From: Andrea Amorese Date: Thu, 23 Dec 2021 14:45:53 +0000 (+0100) Subject: Built motion from commit 3fb43073.|2.5.42 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22https:/fonts.googleapis.com//%22my-avatar.png/%22?a=commitdiff_plain;h=d0f01ec88f7879b3b9d3471c22e5141c804488ee;p=motion2.git Built motion from commit 3fb43073.|2.5.42 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index adaf873..6a385b3 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-23T14:02:33.196Z", + "time": "2021-12-23T14:24:43.662Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7cbe14c..90e3204 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-23T14:02:33.196Z", + "time": "2021-12-23T14:24:43.662Z", "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 56b53e3..f490687 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 _0xa8b4=['browser','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','STRING','motionbar','jscripty','urlForward'];(function(_0x336a76,_0x4ea9bc){var _0x2344b8=function(_0x180401){while(--_0x180401){_0x336a76['push'](_0x336a76['shift']());}};_0x2344b8(++_0x4ea9bc);}(_0xa8b4,0xc4));var _0x4a8b=function(_0xb053b7,_0x3167bc){_0xb053b7=_0xb053b7-0x0;var _0x13ad00=_0xa8b4[_0xb053b7];return _0x13ad00;};'use strict';var Sequelize=require(_0x4a8b('0x0'));module[_0x4a8b('0x1')]={'name':{'type':Sequelize[_0x4a8b('0x2')],'get':function(_0x217bcd){return this[_0x4a8b('0x3')]('action');}},'action':{'type':Sequelize[_0x4a8b('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0x4a8b('0x5'),_0x4a8b('0x6'),_0x4a8b('0x7'),_0x4a8b('0x8'),'bot',_0x4a8b('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x4a8b('0xa')},'data2':{'type':Sequelize[_0x4a8b('0x4')](0x1000),'comment':_0x4a8b('0xb')},'data3':{'type':Sequelize[_0x4a8b('0x4')](0x1000),'comment':_0x4a8b('0xc')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x4a8b('0xd')},'data5':{'type':Sequelize[_0x4a8b('0x4')](0x1000),'comments':_0x4a8b('0xe')},'data6':{'type':Sequelize['STRING'],'comments':_0x4a8b('0xf')},'data7':{'type':Sequelize[_0x4a8b('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x14f1=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','action','STRING','contactManager','integration','urlForward','browser','bot'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x14f1,0x90));var _0x114f=function(_0x1bd794,_0x110fe4){_0x1bd794=_0x1bd794-0x0;var _0x16e8c5=_0x14f1[_0x1bd794];return _0x16e8c5;};'use strict';var Sequelize=require(_0x114f('0x0'));module['exports']={'name':{'type':Sequelize[_0x114f('0x1')],'get':function(_0x206991){return this['getDataValue'](_0x114f('0x2'));}},'action':{'type':Sequelize[_0x114f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x114f('0x4'),_0x114f('0x5'),'motionbar','jscripty',_0x114f('0x6'),_0x114f('0x7'),_0x114f('0x8'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x114f('0x9')},'data1':{'type':Sequelize[_0x114f('0x3')](0x1000),'comment':_0x114f('0xa')},'data2':{'type':Sequelize[_0x114f('0x3')](0x1000),'comment':_0x114f('0xb')},'data3':{'type':Sequelize[_0x114f('0x3')](0x1000),'comment':_0x114f('0xc')},'data4':{'type':Sequelize[_0x114f('0x3')](0x1000),'comments':_0x114f('0xd')},'data5':{'type':Sequelize[_0x114f('0x3')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x114f('0x3')],'comments':_0x114f('0xe')},'data7':{'type':Sequelize[_0x114f('0xf')],'comments':_0x114f('0x10')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 391f07b..bf0a857 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 _0x5943=['apply','reject','save','update','then','error','name','send','body','params','catch','Action','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','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','offset','count','limit','Content-Range','json'];(function(_0x426433,_0x2613d8){var _0x5ddee4=function(_0x20ea2a){while(--_0x20ea2a){_0x426433['push'](_0x426433['shift']());}};_0x5ddee4(++_0x2613d8);}(_0x5943,0x17d));var _0x3594=function(_0x585392,_0x26e6a5){_0x585392=_0x585392-0x0;var _0x4b54a7=_0x5943[_0x585392];return _0x4b54a7;};'use strict';var emlformat=require(_0x3594('0x0'));var rimraf=require(_0x3594('0x1'));var zipdir=require(_0x3594('0x2'));var jsonpatch=require(_0x3594('0x3'));var rp=require(_0x3594('0x4'));var moment=require(_0x3594('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3594('0x6'));var util=require(_0x3594('0x7'));var path=require('path');var sox=require(_0x3594('0x8'));var csv=require(_0x3594('0x9'));var ejs=require(_0x3594('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3594('0xb'));var squel=require('squel');var crypto=require(_0x3594('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3594('0x9'));var querystring=require(_0x3594('0xd'));var Papa=require(_0x3594('0xe'));var Redis=require(_0x3594('0xf'));var authService=require(_0x3594('0x10'));var qs=require(_0x3594('0x11'));var as=require(_0x3594('0x12'));var hardwareService=require(_0x3594('0x13'));var logger=require(_0x3594('0x14'))(_0x3594('0x15'));var utils=require(_0x3594('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3594('0x17'));var db=require(_0x3594('0x18'))['db'];function respondWithStatusCode(_0x268bc3,_0x1abe0a){_0x1abe0a=_0x1abe0a||0xcc;return function(_0x50130c){if(_0x50130c){return _0x268bc3[_0x3594('0x19')](_0x1abe0a);}return _0x268bc3[_0x3594('0x1a')](_0x1abe0a)[_0x3594('0x1b')]();};}function respondWithResult(_0x364437,_0x54005c){_0x54005c=_0x54005c||0xc8;return function(_0x3dfa58){if(_0x3dfa58){return _0x364437['status'](_0x54005c)['json'](_0x3dfa58);}};}function respondWithFilteredResult(_0x72e995,_0x5bd0b6){return function(_0x15f2e4){if(_0x15f2e4){var _0x772d10=typeof _0x5bd0b6[_0x3594('0x1c')]==='undefined'&&typeof _0x5bd0b6['limit']==='undefined';var _0x232078=_0x15f2e4[_0x3594('0x1d')];var _0x59db07=_0x772d10?0x0:_0x5bd0b6[_0x3594('0x1c')];var _0xbe46b2=_0x772d10?_0x15f2e4[_0x3594('0x1d')]:_0x5bd0b6['offset']+_0x5bd0b6[_0x3594('0x1e')];var _0x20565e;if(_0xbe46b2>=_0x232078){_0xbe46b2=_0x232078;_0x20565e=0xc8;}else{_0x20565e=0xce;}_0x72e995[_0x3594('0x1a')](_0x20565e);return _0x72e995['set'](_0x3594('0x1f'),_0x59db07+'-'+_0xbe46b2+'/'+_0x232078)[_0x3594('0x20')](_0x15f2e4);}return null;};}function patchUpdates(_0x516dc0){return function(_0x55729e){try{jsonpatch[_0x3594('0x21')](_0x55729e,_0x516dc0,!![]);}catch(_0x2fe3c7){return BPromise[_0x3594('0x22')](_0x2fe3c7);}return _0x55729e[_0x3594('0x23')]();};}function saveUpdates(_0xf62e63,_0x2f1e90){return function(_0x3353f0){if(_0x3353f0){return _0x3353f0[_0x3594('0x24')](_0xf62e63)[_0x3594('0x25')](function(_0x1e9cf8){return _0x1e9cf8;});}return null;};}function removeEntity(_0x43c766,_0x28ee2f){return function(_0x4d08c7){if(_0x4d08c7){return _0x4d08c7['destroy']()[_0x3594('0x25')](function(){_0x43c766[_0x3594('0x1a')](0xcc)[_0x3594('0x1b')]();});}};}function handleEntityNotFound(_0x92d0ce,_0x54d84b){return function(_0x578df8){if(!_0x578df8){_0x92d0ce[_0x3594('0x19')](0x194);}return _0x578df8;};}function handleError(_0x4e9924,_0x353c1d){_0x353c1d=_0x353c1d||0x1f4;return function(_0x245403){logger[_0x3594('0x26')](_0x245403['stack']);if(_0x245403[_0x3594('0x27')]){delete _0x245403['name'];}_0x4e9924[_0x3594('0x1a')](_0x353c1d)[_0x3594('0x28')](_0x245403);};}exports['update']=function(_0x1df215,_0x474e7d){if(_0x1df215['body']['id']){delete _0x1df215[_0x3594('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0x1df215[_0x3594('0x2a')]['id']}})['then'](handleEntityNotFound(_0x474e7d,null))[_0x3594('0x25')](saveUpdates(_0x1df215['body'],null))[_0x3594('0x25')](respondWithResult(_0x474e7d,null))[_0x3594('0x2b')](handleError(_0x474e7d,null));};exports['destroy']=function(_0xfab7a2,_0x3ee123){return db[_0x3594('0x2c')][_0x3594('0x2d')]({'where':{'id':_0xfab7a2['params']['id']}})[_0x3594('0x25')](handleEntityNotFound(_0x3ee123,null))['then'](removeEntity(_0x3ee123,null))[_0x3594('0x2b')](handleError(_0x3ee123,null));}; \ No newline at end of file +var _0x2345=['update','then','destroy','error','name','send','body','Action','find','params','catch','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0x70c8cd,_0x21fbd3){var _0x26859a=function(_0x1793c2){while(--_0x1793c2){_0x70c8cd['push'](_0x70c8cd['shift']());}};_0x26859a(++_0x21fbd3);}(_0x2345,0x6b));var _0x5234=function(_0x31df89,_0x51dd23){_0x31df89=_0x31df89-0x0;var _0x30d3f5=_0x2345[_0x31df89];return _0x30d3f5;};'use strict';var emlformat=require(_0x5234('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5234('0x1'));var rp=require('request-promise');var moment=require(_0x5234('0x2'));var BPromise=require(_0x5234('0x3'));var Mustache=require(_0x5234('0x4'));var util=require(_0x5234('0x5'));var path=require(_0x5234('0x6'));var sox=require(_0x5234('0x7'));var csv=require(_0x5234('0x8'));var ejs=require(_0x5234('0x9'));var fs=require('fs');var fs_extra=require(_0x5234('0xa'));var _=require(_0x5234('0xb'));var squel=require(_0x5234('0xc'));var crypto=require('crypto');var jsforce=require(_0x5234('0xd'));var deskjs=require(_0x5234('0xe'));var toCsv=require(_0x5234('0x8'));var querystring=require(_0x5234('0xf'));var Papa=require(_0x5234('0x10'));var Redis=require(_0x5234('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5234('0x12'));var as=require(_0x5234('0x13'));var hardwareService=require(_0x5234('0x14'));var logger=require(_0x5234('0x15'))(_0x5234('0x16'));var utils=require(_0x5234('0x17'));var config=require(_0x5234('0x18'));var licenseUtil=require(_0x5234('0x19'));var db=require(_0x5234('0x1a'))['db'];function respondWithStatusCode(_0x258e9f,_0x106a13){_0x106a13=_0x106a13||0xcc;return function(_0x5ae7e1){if(_0x5ae7e1){return _0x258e9f[_0x5234('0x1b')](_0x106a13);}return _0x258e9f['status'](_0x106a13)[_0x5234('0x1c')]();};}function respondWithResult(_0x5475cc,_0x4b48e9){_0x4b48e9=_0x4b48e9||0xc8;return function(_0x1f876f){if(_0x1f876f){return _0x5475cc[_0x5234('0x1d')](_0x4b48e9)[_0x5234('0x1e')](_0x1f876f);}};}function respondWithFilteredResult(_0x5bcfcf,_0x176c1e){return function(_0x3a8d8c){if(_0x3a8d8c){var _0x2dca32=typeof _0x176c1e[_0x5234('0x1f')]===_0x5234('0x20')&&typeof _0x176c1e['limit']===_0x5234('0x20');var _0x2aa4c9=_0x3a8d8c[_0x5234('0x21')];var _0x3420a4=_0x2dca32?0x0:_0x176c1e['offset'];var _0x1aa42c=_0x2dca32?_0x3a8d8c['count']:_0x176c1e[_0x5234('0x1f')]+_0x176c1e[_0x5234('0x22')];var _0x4052eb;if(_0x1aa42c>=_0x2aa4c9){_0x1aa42c=_0x2aa4c9;_0x4052eb=0xc8;}else{_0x4052eb=0xce;}_0x5bcfcf[_0x5234('0x1d')](_0x4052eb);return _0x5bcfcf['set'](_0x5234('0x23'),_0x3420a4+'-'+_0x1aa42c+'/'+_0x2aa4c9)[_0x5234('0x1e')](_0x3a8d8c);}return null;};}function patchUpdates(_0x3db892){return function(_0x19725a){try{jsonpatch[_0x5234('0x24')](_0x19725a,_0x3db892,!![]);}catch(_0x2b24b5){return BPromise['reject'](_0x2b24b5);}return _0x19725a['save']();};}function saveUpdates(_0xed6364,_0x1da583){return function(_0x1ae648){if(_0x1ae648){return _0x1ae648[_0x5234('0x25')](_0xed6364)[_0x5234('0x26')](function(_0x4d98bc){return _0x4d98bc;});}return null;};}function removeEntity(_0x40c892,_0x8b3dd4){return function(_0x3a8cc1){if(_0x3a8cc1){return _0x3a8cc1[_0x5234('0x27')]()[_0x5234('0x26')](function(){_0x40c892['status'](0xcc)[_0x5234('0x1c')]();});}};}function handleEntityNotFound(_0x306b42,_0x3c7706){return function(_0x33779a){if(!_0x33779a){_0x306b42[_0x5234('0x1b')](0x194);}return _0x33779a;};}function handleError(_0x1c6557,_0x1614db){_0x1614db=_0x1614db||0x1f4;return function(_0x2e33a1){logger[_0x5234('0x28')](_0x2e33a1['stack']);if(_0x2e33a1[_0x5234('0x29')]){delete _0x2e33a1[_0x5234('0x29')];}_0x1c6557[_0x5234('0x1d')](_0x1614db)[_0x5234('0x2a')](_0x2e33a1);};}exports['update']=function(_0x181963,_0x39463a){if(_0x181963['body']['id']){delete _0x181963[_0x5234('0x2b')]['id'];}return db[_0x5234('0x2c')][_0x5234('0x2d')]({'where':{'id':_0x181963[_0x5234('0x2e')]['id']}})[_0x5234('0x26')](handleEntityNotFound(_0x39463a,null))['then'](saveUpdates(_0x181963[_0x5234('0x2b')],null))[_0x5234('0x26')](respondWithResult(_0x39463a,null))[_0x5234('0x2f')](handleError(_0x39463a,null));};exports[_0x5234('0x27')]=function(_0x193c7f,_0x19709b){return db[_0x5234('0x2c')]['find']({'where':{'id':_0x193c7f[_0x5234('0x2e')]['id']}})['then'](handleEntityNotFound(_0x19709b,null))[_0x5234('0x26')](removeEntity(_0x19709b,null))['catch'](handleError(_0x19709b,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index bed77cb..7f6096f 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 _0xe2c8=['rimraf','../../config/environment','exports','define','Action','lodash','../../config/logger','request-promise','path'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xe2c8,0x8c));var _0x8e2c=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xe2c8[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x8e2c('0x0'));var util=require('util');var logger=require(_0x8e2c('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8e2c('0x2'));var fs=require('fs');var path=require(_0x8e2c('0x3'));var rimraf=require(_0x8e2c('0x4'));var config=require(_0x8e2c('0x5'));var attributes=require('./action.attributes');module[_0x8e2c('0x6')]=function(_0x1257d4,_0x3e5130){return _0x1257d4[_0x8e2c('0x7')](_0x8e2c('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a0b=['path','rimraf','./action.attributes','exports','define','Action','tools_actions','lodash','api','moment','request-promise'];(function(_0x3856b3,_0x20d6fe){var _0xdbb85a=function(_0x53b738){while(--_0x53b738){_0x3856b3['push'](_0x3856b3['shift']());}};_0xdbb85a(++_0x20d6fe);}(_0x9a0b,0x125));var _0xb9a0=function(_0xa7b7d8,_0x10150a){_0xa7b7d8=_0xa7b7d8-0x0;var _0xf4146e=_0x9a0b[_0xa7b7d8];return _0xf4146e;};'use strict';var _=require(_0xb9a0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb9a0('0x1'));var moment=require(_0xb9a0('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9a0('0x3'));var fs=require('fs');var path=require(_0xb9a0('0x4'));var rimraf=require(_0xb9a0('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9a0('0x6'));module[_0xb9a0('0x7')]=function(_0x4e9e29,_0x2dedc7){return _0x4e9e29[_0xb9a0('0x8')](_0xb9a0('0x9'),attributes,{'tableName':_0xb9a0('0xa'),'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 7a442af..eeb14c0 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(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0x53ec,0x192));var _0xc53e=function(_0x51fb3c,_0x28a763){_0x51fb3c=_0x51fb3c-0x0;var _0x941d96=_0x53ec[_0x51fb3c];return _0x941d96;};'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 _0xe14b=['../../config/environment','jayson/promise','client','http','then','info','Action,\x20%s,\x20%s','Action,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils'];(function(_0x688b12,_0x401970){var _0x1b45aa=function(_0x15f239){while(--_0x15f239){_0x688b12['push'](_0x688b12['shift']());}};_0x1b45aa(++_0x401970);}(_0xe14b,0x93));var _0xbe14=function(_0x1791c7,_0x3b0033){_0x1791c7=_0x1791c7-0x0;var _0x155d75=_0xe14b[_0x1791c7];return _0x155d75;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 5f390bc..dce2aa8 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 _0x0f1c=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','update','delete','isAuthenticated','destroy','exports'];(function(_0x1138f5,_0x48435e){var _0xbe8e44=function(_0x324a75){while(--_0x324a75){_0x1138f5['push'](_0x1138f5['shift']());}};_0xbe8e44(++_0x48435e);}(_0x0f1c,0x96));var _0xc0f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0f1c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc0f1('0x0'));var util=require(_0xc0f1('0x1'));var path=require('path');var timeout=require(_0xc0f1('0x2'));var express=require(_0xc0f1('0x3'));var router=express['Router']();var fs_extra=require(_0xc0f1('0x4'));var auth=require(_0xc0f1('0x5'));var interaction=require(_0xc0f1('0x6'));var config=require(_0xc0f1('0x7'));var controller=require(_0xc0f1('0x8'));router['put'](_0xc0f1('0x9'),auth['isAuthenticated'](),controller[_0xc0f1('0xa')]);router[_0xc0f1('0xb')](_0xc0f1('0x9'),auth[_0xc0f1('0xc')](),controller[_0xc0f1('0xd')]);module[_0xc0f1('0xe')]=router; \ No newline at end of file +var _0x6203=['delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6203,0xc5));var _0x3620=function(_0x22bef1,_0x2d2adb){_0x22bef1=_0x22bef1-0x0;var _0x9b0f2e=_0x6203[_0x22bef1];return _0x9b0f2e;};'use strict';var multer=require(_0x3620('0x0'));var util=require('util');var path=require(_0x3620('0x1'));var timeout=require(_0x3620('0x2'));var express=require(_0x3620('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3620('0x4'));var interaction=require(_0x3620('0x5'));var config=require(_0x3620('0x6'));var controller=require('./action.controller');router[_0x3620('0x7')](_0x3620('0x8'),auth[_0x3620('0x9')](),controller[_0x3620('0xa')]);router[_0x3620('0xb')](_0x3620('0x8'),auth[_0x3620('0x9')](),controller['destroy']);module[_0x3620('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 86c6b46..772503e 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 _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x108b5d,_0x2b39d9){var _0x1d2d24=function(_0x5b0f19){while(--_0x5b0f19){_0x108b5d['push'](_0x108b5d['shift']());}};_0x1d2d24(++_0x2b39d9);}(_0xb138,0x1dd));var _0x8b13=function(_0x3fa3f5,_0x103f66){_0x3fa3f5=_0x3fa3f5-0x0;var _0x16874c=_0xb138[_0x3fa3f5];return _0x16874c;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x44caf2,_0x8ffb16){var _0x25978d=function(_0x1a2e61){while(--_0x1a2e61){_0x44caf2['push'](_0x44caf2['shift']());}};_0x25978d(++_0x8ffb16);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xfdbd[_0x58dc25];return _0x21b0a7;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2fcf15a..9039ec8 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 _0x0a5f=['SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','replace','format','groupBy','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','IS\x20NOT\x20EMPTY','Sequelize','ValidationErrorItem','alias','output','web','fullPath','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','run','runReport','eml-format','rimraf','zip-dir','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','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','CustomReports','UserProfileResource','sendStatus','stack','name','send','index','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','AnalyticCustomReport','includeAll','findAll','rows','catch','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join'];(function(_0x246890,_0x46b964){var _0x2b2a5a=function(_0x4f1232){while(--_0x4f1232){_0x246890['push'](_0x246890['shift']());}};_0x2b2a5a(++_0x46b964);}(_0x0a5f,0x192));var _0xf0a5=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0a5f[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xf0a5('0x0'));var rimraf=require(_0xf0a5('0x1'));var zipdir=require(_0xf0a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0a5('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf0a5('0x4'));var util=require(_0xf0a5('0x5'));var path=require(_0xf0a5('0x6'));var sox=require('sox');var csv=require(_0xf0a5('0x7'));var ejs=require(_0xf0a5('0x8'));var fs=require('fs');var fs_extra=require(_0xf0a5('0x9'));var _=require('lodash');var squel=require(_0xf0a5('0xa'));var crypto=require(_0xf0a5('0xb'));var jsforce=require(_0xf0a5('0xc'));var deskjs=require(_0xf0a5('0xd'));var toCsv=require(_0xf0a5('0x7'));var querystring=require(_0xf0a5('0xe'));var Papa=require(_0xf0a5('0xf'));var Redis=require(_0xf0a5('0x10'));var authService=require(_0xf0a5('0x11'));var qs=require(_0xf0a5('0x12'));var as=require(_0xf0a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0a5('0x14'));var utils=require(_0xf0a5('0x15'));var config=require(_0xf0a5('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0xf0a5('0x17'))['dbH'];function respondWithStatusCode(_0x465c3e,_0x2d2f37){_0x2d2f37=_0x2d2f37||0xcc;return function(_0x579b57){if(_0x579b57){return _0x465c3e['sendStatus'](_0x2d2f37);}return _0x465c3e[_0xf0a5('0x18')](_0x2d2f37)[_0xf0a5('0x19')]();};}function respondWithResult(_0x86a4c,_0x2305e6){_0x2305e6=_0x2305e6||0xc8;return function(_0x5eaaa6){if(_0x5eaaa6){return _0x86a4c[_0xf0a5('0x18')](_0x2305e6)[_0xf0a5('0x1a')](_0x5eaaa6);}};}function respondWithFilteredResult(_0xfe660e,_0x477529){return function(_0x432e4f){if(_0x432e4f){var _0x36f558=typeof _0x477529[_0xf0a5('0x1b')]===_0xf0a5('0x1c')&&typeof _0x477529[_0xf0a5('0x1d')]===_0xf0a5('0x1c');var _0x1e4b8e=_0x432e4f[_0xf0a5('0x1e')];var _0x51d9af=_0x36f558?0x0:_0x477529[_0xf0a5('0x1b')];var _0x16c654=_0x36f558?_0x432e4f['count']:_0x477529['offset']+_0x477529[_0xf0a5('0x1d')];var _0x4a7c0b;if(_0x16c654>=_0x1e4b8e){_0x16c654=_0x1e4b8e;_0x4a7c0b=0xc8;}else{_0x4a7c0b=0xce;}_0xfe660e[_0xf0a5('0x18')](_0x4a7c0b);return _0xfe660e[_0xf0a5('0x1f')](_0xf0a5('0x20'),_0x51d9af+'-'+_0x16c654+'/'+_0x1e4b8e)['json'](_0x432e4f);}return null;};}function patchUpdates(_0x4ddd15){return function(_0x541bde){try{jsonpatch[_0xf0a5('0x21')](_0x541bde,_0x4ddd15,!![]);}catch(_0x34e2a4){return BPromise[_0xf0a5('0x22')](_0x34e2a4);}return _0x541bde['save']();};}function saveUpdates(_0x51a44c,_0x2f0980){return function(_0x21d579){if(_0x21d579){return _0x21d579[_0xf0a5('0x23')](_0x51a44c)[_0xf0a5('0x24')](function(_0x415ec2){return _0x415ec2;});}return null;};}function removeEntity(_0xd8b72e,_0x150a39){return function(_0x39aaac){if(_0x39aaac){return _0x39aaac[_0xf0a5('0x25')]()[_0xf0a5('0x24')](function(){var _0x12d773=_0x39aaac['get']({'plain':!![]});var _0x5c5b6e=_0xf0a5('0x26');return db[_0xf0a5('0x27')][_0xf0a5('0x25')]({'where':{'type':_0x5c5b6e,'resourceId':_0x12d773['id']}})[_0xf0a5('0x24')](function(){return _0x39aaac;});})['then'](function(){_0xd8b72e['status'](0xcc)[_0xf0a5('0x19')]();});}};}function handleEntityNotFound(_0x2a7a4e,_0x10a156){return function(_0x1281ee){if(!_0x1281ee){_0x2a7a4e[_0xf0a5('0x28')](0x194);}return _0x1281ee;};}function handleError(_0x199260,_0x361ab2){_0x361ab2=_0x361ab2||0x1f4;return function(_0x3f3db6){logger['error'](_0x3f3db6[_0xf0a5('0x29')]);if(_0x3f3db6[_0xf0a5('0x2a')]){delete _0x3f3db6[_0xf0a5('0x2a')];}_0x199260[_0xf0a5('0x18')](_0x361ab2)[_0xf0a5('0x2b')](_0x3f3db6);};}exports[_0xf0a5('0x2c')]=function(_0x478b7e,_0x42de00){var _0x11df05={},_0x40580b={},_0x40cda8={'count':0x0,'rows':[]};var _0x4995fb=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x371cf2){return{'name':_0x371cf2[_0xf0a5('0x2d')],'type':_0x371cf2['type']['key']};});_0x40580b[_0xf0a5('0x2e')]=_[_0xf0a5('0x2f')](_0x4995fb,'name');_0x40580b[_0xf0a5('0x30')]=_[_0xf0a5('0x31')](_0x478b7e[_0xf0a5('0x30')]);_0x40580b['filters']=_[_0xf0a5('0x32')](_0x40580b[_0xf0a5('0x2e')],_0x40580b[_0xf0a5('0x30')]);_0x11df05[_0xf0a5('0x33')]=_[_0xf0a5('0x32')](_0x40580b[_0xf0a5('0x2e')],qs[_0xf0a5('0x34')](_0x478b7e[_0xf0a5('0x30')][_0xf0a5('0x34')]));_0x11df05['attributes']=_0x11df05[_0xf0a5('0x33')][_0xf0a5('0x35')]?_0x11df05[_0xf0a5('0x33')]:_0x40580b[_0xf0a5('0x2e')];if(!_0x478b7e['query'][_0xf0a5('0x36')](_0xf0a5('0x37'))){_0x11df05['limit']=qs[_0xf0a5('0x1d')](_0x478b7e['query'][_0xf0a5('0x1d')]);_0x11df05['offset']=qs[_0xf0a5('0x1b')](_0x478b7e[_0xf0a5('0x30')][_0xf0a5('0x1b')]);}_0x11df05[_0xf0a5('0x38')]=qs['sort'](_0x478b7e[_0xf0a5('0x30')][_0xf0a5('0x39')]);_0x11df05[_0xf0a5('0x3a')]=qs[_0xf0a5('0x3b')](_[_0xf0a5('0x3c')](_0x478b7e[_0xf0a5('0x30')],_0x40580b[_0xf0a5('0x3b')]),_0x4995fb);if(_0x478b7e[_0xf0a5('0x30')]['filter']){_0x11df05['where']=_['merge'](_0x11df05[_0xf0a5('0x3a')],{'$or':_[_0xf0a5('0x2f')](_0x4995fb,function(_0x17a7cc){if(_0x17a7cc['type']!==_0xf0a5('0x3d')){var _0x51a61b={};_0x51a61b[_0x17a7cc[_0xf0a5('0x2a')]]={'$like':'%'+_0x478b7e[_0xf0a5('0x30')]['filter']+'%'};return _0x51a61b;}})});}_0x11df05=_[_0xf0a5('0x3e')]({},_0x11df05,_0x478b7e[_0xf0a5('0x3f')]);var _0x1f503c={'where':_0x11df05[_0xf0a5('0x3a')]};return db[_0xf0a5('0x40')][_0xf0a5('0x1e')](_0x1f503c)[_0xf0a5('0x24')](function(_0x56bb8a){_0x40cda8[_0xf0a5('0x1e')]=_0x56bb8a;if(_0x478b7e[_0xf0a5('0x30')][_0xf0a5('0x41')]){_0x11df05['include']=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xf0a5('0x42')](_0x11df05);})[_0xf0a5('0x24')](function(_0x4fe734){_0x40cda8[_0xf0a5('0x43')]=_0x4fe734;return _0x40cda8;})[_0xf0a5('0x24')](respondWithFilteredResult(_0x42de00,_0x11df05))[_0xf0a5('0x44')](handleError(_0x42de00,null));};exports['show']=function(_0x4e0555,_0xf02b75){var _0x378a09={'raw':![],'where':{'id':_0x4e0555[_0xf0a5('0x45')]['id']}},_0x10cb6e={};_0x10cb6e[_0xf0a5('0x2e')]=_[_0xf0a5('0x31')](db['AnalyticCustomReport'][_0xf0a5('0x46')]);_0x10cb6e[_0xf0a5('0x30')]=_[_0xf0a5('0x31')](_0x4e0555[_0xf0a5('0x30')]);_0x10cb6e['filters']=_['intersection'](_0x10cb6e[_0xf0a5('0x2e')],_0x10cb6e[_0xf0a5('0x30')]);_0x378a09[_0xf0a5('0x33')]=_['intersection'](_0x10cb6e[_0xf0a5('0x2e')],qs[_0xf0a5('0x34')](_0x4e0555[_0xf0a5('0x30')][_0xf0a5('0x34')]));_0x378a09[_0xf0a5('0x33')]=_0x378a09['attributes'][_0xf0a5('0x35')]?_0x378a09[_0xf0a5('0x33')]:_0x10cb6e[_0xf0a5('0x2e')];if(_0x4e0555[_0xf0a5('0x30')][_0xf0a5('0x41')]){_0x378a09[_0xf0a5('0x47')]=[{'all':!![]}];}_0x378a09=_['merge']({},_0x378a09,_0x4e0555['options']);return db[_0xf0a5('0x40')][_0xf0a5('0x48')](_0x378a09)[_0xf0a5('0x24')](handleEntityNotFound(_0xf02b75,null))[_0xf0a5('0x24')](respondWithResult(_0xf02b75,null))[_0xf0a5('0x44')](handleError(_0xf02b75,null));};exports[_0xf0a5('0x49')]=function(_0x4a1266,_0x1cd22c){return db['AnalyticCustomReport'][_0xf0a5('0x49')](_0x4a1266[_0xf0a5('0x4a')],{})['then'](function(_0x525755){var _0x36e36d=_0x4a1266[_0xf0a5('0x4b')]['get']({'plain':!![]});if(!_0x36e36d)throw new Error(_0xf0a5('0x4c'));if(_0x36e36d[_0xf0a5('0x4d')]===_0xf0a5('0x4b')){var _0x3ac758=_0x525755[_0xf0a5('0x4e')]({'plain':!![]});var _0x492334='Reports';return db[_0xf0a5('0x4f')]['find']({'where':{'name':_0x492334,'userProfileId':_0x36e36d['userProfileId']},'raw':!![]})[_0xf0a5('0x24')](function(_0x4d648f){if(_0x4d648f&&_0x4d648f['autoAssociation']===0x0){return db[_0xf0a5('0x27')][_0xf0a5('0x49')]({'name':_0x3ac758[_0xf0a5('0x2a')],'resourceId':_0x3ac758['id'],'type':_0xf0a5('0x26'),'sectionId':_0x4d648f['id']},{})[_0xf0a5('0x24')](function(){return _0x525755;});}else{return _0x525755;}})[_0xf0a5('0x44')](function(_0x5499ed){logger[_0xf0a5('0x50')](_0xf0a5('0x51'),_0x5499ed);throw _0x5499ed;});}return _0x525755;})['then'](respondWithResult(_0x1cd22c,0xc9))[_0xf0a5('0x44')](handleError(_0x1cd22c,null));};exports[_0xf0a5('0x23')]=function(_0x4585db,_0xf97337){if(_0x4585db['body']['id']){delete _0x4585db['body']['id'];}return db[_0xf0a5('0x40')][_0xf0a5('0x48')]({'where':{'id':_0x4585db['params']['id']}})['then'](handleEntityNotFound(_0xf97337,null))[_0xf0a5('0x24')](saveUpdates(_0x4585db[_0xf0a5('0x4a')],null))['then'](respondWithResult(_0xf97337,null))[_0xf0a5('0x44')](handleError(_0xf97337,null));};exports[_0xf0a5('0x25')]=function(_0x159cc9,_0x2fc8fb){return db[_0xf0a5('0x40')][_0xf0a5('0x48')]({'where':{'id':_0x159cc9[_0xf0a5('0x45')]['id']}})[_0xf0a5('0x24')](handleEntityNotFound(_0x2fc8fb,null))[_0xf0a5('0x24')](removeEntity(_0x2fc8fb,null))['catch'](handleError(_0x2fc8fb,null));};exports[_0xf0a5('0x52')]=function(_0x5c841c,_0x513473){var _0x1983b2=0xa;var _0x4dc52b=[_0xf0a5('0x53'),_0xf0a5('0x54'),_0xf0a5('0x55'),_0xf0a5('0x56')];var _0x3bff7b={'SUM':_0xf0a5('0x57'),'COUNT':_0xf0a5('0x58'),'COUNT DISTINCT':_0xf0a5('0x59'),'MAX':_0xf0a5('0x5a'),'MIN':'MIN(%s)','AVG':_0xf0a5('0x5b'),'GROUP_CONCAT':_0xf0a5('0x5c'),'GROUP_CONCAT ASC':_0xf0a5('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x1f4910={'SEC_TO_TIME':_0xf0a5('0x5e'),'DATE':_0xf0a5('0x5f'),'HOUR':_0xf0a5('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf0a5('0x61')};var _0x53b619=function(_0x225efa){return!_[_0xf0a5('0x62')]([_0xf0a5('0x63'),_0xf0a5('0x64'),_0xf0a5('0x65'),'IS\x20NOT\x20EMPTY'],_0x225efa);};var _0x3bc095=function(_0x332b2e){if(!_0x332b2e||!_0x332b2e[_0xf0a5('0x66')][_0xf0a5('0x35')]){return'';}for(var _0xa002ae='(',_0x580bae=0x0;_0x580bae<_0x332b2e[_0xf0a5('0x66')][_0xf0a5('0x35')];_0x580bae+=0x1){_0x580bae>0x0&&(_0xa002ae+='\x20'+_0x332b2e[_0xf0a5('0x67')]+'\x20');_0xa002ae+=_0x332b2e[_0xf0a5('0x66')][_0x580bae][_0xf0a5('0x68')]?_0x3bc095(_0x332b2e[_0xf0a5('0x66')][_0x580bae]['group']):_0x332b2e[_0xf0a5('0x66')][_0x580bae]['field']+'\x20'+_0x332b2e['rules'][_0x580bae][_0xf0a5('0x69')]+(_0x53b619(_0x332b2e[_0xf0a5('0x66')][_0x580bae][_0xf0a5('0x69')])?'\x20'+_0x332b2e[_0xf0a5('0x66')][_0x580bae][_0xf0a5('0x6a')]:'');}return _0xa002ae+')';};var _0x79e599={'where':{'id':_0x5c841c[_0xf0a5('0x45')]['id']}},_0x1b4e15,_0x588d6c,_0x21ba02,_0x36024a,_0x543a83;_0x79e599=_[_0xf0a5('0x3e')]({},_0x79e599,_0x5c841c[_0xf0a5('0x3f')]);return db[_0xf0a5('0x40')][_0xf0a5('0x48')](_0x79e599)[_0xf0a5('0x24')](function(_0x55a150){if(_0x55a150){_0x1b4e15=_0x55a150;return _0x55a150[_0xf0a5('0x6b')]();}return null;})[_0xf0a5('0x24')](function(_0x3f8f91){if(_0x3f8f91){if(!_0x3f8f91[_0xf0a5('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0xf0a5('0x6c'),0x193);}_0x588d6c=_0x3f8f91;return db[_0xf0a5('0x6d')][_0xf0a5('0x42')]({'raw':!![]});}return null;})['then'](function(_0x516ecd){if(_0x516ecd){_0x21ba02=_[_0xf0a5('0x6e')](_0x516ecd,'id');var _0x553699;var _0x1fb04b=squel[_0xf0a5('0x6f')]();_0x1fb04b[_0xf0a5('0x70')](_0x1b4e15[_0xf0a5('0x71')]);for(var _0x7a67bd=0x0;_0x7a67bd<_0x588d6c['length'];_0x7a67bd+=0x1){_0x553699=_0x588d6c[_0x7a67bd][_0xf0a5('0x72')]?_0x21ba02[_0x588d6c[_0x7a67bd][_0xf0a5('0x72')]][_0xf0a5('0x73')]:_0x588d6c[_0x7a67bd][_0xf0a5('0x74')];_0x553699=_0x588d6c[_0x7a67bd][_0xf0a5('0x75')]?_[_0xf0a5('0x76')](_0x3bff7b[_0x588d6c[_0x7a67bd][_0xf0a5('0x75')]],'%s',_0x553699):_0x553699;_0x553699=_0x588d6c[_0x7a67bd][_0xf0a5('0x77')]?_[_0xf0a5('0x76')](_0x1f4910[_0x588d6c[_0x7a67bd][_0xf0a5('0x77')]],'%s',_0x553699):_0x553699;if(_0x588d6c[_0x7a67bd][_0xf0a5('0x78')]){_0x1fb04b['group'](_0x553699);}_0x588d6c[_0x7a67bd][_0xf0a5('0x79')]&&_0x1fb04b[_0xf0a5('0x38')](_0x553699,_0x588d6c[_0x7a67bd][_0xf0a5('0x79')]===_0xf0a5('0x7a')?![]:!![]);_0x1fb04b[_0xf0a5('0x74')](_0x553699,_0x588d6c[_0x7a67bd]['alias']||_0x553699);}if(_0x1b4e15[_0xf0a5('0x7b')]){_0x1b4e15[_0xf0a5('0x7b')]=JSON[_0xf0a5('0x7c')](_0x1b4e15[_0xf0a5('0x7b')]);for(var _0x5622e9=0x0;_0x5622e9<_0x1b4e15[_0xf0a5('0x7b')][_0xf0a5('0x35')];_0x5622e9+=0x1){if(_0x1b4e15['joins'][_0x5622e9][_0xf0a5('0x7d')]&&_[_0xf0a5('0x62')](_0x4dc52b,_0x1b4e15[_0xf0a5('0x7b')][_0x5622e9][_0xf0a5('0x7d')])&&_0x1b4e15['joins'][_0x5622e9][_0xf0a5('0x7e')]&&_0x1b4e15[_0xf0a5('0x7b')][_0x5622e9][_0xf0a5('0x7f')]&&_0x1b4e15['joins'][_0x5622e9][_0xf0a5('0x80')]){_0x1fb04b[_0x1b4e15['joins'][_0x5622e9][_0xf0a5('0x7d')]](_0x1b4e15['joins'][_0x5622e9][_0xf0a5('0x7f')],null,util[_0xf0a5('0x77')](_0xf0a5('0x81'),_0x1b4e15['table'],_0x1b4e15[_0xf0a5('0x7b')][_0x5622e9][_0xf0a5('0x7e')],_0x1b4e15['joins'][_0x5622e9]['foreignTable'],_0x1b4e15[_0xf0a5('0x7b')][_0x5622e9]['foreignKey']));}}}if(_0x1b4e15[_0xf0a5('0x82')]){_0x1b4e15[_0xf0a5('0x82')]=JSON[_0xf0a5('0x7c')](_0x1b4e15[_0xf0a5('0x82')]);_0x1fb04b['where'](_0x3bc095(_0x1b4e15[_0xf0a5('0x82')][_0xf0a5('0x68')]));}_0x543a83=_0x1fb04b[_0xf0a5('0x83')]();_0x1fb04b['limit'](_0x1983b2);_0x1fb04b[_0xf0a5('0x1b')](0x0);logger[_0xf0a5('0x84')](_0xf0a5('0x85'),_0x1fb04b[_0xf0a5('0x86')]());return dbH['sequelize']['query'](_0x1fb04b[_0xf0a5('0x86')](),{'type':dbH[_0xf0a5('0x87')][_0xf0a5('0x88')][_0xf0a5('0x89')]});}})[_0xf0a5('0x24')](respondWithResult(_0x513473,null))['catch'](handleError(_0x513473,null));};function runReport(_0x4f4899,_0x169316,_0x4462c0){var _0x2d0718=_0x169316[_0xf0a5('0x2a')];var _0x299c0b=0xa;var _0x52e585=[_0xf0a5('0x53'),_0xf0a5('0x54'),_0xf0a5('0x55'),_0xf0a5('0x56')];var _0x44deb0={'SUM':_0xf0a5('0x57'),'COUNT':_0xf0a5('0x58'),'COUNT DISTINCT':_0xf0a5('0x59'),'MAX':_0xf0a5('0x5a'),'MIN':_0xf0a5('0x8a'),'AVG':_0xf0a5('0x5b'),'GROUP_CONCAT':_0xf0a5('0x5c'),'GROUP_CONCAT ASC':_0xf0a5('0x5d'),'GROUP_CONCAT DESC':_0xf0a5('0x8b')};var _0x5b13eb={'SEC_TO_TIME':_0xf0a5('0x5e'),'DATE':_0xf0a5('0x5f'),'HOUR':_0xf0a5('0x60'),'ROUND':_0xf0a5('0x8c'),'UNIX_TIMESTAMP':_0xf0a5('0x61')};var _0x466b55=function(_0x1aea53){return!_[_0xf0a5('0x62')]([_0xf0a5('0x63'),_0xf0a5('0x64'),_0xf0a5('0x65'),_0xf0a5('0x8d')],_0x1aea53);};var _0x2f63f2=function(_0x173a39){if(!_0x173a39||!_0x173a39['rules'][_0xf0a5('0x35')]){return'';}for(var _0x337ecc='(',_0x18c2b4=0x0;_0x18c2b4<_0x173a39[_0xf0a5('0x66')][_0xf0a5('0x35')];_0x18c2b4+=0x1){_0x18c2b4>0x0&&(_0x337ecc+='\x20'+_0x173a39[_0xf0a5('0x67')]+'\x20');_0x337ecc+=_0x173a39[_0xf0a5('0x66')][_0x18c2b4][_0xf0a5('0x68')]?_0x2f63f2(_0x173a39[_0xf0a5('0x66')][_0x18c2b4][_0xf0a5('0x68')]):_0x173a39[_0xf0a5('0x66')][_0x18c2b4][_0xf0a5('0x74')]+'\x20'+_0x173a39['rules'][_0x18c2b4][_0xf0a5('0x69')]+(_0x466b55(_0x173a39['rules'][_0x18c2b4][_0xf0a5('0x69')])?'\x20'+_0x173a39[_0xf0a5('0x66')][_0x18c2b4][_0xf0a5('0x6a')]:'');}return _0x337ecc+')';};var _0x37a619={'where':{'id':_0x4f4899['id']}},_0x1f7954,_0x25c362,_0x130c9a,_0x1b6ea7,_0x5b40a4;_0x37a619=_[_0xf0a5('0x3e')]({},_0x37a619,_0x4462c0);return db['AnalyticCustomReport'][_0xf0a5('0x48')](_0x37a619)[_0xf0a5('0x24')](function(_0x30d62a){if(_0x30d62a){_0x1f7954=_0x30d62a;return _0x30d62a[_0xf0a5('0x6b')]();}return null;})[_0xf0a5('0x24')](function(_0x3adad8){if(_0x3adad8){if(!_0x3adad8[_0xf0a5('0x35')]){throw new db[(_0xf0a5('0x8e'))][(_0xf0a5('0x8f'))](_0xf0a5('0x6c'),0x193);}_0x25c362=_0x3adad8;return db[_0xf0a5('0x6d')][_0xf0a5('0x42')]({'raw':!![]});}return null;})[_0xf0a5('0x24')](function(_0x2f40ef){if(_0x2f40ef){_0x130c9a=_[_0xf0a5('0x6e')](_0x2f40ef,'id');var _0x1d56e9;var _0x29a3ec=squel[_0xf0a5('0x6f')]();_0x29a3ec[_0xf0a5('0x70')](_0x1f7954[_0xf0a5('0x71')]);for(var _0x2a3c90=0x0;_0x2a3c90<_0x25c362[_0xf0a5('0x35')];_0x2a3c90+=0x1){_0x1d56e9=_0x25c362[_0x2a3c90]['MetricId']?_0x130c9a[_0x25c362[_0x2a3c90][_0xf0a5('0x72')]][_0xf0a5('0x73')]:_0x25c362[_0x2a3c90][_0xf0a5('0x74')];_0x1d56e9=_0x25c362[_0x2a3c90][_0xf0a5('0x75')]?_[_0xf0a5('0x76')](_0x44deb0[_0x25c362[_0x2a3c90][_0xf0a5('0x75')]],'%s',_0x1d56e9):_0x1d56e9;_0x1d56e9=_0x25c362[_0x2a3c90][_0xf0a5('0x77')]?_[_0xf0a5('0x76')](_0x5b13eb[_0x25c362[_0x2a3c90][_0xf0a5('0x77')]],'%s',_0x1d56e9):_0x1d56e9;if(_0x25c362[_0x2a3c90][_0xf0a5('0x78')]){_0x29a3ec[_0xf0a5('0x68')](_0x1d56e9);}_0x25c362[_0x2a3c90]['orderBy']&&_0x29a3ec[_0xf0a5('0x38')](_0x1d56e9,_0x25c362[_0x2a3c90]['orderBy']===_0xf0a5('0x7a')?![]:!![]);_0x29a3ec[_0xf0a5('0x74')](_0x1d56e9,_0x25c362[_0x2a3c90][_0xf0a5('0x90')]||_0x1d56e9);}if(_0x1f7954[_0xf0a5('0x7b')]){_0x1f7954['joins']=JSON[_0xf0a5('0x7c')](_0x1f7954[_0xf0a5('0x7b')]);for(var _0x590db6=0x0;_0x590db6<_0x1f7954[_0xf0a5('0x7b')][_0xf0a5('0x35')];_0x590db6+=0x1){if(_0x1f7954['joins'][_0x590db6][_0xf0a5('0x7d')]&&_[_0xf0a5('0x62')](_0x52e585,_0x1f7954[_0xf0a5('0x7b')][_0x590db6][_0xf0a5('0x7d')])&&_0x1f7954['joins'][_0x590db6][_0xf0a5('0x7e')]&&_0x1f7954[_0xf0a5('0x7b')][_0x590db6][_0xf0a5('0x7f')]&&_0x1f7954['joins'][_0x590db6][_0xf0a5('0x80')]){_0x29a3ec[_0x1f7954[_0xf0a5('0x7b')][_0x590db6]['type']](_0x1f7954[_0xf0a5('0x7b')][_0x590db6][_0xf0a5('0x7f')],null,util[_0xf0a5('0x77')](_0xf0a5('0x81'),_0x1f7954[_0xf0a5('0x71')],_0x1f7954[_0xf0a5('0x7b')][_0x590db6][_0xf0a5('0x7e')],_0x1f7954[_0xf0a5('0x7b')][_0x590db6][_0xf0a5('0x7f')],_0x1f7954[_0xf0a5('0x7b')][_0x590db6]['foreignKey']));}}}if(_0x1f7954[_0xf0a5('0x82')]){_0x1f7954[_0xf0a5('0x82')]=JSON[_0xf0a5('0x7c')](_0x1f7954[_0xf0a5('0x82')]);_0x29a3ec[_0xf0a5('0x3a')](_0x2f63f2(_0x1f7954[_0xf0a5('0x82')]['group']));}_0x5b40a4=_0x29a3ec[_0xf0a5('0x83')]();_0x29a3ec[_0xf0a5('0x1d')](_0x299c0b);_0x29a3ec['offset'](0x0);return;}})[_0xf0a5('0x24')](function(){if(_0x169316[_0xf0a5('0x91')]===_0xf0a5('0x92')){return null;}var _0x23a7ec=_[_0xf0a5('0x3e')](_0x169316,{'name':_0x169316[_0xf0a5('0x93')]||_0x169316[_0xf0a5('0x2a')]||_0x1f7954[_0xf0a5('0x2a')],'basename':_0x2d0718,'savename':util[_0xf0a5('0x77')](_0xf0a5('0x94'),_0x169316[_0xf0a5('0x2a')]||_0x1f7954[_0xf0a5('0x2a')],require(_0xf0a5('0x95'))[_0xf0a5('0x96')](0x4),_0x169316[_0xf0a5('0x91')]||'csv'),'reportId':_0x1f7954['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xf0a5('0x49')](_0x23a7ec,{'raw':!![]});})[_0xf0a5('0x24')](function(_0x255ba9){if(_0x1f7954[_0xf0a5('0x71')]===_0xf0a5('0x97')){_0x5b40a4[_0xf0a5('0x3a')](_0x1f7954['table']+_0xf0a5('0x98'),_0x169316['startDate'],_0x169316['endDate']);}else{_0x5b40a4[_0xf0a5('0x3a')](_0x1f7954[_0xf0a5('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x169316['startDate'],_0x169316[_0xf0a5('0x99')]);}if(_0x255ba9){logger['info'](_0xf0a5('0x9a'),_0x5b40a4[_0xf0a5('0x86')]());require(_0xf0a5('0x9b'))[_0xf0a5('0x9c')](path[_0xf0a5('0x53')](__dirname,_0xf0a5('0x9d'),_0x255ba9['output']),[_0x255ba9['id'],_0x5b40a4[_0xf0a5('0x86')](),path[_0xf0a5('0x53')](__dirname,'../../files/reports',_0x255ba9[_0xf0a5('0x9e')]),_0x2d0718]);return _0x255ba9;}else{var _0x3723ec=squel[_0xf0a5('0x6f')]();_0x3723ec[_0xf0a5('0x70')]('('+_0x5b40a4[_0xf0a5('0x86')]()+')',_0xf0a5('0x9f'));_0x3723ec[_0xf0a5('0x74')](_0xf0a5('0xa0'),_0xf0a5('0x1e'));_0x5b40a4[_0xf0a5('0x1d')](_0x169316[_0xf0a5('0x1d')]||_0x299c0b);_0x5b40a4['offset'](_0x169316[_0xf0a5('0x1b')]||0x0);return dbH[_0xf0a5('0x87')][_0xf0a5('0x30')](_0x3723ec[_0xf0a5('0x86')](),{'type':dbH['sequelize'][_0xf0a5('0x88')][_0xf0a5('0x89')]})[_0xf0a5('0x24')](function(_0x42b85a){if(!_0x42b85a[_0xf0a5('0x35')]){_0x1b6ea7=0x0;}else{_0x1b6ea7=_0x42b85a[0x0][_0xf0a5('0x1e')]||0x0;}return dbH[_0xf0a5('0x87')][_0xf0a5('0x30')](_0x5b40a4[_0xf0a5('0x86')](),{'type':dbH[_0xf0a5('0x87')][_0xf0a5('0x88')][_0xf0a5('0x89')]});})[_0xf0a5('0x24')](function(_0x48958c){return{'rows':_0x48958c||[],'count':_0x1b6ea7};});}});}exports[_0xf0a5('0xa1')]=function(_0x6e64d0,_0x105614){return runReport(_0x6e64d0['params'],_0x6e64d0[_0xf0a5('0x30')],_0x6e64d0[_0xf0a5('0x3f')])[_0xf0a5('0x24')](respondWithResult(_0x105614,null))[_0xf0a5('0x44')](handleError(_0x105614,null));};exports[_0xf0a5('0xa2')]=runReport;exports[_0xf0a5('0x30')]=function(_0x6a5cde,_0x40b990){var _0x2b26a3=0xa;var _0x36c376=[_0xf0a5('0x53'),'left_join','right_join',_0xf0a5('0x56')];var _0x4bb581={'SUM':_0xf0a5('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf0a5('0x59'),'MAX':_0xf0a5('0x5a'),'MIN':_0xf0a5('0x8a'),'AVG':_0xf0a5('0x5b'),'GROUP_CONCAT':_0xf0a5('0x5c'),'GROUP_CONCAT ASC':_0xf0a5('0x5d'),'GROUP_CONCAT DESC':_0xf0a5('0x8b')};var _0x5b8673={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xf0a5('0x60'),'ROUND':_0xf0a5('0x8c'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1fdafe=function(_0x5c137b){return!_[_0xf0a5('0x62')]([_0xf0a5('0x63'),_0xf0a5('0x64'),'IS\x20EMPTY',_0xf0a5('0x8d')],_0x5c137b);};var _0x5dc200=function(_0x3d39aa){if(!_0x3d39aa||!_0x3d39aa[_0xf0a5('0x66')][_0xf0a5('0x35')]){return'';}for(var _0x277a78='(',_0x232f4e=0x0;_0x232f4e<_0x3d39aa['rules'][_0xf0a5('0x35')];_0x232f4e+=0x1){_0x232f4e>0x0&&(_0x277a78+='\x20'+_0x3d39aa[_0xf0a5('0x67')]+'\x20');_0x277a78+=_0x3d39aa['rules'][_0x232f4e]['group']?_0x5dc200(_0x3d39aa[_0xf0a5('0x66')][_0x232f4e][_0xf0a5('0x68')]):_0x3d39aa[_0xf0a5('0x66')][_0x232f4e][_0xf0a5('0x74')]+'\x20'+_0x3d39aa[_0xf0a5('0x66')][_0x232f4e]['condition']+(_0x1fdafe(_0x3d39aa[_0xf0a5('0x66')][_0x232f4e][_0xf0a5('0x69')])?'\x20'+_0x3d39aa[_0xf0a5('0x66')][_0x232f4e][_0xf0a5('0x6a')]:'');}return _0x277a78+')';};var _0x5a6297={'where':{'id':_0x6a5cde[_0xf0a5('0x45')]['id']}},_0x583898,_0x42f772,_0x370a41,_0x29da40,_0x12445b;_0x5a6297=_[_0xf0a5('0x3e')]({},_0x5a6297,_0x6a5cde[_0xf0a5('0x3f')]);return db[_0xf0a5('0x40')]['find'](_0x5a6297)['then'](function(_0x54a269){if(_0x54a269){_0x583898=_0x54a269;return _0x54a269[_0xf0a5('0x6b')]();}return null;})[_0xf0a5('0x24')](function(_0x213b8f){if(_0x213b8f){if(!_0x213b8f[_0xf0a5('0x35')]){throw new db[(_0xf0a5('0x8e'))][(_0xf0a5('0x8f'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x42f772=_0x213b8f;return db['AnalyticMetric'][_0xf0a5('0x42')]({'raw':!![]});}return null;})[_0xf0a5('0x24')](function(_0x3a223a){if(_0x3a223a){_0x370a41=_['keyBy'](_0x3a223a,'id');var _0x3d4976;var _0x101a2b=squel[_0xf0a5('0x6f')]();_0x101a2b['from'](_0x583898['table']);for(var _0x3cd58b=0x0;_0x3cd58b<_0x42f772[_0xf0a5('0x35')];_0x3cd58b+=0x1){_0x3d4976=_0x42f772[_0x3cd58b][_0xf0a5('0x72')]?_0x370a41[_0x42f772[_0x3cd58b][_0xf0a5('0x72')]]['metric']:_0x42f772[_0x3cd58b][_0xf0a5('0x74')];_0x3d4976=_0x42f772[_0x3cd58b]['function']?_['replace'](_0x4bb581[_0x42f772[_0x3cd58b][_0xf0a5('0x75')]],'%s',_0x3d4976):_0x3d4976;_0x3d4976=_0x42f772[_0x3cd58b][_0xf0a5('0x77')]?_[_0xf0a5('0x76')](_0x5b8673[_0x42f772[_0x3cd58b][_0xf0a5('0x77')]],'%s',_0x3d4976):_0x3d4976;if(_0x42f772[_0x3cd58b][_0xf0a5('0x78')]){_0x101a2b[_0xf0a5('0x68')](_0x3d4976);}_0x42f772[_0x3cd58b][_0xf0a5('0x79')]&&_0x101a2b[_0xf0a5('0x38')](_0x3d4976,_0x42f772[_0x3cd58b]['orderBy']===_0xf0a5('0x7a')?![]:!![]);_0x101a2b[_0xf0a5('0x74')](_0x3d4976,_0x42f772[_0x3cd58b][_0xf0a5('0x90')]||_0x3d4976);}if(_0x583898[_0xf0a5('0x7b')]){_0x583898[_0xf0a5('0x7b')]=JSON[_0xf0a5('0x7c')](_0x583898[_0xf0a5('0x7b')]);for(var _0x213fa4=0x0;_0x213fa4<_0x583898['joins'][_0xf0a5('0x35')];_0x213fa4+=0x1){if(_0x583898['joins'][_0x213fa4][_0xf0a5('0x7d')]&&_['includes'](_0x36c376,_0x583898['joins'][_0x213fa4][_0xf0a5('0x7d')])&&_0x583898[_0xf0a5('0x7b')][_0x213fa4][_0xf0a5('0x7e')]&&_0x583898[_0xf0a5('0x7b')][_0x213fa4]['foreignTable']&&_0x583898[_0xf0a5('0x7b')][_0x213fa4][_0xf0a5('0x80')]){_0x101a2b[_0x583898[_0xf0a5('0x7b')][_0x213fa4]['type']](_0x583898['joins'][_0x213fa4][_0xf0a5('0x7f')],null,util[_0xf0a5('0x77')](_0xf0a5('0x81'),_0x583898[_0xf0a5('0x71')],_0x583898[_0xf0a5('0x7b')][_0x213fa4][_0xf0a5('0x7e')],_0x583898['joins'][_0x213fa4]['foreignTable'],_0x583898['joins'][_0x213fa4][_0xf0a5('0x80')]));}}}if(_0x583898[_0xf0a5('0x82')]){_0x583898[_0xf0a5('0x82')]=JSON[_0xf0a5('0x7c')](_0x583898[_0xf0a5('0x82')]);_0x101a2b[_0xf0a5('0x3a')](_0x5dc200(_0x583898[_0xf0a5('0x82')][_0xf0a5('0x68')]));}_0x12445b=_0x101a2b[_0xf0a5('0x83')]();_0x101a2b[_0xf0a5('0x1d')](_0x2b26a3);_0x101a2b[_0xf0a5('0x1b')](0x0);logger[_0xf0a5('0x84')](_0xf0a5('0x85'),_0x101a2b[_0xf0a5('0x86')]());return dbH[_0xf0a5('0x87')][_0xf0a5('0x30')](_0x101a2b['toString'](),{'type':dbH[_0xf0a5('0x87')][_0xf0a5('0x88')][_0xf0a5('0x89')]});}})[_0xf0a5('0x24')](function(){return{'sql':_0x12445b['toString']()};})[_0xf0a5('0x24')](respondWithResult(_0x40b990,null))[_0xf0a5('0x44')](handleError(_0x40b990,null));}; \ No newline at end of file +var _0xd19f=['.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','name','send','map','AnalyticCustomReport','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','include','findAll','rows','show','rawAttributes','includeAll','catch','create','body','user','role','get','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','preview','join','left_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)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','parse','debug','toString','sequelize','QueryTypes','right_join','cross_join','SUM(%s)','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','getFields','Please\x20insert\x20at\x20least\x20one\x20field','clone','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','cdr'];(function(_0x8e0f9a,_0x57508a){var _0x441c0f=function(_0x45fb84){while(--_0x45fb84){_0x8e0f9a['push'](_0x8e0f9a['shift']());}};_0x441c0f(++_0x57508a);}(_0xd19f,0x161));var _0xfd19=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xd19f[_0x4c7d8b];return _0x187158;};'use strict';var emlformat=require(_0xfd19('0x0'));var rimraf=require(_0xfd19('0x1'));var zipdir=require(_0xfd19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd19('0x3'));var moment=require(_0xfd19('0x4'));var BPromise=require(_0xfd19('0x5'));var Mustache=require('mustache');var util=require(_0xfd19('0x6'));var path=require(_0xfd19('0x7'));var sox=require(_0xfd19('0x8'));var csv=require('to-csv');var ejs=require(_0xfd19('0x9'));var fs=require('fs');var fs_extra=require(_0xfd19('0xa'));var _=require('lodash');var squel=require(_0xfd19('0xb'));var crypto=require(_0xfd19('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfd19('0xd'));var toCsv=require(_0xfd19('0xe'));var querystring=require(_0xfd19('0xf'));var Papa=require(_0xfd19('0x10'));var Redis=require(_0xfd19('0x11'));var authService=require(_0xfd19('0x12'));var qs=require(_0xfd19('0x13'));var as=require(_0xfd19('0x14'));var hardwareService=require(_0xfd19('0x15'));var logger=require(_0xfd19('0x16'))('api');var utils=require(_0xfd19('0x17'));var config=require(_0xfd19('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd19('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x49a696,_0x256fdc){_0x256fdc=_0x256fdc||0xcc;return function(_0x1e53cb){if(_0x1e53cb){return _0x49a696[_0xfd19('0x1a')](_0x256fdc);}return _0x49a696[_0xfd19('0x1b')](_0x256fdc)[_0xfd19('0x1c')]();};}function respondWithResult(_0x48624e,_0x2417f0){_0x2417f0=_0x2417f0||0xc8;return function(_0x425b24){if(_0x425b24){return _0x48624e[_0xfd19('0x1b')](_0x2417f0)[_0xfd19('0x1d')](_0x425b24);}};}function respondWithFilteredResult(_0x3c4023,_0x96f279){return function(_0x35d124){if(_0x35d124){var _0x3d0f7d=typeof _0x96f279[_0xfd19('0x1e')]===_0xfd19('0x1f')&&typeof _0x96f279[_0xfd19('0x20')]===_0xfd19('0x1f');var _0x29b698=_0x35d124[_0xfd19('0x21')];var _0x5df519=_0x3d0f7d?0x0:_0x96f279[_0xfd19('0x1e')];var _0x9fdc5=_0x3d0f7d?_0x35d124['count']:_0x96f279[_0xfd19('0x1e')]+_0x96f279[_0xfd19('0x20')];var _0x2cea18;if(_0x9fdc5>=_0x29b698){_0x9fdc5=_0x29b698;_0x2cea18=0xc8;}else{_0x2cea18=0xce;}_0x3c4023[_0xfd19('0x1b')](_0x2cea18);return _0x3c4023[_0xfd19('0x22')](_0xfd19('0x23'),_0x5df519+'-'+_0x9fdc5+'/'+_0x29b698)[_0xfd19('0x1d')](_0x35d124);}return null;};}function patchUpdates(_0x1ea33e){return function(_0x311fcd){try{jsonpatch['apply'](_0x311fcd,_0x1ea33e,!![]);}catch(_0x5ba3ff){return BPromise[_0xfd19('0x24')](_0x5ba3ff);}return _0x311fcd['save']();};}function saveUpdates(_0x4afecd,_0x18c596){return function(_0x2bbed6){if(_0x2bbed6){return _0x2bbed6[_0xfd19('0x25')](_0x4afecd)[_0xfd19('0x26')](function(_0x45932d){return _0x45932d;});}return null;};}function removeEntity(_0x2f4549,_0x17b5e9){return function(_0x23c8d3){if(_0x23c8d3){return _0x23c8d3[_0xfd19('0x27')]()[_0xfd19('0x26')](function(){var _0x435b91=_0x23c8d3['get']({'plain':!![]});var _0x4e3cfa='CustomReports';return db[_0xfd19('0x28')][_0xfd19('0x27')]({'where':{'type':_0x4e3cfa,'resourceId':_0x435b91['id']}})[_0xfd19('0x26')](function(){return _0x23c8d3;});})['then'](function(){_0x2f4549[_0xfd19('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33cb8b,_0x2f9a21){return function(_0x597f8b){if(!_0x597f8b){_0x33cb8b['sendStatus'](0x194);}return _0x597f8b;};}function handleError(_0x4b7ab1,_0x12b2ac){_0x12b2ac=_0x12b2ac||0x1f4;return function(_0x4db70b){logger[_0xfd19('0x29')](_0x4db70b[_0xfd19('0x2a')]);if(_0x4db70b['name']){delete _0x4db70b[_0xfd19('0x2b')];}_0x4b7ab1[_0xfd19('0x1b')](_0x12b2ac)[_0xfd19('0x2c')](_0x4db70b);};}exports['index']=function(_0x53d9aa,_0x301cf2){var _0x44d30e={},_0x2403e4={},_0x573c5b={'count':0x0,'rows':[]};var _0x1602ec=_[_0xfd19('0x2d')](db[_0xfd19('0x2e')]['rawAttributes'],function(_0x511474){return{'name':_0x511474[_0xfd19('0x2f')],'type':_0x511474[_0xfd19('0x30')][_0xfd19('0x31')]};});_0x2403e4[_0xfd19('0x32')]=_[_0xfd19('0x2d')](_0x1602ec,_0xfd19('0x2b'));_0x2403e4[_0xfd19('0x33')]=_[_0xfd19('0x34')](_0x53d9aa[_0xfd19('0x33')]);_0x2403e4['filters']=_['intersection'](_0x2403e4['model'],_0x2403e4['query']);_0x44d30e[_0xfd19('0x35')]=_[_0xfd19('0x36')](_0x2403e4[_0xfd19('0x32')],qs[_0xfd19('0x37')](_0x53d9aa[_0xfd19('0x33')][_0xfd19('0x37')]));_0x44d30e['attributes']=_0x44d30e[_0xfd19('0x35')][_0xfd19('0x38')]?_0x44d30e[_0xfd19('0x35')]:_0x2403e4[_0xfd19('0x32')];if(!_0x53d9aa[_0xfd19('0x33')]['hasOwnProperty'](_0xfd19('0x39'))){_0x44d30e[_0xfd19('0x20')]=qs[_0xfd19('0x20')](_0x53d9aa['query'][_0xfd19('0x20')]);_0x44d30e[_0xfd19('0x1e')]=qs[_0xfd19('0x1e')](_0x53d9aa['query'][_0xfd19('0x1e')]);}_0x44d30e[_0xfd19('0x3a')]=qs[_0xfd19('0x3b')](_0x53d9aa[_0xfd19('0x33')][_0xfd19('0x3b')]);_0x44d30e['where']=qs[_0xfd19('0x3c')](_['pick'](_0x53d9aa[_0xfd19('0x33')],_0x2403e4[_0xfd19('0x3c')]),_0x1602ec);if(_0x53d9aa['query'][_0xfd19('0x3d')]){_0x44d30e['where']=_[_0xfd19('0x3e')](_0x44d30e[_0xfd19('0x3f')],{'$or':_[_0xfd19('0x2d')](_0x1602ec,function(_0x4fcb26){if(_0x4fcb26['type']!==_0xfd19('0x40')){var _0x4d599e={};_0x4d599e[_0x4fcb26[_0xfd19('0x2b')]]={'$like':'%'+_0x53d9aa[_0xfd19('0x33')]['filter']+'%'};return _0x4d599e;}})});}_0x44d30e=_[_0xfd19('0x3e')]({},_0x44d30e,_0x53d9aa[_0xfd19('0x41')]);var _0x119746={'where':_0x44d30e['where']};return db[_0xfd19('0x2e')]['count'](_0x119746)[_0xfd19('0x26')](function(_0x47b8f9){_0x573c5b[_0xfd19('0x21')]=_0x47b8f9;if(_0x53d9aa[_0xfd19('0x33')]['includeAll']){_0x44d30e[_0xfd19('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xfd19('0x43')](_0x44d30e);})[_0xfd19('0x26')](function(_0x9bfca5){_0x573c5b[_0xfd19('0x44')]=_0x9bfca5;return _0x573c5b;})[_0xfd19('0x26')](respondWithFilteredResult(_0x301cf2,_0x44d30e))['catch'](handleError(_0x301cf2,null));};exports[_0xfd19('0x45')]=function(_0x54eb6b,_0x3883ab){var _0x5b2243={'raw':![],'where':{'id':_0x54eb6b['params']['id']}},_0x158fd8={};_0x158fd8[_0xfd19('0x32')]=_[_0xfd19('0x34')](db[_0xfd19('0x2e')][_0xfd19('0x46')]);_0x158fd8[_0xfd19('0x33')]=_[_0xfd19('0x34')](_0x54eb6b[_0xfd19('0x33')]);_0x158fd8[_0xfd19('0x3c')]=_['intersection'](_0x158fd8['model'],_0x158fd8[_0xfd19('0x33')]);_0x5b2243[_0xfd19('0x35')]=_[_0xfd19('0x36')](_0x158fd8['model'],qs[_0xfd19('0x37')](_0x54eb6b[_0xfd19('0x33')][_0xfd19('0x37')]));_0x5b2243[_0xfd19('0x35')]=_0x5b2243[_0xfd19('0x35')][_0xfd19('0x38')]?_0x5b2243[_0xfd19('0x35')]:_0x158fd8[_0xfd19('0x32')];if(_0x54eb6b[_0xfd19('0x33')][_0xfd19('0x47')]){_0x5b2243[_0xfd19('0x42')]=[{'all':!![]}];}_0x5b2243=_[_0xfd19('0x3e')]({},_0x5b2243,_0x54eb6b['options']);return db[_0xfd19('0x2e')]['find'](_0x5b2243)[_0xfd19('0x26')](handleEntityNotFound(_0x3883ab,null))[_0xfd19('0x26')](respondWithResult(_0x3883ab,null))[_0xfd19('0x48')](handleError(_0x3883ab,null));};exports[_0xfd19('0x49')]=function(_0x5b4dcd,_0x3333b0){return db[_0xfd19('0x2e')]['create'](_0x5b4dcd[_0xfd19('0x4a')],{})[_0xfd19('0x26')](function(_0x51c6b5){var _0x135b1d=_0x5b4dcd[_0xfd19('0x4b')]['get']({'plain':!![]});if(!_0x135b1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x135b1d[_0xfd19('0x4c')]===_0xfd19('0x4b')){var _0x3589d3=_0x51c6b5[_0xfd19('0x4d')]({'plain':!![]});var _0x226311=_0xfd19('0x4e');return db[_0xfd19('0x4f')]['find']({'where':{'name':_0x226311,'userProfileId':_0x135b1d[_0xfd19('0x50')]},'raw':!![]})[_0xfd19('0x26')](function(_0x209fa5){if(_0x209fa5&&_0x209fa5[_0xfd19('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x3589d3['name'],'resourceId':_0x3589d3['id'],'type':_0xfd19('0x52'),'sectionId':_0x209fa5['id']},{})[_0xfd19('0x26')](function(){return _0x51c6b5;});}else{return _0x51c6b5;}})[_0xfd19('0x48')](function(_0xb7c8c2){logger[_0xfd19('0x29')](_0xfd19('0x53'),_0xb7c8c2);throw _0xb7c8c2;});}return _0x51c6b5;})['then'](respondWithResult(_0x3333b0,0xc9))[_0xfd19('0x48')](handleError(_0x3333b0,null));};exports[_0xfd19('0x25')]=function(_0x3ed6cc,_0x12b776){if(_0x3ed6cc[_0xfd19('0x4a')]['id']){delete _0x3ed6cc[_0xfd19('0x4a')]['id'];}return db[_0xfd19('0x2e')][_0xfd19('0x54')]({'where':{'id':_0x3ed6cc[_0xfd19('0x55')]['id']}})[_0xfd19('0x26')](handleEntityNotFound(_0x12b776,null))[_0xfd19('0x26')](saveUpdates(_0x3ed6cc[_0xfd19('0x4a')],null))[_0xfd19('0x26')](respondWithResult(_0x12b776,null))[_0xfd19('0x48')](handleError(_0x12b776,null));};exports[_0xfd19('0x27')]=function(_0x29df21,_0x1b890a){return db['AnalyticCustomReport'][_0xfd19('0x54')]({'where':{'id':_0x29df21[_0xfd19('0x55')]['id']}})[_0xfd19('0x26')](handleEntityNotFound(_0x1b890a,null))[_0xfd19('0x26')](removeEntity(_0x1b890a,null))[_0xfd19('0x48')](handleError(_0x1b890a,null));};exports[_0xfd19('0x56')]=function(_0x4b06dd,_0x3d4066){var _0x4853f8=0xa;var _0xf74f47=[_0xfd19('0x57'),_0xfd19('0x58'),'right_join','cross_join'];var _0x460c73={'SUM':'SUM(%s)','COUNT':_0xfd19('0x59'),'COUNT DISTINCT':_0xfd19('0x5a'),'MAX':_0xfd19('0x5b'),'MIN':_0xfd19('0x5c'),'AVG':_0xfd19('0x5d'),'GROUP_CONCAT':_0xfd19('0x5e'),'GROUP_CONCAT ASC':_0xfd19('0x5f'),'GROUP_CONCAT DESC':_0xfd19('0x60')};var _0x8e5662={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xfd19('0x61'),'HOUR':_0xfd19('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfd19('0x63')};var _0xbcdbac=function(_0x1daae6){return!_[_0xfd19('0x64')](['IS\x20NULL',_0xfd19('0x65'),'IS\x20EMPTY',_0xfd19('0x66')],_0x1daae6);};var _0x4bdd74=function(_0x3d30ef){if(!_0x3d30ef||!_0x3d30ef[_0xfd19('0x67')][_0xfd19('0x38')]){return'';}for(var _0xf3611f='(',_0x3245c7=0x0;_0x3245c7<_0x3d30ef[_0xfd19('0x67')][_0xfd19('0x38')];_0x3245c7+=0x1){_0x3245c7>0x0&&(_0xf3611f+='\x20'+_0x3d30ef[_0xfd19('0x68')]+'\x20');_0xf3611f+=_0x3d30ef['rules'][_0x3245c7][_0xfd19('0x69')]?_0x4bdd74(_0x3d30ef[_0xfd19('0x67')][_0x3245c7]['group']):_0x3d30ef[_0xfd19('0x67')][_0x3245c7][_0xfd19('0x6a')]+'\x20'+_0x3d30ef[_0xfd19('0x67')][_0x3245c7][_0xfd19('0x6b')]+(_0xbcdbac(_0x3d30ef[_0xfd19('0x67')][_0x3245c7][_0xfd19('0x6b')])?'\x20'+_0x3d30ef[_0xfd19('0x67')][_0x3245c7][_0xfd19('0x6c')]:'');}return _0xf3611f+')';};var _0x5e0800={'where':{'id':_0x4b06dd[_0xfd19('0x55')]['id']}},_0x489453,_0x16905a,_0x4789bb,_0x99ae90,_0x291964;_0x5e0800=_['merge']({},_0x5e0800,_0x4b06dd[_0xfd19('0x41')]);return db['AnalyticCustomReport'][_0xfd19('0x54')](_0x5e0800)['then'](function(_0x1c550d){if(_0x1c550d){_0x489453=_0x1c550d;return _0x1c550d['getFields']();}return null;})[_0xfd19('0x26')](function(_0x5a28d5){if(_0x5a28d5){if(!_0x5a28d5[_0xfd19('0x38')]){throw new db[(_0xfd19('0x6d'))][(_0xfd19('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x16905a=_0x5a28d5;return db[_0xfd19('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xfd19('0x26')](function(_0x538f2c){if(_0x538f2c){_0x4789bb=_[_0xfd19('0x70')](_0x538f2c,'id');var _0x3ec82a;var _0x2d14de=squel[_0xfd19('0x71')]();_0x2d14de[_0xfd19('0x72')](_0x489453[_0xfd19('0x73')]);for(var _0x10ccb4=0x0;_0x10ccb4<_0x16905a['length'];_0x10ccb4+=0x1){_0x3ec82a=_0x16905a[_0x10ccb4][_0xfd19('0x74')]?_0x4789bb[_0x16905a[_0x10ccb4][_0xfd19('0x74')]][_0xfd19('0x75')]:_0x16905a[_0x10ccb4][_0xfd19('0x6a')];_0x3ec82a=_0x16905a[_0x10ccb4][_0xfd19('0x76')]?_[_0xfd19('0x77')](_0x460c73[_0x16905a[_0x10ccb4][_0xfd19('0x76')]],'%s',_0x3ec82a):_0x3ec82a;_0x3ec82a=_0x16905a[_0x10ccb4][_0xfd19('0x78')]?_['replace'](_0x8e5662[_0x16905a[_0x10ccb4][_0xfd19('0x78')]],'%s',_0x3ec82a):_0x3ec82a;if(_0x16905a[_0x10ccb4][_0xfd19('0x79')]){_0x2d14de[_0xfd19('0x69')](_0x3ec82a);}_0x16905a[_0x10ccb4][_0xfd19('0x7a')]&&_0x2d14de[_0xfd19('0x3a')](_0x3ec82a,_0x16905a[_0x10ccb4][_0xfd19('0x7a')]===_0xfd19('0x7b')?![]:!![]);_0x2d14de['field'](_0x3ec82a,_0x16905a[_0x10ccb4][_0xfd19('0x7c')]||_0x3ec82a);}if(_0x489453[_0xfd19('0x7d')]){_0x489453[_0xfd19('0x7d')]=JSON['parse'](_0x489453[_0xfd19('0x7d')]);for(var _0xeb101a=0x0;_0xeb101a<_0x489453[_0xfd19('0x7d')][_0xfd19('0x38')];_0xeb101a+=0x1){if(_0x489453['joins'][_0xeb101a][_0xfd19('0x30')]&&_[_0xfd19('0x64')](_0xf74f47,_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x30')])&&_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x7e')]&&_0x489453[_0xfd19('0x7d')][_0xeb101a]['foreignTable']&&_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x7f')]){_0x2d14de[_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x30')]](_0x489453[_0xfd19('0x7d')][_0xeb101a]['foreignTable'],null,util[_0xfd19('0x78')](_0xfd19('0x80'),_0x489453[_0xfd19('0x73')],_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x7e')],_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x81')],_0x489453[_0xfd19('0x7d')][_0xeb101a][_0xfd19('0x7f')]));}}}if(_0x489453[_0xfd19('0x82')]){_0x489453['conditions']=JSON[_0xfd19('0x83')](_0x489453['conditions']);_0x2d14de[_0xfd19('0x3f')](_0x4bdd74(_0x489453[_0xfd19('0x82')]['group']));}_0x291964=_0x2d14de['clone']();_0x2d14de[_0xfd19('0x20')](_0x4853f8);_0x2d14de[_0xfd19('0x1e')](0x0);logger[_0xfd19('0x84')]('Limited\x20Query:',_0x2d14de[_0xfd19('0x85')]());return dbH[_0xfd19('0x86')][_0xfd19('0x33')](_0x2d14de[_0xfd19('0x85')](),{'type':dbH['sequelize'][_0xfd19('0x87')]['SELECT']});}})[_0xfd19('0x26')](respondWithResult(_0x3d4066,null))['catch'](handleError(_0x3d4066,null));};function runReport(_0x119c0d,_0x44c7f2,_0x701a3){var _0x3cd747=_0x44c7f2['name'];var _0x26a090=0xa;var _0x3f3b45=[_0xfd19('0x57'),_0xfd19('0x58'),_0xfd19('0x88'),_0xfd19('0x89')];var _0x52e154={'SUM':_0xfd19('0x8a'),'COUNT':_0xfd19('0x59'),'COUNT DISTINCT':_0xfd19('0x5a'),'MAX':_0xfd19('0x5b'),'MIN':'MIN(%s)','AVG':_0xfd19('0x5d'),'GROUP_CONCAT':_0xfd19('0x5e'),'GROUP_CONCAT ASC':_0xfd19('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x258b8f={'SEC_TO_TIME':_0xfd19('0x8b'),'DATE':_0xfd19('0x61'),'HOUR':_0xfd19('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfd19('0x63')};var _0x1b0f7d=function(_0x4905ef){return!_[_0xfd19('0x64')]([_0xfd19('0x8c'),_0xfd19('0x65'),_0xfd19('0x8d'),'IS\x20NOT\x20EMPTY'],_0x4905ef);};var _0xf367b1=function(_0x5d4383){if(!_0x5d4383||!_0x5d4383[_0xfd19('0x67')]['length']){return'';}for(var _0x1545a6='(',_0x401f83=0x0;_0x401f83<_0x5d4383[_0xfd19('0x67')]['length'];_0x401f83+=0x1){_0x401f83>0x0&&(_0x1545a6+='\x20'+_0x5d4383['operator']+'\x20');_0x1545a6+=_0x5d4383[_0xfd19('0x67')][_0x401f83][_0xfd19('0x69')]?_0xf367b1(_0x5d4383[_0xfd19('0x67')][_0x401f83][_0xfd19('0x69')]):_0x5d4383[_0xfd19('0x67')][_0x401f83]['field']+'\x20'+_0x5d4383[_0xfd19('0x67')][_0x401f83][_0xfd19('0x6b')]+(_0x1b0f7d(_0x5d4383[_0xfd19('0x67')][_0x401f83][_0xfd19('0x6b')])?'\x20'+_0x5d4383[_0xfd19('0x67')][_0x401f83][_0xfd19('0x6c')]:'');}return _0x1545a6+')';};var _0x165d6d={'where':{'id':_0x119c0d['id']}},_0x329ec0,_0x44dfdc,_0x8ab1b7,_0x29605b,_0x4ea20c;_0x165d6d=_[_0xfd19('0x3e')]({},_0x165d6d,_0x701a3);return db['AnalyticCustomReport'][_0xfd19('0x54')](_0x165d6d)[_0xfd19('0x26')](function(_0x211cc4){if(_0x211cc4){_0x329ec0=_0x211cc4;return _0x211cc4[_0xfd19('0x8e')]();}return null;})[_0xfd19('0x26')](function(_0x3a2d96){if(_0x3a2d96){if(!_0x3a2d96[_0xfd19('0x38')]){throw new db[(_0xfd19('0x6d'))][(_0xfd19('0x6e'))](_0xfd19('0x8f'),0x193);}_0x44dfdc=_0x3a2d96;return db[_0xfd19('0x6f')]['findAll']({'raw':!![]});}return null;})[_0xfd19('0x26')](function(_0x21ff03){if(_0x21ff03){_0x8ab1b7=_[_0xfd19('0x70')](_0x21ff03,'id');var _0x4fc10b;var _0x311804=squel[_0xfd19('0x71')]();_0x311804[_0xfd19('0x72')](_0x329ec0[_0xfd19('0x73')]);for(var _0x5a1614=0x0;_0x5a1614<_0x44dfdc[_0xfd19('0x38')];_0x5a1614+=0x1){_0x4fc10b=_0x44dfdc[_0x5a1614]['MetricId']?_0x8ab1b7[_0x44dfdc[_0x5a1614][_0xfd19('0x74')]]['metric']:_0x44dfdc[_0x5a1614][_0xfd19('0x6a')];_0x4fc10b=_0x44dfdc[_0x5a1614][_0xfd19('0x76')]?_[_0xfd19('0x77')](_0x52e154[_0x44dfdc[_0x5a1614]['function']],'%s',_0x4fc10b):_0x4fc10b;_0x4fc10b=_0x44dfdc[_0x5a1614][_0xfd19('0x78')]?_[_0xfd19('0x77')](_0x258b8f[_0x44dfdc[_0x5a1614]['format']],'%s',_0x4fc10b):_0x4fc10b;if(_0x44dfdc[_0x5a1614]['groupBy']){_0x311804[_0xfd19('0x69')](_0x4fc10b);}_0x44dfdc[_0x5a1614][_0xfd19('0x7a')]&&_0x311804[_0xfd19('0x3a')](_0x4fc10b,_0x44dfdc[_0x5a1614]['orderBy']===_0xfd19('0x7b')?![]:!![]);_0x311804[_0xfd19('0x6a')](_0x4fc10b,_0x44dfdc[_0x5a1614]['alias']||_0x4fc10b);}if(_0x329ec0[_0xfd19('0x7d')]){_0x329ec0[_0xfd19('0x7d')]=JSON['parse'](_0x329ec0[_0xfd19('0x7d')]);for(var _0x51fd0a=0x0;_0x51fd0a<_0x329ec0['joins'][_0xfd19('0x38')];_0x51fd0a+=0x1){if(_0x329ec0[_0xfd19('0x7d')][_0x51fd0a][_0xfd19('0x30')]&&_[_0xfd19('0x64')](_0x3f3b45,_0x329ec0[_0xfd19('0x7d')][_0x51fd0a][_0xfd19('0x30')])&&_0x329ec0[_0xfd19('0x7d')][_0x51fd0a][_0xfd19('0x7e')]&&_0x329ec0[_0xfd19('0x7d')][_0x51fd0a][_0xfd19('0x81')]&&_0x329ec0[_0xfd19('0x7d')][_0x51fd0a][_0xfd19('0x7f')]){_0x311804[_0x329ec0[_0xfd19('0x7d')][_0x51fd0a]['type']](_0x329ec0[_0xfd19('0x7d')][_0x51fd0a]['foreignTable'],null,util[_0xfd19('0x78')](_0xfd19('0x80'),_0x329ec0[_0xfd19('0x73')],_0x329ec0['joins'][_0x51fd0a]['parentKey'],_0x329ec0[_0xfd19('0x7d')][_0x51fd0a]['foreignTable'],_0x329ec0[_0xfd19('0x7d')][_0x51fd0a]['foreignKey']));}}}if(_0x329ec0[_0xfd19('0x82')]){_0x329ec0[_0xfd19('0x82')]=JSON[_0xfd19('0x83')](_0x329ec0[_0xfd19('0x82')]);_0x311804[_0xfd19('0x3f')](_0xf367b1(_0x329ec0[_0xfd19('0x82')][_0xfd19('0x69')]));}_0x4ea20c=_0x311804[_0xfd19('0x90')]();_0x311804[_0xfd19('0x20')](_0x26a090);_0x311804[_0xfd19('0x1e')](0x0);return;}})[_0xfd19('0x26')](function(){if(_0x44c7f2[_0xfd19('0x91')]===_0xfd19('0x92')){return null;}var _0x2f895b=_['merge'](_0x44c7f2,{'name':_0x44c7f2[_0xfd19('0x93')]||_0x44c7f2[_0xfd19('0x2b')]||_0x329ec0[_0xfd19('0x2b')],'basename':_0x3cd747,'savename':util[_0xfd19('0x78')](_0xfd19('0x94'),_0x44c7f2[_0xfd19('0x2b')]||_0x329ec0[_0xfd19('0x2b')],require(_0xfd19('0x95'))['generate'](0x4),_0x44c7f2[_0xfd19('0x91')]||_0xfd19('0x96')),'reportId':_0x329ec0['id'],'reportType':_0xfd19('0x97')});return db[_0xfd19('0x98')][_0xfd19('0x49')](_0x2f895b,{'raw':!![]});})[_0xfd19('0x26')](function(_0x5e52b9){if(_0x329ec0['table']===_0xfd19('0x99')){_0x4ea20c[_0xfd19('0x3f')](_0x329ec0['table']+_0xfd19('0x9a'),_0x44c7f2['startDate'],_0x44c7f2['endDate']);}else{_0x4ea20c[_0xfd19('0x3f')](_0x329ec0[_0xfd19('0x73')]+_0xfd19('0x9b'),_0x44c7f2[_0xfd19('0x9c')],_0x44c7f2[_0xfd19('0x9d')]);}if(_0x5e52b9){logger[_0xfd19('0x9e')](_0xfd19('0x9f'),_0x4ea20c[_0xfd19('0x85')]());require('child_process')[_0xfd19('0xa0')](path[_0xfd19('0x57')](__dirname,'../../components/export/',_0x5e52b9['output']),[_0x5e52b9['id'],_0x4ea20c[_0xfd19('0x85')](),path['join'](__dirname,_0xfd19('0xa1'),_0x5e52b9[_0xfd19('0xa2')]),_0x3cd747]);return _0x5e52b9;}else{var _0x2eb26d=squel[_0xfd19('0x71')]();_0x2eb26d['from']('('+_0x4ea20c[_0xfd19('0x85')]()+')',_0xfd19('0xa3'));_0x2eb26d[_0xfd19('0x6a')](_0xfd19('0xa4'),_0xfd19('0x21'));_0x4ea20c['limit'](_0x44c7f2[_0xfd19('0x20')]||_0x26a090);_0x4ea20c['offset'](_0x44c7f2[_0xfd19('0x1e')]||0x0);return dbH[_0xfd19('0x86')][_0xfd19('0x33')](_0x2eb26d[_0xfd19('0x85')](),{'type':dbH[_0xfd19('0x86')]['QueryTypes']['SELECT']})[_0xfd19('0x26')](function(_0x7b3648){if(!_0x7b3648[_0xfd19('0x38')]){_0x29605b=0x0;}else{_0x29605b=_0x7b3648[0x0][_0xfd19('0x21')]||0x0;}return dbH[_0xfd19('0x86')][_0xfd19('0x33')](_0x4ea20c['toString'](),{'type':dbH[_0xfd19('0x86')]['QueryTypes'][_0xfd19('0xa5')]});})[_0xfd19('0x26')](function(_0x5ff90b){return{'rows':_0x5ff90b||[],'count':_0x29605b};});}});}exports[_0xfd19('0xa6')]=function(_0x3bd0d1,_0x18d1e5){return runReport(_0x3bd0d1[_0xfd19('0x55')],_0x3bd0d1['query'],_0x3bd0d1[_0xfd19('0x41')])[_0xfd19('0x26')](respondWithResult(_0x18d1e5,null))['catch'](handleError(_0x18d1e5,null));};exports[_0xfd19('0xa7')]=runReport;exports['query']=function(_0x537f12,_0x128e6e){var _0x463aa1=0xa;var _0x1e2472=[_0xfd19('0x57'),_0xfd19('0x58'),_0xfd19('0x88'),_0xfd19('0x89')];var _0x4f53b7={'SUM':_0xfd19('0x8a'),'COUNT':_0xfd19('0x59'),'COUNT DISTINCT':_0xfd19('0x5a'),'MAX':_0xfd19('0x5b'),'MIN':'MIN(%s)','AVG':_0xfd19('0x5d'),'GROUP_CONCAT':_0xfd19('0x5e'),'GROUP_CONCAT ASC':_0xfd19('0x5f'),'GROUP_CONCAT DESC':_0xfd19('0x60')};var _0x3dae80={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xfd19('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xfd19('0x63')};var _0x5a2aba=function(_0x5128da){return!_[_0xfd19('0x64')](['IS\x20NULL',_0xfd19('0x65'),_0xfd19('0x8d'),_0xfd19('0x66')],_0x5128da);};var _0x4c4fd0=function(_0x176033){if(!_0x176033||!_0x176033[_0xfd19('0x67')][_0xfd19('0x38')]){return'';}for(var _0x17bb6c='(',_0x56394a=0x0;_0x56394a<_0x176033[_0xfd19('0x67')][_0xfd19('0x38')];_0x56394a+=0x1){_0x56394a>0x0&&(_0x17bb6c+='\x20'+_0x176033['operator']+'\x20');_0x17bb6c+=_0x176033[_0xfd19('0x67')][_0x56394a][_0xfd19('0x69')]?_0x4c4fd0(_0x176033['rules'][_0x56394a][_0xfd19('0x69')]):_0x176033[_0xfd19('0x67')][_0x56394a][_0xfd19('0x6a')]+'\x20'+_0x176033[_0xfd19('0x67')][_0x56394a][_0xfd19('0x6b')]+(_0x5a2aba(_0x176033[_0xfd19('0x67')][_0x56394a][_0xfd19('0x6b')])?'\x20'+_0x176033[_0xfd19('0x67')][_0x56394a][_0xfd19('0x6c')]:'');}return _0x17bb6c+')';};var _0x45987d={'where':{'id':_0x537f12['params']['id']}},_0x18c772,_0x211920,_0x41deca,_0x228e9f,_0x1639d2;_0x45987d=_[_0xfd19('0x3e')]({},_0x45987d,_0x537f12[_0xfd19('0x41')]);return db[_0xfd19('0x2e')][_0xfd19('0x54')](_0x45987d)[_0xfd19('0x26')](function(_0x5dbc22){if(_0x5dbc22){_0x18c772=_0x5dbc22;return _0x5dbc22['getFields']();}return null;})[_0xfd19('0x26')](function(_0x26667f){if(_0x26667f){if(!_0x26667f['length']){throw new db[(_0xfd19('0x6d'))][(_0xfd19('0x6e'))](_0xfd19('0x8f'),0x193);}_0x211920=_0x26667f;return db[_0xfd19('0x6f')][_0xfd19('0x43')]({'raw':!![]});}return null;})['then'](function(_0x1ca994){if(_0x1ca994){_0x41deca=_[_0xfd19('0x70')](_0x1ca994,'id');var _0x1a807c;var _0x398d55=squel[_0xfd19('0x71')]();_0x398d55[_0xfd19('0x72')](_0x18c772[_0xfd19('0x73')]);for(var _0x33d6a5=0x0;_0x33d6a5<_0x211920[_0xfd19('0x38')];_0x33d6a5+=0x1){_0x1a807c=_0x211920[_0x33d6a5][_0xfd19('0x74')]?_0x41deca[_0x211920[_0x33d6a5][_0xfd19('0x74')]][_0xfd19('0x75')]:_0x211920[_0x33d6a5][_0xfd19('0x6a')];_0x1a807c=_0x211920[_0x33d6a5][_0xfd19('0x76')]?_[_0xfd19('0x77')](_0x4f53b7[_0x211920[_0x33d6a5][_0xfd19('0x76')]],'%s',_0x1a807c):_0x1a807c;_0x1a807c=_0x211920[_0x33d6a5]['format']?_[_0xfd19('0x77')](_0x3dae80[_0x211920[_0x33d6a5][_0xfd19('0x78')]],'%s',_0x1a807c):_0x1a807c;if(_0x211920[_0x33d6a5][_0xfd19('0x79')]){_0x398d55['group'](_0x1a807c);}_0x211920[_0x33d6a5]['orderBy']&&_0x398d55[_0xfd19('0x3a')](_0x1a807c,_0x211920[_0x33d6a5][_0xfd19('0x7a')]===_0xfd19('0x7b')?![]:!![]);_0x398d55['field'](_0x1a807c,_0x211920[_0x33d6a5][_0xfd19('0x7c')]||_0x1a807c);}if(_0x18c772[_0xfd19('0x7d')]){_0x18c772[_0xfd19('0x7d')]=JSON[_0xfd19('0x83')](_0x18c772[_0xfd19('0x7d')]);for(var _0x1d5511=0x0;_0x1d5511<_0x18c772[_0xfd19('0x7d')][_0xfd19('0x38')];_0x1d5511+=0x1){if(_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x30')]&&_[_0xfd19('0x64')](_0x1e2472,_0x18c772['joins'][_0x1d5511][_0xfd19('0x30')])&&_0x18c772[_0xfd19('0x7d')][_0x1d5511]['parentKey']&&_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x81')]&&_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x7f')]){_0x398d55[_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x30')]](_0x18c772['joins'][_0x1d5511][_0xfd19('0x81')],null,util[_0xfd19('0x78')](_0xfd19('0x80'),_0x18c772[_0xfd19('0x73')],_0x18c772['joins'][_0x1d5511]['parentKey'],_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x81')],_0x18c772[_0xfd19('0x7d')][_0x1d5511][_0xfd19('0x7f')]));}}}if(_0x18c772['conditions']){_0x18c772['conditions']=JSON[_0xfd19('0x83')](_0x18c772[_0xfd19('0x82')]);_0x398d55[_0xfd19('0x3f')](_0x4c4fd0(_0x18c772[_0xfd19('0x82')][_0xfd19('0x69')]));}_0x1639d2=_0x398d55[_0xfd19('0x90')]();_0x398d55[_0xfd19('0x20')](_0x463aa1);_0x398d55[_0xfd19('0x1e')](0x0);logger[_0xfd19('0x84')](_0xfd19('0xa8'),_0x398d55[_0xfd19('0x85')]());return dbH[_0xfd19('0x86')][_0xfd19('0x33')](_0x398d55['toString'](),{'type':dbH[_0xfd19('0x86')]['QueryTypes'][_0xfd19('0xa5')]});}})[_0xfd19('0x26')](function(){return{'sql':_0x1639d2[_0xfd19('0x85')]()};})[_0xfd19('0x26')](respondWithResult(_0x128e6e,null))['catch'](handleError(_0x128e6e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e24d81c..143786e 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 _0x9ad1=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x41f430,_0x39ceea){var _0x3d11a8=function(_0x11ee41){while(--_0x11ee41){_0x41f430['push'](_0x41f430['shift']());}};_0x3d11a8(++_0x39ceea);}(_0x9ad1,0x93));var _0x19ad=function(_0x146a84,_0x519757){_0x146a84=_0x146a84-0x0;var _0x1cfed5=_0x9ad1[_0x146a84];return _0x1cfed5;};'use strict';var _=require(_0x19ad('0x0'));var util=require('util');var logger=require(_0x19ad('0x1'))(_0x19ad('0x2'));var moment=require(_0x19ad('0x3'));var BPromise=require(_0x19ad('0x4'));var rp=require(_0x19ad('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x19ad('0x6'));var attributes=require(_0x19ad('0x7'));module[_0x19ad('0x8')]=function(_0x70bb14,_0x508235){return _0x70bb14[_0x19ad('0x9')](_0x19ad('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8831=['moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','analytics_custom_reports','util','../../config/logger','api'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x8831,0x99));var _0x1883=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x8831[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require('lodash');var util=require(_0x1883('0x0'));var logger=require(_0x1883('0x1'))(_0x1883('0x2'));var moment=require(_0x1883('0x3'));var BPromise=require(_0x1883('0x4'));var rp=require(_0x1883('0x5'));var fs=require('fs');var path=require(_0x1883('0x6'));var rimraf=require('rimraf');var config=require(_0x1883('0x7'));var attributes=require(_0x1883('0x8'));module[_0x1883('0x9')]=function(_0x14f27d,_0x76fa40){return _0x14f27d[_0x1883('0xa')]('AnalyticCustomReport',attributes,{'tableName':_0x1883('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 8422dac..eede77a 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 _0x4405=['code','AnalyticCustomReport,\x20%s,\x20%s','message','info','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4405,0x1a9));var _0x5440=function(_0x15f1b3,_0x38ede0){_0x15f1b3=_0x15f1b3-0x0;var _0x45f5a3=_0x4405[_0x15f1b3];return _0x45f5a3;};'use strict';var _=require(_0x5440('0x0'));var util=require('util');var moment=require(_0x5440('0x1'));var BPromise=require('bluebird');var rs=require(_0x5440('0x2'));var fs=require('fs');var Redis=require(_0x5440('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5440('0x4'));var logger=require(_0x5440('0x5'))('rpc');var config=require(_0x5440('0x6'));var jayson=require(_0x5440('0x7'));var client=jayson[_0x5440('0x8')][_0x5440('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37b8be,_0x1b4fa9,_0x2ef9fe){return new BPromise(function(_0x3fed25,_0xe54b9f){return client[_0x5440('0xa')](_0x37b8be,_0x2ef9fe)[_0x5440('0xb')](function(_0x277603){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x1b4fa9,_0x5440('0xc'));logger[_0x5440('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1b4fa9,_0x5440('0xc'),JSON[_0x5440('0xe')](_0x277603));if(_0x277603[_0x5440('0xf')]){if(_0x277603[_0x5440('0xf')][_0x5440('0x10')]===0x1f4){logger[_0x5440('0xf')](_0x5440('0x11'),_0x1b4fa9,_0x277603[_0x5440('0xf')]['message']);return _0xe54b9f(_0x277603[_0x5440('0xf')]['message']);}logger['error'](_0x5440('0x11'),_0x1b4fa9,_0x277603[_0x5440('0xf')][_0x5440('0x12')]);return _0x3fed25(_0x277603[_0x5440('0xf')][_0x5440('0x12')]);}else{logger[_0x5440('0x13')](_0x5440('0x11'),_0x1b4fa9,'request\x20sent');_0x3fed25(_0x277603['result']['message']);}})[_0x5440('0x14')](function(_0x28a8e4){logger[_0x5440('0xf')](_0x5440('0x11'),_0x1b4fa9,_0x28a8e4);_0xe54b9f(_0x28a8e4);});});} \ No newline at end of file +var _0xed2c=['code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x56403e,_0x5840b5){var _0xd57bb2=function(_0x3a107a){while(--_0x3a107a){_0x56403e['push'](_0x56403e['shift']());}};_0xd57bb2(++_0x5840b5);}(_0xed2c,0x1b9));var _0xced2=function(_0x9a138c,_0x2607f8){_0x9a138c=_0x9a138c-0x0;var _0x3771a3=_0xed2c[_0x9a138c];return _0x3771a3;};'use strict';var _=require('lodash');var util=require(_0xced2('0x0'));var moment=require(_0xced2('0x1'));var BPromise=require(_0xced2('0x2'));var rs=require(_0xced2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xced2('0x5'));var config=require(_0xced2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xced2('0x7')][_0xced2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a5688,_0x13eea1,_0x56f30c){return new BPromise(function(_0x1bf5dd,_0x51b6e0){return client[_0xced2('0x9')](_0x4a5688,_0x56f30c)['then'](function(_0x435ee1){logger['info'](_0xced2('0xa'),_0x13eea1,_0xced2('0xb'));logger[_0xced2('0xc')](_0xced2('0xd'),_0x13eea1,_0xced2('0xb'),JSON['stringify'](_0x435ee1));if(_0x435ee1[_0xced2('0xe')]){if(_0x435ee1['error'][_0xced2('0xf')]===0x1f4){logger[_0xced2('0xe')](_0xced2('0xa'),_0x13eea1,_0x435ee1[_0xced2('0xe')][_0xced2('0x10')]);return _0x51b6e0(_0x435ee1[_0xced2('0xe')]['message']);}logger[_0xced2('0xe')](_0xced2('0xa'),_0x13eea1,_0x435ee1['error']['message']);return _0x1bf5dd(_0x435ee1['error'][_0xced2('0x10')]);}else{logger[_0xced2('0x11')](_0xced2('0xa'),_0x13eea1,_0xced2('0xb'));_0x1bf5dd(_0x435ee1[_0xced2('0x12')][_0xced2('0x10')]);}})['catch'](function(_0x1cf064){logger[_0xced2('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x13eea1,_0x1cf064);_0x51b6e0(_0x1cf064);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6213233..2a9c2e5 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 _0xb74b=['preview','/:id/run','run','/:id/query','query','post','create','put','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xb74b,0x87));var _0xbb74=function(_0x38175c,_0x2de69b){_0x38175c=_0x38175c-0x0;var _0x1566ad=_0xb74b[_0x38175c];return _0x1566ad;};'use strict';var multer=require(_0xbb74('0x0'));var util=require(_0xbb74('0x1'));var path=require(_0xbb74('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb74('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbb74('0x4'));var config=require(_0xbb74('0x5'));var controller=require(_0xbb74('0x6'));router[_0xbb74('0x7')]('/',auth[_0xbb74('0x8')](),controller[_0xbb74('0x9')]);router['get'](_0xbb74('0xa'),auth[_0xbb74('0x8')](),controller['show']);router[_0xbb74('0x7')](_0xbb74('0xb'),auth[_0xbb74('0x8')](),controller[_0xbb74('0xc')]);router[_0xbb74('0x7')](_0xbb74('0xd'),auth[_0xbb74('0x8')](),controller[_0xbb74('0xe')]);router[_0xbb74('0x7')](_0xbb74('0xf'),auth[_0xbb74('0x8')](),controller[_0xbb74('0x10')]);router[_0xbb74('0x11')]('/',auth[_0xbb74('0x8')](),controller[_0xbb74('0x12')]);router[_0xbb74('0x13')]('/:id',auth[_0xbb74('0x8')](),controller['update']);router['delete'](_0xbb74('0xa'),auth[_0xbb74('0x8')](),controller[_0xbb74('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8a08=['Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','/:id/query','query','post','update','delete','multer','util','path','connect-timeout'];(function(_0x2b16b3,_0x1611a1){var _0x415632=function(_0x64039a){while(--_0x64039a){_0x2b16b3['push'](_0x2b16b3['shift']());}};_0x415632(++_0x1611a1);}(_0x8a08,0x106));var _0x88a0=function(_0x13e31a,_0x12369c){_0x13e31a=_0x13e31a-0x0;var _0xf657a=_0x8a08[_0x13e31a];return _0xf657a;};'use strict';var multer=require(_0x88a0('0x0'));var util=require(_0x88a0('0x1'));var path=require(_0x88a0('0x2'));var timeout=require(_0x88a0('0x3'));var express=require('express');var router=express[_0x88a0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x88a0('0x5'));var config=require(_0x88a0('0x6'));var controller=require(_0x88a0('0x7'));router['get']('/',auth[_0x88a0('0x8')](),controller['index']);router[_0x88a0('0x9')](_0x88a0('0xa'),auth[_0x88a0('0x8')](),controller[_0x88a0('0xb')]);router['get'](_0x88a0('0xc'),auth[_0x88a0('0x8')](),controller[_0x88a0('0xd')]);router[_0x88a0('0x9')]('/:id/run',auth[_0x88a0('0x8')](),controller['run']);router[_0x88a0('0x9')](_0x88a0('0xe'),auth[_0x88a0('0x8')](),controller[_0x88a0('0xf')]);router[_0x88a0('0x10')]('/',auth[_0x88a0('0x8')](),controller['create']);router['put'](_0x88a0('0xa'),auth[_0x88a0('0x8')](),controller[_0x88a0('0x11')]);router[_0x88a0('0x12')](_0x88a0('0xa'),auth[_0x88a0('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b4ada2a..54766c8 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 _0xc4aa=['STRING','sequelize','exports'];(function(_0x47a250,_0x298f3a){var _0x2d855c=function(_0x5f96e5){while(--_0x5f96e5){_0x47a250['push'](_0x47a250['shift']());}};_0x2d855c(++_0x298f3a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x41028d,_0xf572c4){var _0x3ea308=function(_0x55153f){while(--_0x55153f){_0x41028d['push'](_0x41028d['shift']());}};_0x3ea308(++_0xf572c4);}(_0x31f0,0xb7));var _0x031f=function(_0x33c4e1,_0x48e545){_0x33c4e1=_0x33c4e1-0x0;var _0x7f81fc=_0x31f0[_0x33c4e1];return _0x7f81fc;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 4ec2920..864cc20 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x46d1c1,_0x57a805){var _0x3114f0=function(_0x3829f4){while(--_0x3829f4){_0x46d1c1['push'](_0x46d1c1['shift']());}};_0x3114f0(++_0x57a805);}(_0x53ec,0x192));var _0xc53e=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x53ec[_0x34aec4];return _0x51e1a7;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x1d2987,_0x533726){var _0x488c9b=function(_0x3e9d22){while(--_0x3e9d22){_0x1d2987['push'](_0x1d2987['shift']());}};_0x488c9b(++_0x533726);}(_0x0295,0x1f0));var _0x5029=function(_0x54b8e9,_0x55a1e3){_0x54b8e9=_0x54b8e9-0x0;var _0x26fbbf=_0x0295[_0x54b8e9];return _0x26fbbf;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index ec27c3f..91b7aab 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 _0x4eeb=['path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','api','request-promise'];(function(_0x165cc3,_0x1b2d7d){var _0x2d5eea=function(_0x48bc18){while(--_0x48bc18){_0x165cc3['push'](_0x165cc3['shift']());}};_0x2d5eea(++_0x1b2d7d);}(_0x4eeb,0xa3));var _0xb4ee=function(_0x14b07c,_0x31439f){_0x14b07c=_0x14b07c-0x0;var _0x4d42f2=_0x4eeb[_0x14b07c];return _0x4d42f2;};'use strict';var _=require(_0xb4ee('0x0'));var util=require(_0xb4ee('0x1'));var logger=require(_0xb4ee('0x2'))(_0xb4ee('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4ee('0x4'));var fs=require('fs');var path=require(_0xb4ee('0x5'));var rimraf=require(_0xb4ee('0x6'));var config=require(_0xb4ee('0x7'));var attributes=require(_0xb4ee('0x8'));module[_0xb4ee('0x9')]=function(_0x32cf5e,_0x52a262){return _0x32cf5e[_0xb4ee('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0xb4ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd404=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd404,0x191));var _0x4d40=function(_0x400f91,_0x24f6c1){_0x400f91=_0x400f91-0x0;var _0x411a66=_0xd404[_0x400f91];return _0x411a66;};'use strict';var _=require(_0x4d40('0x0'));var util=require(_0x4d40('0x1'));var logger=require(_0x4d40('0x2'))('api');var moment=require(_0x4d40('0x3'));var BPromise=require(_0x4d40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d40('0x5'));var attributes=require(_0x4d40('0x6'));module[_0x4d40('0x7')]=function(_0x126e3,_0x5d2398){return _0x126e3[_0x4d40('0x8')](_0x4d40('0x9'),attributes,{'tableName':_0x4d40('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 67861ad..800eeb4 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 _0x9c4d=['../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc'];(function(_0x4c8c74,_0x55483d){var _0xb66fbc=function(_0x41ff85){while(--_0x41ff85){_0x4c8c74['push'](_0x4c8c74['shift']());}};_0xb66fbc(++_0x55483d);}(_0x9c4d,0xec));var _0xd9c4=function(_0x8ae470,_0x3131a5){_0x8ae470=_0x8ae470-0x0;var _0x5df782=_0x9c4d[_0x8ae470];return _0x5df782;};'use strict';var _=require(_0xd9c4('0x0'));var util=require(_0xd9c4('0x1'));var moment=require('moment');var BPromise=require(_0xd9c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9c4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9c4('0x4'))(_0xd9c4('0x5'));var config=require(_0xd9c4('0x6'));var jayson=require(_0xd9c4('0x7'));var client=jayson[_0xd9c4('0x8')][_0xd9c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3291c5,_0x298b2c,_0x3d7ed7){return new BPromise(function(_0x7393dc,_0x3696d7){return client[_0xd9c4('0xa')](_0x3291c5,_0x3d7ed7)['then'](function(_0x4ef89e){logger[_0xd9c4('0xb')](_0xd9c4('0xc'),_0x298b2c,_0xd9c4('0xd'));logger[_0xd9c4('0xe')](_0xd9c4('0xf'),_0x298b2c,_0xd9c4('0xd'),JSON[_0xd9c4('0x10')](_0x4ef89e));if(_0x4ef89e[_0xd9c4('0x11')]){if(_0x4ef89e[_0xd9c4('0x11')][_0xd9c4('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x298b2c,_0x4ef89e[_0xd9c4('0x11')][_0xd9c4('0x13')]);return _0x3696d7(_0x4ef89e[_0xd9c4('0x11')][_0xd9c4('0x13')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x298b2c,_0x4ef89e['error'][_0xd9c4('0x13')]);return _0x7393dc(_0x4ef89e[_0xd9c4('0x11')][_0xd9c4('0x13')]);}else{logger[_0xd9c4('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x298b2c,'request\x20sent');_0x7393dc(_0x4ef89e[_0xd9c4('0x14')][_0xd9c4('0x13')]);}})[_0xd9c4('0x15')](function(_0x5aa45a){logger['error'](_0xd9c4('0xc'),_0x298b2c,_0x5aa45a);_0x3696d7(_0x5aa45a);});});} \ No newline at end of file +var _0x9811=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1879d3,_0x3833a5){var _0x187641=function(_0xe33cea){while(--_0xe33cea){_0x1879d3['push'](_0x1879d3['shift']());}};_0x187641(++_0x3833a5);}(_0x9811,0x197));var _0x1981=function(_0x4a5aa9,_0xad899d){_0x4a5aa9=_0x4a5aa9-0x0;var _0x30e941=_0x9811[_0x4a5aa9];return _0x30e941;};'use strict';var _=require(_0x1981('0x0'));var util=require(_0x1981('0x1'));var moment=require(_0x1981('0x2'));var BPromise=require(_0x1981('0x3'));var rs=require(_0x1981('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1981('0x5'));var logger=require(_0x1981('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1981('0x7')][_0x1981('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x244c31,_0x2c28aa,_0x53cc51){return new BPromise(function(_0x44d24d,_0x3d55e5){return client['request'](_0x244c31,_0x53cc51)[_0x1981('0x9')](function(_0x26253d){logger[_0x1981('0xa')](_0x1981('0xb'),_0x2c28aa,_0x1981('0xc'));logger[_0x1981('0xd')](_0x1981('0xe'),_0x2c28aa,_0x1981('0xc'),JSON[_0x1981('0xf')](_0x26253d));if(_0x26253d[_0x1981('0x10')]){if(_0x26253d[_0x1981('0x10')][_0x1981('0x11')]===0x1f4){logger[_0x1981('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x2c28aa,_0x26253d[_0x1981('0x10')]['message']);return _0x3d55e5(_0x26253d[_0x1981('0x10')][_0x1981('0x12')]);}logger[_0x1981('0x10')](_0x1981('0xb'),_0x2c28aa,_0x26253d[_0x1981('0x10')]['message']);return _0x44d24d(_0x26253d[_0x1981('0x10')][_0x1981('0x12')]);}else{logger[_0x1981('0xa')](_0x1981('0xb'),_0x2c28aa,_0x1981('0xc'));_0x44d24d(_0x26253d[_0x1981('0x13')]['message']);}})[_0x1981('0x14')](function(_0x743af9){logger['error'](_0x1981('0xb'),_0x2c28aa,_0x743af9);_0x3d55e5(_0x743af9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index ebcbc22..5f0168a 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 _0x1e2d=['/:id/preview','preview','run','/:id/query','query','create','put','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show'];(function(_0x374787,_0x5855ad){var _0x8f3230=function(_0x2cbc24){while(--_0x2cbc24){_0x374787['push'](_0x374787['shift']());}};_0x8f3230(++_0x5855ad);}(_0x1e2d,0x127));var _0xd1e2=function(_0x238160,_0x20515e){_0x238160=_0x238160-0x0;var _0x2957e3=_0x1e2d[_0x238160];return _0x2957e3;};'use strict';var multer=require('multer');var util=require(_0xd1e2('0x0'));var path=require(_0xd1e2('0x1'));var timeout=require(_0xd1e2('0x2'));var express=require('express');var router=express[_0xd1e2('0x3')]();var fs_extra=require(_0xd1e2('0x4'));var auth=require(_0xd1e2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e2('0x6'));var controller=require(_0xd1e2('0x7'));router['get']('/',auth[_0xd1e2('0x8')](),controller[_0xd1e2('0x9')]);router[_0xd1e2('0xa')](_0xd1e2('0xb'),auth[_0xd1e2('0x8')](),controller[_0xd1e2('0xc')]);router[_0xd1e2('0xa')](_0xd1e2('0xd'),auth[_0xd1e2('0x8')](),controller[_0xd1e2('0xe')]);router[_0xd1e2('0xa')]('/:id/run',auth[_0xd1e2('0x8')](),controller[_0xd1e2('0xf')]);router[_0xd1e2('0xa')](_0xd1e2('0x10'),auth['isAuthenticated'](),controller[_0xd1e2('0x11')]);router['post']('/',auth[_0xd1e2('0x8')](),controller[_0xd1e2('0x12')]);router[_0xd1e2('0x13')](_0xd1e2('0xb'),auth[_0xd1e2('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd1e2('0x8')](),controller[_0xd1e2('0x14')]);module[_0xd1e2('0x15')]=router; \ No newline at end of file +var _0xd545=['isAuthenticated','index','/:id/preview','preview','run','/:id/query','query','create','/:id','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xd545,0xff));var _0x5d54=function(_0x5f423f,_0x2a364b){_0x5f423f=_0x5f423f-0x0;var _0x3f356d=_0xd545[_0x5f423f];return _0x3f356d;};'use strict';var multer=require(_0x5d54('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5d54('0x1'));var express=require(_0x5d54('0x2'));var router=express['Router']();var fs_extra=require(_0x5d54('0x3'));var auth=require(_0x5d54('0x4'));var interaction=require(_0x5d54('0x5'));var config=require(_0x5d54('0x6'));var controller=require(_0x5d54('0x7'));router[_0x5d54('0x8')]('/',auth[_0x5d54('0x9')](),controller[_0x5d54('0xa')]);router[_0x5d54('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5d54('0x8')](_0x5d54('0xb'),auth[_0x5d54('0x9')](),controller[_0x5d54('0xc')]);router[_0x5d54('0x8')]('/:id/run',auth[_0x5d54('0x9')](),controller[_0x5d54('0xd')]);router[_0x5d54('0x8')](_0x5d54('0xe'),auth['isAuthenticated'](),controller[_0x5d54('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5d54('0x10')]);router['put'](_0x5d54('0x11'),auth[_0x5d54('0x9')](),controller[_0x5d54('0x12')]);router[_0x5d54('0x13')](_0x5d54('0x11'),auth[_0x5d54('0x9')](),controller[_0x5d54('0x14')]);module[_0x5d54('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 dcc7bf7..7943a89 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 _0xe483=['Loading','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x971597,_0x104aff){var _0x43ca7b=function(_0x1e6b1f){while(--_0x1e6b1f){_0x971597['push'](_0x971597['shift']());}};_0x43ca7b(++_0x104aff);}(_0xe483,0x1d8));var _0x3e48=function(_0x4083ba,_0x5275b6){_0x4083ba=_0x4083ba-0x0;var _0x191875=_0xe483[_0x4083ba];return _0x191875;};'use strict';var Sequelize=require(_0x3e48('0x0'));var moment=require('moment');module[_0x3e48('0x1')]={'name':{'type':Sequelize[_0x3e48('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3e48('0x3')](_0x3e48('0x4'),_0x3e48('0x5'),_0x3e48('0x6')),'allowNull':![],'defaultValue':_0x3e48('0x4')},'savename':{'type':Sequelize[_0x3e48('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3e48('0x7')]},'endDate':{'type':Sequelize[_0x3e48('0x7')]},'status':{'type':Sequelize[_0x3e48('0x2')],'defaultValue':_0x3e48('0x8')},'type':{'type':Sequelize['ENUM']('manual',_0x3e48('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3e48('0xa')](0xb)[_0x3e48('0xb')]},'reportType':{'type':Sequelize[_0x3e48('0x2')]}}; \ No newline at end of file +var _0x57cd=['UNSIGNED','moment','exports','STRING','ENUM','csv','pdf','DATE','Loading','scheduled','manual','INTEGER'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0x57cd,0xa9));var _0xd57c=function(_0x4181c8,_0x26ca3b){_0x4181c8=_0x4181c8-0x0;var _0x2570d3=_0x57cd[_0x4181c8];return _0x2570d3;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd57c('0x0'));module[_0xd57c('0x1')]={'name':{'type':Sequelize[_0xd57c('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xd57c('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xd57c('0x3')](_0xd57c('0x4'),_0xd57c('0x5'),'xlsx'),'allowNull':![],'defaultValue':_0xd57c('0x4')},'savename':{'type':Sequelize[_0xd57c('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd57c('0x6')]},'endDate':{'type':Sequelize[_0xd57c('0x6')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xd57c('0x7')},'type':{'type':Sequelize[_0xd57c('0x3')]('manual',_0xd57c('0x8')),'allowNull':![],'defaultValue':_0xd57c('0x9')},'reportId':{'type':Sequelize[_0xd57c('0xa')](0xb)[_0xd57c('0xb')]},'reportType':{'type':Sequelize[_0xd57c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e4f9014..ba6e01a 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 _0xf03c=['basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','include','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','format'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0xf03c,0x1c9));var _0xcf03=function(_0x1db063,_0x56a060){_0x1db063=_0x1db063-0x0;var _0x26442b=_0xf03c[_0x1db063];return _0x26442b;};'use strict';var emlformat=require(_0xcf03('0x0'));var rimraf=require(_0xcf03('0x1'));var zipdir=require(_0xcf03('0x2'));var jsonpatch=require(_0xcf03('0x3'));var rp=require(_0xcf03('0x4'));var moment=require(_0xcf03('0x5'));var BPromise=require(_0xcf03('0x6'));var Mustache=require('mustache');var util=require(_0xcf03('0x7'));var path=require('path');var sox=require(_0xcf03('0x8'));var csv=require(_0xcf03('0x9'));var ejs=require(_0xcf03('0xa'));var fs=require('fs');var fs_extra=require(_0xcf03('0xb'));var _=require(_0xcf03('0xc'));var squel=require(_0xcf03('0xd'));var crypto=require(_0xcf03('0xe'));var jsforce=require(_0xcf03('0xf'));var deskjs=require(_0xcf03('0x10'));var toCsv=require(_0xcf03('0x9'));var querystring=require('querystring');var Papa=require(_0xcf03('0x11'));var Redis=require('ioredis');var authService=require(_0xcf03('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xcf03('0x13'));var hardwareService=require(_0xcf03('0x14'));var logger=require(_0xcf03('0x15'))('api');var utils=require(_0xcf03('0x16'));var config=require(_0xcf03('0x17'));var licenseUtil=require(_0xcf03('0x18'));var db=require(_0xcf03('0x19'))['db'];function respondWithStatusCode(_0x483c9e,_0x13e4bd){_0x13e4bd=_0x13e4bd||0xcc;return function(_0x3bdd3a){if(_0x3bdd3a){return _0x483c9e[_0xcf03('0x1a')](_0x13e4bd);}return _0x483c9e['status'](_0x13e4bd)['end']();};}function respondWithResult(_0x44230c,_0x529596){_0x529596=_0x529596||0xc8;return function(_0x5231b8){if(_0x5231b8){return _0x44230c[_0xcf03('0x1b')](_0x529596)[_0xcf03('0x1c')](_0x5231b8);}};}function respondWithFilteredResult(_0x5bf104,_0x2e131a){return function(_0x159605){if(_0x159605){var _0x2010d4=typeof _0x2e131a[_0xcf03('0x1d')]===_0xcf03('0x1e')&&typeof _0x2e131a[_0xcf03('0x1f')]===_0xcf03('0x1e');var _0x28e962=_0x159605[_0xcf03('0x20')];var _0x6f64ec=_0x2010d4?0x0:_0x2e131a[_0xcf03('0x1d')];var _0x58743b=_0x2010d4?_0x159605['count']:_0x2e131a[_0xcf03('0x1d')]+_0x2e131a['limit'];var _0x34e926;if(_0x58743b>=_0x28e962){_0x58743b=_0x28e962;_0x34e926=0xc8;}else{_0x34e926=0xce;}_0x5bf104[_0xcf03('0x1b')](_0x34e926);return _0x5bf104[_0xcf03('0x21')](_0xcf03('0x22'),_0x6f64ec+'-'+_0x58743b+'/'+_0x28e962)['json'](_0x159605);}return null;};}function patchUpdates(_0x3420af){return function(_0x31571c){try{jsonpatch[_0xcf03('0x23')](_0x31571c,_0x3420af,!![]);}catch(_0x5dc8f7){return BPromise[_0xcf03('0x24')](_0x5dc8f7);}return _0x31571c[_0xcf03('0x25')]();};}function saveUpdates(_0x27eac3,_0x3e6696){return function(_0x52509c){if(_0x52509c){return _0x52509c[_0xcf03('0x26')](_0x27eac3)[_0xcf03('0x27')](function(_0x1d2eed){return _0x1d2eed;});}return null;};}function removeEntity(_0x2c57d3,_0x606db5){return function(_0x29f7cf){if(_0x29f7cf){return _0x29f7cf[_0xcf03('0x28')]()['then'](function(){var _0x1d68c1=_0x29f7cf[_0xcf03('0x29')]({'plain':!![]});var _0x27287d=_0xcf03('0x2a');return db[_0xcf03('0x2b')][_0xcf03('0x28')]({'where':{'type':_0x27287d,'resourceId':_0x1d68c1['id']}})[_0xcf03('0x27')](function(){return _0x29f7cf;});})['then'](function(){_0x2c57d3[_0xcf03('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb84e,_0x15db8b){return function(_0x135d9d){if(!_0x135d9d){_0x4cb84e[_0xcf03('0x1a')](0x194);}return _0x135d9d;};}function handleError(_0x5d0159,_0x494bc3){_0x494bc3=_0x494bc3||0x1f4;return function(_0x4fe67c){logger['error'](_0x4fe67c['stack']);if(_0x4fe67c['name']){delete _0x4fe67c['name'];}_0x5d0159[_0xcf03('0x1b')](_0x494bc3)['send'](_0x4fe67c);};}exports['index']=function(_0x4de356,_0xb90e12){var _0xcbce2={},_0x62407d={},_0x124509={'count':0x0,'rows':[]};var _0x2f8a9f=_[_0xcf03('0x2c')](db[_0xcf03('0x2d')][_0xcf03('0x2e')],function(_0x412e99){return{'name':_0x412e99[_0xcf03('0x2f')],'type':_0x412e99['type'][_0xcf03('0x30')]};});_0x62407d[_0xcf03('0x31')]=_['map'](_0x2f8a9f,_0xcf03('0x32'));_0x62407d[_0xcf03('0x33')]=_[_0xcf03('0x34')](_0x4de356[_0xcf03('0x33')]);_0x62407d['filters']=_['intersection'](_0x62407d[_0xcf03('0x31')],_0x62407d[_0xcf03('0x33')]);_0xcbce2['attributes']=_[_0xcf03('0x35')](_0x62407d[_0xcf03('0x31')],qs[_0xcf03('0x36')](_0x4de356[_0xcf03('0x33')][_0xcf03('0x36')]));_0xcbce2[_0xcf03('0x37')]=_0xcbce2[_0xcf03('0x37')][_0xcf03('0x38')]?_0xcbce2[_0xcf03('0x37')]:_0x62407d['model'];if(!_0x4de356[_0xcf03('0x33')][_0xcf03('0x39')](_0xcf03('0x3a'))){_0xcbce2[_0xcf03('0x1f')]=qs['limit'](_0x4de356[_0xcf03('0x33')][_0xcf03('0x1f')]);_0xcbce2['offset']=qs['offset'](_0x4de356['query'][_0xcf03('0x1d')]);}_0xcbce2['order']=qs[_0xcf03('0x3b')](_0x4de356[_0xcf03('0x33')]['sort']);_0xcbce2[_0xcf03('0x3c')]=qs[_0xcf03('0x3d')](_[_0xcf03('0x3e')](_0x4de356['query'],_0x62407d['filters']),_0x2f8a9f);if(_0x4de356['query'][_0xcf03('0x3f')]){_0xcbce2[_0xcf03('0x3c')]=_[_0xcf03('0x40')](_0xcbce2[_0xcf03('0x3c')],{'$or':_[_0xcf03('0x2c')](_0x2f8a9f,function(_0x3dbb66){if(_0x3dbb66['type']!=='VIRTUAL'){var _0x1ae167={};_0x1ae167[_0x3dbb66[_0xcf03('0x32')]]={'$like':'%'+_0x4de356[_0xcf03('0x33')]['filter']+'%'};return _0x1ae167;}})});}_0xcbce2=_[_0xcf03('0x40')]({},_0xcbce2,_0x4de356[_0xcf03('0x41')]);var _0x4eca7f={'where':_0xcbce2[_0xcf03('0x3c')]};return db[_0xcf03('0x2d')][_0xcf03('0x20')](_0x4eca7f)[_0xcf03('0x27')](function(_0xa5062d){_0x124509['count']=_0xa5062d;if(_0x4de356[_0xcf03('0x33')]['includeAll']){_0xcbce2[_0xcf03('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0xcbce2);})['then'](function(_0x5e8c69){_0x124509['rows']=_0x5e8c69;return _0x124509;})[_0xcf03('0x27')](respondWithFilteredResult(_0xb90e12,_0xcbce2))[_0xcf03('0x43')](handleError(_0xb90e12,null));};exports['show']=function(_0x337d54,_0x4116ef){var _0x51cf7e={'raw':!![],'where':{'id':_0x337d54[_0xcf03('0x44')]['id']}},_0x556e9b={};_0x556e9b['model']=_['keys'](db[_0xcf03('0x2d')][_0xcf03('0x2e')]);_0x556e9b['query']=_[_0xcf03('0x34')](_0x337d54['query']);_0x556e9b[_0xcf03('0x3d')]=_[_0xcf03('0x35')](_0x556e9b[_0xcf03('0x31')],_0x556e9b['query']);_0x51cf7e[_0xcf03('0x37')]=_[_0xcf03('0x35')](_0x556e9b[_0xcf03('0x31')],qs[_0xcf03('0x36')](_0x337d54['query'][_0xcf03('0x36')]));_0x51cf7e[_0xcf03('0x37')]=_0x51cf7e[_0xcf03('0x37')][_0xcf03('0x38')]?_0x51cf7e[_0xcf03('0x37')]:_0x556e9b[_0xcf03('0x31')];if(_0x337d54['query']['includeAll']){_0x51cf7e[_0xcf03('0x42')]=[{'all':!![]}];}_0x51cf7e=_['merge']({},_0x51cf7e,_0x337d54[_0xcf03('0x41')]);return db['AnalyticExtractedReport'][_0xcf03('0x45')](_0x51cf7e)[_0xcf03('0x27')](handleEntityNotFound(_0x4116ef,null))[_0xcf03('0x27')](respondWithResult(_0x4116ef,null))[_0xcf03('0x43')](handleError(_0x4116ef,null));};exports[_0xcf03('0x46')]=function(_0x218acf,_0x5116a7){return db[_0xcf03('0x2d')]['create'](_0x218acf[_0xcf03('0x47')],{})[_0xcf03('0x27')](function(_0x1f5323){var _0x653257=_0x218acf[_0xcf03('0x48')][_0xcf03('0x29')]({'plain':!![]});if(!_0x653257)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x653257[_0xcf03('0x49')]===_0xcf03('0x48')){var _0x1c0a51=_0x1f5323[_0xcf03('0x29')]({'plain':!![]});var _0x1e34c0=_0xcf03('0x2a');return db[_0xcf03('0x4a')]['find']({'where':{'name':_0x1e34c0,'userProfileId':_0x653257[_0xcf03('0x4b')]},'raw':!![]})['then'](function(_0x2290b8){if(_0x2290b8&&_0x2290b8['autoAssociation']===0x0){return db['UserProfileResource'][_0xcf03('0x46')]({'name':_0x1c0a51[_0xcf03('0x32')],'resourceId':_0x1c0a51['id'],'type':_0x2290b8['name'],'sectionId':_0x2290b8['id']},{})[_0xcf03('0x27')](function(){return _0x1f5323;});}else{return _0x1f5323;}})[_0xcf03('0x43')](function(_0x3c772b){logger[_0xcf03('0x4c')](_0xcf03('0x4d'),_0x3c772b);throw _0x3c772b;});}return _0x1f5323;})['then'](respondWithResult(_0x5116a7,0xc9))[_0xcf03('0x43')](handleError(_0x5116a7,null));};exports[_0xcf03('0x26')]=function(_0x330f09,_0x2fd39a){if(_0x330f09['body']['id']){delete _0x330f09[_0xcf03('0x47')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x330f09[_0xcf03('0x44')]['id']}})[_0xcf03('0x27')](handleEntityNotFound(_0x2fd39a,null))[_0xcf03('0x27')](saveUpdates(_0x330f09['body'],null))['then'](respondWithResult(_0x2fd39a,null))[_0xcf03('0x43')](handleError(_0x2fd39a,null));};exports[_0xcf03('0x28')]=function(_0x58fdc6,_0x7b1783){return db[_0xcf03('0x2d')][_0xcf03('0x45')]({'where':{'id':_0x58fdc6['params']['id']}})[_0xcf03('0x27')](handleEntityNotFound(_0x7b1783,null))[_0xcf03('0x27')](removeEntity(_0x7b1783,null))[_0xcf03('0x43')](handleError(_0x7b1783,null));};exports['download']=function(_0x5005a2,_0x2d409c,_0x22b953){return db[_0xcf03('0x2d')][_0xcf03('0x45')]({'where':{'id':_0x5005a2['params']['id']},'attributes':[_0xcf03('0x32'),'basename',_0xcf03('0x4e'),_0xcf03('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x2d409c,null))[_0xcf03('0x27')](function(_0x3855b1){if(_0x3855b1){if(!fs[_0xcf03('0x50')](path[_0xcf03('0x51')](config[_0xcf03('0x52')],_0xcf03('0x53'),_0x3855b1['savename']))){throw new db['Sequelize'][(_0xcf03('0x54'))](_0xcf03('0x55'));}if(_0x5005a2[_0xcf03('0x33')][_0xcf03('0x56')]){return _0x2d409c['sendStatus'](0xc8);}return _0x2d409c[_0xcf03('0x57')](path[_0xcf03('0x51')](config[_0xcf03('0x52')],_0xcf03('0x53'),_0x3855b1[_0xcf03('0x4e')]),util[_0xcf03('0x58')]('%s.%s',_0x3855b1[_0xcf03('0x59')]||_0x3855b1['name'],_0x3855b1[_0xcf03('0x4f')][_0xcf03('0x5a')]()));}})[_0xcf03('0x43')](handleError(_0x2d409c,null));}; \ No newline at end of file +var _0x9b2b=['Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','output','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','end','sendStatus','error','stack','name','send','index','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','AnalyticExtractedReport','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError'];(function(_0x77d286,_0x1ddc6d){var _0x5446a5=function(_0x45e2cf){while(--_0x45e2cf){_0x77d286['push'](_0x77d286['shift']());}};_0x5446a5(++_0x1ddc6d);}(_0x9b2b,0x11a));var _0xb9b2=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x9b2b[_0x207d2f];return _0x3c3498;};'use strict';var emlformat=require(_0xb9b2('0x0'));var rimraf=require(_0xb9b2('0x1'));var zipdir=require(_0xb9b2('0x2'));var jsonpatch=require(_0xb9b2('0x3'));var rp=require(_0xb9b2('0x4'));var moment=require(_0xb9b2('0x5'));var BPromise=require(_0xb9b2('0x6'));var Mustache=require(_0xb9b2('0x7'));var util=require(_0xb9b2('0x8'));var path=require('path');var sox=require(_0xb9b2('0x9'));var csv=require('to-csv');var ejs=require(_0xb9b2('0xa'));var fs=require('fs');var fs_extra=require(_0xb9b2('0xb'));var _=require('lodash');var squel=require(_0xb9b2('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9b2('0xd'));var deskjs=require(_0xb9b2('0xe'));var toCsv=require(_0xb9b2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b2('0x10'));var authService=require(_0xb9b2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b2('0x12'));var logger=require(_0xb9b2('0x13'))('api');var utils=require(_0xb9b2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb9b2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x325fa9,_0xc51cec){_0xc51cec=_0xc51cec||0xcc;return function(_0x5979b0){if(_0x5979b0){return _0x325fa9['sendStatus'](_0xc51cec);}return _0x325fa9[_0xb9b2('0x16')](_0xc51cec)['end']();};}function respondWithResult(_0x5b0961,_0x2866a9){_0x2866a9=_0x2866a9||0xc8;return function(_0x56321e){if(_0x56321e){return _0x5b0961['status'](_0x2866a9)[_0xb9b2('0x17')](_0x56321e);}};}function respondWithFilteredResult(_0x3bc951,_0x21be21){return function(_0x5aad59){if(_0x5aad59){var _0x1371d2=typeof _0x21be21[_0xb9b2('0x18')]==='undefined'&&typeof _0x21be21['limit']===_0xb9b2('0x19');var _0x467663=_0x5aad59[_0xb9b2('0x1a')];var _0x3c2353=_0x1371d2?0x0:_0x21be21[_0xb9b2('0x18')];var _0x3a19cd=_0x1371d2?_0x5aad59['count']:_0x21be21[_0xb9b2('0x18')]+_0x21be21[_0xb9b2('0x1b')];var _0x10396c;if(_0x3a19cd>=_0x467663){_0x3a19cd=_0x467663;_0x10396c=0xc8;}else{_0x10396c=0xce;}_0x3bc951['status'](_0x10396c);return _0x3bc951[_0xb9b2('0x1c')](_0xb9b2('0x1d'),_0x3c2353+'-'+_0x3a19cd+'/'+_0x467663)[_0xb9b2('0x17')](_0x5aad59);}return null;};}function patchUpdates(_0x2daba6){return function(_0x35fb0f){try{jsonpatch[_0xb9b2('0x1e')](_0x35fb0f,_0x2daba6,!![]);}catch(_0x17fef2){return BPromise['reject'](_0x17fef2);}return _0x35fb0f[_0xb9b2('0x1f')]();};}function saveUpdates(_0x446056,_0x2f4d31){return function(_0x52deaa){if(_0x52deaa){return _0x52deaa['update'](_0x446056)['then'](function(_0x27fb98){return _0x27fb98;});}return null;};}function removeEntity(_0x23592d,_0x4423ca){return function(_0x645613){if(_0x645613){return _0x645613[_0xb9b2('0x20')]()[_0xb9b2('0x21')](function(){var _0x36d7b7=_0x645613['get']({'plain':!![]});var _0x384641='ExtractedReports';return db['UserProfileResource'][_0xb9b2('0x20')]({'where':{'type':_0x384641,'resourceId':_0x36d7b7['id']}})[_0xb9b2('0x21')](function(){return _0x645613;});})['then'](function(){_0x23592d[_0xb9b2('0x16')](0xcc)[_0xb9b2('0x22')]();});}};}function handleEntityNotFound(_0x740e58,_0xe522ab){return function(_0x58366a){if(!_0x58366a){_0x740e58[_0xb9b2('0x23')](0x194);}return _0x58366a;};}function handleError(_0x4c81d9,_0x70c3dc){_0x70c3dc=_0x70c3dc||0x1f4;return function(_0x355d10){logger[_0xb9b2('0x24')](_0x355d10[_0xb9b2('0x25')]);if(_0x355d10[_0xb9b2('0x26')]){delete _0x355d10[_0xb9b2('0x26')];}_0x4c81d9['status'](_0x70c3dc)[_0xb9b2('0x27')](_0x355d10);};}exports[_0xb9b2('0x28')]=function(_0x311a1d,_0xbd327){var _0x4e04cc={},_0x43f237={},_0x3b6a8e={'count':0x0,'rows':[]};var _0x110c67=_[_0xb9b2('0x29')](db['AnalyticExtractedReport']['rawAttributes'],function(_0x9497f8){return{'name':_0x9497f8['fieldName'],'type':_0x9497f8['type']['key']};});_0x43f237['model']=_[_0xb9b2('0x29')](_0x110c67,'name');_0x43f237[_0xb9b2('0x2a')]=_[_0xb9b2('0x2b')](_0x311a1d['query']);_0x43f237[_0xb9b2('0x2c')]=_[_0xb9b2('0x2d')](_0x43f237['model'],_0x43f237[_0xb9b2('0x2a')]);_0x4e04cc['attributes']=_['intersection'](_0x43f237[_0xb9b2('0x2e')],qs[_0xb9b2('0x2f')](_0x311a1d[_0xb9b2('0x2a')][_0xb9b2('0x2f')]));_0x4e04cc[_0xb9b2('0x30')]=_0x4e04cc[_0xb9b2('0x30')][_0xb9b2('0x31')]?_0x4e04cc[_0xb9b2('0x30')]:_0x43f237[_0xb9b2('0x2e')];if(!_0x311a1d['query'][_0xb9b2('0x32')](_0xb9b2('0x33'))){_0x4e04cc[_0xb9b2('0x1b')]=qs[_0xb9b2('0x1b')](_0x311a1d[_0xb9b2('0x2a')]['limit']);_0x4e04cc[_0xb9b2('0x18')]=qs[_0xb9b2('0x18')](_0x311a1d[_0xb9b2('0x2a')][_0xb9b2('0x18')]);}_0x4e04cc[_0xb9b2('0x34')]=qs['sort'](_0x311a1d['query']['sort']);_0x4e04cc[_0xb9b2('0x35')]=qs[_0xb9b2('0x2c')](_[_0xb9b2('0x36')](_0x311a1d['query'],_0x43f237[_0xb9b2('0x2c')]),_0x110c67);if(_0x311a1d[_0xb9b2('0x2a')][_0xb9b2('0x37')]){_0x4e04cc[_0xb9b2('0x35')]=_[_0xb9b2('0x38')](_0x4e04cc[_0xb9b2('0x35')],{'$or':_[_0xb9b2('0x29')](_0x110c67,function(_0x4bb78d){if(_0x4bb78d['type']!=='VIRTUAL'){var _0x3c62ff={};_0x3c62ff[_0x4bb78d[_0xb9b2('0x26')]]={'$like':'%'+_0x311a1d['query'][_0xb9b2('0x37')]+'%'};return _0x3c62ff;}})});}_0x4e04cc=_[_0xb9b2('0x38')]({},_0x4e04cc,_0x311a1d[_0xb9b2('0x39')]);var _0x312b48={'where':_0x4e04cc['where']};return db[_0xb9b2('0x3a')][_0xb9b2('0x1a')](_0x312b48)[_0xb9b2('0x21')](function(_0x38eb41){_0x3b6a8e['count']=_0x38eb41;if(_0x311a1d[_0xb9b2('0x2a')]['includeAll']){_0x4e04cc[_0xb9b2('0x3b')]=[{'all':!![]}];}return db[_0xb9b2('0x3a')][_0xb9b2('0x3c')](_0x4e04cc);})[_0xb9b2('0x21')](function(_0x4677ba){_0x3b6a8e[_0xb9b2('0x3d')]=_0x4677ba;return _0x3b6a8e;})[_0xb9b2('0x21')](respondWithFilteredResult(_0xbd327,_0x4e04cc))[_0xb9b2('0x3e')](handleError(_0xbd327,null));};exports[_0xb9b2('0x3f')]=function(_0x5d0d27,_0x300555){var _0x44f184={'raw':!![],'where':{'id':_0x5d0d27[_0xb9b2('0x40')]['id']}},_0x3ae2a6={};_0x3ae2a6['model']=_[_0xb9b2('0x2b')](db[_0xb9b2('0x3a')][_0xb9b2('0x41')]);_0x3ae2a6[_0xb9b2('0x2a')]=_['keys'](_0x5d0d27[_0xb9b2('0x2a')]);_0x3ae2a6[_0xb9b2('0x2c')]=_[_0xb9b2('0x2d')](_0x3ae2a6[_0xb9b2('0x2e')],_0x3ae2a6[_0xb9b2('0x2a')]);_0x44f184[_0xb9b2('0x30')]=_['intersection'](_0x3ae2a6[_0xb9b2('0x2e')],qs['fields'](_0x5d0d27[_0xb9b2('0x2a')]['fields']));_0x44f184['attributes']=_0x44f184[_0xb9b2('0x30')][_0xb9b2('0x31')]?_0x44f184[_0xb9b2('0x30')]:_0x3ae2a6[_0xb9b2('0x2e')];if(_0x5d0d27[_0xb9b2('0x2a')]['includeAll']){_0x44f184[_0xb9b2('0x3b')]=[{'all':!![]}];}_0x44f184=_[_0xb9b2('0x38')]({},_0x44f184,_0x5d0d27[_0xb9b2('0x39')]);return db[_0xb9b2('0x3a')][_0xb9b2('0x42')](_0x44f184)[_0xb9b2('0x21')](handleEntityNotFound(_0x300555,null))[_0xb9b2('0x21')](respondWithResult(_0x300555,null))[_0xb9b2('0x3e')](handleError(_0x300555,null));};exports[_0xb9b2('0x43')]=function(_0x1b8bf0,_0x10d606){return db[_0xb9b2('0x3a')][_0xb9b2('0x43')](_0x1b8bf0[_0xb9b2('0x44')],{})[_0xb9b2('0x21')](function(_0x20bac2){var _0x53fea2=_0x1b8bf0[_0xb9b2('0x45')][_0xb9b2('0x46')]({'plain':!![]});if(!_0x53fea2)throw new Error(_0xb9b2('0x47'));if(_0x53fea2['role']===_0xb9b2('0x45')){var _0x3b11c1=_0x20bac2[_0xb9b2('0x46')]({'plain':!![]});var _0xcb09ca=_0xb9b2('0x48');return db['UserProfileSection'][_0xb9b2('0x42')]({'where':{'name':_0xcb09ca,'userProfileId':_0x53fea2[_0xb9b2('0x49')]},'raw':!![]})[_0xb9b2('0x21')](function(_0x155c27){if(_0x155c27&&_0x155c27[_0xb9b2('0x4a')]===0x0){return db[_0xb9b2('0x4b')][_0xb9b2('0x43')]({'name':_0x3b11c1[_0xb9b2('0x26')],'resourceId':_0x3b11c1['id'],'type':_0x155c27[_0xb9b2('0x26')],'sectionId':_0x155c27['id']},{})[_0xb9b2('0x21')](function(){return _0x20bac2;});}else{return _0x20bac2;}})['catch'](function(_0x45860e){logger[_0xb9b2('0x24')](_0xb9b2('0x4c'),_0x45860e);throw _0x45860e;});}return _0x20bac2;})[_0xb9b2('0x21')](respondWithResult(_0x10d606,0xc9))[_0xb9b2('0x3e')](handleError(_0x10d606,null));};exports[_0xb9b2('0x4d')]=function(_0x220180,_0x435166){if(_0x220180[_0xb9b2('0x44')]['id']){delete _0x220180[_0xb9b2('0x44')]['id'];}return db[_0xb9b2('0x3a')][_0xb9b2('0x42')]({'where':{'id':_0x220180[_0xb9b2('0x40')]['id']}})[_0xb9b2('0x21')](handleEntityNotFound(_0x435166,null))[_0xb9b2('0x21')](saveUpdates(_0x220180[_0xb9b2('0x44')],null))[_0xb9b2('0x21')](respondWithResult(_0x435166,null))['catch'](handleError(_0x435166,null));};exports[_0xb9b2('0x20')]=function(_0x5ed7b5,_0x1c84b2){return db['AnalyticExtractedReport'][_0xb9b2('0x42')]({'where':{'id':_0x5ed7b5[_0xb9b2('0x40')]['id']}})[_0xb9b2('0x21')](handleEntityNotFound(_0x1c84b2,null))[_0xb9b2('0x21')](removeEntity(_0x1c84b2,null))[_0xb9b2('0x3e')](handleError(_0x1c84b2,null));};exports[_0xb9b2('0x4e')]=function(_0x456478,_0x3f404f,_0x35704d){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x456478[_0xb9b2('0x40')]['id']},'attributes':['name','basename',_0xb9b2('0x4f'),'output'],'raw':!![]})[_0xb9b2('0x21')](handleEntityNotFound(_0x3f404f,null))[_0xb9b2('0x21')](function(_0x4e40a9){if(_0x4e40a9){if(!fs[_0xb9b2('0x50')](path[_0xb9b2('0x51')](config[_0xb9b2('0x52')],_0xb9b2('0x53'),_0x4e40a9[_0xb9b2('0x4f')]))){throw new db[(_0xb9b2('0x54'))][(_0xb9b2('0x55'))](_0xb9b2('0x56'));}if(_0x456478[_0xb9b2('0x2a')][_0xb9b2('0x57')]){return _0x3f404f[_0xb9b2('0x23')](0xc8);}return _0x3f404f['download'](path[_0xb9b2('0x51')](config[_0xb9b2('0x52')],'server/files/reports',_0x4e40a9[_0xb9b2('0x4f')]),util[_0xb9b2('0x58')](_0xb9b2('0x59'),_0x4e40a9[_0xb9b2('0x5a')]||_0x4e40a9[_0xb9b2('0x26')],_0x4e40a9[_0xb9b2('0x5b')]['toLowerCase']()));}})[_0xb9b2('0x3e')](handleError(_0x3f404f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 8b3b697..51ede89 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 _0xdf9e=['AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x2b1e8a,_0x354f05){var _0x35cf1e=function(_0x5b4e86){while(--_0x5b4e86){_0x2b1e8a['push'](_0x2b1e8a['shift']());}};_0x35cf1e(++_0x354f05);}(_0xdf9e,0x12b));var _0xedf9=function(_0x21f2e2,_0x1fff90){_0x21f2e2=_0x21f2e2-0x0;var _0x5ed0e1=_0xdf9e[_0x21f2e2];return _0x5ed0e1;};'use strict';var _=require('lodash');var util=require(_0xedf9('0x0'));var logger=require(_0xedf9('0x1'))(_0xedf9('0x2'));var moment=require('moment');var BPromise=require(_0xedf9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xedf9('0x4'));var config=require(_0xedf9('0x5'));var attributes=require(_0xedf9('0x6'));module['exports']=function(_0x5474d0,_0x15ba52){return _0x5474d0['define'](_0xedf9('0x7'),attributes,{'tableName':_0xedf9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf5e4=['exports','define','analytics_extracted_reports','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xf5e4,0x1db));var _0x4f5e=function(_0x1d4817,_0x3d880a){_0x1d4817=_0x1d4817-0x0;var _0x140227=_0xf5e4[_0x1d4817];return _0x140227;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f5e('0x0'))(_0x4f5e('0x1'));var moment=require(_0x4f5e('0x2'));var BPromise=require(_0x4f5e('0x3'));var rp=require(_0x4f5e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x4f5e('0x5')]=function(_0xe1f12f,_0x48a971){return _0xe1f12f[_0x4f5e('0x6')]('AnalyticExtractedReport',attributes,{'tableName':_0x4f5e('0x7'),'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 4f3459b..b744667 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 _0xac10=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4dab87,_0x363ff7){var _0x1fa5a2=function(_0x451848){while(--_0x451848){_0x4dab87['push'](_0x4dab87['shift']());}};_0x1fa5a2(++_0x363ff7);}(_0xac10,0x14b));var _0x0ac1=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xac10[_0x34b87f];return _0x449805;};'use strict';var _=require(_0x0ac1('0x0'));var util=require(_0x0ac1('0x1'));var moment=require(_0x0ac1('0x2'));var BPromise=require(_0x0ac1('0x3'));var rs=require(_0x0ac1('0x4'));var fs=require('fs');var Redis=require(_0x0ac1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0ac1('0x6'));var logger=require('../../config/logger')(_0x0ac1('0x7'));var config=require(_0x0ac1('0x8'));var jayson=require(_0x0ac1('0x9'));var client=jayson[_0x0ac1('0xa')][_0x0ac1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a1ad0,_0x4f900c,_0x3d6f03){return new BPromise(function(_0x3b720a,_0x427a2d){return client[_0x0ac1('0xc')](_0x4a1ad0,_0x3d6f03)[_0x0ac1('0xd')](function(_0x292f91){logger[_0x0ac1('0xe')](_0x0ac1('0xf'),_0x4f900c,_0x0ac1('0x10'));logger[_0x0ac1('0x11')](_0x0ac1('0x12'),_0x4f900c,_0x0ac1('0x10'),JSON['stringify'](_0x292f91));if(_0x292f91[_0x0ac1('0x13')]){if(_0x292f91['error'][_0x0ac1('0x14')]===0x1f4){logger[_0x0ac1('0x13')](_0x0ac1('0xf'),_0x4f900c,_0x292f91['error'][_0x0ac1('0x15')]);return _0x427a2d(_0x292f91[_0x0ac1('0x13')][_0x0ac1('0x15')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x4f900c,_0x292f91[_0x0ac1('0x13')][_0x0ac1('0x15')]);return _0x3b720a(_0x292f91[_0x0ac1('0x13')]['message']);}else{logger[_0x0ac1('0xe')](_0x0ac1('0xf'),_0x4f900c,_0x0ac1('0x10'));_0x3b720a(_0x292f91['result']['message']);}})[_0x0ac1('0x16')](function(_0x2bbe66){logger[_0x0ac1('0x13')](_0x0ac1('0xf'),_0x4f900c,_0x2bbe66);_0x427a2d(_0x2bbe66);});});} \ No newline at end of file +var _0xf651=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x222688,_0x46c5eb){var _0x437433=function(_0x29958c){while(--_0x29958c){_0x222688['push'](_0x222688['shift']());}};_0x437433(++_0x46c5eb);}(_0xf651,0xac));var _0x1f65=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf651[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1f65('0x0'));var BPromise=require('bluebird');var rs=require(_0x1f65('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f65('0x2'))['db'];var utils=require(_0x1f65('0x3'));var logger=require(_0x1f65('0x4'))(_0x1f65('0x5'));var config=require('../../config/environment');var jayson=require(_0x1f65('0x6'));var client=jayson['client'][_0x1f65('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21d65f,_0x4b8536,_0xd38738){return new BPromise(function(_0x1e2b22,_0xe8c57a){return client['request'](_0x21d65f,_0xd38738)['then'](function(_0xbd58d4){logger['info'](_0x1f65('0x8'),_0x4b8536,_0x1f65('0x9'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4b8536,_0x1f65('0x9'),JSON[_0x1f65('0xa')](_0xbd58d4));if(_0xbd58d4[_0x1f65('0xb')]){if(_0xbd58d4[_0x1f65('0xb')]['code']===0x1f4){logger[_0x1f65('0xb')](_0x1f65('0x8'),_0x4b8536,_0xbd58d4[_0x1f65('0xb')][_0x1f65('0xc')]);return _0xe8c57a(_0xbd58d4['error'][_0x1f65('0xc')]);}logger[_0x1f65('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4b8536,_0xbd58d4[_0x1f65('0xb')]['message']);return _0x1e2b22(_0xbd58d4[_0x1f65('0xb')][_0x1f65('0xc')]);}else{logger['info'](_0x1f65('0x8'),_0x4b8536,_0x1f65('0x9'));_0x1e2b22(_0xbd58d4[_0x1f65('0xd')][_0x1f65('0xc')]);}})[_0x1f65('0xe')](function(_0x550845){logger['error'](_0x1f65('0x8'),_0x4b8536,_0x550845);_0xe8c57a(_0x550845);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 5ee00d3..ea44eef 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 _0x452e=['put','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','index','get','/:id','/:id/download','post'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x452e,0x148));var _0xe452=function(_0x6aa6e,_0x3d0e3d){_0x6aa6e=_0x6aa6e-0x0;var _0x550846=_0x452e[_0x6aa6e];return _0x550846;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe452('0x0'));var timeout=require(_0xe452('0x1'));var express=require(_0xe452('0x2'));var router=express[_0xe452('0x3')]();var fs_extra=require(_0xe452('0x4'));var auth=require(_0xe452('0x5'));var interaction=require(_0xe452('0x6'));var config=require('../../config/environment');var controller=require(_0xe452('0x7'));router['get']('/',auth[_0xe452('0x8')](),controller[_0xe452('0x9')]);router[_0xe452('0xa')](_0xe452('0xb'),auth[_0xe452('0x8')](),controller['show']);router['get'](_0xe452('0xc'),auth['isAuthenticated'](),controller['download']);router[_0xe452('0xd')]('/',auth[_0xe452('0x8')](),controller['create']);router[_0xe452('0xe')]('/:id',auth[_0xe452('0x8')](),controller['update']);router[_0xe452('0xf')](_0xe452('0xb'),auth['isAuthenticated'](),controller[_0xe452('0x10')]);module[_0xe452('0x11')]=router; \ No newline at end of file +var _0x91c5=['../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','util','Router','fs-extra','../../components/interaction/service'];(function(_0x1cb61a,_0x59b05d){var _0x32077f=function(_0x2662c5){while(--_0x2662c5){_0x1cb61a['push'](_0x1cb61a['shift']());}};_0x32077f(++_0x59b05d);}(_0x91c5,0x137));var _0x591c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x91c5[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x591c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x591c('0x1')]();var fs_extra=require(_0x591c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x591c('0x3'));var config=require(_0x591c('0x4'));var controller=require('./analyticExtractedReport.controller');router[_0x591c('0x5')]('/',auth[_0x591c('0x6')](),controller[_0x591c('0x7')]);router[_0x591c('0x5')](_0x591c('0x8'),auth[_0x591c('0x6')](),controller[_0x591c('0x9')]);router[_0x591c('0x5')]('/:id/download',auth[_0x591c('0x6')](),controller['download']);router[_0x591c('0xa')]('/',auth[_0x591c('0x6')](),controller[_0x591c('0xb')]);router[_0x591c('0xc')](_0x591c('0x8'),auth[_0x591c('0x6')](),controller[_0x591c('0xd')]);router[_0x591c('0xe')](_0x591c('0x8'),auth[_0x591c('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 596adc6..0d17d7d 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 _0x89b5=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x438464,_0x15612d){var _0x430abf=function(_0xc114c2){while(--_0xc114c2){_0x438464['push'](_0x438464['shift']());}};_0x430abf(++_0x15612d);}(_0x89b5,0x189));var _0x589b=function(_0x4d2879,_0x5b66ab){_0x4d2879=_0x4d2879-0x0;var _0x321d16=_0x89b5[_0x4d2879];return _0x321d16;};'use strict';var Sequelize=require(_0x589b('0x0'));module[_0x589b('0x1')]={'field':{'type':Sequelize[_0x589b('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x589b('0x3')]},'groupBy':{'type':Sequelize[_0x589b('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x589b('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xc809=['sequelize','STRING','BOOLEAN'];(function(_0x5d438a,_0x50b664){var _0x36a087=function(_0x2434d4){while(--_0x2434d4){_0x5d438a['push'](_0x5d438a['shift']());}};_0x36a087(++_0x50b664);}(_0xc809,0x192));var _0x9c80=function(_0x41d1ab,_0xf32f31){_0x41d1ab=_0x41d1ab-0x0;var _0xaadc21=_0xc809[_0x41d1ab];return _0xaadc21;};'use strict';var Sequelize=require(_0x9c80('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x9c80('0x1')]},'function':{'type':Sequelize[_0x9c80('0x1')]},'format':{'type':Sequelize[_0x9c80('0x1')]},'groupBy':{'type':Sequelize[_0x9c80('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9c80('0x1')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index dd6f074..9a4a111 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 _0xf031=['request-promise','moment','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','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','Content-Range','json','save','update','then','destroy','error','name','send','AnalyticFieldReport','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch'];(function(_0x58cf87,_0x3d57cb){var _0x5f2e3f=function(_0x5d90ba){while(--_0x5d90ba){_0x58cf87['push'](_0x58cf87['shift']());}};_0x5f2e3f(++_0x3d57cb);}(_0xf031,0xe4));var _0x1f03=function(_0x258134,_0x252177){_0x258134=_0x258134-0x0;var _0x2c2d74=_0xf031[_0x258134];return _0x2c2d74;};'use strict';var emlformat=require(_0x1f03('0x0'));var rimraf=require(_0x1f03('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f03('0x2'));var rp=require(_0x1f03('0x3'));var moment=require(_0x1f03('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1f03('0x5'));var csv=require(_0x1f03('0x6'));var ejs=require(_0x1f03('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f03('0x8'));var jsforce=require(_0x1f03('0x9'));var deskjs=require(_0x1f03('0xa'));var toCsv=require('to-csv');var querystring=require(_0x1f03('0xb'));var Papa=require('papaparse');var Redis=require(_0x1f03('0xc'));var authService=require(_0x1f03('0xd'));var qs=require(_0x1f03('0xe'));var as=require(_0x1f03('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f03('0x10'))(_0x1f03('0x11'));var utils=require('../../config/utils');var config=require(_0x1f03('0x12'));var licenseUtil=require(_0x1f03('0x13'));var db=require(_0x1f03('0x14'))['db'];function respondWithStatusCode(_0x496423,_0x59029e){_0x59029e=_0x59029e||0xcc;return function(_0x45d09b){if(_0x45d09b){return _0x496423[_0x1f03('0x15')](_0x59029e);}return _0x496423[_0x1f03('0x16')](_0x59029e)[_0x1f03('0x17')]();};}function respondWithResult(_0x5096d3,_0x595bbe){_0x595bbe=_0x595bbe||0xc8;return function(_0xfc3bff){if(_0xfc3bff){return _0x5096d3[_0x1f03('0x16')](_0x595bbe)['json'](_0xfc3bff);}};}function respondWithFilteredResult(_0x359f0f,_0x4d4380){return function(_0x35fc94){if(_0x35fc94){var _0x3fda12=typeof _0x4d4380[_0x1f03('0x18')]==='undefined'&&typeof _0x4d4380[_0x1f03('0x19')]===_0x1f03('0x1a');var _0x896601=_0x35fc94[_0x1f03('0x1b')];var _0x43d334=_0x3fda12?0x0:_0x4d4380['offset'];var _0x1c9382=_0x3fda12?_0x35fc94[_0x1f03('0x1b')]:_0x4d4380[_0x1f03('0x18')]+_0x4d4380[_0x1f03('0x19')];var _0x954afe;if(_0x1c9382>=_0x896601){_0x1c9382=_0x896601;_0x954afe=0xc8;}else{_0x954afe=0xce;}_0x359f0f[_0x1f03('0x16')](_0x954afe);return _0x359f0f['set'](_0x1f03('0x1c'),_0x43d334+'-'+_0x1c9382+'/'+_0x896601)[_0x1f03('0x1d')](_0x35fc94);}return null;};}function patchUpdates(_0x53d91e){return function(_0x6fe9e8){try{jsonpatch['apply'](_0x6fe9e8,_0x53d91e,!![]);}catch(_0x36f17c){return BPromise['reject'](_0x36f17c);}return _0x6fe9e8[_0x1f03('0x1e')]();};}function saveUpdates(_0x5b67b9,_0x1c2f55){return function(_0x3cf273){if(_0x3cf273){return _0x3cf273[_0x1f03('0x1f')](_0x5b67b9)[_0x1f03('0x20')](function(_0x10b0d7){return _0x10b0d7;});}return null;};}function removeEntity(_0x3feab6,_0x4c7e76){return function(_0x142bef){if(_0x142bef){return _0x142bef[_0x1f03('0x21')]()[_0x1f03('0x20')](function(){_0x3feab6[_0x1f03('0x16')](0xcc)[_0x1f03('0x17')]();});}};}function handleEntityNotFound(_0x53c02a,_0x34fe46){return function(_0x5e0add){if(!_0x5e0add){_0x53c02a[_0x1f03('0x15')](0x194);}return _0x5e0add;};}function handleError(_0x448412,_0x1b7aab){_0x1b7aab=_0x1b7aab||0x1f4;return function(_0x58e16b){logger[_0x1f03('0x22')](_0x58e16b['stack']);if(_0x58e16b[_0x1f03('0x23')]){delete _0x58e16b[_0x1f03('0x23')];}_0x448412[_0x1f03('0x16')](_0x1b7aab)[_0x1f03('0x24')](_0x58e16b);};}exports['index']=function(_0x1bed58,_0x319df0){var _0x5e4fec={},_0x5d0036={},_0x152734={'count':0x0,'rows':[]};var _0x3598c1=_['map'](db[_0x1f03('0x25')]['rawAttributes'],function(_0x11505e){return{'name':_0x11505e['fieldName'],'type':_0x11505e[_0x1f03('0x26')][_0x1f03('0x27')]};});_0x5d0036[_0x1f03('0x28')]=_[_0x1f03('0x29')](_0x3598c1,_0x1f03('0x23'));_0x5d0036[_0x1f03('0x2a')]=_[_0x1f03('0x2b')](_0x1bed58[_0x1f03('0x2a')]);_0x5d0036[_0x1f03('0x2c')]=_['intersection'](_0x5d0036[_0x1f03('0x28')],_0x5d0036[_0x1f03('0x2a')]);_0x5e4fec['attributes']=_[_0x1f03('0x2d')](_0x5d0036[_0x1f03('0x28')],qs[_0x1f03('0x2e')](_0x1bed58[_0x1f03('0x2a')][_0x1f03('0x2e')]));_0x5e4fec[_0x1f03('0x2f')]=_0x5e4fec[_0x1f03('0x2f')][_0x1f03('0x30')]?_0x5e4fec[_0x1f03('0x2f')]:_0x5d0036[_0x1f03('0x28')];if(!_0x1bed58[_0x1f03('0x2a')][_0x1f03('0x31')]('nolimit')){_0x5e4fec[_0x1f03('0x19')]=qs['limit'](_0x1bed58[_0x1f03('0x2a')]['limit']);_0x5e4fec[_0x1f03('0x18')]=qs['offset'](_0x1bed58[_0x1f03('0x2a')]['offset']);}_0x5e4fec[_0x1f03('0x32')]=qs[_0x1f03('0x33')](_0x1bed58[_0x1f03('0x2a')]['sort']);_0x5e4fec['where']=qs[_0x1f03('0x2c')](_[_0x1f03('0x34')](_0x1bed58[_0x1f03('0x2a')],_0x5d0036[_0x1f03('0x2c')]),_0x3598c1);if(_0x1bed58['query']['filter']){_0x5e4fec[_0x1f03('0x35')]=_[_0x1f03('0x36')](_0x5e4fec['where'],{'$or':_['map'](_0x3598c1,function(_0x495842){if(_0x495842[_0x1f03('0x26')]!==_0x1f03('0x37')){var _0x342cf4={};_0x342cf4[_0x495842['name']]={'$like':'%'+_0x1bed58[_0x1f03('0x2a')][_0x1f03('0x38')]+'%'};return _0x342cf4;}})});}_0x5e4fec=_[_0x1f03('0x36')]({},_0x5e4fec,_0x1bed58[_0x1f03('0x39')]);var _0x420792={'where':_0x5e4fec[_0x1f03('0x35')]};return db[_0x1f03('0x25')]['count'](_0x420792)['then'](function(_0x39947f){_0x152734[_0x1f03('0x1b')]=_0x39947f;if(_0x1bed58[_0x1f03('0x2a')][_0x1f03('0x3a')]){_0x5e4fec[_0x1f03('0x3b')]=[{'all':!![]}];}return db[_0x1f03('0x25')][_0x1f03('0x3c')](_0x5e4fec);})[_0x1f03('0x20')](function(_0x21a331){_0x152734[_0x1f03('0x3d')]=_0x21a331;return _0x152734;})[_0x1f03('0x20')](respondWithFilteredResult(_0x319df0,_0x5e4fec))[_0x1f03('0x3e')](handleError(_0x319df0,null));};exports['show']=function(_0x5a8c00,_0xd4bac2){var _0x1627c6={'raw':![],'where':{'id':_0x5a8c00[_0x1f03('0x3f')]['id']}},_0x298942={};_0x298942[_0x1f03('0x28')]=_[_0x1f03('0x2b')](db[_0x1f03('0x25')][_0x1f03('0x40')]);_0x298942['query']=_[_0x1f03('0x2b')](_0x5a8c00['query']);_0x298942['filters']=_[_0x1f03('0x2d')](_0x298942[_0x1f03('0x28')],_0x298942['query']);_0x1627c6[_0x1f03('0x2f')]=_[_0x1f03('0x2d')](_0x298942[_0x1f03('0x28')],qs[_0x1f03('0x2e')](_0x5a8c00[_0x1f03('0x2a')][_0x1f03('0x2e')]));_0x1627c6[_0x1f03('0x2f')]=_0x1627c6['attributes']['length']?_0x1627c6['attributes']:_0x298942['model'];if(_0x5a8c00[_0x1f03('0x2a')][_0x1f03('0x3a')]){_0x1627c6[_0x1f03('0x3b')]=[{'all':!![]}];}_0x1627c6=_['merge']({},_0x1627c6,_0x5a8c00[_0x1f03('0x39')]);return db['AnalyticFieldReport'][_0x1f03('0x41')](_0x1627c6)['then'](handleEntityNotFound(_0xd4bac2,null))['then'](respondWithResult(_0xd4bac2,null))[_0x1f03('0x3e')](handleError(_0xd4bac2,null));};exports[_0x1f03('0x42')]=function(_0x35d6cd,_0x3f6ad7){return db[_0x1f03('0x25')]['create'](_0x35d6cd[_0x1f03('0x43')],{})[_0x1f03('0x20')](respondWithResult(_0x3f6ad7,0xc9))[_0x1f03('0x3e')](handleError(_0x3f6ad7,null));};exports[_0x1f03('0x44')]=function(_0x2f969b,_0x1bfd58){return db[_0x1f03('0x25')][_0x1f03('0x44')](_0x2f969b[_0x1f03('0x43')],{'raw':![],'individualHooks':!![]})[_0x1f03('0x20')](respondWithResult(_0x1bfd58,0xc9))[_0x1f03('0x3e')](handleError(_0x1bfd58,null));};exports[_0x1f03('0x1f')]=function(_0xa337b7,_0x530590){if(_0xa337b7[_0x1f03('0x43')]['id']){delete _0xa337b7[_0x1f03('0x43')]['id'];}return db[_0x1f03('0x25')][_0x1f03('0x41')]({'where':{'id':_0xa337b7[_0x1f03('0x3f')]['id']}})[_0x1f03('0x20')](handleEntityNotFound(_0x530590,null))['then'](saveUpdates(_0xa337b7[_0x1f03('0x43')],null))[_0x1f03('0x20')](respondWithResult(_0x530590,null))[_0x1f03('0x3e')](handleError(_0x530590,null));};exports[_0x1f03('0x21')]=function(_0x4f7aa0,_0x4cef0b){return db[_0x1f03('0x25')]['find']({'where':{'id':_0x4f7aa0['params']['id']}})['then'](handleEntityNotFound(_0x4cef0b,null))[_0x1f03('0x20')](removeEntity(_0x4cef0b,null))['catch'](handleError(_0x4cef0b,null));};exports[_0x1f03('0x45')]=function(_0x1b512d,_0x4218a1){return db['AnalyticFieldReport'][_0x1f03('0x21')]({'where':{'id':_0x1b512d['query'][_0x1f03('0x46')]||[]},'raw':![],'individualHooks':!![]})[_0x1f03('0x20')](respondWithResult(_0x4218a1,0xcc))[_0x1f03('0x3e')](handleError(_0x4218a1,null));};exports[_0x1f03('0x47')]=function(_0xd7d49e,_0x2719ea,_0x14d604){return db[_0x1f03('0x48')][_0x1f03('0x49')]({'where':{'id':_0xd7d49e[_0x1f03('0x3f')]['id']}})[_0x1f03('0x20')](handleEntityNotFound(_0x2719ea,null))[_0x1f03('0x20')](function(_0x3e0c13){if(_0x3e0c13){return db[_0x1f03('0x4a')][_0x1f03('0x4b')](function(_0x43f81e){return db['AnalyticFieldReport'][_0x1f03('0x21')]({'where':{'CustomReportId':_0xd7d49e[_0x1f03('0x3f')]['id']},'transaction':_0x43f81e})[_0x1f03('0x20')](function(_0x293779){var _0x3f7460=_[_0x1f03('0x29')](_0xd7d49e[_0x1f03('0x43')],function(_0x4217d5){delete _0x4217d5['id'];_0x4217d5[_0x1f03('0x4c')]=_0xd7d49e[_0x1f03('0x3f')]['id'];return _0x4217d5;});return db[_0x1f03('0x25')][_0x1f03('0x44')](_0x3f7460,{'transaction':_0x43f81e});});})[_0x1f03('0x20')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0xd7d49e[_0x1f03('0x3f')]['id']}});});}})[_0x1f03('0x20')](respondWithResult(_0x2719ea,null))[_0x1f03('0x3e')](handleError(_0x2719ea,null));}; \ No newline at end of file +var _0xa718=['status','end','json','undefined','limit','count','offset','apply','save','update','then','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','length','find','create','body','bulkCreate','destroy','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0xc674a4,_0x1aca13){var _0x579921=function(_0x57465b){while(--_0x57465b){_0xc674a4['push'](_0xc674a4['shift']());}};_0x579921(++_0x1aca13);}(_0xa718,0x83));var _0x8a71=function(_0x42e184,_0x501983){_0x42e184=_0x42e184-0x0;var _0x1d0a24=_0xa718[_0x42e184];return _0x1d0a24;};'use strict';var emlformat=require(_0x8a71('0x0'));var rimraf=require(_0x8a71('0x1'));var zipdir=require(_0x8a71('0x2'));var jsonpatch=require(_0x8a71('0x3'));var rp=require('request-promise');var moment=require(_0x8a71('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8a71('0x5'));var util=require(_0x8a71('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8a71('0x7'));var ejs=require(_0x8a71('0x8'));var fs=require('fs');var fs_extra=require(_0x8a71('0x9'));var _=require('lodash');var squel=require(_0x8a71('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8a71('0xb'));var toCsv=require(_0x8a71('0x7'));var querystring=require(_0x8a71('0xc'));var Papa=require(_0x8a71('0xd'));var Redis=require('ioredis');var authService=require(_0x8a71('0xe'));var qs=require(_0x8a71('0xf'));var as=require(_0x8a71('0x10'));var hardwareService=require(_0x8a71('0x11'));var logger=require(_0x8a71('0x12'))(_0x8a71('0x13'));var utils=require(_0x8a71('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8a71('0x15'))['db'];function respondWithStatusCode(_0x2df96d,_0x548a94){_0x548a94=_0x548a94||0xcc;return function(_0x2b65ad){if(_0x2b65ad){return _0x2df96d[_0x8a71('0x16')](_0x548a94);}return _0x2df96d[_0x8a71('0x17')](_0x548a94)[_0x8a71('0x18')]();};}function respondWithResult(_0x8c6cca,_0x25ce94){_0x25ce94=_0x25ce94||0xc8;return function(_0x49af19){if(_0x49af19){return _0x8c6cca[_0x8a71('0x17')](_0x25ce94)[_0x8a71('0x19')](_0x49af19);}};}function respondWithFilteredResult(_0x2a7ff1,_0x39e663){return function(_0x27d106){if(_0x27d106){var _0x20074d=typeof _0x39e663['offset']===_0x8a71('0x1a')&&typeof _0x39e663[_0x8a71('0x1b')]===_0x8a71('0x1a');var _0x5055fc=_0x27d106[_0x8a71('0x1c')];var _0x39111a=_0x20074d?0x0:_0x39e663[_0x8a71('0x1d')];var _0xabef77=_0x20074d?_0x27d106[_0x8a71('0x1c')]:_0x39e663[_0x8a71('0x1d')]+_0x39e663[_0x8a71('0x1b')];var _0x1d40bb;if(_0xabef77>=_0x5055fc){_0xabef77=_0x5055fc;_0x1d40bb=0xc8;}else{_0x1d40bb=0xce;}_0x2a7ff1[_0x8a71('0x17')](_0x1d40bb);return _0x2a7ff1['set']('Content-Range',_0x39111a+'-'+_0xabef77+'/'+_0x5055fc)[_0x8a71('0x19')](_0x27d106);}return null;};}function patchUpdates(_0x1d5888){return function(_0x11ec56){try{jsonpatch[_0x8a71('0x1e')](_0x11ec56,_0x1d5888,!![]);}catch(_0x2533d2){return BPromise['reject'](_0x2533d2);}return _0x11ec56[_0x8a71('0x1f')]();};}function saveUpdates(_0x32cfbb,_0x2dbf7d){return function(_0x344866){if(_0x344866){return _0x344866[_0x8a71('0x20')](_0x32cfbb)['then'](function(_0x24b568){return _0x24b568;});}return null;};}function removeEntity(_0x2e7795,_0x763f00){return function(_0x5897c6){if(_0x5897c6){return _0x5897c6['destroy']()[_0x8a71('0x21')](function(){_0x2e7795[_0x8a71('0x17')](0xcc)[_0x8a71('0x18')]();});}};}function handleEntityNotFound(_0x588f6c,_0x47b150){return function(_0x203d37){if(!_0x203d37){_0x588f6c[_0x8a71('0x16')](0x194);}return _0x203d37;};}function handleError(_0x831283,_0x5b47c4){_0x5b47c4=_0x5b47c4||0x1f4;return function(_0x4a377d){logger[_0x8a71('0x22')](_0x4a377d[_0x8a71('0x23')]);if(_0x4a377d[_0x8a71('0x24')]){delete _0x4a377d['name'];}_0x831283[_0x8a71('0x17')](_0x5b47c4)[_0x8a71('0x25')](_0x4a377d);};}exports['index']=function(_0x80eb31,_0xc6d17d){var _0x3697fe={},_0x14bdd3={},_0x2074e6={'count':0x0,'rows':[]};var _0xaba79=_[_0x8a71('0x26')](db[_0x8a71('0x27')][_0x8a71('0x28')],function(_0x51309e){return{'name':_0x51309e[_0x8a71('0x29')],'type':_0x51309e[_0x8a71('0x2a')]['key']};});_0x14bdd3[_0x8a71('0x2b')]=_[_0x8a71('0x26')](_0xaba79,_0x8a71('0x24'));_0x14bdd3[_0x8a71('0x2c')]=_[_0x8a71('0x2d')](_0x80eb31[_0x8a71('0x2c')]);_0x14bdd3[_0x8a71('0x2e')]=_['intersection'](_0x14bdd3['model'],_0x14bdd3[_0x8a71('0x2c')]);_0x3697fe[_0x8a71('0x2f')]=_[_0x8a71('0x30')](_0x14bdd3[_0x8a71('0x2b')],qs[_0x8a71('0x31')](_0x80eb31[_0x8a71('0x2c')]['fields']));_0x3697fe[_0x8a71('0x2f')]=_0x3697fe[_0x8a71('0x2f')]['length']?_0x3697fe[_0x8a71('0x2f')]:_0x14bdd3[_0x8a71('0x2b')];if(!_0x80eb31[_0x8a71('0x2c')]['hasOwnProperty'](_0x8a71('0x32'))){_0x3697fe[_0x8a71('0x1b')]=qs[_0x8a71('0x1b')](_0x80eb31[_0x8a71('0x2c')][_0x8a71('0x1b')]);_0x3697fe['offset']=qs[_0x8a71('0x1d')](_0x80eb31[_0x8a71('0x2c')][_0x8a71('0x1d')]);}_0x3697fe[_0x8a71('0x33')]=qs['sort'](_0x80eb31[_0x8a71('0x2c')]['sort']);_0x3697fe[_0x8a71('0x34')]=qs[_0x8a71('0x2e')](_[_0x8a71('0x35')](_0x80eb31[_0x8a71('0x2c')],_0x14bdd3[_0x8a71('0x2e')]),_0xaba79);if(_0x80eb31['query']['filter']){_0x3697fe['where']=_['merge'](_0x3697fe[_0x8a71('0x34')],{'$or':_['map'](_0xaba79,function(_0x10cd00){if(_0x10cd00[_0x8a71('0x2a')]!==_0x8a71('0x36')){var _0x3d2c1d={};_0x3d2c1d[_0x10cd00[_0x8a71('0x24')]]={'$like':'%'+_0x80eb31[_0x8a71('0x2c')][_0x8a71('0x37')]+'%'};return _0x3d2c1d;}})});}_0x3697fe=_[_0x8a71('0x38')]({},_0x3697fe,_0x80eb31[_0x8a71('0x39')]);var _0x1a0bce={'where':_0x3697fe[_0x8a71('0x34')]};return db[_0x8a71('0x27')]['count'](_0x1a0bce)[_0x8a71('0x21')](function(_0x4a5869){_0x2074e6['count']=_0x4a5869;if(_0x80eb31['query']['includeAll']){_0x3697fe[_0x8a71('0x3a')]=[{'all':!![]}];}return db[_0x8a71('0x27')][_0x8a71('0x3b')](_0x3697fe);})[_0x8a71('0x21')](function(_0x5c4e33){_0x2074e6[_0x8a71('0x3c')]=_0x5c4e33;return _0x2074e6;})[_0x8a71('0x21')](respondWithFilteredResult(_0xc6d17d,_0x3697fe))[_0x8a71('0x3d')](handleError(_0xc6d17d,null));};exports[_0x8a71('0x3e')]=function(_0x12b60b,_0x1895c4){var _0x3fd8bf={'raw':![],'where':{'id':_0x12b60b[_0x8a71('0x3f')]['id']}},_0xe67933={};_0xe67933[_0x8a71('0x2b')]=_['keys'](db[_0x8a71('0x27')]['rawAttributes']);_0xe67933['query']=_[_0x8a71('0x2d')](_0x12b60b[_0x8a71('0x2c')]);_0xe67933['filters']=_[_0x8a71('0x30')](_0xe67933[_0x8a71('0x2b')],_0xe67933[_0x8a71('0x2c')]);_0x3fd8bf['attributes']=_[_0x8a71('0x30')](_0xe67933[_0x8a71('0x2b')],qs['fields'](_0x12b60b[_0x8a71('0x2c')][_0x8a71('0x31')]));_0x3fd8bf['attributes']=_0x3fd8bf['attributes'][_0x8a71('0x40')]?_0x3fd8bf[_0x8a71('0x2f')]:_0xe67933['model'];if(_0x12b60b['query']['includeAll']){_0x3fd8bf[_0x8a71('0x3a')]=[{'all':!![]}];}_0x3fd8bf=_[_0x8a71('0x38')]({},_0x3fd8bf,_0x12b60b[_0x8a71('0x39')]);return db[_0x8a71('0x27')][_0x8a71('0x41')](_0x3fd8bf)[_0x8a71('0x21')](handleEntityNotFound(_0x1895c4,null))[_0x8a71('0x21')](respondWithResult(_0x1895c4,null))[_0x8a71('0x3d')](handleError(_0x1895c4,null));};exports[_0x8a71('0x42')]=function(_0x863f8a,_0x5bb994){return db[_0x8a71('0x27')][_0x8a71('0x42')](_0x863f8a[_0x8a71('0x43')],{})[_0x8a71('0x21')](respondWithResult(_0x5bb994,0xc9))['catch'](handleError(_0x5bb994,null));};exports[_0x8a71('0x44')]=function(_0x44b4dd,_0x5adf66){return db['AnalyticFieldReport'][_0x8a71('0x44')](_0x44b4dd[_0x8a71('0x43')],{'raw':![],'individualHooks':!![]})[_0x8a71('0x21')](respondWithResult(_0x5adf66,0xc9))[_0x8a71('0x3d')](handleError(_0x5adf66,null));};exports[_0x8a71('0x20')]=function(_0x56afcf,_0x51a0f7){if(_0x56afcf['body']['id']){delete _0x56afcf['body']['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x56afcf['params']['id']}})[_0x8a71('0x21')](handleEntityNotFound(_0x51a0f7,null))[_0x8a71('0x21')](saveUpdates(_0x56afcf[_0x8a71('0x43')],null))[_0x8a71('0x21')](respondWithResult(_0x51a0f7,null))[_0x8a71('0x3d')](handleError(_0x51a0f7,null));};exports[_0x8a71('0x45')]=function(_0x475205,_0x412b77){return db[_0x8a71('0x27')][_0x8a71('0x41')]({'where':{'id':_0x475205[_0x8a71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x412b77,null))[_0x8a71('0x21')](removeEntity(_0x412b77,null))['catch'](handleError(_0x412b77,null));};exports[_0x8a71('0x46')]=function(_0x556305,_0x4e23ab){return db[_0x8a71('0x27')][_0x8a71('0x45')]({'where':{'id':_0x556305[_0x8a71('0x2c')][_0x8a71('0x47')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4e23ab,0xcc))[_0x8a71('0x3d')](handleError(_0x4e23ab,null));};exports['addFields']=function(_0x21b385,_0x31b249,_0x80f2b4){return db[_0x8a71('0x48')][_0x8a71('0x49')]({'where':{'id':_0x21b385[_0x8a71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x31b249,null))[_0x8a71('0x21')](function(_0x9639d1){if(_0x9639d1){return db[_0x8a71('0x4a')][_0x8a71('0x4b')](function(_0x166454){return db[_0x8a71('0x27')]['destroy']({'where':{'CustomReportId':_0x21b385[_0x8a71('0x3f')]['id']},'transaction':_0x166454})['then'](function(_0x43ddc3){var _0x44704e=_[_0x8a71('0x26')](_0x21b385[_0x8a71('0x43')],function(_0x3cd6d2){delete _0x3cd6d2['id'];_0x3cd6d2[_0x8a71('0x4c')]=_0x21b385[_0x8a71('0x3f')]['id'];return _0x3cd6d2;});return db[_0x8a71('0x27')]['bulkCreate'](_0x44704e,{'transaction':_0x166454});});})[_0x8a71('0x21')](function(){return db[_0x8a71('0x27')][_0x8a71('0x3b')]({'where':{'CustomReportId':_0x21b385[_0x8a71('0x3f')]['id']}});});}})[_0x8a71('0x21')](respondWithResult(_0x31b249,null))['catch'](handleError(_0x31b249,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 43fb039..9432c8b 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 _0x7ff5=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./analyticFieldReport.attributes'];(function(_0x4da758,_0x181cfb){var _0x17c1a7=function(_0x49c66e){while(--_0x49c66e){_0x4da758['push'](_0x4da758['shift']());}};_0x17c1a7(++_0x181cfb);}(_0x7ff5,0x130));var _0x57ff=function(_0xd72024,_0x2c71c8){_0xd72024=_0xd72024-0x0;var _0x24d0b3=_0x7ff5[_0xd72024];return _0x24d0b3;};'use strict';var _=require(_0x57ff('0x0'));var util=require(_0x57ff('0x1'));var logger=require(_0x57ff('0x2'))('api');var moment=require(_0x57ff('0x3'));var BPromise=require(_0x57ff('0x4'));var rp=require(_0x57ff('0x5'));var fs=require('fs');var path=require(_0x57ff('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x57ff('0x7'));module[_0x57ff('0x8')]=function(_0x1ce381,_0x19a7ef){return _0x1ce381[_0x57ff('0x9')](_0x57ff('0xa'),attributes,{'tableName':_0x57ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e85=['request-promise','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','api'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7e85,0xf5));var _0x57e8=function(_0x4018d0,_0x10df66){_0x4018d0=_0x4018d0-0x0;var _0x229c58=_0x7e85[_0x4018d0];return _0x229c58;};'use strict';var _=require(_0x57e8('0x0'));var util=require(_0x57e8('0x1'));var logger=require('../../config/logger')(_0x57e8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x57e8('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x57e8('0x5')]=function(_0x71407f,_0xde61bd){return _0x71407f[_0x57e8('0x6')](_0x57e8('0x7'),attributes,{'tableName':'analytics_report_fields','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 fc09fc3..a498ee7 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 _0x6409=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird'];(function(_0x41feaa,_0x543896){var _0x432b37=function(_0x12be20){while(--_0x12be20){_0x41feaa['push'](_0x41feaa['shift']());}};_0x432b37(++_0x543896);}(_0x6409,0x124));var _0x9640=function(_0x1127e0,_0x1a6508){_0x1127e0=_0x1127e0-0x0;var _0x56e3f7=_0x6409[_0x1127e0];return _0x56e3f7;};'use strict';var _=require(_0x9640('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9640('0x1'));var rs=require(_0x9640('0x2'));var fs=require('fs');var Redis=require(_0x9640('0x3'));var db=require(_0x9640('0x4'))['db'];var utils=require(_0x9640('0x5'));var logger=require(_0x9640('0x6'))('rpc');var config=require(_0x9640('0x7'));var jayson=require(_0x9640('0x8'));var client=jayson[_0x9640('0x9')][_0x9640('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb52e97,_0x533090,_0x1e9488){return new BPromise(function(_0x55dc02,_0x71500e){return client['request'](_0xb52e97,_0x1e9488)[_0x9640('0xb')](function(_0x4c79cd){logger[_0x9640('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x533090,_0x9640('0xd'));logger[_0x9640('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x533090,'request\x20sent',JSON['stringify'](_0x4c79cd));if(_0x4c79cd[_0x9640('0xf')]){if(_0x4c79cd[_0x9640('0xf')][_0x9640('0x10')]===0x1f4){logger[_0x9640('0xf')](_0x9640('0x11'),_0x533090,_0x4c79cd['error'][_0x9640('0x12')]);return _0x71500e(_0x4c79cd[_0x9640('0xf')]['message']);}logger[_0x9640('0xf')](_0x9640('0x11'),_0x533090,_0x4c79cd[_0x9640('0xf')]['message']);return _0x55dc02(_0x4c79cd[_0x9640('0xf')][_0x9640('0x12')]);}else{logger[_0x9640('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x533090,_0x9640('0xd'));_0x55dc02(_0x4c79cd[_0x9640('0x13')]['message']);}})[_0x9640('0x14')](function(_0x1beb8d){logger[_0x9640('0xf')](_0x9640('0x11'),_0x533090,_0x1beb8d);_0x71500e(_0x1beb8d);});});} \ No newline at end of file +var _0xeb3a=['code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3a18d5,_0x15b089){var _0x3ef803=function(_0x509998){while(--_0x509998){_0x3a18d5['push'](_0x3a18d5['shift']());}};_0x3ef803(++_0x15b089);}(_0xeb3a,0x122));var _0xaeb3=function(_0x5250c7,_0x319158){_0x5250c7=_0x5250c7-0x0;var _0x356699=_0xeb3a[_0x5250c7];return _0x356699;};'use strict';var _=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var moment=require(_0xaeb3('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeb3('0x3'));var fs=require('fs');var Redis=require(_0xaeb3('0x4'));var db=require(_0xaeb3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeb3('0x6'))(_0xaeb3('0x7'));var config=require(_0xaeb3('0x8'));var jayson=require(_0xaeb3('0x9'));var client=jayson['client'][_0xaeb3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8388,_0x2fc1c5,_0x1ce85d){return new BPromise(function(_0x5d9327,_0x418e76){return client[_0xaeb3('0xb')](_0x2b8388,_0x1ce85d)['then'](function(_0x8903e){logger[_0xaeb3('0xc')](_0xaeb3('0xd'),_0x2fc1c5,_0xaeb3('0xe'));logger[_0xaeb3('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x2fc1c5,_0xaeb3('0xe'),JSON[_0xaeb3('0x10')](_0x8903e));if(_0x8903e['error']){if(_0x8903e[_0xaeb3('0x11')][_0xaeb3('0x12')]===0x1f4){logger[_0xaeb3('0x11')](_0xaeb3('0xd'),_0x2fc1c5,_0x8903e['error']['message']);return _0x418e76(_0x8903e['error'][_0xaeb3('0x13')]);}logger['error'](_0xaeb3('0xd'),_0x2fc1c5,_0x8903e[_0xaeb3('0x11')][_0xaeb3('0x13')]);return _0x5d9327(_0x8903e[_0xaeb3('0x11')][_0xaeb3('0x13')]);}else{logger[_0xaeb3('0xc')](_0xaeb3('0xd'),_0x2fc1c5,_0xaeb3('0xe'));_0x5d9327(_0x8903e[_0xaeb3('0x14')]['message']);}})[_0xaeb3('0x15')](function(_0x23a358){logger[_0xaeb3('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2fc1c5,_0x23a358);_0x418e76(_0x23a358);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 0d6dd92..750912e 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(_0x7ce49d,_0x40a444){var _0x2b347d=function(_0x61a057){while(--_0x61a057){_0x7ce49d['push'](_0x7ce49d['shift']());}};_0x2b347d(++_0x40a444);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x1d9dee,_0x333dc0){var _0x1cba66=function(_0xe02f3){while(--_0xe02f3){_0x1d9dee['push'](_0x1d9dee['shift']());}};_0x1cba66(++_0x333dc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 29423ce..be343ef 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 _0xf323=['TEXT','STRING','name'];(function(_0x40275f,_0x55dbfb){var _0x279df9=function(_0x10b229){while(--_0x10b229){_0x40275f['push'](_0x40275f['shift']());}};_0x279df9(++_0x55dbfb);}(_0xf323,0x1c6));var _0x3f32=function(_0x5defb5,_0x75935d){_0x5defb5=_0x5defb5-0x0;var _0xbba834=_0xf323[_0x5defb5];return _0xbba834;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3f32('0x0')],'allowNull':![],'unique':_0x3f32('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x3f32('0x2')]},'description':{'type':Sequelize[_0x3f32('0x0')]}}; \ No newline at end of file +var _0x6739=['TEXT','sequelize','exports','STRING','name'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x6739,0xd3));var _0x9673=function(_0x874593,_0x3474fd){_0x874593=_0x874593-0x0;var _0x58b60b=_0x6739[_0x874593];return _0x58b60b;};'use strict';var Sequelize=require(_0x9673('0x0'));module[_0x9673('0x1')]={'name':{'type':Sequelize[_0x9673('0x2')],'allowNull':![],'unique':_0x9673('0x3')},'table':{'type':Sequelize[_0x9673('0x2')]},'metric':{'type':Sequelize[_0x9673('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5a97ab7..1d73c18 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','keys','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','params','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring'];(function(_0x28ee1a,_0x55fb56){var _0x4eb8ff=function(_0x8b00a6){while(--_0x8b00a6){_0x28ee1a['push'](_0x28ee1a['shift']());}};_0x4eb8ff(++_0x55fb56);}(_0xe14b,0x93));var _0xbe14=function(_0x434903,_0x2bae84){_0x434903=_0x434903-0x0;var _0x31021e=_0xe14b[_0x434903];return _0x31021e;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];function respondWithStatusCode(_0x27792f,_0x3b898d){_0x3b898d=_0x3b898d||0xcc;return function(_0x23a730){if(_0x23a730){return _0x27792f[_0xbe14('0x16')](_0x3b898d);}return _0x27792f[_0xbe14('0x17')](_0x3b898d)[_0xbe14('0x18')]();};}function respondWithResult(_0x1e4826,_0x33fd54){_0x33fd54=_0x33fd54||0xc8;return function(_0x813399){if(_0x813399){return _0x1e4826['status'](_0x33fd54)['json'](_0x813399);}};}function respondWithFilteredResult(_0x3f58f5,_0x3dc4a9){return function(_0xf4ac9){if(_0xf4ac9){var _0x37ce4e=typeof _0x3dc4a9['offset']===_0xbe14('0x19')&&typeof _0x3dc4a9[_0xbe14('0x1a')]===_0xbe14('0x19');var _0x123ede=_0xf4ac9[_0xbe14('0x1b')];var _0x29ab73=_0x37ce4e?0x0:_0x3dc4a9[_0xbe14('0x1c')];var _0x5ea1f8=_0x37ce4e?_0xf4ac9[_0xbe14('0x1b')]:_0x3dc4a9[_0xbe14('0x1c')]+_0x3dc4a9[_0xbe14('0x1a')];var _0x433459;if(_0x5ea1f8>=_0x123ede){_0x5ea1f8=_0x123ede;_0x433459=0xc8;}else{_0x433459=0xce;}_0x3f58f5[_0xbe14('0x17')](_0x433459);return _0x3f58f5[_0xbe14('0x1d')]('Content-Range',_0x29ab73+'-'+_0x5ea1f8+'/'+_0x123ede)[_0xbe14('0x1e')](_0xf4ac9);}return null;};}function patchUpdates(_0x4a1bbd){return function(_0x417c8d){try{jsonpatch[_0xbe14('0x1f')](_0x417c8d,_0x4a1bbd,!![]);}catch(_0x188ec4){return BPromise['reject'](_0x188ec4);}return _0x417c8d[_0xbe14('0x20')]();};}function saveUpdates(_0x56d845,_0x3c1c85){return function(_0x56e80c){if(_0x56e80c){return _0x56e80c[_0xbe14('0x21')](_0x56d845)['then'](function(_0x274018){return _0x274018;});}return null;};}function removeEntity(_0x3d3608,_0x505dbd){return function(_0x2da350){if(_0x2da350){return _0x2da350['destroy']()[_0xbe14('0x22')](function(){var _0x4851f8=_0x2da350[_0xbe14('0x23')]({'plain':!![]});var _0x5fa043=_0xbe14('0x24');return db[_0xbe14('0x25')][_0xbe14('0x26')]({'where':{'type':_0x5fa043,'resourceId':_0x4851f8['id']}})[_0xbe14('0x22')](function(){return _0x2da350;});})['then'](function(){_0x3d3608[_0xbe14('0x17')](0xcc)[_0xbe14('0x18')]();});}};}function handleEntityNotFound(_0x391556,_0x169369){return function(_0x5dd475){if(!_0x5dd475){_0x391556[_0xbe14('0x16')](0x194);}return _0x5dd475;};}function handleError(_0x29fc64,_0x59bf34){_0x59bf34=_0x59bf34||0x1f4;return function(_0x3c3613){logger[_0xbe14('0x27')](_0x3c3613[_0xbe14('0x28')]);if(_0x3c3613[_0xbe14('0x29')]){delete _0x3c3613[_0xbe14('0x29')];}_0x29fc64[_0xbe14('0x17')](_0x59bf34)[_0xbe14('0x2a')](_0x3c3613);};}exports[_0xbe14('0x2b')]=function(_0x4168c8,_0x16a159){var _0x40538f={},_0x3bf43c={},_0x39dc0a={'count':0x0,'rows':[]};var _0x10ae36=_[_0xbe14('0x2c')](db[_0xbe14('0x2d')][_0xbe14('0x2e')],function(_0x2ff48e){return{'name':_0x2ff48e[_0xbe14('0x2f')],'type':_0x2ff48e[_0xbe14('0x30')]['key']};});_0x3bf43c[_0xbe14('0x31')]=_['map'](_0x10ae36,'name');_0x3bf43c[_0xbe14('0x32')]=_['keys'](_0x4168c8[_0xbe14('0x32')]);_0x3bf43c[_0xbe14('0x33')]=_['intersection'](_0x3bf43c['model'],_0x3bf43c['query']);_0x40538f[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x3bf43c['model'],qs[_0xbe14('0x36')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x36')]));_0x40538f[_0xbe14('0x34')]=_0x40538f[_0xbe14('0x34')]['length']?_0x40538f['attributes']:_0x3bf43c[_0xbe14('0x31')];if(!_0x4168c8['query']['hasOwnProperty']('nolimit')){_0x40538f[_0xbe14('0x1a')]=qs[_0xbe14('0x1a')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1a')]);_0x40538f[_0xbe14('0x1c')]=qs[_0xbe14('0x1c')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x1c')]);}_0x40538f[_0xbe14('0x37')]=qs[_0xbe14('0x38')](_0x4168c8[_0xbe14('0x32')][_0xbe14('0x38')]);_0x40538f['where']=qs['filters'](_[_0xbe14('0x39')](_0x4168c8[_0xbe14('0x32')],_0x3bf43c[_0xbe14('0x33')]),_0x10ae36);if(_0x4168c8['query'][_0xbe14('0x3a')]){_0x40538f[_0xbe14('0x3b')]=_[_0xbe14('0x3c')](_0x40538f[_0xbe14('0x3b')],{'$or':_[_0xbe14('0x2c')](_0x10ae36,function(_0x25ee1f){if(_0x25ee1f[_0xbe14('0x30')]!==_0xbe14('0x3d')){var _0x1b2608={};_0x1b2608[_0x25ee1f['name']]={'$like':'%'+_0x4168c8[_0xbe14('0x32')][_0xbe14('0x3a')]+'%'};return _0x1b2608;}})});}_0x40538f=_[_0xbe14('0x3c')]({},_0x40538f,_0x4168c8[_0xbe14('0x3e')]);var _0x3287b9={'where':_0x40538f[_0xbe14('0x3b')]};return db['AnalyticMetric'][_0xbe14('0x1b')](_0x3287b9)[_0xbe14('0x22')](function(_0x1220c9){_0x39dc0a[_0xbe14('0x1b')]=_0x1220c9;if(_0x4168c8['query']['includeAll']){_0x40538f[_0xbe14('0x3f')]=[{'all':!![]}];}return db[_0xbe14('0x2d')][_0xbe14('0x40')](_0x40538f);})['then'](function(_0x5d5318){_0x39dc0a[_0xbe14('0x41')]=_0x5d5318;return _0x39dc0a;})['then'](respondWithFilteredResult(_0x16a159,_0x40538f))['catch'](handleError(_0x16a159,null));};exports[_0xbe14('0x42')]=function(_0x1f0355,_0x8216c3){var _0x5051e4={'raw':!![],'where':{'id':_0x1f0355['params']['id']}},_0x558525={};_0x558525[_0xbe14('0x31')]=_[_0xbe14('0x43')](db[_0xbe14('0x2d')]['rawAttributes']);_0x558525[_0xbe14('0x32')]=_[_0xbe14('0x43')](_0x1f0355[_0xbe14('0x32')]);_0x558525[_0xbe14('0x33')]=_['intersection'](_0x558525['model'],_0x558525[_0xbe14('0x32')]);_0x5051e4[_0xbe14('0x34')]=_[_0xbe14('0x35')](_0x558525[_0xbe14('0x31')],qs[_0xbe14('0x36')](_0x1f0355['query']['fields']));_0x5051e4[_0xbe14('0x34')]=_0x5051e4[_0xbe14('0x34')][_0xbe14('0x44')]?_0x5051e4[_0xbe14('0x34')]:_0x558525['model'];if(_0x1f0355[_0xbe14('0x32')][_0xbe14('0x45')]){_0x5051e4['include']=[{'all':!![]}];}_0x5051e4=_[_0xbe14('0x3c')]({},_0x5051e4,_0x1f0355[_0xbe14('0x3e')]);return db[_0xbe14('0x2d')][_0xbe14('0x46')](_0x5051e4)['then'](handleEntityNotFound(_0x8216c3,null))['then'](respondWithResult(_0x8216c3,null))[_0xbe14('0x47')](handleError(_0x8216c3,null));};exports[_0xbe14('0x48')]=function(_0x4a1a37,_0x5acf90){return db[_0xbe14('0x2d')][_0xbe14('0x48')](_0x4a1a37[_0xbe14('0x49')],{})[_0xbe14('0x22')](function(_0xdbc6e1){var _0xd04fd5=_0x4a1a37[_0xbe14('0x4a')]['get']({'plain':!![]});if(!_0xd04fd5)throw new Error(_0xbe14('0x4b'));if(_0xd04fd5[_0xbe14('0x4c')]===_0xbe14('0x4a')){var _0x22b1f8=_0xdbc6e1[_0xbe14('0x23')]({'plain':!![]});var _0x494c32=_0xbe14('0x24');return db[_0xbe14('0x4d')][_0xbe14('0x46')]({'where':{'name':_0x494c32,'userProfileId':_0xd04fd5[_0xbe14('0x4e')]},'raw':!![]})[_0xbe14('0x22')](function(_0x2dbeb1){if(_0x2dbeb1&&_0x2dbeb1['autoAssociation']===0x0){return db['UserProfileResource'][_0xbe14('0x48')]({'name':_0x22b1f8[_0xbe14('0x29')],'resourceId':_0x22b1f8['id'],'type':_0x2dbeb1[_0xbe14('0x29')],'sectionId':_0x2dbeb1['id']},{})['then'](function(){return _0xdbc6e1;});}else{return _0xdbc6e1;}})['catch'](function(_0x44fe0d){logger[_0xbe14('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44fe0d);throw _0x44fe0d;});}return _0xdbc6e1;})[_0xbe14('0x22')](respondWithResult(_0x5acf90,0xc9))[_0xbe14('0x47')](handleError(_0x5acf90,null));};exports['update']=function(_0x28f995,_0x4a40d2){if(_0x28f995[_0xbe14('0x49')]['id']){delete _0x28f995[_0xbe14('0x49')]['id'];}return db[_0xbe14('0x2d')]['find']({'where':{'id':_0x28f995[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4a40d2,null))['then'](saveUpdates(_0x28f995[_0xbe14('0x49')],null))[_0xbe14('0x22')](respondWithResult(_0x4a40d2,null))[_0xbe14('0x47')](handleError(_0x4a40d2,null));};exports[_0xbe14('0x26')]=function(_0x49322f,_0x4f06a3){return db[_0xbe14('0x2d')][_0xbe14('0x46')]({'where':{'id':_0x49322f[_0xbe14('0x4f')]['id']}})[_0xbe14('0x22')](handleEntityNotFound(_0x4f06a3,null))[_0xbe14('0x22')](removeEntity(_0x4f06a3,null))[_0xbe14('0x47')](handleError(_0x4f06a3,null));}; \ No newline at end of file +var _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(_0x4315fa,_0x557fb0){var _0xff3795=function(_0x4a688b){while(--_0x4a688b){_0x4315fa['push'](_0x4315fa['shift']());}};_0xff3795(++_0x557fb0);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'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 f192403..36df861 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 _0xe7de=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7de,0x165));var _0xee7d=function(_0x333350,_0x2c3380){_0x333350=_0x333350-0x0;var _0x16d859=_0xe7de[_0x333350];return _0x16d859;};'use strict';var _=require(_0xee7d('0x0'));var util=require(_0xee7d('0x1'));var logger=require(_0xee7d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xee7d('0x3'));var rp=require(_0xee7d('0x4'));var fs=require('fs');var path=require(_0xee7d('0x5'));var rimraf=require(_0xee7d('0x6'));var config=require(_0xee7d('0x7'));var attributes=require(_0xee7d('0x8'));module[_0xee7d('0x9')]=function(_0x215ba4,_0x401cd0){return _0x215ba4[_0xee7d('0xa')](_0xee7d('0xb'),attributes,{'tableName':_0xee7d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41ec=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','util'];(function(_0x187f1e,_0x195cc5){var _0x4d0927=function(_0x1af905){while(--_0x1af905){_0x187f1e['push'](_0x187f1e['shift']());}};_0x4d0927(++_0x195cc5);}(_0x41ec,0x143));var _0xc41e=function(_0xb8d653,_0x5c8821){_0xb8d653=_0xb8d653-0x0;var _0x2b8b8d=_0x41ec[_0xb8d653];return _0x2b8b8d;};'use strict';var _=require('lodash');var util=require(_0xc41e('0x0'));var logger=require('../../config/logger')(_0xc41e('0x1'));var moment=require(_0xc41e('0x2'));var BPromise=require('bluebird');var rp=require(_0xc41e('0x3'));var fs=require('fs');var path=require(_0xc41e('0x4'));var rimraf=require(_0xc41e('0x5'));var config=require(_0xc41e('0x6'));var attributes=require(_0xc41e('0x7'));module[_0xc41e('0x8')]=function(_0x3351e2,_0x92f7c){return _0x3351e2[_0xc41e('0x9')](_0xc41e('0xa'),attributes,{'tableName':_0xc41e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index b073636..67b6d58 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 _0x367f=['request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x415310,_0x181133){var _0x179713=function(_0x10d0c9){while(--_0x10d0c9){_0x415310['push'](_0x415310['shift']());}};_0x179713(++_0x181133);}(_0x367f,0xbc));var _0xf367=function(_0x11c004,_0x232c4a){_0x11c004=_0x11c004-0x0;var _0x544306=_0x367f[_0x11c004];return _0x544306;};'use strict';var _=require('lodash');var util=require(_0xf367('0x0'));var moment=require(_0xf367('0x1'));var BPromise=require(_0xf367('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf367('0x3'))['db'];var utils=require(_0xf367('0x4'));var logger=require(_0xf367('0x5'))(_0xf367('0x6'));var config=require('../../config/environment');var jayson=require(_0xf367('0x7'));var client=jayson[_0xf367('0x8')][_0xf367('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eee31,_0x337f98,_0x557955){return new BPromise(function(_0x36be8c,_0x6abf1d){return client[_0xf367('0xa')](_0x5eee31,_0x557955)[_0xf367('0xb')](function(_0x27e21a){logger[_0xf367('0xc')](_0xf367('0xd'),_0x337f98,'request\x20sent');logger[_0xf367('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x337f98,_0xf367('0xf'),JSON[_0xf367('0x10')](_0x27e21a));if(_0x27e21a['error']){if(_0x27e21a['error'][_0xf367('0x11')]===0x1f4){logger['error'](_0xf367('0xd'),_0x337f98,_0x27e21a[_0xf367('0x12')]['message']);return _0x6abf1d(_0x27e21a[_0xf367('0x12')]['message']);}logger[_0xf367('0x12')](_0xf367('0xd'),_0x337f98,_0x27e21a['error'][_0xf367('0x13')]);return _0x36be8c(_0x27e21a[_0xf367('0x12')][_0xf367('0x13')]);}else{logger[_0xf367('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x337f98,_0xf367('0xf'));_0x36be8c(_0x27e21a[_0xf367('0x14')]['message']);}})[_0xf367('0x15')](function(_0x5876d6){logger['error'](_0xf367('0xd'),_0x337f98,_0x5876d6);_0x6abf1d(_0x5876d6);});});} \ No newline at end of file +var _0xc19f=['client','http','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5087bf,_0x3b45a7){var _0x41ba1c=function(_0x29d9a7){while(--_0x29d9a7){_0x5087bf['push'](_0x5087bf['shift']());}};_0x41ba1c(++_0x3b45a7);}(_0xc19f,0x113));var _0xfc19=function(_0x19b9f8,_0x4eda33){_0x19b9f8=_0x19b9f8-0x0;var _0x2691de=_0xc19f[_0x19b9f8];return _0x2691de;};'use strict';var _=require(_0xfc19('0x0'));var util=require(_0xfc19('0x1'));var moment=require('moment');var BPromise=require(_0xfc19('0x2'));var rs=require(_0xfc19('0x3'));var fs=require('fs');var Redis=require(_0xfc19('0x4'));var db=require(_0xfc19('0x5'))['db'];var utils=require(_0xfc19('0x6'));var logger=require('../../config/logger')(_0xfc19('0x7'));var config=require(_0xfc19('0x8'));var jayson=require(_0xfc19('0x9'));var client=jayson[_0xfc19('0xa')][_0xfc19('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d72c,_0x2977ba,_0x443137){return new BPromise(function(_0x3bde53,_0x17ceda){return client['request'](_0x23d72c,_0x443137)['then'](function(_0xb84f8e){logger['info'](_0xfc19('0xc'),_0x2977ba,_0xfc19('0xd'));logger[_0xfc19('0xe')](_0xfc19('0xf'),_0x2977ba,_0xfc19('0xd'),JSON['stringify'](_0xb84f8e));if(_0xb84f8e[_0xfc19('0x10')]){if(_0xb84f8e[_0xfc19('0x10')]['code']===0x1f4){logger[_0xfc19('0x10')](_0xfc19('0xc'),_0x2977ba,_0xb84f8e[_0xfc19('0x10')][_0xfc19('0x11')]);return _0x17ceda(_0xb84f8e[_0xfc19('0x10')][_0xfc19('0x11')]);}logger[_0xfc19('0x10')](_0xfc19('0xc'),_0x2977ba,_0xb84f8e[_0xfc19('0x10')][_0xfc19('0x11')]);return _0x3bde53(_0xb84f8e[_0xfc19('0x10')][_0xfc19('0x11')]);}else{logger[_0xfc19('0x12')](_0xfc19('0xc'),_0x2977ba,_0xfc19('0xd'));_0x3bde53(_0xb84f8e['result'][_0xfc19('0x11')]);}})['catch'](function(_0x8a23d4){logger[_0xfc19('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x2977ba,_0x8a23d4);_0x17ceda(_0x8a23d4);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 20b5874..f0723fb 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 _0xd101=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x123ff8,_0x2b9a42){var _0x2d8b5e=function(_0x970b6f){while(--_0x970b6f){_0x123ff8['push'](_0x123ff8['shift']());}};_0x2d8b5e(++_0x2b9a42);}(_0xd101,0xc1));var _0x1d10=function(_0x5030f2,_0x28272e){_0x5030f2=_0x5030f2-0x0;var _0x3f4438=_0xd101[_0x5030f2];return _0x3f4438;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./analyticMetric.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0xe')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller['destroy']);module[_0x1d10('0x13')]=router; \ No newline at end of file +var _0xd206=['isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x3fee61,_0x2d0e18){var _0x1a8e55=function(_0x3888ec){while(--_0x3888ec){_0x3fee61['push'](_0x3fee61['shift']());}};_0x1a8e55(++_0x2d0e18);}(_0xd206,0x107));var _0x6d20=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xd206[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var path=require('path');var timeout=require(_0x6d20('0x2'));var express=require(_0x6d20('0x3'));var router=express[_0x6d20('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d20('0x5'));var interaction=require(_0x6d20('0x6'));var config=require(_0x6d20('0x7'));var controller=require(_0x6d20('0x8'));router['get']('/',auth[_0x6d20('0x9')](),controller['index']);router['get'](_0x6d20('0xa'),auth[_0x6d20('0x9')](),controller['show']);router[_0x6d20('0xb')]('/',auth['isAuthenticated'](),controller[_0x6d20('0xc')]);router[_0x6d20('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6d20('0xe')](_0x6d20('0xa'),auth['isAuthenticated'](),controller[_0x6d20('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 5490740..8935ec4 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 _0xe822=['sequelize','exports','TEXT'];(function(_0x4b6971,_0x565ea0){var _0x388ba0=function(_0x68de29){while(--_0x68de29){_0x4b6971['push'](_0x4b6971['shift']());}};_0x388ba0(++_0x565ea0);}(_0xe822,0x1ce));var _0x2e82=function(_0x544499,_0x4adf0e){_0x544499=_0x544499-0x0;var _0x1f22ba=_0xe822[_0x544499];return _0x1f22ba;};'use strict';var Sequelize=require(_0x2e82('0x0'));module[_0x2e82('0x1')]={'tree':{'type':Sequelize[_0x2e82('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x67aa=['TEXT','exports'];(function(_0x13b95a,_0x43bcd2){var _0x1548cc=function(_0x4f9f2e){while(--_0x4f9f2e){_0x13b95a['push'](_0x13b95a['shift']());}};_0x1548cc(++_0x43bcd2);}(_0x67aa,0x1cf));var _0xa67a=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0x67aa[_0x274d4b];return _0x1a1f03;};'use strict';var Sequelize=require('sequelize');module[_0xa67a('0x0')]={'tree':{'type':Sequelize[_0xa67a('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 47cf98c..af30d2f 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 _0xa56a=['query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','fields','include','create','body','find','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model'];(function(_0x5e8fd5,_0x44fd95){var _0x543717=function(_0x13dc28){while(--_0x13dc28){_0x5e8fd5['push'](_0x5e8fd5['shift']());}};_0x543717(++_0x44fd95);}(_0xa56a,0x1e0));var _0xaa56=function(_0xb020e2,_0x30bca6){_0xb020e2=_0xb020e2-0x0;var _0x570fe0=_0xa56a[_0xb020e2];return _0x570fe0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa56('0x0'));var zipdir=require(_0xaa56('0x1'));var jsonpatch=require(_0xaa56('0x2'));var rp=require(_0xaa56('0x3'));var moment=require(_0xaa56('0x4'));var BPromise=require(_0xaa56('0x5'));var Mustache=require(_0xaa56('0x6'));var util=require(_0xaa56('0x7'));var path=require(_0xaa56('0x8'));var sox=require(_0xaa56('0x9'));var csv=require(_0xaa56('0xa'));var ejs=require(_0xaa56('0xb'));var fs=require('fs');var fs_extra=require(_0xaa56('0xc'));var _=require(_0xaa56('0xd'));var squel=require(_0xaa56('0xe'));var crypto=require('crypto');var jsforce=require(_0xaa56('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaa56('0x10'));var Papa=require(_0xaa56('0x11'));var Redis=require(_0xaa56('0x12'));var authService=require(_0xaa56('0x13'));var qs=require(_0xaa56('0x14'));var as=require(_0xaa56('0x15'));var hardwareService=require(_0xaa56('0x16'));var logger=require(_0xaa56('0x17'))('api');var utils=require(_0xaa56('0x18'));var config=require(_0xaa56('0x19'));var licenseUtil=require(_0xaa56('0x1a'));var db=require(_0xaa56('0x1b'))['db'];function respondWithStatusCode(_0x49e396,_0x18ef3d){_0x18ef3d=_0x18ef3d||0xcc;return function(_0x1243b6){if(_0x1243b6){return _0x49e396['sendStatus'](_0x18ef3d);}return _0x49e396['status'](_0x18ef3d)['end']();};}function respondWithResult(_0x3f277c,_0x1b622b){_0x1b622b=_0x1b622b||0xc8;return function(_0x3e2a5c){if(_0x3e2a5c){return _0x3f277c[_0xaa56('0x1c')](_0x1b622b)['json'](_0x3e2a5c);}};}function respondWithFilteredResult(_0x4a9ff3,_0x38de11){return function(_0xd3f427){if(_0xd3f427){var _0x84ba9e=typeof _0x38de11['offset']===_0xaa56('0x1d')&&typeof _0x38de11[_0xaa56('0x1e')]===_0xaa56('0x1d');var _0x3d6161=_0xd3f427[_0xaa56('0x1f')];var _0x2f6169=_0x84ba9e?0x0:_0x38de11['offset'];var _0x34c51c=_0x84ba9e?_0xd3f427[_0xaa56('0x1f')]:_0x38de11[_0xaa56('0x20')]+_0x38de11[_0xaa56('0x1e')];var _0x5c3ac9;if(_0x34c51c>=_0x3d6161){_0x34c51c=_0x3d6161;_0x5c3ac9=0xc8;}else{_0x5c3ac9=0xce;}_0x4a9ff3['status'](_0x5c3ac9);return _0x4a9ff3[_0xaa56('0x21')](_0xaa56('0x22'),_0x2f6169+'-'+_0x34c51c+'/'+_0x3d6161)['json'](_0xd3f427);}return null;};}function patchUpdates(_0x2ca69b){return function(_0x2f930f){try{jsonpatch[_0xaa56('0x23')](_0x2f930f,_0x2ca69b,!![]);}catch(_0x5443ab){return BPromise[_0xaa56('0x24')](_0x5443ab);}return _0x2f930f['save']();};}function saveUpdates(_0x515fb5,_0x42b025){return function(_0xff03b1){if(_0xff03b1){return _0xff03b1[_0xaa56('0x25')](_0x515fb5)[_0xaa56('0x26')](function(_0x4ae8a9){return _0x4ae8a9;});}return null;};}function removeEntity(_0x45350b,_0x29a19a){return function(_0x22ce88){if(_0x22ce88){return _0x22ce88[_0xaa56('0x27')]()['then'](function(){_0x45350b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf8e0,_0x15827e){return function(_0x3a7b52){if(!_0x3a7b52){_0x2cf8e0[_0xaa56('0x28')](0x194);}return _0x3a7b52;};}function handleError(_0x3c3f11,_0x5d01c1){_0x5d01c1=_0x5d01c1||0x1f4;return function(_0x18379b){logger[_0xaa56('0x29')](_0x18379b[_0xaa56('0x2a')]);if(_0x18379b[_0xaa56('0x2b')]){delete _0x18379b[_0xaa56('0x2b')];}_0x3c3f11[_0xaa56('0x1c')](_0x5d01c1)[_0xaa56('0x2c')](_0x18379b);};}exports[_0xaa56('0x2d')]=function(_0x49bedf,_0x21fb5d){var _0x5a3964={},_0xba54af={},_0x4ae93f={'count':0x0,'rows':[]};var _0x1a6bf6=_[_0xaa56('0x2e')](db[_0xaa56('0x2f')]['rawAttributes'],function(_0x31e7da){return{'name':_0x31e7da[_0xaa56('0x30')],'type':_0x31e7da[_0xaa56('0x31')][_0xaa56('0x32')]};});_0xba54af[_0xaa56('0x33')]=_[_0xaa56('0x2e')](_0x1a6bf6,_0xaa56('0x2b'));_0xba54af[_0xaa56('0x34')]=_[_0xaa56('0x35')](_0x49bedf[_0xaa56('0x34')]);_0xba54af[_0xaa56('0x36')]=_[_0xaa56('0x37')](_0xba54af[_0xaa56('0x33')],_0xba54af[_0xaa56('0x34')]);_0x5a3964[_0xaa56('0x38')]=_['intersection'](_0xba54af[_0xaa56('0x33')],qs['fields'](_0x49bedf[_0xaa56('0x34')]['fields']));_0x5a3964[_0xaa56('0x38')]=_0x5a3964[_0xaa56('0x38')][_0xaa56('0x39')]?_0x5a3964[_0xaa56('0x38')]:_0xba54af[_0xaa56('0x33')];if(!_0x49bedf[_0xaa56('0x34')]['hasOwnProperty']('nolimit')){_0x5a3964[_0xaa56('0x1e')]=qs[_0xaa56('0x1e')](_0x49bedf[_0xaa56('0x34')][_0xaa56('0x1e')]);_0x5a3964[_0xaa56('0x20')]=qs[_0xaa56('0x20')](_0x49bedf['query'][_0xaa56('0x20')]);}_0x5a3964[_0xaa56('0x3a')]=qs['sort'](_0x49bedf['query'][_0xaa56('0x3b')]);_0x5a3964[_0xaa56('0x3c')]=qs['filters'](_[_0xaa56('0x3d')](_0x49bedf[_0xaa56('0x34')],_0xba54af[_0xaa56('0x36')]),_0x1a6bf6);if(_0x49bedf[_0xaa56('0x34')][_0xaa56('0x3e')]){_0x5a3964[_0xaa56('0x3c')]=_[_0xaa56('0x3f')](_0x5a3964['where'],{'$or':_[_0xaa56('0x2e')](_0x1a6bf6,function(_0x695e21){if(_0x695e21[_0xaa56('0x31')]!==_0xaa56('0x40')){var _0xac895d={};_0xac895d[_0x695e21[_0xaa56('0x2b')]]={'$like':'%'+_0x49bedf[_0xaa56('0x34')][_0xaa56('0x3e')]+'%'};return _0xac895d;}})});}_0x5a3964=_[_0xaa56('0x3f')]({},_0x5a3964,_0x49bedf[_0xaa56('0x41')]);var _0x1e84ac={'where':_0x5a3964[_0xaa56('0x3c')]};return db['AnalyticTreeReport'][_0xaa56('0x1f')](_0x1e84ac)[_0xaa56('0x26')](function(_0x2542d5){_0x4ae93f['count']=_0x2542d5;if(_0x49bedf[_0xaa56('0x34')][_0xaa56('0x42')]){_0x5a3964['include']=[{'all':!![]}];}return db[_0xaa56('0x2f')][_0xaa56('0x43')](_0x5a3964);})['then'](function(_0x23c38c){_0x4ae93f['rows']=_0x23c38c;return _0x4ae93f;})[_0xaa56('0x26')](respondWithFilteredResult(_0x21fb5d,_0x5a3964))[_0xaa56('0x44')](handleError(_0x21fb5d,null));};exports['show']=function(_0x1bdb84,_0xea90e9){var _0x56ea9f={'raw':!![],'where':{'id':_0x1bdb84['params']['id']}},_0x5f5257={};_0x5f5257[_0xaa56('0x33')]=_['keys'](db[_0xaa56('0x2f')][_0xaa56('0x45')]);_0x5f5257[_0xaa56('0x34')]=_[_0xaa56('0x35')](_0x1bdb84[_0xaa56('0x34')]);_0x5f5257[_0xaa56('0x36')]=_[_0xaa56('0x37')](_0x5f5257[_0xaa56('0x33')],_0x5f5257['query']);_0x56ea9f[_0xaa56('0x38')]=_[_0xaa56('0x37')](_0x5f5257[_0xaa56('0x33')],qs[_0xaa56('0x46')](_0x1bdb84['query'][_0xaa56('0x46')]));_0x56ea9f[_0xaa56('0x38')]=_0x56ea9f['attributes'][_0xaa56('0x39')]?_0x56ea9f['attributes']:_0x5f5257['model'];if(_0x1bdb84['query']['includeAll']){_0x56ea9f[_0xaa56('0x47')]=[{'all':!![]}];}_0x56ea9f=_[_0xaa56('0x3f')]({},_0x56ea9f,_0x1bdb84[_0xaa56('0x41')]);return db[_0xaa56('0x2f')]['find'](_0x56ea9f)[_0xaa56('0x26')](handleEntityNotFound(_0xea90e9,null))[_0xaa56('0x26')](respondWithResult(_0xea90e9,null))[_0xaa56('0x44')](handleError(_0xea90e9,null));};exports['create']=function(_0x345513,_0x27175e){return db[_0xaa56('0x2f')][_0xaa56('0x48')](_0x345513[_0xaa56('0x49')],{})[_0xaa56('0x26')](respondWithResult(_0x27175e,0xc9))['catch'](handleError(_0x27175e,null));};exports[_0xaa56('0x25')]=function(_0x39ec17,_0x4b2bf1){if(_0x39ec17['body']['id']){delete _0x39ec17[_0xaa56('0x49')]['id'];}return db[_0xaa56('0x2f')][_0xaa56('0x4a')]({'where':{'id':_0x39ec17[_0xaa56('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b2bf1,null))[_0xaa56('0x26')](saveUpdates(_0x39ec17[_0xaa56('0x49')],null))[_0xaa56('0x26')](respondWithResult(_0x4b2bf1,null))[_0xaa56('0x44')](handleError(_0x4b2bf1,null));};exports[_0xaa56('0x27')]=function(_0x110feb,_0x40756f){return db[_0xaa56('0x2f')][_0xaa56('0x4a')]({'where':{'id':_0x110feb[_0xaa56('0x4b')]['id']}})[_0xaa56('0x26')](handleEntityNotFound(_0x40756f,null))['then'](removeEntity(_0x40756f,null))[_0xaa56('0x44')](handleError(_0x40756f,null));}; \ No newline at end of file +var _0x3a2b=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','status','sendStatus','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticTreeReport','then','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','eml-format','rimraf','zip-dir'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x3a2b,0x1b9));var _0xb3a2=function(_0x5b03ee,_0x184379){_0x5b03ee=_0x5b03ee-0x0;var _0x497f9a=_0x3a2b[_0x5b03ee];return _0x497f9a;};'use strict';var emlformat=require(_0xb3a2('0x0'));var rimraf=require(_0xb3a2('0x1'));var zipdir=require(_0xb3a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3a2('0x3'));var moment=require(_0xb3a2('0x4'));var BPromise=require(_0xb3a2('0x5'));var Mustache=require(_0xb3a2('0x6'));var util=require('util');var path=require(_0xb3a2('0x7'));var sox=require(_0xb3a2('0x8'));var csv=require(_0xb3a2('0x9'));var ejs=require(_0xb3a2('0xa'));var fs=require('fs');var fs_extra=require(_0xb3a2('0xb'));var _=require(_0xb3a2('0xc'));var squel=require(_0xb3a2('0xd'));var crypto=require(_0xb3a2('0xe'));var jsforce=require(_0xb3a2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3a2('0x10'));var Papa=require(_0xb3a2('0x11'));var Redis=require('ioredis');var authService=require(_0xb3a2('0x12'));var qs=require(_0xb3a2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3a2('0x14'));var logger=require(_0xb3a2('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xb3a2('0x16'));var licenseUtil=require(_0xb3a2('0x17'));var db=require(_0xb3a2('0x18'))['db'];function respondWithStatusCode(_0x3624fe,_0x32448a){_0x32448a=_0x32448a||0xcc;return function(_0x2c3d62){if(_0x2c3d62){return _0x3624fe['sendStatus'](_0x32448a);}return _0x3624fe['status'](_0x32448a)[_0xb3a2('0x19')]();};}function respondWithResult(_0x43d72b,_0x521fc9){_0x521fc9=_0x521fc9||0xc8;return function(_0x24f3ca){if(_0x24f3ca){return _0x43d72b['status'](_0x521fc9)[_0xb3a2('0x1a')](_0x24f3ca);}};}function respondWithFilteredResult(_0x5489a8,_0x184bc6){return function(_0x2d0dc4){if(_0x2d0dc4){var _0x480c89=typeof _0x184bc6[_0xb3a2('0x1b')]===_0xb3a2('0x1c')&&typeof _0x184bc6[_0xb3a2('0x1d')]==='undefined';var _0x332ce5=_0x2d0dc4[_0xb3a2('0x1e')];var _0x5debca=_0x480c89?0x0:_0x184bc6[_0xb3a2('0x1b')];var _0x354815=_0x480c89?_0x2d0dc4[_0xb3a2('0x1e')]:_0x184bc6['offset']+_0x184bc6[_0xb3a2('0x1d')];var _0x3df30f;if(_0x354815>=_0x332ce5){_0x354815=_0x332ce5;_0x3df30f=0xc8;}else{_0x3df30f=0xce;}_0x5489a8['status'](_0x3df30f);return _0x5489a8[_0xb3a2('0x1f')](_0xb3a2('0x20'),_0x5debca+'-'+_0x354815+'/'+_0x332ce5)[_0xb3a2('0x1a')](_0x2d0dc4);}return null;};}function patchUpdates(_0x3d31cc){return function(_0x91d6b1){try{jsonpatch[_0xb3a2('0x21')](_0x91d6b1,_0x3d31cc,!![]);}catch(_0x260b9e){return BPromise['reject'](_0x260b9e);}return _0x91d6b1[_0xb3a2('0x22')]();};}function saveUpdates(_0x53e26d,_0x585af3){return function(_0x1e31e6){if(_0x1e31e6){return _0x1e31e6[_0xb3a2('0x23')](_0x53e26d)['then'](function(_0x570d42){return _0x570d42;});}return null;};}function removeEntity(_0x5d2165,_0x1df391){return function(_0x27b71c){if(_0x27b71c){return _0x27b71c['destroy']()['then'](function(){_0x5d2165[_0xb3a2('0x24')](0xcc)[_0xb3a2('0x19')]();});}};}function handleEntityNotFound(_0x96d5a2,_0x2097e7){return function(_0x59d892){if(!_0x59d892){_0x96d5a2[_0xb3a2('0x25')](0x194);}return _0x59d892;};}function handleError(_0xa84f1,_0x23a667){_0x23a667=_0x23a667||0x1f4;return function(_0x236579){logger['error'](_0x236579['stack']);if(_0x236579[_0xb3a2('0x26')]){delete _0x236579[_0xb3a2('0x26')];}_0xa84f1[_0xb3a2('0x24')](_0x23a667)[_0xb3a2('0x27')](_0x236579);};}exports[_0xb3a2('0x28')]=function(_0x5bf1e3,_0x220f97){var _0x74b9d4={},_0x4c623a={},_0x221967={'count':0x0,'rows':[]};var _0x3f6c78=_['map'](db['AnalyticTreeReport']['rawAttributes'],function(_0x46933b){return{'name':_0x46933b[_0xb3a2('0x29')],'type':_0x46933b[_0xb3a2('0x2a')][_0xb3a2('0x2b')]};});_0x4c623a['model']=_[_0xb3a2('0x2c')](_0x3f6c78,_0xb3a2('0x26'));_0x4c623a[_0xb3a2('0x2d')]=_[_0xb3a2('0x2e')](_0x5bf1e3[_0xb3a2('0x2d')]);_0x4c623a[_0xb3a2('0x2f')]=_[_0xb3a2('0x30')](_0x4c623a['model'],_0x4c623a[_0xb3a2('0x2d')]);_0x74b9d4[_0xb3a2('0x31')]=_[_0xb3a2('0x30')](_0x4c623a['model'],qs[_0xb3a2('0x32')](_0x5bf1e3['query'][_0xb3a2('0x32')]));_0x74b9d4[_0xb3a2('0x31')]=_0x74b9d4[_0xb3a2('0x31')][_0xb3a2('0x33')]?_0x74b9d4['attributes']:_0x4c623a[_0xb3a2('0x34')];if(!_0x5bf1e3[_0xb3a2('0x2d')][_0xb3a2('0x35')](_0xb3a2('0x36'))){_0x74b9d4[_0xb3a2('0x1d')]=qs[_0xb3a2('0x1d')](_0x5bf1e3[_0xb3a2('0x2d')][_0xb3a2('0x1d')]);_0x74b9d4[_0xb3a2('0x1b')]=qs[_0xb3a2('0x1b')](_0x5bf1e3['query'][_0xb3a2('0x1b')]);}_0x74b9d4[_0xb3a2('0x37')]=qs['sort'](_0x5bf1e3['query'][_0xb3a2('0x38')]);_0x74b9d4[_0xb3a2('0x39')]=qs[_0xb3a2('0x2f')](_['pick'](_0x5bf1e3[_0xb3a2('0x2d')],_0x4c623a[_0xb3a2('0x2f')]),_0x3f6c78);if(_0x5bf1e3['query'][_0xb3a2('0x3a')]){_0x74b9d4[_0xb3a2('0x39')]=_[_0xb3a2('0x3b')](_0x74b9d4[_0xb3a2('0x39')],{'$or':_['map'](_0x3f6c78,function(_0x422c9a){if(_0x422c9a['type']!=='VIRTUAL'){var _0x3382b5={};_0x3382b5[_0x422c9a[_0xb3a2('0x26')]]={'$like':'%'+_0x5bf1e3[_0xb3a2('0x2d')][_0xb3a2('0x3a')]+'%'};return _0x3382b5;}})});}_0x74b9d4=_[_0xb3a2('0x3b')]({},_0x74b9d4,_0x5bf1e3[_0xb3a2('0x3c')]);var _0x4e4e23={'where':_0x74b9d4[_0xb3a2('0x39')]};return db[_0xb3a2('0x3d')][_0xb3a2('0x1e')](_0x4e4e23)[_0xb3a2('0x3e')](function(_0x4ef40b){_0x221967[_0xb3a2('0x1e')]=_0x4ef40b;if(_0x5bf1e3[_0xb3a2('0x2d')][_0xb3a2('0x3f')]){_0x74b9d4[_0xb3a2('0x40')]=[{'all':!![]}];}return db[_0xb3a2('0x3d')]['findAll'](_0x74b9d4);})[_0xb3a2('0x3e')](function(_0x245462){_0x221967[_0xb3a2('0x41')]=_0x245462;return _0x221967;})['then'](respondWithFilteredResult(_0x220f97,_0x74b9d4))[_0xb3a2('0x42')](handleError(_0x220f97,null));};exports[_0xb3a2('0x43')]=function(_0x2a16f1,_0x33b757){var _0x2fa390={'raw':!![],'where':{'id':_0x2a16f1[_0xb3a2('0x44')]['id']}},_0xd2f7e3={};_0xd2f7e3[_0xb3a2('0x34')]=_[_0xb3a2('0x2e')](db[_0xb3a2('0x3d')][_0xb3a2('0x45')]);_0xd2f7e3['query']=_[_0xb3a2('0x2e')](_0x2a16f1[_0xb3a2('0x2d')]);_0xd2f7e3['filters']=_[_0xb3a2('0x30')](_0xd2f7e3[_0xb3a2('0x34')],_0xd2f7e3[_0xb3a2('0x2d')]);_0x2fa390['attributes']=_[_0xb3a2('0x30')](_0xd2f7e3[_0xb3a2('0x34')],qs['fields'](_0x2a16f1[_0xb3a2('0x2d')][_0xb3a2('0x32')]));_0x2fa390['attributes']=_0x2fa390[_0xb3a2('0x31')]['length']?_0x2fa390[_0xb3a2('0x31')]:_0xd2f7e3[_0xb3a2('0x34')];if(_0x2a16f1['query']['includeAll']){_0x2fa390['include']=[{'all':!![]}];}_0x2fa390=_[_0xb3a2('0x3b')]({},_0x2fa390,_0x2a16f1['options']);return db[_0xb3a2('0x3d')][_0xb3a2('0x46')](_0x2fa390)[_0xb3a2('0x3e')](handleEntityNotFound(_0x33b757,null))[_0xb3a2('0x3e')](respondWithResult(_0x33b757,null))[_0xb3a2('0x42')](handleError(_0x33b757,null));};exports['create']=function(_0x3d63da,_0x5adae2){return db[_0xb3a2('0x3d')][_0xb3a2('0x47')](_0x3d63da[_0xb3a2('0x48')],{})[_0xb3a2('0x3e')](respondWithResult(_0x5adae2,0xc9))[_0xb3a2('0x42')](handleError(_0x5adae2,null));};exports[_0xb3a2('0x23')]=function(_0xa74ca8,_0x322d08){if(_0xa74ca8[_0xb3a2('0x48')]['id']){delete _0xa74ca8['body']['id'];}return db[_0xb3a2('0x3d')][_0xb3a2('0x46')]({'where':{'id':_0xa74ca8[_0xb3a2('0x44')]['id']}})[_0xb3a2('0x3e')](handleEntityNotFound(_0x322d08,null))['then'](saveUpdates(_0xa74ca8[_0xb3a2('0x48')],null))[_0xb3a2('0x3e')](respondWithResult(_0x322d08,null))[_0xb3a2('0x42')](handleError(_0x322d08,null));};exports[_0xb3a2('0x49')]=function(_0x274cf3,_0x33407d){return db[_0xb3a2('0x3d')][_0xb3a2('0x46')]({'where':{'id':_0x274cf3['params']['id']}})[_0xb3a2('0x3e')](handleEntityNotFound(_0x33407d,null))[_0xb3a2('0x3e')](removeEntity(_0x33407d,null))[_0xb3a2('0x42')](handleError(_0x33407d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9af9ae5..837c144 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 _0x393d=['analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x393d,0x119));var _0xd393=function(_0x211c0,_0x315fe4){_0x211c0=_0x211c0-0x0;var _0x3432b7=_0x393d[_0x211c0];return _0x3432b7;};'use strict';var _=require(_0xd393('0x0'));var util=require(_0xd393('0x1'));var logger=require(_0xd393('0x2'))(_0xd393('0x3'));var moment=require(_0xd393('0x4'));var BPromise=require(_0xd393('0x5'));var rp=require(_0xd393('0x6'));var fs=require('fs');var path=require(_0xd393('0x7'));var rimraf=require(_0xd393('0x8'));var config=require(_0xd393('0x9'));var attributes=require(_0xd393('0xa'));module['exports']=function(_0x124f34,_0x2bb9d5){return _0x124f34[_0xd393('0xb')](_0xd393('0xc'),attributes,{'tableName':_0xd393('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdee=['path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdee,0x6f));var _0xebde=function(_0x39e6e6,_0x3e4898){_0x39e6e6=_0x39e6e6-0x0;var _0x4ecd7b=_0xbdee[_0x39e6e6];return _0x4ecd7b;};'use strict';var _=require(_0xebde('0x0'));var util=require(_0xebde('0x1'));var logger=require(_0xebde('0x2'))(_0xebde('0x3'));var moment=require(_0xebde('0x4'));var BPromise=require('bluebird');var rp=require(_0xebde('0x5'));var fs=require('fs');var path=require(_0xebde('0x6'));var rimraf=require(_0xebde('0x7'));var config=require(_0xebde('0x8'));var attributes=require(_0xebde('0x9'));module[_0xebde('0xa')]=function(_0x734e16,_0x4330c6){return _0x734e16[_0xebde('0xb')](_0xebde('0xc'),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 84ecafa..97d7151 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x228c42,_0x15ff78){var _0x10e6a6=function(_0x2273af){while(--_0x2273af){_0x228c42['push'](_0x228c42['shift']());}};_0x10e6a6(++_0x15ff78);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x1438e6,_0x4c5004){_0x1438e6=_0x1438e6-0x0;var _0x208be2=_0x7a54[_0x1438e6];return _0x208be2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index dcb13cb..f1d0116 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 _0x7064=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x42aabd,_0x217ade){var _0x2e83fb=function(_0x1508d8){while(--_0x1508d8){_0x42aabd['push'](_0x42aabd['shift']());}};_0x2e83fb(++_0x217ade);}(_0x7064,0x187));var _0x4706=function(_0x4bf448,_0x495276){_0x4bf448=_0x4bf448-0x0;var _0x2af0f4=_0x7064[_0x4bf448];return _0x2af0f4;};'use strict';var multer=require(_0x4706('0x0'));var util=require(_0x4706('0x1'));var path=require(_0x4706('0x2'));var timeout=require(_0x4706('0x3'));var express=require(_0x4706('0x4'));var router=express[_0x4706('0x5')]();var fs_extra=require(_0x4706('0x6'));var auth=require(_0x4706('0x7'));var interaction=require(_0x4706('0x8'));var config=require(_0x4706('0x9'));var controller=require(_0x4706('0xa'));router[_0x4706('0xb')]('/',auth['isAuthenticated'](),controller[_0x4706('0xc')]);router['get'](_0x4706('0xd'),auth[_0x4706('0xe')](),controller['show']);router[_0x4706('0xf')]('/',auth[_0x4706('0xe')](),controller[_0x4706('0x10')]);router[_0x4706('0x11')](_0x4706('0xd'),auth[_0x4706('0xe')](),controller[_0x4706('0x12')]);router[_0x4706('0x13')](_0x4706('0xd'),auth[_0x4706('0xe')](),controller['destroy']);module[_0x4706('0x14')]=router; \ No newline at end of file +var _0x585b=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy'];(function(_0xf64228,_0x2cc686){var _0x4fc61f=function(_0x2cf72b){while(--_0x2cf72b){_0xf64228['push'](_0xf64228['shift']());}};_0x4fc61f(++_0x2cc686);}(_0x585b,0x165));var _0xb585=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x585b[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0xb585('0x0'));var path=require(_0xb585('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb585('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xb585('0x3'));var interaction=require(_0xb585('0x4'));var config=require(_0xb585('0x5'));var controller=require('./analyticTreeReport.controller');router['get']('/',auth[_0xb585('0x6')](),controller[_0xb585('0x7')]);router[_0xb585('0x8')](_0xb585('0x9'),auth[_0xb585('0x6')](),controller[_0xb585('0xa')]);router[_0xb585('0xb')]('/',auth[_0xb585('0x6')](),controller[_0xb585('0xc')]);router[_0xb585('0xd')]('/:id',auth[_0xb585('0x6')](),controller[_0xb585('0xe')]);router[_0xb585('0xf')](_0xb585('0x9'),auth['isAuthenticated'](),controller[_0xb585('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6009534..c781603 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 _0x2b37=['exports','STRING','sequelize'];(function(_0x597166,_0x2e9578){var _0x5280d5=function(_0x2bfc59){while(--_0x2bfc59){_0x597166['push'](_0x597166['shift']());}};_0x5280d5(++_0x2e9578);}(_0x2b37,0x12b));var _0x72b3=function(_0x292c39,_0x46338b){_0x292c39=_0x292c39-0x0;var _0x56859d=_0x2b37[_0x292c39];return _0x56859d;};'use strict';var Sequelize=require(_0x72b3('0x0'));module[_0x72b3('0x1')]={'name':{'type':Sequelize[_0x72b3('0x2')]},'basename':{'type':Sequelize[_0x72b3('0x2')]},'type':{'type':Sequelize[_0x72b3('0x2')]}}; \ No newline at end of file +var _0xe4b8=['exports','STRING','sequelize'];(function(_0x1015a6,_0x4dc3ab){var _0x5ca2d1=function(_0x399cc5){while(--_0x399cc5){_0x1015a6['push'](_0x1015a6['shift']());}};_0x5ca2d1(++_0x4dc3ab);}(_0xe4b8,0x179));var _0x8e4b=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xe4b8[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x8e4b('0x0'));module[_0x8e4b('0x1')]={'name':{'type':Sequelize[_0x8e4b('0x2')]},'basename':{'type':Sequelize[_0x8e4b('0x2')]},'type':{'type':Sequelize[_0x8e4b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 788eba4..b239499 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 _0x811c=['ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','Content-Range','apply','reject','save','then','sendStatus','error','name','send','index','map','Attachment','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','show','includeAll','find','clone','params','get','updatedAt','body','omit','createdAt','catch','update','file','filename','mimetype','create','download','findOne','server/files/attachments/','join','basename','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv'];(function(_0x5f0e68,_0x3f22ba){var _0x43e077=function(_0x3b2502){while(--_0x3b2502){_0x5f0e68['push'](_0x5f0e68['shift']());}};_0x43e077(++_0x3f22ba);}(_0x811c,0xec));var _0xc811=function(_0x44fb8c,_0x3625c){_0x44fb8c=_0x44fb8c-0x0;var _0x5599ec=_0x811c[_0x44fb8c];return _0x5599ec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc811('0x0'));var zipdir=require(_0xc811('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc811('0x2'));var moment=require('moment');var BPromise=require(_0xc811('0x3'));var Mustache=require('mustache');var util=require(_0xc811('0x4'));var path=require('path');var sox=require(_0xc811('0x5'));var csv=require(_0xc811('0x6'));var ejs=require(_0xc811('0x7'));var fs=require('fs');var fs_extra=require(_0xc811('0x8'));var _=require('lodash');var squel=require(_0xc811('0x9'));var crypto=require(_0xc811('0xa'));var jsforce=require(_0xc811('0xb'));var deskjs=require(_0xc811('0xc'));var toCsv=require(_0xc811('0x6'));var querystring=require(_0xc811('0xd'));var Papa=require(_0xc811('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc811('0xf'));var hardwareService=require(_0xc811('0x10'));var logger=require(_0xc811('0x11'))('api');var utils=require(_0xc811('0x12'));var config=require(_0xc811('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc811('0x14'))['db'];function respondWithStatusCode(_0x25863e,_0xca8f92){_0xca8f92=_0xca8f92||0xcc;return function(_0x46c11b){if(_0x46c11b){return _0x25863e['sendStatus'](_0xca8f92);}return _0x25863e[_0xc811('0x15')](_0xca8f92)[_0xc811('0x16')]();};}function respondWithResult(_0x4fbb73,_0x2e183f){_0x2e183f=_0x2e183f||0xc8;return function(_0xd9e701){if(_0xd9e701){return _0x4fbb73[_0xc811('0x15')](_0x2e183f)['json'](_0xd9e701);}};}function respondWithFilteredResult(_0x23aa0e,_0x18b1de){return function(_0x4ac208){if(_0x4ac208){var _0x58ce41=typeof _0x18b1de[_0xc811('0x17')]===_0xc811('0x18')&&typeof _0x18b1de[_0xc811('0x19')]===_0xc811('0x18');var _0x57f02f=_0x4ac208['count'];var _0x20fa8e=_0x58ce41?0x0:_0x18b1de[_0xc811('0x17')];var _0x387205=_0x58ce41?_0x4ac208['count']:_0x18b1de[_0xc811('0x17')]+_0x18b1de[_0xc811('0x19')];var _0x12055d;if(_0x387205>=_0x57f02f){_0x387205=_0x57f02f;_0x12055d=0xc8;}else{_0x12055d=0xce;}_0x23aa0e['status'](_0x12055d);return _0x23aa0e['set'](_0xc811('0x1a'),_0x20fa8e+'-'+_0x387205+'/'+_0x57f02f)['json'](_0x4ac208);}return null;};}function patchUpdates(_0x15817a){return function(_0x10afab){try{jsonpatch[_0xc811('0x1b')](_0x10afab,_0x15817a,!![]);}catch(_0x46d3ab){return BPromise[_0xc811('0x1c')](_0x46d3ab);}return _0x10afab[_0xc811('0x1d')]();};}function saveUpdates(_0x5ef4f8,_0x3c4b77){return function(_0x3a6e79){if(_0x3a6e79){return _0x3a6e79['update'](_0x5ef4f8)['then'](function(_0x2e5d59){return _0x2e5d59;});}return null;};}function removeEntity(_0x36e092,_0x41a455){return function(_0x33a49b){if(_0x33a49b){return _0x33a49b['destroy']()[_0xc811('0x1e')](function(){_0x36e092[_0xc811('0x15')](0xcc)[_0xc811('0x16')]();});}};}function handleEntityNotFound(_0x46d271,_0x285c82){return function(_0x25e02a){if(!_0x25e02a){_0x46d271[_0xc811('0x1f')](0x194);}return _0x25e02a;};}function handleError(_0x169324,_0x3dc3e7){_0x3dc3e7=_0x3dc3e7||0x1f4;return function(_0x2847a9){logger[_0xc811('0x20')](_0x2847a9['stack']);if(_0x2847a9['name']){delete _0x2847a9[_0xc811('0x21')];}_0x169324[_0xc811('0x15')](_0x3dc3e7)[_0xc811('0x22')](_0x2847a9);};}exports[_0xc811('0x23')]=function(_0x5af8ee,_0x4315d8){var _0x10ec36={},_0x31582e={},_0x1d0d0b={'count':0x0,'rows':[]};var _0x35b720=_[_0xc811('0x24')](db[_0xc811('0x25')]['rawAttributes'],function(_0xcd3dd1){return{'name':_0xcd3dd1['fieldName'],'type':_0xcd3dd1[_0xc811('0x26')][_0xc811('0x27')]};});_0x31582e['model']=_[_0xc811('0x24')](_0x35b720,_0xc811('0x21'));_0x31582e['query']=_[_0xc811('0x28')](_0x5af8ee[_0xc811('0x29')]);_0x31582e[_0xc811('0x2a')]=_[_0xc811('0x2b')](_0x31582e[_0xc811('0x2c')],_0x31582e['query']);_0x10ec36[_0xc811('0x2d')]=_[_0xc811('0x2b')](_0x31582e['model'],qs['fields'](_0x5af8ee[_0xc811('0x29')][_0xc811('0x2e')]));_0x10ec36[_0xc811('0x2d')]=_0x10ec36[_0xc811('0x2d')][_0xc811('0x2f')]?_0x10ec36[_0xc811('0x2d')]:_0x31582e[_0xc811('0x2c')];if(!_0x5af8ee[_0xc811('0x29')][_0xc811('0x30')]('nolimit')){_0x10ec36[_0xc811('0x19')]=qs[_0xc811('0x19')](_0x5af8ee['query'][_0xc811('0x19')]);_0x10ec36[_0xc811('0x17')]=qs[_0xc811('0x17')](_0x5af8ee[_0xc811('0x29')][_0xc811('0x17')]);}_0x10ec36[_0xc811('0x31')]=qs[_0xc811('0x32')](_0x5af8ee[_0xc811('0x29')][_0xc811('0x32')]);_0x10ec36[_0xc811('0x33')]=qs[_0xc811('0x2a')](_[_0xc811('0x34')](_0x5af8ee[_0xc811('0x29')],_0x31582e[_0xc811('0x2a')]),_0x35b720);if(_0x5af8ee[_0xc811('0x29')][_0xc811('0x35')]){_0x10ec36[_0xc811('0x33')]=_[_0xc811('0x36')](_0x10ec36[_0xc811('0x33')],{'$or':_[_0xc811('0x24')](_0x35b720,function(_0x30203c){if(_0x30203c[_0xc811('0x26')]!==_0xc811('0x37')){var _0xaa2707={};_0xaa2707[_0x30203c[_0xc811('0x21')]]={'$like':'%'+_0x5af8ee['query'][_0xc811('0x35')]+'%'};return _0xaa2707;}})});}_0x10ec36=_[_0xc811('0x36')]({},_0x10ec36,_0x5af8ee[_0xc811('0x38')]);var _0x114f1a={'where':_0x10ec36[_0xc811('0x33')]};return db[_0xc811('0x25')][_0xc811('0x39')](_0x114f1a)[_0xc811('0x1e')](function(_0x433837){_0x1d0d0b[_0xc811('0x39')]=_0x433837;if(_0x5af8ee[_0xc811('0x29')]['includeAll']){_0x10ec36[_0xc811('0x3a')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x10ec36);})['then'](function(_0x2003cd){_0x1d0d0b[_0xc811('0x3b')]=_0x2003cd;return _0x1d0d0b;})['then'](respondWithFilteredResult(_0x4315d8,_0x10ec36))['catch'](handleError(_0x4315d8,null));};exports[_0xc811('0x3c')]=function(_0x421798,_0x3389e1){var _0x51876a={'raw':!![],'where':{'id':_0x421798['params']['id']}},_0x5d7581={};_0x5d7581[_0xc811('0x2c')]=_[_0xc811('0x28')](db[_0xc811('0x25')]['rawAttributes']);_0x5d7581[_0xc811('0x29')]=_[_0xc811('0x28')](_0x421798[_0xc811('0x29')]);_0x5d7581['filters']=_[_0xc811('0x2b')](_0x5d7581[_0xc811('0x2c')],_0x5d7581[_0xc811('0x29')]);_0x51876a[_0xc811('0x2d')]=_['intersection'](_0x5d7581[_0xc811('0x2c')],qs[_0xc811('0x2e')](_0x421798[_0xc811('0x29')][_0xc811('0x2e')]));_0x51876a[_0xc811('0x2d')]=_0x51876a['attributes'][_0xc811('0x2f')]?_0x51876a[_0xc811('0x2d')]:_0x5d7581[_0xc811('0x2c')];if(_0x421798[_0xc811('0x29')][_0xc811('0x3d')]){_0x51876a[_0xc811('0x3a')]=[{'all':!![]}];}_0x51876a=_[_0xc811('0x36')]({},_0x51876a,_0x421798[_0xc811('0x38')]);return db[_0xc811('0x25')][_0xc811('0x3e')](_0x51876a)[_0xc811('0x1e')](handleEntityNotFound(_0x3389e1,null))[_0xc811('0x1e')](respondWithResult(_0x3389e1,null))['catch'](handleError(_0x3389e1,null));};exports[_0xc811('0x3f')]=function(_0x11b5ca,_0x5ea4b2){var _0x1cf078={'where':{'id':_0x11b5ca[_0xc811('0x40')]['id']}},_0xf996ff={};_0xf996ff[_0xc811('0x2c')]=_['keys'](db[_0xc811('0x25')]['rawAttributes']);_0x1cf078[_0xc811('0x2d')]=_[_0xc811('0x2b')](_0xf996ff[_0xc811('0x2c')],qs['fields'](_0x11b5ca[_0xc811('0x29')]['fields']));_0x1cf078[_0xc811('0x2d')]=_0x1cf078['attributes'][_0xc811('0x2f')]?_0x1cf078['attributes']:_0xf996ff['model'];if(_0x11b5ca[_0xc811('0x29')][_0xc811('0x3d')]){_0x1cf078[_0xc811('0x3a')]=[{'all':!![]}];}_0x1cf078=_[_0xc811('0x36')]({},_0x1cf078,_0x11b5ca[_0xc811('0x38')]);return db['Attachment'][_0xc811('0x3e')](_0x1cf078)[_0xc811('0x1e')](handleEntityNotFound(_0x5ea4b2,null))[_0xc811('0x1e')](function(_0x2a8428){if(_0x2a8428){var _0x10aa30=_0x2a8428[_0xc811('0x41')]({'plain':!![]});_0x10aa30=qs['omit'](_0x10aa30,['id','createdAt',_0xc811('0x42')]);_0x11b5ca[_0xc811('0x43')]=_[_0xc811('0x44')](_0x11b5ca[_0xc811('0x43')],['id',_0xc811('0x45'),_0xc811('0x42')]);return db[_0xc811('0x25')]['create'](_[_0xc811('0x36')](_0x10aa30,_0x11b5ca[_0xc811('0x43')]),{'include':_0x11b5ca['query'][_0xc811('0x3d')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5ea4b2,0xc9))[_0xc811('0x46')](handleError(_0x5ea4b2,null));};exports[_0xc811('0x47')]=function(_0x48d31a,_0x5d3e16){if(_0x48d31a['body']['id']){delete _0x48d31a['body']['id'];}return db[_0xc811('0x25')][_0xc811('0x3e')]({'where':{'id':_0x48d31a[_0xc811('0x40')]['id']}})[_0xc811('0x1e')](handleEntityNotFound(_0x5d3e16,null))[_0xc811('0x1e')](saveUpdates(_0x48d31a[_0xc811('0x43')],null))[_0xc811('0x1e')](respondWithResult(_0x5d3e16,null))[_0xc811('0x46')](handleError(_0x5d3e16,null));};exports['destroy']=function(_0x15aa17,_0x2e60d5){return db[_0xc811('0x25')][_0xc811('0x3e')]({'where':{'id':_0x15aa17[_0xc811('0x40')]['id']}})[_0xc811('0x1e')](handleEntityNotFound(_0x2e60d5,null))[_0xc811('0x1e')](removeEntity(_0x2e60d5,null))['catch'](handleError(_0x2e60d5,null));};exports['create']=function(_0x163aa3,_0x18bcd0,_0x96ca44){_0x163aa3[_0xc811('0x43')][_0xc811('0x21')]=_0x163aa3['file']['originalname'];_0x163aa3[_0xc811('0x43')]['basename']=_0x163aa3[_0xc811('0x48')][_0xc811('0x49')];_0x163aa3['body']['type']=_0x163aa3[_0xc811('0x48')][_0xc811('0x4a')];return db[_0xc811('0x25')][_0xc811('0x4b')](_0x163aa3[_0xc811('0x43')])[_0xc811('0x1e')](respondWithResult(_0x18bcd0,0xc9))['catch'](handleError(_0x18bcd0,null));};exports[_0xc811('0x4c')]=function(_0x5ef09a,_0x1f8378,_0x3cbb6a){return db['Attachment'][_0xc811('0x4d')]({'where':{'id':_0x5ef09a[_0xc811('0x40')]['id']},'raw':!![]})[_0xc811('0x1e')](handleEntityNotFound(_0x1f8378,null))[_0xc811('0x1e')](function(_0x5e392a){if(_0x5e392a){var _0x24bff1=_0x5e392a['ChatOfflineMessageId']!==null;var _0x38ce3f=path['join'](config['root'],_0xc811('0x4e'));if(_0x24bff1){_0x38ce3f=path[_0xc811('0x4f')](_0x38ce3f,'offline-chat/');}var _0x5553f1=path[_0xc811('0x4f')](_0x38ce3f,_0x5e392a[_0xc811('0x50')]);return _0x1f8378['download'](_0x5553f1);}})[_0xc811('0x46')](handleError(_0x1f8378,null));}; \ No newline at end of file +var _0xe0bb=['filter','merge','VIRTUAL','options','Attachment','includeAll','findAll','catch','show','include','find','clone','rawAttributes','get','createdAt','updatedAt','body','omit','create','params','originalname','basename','file','filename','type','mimetype','download','join','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','end','stack','name','send','index','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0xe0bb,0xd3));var _0xbe0b=function(_0x26dd9a,_0x28a8e1){_0x26dd9a=_0x26dd9a-0x0;var _0x32c5f8=_0xe0bb[_0x26dd9a];return _0x32c5f8;};'use strict';var emlformat=require(_0xbe0b('0x0'));var rimraf=require(_0xbe0b('0x1'));var zipdir=require(_0xbe0b('0x2'));var jsonpatch=require(_0xbe0b('0x3'));var rp=require(_0xbe0b('0x4'));var moment=require(_0xbe0b('0x5'));var BPromise=require(_0xbe0b('0x6'));var Mustache=require(_0xbe0b('0x7'));var util=require(_0xbe0b('0x8'));var path=require(_0xbe0b('0x9'));var sox=require(_0xbe0b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe0b('0xb'));var _=require(_0xbe0b('0xc'));var squel=require(_0xbe0b('0xd'));var crypto=require(_0xbe0b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe0b('0xf'));var querystring=require(_0xbe0b('0x10'));var Papa=require(_0xbe0b('0x11'));var Redis=require(_0xbe0b('0x12'));var authService=require(_0xbe0b('0x13'));var qs=require(_0xbe0b('0x14'));var as=require(_0xbe0b('0x15'));var hardwareService=require(_0xbe0b('0x16'));var logger=require(_0xbe0b('0x17'))('api');var utils=require(_0xbe0b('0x18'));var config=require(_0xbe0b('0x19'));var licenseUtil=require(_0xbe0b('0x1a'));var db=require(_0xbe0b('0x1b'))['db'];function respondWithStatusCode(_0x405fd4,_0x4ec3cf){_0x4ec3cf=_0x4ec3cf||0xcc;return function(_0x4d6104){if(_0x4d6104){return _0x405fd4[_0xbe0b('0x1c')](_0x4ec3cf);}return _0x405fd4[_0xbe0b('0x1d')](_0x4ec3cf)['end']();};}function respondWithResult(_0x321960,_0x457a40){_0x457a40=_0x457a40||0xc8;return function(_0xc459c6){if(_0xc459c6){return _0x321960[_0xbe0b('0x1d')](_0x457a40)[_0xbe0b('0x1e')](_0xc459c6);}};}function respondWithFilteredResult(_0x3e6ef2,_0x4a6509){return function(_0x1076d0){if(_0x1076d0){var _0x3e6289=typeof _0x4a6509[_0xbe0b('0x1f')]===_0xbe0b('0x20')&&typeof _0x4a6509[_0xbe0b('0x21')]==='undefined';var _0x3799ea=_0x1076d0['count'];var _0x5df485=_0x3e6289?0x0:_0x4a6509['offset'];var _0x3df1bd=_0x3e6289?_0x1076d0[_0xbe0b('0x22')]:_0x4a6509[_0xbe0b('0x1f')]+_0x4a6509[_0xbe0b('0x21')];var _0x29735f;if(_0x3df1bd>=_0x3799ea){_0x3df1bd=_0x3799ea;_0x29735f=0xc8;}else{_0x29735f=0xce;}_0x3e6ef2[_0xbe0b('0x1d')](_0x29735f);return _0x3e6ef2[_0xbe0b('0x23')]('Content-Range',_0x5df485+'-'+_0x3df1bd+'/'+_0x3799ea)[_0xbe0b('0x1e')](_0x1076d0);}return null;};}function patchUpdates(_0x3cae02){return function(_0x3b5398){try{jsonpatch['apply'](_0x3b5398,_0x3cae02,!![]);}catch(_0x5edc51){return BPromise[_0xbe0b('0x24')](_0x5edc51);}return _0x3b5398[_0xbe0b('0x25')]();};}function saveUpdates(_0x362554,_0x45c62b){return function(_0x436bea){if(_0x436bea){return _0x436bea[_0xbe0b('0x26')](_0x362554)['then'](function(_0x5ecf93){return _0x5ecf93;});}return null;};}function removeEntity(_0x5b81ee,_0x57790e){return function(_0xffebc1){if(_0xffebc1){return _0xffebc1[_0xbe0b('0x27')]()[_0xbe0b('0x28')](function(){_0x5b81ee[_0xbe0b('0x1d')](0xcc)[_0xbe0b('0x29')]();});}};}function handleEntityNotFound(_0x2e6914,_0x135109){return function(_0x2d8a58){if(!_0x2d8a58){_0x2e6914[_0xbe0b('0x1c')](0x194);}return _0x2d8a58;};}function handleError(_0x280105,_0x3f7184){_0x3f7184=_0x3f7184||0x1f4;return function(_0x54ebde){logger['error'](_0x54ebde[_0xbe0b('0x2a')]);if(_0x54ebde[_0xbe0b('0x2b')]){delete _0x54ebde[_0xbe0b('0x2b')];}_0x280105[_0xbe0b('0x1d')](_0x3f7184)[_0xbe0b('0x2c')](_0x54ebde);};}exports[_0xbe0b('0x2d')]=function(_0x1ff6ec,_0x1a3e5a){var _0xd94ba0={},_0x1504e1={},_0x53eafd={'count':0x0,'rows':[]};var _0x118d49=_[_0xbe0b('0x2e')](db['Attachment']['rawAttributes'],function(_0x2f712c){return{'name':_0x2f712c[_0xbe0b('0x2f')],'type':_0x2f712c['type'][_0xbe0b('0x30')]};});_0x1504e1[_0xbe0b('0x31')]=_[_0xbe0b('0x2e')](_0x118d49,_0xbe0b('0x2b'));_0x1504e1[_0xbe0b('0x32')]=_[_0xbe0b('0x33')](_0x1ff6ec[_0xbe0b('0x32')]);_0x1504e1['filters']=_[_0xbe0b('0x34')](_0x1504e1[_0xbe0b('0x31')],_0x1504e1[_0xbe0b('0x32')]);_0xd94ba0['attributes']=_['intersection'](_0x1504e1[_0xbe0b('0x31')],qs[_0xbe0b('0x35')](_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x35')]));_0xd94ba0[_0xbe0b('0x36')]=_0xd94ba0[_0xbe0b('0x36')][_0xbe0b('0x37')]?_0xd94ba0[_0xbe0b('0x36')]:_0x1504e1[_0xbe0b('0x31')];if(!_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x38')](_0xbe0b('0x39'))){_0xd94ba0[_0xbe0b('0x21')]=qs[_0xbe0b('0x21')](_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x21')]);_0xd94ba0[_0xbe0b('0x1f')]=qs[_0xbe0b('0x1f')](_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x1f')]);}_0xd94ba0[_0xbe0b('0x3a')]=qs['sort'](_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x3b')]);_0xd94ba0[_0xbe0b('0x3c')]=qs[_0xbe0b('0x3d')](_['pick'](_0x1ff6ec[_0xbe0b('0x32')],_0x1504e1['filters']),_0x118d49);if(_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x3e')]){_0xd94ba0[_0xbe0b('0x3c')]=_[_0xbe0b('0x3f')](_0xd94ba0[_0xbe0b('0x3c')],{'$or':_[_0xbe0b('0x2e')](_0x118d49,function(_0x357a06){if(_0x357a06['type']!==_0xbe0b('0x40')){var _0x24590d={};_0x24590d[_0x357a06[_0xbe0b('0x2b')]]={'$like':'%'+_0x1ff6ec[_0xbe0b('0x32')][_0xbe0b('0x3e')]+'%'};return _0x24590d;}})});}_0xd94ba0=_[_0xbe0b('0x3f')]({},_0xd94ba0,_0x1ff6ec[_0xbe0b('0x41')]);var _0x396109={'where':_0xd94ba0[_0xbe0b('0x3c')]};return db[_0xbe0b('0x42')][_0xbe0b('0x22')](_0x396109)[_0xbe0b('0x28')](function(_0x144587){_0x53eafd[_0xbe0b('0x22')]=_0x144587;if(_0x1ff6ec['query'][_0xbe0b('0x43')]){_0xd94ba0['include']=[{'all':!![]}];}return db['Attachment'][_0xbe0b('0x44')](_0xd94ba0);})[_0xbe0b('0x28')](function(_0x30251d){_0x53eafd['rows']=_0x30251d;return _0x53eafd;})[_0xbe0b('0x28')](respondWithFilteredResult(_0x1a3e5a,_0xd94ba0))[_0xbe0b('0x45')](handleError(_0x1a3e5a,null));};exports[_0xbe0b('0x46')]=function(_0x145bb0,_0x4c9782){var _0x40460c={'raw':!![],'where':{'id':_0x145bb0['params']['id']}},_0x116b73={};_0x116b73[_0xbe0b('0x31')]=_[_0xbe0b('0x33')](db[_0xbe0b('0x42')]['rawAttributes']);_0x116b73[_0xbe0b('0x32')]=_['keys'](_0x145bb0[_0xbe0b('0x32')]);_0x116b73[_0xbe0b('0x3d')]=_[_0xbe0b('0x34')](_0x116b73[_0xbe0b('0x31')],_0x116b73[_0xbe0b('0x32')]);_0x40460c[_0xbe0b('0x36')]=_[_0xbe0b('0x34')](_0x116b73[_0xbe0b('0x31')],qs['fields'](_0x145bb0[_0xbe0b('0x32')][_0xbe0b('0x35')]));_0x40460c[_0xbe0b('0x36')]=_0x40460c[_0xbe0b('0x36')][_0xbe0b('0x37')]?_0x40460c[_0xbe0b('0x36')]:_0x116b73[_0xbe0b('0x31')];if(_0x145bb0['query']['includeAll']){_0x40460c[_0xbe0b('0x47')]=[{'all':!![]}];}_0x40460c=_[_0xbe0b('0x3f')]({},_0x40460c,_0x145bb0[_0xbe0b('0x41')]);return db[_0xbe0b('0x42')][_0xbe0b('0x48')](_0x40460c)[_0xbe0b('0x28')](handleEntityNotFound(_0x4c9782,null))['then'](respondWithResult(_0x4c9782,null))['catch'](handleError(_0x4c9782,null));};exports[_0xbe0b('0x49')]=function(_0x5c05e2,_0x1174d4){var _0x322547={'where':{'id':_0x5c05e2['params']['id']}},_0x17b264={};_0x17b264[_0xbe0b('0x31')]=_['keys'](db[_0xbe0b('0x42')][_0xbe0b('0x4a')]);_0x322547[_0xbe0b('0x36')]=_[_0xbe0b('0x34')](_0x17b264['model'],qs['fields'](_0x5c05e2[_0xbe0b('0x32')][_0xbe0b('0x35')]));_0x322547['attributes']=_0x322547[_0xbe0b('0x36')][_0xbe0b('0x37')]?_0x322547[_0xbe0b('0x36')]:_0x17b264[_0xbe0b('0x31')];if(_0x5c05e2[_0xbe0b('0x32')]['includeAll']){_0x322547[_0xbe0b('0x47')]=[{'all':!![]}];}_0x322547=_[_0xbe0b('0x3f')]({},_0x322547,_0x5c05e2[_0xbe0b('0x41')]);return db[_0xbe0b('0x42')][_0xbe0b('0x48')](_0x322547)['then'](handleEntityNotFound(_0x1174d4,null))['then'](function(_0x4dbae9){if(_0x4dbae9){var _0x4b9c08=_0x4dbae9[_0xbe0b('0x4b')]({'plain':!![]});_0x4b9c08=qs['omit'](_0x4b9c08,['id',_0xbe0b('0x4c'),_0xbe0b('0x4d')]);_0x5c05e2[_0xbe0b('0x4e')]=_[_0xbe0b('0x4f')](_0x5c05e2[_0xbe0b('0x4e')],['id',_0xbe0b('0x4c'),'updatedAt']);return db[_0xbe0b('0x42')][_0xbe0b('0x50')](_[_0xbe0b('0x3f')](_0x4b9c08,_0x5c05e2[_0xbe0b('0x4e')]),{'include':_0x5c05e2[_0xbe0b('0x32')][_0xbe0b('0x43')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x1174d4,0xc9))['catch'](handleError(_0x1174d4,null));};exports[_0xbe0b('0x26')]=function(_0x1d7a92,_0x1b9d3a){if(_0x1d7a92['body']['id']){delete _0x1d7a92['body']['id'];}return db['Attachment']['find']({'where':{'id':_0x1d7a92['params']['id']}})[_0xbe0b('0x28')](handleEntityNotFound(_0x1b9d3a,null))[_0xbe0b('0x28')](saveUpdates(_0x1d7a92[_0xbe0b('0x4e')],null))[_0xbe0b('0x28')](respondWithResult(_0x1b9d3a,null))['catch'](handleError(_0x1b9d3a,null));};exports[_0xbe0b('0x27')]=function(_0x4b623f,_0x5bf2df){return db[_0xbe0b('0x42')]['find']({'where':{'id':_0x4b623f[_0xbe0b('0x51')]['id']}})[_0xbe0b('0x28')](handleEntityNotFound(_0x5bf2df,null))[_0xbe0b('0x28')](removeEntity(_0x5bf2df,null))[_0xbe0b('0x45')](handleError(_0x5bf2df,null));};exports[_0xbe0b('0x50')]=function(_0x1f26c5,_0x10998d,_0x56500f){_0x1f26c5[_0xbe0b('0x4e')][_0xbe0b('0x2b')]=_0x1f26c5['file'][_0xbe0b('0x52')];_0x1f26c5['body'][_0xbe0b('0x53')]=_0x1f26c5[_0xbe0b('0x54')][_0xbe0b('0x55')];_0x1f26c5[_0xbe0b('0x4e')][_0xbe0b('0x56')]=_0x1f26c5['file'][_0xbe0b('0x57')];return db[_0xbe0b('0x42')][_0xbe0b('0x50')](_0x1f26c5[_0xbe0b('0x4e')])[_0xbe0b('0x28')](respondWithResult(_0x10998d,0xc9))[_0xbe0b('0x45')](handleError(_0x10998d,null));};exports[_0xbe0b('0x58')]=function(_0x4bf17f,_0x251eb0,_0xd61ab7){return db[_0xbe0b('0x42')]['findOne']({'where':{'id':_0x4bf17f[_0xbe0b('0x51')]['id']},'raw':!![]})[_0xbe0b('0x28')](handleEntityNotFound(_0x251eb0,null))[_0xbe0b('0x28')](function(_0x14eb87){if(_0x14eb87){var _0x3f3ec8=_0x14eb87['ChatOfflineMessageId']!==null;var _0x23c311=path[_0xbe0b('0x59')](config[_0xbe0b('0x5a')],'server/files/attachments/');if(_0x3f3ec8){_0x23c311=path['join'](_0x23c311,'offline-chat/');}var _0x5db492=path['join'](_0x23c311,_0x14eb87['basename']);return _0x251eb0[_0xbe0b('0x58')](_0x5db492);}})[_0xbe0b('0x45')](handleError(_0x251eb0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index ccabf97..ae9af76 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 _0x9995=['define','Attachment','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x179da7,_0x5d1e55){var _0x7d4a8f=function(_0x541de9){while(--_0x541de9){_0x179da7['push'](_0x179da7['shift']());}};_0x7d4a8f(++_0x5d1e55);}(_0x9995,0x136));var _0x5999=function(_0x1d4a68,_0x4de1e6){_0x1d4a68=_0x1d4a68-0x0;var _0x7a282c=_0x9995[_0x1d4a68];return _0x7a282c;};'use strict';var _=require(_0x5999('0x0'));var util=require(_0x5999('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5999('0x2'));var BPromise=require(_0x5999('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5999('0x4'));var rimraf=require(_0x5999('0x5'));var config=require(_0x5999('0x6'));var attributes=require(_0x5999('0x7'));module[_0x5999('0x8')]=function(_0x373ff3,_0x378ec9){return _0x373ff3[_0x5999('0x9')](_0x5999('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf739=['attachments','lodash','api','moment','path','./attachment.attributes','exports','define','Attachment'];(function(_0x2b18c9,_0x49659f){var _0x8b913c=function(_0x3e0954){while(--_0x3e0954){_0x2b18c9['push'](_0x2b18c9['shift']());}};_0x8b913c(++_0x49659f);}(_0xf739,0x121));var _0x9f73=function(_0x4f153b,_0x39818f){_0x4f153b=_0x4f153b-0x0;var _0x4e0cf8=_0xf739[_0x4f153b];return _0x4e0cf8;};'use strict';var _=require(_0x9f73('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9f73('0x1'));var moment=require(_0x9f73('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f73('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f73('0x4'));module[_0x9f73('0x5')]=function(_0x16845d,_0x574271){return _0x16845d[_0x9f73('0x6')](_0x9f73('0x7'),attributes,{'tableName':_0x9f73('0x8'),'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 94df6d6..e325700 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 _0xde56=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','raw','CreateAttachment','lodash'];(function(_0x56bcbd,_0x4f8854){var _0x192d76=function(_0x26a2e3){while(--_0x26a2e3){_0x56bcbd['push'](_0x56bcbd['shift']());}};_0x192d76(++_0x4f8854);}(_0xde56,0x144));var _0x6de5=function(_0x2a3c4d,_0x9c6b37){_0x2a3c4d=_0x2a3c4d-0x0;var _0x55c390=_0xde56[_0x2a3c4d];return _0x55c390;};'use strict';var _=require(_0x6de5('0x0'));var util=require('util');var moment=require(_0x6de5('0x1'));var BPromise=require(_0x6de5('0x2'));var rs=require(_0x6de5('0x3'));var fs=require('fs');var Redis=require(_0x6de5('0x4'));var db=require(_0x6de5('0x5'))['db'];var utils=require(_0x6de5('0x6'));var logger=require(_0x6de5('0x7'))(_0x6de5('0x8'));var config=require(_0x6de5('0x9'));var jayson=require(_0x6de5('0xa'));var client=jayson['client'][_0x6de5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x141d65,_0x27dcfe,_0x1f8236){return new BPromise(function(_0x1cd11e,_0x3f1400){return client['request'](_0x141d65,_0x1f8236)['then'](function(_0x1769af){logger[_0x6de5('0xc')](_0x6de5('0xd'),_0x27dcfe,_0x6de5('0xe'));logger['debug'](_0x6de5('0xf'),_0x27dcfe,_0x6de5('0xe'),JSON[_0x6de5('0x10')](_0x1769af));if(_0x1769af[_0x6de5('0x11')]){if(_0x1769af['error'][_0x6de5('0x12')]===0x1f4){logger[_0x6de5('0x11')]('Attachment,\x20%s,\x20%s',_0x27dcfe,_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);return _0x3f1400(_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);}logger['error'](_0x6de5('0xd'),_0x27dcfe,_0x1769af[_0x6de5('0x11')][_0x6de5('0x13')]);return _0x1cd11e(_0x1769af[_0x6de5('0x11')]['message']);}else{logger[_0x6de5('0xc')](_0x6de5('0xd'),_0x27dcfe,_0x6de5('0xe'));_0x1cd11e(_0x1769af[_0x6de5('0x14')]['message']);}})[_0x6de5('0x15')](function(_0x2316a6){logger[_0x6de5('0x11')](_0x6de5('0xd'),_0x27dcfe,_0x2316a6);_0x3f1400(_0x2316a6);});});}exports['CreateAttachment']=function(_0x1752f5){var _0x7b934e=this;return new Promise(function(_0x385ade,_0x344bbb){return db['Attachment']['create'](_0x1752f5[_0x6de5('0x16')],{'raw':_0x1752f5['options']?_0x1752f5['options'][_0x6de5('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x37a64d){logger[_0x6de5('0xc')](_0x6de5('0x18'),_0x1752f5);logger['debug'](_0x6de5('0x18'),_0x1752f5,JSON['stringify'](_0x37a64d));_0x385ade(_0x37a64d);})['catch'](function(_0x4c9621){logger['error'](_0x6de5('0x18'),_0x4c9621[_0x6de5('0x13')],_0x1752f5);_0x344bbb(_0x7b934e[_0x6de5('0x11')](0x1f4,_0x4c9621[_0x6de5('0x13')]));});});}; \ No newline at end of file +var _0xcabc=['error','code','message','result','catch','CreateAttachment','Attachment','create','body','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x450866,_0x597c41){var _0x586729=function(_0x12dd6f){while(--_0x12dd6f){_0x450866['push'](_0x450866['shift']());}};_0x586729(++_0x597c41);}(_0xcabc,0x16a));var _0xccab=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcabc[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xccab('0x0'));var moment=require(_0xccab('0x1'));var BPromise=require(_0xccab('0x2'));var rs=require(_0xccab('0x3'));var fs=require('fs');var Redis=require(_0xccab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xccab('0x5'));var logger=require(_0xccab('0x6'))('rpc');var config=require(_0xccab('0x7'));var jayson=require(_0xccab('0x8'));var client=jayson[_0xccab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112ab8,_0x29f877,_0x24b95c){return new BPromise(function(_0x4a6f3c,_0x2c43fa){return client[_0xccab('0xa')](_0x112ab8,_0x24b95c)['then'](function(_0x401b85){logger[_0xccab('0xb')](_0xccab('0xc'),_0x29f877,_0xccab('0xd'));logger[_0xccab('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x29f877,'request\x20sent',JSON[_0xccab('0xf')](_0x401b85));if(_0x401b85[_0xccab('0x10')]){if(_0x401b85[_0xccab('0x10')][_0xccab('0x11')]===0x1f4){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x401b85[_0xccab('0x10')]['message']);return _0x2c43fa(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}logger['error'](_0xccab('0xc'),_0x29f877,_0x401b85['error']['message']);return _0x4a6f3c(_0x401b85[_0xccab('0x10')][_0xccab('0x12')]);}else{logger[_0xccab('0xb')]('Attachment,\x20%s,\x20%s',_0x29f877,_0xccab('0xd'));_0x4a6f3c(_0x401b85[_0xccab('0x13')]['message']);}})[_0xccab('0x14')](function(_0x333142){logger[_0xccab('0x10')](_0xccab('0xc'),_0x29f877,_0x333142);_0x2c43fa(_0x333142);});});}exports[_0xccab('0x15')]=function(_0x5157c6){var _0x4ba1c2=this;return new Promise(function(_0x1960e7,_0x5e1eeb){return db[_0xccab('0x16')][_0xccab('0x17')](_0x5157c6[_0xccab('0x18')],{'raw':_0x5157c6['options']?_0x5157c6['options'][_0xccab('0x19')]===undefined?!![]:![]:!![]})[_0xccab('0x1a')](function(_0x459090){logger['info'](_0xccab('0x15'),_0x5157c6);logger['debug'](_0xccab('0x15'),_0x5157c6,JSON[_0xccab('0xf')](_0x459090));_0x1960e7(_0x459090);})['catch'](function(_0x32c852){logger[_0xccab('0x10')](_0xccab('0x15'),_0x32c852[_0xccab('0x12')],_0x5157c6);_0x5e1eeb(_0x4ba1c2[_0xccab('0x10')](0x1f4,_0x32c852[_0xccab('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 21b6a3f..f197232 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x171ca7,_0xdf336c){_0x171ca7=_0x171ca7-0x0;var _0x4f2ca3=_0xdb28[_0x171ca7];return _0x4f2ca3;};'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('./attachment.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['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x24546d,_0x1d083d){var _0x2e183b=function(_0x280e73){while(--_0x280e73){_0x24546d['push'](_0x24546d['shift']());}};_0x2e183b(++_0x1d083d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x18bca9,_0xc09be9){_0x18bca9=_0x18bca9-0x0;var _0x13e8e8=_0x5f2f[_0x18bca9];return _0x13e8e8;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ddd0887..c03f337 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 _0xdb94=['ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport-local','Strategy','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','add','minutes','getLicense','catch','send','message','login'];(function(_0x1d7bbd,_0x2042b2){var _0x551054=function(_0x53ae98){while(--_0x53ae98){_0x1d7bbd['push'](_0x1d7bbd['shift']());}};_0x551054(++_0x2042b2);}(_0xdb94,0xe5));var _0x4db9=function(_0x16c2e9,_0x229aa3){_0x16c2e9=_0x16c2e9-0x0;var _0x41991b=_0xdb94[_0x16c2e9];return _0x41991b;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x4db9('0x0'))[_0x4db9('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var util=require(_0x4db9('0x4'));var db=require(_0x4db9('0x5'))['db'];var authService=require(_0x4db9('0x6'));var utils=require('../../config/utils');var config=require(_0x4db9('0x7'));var logger=require('../../config/logger')(_0x4db9('0x8'));function isActiveDirectoryConfigured(_0xc76bc1){var _0x1dddb9=![];if(typeof _0xc76bc1[_0x4db9('0x9')]!==_0x4db9('0xa')){_0x1dddb9=_0xc76bc1['activedirectory'][_0x4db9('0xb')]&&_0xc76bc1[_0x4db9('0x9')][_0x4db9('0xc')]&&_0xc76bc1[_0x4db9('0x9')][_0x4db9('0xd')];}return _0x1dddb9;}function adAuthenticate(_0x575064,_0x268eb5,_0xf0b804){return new BPromise(function(_0x31f02d,_0xe6de11){try{var _0x34147f=new ActiveDirectory(_0x575064);_0x34147f[_0x4db9('0xe')](_0x268eb5,_0xf0b804,function(_0x58b34a,_0x2a7107){if(_0x58b34a){logger[_0x4db9('0xf')]('Error\x20authenticate\x20%s:\x20%s',_0x268eb5,util['inspect'](_0x58b34a,{'showHidden':![],'depth':null}));_0xe6de11(_0x4db9('0x10'));}else if(!_0x2a7107){logger[_0x4db9('0xf')](_0x4db9('0x11'),_0x268eb5);_0xe6de11('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x31f02d(_0x2a7107);}});}catch(_0x1a93be){_0xe6de11(_0x1a93be);}});}function ActiveDirectoryAuthenticate(_0x3dde55,_0x2018d2,_0x1ea47d,_0x2d89a7){var _0x585230,_0x1b1062;if(!isActiveDirectoryConfigured(config)){logger[_0x4db9('0xf')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x2018d2);return _0x2d89a7(null,![],{'message':_0x4db9('0x10')});}return db[_0x4db9('0x12')][_0x4db9('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x4db9('0x14')],'raw':!![]})[_0x4db9('0x15')](function(_0x4c5f4f){_0x585230=_0x4c5f4f;if(!_0x585230['adSsoEnabled']){logger['error'](_0x4db9('0x16'),_0x2018d2);throw new Error(_0x4db9('0x10'));}return _0x3dde55['findOne']({'logging':!![],'attributes':['id',_0x4db9('0x17'),_0x4db9('0x18'),_0x4db9('0x19'),_0x4db9('0x1a'),_0x4db9('0x1b'),_0x4db9('0x1c'),_0x4db9('0x1d'),_0x4db9('0x1e')],'where':{'name':_0x2018d2,'role':{'$or':[_0x4db9('0x1f'),_0x4db9('0x20'),_0x4db9('0x21')]},'adSsoEnabled':!![]}});})[_0x4db9('0x15')](function(_0x4d56a1){if(!_0x4d56a1||_0x4d56a1&&_0x4d56a1[_0x4db9('0x17')]!==_0x2018d2){throw new Error(_0x4db9('0x10'));}_0x1b1062=_0x4d56a1;var _0x56a550=_0x1b1062[_0x4db9('0x17')]+'@'+config[_0x4db9('0x9')][_0x4db9('0xd')];return adAuthenticate(config[_0x4db9('0x9')],_0x56a550,_0x1ea47d);})['then'](function(_0xe3dbe){if(_0x1b1062['disabled']){throw new Error(_0x4db9('0x10'));}if(_0x585230[_0x4db9('0x14')]>0x0){if(_0x1b1062[_0x4db9('0x1c')]){if(moment(_0x1b1062[_0x4db9('0x1d')])[_0x4db9('0x22')](_0x585230[_0x4db9('0x14')],_0x4db9('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0x1b1062,0x0,![],null)[_0x4db9('0x15')](function(){return utils['getLicense'](_0x1b1062);})[_0x4db9('0x15')](function(){return _0x2d89a7(null,_0x1b1062);});}else{return utils[_0x4db9('0x24')](_0x1b1062)[_0x4db9('0x15')](function(){return _0x2d89a7(null,_0x1b1062);});}}else{return utils[_0x4db9('0x24')](_0x1b1062)[_0x4db9('0x15')](function(){return _0x2d89a7(null,_0x1b1062);});}})[_0x4db9('0x25')](function(_0x1d0dc2){return _0x2d89a7(null,![],_0x1d0dc2);});}function handleError(_0x373a7d,_0x4c4a47,_0x35f757){return _0x373a7d['status'](_0x4c4a47||0x1f4)[_0x4db9('0x26')]({'message':_0x35f757?_0x35f757[_0x4db9('0x27')]||_0x35f757:''});}exports[_0x4db9('0x28')]=function(_0x314e64,_0x341bc5,_0x4b6130){passport[_0x4db9('0xe')](_0x4db9('0x29'),function(_0x2456b2,_0x31fe6a,_0x5a16e4){var _0x553d07=_0x2456b2||_0x5a16e4;if(_0x553d07){return handleError(_0x341bc5,0x191,_0x553d07);}if(!_0x31fe6a){return handleError(_0x341bc5,0x194,{'message':_0x4db9('0x2a')});}else{var _0x39e528={'payload':{'id':_0x31fe6a['id'],'role':_0x31fe6a['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x39e528)[_0x4db9('0x15')](function(_0x50a75e){_0x341bc5['json']({'id':_0x31fe6a['id'],'token':_0x50a75e,'statusCall':'','isAlreadyLogged':_0x31fe6a[_0x4db9('0x1e')]});});}})(_0x314e64,_0x341bc5,_0x4b6130);};passport[_0x4db9('0x2b')]('ad-login',new LocalStrategy({'usernameField':_0x4db9('0x17'),'passwordField':_0x4db9('0x18')},function(_0x11d881,_0x28f48c,_0x5ce0db){return ActiveDirectoryAuthenticate(db[_0x4db9('0x2c')],_0x11d881,_0x28f48c,_0x5ce0db);})); \ No newline at end of file +var _0x1d70=['Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','adSsoEnabled','blockDuration','findOne','name','role','disabled','blocked','blockedAt','online','admin','user','agent','then','add','getLicense','catch','status','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','ad-login','password','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','api','activedirectory','undefined','baseDN','url','domain','authenticate','error'];(function(_0x3bef05,_0x3fe8da){var _0x5d5593=function(_0x581032){while(--_0x581032){_0x3bef05['push'](_0x3bef05['shift']());}};_0x5d5593(++_0x3fe8da);}(_0x1d70,0x17b));var _0x01d7=function(_0x1fca08,_0x421519){_0x1fca08=_0x1fca08-0x0;var _0x41eeb0=_0x1d70[_0x1fca08];return _0x41eeb0;};'use strict';var passport=require('passport');var LocalStrategy=require(_0x01d7('0x0'))[_0x01d7('0x1')];var moment=require(_0x01d7('0x2'));var ActiveDirectory=require(_0x01d7('0x3'));var BPromise=require(_0x01d7('0x4'));var util=require(_0x01d7('0x5'));var db=require(_0x01d7('0x6'))['db'];var authService=require(_0x01d7('0x7'));var utils=require(_0x01d7('0x8'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x01d7('0x9'));function isActiveDirectoryConfigured(_0x525a62){var _0x3ddb7b=![];if(typeof _0x525a62[_0x01d7('0xa')]!==_0x01d7('0xb')){_0x3ddb7b=_0x525a62[_0x01d7('0xa')][_0x01d7('0xc')]&&_0x525a62[_0x01d7('0xa')][_0x01d7('0xd')]&&_0x525a62['activedirectory'][_0x01d7('0xe')];}return _0x3ddb7b;}function adAuthenticate(_0x3f62cb,_0x2c0d9d,_0x3fc06b){return new BPromise(function(_0xa7ba88,_0x479abd){try{var _0x3fdc25=new ActiveDirectory(_0x3f62cb);_0x3fdc25[_0x01d7('0xf')](_0x2c0d9d,_0x3fc06b,function(_0xe1c00d,_0x13d8a1){if(_0xe1c00d){logger[_0x01d7('0x10')](_0x01d7('0x11'),_0x2c0d9d,util[_0x01d7('0x12')](_0xe1c00d,{'showHidden':![],'depth':null}));_0x479abd(_0x01d7('0x13'));}else if(!_0x13d8a1){logger[_0x01d7('0x10')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x2c0d9d);_0x479abd(_0x01d7('0x13'));}else{_0xa7ba88(_0x13d8a1);}});}catch(_0x5abd36){_0x479abd(_0x5abd36);}});}function ActiveDirectoryAuthenticate(_0x38a215,_0x6b7b48,_0x52ca50,_0x4e4ce0){var _0x853dd2,_0x5b032d;if(!isActiveDirectoryConfigured(config)){logger[_0x01d7('0x10')](_0x01d7('0x14'),_0x6b7b48);return _0x4e4ce0(null,![],{'message':_0x01d7('0x13')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x01d7('0x15'),_0x01d7('0x16')],'raw':!![]})['then'](function(_0x5b96ad){_0x853dd2=_0x5b96ad;if(!_0x853dd2[_0x01d7('0x15')]){logger[_0x01d7('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x6b7b48);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x38a215[_0x01d7('0x17')]({'logging':!![],'attributes':['id',_0x01d7('0x18'),'password','salt',_0x01d7('0x19'),_0x01d7('0x1a'),_0x01d7('0x1b'),_0x01d7('0x1c'),_0x01d7('0x1d')],'where':{'name':_0x6b7b48,'role':{'$or':[_0x01d7('0x1e'),_0x01d7('0x1f'),_0x01d7('0x20')]},'adSsoEnabled':!![]}});})[_0x01d7('0x21')](function(_0x540d50){if(!_0x540d50||_0x540d50&&_0x540d50[_0x01d7('0x18')]!==_0x6b7b48){throw new Error(_0x01d7('0x13'));}_0x5b032d=_0x540d50;var _0x54fb91=_0x5b032d['name']+'@'+config['activedirectory'][_0x01d7('0xe')];return adAuthenticate(config['activedirectory'],_0x54fb91,_0x52ca50);})[_0x01d7('0x21')](function(_0x26df36){if(_0x5b032d[_0x01d7('0x1a')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x853dd2[_0x01d7('0x16')]>0x0){if(_0x5b032d[_0x01d7('0x1b')]){if(moment(_0x5b032d[_0x01d7('0x1c')])[_0x01d7('0x22')](_0x853dd2['blockDuration'],'minutes')>moment()){throw new Error(_0x01d7('0x13'));}return utils['clearBlockUser'](_0x5b032d,0x0,![],null)['then'](function(){return utils[_0x01d7('0x23')](_0x5b032d);})[_0x01d7('0x21')](function(){return _0x4e4ce0(null,_0x5b032d);});}else{return utils[_0x01d7('0x23')](_0x5b032d)[_0x01d7('0x21')](function(){return _0x4e4ce0(null,_0x5b032d);});}}else{return utils[_0x01d7('0x23')](_0x5b032d)[_0x01d7('0x21')](function(){return _0x4e4ce0(null,_0x5b032d);});}})[_0x01d7('0x24')](function(_0x6abbe8){return _0x4e4ce0(null,![],_0x6abbe8);});}function handleError(_0x566a2a,_0x436228,_0x436c20){return _0x566a2a[_0x01d7('0x25')](_0x436228||0x1f4)['send']({'message':_0x436c20?_0x436c20[_0x01d7('0x26')]||_0x436c20:''});}exports[_0x01d7('0x27')]=function(_0x57e37a,_0x107a80,_0x157fb7){passport[_0x01d7('0xf')]('ad-login',function(_0x459bc3,_0x21b925,_0x3d37e1){var _0x2ed7b0=_0x459bc3||_0x3d37e1;if(_0x2ed7b0){return handleError(_0x107a80,0x191,_0x2ed7b0);}if(!_0x21b925){return handleError(_0x107a80,0x194,{'message':_0x01d7('0x28')});}else{var _0x5c9096={'payload':{'id':_0x21b925['id'],'role':_0x21b925[_0x01d7('0x19')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x5c9096)[_0x01d7('0x21')](function(_0xdf22b6){_0x107a80['json']({'id':_0x21b925['id'],'token':_0xdf22b6,'statusCall':'','isAlreadyLogged':_0x21b925['online']});});}})(_0x57e37a,_0x107a80,_0x157fb7);};passport[_0x01d7('0x29')](_0x01d7('0x2a'),new LocalStrategy({'usernameField':_0x01d7('0x18'),'passwordField':_0x01d7('0x2b')},function(_0xb97de1,_0x4dd60e,_0x5168ee){return ActiveDirectoryAuthenticate(db['User'],_0xb97de1,_0x4dd60e,_0x5168ee);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 72aab74..0afa3fe 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 _0x1603=['post','login','express'];(function(_0x26e105,_0x821a88){var _0x534f19=function(_0x3cbc79){while(--_0x3cbc79){_0x26e105['push'](_0x26e105['shift']());}};_0x534f19(++_0x821a88);}(_0x1603,0x77));var _0x3160=function(_0x48fce3,_0x53822a){_0x48fce3=_0x48fce3-0x0;var _0x2072f0=_0x1603[_0x48fce3];return _0x2072f0;};'use strict';var express=require(_0x3160('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0x3160('0x1')]('/',controller[_0x3160('0x2')]);module['exports']=router; \ No newline at end of file +var _0x433f=['post','exports','express'];(function(_0x50b0a9,_0x5160b1){var _0xa4c6f7=function(_0x4757eb){while(--_0x4757eb){_0x50b0a9['push'](_0x50b0a9['shift']());}};_0xa4c6f7(++_0x5160b1);}(_0x433f,0x1a6));var _0xf433=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x433f[_0x4b055c];return _0x4b62bb;};'use strict';var express=require(_0xf433('0x0'));var router=express['Router']();var controller=require('./authActiveDirectory.controller');router[_0xf433('0x1')]('/',controller['login']);module[_0xf433('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 524057d..6f6e42d 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0xa3d13d,_0x134b1b){var _0x35f6cf=function(_0x315190){while(--_0x315190){_0xa3d13d['push'](_0xa3d13d['shift']());}};_0x35f6cf(++_0x134b1b);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _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(_0x3daee9,_0x584718){var _0x1a9a60=function(_0x5a9c53){while(--_0x5a9c53){_0x3daee9['push'](_0x3daee9['shift']());}};_0x1a9a60(++_0x584718);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 d270b54..a1d3bad 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 _0x679c=['../../components/auth/service','login','get','callback','isMiddleware','exports','express','Router','./authGoogle.controller','../user/user.controller.js'];(function(_0x3530d0,_0x4dfb47){var _0x2165c6=function(_0x2ab151){while(--_0x2ab151){_0x3530d0['push'](_0x3530d0['shift']());}};_0x2165c6(++_0x4dfb47);}(_0x679c,0x128));var _0xc679=function(_0x2f63e8,_0x250a22){_0x2f63e8=_0x2f63e8-0x0;var _0x84b0b8=_0x679c[_0x2f63e8];return _0x84b0b8;};'use strict';var express=require(_0xc679('0x0'));var passport=require('passport');var router=express[_0xc679('0x1')]();var controller=require(_0xc679('0x2'));var userController=require(_0xc679('0x3'));var authService=require(_0xc679('0x4'));router['get']('/',controller[_0xc679('0x5')]);router[_0xc679('0x6')]('/callback',controller[_0xc679('0x7')],authService[_0xc679('0x8')],userController[_0xc679('0x5')],authService['setTokenCookie']);module[_0xc679('0x9')]=router; \ No newline at end of file +var _0x3144=['passport','Router','./authGoogle.controller','../../components/auth/service','login','get','/callback','callback','setTokenCookie','exports','express'];(function(_0x57c107,_0x2c2f4a){var _0x135c42=function(_0x220a80){while(--_0x220a80){_0x57c107['push'](_0x57c107['shift']());}};_0x135c42(++_0x2c2f4a);}(_0x3144,0x1e3));var _0x4314=function(_0x2ac723,_0x28ce70){_0x2ac723=_0x2ac723-0x0;var _0x3a8802=_0x3144[_0x2ac723];return _0x3a8802;};'use strict';var express=require(_0x4314('0x0'));var passport=require(_0x4314('0x1'));var router=express[_0x4314('0x2')]();var controller=require(_0x4314('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0x4314('0x4'));router['get']('/',controller[_0x4314('0x5')]);router[_0x4314('0x6')](_0x4314('0x7'),controller[_0x4314('0x8')],authService['isMiddleware'],userController['login'],authService[_0x4314('0x9')]);module[_0x4314('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 101e192..d4f103d 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 _0x2e3c=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','params','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','validatePasswordHistory','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','MailServerOut','Smtp','service','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','email','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','generate','body','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x2e3c,0x1b1));var _0xc2e3=function(_0x54e4cc,_0x560149){_0x54e4cc=_0x54e4cc-0x0;var _0xdff54=_0x2e3c[_0x54e4cc];return _0xdff54;};'use strict';var util=require(_0xc2e3('0x0'));var passport=require(_0xc2e3('0x1'));var LocalStrategy=require(_0xc2e3('0x2'))[_0xc2e3('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xc2e3('0x4'));var moment=require(_0xc2e3('0x5'));var db=require(_0xc2e3('0x6'))['db'];var authService=require(_0xc2e3('0x7'));var utils=require(_0xc2e3('0x8'));var client=jayson['client'][_0xc2e3('0x9')]({'port':0x232b});function localAuthenticate(_0x11d75d,_0x12e465,_0xa3c86e,_0x5e61ce){var _0x16ae3e,_0x5c5828;return db[_0xc2e3('0xa')][_0xc2e3('0xb')]({'where':{'id':0x1},'attributes':[_0xc2e3('0xc'),_0xc2e3('0xd')],'raw':!![]})[_0xc2e3('0xe')](function(_0x484356){_0x16ae3e=_0x484356;return _0x11d75d[_0xc2e3('0xb')]({'attributes':['id',_0xc2e3('0xf'),'password',_0xc2e3('0x10'),_0xc2e3('0x11'),_0xc2e3('0x12'),'blocked',_0xc2e3('0x13'),_0xc2e3('0x14')],'where':{'name':_0x12e465,'role':{'$or':[_0xc2e3('0x15'),_0xc2e3('0x16'),_0xc2e3('0x17')]}}});})[_0xc2e3('0xe')](function(_0x123e42){if(!_0x123e42||_0x123e42&&_0x123e42[_0xc2e3('0xf')]!==_0x12e465){throw new Error(_0xc2e3('0x18'));}else{_0x5c5828=_0x123e42;return _0x5c5828;}})[_0xc2e3('0xe')](function(){_0x5c5828[_0xc2e3('0x19')](_0xa3c86e,function(_0x3f8464,_0x365689){var _0x13d1a5=_0x5c5828[_0xc2e3('0x14')]+0x1;if(_0x3f8464){return _0x5e61ce(_0x3f8464);}else if(!_0x365689){if(_0x5c5828[_0xc2e3('0x12')]){return _0x5e61ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x16ae3e[_0xc2e3('0xc')]>0x0){if(_0x5c5828[_0xc2e3('0x1a')]){if(_0x16ae3e['blockDuration']>0x0){if(moment(_0x5c5828[_0xc2e3('0x13')])[_0xc2e3('0x1b')](_0x16ae3e['blockDuration'],_0xc2e3('0x1c'))>moment()){return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}else{return utils[_0xc2e3('0x1d')](_0x5c5828,_0x13d1a5,![],null)[_0xc2e3('0xe')](function(){return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});});}}else{return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}}else{if(_0x13d1a5>=_0x16ae3e['allowedLoginAttempts']){return utils[_0xc2e3('0x1d')](_0x5c5828,0x0,!![],moment())[_0xc2e3('0xe')](function(){return _0x5e61ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5c5828,_0x13d1a5,![],null)[_0xc2e3('0xe')](function(){return _0x5e61ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}}else{if(_0x5c5828[_0xc2e3('0x12')]){return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}else if(_0x16ae3e[_0xc2e3('0xc')]>0x0){if(_0x5c5828['blocked']){if(_0x16ae3e[_0xc2e3('0xd')]>0x0){if(moment(_0x5c5828[_0xc2e3('0x13')])['add'](_0x16ae3e[_0xc2e3('0xd')],_0xc2e3('0x1c'))>moment()){return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}else{return utils[_0xc2e3('0x1d')](_0x5c5828,0x0,![],null)[_0xc2e3('0xe')](function(){return utils[_0xc2e3('0x1e')](_0x5c5828);})[_0xc2e3('0xe')](function(){return _0x5e61ce(null,_0x5c5828);});}}else{return _0x5e61ce(null,![],{'message':_0xc2e3('0x18')});}}else{return utils[_0xc2e3('0x1d')](_0x5c5828,0x0,![],null)[_0xc2e3('0xe')](function(){return utils[_0xc2e3('0x1e')](_0x5c5828);})[_0xc2e3('0xe')](function(){return _0x5e61ce(null,_0x5c5828);})['catch'](function(_0x2d5087){return _0x5e61ce(null,![],_0x2d5087);});}}else{if(_0x5c5828[_0xc2e3('0x1a')]){return _0x5e61ce(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xc2e3('0x1e')](_0x5c5828)[_0xc2e3('0xe')](function(){return _0x5e61ce(null,_0x5c5828);});}}}});})[_0xc2e3('0x1f')](function(_0x5b8861){return _0x5e61ce(null,![],_0x5b8861);});}function sendServiceMail(_0x2126ef){return db[_0xc2e3('0x20')][_0xc2e3('0x21')]({'where':{'service':!![]},'attributes':['id',_0xc2e3('0xf'),'email'],'include':[{'model':db[_0xc2e3('0x22')],'as':_0xc2e3('0x23')}]})[_0xc2e3('0xe')](function(_0x42c90d){if(!_0x42c90d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4682bb={'tls':{'rejectUnauthorized':![]}};if(_0x42c90d[_0xc2e3('0x23')][_0xc2e3('0x24')]){_0x4682bb[_0xc2e3('0x24')]=_0x42c90d[_0xc2e3('0x23')]['service'];}else{_0x4682bb[_0xc2e3('0x25')]=_0x42c90d[_0xc2e3('0x23')][_0xc2e3('0x25')];_0x4682bb[_0xc2e3('0x26')]=_0x42c90d[_0xc2e3('0x23')][_0xc2e3('0x26')];_0x4682bb[_0xc2e3('0x27')]=_0x42c90d['Smtp'][_0xc2e3('0x27')];}if(_0x42c90d[_0xc2e3('0x23')]['authentication']){_0x4682bb[_0xc2e3('0x28')]={'user':_0x42c90d[_0xc2e3('0x23')][_0xc2e3('0x16')],'pass':_0x42c90d['Smtp'][_0xc2e3('0x29')]};}var _0x22dfed={'account':_0x4682bb,'message':_[_0xc2e3('0x2a')]({'from':util['format'](_0xc2e3('0x2b'),_0x42c90d['name'],_0x42c90d[_0xc2e3('0x2c')]||_0x42c90d[_0xc2e3('0x23')][_0xc2e3('0x16')])},_0x2126ef)};return client[_0xc2e3('0x2d')]('SendMail',_0x22dfed);})[_0xc2e3('0xe')](function(_0x13d9e2){if(_0x13d9e2[_0xc2e3('0x2e')]){throw new Error(util['format'](_0xc2e3('0x2f'),_0x13d9e2[_0xc2e3('0x2e')][_0xc2e3('0x30')]||JSON[_0xc2e3('0x31')](_0x13d9e2[_0xc2e3('0x2e')])));}return!![];});}function handleError(_0x492b88,_0x25ecc5,_0x1b5431){return _0x492b88['status'](_0x25ecc5||0x1f4)[_0xc2e3('0x32')]({'message':_0x1b5431?_0x1b5431[_0xc2e3('0x30')]||_0x1b5431:''});}exports[_0xc2e3('0x33')]=function(_0x52a370,_0x3b6336,_0x1475c2){passport['authenticate']('local-login',function(_0x4b5479,_0x13e401,_0x10170c){var _0x2daa19=_0x4b5479||_0x10170c;if(_0x2daa19){return handleError(_0x3b6336,0x191,_0x2daa19);}if(!_0x13e401){return handleError(_0x3b6336,0x194,{'message':_0xc2e3('0x34')});}else{var _0x33e28a={'payload':{'id':_0x13e401['id'],'role':_0x13e401[_0xc2e3('0x11')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x33e28a)[_0xc2e3('0xe')](function(_0x3b65fc){_0x3b6336[_0xc2e3('0x35')]({'id':_0x13e401['id'],'token':_0x3b65fc,'statusCall':'','isAlreadyLogged':_0x13e401[_0xc2e3('0x36')]});});}})(_0x52a370,_0x3b6336,_0x1475c2);};exports['forgot']=function(_0x303484,_0x31a48a,_0x379d81){if(!_0x303484['body'][_0xc2e3('0x2c')]){return handleError(_0x31a48a,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x56a6e2=rs[_0xc2e3('0x37')]();_0x303484[_0xc2e3('0x38')][_0xc2e3('0x2c')]=_0x303484[_0xc2e3('0x38')][_0xc2e3('0x2c')][_0xc2e3('0x39')]()['toLowerCase']();var _0x4fee98;return db[_0xc2e3('0xa')][_0xc2e3('0xb')]({'where':{'id':0x1},'attributes':[_0xc2e3('0xc'),_0xc2e3('0xd')],'raw':!![]})[_0xc2e3('0xe')](function(_0x5d6870){_0x4fee98=_0x5d6870;return db[_0xc2e3('0x3a')][_0xc2e3('0x21')]({'where':{'email':_0x303484[_0xc2e3('0x38')]['email']}});})['then'](function(_0x78c3a0){if(!_0x78c3a0){throw new Error(_0xc2e3('0x3b'));}if(_0x78c3a0[_0xc2e3('0x12')]){throw new Error(_0xc2e3('0x3c'));}if(_0x78c3a0[_0xc2e3('0x1a')]){if(moment(_0x78c3a0[_0xc2e3('0x13')])[_0xc2e3('0x1b')](_0x4fee98[_0xc2e3('0xd')],_0xc2e3('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x78c3a0[_0xc2e3('0x1a')]=![];_0x78c3a0[_0xc2e3('0x13')]=null;}}_0x78c3a0['resetPasswordToken']=_0x56a6e2;_0x78c3a0[_0xc2e3('0x3d')]=Date[_0xc2e3('0x3e')]()+0x36ee80;return _0x78c3a0[_0xc2e3('0x3f')]();})[_0xc2e3('0xe')](function(){return sendServiceMail({'to':_0x303484[_0xc2e3('0x38')]['email'],'subject':_0xc2e3('0x40'),'text':_0xc2e3('0x41')+_0xc2e3('0x42')+_0xc2e3('0x43')+_0x303484[_0xc2e3('0x44')][_0xc2e3('0x25')]+_0xc2e3('0x45')+_0x56a6e2+'\x0a\x0a'+_0xc2e3('0x46')});})[_0xc2e3('0xe')](function(){_0x31a48a[_0xc2e3('0x47')](0xc8)[_0xc2e3('0x32')]({'message':_0xc2e3('0x48')});})[_0xc2e3('0x1f')](function(_0x512329){return handleError(_0x31a48a,0x1f4,_0x512329);});};exports['reset']=function(_0x587d2c,_0x21d6bf,_0x258c31){return db[_0xc2e3('0x3a')][_0xc2e3('0x21')]({'where':{'resetPasswordToken':_0x587d2c[_0xc2e3('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0xc2e3('0x3e')]()}}})[_0xc2e3('0xe')](function(_0x1e189c){if(!_0x1e189c){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0xc2e3('0xa')][_0xc2e3('0xb')]({'attributes':['id',_0xc2e3('0x4a'),_0xc2e3('0x4b'),_0xc2e3('0x4c')]})[_0xc2e3('0xe')](function(_0x34c815){if(_0x34c815[_0xc2e3('0x4a')])authService[_0xc2e3('0x4d')](_0x587d2c[_0xc2e3('0x38')][_0xc2e3('0x4e')]);if(!_0x34c815[_0xc2e3('0x4b')]||!_0x1e189c['previousPasswords'])return _0x1e189c;authService[_0xc2e3('0x4f')](_0x587d2c[_0xc2e3('0x38')][_0xc2e3('0x4e')],_0x1e189c['previousPasswords'],_0x34c815[_0xc2e3('0x4c')]);return _0x1e189c;})['then'](function(){_0x1e189c['password']=_0x587d2c[_0xc2e3('0x38')]['password'];_0x1e189c[_0xc2e3('0x50')]=null;_0x1e189c[_0xc2e3('0x3d')]=null;return _0x1e189c[_0xc2e3('0x3f')]();});})[_0xc2e3('0xe')](function(){_0x21d6bf[_0xc2e3('0x47')](0xc8)[_0xc2e3('0x32')]({'message':_0xc2e3('0x51')});})[_0xc2e3('0x1f')](function(_0xc74f22){return handleError(_0x21d6bf,0x1f4,_0xc74f22);});};passport[_0xc2e3('0x52')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0xc2e3('0x4e')},function(_0x23bd00,_0x266c31,_0x47c22a){return localAuthenticate(db[_0xc2e3('0x3a')],_0x23bd00,_0x266c31,_0x47c22a);})); \ No newline at end of file +var _0x43a4=['generate','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','password','previousPasswords','validatePasswordHistory','resetPasswordToken','resetPasswordExpires','status','Password\x20reset!','util','passport-local','Strategy','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','login','local-login','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing'];(function(_0x4ea22c,_0x4f800f){var _0x3eeb9c=function(_0x33acc8){while(--_0x33acc8){_0x4ea22c['push'](_0x4ea22c['shift']());}};_0x3eeb9c(++_0x4f800f);}(_0x43a4,0x174));var _0x443a=function(_0x626eca,_0x46bcc0){_0x626eca=_0x626eca-0x0;var _0x14d464=_0x43a4[_0x626eca];return _0x14d464;};'use strict';var util=require(_0x443a('0x0'));var passport=require('passport');var LocalStrategy=require(_0x443a('0x1'))[_0x443a('0x2')];var jayson=require('jayson/promise');var _=require(_0x443a('0x3'));var rs=require(_0x443a('0x4'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x443a('0x5'));var utils=require(_0x443a('0x6'));var client=jayson[_0x443a('0x7')][_0x443a('0x8')]({'port':0x232b});function localAuthenticate(_0x48193a,_0x3c1a29,_0x47807a,_0x207c90){var _0x2cc23c,_0x21e551;return db[_0x443a('0x9')][_0x443a('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x443a('0xb')],'raw':!![]})[_0x443a('0xc')](function(_0x1a2fe4){_0x2cc23c=_0x1a2fe4;return _0x48193a[_0x443a('0xa')]({'attributes':['id',_0x443a('0xd'),'password','salt','role',_0x443a('0xe'),_0x443a('0xf'),_0x443a('0x10'),_0x443a('0x11')],'where':{'name':_0x3c1a29,'role':{'$or':[_0x443a('0x12'),_0x443a('0x13'),_0x443a('0x14')]}}});})['then'](function(_0x26e85b){if(!_0x26e85b||_0x26e85b&&_0x26e85b[_0x443a('0xd')]!==_0x3c1a29){throw new Error(_0x443a('0x15'));}else{_0x21e551=_0x26e85b;return _0x21e551;}})[_0x443a('0xc')](function(){_0x21e551[_0x443a('0x16')](_0x47807a,function(_0x33cafd,_0x4ec695){var _0x2d5d17=_0x21e551['loginAttempts']+0x1;if(_0x33cafd){return _0x207c90(_0x33cafd);}else if(!_0x4ec695){if(_0x21e551[_0x443a('0xe')]){return _0x207c90(null,![],{'message':_0x443a('0x15')});}else if(_0x2cc23c[_0x443a('0x17')]>0x0){if(_0x21e551[_0x443a('0xf')]){if(_0x2cc23c[_0x443a('0xb')]>0x0){if(moment(_0x21e551[_0x443a('0x10')])[_0x443a('0x18')](_0x2cc23c['blockDuration'],_0x443a('0x19'))>moment()){return _0x207c90(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x443a('0x1a')](_0x21e551,_0x2d5d17,![],null)[_0x443a('0xc')](function(){return _0x207c90(null,![],{'message':_0x443a('0x15')});});}}else{return _0x207c90(null,![],{'message':_0x443a('0x15')});}}else{if(_0x2d5d17>=_0x2cc23c[_0x443a('0x17')]){return utils[_0x443a('0x1a')](_0x21e551,0x0,!![],moment())[_0x443a('0xc')](function(){return _0x207c90(null,![],{'message':_0x443a('0x15')});});}else{return utils['clearBlockUser'](_0x21e551,_0x2d5d17,![],null)[_0x443a('0xc')](function(){return _0x207c90(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x207c90(null,![],{'message':_0x443a('0x15')});}}else{if(_0x21e551[_0x443a('0xe')]){return _0x207c90(null,![],{'message':_0x443a('0x15')});}else if(_0x2cc23c['allowedLoginAttempts']>0x0){if(_0x21e551['blocked']){if(_0x2cc23c['blockDuration']>0x0){if(moment(_0x21e551[_0x443a('0x10')])[_0x443a('0x18')](_0x2cc23c[_0x443a('0xb')],'minutes')>moment()){return _0x207c90(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x443a('0x1a')](_0x21e551,0x0,![],null)[_0x443a('0xc')](function(){return utils[_0x443a('0x1b')](_0x21e551);})[_0x443a('0xc')](function(){return _0x207c90(null,_0x21e551);});}}else{return _0x207c90(null,![],{'message':_0x443a('0x15')});}}else{return utils['clearBlockUser'](_0x21e551,0x0,![],null)[_0x443a('0xc')](function(){return utils[_0x443a('0x1b')](_0x21e551);})[_0x443a('0xc')](function(){return _0x207c90(null,_0x21e551);})['catch'](function(_0x2f9adc){return _0x207c90(null,![],_0x2f9adc);});}}else{if(_0x21e551[_0x443a('0xf')]){return _0x207c90(null,![],{'message':_0x443a('0x15')});}else{return utils[_0x443a('0x1b')](_0x21e551)['then'](function(){return _0x207c90(null,_0x21e551);});}}}});})[_0x443a('0x1c')](function(_0x51a8d8){return _0x207c90(null,![],_0x51a8d8);});}function sendServiceMail(_0x1a52aa){return db['MailAccount'][_0x443a('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x443a('0xd'),_0x443a('0x1e')],'include':[{'model':db[_0x443a('0x1f')],'as':_0x443a('0x20')}]})[_0x443a('0xc')](function(_0x3f410c){if(!_0x3f410c){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x58a40e={'tls':{'rejectUnauthorized':![]}};if(_0x3f410c['Smtp'][_0x443a('0x21')]){_0x58a40e[_0x443a('0x21')]=_0x3f410c['Smtp'][_0x443a('0x21')];}else{_0x58a40e[_0x443a('0x22')]=_0x3f410c[_0x443a('0x20')]['host'];_0x58a40e['port']=_0x3f410c[_0x443a('0x20')][_0x443a('0x23')];_0x58a40e['secure']=_0x3f410c['Smtp'][_0x443a('0x24')];}if(_0x3f410c['Smtp'][_0x443a('0x25')]){_0x58a40e[_0x443a('0x26')]={'user':_0x3f410c[_0x443a('0x20')]['user'],'pass':_0x3f410c[_0x443a('0x20')][_0x443a('0x27')]};}var _0x551fba={'account':_0x58a40e,'message':_[_0x443a('0x28')]({'from':util[_0x443a('0x29')](_0x443a('0x2a'),_0x3f410c['name'],_0x3f410c[_0x443a('0x1e')]||_0x3f410c[_0x443a('0x20')]['user'])},_0x1a52aa)};return client[_0x443a('0x2b')](_0x443a('0x2c'),_0x551fba);})[_0x443a('0xc')](function(_0x233119){if(_0x233119[_0x443a('0x2d')]){throw new Error(util[_0x443a('0x29')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x233119[_0x443a('0x2d')][_0x443a('0x2e')]||JSON[_0x443a('0x2f')](_0x233119[_0x443a('0x2d')])));}return!![];});}function handleError(_0x3ba93c,_0x51501a,_0x1e394a){return _0x3ba93c['status'](_0x51501a||0x1f4)[_0x443a('0x30')]({'message':_0x1e394a?_0x1e394a['message']||_0x1e394a:''});}exports[_0x443a('0x31')]=function(_0x252a77,_0x51d239,_0x2883ea){passport[_0x443a('0x16')](_0x443a('0x32'),function(_0x335d61,_0x20686d,_0x4c9c2e){var _0x2f2545=_0x335d61||_0x4c9c2e;if(_0x2f2545){return handleError(_0x51d239,0x191,_0x2f2545);}if(!_0x20686d){return handleError(_0x51d239,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x361623={'payload':{'id':_0x20686d['id'],'role':_0x20686d[_0x443a('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x443a('0x34')](_0x361623)['then'](function(_0x54e849){_0x51d239[_0x443a('0x35')]({'id':_0x20686d['id'],'token':_0x54e849,'statusCall':'','isAlreadyLogged':_0x20686d[_0x443a('0x36')]});});}})(_0x252a77,_0x51d239,_0x2883ea);};exports[_0x443a('0x37')]=function(_0x4f8ce8,_0x5be347,_0x194508){if(!_0x4f8ce8[_0x443a('0x38')][_0x443a('0x1e')]){return handleError(_0x5be347,0x1f4,{'message':_0x443a('0x39')});}var _0x228641=rs[_0x443a('0x3a')]();_0x4f8ce8[_0x443a('0x38')]['email']=_0x4f8ce8['body']['email']['trim']()[_0x443a('0x3b')]();var _0x58776d;return db[_0x443a('0x9')][_0x443a('0xa')]({'where':{'id':0x1},'attributes':[_0x443a('0x17'),_0x443a('0xb')],'raw':!![]})[_0x443a('0xc')](function(_0x28e23e){_0x58776d=_0x28e23e;return db[_0x443a('0x3c')]['find']({'where':{'email':_0x4f8ce8[_0x443a('0x38')]['email']}});})[_0x443a('0xc')](function(_0x3e140f){if(!_0x3e140f){throw new Error(_0x443a('0x3d'));}if(_0x3e140f[_0x443a('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x3e140f[_0x443a('0xf')]){if(moment(_0x3e140f[_0x443a('0x10')])[_0x443a('0x18')](_0x58776d[_0x443a('0xb')],_0x443a('0x19'))>moment()){throw new Error(_0x443a('0x3e'));}else{_0x3e140f[_0x443a('0xf')]=![];_0x3e140f[_0x443a('0x10')]=null;}}_0x3e140f['resetPasswordToken']=_0x228641;_0x3e140f['resetPasswordExpires']=Date[_0x443a('0x3f')]()+0x36ee80;return _0x3e140f[_0x443a('0x40')]();})['then'](function(){return sendServiceMail({'to':_0x4f8ce8[_0x443a('0x38')][_0x443a('0x1e')],'subject':_0x443a('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x443a('0x42')+_0x443a('0x43')+_0x4f8ce8[_0x443a('0x44')][_0x443a('0x22')]+_0x443a('0x45')+_0x228641+'\x0a\x0a'+_0x443a('0x46')});})['then'](function(){_0x5be347['status'](0xc8)[_0x443a('0x30')]({'message':_0x443a('0x47')});})[_0x443a('0x1c')](function(_0x32aaf1){return handleError(_0x5be347,0x1f4,_0x32aaf1);});};exports[_0x443a('0x48')]=function(_0x5c824a,_0x23bf05,_0x525954){return db[_0x443a('0x3c')][_0x443a('0x1d')]({'where':{'resetPasswordToken':_0x5c824a[_0x443a('0x49')][_0x443a('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x443a('0x3f')]()}}})[_0x443a('0xc')](function(_0x441a64){if(!_0x441a64){throw new Error(_0x443a('0x4b'));}return db['Setting']['findOne']({'attributes':['id',_0x443a('0x4c'),_0x443a('0x4d'),_0x443a('0x4e')]})['then'](function(_0x36f346){if(_0x36f346[_0x443a('0x4c')])authService['validatePasswordPattern'](_0x5c824a['body'][_0x443a('0x4f')]);if(!_0x36f346[_0x443a('0x4d')]||!_0x441a64[_0x443a('0x50')])return _0x441a64;authService[_0x443a('0x51')](_0x5c824a[_0x443a('0x38')][_0x443a('0x4f')],_0x441a64[_0x443a('0x50')],_0x36f346['passwordHistoryLimit']);return _0x441a64;})[_0x443a('0xc')](function(){_0x441a64[_0x443a('0x4f')]=_0x5c824a[_0x443a('0x38')]['password'];_0x441a64[_0x443a('0x52')]=null;_0x441a64[_0x443a('0x53')]=null;return _0x441a64['save']();});})['then'](function(){_0x23bf05[_0x443a('0x54')](0xc8)[_0x443a('0x30')]({'message':_0x443a('0x55')});})['catch'](function(_0x436061){return handleError(_0x23bf05,0x1f4,_0x436061);});};passport['use'](_0x443a('0x32'),new LocalStrategy({'usernameField':'name','passwordField':_0x443a('0x4f')},function(_0x132b23,_0x4d9e6b,_0xac6983){return localAuthenticate(db[_0x443a('0x3c')],_0x132b23,_0x4d9e6b,_0xac6983);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 459b5dd..8c06001 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 _0xae82=['reset','exports','express','Router','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0x4d183d,_0x123de0){var _0x431236=function(_0x35642b){while(--_0x35642b){_0x4d183d['push'](_0x4d183d['shift']());}};_0x431236(++_0x123de0);}(_0xae82,0x12b));var _0x2ae8=function(_0x2a8c80,_0x189d4d){_0x2a8c80=_0x2a8c80-0x0;var _0x2df77f=_0xae82[_0x2a8c80];return _0x2df77f;};'use strict';var express=require(_0x2ae8('0x0'));var router=express[_0x2ae8('0x1')]();var controller=require(_0x2ae8('0x2'));router['post']('/',controller['login']);router[_0x2ae8('0x3')](_0x2ae8('0x4'),controller[_0x2ae8('0x5')]);router['post'](_0x2ae8('0x6'),controller[_0x2ae8('0x7')]);module[_0x2ae8('0x8')]=router; \ No newline at end of file +var _0xf152=['Router','./authLocal.controller','post','/forgot','reset'];(function(_0x2df286,_0x58e02d){var _0x21cac8=function(_0x9132b9){while(--_0x9132b9){_0x2df286['push'](_0x2df286['shift']());}};_0x21cac8(++_0x58e02d);}(_0xf152,0x113));var _0x2f15=function(_0x266a89,_0x1d1ace){_0x266a89=_0x266a89-0x0;var _0x1fae3e=_0xf152[_0x266a89];return _0x1fae3e;};'use strict';var express=require('express');var router=express[_0x2f15('0x0')]();var controller=require(_0x2f15('0x1'));router['post']('/',controller['login']);router[_0x2f15('0x2')](_0x2f15('0x3'),controller['forgot']);router[_0x2f15('0x2')]('/reset/:token',controller[_0x2f15('0x4')]);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 136f115..248e37d 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 _0x2ebe=['STRING','INTEGER','exports'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x2ebe,0x179));var _0xe2eb=function(_0x5cc415,_0x53e463){_0x5cc415=_0x5cc415-0x0;var _0x181315=_0x2ebe[_0x5cc415];return _0x181315;};'use strict';var Sequelize=require('sequelize');module[_0xe2eb('0x0')]={'name':{'type':Sequelize[_0xe2eb('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe2eb('0x1')]},'description':{'type':Sequelize[_0xe2eb('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe2eb('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8424=['BOOLEAN','exports','STRING'];(function(_0x26eabb,_0x4a8128){var _0x4551f=function(_0x3a7621){while(--_0x3a7621){_0x26eabb['push'](_0x26eabb['shift']());}};_0x4551f(++_0x4a8128);}(_0x8424,0x91));var _0x4842=function(_0x3ff3ad,_0x8b7555){_0x3ff3ad=_0x3ff3ad-0x0;var _0x555b3d=_0x8424[_0x3ff3ad];return _0x555b3d;};'use strict';var Sequelize=require('sequelize');module[_0x4842('0x0')]={'name':{'type':Sequelize[_0x4842('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x4842('0x1')]},'description':{'type':Sequelize[_0x4842('0x1')]},'status':{'type':Sequelize[_0x4842('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 0730097..445faa1 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 _0xe25d=['findAll','catch','show','params','Automation','create','body','find','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','rawAttributes','eml-format','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','send','index','map','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x3457b4,_0x4cd8f9){var _0xaa8fa9=function(_0x51897a){while(--_0x51897a){_0x3457b4['push'](_0x3457b4['shift']());}};_0xaa8fa9(++_0x4cd8f9);}(_0xe25d,0x15e));var _0xde25=function(_0x29769f,_0x4dbd19){_0x29769f=_0x29769f-0x0;var _0x59f8c1=_0xe25d[_0x29769f];return _0x59f8c1;};'use strict';var emlformat=require(_0xde25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde25('0x1'));var rp=require(_0xde25('0x2'));var moment=require(_0xde25('0x3'));var BPromise=require(_0xde25('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xde25('0x5'));var csv=require(_0xde25('0x6'));var ejs=require(_0xde25('0x7'));var fs=require('fs');var fs_extra=require(_0xde25('0x8'));var _=require(_0xde25('0x9'));var squel=require(_0xde25('0xa'));var crypto=require(_0xde25('0xb'));var jsforce=require(_0xde25('0xc'));var deskjs=require(_0xde25('0xd'));var toCsv=require(_0xde25('0x6'));var querystring=require('querystring');var Papa=require(_0xde25('0xe'));var Redis=require('ioredis');var authService=require(_0xde25('0xf'));var qs=require(_0xde25('0x10'));var as=require(_0xde25('0x11'));var hardwareService=require(_0xde25('0x12'));var logger=require(_0xde25('0x13'))(_0xde25('0x14'));var utils=require(_0xde25('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde25('0x16'));var db=require(_0xde25('0x17'))['db'];function respondWithStatusCode(_0x410617,_0x46d351){_0x46d351=_0x46d351||0xcc;return function(_0x27fb7c){if(_0x27fb7c){return _0x410617[_0xde25('0x18')](_0x46d351);}return _0x410617[_0xde25('0x19')](_0x46d351)[_0xde25('0x1a')]();};}function respondWithResult(_0x550b3b,_0x230783){_0x230783=_0x230783||0xc8;return function(_0x1b9edb){if(_0x1b9edb){return _0x550b3b[_0xde25('0x19')](_0x230783)[_0xde25('0x1b')](_0x1b9edb);}};}function respondWithFilteredResult(_0x306f24,_0x5a1bbc){return function(_0x520704){if(_0x520704){var _0x1bf085=typeof _0x5a1bbc[_0xde25('0x1c')]===_0xde25('0x1d')&&typeof _0x5a1bbc['limit']===_0xde25('0x1d');var _0x234c05=_0x520704['count'];var _0x214403=_0x1bf085?0x0:_0x5a1bbc[_0xde25('0x1c')];var _0xcaec43=_0x1bf085?_0x520704[_0xde25('0x1e')]:_0x5a1bbc[_0xde25('0x1c')]+_0x5a1bbc[_0xde25('0x1f')];var _0x3076fe;if(_0xcaec43>=_0x234c05){_0xcaec43=_0x234c05;_0x3076fe=0xc8;}else{_0x3076fe=0xce;}_0x306f24[_0xde25('0x19')](_0x3076fe);return _0x306f24[_0xde25('0x20')](_0xde25('0x21'),_0x214403+'-'+_0xcaec43+'/'+_0x234c05)[_0xde25('0x1b')](_0x520704);}return null;};}function patchUpdates(_0x5d8137){return function(_0x23f2c0){try{jsonpatch[_0xde25('0x22')](_0x23f2c0,_0x5d8137,!![]);}catch(_0x173e49){return BPromise[_0xde25('0x23')](_0x173e49);}return _0x23f2c0[_0xde25('0x24')]();};}function saveUpdates(_0x359f60,_0x43e8af){return function(_0x17bcc6){if(_0x17bcc6){return _0x17bcc6['update'](_0x359f60)[_0xde25('0x25')](function(_0x35bb8a){return _0x35bb8a;});}return null;};}function removeEntity(_0x5dd932,_0x463b14){return function(_0x47e0d4){if(_0x47e0d4){return _0x47e0d4[_0xde25('0x26')]()[_0xde25('0x25')](function(){_0x5dd932['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15bd97,_0x26a254){return function(_0x2f1254){if(!_0x2f1254){_0x15bd97[_0xde25('0x18')](0x194);}return _0x2f1254;};}function handleError(_0x51df56,_0x5eeb7c){_0x5eeb7c=_0x5eeb7c||0x1f4;return function(_0x44398b){logger[_0xde25('0x27')](_0x44398b['stack']);if(_0x44398b['name']){delete _0x44398b['name'];}_0x51df56[_0xde25('0x19')](_0x5eeb7c)[_0xde25('0x28')](_0x44398b);};}exports[_0xde25('0x29')]=function(_0x386a0e,_0x4022dd){var _0x125b21={},_0x39987b={},_0x506644={'count':0x0,'rows':[]};var _0x1d81f6=_[_0xde25('0x2a')](db['Automation']['rawAttributes'],function(_0x24139a){return{'name':_0x24139a[_0xde25('0x2b')],'type':_0x24139a[_0xde25('0x2c')]['key']};});_0x39987b[_0xde25('0x2d')]=_[_0xde25('0x2a')](_0x1d81f6,_0xde25('0x2e'));_0x39987b[_0xde25('0x2f')]=_[_0xde25('0x30')](_0x386a0e[_0xde25('0x2f')]);_0x39987b[_0xde25('0x31')]=_[_0xde25('0x32')](_0x39987b[_0xde25('0x2d')],_0x39987b['query']);_0x125b21[_0xde25('0x33')]=_[_0xde25('0x32')](_0x39987b['model'],qs[_0xde25('0x34')](_0x386a0e[_0xde25('0x2f')]['fields']));_0x125b21[_0xde25('0x33')]=_0x125b21[_0xde25('0x33')][_0xde25('0x35')]?_0x125b21[_0xde25('0x33')]:_0x39987b['model'];if(!_0x386a0e[_0xde25('0x2f')]['hasOwnProperty'](_0xde25('0x36'))){_0x125b21['limit']=qs[_0xde25('0x1f')](_0x386a0e[_0xde25('0x2f')][_0xde25('0x1f')]);_0x125b21['offset']=qs[_0xde25('0x1c')](_0x386a0e[_0xde25('0x2f')][_0xde25('0x1c')]);}_0x125b21[_0xde25('0x37')]=qs[_0xde25('0x38')](_0x386a0e[_0xde25('0x2f')][_0xde25('0x38')]);_0x125b21[_0xde25('0x39')]=qs['filters'](_[_0xde25('0x3a')](_0x386a0e[_0xde25('0x2f')],_0x39987b[_0xde25('0x31')]),_0x1d81f6);if(_0x386a0e['query'][_0xde25('0x3b')]){_0x125b21[_0xde25('0x39')]=_[_0xde25('0x3c')](_0x125b21[_0xde25('0x39')],{'$or':_['map'](_0x1d81f6,function(_0x4395b2){if(_0x4395b2[_0xde25('0x2c')]!==_0xde25('0x3d')){var _0x1fe8a2={};_0x1fe8a2[_0x4395b2['name']]={'$like':'%'+_0x386a0e[_0xde25('0x2f')][_0xde25('0x3b')]+'%'};return _0x1fe8a2;}})});}_0x125b21=_[_0xde25('0x3c')]({},_0x125b21,_0x386a0e[_0xde25('0x3e')]);var _0x57515b={'where':_0x125b21[_0xde25('0x39')]};return db['Automation'][_0xde25('0x1e')](_0x57515b)[_0xde25('0x25')](function(_0x526951){_0x506644['count']=_0x526951;if(_0x386a0e[_0xde25('0x2f')][_0xde25('0x3f')]){_0x125b21[_0xde25('0x40')]=[{'all':!![]}];}return db['Automation'][_0xde25('0x41')](_0x125b21);})['then'](function(_0x7a41ad){_0x506644['rows']=_0x7a41ad;return _0x506644;})['then'](respondWithFilteredResult(_0x4022dd,_0x125b21))[_0xde25('0x42')](handleError(_0x4022dd,null));};exports[_0xde25('0x43')]=function(_0xc816a,_0x4f1e82){var _0xec7b78={'raw':![],'where':{'id':_0xc816a[_0xde25('0x44')]['id']}},_0x41e766={};_0x41e766[_0xde25('0x2d')]=_[_0xde25('0x30')](db[_0xde25('0x45')]['rawAttributes']);_0x41e766[_0xde25('0x2f')]=_['keys'](_0xc816a[_0xde25('0x2f')]);_0x41e766[_0xde25('0x31')]=_[_0xde25('0x32')](_0x41e766['model'],_0x41e766[_0xde25('0x2f')]);_0xec7b78[_0xde25('0x33')]=_[_0xde25('0x32')](_0x41e766[_0xde25('0x2d')],qs[_0xde25('0x34')](_0xc816a[_0xde25('0x2f')]['fields']));_0xec7b78[_0xde25('0x33')]=_0xec7b78[_0xde25('0x33')][_0xde25('0x35')]?_0xec7b78[_0xde25('0x33')]:_0x41e766[_0xde25('0x2d')];if(_0xc816a[_0xde25('0x2f')][_0xde25('0x3f')]){_0xec7b78[_0xde25('0x40')]=[{'all':!![]}];}_0xec7b78=_[_0xde25('0x3c')]({},_0xec7b78,_0xc816a['options']);return db[_0xde25('0x45')]['find'](_0xec7b78)[_0xde25('0x25')](handleEntityNotFound(_0x4f1e82,null))[_0xde25('0x25')](respondWithResult(_0x4f1e82,null))[_0xde25('0x42')](handleError(_0x4f1e82,null));};exports['create']=function(_0xef0867,_0x5845e0){return db['Automation'][_0xde25('0x46')](_0xef0867[_0xde25('0x47')],{})[_0xde25('0x25')](respondWithResult(_0x5845e0,0xc9))[_0xde25('0x42')](handleError(_0x5845e0,null));};exports['update']=function(_0x463708,_0x361350){if(_0x463708['body']['id']){delete _0x463708['body']['id'];}return db['Automation']['find']({'where':{'id':_0x463708[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0x361350,null))[_0xde25('0x25')](saveUpdates(_0x463708['body'],null))['then'](respondWithResult(_0x361350,null))[_0xde25('0x42')](handleError(_0x361350,null));};exports[_0xde25('0x26')]=function(_0x1f214e,_0x180ecf){return db[_0xde25('0x45')][_0xde25('0x48')]({'where':{'id':_0x1f214e[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0x180ecf,null))[_0xde25('0x25')](removeEntity(_0x180ecf,null))[_0xde25('0x42')](handleError(_0x180ecf,null));};exports['addConditions']=function(_0x29235e,_0x3e5b4e,_0x9f3101){return db[_0xde25('0x49')][_0xde25('0x48')]({'where':{'id':_0x29235e[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0x3e5b4e,null))[_0xde25('0x25')](function(_0xef33c5){if(_0xef33c5){return _0xef33c5['addConditions'](_0x29235e[_0xde25('0x47')][_0xde25('0x4a')],_[_0xde25('0x4b')](_0x29235e['body'],[_0xde25('0x4a'),'id'])||{});}})['then'](respondWithResult(_0x3e5b4e,null))[_0xde25('0x42')](handleError(_0x3e5b4e,null));};exports[_0xde25('0x4c')]=function(_0x17274b,_0x1c5fb1,_0x7a3722){var _0xfd2f89={};var _0x5ee507={};var _0xa4da34;var _0x2f88fe;return db[_0xde25('0x45')][_0xde25('0x4d')]({'where':{'id':_0x17274b[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0x1c5fb1,null))['then'](function(_0x2ccab6){if(_0x2ccab6){_0xa4da34=_0x2ccab6;_0x5ee507[_0xde25('0x2d')]=_[_0xde25('0x30')](db[_0xde25('0x49')]['rawAttributes']);_0x5ee507[_0xde25('0x2f')]=_[_0xde25('0x30')](_0x17274b[_0xde25('0x2f')]);_0x5ee507[_0xde25('0x31')]=_[_0xde25('0x32')](_0x5ee507[_0xde25('0x2d')],_0x5ee507['query']);_0xfd2f89[_0xde25('0x33')]=_[_0xde25('0x32')](_0x5ee507[_0xde25('0x2d')],qs[_0xde25('0x34')](_0x17274b['query'][_0xde25('0x34')]));_0xfd2f89[_0xde25('0x33')]=_0xfd2f89[_0xde25('0x33')][_0xde25('0x35')]?_0xfd2f89[_0xde25('0x33')]:_0x5ee507[_0xde25('0x2d')];_0xfd2f89[_0xde25('0x37')]=qs['sort'](_0x17274b[_0xde25('0x2f')][_0xde25('0x38')]);_0xfd2f89[_0xde25('0x39')]=qs[_0xde25('0x31')](_['pick'](_0x17274b[_0xde25('0x2f')],_0x5ee507[_0xde25('0x31')]));if(_0x17274b[_0xde25('0x2f')][_0xde25('0x3b')]){_0xfd2f89[_0xde25('0x39')]=_[_0xde25('0x3c')](_0xfd2f89[_0xde25('0x39')],{'$or':_[_0xde25('0x2a')](_0xfd2f89[_0xde25('0x33')],function(_0x545b66){var _0x4ee67f={};_0x4ee67f[_0x545b66]={'$like':'%'+_0x17274b[_0xde25('0x2f')][_0xde25('0x3b')]+'%'};return _0x4ee67f;})});}_0xfd2f89=_['merge']({},_0xfd2f89,_0x17274b[_0xde25('0x3e')]);return _0xa4da34[_0xde25('0x4c')](_0xfd2f89);}})[_0xde25('0x25')](function(_0x55e6a0){if(_0x55e6a0){_0x2f88fe=_0x55e6a0[_0xde25('0x35')];if(!_0x17274b[_0xde25('0x2f')][_0xde25('0x4e')](_0xde25('0x36'))){_0xfd2f89[_0xde25('0x1f')]=qs[_0xde25('0x1f')](_0x17274b[_0xde25('0x2f')][_0xde25('0x1f')]);_0xfd2f89['offset']=qs[_0xde25('0x1c')](_0x17274b[_0xde25('0x2f')][_0xde25('0x1c')]);}return _0xa4da34[_0xde25('0x4c')](_0xfd2f89);}})[_0xde25('0x25')](function(_0x2c1600){if(_0x2c1600){return _0x2c1600?{'count':_0x2f88fe,'rows':_0x2c1600}:null;}})[_0xde25('0x25')](respondWithResult(_0x1c5fb1,null))[_0xde25('0x42')](handleError(_0x1c5fb1,null));};exports[_0xde25('0x4f')]=function(_0x598bdf,_0x532bc2,_0x3a5aba){return db[_0xde25('0x50')][_0xde25('0x48')]({'where':{'id':_0x598bdf[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0x532bc2,null))[_0xde25('0x25')](function(_0x419ce1){if(_0x419ce1){return _0x419ce1[_0xde25('0x4f')](_0x598bdf['body'][_0xde25('0x4a')],_[_0xde25('0x4b')](_0x598bdf[_0xde25('0x47')],[_0xde25('0x4a'),'id'])||{});}})[_0xde25('0x25')](respondWithResult(_0x532bc2,null))['catch'](handleError(_0x532bc2,null));};exports[_0xde25('0x51')]=function(_0x48bd05,_0xeef146,_0x7b5613){var _0x27fa5b={};var _0x4c8d1a={};var _0x583bc0;var _0x3a5a4d;return db[_0xde25('0x45')]['findOne']({'where':{'id':_0x48bd05[_0xde25('0x44')]['id']}})[_0xde25('0x25')](handleEntityNotFound(_0xeef146,null))[_0xde25('0x25')](function(_0x2508f7){if(_0x2508f7){_0x583bc0=_0x2508f7;_0x4c8d1a[_0xde25('0x2d')]=_['keys'](db[_0xde25('0x50')][_0xde25('0x52')]);_0x4c8d1a[_0xde25('0x2f')]=_[_0xde25('0x30')](_0x48bd05[_0xde25('0x2f')]);_0x4c8d1a[_0xde25('0x31')]=_[_0xde25('0x32')](_0x4c8d1a[_0xde25('0x2d')],_0x4c8d1a[_0xde25('0x2f')]);_0x27fa5b[_0xde25('0x33')]=_[_0xde25('0x32')](_0x4c8d1a[_0xde25('0x2d')],qs[_0xde25('0x34')](_0x48bd05[_0xde25('0x2f')][_0xde25('0x34')]));_0x27fa5b['attributes']=_0x27fa5b[_0xde25('0x33')][_0xde25('0x35')]?_0x27fa5b[_0xde25('0x33')]:_0x4c8d1a['model'];_0x27fa5b[_0xde25('0x37')]=qs[_0xde25('0x38')](_0x48bd05[_0xde25('0x2f')]['sort']);_0x27fa5b[_0xde25('0x39')]=qs[_0xde25('0x31')](_[_0xde25('0x3a')](_0x48bd05[_0xde25('0x2f')],_0x4c8d1a['filters']));if(_0x48bd05[_0xde25('0x2f')][_0xde25('0x3b')]){_0x27fa5b[_0xde25('0x39')]=_[_0xde25('0x3c')](_0x27fa5b[_0xde25('0x39')],{'$or':_[_0xde25('0x2a')](_0x27fa5b['attributes'],function(_0xc6f809){var _0x49abb2={};_0x49abb2[_0xc6f809]={'$like':'%'+_0x48bd05['query'][_0xde25('0x3b')]+'%'};return _0x49abb2;})});}_0x27fa5b=_[_0xde25('0x3c')]({},_0x27fa5b,_0x48bd05[_0xde25('0x3e')]);return _0x583bc0[_0xde25('0x51')](_0x27fa5b);}})[_0xde25('0x25')](function(_0x32de96){if(_0x32de96){_0x3a5a4d=_0x32de96[_0xde25('0x35')];if(!_0x48bd05[_0xde25('0x2f')]['hasOwnProperty'](_0xde25('0x36'))){_0x27fa5b[_0xde25('0x1f')]=qs[_0xde25('0x1f')](_0x48bd05[_0xde25('0x2f')][_0xde25('0x1f')]);_0x27fa5b[_0xde25('0x1c')]=qs[_0xde25('0x1c')](_0x48bd05[_0xde25('0x2f')][_0xde25('0x1c')]);}return _0x583bc0[_0xde25('0x51')](_0x27fa5b);}})['then'](function(_0x3041c2){if(_0x3041c2){return _0x3041c2?{'count':_0x3a5a4d,'rows':_0x3041c2}:null;}})[_0xde25('0x25')](respondWithResult(_0xeef146,null))[_0xde25('0x42')](handleError(_0xeef146,null));}; \ No newline at end of file +var _0x48eb=['Action','getActions','hasOwnProperty','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','destroy','then','error','stack','name','send','index','map','Automation','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','ids','omit','findOne','pick','addActions'];(function(_0x47b462,_0x4e6b2a){var _0x499df8=function(_0xf4d461){while(--_0xf4d461){_0x47b462['push'](_0x47b462['shift']());}};_0x499df8(++_0x4e6b2a);}(_0x48eb,0x147));var _0xb48e=function(_0x806186,_0x4d66ee){_0x806186=_0x806186-0x0;var _0x58ebb6=_0x48eb[_0x806186];return _0x58ebb6;};'use strict';var emlformat=require(_0xb48e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb48e('0x1'));var BPromise=require(_0xb48e('0x2'));var Mustache=require(_0xb48e('0x3'));var util=require(_0xb48e('0x4'));var path=require(_0xb48e('0x5'));var sox=require(_0xb48e('0x6'));var csv=require(_0xb48e('0x7'));var ejs=require(_0xb48e('0x8'));var fs=require('fs');var fs_extra=require(_0xb48e('0x9'));var _=require(_0xb48e('0xa'));var squel=require(_0xb48e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb48e('0x7'));var querystring=require(_0xb48e('0xc'));var Papa=require(_0xb48e('0xd'));var Redis=require('ioredis');var authService=require(_0xb48e('0xe'));var qs=require(_0xb48e('0xf'));var as=require(_0xb48e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb48e('0x11'))(_0xb48e('0x12'));var utils=require(_0xb48e('0x13'));var config=require(_0xb48e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb48e('0x15'))['db'];function respondWithStatusCode(_0x318e91,_0x1c1d31){_0x1c1d31=_0x1c1d31||0xcc;return function(_0x71229b){if(_0x71229b){return _0x318e91[_0xb48e('0x16')](_0x1c1d31);}return _0x318e91[_0xb48e('0x17')](_0x1c1d31)[_0xb48e('0x18')]();};}function respondWithResult(_0x2dfcd5,_0x4d7eba){_0x4d7eba=_0x4d7eba||0xc8;return function(_0x147969){if(_0x147969){return _0x2dfcd5[_0xb48e('0x17')](_0x4d7eba)[_0xb48e('0x19')](_0x147969);}};}function respondWithFilteredResult(_0x4f35be,_0x59cefb){return function(_0x2cea40){if(_0x2cea40){var _0x59143a=typeof _0x59cefb[_0xb48e('0x1a')]==='undefined'&&typeof _0x59cefb[_0xb48e('0x1b')]===_0xb48e('0x1c');var _0x5a8f0d=_0x2cea40[_0xb48e('0x1d')];var _0x2f4d66=_0x59143a?0x0:_0x59cefb['offset'];var _0x2a8dd6=_0x59143a?_0x2cea40['count']:_0x59cefb[_0xb48e('0x1a')]+_0x59cefb[_0xb48e('0x1b')];var _0x43cda6;if(_0x2a8dd6>=_0x5a8f0d){_0x2a8dd6=_0x5a8f0d;_0x43cda6=0xc8;}else{_0x43cda6=0xce;}_0x4f35be['status'](_0x43cda6);return _0x4f35be[_0xb48e('0x1e')]('Content-Range',_0x2f4d66+'-'+_0x2a8dd6+'/'+_0x5a8f0d)[_0xb48e('0x19')](_0x2cea40);}return null;};}function patchUpdates(_0x2b17b5){return function(_0x6ae8af){try{jsonpatch[_0xb48e('0x1f')](_0x6ae8af,_0x2b17b5,!![]);}catch(_0x2b0980){return BPromise['reject'](_0x2b0980);}return _0x6ae8af[_0xb48e('0x20')]();};}function saveUpdates(_0x42b32f,_0x1b3357){return function(_0x37830b){if(_0x37830b){return _0x37830b[_0xb48e('0x21')](_0x42b32f)['then'](function(_0x25583f){return _0x25583f;});}return null;};}function removeEntity(_0x1ad179,_0x5300da){return function(_0x508c49){if(_0x508c49){return _0x508c49[_0xb48e('0x22')]()[_0xb48e('0x23')](function(){_0x1ad179['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1387d7,_0x506506){return function(_0x40d425){if(!_0x40d425){_0x1387d7[_0xb48e('0x16')](0x194);}return _0x40d425;};}function handleError(_0x31fa4b,_0x40db84){_0x40db84=_0x40db84||0x1f4;return function(_0x3e10b2){logger[_0xb48e('0x24')](_0x3e10b2[_0xb48e('0x25')]);if(_0x3e10b2['name']){delete _0x3e10b2[_0xb48e('0x26')];}_0x31fa4b[_0xb48e('0x17')](_0x40db84)[_0xb48e('0x27')](_0x3e10b2);};}exports[_0xb48e('0x28')]=function(_0x54a5b7,_0x69b15a){var _0x174a55={},_0x3293d7={},_0x4a95c1={'count':0x0,'rows':[]};var _0x54c3ad=_[_0xb48e('0x29')](db[_0xb48e('0x2a')]['rawAttributes'],function(_0x40fcc9){return{'name':_0x40fcc9[_0xb48e('0x2b')],'type':_0x40fcc9[_0xb48e('0x2c')][_0xb48e('0x2d')]};});_0x3293d7['model']=_[_0xb48e('0x29')](_0x54c3ad,_0xb48e('0x26'));_0x3293d7[_0xb48e('0x2e')]=_[_0xb48e('0x2f')](_0x54a5b7[_0xb48e('0x2e')]);_0x3293d7[_0xb48e('0x30')]=_[_0xb48e('0x31')](_0x3293d7[_0xb48e('0x32')],_0x3293d7['query']);_0x174a55[_0xb48e('0x33')]=_[_0xb48e('0x31')](_0x3293d7[_0xb48e('0x32')],qs['fields'](_0x54a5b7[_0xb48e('0x2e')][_0xb48e('0x34')]));_0x174a55[_0xb48e('0x33')]=_0x174a55[_0xb48e('0x33')][_0xb48e('0x35')]?_0x174a55['attributes']:_0x3293d7[_0xb48e('0x32')];if(!_0x54a5b7['query']['hasOwnProperty'](_0xb48e('0x36'))){_0x174a55[_0xb48e('0x1b')]=qs[_0xb48e('0x1b')](_0x54a5b7['query'][_0xb48e('0x1b')]);_0x174a55[_0xb48e('0x1a')]=qs['offset'](_0x54a5b7[_0xb48e('0x2e')][_0xb48e('0x1a')]);}_0x174a55[_0xb48e('0x37')]=qs[_0xb48e('0x38')](_0x54a5b7[_0xb48e('0x2e')]['sort']);_0x174a55['where']=qs[_0xb48e('0x30')](_['pick'](_0x54a5b7[_0xb48e('0x2e')],_0x3293d7[_0xb48e('0x30')]),_0x54c3ad);if(_0x54a5b7[_0xb48e('0x2e')][_0xb48e('0x39')]){_0x174a55['where']=_[_0xb48e('0x3a')](_0x174a55['where'],{'$or':_[_0xb48e('0x29')](_0x54c3ad,function(_0x3cafee){if(_0x3cafee['type']!==_0xb48e('0x3b')){var _0x545278={};_0x545278[_0x3cafee[_0xb48e('0x26')]]={'$like':'%'+_0x54a5b7['query'][_0xb48e('0x39')]+'%'};return _0x545278;}})});}_0x174a55=_[_0xb48e('0x3a')]({},_0x174a55,_0x54a5b7['options']);var _0x1d3567={'where':_0x174a55[_0xb48e('0x3c')]};return db[_0xb48e('0x2a')]['count'](_0x1d3567)['then'](function(_0x5ea951){_0x4a95c1[_0xb48e('0x1d')]=_0x5ea951;if(_0x54a5b7[_0xb48e('0x2e')][_0xb48e('0x3d')]){_0x174a55[_0xb48e('0x3e')]=[{'all':!![]}];}return db[_0xb48e('0x2a')][_0xb48e('0x3f')](_0x174a55);})[_0xb48e('0x23')](function(_0x2fac70){_0x4a95c1[_0xb48e('0x40')]=_0x2fac70;return _0x4a95c1;})['then'](respondWithFilteredResult(_0x69b15a,_0x174a55))[_0xb48e('0x41')](handleError(_0x69b15a,null));};exports[_0xb48e('0x42')]=function(_0x1615ef,_0x36a5da){var _0x1e9385={'raw':![],'where':{'id':_0x1615ef[_0xb48e('0x43')]['id']}},_0x54dd98={};_0x54dd98[_0xb48e('0x32')]=_['keys'](db[_0xb48e('0x2a')][_0xb48e('0x44')]);_0x54dd98[_0xb48e('0x2e')]=_[_0xb48e('0x2f')](_0x1615ef[_0xb48e('0x2e')]);_0x54dd98[_0xb48e('0x30')]=_[_0xb48e('0x31')](_0x54dd98['model'],_0x54dd98['query']);_0x1e9385[_0xb48e('0x33')]=_['intersection'](_0x54dd98['model'],qs[_0xb48e('0x34')](_0x1615ef[_0xb48e('0x2e')]['fields']));_0x1e9385[_0xb48e('0x33')]=_0x1e9385[_0xb48e('0x33')][_0xb48e('0x35')]?_0x1e9385['attributes']:_0x54dd98[_0xb48e('0x32')];if(_0x1615ef[_0xb48e('0x2e')][_0xb48e('0x3d')]){_0x1e9385[_0xb48e('0x3e')]=[{'all':!![]}];}_0x1e9385=_[_0xb48e('0x3a')]({},_0x1e9385,_0x1615ef[_0xb48e('0x45')]);return db[_0xb48e('0x2a')][_0xb48e('0x46')](_0x1e9385)[_0xb48e('0x23')](handleEntityNotFound(_0x36a5da,null))[_0xb48e('0x23')](respondWithResult(_0x36a5da,null))['catch'](handleError(_0x36a5da,null));};exports[_0xb48e('0x47')]=function(_0x21cd08,_0x4c9c68){return db['Automation']['create'](_0x21cd08[_0xb48e('0x48')],{})[_0xb48e('0x23')](respondWithResult(_0x4c9c68,0xc9))[_0xb48e('0x41')](handleError(_0x4c9c68,null));};exports[_0xb48e('0x21')]=function(_0x39bb17,_0x5ba233){if(_0x39bb17[_0xb48e('0x48')]['id']){delete _0x39bb17[_0xb48e('0x48')]['id'];}return db[_0xb48e('0x2a')][_0xb48e('0x46')]({'where':{'id':_0x39bb17[_0xb48e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ba233,null))[_0xb48e('0x23')](saveUpdates(_0x39bb17[_0xb48e('0x48')],null))[_0xb48e('0x23')](respondWithResult(_0x5ba233,null))[_0xb48e('0x41')](handleError(_0x5ba233,null));};exports[_0xb48e('0x22')]=function(_0x981bc3,_0x4d3a37){return db[_0xb48e('0x2a')][_0xb48e('0x46')]({'where':{'id':_0x981bc3['params']['id']}})[_0xb48e('0x23')](handleEntityNotFound(_0x4d3a37,null))[_0xb48e('0x23')](removeEntity(_0x4d3a37,null))[_0xb48e('0x41')](handleError(_0x4d3a37,null));};exports['addConditions']=function(_0x24741b,_0x4e83bb,_0x1da976){return db['Condition'][_0xb48e('0x46')]({'where':{'id':_0x24741b[_0xb48e('0x43')]['id']}})[_0xb48e('0x23')](handleEntityNotFound(_0x4e83bb,null))['then'](function(_0x1366e8){if(_0x1366e8){return _0x1366e8['addConditions'](_0x24741b[_0xb48e('0x48')][_0xb48e('0x49')],_[_0xb48e('0x4a')](_0x24741b[_0xb48e('0x48')],[_0xb48e('0x49'),'id'])||{});}})[_0xb48e('0x23')](respondWithResult(_0x4e83bb,null))[_0xb48e('0x41')](handleError(_0x4e83bb,null));};exports['getConditions']=function(_0x519e00,_0x54ea51,_0xc3ec38){var _0x716f47={};var _0x4599a8={};var _0x1ea2b8;var _0x141b33;return db['Automation'][_0xb48e('0x4b')]({'where':{'id':_0x519e00[_0xb48e('0x43')]['id']}})[_0xb48e('0x23')](handleEntityNotFound(_0x54ea51,null))[_0xb48e('0x23')](function(_0x45e457){if(_0x45e457){_0x1ea2b8=_0x45e457;_0x4599a8[_0xb48e('0x32')]=_[_0xb48e('0x2f')](db['Condition']['rawAttributes']);_0x4599a8[_0xb48e('0x2e')]=_[_0xb48e('0x2f')](_0x519e00[_0xb48e('0x2e')]);_0x4599a8[_0xb48e('0x30')]=_[_0xb48e('0x31')](_0x4599a8['model'],_0x4599a8[_0xb48e('0x2e')]);_0x716f47['attributes']=_[_0xb48e('0x31')](_0x4599a8['model'],qs[_0xb48e('0x34')](_0x519e00[_0xb48e('0x2e')][_0xb48e('0x34')]));_0x716f47[_0xb48e('0x33')]=_0x716f47[_0xb48e('0x33')][_0xb48e('0x35')]?_0x716f47['attributes']:_0x4599a8[_0xb48e('0x32')];_0x716f47[_0xb48e('0x37')]=qs['sort'](_0x519e00[_0xb48e('0x2e')][_0xb48e('0x38')]);_0x716f47[_0xb48e('0x3c')]=qs[_0xb48e('0x30')](_[_0xb48e('0x4c')](_0x519e00[_0xb48e('0x2e')],_0x4599a8[_0xb48e('0x30')]));if(_0x519e00[_0xb48e('0x2e')][_0xb48e('0x39')]){_0x716f47['where']=_[_0xb48e('0x3a')](_0x716f47['where'],{'$or':_[_0xb48e('0x29')](_0x716f47['attributes'],function(_0x2972cd){var _0x32daff={};_0x32daff[_0x2972cd]={'$like':'%'+_0x519e00[_0xb48e('0x2e')][_0xb48e('0x39')]+'%'};return _0x32daff;})});}_0x716f47=_[_0xb48e('0x3a')]({},_0x716f47,_0x519e00[_0xb48e('0x45')]);return _0x1ea2b8['getConditions'](_0x716f47);}})[_0xb48e('0x23')](function(_0x4beec0){if(_0x4beec0){_0x141b33=_0x4beec0[_0xb48e('0x35')];if(!_0x519e00[_0xb48e('0x2e')]['hasOwnProperty'](_0xb48e('0x36'))){_0x716f47[_0xb48e('0x1b')]=qs[_0xb48e('0x1b')](_0x519e00['query'][_0xb48e('0x1b')]);_0x716f47[_0xb48e('0x1a')]=qs[_0xb48e('0x1a')](_0x519e00[_0xb48e('0x2e')]['offset']);}return _0x1ea2b8['getConditions'](_0x716f47);}})[_0xb48e('0x23')](function(_0x5bd9c9){if(_0x5bd9c9){return _0x5bd9c9?{'count':_0x141b33,'rows':_0x5bd9c9}:null;}})[_0xb48e('0x23')](respondWithResult(_0x54ea51,null))[_0xb48e('0x41')](handleError(_0x54ea51,null));};exports[_0xb48e('0x4d')]=function(_0x259c2a,_0x21730a,_0x4d76ae){return db[_0xb48e('0x4e')][_0xb48e('0x46')]({'where':{'id':_0x259c2a[_0xb48e('0x43')]['id']}})['then'](handleEntityNotFound(_0x21730a,null))['then'](function(_0x5d2694){if(_0x5d2694){return _0x5d2694['addActions'](_0x259c2a[_0xb48e('0x48')][_0xb48e('0x49')],_[_0xb48e('0x4a')](_0x259c2a[_0xb48e('0x48')],[_0xb48e('0x49'),'id'])||{});}})[_0xb48e('0x23')](respondWithResult(_0x21730a,null))[_0xb48e('0x41')](handleError(_0x21730a,null));};exports[_0xb48e('0x4f')]=function(_0x4b77e4,_0x13c66b,_0x40285e){var _0x3cf292={};var _0x1875e4={};var _0xa745ab;var _0xc86993;return db['Automation'][_0xb48e('0x4b')]({'where':{'id':_0x4b77e4[_0xb48e('0x43')]['id']}})[_0xb48e('0x23')](handleEntityNotFound(_0x13c66b,null))['then'](function(_0x2350ca){if(_0x2350ca){_0xa745ab=_0x2350ca;_0x1875e4['model']=_[_0xb48e('0x2f')](db[_0xb48e('0x4e')]['rawAttributes']);_0x1875e4[_0xb48e('0x2e')]=_[_0xb48e('0x2f')](_0x4b77e4['query']);_0x1875e4[_0xb48e('0x30')]=_[_0xb48e('0x31')](_0x1875e4[_0xb48e('0x32')],_0x1875e4[_0xb48e('0x2e')]);_0x3cf292[_0xb48e('0x33')]=_[_0xb48e('0x31')](_0x1875e4[_0xb48e('0x32')],qs[_0xb48e('0x34')](_0x4b77e4['query'][_0xb48e('0x34')]));_0x3cf292['attributes']=_0x3cf292[_0xb48e('0x33')][_0xb48e('0x35')]?_0x3cf292[_0xb48e('0x33')]:_0x1875e4[_0xb48e('0x32')];_0x3cf292[_0xb48e('0x37')]=qs['sort'](_0x4b77e4[_0xb48e('0x2e')][_0xb48e('0x38')]);_0x3cf292[_0xb48e('0x3c')]=qs[_0xb48e('0x30')](_[_0xb48e('0x4c')](_0x4b77e4['query'],_0x1875e4[_0xb48e('0x30')]));if(_0x4b77e4[_0xb48e('0x2e')]['filter']){_0x3cf292[_0xb48e('0x3c')]=_['merge'](_0x3cf292[_0xb48e('0x3c')],{'$or':_[_0xb48e('0x29')](_0x3cf292['attributes'],function(_0x117278){var _0x489304={};_0x489304[_0x117278]={'$like':'%'+_0x4b77e4[_0xb48e('0x2e')][_0xb48e('0x39')]+'%'};return _0x489304;})});}_0x3cf292=_[_0xb48e('0x3a')]({},_0x3cf292,_0x4b77e4['options']);return _0xa745ab['getActions'](_0x3cf292);}})[_0xb48e('0x23')](function(_0x450b51){if(_0x450b51){_0xc86993=_0x450b51[_0xb48e('0x35')];if(!_0x4b77e4['query'][_0xb48e('0x50')](_0xb48e('0x36'))){_0x3cf292['limit']=qs[_0xb48e('0x1b')](_0x4b77e4[_0xb48e('0x2e')][_0xb48e('0x1b')]);_0x3cf292['offset']=qs['offset'](_0x4b77e4['query'][_0xb48e('0x1a')]);}return _0xa745ab['getActions'](_0x3cf292);}})['then'](function(_0x59dcb5){if(_0x59dcb5){return _0x59dcb5?{'count':_0xc86993,'rows':_0x59dcb5}:null;}})[_0xb48e('0x23')](respondWithResult(_0x13c66b,null))['catch'](handleError(_0x13c66b,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 66528db..af23adc 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 _0x9f24=['path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x9f24,0xd7));var _0x49f2=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x9f24[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x49f2('0x0'));var util=require(_0x49f2('0x1'));var logger=require(_0x49f2('0x2'))('api');var moment=require(_0x49f2('0x3'));var BPromise=require(_0x49f2('0x4'));var rp=require(_0x49f2('0x5'));var fs=require('fs');var path=require(_0x49f2('0x6'));var rimraf=require(_0x49f2('0x7'));var config=require(_0x49f2('0x8'));var attributes=require(_0x49f2('0x9'));module[_0x49f2('0xa')]=function(_0x5c64a1,_0x3bffde){return _0x5c64a1[_0x49f2('0xb')](_0x49f2('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40da=['exports','Automation','tools_automations','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./automation.attributes'];(function(_0x50a470,_0x313881){var _0x2eac77=function(_0x5e896e){while(--_0x5e896e){_0x50a470['push'](_0x50a470['shift']());}};_0x2eac77(++_0x313881);}(_0x40da,0xf3));var _0xa40d=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x40da[_0x82129b];return _0x2ae5dc;};'use strict';var _=require(_0xa40d('0x0'));var util=require(_0xa40d('0x1'));var logger=require(_0xa40d('0x2'))('api');var moment=require(_0xa40d('0x3'));var BPromise=require(_0xa40d('0x4'));var rp=require(_0xa40d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa40d('0x6'));var config=require(_0xa40d('0x7'));var attributes=require(_0xa40d('0x8'));module[_0xa40d('0x9')]=function(_0x3950b0,_0x144438){return _0x3950b0['define'](_0xa40d('0xa'),attributes,{'tableName':_0xa40d('0xb'),'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 8589a63..7c2c514 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 _0xc373=['../../config/environment','jayson/promise','request','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5ba011,_0x288db3){var _0x39b0cd=function(_0x3b4848){while(--_0x3b4848){_0x5ba011['push'](_0x5ba011['shift']());}};_0x39b0cd(++_0x288db3);}(_0xc373,0x1c7));var _0x3c37=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0xc373[_0x16cb03];return _0x10944e;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var moment=require(_0x3c37('0x1'));var BPromise=require(_0x3c37('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c37('0x3'))['db'];var utils=require(_0x3c37('0x4'));var logger=require(_0x3c37('0x5'))(_0x3c37('0x6'));var config=require(_0x3c37('0x7'));var jayson=require(_0x3c37('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1941,_0x1244e6,_0x14b09d){return new BPromise(function(_0x10617,_0x465de6){return client[_0x3c37('0x9')](_0x2e1941,_0x14b09d)[_0x3c37('0xa')](function(_0x59d4f9){logger[_0x3c37('0xb')]('Automation,\x20%s,\x20%s',_0x1244e6,'request\x20sent');logger[_0x3c37('0xc')](_0x3c37('0xd'),_0x1244e6,_0x3c37('0xe'),JSON[_0x3c37('0xf')](_0x59d4f9));if(_0x59d4f9[_0x3c37('0x10')]){if(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x11')]===0x1f4){logger['error'](_0x3c37('0x12'),_0x1244e6,_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);return _0x465de6(_0x59d4f9['error']['message']);}logger[_0x3c37('0x10')]('Automation,\x20%s,\x20%s',_0x1244e6,_0x59d4f9['error'][_0x3c37('0x13')]);return _0x10617(_0x59d4f9[_0x3c37('0x10')][_0x3c37('0x13')]);}else{logger[_0x3c37('0xb')](_0x3c37('0x12'),_0x1244e6,_0x3c37('0xe'));_0x10617(_0x59d4f9[_0x3c37('0x14')][_0x3c37('0x13')]);}})[_0x3c37('0x15')](function(_0x4e1560){logger[_0x3c37('0x10')](_0x3c37('0x12'),_0x1244e6,_0x4e1560);_0x465de6(_0x4e1560);});});} \ No newline at end of file +var _0x91b6=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x25ee76,_0x6535a3){var _0x392a09=function(_0x41a342){while(--_0x41a342){_0x25ee76['push'](_0x25ee76['shift']());}};_0x392a09(++_0x6535a3);}(_0x91b6,0x18b));var _0x691b=function(_0x5563d2,_0x40ec1a){_0x5563d2=_0x5563d2-0x0;var _0x276409=_0x91b6[_0x5563d2];return _0x276409;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var moment=require('moment');var BPromise=require(_0x691b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x691b('0x3'))['db'];var utils=require(_0x691b('0x4'));var logger=require(_0x691b('0x5'))(_0x691b('0x6'));var config=require(_0x691b('0x7'));var jayson=require(_0x691b('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x448027,_0x1ebd9c,_0x4ff18c){return new BPromise(function(_0x223632,_0xceca6a){return client[_0x691b('0x9')](_0x448027,_0x4ff18c)[_0x691b('0xa')](function(_0xbd8767){logger[_0x691b('0xb')](_0x691b('0xc'),_0x1ebd9c,_0x691b('0xd'));logger['debug'](_0x691b('0xe'),_0x1ebd9c,_0x691b('0xd'),JSON[_0x691b('0xf')](_0xbd8767));if(_0xbd8767[_0x691b('0x10')]){if(_0xbd8767[_0x691b('0x10')][_0x691b('0x11')]===0x1f4){logger['error'](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0xceca6a(_0xbd8767[_0x691b('0x10')]['message']);}logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);return _0x223632(_0xbd8767[_0x691b('0x10')][_0x691b('0x12')]);}else{logger[_0x691b('0xb')]('Automation,\x20%s,\x20%s',_0x1ebd9c,_0x691b('0xd'));_0x223632(_0xbd8767['result'][_0x691b('0x12')]);}})[_0x691b('0x13')](function(_0x2e4f84){logger[_0x691b('0x10')](_0x691b('0xc'),_0x1ebd9c,_0x2e4f84);_0xceca6a(_0x2e4f84);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 86089b4..4b1e8b4 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 _0x10bd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','post','create','addConditions','/:id/actions','addActions','update','delete','destroy','util','connect-timeout','express'];(function(_0x35ab34,_0x273111){var _0x6203d7=function(_0x55c4ef){while(--_0x55c4ef){_0x35ab34['push'](_0x35ab34['shift']());}};_0x6203d7(++_0x273111);}(_0x10bd,0x97));var _0xd10b=function(_0xd24f28,_0x3f6a75){_0xd24f28=_0xd24f28-0x0;var _0x4d8ce9=_0x10bd[_0xd24f28];return _0x4d8ce9;};'use strict';var multer=require('multer');var util=require(_0xd10b('0x0'));var path=require('path');var timeout=require(_0xd10b('0x1'));var express=require(_0xd10b('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd10b('0x3'));var interaction=require(_0xd10b('0x4'));var config=require(_0xd10b('0x5'));var controller=require(_0xd10b('0x6'));router['get']('/',auth[_0xd10b('0x7')](),controller[_0xd10b('0x8')]);router[_0xd10b('0x9')](_0xd10b('0xa'),auth[_0xd10b('0x7')](),controller[_0xd10b('0xb')]);router[_0xd10b('0x9')](_0xd10b('0xc'),auth[_0xd10b('0x7')](),controller[_0xd10b('0xd')]);router[_0xd10b('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0xd10b('0xe')]('/',auth['isAuthenticated'](),controller[_0xd10b('0xf')]);router['post'](_0xd10b('0xc'),auth[_0xd10b('0x7')](),controller[_0xd10b('0x10')]);router['post'](_0xd10b('0x11'),auth[_0xd10b('0x7')](),controller[_0xd10b('0x12')]);router['put'](_0xd10b('0xa'),auth[_0xd10b('0x7')](),controller[_0xd10b('0x13')]);router[_0xd10b('0x14')](_0xd10b('0xa'),auth[_0xd10b('0x7')](),controller[_0xd10b('0x15')]);module['exports']=router; \ No newline at end of file +var _0x32ff=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','post','addConditions','addActions','put','update','delete','destroy','exports','multer'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x32ff,0xc7));var _0xf32f=function(_0x241e09,_0x5ccd1d){_0x241e09=_0x241e09-0x0;var _0x592098=_0x32ff[_0x241e09];return _0x592098;};'use strict';var multer=require(_0xf32f('0x0'));var util=require(_0xf32f('0x1'));var path=require(_0xf32f('0x2'));var timeout=require(_0xf32f('0x3'));var express=require(_0xf32f('0x4'));var router=express[_0xf32f('0x5')]();var fs_extra=require(_0xf32f('0x6'));var auth=require(_0xf32f('0x7'));var interaction=require(_0xf32f('0x8'));var config=require(_0xf32f('0x9'));var controller=require(_0xf32f('0xa'));router[_0xf32f('0xb')]('/',auth[_0xf32f('0xc')](),controller['index']);router[_0xf32f('0xb')]('/:id',auth[_0xf32f('0xc')](),controller[_0xf32f('0xd')]);router[_0xf32f('0xb')](_0xf32f('0xe'),auth[_0xf32f('0xc')](),controller[_0xf32f('0xf')]);router[_0xf32f('0xb')](_0xf32f('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0xf32f('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf32f('0x11')](_0xf32f('0xe'),auth[_0xf32f('0xc')](),controller[_0xf32f('0x12')]);router[_0xf32f('0x11')](_0xf32f('0x10'),auth[_0xf32f('0xc')](),controller[_0xf32f('0x13')]);router[_0xf32f('0x14')]('/:id',auth[_0xf32f('0xc')](),controller[_0xf32f('0x15')]);router[_0xf32f('0x16')]('/:id',auth[_0xf32f('0xc')](),controller[_0xf32f('0x17')]);module[_0xf32f('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 40a9754..0e1519c 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 _0x5586=['ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\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)','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM'];(function(_0xf7b34f,_0x35bec1){var _0x13e4a2=function(_0x53ea58){while(--_0x53ea58){_0xf7b34f['push'](_0xf7b34f['shift']());}};_0x13e4a2(++_0x35bec1);}(_0x5586,0x1a0));var _0x6558=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x5586[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x6558('0x0'));module[_0x6558('0x1')]={'name':{'type':Sequelize[_0x6558('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x6558('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x6558('0x4')},'description':{'type':Sequelize[_0x6558('0x2')]},'active':{'type':Sequelize[_0x6558('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x6558('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x6558('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x6558('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6558('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x6558('0x6')](0x5)[_0x6558('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x6558('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x6558('0xc')},'dialTimezone':{'type':Sequelize[_0x6558('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x6558('0x3')](_0x6558('0xd'),'never',_0x6558('0xe')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x6558('0x5')],'defaultValue':0x0,'comment':_0x6558('0xf')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x6558('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x6558('0x10')},'dialAMDGreeting':{'type':Sequelize[_0x6558('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x6558('0x6')](0x9)[_0x6558('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x6558('0x11')},'dialAMDMinWordLength':{'type':Sequelize[_0x6558('0x6')](0x9)[_0x6558('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x6558('0x12')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x6558('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x6558('0x13')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x6558('0x14')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x6558('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x6558('0x15')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x6558('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x6558('0x16'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x6558('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6558('0x17')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x6558('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x6558('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x6558('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0x1a')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x6558('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x6558('0x6')](0x5)[_0x6558('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x6558('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x6558('0x6')](0x3)[_0x6558('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x6558('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x6558('0x22')}}; \ No newline at end of file +var _0xddd1=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','BOOLEAN','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','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\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)'];(function(_0x138483,_0x581c29){var _0x237098=function(_0x37f4f4){while(--_0x37f4f4){_0x138483['push'](_0x138483['shift']());}};_0x237098(++_0x581c29);}(_0xddd1,0xab));var _0x1ddd=function(_0x84c31a,_0x1ab911){_0x84c31a=_0x84c31a-0x0;var _0x21679d=_0xddd1[_0x84c31a];return _0x21679d;};'use strict';var Sequelize=require('sequelize');module[_0x1ddd('0x0')]={'name':{'type':Sequelize[_0x1ddd('0x1')],'unique':_0x1ddd('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1ddd('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1ddd('0x1')]},'active':{'type':Sequelize[_0x1ddd('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1ddd('0x5')](0x4)[_0x1ddd('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1ddd('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1ddd('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1ddd('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1ddd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1ddd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x3,'comment':_0x1ddd('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1ddd('0xd')},'dialTimezone':{'type':Sequelize[_0x1ddd('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x1ddd('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1ddd('0x3')]('always',_0x1ddd('0xf'),_0x1ddd('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1ddd('0x4')],'defaultValue':0x0,'comment':_0x1ddd('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1ddd('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1ddd('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x1ddd('0x5')](0x9)[_0x1ddd('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1ddd('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1ddd('0x5')](0x9)[_0x1ddd('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1ddd('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1ddd('0x5')](0x9)[_0x1ddd('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ddd('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1ddd('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1ddd('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x1ddd('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1ddd('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1ddd('0x5')](0x9)[_0x1ddd('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1ddd('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1ddd('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1ddd('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1ddd('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1ddd('0x3')](_0x1ddd('0x1b'),_0x1ddd('0x1c')),'defaultValue':_0x1ddd('0x1b')},'dialPrefix':{'type':Sequelize[_0x1ddd('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ddd('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1ddd('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1ddd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x1ddd('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1ddd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x24')},'dialMachineMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x25')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1ddd('0x5')](0x5)[_0x1ddd('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x26')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1ddd('0x5')](0x3)[_0x1ddd('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1ddd('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1ddd('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 30c4126..9f53a3e 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 _0x5d91=['push','sequelize','all','removeLists','CmHopper','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','IvrCampaigns','UserProfileResource','status','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','Campaign','findAll','catch','show','params','fields','includeAll','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','rawAttributes','omit','createdAt','updatedAt','findOne','CampaignId','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','into'];(function(_0x2da357,_0x1f9b2f){var _0x138fdd=function(_0xe3077d){while(--_0xe3077d){_0x2da357['push'](_0x2da357['shift']());}};_0x138fdd(++_0x1f9b2f);}(_0x5d91,0x110));var _0x15d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d91[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x15d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x15d9('0x2'));var moment=require('moment');var BPromise=require(_0x15d9('0x3'));var Mustache=require(_0x15d9('0x4'));var util=require(_0x15d9('0x5'));var path=require(_0x15d9('0x6'));var sox=require(_0x15d9('0x7'));var csv=require('to-csv');var ejs=require(_0x15d9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x15d9('0x9'));var crypto=require(_0x15d9('0xa'));var jsforce=require(_0x15d9('0xb'));var deskjs=require(_0x15d9('0xc'));var toCsv=require(_0x15d9('0xd'));var querystring=require('querystring');var Papa=require(_0x15d9('0xe'));var Redis=require('ioredis');var authService=require(_0x15d9('0xf'));var qs=require(_0x15d9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x15d9('0x11'));var logger=require(_0x15d9('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x15d9('0x13'))['db'];function respondWithStatusCode(_0x231a4e,_0x1c8190){_0x1c8190=_0x1c8190||0xcc;return function(_0x2920f0){if(_0x2920f0){return _0x231a4e[_0x15d9('0x14')](_0x1c8190);}return _0x231a4e['status'](_0x1c8190)[_0x15d9('0x15')]();};}function respondWithResult(_0x35fba5,_0x955e75){_0x955e75=_0x955e75||0xc8;return function(_0x1d7c7f){if(_0x1d7c7f){return _0x35fba5['status'](_0x955e75)[_0x15d9('0x16')](_0x1d7c7f);}};}function respondWithFilteredResult(_0x40563f,_0x532e5a){return function(_0x54e98f){if(_0x54e98f){var _0x4980ed=typeof _0x532e5a[_0x15d9('0x17')]===_0x15d9('0x18')&&typeof _0x532e5a[_0x15d9('0x19')]===_0x15d9('0x18');var _0x1b2f2e=_0x54e98f[_0x15d9('0x1a')];var _0x293053=_0x4980ed?0x0:_0x532e5a[_0x15d9('0x17')];var _0x2edf59=_0x4980ed?_0x54e98f[_0x15d9('0x1a')]:_0x532e5a[_0x15d9('0x17')]+_0x532e5a['limit'];var _0x11aa4a;if(_0x2edf59>=_0x1b2f2e){_0x2edf59=_0x1b2f2e;_0x11aa4a=0xc8;}else{_0x11aa4a=0xce;}_0x40563f['status'](_0x11aa4a);return _0x40563f['set'](_0x15d9('0x1b'),_0x293053+'-'+_0x2edf59+'/'+_0x1b2f2e)['json'](_0x54e98f);}return null;};}function patchUpdates(_0x5f134a){return function(_0x33927e){try{jsonpatch[_0x15d9('0x1c')](_0x33927e,_0x5f134a,!![]);}catch(_0xbc7b3b){return BPromise[_0x15d9('0x1d')](_0xbc7b3b);}return _0x33927e['save']();};}function saveUpdates(_0x39ad4a,_0x40c5a3){return function(_0x42030b){if(_0x42030b){return _0x42030b[_0x15d9('0x1e')](_0x39ad4a)[_0x15d9('0x1f')](function(_0x1d07ee){return _0x1d07ee;});}return null;};}function removeEntity(_0x1740ed,_0x4ece3e){return function(_0x4fd0db){if(_0x4fd0db){return _0x4fd0db[_0x15d9('0x20')]()[_0x15d9('0x1f')](function(){var _0x44e7c8=_0x4fd0db[_0x15d9('0x21')]({'plain':!![]});var _0xfb7c05=_0x15d9('0x22');return db[_0x15d9('0x23')][_0x15d9('0x20')]({'where':{'type':_0xfb7c05,'resourceId':_0x44e7c8['id']}})[_0x15d9('0x1f')](function(){return _0x4fd0db;});})[_0x15d9('0x1f')](function(){_0x1740ed[_0x15d9('0x24')](0xcc)[_0x15d9('0x15')]();});}};}function handleEntityNotFound(_0x3f0367,_0x1be834){return function(_0x541c81){if(!_0x541c81){_0x3f0367['sendStatus'](0x194);}return _0x541c81;};}function handleError(_0x126afe,_0x16cf51){_0x16cf51=_0x16cf51||0x1f4;return function(_0x378652){logger[_0x15d9('0x25')](_0x378652[_0x15d9('0x26')]);if(_0x378652[_0x15d9('0x27')]){delete _0x378652[_0x15d9('0x27')];}_0x126afe['status'](_0x16cf51)[_0x15d9('0x28')](_0x378652);};}exports['index']=function(_0x1335ab,_0x32916f){var _0x145d97={},_0x25989e={},_0x4079e7={'count':0x0,'rows':[]};var _0x30ee8d=_[_0x15d9('0x29')](db['Campaign']['rawAttributes'],function(_0x3b96ef){return{'name':_0x3b96ef[_0x15d9('0x2a')],'type':_0x3b96ef['type'][_0x15d9('0x2b')]};});_0x25989e[_0x15d9('0x2c')]=_['map'](_0x30ee8d,_0x15d9('0x27'));_0x25989e[_0x15d9('0x2d')]=_[_0x15d9('0x2e')](_0x1335ab[_0x15d9('0x2d')]);_0x25989e[_0x15d9('0x2f')]=_[_0x15d9('0x30')](_0x25989e[_0x15d9('0x2c')],_0x25989e[_0x15d9('0x2d')]);_0x145d97[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x25989e[_0x15d9('0x2c')],qs['fields'](_0x1335ab[_0x15d9('0x2d')]['fields']));_0x145d97[_0x15d9('0x31')]=_0x145d97['attributes'][_0x15d9('0x32')]?_0x145d97[_0x15d9('0x31')]:_0x25989e[_0x15d9('0x2c')];if(!_0x1335ab[_0x15d9('0x2d')][_0x15d9('0x33')](_0x15d9('0x34'))){_0x145d97[_0x15d9('0x19')]=qs[_0x15d9('0x19')](_0x1335ab[_0x15d9('0x2d')][_0x15d9('0x19')]);_0x145d97[_0x15d9('0x17')]=qs[_0x15d9('0x17')](_0x1335ab[_0x15d9('0x2d')]['offset']);}_0x145d97[_0x15d9('0x35')]=qs[_0x15d9('0x36')](_0x1335ab[_0x15d9('0x2d')][_0x15d9('0x36')]);_0x145d97[_0x15d9('0x37')]=qs[_0x15d9('0x2f')](_[_0x15d9('0x38')](_0x1335ab['query'],_0x25989e[_0x15d9('0x2f')]),_0x30ee8d);if(_0x1335ab[_0x15d9('0x2d')][_0x15d9('0x39')]){_0x145d97[_0x15d9('0x37')]=_[_0x15d9('0x3a')](_0x145d97[_0x15d9('0x37')],{'$or':_[_0x15d9('0x29')](_0x30ee8d,function(_0x259af2){if(_0x259af2['type']!=='VIRTUAL'){var _0x21eab8={};_0x21eab8[_0x259af2[_0x15d9('0x27')]]={'$like':'%'+_0x1335ab[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0x21eab8;}})});}_0x145d97=_[_0x15d9('0x3a')]({},_0x145d97,_0x1335ab[_0x15d9('0x3b')]);var _0x35eaf8={'where':_0x145d97[_0x15d9('0x37')]};return db['Campaign']['count'](_0x35eaf8)[_0x15d9('0x1f')](function(_0x3ccd73){_0x4079e7[_0x15d9('0x1a')]=_0x3ccd73;if(_0x1335ab[_0x15d9('0x2d')]['includeAll']){_0x145d97[_0x15d9('0x3c')]=[{'all':!![]}];}return db[_0x15d9('0x3d')][_0x15d9('0x3e')](_0x145d97);})[_0x15d9('0x1f')](function(_0x544812){_0x4079e7['rows']=_0x544812;return _0x4079e7;})[_0x15d9('0x1f')](respondWithFilteredResult(_0x32916f,_0x145d97))[_0x15d9('0x3f')](handleError(_0x32916f,null));};exports[_0x15d9('0x40')]=function(_0x27fafc,_0x10056c){var _0xd89b7d={'raw':![],'where':{'id':_0x27fafc[_0x15d9('0x41')]['id']}},_0x20b423={};_0x20b423[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db[_0x15d9('0x3d')]['rawAttributes']);_0x20b423[_0x15d9('0x2d')]=_[_0x15d9('0x2e')](_0x27fafc[_0x15d9('0x2d')]);_0x20b423[_0x15d9('0x2f')]=_[_0x15d9('0x30')](_0x20b423[_0x15d9('0x2c')],_0x20b423[_0x15d9('0x2d')]);_0xd89b7d[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x20b423['model'],qs[_0x15d9('0x42')](_0x27fafc[_0x15d9('0x2d')][_0x15d9('0x42')]));_0xd89b7d[_0x15d9('0x31')]=_0xd89b7d['attributes'][_0x15d9('0x32')]?_0xd89b7d[_0x15d9('0x31')]:_0x20b423['model'];if(_0x27fafc[_0x15d9('0x2d')][_0x15d9('0x43')]){_0xd89b7d[_0x15d9('0x3c')]=[{'all':!![]}];}_0xd89b7d=_[_0x15d9('0x3a')]({},_0xd89b7d,_0x27fafc[_0x15d9('0x3b')]);return db[_0x15d9('0x3d')][_0x15d9('0x44')](_0xd89b7d)[_0x15d9('0x1f')](handleEntityNotFound(_0x10056c,null))[_0x15d9('0x1f')](respondWithResult(_0x10056c,null))[_0x15d9('0x3f')](handleError(_0x10056c,null));};exports[_0x15d9('0x45')]=function(_0x4203ed,_0x57e483){return db[_0x15d9('0x3d')][_0x15d9('0x45')](_0x4203ed[_0x15d9('0x46')],{})[_0x15d9('0x1f')](function(_0x12c690){var _0x222300=_0x4203ed[_0x15d9('0x47')][_0x15d9('0x21')]({'plain':!![]});if(!_0x222300)throw new Error(_0x15d9('0x48'));if(_0x222300[_0x15d9('0x49')]===_0x15d9('0x47')){var _0x36544a=_0x12c690[_0x15d9('0x21')]({'plain':!![]});var _0x4c2267=_0x15d9('0x22');return db[_0x15d9('0x4a')][_0x15d9('0x44')]({'where':{'name':_0x4c2267,'userProfileId':_0x222300[_0x15d9('0x4b')]},'raw':!![]})[_0x15d9('0x1f')](function(_0xf240e8){if(_0xf240e8&&_0xf240e8[_0x15d9('0x4c')]===0x0){return db[_0x15d9('0x23')][_0x15d9('0x45')]({'name':_0x36544a['name'],'resourceId':_0x36544a['id'],'type':_0xf240e8[_0x15d9('0x27')],'sectionId':_0xf240e8['id']},{})[_0x15d9('0x1f')](function(){return _0x12c690;});}else{return _0x12c690;}})['catch'](function(_0x4e03dd){logger[_0x15d9('0x25')](_0x15d9('0x4d'),_0x4e03dd);throw _0x4e03dd;});}return _0x12c690;})[_0x15d9('0x1f')](respondWithResult(_0x57e483,0xc9))[_0x15d9('0x3f')](handleError(_0x57e483,null));};exports[_0x15d9('0x4e')]=function(_0x11e747,_0x1b1c6f){var _0x4186c5={'where':{'id':_0x11e747[_0x15d9('0x41')]['id']}},_0x317440={};_0x317440[_0x15d9('0x2c')]=_['keys'](db[_0x15d9('0x3d')][_0x15d9('0x4f')]);_0x4186c5['attributes']=_[_0x15d9('0x30')](_0x317440['model'],qs['fields'](_0x11e747[_0x15d9('0x2d')][_0x15d9('0x42')]));_0x4186c5[_0x15d9('0x31')]=_0x4186c5[_0x15d9('0x31')]['length']?_0x4186c5[_0x15d9('0x31')]:_0x317440[_0x15d9('0x2c')];if(_0x11e747['query'][_0x15d9('0x43')]){_0x4186c5[_0x15d9('0x3c')]=[{'all':!![]}];}_0x4186c5=_[_0x15d9('0x3a')]({},_0x4186c5,_0x11e747[_0x15d9('0x3b')]);return db['Campaign'][_0x15d9('0x44')](_0x4186c5)[_0x15d9('0x1f')](handleEntityNotFound(_0x1b1c6f,null))[_0x15d9('0x1f')](function(_0x6aec03){if(_0x6aec03){var _0x249205=_0x6aec03['get']({'plain':!![]});_0x249205=qs[_0x15d9('0x50')](_0x249205,['id',_0x15d9('0x51'),_0x15d9('0x52')]);_0x11e747[_0x15d9('0x46')]=_[_0x15d9('0x50')](_0x11e747['body'],['id',_0x15d9('0x51'),_0x15d9('0x52')]);return db['Campaign'][_0x15d9('0x45')](_['merge'](_0x249205,_0x11e747[_0x15d9('0x46')]),{'include':_0x11e747[_0x15d9('0x2d')][_0x15d9('0x43')]?[{'all':!![]}]:undefined})[_0x15d9('0x1f')](function(_0x5a8db5){var _0x37b9f7=_0x11e747[_0x15d9('0x47')][_0x15d9('0x21')]({'plain':!![]});if(!_0x37b9f7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37b9f7[_0x15d9('0x49')]==='user'){var _0x5d1213=_0x5a8db5[_0x15d9('0x21')]({'plain':!![]});var _0x715a3='IvrCampaigns';return db[_0x15d9('0x4a')][_0x15d9('0x44')]({'where':{'name':_0x715a3,'userProfileId':_0x37b9f7['userProfileId']},'raw':!![]})[_0x15d9('0x1f')](function(_0x82d5da){if(_0x82d5da&&_0x82d5da[_0x15d9('0x4c')]===0x0){return db[_0x15d9('0x23')][_0x15d9('0x45')]({'name':_0x5d1213[_0x15d9('0x27')],'resourceId':_0x5d1213['id'],'type':_0x82d5da[_0x15d9('0x27')],'sectionId':_0x82d5da['id']},{})[_0x15d9('0x1f')](function(){return _0x5a8db5;});}else{return _0x5a8db5;}})['catch'](function(_0xd61969){logger[_0x15d9('0x25')](_0x15d9('0x4d'),_0xd61969);throw _0xd61969;});}return _0x5a8db5;});}})[_0x15d9('0x1f')](respondWithResult(_0x1b1c6f,0xc9))[_0x15d9('0x3f')](handleError(_0x1b1c6f,null));};exports[_0x15d9('0x1e')]=function(_0x25a0fc,_0x3474c0){if(_0x25a0fc[_0x15d9('0x46')]['id']){delete _0x25a0fc['body']['id'];}return db[_0x15d9('0x3d')][_0x15d9('0x44')]({'where':{'id':_0x25a0fc[_0x15d9('0x41')]['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x3474c0,null))[_0x15d9('0x1f')](saveUpdates(_0x25a0fc[_0x15d9('0x46')],null))['then'](respondWithResult(_0x3474c0,null))[_0x15d9('0x3f')](handleError(_0x3474c0,null));};exports[_0x15d9('0x20')]=function(_0x27ea2e,_0x226b52){return db[_0x15d9('0x3d')][_0x15d9('0x44')]({'where':{'id':_0x27ea2e[_0x15d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x226b52,null))[_0x15d9('0x1f')](removeEntity(_0x226b52,null))[_0x15d9('0x3f')](handleError(_0x226b52,null));};exports['getHoppers']=function(_0x39bf74,_0x6a99d2,_0x26d6e7){var _0x4a81a2={'raw':!![],'where':{}};var _0x4eec7f={};var _0x1f94bd={'count':0x0,'rows':[]};return db[_0x15d9('0x3d')][_0x15d9('0x53')]({'where':{'id':_0x39bf74['params']['id']}})['then'](handleEntityNotFound(_0x6a99d2,null))[_0x15d9('0x1f')](function(_0x410285){if(_0x410285){_0x4eec7f[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db['CmHopper'][_0x15d9('0x4f')]);_0x4eec7f['query']=_[_0x15d9('0x2e')](_0x39bf74['query']);_0x4eec7f['filters']=_[_0x15d9('0x30')](_0x4eec7f[_0x15d9('0x2c')],_0x4eec7f[_0x15d9('0x2d')]);_0x4a81a2[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x4eec7f['model'],qs[_0x15d9('0x42')](_0x39bf74[_0x15d9('0x2d')][_0x15d9('0x42')]));_0x4a81a2[_0x15d9('0x31')]=_0x4a81a2[_0x15d9('0x31')][_0x15d9('0x32')]?_0x4a81a2[_0x15d9('0x31')]:_0x4eec7f['model'];if(!_0x39bf74['query'][_0x15d9('0x33')]('nolimit')){_0x4a81a2['limit']=qs[_0x15d9('0x19')](_0x39bf74['query'][_0x15d9('0x19')]);_0x4a81a2['offset']=qs[_0x15d9('0x17')](_0x39bf74[_0x15d9('0x2d')][_0x15d9('0x17')]);}_0x4a81a2['order']=qs['sort'](_0x39bf74[_0x15d9('0x2d')][_0x15d9('0x36')]);_0x4a81a2['where']=qs[_0x15d9('0x2f')](_['pick'](_0x39bf74['query'],_0x4eec7f['filters']));_0x4a81a2[_0x15d9('0x37')][_0x15d9('0x54')]=_0x410285['id'];if(_0x39bf74[_0x15d9('0x2d')]['filter']){_0x4a81a2[_0x15d9('0x37')]=_['merge'](_0x4a81a2[_0x15d9('0x37')],{'$or':_[_0x15d9('0x29')](_0x4a81a2['attributes'],function(_0x3c9d91){var _0x1c8098={};_0x1c8098[_0x3c9d91]={'$like':'%'+_0x39bf74[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0x1c8098;})});}_0x4a81a2=_[_0x15d9('0x3a')]({},_0x4a81a2,_0x39bf74[_0x15d9('0x3b')]);return db['CmHopper'][_0x15d9('0x1a')]({'where':_0x4a81a2[_0x15d9('0x37')]})[_0x15d9('0x1f')](function(_0x38a838){_0x1f94bd[_0x15d9('0x1a')]=_0x38a838;if(_0x39bf74[_0x15d9('0x2d')]['includeAll']){_0x4a81a2['include']=[{'all':!![]}];}return db['CmHopper'][_0x15d9('0x3e')](_0x4a81a2);})[_0x15d9('0x1f')](function(_0x42a2f5){_0x1f94bd['rows']=_0x42a2f5;return _0x1f94bd;});}})[_0x15d9('0x1f')](respondWithFilteredResult(_0x6a99d2,_0x4a81a2))[_0x15d9('0x3f')](handleError(_0x6a99d2,null));};exports['getHopperHistories']=function(_0x4021c7,_0x36f0b6,_0x203ecf){var _0x3c9a9f={'raw':!![],'where':{}};var _0x283e93={};var _0x28f524={'count':0x0,'rows':[]};return db['Campaign'][_0x15d9('0x53')]({'where':{'id':_0x4021c7['params']['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x36f0b6,null))[_0x15d9('0x1f')](function(_0x2d0855){if(_0x2d0855){_0x283e93['model']=_[_0x15d9('0x2e')](db[_0x15d9('0x55')][_0x15d9('0x4f')]);_0x283e93[_0x15d9('0x2d')]=_['keys'](_0x4021c7['query']);_0x283e93[_0x15d9('0x2f')]=_[_0x15d9('0x30')](_0x283e93[_0x15d9('0x2c')],_0x283e93[_0x15d9('0x2d')]);_0x3c9a9f[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x283e93[_0x15d9('0x2c')],qs['fields'](_0x4021c7[_0x15d9('0x2d')]['fields']));_0x3c9a9f[_0x15d9('0x31')]=_0x3c9a9f[_0x15d9('0x31')][_0x15d9('0x32')]?_0x3c9a9f[_0x15d9('0x31')]:_0x283e93[_0x15d9('0x2c')];if(!_0x4021c7[_0x15d9('0x2d')]['hasOwnProperty']('nolimit')){_0x3c9a9f[_0x15d9('0x19')]=qs[_0x15d9('0x19')](_0x4021c7[_0x15d9('0x2d')][_0x15d9('0x19')]);_0x3c9a9f['offset']=qs[_0x15d9('0x17')](_0x4021c7[_0x15d9('0x2d')][_0x15d9('0x17')]);}_0x3c9a9f[_0x15d9('0x35')]=qs[_0x15d9('0x36')](_0x4021c7[_0x15d9('0x2d')]['sort']);_0x3c9a9f['where']=qs['filters'](_[_0x15d9('0x38')](_0x4021c7['query'],_0x283e93['filters']));_0x3c9a9f['where'][_0x15d9('0x54')]=_0x2d0855['id'];if(_0x4021c7['query'][_0x15d9('0x39')]){_0x3c9a9f[_0x15d9('0x37')]=_[_0x15d9('0x3a')](_0x3c9a9f[_0x15d9('0x37')],{'$or':_['map'](_0x3c9a9f['attributes'],function(_0x3ec3de){var _0x38b6dc={};_0x38b6dc[_0x3ec3de]={'$like':'%'+_0x4021c7[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0x38b6dc;})});}_0x3c9a9f=_[_0x15d9('0x3a')]({},_0x3c9a9f,_0x4021c7[_0x15d9('0x3b')]);return db['CmHopperHistory'][_0x15d9('0x1a')]({'where':_0x3c9a9f[_0x15d9('0x37')]})[_0x15d9('0x1f')](function(_0x4f9dc9){_0x28f524[_0x15d9('0x1a')]=_0x4f9dc9;if(_0x4021c7[_0x15d9('0x2d')][_0x15d9('0x43')]){_0x3c9a9f[_0x15d9('0x3c')]=[{'all':!![]}];}return db[_0x15d9('0x55')]['findAll'](_0x3c9a9f);})[_0x15d9('0x1f')](function(_0x2405b5){_0x28f524[_0x15d9('0x56')]=_0x2405b5;return _0x28f524;});}})[_0x15d9('0x1f')](respondWithFilteredResult(_0x36f0b6,_0x3c9a9f))[_0x15d9('0x3f')](handleError(_0x36f0b6,null));};exports[_0x15d9('0x57')]=function(_0x698e07,_0x4b6cd4,_0x3ef92c){var _0x3d7687={'raw':!![],'where':{}};var _0x40f739={};var _0x493105={'count':0x0,'rows':[]};return db[_0x15d9('0x3d')][_0x15d9('0x53')]({'where':{'id':_0x698e07[_0x15d9('0x41')]['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x4b6cd4,null))[_0x15d9('0x1f')](function(_0x3a5d94){if(_0x3a5d94){_0x40f739[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db[_0x15d9('0x58')][_0x15d9('0x4f')]);_0x40f739[_0x15d9('0x2d')]=_['keys'](_0x698e07[_0x15d9('0x2d')]);_0x40f739['filters']=_[_0x15d9('0x30')](_0x40f739['model'],_0x40f739[_0x15d9('0x2d')]);_0x3d7687[_0x15d9('0x31')]=_['intersection'](_0x40f739['model'],qs[_0x15d9('0x42')](_0x698e07['query'][_0x15d9('0x42')]));_0x3d7687[_0x15d9('0x31')]=_0x3d7687['attributes'][_0x15d9('0x32')]?_0x3d7687[_0x15d9('0x31')]:_0x40f739[_0x15d9('0x2c')];if(!_0x698e07[_0x15d9('0x2d')]['hasOwnProperty']('nolimit')){_0x3d7687['limit']=qs['limit'](_0x698e07[_0x15d9('0x2d')]['limit']);_0x3d7687[_0x15d9('0x17')]=qs[_0x15d9('0x17')](_0x698e07[_0x15d9('0x2d')][_0x15d9('0x17')]);}_0x3d7687[_0x15d9('0x35')]=qs[_0x15d9('0x36')](_0x698e07[_0x15d9('0x2d')]['sort']);_0x3d7687[_0x15d9('0x37')]=qs[_0x15d9('0x2f')](_[_0x15d9('0x38')](_0x698e07[_0x15d9('0x2d')],_0x40f739[_0x15d9('0x2f')]));_0x3d7687[_0x15d9('0x37')]['CampaignId']=_0x3a5d94['id'];if(_0x698e07[_0x15d9('0x2d')][_0x15d9('0x39')]){_0x3d7687[_0x15d9('0x37')]=_['merge'](_0x3d7687[_0x15d9('0x37')],{'$or':_['map'](_0x3d7687[_0x15d9('0x31')],function(_0x4551da){var _0xa1f709={};_0xa1f709[_0x4551da]={'$like':'%'+_0x698e07['query'][_0x15d9('0x39')]+'%'};return _0xa1f709;})});}_0x3d7687=_[_0x15d9('0x3a')]({},_0x3d7687,_0x698e07[_0x15d9('0x3b')]);return db[_0x15d9('0x58')][_0x15d9('0x1a')]({'where':_0x3d7687['where']})['then'](function(_0x15c3f9){_0x493105['count']=_0x15c3f9;if(_0x698e07[_0x15d9('0x2d')][_0x15d9('0x43')]){_0x3d7687[_0x15d9('0x3c')]=[{'all':!![]}];}return db[_0x15d9('0x58')][_0x15d9('0x3e')](_0x3d7687);})[_0x15d9('0x1f')](function(_0x521982){_0x493105[_0x15d9('0x56')]=_0x521982;return _0x493105;});}})[_0x15d9('0x1f')](respondWithFilteredResult(_0x4b6cd4,_0x3d7687))[_0x15d9('0x3f')](handleError(_0x4b6cd4,null));};exports[_0x15d9('0x59')]=function(_0x1f5970,_0x378b5e,_0x1784e0){var _0x54ba52={'raw':!![],'where':{}};var _0x5886c4={};var _0x7a6dbf={'count':0x0,'rows':[]};return db['Campaign'][_0x15d9('0x53')]({'where':{'id':_0x1f5970['params']['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x378b5e,null))[_0x15d9('0x1f')](function(_0x3f1957){if(_0x3f1957){_0x5886c4[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db[_0x15d9('0x5a')]['rawAttributes']);_0x5886c4['query']=_[_0x15d9('0x2e')](_0x1f5970[_0x15d9('0x2d')]);_0x5886c4[_0x15d9('0x2f')]=_['intersection'](_0x5886c4[_0x15d9('0x2c')],_0x5886c4[_0x15d9('0x2d')]);_0x54ba52[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x5886c4[_0x15d9('0x2c')],qs[_0x15d9('0x42')](_0x1f5970['query'][_0x15d9('0x42')]));_0x54ba52[_0x15d9('0x31')]=_0x54ba52[_0x15d9('0x31')][_0x15d9('0x32')]?_0x54ba52['attributes']:_0x5886c4[_0x15d9('0x2c')];if(!_0x1f5970[_0x15d9('0x2d')][_0x15d9('0x33')](_0x15d9('0x34'))){_0x54ba52[_0x15d9('0x19')]=qs[_0x15d9('0x19')](_0x1f5970[_0x15d9('0x2d')][_0x15d9('0x19')]);_0x54ba52[_0x15d9('0x17')]=qs[_0x15d9('0x17')](_0x1f5970[_0x15d9('0x2d')]['offset']);}_0x54ba52['order']=qs['sort'](_0x1f5970[_0x15d9('0x2d')][_0x15d9('0x36')]);_0x54ba52[_0x15d9('0x37')]=qs[_0x15d9('0x2f')](_[_0x15d9('0x38')](_0x1f5970['query'],_0x5886c4[_0x15d9('0x2f')]));_0x54ba52['where'][_0x15d9('0x54')]=_0x3f1957['id'];if(_0x1f5970['query'][_0x15d9('0x39')]){_0x54ba52[_0x15d9('0x37')]=_[_0x15d9('0x3a')](_0x54ba52[_0x15d9('0x37')],{'$or':_[_0x15d9('0x29')](_0x54ba52[_0x15d9('0x31')],function(_0x248eb7){var _0xdcfcc3={};_0xdcfcc3[_0x248eb7]={'$like':'%'+_0x1f5970[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0xdcfcc3;})});}_0x54ba52=_['merge']({},_0x54ba52,_0x1f5970['options']);return db['CmHopperBlack'][_0x15d9('0x1a')]({'where':_0x54ba52['where']})[_0x15d9('0x1f')](function(_0x1304cf){_0x7a6dbf[_0x15d9('0x1a')]=_0x1304cf;if(_0x1f5970[_0x15d9('0x2d')][_0x15d9('0x43')]){_0x54ba52['include']=[{'all':!![]}];}return db[_0x15d9('0x5a')][_0x15d9('0x3e')](_0x54ba52);})[_0x15d9('0x1f')](function(_0x2bd0d3){_0x7a6dbf[_0x15d9('0x56')]=_0x2bd0d3;return _0x7a6dbf;});}})[_0x15d9('0x1f')](respondWithFilteredResult(_0x378b5e,_0x54ba52))[_0x15d9('0x3f')](handleError(_0x378b5e,null));};exports[_0x15d9('0x5b')]=function(_0x6c9d5c,_0x4bcd76,_0x39dcd4){var _0x3756d6={};var _0x28ba0d={};var _0x2ff77e;var _0x12c394;return db[_0x15d9('0x3d')][_0x15d9('0x53')]({'where':{'id':_0x6c9d5c['params']['id']}})['then'](handleEntityNotFound(_0x4bcd76,null))[_0x15d9('0x1f')](function(_0x411ce5){if(_0x411ce5){_0x2ff77e=_0x411ce5;_0x28ba0d[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db['CmList']['rawAttributes']);_0x28ba0d[_0x15d9('0x2d')]=_[_0x15d9('0x2e')](_0x6c9d5c[_0x15d9('0x2d')]);_0x28ba0d[_0x15d9('0x2f')]=_['intersection'](_0x28ba0d[_0x15d9('0x2c')],_0x28ba0d[_0x15d9('0x2d')]);_0x3756d6[_0x15d9('0x31')]=_[_0x15d9('0x30')](_0x28ba0d[_0x15d9('0x2c')],qs['fields'](_0x6c9d5c[_0x15d9('0x2d')]['fields']));_0x3756d6[_0x15d9('0x31')]=_0x3756d6[_0x15d9('0x31')]['length']?_0x3756d6[_0x15d9('0x31')]:_0x28ba0d['model'];_0x3756d6['order']=qs[_0x15d9('0x36')](_0x6c9d5c[_0x15d9('0x2d')]['sort']);_0x3756d6[_0x15d9('0x37')]=qs['filters'](_[_0x15d9('0x38')](_0x6c9d5c[_0x15d9('0x2d')],_0x28ba0d['filters']));if(_0x6c9d5c['query'][_0x15d9('0x39')]){_0x3756d6[_0x15d9('0x37')]=_[_0x15d9('0x3a')](_0x3756d6[_0x15d9('0x37')],{'$or':_[_0x15d9('0x29')](_0x3756d6[_0x15d9('0x31')],function(_0x1a35e8){var _0x527469={};_0x527469[_0x1a35e8]={'$like':'%'+_0x6c9d5c[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0x527469;})});}_0x3756d6=_['merge']({},_0x3756d6,_0x6c9d5c[_0x15d9('0x3b')]);return _0x2ff77e[_0x15d9('0x5b')](_0x3756d6);}})[_0x15d9('0x1f')](function(_0x336e78){if(_0x336e78){_0x12c394=_0x336e78[_0x15d9('0x32')];if(!_0x6c9d5c[_0x15d9('0x2d')][_0x15d9('0x33')](_0x15d9('0x34'))){_0x3756d6[_0x15d9('0x19')]=qs[_0x15d9('0x19')](_0x6c9d5c[_0x15d9('0x2d')][_0x15d9('0x19')]);_0x3756d6[_0x15d9('0x17')]=qs[_0x15d9('0x17')](_0x6c9d5c['query']['offset']);}return _0x2ff77e[_0x15d9('0x5b')](_0x3756d6);}})[_0x15d9('0x1f')](function(_0x466bdf){if(_0x466bdf){return _0x466bdf?{'count':_0x12c394,'rows':_0x466bdf}:null;}})[_0x15d9('0x1f')](respondWithResult(_0x4bcd76,null))['catch'](handleError(_0x4bcd76,null));};exports[_0x15d9('0x5c')]=function(_0x2670ee,_0x221b8d,_0x573acf){var _0x5e298a,_0x22fd90;return db[_0x15d9('0x3d')]['find']({'where':{'id':_0x2670ee['params']['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x221b8d,null))['then'](function(_0x3bc768){if(_0x3bc768){_0x22fd90=_0x3bc768;return _0x3bc768[_0x15d9('0x5c')](_0x2670ee[_0x15d9('0x46')][_0x15d9('0x5d')],_['omit'](_0x2670ee['body'],[_0x15d9('0x5d'),'id'])||{});}return null;})[_0x15d9('0x5e')](function(_0x324628){var _0x16207a;_0x5e298a=_0x324628||[];var _0x5453ab=[];if(_0x324628){for(var _0x57b608=0x0;_0x57b608<_0x324628['length'];_0x57b608+=0x1){var _0x368c1f=_0x324628[_0x57b608][_0x15d9('0x21')]({'plain':!![]});_0x22fd90['dialCheckDuplicateType']=_0x2670ee['body'][_0x15d9('0x5f')]?_0x2670ee[_0x15d9('0x46')][_0x15d9('0x5f')]:_0x22fd90[_0x15d9('0x5f')];switch(_0x22fd90[_0x15d9('0x5f')]){case _0x15d9('0x60'):_0x16207a=squel[_0x15d9('0x61')]()['into'](_0x15d9('0x62'))[_0x15d9('0x63')]([_0x15d9('0x64'),_0x15d9('0x65'),_0x15d9('0x66'),_0x15d9('0x67'),_0x15d9('0x54'),_0x15d9('0x51'),_0x15d9('0x52')],squel[_0x15d9('0x68')]()['field'](_0x15d9('0x64'),'phone')[_0x15d9('0x69')]('NOW()',_0x15d9('0x65'))[_0x15d9('0x69')]('id',_0x15d9('0x66'))['field'](_0x368c1f[_0x15d9('0x6a')][_0x15d9('0x6b')](),'ListId')[_0x15d9('0x69')](_0x2670ee[_0x15d9('0x41')]['id'][_0x15d9('0x6b')](),_0x15d9('0x54'))[_0x15d9('0x69')](_0x15d9('0x6c'),_0x15d9('0x51'))[_0x15d9('0x69')](_0x15d9('0x6c'),_0x15d9('0x52'))[_0x15d9('0x6d')](_0x15d9('0x6e'))[_0x15d9('0x37')](_0x15d9('0x6f'))[_0x15d9('0x37')](_0x15d9('0x70'),_0x368c1f[_0x15d9('0x6a')]['toString']())[_0x15d9('0x37')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x15d9('0x71'),squel[_0x15d9('0x68')]()[_0x15d9('0x69')](_0x15d9('0x72'))[_0x15d9('0x6d')](_0x15d9('0x73'))[_0x15d9('0x37')](_0x15d9('0x74'),_0x2670ee[_0x15d9('0x41')]['id']['toString']()))[_0x15d9('0x37')](_0x15d9('0x71'),squel['select']()[_0x15d9('0x69')](_0x15d9('0x75'))[_0x15d9('0x6d')](_0x15d9('0x62'))['where']('CampaignId\x20=\x20?',_0x2670ee[_0x15d9('0x41')]['id'][_0x15d9('0x6b')]())))['toString']();break;case _0x15d9('0x76'):_0x16207a=squel[_0x15d9('0x61')]()['into']('cm_hopper')['fromQuery']([_0x15d9('0x64'),_0x15d9('0x65'),'ContactId',_0x15d9('0x67'),_0x15d9('0x54'),'createdAt','updatedAt'],squel[_0x15d9('0x68')]()[_0x15d9('0x69')](_0x15d9('0x64'),_0x15d9('0x64'))[_0x15d9('0x69')]('NOW()','scheduledAt')[_0x15d9('0x69')]('id',_0x15d9('0x66'))[_0x15d9('0x69')](_0x368c1f['CmListId'][_0x15d9('0x6b')](),_0x15d9('0x67'))['field'](_0x2670ee[_0x15d9('0x41')]['id'][_0x15d9('0x6b')](),'CampaignId')['field'](_0x15d9('0x6c'),_0x15d9('0x51'))['field']('NOW()','updatedAt')[_0x15d9('0x6d')](_0x15d9('0x6e'))[_0x15d9('0x37')](_0x15d9('0x6f'))[_0x15d9('0x37')](_0x15d9('0x70'),_0x368c1f[_0x15d9('0x6a')][_0x15d9('0x6b')]())[_0x15d9('0x37')](_0x15d9('0x77'))[_0x15d9('0x37')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x15d9('0x69')](_0x15d9('0x75'))[_0x15d9('0x6d')](_0x15d9('0x62'))[_0x15d9('0x37')](_0x15d9('0x74'),_0x2670ee['params']['id'][_0x15d9('0x6b')]())))[_0x15d9('0x6b')]();break;default:_0x16207a=squel[_0x15d9('0x61')]()[_0x15d9('0x78')](_0x15d9('0x62'))[_0x15d9('0x63')](['phone','scheduledAt',_0x15d9('0x66'),_0x15d9('0x67'),_0x15d9('0x54'),_0x15d9('0x51'),_0x15d9('0x52')],squel[_0x15d9('0x68')]()[_0x15d9('0x69')](_0x15d9('0x64'),_0x15d9('0x64'))[_0x15d9('0x69')](_0x15d9('0x6c'),_0x15d9('0x65'))[_0x15d9('0x69')]('id',_0x15d9('0x66'))[_0x15d9('0x69')](_0x368c1f[_0x15d9('0x6a')][_0x15d9('0x6b')](),'ListId')[_0x15d9('0x69')](_0x2670ee[_0x15d9('0x41')]['id'][_0x15d9('0x6b')](),_0x15d9('0x54'))[_0x15d9('0x69')](_0x15d9('0x6c'),'createdAt')[_0x15d9('0x69')]('NOW()',_0x15d9('0x52'))['from']('cm_contacts')[_0x15d9('0x37')](_0x15d9('0x6f'))[_0x15d9('0x37')]('ListId\x20=\x20?',_0x368c1f['CmListId'][_0x15d9('0x6b')]())[_0x15d9('0x37')](_0x15d9('0x77')))['toString']();}_0x5453ab[_0x15d9('0x79')](db[_0x15d9('0x7a')][_0x15d9('0x2d')](_0x16207a));}return BPromise[_0x15d9('0x7b')](_0x5453ab);}})['then'](function(){return _0x5e298a;})[_0x15d9('0x1f')](respondWithResult(_0x221b8d,null))[_0x15d9('0x3f')](handleError(_0x221b8d,null));};exports[_0x15d9('0x7c')]=function(_0x3241ef,_0x2edf99,_0x2de33c){return db[_0x15d9('0x3d')][_0x15d9('0x44')]({'where':{'id':_0x3241ef[_0x15d9('0x41')]['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x2edf99,null))[_0x15d9('0x1f')](function(_0x51fd3a){if(_0x51fd3a){return _0x51fd3a['removeLists'](_0x3241ef[_0x15d9('0x2d')][_0x15d9('0x5d')]);}})['then'](function(_0xb20cea){if(_0xb20cea){return db[_0x15d9('0x7d')][_0x15d9('0x20')]({'where':{'ListId':_0x3241ef[_0x15d9('0x2d')]['ids'],'CampaignId':_0x3241ef['params']['id']}})[_0x15d9('0x1f')](function(){return _0xb20cea;});}})[_0x15d9('0x1f')](respondWithStatusCode(_0x2edf99,null))[_0x15d9('0x3f')](handleError(_0x2edf99,null));};exports[_0x15d9('0x7e')]=function(_0x25b863,_0x3657eb,_0x310bd5){var _0x10f61c={};var _0x2812af={};var _0x51f937;var _0x55612e;return db[_0x15d9('0x3d')]['findOne']({'where':{'id':_0x25b863[_0x15d9('0x41')]['id']}})[_0x15d9('0x1f')](handleEntityNotFound(_0x3657eb,null))[_0x15d9('0x1f')](function(_0x2adfa1){if(_0x2adfa1){_0x51f937=_0x2adfa1;_0x2812af[_0x15d9('0x2c')]=_[_0x15d9('0x2e')](db[_0x15d9('0x7f')]['rawAttributes']);_0x2812af[_0x15d9('0x2d')]=_[_0x15d9('0x2e')](_0x25b863['query']);_0x2812af[_0x15d9('0x2f')]=_['intersection'](_0x2812af[_0x15d9('0x2c')],_0x2812af[_0x15d9('0x2d')]);_0x10f61c[_0x15d9('0x31')]=_['intersection'](_0x2812af[_0x15d9('0x2c')],qs[_0x15d9('0x42')](_0x25b863[_0x15d9('0x2d')][_0x15d9('0x42')]));_0x10f61c[_0x15d9('0x31')]=_0x10f61c[_0x15d9('0x31')][_0x15d9('0x32')]?_0x10f61c[_0x15d9('0x31')]:_0x2812af[_0x15d9('0x2c')];_0x10f61c[_0x15d9('0x35')]=qs[_0x15d9('0x36')](_0x25b863['query'][_0x15d9('0x36')]);_0x10f61c[_0x15d9('0x37')]=qs[_0x15d9('0x2f')](_[_0x15d9('0x38')](_0x25b863[_0x15d9('0x2d')],_0x2812af[_0x15d9('0x2f')]));if(_0x25b863[_0x15d9('0x2d')][_0x15d9('0x39')]){_0x10f61c['where']=_[_0x15d9('0x3a')](_0x10f61c[_0x15d9('0x37')],{'$or':_[_0x15d9('0x29')](_0x10f61c[_0x15d9('0x31')],function(_0x380cf5){var _0x126d3b={};_0x126d3b[_0x380cf5]={'$like':'%'+_0x25b863[_0x15d9('0x2d')][_0x15d9('0x39')]+'%'};return _0x126d3b;})});}_0x10f61c=_[_0x15d9('0x3a')]({},_0x10f61c,_0x25b863[_0x15d9('0x3b')]);return _0x51f937[_0x15d9('0x7e')](_0x10f61c);}})[_0x15d9('0x1f')](function(_0x1e8940){if(_0x1e8940){_0x55612e=_0x1e8940[_0x15d9('0x32')];if(!_0x25b863['query']['hasOwnProperty'](_0x15d9('0x34'))){_0x10f61c[_0x15d9('0x19')]=qs['limit'](_0x25b863[_0x15d9('0x2d')][_0x15d9('0x19')]);_0x10f61c[_0x15d9('0x17')]=qs[_0x15d9('0x17')](_0x25b863['query'][_0x15d9('0x17')]);}return _0x51f937[_0x15d9('0x7e')](_0x10f61c);}})['then'](function(_0x92228f){if(_0x92228f){return _0x92228f?{'count':_0x55612e,'rows':_0x92228f}:null;}})['then'](respondWithResult(_0x3657eb,null))['catch'](handleError(_0x3657eb,null));};exports['addBlackLists']=function(_0x5a7230,_0x71ab6a,_0x59016f){var _0x1c540c,_0x37b030;return db[_0x15d9('0x3d')]['find']({'where':{'id':_0x5a7230[_0x15d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x71ab6a,null))['then'](function(_0x3c719a){if(_0x3c719a){_0x37b030=_0x3c719a;return _0x3c719a[_0x15d9('0x80')](_0x5a7230[_0x15d9('0x46')][_0x15d9('0x5d')],_['omit'](_0x5a7230[_0x15d9('0x46')],['ids','id'])||{});}return null;})[_0x15d9('0x5e')](function(_0x3b2734){var _0x5d680f;_0x1c540c=_0x3b2734||[];var _0x52011c=[];if(_0x3b2734){for(var _0x35cdcf=0x0;_0x35cdcf<_0x3b2734[_0x15d9('0x32')];_0x35cdcf+=0x1){var _0x2fbc7f=_0x3b2734[_0x35cdcf][_0x15d9('0x21')]({'plain':!![]});_0x5d680f=squel[_0x15d9('0x61')]()[_0x15d9('0x78')](_0x15d9('0x81'))[_0x15d9('0x63')](['phone',_0x15d9('0x66'),_0x15d9('0x67'),_0x15d9('0x54'),_0x15d9('0x51'),_0x15d9('0x52')],squel[_0x15d9('0x68')]()[_0x15d9('0x69')](_0x15d9('0x64'),_0x15d9('0x64'))['field']('id',_0x15d9('0x66'))[_0x15d9('0x69')](_0x2fbc7f['CmListId'][_0x15d9('0x6b')](),_0x15d9('0x67'))[_0x15d9('0x69')](_0x5a7230['params']['id'][_0x15d9('0x6b')](),_0x15d9('0x54'))[_0x15d9('0x69')]('NOW()','createdAt')[_0x15d9('0x69')]('NOW()',_0x15d9('0x52'))[_0x15d9('0x6d')](_0x15d9('0x6e'))['where']('deletedAt\x20IS\x20NULL')[_0x15d9('0x37')](_0x15d9('0x70'),_0x2fbc7f[_0x15d9('0x6a')]['toString']())[_0x15d9('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0x15d9('0x6b')]();_0x52011c['push'](db['sequelize'][_0x15d9('0x2d')](_0x5d680f));}return BPromise['all'](_0x52011c);}})[_0x15d9('0x1f')](function(){return _0x1c540c;})[_0x15d9('0x1f')](respondWithResult(_0x71ab6a,null))[_0x15d9('0x3f')](handleError(_0x71ab6a,null));};exports[_0x15d9('0x82')]=function(_0x2a5f7e,_0x5a5430,_0x5ded3b){return db['Campaign']['find']({'where':{'id':_0x2a5f7e[_0x15d9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a5430,null))['then'](function(_0x359efd){if(_0x359efd){return _0x359efd[_0x15d9('0x82')](_0x2a5f7e[_0x15d9('0x2d')][_0x15d9('0x5d')]);}})['then'](function(_0x4ff59b){if(_0x4ff59b){return db[_0x15d9('0x5a')][_0x15d9('0x20')]({'where':{'ListId':_0x2a5f7e['query'][_0x15d9('0x5d')],'CampaignId':_0x2a5f7e[_0x15d9('0x41')]['id']}})[_0x15d9('0x1f')](function(){return _0x4ff59b;});}})[_0x15d9('0x1f')](respondWithStatusCode(_0x5a5430,null))[_0x15d9('0x3f')](handleError(_0x5a5430,null));}; \ No newline at end of file +var _0x6335=['phone','ContactId','field','NOW()','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','scheduledAt','cm_contacts','sequelize','all','removeLists','getBlackLists','CmList','spread','cm_hopper_black','push','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','Campaign','includeAll','include','findAll','catch','params','find','create','role','user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','getHoppers','CmHopper','pick','CampaignId','map','findOne','CmHopperFinal','rows','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','dialCheckDuplicateType','insert','into','cm_hopper'];(function(_0x4378fb,_0xd27d09){var _0x43716f=function(_0x43f0e4){while(--_0x43f0e4){_0x4378fb['push'](_0x4378fb['shift']());}};_0x43716f(++_0xd27d09);}(_0x6335,0xa2));var _0x5633=function(_0x27b61a,_0x4e283b){_0x27b61a=_0x27b61a-0x0;var _0x30ba44=_0x6335[_0x27b61a];return _0x30ba44;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5633('0x0'));var zipdir=require(_0x5633('0x1'));var jsonpatch=require(_0x5633('0x2'));var rp=require(_0x5633('0x3'));var moment=require(_0x5633('0x4'));var BPromise=require(_0x5633('0x5'));var Mustache=require(_0x5633('0x6'));var util=require(_0x5633('0x7'));var path=require(_0x5633('0x8'));var sox=require(_0x5633('0x9'));var csv=require('to-csv');var ejs=require(_0x5633('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5633('0xb'));var squel=require('squel');var crypto=require(_0x5633('0xc'));var jsforce=require(_0x5633('0xd'));var deskjs=require(_0x5633('0xe'));var toCsv=require(_0x5633('0xf'));var querystring=require(_0x5633('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5633('0x11'));var qs=require(_0x5633('0x12'));var as=require(_0x5633('0x13'));var hardwareService=require(_0x5633('0x14'));var logger=require(_0x5633('0x15'))(_0x5633('0x16'));var utils=require('../../config/utils');var config=require(_0x5633('0x17'));var licenseUtil=require(_0x5633('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x262f4e,_0x6c6d41){_0x6c6d41=_0x6c6d41||0xcc;return function(_0x6ed2de){if(_0x6ed2de){return _0x262f4e['sendStatus'](_0x6c6d41);}return _0x262f4e[_0x5633('0x19')](_0x6c6d41)[_0x5633('0x1a')]();};}function respondWithResult(_0x4bf851,_0x58585f){_0x58585f=_0x58585f||0xc8;return function(_0x5b76d9){if(_0x5b76d9){return _0x4bf851[_0x5633('0x19')](_0x58585f)[_0x5633('0x1b')](_0x5b76d9);}};}function respondWithFilteredResult(_0x1a5159,_0x7c5799){return function(_0x378395){if(_0x378395){var _0x310412=typeof _0x7c5799[_0x5633('0x1c')]===_0x5633('0x1d')&&typeof _0x7c5799[_0x5633('0x1e')]===_0x5633('0x1d');var _0x4ddc87=_0x378395[_0x5633('0x1f')];var _0x421c9a=_0x310412?0x0:_0x7c5799[_0x5633('0x1c')];var _0x1df3a0=_0x310412?_0x378395[_0x5633('0x1f')]:_0x7c5799[_0x5633('0x1c')]+_0x7c5799['limit'];var _0x463099;if(_0x1df3a0>=_0x4ddc87){_0x1df3a0=_0x4ddc87;_0x463099=0xc8;}else{_0x463099=0xce;}_0x1a5159[_0x5633('0x19')](_0x463099);return _0x1a5159[_0x5633('0x20')](_0x5633('0x21'),_0x421c9a+'-'+_0x1df3a0+'/'+_0x4ddc87)[_0x5633('0x1b')](_0x378395);}return null;};}function patchUpdates(_0x1938fb){return function(_0x36c988){try{jsonpatch[_0x5633('0x22')](_0x36c988,_0x1938fb,!![]);}catch(_0xfaa5d){return BPromise[_0x5633('0x23')](_0xfaa5d);}return _0x36c988[_0x5633('0x24')]();};}function saveUpdates(_0x421e5a,_0x182f5a){return function(_0x1c62ba){if(_0x1c62ba){return _0x1c62ba['update'](_0x421e5a)['then'](function(_0x25eedd){return _0x25eedd;});}return null;};}function removeEntity(_0x1017e9,_0x534658){return function(_0x297223){if(_0x297223){return _0x297223[_0x5633('0x25')]()[_0x5633('0x26')](function(){var _0x49e374=_0x297223[_0x5633('0x27')]({'plain':!![]});var _0x1917fb=_0x5633('0x28');return db[_0x5633('0x29')][_0x5633('0x25')]({'where':{'type':_0x1917fb,'resourceId':_0x49e374['id']}})[_0x5633('0x26')](function(){return _0x297223;});})[_0x5633('0x26')](function(){_0x1017e9[_0x5633('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x278c09,_0x1bdc55){return function(_0x2c9893){if(!_0x2c9893){_0x278c09[_0x5633('0x2a')](0x194);}return _0x2c9893;};}function handleError(_0x2ac6d3,_0x145a76){_0x145a76=_0x145a76||0x1f4;return function(_0x49a39e){logger[_0x5633('0x2b')](_0x49a39e['stack']);if(_0x49a39e[_0x5633('0x2c')]){delete _0x49a39e[_0x5633('0x2c')];}_0x2ac6d3[_0x5633('0x19')](_0x145a76)[_0x5633('0x2d')](_0x49a39e);};}exports[_0x5633('0x2e')]=function(_0x2ae3be,_0x5beb01){var _0x51cbad={},_0x3c04eb={},_0x4353ad={'count':0x0,'rows':[]};var _0x9d509b=_['map'](db['Campaign'][_0x5633('0x2f')],function(_0x5917b4){return{'name':_0x5917b4[_0x5633('0x30')],'type':_0x5917b4[_0x5633('0x31')][_0x5633('0x32')]};});_0x3c04eb[_0x5633('0x33')]=_['map'](_0x9d509b,_0x5633('0x2c'));_0x3c04eb[_0x5633('0x34')]=_[_0x5633('0x35')](_0x2ae3be['query']);_0x3c04eb[_0x5633('0x36')]=_[_0x5633('0x37')](_0x3c04eb[_0x5633('0x33')],_0x3c04eb[_0x5633('0x34')]);_0x51cbad[_0x5633('0x38')]=_[_0x5633('0x37')](_0x3c04eb[_0x5633('0x33')],qs['fields'](_0x2ae3be[_0x5633('0x34')][_0x5633('0x39')]));_0x51cbad[_0x5633('0x38')]=_0x51cbad[_0x5633('0x38')][_0x5633('0x3a')]?_0x51cbad[_0x5633('0x38')]:_0x3c04eb['model'];if(!_0x2ae3be[_0x5633('0x34')][_0x5633('0x3b')](_0x5633('0x3c'))){_0x51cbad[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x2ae3be['query']['limit']);_0x51cbad['offset']=qs[_0x5633('0x1c')](_0x2ae3be['query'][_0x5633('0x1c')]);}_0x51cbad[_0x5633('0x3d')]=qs[_0x5633('0x3e')](_0x2ae3be[_0x5633('0x34')][_0x5633('0x3e')]);_0x51cbad['where']=qs[_0x5633('0x36')](_['pick'](_0x2ae3be[_0x5633('0x34')],_0x3c04eb[_0x5633('0x36')]),_0x9d509b);if(_0x2ae3be[_0x5633('0x34')][_0x5633('0x3f')]){_0x51cbad[_0x5633('0x40')]=_['merge'](_0x51cbad[_0x5633('0x40')],{'$or':_['map'](_0x9d509b,function(_0xcacee9){if(_0xcacee9[_0x5633('0x31')]!==_0x5633('0x41')){var _0x4f8516={};_0x4f8516[_0xcacee9[_0x5633('0x2c')]]={'$like':'%'+_0x2ae3be[_0x5633('0x34')][_0x5633('0x3f')]+'%'};return _0x4f8516;}})});}_0x51cbad=_[_0x5633('0x42')]({},_0x51cbad,_0x2ae3be[_0x5633('0x43')]);var _0x1d6bb7={'where':_0x51cbad[_0x5633('0x40')]};return db[_0x5633('0x44')]['count'](_0x1d6bb7)['then'](function(_0x1c7e2a){_0x4353ad[_0x5633('0x1f')]=_0x1c7e2a;if(_0x2ae3be['query'][_0x5633('0x45')]){_0x51cbad[_0x5633('0x46')]=[{'all':!![]}];}return db['Campaign'][_0x5633('0x47')](_0x51cbad);})['then'](function(_0x48dcd4){_0x4353ad['rows']=_0x48dcd4;return _0x4353ad;})['then'](respondWithFilteredResult(_0x5beb01,_0x51cbad))[_0x5633('0x48')](handleError(_0x5beb01,null));};exports['show']=function(_0x24524e,_0x1e03f7){var _0x26409d={'raw':![],'where':{'id':_0x24524e[_0x5633('0x49')]['id']}},_0x3f1e26={};_0x3f1e26[_0x5633('0x33')]=_[_0x5633('0x35')](db[_0x5633('0x44')][_0x5633('0x2f')]);_0x3f1e26[_0x5633('0x34')]=_['keys'](_0x24524e[_0x5633('0x34')]);_0x3f1e26[_0x5633('0x36')]=_[_0x5633('0x37')](_0x3f1e26[_0x5633('0x33')],_0x3f1e26[_0x5633('0x34')]);_0x26409d[_0x5633('0x38')]=_['intersection'](_0x3f1e26['model'],qs[_0x5633('0x39')](_0x24524e[_0x5633('0x34')][_0x5633('0x39')]));_0x26409d[_0x5633('0x38')]=_0x26409d['attributes'][_0x5633('0x3a')]?_0x26409d['attributes']:_0x3f1e26[_0x5633('0x33')];if(_0x24524e['query'][_0x5633('0x45')]){_0x26409d[_0x5633('0x46')]=[{'all':!![]}];}_0x26409d=_['merge']({},_0x26409d,_0x24524e[_0x5633('0x43')]);return db[_0x5633('0x44')][_0x5633('0x4a')](_0x26409d)[_0x5633('0x26')](handleEntityNotFound(_0x1e03f7,null))[_0x5633('0x26')](respondWithResult(_0x1e03f7,null))[_0x5633('0x48')](handleError(_0x1e03f7,null));};exports[_0x5633('0x4b')]=function(_0x14c467,_0x1ffa17){return db[_0x5633('0x44')][_0x5633('0x4b')](_0x14c467['body'],{})[_0x5633('0x26')](function(_0x1380a1){var _0x187739=_0x14c467['user']['get']({'plain':!![]});if(!_0x187739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x187739[_0x5633('0x4c')]===_0x5633('0x4d')){var _0x14fcc0=_0x1380a1[_0x5633('0x27')]({'plain':!![]});var _0x34b1c6='IvrCampaigns';return db['UserProfileSection'][_0x5633('0x4a')]({'where':{'name':_0x34b1c6,'userProfileId':_0x187739['userProfileId']},'raw':!![]})['then'](function(_0x10a4f6){if(_0x10a4f6&&_0x10a4f6['autoAssociation']===0x0){return db[_0x5633('0x29')][_0x5633('0x4b')]({'name':_0x14fcc0[_0x5633('0x2c')],'resourceId':_0x14fcc0['id'],'type':_0x10a4f6[_0x5633('0x2c')],'sectionId':_0x10a4f6['id']},{})[_0x5633('0x26')](function(){return _0x1380a1;});}else{return _0x1380a1;}})[_0x5633('0x48')](function(_0x2ba729){logger[_0x5633('0x2b')](_0x5633('0x4e'),_0x2ba729);throw _0x2ba729;});}return _0x1380a1;})[_0x5633('0x26')](respondWithResult(_0x1ffa17,0xc9))[_0x5633('0x48')](handleError(_0x1ffa17,null));};exports[_0x5633('0x4f')]=function(_0xf4d2ab,_0x45b2ef){var _0x26fce0={'where':{'id':_0xf4d2ab[_0x5633('0x49')]['id']}},_0xcae93d={};_0xcae93d[_0x5633('0x33')]=_[_0x5633('0x35')](db[_0x5633('0x44')]['rawAttributes']);_0x26fce0['attributes']=_[_0x5633('0x37')](_0xcae93d[_0x5633('0x33')],qs['fields'](_0xf4d2ab[_0x5633('0x34')][_0x5633('0x39')]));_0x26fce0[_0x5633('0x38')]=_0x26fce0[_0x5633('0x38')][_0x5633('0x3a')]?_0x26fce0[_0x5633('0x38')]:_0xcae93d[_0x5633('0x33')];if(_0xf4d2ab[_0x5633('0x34')][_0x5633('0x45')]){_0x26fce0[_0x5633('0x46')]=[{'all':!![]}];}_0x26fce0=_[_0x5633('0x42')]({},_0x26fce0,_0xf4d2ab[_0x5633('0x43')]);return db[_0x5633('0x44')]['find'](_0x26fce0)[_0x5633('0x26')](handleEntityNotFound(_0x45b2ef,null))[_0x5633('0x26')](function(_0x186aea){if(_0x186aea){var _0x253453=_0x186aea[_0x5633('0x27')]({'plain':!![]});_0x253453=qs[_0x5633('0x50')](_0x253453,['id',_0x5633('0x51'),_0x5633('0x52')]);_0xf4d2ab[_0x5633('0x53')]=_['omit'](_0xf4d2ab[_0x5633('0x53')],['id',_0x5633('0x51'),_0x5633('0x52')]);return db['Campaign'][_0x5633('0x4b')](_['merge'](_0x253453,_0xf4d2ab[_0x5633('0x53')]),{'include':_0xf4d2ab[_0x5633('0x34')][_0x5633('0x45')]?[{'all':!![]}]:undefined})[_0x5633('0x26')](function(_0x33c0d0){var _0x3d628d=_0xf4d2ab[_0x5633('0x4d')][_0x5633('0x27')]({'plain':!![]});if(!_0x3d628d)throw new Error(_0x5633('0x54'));if(_0x3d628d[_0x5633('0x4c')]==='user'){var _0x1db751=_0x33c0d0['get']({'plain':!![]});var _0x41afdf=_0x5633('0x28');return db[_0x5633('0x55')][_0x5633('0x4a')]({'where':{'name':_0x41afdf,'userProfileId':_0x3d628d[_0x5633('0x56')]},'raw':!![]})['then'](function(_0x6f8069){if(_0x6f8069&&_0x6f8069[_0x5633('0x57')]===0x0){return db[_0x5633('0x29')][_0x5633('0x4b')]({'name':_0x1db751[_0x5633('0x2c')],'resourceId':_0x1db751['id'],'type':_0x6f8069[_0x5633('0x2c')],'sectionId':_0x6f8069['id']},{})[_0x5633('0x26')](function(){return _0x33c0d0;});}else{return _0x33c0d0;}})[_0x5633('0x48')](function(_0x451d9f){logger['error'](_0x5633('0x4e'),_0x451d9f);throw _0x451d9f;});}return _0x33c0d0;});}})[_0x5633('0x26')](respondWithResult(_0x45b2ef,0xc9))['catch'](handleError(_0x45b2ef,null));};exports[_0x5633('0x58')]=function(_0x3306b5,_0x5e3dd5){if(_0x3306b5[_0x5633('0x53')]['id']){delete _0x3306b5['body']['id'];}return db['Campaign'][_0x5633('0x4a')]({'where':{'id':_0x3306b5[_0x5633('0x49')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x5e3dd5,null))[_0x5633('0x26')](saveUpdates(_0x3306b5[_0x5633('0x53')],null))['then'](respondWithResult(_0x5e3dd5,null))[_0x5633('0x48')](handleError(_0x5e3dd5,null));};exports[_0x5633('0x25')]=function(_0x5b69ea,_0x239eaf){return db[_0x5633('0x44')][_0x5633('0x4a')]({'where':{'id':_0x5b69ea['params']['id']}})['then'](handleEntityNotFound(_0x239eaf,null))[_0x5633('0x26')](removeEntity(_0x239eaf,null))[_0x5633('0x48')](handleError(_0x239eaf,null));};exports[_0x5633('0x59')]=function(_0x259abf,_0x3e5aa4,_0x51d6b6){var _0x4b71e6={'raw':!![],'where':{}};var _0x4296fd={};var _0x4f59c1={'count':0x0,'rows':[]};return db[_0x5633('0x44')]['findOne']({'where':{'id':_0x259abf[_0x5633('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e5aa4,null))['then'](function(_0xa738a1){if(_0xa738a1){_0x4296fd[_0x5633('0x33')]=_[_0x5633('0x35')](db[_0x5633('0x5a')]['rawAttributes']);_0x4296fd[_0x5633('0x34')]=_[_0x5633('0x35')](_0x259abf['query']);_0x4296fd['filters']=_['intersection'](_0x4296fd[_0x5633('0x33')],_0x4296fd[_0x5633('0x34')]);_0x4b71e6[_0x5633('0x38')]=_[_0x5633('0x37')](_0x4296fd['model'],qs[_0x5633('0x39')](_0x259abf[_0x5633('0x34')][_0x5633('0x39')]));_0x4b71e6[_0x5633('0x38')]=_0x4b71e6[_0x5633('0x38')][_0x5633('0x3a')]?_0x4b71e6[_0x5633('0x38')]:_0x4296fd[_0x5633('0x33')];if(!_0x259abf[_0x5633('0x34')][_0x5633('0x3b')](_0x5633('0x3c'))){_0x4b71e6[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x259abf[_0x5633('0x34')][_0x5633('0x1e')]);_0x4b71e6[_0x5633('0x1c')]=qs[_0x5633('0x1c')](_0x259abf['query'][_0x5633('0x1c')]);}_0x4b71e6[_0x5633('0x3d')]=qs[_0x5633('0x3e')](_0x259abf[_0x5633('0x34')][_0x5633('0x3e')]);_0x4b71e6['where']=qs[_0x5633('0x36')](_[_0x5633('0x5b')](_0x259abf[_0x5633('0x34')],_0x4296fd[_0x5633('0x36')]));_0x4b71e6[_0x5633('0x40')][_0x5633('0x5c')]=_0xa738a1['id'];if(_0x259abf[_0x5633('0x34')][_0x5633('0x3f')]){_0x4b71e6[_0x5633('0x40')]=_[_0x5633('0x42')](_0x4b71e6['where'],{'$or':_[_0x5633('0x5d')](_0x4b71e6['attributes'],function(_0x42aad6){var _0xa158={};_0xa158[_0x42aad6]={'$like':'%'+_0x259abf[_0x5633('0x34')][_0x5633('0x3f')]+'%'};return _0xa158;})});}_0x4b71e6=_[_0x5633('0x42')]({},_0x4b71e6,_0x259abf[_0x5633('0x43')]);return db[_0x5633('0x5a')][_0x5633('0x1f')]({'where':_0x4b71e6['where']})['then'](function(_0x1360a7){_0x4f59c1[_0x5633('0x1f')]=_0x1360a7;if(_0x259abf['query'][_0x5633('0x45')]){_0x4b71e6[_0x5633('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x5633('0x47')](_0x4b71e6);})[_0x5633('0x26')](function(_0x124353){_0x4f59c1['rows']=_0x124353;return _0x4f59c1;});}})[_0x5633('0x26')](respondWithFilteredResult(_0x3e5aa4,_0x4b71e6))[_0x5633('0x48')](handleError(_0x3e5aa4,null));};exports['getHopperHistories']=function(_0x31983c,_0x3882cd,_0x590f91){var _0x2e5aa9={'raw':!![],'where':{}};var _0x2036b5={};var _0x5c0847={'count':0x0,'rows':[]};return db[_0x5633('0x44')][_0x5633('0x5e')]({'where':{'id':_0x31983c[_0x5633('0x49')]['id']}})['then'](handleEntityNotFound(_0x3882cd,null))[_0x5633('0x26')](function(_0x47bccd){if(_0x47bccd){_0x2036b5['model']=_[_0x5633('0x35')](db['CmHopperHistory'][_0x5633('0x2f')]);_0x2036b5['query']=_[_0x5633('0x35')](_0x31983c[_0x5633('0x34')]);_0x2036b5[_0x5633('0x36')]=_['intersection'](_0x2036b5['model'],_0x2036b5[_0x5633('0x34')]);_0x2e5aa9[_0x5633('0x38')]=_[_0x5633('0x37')](_0x2036b5['model'],qs[_0x5633('0x39')](_0x31983c['query'][_0x5633('0x39')]));_0x2e5aa9[_0x5633('0x38')]=_0x2e5aa9[_0x5633('0x38')][_0x5633('0x3a')]?_0x2e5aa9['attributes']:_0x2036b5[_0x5633('0x33')];if(!_0x31983c[_0x5633('0x34')]['hasOwnProperty'](_0x5633('0x3c'))){_0x2e5aa9[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x31983c[_0x5633('0x34')][_0x5633('0x1e')]);_0x2e5aa9[_0x5633('0x1c')]=qs[_0x5633('0x1c')](_0x31983c[_0x5633('0x34')][_0x5633('0x1c')]);}_0x2e5aa9[_0x5633('0x3d')]=qs[_0x5633('0x3e')](_0x31983c[_0x5633('0x34')][_0x5633('0x3e')]);_0x2e5aa9[_0x5633('0x40')]=qs[_0x5633('0x36')](_[_0x5633('0x5b')](_0x31983c[_0x5633('0x34')],_0x2036b5[_0x5633('0x36')]));_0x2e5aa9['where'][_0x5633('0x5c')]=_0x47bccd['id'];if(_0x31983c['query'][_0x5633('0x3f')]){_0x2e5aa9[_0x5633('0x40')]=_[_0x5633('0x42')](_0x2e5aa9[_0x5633('0x40')],{'$or':_[_0x5633('0x5d')](_0x2e5aa9[_0x5633('0x38')],function(_0x416266){var _0x5816eb={};_0x5816eb[_0x416266]={'$like':'%'+_0x31983c['query'][_0x5633('0x3f')]+'%'};return _0x5816eb;})});}_0x2e5aa9=_[_0x5633('0x42')]({},_0x2e5aa9,_0x31983c[_0x5633('0x43')]);return db['CmHopperHistory']['count']({'where':_0x2e5aa9['where']})[_0x5633('0x26')](function(_0xd28184){_0x5c0847[_0x5633('0x1f')]=_0xd28184;if(_0x31983c['query'][_0x5633('0x45')]){_0x2e5aa9[_0x5633('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5633('0x47')](_0x2e5aa9);})[_0x5633('0x26')](function(_0x147d74){_0x5c0847['rows']=_0x147d74;return _0x5c0847;});}})[_0x5633('0x26')](respondWithFilteredResult(_0x3882cd,_0x2e5aa9))[_0x5633('0x48')](handleError(_0x3882cd,null));};exports['getHopperFinals']=function(_0x3008f5,_0x43b8a5,_0x2cd68a){var _0x4ab6e7={'raw':!![],'where':{}};var _0x249447={};var _0x126627={'count':0x0,'rows':[]};return db[_0x5633('0x44')][_0x5633('0x5e')]({'where':{'id':_0x3008f5[_0x5633('0x49')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x43b8a5,null))[_0x5633('0x26')](function(_0x8bdc05){if(_0x8bdc05){_0x249447[_0x5633('0x33')]=_[_0x5633('0x35')](db[_0x5633('0x5f')]['rawAttributes']);_0x249447['query']=_[_0x5633('0x35')](_0x3008f5[_0x5633('0x34')]);_0x249447['filters']=_[_0x5633('0x37')](_0x249447[_0x5633('0x33')],_0x249447['query']);_0x4ab6e7['attributes']=_[_0x5633('0x37')](_0x249447['model'],qs[_0x5633('0x39')](_0x3008f5['query']['fields']));_0x4ab6e7[_0x5633('0x38')]=_0x4ab6e7[_0x5633('0x38')][_0x5633('0x3a')]?_0x4ab6e7['attributes']:_0x249447[_0x5633('0x33')];if(!_0x3008f5[_0x5633('0x34')][_0x5633('0x3b')](_0x5633('0x3c'))){_0x4ab6e7[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x3008f5['query'][_0x5633('0x1e')]);_0x4ab6e7[_0x5633('0x1c')]=qs['offset'](_0x3008f5[_0x5633('0x34')][_0x5633('0x1c')]);}_0x4ab6e7[_0x5633('0x3d')]=qs[_0x5633('0x3e')](_0x3008f5[_0x5633('0x34')][_0x5633('0x3e')]);_0x4ab6e7[_0x5633('0x40')]=qs[_0x5633('0x36')](_[_0x5633('0x5b')](_0x3008f5['query'],_0x249447[_0x5633('0x36')]));_0x4ab6e7[_0x5633('0x40')][_0x5633('0x5c')]=_0x8bdc05['id'];if(_0x3008f5[_0x5633('0x34')][_0x5633('0x3f')]){_0x4ab6e7['where']=_[_0x5633('0x42')](_0x4ab6e7[_0x5633('0x40')],{'$or':_['map'](_0x4ab6e7[_0x5633('0x38')],function(_0x3fd8d9){var _0x2797c3={};_0x2797c3[_0x3fd8d9]={'$like':'%'+_0x3008f5[_0x5633('0x34')]['filter']+'%'};return _0x2797c3;})});}_0x4ab6e7=_['merge']({},_0x4ab6e7,_0x3008f5[_0x5633('0x43')]);return db['CmHopperFinal'][_0x5633('0x1f')]({'where':_0x4ab6e7[_0x5633('0x40')]})[_0x5633('0x26')](function(_0x4530e9){_0x126627[_0x5633('0x1f')]=_0x4530e9;if(_0x3008f5['query'][_0x5633('0x45')]){_0x4ab6e7[_0x5633('0x46')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5633('0x47')](_0x4ab6e7);})[_0x5633('0x26')](function(_0x1283d4){_0x126627[_0x5633('0x60')]=_0x1283d4;return _0x126627;});}})[_0x5633('0x26')](respondWithFilteredResult(_0x43b8a5,_0x4ab6e7))[_0x5633('0x48')](handleError(_0x43b8a5,null));};exports[_0x5633('0x61')]=function(_0x49ed41,_0xdc58cc,_0x3cd940){var _0x3ef375={'raw':!![],'where':{}};var _0x26ac49={};var _0x275379={'count':0x0,'rows':[]};return db['Campaign'][_0x5633('0x5e')]({'where':{'id':_0x49ed41[_0x5633('0x49')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0xdc58cc,null))[_0x5633('0x26')](function(_0x3e37cd){if(_0x3e37cd){_0x26ac49[_0x5633('0x33')]=_[_0x5633('0x35')](db['CmHopperBlack'][_0x5633('0x2f')]);_0x26ac49[_0x5633('0x34')]=_['keys'](_0x49ed41[_0x5633('0x34')]);_0x26ac49[_0x5633('0x36')]=_[_0x5633('0x37')](_0x26ac49[_0x5633('0x33')],_0x26ac49['query']);_0x3ef375['attributes']=_[_0x5633('0x37')](_0x26ac49['model'],qs['fields'](_0x49ed41['query']['fields']));_0x3ef375[_0x5633('0x38')]=_0x3ef375[_0x5633('0x38')][_0x5633('0x3a')]?_0x3ef375['attributes']:_0x26ac49[_0x5633('0x33')];if(!_0x49ed41[_0x5633('0x34')][_0x5633('0x3b')](_0x5633('0x3c'))){_0x3ef375[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x49ed41[_0x5633('0x34')][_0x5633('0x1e')]);_0x3ef375[_0x5633('0x1c')]=qs[_0x5633('0x1c')](_0x49ed41[_0x5633('0x34')][_0x5633('0x1c')]);}_0x3ef375[_0x5633('0x3d')]=qs[_0x5633('0x3e')](_0x49ed41[_0x5633('0x34')][_0x5633('0x3e')]);_0x3ef375[_0x5633('0x40')]=qs[_0x5633('0x36')](_['pick'](_0x49ed41[_0x5633('0x34')],_0x26ac49[_0x5633('0x36')]));_0x3ef375[_0x5633('0x40')][_0x5633('0x5c')]=_0x3e37cd['id'];if(_0x49ed41['query'][_0x5633('0x3f')]){_0x3ef375['where']=_['merge'](_0x3ef375[_0x5633('0x40')],{'$or':_[_0x5633('0x5d')](_0x3ef375[_0x5633('0x38')],function(_0x5098c9){var _0x5e849e={};_0x5e849e[_0x5098c9]={'$like':'%'+_0x49ed41[_0x5633('0x34')][_0x5633('0x3f')]+'%'};return _0x5e849e;})});}_0x3ef375=_[_0x5633('0x42')]({},_0x3ef375,_0x49ed41['options']);return db[_0x5633('0x62')][_0x5633('0x1f')]({'where':_0x3ef375[_0x5633('0x40')]})[_0x5633('0x26')](function(_0x528370){_0x275379[_0x5633('0x1f')]=_0x528370;if(_0x49ed41[_0x5633('0x34')][_0x5633('0x45')]){_0x3ef375[_0x5633('0x46')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5633('0x47')](_0x3ef375);})['then'](function(_0x49cd5e){_0x275379['rows']=_0x49cd5e;return _0x275379;});}})[_0x5633('0x26')](respondWithFilteredResult(_0xdc58cc,_0x3ef375))[_0x5633('0x48')](handleError(_0xdc58cc,null));};exports[_0x5633('0x63')]=function(_0x406d0b,_0x2fe03f,_0x456041){var _0x44c98d={};var _0x108341={};var _0x4f701b;var _0x5ae9d8;return db[_0x5633('0x44')][_0x5633('0x5e')]({'where':{'id':_0x406d0b[_0x5633('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe03f,null))[_0x5633('0x26')](function(_0x594053){if(_0x594053){_0x4f701b=_0x594053;_0x108341['model']=_[_0x5633('0x35')](db['CmList'][_0x5633('0x2f')]);_0x108341[_0x5633('0x34')]=_[_0x5633('0x35')](_0x406d0b['query']);_0x108341[_0x5633('0x36')]=_[_0x5633('0x37')](_0x108341['model'],_0x108341[_0x5633('0x34')]);_0x44c98d[_0x5633('0x38')]=_[_0x5633('0x37')](_0x108341[_0x5633('0x33')],qs[_0x5633('0x39')](_0x406d0b[_0x5633('0x34')]['fields']));_0x44c98d[_0x5633('0x38')]=_0x44c98d[_0x5633('0x38')][_0x5633('0x3a')]?_0x44c98d[_0x5633('0x38')]:_0x108341[_0x5633('0x33')];_0x44c98d['order']=qs[_0x5633('0x3e')](_0x406d0b[_0x5633('0x34')][_0x5633('0x3e')]);_0x44c98d[_0x5633('0x40')]=qs[_0x5633('0x36')](_[_0x5633('0x5b')](_0x406d0b['query'],_0x108341[_0x5633('0x36')]));if(_0x406d0b[_0x5633('0x34')][_0x5633('0x3f')]){_0x44c98d['where']=_['merge'](_0x44c98d[_0x5633('0x40')],{'$or':_['map'](_0x44c98d['attributes'],function(_0x25d8d1){var _0x120dcd={};_0x120dcd[_0x25d8d1]={'$like':'%'+_0x406d0b['query'][_0x5633('0x3f')]+'%'};return _0x120dcd;})});}_0x44c98d=_[_0x5633('0x42')]({},_0x44c98d,_0x406d0b[_0x5633('0x43')]);return _0x4f701b[_0x5633('0x63')](_0x44c98d);}})[_0x5633('0x26')](function(_0x5be6e1){if(_0x5be6e1){_0x5ae9d8=_0x5be6e1[_0x5633('0x3a')];if(!_0x406d0b['query']['hasOwnProperty'](_0x5633('0x3c'))){_0x44c98d['limit']=qs[_0x5633('0x1e')](_0x406d0b[_0x5633('0x34')][_0x5633('0x1e')]);_0x44c98d['offset']=qs[_0x5633('0x1c')](_0x406d0b['query']['offset']);}return _0x4f701b[_0x5633('0x63')](_0x44c98d);}})[_0x5633('0x26')](function(_0x4eaca4){if(_0x4eaca4){return _0x4eaca4?{'count':_0x5ae9d8,'rows':_0x4eaca4}:null;}})[_0x5633('0x26')](respondWithResult(_0x2fe03f,null))[_0x5633('0x48')](handleError(_0x2fe03f,null));};exports[_0x5633('0x64')]=function(_0xadbef0,_0x18b2b8,_0x14b127){var _0x38000f,_0x58f15c;return db['Campaign'][_0x5633('0x4a')]({'where':{'id':_0xadbef0[_0x5633('0x49')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x18b2b8,null))['then'](function(_0x3feaca){if(_0x3feaca){_0x58f15c=_0x3feaca;return _0x3feaca[_0x5633('0x64')](_0xadbef0[_0x5633('0x53')][_0x5633('0x65')],_['omit'](_0xadbef0['body'],[_0x5633('0x65'),'id'])||{});}return null;})['spread'](function(_0x5d6c33){var _0x3e254a;_0x38000f=_0x5d6c33||[];var _0x31bb0c=[];if(_0x5d6c33){for(var _0xdb8a47=0x0;_0xdb8a47<_0x5d6c33[_0x5633('0x3a')];_0xdb8a47+=0x1){var _0x41f33c=_0x5d6c33[_0xdb8a47][_0x5633('0x27')]({'plain':!![]});_0x58f15c[_0x5633('0x66')]=_0xadbef0['body'][_0x5633('0x66')]?_0xadbef0[_0x5633('0x53')][_0x5633('0x66')]:_0x58f15c['dialCheckDuplicateType'];switch(_0x58f15c['dialCheckDuplicateType']){case'always':_0x3e254a=squel[_0x5633('0x67')]()[_0x5633('0x68')](_0x5633('0x69'))['fromQuery']([_0x5633('0x6a'),'scheduledAt',_0x5633('0x6b'),'ListId',_0x5633('0x5c'),'createdAt',_0x5633('0x52')],squel['select']()[_0x5633('0x6c')](_0x5633('0x6a'),_0x5633('0x6a'))[_0x5633('0x6c')](_0x5633('0x6d'),'scheduledAt')[_0x5633('0x6c')]('id',_0x5633('0x6b'))['field'](_0x41f33c[_0x5633('0x6e')][_0x5633('0x6f')](),_0x5633('0x70'))[_0x5633('0x6c')](_0xadbef0[_0x5633('0x49')]['id'][_0x5633('0x6f')](),'CampaignId')[_0x5633('0x6c')](_0x5633('0x6d'),_0x5633('0x51'))[_0x5633('0x6c')](_0x5633('0x6d'),_0x5633('0x52'))[_0x5633('0x71')]('cm_contacts')[_0x5633('0x40')](_0x5633('0x72'))[_0x5633('0x40')](_0x5633('0x73'),_0x41f33c['CmListId'][_0x5633('0x6f')]())[_0x5633('0x40')](_0x5633('0x74'))[_0x5633('0x40')](_0x5633('0x75'),squel[_0x5633('0x76')]()[_0x5633('0x6c')]('COALESCE(calleridnum,\x27\x27)')[_0x5633('0x71')]('cm_hopper_final')[_0x5633('0x40')](_0x5633('0x77'),_0xadbef0[_0x5633('0x49')]['id']['toString']()))['where'](_0x5633('0x75'),squel[_0x5633('0x76')]()[_0x5633('0x6c')](_0x5633('0x78'))[_0x5633('0x71')](_0x5633('0x69'))['where'](_0x5633('0x77'),_0xadbef0[_0x5633('0x49')]['id'][_0x5633('0x6f')]())))[_0x5633('0x6f')]();break;case _0x5633('0x79'):_0x3e254a=squel[_0x5633('0x67')]()[_0x5633('0x68')]('cm_hopper')[_0x5633('0x7a')]([_0x5633('0x6a'),_0x5633('0x7b'),_0x5633('0x6b'),_0x5633('0x70'),_0x5633('0x5c'),_0x5633('0x51'),_0x5633('0x52')],squel[_0x5633('0x76')]()[_0x5633('0x6c')](_0x5633('0x6a'),_0x5633('0x6a'))[_0x5633('0x6c')](_0x5633('0x6d'),'scheduledAt')[_0x5633('0x6c')]('id',_0x5633('0x6b'))[_0x5633('0x6c')](_0x41f33c[_0x5633('0x6e')][_0x5633('0x6f')](),_0x5633('0x70'))[_0x5633('0x6c')](_0xadbef0['params']['id'][_0x5633('0x6f')](),_0x5633('0x5c'))['field'](_0x5633('0x6d'),'createdAt')[_0x5633('0x6c')]('NOW()',_0x5633('0x52'))[_0x5633('0x71')](_0x5633('0x7c'))[_0x5633('0x40')](_0x5633('0x72'))[_0x5633('0x40')](_0x5633('0x73'),_0x41f33c[_0x5633('0x6e')]['toString']())['where'](_0x5633('0x74'))[_0x5633('0x40')](_0x5633('0x75'),squel['select']()[_0x5633('0x6c')](_0x5633('0x78'))['from'](_0x5633('0x69'))[_0x5633('0x40')](_0x5633('0x77'),_0xadbef0['params']['id']['toString']())))['toString']();break;default:_0x3e254a=squel[_0x5633('0x67')]()[_0x5633('0x68')](_0x5633('0x69'))[_0x5633('0x7a')]([_0x5633('0x6a'),'scheduledAt',_0x5633('0x6b'),_0x5633('0x70'),_0x5633('0x5c'),'createdAt',_0x5633('0x52')],squel['select']()[_0x5633('0x6c')](_0x5633('0x6a'),_0x5633('0x6a'))['field'](_0x5633('0x6d'),_0x5633('0x7b'))[_0x5633('0x6c')]('id','ContactId')[_0x5633('0x6c')](_0x41f33c[_0x5633('0x6e')][_0x5633('0x6f')](),'ListId')['field'](_0xadbef0[_0x5633('0x49')]['id']['toString'](),_0x5633('0x5c'))[_0x5633('0x6c')](_0x5633('0x6d'),_0x5633('0x51'))[_0x5633('0x6c')](_0x5633('0x6d'),'updatedAt')['from']('cm_contacts')[_0x5633('0x40')](_0x5633('0x72'))[_0x5633('0x40')](_0x5633('0x73'),_0x41f33c['CmListId']['toString']())[_0x5633('0x40')](_0x5633('0x74')))['toString']();}_0x31bb0c['push'](db[_0x5633('0x7d')][_0x5633('0x34')](_0x3e254a));}return BPromise[_0x5633('0x7e')](_0x31bb0c);}})['then'](function(){return _0x38000f;})['then'](respondWithResult(_0x18b2b8,null))['catch'](handleError(_0x18b2b8,null));};exports[_0x5633('0x7f')]=function(_0x44fc78,_0x5eaaa8,_0x4d1ea6){return db['Campaign']['find']({'where':{'id':_0x44fc78[_0x5633('0x49')]['id']}})['then'](handleEntityNotFound(_0x5eaaa8,null))['then'](function(_0x2e8fc6){if(_0x2e8fc6){return _0x2e8fc6[_0x5633('0x7f')](_0x44fc78[_0x5633('0x34')][_0x5633('0x65')]);}})[_0x5633('0x26')](function(_0x50f3a3){if(_0x50f3a3){return db[_0x5633('0x5a')]['destroy']({'where':{'ListId':_0x44fc78[_0x5633('0x34')][_0x5633('0x65')],'CampaignId':_0x44fc78['params']['id']}})[_0x5633('0x26')](function(){return _0x50f3a3;});}})[_0x5633('0x26')](respondWithStatusCode(_0x5eaaa8,null))[_0x5633('0x48')](handleError(_0x5eaaa8,null));};exports[_0x5633('0x80')]=function(_0x467241,_0x5592be,_0x4274d5){var _0x273bc6={};var _0x3c7073={};var _0x43c896;var _0x4de151;return db[_0x5633('0x44')]['findOne']({'where':{'id':_0x467241[_0x5633('0x49')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x5592be,null))[_0x5633('0x26')](function(_0x23adf4){if(_0x23adf4){_0x43c896=_0x23adf4;_0x3c7073[_0x5633('0x33')]=_[_0x5633('0x35')](db[_0x5633('0x81')][_0x5633('0x2f')]);_0x3c7073[_0x5633('0x34')]=_['keys'](_0x467241[_0x5633('0x34')]);_0x3c7073[_0x5633('0x36')]=_['intersection'](_0x3c7073['model'],_0x3c7073[_0x5633('0x34')]);_0x273bc6[_0x5633('0x38')]=_[_0x5633('0x37')](_0x3c7073['model'],qs[_0x5633('0x39')](_0x467241['query'][_0x5633('0x39')]));_0x273bc6['attributes']=_0x273bc6[_0x5633('0x38')][_0x5633('0x3a')]?_0x273bc6[_0x5633('0x38')]:_0x3c7073[_0x5633('0x33')];_0x273bc6[_0x5633('0x3d')]=qs['sort'](_0x467241[_0x5633('0x34')][_0x5633('0x3e')]);_0x273bc6[_0x5633('0x40')]=qs['filters'](_['pick'](_0x467241[_0x5633('0x34')],_0x3c7073[_0x5633('0x36')]));if(_0x467241[_0x5633('0x34')]['filter']){_0x273bc6[_0x5633('0x40')]=_[_0x5633('0x42')](_0x273bc6[_0x5633('0x40')],{'$or':_[_0x5633('0x5d')](_0x273bc6['attributes'],function(_0x1c70e4){var _0x1fb816={};_0x1fb816[_0x1c70e4]={'$like':'%'+_0x467241[_0x5633('0x34')][_0x5633('0x3f')]+'%'};return _0x1fb816;})});}_0x273bc6=_[_0x5633('0x42')]({},_0x273bc6,_0x467241['options']);return _0x43c896[_0x5633('0x80')](_0x273bc6);}})['then'](function(_0x170ac4){if(_0x170ac4){_0x4de151=_0x170ac4[_0x5633('0x3a')];if(!_0x467241['query'][_0x5633('0x3b')](_0x5633('0x3c'))){_0x273bc6[_0x5633('0x1e')]=qs[_0x5633('0x1e')](_0x467241['query'][_0x5633('0x1e')]);_0x273bc6[_0x5633('0x1c')]=qs[_0x5633('0x1c')](_0x467241[_0x5633('0x34')][_0x5633('0x1c')]);}return _0x43c896[_0x5633('0x80')](_0x273bc6);}})[_0x5633('0x26')](function(_0x6f60c4){if(_0x6f60c4){return _0x6f60c4?{'count':_0x4de151,'rows':_0x6f60c4}:null;}})['then'](respondWithResult(_0x5592be,null))[_0x5633('0x48')](handleError(_0x5592be,null));};exports['addBlackLists']=function(_0x2a4215,_0x2ab456,_0x2c8f8e){var _0x42439a,_0x51179b;return db['Campaign'][_0x5633('0x4a')]({'where':{'id':_0x2a4215['params']['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x2ab456,null))[_0x5633('0x26')](function(_0x21acd3){if(_0x21acd3){_0x51179b=_0x21acd3;return _0x21acd3['addBlackLists'](_0x2a4215[_0x5633('0x53')]['ids'],_[_0x5633('0x50')](_0x2a4215['body'],[_0x5633('0x65'),'id'])||{});}return null;})[_0x5633('0x82')](function(_0x2c0f46){var _0x1cb7b5;_0x42439a=_0x2c0f46||[];var _0x3f8436=[];if(_0x2c0f46){for(var _0x5b3206=0x0;_0x5b3206<_0x2c0f46[_0x5633('0x3a')];_0x5b3206+=0x1){var _0x2df3a7=_0x2c0f46[_0x5b3206]['get']({'plain':!![]});_0x1cb7b5=squel[_0x5633('0x67')]()[_0x5633('0x68')](_0x5633('0x83'))['fromQuery']([_0x5633('0x6a'),_0x5633('0x6b'),_0x5633('0x70'),_0x5633('0x5c'),_0x5633('0x51'),_0x5633('0x52')],squel['select']()['field'](_0x5633('0x6a'),_0x5633('0x6a'))[_0x5633('0x6c')]('id',_0x5633('0x6b'))['field'](_0x2df3a7['CmListId'][_0x5633('0x6f')](),_0x5633('0x70'))['field'](_0x2a4215[_0x5633('0x49')]['id'][_0x5633('0x6f')](),_0x5633('0x5c'))[_0x5633('0x6c')](_0x5633('0x6d'),'createdAt')[_0x5633('0x6c')](_0x5633('0x6d'),_0x5633('0x52'))['from'](_0x5633('0x7c'))[_0x5633('0x40')](_0x5633('0x72'))[_0x5633('0x40')]('ListId\x20=\x20?',_0x2df3a7[_0x5633('0x6e')][_0x5633('0x6f')]())[_0x5633('0x40')](_0x5633('0x74')))['toString']();_0x3f8436[_0x5633('0x84')](db[_0x5633('0x7d')][_0x5633('0x34')](_0x1cb7b5));}return BPromise[_0x5633('0x7e')](_0x3f8436);}})[_0x5633('0x26')](function(){return _0x42439a;})['then'](respondWithResult(_0x2ab456,null))[_0x5633('0x48')](handleError(_0x2ab456,null));};exports[_0x5633('0x85')]=function(_0x2912d0,_0x470153,_0x4530d0){return db[_0x5633('0x44')][_0x5633('0x4a')]({'where':{'id':_0x2912d0['params']['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x470153,null))[_0x5633('0x26')](function(_0x2cc9df){if(_0x2cc9df){return _0x2cc9df[_0x5633('0x85')](_0x2912d0[_0x5633('0x34')]['ids']);}})[_0x5633('0x26')](function(_0x16133f){if(_0x16133f){return db[_0x5633('0x62')][_0x5633('0x25')]({'where':{'ListId':_0x2912d0[_0x5633('0x34')]['ids'],'CampaignId':_0x2912d0['params']['id']}})['then'](function(){return _0x16133f;});}})['then'](respondWithStatusCode(_0x470153,null))[_0x5633('0x48')](handleError(_0x470153,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f179bae..c069392 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x24e91d,_0x5d6ffe){var _0x324d8d=function(_0x53a0e0){while(--_0x53a0e0){_0x24e91d['push'](_0x24e91d['shift']());}};_0x324d8d(++_0x5d6ffe);}(_0x7a54,0x106));var _0x47a5=function(_0x56f64c,_0xac934e){_0x56f64c=_0x56f64c-0x0;var _0x175a7e=_0x7a54[_0x56f64c];return _0x175a7e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x28e919,_0x145939){var _0x692b7e=function(_0x1514ae){while(--_0x1514ae){_0x28e919['push'](_0x28e919['shift']());}};_0x692b7e(++_0x145939);}(_0x7a54,0x106));var _0x47a5=function(_0x44b329,_0x58dae5){_0x44b329=_0x44b329-0x0;var _0x4a9bb4=_0x7a54[_0x44b329];return _0x4a9bb4;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ade0eee..ab2ea99 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 _0x41bb=['catch','GetCampaign','findAll','options','raw','attributes','limit','include','map','model','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x199b64,_0x5d1120){var _0x42b220=function(_0x26d4e6){while(--_0x26d4e6){_0x199b64['push'](_0x199b64['shift']());}};_0x42b220(++_0x5d1120);}(_0x41bb,0xc5));var _0xb41b=function(_0xf11c21,_0x47c0e2){_0xf11c21=_0xf11c21-0x0;var _0x1f5902=_0x41bb[_0xf11c21];return _0x1f5902;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('Campaign,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['Campaign'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetCampaign',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});}; \ No newline at end of file +var _0x6c76=['moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','map','include','model','GetCampaign','debug','lodash','util'];(function(_0x169ed3,_0x113a9f){var _0x5b35b0=function(_0x165cbd){while(--_0x165cbd){_0x169ed3['push'](_0x169ed3['shift']());}};_0x5b35b0(++_0x113a9f);}(_0x6c76,0x184));var _0x66c7=function(_0x1d9efb,_0x8f7c19){_0x1d9efb=_0x1d9efb-0x0;var _0x5469fa=_0x6c76[_0x1d9efb];return _0x5469fa;};'use strict';var _=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var moment=require(_0x66c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x66c7('0x3'));var fs=require('fs');var Redis=require(_0x66c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x66c7('0x7'));var client=jayson[_0x66c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23408c,_0x4dffcd,_0x4fa6ce){return new BPromise(function(_0x208d06,_0x2b0065){return client[_0x66c7('0x9')](_0x23408c,_0x4fa6ce)['then'](function(_0x20c010){logger[_0x66c7('0xa')](_0x66c7('0xb'),_0x4dffcd,_0x66c7('0xc'));logger['debug'](_0x66c7('0xd'),_0x4dffcd,_0x66c7('0xc'),JSON[_0x66c7('0xe')](_0x20c010));if(_0x20c010[_0x66c7('0xf')]){if(_0x20c010[_0x66c7('0xf')][_0x66c7('0x10')]===0x1f4){logger[_0x66c7('0xf')]('Campaign,\x20%s,\x20%s',_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x2b0065(_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);}logger[_0x66c7('0xf')](_0x66c7('0xb'),_0x4dffcd,_0x20c010[_0x66c7('0xf')][_0x66c7('0x11')]);return _0x208d06(_0x20c010[_0x66c7('0xf')]['message']);}else{logger[_0x66c7('0xa')]('Campaign,\x20%s,\x20%s',_0x4dffcd,_0x66c7('0xc'));_0x208d06(_0x20c010[_0x66c7('0x12')][_0x66c7('0x11')]);}})[_0x66c7('0x13')](function(_0x22b262){logger['error']('Campaign,\x20%s,\x20%s',_0x4dffcd,_0x22b262);_0x2b0065(_0x22b262);});});}exports['GetCampaign']=function(_0x5129f6){var _0x8ad572=this;return new Promise(function(_0x19f29d,_0x47a299){return db['Campaign'][_0x66c7('0x14')]({'raw':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x16')]===undefined?!![]:![]:!![],'where':_0x5129f6['options']?_0x5129f6['options'][_0x66c7('0x17')]||null:null,'attributes':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')][_0x66c7('0x18')]||null:null,'limit':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['limit']||null:null,'include':_0x5129f6[_0x66c7('0x15')]?_0x5129f6[_0x66c7('0x15')]['include']?_[_0x66c7('0x19')](_0x5129f6[_0x66c7('0x15')][_0x66c7('0x1a')],function(_0x1fc9d3){return{'model':db[_0x1fc9d3['model']],'as':_0x1fc9d3['as'],'attributes':_0x1fc9d3[_0x66c7('0x18')],'include':_0x1fc9d3[_0x66c7('0x1a')]?_['map'](_0x1fc9d3[_0x66c7('0x1a')],function(_0x11a6b9){return{'model':db[_0x11a6b9[_0x66c7('0x1b')]],'as':_0x11a6b9['as'],'attributes':_0x11a6b9[_0x66c7('0x18')],'include':_0x11a6b9[_0x66c7('0x1a')]?_['map'](_0x11a6b9['include'],function(_0x4e514a){return{'model':db[_0x4e514a[_0x66c7('0x1b')]],'as':_0x4e514a['as'],'attributes':_0x4e514a[_0x66c7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9afd50){logger[_0x66c7('0xa')](_0x66c7('0x1c'),_0x5129f6);logger[_0x66c7('0x1d')](_0x66c7('0x1c'),_0x5129f6,JSON[_0x66c7('0xe')](_0x9afd50));_0x19f29d(_0x9afd50);})['catch'](function(_0xccefb2){logger[_0x66c7('0xf')](_0x66c7('0x1c'),_0xccefb2[_0x66c7('0x11')],_0x5129f6);_0x47a299(_0x8ad572[_0x66c7('0xf')](0x1f4,_0xccefb2['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 474dda0..d8b4186 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 _0x9762=['Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','getBlackLists','post','create','/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeLists','util','path','connect-timeout','express'];(function(_0x3f8c03,_0x24447b){var _0x2a9f40=function(_0x5ee245){while(--_0x5ee245){_0x3f8c03['push'](_0x3f8c03['shift']());}};_0x2a9f40(++_0x24447b);}(_0x9762,0x19c));var _0x2976=function(_0x3da599,_0x12a4fc){_0x3da599=_0x3da599-0x0;var _0x496e9e=_0x9762[_0x3da599];return _0x496e9e;};'use strict';var multer=require('multer');var util=require(_0x2976('0x0'));var path=require(_0x2976('0x1'));var timeout=require(_0x2976('0x2'));var express=require(_0x2976('0x3'));var router=express[_0x2976('0x4')]();var fs_extra=require(_0x2976('0x5'));var auth=require(_0x2976('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2976('0x7'));router[_0x2976('0x8')]('/',auth[_0x2976('0x9')](),controller['index']);router[_0x2976('0x8')](_0x2976('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2976('0x8')](_0x2976('0xb'),auth[_0x2976('0x9')](),controller[_0x2976('0xc')]);router[_0x2976('0x8')](_0x2976('0xd'),auth['isAuthenticated'](),controller[_0x2976('0xe')]);router[_0x2976('0x8')](_0x2976('0xf'),auth['isAuthenticated'](),controller[_0x2976('0x10')]);router['get']('/:id/hopper_black',auth[_0x2976('0x9')](),controller[_0x2976('0x11')]);router[_0x2976('0x8')](_0x2976('0x12'),auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth['isAuthenticated'](),controller[_0x2976('0x13')]);router[_0x2976('0x14')]('/',auth[_0x2976('0x9')](),controller[_0x2976('0x15')]);router[_0x2976('0x14')](_0x2976('0x16'),auth[_0x2976('0x9')](),controller[_0x2976('0x17')]);router[_0x2976('0x14')](_0x2976('0x12'),auth['isAuthenticated'](),controller[_0x2976('0x18')]);router[_0x2976('0x14')](_0x2976('0x19'),auth[_0x2976('0x9')](),controller[_0x2976('0x1a')]);router[_0x2976('0x1b')](_0x2976('0xa'),auth[_0x2976('0x9')](),controller[_0x2976('0x1c')]);router[_0x2976('0x1d')](_0x2976('0xa'),auth[_0x2976('0x9')](),controller[_0x2976('0x1e')]);router[_0x2976('0x1d')](_0x2976('0x12'),auth[_0x2976('0x9')](),controller[_0x2976('0x1f')]);router[_0x2976('0x1d')](_0x2976('0x19'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0xff14=['getBlackLists','post','clone','addLists','/:id/blacklists','update','delete','destroy','removeLists','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists'];(function(_0x5d0c9e,_0x46ad79){var _0x30bc16=function(_0x43783){while(--_0x43783){_0x5d0c9e['push'](_0x5d0c9e['shift']());}};_0x30bc16(++_0x46ad79);}(_0xff14,0x1ca));var _0x4ff1=function(_0x33f96f,_0x1680b1){_0x33f96f=_0x33f96f-0x0;var _0x3156f2=_0xff14[_0x33f96f];return _0x3156f2;};'use strict';var multer=require(_0x4ff1('0x0'));var util=require(_0x4ff1('0x1'));var path=require('path');var timeout=require(_0x4ff1('0x2'));var express=require(_0x4ff1('0x3'));var router=express[_0x4ff1('0x4')]();var fs_extra=require(_0x4ff1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ff1('0x6'));var config=require(_0x4ff1('0x7'));var controller=require(_0x4ff1('0x8'));router[_0x4ff1('0x9')]('/',auth['isAuthenticated'](),controller[_0x4ff1('0xa')]);router[_0x4ff1('0x9')](_0x4ff1('0xb'),auth['isAuthenticated'](),controller[_0x4ff1('0xc')]);router[_0x4ff1('0x9')](_0x4ff1('0xd'),auth[_0x4ff1('0xe')](),controller[_0x4ff1('0xf')]);router[_0x4ff1('0x9')](_0x4ff1('0x10'),auth['isAuthenticated'](),controller[_0x4ff1('0x11')]);router[_0x4ff1('0x9')](_0x4ff1('0x12'),auth[_0x4ff1('0xe')](),controller['getHopperFinals']);router[_0x4ff1('0x9')](_0x4ff1('0x13'),auth[_0x4ff1('0xe')](),controller[_0x4ff1('0x14')]);router['get'](_0x4ff1('0x15'),auth[_0x4ff1('0xe')](),controller['getLists']);router[_0x4ff1('0x9')]('/:id/blacklists',auth[_0x4ff1('0xe')](),controller[_0x4ff1('0x16')]);router[_0x4ff1('0x17')]('/',auth[_0x4ff1('0xe')](),controller['create']);router[_0x4ff1('0x17')]('/:id/clone',auth[_0x4ff1('0xe')](),controller[_0x4ff1('0x18')]);router['post'](_0x4ff1('0x15'),auth[_0x4ff1('0xe')](),controller[_0x4ff1('0x19')]);router[_0x4ff1('0x17')](_0x4ff1('0x1a'),auth[_0x4ff1('0xe')](),controller['addBlackLists']);router['put'](_0x4ff1('0xb'),auth['isAuthenticated'](),controller[_0x4ff1('0x1b')]);router[_0x4ff1('0x1c')](_0x4ff1('0xb'),auth['isAuthenticated'](),controller[_0x4ff1('0x1d')]);router[_0x4ff1('0x1c')](_0x4ff1('0x15'),auth[_0x4ff1('0xe')](),controller[_0x4ff1('0x1e')]);router[_0x4ff1('0x1c')]('/:id/blacklists',auth[_0x4ff1('0xe')](),controller['removeBlackLists']);module[_0x4ff1('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0ca6436..f90760a 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 _0x031a=['sequelize','exports','STRING','TEXT','getDataValue','key'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x031a,0x108));var _0xa031=function(_0x34bc09,_0x10be5d){_0x34bc09=_0x34bc09-0x0;var _0x2cec34=_0x031a[_0x34bc09];return _0x2cec34;};'use strict';var Sequelize=require(_0xa031('0x0'));module[_0xa031('0x1')]={'key':{'type':Sequelize[_0xa031('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xa031('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xa031('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xa031('0x4')](_0xa031('0x5'));}}}; \ No newline at end of file +var _0x79c9=['STRING','VIRTUAL','getDataValue','sequelize','exports'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x79c9,0x148));var _0x979c=function(_0x24178c,_0x4c6670){_0x24178c=_0x24178c-0x0;var _0x239094=_0x79c9[_0x24178c];return _0x239094;};'use strict';var Sequelize=require(_0x979c('0x0'));module[_0x979c('0x1')]={'key':{'type':Sequelize[_0x979c('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x979c('0x2')]},'name':{'type':Sequelize[_0x979c('0x3')],'get':function(){return this[_0x979c('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 6b92019..88a3303 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 _0x9df3=['user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','update','then','destroy','get','CannedAnswers','error','stack','name','send','map','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','options','CannedAnswer','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x5571f3,_0x3563f3){var _0x9969cf=function(_0x45c545){while(--_0x45c545){_0x5571f3['push'](_0x5571f3['shift']());}};_0x9969cf(++_0x3563f3);}(_0x9df3,0x1b4));var _0x39df=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x9df3[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0x39df('0x0'));var rimraf=require(_0x39df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39df('0x2'));var rp=require(_0x39df('0x3'));var moment=require(_0x39df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39df('0x5'));var util=require(_0x39df('0x6'));var path=require(_0x39df('0x7'));var sox=require(_0x39df('0x8'));var csv=require('to-csv');var ejs=require(_0x39df('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39df('0xa'));var squel=require(_0x39df('0xb'));var crypto=require(_0x39df('0xc'));var jsforce=require(_0x39df('0xd'));var deskjs=require(_0x39df('0xe'));var toCsv=require(_0x39df('0xf'));var querystring=require(_0x39df('0x10'));var Papa=require('papaparse');var Redis=require(_0x39df('0x11'));var authService=require(_0x39df('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39df('0x13'));var logger=require(_0x39df('0x14'))(_0x39df('0x15'));var utils=require(_0x39df('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x39df('0x17'));var db=require(_0x39df('0x18'))['db'];function respondWithStatusCode(_0x230821,_0xdb33e5){_0xdb33e5=_0xdb33e5||0xcc;return function(_0x50af46){if(_0x50af46){return _0x230821[_0x39df('0x19')](_0xdb33e5);}return _0x230821[_0x39df('0x1a')](_0xdb33e5)[_0x39df('0x1b')]();};}function respondWithResult(_0x276577,_0x201ff0){_0x201ff0=_0x201ff0||0xc8;return function(_0x4b9208){if(_0x4b9208){return _0x276577[_0x39df('0x1a')](_0x201ff0)['json'](_0x4b9208);}};}function respondWithFilteredResult(_0x36fa87,_0x6b9dde){return function(_0x27f1d8){if(_0x27f1d8){var _0x163523=typeof _0x6b9dde[_0x39df('0x1c')]===_0x39df('0x1d')&&typeof _0x6b9dde['limit']===_0x39df('0x1d');var _0x49d0c1=_0x27f1d8['count'];var _0x301868=_0x163523?0x0:_0x6b9dde[_0x39df('0x1c')];var _0xbc44f9=_0x163523?_0x27f1d8[_0x39df('0x1e')]:_0x6b9dde[_0x39df('0x1c')]+_0x6b9dde[_0x39df('0x1f')];var _0x4bd28f;if(_0xbc44f9>=_0x49d0c1){_0xbc44f9=_0x49d0c1;_0x4bd28f=0xc8;}else{_0x4bd28f=0xce;}_0x36fa87[_0x39df('0x1a')](_0x4bd28f);return _0x36fa87[_0x39df('0x20')]('Content-Range',_0x301868+'-'+_0xbc44f9+'/'+_0x49d0c1)[_0x39df('0x21')](_0x27f1d8);}return null;};}function patchUpdates(_0x42edae){return function(_0x29d837){try{jsonpatch[_0x39df('0x22')](_0x29d837,_0x42edae,!![]);}catch(_0xac848d){return BPromise['reject'](_0xac848d);}return _0x29d837[_0x39df('0x23')]();};}function saveUpdates(_0x5df09f,_0x446e75){return function(_0x49e339){if(_0x49e339){return _0x49e339[_0x39df('0x24')](_0x5df09f)[_0x39df('0x25')](function(_0x5f41e9){return _0x5f41e9;});}return null;};}function removeEntity(_0x473fb4,_0x5a17b5){return function(_0x2eb0c7){if(_0x2eb0c7){return _0x2eb0c7[_0x39df('0x26')]()[_0x39df('0x25')](function(){var _0x38d14c=_0x2eb0c7[_0x39df('0x27')]({'plain':!![]});var _0x53075c=_0x39df('0x28');return db['UserProfileResource'][_0x39df('0x26')]({'where':{'type':_0x53075c,'resourceId':_0x38d14c['id']}})[_0x39df('0x25')](function(){return _0x2eb0c7;});})[_0x39df('0x25')](function(){_0x473fb4[_0x39df('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c40e,_0xa8a63d){return function(_0x58985c){if(!_0x58985c){_0x27c40e[_0x39df('0x19')](0x194);}return _0x58985c;};}function handleError(_0xaa507d,_0x3e2cd7){_0x3e2cd7=_0x3e2cd7||0x1f4;return function(_0x9ea474){logger[_0x39df('0x29')](_0x9ea474[_0x39df('0x2a')]);if(_0x9ea474[_0x39df('0x2b')]){delete _0x9ea474[_0x39df('0x2b')];}_0xaa507d['status'](_0x3e2cd7)[_0x39df('0x2c')](_0x9ea474);};}exports['index']=function(_0x3d3a02,_0xb0766e){var _0x486a7a={},_0x1af9ac={},_0x579339={'count':0x0,'rows':[]};var _0x2b42df=_[_0x39df('0x2d')](db['CannedAnswer']['rawAttributes'],function(_0x3eb154){return{'name':_0x3eb154[_0x39df('0x2e')],'type':_0x3eb154[_0x39df('0x2f')]['key']};});_0x1af9ac[_0x39df('0x30')]=_[_0x39df('0x2d')](_0x2b42df,_0x39df('0x2b'));_0x1af9ac[_0x39df('0x31')]=_['keys'](_0x3d3a02[_0x39df('0x31')]);_0x1af9ac['filters']=_[_0x39df('0x32')](_0x1af9ac[_0x39df('0x30')],_0x1af9ac[_0x39df('0x31')]);_0x486a7a[_0x39df('0x33')]=_[_0x39df('0x32')](_0x1af9ac[_0x39df('0x30')],qs['fields'](_0x3d3a02[_0x39df('0x31')][_0x39df('0x34')]));_0x486a7a['attributes']=_0x486a7a[_0x39df('0x33')][_0x39df('0x35')]?_0x486a7a['attributes']:_0x1af9ac[_0x39df('0x30')];if(!_0x3d3a02[_0x39df('0x31')]['hasOwnProperty'](_0x39df('0x36'))){_0x486a7a[_0x39df('0x1f')]=qs['limit'](_0x3d3a02[_0x39df('0x31')][_0x39df('0x1f')]);_0x486a7a[_0x39df('0x1c')]=qs['offset'](_0x3d3a02[_0x39df('0x31')][_0x39df('0x1c')]);}_0x486a7a[_0x39df('0x37')]=qs['sort'](_0x3d3a02[_0x39df('0x31')][_0x39df('0x38')]);_0x486a7a[_0x39df('0x39')]=qs[_0x39df('0x3a')](_[_0x39df('0x3b')](_0x3d3a02[_0x39df('0x31')],_0x1af9ac['filters']),_0x2b42df);if(_0x3d3a02[_0x39df('0x31')]['filter']){_0x486a7a[_0x39df('0x39')]=_[_0x39df('0x3c')](_0x486a7a[_0x39df('0x39')],{'$or':[{'key':{'$like':'%'+_0x3d3a02[_0x39df('0x31')]['filter']+'%'}},{'value':{'$like':'%'+_0x3d3a02[_0x39df('0x31')][_0x39df('0x3d')]+'%'}}]});}_0x486a7a=_[_0x39df('0x3c')]({},_0x486a7a,_0x3d3a02[_0x39df('0x3e')]);var _0x52d2fb={'where':_0x486a7a[_0x39df('0x39')]};return db[_0x39df('0x3f')][_0x39df('0x1e')](_0x52d2fb)[_0x39df('0x25')](function(_0x4cef85){_0x579339[_0x39df('0x1e')]=_0x4cef85;if(_0x3d3a02['query'][_0x39df('0x40')]){_0x486a7a[_0x39df('0x41')]=[{'all':!![]}];}return db[_0x39df('0x3f')][_0x39df('0x42')](_0x486a7a);})[_0x39df('0x25')](function(_0x4933f7){_0x579339[_0x39df('0x43')]=_0x4933f7;return _0x579339;})[_0x39df('0x25')](respondWithFilteredResult(_0xb0766e,_0x486a7a))[_0x39df('0x44')](handleError(_0xb0766e,null));};exports['show']=function(_0x4fcec7,_0x143324){var _0x26c2f0={'raw':!![],'where':{'id':_0x4fcec7[_0x39df('0x45')]['id']}},_0x2a5a3d={};_0x2a5a3d[_0x39df('0x30')]=_[_0x39df('0x46')](db['CannedAnswer'][_0x39df('0x47')]);_0x2a5a3d[_0x39df('0x31')]=_[_0x39df('0x46')](_0x4fcec7['query']);_0x2a5a3d[_0x39df('0x3a')]=_[_0x39df('0x32')](_0x2a5a3d[_0x39df('0x30')],_0x2a5a3d[_0x39df('0x31')]);_0x26c2f0['attributes']=_[_0x39df('0x32')](_0x2a5a3d[_0x39df('0x30')],qs[_0x39df('0x34')](_0x4fcec7['query'][_0x39df('0x34')]));_0x26c2f0['attributes']=_0x26c2f0['attributes'][_0x39df('0x35')]?_0x26c2f0[_0x39df('0x33')]:_0x2a5a3d['model'];if(_0x4fcec7[_0x39df('0x31')][_0x39df('0x40')]){_0x26c2f0['include']=[{'all':!![]}];}_0x26c2f0=_['merge']({},_0x26c2f0,_0x4fcec7[_0x39df('0x3e')]);return db[_0x39df('0x3f')][_0x39df('0x48')](_0x26c2f0)[_0x39df('0x25')](handleEntityNotFound(_0x143324,null))[_0x39df('0x25')](respondWithResult(_0x143324,null))['catch'](handleError(_0x143324,null));};exports['update']=function(_0x1aa13c,_0x345d04){if(_0x1aa13c[_0x39df('0x49')]['id']){delete _0x1aa13c['body']['id'];}return db[_0x39df('0x3f')][_0x39df('0x48')]({'where':{'id':_0x1aa13c[_0x39df('0x45')]['id']}})[_0x39df('0x25')](handleEntityNotFound(_0x345d04,null))[_0x39df('0x25')](saveUpdates(_0x1aa13c['body'],null))[_0x39df('0x25')](respondWithResult(_0x345d04,null))['catch'](handleError(_0x345d04,null));};exports['destroy']=function(_0xb0b67,_0x2fae91){return db['CannedAnswer']['find']({'where':{'id':_0xb0b67[_0x39df('0x45')]['id']}})[_0x39df('0x25')](handleEntityNotFound(_0x2fae91,null))['then'](removeEntity(_0x2fae91,null))[_0x39df('0x44')](handleError(_0x2fae91,null));};exports['create']=function(_0xad0960,_0x43df46){var _0x9a425a={'key':_0xad0960[_0x39df('0x49')]['key']};if(_0xad0960[_0x39df('0x49')][_0x39df('0x4a')]){_0x9a425a[_0x39df('0x4a')]=_0xad0960['body'][_0x39df('0x4a')];}else if(_0xad0960[_0x39df('0x49')]['SmsAccountId']){_0x9a425a[_0x39df('0x4b')]=_0xad0960['body'][_0x39df('0x4b')];}else if(_0xad0960[_0x39df('0x49')][_0x39df('0x4c')]){_0x9a425a[_0x39df('0x4c')]=_0xad0960[_0x39df('0x49')][_0x39df('0x4c')];}else if(_0xad0960[_0x39df('0x49')][_0x39df('0x4d')]){_0x9a425a[_0x39df('0x4d')]=_0xad0960[_0x39df('0x49')]['ChatWebsiteId'];}return db[_0x39df('0x3f')][_0x39df('0x48')]({'where':_0x9a425a})[_0x39df('0x25')](function(_0xd9980a){if(_0xd9980a){throw new db[(_0x39df('0x4e'))][(_0x39df('0x4f'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x39df('0x3f')]['create'](_0xad0960[_0x39df('0x49')]);})['then'](function(_0x37b9bb){var _0x532cc5=_0xad0960[_0x39df('0x50')][_0x39df('0x27')]({'plain':!![]});if(!_0x532cc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x532cc5[_0x39df('0x51')]===_0x39df('0x50')){var _0x2b604b=_0x37b9bb[_0x39df('0x27')]({'plain':!![]});return db[_0x39df('0x52')]['find']({'where':{'name':_0x39df('0x28'),'userProfileId':_0x532cc5[_0x39df('0x53')]},'raw':!![]})[_0x39df('0x25')](function(_0x4f5f00){if(_0x4f5f00&&_0x4f5f00[_0x39df('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b604b[_0x39df('0x2b')],'resourceId':_0x2b604b['id'],'type':_0x4f5f00[_0x39df('0x2b')],'sectionId':_0x4f5f00['id']},{})['then'](function(){return _0x37b9bb;});}else{return _0x37b9bb;}})[_0x39df('0x44')](function(_0x50b894){logger[_0x39df('0x29')](_0x39df('0x55'),_0x50b894);throw _0x50b894;});}return _0x37b9bb;})[_0x39df('0x25')](respondWithResult(_0x43df46,0xc9))['catch'](handleError(_0x43df46,null));}; \ No newline at end of file +var _0x3d09=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','CannedAnswers','UserProfileResource','destroy','end','sendStatus','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','catch','params','keys','includeAll','find','update','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4c4da0,_0x3f2083){var _0x257623=function(_0x577d3d){while(--_0x577d3d){_0x4c4da0['push'](_0x4c4da0['shift']());}};_0x257623(++_0x3f2083);}(_0x3d09,0x1c6));var _0x93d0=function(_0x2aeeab,_0x45a9b5){_0x2aeeab=_0x2aeeab-0x0;var _0x21d9a3=_0x3d09[_0x2aeeab];return _0x21d9a3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93d0('0x0'));var zipdir=require(_0x93d0('0x1'));var jsonpatch=require(_0x93d0('0x2'));var rp=require(_0x93d0('0x3'));var moment=require(_0x93d0('0x4'));var BPromise=require(_0x93d0('0x5'));var Mustache=require(_0x93d0('0x6'));var util=require(_0x93d0('0x7'));var path=require(_0x93d0('0x8'));var sox=require('sox');var csv=require(_0x93d0('0x9'));var ejs=require(_0x93d0('0xa'));var fs=require('fs');var fs_extra=require(_0x93d0('0xb'));var _=require(_0x93d0('0xc'));var squel=require(_0x93d0('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93d0('0xe'));var toCsv=require(_0x93d0('0x9'));var querystring=require(_0x93d0('0xf'));var Papa=require(_0x93d0('0x10'));var Redis=require(_0x93d0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x93d0('0x12'));var as=require(_0x93d0('0x13'));var hardwareService=require(_0x93d0('0x14'));var logger=require(_0x93d0('0x15'))('api');var utils=require(_0x93d0('0x16'));var config=require(_0x93d0('0x17'));var licenseUtil=require(_0x93d0('0x18'));var db=require(_0x93d0('0x19'))['db'];function respondWithStatusCode(_0x186fdf,_0x57890b){_0x57890b=_0x57890b||0xcc;return function(_0x485fe6){if(_0x485fe6){return _0x186fdf['sendStatus'](_0x57890b);}return _0x186fdf[_0x93d0('0x1a')](_0x57890b)['end']();};}function respondWithResult(_0x417ebb,_0xfe6fce){_0xfe6fce=_0xfe6fce||0xc8;return function(_0x3b7d8c){if(_0x3b7d8c){return _0x417ebb[_0x93d0('0x1a')](_0xfe6fce)[_0x93d0('0x1b')](_0x3b7d8c);}};}function respondWithFilteredResult(_0x3719bf,_0x19d9e3){return function(_0x20e4cf){if(_0x20e4cf){var _0x20a73e=typeof _0x19d9e3[_0x93d0('0x1c')]===_0x93d0('0x1d')&&typeof _0x19d9e3[_0x93d0('0x1e')]===_0x93d0('0x1d');var _0x2f420b=_0x20e4cf[_0x93d0('0x1f')];var _0x4b9812=_0x20a73e?0x0:_0x19d9e3['offset'];var _0x5be497=_0x20a73e?_0x20e4cf[_0x93d0('0x1f')]:_0x19d9e3[_0x93d0('0x1c')]+_0x19d9e3[_0x93d0('0x1e')];var _0xd05aab;if(_0x5be497>=_0x2f420b){_0x5be497=_0x2f420b;_0xd05aab=0xc8;}else{_0xd05aab=0xce;}_0x3719bf[_0x93d0('0x1a')](_0xd05aab);return _0x3719bf[_0x93d0('0x20')](_0x93d0('0x21'),_0x4b9812+'-'+_0x5be497+'/'+_0x2f420b)['json'](_0x20e4cf);}return null;};}function patchUpdates(_0x10250a){return function(_0x5eace1){try{jsonpatch[_0x93d0('0x22')](_0x5eace1,_0x10250a,!![]);}catch(_0x83d8f0){return BPromise[_0x93d0('0x23')](_0x83d8f0);}return _0x5eace1[_0x93d0('0x24')]();};}function saveUpdates(_0x140771,_0x2e73fe){return function(_0x2a3917){if(_0x2a3917){return _0x2a3917['update'](_0x140771)[_0x93d0('0x25')](function(_0x58482e){return _0x58482e;});}return null;};}function removeEntity(_0x55afef,_0x5e427b){return function(_0x50b0f1){if(_0x50b0f1){return _0x50b0f1['destroy']()[_0x93d0('0x25')](function(){var _0x473285=_0x50b0f1[_0x93d0('0x26')]({'plain':!![]});var _0x480080=_0x93d0('0x27');return db[_0x93d0('0x28')][_0x93d0('0x29')]({'where':{'type':_0x480080,'resourceId':_0x473285['id']}})[_0x93d0('0x25')](function(){return _0x50b0f1;});})[_0x93d0('0x25')](function(){_0x55afef[_0x93d0('0x1a')](0xcc)[_0x93d0('0x2a')]();});}};}function handleEntityNotFound(_0x490226,_0x3b2614){return function(_0x2ca043){if(!_0x2ca043){_0x490226[_0x93d0('0x2b')](0x194);}return _0x2ca043;};}function handleError(_0x3eb07f,_0x5ab1fe){_0x5ab1fe=_0x5ab1fe||0x1f4;return function(_0x351bda){logger['error'](_0x351bda['stack']);if(_0x351bda[_0x93d0('0x2c')]){delete _0x351bda[_0x93d0('0x2c')];}_0x3eb07f[_0x93d0('0x1a')](_0x5ab1fe)[_0x93d0('0x2d')](_0x351bda);};}exports[_0x93d0('0x2e')]=function(_0x19539d,_0x1c0fac){var _0x409bd2={},_0x46bad8={},_0x211ce7={'count':0x0,'rows':[]};var _0xcffb44=_[_0x93d0('0x2f')](db[_0x93d0('0x30')][_0x93d0('0x31')],function(_0x4d6f7a){return{'name':_0x4d6f7a[_0x93d0('0x32')],'type':_0x4d6f7a[_0x93d0('0x33')][_0x93d0('0x34')]};});_0x46bad8[_0x93d0('0x35')]=_[_0x93d0('0x2f')](_0xcffb44,_0x93d0('0x2c'));_0x46bad8[_0x93d0('0x36')]=_['keys'](_0x19539d[_0x93d0('0x36')]);_0x46bad8[_0x93d0('0x37')]=_[_0x93d0('0x38')](_0x46bad8[_0x93d0('0x35')],_0x46bad8[_0x93d0('0x36')]);_0x409bd2[_0x93d0('0x39')]=_[_0x93d0('0x38')](_0x46bad8[_0x93d0('0x35')],qs[_0x93d0('0x3a')](_0x19539d['query']['fields']));_0x409bd2['attributes']=_0x409bd2[_0x93d0('0x39')][_0x93d0('0x3b')]?_0x409bd2['attributes']:_0x46bad8[_0x93d0('0x35')];if(!_0x19539d['query'][_0x93d0('0x3c')](_0x93d0('0x3d'))){_0x409bd2[_0x93d0('0x1e')]=qs[_0x93d0('0x1e')](_0x19539d['query']['limit']);_0x409bd2[_0x93d0('0x1c')]=qs[_0x93d0('0x1c')](_0x19539d[_0x93d0('0x36')]['offset']);}_0x409bd2[_0x93d0('0x3e')]=qs[_0x93d0('0x3f')](_0x19539d[_0x93d0('0x36')][_0x93d0('0x3f')]);_0x409bd2[_0x93d0('0x40')]=qs[_0x93d0('0x37')](_[_0x93d0('0x41')](_0x19539d[_0x93d0('0x36')],_0x46bad8['filters']),_0xcffb44);if(_0x19539d['query']['filter']){_0x409bd2[_0x93d0('0x40')]=_[_0x93d0('0x42')](_0x409bd2[_0x93d0('0x40')],{'$or':[{'key':{'$like':'%'+_0x19539d[_0x93d0('0x36')][_0x93d0('0x43')]+'%'}},{'value':{'$like':'%'+_0x19539d[_0x93d0('0x36')][_0x93d0('0x43')]+'%'}}]});}_0x409bd2=_[_0x93d0('0x42')]({},_0x409bd2,_0x19539d[_0x93d0('0x44')]);var _0x2f9cca={'where':_0x409bd2[_0x93d0('0x40')]};return db[_0x93d0('0x30')][_0x93d0('0x1f')](_0x2f9cca)['then'](function(_0x5d5739){_0x211ce7[_0x93d0('0x1f')]=_0x5d5739;if(_0x19539d['query']['includeAll']){_0x409bd2[_0x93d0('0x45')]=[{'all':!![]}];}return db['CannedAnswer'][_0x93d0('0x46')](_0x409bd2);})[_0x93d0('0x25')](function(_0x42cc73){_0x211ce7[_0x93d0('0x47')]=_0x42cc73;return _0x211ce7;})[_0x93d0('0x25')](respondWithFilteredResult(_0x1c0fac,_0x409bd2))[_0x93d0('0x48')](handleError(_0x1c0fac,null));};exports['show']=function(_0x46654d,_0x18901f){var _0x3d026a={'raw':!![],'where':{'id':_0x46654d[_0x93d0('0x49')]['id']}},_0xac8409={};_0xac8409[_0x93d0('0x35')]=_[_0x93d0('0x4a')](db['CannedAnswer'][_0x93d0('0x31')]);_0xac8409[_0x93d0('0x36')]=_['keys'](_0x46654d[_0x93d0('0x36')]);_0xac8409[_0x93d0('0x37')]=_['intersection'](_0xac8409[_0x93d0('0x35')],_0xac8409[_0x93d0('0x36')]);_0x3d026a[_0x93d0('0x39')]=_[_0x93d0('0x38')](_0xac8409[_0x93d0('0x35')],qs[_0x93d0('0x3a')](_0x46654d[_0x93d0('0x36')]['fields']));_0x3d026a[_0x93d0('0x39')]=_0x3d026a[_0x93d0('0x39')][_0x93d0('0x3b')]?_0x3d026a['attributes']:_0xac8409['model'];if(_0x46654d[_0x93d0('0x36')][_0x93d0('0x4b')]){_0x3d026a['include']=[{'all':!![]}];}_0x3d026a=_['merge']({},_0x3d026a,_0x46654d[_0x93d0('0x44')]);return db[_0x93d0('0x30')][_0x93d0('0x4c')](_0x3d026a)['then'](handleEntityNotFound(_0x18901f,null))[_0x93d0('0x25')](respondWithResult(_0x18901f,null))[_0x93d0('0x48')](handleError(_0x18901f,null));};exports[_0x93d0('0x4d')]=function(_0x259130,_0x1e78c3){if(_0x259130['body']['id']){delete _0x259130[_0x93d0('0x4e')]['id'];}return db[_0x93d0('0x30')][_0x93d0('0x4c')]({'where':{'id':_0x259130[_0x93d0('0x49')]['id']}})[_0x93d0('0x25')](handleEntityNotFound(_0x1e78c3,null))[_0x93d0('0x25')](saveUpdates(_0x259130[_0x93d0('0x4e')],null))[_0x93d0('0x25')](respondWithResult(_0x1e78c3,null))[_0x93d0('0x48')](handleError(_0x1e78c3,null));};exports[_0x93d0('0x29')]=function(_0x507d97,_0x377dc0){return db['CannedAnswer']['find']({'where':{'id':_0x507d97[_0x93d0('0x49')]['id']}})['then'](handleEntityNotFound(_0x377dc0,null))['then'](removeEntity(_0x377dc0,null))[_0x93d0('0x48')](handleError(_0x377dc0,null));};exports['create']=function(_0x2acab0,_0x39164f){var _0x739781={'key':_0x2acab0[_0x93d0('0x4e')][_0x93d0('0x34')]};if(_0x2acab0['body'][_0x93d0('0x4f')]){_0x739781['MailAccountId']=_0x2acab0[_0x93d0('0x4e')][_0x93d0('0x4f')];}else if(_0x2acab0['body'][_0x93d0('0x50')]){_0x739781[_0x93d0('0x50')]=_0x2acab0['body']['SmsAccountId'];}else if(_0x2acab0[_0x93d0('0x4e')]['OpenchannelAccountId']){_0x739781[_0x93d0('0x51')]=_0x2acab0[_0x93d0('0x4e')]['OpenchannelAccountId'];}else if(_0x2acab0['body'][_0x93d0('0x52')]){_0x739781['ChatWebsiteId']=_0x2acab0['body'][_0x93d0('0x52')];}return db[_0x93d0('0x30')][_0x93d0('0x4c')]({'where':_0x739781})[_0x93d0('0x25')](function(_0xfd29a2){if(_0xfd29a2){throw new db['Sequelize']['ValidationError'](_0x93d0('0x53'));}return db[_0x93d0('0x30')][_0x93d0('0x54')](_0x2acab0[_0x93d0('0x4e')]);})[_0x93d0('0x25')](function(_0x496fa6){var _0x56271e=_0x2acab0[_0x93d0('0x55')][_0x93d0('0x26')]({'plain':!![]});if(!_0x56271e)throw new Error(_0x93d0('0x56'));if(_0x56271e[_0x93d0('0x57')]===_0x93d0('0x55')){var _0x21eb04=_0x496fa6[_0x93d0('0x26')]({'plain':!![]});return db[_0x93d0('0x58')][_0x93d0('0x4c')]({'where':{'name':_0x93d0('0x27'),'userProfileId':_0x56271e['userProfileId']},'raw':!![]})[_0x93d0('0x25')](function(_0x468250){if(_0x468250&&_0x468250[_0x93d0('0x59')]===0x0){return db[_0x93d0('0x28')][_0x93d0('0x54')]({'name':_0x21eb04['name'],'resourceId':_0x21eb04['id'],'type':_0x468250[_0x93d0('0x2c')],'sectionId':_0x468250['id']},{})[_0x93d0('0x25')](function(){return _0x496fa6;});}else{return _0x496fa6;}})[_0x93d0('0x48')](function(_0x26677d){logger[_0x93d0('0x5a')](_0x93d0('0x5b'),_0x26677d);throw _0x26677d;});}return _0x496fa6;})[_0x93d0('0x25')](respondWithResult(_0x39164f,0xc9))['catch'](handleError(_0x39164f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index bbcf1f6..bb544b9 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 _0x7a35=['api','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x33735f,_0x20aebc){var _0x46b52e=function(_0x184520){while(--_0x184520){_0x33735f['push'](_0x33735f['shift']());}};_0x46b52e(++_0x20aebc);}(_0x7a35,0x17f));var _0x57a3=function(_0x12c32c,_0x13af3b){_0x12c32c=_0x12c32c-0x0;var _0x39b809=_0x7a35[_0x12c32c];return _0x39b809;};'use strict';var _=require('lodash');var util=require(_0x57a3('0x0'));var logger=require(_0x57a3('0x1'))(_0x57a3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57a3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57a3('0x4'));var config=require(_0x57a3('0x5'));var attributes=require(_0x57a3('0x6'));module[_0x57a3('0x7')]=function(_0x519ad7,_0x4e59e6){return _0x519ad7[_0x57a3('0x8')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x57a3('0x9'),'collate':_0x57a3('0xa')});}; \ No newline at end of file +var _0xa470=['api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','util','../../config/logger'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0xa470,0xe8));var _0x0a47=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa470[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0a47('0x0'));var logger=require(_0x0a47('0x1'))(_0x0a47('0x2'));var moment=require(_0x0a47('0x3'));var BPromise=require(_0x0a47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a47('0x5'));var rimraf=require(_0x0a47('0x6'));var config=require(_0x0a47('0x7'));var attributes=require(_0x0a47('0x8'));module[_0x0a47('0x9')]=function(_0xa32a76,_0x2eaa25){return _0xa32a76[_0x0a47('0xa')]('CannedAnswer',attributes,{'tableName':_0x0a47('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0a47('0xc'),'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 7285870..cb23b93 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(_0x5530ea,_0x15a34e){var _0x20f3d7=function(_0x2d1205){while(--_0x2d1205){_0x5530ea['push'](_0x5530ea['shift']());}};_0x20f3d7(++_0x15a34e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x76c4f,_0x42c837){var _0x54113a=function(_0x1c169a){while(--_0x1c169a){_0x76c4f['push'](_0x76c4f['shift']());}};_0x54113a(++_0x42c837);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 adee0a2..9aef685 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 _0x998c=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','util','connect-timeout','express'];(function(_0x45a507,_0x937053){var _0x379da6=function(_0x31bd47){while(--_0x31bd47){_0x45a507['push'](_0x45a507['shift']());}};_0x379da6(++_0x937053);}(_0x998c,0x1ed));var _0xc998=function(_0x2ace95,_0x186b37){_0x2ace95=_0x2ace95-0x0;var _0x35ecfa=_0x998c[_0x2ace95];return _0x35ecfa;};'use strict';var multer=require('multer');var util=require(_0xc998('0x0'));var path=require('path');var timeout=require(_0xc998('0x1'));var express=require(_0xc998('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc998('0x3'));var interaction=require(_0xc998('0x4'));var config=require(_0xc998('0x5'));var controller=require('./cannedAnswer.controller');router[_0xc998('0x6')]('/',auth['isAuthenticated'](),controller[_0xc998('0x7')]);router[_0xc998('0x6')](_0xc998('0x8'),auth[_0xc998('0x9')](),controller[_0xc998('0xa')]);router[_0xc998('0xb')]('/',auth[_0xc998('0x9')](),controller['create']);router[_0xc998('0xc')]('/:id',auth[_0xc998('0x9')](),controller[_0xc998('0xd')]);router[_0xc998('0xe')](_0xc998('0x8'),auth[_0xc998('0x9')](),controller['destroy']);module[_0xc998('0xf')]=router; \ No newline at end of file +var _0x6f7a=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','show','post','create','/:id','update','destroy'];(function(_0x4c221e,_0x13dbb8){var _0x18f35b=function(_0x3ebafe){while(--_0x3ebafe){_0x4c221e['push'](_0x4c221e['shift']());}};_0x18f35b(++_0x13dbb8);}(_0x6f7a,0x160));var _0xa6f7=function(_0x2d71af,_0x1b0887){_0x2d71af=_0x2d71af-0x0;var _0x21a714=_0x6f7a[_0x2d71af];return _0x21a714;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa6f7('0x1'));var express=require(_0xa6f7('0x2'));var router=express['Router']();var fs_extra=require(_0xa6f7('0x3'));var auth=require(_0xa6f7('0x4'));var interaction=require(_0xa6f7('0x5'));var config=require(_0xa6f7('0x6'));var controller=require(_0xa6f7('0x7'));router[_0xa6f7('0x8')]('/',auth[_0xa6f7('0x9')](),controller['index']);router[_0xa6f7('0x8')]('/:id',auth[_0xa6f7('0x9')](),controller[_0xa6f7('0xa')]);router[_0xa6f7('0xb')]('/',auth[_0xa6f7('0x9')](),controller[_0xa6f7('0xc')]);router['put'](_0xa6f7('0xd'),auth['isAuthenticated'](),controller[_0xa6f7('0xe')]);router['delete']('/:id',auth[_0xa6f7('0x9')](),controller[_0xa6f7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 5d1e816..2e03262 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 _0x5db8=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x2a6b41,_0x21f69a){var _0x2b5c34=function(_0x4ed090){while(--_0x4ed090){_0x2a6b41['push'](_0x2a6b41['shift']());}};_0x2b5c34(++_0x21f69a);}(_0x5db8,0xbb));var _0x85db=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x5db8[_0x1deee5];return _0x1d6c3a;};'use strict';var Sequelize=require(_0x85db('0x0'));module[_0x85db('0x1')]={'calldate':{'type':Sequelize[_0x85db('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x85db('0x3')]},'src':{'type':Sequelize[_0x85db('0x3')]},'dst':{'type':Sequelize[_0x85db('0x3')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x85db('0x3')]},'lastapp':{'type':Sequelize[_0x85db('0x3')]},'lastdata':{'type':Sequelize[_0x85db('0x3')]},'duration':{'type':Sequelize[_0x85db('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x85db('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x85db('0x3')]},'userfield':{'type':Sequelize[_0x85db('0x3')]},'uniqueid':{'type':Sequelize[_0x85db('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x85db('0x3')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x85db('0x3')]},'tag':{'type':Sequelize[_0x85db('0x3')]}}; \ No newline at end of file +var _0xca5a=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x32a584,_0x153f59){var _0x2a3073=function(_0x5a48b4){while(--_0x5a48b4){_0x32a584['push'](_0x32a584['shift']());}};_0x2a3073(++_0x153f59);}(_0xca5a,0x82));var _0xaca5=function(_0x474cc2,_0x4c930b){_0x474cc2=_0x474cc2-0x0;var _0x5f5360=_0xca5a[_0x474cc2];return _0x5f5360;};'use strict';var Sequelize=require('sequelize');module[_0xaca5('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xaca5('0x1')},'clid':{'type':Sequelize[_0xaca5('0x2')]},'src':{'type':Sequelize[_0xaca5('0x2')]},'dst':{'type':Sequelize[_0xaca5('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xaca5('0x2')]},'dstchannel':{'type':Sequelize[_0xaca5('0x2')]},'lastapp':{'type':Sequelize[_0xaca5('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0xaca5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xaca5('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xaca5('0x2')]},'amaflags':{'type':Sequelize[_0xaca5('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xaca5('0x2')]},'userfield':{'type':Sequelize[_0xaca5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xaca5('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xaca5('0x2')]},'type':{'type':Sequelize[_0xaca5('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b885913..ba76bf9 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 _0x7118=['stack','name','send','index','map','Cdr','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x479842,_0xe948ce){var _0x2145d0=function(_0x3604bd){while(--_0x3604bd){_0x479842['push'](_0x479842['shift']());}};_0x2145d0(++_0xe948ce);}(_0x7118,0x159));var _0x8711=function(_0x1ea37c,_0x969d7b){_0x1ea37c=_0x1ea37c-0x0;var _0x3b88f1=_0x7118[_0x1ea37c];return _0x3b88f1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8711('0x0'));var jsonpatch=require(_0x8711('0x1'));var rp=require('request-promise');var moment=require(_0x8711('0x2'));var BPromise=require(_0x8711('0x3'));var Mustache=require(_0x8711('0x4'));var util=require(_0x8711('0x5'));var path=require(_0x8711('0x6'));var sox=require(_0x8711('0x7'));var csv=require(_0x8711('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8711('0x9'));var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0x8'));var querystring=require(_0x8711('0xf'));var Papa=require(_0x8711('0x10'));var Redis=require(_0x8711('0x11'));var authService=require(_0x8711('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x13'));var logger=require(_0x8711('0x14'))(_0x8711('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8711('0x16'));var db=require(_0x8711('0x17'))['db'];function respondWithStatusCode(_0x5d2c38,_0x49b241){_0x49b241=_0x49b241||0xcc;return function(_0x11adb0){if(_0x11adb0){return _0x5d2c38[_0x8711('0x18')](_0x49b241);}return _0x5d2c38[_0x8711('0x19')](_0x49b241)[_0x8711('0x1a')]();};}function respondWithResult(_0xc0a891,_0x22f434){_0x22f434=_0x22f434||0xc8;return function(_0x16b742){if(_0x16b742){return _0xc0a891['status'](_0x22f434)[_0x8711('0x1b')](_0x16b742);}};}function respondWithFilteredResult(_0x363bcd,_0x13f394){return function(_0x2e12ec){if(_0x2e12ec){var _0x3ab905=typeof _0x13f394[_0x8711('0x1c')]==='undefined'&&typeof _0x13f394[_0x8711('0x1d')]===_0x8711('0x1e');var _0x1c2cb5=_0x2e12ec[_0x8711('0x1f')];var _0x19a157=_0x3ab905?0x0:_0x13f394['offset'];var _0x5b2bf8=_0x3ab905?_0x2e12ec['count']:_0x13f394[_0x8711('0x1c')]+_0x13f394[_0x8711('0x1d')];var _0x2f6134;if(_0x5b2bf8>=_0x1c2cb5){_0x5b2bf8=_0x1c2cb5;_0x2f6134=0xc8;}else{_0x2f6134=0xce;}_0x363bcd['status'](_0x2f6134);return _0x363bcd['set'](_0x8711('0x20'),_0x19a157+'-'+_0x5b2bf8+'/'+_0x1c2cb5)[_0x8711('0x1b')](_0x2e12ec);}return null;};}function patchUpdates(_0x1209e0){return function(_0x44b948){try{jsonpatch[_0x8711('0x21')](_0x44b948,_0x1209e0,!![]);}catch(_0x270081){return BPromise[_0x8711('0x22')](_0x270081);}return _0x44b948[_0x8711('0x23')]();};}function saveUpdates(_0xace829,_0x41369d){return function(_0x4a35f5){if(_0x4a35f5){return _0x4a35f5[_0x8711('0x24')](_0xace829)[_0x8711('0x25')](function(_0x3302b9){return _0x3302b9;});}return null;};}function removeEntity(_0x939ef3,_0x4cf830){return function(_0x27cafd){if(_0x27cafd){return _0x27cafd[_0x8711('0x26')]()[_0x8711('0x25')](function(){_0x939ef3['status'](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x17bf7f,_0x3e8281){return function(_0x217197){if(!_0x217197){_0x17bf7f[_0x8711('0x18')](0x194);}return _0x217197;};}function handleError(_0x514956,_0x494683){_0x494683=_0x494683||0x1f4;return function(_0x515a74){logger[_0x8711('0x27')](_0x515a74[_0x8711('0x28')]);if(_0x515a74[_0x8711('0x29')]){delete _0x515a74[_0x8711('0x29')];}_0x514956[_0x8711('0x19')](_0x494683)[_0x8711('0x2a')](_0x515a74);};}exports[_0x8711('0x2b')]=function(_0x3ca2b5,_0x398097){var _0x47e7b7={},_0x27db5d={},_0x591380={'count':0x0,'rows':[]};var _0x28c2d5=_[_0x8711('0x2c')](db[_0x8711('0x2d')]['rawAttributes'],function(_0x440bc8){return{'name':_0x440bc8['fieldName'],'type':_0x440bc8[_0x8711('0x2e')][_0x8711('0x2f')]};});_0x27db5d[_0x8711('0x30')]=_['map'](_0x28c2d5,'name');_0x27db5d[_0x8711('0x31')]=_[_0x8711('0x32')](_0x3ca2b5[_0x8711('0x31')]);_0x27db5d[_0x8711('0x33')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],_0x27db5d[_0x8711('0x31')]);_0x47e7b7[_0x8711('0x35')]=_[_0x8711('0x34')](_0x27db5d[_0x8711('0x30')],qs['fields'](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x36')]));_0x47e7b7[_0x8711('0x35')]=_0x47e7b7[_0x8711('0x35')][_0x8711('0x37')]?_0x47e7b7[_0x8711('0x35')]:_0x27db5d[_0x8711('0x30')];if(!_0x3ca2b5[_0x8711('0x31')][_0x8711('0x38')](_0x8711('0x39'))){_0x47e7b7['limit']=qs[_0x8711('0x1d')](_0x3ca2b5[_0x8711('0x31')][_0x8711('0x1d')]);_0x47e7b7[_0x8711('0x1c')]=qs[_0x8711('0x1c')](_0x3ca2b5['query'][_0x8711('0x1c')]);}_0x47e7b7[_0x8711('0x3a')]=qs[_0x8711('0x3b')](_0x3ca2b5['query'][_0x8711('0x3b')]);_0x47e7b7[_0x8711('0x3c')]=qs[_0x8711('0x33')](_[_0x8711('0x3d')](_0x3ca2b5[_0x8711('0x31')],_0x27db5d[_0x8711('0x33')]),_0x28c2d5);if(_0x3ca2b5[_0x8711('0x31')]['filter']){_0x47e7b7[_0x8711('0x3c')]=_[_0x8711('0x3e')](_0x47e7b7[_0x8711('0x3c')],{'$or':_[_0x8711('0x2c')](_0x28c2d5,function(_0x5a7e83){if(_0x5a7e83['type']!==_0x8711('0x3f')){var _0x18b82a={};_0x18b82a[_0x5a7e83[_0x8711('0x29')]]={'$like':'%'+_0x3ca2b5[_0x8711('0x31')][_0x8711('0x40')]+'%'};return _0x18b82a;}})});}_0x47e7b7=_[_0x8711('0x3e')]({},_0x47e7b7,_0x3ca2b5[_0x8711('0x41')]);var _0x2db474={'where':_0x47e7b7[_0x8711('0x3c')]};return db[_0x8711('0x2d')][_0x8711('0x1f')](_0x2db474)[_0x8711('0x25')](function(_0x1efd42){_0x591380[_0x8711('0x1f')]=_0x1efd42;if(_0x3ca2b5[_0x8711('0x31')][_0x8711('0x42')]){_0x47e7b7[_0x8711('0x43')]=[{'all':!![]}];}return db[_0x8711('0x2d')][_0x8711('0x44')](_0x47e7b7);})[_0x8711('0x25')](function(_0x2fb5e8){_0x591380['rows']=_0x2fb5e8;return _0x591380;})[_0x8711('0x25')](respondWithFilteredResult(_0x398097,_0x47e7b7))['catch'](handleError(_0x398097,null));};exports[_0x8711('0x45')]=function(_0x3d9562,_0x121971){var _0x38c0c4={'raw':!![],'where':{'id':_0x3d9562[_0x8711('0x46')]['id']}},_0x5f2c0c={};_0x5f2c0c[_0x8711('0x30')]=_[_0x8711('0x32')](db[_0x8711('0x2d')][_0x8711('0x47')]);_0x5f2c0c[_0x8711('0x31')]=_['keys'](_0x3d9562[_0x8711('0x31')]);_0x5f2c0c[_0x8711('0x33')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],_0x5f2c0c['query']);_0x38c0c4[_0x8711('0x35')]=_[_0x8711('0x34')](_0x5f2c0c[_0x8711('0x30')],qs[_0x8711('0x36')](_0x3d9562[_0x8711('0x31')]['fields']));_0x38c0c4['attributes']=_0x38c0c4[_0x8711('0x35')][_0x8711('0x37')]?_0x38c0c4['attributes']:_0x5f2c0c[_0x8711('0x30')];if(_0x3d9562[_0x8711('0x31')][_0x8711('0x42')]){_0x38c0c4[_0x8711('0x43')]=[{'all':!![]}];}_0x38c0c4=_['merge']({},_0x38c0c4,_0x3d9562[_0x8711('0x41')]);return db[_0x8711('0x2d')][_0x8711('0x48')](_0x38c0c4)['then'](handleEntityNotFound(_0x121971,null))[_0x8711('0x25')](respondWithResult(_0x121971,null))[_0x8711('0x49')](handleError(_0x121971,null));};exports['create']=function(_0x3e9ab1,_0x14a815){return db['Cdr'][_0x8711('0x4a')](_0x3e9ab1[_0x8711('0x4b')],{})['then'](respondWithResult(_0x14a815,0xc9))[_0x8711('0x49')](handleError(_0x14a815,null));};exports[_0x8711('0x24')]=function(_0x1c55d8,_0x17a3f5){if(_0x1c55d8['body']['id']){delete _0x1c55d8[_0x8711('0x4b')]['id'];}return db[_0x8711('0x2d')]['find']({'where':{'id':_0x1c55d8[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x17a3f5,null))['then'](saveUpdates(_0x1c55d8['body'],null))['then'](respondWithResult(_0x17a3f5,null))['catch'](handleError(_0x17a3f5,null));};exports[_0x8711('0x26')]=function(_0x2efca0,_0x1c83f7){return db[_0x8711('0x2d')][_0x8711('0x48')]({'where':{'id':_0x2efca0[_0x8711('0x46')]['id']}})[_0x8711('0x25')](handleEntityNotFound(_0x1c83f7,null))['then'](removeEntity(_0x1c83f7,null))['catch'](handleError(_0x1c83f7,null));};exports['describe']=function(_0x3b9e2b,_0x867599){return db[_0x8711('0x2d')][_0x8711('0x4c')]()[_0x8711('0x25')](respondWithResult(_0x867599,null))[_0x8711('0x49')](handleError(_0x867599,null));}; \ No newline at end of file +var _0x885a=['include','findAll','rows','show','params','rawAttributes','length','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','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','status','end','json','undefined','limit','offset','set','reject','save','update','then','error','stack','name','map','Cdr','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','count','includeAll'];(function(_0x3a8213,_0x1a8cc3){var _0x4c8ae2=function(_0x46d786){while(--_0x46d786){_0x3a8213['push'](_0x3a8213['shift']());}};_0x4c8ae2(++_0x1a8cc3);}(_0x885a,0x180));var _0xa885=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x885a[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa885('0x0'));var zipdir=require(_0xa885('0x1'));var jsonpatch=require(_0xa885('0x2'));var rp=require(_0xa885('0x3'));var moment=require('moment');var BPromise=require(_0xa885('0x4'));var Mustache=require(_0xa885('0x5'));var util=require(_0xa885('0x6'));var path=require(_0xa885('0x7'));var sox=require(_0xa885('0x8'));var csv=require(_0xa885('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa885('0xa'));var _=require(_0xa885('0xb'));var squel=require(_0xa885('0xc'));var crypto=require('crypto');var jsforce=require(_0xa885('0xd'));var deskjs=require(_0xa885('0xe'));var toCsv=require(_0xa885('0x9'));var querystring=require('querystring');var Papa=require(_0xa885('0xf'));var Redis=require(_0xa885('0x10'));var authService=require(_0xa885('0x11'));var qs=require(_0xa885('0x12'));var as=require(_0xa885('0x13'));var hardwareService=require(_0xa885('0x14'));var logger=require(_0xa885('0x15'))('api');var utils=require(_0xa885('0x16'));var config=require(_0xa885('0x17'));var licenseUtil=require(_0xa885('0x18'));var db=require(_0xa885('0x19'))['db'];function respondWithStatusCode(_0x412b2a,_0x3e9c7a){_0x3e9c7a=_0x3e9c7a||0xcc;return function(_0x4585d9){if(_0x4585d9){return _0x412b2a['sendStatus'](_0x3e9c7a);}return _0x412b2a[_0xa885('0x1a')](_0x3e9c7a)[_0xa885('0x1b')]();};}function respondWithResult(_0x27b24a,_0x12d81c){_0x12d81c=_0x12d81c||0xc8;return function(_0x33ce2e){if(_0x33ce2e){return _0x27b24a['status'](_0x12d81c)[_0xa885('0x1c')](_0x33ce2e);}};}function respondWithFilteredResult(_0x2ca5c5,_0x5296e6){return function(_0x14bff1){if(_0x14bff1){var _0x32fc86=typeof _0x5296e6['offset']===_0xa885('0x1d')&&typeof _0x5296e6[_0xa885('0x1e')]==='undefined';var _0x20a206=_0x14bff1['count'];var _0x2e9290=_0x32fc86?0x0:_0x5296e6[_0xa885('0x1f')];var _0x8c26c=_0x32fc86?_0x14bff1['count']:_0x5296e6[_0xa885('0x1f')]+_0x5296e6['limit'];var _0x127a86;if(_0x8c26c>=_0x20a206){_0x8c26c=_0x20a206;_0x127a86=0xc8;}else{_0x127a86=0xce;}_0x2ca5c5[_0xa885('0x1a')](_0x127a86);return _0x2ca5c5[_0xa885('0x20')]('Content-Range',_0x2e9290+'-'+_0x8c26c+'/'+_0x20a206)[_0xa885('0x1c')](_0x14bff1);}return null;};}function patchUpdates(_0x32b8df){return function(_0x1530b6){try{jsonpatch['apply'](_0x1530b6,_0x32b8df,!![]);}catch(_0x273988){return BPromise[_0xa885('0x21')](_0x273988);}return _0x1530b6[_0xa885('0x22')]();};}function saveUpdates(_0x4ad909,_0x303830){return function(_0x582b59){if(_0x582b59){return _0x582b59[_0xa885('0x23')](_0x4ad909)[_0xa885('0x24')](function(_0x5d2b43){return _0x5d2b43;});}return null;};}function removeEntity(_0x1d94c1,_0x190a57){return function(_0x21c98c){if(_0x21c98c){return _0x21c98c['destroy']()[_0xa885('0x24')](function(){_0x1d94c1[_0xa885('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ae58,_0x47daee){return function(_0x15ff4d){if(!_0x15ff4d){_0x39ae58['sendStatus'](0x194);}return _0x15ff4d;};}function handleError(_0x1a28d6,_0x110e63){_0x110e63=_0x110e63||0x1f4;return function(_0x3e347e){logger[_0xa885('0x25')](_0x3e347e[_0xa885('0x26')]);if(_0x3e347e[_0xa885('0x27')]){delete _0x3e347e[_0xa885('0x27')];}_0x1a28d6[_0xa885('0x1a')](_0x110e63)['send'](_0x3e347e);};}exports['index']=function(_0x5c4ca7,_0x4fc438){var _0x1c94ab={},_0x3e9e22={},_0x3af5d9={'count':0x0,'rows':[]};var _0x17c0eb=_[_0xa885('0x28')](db[_0xa885('0x29')]['rawAttributes'],function(_0x40d982){return{'name':_0x40d982['fieldName'],'type':_0x40d982[_0xa885('0x2a')]['key']};});_0x3e9e22[_0xa885('0x2b')]=_['map'](_0x17c0eb,_0xa885('0x27'));_0x3e9e22[_0xa885('0x2c')]=_[_0xa885('0x2d')](_0x5c4ca7['query']);_0x3e9e22[_0xa885('0x2e')]=_[_0xa885('0x2f')](_0x3e9e22['model'],_0x3e9e22[_0xa885('0x2c')]);_0x1c94ab['attributes']=_[_0xa885('0x2f')](_0x3e9e22[_0xa885('0x2b')],qs[_0xa885('0x30')](_0x5c4ca7['query'][_0xa885('0x30')]));_0x1c94ab[_0xa885('0x31')]=_0x1c94ab[_0xa885('0x31')]['length']?_0x1c94ab[_0xa885('0x31')]:_0x3e9e22[_0xa885('0x2b')];if(!_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x32')](_0xa885('0x33'))){_0x1c94ab[_0xa885('0x1e')]=qs[_0xa885('0x1e')](_0x5c4ca7[_0xa885('0x2c')]['limit']);_0x1c94ab['offset']=qs[_0xa885('0x1f')](_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x1f')]);}_0x1c94ab[_0xa885('0x34')]=qs[_0xa885('0x35')](_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x35')]);_0x1c94ab[_0xa885('0x36')]=qs[_0xa885('0x2e')](_['pick'](_0x5c4ca7['query'],_0x3e9e22[_0xa885('0x2e')]),_0x17c0eb);if(_0x5c4ca7['query']['filter']){_0x1c94ab[_0xa885('0x36')]=_['merge'](_0x1c94ab[_0xa885('0x36')],{'$or':_[_0xa885('0x28')](_0x17c0eb,function(_0x39503d){if(_0x39503d[_0xa885('0x2a')]!==_0xa885('0x37')){var _0xc35213={};_0xc35213[_0x39503d[_0xa885('0x27')]]={'$like':'%'+_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x38')]+'%'};return _0xc35213;}})});}_0x1c94ab=_[_0xa885('0x39')]({},_0x1c94ab,_0x5c4ca7['options']);var _0x30759d={'where':_0x1c94ab[_0xa885('0x36')]};return db[_0xa885('0x29')][_0xa885('0x3a')](_0x30759d)[_0xa885('0x24')](function(_0x5e327f){_0x3af5d9['count']=_0x5e327f;if(_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x3b')]){_0x1c94ab[_0xa885('0x3c')]=[{'all':!![]}];}return db[_0xa885('0x29')][_0xa885('0x3d')](_0x1c94ab);})['then'](function(_0x1f2a71){_0x3af5d9[_0xa885('0x3e')]=_0x1f2a71;return _0x3af5d9;})['then'](respondWithFilteredResult(_0x4fc438,_0x1c94ab))['catch'](handleError(_0x4fc438,null));};exports[_0xa885('0x3f')]=function(_0x299baf,_0x4da64c){var _0x561bf0={'raw':!![],'where':{'id':_0x299baf[_0xa885('0x40')]['id']}},_0x1089e5={};_0x1089e5[_0xa885('0x2b')]=_[_0xa885('0x2d')](db[_0xa885('0x29')][_0xa885('0x41')]);_0x1089e5[_0xa885('0x2c')]=_[_0xa885('0x2d')](_0x299baf[_0xa885('0x2c')]);_0x1089e5[_0xa885('0x2e')]=_[_0xa885('0x2f')](_0x1089e5['model'],_0x1089e5[_0xa885('0x2c')]);_0x561bf0[_0xa885('0x31')]=_[_0xa885('0x2f')](_0x1089e5['model'],qs[_0xa885('0x30')](_0x299baf[_0xa885('0x2c')][_0xa885('0x30')]));_0x561bf0[_0xa885('0x31')]=_0x561bf0['attributes'][_0xa885('0x42')]?_0x561bf0['attributes']:_0x1089e5[_0xa885('0x2b')];if(_0x299baf[_0xa885('0x2c')]['includeAll']){_0x561bf0[_0xa885('0x3c')]=[{'all':!![]}];}_0x561bf0=_[_0xa885('0x39')]({},_0x561bf0,_0x299baf[_0xa885('0x43')]);return db[_0xa885('0x29')][_0xa885('0x44')](_0x561bf0)['then'](handleEntityNotFound(_0x4da64c,null))[_0xa885('0x24')](respondWithResult(_0x4da64c,null))[_0xa885('0x45')](handleError(_0x4da64c,null));};exports[_0xa885('0x46')]=function(_0x51f4df,_0x4d146e){return db['Cdr'][_0xa885('0x46')](_0x51f4df[_0xa885('0x47')],{})[_0xa885('0x24')](respondWithResult(_0x4d146e,0xc9))[_0xa885('0x45')](handleError(_0x4d146e,null));};exports[_0xa885('0x23')]=function(_0x49aa9b,_0x43245c){if(_0x49aa9b[_0xa885('0x47')]['id']){delete _0x49aa9b[_0xa885('0x47')]['id'];}return db[_0xa885('0x29')][_0xa885('0x44')]({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))['then'](saveUpdates(_0x49aa9b[_0xa885('0x47')],null))[_0xa885('0x24')](respondWithResult(_0x43245c,null))[_0xa885('0x45')](handleError(_0x43245c,null));};exports[_0xa885('0x48')]=function(_0x164d9d,_0x66a035){return db[_0xa885('0x29')]['find']({'where':{'id':_0x164d9d[_0xa885('0x40')]['id']}})[_0xa885('0x24')](handleEntityNotFound(_0x66a035,null))[_0xa885('0x24')](removeEntity(_0x66a035,null))[_0xa885('0x45')](handleError(_0x66a035,null));};exports[_0xa885('0x49')]=function(_0x1bd3a2,_0x159d12){return db['Cdr'][_0xa885('0x49')]()[_0xa885('0x24')](respondWithResult(_0x159d12,null))[_0xa885('0x45')](handleError(_0x159d12,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 4f472a6..296cace 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(_0x1d8b34,_0xe81069){var _0x1b251d=function(_0x2af296){while(--_0x2af296){_0x1d8b34['push'](_0x1d8b34['shift']());}};_0x1b251d(++_0xe81069);}(_0x7a54,0x106));var _0x47a5=function(_0x59bab0,_0x97e5c){_0x59bab0=_0x59bab0-0x0;var _0xe924b5=_0x7a54[_0x59bab0];return _0xe924b5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x16fb98,_0x4edc1d){var _0x352f25=function(_0x77c053){while(--_0x77c053){_0x16fb98['push'](_0x16fb98['shift']());}};_0x352f25(++_0x4edc1d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2ce1fc9..a7b6b93 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 _0x0d09=['info','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then'];(function(_0x4b637b,_0x32f31b){var _0x1a1037=function(_0x5e82f9){while(--_0x5e82f9){_0x4b637b['push'](_0x4b637b['shift']());}};_0x1a1037(++_0x32f31b);}(_0x0d09,0x1d7));var _0x90d0=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0x0d09[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require(_0x90d0('0x0'));var util=require(_0x90d0('0x1'));var moment=require(_0x90d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x90d0('0x3'));var fs=require('fs');var Redis=require(_0x90d0('0x4'));var db=require(_0x90d0('0x5'))['db'];var utils=require(_0x90d0('0x6'));var logger=require(_0x90d0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x90d0('0x8')][_0x90d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fde01,_0xe36904,_0x5cb20d){return new BPromise(function(_0x2bb3f3,_0x4771d6){return client[_0x90d0('0xa')](_0x2fde01,_0x5cb20d)[_0x90d0('0xb')](function(_0x513898){logger[_0x90d0('0xc')]('Cdr,\x20%s,\x20%s',_0xe36904,'request\x20sent');logger['debug'](_0x90d0('0xd'),_0xe36904,_0x90d0('0xe'),JSON[_0x90d0('0xf')](_0x513898));if(_0x513898[_0x90d0('0x10')]){if(_0x513898[_0x90d0('0x10')]['code']===0x1f4){logger['error'](_0x90d0('0x11'),_0xe36904,_0x513898[_0x90d0('0x10')][_0x90d0('0x12')]);return _0x4771d6(_0x513898[_0x90d0('0x10')][_0x90d0('0x12')]);}logger[_0x90d0('0x10')]('Cdr,\x20%s,\x20%s',_0xe36904,_0x513898[_0x90d0('0x10')][_0x90d0('0x12')]);return _0x2bb3f3(_0x513898[_0x90d0('0x10')][_0x90d0('0x12')]);}else{logger['info'](_0x90d0('0x11'),_0xe36904,_0x90d0('0xe'));_0x2bb3f3(_0x513898[_0x90d0('0x13')][_0x90d0('0x12')]);}})[_0x90d0('0x14')](function(_0x27c701){logger[_0x90d0('0x10')](_0x90d0('0x11'),_0xe36904,_0x27c701);_0x4771d6(_0x27c701);});});} \ No newline at end of file +var _0x6a49=['message','Cdr,\x20%s,\x20%s','request\x20sent','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x3fe7cf,_0x3c56dc){var _0x4232a7=function(_0x3ed3df){while(--_0x3ed3df){_0x3fe7cf['push'](_0x3fe7cf['shift']());}};_0x4232a7(++_0x3c56dc);}(_0x6a49,0x138));var _0x96a4=function(_0x2d3526,_0x3a4031){_0x2d3526=_0x2d3526-0x0;var _0x4816e6=_0x6a49[_0x2d3526];return _0x4816e6;};'use strict';var _=require(_0x96a4('0x0'));var util=require(_0x96a4('0x1'));var moment=require(_0x96a4('0x2'));var BPromise=require('bluebird');var rs=require(_0x96a4('0x3'));var fs=require('fs');var Redis=require(_0x96a4('0x4'));var db=require(_0x96a4('0x5'))['db'];var utils=require(_0x96a4('0x6'));var logger=require('../../config/logger')(_0x96a4('0x7'));var config=require(_0x96a4('0x8'));var jayson=require(_0x96a4('0x9'));var client=jayson[_0x96a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219e45,_0x4ce60b,_0x3744fa){return new BPromise(function(_0x2c6f17,_0x31409e){return client['request'](_0x219e45,_0x3744fa)[_0x96a4('0xb')](function(_0x439de8){logger[_0x96a4('0xc')]('Cdr,\x20%s,\x20%s',_0x4ce60b,'request\x20sent');logger[_0x96a4('0xd')](_0x96a4('0xe'),_0x4ce60b,'request\x20sent',JSON[_0x96a4('0xf')](_0x439de8));if(_0x439de8['error']){if(_0x439de8['error'][_0x96a4('0x10')]===0x1f4){logger[_0x96a4('0x11')]('Cdr,\x20%s,\x20%s',_0x4ce60b,_0x439de8[_0x96a4('0x11')][_0x96a4('0x12')]);return _0x31409e(_0x439de8[_0x96a4('0x11')][_0x96a4('0x12')]);}logger['error'](_0x96a4('0x13'),_0x4ce60b,_0x439de8[_0x96a4('0x11')][_0x96a4('0x12')]);return _0x2c6f17(_0x439de8[_0x96a4('0x11')][_0x96a4('0x12')]);}else{logger[_0x96a4('0xc')](_0x96a4('0x13'),_0x4ce60b,_0x96a4('0x14'));_0x2c6f17(_0x439de8['result'][_0x96a4('0x12')]);}})[_0x96a4('0x15')](function(_0xf4d986){logger[_0x96a4('0x11')](_0x96a4('0x13'),_0x4ce60b,_0xf4d986);_0x31409e(_0xf4d986);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 426d7ba..d02c4b6 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(_0x71ae3c,_0x404627){var _0x194072=function(_0x13c008){while(--_0x13c008){_0x71ae3c['push'](_0x71ae3c['shift']());}};_0x194072(++_0x404627);}(_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(_0x1d80be,_0x3a60ff){var _0xf9a4f3=function(_0x5b8a08){while(--_0x5b8a08){_0x1d80be['push'](_0x1d80be['shift']());}};_0xf9a4f3(++_0x3a60ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 f5387e7..cca5621 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 _0xb305=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb305,0x1c1));var _0x5b30=function(_0x51a4d2,_0x3bef14){_0x51a4d2=_0x51a4d2-0x0;var _0x118df8=_0xb305[_0x51a4d2];return _0x118df8;};'use strict';var Sequelize=require(_0x5b30('0x0'));module[_0x5b30('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x5b30('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5b30('0x3')]()},'description':{'type':Sequelize[_0x5b30('0x2')]},'interval':{'type':Sequelize[_0x5b30('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0987=['*,*,*,*','sequelize','exports','noop','TEXT','STRING'];(function(_0x1ec128,_0x59efd5){var _0x1c11a9=function(_0x415b11){while(--_0x415b11){_0x1ec128['push'](_0x1ec128['shift']());}};_0x1c11a9(++_0x59efd5);}(_0x0987,0x193));var _0x7098=function(_0x2570bd,_0x465bd5){_0x2570bd=_0x2570bd-0x0;var _0x227eb0=_0x0987[_0x2570bd];return _0x227eb0;};'use strict';var Sequelize=require(_0x7098('0x0'));module[_0x7098('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7098('0x2')},'appdata':{'type':Sequelize[_0x7098('0x3')]()},'description':{'type':Sequelize[_0x7098('0x4')]},'interval':{'type':Sequelize[_0x7098('0x4')],'defaultValue':_0x7098('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 016b2f4..ed39042 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 _0x3176=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','keys','ChatApplication','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x528a7e,_0x8c6ad3){var _0x17f1e2=function(_0x2f6791){while(--_0x2f6791){_0x528a7e['push'](_0x528a7e['shift']());}};_0x17f1e2(++_0x8c6ad3);}(_0x3176,0x1d8));var _0x6317=function(_0x671904,_0xbdabdb){_0x671904=_0x671904-0x0;var _0x92009d=_0x3176[_0x671904];return _0x92009d;};'use strict';var emlformat=require(_0x6317('0x0'));var rimraf=require(_0x6317('0x1'));var zipdir=require(_0x6317('0x2'));var jsonpatch=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var moment=require(_0x6317('0x5'));var BPromise=require(_0x6317('0x6'));var Mustache=require(_0x6317('0x7'));var util=require(_0x6317('0x8'));var path=require(_0x6317('0x9'));var sox=require(_0x6317('0xa'));var csv=require(_0x6317('0xb'));var ejs=require(_0x6317('0xc'));var fs=require('fs');var fs_extra=require(_0x6317('0xd'));var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xb'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var licenseUtil=require(_0x6317('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x359566,_0x3f64fb){_0x3f64fb=_0x3f64fb||0xcc;return function(_0x4aa69f){if(_0x4aa69f){return _0x359566[_0x6317('0x1a')](_0x3f64fb);}return _0x359566[_0x6317('0x1b')](_0x3f64fb)['end']();};}function respondWithResult(_0x252b7d,_0x1fba31){_0x1fba31=_0x1fba31||0xc8;return function(_0x32ad4a){if(_0x32ad4a){return _0x252b7d[_0x6317('0x1b')](_0x1fba31)[_0x6317('0x1c')](_0x32ad4a);}};}function respondWithFilteredResult(_0x5317b4,_0x54e857){return function(_0x560b77){if(_0x560b77){var _0x1b42b3=typeof _0x54e857['offset']==='undefined'&&typeof _0x54e857[_0x6317('0x1d')]==='undefined';var _0x487bbc=_0x560b77[_0x6317('0x1e')];var _0x1d8497=_0x1b42b3?0x0:_0x54e857['offset'];var _0xc90572=_0x1b42b3?_0x560b77['count']:_0x54e857[_0x6317('0x1f')]+_0x54e857[_0x6317('0x1d')];var _0x164c96;if(_0xc90572>=_0x487bbc){_0xc90572=_0x487bbc;_0x164c96=0xc8;}else{_0x164c96=0xce;}_0x5317b4[_0x6317('0x1b')](_0x164c96);return _0x5317b4['set'](_0x6317('0x20'),_0x1d8497+'-'+_0xc90572+'/'+_0x487bbc)[_0x6317('0x1c')](_0x560b77);}return null;};}function patchUpdates(_0x30c5f1){return function(_0x3687d1){try{jsonpatch[_0x6317('0x21')](_0x3687d1,_0x30c5f1,!![]);}catch(_0x355b66){return BPromise[_0x6317('0x22')](_0x355b66);}return _0x3687d1[_0x6317('0x23')]();};}function saveUpdates(_0x1cd0c7,_0x1e9b7e){return function(_0x4b8b11){if(_0x4b8b11){return _0x4b8b11[_0x6317('0x24')](_0x1cd0c7)['then'](function(_0x1bdf53){return _0x1bdf53;});}return null;};}function removeEntity(_0x4a2e3e,_0x2b7669){return function(_0x2a36ee){if(_0x2a36ee){return _0x2a36ee[_0x6317('0x25')]()[_0x6317('0x26')](function(){_0x4a2e3e[_0x6317('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x674933,_0x14b136){return function(_0x4db284){if(!_0x4db284){_0x674933['sendStatus'](0x194);}return _0x4db284;};}function handleError(_0x336fb1,_0x2b4416){_0x2b4416=_0x2b4416||0x1f4;return function(_0x2ca4e7){logger[_0x6317('0x27')](_0x2ca4e7[_0x6317('0x28')]);if(_0x2ca4e7[_0x6317('0x29')]){delete _0x2ca4e7[_0x6317('0x29')];}_0x336fb1['status'](_0x2b4416)[_0x6317('0x2a')](_0x2ca4e7);};}exports[_0x6317('0x2b')]=function(_0x23d35b,_0x5538d8){var _0x343e56={'raw':!![],'where':{'id':_0x23d35b['params']['id']}},_0x1a3f96={};_0x1a3f96['model']=_[_0x6317('0x2c')](db[_0x6317('0x2d')]['rawAttributes']);_0x1a3f96[_0x6317('0x2e')]=_[_0x6317('0x2c')](_0x23d35b[_0x6317('0x2e')]);_0x1a3f96[_0x6317('0x2f')]=_[_0x6317('0x30')](_0x1a3f96[_0x6317('0x31')],_0x1a3f96[_0x6317('0x2e')]);_0x343e56[_0x6317('0x32')]=_[_0x6317('0x30')](_0x1a3f96[_0x6317('0x31')],qs[_0x6317('0x33')](_0x23d35b[_0x6317('0x2e')]['fields']));_0x343e56[_0x6317('0x32')]=_0x343e56['attributes'][_0x6317('0x34')]?_0x343e56[_0x6317('0x32')]:_0x1a3f96[_0x6317('0x31')];if(_0x23d35b[_0x6317('0x2e')][_0x6317('0x35')]){_0x343e56[_0x6317('0x36')]=[{'all':!![]}];}_0x343e56=_[_0x6317('0x37')]({},_0x343e56,_0x23d35b[_0x6317('0x38')]);return db[_0x6317('0x2d')][_0x6317('0x39')](_0x343e56)[_0x6317('0x26')](handleEntityNotFound(_0x5538d8,null))['then'](respondWithResult(_0x5538d8,null))[_0x6317('0x3a')](handleError(_0x5538d8,null));};exports[_0x6317('0x24')]=function(_0x28091b,_0x2a3cd2){if(_0x28091b[_0x6317('0x3b')]['id']){delete _0x28091b[_0x6317('0x3b')]['id'];}return db[_0x6317('0x2d')][_0x6317('0x39')]({'where':{'id':_0x28091b['params']['id']}})[_0x6317('0x26')](handleEntityNotFound(_0x2a3cd2,null))[_0x6317('0x26')](saveUpdates(_0x28091b['body'],null))[_0x6317('0x26')](respondWithResult(_0x2a3cd2,null))[_0x6317('0x3a')](handleError(_0x2a3cd2,null));};exports[_0x6317('0x25')]=function(_0x2d5f7d,_0x52aab3){return db[_0x6317('0x2d')][_0x6317('0x39')]({'where':{'id':_0x2d5f7d['params']['id']}})[_0x6317('0x26')](handleEntityNotFound(_0x52aab3,null))[_0x6317('0x26')](removeEntity(_0x52aab3,null))[_0x6317('0x3a')](handleError(_0x52aab3,null));}; \ No newline at end of file +var _0x2333=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','show','params','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll','merge','options','find','then','body','catch','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0x2333,0x11a));var _0x3233=function(_0x9e290a,_0x71091a){_0x9e290a=_0x9e290a-0x0;var _0x371e4c=_0x2333[_0x9e290a];return _0x371e4c;};'use strict';var emlformat=require(_0x3233('0x0'));var rimraf=require(_0x3233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3233('0x2'));var moment=require(_0x3233('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3233('0x4'));var util=require(_0x3233('0x5'));var path=require(_0x3233('0x6'));var sox=require(_0x3233('0x7'));var csv=require(_0x3233('0x8'));var ejs=require(_0x3233('0x9'));var fs=require('fs');var fs_extra=require(_0x3233('0xa'));var _=require(_0x3233('0xb'));var squel=require(_0x3233('0xc'));var crypto=require(_0x3233('0xd'));var jsforce=require(_0x3233('0xe'));var deskjs=require(_0x3233('0xf'));var toCsv=require(_0x3233('0x8'));var querystring=require(_0x3233('0x10'));var Papa=require(_0x3233('0x11'));var Redis=require(_0x3233('0x12'));var authService=require(_0x3233('0x13'));var qs=require(_0x3233('0x14'));var as=require(_0x3233('0x15'));var hardwareService=require(_0x3233('0x16'));var logger=require(_0x3233('0x17'))('api');var utils=require(_0x3233('0x18'));var config=require(_0x3233('0x19'));var licenseUtil=require(_0x3233('0x1a'));var db=require(_0x3233('0x1b'))['db'];function respondWithStatusCode(_0xd59689,_0x18166d){_0x18166d=_0x18166d||0xcc;return function(_0x44ef5f){if(_0x44ef5f){return _0xd59689[_0x3233('0x1c')](_0x18166d);}return _0xd59689[_0x3233('0x1d')](_0x18166d)[_0x3233('0x1e')]();};}function respondWithResult(_0x428b44,_0x27e9fd){_0x27e9fd=_0x27e9fd||0xc8;return function(_0x7f5e07){if(_0x7f5e07){return _0x428b44['status'](_0x27e9fd)['json'](_0x7f5e07);}};}function respondWithFilteredResult(_0xc71f65,_0x26a41e){return function(_0x45fc24){if(_0x45fc24){var _0x5885a5=typeof _0x26a41e[_0x3233('0x1f')]===_0x3233('0x20')&&typeof _0x26a41e[_0x3233('0x21')]==='undefined';var _0x33f2e5=_0x45fc24[_0x3233('0x22')];var _0x55fa30=_0x5885a5?0x0:_0x26a41e[_0x3233('0x1f')];var _0x58420c=_0x5885a5?_0x45fc24[_0x3233('0x22')]:_0x26a41e['offset']+_0x26a41e['limit'];var _0x5a6f13;if(_0x58420c>=_0x33f2e5){_0x58420c=_0x33f2e5;_0x5a6f13=0xc8;}else{_0x5a6f13=0xce;}_0xc71f65[_0x3233('0x1d')](_0x5a6f13);return _0xc71f65['set'](_0x3233('0x23'),_0x55fa30+'-'+_0x58420c+'/'+_0x33f2e5)['json'](_0x45fc24);}return null;};}function patchUpdates(_0x305227){return function(_0x161855){try{jsonpatch[_0x3233('0x24')](_0x161855,_0x305227,!![]);}catch(_0x42d311){return BPromise['reject'](_0x42d311);}return _0x161855[_0x3233('0x25')]();};}function saveUpdates(_0x2a9dd9,_0x56fa5a){return function(_0x531cd8){if(_0x531cd8){return _0x531cd8[_0x3233('0x26')](_0x2a9dd9)['then'](function(_0x199c37){return _0x199c37;});}return null;};}function removeEntity(_0xa73f3e,_0x43227e){return function(_0x4c3875){if(_0x4c3875){return _0x4c3875[_0x3233('0x27')]()['then'](function(){_0xa73f3e[_0x3233('0x1d')](0xcc)[_0x3233('0x1e')]();});}};}function handleEntityNotFound(_0x56f216,_0x3351d3){return function(_0x49a421){if(!_0x49a421){_0x56f216['sendStatus'](0x194);}return _0x49a421;};}function handleError(_0x430e8e,_0x39a345){_0x39a345=_0x39a345||0x1f4;return function(_0x5d8e63){logger[_0x3233('0x28')](_0x5d8e63[_0x3233('0x29')]);if(_0x5d8e63[_0x3233('0x2a')]){delete _0x5d8e63[_0x3233('0x2a')];}_0x430e8e[_0x3233('0x1d')](_0x39a345)['send'](_0x5d8e63);};}exports[_0x3233('0x2b')]=function(_0xd4171b,_0xabcf54){var _0xc87d63={'raw':!![],'where':{'id':_0xd4171b[_0x3233('0x2c')]['id']}},_0x233f6b={};_0x233f6b[_0x3233('0x2d')]=_[_0x3233('0x2e')](db[_0x3233('0x2f')]['rawAttributes']);_0x233f6b[_0x3233('0x30')]=_[_0x3233('0x2e')](_0xd4171b['query']);_0x233f6b[_0x3233('0x31')]=_[_0x3233('0x32')](_0x233f6b['model'],_0x233f6b[_0x3233('0x30')]);_0xc87d63[_0x3233('0x33')]=_['intersection'](_0x233f6b[_0x3233('0x2d')],qs[_0x3233('0x34')](_0xd4171b['query'][_0x3233('0x34')]));_0xc87d63[_0x3233('0x33')]=_0xc87d63['attributes']['length']?_0xc87d63[_0x3233('0x33')]:_0x233f6b['model'];if(_0xd4171b[_0x3233('0x30')][_0x3233('0x35')]){_0xc87d63['include']=[{'all':!![]}];}_0xc87d63=_[_0x3233('0x36')]({},_0xc87d63,_0xd4171b[_0x3233('0x37')]);return db[_0x3233('0x2f')][_0x3233('0x38')](_0xc87d63)[_0x3233('0x39')](handleEntityNotFound(_0xabcf54,null))[_0x3233('0x39')](respondWithResult(_0xabcf54,null))['catch'](handleError(_0xabcf54,null));};exports['update']=function(_0x33669b,_0x3c2ab8){if(_0x33669b['body']['id']){delete _0x33669b[_0x3233('0x3a')]['id'];}return db['ChatApplication'][_0x3233('0x38')]({'where':{'id':_0x33669b[_0x3233('0x2c')]['id']}})[_0x3233('0x39')](handleEntityNotFound(_0x3c2ab8,null))['then'](saveUpdates(_0x33669b[_0x3233('0x3a')],null))[_0x3233('0x39')](respondWithResult(_0x3c2ab8,null))[_0x3233('0x3b')](handleError(_0x3c2ab8,null));};exports['destroy']=function(_0x3edb85,_0x461eb7){return db[_0x3233('0x2f')][_0x3233('0x38')]({'where':{'id':_0x3edb85[_0x3233('0x2c')]['id']}})[_0x3233('0x39')](handleEntityNotFound(_0x461eb7,null))[_0x3233('0x39')](removeEntity(_0x461eb7,null))[_0x3233('0x3b')](handleError(_0x461eb7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9fdba39..d155baf 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 _0x8b5c=['rimraf','../../config/environment','./chatApplication.attributes','exports','chat_applications','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x2b0a86,_0x2ecebd){var _0x955940=function(_0x1988f8){while(--_0x1988f8){_0x2b0a86['push'](_0x2b0a86['shift']());}};_0x955940(++_0x2ecebd);}(_0x8b5c,0x1da));var _0xc8b5=function(_0x310ac0,_0xedd465){_0x310ac0=_0x310ac0-0x0;var _0x43aaa0=_0x8b5c[_0x310ac0];return _0x43aaa0;};'use strict';var _=require(_0xc8b5('0x0'));var util=require(_0xc8b5('0x1'));var logger=require('../../config/logger')(_0xc8b5('0x2'));var moment=require(_0xc8b5('0x3'));var BPromise=require(_0xc8b5('0x4'));var rp=require(_0xc8b5('0x5'));var fs=require('fs');var path=require(_0xc8b5('0x6'));var rimraf=require(_0xc8b5('0x7'));var config=require(_0xc8b5('0x8'));var attributes=require(_0xc8b5('0x9'));module[_0xc8b5('0xa')]=function(_0x372407,_0x4b4c75){return _0x372407['define']('ChatApplication',attributes,{'tableName':_0xc8b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc8b5('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x3e44=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x3e44,0xd8));var _0x43e4=function(_0x2443ca,_0x215399){_0x2443ca=_0x2443ca-0x0;var _0x5933df=_0x3e44[_0x2443ca];return _0x5933df;};'use strict';var _=require(_0x43e4('0x0'));var util=require('util');var logger=require(_0x43e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x43e4('0x2'));var rp=require(_0x43e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x43e4('0x4'));var config=require(_0x43e4('0x5'));var attributes=require('./chatApplication.attributes');module[_0x43e4('0x6')]=function(_0x19cbb8,_0x190d4c){return _0x19cbb8[_0x43e4('0x7')](_0x43e4('0x8'),attributes,{'tableName':_0x43e4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x43e4('0xa'),'collate':_0x43e4('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index abc9a86..0a39079 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 _0x8be7=['rpc','../../config/environment','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x338995,_0x467360){var _0x5e0956=function(_0x5a6fa4){while(--_0x5a6fa4){_0x338995['push'](_0x338995['shift']());}};_0x5e0956(++_0x467360);}(_0x8be7,0x197));var _0x78be=function(_0x5590a7,_0x24f509){_0x5590a7=_0x5590a7-0x0;var _0x522a21=_0x8be7[_0x5590a7];return _0x522a21;};'use strict';var _=require('lodash');var util=require(_0x78be('0x0'));var moment=require(_0x78be('0x1'));var BPromise=require(_0x78be('0x2'));var rs=require(_0x78be('0x3'));var fs=require('fs');var Redis=require(_0x78be('0x4'));var db=require(_0x78be('0x5'))['db'];var utils=require(_0x78be('0x6'));var logger=require('../../config/logger')(_0x78be('0x7'));var config=require(_0x78be('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x78be('0x9')][_0x78be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33e98f,_0x1386c1,_0x44a649){return new BPromise(function(_0x2ce8f6,_0x454e1e){return client[_0x78be('0xb')](_0x33e98f,_0x44a649)[_0x78be('0xc')](function(_0x53ef2b){logger[_0x78be('0xd')](_0x78be('0xe'),_0x1386c1,'request\x20sent');logger['debug'](_0x78be('0xf'),_0x1386c1,'request\x20sent',JSON[_0x78be('0x10')](_0x53ef2b));if(_0x53ef2b[_0x78be('0x11')]){if(_0x53ef2b[_0x78be('0x11')][_0x78be('0x12')]===0x1f4){logger[_0x78be('0x11')](_0x78be('0xe'),_0x1386c1,_0x53ef2b[_0x78be('0x11')][_0x78be('0x13')]);return _0x454e1e(_0x53ef2b[_0x78be('0x11')][_0x78be('0x13')]);}logger['error'](_0x78be('0xe'),_0x1386c1,_0x53ef2b[_0x78be('0x11')]['message']);return _0x2ce8f6(_0x53ef2b[_0x78be('0x11')][_0x78be('0x13')]);}else{logger[_0x78be('0xd')](_0x78be('0xe'),_0x1386c1,_0x78be('0x14'));_0x2ce8f6(_0x53ef2b[_0x78be('0x15')][_0x78be('0x13')]);}})[_0x78be('0x16')](function(_0x24871e){logger[_0x78be('0x11')](_0x78be('0xe'),_0x1386c1,_0x24871e);_0x454e1e(_0x24871e);});});} \ No newline at end of file +var _0x1142=['request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x1142,0xae));var _0x2114=function(_0x37ac89,_0x74c6bd){_0x37ac89=_0x37ac89-0x0;var _0x3b9691=_0x1142[_0x37ac89];return _0x3b9691;};'use strict';var _=require('lodash');var util=require(_0x2114('0x0'));var moment=require(_0x2114('0x1'));var BPromise=require(_0x2114('0x2'));var rs=require(_0x2114('0x3'));var fs=require('fs');var Redis=require(_0x2114('0x4'));var db=require(_0x2114('0x5'))['db'];var utils=require(_0x2114('0x6'));var logger=require('../../config/logger')(_0x2114('0x7'));var config=require(_0x2114('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2114('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x475f22,_0x25b2c3,_0x37cb0c){return new BPromise(function(_0x5a9db3,_0x4aea43){return client[_0x2114('0xa')](_0x475f22,_0x37cb0c)['then'](function(_0x218513){logger[_0x2114('0xb')](_0x2114('0xc'),_0x25b2c3,'request\x20sent');logger[_0x2114('0xd')](_0x2114('0xe'),_0x25b2c3,_0x2114('0xf'),JSON[_0x2114('0x10')](_0x218513));if(_0x218513[_0x2114('0x11')]){if(_0x218513['error'][_0x2114('0x12')]===0x1f4){logger['error'](_0x2114('0xc'),_0x25b2c3,_0x218513[_0x2114('0x11')][_0x2114('0x13')]);return _0x4aea43(_0x218513['error'][_0x2114('0x13')]);}logger[_0x2114('0x11')](_0x2114('0xc'),_0x25b2c3,_0x218513[_0x2114('0x11')][_0x2114('0x13')]);return _0x5a9db3(_0x218513[_0x2114('0x11')]['message']);}else{logger[_0x2114('0xb')](_0x2114('0xc'),_0x25b2c3,_0x2114('0xf'));_0x5a9db3(_0x218513['result'][_0x2114('0x13')]);}})[_0x2114('0x14')](function(_0x2ccc56){logger[_0x2114('0x11')]('ChatApplication,\x20%s,\x20%s',_0x25b2c3,_0x2ccc56);_0x4aea43(_0x2ccc56);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 73741a6..4214c27 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 _0x8773=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x2b542f,_0x253798){var _0x442ecd=function(_0x2c0675){while(--_0x2c0675){_0x2b542f['push'](_0x2b542f['shift']());}};_0x442ecd(++_0x253798);}(_0x8773,0x17e));var _0x3877=function(_0x33a68,_0x3f2f1d){_0x33a68=_0x33a68-0x0;var _0x5640ff=_0x8773[_0x33a68];return _0x5640ff;};'use strict';var multer=require('multer');var util=require(_0x3877('0x0'));var path=require('path');var timeout=require(_0x3877('0x1'));var express=require('express');var router=express[_0x3877('0x2')]();var fs_extra=require(_0x3877('0x3'));var auth=require(_0x3877('0x4'));var interaction=require(_0x3877('0x5'));var config=require('../../config/environment');var controller=require(_0x3877('0x6'));router[_0x3877('0x7')](_0x3877('0x8'),auth[_0x3877('0x9')](),controller[_0x3877('0xa')]);router[_0x3877('0xb')]('/:id',auth[_0x3877('0x9')](),controller[_0x3877('0xc')]);router[_0x3877('0xd')](_0x3877('0x8'),auth[_0x3877('0x9')](),controller[_0x3877('0xe')]);module[_0x3877('0xf')]=router; \ No newline at end of file +var _0x7a98=['../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3b2c7a,_0x55ed65){var _0x558220=function(_0x476f49){while(--_0x476f49){_0x3b2c7a['push'](_0x3b2c7a['shift']());}};_0x558220(++_0x55ed65);}(_0x7a98,0x198));var _0x87a9=function(_0x18c8f9,_0x1c51e5){_0x18c8f9=_0x18c8f9-0x0;var _0x5ad5a6=_0x7a98[_0x18c8f9];return _0x5ad5a6;};'use strict';var multer=require(_0x87a9('0x0'));var util=require('util');var path=require(_0x87a9('0x1'));var timeout=require(_0x87a9('0x2'));var express=require(_0x87a9('0x3'));var router=express[_0x87a9('0x4')]();var fs_extra=require(_0x87a9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x87a9('0x6'));var config=require(_0x87a9('0x7'));var controller=require(_0x87a9('0x8'));router[_0x87a9('0x9')](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xc')]);router[_0x87a9('0xd')](_0x87a9('0xa'),auth[_0x87a9('0xb')](),controller[_0x87a9('0xe')]);router[_0x87a9('0xf')](_0x87a9('0xa'),auth['isAuthenticated'](),controller[_0x87a9('0x10')]);module[_0x87a9('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index a35d550..67d64cb 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 _0xe944=['sequelize','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe944,0x174));var _0x4e94=function(_0x1777da,_0x1dc74f){_0x1777da=_0x1777da-0x0;var _0x20ca4b=_0xe944[_0x1777da];return _0x20ca4b;};'use strict';var Sequelize=require(_0x4e94('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4e94('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x741a=['sequelize','exports','STRING'];(function(_0x352b44,_0x4a91a1){var _0x3e8baa=function(_0xed4bc3){while(--_0xed4bc3){_0x352b44['push'](_0x352b44['shift']());}};_0x3e8baa(++_0x4a91a1);}(_0x741a,0x7b));var _0xa741=function(_0x293a24,_0x2406e6){_0x293a24=_0x293a24-0x0;var _0x23d1cf=_0x741a[_0x293a24];return _0x23d1cf;};'use strict';var Sequelize=require(_0xa741('0x0'));module[_0xa741('0x1')]={'name':{'type':Sequelize[_0xa741('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa741('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 0ffae08..9391e2c 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 _0x5199=['status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','error','stack','name','send','index','map','ChatGroup','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','merge','include','findAll','rows','catch','params','rawAttributes','length','includeAll','options','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','ids','findOne','User','sort','filter','getMembers','removeMembers','addMessage','getMessages','keys','$gte','format','eml-format','rimraf','fast-json-patch','bluebird','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus'];(function(_0x2e092e,_0x1bbef3){var _0x4d4f52=function(_0x260843){while(--_0x260843){_0x2e092e['push'](_0x2e092e['shift']());}};_0x4d4f52(++_0x1bbef3);}(_0x5199,0x1ae));var _0x9519=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5199[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x9519('0x0'));var rimraf=require(_0x9519('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9519('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9519('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9519('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9519('0x5'));var _=require(_0x9519('0x6'));var squel=require(_0x9519('0x7'));var crypto=require('crypto');var jsforce=require(_0x9519('0x8'));var deskjs=require(_0x9519('0x9'));var toCsv=require(_0x9519('0x4'));var querystring=require(_0x9519('0xa'));var Papa=require(_0x9519('0xb'));var Redis=require(_0x9519('0xc'));var authService=require(_0x9519('0xd'));var qs=require(_0x9519('0xe'));var as=require(_0x9519('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9519('0x10'));var utils=require(_0x9519('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9519('0x12'))['db'];config[_0x9519('0x13')]=_[_0x9519('0x14')](config['redis'],{'host':_0x9519('0x15'),'port':0x18eb});var socket=require(_0x9519('0x16'))(new Redis(config[_0x9519('0x13')]));require(_0x9519('0x17'))['register'](socket);function respondWithStatusCode(_0x501b29,_0x3c53d1){_0x3c53d1=_0x3c53d1||0xcc;return function(_0x5ad2f9){if(_0x5ad2f9){return _0x501b29[_0x9519('0x18')](_0x3c53d1);}return _0x501b29[_0x9519('0x19')](_0x3c53d1)[_0x9519('0x1a')]();};}function respondWithResult(_0x43092f,_0x190eff){_0x190eff=_0x190eff||0xc8;return function(_0x2eddbf){if(_0x2eddbf){return _0x43092f[_0x9519('0x19')](_0x190eff)['json'](_0x2eddbf);}};}function respondWithFilteredResult(_0xb43e68,_0x4f8053){return function(_0x41b77f){if(_0x41b77f){var _0x354bc1=typeof _0x4f8053[_0x9519('0x1b')]===_0x9519('0x1c')&&typeof _0x4f8053[_0x9519('0x1d')]===_0x9519('0x1c');var _0x3e9844=_0x41b77f[_0x9519('0x1e')];var _0x5c3341=_0x354bc1?0x0:_0x4f8053[_0x9519('0x1b')];var _0x1267a1=_0x354bc1?_0x41b77f[_0x9519('0x1e')]:_0x4f8053[_0x9519('0x1b')]+_0x4f8053[_0x9519('0x1d')];var _0x2cb0dd;if(_0x1267a1>=_0x3e9844){_0x1267a1=_0x3e9844;_0x2cb0dd=0xc8;}else{_0x2cb0dd=0xce;}_0xb43e68[_0x9519('0x19')](_0x2cb0dd);return _0xb43e68['set'](_0x9519('0x1f'),_0x5c3341+'-'+_0x1267a1+'/'+_0x3e9844)[_0x9519('0x20')](_0x41b77f);}return null;};}function patchUpdates(_0x4b053a){return function(_0x20a7c6){try{jsonpatch['apply'](_0x20a7c6,_0x4b053a,!![]);}catch(_0x477851){return BPromise[_0x9519('0x21')](_0x477851);}return _0x20a7c6[_0x9519('0x22')]();};}function saveUpdates(_0x53a21f,_0x1627f8){return function(_0x1f0a61){if(_0x1f0a61){return _0x1f0a61[_0x9519('0x23')](_0x53a21f)[_0x9519('0x24')](function(_0x1d456a){return _0x1d456a;});}return null;};}function removeEntity(_0x99f91d,_0x319bdd){return function(_0x36c243){if(_0x36c243){return _0x36c243['destroy']()['then'](function(){_0x99f91d[_0x9519('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c4cc7,_0x11e38a){return function(_0x293359){if(!_0x293359){_0x5c4cc7[_0x9519('0x18')](0x194);}return _0x293359;};}function handleError(_0x2a8a01,_0x423b59){_0x423b59=_0x423b59||0x1f4;return function(_0x1a6416){logger[_0x9519('0x25')](_0x1a6416[_0x9519('0x26')]);if(_0x1a6416[_0x9519('0x27')]){delete _0x1a6416[_0x9519('0x27')];}_0x2a8a01['status'](_0x423b59)[_0x9519('0x28')](_0x1a6416);};}exports[_0x9519('0x29')]=function(_0x15b7b6,_0x3b3914){var _0x30cf1d={},_0x1921c9={},_0x1358a8={'count':0x0,'rows':[]};var _0x458c38=_[_0x9519('0x2a')](db[_0x9519('0x2b')]['rawAttributes'],function(_0x2da3aa){return{'name':_0x2da3aa[_0x9519('0x2c')],'type':_0x2da3aa[_0x9519('0x2d')][_0x9519('0x2e')]};});_0x1921c9[_0x9519('0x2f')]=_[_0x9519('0x2a')](_0x458c38,_0x9519('0x27'));_0x1921c9[_0x9519('0x30')]=_['keys'](_0x15b7b6['query']);_0x1921c9['filters']=_['intersection'](_0x1921c9[_0x9519('0x2f')],_0x1921c9[_0x9519('0x30')]);_0x30cf1d['attributes']=_[_0x9519('0x31')](_0x1921c9[_0x9519('0x2f')],qs[_0x9519('0x32')](_0x15b7b6[_0x9519('0x30')][_0x9519('0x32')]));_0x30cf1d['attributes']=_0x30cf1d[_0x9519('0x33')]['length']?_0x30cf1d[_0x9519('0x33')]:_0x1921c9[_0x9519('0x2f')];if(!_0x15b7b6[_0x9519('0x30')][_0x9519('0x34')](_0x9519('0x35'))){_0x30cf1d[_0x9519('0x1d')]=qs[_0x9519('0x1d')](_0x15b7b6[_0x9519('0x30')][_0x9519('0x1d')]);_0x30cf1d[_0x9519('0x1b')]=qs[_0x9519('0x1b')](_0x15b7b6['query']['offset']);}_0x30cf1d[_0x9519('0x36')]=qs['sort'](_0x15b7b6[_0x9519('0x30')]['sort']);_0x30cf1d[_0x9519('0x37')]=qs[_0x9519('0x38')](_[_0x9519('0x39')](_0x15b7b6[_0x9519('0x30')],_0x1921c9[_0x9519('0x38')]),_0x458c38);if(_0x15b7b6[_0x9519('0x30')]['filter']){_0x30cf1d['where']=_[_0x9519('0x3a')](_0x30cf1d[_0x9519('0x37')],{'$or':_[_0x9519('0x2a')](_0x458c38,function(_0x128882){if(_0x128882[_0x9519('0x2d')]!=='VIRTUAL'){var _0x104a74={};_0x104a74[_0x128882['name']]={'$like':'%'+_0x15b7b6[_0x9519('0x30')]['filter']+'%'};return _0x104a74;}})});}_0x30cf1d=_['merge']({},_0x30cf1d,_0x15b7b6['options']);var _0x35511f={'where':_0x30cf1d['where']};return db[_0x9519('0x2b')][_0x9519('0x1e')](_0x35511f)['then'](function(_0x3dbe1c){_0x1358a8['count']=_0x3dbe1c;if(_0x15b7b6[_0x9519('0x30')]['includeAll']){_0x30cf1d[_0x9519('0x3b')]=[{'all':!![]}];}return db[_0x9519('0x2b')][_0x9519('0x3c')](_0x30cf1d);})['then'](function(_0x53a58e){_0x1358a8[_0x9519('0x3d')]=_0x53a58e;return _0x1358a8;})[_0x9519('0x24')](respondWithFilteredResult(_0x3b3914,_0x30cf1d))[_0x9519('0x3e')](handleError(_0x3b3914,null));};exports['show']=function(_0x373b99,_0x4358cb){var _0x8ee97c={'raw':!![],'where':{'id':_0x373b99[_0x9519('0x3f')]['id']}},_0x2d2e3f={};_0x2d2e3f[_0x9519('0x2f')]=_['keys'](db[_0x9519('0x2b')][_0x9519('0x40')]);_0x2d2e3f[_0x9519('0x30')]=_['keys'](_0x373b99[_0x9519('0x30')]);_0x2d2e3f['filters']=_[_0x9519('0x31')](_0x2d2e3f[_0x9519('0x2f')],_0x2d2e3f['query']);_0x8ee97c[_0x9519('0x33')]=_[_0x9519('0x31')](_0x2d2e3f[_0x9519('0x2f')],qs[_0x9519('0x32')](_0x373b99[_0x9519('0x30')][_0x9519('0x32')]));_0x8ee97c[_0x9519('0x33')]=_0x8ee97c[_0x9519('0x33')][_0x9519('0x41')]?_0x8ee97c[_0x9519('0x33')]:_0x2d2e3f[_0x9519('0x2f')];if(_0x373b99[_0x9519('0x30')][_0x9519('0x42')]){_0x8ee97c[_0x9519('0x3b')]=[{'all':!![]}];}_0x8ee97c=_[_0x9519('0x3a')]({},_0x8ee97c,_0x373b99[_0x9519('0x43')]);return db[_0x9519('0x2b')][_0x9519('0x44')](_0x8ee97c)[_0x9519('0x24')](handleEntityNotFound(_0x4358cb,null))[_0x9519('0x24')](respondWithResult(_0x4358cb,null))[_0x9519('0x3e')](handleError(_0x4358cb,null));};exports[_0x9519('0x45')]=function(_0x36cd0e,_0x3b4add){return db['ChatGroup']['create'](_0x36cd0e[_0x9519('0x46')],{})[_0x9519('0x24')](respondWithResult(_0x3b4add,0xc9))[_0x9519('0x3e')](handleError(_0x3b4add,null));};exports['update']=function(_0x30ba88,_0x52a7d1){if(_0x30ba88[_0x9519('0x46')]['id']){delete _0x30ba88[_0x9519('0x46')]['id'];}return db[_0x9519('0x2b')]['find']({'where':{'id':_0x30ba88['params']['id']}})[_0x9519('0x24')](handleEntityNotFound(_0x52a7d1,null))[_0x9519('0x24')](saveUpdates(_0x30ba88['body'],null))['then'](respondWithResult(_0x52a7d1,null))['catch'](handleError(_0x52a7d1,null));};exports[_0x9519('0x47')]=function(_0x5b5b84,_0x30cd3a){return db[_0x9519('0x2b')][_0x9519('0x44')]({'where':{'id':_0x5b5b84[_0x9519('0x3f')]['id']}})[_0x9519('0x24')](handleEntityNotFound(_0x30cd3a,null))[_0x9519('0x24')](removeEntity(_0x30cd3a,null))[_0x9519('0x3e')](handleError(_0x30cd3a,null));};exports[_0x9519('0x48')]=function(_0x21f179,_0x54b232){return db[_0x9519('0x2b')][_0x9519('0x48')]()[_0x9519('0x24')](respondWithResult(_0x54b232,null))[_0x9519('0x3e')](handleError(_0x54b232,null));};exports[_0x9519('0x49')]=function(_0x3efaa8,_0x24691f,_0x67c81){return db[_0x9519('0x4a')][_0x9519('0x1e')]({'where':{'ChatGroupId':_0x3efaa8['params']['id'],'ToId':_0x3efaa8[_0x9519('0x4b')]['id'],'read':![]}})['then'](function(_0x33cc35){return{'id':_[_0x9519('0x4c')](_0x3efaa8['params']['id']),'count':_0x33cc35};})[_0x9519('0x24')](respondWithResult(_0x24691f,null))[_0x9519('0x3e')](handleError(_0x24691f,null));};exports['addMembers']=function(_0x3373ce,_0x230856,_0x37dde1){return db[_0x9519('0x2b')][_0x9519('0x44')]({'where':{'id':_0x3373ce['params']['id']}})['then'](handleEntityNotFound(_0x230856,null))[_0x9519('0x24')](function(_0x1fedd7){if(_0x1fedd7){return _0x1fedd7[_0x9519('0x4d')](_0x3373ce[_0x9519('0x46')]['ids'],_[_0x9519('0x4e')](_0x3373ce[_0x9519('0x46')],[_0x9519('0x4f'),'id'])||{});}})[_0x9519('0x24')](respondWithResult(_0x230856,null))[_0x9519('0x3e')](handleError(_0x230856,null));};exports['getMembers']=function(_0xc0ceb1,_0x1edfb8,_0x357e71){var _0x2300ad={};var _0x250af9={};var _0x4d43b3;var _0x40e8c8;return db[_0x9519('0x2b')][_0x9519('0x50')]({'where':{'id':_0xc0ceb1[_0x9519('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1edfb8,null))[_0x9519('0x24')](function(_0x48d95e){if(_0x48d95e){_0x4d43b3=_0x48d95e;_0x250af9[_0x9519('0x2f')]=_['keys'](db[_0x9519('0x51')]['rawAttributes']);_0x250af9[_0x9519('0x30')]=_['keys'](_0xc0ceb1[_0x9519('0x30')]);_0x250af9[_0x9519('0x38')]=_[_0x9519('0x31')](_0x250af9[_0x9519('0x2f')],_0x250af9[_0x9519('0x30')]);_0x2300ad['attributes']=_['intersection'](_0x250af9[_0x9519('0x2f')],qs[_0x9519('0x32')](_0xc0ceb1[_0x9519('0x30')][_0x9519('0x32')]));_0x2300ad[_0x9519('0x33')]=_0x2300ad[_0x9519('0x33')][_0x9519('0x41')]?_0x2300ad['attributes']:_0x250af9[_0x9519('0x2f')];_0x2300ad['order']=qs['sort'](_0xc0ceb1[_0x9519('0x30')][_0x9519('0x52')]);_0x2300ad[_0x9519('0x37')]=qs['filters'](_['pick'](_0xc0ceb1[_0x9519('0x30')],_0x250af9['filters']));if(_0xc0ceb1[_0x9519('0x30')][_0x9519('0x53')]){_0x2300ad[_0x9519('0x37')]=_[_0x9519('0x3a')](_0x2300ad[_0x9519('0x37')],{'$or':_[_0x9519('0x2a')](_0x2300ad[_0x9519('0x33')],function(_0x4816e0){var _0x1ff474={};_0x1ff474[_0x4816e0]={'$like':'%'+_0xc0ceb1['query'][_0x9519('0x53')]+'%'};return _0x1ff474;})});}_0x2300ad=_[_0x9519('0x3a')]({},_0x2300ad,_0xc0ceb1[_0x9519('0x43')]);return _0x4d43b3[_0x9519('0x54')](_0x2300ad);}})['then'](function(_0x4e0ba7){if(_0x4e0ba7){_0x40e8c8=_0x4e0ba7[_0x9519('0x41')];if(!_0xc0ceb1[_0x9519('0x30')][_0x9519('0x34')]('nolimit')){_0x2300ad[_0x9519('0x1d')]=qs[_0x9519('0x1d')](_0xc0ceb1[_0x9519('0x30')]['limit']);_0x2300ad[_0x9519('0x1b')]=qs['offset'](_0xc0ceb1[_0x9519('0x30')]['offset']);}return _0x4d43b3[_0x9519('0x54')](_0x2300ad);}})[_0x9519('0x24')](function(_0x249485){if(_0x249485){return _0x249485?{'count':_0x40e8c8,'rows':_0x249485}:null;}})[_0x9519('0x24')](respondWithResult(_0x1edfb8,null))[_0x9519('0x3e')](handleError(_0x1edfb8,null));};exports[_0x9519('0x55')]=function(_0xe68b17,_0x401046,_0xce10c5){return db[_0x9519('0x2b')][_0x9519('0x44')]({'where':{'id':_0xe68b17[_0x9519('0x3f')]['id']}})[_0x9519('0x24')](handleEntityNotFound(_0x401046,null))[_0x9519('0x24')](function(_0x2dee58){if(_0x2dee58){return _0x2dee58[_0x9519('0x55')](_0xe68b17[_0x9519('0x30')][_0x9519('0x4f')]);}})[_0x9519('0x24')](respondWithStatusCode(_0x401046,null))[_0x9519('0x3e')](handleError(_0x401046,null));};exports[_0x9519('0x56')]=function(_0x41886b,_0x4bfe1d,_0x1c6f95){if(_0x41886b[_0x9519('0x46')]['id']){delete _0x41886b[_0x9519('0x46')]['id'];}return db[_0x9519('0x2b')][_0x9519('0x44')]({'where':{'id':_0x41886b[_0x9519('0x3f')]['id']}})[_0x9519('0x24')](handleEntityNotFound(_0x4bfe1d,null))['then'](function(_0x28d42c){if(_0x28d42c){_0x41886b[_0x9519('0x46')]['ChatGroupId']=_0x28d42c['id'];return db[_0x9519('0x4a')][_0x9519('0x45')](_0x41886b[_0x9519('0x46')]);}})[_0x9519('0x24')](respondWithResult(_0x4bfe1d,null))['catch'](handleError(_0x4bfe1d,null));};exports[_0x9519('0x57')]=function(_0x35aa6f,_0x5c5ed4,_0x381c90){var _0x2ddb64={};var _0x18037d={};var _0x482f1d;var _0x433613;return db['ChatGroup']['findOne']({'where':{'id':_0x35aa6f[_0x9519('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5c5ed4,null))['then'](function(_0x3d837d){if(_0x3d837d){_0x482f1d=_0x3d837d;_0x18037d[_0x9519('0x2f')]=_[_0x9519('0x58')](db[_0x9519('0x4a')]['rawAttributes']);_0x18037d[_0x9519('0x30')]=_[_0x9519('0x58')](_0x35aa6f[_0x9519('0x30')]);_0x18037d[_0x9519('0x38')]=_['intersection'](_0x18037d[_0x9519('0x2f')],_0x18037d[_0x9519('0x30')]);_0x2ddb64[_0x9519('0x33')]=_[_0x9519('0x31')](_0x18037d[_0x9519('0x2f')],qs[_0x9519('0x32')](_0x35aa6f['query'][_0x9519('0x32')]));_0x2ddb64['attributes']=_0x2ddb64['attributes'][_0x9519('0x41')]?_0x2ddb64['attributes']:_0x18037d[_0x9519('0x2f')];_0x2ddb64[_0x9519('0x36')]=qs[_0x9519('0x52')](_0x35aa6f[_0x9519('0x30')][_0x9519('0x52')]);_0x2ddb64[_0x9519('0x37')]=qs['filters'](_['pick'](_0x35aa6f[_0x9519('0x30')],_0x18037d[_0x9519('0x38')]));if(_0x35aa6f[_0x9519('0x30')][_0x9519('0x53')]){_0x2ddb64[_0x9519('0x37')]=_[_0x9519('0x3a')](_0x2ddb64[_0x9519('0x37')],{'$or':_[_0x9519('0x2a')](_0x2ddb64[_0x9519('0x33')],function(_0x3f6414){var _0x13211e={};_0x13211e[_0x3f6414]={'$like':'%'+_0x35aa6f[_0x9519('0x30')][_0x9519('0x53')]+'%'};return _0x13211e;})});}if(_0x35aa6f[_0x9519('0x30')][_0x9519('0x59')]){var _0x15e881=_0x35aa6f['query'][_0x9519('0x59')]['split'](',');var _0x164738={};_0x164738[_0x15e881[0x0]]={'$gte':moment(_0x15e881[0x1])[_0x9519('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2ddb64[_0x9519('0x37')]=_[_0x9519('0x3a')](_0x2ddb64[_0x9519('0x37')],_0x164738);}_0x2ddb64=_[_0x9519('0x3a')]({},_0x2ddb64,_0x35aa6f[_0x9519('0x43')]);return _0x482f1d['getMessages'](_0x2ddb64);}})[_0x9519('0x24')](function(_0x323e06){if(_0x323e06){_0x433613=_0x323e06[_0x9519('0x41')];if(!_0x35aa6f[_0x9519('0x30')]['hasOwnProperty']('nolimit')){_0x2ddb64[_0x9519('0x1d')]=qs[_0x9519('0x1d')](_0x35aa6f[_0x9519('0x30')]['limit']);_0x2ddb64[_0x9519('0x1b')]=qs['offset'](_0x35aa6f['query'][_0x9519('0x1b')]);}return _0x482f1d[_0x9519('0x57')](_0x2ddb64);}})[_0x9519('0x24')](function(_0x467c7a){if(_0x467c7a){return _0x467c7a?{'count':_0x433613,'rows':_0x467c7a}:null;}})[_0x9519('0x24')](respondWithResult(_0x5c5ed4,null))[_0x9519('0x3e')](handleError(_0x5c5ed4,null));}; \ No newline at end of file +var _0x5eae=['filter','options','includeAll','include','rows','catch','show','find','create','body','params','ChatInternalMessage','user','omit','ids','getMembers','findOne','User','where','removeMembers','ChatGroupId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','merge','VIRTUAL'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x5eae,0x13c));var _0xe5ea=function(_0x2f3078,_0x106601){_0x2f3078=_0x2f3078-0x0;var _0x37a445=_0x5eae[_0x2f3078];return _0x37a445;};'use strict';var emlformat=require(_0xe5ea('0x0'));var rimraf=require(_0xe5ea('0x1'));var zipdir=require(_0xe5ea('0x2'));var jsonpatch=require(_0xe5ea('0x3'));var rp=require(_0xe5ea('0x4'));var moment=require('moment');var BPromise=require(_0xe5ea('0x5'));var Mustache=require('mustache');var util=require(_0xe5ea('0x6'));var path=require(_0xe5ea('0x7'));var sox=require(_0xe5ea('0x8'));var csv=require(_0xe5ea('0x9'));var ejs=require(_0xe5ea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5ea('0xb'));var squel=require(_0xe5ea('0xc'));var crypto=require(_0xe5ea('0xd'));var jsforce=require(_0xe5ea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe5ea('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe5ea('0xf'));var authService=require(_0xe5ea('0x10'));var qs=require(_0xe5ea('0x11'));var as=require(_0xe5ea('0x12'));var hardwareService=require(_0xe5ea('0x13'));var logger=require(_0xe5ea('0x14'))(_0xe5ea('0x15'));var utils=require(_0xe5ea('0x16'));var config=require(_0xe5ea('0x17'));var licenseUtil=require(_0xe5ea('0x18'));var db=require(_0xe5ea('0x19'))['db'];config[_0xe5ea('0x1a')]=_[_0xe5ea('0x1b')](config[_0xe5ea('0x1a')],{'host':_0xe5ea('0x1c'),'port':0x18eb});var socket=require(_0xe5ea('0x1d'))(new Redis(config[_0xe5ea('0x1a')]));require(_0xe5ea('0x1e'))[_0xe5ea('0x1f')](socket);function respondWithStatusCode(_0x1ecbef,_0x26c81c){_0x26c81c=_0x26c81c||0xcc;return function(_0x46a160){if(_0x46a160){return _0x1ecbef[_0xe5ea('0x20')](_0x26c81c);}return _0x1ecbef[_0xe5ea('0x21')](_0x26c81c)[_0xe5ea('0x22')]();};}function respondWithResult(_0x3df936,_0x187117){_0x187117=_0x187117||0xc8;return function(_0xe96631){if(_0xe96631){return _0x3df936[_0xe5ea('0x21')](_0x187117)[_0xe5ea('0x23')](_0xe96631);}};}function respondWithFilteredResult(_0x47e58d,_0x16c196){return function(_0xd32f9d){if(_0xd32f9d){var _0x1d149b=typeof _0x16c196[_0xe5ea('0x24')]===_0xe5ea('0x25')&&typeof _0x16c196['limit']===_0xe5ea('0x25');var _0x4acffb=_0xd32f9d[_0xe5ea('0x26')];var _0x17f0d5=_0x1d149b?0x0:_0x16c196[_0xe5ea('0x24')];var _0xaecd52=_0x1d149b?_0xd32f9d[_0xe5ea('0x26')]:_0x16c196[_0xe5ea('0x24')]+_0x16c196['limit'];var _0xe610b4;if(_0xaecd52>=_0x4acffb){_0xaecd52=_0x4acffb;_0xe610b4=0xc8;}else{_0xe610b4=0xce;}_0x47e58d[_0xe5ea('0x21')](_0xe610b4);return _0x47e58d[_0xe5ea('0x27')]('Content-Range',_0x17f0d5+'-'+_0xaecd52+'/'+_0x4acffb)[_0xe5ea('0x23')](_0xd32f9d);}return null;};}function patchUpdates(_0x2bb4e2){return function(_0x1bda90){try{jsonpatch[_0xe5ea('0x28')](_0x1bda90,_0x2bb4e2,!![]);}catch(_0x2b2406){return BPromise[_0xe5ea('0x29')](_0x2b2406);}return _0x1bda90[_0xe5ea('0x2a')]();};}function saveUpdates(_0x370a3c,_0x531f64){return function(_0x278113){if(_0x278113){return _0x278113[_0xe5ea('0x2b')](_0x370a3c)['then'](function(_0x4c4d2b){return _0x4c4d2b;});}return null;};}function removeEntity(_0x33f1a3,_0x35f6ed){return function(_0x34114b){if(_0x34114b){return _0x34114b[_0xe5ea('0x2c')]()[_0xe5ea('0x2d')](function(){_0x33f1a3['status'](0xcc)[_0xe5ea('0x22')]();});}};}function handleEntityNotFound(_0x353fd5,_0x213c11){return function(_0x25312f){if(!_0x25312f){_0x353fd5['sendStatus'](0x194);}return _0x25312f;};}function handleError(_0x2bac46,_0x31d11f){_0x31d11f=_0x31d11f||0x1f4;return function(_0x4f4c17){logger[_0xe5ea('0x2e')](_0x4f4c17[_0xe5ea('0x2f')]);if(_0x4f4c17[_0xe5ea('0x30')]){delete _0x4f4c17['name'];}_0x2bac46[_0xe5ea('0x21')](_0x31d11f)[_0xe5ea('0x31')](_0x4f4c17);};}exports[_0xe5ea('0x32')]=function(_0x3f9396,_0x1fd799){var _0x9f3635={},_0x291302={},_0x582f87={'count':0x0,'rows':[]};var _0x165fdb=_[_0xe5ea('0x33')](db[_0xe5ea('0x34')][_0xe5ea('0x35')],function(_0x50cae1){return{'name':_0x50cae1[_0xe5ea('0x36')],'type':_0x50cae1['type'][_0xe5ea('0x37')]};});_0x291302['model']=_[_0xe5ea('0x33')](_0x165fdb,_0xe5ea('0x30'));_0x291302['query']=_[_0xe5ea('0x38')](_0x3f9396['query']);_0x291302['filters']=_[_0xe5ea('0x39')](_0x291302[_0xe5ea('0x3a')],_0x291302[_0xe5ea('0x3b')]);_0x9f3635[_0xe5ea('0x3c')]=_[_0xe5ea('0x39')](_0x291302['model'],qs['fields'](_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x3d')]));_0x9f3635['attributes']=_0x9f3635[_0xe5ea('0x3c')][_0xe5ea('0x3e')]?_0x9f3635['attributes']:_0x291302[_0xe5ea('0x3a')];if(!_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x3f')](_0xe5ea('0x40'))){_0x9f3635['limit']=qs[_0xe5ea('0x41')](_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x41')]);_0x9f3635['offset']=qs[_0xe5ea('0x24')](_0x3f9396[_0xe5ea('0x3b')]['offset']);}_0x9f3635[_0xe5ea('0x42')]=qs[_0xe5ea('0x43')](_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x43')]);_0x9f3635['where']=qs[_0xe5ea('0x44')](_[_0xe5ea('0x45')](_0x3f9396[_0xe5ea('0x3b')],_0x291302[_0xe5ea('0x44')]),_0x165fdb);if(_0x3f9396[_0xe5ea('0x3b')]['filter']){_0x9f3635['where']=_[_0xe5ea('0x46')](_0x9f3635['where'],{'$or':_[_0xe5ea('0x33')](_0x165fdb,function(_0x3f1c49){if(_0x3f1c49['type']!==_0xe5ea('0x47')){var _0x2a3fde={};_0x2a3fde[_0x3f1c49['name']]={'$like':'%'+_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x48')]+'%'};return _0x2a3fde;}})});}_0x9f3635=_[_0xe5ea('0x46')]({},_0x9f3635,_0x3f9396[_0xe5ea('0x49')]);var _0x5d2a67={'where':_0x9f3635['where']};return db[_0xe5ea('0x34')][_0xe5ea('0x26')](_0x5d2a67)[_0xe5ea('0x2d')](function(_0x32cbe3){_0x582f87[_0xe5ea('0x26')]=_0x32cbe3;if(_0x3f9396[_0xe5ea('0x3b')][_0xe5ea('0x4a')]){_0x9f3635[_0xe5ea('0x4b')]=[{'all':!![]}];}return db[_0xe5ea('0x34')]['findAll'](_0x9f3635);})[_0xe5ea('0x2d')](function(_0x22686a){_0x582f87[_0xe5ea('0x4c')]=_0x22686a;return _0x582f87;})['then'](respondWithFilteredResult(_0x1fd799,_0x9f3635))[_0xe5ea('0x4d')](handleError(_0x1fd799,null));};exports[_0xe5ea('0x4e')]=function(_0x31321e,_0xb0db0c){var _0x4527be={'raw':!![],'where':{'id':_0x31321e['params']['id']}},_0x15107c={};_0x15107c['model']=_[_0xe5ea('0x38')](db[_0xe5ea('0x34')][_0xe5ea('0x35')]);_0x15107c[_0xe5ea('0x3b')]=_[_0xe5ea('0x38')](_0x31321e[_0xe5ea('0x3b')]);_0x15107c['filters']=_[_0xe5ea('0x39')](_0x15107c[_0xe5ea('0x3a')],_0x15107c[_0xe5ea('0x3b')]);_0x4527be['attributes']=_[_0xe5ea('0x39')](_0x15107c[_0xe5ea('0x3a')],qs[_0xe5ea('0x3d')](_0x31321e['query'][_0xe5ea('0x3d')]));_0x4527be[_0xe5ea('0x3c')]=_0x4527be[_0xe5ea('0x3c')][_0xe5ea('0x3e')]?_0x4527be[_0xe5ea('0x3c')]:_0x15107c[_0xe5ea('0x3a')];if(_0x31321e[_0xe5ea('0x3b')]['includeAll']){_0x4527be[_0xe5ea('0x4b')]=[{'all':!![]}];}_0x4527be=_[_0xe5ea('0x46')]({},_0x4527be,_0x31321e[_0xe5ea('0x49')]);return db[_0xe5ea('0x34')][_0xe5ea('0x4f')](_0x4527be)[_0xe5ea('0x2d')](handleEntityNotFound(_0xb0db0c,null))[_0xe5ea('0x2d')](respondWithResult(_0xb0db0c,null))[_0xe5ea('0x4d')](handleError(_0xb0db0c,null));};exports[_0xe5ea('0x50')]=function(_0x5e4087,_0x1aa99e){return db[_0xe5ea('0x34')][_0xe5ea('0x50')](_0x5e4087[_0xe5ea('0x51')],{})['then'](respondWithResult(_0x1aa99e,0xc9))[_0xe5ea('0x4d')](handleError(_0x1aa99e,null));};exports['update']=function(_0x59f212,_0x16e81e){if(_0x59f212['body']['id']){delete _0x59f212['body']['id'];}return db[_0xe5ea('0x34')][_0xe5ea('0x4f')]({'where':{'id':_0x59f212[_0xe5ea('0x52')]['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x16e81e,null))[_0xe5ea('0x2d')](saveUpdates(_0x59f212[_0xe5ea('0x51')],null))[_0xe5ea('0x2d')](respondWithResult(_0x16e81e,null))[_0xe5ea('0x4d')](handleError(_0x16e81e,null));};exports['destroy']=function(_0x2f2dca,_0x4ae613){return db[_0xe5ea('0x34')][_0xe5ea('0x4f')]({'where':{'id':_0x2f2dca[_0xe5ea('0x52')]['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x4ae613,null))[_0xe5ea('0x2d')](removeEntity(_0x4ae613,null))[_0xe5ea('0x4d')](handleError(_0x4ae613,null));};exports['describe']=function(_0x421d83,_0x2833ab){return db[_0xe5ea('0x34')]['describe']()[_0xe5ea('0x2d')](respondWithResult(_0x2833ab,null))[_0xe5ea('0x4d')](handleError(_0x2833ab,null));};exports['getUnread']=function(_0x5417bd,_0x245401,_0x237d61){return db[_0xe5ea('0x53')][_0xe5ea('0x26')]({'where':{'ChatGroupId':_0x5417bd[_0xe5ea('0x52')]['id'],'ToId':_0x5417bd[_0xe5ea('0x54')]['id'],'read':![]}})[_0xe5ea('0x2d')](function(_0x3227bb){return{'id':_['toInteger'](_0x5417bd[_0xe5ea('0x52')]['id']),'count':_0x3227bb};})[_0xe5ea('0x2d')](respondWithResult(_0x245401,null))[_0xe5ea('0x4d')](handleError(_0x245401,null));};exports['addMembers']=function(_0x167bd9,_0x52235e,_0x5b36fb){return db[_0xe5ea('0x34')][_0xe5ea('0x4f')]({'where':{'id':_0x167bd9[_0xe5ea('0x52')]['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x52235e,null))[_0xe5ea('0x2d')](function(_0x44ab1f){if(_0x44ab1f){return _0x44ab1f['addMembers'](_0x167bd9['body']['ids'],_[_0xe5ea('0x55')](_0x167bd9['body'],[_0xe5ea('0x56'),'id'])||{});}})['then'](respondWithResult(_0x52235e,null))[_0xe5ea('0x4d')](handleError(_0x52235e,null));};exports[_0xe5ea('0x57')]=function(_0x264357,_0x40ee2b,_0x24636d){var _0x176b9a={};var _0x15fe74={};var _0x5db766;var _0x188540;return db[_0xe5ea('0x34')][_0xe5ea('0x58')]({'where':{'id':_0x264357[_0xe5ea('0x52')]['id']}})['then'](handleEntityNotFound(_0x40ee2b,null))['then'](function(_0x1cd3f0){if(_0x1cd3f0){_0x5db766=_0x1cd3f0;_0x15fe74[_0xe5ea('0x3a')]=_[_0xe5ea('0x38')](db[_0xe5ea('0x59')][_0xe5ea('0x35')]);_0x15fe74[_0xe5ea('0x3b')]=_['keys'](_0x264357[_0xe5ea('0x3b')]);_0x15fe74['filters']=_[_0xe5ea('0x39')](_0x15fe74[_0xe5ea('0x3a')],_0x15fe74[_0xe5ea('0x3b')]);_0x176b9a[_0xe5ea('0x3c')]=_[_0xe5ea('0x39')](_0x15fe74['model'],qs['fields'](_0x264357[_0xe5ea('0x3b')]['fields']));_0x176b9a[_0xe5ea('0x3c')]=_0x176b9a['attributes'][_0xe5ea('0x3e')]?_0x176b9a[_0xe5ea('0x3c')]:_0x15fe74['model'];_0x176b9a[_0xe5ea('0x42')]=qs[_0xe5ea('0x43')](_0x264357[_0xe5ea('0x3b')][_0xe5ea('0x43')]);_0x176b9a[_0xe5ea('0x5a')]=qs[_0xe5ea('0x44')](_[_0xe5ea('0x45')](_0x264357[_0xe5ea('0x3b')],_0x15fe74[_0xe5ea('0x44')]));if(_0x264357[_0xe5ea('0x3b')][_0xe5ea('0x48')]){_0x176b9a[_0xe5ea('0x5a')]=_[_0xe5ea('0x46')](_0x176b9a[_0xe5ea('0x5a')],{'$or':_[_0xe5ea('0x33')](_0x176b9a['attributes'],function(_0x33ce84){var _0x3941b0={};_0x3941b0[_0x33ce84]={'$like':'%'+_0x264357[_0xe5ea('0x3b')][_0xe5ea('0x48')]+'%'};return _0x3941b0;})});}_0x176b9a=_[_0xe5ea('0x46')]({},_0x176b9a,_0x264357[_0xe5ea('0x49')]);return _0x5db766[_0xe5ea('0x57')](_0x176b9a);}})[_0xe5ea('0x2d')](function(_0x394295){if(_0x394295){_0x188540=_0x394295['length'];if(!_0x264357[_0xe5ea('0x3b')]['hasOwnProperty'](_0xe5ea('0x40'))){_0x176b9a[_0xe5ea('0x41')]=qs['limit'](_0x264357[_0xe5ea('0x3b')][_0xe5ea('0x41')]);_0x176b9a[_0xe5ea('0x24')]=qs[_0xe5ea('0x24')](_0x264357[_0xe5ea('0x3b')]['offset']);}return _0x5db766[_0xe5ea('0x57')](_0x176b9a);}})[_0xe5ea('0x2d')](function(_0x11278){if(_0x11278){return _0x11278?{'count':_0x188540,'rows':_0x11278}:null;}})[_0xe5ea('0x2d')](respondWithResult(_0x40ee2b,null))['catch'](handleError(_0x40ee2b,null));};exports['removeMembers']=function(_0x33ba5a,_0x2969d2,_0x11f558){return db['ChatGroup'][_0xe5ea('0x4f')]({'where':{'id':_0x33ba5a['params']['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x2969d2,null))[_0xe5ea('0x2d')](function(_0x4c0a86){if(_0x4c0a86){return _0x4c0a86[_0xe5ea('0x5b')](_0x33ba5a[_0xe5ea('0x3b')][_0xe5ea('0x56')]);}})[_0xe5ea('0x2d')](respondWithStatusCode(_0x2969d2,null))['catch'](handleError(_0x2969d2,null));};exports['addMessage']=function(_0x539494,_0x5036de,_0x2feb6d){if(_0x539494[_0xe5ea('0x51')]['id']){delete _0x539494[_0xe5ea('0x51')]['id'];}return db[_0xe5ea('0x34')][_0xe5ea('0x4f')]({'where':{'id':_0x539494[_0xe5ea('0x52')]['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x5036de,null))[_0xe5ea('0x2d')](function(_0x56752f){if(_0x56752f){_0x539494['body'][_0xe5ea('0x5c')]=_0x56752f['id'];return db[_0xe5ea('0x53')][_0xe5ea('0x50')](_0x539494[_0xe5ea('0x51')]);}})[_0xe5ea('0x2d')](respondWithResult(_0x5036de,null))[_0xe5ea('0x4d')](handleError(_0x5036de,null));};exports['getMessages']=function(_0x558637,_0x5d7428,_0x349034){var _0x587aa0={};var _0xf1a7de={};var _0x376602;var _0x4fe26a;return db[_0xe5ea('0x34')][_0xe5ea('0x58')]({'where':{'id':_0x558637[_0xe5ea('0x52')]['id']}})[_0xe5ea('0x2d')](handleEntityNotFound(_0x5d7428,null))['then'](function(_0x17f64d){if(_0x17f64d){_0x376602=_0x17f64d;_0xf1a7de[_0xe5ea('0x3a')]=_['keys'](db['ChatInternalMessage'][_0xe5ea('0x35')]);_0xf1a7de['query']=_[_0xe5ea('0x38')](_0x558637['query']);_0xf1a7de[_0xe5ea('0x44')]=_[_0xe5ea('0x39')](_0xf1a7de[_0xe5ea('0x3a')],_0xf1a7de[_0xe5ea('0x3b')]);_0x587aa0[_0xe5ea('0x3c')]=_['intersection'](_0xf1a7de[_0xe5ea('0x3a')],qs['fields'](_0x558637['query'][_0xe5ea('0x3d')]));_0x587aa0[_0xe5ea('0x3c')]=_0x587aa0[_0xe5ea('0x3c')]['length']?_0x587aa0[_0xe5ea('0x3c')]:_0xf1a7de[_0xe5ea('0x3a')];_0x587aa0[_0xe5ea('0x42')]=qs['sort'](_0x558637['query'][_0xe5ea('0x43')]);_0x587aa0[_0xe5ea('0x5a')]=qs[_0xe5ea('0x44')](_['pick'](_0x558637[_0xe5ea('0x3b')],_0xf1a7de[_0xe5ea('0x44')]));if(_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x48')]){_0x587aa0[_0xe5ea('0x5a')]=_[_0xe5ea('0x46')](_0x587aa0[_0xe5ea('0x5a')],{'$or':_[_0xe5ea('0x33')](_0x587aa0['attributes'],function(_0xb712e4){var _0x2c5fbc={};_0x2c5fbc[_0xb712e4]={'$like':'%'+_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x48')]+'%'};return _0x2c5fbc;})});}if(_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x5d')]){var _0x449653=_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x5d')]['split'](',');var _0x4fa847={};_0x4fa847[_0x449653[0x0]]={'$gte':moment(_0x449653[0x1])[_0xe5ea('0x5e')](_0xe5ea('0x5f'))};_0x587aa0[_0xe5ea('0x5a')]=_[_0xe5ea('0x46')](_0x587aa0['where'],_0x4fa847);}_0x587aa0=_[_0xe5ea('0x46')]({},_0x587aa0,_0x558637[_0xe5ea('0x49')]);return _0x376602[_0xe5ea('0x60')](_0x587aa0);}})[_0xe5ea('0x2d')](function(_0x5bcebc){if(_0x5bcebc){_0x4fe26a=_0x5bcebc[_0xe5ea('0x3e')];if(!_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x3f')]('nolimit')){_0x587aa0['limit']=qs['limit'](_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x41')]);_0x587aa0[_0xe5ea('0x24')]=qs['offset'](_0x558637[_0xe5ea('0x3b')][_0xe5ea('0x24')]);}return _0x376602[_0xe5ea('0x60')](_0x587aa0);}})[_0xe5ea('0x2d')](function(_0x475b3a){if(_0x475b3a){return _0x475b3a?{'count':_0x4fe26a,'rows':_0x475b3a}:null;}})[_0xe5ea('0x2d')](respondWithResult(_0x5d7428,null))[_0xe5ea('0x4d')](handleError(_0x5d7428,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cef2ba4..2e6fbe6 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 _0xb9f7=['../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb9f7,0x18b));var _0x7b9f=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xb9f7[_0x101e7b];return _0x4995c0;};'use strict';var EventEmitter=require(_0x7b9f('0x0'));var ChatGroup=require(_0x7b9f('0x1'))['db'][_0x7b9f('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7b9f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7b9f('0x4'),'afterDestroy':_0x7b9f('0x5')};function emitEvent(_0x1be992){return function(_0x2e5c63,_0x174cd2,_0x208b54){ChatGroupEvents['emit'](_0x1be992+':'+_0x2e5c63['id'],_0x2e5c63);ChatGroupEvents[_0x7b9f('0x6')](_0x1be992,_0x2e5c63);_0x208b54(null);};}for(var e in events){if(events[_0x7b9f('0x7')](e)){var event=events[e];ChatGroup[_0x7b9f('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xc075=['save','update','remove','emit','hook','exports','events','setMaxListeners'];(function(_0x2e61cc,_0x3886af){var _0x558ca0=function(_0x1c0a7d){while(--_0x1c0a7d){_0x2e61cc['push'](_0x2e61cc['shift']());}};_0x558ca0(++_0x3886af);}(_0xc075,0x1a6));var _0x5c07=function(_0x4e9722,_0x397695){_0x4e9722=_0x4e9722-0x0;var _0x146799=_0xc075[_0x4e9722];return _0x146799;};'use strict';var EventEmitter=require(_0x5c07('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5c07('0x1')](0x0);var events={'afterCreate':_0x5c07('0x2'),'afterUpdate':_0x5c07('0x3'),'afterDestroy':_0x5c07('0x4')};function emitEvent(_0x2e0e13){return function(_0x32ff87,_0x5a179c,_0x2d72d4){ChatGroupEvents[_0x5c07('0x5')](_0x2e0e13+':'+_0x32ff87['id'],_0x32ff87);ChatGroupEvents[_0x5c07('0x5')](_0x2e0e13,_0x32ff87);_0x2d72d4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x5c07('0x6')](e,emitEvent(event));}}module[_0x5c07('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 08c72dc..8d2b231 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 _0xfab5=['path','rimraf','./chatGroup.attributes','ChatGroup','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x30b4f4,_0xc3efcf){var _0x21147d=function(_0x2ad24a){while(--_0x2ad24a){_0x30b4f4['push'](_0x30b4f4['shift']());}};_0x21147d(++_0xc3efcf);}(_0xfab5,0x7c));var _0x5fab=function(_0x1ee191,_0x2b8c91){_0x1ee191=_0x1ee191-0x0;var _0x5288bc=_0xfab5[_0x1ee191];return _0x5288bc;};'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(_0x5fab('0x7'));var config=require('../../config/environment');var attributes=require(_0x5fab('0x8'));module['exports']=function(_0x2dc326,_0xd03c48){return _0x2dc326['define'](_0x5fab('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x155e=['path','rimraf','../../config/environment','./chatGroup.attributes','exports','chat_groups','lodash','../../config/logger','api','request-promise'];(function(_0x16c1ed,_0x49498e){var _0x30840b=function(_0x4638a8){while(--_0x4638a8){_0x16c1ed['push'](_0x16c1ed['shift']());}};_0x30840b(++_0x49498e);}(_0x155e,0x150));var _0xe155=function(_0x122266,_0x2e52b1){_0x122266=_0x122266-0x0;var _0x19aee9=_0x155e[_0x122266];return _0x19aee9;};'use strict';var _=require(_0xe155('0x0'));var util=require('util');var logger=require(_0xe155('0x1'))(_0xe155('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe155('0x3'));var fs=require('fs');var path=require(_0xe155('0x4'));var rimraf=require(_0xe155('0x5'));var config=require(_0xe155('0x6'));var attributes=require(_0xe155('0x7'));module[_0xe155('0x8')]=function(_0x5eb416,_0xabeeb8){return _0x5eb416['define']('ChatGroup',attributes,{'tableName':_0xe155('0x9'),'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 9deb40a..0656730 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 _0x653d=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./chatGroup.socket','then'];(function(_0x3d02d4,_0x34f87d){var _0x6b3e9b=function(_0x2b3d70){while(--_0x2b3d70){_0x3d02d4['push'](_0x3d02d4['shift']());}};_0x6b3e9b(++_0x34f87d);}(_0x653d,0x133));var _0xd653=function(_0xb89aee,_0x17930f){_0xb89aee=_0xb89aee-0x0;var _0x22316e=_0x653d[_0xb89aee];return _0x22316e;};'use strict';var _=require('lodash');var util=require(_0xd653('0x0'));var moment=require(_0xd653('0x1'));var BPromise=require(_0xd653('0x2'));var rs=require(_0xd653('0x3'));var fs=require('fs');var Redis=require(_0xd653('0x4'));var db=require(_0xd653('0x5'))['db'];var utils=require(_0xd653('0x6'));var logger=require(_0xd653('0x7'))(_0xd653('0x8'));var config=require(_0xd653('0x9'));var jayson=require(_0xd653('0xa'));var client=jayson[_0xd653('0xb')][_0xd653('0xc')]({'port':0x232a});config[_0xd653('0xd')]=_['defaults'](config['redis'],{'host':_0xd653('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd653('0xd')]));require(_0xd653('0xf'))['register'](socket);function respondWithRpcPromise(_0x72d663,_0x1e39f0,_0x279bb0){return new BPromise(function(_0x4d2507,_0x2b4cad){return client['request'](_0x72d663,_0x279bb0)[_0xd653('0x10')](function(_0x31749f){logger[_0xd653('0x11')](_0xd653('0x12'),_0x1e39f0,_0xd653('0x13'));logger[_0xd653('0x14')](_0xd653('0x15'),_0x1e39f0,'request\x20sent',JSON['stringify'](_0x31749f));if(_0x31749f[_0xd653('0x16')]){if(_0x31749f[_0xd653('0x16')][_0xd653('0x17')]===0x1f4){logger[_0xd653('0x16')](_0xd653('0x12'),_0x1e39f0,_0x31749f[_0xd653('0x16')]['message']);return _0x2b4cad(_0x31749f['error']['message']);}logger[_0xd653('0x16')](_0xd653('0x12'),_0x1e39f0,_0x31749f[_0xd653('0x16')]['message']);return _0x4d2507(_0x31749f[_0xd653('0x16')][_0xd653('0x18')]);}else{logger[_0xd653('0x11')](_0xd653('0x12'),_0x1e39f0,_0xd653('0x13'));_0x4d2507(_0x31749f[_0xd653('0x19')][_0xd653('0x18')]);}})[_0xd653('0x1a')](function(_0x52aa44){logger[_0xd653('0x16')](_0xd653('0x12'),_0x1e39f0,_0x52aa44);_0x2b4cad(_0x52aa44);});});} \ No newline at end of file +var _0x7024=['../../config/environment','jayson/promise','http','redis','defaults','./chatGroup.socket','register','request','then','info','debug','request\x20sent','stringify','error','ChatGroup,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1ba79f,_0x972517){var _0x4dc491=function(_0x31a1fb){while(--_0x31a1fb){_0x1ba79f['push'](_0x1ba79f['shift']());}};_0x4dc491(++_0x972517);}(_0x7024,0xa1));var _0x4702=function(_0x55c55d,_0x197d97){_0x55c55d=_0x55c55d-0x0;var _0x5ca11e=_0x7024[_0x55c55d];return _0x5ca11e;};'use strict';var _=require(_0x4702('0x0'));var util=require('util');var moment=require(_0x4702('0x1'));var BPromise=require(_0x4702('0x2'));var rs=require(_0x4702('0x3'));var fs=require('fs');var Redis=require(_0x4702('0x4'));var db=require(_0x4702('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4702('0x6'))('rpc');var config=require(_0x4702('0x7'));var jayson=require(_0x4702('0x8'));var client=jayson['client'][_0x4702('0x9')]({'port':0x232a});config[_0x4702('0xa')]=_[_0x4702('0xb')](config[_0x4702('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4702('0xc'))[_0x4702('0xd')](socket);function respondWithRpcPromise(_0x4574a4,_0x231075,_0x5258ba){return new BPromise(function(_0x28f300,_0x5c6f8c){return client[_0x4702('0xe')](_0x4574a4,_0x5258ba)[_0x4702('0xf')](function(_0x48a77c){logger[_0x4702('0x10')]('ChatGroup,\x20%s,\x20%s',_0x231075,'request\x20sent');logger[_0x4702('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x231075,_0x4702('0x12'),JSON[_0x4702('0x13')](_0x48a77c));if(_0x48a77c['error']){if(_0x48a77c[_0x4702('0x14')]['code']===0x1f4){logger[_0x4702('0x14')](_0x4702('0x15'),_0x231075,_0x48a77c[_0x4702('0x14')][_0x4702('0x16')]);return _0x5c6f8c(_0x48a77c[_0x4702('0x14')][_0x4702('0x16')]);}logger[_0x4702('0x14')](_0x4702('0x15'),_0x231075,_0x48a77c[_0x4702('0x14')][_0x4702('0x16')]);return _0x28f300(_0x48a77c[_0x4702('0x14')]['message']);}else{logger['info'](_0x4702('0x15'),_0x231075,'request\x20sent');_0x28f300(_0x48a77c['result']['message']);}})[_0x4702('0x17')](function(_0x156a29){logger[_0x4702('0x14')](_0x4702('0x15'),_0x231075,_0x156a29);_0x5c6f8c(_0x156a29);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index be647c0..6eab38d 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 _0xc15a=['update','emit','register','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x28277d,_0x822e2){var _0x588fca=function(_0x33b503){while(--_0x33b503){_0x28277d['push'](_0x28277d['shift']());}};_0x588fca(++_0x822e2);}(_0xc15a,0x1c5));var _0xac15=function(_0x438a2e,_0x1f7948){_0x438a2e=_0x438a2e-0x0;var _0x36388b=_0xc15a[_0x438a2e];return _0x36388b;};'use strict';var ChatGroupEvents=require(_0xac15('0x0'));var events=[_0xac15('0x1'),_0xac15('0x2'),_0xac15('0x3')];function createListener(_0x6b74a9,_0x29ab73){return function(_0x598955){_0x29ab73[_0xac15('0x4')](_0x6b74a9,_0x598955);};}function removeListener(_0x368009,_0x5151c9){return function(){ChatGroupEvents['removeListener'](_0x368009,_0x5151c9);};}exports[_0xac15('0x5')]=function(_0xbd3af3){for(var _0x3675f6=0x0,_0x4ccd34=events[_0xac15('0x6')];_0x3675f6<_0x4ccd34;_0x3675f6++){var _0x4a76aa=events[_0x3675f6];var _0x2d0a3e=createListener(_0xac15('0x7')+_0x4a76aa,_0xbd3af3);ChatGroupEvents['on'](_0x4a76aa,_0x2d0a3e);}}; \ No newline at end of file +var _0x4312=['update','removeListener','register','length','chatGroup:','save','remove'];(function(_0xe51c5d,_0xf8fdf7){var _0x4c6a1b=function(_0x1b9b32){while(--_0x1b9b32){_0xe51c5d['push'](_0xe51c5d['shift']());}};_0x4c6a1b(++_0xf8fdf7);}(_0x4312,0x124));var _0x2431=function(_0xb4fe2c,_0x3d2be6){_0xb4fe2c=_0xb4fe2c-0x0;var _0x460a1a=_0x4312[_0xb4fe2c];return _0x460a1a;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x2431('0x0'),_0x2431('0x1'),_0x2431('0x2')];function createListener(_0x201e18,_0x5ce00d){return function(_0x1c9563){_0x5ce00d['emit'](_0x201e18,_0x1c9563);};}function removeListener(_0x4279ec,_0x377ea7){return function(){ChatGroupEvents[_0x2431('0x3')](_0x4279ec,_0x377ea7);};}exports[_0x2431('0x4')]=function(_0x149c38){for(var _0x5efe69=0x0,_0x452382=events[_0x2431('0x5')];_0x5efe69<_0x452382;_0x5efe69++){var _0x231542=events[_0x5efe69];var _0x3416c9=createListener(_0x2431('0x6')+_0x231542,_0x149c38);ChatGroupEvents['on'](_0x231542,_0x3416c9);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0191328..df32dbf 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 _0x2c98=['destroy','removeMembers','exports','multer','express','Router','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','create','/:id/messages','addMessage','put'];(function(_0x26843e,_0x35f69f){var _0x325200=function(_0x1b90ba){while(--_0x1b90ba){_0x26843e['push'](_0x26843e['shift']());}};_0x325200(++_0x35f69f);}(_0x2c98,0x99));var _0x82c9=function(_0x3b4409,_0x7ead85){_0x3b4409=_0x3b4409-0x0;var _0x429a7c=_0x2c98[_0x3b4409];return _0x429a7c;};'use strict';var multer=require(_0x82c9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x82c9('0x1'));var router=express[_0x82c9('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x82c9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x82c9('0x4'));var controller=require(_0x82c9('0x5'));router[_0x82c9('0x6')]('/',auth[_0x82c9('0x7')](),controller[_0x82c9('0x8')]);router[_0x82c9('0x6')](_0x82c9('0x9'),auth['isAuthenticated'](),controller[_0x82c9('0xa')]);router[_0x82c9('0x6')](_0x82c9('0xb'),auth[_0x82c9('0x7')](),controller['show']);router[_0x82c9('0x6')](_0x82c9('0xc'),auth['isAuthenticated'](),controller[_0x82c9('0xd')]);router[_0x82c9('0x6')](_0x82c9('0xe'),auth[_0x82c9('0x7')](),controller[_0x82c9('0xf')]);router[_0x82c9('0x6')]('/:id/messages',auth[_0x82c9('0x7')](),controller[_0x82c9('0x10')]);router[_0x82c9('0x11')]('/',auth['isAuthenticated'](),controller[_0x82c9('0x12')]);router['post']('/:id/members',auth[_0x82c9('0x7')](),controller['addMembers']);router[_0x82c9('0x11')](_0x82c9('0x13'),auth[_0x82c9('0x7')](),controller[_0x82c9('0x14')]);router[_0x82c9('0x15')](_0x82c9('0xb'),auth[_0x82c9('0x7')](),controller['update']);router['delete']('/:id',auth[_0x82c9('0x7')](),controller[_0x82c9('0x16')]);router['delete'](_0x82c9('0xe'),auth['isAuthenticated'](),controller[_0x82c9('0x17')]);module[_0x82c9('0x18')]=router; \ No newline at end of file +var _0x2b68=['/:id/messages','getMessages','post','create','addMembers','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x16337a,_0x4789a1){var _0x422365=function(_0x34f039){while(--_0x34f039){_0x16337a['push'](_0x16337a['shift']());}};_0x422365(++_0x4789a1);}(_0x2b68,0x1e3));var _0x82b6=function(_0x4ef05e,_0x18b00a){_0x4ef05e=_0x4ef05e-0x0;var _0x241f30=_0x2b68[_0x4ef05e];return _0x241f30;};'use strict';var multer=require(_0x82b6('0x0'));var util=require(_0x82b6('0x1'));var path=require(_0x82b6('0x2'));var timeout=require(_0x82b6('0x3'));var express=require(_0x82b6('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x82b6('0x5'));var interaction=require(_0x82b6('0x6'));var config=require('../../config/environment');var controller=require(_0x82b6('0x7'));router['get']('/',auth[_0x82b6('0x8')](),controller[_0x82b6('0x9')]);router[_0x82b6('0xa')](_0x82b6('0xb'),auth[_0x82b6('0x8')](),controller[_0x82b6('0xc')]);router['get'](_0x82b6('0xd'),auth[_0x82b6('0x8')](),controller[_0x82b6('0xe')]);router['get']('/:id/unread',auth[_0x82b6('0x8')](),controller['getUnread']);router[_0x82b6('0xa')](_0x82b6('0xf'),auth['isAuthenticated'](),controller[_0x82b6('0x10')]);router[_0x82b6('0xa')](_0x82b6('0x11'),auth[_0x82b6('0x8')](),controller[_0x82b6('0x12')]);router[_0x82b6('0x13')]('/',auth[_0x82b6('0x8')](),controller[_0x82b6('0x14')]);router['post'](_0x82b6('0xf'),auth[_0x82b6('0x8')](),controller[_0x82b6('0x15')]);router[_0x82b6('0x13')](_0x82b6('0x11'),auth[_0x82b6('0x8')](),controller['addMessage']);router['put'](_0x82b6('0xd'),auth[_0x82b6('0x8')](),controller[_0x82b6('0x16')]);router[_0x82b6('0x17')](_0x82b6('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x82b6('0x17')](_0x82b6('0xf'),auth[_0x82b6('0x8')](),controller['removeMembers']);module[_0x82b6('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index c875404..82db75d 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 _0xb10b=['out','sequelize','BOOLEAN','INTEGER','ENUM','thumb','star','TEXT','STRING','DATE','long'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xb10b,0x12a));var _0xbb10=function(_0xec919c,_0x45c528){_0xec919c=_0xec919c-0x0;var _0x516869=_0xb10b[_0xec919c];return _0x516869;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'closed':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbb10('0x2')]},'ratingType':{'type':Sequelize[_0xbb10('0x3')]('star',_0xbb10('0x4')),'defaultValue':_0xbb10('0x5')},'ratingMessage':{'type':Sequelize[_0xbb10('0x6')]},'pathTranscript':{'type':Sequelize[_0xbb10('0x6')]},'mailTranscript':{'type':Sequelize[_0xbb10('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbb10('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbb10('0x7')]},'thirdDisposition':{'type':Sequelize[_0xbb10('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xbb10('0x7')]},'browserVersion':{'type':Sequelize[_0xbb10('0x7')]},'osName':{'type':Sequelize[_0xbb10('0x7')]},'osVersion':{'type':Sequelize[_0xbb10('0x7')]},'deviceModel':{'type':Sequelize[_0xbb10('0x7')]},'deviceVendor':{'type':Sequelize[_0xbb10('0x7')]},'deviceType':{'type':Sequelize[_0xbb10('0x7')]},'referer':{'type':Sequelize[_0xbb10('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0xbb10('0x9'))},'read1stAt':{'type':Sequelize[_0xbb10('0x8')]},'lastMsgAt':{'type':Sequelize[_0xbb10('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xbb10('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xbb10('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xbb10('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x0901=['BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long','sequelize','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x0901,0x134));var _0x1090=function(_0x577531,_0x49dd10){_0x577531=_0x577531-0x0;var _0x4f63ab=_0x0901[_0x577531];return _0x4f63ab;};'use strict';var Sequelize=require(_0x1090('0x0'));module[_0x1090('0x1')]={'closed':{'type':Sequelize[_0x1090('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1090('0x3')]},'ratingType':{'type':Sequelize[_0x1090('0x4')](_0x1090('0x5'),'thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x1090('0x6')]},'pathTranscript':{'type':Sequelize[_0x1090('0x6')]},'mailTranscript':{'type':Sequelize[_0x1090('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1090('0x8')]},'disposition':{'type':Sequelize[_0x1090('0x7')]},'secondDisposition':{'type':Sequelize[_0x1090('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1090('0x7')]},'browserName':{'type':Sequelize[_0x1090('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x1090('0x7')]},'osVersion':{'type':Sequelize[_0x1090('0x7')]},'deviceModel':{'type':Sequelize[_0x1090('0x7')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x1090('0x7')]},'formData':{'type':Sequelize[_0x1090('0x6')](_0x1090('0x9'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x1090('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1090('0x7')]},'customerPort':{'type':Sequelize[_0x1090('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x1090('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x1090('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4ce1422..23e07e9 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 _0x9a8e=['groupBy','ChatInteractionId','all','rows','show','includeAll','include','options','create','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','vidaooNote','vidaooMetadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','agent_alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','includeAgent','push','alias','findAll','addTags','setTags','spread','emit','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','then','destroy','stack','name','send','render','body','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','unmanaged','index','ChatInteraction','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','start','some','isEmpty','ChatWebsiteId','concat','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.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','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?'];(function(_0x507720,_0x2fd33a){var _0x2dc8ea=function(_0x3d700e){while(--_0x3d700e){_0x507720['push'](_0x507720['shift']());}};_0x2dc8ea(++_0x2fd33a);}(_0x9a8e,0x1ce));var _0xe9a8=function(_0xd29dac,_0x300ba0){_0xd29dac=_0xd29dac-0x0;var _0x2641a9=_0x9a8e[_0xd29dac];return _0x2641a9;};'use strict';var emlformat=require(_0xe9a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe9a8('0x1'));var rp=require('request-promise');var moment=require(_0xe9a8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe9a8('0x3'));var util=require(_0xe9a8('0x4'));var path=require(_0xe9a8('0x5'));var sox=require(_0xe9a8('0x6'));var csv=require(_0xe9a8('0x7'));var ejs=require(_0xe9a8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9a8('0x9'));var squel=require(_0xe9a8('0xa'));var crypto=require('crypto');var jsforce=require(_0xe9a8('0xb'));var deskjs=require(_0xe9a8('0xc'));var toCsv=require(_0xe9a8('0x7'));var querystring=require(_0xe9a8('0xd'));var Papa=require(_0xe9a8('0xe'));var Redis=require(_0xe9a8('0xf'));var authService=require(_0xe9a8('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe9a8('0x11'));var pdf=require(_0xe9a8('0x12'));var hardwareService=require(_0xe9a8('0x13'));var logger=require('../../config/logger')(_0xe9a8('0x14'));var utils=require(_0xe9a8('0x15'));var config=require(_0xe9a8('0x16'));var licenseUtil=require(_0xe9a8('0x17'));var db=require(_0xe9a8('0x18'))['db'];config[_0xe9a8('0x19')]=_[_0xe9a8('0x1a')](config[_0xe9a8('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xe9a8('0x1b'))(new Redis(config[_0xe9a8('0x19')]));require(_0xe9a8('0x1c'))['register'](socket);var jayson=require(_0xe9a8('0x1d'));var client=jayson[_0xe9a8('0x1e')][_0xe9a8('0x1f')]({'port':0x232b});var client9004=jayson[_0xe9a8('0x1e')][_0xe9a8('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x52c482,_0x310000,_0x1cf808,_0x1df210){return new BPromise(function(_0x1724cb,_0x3426d5){var _0x3f6638=_0x1df210||client;return _0x3f6638[_0xe9a8('0x20')](_0x52c482,_0x1cf808)['then'](function(_0x1f004a){logger[_0xe9a8('0x21')](_0xe9a8('0x22'),_0x310000,_0xe9a8('0x23'));logger[_0xe9a8('0x24')](_0xe9a8('0x25'),_0x310000,'request\x20sent',JSON['stringify'](_0x1f004a));if(_0x1f004a[_0xe9a8('0x26')]){if(_0x1f004a[_0xe9a8('0x26')][_0xe9a8('0x27')]===0x1f4){logger['error'](_0xe9a8('0x22'),_0x310000,_0x1f004a['error'][_0xe9a8('0x28')]);return _0x3426d5(_0x1f004a['error'][_0xe9a8('0x28')]);}logger[_0xe9a8('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x310000,_0x1f004a[_0xe9a8('0x26')][_0xe9a8('0x28')]);return _0x1724cb(_0x1f004a[_0xe9a8('0x26')]['message']);}else{logger[_0xe9a8('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x310000,_0xe9a8('0x23'));_0x1724cb(_0x1f004a[_0xe9a8('0x29')]['message']);}})[_0xe9a8('0x2a')](function(_0x238402){logger[_0xe9a8('0x26')](_0xe9a8('0x22'),_0x310000,_0x238402);_0x3426d5(_0x238402);});});}function respondWithStatusCode(_0x31c7a8,_0x5850e4){_0x5850e4=_0x5850e4||0xcc;return function(_0x562b6c){if(_0x562b6c){return _0x31c7a8[_0xe9a8('0x2b')](_0x5850e4);}return _0x31c7a8[_0xe9a8('0x2c')](_0x5850e4)[_0xe9a8('0x2d')]();};}function respondWithResult(_0x1c9f8b,_0x36958b){_0x36958b=_0x36958b||0xc8;return function(_0x33be32){if(_0x33be32){return _0x1c9f8b['status'](_0x36958b)[_0xe9a8('0x2e')](_0x33be32);}};}function respondWithFilteredResult(_0x3ffe44,_0x5c449d){return function(_0x2fdf34){if(_0x2fdf34){var _0x5c0857=typeof _0x5c449d['offset']===_0xe9a8('0x2f')&&typeof _0x5c449d[_0xe9a8('0x30')]==='undefined';var _0x419426=_0x2fdf34['count'];var _0x5593ca=_0x5c0857?0x0:_0x5c449d[_0xe9a8('0x31')];var _0x3e5f8d=_0x5c0857?_0x2fdf34[_0xe9a8('0x32')]:_0x5c449d[_0xe9a8('0x31')]+_0x5c449d[_0xe9a8('0x30')];var _0x30bcfd;if(_0x3e5f8d>=_0x419426){_0x3e5f8d=_0x419426;_0x30bcfd=0xc8;}else{_0x30bcfd=0xce;}_0x3ffe44[_0xe9a8('0x2c')](_0x30bcfd);return _0x3ffe44[_0xe9a8('0x33')](_0xe9a8('0x34'),_0x5593ca+'-'+_0x3e5f8d+'/'+_0x419426)['json'](_0x2fdf34);}return null;};}function patchUpdates(_0x59e0f2){return function(_0x279a23){try{jsonpatch[_0xe9a8('0x35')](_0x279a23,_0x59e0f2,!![]);}catch(_0x1ab34d){return BPromise['reject'](_0x1ab34d);}return _0x279a23['save']();};}function saveUpdates(_0x3d1b5a,_0x4ff853){return function(_0x169b6b){if(_0x169b6b){return _0x169b6b['update'](_0x3d1b5a)[_0xe9a8('0x36')](function(_0x2a19fc){return _0x2a19fc;});}return null;};}function removeEntity(_0x34baa7,_0xd8cd79){return function(_0x253dcb){if(_0x253dcb){return _0x253dcb[_0xe9a8('0x37')]()[_0xe9a8('0x36')](function(){_0x34baa7[_0xe9a8('0x2c')](0xcc)[_0xe9a8('0x2d')]();});}};}function handleEntityNotFound(_0x333f5a,_0x5aef16){return function(_0x19bbda){if(!_0x19bbda){_0x333f5a['sendStatus'](0x194);}return _0x19bbda;};}function handleError(_0x43ea2c,_0x5569e3){_0x5569e3=_0x5569e3||0x1f4;return function(_0x487598){logger['error'](_0x487598[_0xe9a8('0x38')]);if(_0x487598[_0xe9a8('0x39')]){delete _0x487598['name'];}_0x43ea2c[_0xe9a8('0x2c')](_0x5569e3)[_0xe9a8('0x3a')](_0x487598);};}function getMustacheRender(_0x5c2724,_0x481c4b){return Mustache[_0xe9a8('0x3b')](_0x5c2724,_['merge'](_0x481c4b[_0xe9a8('0x3c')],{'contact':_0x481c4b['contact'],'message':_0x481c4b['message'],'agent':_0x481c4b[_0xe9a8('0x3d')],'interaction':_0x481c4b[_0xe9a8('0x3e')],'account':_0x481c4b[_0xe9a8('0x3f')]}))||'';}function getInteractionUsers(_0xe228de,_0x6cbbbc){return new BPromise(function(_0x3c462d,_0xc41f7){try{if(_0x6cbbbc[_0xe228de['id']]){_0xe228de['Users']=_[_0xe9a8('0x40')](_0x6cbbbc[_0xe228de['id']],function(_0x22f95a){return{'id':_0x22f95a['id'],'fullname':_0x22f95a[_0xe9a8('0x41')]};});}}catch(_0x1bd5f2){_0xc41f7(_0x1bd5f2);}_0x3c462d(_0xe228de);});}function getInteractionTags(_0x3c24bd,_0x494636){return new BPromise(function(_0x55c938,_0x2bdcd7){try{if(_0x3c24bd[_0xe9a8('0x42')]){_0x3c24bd[_0xe9a8('0x43')]=[];_0x3c24bd['TagIds'][_0xe9a8('0x44')](',')[_0xe9a8('0x45')](function(_0x52c2cd){_0x3c24bd[_0xe9a8('0x43')]['push'](_0x494636[_0x52c2cd]);});}delete _0x3c24bd['TagIds'];}catch(_0x459dc2){_0x2bdcd7(_0x459dc2);}_0x55c938(_0x3c24bd);});}function updateChatInteraction(_0x289074,_0x5461b5,_0x5da034){return new BPromise(function(_0x56a0f3,_0x4735f0){return getInteractionUsers(_0x289074,_0x5da034)[_0xe9a8('0x36')](function(_0x2ab594){return getInteractionTags(_0x2ab594,_0x5461b5);})[_0xe9a8('0x36')](function(_0x37c9b5){return getStateInteraction(_0x37c9b5);})[_0xe9a8('0x36')](function(_0x25a477){_0x56a0f3(_0x25a477);})[_0xe9a8('0x2a')](function(_0x1a645d){_0x4735f0(_0x1a645d);});});}function getStateInteraction(_0x107f05){return new BPromise(function(_0x441ef3){_0x107f05[_0xe9a8('0x46')]=0x0;_0x107f05[_0xe9a8('0x47')]=0x0;_0x107f05[_0xe9a8('0x48')]=0x0;_0x107f05['unmanaged']=0x0;_0x107f05[_0xe9a8('0x49')]=0x0;_0x107f05[_0xe9a8('0x4a')]=0x0;if(!_0x107f05[_0xe9a8('0x4b')]&&!_0x107f05['UserId']){_0x107f05[_0xe9a8('0x46')]+=0x1;}if(!_0x107f05[_0xe9a8('0x4b')]&&_0x107f05[_0xe9a8('0x4c')]){_0x107f05[_0xe9a8('0x47')]+=0x1;if(_0x107f05['waiting']){_0x107f05[_0xe9a8('0x46')]-=0x1;}}if(_0x107f05[_0xe9a8('0x4b')]&&_0x107f05['disposition']===_0xe9a8('0x49')){_0x107f05[_0xe9a8('0x49')]+=0x1;if(_0x107f05[_0xe9a8('0x46')]){_0x107f05[_0xe9a8('0x46')]-=0x1;}}else if(_0x107f05['closed']&&!_0x107f05['UserId']&&_0x107f05[_0xe9a8('0x4d')]){_0x107f05[_0xe9a8('0x4e')]+=0x1;if(_0x107f05[_0xe9a8('0x46')]){_0x107f05['waiting']-=0x1;}}else if(_0x107f05[_0xe9a8('0x4b')]&&_0x107f05[_0xe9a8('0x4c')]){_0x107f05['answered']+=0x1;if(_0x107f05[_0xe9a8('0x47')]){_0x107f05[_0xe9a8('0x47')]-=0x1;}}_0x107f05['total']+=0x1;_0x441ef3(_0x107f05);});}exports[_0xe9a8('0x4f')]=function(_0x4652e5,_0x3cbd21){var _0x269b22={},_0x25364b={},_0x43bd9a={'count':0x0,'rows':[]};var _0x5c7669=_[_0xe9a8('0x40')](db[_0xe9a8('0x50')][_0xe9a8('0x51')],function(_0x427c37){return{'name':_0x427c37[_0xe9a8('0x52')],'type':_0x427c37['type'][_0xe9a8('0x53')]};});_0x25364b[_0xe9a8('0x54')]=_[_0xe9a8('0x40')](_0x5c7669,_0xe9a8('0x39'));_0x25364b['query']=_[_0xe9a8('0x55')](_0x4652e5[_0xe9a8('0x56')]);_0x25364b['filters']=_[_0xe9a8('0x57')](_0x25364b[_0xe9a8('0x54')],_0x25364b[_0xe9a8('0x56')]);_0x269b22[_0xe9a8('0x58')]=_[_0xe9a8('0x57')](_0x25364b[_0xe9a8('0x54')],qs[_0xe9a8('0x59')](_0x4652e5[_0xe9a8('0x56')]['fields']));_0x269b22['attributes']=_0x269b22['attributes']['length']?_0x269b22[_0xe9a8('0x58')]:_0x25364b[_0xe9a8('0x54')];if(!_0x4652e5['query'][_0xe9a8('0x5a')](_0xe9a8('0x5b'))){_0x269b22[_0xe9a8('0x30')]=qs[_0xe9a8('0x30')](_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x30')]);_0x269b22['offset']=qs[_0xe9a8('0x31')](_0x4652e5['query']['offset']);}_0x269b22[_0xe9a8('0x5c')]=qs['sort'](_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x5d')]);_0x269b22[_0xe9a8('0x5e')]=qs[_0xe9a8('0x5f')](_[_0xe9a8('0x60')](_0x4652e5[_0xe9a8('0x56')],_0x25364b['filters']),_0x5c7669);var _0x2a1e18=[];var _0x3f2dfc=squel[_0xe9a8('0x61')]()['field']('id')[_0xe9a8('0x62')](_0xe9a8('0x39'))['field'](_0xe9a8('0x63'))[_0xe9a8('0x64')]('tools_tags');var _0x241b4e=squel[_0xe9a8('0x61')]()[_0xe9a8('0x62')](_0xe9a8('0x65'))[_0xe9a8('0x62')](_0xe9a8('0x66'))[_0xe9a8('0x62')](_0xe9a8('0x67'))[_0xe9a8('0x64')]('user_has_chat_interactions','ui')[_0xe9a8('0x68')](_0xe9a8('0x69'),'u',_0xe9a8('0x6a'));var _0x49a7ed=squel[_0xe9a8('0x61')]()[_0xe9a8('0x64')](_0xe9a8('0x6b'),'i')['left_join'](_0xe9a8('0x6c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xe9a8('0x68')](_0xe9a8('0x69'),'o',_0xe9a8('0x6d'))[_0xe9a8('0x68')](_0xe9a8('0x6e'),'a',_0xe9a8('0x6f'))[_0xe9a8('0x68')](_0xe9a8('0x70'),'me',_0xe9a8('0x71'))['left_join']('chat_interaction_has_tags','it',_0xe9a8('0x72'))[_0xe9a8('0x68')](_0xe9a8('0x73'),'t',_0xe9a8('0x74'));var _0x4214af=squel[_0xe9a8('0x75')]();var _0x1c544e=[];var _0x592437=squel[_0xe9a8('0x75')]();var _0x3d9d47;if(_0x4652e5['query'][_0xe9a8('0x76')]){_0x3d9d47=as[_0xe9a8('0x77')](_0x4652e5['query'][_0xe9a8('0x76')]);var _0x42ff68=_0x3d9d47[_0xe9a8('0x78')];for(var _0x152ecf=0x0;_0x152ecf<_0x3d9d47[_0xe9a8('0x79')]['length'];_0x152ecf++){var _0x305269=_0x3d9d47['conditions'][_0x152ecf];var _0x198630='i';var _0x1c2a5=_['find'](_0x5c7669,[_0xe9a8('0x39'),_0x305269[_0xe9a8('0x62')]]);if(!_0x1c2a5){switch(_0x305269['field']){case _0xe9a8('0x7a'):if(_0x305269['value']==0x1){_0x49a7ed[_0xe9a8('0x7b')]('`'+_0x305269[_0xe9a8('0x62')]+_0xe9a8('0x7c'));}else{_0x49a7ed[_0xe9a8('0x7b')]('`'+_0x305269[_0xe9a8('0x62')]+_0xe9a8('0x7d'));}break;case _0xe9a8('0x7e'):if(_0x305269[_0xe9a8('0x7f')]===_0xe9a8('0x80')){if(_0x305269[_0xe9a8('0x81')][_0xe9a8('0x44')]('\x20')[_0xe9a8('0x82')]>0x1){_0x4214af[_0x42ff68](_0xe9a8('0x83'),qs[_0xe9a8('0x84')](_0x305269['value']),null);}else{var _0x4b1124='%'+_0x305269[_0xe9a8('0x81')]+'%';_0x4214af[_0x42ff68](_0xe9a8('0x85'),_0x4b1124,_0x4b1124,_0x4b1124);}}else{_0x1c2a5=_[_0xe9a8('0x86')](_0x5c7669,[_0xe9a8('0x39'),_0xe9a8('0x87')]);_0x305269[_0xe9a8('0x62')]=_0xe9a8('0x87');_0x9aa699=as['buildExpression'](_0x198630,_0x1c2a5[_0xe9a8('0x88')],_0x305269);_0x4214af[_0x42ff68](_0x9aa699[_0xe9a8('0x89')],_0x9aa699[_0xe9a8('0x81')]['start'],_0x9aa699[_0xe9a8('0x81')]['end']);}break;case _0xe9a8('0x8a'):var _0x458c62=_0x305269[_0xe9a8('0x81')][_0xe9a8('0x44')](',')[_0xe9a8('0x40')](function(_0x37a87b){return Number(_0x37a87b);});_0x458c62[_0xe9a8('0x45')](function(_0x1c069a){_0x592437['or'](_0xe9a8('0x8b'),'%,'+_0x1c069a+',%');});_0x1c544e=_[_0xe9a8('0x8c')](_0x1c544e,_0x458c62);break;case _0xe9a8('0x8d'):if(_0x305269[_0xe9a8('0x7f')]===_0xe9a8('0x80')){_0x4214af[_0x42ff68](_0xe9a8('0x8e'),'%'+_0x305269[_0xe9a8('0x81')]+'%',null);}else{_0x1c2a5=_[_0xe9a8('0x86')](_0x5c7669,['name',_0xe9a8('0x4c')]);_0x305269[_0xe9a8('0x62')]='UserId';_0x9aa699=as[_0xe9a8('0x8f')](_0x198630,_0x1c2a5[_0xe9a8('0x88')],_0x305269);_0x4214af[_0x42ff68](_0x9aa699[_0xe9a8('0x89')],_0x9aa699['value'][_0xe9a8('0x90')],_0x9aa699[_0xe9a8('0x81')][_0xe9a8('0x2d')]);}break;case'body':_0x9aa699=as[_0xe9a8('0x8f')]('me',null,_0x305269);_0x4214af[_0x42ff68](_0x9aa699[_0xe9a8('0x89')],_0x9aa699[_0xe9a8('0x81')][_0xe9a8('0x90')],_0x9aa699[_0xe9a8('0x81')][_0xe9a8('0x2d')]);break;}}else{var _0x9aa699=as[_0xe9a8('0x8f')](_0x198630,_0x1c2a5[_0xe9a8('0x88')],_0x305269);_0x4214af[_0x42ff68](_0x9aa699[_0xe9a8('0x89')],_0x9aa699['value'][_0xe9a8('0x90')],_0x9aa699[_0xe9a8('0x81')][_0xe9a8('0x2d')]);}}}else{var _0x3910a1=_(_0x4652e5[_0xe9a8('0x56')])['keys']()['map'](function(_0x3b43f5){return _[_0xe9a8('0x91')](_0x5c7669,[_0xe9a8('0x39'),_0x3b43f5])?_0x3b43f5:undefined;})['compact']()['value']();if(!_[_0xe9a8('0x92')](_0x3910a1)){_0x3910a1[_0xe9a8('0x45')](function(_0x127747){if(_0x127747===_0xe9a8('0x93')){_0x49a7ed[_0xe9a8('0x5e')]('i.ChatWebsiteId\x20IN\x20?',[][_0xe9a8('0x94')](_0x4652e5[_0xe9a8('0x56')][_0x127747]));}else if(_0x127747==='createdAt'){var _0x24ecc9=JSON[_0xe9a8('0x95')](_0x4652e5[_0xe9a8('0x56')][_0x127747])[_0xe9a8('0x96')];var _0x4bb53a=JSON['parse'](_0x4652e5['query'][_0x127747])[_0xe9a8('0x97')];_0x49a7ed[_0xe9a8('0x5e')](_0xe9a8('0x98'),_0x24ecc9,_0x4bb53a);}else{if(_0x4652e5['query'][_0x127747]===_0xe9a8('0x99')){_0x49a7ed[_0xe9a8('0x5e')]('i.'+_0x127747+'\x20IS\x20NULL');}else{_0x49a7ed[_0xe9a8('0x5e')]('i.'+_0x127747+_0xe9a8('0x9a'),_0x4652e5[_0xe9a8('0x56')][_0x127747]);}}});}if(_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x9b')]){if(_0x4652e5[_0xe9a8('0x56')]['read']==0x1){_0x49a7ed[_0xe9a8('0x7b')](_0xe9a8('0x9c'));}else{_0x49a7ed[_0xe9a8('0x7b')](_0xe9a8('0x9d'));}}if(_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x9e')]){_0x1c544e=_[_0xe9a8('0x9f')](_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x9e')])?_0x4652e5['query'][_0xe9a8('0x9e')]:new Array(_0x4652e5[_0xe9a8('0x56')]['tag']);_0x1c544e[_0xe9a8('0x45')](function(_0x3bf148){_0x592437['or'](_0xe9a8('0x8b'),'%,'+_0x3bf148+',%');});}if(_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0xa0')]){var _0xf14e24=_0x4652e5[_0xe9a8('0x56')]['filter'][_0xe9a8('0xa1')]('\x5c','\x5c\x5c')[_0xe9a8('0xa1')](/'/g,'\x27\x27');if(qs[_0xe9a8('0xa2')](_0xf14e24)){_0x4214af['or'](_0xe9a8('0xa3'),_0xf14e24+'%');}else{_0x4214af['or'](_0xe9a8('0xa4'),qs[_0xe9a8('0x84')](_0xf14e24))['or'](_0xe9a8('0xa5'),_0xf14e24+'%');}}}_0x49a7ed[_0xe9a8('0x5e')](_0x4214af);_0x49a7ed[_0xe9a8('0xa6')](_0xe9a8('0xa7'));var _0x40e6d4={'type':db[_0xe9a8('0xa8')]['QueryTypes'][_0xe9a8('0xa9')],'raw':!![]};var _0x1b44e0=_0x49a7ed[_0xe9a8('0xaa')]();_0x1b44e0[_0xe9a8('0x62')](_0xe9a8('0xa7'));_0x1b44e0[_0xe9a8('0x62')](_0xe9a8('0xab'),_0xe9a8('0x7a'));if(_0x269b22['order']){_0x269b22[_0xe9a8('0x5c')][_0xe9a8('0x45')](function(_0x21a233){var _0xcec51f=_0x21a233[0x0]===_0xe9a8('0xac')?_0x21a233[0x0]:'i.'+_0x21a233[0x0];_0x49a7ed[_0xe9a8('0x5c')](_0xcec51f,_0x21a233[0x1]===_0xe9a8('0xad')?![]:!![]);});}if(!_[_0xe9a8('0x92')](_0x1c544e)){_0x49a7ed['having'](_0x592437);_0x1b44e0[_0xe9a8('0x5e')]('t.id\x20IN\x20?',_0x1c544e);}BPromise[_0xe9a8('0xae')]()[_0xe9a8('0x36')](function(){if(!_0x3d9d47){if(_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x93')])return;_0x1b44e0[_0xe9a8('0x5e')](_0xe9a8('0xaf'));_0x49a7ed[_0xe9a8('0x5e')](_0xe9a8('0xaf'));return;}if(_0x4652e5[_0xe9a8('0xb0')][_0xe9a8('0xb1')]!=='agent')return;return _0x4652e5[_0xe9a8('0xb0')][_0xe9a8('0xb2')]({'attributes':['id'],'raw':!![]})[_0xe9a8('0x36')](function(_0x3a9625){if(_[_0xe9a8('0x92')](_0x3a9625)){_0x1b44e0['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x49a7ed[_0xe9a8('0x5e')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1b44e0['where'](_0xe9a8('0xb3'),_[_0xe9a8('0x40')](_0x3a9625,'id'));_0x49a7ed[_0xe9a8('0x5e')](_0xe9a8('0xb3'),_[_0xe9a8('0x40')](_0x3a9625,'id'));}});})[_0xe9a8('0x36')](function(){if(_0x4652e5[_0xe9a8('0xb0')]['role']===_0xe9a8('0x3d')&&!_0x3d9d47&&!_0x4652e5[_0xe9a8('0x56')][_0xe9a8('0x93')])return[];return db[_0xe9a8('0xb4')]['query'](_0x1b44e0[_0xe9a8('0xb5')](),_0x40e6d4);})[_0xe9a8('0x36')](function(_0x2c16ef){_0x43bd9a[_0xe9a8('0x32')]=_0x2c16ef[_0xe9a8('0x82')];if(_0x43bd9a[_0xe9a8('0x32')]===0x0)return[];return db[_0xe9a8('0xb4')][_0xe9a8('0x56')](_0x3f2dfc[_0xe9a8('0xb5')](),_0x40e6d4)[_0xe9a8('0x36')](function(_0x43b2ec){_0x2a1e18=_[_0xe9a8('0xb6')](_0x43b2ec,'id');_0x40e6d4=_[_0xe9a8('0xb7')](_0x40e6d4,{'model':db[_0xe9a8('0x50')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4652e5[_0xe9a8('0x56')]['fields']){_0x269b22[_0xe9a8('0x58')][_0xe9a8('0x45')](function(_0x548296){_0x49a7ed['field']('i.'+_0x548296);});}else{_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xab'),_0xe9a8('0x7a'));_0x49a7ed['field'](_0xe9a8('0xb8'),_0xe9a8('0xb9'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xba'),_0xe9a8('0xbb'));_0x49a7ed[_0xe9a8('0x62')]('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',_0xe9a8('0xac'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xbc'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xbd'),_0xe9a8('0xbe'));_0x49a7ed[_0xe9a8('0x62')]('c.lastName',_0xe9a8('0xbf'));_0x49a7ed[_0xe9a8('0x62')]('c.email',_0xe9a8('0xc0'));_0x49a7ed[_0xe9a8('0x62')]('c.phone',_0xe9a8('0xc1'));_0x49a7ed['field'](_0xe9a8('0xc2'),_0xe9a8('0xc3'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xc4'),_0xe9a8('0xc5'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xc6'),_0xe9a8('0xc7'));_0x49a7ed[_0xe9a8('0x62')](_0xe9a8('0xc8'),_0xe9a8('0xc9'));_0x49a7ed['field'](_0xe9a8('0xca'),_0xe9a8('0x42'));}if(_0x269b22[_0xe9a8('0x30')])_0x49a7ed[_0xe9a8('0x30')](_0x269b22[_0xe9a8('0x30')]);if(_0x269b22[_0xe9a8('0x31')])_0x49a7ed[_0xe9a8('0x31')](_0x269b22[_0xe9a8('0x31')]);return db[_0xe9a8('0xb4')]['query'](_0x49a7ed[_0xe9a8('0xb5')](),_0x40e6d4);})[_0xe9a8('0x36')](function(_0x4dd472){if(_0x4dd472['length']>0x0)_0x241b4e[_0xe9a8('0x5e')](_0xe9a8('0xcb'),_['map'](_0x4dd472,'id'));return db[_0xe9a8('0xb4')][_0xe9a8('0x56')](_0x241b4e[_0xe9a8('0xb5')](),_0x40e6d4)[_0xe9a8('0x36')](function(_0x377bab){var _0x3960e0=_[_0xe9a8('0xcc')](_0x377bab,_0xe9a8('0xcd'));var _0x53b2f0=[];_0x4dd472[_0xe9a8('0x45')](function(_0x52acf7){_0x53b2f0['push'](updateChatInteraction(_0x52acf7,_0x2a1e18,_0x3960e0));});return BPromise[_0xe9a8('0xce')](_0x53b2f0);});});})[_0xe9a8('0x36')](function(_0x871300){_0x43bd9a[_0xe9a8('0xcf')]=_0x871300;return _0x43bd9a;})[_0xe9a8('0x36')](respondWithFilteredResult(_0x3cbd21,_0x269b22))['catch'](handleError(_0x3cbd21,null));};exports[_0xe9a8('0xd0')]=function(_0x23cd46,_0x23943d){var _0x24c070={'raw':![],'where':{'id':_0x23cd46['params']['id']}},_0x2a3505={};_0x2a3505[_0xe9a8('0x54')]=_[_0xe9a8('0x55')](db['ChatInteraction'][_0xe9a8('0x51')]);_0x2a3505[_0xe9a8('0x56')]=_[_0xe9a8('0x55')](_0x23cd46['query']);_0x2a3505[_0xe9a8('0x5f')]=_[_0xe9a8('0x57')](_0x2a3505['model'],_0x2a3505[_0xe9a8('0x56')]);_0x24c070[_0xe9a8('0x58')]=_['intersection'](_0x2a3505[_0xe9a8('0x54')],qs[_0xe9a8('0x59')](_0x23cd46['query'][_0xe9a8('0x59')]));_0x24c070[_0xe9a8('0x58')]=_0x24c070[_0xe9a8('0x58')]['length']?_0x24c070[_0xe9a8('0x58')]:_0x2a3505['model'];if(_0x23cd46[_0xe9a8('0x56')][_0xe9a8('0xd1')]){_0x24c070[_0xe9a8('0xd2')]=[{'all':!![]}];}_0x24c070=_[_0xe9a8('0xb7')]({},_0x24c070,_0x23cd46[_0xe9a8('0xd3')]);return db['ChatInteraction'][_0xe9a8('0x86')](_0x24c070)['then'](handleEntityNotFound(_0x23943d,null))[_0xe9a8('0x36')](respondWithResult(_0x23943d,null))[_0xe9a8('0x2a')](handleError(_0x23943d,null));};exports[_0xe9a8('0xd4')]=function(_0x1b99bd,_0x20129f){return db[_0xe9a8('0x50')][_0xe9a8('0xd4')](_0x1b99bd[_0xe9a8('0x3c')],{})['then'](respondWithResult(_0x20129f,0xc9))[_0xe9a8('0x2a')](handleError(_0x20129f,null));};exports['update']=function(_0x41eb9a,_0xbf3267){if(_0x41eb9a['body']['id']){delete _0x41eb9a[_0xe9a8('0x3c')]['id'];}return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0x41eb9a['params']['id']}})['then'](handleEntityNotFound(_0xbf3267,null))[_0xe9a8('0x36')](saveUpdates(_0x41eb9a['body'],null))[_0xe9a8('0x36')](respondWithResult(_0xbf3267,null))['catch'](handleError(_0xbf3267,null));};exports['destroy']=function(_0x5553c9,_0x28917f){return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0x5553c9[_0xe9a8('0xd5')]['id']}})[_0xe9a8('0x36')](handleEntityNotFound(_0x28917f,null))[_0xe9a8('0x36')](removeEntity(_0x28917f,null))[_0xe9a8('0x2a')](handleError(_0x28917f,null));};exports[_0xe9a8('0xd6')]=function(_0x3c9453,_0x1fe4ff){return db[_0xe9a8('0x50')]['describe']()[_0xe9a8('0x36')](respondWithResult(_0x1fe4ff,null))[_0xe9a8('0x2a')](handleError(_0x1fe4ff,null));};exports[_0xe9a8('0xd7')]=function(_0x5a7fd3,_0x87735){var _0x5d66d8=_0x5a7fd3[_0xe9a8('0xd5')]['id'];var _0x1d71b9;var _0x534349;var _0x421529;return db['ChatInteraction'][_0xe9a8('0xd8')]({'where':{'id':_0x5d66d8}})[_0xe9a8('0x36')](function(_0xdb0400){_0x1d71b9=_0xdb0400;return db[_0xe9a8('0xd9')][_0xe9a8('0xd8')]({'where':{'id':_0xdb0400[_0xe9a8('0x93')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xe9a8('0x36')](function(_0x4a2e03){if(_0x4a2e03&&_0x4a2e03[_0xe9a8('0xda')]&&_0x4a2e03[_0xe9a8('0xdb')]){_0x534349=_0x4a2e03;var _0x2d3cc2={'interaction':{'id':_0x5d66d8},'agent':{'id':_0x5a7fd3[_0xe9a8('0xb0')]['id'],'name':_0x5a7fd3[_0xe9a8('0xb0')]['name'],'fullname':_0x5a7fd3[_0xe9a8('0xb0')]['fullname'],'email':_0x5a7fd3[_0xe9a8('0xb0')][_0xe9a8('0xdc')]},'contact':_0x5a7fd3[_0xe9a8('0x3c')][_0xe9a8('0xdd')],'account':_0x5a7fd3[_0xe9a8('0x3c')][_0xe9a8('0x3f')]};var _0x4f87c6={'rejectUnauthorized':![],'method':'POST','url':_0xe9a8('0xde'),'headers':{'X-APIKEY':_0x4a2e03[_0xe9a8('0xda')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5a7fd3[_0xe9a8('0xb0')]['email']],'buttons':null,'topic':_0x534349[_0xe9a8('0xdf')],'note':_[_0xe9a8('0xe0')](_0x534349[_0xe9a8('0xe1')])?null:getMustacheRender(_0x534349['vidaooNote'],_0x2d3cc2),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe9a8('0xe0')](_0x534349[_0xe9a8('0xe2')])){var _0x1cc86b=getMustacheRender(_0x534349['vidaooMetadata'],_0x2d3cc2);var _0xa88cf4=JSON['parse'](_0x1cc86b);_0x4f87c6['body']['metadata']=_0xa88cf4;}}catch(_0x40a429){throw new db[(_0xe9a8('0xa8'))][(_0xe9a8('0xe3'))](_0xe9a8('0xe4'));}return rp(_0x4f87c6);}else{throw new db[(_0xe9a8('0xa8'))][(_0xe9a8('0xe3'))](_0xe9a8('0xe5'));}})[_0xe9a8('0x36')](function(_0x5e48ab){_0x421529=_0x5e48ab;if(_0x421529['id']){var _0x3903f1={'body':_0x421529[_0xe9a8('0xe6')],'ChatWebsiteId':_0x534349['id'],'ChatInteractionId':_0x1d71b9['id'],'direction':_0xe9a8('0xe7'),'UserId':_0x5a7fd3[_0xe9a8('0xb0')]['id']};return db[_0xe9a8('0xe8')][_0xe9a8('0xd4')](_0x3903f1,{});}else{throw new db[(_0xe9a8('0xa8'))][(_0xe9a8('0xe3'))](_0xe9a8('0xe9'));}})[_0xe9a8('0x36')](function(){return _0x1d71b9['updateAttributes']({'vidaooSessionId':_0x421529['id']});})[_0xe9a8('0x36')](respondWithResult(_0x87735,null))[_0xe9a8('0x2a')](handleError(_0x87735,null));};exports[_0xe9a8('0xea')]=function(_0x55d442,_0x24cf54){if(_0x55d442[_0xe9a8('0x3c')]['id']){delete _0x55d442[_0xe9a8('0x3c')]['id'];}return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0x55d442[_0xe9a8('0xd5')]['id']},'include':[{'model':db[_0xe9a8('0xeb')],'as':_0xe9a8('0x7e')}]})[_0xe9a8('0x36')](handleEntityNotFound(_0x24cf54,null))[_0xe9a8('0x36')](saveUpdates(_0x55d442[_0xe9a8('0x3c')],null))[_0xe9a8('0x36')](respondWithResult(_0x24cf54,null))[_0xe9a8('0x2a')](handleError(_0x24cf54,null));};exports[_0xe9a8('0xec')]=function(_0x4383d0,_0x32cffa,_0x34bf12){if(_0x4383d0['body']['id']){delete _0x4383d0['body']['id'];}return db[_0xe9a8('0x50')]['find']({'where':{'id':_0x4383d0[_0xe9a8('0xd5')]['id']}})[_0xe9a8('0x36')](function(_0x383e6){if(!_0x383e6){logger['error'](_0xe9a8('0xed'),_0xe9a8('0xec'),0x194,'entity\x20not\x20found');_0x32cffa[_0xe9a8('0x2b')](0x194);}else{if(_0x383e6[_0xe9a8('0x4c')]){throw new db[(_0xe9a8('0xa8'))][(_0xe9a8('0xe3'))](_0xe9a8('0xee'));}}return _0x383e6;})['then'](function(_0x4a93ee){if(_0x4a93ee){return _0x4a93ee['update']({'closed':_0x4383d0[_0xe9a8('0x3c')][_0xe9a8('0x4b')],'disposition':_0x4383d0['body'][_0xe9a8('0x4d')]})[_0xe9a8('0x36')](function(_0x248444){return _0x248444;});}})['then'](function(_0x3e7b03){return respondWithRpcPromise(_0xe9a8('0xef'),_0xe9a8('0xec'),_0x4383d0[_0xe9a8('0x3c')],client9004);})['then'](respondWithResult(_0x32cffa,null))[_0xe9a8('0x2a')](handleError(_0x32cffa,null));};exports[_0xe9a8('0xf0')]=function(_0x3e8baa,_0x2c8610,_0x34f465){_0x3e8baa[_0xe9a8('0x3c')]['name']=_0x3e8baa[_0xe9a8('0xf1')][_0xe9a8('0xf2')];_0x3e8baa['body'][_0xe9a8('0xf3')]=_0x3e8baa['file'][_0xe9a8('0xf4')];_0x3e8baa['body']['type']=_0x3e8baa[_0xe9a8('0xf1')][_0xe9a8('0xf5')];return db[_0xe9a8('0xf6')][_0xe9a8('0xd4')](_0x3e8baa[_0xe9a8('0x3c')])[_0xe9a8('0x36')](respondWithResult(_0x2c8610,0xc9))[_0xe9a8('0x2a')](handleError(_0x2c8610,null));};exports[_0xe9a8('0xf7')]=function(_0x5bbb57,_0x17cffa,_0x429148){return db[_0xe9a8('0x50')][_0xe9a8('0xd8')]({'where':{'id':_0x5bbb57[_0xe9a8('0xd5')]['id']},'raw':!![]})[_0xe9a8('0x36')](handleEntityNotFound(_0x17cffa,null))[_0xe9a8('0x36')](function(_0x5b3054){if(_0x5b3054){if(_0x5b3054['closed']){return _0x17cffa[_0xe9a8('0x2c')](0x193)[_0xe9a8('0x2e')]({'status':0x193,'message':_0xe9a8('0xf8')});}return db[_0xe9a8('0xf6')]['findOne']({'where':{'id':_0x5bbb57[_0xe9a8('0x56')][_0xe9a8('0xf9')]},'raw':!![]})[_0xe9a8('0x36')](handleEntityNotFound(_0x17cffa,null));}})[_0xe9a8('0x36')](function(_0x22aa8f){if(_0x22aa8f){var _0x3d5f74=_0x22aa8f[_0xe9a8('0xfa')]!==null;var _0x3c37d8=path[_0xe9a8('0xfb')](config['root'],_0xe9a8('0xfc'));if(_0x3d5f74){_0x3c37d8=path[_0xe9a8('0xfb')](_0x3c37d8,_0xe9a8('0xfd'));}var _0x1fd6ff=path[_0xe9a8('0xfb')](_0x3c37d8,_0x22aa8f[_0xe9a8('0xf3')]);return _0x17cffa[_0xe9a8('0xfe')](_0x1fd6ff);}})[_0xe9a8('0x2a')](handleError(_0x17cffa,null));};exports[_0xe9a8('0xff')]=function(_0x122dc8,_0x581f43){var _0x35bb8c=null;var _0x1e29f9=null;var _0x4f1877=null;var _0x470c8f=null;if(_0x122dc8[_0xe9a8('0x3c')]['id']){delete _0x122dc8[_0xe9a8('0x3c')]['id'];}if(_0x122dc8[_0xe9a8('0x3c')][_0xe9a8('0x100')]){_0x470c8f=path[_0xe9a8('0xfb')](config[_0xe9a8('0x101')],_0xe9a8('0x102'),util[_0xe9a8('0x103')](_0xe9a8('0x104'),Date[_0xe9a8('0x105')]()));_0x122dc8[_0xe9a8('0x3c')][_0xe9a8('0x106')]=_0x470c8f;}return db[_0xe9a8('0x50')]['find']({'where':{'id':_0x122dc8[_0xe9a8('0xd5')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xe9a8('0x107'),'include':[{'model':db[_0xe9a8('0x8d')],'as':_0xe9a8('0x8d')}]}]})[_0xe9a8('0x36')](handleEntityNotFound(_0x581f43,null))[_0xe9a8('0x36')](saveUpdates(_0x122dc8['body'],null))[_0xe9a8('0x36')](function(_0x2711f9){if(_0x2711f9){_0x35bb8c=_0x2711f9;return db['ChatWebsite'][_0xe9a8('0x86')]({'where':{'id':_0x35bb8c['ChatWebsiteId']}});}})[_0xe9a8('0x36')](function(_0x5e99ad){if(_0x5e99ad){_0x4f1877=_0x5e99ad;return db[_0xe9a8('0xeb')][_0xe9a8('0x86')]({'where':{'id':_0x35bb8c[_0xe9a8('0x87')]}});}})[_0xe9a8('0x36')](function(_0x23c523){if(_0x23c523){_0x1e29f9=_0x23c523;if(_0x470c8f){var _0x57e889=null;for(var _0x566933=0x1;_0x566933<_0x35bb8c['Messages']['length'];++_0x566933){_0x57e889=_0x35bb8c[_0xe9a8('0x107')][_0x566933];var _0x13d53c=_0x57e889[_0xe9a8('0x4c')]?util['format'](_0xe9a8('0x108'),_0x4f1877['agentAlias'],_0x57e889[_0xe9a8('0x4c')]):_0xe9a8('0x109');var _0x2e2094=_0x122dc8[_0xe9a8('0x3c')][_0xe9a8('0x10a')]||util[_0xe9a8('0x103')](_0xe9a8('0x108'),_0xe9a8('0x10b'),_0x57e889[_0xe9a8('0x87')]);switch(_0x4f1877[_0xe9a8('0x10c')]){case _0xe9a8('0x10d'):_0x13d53c=_0x57e889['UserId']?util[_0xe9a8('0x103')]('%s%d',_0x4f1877[_0xe9a8('0x10e')],_0x57e889[_0xe9a8('0x4c')]):_0xe9a8('0x109');break;case _0xe9a8('0x10f'):_0x13d53c=_0x57e889[_0xe9a8('0x4c')]?_0x57e889[_0xe9a8('0x8d')]['alias']||_0x57e889[_0xe9a8('0x8d')]['fullname']:_0xe9a8('0x109');break;case'agent_fullname':_0x13d53c=_0x57e889[_0xe9a8('0x4c')]?_0x57e889[_0xe9a8('0x8d')]['fullname']:_0xe9a8('0x109');break;default:_0x13d53c=_0x57e889['UserId']?util['format']('%s%d',_0x4f1877[_0xe9a8('0x10e')],_0x57e889[_0xe9a8('0x4c')]):_0xe9a8('0x109');}var _0x3d4cb5=util['format'](_0xe9a8('0x110'),moment(_0x57e889['createdAt'])[_0xe9a8('0x103')](_0xe9a8('0x111')),_0x57e889['direction']==='in'?_0x2e2094:_0x13d53c,_0x57e889[_0xe9a8('0x3c')]);if(!_0x57e889[_0xe9a8('0x112')]){fs[_0xe9a8('0x113')](_0x470c8f,_0x3d4cb5);}}return db[_0xe9a8('0x114')][_0xe9a8('0xd8')]({'where':{'service':!![]},'include':[{'model':db[_0xe9a8('0x115')],'as':_0xe9a8('0x116'),'raw':!![]}]});}}})[_0xe9a8('0x36')](function(_0x4d613a){if(_0x4d613a&&_0x4d613a[_0xe9a8('0x116')]&&_0x122dc8[_0xe9a8('0x3c')]){var _0x2b688f={'tls':{'rejectUnauthorized':![]}};if(_0x4d613a['Smtp']['service']){_0x2b688f[_0xe9a8('0x117')]=_0x4d613a[_0xe9a8('0x116')]['service'];}else{_0x2b688f[_0xe9a8('0x118')]=_0x4d613a[_0xe9a8('0x116')][_0xe9a8('0x118')];_0x2b688f['port']=_0x4d613a[_0xe9a8('0x116')][_0xe9a8('0x119')];_0x2b688f['secure']=_0x4d613a[_0xe9a8('0x116')]['secure'];}if(_0x4d613a[_0xe9a8('0x116')]['authentication']){_0x2b688f[_0xe9a8('0x11a')]={'user':_0x4d613a[_0xe9a8('0x116')][_0xe9a8('0xb0')],'pass':_0x4d613a[_0xe9a8('0x116')][_0xe9a8('0x11b')]};}return respondWithRpcPromise(_0xe9a8('0x11c'),_0xe9a8('0x11d'),{'account':_0x2b688f,'message':{'from':util[_0xe9a8('0x103')](_0xe9a8('0x11e'),_0x4d613a['name'],_0x4d613a['email']||_0x4d613a[_0xe9a8('0x116')][_0xe9a8('0xb0')]),'to':_0x122dc8[_0xe9a8('0x3c')]['mailTranscript'],'subject':_0xe9a8('0x11f'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x122dc8['body'][_0xe9a8('0x100')]),'attachments':[{'path':_0x470c8f}]}})[_0xe9a8('0x36')](function(){return _0x35bb8c;})[_0xe9a8('0x2a')](function(_0x4355ec){console[_0xe9a8('0x26')](_0x4355ec);});}else{return _0x35bb8c;}})['then'](respondWithStatusCode(_0x581f43,0xc8))[_0xe9a8('0x2a')](handleError(_0x581f43,null));};exports[_0xe9a8('0x120')]=function(_0x336484,_0x487614,_0xd49f1e){return db['ChatMessage'][_0xe9a8('0x86')]({'where':{'id':_0x336484['params']['id']}})['then'](handleEntityNotFound(_0x487614,null))[_0xe9a8('0x36')](function(_0xb15b3c){if(_0xb15b3c){return _0xb15b3c['addMessage'](_0x336484['body'][_0xe9a8('0x121')],_[_0xe9a8('0x122')](_0x336484[_0xe9a8('0x3c')],['ids','id'])||{});}})[_0xe9a8('0x36')](respondWithResult(_0x487614,null))[_0xe9a8('0x2a')](handleError(_0x487614,null));};exports[_0xe9a8('0x123')]=function(_0x387829,_0x3957bf,_0x43d7f9){var _0x569072={'raw':![],'where':{}};var _0x9dfb41={};var _0x2a953f={'count':0x0,'rows':[]};return db[_0xe9a8('0x50')][_0xe9a8('0xd8')]({'where':{'id':_0x387829[_0xe9a8('0xd5')]['id']}})[_0xe9a8('0x36')](handleEntityNotFound(_0x3957bf,null))[_0xe9a8('0x36')](function(_0x5cddc0){if(_0x5cddc0){_0x9dfb41[_0xe9a8('0x54')]=_[_0xe9a8('0x55')](db['ChatMessage'][_0xe9a8('0x51')]);_0x9dfb41[_0xe9a8('0x56')]=_[_0xe9a8('0x55')](_0x387829['query']);_0x9dfb41['filters']=_['intersection'](_0x9dfb41[_0xe9a8('0x54')],_0x9dfb41[_0xe9a8('0x56')]);_0x569072[_0xe9a8('0x58')]=_[_0xe9a8('0x57')](_0x9dfb41[_0xe9a8('0x54')],qs[_0xe9a8('0x59')](_0x387829[_0xe9a8('0x56')][_0xe9a8('0x59')]));_0x569072[_0xe9a8('0x58')]=_0x569072['attributes'][_0xe9a8('0x82')]?_0x569072[_0xe9a8('0x58')]:_0x9dfb41[_0xe9a8('0x54')];if(!_0x387829[_0xe9a8('0x56')][_0xe9a8('0x5a')]('nolimit')){_0x569072[_0xe9a8('0x30')]=qs[_0xe9a8('0x30')](_0x387829[_0xe9a8('0x56')][_0xe9a8('0x30')]);_0x569072[_0xe9a8('0x31')]=qs[_0xe9a8('0x31')](_0x387829[_0xe9a8('0x56')][_0xe9a8('0x31')]);}_0x569072[_0xe9a8('0x5c')]=qs[_0xe9a8('0x5d')](_0x387829[_0xe9a8('0x56')][_0xe9a8('0x5d')]);_0x569072[_0xe9a8('0x5e')]=qs['filters'](_[_0xe9a8('0x60')](_0x387829[_0xe9a8('0x56')],_0x9dfb41[_0xe9a8('0x5f')]));_0x569072[_0xe9a8('0x5e')][_0xe9a8('0xcd')]=_0x5cddc0['id'];if(_0x387829[_0xe9a8('0x56')][_0xe9a8('0xa0')]){_0x569072['where']=_[_0xe9a8('0xb7')](_0x569072[_0xe9a8('0x5e')],{'$or':_[_0xe9a8('0x40')](_0x569072[_0xe9a8('0x58')],function(_0x56bc56){var _0x1387d9={};_0x1387d9[_0x56bc56]={'$like':'%'+_0x387829[_0xe9a8('0x56')]['filter']+'%'};return _0x1387d9;})});}if(_0x387829[_0xe9a8('0x56')]['$gte']){var _0x2415b8=_0x387829[_0xe9a8('0x56')][_0xe9a8('0x96')][_0xe9a8('0x44')](',');var _0xc2e54b={};_0xc2e54b[_0x2415b8[0x0]]={'$gte':moment(_0x2415b8[0x1])[_0xe9a8('0x103')](_0xe9a8('0x124'))};_0x569072[_0xe9a8('0x5e')]=_['merge'](_0x569072[_0xe9a8('0x5e')],_0xc2e54b);}_0x569072=_[_0xe9a8('0xb7')]({},_0x569072,_0x387829[_0xe9a8('0xd3')]);return db[_0xe9a8('0xe8')][_0xe9a8('0x32')]({'where':_0x569072[_0xe9a8('0x5e')]})[_0xe9a8('0x36')](function(_0xe693f9){_0x2a953f[_0xe9a8('0x32')]=_0xe693f9;if(_0x387829[_0xe9a8('0x56')][_0xe9a8('0xd1')]){_0x569072[_0xe9a8('0xd2')]=[{'all':!![]}];}return db[_0xe9a8('0xe8')]['findAll'](_0x569072);})['then'](function(_0x2b63b7){_0x2a953f[_0xe9a8('0xcf')]=_0x2b63b7;return _0x2a953f;});}})[_0xe9a8('0x36')](respondWithFilteredResult(_0x3957bf,_0x569072))['catch'](handleError(_0x3957bf,null));};exports[_0xe9a8('0x125')]=function(_0x501309,_0x16f130,_0x50a3a0){var _0x5169cd={'where':{}},_0x23555b={},_0x26b07c={'count':0x0,'rows':[]};return db[_0xe9a8('0x50')][_0xe9a8('0xd8')]({'where':{'id':_0x501309['params']['id']}})['then'](handleEntityNotFound(_0x16f130,null))['then'](function(_0x1f8d54){if(_0x1f8d54){_0x23555b[_0xe9a8('0x54')]=_[_0xe9a8('0x55')](db[_0xe9a8('0xe8')][_0xe9a8('0x51')]);_0x23555b[_0xe9a8('0x56')]=_['keys'](_0x501309[_0xe9a8('0x56')]);_0x23555b[_0xe9a8('0x5f')]=_[_0xe9a8('0x57')](_0x23555b[_0xe9a8('0x54')],_0x23555b[_0xe9a8('0x56')]);_0x5169cd[_0xe9a8('0x58')]=_[_0xe9a8('0x57')](_0x23555b[_0xe9a8('0x54')],qs[_0xe9a8('0x59')](_0x501309[_0xe9a8('0x56')][_0xe9a8('0x59')]));_0x5169cd['attributes']=_0x5169cd['attributes'][_0xe9a8('0x82')]?_0x5169cd[_0xe9a8('0x58')]:_0x23555b[_0xe9a8('0x54')];if(!_0x501309[_0xe9a8('0x56')][_0xe9a8('0x5a')](_0xe9a8('0x5b'))){_0x5169cd['limit']=qs[_0xe9a8('0x30')](_0x501309[_0xe9a8('0x56')][_0xe9a8('0x30')]);_0x5169cd['offset']=qs[_0xe9a8('0x31')](_0x501309[_0xe9a8('0x56')][_0xe9a8('0x31')]);}_0x5169cd[_0xe9a8('0x5c')]=qs[_0xe9a8('0x5d')](_0x501309['query'][_0xe9a8('0x5d')]);_0x5169cd[_0xe9a8('0x5e')]=qs[_0xe9a8('0x5f')](_[_0xe9a8('0x60')](_0x501309[_0xe9a8('0x56')],_0x23555b[_0xe9a8('0x5f')]));_0x5169cd[_0xe9a8('0x5e')][_0xe9a8('0xcd')]=_0x1f8d54['id'];if(_0x501309[_0xe9a8('0x56')][_0xe9a8('0xa0')]){_0x5169cd['where']=_['merge'](_0x5169cd['where'],{'$or':_[_0xe9a8('0x40')](_0x5169cd[_0xe9a8('0x58')],function(_0x41aea7){var _0x42c413={};_0x42c413[_0x41aea7]={'$like':'%'+_0x501309[_0xe9a8('0x56')][_0xe9a8('0xa0')]+'%'};return _0x42c413;})});}_0x5169cd['where']['secret']=![];if(_0x501309[_0xe9a8('0x56')]['id']){_0x5169cd[_0xe9a8('0x5e')]['id']={'$gt':_0x501309['query']['id']};}_0x5169cd=_[_0xe9a8('0xb7')]({},_0x5169cd,_0x501309[_0xe9a8('0xd3')]);return db[_0xe9a8('0xe8')][_0xe9a8('0x32')]({'where':_0x5169cd['where']})[_0xe9a8('0x36')](function(_0x20d6fd){_0x26b07c[_0xe9a8('0x32')]=_0x20d6fd;_0x5169cd[_0xe9a8('0xd2')]=[];if(_0x501309['query'][_0xe9a8('0x126')]){_0x5169cd['include'][_0xe9a8('0x127')]({'model':db[_0xe9a8('0x8d')],'as':_0xe9a8('0x8d'),'attributes':['id',_0xe9a8('0x41'),_0xe9a8('0x128')]});}if(_0x501309[_0xe9a8('0x56')][_0xe9a8('0xd1')]){_0x5169cd[_0xe9a8('0xd2')]=[{'all':!![]}];}return db[_0xe9a8('0xe8')][_0xe9a8('0x129')](_0x5169cd);})[_0xe9a8('0x36')](function(_0x5ca9bb){_0x26b07c[_0xe9a8('0xcf')]=_0x5ca9bb;return _0x26b07c;});}})[_0xe9a8('0x36')](respondWithFilteredResult(_0x16f130,_0x5169cd))[_0xe9a8('0x2a')](handleError(_0x16f130,null));};exports[_0xe9a8('0x12a')]=function(_0x3a7a6e,_0x54fc11,_0x3c0048){return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0x3a7a6e[_0xe9a8('0xd5')]['id']}})[_0xe9a8('0x36')](handleEntityNotFound(_0x54fc11,null))[_0xe9a8('0x36')](function(_0x583eb5){if(_0x583eb5){return _0x583eb5[_0xe9a8('0x12b')](_0x3a7a6e[_0xe9a8('0x3c')][_0xe9a8('0x121')],_[_0xe9a8('0x122')](_0x3a7a6e['body'],[_0xe9a8('0x121'),'id'])||{})[_0xe9a8('0x12c')](function(){return db[_0xe9a8('0x8a')][_0xe9a8('0x129')]({'attributes':['id',_0xe9a8('0x39'),'color'],'where':{'id':_0x3a7a6e['body']['ids']}});})[_0xe9a8('0x36')](function(_0x1b9f13){socket[_0xe9a8('0x12d')]('chatInteractionTags:save',{'id':Number(_0x3a7a6e['params']['id']),'tags':_0x1b9f13||[]});return{'id':Number(_0x3a7a6e[_0xe9a8('0xd5')]['id']),'tags':_0x1b9f13||[]};});}})[_0xe9a8('0x36')](respondWithResult(_0x54fc11,null))[_0xe9a8('0x2a')](handleError(_0x54fc11,null));};exports[_0xe9a8('0x12e')]=function(_0x27a7ff,_0x44d659,_0x229f36){return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0x27a7ff[_0xe9a8('0xd5')]['id']}})[_0xe9a8('0x36')](handleEntityNotFound(_0x44d659,null))[_0xe9a8('0x36')](function(_0x5bf9f6){if(_0x5bf9f6){return _0x5bf9f6[_0xe9a8('0x12e')](_0x27a7ff[_0xe9a8('0x56')][_0xe9a8('0x121')]);}})[_0xe9a8('0x36')](respondWithStatusCode(_0x44d659,null))[_0xe9a8('0x2a')](handleError(_0x44d659,null));};exports[_0xe9a8('0xfe')]=function(_0xcb3441,_0x51c27){var _0x1ce0c2=moment()[_0xe9a8('0x12f')]()[_0xe9a8('0xb5')]();var _0x10264e=path[_0xe9a8('0xfb')](config[_0xe9a8('0x101')],_0xe9a8('0x130'),'files',_0xe9a8('0x131'));var _0x5ad405=path[_0xe9a8('0xfb')](config[_0xe9a8('0x101')],_0xe9a8('0x130'),_0xe9a8('0x132'),_0xe9a8('0x133'));var _0x59f640=path[_0xe9a8('0xfb')](_0x10264e,_0x1ce0c2);var _0x4b9988=util[_0xe9a8('0x103')](_0xe9a8('0x134'),_0xcb3441['params']['id'],_0x1ce0c2);var _0x20c837=path[_0xe9a8('0xfb')](_0x10264e,_0x4b9988);var _0xda4d43=[];_0xda4d43['push']({'model':db[_0xe9a8('0x8d')],'as':_0xe9a8('0x8d'),'attributes':['id','fullname'],'raw':!![]});_0xda4d43[_0xe9a8('0x127')]({'model':db['CmContact'],'as':_0xe9a8('0x7e'),'attributes':['id',_0xe9a8('0x135'),_0xe9a8('0x136')],'raw':!![]});if(_0xcb3441[_0xe9a8('0x56')][_0xe9a8('0x133')]){_0xda4d43[_0xe9a8('0x127')]({'model':db['Attachment'],'as':_0xe9a8('0xf6'),'raw':!![]});}var _0x596fa5=[{'model':db[_0xe9a8('0xe8')],'as':_0xe9a8('0x107'),'attributes':['id',_0xe9a8('0x3c'),_0xe9a8('0x137'),_0xe9a8('0x138'),_0xe9a8('0x112'),'read'],'include':_0xda4d43}];_0x596fa5[_0xe9a8('0x127')]({'model':db[_0xe9a8('0xd9')],'as':_0xe9a8('0x139'),'attributes':['id',_0xe9a8('0x39')]});_0x596fa5[_0xe9a8('0x127')]({'model':db['User'],'as':_0xe9a8('0x13a'),'attributes':['id',_0xe9a8('0x41')]});return db[_0xe9a8('0x50')][_0xe9a8('0x86')]({'where':{'id':_0xcb3441['params']['id']},'include':_0x596fa5})[_0xe9a8('0x36')](handleEntityNotFound(_0x51c27,null))[_0xe9a8('0x36')](function(_0x236585){if(_0x236585){var _0x284f48=_0x236585[_0xe9a8('0x13b')]({'plain':!![]});fs[_0xe9a8('0x13c')](_0x59f640);var _0x5a097f={'channel':_0xe9a8('0x13d'),'account':_0x284f48[_0xe9a8('0x139')][_0xe9a8('0x39')],'agent':_0x284f48[_0xe9a8('0x13a')]?_0x284f48[_0xe9a8('0x13a')]['fullname']:_0xe9a8('0x13e'),'createdAt':moment(_0x284f48['createdAt'])[_0xe9a8('0x103')](_0xe9a8('0x124'))['toString'](),'closedAt':_0x284f48[_0xe9a8('0x4b')]?moment(_0x284f48[_0xe9a8('0x13f')])[_0xe9a8('0x103')](_0xe9a8('0x124'))[_0xe9a8('0xb5')]():'','disposition':_0x284f48[_0xe9a8('0x4d')],'chatInfo':{'browser':_0x284f48[_0xe9a8('0x140')],'os':_0x284f48[_0xe9a8('0x141')],'referer':_0x284f48['referer'],'customerIp':_0x284f48[_0xe9a8('0x142')],'customerPort':_0x284f48[_0xe9a8('0x143')]?_0x284f48[_0xe9a8('0x143')]:_0xe9a8('0x13e')},'messages':_(_0x284f48[_0xe9a8('0x107')])[_0xe9a8('0x144')]()[_0xe9a8('0xa0')]({'secret':![]})[_0xe9a8('0x40')](function(_0x2c5619){if(_0x2c5619[_0xe9a8('0xf6')]){var _0x30728f=path['join'](_0x5ad405,_0x2c5619[_0xe9a8('0xf6')][_0xe9a8('0xf3')]);if(fs[_0xe9a8('0x145')](_0x30728f)){fs['createReadStream'](_0x30728f)['pipe'](fs['createWriteStream'](path['join'](_0x59f640,_0x2c5619[_0xe9a8('0xf6')][_0xe9a8('0xf3')])));}}return{'date':moment(_0x2c5619[_0xe9a8('0x137')])[_0xe9a8('0x103')](_0xe9a8('0x124'))[_0xe9a8('0xb5')](),'sender':_0x2c5619[_0xe9a8('0x138')]==='out'?_0x2c5619[_0xe9a8('0x8d')]?_0x2c5619['User']['fullname']:'System':_0x2c5619['Contact'][_0xe9a8('0x135')]+(_0x2c5619[_0xe9a8('0x7e')][_0xe9a8('0x136')]?'\x20'+_0x2c5619[_0xe9a8('0x7e')]['lastName']:''),'body':_0x2c5619['Attachment']?_0x2c5619[_0xe9a8('0xf6')]['basename']:_0x2c5619['body'],'direction':_0x2c5619[_0xe9a8('0x138')]===_0xe9a8('0xe7')?'A':'C','secret':_0x2c5619[_0xe9a8('0x112')],'read':_0x2c5619['read'],'attachment':_0x2c5619[_0xe9a8('0xf6')]};})['value']()};return ejs[_0xe9a8('0x146')](path[_0xe9a8('0xfb')](config[_0xe9a8('0x101')],_0xe9a8('0x130'),_0xe9a8('0x147'),'downloadInteraction.ejs'),{'interaction':_0x5a097f})['then'](function(_0x21b678){var _0x9ca001=path[_0xe9a8('0xfb')](_0x59f640,_0xe9a8('0x148')+_0x284f48['id']+'-'+_0x1ce0c2+_0xe9a8('0x149'));var _0x460369={'path':_0x9ca001,'channel':_0xe9a8('0x13d'),'interactionId':_0x284f48['id']};return pdf[_0xe9a8('0x14a')](_0x21b678,_0x460369);})['then'](function(){return new BPromise(function(_0x3b5347,_0x3f241e){zipdir(_0x59f640,{'saveTo':_0x20c837},function(_0x2ef9f2,_0x51fc2e){if(_0x2ef9f2)return _0x3f241e(_0x2ef9f2);return _0x3b5347(_0x51fc2e);});})['then'](function(){return new BPromise(function(_0x3ba0e8,_0x34e1ed){rimraf(_0x59f640,function(_0x3aedb1){if(_0x3aedb1)_0x34e1ed(_0x3aedb1);return _0x3ba0e8();});});})['then'](function(){return _0x51c27[_0xe9a8('0xfe')](_0x20c837,_0x4b9988,function(_0x42bdac){if(_0x42bdac){console[_0xe9a8('0x14b')](_0xe9a8('0x14c'),_0x42bdac);}else{fs['unlinkSync'](_0x20c837);}});});});}else{return _0x51c27['sendStatus'](0xc8);}})[_0xe9a8('0x2a')](handleError(_0x51c27,null));}; \ No newline at end of file +var _0x5b0e=['user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','keyBy','a.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','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','toString','groupBy','all','rows','catch','params','ChatInteraction','includeAll','include','options','describe','createVidaooSession','ChatWebsite','findOne','vidaooEscalation','vidaooNote','vidaooMetadata','vidaooApiKey','email','vidaooTopic','isNull','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','create','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','now','Messages','%s%d','agentAlias','System','customer','agentIdentifier','website_alias','agent_fullname','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','rawAttributes','sort','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','includeAgent','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','Account','Owner','get','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','createReadStream','createWriteStream','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Chat','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','reject','save','update','destroy','name','render','merge','contact','interaction','account','Users','map','fullname','TagIds','forEach','Tags','push','waiting','talking','answered','unmanaged','abandoned','total','UserId','disposition','index','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','a.id\x20=\x20i.ChatWebsiteId','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','split','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?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','body','some','isEmpty','where','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL'];(function(_0x256d89,_0xa985b6){var _0x512aa9=function(_0x46b0d3){while(--_0x46b0d3){_0x256d89['push'](_0x256d89['shift']());}};_0x512aa9(++_0xa985b6);}(_0x5b0e,0x1c8));var _0xe5b0=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x5b0e[_0x48d6a3];return _0x38bfa0;};'use strict';var emlformat=require(_0xe5b0('0x0'));var rimraf=require(_0xe5b0('0x1'));var zipdir=require(_0xe5b0('0x2'));var jsonpatch=require(_0xe5b0('0x3'));var rp=require(_0xe5b0('0x4'));var moment=require(_0xe5b0('0x5'));var BPromise=require(_0xe5b0('0x6'));var Mustache=require(_0xe5b0('0x7'));var util=require('util');var path=require(_0xe5b0('0x8'));var sox=require('sox');var csv=require(_0xe5b0('0x9'));var ejs=require(_0xe5b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe5b0('0xb'));var _=require(_0xe5b0('0xc'));var squel=require(_0xe5b0('0xd'));var crypto=require(_0xe5b0('0xe'));var jsforce=require(_0xe5b0('0xf'));var deskjs=require(_0xe5b0('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe5b0('0x11'));var Redis=require(_0xe5b0('0x12'));var authService=require(_0xe5b0('0x13'));var qs=require(_0xe5b0('0x14'));var as=require(_0xe5b0('0x15'));var pdf=require(_0xe5b0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5b0('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xe5b0('0x18'));var licenseUtil=require(_0xe5b0('0x19'));var db=require('../../mysqldb')['db'];config[_0xe5b0('0x1a')]=_[_0xe5b0('0x1b')](config[_0xe5b0('0x1a')],{'host':_0xe5b0('0x1c'),'port':0x18eb});var socket=require(_0xe5b0('0x1d'))(new Redis(config[_0xe5b0('0x1a')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xe5b0('0x1e'));var client=jayson[_0xe5b0('0x1f')][_0xe5b0('0x20')]({'port':0x232b});var client9004=jayson[_0xe5b0('0x1f')][_0xe5b0('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x26a67a,_0x3caa8f,_0x6be859,_0x42a71a){return new BPromise(function(_0x22067b,_0x1972f3){var _0x45b2a2=_0x42a71a||client;return _0x45b2a2[_0xe5b0('0x21')](_0x26a67a,_0x6be859)[_0xe5b0('0x22')](function(_0x1f598c){logger[_0xe5b0('0x23')](_0xe5b0('0x24'),_0x3caa8f,_0xe5b0('0x25'));logger[_0xe5b0('0x26')](_0xe5b0('0x27'),_0x3caa8f,_0xe5b0('0x25'),JSON['stringify'](_0x1f598c));if(_0x1f598c[_0xe5b0('0x28')]){if(_0x1f598c[_0xe5b0('0x28')][_0xe5b0('0x29')]===0x1f4){logger['error'](_0xe5b0('0x24'),_0x3caa8f,_0x1f598c[_0xe5b0('0x28')][_0xe5b0('0x2a')]);return _0x1972f3(_0x1f598c['error'][_0xe5b0('0x2a')]);}logger[_0xe5b0('0x28')](_0xe5b0('0x24'),_0x3caa8f,_0x1f598c[_0xe5b0('0x28')][_0xe5b0('0x2a')]);return _0x22067b(_0x1f598c['error']['message']);}else{logger[_0xe5b0('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x3caa8f,'request\x20sent');_0x22067b(_0x1f598c[_0xe5b0('0x2b')][_0xe5b0('0x2a')]);}})['catch'](function(_0x3935ad){logger[_0xe5b0('0x28')](_0xe5b0('0x24'),_0x3caa8f,_0x3935ad);_0x1972f3(_0x3935ad);});});}function respondWithStatusCode(_0x4bcc15,_0x470895){_0x470895=_0x470895||0xcc;return function(_0x59f578){if(_0x59f578){return _0x4bcc15[_0xe5b0('0x2c')](_0x470895);}return _0x4bcc15[_0xe5b0('0x2d')](_0x470895)[_0xe5b0('0x2e')]();};}function respondWithResult(_0xc31e2d,_0x438346){_0x438346=_0x438346||0xc8;return function(_0x479211){if(_0x479211){return _0xc31e2d[_0xe5b0('0x2d')](_0x438346)['json'](_0x479211);}};}function respondWithFilteredResult(_0x5ac69e,_0x18c108){return function(_0x3a6b4e){if(_0x3a6b4e){var _0x1c5937=typeof _0x18c108['offset']===_0xe5b0('0x2f')&&typeof _0x18c108[_0xe5b0('0x30')]===_0xe5b0('0x2f');var _0x3f9d09=_0x3a6b4e['count'];var _0x4c472d=_0x1c5937?0x0:_0x18c108[_0xe5b0('0x31')];var _0x449468=_0x1c5937?_0x3a6b4e[_0xe5b0('0x32')]:_0x18c108[_0xe5b0('0x31')]+_0x18c108[_0xe5b0('0x30')];var _0x5acdcf;if(_0x449468>=_0x3f9d09){_0x449468=_0x3f9d09;_0x5acdcf=0xc8;}else{_0x5acdcf=0xce;}_0x5ac69e[_0xe5b0('0x2d')](_0x5acdcf);return _0x5ac69e[_0xe5b0('0x33')](_0xe5b0('0x34'),_0x4c472d+'-'+_0x449468+'/'+_0x3f9d09)[_0xe5b0('0x35')](_0x3a6b4e);}return null;};}function patchUpdates(_0x126669){return function(_0x407a3e){try{jsonpatch['apply'](_0x407a3e,_0x126669,!![]);}catch(_0xaf184a){return BPromise[_0xe5b0('0x36')](_0xaf184a);}return _0x407a3e[_0xe5b0('0x37')]();};}function saveUpdates(_0x2f008d,_0x31399b){return function(_0x47e628){if(_0x47e628){return _0x47e628[_0xe5b0('0x38')](_0x2f008d)[_0xe5b0('0x22')](function(_0x55186e){return _0x55186e;});}return null;};}function removeEntity(_0x2b6b87,_0x159e9d){return function(_0x2cb45b){if(_0x2cb45b){return _0x2cb45b[_0xe5b0('0x39')]()['then'](function(){_0x2b6b87[_0xe5b0('0x2d')](0xcc)[_0xe5b0('0x2e')]();});}};}function handleEntityNotFound(_0x33a133,_0x88a53e){return function(_0x1bd688){if(!_0x1bd688){_0x33a133[_0xe5b0('0x2c')](0x194);}return _0x1bd688;};}function handleError(_0x2313c8,_0x49febb){_0x49febb=_0x49febb||0x1f4;return function(_0x558a8c){logger[_0xe5b0('0x28')](_0x558a8c['stack']);if(_0x558a8c['name']){delete _0x558a8c[_0xe5b0('0x3a')];}_0x2313c8['status'](_0x49febb)['send'](_0x558a8c);};}function getMustacheRender(_0xb17b5c,_0x12482a){return Mustache[_0xe5b0('0x3b')](_0xb17b5c,_[_0xe5b0('0x3c')](_0x12482a['body'],{'contact':_0x12482a[_0xe5b0('0x3d')],'message':_0x12482a[_0xe5b0('0x2a')],'agent':_0x12482a['agent'],'interaction':_0x12482a[_0xe5b0('0x3e')],'account':_0x12482a[_0xe5b0('0x3f')]}))||'';}function getInteractionUsers(_0x51478c,_0x431b49){return new BPromise(function(_0x501bf0,_0x2f5765){try{if(_0x431b49[_0x51478c['id']]){_0x51478c[_0xe5b0('0x40')]=_[_0xe5b0('0x41')](_0x431b49[_0x51478c['id']],function(_0x1ba63c){return{'id':_0x1ba63c['id'],'fullname':_0x1ba63c[_0xe5b0('0x42')]};});}}catch(_0x248802){_0x2f5765(_0x248802);}_0x501bf0(_0x51478c);});}function getInteractionTags(_0x2f8a7c,_0x1ae24b){return new BPromise(function(_0x53c130,_0x3fdebd){try{if(_0x2f8a7c[_0xe5b0('0x43')]){_0x2f8a7c['Tags']=[];_0x2f8a7c[_0xe5b0('0x43')]['split'](',')[_0xe5b0('0x44')](function(_0x5249f5){_0x2f8a7c[_0xe5b0('0x45')][_0xe5b0('0x46')](_0x1ae24b[_0x5249f5]);});}delete _0x2f8a7c[_0xe5b0('0x43')];}catch(_0x1a1fe4){_0x3fdebd(_0x1a1fe4);}_0x53c130(_0x2f8a7c);});}function updateChatInteraction(_0x9fd673,_0x587e8a,_0xa4162f){return new BPromise(function(_0x3383e9,_0x4532ce){return getInteractionUsers(_0x9fd673,_0xa4162f)[_0xe5b0('0x22')](function(_0x366d06){return getInteractionTags(_0x366d06,_0x587e8a);})[_0xe5b0('0x22')](function(_0x3fb75f){return getStateInteraction(_0x3fb75f);})[_0xe5b0('0x22')](function(_0x939c7e){_0x3383e9(_0x939c7e);})['catch'](function(_0x3f73bc){_0x4532ce(_0x3f73bc);});});}function getStateInteraction(_0x1ceb72){return new BPromise(function(_0xfd16db){_0x1ceb72[_0xe5b0('0x47')]=0x0;_0x1ceb72[_0xe5b0('0x48')]=0x0;_0x1ceb72[_0xe5b0('0x49')]=0x0;_0x1ceb72[_0xe5b0('0x4a')]=0x0;_0x1ceb72[_0xe5b0('0x4b')]=0x0;_0x1ceb72[_0xe5b0('0x4c')]=0x0;if(!_0x1ceb72['closed']&&!_0x1ceb72['UserId']){_0x1ceb72['waiting']+=0x1;}if(!_0x1ceb72['closed']&&_0x1ceb72[_0xe5b0('0x4d')]){_0x1ceb72[_0xe5b0('0x48')]+=0x1;if(_0x1ceb72[_0xe5b0('0x47')]){_0x1ceb72['waiting']-=0x1;}}if(_0x1ceb72['closed']&&_0x1ceb72[_0xe5b0('0x4e')]===_0xe5b0('0x4b')){_0x1ceb72[_0xe5b0('0x4b')]+=0x1;if(_0x1ceb72[_0xe5b0('0x47')]){_0x1ceb72[_0xe5b0('0x47')]-=0x1;}}else if(_0x1ceb72['closed']&&!_0x1ceb72['UserId']&&_0x1ceb72['disposition']){_0x1ceb72['unmanaged']+=0x1;if(_0x1ceb72['waiting']){_0x1ceb72['waiting']-=0x1;}}else if(_0x1ceb72['closed']&&_0x1ceb72['UserId']){_0x1ceb72[_0xe5b0('0x49')]+=0x1;if(_0x1ceb72[_0xe5b0('0x48')]){_0x1ceb72['talking']-=0x1;}}_0x1ceb72[_0xe5b0('0x4c')]+=0x1;_0xfd16db(_0x1ceb72);});}exports[_0xe5b0('0x4f')]=function(_0x1f957b,_0x59a3c6){var _0x1bb21d={},_0x273868={},_0x50e355={'count':0x0,'rows':[]};var _0x20b000=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x52e706){return{'name':_0x52e706[_0xe5b0('0x50')],'type':_0x52e706['type']['key']};});_0x273868['model']=_['map'](_0x20b000,_0xe5b0('0x3a'));_0x273868[_0xe5b0('0x51')]=_[_0xe5b0('0x52')](_0x1f957b[_0xe5b0('0x51')]);_0x273868[_0xe5b0('0x53')]=_[_0xe5b0('0x54')](_0x273868[_0xe5b0('0x55')],_0x273868[_0xe5b0('0x51')]);_0x1bb21d[_0xe5b0('0x56')]=_[_0xe5b0('0x54')](_0x273868[_0xe5b0('0x55')],qs[_0xe5b0('0x57')](_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0x57')]));_0x1bb21d['attributes']=_0x1bb21d[_0xe5b0('0x56')][_0xe5b0('0x58')]?_0x1bb21d[_0xe5b0('0x56')]:_0x273868['model'];if(!_0x1f957b['query'][_0xe5b0('0x59')](_0xe5b0('0x5a'))){_0x1bb21d[_0xe5b0('0x30')]=qs[_0xe5b0('0x30')](_0x1f957b[_0xe5b0('0x51')]['limit']);_0x1bb21d[_0xe5b0('0x31')]=qs['offset'](_0x1f957b['query'][_0xe5b0('0x31')]);}_0x1bb21d['order']=qs['sort'](_0x1f957b[_0xe5b0('0x51')]['sort']);_0x1bb21d['where']=qs[_0xe5b0('0x53')](_[_0xe5b0('0x5b')](_0x1f957b[_0xe5b0('0x51')],_0x273868[_0xe5b0('0x53')]),_0x20b000);var _0x204b9f=[];var _0x194d05=squel[_0xe5b0('0x5c')]()[_0xe5b0('0x5d')]('id')['field'](_0xe5b0('0x3a'))[_0xe5b0('0x5d')]('color')[_0xe5b0('0x5e')](_0xe5b0('0x5f'));var _0x45b74e=squel['select']()[_0xe5b0('0x5d')](_0xe5b0('0x60'))[_0xe5b0('0x5d')](_0xe5b0('0x61'))[_0xe5b0('0x5d')](_0xe5b0('0x62'))[_0xe5b0('0x5e')]('user_has_chat_interactions','ui')['left_join'](_0xe5b0('0x63'),'u','u.id\x20=\x20ui.UserId');var _0x2509ac=squel[_0xe5b0('0x5c')]()[_0xe5b0('0x5e')](_0xe5b0('0x64'),'i')['left_join'](_0xe5b0('0x65'),'c',_0xe5b0('0x66'))[_0xe5b0('0x67')](_0xe5b0('0x63'),'o',_0xe5b0('0x68'))[_0xe5b0('0x67')]('chat_websites','a',_0xe5b0('0x69'))[_0xe5b0('0x67')]('chat_messages','me','me.ChatInteractionId\x20=\x20i.id')[_0xe5b0('0x67')]('chat_interaction_has_tags','it',_0xe5b0('0x6a'))[_0xe5b0('0x67')]('tools_tags','t',_0xe5b0('0x6b'));var _0x1331ba=squel[_0xe5b0('0x6c')]();var _0x41c50c=[];var _0x214d25=squel[_0xe5b0('0x6c')]();var _0x581e1e;if(_0x1f957b[_0xe5b0('0x51')]['search']){_0x581e1e=as[_0xe5b0('0x6d')](_0x1f957b[_0xe5b0('0x51')]['search']);var _0x37948e=_0x581e1e[_0xe5b0('0x6e')];for(var _0x4e3f6f=0x0;_0x4e3f6f<_0x581e1e[_0xe5b0('0x6f')][_0xe5b0('0x58')];_0x4e3f6f++){var _0x24cee3=_0x581e1e[_0xe5b0('0x6f')][_0x4e3f6f];var _0x4e60c3='i';var _0x456d35=_[_0xe5b0('0x70')](_0x20b000,[_0xe5b0('0x3a'),_0x24cee3[_0xe5b0('0x5d')]]);if(!_0x456d35){switch(_0x24cee3[_0xe5b0('0x5d')]){case _0xe5b0('0x71'):if(_0x24cee3['value']==0x1){_0x2509ac['having']('`'+_0x24cee3[_0xe5b0('0x5d')]+'`\x20=\x200');}else{_0x2509ac[_0xe5b0('0x72')]('`'+_0x24cee3[_0xe5b0('0x5d')]+_0xe5b0('0x73'));}break;case _0xe5b0('0x74'):if(_0x24cee3[_0xe5b0('0x75')]===_0xe5b0('0x76')){if(_0x24cee3[_0xe5b0('0x77')][_0xe5b0('0x78')]('\x20')[_0xe5b0('0x58')]>0x1){_0x1331ba[_0x37948e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xe5b0('0x79')](_0x24cee3[_0xe5b0('0x77')]),null);}else{var _0x50b15a='%'+_0x24cee3[_0xe5b0('0x77')]+'%';_0x1331ba[_0x37948e](_0xe5b0('0x7a'),_0x50b15a,_0x50b15a,_0x50b15a);}}else{_0x456d35=_['find'](_0x20b000,['name',_0xe5b0('0x7b')]);_0x24cee3[_0xe5b0('0x5d')]=_0xe5b0('0x7b');_0x21f686=as[_0xe5b0('0x7c')](_0x4e60c3,_0x456d35['type'],_0x24cee3);_0x1331ba[_0x37948e](_0x21f686[_0xe5b0('0x7d')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x7e')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x2e')]);}break;case _0xe5b0('0x7f'):var _0x4c39f0=_0x24cee3[_0xe5b0('0x77')][_0xe5b0('0x78')](',')[_0xe5b0('0x41')](function(_0x46db58){return Number(_0x46db58);});_0x4c39f0[_0xe5b0('0x44')](function(_0x138182){_0x214d25['or'](_0xe5b0('0x80'),'%,'+_0x138182+',%');});_0x41c50c=_['union'](_0x41c50c,_0x4c39f0);break;case _0xe5b0('0x81'):if(_0x24cee3['operator']==='$substring'){_0x1331ba[_0x37948e](_0xe5b0('0x82'),'%'+_0x24cee3['value']+'%',null);}else{_0x456d35=_[_0xe5b0('0x70')](_0x20b000,[_0xe5b0('0x3a'),_0xe5b0('0x4d')]);_0x24cee3[_0xe5b0('0x5d')]='UserId';_0x21f686=as[_0xe5b0('0x7c')](_0x4e60c3,_0x456d35[_0xe5b0('0x83')],_0x24cee3);_0x1331ba[_0x37948e](_0x21f686[_0xe5b0('0x7d')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x7e')],_0x21f686['value']['end']);}break;case _0xe5b0('0x84'):_0x21f686=as[_0xe5b0('0x7c')]('me',null,_0x24cee3);_0x1331ba[_0x37948e](_0x21f686[_0xe5b0('0x7d')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x7e')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x2e')]);break;}}else{var _0x21f686=as[_0xe5b0('0x7c')](_0x4e60c3,_0x456d35[_0xe5b0('0x83')],_0x24cee3);_0x1331ba[_0x37948e](_0x21f686[_0xe5b0('0x7d')],_0x21f686['value'][_0xe5b0('0x7e')],_0x21f686[_0xe5b0('0x77')][_0xe5b0('0x2e')]);}}}else{var _0x488c06=_(_0x1f957b['query'])['keys']()['map'](function(_0x4f6f94){return _[_0xe5b0('0x85')](_0x20b000,[_0xe5b0('0x3a'),_0x4f6f94])?_0x4f6f94:undefined;})['compact']()[_0xe5b0('0x77')]();if(!_[_0xe5b0('0x86')](_0x488c06)){_0x488c06[_0xe5b0('0x44')](function(_0x407c5f){if(_0x407c5f==='ChatWebsiteId'){_0x2509ac[_0xe5b0('0x87')](_0xe5b0('0x88'),[]['concat'](_0x1f957b['query'][_0x407c5f]));}else if(_0x407c5f==='createdAt'){var _0x1564cb=JSON[_0xe5b0('0x89')](_0x1f957b[_0xe5b0('0x51')][_0x407c5f])[_0xe5b0('0x8a')];var _0x4cb23b=JSON['parse'](_0x1f957b[_0xe5b0('0x51')][_0x407c5f])[_0xe5b0('0x8b')];_0x2509ac[_0xe5b0('0x87')](_0xe5b0('0x8c'),_0x1564cb,_0x4cb23b);}else{if(_0x1f957b[_0xe5b0('0x51')][_0x407c5f]===_0xe5b0('0x8d')){_0x2509ac['where']('i.'+_0x407c5f+_0xe5b0('0x8e'));}else{_0x2509ac[_0xe5b0('0x87')]('i.'+_0x407c5f+_0xe5b0('0x8f'),_0x1f957b[_0xe5b0('0x51')][_0x407c5f]);}}});}if(_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0x90')]){if(_0x1f957b['query'][_0xe5b0('0x90')]==0x1){_0x2509ac[_0xe5b0('0x72')](_0xe5b0('0x91'));}else{_0x2509ac['having']('`unreadMessages`\x20>\x200');}}if(_0x1f957b['query'][_0xe5b0('0x92')]){_0x41c50c=_[_0xe5b0('0x93')](_0x1f957b['query']['tag'])?_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0x92')]:new Array(_0x1f957b['query'][_0xe5b0('0x92')]);_0x41c50c[_0xe5b0('0x44')](function(_0x5959a6){_0x214d25['or'](_0xe5b0('0x80'),'%,'+_0x5959a6+',%');});}if(_0x1f957b['query'][_0xe5b0('0x94')]){var _0x44d500=_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0x94')][_0xe5b0('0x95')]('\x5c','\x5c\x5c')[_0xe5b0('0x95')](/'/g,'\x27\x27');if(qs[_0xe5b0('0x96')](_0x44d500)){_0x1331ba['or'](_0xe5b0('0x97'),_0x44d500+'%');}else{_0x1331ba['or'](_0xe5b0('0x98'),qs[_0xe5b0('0x79')](_0x44d500))['or'](_0xe5b0('0x99'),_0x44d500+'%');}}}_0x2509ac[_0xe5b0('0x87')](_0x1331ba);_0x2509ac['group'](_0xe5b0('0x9a'));var _0x52e941={'type':db[_0xe5b0('0x9b')]['QueryTypes'][_0xe5b0('0x9c')],'raw':!![]};var _0x56add6=_0x2509ac[_0xe5b0('0x9d')]();_0x56add6[_0xe5b0('0x5d')](_0xe5b0('0x9a'));_0x56add6[_0xe5b0('0x5d')](_0xe5b0('0x9e'),'unreadMessages');if(_0x1bb21d[_0xe5b0('0x9f')]){_0x1bb21d['order'][_0xe5b0('0x44')](function(_0x45b623){var _0x329d2e=_0x45b623[0x0]===_0xe5b0('0xa0')?_0x45b623[0x0]:'i.'+_0x45b623[0x0];_0x2509ac[_0xe5b0('0x9f')](_0x329d2e,_0x45b623[0x1]===_0xe5b0('0xa1')?![]:!![]);});}if(!_[_0xe5b0('0x86')](_0x41c50c)){_0x2509ac[_0xe5b0('0x72')](_0x214d25);_0x56add6['where'](_0xe5b0('0xa2'),_0x41c50c);}BPromise[_0xe5b0('0xa3')]()[_0xe5b0('0x22')](function(){if(!_0x581e1e){if(_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0xa4')])return;_0x56add6[_0xe5b0('0x87')](_0xe5b0('0xa5'));_0x2509ac[_0xe5b0('0x87')](_0xe5b0('0xa5'));return;}if(_0x1f957b[_0xe5b0('0xa6')][_0xe5b0('0xa7')]!==_0xe5b0('0xa8'))return;return _0x1f957b[_0xe5b0('0xa6')][_0xe5b0('0xa9')]({'attributes':['id'],'raw':!![]})['then'](function(_0x415542){if(_['isEmpty'](_0x415542)){_0x56add6[_0xe5b0('0x87')](_0xe5b0('0xaa'));_0x2509ac[_0xe5b0('0x87')](_0xe5b0('0xaa'));}else{_0x56add6['where']('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x415542,'id'));_0x2509ac['where'](_0xe5b0('0x88'),_[_0xe5b0('0x41')](_0x415542,'id'));}});})[_0xe5b0('0x22')](function(){if(_0x1f957b['user'][_0xe5b0('0xa7')]===_0xe5b0('0xa8')&&!_0x581e1e&&!_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0xa4')])return[];return db[_0xe5b0('0xab')][_0xe5b0('0x51')](_0x56add6['toString'](),_0x52e941);})[_0xe5b0('0x22')](function(_0x5171c1){_0x50e355['count']=_0x5171c1[_0xe5b0('0x58')];if(_0x50e355[_0xe5b0('0x32')]===0x0)return[];return db['sequelize'][_0xe5b0('0x51')](_0x194d05['toString'](),_0x52e941)['then'](function(_0x2d062a){_0x204b9f=_[_0xe5b0('0xac')](_0x2d062a,'id');_0x52e941=_[_0xe5b0('0x3c')](_0x52e941,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f957b[_0xe5b0('0x51')][_0xe5b0('0x57')]){_0x1bb21d['attributes'][_0xe5b0('0x44')](function(_0x57e64f){_0x2509ac[_0xe5b0('0x5d')]('i.'+_0x57e64f);});}else{_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0x9e'),_0xe5b0('0x71'));_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xad'),'Account.key');_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xae'),'Account.mandatoryDisposition');_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xaf'),_0xe5b0('0xa0'));_0x2509ac['field']('i.*');_0x2509ac[_0xe5b0('0x5d')]('c.firstName',_0xe5b0('0xb0'));_0x2509ac['field'](_0xe5b0('0xb1'),'Contact.lastName');_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xb2'),_0xe5b0('0xb3'));_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xb4'),'Contact.phone');_0x2509ac['field'](_0xe5b0('0xb5'),_0xe5b0('0xb6'));_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xb7'),_0xe5b0('0xb8'));_0x2509ac['field'](_0xe5b0('0xb9'),'Owner.fullname');_0x2509ac[_0xe5b0('0x5d')]('o.internal',_0xe5b0('0xba'));_0x2509ac[_0xe5b0('0x5d')](_0xe5b0('0xbb'),'TagIds');}if(_0x1bb21d[_0xe5b0('0x30')])_0x2509ac[_0xe5b0('0x30')](_0x1bb21d[_0xe5b0('0x30')]);if(_0x1bb21d['offset'])_0x2509ac[_0xe5b0('0x31')](_0x1bb21d['offset']);return db[_0xe5b0('0xab')][_0xe5b0('0x51')](_0x2509ac['toString'](),_0x52e941);})[_0xe5b0('0x22')](function(_0x2759c2){if(_0x2759c2[_0xe5b0('0x58')]>0x0)_0x45b74e[_0xe5b0('0x87')](_0xe5b0('0xbc'),_[_0xe5b0('0x41')](_0x2759c2,'id'));return db['sequelize']['query'](_0x45b74e[_0xe5b0('0xbd')](),_0x52e941)[_0xe5b0('0x22')](function(_0x21ca78){var _0x5f2475=_[_0xe5b0('0xbe')](_0x21ca78,'ChatInteractionId');var _0x3f9a00=[];_0x2759c2[_0xe5b0('0x44')](function(_0xbc72f4){_0x3f9a00[_0xe5b0('0x46')](updateChatInteraction(_0xbc72f4,_0x204b9f,_0x5f2475));});return BPromise[_0xe5b0('0xbf')](_0x3f9a00);});});})[_0xe5b0('0x22')](function(_0x4e483d){_0x50e355[_0xe5b0('0xc0')]=_0x4e483d;return _0x50e355;})['then'](respondWithFilteredResult(_0x59a3c6,_0x1bb21d))[_0xe5b0('0xc1')](handleError(_0x59a3c6,null));};exports['show']=function(_0x3f5788,_0x3503c4){var _0x263dad={'raw':![],'where':{'id':_0x3f5788[_0xe5b0('0xc2')]['id']}},_0x256e34={};_0x256e34['model']=_[_0xe5b0('0x52')](db[_0xe5b0('0xc3')]['rawAttributes']);_0x256e34[_0xe5b0('0x51')]=_[_0xe5b0('0x52')](_0x3f5788[_0xe5b0('0x51')]);_0x256e34[_0xe5b0('0x53')]=_[_0xe5b0('0x54')](_0x256e34[_0xe5b0('0x55')],_0x256e34[_0xe5b0('0x51')]);_0x263dad['attributes']=_[_0xe5b0('0x54')](_0x256e34[_0xe5b0('0x55')],qs['fields'](_0x3f5788['query'][_0xe5b0('0x57')]));_0x263dad[_0xe5b0('0x56')]=_0x263dad[_0xe5b0('0x56')][_0xe5b0('0x58')]?_0x263dad['attributes']:_0x256e34['model'];if(_0x3f5788['query'][_0xe5b0('0xc4')]){_0x263dad[_0xe5b0('0xc5')]=[{'all':!![]}];}_0x263dad=_['merge']({},_0x263dad,_0x3f5788[_0xe5b0('0xc6')]);return db['ChatInteraction'][_0xe5b0('0x70')](_0x263dad)[_0xe5b0('0x22')](handleEntityNotFound(_0x3503c4,null))[_0xe5b0('0x22')](respondWithResult(_0x3503c4,null))[_0xe5b0('0xc1')](handleError(_0x3503c4,null));};exports['create']=function(_0x25d539,_0x9e53af){return db[_0xe5b0('0xc3')]['create'](_0x25d539[_0xe5b0('0x84')],{})[_0xe5b0('0x22')](respondWithResult(_0x9e53af,0xc9))['catch'](handleError(_0x9e53af,null));};exports[_0xe5b0('0x38')]=function(_0x458bde,_0x3baa56){if(_0x458bde[_0xe5b0('0x84')]['id']){delete _0x458bde['body']['id'];}return db['ChatInteraction'][_0xe5b0('0x70')]({'where':{'id':_0x458bde[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x3baa56,null))[_0xe5b0('0x22')](saveUpdates(_0x458bde[_0xe5b0('0x84')],null))[_0xe5b0('0x22')](respondWithResult(_0x3baa56,null))[_0xe5b0('0xc1')](handleError(_0x3baa56,null));};exports[_0xe5b0('0x39')]=function(_0x11e843,_0x28da1d){return db['ChatInteraction'][_0xe5b0('0x70')]({'where':{'id':_0x11e843[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x28da1d,null))[_0xe5b0('0x22')](removeEntity(_0x28da1d,null))['catch'](handleError(_0x28da1d,null));};exports[_0xe5b0('0xc7')]=function(_0x2d1373,_0x214611){return db['ChatInteraction'][_0xe5b0('0xc7')]()[_0xe5b0('0x22')](respondWithResult(_0x214611,null))['catch'](handleError(_0x214611,null));};exports[_0xe5b0('0xc8')]=function(_0x42af85,_0x353713){var _0x54e34c=_0x42af85['params']['id'];var _0x55a346;var _0x2f784a;var _0x409204;return db[_0xe5b0('0xc3')]['findOne']({'where':{'id':_0x54e34c}})[_0xe5b0('0x22')](function(_0x4a298b){_0x55a346=_0x4a298b;return db[_0xe5b0('0xc9')][_0xe5b0('0xca')]({'where':{'id':_0x4a298b[_0xe5b0('0xa4')]},'attributes':['id','vidaooApiKey',_0xe5b0('0xcb'),'vidaooTopic',_0xe5b0('0xcc'),_0xe5b0('0xcd')],'raw':!![]});})[_0xe5b0('0x22')](function(_0x5cd17c){if(_0x5cd17c&&_0x5cd17c[_0xe5b0('0xce')]&&_0x5cd17c[_0xe5b0('0xcb')]){_0x2f784a=_0x5cd17c;var _0x2d24a4={'interaction':{'id':_0x54e34c},'agent':{'id':_0x42af85[_0xe5b0('0xa6')]['id'],'name':_0x42af85['user']['name'],'fullname':_0x42af85[_0xe5b0('0xa6')][_0xe5b0('0x42')],'email':_0x42af85[_0xe5b0('0xa6')][_0xe5b0('0xcf')]},'contact':_0x42af85['body'][_0xe5b0('0x3d')],'account':_0x42af85[_0xe5b0('0x84')][_0xe5b0('0x3f')]};var _0x5327df={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x5cd17c[_0xe5b0('0xce')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x42af85['user'][_0xe5b0('0xcf')]],'buttons':null,'topic':_0x2f784a[_0xe5b0('0xd0')],'note':_[_0xe5b0('0xd1')](_0x2f784a['vidaooNote'])?null:getMustacheRender(_0x2f784a[_0xe5b0('0xcc')],_0x2d24a4),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe5b0('0xd1')](_0x2f784a[_0xe5b0('0xcd')])){var _0xa0fd11=getMustacheRender(_0x2f784a['vidaooMetadata'],_0x2d24a4);var _0x456eae=JSON[_0xe5b0('0x89')](_0xa0fd11);_0x5327df['body'][_0xe5b0('0xd2')]=_0x456eae;}}catch(_0x4666da){throw new db['Sequelize']['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x5327df);}else{throw new db['Sequelize'][(_0xe5b0('0xd3'))](_0xe5b0('0xd4'));}})[_0xe5b0('0x22')](function(_0xb2c36d){_0x409204=_0xb2c36d;if(_0x409204['id']){var _0x24fdf5={'body':_0x409204['join_url'],'ChatWebsiteId':_0x2f784a['id'],'ChatInteractionId':_0x55a346['id'],'direction':_0xe5b0('0xd5'),'UserId':_0x42af85[_0xe5b0('0xa6')]['id']};return db[_0xe5b0('0xd6')][_0xe5b0('0xd7')](_0x24fdf5,{});}else{throw new db[(_0xe5b0('0x9b'))][(_0xe5b0('0xd3'))](_0xe5b0('0xd8'));}})[_0xe5b0('0x22')](function(){return _0x55a346['updateAttributes']({'vidaooSessionId':_0x409204['id']});})[_0xe5b0('0x22')](respondWithResult(_0x353713,null))[_0xe5b0('0xc1')](handleError(_0x353713,null));};exports[_0xe5b0('0xd9')]=function(_0x5975a5,_0x2b6b05){if(_0x5975a5[_0xe5b0('0x84')]['id']){delete _0x5975a5[_0xe5b0('0x84')]['id'];}return db['ChatInteraction'][_0xe5b0('0x70')]({'where':{'id':_0x5975a5[_0xe5b0('0xc2')]['id']},'include':[{'model':db[_0xe5b0('0xda')],'as':'Contact'}]})[_0xe5b0('0x22')](handleEntityNotFound(_0x2b6b05,null))['then'](saveUpdates(_0x5975a5['body'],null))[_0xe5b0('0x22')](respondWithResult(_0x2b6b05,null))[_0xe5b0('0xc1')](handleError(_0x2b6b05,null));};exports[_0xe5b0('0xdb')]=function(_0x30af3e,_0x32d719,_0x4616b2){if(_0x30af3e[_0xe5b0('0x84')]['id']){delete _0x30af3e[_0xe5b0('0x84')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x30af3e['params']['id']}})[_0xe5b0('0x22')](function(_0x3d65c8){if(!_0x3d65c8){logger['error'](_0xe5b0('0xdc'),_0xe5b0('0xdb'),0x194,'entity\x20not\x20found');_0x32d719[_0xe5b0('0x2c')](0x194);}else{if(_0x3d65c8[_0xe5b0('0x4d')]){throw new db[(_0xe5b0('0x9b'))]['ValidationError'](_0xe5b0('0xdd'));}}return _0x3d65c8;})[_0xe5b0('0x22')](function(_0x107156){if(_0x107156){return _0x107156[_0xe5b0('0x38')]({'closed':_0x30af3e[_0xe5b0('0x84')][_0xe5b0('0xde')],'disposition':_0x30af3e[_0xe5b0('0x84')][_0xe5b0('0x4e')]})[_0xe5b0('0x22')](function(_0x25be33){return _0x25be33;});}})[_0xe5b0('0x22')](function(_0x348243){return respondWithRpcPromise('AbandonInteraction',_0xe5b0('0xdb'),_0x30af3e[_0xe5b0('0x84')],client9004);})[_0xe5b0('0x22')](respondWithResult(_0x32d719,null))[_0xe5b0('0xc1')](handleError(_0x32d719,null));};exports[_0xe5b0('0xdf')]=function(_0x4b569,_0x586093,_0x3f79a1){_0x4b569[_0xe5b0('0x84')][_0xe5b0('0x3a')]=_0x4b569[_0xe5b0('0xe0')][_0xe5b0('0xe1')];_0x4b569['body'][_0xe5b0('0xe2')]=_0x4b569[_0xe5b0('0xe0')][_0xe5b0('0xe3')];_0x4b569[_0xe5b0('0x84')][_0xe5b0('0x83')]=_0x4b569['file'][_0xe5b0('0xe4')];return db[_0xe5b0('0xe5')][_0xe5b0('0xd7')](_0x4b569[_0xe5b0('0x84')])[_0xe5b0('0x22')](respondWithResult(_0x586093,0xc9))[_0xe5b0('0xc1')](handleError(_0x586093,null));};exports[_0xe5b0('0xe6')]=function(_0x5b3125,_0x3f86a4,_0x445de8){return db[_0xe5b0('0xc3')][_0xe5b0('0xca')]({'where':{'id':_0x5b3125[_0xe5b0('0xc2')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3f86a4,null))[_0xe5b0('0x22')](function(_0x1a1c86){if(_0x1a1c86){if(_0x1a1c86['closed']){return _0x3f86a4['status'](0x193)[_0xe5b0('0x35')]({'status':0x193,'message':_0xe5b0('0xe7')});}return db[_0xe5b0('0xe5')]['findOne']({'where':{'id':_0x5b3125[_0xe5b0('0x51')][_0xe5b0('0xe8')]},'raw':!![]})[_0xe5b0('0x22')](handleEntityNotFound(_0x3f86a4,null));}})[_0xe5b0('0x22')](function(_0x103002){if(_0x103002){var _0x207131=_0x103002['ChatOfflineMessageId']!==null;var _0x33fb08=path[_0xe5b0('0xe9')](config[_0xe5b0('0xea')],'server/files/attachments/');if(_0x207131){_0x33fb08=path['join'](_0x33fb08,_0xe5b0('0xeb'));}var _0x24a809=path[_0xe5b0('0xe9')](_0x33fb08,_0x103002[_0xe5b0('0xe2')]);return _0x3f86a4[_0xe5b0('0xec')](_0x24a809);}})[_0xe5b0('0xc1')](handleError(_0x3f86a4,null));};exports['close']=function(_0x10b13d,_0x2356a4){var _0x3f1f85=null;var _0x1fe8c2=null;var _0x1d1ea6=null;var _0x53563e=null;if(_0x10b13d[_0xe5b0('0x84')]['id']){delete _0x10b13d[_0xe5b0('0x84')]['id'];}if(_0x10b13d[_0xe5b0('0x84')][_0xe5b0('0xed')]){_0x53563e=path['join'](config[_0xe5b0('0xea')],_0xe5b0('0xee'),util[_0xe5b0('0xef')]('transcript-%s.txt',Date[_0xe5b0('0xf0')]()));_0x10b13d[_0xe5b0('0x84')]['pathTranscript']=_0x53563e;}return db[_0xe5b0('0xc3')][_0xe5b0('0x70')]({'where':{'id':_0x10b13d[_0xe5b0('0xc2')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xe5b0('0xf1'),'include':[{'model':db['User'],'as':_0xe5b0('0x81')}]}]})['then'](handleEntityNotFound(_0x2356a4,null))[_0xe5b0('0x22')](saveUpdates(_0x10b13d['body'],null))[_0xe5b0('0x22')](function(_0xe1e921){if(_0xe1e921){_0x3f1f85=_0xe1e921;return db[_0xe5b0('0xc9')][_0xe5b0('0x70')]({'where':{'id':_0x3f1f85[_0xe5b0('0xa4')]}});}})[_0xe5b0('0x22')](function(_0x28255f){if(_0x28255f){_0x1d1ea6=_0x28255f;return db[_0xe5b0('0xda')][_0xe5b0('0x70')]({'where':{'id':_0x3f1f85[_0xe5b0('0x7b')]}});}})['then'](function(_0x4cb93b){if(_0x4cb93b){_0x1fe8c2=_0x4cb93b;if(_0x53563e){var _0xdb3b1d=null;for(var _0x3dd72a=0x1;_0x3dd72a<_0x3f1f85['Messages']['length'];++_0x3dd72a){_0xdb3b1d=_0x3f1f85[_0xe5b0('0xf1')][_0x3dd72a];var _0x2a2301=_0xdb3b1d[_0xe5b0('0x4d')]?util[_0xe5b0('0xef')](_0xe5b0('0xf2'),_0x1d1ea6[_0xe5b0('0xf3')],_0xdb3b1d[_0xe5b0('0x4d')]):_0xe5b0('0xf4');var _0x140d07=_0x10b13d[_0xe5b0('0x84')][_0xe5b0('0xf5')]||util['format'](_0xe5b0('0xf2'),'Visitor',_0xdb3b1d[_0xe5b0('0x7b')]);switch(_0x1d1ea6[_0xe5b0('0xf6')]){case _0xe5b0('0xf7'):_0x2a2301=_0xdb3b1d[_0xe5b0('0x4d')]?util['format'](_0xe5b0('0xf2'),_0x1d1ea6[_0xe5b0('0xf3')],_0xdb3b1d['UserId']):_0xe5b0('0xf4');break;case'agent_alias':_0x2a2301=_0xdb3b1d[_0xe5b0('0x4d')]?_0xdb3b1d[_0xe5b0('0x81')]['alias']||_0xdb3b1d['User'][_0xe5b0('0x42')]:_0xe5b0('0xf4');break;case _0xe5b0('0xf8'):_0x2a2301=_0xdb3b1d[_0xe5b0('0x4d')]?_0xdb3b1d['User'][_0xe5b0('0x42')]:_0xe5b0('0xf4');break;default:_0x2a2301=_0xdb3b1d['UserId']?util[_0xe5b0('0xef')]('%s%d',_0x1d1ea6['agentAlias'],_0xdb3b1d[_0xe5b0('0x4d')]):_0xe5b0('0xf4');}var _0x50bf21=util[_0xe5b0('0xef')]('[%s]\x20%s:\x20%s\x0a',moment(_0xdb3b1d['createdAt'])[_0xe5b0('0xef')]('MM/DD/YYYY\x20HH:mm:ss'),_0xdb3b1d[_0xe5b0('0xf9')]==='in'?_0x140d07:_0x2a2301,_0xdb3b1d['body']);if(!_0xdb3b1d[_0xe5b0('0xfa')]){fs[_0xe5b0('0xfb')](_0x53563e,_0x50bf21);}}return db[_0xe5b0('0xfc')][_0xe5b0('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0xe5b0('0xfd')],'as':_0xe5b0('0xfe'),'raw':!![]}]});}}})[_0xe5b0('0x22')](function(_0x5c19d){if(_0x5c19d&&_0x5c19d[_0xe5b0('0xfe')]&&_0x10b13d['body']){var _0x54cab7={'tls':{'rejectUnauthorized':![]}};if(_0x5c19d[_0xe5b0('0xfe')]['service']){_0x54cab7['service']=_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0xff')];}else{_0x54cab7['host']=_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0x100')];_0x54cab7[_0xe5b0('0x101')]=_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0x101')];_0x54cab7[_0xe5b0('0x102')]=_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0x102')];}if(_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0x103')]){_0x54cab7['auth']={'user':_0x5c19d['Smtp'][_0xe5b0('0xa6')],'pass':_0x5c19d[_0xe5b0('0xfe')][_0xe5b0('0x104')]};}return respondWithRpcPromise(_0xe5b0('0x105'),'sendMail',{'account':_0x54cab7,'message':{'from':util[_0xe5b0('0xef')](_0xe5b0('0x106'),_0x5c19d[_0xe5b0('0x3a')],_0x5c19d['email']||_0x5c19d[_0xe5b0('0xfe')]['user']),'to':_0x10b13d['body']['mailTranscript'],'subject':_0xe5b0('0x107'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10b13d['body']['mailTranscript']),'attachments':[{'path':_0x53563e}]}})[_0xe5b0('0x22')](function(){return _0x3f1f85;})[_0xe5b0('0xc1')](function(_0x5a19ca){console[_0xe5b0('0x28')](_0x5a19ca);});}else{return _0x3f1f85;}})['then'](respondWithStatusCode(_0x2356a4,0xc8))['catch'](handleError(_0x2356a4,null));};exports[_0xe5b0('0x108')]=function(_0x4eb85d,_0x481938,_0x4a5e99){return db[_0xe5b0('0xd6')][_0xe5b0('0x70')]({'where':{'id':_0x4eb85d[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x481938,null))[_0xe5b0('0x22')](function(_0x503df9){if(_0x503df9){return _0x503df9[_0xe5b0('0x108')](_0x4eb85d[_0xe5b0('0x84')][_0xe5b0('0x109')],_[_0xe5b0('0x10a')](_0x4eb85d['body'],[_0xe5b0('0x109'),'id'])||{});}})[_0xe5b0('0x22')](respondWithResult(_0x481938,null))[_0xe5b0('0xc1')](handleError(_0x481938,null));};exports[_0xe5b0('0x10b')]=function(_0x46dc75,_0x64876e,_0x31e3e9){var _0x1a9104={'raw':![],'where':{}};var _0x20bb2b={};var _0x496aed={'count':0x0,'rows':[]};return db[_0xe5b0('0xc3')][_0xe5b0('0xca')]({'where':{'id':_0x46dc75[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x64876e,null))[_0xe5b0('0x22')](function(_0x4c6456){if(_0x4c6456){_0x20bb2b[_0xe5b0('0x55')]=_[_0xe5b0('0x52')](db['ChatMessage'][_0xe5b0('0x10c')]);_0x20bb2b['query']=_[_0xe5b0('0x52')](_0x46dc75['query']);_0x20bb2b[_0xe5b0('0x53')]=_[_0xe5b0('0x54')](_0x20bb2b[_0xe5b0('0x55')],_0x20bb2b[_0xe5b0('0x51')]);_0x1a9104[_0xe5b0('0x56')]=_[_0xe5b0('0x54')](_0x20bb2b[_0xe5b0('0x55')],qs['fields'](_0x46dc75[_0xe5b0('0x51')]['fields']));_0x1a9104[_0xe5b0('0x56')]=_0x1a9104['attributes'][_0xe5b0('0x58')]?_0x1a9104[_0xe5b0('0x56')]:_0x20bb2b[_0xe5b0('0x55')];if(!_0x46dc75[_0xe5b0('0x51')][_0xe5b0('0x59')]('nolimit')){_0x1a9104['limit']=qs[_0xe5b0('0x30')](_0x46dc75['query'][_0xe5b0('0x30')]);_0x1a9104['offset']=qs[_0xe5b0('0x31')](_0x46dc75['query'][_0xe5b0('0x31')]);}_0x1a9104[_0xe5b0('0x9f')]=qs[_0xe5b0('0x10d')](_0x46dc75[_0xe5b0('0x51')][_0xe5b0('0x10d')]);_0x1a9104[_0xe5b0('0x87')]=qs[_0xe5b0('0x53')](_['pick'](_0x46dc75[_0xe5b0('0x51')],_0x20bb2b[_0xe5b0('0x53')]));_0x1a9104[_0xe5b0('0x87')][_0xe5b0('0x10e')]=_0x4c6456['id'];if(_0x46dc75[_0xe5b0('0x51')]['filter']){_0x1a9104[_0xe5b0('0x87')]=_[_0xe5b0('0x3c')](_0x1a9104[_0xe5b0('0x87')],{'$or':_[_0xe5b0('0x41')](_0x1a9104[_0xe5b0('0x56')],function(_0x10b257){var _0xc3b214={};_0xc3b214[_0x10b257]={'$like':'%'+_0x46dc75[_0xe5b0('0x51')][_0xe5b0('0x94')]+'%'};return _0xc3b214;})});}if(_0x46dc75[_0xe5b0('0x51')][_0xe5b0('0x8a')]){var _0x1290f1=_0x46dc75['query'][_0xe5b0('0x8a')][_0xe5b0('0x78')](',');var _0x47e253={};_0x47e253[_0x1290f1[0x0]]={'$gte':moment(_0x1290f1[0x1])[_0xe5b0('0xef')](_0xe5b0('0x10f'))};_0x1a9104[_0xe5b0('0x87')]=_[_0xe5b0('0x3c')](_0x1a9104[_0xe5b0('0x87')],_0x47e253);}_0x1a9104=_[_0xe5b0('0x3c')]({},_0x1a9104,_0x46dc75[_0xe5b0('0xc6')]);return db[_0xe5b0('0xd6')][_0xe5b0('0x32')]({'where':_0x1a9104[_0xe5b0('0x87')]})[_0xe5b0('0x22')](function(_0x21c0d4){_0x496aed[_0xe5b0('0x32')]=_0x21c0d4;if(_0x46dc75[_0xe5b0('0x51')][_0xe5b0('0xc4')]){_0x1a9104[_0xe5b0('0xc5')]=[{'all':!![]}];}return db[_0xe5b0('0xd6')][_0xe5b0('0x110')](_0x1a9104);})['then'](function(_0x9b4d11){_0x496aed[_0xe5b0('0xc0')]=_0x9b4d11;return _0x496aed;});}})['then'](respondWithFilteredResult(_0x64876e,_0x1a9104))[_0xe5b0('0xc1')](handleError(_0x64876e,null));};exports['getMyMessages']=function(_0x41970b,_0x3d65aa,_0x4e6b22){var _0x579dbd={'where':{}},_0x30c178={},_0x4b4f0d={'count':0x0,'rows':[]};return db[_0xe5b0('0xc3')]['findOne']({'where':{'id':_0x41970b[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x3d65aa,null))['then'](function(_0x3ae8ba){if(_0x3ae8ba){_0x30c178[_0xe5b0('0x55')]=_[_0xe5b0('0x52')](db[_0xe5b0('0xd6')][_0xe5b0('0x10c')]);_0x30c178[_0xe5b0('0x51')]=_['keys'](_0x41970b['query']);_0x30c178[_0xe5b0('0x53')]=_[_0xe5b0('0x54')](_0x30c178['model'],_0x30c178[_0xe5b0('0x51')]);_0x579dbd['attributes']=_['intersection'](_0x30c178[_0xe5b0('0x55')],qs[_0xe5b0('0x57')](_0x41970b[_0xe5b0('0x51')][_0xe5b0('0x57')]));_0x579dbd[_0xe5b0('0x56')]=_0x579dbd[_0xe5b0('0x56')][_0xe5b0('0x58')]?_0x579dbd[_0xe5b0('0x56')]:_0x30c178['model'];if(!_0x41970b[_0xe5b0('0x51')][_0xe5b0('0x59')](_0xe5b0('0x5a'))){_0x579dbd[_0xe5b0('0x30')]=qs['limit'](_0x41970b['query'][_0xe5b0('0x30')]);_0x579dbd['offset']=qs[_0xe5b0('0x31')](_0x41970b[_0xe5b0('0x51')][_0xe5b0('0x31')]);}_0x579dbd['order']=qs[_0xe5b0('0x10d')](_0x41970b['query'][_0xe5b0('0x10d')]);_0x579dbd[_0xe5b0('0x87')]=qs[_0xe5b0('0x53')](_[_0xe5b0('0x5b')](_0x41970b['query'],_0x30c178[_0xe5b0('0x53')]));_0x579dbd['where'][_0xe5b0('0x10e')]=_0x3ae8ba['id'];if(_0x41970b[_0xe5b0('0x51')][_0xe5b0('0x94')]){_0x579dbd[_0xe5b0('0x87')]=_['merge'](_0x579dbd[_0xe5b0('0x87')],{'$or':_[_0xe5b0('0x41')](_0x579dbd[_0xe5b0('0x56')],function(_0x33cbca){var _0x4594a4={};_0x4594a4[_0x33cbca]={'$like':'%'+_0x41970b[_0xe5b0('0x51')]['filter']+'%'};return _0x4594a4;})});}_0x579dbd['where']['secret']=![];if(_0x41970b[_0xe5b0('0x51')]['id']){_0x579dbd['where']['id']={'$gt':_0x41970b[_0xe5b0('0x51')]['id']};}_0x579dbd=_['merge']({},_0x579dbd,_0x41970b[_0xe5b0('0xc6')]);return db[_0xe5b0('0xd6')][_0xe5b0('0x32')]({'where':_0x579dbd[_0xe5b0('0x87')]})[_0xe5b0('0x22')](function(_0x54ea41){_0x4b4f0d[_0xe5b0('0x32')]=_0x54ea41;_0x579dbd[_0xe5b0('0xc5')]=[];if(_0x41970b[_0xe5b0('0x51')][_0xe5b0('0x111')]){_0x579dbd['include'][_0xe5b0('0x46')]({'model':db[_0xe5b0('0x81')],'as':_0xe5b0('0x81'),'attributes':['id','fullname','alias']});}if(_0x41970b[_0xe5b0('0x51')][_0xe5b0('0xc4')]){_0x579dbd[_0xe5b0('0xc5')]=[{'all':!![]}];}return db[_0xe5b0('0xd6')][_0xe5b0('0x110')](_0x579dbd);})[_0xe5b0('0x22')](function(_0x2bbeea){_0x4b4f0d[_0xe5b0('0xc0')]=_0x2bbeea;return _0x4b4f0d;});}})['then'](respondWithFilteredResult(_0x3d65aa,_0x579dbd))[_0xe5b0('0xc1')](handleError(_0x3d65aa,null));};exports[_0xe5b0('0x112')]=function(_0x5dd6ad,_0x1b77f0,_0x417bb3){return db[_0xe5b0('0xc3')][_0xe5b0('0x70')]({'where':{'id':_0x5dd6ad[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x1b77f0,null))[_0xe5b0('0x22')](function(_0x384a8c){if(_0x384a8c){return _0x384a8c[_0xe5b0('0x113')](_0x5dd6ad[_0xe5b0('0x84')][_0xe5b0('0x109')],_[_0xe5b0('0x10a')](_0x5dd6ad[_0xe5b0('0x84')],[_0xe5b0('0x109'),'id'])||{})[_0xe5b0('0x114')](function(){return db[_0xe5b0('0x7f')][_0xe5b0('0x110')]({'attributes':['id',_0xe5b0('0x3a'),'color'],'where':{'id':_0x5dd6ad[_0xe5b0('0x84')][_0xe5b0('0x109')]}});})['then'](function(_0x240e06){socket[_0xe5b0('0x115')](_0xe5b0('0x116'),{'id':Number(_0x5dd6ad[_0xe5b0('0xc2')]['id']),'tags':_0x240e06||[]});return{'id':Number(_0x5dd6ad[_0xe5b0('0xc2')]['id']),'tags':_0x240e06||[]};});}})[_0xe5b0('0x22')](respondWithResult(_0x1b77f0,null))[_0xe5b0('0xc1')](handleError(_0x1b77f0,null));};exports[_0xe5b0('0x117')]=function(_0xa06654,_0x528d54,_0x5b2dce){return db[_0xe5b0('0xc3')][_0xe5b0('0x70')]({'where':{'id':_0xa06654[_0xe5b0('0xc2')]['id']}})[_0xe5b0('0x22')](handleEntityNotFound(_0x528d54,null))[_0xe5b0('0x22')](function(_0x9313c9){if(_0x9313c9){return _0x9313c9['removeTags'](_0xa06654[_0xe5b0('0x51')][_0xe5b0('0x109')]);}})[_0xe5b0('0x22')](respondWithStatusCode(_0x528d54,null))['catch'](handleError(_0x528d54,null));};exports['download']=function(_0x45ac04,_0x4c43a3){var _0x260528=moment()['unix']()[_0xe5b0('0xbd')]();var _0x3022a6=path['join'](config['root'],_0xe5b0('0x118'),_0xe5b0('0x119'),'tmp');var _0x265b67=path['join'](config[_0xe5b0('0xea')],_0xe5b0('0x118'),_0xe5b0('0x119'),_0xe5b0('0x11a'));var _0x3aa4ad=path[_0xe5b0('0xe9')](_0x3022a6,_0x260528);var _0x220c9d=util[_0xe5b0('0xef')](_0xe5b0('0x11b'),_0x45ac04[_0xe5b0('0xc2')]['id'],_0x260528);var _0x2d754b=path[_0xe5b0('0xe9')](_0x3022a6,_0x220c9d);var _0x3fe23c=[];_0x3fe23c[_0xe5b0('0x46')]({'model':db['User'],'as':_0xe5b0('0x81'),'attributes':['id',_0xe5b0('0x42')],'raw':!![]});_0x3fe23c[_0xe5b0('0x46')]({'model':db[_0xe5b0('0xda')],'as':_0xe5b0('0x74'),'attributes':['id',_0xe5b0('0x11c'),_0xe5b0('0x11d')],'raw':!![]});if(_0x45ac04['query'][_0xe5b0('0x11a')]){_0x3fe23c['push']({'model':db[_0xe5b0('0xe5')],'as':_0xe5b0('0xe5'),'raw':!![]});}var _0x636665=[{'model':db[_0xe5b0('0xd6')],'as':_0xe5b0('0xf1'),'attributes':['id',_0xe5b0('0x84'),_0xe5b0('0x11e'),_0xe5b0('0xf9'),_0xe5b0('0xfa'),_0xe5b0('0x90')],'include':_0x3fe23c}];_0x636665['push']({'model':db[_0xe5b0('0xc9')],'as':_0xe5b0('0x11f'),'attributes':['id',_0xe5b0('0x3a')]});_0x636665['push']({'model':db['User'],'as':_0xe5b0('0x120'),'attributes':['id',_0xe5b0('0x42')]});return db[_0xe5b0('0xc3')]['find']({'where':{'id':_0x45ac04[_0xe5b0('0xc2')]['id']},'include':_0x636665})[_0xe5b0('0x22')](handleEntityNotFound(_0x4c43a3,null))[_0xe5b0('0x22')](function(_0x2a2e0c){if(_0x2a2e0c){var _0x730c8d=_0x2a2e0c[_0xe5b0('0x121')]({'plain':!![]});fs[_0xe5b0('0x122')](_0x3aa4ad);var _0x4b416e={'channel':'Chat','account':_0x730c8d[_0xe5b0('0x11f')][_0xe5b0('0x3a')],'agent':_0x730c8d[_0xe5b0('0x120')]?_0x730c8d[_0xe5b0('0x120')][_0xe5b0('0x42')]:_0xe5b0('0x123'),'createdAt':moment(_0x730c8d['createdAt'])[_0xe5b0('0xef')](_0xe5b0('0x10f'))[_0xe5b0('0xbd')](),'closedAt':_0x730c8d[_0xe5b0('0xde')]?moment(_0x730c8d[_0xe5b0('0x124')])[_0xe5b0('0xef')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe5b0('0xbd')]():'','disposition':_0x730c8d['disposition'],'chatInfo':{'browser':_0x730c8d[_0xe5b0('0x125')],'os':_0x730c8d[_0xe5b0('0x126')],'referer':_0x730c8d[_0xe5b0('0x127')],'customerIp':_0x730c8d[_0xe5b0('0x128')],'customerPort':_0x730c8d[_0xe5b0('0x129')]?_0x730c8d['customerPort']:'N.A.'},'messages':_(_0x730c8d['Messages'])[_0xe5b0('0x12a')]()['filter']({'secret':![]})[_0xe5b0('0x41')](function(_0x257026){if(_0x257026[_0xe5b0('0xe5')]){var _0x113f14=path[_0xe5b0('0xe9')](_0x265b67,_0x257026[_0xe5b0('0xe5')]['basename']);if(fs['existsSync'](_0x113f14)){fs[_0xe5b0('0x12b')](_0x113f14)['pipe'](fs[_0xe5b0('0x12c')](path[_0xe5b0('0xe9')](_0x3aa4ad,_0x257026[_0xe5b0('0xe5')][_0xe5b0('0xe2')])));}}return{'date':moment(_0x257026[_0xe5b0('0x11e')])[_0xe5b0('0xef')](_0xe5b0('0x10f'))['toString'](),'sender':_0x257026[_0xe5b0('0xf9')]===_0xe5b0('0xd5')?_0x257026[_0xe5b0('0x81')]?_0x257026[_0xe5b0('0x81')][_0xe5b0('0x42')]:_0xe5b0('0xf4'):_0x257026[_0xe5b0('0x74')][_0xe5b0('0x11c')]+(_0x257026['Contact'][_0xe5b0('0x11d')]?'\x20'+_0x257026[_0xe5b0('0x74')]['lastName']:''),'body':_0x257026[_0xe5b0('0xe5')]?_0x257026['Attachment']['basename']:_0x257026[_0xe5b0('0x84')],'direction':_0x257026[_0xe5b0('0xf9')]===_0xe5b0('0xd5')?'A':'C','secret':_0x257026['secret'],'read':_0x257026[_0xe5b0('0x90')],'attachment':_0x257026['Attachment']};})[_0xe5b0('0x77')]()};return ejs[_0xe5b0('0x12d')](path[_0xe5b0('0xe9')](config[_0xe5b0('0xea')],_0xe5b0('0x118'),_0xe5b0('0x12e'),_0xe5b0('0x12f')),{'interaction':_0x4b416e})[_0xe5b0('0x22')](function(_0x599898){var _0xe388df=path[_0xe5b0('0xe9')](_0x3aa4ad,_0xe5b0('0x130')+_0x730c8d['id']+'-'+_0x260528+_0xe5b0('0x131'));var _0x3dbcea={'path':_0xe388df,'channel':_0xe5b0('0x132'),'interactionId':_0x730c8d['id']};return pdf[_0xe5b0('0x133')](_0x599898,_0x3dbcea);})[_0xe5b0('0x22')](function(){return new BPromise(function(_0xb8f834,_0x5c0515){zipdir(_0x3aa4ad,{'saveTo':_0x2d754b},function(_0x5845ce,_0x733a9b){if(_0x5845ce)return _0x5c0515(_0x5845ce);return _0xb8f834(_0x733a9b);});})[_0xe5b0('0x22')](function(){return new BPromise(function(_0x4f1067,_0xa6a973){rimraf(_0x3aa4ad,function(_0x31900b){if(_0x31900b)_0xa6a973(_0x31900b);return _0x4f1067();});});})[_0xe5b0('0x22')](function(){return _0x4c43a3[_0xe5b0('0xec')](_0x2d754b,_0x220c9d,function(_0x380927){if(_0x380927){console[_0xe5b0('0x134')](_0xe5b0('0x135'),_0x380927);}else{fs[_0xe5b0('0x136')](_0x2d754b);}});});});}else{return _0x4c43a3['sendStatus'](0xc8);}})[_0xe5b0('0xc1')](handleError(_0x4c43a3,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index f89e1e8..8199213 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 _0xe504=['events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe504,0x18c));var _0x4e50=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe504[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x4e50('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x4e50('0x1')];var ChatMessage=require(_0x4e50('0x2'))['db'][_0x4e50('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x4e50('0x4')](0x0);var events={'afterCreate':_0x4e50('0x5'),'afterUpdate':'update','afterDestroy':_0x4e50('0x6')};function emitEvent(_0x4351af){return function(_0x14ed39,_0x364bea,_0x245e06){_0x14ed39[_0x4e50('0x7')]({'attributes':['id'],'raw':!![]})[_0x4e50('0x8')](function(_0x52a2a3){_0x14ed39[_0x4e50('0x9')]('Users',_0x52a2a3[_0x4e50('0xa')](function(_0x3d7c09){return{'id':_0x3d7c09['id']};}));return ChatMessage[_0x4e50('0xb')]({'where':{'ChatInteractionId':_0x14ed39['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e50('0x8')](function(_0x5b92ce){_0x14ed39[_0x4e50('0x9')](_0x4e50('0xc'),_0x5b92ce['length']);ChatInteractionEvents['emit'](_0x4351af+':'+_0x14ed39['id'],_0x14ed39);ChatInteractionEvents[_0x4e50('0xd')](_0x4351af,_0x14ed39);_0x245e06(null);})[_0x4e50('0xe')](_0x245e06(null));};}for(var e in events){if(events[_0x4e50('0xf')](e)){var event=events[e];ChatInteraction[_0x4e50('0x10')](e,emitEvent(event));}}module[_0x4e50('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x9746=['findAll','unreadMessages','length','emit','events','../../mysqldb','ChatMessage','update','remove','then','setDataValue','Users'];(function(_0x378635,_0x254be9){var _0x28c28e=function(_0x4fc4ae){while(--_0x4fc4ae){_0x378635['push'](_0x378635['shift']());}};_0x28c28e(++_0x254be9);}(_0x9746,0x148));var _0x6974=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x9746[_0x4e9628];return _0x27bc8c;};'use strict';var EventEmitter=require(_0x6974('0x0'));var ChatInteraction=require(_0x6974('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x6974('0x1'))['db'][_0x6974('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6974('0x3'),'afterDestroy':_0x6974('0x4')};function emitEvent(_0x1c2351){return function(_0x2489c6,_0x27c3d8,_0x22c846){_0x2489c6['getUsers']({'attributes':['id'],'raw':!![]})[_0x6974('0x5')](function(_0x400710){_0x2489c6[_0x6974('0x6')](_0x6974('0x7'),_0x400710['map'](function(_0x120364){return{'id':_0x120364['id']};}));return ChatMessage[_0x6974('0x8')]({'where':{'ChatInteractionId':_0x2489c6['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x30b242){_0x2489c6[_0x6974('0x6')](_0x6974('0x9'),_0x30b242[_0x6974('0xa')]);ChatInteractionEvents['emit'](_0x1c2351+':'+_0x2489c6['id'],_0x2489c6);ChatInteractionEvents[_0x6974('0xb')](_0x1c2351,_0x2489c6);_0x22c846(null);})['catch'](_0x22c846(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3fb8369..126db0f 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 _0xaae8=['api','moment','request-promise','rimraf','../../config/environment','exports','define','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0x5e40a4,_0x467e47){var _0x182e33=function(_0x52e531){while(--_0x52e531){_0x5e40a4['push'](_0x5e40a4['shift']());}};_0x182e33(++_0x467e47);}(_0xaae8,0xe7));var _0x8aae=function(_0x483646,_0x1b7f6d){_0x483646=_0x483646-0x0;var _0x15f315=_0xaae8[_0x483646];return _0x15f315;};'use strict';var _=require(_0x8aae('0x0'));var util=require(_0x8aae('0x1'));var logger=require(_0x8aae('0x2'))(_0x8aae('0x3'));var moment=require(_0x8aae('0x4'));var BPromise=require('bluebird');var rp=require(_0x8aae('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8aae('0x6'));var config=require(_0x8aae('0x7'));var attributes=require('./chatInteraction.attributes');module[_0x8aae('0x8')]=function(_0xeb03b3,_0x491367){return _0xeb03b3[_0x8aae('0x9')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2597b1,_0x3dd0af,_0x32c0ce){if(_0x2597b1['changed'](_0x8aae('0xa'))){_0x2597b1['closedAt']=moment()['format'](_0x8aae('0xb'));}_0x32c0ce(null,_0x2597b1);}},'charset':_0x8aae('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8598=['define','changed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','./chatInteraction.attributes'];(function(_0x2001cd,_0x3da1f3){var _0x1f321e=function(_0x2765cd){while(--_0x2765cd){_0x2001cd['push'](_0x2001cd['shift']());}};_0x1f321e(++_0x3da1f3);}(_0x8598,0x1cc));var _0x8859=function(_0x5f4893,_0x3bdc21){_0x5f4893=_0x5f4893-0x0;var _0x45a813=_0x8598[_0x5f4893];return _0x45a813;};'use strict';var _=require(_0x8859('0x0'));var util=require(_0x8859('0x1'));var logger=require('../../config/logger')(_0x8859('0x2'));var moment=require(_0x8859('0x3'));var BPromise=require(_0x8859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8859('0x5'));var rimraf=require(_0x8859('0x6'));var config=require('../../config/environment');var attributes=require(_0x8859('0x7'));module['exports']=function(_0x238fe0,_0x37ada9){return _0x238fe0[_0x8859('0x8')]('ChatInteraction',attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x37500e,_0x5326a0,_0x88cb60){if(_0x37500e[_0x8859('0x9')]('closed')){_0x37500e['closedAt']=moment()['format'](_0x8859('0xa'));}_0x88cb60(null,_0x37500e);}},'charset':'utf8mb4','collate':_0x8859('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 0149e20..3148555 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 _0xfcae=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags'];(function(_0x1f95f7,_0x361b99){var _0x1a0a51=function(_0x49275e){while(--_0x49275e){_0x1f95f7['push'](_0x1f95f7['shift']());}};_0x1a0a51(++_0x361b99);}(_0xfcae,0xa8));var _0xefca=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xfcae[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xefca('0x0'));var util=require('util');var moment=require(_0xefca('0x1'));var BPromise=require(_0xefca('0x2'));var rs=require(_0xefca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefca('0x4'))['db'];var utils=require(_0xefca('0x5'));var logger=require(_0xefca('0x6'))(_0xefca('0x7'));var config=require(_0xefca('0x8'));var jayson=require(_0xefca('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xefca('0xa')](config[_0xefca('0xb')],{'host':_0xefca('0xc'),'port':0x18eb});var socket=require(_0xefca('0xd'))(new Redis(config[_0xefca('0xb')]));require(_0xefca('0xe'))[_0xefca('0xf')](socket);function respondWithRpcPromise(_0x1fe4a4,_0x62cd67,_0x2b7d5a){return new BPromise(function(_0x3ecd03,_0x4e8af4){return client[_0xefca('0x10')](_0x1fe4a4,_0x2b7d5a)[_0xefca('0x11')](function(_0x211b3f){logger[_0xefca('0x12')](_0xefca('0x13'),_0x62cd67,_0xefca('0x14'));logger[_0xefca('0x15')](_0xefca('0x16'),_0x62cd67,_0xefca('0x14'),JSON[_0xefca('0x17')](_0x211b3f));if(_0x211b3f[_0xefca('0x18')]){if(_0x211b3f[_0xefca('0x18')][_0xefca('0x19')]===0x1f4){logger['error'](_0xefca('0x13'),_0x62cd67,_0x211b3f[_0xefca('0x18')][_0xefca('0x1a')]);return _0x4e8af4(_0x211b3f['error'][_0xefca('0x1a')]);}logger[_0xefca('0x18')](_0xefca('0x13'),_0x62cd67,_0x211b3f[_0xefca('0x18')]['message']);return _0x3ecd03(_0x211b3f['error'][_0xefca('0x1a')]);}else{logger[_0xefca('0x12')](_0xefca('0x13'),_0x62cd67,_0xefca('0x14'));_0x3ecd03(_0x211b3f['result'][_0xefca('0x1a')]);}})[_0xefca('0x1b')](function(_0x24dcff){logger['error'](_0xefca('0x13'),_0x62cd67,_0x24dcff);_0x4e8af4(_0x24dcff);});});}exports['UpdateChatInteraction']=function(_0x4878d6){var _0x546db5=this;return new Promise(function(_0x115d89,_0x1586c8){return db['ChatInteraction']['update'](_0x4878d6[_0xefca('0x1c')],{'raw':_0x4878d6[_0xefca('0x1d')]?_0x4878d6[_0xefca('0x1d')][_0xefca('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4878d6[_0xefca('0x1d')]?_0x4878d6[_0xefca('0x1d')][_0xefca('0x1f')]||null:null,'attributes':_0x4878d6[_0xefca('0x1d')]?_0x4878d6['options'][_0xefca('0x20')]||null:null,'limit':_0x4878d6[_0xefca('0x1d')]?_0x4878d6[_0xefca('0x1d')][_0xefca('0x21')]||null:null})[_0xefca('0x11')](function(_0x52a03c){logger['info'](_0xefca('0x22'),_0x4878d6);logger['debug'](_0xefca('0x22'),_0x4878d6,JSON['stringify'](_0x52a03c));_0x115d89(_0x52a03c);})[_0xefca('0x1b')](function(_0x144c8c){logger[_0xefca('0x18')]('UpdateChatInteraction',_0x144c8c[_0xefca('0x1a')],_0x4878d6);_0x1586c8(_0x546db5[_0xefca('0x18')](0x1f4,_0x144c8c[_0xefca('0x1a')]));});});};exports[_0xefca('0x23')]=function(_0xe6de3d){return new Promise(function(_0x34d64b,_0xdb6020){return db['ChatInteraction'][_0xefca('0x24')]({'where':_0xe6de3d['options']?_0xe6de3d['options'][_0xefca('0x1f')]||null:null})[_0xefca('0x11')](function(_0x4821c8){if(_0x4821c8){return _0x4821c8[_0xefca('0x25')](_0xe6de3d[_0xefca('0x1c')][_0xefca('0x26')],_[_0xefca('0x27')](_0xe6de3d['body'],[_0xefca('0x26'),'id'])||{});}})[_0xefca('0x28')](function(_0x47df3c){logger['info'](_0xefca('0x29'),_0xe6de3d);logger[_0xefca('0x15')](_0xefca('0x29'),_0xe6de3d,JSON[_0xefca('0x17')](_0x47df3c));_0x34d64b(_0x47df3c);})[_0xefca('0x1b')](function(_0x2848fc){logger[_0xefca('0x18')](_0xefca('0x29'),_0x2848fc[_0xefca('0x1a')],_0xe6de3d);_0xdb6020(_this['error'](0x1f4,_0x2848fc[_0xefca('0x1a')]));});});}; \ No newline at end of file +var _0x284f=['addTags','ids','omit','spread','debug','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','update','body','options','where','attributes','limit','catch','AddTagsToChatInteraction','find'];(function(_0x9f4235,_0x2d4515){var _0x1970dd=function(_0x47d0b7){while(--_0x47d0b7){_0x9f4235['push'](_0x9f4235['shift']());}};_0x1970dd(++_0x2d4515);}(_0x284f,0x12c));var _0xf284=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x284f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf284('0x0'));var util=require(_0xf284('0x1'));var moment=require(_0xf284('0x2'));var BPromise=require(_0xf284('0x3'));var rs=require(_0xf284('0x4'));var fs=require('fs');var Redis=require(_0xf284('0x5'));var db=require(_0xf284('0x6'))['db'];var utils=require(_0xf284('0x7'));var logger=require(_0xf284('0x8'))('rpc');var config=require(_0xf284('0x9'));var jayson=require(_0xf284('0xa'));var client=jayson['client'][_0xf284('0xb')]({'port':0x232a});config[_0xf284('0xc')]=_['defaults'](config['redis'],{'host':_0xf284('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf284('0xc')]));require(_0xf284('0xe'))[_0xf284('0xf')](socket);function respondWithRpcPromise(_0x46aa18,_0xf1e9c3,_0x30d702){return new BPromise(function(_0xce8858,_0x4f4f67){return client['request'](_0x46aa18,_0x30d702)[_0xf284('0x10')](function(_0x58b631){logger[_0xf284('0x11')](_0xf284('0x12'),_0xf1e9c3,_0xf284('0x13'));logger['debug'](_0xf284('0x14'),_0xf1e9c3,_0xf284('0x13'),JSON[_0xf284('0x15')](_0x58b631));if(_0x58b631[_0xf284('0x16')]){if(_0x58b631[_0xf284('0x16')][_0xf284('0x17')]===0x1f4){logger[_0xf284('0x16')](_0xf284('0x12'),_0xf1e9c3,_0x58b631[_0xf284('0x16')][_0xf284('0x18')]);return _0x4f4f67(_0x58b631['error']['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0xf1e9c3,_0x58b631['error'][_0xf284('0x18')]);return _0xce8858(_0x58b631['error'][_0xf284('0x18')]);}else{logger[_0xf284('0x11')](_0xf284('0x12'),_0xf1e9c3,_0xf284('0x13'));_0xce8858(_0x58b631[_0xf284('0x19')][_0xf284('0x18')]);}})['catch'](function(_0x1fb0f1){logger[_0xf284('0x16')](_0xf284('0x12'),_0xf1e9c3,_0x1fb0f1);_0x4f4f67(_0x1fb0f1);});});}exports[_0xf284('0x1a')]=function(_0x4a4d14){var _0x49bbe4=this;return new Promise(function(_0x50478b,_0x3b1045){return db['ChatInteraction'][_0xf284('0x1b')](_0x4a4d14[_0xf284('0x1c')],{'raw':_0x4a4d14['options']?_0x4a4d14[_0xf284('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a4d14['options']?_0x4a4d14['options'][_0xf284('0x1e')]||null:null,'attributes':_0x4a4d14[_0xf284('0x1d')]?_0x4a4d14[_0xf284('0x1d')][_0xf284('0x1f')]||null:null,'limit':_0x4a4d14[_0xf284('0x1d')]?_0x4a4d14[_0xf284('0x1d')][_0xf284('0x20')]||null:null})[_0xf284('0x10')](function(_0x49668a){logger[_0xf284('0x11')](_0xf284('0x1a'),_0x4a4d14);logger['debug'](_0xf284('0x1a'),_0x4a4d14,JSON[_0xf284('0x15')](_0x49668a));_0x50478b(_0x49668a);})[_0xf284('0x21')](function(_0x62f672){logger[_0xf284('0x16')](_0xf284('0x1a'),_0x62f672[_0xf284('0x18')],_0x4a4d14);_0x3b1045(_0x49bbe4[_0xf284('0x16')](0x1f4,_0x62f672[_0xf284('0x18')]));});});};exports[_0xf284('0x22')]=function(_0x38923d){return new Promise(function(_0x235f90,_0x238915){return db['ChatInteraction'][_0xf284('0x23')]({'where':_0x38923d['options']?_0x38923d[_0xf284('0x1d')][_0xf284('0x1e')]||null:null})['then'](function(_0x12c5cc){if(_0x12c5cc){return _0x12c5cc[_0xf284('0x24')](_0x38923d['body'][_0xf284('0x25')],_[_0xf284('0x26')](_0x38923d[_0xf284('0x1c')],[_0xf284('0x25'),'id'])||{});}})[_0xf284('0x27')](function(_0x1f3fa4){logger[_0xf284('0x11')]('AddTags',_0x38923d);logger[_0xf284('0x28')]('AddTags',_0x38923d,JSON[_0xf284('0x15')](_0x1f3fa4));_0x235f90(_0x1f3fa4);})['catch'](function(_0x13beee){logger['error'](_0xf284('0x29'),_0x13beee[_0xf284('0x18')],_0x38923d);_0x238915(_this[_0xf284('0x16')](0x1f4,_0x13beee[_0xf284('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 2648443..825cf36 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 _0x372b=['length','chatInteraction:','./chatInteraction.events','save','update','emit','removeListener','register'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x372b,0x18a));var _0xb372=function(_0x30e189,_0x3dc142){_0x30e189=_0x30e189-0x0;var _0x1c28c8=_0x372b[_0x30e189];return _0x1c28c8;};'use strict';var ChatInteractionEvents=require(_0xb372('0x0'));var events=[_0xb372('0x1'),'remove',_0xb372('0x2')];function createListener(_0x41734c,_0x4706d0){return function(_0xbd4c2b){_0x4706d0[_0xb372('0x3')](_0x41734c,_0xbd4c2b);};}function removeListener(_0x458bf9,_0x4fe3cb){return function(){ChatInteractionEvents[_0xb372('0x4')](_0x458bf9,_0x4fe3cb);};}exports[_0xb372('0x5')]=function(_0xa1eefa){for(var _0x5c8510=0x0,_0x39c4ac=events[_0xb372('0x6')];_0x5c8510<_0x39c4ac;_0x5c8510++){var _0x1a6925=events[_0x5c8510];var _0x6a7a15=createListener(_0xb372('0x7')+_0x1a6925,_0xa1eefa);ChatInteractionEvents['on'](_0x1a6925,_0x6a7a15);}}; \ No newline at end of file +var _0x3999=['register','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x3999,0x18a));var _0x9399=function(_0x50f7eb,_0x2dc280){_0x50f7eb=_0x50f7eb-0x0;var _0x4394ca=_0x3999[_0x50f7eb];return _0x4394ca;};'use strict';var ChatInteractionEvents=require(_0x9399('0x0'));var events=['save',_0x9399('0x1'),_0x9399('0x2')];function createListener(_0x4b81a8,_0x4a2590){return function(_0x1b23ac){_0x4a2590[_0x9399('0x3')](_0x4b81a8,_0x1b23ac);};}function removeListener(_0x4320aa,_0x25ac24){return function(){ChatInteractionEvents[_0x9399('0x4')](_0x4320aa,_0x25ac24);};}exports[_0x9399('0x5')]=function(_0xbe96e6){for(var _0x82a508=0x0,_0x461412=events['length'];_0x82a508<_0x461412;_0x82a508++){var _0x36ad35=events[_0x82a508];var _0xcd52b3=createListener(_0x9399('0x6')+_0x36ad35,_0xbe96e6);ChatInteractionEvents['on'](_0x36ad35,_0xcd52b3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 3989240..5a894b1 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 _0x138a=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','root','server/files/attachments/','format','%s-%s','now','originalname','replace','post','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','/:id/tags','removeTags'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x138a,0xc8));var _0xa138=function(_0x6d1cff,_0x2c642b){_0x6d1cff=_0x6d1cff-0x0;var _0x5aeaa5=_0x138a[_0x6d1cff];return _0x5aeaa5;};'use strict';var multer=require(_0xa138('0x0'));var util=require('util');var path=require(_0xa138('0x1'));var timeout=require(_0xa138('0x2'));var express=require(_0xa138('0x3'));var router=express[_0xa138('0x4')]();var fs_extra=require(_0xa138('0x5'));var auth=require(_0xa138('0x6'));var interaction=require(_0xa138('0x7'));var config=require(_0xa138('0x8'));var controller=require(_0xa138('0x9'));router[_0xa138('0xa')]('/',auth['isAuthenticated'](),controller[_0xa138('0xb')]);router[_0xa138('0xa')]('/describe',auth[_0xa138('0xc')](),controller['describe']);router['get'](_0xa138('0xd'),auth[_0xa138('0xe')](),controller[_0xa138('0xf')]);router[_0xa138('0xa')](_0xa138('0x10'),auth['isChatInteractionAuthorized'](),controller[_0xa138('0x11')]);router[_0xa138('0xa')](_0xa138('0x12'),auth[_0xa138('0xc')](),controller['getMessages']);router[_0xa138('0xa')](_0xa138('0x13'),auth[_0xa138('0xe')](),controller[_0xa138('0x14')]);router['get'](_0xa138('0x15'),auth['isAuthenticated'](),controller[_0xa138('0x16')]);router['post']('/',auth[_0xa138('0xc')](),controller['create']);router['post']('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b6913,_0x37764,_0x12dd8c){_0x12dd8c(null,path['join'](config[_0xa138('0x17')],_0xa138('0x18')));},'filename':function(_0x52f515,_0x5b8b8d,_0x18e982){_0x18e982(null,util[_0xa138('0x19')](_0xa138('0x1a'),Date[_0xa138('0x1b')](),_0x5b8b8d[_0xa138('0x1c')][_0xa138('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa138('0x1e')](_0xa138('0x1f'),upload[_0xa138('0x20')](_0xa138('0x21')),controller[_0xa138('0x22')]);router[_0xa138('0x1e')](_0xa138('0x12'),auth[_0xa138('0xe')](),controller[_0xa138('0x23')]);router[_0xa138('0x1e')]('/:id/tags',auth[_0xa138('0xc')](),interaction[_0xa138('0x24')](_0xa138('0x25'),_0xa138('0x26')),controller[_0xa138('0x27')]);router[_0xa138('0x28')](_0xa138('0xd'),auth['isAuthenticated'](),interaction[_0xa138('0x24')](_0xa138('0x25'),_0xa138('0x29')),controller['update']);router['put']('/:id/custom_update',controller[_0xa138('0x2a')]);router['put'](_0xa138('0x2b'),auth[_0xa138('0xe')](),controller[_0xa138('0x2c')]);router[_0xa138('0x28')](_0xa138('0x2d'),controller[_0xa138('0x2e')]);router[_0xa138('0x2f')](_0xa138('0xd'),auth[_0xa138('0xc')](),interaction[_0xa138('0x24')](_0xa138('0x25'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0xa138('0x30'),auth[_0xa138('0xc')](),controller[_0xa138('0x31')]);module['exports']=router; \ No newline at end of file +var _0x4a69=['attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','createVidaooSession','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','get'];(function(_0x1ae764,_0xef0fc9){var _0x57bdde=function(_0x1ce295){while(--_0x1ce295){_0x1ae764['push'](_0x1ae764['shift']());}};_0x57bdde(++_0xef0fc9);}(_0x4a69,0x181));var _0x94a6=function(_0x27ffc3,_0x6a9a3f){_0x27ffc3=_0x27ffc3-0x0;var _0x139f94=_0x4a69[_0x27ffc3];return _0x139f94;};'use strict';var multer=require(_0x94a6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x94a6('0x1'));var express=require(_0x94a6('0x2'));var router=express[_0x94a6('0x3')]();var fs_extra=require(_0x94a6('0x4'));var auth=require(_0x94a6('0x5'));var interaction=require(_0x94a6('0x6'));var config=require('../../config/environment');var controller=require(_0x94a6('0x7'));router['get']('/',auth[_0x94a6('0x8')](),controller['index']);router['get'](_0x94a6('0x9'),auth[_0x94a6('0x8')](),controller[_0x94a6('0xa')]);router['get'](_0x94a6('0xb'),auth[_0x94a6('0xc')](),controller[_0x94a6('0xd')]);router[_0x94a6('0xe')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0x94a6('0xf')]);router[_0x94a6('0xe')](_0x94a6('0x10'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x11')]);router[_0x94a6('0xe')](_0x94a6('0x12'),auth[_0x94a6('0xc')](),controller[_0x94a6('0x13')]);router['get'](_0x94a6('0x14'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x15')]);router[_0x94a6('0x16')]('/',auth[_0x94a6('0x8')](),controller['create']);router[_0x94a6('0x16')]('/:id/vidaoo',auth[_0x94a6('0x8')](),controller[_0x94a6('0x17')]);var upload=multer({'storage':multer[_0x94a6('0x18')]({'destination':function(_0x20617b,_0x191f18,_0x18ae51){_0x18ae51(null,path[_0x94a6('0x19')](config[_0x94a6('0x1a')],_0x94a6('0x1b')));},'filename':function(_0xa531d3,_0x2688c6,_0x42d93a){_0x42d93a(null,util['format'](_0x94a6('0x1c'),Date[_0x94a6('0x1d')](),_0x2688c6[_0x94a6('0x1e')][_0x94a6('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x94a6('0x16')](_0x94a6('0x20'),upload['single']('file'),controller['attachmentUpload']);router['post'](_0x94a6('0x10'),auth[_0x94a6('0xc')](),controller[_0x94a6('0x21')]);router[_0x94a6('0x16')](_0x94a6('0x22'),auth[_0x94a6('0x8')](),interaction[_0x94a6('0x23')](_0x94a6('0x24'),'chatinteraction:addtags'),controller[_0x94a6('0x25')]);router[_0x94a6('0x26')](_0x94a6('0xb'),auth['isAuthenticated'](),interaction[_0x94a6('0x23')]('chat',_0x94a6('0x27')),controller[_0x94a6('0x28')]);router[_0x94a6('0x26')]('/:id/custom_update',controller['customUpdate']);router[_0x94a6('0x26')](_0x94a6('0x29'),auth[_0x94a6('0xc')](),controller[_0x94a6('0x2a')]);router[_0x94a6('0x26')](_0x94a6('0x2b'),controller[_0x94a6('0x2c')]);router[_0x94a6('0x2d')]('/:id',auth[_0x94a6('0x8')](),interaction[_0x94a6('0x23')]('chat',_0x94a6('0x2e')),controller[_0x94a6('0x2f')]);router[_0x94a6('0x2d')](_0x94a6('0x22'),auth[_0x94a6('0x8')](),controller[_0x94a6('0x30')]);module[_0x94a6('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 19bd96c..a30d520 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 _0x34d2=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0xabbd2f,_0x44d05a){var _0x34a040=function(_0x3736d9){while(--_0x3736d9){_0xabbd2f['push'](_0xabbd2f['shift']());}};_0x34a040(++_0x44d05a);}(_0x34d2,0xf9));var _0x234d=function(_0x326b43,_0x5e4af0){_0x326b43=_0x326b43-0x0;var _0x31aed2=_0x34d2[_0x326b43];return _0x31aed2;};'use strict';var Sequelize=require(_0x234d('0x0'));module[_0x234d('0x1')]={'body':{'type':Sequelize[_0x234d('0x2')](_0x234d('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x234d('0x4')]}}; \ No newline at end of file +var _0x20db=['exports','TEXT','medium','BOOLEAN','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x20db,0x10d));var _0xb20d=function(_0x2c469e,_0x265e10){_0x2c469e=_0x2c469e-0x0;var _0xb02d87=_0x20db[_0x2c469e];return _0xb02d87;};'use strict';var Sequelize=require(_0xb20d('0x0'));module[_0xb20d('0x1')]={'body':{'type':Sequelize[_0xb20d('0x2')](_0xb20d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb20d('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f2bc97c..15618ae 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 _0x7b47=['UserProfileSection','userProfileId','autoAssociation','isEmpty','agent','resourceId','push','messages','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','include','findAll','rows','params','includeAll','create','body','find','catch','get','lastMessage','getUsers','admin','user','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2355b2,_0x23d32a){var _0x493c45=function(_0x4b3b33){while(--_0x4b3b33){_0x2355b2['push'](_0x2355b2['shift']());}};_0x493c45(++_0x23d32a);}(_0x7b47,0xea));var _0x77b4=function(_0x49fc14,_0x2917a2){_0x49fc14=_0x49fc14-0x0;var _0x270888=_0x7b47[_0x49fc14];return _0x270888;};'use strict';var emlformat=require(_0x77b4('0x0'));var rimraf=require(_0x77b4('0x1'));var zipdir=require(_0x77b4('0x2'));var jsonpatch=require(_0x77b4('0x3'));var rp=require('request-promise');var moment=require(_0x77b4('0x4'));var BPromise=require(_0x77b4('0x5'));var Mustache=require(_0x77b4('0x6'));var util=require(_0x77b4('0x7'));var path=require(_0x77b4('0x8'));var sox=require(_0x77b4('0x9'));var csv=require('to-csv');var ejs=require(_0x77b4('0xa'));var fs=require('fs');var fs_extra=require(_0x77b4('0xb'));var _=require(_0x77b4('0xc'));var squel=require(_0x77b4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x77b4('0xe'));var toCsv=require(_0x77b4('0xf'));var querystring=require(_0x77b4('0x10'));var Papa=require(_0x77b4('0x11'));var Redis=require(_0x77b4('0x12'));var authService=require(_0x77b4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x77b4('0x14'));var hardwareService=require(_0x77b4('0x15'));var logger=require(_0x77b4('0x16'))(_0x77b4('0x17'));var utils=require(_0x77b4('0x18'));var config=require(_0x77b4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x77b4('0x1a')]=_['defaults'](config[_0x77b4('0x1a')],{'host':_0x77b4('0x1b'),'port':0x18eb});var socket=require(_0x77b4('0x1c'))(new Redis(config[_0x77b4('0x1a')]));require(_0x77b4('0x1d'))[_0x77b4('0x1e')](socket);function respondWithStatusCode(_0x38aef1,_0x3642f0){_0x3642f0=_0x3642f0||0xcc;return function(_0x4c6228){if(_0x4c6228){return _0x38aef1[_0x77b4('0x1f')](_0x3642f0);}return _0x38aef1['status'](_0x3642f0)[_0x77b4('0x20')]();};}function respondWithResult(_0x39ef96,_0x5dbadc){_0x5dbadc=_0x5dbadc||0xc8;return function(_0xb0cd0f){if(_0xb0cd0f){return _0x39ef96[_0x77b4('0x21')](_0x5dbadc)['json'](_0xb0cd0f);}};}function respondWithFilteredResult(_0x314ac3,_0x4f81e3){return function(_0x59fd73){if(_0x59fd73){var _0x5ac843=typeof _0x4f81e3[_0x77b4('0x22')]==='undefined'&&typeof _0x4f81e3[_0x77b4('0x23')]==='undefined';var _0x59eca4=_0x59fd73[_0x77b4('0x24')];var _0x2ffd37=_0x5ac843?0x0:_0x4f81e3[_0x77b4('0x22')];var _0x58c415=_0x5ac843?_0x59fd73[_0x77b4('0x24')]:_0x4f81e3[_0x77b4('0x22')]+_0x4f81e3['limit'];var _0x25532d;if(_0x58c415>=_0x59eca4){_0x58c415=_0x59eca4;_0x25532d=0xc8;}else{_0x25532d=0xce;}_0x314ac3['status'](_0x25532d);return _0x314ac3[_0x77b4('0x25')](_0x77b4('0x26'),_0x2ffd37+'-'+_0x58c415+'/'+_0x59eca4)[_0x77b4('0x27')](_0x59fd73);}return null;};}function patchUpdates(_0x41b1df){return function(_0x2de5a9){try{jsonpatch[_0x77b4('0x28')](_0x2de5a9,_0x41b1df,!![]);}catch(_0x4e7540){return BPromise[_0x77b4('0x29')](_0x4e7540);}return _0x2de5a9[_0x77b4('0x2a')]();};}function saveUpdates(_0x4d77b3,_0xc56de9){return function(_0x207b72){if(_0x207b72){return _0x207b72[_0x77b4('0x2b')](_0x4d77b3)[_0x77b4('0x2c')](function(_0x5c7f49){return _0x5c7f49;});}return null;};}function removeEntity(_0x2fee95,_0x437c43){return function(_0x3e4df9){if(_0x3e4df9){return _0x3e4df9[_0x77b4('0x2d')]()[_0x77b4('0x2c')](function(){_0x2fee95['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x384351,_0x301d91){return function(_0xa6f05f){if(!_0xa6f05f){_0x384351[_0x77b4('0x1f')](0x194);}return _0xa6f05f;};}function handleError(_0x146d14,_0x5eaa41){_0x5eaa41=_0x5eaa41||0x1f4;return function(_0x3eaf29){logger[_0x77b4('0x2e')](_0x3eaf29['stack']);if(_0x3eaf29[_0x77b4('0x2f')]){delete _0x3eaf29[_0x77b4('0x2f')];}_0x146d14['status'](_0x5eaa41)['send'](_0x3eaf29);};}exports['index']=function(_0x19bf75,_0x531bf1){var _0x222c7c={},_0x48afbd={},_0x20a987={'count':0x0,'rows':[]};var _0x48ba06=_[_0x77b4('0x30')](db['ChatInternalMessage'][_0x77b4('0x31')],function(_0x15cfb2){return{'name':_0x15cfb2[_0x77b4('0x32')],'type':_0x15cfb2[_0x77b4('0x33')][_0x77b4('0x34')]};});_0x48afbd[_0x77b4('0x35')]=_[_0x77b4('0x30')](_0x48ba06,'name');_0x48afbd['query']=_[_0x77b4('0x36')](_0x19bf75[_0x77b4('0x37')]);_0x48afbd[_0x77b4('0x38')]=_[_0x77b4('0x39')](_0x48afbd[_0x77b4('0x35')],_0x48afbd['query']);_0x222c7c['attributes']=_[_0x77b4('0x39')](_0x48afbd[_0x77b4('0x35')],qs['fields'](_0x19bf75[_0x77b4('0x37')][_0x77b4('0x3a')]));_0x222c7c[_0x77b4('0x3b')]=_0x222c7c['attributes'][_0x77b4('0x3c')]?_0x222c7c['attributes']:_0x48afbd[_0x77b4('0x35')];if(!_0x19bf75[_0x77b4('0x37')][_0x77b4('0x3d')]('nolimit')){_0x222c7c[_0x77b4('0x23')]=qs[_0x77b4('0x23')](_0x19bf75['query']['limit']);_0x222c7c[_0x77b4('0x22')]=qs[_0x77b4('0x22')](_0x19bf75[_0x77b4('0x37')][_0x77b4('0x22')]);}_0x222c7c[_0x77b4('0x3e')]=qs[_0x77b4('0x3f')](_0x19bf75['query']['sort']);_0x222c7c[_0x77b4('0x40')]=qs[_0x77b4('0x38')](_[_0x77b4('0x41')](_0x19bf75[_0x77b4('0x37')],_0x48afbd[_0x77b4('0x38')]),_0x48ba06);if(_0x19bf75[_0x77b4('0x37')][_0x77b4('0x42')]){_0x222c7c['where']=_[_0x77b4('0x43')](_0x222c7c[_0x77b4('0x40')],{'$or':_['map'](_0x48ba06,function(_0x349d47){if(_0x349d47[_0x77b4('0x33')]!==_0x77b4('0x44')){var _0xc1b302={};_0xc1b302[_0x349d47['name']]={'$like':'%'+_0x19bf75['query'][_0x77b4('0x42')]+'%'};return _0xc1b302;}})});}_0x222c7c=_[_0x77b4('0x43')]({},_0x222c7c,_0x19bf75[_0x77b4('0x45')]);var _0x339e2d={'where':_0x222c7c['where']};return db[_0x77b4('0x46')]['count'](_0x339e2d)[_0x77b4('0x2c')](function(_0x4dd989){_0x20a987[_0x77b4('0x24')]=_0x4dd989;if(_0x19bf75[_0x77b4('0x37')]['includeAll']){_0x222c7c[_0x77b4('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x77b4('0x48')](_0x222c7c);})['then'](function(_0xb2c429){_0x20a987[_0x77b4('0x49')]=_0xb2c429;return _0x20a987;})[_0x77b4('0x2c')](respondWithFilteredResult(_0x531bf1,_0x222c7c))['catch'](handleError(_0x531bf1,null));};exports['show']=function(_0x5f1f19,_0xea2a32){var _0x3e335d={'raw':!![],'where':{'id':_0x5f1f19[_0x77b4('0x4a')]['id']}},_0x22377d={};_0x22377d['model']=_[_0x77b4('0x36')](db[_0x77b4('0x46')][_0x77b4('0x31')]);_0x22377d[_0x77b4('0x37')]=_[_0x77b4('0x36')](_0x5f1f19[_0x77b4('0x37')]);_0x22377d[_0x77b4('0x38')]=_['intersection'](_0x22377d['model'],_0x22377d[_0x77b4('0x37')]);_0x3e335d[_0x77b4('0x3b')]=_[_0x77b4('0x39')](_0x22377d[_0x77b4('0x35')],qs[_0x77b4('0x3a')](_0x5f1f19[_0x77b4('0x37')][_0x77b4('0x3a')]));_0x3e335d[_0x77b4('0x3b')]=_0x3e335d[_0x77b4('0x3b')]['length']?_0x3e335d[_0x77b4('0x3b')]:_0x22377d[_0x77b4('0x35')];if(_0x5f1f19[_0x77b4('0x37')][_0x77b4('0x4b')]){_0x3e335d[_0x77b4('0x47')]=[{'all':!![]}];}_0x3e335d=_[_0x77b4('0x43')]({},_0x3e335d,_0x5f1f19[_0x77b4('0x45')]);return db[_0x77b4('0x46')]['find'](_0x3e335d)[_0x77b4('0x2c')](handleEntityNotFound(_0xea2a32,null))[_0x77b4('0x2c')](respondWithResult(_0xea2a32,null))['catch'](handleError(_0xea2a32,null));};exports[_0x77b4('0x4c')]=function(_0x31ce11,_0x2b0ffd){return db[_0x77b4('0x46')]['create'](_0x31ce11[_0x77b4('0x4d')],{})['then'](respondWithResult(_0x2b0ffd,0xc9))['catch'](handleError(_0x2b0ffd,null));};exports['update']=function(_0x49b935,_0x9e6645){if(_0x49b935[_0x77b4('0x4d')]['id']){delete _0x49b935[_0x77b4('0x4d')]['id'];}return db[_0x77b4('0x46')][_0x77b4('0x4e')]({'where':{'id':_0x49b935[_0x77b4('0x4a')]['id']}})[_0x77b4('0x2c')](handleEntityNotFound(_0x9e6645,null))[_0x77b4('0x2c')](saveUpdates(_0x49b935['body'],null))['then'](respondWithResult(_0x9e6645,null))[_0x77b4('0x4f')](handleError(_0x9e6645,null));};exports[_0x77b4('0x2d')]=function(_0x414d67,_0x5cb2be){return db['ChatInternalMessage'][_0x77b4('0x4e')]({'where':{'id':_0x414d67[_0x77b4('0x4a')]['id']}})[_0x77b4('0x2c')](handleEntityNotFound(_0x5cb2be,null))[_0x77b4('0x2c')](removeEntity(_0x5cb2be,null))[_0x77b4('0x4f')](handleError(_0x5cb2be,null));};exports['describe']=function(_0x18f6f1,_0x24268d){return db[_0x77b4('0x46')]['describe']()['then'](respondWithResult(_0x24268d,null))['catch'](handleError(_0x24268d,null));};function wrapUser(_0x5cd119){return function(_0x1f2026){var _0x57c9b4=_0x5cd119[_0x77b4('0x50')]({'plain':!![]});_0x57c9b4['messages']=[];if(_0x1f2026){_0x57c9b4['lastMessageAt']=_0x1f2026['createdAt'];_0x57c9b4[_0x77b4('0x51')]=_0x1f2026;}else{_0x57c9b4['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x57c9b4[_0x77b4('0x51')]={};}return _0x57c9b4;};}exports[_0x77b4('0x52')]=function(_0x4a45c4,_0x42f5dd,_0x3fa5cd){var _0x44b8df=[];return db['User']['findAll']({'where':{'role':['agent',_0x77b4('0x53'),_0x77b4('0x54')]},'attributes':['id','fullname',_0x77b4('0x2f'),'role',_0x77b4('0x55'),_0x77b4('0x56'),_0x77b4('0x57'),_0x77b4('0x58'),_0x77b4('0x59'),_0x77b4('0x5a')],'order':qs[_0x77b4('0x3f')](_0x77b4('0x5b')),'include':[{'model':db[_0x77b4('0x5c')],'as':_0x77b4('0x5d'),'attributes':['id',_0x77b4('0x2f'),_0x77b4('0x33')],'through':{'attributes':[]}}]})[_0x77b4('0x2c')](function(_0xe69ca2){if(_0xe69ca2){var _0x232d2a=_0x4a45c4[_0x77b4('0x54')]['get']({'plain':!![]});if(!_0x232d2a)throw new Error(_0x77b4('0x5e'));if(_0x232d2a[_0x77b4('0x5f')]===_0x77b4('0x54')){return db[_0x77b4('0x60')][_0x77b4('0x4e')]({'where':{'name':'Agents','userProfileId':_0x232d2a[_0x77b4('0x61')]},'raw':!![]})[_0x77b4('0x2c')](function(_0x1e3736){if(_0x1e3736){if(_0x1e3736[_0x77b4('0x62')]===0x0){return db['UserProfileResource'][_0x77b4('0x48')]({'where':{'sectionId':_0x1e3736['id']},'raw':!![]})[_0x77b4('0x2c')](function(_0x108e1e){var _0x2a12ca=[];if(_[_0x77b4('0x63')](_0x108e1e)){_0x2a12ca=_[_0x77b4('0x42')](_0xe69ca2,function(_0x508bf9){if(_0x508bf9[_0x77b4('0x5f')]!==_0x77b4('0x64')){return _0x508bf9;}});return _0x2a12ca;}else{for(var _0x53105e=0x0;_0x53105e<_0xe69ca2[_0x77b4('0x3c')];_0x53105e++){var _0x4aff4d=_0xe69ca2[_0x53105e];if(_0x4aff4d[_0x77b4('0x5f')]===_0x77b4('0x64')){var _0x4027e1=_[_0x77b4('0x4e')](_0x108e1e,function(_0x5a62b4){return _0x5a62b4[_0x77b4('0x65')]===_0x4aff4d['id'];});if(_0x4027e1)_0x2a12ca[_0x77b4('0x66')](_0x4aff4d);}else{_0x2a12ca[_0x77b4('0x66')](_0x4aff4d);}}return _0x2a12ca;}});}else{return _0xe69ca2;}}else{var _0x197d48=_['filter'](_0xe69ca2,function(_0x5f29f5){if(_0x5f29f5['role']!==_0x77b4('0x64')){return _0x5f29f5;}});return _0x197d48;}});}else{return _0xe69ca2;}}})[_0x77b4('0x2c')](function(_0x455bc0){var _0x360569=[];if(_0x455bc0){_0x44b8df=_0x455bc0;for(var _0xb245=0x0;_0xb245<_0x455bc0[_0x77b4('0x3c')];_0xb245+=0x1){_0x44b8df[_0xb245][_0x77b4('0x67')]=[];_0x360569[_0x77b4('0x66')](db[_0x77b4('0x46')][_0x77b4('0x4e')]({'where':{'FromId':[_0x4a45c4[_0x77b4('0x54')]['id'],_0x455bc0[_0xb245]['id']],'ToId':[_0x4a45c4[_0x77b4('0x54')]['id'],_0x455bc0[_0xb245]['id']],'ChatGroupId':null},'attributes':['id',_0x77b4('0x68'),_0x77b4('0x69'),_0x77b4('0x6a'),_0x77b4('0x6b'),_0x77b4('0x4d')],'order':qs[_0x77b4('0x3f')](_0x77b4('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x455bc0[_0xb245])));}return BPromise[_0x77b4('0x6d')](_0x360569);}return[];})[_0x77b4('0x2c')](function(_0x5c2b89){return{'rows':_0x5c2b89,'count':_0x5c2b89['length']};})[_0x77b4('0x2c')](respondWithResult(_0x42f5dd,null))[_0x77b4('0x4f')](handleError(_0x42f5dd,null));}; \ No newline at end of file +var _0x1a4e=['UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','send','index','ChatInternalMessage','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','update','describe','get','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','findAll','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x50af15,_0x414b26){var _0x504174=function(_0x49fc73){while(--_0x49fc73){_0x50af15['push'](_0x50af15['shift']());}};_0x504174(++_0x414b26);}(_0x1a4e,0x83));var _0xe1a4=function(_0x2b18c9,_0x49659f){_0x2b18c9=_0x2b18c9-0x0;var _0x8b913c=_0x1a4e[_0x2b18c9];return _0x8b913c;};'use strict';var emlformat=require(_0xe1a4('0x0'));var rimraf=require(_0xe1a4('0x1'));var zipdir=require(_0xe1a4('0x2'));var jsonpatch=require(_0xe1a4('0x3'));var rp=require(_0xe1a4('0x4'));var moment=require(_0xe1a4('0x5'));var BPromise=require(_0xe1a4('0x6'));var Mustache=require(_0xe1a4('0x7'));var util=require(_0xe1a4('0x8'));var path=require(_0xe1a4('0x9'));var sox=require(_0xe1a4('0xa'));var csv=require(_0xe1a4('0xb'));var ejs=require(_0xe1a4('0xc'));var fs=require('fs');var fs_extra=require(_0xe1a4('0xd'));var _=require(_0xe1a4('0xe'));var squel=require('squel');var crypto=require(_0xe1a4('0xf'));var jsforce=require(_0xe1a4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe1a4('0xb'));var querystring=require(_0xe1a4('0x11'));var Papa=require(_0xe1a4('0x12'));var Redis=require(_0xe1a4('0x13'));var authService=require(_0xe1a4('0x14'));var qs=require(_0xe1a4('0x15'));var as=require(_0xe1a4('0x16'));var hardwareService=require(_0xe1a4('0x17'));var logger=require(_0xe1a4('0x18'))(_0xe1a4('0x19'));var utils=require('../../config/utils');var config=require(_0xe1a4('0x1a'));var licenseUtil=require(_0xe1a4('0x1b'));var db=require(_0xe1a4('0x1c'))['db'];config[_0xe1a4('0x1d')]=_['defaults'](config['redis'],{'host':_0xe1a4('0x1e'),'port':0x18eb});var socket=require(_0xe1a4('0x1f'))(new Redis(config[_0xe1a4('0x1d')]));require('./chatInternalMessage.socket')[_0xe1a4('0x20')](socket);function respondWithStatusCode(_0x347138,_0x1b6a5a){_0x1b6a5a=_0x1b6a5a||0xcc;return function(_0xc7db92){if(_0xc7db92){return _0x347138[_0xe1a4('0x21')](_0x1b6a5a);}return _0x347138[_0xe1a4('0x22')](_0x1b6a5a)[_0xe1a4('0x23')]();};}function respondWithResult(_0x183065,_0xb9a353){_0xb9a353=_0xb9a353||0xc8;return function(_0x50bea4){if(_0x50bea4){return _0x183065[_0xe1a4('0x22')](_0xb9a353)[_0xe1a4('0x24')](_0x50bea4);}};}function respondWithFilteredResult(_0x5eeb85,_0x234313){return function(_0x4feaa9){if(_0x4feaa9){var _0x5547fc=typeof _0x234313[_0xe1a4('0x25')]===_0xe1a4('0x26')&&typeof _0x234313[_0xe1a4('0x27')]==='undefined';var _0x3bf6df=_0x4feaa9[_0xe1a4('0x28')];var _0xe82d06=_0x5547fc?0x0:_0x234313[_0xe1a4('0x25')];var _0x12008c=_0x5547fc?_0x4feaa9['count']:_0x234313[_0xe1a4('0x25')]+_0x234313[_0xe1a4('0x27')];var _0x270426;if(_0x12008c>=_0x3bf6df){_0x12008c=_0x3bf6df;_0x270426=0xc8;}else{_0x270426=0xce;}_0x5eeb85[_0xe1a4('0x22')](_0x270426);return _0x5eeb85['set'](_0xe1a4('0x29'),_0xe82d06+'-'+_0x12008c+'/'+_0x3bf6df)['json'](_0x4feaa9);}return null;};}function patchUpdates(_0x2405ba){return function(_0x2fe904){try{jsonpatch[_0xe1a4('0x2a')](_0x2fe904,_0x2405ba,!![]);}catch(_0x2f9dd1){return BPromise['reject'](_0x2f9dd1);}return _0x2fe904[_0xe1a4('0x2b')]();};}function saveUpdates(_0x28aa9a,_0x15cba7){return function(_0x411f93){if(_0x411f93){return _0x411f93['update'](_0x28aa9a)[_0xe1a4('0x2c')](function(_0x49dec8){return _0x49dec8;});}return null;};}function removeEntity(_0x36ecdd,_0x498e02){return function(_0x35843){if(_0x35843){return _0x35843[_0xe1a4('0x2d')]()['then'](function(){_0x36ecdd[_0xe1a4('0x22')](0xcc)[_0xe1a4('0x23')]();});}};}function handleEntityNotFound(_0x56e611,_0x2519d2){return function(_0x310809){if(!_0x310809){_0x56e611[_0xe1a4('0x21')](0x194);}return _0x310809;};}function handleError(_0x5794b3,_0x2c9070){_0x2c9070=_0x2c9070||0x1f4;return function(_0x1fb0ae){logger[_0xe1a4('0x2e')](_0x1fb0ae['stack']);if(_0x1fb0ae[_0xe1a4('0x2f')]){delete _0x1fb0ae[_0xe1a4('0x2f')];}_0x5794b3[_0xe1a4('0x22')](_0x2c9070)[_0xe1a4('0x30')](_0x1fb0ae);};}exports[_0xe1a4('0x31')]=function(_0x3c4b18,_0x2b421a){var _0x4cbe04={},_0x4e5c2e={},_0x1f0e97={'count':0x0,'rows':[]};var _0x391c07=_['map'](db[_0xe1a4('0x32')]['rawAttributes'],function(_0x2b8650){return{'name':_0x2b8650[_0xe1a4('0x33')],'type':_0x2b8650[_0xe1a4('0x34')][_0xe1a4('0x35')]};});_0x4e5c2e[_0xe1a4('0x36')]=_[_0xe1a4('0x37')](_0x391c07,_0xe1a4('0x2f'));_0x4e5c2e[_0xe1a4('0x38')]=_[_0xe1a4('0x39')](_0x3c4b18[_0xe1a4('0x38')]);_0x4e5c2e[_0xe1a4('0x3a')]=_[_0xe1a4('0x3b')](_0x4e5c2e[_0xe1a4('0x36')],_0x4e5c2e[_0xe1a4('0x38')]);_0x4cbe04[_0xe1a4('0x3c')]=_[_0xe1a4('0x3b')](_0x4e5c2e['model'],qs['fields'](_0x3c4b18[_0xe1a4('0x38')][_0xe1a4('0x3d')]));_0x4cbe04[_0xe1a4('0x3c')]=_0x4cbe04[_0xe1a4('0x3c')][_0xe1a4('0x3e')]?_0x4cbe04[_0xe1a4('0x3c')]:_0x4e5c2e[_0xe1a4('0x36')];if(!_0x3c4b18[_0xe1a4('0x38')][_0xe1a4('0x3f')](_0xe1a4('0x40'))){_0x4cbe04['limit']=qs['limit'](_0x3c4b18['query'][_0xe1a4('0x27')]);_0x4cbe04[_0xe1a4('0x25')]=qs['offset'](_0x3c4b18[_0xe1a4('0x38')][_0xe1a4('0x25')]);}_0x4cbe04[_0xe1a4('0x41')]=qs['sort'](_0x3c4b18[_0xe1a4('0x38')][_0xe1a4('0x42')]);_0x4cbe04[_0xe1a4('0x43')]=qs[_0xe1a4('0x3a')](_['pick'](_0x3c4b18['query'],_0x4e5c2e[_0xe1a4('0x3a')]),_0x391c07);if(_0x3c4b18['query'][_0xe1a4('0x44')]){_0x4cbe04['where']=_[_0xe1a4('0x45')](_0x4cbe04[_0xe1a4('0x43')],{'$or':_[_0xe1a4('0x37')](_0x391c07,function(_0x3cfad7){if(_0x3cfad7[_0xe1a4('0x34')]!==_0xe1a4('0x46')){var _0x1aae9b={};_0x1aae9b[_0x3cfad7[_0xe1a4('0x2f')]]={'$like':'%'+_0x3c4b18[_0xe1a4('0x38')]['filter']+'%'};return _0x1aae9b;}})});}_0x4cbe04=_[_0xe1a4('0x45')]({},_0x4cbe04,_0x3c4b18[_0xe1a4('0x47')]);var _0x5ad867={'where':_0x4cbe04[_0xe1a4('0x43')]};return db['ChatInternalMessage']['count'](_0x5ad867)[_0xe1a4('0x2c')](function(_0x5a6ee5){_0x1f0e97[_0xe1a4('0x28')]=_0x5a6ee5;if(_0x3c4b18['query'][_0xe1a4('0x48')]){_0x4cbe04[_0xe1a4('0x49')]=[{'all':!![]}];}return db[_0xe1a4('0x32')]['findAll'](_0x4cbe04);})[_0xe1a4('0x2c')](function(_0x507b65){_0x1f0e97[_0xe1a4('0x4a')]=_0x507b65;return _0x1f0e97;})[_0xe1a4('0x2c')](respondWithFilteredResult(_0x2b421a,_0x4cbe04))[_0xe1a4('0x4b')](handleError(_0x2b421a,null));};exports[_0xe1a4('0x4c')]=function(_0x241138,_0x4f8c21){var _0x5620fd={'raw':!![],'where':{'id':_0x241138[_0xe1a4('0x4d')]['id']}},_0x1421fe={};_0x1421fe[_0xe1a4('0x36')]=_['keys'](db[_0xe1a4('0x32')][_0xe1a4('0x4e')]);_0x1421fe[_0xe1a4('0x38')]=_[_0xe1a4('0x39')](_0x241138['query']);_0x1421fe[_0xe1a4('0x3a')]=_['intersection'](_0x1421fe['model'],_0x1421fe[_0xe1a4('0x38')]);_0x5620fd[_0xe1a4('0x3c')]=_[_0xe1a4('0x3b')](_0x1421fe[_0xe1a4('0x36')],qs[_0xe1a4('0x3d')](_0x241138[_0xe1a4('0x38')][_0xe1a4('0x3d')]));_0x5620fd[_0xe1a4('0x3c')]=_0x5620fd[_0xe1a4('0x3c')][_0xe1a4('0x3e')]?_0x5620fd[_0xe1a4('0x3c')]:_0x1421fe[_0xe1a4('0x36')];if(_0x241138[_0xe1a4('0x38')]['includeAll']){_0x5620fd[_0xe1a4('0x49')]=[{'all':!![]}];}_0x5620fd=_[_0xe1a4('0x45')]({},_0x5620fd,_0x241138[_0xe1a4('0x47')]);return db['ChatInternalMessage'][_0xe1a4('0x4f')](_0x5620fd)[_0xe1a4('0x2c')](handleEntityNotFound(_0x4f8c21,null))[_0xe1a4('0x2c')](respondWithResult(_0x4f8c21,null))[_0xe1a4('0x4b')](handleError(_0x4f8c21,null));};exports[_0xe1a4('0x50')]=function(_0x46a8e6,_0x3bfeed){return db[_0xe1a4('0x32')][_0xe1a4('0x50')](_0x46a8e6[_0xe1a4('0x51')],{})['then'](respondWithResult(_0x3bfeed,0xc9))[_0xe1a4('0x4b')](handleError(_0x3bfeed,null));};exports[_0xe1a4('0x52')]=function(_0x413c4d,_0x1196d1){if(_0x413c4d[_0xe1a4('0x51')]['id']){delete _0x413c4d[_0xe1a4('0x51')]['id'];}return db[_0xe1a4('0x32')][_0xe1a4('0x4f')]({'where':{'id':_0x413c4d[_0xe1a4('0x4d')]['id']}})[_0xe1a4('0x2c')](handleEntityNotFound(_0x1196d1,null))[_0xe1a4('0x2c')](saveUpdates(_0x413c4d['body'],null))['then'](respondWithResult(_0x1196d1,null))['catch'](handleError(_0x1196d1,null));};exports[_0xe1a4('0x2d')]=function(_0x4c6bd2,_0x212b31){return db[_0xe1a4('0x32')][_0xe1a4('0x4f')]({'where':{'id':_0x4c6bd2['params']['id']}})[_0xe1a4('0x2c')](handleEntityNotFound(_0x212b31,null))[_0xe1a4('0x2c')](removeEntity(_0x212b31,null))[_0xe1a4('0x4b')](handleError(_0x212b31,null));};exports['describe']=function(_0xecb3df,_0xf93846){return db[_0xe1a4('0x32')][_0xe1a4('0x53')]()['then'](respondWithResult(_0xf93846,null))[_0xe1a4('0x4b')](handleError(_0xf93846,null));};function wrapUser(_0x5628b3){return function(_0x5df5e1){var _0x4a850f=_0x5628b3[_0xe1a4('0x54')]({'plain':!![]});_0x4a850f[_0xe1a4('0x55')]=[];if(_0x5df5e1){_0x4a850f[_0xe1a4('0x56')]=_0x5df5e1['createdAt'];_0x4a850f['lastMessage']=_0x5df5e1;}else{_0x4a850f['lastMessageAt']=moment(0x0)[_0xe1a4('0x57')](_0xe1a4('0x58'));_0x4a850f[_0xe1a4('0x59')]={};}return _0x4a850f;};}exports['getUsers']=function(_0x2b5d00,_0x204831,_0x1e9941){var _0x50fa01=[];return db[_0xe1a4('0x5a')][_0xe1a4('0x5b')]({'where':{'role':[_0xe1a4('0x5c'),_0xe1a4('0x5d'),_0xe1a4('0x5e')]},'attributes':['id','fullname',_0xe1a4('0x2f'),_0xe1a4('0x5f'),_0xe1a4('0x60'),_0xe1a4('0x61'),_0xe1a4('0x62'),_0xe1a4('0x63'),_0xe1a4('0x64'),_0xe1a4('0x65')],'order':qs[_0xe1a4('0x42')](_0xe1a4('0x66')),'include':[{'model':db['VoiceQueue'],'as':_0xe1a4('0x67'),'attributes':['id',_0xe1a4('0x2f'),_0xe1a4('0x34')],'through':{'attributes':[]}}]})[_0xe1a4('0x2c')](function(_0x594297){if(_0x594297){var _0x180111=_0x2b5d00[_0xe1a4('0x5e')][_0xe1a4('0x54')]({'plain':!![]});if(!_0x180111)throw new Error(_0xe1a4('0x68'));if(_0x180111[_0xe1a4('0x5f')]===_0xe1a4('0x5e')){return db[_0xe1a4('0x69')][_0xe1a4('0x4f')]({'where':{'name':_0xe1a4('0x6a'),'userProfileId':_0x180111[_0xe1a4('0x6b')]},'raw':!![]})['then'](function(_0x3d0c43){if(_0x3d0c43){if(_0x3d0c43['autoAssociation']===0x0){return db[_0xe1a4('0x6c')]['findAll']({'where':{'sectionId':_0x3d0c43['id']},'raw':!![]})[_0xe1a4('0x2c')](function(_0x27eac1){var _0x371130=[];if(_[_0xe1a4('0x6d')](_0x27eac1)){_0x371130=_[_0xe1a4('0x44')](_0x594297,function(_0x2d604a){if(_0x2d604a[_0xe1a4('0x5f')]!==_0xe1a4('0x5c')){return _0x2d604a;}});return _0x371130;}else{for(var _0x41d501=0x0;_0x41d501<_0x594297['length'];_0x41d501++){var _0x4f8577=_0x594297[_0x41d501];if(_0x4f8577[_0xe1a4('0x5f')]===_0xe1a4('0x5c')){var _0x54d65f=_['find'](_0x27eac1,function(_0x4e86d5){return _0x4e86d5[_0xe1a4('0x6e')]===_0x4f8577['id'];});if(_0x54d65f)_0x371130[_0xe1a4('0x6f')](_0x4f8577);}else{_0x371130[_0xe1a4('0x6f')](_0x4f8577);}}return _0x371130;}});}else{return _0x594297;}}else{var _0x24b840=_[_0xe1a4('0x44')](_0x594297,function(_0x34b3b9){if(_0x34b3b9[_0xe1a4('0x5f')]!=='agent'){return _0x34b3b9;}});return _0x24b840;}});}else{return _0x594297;}}})[_0xe1a4('0x2c')](function(_0x17f585){var _0x3892e6=[];if(_0x17f585){_0x50fa01=_0x17f585;for(var _0x3855c8=0x0;_0x3855c8<_0x17f585['length'];_0x3855c8+=0x1){_0x50fa01[_0x3855c8][_0xe1a4('0x55')]=[];_0x3892e6[_0xe1a4('0x6f')](db[_0xe1a4('0x32')][_0xe1a4('0x4f')]({'where':{'FromId':[_0x2b5d00[_0xe1a4('0x5e')]['id'],_0x17f585[_0x3855c8]['id']],'ToId':[_0x2b5d00[_0xe1a4('0x5e')]['id'],_0x17f585[_0x3855c8]['id']],'ChatGroupId':null},'attributes':['id',_0xe1a4('0x70'),_0xe1a4('0x71'),_0xe1a4('0x72'),_0xe1a4('0x73'),_0xe1a4('0x51')],'order':qs[_0xe1a4('0x42')](_0xe1a4('0x74')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe1a4('0x2c')](wrapUser(_0x17f585[_0x3855c8])));}return BPromise[_0xe1a4('0x75')](_0x3892e6);}return[];})[_0xe1a4('0x2c')](function(_0xf52589){return{'rows':_0xf52589,'count':_0xf52589['length']};})[_0xe1a4('0x2c')](respondWithResult(_0x204831,null))['catch'](handleError(_0x204831,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a8f72d9..18e106c 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 _0x5a7e=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','remove','emit'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x5a7e,0x8a));var _0xe5a7=function(_0x49ee25,_0x11b0ed){_0x49ee25=_0x49ee25-0x0;var _0x1df72d=_0x5a7e[_0x49ee25];return _0x1df72d;};'use strict';var EventEmitter=require(_0xe5a7('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe5a7('0x1')](0x0);var events={'afterCreate':_0xe5a7('0x2'),'afterUpdate':_0xe5a7('0x3'),'afterDestroy':_0xe5a7('0x4')};function emitEvent(_0x4eb7a2){return function(_0x969b08,_0x5eade9,_0x5c043f){ChatInternalMessageEvents[_0xe5a7('0x5')](_0x4eb7a2+':'+_0x969b08['id'],_0x969b08);ChatInternalMessageEvents[_0xe5a7('0x5')](_0x4eb7a2,_0x969b08);_0x5c043f(null);};}for(var e in events){if(events[_0xe5a7('0x6')](e)){var event=events[e];ChatInternalMessage[_0xe5a7('0x7')](e,emitEvent(event));}}module[_0xe5a7('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x971e=['remove','emit','exports','events','ChatInternalMessage','setMaxListeners'];(function(_0x3eaf06,_0x1bf08d){var _0x4b16d2=function(_0xc1b0df){while(--_0xc1b0df){_0x3eaf06['push'](_0x3eaf06['shift']());}};_0x4b16d2(++_0x1bf08d);}(_0x971e,0x165));var _0xe971=function(_0x17cbb6,_0x42b712){_0x17cbb6=_0x17cbb6-0x0;var _0x1e26d0=_0x971e[_0x17cbb6];return _0x1e26d0;};'use strict';var EventEmitter=require(_0xe971('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xe971('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe971('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe971('0x3')};function emitEvent(_0x57e1ca){return function(_0x33c241,_0x13241d,_0x2a80d9){ChatInternalMessageEvents[_0xe971('0x4')](_0x57e1ca+':'+_0x33c241['id'],_0x33c241);ChatInternalMessageEvents[_0xe971('0x4')](_0x57e1ca,_0x33c241);_0x2a80d9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xe971('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 6354e11..6a282c4 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 _0xc8b6=['rimraf','define','ChatInternalMessage','chat_internal_messages','lodash','../../config/logger','moment','path'];(function(_0x37b27a,_0x5b5d6b){var _0x5c46cd=function(_0x4ba99a){while(--_0x4ba99a){_0x37b27a['push'](_0x37b27a['shift']());}};_0x5c46cd(++_0x5b5d6b);}(_0xc8b6,0xec));var _0x6c8b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc8b6[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6c8b('0x0'));var util=require('util');var logger=require(_0x6c8b('0x1'))('api');var moment=require(_0x6c8b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6c8b('0x3'));var rimraf=require(_0x6c8b('0x4'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x2faf94,_0x2a66c6){return _0x2faf94[_0x6c8b('0x5')](_0x6c8b('0x6'),attributes,{'tableName':_0x6c8b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x61c6=['../../config/environment','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x56f220,_0x9e6544){var _0x187aaa=function(_0xe56fe2){while(--_0xe56fe2){_0x56f220['push'](_0x56f220['shift']());}};_0x187aaa(++_0x9e6544);}(_0x61c6,0x1b6));var _0x661c=function(_0xf4acec,_0x3a6598){_0xf4acec=_0xf4acec-0x0;var _0x3934cf=_0x61c6[_0xf4acec];return _0x3934cf;};'use strict';var _=require('lodash');var util=require(_0x661c('0x0'));var logger=require(_0x661c('0x1'))(_0x661c('0x2'));var moment=require('moment');var BPromise=require(_0x661c('0x3'));var rp=require(_0x661c('0x4'));var fs=require('fs');var path=require(_0x661c('0x5'));var rimraf=require('rimraf');var config=require(_0x661c('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x661c('0x7')]=function(_0x182e0b,_0x162e7d){return _0x182e0b[_0x661c('0x8')](_0x661c('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x661c('0xa'),'collate':_0x661c('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 560cbbd..47be6c0 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 _0xcbcc=['request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x54693a,_0xa0d431){var _0x129c79=function(_0x36d52c){while(--_0x36d52c){_0x54693a['push'](_0x54693a['shift']());}};_0x129c79(++_0xa0d431);}(_0xcbcc,0x198));var _0xccbc=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xcbcc[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xccbc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xccbc('0x1'));var rs=require(_0xccbc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xccbc('0x3'))['db'];var utils=require(_0xccbc('0x4'));var logger=require(_0xccbc('0x5'))(_0xccbc('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xccbc('0x7')]({'port':0x232a});config[_0xccbc('0x8')]=_[_0xccbc('0x9')](config[_0xccbc('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xccbc('0xa'))(new Redis(config[_0xccbc('0x8')]));require(_0xccbc('0xb'))['register'](socket);function respondWithRpcPromise(_0x13b5bd,_0x2fef4d,_0x10a5a4){return new BPromise(function(_0x52b327,_0x232aa7){return client[_0xccbc('0xc')](_0x13b5bd,_0x10a5a4)[_0xccbc('0xd')](function(_0x3b2857){logger[_0xccbc('0xe')](_0xccbc('0xf'),_0x2fef4d,_0xccbc('0x10'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x2fef4d,_0xccbc('0x10'),JSON['stringify'](_0x3b2857));if(_0x3b2857[_0xccbc('0x11')]){if(_0x3b2857[_0xccbc('0x11')][_0xccbc('0x12')]===0x1f4){logger['error'](_0xccbc('0xf'),_0x2fef4d,_0x3b2857['error'][_0xccbc('0x13')]);return _0x232aa7(_0x3b2857[_0xccbc('0x11')][_0xccbc('0x13')]);}logger[_0xccbc('0x11')](_0xccbc('0xf'),_0x2fef4d,_0x3b2857[_0xccbc('0x11')]['message']);return _0x52b327(_0x3b2857['error'][_0xccbc('0x13')]);}else{logger[_0xccbc('0xe')](_0xccbc('0xf'),_0x2fef4d,_0xccbc('0x10'));_0x52b327(_0x3b2857['result']['message']);}})[_0xccbc('0x14')](function(_0x46e4a4){logger[_0xccbc('0x11')](_0xccbc('0xf'),_0x2fef4d,_0x46e4a4);_0x232aa7(_0x46e4a4);});});} \ No newline at end of file +var _0xeea2=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug'];(function(_0x25c1b2,_0x1624c8){var _0x1e8f96=function(_0x460ed3){while(--_0x460ed3){_0x25c1b2['push'](_0x25c1b2['shift']());}};_0x1e8f96(++_0x1624c8);}(_0xeea2,0xce));var _0x2eea=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xeea2[_0x4b7895];return _0x264180;};'use strict';var _=require(_0x2eea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2eea('0x1'));var rs=require(_0x2eea('0x2'));var fs=require('fs');var Redis=require(_0x2eea('0x3'));var db=require(_0x2eea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2eea('0x5'))(_0x2eea('0x6'));var config=require(_0x2eea('0x7'));var jayson=require(_0x2eea('0x8'));var client=jayson[_0x2eea('0x9')]['http']({'port':0x232a});config[_0x2eea('0xa')]=_[_0x2eea('0xb')](config[_0x2eea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2eea('0xc'))(new Redis(config[_0x2eea('0xa')]));require(_0x2eea('0xd'))[_0x2eea('0xe')](socket);function respondWithRpcPromise(_0x2f3f11,_0x69b56c,_0x91a058){return new BPromise(function(_0x44fbd8,_0x295f0b){return client[_0x2eea('0xf')](_0x2f3f11,_0x91a058)['then'](function(_0x103c00){logger[_0x2eea('0x10')](_0x2eea('0x11'),_0x69b56c,'request\x20sent');logger[_0x2eea('0x12')](_0x2eea('0x13'),_0x69b56c,'request\x20sent',JSON['stringify'](_0x103c00));if(_0x103c00[_0x2eea('0x14')]){if(_0x103c00[_0x2eea('0x14')][_0x2eea('0x15')]===0x1f4){logger[_0x2eea('0x14')](_0x2eea('0x11'),_0x69b56c,_0x103c00['error']['message']);return _0x295f0b(_0x103c00[_0x2eea('0x14')][_0x2eea('0x16')]);}logger[_0x2eea('0x14')](_0x2eea('0x11'),_0x69b56c,_0x103c00['error'][_0x2eea('0x16')]);return _0x44fbd8(_0x103c00[_0x2eea('0x14')][_0x2eea('0x16')]);}else{logger[_0x2eea('0x10')](_0x2eea('0x11'),_0x69b56c,_0x2eea('0x17'));_0x44fbd8(_0x103c00['result'][_0x2eea('0x16')]);}})[_0x2eea('0x18')](function(_0x17eac3){logger[_0x2eea('0x14')](_0x2eea('0x11'),_0x69b56c,_0x17eac3);_0x295f0b(_0x17eac3);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 25b82f9..fbe6e9c 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 _0x41ab=['length','chatInternalMessage:','./chatInternalMessage.events','remove','update','removeListener','register'];(function(_0x57b092,_0x33cc77){var _0x4a15b0=function(_0x316c74){while(--_0x316c74){_0x57b092['push'](_0x57b092['shift']());}};_0x4a15b0(++_0x33cc77);}(_0x41ab,0x11a));var _0xb41a=function(_0x1bb191,_0x552afb){_0x1bb191=_0x1bb191-0x0;var _0x31b09f=_0x41ab[_0x1bb191];return _0x31b09f;};'use strict';var ChatInternalMessageEvents=require(_0xb41a('0x0'));var events=['save',_0xb41a('0x1'),_0xb41a('0x2')];function createListener(_0x3df202,_0x30e817){return function(_0xbccfd4){_0x30e817['emit'](_0x3df202,_0xbccfd4);};}function removeListener(_0x2b0a29,_0x569b90){return function(){ChatInternalMessageEvents[_0xb41a('0x3')](_0x2b0a29,_0x569b90);};}exports[_0xb41a('0x4')]=function(_0x1ace83){for(var _0x5a3592=0x0,_0x384e64=events[_0xb41a('0x5')];_0x5a3592<_0x384e64;_0x5a3592++){var _0x5ec831=events[_0x5a3592];var _0x3b79fb=createListener(_0xb41a('0x6')+_0x5ec831,_0x1ace83);ChatInternalMessageEvents['on'](_0x5ec831,_0x3b79fb);}}; \ No newline at end of file +var _0x0834=['removeListener','register','length','chatInternalMessage:','update','emit'];(function(_0x5951a7,_0x24e83f){var _0x593dcf=function(_0x431184){while(--_0x431184){_0x5951a7['push'](_0x5951a7['shift']());}};_0x593dcf(++_0x24e83f);}(_0x0834,0x154));var _0x4083=function(_0x5d232c,_0x54463a){_0x5d232c=_0x5d232c-0x0;var _0x2292a4=_0x0834[_0x5d232c];return _0x2292a4;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove',_0x4083('0x0')];function createListener(_0x37275a,_0x4138ea){return function(_0xac8bef){_0x4138ea[_0x4083('0x1')](_0x37275a,_0xac8bef);};}function removeListener(_0x4d0884,_0xcd8c37){return function(){ChatInternalMessageEvents[_0x4083('0x2')](_0x4d0884,_0xcd8c37);};}exports[_0x4083('0x3')]=function(_0x39481b){for(var _0x2ed7a6=0x0,_0x4a9408=events[_0x4083('0x4')];_0x2ed7a6<_0x4a9408;_0x2ed7a6++){var _0x44b1fc=events[_0x2ed7a6];var _0x3fe1e5=createListener(_0x4083('0x5')+_0x44b1fc,_0x39481b);ChatInternalMessageEvents['on'](_0x44b1fc,_0x3fe1e5);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 538d989..270a6e7 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 _0xc056=['post','create','put','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x646199,_0x22dadf){var _0xaef0a2=function(_0x484940){while(--_0x484940){_0x646199['push'](_0x646199['shift']());}};_0xaef0a2(++_0x22dadf);}(_0xc056,0x1a2));var _0x6c05=function(_0x4b024c,_0x43354d){_0x4b024c=_0x4b024c-0x0;var _0x286e45=_0xc056[_0x4b024c];return _0x286e45;};'use strict';var multer=require(_0x6c05('0x0'));var util=require(_0x6c05('0x1'));var path=require(_0x6c05('0x2'));var timeout=require(_0x6c05('0x3'));var express=require('express');var router=express[_0x6c05('0x4')]();var fs_extra=require(_0x6c05('0x5'));var auth=require(_0x6c05('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6c05('0x7'));router[_0x6c05('0x8')]('/',auth['isAuthenticated'](),controller[_0x6c05('0x9')]);router['get'](_0x6c05('0xa'),auth[_0x6c05('0xb')](),controller['describe']);router[_0x6c05('0x8')]('/users',auth[_0x6c05('0xb')](),controller['getUsers']);router[_0x6c05('0x8')](_0x6c05('0xc'),auth[_0x6c05('0xb')](),controller[_0x6c05('0xd')]);router[_0x6c05('0xe')]('/',auth[_0x6c05('0xb')](),controller[_0x6c05('0xf')]);router[_0x6c05('0x10')](_0x6c05('0xc'),controller['update']);router['delete']('/:id',auth[_0x6c05('0xb')](),controller[_0x6c05('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4f36=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','create','put','delete','destroy','multer','util','connect-timeout'];(function(_0x3cf4e6,_0xdfcbe4){var _0x4c1e62=function(_0x33d1d7){while(--_0x33d1d7){_0x3cf4e6['push'](_0x3cf4e6['shift']());}};_0x4c1e62(++_0xdfcbe4);}(_0x4f36,0x6b));var _0x64f3=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x4f36[_0x5447aa];return _0xb21e53;};'use strict';var multer=require(_0x64f3('0x0'));var util=require(_0x64f3('0x1'));var path=require('path');var timeout=require(_0x64f3('0x2'));var express=require(_0x64f3('0x3'));var router=express['Router']();var fs_extra=require(_0x64f3('0x4'));var auth=require(_0x64f3('0x5'));var interaction=require(_0x64f3('0x6'));var config=require(_0x64f3('0x7'));var controller=require(_0x64f3('0x8'));router[_0x64f3('0x9')]('/',auth[_0x64f3('0xa')](),controller[_0x64f3('0xb')]);router[_0x64f3('0x9')](_0x64f3('0xc'),auth[_0x64f3('0xa')](),controller[_0x64f3('0xd')]);router[_0x64f3('0x9')](_0x64f3('0xe'),auth[_0x64f3('0xa')](),controller[_0x64f3('0xf')]);router[_0x64f3('0x9')](_0x64f3('0x10'),auth[_0x64f3('0xa')](),controller['show']);router[_0x64f3('0x11')]('/',auth[_0x64f3('0xa')](),controller[_0x64f3('0x12')]);router[_0x64f3('0x13')](_0x64f3('0x10'),controller['update']);router[_0x64f3('0x14')]('/:id',auth[_0x64f3('0xa')](),controller[_0x64f3('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1c0ab83..75e45f1 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 _0xdd6e=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdd6e,0xa5));var _0xedd6=function(_0x835915,_0x4ae352){_0x835915=_0x835915-0x0;var _0x13b461=_0xdd6e[_0x835915];return _0x13b461;};'use strict';var Sequelize=require(_0xedd6('0x0'));module[_0xedd6('0x1')]={'body':{'type':Sequelize[_0xedd6('0x2')](_0xedd6('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xedd6('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xedd6('0x5')]('in',_0xedd6('0x6')),'defaultValue':_0xedd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x34ab=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x1a0de7,_0x1334fd){var _0x1fc8aa=function(_0x59f2bb){while(--_0x59f2bb){_0x1a0de7['push'](_0x1a0de7['shift']());}};_0x1fc8aa(++_0x1334fd);}(_0x34ab,0x169));var _0xb34a=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x34ab[_0x2d4421];return _0x2d3b01;};'use strict';var Sequelize=require(_0xb34a('0x0'));module[_0xb34a('0x1')]={'body':{'type':Sequelize[_0xb34a('0x2')](_0xb34a('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb34a('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb34a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb34a('0x5')]('in',_0xb34a('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb34a('0x7')]},'providerResponse':{'type':Sequelize[_0xb34a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index afdcb3c..315625b 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 _0x9d9e=['attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create','body','describe','chat-interactions','accept','chat','readAt','format','UserId','user','agent','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','fullname','motionChannel','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','apply','reject','save','update','destroy','end','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x294951,_0x498389){var _0x201cdc=function(_0x54d981){while(--_0x54d981){_0x294951['push'](_0x294951['shift']());}};_0x201cdc(++_0x498389);}(_0x9d9e,0xc1));var _0xe9d9=function(_0x7c3553,_0x58020e){_0x7c3553=_0x7c3553-0x0;var _0x3d2fc5=_0x9d9e[_0x7c3553];return _0x3d2fc5;};'use strict';var emlformat=require(_0xe9d9('0x0'));var rimraf=require(_0xe9d9('0x1'));var zipdir=require(_0xe9d9('0x2'));var jsonpatch=require(_0xe9d9('0x3'));var rp=require(_0xe9d9('0x4'));var moment=require(_0xe9d9('0x5'));var BPromise=require(_0xe9d9('0x6'));var Mustache=require(_0xe9d9('0x7'));var util=require(_0xe9d9('0x8'));var path=require('path');var sox=require(_0xe9d9('0x9'));var csv=require(_0xe9d9('0xa'));var ejs=require(_0xe9d9('0xb'));var fs=require('fs');var fs_extra=require(_0xe9d9('0xc'));var _=require(_0xe9d9('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe9d9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe9d9('0xf'));var Papa=require(_0xe9d9('0x10'));var Redis=require(_0xe9d9('0x11'));var authService=require(_0xe9d9('0x12'));var qs=require(_0xe9d9('0x13'));var as=require(_0xe9d9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9d9('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe9d9('0x16'));var db=require(_0xe9d9('0x17'))['db'];config[_0xe9d9('0x18')]=_[_0xe9d9('0x19')](config['redis'],{'host':_0xe9d9('0x1a'),'port':0x18eb});var socket=require(_0xe9d9('0x1b'))(new Redis(config[_0xe9d9('0x18')]));require(_0xe9d9('0x1c'))[_0xe9d9('0x1d')](socket);var jayson=require(_0xe9d9('0x1e'));var client=jayson[_0xe9d9('0x1f')][_0xe9d9('0x20')]({'port':0x232c});var client9002=jayson[_0xe9d9('0x1f')][_0xe9d9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2dc01d,_0x3b0876,_0x29fac2,_0x204616){return new BPromise(function(_0x3727dc,_0x4f2396){var _0x1eda39=_0x204616||client;return _0x1eda39['request'](_0x2dc01d,_0x29fac2)[_0xe9d9('0x21')](function(_0x4280ea){logger[_0xe9d9('0x22')](_0xe9d9('0x23'),_0x3b0876,'request\x20sent');logger[_0xe9d9('0x24')](_0xe9d9('0x25'),_0x3b0876,_0xe9d9('0x26'),JSON[_0xe9d9('0x27')](_0x4280ea));if(_0x4280ea[_0xe9d9('0x28')]){if(_0x4280ea[_0xe9d9('0x28')][_0xe9d9('0x29')]===0x1f4){logger['error'](_0xe9d9('0x23'),_0x3b0876,_0x4280ea[_0xe9d9('0x28')]['message']);return _0x4f2396(_0x4280ea[_0xe9d9('0x28')]['message']);}logger[_0xe9d9('0x28')](_0xe9d9('0x23'),_0x3b0876,_0x4280ea[_0xe9d9('0x28')]['message']);return _0x3727dc(_0x4280ea[_0xe9d9('0x28')][_0xe9d9('0x2a')]);}else{logger[_0xe9d9('0x22')](_0xe9d9('0x23'),_0x3b0876,'request\x20sent');_0x3727dc(_0x4280ea[_0xe9d9('0x2b')][_0xe9d9('0x2a')]);}})[_0xe9d9('0x2c')](function(_0x5eb255){logger[_0xe9d9('0x28')](_0xe9d9('0x23'),_0x3b0876,_0x5eb255);_0x4f2396(_0x5eb255);});});}function respondWithStatusCode(_0x4d1568,_0x4fdb2c){_0x4fdb2c=_0x4fdb2c||0xcc;return function(_0x13ba88){if(_0x13ba88){return _0x4d1568[_0xe9d9('0x2d')](_0x4fdb2c);}return _0x4d1568[_0xe9d9('0x2e')](_0x4fdb2c)['end']();};}function respondWithResult(_0x5565d6,_0x5b5bae){_0x5b5bae=_0x5b5bae||0xc8;return function(_0x3e316e){if(_0x3e316e){return _0x5565d6[_0xe9d9('0x2e')](_0x5b5bae)[_0xe9d9('0x2f')](_0x3e316e);}};}function respondWithFilteredResult(_0x56067a,_0xf5c8e3){return function(_0x15effc){if(_0x15effc){var _0x2bd832=typeof _0xf5c8e3['offset']===_0xe9d9('0x30')&&typeof _0xf5c8e3[_0xe9d9('0x31')]===_0xe9d9('0x30');var _0x39c3d5=_0x15effc[_0xe9d9('0x32')];var _0x513081=_0x2bd832?0x0:_0xf5c8e3['offset'];var _0x5f59bb=_0x2bd832?_0x15effc[_0xe9d9('0x32')]:_0xf5c8e3[_0xe9d9('0x33')]+_0xf5c8e3[_0xe9d9('0x31')];var _0x40ae7c;if(_0x5f59bb>=_0x39c3d5){_0x5f59bb=_0x39c3d5;_0x40ae7c=0xc8;}else{_0x40ae7c=0xce;}_0x56067a['status'](_0x40ae7c);return _0x56067a['set']('Content-Range',_0x513081+'-'+_0x5f59bb+'/'+_0x39c3d5)['json'](_0x15effc);}return null;};}function patchUpdates(_0x1a2df7){return function(_0x43ac0e){try{jsonpatch[_0xe9d9('0x34')](_0x43ac0e,_0x1a2df7,!![]);}catch(_0x36bd34){return BPromise[_0xe9d9('0x35')](_0x36bd34);}return _0x43ac0e[_0xe9d9('0x36')]();};}function saveUpdates(_0x71e049,_0x14fb46){return function(_0x2cf764){if(_0x2cf764){return _0x2cf764[_0xe9d9('0x37')](_0x71e049)['then'](function(_0x7780cd){return _0x7780cd;});}return null;};}function removeEntity(_0x138f11,_0x3d4c5e){return function(_0xe8e982){if(_0xe8e982){return _0xe8e982[_0xe9d9('0x38')]()[_0xe9d9('0x21')](function(){_0x138f11[_0xe9d9('0x2e')](0xcc)[_0xe9d9('0x39')]();});}};}function handleEntityNotFound(_0xfa3323,_0x3b4365){return function(_0x1db738){if(!_0x1db738){_0xfa3323[_0xe9d9('0x2d')](0x194);}return _0x1db738;};}function handleError(_0x4afb15,_0x232e9a){_0x232e9a=_0x232e9a||0x1f4;return function(_0x11722b){logger[_0xe9d9('0x28')](_0x11722b['stack']);if(_0x11722b[_0xe9d9('0x3a')]){delete _0x11722b['name'];}_0x4afb15['status'](_0x232e9a)[_0xe9d9('0x3b')](_0x11722b);};}exports['index']=function(_0x50957e,_0x314089){var _0x4bcd2b={},_0x401294={},_0x43241c={'count':0x0,'rows':[]};var _0x551bdd=_[_0xe9d9('0x3c')](db[_0xe9d9('0x3d')][_0xe9d9('0x3e')],function(_0x341136){return{'name':_0x341136[_0xe9d9('0x3f')],'type':_0x341136[_0xe9d9('0x40')][_0xe9d9('0x41')]};});_0x401294[_0xe9d9('0x42')]=_[_0xe9d9('0x3c')](_0x551bdd,_0xe9d9('0x3a'));_0x401294[_0xe9d9('0x43')]=_[_0xe9d9('0x44')](_0x50957e[_0xe9d9('0x43')]);_0x401294[_0xe9d9('0x45')]=_[_0xe9d9('0x46')](_0x401294[_0xe9d9('0x42')],_0x401294[_0xe9d9('0x43')]);_0x4bcd2b[_0xe9d9('0x47')]=_['intersection'](_0x401294[_0xe9d9('0x42')],qs[_0xe9d9('0x48')](_0x50957e[_0xe9d9('0x43')][_0xe9d9('0x48')]));_0x4bcd2b['attributes']=_0x4bcd2b[_0xe9d9('0x47')][_0xe9d9('0x49')]?_0x4bcd2b[_0xe9d9('0x47')]:_0x401294['model'];if(!_0x50957e[_0xe9d9('0x43')][_0xe9d9('0x4a')]('nolimit')){_0x4bcd2b[_0xe9d9('0x31')]=qs[_0xe9d9('0x31')](_0x50957e[_0xe9d9('0x43')]['limit']);_0x4bcd2b['offset']=qs['offset'](_0x50957e[_0xe9d9('0x43')][_0xe9d9('0x33')]);}_0x4bcd2b[_0xe9d9('0x4b')]=qs[_0xe9d9('0x4c')](_0x50957e[_0xe9d9('0x43')][_0xe9d9('0x4c')]);_0x4bcd2b[_0xe9d9('0x4d')]=qs[_0xe9d9('0x45')](_['pick'](_0x50957e[_0xe9d9('0x43')],_0x401294['filters']),_0x551bdd);if(_0x50957e['query'][_0xe9d9('0x4e')]){_0x4bcd2b[_0xe9d9('0x4d')]=_[_0xe9d9('0x4f')](_0x4bcd2b[_0xe9d9('0x4d')],{'$or':_[_0xe9d9('0x3c')](_0x551bdd,function(_0x10e08f){if(_0x10e08f[_0xe9d9('0x40')]!==_0xe9d9('0x50')){var _0x3e004b={};_0x3e004b[_0x10e08f[_0xe9d9('0x3a')]]={'$like':'%'+_0x50957e['query'][_0xe9d9('0x4e')]+'%'};return _0x3e004b;}})});}_0x4bcd2b=_[_0xe9d9('0x4f')]({},_0x4bcd2b,_0x50957e[_0xe9d9('0x51')]);var _0x1413e4={'where':_0x4bcd2b[_0xe9d9('0x4d')]};return db[_0xe9d9('0x3d')]['count'](_0x1413e4)['then'](function(_0x57ec5c){_0x43241c[_0xe9d9('0x32')]=_0x57ec5c;if(_0x50957e[_0xe9d9('0x43')]['includeAll']){_0x4bcd2b[_0xe9d9('0x52')]=[{'all':!![]}];}return db[_0xe9d9('0x3d')][_0xe9d9('0x53')](_0x4bcd2b);})[_0xe9d9('0x21')](function(_0x2b7abe){_0x43241c[_0xe9d9('0x54')]=_0x2b7abe;return _0x43241c;})[_0xe9d9('0x21')](respondWithFilteredResult(_0x314089,_0x4bcd2b))['catch'](handleError(_0x314089,null));};exports[_0xe9d9('0x55')]=function(_0x395043,_0x253b6f){var _0x131ce8={'raw':!![],'where':{'id':_0x395043[_0xe9d9('0x56')]['id']}},_0x2a7bd5={};_0x2a7bd5['model']=_[_0xe9d9('0x44')](db['ChatMessage'][_0xe9d9('0x3e')]);_0x2a7bd5[_0xe9d9('0x43')]=_[_0xe9d9('0x44')](_0x395043[_0xe9d9('0x43')]);_0x2a7bd5[_0xe9d9('0x45')]=_[_0xe9d9('0x46')](_0x2a7bd5[_0xe9d9('0x42')],_0x2a7bd5[_0xe9d9('0x43')]);_0x131ce8['attributes']=_['intersection'](_0x2a7bd5[_0xe9d9('0x42')],qs[_0xe9d9('0x48')](_0x395043[_0xe9d9('0x43')]['fields']));_0x131ce8[_0xe9d9('0x47')]=_0x131ce8[_0xe9d9('0x47')][_0xe9d9('0x49')]?_0x131ce8[_0xe9d9('0x47')]:_0x2a7bd5['model'];if(_0x395043['query'][_0xe9d9('0x57')]){_0x131ce8[_0xe9d9('0x52')]=[{'all':!![]}];}_0x131ce8=_[_0xe9d9('0x4f')]({},_0x131ce8,_0x395043['options']);return db[_0xe9d9('0x3d')][_0xe9d9('0x58')](_0x131ce8)['then'](handleEntityNotFound(_0x253b6f,null))['then'](respondWithResult(_0x253b6f,null))[_0xe9d9('0x2c')](handleError(_0x253b6f,null));};exports[_0xe9d9('0x59')]=function(_0x28b448,_0x15e1f6){return db[_0xe9d9('0x3d')][_0xe9d9('0x59')](_0x28b448[_0xe9d9('0x5a')],{})[_0xe9d9('0x21')](respondWithResult(_0x15e1f6,0xc9))['catch'](handleError(_0x15e1f6,null));};exports[_0xe9d9('0x37')]=function(_0x3e23fc,_0x4d7710){if(_0x3e23fc[_0xe9d9('0x5a')]['id']){delete _0x3e23fc[_0xe9d9('0x5a')]['id'];}return db[_0xe9d9('0x3d')][_0xe9d9('0x58')]({'where':{'id':_0x3e23fc['params']['id']}})[_0xe9d9('0x21')](handleEntityNotFound(_0x4d7710,null))['then'](saveUpdates(_0x3e23fc['body'],null))[_0xe9d9('0x21')](respondWithResult(_0x4d7710,null))[_0xe9d9('0x2c')](handleError(_0x4d7710,null));};exports[_0xe9d9('0x38')]=function(_0x431827,_0xba145f){return db['ChatMessage'][_0xe9d9('0x58')]({'where':{'id':_0x431827[_0xe9d9('0x56')]['id']}})[_0xe9d9('0x21')](handleEntityNotFound(_0xba145f,null))[_0xe9d9('0x21')](removeEntity(_0xba145f,null))[_0xe9d9('0x2c')](handleError(_0xba145f,null));};exports[_0xe9d9('0x5b')]=function(_0x3f5a61,_0x166af2){return db['ChatMessage']['describe']()[_0xe9d9('0x21')](respondWithResult(_0x166af2,null))[_0xe9d9('0x2c')](handleError(_0x166af2,null));};var interaction_log=require(_0xe9d9('0x15'))(_0xe9d9('0x5c'));exports[_0xe9d9('0x5d')]=function(_0x55b8fb,_0x25652,_0x1aaa58){var _0x3f88eb={'agent':{},'channel':_0xe9d9('0x5e')};if(_0x55b8fb[_0xe9d9('0x5a')]['id']){delete _0x55b8fb[_0xe9d9('0x5a')]['id'];}_0x55b8fb[_0xe9d9('0x5a')]['read']=!![];_0x55b8fb[_0xe9d9('0x5a')][_0xe9d9('0x5f')]=moment()[_0xe9d9('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x55b8fb['body'][_0xe9d9('0x61')]=_0x55b8fb['body'][_0xe9d9('0x61')]||_0x55b8fb[_0xe9d9('0x62')]['id'];_0x3f88eb[_0xe9d9('0x63')]['id']=_0x55b8fb['body']['UserId'];return db[_0xe9d9('0x3d')][_0xe9d9('0x58')]({'where':{'id':_0x55b8fb[_0xe9d9('0x56')]['id'],'UserId':null}})[_0xe9d9('0x21')](handleEntityNotFound(_0x25652,null))[_0xe9d9('0x21')](saveUpdates(_0x55b8fb['body'],null))['then'](function(_0xbf2cda){if(_0xbf2cda){_0x3f88eb[_0xe9d9('0x2a')]=_0xbf2cda['get']({'plain':!![]});return db[_0xe9d9('0x64')][_0xe9d9('0x58')]({'where':{'id':_0xbf2cda[_0xe9d9('0x65')]}});}return null;})[_0xe9d9('0x21')](handleEntityNotFound(_0x25652,null))[_0xe9d9('0x21')](function(_0x4db1c4){if(_0x4db1c4){return _0x4db1c4['update']({'UserId':_0x55b8fb[_0xe9d9('0x5a')][_0xe9d9('0x61')],'read1stAt':_[_0xe9d9('0x66')](_0x4db1c4[_0xe9d9('0x67')])?moment()[_0xe9d9('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x33ead9){if(_0x33ead9){_0x3f88eb[_0xe9d9('0x68')]=_0x33ead9[_0xe9d9('0x69')]({'plain':!![]});interaction_log[_0xe9d9('0x22')](_0xe9d9('0x6a'),_0x55b8fb[_0xe9d9('0x62')]['id'],_0x55b8fb[_0xe9d9('0x62')][_0xe9d9('0x3a')],_0x55b8fb[_0xe9d9('0x62')][_0xe9d9('0x6b')],_0x3f88eb['interaction']['id'],_0x55b8fb[_0xe9d9('0x5a')]?JSON[_0xe9d9('0x27')](_0x55b8fb[_0xe9d9('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0xe9d9('0x6c'),_0x3f88eb);}return null;})['then'](function(_0x391c52){var _0x52d6c7=_0xe9d9('0x6d')+_0x391c52[_0xe9d9('0x2a')][_0xe9d9('0x6e')];return db['sequelize'][_0xe9d9('0x43')](_0x52d6c7,{'type':db[_0xe9d9('0x6f')][_0xe9d9('0x70')][_0xe9d9('0x71')],'raw':!![]})[_0xe9d9('0x21')](function(_0x5cec9a){return _0x5cec9a;});})[_0xe9d9('0x21')](function(_0x30a1ce){if(_0x30a1ce){_0x3f88eb[_0xe9d9('0x2a')][_0xe9d9('0x72')]=_0x30a1ce[0x0];if(!_0x55b8fb[_0xe9d9('0x5a')][_0xe9d9('0x61')])return;return db['User'][_0xe9d9('0x58')]({'where':{'id':_0x55b8fb['body'][_0xe9d9('0x61')],'role':_0xe9d9('0x63')},'attributes':['id',_0xe9d9('0x3a'),'fullname',_0xe9d9('0x73'),_0xe9d9('0x74')],'raw':!![]});}return null;})[_0xe9d9('0x21')](function(_0x17ad7a){if(!_0x17ad7a)return null;_0x3f88eb[_0xe9d9('0x2a')][_0xe9d9('0x63')]=_0x17ad7a;return _0x3f88eb;})['then'](function(_0x20c5ac){if(_0x20c5ac){if(_0x55b8fb['body'][_0xe9d9('0x75')]){_0x3f88eb[_0xe9d9('0x2a')][_0xe9d9('0x76')]=util[_0xe9d9('0x60')](_0xe9d9('0x77'),_0x55b8fb[_0xe9d9('0x62')][_0xe9d9('0x3a')]);_0x3f88eb[_0xe9d9('0x2a')][_0xe9d9('0x78')]=_0x3f88eb['channel'];_0x3f88eb[_0xe9d9('0x2a')]['motionChannel']=_0x3f88eb[_0xe9d9('0x78')];_0x3f88eb[_0xe9d9('0x2a')][_0xe9d9('0x79')]='accept';return respondWithRpcPromise(_0xe9d9('0x7a'),'EventManager',{'event':_0xe9d9('0x7b'),'message':_['merge'](_0x3f88eb[_0xe9d9('0x2a')],JSON['parse'](_0x3f88eb[_0xe9d9('0x68')]['formData']))},client9002)[_0xe9d9('0x21')](function(){return _0x3f88eb;});}return _0x3f88eb;}return null;})['then'](respondWithResult(_0x25652,null))['catch'](handleError(_0x25652,null));};var interaction_log=require(_0xe9d9('0x15'))(_0xe9d9('0x5c'));exports['reject']=function(_0x4dc4ae,_0xda52e6,_0x52a6b2){var _0x37c451={'agent':{},'channel':_0xe9d9('0x5e')};if(_0x4dc4ae[_0xe9d9('0x5a')]['id']){delete _0x4dc4ae[_0xe9d9('0x5a')]['id'];}_0x4dc4ae[_0xe9d9('0x5a')][_0xe9d9('0x61')]=_0x4dc4ae['body'][_0xe9d9('0x61')]||_0x4dc4ae[_0xe9d9('0x62')]['id'];_0x37c451['agent']['id']=_0x4dc4ae['body'][_0xe9d9('0x61')];return db[_0xe9d9('0x3d')][_0xe9d9('0x58')]({'where':{'id':_0x4dc4ae[_0xe9d9('0x56')]['id'],'UserId':null}})[_0xe9d9('0x21')](handleEntityNotFound(_0xda52e6,null))[_0xe9d9('0x21')](function(_0x386271){if(_0x386271){_0x37c451[_0xe9d9('0x2a')]=_0x386271[_0xe9d9('0x69')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x386271[_0xe9d9('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xda52e6,null))[_0xe9d9('0x21')](function(_0x1d5100){if(_0x1d5100){_0x37c451[_0xe9d9('0x68')]=_0x1d5100[_0xe9d9('0x69')]({'plain':!![]});interaction_log[_0xe9d9('0x22')](_0xe9d9('0x7c'),_0x4dc4ae[_0xe9d9('0x62')]['id'],_0x4dc4ae[_0xe9d9('0x62')][_0xe9d9('0x3a')],_0x4dc4ae['user'][_0xe9d9('0x6b')],_0x37c451[_0xe9d9('0x68')]['id'],_0x4dc4ae[_0xe9d9('0x5a')]?JSON[_0xe9d9('0x27')](_0x4dc4ae[_0xe9d9('0x5a')]):'null');return respondWithRpcPromise(_0xe9d9('0x7d'),_0xe9d9('0x7e'),_0x37c451);}return null;})['then'](function(_0x4e4e3d){var _0x4e3719=_0xe9d9('0x6d')+_0x4e4e3d['message'][_0xe9d9('0x6e')];return db[_0xe9d9('0x7f')][_0xe9d9('0x43')](_0x4e3719,{'type':db[_0xe9d9('0x6f')][_0xe9d9('0x70')][_0xe9d9('0x71')],'raw':!![]})[_0xe9d9('0x21')](function(_0x2a7b1d){return _0x2a7b1d;});})[_0xe9d9('0x21')](function(_0x5d3d8c){if(_0x5d3d8c){_0x37c451[_0xe9d9('0x2a')][_0xe9d9('0x72')]=_0x5d3d8c[0x0];if(!_0x4dc4ae[_0xe9d9('0x5a')][_0xe9d9('0x61')])return;return db['User']['find']({'where':{'id':_0x4dc4ae[_0xe9d9('0x5a')][_0xe9d9('0x61')],'role':_0xe9d9('0x63')},'attributes':['id',_0xe9d9('0x3a'),_0xe9d9('0x80'),_0xe9d9('0x73'),_0xe9d9('0x74')],'raw':!![]});}return null;})['then'](function(_0x69f0aa){if(!_0x69f0aa)return null;_0x37c451['message']['agent']=_0x69f0aa;return _0x37c451;})[_0xe9d9('0x21')](function(_0x5256a4){if(_0x5256a4){_0x5256a4[_0xe9d9('0x2a')][_0xe9d9('0x76')]=util[_0xe9d9('0x60')](_0xe9d9('0x77'),_0x4dc4ae[_0xe9d9('0x62')]['name']);_0x5256a4[_0xe9d9('0x2a')][_0xe9d9('0x78')]=_0x37c451[_0xe9d9('0x78')];_0x5256a4[_0xe9d9('0x2a')][_0xe9d9('0x81')]=_0x37c451[_0xe9d9('0x78')];_0x5256a4[_0xe9d9('0x2a')][_0xe9d9('0x79')]=_0xe9d9('0x35');respondWithRpcPromise(_0xe9d9('0x7a'),_0xe9d9('0x7a'),{'event':_0xe9d9('0x82'),'message':_[_0xe9d9('0x4f')](_0x37c451['message'],JSON[_0xe9d9('0x83')](_0x37c451['interaction']['formData']))},client9002);return _0x37c451;}return null;})['then'](respondWithResult(_0xda52e6,null))[_0xe9d9('0x2c')](handleError(_0xda52e6,null));}; \ No newline at end of file +var _0xdbac=['set','Content-Range','apply','reject','then','destroy','name','send','index','map','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','describe','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','channel','accept','EventManager','acceptmessage','parse','formData','chat-interactions','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','fullname','SIP/%s','motionChannel','event','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x1ea37f,_0x3fa0d5){var _0x43c566=function(_0x2ab9ec){while(--_0x2ab9ec){_0x1ea37f['push'](_0x1ea37f['shift']());}};_0x43c566(++_0x3fa0d5);}(_0xdbac,0xdb));var _0xcdba=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xdbac[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdba('0x0'));var zipdir=require(_0xcdba('0x1'));var jsonpatch=require(_0xcdba('0x2'));var rp=require(_0xcdba('0x3'));var moment=require(_0xcdba('0x4'));var BPromise=require(_0xcdba('0x5'));var Mustache=require(_0xcdba('0x6'));var util=require(_0xcdba('0x7'));var path=require(_0xcdba('0x8'));var sox=require(_0xcdba('0x9'));var csv=require(_0xcdba('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcdba('0xb'));var crypto=require(_0xcdba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcdba('0xd'));var toCsv=require(_0xcdba('0xa'));var querystring=require('querystring');var Papa=require(_0xcdba('0xe'));var Redis=require(_0xcdba('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcdba('0x10'));var as=require(_0xcdba('0x11'));var hardwareService=require(_0xcdba('0x12'));var logger=require(_0xcdba('0x13'))('api');var utils=require(_0xcdba('0x14'));var config=require(_0xcdba('0x15'));var licenseUtil=require(_0xcdba('0x16'));var db=require(_0xcdba('0x17'))['db'];config[_0xcdba('0x18')]=_[_0xcdba('0x19')](config[_0xcdba('0x18')],{'host':_0xcdba('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdba('0x18')]));require(_0xcdba('0x1b'))[_0xcdba('0x1c')](socket);var jayson=require(_0xcdba('0x1d'));var client=jayson[_0xcdba('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xcdba('0x1e')][_0xcdba('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x281640,_0x140cbc,_0x5a1e5c,_0x2f93fa){return new BPromise(function(_0x2ce1f9,_0x4692af){var _0x2020e4=_0x2f93fa||client;return _0x2020e4[_0xcdba('0x20')](_0x281640,_0x5a1e5c)['then'](function(_0x1f2439){logger[_0xcdba('0x21')]('ChatMessage,\x20%s,\x20%s',_0x140cbc,_0xcdba('0x22'));logger[_0xcdba('0x23')](_0xcdba('0x24'),_0x140cbc,_0xcdba('0x22'),JSON[_0xcdba('0x25')](_0x1f2439));if(_0x1f2439['error']){if(_0x1f2439[_0xcdba('0x26')][_0xcdba('0x27')]===0x1f4){logger[_0xcdba('0x26')](_0xcdba('0x28'),_0x140cbc,_0x1f2439[_0xcdba('0x26')][_0xcdba('0x29')]);return _0x4692af(_0x1f2439['error'][_0xcdba('0x29')]);}logger[_0xcdba('0x26')](_0xcdba('0x28'),_0x140cbc,_0x1f2439[_0xcdba('0x26')][_0xcdba('0x29')]);return _0x2ce1f9(_0x1f2439[_0xcdba('0x26')][_0xcdba('0x29')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x140cbc,_0xcdba('0x22'));_0x2ce1f9(_0x1f2439[_0xcdba('0x2a')]['message']);}})['catch'](function(_0x18e37d){logger[_0xcdba('0x26')](_0xcdba('0x28'),_0x140cbc,_0x18e37d);_0x4692af(_0x18e37d);});});}function respondWithStatusCode(_0x322d88,_0x21cca5){_0x21cca5=_0x21cca5||0xcc;return function(_0xf471a3){if(_0xf471a3){return _0x322d88[_0xcdba('0x2b')](_0x21cca5);}return _0x322d88[_0xcdba('0x2c')](_0x21cca5)[_0xcdba('0x2d')]();};}function respondWithResult(_0x20d963,_0x1c3737){_0x1c3737=_0x1c3737||0xc8;return function(_0x3ad420){if(_0x3ad420){return _0x20d963[_0xcdba('0x2c')](_0x1c3737)[_0xcdba('0x2e')](_0x3ad420);}};}function respondWithFilteredResult(_0x1155cc,_0x3eb426){return function(_0x261f44){if(_0x261f44){var _0x136ebb=typeof _0x3eb426[_0xcdba('0x2f')]==='undefined'&&typeof _0x3eb426['limit']===_0xcdba('0x30');var _0x209f89=_0x261f44[_0xcdba('0x31')];var _0x2a909a=_0x136ebb?0x0:_0x3eb426['offset'];var _0x36f53d=_0x136ebb?_0x261f44[_0xcdba('0x31')]:_0x3eb426[_0xcdba('0x2f')]+_0x3eb426[_0xcdba('0x32')];var _0x3fb4e3;if(_0x36f53d>=_0x209f89){_0x36f53d=_0x209f89;_0x3fb4e3=0xc8;}else{_0x3fb4e3=0xce;}_0x1155cc[_0xcdba('0x2c')](_0x3fb4e3);return _0x1155cc[_0xcdba('0x33')](_0xcdba('0x34'),_0x2a909a+'-'+_0x36f53d+'/'+_0x209f89)['json'](_0x261f44);}return null;};}function patchUpdates(_0x332284){return function(_0x24ffee){try{jsonpatch[_0xcdba('0x35')](_0x24ffee,_0x332284,!![]);}catch(_0x5eba4f){return BPromise[_0xcdba('0x36')](_0x5eba4f);}return _0x24ffee['save']();};}function saveUpdates(_0x4f2636,_0x56b10b){return function(_0x5b0061){if(_0x5b0061){return _0x5b0061['update'](_0x4f2636)[_0xcdba('0x37')](function(_0xe0e60c){return _0xe0e60c;});}return null;};}function removeEntity(_0x4ae719,_0x1e75cb){return function(_0x23ef04){if(_0x23ef04){return _0x23ef04[_0xcdba('0x38')]()['then'](function(){_0x4ae719['status'](0xcc)[_0xcdba('0x2d')]();});}};}function handleEntityNotFound(_0x388a12,_0x3357ff){return function(_0x1ef4e5){if(!_0x1ef4e5){_0x388a12[_0xcdba('0x2b')](0x194);}return _0x1ef4e5;};}function handleError(_0x4e3c98,_0x2e72a0){_0x2e72a0=_0x2e72a0||0x1f4;return function(_0x348825){logger[_0xcdba('0x26')](_0x348825['stack']);if(_0x348825[_0xcdba('0x39')]){delete _0x348825[_0xcdba('0x39')];}_0x4e3c98[_0xcdba('0x2c')](_0x2e72a0)[_0xcdba('0x3a')](_0x348825);};}exports[_0xcdba('0x3b')]=function(_0x57b4f7,_0x1ba1bf){var _0x4d6064={},_0xfe2ed2={},_0x256370={'count':0x0,'rows':[]};var _0x2ebb84=_[_0xcdba('0x3c')](db['ChatMessage']['rawAttributes'],function(_0x2948aa){return{'name':_0x2948aa['fieldName'],'type':_0x2948aa[_0xcdba('0x3d')][_0xcdba('0x3e')]};});_0xfe2ed2[_0xcdba('0x3f')]=_['map'](_0x2ebb84,_0xcdba('0x39'));_0xfe2ed2['query']=_[_0xcdba('0x40')](_0x57b4f7[_0xcdba('0x41')]);_0xfe2ed2[_0xcdba('0x42')]=_[_0xcdba('0x43')](_0xfe2ed2[_0xcdba('0x3f')],_0xfe2ed2[_0xcdba('0x41')]);_0x4d6064['attributes']=_['intersection'](_0xfe2ed2[_0xcdba('0x3f')],qs[_0xcdba('0x44')](_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x44')]));_0x4d6064[_0xcdba('0x45')]=_0x4d6064[_0xcdba('0x45')][_0xcdba('0x46')]?_0x4d6064[_0xcdba('0x45')]:_0xfe2ed2[_0xcdba('0x3f')];if(!_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x47')](_0xcdba('0x48'))){_0x4d6064['limit']=qs['limit'](_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x32')]);_0x4d6064[_0xcdba('0x2f')]=qs['offset'](_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x2f')]);}_0x4d6064[_0xcdba('0x49')]=qs[_0xcdba('0x4a')](_0x57b4f7['query']['sort']);_0x4d6064[_0xcdba('0x4b')]=qs['filters'](_[_0xcdba('0x4c')](_0x57b4f7['query'],_0xfe2ed2[_0xcdba('0x42')]),_0x2ebb84);if(_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x4d')]){_0x4d6064[_0xcdba('0x4b')]=_[_0xcdba('0x4e')](_0x4d6064['where'],{'$or':_[_0xcdba('0x3c')](_0x2ebb84,function(_0x3b7f17){if(_0x3b7f17['type']!==_0xcdba('0x4f')){var _0x2d47b3={};_0x2d47b3[_0x3b7f17[_0xcdba('0x39')]]={'$like':'%'+_0x57b4f7['query']['filter']+'%'};return _0x2d47b3;}})});}_0x4d6064=_[_0xcdba('0x4e')]({},_0x4d6064,_0x57b4f7[_0xcdba('0x50')]);var _0x19085e={'where':_0x4d6064[_0xcdba('0x4b')]};return db[_0xcdba('0x51')]['count'](_0x19085e)[_0xcdba('0x37')](function(_0x133478){_0x256370[_0xcdba('0x31')]=_0x133478;if(_0x57b4f7[_0xcdba('0x41')][_0xcdba('0x52')]){_0x4d6064[_0xcdba('0x53')]=[{'all':!![]}];}return db[_0xcdba('0x51')]['findAll'](_0x4d6064);})[_0xcdba('0x37')](function(_0x1575a8){_0x256370[_0xcdba('0x54')]=_0x1575a8;return _0x256370;})[_0xcdba('0x37')](respondWithFilteredResult(_0x1ba1bf,_0x4d6064))[_0xcdba('0x55')](handleError(_0x1ba1bf,null));};exports['show']=function(_0x405162,_0x7ab7f6){var _0x59a293={'raw':!![],'where':{'id':_0x405162[_0xcdba('0x56')]['id']}},_0x76ed29={};_0x76ed29[_0xcdba('0x3f')]=_[_0xcdba('0x40')](db[_0xcdba('0x51')][_0xcdba('0x57')]);_0x76ed29[_0xcdba('0x41')]=_[_0xcdba('0x40')](_0x405162[_0xcdba('0x41')]);_0x76ed29[_0xcdba('0x42')]=_[_0xcdba('0x43')](_0x76ed29[_0xcdba('0x3f')],_0x76ed29[_0xcdba('0x41')]);_0x59a293[_0xcdba('0x45')]=_[_0xcdba('0x43')](_0x76ed29[_0xcdba('0x3f')],qs[_0xcdba('0x44')](_0x405162[_0xcdba('0x41')][_0xcdba('0x44')]));_0x59a293[_0xcdba('0x45')]=_0x59a293[_0xcdba('0x45')][_0xcdba('0x46')]?_0x59a293[_0xcdba('0x45')]:_0x76ed29[_0xcdba('0x3f')];if(_0x405162[_0xcdba('0x41')][_0xcdba('0x52')]){_0x59a293[_0xcdba('0x53')]=[{'all':!![]}];}_0x59a293=_[_0xcdba('0x4e')]({},_0x59a293,_0x405162[_0xcdba('0x50')]);return db[_0xcdba('0x51')][_0xcdba('0x58')](_0x59a293)['then'](handleEntityNotFound(_0x7ab7f6,null))['then'](respondWithResult(_0x7ab7f6,null))[_0xcdba('0x55')](handleError(_0x7ab7f6,null));};exports[_0xcdba('0x59')]=function(_0x2070c3,_0x5660ae){return db[_0xcdba('0x51')]['create'](_0x2070c3[_0xcdba('0x5a')],{})[_0xcdba('0x37')](respondWithResult(_0x5660ae,0xc9))[_0xcdba('0x55')](handleError(_0x5660ae,null));};exports[_0xcdba('0x5b')]=function(_0x23a7e3,_0x13024c){if(_0x23a7e3['body']['id']){delete _0x23a7e3['body']['id'];}return db['ChatMessage'][_0xcdba('0x58')]({'where':{'id':_0x23a7e3[_0xcdba('0x56')]['id']}})[_0xcdba('0x37')](handleEntityNotFound(_0x13024c,null))[_0xcdba('0x37')](saveUpdates(_0x23a7e3['body'],null))[_0xcdba('0x37')](respondWithResult(_0x13024c,null))[_0xcdba('0x55')](handleError(_0x13024c,null));};exports[_0xcdba('0x38')]=function(_0x45c07d,_0x1062c4){return db[_0xcdba('0x51')]['find']({'where':{'id':_0x45c07d['params']['id']}})[_0xcdba('0x37')](handleEntityNotFound(_0x1062c4,null))[_0xcdba('0x37')](removeEntity(_0x1062c4,null))[_0xcdba('0x55')](handleError(_0x1062c4,null));};exports['describe']=function(_0x672de4,_0x5b2f08){return db[_0xcdba('0x51')][_0xcdba('0x5c')]()[_0xcdba('0x37')](respondWithResult(_0x5b2f08,null))[_0xcdba('0x55')](handleError(_0x5b2f08,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports['accept']=function(_0x384404,_0x13c08d,_0x168bf2){var _0x5933b8={'agent':{},'channel':_0xcdba('0x5d')};if(_0x384404[_0xcdba('0x5a')]['id']){delete _0x384404[_0xcdba('0x5a')]['id'];}_0x384404[_0xcdba('0x5a')][_0xcdba('0x5e')]=!![];_0x384404[_0xcdba('0x5a')][_0xcdba('0x5f')]=moment()[_0xcdba('0x60')](_0xcdba('0x61'));_0x384404['body'][_0xcdba('0x62')]=_0x384404[_0xcdba('0x5a')][_0xcdba('0x62')]||_0x384404[_0xcdba('0x63')]['id'];_0x5933b8[_0xcdba('0x64')]['id']=_0x384404[_0xcdba('0x5a')]['UserId'];return db[_0xcdba('0x51')]['find']({'where':{'id':_0x384404[_0xcdba('0x56')]['id'],'UserId':null}})[_0xcdba('0x37')](handleEntityNotFound(_0x13c08d,null))['then'](saveUpdates(_0x384404[_0xcdba('0x5a')],null))[_0xcdba('0x37')](function(_0xd3e48){if(_0xd3e48){_0x5933b8['message']=_0xd3e48['get']({'plain':!![]});return db[_0xcdba('0x65')]['find']({'where':{'id':_0xd3e48[_0xcdba('0x66')]}});}return null;})[_0xcdba('0x37')](handleEntityNotFound(_0x13c08d,null))[_0xcdba('0x37')](function(_0x5a2ef2){if(_0x5a2ef2){return _0x5a2ef2[_0xcdba('0x5b')]({'UserId':_0x384404[_0xcdba('0x5a')][_0xcdba('0x62')],'read1stAt':_['isNil'](_0x5a2ef2['read1stAt'])?moment()[_0xcdba('0x60')](_0xcdba('0x61')):undefined});}return null;})['then'](function(_0xe747ca){if(_0xe747ca){_0x5933b8[_0xcdba('0x67')]=_0xe747ca[_0xcdba('0x68')]({'plain':!![]});interaction_log[_0xcdba('0x21')](_0xcdba('0x69'),_0x384404[_0xcdba('0x63')]['id'],_0x384404[_0xcdba('0x63')][_0xcdba('0x39')],_0x384404['user']['role'],_0x5933b8['interaction']['id'],_0x384404[_0xcdba('0x5a')]?JSON[_0xcdba('0x25')](_0x384404[_0xcdba('0x5a')]):_0xcdba('0x6a'));return respondWithRpcPromise(_0xcdba('0x6b'),_0xcdba('0x6c'),_0x5933b8);}return null;})[_0xcdba('0x37')](function(_0x5a5730){var _0x212056=_0xcdba('0x6d')+_0x5a5730[_0xcdba('0x29')][_0xcdba('0x6e')];return db[_0xcdba('0x6f')][_0xcdba('0x41')](_0x212056,{'type':db[_0xcdba('0x70')]['QueryTypes'][_0xcdba('0x71')],'raw':!![]})[_0xcdba('0x37')](function(_0x8f5d52){return _0x8f5d52;});})[_0xcdba('0x37')](function(_0x15d5ed){if(_0x15d5ed){_0x5933b8[_0xcdba('0x29')][_0xcdba('0x72')]=_0x15d5ed[0x0];if(!_0x384404[_0xcdba('0x5a')][_0xcdba('0x62')])return;return db[_0xcdba('0x73')]['find']({'where':{'id':_0x384404[_0xcdba('0x5a')][_0xcdba('0x62')],'role':_0xcdba('0x64')},'attributes':['id',_0xcdba('0x39'),'fullname',_0xcdba('0x74'),_0xcdba('0x75')],'raw':!![]});}return null;})[_0xcdba('0x37')](function(_0x39501f){if(!_0x39501f)return null;_0x5933b8['message']['agent']=_0x39501f;return _0x5933b8;})[_0xcdba('0x37')](function(_0x27cff0){if(_0x27cff0){if(_0x384404[_0xcdba('0x5a')][_0xcdba('0x76')]){_0x5933b8[_0xcdba('0x29')][_0xcdba('0x77')]=util['format']('SIP/%s',_0x384404[_0xcdba('0x63')][_0xcdba('0x39')]);_0x5933b8[_0xcdba('0x29')][_0xcdba('0x78')]=_0x5933b8[_0xcdba('0x78')];_0x5933b8['message']['motionChannel']=_0x5933b8['channel'];_0x5933b8[_0xcdba('0x29')]['event']=_0xcdba('0x79');return respondWithRpcPromise(_0xcdba('0x7a'),_0xcdba('0x7a'),{'event':_0xcdba('0x7b'),'message':_[_0xcdba('0x4e')](_0x5933b8[_0xcdba('0x29')],JSON[_0xcdba('0x7c')](_0x5933b8['interaction'][_0xcdba('0x7d')]))},client9002)[_0xcdba('0x37')](function(){return _0x5933b8;});}return _0x5933b8;}return null;})[_0xcdba('0x37')](respondWithResult(_0x13c08d,null))['catch'](handleError(_0x13c08d,null));};var interaction_log=require('../../config/logger')(_0xcdba('0x7e'));exports[_0xcdba('0x36')]=function(_0x4d3846,_0x20c869,_0x406755){var _0x31f86f={'agent':{},'channel':'chat'};if(_0x4d3846[_0xcdba('0x5a')]['id']){delete _0x4d3846[_0xcdba('0x5a')]['id'];}_0x4d3846[_0xcdba('0x5a')][_0xcdba('0x62')]=_0x4d3846[_0xcdba('0x5a')][_0xcdba('0x62')]||_0x4d3846[_0xcdba('0x63')]['id'];_0x31f86f[_0xcdba('0x64')]['id']=_0x4d3846[_0xcdba('0x5a')][_0xcdba('0x62')];return db[_0xcdba('0x51')][_0xcdba('0x58')]({'where':{'id':_0x4d3846[_0xcdba('0x56')]['id'],'UserId':null}})[_0xcdba('0x37')](handleEntityNotFound(_0x20c869,null))[_0xcdba('0x37')](function(_0x240853){if(_0x240853){_0x31f86f[_0xcdba('0x29')]=_0x240853['get']({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x240853[_0xcdba('0x66')]}});}return null;})[_0xcdba('0x37')](handleEntityNotFound(_0x20c869,null))[_0xcdba('0x37')](function(_0x1ede62){if(_0x1ede62){_0x31f86f[_0xcdba('0x67')]=_0x1ede62[_0xcdba('0x68')]({'plain':!![]});interaction_log[_0xcdba('0x21')](_0xcdba('0x7f'),_0x4d3846['user']['id'],_0x4d3846[_0xcdba('0x63')]['name'],_0x4d3846['user']['role'],_0x31f86f[_0xcdba('0x67')]['id'],_0x4d3846['body']?JSON['stringify'](_0x4d3846[_0xcdba('0x5a')]):_0xcdba('0x6a'));return respondWithRpcPromise(_0xcdba('0x80'),_0xcdba('0x81'),_0x31f86f);}return null;})[_0xcdba('0x37')](function(_0x1866e9){var _0x4d61e3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1866e9[_0xcdba('0x29')][_0xcdba('0x6e')];return db['sequelize'][_0xcdba('0x41')](_0x4d61e3,{'type':db['Sequelize'][_0xcdba('0x82')][_0xcdba('0x71')],'raw':!![]})['then'](function(_0x40b5c4){return _0x40b5c4;});})[_0xcdba('0x37')](function(_0x1c6fa0){if(_0x1c6fa0){_0x31f86f['message'][_0xcdba('0x72')]=_0x1c6fa0[0x0];if(!_0x4d3846[_0xcdba('0x5a')][_0xcdba('0x62')])return;return db[_0xcdba('0x73')][_0xcdba('0x58')]({'where':{'id':_0x4d3846[_0xcdba('0x5a')][_0xcdba('0x62')],'role':_0xcdba('0x64')},'attributes':['id','name',_0xcdba('0x83'),_0xcdba('0x74'),_0xcdba('0x75')],'raw':!![]});}return null;})['then'](function(_0x25f506){if(!_0x25f506)return null;_0x31f86f[_0xcdba('0x29')][_0xcdba('0x64')]=_0x25f506;return _0x31f86f;})[_0xcdba('0x37')](function(_0x25fb07){if(_0x25fb07){_0x25fb07[_0xcdba('0x29')][_0xcdba('0x77')]=util[_0xcdba('0x60')](_0xcdba('0x84'),_0x4d3846[_0xcdba('0x63')][_0xcdba('0x39')]);_0x25fb07[_0xcdba('0x29')]['channel']=_0x31f86f[_0xcdba('0x78')];_0x25fb07[_0xcdba('0x29')][_0xcdba('0x85')]=_0x31f86f[_0xcdba('0x78')];_0x25fb07[_0xcdba('0x29')][_0xcdba('0x86')]=_0xcdba('0x36');respondWithRpcPromise(_0xcdba('0x7a'),'EventManager',{'event':'rejectmessage','message':_[_0xcdba('0x4e')](_0x31f86f[_0xcdba('0x29')],JSON[_0xcdba('0x7c')](_0x31f86f['interaction'][_0xcdba('0x7d')]))},client9002);return _0x31f86f;}return null;})['then'](respondWithResult(_0x20c869,null))[_0xcdba('0x55')](handleError(_0x20c869,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 34bc4ac..30e1fbf 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 _0xc728=['save','update','emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0xc728,0x145));var _0x8c72=function(_0x9729d0,_0x4eaaf7){_0x9729d0=_0x9729d0-0x0;var _0x38d6f9=_0xc728[_0x9729d0];return _0x38d6f9;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x8c72('0x0'))['db'][_0x8c72('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8c72('0x2')](0x0);var events={'afterCreate':_0x8c72('0x3'),'afterUpdate':_0x8c72('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1bb089){return function(_0x49eb8c,_0x1a65ea,_0x185fbb){ChatMessageEvents[_0x8c72('0x5')](_0x1bb089+':'+_0x49eb8c['id'],_0x49eb8c);ChatMessageEvents[_0x8c72('0x5')](_0x1bb089,_0x49eb8c);_0x185fbb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x8c72('0x6')](e,emitEvent(event));}}module[_0x8c72('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xaef7=['exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5bb078,_0x3bb395){var _0x27a866=function(_0x34fb2d){while(--_0x34fb2d){_0x5bb078['push'](_0x5bb078['shift']());}};_0x27a866(++_0x3bb395);}(_0xaef7,0x97));var _0x7aef=function(_0x3df3b1,_0x396e5a){_0x3df3b1=_0x3df3b1-0x0;var _0x39d1f1=_0xaef7[_0x3df3b1];return _0x39d1f1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x7aef('0x0'))['db'][_0x7aef('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7aef('0x2')](0x0);var events={'afterCreate':_0x7aef('0x3'),'afterUpdate':_0x7aef('0x4'),'afterDestroy':_0x7aef('0x5')};function emitEvent(_0x3726ba){return function(_0x4c098d,_0x156273,_0x1efb38){ChatMessageEvents[_0x7aef('0x6')](_0x3726ba+':'+_0x4c098d['id'],_0x4c098d);ChatMessageEvents['emit'](_0x3726ba,_0x4c098d);_0x1efb38(null);};}for(var e in events){if(events[_0x7aef('0x7')](e)){var event=events[e];ChatMessage[_0x7aef('0x8')](e,emitEvent(event));}}module[_0x7aef('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c1bd1ae..1b670f0 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 _0x03f0=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error'];(function(_0x35b76f,_0x324c48){var _0x582906=function(_0x5e4a7b){while(--_0x5e4a7b){_0x35b76f['push'](_0x35b76f['shift']());}};_0x582906(++_0x324c48);}(_0x03f0,0x1b2));var _0x003f=function(_0x3dcb78,_0x2e1e59){_0x3dcb78=_0x3dcb78-0x0;var _0x3a333f=_0x03f0[_0x3dcb78];return _0x3a333f;};'use strict';var _=require('lodash');var util=require(_0x003f('0x0'));var logger=require('../../config/logger')(_0x003f('0x1'));var moment=require(_0x003f('0x2'));var BPromise=require(_0x003f('0x3'));var rp=require(_0x003f('0x4'));var fs=require('fs');var path=require(_0x003f('0x5'));var rimraf=require(_0x003f('0x6'));var config=require(_0x003f('0x7'));var attributes=require('./chatMessage.attributes');module[_0x003f('0x8')]=function(_0x40ca2b,_0x5ee383){return _0x40ca2b['define']('ChatMessage',attributes,{'tableName':_0x003f('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x003f('0xa')],'type':_0x003f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x255617,_0x344d3e,_0x3d74b2){var _0x217d36=_0x40ca2b[_0x003f('0xc')];var _0x55b4bf=_0x255617[_0x003f('0xd')]({'plain':!![]});if(_0x55b4bf[_0x003f('0xe')][_0x003f('0xf')]()==='in'||_0x55b4bf[_0x003f('0xe')][_0x003f('0xf')]()===_0x003f('0x10')&&!_0x55b4bf['secret']&&!_[_0x003f('0x11')](_0x55b4bf['UserId'])){_0x217d36[_0x003f('0x12')][_0x003f('0x13')]({'where':{'id':_0x55b4bf[_0x003f('0x14')]}})[_0x003f('0x15')](function(_0x4bdd84){if(_0x4bdd84){_0x4bdd84['update']({'lastMsgAt':_0x55b4bf[_0x003f('0x16')],'lastMsgDirection':_0x55b4bf[_0x003f('0xe')][_0x003f('0xf')]()});}})[_0x003f('0x17')](function(_0x5aa438){console[_0x003f('0x18')](_0x5aa438);});}_0x3d74b2();}},'charset':_0x003f('0x19'),'collate':_0x003f('0x1a')});}; \ No newline at end of file +var _0x4d1b=['secret','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','chat_messages','body','FULLTEXT','models','get','direction','out'];(function(_0x31a0cd,_0x5ec488){var _0x3720f0=function(_0x4696c0){while(--_0x4696c0){_0x31a0cd['push'](_0x31a0cd['shift']());}};_0x3720f0(++_0x5ec488);}(_0x4d1b,0x128));var _0xb4d1=function(_0x34e4a0,_0x1fd446){_0x34e4a0=_0x34e4a0-0x0;var _0x3ead3e=_0x4d1b[_0x34e4a0];return _0x3ead3e;};'use strict';var _=require(_0xb4d1('0x0'));var util=require(_0xb4d1('0x1'));var logger=require('../../config/logger')(_0xb4d1('0x2'));var moment=require('moment');var BPromise=require(_0xb4d1('0x3'));var rp=require(_0xb4d1('0x4'));var fs=require('fs');var path=require(_0xb4d1('0x5'));var rimraf=require(_0xb4d1('0x6'));var config=require(_0xb4d1('0x7'));var attributes=require(_0xb4d1('0x8'));module['exports']=function(_0x2f59d0,_0x4d0f39){return _0x2f59d0['define']('ChatMessage',attributes,{'tableName':_0xb4d1('0x9'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xb4d1('0xa')],'type':_0xb4d1('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x496a61,_0x953c59,_0x51e0a9){var _0x10e2e1=_0x2f59d0[_0xb4d1('0xc')];var _0x160b9a=_0x496a61[_0xb4d1('0xd')]({'plain':!![]});if(_0x160b9a[_0xb4d1('0xe')]['toLowerCase']()==='in'||_0x160b9a[_0xb4d1('0xe')]['toLowerCase']()===_0xb4d1('0xf')&&!_0x160b9a[_0xb4d1('0x10')]&&!_['isNil'](_0x160b9a['UserId'])){_0x10e2e1[_0xb4d1('0x11')][_0xb4d1('0x12')]({'where':{'id':_0x160b9a[_0xb4d1('0x13')]}})[_0xb4d1('0x14')](function(_0x590e46){if(_0x590e46){_0x590e46[_0xb4d1('0x15')]({'lastMsgAt':_0x160b9a[_0xb4d1('0x16')],'lastMsgDirection':_0x160b9a[_0xb4d1('0xe')]['toLowerCase']()});}})[_0xb4d1('0x17')](function(_0x47227b){console['error'](_0x47227b);});}_0x51e0a9();}},'charset':_0xb4d1('0x18'),'collate':_0xb4d1('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 07c7229..ce521ee 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 _0xe9e9=['request','then','info','request\x20sent','debug','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatMessage.socket','register'];(function(_0x2c6385,_0x5aadbb){var _0x4f5272=function(_0x47191b){while(--_0x47191b){_0x2c6385['push'](_0x2c6385['shift']());}};_0x4f5272(++_0x5aadbb);}(_0xe9e9,0x7b));var _0x9e9e=function(_0x10c400,_0x4756b1){_0x10c400=_0x10c400-0x0;var _0x55bb49=_0xe9e9[_0x10c400];return _0x55bb49;};'use strict';var _=require(_0x9e9e('0x0'));var util=require(_0x9e9e('0x1'));var moment=require(_0x9e9e('0x2'));var BPromise=require(_0x9e9e('0x3'));var rs=require(_0x9e9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e9e('0x5'))['db'];var utils=require(_0x9e9e('0x6'));var logger=require('../../config/logger')(_0x9e9e('0x7'));var config=require(_0x9e9e('0x8'));var jayson=require(_0x9e9e('0x9'));var client=jayson[_0x9e9e('0xa')][_0x9e9e('0xb')]({'port':0x232a});config[_0x9e9e('0xc')]=_[_0x9e9e('0xd')](config[_0x9e9e('0xc')],{'host':_0x9e9e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e9e('0xf'))[_0x9e9e('0x10')](socket);function respondWithRpcPromise(_0x2ce589,_0x3b0c34,_0x283acc){return new BPromise(function(_0x2b0c1b,_0x3fc1f7){return client[_0x9e9e('0x11')](_0x2ce589,_0x283acc)[_0x9e9e('0x12')](function(_0x5b7b35){logger[_0x9e9e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3b0c34,_0x9e9e('0x14'));logger[_0x9e9e('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3b0c34,'request\x20sent',JSON[_0x9e9e('0x16')](_0x5b7b35));if(_0x5b7b35['error']){if(_0x5b7b35[_0x9e9e('0x17')][_0x9e9e('0x18')]===0x1f4){logger[_0x9e9e('0x17')]('ChatMessage,\x20%s,\x20%s',_0x3b0c34,_0x5b7b35['error'][_0x9e9e('0x19')]);return _0x3fc1f7(_0x5b7b35[_0x9e9e('0x17')]['message']);}logger[_0x9e9e('0x17')](_0x9e9e('0x1a'),_0x3b0c34,_0x5b7b35[_0x9e9e('0x17')][_0x9e9e('0x19')]);return _0x2b0c1b(_0x5b7b35[_0x9e9e('0x17')]['message']);}else{logger[_0x9e9e('0x13')](_0x9e9e('0x1a'),_0x3b0c34,_0x9e9e('0x14'));_0x2b0c1b(_0x5b7b35[_0x9e9e('0x1b')][_0x9e9e('0x19')]);}})[_0x9e9e('0x1c')](function(_0x5053b6){logger[_0x9e9e('0x17')](_0x9e9e('0x1a'),_0x3b0c34,_0x5053b6);_0x3fc1f7(_0x5053b6);});});}exports[_0x9e9e('0x1d')]=function(_0x5a7514){var _0xd762e9=this;return new Promise(function(_0x2f2347,_0x3952e7){return db[_0x9e9e('0x1e')][_0x9e9e('0x1f')](_0x5a7514[_0x9e9e('0x20')],{'raw':_0x5a7514['options']?_0x5a7514[_0x9e9e('0x21')][_0x9e9e('0x22')]===undefined?!![]:![]:!![]})[_0x9e9e('0x12')](function(_0x52263e){logger['info'](_0x9e9e('0x1d'),_0x5a7514);logger[_0x9e9e('0x15')]('CreateChatMessage',_0x5a7514,JSON[_0x9e9e('0x16')](_0x52263e));_0x2f2347(_0x52263e);})[_0x9e9e('0x1c')](function(_0xb78534){logger[_0x9e9e('0x17')](_0x9e9e('0x1d'),_0xb78534['message'],_0x5a7514);_0x3952e7(_0xd762e9['error'](0x1f4,_0xb78534['message']));});});}; \ No newline at end of file +var _0x46f8=['then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request'];(function(_0x2fb5df,_0x3aae4b){var _0x61fb8f=function(_0x5834f0){while(--_0x5834f0){_0x2fb5df['push'](_0x2fb5df['shift']());}};_0x61fb8f(++_0x3aae4b);}(_0x46f8,0x150));var _0x846f=function(_0x4e437d,_0xf7e60d){_0x4e437d=_0x4e437d-0x0;var _0x564810=_0x46f8[_0x4e437d];return _0x564810;};'use strict';var _=require(_0x846f('0x0'));var util=require('util');var moment=require(_0x846f('0x1'));var BPromise=require('bluebird');var rs=require(_0x846f('0x2'));var fs=require('fs');var Redis=require(_0x846f('0x3'));var db=require(_0x846f('0x4'))['db'];var utils=require(_0x846f('0x5'));var logger=require(_0x846f('0x6'))(_0x846f('0x7'));var config=require(_0x846f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x846f('0x9')]['http']({'port':0x232a});config[_0x846f('0xa')]=_[_0x846f('0xb')](config[_0x846f('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x846f('0xc'))(new Redis(config[_0x846f('0xa')]));require(_0x846f('0xd'))[_0x846f('0xe')](socket);function respondWithRpcPromise(_0xbd4aa4,_0x4c9ca4,_0x350bad){return new BPromise(function(_0x26cc4a,_0x3a48ce){return client[_0x846f('0xf')](_0xbd4aa4,_0x350bad)[_0x846f('0x10')](function(_0x4da1ca){logger['info'](_0x846f('0x11'),_0x4c9ca4,_0x846f('0x12'));logger[_0x846f('0x13')](_0x846f('0x14'),_0x4c9ca4,_0x846f('0x12'),JSON['stringify'](_0x4da1ca));if(_0x4da1ca[_0x846f('0x15')]){if(_0x4da1ca[_0x846f('0x15')]['code']===0x1f4){logger[_0x846f('0x15')](_0x846f('0x11'),_0x4c9ca4,_0x4da1ca[_0x846f('0x15')][_0x846f('0x16')]);return _0x3a48ce(_0x4da1ca['error'][_0x846f('0x16')]);}logger[_0x846f('0x15')](_0x846f('0x11'),_0x4c9ca4,_0x4da1ca[_0x846f('0x15')][_0x846f('0x16')]);return _0x26cc4a(_0x4da1ca[_0x846f('0x15')][_0x846f('0x16')]);}else{logger[_0x846f('0x17')](_0x846f('0x11'),_0x4c9ca4,_0x846f('0x12'));_0x26cc4a(_0x4da1ca[_0x846f('0x18')]['message']);}})[_0x846f('0x19')](function(_0x3338d8){logger['error'](_0x846f('0x11'),_0x4c9ca4,_0x3338d8);_0x3a48ce(_0x3338d8);});});}exports[_0x846f('0x1a')]=function(_0x3a7dd6){var _0x23b564=this;return new Promise(function(_0x34aed9,_0x3f65ed){return db[_0x846f('0x1b')][_0x846f('0x1c')](_0x3a7dd6[_0x846f('0x1d')],{'raw':_0x3a7dd6[_0x846f('0x1e')]?_0x3a7dd6[_0x846f('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x846f('0x10')](function(_0x194356){logger[_0x846f('0x17')](_0x846f('0x1a'),_0x3a7dd6);logger['debug'](_0x846f('0x1a'),_0x3a7dd6,JSON[_0x846f('0x1f')](_0x194356));_0x34aed9(_0x194356);})[_0x846f('0x19')](function(_0x152e1e){logger[_0x846f('0x15')](_0x846f('0x1a'),_0x152e1e[_0x846f('0x16')],_0x3a7dd6);_0x3f65ed(_0x23b564[_0x846f('0x15')](0x1f4,_0x152e1e[_0x846f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 411d4af..660c49d 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 _0xabce=['chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x2f1dac,_0x1818be){var _0x3be60e=function(_0x5b35a0){while(--_0x5b35a0){_0x2f1dac['push'](_0x2f1dac['shift']());}};_0x3be60e(++_0x1818be);}(_0xabce,0x103));var _0xeabc=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xabce[_0x139a3c];return _0x2b375b;};'use strict';var ChatMessageEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){ChatMessageEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);ChatMessageEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x47c7=['./chatMessage.events','remove','update','removeListener','register','length','chatMessage:'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x47c7,0x1ab));var _0x747c=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0x47c7[_0x1b70e3];return _0x1452ab;};'use strict';var ChatMessageEvents=require(_0x747c('0x0'));var events=['save',_0x747c('0x1'),_0x747c('0x2')];function createListener(_0x4a6fc3,_0xbe1d88){return function(_0x2af847){_0xbe1d88['emit'](_0x4a6fc3,_0x2af847);};}function removeListener(_0x3313cd,_0x3c0c0){return function(){ChatMessageEvents[_0x747c('0x3')](_0x3313cd,_0x3c0c0);};}exports[_0x747c('0x4')]=function(_0x5e991e){for(var _0xa1148a=0x0,_0x4eb6bc=events[_0x747c('0x5')];_0xa1148a<_0x4eb6bc;_0xa1148a++){var _0x24206f=events[_0xa1148a];var _0x10b9f0=createListener(_0x747c('0x6')+_0x24206f,_0x5e991e);ChatMessageEvents['on'](_0x24206f,_0x10b9f0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c733bf3..e0ca57d 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 _0xbe59=['/describe','describe','show','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2a4cc6,_0x3ed438){var _0x381547=function(_0x44daba){while(--_0x44daba){_0x2a4cc6['push'](_0x2a4cc6['shift']());}};_0x381547(++_0x3ed438);}(_0xbe59,0x123));var _0x9be5=function(_0x53a41e,_0x6250fc){_0x53a41e=_0x53a41e-0x0;var _0x222680=_0xbe59[_0x53a41e];return _0x222680;};'use strict';var multer=require(_0x9be5('0x0'));var util=require(_0x9be5('0x1'));var path=require('path');var timeout=require(_0x9be5('0x2'));var express=require(_0x9be5('0x3'));var router=express['Router']();var fs_extra=require(_0x9be5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9be5('0x5'));var config=require(_0x9be5('0x6'));var controller=require('./chatMessage.controller');router[_0x9be5('0x7')]('/',auth[_0x9be5('0x8')](),controller['index']);router['get'](_0x9be5('0x9'),auth[_0x9be5('0x8')](),controller[_0x9be5('0xa')]);router[_0x9be5('0x7')]('/:id',auth[_0x9be5('0x8')](),controller[_0x9be5('0xb')]);router['post']('/',auth[_0x9be5('0x8')](),interaction[_0x9be5('0xc')](_0x9be5('0xd'),_0x9be5('0xe')),controller[_0x9be5('0xf')]);router[_0x9be5('0x10')]('/:id',controller[_0x9be5('0x11')]);router[_0x9be5('0x10')](_0x9be5('0x12'),auth['isAuthenticated'](),controller[_0x9be5('0x13')]);router['put'](_0x9be5('0x14'),auth[_0x9be5('0x8')](),controller['reject']);router[_0x9be5('0x15')](_0x9be5('0x16'),auth[_0x9be5('0x8')](),controller[_0x9be5('0x17')]);module[_0x9be5('0x18')]=router; \ No newline at end of file +var _0xfb48=['../../config/environment','get','isAuthenticated','index','show','chatmessage:create','put','/:id','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1ef588,_0x3bdabc){var _0x48cee3=function(_0x37fb42){while(--_0x37fb42){_0x1ef588['push'](_0x1ef588['shift']());}};_0x48cee3(++_0x3bdabc);}(_0xfb48,0x1b1));var _0x8fb4=function(_0x414161,_0x53dd7f){_0x414161=_0x414161-0x0;var _0x5b8404=_0xfb48[_0x414161];return _0x5b8404;};'use strict';var multer=require(_0x8fb4('0x0'));var util=require(_0x8fb4('0x1'));var path=require(_0x8fb4('0x2'));var timeout=require(_0x8fb4('0x3'));var express=require(_0x8fb4('0x4'));var router=express[_0x8fb4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8fb4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8fb4('0x7'));var controller=require('./chatMessage.controller');router[_0x8fb4('0x8')]('/',auth[_0x8fb4('0x9')](),controller[_0x8fb4('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8fb4('0x8')]('/:id',auth[_0x8fb4('0x9')](),controller[_0x8fb4('0xb')]);router['post']('/',auth[_0x8fb4('0x9')](),interaction['tracked']('chat',_0x8fb4('0xc')),controller['create']);router[_0x8fb4('0xd')](_0x8fb4('0xe'),controller['update']);router[_0x8fb4('0xd')](_0x8fb4('0xf'),auth['isAuthenticated'](),controller[_0x8fb4('0x10')]);router[_0x8fb4('0xd')](_0x8fb4('0x11'),auth[_0x8fb4('0x9')](),controller[_0x8fb4('0x12')]);router[_0x8fb4('0x13')](_0x8fb4('0xe'),auth['isAuthenticated'](),controller[_0x8fb4('0x14')]);module[_0x8fb4('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 9458da4..8fdf48c 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 _0x2032=['medium','exports','TEXT'];(function(_0x146f5b,_0x3306ff){var _0x2a6ec5=function(_0x17f1ef){while(--_0x17f1ef){_0x146f5b['push'](_0x146f5b['shift']());}};_0x2a6ec5(++_0x3306ff);}(_0x2032,0xd9));var _0x2203=function(_0x568561,_0x18f100){_0x568561=_0x568561-0x0;var _0x393fa6=_0x2032[_0x568561];return _0x393fa6;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0xfbd3ea,_0x7fe0e3){var _0x536a12=function(_0x22ca8c){while(--_0x22ca8c){_0xfbd3ea['push'](_0xfbd3ea['shift']());}};_0x536a12(++_0x7fe0e3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x45a4c1,_0x38437d){_0x45a4c1=_0x45a4c1-0x0;var _0x44d44f=_0x5f2f[_0x45a4c1];return _0x44d44f;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('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 425c2d3..054f7e2 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(_0x461925,_0x341231){var _0x229a0b=function(_0x1a71a0){while(--_0x1a71a0){_0x461925['push'](_0x461925['shift']());}};_0x229a0b(++_0x341231);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x7a54,0x106));var _0x47a5=function(_0x205ea2,_0x392f7d){_0x205ea2=_0x205ea2-0x0;var _0xeaede3=_0x7a54[_0x205ea2];return _0xeaede3;};'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 6692d97..0575064 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 _0xcc1c=['remove','emit','hook','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update'];(function(_0x3e58c7,_0x54bd6b){var _0x1d0858=function(_0x348fd4){while(--_0x348fd4){_0x3e58c7['push'](_0x3e58c7['shift']());}};_0x1d0858(++_0x54bd6b);}(_0xcc1c,0xa3));var _0xccc1=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0xcc1c[_0x2181b1];return _0x530548;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0xccc1('0x0'))['db'][_0xccc1('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xccc1('0x2')](0x0);var events={'afterCreate':_0xccc1('0x3'),'afterUpdate':_0xccc1('0x4'),'afterDestroy':_0xccc1('0x5')};function emitEvent(_0x31d992){return function(_0x20cb83,_0x2e2f79,_0x56808d){ChatOfflineMessageEvents[_0xccc1('0x6')](_0x31d992+':'+_0x20cb83['id'],_0x20cb83);ChatOfflineMessageEvents['emit'](_0x31d992,_0x20cb83);_0x56808d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0xccc1('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x1419=['ChatOfflineMessage','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x1419,0x127));var _0x9141=function(_0x37b074,_0x1e0b4b){_0x37b074=_0x37b074-0x0;var _0x26e206=_0x1419[_0x37b074];return _0x26e206;};'use strict';var EventEmitter=require(_0x9141('0x0'));var ChatOfflineMessage=require(_0x9141('0x1'))['db'][_0x9141('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9141('0x3')](0x0);var events={'afterCreate':_0x9141('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x749bf2){return function(_0x16694b,_0x4c1d20,_0x544162){ChatOfflineMessageEvents[_0x9141('0x5')](_0x749bf2+':'+_0x16694b['id'],_0x16694b);ChatOfflineMessageEvents[_0x9141('0x5')](_0x749bf2,_0x16694b);_0x544162(null);};}for(var e in events){if(events[_0x9141('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x9141('0x7')](e,emitEvent(event));}}module[_0x9141('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fdbd965..fadee16 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 _0xc04f=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0xc04f,0x190));var _0xfc04=function(_0xaa9204,_0x163a47){_0xaa9204=_0xaa9204-0x0;var _0x1e39f8=_0xc04f[_0xaa9204];return _0x1e39f8;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xfc04('0x0')]=function(_0x5ef321){return _0x5ef321[_0xfc04('0x1')](_0xfc04('0x2'),attributes,{'tableName':_0xfc04('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfc04('0x4')});}; \ No newline at end of file +var _0xfe78=['utf8mb4','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x43e4dc,_0x36dfab){var _0x348059=function(_0x4302e6){while(--_0x4302e6){_0x43e4dc['push'](_0x43e4dc['shift']());}};_0x348059(++_0x36dfab);}(_0xfe78,0x13f));var _0x8fe7=function(_0x52ed2c,_0x230407){_0x52ed2c=_0x52ed2c-0x0;var _0x511475=_0xfe78[_0x52ed2c];return _0x511475;};'use strict';var attributes=require(_0x8fe7('0x0'));module[_0x8fe7('0x1')]=function(_0x3517b2){return _0x3517b2[_0x8fe7('0x2')](_0x8fe7('0x3'),attributes,{'tableName':_0x8fe7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fe7('0x5'),'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 1cc543d..2461422 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 _0x22c0=['request','then','info','request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0xb030a5,_0x4404ab){var _0x26c5bf=function(_0x1ce048){while(--_0x1ce048){_0xb030a5['push'](_0xb030a5['shift']());}};_0x26c5bf(++_0x4404ab);}(_0x22c0,0x1c4));var _0x022c=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x22c0[_0x154940];return _0x401409;};'use strict';var _=require(_0x022c('0x0'));var util=require(_0x022c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x022c('0x2'));var fs=require('fs');var Redis=require(_0x022c('0x3'));var db=require(_0x022c('0x4'))['db'];var utils=require(_0x022c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x022c('0x6'));var jayson=require(_0x022c('0x7'));var client=jayson[_0x022c('0x8')][_0x022c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c61e,_0x55f962,_0x176803){return new BPromise(function(_0x43ff88,_0x2a5042){return client[_0x022c('0xa')](_0x37c61e,_0x176803)[_0x022c('0xb')](function(_0x4a1277){logger[_0x022c('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x55f962,_0x022c('0xd'));logger[_0x022c('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x55f962,'request\x20sent',JSON[_0x022c('0xf')](_0x4a1277));if(_0x4a1277[_0x022c('0x10')]){if(_0x4a1277[_0x022c('0x10')][_0x022c('0x11')]===0x1f4){logger[_0x022c('0x10')](_0x022c('0x12'),_0x55f962,_0x4a1277[_0x022c('0x10')][_0x022c('0x13')]);return _0x2a5042(_0x4a1277[_0x022c('0x10')][_0x022c('0x13')]);}logger[_0x022c('0x10')](_0x022c('0x12'),_0x55f962,_0x4a1277['error'][_0x022c('0x13')]);return _0x43ff88(_0x4a1277[_0x022c('0x10')]['message']);}else{logger[_0x022c('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x55f962,_0x022c('0xd'));_0x43ff88(_0x4a1277[_0x022c('0x14')][_0x022c('0x13')]);}})[_0x022c('0x15')](function(_0x3fe3a2){logger[_0x022c('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x55f962,_0x3fe3a2);_0x2a5042(_0x3fe3a2);});});} \ No newline at end of file +var _0x7eab=['../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x44ce97,_0x321989){var _0x48eec6=function(_0x18049b){while(--_0x18049b){_0x44ce97['push'](_0x44ce97['shift']());}};_0x48eec6(++_0x321989);}(_0x7eab,0x1d7));var _0xb7ea=function(_0x2ec960,_0x3df94e){_0x2ec960=_0x2ec960-0x0;var _0x342d47=_0x7eab[_0x2ec960];return _0x342d47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb7ea('0x0'));var BPromise=require(_0xb7ea('0x1'));var rs=require(_0xb7ea('0x2'));var fs=require('fs');var Redis=require(_0xb7ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7ea('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb7ea('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xb7ea('0x6')][_0xb7ea('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4a3900,_0x74a760,_0x2d5212){return new BPromise(function(_0x4ebf55,_0x1114d9){return client[_0xb7ea('0x8')](_0x4a3900,_0x2d5212)['then'](function(_0x2d9fc6){logger[_0xb7ea('0x9')]('ChatOfflineMessage,\x20%s,\x20%s',_0x74a760,'request\x20sent');logger['debug'](_0xb7ea('0xa'),_0x74a760,'request\x20sent',JSON[_0xb7ea('0xb')](_0x2d9fc6));if(_0x2d9fc6['error']){if(_0x2d9fc6[_0xb7ea('0xc')]['code']===0x1f4){logger[_0xb7ea('0xc')](_0xb7ea('0xd'),_0x74a760,_0x2d9fc6[_0xb7ea('0xc')][_0xb7ea('0xe')]);return _0x1114d9(_0x2d9fc6[_0xb7ea('0xc')]['message']);}logger[_0xb7ea('0xc')](_0xb7ea('0xd'),_0x74a760,_0x2d9fc6[_0xb7ea('0xc')][_0xb7ea('0xe')]);return _0x4ebf55(_0x2d9fc6['error'][_0xb7ea('0xe')]);}else{logger[_0xb7ea('0x9')](_0xb7ea('0xd'),_0x74a760,'request\x20sent');_0x4ebf55(_0x2d9fc6[_0xb7ea('0xf')][_0xb7ea('0xe')]);}})[_0xb7ea('0x10')](function(_0x374642){logger['error'](_0xb7ea('0xd'),_0x74a760,_0x374642);_0x1114d9(_0x374642);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 0a9937b..9c21f9b 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 _0x5281=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','show','post','put','/:id','update','delete','multer','util','path','connect-timeout','Router'];(function(_0x5e4df4,_0x1755d9){var _0x4f6a56=function(_0x572ea5){while(--_0x572ea5){_0x5e4df4['push'](_0x5e4df4['shift']());}};_0x4f6a56(++_0x1755d9);}(_0x5281,0x80));var _0x1528=function(_0x11b3e8,_0xcf06ab){_0x11b3e8=_0x11b3e8-0x0;var _0x16e82e=_0x5281[_0x11b3e8];return _0x16e82e;};'use strict';var multer=require(_0x1528('0x0'));var util=require(_0x1528('0x1'));var path=require(_0x1528('0x2'));var timeout=require(_0x1528('0x3'));var express=require('express');var router=express[_0x1528('0x4')]();var fs_extra=require(_0x1528('0x5'));var auth=require(_0x1528('0x6'));var interaction=require(_0x1528('0x7'));var config=require(_0x1528('0x8'));var controller=require(_0x1528('0x9'));router[_0x1528('0xa')]('/',auth[_0x1528('0xb')](),controller[_0x1528('0xc')]);router[_0x1528('0xa')]('/describe',auth[_0x1528('0xb')](),controller['describe']);router[_0x1528('0xa')]('/:id',auth[_0x1528('0xb')](),controller[_0x1528('0xd')]);router[_0x1528('0xe')]('/',auth[_0x1528('0xb')](),controller['create']);router[_0x1528('0xf')](_0x1528('0x10'),auth[_0x1528('0xb')](),controller[_0x1528('0x11')]);router[_0x1528('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x327e=['fs-extra','../../config/environment','isAuthenticated','get','describe','/:id','show','post','put','update','delete','destroy','path','connect-timeout','Router'];(function(_0x1ac404,_0xfc879){var _0x208f73=function(_0x340ce3){while(--_0x340ce3){_0x1ac404['push'](_0x1ac404['shift']());}};_0x208f73(++_0xfc879);}(_0x327e,0xc0));var _0xe327=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x327e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe327('0x0'));var timeout=require(_0xe327('0x1'));var express=require('express');var router=express[_0xe327('0x2')]();var fs_extra=require(_0xe327('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe327('0x4'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xe327('0x5')](),controller['index']);router[_0xe327('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xe327('0x7')]);router[_0xe327('0x6')](_0xe327('0x8'),auth[_0xe327('0x5')](),controller[_0xe327('0x9')]);router[_0xe327('0xa')]('/',auth[_0xe327('0x5')](),controller['create']);router[_0xe327('0xb')](_0xe327('0x8'),auth['isAuthenticated'](),controller[_0xe327('0xc')]);router[_0xe327('0xd')](_0xe327('0x8'),auth['isAuthenticated'](),controller[_0xe327('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index c982574..7c217cc 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 _0xfcf5=['mouseOver','timeout','INTEGER','exports','STRING','ENUM'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xfcf5,0x14d));var _0x5fcf=function(_0x1ad6f8,_0x9160db){_0x1ad6f8=_0x1ad6f8-0x0;var _0xc83409=_0xfcf5[_0x1ad6f8];return _0xc83409;};'use strict';var Sequelize=require('sequelize');module[_0x5fcf('0x0')]={'name':{'type':Sequelize[_0x5fcf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5fcf('0x2')](_0x5fcf('0x3'),_0x5fcf('0x4')),'defaultValue':_0x5fcf('0x3')},'selector':{'type':Sequelize[_0x5fcf('0x1')]},'timeout':{'type':Sequelize[_0x5fcf('0x5')]}}; \ No newline at end of file +var _0xa443=['ENUM','timeout','STRING','INTEGER','sequelize','exports'];(function(_0x1a55e5,_0x1817b2){var _0x49c446=function(_0x796d6a){while(--_0x796d6a){_0x1a55e5['push'](_0x1a55e5['shift']());}};_0x49c446(++_0x1817b2);}(_0xa443,0x100));var _0x3a44=function(_0x1b8b66,_0x2f9a50){_0x1b8b66=_0x1b8b66-0x0;var _0x795e0c=_0xa443[_0x1b8b66];return _0x795e0c;};'use strict';var Sequelize=require(_0x3a44('0x0'));module[_0x3a44('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3a44('0x2')]('mouseOver',_0x3a44('0x3')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x3a44('0x4')]},'timeout':{'type':Sequelize[_0x3a44('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2953f0d..bbaa4db 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 _0x47d6=['../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','include','merge','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','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(_0x546604,_0x407851){var _0x233baa=function(_0x5b18b8){while(--_0x5b18b8){_0x546604['push'](_0x546604['shift']());}};_0x233baa(++_0x407851);}(_0x47d6,0x1de));var _0x647d=function(_0x456b97,_0x11cf55){_0x456b97=_0x456b97-0x0;var _0x29d12f=_0x47d6[_0x456b97];return _0x29d12f;};'use strict';var emlformat=require(_0x647d('0x0'));var rimraf=require(_0x647d('0x1'));var zipdir=require(_0x647d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x647d('0x3'));var BPromise=require(_0x647d('0x4'));var Mustache=require(_0x647d('0x5'));var util=require('util');var path=require(_0x647d('0x6'));var sox=require(_0x647d('0x7'));var csv=require(_0x647d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x647d('0x9'));var _=require(_0x647d('0xa'));var squel=require(_0x647d('0xb'));var crypto=require(_0x647d('0xc'));var jsforce=require(_0x647d('0xd'));var deskjs=require(_0x647d('0xe'));var toCsv=require(_0x647d('0x8'));var querystring=require(_0x647d('0xf'));var Papa=require(_0x647d('0x10'));var Redis=require(_0x647d('0x11'));var authService=require(_0x647d('0x12'));var qs=require(_0x647d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x647d('0x14'));var logger=require(_0x647d('0x15'))(_0x647d('0x16'));var utils=require(_0x647d('0x17'));var config=require(_0x647d('0x18'));var licenseUtil=require(_0x647d('0x19'));var db=require(_0x647d('0x1a'))['db'];function respondWithStatusCode(_0x26cb0b,_0x52570d){_0x52570d=_0x52570d||0xcc;return function(_0x412e63){if(_0x412e63){return _0x26cb0b[_0x647d('0x1b')](_0x52570d);}return _0x26cb0b[_0x647d('0x1c')](_0x52570d)[_0x647d('0x1d')]();};}function respondWithResult(_0x4b224d,_0x18ef9e){_0x18ef9e=_0x18ef9e||0xc8;return function(_0x368b52){if(_0x368b52){return _0x4b224d[_0x647d('0x1c')](_0x18ef9e)['json'](_0x368b52);}};}function respondWithFilteredResult(_0x25fa4a,_0x4c175c){return function(_0x264e53){if(_0x264e53){var _0x5740ff=typeof _0x4c175c[_0x647d('0x1e')]===_0x647d('0x1f')&&typeof _0x4c175c['limit']===_0x647d('0x1f');var _0x539fe4=_0x264e53[_0x647d('0x20')];var _0x30a107=_0x5740ff?0x0:_0x4c175c[_0x647d('0x1e')];var _0x407788=_0x5740ff?_0x264e53[_0x647d('0x20')]:_0x4c175c[_0x647d('0x1e')]+_0x4c175c[_0x647d('0x21')];var _0x29168d;if(_0x407788>=_0x539fe4){_0x407788=_0x539fe4;_0x29168d=0xc8;}else{_0x29168d=0xce;}_0x25fa4a[_0x647d('0x1c')](_0x29168d);return _0x25fa4a[_0x647d('0x22')](_0x647d('0x23'),_0x30a107+'-'+_0x407788+'/'+_0x539fe4)[_0x647d('0x24')](_0x264e53);}return null;};}function patchUpdates(_0x33145c){return function(_0x13dcb6){try{jsonpatch[_0x647d('0x25')](_0x13dcb6,_0x33145c,!![]);}catch(_0x40484c){return BPromise[_0x647d('0x26')](_0x40484c);}return _0x13dcb6[_0x647d('0x27')]();};}function saveUpdates(_0x266982,_0x5e354e){return function(_0x417a03){if(_0x417a03){return _0x417a03[_0x647d('0x28')](_0x266982)['then'](function(_0x25bd0e){return _0x25bd0e;});}return null;};}function removeEntity(_0x3d8e69,_0x1f4c09){return function(_0x1e508a){if(_0x1e508a){return _0x1e508a['destroy']()[_0x647d('0x29')](function(){_0x3d8e69[_0x647d('0x1c')](0xcc)[_0x647d('0x1d')]();});}};}function handleEntityNotFound(_0x2a974c,_0x141b25){return function(_0x5db555){if(!_0x5db555){_0x2a974c[_0x647d('0x1b')](0x194);}return _0x5db555;};}function handleError(_0x248ab7,_0x1c6888){_0x1c6888=_0x1c6888||0x1f4;return function(_0x4499b2){logger[_0x647d('0x2a')](_0x4499b2[_0x647d('0x2b')]);if(_0x4499b2[_0x647d('0x2c')]){delete _0x4499b2[_0x647d('0x2c')];}_0x248ab7['status'](_0x1c6888)['send'](_0x4499b2);};}exports[_0x647d('0x2d')]=function(_0x20d08d,_0x1a0360){var _0x427915={'raw':!![],'where':{'id':_0x20d08d[_0x647d('0x2e')]['id']}},_0xefdb81={};_0xefdb81[_0x647d('0x2f')]=_[_0x647d('0x30')](db[_0x647d('0x31')][_0x647d('0x32')]);_0xefdb81[_0x647d('0x33')]=_[_0x647d('0x30')](_0x20d08d[_0x647d('0x33')]);_0xefdb81[_0x647d('0x34')]=_[_0x647d('0x35')](_0xefdb81[_0x647d('0x2f')],_0xefdb81['query']);_0x427915[_0x647d('0x36')]=_[_0x647d('0x35')](_0xefdb81[_0x647d('0x2f')],qs[_0x647d('0x37')](_0x20d08d[_0x647d('0x33')][_0x647d('0x37')]));_0x427915[_0x647d('0x36')]=_0x427915[_0x647d('0x36')]['length']?_0x427915[_0x647d('0x36')]:_0xefdb81[_0x647d('0x2f')];if(_0x20d08d[_0x647d('0x33')]['includeAll']){_0x427915[_0x647d('0x38')]=[{'all':!![]}];}_0x427915=_[_0x647d('0x39')]({},_0x427915,_0x20d08d['options']);return db[_0x647d('0x31')][_0x647d('0x3a')](_0x427915)[_0x647d('0x29')](handleEntityNotFound(_0x1a0360,null))[_0x647d('0x29')](respondWithResult(_0x1a0360,null))[_0x647d('0x3b')](handleError(_0x1a0360,null));};exports[_0x647d('0x3c')]=function(_0x250c33,_0x156844){return db[_0x647d('0x31')][_0x647d('0x3c')](_0x250c33[_0x647d('0x3d')],{})[_0x647d('0x29')](respondWithResult(_0x156844,0xc9))[_0x647d('0x3b')](handleError(_0x156844,null));};exports['update']=function(_0x3c4cbc,_0x5da608){if(_0x3c4cbc[_0x647d('0x3d')]['id']){delete _0x3c4cbc[_0x647d('0x3d')]['id'];}return db[_0x647d('0x31')]['find']({'where':{'id':_0x3c4cbc[_0x647d('0x2e')]['id']}})[_0x647d('0x29')](handleEntityNotFound(_0x5da608,null))[_0x647d('0x29')](saveUpdates(_0x3c4cbc['body'],null))[_0x647d('0x29')](respondWithResult(_0x5da608,null))['catch'](handleError(_0x5da608,null));};exports[_0x647d('0x3e')]=function(_0x5a3fe8,_0x2d261b){return db[_0x647d('0x31')][_0x647d('0x3a')]({'where':{'id':_0x5a3fe8[_0x647d('0x2e')]['id']}})[_0x647d('0x29')](handleEntityNotFound(_0x2d261b,null))[_0x647d('0x29')](removeEntity(_0x2d261b,null))[_0x647d('0x3b')](handleError(_0x2d261b,null));}; \ No newline at end of file +var _0xd0bb=['name','send','params','model','keys','ChatProactiveAction','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','create','body','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','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'];(function(_0x42ce24,_0x2d3ea5){var _0x552b53=function(_0x20cb29){while(--_0x20cb29){_0x42ce24['push'](_0x42ce24['shift']());}};_0x552b53(++_0x2d3ea5);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x382602,_0x5e9d2d){_0x382602=_0x382602-0x0;var _0x14dda6=_0xd0bb[_0x382602];return _0x14dda6;};'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['show']=function(_0x4dfe76,_0x2187a5){var _0x684b09={'raw':!![],'where':{'id':_0x4dfe76[_0xbd0b('0x2a')]['id']}},_0x14e5a3={};_0x14e5a3[_0xbd0b('0x2b')]=_[_0xbd0b('0x2c')](db[_0xbd0b('0x2d')]['rawAttributes']);_0x14e5a3[_0xbd0b('0x2e')]=_[_0xbd0b('0x2c')](_0x4dfe76['query']);_0x14e5a3['filters']=_[_0xbd0b('0x2f')](_0x14e5a3[_0xbd0b('0x2b')],_0x14e5a3['query']);_0x684b09[_0xbd0b('0x30')]=_[_0xbd0b('0x2f')](_0x14e5a3[_0xbd0b('0x2b')],qs[_0xbd0b('0x31')](_0x4dfe76[_0xbd0b('0x2e')][_0xbd0b('0x31')]));_0x684b09['attributes']=_0x684b09[_0xbd0b('0x30')][_0xbd0b('0x32')]?_0x684b09[_0xbd0b('0x30')]:_0x14e5a3[_0xbd0b('0x2b')];if(_0x4dfe76[_0xbd0b('0x2e')][_0xbd0b('0x33')]){_0x684b09[_0xbd0b('0x34')]=[{'all':!![]}];}_0x684b09=_[_0xbd0b('0x35')]({},_0x684b09,_0x4dfe76[_0xbd0b('0x36')]);return db[_0xbd0b('0x2d')][_0xbd0b('0x37')](_0x684b09)[_0xbd0b('0x24')](handleEntityNotFound(_0x2187a5,null))[_0xbd0b('0x24')](respondWithResult(_0x2187a5,null))[_0xbd0b('0x38')](handleError(_0x2187a5,null));};exports['create']=function(_0x6132c8,_0x23b0fa){return db['ChatProactiveAction'][_0xbd0b('0x39')](_0x6132c8[_0xbd0b('0x3a')],{})[_0xbd0b('0x24')](respondWithResult(_0x23b0fa,0xc9))[_0xbd0b('0x38')](handleError(_0x23b0fa,null));};exports[_0xbd0b('0x23')]=function(_0x288715,_0x4c8ff5){if(_0x288715[_0xbd0b('0x3a')]['id']){delete _0x288715[_0xbd0b('0x3a')]['id'];}return db[_0xbd0b('0x2d')][_0xbd0b('0x37')]({'where':{'id':_0x288715[_0xbd0b('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4c8ff5,null))['then'](saveUpdates(_0x288715[_0xbd0b('0x3a')],null))[_0xbd0b('0x24')](respondWithResult(_0x4c8ff5,null))[_0xbd0b('0x38')](handleError(_0x4c8ff5,null));};exports[_0xbd0b('0x25')]=function(_0x4a9bdd,_0x47b588){return db[_0xbd0b('0x2d')]['find']({'where':{'id':_0x4a9bdd[_0xbd0b('0x2a')]['id']}})[_0xbd0b('0x24')](handleEntityNotFound(_0x47b588,null))[_0xbd0b('0x24')](removeEntity(_0x47b588,null))[_0xbd0b('0x38')](handleError(_0x47b588,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 439ca5b..136d4ff 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 _0x13f2=['request-promise','path','rimraf','./chatProactiveAction.attributes','exports','chat_proactive_actions','api','moment'];(function(_0x285755,_0x4c6df5){var _0x594918=function(_0x553568){while(--_0x553568){_0x285755['push'](_0x285755['shift']());}};_0x594918(++_0x4c6df5);}(_0x13f2,0x1ae));var _0x213f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x13f2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x213f('0x0'));var moment=require(_0x213f('0x1'));var BPromise=require('bluebird');var rp=require(_0x213f('0x2'));var fs=require('fs');var path=require(_0x213f('0x3'));var rimraf=require(_0x213f('0x4'));var config=require('../../config/environment');var attributes=require(_0x213f('0x5'));module[_0x213f('0x6')]=function(_0x147ef3,_0x353b7f){return _0x147ef3['define']('ChatProactiveAction',attributes,{'tableName':_0x213f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x679b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x5c8099,_0x1316db){var _0x187ac9=function(_0xdc9333){while(--_0xdc9333){_0x5c8099['push'](_0x5c8099['shift']());}};_0x187ac9(++_0x1316db);}(_0x679b,0x1ea));var _0xb679=function(_0x4d6900,_0x1723e7){_0x4d6900=_0x4d6900-0x0;var _0x5c9db6=_0x679b[_0x4d6900];return _0x5c9db6;};'use strict';var _=require(_0xb679('0x0'));var util=require(_0xb679('0x1'));var logger=require(_0xb679('0x2'))(_0xb679('0x3'));var moment=require(_0xb679('0x4'));var BPromise=require(_0xb679('0x5'));var rp=require(_0xb679('0x6'));var fs=require('fs');var path=require(_0xb679('0x7'));var rimraf=require(_0xb679('0x8'));var config=require(_0xb679('0x9'));var attributes=require('./chatProactiveAction.attributes');module[_0xb679('0xa')]=function(_0x4d9e0a,_0x4c12fd){return _0x4d9e0a[_0xb679('0xb')](_0xb679('0xc'),attributes,{'tableName':_0xb679('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index abe63da..b19d41d 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 _0x7b8d=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7b8d,0x1d7));var _0xd7b8=function(_0x525e4f,_0x54bfbb){_0x525e4f=_0x525e4f-0x0;var _0x45a511=_0x7b8d[_0x525e4f];return _0x45a511;};'use strict';var _=require('lodash');var util=require(_0xd7b8('0x0'));var moment=require(_0xd7b8('0x1'));var BPromise=require(_0xd7b8('0x2'));var rs=require(_0xd7b8('0x3'));var fs=require('fs');var Redis=require(_0xd7b8('0x4'));var db=require(_0xd7b8('0x5'))['db'];var utils=require(_0xd7b8('0x6'));var logger=require(_0xd7b8('0x7'))(_0xd7b8('0x8'));var config=require(_0xd7b8('0x9'));var jayson=require(_0xd7b8('0xa'));var client=jayson[_0xd7b8('0xb')][_0xd7b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x803c4,_0x47dc61,_0x2b75f7){return new BPromise(function(_0x95e4c,_0x162155){return client[_0xd7b8('0xd')](_0x803c4,_0x2b75f7)[_0xd7b8('0xe')](function(_0x1b126c){logger[_0xd7b8('0xf')](_0xd7b8('0x10'),_0x47dc61,_0xd7b8('0x11'));logger[_0xd7b8('0x12')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x47dc61,'request\x20sent',JSON['stringify'](_0x1b126c));if(_0x1b126c['error']){if(_0x1b126c[_0xd7b8('0x13')][_0xd7b8('0x14')]===0x1f4){logger[_0xd7b8('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x47dc61,_0x1b126c[_0xd7b8('0x13')][_0xd7b8('0x15')]);return _0x162155(_0x1b126c[_0xd7b8('0x13')][_0xd7b8('0x15')]);}logger[_0xd7b8('0x13')](_0xd7b8('0x10'),_0x47dc61,_0x1b126c[_0xd7b8('0x13')][_0xd7b8('0x15')]);return _0x95e4c(_0x1b126c[_0xd7b8('0x13')][_0xd7b8('0x15')]);}else{logger[_0xd7b8('0xf')](_0xd7b8('0x10'),_0x47dc61,_0xd7b8('0x11'));_0x95e4c(_0x1b126c['result'][_0xd7b8('0x15')]);}})[_0xd7b8('0x16')](function(_0x27e812){logger[_0xd7b8('0x13')](_0xd7b8('0x10'),_0x47dc61,_0x27e812);_0x162155(_0x27e812);});});} \ No newline at end of file +var _0xf93d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','bluebird'];(function(_0x557d3e,_0x67d344){var _0x4b3f60=function(_0x26f3dc){while(--_0x26f3dc){_0x557d3e['push'](_0x557d3e['shift']());}};_0x4b3f60(++_0x67d344);}(_0xf93d,0xe6));var _0xdf93=function(_0x1cdbbc,_0xbad129){_0x1cdbbc=_0x1cdbbc-0x0;var _0x424b4e=_0xf93d[_0x1cdbbc];return _0x424b4e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdf93('0x0'));var rs=require(_0xdf93('0x1'));var fs=require('fs');var Redis=require(_0xdf93('0x2'));var db=require(_0xdf93('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf93('0x4'))(_0xdf93('0x5'));var config=require(_0xdf93('0x6'));var jayson=require(_0xdf93('0x7'));var client=jayson[_0xdf93('0x8')][_0xdf93('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e604e,_0xc1e175,_0x157cc7){return new BPromise(function(_0x3080fd,_0x37678f){return client[_0xdf93('0xa')](_0x1e604e,_0x157cc7)[_0xdf93('0xb')](function(_0x3c113c){logger['info'](_0xdf93('0xc'),_0xc1e175,_0xdf93('0xd'));logger['debug'](_0xdf93('0xe'),_0xc1e175,_0xdf93('0xd'),JSON[_0xdf93('0xf')](_0x3c113c));if(_0x3c113c[_0xdf93('0x10')]){if(_0x3c113c[_0xdf93('0x10')][_0xdf93('0x11')]===0x1f4){logger[_0xdf93('0x10')](_0xdf93('0xc'),_0xc1e175,_0x3c113c[_0xdf93('0x10')][_0xdf93('0x12')]);return _0x37678f(_0x3c113c[_0xdf93('0x10')]['message']);}logger['error'](_0xdf93('0xc'),_0xc1e175,_0x3c113c[_0xdf93('0x10')][_0xdf93('0x12')]);return _0x3080fd(_0x3c113c[_0xdf93('0x10')][_0xdf93('0x12')]);}else{logger[_0xdf93('0x13')](_0xdf93('0xc'),_0xc1e175,'request\x20sent');_0x3080fd(_0x3c113c['result']['message']);}})[_0xdf93('0x14')](function(_0x4e1d1b){logger[_0xdf93('0x10')]('ChatProactiveAction,\x20%s,\x20%s',_0xc1e175,_0x4e1d1b);_0x37678f(_0x4e1d1b);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7c255ca..0a5e458 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 _0x2bd8=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','exports'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x2bd8,0x130));var _0x82bd=function(_0x11dd9a,_0x3cc8cd){_0x11dd9a=_0x11dd9a-0x0;var _0x15645a=_0x2bd8[_0x11dd9a];return _0x15645a;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var timeout=require(_0x82bd('0x2'));var express=require(_0x82bd('0x3'));var router=express[_0x82bd('0x4')]();var fs_extra=require(_0x82bd('0x5'));var auth=require(_0x82bd('0x6'));var interaction=require(_0x82bd('0x7'));var config=require('../../config/environment');var controller=require(_0x82bd('0x8'));router[_0x82bd('0x9')](_0x82bd('0xa'),auth['isAuthenticated'](),controller[_0x82bd('0xb')]);router[_0x82bd('0xc')]('/',auth[_0x82bd('0xd')](),controller[_0x82bd('0xe')]);router['put'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82bd('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x82bd('0xf')]=router; \ No newline at end of file +var _0x53ec=['create','put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','show','post'];(function(_0x1b0366,_0xba43e0){var _0x1e1dc9=function(_0xe7b5bd){while(--_0xe7b5bd){_0x1b0366['push'](_0x1b0366['shift']());}};_0x1e1dc9(++_0xba43e0);}(_0x53ec,0x192));var _0xc53e=function(_0x5211cd,_0x266b93){_0x5211cd=_0x5211cd-0x0;var _0x366c0f=_0x53ec[_0x5211cd];return _0x366c0f;};'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'](_0xc53e('0x9'),auth['isAuthenticated'](),controller[_0xc53e('0xa')]);router[_0xc53e('0xb')]('/',auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xd')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0xf')]);router[_0xc53e('0x10')](_0xc53e('0x9'),auth[_0xc53e('0xe')](),controller[_0xc53e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ed6585a..43bd446 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 _0xdd06=['ENUM','rrmemory','roundrobin','exports','name','STRING','INTEGER'];(function(_0x52db0b,_0x58ea3e){var _0x30b5b=function(_0x2db24b){while(--_0x2db24b){_0x52db0b['push'](_0x52db0b['shift']());}};_0x30b5b(++_0x58ea3e);}(_0xdd06,0xce));var _0x6dd0=function(_0x31ed12,_0x2a38f9){_0x31ed12=_0x31ed12-0x0;var _0x1afd40=_0xdd06[_0x31ed12];return _0x1afd40;};'use strict';var Sequelize=require('sequelize');module[_0x6dd0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6dd0('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6dd0('0x2')]},'timeout':{'type':Sequelize[_0x6dd0('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6dd0('0x4')](_0x6dd0('0x5'),'beepall',_0x6dd0('0x6'))}}; \ No newline at end of file +var _0x8082=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','name'];(function(_0x5977e1,_0x5d804c){var _0x1b2c20=function(_0x445909){while(--_0x445909){_0x5977e1['push'](_0x5977e1['shift']());}};_0x1b2c20(++_0x5d804c);}(_0x8082,0x139));var _0x2808=function(_0x317cb9,_0x3afb86){_0x317cb9=_0x317cb9-0x0;var _0x54121f=_0x8082[_0x317cb9];return _0x54121f;};'use strict';var Sequelize=require(_0x2808('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2808('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2808('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2808('0x3')](_0x2808('0x4'),_0x2808('0x5'),_0x2808('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index d2238d0..28aec64 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 _0x89f0=['ids','Team','online','voicePause','interface','flatMap','Agents','each','forEach','emit','userChatQueue:save','removeTeams','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','compact','value','transaction','removeAgents','userChatQueue:remove','addAgents','omit','isArray','getAgents','eml-format','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','UserProfileResource','sendStatus','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','hasOwnProperty','ChatQueueId','UserChatQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams'];(function(_0x4ccbe6,_0x31bf37){var _0xede63e=function(_0x340e0c){while(--_0x340e0c){_0x4ccbe6['push'](_0x4ccbe6['shift']());}};_0xede63e(++_0x31bf37);}(_0x89f0,0x146));var _0x089f=function(_0x43f9e8,_0x4a9317){_0x43f9e8=_0x43f9e8-0x0;var _0x247071=_0x89f0[_0x43f9e8];return _0x247071;};'use strict';var emlformat=require(_0x089f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x089f('0x1'));var rp=require('request-promise');var moment=require(_0x089f('0x2'));var BPromise=require(_0x089f('0x3'));var Mustache=require('mustache');var util=require(_0x089f('0x4'));var path=require(_0x089f('0x5'));var sox=require(_0x089f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x089f('0x7'));var _=require('lodash');var squel=require(_0x089f('0x8'));var crypto=require(_0x089f('0x9'));var jsforce=require(_0x089f('0xa'));var deskjs=require(_0x089f('0xb'));var toCsv=require(_0x089f('0xc'));var querystring=require('querystring');var Papa=require(_0x089f('0xd'));var Redis=require('ioredis');var authService=require(_0x089f('0xe'));var qs=require(_0x089f('0xf'));var as=require(_0x089f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x089f('0x11'));var utils=require(_0x089f('0x12'));var config=require(_0x089f('0x13'));var licenseUtil=require(_0x089f('0x14'));var db=require('../../mysqldb')['db'];config[_0x089f('0x15')]=_[_0x089f('0x16')](config[_0x089f('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x089f('0x17'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x089f('0x18')](socket);var jayson=require(_0x089f('0x19'));var client=jayson[_0x089f('0x1a')][_0x089f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x45f436,_0x4e2636,_0x1a05bc,_0x40f8a6){return new BPromise(function(_0x1e6bf9,_0x45f5ed){var _0x4c3fe5=_0x40f8a6||client;return _0x4c3fe5[_0x089f('0x1c')](_0x45f436,_0x1a05bc)[_0x089f('0x1d')](function(_0x432239){logger[_0x089f('0x1e')](_0x089f('0x1f'),_0x4e2636,_0x089f('0x20'));logger[_0x089f('0x21')](_0x089f('0x22'),_0x4e2636,_0x089f('0x20'),JSON[_0x089f('0x23')](_0x432239));if(_0x432239['error']){if(_0x432239['error'][_0x089f('0x24')]===0x1f4){logger[_0x089f('0x25')](_0x089f('0x1f'),_0x4e2636,_0x432239[_0x089f('0x25')][_0x089f('0x26')]);return _0x45f5ed(_0x432239[_0x089f('0x25')][_0x089f('0x26')]);}logger[_0x089f('0x25')]('ChatQueue,\x20%s,\x20%s',_0x4e2636,_0x432239[_0x089f('0x25')][_0x089f('0x26')]);return _0x1e6bf9(_0x432239[_0x089f('0x25')][_0x089f('0x26')]);}else{logger[_0x089f('0x1e')](_0x089f('0x1f'),_0x4e2636,_0x089f('0x20'));_0x1e6bf9(_0x432239[_0x089f('0x27')][_0x089f('0x26')]);}})['catch'](function(_0x20ca82){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4e2636,_0x20ca82);_0x45f5ed(_0x20ca82);});});}function respondWithStatusCode(_0x4a669c,_0x3875bc){_0x3875bc=_0x3875bc||0xcc;return function(_0x3ccd52){if(_0x3ccd52){return _0x4a669c['sendStatus'](_0x3875bc);}return _0x4a669c[_0x089f('0x28')](_0x3875bc)[_0x089f('0x29')]();};}function respondWithResult(_0x1dd139,_0x4c1817){_0x4c1817=_0x4c1817||0xc8;return function(_0x539c08){if(_0x539c08){return _0x1dd139[_0x089f('0x28')](_0x4c1817)['json'](_0x539c08);}};}function respondWithFilteredResult(_0x5244d9,_0x42cf4e){return function(_0x985705){if(_0x985705){var _0x33661d=typeof _0x42cf4e[_0x089f('0x2a')]===_0x089f('0x2b')&&typeof _0x42cf4e[_0x089f('0x2c')]===_0x089f('0x2b');var _0x44532c=_0x985705[_0x089f('0x2d')];var _0x44885a=_0x33661d?0x0:_0x42cf4e[_0x089f('0x2a')];var _0x59f7ba=_0x33661d?_0x985705[_0x089f('0x2d')]:_0x42cf4e[_0x089f('0x2a')]+_0x42cf4e[_0x089f('0x2c')];var _0x18ad87;if(_0x59f7ba>=_0x44532c){_0x59f7ba=_0x44532c;_0x18ad87=0xc8;}else{_0x18ad87=0xce;}_0x5244d9['status'](_0x18ad87);return _0x5244d9['set'](_0x089f('0x2e'),_0x44885a+'-'+_0x59f7ba+'/'+_0x44532c)[_0x089f('0x2f')](_0x985705);}return null;};}function patchUpdates(_0x186bd7){return function(_0x3daa48){try{jsonpatch[_0x089f('0x30')](_0x3daa48,_0x186bd7,!![]);}catch(_0x3da1ba){return BPromise[_0x089f('0x31')](_0x3da1ba);}return _0x3daa48[_0x089f('0x32')]();};}function saveUpdates(_0xae8420,_0x9bfae6){return function(_0x4d7a97){if(_0x4d7a97){return _0x4d7a97[_0x089f('0x33')](_0xae8420)['then'](function(_0x23d151){return _0x23d151;});}return null;};}function removeEntity(_0x5276d9,_0x30385e){return function(_0x2b5b7a){if(_0x2b5b7a){return _0x2b5b7a[_0x089f('0x34')]()[_0x089f('0x1d')](function(){var _0xc5e39f=_0x2b5b7a['get']({'plain':!![]});var _0x48d910='ChatQueues';return db[_0x089f('0x35')][_0x089f('0x34')]({'where':{'type':_0x48d910,'resourceId':_0xc5e39f['id']}})[_0x089f('0x1d')](function(){return _0x2b5b7a;});})[_0x089f('0x1d')](function(){_0x5276d9[_0x089f('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e324d,_0xbe428a){return function(_0x23485b){if(!_0x23485b){_0x4e324d[_0x089f('0x36')](0x194);}return _0x23485b;};}function handleError(_0x1b4acf,_0x4826ff){_0x4826ff=_0x4826ff||0x1f4;return function(_0xf11c07){logger[_0x089f('0x25')](_0xf11c07['stack']);if(_0xf11c07['name']){delete _0xf11c07[_0x089f('0x37')];}_0x1b4acf['status'](_0x4826ff)[_0x089f('0x38')](_0xf11c07);};}exports[_0x089f('0x39')]=function(_0x409f73,_0x8cc0a1){var _0x47b133={},_0xe2760d={},_0x59587d={'count':0x0,'rows':[]};var _0x4881fe=_[_0x089f('0x3a')](db[_0x089f('0x3b')][_0x089f('0x3c')],function(_0x2e4426){return{'name':_0x2e4426[_0x089f('0x3d')],'type':_0x2e4426[_0x089f('0x3e')][_0x089f('0x3f')]};});_0xe2760d[_0x089f('0x40')]=_[_0x089f('0x3a')](_0x4881fe,_0x089f('0x37'));_0xe2760d[_0x089f('0x41')]=_['keys'](_0x409f73[_0x089f('0x41')]);_0xe2760d[_0x089f('0x42')]=_[_0x089f('0x43')](_0xe2760d['model'],_0xe2760d[_0x089f('0x41')]);_0x47b133['attributes']=_[_0x089f('0x43')](_0xe2760d[_0x089f('0x40')],qs[_0x089f('0x44')](_0x409f73[_0x089f('0x41')][_0x089f('0x44')]));_0x47b133[_0x089f('0x45')]=_0x47b133['attributes'][_0x089f('0x46')]?_0x47b133['attributes']:_0xe2760d[_0x089f('0x40')];if(!_0x409f73[_0x089f('0x41')]['hasOwnProperty'](_0x089f('0x47'))){_0x47b133[_0x089f('0x2c')]=qs['limit'](_0x409f73[_0x089f('0x41')][_0x089f('0x2c')]);_0x47b133['offset']=qs[_0x089f('0x2a')](_0x409f73['query'][_0x089f('0x2a')]);}_0x47b133[_0x089f('0x48')]=qs[_0x089f('0x49')](_0x409f73['query'][_0x089f('0x49')]);_0x47b133[_0x089f('0x4a')]=qs[_0x089f('0x42')](_[_0x089f('0x4b')](_0x409f73[_0x089f('0x41')],_0xe2760d['filters']),_0x4881fe);if(_0x409f73[_0x089f('0x41')][_0x089f('0x4c')]){_0x47b133[_0x089f('0x4a')]=_[_0x089f('0x4d')](_0x47b133['where'],{'$or':_[_0x089f('0x3a')](_0x4881fe,function(_0x4e9128){if(_0x4e9128['type']!==_0x089f('0x4e')){var _0x42ebc4={};_0x42ebc4[_0x4e9128['name']]={'$like':'%'+_0x409f73[_0x089f('0x41')]['filter']+'%'};return _0x42ebc4;}})});}_0x47b133=_[_0x089f('0x4d')]({},_0x47b133,_0x409f73[_0x089f('0x4f')]);var _0x524fef={'where':_0x47b133[_0x089f('0x4a')]};return db[_0x089f('0x3b')][_0x089f('0x2d')](_0x524fef)[_0x089f('0x1d')](function(_0x3a1b72){_0x59587d[_0x089f('0x2d')]=_0x3a1b72;if(_0x409f73[_0x089f('0x41')][_0x089f('0x50')]){_0x47b133[_0x089f('0x51')]=[{'all':!![]}];}return db[_0x089f('0x3b')][_0x089f('0x52')](_0x47b133);})[_0x089f('0x1d')](function(_0x3a3659){_0x59587d[_0x089f('0x53')]=_0x3a3659;return _0x59587d;})[_0x089f('0x1d')](respondWithFilteredResult(_0x8cc0a1,_0x47b133))[_0x089f('0x54')](handleError(_0x8cc0a1,null));};exports[_0x089f('0x55')]=function(_0x5dda38,_0x1aa716){var _0xed7510={'raw':!![],'where':{'id':_0x5dda38[_0x089f('0x56')]['id']}},_0x37cffa={};_0x37cffa[_0x089f('0x40')]=_[_0x089f('0x57')](db[_0x089f('0x3b')]['rawAttributes']);_0x37cffa[_0x089f('0x41')]=_['keys'](_0x5dda38['query']);_0x37cffa[_0x089f('0x42')]=_[_0x089f('0x43')](_0x37cffa['model'],_0x37cffa[_0x089f('0x41')]);_0xed7510[_0x089f('0x45')]=_[_0x089f('0x43')](_0x37cffa[_0x089f('0x40')],qs[_0x089f('0x44')](_0x5dda38[_0x089f('0x41')][_0x089f('0x44')]));_0xed7510[_0x089f('0x45')]=_0xed7510[_0x089f('0x45')][_0x089f('0x46')]?_0xed7510[_0x089f('0x45')]:_0x37cffa['model'];if(_0x5dda38[_0x089f('0x41')]['includeAll']){_0xed7510['include']=[{'all':!![]}];}_0xed7510=_[_0x089f('0x4d')]({},_0xed7510,_0x5dda38[_0x089f('0x4f')]);return db['ChatQueue'][_0x089f('0x58')](_0xed7510)[_0x089f('0x1d')](handleEntityNotFound(_0x1aa716,null))[_0x089f('0x1d')](respondWithResult(_0x1aa716,null))[_0x089f('0x54')](handleError(_0x1aa716,null));};exports[_0x089f('0x59')]=function(_0x2e2ceb,_0x15eefb){return db['ChatQueue'][_0x089f('0x59')](_0x2e2ceb['body'],{})[_0x089f('0x1d')](function(_0x5d2871){var _0x3aa9e3=_0x2e2ceb[_0x089f('0x5a')][_0x089f('0x5b')]({'plain':!![]});if(!_0x3aa9e3)throw new Error(_0x089f('0x5c'));if(_0x3aa9e3['role']===_0x089f('0x5a')){var _0x3625a2=_0x5d2871[_0x089f('0x5b')]({'plain':!![]});var _0x3362f4=_0x089f('0x5d');return db['UserProfileSection']['find']({'where':{'name':_0x3362f4,'userProfileId':_0x3aa9e3[_0x089f('0x5e')]},'raw':!![]})[_0x089f('0x1d')](function(_0x223725){if(_0x223725&&_0x223725[_0x089f('0x5f')]===0x0){return db[_0x089f('0x35')][_0x089f('0x59')]({'name':_0x3625a2['name'],'resourceId':_0x3625a2['id'],'type':_0x223725['name'],'sectionId':_0x223725['id']},{})['then'](function(){return _0x5d2871;});}else{return _0x5d2871;}})[_0x089f('0x54')](function(_0xbdadf3){logger['error'](_0x089f('0x60'),_0xbdadf3);throw _0xbdadf3;});}return _0x5d2871;})[_0x089f('0x1d')](respondWithResult(_0x15eefb,0xc9))[_0x089f('0x54')](handleError(_0x15eefb,null));};exports['update']=function(_0x5c3d30,_0x380f78){if(_0x5c3d30[_0x089f('0x61')]['id']){delete _0x5c3d30[_0x089f('0x61')]['id'];}return db['ChatQueue'][_0x089f('0x58')]({'where':{'id':_0x5c3d30[_0x089f('0x56')]['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x380f78,null))['then'](saveUpdates(_0x5c3d30[_0x089f('0x61')],null))['then'](respondWithResult(_0x380f78,null))[_0x089f('0x54')](handleError(_0x380f78,null));};exports['destroy']=function(_0x586023,_0x568063){return db['ChatQueue'][_0x089f('0x58')]({'where':{'id':_0x586023[_0x089f('0x56')]['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x568063,null))['then'](removeEntity(_0x568063,null))[_0x089f('0x54')](handleError(_0x568063,null));};exports[_0x089f('0x62')]=function(_0x25ae1a,_0x1bba27){return db[_0x089f('0x3b')][_0x089f('0x62')]()[_0x089f('0x1d')](respondWithResult(_0x1bba27,null))[_0x089f('0x54')](handleError(_0x1bba27,null));};exports[_0x089f('0x63')]=function(_0x1edcef,_0x403a53,_0x4e45c2){var _0x1a5b2f={'raw':!![],'where':{}},_0x4787af={},_0x48bb63;return db[_0x089f('0x3b')][_0x089f('0x64')]({'where':{'id':_0x1edcef[_0x089f('0x56')]['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x403a53,null))[_0x089f('0x1d')](function(_0x3a8889){if(_0x3a8889){_0x48bb63=_0x3a8889['get']({'plain':!![]});_0x4787af[_0x089f('0x40')]=_[_0x089f('0x57')](db['UserChatQueue'][_0x089f('0x3c')]);_0x4787af['query']=_[_0x089f('0x57')](_0x1edcef['query']);_0x4787af['filters']=_[_0x089f('0x43')](_0x4787af[_0x089f('0x40')],_0x4787af[_0x089f('0x41')]);_0x1a5b2f[_0x089f('0x45')]=_['intersection'](_0x4787af[_0x089f('0x40')],qs[_0x089f('0x44')](_0x1edcef[_0x089f('0x41')][_0x089f('0x44')]));_0x1a5b2f['attributes']=_0x1a5b2f[_0x089f('0x45')]['length']?_0x1a5b2f[_0x089f('0x45')]:_0x4787af[_0x089f('0x40')];if(!_0x1edcef[_0x089f('0x41')][_0x089f('0x65')](_0x089f('0x47'))){_0x1a5b2f[_0x089f('0x2c')]=qs[_0x089f('0x2c')](_0x1edcef[_0x089f('0x41')]['limit']);_0x1a5b2f['offset']=qs[_0x089f('0x2a')](_0x1edcef['query'][_0x089f('0x2a')]);}_0x1a5b2f[_0x089f('0x48')]=qs['sort'](_0x1edcef[_0x089f('0x41')][_0x089f('0x49')]);_0x1a5b2f['where']=qs[_0x089f('0x42')](_['pick'](_0x1edcef[_0x089f('0x41')],_0x4787af['filters']));_0x1a5b2f[_0x089f('0x4a')][_0x089f('0x66')]=_0x3a8889['id'];if(_0x1edcef[_0x089f('0x41')][_0x089f('0x4c')]){_0x1a5b2f[_0x089f('0x4a')]=_[_0x089f('0x4d')](_0x1a5b2f[_0x089f('0x4a')],{'$or':_[_0x089f('0x3a')](_0x1a5b2f[_0x089f('0x45')],function(_0x534449){var _0x5a57c4={};_0x5a57c4[_0x534449]={'$like':'%'+_0x1edcef[_0x089f('0x41')][_0x089f('0x4c')]+'%'};return _0x5a57c4;})});}_0x1a5b2f=_[_0x089f('0x4d')]({},_0x1a5b2f,_0x1edcef[_0x089f('0x4f')]);return db[_0x089f('0x67')][_0x089f('0x52')](_0x1a5b2f);}})[_0x089f('0x1d')](function(_0x320681){if(_0x320681){return db[_0x089f('0x68')][_0x089f('0x69')]({'where':{'id':_[_0x089f('0x3a')](_0x320681,_0x089f('0x6a')),'role':_0x089f('0x6b')},'attributes':['id',_0x089f('0x37'),'chatPause',_0x089f('0x6c'),_0x089f('0x6d')]});}})['then'](function(_0x47933e){if(_0x47933e){return{'count':_0x47933e[_0x089f('0x2d')],'rows':_['map'](_0x47933e[_0x089f('0x53')],function(_0x10dbd6){return{'membername':_0x10dbd6['name'],'UserId':_0x10dbd6['id'],'queue_name':_0x48bb63[_0x089f('0x37')],'ChatQueueId':_0x48bb63['id'],'interface':util[_0x089f('0x6e')](_0x089f('0x6f'),_0x089f('0x70'),_0x10dbd6[_0x089f('0x37')]),'penalty':0x0,'paused':_0x10dbd6['chatPause'],'createdAt':_0x10dbd6[_0x089f('0x6d')],'updatedAt':_0x10dbd6[_0x089f('0x6c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x089f('0x1d')](respondWithFilteredResult(_0x403a53,_0x1a5b2f))['catch'](handleError(_0x403a53,null));};exports['getTeams']=function(_0x1fab66,_0x102b4a,_0x30dc4d){var _0x1f6a80={};var _0x5a2d3a={};var _0x39e600;var _0x446573;return db[_0x089f('0x3b')][_0x089f('0x64')]({'where':{'id':_0x1fab66['params']['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x102b4a,null))[_0x089f('0x1d')](function(_0x49815c){if(_0x49815c){_0x39e600=_0x49815c;_0x5a2d3a[_0x089f('0x40')]=_[_0x089f('0x57')](db['Team']['rawAttributes']);_0x5a2d3a[_0x089f('0x41')]=_[_0x089f('0x57')](_0x1fab66['query']);_0x5a2d3a[_0x089f('0x42')]=_[_0x089f('0x43')](_0x5a2d3a[_0x089f('0x40')],_0x5a2d3a[_0x089f('0x41')]);_0x1f6a80[_0x089f('0x45')]=_[_0x089f('0x43')](_0x5a2d3a[_0x089f('0x40')],qs['fields'](_0x1fab66[_0x089f('0x41')]['fields']));_0x1f6a80[_0x089f('0x45')]=_0x1f6a80[_0x089f('0x45')]['length']?_0x1f6a80[_0x089f('0x45')]:_0x5a2d3a[_0x089f('0x40')];_0x1f6a80[_0x089f('0x48')]=qs[_0x089f('0x49')](_0x1fab66['query']['sort']);_0x1f6a80['where']=qs[_0x089f('0x42')](_[_0x089f('0x4b')](_0x1fab66['query'],_0x5a2d3a[_0x089f('0x42')]));if(_0x1fab66['query'][_0x089f('0x4c')]){_0x1f6a80[_0x089f('0x4a')]=_[_0x089f('0x4d')](_0x1f6a80['where'],{'$or':_[_0x089f('0x3a')](_0x1f6a80[_0x089f('0x45')],function(_0x22a32a){var _0x3e15e8={};_0x3e15e8[_0x22a32a]={'$like':'%'+_0x1fab66['query'][_0x089f('0x4c')]+'%'};return _0x3e15e8;})});}_0x1f6a80=_[_0x089f('0x4d')]({},_0x1f6a80,_0x1fab66[_0x089f('0x4f')]);return _0x39e600[_0x089f('0x71')](_0x1f6a80);}})[_0x089f('0x1d')](function(_0x1eac2f){if(_0x1eac2f){_0x446573=_0x1eac2f[_0x089f('0x46')];if(!_0x1fab66[_0x089f('0x41')]['hasOwnProperty'](_0x089f('0x47'))){_0x1f6a80['limit']=qs['limit'](_0x1fab66['query'][_0x089f('0x2c')]);_0x1f6a80[_0x089f('0x2a')]=qs[_0x089f('0x2a')](_0x1fab66['query']['offset']);}return _0x39e600[_0x089f('0x71')](_0x1f6a80);}})[_0x089f('0x1d')](function(_0x3481a7){if(_0x3481a7){return _0x3481a7?{'count':_0x446573,'rows':_0x3481a7}:null;}})['then'](respondWithResult(_0x102b4a,null))['catch'](handleError(_0x102b4a,null));};exports[_0x089f('0x72')]=function(_0x307023,_0x2c60dd,_0x34991b){var _0x31d319=_0x307023[_0x089f('0x61')][_0x089f('0x73')];return db[_0x089f('0x74')][_0x089f('0x52')]({'where':{'id':_0x31d319},'attributes':['id'],'include':[{'model':db[_0x089f('0x68')],'as':'Agents','attributes':['id',_0x089f('0x37'),_0x089f('0x75'),_0x089f('0x76'),_0x089f('0x77')],'raw':!![]}]})['then'](function(_0x201f8d){if(_0x201f8d){var _0x1fc0ba=_[_0x089f('0x78')](_0x201f8d,function(_0x27e60e){var _0x65efc3=_0x27e60e[_0x089f('0x5b')]({'plain':!![]});return _0x65efc3[_0x089f('0x79')];});return db['ChatQueue'][_0x089f('0x58')]({'where':{'id':_0x307023['params']['id']}})[_0x089f('0x1d')](function(_0x312c78){return db['sequelize']['transaction'](function(_0x3482aa){return _0x312c78['addTeams'](_0x31d319,{'transaction':_0x3482aa})[_0x089f('0x1d')](function(){return BPromise[_0x089f('0x7a')](_0x1fc0ba,function(_0x1b15b6){return db[_0x089f('0x67')]['findOrCreate']({'where':{'UserId':_0x1b15b6['id'],'ChatQueueId':_0x307023[_0x089f('0x56')]['id']},'transaction':_0x3482aa});});})[_0x089f('0x1d')](function(){_0x1fc0ba[_0x089f('0x7b')](function(_0x3099bf){socket[_0x089f('0x7c')](_0x089f('0x7d'),{'UserId':_0x3099bf['id'],'ChatQueueId':_0x312c78['id']});});});});});}})[_0x089f('0x1d')](respondWithStatusCode(_0x2c60dd,null))[_0x089f('0x54')](handleError(_0x2c60dd,null));};exports[_0x089f('0x7e')]=function(_0x548086,_0x3b79b7,_0x4c3fc7){return db[_0x089f('0x74')][_0x089f('0x52')]({'where':{'id':_0x548086[_0x089f('0x41')][_0x089f('0x73')]},'attributes':['id'],'include':[{'model':db[_0x089f('0x68')],'as':_0x089f('0x79'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3b79b7,null))['then'](function(_0x39b470){var _0x3b8c92=_[_0x089f('0x3a')](_0x39b470,'id');var _0x525719=[];var _0xe58a36=[];var _0x557906=squel['select']();_0x557906['field'](_0x089f('0x7f'))[_0x089f('0x80')](_0x089f('0x81'),'tq')[_0x089f('0x82')](_0x089f('0x83'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x089f('0x4a')]('ChatQueueId\x20=\x20?',_0x548086['params']['id']);for(var _0x521bf3=0x0;_0x521bf3<_0x39b470['length'];_0x521bf3+=0x1){let _0x491d98=_0x39b470[_0x521bf3];for(var _0x434a59=0x0;_0x434a59<_0x491d98[_0x089f('0x79')][_0x089f('0x46')];_0x434a59+=0x1){let _0x12f342=_0x491d98[_0x089f('0x79')][_0x434a59];var _0x13f92a=_0x557906[_0x089f('0x84')]();_0x13f92a[_0x089f('0x4a')](_0x089f('0x85'),_0x12f342['id']);_0xe58a36[_0x089f('0x86')](db[_0x089f('0x87')][_0x089f('0x41')](_0x13f92a['toString'](),{'type':db[_0x089f('0x87')][_0x089f('0x88')][_0x089f('0x89')]})[_0x089f('0x1d')](function(_0x5c94b2){if(_0x5c94b2['length']===0x1){return _0x12f342['id'];}else{var _0x3c86d8=_['every'](_[_0x089f('0x3a')](_0x5c94b2,'TeamId'),function(_0x5dff4e){return _['includes'](_0x3b8c92,_0x5dff4e);});if(_0x3c86d8){return _0x12f342['id'];}}}));}}return BPromise['all'](_0xe58a36)['then'](function(_0x511e40){_0x525719=_(_0x525719)['union'](_0x511e40)[_0x089f('0x8a')]()[_0x089f('0x8b')]();return db['ChatQueue'][_0x089f('0x58')]({'where':{'id':_0x548086['params']['id']}})['then'](function(_0x218795){return db['sequelize'][_0x089f('0x8c')](function(_0x4f75bb){return _0x218795[_0x089f('0x7e')](_0x548086['query']['ids'],{'transaction':_0x4f75bb})['then'](function(){if(!_['isEmpty'](_0x525719)){return _0x218795[_0x089f('0x8d')](_0x525719,{'transaction':_0x4f75bb});}})[_0x089f('0x1d')](function(){_0x525719['forEach'](function(_0x4c4ff5){socket['emit'](_0x089f('0x8e'),{'UserId':_0x4c4ff5,'ChatQueueId':_0x218795['id']});});});});});});})[_0x089f('0x1d')](respondWithStatusCode(_0x3b79b7,null))[_0x089f('0x54')](handleError(_0x3b79b7,null));};exports[_0x089f('0x8f')]=function(_0x4fcf9c,_0x44eb5c,_0x51174b){return db[_0x089f('0x3b')]['find']({'where':{'id':_0x4fcf9c[_0x089f('0x56')]['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x44eb5c,null))[_0x089f('0x1d')](function(_0x3cf976){if(_0x3cf976){return _0x3cf976['addAgents'](_0x4fcf9c[_0x089f('0x61')][_0x089f('0x73')],_[_0x089f('0x90')](_0x4fcf9c[_0x089f('0x61')],['ids','id'])||{})['spread'](function(_0x4a02fa){for(var _0x5beac2=0x0;_0x5beac2<_0x4fcf9c[_0x089f('0x61')][_0x089f('0x73')][_0x089f('0x46')];_0x5beac2+=0x1){socket[_0x089f('0x7c')](_0x089f('0x7d'),{'UserId':Number(_0x4fcf9c[_0x089f('0x61')]['ids'][_0x5beac2]),'ChatQueueId':Number(_0x4fcf9c[_0x089f('0x56')]['id'])});}return _0x4a02fa;});}})[_0x089f('0x1d')](respondWithResult(_0x44eb5c,null))[_0x089f('0x54')](handleError(_0x44eb5c,null));};exports['removeAgents']=function(_0x507be7,_0x563150,_0x489429){return db[_0x089f('0x3b')][_0x089f('0x58')]({'where':{'id':_0x507be7[_0x089f('0x56')]['id']}})[_0x089f('0x1d')](handleEntityNotFound(_0x563150,null))[_0x089f('0x1d')](function(_0x1d702d){if(_0x1d702d){return _0x1d702d[_0x089f('0x8d')](_0x507be7[_0x089f('0x41')][_0x089f('0x73')])['then'](function(){if(_[_0x089f('0x91')](_0x507be7[_0x089f('0x41')]['ids'])){for(var _0x549720=0x0;_0x549720<_0x507be7[_0x089f('0x41')]['ids'][_0x089f('0x46')];_0x549720+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x507be7[_0x089f('0x41')][_0x089f('0x73')][_0x549720]),'ChatQueueId':Number(_0x507be7[_0x089f('0x56')]['id'])});}}else{socket['emit'](_0x089f('0x8e'),{'UserId':Number(_0x507be7[_0x089f('0x41')][_0x089f('0x73')]),'ChatQueueId':Number(_0x507be7[_0x089f('0x56')]['id'])});}});}})[_0x089f('0x1d')](respondWithStatusCode(_0x563150,null))['catch'](handleError(_0x563150,null));};exports['getAgents']=function(_0x50a2b2,_0x9f0d18,_0x956a43){var _0x12c810={};var _0xa63b6b={};var _0x171c8e;var _0x429ed2;return db['ChatQueue']['findOne']({'where':{'id':_0x50a2b2[_0x089f('0x56')]['id']}})['then'](handleEntityNotFound(_0x9f0d18,null))['then'](function(_0x25c523){if(_0x25c523){_0x171c8e=_0x25c523;_0xa63b6b[_0x089f('0x40')]=_[_0x089f('0x57')](db[_0x089f('0x68')][_0x089f('0x3c')]);_0xa63b6b[_0x089f('0x41')]=_[_0x089f('0x57')](_0x50a2b2[_0x089f('0x41')]);_0xa63b6b[_0x089f('0x42')]=_['intersection'](_0xa63b6b[_0x089f('0x40')],_0xa63b6b[_0x089f('0x41')]);_0x12c810[_0x089f('0x45')]=_['intersection'](_0xa63b6b[_0x089f('0x40')],qs[_0x089f('0x44')](_0x50a2b2[_0x089f('0x41')]['fields']));_0x12c810[_0x089f('0x45')]=_0x12c810[_0x089f('0x45')][_0x089f('0x46')]?_0x12c810[_0x089f('0x45')]:_0xa63b6b['model'];_0x12c810[_0x089f('0x48')]=qs[_0x089f('0x49')](_0x50a2b2['query'][_0x089f('0x49')]);_0x12c810['where']=qs[_0x089f('0x42')](_[_0x089f('0x4b')](_0x50a2b2['query'],_0xa63b6b[_0x089f('0x42')]));if(_0x50a2b2[_0x089f('0x41')][_0x089f('0x4c')]){_0x12c810['where']=_[_0x089f('0x4d')](_0x12c810['where'],{'$or':_[_0x089f('0x3a')](_0x12c810['attributes'],function(_0x12c0bc){var _0x922ca9={};_0x922ca9[_0x12c0bc]={'$like':'%'+_0x50a2b2['query']['filter']+'%'};return _0x922ca9;})});}_0x12c810=_['merge']({},_0x12c810,_0x50a2b2['options']);return _0x171c8e[_0x089f('0x92')](_0x12c810);}})['then'](function(_0x247733){if(_0x247733){_0x429ed2=_0x247733[_0x089f('0x46')];if(!_0x50a2b2[_0x089f('0x41')][_0x089f('0x65')]('nolimit')){_0x12c810[_0x089f('0x2c')]=qs[_0x089f('0x2c')](_0x50a2b2[_0x089f('0x41')][_0x089f('0x2c')]);_0x12c810['offset']=qs[_0x089f('0x2a')](_0x50a2b2[_0x089f('0x41')][_0x089f('0x2a')]);}return _0x171c8e[_0x089f('0x92')](_0x12c810);}})[_0x089f('0x1d')](function(_0x2005df){if(_0x2005df){return _0x2005df?{'count':_0x429ed2,'rows':_0x2005df}:null;}})[_0x089f('0x1d')](respondWithResult(_0x9f0d18,null))[_0x089f('0x54')](handleError(_0x9f0d18,null));}; \ No newline at end of file +var _0x114d=['send','index','ChatQueue','rawAttributes','type','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','chatPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','removeTeams','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','userChatQueue:save','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','client','http','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','get','ChatQueues','UserProfileResource','destroy','stack','name'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x114d,0x182));var _0xd114=function(_0xa9d2ab,_0x55455d){_0xa9d2ab=_0xa9d2ab-0x0;var _0x2a562d=_0x114d[_0xa9d2ab];return _0x2a562d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd114('0x0'));var zipdir=require(_0xd114('0x1'));var jsonpatch=require(_0xd114('0x2'));var rp=require(_0xd114('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd114('0x4'));var util=require(_0xd114('0x5'));var path=require(_0xd114('0x6'));var sox=require(_0xd114('0x7'));var csv=require('to-csv');var ejs=require(_0xd114('0x8'));var fs=require('fs');var fs_extra=require(_0xd114('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd114('0xa'));var jsforce=require(_0xd114('0xb'));var deskjs=require(_0xd114('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd114('0xd'));var Papa=require(_0xd114('0xe'));var Redis=require(_0xd114('0xf'));var authService=require(_0xd114('0x10'));var qs=require(_0xd114('0x11'));var as=require(_0xd114('0x12'));var hardwareService=require(_0xd114('0x13'));var logger=require(_0xd114('0x14'))(_0xd114('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd114('0x16'));var db=require(_0xd114('0x17'))['db'];config[_0xd114('0x18')]=_[_0xd114('0x19')](config[_0xd114('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0xd114('0x1a')](socket);var jayson=require(_0xd114('0x1b'));var client=jayson[_0xd114('0x1c')][_0xd114('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x3bec84,_0x2de6e6,_0x41091e,_0x3b68b2){return new BPromise(function(_0x5e9101,_0x1b3993){var _0x59addb=_0x3b68b2||client;return _0x59addb['request'](_0x3bec84,_0x41091e)['then'](function(_0x2ec866){logger[_0xd114('0x1e')](_0xd114('0x1f'),_0x2de6e6,'request\x20sent');logger[_0xd114('0x20')](_0xd114('0x21'),_0x2de6e6,_0xd114('0x22'),JSON[_0xd114('0x23')](_0x2ec866));if(_0x2ec866[_0xd114('0x24')]){if(_0x2ec866['error'][_0xd114('0x25')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2de6e6,_0x2ec866[_0xd114('0x24')][_0xd114('0x26')]);return _0x1b3993(_0x2ec866[_0xd114('0x24')][_0xd114('0x26')]);}logger[_0xd114('0x24')](_0xd114('0x1f'),_0x2de6e6,_0x2ec866['error']['message']);return _0x5e9101(_0x2ec866[_0xd114('0x24')][_0xd114('0x26')]);}else{logger['info'](_0xd114('0x1f'),_0x2de6e6,'request\x20sent');_0x5e9101(_0x2ec866[_0xd114('0x27')][_0xd114('0x26')]);}})['catch'](function(_0x230153){logger[_0xd114('0x24')]('ChatQueue,\x20%s,\x20%s',_0x2de6e6,_0x230153);_0x1b3993(_0x230153);});});}function respondWithStatusCode(_0x44d7c1,_0x487e19){_0x487e19=_0x487e19||0xcc;return function(_0xe8d9c4){if(_0xe8d9c4){return _0x44d7c1[_0xd114('0x28')](_0x487e19);}return _0x44d7c1['status'](_0x487e19)[_0xd114('0x29')]();};}function respondWithResult(_0x17035b,_0x598b63){_0x598b63=_0x598b63||0xc8;return function(_0xd70a2e){if(_0xd70a2e){return _0x17035b[_0xd114('0x2a')](_0x598b63)[_0xd114('0x2b')](_0xd70a2e);}};}function respondWithFilteredResult(_0x1f056f,_0x277d14){return function(_0x4d4862){if(_0x4d4862){var _0x115671=typeof _0x277d14[_0xd114('0x2c')]===_0xd114('0x2d')&&typeof _0x277d14[_0xd114('0x2e')]===_0xd114('0x2d');var _0x196099=_0x4d4862[_0xd114('0x2f')];var _0x4d162c=_0x115671?0x0:_0x277d14[_0xd114('0x2c')];var _0x6b3388=_0x115671?_0x4d4862[_0xd114('0x2f')]:_0x277d14[_0xd114('0x2c')]+_0x277d14['limit'];var _0x4dd630;if(_0x6b3388>=_0x196099){_0x6b3388=_0x196099;_0x4dd630=0xc8;}else{_0x4dd630=0xce;}_0x1f056f[_0xd114('0x2a')](_0x4dd630);return _0x1f056f['set'](_0xd114('0x30'),_0x4d162c+'-'+_0x6b3388+'/'+_0x196099)[_0xd114('0x2b')](_0x4d4862);}return null;};}function patchUpdates(_0x204910){return function(_0x57904d){try{jsonpatch['apply'](_0x57904d,_0x204910,!![]);}catch(_0x2f8517){return BPromise['reject'](_0x2f8517);}return _0x57904d[_0xd114('0x31')]();};}function saveUpdates(_0x8aa921,_0x599881){return function(_0x396e22){if(_0x396e22){return _0x396e22[_0xd114('0x32')](_0x8aa921)[_0xd114('0x33')](function(_0x2f1de3){return _0x2f1de3;});}return null;};}function removeEntity(_0x3450df,_0x25a241){return function(_0x1e7769){if(_0x1e7769){return _0x1e7769['destroy']()[_0xd114('0x33')](function(){var _0x3ca885=_0x1e7769[_0xd114('0x34')]({'plain':!![]});var _0x48ca3b=_0xd114('0x35');return db[_0xd114('0x36')][_0xd114('0x37')]({'where':{'type':_0x48ca3b,'resourceId':_0x3ca885['id']}})['then'](function(){return _0x1e7769;});})[_0xd114('0x33')](function(){_0x3450df[_0xd114('0x2a')](0xcc)[_0xd114('0x29')]();});}};}function handleEntityNotFound(_0x329c18,_0x324715){return function(_0x3e6805){if(!_0x3e6805){_0x329c18['sendStatus'](0x194);}return _0x3e6805;};}function handleError(_0x2a236d,_0x723486){_0x723486=_0x723486||0x1f4;return function(_0x5de9ab){logger[_0xd114('0x24')](_0x5de9ab[_0xd114('0x38')]);if(_0x5de9ab[_0xd114('0x39')]){delete _0x5de9ab[_0xd114('0x39')];}_0x2a236d[_0xd114('0x2a')](_0x723486)[_0xd114('0x3a')](_0x5de9ab);};}exports[_0xd114('0x3b')]=function(_0xcd248,_0x42d1a0){var _0x4cf09d={},_0x38d77b={},_0x1fd8a9={'count':0x0,'rows':[]};var _0x1bddfa=_['map'](db[_0xd114('0x3c')][_0xd114('0x3d')],function(_0x42a1f8){return{'name':_0x42a1f8['fieldName'],'type':_0x42a1f8[_0xd114('0x3e')]['key']};});_0x38d77b[_0xd114('0x3f')]=_[_0xd114('0x40')](_0x1bddfa,_0xd114('0x39'));_0x38d77b['query']=_[_0xd114('0x41')](_0xcd248[_0xd114('0x42')]);_0x38d77b['filters']=_[_0xd114('0x43')](_0x38d77b[_0xd114('0x3f')],_0x38d77b['query']);_0x4cf09d[_0xd114('0x44')]=_[_0xd114('0x43')](_0x38d77b[_0xd114('0x3f')],qs[_0xd114('0x45')](_0xcd248[_0xd114('0x42')][_0xd114('0x45')]));_0x4cf09d[_0xd114('0x44')]=_0x4cf09d[_0xd114('0x44')][_0xd114('0x46')]?_0x4cf09d[_0xd114('0x44')]:_0x38d77b[_0xd114('0x3f')];if(!_0xcd248[_0xd114('0x42')][_0xd114('0x47')](_0xd114('0x48'))){_0x4cf09d[_0xd114('0x2e')]=qs[_0xd114('0x2e')](_0xcd248[_0xd114('0x42')][_0xd114('0x2e')]);_0x4cf09d[_0xd114('0x2c')]=qs['offset'](_0xcd248['query'][_0xd114('0x2c')]);}_0x4cf09d[_0xd114('0x49')]=qs[_0xd114('0x4a')](_0xcd248[_0xd114('0x42')]['sort']);_0x4cf09d[_0xd114('0x4b')]=qs[_0xd114('0x4c')](_[_0xd114('0x4d')](_0xcd248[_0xd114('0x42')],_0x38d77b[_0xd114('0x4c')]),_0x1bddfa);if(_0xcd248[_0xd114('0x42')][_0xd114('0x4e')]){_0x4cf09d[_0xd114('0x4b')]=_['merge'](_0x4cf09d[_0xd114('0x4b')],{'$or':_['map'](_0x1bddfa,function(_0x549df3){if(_0x549df3['type']!=='VIRTUAL'){var _0x3d7ab7={};_0x3d7ab7[_0x549df3['name']]={'$like':'%'+_0xcd248[_0xd114('0x42')][_0xd114('0x4e')]+'%'};return _0x3d7ab7;}})});}_0x4cf09d=_[_0xd114('0x4f')]({},_0x4cf09d,_0xcd248[_0xd114('0x50')]);var _0x450f53={'where':_0x4cf09d[_0xd114('0x4b')]};return db[_0xd114('0x3c')]['count'](_0x450f53)[_0xd114('0x33')](function(_0x481d92){_0x1fd8a9[_0xd114('0x2f')]=_0x481d92;if(_0xcd248[_0xd114('0x42')][_0xd114('0x51')]){_0x4cf09d['include']=[{'all':!![]}];}return db[_0xd114('0x3c')][_0xd114('0x52')](_0x4cf09d);})['then'](function(_0x5f1cbb){_0x1fd8a9[_0xd114('0x53')]=_0x5f1cbb;return _0x1fd8a9;})['then'](respondWithFilteredResult(_0x42d1a0,_0x4cf09d))[_0xd114('0x54')](handleError(_0x42d1a0,null));};exports[_0xd114('0x55')]=function(_0x56540f,_0x514a47){var _0x213a9e={'raw':!![],'where':{'id':_0x56540f['params']['id']}},_0x1ba7ef={};_0x1ba7ef['model']=_[_0xd114('0x41')](db['ChatQueue'][_0xd114('0x3d')]);_0x1ba7ef[_0xd114('0x42')]=_[_0xd114('0x41')](_0x56540f['query']);_0x1ba7ef['filters']=_[_0xd114('0x43')](_0x1ba7ef['model'],_0x1ba7ef[_0xd114('0x42')]);_0x213a9e[_0xd114('0x44')]=_[_0xd114('0x43')](_0x1ba7ef[_0xd114('0x3f')],qs[_0xd114('0x45')](_0x56540f['query'][_0xd114('0x45')]));_0x213a9e['attributes']=_0x213a9e[_0xd114('0x44')][_0xd114('0x46')]?_0x213a9e['attributes']:_0x1ba7ef[_0xd114('0x3f')];if(_0x56540f[_0xd114('0x42')][_0xd114('0x51')]){_0x213a9e[_0xd114('0x56')]=[{'all':!![]}];}_0x213a9e=_[_0xd114('0x4f')]({},_0x213a9e,_0x56540f[_0xd114('0x50')]);return db['ChatQueue'][_0xd114('0x57')](_0x213a9e)[_0xd114('0x33')](handleEntityNotFound(_0x514a47,null))['then'](respondWithResult(_0x514a47,null))[_0xd114('0x54')](handleError(_0x514a47,null));};exports[_0xd114('0x58')]=function(_0x2adbbb,_0x186b22){return db['ChatQueue'][_0xd114('0x58')](_0x2adbbb['body'],{})[_0xd114('0x33')](function(_0x482fcb){var _0x5c4b1c=_0x2adbbb[_0xd114('0x59')][_0xd114('0x34')]({'plain':!![]});if(!_0x5c4b1c)throw new Error(_0xd114('0x5a'));if(_0x5c4b1c[_0xd114('0x5b')]===_0xd114('0x59')){var _0x5588cd=_0x482fcb['get']({'plain':!![]});var _0x215da1='ChatQueues';return db[_0xd114('0x5c')][_0xd114('0x57')]({'where':{'name':_0x215da1,'userProfileId':_0x5c4b1c[_0xd114('0x5d')]},'raw':!![]})[_0xd114('0x33')](function(_0x105ee0){if(_0x105ee0&&_0x105ee0['autoAssociation']===0x0){return db[_0xd114('0x36')][_0xd114('0x58')]({'name':_0x5588cd['name'],'resourceId':_0x5588cd['id'],'type':_0x105ee0[_0xd114('0x39')],'sectionId':_0x105ee0['id']},{})[_0xd114('0x33')](function(){return _0x482fcb;});}else{return _0x482fcb;}})[_0xd114('0x54')](function(_0x1548e8){logger['error'](_0xd114('0x5e'),_0x1548e8);throw _0x1548e8;});}return _0x482fcb;})[_0xd114('0x33')](respondWithResult(_0x186b22,0xc9))[_0xd114('0x54')](handleError(_0x186b22,null));};exports['update']=function(_0x35891b,_0x123b38){if(_0x35891b[_0xd114('0x5f')]['id']){delete _0x35891b[_0xd114('0x5f')]['id'];}return db[_0xd114('0x3c')]['find']({'where':{'id':_0x35891b[_0xd114('0x60')]['id']}})[_0xd114('0x33')](handleEntityNotFound(_0x123b38,null))[_0xd114('0x33')](saveUpdates(_0x35891b['body'],null))[_0xd114('0x33')](respondWithResult(_0x123b38,null))['catch'](handleError(_0x123b38,null));};exports[_0xd114('0x37')]=function(_0x1892e9,_0xee30bd){return db[_0xd114('0x3c')][_0xd114('0x57')]({'where':{'id':_0x1892e9['params']['id']}})[_0xd114('0x33')](handleEntityNotFound(_0xee30bd,null))[_0xd114('0x33')](removeEntity(_0xee30bd,null))[_0xd114('0x54')](handleError(_0xee30bd,null));};exports[_0xd114('0x61')]=function(_0xf7da3d,_0x4b8d28){return db[_0xd114('0x3c')][_0xd114('0x61')]()['then'](respondWithResult(_0x4b8d28,null))['catch'](handleError(_0x4b8d28,null));};exports[_0xd114('0x62')]=function(_0x444002,_0x17111d,_0x2ddfa9){var _0x19a039={'raw':!![],'where':{}},_0x216101={},_0xbf2aab;return db[_0xd114('0x3c')][_0xd114('0x63')]({'where':{'id':_0x444002['params']['id']}})[_0xd114('0x33')](handleEntityNotFound(_0x17111d,null))[_0xd114('0x33')](function(_0x2a5939){if(_0x2a5939){_0xbf2aab=_0x2a5939[_0xd114('0x34')]({'plain':!![]});_0x216101['model']=_['keys'](db[_0xd114('0x64')][_0xd114('0x3d')]);_0x216101[_0xd114('0x42')]=_[_0xd114('0x41')](_0x444002[_0xd114('0x42')]);_0x216101[_0xd114('0x4c')]=_['intersection'](_0x216101[_0xd114('0x3f')],_0x216101[_0xd114('0x42')]);_0x19a039['attributes']=_['intersection'](_0x216101[_0xd114('0x3f')],qs[_0xd114('0x45')](_0x444002[_0xd114('0x42')]['fields']));_0x19a039[_0xd114('0x44')]=_0x19a039[_0xd114('0x44')][_0xd114('0x46')]?_0x19a039[_0xd114('0x44')]:_0x216101['model'];if(!_0x444002[_0xd114('0x42')]['hasOwnProperty'](_0xd114('0x48'))){_0x19a039[_0xd114('0x2e')]=qs[_0xd114('0x2e')](_0x444002[_0xd114('0x42')][_0xd114('0x2e')]);_0x19a039[_0xd114('0x2c')]=qs['offset'](_0x444002['query'][_0xd114('0x2c')]);}_0x19a039['order']=qs[_0xd114('0x4a')](_0x444002['query']['sort']);_0x19a039[_0xd114('0x4b')]=qs[_0xd114('0x4c')](_[_0xd114('0x4d')](_0x444002[_0xd114('0x42')],_0x216101[_0xd114('0x4c')]));_0x19a039[_0xd114('0x4b')][_0xd114('0x65')]=_0x2a5939['id'];if(_0x444002['query']['filter']){_0x19a039[_0xd114('0x4b')]=_[_0xd114('0x4f')](_0x19a039[_0xd114('0x4b')],{'$or':_['map'](_0x19a039[_0xd114('0x44')],function(_0x54e769){var _0xbec75e={};_0xbec75e[_0x54e769]={'$like':'%'+_0x444002['query'][_0xd114('0x4e')]+'%'};return _0xbec75e;})});}_0x19a039=_[_0xd114('0x4f')]({},_0x19a039,_0x444002[_0xd114('0x50')]);return db[_0xd114('0x64')][_0xd114('0x52')](_0x19a039);}})[_0xd114('0x33')](function(_0x4086f6){if(_0x4086f6){return db[_0xd114('0x66')]['findAndCountAll']({'where':{'id':_[_0xd114('0x40')](_0x4086f6,'UserId'),'role':'agent'},'attributes':['id','name',_0xd114('0x67'),_0xd114('0x68'),'createdAt']});}})[_0xd114('0x33')](function(_0x2c76b3){if(_0x2c76b3){return{'count':_0x2c76b3[_0xd114('0x2f')],'rows':_[_0xd114('0x40')](_0x2c76b3[_0xd114('0x53')],function(_0x443985){return{'membername':_0x443985[_0xd114('0x39')],'UserId':_0x443985['id'],'queue_name':_0xbf2aab['name'],'ChatQueueId':_0xbf2aab['id'],'interface':util[_0xd114('0x69')](_0xd114('0x6a'),'SIP',_0x443985[_0xd114('0x39')]),'penalty':0x0,'paused':_0x443985[_0xd114('0x67')],'createdAt':_0x443985[_0xd114('0x6b')],'updatedAt':_0x443985['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17111d,_0x19a039))[_0xd114('0x54')](handleError(_0x17111d,null));};exports[_0xd114('0x6c')]=function(_0x3b26e8,_0x14d67b,_0x3d9cdf){var _0x1d1625={};var _0x5dc341={};var _0x1245b2;var _0x32bc93;return db['ChatQueue'][_0xd114('0x63')]({'where':{'id':_0x3b26e8['params']['id']}})['then'](handleEntityNotFound(_0x14d67b,null))['then'](function(_0x38244f){if(_0x38244f){_0x1245b2=_0x38244f;_0x5dc341[_0xd114('0x3f')]=_['keys'](db[_0xd114('0x6d')]['rawAttributes']);_0x5dc341[_0xd114('0x42')]=_[_0xd114('0x41')](_0x3b26e8[_0xd114('0x42')]);_0x5dc341[_0xd114('0x4c')]=_[_0xd114('0x43')](_0x5dc341[_0xd114('0x3f')],_0x5dc341[_0xd114('0x42')]);_0x1d1625[_0xd114('0x44')]=_[_0xd114('0x43')](_0x5dc341[_0xd114('0x3f')],qs['fields'](_0x3b26e8[_0xd114('0x42')][_0xd114('0x45')]));_0x1d1625['attributes']=_0x1d1625['attributes'][_0xd114('0x46')]?_0x1d1625[_0xd114('0x44')]:_0x5dc341['model'];_0x1d1625[_0xd114('0x49')]=qs['sort'](_0x3b26e8[_0xd114('0x42')][_0xd114('0x4a')]);_0x1d1625[_0xd114('0x4b')]=qs[_0xd114('0x4c')](_['pick'](_0x3b26e8[_0xd114('0x42')],_0x5dc341['filters']));if(_0x3b26e8['query']['filter']){_0x1d1625[_0xd114('0x4b')]=_[_0xd114('0x4f')](_0x1d1625[_0xd114('0x4b')],{'$or':_[_0xd114('0x40')](_0x1d1625[_0xd114('0x44')],function(_0x103e35){var _0x127e29={};_0x127e29[_0x103e35]={'$like':'%'+_0x3b26e8[_0xd114('0x42')]['filter']+'%'};return _0x127e29;})});}_0x1d1625=_['merge']({},_0x1d1625,_0x3b26e8[_0xd114('0x50')]);return _0x1245b2[_0xd114('0x6c')](_0x1d1625);}})[_0xd114('0x33')](function(_0x18c727){if(_0x18c727){_0x32bc93=_0x18c727['length'];if(!_0x3b26e8[_0xd114('0x42')][_0xd114('0x47')](_0xd114('0x48'))){_0x1d1625[_0xd114('0x2e')]=qs[_0xd114('0x2e')](_0x3b26e8['query']['limit']);_0x1d1625[_0xd114('0x2c')]=qs[_0xd114('0x2c')](_0x3b26e8['query'][_0xd114('0x2c')]);}return _0x1245b2[_0xd114('0x6c')](_0x1d1625);}})[_0xd114('0x33')](function(_0x144472){if(_0x144472){return _0x144472?{'count':_0x32bc93,'rows':_0x144472}:null;}})[_0xd114('0x33')](respondWithResult(_0x14d67b,null))[_0xd114('0x54')](handleError(_0x14d67b,null));};exports[_0xd114('0x6e')]=function(_0x16af3b,_0x47400b,_0x102a87){var _0x5c736f=_0x16af3b[_0xd114('0x5f')]['ids'];return db['Team'][_0xd114('0x52')]({'where':{'id':_0x5c736f},'attributes':['id'],'include':[{'model':db[_0xd114('0x66')],'as':_0xd114('0x6f'),'attributes':['id','name',_0xd114('0x70'),_0xd114('0x71'),_0xd114('0x72')],'raw':!![]}]})[_0xd114('0x33')](function(_0x5b2556){if(_0x5b2556){var _0x4e0c6c=_[_0xd114('0x73')](_0x5b2556,function(_0x3cb498){var _0x3d7e10=_0x3cb498['get']({'plain':!![]});return _0x3d7e10[_0xd114('0x6f')];});return db['ChatQueue'][_0xd114('0x57')]({'where':{'id':_0x16af3b[_0xd114('0x60')]['id']}})[_0xd114('0x33')](function(_0x4c3f85){return db[_0xd114('0x74')][_0xd114('0x75')](function(_0x41d642){return _0x4c3f85['addTeams'](_0x5c736f,{'transaction':_0x41d642})[_0xd114('0x33')](function(){return BPromise['each'](_0x4e0c6c,function(_0x3fd8c8){return db['UserChatQueue'][_0xd114('0x76')]({'where':{'UserId':_0x3fd8c8['id'],'ChatQueueId':_0x16af3b[_0xd114('0x60')]['id']},'transaction':_0x41d642});});})[_0xd114('0x33')](function(){_0x4e0c6c[_0xd114('0x77')](function(_0x35cef0){socket[_0xd114('0x78')]('userChatQueue:save',{'UserId':_0x35cef0['id'],'ChatQueueId':_0x4c3f85['id']});});});});});}})[_0xd114('0x33')](respondWithStatusCode(_0x47400b,null))[_0xd114('0x54')](handleError(_0x47400b,null));};exports['removeTeams']=function(_0x12ca78,_0x1182f1,_0x30568a){return db[_0xd114('0x6d')][_0xd114('0x52')]({'where':{'id':_0x12ca78[_0xd114('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd114('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1182f1,null))[_0xd114('0x33')](function(_0x417164){var _0x5f4377=_['map'](_0x417164,'id');var _0x43f05e=[];var _0xb338f9=[];var _0x46a5fc=squel['select']();_0x46a5fc[_0xd114('0x79')](_0xd114('0x7a'))[_0xd114('0x7b')](_0xd114('0x7c'),'tq')[_0xd114('0x7d')](_0xd114('0x7e'),'ut',_0xd114('0x7f'))['where'](_0xd114('0x80'),_0x12ca78[_0xd114('0x60')]['id']);for(var _0x3bf9b6=0x0;_0x3bf9b6<_0x417164[_0xd114('0x46')];_0x3bf9b6+=0x1){let _0x4af28c=_0x417164[_0x3bf9b6];for(var _0x3abfae=0x0;_0x3abfae<_0x4af28c[_0xd114('0x6f')][_0xd114('0x46')];_0x3abfae+=0x1){let _0x2da5f6=_0x4af28c[_0xd114('0x6f')][_0x3abfae];var _0x2c4f2c=_0x46a5fc[_0xd114('0x81')]();_0x2c4f2c[_0xd114('0x4b')](_0xd114('0x82'),_0x2da5f6['id']);_0xb338f9['push'](db[_0xd114('0x74')]['query'](_0x2c4f2c[_0xd114('0x83')](),{'type':db[_0xd114('0x74')]['QueryTypes'][_0xd114('0x84')]})[_0xd114('0x33')](function(_0x27bf3e){if(_0x27bf3e['length']===0x1){return _0x2da5f6['id'];}else{var _0x575d98=_[_0xd114('0x85')](_[_0xd114('0x40')](_0x27bf3e,_0xd114('0x86')),function(_0x16c857){return _['includes'](_0x5f4377,_0x16c857);});if(_0x575d98){return _0x2da5f6['id'];}}}));}}return BPromise[_0xd114('0x87')](_0xb338f9)['then'](function(_0x3d2ee5){_0x43f05e=_(_0x43f05e)[_0xd114('0x88')](_0x3d2ee5)[_0xd114('0x89')]()['value']();return db['ChatQueue'][_0xd114('0x57')]({'where':{'id':_0x12ca78[_0xd114('0x60')]['id']}})['then'](function(_0x58608e){return db[_0xd114('0x74')]['transaction'](function(_0xe43ca6){return _0x58608e[_0xd114('0x8a')](_0x12ca78[_0xd114('0x42')][_0xd114('0x8b')],{'transaction':_0xe43ca6})[_0xd114('0x33')](function(){if(!_[_0xd114('0x8c')](_0x43f05e)){return _0x58608e[_0xd114('0x8d')](_0x43f05e,{'transaction':_0xe43ca6});}})[_0xd114('0x33')](function(){_0x43f05e['forEach'](function(_0x4e0493){socket['emit'](_0xd114('0x8e'),{'UserId':_0x4e0493,'ChatQueueId':_0x58608e['id']});});});});});});})[_0xd114('0x33')](respondWithStatusCode(_0x1182f1,null))[_0xd114('0x54')](handleError(_0x1182f1,null));};exports[_0xd114('0x8f')]=function(_0x40a23d,_0x3a339c,_0x4b2a3c){return db[_0xd114('0x3c')]['find']({'where':{'id':_0x40a23d[_0xd114('0x60')]['id']}})[_0xd114('0x33')](handleEntityNotFound(_0x3a339c,null))['then'](function(_0x26edc3){if(_0x26edc3){return _0x26edc3['addAgents'](_0x40a23d[_0xd114('0x5f')][_0xd114('0x8b')],_[_0xd114('0x90')](_0x40a23d[_0xd114('0x5f')],[_0xd114('0x8b'),'id'])||{})['spread'](function(_0x1e6b44){for(var _0x5cdd2e=0x0;_0x5cdd2e<_0x40a23d[_0xd114('0x5f')][_0xd114('0x8b')]['length'];_0x5cdd2e+=0x1){socket[_0xd114('0x78')](_0xd114('0x91'),{'UserId':Number(_0x40a23d[_0xd114('0x5f')][_0xd114('0x8b')][_0x5cdd2e]),'ChatQueueId':Number(_0x40a23d['params']['id'])});}return _0x1e6b44;});}})[_0xd114('0x33')](respondWithResult(_0x3a339c,null))['catch'](handleError(_0x3a339c,null));};exports[_0xd114('0x8d')]=function(_0x3c3895,_0x380f0a,_0x504f39){return db[_0xd114('0x3c')][_0xd114('0x57')]({'where':{'id':_0x3c3895[_0xd114('0x60')]['id']}})['then'](handleEntityNotFound(_0x380f0a,null))[_0xd114('0x33')](function(_0x21a874){if(_0x21a874){return _0x21a874['removeAgents'](_0x3c3895[_0xd114('0x42')]['ids'])['then'](function(){if(_[_0xd114('0x92')](_0x3c3895[_0xd114('0x42')][_0xd114('0x8b')])){for(var _0x262b83=0x0;_0x262b83<_0x3c3895[_0xd114('0x42')][_0xd114('0x8b')][_0xd114('0x46')];_0x262b83+=0x1){socket[_0xd114('0x78')](_0xd114('0x8e'),{'UserId':Number(_0x3c3895[_0xd114('0x42')][_0xd114('0x8b')][_0x262b83]),'ChatQueueId':Number(_0x3c3895[_0xd114('0x60')]['id'])});}}else{socket[_0xd114('0x78')]('userChatQueue:remove',{'UserId':Number(_0x3c3895[_0xd114('0x42')][_0xd114('0x8b')]),'ChatQueueId':Number(_0x3c3895[_0xd114('0x60')]['id'])});}});}})['then'](respondWithStatusCode(_0x380f0a,null))[_0xd114('0x54')](handleError(_0x380f0a,null));};exports[_0xd114('0x93')]=function(_0x77234b,_0x3dbe86,_0x5c735b){var _0x59c49d={};var _0x28e132={};var _0x4ad186;var _0x4774ca;return db[_0xd114('0x3c')][_0xd114('0x63')]({'where':{'id':_0x77234b[_0xd114('0x60')]['id']}})['then'](handleEntityNotFound(_0x3dbe86,null))[_0xd114('0x33')](function(_0x371f21){if(_0x371f21){_0x4ad186=_0x371f21;_0x28e132[_0xd114('0x3f')]=_['keys'](db[_0xd114('0x66')][_0xd114('0x3d')]);_0x28e132[_0xd114('0x42')]=_[_0xd114('0x41')](_0x77234b[_0xd114('0x42')]);_0x28e132[_0xd114('0x4c')]=_[_0xd114('0x43')](_0x28e132['model'],_0x28e132[_0xd114('0x42')]);_0x59c49d[_0xd114('0x44')]=_[_0xd114('0x43')](_0x28e132[_0xd114('0x3f')],qs[_0xd114('0x45')](_0x77234b[_0xd114('0x42')][_0xd114('0x45')]));_0x59c49d[_0xd114('0x44')]=_0x59c49d[_0xd114('0x44')][_0xd114('0x46')]?_0x59c49d[_0xd114('0x44')]:_0x28e132['model'];_0x59c49d[_0xd114('0x49')]=qs[_0xd114('0x4a')](_0x77234b[_0xd114('0x42')][_0xd114('0x4a')]);_0x59c49d[_0xd114('0x4b')]=qs[_0xd114('0x4c')](_[_0xd114('0x4d')](_0x77234b['query'],_0x28e132[_0xd114('0x4c')]));if(_0x77234b[_0xd114('0x42')][_0xd114('0x4e')]){_0x59c49d[_0xd114('0x4b')]=_[_0xd114('0x4f')](_0x59c49d[_0xd114('0x4b')],{'$or':_[_0xd114('0x40')](_0x59c49d['attributes'],function(_0x200775){var _0x13ff9c={};_0x13ff9c[_0x200775]={'$like':'%'+_0x77234b['query'][_0xd114('0x4e')]+'%'};return _0x13ff9c;})});}_0x59c49d=_[_0xd114('0x4f')]({},_0x59c49d,_0x77234b[_0xd114('0x50')]);return _0x4ad186[_0xd114('0x93')](_0x59c49d);}})['then'](function(_0x4f5e3e){if(_0x4f5e3e){_0x4774ca=_0x4f5e3e[_0xd114('0x46')];if(!_0x77234b[_0xd114('0x42')]['hasOwnProperty']('nolimit')){_0x59c49d['limit']=qs[_0xd114('0x2e')](_0x77234b[_0xd114('0x42')][_0xd114('0x2e')]);_0x59c49d['offset']=qs['offset'](_0x77234b['query'][_0xd114('0x2c')]);}return _0x4ad186[_0xd114('0x93')](_0x59c49d);}})[_0xd114('0x33')](function(_0x472552){if(_0x472552){return _0x472552?{'count':_0x4774ca,'rows':_0x472552}:null;}})[_0xd114('0x33')](respondWithResult(_0x3dbe86,null))[_0xd114('0x54')](handleError(_0x3dbe86,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index d0978de..b5b7f29 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 _0xf977=['hook','events','../../mysqldb','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x103ff9,_0x576a4d){var _0x40693e=function(_0xd67bce){while(--_0xd67bce){_0x103ff9['push'](_0x103ff9['shift']());}};_0x40693e(++_0x576a4d);}(_0xf977,0x161));var _0x7f97=function(_0x4ebbe5,_0x55aebe){_0x4ebbe5=_0x4ebbe5-0x0;var _0x12deec=_0xf977[_0x4ebbe5];return _0x12deec;};'use strict';var EventEmitter=require(_0x7f97('0x0'));var ChatQueue=require(_0x7f97('0x1'))['db'][_0x7f97('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x7f97('0x3')](0x0);var events={'afterCreate':_0x7f97('0x4'),'afterUpdate':_0x7f97('0x5'),'afterDestroy':_0x7f97('0x6')};function emitEvent(_0x3c7112){return function(_0x22604a,_0x49b370,_0x454144){ChatQueueEvents['emit'](_0x3c7112+':'+_0x22604a['id'],_0x22604a);ChatQueueEvents['emit'](_0x3c7112,_0x22604a);_0x454144(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7f97('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x6071=['events','ChatQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1df58a,_0x21be39){var _0x1a1849=function(_0x48647f){while(--_0x48647f){_0x1df58a['push'](_0x1df58a['shift']());}};_0x1a1849(++_0x21be39);}(_0x6071,0x10e));var _0x1607=function(_0x218912,_0x313c41){_0x218912=_0x218912-0x0;var _0x5c2ce3=_0x6071[_0x218912];return _0x5c2ce3;};'use strict';var EventEmitter=require(_0x1607('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x1607('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x1607('0x2')](0x0);var events={'afterCreate':_0x1607('0x3'),'afterUpdate':_0x1607('0x4'),'afterDestroy':_0x1607('0x5')};function emitEvent(_0x51e530){return function(_0x4cb2fe,_0x522dc9,_0x5aeef2){ChatQueueEvents[_0x1607('0x6')](_0x51e530+':'+_0x4cb2fe['id'],_0x4cb2fe);ChatQueueEvents[_0x1607('0x6')](_0x51e530,_0x4cb2fe);_0x5aeef2(null);};}for(var e in events){if(events[_0x1607('0x7')](e)){var event=events[e];ChatQueue[_0x1607('0x8')](e,emitEvent(event));}}module[_0x1607('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 3aa92e5..c29a1ef 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 _0x2081=['chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatQueue'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x2081,0x139));var _0x1208=function(_0x4b7e4d,_0x82d2ab){_0x4b7e4d=_0x4b7e4d-0x0;var _0x38d6af=_0x2081[_0x4b7e4d];return _0x38d6af;};'use strict';var _=require(_0x1208('0x0'));var util=require(_0x1208('0x1'));var logger=require(_0x1208('0x2'))(_0x1208('0x3'));var moment=require(_0x1208('0x4'));var BPromise=require(_0x1208('0x5'));var rp=require(_0x1208('0x6'));var fs=require('fs');var path=require(_0x1208('0x7'));var rimraf=require(_0x1208('0x8'));var config=require(_0x1208('0x9'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x305e20,_0x42e710){return _0x305e20[_0x1208('0xa')](_0x1208('0xb'),attributes,{'tableName':_0x1208('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x589f=['util','api','moment','request-promise','../../config/environment','./chatQueue.attributes','exports','define','lodash'];(function(_0x2e3210,_0x555b54){var _0x399fad=function(_0x104a6d){while(--_0x104a6d){_0x2e3210['push'](_0x2e3210['shift']());}};_0x399fad(++_0x555b54);}(_0x589f,0x194));var _0xf589=function(_0x4f613c,_0x425015){_0x4f613c=_0x4f613c-0x0;var _0x50cffd=_0x589f[_0x4f613c];return _0x50cffd;};'use strict';var _=require(_0xf589('0x0'));var util=require(_0xf589('0x1'));var logger=require('../../config/logger')(_0xf589('0x2'));var moment=require(_0xf589('0x3'));var BPromise=require('bluebird');var rp=require(_0xf589('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf589('0x5'));var attributes=require(_0xf589('0x6'));module[_0xf589('0x7')]=function(_0x2925c7,_0x3500b1){return _0x2925c7[_0xf589('0x8')]('ChatQueue',attributes,{'tableName':'chat_queues','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 02be652..e42328d 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 _0x8768=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x25fded,_0x34216e){var _0x269156=function(_0x190fe0){while(--_0x190fe0){_0x25fded['push'](_0x25fded['shift']());}};_0x269156(++_0x34216e);}(_0x8768,0xa1));var _0x8876=function(_0x39327e,_0x456035){_0x39327e=_0x39327e-0x0;var _0x4de57d=_0x8768[_0x39327e];return _0x4de57d;};'use strict';var _=require(_0x8876('0x0'));var util=require(_0x8876('0x1'));var moment=require(_0x8876('0x2'));var BPromise=require(_0x8876('0x3'));var rs=require(_0x8876('0x4'));var fs=require('fs');var Redis=require(_0x8876('0x5'));var db=require(_0x8876('0x6'))['db'];var utils=require(_0x8876('0x7'));var logger=require(_0x8876('0x8'))(_0x8876('0x9'));var config=require(_0x8876('0xa'));var jayson=require(_0x8876('0xb'));var client=jayson[_0x8876('0xc')]['http']({'port':0x232a});config[_0x8876('0xd')]=_[_0x8876('0xe')](config[_0x8876('0xd')],{'host':_0x8876('0xf'),'port':0x18eb});var socket=require(_0x8876('0x10'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x8876('0x11')](socket);function respondWithRpcPromise(_0x449111,_0x59f192,_0x4e0e64){return new BPromise(function(_0xc1ddfd,_0x20fe1e){return client[_0x8876('0x12')](_0x449111,_0x4e0e64)[_0x8876('0x13')](function(_0x67faf5){logger[_0x8876('0x14')](_0x8876('0x15'),_0x59f192,_0x8876('0x16'));logger[_0x8876('0x17')](_0x8876('0x18'),_0x59f192,'request\x20sent',JSON[_0x8876('0x19')](_0x67faf5));if(_0x67faf5[_0x8876('0x1a')]){if(_0x67faf5[_0x8876('0x1a')][_0x8876('0x1b')]===0x1f4){logger[_0x8876('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x59f192,_0x67faf5[_0x8876('0x1a')][_0x8876('0x1c')]);return _0x20fe1e(_0x67faf5[_0x8876('0x1a')][_0x8876('0x1c')]);}logger[_0x8876('0x1a')](_0x8876('0x15'),_0x59f192,_0x67faf5[_0x8876('0x1a')]['message']);return _0xc1ddfd(_0x67faf5[_0x8876('0x1a')][_0x8876('0x1c')]);}else{logger[_0x8876('0x14')](_0x8876('0x15'),_0x59f192,_0x8876('0x16'));_0xc1ddfd(_0x67faf5['result']['message']);}})[_0x8876('0x1d')](function(_0x4715d1){logger[_0x8876('0x1a')]('ChatQueue,\x20%s,\x20%s',_0x59f192,_0x4715d1);_0x20fe1e(_0x4715d1);});});}exports[_0x8876('0x1e')]=function(_0x2f9c08){var _0x53f785=this;return new Promise(function(_0x34c6dd,_0xe3c6a1){return db[_0x8876('0x1f')][_0x8876('0x20')]({'raw':_0x2f9c08[_0x8876('0x21')]?_0x2f9c08[_0x8876('0x21')][_0x8876('0x22')]===undefined?!![]:![]:!![],'where':_0x2f9c08['options']?_0x2f9c08[_0x8876('0x21')]['where']||null:null,'attributes':_0x2f9c08[_0x8876('0x21')]?_0x2f9c08[_0x8876('0x21')][_0x8876('0x23')]||null:null,'limit':_0x2f9c08[_0x8876('0x21')]?_0x2f9c08[_0x8876('0x21')][_0x8876('0x24')]||null:null,'include':_0x2f9c08[_0x8876('0x21')]?_0x2f9c08[_0x8876('0x21')][_0x8876('0x25')]?_[_0x8876('0x26')](_0x2f9c08[_0x8876('0x21')][_0x8876('0x25')],function(_0xbd6621){return{'model':db[_0xbd6621['model']],'as':_0xbd6621['as'],'attributes':_0xbd6621[_0x8876('0x23')],'include':_0xbd6621[_0x8876('0x25')]?_[_0x8876('0x26')](_0xbd6621[_0x8876('0x25')],function(_0x14af7b){return{'model':db[_0x14af7b[_0x8876('0x27')]],'as':_0x14af7b['as'],'attributes':_0x14af7b[_0x8876('0x23')],'include':_0x14af7b['include']?_[_0x8876('0x26')](_0x14af7b['include'],function(_0x5dbffd){return{'model':db[_0x5dbffd[_0x8876('0x27')]],'as':_0x5dbffd['as'],'attributes':_0x5dbffd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x41312a){logger['info']('GetChatQueue',_0x2f9c08);logger[_0x8876('0x17')]('GetChatQueue',_0x2f9c08,JSON[_0x8876('0x19')](_0x41312a));_0x34c6dd(_0x41312a);})[_0x8876('0x1d')](function(_0x4d0266){logger[_0x8876('0x1a')]('GetChatQueue',_0x4d0266['message'],_0x2f9c08);_0xe3c6a1(_0x53f785[_0x8876('0x1a')](0x1f4,_0x4d0266['message']));});});};exports[_0x8876('0x28')]=function(_0xc1781e){var _0x431400=this;return new Promise(function(_0x4b8f29,_0x3620a0){return db[_0x8876('0x1f')][_0x8876('0x29')]({'raw':_0xc1781e[_0x8876('0x21')]?_0xc1781e[_0x8876('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0xc1781e['options']?_0xc1781e[_0x8876('0x21')][_0x8876('0x2a')]||null:null,'attributes':_0xc1781e[_0x8876('0x21')]?_0xc1781e['options'][_0x8876('0x23')]||null:null,'include':_0xc1781e[_0x8876('0x21')]?_0xc1781e['options'][_0x8876('0x25')]?_[_0x8876('0x26')](_0xc1781e[_0x8876('0x21')][_0x8876('0x25')],function(_0x161879){return{'model':db[_0x161879[_0x8876('0x27')]],'as':_0x161879['as'],'attributes':_0x161879[_0x8876('0x23')],'include':_0x161879[_0x8876('0x25')]?_[_0x8876('0x26')](_0x161879[_0x8876('0x25')],function(_0x50adf2){return{'model':db[_0x50adf2[_0x8876('0x27')]],'as':_0x50adf2['as'],'attributes':_0x50adf2['attributes'],'include':_0x50adf2[_0x8876('0x25')]?_[_0x8876('0x26')](_0x50adf2['include'],function(_0x387ada){return{'model':db[_0x387ada[_0x8876('0x27')]],'as':_0x387ada['as'],'attributes':_0x387ada['attributes']};}):[]};}):[]};}):[]:[]})[_0x8876('0x13')](function(_0x49e237){logger[_0x8876('0x14')](_0x8876('0x28'),_0xc1781e);logger[_0x8876('0x17')](_0x8876('0x28'),_0xc1781e,JSON[_0x8876('0x19')](_0x49e237));_0x4b8f29(_0x49e237);})['catch'](function(_0xca2858){logger[_0x8876('0x1a')](_0x8876('0x28'),_0xca2858['message'],_0xc1781e);_0x3620a0(_0x431400['error'](0x1f4,_0xca2858[_0x8876('0x1c')]));});});}; \ No newline at end of file +var _0xe844=['http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowChatQueue','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe844,0xba));var _0x4e84=function(_0x3458f1,_0x2baca6){_0x3458f1=_0x3458f1-0x0;var _0x105093=_0xe844[_0x3458f1];return _0x105093;};'use strict';var _=require(_0x4e84('0x0'));var util=require(_0x4e84('0x1'));var moment=require(_0x4e84('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4e84('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e84('0x4'));var logger=require(_0x4e84('0x5'))(_0x4e84('0x6'));var config=require(_0x4e84('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4e84('0x8')][_0x4e84('0x9')]({'port':0x232a});config[_0x4e84('0xa')]=_[_0x4e84('0xb')](config[_0x4e84('0xa')],{'host':_0x4e84('0xc'),'port':0x18eb});var socket=require(_0x4e84('0xd'))(new Redis(config[_0x4e84('0xa')]));require(_0x4e84('0xe'))['register'](socket);function respondWithRpcPromise(_0x3fe79e,_0x110d70,_0x3e3b8){return new BPromise(function(_0x3eb944,_0x4c42a8){return client[_0x4e84('0xf')](_0x3fe79e,_0x3e3b8)[_0x4e84('0x10')](function(_0x24e672){logger[_0x4e84('0x11')](_0x4e84('0x12'),_0x110d70,_0x4e84('0x13'));logger['debug'](_0x4e84('0x14'),_0x110d70,_0x4e84('0x13'),JSON[_0x4e84('0x15')](_0x24e672));if(_0x24e672[_0x4e84('0x16')]){if(_0x24e672[_0x4e84('0x16')][_0x4e84('0x17')]===0x1f4){logger[_0x4e84('0x16')](_0x4e84('0x12'),_0x110d70,_0x24e672[_0x4e84('0x16')]['message']);return _0x4c42a8(_0x24e672[_0x4e84('0x16')]['message']);}logger[_0x4e84('0x16')](_0x4e84('0x12'),_0x110d70,_0x24e672[_0x4e84('0x16')][_0x4e84('0x18')]);return _0x3eb944(_0x24e672[_0x4e84('0x16')]['message']);}else{logger[_0x4e84('0x11')]('ChatQueue,\x20%s,\x20%s',_0x110d70,'request\x20sent');_0x3eb944(_0x24e672[_0x4e84('0x19')][_0x4e84('0x18')]);}})[_0x4e84('0x1a')](function(_0x1baf09){logger[_0x4e84('0x16')](_0x4e84('0x12'),_0x110d70,_0x1baf09);_0x4c42a8(_0x1baf09);});});}exports[_0x4e84('0x1b')]=function(_0x48fc96){var _0x15c43b=this;return new Promise(function(_0x3b3ad3,_0x11b884){return db[_0x4e84('0x1c')][_0x4e84('0x1d')]({'raw':_0x48fc96[_0x4e84('0x1e')]?_0x48fc96[_0x4e84('0x1e')][_0x4e84('0x1f')]===undefined?!![]:![]:!![],'where':_0x48fc96['options']?_0x48fc96['options'][_0x4e84('0x20')]||null:null,'attributes':_0x48fc96[_0x4e84('0x1e')]?_0x48fc96[_0x4e84('0x1e')][_0x4e84('0x21')]||null:null,'limit':_0x48fc96[_0x4e84('0x1e')]?_0x48fc96[_0x4e84('0x1e')][_0x4e84('0x22')]||null:null,'include':_0x48fc96['options']?_0x48fc96[_0x4e84('0x1e')][_0x4e84('0x23')]?_[_0x4e84('0x24')](_0x48fc96[_0x4e84('0x1e')][_0x4e84('0x23')],function(_0x5fb1f5){return{'model':db[_0x5fb1f5['model']],'as':_0x5fb1f5['as'],'attributes':_0x5fb1f5[_0x4e84('0x21')],'include':_0x5fb1f5[_0x4e84('0x23')]?_[_0x4e84('0x24')](_0x5fb1f5['include'],function(_0xdb6047){return{'model':db[_0xdb6047['model']],'as':_0xdb6047['as'],'attributes':_0xdb6047[_0x4e84('0x21')],'include':_0xdb6047[_0x4e84('0x23')]?_[_0x4e84('0x24')](_0xdb6047[_0x4e84('0x23')],function(_0x1fa0ae){return{'model':db[_0x1fa0ae[_0x4e84('0x25')]],'as':_0x1fa0ae['as'],'attributes':_0x1fa0ae[_0x4e84('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4e84('0x10')](function(_0x1e3cec){logger[_0x4e84('0x11')]('GetChatQueue',_0x48fc96);logger['debug'](_0x4e84('0x1b'),_0x48fc96,JSON[_0x4e84('0x15')](_0x1e3cec));_0x3b3ad3(_0x1e3cec);})[_0x4e84('0x1a')](function(_0x5cfa03){logger[_0x4e84('0x16')](_0x4e84('0x1b'),_0x5cfa03[_0x4e84('0x18')],_0x48fc96);_0x11b884(_0x15c43b[_0x4e84('0x16')](0x1f4,_0x5cfa03[_0x4e84('0x18')]));});});};exports[_0x4e84('0x26')]=function(_0x2f7b70){var _0x3e9e09=this;return new Promise(function(_0x41d350,_0x4b9ecd){return db[_0x4e84('0x1c')]['find']({'raw':_0x2f7b70[_0x4e84('0x1e')]?_0x2f7b70[_0x4e84('0x1e')][_0x4e84('0x1f')]===undefined?!![]:![]:!![],'where':_0x2f7b70['options']?_0x2f7b70[_0x4e84('0x1e')][_0x4e84('0x20')]||null:null,'attributes':_0x2f7b70[_0x4e84('0x1e')]?_0x2f7b70[_0x4e84('0x1e')][_0x4e84('0x21')]||null:null,'include':_0x2f7b70[_0x4e84('0x1e')]?_0x2f7b70['options']['include']?_[_0x4e84('0x24')](_0x2f7b70[_0x4e84('0x1e')]['include'],function(_0x1db9e9){return{'model':db[_0x1db9e9[_0x4e84('0x25')]],'as':_0x1db9e9['as'],'attributes':_0x1db9e9[_0x4e84('0x21')],'include':_0x1db9e9['include']?_['map'](_0x1db9e9[_0x4e84('0x23')],function(_0x25e926){return{'model':db[_0x25e926['model']],'as':_0x25e926['as'],'attributes':_0x25e926['attributes'],'include':_0x25e926[_0x4e84('0x23')]?_[_0x4e84('0x24')](_0x25e926['include'],function(_0x168a86){return{'model':db[_0x168a86[_0x4e84('0x25')]],'as':_0x168a86['as'],'attributes':_0x168a86['attributes']};}):[]};}):[]};}):[]:[]})[_0x4e84('0x10')](function(_0x314311){logger[_0x4e84('0x11')]('ShowChatQueue',_0x2f7b70);logger['debug'](_0x4e84('0x26'),_0x2f7b70,JSON[_0x4e84('0x15')](_0x314311));_0x41d350(_0x314311);})[_0x4e84('0x1a')](function(_0x4d3c9d){logger[_0x4e84('0x16')](_0x4e84('0x26'),_0x4d3c9d[_0x4e84('0x18')],_0x2f7b70);_0x4b9ecd(_0x3e9e09[_0x4e84('0x16')](0x1f4,_0x4d3c9d[_0x4e84('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 714bb71..193f1aa 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 _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x68c4e3,_0x5b18b0){var _0xaca048=function(_0x485160){while(--_0x485160){_0x68c4e3['push'](_0x68c4e3['shift']());}};_0xaca048(++_0x5b18b0);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1c44ad,_0x38dec8){_0x1c44ad=_0x1c44ad-0x0;var _0x4092ad=_0x6f0d[_0x1c44ad];return _0x4092ad;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file +var _0x9f62=['save','update','removeListener','register','length'];(function(_0x368e09,_0x2c1517){var _0x14b7df=function(_0x5002af){while(--_0x5002af){_0x368e09['push'](_0x368e09['shift']());}};_0x14b7df(++_0x2c1517);}(_0x9f62,0x154));var _0x29f6=function(_0x4e3de9,_0x59c9a7){_0x4e3de9=_0x4e3de9-0x0;var _0x47e459=_0x9f62[_0x4e3de9];return _0x47e459;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){ChatQueueEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('chatQueue:'+_0x2ba602,_0x595034);ChatQueueEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 219dd4a..c1a9ef9 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x53f6dc,_0x372cb6){var _0x3d78bf=function(_0x4d6ad5){while(--_0x4d6ad5){_0x53f6dc['push'](_0x53f6dc['shift']());}};_0x3d78bf(++_0x372cb6);}(_0x55ca,0x126));var _0xa55c=function(_0x44e4a1,_0x3d053a){_0x44e4a1=_0x44e4a1-0x0;var _0x546ad3=_0x55ca[_0x44e4a1];return _0x546ad3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x814b=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x428009,_0x54c78a){var _0x55f4e4=function(_0x4cbce9){while(--_0x4cbce9){_0x428009['push'](_0x428009['shift']());}};_0x55f4e4(++_0x54c78a);}(_0x814b,0x1a2));var _0xb814=function(_0x24697b,_0x2eb072){_0x24697b=_0x24697b-0x0;var _0x585b99=_0x814b[_0x24697b];return _0x585b99;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0xa')](_0xb814('0x10'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0xa')](_0xb814('0x12'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router['get'](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x15')]);router[_0xb814('0x16')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x17')]);router[_0xb814('0x16')](_0xb814('0x12'),auth[_0xb814('0xb')](),controller[_0xb814('0x18')]);router[_0xb814('0x16')](_0xb814('0x14'),auth[_0xb814('0xb')](),controller[_0xb814('0x19')]);router[_0xb814('0x1a')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x1b')]);router[_0xb814('0x1c')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller['destroy']);router[_0xb814('0x1c')]('/:id/teams',auth[_0xb814('0xb')](),controller[_0xb814('0x1d')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xb814('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b6f042a..1710176 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 _0x8837=['moment','exports','STRING','DATE'];(function(_0x25f983,_0x352b9d){var _0x50a304=function(_0x2bc5db){while(--_0x2bc5db){_0x25f983['push'](_0x25f983['shift']());}};_0x50a304(++_0x352b9d);}(_0x8837,0x184));var _0x7883=function(_0x30b36f,_0x57ed02){_0x30b36f=_0x30b36f-0x0;var _0x3b3246=_0x8837[_0x30b36f];return _0x3b3246;};'use strict';var moment=require(_0x7883('0x0'));var Sequelize=require('sequelize');module[_0x7883('0x1')]={'uniqueid':{'type':Sequelize[_0x7883('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7883('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7883('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7883('0x3')]},'reason':{'type':Sequelize[_0x7883('0x2')]}}; \ No newline at end of file +var _0x0960=['STRING','DATE','moment','sequelize'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x0960,0xc2));var _0x0096=function(_0x4718dd,_0x46ecba){_0x4718dd=_0x4718dd-0x0;var _0x56131e=_0x0960[_0x4718dd];return _0x56131e;};'use strict';var moment=require(_0x0096('0x0'));var Sequelize=require(_0x0096('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0096('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0096('0x2')]},'joinAt':{'type':Sequelize[_0x0096('0x3')]},'leaveAt':{'type':Sequelize[_0x0096('0x3')]},'acceptAt':{'type':Sequelize[_0x0096('0x3')]},'exitAt':{'type':Sequelize[_0x0096('0x3')]},'reason':{'type':Sequelize[_0x0096('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 5c61e1b..48d6e42 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 _0xa809=['../../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','update','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','ChatQueueReport','findAll','rows','catch','show','keys','options','find','create','body','params','describe','rimraf','request-promise','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xa809,0x1f3));var _0x9a80=function(_0x1211b9,_0x19157c){_0x1211b9=_0x1211b9-0x0;var _0x1f8c6f=_0xa809[_0x1211b9];return _0x1f8c6f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a80('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9a80('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9a80('0x2'));var path=require(_0x9a80('0x3'));var sox=require(_0x9a80('0x4'));var csv=require(_0x9a80('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a80('0x6'));var _=require('lodash');var squel=require(_0x9a80('0x7'));var crypto=require(_0x9a80('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x9a80('0x9'));var toCsv=require(_0x9a80('0x5'));var querystring=require(_0x9a80('0xa'));var Papa=require(_0x9a80('0xb'));var Redis=require('ioredis');var authService=require(_0x9a80('0xc'));var qs=require(_0x9a80('0xd'));var as=require(_0x9a80('0xe'));var hardwareService=require(_0x9a80('0xf'));var logger=require(_0x9a80('0x10'))(_0x9a80('0x11'));var utils=require(_0x9a80('0x12'));var config=require(_0x9a80('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a80('0x14'))['db'];function respondWithStatusCode(_0x4dc0a5,_0x123cbd){_0x123cbd=_0x123cbd||0xcc;return function(_0x33170d){if(_0x33170d){return _0x4dc0a5[_0x9a80('0x15')](_0x123cbd);}return _0x4dc0a5[_0x9a80('0x16')](_0x123cbd)[_0x9a80('0x17')]();};}function respondWithResult(_0x20a68a,_0x5a6187){_0x5a6187=_0x5a6187||0xc8;return function(_0x16c1b5){if(_0x16c1b5){return _0x20a68a['status'](_0x5a6187)[_0x9a80('0x18')](_0x16c1b5);}};}function respondWithFilteredResult(_0x109066,_0x3625b0){return function(_0x5181b5){if(_0x5181b5){var _0x3f393c=typeof _0x3625b0[_0x9a80('0x19')]===_0x9a80('0x1a')&&typeof _0x3625b0[_0x9a80('0x1b')]===_0x9a80('0x1a');var _0x5a6efc=_0x5181b5[_0x9a80('0x1c')];var _0x4bfb77=_0x3f393c?0x0:_0x3625b0[_0x9a80('0x19')];var _0x281ca5=_0x3f393c?_0x5181b5[_0x9a80('0x1c')]:_0x3625b0[_0x9a80('0x19')]+_0x3625b0['limit'];var _0x47cfe4;if(_0x281ca5>=_0x5a6efc){_0x281ca5=_0x5a6efc;_0x47cfe4=0xc8;}else{_0x47cfe4=0xce;}_0x109066[_0x9a80('0x16')](_0x47cfe4);return _0x109066[_0x9a80('0x1d')](_0x9a80('0x1e'),_0x4bfb77+'-'+_0x281ca5+'/'+_0x5a6efc)[_0x9a80('0x18')](_0x5181b5);}return null;};}function patchUpdates(_0x42e054){return function(_0x5a244c){try{jsonpatch[_0x9a80('0x1f')](_0x5a244c,_0x42e054,!![]);}catch(_0x252fd6){return BPromise[_0x9a80('0x20')](_0x252fd6);}return _0x5a244c['save']();};}function saveUpdates(_0x55ce38,_0x28d895){return function(_0x5cc1b1){if(_0x5cc1b1){return _0x5cc1b1[_0x9a80('0x21')](_0x55ce38)['then'](function(_0x125731){return _0x125731;});}return null;};}function removeEntity(_0x5e164f,_0x2601c7){return function(_0x435b4b){if(_0x435b4b){return _0x435b4b[_0x9a80('0x22')]()[_0x9a80('0x23')](function(){_0x5e164f[_0x9a80('0x16')](0xcc)[_0x9a80('0x17')]();});}};}function handleEntityNotFound(_0x4546e6,_0x1ac84d){return function(_0x52ae41){if(!_0x52ae41){_0x4546e6[_0x9a80('0x15')](0x194);}return _0x52ae41;};}function handleError(_0x39b2a5,_0x5b7f91){_0x5b7f91=_0x5b7f91||0x1f4;return function(_0x3508d7){logger[_0x9a80('0x24')](_0x3508d7['stack']);if(_0x3508d7[_0x9a80('0x25')]){delete _0x3508d7[_0x9a80('0x25')];}_0x39b2a5[_0x9a80('0x16')](_0x5b7f91)[_0x9a80('0x26')](_0x3508d7);};}exports[_0x9a80('0x27')]=function(_0x341ae5,_0x5a86d1){var _0x15a185={},_0x40db09={},_0x2f8904={'count':0x0,'rows':[]};var _0x41c043=_[_0x9a80('0x28')](db['ChatQueueReport'][_0x9a80('0x29')],function(_0x364f32){return{'name':_0x364f32[_0x9a80('0x2a')],'type':_0x364f32[_0x9a80('0x2b')]['key']};});_0x40db09[_0x9a80('0x2c')]=_[_0x9a80('0x28')](_0x41c043,_0x9a80('0x25'));_0x40db09[_0x9a80('0x2d')]=_['keys'](_0x341ae5[_0x9a80('0x2d')]);_0x40db09[_0x9a80('0x2e')]=_['intersection'](_0x40db09[_0x9a80('0x2c')],_0x40db09[_0x9a80('0x2d')]);_0x15a185[_0x9a80('0x2f')]=_[_0x9a80('0x30')](_0x40db09['model'],qs[_0x9a80('0x31')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x31')]));_0x15a185[_0x9a80('0x2f')]=_0x15a185[_0x9a80('0x2f')][_0x9a80('0x32')]?_0x15a185[_0x9a80('0x2f')]:_0x40db09[_0x9a80('0x2c')];if(!_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x33')](_0x9a80('0x34'))){_0x15a185[_0x9a80('0x1b')]=qs[_0x9a80('0x1b')](_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x1b')]);_0x15a185['offset']=qs['offset'](_0x341ae5['query'][_0x9a80('0x19')]);}_0x15a185[_0x9a80('0x35')]=qs[_0x9a80('0x36')](_0x341ae5['query'][_0x9a80('0x36')]);_0x15a185[_0x9a80('0x37')]=qs[_0x9a80('0x2e')](_[_0x9a80('0x38')](_0x341ae5['query'],_0x40db09['filters']),_0x41c043);if(_0x341ae5['query']['filter']){_0x15a185[_0x9a80('0x37')]=_[_0x9a80('0x39')](_0x15a185[_0x9a80('0x37')],{'$or':_['map'](_0x41c043,function(_0x44b0aa){if(_0x44b0aa['type']!==_0x9a80('0x3a')){var _0x1ea1f2={};_0x1ea1f2[_0x44b0aa[_0x9a80('0x25')]]={'$like':'%'+_0x341ae5[_0x9a80('0x2d')]['filter']+'%'};return _0x1ea1f2;}})});}_0x15a185=_[_0x9a80('0x39')]({},_0x15a185,_0x341ae5['options']);var _0x44da37={'where':_0x15a185[_0x9a80('0x37')]};return db['ChatQueueReport']['count'](_0x44da37)['then'](function(_0x2d12d8){_0x2f8904['count']=_0x2d12d8;if(_0x341ae5[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x15a185[_0x9a80('0x3c')]=[{'all':!![]}];}return db[_0x9a80('0x3d')][_0x9a80('0x3e')](_0x15a185);})[_0x9a80('0x23')](function(_0x15c750){_0x2f8904[_0x9a80('0x3f')]=_0x15c750;return _0x2f8904;})['then'](respondWithFilteredResult(_0x5a86d1,_0x15a185))[_0x9a80('0x40')](handleError(_0x5a86d1,null));};exports[_0x9a80('0x41')]=function(_0x2644b3,_0x554073){var _0x39cb75={'raw':!![],'where':{'id':_0x2644b3['params']['id']}},_0x52094e={};_0x52094e[_0x9a80('0x2c')]=_[_0x9a80('0x42')](db[_0x9a80('0x3d')][_0x9a80('0x29')]);_0x52094e[_0x9a80('0x2d')]=_[_0x9a80('0x42')](_0x2644b3[_0x9a80('0x2d')]);_0x52094e[_0x9a80('0x2e')]=_[_0x9a80('0x30')](_0x52094e[_0x9a80('0x2c')],_0x52094e['query']);_0x39cb75[_0x9a80('0x2f')]=_['intersection'](_0x52094e[_0x9a80('0x2c')],qs[_0x9a80('0x31')](_0x2644b3['query'][_0x9a80('0x31')]));_0x39cb75[_0x9a80('0x2f')]=_0x39cb75['attributes']['length']?_0x39cb75[_0x9a80('0x2f')]:_0x52094e[_0x9a80('0x2c')];if(_0x2644b3[_0x9a80('0x2d')][_0x9a80('0x3b')]){_0x39cb75['include']=[{'all':!![]}];}_0x39cb75=_['merge']({},_0x39cb75,_0x2644b3[_0x9a80('0x43')]);return db[_0x9a80('0x3d')][_0x9a80('0x44')](_0x39cb75)['then'](handleEntityNotFound(_0x554073,null))[_0x9a80('0x23')](respondWithResult(_0x554073,null))['catch'](handleError(_0x554073,null));};exports[_0x9a80('0x45')]=function(_0x1766b8,_0x5bec53){return db[_0x9a80('0x3d')][_0x9a80('0x45')](_0x1766b8[_0x9a80('0x46')],{})[_0x9a80('0x23')](respondWithResult(_0x5bec53,0xc9))[_0x9a80('0x40')](handleError(_0x5bec53,null));};exports['update']=function(_0x4790a7,_0x4a4fe6){if(_0x4790a7['body']['id']){delete _0x4790a7[_0x9a80('0x46')]['id'];}return db[_0x9a80('0x3d')][_0x9a80('0x44')]({'where':{'id':_0x4790a7[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4a4fe6,null))['then'](saveUpdates(_0x4790a7[_0x9a80('0x46')],null))[_0x9a80('0x23')](respondWithResult(_0x4a4fe6,null))[_0x9a80('0x40')](handleError(_0x4a4fe6,null));};exports[_0x9a80('0x22')]=function(_0x124e31,_0x4c742a){return db['ChatQueueReport'][_0x9a80('0x44')]({'where':{'id':_0x124e31[_0x9a80('0x47')]['id']}})[_0x9a80('0x23')](handleEntityNotFound(_0x4c742a,null))[_0x9a80('0x23')](removeEntity(_0x4c742a,null))[_0x9a80('0x40')](handleError(_0x4c742a,null));};exports[_0x9a80('0x48')]=function(_0x4735bd,_0x4adad7){return db['ChatQueueReport'][_0x9a80('0x48')]()[_0x9a80('0x23')](respondWithResult(_0x4adad7,null))['catch'](handleError(_0x4adad7,null));}; \ No newline at end of file +var _0x6144=['catch','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','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','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','end','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x31e041,_0x3b1644){var _0x308499=function(_0x217b60){while(--_0x217b60){_0x31e041['push'](_0x31e041['shift']());}};_0x308499(++_0x3b1644);}(_0x6144,0x99));var _0x4614=function(_0x256ece,_0x35cc11){_0x256ece=_0x256ece-0x0;var _0x46f498=_0x6144[_0x256ece];return _0x46f498;};'use strict';var emlformat=require(_0x4614('0x0'));var rimraf=require(_0x4614('0x1'));var zipdir=require(_0x4614('0x2'));var jsonpatch=require(_0x4614('0x3'));var rp=require('request-promise');var moment=require(_0x4614('0x4'));var BPromise=require(_0x4614('0x5'));var Mustache=require(_0x4614('0x6'));var util=require(_0x4614('0x7'));var path=require('path');var sox=require(_0x4614('0x8'));var csv=require(_0x4614('0x9'));var ejs=require(_0x4614('0xa'));var fs=require('fs');var fs_extra=require(_0x4614('0xb'));var _=require(_0x4614('0xc'));var squel=require('squel');var crypto=require(_0x4614('0xd'));var jsforce=require(_0x4614('0xe'));var deskjs=require(_0x4614('0xf'));var toCsv=require(_0x4614('0x9'));var querystring=require('querystring');var Papa=require(_0x4614('0x10'));var Redis=require(_0x4614('0x11'));var authService=require(_0x4614('0x12'));var qs=require(_0x4614('0x13'));var as=require(_0x4614('0x14'));var hardwareService=require(_0x4614('0x15'));var logger=require(_0x4614('0x16'))('api');var utils=require(_0x4614('0x17'));var config=require(_0x4614('0x18'));var licenseUtil=require(_0x4614('0x19'));var db=require(_0x4614('0x1a'))['db'];function respondWithStatusCode(_0x4c8823,_0x47a467){_0x47a467=_0x47a467||0xcc;return function(_0x16b52d){if(_0x16b52d){return _0x4c8823[_0x4614('0x1b')](_0x47a467);}return _0x4c8823[_0x4614('0x1c')](_0x47a467)['end']();};}function respondWithResult(_0x4c2c57,_0x55e58a){_0x55e58a=_0x55e58a||0xc8;return function(_0x33beae){if(_0x33beae){return _0x4c2c57[_0x4614('0x1c')](_0x55e58a)['json'](_0x33beae);}};}function respondWithFilteredResult(_0x1f2ec6,_0x186f89){return function(_0x237ee6){if(_0x237ee6){var _0x4d5801=typeof _0x186f89[_0x4614('0x1d')]===_0x4614('0x1e')&&typeof _0x186f89[_0x4614('0x1f')]===_0x4614('0x1e');var _0x353295=_0x237ee6[_0x4614('0x20')];var _0x5d10fc=_0x4d5801?0x0:_0x186f89[_0x4614('0x1d')];var _0x195eac=_0x4d5801?_0x237ee6['count']:_0x186f89[_0x4614('0x1d')]+_0x186f89[_0x4614('0x1f')];var _0x27de9;if(_0x195eac>=_0x353295){_0x195eac=_0x353295;_0x27de9=0xc8;}else{_0x27de9=0xce;}_0x1f2ec6['status'](_0x27de9);return _0x1f2ec6['set'](_0x4614('0x21'),_0x5d10fc+'-'+_0x195eac+'/'+_0x353295)[_0x4614('0x22')](_0x237ee6);}return null;};}function patchUpdates(_0x4ab7f1){return function(_0x480736){try{jsonpatch[_0x4614('0x23')](_0x480736,_0x4ab7f1,!![]);}catch(_0x5c0f26){return BPromise['reject'](_0x5c0f26);}return _0x480736[_0x4614('0x24')]();};}function saveUpdates(_0x3cc9a7,_0x3973aa){return function(_0x55e73e){if(_0x55e73e){return _0x55e73e[_0x4614('0x25')](_0x3cc9a7)[_0x4614('0x26')](function(_0x35038b){return _0x35038b;});}return null;};}function removeEntity(_0x5ee455,_0x341fa5){return function(_0x261120){if(_0x261120){return _0x261120['destroy']()[_0x4614('0x26')](function(){_0x5ee455[_0x4614('0x1c')](0xcc)[_0x4614('0x27')]();});}};}function handleEntityNotFound(_0x51edf0,_0x3a0e22){return function(_0x488736){if(!_0x488736){_0x51edf0[_0x4614('0x1b')](0x194);}return _0x488736;};}function handleError(_0x2aa287,_0x2a1cab){_0x2a1cab=_0x2a1cab||0x1f4;return function(_0x5ecfa6){logger['error'](_0x5ecfa6[_0x4614('0x28')]);if(_0x5ecfa6[_0x4614('0x29')]){delete _0x5ecfa6['name'];}_0x2aa287['status'](_0x2a1cab)[_0x4614('0x2a')](_0x5ecfa6);};}exports[_0x4614('0x2b')]=function(_0x1526a7,_0x59fd75){var _0x456a28={},_0xc57a63={},_0x453ea4={'count':0x0,'rows':[]};var _0x3ee108=_[_0x4614('0x2c')](db[_0x4614('0x2d')][_0x4614('0x2e')],function(_0xce27a8){return{'name':_0xce27a8[_0x4614('0x2f')],'type':_0xce27a8[_0x4614('0x30')][_0x4614('0x31')]};});_0xc57a63['model']=_[_0x4614('0x2c')](_0x3ee108,_0x4614('0x29'));_0xc57a63[_0x4614('0x32')]=_[_0x4614('0x33')](_0x1526a7['query']);_0xc57a63[_0x4614('0x34')]=_['intersection'](_0xc57a63[_0x4614('0x35')],_0xc57a63[_0x4614('0x32')]);_0x456a28[_0x4614('0x36')]=_[_0x4614('0x37')](_0xc57a63['model'],qs[_0x4614('0x38')](_0x1526a7[_0x4614('0x32')][_0x4614('0x38')]));_0x456a28['attributes']=_0x456a28['attributes'][_0x4614('0x39')]?_0x456a28[_0x4614('0x36')]:_0xc57a63['model'];if(!_0x1526a7[_0x4614('0x32')]['hasOwnProperty'](_0x4614('0x3a'))){_0x456a28[_0x4614('0x1f')]=qs[_0x4614('0x1f')](_0x1526a7[_0x4614('0x32')][_0x4614('0x1f')]);_0x456a28['offset']=qs['offset'](_0x1526a7[_0x4614('0x32')]['offset']);}_0x456a28['order']=qs[_0x4614('0x3b')](_0x1526a7[_0x4614('0x32')]['sort']);_0x456a28[_0x4614('0x3c')]=qs[_0x4614('0x34')](_[_0x4614('0x3d')](_0x1526a7[_0x4614('0x32')],_0xc57a63[_0x4614('0x34')]),_0x3ee108);if(_0x1526a7[_0x4614('0x32')][_0x4614('0x3e')]){_0x456a28[_0x4614('0x3c')]=_[_0x4614('0x3f')](_0x456a28[_0x4614('0x3c')],{'$or':_[_0x4614('0x2c')](_0x3ee108,function(_0x2beb47){if(_0x2beb47[_0x4614('0x30')]!==_0x4614('0x40')){var _0x4bf878={};_0x4bf878[_0x2beb47[_0x4614('0x29')]]={'$like':'%'+_0x1526a7[_0x4614('0x32')][_0x4614('0x3e')]+'%'};return _0x4bf878;}})});}_0x456a28=_[_0x4614('0x3f')]({},_0x456a28,_0x1526a7[_0x4614('0x41')]);var _0x5587f1={'where':_0x456a28[_0x4614('0x3c')]};return db['ChatQueueReport'][_0x4614('0x20')](_0x5587f1)[_0x4614('0x26')](function(_0x3ca934){_0x453ea4[_0x4614('0x20')]=_0x3ca934;if(_0x1526a7[_0x4614('0x32')][_0x4614('0x42')]){_0x456a28[_0x4614('0x43')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x4614('0x44')](_0x456a28);})[_0x4614('0x26')](function(_0x214830){_0x453ea4['rows']=_0x214830;return _0x453ea4;})[_0x4614('0x26')](respondWithFilteredResult(_0x59fd75,_0x456a28))[_0x4614('0x45')](handleError(_0x59fd75,null));};exports['show']=function(_0x3f6fa3,_0x3aafc3){var _0x1b2d57={'raw':!![],'where':{'id':_0x3f6fa3['params']['id']}},_0x4e6eeb={};_0x4e6eeb[_0x4614('0x35')]=_[_0x4614('0x33')](db[_0x4614('0x2d')][_0x4614('0x2e')]);_0x4e6eeb[_0x4614('0x32')]=_[_0x4614('0x33')](_0x3f6fa3['query']);_0x4e6eeb[_0x4614('0x34')]=_[_0x4614('0x37')](_0x4e6eeb[_0x4614('0x35')],_0x4e6eeb[_0x4614('0x32')]);_0x1b2d57[_0x4614('0x36')]=_[_0x4614('0x37')](_0x4e6eeb['model'],qs[_0x4614('0x38')](_0x3f6fa3[_0x4614('0x32')][_0x4614('0x38')]));_0x1b2d57[_0x4614('0x36')]=_0x1b2d57[_0x4614('0x36')][_0x4614('0x39')]?_0x1b2d57[_0x4614('0x36')]:_0x4e6eeb[_0x4614('0x35')];if(_0x3f6fa3[_0x4614('0x32')]['includeAll']){_0x1b2d57[_0x4614('0x43')]=[{'all':!![]}];}_0x1b2d57=_['merge']({},_0x1b2d57,_0x3f6fa3[_0x4614('0x41')]);return db[_0x4614('0x2d')][_0x4614('0x46')](_0x1b2d57)['then'](handleEntityNotFound(_0x3aafc3,null))['then'](respondWithResult(_0x3aafc3,null))[_0x4614('0x45')](handleError(_0x3aafc3,null));};exports[_0x4614('0x47')]=function(_0x16f4b2,_0x2e0bd4){return db['ChatQueueReport']['create'](_0x16f4b2['body'],{})[_0x4614('0x26')](respondWithResult(_0x2e0bd4,0xc9))[_0x4614('0x45')](handleError(_0x2e0bd4,null));};exports[_0x4614('0x25')]=function(_0x23d2dc,_0x149d12){if(_0x23d2dc[_0x4614('0x48')]['id']){delete _0x23d2dc[_0x4614('0x48')]['id'];}return db[_0x4614('0x2d')][_0x4614('0x46')]({'where':{'id':_0x23d2dc['params']['id']}})['then'](handleEntityNotFound(_0x149d12,null))[_0x4614('0x26')](saveUpdates(_0x23d2dc[_0x4614('0x48')],null))['then'](respondWithResult(_0x149d12,null))[_0x4614('0x45')](handleError(_0x149d12,null));};exports['destroy']=function(_0x37a973,_0x3275a5){return db[_0x4614('0x2d')][_0x4614('0x46')]({'where':{'id':_0x37a973['params']['id']}})['then'](handleEntityNotFound(_0x3275a5,null))[_0x4614('0x26')](removeEntity(_0x3275a5,null))[_0x4614('0x45')](handleError(_0x3275a5,null));};exports['describe']=function(_0x3fda0b,_0xe20779){return db[_0x4614('0x2d')][_0x4614('0x49')]()[_0x4614('0x26')](respondWithResult(_0xe20779,null))[_0x4614('0x45')](handleError(_0xe20779,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 308e73f..9abd3f4 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0xf8ebe,_0x4a8cba){var _0x11131f=function(_0x2a5d52){while(--_0x2a5d52){_0xf8ebe['push'](_0xf8ebe['shift']());}};_0x11131f(++_0x4a8cba);}(_0xe706,0xa3));var _0x6e70=function(_0x441981,_0x12a3eb){_0x441981=_0x441981-0x0;var _0x19ce77=_0xe706[_0x441981];return _0x19ce77;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0xf4f3f9,_0x47cebf){var _0x3b7cd0=function(_0xab5d1a){while(--_0xab5d1a){_0xf4f3f9['push'](_0xf4f3f9['shift']());}};_0x3b7cd0(++_0x47cebf);}(_0x757a,0xde));var _0xa757=function(_0x44c1b0,_0x5e86d0){_0x44c1b0=_0x44c1b0-0x0;var _0x9c9ad=_0x757a[_0x44c1b0];return _0x9c9ad;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0f904d9..c5c51fc 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 _0x88b6=['update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','body','options','raw','CreateChatQueueReport','debug','UpdateChatQueueReport','ChatQueueReport'];(function(_0x2291dc,_0x157ae5){var _0x2b760e=function(_0x4a19a5){while(--_0x4a19a5){_0x2291dc['push'](_0x2291dc['shift']());}};_0x2b760e(++_0x157ae5);}(_0x88b6,0x196));var _0x688b=function(_0x17ab3e,_0x25a7c2){_0x17ab3e=_0x17ab3e-0x0;var _0x1c5b4b=_0x88b6[_0x17ab3e];return _0x1c5b4b;};'use strict';var _=require(_0x688b('0x0'));var util=require(_0x688b('0x1'));var moment=require(_0x688b('0x2'));var BPromise=require('bluebird');var rs=require(_0x688b('0x3'));var fs=require('fs');var Redis=require(_0x688b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x688b('0x5'));var logger=require('../../config/logger')(_0x688b('0x6'));var config=require(_0x688b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x688b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ac472,_0x5706c1,_0xd8dfda){return new BPromise(function(_0x125867,_0x57f793){return client['request'](_0x1ac472,_0xd8dfda)[_0x688b('0x9')](function(_0x5925a7){logger['info'](_0x688b('0xa'),_0x5706c1,_0x688b('0xb'));logger['debug'](_0x688b('0xc'),_0x5706c1,'request\x20sent',JSON[_0x688b('0xd')](_0x5925a7));if(_0x5925a7[_0x688b('0xe')]){if(_0x5925a7[_0x688b('0xe')][_0x688b('0xf')]===0x1f4){logger[_0x688b('0xe')](_0x688b('0xa'),_0x5706c1,_0x5925a7[_0x688b('0xe')][_0x688b('0x10')]);return _0x57f793(_0x5925a7[_0x688b('0xe')][_0x688b('0x10')]);}logger[_0x688b('0xe')]('ChatQueueReport,\x20%s,\x20%s',_0x5706c1,_0x5925a7[_0x688b('0xe')][_0x688b('0x10')]);return _0x125867(_0x5925a7['error'][_0x688b('0x10')]);}else{logger[_0x688b('0x11')](_0x688b('0xa'),_0x5706c1,_0x688b('0xb'));_0x125867(_0x5925a7[_0x688b('0x12')][_0x688b('0x10')]);}})[_0x688b('0x13')](function(_0x2645b8){logger[_0x688b('0xe')](_0x688b('0xa'),_0x5706c1,_0x2645b8);_0x57f793(_0x2645b8);});});}exports['CreateChatQueueReport']=function(_0x2209f7){var _0x469f02=this;return new Promise(function(_0x37802e,_0x485bfc){return db['ChatQueueReport'][_0x688b('0x14')](_0x2209f7[_0x688b('0x15')],{'raw':_0x2209f7[_0x688b('0x16')]?_0x2209f7[_0x688b('0x16')][_0x688b('0x17')]===undefined?!![]:![]:!![]})[_0x688b('0x9')](function(_0x3ae8a4){logger[_0x688b('0x11')](_0x688b('0x18'),_0x2209f7);logger[_0x688b('0x19')](_0x688b('0x18'),_0x2209f7,JSON[_0x688b('0xd')](_0x3ae8a4));_0x37802e(_0x3ae8a4);})[_0x688b('0x13')](function(_0x1bb4cb){logger[_0x688b('0xe')](_0x688b('0x18'),_0x1bb4cb['message'],_0x2209f7);_0x485bfc(_0x469f02[_0x688b('0xe')](0x1f4,_0x1bb4cb['message']));});});};exports[_0x688b('0x1a')]=function(_0x47fe32){var _0x4d97ea=this;return new Promise(function(_0x21c958,_0xe393a){return db[_0x688b('0x1b')][_0x688b('0x1c')](_0x47fe32['body'],{'raw':_0x47fe32['options']?_0x47fe32['options'][_0x688b('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47fe32[_0x688b('0x16')]?_0x47fe32[_0x688b('0x16')][_0x688b('0x1d')]||null:null,'attributes':_0x47fe32[_0x688b('0x16')]?_0x47fe32[_0x688b('0x16')][_0x688b('0x1e')]||null:null,'limit':_0x47fe32['options']?_0x47fe32['options']['limit']||null:null})[_0x688b('0x9')](function(_0x31c4e7){logger[_0x688b('0x11')]('UpdateChatQueueReport',_0x47fe32);logger['debug']('UpdateChatQueueReport',_0x47fe32,JSON['stringify'](_0x31c4e7));_0x21c958(_0x31c4e7);})[_0x688b('0x13')](function(_0x4864d2){logger[_0x688b('0xe')](_0x688b('0x1a'),_0x4864d2[_0x688b('0x10')],_0x47fe32);_0xe393a(_0x4d97ea[_0x688b('0xe')](0x1f4,_0x4864d2[_0x688b('0x10')]));});});}; \ No newline at end of file +var _0x3351=['info','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','then','UpdateChatQueueReport','update','body','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x3351,0x116));var _0x1335=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3351[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x1335('0x0'));var util=require(_0x1335('0x1'));var moment=require(_0x1335('0x2'));var BPromise=require(_0x1335('0x3'));var rs=require(_0x1335('0x4'));var fs=require('fs');var Redis=require(_0x1335('0x5'));var db=require(_0x1335('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1335('0x7'))(_0x1335('0x8'));var config=require(_0x1335('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1335('0xa')][_0x1335('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e0f39,_0x31c525,_0x573c11){return new BPromise(function(_0x18d774,_0x236a50){return client[_0x1335('0xc')](_0x5e0f39,_0x573c11)['then'](function(_0x3b12fc){logger['info'](_0x1335('0xd'),_0x31c525,_0x1335('0xe'));logger['debug']('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x31c525,_0x1335('0xe'),JSON[_0x1335('0xf')](_0x3b12fc));if(_0x3b12fc['error']){if(_0x3b12fc[_0x1335('0x10')][_0x1335('0x11')]===0x1f4){logger[_0x1335('0x10')](_0x1335('0xd'),_0x31c525,_0x3b12fc[_0x1335('0x10')][_0x1335('0x12')]);return _0x236a50(_0x3b12fc[_0x1335('0x10')][_0x1335('0x12')]);}logger['error'](_0x1335('0xd'),_0x31c525,_0x3b12fc[_0x1335('0x10')][_0x1335('0x12')]);return _0x18d774(_0x3b12fc[_0x1335('0x10')][_0x1335('0x12')]);}else{logger[_0x1335('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x31c525,_0x1335('0xe'));_0x18d774(_0x3b12fc[_0x1335('0x14')]['message']);}})[_0x1335('0x15')](function(_0x1f408a){logger['error'](_0x1335('0xd'),_0x31c525,_0x1f408a);_0x236a50(_0x1f408a);});});}exports[_0x1335('0x16')]=function(_0x1bd554){var _0xba6e1e=this;return new Promise(function(_0x3c918a,_0x54eef3){return db[_0x1335('0x17')][_0x1335('0x18')](_0x1bd554['body'],{'raw':_0x1bd554['options']?_0x1bd554[_0x1335('0x19')][_0x1335('0x1a')]===undefined?!![]:![]:!![]})[_0x1335('0x1b')](function(_0x12c502){logger['info']('CreateChatQueueReport',_0x1bd554);logger['debug'](_0x1335('0x16'),_0x1bd554,JSON['stringify'](_0x12c502));_0x3c918a(_0x12c502);})[_0x1335('0x15')](function(_0x386729){logger[_0x1335('0x10')]('CreateChatQueueReport',_0x386729[_0x1335('0x12')],_0x1bd554);_0x54eef3(_0xba6e1e['error'](0x1f4,_0x386729['message']));});});};exports[_0x1335('0x1c')]=function(_0x28abcc){var _0x5601a2=this;return new Promise(function(_0x480403,_0x58202c){return db[_0x1335('0x17')][_0x1335('0x1d')](_0x28abcc[_0x1335('0x1e')],{'raw':_0x28abcc[_0x1335('0x19')]?_0x28abcc[_0x1335('0x19')][_0x1335('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28abcc[_0x1335('0x19')]?_0x28abcc[_0x1335('0x19')]['where']||null:null,'attributes':_0x28abcc[_0x1335('0x19')]?_0x28abcc['options'][_0x1335('0x1f')]||null:null,'limit':_0x28abcc['options']?_0x28abcc['options']['limit']||null:null})[_0x1335('0x1b')](function(_0x3c4404){logger['info'](_0x1335('0x1c'),_0x28abcc);logger[_0x1335('0x20')](_0x1335('0x1c'),_0x28abcc,JSON[_0x1335('0xf')](_0x3c4404));_0x480403(_0x3c4404);})[_0x1335('0x15')](function(_0x114da4){logger[_0x1335('0x10')](_0x1335('0x1c'),_0x114da4['message'],_0x28abcc);_0x58202c(_0x5601a2[_0x1335('0x10')](0x1f4,_0x114da4[_0x1335('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 43e0e4e..d495525 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 _0xe8c4=['post','create','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x53abe5,_0x33a9e5){var _0xc1c37e=function(_0xd53c6e){while(--_0xd53c6e){_0x53abe5['push'](_0x53abe5['shift']());}};_0xc1c37e(++_0x33a9e5);}(_0xe8c4,0x90));var _0x4e8c=function(_0x454080,_0x1f6126){_0x454080=_0x454080-0x0;var _0x16c2ae=_0xe8c4[_0x454080];return _0x16c2ae;};'use strict';var multer=require(_0x4e8c('0x0'));var util=require(_0x4e8c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4e8c('0x2'));var router=express[_0x4e8c('0x3')]();var fs_extra=require(_0x4e8c('0x4'));var auth=require(_0x4e8c('0x5'));var interaction=require(_0x4e8c('0x6'));var config=require(_0x4e8c('0x7'));var controller=require(_0x4e8c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x4e8c('0x9')]);router[_0x4e8c('0xa')](_0x4e8c('0xb'),auth[_0x4e8c('0xc')](),controller[_0x4e8c('0xd')]);router[_0x4e8c('0xa')](_0x4e8c('0xe'),auth[_0x4e8c('0xc')](),controller[_0x4e8c('0xf')]);router[_0x4e8c('0x10')]('/',auth['isAuthenticated'](),controller[_0x4e8c('0x11')]);router['put'](_0x4e8c('0xe'),auth[_0x4e8c('0xc')](),controller['update']);router[_0x4e8c('0x12')](_0x4e8c('0xe'),auth[_0x4e8c('0xc')](),controller[_0x4e8c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xc3b5=['get','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated'];(function(_0x25551b,_0x2a6634){var _0x246f95=function(_0x4435cd){while(--_0x4435cd){_0x25551b['push'](_0x25551b['shift']());}};_0x246f95(++_0x2a6634);}(_0xc3b5,0x1f0));var _0x5c3b=function(_0x13e9a9,_0x2a1327){_0x13e9a9=_0x13e9a9-0x0;var _0x47c190=_0xc3b5[_0x13e9a9];return _0x47c190;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c3b('0x0'));var timeout=require(_0x5c3b('0x1'));var express=require('express');var router=express[_0x5c3b('0x2')]();var fs_extra=require(_0x5c3b('0x3'));var auth=require(_0x5c3b('0x4'));var interaction=require(_0x5c3b('0x5'));var config=require('../../config/environment');var controller=require(_0x5c3b('0x6'));router['get']('/',auth[_0x5c3b('0x7')](),controller['index']);router[_0x5c3b('0x8')](_0x5c3b('0x9'),auth['isAuthenticated'](),controller[_0x5c3b('0xa')]);router[_0x5c3b('0x8')](_0x5c3b('0xb'),auth[_0x5c3b('0x7')](),controller['show']);router[_0x5c3b('0xc')]('/',auth[_0x5c3b('0x7')](),controller[_0x5c3b('0xd')]);router[_0x5c3b('0xe')](_0x5c3b('0xb'),auth[_0x5c3b('0x7')](),controller[_0x5c3b('0xf')]);router[_0x5c3b('0x10')](_0x5c3b('0xb'),auth[_0x5c3b('0x7')](),controller[_0x5c3b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index cf8e5df..ff80326 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1ce4d1,_0xea0bcb){var _0x1b270e=function(_0x584e49){while(--_0x584e49){_0x1ce4d1['push'](_0x1ce4d1['shift']());}};_0x1b270e(++_0xea0bcb);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x13fae8,_0x5c7d2f){var _0x5cf8a5=function(_0x291b7f){while(--_0x291b7f){_0x13fae8['push'](_0x13fae8['shift']());}};_0x5cf8a5(++_0x5c7d2f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0xcb91[_0x102977];return _0x15c466;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index aebdcf4..1cd94c3 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 _0x7a95=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ChatTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x7a95,0x91));var _0x57a9=function(_0x2b80a5,_0x2cc22e){_0x2b80a5=_0x2b80a5-0x0;var _0x475749=_0x7a95[_0x2b80a5];return _0x475749;};'use strict';var emlformat=require(_0x57a9('0x0'));var rimraf=require(_0x57a9('0x1'));var zipdir=require(_0x57a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x57a9('0x3'));var moment=require(_0x57a9('0x4'));var BPromise=require(_0x57a9('0x5'));var Mustache=require(_0x57a9('0x6'));var util=require(_0x57a9('0x7'));var path=require(_0x57a9('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57a9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x57a9('0xa'));var squel=require(_0x57a9('0xb'));var crypto=require(_0x57a9('0xc'));var jsforce=require(_0x57a9('0xd'));var deskjs=require(_0x57a9('0xe'));var toCsv=require(_0x57a9('0xf'));var querystring=require(_0x57a9('0x10'));var Papa=require(_0x57a9('0x11'));var Redis=require(_0x57a9('0x12'));var authService=require(_0x57a9('0x13'));var qs=require(_0x57a9('0x14'));var as=require(_0x57a9('0x15'));var hardwareService=require(_0x57a9('0x16'));var logger=require('../../config/logger')(_0x57a9('0x17'));var utils=require(_0x57a9('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x57a9('0x19'))['db'];function respondWithStatusCode(_0x374c84,_0x5bbc3f){_0x5bbc3f=_0x5bbc3f||0xcc;return function(_0x2c899d){if(_0x2c899d){return _0x374c84[_0x57a9('0x1a')](_0x5bbc3f);}return _0x374c84[_0x57a9('0x1b')](_0x5bbc3f)[_0x57a9('0x1c')]();};}function respondWithResult(_0x4f34c4,_0x16c284){_0x16c284=_0x16c284||0xc8;return function(_0x56b1f8){if(_0x56b1f8){return _0x4f34c4[_0x57a9('0x1b')](_0x16c284)[_0x57a9('0x1d')](_0x56b1f8);}};}function respondWithFilteredResult(_0x1fe217,_0x1ebdd7){return function(_0x39203e){if(_0x39203e){var _0x30de72=typeof _0x1ebdd7['offset']==='undefined'&&typeof _0x1ebdd7[_0x57a9('0x1e')]===_0x57a9('0x1f');var _0x197a61=_0x39203e[_0x57a9('0x20')];var _0xee11f1=_0x30de72?0x0:_0x1ebdd7[_0x57a9('0x21')];var _0x1482f7=_0x30de72?_0x39203e[_0x57a9('0x20')]:_0x1ebdd7[_0x57a9('0x21')]+_0x1ebdd7[_0x57a9('0x1e')];var _0x1a6d9d;if(_0x1482f7>=_0x197a61){_0x1482f7=_0x197a61;_0x1a6d9d=0xc8;}else{_0x1a6d9d=0xce;}_0x1fe217[_0x57a9('0x1b')](_0x1a6d9d);return _0x1fe217['set'](_0x57a9('0x22'),_0xee11f1+'-'+_0x1482f7+'/'+_0x197a61)[_0x57a9('0x1d')](_0x39203e);}return null;};}function patchUpdates(_0x288ab2){return function(_0x5181dc){try{jsonpatch[_0x57a9('0x23')](_0x5181dc,_0x288ab2,!![]);}catch(_0x16f862){return BPromise[_0x57a9('0x24')](_0x16f862);}return _0x5181dc[_0x57a9('0x25')]();};}function saveUpdates(_0x192615,_0x21e004){return function(_0x3f499e){if(_0x3f499e){return _0x3f499e[_0x57a9('0x26')](_0x192615)[_0x57a9('0x27')](function(_0x28a27a){return _0x28a27a;});}return null;};}function removeEntity(_0x2c6b2b,_0xb29b5){return function(_0x51acad){if(_0x51acad){return _0x51acad[_0x57a9('0x28')]()[_0x57a9('0x27')](function(){_0x2c6b2b[_0x57a9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23388c,_0xb99f9c){return function(_0x5b304c){if(!_0x5b304c){_0x23388c[_0x57a9('0x1a')](0x194);}return _0x5b304c;};}function handleError(_0x183596,_0x1fbddb){_0x1fbddb=_0x1fbddb||0x1f4;return function(_0xd753ff){logger[_0x57a9('0x29')](_0xd753ff[_0x57a9('0x2a')]);if(_0xd753ff[_0x57a9('0x2b')]){delete _0xd753ff['name'];}_0x183596[_0x57a9('0x1b')](_0x1fbddb)[_0x57a9('0x2c')](_0xd753ff);};}exports[_0x57a9('0x2d')]=function(_0x4ce7eb,_0x45b266){var _0x3e029c={},_0x3246b8={},_0xff4239={'count':0x0,'rows':[]};var _0x84e3d2=_['map'](db[_0x57a9('0x2e')][_0x57a9('0x2f')],function(_0x57f89c){return{'name':_0x57f89c[_0x57a9('0x30')],'type':_0x57f89c['type'][_0x57a9('0x31')]};});_0x3246b8[_0x57a9('0x32')]=_[_0x57a9('0x33')](_0x84e3d2,_0x57a9('0x2b'));_0x3246b8['query']=_[_0x57a9('0x34')](_0x4ce7eb[_0x57a9('0x35')]);_0x3246b8[_0x57a9('0x36')]=_[_0x57a9('0x37')](_0x3246b8['model'],_0x3246b8['query']);_0x3e029c[_0x57a9('0x38')]=_[_0x57a9('0x37')](_0x3246b8['model'],qs[_0x57a9('0x39')](_0x4ce7eb['query'][_0x57a9('0x39')]));_0x3e029c['attributes']=_0x3e029c[_0x57a9('0x38')][_0x57a9('0x3a')]?_0x3e029c[_0x57a9('0x38')]:_0x3246b8[_0x57a9('0x32')];if(!_0x4ce7eb[_0x57a9('0x35')]['hasOwnProperty'](_0x57a9('0x3b'))){_0x3e029c[_0x57a9('0x1e')]=qs[_0x57a9('0x1e')](_0x4ce7eb[_0x57a9('0x35')]['limit']);_0x3e029c[_0x57a9('0x21')]=qs[_0x57a9('0x21')](_0x4ce7eb[_0x57a9('0x35')][_0x57a9('0x21')]);}_0x3e029c[_0x57a9('0x3c')]=qs[_0x57a9('0x3d')](_0x4ce7eb[_0x57a9('0x35')]['sort']);_0x3e029c['where']=qs[_0x57a9('0x36')](_[_0x57a9('0x3e')](_0x4ce7eb['query'],_0x3246b8[_0x57a9('0x36')]),_0x84e3d2);if(_0x4ce7eb[_0x57a9('0x35')]['filter']){_0x3e029c[_0x57a9('0x3f')]=_[_0x57a9('0x40')](_0x3e029c[_0x57a9('0x3f')],{'$or':_['map'](_0x84e3d2,function(_0x694c2b){if(_0x694c2b[_0x57a9('0x41')]!==_0x57a9('0x42')){var _0x2e7dfd={};_0x2e7dfd[_0x694c2b[_0x57a9('0x2b')]]={'$like':'%'+_0x4ce7eb[_0x57a9('0x35')][_0x57a9('0x43')]+'%'};return _0x2e7dfd;}})});}_0x3e029c=_[_0x57a9('0x40')]({},_0x3e029c,_0x4ce7eb[_0x57a9('0x44')]);var _0x413af6={'where':_0x3e029c[_0x57a9('0x3f')]};return db[_0x57a9('0x2e')][_0x57a9('0x20')](_0x413af6)['then'](function(_0x556071){_0xff4239[_0x57a9('0x20')]=_0x556071;if(_0x4ce7eb[_0x57a9('0x35')][_0x57a9('0x45')]){_0x3e029c[_0x57a9('0x46')]=[{'all':!![]}];}return db[_0x57a9('0x2e')][_0x57a9('0x47')](_0x3e029c);})['then'](function(_0x3ddf79){_0xff4239['rows']=_0x3ddf79;return _0xff4239;})[_0x57a9('0x27')](respondWithFilteredResult(_0x45b266,_0x3e029c))[_0x57a9('0x48')](handleError(_0x45b266,null));};exports['show']=function(_0x23de39,_0x106011){var _0x42dab4={'raw':!![],'where':{'id':_0x23de39[_0x57a9('0x49')]['id']}},_0x9f770c={};_0x9f770c[_0x57a9('0x32')]=_['keys'](db[_0x57a9('0x2e')][_0x57a9('0x2f')]);_0x9f770c[_0x57a9('0x35')]=_[_0x57a9('0x34')](_0x23de39[_0x57a9('0x35')]);_0x9f770c['filters']=_[_0x57a9('0x37')](_0x9f770c[_0x57a9('0x32')],_0x9f770c[_0x57a9('0x35')]);_0x42dab4['attributes']=_[_0x57a9('0x37')](_0x9f770c[_0x57a9('0x32')],qs[_0x57a9('0x39')](_0x23de39[_0x57a9('0x35')]['fields']));_0x42dab4[_0x57a9('0x38')]=_0x42dab4['attributes'][_0x57a9('0x3a')]?_0x42dab4['attributes']:_0x9f770c[_0x57a9('0x32')];if(_0x23de39[_0x57a9('0x35')][_0x57a9('0x45')]){_0x42dab4[_0x57a9('0x46')]=[{'all':!![]}];}_0x42dab4=_[_0x57a9('0x40')]({},_0x42dab4,_0x23de39[_0x57a9('0x44')]);return db[_0x57a9('0x2e')][_0x57a9('0x4a')](_0x42dab4)[_0x57a9('0x27')](handleEntityNotFound(_0x106011,null))[_0x57a9('0x27')](respondWithResult(_0x106011,null))['catch'](handleError(_0x106011,null));};exports[_0x57a9('0x4b')]=function(_0x144a0f,_0x54e40f){return db[_0x57a9('0x2e')][_0x57a9('0x4b')](_0x144a0f['body'],{})[_0x57a9('0x27')](respondWithResult(_0x54e40f,0xc9))[_0x57a9('0x48')](handleError(_0x54e40f,null));};exports[_0x57a9('0x26')]=function(_0x339c76,_0x13d388){if(_0x339c76['body']['id']){delete _0x339c76['body']['id'];}return db['ChatTransferReport'][_0x57a9('0x4a')]({'where':{'id':_0x339c76[_0x57a9('0x49')]['id']}})[_0x57a9('0x27')](handleEntityNotFound(_0x13d388,null))[_0x57a9('0x27')](saveUpdates(_0x339c76[_0x57a9('0x4c')],null))['then'](respondWithResult(_0x13d388,null))[_0x57a9('0x48')](handleError(_0x13d388,null));};exports[_0x57a9('0x28')]=function(_0x55ac66,_0x2f1163){return db[_0x57a9('0x2e')][_0x57a9('0x4a')]({'where':{'id':_0x55ac66[_0x57a9('0x49')]['id']}})[_0x57a9('0x27')](handleEntityNotFound(_0x2f1163,null))[_0x57a9('0x27')](removeEntity(_0x2f1163,null))[_0x57a9('0x48')](handleError(_0x2f1163,null));};exports[_0x57a9('0x4d')]=function(_0x45bb81,_0x305fc2){return db[_0x57a9('0x2e')][_0x57a9('0x4d')]()[_0x57a9('0x27')](respondWithResult(_0x305fc2,null))['catch'](handleError(_0x305fc2,null));}; \ No newline at end of file +var _0x0e46=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatTransferReport','include','findAll','catch','show','params','keys','includeAll','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x52fd3d,_0x3af718){var _0x49b06d=function(_0x2f4a2b){while(--_0x2f4a2b){_0x52fd3d['push'](_0x52fd3d['shift']());}};_0x49b06d(++_0x3af718);}(_0x0e46,0x11f));var _0x60e4=function(_0x4c6fe9,_0x545ab3){_0x4c6fe9=_0x4c6fe9-0x0;var _0x4046b7=_0x0e46[_0x4c6fe9];return _0x4046b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x60e4('0x0'));var zipdir=require(_0x60e4('0x1'));var jsonpatch=require(_0x60e4('0x2'));var rp=require(_0x60e4('0x3'));var moment=require(_0x60e4('0x4'));var BPromise=require(_0x60e4('0x5'));var Mustache=require(_0x60e4('0x6'));var util=require('util');var path=require(_0x60e4('0x7'));var sox=require(_0x60e4('0x8'));var csv=require('to-csv');var ejs=require(_0x60e4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60e4('0xa'));var squel=require(_0x60e4('0xb'));var crypto=require('crypto');var jsforce=require(_0x60e4('0xc'));var deskjs=require(_0x60e4('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x60e4('0xe'));var Redis=require(_0x60e4('0xf'));var authService=require(_0x60e4('0x10'));var qs=require(_0x60e4('0x11'));var as=require(_0x60e4('0x12'));var hardwareService=require(_0x60e4('0x13'));var logger=require('../../config/logger')(_0x60e4('0x14'));var utils=require(_0x60e4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x60e4('0x16'));var db=require(_0x60e4('0x17'))['db'];function respondWithStatusCode(_0x404ab0,_0x2a1756){_0x2a1756=_0x2a1756||0xcc;return function(_0x137c22){if(_0x137c22){return _0x404ab0[_0x60e4('0x18')](_0x2a1756);}return _0x404ab0[_0x60e4('0x19')](_0x2a1756)[_0x60e4('0x1a')]();};}function respondWithResult(_0x4a8d0c,_0x10b463){_0x10b463=_0x10b463||0xc8;return function(_0x5dd420){if(_0x5dd420){return _0x4a8d0c['status'](_0x10b463)[_0x60e4('0x1b')](_0x5dd420);}};}function respondWithFilteredResult(_0x412c15,_0xac1f83){return function(_0x531ac8){if(_0x531ac8){var _0x14b1f7=typeof _0xac1f83[_0x60e4('0x1c')]===_0x60e4('0x1d')&&typeof _0xac1f83[_0x60e4('0x1e')]===_0x60e4('0x1d');var _0x4a43c4=_0x531ac8['count'];var _0xc485e7=_0x14b1f7?0x0:_0xac1f83['offset'];var _0xa92c3a=_0x14b1f7?_0x531ac8[_0x60e4('0x1f')]:_0xac1f83[_0x60e4('0x1c')]+_0xac1f83[_0x60e4('0x1e')];var _0x5aa796;if(_0xa92c3a>=_0x4a43c4){_0xa92c3a=_0x4a43c4;_0x5aa796=0xc8;}else{_0x5aa796=0xce;}_0x412c15[_0x60e4('0x19')](_0x5aa796);return _0x412c15[_0x60e4('0x20')](_0x60e4('0x21'),_0xc485e7+'-'+_0xa92c3a+'/'+_0x4a43c4)['json'](_0x531ac8);}return null;};}function patchUpdates(_0x2d594a){return function(_0x1b77b6){try{jsonpatch[_0x60e4('0x22')](_0x1b77b6,_0x2d594a,!![]);}catch(_0x8f71dc){return BPromise[_0x60e4('0x23')](_0x8f71dc);}return _0x1b77b6[_0x60e4('0x24')]();};}function saveUpdates(_0x1412f0,_0x113fa2){return function(_0x57bbc7){if(_0x57bbc7){return _0x57bbc7[_0x60e4('0x25')](_0x1412f0)[_0x60e4('0x26')](function(_0x2e49bf){return _0x2e49bf;});}return null;};}function removeEntity(_0x1b8543,_0x450e4c){return function(_0x156875){if(_0x156875){return _0x156875['destroy']()[_0x60e4('0x26')](function(){_0x1b8543[_0x60e4('0x19')](0xcc)[_0x60e4('0x1a')]();});}};}function handleEntityNotFound(_0x321d68,_0x8b58fa){return function(_0x123fc8){if(!_0x123fc8){_0x321d68['sendStatus'](0x194);}return _0x123fc8;};}function handleError(_0x5a1907,_0xa5e565){_0xa5e565=_0xa5e565||0x1f4;return function(_0x2824fd){logger[_0x60e4('0x27')](_0x2824fd['stack']);if(_0x2824fd[_0x60e4('0x28')]){delete _0x2824fd[_0x60e4('0x28')];}_0x5a1907['status'](_0xa5e565)[_0x60e4('0x29')](_0x2824fd);};}exports[_0x60e4('0x2a')]=function(_0x13828c,_0x31aa44){var _0x2c07af={},_0x515a19={},_0x2ca49d={'count':0x0,'rows':[]};var _0x583578=_[_0x60e4('0x2b')](db['ChatTransferReport'][_0x60e4('0x2c')],function(_0x175c40){return{'name':_0x175c40[_0x60e4('0x2d')],'type':_0x175c40['type'][_0x60e4('0x2e')]};});_0x515a19['model']=_[_0x60e4('0x2b')](_0x583578,_0x60e4('0x28'));_0x515a19[_0x60e4('0x2f')]=_['keys'](_0x13828c['query']);_0x515a19['filters']=_[_0x60e4('0x30')](_0x515a19[_0x60e4('0x31')],_0x515a19[_0x60e4('0x2f')]);_0x2c07af[_0x60e4('0x32')]=_[_0x60e4('0x30')](_0x515a19[_0x60e4('0x31')],qs[_0x60e4('0x33')](_0x13828c['query']['fields']));_0x2c07af['attributes']=_0x2c07af['attributes'][_0x60e4('0x34')]?_0x2c07af[_0x60e4('0x32')]:_0x515a19[_0x60e4('0x31')];if(!_0x13828c['query'][_0x60e4('0x35')](_0x60e4('0x36'))){_0x2c07af[_0x60e4('0x1e')]=qs[_0x60e4('0x1e')](_0x13828c[_0x60e4('0x2f')][_0x60e4('0x1e')]);_0x2c07af[_0x60e4('0x1c')]=qs[_0x60e4('0x1c')](_0x13828c[_0x60e4('0x2f')][_0x60e4('0x1c')]);}_0x2c07af[_0x60e4('0x37')]=qs[_0x60e4('0x38')](_0x13828c['query'][_0x60e4('0x38')]);_0x2c07af[_0x60e4('0x39')]=qs[_0x60e4('0x3a')](_[_0x60e4('0x3b')](_0x13828c[_0x60e4('0x2f')],_0x515a19[_0x60e4('0x3a')]),_0x583578);if(_0x13828c[_0x60e4('0x2f')][_0x60e4('0x3c')]){_0x2c07af['where']=_[_0x60e4('0x3d')](_0x2c07af[_0x60e4('0x39')],{'$or':_[_0x60e4('0x2b')](_0x583578,function(_0x544771){if(_0x544771['type']!==_0x60e4('0x3e')){var _0x4349ef={};_0x4349ef[_0x544771[_0x60e4('0x28')]]={'$like':'%'+_0x13828c[_0x60e4('0x2f')][_0x60e4('0x3c')]+'%'};return _0x4349ef;}})});}_0x2c07af=_[_0x60e4('0x3d')]({},_0x2c07af,_0x13828c[_0x60e4('0x3f')]);var _0x47d59c={'where':_0x2c07af['where']};return db[_0x60e4('0x40')][_0x60e4('0x1f')](_0x47d59c)['then'](function(_0x3ed14b){_0x2ca49d[_0x60e4('0x1f')]=_0x3ed14b;if(_0x13828c[_0x60e4('0x2f')]['includeAll']){_0x2c07af[_0x60e4('0x41')]=[{'all':!![]}];}return db[_0x60e4('0x40')][_0x60e4('0x42')](_0x2c07af);})['then'](function(_0x5a370c){_0x2ca49d['rows']=_0x5a370c;return _0x2ca49d;})[_0x60e4('0x26')](respondWithFilteredResult(_0x31aa44,_0x2c07af))[_0x60e4('0x43')](handleError(_0x31aa44,null));};exports[_0x60e4('0x44')]=function(_0x373caa,_0x2f2195){var _0x5f04f3={'raw':!![],'where':{'id':_0x373caa[_0x60e4('0x45')]['id']}},_0x29cb86={};_0x29cb86[_0x60e4('0x31')]=_[_0x60e4('0x46')](db[_0x60e4('0x40')][_0x60e4('0x2c')]);_0x29cb86[_0x60e4('0x2f')]=_['keys'](_0x373caa[_0x60e4('0x2f')]);_0x29cb86[_0x60e4('0x3a')]=_[_0x60e4('0x30')](_0x29cb86['model'],_0x29cb86[_0x60e4('0x2f')]);_0x5f04f3[_0x60e4('0x32')]=_[_0x60e4('0x30')](_0x29cb86[_0x60e4('0x31')],qs['fields'](_0x373caa[_0x60e4('0x2f')][_0x60e4('0x33')]));_0x5f04f3['attributes']=_0x5f04f3[_0x60e4('0x32')][_0x60e4('0x34')]?_0x5f04f3[_0x60e4('0x32')]:_0x29cb86[_0x60e4('0x31')];if(_0x373caa[_0x60e4('0x2f')][_0x60e4('0x47')]){_0x5f04f3[_0x60e4('0x41')]=[{'all':!![]}];}_0x5f04f3=_[_0x60e4('0x3d')]({},_0x5f04f3,_0x373caa['options']);return db[_0x60e4('0x40')][_0x60e4('0x48')](_0x5f04f3)[_0x60e4('0x26')](handleEntityNotFound(_0x2f2195,null))[_0x60e4('0x26')](respondWithResult(_0x2f2195,null))[_0x60e4('0x43')](handleError(_0x2f2195,null));};exports[_0x60e4('0x49')]=function(_0xc50bec,_0x1e80c9){return db[_0x60e4('0x40')][_0x60e4('0x49')](_0xc50bec[_0x60e4('0x4a')],{})[_0x60e4('0x26')](respondWithResult(_0x1e80c9,0xc9))[_0x60e4('0x43')](handleError(_0x1e80c9,null));};exports[_0x60e4('0x25')]=function(_0x57edf1,_0x13b5a0){if(_0x57edf1[_0x60e4('0x4a')]['id']){delete _0x57edf1[_0x60e4('0x4a')]['id'];}return db[_0x60e4('0x40')][_0x60e4('0x48')]({'where':{'id':_0x57edf1['params']['id']}})[_0x60e4('0x26')](handleEntityNotFound(_0x13b5a0,null))[_0x60e4('0x26')](saveUpdates(_0x57edf1[_0x60e4('0x4a')],null))[_0x60e4('0x26')](respondWithResult(_0x13b5a0,null))[_0x60e4('0x43')](handleError(_0x13b5a0,null));};exports[_0x60e4('0x4b')]=function(_0xacbe1c,_0x42d930){return db['ChatTransferReport']['find']({'where':{'id':_0xacbe1c[_0x60e4('0x45')]['id']}})[_0x60e4('0x26')](handleEntityNotFound(_0x42d930,null))[_0x60e4('0x26')](removeEntity(_0x42d930,null))[_0x60e4('0x43')](handleError(_0x42d930,null));};exports[_0x60e4('0x4c')]=function(_0x10ed2b,_0x1e79e3){return db[_0x60e4('0x40')][_0x60e4('0x4c')]()[_0x60e4('0x26')](respondWithResult(_0x1e79e3,null))[_0x60e4('0x43')](handleError(_0x1e79e3,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 97a1310..c48f4da 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 _0xf732=['exports','define','report_chat_transfer','uniqueid','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x2467c9,_0xe83242){var _0xe776b0=function(_0x4f0485){while(--_0x4f0485){_0x2467c9['push'](_0x2467c9['shift']());}};_0xe776b0(++_0xe83242);}(_0xf732,0x16f));var _0x2f73=function(_0x49fa22,_0x3a8ccb){_0x49fa22=_0x49fa22-0x0;var _0x4af7a1=_0xf732[_0x49fa22];return _0x4af7a1;};'use strict';var _=require(_0x2f73('0x0'));var util=require('util');var logger=require(_0x2f73('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f73('0x2'));var fs=require('fs');var path=require(_0x2f73('0x3'));var rimraf=require(_0x2f73('0x4'));var config=require(_0x2f73('0x5'));var attributes=require(_0x2f73('0x6'));module[_0x2f73('0x7')]=function(_0x104ba0,_0x2a9352){return _0x104ba0[_0x2f73('0x8')]('ChatTransferReport',attributes,{'tableName':_0x2f73('0x9'),'paranoid':![],'indexes':[{'name':_0x2f73('0xa'),'fields':[_0x2f73('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb444=['rimraf','./chatTransferReport.attributes','exports','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xb444,0x1e5));var _0x4b44=function(_0x458067,_0x3988fe){_0x458067=_0x458067-0x0;var _0x480cb4=_0xb444[_0x458067];return _0x480cb4;};'use strict';var _=require(_0x4b44('0x0'));var util=require(_0x4b44('0x1'));var logger=require(_0x4b44('0x2'))(_0x4b44('0x3'));var moment=require(_0x4b44('0x4'));var BPromise=require('bluebird');var rp=require(_0x4b44('0x5'));var fs=require('fs');var path=require(_0x4b44('0x6'));var rimraf=require(_0x4b44('0x7'));var config=require('../../config/environment');var attributes=require(_0x4b44('0x8'));module[_0x4b44('0x9')]=function(_0x378b44,_0x54a34f){return _0x378b44['define'](_0x4b44('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x4b44('0xb'),'fields':[_0x4b44('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 688b44a..9c6d1d1 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 _0xe833=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0xf13acd,_0x30deb2){var _0x9be1df=function(_0x56d1c1){while(--_0x56d1c1){_0xf13acd['push'](_0xf13acd['shift']());}};_0x9be1df(++_0x30deb2);}(_0xe833,0x1df));var _0x3e83=function(_0x30d538,_0x2510d4){_0x30d538=_0x30d538-0x0;var _0x5c2083=_0xe833[_0x30d538];return _0x5c2083;};'use strict';var _=require(_0x3e83('0x0'));var util=require(_0x3e83('0x1'));var moment=require(_0x3e83('0x2'));var BPromise=require(_0x3e83('0x3'));var rs=require(_0x3e83('0x4'));var fs=require('fs');var Redis=require(_0x3e83('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e83('0x6'));var logger=require(_0x3e83('0x7'))(_0x3e83('0x8'));var config=require(_0x3e83('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e83('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x453840,_0x785029,_0x2496a5){return new BPromise(function(_0x466c97,_0x26dca2){return client['request'](_0x453840,_0x2496a5)['then'](function(_0x389cfe){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x785029,_0x3e83('0xb'));logger['debug'](_0x3e83('0xc'),_0x785029,'request\x20sent',JSON['stringify'](_0x389cfe));if(_0x389cfe[_0x3e83('0xd')]){if(_0x389cfe[_0x3e83('0xd')][_0x3e83('0xe')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x785029,_0x389cfe[_0x3e83('0xd')][_0x3e83('0xf')]);return _0x26dca2(_0x389cfe['error'][_0x3e83('0xf')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x785029,_0x389cfe['error']['message']);return _0x466c97(_0x389cfe[_0x3e83('0xd')][_0x3e83('0xf')]);}else{logger[_0x3e83('0x10')](_0x3e83('0x11'),_0x785029,'request\x20sent');_0x466c97(_0x389cfe[_0x3e83('0x12')][_0x3e83('0xf')]);}})[_0x3e83('0x13')](function(_0x449981){logger[_0x3e83('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x785029,_0x449981);_0x26dca2(_0x449981);});});} \ No newline at end of file +var _0x5a67=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50e74e,_0x5cbc74){var _0x47ce91=function(_0x479df0){while(--_0x479df0){_0x50e74e['push'](_0x50e74e['shift']());}};_0x47ce91(++_0x5cbc74);}(_0x5a67,0x1d5));var _0x75a6=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0x5a67[_0xd02bb];return _0x1cdf23;};'use strict';var _=require('lodash');var util=require(_0x75a6('0x0'));var moment=require(_0x75a6('0x1'));var BPromise=require(_0x75a6('0x2'));var rs=require(_0x75a6('0x3'));var fs=require('fs');var Redis=require(_0x75a6('0x4'));var db=require(_0x75a6('0x5'))['db'];var utils=require(_0x75a6('0x6'));var logger=require(_0x75a6('0x7'))('rpc');var config=require(_0x75a6('0x8'));var jayson=require(_0x75a6('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1785ee,_0x3e8073,_0x1fc15d){return new BPromise(function(_0x568170,_0x4f74bb){return client[_0x75a6('0xa')](_0x1785ee,_0x1fc15d)[_0x75a6('0xb')](function(_0x31c707){logger[_0x75a6('0xc')](_0x75a6('0xd'),_0x3e8073,_0x75a6('0xe'));logger['debug'](_0x75a6('0xf'),_0x3e8073,_0x75a6('0xe'),JSON['stringify'](_0x31c707));if(_0x31c707[_0x75a6('0x10')]){if(_0x31c707[_0x75a6('0x10')]['code']===0x1f4){logger[_0x75a6('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x3e8073,_0x31c707[_0x75a6('0x10')]['message']);return _0x4f74bb(_0x31c707['error'][_0x75a6('0x11')]);}logger[_0x75a6('0x10')](_0x75a6('0xd'),_0x3e8073,_0x31c707['error'][_0x75a6('0x11')]);return _0x568170(_0x31c707['error'][_0x75a6('0x11')]);}else{logger[_0x75a6('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x3e8073,'request\x20sent');_0x568170(_0x31c707[_0x75a6('0x12')][_0x75a6('0x11')]);}})['catch'](function(_0xc59d7d){logger[_0x75a6('0x10')](_0x75a6('0xd'),_0x3e8073,_0xc59d7d);_0x4f74bb(_0xc59d7d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 425f18f..16d3c50 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 _0x0711=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x5098e8,_0x3bee6e){var _0x4323ad=function(_0xb13e37){while(--_0xb13e37){_0x5098e8['push'](_0x5098e8['shift']());}};_0x4323ad(++_0x3bee6e);}(_0x0711,0xfa));var _0x1071=function(_0x1418d9,_0x563b32){_0x1418d9=_0x1418d9-0x0;var _0x4cfd05=_0x0711[_0x1418d9];return _0x4cfd05;};'use strict';var multer=require(_0x1071('0x0'));var util=require(_0x1071('0x1'));var path=require(_0x1071('0x2'));var timeout=require(_0x1071('0x3'));var express=require(_0x1071('0x4'));var router=express[_0x1071('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1071('0x6'));var interaction=require(_0x1071('0x7'));var config=require('../../config/environment');var controller=require(_0x1071('0x8'));router[_0x1071('0x9')]('/',auth[_0x1071('0xa')](),controller['index']);router[_0x1071('0x9')](_0x1071('0xb'),auth[_0x1071('0xa')](),controller[_0x1071('0xc')]);router[_0x1071('0x9')](_0x1071('0xd'),auth[_0x1071('0xa')](),controller['show']);router[_0x1071('0xe')]('/',auth[_0x1071('0xa')](),controller[_0x1071('0xf')]);router[_0x1071('0x10')](_0x1071('0xd'),auth[_0x1071('0xa')](),controller[_0x1071('0x11')]);router[_0x1071('0x12')](_0x1071('0xd'),auth[_0x1071('0xa')](),controller[_0x1071('0x13')]);module[_0x1071('0x14')]=router; \ No newline at end of file +var _0xaab4=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0xc34ee0,_0x316641){var _0x2ba768=function(_0x336ef8){while(--_0x336ef8){_0xc34ee0['push'](_0xc34ee0['shift']());}};_0x2ba768(++_0x316641);}(_0xaab4,0x162));var _0x4aab=function(_0x3dfb8a,_0x4f939){_0x3dfb8a=_0x3dfb8a-0x0;var _0x3d2e5f=_0xaab4[_0x3dfb8a];return _0x3d2e5f;};'use strict';var multer=require(_0x4aab('0x0'));var util=require(_0x4aab('0x1'));var path=require(_0x4aab('0x2'));var timeout=require(_0x4aab('0x3'));var express=require(_0x4aab('0x4'));var router=express[_0x4aab('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4aab('0x6'));var config=require(_0x4aab('0x7'));var controller=require('./chatTransferReport.controller');router[_0x4aab('0x8')]('/',auth[_0x4aab('0x9')](),controller['index']);router[_0x4aab('0x8')](_0x4aab('0xa'),auth['isAuthenticated'](),controller[_0x4aab('0xb')]);router[_0x4aab('0x8')](_0x4aab('0xc'),auth['isAuthenticated'](),controller[_0x4aab('0xd')]);router['post']('/',auth[_0x4aab('0x9')](),controller[_0x4aab('0xe')]);router['put'](_0x4aab('0xc'),auth[_0x4aab('0x9')](),controller[_0x4aab('0xf')]);router[_0x4aab('0x10')](_0x4aab('0xc'),auth['isAuthenticated'](),controller[_0x4aab('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a13a0b3..8911f93 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 _0x5caa=['Send','Skip','Feedback','thumb','star','name','input','onlineForm','parse','getDataValue','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x834246,_0x3ac832){var _0x5708af=function(_0xe087ca){while(--_0xe087ca){_0x834246['push'](_0x834246['shift']());}};_0x5708af(++_0x3ac832);}(_0x5caa,0x156));var _0xa5ca=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x5caa[_0x2d460c];return _0xf6fc4c;};'use strict';var Sequelize=require(_0xa5ca('0x0'));var rs=require(_0xa5ca('0x1'));module[_0xa5ca('0x2')]={'name':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![],'unique':_0xa5ca('0x4')},'description':{'type':Sequelize[_0xa5ca('0x3')]},'mapKey':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x5')},'mapKeyOffline':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x5')},'key':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![],'defaultValue':_0xa5ca('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![],'defaultValue':_0xa5ca('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xa5ca('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xa5ca('0x3')]},'animation':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xa5ca('0x9')](_0xa5ca('0xa'),_0xa5ca('0xb')),'defaultValue':_0xa5ca('0xa')},'header_online':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0xc')},'start_chat_button':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0xd')},'offline_chat_button':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xa5ca('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xa5ca('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xa5ca('0xf')]},'closingQuestion':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa5ca('0x13')},'placeholderMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x14')},'closingMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x15')},'closingMessageButton':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x16')},'skipMessageButton':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x17')},'conditionAgreement':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x18')},'ratingType':{'type':Sequelize[_0xa5ca('0x9')]('star',_0xa5ca('0x19')),'defaultValue':_0xa5ca('0x1a')},'ratingStarsNumber':{'type':Sequelize[_0xa5ca('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xa5ca('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xa5ca('0x1b'),'type':'text','required':!![]},'props':{'title':_0xa5ca('0x1b'),'helpText':''}},{'type':_0xa5ca('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xa5ca('0x5'),'type':_0xa5ca('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xa5ca('0x1d'))?JSON[_0xa5ca('0x1e')](this[_0xa5ca('0x1f')](_0xa5ca('0x1d'))):{};},'set':function(_0xe81efd){return this[_0xa5ca('0x20')](_0xa5ca('0x1d'),JSON[_0xa5ca('0x21')](_0xe81efd));}},'offlineForm':{'type':Sequelize[_0xa5ca('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xa5ca('0x1c'),'props':{'title':_0xa5ca('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xa5ca('0x5'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0xa5ca('0x22')},'props':{'title':'Comments','helpText':_0xa5ca('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0xa5ca('0x1f')]('offlineForm')?JSON[_0xa5ca('0x1e')](this[_0xa5ca('0x1f')]('offlineForm')):{};},'set':function(_0x56e111){return this[_0xa5ca('0x20')](_0xa5ca('0x24'),JSON['stringify'](_0x56e111));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xa5ca('0x25')]();}},'autoclose':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xa5ca('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xa5ca('0x26')},'waitingMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x28')},'offlineMessageBody':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x2a')},'skipUnmanaged':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x17')},'sendUnmanaged':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x16')},'enableCustomerAttachment':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xa5ca('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xa5ca('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa5ca('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0xa5ca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x2c')},'verticalAlignment':{'type':Sequelize[_0xa5ca('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x2d')},'messagesAlignment':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':_0xa5ca('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xa5ca('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xa5ca('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xa5ca('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa5ca('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xa5ca('0x2f')},'systemAvatar':{'type':Sequelize[_0xa5ca('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa5ca('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![],'comment':_0xa5ca('0x30'),'set':function(_0x4c38c9){if(!_0x4c38c9)this[_0xa5ca('0x20')](_0xa5ca('0x31'),null);this[_0xa5ca('0x20')]('mandatoryDisposition',_0x4c38c9);}},'vidaooEscalation':{'type':Sequelize[_0xa5ca('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xa5ca('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa5ca('0x32')},'vidaooNote':{'type':Sequelize[_0xa5ca('0x3')],'defaultValue':function(){return _0xa5ca('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xa5ca('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xa5ca('0xf')]}}; \ No newline at end of file +var _0xe04b=['setDataValue','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','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','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Send','thumb','star','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe04b,0x7a));var _0xbe04=function(_0x384f48,_0x5c72ff){_0x384f48=_0x384f48-0x0;var _0x57609a=_0xe04b[_0x384f48];return _0x57609a;};'use strict';var Sequelize=require(_0xbe04('0x0'));var rs=require(_0xbe04('0x1'));module[_0xbe04('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![],'unique':_0xbe04('0x4')},'description':{'type':Sequelize[_0xbe04('0x3')]},'mapKey':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x5')},'mapKeyOffline':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x5')},'key':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x6')},'customerAlias':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![],'defaultValue':_0xbe04('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![],'defaultValue':_0xbe04('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbe04('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbe04('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbe04('0xb')](_0xbe04('0xc'),'squared'),'defaultValue':_0xbe04('0xc')},'header_online':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0xd')},'start_chat_button':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbe04('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x11')},'noteTitle':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x12')},'placeholderMessage':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x13')},'closingMessageButton':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x14')},'skipMessageButton':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbe04('0xb')]('star',_0xbe04('0x15')),'defaultValue':_0xbe04('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xbe04('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbe04('0x17')],'defaultValue':function(){return JSON[_0xbe04('0x18')]({'items':[{'type':_0xbe04('0x19'),'variable':null,'config':{'placeholder':_0xbe04('0x1a'),'type':_0xbe04('0x1b'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbe04('0x5'),'type':_0xbe04('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbe04('0x1c')](_0xbe04('0x1d'))?JSON[_0xbe04('0x1e')](this[_0xbe04('0x1c')](_0xbe04('0x1d'))):{};},'set':function(_0x1bb931){return this['setDataValue'](_0xbe04('0x1d'),JSON[_0xbe04('0x18')](_0x1bb931));}},'offlineForm':{'type':Sequelize[_0xbe04('0x17')],'defaultValue':function(){return JSON[_0xbe04('0x18')]({'items':[{'type':_0xbe04('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbe04('0x5'),'type':_0xbe04('0x5')},'variable':null},{'type':_0xbe04('0x1f'),'config':{'placeholder':_0xbe04('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xbe04('0x1c')](_0xbe04('0x21'))?JSON['parse'](this[_0xbe04('0x1c')]('offlineForm')):{};},'set':function(_0x59e9f7){return this[_0xbe04('0x22')](_0xbe04('0x21'),JSON[_0xbe04('0x18')](_0x59e9f7));}},'token':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbe04('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbe04('0x3')]},'waitingTitle':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x27')},'skipUnmanaged':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x28')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbe04('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbe04('0x29');}},'notificationSound':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xbe04('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xbe04('0x2b')},'verticalAlignment':{'type':Sequelize[_0xbe04('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xbe04('0x3')]},'customerAvatar':{'type':Sequelize[_0xbe04('0x17')]},'showCustomerAvatar':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbe04('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![],'defaultValue':_0xbe04('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbe04('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbe04('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':_0xbe04('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe04('0x9')],'comment':_0xbe04('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![],'comment':_0xbe04('0x30'),'set':function(_0x8216d7){if(!_0x8216d7)this[_0xbe04('0x22')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbe04('0x31'),_0x8216d7);}},'vidaooEscalation':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbe04('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbe04('0x3')],'allowNull':![],'defaultValue':_0xbe04('0x32')},'vidaooNote':{'type':Sequelize[_0xbe04('0x3')],'defaultValue':function(){return _0xbe04('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbe04('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xbe04('0x17')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 9ffd584..9b6e8ce 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(_0x11fdd8,_0x6e1f6c){var _0x35cf9c=function(_0x217d8e){while(--_0x217d8e){_0x11fdd8['push'](_0x11fdd8['shift']());}};_0x35cf9c(++_0x6e1f6c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3dea7d,_0x2cd4ea){_0x3dea7d=_0x3dea7d-0x0;var _0x53919a=_0x0b0e[_0x3dea7d];return _0x53919a;};'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 _0x5f66=['Start','startRouting','EventManager','offline','files','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','findOne','MailServerOut','Smtp','forwardOfflineAddress','service','host','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','toPairsIn','mapValues','subjectOffline','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','custom','License','increment','chatLicenseExceeded','all','some','x-real-ip','connection','remoteAddress','replace','alignment','color','labelText','textColor','color_button','backgroundColor','addApplications','Transaction','READ_COMMITTED','priority','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','limit','undefined','count','offset','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','index','mandatoryDispositionPause','map','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatWebsite','include','rows','show','params','Pause','keys','rawAttributes','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ChatWebsiteId','Disposition','getDispositions','removeDispositions','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','isNil','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','getResult','chat','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','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','Contacts','DESC','ChatApplication','Applications','List','account','applications','list','asc','contact','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','ChatInteraction','threadId','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','unmanaged','*,*,*,*','AttachmentId','User','unshift','agent','forcedOwnership'];(function(_0x30cd87,_0x593d6d){var _0x2a54c0=function(_0x40b4f4){while(--_0x40b4f4){_0x30cd87['push'](_0x30cd87['shift']());}};_0x2a54c0(++_0x593d6d);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x65f6('0x0'));var util=require('util');var path=require(_0x65f6('0x1'));var ejs=require(_0x65f6('0x2'));var fs=require('fs');var fs_extra=require(_0x65f6('0x3'));var _=require(_0x65f6('0x4'));var querystring=require(_0x65f6('0x5'));var Redis=require('ioredis');var qs=require(_0x65f6('0x6'));var logger=require('../../config/logger')(_0x65f6('0x7'));var config=require(_0x65f6('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);var htmlToText=require('html-to-text');var jayson=require(_0x65f6('0xe'));var client=jayson[_0x65f6('0xf')][_0x65f6('0x10')]({'port':0x232c});var client9002=jayson[_0x65f6('0xf')]['http']({'port':0x232a});var client9003=jayson[_0x65f6('0xf')]['http']({'port':0x232b});var client9001=jayson['client'][_0x65f6('0x10')]({'port':0x2329});function respondWithRpcPromise(_0x576875,_0x419819,_0x4862a5,_0x2f964a){return new BPromise(function(_0x186a6a,_0x2c4ee5){var _0x217570=_0x2f964a||client;return _0x217570[_0x65f6('0x11')](_0x576875,_0x4862a5)[_0x65f6('0x12')](function(_0x44144b){logger[_0x65f6('0x13')](_0x65f6('0x14'),_0x419819,_0x65f6('0x15'));logger['debug'](_0x65f6('0x16'),_0x419819,'request\x20sent',JSON['stringify'](_0x44144b));if(_0x44144b[_0x65f6('0x17')]){if(_0x44144b[_0x65f6('0x17')][_0x65f6('0x18')]===0x1f4){logger[_0x65f6('0x17')](_0x65f6('0x14'),_0x419819,_0x44144b[_0x65f6('0x17')][_0x65f6('0x19')]);return _0x2c4ee5(_0x44144b[_0x65f6('0x17')]['message']);}logger['error'](_0x65f6('0x14'),_0x419819,_0x44144b['error']['message']);return _0x186a6a(_0x44144b['error'][_0x65f6('0x19')]);}else{logger[_0x65f6('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x419819,_0x65f6('0x15'));_0x186a6a(_0x44144b[_0x65f6('0x1a')][_0x65f6('0x19')]);}})[_0x65f6('0x1b')](function(_0x219ab2){logger[_0x65f6('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x419819,_0x219ab2);_0x2c4ee5(_0x219ab2);});});}function respondWithStatusCode(_0x197a49,_0x4bb39e){_0x4bb39e=_0x4bb39e||0xcc;return function(_0x5b9e2a){if(_0x5b9e2a){return _0x197a49[_0x65f6('0x1c')](_0x4bb39e);}return _0x197a49[_0x65f6('0x1d')](_0x4bb39e)['end']();};}function respondWithResult(_0x1eeaaa,_0x471a33){_0x471a33=_0x471a33||0xc8;return function(_0x2317ce){if(_0x2317ce){return _0x1eeaaa[_0x65f6('0x1d')](_0x471a33)['json'](_0x2317ce);}};}function respondWithFilteredResult(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(_0x20a161){var _0x5963e0=typeof _0x59ea32['offset']==='undefined'&&typeof _0x59ea32[_0x65f6('0x1e')]===_0x65f6('0x1f');var _0x4b2292=_0x20a161[_0x65f6('0x20')];var _0x28f710=_0x5963e0?0x0:_0x59ea32['offset'];var _0x325cb4=_0x5963e0?_0x20a161[_0x65f6('0x20')]:_0x59ea32[_0x65f6('0x21')]+_0x59ea32['limit'];var _0x4ac04b;if(_0x325cb4>=_0x4b2292){_0x325cb4=_0x4b2292;_0x4ac04b=0xc8;}else{_0x4ac04b=0xce;}_0x9d7bb0['status'](_0x4ac04b);return _0x9d7bb0[_0x65f6('0x22')](_0x65f6('0x23'),_0x28f710+'-'+_0x325cb4+'/'+_0x4b2292)[_0x65f6('0x24')](_0x20a161);}return null;};}function saveUpdates(_0x408ccc){return function(_0x518cac){if(_0x518cac){return _0x518cac[_0x65f6('0x25')](_0x408ccc)[_0x65f6('0x12')](function(_0x4ace4c){return _0x4ace4c;});}return null;};}function removeEntity(_0x4ea23d){return function(_0x154cbd){if(_0x154cbd){return _0x154cbd[_0x65f6('0x26')]()['then'](function(){var _0x4e50c0=_0x154cbd[_0x65f6('0x27')]({'plain':!![]});var _0x1ce43c=_0x65f6('0x28');return db[_0x65f6('0x29')][_0x65f6('0x26')]({'where':{'type':_0x1ce43c,'resourceId':_0x4e50c0['id']}})[_0x65f6('0x12')](function(){return _0x154cbd;});})['then'](function(){_0x4ea23d[_0x65f6('0x1d')](0xcc)[_0x65f6('0x2a')]();});}};}function handleEntityNotFound(_0x46f03c){return function(_0x4bc037){if(!_0x4bc037){_0x46f03c[_0x65f6('0x1c')](0x194);}return _0x4bc037;};}function handleError(_0x2a7aa8,_0xbaed3c){_0xbaed3c=_0xbaed3c||0x1f4;return function(_0x45510a){logger[_0x65f6('0x17')](_0x45510a[_0x65f6('0x2b')]);if(_0x45510a['name']){delete _0x45510a[_0x65f6('0x2c')];}_0x2a7aa8[_0x65f6('0x1d')](_0xbaed3c)['send'](_0x45510a);};}exports[_0x65f6('0x2d')]=function(_0x5a740a,_0x2b403b){var _0x50494b={'include':[{'model':db['Pause'],'as':_0x65f6('0x2e')}]},_0x2b9fb6={},_0x24f7fd={'count':0x0,'rows':[]};var _0x13e41a=_[_0x65f6('0x2f')](db['ChatWebsite']['rawAttributes'],function(_0x30109d){return{'name':_0x30109d['fieldName'],'type':_0x30109d[_0x65f6('0x30')]['key']};});_0x2b9fb6[_0x65f6('0x31')]=_[_0x65f6('0x2f')](_0x13e41a,'name');_0x2b9fb6[_0x65f6('0x32')]=_['keys'](_0x5a740a['query']);_0x2b9fb6[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x2b9fb6[_0x65f6('0x31')],_0x2b9fb6[_0x65f6('0x32')]);_0x50494b[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x2b9fb6[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x5a740a['query'][_0x65f6('0x36')]));_0x50494b['attributes']=_0x50494b[_0x65f6('0x35')][_0x65f6('0x37')]?_0x50494b[_0x65f6('0x35')]:_0x2b9fb6[_0x65f6('0x31')];if(!_0x5a740a['query'][_0x65f6('0x38')](_0x65f6('0x39'))){_0x50494b[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x5a740a[_0x65f6('0x32')][_0x65f6('0x1e')]);_0x50494b[_0x65f6('0x21')]=qs[_0x65f6('0x21')](_0x5a740a[_0x65f6('0x32')]['offset']);}_0x50494b[_0x65f6('0x3a')]=qs[_0x65f6('0x3b')](_0x5a740a[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x50494b[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x5a740a[_0x65f6('0x32')],_0x2b9fb6[_0x65f6('0x33')]),_0x13e41a);if(_0x5a740a[_0x65f6('0x32')][_0x65f6('0x3e')]){_0x50494b[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](_0x50494b[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x13e41a,function(_0x2cb38d){if(_0x2cb38d['type']!==_0x65f6('0x40')){var _0x37cd36={};_0x37cd36[_0x2cb38d[_0x65f6('0x2c')]]={'$like':'%'+_0x5a740a[_0x65f6('0x32')]['filter']+'%'};return _0x37cd36;}})});}_0x50494b=_[_0x65f6('0x3f')]({},_0x50494b,_0x5a740a[_0x65f6('0x41')]);var _0x2b01eb={'where':_0x50494b['where']};return db[_0x65f6('0x42')][_0x65f6('0x20')](_0x2b01eb)[_0x65f6('0x12')](function(_0x2179e5){_0x24f7fd['count']=_0x2179e5;if(_0x5a740a[_0x65f6('0x32')]['includeAll']){_0x50494b[_0x65f6('0x43')]=[{'all':!![]}];}return db[_0x65f6('0x42')]['findAll'](_0x50494b);})[_0x65f6('0x12')](function(_0x5085db){_0x24f7fd[_0x65f6('0x44')]=_0x5085db;return _0x24f7fd;})[_0x65f6('0x12')](respondWithFilteredResult(_0x2b403b,_0x50494b))[_0x65f6('0x1b')](handleError(_0x2b403b,null));};exports[_0x65f6('0x45')]=function(_0x3ec18f,_0x3837b2){var _0x4d30c5={'raw':![],'where':{'id':_0x3ec18f[_0x65f6('0x46')]['id']},'include':[{'model':db[_0x65f6('0x47')],'as':_0x65f6('0x2e')}]},_0x51bf6c={};_0x51bf6c[_0x65f6('0x31')]=_[_0x65f6('0x48')](db[_0x65f6('0x42')][_0x65f6('0x49')]);_0x51bf6c[_0x65f6('0x32')]=_[_0x65f6('0x48')](_0x3ec18f['query']);_0x51bf6c[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x51bf6c[_0x65f6('0x31')],_0x51bf6c['query']);_0x4d30c5[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x51bf6c['model'],qs[_0x65f6('0x36')](_0x3ec18f[_0x65f6('0x32')]['fields']));_0x4d30c5[_0x65f6('0x35')]=_0x4d30c5['attributes'][_0x65f6('0x37')]?_0x4d30c5[_0x65f6('0x35')]:_0x51bf6c[_0x65f6('0x31')];if(_0x3ec18f['query'][_0x65f6('0x4a')]){_0x4d30c5[_0x65f6('0x43')]=[{'all':!![]}];}_0x4d30c5=_['merge']({},_0x4d30c5,_0x3ec18f[_0x65f6('0x41')]);return db[_0x65f6('0x42')]['find'](_0x4d30c5)[_0x65f6('0x12')](handleEntityNotFound(_0x3837b2,null))[_0x65f6('0x12')](respondWithResult(_0x3837b2,null))[_0x65f6('0x1b')](handleError(_0x3837b2,null));};exports[_0x65f6('0x4b')]=function(_0x234fa7,_0x2350ca){return db[_0x65f6('0x42')][_0x65f6('0x4b')](_0x234fa7['body'],{})['then'](function(_0x5ca62e){var _0x19f40c=_0x234fa7[_0x65f6('0x4c')][_0x65f6('0x27')]({'plain':!![]});if(!_0x19f40c)throw new Error(_0x65f6('0x4d'));if(_0x19f40c['role']===_0x65f6('0x4c')){var _0x2032b9=_0x5ca62e[_0x65f6('0x27')]({'plain':!![]});var _0x50f63a=_0x65f6('0x28');return db[_0x65f6('0x4e')][_0x65f6('0x4f')]({'where':{'name':_0x50f63a,'userProfileId':_0x19f40c['userProfileId']},'raw':!![]})['then'](function(_0x1d337d){if(_0x1d337d&&_0x1d337d[_0x65f6('0x50')]===0x0){return db[_0x65f6('0x29')][_0x65f6('0x4b')]({'name':_0x2032b9[_0x65f6('0x2c')],'resourceId':_0x2032b9['id'],'type':_0x1d337d[_0x65f6('0x2c')],'sectionId':_0x1d337d['id']},{})[_0x65f6('0x12')](function(){return _0x5ca62e;});}else{return _0x5ca62e;}})[_0x65f6('0x1b')](function(_0x2d8b5b){logger[_0x65f6('0x17')](_0x65f6('0x51'),_0x2d8b5b);throw _0x2d8b5b;});}return _0x5ca62e;})[_0x65f6('0x12')](respondWithResult(_0x2350ca,0xc9))[_0x65f6('0x1b')](handleError(_0x2350ca,null));};exports[_0x65f6('0x25')]=function(_0x5ba9c6,_0x47610a){if(_0x5ba9c6[_0x65f6('0x52')]['id']){delete _0x5ba9c6[_0x65f6('0x52')]['id'];}return db['ChatWebsite'][_0x65f6('0x4f')]({'where':{'id':_0x5ba9c6[_0x65f6('0x46')]['id']},'include':[{'model':db[_0x65f6('0x47')],'as':_0x65f6('0x2e')}]})['then'](handleEntityNotFound(_0x47610a,null))[_0x65f6('0x12')](saveUpdates(_0x5ba9c6[_0x65f6('0x52')],null))[_0x65f6('0x12')](respondWithResult(_0x47610a,null))[_0x65f6('0x1b')](handleError(_0x47610a,null));};exports['destroy']=function(_0x2923ff,_0x2fc20f){return db['ChatWebsite'][_0x65f6('0x4f')]({'where':{'id':_0x2923ff[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x2fc20f,null))['then'](removeEntity(_0x2fc20f,null))[_0x65f6('0x1b')](handleError(_0x2fc20f,null));};exports[_0x65f6('0x53')]=function(_0x3974ef,_0x3c23e3){return db[_0x65f6('0x42')][_0x65f6('0x53')]()['then'](respondWithResult(_0x3c23e3,null))['catch'](handleError(_0x3c23e3,null));};exports['addDisposition']=function(_0x336a7d,_0x367d95){if(_0x336a7d[_0x65f6('0x52')]['id']){delete _0x336a7d[_0x65f6('0x52')]['id'];}return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x336a7d['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x367d95,null))[_0x65f6('0x12')](function(_0x54b569){if(_0x54b569){_0x336a7d[_0x65f6('0x52')][_0x65f6('0x54')]=_0x54b569['id'];return db[_0x65f6('0x55')]['create'](_0x336a7d[_0x65f6('0x52')]);}})[_0x65f6('0x12')](respondWithResult(_0x367d95,null))['catch'](handleError(_0x367d95,null));};exports[_0x65f6('0x56')]=function(_0x3edc6b,_0x1301f5){var _0x417b44={'raw':![],'where':{}};var _0x3d55f7={};var _0x2226bf={'count':0x0,'rows':[]};return db[_0x65f6('0x42')]['findOne']({'where':{'id':_0x3edc6b['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x1301f5,null))[_0x65f6('0x12')](function(_0x4a9524){if(_0x4a9524){_0x3d55f7[_0x65f6('0x31')]=_['keys'](db[_0x65f6('0x55')]['rawAttributes']);_0x3d55f7[_0x65f6('0x32')]=_[_0x65f6('0x48')](_0x3edc6b[_0x65f6('0x32')]);_0x3d55f7[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x3d55f7[_0x65f6('0x31')],_0x3d55f7[_0x65f6('0x32')]);_0x417b44[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x3d55f7['model'],qs['fields'](_0x3edc6b[_0x65f6('0x32')][_0x65f6('0x36')]));_0x417b44[_0x65f6('0x35')]=_0x417b44['attributes']['length']?_0x417b44[_0x65f6('0x35')]:_0x3d55f7[_0x65f6('0x31')];if(!_0x3edc6b[_0x65f6('0x32')][_0x65f6('0x38')](_0x65f6('0x39'))){_0x417b44[_0x65f6('0x1e')]=qs['limit'](_0x3edc6b['query'][_0x65f6('0x1e')]);_0x417b44[_0x65f6('0x21')]=qs['offset'](_0x3edc6b[_0x65f6('0x32')]['offset']);}_0x417b44[_0x65f6('0x3a')]=qs[_0x65f6('0x3b')](_0x3edc6b[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x417b44['where']=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x3edc6b[_0x65f6('0x32')],_0x3d55f7['filters']));_0x417b44['where'][_0x65f6('0x54')]=_0x4a9524['id'];if(_0x3edc6b['query'][_0x65f6('0x3e')]){_0x417b44[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](_0x417b44[_0x65f6('0x3c')],{'$or':_['map'](_0x417b44['attributes'],function(_0x56f7f1){var _0x2e29b4={};_0x2e29b4[_0x56f7f1]={'$like':'%'+_0x3edc6b[_0x65f6('0x32')][_0x65f6('0x3e')]+'%'};return _0x2e29b4;})});}_0x417b44=_['merge']({},_0x417b44,_0x3edc6b[_0x65f6('0x41')]);return db[_0x65f6('0x55')][_0x65f6('0x20')]({'where':_0x417b44['where']})[_0x65f6('0x12')](function(_0x15809e){_0x2226bf['count']=_0x15809e;if(_0x3edc6b[_0x65f6('0x32')][_0x65f6('0x4a')]){_0x417b44['include']=[{'all':!![]}];}return db[_0x65f6('0x55')]['findAll'](_0x417b44);})[_0x65f6('0x12')](function(_0x55ea91){_0x2226bf[_0x65f6('0x44')]=_0x55ea91;return _0x2226bf;});}})[_0x65f6('0x12')](respondWithFilteredResult(_0x1301f5,_0x417b44))['catch'](handleError(_0x1301f5,null));};exports[_0x65f6('0x57')]=function(_0x442e25,_0x2a700b){return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x442e25[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x2a700b,null))[_0x65f6('0x12')](function(_0x31dba0){if(_0x31dba0){return _0x31dba0[_0x65f6('0x57')](_0x442e25[_0x65f6('0x32')]['ids']);}})[_0x65f6('0x12')](respondWithStatusCode(_0x2a700b,null))[_0x65f6('0x1b')](handleError(_0x2a700b,null));};exports[_0x65f6('0x58')]=function(_0x219e42,_0x5694f9){if(_0x219e42[_0x65f6('0x52')]['id']){delete _0x219e42[_0x65f6('0x52')]['id'];}return db['ChatWebsite'][_0x65f6('0x4f')]({'where':{'id':_0x219e42['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x5694f9,null))['then'](function(_0x31f6c1){if(_0x31f6c1){_0x219e42[_0x65f6('0x52')]['ChatWebsiteId']=_0x31f6c1['id'];return db['CannedAnswer'][_0x65f6('0x4b')](_0x219e42[_0x65f6('0x52')]);}})['then'](respondWithResult(_0x5694f9,null))[_0x65f6('0x1b')](handleError(_0x5694f9,null));};exports[_0x65f6('0x59')]=function(_0x73d359,_0x4edba0){var _0x1348ec={'raw':![],'where':{}};var _0x246510={};var _0x5889dc={'count':0x0,'rows':[]};return db[_0x65f6('0x42')]['findOne']({'where':{'id':_0x73d359[_0x65f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x4edba0,null))['then'](function(_0x20687f){if(_0x20687f){_0x246510[_0x65f6('0x31')]=_[_0x65f6('0x48')](db[_0x65f6('0x5a')][_0x65f6('0x49')]);_0x246510[_0x65f6('0x32')]=_[_0x65f6('0x48')](_0x73d359[_0x65f6('0x32')]);_0x246510['filters']=_['intersection'](_0x246510[_0x65f6('0x31')],_0x246510['query']);_0x1348ec[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x246510[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x73d359[_0x65f6('0x32')]['fields']));_0x1348ec[_0x65f6('0x35')]=_0x1348ec[_0x65f6('0x35')][_0x65f6('0x37')]?_0x1348ec['attributes']:_0x246510[_0x65f6('0x31')];if(!_0x73d359[_0x65f6('0x32')][_0x65f6('0x38')](_0x65f6('0x39'))){_0x1348ec[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x73d359['query']['limit']);_0x1348ec[_0x65f6('0x21')]=qs[_0x65f6('0x21')](_0x73d359[_0x65f6('0x32')][_0x65f6('0x21')]);}_0x1348ec['order']=qs['sort'](_0x73d359[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x1348ec[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x73d359[_0x65f6('0x32')],_0x246510['filters']));_0x1348ec['where']['ChatWebsiteId']=_0x20687f['id'];if(_0x73d359[_0x65f6('0x32')][_0x65f6('0x3e')]){_0x1348ec[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](_0x1348ec['where'],{'$or':_['map'](_0x1348ec[_0x65f6('0x35')],function(_0x27e44b){var _0x56077a={};_0x56077a[_0x27e44b]={'$like':'%'+_0x73d359[_0x65f6('0x32')]['filter']+'%'};return _0x56077a;})});}_0x1348ec=_[_0x65f6('0x3f')]({},_0x1348ec,_0x73d359['options']);return db[_0x65f6('0x5a')][_0x65f6('0x20')]({'where':_0x1348ec['where']})[_0x65f6('0x12')](function(_0x330e18){_0x5889dc[_0x65f6('0x20')]=_0x330e18;if(_0x73d359[_0x65f6('0x32')][_0x65f6('0x4a')]){_0x1348ec[_0x65f6('0x43')]=[{'all':!![]}];}return db['CannedAnswer'][_0x65f6('0x5b')](_0x1348ec);})['then'](function(_0x24495c){_0x5889dc['rows']=_0x24495c;return _0x5889dc;});}})[_0x65f6('0x12')](respondWithFilteredResult(_0x4edba0,_0x1348ec))[_0x65f6('0x1b')](handleError(_0x4edba0,null));};exports[_0x65f6('0x5c')]=function(_0x41e59a,_0x535558){return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x41e59a[_0x65f6('0x46')]['id']}})['then'](handleEntityNotFound(_0x535558,null))['then'](function(_0xccd888){if(_0xccd888){return _0xccd888[_0x65f6('0x5c')](_0x41e59a['query'][_0x65f6('0x5d')]);}})[_0x65f6('0x12')](respondWithStatusCode(_0x535558,null))[_0x65f6('0x1b')](handleError(_0x535558,null));};exports['addLogo']=function(_0x2c8938,_0xf1e6a1){_0x2c8938['body'][_0x65f6('0x5e')]=_0x2c8938[_0x65f6('0x5f')][_0x65f6('0x60')];return db['ChatWebsite'][_0x65f6('0x4f')]({'where':{'id':_0x2c8938[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0xf1e6a1,null))['then'](saveUpdates(_0x2c8938[_0x65f6('0x52')],null))['then'](respondWithResult(_0xf1e6a1,null))[_0x65f6('0x1b')](handleError(_0xf1e6a1,null));};exports[_0x65f6('0x61')]=function(_0x31ec61,_0x22be6e){_0x31ec61[_0x65f6('0x52')][_0x65f6('0x62')]=_0x31ec61['file'][_0x65f6('0x60')];return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x31ec61[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x22be6e,null))['then'](saveUpdates(_0x31ec61['body'],null))['then'](respondWithResult(_0x22be6e,null))[_0x65f6('0x1b')](handleError(_0x22be6e,null));};exports[_0x65f6('0x63')]=function(_0xcfc47a,_0x59b715){_0xcfc47a[_0x65f6('0x52')]['customerAvatar']=_0xcfc47a['file'][_0x65f6('0x60')];return db[_0x65f6('0x42')]['find']({'where':{'id':_0xcfc47a[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x59b715,null))[_0x65f6('0x12')](saveUpdates(_0xcfc47a[_0x65f6('0x52')],null))[_0x65f6('0x12')](respondWithResult(_0x59b715,null))[_0x65f6('0x1b')](handleError(_0x59b715,null));};exports[_0x65f6('0x64')]=function(_0x3291ac,_0x477f29){_0x3291ac[_0x65f6('0x52')][_0x65f6('0x65')]=_0x3291ac[_0x65f6('0x5f')]['filename'];return db[_0x65f6('0x42')]['find']({'where':{'id':_0x3291ac['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x477f29,null))[_0x65f6('0x12')](saveUpdates(_0x3291ac[_0x65f6('0x52')],null))[_0x65f6('0x12')](respondWithResult(_0x477f29,null))['catch'](handleError(_0x477f29,null));};exports[_0x65f6('0x66')]=function(_0x565b63,_0x490512){var _0x416ed4=path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x69'));var _0xd893ef={'where':{'id':_0x565b63[_0x65f6('0x46')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x5c8131=![];return require('../../config/license/util')[_0x65f6('0x6a')]()[_0x65f6('0x12')](function(_0x365044){if(_0x365044){_0x5c8131=_0x365044['custom'];}})[_0x65f6('0x12')](function(){return db['ChatWebsite']['find'](_0xd893ef);})[_0x65f6('0x12')](handleEntityNotFound(_0x490512,null))[_0x65f6('0x12')](function(_0x2dbed5){if(_0x2dbed5){if(!_[_0x65f6('0x6b')](_0x2dbed5[_0x65f6('0x5e')])){if(fs['existsSync'](path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x6c'),_0x2dbed5[_0x65f6('0x5e')]))&&_0x5c8131){_0x416ed4=path['join'](config[_0x65f6('0x68')],_0x65f6('0x6c'),_0x2dbed5[_0x65f6('0x5e')]);}}return _0x490512[_0x65f6('0x6d')](_0x416ed4);}})[_0x65f6('0x1b')](handleError(_0x490512,null));};exports[_0x65f6('0x6e')]=function(_0x2f9814,_0x8aab06){var _0x558410=path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x6f'));var _0x8adb47={'where':{'id':_0x2f9814[_0x65f6('0x46')]['id']},'attributes':['id',_0x65f6('0x62')],'raw':!![]};return db['ChatWebsite'][_0x65f6('0x4f')](_0x8adb47)[_0x65f6('0x12')](handleEntityNotFound(_0x8aab06,null))['then'](function(_0x34f1e6){if(_0x34f1e6){if(!_['isNil'](_0x34f1e6[_0x65f6('0x62')])){if(fs[_0x65f6('0x70')](path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x71'),_0x34f1e6['agentAvatar']))){_0x558410=path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x71'),_0x34f1e6[_0x65f6('0x62')]);}}return _0x8aab06[_0x65f6('0x6d')](_0x558410);}})['catch'](handleError(_0x8aab06,null));};exports['getCustomerAvatar']=function(_0x38006c,_0x22a9e7){var _0x2993ee=path[_0x65f6('0x67')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x534004={'where':{'id':_0x38006c[_0x65f6('0x46')]['id']},'attributes':['id',_0x65f6('0x72'),_0x65f6('0x73')],'raw':!![]};return db['ChatWebsite'][_0x65f6('0x4f')](_0x534004)[_0x65f6('0x12')](handleEntityNotFound(_0x22a9e7,null))[_0x65f6('0x12')](function(_0x18c6a8){if(_0x18c6a8){if(!_[_0x65f6('0x6b')](_0x18c6a8['customerAvatar'])){if(fs[_0x65f6('0x70')](path[_0x65f6('0x67')](config['root'],'server/files/images/avatars/',_0x18c6a8[_0x65f6('0x72')]))&&_0x18c6a8[_0x65f6('0x73')]){_0x2993ee=path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x71'),_0x18c6a8['customerAvatar']);}}return _0x22a9e7[_0x65f6('0x6d')](_0x2993ee);}})['catch'](handleError(_0x22a9e7,null));};exports[_0x65f6('0x74')]=function(_0x5d181a,_0x38fcc9){var _0x5cec52=path[_0x65f6('0x67')](config['root'],_0x65f6('0x75'));var _0x3b9aed={'where':{'id':_0x5d181a['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x65f6('0x42')][_0x65f6('0x4f')](_0x3b9aed)[_0x65f6('0x12')](handleEntityNotFound(_0x38fcc9,null))[_0x65f6('0x12')](function(_0x861892){if(_0x861892){if(!_[_0x65f6('0x6b')](_0x861892[_0x65f6('0x65')])){if(fs[_0x65f6('0x70')](path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x71'),_0x861892[_0x65f6('0x65')]))){_0x5cec52=path[_0x65f6('0x67')](config[_0x65f6('0x68')],_0x65f6('0x71'),_0x861892[_0x65f6('0x65')]);}}return _0x38fcc9[_0x65f6('0x6d')](_0x5cec52);}})['catch'](handleError(_0x38fcc9,null));};exports[_0x65f6('0x76')]=function(_0x91d7bf,_0x11bdf3){var _0x16e246=require(_0x65f6('0x77'));var _0x1dbf36=new _0x16e246();var _0x849936=_0x1dbf36[_0x65f6('0x78')](_0x91d7bf[_0x65f6('0x79')]['user-agent'])[_0x65f6('0x7a')]();var _0x585e99={'body':_0x91d7bf[_0x65f6('0x52')],'channel':_0x65f6('0x7b')};var _0x5c2f2c=[];var _0x38db52=[];var _0x39dedf={};var _0x5c7462=![];return db[_0x65f6('0x7c')][_0x65f6('0x53')]()[_0x65f6('0x12')](function(_0x207831){if(!_0x207831){throw new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))]('no\x20available\x20attributes');}_0x5c2f2c=_[_0x65f6('0x7f')](_[_0x65f6('0x48')](_0x207831),[_0x65f6('0x80'),_0x65f6('0x81')]);_0x38db52=_['difference'](_['keys'](_0x207831),['createdAt',_0x65f6('0x81'),_0x65f6('0x82'),_0x65f6('0x83')]);if(_0x91d7bf[_0x65f6('0x52')]['id']){delete _0x91d7bf[_0x65f6('0x52')]['id'];}if(_['isNil'](_0x91d7bf['body'][_0x65f6('0x84')])){throw new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x91d7bf[_0x65f6('0x52')]['body'])||_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x52')]===''){throw new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))](_0x65f6('0x85'));}if(_[_0x65f6('0x6b')](_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x86')])){throw new db[(_0x65f6('0x7d'))]['ValidationError'](_0x65f6('0x87')+_0x38db52);}if(!_[_0x65f6('0x88')](_0x38db52,_0x91d7bf['body'][_0x65f6('0x86')])){throw new db['Sequelize'][(_0x65f6('0x7e'))](_0x65f6('0x89')+_0x38db52);}_0x39dedf[_0x91d7bf[_0x65f6('0x52')]['mapKey']]=_0x91d7bf[_0x65f6('0x52')]['from'];})['then'](function(){return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x91d7bf['params']['id']},'include':[{'model':db[_0x65f6('0x8a')],'as':'List','include':[{'model':db[_0x65f6('0x7c')],'as':_0x65f6('0x8b'),'where':_0x39dedf,'limit':0x1,'order':[[_0x65f6('0x81'),_0x65f6('0x8c')]]}]},{'model':db[_0x65f6('0x8d')],'as':_0x65f6('0x8e')}]});})[_0x65f6('0x12')](handleEntityNotFound(_0x11bdf3,null))[_0x65f6('0x12')](function(_0x5ed6ff){if(_0x5ed6ff&&_0x5ed6ff[_0x65f6('0x8f')]){_0x585e99[_0x65f6('0x90')]=_0x5ed6ff;_0x585e99[_0x65f6('0x91')]=_0x5ed6ff[_0x65f6('0x8e')];_0x585e99[_0x65f6('0x92')]=_0x5ed6ff['List'];_0x585e99[_0x65f6('0x91')]=_['orderBy'](_0x585e99[_0x65f6('0x91')],['priority'],[_0x65f6('0x93')]);if(_0x585e99[_0x65f6('0x90')][_0x65f6('0x8e')]){delete _0x585e99[_0x65f6('0x90')][_0x65f6('0x8e')];}if(_0x585e99[_0x65f6('0x90')][_0x65f6('0x8f')]&&_0x585e99[_0x65f6('0x90')][_0x65f6('0x8f')][_0x65f6('0x8b')][_0x65f6('0x37')]){return _0x585e99[_0x65f6('0x90')][_0x65f6('0x8f')][_0x65f6('0x8b')][0x0];}var _0x37fa08=_[_0x65f6('0x9')](_0x91d7bf[_0x65f6('0x52')],{'firstName':_0x91d7bf['body'][_0x65f6('0x84')],'ListId':_0x5ed6ff['ListId']});_0x37fa08[_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x86')]]=_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x84')];return db[_0x65f6('0x7c')][_0x65f6('0x4b')](_0x37fa08,{'fields':_0x5c2f2c,'raw':!![]});}})['then'](handleEntityNotFound(_0x11bdf3,null))[_0x65f6('0x12')](function(_0x1ac0bd){_0x585e99[_0x65f6('0x94')]=_0x1ac0bd;var _0x359734=_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x95')];if(_0x91d7bf[_0x65f6('0x79')][_0x65f6('0x96')]){_0x359734=_0x91d7bf[_0x65f6('0x79')][_0x65f6('0x96')];}else if(_0x91d7bf[_0x65f6('0x79')]['x-forwarded-for']){_0x359734=_['first'](_0x91d7bf[_0x65f6('0x79')][_0x65f6('0x97')][_0x65f6('0x98')](','));}if(_0x1ac0bd){var _0x179fed={'ContactId':_0x1ac0bd['id'],'ChatWebsiteId':_0x91d7bf[_0x65f6('0x46')]['id'],'from':(_0x1ac0bd[_0x65f6('0x99')]||'')+'\x20'+(_0x1ac0bd[_0x65f6('0x9a')]||''),'customerIp':_0x359734,'customerPort':_0x91d7bf['headers'][_0x65f6('0x9b')]?_0x91d7bf[_0x65f6('0x79')][_0x65f6('0x9b')]:null,'referer':_0x91d7bf[_0x65f6('0x52')][_0x65f6('0x9c')],'browserName':_0x849936[_0x65f6('0x9d')][_0x65f6('0x2c')]&&_0x849936[_0x65f6('0x9d')][_0x65f6('0x9e')]?util[_0x65f6('0x9f')](_0x65f6('0xa0'),_0x849936[_0x65f6('0x9d')][_0x65f6('0x2c')],_0x849936['browser']['version']):'unknown','browserVersion':_0x849936[_0x65f6('0x9d')][_0x65f6('0x9e')]||_0x65f6('0xa1'),'osName':util['format'](_0x65f6('0xa0'),_0x849936['os'][_0x65f6('0x2c')],_0x849936['os'][_0x65f6('0x9e')]),'osVersion':_0x849936['os']['version'],'deviceModel':_0x849936[_0x65f6('0xa2')][_0x65f6('0x31')]&&_0x849936['device'][_0x65f6('0xa3')]?util[_0x65f6('0x9f')](_0x65f6('0xa4'),_0x849936['device'][_0x65f6('0x31')],_0x849936[_0x65f6('0xa2')][_0x65f6('0xa3')],_0x849936[_0x65f6('0xa2')][_0x65f6('0x30')]):null,'deviceVendor':_0x849936[_0x65f6('0xa2')][_0x65f6('0xa3')],'deviceType':_0x849936[_0x65f6('0xa2')][_0x65f6('0x30')],'formData':JSON[_0x65f6('0xa5')](_0x91d7bf['body'])};var _0x43c89e={'ChatWebsiteId':_0x91d7bf[_0x65f6('0x46')]['id'],'closed':![]};if(_0x91d7bf[_0x65f6('0x52')]['threadId']){_0x43c89e['threadId']=_0x91d7bf[_0x65f6('0x52')]['threadId'];return db[_0x65f6('0xa6')][_0x65f6('0x4f')]({'where':_0x43c89e})[_0x65f6('0x12')](function(_0xbf4abe){if(_0xbf4abe){return[_0xbf4abe,![]];}_0x179fed[_0x65f6('0xa7')]=_0x91d7bf['body'][_0x65f6('0xa7')];_0x179fed[_0x65f6('0xa8')]=_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xa8')];return db['ChatInteraction'][_0x65f6('0x4b')](_0x179fed)[_0x65f6('0x12')](function(_0x11d3fb){return[_0x11d3fb,!![]];});});}_0x43c89e[_0x65f6('0xa9')]=_0x1ac0bd['id'];if(_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xaa')]&&_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xaa')]['id']){_0x43c89e['id']=_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xaa')]['id'];return db[_0x65f6('0xa6')][_0x65f6('0x4f')]({'where':_0x43c89e})[_0x65f6('0x12')](function(_0x31e87d){if(_0x31e87d){return[_0x31e87d,![]];}return db[_0x65f6('0xa6')]['create'](_0x179fed)[_0x65f6('0x12')](function(_0x1cca16){return[_0x1cca16,!![]];});});}return db['ChatInteraction']['create'](_0x179fed)[_0x65f6('0x12')](function(_0x7c1efc){return[_0x7c1efc,!![]];});}})[_0x65f6('0xab')](function(_0x2bcdec,_0x21b9ba){if(_0x2bcdec){_0x5c7462=_0x21b9ba;if(!_0x21b9ba){var _0x33e01f={'from':(_0x585e99[_0x65f6('0x94')]['firstName']||'')+'\x20'+(_0x585e99[_0x65f6('0x94')]['lastName']||'')};if(_0x91d7bf['body'][_0x65f6('0xa7')]&&_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xac')]&&_0x91d7bf[_0x65f6('0x52')]['threadId']!=_0x91d7bf['body'][_0x65f6('0xac')]){_0x33e01f[_0x65f6('0xa7')]=_0x91d7bf['body']['messageId'];}return _0x2bcdec['update'](_0x33e01f);}else{return _0x2bcdec;}}})[_0x65f6('0x12')](function(_0x42dc3a){_0x585e99[_0x65f6('0xaa')]=_0x42dc3a[_0x65f6('0x27')]({'plain':!![]});_0x585e99[_0x65f6('0xaa')]['created']=_0x5c7462;if(_0x585e99['interaction'][_0x65f6('0xad')]){if(_0x585e99[_0x65f6('0x90')][_0x65f6('0xae')]){_0x585e99['applications']['push']({'id':0x0,'priority':_0x585e99[_0x65f6('0x91')][_0x65f6('0x37')]+0x1,'app':'close','appdata':_0x65f6('0xaf'),'interval':_0x65f6('0xb0')});}}return db['ChatMessage'][_0x65f6('0x4b')]({'body':_0x91d7bf['body'][_0x65f6('0x52')],'ChatWebsiteId':_0x91d7bf[_0x65f6('0x46')]['id'],'ChatInteractionId':_0x42dc3a['id'],'direction':'in','ContactId':_0x585e99[_0x65f6('0x94')]['id'],'AttachmentId':_0x91d7bf[_0x65f6('0x52')][_0x65f6('0xb1')]});})[_0x65f6('0x12')](function(_0x5ca33e){_0x585e99[_0x65f6('0x19')]=_0x5ca33e;if(_0x585e99[_0x65f6('0xaa')]['UserId']){return db[_0x65f6('0xb2')][_0x65f6('0x4f')]({'attributes':['id',_0x65f6('0x2c')],'where':{'id':_0x585e99['interaction']['UserId']}})[_0x65f6('0x12')](function(_0x2229ae){if(_0x2229ae){_0x585e99[_0x65f6('0x91')][_0x65f6('0xb3')]({'id':0x0,'priority':0x0,'app':_0x65f6('0xb4'),'appdata':_0x2229ae[_0x65f6('0x2c')]+','+(_0x585e99['account']['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0xb0')});_0x585e99[_0x65f6('0xb5')]=!![];}return respondWithRpcPromise(_0x65f6('0xb6'),_0x65f6('0xb7'),_0x585e99);});}return respondWithRpcPromise(_0x65f6('0xb6'),_0x65f6('0xb7'),_0x585e99);})[_0x65f6('0x12')](function(_0x4146df){respondWithRpcPromise(_0x65f6('0xb8'),_0x65f6('0xb8'),{'event':_0x65f6('0x76'),'message':_0x4146df},client9002);return _0x4146df;})[_0x65f6('0x12')](respondWithResult(_0x11bdf3,null))['catch'](handleError(_0x11bdf3,null));};exports[_0x65f6('0xb9')]=function(_0x3d2328,_0x21a8c9){var _0x101050,_0x3be8bc,_0x385d13;var _0xd00f2f=[];var _0x868a4f={};var _0x2820b3=_0x3d2328[_0x65f6('0xba')]||[];var _0x591fcd=[];var _0x4dfda4;return db[_0x65f6('0x7c')][_0x65f6('0x53')]()['then'](function(_0x1db7e4){if(!_0x1db7e4){throw new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))]('no\x20available\x20attributes');}_0xd00f2f=_['difference'](_[_0x65f6('0x48')](_0x1db7e4),[_0x65f6('0x80'),_0x65f6('0x81'),_0x65f6('0x82'),_0x65f6('0x83')]);if(_0x3d2328[_0x65f6('0x52')]['id']){delete _0x3d2328[_0x65f6('0x52')]['id'];}if(_[_0x65f6('0x6b')](_0x3d2328[_0x65f6('0x52')][_0x65f6('0x84')])){throw _0x21a8c9[_0x65f6('0x1d')](0x1f4)[_0x65f6('0xbb')](new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))](_0x65f6('0xbc')));}if(_[_0x65f6('0x6b')](_0x3d2328[_0x65f6('0x52')][_0x65f6('0x52')])||_0x3d2328['body'][_0x65f6('0x52')]===''){throw _0x21a8c9[_0x65f6('0x1d')](0x1f4)[_0x65f6('0xbb')](new db[(_0x65f6('0x7d'))]['ValidationError'](_0x65f6('0x85')));}if(_['isNil'](_0x3d2328[_0x65f6('0x52')][_0x65f6('0xbd')])){throw _0x21a8c9[_0x65f6('0x1d')](0x1f4)[_0x65f6('0xbb')](new db[(_0x65f6('0x7d'))]['ValidationError'](_0x65f6('0xbe')+_0xd00f2f));}if(!_['includes'](_0xd00f2f,_0x3d2328['body']['mapKeyOffline'])){throw _0x21a8c9[_0x65f6('0x1d')](0x1f4)['send'](new db[(_0x65f6('0x7d'))][(_0x65f6('0x7e'))](_0x65f6('0xbf')+_0xd00f2f));}_0x868a4f[_0x3d2328[_0x65f6('0x52')][_0x65f6('0xbd')]]=_0x3d2328[_0x65f6('0x52')][_0x65f6('0x84')];})[_0x65f6('0x12')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x3d2328[_0x65f6('0x46')]['id']},'include':[{'model':db[_0x65f6('0x8a')],'as':'List'},{'model':db[_0x65f6('0xc0')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x21a8c9,null))[_0x65f6('0x12')](function(_0x74f19d){if(_0x74f19d&&_0x74f19d[_0x65f6('0x8f')]){_0x3be8bc=_0x74f19d;var _0x1050c7=_[_0x65f6('0x9')](_0x3d2328['body'],{'firstName':_0x3d2328[_0x65f6('0x52')]['from'],'phone':_0x3d2328[_0x65f6('0x52')]['from'],'ListId':_0x74f19d['ListId']});_0x1050c7[_0x3d2328[_0x65f6('0x52')][_0x65f6('0xbd')]]=_0x3d2328[_0x65f6('0x52')][_0x65f6('0x84')];return db[_0x65f6('0x7c')][_0x65f6('0xc1')]({'where':_0x868a4f,'defaults':_0x1050c7});}})[_0x65f6('0xab')](function(_0x2ff0f5){if(_0x2ff0f5){_0x385d13=_0x2ff0f5;var _0x504520=fs[_0x65f6('0xc2')](path['join'](config[_0x65f6('0x68')],_0x65f6('0xc3')),_0x65f6('0xc4'));var _0x588b38=ejs[_0x65f6('0xc5')](_0x504520,{'body':_[_0x65f6('0xc6')](_0x3d2328['body'][_0x65f6('0x52')]),'bodyTitle':_0x3be8bc[_0x65f6('0xc7')]});return db[_0x65f6('0xc8')][_0x65f6('0x4b')]({'body':_0x588b38,'plainBody':htmlToText[_0x65f6('0xc9')](_0x588b38),'ContactId':_0x2ff0f5['id'],'ChatWebsiteId':_0x3be8bc['id']});}})['then'](function(_0x428a19){_0x4dfda4=_0x428a19;if(_0x2820b3[_0x65f6('0x37')]){var _0x410442=_0x2820b3['map'](function(_0x4c1149){return{'name':_0x4c1149[_0x65f6('0xca')],'basename':_0x4c1149[_0x65f6('0x60')],'type':_0x4c1149[_0x65f6('0xcb')],'ChatOfflineMessageId':_0x428a19['id']};});_0x591fcd=_0x410442[_0x65f6('0x2f')](_0x3d1df9=>{var _0x5b4033={'filename':_0x3d1df9['name'],'path':path['join'](config[_0x65f6('0x68')],_0x65f6('0xcc'),'files','attachments','offline-chat',_0x3d1df9[_0x65f6('0xcd')])};return _0x5b4033;});if(!_0x3be8bc[_0x65f6('0xce')]){return db[_0x65f6('0xcf')][_0x65f6('0xd0')](function(_0x1be461){return db[_0x65f6('0xd1')][_0x65f6('0xd2')](_0x410442,{'transaction':_0x1be461});});}}})[_0x65f6('0x12')](function(){if(_0x4dfda4){_0x101050=_0x4dfda4;return db[_0x65f6('0xc0')][_0x65f6('0xd3')]({'where':{'active':!![]},'include':[{'model':db[_0x65f6('0xd4')],'as':_0x65f6('0xd5'),'raw':!![]}]});}})[_0x65f6('0x12')](function(_0x62136d){if(_0x62136d&&_0x62136d[_0x65f6('0xd5')]&&_0x3be8bc['forwardOffline']&&_0x3be8bc[_0x65f6('0xd6')]){var _0x1979c2={'tls':{'rejectUnauthorized':![]}};if(_0x62136d[_0x65f6('0xd5')][_0x65f6('0xd7')]){_0x1979c2[_0x65f6('0xd7')]=_0x62136d[_0x65f6('0xd5')]['service'];}else{_0x1979c2[_0x65f6('0xd8')]=_0x62136d[_0x65f6('0xd5')]['host'];_0x1979c2['port']=_0x62136d[_0x65f6('0xd5')]['port'];_0x1979c2['secure']=_0x62136d[_0x65f6('0xd5')][_0x65f6('0xd9')];}if(_0x62136d['Smtp'][_0x65f6('0xda')]){_0x1979c2[_0x65f6('0xdb')]={'user':_0x62136d['Smtp'][_0x65f6('0x4c')],'pass':_0x62136d[_0x65f6('0xd5')][_0x65f6('0xdc')]};}return respondWithRpcPromise(_0x65f6('0xdd'),_0x65f6('0xde'),{'account':_0x1979c2,'message':{'from':util[_0x65f6('0x9f')](_0x65f6('0xdf'),_0x62136d[_0x65f6('0x2c')],_0x62136d[_0x65f6('0xe0')]||_0x62136d['Smtp'][_0x65f6('0x4c')]),'to':_0x3be8bc[_0x65f6('0xd6')],'subject':_0x3be8bc[_0x65f6('0xe1')],'html':_0x101050[_0x65f6('0x52')],'attachments':_0x591fcd}},client9003)[_0x65f6('0x12')](function(){return _0x101050;})[_0x65f6('0x1b')](function(_0x4e4726){console[_0x65f6('0x17')](_0x4e4726);});}})['then'](function(){if(_0x3be8bc&&_0x3be8bc['openNewInteraction']&&_0x3be8bc['MailAccountId']){var _0x3f770a=[];if(_0x2820b3['length']){_0x3f770a=_0x2820b3[_0x65f6('0x2f')](function(_0x408f37){return{'name':_0x408f37[_0x65f6('0xca')],'basename':_0x408f37[_0x65f6('0x60')],'type':_0x408f37[_0x65f6('0xcb')],'ChatOfflineMessageId':_0x4dfda4['id']};});}var _0x355476;if(!_[_0x65f6('0x6b')](_0x3be8bc['subjectOffline'])){var _0x5db63d=_[_0x65f6('0x2f')](_0x3d2328[_0x65f6('0x52')],function(_0x11edd6){return _0x11edd6;});var _0x4bb32e=_[_0x65f6('0xe2')](_0x5db63d)[0x0];var _0x5d8c8e=_[_0x65f6('0xe3')](_0x4bb32e,function(_0x2b1dfc){return _0x2b1dfc;});_0x355476=_0x5d8c8e[0x1][_0x3be8bc[_0x65f6('0xe4')]];}var _0x4b920a={'from':_0x385d13[_0x65f6('0xe0')],'firstName':_0x385d13[_0x65f6('0x99')],'lastName':_0x385d13[_0x65f6('0x9a')],'mapKey':_0x65f6('0xe0'),'message':{'from':_0x385d13['email'],'to':_0x3be8bc['MailAccount'][_0x65f6('0xe0')],'cc':'','subject':_['isNil'](_0x355476)?_0x3be8bc[_0x65f6('0xe1')]:_0x355476,'messageId':'','sentAt':new Date(),'attach':_0x3f770a['length'],'attachments':_0x3f770a,'originChannel':_0x65f6('0xe5'),'ChatWebsiteId':_0x3be8bc['id'],'ChatOfflineMessageId':_0x101050['id'],'originTo':_0x3be8bc[_0x65f6('0xc0')][_0x65f6('0xe0')]},'body':_0x101050['body']};var _0x3225b6={'account':{'id':_0x3be8bc[_0x65f6('0xe6')]},'body':_0x4b920a,'log':_0x65f6('0xe7')};return respondWithRpcPromise(_0x65f6('0xe7'),_0x65f6('0xe8'),_0x3225b6,client9001)[_0x65f6('0x12')](function(){return _0x101050;})[_0x65f6('0x1b')](function(_0x4e40d4){console[_0x65f6('0x17')](_0x4e40d4);});}return;})[_0x65f6('0x12')](function(){if(_0x101050){return _0x101050;}})[_0x65f6('0x12')](respondWithResult(_0x21a8c9,null))[_0x65f6('0x1b')](function(_0x72ac02){console[_0x65f6('0x17')](_0x65f6('0x1b'),_0x72ac02);for(var _0xe52598 of _0x2820b3){var _0x1790e4=path['join'](config[_0x65f6('0x68')],'server',_0x65f6('0xba'),_0x65f6('0xe9'),_0x65f6('0xea'),_0xe52598[_0x65f6('0x60')]);fs_extra[_0x65f6('0xeb')](_0x1790e4)[_0x65f6('0x1b')](function(_0x4684ab){console[_0x65f6('0x17')](_0x65f6('0xec'),_0x1790e4,_0x4684ab);});}});};exports[_0x65f6('0xed')]=function(_0x148993,_0x38e6ff){return db[_0x65f6('0xa6')][_0x65f6('0x4f')]({'where':{'id':_0x148993[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x38e6ff,null))[_0x65f6('0x12')](function(_0x560dbb){if(_0x560dbb){return _0x560dbb[_0x65f6('0xed')](_0x148993[_0x65f6('0x52')]['ids'],_[_0x65f6('0xee')](_0x148993[_0x65f6('0x52')],[_0x65f6('0x5d'),'id'])||{});}})[_0x65f6('0x12')](respondWithResult(_0x38e6ff,null))[_0x65f6('0x1b')](handleError(_0x38e6ff,null));};exports[_0x65f6('0xef')]=function(_0x4adb7a,_0x492c89){var _0x409127={'raw':![],'where':{}};var _0x2c0165={};var _0xd11998={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x65f6('0xd3')]({'where':{'id':_0x4adb7a['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x492c89,null))[_0x65f6('0x12')](function(_0x1c8b2e){if(_0x1c8b2e){_0x2c0165[_0x65f6('0x31')]=_['keys'](db[_0x65f6('0xa6')]['rawAttributes']);_0x2c0165[_0x65f6('0x32')]=_[_0x65f6('0x48')](_0x4adb7a[_0x65f6('0x32')]);_0x2c0165['filters']=_[_0x65f6('0x34')](_0x2c0165['model'],_0x2c0165['query']);_0x409127[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x2c0165[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x4adb7a[_0x65f6('0x32')][_0x65f6('0x36')]));_0x409127[_0x65f6('0x35')]=_0x409127[_0x65f6('0x35')][_0x65f6('0x37')]?_0x409127[_0x65f6('0x35')]:_0x2c0165[_0x65f6('0x31')];if(!_0x4adb7a['query'][_0x65f6('0x38')]('nolimit')){_0x409127[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x4adb7a['query'][_0x65f6('0x1e')]);_0x409127[_0x65f6('0x21')]=qs['offset'](_0x4adb7a['query'][_0x65f6('0x21')]);}_0x409127['order']=qs['sort'](_0x4adb7a[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x409127[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x4adb7a[_0x65f6('0x32')],_0x2c0165[_0x65f6('0x33')]));_0x409127[_0x65f6('0x3c')][_0x65f6('0x54')]=_0x1c8b2e['id'];if(_0x4adb7a['query'][_0x65f6('0x3e')]){_0x409127[_0x65f6('0x3c')]=_['merge'](_0x409127[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x409127[_0x65f6('0x35')],function(_0xcf934){var _0x73732f={};_0x73732f[_0xcf934]={'$like':'%'+_0x4adb7a[_0x65f6('0x32')]['filter']+'%'};return _0x73732f;})});}_0x409127=_['merge']({},_0x409127,_0x4adb7a[_0x65f6('0x41')]);return db[_0x65f6('0xa6')][_0x65f6('0x20')]({'where':_0x409127[_0x65f6('0x3c')]})[_0x65f6('0x12')](function(_0x4cee07){_0xd11998[_0x65f6('0x20')]=_0x4cee07;if(_0x4adb7a[_0x65f6('0x32')][_0x65f6('0x4a')]){_0x409127[_0x65f6('0x43')]=[{'model':db[_0x65f6('0x7c')],'as':_0x65f6('0xf0'),'required':![]},{'model':db[_0x65f6('0xb2')],'as':_0x65f6('0xf1'),'attributes':[_0x65f6('0x2c'),_0x65f6('0xf2'),_0x65f6('0xf3')],'required':![]},{'model':db['Tag'],'as':_0x65f6('0xf4'),'attributes':['id',_0x65f6('0x2c'),'color'],'where':_0x4adb7a['query'][_0x65f6('0xf5')]?{'id':_0x4adb7a[_0x65f6('0x32')][_0x65f6('0xf5')]}:undefined,'required':_0x4adb7a['query'][_0x65f6('0xf5')]?!![]:![]}];}return db[_0x65f6('0xa6')][_0x65f6('0x5b')](_0x409127);})[_0x65f6('0x12')](function(_0xf29979){_0xd11998[_0x65f6('0x44')]=_0xf29979;return _0xd11998;});}})[_0x65f6('0x12')](respondWithFilteredResult(_0x492c89,_0x409127))['catch'](handleError(_0x492c89,null));};function iftimePromise(_0xacdf06,_0x58f7a8){return respondWithRpcPromise(_0x65f6('0xf6'),_0x65f6('0xf7'),{'command':_0x58f7a8[_0x65f6('0xf8')]?util[_0x65f6('0x9f')](_0x65f6('0xf9'),_0xacdf06[_0x65f6('0xfa')],_0x58f7a8['timezone']):util[_0x65f6('0x9f')]('iftime\x20%s',_0xacdf06[_0x65f6('0xfa')])},client9002)['then'](function(_0x32829e){var _0x5258a4=_0x32829e&&_0x32829e[_0x65f6('0xfb')](_0x65f6('0xfc'))>=0x0?!![]:![];logger[_0x65f6('0x13')](_0x65f6('0xfd'),_0x58f7a8['id'],_0xacdf06['id'],_0xacdf06['interval'],_0x5258a4?_0x65f6('0xfe'):_0x65f6('0xff'),_0x58f7a8[_0x65f6('0xf8')]?_0x58f7a8[_0x65f6('0xf8')]:_0x65f6('0x100'));return _0x5258a4;})[_0x65f6('0x1b')](function(_0xd06566){logger[_0x65f6('0x17')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x58f7a8['id'],_0xacdf06['id'],_0xacdf06['interval'],util[_0x65f6('0x101')](_0xd06566,{'showHidden':![],'depth':null}),_0x58f7a8[_0x65f6('0xf8')]?_0x58f7a8[_0x65f6('0xf8')]:_0x65f6('0x100'));return![];});}exports['getSnippet']=function(_0x1a25ae,_0x1e1498){var _0x4c63f9=0x0;var _0x13f4a5=0x0;var _0x4315c1=![];var _0x141d13;var _0x575f14;return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0x1a25ae['params']['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x65f6('0x102')],'as':_0x65f6('0x103'),'attributes':['id',_0x65f6('0xfa')],'raw':!![]}]}]})[_0x65f6('0x12')](handleEntityNotFound(_0x1e1498,null))[_0x65f6('0x12')](function(_0x39bea9){if(_0x39bea9){_0x141d13=_0x39bea9;return _0x39bea9[_0x65f6('0x104')]({'raw':!![]});}})[_0x65f6('0x12')](function(_0x270944){if(_0x141d13){if(_0x270944){_0x575f14=_0x270944;}}return require(_0x65f6('0x105'))[_0x65f6('0x6a')]();})[_0x65f6('0x12')](function(_0x2a0aab){if(_0x2a0aab){_0x13f4a5=_0x2a0aab[_0x65f6('0x106')];_0x4315c1=_0x2a0aab[_0x65f6('0x107')];}})[_0x65f6('0x12')](function(){return db[_0x65f6('0xa6')][_0x65f6('0x20')]({'where':{'closed':![]}});})['then'](function(_0x4345af){_0x4c63f9=_0x4345af;if(_0x13f4a5&&_0x4345af>_0x13f4a5){return db[_0x65f6('0x108')]['findOne']({'where':{'id':0x1}})['then'](function(_0x23709a){if(_0x23709a){_0x23709a[_0x65f6('0x109')](_0x65f6('0x10a'));}});}})[_0x65f6('0x12')](function(){if(_0x141d13['Interval']&&_0x141d13['Interval'][_0x65f6('0x103')]){var _0x5dc205=[];for(var _0xd2313b=0x0;_0xd2313b<_0x141d13[_0x65f6('0x102')]['Intervals']['length'];_0xd2313b++){var _0x408e74=_0x141d13[_0x65f6('0x102')][_0x65f6('0x103')][_0xd2313b][_0x65f6('0x27')]({'plain':!![]});_0x5dc205['push'](iftimePromise(_0x408e74,_0x141d13));}return BPromise[_0x65f6('0x10b')](_0x5dc205)['then'](function(_0x34542c){return _[_0x65f6('0x10c')](_0x34542c);});}else{return!![];}})[_0x65f6('0x12')](function(_0x2ab4ac){var _0x4bc08e=fs[_0x65f6('0xc2')](path['join'](config[_0x65f6('0x68')],'server/files/chat/iframe.ejs'),'utf8');var _0x38de54={'remote':_0x141d13['remote'],'query':querystring[_0x65f6('0xa5')](_[_0x65f6('0x3f')](_0x141d13[_0x65f6('0x27')]({'plain':!![]}),{'customerIp':_0x1a25ae[_0x65f6('0x79')][_0x65f6('0x97')]||_0x1a25ae[_0x65f6('0x79')][_0x65f6('0x10d')]||_0x1a25ae[_0x65f6('0x10e')][_0x65f6('0x10f')]||_0x1a25ae['ip'],'referer':_0x1a25ae['headers'][_0x65f6('0x9c')],'openedInteractions':_0x4c63f9,'maxInteractions':_0x13f4a5,'virtual':_0x4315c1[_0x65f6('0x106')],'online':_0x2ab4ac,'custom':_0x4315c1}))[_0x65f6('0x110')](/'/g,'\x5c\x27')};_0x1e1498[_0x65f6('0xbb')](ejs['render'](Mustache[_0x65f6('0xc5')](_0x4bc08e,_0x38de54),{'proactiveActions':_0x575f14,'alignment':_0x141d13[_0x65f6('0x111')],'verticalAlignment':_0x141d13['verticalAlignment'],'div_color':_0x141d13[_0x65f6('0x112')],'labelText':_0x141d13[_0x65f6('0x113')],'text_color':_0x141d13[_0x65f6('0x114')],'button_color':_0x141d13[_0x65f6('0x115')],'background_color':_0x141d13[_0x65f6('0x116')]}));})[_0x65f6('0x1b')](handleError(_0x1e1498,null));};exports[_0x65f6('0x117')]=function(_0x112db7,_0x313634){var _0x1779de=_0x112db7[_0x65f6('0x46')]['id'];var _0x4b1ec2=_0x112db7[_0x65f6('0x52')];var _0x533902=0xc8;var _0x3bee71=null;return db['sequelize'][_0x65f6('0xd0')]({'isolationLevel':db[_0x65f6('0xcf')][_0x65f6('0x118')]['ISOLATION_LEVELS'][_0x65f6('0x119')]},function(_0x34ec6b){return db['ChatWebsite'][_0x65f6('0xd3')]({'where':{'id':_0x1779de},'transaction':_0x34ec6b})[_0x65f6('0x12')](function(_0xff9e69){if(_0xff9e69){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x1779de},'transaction':_0x34ec6b})['then'](function(){var _0x4eec1f=_[_0x65f6('0x2f')](_0x4b1ec2,function(_0x14417a){_0x14417a[_0x65f6('0x54')]=_0x1779de;return _0x14417a;});return db[_0x65f6('0x8d')][_0x65f6('0xd2')](_0x4eec1f,{'transaction':_0x34ec6b});});}else{_0x533902=0x194;_0x3bee71=[];}});})[_0x65f6('0x12')](function(){if(_0x533902!==0x194){return db[_0x65f6('0x8d')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x1779de},'order':_0x65f6('0x11a')})[_0x65f6('0x12')](function(_0x212333){_0x3bee71=_0x212333;});}})[_0x65f6('0x1b')](function(_0x4dbf35){_0x533902=0x1f4;logger[_0x65f6('0x17')](_0x4dbf35['stack']);if(_0x4dbf35[_0x65f6('0x2c')]){delete _0x4dbf35[_0x65f6('0x2c')];}_0x3bee71=_0x4dbf35;})['finally'](function(){if(_0x3bee71===null){_0x313634['sendStatus'](_0x533902);}else{if(_0x533902===0x1f4){_0x313634[_0x65f6('0x1d')](_0x533902)[_0x65f6('0xbb')](_0x3bee71);}else{_0x313634['status'](_0x533902)['json'](_0x3bee71);}}});};exports[_0x65f6('0x11b')]=function(_0x41ee46,_0xa54e78){var _0x31a57d={};var _0x3177f6={};var _0x142593;var _0x2d8fcc;return db[_0x65f6('0x42')][_0x65f6('0xd3')]({'where':{'id':_0x41ee46[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0xa54e78,null))[_0x65f6('0x12')](function(_0x1556ab){if(_0x1556ab){_0x142593=_0x1556ab;_0x3177f6[_0x65f6('0x31')]=_[_0x65f6('0x48')](db[_0x65f6('0x8d')]['rawAttributes']);_0x3177f6['query']=_[_0x65f6('0x48')](_0x41ee46[_0x65f6('0x32')]);_0x3177f6[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x3177f6[_0x65f6('0x31')],_0x3177f6[_0x65f6('0x32')]);_0x31a57d[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x3177f6[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x41ee46['query'][_0x65f6('0x36')]));_0x31a57d['attributes']=_0x31a57d['attributes'][_0x65f6('0x37')]?_0x31a57d[_0x65f6('0x35')]:_0x3177f6[_0x65f6('0x31')];_0x31a57d[_0x65f6('0x3a')]=qs['sort'](_0x41ee46[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x31a57d[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x41ee46[_0x65f6('0x32')],_0x3177f6[_0x65f6('0x33')]));if(_0x41ee46[_0x65f6('0x32')][_0x65f6('0x3e')]){_0x31a57d[_0x65f6('0x3c')]=_['merge'](_0x31a57d['where'],{'$or':_[_0x65f6('0x2f')](_0x31a57d[_0x65f6('0x35')],function(_0x457fa8){var _0x15f247={};_0x15f247[_0x457fa8]={'$like':'%'+_0x41ee46[_0x65f6('0x32')][_0x65f6('0x3e')]+'%'};return _0x15f247;})});}_0x31a57d=_[_0x65f6('0x3f')]({},_0x31a57d,_0x41ee46[_0x65f6('0x41')]);return _0x142593['getApplications'](_0x31a57d);}})['then'](function(_0x1ebe7e){if(_0x1ebe7e){_0x2d8fcc=_0x1ebe7e[_0x65f6('0x37')];if(!_0x41ee46['query'][_0x65f6('0x38')](_0x65f6('0x39'))){_0x31a57d[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x41ee46[_0x65f6('0x32')][_0x65f6('0x1e')]);_0x31a57d['offset']=qs[_0x65f6('0x21')](_0x41ee46[_0x65f6('0x32')]['offset']);}return _0x142593['getApplications'](_0x31a57d);}})[_0x65f6('0x12')](function(_0x3743eb){if(_0x3743eb){return _0x3743eb?{'count':_0x2d8fcc,'rows':_0x3743eb}:null;}})[_0x65f6('0x12')](respondWithResult(_0xa54e78,null))[_0x65f6('0x1b')](handleError(_0xa54e78,null));};exports[_0x65f6('0x11c')]=function(_0x3dd349,_0x4c7b0a){return db['chatProactiveAction'][_0x65f6('0x4f')]({'where':{'id':_0x3dd349[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x4c7b0a,null))['then'](function(_0x25684b){if(_0x25684b){return _0x25684b[_0x65f6('0x11c')](_0x3dd349[_0x65f6('0x52')]['ids'],_[_0x65f6('0xee')](_0x3dd349[_0x65f6('0x52')],[_0x65f6('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x4c7b0a,null))[_0x65f6('0x1b')](handleError(_0x4c7b0a,null));};exports[_0x65f6('0x104')]=function(_0x1ad645,_0x3b062b){var _0x2c1a02={};var _0x15bdd2={};var _0x20fbe4;var _0x4316bc;return db[_0x65f6('0x42')][_0x65f6('0xd3')]({'where':{'id':_0x1ad645['params']['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x3b062b,null))['then'](function(_0x2086ce){if(_0x2086ce){_0x20fbe4=_0x2086ce;_0x15bdd2['model']=_['keys'](db[_0x65f6('0x11d')][_0x65f6('0x49')]);_0x15bdd2['query']=_[_0x65f6('0x48')](_0x1ad645[_0x65f6('0x32')]);_0x15bdd2[_0x65f6('0x33')]=_[_0x65f6('0x34')](_0x15bdd2[_0x65f6('0x31')],_0x15bdd2['query']);_0x2c1a02['attributes']=_['intersection'](_0x15bdd2[_0x65f6('0x31')],qs['fields'](_0x1ad645[_0x65f6('0x32')][_0x65f6('0x36')]));_0x2c1a02[_0x65f6('0x35')]=_0x2c1a02[_0x65f6('0x35')][_0x65f6('0x37')]?_0x2c1a02[_0x65f6('0x35')]:_0x15bdd2[_0x65f6('0x31')];_0x2c1a02['order']=qs['sort'](_0x1ad645['query'][_0x65f6('0x3b')]);_0x2c1a02[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x1ad645['query'],_0x15bdd2[_0x65f6('0x33')]));if(_0x1ad645['query']['filter']){_0x2c1a02[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](_0x2c1a02['where'],{'$or':_[_0x65f6('0x2f')](_0x2c1a02[_0x65f6('0x35')],function(_0xb4e1c5){var _0x390553={};_0x390553[_0xb4e1c5]={'$like':'%'+_0x1ad645['query']['filter']+'%'};return _0x390553;})});}_0x2c1a02=_[_0x65f6('0x3f')]({},_0x2c1a02,_0x1ad645[_0x65f6('0x41')]);return _0x20fbe4['getProactiveActions'](_0x2c1a02);}})[_0x65f6('0x12')](function(_0x13ecb8){if(_0x13ecb8){_0x4316bc=_0x13ecb8[_0x65f6('0x37')];if(!_0x1ad645[_0x65f6('0x32')][_0x65f6('0x38')](_0x65f6('0x39'))){_0x2c1a02[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x1ad645[_0x65f6('0x32')]['limit']);_0x2c1a02[_0x65f6('0x21')]=qs[_0x65f6('0x21')](_0x1ad645[_0x65f6('0x32')][_0x65f6('0x21')]);}return _0x20fbe4['getProactiveActions'](_0x2c1a02);}})['then'](function(_0x2c6cca){if(_0x2c6cca){return _0x2c6cca?{'count':_0x4316bc,'rows':_0x2c6cca}:null;}})['then'](respondWithResult(_0x3b062b,null))[_0x65f6('0x1b')](handleError(_0x3b062b,null));};exports[_0x65f6('0x11e')]=function(_0x3d46d4,_0xf51395){var _0x5b3abc=_0x3d46d4[_0x65f6('0x32')]['online']===_0x65f6('0x11f')?_0x65f6('0x120'):'onlineForm';return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'attributes':['id',_0x5b3abc],'where':{'id':_0x3d46d4[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0xf51395,null))[_0x65f6('0x12')](function(_0x9c768){if(_0x9c768){var _0x5b2cc1=_0x9c768[_0x5b3abc];var _0x62830b=_0x5b2cc1&&_0x5b2cc1['items']?_0x5b2cc1[_0x65f6('0x121')]:[];_0xf51395['send']({'fromKey':_[_0x65f6('0x6b')](_0x5b2cc1[_0x65f6('0x122')])?undefined:_0x5b2cc1['fromKey'],'count':_0x62830b[_0x65f6('0x37')],'rows':_0x62830b});}})[_0x65f6('0x1b')](handleError(_0xf51395,null));};exports['getOfflineMessages']=function(_0x42ad46,_0x4dd517){var _0x2dcf79={'raw':![],'where':{}};var _0x333da7={};var _0x10c466={'count':0x0,'rows':[]};return db[_0x65f6('0x42')][_0x65f6('0xd3')]({'where':{'id':_0x42ad46[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x4dd517,null))[_0x65f6('0x12')](function(_0x1c9d56){if(_0x1c9d56){_0x333da7[_0x65f6('0x31')]=_[_0x65f6('0x48')](db[_0x65f6('0xc8')][_0x65f6('0x49')]);_0x333da7[_0x65f6('0x32')]=_[_0x65f6('0x48')](_0x42ad46[_0x65f6('0x32')]);_0x333da7['filters']=_[_0x65f6('0x34')](_0x333da7[_0x65f6('0x31')],_0x333da7['query']);_0x2dcf79[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0x333da7[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x42ad46[_0x65f6('0x32')][_0x65f6('0x36')]));_0x2dcf79[_0x65f6('0x35')]=_0x2dcf79[_0x65f6('0x35')][_0x65f6('0x37')]?_0x2dcf79[_0x65f6('0x35')]:_0x333da7['model'];if(!_0x42ad46['query'][_0x65f6('0x38')](_0x65f6('0x39'))){_0x2dcf79['limit']=qs[_0x65f6('0x1e')](_0x42ad46[_0x65f6('0x32')][_0x65f6('0x1e')]);_0x2dcf79[_0x65f6('0x21')]=qs[_0x65f6('0x21')](_0x42ad46['query']['offset']);}_0x2dcf79['order']=qs[_0x65f6('0x3b')](_0x42ad46[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x2dcf79[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_['pick'](_0x42ad46[_0x65f6('0x32')],_0x333da7['filters']));_0x2dcf79[_0x65f6('0x3c')][_0x65f6('0x54')]=_0x1c9d56['id'];if(_0x42ad46[_0x65f6('0x32')]['filter']){_0x2dcf79[_0x65f6('0x3c')]=_['merge'](_0x2dcf79[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x2dcf79['attributes'],function(_0x230125){var _0xe75255={};_0xe75255[_0x230125]={'$like':'%'+_0x42ad46['query'][_0x65f6('0x3e')]+'%'};return _0xe75255;})});}_0x2dcf79=_[_0x65f6('0x3f')]({},_0x2dcf79,_0x42ad46[_0x65f6('0x41')]);return db[_0x65f6('0xc8')][_0x65f6('0x20')]({'where':_0x2dcf79['where']})[_0x65f6('0x12')](function(_0x4416b4){_0x10c466['count']=_0x4416b4;if(_0x42ad46[_0x65f6('0x32')][_0x65f6('0x4a')]){_0x2dcf79['include']=[{'all':!![]}];}else{_0x2dcf79['include']=[{'model':db[_0x65f6('0x7c')],'as':'Contact','required':![]},{'model':db[_0x65f6('0xd1')],'as':_0x65f6('0x123'),'required':![]}];}return db[_0x65f6('0xc8')][_0x65f6('0x5b')](_0x2dcf79);})[_0x65f6('0x12')](function(_0x2e36c8){_0x10c466[_0x65f6('0x44')]=_0x2e36c8;return _0x10c466;});}})[_0x65f6('0x12')](respondWithFilteredResult(_0x4dd517,_0x2dcf79))[_0x65f6('0x1b')](handleError(_0x4dd517,null));};exports[_0x65f6('0x124')]=function(_0x52556c,_0x4665ec){return db['ChatWebsite'][_0x65f6('0x4f')]({'where':{'id':_0x52556c[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x4665ec,null))[_0x65f6('0x12')](function(_0x57c109){if(_0x57c109){return _0x57c109['addAgents'](_0x52556c[_0x65f6('0x52')][_0x65f6('0x5d')],_[_0x65f6('0xee')](_0x52556c[_0x65f6('0x52')],[_0x65f6('0x5d'),'id'])||{})[_0x65f6('0xab')](function(_0x5052d0){for(var _0x5dcfb7=0x0;_0x5dcfb7<_0x52556c[_0x65f6('0x52')]['ids'][_0x65f6('0x37')];_0x5dcfb7+=0x1){socket[_0x65f6('0x125')](_0x65f6('0x126'),{'UserId':Number(_0x52556c[_0x65f6('0x52')][_0x65f6('0x5d')][_0x5dcfb7]),'ChatWebsiteId':Number(_0x52556c['params']['id'])});}return _0x5052d0;});}})[_0x65f6('0x12')](respondWithResult(_0x4665ec,null))['catch'](handleError(_0x4665ec,null));};exports[_0x65f6('0x127')]=function(_0xab6058,_0x57d25c){return db[_0x65f6('0x42')][_0x65f6('0x4f')]({'where':{'id':_0xab6058[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x57d25c,null))['then'](function(_0x402a5e){if(_0x402a5e){return _0x402a5e[_0x65f6('0x127')](_0xab6058[_0x65f6('0x32')]['ids'])[_0x65f6('0x12')](function(){if(_[_0x65f6('0x128')](_0xab6058[_0x65f6('0x32')][_0x65f6('0x5d')])){for(var _0x146686=0x0;_0x146686<_0xab6058[_0x65f6('0x32')][_0x65f6('0x5d')][_0x65f6('0x37')];_0x146686+=0x1){socket[_0x65f6('0x125')]('userChatWebsite:remove',{'UserId':Number(_0xab6058[_0x65f6('0x32')][_0x65f6('0x5d')][_0x146686]),'ChatWebsiteId':Number(_0xab6058[_0x65f6('0x46')]['id'])});}}else{socket[_0x65f6('0x125')](_0x65f6('0x129'),{'UserId':Number(_0xab6058[_0x65f6('0x32')][_0x65f6('0x5d')]),'ChatWebsiteId':Number(_0xab6058[_0x65f6('0x46')]['id'])});}});}})[_0x65f6('0x12')](respondWithStatusCode(_0x57d25c,null))[_0x65f6('0x1b')](handleError(_0x57d25c,null));};exports[_0x65f6('0x12a')]=function(_0x9d31a8,_0x56a917){var _0x5bc949={};var _0xcecebe={};var _0xbf5cba;var _0xfbd390;return db[_0x65f6('0x42')]['findOne']({'where':{'id':_0x9d31a8[_0x65f6('0x46')]['id']}})[_0x65f6('0x12')](handleEntityNotFound(_0x56a917,null))[_0x65f6('0x12')](function(_0x5bba5b){if(_0x5bba5b){_0xbf5cba=_0x5bba5b;_0xcecebe[_0x65f6('0x31')]=_[_0x65f6('0x48')](db[_0x65f6('0xb2')][_0x65f6('0x49')]);_0xcecebe[_0x65f6('0x32')]=_['keys'](_0x9d31a8['query']);_0xcecebe['filters']=_[_0x65f6('0x34')](_0xcecebe[_0x65f6('0x31')],_0xcecebe[_0x65f6('0x32')]);_0x5bc949[_0x65f6('0x35')]=_[_0x65f6('0x34')](_0xcecebe[_0x65f6('0x31')],qs[_0x65f6('0x36')](_0x9d31a8[_0x65f6('0x32')][_0x65f6('0x36')]));_0x5bc949['attributes']=_0x5bc949[_0x65f6('0x35')][_0x65f6('0x37')]?_0x5bc949['attributes']:_0xcecebe['model'];_0x5bc949[_0x65f6('0x3a')]=qs['sort'](_0x9d31a8[_0x65f6('0x32')][_0x65f6('0x3b')]);_0x5bc949[_0x65f6('0x3c')]=qs[_0x65f6('0x33')](_[_0x65f6('0x3d')](_0x9d31a8[_0x65f6('0x32')],_0xcecebe[_0x65f6('0x33')]));if(_0x9d31a8[_0x65f6('0x32')][_0x65f6('0x3e')]){_0x5bc949[_0x65f6('0x3c')]=_[_0x65f6('0x3f')](_0x5bc949[_0x65f6('0x3c')],{'$or':_[_0x65f6('0x2f')](_0x5bc949[_0x65f6('0x35')],function(_0x4e5800){var _0x35934d={};_0x35934d[_0x4e5800]={'$like':'%'+_0x9d31a8[_0x65f6('0x32')][_0x65f6('0x3e')]+'%'};return _0x35934d;})});}_0x5bc949=_[_0x65f6('0x3f')]({},_0x5bc949,_0x9d31a8[_0x65f6('0x41')]);return _0xbf5cba[_0x65f6('0x12a')](_0x5bc949);}})['then'](function(_0x309659){if(_0x309659){_0xfbd390=_0x309659['length'];if(!_0x9d31a8[_0x65f6('0x32')][_0x65f6('0x38')](_0x65f6('0x39'))){_0x5bc949[_0x65f6('0x1e')]=qs[_0x65f6('0x1e')](_0x9d31a8[_0x65f6('0x32')]['limit']);_0x5bc949[_0x65f6('0x21')]=qs[_0x65f6('0x21')](_0x9d31a8[_0x65f6('0x32')]['offset']);}return _0xbf5cba[_0x65f6('0x12a')](_0x5bc949);}})[_0x65f6('0x12')](function(_0x227065){if(_0x227065){return _0x227065?{'count':_0xfbd390,'rows':_0x227065}:null;}})['then'](respondWithResult(_0x56a917,null))[_0x65f6('0x1b')](handleError(_0x56a917,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c88b1de..46af8db 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 _0x302c=['save','emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x48cac8,_0x150d03){var _0x539232=function(_0x2fe472){while(--_0x2fe472){_0x48cac8['push'](_0x48cac8['shift']());}};_0x539232(++_0x150d03);}(_0x302c,0x15c));var _0xc302=function(_0x2deda4,_0x7d72d2){_0x2deda4=_0x2deda4-0x0;var _0x347822=_0x302c[_0x2deda4];return _0x347822;};'use strict';var EventEmitter=require(_0xc302('0x0'));var ChatWebsite=require(_0xc302('0x1'))['db'][_0xc302('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc302('0x3')](0x0);var events={'afterCreate':_0xc302('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x256168){return function(_0xdc61f1,_0x3ed277,_0x589559){ChatWebsiteEvents['emit'](_0x256168+':'+_0xdc61f1['id'],_0xdc61f1);ChatWebsiteEvents[_0xc302('0x5')](_0x256168,_0xdc61f1);_0x589559(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xc302('0x6')](e,emitEvent(event));}}module[_0xc302('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7dfd=['../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd7df('0x0'));var ChatWebsite=require(_0xd7df('0x1'))['db'][_0xd7df('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd7df('0x3')](0x0);var events={'afterCreate':_0xd7df('0x4'),'afterUpdate':_0xd7df('0x5'),'afterDestroy':_0xd7df('0x6')};function emitEvent(_0x38eee7){return function(_0x3ef231,_0x3d8c5a,_0x65a0b6){ChatWebsiteEvents[_0xd7df('0x7')](_0x38eee7+':'+_0x3ef231['id'],_0x3ef231);ChatWebsiteEvents[_0xd7df('0x7')](_0x38eee7,_0x3ef231);_0x65a0b6(null);};}for(var e in events){if(events[_0xd7df('0x8')](e)){var event=events[e];ChatWebsite[_0xd7df('0x9')](e,emitEvent(event));}}module[_0xd7df('0xa')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 6a97391..efd1eea 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 _0x8863=['exports','define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2a69b5,_0xa0fe8e){var _0x14622e=function(_0x5af734){while(--_0x5af734){_0x2a69b5['push'](_0x2a69b5['shift']());}};_0x14622e(++_0xa0fe8e);}(_0x8863,0xde));var _0x3886=function(_0x426f31,_0x3b37cc){_0x426f31=_0x426f31-0x0;var _0x5f0aab=_0x8863[_0x426f31];return _0x5f0aab;};'use strict';var _=require(_0x3886('0x0'));var util=require(_0x3886('0x1'));var logger=require(_0x3886('0x2'))(_0x3886('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3886('0x4'));var fs=require('fs');var path=require(_0x3886('0x5'));var rimraf=require(_0x3886('0x6'));var config=require(_0x3886('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x3886('0x8')]=function(_0x1740e4,_0xffb6e6){return _0x1740e4[_0x3886('0x9')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa36=['exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatWebsite.attributes'];(function(_0xe75d3f,_0x118e4b){var _0x1efa54=function(_0x2565d8){while(--_0x2565d8){_0xe75d3f['push'](_0xe75d3f['shift']());}};_0x1efa54(++_0x118e4b);}(_0xaa36,0x177));var _0x6aa3=function(_0x5deec1,_0x33e02b){_0x5deec1=_0x5deec1-0x0;var _0x19afaa=_0xaa36[_0x5deec1];return _0x19afaa;};'use strict';var _=require(_0x6aa3('0x0'));var util=require(_0x6aa3('0x1'));var logger=require(_0x6aa3('0x2'))(_0x6aa3('0x3'));var moment=require(_0x6aa3('0x4'));var BPromise=require('bluebird');var rp=require(_0x6aa3('0x5'));var fs=require('fs');var path=require(_0x6aa3('0x6'));var rimraf=require(_0x6aa3('0x7'));var config=require('../../config/environment');var attributes=require(_0x6aa3('0x8'));module[_0x6aa3('0x9')]=function(_0x2825b7,_0x5d13e2){return _0x2825b7['define'](_0x6aa3('0xa'),attributes,{'tableName':_0x6aa3('0xb'),'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 0319150..ec2c5db 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 _0xfaf2=['../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x464950,_0x1f693f){var _0x129e33=function(_0x5e831f){while(--_0x5e831f){_0x464950['push'](_0x464950['shift']());}};_0x129e33(++_0x1f693f);}(_0xfaf2,0x19b));var _0x2faf=function(_0x31a83a,_0x529ea1){_0x31a83a=_0x31a83a-0x0;var _0x31c6ba=_0xfaf2[_0x31a83a];return _0x31c6ba;};'use strict';var _=require(_0x2faf('0x0'));var util=require(_0x2faf('0x1'));var moment=require(_0x2faf('0x2'));var BPromise=require('bluebird');var rs=require(_0x2faf('0x3'));var fs=require('fs');var Redis=require(_0x2faf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2faf('0x5'));var logger=require('../../config/logger')(_0x2faf('0x6'));var config=require(_0x2faf('0x7'));var jayson=require(_0x2faf('0x8'));var client=jayson[_0x2faf('0x9')]['http']({'port':0x232a});config[_0x2faf('0xa')]=_[_0x2faf('0xb')](config[_0x2faf('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2faf('0xc'))(new Redis(config[_0x2faf('0xa')]));require(_0x2faf('0xd'))[_0x2faf('0xe')](socket);function respondWithRpcPromise(_0x3a9734,_0x57be76,_0x19d2cc){return new BPromise(function(_0x1c189f,_0x451e5b){return client[_0x2faf('0xf')](_0x3a9734,_0x19d2cc)[_0x2faf('0x10')](function(_0x1ba124){logger['info'](_0x2faf('0x11'),_0x57be76,'request\x20sent');logger[_0x2faf('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x57be76,_0x2faf('0x13'),JSON['stringify'](_0x1ba124));if(_0x1ba124[_0x2faf('0x14')]){if(_0x1ba124[_0x2faf('0x14')][_0x2faf('0x15')]===0x1f4){logger['error'](_0x2faf('0x11'),_0x57be76,_0x1ba124[_0x2faf('0x14')][_0x2faf('0x16')]);return _0x451e5b(_0x1ba124[_0x2faf('0x14')][_0x2faf('0x16')]);}logger[_0x2faf('0x14')](_0x2faf('0x11'),_0x57be76,_0x1ba124['error'][_0x2faf('0x16')]);return _0x1c189f(_0x1ba124[_0x2faf('0x14')][_0x2faf('0x16')]);}else{logger[_0x2faf('0x17')](_0x2faf('0x11'),_0x57be76,'request\x20sent');_0x1c189f(_0x1ba124[_0x2faf('0x18')][_0x2faf('0x16')]);}})[_0x2faf('0x19')](function(_0xc70465){logger[_0x2faf('0x14')](_0x2faf('0x11'),_0x57be76,_0xc70465);_0x451e5b(_0xc70465);});});} \ No newline at end of file +var _0xb466=['ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request'];(function(_0x595612,_0x494e32){var _0x4ad122=function(_0x30de80){while(--_0x30de80){_0x595612['push'](_0x595612['shift']());}};_0x4ad122(++_0x494e32);}(_0xb466,0x19a));var _0x6b46=function(_0x28e19a,_0x242f29){_0x28e19a=_0x28e19a-0x0;var _0x30fa69=_0xb466[_0x28e19a];return _0x30fa69;};'use strict';var _=require(_0x6b46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6b46('0x1'));var rs=require(_0x6b46('0x2'));var fs=require('fs');var Redis=require(_0x6b46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b46('0x4'));var logger=require(_0x6b46('0x5'))(_0x6b46('0x6'));var config=require(_0x6b46('0x7'));var jayson=require(_0x6b46('0x8'));var client=jayson['client'][_0x6b46('0x9')]({'port':0x232a});config[_0x6b46('0xa')]=_[_0x6b46('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6b46('0xc'))(new Redis(config[_0x6b46('0xa')]));require(_0x6b46('0xd'))['register'](socket);function respondWithRpcPromise(_0x1c8bdb,_0x563acd,_0x832a09){return new BPromise(function(_0xea4299,_0x97496d){return client[_0x6b46('0xe')](_0x1c8bdb,_0x832a09)['then'](function(_0x2cc4d5){logger['info'](_0x6b46('0xf'),_0x563acd,_0x6b46('0x10'));logger['debug'](_0x6b46('0x11'),_0x563acd,_0x6b46('0x10'),JSON[_0x6b46('0x12')](_0x2cc4d5));if(_0x2cc4d5[_0x6b46('0x13')]){if(_0x2cc4d5['error'][_0x6b46('0x14')]===0x1f4){logger[_0x6b46('0x13')](_0x6b46('0xf'),_0x563acd,_0x2cc4d5[_0x6b46('0x13')][_0x6b46('0x15')]);return _0x97496d(_0x2cc4d5[_0x6b46('0x13')][_0x6b46('0x15')]);}logger['error'](_0x6b46('0xf'),_0x563acd,_0x2cc4d5[_0x6b46('0x13')][_0x6b46('0x15')]);return _0xea4299(_0x2cc4d5[_0x6b46('0x13')]['message']);}else{logger[_0x6b46('0x16')](_0x6b46('0xf'),_0x563acd,_0x6b46('0x10'));_0xea4299(_0x2cc4d5[_0x6b46('0x17')][_0x6b46('0x15')]);}})[_0x6b46('0x18')](function(_0x81c357){logger['error'](_0x6b46('0xf'),_0x563acd,_0x81c357);_0x97496d(_0x81c357);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index cd47615..7cf6d19 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 _0x108e=['length','chatWebsite:','save','remove','update','removeListener','register'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0x108e,0xb8));var _0xe108=function(_0x2c5170,_0x113ca9){_0x2c5170=_0x2c5170-0x0;var _0x190d4e=_0x108e[_0x2c5170];return _0x190d4e;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xe108('0x0'),_0xe108('0x1'),_0xe108('0x2')];function createListener(_0x2ecad0,_0x1db2f8){return function(_0x4748dc){_0x1db2f8['emit'](_0x2ecad0,_0x4748dc);};}function removeListener(_0x5a82e1,_0x561f9d){return function(){ChatWebsiteEvents[_0xe108('0x3')](_0x5a82e1,_0x561f9d);};}exports[_0xe108('0x4')]=function(_0x5c396c){for(var _0x50f27c=0x0,_0x8fbc88=events[_0xe108('0x5')];_0x50f27c<_0x8fbc88;_0x50f27c++){var _0x28279e=events[_0x50f27c];var _0x4ed625=createListener(_0xe108('0x6')+_0x28279e,_0x5c396c);ChatWebsiteEvents['on'](_0x28279e,_0x4ed625);}}; \ No newline at end of file +var _0xb833=['register','length','chatWebsite:','remove','emit'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xb833,0x16b));var _0x3b83=function(_0x2798c7,_0x38a3db){_0x2798c7=_0x2798c7-0x0;var _0x141df6=_0xb833[_0x2798c7];return _0x141df6;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=['save',_0x3b83('0x0'),'update'];function createListener(_0x2f57a7,_0x548377){return function(_0x4122d6){_0x548377[_0x3b83('0x1')](_0x2f57a7,_0x4122d6);};}function removeListener(_0x1290d4,_0x49d3f7){return function(){ChatWebsiteEvents['removeListener'](_0x1290d4,_0x49d3f7);};}exports[_0x3b83('0x2')]=function(_0x584a86){for(var _0x3acc40=0x0,_0x2380cd=events[_0x3b83('0x3')];_0x3acc40<_0x2380cd;_0x3acc40++){var _0x21fefb=events[_0x3acc40];var _0x21a6c6=createListener(_0x3b83('0x4')+_0x21fefb,_0x584a86);ChatWebsiteEvents['on'](_0x21fefb,_0x21a6c6);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index bebfcc3..632de1b 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 _0xf8ef=['extname','/:id/offline','any','offline','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','removeAnswers','removeAgents','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','join','format','%s-%s','originalname','file','addLogo','diskStorage','root','server/files/images/avatars/','now','addAvatar','single','addCustomerAvatar','addSystemAvatar','notify','offline-chat','replace'];(function(_0x7806b2,_0x413131){var _0x764a77=function(_0x3b0307){while(--_0x3b0307){_0x7806b2['push'](_0x7806b2['shift']());}};_0x764a77(++_0x413131);}(_0xf8ef,0x15c));var _0xff8e=function(_0x48eab4,_0x277c00){_0x48eab4=_0x48eab4-0x0;var _0xae2e9e=_0xf8ef[_0x48eab4];return _0xae2e9e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xff8e('0x0'));var express=require('express');var router=express[_0xff8e('0x1')]();var fs_extra=require(_0xff8e('0x2'));var auth=require(_0xff8e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xff8e('0x4'));var controller=require(_0xff8e('0x5'));router[_0xff8e('0x6')]('/',auth[_0xff8e('0x7')](),controller[_0xff8e('0x8')]);router[_0xff8e('0x6')]('/describe',auth[_0xff8e('0x7')](),controller[_0xff8e('0x9')]);router['get'](_0xff8e('0xa'),auth[_0xff8e('0x7')](),controller[_0xff8e('0xb')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xff8e('0xc')]);router[_0xff8e('0x6')](_0xff8e('0xd'),auth[_0xff8e('0x7')](),controller[_0xff8e('0xe')]);router[_0xff8e('0x6')](_0xff8e('0xf'),controller[_0xff8e('0x10')]);router[_0xff8e('0x6')](_0xff8e('0x11'),controller[_0xff8e('0x12')]);router[_0xff8e('0x6')](_0xff8e('0x13'),controller[_0xff8e('0x14')]);router[_0xff8e('0x6')](_0xff8e('0x15'),controller['getSystemAvatar']);router[_0xff8e('0x6')](_0xff8e('0x16'),auth[_0xff8e('0x7')](),controller['getInteractions']);router[_0xff8e('0x6')](_0xff8e('0x17'),controller[_0xff8e('0x18')]);router[_0xff8e('0x6')](_0xff8e('0x19'),auth['isAuthenticated'](),controller[_0xff8e('0x1a')]);router[_0xff8e('0x6')]('/:id/proactive_actions',auth[_0xff8e('0x7')](),controller['getProactiveActions']);router[_0xff8e('0x6')](_0xff8e('0x1b'),controller[_0xff8e('0x1c')]);router[_0xff8e('0x6')](_0xff8e('0x1d'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x1e')]);router['get'](_0xff8e('0x1f'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x20')]);router[_0xff8e('0x21')]('/',auth[_0xff8e('0x7')](),controller[_0xff8e('0x22')]);router['post'](_0xff8e('0x23'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x24')]);router['post'](_0xff8e('0xd'),auth[_0xff8e('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4ce01,_0x1cf1cc,_0x8f1287){_0x8f1287(null,path[_0xff8e('0x25')](config['root'],'server/files/images/logos/'));},'filename':function(_0x359ef6,_0x4234e1,_0x23503a){_0x23503a(null,util[_0xff8e('0x26')](_0xff8e('0x27'),Date['now'](),_0x4234e1[_0xff8e('0x28')]));}})});router[_0xff8e('0x21')](_0xff8e('0xf'),upload['single'](_0xff8e('0x29')),controller[_0xff8e('0x2a')]);var upload=multer({'storage':multer[_0xff8e('0x2b')]({'destination':function(_0x138cbc,_0x17ac09,_0x2e8cb9){_0x2e8cb9(null,path[_0xff8e('0x25')](config[_0xff8e('0x2c')],_0xff8e('0x2d')));},'filename':function(_0x156379,_0x18e7b1,_0x3b579d){_0x3b579d(null,util[_0xff8e('0x26')](_0xff8e('0x27'),Date[_0xff8e('0x2e')](),_0x18e7b1[_0xff8e('0x28')]));}})});router[_0xff8e('0x21')](_0xff8e('0x11'),upload['single'](_0xff8e('0x29')),controller[_0xff8e('0x2f')]);var upload=multer({'storage':multer[_0xff8e('0x2b')]({'destination':function(_0x362d70,_0xf4372e,_0x1d7f60){_0x1d7f60(null,path['join'](config['root'],_0xff8e('0x2d')));},'filename':function(_0x469d57,_0x269420,_0xdee076){_0xdee076(null,util[_0xff8e('0x26')](_0xff8e('0x27'),Date['now'](),_0x269420['originalname']));}})});router[_0xff8e('0x21')]('/:id/customer_avatar',upload[_0xff8e('0x30')](_0xff8e('0x29')),controller[_0xff8e('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3df06c,_0x283ee8,_0x4611c9){_0x4611c9(null,path[_0xff8e('0x25')](config[_0xff8e('0x2c')],_0xff8e('0x2d')));},'filename':function(_0x42345f,_0xf656c8,_0xb8b281){_0xb8b281(null,util[_0xff8e('0x26')](_0xff8e('0x27'),Date['now'](),_0xf656c8['originalname']));}})});router[_0xff8e('0x21')](_0xff8e('0x15'),upload['single'](_0xff8e('0x29')),controller[_0xff8e('0x32')]);router[_0xff8e('0x21')]('/:id/notify',controller[_0xff8e('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0xff8e('0x2b')]({'destination':function(_0x5c91b2,_0x238261,_0x13034e){const _0x17e2f9=path['join'](config['root'],'server/files','attachments',_0xff8e('0x34'));fs_extra['ensureDir'](_0x17e2f9,function(){_0x13034e(null,_0x17e2f9);});},'filename':function(_0x579d86,_0x39a833,_0x38bcac){const _0x1ed2e4=_0x39a833['originalname'][_0xff8e('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x42939a=path[_0xff8e('0x36')](_0x1ed2e4);const _0x15e8a6=Date[_0xff8e('0x2e')]()+'-'+_0x1ed2e4[_0xff8e('0x35')](_0x42939a,'')+_0x42939a;_0x38bcac(null,_0x15e8a6);}})});router['post'](_0xff8e('0x37'),offlineUploadMulter[_0xff8e('0x38')](),controller[_0xff8e('0x39')]);router[_0xff8e('0x21')](_0xff8e('0x16'),auth[_0xff8e('0x7')](),controller['addInteraction']);router[_0xff8e('0x21')](_0xff8e('0x19'),auth[_0xff8e('0x7')](),controller['addApplications']);router['post'](_0xff8e('0x3a'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x3b')]);router[_0xff8e('0x21')](_0xff8e('0x1f'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x3c')]);router[_0xff8e('0x3d')](_0xff8e('0xa'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x3e')]);router['delete'](_0xff8e('0xa'),auth[_0xff8e('0x7')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xff8e('0x7')](),controller['removeDispositions']);router[_0xff8e('0x3f')](_0xff8e('0xd'),auth[_0xff8e('0x7')](),controller[_0xff8e('0x40')]);router[_0xff8e('0x3f')]('/:id/users',auth[_0xff8e('0x7')](),controller[_0xff8e('0x41')]);module[_0xff8e('0x42')]=router; \ No newline at end of file +var _0x1396=['join','server/files/images/logos/','format','%s-%s','originalname','addLogo','root','server/files/images/avatars/','single','file','addAvatar','now','addSystemAvatar','/:id/notify','diskStorage','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','addDisposition','addAnswer'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1396,0xf5));var _0x6139=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x1396[_0x44c935];return _0x465bee;};'use strict';var multer=require(_0x6139('0x0'));var util=require('util');var path=require(_0x6139('0x1'));var timeout=require(_0x6139('0x2'));var express=require(_0x6139('0x3'));var router=express[_0x6139('0x4')]();var fs_extra=require(_0x6139('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6139('0x6'));var controller=require(_0x6139('0x7'));router['get']('/',auth[_0x6139('0x8')](),controller[_0x6139('0x9')]);router[_0x6139('0xa')](_0x6139('0xb'),auth['isAuthenticated'](),controller[_0x6139('0xc')]);router[_0x6139('0xa')]('/:id',auth[_0x6139('0x8')](),controller[_0x6139('0xd')]);router['get'](_0x6139('0xe'),auth[_0x6139('0x8')](),controller[_0x6139('0xf')]);router[_0x6139('0xa')](_0x6139('0x10'),auth[_0x6139('0x8')](),controller[_0x6139('0x11')]);router[_0x6139('0xa')](_0x6139('0x12'),controller[_0x6139('0x13')]);router[_0x6139('0xa')]('/:id/avatar',controller[_0x6139('0x14')]);router[_0x6139('0xa')](_0x6139('0x15'),controller['getCustomerAvatar']);router[_0x6139('0xa')](_0x6139('0x16'),controller['getSystemAvatar']);router[_0x6139('0xa')](_0x6139('0x17'),auth[_0x6139('0x8')](),controller['getInteractions']);router[_0x6139('0xa')]('/:id/snippet',controller['getSnippet']);router[_0x6139('0xa')](_0x6139('0x18'),auth[_0x6139('0x8')](),controller['getApplications']);router[_0x6139('0xa')](_0x6139('0x19'),auth['isAuthenticated'](),controller[_0x6139('0x1a')]);router[_0x6139('0xa')](_0x6139('0x1b'),controller[_0x6139('0x1c')]);router['get'](_0x6139('0x1d'),auth[_0x6139('0x8')](),controller['getOfflineMessages']);router[_0x6139('0xa')](_0x6139('0x1e'),auth['isAuthenticated'](),controller[_0x6139('0x1f')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6139('0x20')](_0x6139('0xe'),auth['isAuthenticated'](),controller[_0x6139('0x21')]);router[_0x6139('0x20')](_0x6139('0x10'),auth[_0x6139('0x8')](),controller[_0x6139('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2bc9f6,_0x23c314,_0x32e278){_0x32e278(null,path[_0x6139('0x23')](config['root'],_0x6139('0x24')));},'filename':function(_0x7c890e,_0x40ecd1,_0x5c58b1){_0x5c58b1(null,util[_0x6139('0x25')](_0x6139('0x26'),Date['now'](),_0x40ecd1[_0x6139('0x27')]));}})});router[_0x6139('0x20')](_0x6139('0x12'),upload['single']('file'),controller[_0x6139('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d12f7,_0x37e85e,_0x43ef27){_0x43ef27(null,path[_0x6139('0x23')](config[_0x6139('0x29')],_0x6139('0x2a')));},'filename':function(_0x8e8043,_0x24f45a,_0x12684e){_0x12684e(null,util[_0x6139('0x25')]('%s-%s',Date['now'](),_0x24f45a[_0x6139('0x27')]));}})});router[_0x6139('0x20')]('/:id/avatar',upload[_0x6139('0x2b')](_0x6139('0x2c')),controller[_0x6139('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x39c4f2,_0x52d5fa,_0x4444a6){_0x4444a6(null,path[_0x6139('0x23')](config[_0x6139('0x29')],'server/files/images/avatars/'));},'filename':function(_0x558d2a,_0x329496,_0x17d8ee){_0x17d8ee(null,util['format'](_0x6139('0x26'),Date[_0x6139('0x2e')](),_0x329496['originalname']));}})});router[_0x6139('0x20')]('/:id/customer_avatar',upload[_0x6139('0x2b')](_0x6139('0x2c')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xece934,_0x2a596a,_0x54f8b1){_0x54f8b1(null,path[_0x6139('0x23')](config[_0x6139('0x29')],_0x6139('0x2a')));},'filename':function(_0x112f19,_0xbcac6a,_0x51f7b6){_0x51f7b6(null,util[_0x6139('0x25')]('%s-%s',Date['now'](),_0xbcac6a[_0x6139('0x27')]));}})});router['post'](_0x6139('0x16'),upload['single']('file'),controller[_0x6139('0x2f')]);router['post'](_0x6139('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x6139('0x31')]({'destination':function(_0x30a801,_0x3d6d1c,_0x4f5e26){const _0x24ed71=path[_0x6139('0x23')](config['root'],_0x6139('0x32'),'attachments',_0x6139('0x33'));fs_extra[_0x6139('0x34')](_0x24ed71,function(){_0x4f5e26(null,_0x24ed71);});},'filename':function(_0x528d85,_0x25578e,_0x349538){const _0x41dbec=_0x25578e[_0x6139('0x27')][_0x6139('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x47f3a1=path[_0x6139('0x36')](_0x41dbec);const _0x481758=Date[_0x6139('0x2e')]()+'-'+_0x41dbec['replace'](_0x47f3a1,'')+_0x47f3a1;_0x349538(null,_0x481758);}})});router[_0x6139('0x20')](_0x6139('0x37'),offlineUploadMulter[_0x6139('0x38')](),controller[_0x6139('0x39')]);router['post'](_0x6139('0x17'),auth[_0x6139('0x8')](),controller[_0x6139('0x3a')]);router[_0x6139('0x20')](_0x6139('0x18'),auth['isAuthenticated'](),controller[_0x6139('0x3b')]);router['post'](_0x6139('0x19'),auth['isAuthenticated'](),controller[_0x6139('0x3c')]);router[_0x6139('0x20')](_0x6139('0x1e'),auth['isAuthenticated'](),controller[_0x6139('0x3d')]);router[_0x6139('0x3e')](_0x6139('0x3f'),auth[_0x6139('0x8')](),controller[_0x6139('0x40')]);router[_0x6139('0x41')](_0x6139('0x3f'),auth['isAuthenticated'](),controller[_0x6139('0x42')]);router[_0x6139('0x41')](_0x6139('0xe'),auth[_0x6139('0x8')](),controller[_0x6139('0x43')]);router[_0x6139('0x41')](_0x6139('0x10'),auth[_0x6139('0x8')](),controller['removeAnswers']);router[_0x6139('0x41')](_0x6139('0x1e'),auth['isAuthenticated'](),controller[_0x6139('0x44')]);module[_0x6139('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index b6c5993..b72eeac 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 _0xa000=['ENUM','AmazonAWS','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x4fb3f4,_0xf521){var _0x5281aa=function(_0x1ced94){while(--_0x1ced94){_0x4fb3f4['push'](_0x4fb3f4['shift']());}};_0x5281aa(++_0xf521);}(_0xa000,0xf9));var _0x0a00=function(_0x1bbfe5,_0x2d4a21){_0x1bbfe5=_0x1bbfe5-0x0;var _0x1cdc4f=_0xa000[_0x1bbfe5];return _0x1cdc4f;};'use strict';var Sequelize=require(_0x0a00('0x0'));module[_0x0a00('0x1')]={'name':{'type':Sequelize[_0x0a00('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0a00('0x3')](_0x0a00('0x4'),'Google',_0x0a00('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x0a00('0x3')](_0x0a00('0x6'),_0x0a00('0x7'))},'data1':{'type':Sequelize[_0x0a00('0x2')],'comment':_0x0a00('0x8')},'data2':{'type':Sequelize[_0x0a00('0x2')],'comment':_0x0a00('0x9')},'data3':{'type':Sequelize[_0x0a00('0x2')],'comment':_0x0a00('0xa')},'data4':{'type':Sequelize[_0x0a00('0x2')],'comment':_0x0a00('0xb')},'data5':{'type':Sequelize[_0x0a00('0xc')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x0a00('0xc')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x0a00('0xc')],'comment':_0x0a00('0xd')}}; \ No newline at end of file +var _0x1c00=['Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','STRING','ENUM','AmazonAWS'];(function(_0x47c882,_0x8a92aa){var _0x205ede=function(_0x2bf8ae){while(--_0x2bf8ae){_0x47c882['push'](_0x47c882['shift']());}};_0x205ede(++_0x8a92aa);}(_0x1c00,0x8c));var _0x01c0=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x1c00[_0x576170];return _0x397c70;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x01c0('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x01c0('0x1')](_0x01c0('0x2'),_0x01c0('0x3'),_0x01c0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('Outlook365',_0x01c0('0x5'))},'data1':{'type':Sequelize[_0x01c0('0x0')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0x01c0('0x6')},'data3':{'type':Sequelize[_0x01c0('0x0')],'comment':_0x01c0('0x7')},'data4':{'type':Sequelize[_0x01c0('0x0')],'comment':_0x01c0('0x8')},'data5':{'type':Sequelize[_0x01c0('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x01c0('0x9')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x01c0('0x9')],'comment':_0x01c0('0xa')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 7da8570..f31b2a3 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 _0x939d=['values','includes','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','ioredis','../../components/encryptor','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','slice','index','CloudProvider','rawAttributes','type','key','map','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','service','MicrosoftAzure','decryptString','data3','show','params','find','catch','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified'];(function(_0x3a8af1,_0x53694a){var _0x26ca03=function(_0x48ff74){while(--_0x48ff74){_0x3a8af1['push'](_0x3a8af1['shift']());}};_0x26ca03(++_0x53694a);}(_0x939d,0xd9));var _0xd939=function(_0x3c7ac7,_0x3e84b7){_0x3c7ac7=_0x3c7ac7-0x0;var _0x5e1678=_0x939d[_0x3c7ac7];return _0x5e1678;};'use strict';var _=require(_0xd939('0x0'));var Redis=require(_0xd939('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0xd939('0x2'));var config=require('../../config/environment');var logger=require(_0xd939('0x3'))(_0xd939('0x4'));var db=require('../../mysqldb')['db'];var oauth=require('./cloudProvider.oauth');config[_0xd939('0x5')]=_[_0xd939('0x6')](config['redis'],{'host':_0xd939('0x7'),'port':0x18eb});var socket=require(_0xd939('0x8'))(new Redis(config[_0xd939('0x5')]));var redis=new Redis(config[_0xd939('0x5')]);function respondWithStatusCode(_0x136f7f,_0x5e04dc){_0x5e04dc=_0x5e04dc||0xcc;return function(_0x4bae79){if(_0x4bae79){return _0x136f7f[_0xd939('0x9')](_0x5e04dc);}return _0x136f7f[_0xd939('0xa')](_0x5e04dc)[_0xd939('0xb')]();};}function respondWithResult(_0xcbb72c,_0x484c85){_0x484c85=_0x484c85||0xc8;return function(_0x31da9d){if(_0x31da9d){return _0xcbb72c[_0xd939('0xa')](_0x484c85)[_0xd939('0xc')](_0x31da9d);}};}function respondWithFilteredResult(_0x543025,_0x571f7d){return function(_0x3a647d){if(_0x3a647d){var _0x4578ba=typeof _0x571f7d[_0xd939('0xd')]==='undefined'&&typeof _0x571f7d[_0xd939('0xe')]===_0xd939('0xf');var _0x431fc4=_0x3a647d[_0xd939('0x10')];var _0x5df3ab=_0x4578ba?0x0:_0x571f7d[_0xd939('0xd')];var _0x15c6b8=_0x4578ba?_0x3a647d['count']:_0x571f7d['offset']+_0x571f7d['limit'];var _0x3aecc2;if(_0x15c6b8>=_0x431fc4){_0x15c6b8=_0x431fc4;_0x3aecc2=0xc8;}else{_0x3aecc2=0xce;}_0x543025['status'](_0x3aecc2);return _0x543025[_0xd939('0x11')](_0xd939('0x12'),_0x5df3ab+'-'+_0x15c6b8+'/'+_0x431fc4)[_0xd939('0xc')](_0x3a647d);}return null;};}function saveUpdates(_0x4046c5){return function(_0x792ae3){if(_0x792ae3){return _0x792ae3[_0xd939('0x13')](_0x4046c5)[_0xd939('0x14')](function(_0x1b9c69){return _0x1b9c69;});}return null;};}function removeEntity(_0x147d91){return function(_0x378646){if(_0x378646){return _0x378646[_0xd939('0x15')]()[_0xd939('0x14')](function(){_0x147d91[_0xd939('0xa')](0xcc)[_0xd939('0xb')]();});}};}function handleEntityNotFound(_0x4331c6){return function(_0x23c4c4){if(!_0x23c4c4){_0x4331c6['sendStatus'](0x194);}return _0x23c4c4;};}function handleError(_0x2a681e,_0x4efbf9){_0x4efbf9=_0x4efbf9||0x1f4;return function(_0x2762d5){logger[_0xd939('0x16')](_0x2762d5[_0xd939('0x17')]);if(_0x2762d5['name']){delete _0x2762d5[_0xd939('0x18')];}_0x2a681e[_0xd939('0xa')](_0x4efbf9)[_0xd939('0x19')](_0x2762d5);};}function maskClientSecret(_0x109a50){return _['padEnd'](_0x109a50[_0xd939('0x1a')](0x0,0x3),0x14,'*');}exports[_0xd939('0x1b')]=function(_0x5eedfc,_0x379b64){var _0x133b4e={},_0x4d9471={},_0x44c661={'count':0x0,'rows':[]};var _0x16286b=_['map'](db[_0xd939('0x1c')][_0xd939('0x1d')],function(_0x15e3a2){return{'name':_0x15e3a2['fieldName'],'type':_0x15e3a2[_0xd939('0x1e')][_0xd939('0x1f')]};});_0x4d9471['model']=_[_0xd939('0x20')](_0x16286b,_0xd939('0x18'));_0x4d9471[_0xd939('0x21')]=_[_0xd939('0x22')](_0x5eedfc[_0xd939('0x21')]);_0x4d9471[_0xd939('0x23')]=_['intersection'](_0x4d9471['model'],_0x4d9471[_0xd939('0x21')]);_0x133b4e[_0xd939('0x24')]=_[_0xd939('0x25')](_0x4d9471[_0xd939('0x26')],qs[_0xd939('0x27')](_0x5eedfc['query'][_0xd939('0x27')]));_0x133b4e[_0xd939('0x24')]=_0x133b4e['attributes'][_0xd939('0x28')]?_0x133b4e[_0xd939('0x24')]:_0x4d9471['model'];if(!_0x5eedfc['query'][_0xd939('0x29')](_0xd939('0x2a'))){_0x133b4e[_0xd939('0xe')]=qs[_0xd939('0xe')](_0x5eedfc['query'][_0xd939('0xe')]);_0x133b4e['offset']=qs[_0xd939('0xd')](_0x5eedfc['query'][_0xd939('0xd')]);}_0x133b4e[_0xd939('0x2b')]=qs['sort'](_0x5eedfc['query'][_0xd939('0x2c')]);_0x133b4e[_0xd939('0x2d')]=qs[_0xd939('0x23')](_[_0xd939('0x2e')](_0x5eedfc[_0xd939('0x21')],_0x4d9471[_0xd939('0x23')]),_0x16286b);if(_0x5eedfc[_0xd939('0x21')]['filter']){_0x133b4e[_0xd939('0x2d')]=_[_0xd939('0x2f')](_0x133b4e[_0xd939('0x2d')],{'$or':_[_0xd939('0x20')](_0x16286b,function(_0x14d56f){if(_0x14d56f['type']!==_0xd939('0x30')){var _0x5930f2={};_0x5930f2[_0x14d56f['name']]={'$like':'%'+_0x5eedfc['query'][_0xd939('0x31')]+'%'};return _0x5930f2;}})});}_0x133b4e=_[_0xd939('0x2f')]({},_0x133b4e,_0x5eedfc[_0xd939('0x32')]);var _0x5474bd={'where':_0x133b4e[_0xd939('0x2d')]};return db[_0xd939('0x1c')][_0xd939('0x10')](_0x5474bd)[_0xd939('0x14')](function(_0x2a216a){_0x44c661[_0xd939('0x10')]=_0x2a216a;if(_0x5eedfc[_0xd939('0x21')][_0xd939('0x33')]){_0x133b4e['include']=[{'all':!![]}];}return db[_0xd939('0x1c')][_0xd939('0x34')](_0x133b4e);})[_0xd939('0x14')](function(_0x3686b9){_0x44c661[_0xd939('0x35')]=_[_0xd939('0x20')](_0x3686b9,function(_0x4e9a5d){if(_0x4e9a5d[_0xd939('0x36')]===_0xd939('0x37')){var _0x212b31=encryptor[_0xd939('0x38')](_0x4e9a5d['data3']);_0x4e9a5d[_0xd939('0x39')]=maskClientSecret(_0x212b31);}return _0x4e9a5d;});return _0x44c661;})[_0xd939('0x14')](respondWithFilteredResult(_0x379b64,_0x133b4e))['catch'](handleError(_0x379b64,null));};exports[_0xd939('0x3a')]=function(_0x5a7e3f,_0x53c899){var _0x19bacf={'raw':!![],'where':{'id':_0x5a7e3f[_0xd939('0x3b')]['id']}},_0x18507b={};_0x18507b[_0xd939('0x26')]=_[_0xd939('0x22')](db[_0xd939('0x1c')][_0xd939('0x1d')]);_0x18507b[_0xd939('0x21')]=_['keys'](_0x5a7e3f[_0xd939('0x21')]);_0x18507b[_0xd939('0x23')]=_[_0xd939('0x25')](_0x18507b[_0xd939('0x26')],_0x18507b[_0xd939('0x21')]);_0x19bacf[_0xd939('0x24')]=_[_0xd939('0x25')](_0x18507b[_0xd939('0x26')],qs[_0xd939('0x27')](_0x5a7e3f['query'][_0xd939('0x27')]));_0x19bacf['attributes']=_0x19bacf[_0xd939('0x24')][_0xd939('0x28')]?_0x19bacf['attributes']:_0x18507b[_0xd939('0x26')];if(_0x5a7e3f[_0xd939('0x21')][_0xd939('0x33')]){_0x19bacf['include']=[{'all':!![]}];}_0x19bacf=_[_0xd939('0x2f')]({},_0x19bacf,_0x5a7e3f['options']);return db['CloudProvider'][_0xd939('0x3c')](_0x19bacf)['then'](handleEntityNotFound(_0x53c899,null))['then'](function(_0xd80513){if(_0xd80513[_0xd939('0x36')]===_0xd939('0x37')){var _0x3c3956=encryptor[_0xd939('0x38')](_0xd80513[_0xd939('0x39')]);_0xd80513['data3']=maskClientSecret(_0x3c3956);}return _0xd80513;})['then'](respondWithResult(_0x53c899,null))[_0xd939('0x3d')](handleError(_0x53c899,null));};exports['create']=function(_0x29c285,_0x1731c0){if(!_0x29c285[_0xd939('0x3e')][_0xd939('0x18')])throw new Error(_0xd939('0x3f'));if(!_0x29c285['body'][_0xd939('0x36')])throw new Error(_0xd939('0x40'));var _0x31c8d8=db['CloudProvider'][_0xd939('0x1d')][_0xd939('0x36')][_0xd939('0x41')];if(!_0x31c8d8[_0xd939('0x42')](_0x29c285[_0xd939('0x3e')][_0xd939('0x36')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x31c8d8[_0xd939('0x43')](',\x20'));if(_0x29c285[_0xd939('0x3e')]['service']===_0xd939('0x37')&&_0x29c285[_0xd939('0x3e')]['data3']){_0x29c285[_0xd939('0x3e')][_0xd939('0x39')]=encryptor[_0xd939('0x44')](_0x29c285['body'][_0xd939('0x39')]);}return db['CloudProvider']['create'](_0x29c285[_0xd939('0x3e')],{})[_0xd939('0x14')](respondWithResult(_0x1731c0,0xc9))[_0xd939('0x3d')](handleError(_0x1731c0,null));};exports[_0xd939('0x13')]=function(_0x30b03c,_0x5a686b){if(_0x30b03c[_0xd939('0x3e')]['id']){delete _0x30b03c[_0xd939('0x3e')]['id'];}return db[_0xd939('0x1c')][_0xd939('0x3c')]({'where':{'id':_0x30b03c[_0xd939('0x3b')]['id']}})[_0xd939('0x14')](handleEntityNotFound(_0x5a686b,null))[_0xd939('0x14')](function(_0x41bd34){if(_0x41bd34[_0xd939('0x36')]==='MicrosoftAzure'&&_0x30b03c[_0xd939('0x3e')][_0xd939('0x39')]){_0x30b03c[_0xd939('0x3e')]['data3']=encryptor[_0xd939('0x44')](_0x30b03c['body']['data3']);}return _0x41bd34;})[_0xd939('0x14')](saveUpdates(_0x30b03c[_0xd939('0x3e')],null))[_0xd939('0x14')](respondWithResult(_0x5a686b,null))[_0xd939('0x3d')](handleError(_0x5a686b,null));};exports[_0xd939('0x15')]=function(_0x34ad8a,_0x4addf9){return db[_0xd939('0x1c')][_0xd939('0x3c')]({'where':{'id':_0x34ad8a[_0xd939('0x3b')]['id']}})[_0xd939('0x14')](handleEntityNotFound(_0x4addf9,null))[_0xd939('0x14')](removeEntity(_0x4addf9,null))[_0xd939('0x3d')](handleError(_0x4addf9,null));};exports[_0xd939('0x45')]=function(_0x43e727,_0x305169){return db[_0xd939('0x1c')][_0xd939('0x46')]({'where':{'id':_0x43e727[_0xd939('0x3b')]['id']},'raw':!![]})[_0xd939('0x14')](function(_0x5a0707){if(!_0x5a0707)return _0x305169[_0xd939('0x9')](0x194);return{'url':oauth[_0xd939('0x47')](_0x5a0707,_0x43e727[_0xd939('0x48')]['id'])};})[_0xd939('0x14')](respondWithResult(_0x305169,null))[_0xd939('0x3d')](handleError(_0x305169,null));};exports['oauth2MicrosoftCallback']=function(_0x2d0cc5,_0x3b1cec){var _0x286ff1=_0x2d0cc5['body'];var _0x2a1f46;var _0x11a35d;if(_0x286ff1[_0xd939('0x16')])throw _0x286ff1;redis[_0xd939('0x49')](_0x286ff1[_0xd939('0x4a')])['then'](function(_0x4ab1b9){if(!_0x4ab1b9)throw new Error(_0xd939('0x4b'));_0x2a1f46=JSON[_0xd939('0x4c')](_0x4ab1b9);var _0x56b6dc=Buffer['from'](_0x286ff1[_0xd939('0x4a')],_0xd939('0x4d'))[_0xd939('0x4e')](_0xd939('0x4f'));_0x11a35d=JSON[_0xd939('0x4c')](_0x56b6dc);if(!oauth[_0xd939('0x50')](_0x286ff1['id_token'],_0x2a1f46[_0xd939('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xd939('0x52')](_0x286ff1[_0xd939('0x4a')]);return oauth[_0xd939('0x53')](_0x286ff1[_0xd939('0x54')],_0x2a1f46);})['then'](function(_0x1e222c){_0x2a1f46['data5']=_0x1e222c[_0xd939('0x55')];_0x2a1f46[_0xd939('0x56')]=_0x1e222c[_0xd939('0x57')];return db[_0xd939('0x1c')][_0xd939('0x13')]({'data5':_0x2a1f46['data5'],'data6':_0x2a1f46[_0xd939('0x56')]},{'where':{'id':_0x2a1f46['id']}});})['then'](function(){oauth[_0xd939('0x58')](_0x2a1f46);socket[_0xd939('0x59')](_0xd939('0x5a'),{'id':_0x11a35d['id']});return;})['then'](respondWithStatusCode(_0x3b1cec,null))[_0xd939('0x3d')](function(_0x576577){if(_0x11a35d){socket['emit'](_0xd939('0x5b'),{'id':_0x11a35d['id']});}if(!_0x2a1f46){logger[_0xd939('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x576577);return _0x3b1cec['status'](0x1f4)[_0xd939('0x19')](_0x576577[_0xd939('0x5c')]);}logger[_0xd939('0x16')](_0xd939('0x5d'),_0x2a1f46['id'],_0x576577);});}; \ No newline at end of file +var _0x79c0=['merge','options','include','findAll','rows','service','MicrosoftAzure','data3','catch','show','params','length','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','sendStatus','status','end','offset','undefined','count','Content-Range','json','update','then','error','stack','name','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter'];(function(_0x4c0edb,_0x47f86d){var _0x48279a=function(_0x2071fc){while(--_0x2071fc){_0x4c0edb['push'](_0x4c0edb['shift']());}};_0x48279a(++_0x47f86d);}(_0x79c0,0x153));var _0x079c=function(_0x1c65d1,_0x226704){_0x1c65d1=_0x1c65d1-0x0;var _0xa02c86=_0x79c0[_0x1c65d1];return _0xa02c86;};'use strict';var _=require(_0x079c('0x0'));var Redis=require(_0x079c('0x1'));var qs=require(_0x079c('0x2'));var encryptor=require(_0x079c('0x3'));var config=require(_0x079c('0x4'));var logger=require(_0x079c('0x5'))(_0x079c('0x6'));var db=require(_0x079c('0x7'))['db'];var oauth=require(_0x079c('0x8'));config[_0x079c('0x9')]=_[_0x079c('0xa')](config[_0x079c('0x9')],{'host':_0x079c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x079c('0x9')]));var redis=new Redis(config[_0x079c('0x9')]);function respondWithStatusCode(_0x38e10c,_0x5d8137){_0x5d8137=_0x5d8137||0xcc;return function(_0x437846){if(_0x437846){return _0x38e10c[_0x079c('0xc')](_0x5d8137);}return _0x38e10c[_0x079c('0xd')](_0x5d8137)[_0x079c('0xe')]();};}function respondWithResult(_0x28eba3,_0x5edbde){_0x5edbde=_0x5edbde||0xc8;return function(_0x5e4102){if(_0x5e4102){return _0x28eba3[_0x079c('0xd')](_0x5edbde)['json'](_0x5e4102);}};}function respondWithFilteredResult(_0x7209b5,_0x4e6d07){return function(_0x50d57b){if(_0x50d57b){var _0x1f2bc5=typeof _0x4e6d07[_0x079c('0xf')]===_0x079c('0x10')&&typeof _0x4e6d07['limit']===_0x079c('0x10');var _0x87870a=_0x50d57b[_0x079c('0x11')];var _0x52d22a=_0x1f2bc5?0x0:_0x4e6d07['offset'];var _0x378e57=_0x1f2bc5?_0x50d57b[_0x079c('0x11')]:_0x4e6d07[_0x079c('0xf')]+_0x4e6d07['limit'];var _0x50a0b1;if(_0x378e57>=_0x87870a){_0x378e57=_0x87870a;_0x50a0b1=0xc8;}else{_0x50a0b1=0xce;}_0x7209b5[_0x079c('0xd')](_0x50a0b1);return _0x7209b5['set'](_0x079c('0x12'),_0x52d22a+'-'+_0x378e57+'/'+_0x87870a)[_0x079c('0x13')](_0x50d57b);}return null;};}function saveUpdates(_0x4828fd){return function(_0x15f1a8){if(_0x15f1a8){return _0x15f1a8[_0x079c('0x14')](_0x4828fd)[_0x079c('0x15')](function(_0x2ba182){return _0x2ba182;});}return null;};}function removeEntity(_0xb112b3){return function(_0x51175d){if(_0x51175d){return _0x51175d['destroy']()['then'](function(){_0xb112b3[_0x079c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdde78a){return function(_0x341eba){if(!_0x341eba){_0xdde78a[_0x079c('0xc')](0x194);}return _0x341eba;};}function handleError(_0x3876cf,_0x1ef398){_0x1ef398=_0x1ef398||0x1f4;return function(_0x2773f4){logger[_0x079c('0x16')](_0x2773f4[_0x079c('0x17')]);if(_0x2773f4['name']){delete _0x2773f4[_0x079c('0x18')];}_0x3876cf['status'](_0x1ef398)['send'](_0x2773f4);};}function maskClientSecret(_0x2f26b7){return _[_0x079c('0x19')](_0x2f26b7[_0x079c('0x1a')](0x0,0x3),0x14,'*');}exports[_0x079c('0x1b')]=function(_0x389c88,_0xc9452a){var _0x1019e4={},_0x4d4719={},_0x57aca2={'count':0x0,'rows':[]};var _0x319921=_[_0x079c('0x1c')](db[_0x079c('0x1d')][_0x079c('0x1e')],function(_0x4b208e){return{'name':_0x4b208e[_0x079c('0x1f')],'type':_0x4b208e[_0x079c('0x20')][_0x079c('0x21')]};});_0x4d4719['model']=_[_0x079c('0x1c')](_0x319921,_0x079c('0x18'));_0x4d4719[_0x079c('0x22')]=_[_0x079c('0x23')](_0x389c88['query']);_0x4d4719['filters']=_[_0x079c('0x24')](_0x4d4719[_0x079c('0x25')],_0x4d4719[_0x079c('0x22')]);_0x1019e4['attributes']=_[_0x079c('0x24')](_0x4d4719[_0x079c('0x25')],qs[_0x079c('0x26')](_0x389c88['query']['fields']));_0x1019e4['attributes']=_0x1019e4[_0x079c('0x27')]['length']?_0x1019e4[_0x079c('0x27')]:_0x4d4719['model'];if(!_0x389c88['query'][_0x079c('0x28')](_0x079c('0x29'))){_0x1019e4['limit']=qs[_0x079c('0x2a')](_0x389c88[_0x079c('0x22')]['limit']);_0x1019e4[_0x079c('0xf')]=qs['offset'](_0x389c88[_0x079c('0x22')]['offset']);}_0x1019e4[_0x079c('0x2b')]=qs[_0x079c('0x2c')](_0x389c88[_0x079c('0x22')][_0x079c('0x2c')]);_0x1019e4[_0x079c('0x2d')]=qs[_0x079c('0x2e')](_[_0x079c('0x2f')](_0x389c88[_0x079c('0x22')],_0x4d4719[_0x079c('0x2e')]),_0x319921);if(_0x389c88['query'][_0x079c('0x30')]){_0x1019e4[_0x079c('0x2d')]=_['merge'](_0x1019e4[_0x079c('0x2d')],{'$or':_[_0x079c('0x1c')](_0x319921,function(_0x3827af){if(_0x3827af[_0x079c('0x20')]!=='VIRTUAL'){var _0x23f51f={};_0x23f51f[_0x3827af[_0x079c('0x18')]]={'$like':'%'+_0x389c88['query'][_0x079c('0x30')]+'%'};return _0x23f51f;}})});}_0x1019e4=_[_0x079c('0x31')]({},_0x1019e4,_0x389c88[_0x079c('0x32')]);var _0x34b955={'where':_0x1019e4[_0x079c('0x2d')]};return db[_0x079c('0x1d')][_0x079c('0x11')](_0x34b955)[_0x079c('0x15')](function(_0x75fb39){_0x57aca2['count']=_0x75fb39;if(_0x389c88[_0x079c('0x22')]['includeAll']){_0x1019e4[_0x079c('0x33')]=[{'all':!![]}];}return db['CloudProvider'][_0x079c('0x34')](_0x1019e4);})['then'](function(_0x36b3c4){_0x57aca2[_0x079c('0x35')]=_[_0x079c('0x1c')](_0x36b3c4,function(_0x4be865){if(_0x4be865[_0x079c('0x36')]===_0x079c('0x37')){var _0x3171cb=encryptor['decryptString'](_0x4be865['data3']);_0x4be865[_0x079c('0x38')]=maskClientSecret(_0x3171cb);}return _0x4be865;});return _0x57aca2;})[_0x079c('0x15')](respondWithFilteredResult(_0xc9452a,_0x1019e4))[_0x079c('0x39')](handleError(_0xc9452a,null));};exports[_0x079c('0x3a')]=function(_0x126680,_0xd501a5){var _0x33e87c={'raw':!![],'where':{'id':_0x126680[_0x079c('0x3b')]['id']}},_0xcdf1c9={};_0xcdf1c9[_0x079c('0x25')]=_[_0x079c('0x23')](db[_0x079c('0x1d')][_0x079c('0x1e')]);_0xcdf1c9[_0x079c('0x22')]=_[_0x079c('0x23')](_0x126680[_0x079c('0x22')]);_0xcdf1c9[_0x079c('0x2e')]=_['intersection'](_0xcdf1c9['model'],_0xcdf1c9['query']);_0x33e87c['attributes']=_[_0x079c('0x24')](_0xcdf1c9[_0x079c('0x25')],qs[_0x079c('0x26')](_0x126680[_0x079c('0x22')][_0x079c('0x26')]));_0x33e87c['attributes']=_0x33e87c['attributes'][_0x079c('0x3c')]?_0x33e87c[_0x079c('0x27')]:_0xcdf1c9[_0x079c('0x25')];if(_0x126680[_0x079c('0x22')]['includeAll']){_0x33e87c[_0x079c('0x33')]=[{'all':!![]}];}_0x33e87c=_['merge']({},_0x33e87c,_0x126680['options']);return db[_0x079c('0x1d')][_0x079c('0x3d')](_0x33e87c)[_0x079c('0x15')](handleEntityNotFound(_0xd501a5,null))[_0x079c('0x15')](function(_0x34f1ce){if(_0x34f1ce['service']==='MicrosoftAzure'){var _0x88fe07=encryptor[_0x079c('0x3e')](_0x34f1ce[_0x079c('0x38')]);_0x34f1ce['data3']=maskClientSecret(_0x88fe07);}return _0x34f1ce;})[_0x079c('0x15')](respondWithResult(_0xd501a5,null))[_0x079c('0x39')](handleError(_0xd501a5,null));};exports[_0x079c('0x3f')]=function(_0x52c610,_0x14b677){if(!_0x52c610[_0x079c('0x40')][_0x079c('0x18')])throw new Error(_0x079c('0x41'));if(!_0x52c610[_0x079c('0x40')]['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0xaaee7b=db[_0x079c('0x1d')]['rawAttributes']['service'][_0x079c('0x42')];if(!_0xaaee7b[_0x079c('0x43')](_0x52c610[_0x079c('0x40')]['service']))throw new Error(_0x079c('0x44')+_0xaaee7b[_0x079c('0x45')](',\x20'));if(_0x52c610[_0x079c('0x40')][_0x079c('0x36')]===_0x079c('0x37')&&_0x52c610['body'][_0x079c('0x38')]){_0x52c610[_0x079c('0x40')]['data3']=encryptor[_0x079c('0x46')](_0x52c610['body'][_0x079c('0x38')]);}return db[_0x079c('0x1d')]['create'](_0x52c610[_0x079c('0x40')],{})[_0x079c('0x15')](respondWithResult(_0x14b677,0xc9))[_0x079c('0x39')](handleError(_0x14b677,null));};exports[_0x079c('0x14')]=function(_0x5d43d6,_0x3ca5f9){if(_0x5d43d6[_0x079c('0x40')]['id']){delete _0x5d43d6[_0x079c('0x40')]['id'];}return db[_0x079c('0x1d')][_0x079c('0x3d')]({'where':{'id':_0x5d43d6[_0x079c('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3ca5f9,null))['then'](function(_0x4b42f9){if(_0x4b42f9[_0x079c('0x36')]===_0x079c('0x37')&&_0x5d43d6['body']['data3']){_0x5d43d6['body'][_0x079c('0x38')]=encryptor['encryptString'](_0x5d43d6['body'][_0x079c('0x38')]);}return _0x4b42f9;})[_0x079c('0x15')](saveUpdates(_0x5d43d6['body'],null))['then'](respondWithResult(_0x3ca5f9,null))[_0x079c('0x39')](handleError(_0x3ca5f9,null));};exports[_0x079c('0x47')]=function(_0x5d22ca,_0x3f936d){return db[_0x079c('0x1d')][_0x079c('0x3d')]({'where':{'id':_0x5d22ca[_0x079c('0x3b')]['id']}})[_0x079c('0x15')](handleEntityNotFound(_0x3f936d,null))[_0x079c('0x15')](removeEntity(_0x3f936d,null))[_0x079c('0x39')](handleError(_0x3f936d,null));};exports[_0x079c('0x48')]=function(_0x5f0dcb,_0x5a7a05){return db[_0x079c('0x1d')][_0x079c('0x49')]({'where':{'id':_0x5f0dcb[_0x079c('0x3b')]['id']},'raw':!![]})[_0x079c('0x15')](function(_0x8519b9){if(!_0x8519b9)return _0x5a7a05[_0x079c('0xc')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x8519b9,_0x5f0dcb['user']['id'])};})['then'](respondWithResult(_0x5a7a05,null))[_0x079c('0x39')](handleError(_0x5a7a05,null));};exports[_0x079c('0x4a')]=function(_0x3e3a0d,_0x10fc1e){var _0x139bdf=_0x3e3a0d[_0x079c('0x40')];var _0x2b1051;var _0x2f1164;if(_0x139bdf['error'])throw _0x139bdf;redis[_0x079c('0x4b')](_0x139bdf[_0x079c('0x4c')])['then'](function(_0x591d22){if(!_0x591d22)throw new Error(_0x079c('0x4d'));_0x2b1051=JSON[_0x079c('0x4e')](_0x591d22);var _0x377e37=Buffer[_0x079c('0x4f')](_0x139bdf[_0x079c('0x4c')],_0x079c('0x50'))[_0x079c('0x51')](_0x079c('0x52'));_0x2f1164=JSON[_0x079c('0x4e')](_0x377e37);if(!oauth[_0x079c('0x53')](_0x139bdf['id_token'],_0x2b1051[_0x079c('0x54')]))throw new Error(_0x079c('0x55'));redis[_0x079c('0x56')](_0x139bdf['state']);return oauth[_0x079c('0x57')](_0x139bdf['code'],_0x2b1051);})[_0x079c('0x15')](function(_0x2ac976){_0x2b1051[_0x079c('0x58')]=_0x2ac976['access_token'];_0x2b1051[_0x079c('0x59')]=_0x2ac976[_0x079c('0x5a')];return db[_0x079c('0x1d')][_0x079c('0x14')]({'data5':_0x2b1051['data5'],'data6':_0x2b1051[_0x079c('0x59')]},{'where':{'id':_0x2b1051['id']}});})['then'](function(){oauth[_0x079c('0x5b')](_0x2b1051);socket['emit'](_0x079c('0x5c'),{'id':_0x2f1164['id']});return;})[_0x079c('0x15')](respondWithStatusCode(_0x10fc1e,null))[_0x079c('0x39')](function(_0x1fa182){if(_0x2f1164){socket[_0x079c('0x5d')](_0x079c('0x5e'),{'id':_0x2f1164['id']});}if(!_0x2b1051){logger['error'](_0x079c('0x5f'),_0x1fa182);return _0x10fc1e[_0x079c('0xd')](0x1f4)['send'](_0x1fa182['message']);}logger[_0x079c('0x16')](_0x079c('0x60'),_0x2b1051['id'],_0x1fa182);});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index cfe9762..d4921f4 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 _0xc812=['CloudProvider','lodash','util','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x166ad7,_0x2ecdec){var _0xe9ec91=function(_0xcfc260){while(--_0xcfc260){_0x166ad7['push'](_0x166ad7['shift']());}};_0xe9ec91(++_0x2ecdec);}(_0xc812,0x8d));var _0x2c81=function(_0xe26339,_0x3866d3){_0xe26339=_0xe26339-0x0;var _0x233e8c=_0xc812[_0xe26339];return _0x233e8c;};'use strict';var _=require(_0x2c81('0x0'));var util=require(_0x2c81('0x1'));var logger=require('../../config/logger')(_0x2c81('0x2'));var moment=require(_0x2c81('0x3'));var BPromise=require(_0x2c81('0x4'));var rp=require(_0x2c81('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2c81('0x6'));var attributes=require('./cloudProvider.attributes');module[_0x2c81('0x7')]=function(_0x3221c0,_0x43dae5){return _0x3221c0[_0x2c81('0x8')](_0x2c81('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ac1=['CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xfbfd77,_0x920bcd){var _0x2ede18=function(_0x15a590){while(--_0x15a590){_0xfbfd77['push'](_0xfbfd77['shift']());}};_0x2ede18(++_0x920bcd);}(_0x7ac1,0x9c));var _0x17ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ac1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x17ac('0x0'));var util=require(_0x17ac('0x1'));var logger=require('../../config/logger')(_0x17ac('0x2'));var moment=require(_0x17ac('0x3'));var BPromise=require(_0x17ac('0x4'));var rp=require(_0x17ac('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ac('0x6'));var config=require(_0x17ac('0x7'));var attributes=require('./cloudProvider.attributes');module[_0x17ac('0x8')]=function(_0x935941,_0x42c226){return _0x935941['define'](_0x17ac('0x9'),attributes,{'tableName':_0x17ac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index d298ee7..ee899bc 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 _0xc4aa=['defaults','localhost','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','from','stringify','toString','randomBytes','hex','client_id','data1','redirect_uri','response_mode','form_post','scope','state','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','nonce','isAfter','resolve','then','data3','findOne','refresh_token','data6','data4','decryptString','POST','data5','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','bind','all','inspect','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis'];(function(_0x1142da,_0x4ee9cb){var _0x234ff9=function(_0x17365d){while(--_0x17365d){_0x1142da['push'](_0x1142da['shift']());}};_0x234ff9(++_0x4ee9cb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var crypto=require(_0xac4a('0x1'));var jwt=require(_0xac4a('0x2'));var moment=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var util=require('util');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xac4a('0x6'))(_0xac4a('0x7'));var schedule=require(_0xac4a('0x8'));var db=require(_0xac4a('0x9'))['db'];config[_0xac4a('0xa')]=_[_0xac4a('0xb')](config[_0xac4a('0xa')],{'host':_0xac4a('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xac4a('0xd'),_0xac4a('0xe'),_0xac4a('0xf'),'offline_access',_0xac4a('0x10'),_0xac4a('0x11'),_0xac4a('0x12')],'Dynamics365':['openid',_0xac4a('0x13')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xac4a('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4855b6){var _0x333ca5=_[_0xac4a('0x15')](AZURE_AUTH_SCOPES[_0x4855b6[_0xac4a('0x16')]]);if(_0x4855b6['type']===_0xac4a('0x17'))_0x333ca5[_0xac4a('0x18')](_0x4855b6[_0xac4a('0x19')]+_0xac4a('0x1a'));return _0x333ca5[_0xac4a('0x1b')]('\x20');}function getAccessTokenScope(_0x3b71c0){if(_0x3b71c0[_0xac4a('0x16')]===_0xac4a('0x1c'))return _0xac4a('0x10');if(_0x3b71c0[_0xac4a('0x16')]===_0xac4a('0x17'))return _0x3b71c0[_0xac4a('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x402fff,_0x34d797){var _0x23eb66=MICROSOFT_AUTH_URL[_0xac4a('0x1d')](_0xac4a('0x1e'),_0x402fff[_0xac4a('0x1f')]);var _0x28e304=[_0xac4a('0x20'),'id_token'];var _0x5ac21e=Buffer[_0xac4a('0x21')](JSON[_0xac4a('0x22')]({'id':_0x34d797}))[_0xac4a('0x23')]('base64');var _0x39e83e=crypto[_0xac4a('0x24')](0x10)[_0xac4a('0x23')](_0xac4a('0x25'));var _0x123694=getAuthorizationScopes(_0x402fff);var _0x3e829c=[{'key':_0xac4a('0x26'),'value':_0x402fff[_0xac4a('0x27')]},{'key':'response_type','value':encodeURIComponent(_0x28e304[_0xac4a('0x1b')]('\x20'))},{'key':_0xac4a('0x28'),'value':_0x402fff['data4']},{'key':_0xac4a('0x29'),'value':_0xac4a('0x2a')},{'key':_0xac4a('0x2b'),'value':encodeURIComponent(_0x123694)},{'key':_0xac4a('0x2c'),'value':_0x5ac21e},{'key':'nonce','value':_0x39e83e},{'key':_0xac4a('0x2d'),'value':_0xac4a('0x2e')}];var _0x15435c=_0x23eb66+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xac4a('0x15')](_0x3e829c,function(_0x594f36){return _0x594f36[_0xac4a('0x2f')]+'='+_0x594f36[_0xac4a('0x30')];})[_0xac4a('0x1b')]('&');_0x402fff[_0xac4a('0x31')]={'issuer':_0x23eb66[_0xac4a('0x1d')](_0xac4a('0x32'),''),'audience':_0x402fff[_0xac4a('0x27')],'state':_0x5ac21e,'nonce':_0x39e83e};redis[_0xac4a('0x33')](_0x5ac21e,JSON[_0xac4a('0x22')](_0x402fff));return _0x15435c;}function isValidIdToken(_0x1c13dc,_0x20202c){try{var _0x4e17ce=jwt[_0xac4a('0x34')](_0x1c13dc,{'complete':!![]});var _0x267a22=_0x4e17ce[_0xac4a('0x35')];if(_0x267a22[_0xac4a('0x36')]!==_0x20202c[_0xac4a('0x37')])return![];if(_0x267a22['aud']!==_0x20202c['audience'])return![];if(_0x267a22[_0xac4a('0x38')]!==_0x20202c[_0xac4a('0x38')])return![];if(moment()[_0xac4a('0x39')](moment['unix'](_0x267a22['exp'])))return![];return!![];}catch(_0x355755){throw _0x355755;}}function refreshOauth2MicrosoftAccessToken(_0x2896bc){return Promise[_0xac4a('0x3a')]()[_0xac4a('0x3b')](function(){if(_0x2896bc[_0xac4a('0x3c')])return _0x2896bc;return db['CloudProvider'][_0xac4a('0x3d')]({'where':{'id':_0x2896bc['id']},'raw':!![]});})['then'](function(_0x30364b){var _0x57adcf={'grant_type':_0xac4a('0x3e'),'refresh_token':_0x30364b[_0xac4a('0x3f')],'scope':getAccessTokenScope(_0x30364b),'redirect_uri':_0x30364b[_0xac4a('0x40')],'client_id':_0x30364b[_0xac4a('0x27')],'client_secret':encryptor[_0xac4a('0x41')](_0x30364b[_0xac4a('0x3c')])};var _0xbd4591={'method':_0xac4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0xac4a('0x1d')](_0xac4a('0x1e'),_0x30364b[_0xac4a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x57adcf,'json':!![]};return rp(_0xbd4591);})[_0xac4a('0x3b')](function(_0x1a9be2){_0x2896bc[_0xac4a('0x43')]=_0x1a9be2['access_token'];_0x2896bc[_0xac4a('0x3f')]=_0x1a9be2[_0xac4a('0x3e')];return db['CloudProvider'][_0xac4a('0x44')]({'data5':_0x2896bc[_0xac4a('0x43')],'data6':_0x2896bc['data6']},{'where':{'id':_0x2896bc['id']}});})['then'](function(){return _0x2896bc;})[_0xac4a('0x45')](function(_0x1ba096){logger[_0xac4a('0x46')](_0xac4a('0x47'),_0x2896bc['id'],_0x1ba096);});}function getOauth2MicrosoftAccessToken(_0x4f5986,_0x453d02){var _0x2e56c6={'grant_type':'authorization_code','code':_0x4f5986,'scope':getAccessTokenScope(_0x453d02),'redirect_uri':_0x453d02[_0xac4a('0x40')],'client_id':_0x453d02[_0xac4a('0x27')],'client_secret':encryptor[_0xac4a('0x41')](_0x453d02['data3'])};var _0x121328={'method':_0xac4a('0x42'),'uri':MICROSOFT_AUTH_URL[_0xac4a('0x1d')]('{TENANT_ID}',_0x453d02[_0xac4a('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2e56c6,'json':!![]};return rp(_0x121328);}function startRefreshInterval(_0x2e76e3){var _0x4b9faf=schedule['intervals'];if(_0x4b9faf[_0x2e76e3['id']])clearInterval(_0x4b9faf[_0x2e76e3['id']]);_0x4b9faf[_0x2e76e3['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xac4a('0x48')](this,{'id':_0x2e76e3['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4b9faf;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x41b757){var _0x2bf8e8=_0x41b757[_0xac4a('0x15')](function(_0x472484){return refreshOauth2MicrosoftAccessToken(_0x472484)[_0xac4a('0x3b')](function(_0x415f31){startRefreshInterval(_0x415f31);});});return Promise[_0xac4a('0x49')](_0x2bf8e8);})[_0xac4a('0x45')](function(_0x28292c){var _0x1f7721=_0x28292c?util[_0xac4a('0x4a')](_0x28292c,{'showHidden':![],'depth':null}):'';logger[_0xac4a('0x46')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart',_0x1f7721);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xdb28=['set','decode','payload','iss','issuer','aud','audience','isAfter','resolve','data3','findOne','then','data6','POST','data5','access_token','refresh_token','CloudProvider','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s','decryptString','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart','exports','lodash','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','data7','/.default','join','Outlook365','Dynamics365','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','base64','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','nonce','key','value','oauth2Claims','data1'];(function(_0x39f256,_0x30b5a6){var _0x9d8751=function(_0x82be06){while(--_0x82be06){_0x39f256['push'](_0x39f256['shift']());}};_0x9d8751(++_0x30b5a6);}(_0xdb28,0x106));var _0x8db2=function(_0x28f800,_0x1cda36){_0x28f800=_0x28f800-0x0;var _0x10dde3=_0xdb28[_0x28f800];return _0x10dde3;};'use strict';var _=require(_0x8db2('0x0'));var crypto=require(_0x8db2('0x1'));var jwt=require(_0x8db2('0x2'));var moment=require(_0x8db2('0x3'));var Redis=require('ioredis');var rp=require(_0x8db2('0x4'));var util=require(_0x8db2('0x5'));var encryptor=require(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var logger=require(_0x8db2('0x8'))('api');var schedule=require(_0x8db2('0x9'));var db=require(_0x8db2('0xa'))['db'];config['redis']=_['defaults'](config[_0x8db2('0xb')],{'host':_0x8db2('0xc'),'port':0x18eb});var redis=new Redis(config[_0x8db2('0xb')]);var MICROSOFT_AUTH_URL=_0x8db2('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),'offline_access',_0x8db2('0x11'),_0x8db2('0x12'),_0x8db2('0x13')],'Dynamics365':['openid',_0x8db2('0x14')]};var MICROSOFT_AUTH_ENDPOINT=_0x8db2('0x15');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x41beda){var _0x3b2faa=_[_0x8db2('0x16')](AZURE_AUTH_SCOPES[_0x41beda[_0x8db2('0x17')]]);if(_0x41beda[_0x8db2('0x17')]==='Dynamics365')_0x3b2faa['push'](_0x41beda[_0x8db2('0x18')]+_0x8db2('0x19'));return _0x3b2faa[_0x8db2('0x1a')]('\x20');}function getAccessTokenScope(_0x1d6a15){if(_0x1d6a15[_0x8db2('0x17')]===_0x8db2('0x1b'))return _0x8db2('0x11');if(_0x1d6a15[_0x8db2('0x17')]===_0x8db2('0x1c'))return _0x1d6a15[_0x8db2('0x18')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x13b0f5,_0x24da1b){var _0x48101e=MICROSOFT_AUTH_URL[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x13b0f5[_0x8db2('0x1f')]);var _0x3fddc2=[_0x8db2('0x20'),_0x8db2('0x21')];var _0x51d60d=Buffer['from'](JSON[_0x8db2('0x22')]({'id':_0x24da1b}))[_0x8db2('0x23')](_0x8db2('0x24'));var _0x1b64e4=crypto['randomBytes'](0x10)[_0x8db2('0x23')](_0x8db2('0x25'));var _0x260940=getAuthorizationScopes(_0x13b0f5);var _0x297ba3=[{'key':_0x8db2('0x26'),'value':_0x13b0f5['data1']},{'key':_0x8db2('0x27'),'value':encodeURIComponent(_0x3fddc2[_0x8db2('0x1a')]('\x20'))},{'key':_0x8db2('0x28'),'value':_0x13b0f5[_0x8db2('0x29')]},{'key':_0x8db2('0x2a'),'value':_0x8db2('0x2b')},{'key':_0x8db2('0x2c'),'value':encodeURIComponent(_0x260940)},{'key':'state','value':_0x51d60d},{'key':_0x8db2('0x2d'),'value':_0x1b64e4},{'key':'prompt','value':'login'}];var _0x52a9ca=_0x48101e+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x297ba3,function(_0xec8cd2){return _0xec8cd2[_0x8db2('0x2e')]+'='+_0xec8cd2[_0x8db2('0x2f')];})[_0x8db2('0x1a')]('&');_0x13b0f5[_0x8db2('0x30')]={'issuer':_0x48101e[_0x8db2('0x1d')]('oauth2/',''),'audience':_0x13b0f5[_0x8db2('0x31')],'state':_0x51d60d,'nonce':_0x1b64e4};redis[_0x8db2('0x32')](_0x51d60d,JSON[_0x8db2('0x22')](_0x13b0f5));return _0x52a9ca;}function isValidIdToken(_0x8b7cec,_0x483aee){try{var _0x2e0691=jwt[_0x8db2('0x33')](_0x8b7cec,{'complete':!![]});var _0x241baf=_0x2e0691[_0x8db2('0x34')];if(_0x241baf[_0x8db2('0x35')]!==_0x483aee[_0x8db2('0x36')])return![];if(_0x241baf[_0x8db2('0x37')]!==_0x483aee[_0x8db2('0x38')])return![];if(_0x241baf[_0x8db2('0x2d')]!==_0x483aee['nonce'])return![];if(moment()[_0x8db2('0x39')](moment['unix'](_0x241baf['exp'])))return![];return!![];}catch(_0x302188){throw _0x302188;}}function refreshOauth2MicrosoftAccessToken(_0x25ed2c){return Promise[_0x8db2('0x3a')]()['then'](function(){if(_0x25ed2c[_0x8db2('0x3b')])return _0x25ed2c;return db['CloudProvider'][_0x8db2('0x3c')]({'where':{'id':_0x25ed2c['id']},'raw':!![]});})[_0x8db2('0x3d')](function(_0x14bd12){var _0x4d9e26={'grant_type':'refresh_token','refresh_token':_0x14bd12[_0x8db2('0x3e')],'scope':getAccessTokenScope(_0x14bd12),'redirect_uri':_0x14bd12[_0x8db2('0x29')],'client_id':_0x14bd12['data1'],'client_secret':encryptor['decryptString'](_0x14bd12[_0x8db2('0x3b')])};var _0x5178f3={'method':_0x8db2('0x3f'),'uri':MICROSOFT_AUTH_URL[_0x8db2('0x1d')](_0x8db2('0x1e'),_0x14bd12[_0x8db2('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4d9e26,'json':!![]};return rp(_0x5178f3);})[_0x8db2('0x3d')](function(_0xae31b7){_0x25ed2c[_0x8db2('0x40')]=_0xae31b7[_0x8db2('0x41')];_0x25ed2c['data6']=_0xae31b7[_0x8db2('0x42')];return db[_0x8db2('0x43')]['update']({'data5':_0x25ed2c[_0x8db2('0x40')],'data6':_0x25ed2c[_0x8db2('0x3e')]},{'where':{'id':_0x25ed2c['id']}});})['then'](function(){return _0x25ed2c;})['catch'](function(_0x3c1983){logger['error'](_0x8db2('0x44'),_0x25ed2c['id'],_0x3c1983);});}function getOauth2MicrosoftAccessToken(_0x264696,_0x26717d){var _0x22c896={'grant_type':'authorization_code','code':_0x264696,'scope':getAccessTokenScope(_0x26717d),'redirect_uri':_0x26717d[_0x8db2('0x29')],'client_id':_0x26717d['data1'],'client_secret':encryptor[_0x8db2('0x45')](_0x26717d[_0x8db2('0x3b')])};var _0x2c8bc9={'method':_0x8db2('0x3f'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x26717d[_0x8db2('0x1f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x22c896,'json':!![]};return rp(_0x2c8bc9);}function startRefreshInterval(_0x2c0507){var _0x5dc2b4=schedule[_0x8db2('0x46')];if(_0x5dc2b4[_0x2c0507['id']])clearInterval(_0x5dc2b4[_0x2c0507['id']]);_0x5dc2b4[_0x2c0507['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8db2('0x47')](this,{'id':_0x2c0507['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8db2('0x46')]=_0x5dc2b4;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x8db2('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8db2('0x3d')](function(_0x953349){var _0x279e74=_0x953349[_0x8db2('0x16')](function(_0x40d82a){return refreshOauth2MicrosoftAccessToken(_0x40d82a)[_0x8db2('0x3d')](function(_0x1575ea){startRefreshInterval(_0x1575ea);});});return Promise[_0x8db2('0x49')](_0x279e74);})[_0x8db2('0x4a')](function(_0x21cf7c){var _0x20bf0b=_0x21cf7c?util[_0x8db2('0x4b')](_0x21cf7c,{'showHidden':![],'depth':null}):'';logger['error'](_0x8db2('0x4c'),_0x20bf0b);});}module[_0x8db2('0x4d')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8a06e00..efd523e 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 _0xd26f=['request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x445543,_0x2e5bdb){var _0xd8c51a=function(_0x2dac17){while(--_0x2dac17){_0x445543['push'](_0x445543['shift']());}};_0xd8c51a(++_0x2e5bdb);}(_0xd26f,0x113));var _0xfd26=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xd26f[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});} \ No newline at end of file +var _0xe5fc=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x19c5f2,_0x44ed13){var _0xb94caf=function(_0x1b3522){while(--_0x1b3522){_0x19c5f2['push'](_0x19c5f2['shift']());}};_0xb94caf(++_0x44ed13);}(_0xe5fc,0x109));var _0xce5f=function(_0x5cb0e7,_0x2eaaa8){_0x5cb0e7=_0x5cb0e7-0x0;var _0x445c05=_0xe5fc[_0x5cb0e7];return _0x445c05;};'use strict';var _=require(_0xce5f('0x0'));var util=require('util');var moment=require(_0xce5f('0x1'));var BPromise=require(_0xce5f('0x2'));var rs=require(_0xce5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce5f('0x4'))('rpc');var config=require(_0xce5f('0x5'));var jayson=require(_0xce5f('0x6'));var client=jayson[_0xce5f('0x7')][_0xce5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ef,_0x30a150,_0x2b64dc){return new BPromise(function(_0x3451af,_0x4fa651){return client[_0xce5f('0x9')](_0x3b77ef,_0x2b64dc)[_0xce5f('0xa')](function(_0x29a7bf){logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));logger[_0xce5f('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x30a150,_0xce5f('0xd'),JSON[_0xce5f('0xf')](_0x29a7bf));if(_0x29a7bf[_0xce5f('0x10')]){if(_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x11')]===0x1f4){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x4fa651(_0x29a7bf['error']['message']);}logger['error'](_0xce5f('0xc'),_0x30a150,_0x29a7bf[_0xce5f('0x10')][_0xce5f('0x12')]);return _0x3451af(_0x29a7bf[_0xce5f('0x10')]['message']);}else{logger[_0xce5f('0xb')](_0xce5f('0xc'),_0x30a150,_0xce5f('0xd'));_0x3451af(_0x29a7bf[_0xce5f('0x13')][_0xce5f('0x12')]);}})[_0xce5f('0x14')](function(_0x1544ba){logger[_0xce5f('0x10')](_0xce5f('0xc'),_0x30a150,_0x1544ba);_0x4fa651(_0x1544ba);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 91d60e8..9934ccf 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x4342f5,_0x32b52d){var _0x220026=function(_0x650b28){while(--_0x650b28){_0x4342f5['push'](_0x4342f5['shift']());}};_0x220026(++_0x32b52d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file +var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0xe7135f,_0x269493){var _0x4aac76=function(_0xe439d2){while(--_0xe439d2){_0xe7135f['push'](_0xe7135f['shift']());}};_0x4aac76(++_0x269493);}(_0xdb28,0x106));var _0x8db2=function(_0x396615,_0x4963){_0x396615=_0x396615-0x0;var _0x58f209=_0xdb28[_0x396615];return _0x58f209;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ff8023e..80814da 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 _0x4cd4=['STRING','name','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4cd4,0x112));var _0x44cd=function(_0x37f69e,_0xbc3019){_0x37f69e=_0x37f69e-0x0;var _0x308ae9=_0x4cd4[_0x37f69e];return _0x308ae9;};'use strict';var Sequelize=require(_0x44cd('0x0'));module[_0x44cd('0x1')]={'name':{'type':Sequelize[_0x44cd('0x2')],'unique':_0x44cd('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x44cd('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x44cd('0x2')]},'fax':{'type':Sequelize[_0x44cd('0x2')]},'type':{'type':Sequelize[_0x44cd('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x44cd('0x2')]},'country':{'type':Sequelize[_0x44cd('0x2')]},'email':{'type':Sequelize[_0x44cd('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x44cd('0x2')]},'sStreet':{'type':Sequelize[_0x44cd('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x44cd('0x2')]},'sCountry':{'type':Sequelize[_0x44cd('0x2')]},'description':{'type':Sequelize[_0x44cd('0x2')]}}; \ No newline at end of file +var _0xb0d2=['exports','STRING','name','sequelize'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb0d2,0x1cf));var _0x2b0d=function(_0x1028d6,_0x50f22e){_0x1028d6=_0x1028d6-0x0;var _0x427a81=_0xb0d2[_0x1028d6];return _0x427a81;};'use strict';var Sequelize=require(_0x2b0d('0x0'));module[_0x2b0d('0x1')]={'name':{'type':Sequelize[_0x2b0d('0x2')],'unique':_0x2b0d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x2b0d('0x2')]},'companyId':{'type':Sequelize[_0x2b0d('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2b0d('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2b0d('0x2')]},'street':{'type':Sequelize[_0x2b0d('0x2')]},'postalCode':{'type':Sequelize[_0x2b0d('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x2b0d('0x2')]},'email':{'type':Sequelize[_0x2b0d('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x2b0d('0x2')]},'sPostalCode':{'type':Sequelize[_0x2b0d('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x2b0d('0x2')]},'description':{'type':Sequelize[_0x2b0d('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 1dba5f3..51350d8 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 _0x5e6a=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Companies','stack','name','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','CmCompany','rows','catch','show','rawAttributes','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','CmContact','ids','omit','findOne','getContacts','nolimit','eml-format','rimraf','zip-dir','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service'];(function(_0x179a45,_0x4ab8fe){var _0x55685=function(_0xd14902){while(--_0xd14902){_0x179a45['push'](_0x179a45['shift']());}};_0x55685(++_0x4ab8fe);}(_0x5e6a,0x18d));var _0xa5e6=function(_0x24f1e6,_0x1f2633){_0x24f1e6=_0x24f1e6-0x0;var _0x1f2d11=_0x5e6a[_0x24f1e6];return _0x1f2d11;};'use strict';var emlformat=require(_0xa5e6('0x0'));var rimraf=require(_0xa5e6('0x1'));var zipdir=require(_0xa5e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5e6('0x3'));var util=require(_0xa5e6('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xa5e6('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5e6('0x6'));var _=require(_0xa5e6('0x7'));var squel=require(_0xa5e6('0x8'));var crypto=require('crypto');var jsforce=require(_0xa5e6('0x9'));var deskjs=require(_0xa5e6('0xa'));var toCsv=require(_0xa5e6('0x5'));var querystring=require(_0xa5e6('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa5e6('0xc'));var qs=require(_0xa5e6('0xd'));var as=require(_0xa5e6('0xe'));var hardwareService=require(_0xa5e6('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa5e6('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5e6('0x11'))['db'];function respondWithStatusCode(_0x1c21b2,_0x1fdabc){_0x1fdabc=_0x1fdabc||0xcc;return function(_0x5e22e4){if(_0x5e22e4){return _0x1c21b2['sendStatus'](_0x1fdabc);}return _0x1c21b2[_0xa5e6('0x12')](_0x1fdabc)[_0xa5e6('0x13')]();};}function respondWithResult(_0x7fc102,_0x5f0963){_0x5f0963=_0x5f0963||0xc8;return function(_0x1e7aea){if(_0x1e7aea){return _0x7fc102[_0xa5e6('0x12')](_0x5f0963)[_0xa5e6('0x14')](_0x1e7aea);}};}function respondWithFilteredResult(_0x5f083e,_0x3fa3a1){return function(_0x404aa2){if(_0x404aa2){var _0x4f6589=typeof _0x3fa3a1['offset']===_0xa5e6('0x15')&&typeof _0x3fa3a1['limit']===_0xa5e6('0x15');var _0x2c2aac=_0x404aa2['count'];var _0x3c3bae=_0x4f6589?0x0:_0x3fa3a1[_0xa5e6('0x16')];var _0x462477=_0x4f6589?_0x404aa2[_0xa5e6('0x17')]:_0x3fa3a1[_0xa5e6('0x16')]+_0x3fa3a1[_0xa5e6('0x18')];var _0x4da819;if(_0x462477>=_0x2c2aac){_0x462477=_0x2c2aac;_0x4da819=0xc8;}else{_0x4da819=0xce;}_0x5f083e[_0xa5e6('0x12')](_0x4da819);return _0x5f083e[_0xa5e6('0x19')](_0xa5e6('0x1a'),_0x3c3bae+'-'+_0x462477+'/'+_0x2c2aac)[_0xa5e6('0x14')](_0x404aa2);}return null;};}function patchUpdates(_0x3f7ced){return function(_0x37f10b){try{jsonpatch[_0xa5e6('0x1b')](_0x37f10b,_0x3f7ced,!![]);}catch(_0x356946){return BPromise[_0xa5e6('0x1c')](_0x356946);}return _0x37f10b[_0xa5e6('0x1d')]();};}function saveUpdates(_0x38418b,_0x2ce25e){return function(_0xcbde86){if(_0xcbde86){return _0xcbde86[_0xa5e6('0x1e')](_0x38418b)['then'](function(_0x1f32d0){return _0x1f32d0;});}return null;};}function removeEntity(_0xc0fbd,_0x17c898){return function(_0xc59ef3){if(_0xc59ef3){return _0xc59ef3[_0xa5e6('0x1f')]()[_0xa5e6('0x20')](function(){var _0x1a1ee9=_0xc59ef3[_0xa5e6('0x21')]({'plain':!![]});var _0xa4de63=_0xa5e6('0x22');return db['UserProfileResource'][_0xa5e6('0x1f')]({'where':{'type':_0xa4de63,'resourceId':_0x1a1ee9['id']}})[_0xa5e6('0x20')](function(){return _0xc59ef3;});})[_0xa5e6('0x20')](function(){_0xc0fbd['status'](0xcc)[_0xa5e6('0x13')]();});}};}function handleEntityNotFound(_0x15a638,_0x5d0c40){return function(_0x3c8e43){if(!_0x3c8e43){_0x15a638['sendStatus'](0x194);}return _0x3c8e43;};}function handleError(_0xf6bae7,_0x4bdc69){_0x4bdc69=_0x4bdc69||0x1f4;return function(_0x1ee483){logger['error'](_0x1ee483[_0xa5e6('0x23')]);if(_0x1ee483['name']){delete _0x1ee483[_0xa5e6('0x24')];}_0xf6bae7['status'](_0x4bdc69)['send'](_0x1ee483);};}exports['index']=function(_0x281dcc,_0x58bf37){var _0x516f70={},_0x117137={},_0x4a8daa={'count':0x0,'rows':[]};return db['CmCompany'][_0xa5e6('0x25')]()[_0xa5e6('0x20')](function(_0x585158){_0x117137[_0xa5e6('0x26')]=_[_0xa5e6('0x27')](_0x585158);_0x117137[_0xa5e6('0x28')]=_['keys'](_0x281dcc['query']);_0x117137[_0xa5e6('0x29')]=_[_0xa5e6('0x2a')](_0x117137['model'],_0x117137[_0xa5e6('0x28')]);_0x516f70[_0xa5e6('0x2b')]=_[_0xa5e6('0x2a')](_0x117137[_0xa5e6('0x26')],qs[_0xa5e6('0x2c')](_0x281dcc[_0xa5e6('0x28')][_0xa5e6('0x2c')]));_0x516f70['attributes']=_0x516f70[_0xa5e6('0x2b')]['length']?_0x516f70[_0xa5e6('0x2b')]:_0x117137[_0xa5e6('0x26')];if(!_0x281dcc[_0xa5e6('0x28')][_0xa5e6('0x2d')]('nolimit')){_0x516f70['limit']=qs['limit'](_0x281dcc['query'][_0xa5e6('0x18')]);_0x516f70[_0xa5e6('0x16')]=qs[_0xa5e6('0x16')](_0x281dcc['query']['offset']);}_0x516f70[_0xa5e6('0x2e')]=qs[_0xa5e6('0x2f')](_0x281dcc[_0xa5e6('0x28')][_0xa5e6('0x2f')]);_0x516f70[_0xa5e6('0x30')]=qs[_0xa5e6('0x29')](_[_0xa5e6('0x31')](_0x281dcc[_0xa5e6('0x28')],_0x117137[_0xa5e6('0x29')]),_0x585158);if(_0x281dcc[_0xa5e6('0x28')][_0xa5e6('0x32')]){_0x516f70[_0xa5e6('0x30')]=_[_0xa5e6('0x33')](_0x516f70[_0xa5e6('0x30')],{'$or':_[_0xa5e6('0x34')](_0x516f70['attributes'],function(_0x367cfd){var _0x22f2be={};_0x22f2be[_0x367cfd]={'$like':'%'+_0x281dcc[_0xa5e6('0x28')][_0xa5e6('0x32')]+'%'};return _0x22f2be;})});}_0x516f70=_[_0xa5e6('0x33')]({},_0x516f70,_0x281dcc[_0xa5e6('0x35')]);var _0x4b9eb8={'where':_0x516f70[_0xa5e6('0x30')]};return db[_0xa5e6('0x36')]['count'](_0x4b9eb8)[_0xa5e6('0x20')](function(_0x5595c3){_0x4a8daa[_0xa5e6('0x17')]=_0x5595c3;if(_0x281dcc[_0xa5e6('0x28')]['includeAll']){_0x516f70['include']=[{'all':!![]}];}return db[_0xa5e6('0x36')]['findAll'](_0x516f70);})[_0xa5e6('0x20')](function(_0x1c3fe2){_0x4a8daa[_0xa5e6('0x37')]=_0x1c3fe2;return _0x4a8daa;})[_0xa5e6('0x20')](respondWithFilteredResult(_0x58bf37,_0x516f70))['catch'](handleError(_0x58bf37,null));})[_0xa5e6('0x38')](handleError(_0x58bf37,null));};exports[_0xa5e6('0x39')]=function(_0x3984cc,_0x5225d6){var _0x22906f={'raw':![],'where':{'id':_0x3984cc['params']['id']}},_0x17e767={};_0x17e767[_0xa5e6('0x26')]=_[_0xa5e6('0x27')](db[_0xa5e6('0x36')][_0xa5e6('0x3a')]);_0x17e767[_0xa5e6('0x28')]=_[_0xa5e6('0x27')](_0x3984cc[_0xa5e6('0x28')]);_0x17e767[_0xa5e6('0x29')]=_[_0xa5e6('0x2a')](_0x17e767[_0xa5e6('0x26')],_0x17e767[_0xa5e6('0x28')]);_0x22906f[_0xa5e6('0x2b')]=_[_0xa5e6('0x2a')](_0x17e767['model'],qs['fields'](_0x3984cc[_0xa5e6('0x28')][_0xa5e6('0x2c')]));_0x22906f['attributes']=_0x22906f[_0xa5e6('0x2b')][_0xa5e6('0x3b')]?_0x22906f[_0xa5e6('0x2b')]:_0x17e767[_0xa5e6('0x26')];if(_0x3984cc[_0xa5e6('0x28')][_0xa5e6('0x3c')]){_0x22906f[_0xa5e6('0x3d')]=[{'all':!![]}];}_0x22906f=_[_0xa5e6('0x33')]({},_0x22906f,_0x3984cc[_0xa5e6('0x35')]);return db[_0xa5e6('0x36')][_0xa5e6('0x3e')](_0x22906f)['then'](handleEntityNotFound(_0x5225d6,null))[_0xa5e6('0x20')](respondWithResult(_0x5225d6,null))[_0xa5e6('0x38')](handleError(_0x5225d6,null));};exports[_0xa5e6('0x3f')]=function(_0x2de0d1,_0xca0844){return db[_0xa5e6('0x36')][_0xa5e6('0x3f')](_0x2de0d1[_0xa5e6('0x40')],{})[_0xa5e6('0x20')](function(_0xdf8ebe){var _0x27c663=_0x2de0d1[_0xa5e6('0x41')][_0xa5e6('0x21')]({'plain':!![]});if(!_0x27c663)throw new Error(_0xa5e6('0x42'));if(_0x27c663[_0xa5e6('0x43')]==='user'){var _0x5125bf=_0xdf8ebe[_0xa5e6('0x21')]({'plain':!![]});var _0x156880=_0xa5e6('0x22');return db[_0xa5e6('0x44')]['find']({'where':{'name':_0x156880,'userProfileId':_0x27c663[_0xa5e6('0x45')]},'raw':!![]})[_0xa5e6('0x20')](function(_0x19e803){if(_0x19e803&&_0x19e803[_0xa5e6('0x46')]===0x0){return db[_0xa5e6('0x47')][_0xa5e6('0x3f')]({'name':_0x5125bf[_0xa5e6('0x24')],'resourceId':_0x5125bf['id'],'type':_0x19e803[_0xa5e6('0x24')],'sectionId':_0x19e803['id']},{})[_0xa5e6('0x20')](function(){return _0xdf8ebe;});}else{return _0xdf8ebe;}})['catch'](function(_0x370a31){logger[_0xa5e6('0x48')](_0xa5e6('0x49'),_0x370a31);throw _0x370a31;});}return _0xdf8ebe;})[_0xa5e6('0x20')](respondWithResult(_0xca0844,0xc9))[_0xa5e6('0x38')](handleError(_0xca0844,null));};exports[_0xa5e6('0x1e')]=function(_0x33e7ef,_0x156c1b){if(_0x33e7ef[_0xa5e6('0x40')]['id']){delete _0x33e7ef[_0xa5e6('0x40')]['id'];}return db[_0xa5e6('0x36')]['find']({'where':{'id':_0x33e7ef[_0xa5e6('0x4a')]['id']}})[_0xa5e6('0x20')](handleEntityNotFound(_0x156c1b,null))['then'](saveUpdates(_0x33e7ef[_0xa5e6('0x40')],null))[_0xa5e6('0x20')](respondWithResult(_0x156c1b,null))['catch'](handleError(_0x156c1b,null));};exports[_0xa5e6('0x1f')]=function(_0x4f0b81,_0x7a9141){return db[_0xa5e6('0x36')][_0xa5e6('0x3e')]({'where':{'id':_0x4f0b81[_0xa5e6('0x4a')]['id']}})[_0xa5e6('0x20')](handleEntityNotFound(_0x7a9141,null))[_0xa5e6('0x20')](removeEntity(_0x7a9141,null))[_0xa5e6('0x38')](handleError(_0x7a9141,null));};exports['describe']=function(_0x16662b,_0x412832){return db[_0xa5e6('0x36')][_0xa5e6('0x25')]()[_0xa5e6('0x20')](respondWithResult(_0x412832,null))[_0xa5e6('0x38')](handleError(_0x412832,null));};exports[_0xa5e6('0x4b')]=function(_0x27fefa,_0x1fcd88,_0x42c9dd){return db[_0xa5e6('0x4c')][_0xa5e6('0x3e')]({'where':{'id':_0x27fefa[_0xa5e6('0x4a')]['id']}})[_0xa5e6('0x20')](handleEntityNotFound(_0x1fcd88,null))[_0xa5e6('0x20')](function(_0x224ecc){if(_0x224ecc){return _0x224ecc[_0xa5e6('0x4b')](_0x27fefa['body'][_0xa5e6('0x4d')],_[_0xa5e6('0x4e')](_0x27fefa[_0xa5e6('0x40')],['ids','id'])||{});}})[_0xa5e6('0x20')](respondWithResult(_0x1fcd88,null))['catch'](handleError(_0x1fcd88,null));};exports['getContacts']=function(_0x5d8434,_0x3a478d,_0x17b6bd){var _0x2ed77e={};var _0x22a941={};var _0x450045;var _0x55a81f;return db['CmCompany'][_0xa5e6('0x4f')]({'where':{'id':_0x5d8434['params']['id']}})[_0xa5e6('0x20')](handleEntityNotFound(_0x3a478d,null))[_0xa5e6('0x20')](function(_0x71a1fd){if(_0x71a1fd){_0x450045=_0x71a1fd;_0x22a941['model']=_[_0xa5e6('0x27')](db[_0xa5e6('0x4c')][_0xa5e6('0x3a')]);_0x22a941[_0xa5e6('0x28')]=_['keys'](_0x5d8434[_0xa5e6('0x28')]);_0x22a941['filters']=_[_0xa5e6('0x2a')](_0x22a941[_0xa5e6('0x26')],_0x22a941[_0xa5e6('0x28')]);_0x2ed77e[_0xa5e6('0x2b')]=_[_0xa5e6('0x2a')](_0x22a941[_0xa5e6('0x26')],qs[_0xa5e6('0x2c')](_0x5d8434['query'][_0xa5e6('0x2c')]));_0x2ed77e['attributes']=_0x2ed77e['attributes'][_0xa5e6('0x3b')]?_0x2ed77e[_0xa5e6('0x2b')]:_0x22a941[_0xa5e6('0x26')];_0x2ed77e[_0xa5e6('0x2e')]=qs[_0xa5e6('0x2f')](_0x5d8434['query']['sort']);_0x2ed77e[_0xa5e6('0x30')]=qs[_0xa5e6('0x29')](_[_0xa5e6('0x31')](_0x5d8434[_0xa5e6('0x28')],_0x22a941[_0xa5e6('0x29')]));if(_0x5d8434[_0xa5e6('0x28')]['filter']){_0x2ed77e[_0xa5e6('0x30')]=_[_0xa5e6('0x33')](_0x2ed77e[_0xa5e6('0x30')],{'$or':_['map'](_0x2ed77e[_0xa5e6('0x2b')],function(_0x290746){var _0xadf54d={};_0xadf54d[_0x290746]={'$like':'%'+_0x5d8434['query'][_0xa5e6('0x32')]+'%'};return _0xadf54d;})});}_0x2ed77e=_['merge']({},_0x2ed77e,_0x5d8434['options']);return _0x450045[_0xa5e6('0x50')](_0x2ed77e);}})[_0xa5e6('0x20')](function(_0x4dfb4d){if(_0x4dfb4d){_0x55a81f=_0x4dfb4d['length'];if(!_0x5d8434[_0xa5e6('0x28')][_0xa5e6('0x2d')](_0xa5e6('0x51'))){_0x2ed77e['limit']=qs['limit'](_0x5d8434[_0xa5e6('0x28')]['limit']);_0x2ed77e[_0xa5e6('0x16')]=qs[_0xa5e6('0x16')](_0x5d8434['query']['offset']);}return _0x450045[_0xa5e6('0x50')](_0x2ed77e);}})[_0xa5e6('0x20')](function(_0x3208d5){if(_0x3208d5){return _0x3208d5?{'count':_0x55a81f,'rows':_0x3208d5}:null;}})['then'](respondWithResult(_0x3a478d,null))['catch'](handleError(_0x3a478d,null));}; \ No newline at end of file +var _0x24a2=['UserProfileResource','destroy','error','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','options','include','findAll','catch','show','params','rawAttributes','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','addContacts','CmContact','ids','omit','findOne','order','pick','eml-format','rimraf','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','Companies'];(function(_0x410d79,_0x12d643){var _0x33c6ad=function(_0x3a8efc){while(--_0x3a8efc){_0x410d79['push'](_0x410d79['shift']());}};_0x33c6ad(++_0x12d643);}(_0x24a2,0x184));var _0x224a=function(_0x2176d8,_0x5ea25e){_0x2176d8=_0x2176d8-0x0;var _0x4f399a=_0x24a2[_0x2176d8];return _0x4f399a;};'use strict';var emlformat=require(_0x224a('0x0'));var rimraf=require(_0x224a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x224a('0x2'));var moment=require(_0x224a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x224a('0x4'));var util=require(_0x224a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x224a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x224a('0x7'));var _=require(_0x224a('0x8'));var squel=require(_0x224a('0x9'));var crypto=require(_0x224a('0xa'));var jsforce=require(_0x224a('0xb'));var deskjs=require(_0x224a('0xc'));var toCsv=require(_0x224a('0x6'));var querystring=require(_0x224a('0xd'));var Papa=require(_0x224a('0xe'));var Redis=require(_0x224a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x224a('0x10'));var hardwareService=require(_0x224a('0x11'));var logger=require(_0x224a('0x12'))(_0x224a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x224a('0x14'))['db'];function respondWithStatusCode(_0x374c5d,_0x2d7cc8){_0x2d7cc8=_0x2d7cc8||0xcc;return function(_0x56d56b){if(_0x56d56b){return _0x374c5d[_0x224a('0x15')](_0x2d7cc8);}return _0x374c5d[_0x224a('0x16')](_0x2d7cc8)[_0x224a('0x17')]();};}function respondWithResult(_0x2f2ccc,_0x15b749){_0x15b749=_0x15b749||0xc8;return function(_0x1dc451){if(_0x1dc451){return _0x2f2ccc[_0x224a('0x16')](_0x15b749)['json'](_0x1dc451);}};}function respondWithFilteredResult(_0x529fce,_0x5558f8){return function(_0x55c8ec){if(_0x55c8ec){var _0x2107ca=typeof _0x5558f8[_0x224a('0x18')]===_0x224a('0x19')&&typeof _0x5558f8['limit']===_0x224a('0x19');var _0x59a912=_0x55c8ec['count'];var _0x119e0b=_0x2107ca?0x0:_0x5558f8[_0x224a('0x18')];var _0x34a57c=_0x2107ca?_0x55c8ec[_0x224a('0x1a')]:_0x5558f8['offset']+_0x5558f8[_0x224a('0x1b')];var _0x132c4d;if(_0x34a57c>=_0x59a912){_0x34a57c=_0x59a912;_0x132c4d=0xc8;}else{_0x132c4d=0xce;}_0x529fce[_0x224a('0x16')](_0x132c4d);return _0x529fce[_0x224a('0x1c')](_0x224a('0x1d'),_0x119e0b+'-'+_0x34a57c+'/'+_0x59a912)[_0x224a('0x1e')](_0x55c8ec);}return null;};}function patchUpdates(_0x5e6146){return function(_0x52e1f0){try{jsonpatch[_0x224a('0x1f')](_0x52e1f0,_0x5e6146,!![]);}catch(_0x3ce3f1){return BPromise[_0x224a('0x20')](_0x3ce3f1);}return _0x52e1f0[_0x224a('0x21')]();};}function saveUpdates(_0x592447,_0x420d0f){return function(_0x357a1d){if(_0x357a1d){return _0x357a1d[_0x224a('0x22')](_0x592447)['then'](function(_0x289a42){return _0x289a42;});}return null;};}function removeEntity(_0x43a1a3,_0x23a4a5){return function(_0x1d3683){if(_0x1d3683){return _0x1d3683['destroy']()[_0x224a('0x23')](function(){var _0x5d46ed=_0x1d3683['get']({'plain':!![]});var _0x3bf442=_0x224a('0x24');return db[_0x224a('0x25')][_0x224a('0x26')]({'where':{'type':_0x3bf442,'resourceId':_0x5d46ed['id']}})['then'](function(){return _0x1d3683;});})[_0x224a('0x23')](function(){_0x43a1a3['status'](0xcc)[_0x224a('0x17')]();});}};}function handleEntityNotFound(_0xa6101d,_0x1b3eb8){return function(_0x37644b){if(!_0x37644b){_0xa6101d[_0x224a('0x15')](0x194);}return _0x37644b;};}function handleError(_0x56eb31,_0x4ff35c){_0x4ff35c=_0x4ff35c||0x1f4;return function(_0x59789f){logger[_0x224a('0x27')](_0x59789f['stack']);if(_0x59789f[_0x224a('0x28')]){delete _0x59789f[_0x224a('0x28')];}_0x56eb31['status'](_0x4ff35c)[_0x224a('0x29')](_0x59789f);};}exports[_0x224a('0x2a')]=function(_0x1d1bc6,_0x2c141e){var _0xb0de9b={},_0x7374a4={},_0x3458c2={'count':0x0,'rows':[]};return db[_0x224a('0x2b')][_0x224a('0x2c')]()[_0x224a('0x23')](function(_0x48cf7d){_0x7374a4[_0x224a('0x2d')]=_[_0x224a('0x2e')](_0x48cf7d);_0x7374a4[_0x224a('0x2f')]=_[_0x224a('0x2e')](_0x1d1bc6['query']);_0x7374a4[_0x224a('0x30')]=_[_0x224a('0x31')](_0x7374a4['model'],_0x7374a4[_0x224a('0x2f')]);_0xb0de9b[_0x224a('0x32')]=_[_0x224a('0x31')](_0x7374a4[_0x224a('0x2d')],qs[_0x224a('0x33')](_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x33')]));_0xb0de9b['attributes']=_0xb0de9b['attributes'][_0x224a('0x34')]?_0xb0de9b['attributes']:_0x7374a4[_0x224a('0x2d')];if(!_0x1d1bc6['query'][_0x224a('0x35')](_0x224a('0x36'))){_0xb0de9b['limit']=qs[_0x224a('0x1b')](_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x1b')]);_0xb0de9b[_0x224a('0x18')]=qs[_0x224a('0x18')](_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x18')]);}_0xb0de9b['order']=qs[_0x224a('0x37')](_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x37')]);_0xb0de9b[_0x224a('0x38')]=qs['filters'](_['pick'](_0x1d1bc6[_0x224a('0x2f')],_0x7374a4[_0x224a('0x30')]),_0x48cf7d);if(_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x39')]){_0xb0de9b[_0x224a('0x38')]=_[_0x224a('0x3a')](_0xb0de9b[_0x224a('0x38')],{'$or':_[_0x224a('0x3b')](_0xb0de9b[_0x224a('0x32')],function(_0x51541d){var _0x394f6a={};_0x394f6a[_0x51541d]={'$like':'%'+_0x1d1bc6[_0x224a('0x2f')][_0x224a('0x39')]+'%'};return _0x394f6a;})});}_0xb0de9b=_[_0x224a('0x3a')]({},_0xb0de9b,_0x1d1bc6[_0x224a('0x3c')]);var _0x3a29ae={'where':_0xb0de9b['where']};return db[_0x224a('0x2b')]['count'](_0x3a29ae)['then'](function(_0x34797d){_0x3458c2[_0x224a('0x1a')]=_0x34797d;if(_0x1d1bc6['query']['includeAll']){_0xb0de9b[_0x224a('0x3d')]=[{'all':!![]}];}return db[_0x224a('0x2b')][_0x224a('0x3e')](_0xb0de9b);})[_0x224a('0x23')](function(_0x494d93){_0x3458c2['rows']=_0x494d93;return _0x3458c2;})[_0x224a('0x23')](respondWithFilteredResult(_0x2c141e,_0xb0de9b))['catch'](handleError(_0x2c141e,null));})[_0x224a('0x3f')](handleError(_0x2c141e,null));};exports[_0x224a('0x40')]=function(_0x2a6b26,_0x33756f){var _0x44223a={'raw':![],'where':{'id':_0x2a6b26[_0x224a('0x41')]['id']}},_0x4cccce={};_0x4cccce[_0x224a('0x2d')]=_[_0x224a('0x2e')](db[_0x224a('0x2b')][_0x224a('0x42')]);_0x4cccce[_0x224a('0x2f')]=_[_0x224a('0x2e')](_0x2a6b26[_0x224a('0x2f')]);_0x4cccce[_0x224a('0x30')]=_[_0x224a('0x31')](_0x4cccce[_0x224a('0x2d')],_0x4cccce[_0x224a('0x2f')]);_0x44223a[_0x224a('0x32')]=_['intersection'](_0x4cccce['model'],qs[_0x224a('0x33')](_0x2a6b26['query'][_0x224a('0x33')]));_0x44223a[_0x224a('0x32')]=_0x44223a[_0x224a('0x32')][_0x224a('0x34')]?_0x44223a[_0x224a('0x32')]:_0x4cccce['model'];if(_0x2a6b26[_0x224a('0x2f')]['includeAll']){_0x44223a[_0x224a('0x3d')]=[{'all':!![]}];}_0x44223a=_[_0x224a('0x3a')]({},_0x44223a,_0x2a6b26['options']);return db[_0x224a('0x2b')]['find'](_0x44223a)[_0x224a('0x23')](handleEntityNotFound(_0x33756f,null))[_0x224a('0x23')](respondWithResult(_0x33756f,null))[_0x224a('0x3f')](handleError(_0x33756f,null));};exports[_0x224a('0x43')]=function(_0x4646ac,_0x3efa19){return db[_0x224a('0x2b')][_0x224a('0x43')](_0x4646ac[_0x224a('0x44')],{})[_0x224a('0x23')](function(_0xac592f){var _0x4e073c=_0x4646ac['user'][_0x224a('0x45')]({'plain':!![]});if(!_0x4e073c)throw new Error(_0x224a('0x46'));if(_0x4e073c[_0x224a('0x47')]===_0x224a('0x48')){var _0x134dbf=_0xac592f[_0x224a('0x45')]({'plain':!![]});var _0x16981a=_0x224a('0x24');return db[_0x224a('0x49')][_0x224a('0x4a')]({'where':{'name':_0x16981a,'userProfileId':_0x4e073c[_0x224a('0x4b')]},'raw':!![]})[_0x224a('0x23')](function(_0x42ea38){if(_0x42ea38&&_0x42ea38[_0x224a('0x4c')]===0x0){return db[_0x224a('0x25')][_0x224a('0x43')]({'name':_0x134dbf[_0x224a('0x28')],'resourceId':_0x134dbf['id'],'type':_0x42ea38['name'],'sectionId':_0x42ea38['id']},{})[_0x224a('0x23')](function(){return _0xac592f;});}else{return _0xac592f;}})['catch'](function(_0x59eb37){logger[_0x224a('0x27')](_0x224a('0x4d'),_0x59eb37);throw _0x59eb37;});}return _0xac592f;})[_0x224a('0x23')](respondWithResult(_0x3efa19,0xc9))[_0x224a('0x3f')](handleError(_0x3efa19,null));};exports[_0x224a('0x22')]=function(_0x135a2c,_0x10ecde){if(_0x135a2c[_0x224a('0x44')]['id']){delete _0x135a2c[_0x224a('0x44')]['id'];}return db[_0x224a('0x2b')][_0x224a('0x4a')]({'where':{'id':_0x135a2c['params']['id']}})[_0x224a('0x23')](handleEntityNotFound(_0x10ecde,null))[_0x224a('0x23')](saveUpdates(_0x135a2c[_0x224a('0x44')],null))[_0x224a('0x23')](respondWithResult(_0x10ecde,null))[_0x224a('0x3f')](handleError(_0x10ecde,null));};exports[_0x224a('0x26')]=function(_0x59d503,_0x5fb84){return db[_0x224a('0x2b')][_0x224a('0x4a')]({'where':{'id':_0x59d503[_0x224a('0x41')]['id']}})[_0x224a('0x23')](handleEntityNotFound(_0x5fb84,null))[_0x224a('0x23')](removeEntity(_0x5fb84,null))['catch'](handleError(_0x5fb84,null));};exports['describe']=function(_0x49b910,_0x23f51b){return db[_0x224a('0x2b')][_0x224a('0x2c')]()[_0x224a('0x23')](respondWithResult(_0x23f51b,null))[_0x224a('0x3f')](handleError(_0x23f51b,null));};exports[_0x224a('0x4e')]=function(_0x4dfc7d,_0x451a5f,_0x4942eb){return db[_0x224a('0x4f')][_0x224a('0x4a')]({'where':{'id':_0x4dfc7d[_0x224a('0x41')]['id']}})[_0x224a('0x23')](handleEntityNotFound(_0x451a5f,null))['then'](function(_0x571599){if(_0x571599){return _0x571599[_0x224a('0x4e')](_0x4dfc7d['body'][_0x224a('0x50')],_[_0x224a('0x51')](_0x4dfc7d[_0x224a('0x44')],[_0x224a('0x50'),'id'])||{});}})[_0x224a('0x23')](respondWithResult(_0x451a5f,null))[_0x224a('0x3f')](handleError(_0x451a5f,null));};exports['getContacts']=function(_0x440409,_0x54edf6,_0x2a1c80){var _0x2b8f71={};var _0x58bd26={};var _0xe093e3;var _0x454f60;return db['CmCompany'][_0x224a('0x52')]({'where':{'id':_0x440409[_0x224a('0x41')]['id']}})[_0x224a('0x23')](handleEntityNotFound(_0x54edf6,null))['then'](function(_0x24d505){if(_0x24d505){_0xe093e3=_0x24d505;_0x58bd26[_0x224a('0x2d')]=_[_0x224a('0x2e')](db[_0x224a('0x4f')]['rawAttributes']);_0x58bd26[_0x224a('0x2f')]=_[_0x224a('0x2e')](_0x440409['query']);_0x58bd26[_0x224a('0x30')]=_[_0x224a('0x31')](_0x58bd26[_0x224a('0x2d')],_0x58bd26[_0x224a('0x2f')]);_0x2b8f71['attributes']=_[_0x224a('0x31')](_0x58bd26[_0x224a('0x2d')],qs[_0x224a('0x33')](_0x440409[_0x224a('0x2f')][_0x224a('0x33')]));_0x2b8f71[_0x224a('0x32')]=_0x2b8f71[_0x224a('0x32')][_0x224a('0x34')]?_0x2b8f71['attributes']:_0x58bd26[_0x224a('0x2d')];_0x2b8f71[_0x224a('0x53')]=qs['sort'](_0x440409[_0x224a('0x2f')]['sort']);_0x2b8f71[_0x224a('0x38')]=qs[_0x224a('0x30')](_[_0x224a('0x54')](_0x440409[_0x224a('0x2f')],_0x58bd26[_0x224a('0x30')]));if(_0x440409[_0x224a('0x2f')]['filter']){_0x2b8f71[_0x224a('0x38')]=_[_0x224a('0x3a')](_0x2b8f71[_0x224a('0x38')],{'$or':_[_0x224a('0x3b')](_0x2b8f71[_0x224a('0x32')],function(_0x528cc1){var _0x3363e1={};_0x3363e1[_0x528cc1]={'$like':'%'+_0x440409[_0x224a('0x2f')][_0x224a('0x39')]+'%'};return _0x3363e1;})});}_0x2b8f71=_[_0x224a('0x3a')]({},_0x2b8f71,_0x440409['options']);return _0xe093e3['getContacts'](_0x2b8f71);}})[_0x224a('0x23')](function(_0x24bc2a){if(_0x24bc2a){_0x454f60=_0x24bc2a['length'];if(!_0x440409[_0x224a('0x2f')]['hasOwnProperty']('nolimit')){_0x2b8f71[_0x224a('0x1b')]=qs[_0x224a('0x1b')](_0x440409[_0x224a('0x2f')]['limit']);_0x2b8f71['offset']=qs[_0x224a('0x18')](_0x440409[_0x224a('0x2f')][_0x224a('0x18')]);}return _0xe093e3['getContacts'](_0x2b8f71);}})[_0x224a('0x23')](function(_0x34cba0){if(_0x34cba0){return _0x34cba0?{'count':_0x454f60,'rows':_0x34cba0}:null;}})[_0x224a('0x23')](respondWithResult(_0x54edf6,null))[_0x224a('0x3f')](handleError(_0x54edf6,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 0d7e97e..00ab923 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 _0xa0a9=['bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','cm_companies','lodash','../../config/logger','api'];(function(_0x3eebec,_0x33de1d){var _0x422046=function(_0x5141b3){while(--_0x5141b3){_0x3eebec['push'](_0x3eebec['shift']());}};_0x422046(++_0x33de1d);}(_0xa0a9,0x147));var _0x9a0a=function(_0x56464a,_0x3551ba){_0x56464a=_0x56464a-0x0;var _0x25a4a9=_0xa0a9[_0x56464a];return _0x25a4a9;};'use strict';var _=require(_0x9a0a('0x0'));var util=require('util');var logger=require(_0x9a0a('0x1'))(_0x9a0a('0x2'));var moment=require('moment');var BPromise=require(_0x9a0a('0x3'));var rp=require(_0x9a0a('0x4'));var fs=require('fs');var path=require(_0x9a0a('0x5'));var rimraf=require(_0x9a0a('0x6'));var config=require(_0x9a0a('0x7'));var attributes=require(_0x9a0a('0x8'));module[_0x9a0a('0x9')]=function(_0x93c93c,_0x54a361){return _0x93c93c['define']('CmCompany',attributes,{'tableName':_0x9a0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfca3=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany','cm_companies'];(function(_0x49e048,_0x2df03e){var _0x520e5f=function(_0x1056b9){while(--_0x1056b9){_0x49e048['push'](_0x49e048['shift']());}};_0x520e5f(++_0x2df03e);}(_0xfca3,0x1bc));var _0x3fca=function(_0x4d1b6c,_0x3bbcae){_0x4d1b6c=_0x4d1b6c-0x0;var _0x59fb36=_0xfca3[_0x4d1b6c];return _0x59fb36;};'use strict';var _=require(_0x3fca('0x0'));var util=require('util');var logger=require(_0x3fca('0x1'))(_0x3fca('0x2'));var moment=require(_0x3fca('0x3'));var BPromise=require(_0x3fca('0x4'));var rp=require(_0x3fca('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fca('0x6'));var config=require(_0x3fca('0x7'));var attributes=require(_0x3fca('0x8'));module['exports']=function(_0x974a87,_0x362db9){return _0x974a87[_0x3fca('0x9')](_0x3fca('0xa'),attributes,{'tableName':_0x3fca('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 d428a26..1e9e8d0 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 _0x05c7=['code','CmCompany,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x158e9d,_0x1a32f4){var _0x17ef6f=function(_0x2d0e37){while(--_0x2d0e37){_0x158e9d['push'](_0x158e9d['shift']());}};_0x17ef6f(++_0x1a32f4);}(_0x05c7,0x98));var _0x705c=function(_0x52eea3,_0x299541){_0x52eea3=_0x52eea3-0x0;var _0xf03aaf=_0x05c7[_0x52eea3];return _0xf03aaf;};'use strict';var _=require(_0x705c('0x0'));var util=require(_0x705c('0x1'));var moment=require(_0x705c('0x2'));var BPromise=require(_0x705c('0x3'));var rs=require(_0x705c('0x4'));var fs=require('fs');var Redis=require(_0x705c('0x5'));var db=require(_0x705c('0x6'))['db'];var utils=require(_0x705c('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x705c('0x8')][_0x705c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e062a,_0x532dcb,_0x18d80f){return new BPromise(function(_0x5800ae,_0x1b9152){return client[_0x705c('0xa')](_0x1e062a,_0x18d80f)[_0x705c('0xb')](function(_0x10711b){logger['info']('CmCompany,\x20%s,\x20%s',_0x532dcb,'request\x20sent');logger[_0x705c('0xc')](_0x705c('0xd'),_0x532dcb,_0x705c('0xe'),JSON['stringify'](_0x10711b));if(_0x10711b[_0x705c('0xf')]){if(_0x10711b['error'][_0x705c('0x10')]===0x1f4){logger[_0x705c('0xf')](_0x705c('0x11'),_0x532dcb,_0x10711b[_0x705c('0xf')]['message']);return _0x1b9152(_0x10711b['error'][_0x705c('0x12')]);}logger[_0x705c('0xf')](_0x705c('0x11'),_0x532dcb,_0x10711b[_0x705c('0xf')]['message']);return _0x5800ae(_0x10711b[_0x705c('0xf')][_0x705c('0x12')]);}else{logger[_0x705c('0x13')]('CmCompany,\x20%s,\x20%s',_0x532dcb,_0x705c('0xe'));_0x5800ae(_0x10711b[_0x705c('0x14')][_0x705c('0x12')]);}})['catch'](function(_0x348a77){logger[_0x705c('0xf')]('CmCompany,\x20%s,\x20%s',_0x532dcb,_0x348a77);_0x1b9152(_0x348a77);});});} \ No newline at end of file +var _0x1659=['client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x41cb3d,_0x2fc15d){var _0x325c46=function(_0x2df030){while(--_0x2df030){_0x41cb3d['push'](_0x41cb3d['shift']());}};_0x325c46(++_0x2fc15d);}(_0x1659,0x122));var _0x9165=function(_0x3278bf,_0x1295bd){_0x3278bf=_0x3278bf-0x0;var _0x550490=_0x1659[_0x3278bf];return _0x550490;};'use strict';var _=require(_0x9165('0x0'));var util=require(_0x9165('0x1'));var moment=require('moment');var BPromise=require(_0x9165('0x2'));var rs=require(_0x9165('0x3'));var fs=require('fs');var Redis=require(_0x9165('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9165('0x5'));var logger=require(_0x9165('0x6'))(_0x9165('0x7'));var config=require(_0x9165('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9165('0x9')][_0x9165('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3a6834,_0x1e0476,_0x5add25){return new BPromise(function(_0xacc4f5,_0x405087){return client[_0x9165('0xb')](_0x3a6834,_0x5add25)[_0x9165('0xc')](function(_0x45f1f1){logger[_0x9165('0xd')]('CmCompany,\x20%s,\x20%s',_0x1e0476,_0x9165('0xe'));logger[_0x9165('0xf')](_0x9165('0x10'),_0x1e0476,_0x9165('0xe'),JSON[_0x9165('0x11')](_0x45f1f1));if(_0x45f1f1[_0x9165('0x12')]){if(_0x45f1f1['error'][_0x9165('0x13')]===0x1f4){logger[_0x9165('0x12')](_0x9165('0x14'),_0x1e0476,_0x45f1f1[_0x9165('0x12')][_0x9165('0x15')]);return _0x405087(_0x45f1f1['error'][_0x9165('0x15')]);}logger['error'](_0x9165('0x14'),_0x1e0476,_0x45f1f1[_0x9165('0x12')][_0x9165('0x15')]);return _0xacc4f5(_0x45f1f1[_0x9165('0x12')][_0x9165('0x15')]);}else{logger[_0x9165('0xd')](_0x9165('0x14'),_0x1e0476,_0x9165('0xe'));_0xacc4f5(_0x45f1f1[_0x9165('0x16')][_0x9165('0x15')]);}})['catch'](function(_0x35ea61){logger['error'](_0x9165('0x14'),_0x1e0476,_0x35ea61);_0x405087(_0x35ea61);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 267aec1..fe8ff30 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 _0x256c=['show','/:id/contacts','getContacts','addContacts','put','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x1fb9fc,_0x24cb60){var _0x33787e=function(_0x40b237){while(--_0x40b237){_0x1fb9fc['push'](_0x1fb9fc['shift']());}};_0x33787e(++_0x24cb60);}(_0x256c,0x16f));var _0xc256=function(_0x1d3b9f,_0x27fccc){_0x1d3b9f=_0x1d3b9f-0x0;var _0x110629=_0x256c[_0x1d3b9f];return _0x110629;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc256('0x0'));var timeout=require(_0xc256('0x1'));var express=require('express');var router=express[_0xc256('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc256('0x3'));var interaction=require(_0xc256('0x4'));var config=require('../../config/environment');var controller=require(_0xc256('0x5'));router[_0xc256('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc256('0x7'),auth[_0xc256('0x8')](),controller[_0xc256('0x9')]);router[_0xc256('0x6')](_0xc256('0xa'),auth['isAuthenticated'](),controller[_0xc256('0xb')]);router[_0xc256('0x6')](_0xc256('0xc'),auth[_0xc256('0x8')](),controller[_0xc256('0xd')]);router['post']('/',auth[_0xc256('0x8')](),controller['create']);router['post'](_0xc256('0xc'),auth[_0xc256('0x8')](),controller[_0xc256('0xe')]);router[_0xc256('0xf')]('/:id',auth[_0xc256('0x8')](),controller['update']);router[_0xc256('0x10')]('/:id',auth[_0xc256('0x8')](),controller[_0xc256('0x11')]);module['exports']=router; \ No newline at end of file +var _0x51ca=['getContacts','create','post','/:id/contacts','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','show'];(function(_0x12d103,_0x108394){var _0x1f9ad5=function(_0xce4a66){while(--_0xce4a66){_0x12d103['push'](_0x12d103['shift']());}};_0x1f9ad5(++_0x108394);}(_0x51ca,0x1ea));var _0xa51c=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x51ca[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0xa51c('0x0'));var util=require(_0xa51c('0x1'));var path=require(_0xa51c('0x2'));var timeout=require('connect-timeout');var express=require(_0xa51c('0x3'));var router=express[_0xa51c('0x4')]();var fs_extra=require(_0xa51c('0x5'));var auth=require(_0xa51c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa51c('0x7'));var controller=require(_0xa51c('0x8'));router[_0xa51c('0x9')]('/',auth[_0xa51c('0xa')](),controller[_0xa51c('0xb')]);router[_0xa51c('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xa51c('0xc')]);router[_0xa51c('0x9')]('/:id',auth[_0xa51c('0xa')](),controller[_0xa51c('0xd')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xa51c('0xe')]);router['post']('/',auth[_0xa51c('0xa')](),controller[_0xa51c('0xf')]);router[_0xa51c('0x10')](_0xa51c('0x11'),auth['isAuthenticated'](),controller['addContacts']);router[_0xa51c('0x12')](_0xa51c('0x13'),auth['isAuthenticated'](),controller[_0xa51c('0x14')]);router[_0xa51c('0x15')](_0xa51c('0x13'),auth['isAuthenticated'](),controller[_0xa51c('0x16')]);module[_0xa51c('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 4711c88..1087bd7 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 _0x8e77=['sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash'];(function(_0x3dc357,_0x26577d){var _0x1110f5=function(_0x4985d5){while(--_0x4985d5){_0x3dc357['push'](_0x3dc357['shift']());}};_0x1110f5(++_0x26577d);}(_0x8e77,0x77));var _0x78e7=function(_0x4ad0f7,_0x1920b0){_0x4ad0f7=_0x4ad0f7-0x0;var _0x30f5c8=_0x8e77[_0x4ad0f7];return _0x30f5c8;};'use strict';var _=require(_0x78e7('0x0'));var Sequelize=require(_0x78e7('0x1'));module[_0x78e7('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x78e7('0x3')]},'street':{'type':Sequelize[_0x78e7('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x78e7('0x3')]},'country':{'type':Sequelize[_0x78e7('0x3')]},'dateOfBirth':{'type':Sequelize[_0x78e7('0x3')]},'description':{'type':Sequelize[_0x78e7('0x4')]},'phone':{'type':Sequelize[_0x78e7('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x78e7('0x3')]},'email':{'type':Sequelize[_0x78e7('0x3')]},'url':{'type':Sequelize[_0x78e7('0x3')]},'facebook':{'type':Sequelize[_0x78e7('0x3')]},'fb_data':{'type':Sequelize[_0x78e7('0x3')]},'twitter':{'type':Sequelize[_0x78e7('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x78e7('0x3')]},'viber':{'type':Sequelize[_0x78e7('0x3')]},'line':{'type':Sequelize[_0x78e7('0x3')]},'wechat':{'type':Sequelize[_0x78e7('0x3')]},'telegram':{'type':Sequelize[_0x78e7('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x78e7('0x5')](0x2)[_0x78e7('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x78e7('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x6863=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6863,0x1c2));var _0x3686=function(_0x339441,_0x2f06fb){_0x339441=_0x339441-0x0;var _0x1bb4d8=_0x6863[_0x339441];return _0x1bb4d8;};'use strict';var _=require(_0x3686('0x0'));var Sequelize=require(_0x3686('0x1'));module[_0x3686('0x2')]={'firstName':{'type':Sequelize[_0x3686('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3686('0x3')]},'street':{'type':Sequelize[_0x3686('0x3')]},'postalCode':{'type':Sequelize[_0x3686('0x3')]},'city':{'type':Sequelize[_0x3686('0x3')]},'country':{'type':Sequelize[_0x3686('0x3')]},'dateOfBirth':{'type':Sequelize[_0x3686('0x3')]},'description':{'type':Sequelize[_0x3686('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3686('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3686('0x3')]},'url':{'type':Sequelize[_0x3686('0x3')]},'facebook':{'type':Sequelize[_0x3686('0x3')]},'fb_data':{'type':Sequelize[_0x3686('0x3')]},'twitter':{'type':Sequelize[_0x3686('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x3686('0x3')]},'viber':{'type':Sequelize[_0x3686('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x3686('0x3')]},'telegram':{'type':Sequelize[_0x3686('0x3')]},'UserId':{'type':Sequelize[_0x3686('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x3686('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3686('0x7')],'defaultValue':Sequelize[_0x3686('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index e2352bb..1f753cc 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 _0xb9ca=['then','end','error','name','send','index','CmContact','describe','keys','length','push','CmCustomField','trimStart','cf_','all','fieldType','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','from','tools_tags','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','Tag','value','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','dateOfBirth','castTo','buildExpression','text','filter','isNil','Contact','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','User','getLists','c.ListId\x20IS\x20NULL','map','agent','sequelize','toString','keyBy','merge','c.firstName','c.phone','c.mobile','c.fax','c.email','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','tags','startsWith','columnName','displayName','analytics','findAll','alias','custom','type','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','WhatsappMessage','bulkCreate','each','duplicates','$or','findOrCreate','show','params','color','omit','format','cf_%d','$and','pickBy','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','options','setTags','ids','getHoppers','findOne','rawAttributes','ContactId','includeAll','include','getJscriptySessions','JscriptySessionReport','binding_values','No\x20association\x20values\x20specified!','binding_keys','Incorrect\x20binding\x20parameters\x20passed!','firstName','root','server/files/tmp','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','file','parse','meta','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','getJourney','mail','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','UserId','fullname','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','thirdDisposition','key','Owner','browserName','customerPort','osName','ratingMessage','ratingType','referer','subject','substatus','Interaction','flatten','moment','bluebird','path','squel','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./cmContact.socket','register','status','offset','limit','undefined','count','set','json','update','destroy'];(function(_0x2a8cb7,_0x314d29){var _0x183a1f=function(_0x7f65bc){while(--_0x7f65bc){_0x2a8cb7['push'](_0x2a8cb7['shift']());}};_0x183a1f(++_0x314d29);}(_0xb9ca,0xfb));var _0xab9c=function(_0x59bc4b,_0x145ddb){_0x59bc4b=_0x59bc4b-0x0;var _0x21af1b=_0xb9ca[_0x59bc4b];return _0x21af1b;};'use strict';var moment=require(_0xab9c('0x0'));var BPromise=require(_0xab9c('0x1'));var util=require('util');var path=require(_0xab9c('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xab9c('0x3'));var Papa=require('papaparse');var Redis=require(_0xab9c('0x4'));var qs=require(_0xab9c('0x5'));var as=require(_0xab9c('0x6'));var logger=require(_0xab9c('0x7'))(_0xab9c('0x8'));var config=require(_0xab9c('0x9'));var db=require(_0xab9c('0xa'))['db'];config['redis']=_[_0xab9c('0xb')](config[_0xab9c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xab9c('0xd'))(new Redis(config[_0xab9c('0xc')]));require(_0xab9c('0xe'))[_0xab9c('0xf')](socket);function respondWithResult(_0x336506,_0x1e7486){_0x1e7486=_0x1e7486||0xc8;return function(_0x34d9c3){if(_0x34d9c3){return _0x336506[_0xab9c('0x10')](_0x1e7486)['json'](_0x34d9c3);}};}function respondWithFilteredResult(_0x582c25,_0x197ccf){return function(_0x1af770){if(_0x1af770){var _0x47cf58=typeof _0x197ccf[_0xab9c('0x11')]==='undefined'&&typeof _0x197ccf[_0xab9c('0x12')]===_0xab9c('0x13');var _0x2ce8a4=_0x1af770[_0xab9c('0x14')];var _0x4feaae=_0x47cf58?0x0:_0x197ccf['offset'];var _0x2e31c0=_0x47cf58?_0x1af770[_0xab9c('0x14')]:_0x197ccf[_0xab9c('0x11')]+_0x197ccf[_0xab9c('0x12')];var _0x115af4;if(_0x2e31c0>=_0x2ce8a4){_0x2e31c0=_0x2ce8a4;_0x115af4=0xc8;}else{_0x115af4=0xce;}_0x582c25[_0xab9c('0x10')](_0x115af4);return _0x582c25[_0xab9c('0x15')]('Content-Range',_0x4feaae+'-'+_0x2e31c0+'/'+_0x2ce8a4)[_0xab9c('0x16')](_0x1af770);}return null;};}function saveUpdates(_0x30832f){return function(_0x3b4ab8){if(_0x3b4ab8){return _0x3b4ab8[_0xab9c('0x17')](_0x30832f)['then'](function(_0x4f7faa){return _0x4f7faa;});}return null;};}function removeEntity(_0x18d094){return function(_0x450c98){if(_0x450c98){return _0x450c98[_0xab9c('0x18')]()[_0xab9c('0x19')](function(){_0x18d094[_0xab9c('0x10')](0xcc)[_0xab9c('0x1a')]();});}};}function handleEntityNotFound(_0x35fbe5){return function(_0x40bdf0){if(!_0x40bdf0){_0x35fbe5['sendStatus'](0x194);}return _0x40bdf0;};}function handleError(_0x57fc38,_0x443941){_0x443941=_0x443941||0x1f4;return function(_0x48bd60){logger[_0xab9c('0x1b')](_0x48bd60['stack']);if(_0x48bd60['name']){delete _0x48bd60[_0xab9c('0x1c')];}_0x57fc38[_0xab9c('0x10')](_0x443941)[_0xab9c('0x1d')](_0x48bd60);};}exports[_0xab9c('0x1e')]=function(_0x43783f,_0x5ba3d0){var _0x1c19f5={},_0xb68e5c={},_0x307a29={'count':0x0,'rows':[]};return db[_0xab9c('0x1f')][_0xab9c('0x20')]()[_0xab9c('0x19')](function(_0x208867){var _0x3dbf96=[];for(var _0x2ed328=0x0;_0x2ed3280x1){_0x694ed['or'](_0xab9c('0x5a'),qs[_0xab9c('0x5b')](_0x56cc81),null);}else{if(qs[_0xab9c('0x5c')](_0x56cc81)){_0x694ed['or'](_0xab9c('0x5d'),_0x56cc81+'%');_0x694ed['or'](_0xab9c('0x5e'),_0x56cc81+'%');_0x694ed['or'](_0xab9c('0x5f'),_0x56cc81+'%');_0x694ed['or'](_0xab9c('0x60'),_0x56cc81+'%');}else if(qs['isEmail'](_0x56cc81)){_0x694ed['or']('c.email\x20LIKE\x20?',_0x56cc81+'%');}else{_0x694ed['or']('c.firstName\x20LIKE\x20?','%'+_0x56cc81+'%');_0x694ed['or'](_0xab9c('0x61'),'%'+_0x56cc81+'%');_0x694ed['or'](_0xab9c('0x62'),'%'+_0x56cc81+'%');}}}}_0x2ed9a1['where'](_0x694ed);_0x2ed9a1[_0xab9c('0x63')](_0xab9c('0x64'));var _0x2690b7={'type':db[_0xab9c('0x65')][_0xab9c('0x66')][_0xab9c('0x67')],'raw':!![]};var _0x3523ed=_0x2ed9a1[_0xab9c('0x68')]()[_0xab9c('0x36')](_0xab9c('0x64'));if(_0x1c19f5['order']){_0x1c19f5[_0xab9c('0x31')][_0xab9c('0x52')](function(_0x403f7c){_0x2ed9a1['order']('c.'+_0x403f7c[0x0],_0x403f7c[0x1]===_0xab9c('0x69')?![]:!![]);});}if(!_['isEmpty'](_0x28e766)){_0x2ed9a1[_0xab9c('0x6a')](_0x1d9d9f);_0x3523ed['where'](_0xab9c('0x6b'),_0x28e766);}BPromise[_0xab9c('0x6c')]()['then'](function(){if(!_0x35662e)return;if(_0x43783f[_0xab9c('0x6d')][_0xab9c('0x6e')]!=='agent')return;if(!_['some'](_0x35662e[_0xab9c('0x42')],[_0xab9c('0x36'),_0xab9c('0x6f')])){return _0x43783f[_0xab9c('0x6d')][_0xab9c('0x70')]({'attributes':['id'],'raw':!![]})[_0xab9c('0x19')](function(_0x37cbc1){if(_[_0xab9c('0x51')](_0x37cbc1)){_0x3523ed[_0xab9c('0x33')](_0xab9c('0x71'));_0x2ed9a1[_0xab9c('0x33')]('c.ListId\x20IS\x20NULL');}else{_0x3523ed[_0xab9c('0x33')](_0xab9c('0x54'),_['map'](_0x37cbc1,'id'));_0x2ed9a1[_0xab9c('0x33')]('c.ListId\x20IN\x20?',_[_0xab9c('0x72')](_0x37cbc1,'id'));}});}})[_0xab9c('0x19')](function(){if(_0x43783f[_0xab9c('0x6d')][_0xab9c('0x6e')]===_0xab9c('0x73')&&!_0x35662e&&!_0x43783f['query'][_0xab9c('0x53')])return[];return db[_0xab9c('0x74')][_0xab9c('0x2a')](_0x3523ed[_0xab9c('0x75')](),_0x2690b7);})[_0xab9c('0x19')](function(_0x5b1a32){_0x307a29['count']=_0x5b1a32[_0xab9c('0x22')];if(_0x307a29[_0xab9c('0x14')]===0x0)return[];return db[_0xab9c('0x74')]['query'](_0x46d9cf[_0xab9c('0x75')](),_0x2690b7)['then'](function(_0x5c25cb){_0xacf5c6=_[_0xab9c('0x76')](_0x5c25cb,'id');_0x2690b7=_[_0xab9c('0x77')](_0x2690b7,{'model':db[_0xab9c('0x1f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x43783f['query'][_0xab9c('0x2e')]){_0x1c19f5['attributes'][_0xab9c('0x52')](function(_0x4fd1ef){_0x2ed9a1[_0xab9c('0x36')]('c.'+_0x4fd1ef);});}else{_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x64'));_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x78'));_0x2ed9a1[_0xab9c('0x36')]('c.lastName');_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x79'));_0x2ed9a1['field'](_0xab9c('0x7a'));_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x7b'));_0x2ed9a1['field'](_0xab9c('0x7c'));_0x2ed9a1[_0xab9c('0x36')]('c.ListId');_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x7d'));_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x7e'));_0x2ed9a1['field'](_0xab9c('0x7f'));_0x2ed9a1[_0xab9c('0x36')](_0xab9c('0x80'),_0xab9c('0x81'));}if(_0x1c19f5[_0xab9c('0x12')])_0x2ed9a1[_0xab9c('0x12')](_0x1c19f5[_0xab9c('0x12')]);if(_0x1c19f5['offset'])_0x2ed9a1['offset'](_0x1c19f5['offset']);return db[_0xab9c('0x74')][_0xab9c('0x2a')](_0x2ed9a1['toString'](),_0x2690b7);});})[_0xab9c('0x19')](function(_0x4aa87f){_0x4aa87f['forEach'](function(_0x1143eb){if(_0x1143eb[_0xab9c('0x81')]){_0x1143eb['Tags']=[];_0x1143eb[_0xab9c('0x81')][_0xab9c('0x46')](',')[_0xab9c('0x52')](function(_0x127694){_0x1143eb[_0xab9c('0x82')][_0xab9c('0x23')](_0xacf5c6[_0x127694]);});}delete _0x1143eb[_0xab9c('0x81')];});_0x307a29[_0xab9c('0x83')]=_0x4aa87f;return _0x307a29;})[_0xab9c('0x19')](respondWithFilteredResult(_0x5ba3d0,_0x1c19f5));})[_0xab9c('0x84')](handleError(_0x5ba3d0,null));};exports[_0xab9c('0x18')]=function(_0x106e23,_0x5ec279){return db['CmContact'][_0xab9c('0x43')]({'where':{'id':_0x106e23['params']['id']}})[_0xab9c('0x19')](handleEntityNotFound(_0x5ec279,null))['then'](removeEntity(_0x5ec279,null))['catch'](handleError(_0x5ec279,null));};exports[_0xab9c('0x20')]=function(_0x3a765c,_0x3236ae){return db[_0xab9c('0x1f')][_0xab9c('0x20')]()[_0xab9c('0x19')](function(_0x20d18b){delete _0x20d18b[_0xab9c('0x85')];for(var _0x5a1ae5=0x0;_0x5a1ae5=_0x5068e7){_0x3aae9f=_0x5068e7;_0x32293c=0xc8;}else{_0x32293c=0xce;}_0x41c28c[_0x40d9('0xd')](_0x32293c);return _0x41c28c['set'](_0x40d9('0x12'),_0x9618c4+'-'+_0x3aae9f+'/'+_0x5068e7)[_0x40d9('0x13')](_0x39438c);}return null;};}function saveUpdates(_0x3ea2dd){return function(_0x408b58){if(_0x408b58){return _0x408b58[_0x40d9('0x14')](_0x3ea2dd)[_0x40d9('0x15')](function(_0x1eca6f){return _0x1eca6f;});}return null;};}function removeEntity(_0x5a4abd){return function(_0x485db2){if(_0x485db2){return _0x485db2['destroy']()[_0x40d9('0x15')](function(){_0x5a4abd[_0x40d9('0xd')](0xcc)[_0x40d9('0x16')]();});}};}function handleEntityNotFound(_0x5cab82){return function(_0x55e762){if(!_0x55e762){_0x5cab82['sendStatus'](0x194);}return _0x55e762;};}function handleError(_0x136e48,_0x4971ef){_0x4971ef=_0x4971ef||0x1f4;return function(_0x1963eb){logger[_0x40d9('0x17')](_0x1963eb[_0x40d9('0x18')]);if(_0x1963eb[_0x40d9('0x19')]){delete _0x1963eb[_0x40d9('0x19')];}_0x136e48[_0x40d9('0xd')](_0x4971ef)[_0x40d9('0x1a')](_0x1963eb);};}exports['index']=function(_0x54f495,_0x3bb454){var _0x544bf6={},_0x19e3ba={},_0x5a34c7={'count':0x0,'rows':[]};return db[_0x40d9('0x1b')][_0x40d9('0x1c')]()[_0x40d9('0x15')](function(_0x3a5b43){var _0x41c44e=[];for(var _0x24e06a=0x0;_0x24e06a0x1){_0xb1ff76['or'](_0x40d9('0x60'),qs[_0x40d9('0x61')](_0x808666),null);}else{if(qs[_0x40d9('0x62')](_0x808666)){_0xb1ff76['or'](_0x40d9('0x63'),_0x808666+'%');_0xb1ff76['or'](_0x40d9('0x64'),_0x808666+'%');_0xb1ff76['or'](_0x40d9('0x65'),_0x808666+'%');_0xb1ff76['or'](_0x40d9('0x66'),_0x808666+'%');}else if(qs[_0x40d9('0x67')](_0x808666)){_0xb1ff76['or'](_0x40d9('0x68'),_0x808666+'%');}else{_0xb1ff76['or'](_0x40d9('0x69'),'%'+_0x808666+'%');_0xb1ff76['or']('c.lastName\x20LIKE\x20?','%'+_0x808666+'%');_0xb1ff76['or'](_0x40d9('0x68'),'%'+_0x808666+'%');}}}}_0xe665b7[_0x40d9('0x2f')](_0xb1ff76);_0xe665b7[_0x40d9('0x6a')](_0x40d9('0x6b'));var _0xed65aa={'type':db['Sequelize'][_0x40d9('0x6c')][_0x40d9('0x6d')],'raw':!![]};var _0x2f22e1=_0xe665b7['clone']()['field'](_0x40d9('0x6b'));if(_0x544bf6[_0x40d9('0x2d')]){_0x544bf6[_0x40d9('0x2d')][_0x40d9('0x47')](function(_0x15af52){_0xe665b7[_0x40d9('0x2d')]('c.'+_0x15af52[0x0],_0x15af52[0x1]===_0x40d9('0x6e')?![]:!![]);});}if(!_[_0x40d9('0x57')](_0x40fa48)){_0xe665b7[_0x40d9('0x6f')](_0x34ff56);_0x2f22e1[_0x40d9('0x2f')](_0x40d9('0x70'),_0x40fa48);}BPromise['resolve']()[_0x40d9('0x15')](function(){if(!_0x35e889)return;if(_0x54f495[_0x40d9('0x71')]['role']!==_0x40d9('0x72'))return;if(!_[_0x40d9('0x73')](_0x35e889[_0x40d9('0x42')],[_0x40d9('0x32'),_0x40d9('0x4a')])){return _0x54f495[_0x40d9('0x71')][_0x40d9('0x74')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22bb1b){if(_['isEmpty'](_0x22bb1b)){_0x2f22e1['where'](_0x40d9('0x75'));_0xe665b7[_0x40d9('0x2f')]('c.ListId\x20IS\x20NULL');}else{_0x2f22e1[_0x40d9('0x2f')]('c.ListId\x20IN\x20?',_[_0x40d9('0x46')](_0x22bb1b,'id'));_0xe665b7[_0x40d9('0x2f')]('c.ListId\x20IN\x20?',_[_0x40d9('0x46')](_0x22bb1b,'id'));}});}})['then'](function(){if(_0x54f495['user'][_0x40d9('0x76')]==='agent'&&!_0x35e889&&!_0x54f495[_0x40d9('0x26')][_0x40d9('0x58')])return[];return db['sequelize'][_0x40d9('0x26')](_0x2f22e1[_0x40d9('0x77')](),_0xed65aa);})['then'](function(_0x1fba3a){_0x5a34c7[_0x40d9('0x11')]=_0x1fba3a[_0x40d9('0x21')];if(_0x5a34c7[_0x40d9('0x11')]===0x0)return[];return db[_0x40d9('0x78')][_0x40d9('0x26')](_0x45d80d[_0x40d9('0x77')](),_0xed65aa)[_0x40d9('0x15')](function(_0x2af489){_0xfe623=_[_0x40d9('0x79')](_0x2af489,'id');_0xed65aa=_[_0x40d9('0x7a')](_0xed65aa,{'model':db[_0x40d9('0x1b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x54f495['query']['fields']){_0x544bf6[_0x40d9('0x2a')][_0x40d9('0x47')](function(_0x28e704){_0xe665b7[_0x40d9('0x32')]('c.'+_0x28e704);});}else{_0xe665b7[_0x40d9('0x32')](_0x40d9('0x6b'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x7b'));_0xe665b7['field']('c.lastName');_0xe665b7[_0x40d9('0x32')]('c.phone');_0xe665b7[_0x40d9('0x32')]('c.mobile');_0xe665b7[_0x40d9('0x32')]('c.fax');_0xe665b7['field'](_0x40d9('0x7c'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x7d'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x7e'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x7f'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x80'));_0xe665b7[_0x40d9('0x32')](_0x40d9('0x81'),_0x40d9('0x82'));}if(_0x544bf6[_0x40d9('0x10')])_0xe665b7[_0x40d9('0x10')](_0x544bf6['limit']);if(_0x544bf6['offset'])_0xe665b7['offset'](_0x544bf6[_0x40d9('0xe')]);return db[_0x40d9('0x78')]['query'](_0xe665b7[_0x40d9('0x77')](),_0xed65aa);});})[_0x40d9('0x15')](function(_0x906da5){_0x906da5[_0x40d9('0x47')](function(_0x38c0b2){if(_0x38c0b2[_0x40d9('0x82')]){_0x38c0b2[_0x40d9('0x83')]=[];_0x38c0b2[_0x40d9('0x82')]['split'](',')[_0x40d9('0x47')](function(_0x32393c){_0x38c0b2[_0x40d9('0x83')][_0x40d9('0x1e')](_0xfe623[_0x32393c]);});}delete _0x38c0b2[_0x40d9('0x82')];});_0x5a34c7[_0x40d9('0x84')]=_0x906da5;return _0x5a34c7;})[_0x40d9('0x15')](respondWithFilteredResult(_0x3bb454,_0x544bf6));})['catch'](handleError(_0x3bb454,null));};exports[_0x40d9('0x85')]=function(_0x56d5c1,_0x3e7dde){return db['CmContact'][_0x40d9('0x43')]({'where':{'id':_0x56d5c1[_0x40d9('0x86')]['id']}})['then'](handleEntityNotFound(_0x3e7dde,null))[_0x40d9('0x15')](removeEntity(_0x3e7dde,null))[_0x40d9('0x87')](handleError(_0x3e7dde,null));};exports[_0x40d9('0x1c')]=function(_0xde20ab,_0xfd8bd0){return db[_0x40d9('0x1b')][_0x40d9('0x1c')]()['then'](function(_0x51bcb8){delete _0x51bcb8[_0x40d9('0x88')];for(var _0x25c1d9=0x0;_0x25c1d9{}\s\\|]/g,'-');_0x3e7641(null,util['format'](_0x100b('0x22'),path[_0x100b('0x23')](_0x177281['originalname'],path[_0x100b('0x24')](_0x177281[_0x100b('0x21')])),Date['now'](),path[_0x100b('0x24')](_0x177281[_0x100b('0x21')])));}})});router['post'](_0x100b('0x25'),upload[_0x100b('0x26')]('file'),controller[_0x100b('0x27')]);var upload=multer({'storage':multer[_0x100b('0x28')]({'destination':function(_0x41d39a,_0x3994c4,_0x57a3c2){_0x57a3c2(null,path['join'](config['root'],_0x100b('0x20')));},'filename':function(_0x4cb714,_0x3fad62,_0x5c8953){_0x3fad62['originalname']=_0x3fad62[_0x100b('0x21')][_0x100b('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c8953(null,util['format'](_0x100b('0x22'),path['basename'](_0x3fad62[_0x100b('0x21')],path[_0x100b('0x24')](_0x3fad62[_0x100b('0x21')])),Date[_0x100b('0x2a')](),path[_0x100b('0x24')](_0x3fad62[_0x100b('0x21')])));}})});router[_0x100b('0x1b')](_0x100b('0x2b'),upload[_0x100b('0x26')](_0x100b('0x2c')),controller[_0x100b('0x2d')]);router[_0x100b('0x1b')](_0x100b('0x2e'),auth[_0x100b('0xc')](),controller[_0x100b('0x2f')]);router[_0x100b('0x30')]('/:id',auth[_0x100b('0xc')](),controller[_0x100b('0x31')]);router[_0x100b('0x32')](_0x100b('0xe'),auth[_0x100b('0xc')](),controller[_0x100b('0x33')]);module[_0x100b('0x34')]=router; \ No newline at end of file +var _0x53fa=['/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/jscripty_sessions','post','/merge','merge','/create_many','diskStorage','join','server/files/tmp','originalname','replace','format','%s-%s%s','extname','/csv','file','root','basename','/upload','single','upload','/upload/:id','import','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','describe'];(function(_0x54bc07,_0x386730){var _0x3fcb34=function(_0x4ee03d){while(--_0x4ee03d){_0x54bc07['push'](_0x54bc07['shift']());}};_0x3fcb34(++_0x386730);}(_0x53fa,0x1c1));var _0xa53f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53fa[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa53f('0x0'));var util=require('util');var path=require(_0xa53f('0x1'));var timeout=require(_0xa53f('0x2'));var express=require(_0xa53f('0x3'));var router=express[_0xa53f('0x4')]();var fs_extra=require(_0xa53f('0x5'));var auth=require(_0xa53f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xa53f('0x7')]('/',auth[_0xa53f('0x8')](),controller[_0xa53f('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xa53f('0xa')]);router[_0xa53f('0x7')](_0xa53f('0xb'),auth[_0xa53f('0x8')](),controller[_0xa53f('0xc')]);router[_0xa53f('0x7')](_0xa53f('0xd'),auth['isAuthenticated'](),controller[_0xa53f('0xe')]);router[_0xa53f('0x7')](_0xa53f('0xf'),auth[_0xa53f('0x8')](),controller[_0xa53f('0x10')]);router[_0xa53f('0x7')](_0xa53f('0x11'),auth[_0xa53f('0x8')](),controller[_0xa53f('0x12')]);router[_0xa53f('0x7')](_0xa53f('0x13'),auth[_0xa53f('0x8')](),controller['getHopperFinals']);router[_0xa53f('0x7')](_0xa53f('0x14'),auth[_0xa53f('0x8')](),controller['getJscriptySessions']);router[_0xa53f('0x7')]('/:id/journey',auth['isAuthenticated'](),controller['getJourney']);router[_0xa53f('0x15')](_0xa53f('0x16'),auth['isAuthenticated'](),controller[_0xa53f('0x17')]);router[_0xa53f('0x15')]('/',auth[_0xa53f('0x8')](),controller['create']);router[_0xa53f('0x15')](_0xa53f('0x18'),auth[_0xa53f('0x8')](),controller['bulkCreate']);router[_0xa53f('0x15')](_0xa53f('0xd'),auth[_0xa53f('0x8')](),controller['setTags']);var upload=multer({'storage':multer[_0xa53f('0x19')]({'destination':function(_0x1cd386,_0x2aa653,_0x263f98){_0x263f98(null,path[_0xa53f('0x1a')](config['root'],_0xa53f('0x1b')));},'filename':function(_0x52f601,_0x2c123d,_0x25bb53){_0x2c123d[_0xa53f('0x1c')]=_0x2c123d['originalname'][_0xa53f('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x25bb53(null,util[_0xa53f('0x1e')](_0xa53f('0x1f'),path['basename'](_0x2c123d[_0xa53f('0x1c')],path[_0xa53f('0x20')](_0x2c123d[_0xa53f('0x1c')])),Date['now'](),path[_0xa53f('0x20')](_0x2c123d[_0xa53f('0x1c')])));}})});router[_0xa53f('0x15')](_0xa53f('0x21'),upload['single'](_0xa53f('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa53f('0x19')]({'destination':function(_0x4dd0e1,_0x4a2f26,_0x5f0570){_0x5f0570(null,path[_0xa53f('0x1a')](config[_0xa53f('0x23')],_0xa53f('0x1b')));},'filename':function(_0x51d2b9,_0x1c295b,_0x2b01e4){_0x1c295b[_0xa53f('0x1c')]=_0x1c295b[_0xa53f('0x1c')][_0xa53f('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2b01e4(null,util['format']('%s-%s%s',path[_0xa53f('0x24')](_0x1c295b['originalname'],path[_0xa53f('0x20')](_0x1c295b[_0xa53f('0x1c')])),Date['now'](),path['extname'](_0x1c295b[_0xa53f('0x1c')])));}})});router[_0xa53f('0x15')](_0xa53f('0x25'),upload[_0xa53f('0x26')](_0xa53f('0x22')),controller[_0xa53f('0x27')]);router[_0xa53f('0x15')](_0xa53f('0x28'),auth[_0xa53f('0x8')](),controller[_0xa53f('0x29')]);router['put']('/:id',auth[_0xa53f('0x8')](),controller[_0xa53f('0x2a')]);router[_0xa53f('0x2b')](_0xa53f('0xb'),auth[_0xa53f('0x8')](),controller[_0xa53f('0x2c')]);module[_0xa53f('0x2d')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f5b9759..dd0ad5e 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 _0x7a4f=['setDataValue','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7a4f,0xd2));var _0xf7a4=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x7a4f[_0x1655bb];return _0x5e2020;};'use strict';var Sequelize=require(_0xf7a4('0x0'));var _=require(_0xf7a4('0x1'));module['exports']={'name':{'type':Sequelize[_0xf7a4('0x2')],'get':function(_0x43efde){return this[_0xf7a4('0x3')](_0xf7a4('0x4'));}},'alias':{'type':Sequelize[_0xf7a4('0x5')],'allowNull':![],'set':function(_0x2b163a){this[_0xf7a4('0x6')]('alias',_0x2b163a?_0x2b163a:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xf7a4('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf7a4('0x7')](_0xf7a4('0x8')),'get':function(){if(this[_0xf7a4('0x3')](_0xf7a4('0x9'))===_0xf7a4('0xa')){return JSON[_0xf7a4('0xb')](this[_0xf7a4('0x3')](_0xf7a4('0xc')));}else{return this[_0xf7a4('0x3')](_0xf7a4('0xc'));}},'set':function(_0x2e81aa){if(Array[_0xf7a4('0xd')](_0x2e81aa)){this['setDataValue'](_0xf7a4('0xc'),JSON[_0xf7a4('0xe')](_0x2e81aa));}else{this[_0xf7a4('0x6')](_0xf7a4('0xc'),_0x2e81aa);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf7a4('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf7a4('0x10')](_0xf7a4('0x11'))}}; \ No newline at end of file +var _0xa2ce=['TEXT','long','type','select','parse','values','stringify','BOOLEAN','voice','getDataValue','alias','STRING','setDataValue','name'];(function(_0x1df728,_0x4149c5){var _0x2cb02a=function(_0x5f2c67){while(--_0x5f2c67){_0x1df728['push'](_0x1df728['shift']());}};_0x2cb02a(++_0x4149c5);}(_0xa2ce,0xe9));var _0xea2c=function(_0x53754c,_0x30bcdc){_0x53754c=_0x53754c-0x0;var _0x23275f=_0xa2ce[_0x53754c];return _0x23275f;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x135d04){return this[_0xea2c('0x0')](_0xea2c('0x1'));}},'alias':{'type':Sequelize[_0xea2c('0x2')],'allowNull':![],'set':function(_0x11f7e8){this[_0xea2c('0x3')]('alias',_0x11f7e8?_0x11f7e8:this[_0xea2c('0x0')](_0xea2c('0x4')));}},'type':{'type':Sequelize[_0xea2c('0x2')],'allowNull':![]},'values':{'type':Sequelize[_0xea2c('0x5')](_0xea2c('0x6')),'get':function(){if(this[_0xea2c('0x0')](_0xea2c('0x7'))===_0xea2c('0x8')){return JSON[_0xea2c('0x9')](this[_0xea2c('0x0')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0xb484a3){if(Array['isArray'](_0xb484a3)){this[_0xea2c('0x3')](_0xea2c('0xa'),JSON[_0xea2c('0xb')](_0xb484a3));}else{this[_0xea2c('0x3')](_0xea2c('0xa'),_0xb484a3);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xea2c('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xea2c('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 69c3274..b73145c 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 _0xbd56=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','apply','save','update','then','destroy','end','name','send','index','map','rawAttributes','fieldName','key','model','differenceBy','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmCustomField','includeAll','catch','params','keys','include','find','body','transaction','create','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x2b9d5c,_0x173518){var _0x37bb93=function(_0x5515cd){while(--_0x5515cd){_0x2b9d5c['push'](_0x2b9d5c['shift']());}};_0x37bb93(++_0x173518);}(_0xbd56,0x19a));var _0x6bd5=function(_0x4f38b2,_0x574021){_0x4f38b2=_0x4f38b2-0x0;var _0x40f571=_0xbd56[_0x4f38b2];return _0x40f571;};'use strict';var emlformat=require(_0x6bd5('0x0'));var rimraf=require(_0x6bd5('0x1'));var zipdir=require(_0x6bd5('0x2'));var jsonpatch=require(_0x6bd5('0x3'));var rp=require(_0x6bd5('0x4'));var moment=require(_0x6bd5('0x5'));var BPromise=require(_0x6bd5('0x6'));var Mustache=require('mustache');var util=require(_0x6bd5('0x7'));var path=require('path');var sox=require(_0x6bd5('0x8'));var csv=require('to-csv');var ejs=require(_0x6bd5('0x9'));var fs=require('fs');var fs_extra=require(_0x6bd5('0xa'));var _=require(_0x6bd5('0xb'));var squel=require(_0x6bd5('0xc'));var crypto=require(_0x6bd5('0xd'));var jsforce=require(_0x6bd5('0xe'));var deskjs=require(_0x6bd5('0xf'));var toCsv=require(_0x6bd5('0x10'));var querystring=require(_0x6bd5('0x11'));var Papa=require(_0x6bd5('0x12'));var Redis=require(_0x6bd5('0x13'));var authService=require(_0x6bd5('0x14'));var qs=require(_0x6bd5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6bd5('0x16'));var logger=require(_0x6bd5('0x17'))('api');var utils=require(_0x6bd5('0x18'));var config=require(_0x6bd5('0x19'));var licenseUtil=require(_0x6bd5('0x1a'));var db=require(_0x6bd5('0x1b'))['db'];function respondWithStatusCode(_0x14e968,_0x158254){_0x158254=_0x158254||0xcc;return function(_0x23cc02){if(_0x23cc02){return _0x14e968[_0x6bd5('0x1c')](_0x158254);}return _0x14e968[_0x6bd5('0x1d')](_0x158254)['end']();};}function respondWithResult(_0x26b25b,_0x17938c){_0x17938c=_0x17938c||0xc8;return function(_0x2898d9){if(_0x2898d9){return _0x26b25b[_0x6bd5('0x1d')](_0x17938c)['json'](_0x2898d9);}};}function respondWithFilteredResult(_0x2283ff,_0x419399){return function(_0x220be1){if(_0x220be1){var _0x8a5fdd=typeof _0x419399[_0x6bd5('0x1e')]===_0x6bd5('0x1f')&&typeof _0x419399['limit']==='undefined';var _0x33ceaa=_0x220be1[_0x6bd5('0x20')];var _0x315c10=_0x8a5fdd?0x0:_0x419399['offset'];var _0x4efcda=_0x8a5fdd?_0x220be1['count']:_0x419399[_0x6bd5('0x1e')]+_0x419399[_0x6bd5('0x21')];var _0x3a17da;if(_0x4efcda>=_0x33ceaa){_0x4efcda=_0x33ceaa;_0x3a17da=0xc8;}else{_0x3a17da=0xce;}_0x2283ff[_0x6bd5('0x1d')](_0x3a17da);return _0x2283ff['set']('Content-Range',_0x315c10+'-'+_0x4efcda+'/'+_0x33ceaa)['json'](_0x220be1);}return null;};}function patchUpdates(_0x1b43b6){return function(_0x2eeea4){try{jsonpatch[_0x6bd5('0x22')](_0x2eeea4,_0x1b43b6,!![]);}catch(_0x2cd510){return BPromise['reject'](_0x2cd510);}return _0x2eeea4[_0x6bd5('0x23')]();};}function saveUpdates(_0x2d12d0,_0x594b09){return function(_0x42938b){if(_0x42938b){return _0x42938b[_0x6bd5('0x24')](_0x2d12d0)[_0x6bd5('0x25')](function(_0x18441e){return _0x18441e;});}return null;};}function removeEntity(_0xfb8c0c,_0x35658c){return function(_0x285590){if(_0x285590){return _0x285590[_0x6bd5('0x26')]()[_0x6bd5('0x25')](function(){_0xfb8c0c[_0x6bd5('0x1d')](0xcc)[_0x6bd5('0x27')]();});}};}function handleEntityNotFound(_0x1b677f,_0xb0b348){return function(_0x5d50a0){if(!_0x5d50a0){_0x1b677f[_0x6bd5('0x1c')](0x194);}return _0x5d50a0;};}function handleError(_0x3a5e27,_0x550476){_0x550476=_0x550476||0x1f4;return function(_0x14d221){logger['error'](_0x14d221['stack']);if(_0x14d221[_0x6bd5('0x28')]){delete _0x14d221[_0x6bd5('0x28')];}_0x3a5e27['status'](_0x550476)[_0x6bd5('0x29')](_0x14d221);};}exports[_0x6bd5('0x2a')]=function(_0x63e78f,_0x4d82ff){var _0xf91e57={},_0x55199d={},_0x40ca39={'count':0x0,'rows':[]};var _0x25e17f=_[_0x6bd5('0x2b')](db['CmCustomField'][_0x6bd5('0x2c')],function(_0x379658){return{'name':_0x379658[_0x6bd5('0x2d')],'type':_0x379658['type'][_0x6bd5('0x2e')]};});_0x55199d[_0x6bd5('0x2f')]=_[_0x6bd5('0x30')](_[_0x6bd5('0x2b')](_0x25e17f,_0x6bd5('0x28')),[_0x6bd5('0x28')]);_0x55199d['query']=_['keys'](_0x63e78f['query']);_0x55199d[_0x6bd5('0x31')]=_[_0x6bd5('0x32')](_0x55199d[_0x6bd5('0x2f')],_0x55199d[_0x6bd5('0x33')]);_0xf91e57[_0x6bd5('0x34')]=_[_0x6bd5('0x32')](_0x55199d[_0x6bd5('0x2f')],qs[_0x6bd5('0x35')](_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x35')]));_0xf91e57[_0x6bd5('0x34')]=_0xf91e57['attributes'][_0x6bd5('0x36')]?_0xf91e57[_0x6bd5('0x34')]:_0x55199d[_0x6bd5('0x2f')];if(!_0x63e78f['query'][_0x6bd5('0x37')]('nolimit')){_0xf91e57[_0x6bd5('0x21')]=qs[_0x6bd5('0x21')](_0x63e78f[_0x6bd5('0x33')]['limit']);_0xf91e57[_0x6bd5('0x1e')]=qs[_0x6bd5('0x1e')](_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x1e')]);}_0xf91e57[_0x6bd5('0x38')]=qs[_0x6bd5('0x39')](_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x39')]);_0xf91e57[_0x6bd5('0x3a')]=qs['filters'](_[_0x6bd5('0x3b')](_0x63e78f['query'],_0x55199d[_0x6bd5('0x31')]),_0x25e17f);if(_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x3c')]){_0xf91e57['where']=_[_0x6bd5('0x3d')](_0xf91e57['where'],{'$or':_[_0x6bd5('0x2b')](_0x25e17f,function(_0x51ad2a){if(_0x51ad2a[_0x6bd5('0x3e')]!==_0x6bd5('0x3f')){var _0xe0d0f9={};_0xe0d0f9[_0x51ad2a[_0x6bd5('0x28')]]={'$like':'%'+_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x3c')]+'%'};return _0xe0d0f9;}})});}_0xf91e57=_[_0x6bd5('0x3d')]({},_0xf91e57,_0x63e78f[_0x6bd5('0x40')]);var _0x1b83ac={'where':_0xf91e57['where']};return db[_0x6bd5('0x41')][_0x6bd5('0x20')](_0x1b83ac)[_0x6bd5('0x25')](function(_0x40ecc8){_0x40ca39[_0x6bd5('0x20')]=_0x40ecc8;if(_0x63e78f[_0x6bd5('0x33')][_0x6bd5('0x42')]){_0xf91e57['include']=[{'all':!![]}];}return db[_0x6bd5('0x41')]['findAll'](_0xf91e57);})[_0x6bd5('0x25')](function(_0x15e9be){_0x40ca39['rows']=_0x15e9be;return _0x40ca39;})[_0x6bd5('0x25')](respondWithFilteredResult(_0x4d82ff,_0xf91e57))[_0x6bd5('0x43')](handleError(_0x4d82ff,null));};exports['show']=function(_0x1de99a,_0x42152f){var _0x39afaf={'raw':!![],'where':{'id':_0x1de99a[_0x6bd5('0x44')]['id']}},_0x5ccfdf={};_0x5ccfdf[_0x6bd5('0x2f')]=_[_0x6bd5('0x45')](db[_0x6bd5('0x41')][_0x6bd5('0x2c')]);_0x5ccfdf[_0x6bd5('0x33')]=_[_0x6bd5('0x45')](_0x1de99a[_0x6bd5('0x33')]);_0x5ccfdf[_0x6bd5('0x31')]=_['intersection'](_0x5ccfdf[_0x6bd5('0x2f')],_0x5ccfdf[_0x6bd5('0x33')]);_0x39afaf[_0x6bd5('0x34')]=_['intersection'](_0x5ccfdf[_0x6bd5('0x2f')],qs[_0x6bd5('0x35')](_0x1de99a[_0x6bd5('0x33')]['fields']));_0x39afaf['attributes']=_0x39afaf[_0x6bd5('0x34')][_0x6bd5('0x36')]?_0x39afaf[_0x6bd5('0x34')]:_0x5ccfdf[_0x6bd5('0x2f')];if(_0x1de99a[_0x6bd5('0x33')][_0x6bd5('0x42')]){_0x39afaf[_0x6bd5('0x46')]=[{'all':!![]}];}_0x39afaf=_['merge']({},_0x39afaf,_0x1de99a[_0x6bd5('0x40')]);return db['CmCustomField'][_0x6bd5('0x47')](_0x39afaf)['then'](handleEntityNotFound(_0x42152f,null))[_0x6bd5('0x25')](respondWithResult(_0x42152f,null))[_0x6bd5('0x43')](handleError(_0x42152f,null));};exports['update']=function(_0x349670,_0x8bd623){if(_0x349670[_0x6bd5('0x48')]['id']){delete _0x349670[_0x6bd5('0x48')]['id'];}return db[_0x6bd5('0x41')][_0x6bd5('0x47')]({'where':{'id':_0x349670[_0x6bd5('0x44')]['id']}})[_0x6bd5('0x25')](handleEntityNotFound(_0x8bd623,null))[_0x6bd5('0x25')](saveUpdates(_0x349670[_0x6bd5('0x48')],null))[_0x6bd5('0x25')](respondWithResult(_0x8bd623,null))['catch'](handleError(_0x8bd623,null));};exports[_0x6bd5('0x26')]=function(_0x47604b,_0x3d9e7f){return db[_0x6bd5('0x41')][_0x6bd5('0x47')]({'where':{'id':_0x47604b[_0x6bd5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d9e7f,null))['then'](removeEntity(_0x3d9e7f,null))[_0x6bd5('0x43')](handleError(_0x3d9e7f,null));};exports['create']=function(_0x34cb07,_0x3622ea){var _0x36246f;return db['sequelize'][_0x6bd5('0x49')](function(_0x5beafb){return db[_0x6bd5('0x41')][_0x6bd5('0x4a')](_0x34cb07['body'],{'transaction':_0x5beafb})[_0x6bd5('0x25')](function(_0x2d8571){_0x36246f=_0x2d8571;var _0x4f6a1f={'type':db[_0x6bd5('0x4b')]['TEXT'],'transaction':_0x5beafb};switch(_0x34cb07[_0x6bd5('0x48')][_0x6bd5('0x3e')]){case'text':_0x4f6a1f[_0x6bd5('0x3e')]=db['Sequelize']['TEXT'];break;case _0x6bd5('0x4c'):_0x4f6a1f['type']=db[_0x6bd5('0x4b')][_0x6bd5('0x4d')];break;case _0x6bd5('0x4e'):_0x4f6a1f['type']=db['Sequelize'][_0x6bd5('0x4f')];_0x4f6a1f[_0x6bd5('0x50')]=![];break;default:}return db[_0x6bd5('0x51')][_0x6bd5('0x52')][_0x6bd5('0x53')](_0x6bd5('0x54'),util[_0x6bd5('0x55')](_0x6bd5('0x56'),_0x36246f['id']),_0x4f6a1f);})[_0x6bd5('0x25')](function(){return _0x36246f;});})[_0x6bd5('0x25')](respondWithResult(_0x3622ea,0xc9))[_0x6bd5('0x43')](handleError(_0x3622ea,null));}; \ No newline at end of file +var _0xb35a=['catch','body','find','destroy','create','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','sequelize','queryInterface','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params'];(function(_0x119b85,_0x437900){var _0x551478=function(_0x1004cf){while(--_0x1004cf){_0x119b85['push'](_0x119b85['shift']());}};_0x551478(++_0x437900);}(_0xb35a,0x1bc));var _0xab35=function(_0x5e795f,_0x831a4f){_0x5e795f=_0x5e795f-0x0;var _0x1a0912=_0xb35a[_0x5e795f];return _0x1a0912;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab35('0x0'));var jsonpatch=require(_0xab35('0x1'));var rp=require(_0xab35('0x2'));var moment=require(_0xab35('0x3'));var BPromise=require(_0xab35('0x4'));var Mustache=require(_0xab35('0x5'));var util=require(_0xab35('0x6'));var path=require(_0xab35('0x7'));var sox=require(_0xab35('0x8'));var csv=require(_0xab35('0x9'));var ejs=require(_0xab35('0xa'));var fs=require('fs');var fs_extra=require(_0xab35('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xab35('0xc'));var jsforce=require(_0xab35('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xab35('0xe'));var Papa=require(_0xab35('0xf'));var Redis=require('ioredis');var authService=require(_0xab35('0x10'));var qs=require(_0xab35('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab35('0x12'))(_0xab35('0x13'));var utils=require(_0xab35('0x14'));var config=require(_0xab35('0x15'));var licenseUtil=require(_0xab35('0x16'));var db=require(_0xab35('0x17'))['db'];function respondWithStatusCode(_0x385c29,_0x417bf1){_0x417bf1=_0x417bf1||0xcc;return function(_0x3410fa){if(_0x3410fa){return _0x385c29[_0xab35('0x18')](_0x417bf1);}return _0x385c29[_0xab35('0x19')](_0x417bf1)[_0xab35('0x1a')]();};}function respondWithResult(_0x2c72d4,_0x53639d){_0x53639d=_0x53639d||0xc8;return function(_0x3e2a8a){if(_0x3e2a8a){return _0x2c72d4[_0xab35('0x19')](_0x53639d)[_0xab35('0x1b')](_0x3e2a8a);}};}function respondWithFilteredResult(_0x52c264,_0x53cd3e){return function(_0x529eba){if(_0x529eba){var _0x2cffad=typeof _0x53cd3e[_0xab35('0x1c')]===_0xab35('0x1d')&&typeof _0x53cd3e['limit']==='undefined';var _0x4fd8b1=_0x529eba[_0xab35('0x1e')];var _0x3d8f2b=_0x2cffad?0x0:_0x53cd3e['offset'];var _0x36e183=_0x2cffad?_0x529eba[_0xab35('0x1e')]:_0x53cd3e[_0xab35('0x1c')]+_0x53cd3e[_0xab35('0x1f')];var _0x44c4fc;if(_0x36e183>=_0x4fd8b1){_0x36e183=_0x4fd8b1;_0x44c4fc=0xc8;}else{_0x44c4fc=0xce;}_0x52c264['status'](_0x44c4fc);return _0x52c264['set']('Content-Range',_0x3d8f2b+'-'+_0x36e183+'/'+_0x4fd8b1)[_0xab35('0x1b')](_0x529eba);}return null;};}function patchUpdates(_0x550bcb){return function(_0x332599){try{jsonpatch[_0xab35('0x20')](_0x332599,_0x550bcb,!![]);}catch(_0x512a65){return BPromise[_0xab35('0x21')](_0x512a65);}return _0x332599[_0xab35('0x22')]();};}function saveUpdates(_0x4b09ab,_0x5dcbe6){return function(_0x130f25){if(_0x130f25){return _0x130f25[_0xab35('0x23')](_0x4b09ab)[_0xab35('0x24')](function(_0x59beb7){return _0x59beb7;});}return null;};}function removeEntity(_0x56ab0d,_0x26ea2a){return function(_0x181e36){if(_0x181e36){return _0x181e36['destroy']()['then'](function(){_0x56ab0d[_0xab35('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2489d7,_0x46dd46){return function(_0x346494){if(!_0x346494){_0x2489d7[_0xab35('0x18')](0x194);}return _0x346494;};}function handleError(_0x3c7d2e,_0x843003){_0x843003=_0x843003||0x1f4;return function(_0x58a3cc){logger[_0xab35('0x25')](_0x58a3cc[_0xab35('0x26')]);if(_0x58a3cc[_0xab35('0x27')]){delete _0x58a3cc[_0xab35('0x27')];}_0x3c7d2e[_0xab35('0x19')](_0x843003)[_0xab35('0x28')](_0x58a3cc);};}exports[_0xab35('0x29')]=function(_0x16e2ab,_0xadc3b2){var _0xfb9d9d={},_0x3d13a9={},_0x17af5f={'count':0x0,'rows':[]};var _0x46e2bd=_[_0xab35('0x2a')](db[_0xab35('0x2b')][_0xab35('0x2c')],function(_0x4fb36e){return{'name':_0x4fb36e[_0xab35('0x2d')],'type':_0x4fb36e[_0xab35('0x2e')][_0xab35('0x2f')]};});_0x3d13a9[_0xab35('0x30')]=_[_0xab35('0x31')](_[_0xab35('0x2a')](_0x46e2bd,_0xab35('0x27')),[_0xab35('0x27')]);_0x3d13a9[_0xab35('0x32')]=_[_0xab35('0x33')](_0x16e2ab[_0xab35('0x32')]);_0x3d13a9[_0xab35('0x34')]=_[_0xab35('0x35')](_0x3d13a9[_0xab35('0x30')],_0x3d13a9[_0xab35('0x32')]);_0xfb9d9d[_0xab35('0x36')]=_[_0xab35('0x35')](_0x3d13a9['model'],qs[_0xab35('0x37')](_0x16e2ab[_0xab35('0x32')][_0xab35('0x37')]));_0xfb9d9d['attributes']=_0xfb9d9d[_0xab35('0x36')][_0xab35('0x38')]?_0xfb9d9d['attributes']:_0x3d13a9[_0xab35('0x30')];if(!_0x16e2ab[_0xab35('0x32')][_0xab35('0x39')](_0xab35('0x3a'))){_0xfb9d9d[_0xab35('0x1f')]=qs[_0xab35('0x1f')](_0x16e2ab[_0xab35('0x32')][_0xab35('0x1f')]);_0xfb9d9d['offset']=qs[_0xab35('0x1c')](_0x16e2ab[_0xab35('0x32')][_0xab35('0x1c')]);}_0xfb9d9d[_0xab35('0x3b')]=qs[_0xab35('0x3c')](_0x16e2ab[_0xab35('0x32')][_0xab35('0x3c')]);_0xfb9d9d['where']=qs['filters'](_[_0xab35('0x3d')](_0x16e2ab['query'],_0x3d13a9[_0xab35('0x34')]),_0x46e2bd);if(_0x16e2ab[_0xab35('0x32')][_0xab35('0x3e')]){_0xfb9d9d[_0xab35('0x3f')]=_[_0xab35('0x40')](_0xfb9d9d['where'],{'$or':_['map'](_0x46e2bd,function(_0x415644){if(_0x415644['type']!==_0xab35('0x41')){var _0x38665f={};_0x38665f[_0x415644[_0xab35('0x27')]]={'$like':'%'+_0x16e2ab[_0xab35('0x32')][_0xab35('0x3e')]+'%'};return _0x38665f;}})});}_0xfb9d9d=_[_0xab35('0x40')]({},_0xfb9d9d,_0x16e2ab[_0xab35('0x42')]);var _0x5e73b3={'where':_0xfb9d9d[_0xab35('0x3f')]};return db[_0xab35('0x2b')][_0xab35('0x1e')](_0x5e73b3)[_0xab35('0x24')](function(_0x444b84){_0x17af5f[_0xab35('0x1e')]=_0x444b84;if(_0x16e2ab[_0xab35('0x32')][_0xab35('0x43')]){_0xfb9d9d[_0xab35('0x44')]=[{'all':!![]}];}return db[_0xab35('0x2b')][_0xab35('0x45')](_0xfb9d9d);})[_0xab35('0x24')](function(_0x271928){_0x17af5f['rows']=_0x271928;return _0x17af5f;})[_0xab35('0x24')](respondWithFilteredResult(_0xadc3b2,_0xfb9d9d))['catch'](handleError(_0xadc3b2,null));};exports[_0xab35('0x46')]=function(_0x5a2b08,_0x11a8cd){var _0x1bb76a={'raw':!![],'where':{'id':_0x5a2b08[_0xab35('0x47')]['id']}},_0x5e302a={};_0x5e302a[_0xab35('0x30')]=_[_0xab35('0x33')](db['CmCustomField'][_0xab35('0x2c')]);_0x5e302a[_0xab35('0x32')]=_[_0xab35('0x33')](_0x5a2b08[_0xab35('0x32')]);_0x5e302a[_0xab35('0x34')]=_[_0xab35('0x35')](_0x5e302a['model'],_0x5e302a['query']);_0x1bb76a[_0xab35('0x36')]=_['intersection'](_0x5e302a[_0xab35('0x30')],qs['fields'](_0x5a2b08[_0xab35('0x32')][_0xab35('0x37')]));_0x1bb76a['attributes']=_0x1bb76a[_0xab35('0x36')][_0xab35('0x38')]?_0x1bb76a['attributes']:_0x5e302a['model'];if(_0x5a2b08['query'][_0xab35('0x43')]){_0x1bb76a['include']=[{'all':!![]}];}_0x1bb76a=_[_0xab35('0x40')]({},_0x1bb76a,_0x5a2b08[_0xab35('0x42')]);return db[_0xab35('0x2b')]['find'](_0x1bb76a)['then'](handleEntityNotFound(_0x11a8cd,null))[_0xab35('0x24')](respondWithResult(_0x11a8cd,null))[_0xab35('0x48')](handleError(_0x11a8cd,null));};exports[_0xab35('0x23')]=function(_0x4f74c6,_0x4a52fe){if(_0x4f74c6[_0xab35('0x49')]['id']){delete _0x4f74c6[_0xab35('0x49')]['id'];}return db[_0xab35('0x2b')][_0xab35('0x4a')]({'where':{'id':_0x4f74c6['params']['id']}})[_0xab35('0x24')](handleEntityNotFound(_0x4a52fe,null))[_0xab35('0x24')](saveUpdates(_0x4f74c6[_0xab35('0x49')],null))['then'](respondWithResult(_0x4a52fe,null))[_0xab35('0x48')](handleError(_0x4a52fe,null));};exports[_0xab35('0x4b')]=function(_0x32de4a,_0x372d31){return db[_0xab35('0x2b')]['find']({'where':{'id':_0x32de4a['params']['id']}})[_0xab35('0x24')](handleEntityNotFound(_0x372d31,null))[_0xab35('0x24')](removeEntity(_0x372d31,null))[_0xab35('0x48')](handleError(_0x372d31,null));};exports[_0xab35('0x4c')]=function(_0x40fb7a,_0x33c7b1){var _0x37f552;return db['sequelize']['transaction'](function(_0x4dfd9c){return db[_0xab35('0x2b')]['create'](_0x40fb7a[_0xab35('0x49')],{'transaction':_0x4dfd9c})[_0xab35('0x24')](function(_0x9a1899){_0x37f552=_0x9a1899;var _0x2d496a={'type':db[_0xab35('0x4d')]['TEXT'],'transaction':_0x4dfd9c};switch(_0x40fb7a[_0xab35('0x49')][_0xab35('0x2e')]){case _0xab35('0x4e'):_0x2d496a['type']=db[_0xab35('0x4d')][_0xab35('0x4f')];break;case'number':_0x2d496a['type']=db[_0xab35('0x4d')][_0xab35('0x50')];break;case _0xab35('0x51'):_0x2d496a[_0xab35('0x2e')]=db[_0xab35('0x4d')][_0xab35('0x52')];_0x2d496a['defaultValue']=![];break;default:}return db[_0xab35('0x53')][_0xab35('0x54')]['addColumn']('cm_contacts',util['format'](_0xab35('0x55'),_0x37f552['id']),_0x2d496a);})[_0xab35('0x24')](function(){return _0x37f552;});})['then'](respondWithResult(_0x33c7b1,0xc9))[_0xab35('0x48')](handleError(_0x33c7b1,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index a5b6f07..efe0872 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 _0xd6cd=['rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x5d7023,_0x293ec7){var _0x4cc12f=function(_0x1fda5e){while(--_0x1fda5e){_0x5d7023['push'](_0x5d7023['shift']());}};_0x4cc12f(++_0x293ec7);}(_0xd6cd,0x7c));var _0xdd6c=function(_0x230041,_0x4d83e1){_0x230041=_0x230041-0x0;var _0x59295b=_0xd6cd[_0x230041];return _0x59295b;};'use strict';var _=require(_0xdd6c('0x0'));var util=require(_0xdd6c('0x1'));var logger=require(_0xdd6c('0x2'))(_0xdd6c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd6c('0x4'));var fs=require('fs');var path=require(_0xdd6c('0x5'));var rimraf=require(_0xdd6c('0x6'));var config=require(_0xdd6c('0x7'));var attributes=require(_0xdd6c('0x8'));module[_0xdd6c('0x9')]=function(_0x26d089,_0x40a5e7){return _0x26d089[_0xdd6c('0xa')](_0xdd6c('0xb'),attributes,{'tableName':_0xdd6c('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91c3=['./cmCustomField.attributes','exports','define','CmCustomField','lodash','util','api','moment','bluebird','rimraf'];(function(_0x4b4844,_0x2f0dfb){var _0x575192=function(_0x13ee1b){while(--_0x13ee1b){_0x4b4844['push'](_0x4b4844['shift']());}};_0x575192(++_0x2f0dfb);}(_0x91c3,0x1a8));var _0x391c=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0x91c3[_0x3ef8f7];return _0x3b097e;};'use strict';var _=require(_0x391c('0x0'));var util=require(_0x391c('0x1'));var logger=require('../../config/logger')(_0x391c('0x2'));var moment=require(_0x391c('0x3'));var BPromise=require(_0x391c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x391c('0x5'));var config=require('../../config/environment');var attributes=require(_0x391c('0x6'));module[_0x391c('0x7')]=function(_0x1de19b,_0x468c0c){return _0x1de19b[_0x391c('0x8')](_0x391c('0x9'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index cbf619b..dab8721 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 _0xd757=['result','catch','lodash','moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x518a68,_0xef1bfd){var _0x699842=function(_0x22a345){while(--_0x22a345){_0x518a68['push'](_0x518a68['shift']());}};_0x699842(++_0xef1bfd);}(_0xd757,0x18e));var _0x7d75=function(_0x5451b8,_0x25ec40){_0x5451b8=_0x5451b8-0x0;var _0x453e70=_0xd757[_0x5451b8];return _0x453e70;};'use strict';var _=require(_0x7d75('0x0'));var util=require('util');var moment=require(_0x7d75('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d75('0x2'));var fs=require('fs');var Redis=require(_0x7d75('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d75('0x4'));var config=require('../../config/environment');var jayson=require(_0x7d75('0x5'));var client=jayson[_0x7d75('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x841d2f,_0x38075d,_0x39ca7d){return new BPromise(function(_0x2560cf,_0x2c71cf){return client[_0x7d75('0x7')](_0x841d2f,_0x39ca7d)[_0x7d75('0x8')](function(_0x54b124){logger['info'](_0x7d75('0x9'),_0x38075d,_0x7d75('0xa'));logger['debug'](_0x7d75('0xb'),_0x38075d,_0x7d75('0xa'),JSON[_0x7d75('0xc')](_0x54b124));if(_0x54b124['error']){if(_0x54b124[_0x7d75('0xd')]['code']===0x1f4){logger[_0x7d75('0xd')](_0x7d75('0x9'),_0x38075d,_0x54b124[_0x7d75('0xd')][_0x7d75('0xe')]);return _0x2c71cf(_0x54b124['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x38075d,_0x54b124[_0x7d75('0xd')]['message']);return _0x2560cf(_0x54b124[_0x7d75('0xd')][_0x7d75('0xe')]);}else{logger[_0x7d75('0xf')](_0x7d75('0x9'),_0x38075d,_0x7d75('0xa'));_0x2560cf(_0x54b124[_0x7d75('0x10')][_0x7d75('0xe')]);}})[_0x7d75('0x11')](function(_0x19f6d3){logger[_0x7d75('0xd')]('CmCustomField,\x20%s,\x20%s',_0x38075d,_0x19f6d3);_0x2c71cf(_0x19f6d3);});});} \ No newline at end of file +var _0x3563=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x3563,0x17b));var _0x3356=function(_0x2a9e72,_0x9e7556){_0x2a9e72=_0x2a9e72-0x0;var _0x432190=_0x3563[_0x2a9e72];return _0x432190;};'use strict';var _=require(_0x3356('0x0'));var util=require('util');var moment=require(_0x3356('0x1'));var BPromise=require(_0x3356('0x2'));var rs=require(_0x3356('0x3'));var fs=require('fs');var Redis=require(_0x3356('0x4'));var db=require(_0x3356('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3356('0x6'))(_0x3356('0x7'));var config=require('../../config/environment');var jayson=require(_0x3356('0x8'));var client=jayson['client'][_0x3356('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x497888,_0x132f93,_0xaa29f7){return new BPromise(function(_0x3f6985,_0x53e162){return client[_0x3356('0xa')](_0x497888,_0xaa29f7)[_0x3356('0xb')](function(_0x2b47a6){logger[_0x3356('0xc')](_0x3356('0xd'),_0x132f93,_0x3356('0xe'));logger[_0x3356('0xf')](_0x3356('0x10'),_0x132f93,_0x3356('0xe'),JSON[_0x3356('0x11')](_0x2b47a6));if(_0x2b47a6['error']){if(_0x2b47a6[_0x3356('0x12')][_0x3356('0x13')]===0x1f4){logger[_0x3356('0x12')](_0x3356('0xd'),_0x132f93,_0x2b47a6[_0x3356('0x12')][_0x3356('0x14')]);return _0x53e162(_0x2b47a6[_0x3356('0x12')][_0x3356('0x14')]);}logger['error'](_0x3356('0xd'),_0x132f93,_0x2b47a6['error'][_0x3356('0x14')]);return _0x3f6985(_0x2b47a6[_0x3356('0x12')]['message']);}else{logger[_0x3356('0xc')](_0x3356('0xd'),_0x132f93,_0x3356('0xe'));_0x3f6985(_0x2b47a6[_0x3356('0x15')]['message']);}})[_0x3356('0x16')](function(_0x419a9e){logger[_0x3356('0x12')](_0x3356('0xd'),_0x132f93,_0x419a9e);_0x53e162(_0x419a9e);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d88e224..b1320a5 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 _0x6bdc=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x883d7,_0x28edb8){var _0x1559d6=function(_0x2a245b){while(--_0x2a245b){_0x883d7['push'](_0x883d7['shift']());}};_0x1559d6(++_0x28edb8);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x1616b1,_0x4b410d){_0x1616b1=_0x1616b1-0x0;var _0x453b0e=_0x6bdc[_0x1616b1];return _0x453b0e;};'use strict';var multer=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var path=require(_0xc6bd('0x2'));var timeout=require(_0xc6bd('0x3'));var express=require(_0xc6bd('0x4'));var router=express[_0xc6bd('0x5')]();var fs_extra=require(_0xc6bd('0x6'));var auth=require(_0xc6bd('0x7'));var interaction=require(_0xc6bd('0x8'));var config=require(_0xc6bd('0x9'));var controller=require('./cmCustomField.controller');router[_0xc6bd('0xa')]('/',auth[_0xc6bd('0xb')](),controller[_0xc6bd('0xc')]);router[_0xc6bd('0xa')](_0xc6bd('0xd'),auth[_0xc6bd('0xb')](),controller['show']);router[_0xc6bd('0xe')]('/',auth[_0xc6bd('0xb')](),controller[_0xc6bd('0xf')]);router['put']('/:id',auth[_0xc6bd('0xb')](),controller['update']);router[_0xc6bd('0x10')]('/:id',auth[_0xc6bd('0xb')](),controller[_0xc6bd('0x11')]);module[_0xc6bd('0x12')]=router; \ No newline at end of file +var _0xb2cb=['../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x65cd78,_0x5a65bf){var _0xd5f41a=function(_0x389d6b){while(--_0x389d6b){_0x65cd78['push'](_0x65cd78['shift']());}};_0xd5f41a(++_0x5a65bf);}(_0xb2cb,0x8a));var _0xbb2c=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xb2cb[_0x4aa4e6];return _0x322588;};'use strict';var multer=require(_0xbb2c('0x0'));var util=require(_0xbb2c('0x1'));var path=require(_0xbb2c('0x2'));var timeout=require(_0xbb2c('0x3'));var express=require('express');var router=express[_0xbb2c('0x4')]();var fs_extra=require(_0xbb2c('0x5'));var auth=require(_0xbb2c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb2c('0x7'));var controller=require(_0xbb2c('0x8'));router[_0xbb2c('0x9')]('/',auth[_0xbb2c('0xa')](),controller['index']);router[_0xbb2c('0x9')](_0xbb2c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbb2c('0xc')]('/',auth[_0xbb2c('0xa')](),controller[_0xbb2c('0xd')]);router[_0xbb2c('0xe')](_0xbb2c('0xb'),auth[_0xbb2c('0xa')](),controller[_0xbb2c('0xf')]);router[_0xbb2c('0x10')](_0xbb2c('0xb'),auth[_0xbb2c('0xa')](),controller[_0xbb2c('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 a4064d2..3692568 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 _0xd5a8=['STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports'];(function(_0x8bd5e3,_0x14c01d){var _0x4c8d3e=function(_0x22317f){while(--_0x22317f){_0x8bd5e3['push'](_0x8bd5e3['shift']());}};_0x4c8d3e(++_0x14c01d);}(_0xd5a8,0x194));var _0x8d5a=function(_0x24e207,_0x2cdc0a){_0x24e207=_0x24e207-0x0;var _0x29442e=_0xd5a8[_0x24e207];return _0x29442e;};'use strict';var moment=require(_0x8d5a('0x0'));var Sequelize=require(_0x8d5a('0x1'));module[_0x8d5a('0x2')]={'phone':{'type':Sequelize[_0x8d5a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8d5a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8d5a('0x5')],'defaultValue':moment()[_0x8d5a('0x6')](_0x8d5a('0x7'))},'countbusyretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8d5a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8d5a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8d5a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8d5a('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8d5a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8d5a('0x8')],'unique':_0x8d5a('0xa')},'ListId':{'type':Sequelize[_0x8d5a('0x8')],'unique':_0x8d5a('0xa')},'UserId':{'type':Sequelize[_0x8d5a('0x8')]},'VoiceQueueId':{'type':Sequelize[_0x8d5a('0x8')],'unique':_0x8d5a('0xa')},'CampaignId':{'type':Sequelize[_0x8d5a('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8d5a('0x8')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0x8d5a('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x7f9d=['BOOLEAN','format','INTEGER','STRING','UNSIGNED','contactListQueue','DATE','sequelize','exports'];(function(_0x518946,_0x5399b0){var _0xb7ca83=function(_0x12e8f1){while(--_0x12e8f1){_0x518946['push'](_0x518946['shift']());}};_0xb7ca83(++_0x5399b0);}(_0x7f9d,0xd6));var _0xd7f9=function(_0x38579c,_0x2fb3eb){_0x38579c=_0x38579c-0x0;var _0x284651=_0x7f9d[_0x38579c];return _0x284651;};'use strict';var moment=require('moment');var Sequelize=require(_0xd7f9('0x0'));module[_0xd7f9('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xd7f9('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xd7f9('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd7f9('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd7f9('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd7f9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd7f9('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd7f9('0x4')],'unique':_0xd7f9('0x7')},'ListId':{'type':Sequelize[_0xd7f9('0x4')],'unique':_0xd7f9('0x7')},'UserId':{'type':Sequelize[_0xd7f9('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xd7f9('0x4')],'unique':_0xd7f9('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd7f9('0x4')],'defaultValue':0x0},'recallmeNotifiedDate':{'type':Sequelize[_0xd7f9('0x8')],'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 4288aac..6bb8cc7 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 _0x08e3=['keys','filters','concat','$and','$or','$gte','$ne','$eq','$not','$between','$notBetween','$like','$overlap','$contains','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','find','create','body','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','DESC','ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','LOCK','Contact','CmCompany','CmList','List','Queue','getPreviewRecall','describe','transaction','hopperId','UPDATE','Company','dialActive','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','error','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x08e3,0x197));var _0x308e=function(_0x21c84f,_0x4614cf){_0x21c84f=_0x21c84f-0x0;var _0x5bd4aa=_0x08e3[_0x21c84f];return _0x5bd4aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x308e('0x0'));var zipdir=require(_0x308e('0x1'));var jsonpatch=require(_0x308e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x308e('0x3'));var Mustache=require(_0x308e('0x4'));var util=require(_0x308e('0x5'));var path=require(_0x308e('0x6'));var sox=require(_0x308e('0x7'));var csv=require(_0x308e('0x8'));var ejs=require(_0x308e('0x9'));var fs=require('fs');var fs_extra=require(_0x308e('0xa'));var _=require(_0x308e('0xb'));var squel=require(_0x308e('0xc'));var crypto=require(_0x308e('0xd'));var jsforce=require(_0x308e('0xe'));var deskjs=require(_0x308e('0xf'));var toCsv=require(_0x308e('0x8'));var querystring=require(_0x308e('0x10'));var Papa=require(_0x308e('0x11'));var Redis=require('ioredis');var authService=require(_0x308e('0x12'));var qs=require(_0x308e('0x13'));var as=require(_0x308e('0x14'));var hardwareService=require(_0x308e('0x15'));var logger=require('../../config/logger')(_0x308e('0x16'));var utils=require(_0x308e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x308e('0x18'))['db'];function respondWithStatusCode(_0x3c6d98,_0x4f8975){_0x4f8975=_0x4f8975||0xcc;return function(_0x2cafcc){if(_0x2cafcc){return _0x3c6d98[_0x308e('0x19')](_0x4f8975);}return _0x3c6d98[_0x308e('0x1a')](_0x4f8975)[_0x308e('0x1b')]();};}function respondWithResult(_0x454c8c,_0x486863){_0x486863=_0x486863||0xc8;return function(_0x5e2c7c){if(_0x5e2c7c){return _0x454c8c[_0x308e('0x1a')](_0x486863)[_0x308e('0x1c')](_0x5e2c7c);}};}function respondWithFilteredResult(_0x3462c1,_0x51e5df){return function(_0x4856ef){if(_0x4856ef){var _0x11a54d=typeof _0x51e5df[_0x308e('0x1d')]===_0x308e('0x1e')&&typeof _0x51e5df[_0x308e('0x1f')]==='undefined';var _0x499c2e=_0x4856ef['count'];var _0x3e921b=_0x11a54d?0x0:_0x51e5df['offset'];var _0x3ea96a=_0x11a54d?_0x4856ef[_0x308e('0x20')]:_0x51e5df[_0x308e('0x1d')]+_0x51e5df[_0x308e('0x1f')];var _0x569cb1;if(_0x3ea96a>=_0x499c2e){_0x3ea96a=_0x499c2e;_0x569cb1=0xc8;}else{_0x569cb1=0xce;}_0x3462c1[_0x308e('0x1a')](_0x569cb1);return _0x3462c1[_0x308e('0x21')](_0x308e('0x22'),_0x3e921b+'-'+_0x3ea96a+'/'+_0x499c2e)[_0x308e('0x1c')](_0x4856ef);}return null;};}function patchUpdates(_0x5582d0){return function(_0x49ee32){try{jsonpatch['apply'](_0x49ee32,_0x5582d0,!![]);}catch(_0x390fc8){return BPromise[_0x308e('0x23')](_0x390fc8);}return _0x49ee32['save']();};}function saveUpdates(_0x5e3fa7,_0x361e27){return function(_0x1c7150){if(_0x1c7150){return _0x1c7150[_0x308e('0x24')](_0x5e3fa7)[_0x308e('0x25')](function(_0x295375){return _0x295375;});}return null;};}function removeEntity(_0x519196,_0x4f36e9){return function(_0x8a8d53){if(_0x8a8d53){return _0x8a8d53['destroy']()[_0x308e('0x25')](function(){_0x519196['status'](0xcc)[_0x308e('0x1b')]();});}};}function handleEntityNotFound(_0x34e3f6,_0x1a4875){return function(_0x259ab5){if(!_0x259ab5){_0x34e3f6['sendStatus'](0x194);}return _0x259ab5;};}function handleError(_0x1a1d40,_0x55cb99){_0x55cb99=_0x55cb99||0x1f4;return function(_0x3b6b3c){logger[_0x308e('0x26')](_0x3b6b3c['stack']);if(_0x3b6b3c[_0x308e('0x27')]){delete _0x3b6b3c[_0x308e('0x27')];}_0x1a1d40[_0x308e('0x1a')](_0x55cb99)[_0x308e('0x28')](_0x3b6b3c);};}exports['index']=function(_0x7ad976,_0x121158){var _0x3d10ea={},_0x1ff920={},_0x2ae436={'count':0x0,'rows':[]};var _0x356b4f=_[_0x308e('0x29')](db[_0x308e('0x2a')][_0x308e('0x2b')],function(_0x4eabc5){return{'name':_0x4eabc5[_0x308e('0x2c')],'type':_0x4eabc5[_0x308e('0x2d')][_0x308e('0x2e')]};});_0x1ff920[_0x308e('0x2f')]=_[_0x308e('0x29')](_0x356b4f,_0x308e('0x27'));_0x1ff920[_0x308e('0x30')]=_[_0x308e('0x31')](_0x7ad976['query']);_0x1ff920[_0x308e('0x32')]=_['intersection'](_0x1ff920[_0x308e('0x2f')],_0x1ff920['query']);_0x1ff920['filters']=_[_0x308e('0x33')](_0x1ff920[_0x308e('0x32')],[_0x308e('0x34'),_0x308e('0x35'),'$gt',_0x308e('0x36'),'$lt','$lte',_0x308e('0x37'),_0x308e('0x38'),_0x308e('0x39'),_0x308e('0x3a'),_0x308e('0x3b'),'$in','$notIn',_0x308e('0x3c'),'$notLike','$iLike','$notILike','$like',_0x308e('0x3d'),_0x308e('0x3e'),_0x308e('0x3f'),_0x308e('0x40')]);_0x3d10ea[_0x308e('0x41')]=_[_0x308e('0x42')](_0x1ff920[_0x308e('0x2f')],qs[_0x308e('0x43')](_0x7ad976[_0x308e('0x30')]['fields']));_0x3d10ea[_0x308e('0x41')]=_0x3d10ea[_0x308e('0x41')][_0x308e('0x44')]?_0x3d10ea[_0x308e('0x41')]:_0x1ff920[_0x308e('0x2f')];if(!_0x7ad976[_0x308e('0x30')][_0x308e('0x45')](_0x308e('0x46'))){_0x3d10ea['limit']=qs[_0x308e('0x1f')](_0x7ad976[_0x308e('0x30')][_0x308e('0x1f')]);_0x3d10ea[_0x308e('0x1d')]=qs[_0x308e('0x1d')](_0x7ad976[_0x308e('0x30')][_0x308e('0x1d')]);}_0x3d10ea[_0x308e('0x47')]=qs[_0x308e('0x48')](_0x7ad976[_0x308e('0x30')][_0x308e('0x48')]);_0x3d10ea[_0x308e('0x49')]=qs[_0x308e('0x32')](_[_0x308e('0x4a')](_0x7ad976['query'],_0x1ff920[_0x308e('0x32')]),_0x356b4f);if(_0x7ad976['query'][_0x308e('0x4b')]){_0x3d10ea['where']=_[_0x308e('0x4c')](_0x3d10ea[_0x308e('0x49')],{'$or':_[_0x308e('0x29')](_0x356b4f,function(_0x5f430f){if(_0x5f430f[_0x308e('0x2d')]!==_0x308e('0x4d')){var _0x5ac118={};_0x5ac118[_0x5f430f[_0x308e('0x27')]]={'$like':'%'+_0x7ad976[_0x308e('0x30')][_0x308e('0x4b')]+'%'};return _0x5ac118;}})});}_0x3d10ea=_[_0x308e('0x4c')]({},_0x3d10ea,_0x7ad976[_0x308e('0x4e')]);var _0x1ffdf6={'where':_0x3d10ea[_0x308e('0x49')]};return db['CmHopper'][_0x308e('0x20')](_0x1ffdf6)[_0x308e('0x25')](function(_0x1168df){_0x2ae436[_0x308e('0x20')]=_0x1168df;if(_0x7ad976[_0x308e('0x30')][_0x308e('0x4f')]){_0x3d10ea[_0x308e('0x50')]=[{'all':!![]}];}return db[_0x308e('0x2a')]['findAll'](_0x3d10ea);})['then'](function(_0x22ca74){_0x2ae436['rows']=_0x22ca74;return _0x2ae436;})['then'](respondWithFilteredResult(_0x121158,_0x3d10ea))[_0x308e('0x51')](handleError(_0x121158,null));};exports['show']=function(_0x2bed75,_0x5b0d1e){var _0x46d97c={'raw':!![],'where':{'id':_0x2bed75['params']['id']}},_0x58d827={};_0x58d827[_0x308e('0x2f')]=_[_0x308e('0x31')](db[_0x308e('0x2a')][_0x308e('0x2b')]);_0x58d827[_0x308e('0x30')]=_['keys'](_0x2bed75[_0x308e('0x30')]);_0x58d827[_0x308e('0x32')]=_[_0x308e('0x42')](_0x58d827['model'],_0x58d827[_0x308e('0x30')]);_0x46d97c[_0x308e('0x41')]=_['intersection'](_0x58d827[_0x308e('0x2f')],qs[_0x308e('0x43')](_0x2bed75[_0x308e('0x30')][_0x308e('0x43')]));_0x46d97c[_0x308e('0x41')]=_0x46d97c[_0x308e('0x41')][_0x308e('0x44')]?_0x46d97c[_0x308e('0x41')]:_0x58d827[_0x308e('0x2f')];if(_0x2bed75[_0x308e('0x30')]['includeAll']){_0x46d97c[_0x308e('0x50')]=[{'all':!![]}];}_0x46d97c=_[_0x308e('0x4c')]({},_0x46d97c,_0x2bed75[_0x308e('0x4e')]);return db[_0x308e('0x2a')][_0x308e('0x52')](_0x46d97c)[_0x308e('0x25')](handleEntityNotFound(_0x5b0d1e,null))[_0x308e('0x25')](respondWithResult(_0x5b0d1e,null))[_0x308e('0x51')](handleError(_0x5b0d1e,null));};exports[_0x308e('0x53')]=function(_0x1b5f72,_0x1509c7){return db[_0x308e('0x2a')][_0x308e('0x53')](_0x1b5f72[_0x308e('0x54')],{})['then'](respondWithResult(_0x1509c7,0xc9))[_0x308e('0x51')](handleError(_0x1509c7,null));};exports[_0x308e('0x24')]=function(_0x12910c,_0x273115){if(_0x12910c[_0x308e('0x54')]['id']){delete _0x12910c[_0x308e('0x54')]['id'];}return db[_0x308e('0x2a')][_0x308e('0x52')]({'where':{'id':_0x12910c[_0x308e('0x55')]['id']}})['then'](handleEntityNotFound(_0x273115,null))[_0x308e('0x25')](saveUpdates(_0x12910c[_0x308e('0x54')],null))[_0x308e('0x25')](respondWithResult(_0x273115,null))[_0x308e('0x51')](handleError(_0x273115,null));};exports['describe']=function(_0x242ad3,_0x364b03){return db[_0x308e('0x2a')]['describe']()['then'](respondWithResult(_0x364b03,null))[_0x308e('0x51')](handleError(_0x364b03,null));};exports['destroy']=function(_0x4b80f3,_0x1879ad){var _0x26b952;return db[_0x308e('0x2a')][_0x308e('0x52')]({'where':{'id':_0x4b80f3[_0x308e('0x55')]['id']}})[_0x308e('0x25')](handleEntityNotFound(_0x1879ad,null))[_0x308e('0x25')](function(_0x3513c1){if(_0x3513c1){return _0x3513c1['destroy']()[_0x308e('0x25')](function(_0x1337fd){return _0x1337fd;});}})[_0x308e('0x25')](function(_0x3b1fbe){_0x26b952=_0x3b1fbe;if(_0x3b1fbe){if(_0x3b1fbe[_0x308e('0x56')]||_0x3b1fbe[_0x308e('0x57')]){return db[_0x3b1fbe[_0x308e('0x56')]?_0x308e('0x58'):'Campaign'][_0x308e('0x52')]({'where':{'id':_0x3b1fbe[_0x308e('0x56')]?_0x3b1fbe[_0x308e('0x56')]:_0x3b1fbe[_0x308e('0x57')]},'attributes':['id',_0x308e('0x27')],'raw':!![]});}}})[_0x308e('0x25')](function(_0x3ad4a8){var _0x1bf1bc={};if(_0x3ad4a8){_['merge'](_0x1bf1bc,_[_0x308e('0x59')](_0x26b952[_0x308e('0x5a')],[_0x308e('0x5b'),_0x308e('0x5c'),'id']));_0x1bf1bc[_0x308e('0x5d')]=0x15;_0x1bf1bc[_0x308e('0x5e')]=_0x308e('0x5f');_0x1bf1bc[_0x308e('0x60')]=_0x3ad4a8[_0x308e('0x27')];_0x1bf1bc[_0x308e('0x61')]=_0x4b80f3[_0x308e('0x62')][_0x308e('0x27')];_0x1bf1bc[_0x308e('0x63')]=_0x4b80f3[_0x308e('0x62')]['id'];_0x1bf1bc[_0x308e('0x5f')]=!![];_0x1bf1bc[_0x308e('0x64')]=moment()[_0x308e('0x65')](_0x308e('0x66'));_0x1bf1bc[_0x308e('0x67')]=_0x26b952['phone'];_0x1bf1bc[_0x308e('0x68')]=_0x26b952[_0x308e('0x56')]?'queue':_0x308e('0x69');return db[_0x308e('0x6a')][_0x308e('0x52')]({'where':{'id':_0x1bf1bc[_0x308e('0x6b')]},'attributes':[_0x308e('0x6c'),_0x308e('0x6d')]})[_0x308e('0x25')](function(_0x4b156d){if(!_[_0x308e('0x6e')](_0x1879ad)&&!_[_0x308e('0x6e')](_0x4b156d['firstName'])){_0x1bf1bc[_0x308e('0x6f')]=_0x4b156d[_0x308e('0x6c')];if(!_[_0x308e('0x6e')](_0x4b156d[_0x308e('0x6d')])){_0x1bf1bc[_0x308e('0x6f')]+='\x20'+_0x4b156d[_0x308e('0x6d')];}}})[_0x308e('0x70')](function(){return db[_0x308e('0x71')]['create'](_0x1bf1bc);});}})[_0x308e('0x25')](function(){return _0x1879ad[_0x308e('0x1a')](0xcc)[_0x308e('0x1b')]();})['catch'](handleError(_0x1879ad,null));};exports[_0x308e('0x72')]=function(_0x1047fc,_0x6731c3,_0x1ffcbe){var _0x452e0c=[];return db[_0x308e('0x6a')]['describe']()['then'](function(_0x87efcb){_0x452e0c=_[_0x308e('0x31')](_0x87efcb);return _0x1047fc[_0x308e('0x62')][_0x308e('0x73')]({'where':{'type':_0x308e('0x74'),'dialActive':!![],'dialMethod':_0x308e('0x75')},'attributes':['id',_0x308e('0x76'),_0x308e('0x77')],'raw':!![]});})['then'](function(_0x438b12){if(_0x438b12&&_0x438b12['length']){return db[_0x308e('0x78')]['transaction'](function(_0x217e8c){var _0x1e5875={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x308e('0x65')](_0x308e('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x438b12,'id')},'$or':[{'UserId':null},{'UserId':_0x1047fc[_0x308e('0x62')]['id']}]};var _0xe9a4a={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x438b12)[_0x308e('0x4b')]([_0x308e('0x77'),0x0])[_0x308e('0x29')]('id')[_0x308e('0x79')]()},'$or':[{'UserId':null},{'UserId':_0x1047fc[_0x308e('0x62')]['id']}]};var _0x19015e={'$or':[_0x1e5875,_0xe9a4a]};var _0x236787=[];if(_0x1047fc[_0x308e('0x54')]['direction']&&_0x1047fc['body'][_0x308e('0x7a')]===_0x308e('0x7b')){if(!_[_0x308e('0x7c')](_0x1047fc[_0x308e('0x54')][_0x308e('0x7d')])){_0x19015e['id']={'$in':_0x1047fc[_0x308e('0x54')][_0x308e('0x7d')]};}_0x236787=[[_0x308e('0x7e'),'ASC'],[_0x308e('0x7f'),_0x438b12[0x0][_0x308e('0x76')]==='ASC'?_0x308e('0x80'):_0x308e('0x81')],db[_0x308e('0x78')][_0x308e('0x82')](_0x308e('0x83')),['id','DESC']];}else{if(!_[_0x308e('0x7c')](_0x1047fc['body'][_0x308e('0x7d')])){_0x19015e['id']={'$notIn':_0x1047fc[_0x308e('0x54')][_0x308e('0x7d')]};}_0x236787=[[_0x308e('0x7e'),'DESC'],[_0x308e('0x7f'),_0x438b12[0x0][_0x308e('0x76')]],db[_0x308e('0x78')][_0x308e('0x82')](_0x308e('0x84')),['id',_0x308e('0x81')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x308e('0x85'),_0x308e('0x86')],'where':_0x19015e,'order':_0x236787,'transaction':_0x217e8c,'lock':_0x217e8c[_0x308e('0x87')]['UPDATE'],'include':[{'model':db[_0x308e('0x6a')],'as':_0x308e('0x88'),'attributes':_0x452e0c,'include':[{'model':db[_0x308e('0x89')],'as':'Company','attributes':['id',_0x308e('0x27')]}]},{'model':db[_0x308e('0x8a')],'as':_0x308e('0x8b'),'attributes':['id','name']},{'model':db[_0x308e('0x58')],'as':_0x308e('0x8c'),'attributes':['id','name','dialActive']}]})[_0x308e('0x25')](function(_0x3c41e4){if(_0x3c41e4){return _0x3c41e4['update']({'UserId':_0x1047fc[_0x308e('0x62')]['id']},{'transaction':_0x217e8c});}});});}})['then'](handleEntityNotFound(_0x6731c3,null))[_0x308e('0x25')](respondWithResult(_0x6731c3,null))[_0x308e('0x51')](handleError(_0x6731c3,null));};exports[_0x308e('0x8d')]=function(_0x358790,_0x445276,_0x52ca45){var _0x5bf872=[];return db[_0x308e('0x6a')][_0x308e('0x8e')]()[_0x308e('0x25')](function(_0x55d5b9){_0x5bf872=_[_0x308e('0x31')](_0x55d5b9);return _0x358790[_0x308e('0x62')]['getVoiceQueues']({'where':{'type':_0x308e('0x74'),'dialActive':!![],'dialMethod':_0x308e('0x75')},'attributes':['id',_0x308e('0x76'),_0x308e('0x77')],'raw':!![]});})[_0x308e('0x25')](function(_0x194d24){if(_0x194d24&&_0x194d24[_0x308e('0x44')]){return db['sequelize'][_0x308e('0x8f')](function(_0xd6abd8){var _0x405fa3={'active':![],'recallme':!![],'id':_0x358790[_0x308e('0x54')][_0x308e('0x90')]};return db[_0x308e('0x2a')]['findOne']({'attributes':['id',_0x308e('0x85'),_0x308e('0x86')],'where':_0x405fa3,'transaction':_0xd6abd8,'lock':_0xd6abd8['LOCK'][_0x308e('0x91')],'include':[{'model':db['CmContact'],'as':_0x308e('0x88'),'attributes':_0x5bf872,'include':[{'model':db[_0x308e('0x89')],'as':_0x308e('0x92'),'attributes':['id',_0x308e('0x27')]}]},{'model':db[_0x308e('0x8a')],'as':_0x308e('0x8b'),'attributes':['id',_0x308e('0x27')]},{'model':db[_0x308e('0x58')],'as':_0x308e('0x8c'),'attributes':['id',_0x308e('0x27'),_0x308e('0x93')]}]})[_0x308e('0x25')](function(_0x5029f4){if(_0x5029f4){return _0x5029f4[_0x308e('0x24')]({'UserId':_0x358790['user']['id']},{'transaction':_0xd6abd8});}});});}})['then'](handleEntityNotFound(_0x445276,null))[_0x308e('0x25')](respondWithResult(_0x445276,null))[_0x308e('0x51')](handleError(_0x445276,null));};exports['getOpenContacts']=function(_0x8bde30,_0x54c14b,_0x3bffaa){return _0x8bde30[_0x308e('0x62')][_0x308e('0x73')]({'where':{'type':_0x308e('0x74'),'dialActive':!![],'dialMethod':_0x308e('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x181b8a){if(_0x181b8a&&_0x181b8a[_0x308e('0x44')]){return db['CmHopper'][_0x308e('0x20')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x308e('0x65')](_0x308e('0x66'))},'VoiceQueueId':{'$in':_[_0x308e('0x29')](_0x181b8a,'id')},'$or':[{'UserId':null},{'UserId':_0x8bde30[_0x308e('0x62')]['id']}]}});}return 0x0;})[_0x308e('0x25')](function(_0x6dd41b){if(!_['isNil'](_0x6dd41b)&&_[_0x308e('0x94')](_0x6dd41b)){return _0x54c14b['status'](0xc8)[_0x308e('0x1c')]({'contacts':_0x6dd41b});}else{logger[_0x308e('0x26')](_0x308e('0x95'),_0x308e('0x96'),0x194,_0x308e('0x97'));_0x54c14b[_0x308e('0x19')](0x194);}})['catch'](handleError(_0x54c14b,null));}; \ No newline at end of file +var _0x0a80=['keys','includeAll','options','create','body','find','describe','CampaignId','VoiceQueueId','Campaign','omit','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','findOne','scheduledat','recallme','UPDATE','CmCompany','CmList','List','VoiceQueue','dialActive','hopperId','Contact','Company','isNumber','getOpenContacts','rimraf','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','query','filters','concat','$gte','$lt','$lte','$ne','$not','$between','$in','$notIn','$notILike','$like','$overlap','$contains','$contained','$any','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x0a80,0x166));var _0x00a8=function(_0x21fcd0,_0x421b41){_0x21fcd0=_0x21fcd0-0x0;var _0x3b7d90=_0x0a80[_0x21fcd0];return _0x3b7d90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00a8('0x1'));var rp=require('request-promise');var moment=require(_0x00a8('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x00a8('0x3'));var path=require('path');var sox=require(_0x00a8('0x4'));var csv=require('to-csv');var ejs=require(_0x00a8('0x5'));var fs=require('fs');var fs_extra=require(_0x00a8('0x6'));var _=require(_0x00a8('0x7'));var squel=require(_0x00a8('0x8'));var crypto=require(_0x00a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x00a8('0xa'));var toCsv=require(_0x00a8('0xb'));var querystring=require(_0x00a8('0xc'));var Papa=require('papaparse');var Redis=require(_0x00a8('0xd'));var authService=require(_0x00a8('0xe'));var qs=require(_0x00a8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x00a8('0x10'));var config=require(_0x00a8('0x11'));var licenseUtil=require(_0x00a8('0x12'));var db=require(_0x00a8('0x13'))['db'];function respondWithStatusCode(_0xa762a7,_0x4a66a4){_0x4a66a4=_0x4a66a4||0xcc;return function(_0x15bed0){if(_0x15bed0){return _0xa762a7['sendStatus'](_0x4a66a4);}return _0xa762a7[_0x00a8('0x14')](_0x4a66a4)[_0x00a8('0x15')]();};}function respondWithResult(_0x233f94,_0x3ab9f1){_0x3ab9f1=_0x3ab9f1||0xc8;return function(_0x45765c){if(_0x45765c){return _0x233f94[_0x00a8('0x14')](_0x3ab9f1)[_0x00a8('0x16')](_0x45765c);}};}function respondWithFilteredResult(_0x5c1f27,_0x321aa0){return function(_0x1e20ca){if(_0x1e20ca){var _0x19097b=typeof _0x321aa0['offset']===_0x00a8('0x17')&&typeof _0x321aa0[_0x00a8('0x18')]===_0x00a8('0x17');var _0x3507ed=_0x1e20ca[_0x00a8('0x19')];var _0x4b6117=_0x19097b?0x0:_0x321aa0[_0x00a8('0x1a')];var _0x8427cd=_0x19097b?_0x1e20ca['count']:_0x321aa0[_0x00a8('0x1a')]+_0x321aa0['limit'];var _0x2ebd8e;if(_0x8427cd>=_0x3507ed){_0x8427cd=_0x3507ed;_0x2ebd8e=0xc8;}else{_0x2ebd8e=0xce;}_0x5c1f27[_0x00a8('0x14')](_0x2ebd8e);return _0x5c1f27[_0x00a8('0x1b')]('Content-Range',_0x4b6117+'-'+_0x8427cd+'/'+_0x3507ed)[_0x00a8('0x16')](_0x1e20ca);}return null;};}function patchUpdates(_0x52d4fc){return function(_0x49a5cc){try{jsonpatch['apply'](_0x49a5cc,_0x52d4fc,!![]);}catch(_0x331b2e){return BPromise[_0x00a8('0x1c')](_0x331b2e);}return _0x49a5cc[_0x00a8('0x1d')]();};}function saveUpdates(_0x3cd706,_0x4ebc62){return function(_0x1b1edd){if(_0x1b1edd){return _0x1b1edd[_0x00a8('0x1e')](_0x3cd706)[_0x00a8('0x1f')](function(_0x5df407){return _0x5df407;});}return null;};}function removeEntity(_0x18a70d,_0x32a2fb){return function(_0x2b1c7c){if(_0x2b1c7c){return _0x2b1c7c[_0x00a8('0x20')]()[_0x00a8('0x1f')](function(){_0x18a70d[_0x00a8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xebee43,_0x32d38){return function(_0x358bb1){if(!_0x358bb1){_0xebee43[_0x00a8('0x21')](0x194);}return _0x358bb1;};}function handleError(_0x16a3c9,_0x41e647){_0x41e647=_0x41e647||0x1f4;return function(_0x2637e4){logger[_0x00a8('0x22')](_0x2637e4[_0x00a8('0x23')]);if(_0x2637e4[_0x00a8('0x24')]){delete _0x2637e4['name'];}_0x16a3c9[_0x00a8('0x14')](_0x41e647)[_0x00a8('0x25')](_0x2637e4);};}exports[_0x00a8('0x26')]=function(_0x1b7f23,_0x25e29a){var _0x3a6349={},_0x3fb819={},_0x1f7634={'count':0x0,'rows':[]};var _0x588420=_[_0x00a8('0x27')](db[_0x00a8('0x28')][_0x00a8('0x29')],function(_0xbf0596){return{'name':_0xbf0596['fieldName'],'type':_0xbf0596[_0x00a8('0x2a')][_0x00a8('0x2b')]};});_0x3fb819['model']=_[_0x00a8('0x27')](_0x588420,_0x00a8('0x24'));_0x3fb819[_0x00a8('0x2c')]=_['keys'](_0x1b7f23[_0x00a8('0x2c')]);_0x3fb819[_0x00a8('0x2d')]=_['intersection'](_0x3fb819['model'],_0x3fb819[_0x00a8('0x2c')]);_0x3fb819[_0x00a8('0x2d')]=_[_0x00a8('0x2e')](_0x3fb819[_0x00a8('0x2d')],['$and','$or','$gt',_0x00a8('0x2f'),_0x00a8('0x30'),_0x00a8('0x31'),_0x00a8('0x32'),'$eq',_0x00a8('0x33'),_0x00a8('0x34'),'$notBetween',_0x00a8('0x35'),_0x00a8('0x36'),'$like','$notLike','$iLike',_0x00a8('0x37'),_0x00a8('0x38'),_0x00a8('0x39'),_0x00a8('0x3a'),_0x00a8('0x3b'),_0x00a8('0x3c')]);_0x3a6349['attributes']=_[_0x00a8('0x3d')](_0x3fb819[_0x00a8('0x3e')],qs[_0x00a8('0x3f')](_0x1b7f23[_0x00a8('0x2c')][_0x00a8('0x3f')]));_0x3a6349[_0x00a8('0x40')]=_0x3a6349[_0x00a8('0x40')][_0x00a8('0x41')]?_0x3a6349[_0x00a8('0x40')]:_0x3fb819[_0x00a8('0x3e')];if(!_0x1b7f23[_0x00a8('0x2c')][_0x00a8('0x42')]('nolimit')){_0x3a6349['limit']=qs[_0x00a8('0x18')](_0x1b7f23[_0x00a8('0x2c')]['limit']);_0x3a6349[_0x00a8('0x1a')]=qs[_0x00a8('0x1a')](_0x1b7f23[_0x00a8('0x2c')][_0x00a8('0x1a')]);}_0x3a6349[_0x00a8('0x43')]=qs['sort'](_0x1b7f23[_0x00a8('0x2c')][_0x00a8('0x44')]);_0x3a6349[_0x00a8('0x45')]=qs[_0x00a8('0x2d')](_[_0x00a8('0x46')](_0x1b7f23[_0x00a8('0x2c')],_0x3fb819[_0x00a8('0x2d')]),_0x588420);if(_0x1b7f23['query'][_0x00a8('0x47')]){_0x3a6349['where']=_[_0x00a8('0x48')](_0x3a6349[_0x00a8('0x45')],{'$or':_[_0x00a8('0x27')](_0x588420,function(_0x1f2cbd){if(_0x1f2cbd[_0x00a8('0x2a')]!==_0x00a8('0x49')){var _0xdb054c={};_0xdb054c[_0x1f2cbd['name']]={'$like':'%'+_0x1b7f23['query'][_0x00a8('0x47')]+'%'};return _0xdb054c;}})});}_0x3a6349=_['merge']({},_0x3a6349,_0x1b7f23['options']);var _0x26b199={'where':_0x3a6349['where']};return db[_0x00a8('0x28')][_0x00a8('0x19')](_0x26b199)[_0x00a8('0x1f')](function(_0x24afce){_0x1f7634[_0x00a8('0x19')]=_0x24afce;if(_0x1b7f23[_0x00a8('0x2c')]['includeAll']){_0x3a6349[_0x00a8('0x4a')]=[{'all':!![]}];}return db[_0x00a8('0x28')][_0x00a8('0x4b')](_0x3a6349);})[_0x00a8('0x1f')](function(_0x571e10){_0x1f7634[_0x00a8('0x4c')]=_0x571e10;return _0x1f7634;})[_0x00a8('0x1f')](respondWithFilteredResult(_0x25e29a,_0x3a6349))[_0x00a8('0x4d')](handleError(_0x25e29a,null));};exports[_0x00a8('0x4e')]=function(_0x1a4d2b,_0x384689){var _0x51d942={'raw':!![],'where':{'id':_0x1a4d2b[_0x00a8('0x4f')]['id']}},_0x3cafd7={};_0x3cafd7['model']=_[_0x00a8('0x50')](db[_0x00a8('0x28')]['rawAttributes']);_0x3cafd7[_0x00a8('0x2c')]=_[_0x00a8('0x50')](_0x1a4d2b[_0x00a8('0x2c')]);_0x3cafd7['filters']=_['intersection'](_0x3cafd7['model'],_0x3cafd7[_0x00a8('0x2c')]);_0x51d942[_0x00a8('0x40')]=_[_0x00a8('0x3d')](_0x3cafd7[_0x00a8('0x3e')],qs['fields'](_0x1a4d2b[_0x00a8('0x2c')][_0x00a8('0x3f')]));_0x51d942[_0x00a8('0x40')]=_0x51d942['attributes'][_0x00a8('0x41')]?_0x51d942[_0x00a8('0x40')]:_0x3cafd7[_0x00a8('0x3e')];if(_0x1a4d2b['query'][_0x00a8('0x51')]){_0x51d942[_0x00a8('0x4a')]=[{'all':!![]}];}_0x51d942=_[_0x00a8('0x48')]({},_0x51d942,_0x1a4d2b[_0x00a8('0x52')]);return db[_0x00a8('0x28')]['find'](_0x51d942)[_0x00a8('0x1f')](handleEntityNotFound(_0x384689,null))['then'](respondWithResult(_0x384689,null))[_0x00a8('0x4d')](handleError(_0x384689,null));};exports[_0x00a8('0x53')]=function(_0x41c998,_0x4356d8){return db[_0x00a8('0x28')][_0x00a8('0x53')](_0x41c998[_0x00a8('0x54')],{})[_0x00a8('0x1f')](respondWithResult(_0x4356d8,0xc9))[_0x00a8('0x4d')](handleError(_0x4356d8,null));};exports[_0x00a8('0x1e')]=function(_0x54ea12,_0x44f2d0){if(_0x54ea12['body']['id']){delete _0x54ea12[_0x00a8('0x54')]['id'];}return db['CmHopper'][_0x00a8('0x55')]({'where':{'id':_0x54ea12[_0x00a8('0x4f')]['id']}})[_0x00a8('0x1f')](handleEntityNotFound(_0x44f2d0,null))[_0x00a8('0x1f')](saveUpdates(_0x54ea12[_0x00a8('0x54')],null))['then'](respondWithResult(_0x44f2d0,null))[_0x00a8('0x4d')](handleError(_0x44f2d0,null));};exports[_0x00a8('0x56')]=function(_0x3b5024,_0x195d0f){return db[_0x00a8('0x28')][_0x00a8('0x56')]()[_0x00a8('0x1f')](respondWithResult(_0x195d0f,null))[_0x00a8('0x4d')](handleError(_0x195d0f,null));};exports[_0x00a8('0x20')]=function(_0x4a83b0,_0x5bc02a){var _0x5adcb5;return db['CmHopper'][_0x00a8('0x55')]({'where':{'id':_0x4a83b0[_0x00a8('0x4f')]['id']}})[_0x00a8('0x1f')](handleEntityNotFound(_0x5bc02a,null))['then'](function(_0x58c27b){if(_0x58c27b){return _0x58c27b[_0x00a8('0x20')]()[_0x00a8('0x1f')](function(_0x51c0db){return _0x51c0db;});}})[_0x00a8('0x1f')](function(_0x5cc75e){_0x5adcb5=_0x5cc75e;if(_0x5cc75e){if(_0x5cc75e['VoiceQueueId']||_0x5cc75e[_0x00a8('0x57')]){return db[_0x5cc75e[_0x00a8('0x58')]?'VoiceQueue':_0x00a8('0x59')][_0x00a8('0x55')]({'where':{'id':_0x5cc75e[_0x00a8('0x58')]?_0x5cc75e['VoiceQueueId']:_0x5cc75e[_0x00a8('0x57')]},'attributes':['id',_0x00a8('0x24')],'raw':!![]});}}})[_0x00a8('0x1f')](function(_0x32c2b5){var _0x34ce0d={};if(_0x32c2b5){_[_0x00a8('0x48')](_0x34ce0d,_[_0x00a8('0x5a')](_0x5adcb5['dataValues'],[_0x00a8('0x5b'),_0x00a8('0x5c'),'id']));_0x34ce0d[_0x00a8('0x5d')]=0x15;_0x34ce0d[_0x00a8('0x5e')]=_0x00a8('0x5f');_0x34ce0d[_0x00a8('0x60')]=_0x32c2b5[_0x00a8('0x24')];_0x34ce0d['membername']=_0x4a83b0[_0x00a8('0x61')][_0x00a8('0x24')];_0x34ce0d[_0x00a8('0x62')]=_0x4a83b0[_0x00a8('0x61')]['id'];_0x34ce0d[_0x00a8('0x5f')]=!![];_0x34ce0d[_0x00a8('0x63')]=moment()[_0x00a8('0x64')](_0x00a8('0x65'));_0x34ce0d[_0x00a8('0x66')]=_0x5adcb5[_0x00a8('0x67')];_0x34ce0d[_0x00a8('0x68')]=_0x5adcb5['VoiceQueueId']?_0x00a8('0x69'):'ivr';return db[_0x00a8('0x6a')][_0x00a8('0x55')]({'where':{'id':_0x34ce0d[_0x00a8('0x6b')]},'attributes':['firstName','lastName']})[_0x00a8('0x1f')](function(_0xaf8940){if(!_[_0x00a8('0x6c')](_0x5bc02a)&&!_[_0x00a8('0x6c')](_0xaf8940[_0x00a8('0x6d')])){_0x34ce0d[_0x00a8('0x6e')]=_0xaf8940['firstName'];if(!_[_0x00a8('0x6c')](_0xaf8940[_0x00a8('0x6f')])){_0x34ce0d[_0x00a8('0x6e')]+='\x20'+_0xaf8940[_0x00a8('0x6f')];}}})[_0x00a8('0x70')](function(){return db[_0x00a8('0x71')][_0x00a8('0x53')](_0x34ce0d);});}})[_0x00a8('0x1f')](function(){return _0x5bc02a[_0x00a8('0x14')](0xcc)['end']();})['catch'](handleError(_0x5bc02a,null));};exports[_0x00a8('0x72')]=function(_0x3fb233,_0x1389d1,_0x57d285){var _0x5767ed=[];return db[_0x00a8('0x6a')][_0x00a8('0x56')]()[_0x00a8('0x1f')](function(_0x2b5780){_0x5767ed=_[_0x00a8('0x50')](_0x2b5780);return _0x3fb233[_0x00a8('0x61')][_0x00a8('0x73')]({'where':{'type':_0x00a8('0x74'),'dialActive':!![],'dialMethod':_0x00a8('0x75')},'attributes':['id',_0x00a8('0x76'),_0x00a8('0x77')],'raw':!![]});})['then'](function(_0x3f3ed9){if(_0x3f3ed9&&_0x3f3ed9[_0x00a8('0x41')]){return db[_0x00a8('0x78')][_0x00a8('0x79')](function(_0x148467){var _0xdbc7c3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x00a8('0x64')](_0x00a8('0x65'))},'VoiceQueueId':{'$in':_[_0x00a8('0x27')](_0x3f3ed9,'id')},'$or':[{'UserId':null},{'UserId':_0x3fb233[_0x00a8('0x61')]['id']}]};var _0x12b105={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x3f3ed9)[_0x00a8('0x47')]([_0x00a8('0x77'),0x0])[_0x00a8('0x27')]('id')[_0x00a8('0x7a')]()},'$or':[{'UserId':null},{'UserId':_0x3fb233[_0x00a8('0x61')]['id']}]};var _0x43f5f6={'$or':[_0xdbc7c3,_0x12b105]};var _0x3e521b=[];if(_0x3fb233[_0x00a8('0x54')][_0x00a8('0x7b')]&&_0x3fb233[_0x00a8('0x54')]['direction']===_0x00a8('0x7c')){if(!_['isEmpty'](_0x3fb233['body'][_0x00a8('0x7d')])){_0x43f5f6['id']={'$in':_0x3fb233[_0x00a8('0x54')][_0x00a8('0x7d')]};}_0x3e521b=[[_0x00a8('0x7e'),'ASC'],[_0x00a8('0x7f'),_0x3f3ed9[0x0]['dialOrderByScheduledAt']===_0x00a8('0x80')?_0x00a8('0x81'):'ASC'],db[_0x00a8('0x78')]['literal'](_0x00a8('0x82')),['id',_0x00a8('0x81')]];}else{if(!_['isEmpty'](_0x3fb233[_0x00a8('0x54')][_0x00a8('0x7d')])){_0x43f5f6['id']={'$notIn':_0x3fb233[_0x00a8('0x54')][_0x00a8('0x7d')]};}_0x3e521b=[[_0x00a8('0x7e'),'DESC'],[_0x00a8('0x7f'),_0x3f3ed9[0x0]['dialOrderByScheduledAt']],db[_0x00a8('0x78')][_0x00a8('0x83')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x00a8('0x80')]];}return db[_0x00a8('0x28')][_0x00a8('0x84')]({'attributes':['id',_0x00a8('0x85'),_0x00a8('0x86')],'where':_0x43f5f6,'order':_0x3e521b,'transaction':_0x148467,'lock':_0x148467['LOCK'][_0x00a8('0x87')],'include':[{'model':db[_0x00a8('0x6a')],'as':'Contact','attributes':_0x5767ed,'include':[{'model':db[_0x00a8('0x88')],'as':'Company','attributes':['id',_0x00a8('0x24')]}]},{'model':db[_0x00a8('0x89')],'as':_0x00a8('0x8a'),'attributes':['id','name']},{'model':db[_0x00a8('0x8b')],'as':'Queue','attributes':['id',_0x00a8('0x24'),_0x00a8('0x8c')]}]})[_0x00a8('0x1f')](function(_0x46d0cd){if(_0x46d0cd){return _0x46d0cd[_0x00a8('0x1e')]({'UserId':_0x3fb233[_0x00a8('0x61')]['id']},{'transaction':_0x148467});}});});}})[_0x00a8('0x1f')](handleEntityNotFound(_0x1389d1,null))[_0x00a8('0x1f')](respondWithResult(_0x1389d1,null))[_0x00a8('0x4d')](handleError(_0x1389d1,null));};exports['getPreviewRecall']=function(_0x43739f,_0x481931,_0x6b6aa0){var _0x54e589=[];return db[_0x00a8('0x6a')][_0x00a8('0x56')]()[_0x00a8('0x1f')](function(_0x37c848){_0x54e589=_[_0x00a8('0x50')](_0x37c848);return _0x43739f[_0x00a8('0x61')]['getVoiceQueues']({'where':{'type':_0x00a8('0x74'),'dialActive':!![],'dialMethod':_0x00a8('0x75')},'attributes':['id',_0x00a8('0x76'),_0x00a8('0x77')],'raw':!![]});})[_0x00a8('0x1f')](function(_0x318cdd){if(_0x318cdd&&_0x318cdd[_0x00a8('0x41')]){return db[_0x00a8('0x78')][_0x00a8('0x79')](function(_0x47c672){var _0x5206cb={'active':![],'recallme':!![],'id':_0x43739f[_0x00a8('0x54')][_0x00a8('0x8d')]};return db[_0x00a8('0x28')][_0x00a8('0x84')]({'attributes':['id',_0x00a8('0x85'),_0x00a8('0x86')],'where':_0x5206cb,'transaction':_0x47c672,'lock':_0x47c672['LOCK'][_0x00a8('0x87')],'include':[{'model':db[_0x00a8('0x6a')],'as':_0x00a8('0x8e'),'attributes':_0x54e589,'include':[{'model':db[_0x00a8('0x88')],'as':_0x00a8('0x8f'),'attributes':['id',_0x00a8('0x24')]}]},{'model':db[_0x00a8('0x89')],'as':_0x00a8('0x8a'),'attributes':['id',_0x00a8('0x24')]},{'model':db[_0x00a8('0x8b')],'as':'Queue','attributes':['id',_0x00a8('0x24'),_0x00a8('0x8c')]}]})[_0x00a8('0x1f')](function(_0xe16fd9){if(_0xe16fd9){return _0xe16fd9[_0x00a8('0x1e')]({'UserId':_0x43739f[_0x00a8('0x61')]['id']},{'transaction':_0x47c672});}});});}})[_0x00a8('0x1f')](handleEntityNotFound(_0x481931,null))[_0x00a8('0x1f')](respondWithResult(_0x481931,null))['catch'](handleError(_0x481931,null));};exports['getOpenContacts']=function(_0x472cb9,_0x5ee379,_0x5af666){return _0x472cb9[_0x00a8('0x61')][_0x00a8('0x73')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x00a8('0x75')},'attributes':['id'],'raw':!![]})['then'](function(_0x4be9e5){if(_0x4be9e5&&_0x4be9e5['length']){return db[_0x00a8('0x28')][_0x00a8('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x00a8('0x65'))},'VoiceQueueId':{'$in':_[_0x00a8('0x27')](_0x4be9e5,'id')},'$or':[{'UserId':null},{'UserId':_0x472cb9[_0x00a8('0x61')]['id']}]}});}return 0x0;})[_0x00a8('0x1f')](function(_0x395b4b){if(!_['isNil'](_0x395b4b)&&_[_0x00a8('0x90')](_0x395b4b)){return _0x5ee379[_0x00a8('0x14')](0xc8)[_0x00a8('0x16')]({'contacts':_0x395b4b});}else{logger[_0x00a8('0x22')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x00a8('0x91'),0x194,'entity\x20not\x20found');_0x5ee379['sendStatus'](0x194);}})[_0x00a8('0x4d')](handleError(_0x5ee379,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index cec7e27..0b8e413 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 _0xe2fe=['CmHopper','scheduledat','phone','priority','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x6d6f7,_0x4ba1a9){var _0x2a6afe=function(_0x2b9c3c){while(--_0x2b9c3c){_0x6d6f7['push'](_0x6d6f7['shift']());}};_0x2a6afe(++_0x4ba1a9);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./cmHopper.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['scheduledat']},{'name':_0xee2f('0xb'),'fields':[_0xee2f('0xb')]},{'name':'priority','fields':[_0xee2f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x440e90,_0x11a7be){var _0x156b4d=function(_0xe75c15){while(--_0xe75c15){_0x440e90['push'](_0x440e90['shift']());}};_0x156b4d(++_0x11a7be);}(_0x7096,0x10c));var _0x6709=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7096[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('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 0294539..1df840e 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 _0x2f50=['error','code','CmHopper,\x20%s,\x20%s','message','result','CmHopper','findAll','options','raw','attributes','limit','include','map','model','GetCmHopper','catch','find','where','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','sequelize','order','UPDATE','CmContact','Contact','Agent','voicePause','length','UserId','push','update','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','ContactId','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','GetContactRecallMe','describe','transaction','LOCK','GetCmHopperPreview','keys','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueId','NOW()\x20+\x20INTERVAL\x20','name','CmList','List','\x20MINUTE','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','twilio/lib/webhooks/webhooks','client','http','request','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f9750,_0x2111d8){var _0x292370=function(_0x54de22){while(--_0x54de22){_0x2f9750['push'](_0x2f9750['shift']());}};_0x292370(++_0x2111d8);}(_0x2f50,0x1ea));var _0x02f5=function(_0x19358d,_0x4a2c1c){_0x19358d=_0x19358d-0x0;var _0x385078=_0x2f50[_0x19358d];return _0x385078;};'use strict';var _=require(_0x02f5('0x0'));var util=require('util');var moment=require(_0x02f5('0x1'));var BPromise=require(_0x02f5('0x2'));var rs=require(_0x02f5('0x3'));var fs=require('fs');var Redis=require(_0x02f5('0x4'));var db=require(_0x02f5('0x5'))['db'];var utils=require(_0x02f5('0x6'));var logger=require(_0x02f5('0x7'))(_0x02f5('0x8'));var config=require(_0x02f5('0x9'));var jayson=require('jayson/promise');const {validateExpressRequest}=require(_0x02f5('0xa'));var client=jayson[_0x02f5('0xb')][_0x02f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42fe61,_0x3d7b69,_0x3fefc1){return new BPromise(function(_0x50bf85,_0xea6a70){return client[_0x02f5('0xd')](_0x42fe61,_0x3fefc1)[_0x02f5('0xe')](function(_0x330f7e){logger[_0x02f5('0xf')]('CmHopper,\x20%s,\x20%s',_0x3d7b69,_0x02f5('0x10'));logger[_0x02f5('0x11')](_0x02f5('0x12'),_0x3d7b69,_0x02f5('0x10'),JSON[_0x02f5('0x13')](_0x330f7e));if(_0x330f7e[_0x02f5('0x14')]){if(_0x330f7e[_0x02f5('0x14')][_0x02f5('0x15')]===0x1f4){logger[_0x02f5('0x14')](_0x02f5('0x16'),_0x3d7b69,_0x330f7e[_0x02f5('0x14')][_0x02f5('0x17')]);return _0xea6a70(_0x330f7e[_0x02f5('0x14')]['message']);}logger['error']('CmHopper,\x20%s,\x20%s',_0x3d7b69,_0x330f7e[_0x02f5('0x14')]['message']);return _0x50bf85(_0x330f7e['error'][_0x02f5('0x17')]);}else{logger['info'](_0x02f5('0x16'),_0x3d7b69,_0x02f5('0x10'));_0x50bf85(_0x330f7e[_0x02f5('0x18')][_0x02f5('0x17')]);}})['catch'](function(_0x2ac9f6){logger[_0x02f5('0x14')](_0x02f5('0x16'),_0x3d7b69,_0x2ac9f6);_0xea6a70(_0x2ac9f6);});});}exports['GetCmHopper']=function(_0x48e816){var _0x3355b2=this;return new Promise(function(_0x45bfb0,_0x2b0a00){return db[_0x02f5('0x19')][_0x02f5('0x1a')]({'raw':_0x48e816[_0x02f5('0x1b')]?_0x48e816['options'][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x48e816[_0x02f5('0x1b')]?_0x48e816[_0x02f5('0x1b')]['where']||null:null,'attributes':_0x48e816['options']?_0x48e816[_0x02f5('0x1b')][_0x02f5('0x1d')]||null:null,'limit':_0x48e816['options']?_0x48e816[_0x02f5('0x1b')][_0x02f5('0x1e')]||null:null,'include':_0x48e816[_0x02f5('0x1b')]?_0x48e816[_0x02f5('0x1b')][_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x48e816[_0x02f5('0x1b')]['include'],function(_0x182e57){return{'model':db[_0x182e57[_0x02f5('0x21')]],'as':_0x182e57['as'],'attributes':_0x182e57[_0x02f5('0x1d')],'include':_0x182e57['include']?_[_0x02f5('0x20')](_0x182e57[_0x02f5('0x1f')],function(_0x3e7183){return{'model':db[_0x3e7183[_0x02f5('0x21')]],'as':_0x3e7183['as'],'attributes':_0x3e7183[_0x02f5('0x1d')],'include':_0x3e7183[_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x3e7183['include'],function(_0x4d1618){return{'model':db[_0x4d1618['model']],'as':_0x4d1618['as'],'attributes':_0x4d1618[_0x02f5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02f5('0xe')](function(_0x70b430){logger[_0x02f5('0xf')]('GetCmHopper',_0x48e816);logger[_0x02f5('0x11')](_0x02f5('0x22'),_0x48e816,JSON[_0x02f5('0x13')](_0x70b430));_0x45bfb0(_0x70b430);})[_0x02f5('0x23')](function(_0x2a7f3c){logger[_0x02f5('0x14')](_0x02f5('0x22'),_0x2a7f3c['message'],_0x48e816);_0x2b0a00(_0x3355b2[_0x02f5('0x14')](0x1f4,_0x2a7f3c['message']));});});};exports['ShowCmHopper']=function(_0x534141){var _0x3262d5=this;return new Promise(function(_0x33d37b,_0x338bdf){return db[_0x02f5('0x19')][_0x02f5('0x24')]({'raw':_0x534141[_0x02f5('0x1b')]?_0x534141[_0x02f5('0x1b')][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x534141[_0x02f5('0x1b')]?_0x534141['options'][_0x02f5('0x25')]||null:null,'attributes':_0x534141['options']?_0x534141[_0x02f5('0x1b')][_0x02f5('0x1d')]||null:null,'include':_0x534141[_0x02f5('0x1b')]?_0x534141[_0x02f5('0x1b')][_0x02f5('0x1f')]?_['map'](_0x534141['options'][_0x02f5('0x1f')],function(_0x43d7ae){return{'model':db[_0x43d7ae[_0x02f5('0x21')]],'as':_0x43d7ae['as'],'attributes':_0x43d7ae[_0x02f5('0x1d')],'include':_0x43d7ae[_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x43d7ae[_0x02f5('0x1f')],function(_0x412700){return{'model':db[_0x412700[_0x02f5('0x21')]],'as':_0x412700['as'],'attributes':_0x412700[_0x02f5('0x1d')],'include':_0x412700['include']?_[_0x02f5('0x20')](_0x412700[_0x02f5('0x1f')],function(_0x57dc87){return{'model':db[_0x57dc87[_0x02f5('0x21')]],'as':_0x57dc87['as'],'attributes':_0x57dc87['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51bc23){logger[_0x02f5('0xf')](_0x02f5('0x26'),_0x534141);logger[_0x02f5('0x11')](_0x02f5('0x26'),_0x534141,JSON['stringify'](_0x51bc23));_0x33d37b(_0x51bc23);})[_0x02f5('0x23')](function(_0xdfc21c){logger[_0x02f5('0x14')](_0x02f5('0x26'),_0xdfc21c['message'],_0x534141);_0x338bdf(_0x3262d5[_0x02f5('0x14')](0x1f4,_0xdfc21c[_0x02f5('0x17')]));});});};exports[_0x02f5('0x27')]=function(_0x55deea){var _0x5cf389=this;return new Promise(function(_0x5a7312,_0x2949f5){return db[_0x02f5('0x19')][_0x02f5('0x28')](_0x55deea[_0x02f5('0x29')],{'raw':_0x55deea['options']?_0x55deea[_0x02f5('0x1b')][_0x02f5('0x1c')]===undefined?!![]:![]:!![]})[_0x02f5('0xe')](function(_0x2d27ef){logger[_0x02f5('0xf')](_0x02f5('0x27'),_0x55deea);logger[_0x02f5('0x11')](_0x02f5('0x27'),_0x55deea,JSON[_0x02f5('0x13')](_0x2d27ef));_0x5a7312(_0x2d27ef);})['catch'](function(_0x4d9e7f){logger[_0x02f5('0x14')](_0x02f5('0x27'),_0x4d9e7f[_0x02f5('0x17')],_0x55deea);_0x2949f5(_0x5cf389[_0x02f5('0x14')](0x1f4,_0x4d9e7f['message']));});});};exports[_0x02f5('0x2a')]=function(_0x13fc52){var _0x31b018=this;return new Promise(function(_0xab2de9,_0x2f981f){return db[_0x02f5('0x19')]['update'](_0x13fc52[_0x02f5('0x29')],{'raw':_0x13fc52[_0x02f5('0x1b')]?_0x13fc52['options'][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13fc52[_0x02f5('0x1b')]?_0x13fc52['options'][_0x02f5('0x25')]||null:null,'attributes':_0x13fc52[_0x02f5('0x1b')]?_0x13fc52['options'][_0x02f5('0x1d')]||null:null,'limit':_0x13fc52[_0x02f5('0x1b')]?_0x13fc52[_0x02f5('0x1b')]['limit']||null:null})[_0x02f5('0xe')](function(_0x560881){logger[_0x02f5('0xf')]('UpdateCmHopper',_0x13fc52);logger[_0x02f5('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x02f5('0x13')](_0x13fc52[_0x02f5('0x1b')]['where']),_0x13fc52[_0x02f5('0x29')][_0x02f5('0x2b')]);logger[_0x02f5('0x11')](_0x02f5('0x2a'),_0x13fc52,JSON['stringify'](_0x560881));_0xab2de9(_0x560881);})[_0x02f5('0x23')](function(_0x498cee){logger['error'](_0x02f5('0x2a'),_0x498cee[_0x02f5('0x17')],_0x13fc52);_0x2f981f(_0x31b018[_0x02f5('0x14')](0x1f4,_0x498cee['message']));});});};exports[_0x02f5('0x2c')]=function(_0x461558){var _0x36b6e2=this;return new Promise(function(_0x552dd4,_0x40f072){return db[_0x02f5('0x19')][_0x02f5('0x2d')]({'where':_0x461558['options']?_0x461558['options']['where']||null:null})[_0x02f5('0xe')](function(_0x307326){logger[_0x02f5('0xf')](_0x02f5('0x2c'),_0x461558);logger['debug'](_0x02f5('0x2c'),_0x461558,JSON[_0x02f5('0x13')](_0x307326));_0x552dd4(_0x307326);})[_0x02f5('0x23')](function(_0x1449e9){logger[_0x02f5('0x14')](_0x02f5('0x2c'),_0x1449e9[_0x02f5('0x17')],_0x461558);_0x40f072(_0x36b6e2['error'](0x1f4,_0x1449e9[_0x02f5('0x17')]));});});};exports[_0x02f5('0x2e')]=function(_0x58d38b){var _0x4cad51=this;return new Promise(function(_0x1fc170,_0x3aa80c){return db['CmContact']['describe']()[_0x02f5('0xe')](function(_0x2635aa){return db[_0x02f5('0x2f')]['transaction'](function(_0x14d92b){return db['CmHopper'][_0x02f5('0x1a')]({'where':_0x58d38b[_0x02f5('0x1b')]?_0x58d38b[_0x02f5('0x1b')][_0x02f5('0x25')]||null:null,'attributes':_0x58d38b['options']?_0x58d38b[_0x02f5('0x1b')]['attributes']||null:null,'limit':_0x58d38b[_0x02f5('0x1b')]?_0x58d38b[_0x02f5('0x1b')]['limit']||null:null,'order':_0x58d38b['options']?_0x58d38b[_0x02f5('0x1b')][_0x02f5('0x30')]||null:null,'transaction':_0x14d92b,'lock':_0x14d92b['LOCK'][_0x02f5('0x31')],'include':[{'model':db[_0x02f5('0x32')],'as':_0x02f5('0x33'),'attributes':_['keys'](_0x2635aa)},{'model':db['User'],'as':_0x02f5('0x34'),'attributes':['id','name',_0x02f5('0x35')]}]})[_0x02f5('0xe')](function(_0x449252){var _0x320061=[];var _0x5b9993=[];for(var _0x164dcf=0x0;_0x164dcf<_0x449252[_0x02f5('0x36')];_0x164dcf+=0x1){var _0x520c20=_0x449252[_0x164dcf][_0x02f5('0x37')];if(_0x520c20===null){_0x320061[_0x02f5('0x38')](_0x449252[_0x164dcf][_0x02f5('0x39')](_0x58d38b['body'],{'transaction':_0x14d92b}));}else if(!_0x5b9993['includes'](_0x520c20)){_0x5b9993[_0x02f5('0x38')](_0x520c20);_0x320061['push'](_0x449252[_0x164dcf]['update'](_0x58d38b[_0x02f5('0x29')],{'transaction':_0x14d92b}));}}return BPromise[_0x02f5('0x3a')](_0x320061);});})['then'](function(_0xf405e9){logger[_0x02f5('0xf')](_0x02f5('0x2e'),_0x58d38b);if(_0xf405e9['length']>0x0){logger[_0x02f5('0xf')](_0x02f5('0x3b'),_0xf405e9[0x0]['dataValues']['id'],_0xf405e9[0x0]['dataValues'][_0x02f5('0x3c')],_0xf405e9[0x0][_0x02f5('0x3d')][_0x02f5('0x2b')]);}logger[_0x02f5('0x11')]('GetContactDialer',_0x58d38b,JSON[_0x02f5('0x13')](_0xf405e9));_0x1fc170(_0xf405e9);})[_0x02f5('0x23')](function(_0x5c468b){logger[_0x02f5('0x14')](_0x02f5('0x2e'),_0x5c468b['message'],_0x58d38b);_0x3aa80c(_0x4cad51['error'](0x1f4,_0x5c468b[_0x02f5('0x17')]));});});});};exports[_0x02f5('0x3e')]=function(_0x22f74e){var _0x37aeaa=this;return new Promise(function(_0x6d28a8,_0x360fce){return db[_0x02f5('0x2f')]['transaction'](function(_0x498f88){return db[_0x02f5('0x3f')]['create'](_0x22f74e[_0x02f5('0x29')],{'raw':_0x22f74e[_0x02f5('0x1b')]?_0x22f74e[_0x02f5('0x1b')][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x498f88})['then'](function(){logger['info'](_0x02f5('0x40'),JSON['stringify'](_0x22f74e[_0x02f5('0x1b')]['where']),_0x22f74e[_0x02f5('0x1b')][_0x02f5('0x25')][_0x02f5('0x2b')]);return db[_0x02f5('0x19')][_0x02f5('0x2d')]({'where':_0x22f74e['options']?_0x22f74e[_0x02f5('0x1b')]['where']||null:null,'transaction':_0x498f88});});})[_0x02f5('0xe')](function(_0x503da6){logger['info'](_0x02f5('0x3e'),_0x22f74e);logger[_0x02f5('0x11')](_0x02f5('0x3e'),_0x22f74e,JSON['stringify'](_0x503da6));_0x6d28a8(_0x503da6);})['catch'](function(_0x51f16a){logger[_0x02f5('0x14')](_0x02f5('0x3e'),_0x51f16a[_0x02f5('0x17')],_0x22f74e);_0x360fce(_0x37aeaa[_0x02f5('0x14')](0x1f4,_0x51f16a['message']));});});};exports[_0x02f5('0x41')]=function(_0x5aca98){var _0x9b92e4=this;return new Promise(function(_0x5880a6,_0x4c6e95){return db[_0x02f5('0x19')][_0x02f5('0x1a')]({'raw':_0x5aca98[_0x02f5('0x1b')]?_0x5aca98[_0x02f5('0x1b')][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x5aca98[_0x02f5('0x1b')]?_0x5aca98[_0x02f5('0x1b')]['where']||null:null,'attributes':[[db[_0x02f5('0x2f')]['fn']('COUNT',db[_0x02f5('0x2f')]['fn']('IF',db['sequelize'][_0x02f5('0x42')](_0x02f5('0x43')+util[_0x02f5('0x44')](_0x02f5('0x45'),moment()[_0x02f5('0x44')](_0x02f5('0x46')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x3d9123){logger[_0x02f5('0xf')](_0x02f5('0x41'),_0x5aca98);logger[_0x02f5('0x11')](_0x02f5('0x41'),_0x5aca98,JSON[_0x02f5('0x13')](_0x3d9123));_0x5880a6(_0x3d9123);})['catch'](function(_0xe6d4c9){logger[_0x02f5('0x14')](_0x02f5('0x41'),_0xe6d4c9['message'],_0x5aca98);_0x4c6e95(_0x9b92e4['error'](0x1f4,_0xe6d4c9[_0x02f5('0x17')]));});});};exports[_0x02f5('0x47')]=function(_0x4a12ca){var _0x565886=this;return new Promise(function(_0x485549,_0xb14d53){return db[_0x02f5('0x32')][_0x02f5('0x48')]()['then'](function(_0xba12f3){return db['sequelize'][_0x02f5('0x49')](function(_0xc9486){return db[_0x02f5('0x19')]['findAll']({'where':_0x4a12ca[_0x02f5('0x1b')]?_0x4a12ca[_0x02f5('0x1b')][_0x02f5('0x25')]||null:null,'attributes':_0x4a12ca[_0x02f5('0x1b')]?_0x4a12ca[_0x02f5('0x1b')][_0x02f5('0x1d')]||null:null,'limit':0x1,'order':_0x4a12ca[_0x02f5('0x1b')]?_0x4a12ca[_0x02f5('0x1b')][_0x02f5('0x30')]||null:null,'group':db[_0x02f5('0x19')][_0x02f5('0x37')],'transaction':_0xc9486,'lock':_0xc9486[_0x02f5('0x4a')][_0x02f5('0x31')],'include':_0x4a12ca[_0x02f5('0x1b')]?_0x4a12ca[_0x02f5('0x1b')][_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x4a12ca[_0x02f5('0x1b')]['include'],function(_0x2c90cd){return{'model':db[_0x2c90cd[_0x02f5('0x21')]],'as':_0x2c90cd['as'],'attributes':_0x2c90cd[_0x02f5('0x1d')],'include':_0x2c90cd[_0x02f5('0x1f')]?_['map'](_0x2c90cd['include'],function(_0x5d084f){return{'model':db[_0x5d084f[_0x02f5('0x21')]],'as':_0x5d084f['as'],'attributes':_0x5d084f[_0x02f5('0x1d')],'include':_0x5d084f[_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x5d084f[_0x02f5('0x1f')],function(_0xac9c22){return{'model':db[_0xac9c22[_0x02f5('0x21')]],'as':_0xac9c22['as'],'attributes':_0xac9c22['attributes']};}):[]};}):[]};}):[]:[]})[_0x02f5('0xe')](function(_0x2e1a81){var _0x237752=[];for(var _0x50e25a=0x0;_0x50e25a<_0x2e1a81[_0x02f5('0x36')];_0x50e25a+=0x1){_0x237752[_0x02f5('0x38')](_0x2e1a81[_0x50e25a][_0x02f5('0x39')](_0x4a12ca['body'],{'transaction':_0xc9486}));}return BPromise[_0x02f5('0x3a')](_0x237752);});})['then'](function(_0x472a07){logger[_0x02f5('0xf')](_0x02f5('0x47'),_0x4a12ca);logger[_0x02f5('0x11')](_0x02f5('0x47'),_0x4a12ca,JSON[_0x02f5('0x13')](_0x472a07));_0x485549(_0x472a07);})[_0x02f5('0x23')](function(_0x3b8adc){logger[_0x02f5('0x14')]('GetContactRecallMe',_0x3b8adc[_0x02f5('0x17')],_0x4a12ca);_0xb14d53(_0x565886[_0x02f5('0x14')](0x1f4,_0x3b8adc[_0x02f5('0x17')]));});});});};exports[_0x02f5('0x4b')]=function(_0x11259f){var _0x52ddc8=this;return new Promise(function(_0xc5b1a3,_0x247834){db[_0x02f5('0x32')][_0x02f5('0x48')]()[_0x02f5('0xe')](function(_0x3f8952){return db[_0x02f5('0x19')][_0x02f5('0x1a')]({'raw':_0x11259f[_0x02f5('0x1b')]?_0x11259f['options'][_0x02f5('0x1c')]===undefined?!![]:![]:!![],'where':_0x11259f['options']?_0x11259f[_0x02f5('0x1b')][_0x02f5('0x25')]||null:null,'attributes':_0x11259f[_0x02f5('0x1b')]?_0x11259f[_0x02f5('0x1b')]['attributes']||null:null,'limit':_0x11259f[_0x02f5('0x1b')]?_0x11259f['options'][_0x02f5('0x1e')]||null:null,'include':_0x11259f[_0x02f5('0x1b')]?_0x11259f['options'][_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x11259f[_0x02f5('0x1b')]['include'],function(_0x1622b6){return{'model':db[_0x1622b6[_0x02f5('0x21')]],'as':_0x1622b6['as'],'attributes':_0x1622b6['as']==='Contact'?_[_0x02f5('0x4c')](_0x3f8952):_0x1622b6[_0x02f5('0x1d')],'include':_0x1622b6[_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x1622b6['include'],function(_0x43a97c){return{'model':db[_0x43a97c['model']],'as':_0x43a97c['as'],'attributes':_0x43a97c[_0x02f5('0x1d')],'include':_0x43a97c[_0x02f5('0x1f')]?_[_0x02f5('0x20')](_0x43a97c[_0x02f5('0x1f')],function(_0x10bbef){return{'model':db[_0x10bbef[_0x02f5('0x21')]],'as':_0x10bbef['as'],'attributes':_0x10bbef[_0x02f5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x02f5('0xe')](function(_0x31cb56){logger[_0x02f5('0xf')](_0x02f5('0x22'),_0x11259f);logger[_0x02f5('0x11')](_0x02f5('0x22'),_0x11259f,JSON['stringify'](_0x31cb56));_0xc5b1a3(_0x31cb56);})[_0x02f5('0x23')](function(_0x387719){logger[_0x02f5('0x14')]('GetCmHopper',_0x387719[_0x02f5('0x17')],_0x11259f);_0x247834(_0x52ddc8['error'](0x1f4,_0x387719['message']));});});});};exports[_0x02f5('0x4d')]=function(_0x3f1caf){var _0x1b1259=this;return new Promise(function(_0x2d5442,_0x52d85e){return db[_0x02f5('0x2f')]['transaction'](function(_0x2569bf){return db['CmHopper']['update']({'active':![]},{'where':{},'transaction':_0x2569bf})['then'](function(_0x59a265){logger[_0x02f5('0xf')](_0x02f5('0x4d'),_0x3f1caf);logger[_0x02f5('0x11')]('ResetActiveCalls',_0x3f1caf,JSON[_0x02f5('0x13')](_0x59a265));_0x2d5442(_0x59a265);})[_0x02f5('0x23')](function(_0x4e0c63){logger[_0x02f5('0x14')](_0x02f5('0x4d'),_0x4e0c63['message'],_0x3f1caf);_0x52d85e(_0x1b1259['error'](0x1f4,_0x4e0c63[_0x02f5('0x17')]));});});});};exports[_0x02f5('0x4e')]=function(_0x19f436){var _0x5616ab=this;var _0x56ec5b=_0x19f436[_0x02f5('0x29')][_0x02f5('0x25')][_0x02f5('0x4f')];var _0x2acf89=_0x19f436['body'][_0x02f5('0x25')]['interval'];return new Promise(function(_0x313ede,_0x4d354b){return db[_0x02f5('0x19')]['findAll']({'where':{'voiceQueueId':_0x56ec5b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db['sequelize']['literal'](_0x02f5('0x50')+_0x2acf89+'\x20MINUTE')}},'include':[{'model':db['CmContact'],'as':_0x02f5('0x33')},{'model':db['User'],'as':_0x02f5('0x34'),'attributes':['id',_0x02f5('0x51'),_0x02f5('0x35')]},{'model':db[_0x02f5('0x52')],'as':_0x02f5('0x53')}]})[_0x02f5('0xe')](function(_0x406824){return db[_0x02f5('0x2f')][_0x02f5('0x49')](function(_0x2d4c9f){return db[_0x02f5('0x19')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0x56ec5b,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x02f5('0x2f')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x2acf89+_0x02f5('0x54'))}},'transaction':_0x2d4c9f})[_0x02f5('0xe')](function(_0x5a4572){_0x313ede(_0x406824);})[_0x02f5('0x23')](function(_0x3041a4){logger[_0x02f5('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x3041a4['message'],_0x19f436);_0x4d354b(validateExpressRequest);});});})[_0x02f5('0x23')](function(_0x218276){logger[_0x02f5('0x14')](_0x02f5('0x4e'),_0x218276['message'],_0x19f436);_0x4d354b(_0x5616ab['error'](0x1f4,_0x218276['message']));});});}; \ No newline at end of file +var _0x0fb7=['map','ShowCmHopper','CreateCmHopper','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','GetCmHopperPreview','ResetActiveCalls','voiceQueueId','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','User','CmList','List','literal','CmHopperHandlePreviewRecallNotifications','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','twilio/lib/webhooks/webhooks','client','http','then','info','request\x20sent','debug','stringify','error','message','CmHopper,\x20%s,\x20%s','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model'];(function(_0x1f8522,_0x207b3c){var _0x305d31=function(_0x3e1f50){while(--_0x3e1f50){_0x1f8522['push'](_0x1f8522['shift']());}};_0x305d31(++_0x207b3c);}(_0x0fb7,0xdd));var _0x70fb=function(_0x54cefb,_0x192225){_0x54cefb=_0x54cefb-0x0;var _0x5e4fbb=_0x0fb7[_0x54cefb];return _0x5e4fbb;};'use strict';var _=require(_0x70fb('0x0'));var util=require(_0x70fb('0x1'));var moment=require(_0x70fb('0x2'));var BPromise=require(_0x70fb('0x3'));var rs=require(_0x70fb('0x4'));var fs=require('fs');var Redis=require(_0x70fb('0x5'));var db=require(_0x70fb('0x6'))['db'];var utils=require(_0x70fb('0x7'));var logger=require('../../config/logger')(_0x70fb('0x8'));var config=require(_0x70fb('0x9'));var jayson=require(_0x70fb('0xa'));const {validateExpressRequest}=require(_0x70fb('0xb'));var client=jayson[_0x70fb('0xc')][_0x70fb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x70a165,_0x33cc3e,_0x30c9d3){return new BPromise(function(_0x5ab7ba,_0x3e09a5){return client['request'](_0x70a165,_0x30c9d3)[_0x70fb('0xe')](function(_0x87b622){logger[_0x70fb('0xf')]('CmHopper,\x20%s,\x20%s',_0x33cc3e,_0x70fb('0x10'));logger[_0x70fb('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x33cc3e,_0x70fb('0x10'),JSON[_0x70fb('0x12')](_0x87b622));if(_0x87b622[_0x70fb('0x13')]){if(_0x87b622[_0x70fb('0x13')]['code']===0x1f4){logger[_0x70fb('0x13')]('CmHopper,\x20%s,\x20%s',_0x33cc3e,_0x87b622[_0x70fb('0x13')][_0x70fb('0x14')]);return _0x3e09a5(_0x87b622[_0x70fb('0x13')][_0x70fb('0x14')]);}logger[_0x70fb('0x13')](_0x70fb('0x15'),_0x33cc3e,_0x87b622['error'][_0x70fb('0x14')]);return _0x5ab7ba(_0x87b622['error']['message']);}else{logger['info'](_0x70fb('0x15'),_0x33cc3e,_0x70fb('0x10'));_0x5ab7ba(_0x87b622[_0x70fb('0x16')][_0x70fb('0x14')]);}})[_0x70fb('0x17')](function(_0x535800){logger[_0x70fb('0x13')](_0x70fb('0x15'),_0x33cc3e,_0x535800);_0x3e09a5(_0x535800);});});}exports[_0x70fb('0x18')]=function(_0x5b8ed9){var _0x27c60e=this;return new Promise(function(_0x2fd49e,_0x35c88a){return db[_0x70fb('0x19')][_0x70fb('0x1a')]({'raw':_0x5b8ed9[_0x70fb('0x1b')]?_0x5b8ed9[_0x70fb('0x1b')][_0x70fb('0x1c')]===undefined?!![]:![]:!![],'where':_0x5b8ed9[_0x70fb('0x1b')]?_0x5b8ed9[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':_0x5b8ed9[_0x70fb('0x1b')]?_0x5b8ed9['options'][_0x70fb('0x1e')]||null:null,'limit':_0x5b8ed9[_0x70fb('0x1b')]?_0x5b8ed9[_0x70fb('0x1b')][_0x70fb('0x1f')]||null:null,'include':_0x5b8ed9[_0x70fb('0x1b')]?_0x5b8ed9[_0x70fb('0x1b')][_0x70fb('0x20')]?_['map'](_0x5b8ed9[_0x70fb('0x1b')][_0x70fb('0x20')],function(_0x5aafb1){return{'model':db[_0x5aafb1[_0x70fb('0x21')]],'as':_0x5aafb1['as'],'attributes':_0x5aafb1[_0x70fb('0x1e')],'include':_0x5aafb1[_0x70fb('0x20')]?_['map'](_0x5aafb1[_0x70fb('0x20')],function(_0x9af353){return{'model':db[_0x9af353[_0x70fb('0x21')]],'as':_0x9af353['as'],'attributes':_0x9af353[_0x70fb('0x1e')],'include':_0x9af353[_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x9af353[_0x70fb('0x20')],function(_0x170834){return{'model':db[_0x170834[_0x70fb('0x21')]],'as':_0x170834['as'],'attributes':_0x170834[_0x70fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x70fb('0xe')](function(_0x47d059){logger[_0x70fb('0xf')](_0x70fb('0x18'),_0x5b8ed9);logger[_0x70fb('0x11')](_0x70fb('0x18'),_0x5b8ed9,JSON[_0x70fb('0x12')](_0x47d059));_0x2fd49e(_0x47d059);})[_0x70fb('0x17')](function(_0x32920f){logger[_0x70fb('0x13')](_0x70fb('0x18'),_0x32920f[_0x70fb('0x14')],_0x5b8ed9);_0x35c88a(_0x27c60e['error'](0x1f4,_0x32920f[_0x70fb('0x14')]));});});};exports[_0x70fb('0x23')]=function(_0x136ba3){var _0x3b081b=this;return new Promise(function(_0x58108f,_0x2d7cf0){return db[_0x70fb('0x19')]['find']({'raw':_0x136ba3['options']?_0x136ba3['options']['raw']===undefined?!![]:![]:!![],'where':_0x136ba3['options']?_0x136ba3[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':_0x136ba3[_0x70fb('0x1b')]?_0x136ba3[_0x70fb('0x1b')][_0x70fb('0x1e')]||null:null,'include':_0x136ba3[_0x70fb('0x1b')]?_0x136ba3[_0x70fb('0x1b')][_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x136ba3[_0x70fb('0x1b')][_0x70fb('0x20')],function(_0x18c1e0){return{'model':db[_0x18c1e0[_0x70fb('0x21')]],'as':_0x18c1e0['as'],'attributes':_0x18c1e0[_0x70fb('0x1e')],'include':_0x18c1e0['include']?_[_0x70fb('0x22')](_0x18c1e0[_0x70fb('0x20')],function(_0x62c2cb){return{'model':db[_0x62c2cb[_0x70fb('0x21')]],'as':_0x62c2cb['as'],'attributes':_0x62c2cb[_0x70fb('0x1e')],'include':_0x62c2cb['include']?_[_0x70fb('0x22')](_0x62c2cb[_0x70fb('0x20')],function(_0x222699){return{'model':db[_0x222699['model']],'as':_0x222699['as'],'attributes':_0x222699['attributes']};}):[]};}):[]};}):[]:[]})[_0x70fb('0xe')](function(_0x72a09c){logger['info'](_0x70fb('0x23'),_0x136ba3);logger[_0x70fb('0x11')](_0x70fb('0x23'),_0x136ba3,JSON['stringify'](_0x72a09c));_0x58108f(_0x72a09c);})[_0x70fb('0x17')](function(_0x4aaab6){logger[_0x70fb('0x13')](_0x70fb('0x23'),_0x4aaab6[_0x70fb('0x14')],_0x136ba3);_0x2d7cf0(_0x3b081b['error'](0x1f4,_0x4aaab6[_0x70fb('0x14')]));});});};exports[_0x70fb('0x24')]=function(_0x38714d){var _0x5da64c=this;return new Promise(function(_0x56894b,_0x4dc908){return db[_0x70fb('0x19')]['create'](_0x38714d[_0x70fb('0x25')],{'raw':_0x38714d['options']?_0x38714d[_0x70fb('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x70fb('0xe')](function(_0x2dd401){logger[_0x70fb('0xf')](_0x70fb('0x24'),_0x38714d);logger[_0x70fb('0x11')]('CreateCmHopper',_0x38714d,JSON[_0x70fb('0x12')](_0x2dd401));_0x56894b(_0x2dd401);})['catch'](function(_0x4bc889){logger[_0x70fb('0x13')](_0x70fb('0x24'),_0x4bc889[_0x70fb('0x14')],_0x38714d);_0x4dc908(_0x5da64c[_0x70fb('0x13')](0x1f4,_0x4bc889[_0x70fb('0x14')]));});});};exports['UpdateCmHopper']=function(_0x595116){var _0x2cc3f0=this;return new Promise(function(_0x4a346c,_0x1771eb){return db[_0x70fb('0x19')][_0x70fb('0x26')](_0x595116[_0x70fb('0x25')],{'raw':_0x595116[_0x70fb('0x1b')]?_0x595116[_0x70fb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x595116['options']?_0x595116[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':_0x595116[_0x70fb('0x1b')]?_0x595116['options'][_0x70fb('0x1e')]||null:null,'limit':_0x595116[_0x70fb('0x1b')]?_0x595116[_0x70fb('0x1b')][_0x70fb('0x1f')]||null:null})['then'](function(_0x283f86){logger[_0x70fb('0xf')](_0x70fb('0x27'),_0x595116);logger[_0x70fb('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x595116[_0x70fb('0x1b')][_0x70fb('0x1d')]),_0x595116[_0x70fb('0x25')][_0x70fb('0x28')]);logger[_0x70fb('0x11')]('UpdateCmHopper',_0x595116,JSON[_0x70fb('0x12')](_0x283f86));_0x4a346c(_0x283f86);})['catch'](function(_0x29afee){logger[_0x70fb('0x13')](_0x70fb('0x27'),_0x29afee[_0x70fb('0x14')],_0x595116);_0x1771eb(_0x2cc3f0[_0x70fb('0x13')](0x1f4,_0x29afee[_0x70fb('0x14')]));});});};exports[_0x70fb('0x29')]=function(_0x4c7cf4){var _0x10b5dc=this;return new Promise(function(_0x5ca415,_0xfbde24){return db['CmHopper'][_0x70fb('0x2a')]({'where':_0x4c7cf4[_0x70fb('0x1b')]?_0x4c7cf4[_0x70fb('0x1b')]['where']||null:null})['then'](function(_0x4179cd){logger[_0x70fb('0xf')](_0x70fb('0x29'),_0x4c7cf4);logger[_0x70fb('0x11')](_0x70fb('0x29'),_0x4c7cf4,JSON[_0x70fb('0x12')](_0x4179cd));_0x5ca415(_0x4179cd);})[_0x70fb('0x17')](function(_0x223f34){logger['error'](_0x70fb('0x29'),_0x223f34['message'],_0x4c7cf4);_0xfbde24(_0x10b5dc['error'](0x1f4,_0x223f34[_0x70fb('0x14')]));});});};exports[_0x70fb('0x2b')]=function(_0x12d4d3){var _0x6e1601=this;return new Promise(function(_0xdb8559,_0x3bfe23){return db[_0x70fb('0x2c')][_0x70fb('0x2d')]()[_0x70fb('0xe')](function(_0x3d7f6b){return db['sequelize'][_0x70fb('0x2e')](function(_0x1e4aad){return db['CmHopper'][_0x70fb('0x1a')]({'where':_0x12d4d3[_0x70fb('0x1b')]?_0x12d4d3[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':_0x12d4d3['options']?_0x12d4d3['options']['attributes']||null:null,'limit':_0x12d4d3[_0x70fb('0x1b')]?_0x12d4d3[_0x70fb('0x1b')][_0x70fb('0x1f')]||null:null,'order':_0x12d4d3[_0x70fb('0x1b')]?_0x12d4d3['options'][_0x70fb('0x2f')]||null:null,'transaction':_0x1e4aad,'lock':_0x1e4aad[_0x70fb('0x30')][_0x70fb('0x31')],'include':[{'model':db[_0x70fb('0x2c')],'as':_0x70fb('0x32'),'attributes':_[_0x70fb('0x33')](_0x3d7f6b)},{'model':db['User'],'as':_0x70fb('0x34'),'attributes':['id','name',_0x70fb('0x35')]}]})[_0x70fb('0xe')](function(_0x3267de){var _0x221850=[];var _0xd788f9=[];for(var _0x2093e6=0x0;_0x2093e6<_0x3267de[_0x70fb('0x36')];_0x2093e6+=0x1){var _0x50e9f9=_0x3267de[_0x2093e6][_0x70fb('0x37')];if(_0x50e9f9===null){_0x221850[_0x70fb('0x38')](_0x3267de[_0x2093e6][_0x70fb('0x26')](_0x12d4d3[_0x70fb('0x25')],{'transaction':_0x1e4aad}));}else if(!_0xd788f9[_0x70fb('0x39')](_0x50e9f9)){_0xd788f9[_0x70fb('0x38')](_0x50e9f9);_0x221850[_0x70fb('0x38')](_0x3267de[_0x2093e6][_0x70fb('0x26')](_0x12d4d3[_0x70fb('0x25')],{'transaction':_0x1e4aad}));}}return BPromise[_0x70fb('0x3a')](_0x221850);});})['then'](function(_0x52a96b){logger[_0x70fb('0xf')](_0x70fb('0x2b'),_0x12d4d3);if(_0x52a96b[_0x70fb('0x36')]>0x0){logger[_0x70fb('0xf')](_0x70fb('0x3b'),_0x52a96b[0x0][_0x70fb('0x3c')]['id'],_0x52a96b[0x0][_0x70fb('0x3c')][_0x70fb('0x3d')],_0x52a96b[0x0][_0x70fb('0x3c')][_0x70fb('0x28')]);}logger[_0x70fb('0x11')](_0x70fb('0x2b'),_0x12d4d3,JSON[_0x70fb('0x12')](_0x52a96b));_0xdb8559(_0x52a96b);})[_0x70fb('0x17')](function(_0x3a26f5){logger[_0x70fb('0x13')](_0x70fb('0x2b'),_0x3a26f5['message'],_0x12d4d3);_0x3bfe23(_0x6e1601['error'](0x1f4,_0x3a26f5[_0x70fb('0x14')]));});});});};exports['MoveContactManagedDialer']=function(_0x5d0499){var _0x19689d=this;return new Promise(function(_0x308758,_0x27507d){return db[_0x70fb('0x3e')][_0x70fb('0x2e')](function(_0x2e2d93){return db['CmHopperFinal']['create'](_0x5d0499[_0x70fb('0x25')],{'raw':_0x5d0499[_0x70fb('0x1b')]?_0x5d0499[_0x70fb('0x1b')][_0x70fb('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x2e2d93})[_0x70fb('0xe')](function(){logger[_0x70fb('0xf')](_0x70fb('0x3f'),JSON['stringify'](_0x5d0499[_0x70fb('0x1b')]['where']),_0x5d0499['options'][_0x70fb('0x1d')][_0x70fb('0x28')]);return db[_0x70fb('0x19')][_0x70fb('0x2a')]({'where':_0x5d0499[_0x70fb('0x1b')]?_0x5d0499[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'transaction':_0x2e2d93});});})[_0x70fb('0xe')](function(_0x2b947c){logger[_0x70fb('0xf')]('MoveContactManagedDialer',_0x5d0499);logger[_0x70fb('0x11')](_0x70fb('0x40'),_0x5d0499,JSON[_0x70fb('0x12')](_0x2b947c));_0x308758(_0x2b947c);})[_0x70fb('0x17')](function(_0x4a740d){logger['error'](_0x70fb('0x40'),_0x4a740d[_0x70fb('0x14')],_0x5d0499);_0x27507d(_0x19689d[_0x70fb('0x13')](0x1f4,_0x4a740d[_0x70fb('0x14')]));});});};exports['CountReScheduled']=function(_0x3a7c53){var _0x6d9a9=this;return new Promise(function(_0x411df9,_0x458783){return db[_0x70fb('0x19')][_0x70fb('0x1a')]({'raw':_0x3a7c53[_0x70fb('0x1b')]?_0x3a7c53[_0x70fb('0x1b')][_0x70fb('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a7c53[_0x70fb('0x1b')]?_0x3a7c53[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':[[db[_0x70fb('0x3e')]['fn'](_0x70fb('0x41'),db['sequelize']['fn']('IF',db[_0x70fb('0x3e')]['literal'](_0x70fb('0x42')+util[_0x70fb('0x43')](_0x70fb('0x44'),moment()[_0x70fb('0x43')](_0x70fb('0x45')))+_0x70fb('0x46')))),_0x70fb('0x47')]]})[_0x70fb('0xe')](function(_0x1317d8){logger[_0x70fb('0xf')](_0x70fb('0x48'),_0x3a7c53);logger[_0x70fb('0x11')](_0x70fb('0x48'),_0x3a7c53,JSON[_0x70fb('0x12')](_0x1317d8));_0x411df9(_0x1317d8);})[_0x70fb('0x17')](function(_0x4ec09c){logger['error'](_0x70fb('0x48'),_0x4ec09c[_0x70fb('0x14')],_0x3a7c53);_0x458783(_0x6d9a9['error'](0x1f4,_0x4ec09c[_0x70fb('0x14')]));});});};exports['GetContactRecallMe']=function(_0x47d7c8){var _0x198cc8=this;return new Promise(function(_0x16909c,_0x6146d1){return db['CmContact'][_0x70fb('0x2d')]()[_0x70fb('0xe')](function(_0x3fd121){return db[_0x70fb('0x3e')][_0x70fb('0x2e')](function(_0x414343){return db[_0x70fb('0x19')]['findAll']({'where':_0x47d7c8[_0x70fb('0x1b')]?_0x47d7c8[_0x70fb('0x1b')][_0x70fb('0x1d')]||null:null,'attributes':_0x47d7c8['options']?_0x47d7c8['options'][_0x70fb('0x1e')]||null:null,'limit':0x1,'order':_0x47d7c8[_0x70fb('0x1b')]?_0x47d7c8[_0x70fb('0x1b')][_0x70fb('0x2f')]||null:null,'group':db[_0x70fb('0x19')][_0x70fb('0x37')],'transaction':_0x414343,'lock':_0x414343[_0x70fb('0x30')][_0x70fb('0x31')],'include':_0x47d7c8[_0x70fb('0x1b')]?_0x47d7c8[_0x70fb('0x1b')][_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x47d7c8[_0x70fb('0x1b')][_0x70fb('0x20')],function(_0x36d23b){return{'model':db[_0x36d23b[_0x70fb('0x21')]],'as':_0x36d23b['as'],'attributes':_0x36d23b['attributes'],'include':_0x36d23b[_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x36d23b[_0x70fb('0x20')],function(_0x16edc9){return{'model':db[_0x16edc9[_0x70fb('0x21')]],'as':_0x16edc9['as'],'attributes':_0x16edc9[_0x70fb('0x1e')],'include':_0x16edc9[_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x16edc9[_0x70fb('0x20')],function(_0x5ce740){return{'model':db[_0x5ce740['model']],'as':_0x5ce740['as'],'attributes':_0x5ce740[_0x70fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x70fb('0xe')](function(_0x41da3b){var _0x18e0e3=[];for(var _0xcbc1a7=0x0;_0xcbc1a7<_0x41da3b[_0x70fb('0x36')];_0xcbc1a7+=0x1){_0x18e0e3[_0x70fb('0x38')](_0x41da3b[_0xcbc1a7][_0x70fb('0x26')](_0x47d7c8[_0x70fb('0x25')],{'transaction':_0x414343}));}return BPromise[_0x70fb('0x3a')](_0x18e0e3);});})[_0x70fb('0xe')](function(_0xcc40f5){logger['info'](_0x70fb('0x49'),_0x47d7c8);logger['debug']('GetContactRecallMe',_0x47d7c8,JSON['stringify'](_0xcc40f5));_0x16909c(_0xcc40f5);})[_0x70fb('0x17')](function(_0x2e9978){logger['error'](_0x70fb('0x49'),_0x2e9978['message'],_0x47d7c8);_0x6146d1(_0x198cc8[_0x70fb('0x13')](0x1f4,_0x2e9978[_0x70fb('0x14')]));});});});};exports[_0x70fb('0x4a')]=function(_0x51c065){var _0x5bf9f0=this;return new Promise(function(_0x1472bd,_0xba2491){db[_0x70fb('0x2c')][_0x70fb('0x2d')]()['then'](function(_0x359412){return db[_0x70fb('0x19')]['findAll']({'raw':_0x51c065['options']?_0x51c065[_0x70fb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x51c065[_0x70fb('0x1b')]?_0x51c065['options'][_0x70fb('0x1d')]||null:null,'attributes':_0x51c065[_0x70fb('0x1b')]?_0x51c065[_0x70fb('0x1b')]['attributes']||null:null,'limit':_0x51c065[_0x70fb('0x1b')]?_0x51c065[_0x70fb('0x1b')]['limit']||null:null,'include':_0x51c065[_0x70fb('0x1b')]?_0x51c065[_0x70fb('0x1b')]['include']?_[_0x70fb('0x22')](_0x51c065[_0x70fb('0x1b')][_0x70fb('0x20')],function(_0x304de2){return{'model':db[_0x304de2[_0x70fb('0x21')]],'as':_0x304de2['as'],'attributes':_0x304de2['as']==='Contact'?_[_0x70fb('0x33')](_0x359412):_0x304de2[_0x70fb('0x1e')],'include':_0x304de2[_0x70fb('0x20')]?_[_0x70fb('0x22')](_0x304de2[_0x70fb('0x20')],function(_0xb28d01){return{'model':db[_0xb28d01[_0x70fb('0x21')]],'as':_0xb28d01['as'],'attributes':_0xb28d01['attributes'],'include':_0xb28d01['include']?_[_0x70fb('0x22')](_0xb28d01[_0x70fb('0x20')],function(_0x1650e5){return{'model':db[_0x1650e5[_0x70fb('0x21')]],'as':_0x1650e5['as'],'attributes':_0x1650e5[_0x70fb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x70fb('0xe')](function(_0x15e9a3){logger[_0x70fb('0xf')](_0x70fb('0x18'),_0x51c065);logger[_0x70fb('0x11')](_0x70fb('0x18'),_0x51c065,JSON[_0x70fb('0x12')](_0x15e9a3));_0x1472bd(_0x15e9a3);})[_0x70fb('0x17')](function(_0x1b897f){logger[_0x70fb('0x13')](_0x70fb('0x18'),_0x1b897f[_0x70fb('0x14')],_0x51c065);_0xba2491(_0x5bf9f0[_0x70fb('0x13')](0x1f4,_0x1b897f[_0x70fb('0x14')]));});});});};exports[_0x70fb('0x4b')]=function(_0x3006e0){var _0x3b2b00=this;return new Promise(function(_0x2daef9,_0x492e42){return db['sequelize'][_0x70fb('0x2e')](function(_0x53a955){return db[_0x70fb('0x19')][_0x70fb('0x26')]({'active':![]},{'where':{},'transaction':_0x53a955})[_0x70fb('0xe')](function(_0x5310cc){logger[_0x70fb('0xf')](_0x70fb('0x4b'),_0x3006e0);logger[_0x70fb('0x11')](_0x70fb('0x4b'),_0x3006e0,JSON[_0x70fb('0x12')](_0x5310cc));_0x2daef9(_0x5310cc);})[_0x70fb('0x17')](function(_0x4c993e){logger[_0x70fb('0x13')](_0x70fb('0x4b'),_0x4c993e[_0x70fb('0x14')],_0x3006e0);_0x492e42(_0x3b2b00[_0x70fb('0x13')](0x1f4,_0x4c993e[_0x70fb('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x53c187){var _0x2b6bb0=this;var _0xc8485f=_0x53c187[_0x70fb('0x25')]['where'][_0x70fb('0x4c')];var _0x1b7d14=_0x53c187[_0x70fb('0x25')][_0x70fb('0x1d')][_0x70fb('0x4d')];return new Promise(function(_0x5c9734,_0xdc2e5e){return db['CmHopper']['findAll']({'where':{'voiceQueueId':_0xc8485f,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x70fb('0x3e')]['literal'](_0x70fb('0x4e')+_0x1b7d14+_0x70fb('0x4f'))}},'include':[{'model':db[_0x70fb('0x2c')],'as':'Contact'},{'model':db[_0x70fb('0x50')],'as':'Agent','attributes':['id','name',_0x70fb('0x35')]},{'model':db[_0x70fb('0x51')],'as':_0x70fb('0x52')}]})[_0x70fb('0xe')](function(_0x5453cc){return db['sequelize'][_0x70fb('0x2e')](function(_0x241278){return db[_0x70fb('0x19')]['update']({'recallmeNotifiedDate':new Date()},{'where':{'voiceQueueId':_0xc8485f,'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$lte':db[_0x70fb('0x3e')][_0x70fb('0x53')](_0x70fb('0x4e')+_0x1b7d14+_0x70fb('0x4f'))}},'transaction':_0x241278})[_0x70fb('0xe')](function(_0x275df4){_0x5c9734(_0x5453cc);})[_0x70fb('0x17')](function(_0x29fded){logger[_0x70fb('0x13')]('CmHopperHandlePreviewRecallNotifications',_0x29fded[_0x70fb('0x14')],_0x53c187);_0xdc2e5e(validateExpressRequest);});});})[_0x70fb('0x17')](function(_0x4d4ea1){logger[_0x70fb('0x13')](_0x70fb('0x54'),_0x4d4ea1[_0x70fb('0x14')],_0x53c187);_0xdc2e5e(_0x2b6bb0['error'](0x1f4,_0x4d4ea1[_0x70fb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 2030090..019d26f 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 _0xf3cf=['update','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','/preview','getPreview','/previewrecall','getPreviewRecall','put'];(function(_0x477cb9,_0x1f151b){var _0x59f8ec=function(_0x231c54){while(--_0x231c54){_0x477cb9['push'](_0x477cb9['shift']());}};_0x59f8ec(++_0x1f151b);}(_0xf3cf,0x1a5));var _0xff3c=function(_0x586fa2,_0x1a45bc){_0x586fa2=_0x586fa2-0x0;var _0x515be9=_0xf3cf[_0x586fa2];return _0x515be9;};'use strict';var multer=require(_0xff3c('0x0'));var util=require(_0xff3c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xff3c('0x2'));var router=express['Router']();var fs_extra=require(_0xff3c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xff3c('0x4'));var config=require(_0xff3c('0x5'));var controller=require('./cmHopper.controller');router[_0xff3c('0x6')]('/',auth[_0xff3c('0x7')](),controller[_0xff3c('0x8')]);router['get'](_0xff3c('0x9'),auth[_0xff3c('0x7')](),controller[_0xff3c('0xa')]);router['get']('/opencontacts',auth[_0xff3c('0x7')](),controller['getOpenContacts']);router['get'](_0xff3c('0xb'),auth[_0xff3c('0x7')](),controller['show']);router[_0xff3c('0xc')]('/',auth[_0xff3c('0x7')](),controller[_0xff3c('0xd')]);router[_0xff3c('0xc')](_0xff3c('0xe'),auth[_0xff3c('0x7')](),controller[_0xff3c('0xf')]);router[_0xff3c('0xc')](_0xff3c('0x10'),auth['isAuthenticated'](),controller[_0xff3c('0x11')]);router[_0xff3c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xff3c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xff3c('0x14')]);module[_0xff3c('0x15')]=router; \ No newline at end of file +var _0xe621=['/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','/preview','getPreview','getPreviewRecall','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x26eb19,_0x4d88f8){var _0x11a1a4=function(_0x5a3b4f){while(--_0x5a3b4f){_0x26eb19['push'](_0x26eb19['shift']());}};_0x11a1a4(++_0x4d88f8);}(_0xe621,0x1f1));var _0x1e62=function(_0x38f5c6,_0x57cf85){_0x38f5c6=_0x38f5c6-0x0;var _0xa54f1d=_0xe621[_0x38f5c6];return _0xa54f1d;};'use strict';var multer=require(_0x1e62('0x0'));var util=require(_0x1e62('0x1'));var path=require(_0x1e62('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1e62('0x3')]();var fs_extra=require(_0x1e62('0x4'));var auth=require(_0x1e62('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1e62('0x6'));var controller=require('./cmHopper.controller');router[_0x1e62('0x7')]('/',auth[_0x1e62('0x8')](),controller['index']);router[_0x1e62('0x7')](_0x1e62('0x9'),auth[_0x1e62('0x8')](),controller[_0x1e62('0xa')]);router[_0x1e62('0x7')](_0x1e62('0xb'),auth[_0x1e62('0x8')](),controller[_0x1e62('0xc')]);router[_0x1e62('0x7')](_0x1e62('0xd'),auth['isAuthenticated'](),controller[_0x1e62('0xe')]);router[_0x1e62('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e62('0xf')](_0x1e62('0x10'),auth[_0x1e62('0x8')](),controller[_0x1e62('0x11')]);router['post']('/previewrecall',auth['isAuthenticated'](),controller[_0x1e62('0x12')]);router[_0x1e62('0x13')]('/:id',auth[_0x1e62('0x8')](),controller['update']);router[_0x1e62('0x14')](_0x1e62('0xd'),auth['isAuthenticated'](),controller[_0x1e62('0x15')]);module[_0x1e62('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4e9006f..eef5b45 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 _0x15cb=['STRING','contactListQueue','INTEGER','sequelize'];(function(_0x1e8e72,_0x22a359){var _0x59323c=function(_0x1cfa0b){while(--_0x1cfa0b){_0x1e8e72['push'](_0x1e8e72['shift']());}};_0x59323c(++_0x22a359);}(_0x15cb,0x16f));var _0xb15c=function(_0x58bf05,_0xb4671d){_0x58bf05=_0x58bf05-0x0;var _0x192802=_0x15cb[_0x58bf05];return _0x192802;};'use strict';var moment=require('moment');var Sequelize=require(_0xb15c('0x0'));module['exports']={'phone':{'type':Sequelize[_0xb15c('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xb15c('0x2')},'ListId':{'type':Sequelize[_0xb15c('0x3')],'unique':_0xb15c('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb15c('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x4e83=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x3f2034,_0x459ac8){var _0x575542=function(_0x41c250){while(--_0x41c250){_0x3f2034['push'](_0x3f2034['shift']());}};_0x575542(++_0x459ac8);}(_0x4e83,0x1ae));var _0x34e8=function(_0x1d656c,_0x14fba4){_0x1d656c=_0x1d656c-0x0;var _0x4eeb25=_0x4e83[_0x1d656c];return _0x4eeb25;};'use strict';var moment=require(_0x34e8('0x0'));var Sequelize=require('sequelize');module[_0x34e8('0x1')]={'phone':{'type':Sequelize[_0x34e8('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x34e8('0x3')],'unique':_0x34e8('0x4')},'ListId':{'type':Sequelize[_0x34e8('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 96aad3a..54c6713 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 _0xccef=['merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','CmHopperBlack','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xccef,0x1d4));var _0xfcce=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xccef[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcce('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcce('0x1'));var rp=require(_0xfcce('0x2'));var moment=require(_0xfcce('0x3'));var BPromise=require(_0xfcce('0x4'));var Mustache=require(_0xfcce('0x5'));var util=require(_0xfcce('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xfcce('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcce('0x8'));var _=require(_0xfcce('0x9'));var squel=require(_0xfcce('0xa'));var crypto=require(_0xfcce('0xb'));var jsforce=require(_0xfcce('0xc'));var deskjs=require(_0xfcce('0xd'));var toCsv=require(_0xfcce('0x7'));var querystring=require('querystring');var Papa=require(_0xfcce('0xe'));var Redis=require(_0xfcce('0xf'));var authService=require(_0xfcce('0x10'));var qs=require(_0xfcce('0x11'));var as=require(_0xfcce('0x12'));var hardwareService=require(_0xfcce('0x13'));var logger=require(_0xfcce('0x14'))(_0xfcce('0x15'));var utils=require(_0xfcce('0x16'));var config=require(_0xfcce('0x17'));var licenseUtil=require(_0xfcce('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7658,_0x42646f){_0x42646f=_0x42646f||0xcc;return function(_0xc85858){if(_0xc85858){return _0x2f7658[_0xfcce('0x19')](_0x42646f);}return _0x2f7658['status'](_0x42646f)[_0xfcce('0x1a')]();};}function respondWithResult(_0x2d45ba,_0x5702d0){_0x5702d0=_0x5702d0||0xc8;return function(_0x540714){if(_0x540714){return _0x2d45ba[_0xfcce('0x1b')](_0x5702d0)[_0xfcce('0x1c')](_0x540714);}};}function respondWithFilteredResult(_0x2d8244,_0x20edec){return function(_0x10a161){if(_0x10a161){var _0x1caeb4=typeof _0x20edec[_0xfcce('0x1d')]===_0xfcce('0x1e')&&typeof _0x20edec[_0xfcce('0x1f')]===_0xfcce('0x1e');var _0x2c4123=_0x10a161[_0xfcce('0x20')];var _0x40f6e4=_0x1caeb4?0x0:_0x20edec[_0xfcce('0x1d')];var _0x3a8854=_0x1caeb4?_0x10a161[_0xfcce('0x20')]:_0x20edec[_0xfcce('0x1d')]+_0x20edec[_0xfcce('0x1f')];var _0x2728b4;if(_0x3a8854>=_0x2c4123){_0x3a8854=_0x2c4123;_0x2728b4=0xc8;}else{_0x2728b4=0xce;}_0x2d8244[_0xfcce('0x1b')](_0x2728b4);return _0x2d8244[_0xfcce('0x21')](_0xfcce('0x22'),_0x40f6e4+'-'+_0x3a8854+'/'+_0x2c4123)[_0xfcce('0x1c')](_0x10a161);}return null;};}function patchUpdates(_0x5126d2){return function(_0x562243){try{jsonpatch[_0xfcce('0x23')](_0x562243,_0x5126d2,!![]);}catch(_0x5d5827){return BPromise[_0xfcce('0x24')](_0x5d5827);}return _0x562243[_0xfcce('0x25')]();};}function saveUpdates(_0x5cfd72,_0x3d8563){return function(_0x2dea99){if(_0x2dea99){return _0x2dea99[_0xfcce('0x26')](_0x5cfd72)[_0xfcce('0x27')](function(_0x9e6e32){return _0x9e6e32;});}return null;};}function removeEntity(_0x6c2e9a,_0x52f3c8){return function(_0xfa12cd){if(_0xfa12cd){return _0xfa12cd[_0xfcce('0x28')]()[_0xfcce('0x27')](function(){_0x6c2e9a[_0xfcce('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ca849,_0x3ca458){return function(_0x2fa852){if(!_0x2fa852){_0x4ca849[_0xfcce('0x19')](0x194);}return _0x2fa852;};}function handleError(_0x2872b0,_0x47b1dc){_0x47b1dc=_0x47b1dc||0x1f4;return function(_0x428a4e){logger[_0xfcce('0x29')](_0x428a4e['stack']);if(_0x428a4e['name']){delete _0x428a4e[_0xfcce('0x2a')];}_0x2872b0[_0xfcce('0x1b')](_0x47b1dc)[_0xfcce('0x2b')](_0x428a4e);};}exports[_0xfcce('0x2c')]=function(_0xb5cdc0,_0x5abfa7){var _0x1accb6={},_0x3b7592={},_0x436915={'count':0x0,'rows':[]};var _0x2b0954=_['map'](db[_0xfcce('0x2d')]['rawAttributes'],function(_0x5ae7bb){return{'name':_0x5ae7bb[_0xfcce('0x2e')],'type':_0x5ae7bb[_0xfcce('0x2f')][_0xfcce('0x30')]};});_0x3b7592[_0xfcce('0x31')]=_[_0xfcce('0x32')](_0x2b0954,_0xfcce('0x2a'));_0x3b7592[_0xfcce('0x33')]=_[_0xfcce('0x34')](_0xb5cdc0['query']);_0x3b7592[_0xfcce('0x35')]=_[_0xfcce('0x36')](_0x3b7592[_0xfcce('0x31')],_0x3b7592[_0xfcce('0x33')]);_0x1accb6[_0xfcce('0x37')]=_[_0xfcce('0x36')](_0x3b7592[_0xfcce('0x31')],qs[_0xfcce('0x38')](_0xb5cdc0[_0xfcce('0x33')][_0xfcce('0x38')]));_0x1accb6[_0xfcce('0x37')]=_0x1accb6[_0xfcce('0x37')][_0xfcce('0x39')]?_0x1accb6[_0xfcce('0x37')]:_0x3b7592['model'];if(!_0xb5cdc0[_0xfcce('0x33')]['hasOwnProperty'](_0xfcce('0x3a'))){_0x1accb6[_0xfcce('0x1f')]=qs[_0xfcce('0x1f')](_0xb5cdc0[_0xfcce('0x33')][_0xfcce('0x1f')]);_0x1accb6[_0xfcce('0x1d')]=qs[_0xfcce('0x1d')](_0xb5cdc0[_0xfcce('0x33')][_0xfcce('0x1d')]);}_0x1accb6[_0xfcce('0x3b')]=qs[_0xfcce('0x3c')](_0xb5cdc0[_0xfcce('0x33')][_0xfcce('0x3c')]);_0x1accb6[_0xfcce('0x3d')]=qs[_0xfcce('0x35')](_[_0xfcce('0x3e')](_0xb5cdc0['query'],_0x3b7592[_0xfcce('0x35')]),_0x2b0954);if(_0xb5cdc0[_0xfcce('0x33')]['filter']){_0x1accb6[_0xfcce('0x3d')]=_['merge'](_0x1accb6[_0xfcce('0x3d')],{'$or':_[_0xfcce('0x32')](_0x2b0954,function(_0x2379d4){if(_0x2379d4[_0xfcce('0x2f')]!=='VIRTUAL'){var _0x420250={};_0x420250[_0x2379d4[_0xfcce('0x2a')]]={'$like':'%'+_0xb5cdc0[_0xfcce('0x33')][_0xfcce('0x3f')]+'%'};return _0x420250;}})});}_0x1accb6=_[_0xfcce('0x40')]({},_0x1accb6,_0xb5cdc0[_0xfcce('0x41')]);var _0x49898e={'where':_0x1accb6[_0xfcce('0x3d')]};return db[_0xfcce('0x2d')][_0xfcce('0x20')](_0x49898e)[_0xfcce('0x27')](function(_0x44b227){_0x436915[_0xfcce('0x20')]=_0x44b227;if(_0xb5cdc0['query'][_0xfcce('0x42')]){_0x1accb6[_0xfcce('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xfcce('0x44')](_0x1accb6);})[_0xfcce('0x27')](function(_0x10668e){_0x436915['rows']=_0x10668e;return _0x436915;})[_0xfcce('0x27')](respondWithFilteredResult(_0x5abfa7,_0x1accb6))[_0xfcce('0x45')](handleError(_0x5abfa7,null));};exports[_0xfcce('0x46')]=function(_0x19a16d,_0x168920){var _0x2bb95c={'raw':!![],'where':{'id':_0x19a16d[_0xfcce('0x47')]['id']}},_0x8a50d={};_0x8a50d['model']=_[_0xfcce('0x34')](db[_0xfcce('0x2d')][_0xfcce('0x48')]);_0x8a50d['query']=_[_0xfcce('0x34')](_0x19a16d['query']);_0x8a50d['filters']=_[_0xfcce('0x36')](_0x8a50d[_0xfcce('0x31')],_0x8a50d[_0xfcce('0x33')]);_0x2bb95c['attributes']=_[_0xfcce('0x36')](_0x8a50d[_0xfcce('0x31')],qs[_0xfcce('0x38')](_0x19a16d[_0xfcce('0x33')][_0xfcce('0x38')]));_0x2bb95c['attributes']=_0x2bb95c['attributes'][_0xfcce('0x39')]?_0x2bb95c[_0xfcce('0x37')]:_0x8a50d[_0xfcce('0x31')];if(_0x19a16d[_0xfcce('0x33')][_0xfcce('0x42')]){_0x2bb95c[_0xfcce('0x43')]=[{'all':!![]}];}_0x2bb95c=_['merge']({},_0x2bb95c,_0x19a16d[_0xfcce('0x41')]);return db[_0xfcce('0x2d')]['find'](_0x2bb95c)['then'](handleEntityNotFound(_0x168920,null))[_0xfcce('0x27')](respondWithResult(_0x168920,null))['catch'](handleError(_0x168920,null));};exports[_0xfcce('0x26')]=function(_0x4c5f26,_0x3b403c){if(_0x4c5f26[_0xfcce('0x49')]['id']){delete _0x4c5f26[_0xfcce('0x49')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x4c5f26[_0xfcce('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b403c,null))[_0xfcce('0x27')](saveUpdates(_0x4c5f26[_0xfcce('0x49')],null))[_0xfcce('0x27')](respondWithResult(_0x3b403c,null))['catch'](handleError(_0x3b403c,null));};exports[_0xfcce('0x28')]=function(_0xaa736f,_0x3074c8){return db['CmHopperBlack'][_0xfcce('0x4a')]({'where':{'id':_0xaa736f['params']['id']}})[_0xfcce('0x27')](handleEntityNotFound(_0x3074c8,null))[_0xfcce('0x27')](removeEntity(_0x3074c8,null))['catch'](handleError(_0x3074c8,null));};exports[_0xfcce('0x4b')]=function(_0x4bec72,_0x4ceeb6){return db[_0xfcce('0x2d')]['describe']()[_0xfcce('0x27')](respondWithResult(_0x4ceeb6,null))['catch'](handleError(_0x4ceeb6,null));}; \ No newline at end of file +var _0xcbe1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','end','error','stack','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','include','findAll','rows','catch','show','params','keys','includeAll','options','update','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x19fc06,_0x3f69f9){var _0x99e1bd=function(_0x1eb512){while(--_0x1eb512){_0x19fc06['push'](_0x19fc06['shift']());}};_0x99e1bd(++_0x3f69f9);}(_0xcbe1,0xd7));var _0x1cbe=function(_0x428f80,_0x307620){_0x428f80=_0x428f80-0x0;var _0x2f4273=_0xcbe1[_0x428f80];return _0x2f4273;};'use strict';var emlformat=require(_0x1cbe('0x0'));var rimraf=require(_0x1cbe('0x1'));var zipdir=require(_0x1cbe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cbe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cbe('0x4'));var util=require('util');var path=require(_0x1cbe('0x5'));var sox=require(_0x1cbe('0x6'));var csv=require(_0x1cbe('0x7'));var ejs=require(_0x1cbe('0x8'));var fs=require('fs');var fs_extra=require(_0x1cbe('0x9'));var _=require(_0x1cbe('0xa'));var squel=require(_0x1cbe('0xb'));var crypto=require(_0x1cbe('0xc'));var jsforce=require(_0x1cbe('0xd'));var deskjs=require(_0x1cbe('0xe'));var toCsv=require(_0x1cbe('0x7'));var querystring=require(_0x1cbe('0xf'));var Papa=require(_0x1cbe('0x10'));var Redis=require(_0x1cbe('0x11'));var authService=require(_0x1cbe('0x12'));var qs=require(_0x1cbe('0x13'));var as=require(_0x1cbe('0x14'));var hardwareService=require(_0x1cbe('0x15'));var logger=require(_0x1cbe('0x16'))(_0x1cbe('0x17'));var utils=require(_0x1cbe('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1cbe('0x19'));var db=require(_0x1cbe('0x1a'))['db'];function respondWithStatusCode(_0x328d37,_0xe2f5e0){_0xe2f5e0=_0xe2f5e0||0xcc;return function(_0x22d8d6){if(_0x22d8d6){return _0x328d37[_0x1cbe('0x1b')](_0xe2f5e0);}return _0x328d37[_0x1cbe('0x1c')](_0xe2f5e0)['end']();};}function respondWithResult(_0x489366,_0x4736c5){_0x4736c5=_0x4736c5||0xc8;return function(_0x165e34){if(_0x165e34){return _0x489366[_0x1cbe('0x1c')](_0x4736c5)[_0x1cbe('0x1d')](_0x165e34);}};}function respondWithFilteredResult(_0x2b508e,_0x23b3d3){return function(_0x31a64c){if(_0x31a64c){var _0xa85789=typeof _0x23b3d3[_0x1cbe('0x1e')]===_0x1cbe('0x1f')&&typeof _0x23b3d3[_0x1cbe('0x20')]===_0x1cbe('0x1f');var _0x34390f=_0x31a64c[_0x1cbe('0x21')];var _0x5c373e=_0xa85789?0x0:_0x23b3d3[_0x1cbe('0x1e')];var _0x3f38a5=_0xa85789?_0x31a64c[_0x1cbe('0x21')]:_0x23b3d3[_0x1cbe('0x1e')]+_0x23b3d3[_0x1cbe('0x20')];var _0x359995;if(_0x3f38a5>=_0x34390f){_0x3f38a5=_0x34390f;_0x359995=0xc8;}else{_0x359995=0xce;}_0x2b508e[_0x1cbe('0x1c')](_0x359995);return _0x2b508e[_0x1cbe('0x22')](_0x1cbe('0x23'),_0x5c373e+'-'+_0x3f38a5+'/'+_0x34390f)['json'](_0x31a64c);}return null;};}function patchUpdates(_0x766c44){return function(_0x4ffead){try{jsonpatch['apply'](_0x4ffead,_0x766c44,!![]);}catch(_0x118cbf){return BPromise[_0x1cbe('0x24')](_0x118cbf);}return _0x4ffead[_0x1cbe('0x25')]();};}function saveUpdates(_0x248403,_0xf22cc4){return function(_0x34f955){if(_0x34f955){return _0x34f955['update'](_0x248403)[_0x1cbe('0x26')](function(_0x399212){return _0x399212;});}return null;};}function removeEntity(_0x3818ac,_0x188969){return function(_0x59e467){if(_0x59e467){return _0x59e467['destroy']()['then'](function(){_0x3818ac['status'](0xcc)[_0x1cbe('0x27')]();});}};}function handleEntityNotFound(_0x4cc4dd,_0x46c720){return function(_0xeef601){if(!_0xeef601){_0x4cc4dd[_0x1cbe('0x1b')](0x194);}return _0xeef601;};}function handleError(_0x1c7731,_0x9d01ef){_0x9d01ef=_0x9d01ef||0x1f4;return function(_0x1f93eb){logger[_0x1cbe('0x28')](_0x1f93eb[_0x1cbe('0x29')]);if(_0x1f93eb['name']){delete _0x1f93eb['name'];}_0x1c7731[_0x1cbe('0x1c')](_0x9d01ef)[_0x1cbe('0x2a')](_0x1f93eb);};}exports[_0x1cbe('0x2b')]=function(_0x52c464,_0x2dafc7){var _0x6d60bb={},_0x2364f5={},_0x5f4220={'count':0x0,'rows':[]};var _0x280da9=_[_0x1cbe('0x2c')](db[_0x1cbe('0x2d')][_0x1cbe('0x2e')],function(_0x45193b){return{'name':_0x45193b[_0x1cbe('0x2f')],'type':_0x45193b[_0x1cbe('0x30')][_0x1cbe('0x31')]};});_0x2364f5['model']=_[_0x1cbe('0x2c')](_0x280da9,_0x1cbe('0x32'));_0x2364f5[_0x1cbe('0x33')]=_['keys'](_0x52c464[_0x1cbe('0x33')]);_0x2364f5[_0x1cbe('0x34')]=_[_0x1cbe('0x35')](_0x2364f5[_0x1cbe('0x36')],_0x2364f5['query']);_0x6d60bb[_0x1cbe('0x37')]=_[_0x1cbe('0x35')](_0x2364f5[_0x1cbe('0x36')],qs[_0x1cbe('0x38')](_0x52c464['query']['fields']));_0x6d60bb[_0x1cbe('0x37')]=_0x6d60bb[_0x1cbe('0x37')][_0x1cbe('0x39')]?_0x6d60bb[_0x1cbe('0x37')]:_0x2364f5[_0x1cbe('0x36')];if(!_0x52c464[_0x1cbe('0x33')]['hasOwnProperty'](_0x1cbe('0x3a'))){_0x6d60bb['limit']=qs[_0x1cbe('0x20')](_0x52c464[_0x1cbe('0x33')][_0x1cbe('0x20')]);_0x6d60bb[_0x1cbe('0x1e')]=qs[_0x1cbe('0x1e')](_0x52c464['query'][_0x1cbe('0x1e')]);}_0x6d60bb['order']=qs[_0x1cbe('0x3b')](_0x52c464[_0x1cbe('0x33')][_0x1cbe('0x3b')]);_0x6d60bb[_0x1cbe('0x3c')]=qs['filters'](_[_0x1cbe('0x3d')](_0x52c464[_0x1cbe('0x33')],_0x2364f5[_0x1cbe('0x34')]),_0x280da9);if(_0x52c464[_0x1cbe('0x33')][_0x1cbe('0x3e')]){_0x6d60bb['where']=_[_0x1cbe('0x3f')](_0x6d60bb[_0x1cbe('0x3c')],{'$or':_[_0x1cbe('0x2c')](_0x280da9,function(_0x235baf){if(_0x235baf[_0x1cbe('0x30')]!=='VIRTUAL'){var _0x55d446={};_0x55d446[_0x235baf['name']]={'$like':'%'+_0x52c464['query'][_0x1cbe('0x3e')]+'%'};return _0x55d446;}})});}_0x6d60bb=_['merge']({},_0x6d60bb,_0x52c464['options']);var _0x2418ad={'where':_0x6d60bb[_0x1cbe('0x3c')]};return db[_0x1cbe('0x2d')][_0x1cbe('0x21')](_0x2418ad)[_0x1cbe('0x26')](function(_0x329a66){_0x5f4220[_0x1cbe('0x21')]=_0x329a66;if(_0x52c464[_0x1cbe('0x33')]['includeAll']){_0x6d60bb[_0x1cbe('0x40')]=[{'all':!![]}];}return db[_0x1cbe('0x2d')][_0x1cbe('0x41')](_0x6d60bb);})['then'](function(_0x3db552){_0x5f4220[_0x1cbe('0x42')]=_0x3db552;return _0x5f4220;})[_0x1cbe('0x26')](respondWithFilteredResult(_0x2dafc7,_0x6d60bb))[_0x1cbe('0x43')](handleError(_0x2dafc7,null));};exports[_0x1cbe('0x44')]=function(_0x2a9507,_0x2e07f6){var _0x224fc={'raw':!![],'where':{'id':_0x2a9507[_0x1cbe('0x45')]['id']}},_0x10ec88={};_0x10ec88[_0x1cbe('0x36')]=_[_0x1cbe('0x46')](db[_0x1cbe('0x2d')][_0x1cbe('0x2e')]);_0x10ec88['query']=_['keys'](_0x2a9507[_0x1cbe('0x33')]);_0x10ec88['filters']=_['intersection'](_0x10ec88[_0x1cbe('0x36')],_0x10ec88['query']);_0x224fc['attributes']=_[_0x1cbe('0x35')](_0x10ec88['model'],qs['fields'](_0x2a9507['query']['fields']));_0x224fc[_0x1cbe('0x37')]=_0x224fc[_0x1cbe('0x37')][_0x1cbe('0x39')]?_0x224fc[_0x1cbe('0x37')]:_0x10ec88['model'];if(_0x2a9507[_0x1cbe('0x33')][_0x1cbe('0x47')]){_0x224fc[_0x1cbe('0x40')]=[{'all':!![]}];}_0x224fc=_['merge']({},_0x224fc,_0x2a9507[_0x1cbe('0x48')]);return db[_0x1cbe('0x2d')]['find'](_0x224fc)[_0x1cbe('0x26')](handleEntityNotFound(_0x2e07f6,null))['then'](respondWithResult(_0x2e07f6,null))[_0x1cbe('0x43')](handleError(_0x2e07f6,null));};exports[_0x1cbe('0x49')]=function(_0xb92348,_0x2af852){if(_0xb92348[_0x1cbe('0x4a')]['id']){delete _0xb92348['body']['id'];}return db[_0x1cbe('0x2d')][_0x1cbe('0x4b')]({'where':{'id':_0xb92348[_0x1cbe('0x45')]['id']}})[_0x1cbe('0x26')](handleEntityNotFound(_0x2af852,null))['then'](saveUpdates(_0xb92348['body'],null))['then'](respondWithResult(_0x2af852,null))[_0x1cbe('0x43')](handleError(_0x2af852,null));};exports[_0x1cbe('0x4c')]=function(_0x4a9cc3,_0x2b0cba){return db['CmHopperBlack'][_0x1cbe('0x4b')]({'where':{'id':_0x4a9cc3[_0x1cbe('0x45')]['id']}})[_0x1cbe('0x26')](handleEntityNotFound(_0x2b0cba,null))['then'](removeEntity(_0x2b0cba,null))['catch'](handleError(_0x2b0cba,null));};exports[_0x1cbe('0x4d')]=function(_0x3bf59e,_0x3fc23c){return db[_0x1cbe('0x2d')]['describe']()[_0x1cbe('0x26')](respondWithResult(_0x3fc23c,null))[_0x1cbe('0x43')](handleError(_0x3fc23c,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c6ad802..adbec35 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 _0x2652=['CmHopperBlack','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./cmHopperBlack.attributes','exports'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x2652,0xab));var _0x2265=function(_0x273f62,_0x338d34){_0x273f62=_0x273f62-0x0;var _0x1d0e31=_0x2652[_0x273f62];return _0x1d0e31;};'use strict';var _=require(_0x2265('0x0'));var util=require('util');var logger=require(_0x2265('0x1'))(_0x2265('0x2'));var moment=require(_0x2265('0x3'));var BPromise=require(_0x2265('0x4'));var rp=require(_0x2265('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2265('0x6'));var config=require('../../config/environment');var attributes=require(_0x2265('0x7'));module[_0x2265('0x8')]=function(_0x465c21,_0x17494a){return _0x465c21['define'](_0x2265('0x9'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a7=['cm_hopper_black','lodash','util','api','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define'];(function(_0x529b89,_0x5da2e4){var _0x4383d2=function(_0x253639){while(--_0x253639){_0x529b89['push'](_0x529b89['shift']());}};_0x4383d2(++_0x5da2e4);}(_0x07a7,0x109));var _0x707a=function(_0x4870f5,_0x2f5b66){_0x4870f5=_0x4870f5-0x0;var _0x361629=_0x07a7[_0x4870f5];return _0x361629;};'use strict';var _=require(_0x707a('0x0'));var util=require(_0x707a('0x1'));var logger=require('../../config/logger')(_0x707a('0x2'));var moment=require('moment');var BPromise=require(_0x707a('0x3'));var rp=require(_0x707a('0x4'));var fs=require('fs');var path=require(_0x707a('0x5'));var rimraf=require(_0x707a('0x6'));var config=require('../../config/environment');var attributes=require(_0x707a('0x7'));module[_0x707a('0x8')]=function(_0x1d3087,_0x21d23a){return _0x1d3087[_0x707a('0x9')]('CmHopperBlack',attributes,{'tableName':_0x707a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4414fee..e9276cd 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 _0x5564=['jayson/promise','client','http','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model','debug','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5564,0x1ca));var _0x4556=function(_0x33dacd,_0xdc8f04){_0x33dacd=_0x33dacd-0x0;var _0x5f1469=_0x5564[_0x33dacd];return _0x5f1469;};'use strict';var _=require('lodash');var util=require(_0x4556('0x0'));var moment=require(_0x4556('0x1'));var BPromise=require(_0x4556('0x2'));var rs=require(_0x4556('0x3'));var fs=require('fs');var Redis=require(_0x4556('0x4'));var db=require(_0x4556('0x5'))['db'];var utils=require(_0x4556('0x6'));var logger=require(_0x4556('0x7'))(_0x4556('0x8'));var config=require(_0x4556('0x9'));var jayson=require(_0x4556('0xa'));var client=jayson[_0x4556('0xb')][_0x4556('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1e1454,_0x237ce5,_0x5dfa1c){return new BPromise(function(_0x464343,_0x2d1ab9){return client['request'](_0x1e1454,_0x5dfa1c)[_0x4556('0xd')](function(_0x1bb019){logger[_0x4556('0xe')](_0x4556('0xf'),_0x237ce5,_0x4556('0x10'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x237ce5,_0x4556('0x10'),JSON[_0x4556('0x11')](_0x1bb019));if(_0x1bb019[_0x4556('0x12')]){if(_0x1bb019[_0x4556('0x12')][_0x4556('0x13')]===0x1f4){logger['error'](_0x4556('0xf'),_0x237ce5,_0x1bb019[_0x4556('0x12')][_0x4556('0x14')]);return _0x2d1ab9(_0x1bb019[_0x4556('0x12')][_0x4556('0x14')]);}logger[_0x4556('0x12')](_0x4556('0xf'),_0x237ce5,_0x1bb019[_0x4556('0x12')][_0x4556('0x14')]);return _0x464343(_0x1bb019['error'][_0x4556('0x14')]);}else{logger[_0x4556('0xe')](_0x4556('0xf'),_0x237ce5,_0x4556('0x10'));_0x464343(_0x1bb019[_0x4556('0x15')][_0x4556('0x14')]);}})[_0x4556('0x16')](function(_0x1fbd9a){logger[_0x4556('0x12')](_0x4556('0xf'),_0x237ce5,_0x1fbd9a);_0x2d1ab9(_0x1fbd9a);});});}exports[_0x4556('0x17')]=function(_0x354308){var _0x59f8de=this;return new Promise(function(_0x38fe6a,_0x4d8166){return db[_0x4556('0x18')]['findAll']({'raw':_0x354308[_0x4556('0x19')]?_0x354308[_0x4556('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x354308['options']?_0x354308[_0x4556('0x19')][_0x4556('0x1a')]||null:null,'attributes':_0x354308[_0x4556('0x19')]?_0x354308[_0x4556('0x19')][_0x4556('0x1b')]||null:null,'limit':_0x354308[_0x4556('0x19')]?_0x354308[_0x4556('0x19')][_0x4556('0x1c')]||null:null,'include':_0x354308[_0x4556('0x19')]?_0x354308[_0x4556('0x19')][_0x4556('0x1d')]?_['map'](_0x354308[_0x4556('0x19')][_0x4556('0x1d')],function(_0x13503e){return{'model':db[_0x13503e['model']],'as':_0x13503e['as'],'attributes':_0x13503e[_0x4556('0x1b')],'include':_0x13503e['include']?_[_0x4556('0x1e')](_0x13503e[_0x4556('0x1d')],function(_0x380604){return{'model':db[_0x380604['model']],'as':_0x380604['as'],'attributes':_0x380604[_0x4556('0x1b')],'include':_0x380604[_0x4556('0x1d')]?_[_0x4556('0x1e')](_0x380604[_0x4556('0x1d')],function(_0x4c7749){return{'model':db[_0x4c7749[_0x4556('0x1f')]],'as':_0x4c7749['as'],'attributes':_0x4c7749[_0x4556('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4556('0xd')](function(_0x5aa768){logger[_0x4556('0xe')](_0x4556('0x17'),_0x354308);logger[_0x4556('0x20')]('GetCmHopperBlack',_0x354308,JSON[_0x4556('0x11')](_0x5aa768));_0x38fe6a(_0x5aa768);})[_0x4556('0x16')](function(_0x34dd2c){logger[_0x4556('0x12')](_0x4556('0x17'),_0x34dd2c[_0x4556('0x14')],_0x354308);_0x4d8166(_0x59f8de[_0x4556('0x12')](0x1f4,_0x34dd2c[_0x4556('0x14')]));});});};exports[_0x4556('0x21')]=function(_0x28170c){var _0x1cf1fb=this;return new Promise(function(_0x1bf5c5,_0x193ed0){return db['CmHopperBlack'][_0x4556('0x22')](_0x28170c[_0x4556('0x23')],{'raw':_0x28170c[_0x4556('0x19')]?_0x28170c['options'][_0x4556('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28170c[_0x4556('0x19')]?_0x28170c[_0x4556('0x19')][_0x4556('0x1a')]||null:null,'attributes':_0x28170c[_0x4556('0x19')]?_0x28170c[_0x4556('0x19')][_0x4556('0x1b')]||null:null,'limit':_0x28170c['options']?_0x28170c[_0x4556('0x19')][_0x4556('0x1c')]||null:null})['then'](function(_0x5e080b){logger[_0x4556('0xe')](_0x4556('0x21'),_0x28170c);logger['debug'](_0x4556('0x21'),_0x28170c,JSON[_0x4556('0x11')](_0x5e080b));_0x1bf5c5(_0x5e080b);})[_0x4556('0x16')](function(_0x588afa){logger[_0x4556('0x12')](_0x4556('0x21'),_0x588afa[_0x4556('0x14')],_0x28170c);_0x193ed0(_0x1cf1fb[_0x4556('0x12')](0x1f4,_0x588afa[_0x4556('0x14')]));});});};exports[_0x4556('0x25')]=function(_0x3e6596){var _0x38baea=this;return new Promise(function(_0x1ca1c4,_0x36bfcf){return db[_0x4556('0x18')][_0x4556('0x26')]({'where':_0x3e6596['options']?_0x3e6596['options'][_0x4556('0x1a')]||null:null})[_0x4556('0xd')](function(_0x5c9576){logger[_0x4556('0xe')](_0x4556('0x25'),_0x3e6596);logger[_0x4556('0x20')](_0x4556('0x25'),_0x3e6596,JSON['stringify'](_0x5c9576));_0x1ca1c4(_0x5c9576);})[_0x4556('0x16')](function(_0x486bbc){logger[_0x4556('0x12')](_0x4556('0x25'),_0x486bbc[_0x4556('0x14')],_0x3e6596);_0x36bfcf(_0x38baea[_0x4556('0x12')](0x1f4,_0x486bbc[_0x4556('0x14')]));});});}; \ No newline at end of file +var _0xedb3=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x511014,_0x2fb10e){var _0x18e92b=function(_0x2b2069){while(--_0x2b2069){_0x511014['push'](_0x511014['shift']());}};_0x18e92b(++_0x2fb10e);}(_0xedb3,0x10b));var _0x3edb=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0xedb3[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x3edb('0x0'));var util=require(_0x3edb('0x1'));var moment=require(_0x3edb('0x2'));var BPromise=require(_0x3edb('0x3'));var rs=require(_0x3edb('0x4'));var fs=require('fs');var Redis=require(_0x3edb('0x5'));var db=require(_0x3edb('0x6'))['db'];var utils=require(_0x3edb('0x7'));var logger=require(_0x3edb('0x8'))('rpc');var config=require(_0x3edb('0x9'));var jayson=require(_0x3edb('0xa'));var client=jayson[_0x3edb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54af90,_0x53acd2,_0x2985e1){return new BPromise(function(_0x457cdc,_0x486f4e){return client[_0x3edb('0xc')](_0x54af90,_0x2985e1)[_0x3edb('0xd')](function(_0x5daa60){logger[_0x3edb('0xe')](_0x3edb('0xf'),_0x53acd2,_0x3edb('0x10'));logger[_0x3edb('0x11')](_0x3edb('0x12'),_0x53acd2,_0x3edb('0x10'),JSON[_0x3edb('0x13')](_0x5daa60));if(_0x5daa60[_0x3edb('0x14')]){if(_0x5daa60[_0x3edb('0x14')][_0x3edb('0x15')]===0x1f4){logger[_0x3edb('0x14')]('CmHopperBlack,\x20%s,\x20%s',_0x53acd2,_0x5daa60[_0x3edb('0x14')][_0x3edb('0x16')]);return _0x486f4e(_0x5daa60[_0x3edb('0x14')][_0x3edb('0x16')]);}logger[_0x3edb('0x14')](_0x3edb('0xf'),_0x53acd2,_0x5daa60[_0x3edb('0x14')][_0x3edb('0x16')]);return _0x457cdc(_0x5daa60[_0x3edb('0x14')][_0x3edb('0x16')]);}else{logger[_0x3edb('0xe')]('CmHopperBlack,\x20%s,\x20%s',_0x53acd2,_0x3edb('0x10'));_0x457cdc(_0x5daa60[_0x3edb('0x17')][_0x3edb('0x16')]);}})[_0x3edb('0x18')](function(_0x242570){logger[_0x3edb('0x14')](_0x3edb('0xf'),_0x53acd2,_0x242570);_0x486f4e(_0x242570);});});}exports[_0x3edb('0x19')]=function(_0x249e62){var _0x2dc8e7=this;return new Promise(function(_0x282202,_0x374655){return db[_0x3edb('0x1a')]['findAll']({'raw':_0x249e62[_0x3edb('0x1b')]?_0x249e62[_0x3edb('0x1b')][_0x3edb('0x1c')]===undefined?!![]:![]:!![],'where':_0x249e62[_0x3edb('0x1b')]?_0x249e62[_0x3edb('0x1b')][_0x3edb('0x1d')]||null:null,'attributes':_0x249e62[_0x3edb('0x1b')]?_0x249e62[_0x3edb('0x1b')][_0x3edb('0x1e')]||null:null,'limit':_0x249e62[_0x3edb('0x1b')]?_0x249e62['options'][_0x3edb('0x1f')]||null:null,'include':_0x249e62['options']?_0x249e62[_0x3edb('0x1b')][_0x3edb('0x20')]?_[_0x3edb('0x21')](_0x249e62[_0x3edb('0x1b')][_0x3edb('0x20')],function(_0x5f2dbe){return{'model':db[_0x5f2dbe[_0x3edb('0x22')]],'as':_0x5f2dbe['as'],'attributes':_0x5f2dbe[_0x3edb('0x1e')],'include':_0x5f2dbe[_0x3edb('0x20')]?_[_0x3edb('0x21')](_0x5f2dbe['include'],function(_0x2f801c){return{'model':db[_0x2f801c[_0x3edb('0x22')]],'as':_0x2f801c['as'],'attributes':_0x2f801c['attributes'],'include':_0x2f801c['include']?_[_0x3edb('0x21')](_0x2f801c['include'],function(_0x82278d){return{'model':db[_0x82278d['model']],'as':_0x82278d['as'],'attributes':_0x82278d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3edb('0xd')](function(_0x21ccc1){logger[_0x3edb('0xe')](_0x3edb('0x19'),_0x249e62);logger['debug']('GetCmHopperBlack',_0x249e62,JSON[_0x3edb('0x13')](_0x21ccc1));_0x282202(_0x21ccc1);})[_0x3edb('0x18')](function(_0x33e85b){logger[_0x3edb('0x14')]('GetCmHopperBlack',_0x33e85b[_0x3edb('0x16')],_0x249e62);_0x374655(_0x2dc8e7[_0x3edb('0x14')](0x1f4,_0x33e85b[_0x3edb('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x4f98f1){var _0x11b85f=this;return new Promise(function(_0x5d8bb9,_0x35ea0b){return db[_0x3edb('0x1a')][_0x3edb('0x23')](_0x4f98f1[_0x3edb('0x24')],{'raw':_0x4f98f1[_0x3edb('0x1b')]?_0x4f98f1[_0x3edb('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f98f1[_0x3edb('0x1b')]?_0x4f98f1['options'][_0x3edb('0x1d')]||null:null,'attributes':_0x4f98f1['options']?_0x4f98f1[_0x3edb('0x1b')][_0x3edb('0x1e')]||null:null,'limit':_0x4f98f1[_0x3edb('0x1b')]?_0x4f98f1[_0x3edb('0x1b')][_0x3edb('0x1f')]||null:null})[_0x3edb('0xd')](function(_0x978613){logger[_0x3edb('0xe')](_0x3edb('0x25'),_0x4f98f1);logger[_0x3edb('0x11')](_0x3edb('0x25'),_0x4f98f1,JSON[_0x3edb('0x13')](_0x978613));_0x5d8bb9(_0x978613);})[_0x3edb('0x18')](function(_0x2b7e7b){logger[_0x3edb('0x14')]('UpdateCmHopperBlack',_0x2b7e7b[_0x3edb('0x16')],_0x4f98f1);_0x35ea0b(_0x11b85f[_0x3edb('0x14')](0x1f4,_0x2b7e7b[_0x3edb('0x16')]));});});};exports[_0x3edb('0x26')]=function(_0x263ecb){var _0x40c839=this;return new Promise(function(_0x5528cc,_0x29253){return db['CmHopperBlack']['destroy']({'where':_0x263ecb[_0x3edb('0x1b')]?_0x263ecb['options'][_0x3edb('0x1d')]||null:null})[_0x3edb('0xd')](function(_0x5eec16){logger[_0x3edb('0xe')](_0x3edb('0x26'),_0x263ecb);logger[_0x3edb('0x11')]('DestroyCmHopperBlack',_0x263ecb,JSON[_0x3edb('0x13')](_0x5eec16));_0x5528cc(_0x5eec16);})['catch'](function(_0x572c6c){logger[_0x3edb('0x14')](_0x3edb('0x26'),_0x572c6c['message'],_0x263ecb);_0x29253(_0x40c839['error'](0x1f4,_0x572c6c[_0x3edb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index cc3a154..1db5ad8 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 _0xb016=['multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','put','/:id','destroy'];(function(_0x34e93e,_0x5d6bf4){var _0x4249b3=function(_0x567ede){while(--_0x567ede){_0x34e93e['push'](_0x34e93e['shift']());}};_0x4249b3(++_0x5d6bf4);}(_0xb016,0x159));var _0x6b01=function(_0x541f8c,_0x1eef63){_0x541f8c=_0x541f8c-0x0;var _0x59c7fd=_0xb016[_0x541f8c];return _0x59c7fd;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./cmHopperBlack.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/describe',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller['update']);router['delete'](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);module['exports']=router; \ No newline at end of file +var _0x57ca=['../../components/interaction/service','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3fce92,_0x7bd4c5){var _0x40ec60=function(_0x143f62){while(--_0x143f62){_0x3fce92['push'](_0x3fce92['shift']());}};_0x40ec60(++_0x7bd4c5);}(_0x57ca,0x108));var _0xa57c=function(_0x5dca91,_0x3e6d9a){_0x5dca91=_0x5dca91-0x0;var _0x24ce62=_0x57ca[_0x5dca91];return _0x24ce62;};'use strict';var multer=require('multer');var util=require(_0xa57c('0x0'));var path=require(_0xa57c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa57c('0x2'));var router=express[_0xa57c('0x3')]();var fs_extra=require(_0xa57c('0x4'));var auth=require(_0xa57c('0x5'));var interaction=require(_0xa57c('0x6'));var config=require('../../config/environment');var controller=require(_0xa57c('0x7'));router[_0xa57c('0x8')]('/',auth[_0xa57c('0x9')](),controller[_0xa57c('0xa')]);router[_0xa57c('0x8')](_0xa57c('0xb'),auth[_0xa57c('0x9')](),controller[_0xa57c('0xc')]);router['get'](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0xe')]);router[_0xa57c('0xf')]('/:id',auth[_0xa57c('0x9')](),controller['update']);router[_0xa57c('0x10')](_0xa57c('0xd'),auth['isAuthenticated'](),controller[_0xa57c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a153e95..5214a39 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 _0xd3f2=['seconds','setDataValue','dispositionat','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','followuptime','diff'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0xd3f2,0x160));var _0x2d3f=function(_0x41dd6b,_0x5ae4ba){_0x41dd6b=_0x41dd6b-0x0;var _0x156c5a=_0xd3f2[_0x41dd6b];return _0x156c5a;};'use strict';var Sequelize=require(_0x2d3f('0x0'));var moment=require(_0x2d3f('0x1'));module['exports']={'state':{'type':Sequelize[_0x2d3f('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2d3f('0x3')]},'scheduledat':{'type':Sequelize[_0x2d3f('0x4')]},'countbusyretry':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2d3f('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2d3f('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x2d3f('0x3')]},'calleridname':{'type':Sequelize[_0x2d3f('0x3')]},'starttime':{'type':Sequelize[_0x2d3f('0x4')]},'responsetime':{'type':Sequelize[_0x2d3f('0x4')]},'answertime':{'type':Sequelize[_0x2d3f('0x4')]},'droptime':{'type':Sequelize[_0x2d3f('0x4')]},'endtime':{'type':Sequelize[_0x2d3f('0x4')]},'ringtime':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2d3f('0x3')]},'campaign':{'type':Sequelize[_0x2d3f('0x3')]},'campaigntype':{'type':Sequelize[_0x2d3f('0x3')]},'membername':{'type':Sequelize[_0x2d3f('0x3')]},'reason':{'type':Sequelize[_0x2d3f('0x3')]},'disposition':{'type':Sequelize[_0x2d3f('0x3')]},'secondDisposition':{'type':Sequelize[_0x2d3f('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2d3f('0x3')]},'dispositionat':{'type':Sequelize[_0x2d3f('0x4')],'set':function(_0x29e0f1){var _0x25181d=this[_0x2d3f('0x5')]('endtime');if(_0x25181d&&_0x29e0f1){this['setDataValue'](_0x2d3f('0x6'),moment(_0x29e0f1)[_0x2d3f('0x7')](moment(_0x25181d),_0x2d3f('0x8')));}return this[_0x2d3f('0x9')](_0x2d3f('0xa'),_0x29e0f1);}},'amd':{'type':Sequelize[_0x2d3f('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2d3f('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2d3f('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2d3f('0x4')]},'deleted':{'type':Sequelize[_0x2d3f('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2d3f('0x4')]},'recallme':{'type':Sequelize[_0x2d3f('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2d3f('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xae06=['BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xae06,0x1b9));var _0x6ae0=function(_0x3bd19b,_0x5246f8){_0x3bd19b=_0x3bd19b-0x0;var _0x1ef16d=_0xae06[_0x3bd19b];return _0x1ef16d;};'use strict';var Sequelize=require(_0x6ae0('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x6ae0('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6ae0('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6ae0('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6ae0('0x2')]},'calleridnum':{'type':Sequelize[_0x6ae0('0x2')]},'calleridname':{'type':Sequelize[_0x6ae0('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6ae0('0x3')]},'answertime':{'type':Sequelize[_0x6ae0('0x3')]},'droptime':{'type':Sequelize[_0x6ae0('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6ae0('0x2')]},'campaign':{'type':Sequelize[_0x6ae0('0x2')]},'campaigntype':{'type':Sequelize[_0x6ae0('0x2')]},'membername':{'type':Sequelize[_0x6ae0('0x2')]},'reason':{'type':Sequelize[_0x6ae0('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6ae0('0x2')]},'thirdDisposition':{'type':Sequelize[_0x6ae0('0x2')]},'dispositionat':{'type':Sequelize[_0x6ae0('0x3')],'set':function(_0x6a64a2){var _0x53c1b0=this[_0x6ae0('0x4')](_0x6ae0('0x5'));if(_0x53c1b0&&_0x6a64a2){this['setDataValue'](_0x6ae0('0x6'),moment(_0x6a64a2)[_0x6ae0('0x7')](moment(_0x53c1b0),_0x6ae0('0x8')));}return this['setDataValue']('dispositionat',_0x6a64a2);}},'amd':{'type':Sequelize[_0x6ae0('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6ae0('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6ae0('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6ae0('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6ae0('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6ae0('0x3')]},'recallme':{'type':Sequelize[_0x6ae0('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6ae0('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6ae0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index a60e51a..dd2f18e 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 _0x7c09=['sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','noSuchContacts','noAnswerContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','state\x20=\x204','checkContactHopper','CmHopper','findOne','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path'];(function(_0x585a5f,_0x1bba51){var _0x157179=function(_0x61dc69){while(--_0x61dc69){_0x585a5f['push'](_0x585a5f['shift']());}};_0x157179(++_0x1bba51);}(_0x7c09,0x102));var _0x97c0=function(_0x5aaef4,_0x235d27){_0x5aaef4=_0x5aaef4-0x0;var _0x62578c=_0x7c09[_0x5aaef4];return _0x62578c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['CmHopperFinal'][_0x97c0('0x48')]()[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,null))[_0x97c0('0x43')](handleError(_0x4ff0a5,null));};exports['update']=function(_0x3e09d5,_0xac56ac){if(_0x3e09d5[_0x97c0('0x49')][_0x97c0('0x4a')]){delete _0x3e09d5[_0x97c0('0x49')]['uniqueid'];}return db[_0x97c0('0x2b')][_0x97c0('0x47')]({'where':{'uniqueid':_0x3e09d5[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0xac56ac,null))['then'](saveUpdates(_0x3e09d5[_0x97c0('0x49')],null))['then'](respondWithResult(_0xac56ac,null))['catch'](handleError(_0xac56ac,null));};exports[_0x97c0('0x4b')]=function(_0x20e2a5,_0x23c7ad,_0x53a255){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x20e2a5[_0x97c0('0x45')]['id']},'attributes':[[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x4f')))),'noSuchContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x50')))),'noAnswerContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x53')))),_0x97c0('0x54')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x55')))),_0x97c0('0x56')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x59')))),'reCallContacts'],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x97c0('0x5a')]]})[_0x97c0('0x24')](handleEntityNotFound(_0x23c7ad,null))[_0x97c0('0x24')](respondWithResult(_0x23c7ad,null))[_0x97c0('0x43')](handleError(_0x23c7ad,null));};exports[_0x97c0('0x5b')]=function(_0x2bb5d3,_0x52643e,_0x3349df){return db[_0x97c0('0x2b')][_0x97c0('0x41')]({'raw':![],'where':{'CampaignId':_0x2bb5d3[_0x97c0('0x45')]['id']},'attributes':[[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x200,\x201,\x20null'))),_0x97c0('0x5c')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x50')))),_0x97c0('0x5d')],[db['sequelize']['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x51')))),_0x97c0('0x52')],[db[_0x97c0('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),_0x97c0('0x54')],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x55')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db['sequelize'][_0x97c0('0x4e')](_0x97c0('0x57')))),_0x97c0('0x58')],[db[_0x97c0('0x4c')]['fn'](_0x97c0('0x4d'),db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x59')))),_0x97c0('0x5e')],[db[_0x97c0('0x4c')]['fn']('COUNT',db[_0x97c0('0x4c')]['fn']('IF',db[_0x97c0('0x4c')][_0x97c0('0x4e')](_0x97c0('0x5f')))),_0x97c0('0x5a')]]})['then'](handleEntityNotFound(_0x52643e,null))[_0x97c0('0x24')](respondWithResult(_0x52643e,null))[_0x97c0('0x43')](handleError(_0x52643e,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x4116c9,_0x30ffa8,_0x1cfe22){return db['VoiceQueue'][_0x97c0('0x47')]({'where':{'id':_0x4116c9[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x30ffa8,null))[_0x97c0('0x24')](function(_0x4d40cd){var _0x4ee6a2;if(_0x4d40cd){_0x4ee6a2=squel['insert']()[_0x97c0('0x60')](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),_0x97c0('0x66'),_0x97c0('0x67'),'createdAt','updatedAt'],squel[_0x97c0('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x64'))[_0x97c0('0x69')](_0x97c0('0x6b'),'ContactId')['field'](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x6d'),'VoiceQueueId')[_0x97c0('0x69')]('NOW()',_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x74'),_0x4116c9['body']['state'][_0x97c0('0x73')]())[_0x97c0('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x97c0('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x97c0('0x68')]()[_0x97c0('0x69')]('phone')[_0x97c0('0x70')]('cm_hopper')['where']('VoiceQueueId\x20=\x20?',_0x4116c9[_0x97c0('0x45')]['id'][_0x97c0('0x73')]()))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x72'),_0x4116c9['params']['id'][_0x97c0('0x73')]())['where']('state\x20=\x204'))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')]['query'](_0x4ee6a2);}return[];})[_0x97c0('0x24')](respondWithResult(_0x30ffa8,null))[_0x97c0('0x43')](handleError(_0x30ffa8,null));};exports[_0x97c0('0x78')]=function(_0x5bb9de,_0x388ba1,_0x550a68){return db[_0x97c0('0x79')][_0x97c0('0x47')]({'where':{'id':_0x5bb9de[_0x97c0('0x45')]['id']}})['then'](handleEntityNotFound(_0x388ba1,null))[_0x97c0('0x24')](function(_0x44f6bc){var _0x37cdb3;if(_0x44f6bc){_0x37cdb3=squel[_0x97c0('0x7a')]()['into'](_0x97c0('0x61'))[_0x97c0('0x62')]([_0x97c0('0x63'),_0x97c0('0x64'),_0x97c0('0x65'),'ListId',_0x97c0('0x7b'),_0x97c0('0x6e'),'updatedAt'],squel['select']()[_0x97c0('0x69')](_0x97c0('0x7c'),_0x97c0('0x63'))['field']('NOW()',_0x97c0('0x64'))['field'](_0x97c0('0x6b'),_0x97c0('0x65'))[_0x97c0('0x69')](_0x97c0('0x6c'),_0x97c0('0x66'))[_0x97c0('0x69')](_0x97c0('0x7d'),'CampaignId')[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6e'))[_0x97c0('0x69')](_0x97c0('0x6a'),_0x97c0('0x6f'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de[_0x97c0('0x45')]['id'][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x74'),_0x5bb9de['body'][_0x97c0('0x7f')][_0x97c0('0x73')]())[_0x97c0('0x39')](_0x97c0('0x80'))['where'](_0x97c0('0x75'),squel[_0x97c0('0x68')]()[_0x97c0('0x69')](_0x97c0('0x63'))[_0x97c0('0x70')](_0x97c0('0x61'))[_0x97c0('0x39')]('CampaignId\x20=\x20?',_0x5bb9de[_0x97c0('0x45')]['id']['toString']()))[_0x97c0('0x39')](_0x97c0('0x75'),squel[_0x97c0('0x68')]()['field'](_0x97c0('0x76'))[_0x97c0('0x70')](_0x97c0('0x71'))[_0x97c0('0x39')](_0x97c0('0x7e'),_0x5bb9de['params']['id'][_0x97c0('0x73')]())['where'](_0x97c0('0x81')))[_0x97c0('0x77')]('ContactId'))[_0x97c0('0x73')]();return db[_0x97c0('0x4c')][_0x97c0('0x2f')](_0x37cdb3);}return[];})[_0x97c0('0x24')](respondWithResult(_0x388ba1,null))[_0x97c0('0x43')](handleError(_0x388ba1,null));};exports[_0x97c0('0x82')]=function(_0x3ebd11,_0x44b374,_0x493e62){return db[_0x97c0('0x83')][_0x97c0('0x84')]({'where':{'VoiceQueueId':_0x3ebd11[_0x97c0('0x49')]['VoiceQueueId'],'CampaignId':_0x3ebd11['body'][_0x97c0('0x7b')],'ContactId':_0x3ebd11[_0x97c0('0x49')][_0x97c0('0x65')]}})[_0x97c0('0x24')](handleEntityNotFound(_0x44b374,null))[_0x97c0('0x24')](function(_0x120d78){if(_0x120d78){return _0x120d78;}return null;})[_0x97c0('0x24')](respondWithResult(_0x44b374,null))[_0x97c0('0x43')](handleError(_0x44b374,null));}; \ No newline at end of file +var _0x5d58=['calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','ANY_VALUE(CampaignId)','cm_hopper_final','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','CmHopperFinal','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','describe','catch','body','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)'];(function(_0x29eb10,_0x190cb3){var _0x5371a2=function(_0x3109ea){while(--_0x3109ea){_0x29eb10['push'](_0x29eb10['shift']());}};_0x5371a2(++_0x190cb3);}(_0x5d58,0x187));var _0x85d5=function(_0x303b35,_0x412f39){_0x303b35=_0x303b35-0x0;var _0x172b99=_0x5d58[_0x303b35];return _0x172b99;};'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('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['CmHopperFinal']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['CmHopperFinal'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')]()['then'](respondWithResult(_0x12a03,null))[_0x85d5('0x40')](handleError(_0x12a03,null));};exports['update']=function(_0x1f2ef9,_0xd8db57){if(_0x1f2ef9[_0x85d5('0x41')]['uniqueid']){delete _0x1f2ef9['body']['uniqueid'];}return db[_0x85d5('0x34')][_0x85d5('0x42')]({'where':{'uniqueid':_0x1f2ef9[_0x85d5('0x39')]['id']}})['then'](handleEntityNotFound(_0xd8db57,null))['then'](saveUpdates(_0x1f2ef9[_0x85d5('0x41')],null))[_0x85d5('0x1c')](respondWithResult(_0xd8db57,null))[_0x85d5('0x40')](handleError(_0xd8db57,null));};exports[_0x85d5('0x43')]=function(_0x4b2dce,_0x3f69ea,_0x29442a){return db[_0x85d5('0x34')][_0x85d5('0x36')]({'raw':![],'where':{'VoiceQueueId':_0x4b2dce[_0x85d5('0x39')]['id']},'attributes':[[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),_0x85d5('0x48')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x85d5('0x4e')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x4f')))),_0x85d5('0x50')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x2022,\x201,\x20null'))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize'][_0x85d5('0x46')](_0x85d5('0x52')))),_0x85d5('0x53')]]})['then'](handleEntityNotFound(_0x3f69ea,null))[_0x85d5('0x1c')](respondWithResult(_0x3f69ea,null))[_0x85d5('0x40')](handleError(_0x3f69ea,null));};exports[_0x85d5('0x54')]=function(_0x561bde,_0x34aa42,_0x1c3e2c){return db['CmHopperFinal'][_0x85d5('0x36')]({'raw':![],'where':{'CampaignId':_0x561bde['params']['id']},'attributes':[[db[_0x85d5('0x44')]['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x47')))),'noSuchContacts'],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x49')))),_0x85d5('0x4a')],[db[_0x85d5('0x44')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x85d5('0x44')]['literal'](_0x85d5('0x4b')))),_0x85d5('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')]('`state`\x20=\x208,\x201,\x20null'))),_0x85d5('0x4d')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db['sequelize']['literal'](_0x85d5('0x55')))),'dropContacts'],[db['sequelize']['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x85d5('0x50')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db['sequelize']['fn']('IF',db[_0x85d5('0x44')][_0x85d5('0x46')](_0x85d5('0x56')))),_0x85d5('0x51')],[db[_0x85d5('0x44')]['fn'](_0x85d5('0x45'),db[_0x85d5('0x44')]['fn']('IF',db[_0x85d5('0x44')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x85d5('0x53')]]})[_0x85d5('0x1c')](handleEntityNotFound(_0x34aa42,null))[_0x85d5('0x1c')](respondWithResult(_0x34aa42,null))['catch'](handleError(_0x34aa42,null));};exports[_0x85d5('0x57')]=function(_0x1fdefb,_0x496586,_0x2dbd18){return db[_0x85d5('0x58')][_0x85d5('0x42')]({'where':{'id':_0x1fdefb[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x496586,null))['then'](function(_0x35ba15){var _0x1b96eb;if(_0x35ba15){_0x1b96eb=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')](_0x85d5('0x5b'))['fromQuery']([_0x85d5('0x5c'),_0x85d5('0x5d'),_0x85d5('0x5e'),_0x85d5('0x5f'),_0x85d5('0x60'),_0x85d5('0x61'),_0x85d5('0x62')],squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x65'),'phone')[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x5d'))[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))['field'](_0x85d5('0x68'),'ListId')['field'](_0x85d5('0x69'),_0x85d5('0x60'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x61'))[_0x85d5('0x64')](_0x85d5('0x66'),_0x85d5('0x62'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x1fdefb[_0x85d5('0x41')][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6f'))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('phone')['from'](_0x85d5('0x5b'))['where'](_0x85d5('0x6b'),_0x1fdefb[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')](_0x85d5('0x71'))[_0x85d5('0x6a')]('cm_hopper_final')[_0x85d5('0x30')](_0x85d5('0x6b'),_0x1fdefb['params']['id'][_0x85d5('0x6c')]())['where'](_0x85d5('0x72')))[_0x85d5('0x73')](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db['sequelize'][_0x85d5('0x27')](_0x1b96eb);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x496586,null))['catch'](handleError(_0x496586,null));};exports[_0x85d5('0x74')]=function(_0x14e4e8,_0x57f26b,_0x45b1e2){return db[_0x85d5('0x75')][_0x85d5('0x42')]({'where':{'id':_0x14e4e8['params']['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x57f26b,null))[_0x85d5('0x1c')](function(_0x2dacf7){var _0x387a3b;if(_0x2dacf7){_0x387a3b=squel[_0x85d5('0x59')]()[_0x85d5('0x5a')]('cm_hopper')[_0x85d5('0x76')]([_0x85d5('0x5c'),'scheduledAt',_0x85d5('0x5e'),'ListId',_0x85d5('0x77'),_0x85d5('0x61'),_0x85d5('0x62')],squel['select']()[_0x85d5('0x64')](_0x85d5('0x65'),_0x85d5('0x5c'))[_0x85d5('0x64')](_0x85d5('0x66'),'scheduledAt')[_0x85d5('0x64')](_0x85d5('0x67'),_0x85d5('0x5e'))[_0x85d5('0x64')]('ANY_VALUE(ListId)',_0x85d5('0x5f'))[_0x85d5('0x64')](_0x85d5('0x78'),'CampaignId')[_0x85d5('0x64')]('NOW()',_0x85d5('0x61'))[_0x85d5('0x64')]('NOW()','updatedAt')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id'][_0x85d5('0x6c')]())[_0x85d5('0x30')](_0x85d5('0x6d'),_0x14e4e8['body'][_0x85d5('0x6e')][_0x85d5('0x6c')]())[_0x85d5('0x30')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x85d5('0x30')](_0x85d5('0x70'),squel['select']()[_0x85d5('0x64')](_0x85d5('0x5c'))[_0x85d5('0x6a')](_0x85d5('0x5b'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']()))[_0x85d5('0x30')](_0x85d5('0x70'),squel[_0x85d5('0x63')]()[_0x85d5('0x64')]('calleridnum')[_0x85d5('0x6a')](_0x85d5('0x79'))[_0x85d5('0x30')](_0x85d5('0x7a'),_0x14e4e8[_0x85d5('0x39')]['id']['toString']())['where'](_0x85d5('0x72')))['group'](_0x85d5('0x5e')))[_0x85d5('0x6c')]();return db[_0x85d5('0x44')][_0x85d5('0x27')](_0x387a3b);}return[];})[_0x85d5('0x1c')](respondWithResult(_0x57f26b,null))[_0x85d5('0x40')](handleError(_0x57f26b,null));};exports[_0x85d5('0x7b')]=function(_0x48553d,_0xedb32d,_0x5366bc){return db[_0x85d5('0x7c')][_0x85d5('0x7d')]({'where':{'VoiceQueueId':_0x48553d[_0x85d5('0x41')]['VoiceQueueId'],'CampaignId':_0x48553d[_0x85d5('0x41')][_0x85d5('0x77')],'ContactId':_0x48553d[_0x85d5('0x41')]['ContactId']}})['then'](handleEntityNotFound(_0xedb32d,null))[_0x85d5('0x1c')](function(_0x428fd4){if(_0x428fd4){return _0x428fd4;}return null;})['then'](respondWithResult(_0xedb32d,null))[_0x85d5('0x40')](handleError(_0xedb32d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 6b657e9..a3f1d4e 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 _0xa0be=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa0be,0x192));var _0xea0b=function(_0x286b71,_0x1981e3){_0x286b71=_0x286b71-0x0;var _0x7a5a47=_0xa0be[_0x286b71];return _0x7a5a47;};'use strict';var _=require(_0xea0b('0x0'));var util=require(_0xea0b('0x1'));var logger=require(_0xea0b('0x2'))(_0xea0b('0x3'));var moment=require(_0xea0b('0x4'));var BPromise=require(_0xea0b('0x5'));var rp=require(_0xea0b('0x6'));var fs=require('fs');var path=require(_0xea0b('0x7'));var rimraf=require('rimraf');var config=require(_0xea0b('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0xea0b('0x9')]=function(_0x4e6eeb,_0x4016ff){return _0x4e6eeb[_0xea0b('0xa')](_0xea0b('0xb'),attributes,{'tableName':_0xea0b('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xea0b('0xd')]},{'name':'uniqueid','fields':[_0xea0b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a4c=['cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal'];(function(_0x13c0cf,_0x37b646){var _0x3c91ef=function(_0x41582d){while(--_0x41582d){_0x13c0cf['push'](_0x13c0cf['shift']());}};_0x3c91ef(++_0x37b646);}(_0x0a4c,0xc3));var _0xc0a4=function(_0x3fdb0d,_0x380866){_0x3fdb0d=_0x3fdb0d-0x0;var _0x5e52d3=_0x0a4c[_0x3fdb0d];return _0x5e52d3;};'use strict';var _=require(_0xc0a4('0x0'));var util=require('util');var logger=require(_0xc0a4('0x1'))('api');var moment=require(_0xc0a4('0x2'));var BPromise=require(_0xc0a4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0a4('0x4'));var rimraf=require(_0xc0a4('0x5'));var config=require(_0xc0a4('0x6'));var attributes=require(_0xc0a4('0x7'));module['exports']=function(_0xfb91fb,_0x2a53ee){return _0xfb91fb['define'](_0xc0a4('0x8'),attributes,{'tableName':_0xc0a4('0x9'),'paranoid':![],'indexes':[{'name':_0xc0a4('0xa'),'fields':[_0xc0a4('0xa')]},{'name':'uniqueid','fields':[_0xc0a4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 91fb671..ceae1d2 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x341a89,_0x33c3ae){var _0x1002b3=function(_0x528c7d){while(--_0x528c7d){_0x341a89['push'](_0x341a89['shift']());}};_0x1002b3(++_0x33c3ae);}(_0x7a54,0x106));var _0x47a5=function(_0x44741c,_0x1a5aec){_0x44741c=_0x44741c-0x0;var _0x1155eb=_0x7a54[_0x44741c];return _0x1155eb;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11099a,_0x13dc85){var _0x196751=function(_0x5f486e){while(--_0x5f486e){_0x11099a['push'](_0x11099a['shift']());}};_0x196751(++_0x13dc85);}(_0x7a54,0x106));var _0x47a5=function(_0x58bc36,_0x286e9e){_0x58bc36=_0x58bc36-0x0;var _0x521ab5=_0x7a54[_0x58bc36];return _0x521ab5;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index c31afd9..01d1b73 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 _0xb22d=['get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5ac77e,_0x4e8691){var _0x2dcbfc=function(_0x142a43){while(--_0x142a43){_0x5ac77e['push'](_0x5ac77e['shift']());}};_0x2dcbfc(++_0x4e8691);}(_0xb22d,0x75));var _0xdb22=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0xb22d[_0xfd9b19];return _0x514918;};'use strict';var multer=require(_0xdb22('0x0'));var util=require('util');var path=require(_0xdb22('0x1'));var timeout=require(_0xdb22('0x2'));var express=require(_0xdb22('0x3'));var router=express[_0xdb22('0x4')]();var fs_extra=require(_0xdb22('0x5'));var auth=require(_0xdb22('0x6'));var interaction=require(_0xdb22('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xdb22('0x8')]('/',auth[_0xdb22('0x9')](),controller[_0xdb22('0xa')]);router[_0xdb22('0x8')](_0xdb22('0xb'),auth[_0xdb22('0x9')](),controller[_0xdb22('0xc')]);router['get'](_0xdb22('0xd'),auth[_0xdb22('0x9')](),controller[_0xdb22('0xe')]);router[_0xdb22('0x8')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xdb22('0xf')]);router[_0xdb22('0x8')]('/campaign/countAttributes/:id',auth[_0xdb22('0x9')](),controller[_0xdb22('0x10')]);router[_0xdb22('0x11')](_0xdb22('0x12'),auth['isAuthenticated'](),controller[_0xdb22('0x13')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xdb22('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xdb22('0x14'),auth[_0xdb22('0x9')](),controller[_0xdb22('0x15')]);router[_0xdb22('0x16')]('/:id',auth[_0xdb22('0x9')](),controller[_0xdb22('0x17')]);module[_0xdb22('0x18')]=router; \ No newline at end of file +var _0xec2b=['./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','post','/checkContactHopper','checkContactHopper','put','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xec2b,0x1e6));var _0xbec2=function(_0x4c51f6,_0x2a0b7a){_0x4c51f6=_0x4c51f6-0x0;var _0x6a70b0=_0xec2b[_0x4c51f6];return _0x6a70b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbec2('0x0'));var timeout=require(_0xbec2('0x1'));var express=require(_0xbec2('0x2'));var router=express[_0xbec2('0x3')]();var fs_extra=require(_0xbec2('0x4'));var auth=require(_0xbec2('0x5'));var interaction=require(_0xbec2('0x6'));var config=require(_0xbec2('0x7'));var controller=require(_0xbec2('0x8'));router[_0xbec2('0x9')]('/',auth[_0xbec2('0xa')](),controller[_0xbec2('0xb')]);router[_0xbec2('0x9')](_0xbec2('0xc'),auth[_0xbec2('0xa')](),controller[_0xbec2('0xd')]);router[_0xbec2('0x9')](_0xbec2('0xe'),auth[_0xbec2('0xa')](),controller[_0xbec2('0xf')]);router['get']('/voice/queue/countAttributes/:id',auth[_0xbec2('0xa')](),controller[_0xbec2('0x10')]);router['get'](_0xbec2('0x11'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xbec2('0x12'),auth['isAuthenticated'](),controller[_0xbec2('0x13')]);router['post'](_0xbec2('0x14'),auth[_0xbec2('0xa')](),controller[_0xbec2('0x15')]);router[_0xbec2('0x16')](_0xbec2('0x17'),auth[_0xbec2('0xa')](),controller[_0xbec2('0x18')]);router[_0xbec2('0x19')](_0xbec2('0xe'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 8ea5500..0d4b2d6 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 _0x8260=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x1f6514,_0x2564c2){var _0x2cfaf6=function(_0x43f4b3){while(--_0x43f4b3){_0x1f6514['push'](_0x1f6514['shift']());}};_0x2cfaf6(++_0x2564c2);}(_0x8260,0xcc));var _0x0826=function(_0x57db3a,_0x32dc3f){_0x57db3a=_0x57db3a-0x0;var _0x18dc71=_0x8260[_0x57db3a];return _0x18dc71;};'use strict';var Sequelize=require(_0x0826('0x0'));module[_0x0826('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x0826('0x2')]},'scheduledat':{'type':Sequelize[_0x0826('0x3')]},'countbusyretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0826('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x0826('0x2')]},'calleridnum':{'type':Sequelize[_0x0826('0x2')]},'calleridname':{'type':Sequelize[_0x0826('0x2')]},'starttime':{'type':Sequelize[_0x0826('0x3')]},'responsetime':{'type':Sequelize[_0x0826('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x0826('0x3')]},'endtime':{'type':Sequelize[_0x0826('0x3')]},'ringtime':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0826('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0826('0x2')]},'membername':{'type':Sequelize[_0x0826('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x0826('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0826('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0826('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0826('0x3')]},'edited':{'type':Sequelize[_0x0826('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0826('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x291f=['BOOLEAN','INTEGER','DATE','STRING'];(function(_0x4ba7da,_0x10fa5f){var _0x45b490=function(_0x122fc1){while(--_0x122fc1){_0x4ba7da['push'](_0x4ba7da['shift']());}};_0x45b490(++_0x10fa5f);}(_0x291f,0x65));var _0xf291=function(_0x3a7be9,_0x17d289){_0x3a7be9=_0x3a7be9-0x0;var _0x240707=_0x291f[_0x3a7be9];return _0x240707;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xf291('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf291('0x1')]},'countbusyretry':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf291('0x2')]},'calleridname':{'type':Sequelize[_0xf291('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf291('0x1')]},'droptime':{'type':Sequelize[_0xf291('0x1')]},'endtime':{'type':Sequelize[_0xf291('0x1')]},'ringtime':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xf291('0x2')]},'campaigntype':{'type':Sequelize[_0xf291('0x2')]},'membername':{'type':Sequelize[_0xf291('0x2')]},'reason':{'type':Sequelize[_0xf291('0x2')]},'amd':{'type':Sequelize[_0xf291('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf291('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf291('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf291('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf291('0x1')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf291('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 0a1558e..08904bc 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 _0x5f7c=['error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','include','find','catch','create','describe','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then'];(function(_0x554552,_0x2e0290){var _0x2ad4a4=function(_0x201ca2){while(--_0x201ca2){_0x554552['push'](_0x554552['shift']());}};_0x2ad4a4(++_0x2e0290);}(_0x5f7c,0x7b));var _0xc5f7=function(_0x29e154,_0x172f13){_0x29e154=_0x29e154-0x0;var _0x1bd116=_0x5f7c[_0x29e154];return _0x1bd116;};'use strict';var emlformat=require(_0xc5f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc5f7('0x1'));var jsonpatch=require(_0xc5f7('0x2'));var rp=require(_0xc5f7('0x3'));var moment=require(_0xc5f7('0x4'));var BPromise=require(_0xc5f7('0x5'));var Mustache=require(_0xc5f7('0x6'));var util=require(_0xc5f7('0x7'));var path=require(_0xc5f7('0x8'));var sox=require(_0xc5f7('0x9'));var csv=require(_0xc5f7('0xa'));var ejs=require(_0xc5f7('0xb'));var fs=require('fs');var fs_extra=require(_0xc5f7('0xc'));var _=require(_0xc5f7('0xd'));var squel=require(_0xc5f7('0xe'));var crypto=require(_0xc5f7('0xf'));var jsforce=require(_0xc5f7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc5f7('0xa'));var querystring=require(_0xc5f7('0x11'));var Papa=require(_0xc5f7('0x12'));var Redis=require(_0xc5f7('0x13'));var authService=require(_0xc5f7('0x14'));var qs=require(_0xc5f7('0x15'));var as=require(_0xc5f7('0x16'));var hardwareService=require(_0xc5f7('0x17'));var logger=require('../../config/logger')(_0xc5f7('0x18'));var utils=require(_0xc5f7('0x19'));var config=require(_0xc5f7('0x1a'));var licenseUtil=require(_0xc5f7('0x1b'));var db=require(_0xc5f7('0x1c'))['db'];function respondWithStatusCode(_0x509e72,_0x48b8d8){_0x48b8d8=_0x48b8d8||0xcc;return function(_0x30f805){if(_0x30f805){return _0x509e72[_0xc5f7('0x1d')](_0x48b8d8);}return _0x509e72[_0xc5f7('0x1e')](_0x48b8d8)[_0xc5f7('0x1f')]();};}function respondWithResult(_0x31babd,_0x5ea498){_0x5ea498=_0x5ea498||0xc8;return function(_0x36ff63){if(_0x36ff63){return _0x31babd[_0xc5f7('0x1e')](_0x5ea498)['json'](_0x36ff63);}};}function respondWithFilteredResult(_0x2acc45,_0xa34022){return function(_0x5d5afe){if(_0x5d5afe){var _0x215486=typeof _0xa34022['offset']===_0xc5f7('0x20')&&typeof _0xa34022['limit']==='undefined';var _0x5d4322=_0x5d5afe[_0xc5f7('0x21')];var _0x3903b4=_0x215486?0x0:_0xa34022[_0xc5f7('0x22')];var _0x18c596=_0x215486?_0x5d5afe[_0xc5f7('0x21')]:_0xa34022[_0xc5f7('0x22')]+_0xa34022[_0xc5f7('0x23')];var _0x28c479;if(_0x18c596>=_0x5d4322){_0x18c596=_0x5d4322;_0x28c479=0xc8;}else{_0x28c479=0xce;}_0x2acc45[_0xc5f7('0x1e')](_0x28c479);return _0x2acc45[_0xc5f7('0x24')](_0xc5f7('0x25'),_0x3903b4+'-'+_0x18c596+'/'+_0x5d4322)[_0xc5f7('0x26')](_0x5d5afe);}return null;};}function patchUpdates(_0x2f28f8){return function(_0x4743f7){try{jsonpatch[_0xc5f7('0x27')](_0x4743f7,_0x2f28f8,!![]);}catch(_0x3a0c7b){return BPromise[_0xc5f7('0x28')](_0x3a0c7b);}return _0x4743f7[_0xc5f7('0x29')]();};}function saveUpdates(_0x3fd013,_0x5af601){return function(_0x43cb19){if(_0x43cb19){return _0x43cb19[_0xc5f7('0x2a')](_0x3fd013)['then'](function(_0x26d32a){return _0x26d32a;});}return null;};}function removeEntity(_0x5c55e2,_0x11d3f5){return function(_0x27eaef){if(_0x27eaef){return _0x27eaef[_0xc5f7('0x2b')]()[_0xc5f7('0x2c')](function(){_0x5c55e2[_0xc5f7('0x1e')](0xcc)[_0xc5f7('0x1f')]();});}};}function handleEntityNotFound(_0x284863,_0x376242){return function(_0x3f63c4){if(!_0x3f63c4){_0x284863[_0xc5f7('0x1d')](0x194);}return _0x3f63c4;};}function handleError(_0x3f8a7d,_0x3dfc64){_0x3dfc64=_0x3dfc64||0x1f4;return function(_0x2756b2){logger[_0xc5f7('0x2d')](_0x2756b2[_0xc5f7('0x2e')]);if(_0x2756b2[_0xc5f7('0x2f')]){delete _0x2756b2['name'];}_0x3f8a7d['status'](_0x3dfc64)[_0xc5f7('0x30')](_0x2756b2);};}exports[_0xc5f7('0x31')]=function(_0x316ab0,_0x12a03d){var _0xceb556={},_0x44749d={},_0x53bfc3={'count':0x0,'rows':[]};var _0x480ed6=_['map'](db[_0xc5f7('0x32')][_0xc5f7('0x33')],function(_0xdc5a64){return{'name':_0xdc5a64[_0xc5f7('0x34')],'type':_0xdc5a64[_0xc5f7('0x35')][_0xc5f7('0x36')]};});_0x44749d[_0xc5f7('0x37')]=_[_0xc5f7('0x38')](_0x480ed6,'name');_0x44749d[_0xc5f7('0x39')]=_[_0xc5f7('0x3a')](_0x316ab0[_0xc5f7('0x39')]);_0x44749d['filters']=_['intersection'](_0x44749d[_0xc5f7('0x37')],_0x44749d[_0xc5f7('0x39')]);_0xceb556[_0xc5f7('0x3b')]=_[_0xc5f7('0x3c')](_0x44749d[_0xc5f7('0x37')],qs[_0xc5f7('0x3d')](_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x3d')]));_0xceb556[_0xc5f7('0x3b')]=_0xceb556[_0xc5f7('0x3b')][_0xc5f7('0x3e')]?_0xceb556['attributes']:_0x44749d[_0xc5f7('0x37')];if(!_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x3f')](_0xc5f7('0x40'))){_0xceb556['limit']=qs[_0xc5f7('0x23')](_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x23')]);_0xceb556[_0xc5f7('0x22')]=qs[_0xc5f7('0x22')](_0x316ab0[_0xc5f7('0x39')]['offset']);}_0xceb556['order']=qs[_0xc5f7('0x41')](_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x41')]);_0xceb556[_0xc5f7('0x42')]=qs[_0xc5f7('0x43')](_[_0xc5f7('0x44')](_0x316ab0['query'],_0x44749d[_0xc5f7('0x43')]),_0x480ed6);if(_0x316ab0['query'][_0xc5f7('0x45')]){_0xceb556[_0xc5f7('0x42')]=_['merge'](_0xceb556[_0xc5f7('0x42')],{'$or':_['map'](_0x480ed6,function(_0x1b99c5){if(_0x1b99c5['type']!==_0xc5f7('0x46')){var _0x50e96e={};_0x50e96e[_0x1b99c5[_0xc5f7('0x2f')]]={'$like':'%'+_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x45')]+'%'};return _0x50e96e;}})});}_0xceb556=_[_0xc5f7('0x47')]({},_0xceb556,_0x316ab0[_0xc5f7('0x48')]);var _0x7f9ffc={'where':_0xceb556[_0xc5f7('0x42')]};return db[_0xc5f7('0x32')][_0xc5f7('0x21')](_0x7f9ffc)[_0xc5f7('0x2c')](function(_0x10488b){_0x53bfc3[_0xc5f7('0x21')]=_0x10488b;if(_0x316ab0[_0xc5f7('0x39')][_0xc5f7('0x49')]){_0xceb556['include']=[{'all':!![]}];}return db[_0xc5f7('0x32')][_0xc5f7('0x4a')](_0xceb556);})[_0xc5f7('0x2c')](function(_0x9defa8){_0x53bfc3[_0xc5f7('0x4b')]=_0x9defa8;return _0x53bfc3;})[_0xc5f7('0x2c')](respondWithFilteredResult(_0x12a03d,_0xceb556))['catch'](handleError(_0x12a03d,null));};exports[_0xc5f7('0x4c')]=function(_0xf47038,_0x3051e1){var _0xbb12c={'raw':!![],'where':{'id':_0xf47038[_0xc5f7('0x4d')]['id']}},_0x21662c={};_0x21662c['model']=_[_0xc5f7('0x3a')](db[_0xc5f7('0x32')][_0xc5f7('0x33')]);_0x21662c[_0xc5f7('0x39')]=_[_0xc5f7('0x3a')](_0xf47038[_0xc5f7('0x39')]);_0x21662c[_0xc5f7('0x43')]=_['intersection'](_0x21662c['model'],_0x21662c[_0xc5f7('0x39')]);_0xbb12c[_0xc5f7('0x3b')]=_['intersection'](_0x21662c[_0xc5f7('0x37')],qs[_0xc5f7('0x3d')](_0xf47038[_0xc5f7('0x39')][_0xc5f7('0x3d')]));_0xbb12c[_0xc5f7('0x3b')]=_0xbb12c[_0xc5f7('0x3b')]['length']?_0xbb12c[_0xc5f7('0x3b')]:_0x21662c['model'];if(_0xf47038[_0xc5f7('0x39')][_0xc5f7('0x49')]){_0xbb12c[_0xc5f7('0x4e')]=[{'all':!![]}];}_0xbb12c=_['merge']({},_0xbb12c,_0xf47038[_0xc5f7('0x48')]);return db[_0xc5f7('0x32')][_0xc5f7('0x4f')](_0xbb12c)['then'](handleEntityNotFound(_0x3051e1,null))[_0xc5f7('0x2c')](respondWithResult(_0x3051e1,null))[_0xc5f7('0x50')](handleError(_0x3051e1,null));};exports['create']=function(_0x18ec82,_0x433062){return db[_0xc5f7('0x32')][_0xc5f7('0x51')](_0x18ec82['body'],{})['then'](respondWithResult(_0x433062,0xc9))[_0xc5f7('0x50')](handleError(_0x433062,null));};exports[_0xc5f7('0x52')]=function(_0x7baa34,_0x4f002f){return db[_0xc5f7('0x32')][_0xc5f7('0x52')]()[_0xc5f7('0x2c')](respondWithResult(_0x4f002f,null))[_0xc5f7('0x50')](handleError(_0x4f002f,null));};exports[_0xc5f7('0x2a')]=function(_0x291f3e,_0x1243be){if(_0x291f3e[_0xc5f7('0x53')]['uniqueid']){delete _0x291f3e[_0xc5f7('0x53')]['uniqueid'];}return db[_0xc5f7('0x32')]['find']({'where':{'uniqueid':_0x291f3e['params']['id']}})[_0xc5f7('0x2c')](handleEntityNotFound(_0x1243be,null))[_0xc5f7('0x2c')](saveUpdates(_0x291f3e[_0xc5f7('0x53')],null))['then'](respondWithResult(_0x1243be,null))[_0xc5f7('0x50')](handleError(_0x1243be,null));}; \ No newline at end of file +var _0xa5ea=['fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','describe','update','uniqueid','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','CmHopperHistory','rawAttributes'];(function(_0xd385d,_0x13cd3a){var _0x283c87=function(_0xf5766d){while(--_0xf5766d){_0xd385d['push'](_0xd385d['shift']());}};_0x283c87(++_0x13cd3a);}(_0xa5ea,0x1e9));var _0xaa5e=function(_0x240b60,_0x389510){_0x240b60=_0x240b60-0x0;var _0x27cc82=_0xa5ea[_0x240b60];return _0x27cc82;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaa5e('0x0'));var jsonpatch=require(_0xaa5e('0x1'));var rp=require(_0xaa5e('0x2'));var moment=require('moment');var BPromise=require(_0xaa5e('0x3'));var Mustache=require(_0xaa5e('0x4'));var util=require(_0xaa5e('0x5'));var path=require(_0xaa5e('0x6'));var sox=require(_0xaa5e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa5e('0x8'));var _=require(_0xaa5e('0x9'));var squel=require(_0xaa5e('0xa'));var crypto=require(_0xaa5e('0xb'));var jsforce=require(_0xaa5e('0xc'));var deskjs=require(_0xaa5e('0xd'));var toCsv=require(_0xaa5e('0xe'));var querystring=require(_0xaa5e('0xf'));var Papa=require(_0xaa5e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaa5e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa5e('0x12'));var logger=require(_0xaa5e('0x13'))(_0xaa5e('0x14'));var utils=require(_0xaa5e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa5e('0x16'))['db'];function respondWithStatusCode(_0x423abc,_0x3e2a60){_0x3e2a60=_0x3e2a60||0xcc;return function(_0x147f52){if(_0x147f52){return _0x423abc[_0xaa5e('0x17')](_0x3e2a60);}return _0x423abc[_0xaa5e('0x18')](_0x3e2a60)['end']();};}function respondWithResult(_0x692efa,_0x19d478){_0x19d478=_0x19d478||0xc8;return function(_0x139657){if(_0x139657){return _0x692efa[_0xaa5e('0x18')](_0x19d478)[_0xaa5e('0x19')](_0x139657);}};}function respondWithFilteredResult(_0x40e2cd,_0x1d645f){return function(_0x365fe4){if(_0x365fe4){var _0x4a6bc9=typeof _0x1d645f[_0xaa5e('0x1a')]===_0xaa5e('0x1b')&&typeof _0x1d645f['limit']===_0xaa5e('0x1b');var _0x481bf7=_0x365fe4['count'];var _0x28e87c=_0x4a6bc9?0x0:_0x1d645f[_0xaa5e('0x1a')];var _0x3203f1=_0x4a6bc9?_0x365fe4[_0xaa5e('0x1c')]:_0x1d645f[_0xaa5e('0x1a')]+_0x1d645f[_0xaa5e('0x1d')];var _0x46417a;if(_0x3203f1>=_0x481bf7){_0x3203f1=_0x481bf7;_0x46417a=0xc8;}else{_0x46417a=0xce;}_0x40e2cd[_0xaa5e('0x18')](_0x46417a);return _0x40e2cd['set'](_0xaa5e('0x1e'),_0x28e87c+'-'+_0x3203f1+'/'+_0x481bf7)['json'](_0x365fe4);}return null;};}function patchUpdates(_0xe5449b){return function(_0x38585e){try{jsonpatch[_0xaa5e('0x1f')](_0x38585e,_0xe5449b,!![]);}catch(_0x370dee){return BPromise[_0xaa5e('0x20')](_0x370dee);}return _0x38585e[_0xaa5e('0x21')]();};}function saveUpdates(_0x3b21bf,_0x60d686){return function(_0x192792){if(_0x192792){return _0x192792['update'](_0x3b21bf)[_0xaa5e('0x22')](function(_0x32f099){return _0x32f099;});}return null;};}function removeEntity(_0xb5705e,_0x2f1786){return function(_0x215c67){if(_0x215c67){return _0x215c67[_0xaa5e('0x23')]()['then'](function(){_0xb5705e['status'](0xcc)[_0xaa5e('0x24')]();});}};}function handleEntityNotFound(_0x2cb824,_0x32f2e1){return function(_0x27b9ba){if(!_0x27b9ba){_0x2cb824['sendStatus'](0x194);}return _0x27b9ba;};}function handleError(_0x4d0f68,_0xd24f4c){_0xd24f4c=_0xd24f4c||0x1f4;return function(_0x443607){logger[_0xaa5e('0x25')](_0x443607['stack']);if(_0x443607[_0xaa5e('0x26')]){delete _0x443607['name'];}_0x4d0f68[_0xaa5e('0x18')](_0xd24f4c)[_0xaa5e('0x27')](_0x443607);};}exports[_0xaa5e('0x28')]=function(_0x3b1db7,_0x35cbf0){var _0x67301b={},_0x376be0={},_0x4821df={'count':0x0,'rows':[]};var _0x2b9e39=_['map'](db[_0xaa5e('0x29')][_0xaa5e('0x2a')],function(_0x50fd06){return{'name':_0x50fd06[_0xaa5e('0x2b')],'type':_0x50fd06[_0xaa5e('0x2c')][_0xaa5e('0x2d')]};});_0x376be0[_0xaa5e('0x2e')]=_[_0xaa5e('0x2f')](_0x2b9e39,_0xaa5e('0x26'));_0x376be0[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x3b1db7[_0xaa5e('0x30')]);_0x376be0[_0xaa5e('0x32')]=_['intersection'](_0x376be0[_0xaa5e('0x2e')],_0x376be0[_0xaa5e('0x30')]);_0x67301b[_0xaa5e('0x33')]=_['intersection'](_0x376be0['model'],qs[_0xaa5e('0x34')](_0x3b1db7[_0xaa5e('0x30')][_0xaa5e('0x34')]));_0x67301b[_0xaa5e('0x33')]=_0x67301b[_0xaa5e('0x33')]['length']?_0x67301b[_0xaa5e('0x33')]:_0x376be0[_0xaa5e('0x2e')];if(!_0x3b1db7[_0xaa5e('0x30')][_0xaa5e('0x35')](_0xaa5e('0x36'))){_0x67301b[_0xaa5e('0x1d')]=qs['limit'](_0x3b1db7[_0xaa5e('0x30')][_0xaa5e('0x1d')]);_0x67301b[_0xaa5e('0x1a')]=qs[_0xaa5e('0x1a')](_0x3b1db7['query'][_0xaa5e('0x1a')]);}_0x67301b[_0xaa5e('0x37')]=qs[_0xaa5e('0x38')](_0x3b1db7['query'][_0xaa5e('0x38')]);_0x67301b[_0xaa5e('0x39')]=qs[_0xaa5e('0x32')](_['pick'](_0x3b1db7['query'],_0x376be0[_0xaa5e('0x32')]),_0x2b9e39);if(_0x3b1db7[_0xaa5e('0x30')][_0xaa5e('0x3a')]){_0x67301b[_0xaa5e('0x39')]=_[_0xaa5e('0x3b')](_0x67301b[_0xaa5e('0x39')],{'$or':_['map'](_0x2b9e39,function(_0x450cd4){if(_0x450cd4[_0xaa5e('0x2c')]!=='VIRTUAL'){var _0x33acab={};_0x33acab[_0x450cd4[_0xaa5e('0x26')]]={'$like':'%'+_0x3b1db7[_0xaa5e('0x30')][_0xaa5e('0x3a')]+'%'};return _0x33acab;}})});}_0x67301b=_[_0xaa5e('0x3b')]({},_0x67301b,_0x3b1db7[_0xaa5e('0x3c')]);var _0x553997={'where':_0x67301b[_0xaa5e('0x39')]};return db[_0xaa5e('0x29')]['count'](_0x553997)[_0xaa5e('0x22')](function(_0x1f1c37){_0x4821df[_0xaa5e('0x1c')]=_0x1f1c37;if(_0x3b1db7['query'][_0xaa5e('0x3d')]){_0x67301b[_0xaa5e('0x3e')]=[{'all':!![]}];}return db[_0xaa5e('0x29')][_0xaa5e('0x3f')](_0x67301b);})[_0xaa5e('0x22')](function(_0xe4b6f0){_0x4821df[_0xaa5e('0x40')]=_0xe4b6f0;return _0x4821df;})[_0xaa5e('0x22')](respondWithFilteredResult(_0x35cbf0,_0x67301b))['catch'](handleError(_0x35cbf0,null));};exports[_0xaa5e('0x41')]=function(_0x5b6f3c,_0x4df90d){var _0x1af164={'raw':!![],'where':{'id':_0x5b6f3c[_0xaa5e('0x42')]['id']}},_0x4cf419={};_0x4cf419[_0xaa5e('0x2e')]=_[_0xaa5e('0x31')](db['CmHopperHistory'][_0xaa5e('0x2a')]);_0x4cf419[_0xaa5e('0x30')]=_[_0xaa5e('0x31')](_0x5b6f3c[_0xaa5e('0x30')]);_0x4cf419[_0xaa5e('0x32')]=_[_0xaa5e('0x43')](_0x4cf419[_0xaa5e('0x2e')],_0x4cf419[_0xaa5e('0x30')]);_0x1af164[_0xaa5e('0x33')]=_['intersection'](_0x4cf419[_0xaa5e('0x2e')],qs[_0xaa5e('0x34')](_0x5b6f3c['query'][_0xaa5e('0x34')]));_0x1af164[_0xaa5e('0x33')]=_0x1af164[_0xaa5e('0x33')][_0xaa5e('0x44')]?_0x1af164[_0xaa5e('0x33')]:_0x4cf419[_0xaa5e('0x2e')];if(_0x5b6f3c[_0xaa5e('0x30')]['includeAll']){_0x1af164[_0xaa5e('0x3e')]=[{'all':!![]}];}_0x1af164=_['merge']({},_0x1af164,_0x5b6f3c['options']);return db[_0xaa5e('0x29')][_0xaa5e('0x45')](_0x1af164)['then'](handleEntityNotFound(_0x4df90d,null))[_0xaa5e('0x22')](respondWithResult(_0x4df90d,null))[_0xaa5e('0x46')](handleError(_0x4df90d,null));};exports['create']=function(_0x4075a3,_0x1611e3){return db[_0xaa5e('0x29')][_0xaa5e('0x47')](_0x4075a3[_0xaa5e('0x48')],{})['then'](respondWithResult(_0x1611e3,0xc9))[_0xaa5e('0x46')](handleError(_0x1611e3,null));};exports[_0xaa5e('0x49')]=function(_0x30667e,_0x25df16){return db[_0xaa5e('0x29')][_0xaa5e('0x49')]()[_0xaa5e('0x22')](respondWithResult(_0x25df16,null))[_0xaa5e('0x46')](handleError(_0x25df16,null));};exports[_0xaa5e('0x4a')]=function(_0x4280d3,_0x3bc1ab){if(_0x4280d3[_0xaa5e('0x48')]['uniqueid']){delete _0x4280d3[_0xaa5e('0x48')][_0xaa5e('0x4b')];}return db[_0xaa5e('0x29')][_0xaa5e('0x45')]({'where':{'uniqueid':_0x4280d3['params']['id']}})[_0xaa5e('0x22')](handleEntityNotFound(_0x3bc1ab,null))[_0xaa5e('0x22')](saveUpdates(_0x4280d3[_0xaa5e('0x48')],null))['then'](respondWithResult(_0x3bc1ab,null))['catch'](handleError(_0x3bc1ab,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 227f29b..54708ed 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 _0x87bc=['uniqueid','lodash','util','api','request-promise','rimraf','define','endtime'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x87bc,0x189));var _0xc87b=function(_0x492adf,_0x288d7c){_0x492adf=_0x492adf-0x0;var _0x4090b4=_0x87bc[_0x492adf];return _0x4090b4;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var logger=require('../../config/logger')(_0xc87b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc87b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc87b('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1a2172,_0x1dfa75){return _0x1a2172[_0xc87b('0x5')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0xc87b('0x6')]},{'name':_0xc87b('0x7'),'fields':[_0xc87b('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf92=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','api'];(function(_0x42d8e8,_0xbaef58){var _0x5f196d=function(_0x412670){while(--_0x412670){_0x42d8e8['push'](_0x42d8e8['shift']());}};_0x5f196d(++_0xbaef58);}(_0xdf92,0x10c));var _0x2df9=function(_0xc6d8b4,_0x3c47a5){_0xc6d8b4=_0xc6d8b4-0x0;var _0x123fc4=_0xdf92[_0xc6d8b4];return _0x123fc4;};'use strict';var _=require(_0x2df9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2df9('0x1'));var moment=require(_0x2df9('0x2'));var BPromise=require(_0x2df9('0x3'));var rp=require(_0x2df9('0x4'));var fs=require('fs');var path=require(_0x2df9('0x5'));var rimraf=require(_0x2df9('0x6'));var config=require(_0x2df9('0x7'));var attributes=require(_0x2df9('0x8'));module[_0x2df9('0x9')]=function(_0x125317,_0x5b6e79){return _0x125317[_0x2df9('0xa')](_0x2df9('0xb'),attributes,{'tableName':_0x2df9('0xc'),'paranoid':![],'indexes':[{'name':_0x2df9('0xd'),'fields':[_0x2df9('0xd')]},{'name':'uniqueid','fields':[_0x2df9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 41a453d..c3cd93e 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 _0xea85=['CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4abfc3,_0x5478e9){var _0x193333=function(_0x527b7d){while(--_0x527b7d){_0x4abfc3['push'](_0x4abfc3['shift']());}};_0x193333(++_0x5478e9);}(_0xea85,0x1cd));var _0x5ea8=function(_0x44714a,_0x511d1b){_0x44714a=_0x44714a-0x0;var _0x3b3c78=_0xea85[_0x44714a];return _0x3b3c78;};'use strict';var _=require(_0x5ea8('0x0'));var util=require('util');var moment=require(_0x5ea8('0x1'));var BPromise=require(_0x5ea8('0x2'));var rs=require(_0x5ea8('0x3'));var fs=require('fs');var Redis=require(_0x5ea8('0x4'));var db=require(_0x5ea8('0x5'))['db'];var utils=require(_0x5ea8('0x6'));var logger=require(_0x5ea8('0x7'))(_0x5ea8('0x8'));var config=require(_0x5ea8('0x9'));var jayson=require(_0x5ea8('0xa'));var client=jayson[_0x5ea8('0xb')][_0x5ea8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x322848,_0x25aa3c,_0xa604ff){return new BPromise(function(_0x53baa9,_0x27938b){return client[_0x5ea8('0xd')](_0x322848,_0xa604ff)[_0x5ea8('0xe')](function(_0x16d173){logger['info'](_0x5ea8('0xf'),_0x25aa3c,_0x5ea8('0x10'));logger[_0x5ea8('0x11')](_0x5ea8('0x12'),_0x25aa3c,_0x5ea8('0x10'),JSON[_0x5ea8('0x13')](_0x16d173));if(_0x16d173[_0x5ea8('0x14')]){if(_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x15')]===0x1f4){logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x16d173['error'][_0x5ea8('0x16')]);return _0x27938b(_0x16d173['error'][_0x5ea8('0x16')]);}logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x16')]);return _0x53baa9(_0x16d173[_0x5ea8('0x14')][_0x5ea8('0x16')]);}else{logger[_0x5ea8('0x17')](_0x5ea8('0xf'),_0x25aa3c,_0x5ea8('0x10'));_0x53baa9(_0x16d173['result']['message']);}})[_0x5ea8('0x18')](function(_0x28a8b0){logger[_0x5ea8('0x14')](_0x5ea8('0xf'),_0x25aa3c,_0x28a8b0);_0x27938b(_0x28a8b0);});});}exports[_0x5ea8('0x19')]=function(_0x39e233){var _0x33fbe3=this;return new Promise(function(_0x5955e8,_0x2a8be0){return db[_0x5ea8('0x1a')]['create'](_0x39e233[_0x5ea8('0x1b')],{'raw':_0x39e233[_0x5ea8('0x1c')]?_0x39e233['options'][_0x5ea8('0x1d')]===undefined?!![]:![]:!![]})[_0x5ea8('0xe')](function(_0x27a9fb){logger['info'](_0x5ea8('0x19'),_0x39e233);logger[_0x5ea8('0x11')](_0x5ea8('0x19'),_0x39e233,JSON[_0x5ea8('0x13')](_0x27a9fb));_0x5955e8(_0x27a9fb);})[_0x5ea8('0x18')](function(_0x1d35f2){logger[_0x5ea8('0x14')](_0x5ea8('0x19'),_0x1d35f2[_0x5ea8('0x16')],_0x39e233);_0x2a8be0(_0x33fbe3[_0x5ea8('0x14')](0x1f4,_0x1d35f2['message']));});});};exports[_0x5ea8('0x1e')]=function(_0x4d13e8){var _0x3d5735=this;return new Promise(function(_0x15543c,_0x56816c){return db[_0x5ea8('0x1a')][_0x5ea8('0x1f')]({'raw':_0x4d13e8[_0x5ea8('0x1c')]?_0x4d13e8[_0x5ea8('0x1c')][_0x5ea8('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d13e8['options']?_0x4d13e8[_0x5ea8('0x1c')][_0x5ea8('0x20')]||null:null,'attributes':[[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')][_0x5ea8('0x23')]('id')),_0x5ea8('0x24')],[db[_0x5ea8('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db['sequelize'][_0x5ea8('0x25')](_0x5ea8('0x26')))),_0x5ea8('0x27')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x28')))),_0x5ea8('0x29')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x2a'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x5ea8('0x2a'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5ea8('0x2b')]]})[_0x5ea8('0xe')](function(_0x46ab80){logger['info']('AvgHandleTime',_0x4d13e8);logger[_0x5ea8('0x11')](_0x5ea8('0x1e'),_0x4d13e8,JSON['stringify'](_0x46ab80));_0x15543c(_0x46ab80);})[_0x5ea8('0x18')](function(_0x2043f7){logger['error'](_0x5ea8('0x1e'),_0x2043f7[_0x5ea8('0x16')],_0x4d13e8);_0x56816c(_0x3d5735[_0x5ea8('0x14')](0x1f4,_0x2043f7[_0x5ea8('0x16')]));});});};exports[_0x5ea8('0x2c')]=function(_0x506434){var _0x5cd6ad=this;return new Promise(function(_0x26cce2,_0x4b6f75){return db[_0x5ea8('0x1a')][_0x5ea8('0x1f')]({'raw':_0x506434['options']?_0x506434[_0x5ea8('0x1c')][_0x5ea8('0x1d')]===undefined?!![]:![]:!![],'where':_0x506434[_0x5ea8('0x1c')]?_0x506434[_0x5ea8('0x1c')][_0x5ea8('0x20')]||null:null,'attributes':[['campaign',_0x5ea8('0x2d')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0x5ea8('0x2e')],[db[_0x5ea8('0x21')]['fn']('COUNT',db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x2f')))),'outboundNoAnswerCallsDay'],[db[_0x5ea8('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x30')))),_0x5ea8('0x31')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x205,\x201,\x20null'))),_0x5ea8('0x32')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')]['literal'](_0x5ea8('0x33')))),_0x5ea8('0x34')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5ea8('0x35')],[db[_0x5ea8('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x36')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn'](_0x5ea8('0x22'),db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x37')))),_0x5ea8('0x38')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db['sequelize']['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')]('`state`\x20=\x2013,\x201,\x20null'))),_0x5ea8('0x39')],[db['sequelize']['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x3a')))),_0x5ea8('0x3b')],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x3c')))),_0x5ea8('0x3d')],[db['sequelize']['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['fn']('IF',db['sequelize'][_0x5ea8('0x25')](_0x5ea8('0x3e')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x3f')))),_0x5ea8('0x3d')],[db[_0x5ea8('0x21')]['fn']('COUNT',db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x40')))),'outboundReCallsDay']],'group':[_0x5ea8('0x41')]})['then'](function(_0x310fee){logger[_0x5ea8('0x17')](_0x5ea8('0x2c'),_0x506434);logger[_0x5ea8('0x11')](_0x5ea8('0x2c'),_0x506434,JSON[_0x5ea8('0x13')](_0x310fee));_0x26cce2(_0x310fee);})['catch'](function(_0x5f188d){logger[_0x5ea8('0x14')](_0x5ea8('0x2c'),_0x5f188d[_0x5ea8('0x16')],_0x506434);_0x4b6f75(_0x5cd6ad['error'](0x1f4,_0x5f188d[_0x5ea8('0x16')]));});});};exports[_0x5ea8('0x42')]=function(_0x34ba53){var _0x311708=this;return new Promise(function(_0x411e00,_0x77112f){return db[_0x5ea8('0x1a')][_0x5ea8('0x1f')]({'raw':_0x34ba53['options']?_0x34ba53[_0x5ea8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x34ba53[_0x5ea8('0x1c')]?_0x34ba53['options'][_0x5ea8('0x20')]||null:null,'attributes':[[_0x5ea8('0x41'),'name'],[db[_0x5ea8('0x21')]['fn'](_0x5ea8('0x22'),db[_0x5ea8('0x21')]['col']('id')),_0x5ea8('0x43')],[db[_0x5ea8('0x21')]['fn']('COUNT',db[_0x5ea8('0x21')]['fn']('IF',db[_0x5ea8('0x21')][_0x5ea8('0x25')](_0x5ea8('0x30')))),'ivrAnswerCallsDay']],'group':[_0x5ea8('0x41')]})[_0x5ea8('0xe')](function(_0x181f2a){logger[_0x5ea8('0x17')](_0x5ea8('0x42'),_0x34ba53);logger[_0x5ea8('0x11')](_0x5ea8('0x42'),_0x34ba53,JSON[_0x5ea8('0x13')](_0x181f2a));_0x411e00(_0x181f2a);})[_0x5ea8('0x18')](function(_0x53f6f6){logger[_0x5ea8('0x14')](_0x5ea8('0x42'),_0x53f6f6[_0x5ea8('0x16')],_0x34ba53);_0x77112f(_0x311708[_0x5ea8('0x14')](0x1f4,_0x53f6f6[_0x5ea8('0x16')]));});});}; \ No newline at end of file +var _0x97a2=['predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','campaign','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','name','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x1901b8,_0x1efe6f){var _0x4ca85f=function(_0x383ca3){while(--_0x383ca3){_0x1901b8['push'](_0x1901b8['shift']());}};_0x4ca85f(++_0x1efe6f);}(_0x97a2,0x1b1));var _0x297a=function(_0x2be764,_0x488c4f){_0x2be764=_0x2be764-0x0;var _0x5c0f77=_0x97a2[_0x2be764];return _0x5c0f77;};'use strict';var _=require(_0x297a('0x0'));var util=require('util');var moment=require(_0x297a('0x1'));var BPromise=require(_0x297a('0x2'));var rs=require(_0x297a('0x3'));var fs=require('fs');var Redis=require(_0x297a('0x4'));var db=require(_0x297a('0x5'))['db'];var utils=require(_0x297a('0x6'));var logger=require(_0x297a('0x7'))(_0x297a('0x8'));var config=require('../../config/environment');var jayson=require(_0x297a('0x9'));var client=jayson[_0x297a('0xa')][_0x297a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8cbc92,_0x43a7d7,_0x3d9c6a){return new BPromise(function(_0x5ab57b,_0x38b066){return client[_0x297a('0xc')](_0x8cbc92,_0x3d9c6a)[_0x297a('0xd')](function(_0xbf6378){logger[_0x297a('0xe')](_0x297a('0xf'),_0x43a7d7,'request\x20sent');logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'),JSON[_0x297a('0x11')](_0xbf6378));if(_0xbf6378[_0x297a('0x12')]){if(_0xbf6378[_0x297a('0x12')]['code']===0x1f4){logger[_0x297a('0x12')](_0x297a('0xf'),_0x43a7d7,_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);return _0x38b066(_0xbf6378[_0x297a('0x12')][_0x297a('0x13')]);}logger[_0x297a('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x43a7d7,_0xbf6378['error'][_0x297a('0x13')]);return _0x5ab57b(_0xbf6378['error'][_0x297a('0x13')]);}else{logger[_0x297a('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x43a7d7,_0x297a('0x10'));_0x5ab57b(_0xbf6378[_0x297a('0x14')]['message']);}})[_0x297a('0x15')](function(_0x333868){logger[_0x297a('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x43a7d7,_0x333868);_0x38b066(_0x333868);});});}exports[_0x297a('0x16')]=function(_0x3af847){var _0x29c6d6=this;return new Promise(function(_0x4d6194,_0xba3b73){return db[_0x297a('0x17')]['create'](_0x3af847[_0x297a('0x18')],{'raw':_0x3af847[_0x297a('0x19')]?_0x3af847[_0x297a('0x19')][_0x297a('0x1a')]===undefined?!![]:![]:!![]})[_0x297a('0xd')](function(_0xde6d1c){logger[_0x297a('0xe')](_0x297a('0x16'),_0x3af847);logger[_0x297a('0x1b')](_0x297a('0x16'),_0x3af847,JSON[_0x297a('0x11')](_0xde6d1c));_0x4d6194(_0xde6d1c);})[_0x297a('0x15')](function(_0x481f59){logger['error']('CreateCmHopperHistory',_0x481f59[_0x297a('0x13')],_0x3af847);_0xba3b73(_0x29c6d6[_0x297a('0x12')](0x1f4,_0x481f59['message']));});});};exports[_0x297a('0x1c')]=function(_0x40919d){var _0x2de036=this;return new Promise(function(_0x1cfe08,_0x519f3b){return db[_0x297a('0x17')][_0x297a('0x1d')]({'raw':_0x40919d[_0x297a('0x19')]?_0x40919d['options'][_0x297a('0x1a')]===undefined?!![]:![]:!![],'where':_0x40919d[_0x297a('0x19')]?_0x40919d[_0x297a('0x19')][_0x297a('0x1e')]||null:null,'attributes':[[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')][_0x297a('0x21')]('id')),_0x297a('0x22')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db['sequelize']['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x24')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x25')))),_0x297a('0x26')],[db['sequelize']['fn']('COUNT',db[_0x297a('0x1f')]['fn']('IF',db['sequelize'][_0x297a('0x23')](_0x297a('0x27')))),_0x297a('0x28')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x29'),db['sequelize']['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x2a')))),_0x297a('0x2b')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x29'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x297a('0x2c')]]})['then'](function(_0x399b37){logger[_0x297a('0xe')](_0x297a('0x1c'),_0x40919d);logger[_0x297a('0x1b')]('AvgHandleTime',_0x40919d,JSON[_0x297a('0x11')](_0x399b37));_0x1cfe08(_0x399b37);})['catch'](function(_0x100723){logger[_0x297a('0x12')]('AvgHandleTime',_0x100723[_0x297a('0x13')],_0x40919d);_0x519f3b(_0x2de036[_0x297a('0x12')](0x1f4,_0x100723[_0x297a('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x4a17ee){var _0x1fd3b4=this;return new Promise(function(_0x2aa6f9,_0x22e365){return db['CmHopperHistory'][_0x297a('0x1d')]({'raw':_0x4a17ee[_0x297a('0x19')]?_0x4a17ee[_0x297a('0x19')][_0x297a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a17ee[_0x297a('0x19')]?_0x4a17ee[_0x297a('0x19')]['where']||null:null,'attributes':[[_0x297a('0x2d'),'name'],[db[_0x297a('0x1f')]['fn']('COUNT',db[_0x297a('0x1f')]['fn']('IF',db['sequelize'][_0x297a('0x23')]('`state`\x20=\x200,\x201,\x20null'))),_0x297a('0x2e')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x297a('0x23')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db['sequelize'][_0x297a('0x23')](_0x297a('0x24')))),_0x297a('0x2f')],[db['sequelize']['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x30')))),'outboundBusyCallsDay'],[db[_0x297a('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x297a('0x23')](_0x297a('0x31')))),_0x297a('0x32')],[db['sequelize']['fn'](_0x297a('0x20'),db['sequelize']['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x33')))),_0x297a('0x34')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db['sequelize']['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x297a('0x35')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')]['literal'](_0x297a('0x36')))),_0x297a('0x37')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x38')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x297a('0x39')))),_0x297a('0x3a')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db['sequelize']['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x3b')))),_0x297a('0x3c')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0x297a('0x3c')],[db[_0x297a('0x1f')]['fn'](_0x297a('0x20'),db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x3e')))),_0x297a('0x3f')]],'group':[_0x297a('0x2d')]})['then'](function(_0x3d1bfd){logger[_0x297a('0xe')](_0x297a('0x40'),_0x4a17ee);logger[_0x297a('0x1b')](_0x297a('0x40'),_0x4a17ee,JSON[_0x297a('0x11')](_0x3d1bfd));_0x2aa6f9(_0x3d1bfd);})['catch'](function(_0x5f32f5){logger[_0x297a('0x12')](_0x297a('0x40'),_0x5f32f5[_0x297a('0x13')],_0x4a17ee);_0x22e365(_0x1fd3b4[_0x297a('0x12')](0x1f4,_0x5f32f5['message']));});});};exports['GetCampaignHopperHistory']=function(_0x38585b){var _0x22eb86=this;return new Promise(function(_0x149b75,_0x7f8313){return db[_0x297a('0x17')][_0x297a('0x1d')]({'raw':_0x38585b[_0x297a('0x19')]?_0x38585b['options']['raw']===undefined?!![]:![]:!![],'where':_0x38585b[_0x297a('0x19')]?_0x38585b['options']['where']||null:null,'attributes':[['campaign',_0x297a('0x41')],[db['sequelize']['fn'](_0x297a('0x20'),db[_0x297a('0x1f')][_0x297a('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn']('COUNT',db[_0x297a('0x1f')]['fn']('IF',db[_0x297a('0x1f')][_0x297a('0x23')](_0x297a('0x24')))),_0x297a('0x42')]],'group':['campaign']})['then'](function(_0x3530df){logger[_0x297a('0xe')]('GetCampaignHopperHistory',_0x38585b);logger[_0x297a('0x1b')](_0x297a('0x43'),_0x38585b,JSON[_0x297a('0x11')](_0x3530df));_0x149b75(_0x3530df);})[_0x297a('0x15')](function(_0x222d1d){logger[_0x297a('0x12')]('GetCampaignHopperHistory',_0x222d1d['message'],_0x38585b);_0x7f8313(_0x22eb86[_0x297a('0x12')](0x1f4,_0x222d1d[_0x297a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b14aac7..6819aba 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 _0xf0c9=['show','post','create','update','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','/describe','isAuthenticated','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf0c9,0x104));var _0x9f0c=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0xf0c9[_0x46ae5a];return _0x434986;};'use strict';var multer=require(_0x9f0c('0x0'));var util=require('util');var path=require(_0x9f0c('0x1'));var timeout=require(_0x9f0c('0x2'));var express=require(_0x9f0c('0x3'));var router=express['Router']();var fs_extra=require(_0x9f0c('0x4'));var auth=require(_0x9f0c('0x5'));var interaction=require(_0x9f0c('0x6'));var config=require('../../config/environment');var controller=require(_0x9f0c('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9f0c('0x8')](_0x9f0c('0x9'),auth[_0x9f0c('0xa')](),controller['describe']);router[_0x9f0c('0x8')](_0x9f0c('0xb'),auth[_0x9f0c('0xa')](),controller[_0x9f0c('0xc')]);router[_0x9f0c('0xd')]('/',auth[_0x9f0c('0xa')](),controller[_0x9f0c('0xe')]);router['put'](_0x9f0c('0xb'),auth[_0x9f0c('0xa')](),controller[_0x9f0c('0xf')]);module[_0x9f0c('0x10')]=router; \ No newline at end of file +var _0x005d=['isAuthenticated','show','post','create','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe'];(function(_0x4ea852,_0x348402){var _0x5562f1=function(_0x40ba65){while(--_0x40ba65){_0x4ea852['push'](_0x4ea852['shift']());}};_0x5562f1(++_0x348402);}(_0x005d,0x138));var _0xd005=function(_0xe4dd6d,_0x3f809d){_0xe4dd6d=_0xe4dd6d-0x0;var _0x2720e4=_0x005d[_0xe4dd6d];return _0x2720e4;};'use strict';var multer=require('multer');var util=require(_0xd005('0x0'));var path=require(_0xd005('0x1'));var timeout=require(_0xd005('0x2'));var express=require(_0xd005('0x3'));var router=express[_0xd005('0x4')]();var fs_extra=require(_0xd005('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd005('0x6'));var config=require(_0xd005('0x7'));var controller=require(_0xd005('0x8'));router[_0xd005('0x9')]('/',auth['isAuthenticated'](),controller[_0xd005('0xa')]);router[_0xd005('0x9')](_0xd005('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xd005('0x9')]('/:id',auth[_0xd005('0xc')](),controller[_0xd005('0xd')]);router[_0xd005('0xe')]('/',auth[_0xd005('0xc')](),controller[_0xd005('0xf')]);router['put'](_0xd005('0x10'),auth['isAuthenticated'](),controller['update']);module[_0xd005('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e6be116..e1b3db1 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 _0x8fed=['name','STRING'];(function(_0x121563,_0xbd9d51){var _0x5067ef=function(_0x21ecfc){while(--_0x21ecfc){_0x121563['push'](_0x121563['shift']());}};_0x5067ef(++_0xbd9d51);}(_0x8fed,0xf5));var _0xd8fe=function(_0x2584d6,_0xc997c0){_0x2584d6=_0x2584d6-0x0;var _0x1121cd=_0x8fed[_0x2584d6];return _0x1121cd;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd8fe('0x0')],'unique':_0xd8fe('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8fe('0x0')]},'dialPrefix':{'type':Sequelize[_0xd8fe('0x0')]}}; \ No newline at end of file +var _0x79a8=['STRING','name','sequelize'];(function(_0x221a21,_0x39f7ef){var _0x32ed05=function(_0x4132eb){while(--_0x4132eb){_0x221a21['push'](_0x221a21['shift']());}};_0x32ed05(++_0x39f7ef);}(_0x79a8,0x1d0));var _0x879a=function(_0x5d9c37,_0x518b93){_0x5d9c37=_0x5d9c37-0x0;var _0x1ba9eb=_0x79a8[_0x5d9c37];return _0x1ba9eb;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'name':{'type':Sequelize[_0x879a('0x1')],'unique':_0x879a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x879a('0x1')]},'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 457de8c..dc2e79c 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 _0x264e=['where','pick','filter','options','includeAll','findAll','show','keys','merge','find','catch','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','params','describe','getDispositions','findOne','Disposition','hasOwnProperty','ListId','rows','removeDispositions','ids','CmContact','tags','join','each','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','BOOLEAN','defaultValue','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','Lists','UserProfileResource','then','sendStatus','name','send','map','CmList','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort'];(function(_0x2c5714,_0x3abac3){var _0x5c30bc=function(_0xabb5d1){while(--_0xabb5d1){_0x2c5714['push'](_0x2c5714['shift']());}};_0x5c30bc(++_0x3abac3);}(_0x264e,0xd2));var _0xe264=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x264e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xe264('0x0'));var rimraf=require(_0xe264('0x1'));var zipdir=require(_0xe264('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe264('0x3'));var moment=require(_0xe264('0x4'));var BPromise=require(_0xe264('0x5'));var Mustache=require(_0xe264('0x6'));var util=require(_0xe264('0x7'));var path=require(_0xe264('0x8'));var sox=require(_0xe264('0x9'));var csv=require(_0xe264('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe264('0xb'));var squel=require('squel');var crypto=require(_0xe264('0xc'));var jsforce=require(_0xe264('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe264('0xa'));var querystring=require(_0xe264('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe264('0xf'));var as=require(_0xe264('0x10'));var hardwareService=require(_0xe264('0x11'));var logger=require(_0xe264('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe264('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe264('0x14'))['db'];config[_0xe264('0x15')]=_[_0xe264('0x16')](config[_0xe264('0x15')],{'host':_0xe264('0x17'),'port':0x18eb});var socket=require(_0xe264('0x18'))(new Redis(config[_0xe264('0x15')]));require(_0xe264('0x19'))[_0xe264('0x1a')](socket);function respondWithStatusCode(_0x5874ba,_0x3ff493){_0x3ff493=_0x3ff493||0xcc;return function(_0x376be9){if(_0x376be9){return _0x5874ba['sendStatus'](_0x3ff493);}return _0x5874ba[_0xe264('0x1b')](_0x3ff493)[_0xe264('0x1c')]();};}function respondWithResult(_0x1874b1,_0x5d2744){_0x5d2744=_0x5d2744||0xc8;return function(_0x54e7b9){if(_0x54e7b9){return _0x1874b1['status'](_0x5d2744)[_0xe264('0x1d')](_0x54e7b9);}};}function respondWithFilteredResult(_0x1ec5fb,_0x11de7f){return function(_0x94540c){if(_0x94540c){var _0x3db05e=typeof _0x11de7f[_0xe264('0x1e')]===_0xe264('0x1f')&&typeof _0x11de7f[_0xe264('0x20')]===_0xe264('0x1f');var _0x36e334=_0x94540c[_0xe264('0x21')];var _0x54d3c5=_0x3db05e?0x0:_0x11de7f[_0xe264('0x1e')];var _0x2c8d4c=_0x3db05e?_0x94540c['count']:_0x11de7f[_0xe264('0x1e')]+_0x11de7f['limit'];var _0x4348b6;if(_0x2c8d4c>=_0x36e334){_0x2c8d4c=_0x36e334;_0x4348b6=0xc8;}else{_0x4348b6=0xce;}_0x1ec5fb[_0xe264('0x1b')](_0x4348b6);return _0x1ec5fb['set'](_0xe264('0x22'),_0x54d3c5+'-'+_0x2c8d4c+'/'+_0x36e334)[_0xe264('0x1d')](_0x94540c);}return null;};}function patchUpdates(_0x19b34a){return function(_0x17955a){try{jsonpatch[_0xe264('0x23')](_0x17955a,_0x19b34a,!![]);}catch(_0x3ab3ce){return BPromise['reject'](_0x3ab3ce);}return _0x17955a[_0xe264('0x24')]();};}function saveUpdates(_0x5aeb3e,_0x4c2606){return function(_0xa708fd){if(_0xa708fd){return _0xa708fd[_0xe264('0x25')](_0x5aeb3e)['then'](function(_0x6aa641){return _0x6aa641;});}return null;};}function removeEntity(_0x28aeec,_0x23ffc7){return function(_0x4768c6){if(_0x4768c6){return _0x4768c6[_0xe264('0x26')]()['then'](function(){var _0x534ed6=_0x4768c6[_0xe264('0x27')]({'plain':!![]});var _0x50ef30=_0xe264('0x28');return db[_0xe264('0x29')][_0xe264('0x26')]({'where':{'type':_0x50ef30,'resourceId':_0x534ed6['id']}})[_0xe264('0x2a')](function(){return _0x4768c6;});})['then'](function(){_0x28aeec[_0xe264('0x1b')](0xcc)[_0xe264('0x1c')]();});}};}function handleEntityNotFound(_0x4f9297,_0xe8f274){return function(_0x2bcda6){if(!_0x2bcda6){_0x4f9297[_0xe264('0x2b')](0x194);}return _0x2bcda6;};}function handleError(_0x196516,_0x2b72c9){_0x2b72c9=_0x2b72c9||0x1f4;return function(_0x1611b9){logger['error'](_0x1611b9['stack']);if(_0x1611b9[_0xe264('0x2c')]){delete _0x1611b9[_0xe264('0x2c')];}_0x196516[_0xe264('0x1b')](_0x2b72c9)[_0xe264('0x2d')](_0x1611b9);};}exports['index']=function(_0x5a8433,_0x21ece6){var _0x93c8={},_0x33568a={},_0x5d0541={'count':0x0,'rows':[]};var _0x20973e=_[_0xe264('0x2e')](db[_0xe264('0x2f')][_0xe264('0x30')],function(_0x4c45bf){return{'name':_0x4c45bf[_0xe264('0x31')],'type':_0x4c45bf[_0xe264('0x32')][_0xe264('0x33')]};});_0x33568a['model']=_[_0xe264('0x2e')](_0x20973e,_0xe264('0x2c'));_0x33568a[_0xe264('0x34')]=_['keys'](_0x5a8433[_0xe264('0x34')]);_0x33568a[_0xe264('0x35')]=_[_0xe264('0x36')](_0x33568a[_0xe264('0x37')],_0x33568a['query']);_0x93c8[_0xe264('0x38')]=_[_0xe264('0x36')](_0x33568a[_0xe264('0x37')],qs[_0xe264('0x39')](_0x5a8433[_0xe264('0x34')]['fields']));_0x93c8['attributes']=_0x93c8['attributes'][_0xe264('0x3a')]?_0x93c8['attributes']:_0x33568a['model'];if(!_0x5a8433['query']['hasOwnProperty'](_0xe264('0x3b'))){_0x93c8['limit']=qs[_0xe264('0x20')](_0x5a8433['query'][_0xe264('0x20')]);_0x93c8[_0xe264('0x1e')]=qs[_0xe264('0x1e')](_0x5a8433[_0xe264('0x34')][_0xe264('0x1e')]);}_0x93c8[_0xe264('0x3c')]=qs[_0xe264('0x3d')](_0x5a8433[_0xe264('0x34')][_0xe264('0x3d')]);_0x93c8[_0xe264('0x3e')]=qs[_0xe264('0x35')](_[_0xe264('0x3f')](_0x5a8433[_0xe264('0x34')],_0x33568a[_0xe264('0x35')]),_0x20973e);if(_0x5a8433[_0xe264('0x34')][_0xe264('0x40')]){_0x93c8[_0xe264('0x3e')]=_['merge'](_0x93c8[_0xe264('0x3e')],{'$or':_[_0xe264('0x2e')](_0x20973e,function(_0x341792){if(_0x341792[_0xe264('0x32')]!=='VIRTUAL'){var _0x1a6954={};_0x1a6954[_0x341792['name']]={'$like':'%'+_0x5a8433[_0xe264('0x34')]['filter']+'%'};return _0x1a6954;}})});}_0x93c8=_['merge']({},_0x93c8,_0x5a8433[_0xe264('0x41')]);var _0xeefdec={'where':_0x93c8[_0xe264('0x3e')]};return db['CmList'][_0xe264('0x21')](_0xeefdec)['then'](function(_0x4e8f99){_0x5d0541[_0xe264('0x21')]=_0x4e8f99;if(_0x5a8433[_0xe264('0x34')][_0xe264('0x42')]){_0x93c8['include']=[{'all':!![]}];}return db[_0xe264('0x2f')][_0xe264('0x43')](_0x93c8);})[_0xe264('0x2a')](function(_0x249f7c){_0x5d0541['rows']=_0x249f7c;return _0x5d0541;})[_0xe264('0x2a')](respondWithFilteredResult(_0x21ece6,_0x93c8))['catch'](handleError(_0x21ece6,null));};exports[_0xe264('0x44')]=function(_0x360905,_0x337c30){var _0x12771f={'raw':![],'where':{'id':_0x360905['params']['id']}},_0x592962={};_0x592962[_0xe264('0x37')]=_[_0xe264('0x45')](db['CmList']['rawAttributes']);_0x592962['query']=_[_0xe264('0x45')](_0x360905[_0xe264('0x34')]);_0x592962[_0xe264('0x35')]=_[_0xe264('0x36')](_0x592962[_0xe264('0x37')],_0x592962[_0xe264('0x34')]);_0x12771f['attributes']=_[_0xe264('0x36')](_0x592962[_0xe264('0x37')],qs[_0xe264('0x39')](_0x360905[_0xe264('0x34')][_0xe264('0x39')]));_0x12771f[_0xe264('0x38')]=_0x12771f[_0xe264('0x38')][_0xe264('0x3a')]?_0x12771f[_0xe264('0x38')]:_0x592962[_0xe264('0x37')];if(_0x360905[_0xe264('0x34')][_0xe264('0x42')]){_0x12771f['include']=[{'all':!![]}];}_0x12771f=_[_0xe264('0x46')]({},_0x12771f,_0x360905[_0xe264('0x41')]);return db[_0xe264('0x2f')][_0xe264('0x47')](_0x12771f)[_0xe264('0x2a')](handleEntityNotFound(_0x337c30,null))[_0xe264('0x2a')](respondWithResult(_0x337c30,null))[_0xe264('0x48')](handleError(_0x337c30,null));};exports['create']=function(_0x398243,_0x3c3dbf){return db[_0xe264('0x2f')]['create'](_0x398243[_0xe264('0x49')],{})[_0xe264('0x2a')](function(_0x185695){var _0x5f4704=_0x398243['user'][_0xe264('0x27')]({'plain':!![]});if(!_0x5f4704)throw new Error(_0xe264('0x4a'));if(_0x5f4704['role']===_0xe264('0x4b')){var _0x59329a=_0x185695[_0xe264('0x27')]({'plain':!![]});var _0x4d531f=_0xe264('0x28');return db[_0xe264('0x4c')][_0xe264('0x47')]({'where':{'name':_0x4d531f,'userProfileId':_0x5f4704[_0xe264('0x4d')]},'raw':!![]})['then'](function(_0x4397ae){if(_0x4397ae&&_0x4397ae[_0xe264('0x4e')]===0x0){return db[_0xe264('0x29')][_0xe264('0x4f')]({'name':_0x59329a[_0xe264('0x2c')],'resourceId':_0x59329a['id'],'type':_0x4397ae[_0xe264('0x2c')],'sectionId':_0x4397ae['id']},{})[_0xe264('0x2a')](function(){return _0x185695;});}else{return _0x185695;}})[_0xe264('0x48')](function(_0x162953){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x162953);throw _0x162953;});}return _0x185695;})['then'](respondWithResult(_0x3c3dbf,0xc9))[_0xe264('0x48')](handleError(_0x3c3dbf,null));};exports[_0xe264('0x25')]=function(_0x2eb514,_0x52aa94){if(_0x2eb514[_0xe264('0x49')]['id']){delete _0x2eb514[_0xe264('0x49')]['id'];}return db['CmList'][_0xe264('0x47')]({'where':{'id':_0x2eb514[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x52aa94,null))[_0xe264('0x2a')](saveUpdates(_0x2eb514[_0xe264('0x49')],null))['then'](respondWithResult(_0x52aa94,null))[_0xe264('0x48')](handleError(_0x52aa94,null));};exports[_0xe264('0x26')]=function(_0x4b0d80,_0x3166c2){return db[_0xe264('0x2f')][_0xe264('0x47')]({'where':{'id':_0x4b0d80[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x3166c2,null))[_0xe264('0x2a')](removeEntity(_0x3166c2,null))[_0xe264('0x48')](handleError(_0x3166c2,null));};exports[_0xe264('0x51')]=function(_0x3b4501,_0x4997a4){return db[_0xe264('0x2f')]['describe']()[_0xe264('0x2a')](respondWithResult(_0x4997a4,null))['catch'](handleError(_0x4997a4,null));};exports['addDisposition']=function(_0xa34ff6,_0x17c50e,_0x4db660){if(_0xa34ff6[_0xe264('0x49')]['id']){delete _0xa34ff6[_0xe264('0x49')]['id'];}return db[_0xe264('0x2f')][_0xe264('0x47')]({'where':{'id':_0xa34ff6[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x17c50e,null))[_0xe264('0x2a')](function(_0x384f63){if(_0x384f63){_0xa34ff6['body']['ListId']=_0x384f63['id'];return db['Disposition'][_0xe264('0x4f')](_0xa34ff6[_0xe264('0x49')]);}})[_0xe264('0x2a')](respondWithResult(_0x17c50e,null))[_0xe264('0x48')](handleError(_0x17c50e,null));};exports[_0xe264('0x52')]=function(_0x3cb260,_0x2a00e2,_0x190fdd){var _0x14344b={'raw':![],'where':{}};var _0x32bc89={};var _0x5ae5fe={'count':0x0,'rows':[]};return db['CmList'][_0xe264('0x53')]({'where':{'id':_0x3cb260[_0xe264('0x50')]['id']}})['then'](handleEntityNotFound(_0x2a00e2,null))[_0xe264('0x2a')](function(_0x37ba81){if(_0x37ba81){_0x32bc89[_0xe264('0x37')]=_[_0xe264('0x45')](db[_0xe264('0x54')]['rawAttributes']);_0x32bc89[_0xe264('0x34')]=_[_0xe264('0x45')](_0x3cb260[_0xe264('0x34')]);_0x32bc89[_0xe264('0x35')]=_['intersection'](_0x32bc89[_0xe264('0x37')],_0x32bc89[_0xe264('0x34')]);_0x14344b[_0xe264('0x38')]=_[_0xe264('0x36')](_0x32bc89['model'],qs[_0xe264('0x39')](_0x3cb260[_0xe264('0x34')]['fields']));_0x14344b[_0xe264('0x38')]=_0x14344b['attributes'][_0xe264('0x3a')]?_0x14344b[_0xe264('0x38')]:_0x32bc89[_0xe264('0x37')];if(!_0x3cb260['query'][_0xe264('0x55')](_0xe264('0x3b'))){_0x14344b['limit']=qs[_0xe264('0x20')](_0x3cb260[_0xe264('0x34')][_0xe264('0x20')]);_0x14344b[_0xe264('0x1e')]=qs[_0xe264('0x1e')](_0x3cb260[_0xe264('0x34')][_0xe264('0x1e')]);}_0x14344b[_0xe264('0x3c')]=qs[_0xe264('0x3d')](_0x3cb260[_0xe264('0x34')][_0xe264('0x3d')]);_0x14344b[_0xe264('0x3e')]=qs[_0xe264('0x35')](_['pick'](_0x3cb260[_0xe264('0x34')],_0x32bc89[_0xe264('0x35')]));_0x14344b[_0xe264('0x3e')][_0xe264('0x56')]=_0x37ba81['id'];if(_0x3cb260[_0xe264('0x34')]['filter']){_0x14344b[_0xe264('0x3e')]=_['merge'](_0x14344b[_0xe264('0x3e')],{'$or':_[_0xe264('0x2e')](_0x14344b[_0xe264('0x38')],function(_0x304b27){var _0x5adc84={};_0x5adc84[_0x304b27]={'$like':'%'+_0x3cb260[_0xe264('0x34')][_0xe264('0x40')]+'%'};return _0x5adc84;})});}_0x14344b=_[_0xe264('0x46')]({},_0x14344b,_0x3cb260[_0xe264('0x41')]);return db[_0xe264('0x54')][_0xe264('0x21')]({'where':_0x14344b[_0xe264('0x3e')]})['then'](function(_0x2ca5b3){_0x5ae5fe[_0xe264('0x21')]=_0x2ca5b3;if(_0x3cb260['query']['includeAll']){_0x14344b['include']=[{'all':!![]}];}return db[_0xe264('0x54')][_0xe264('0x43')](_0x14344b);})[_0xe264('0x2a')](function(_0x2012b3){_0x5ae5fe[_0xe264('0x57')]=_0x2012b3;return _0x5ae5fe;});}})[_0xe264('0x2a')](respondWithFilteredResult(_0x2a00e2,_0x14344b))[_0xe264('0x48')](handleError(_0x2a00e2,null));};exports[_0xe264('0x58')]=function(_0x288ba5,_0x4c2723,_0x215f34){return db[_0xe264('0x2f')][_0xe264('0x47')]({'where':{'id':_0x288ba5[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x4c2723,null))[_0xe264('0x2a')](function(_0x3f96c8){if(_0x3f96c8){return _0x3f96c8[_0xe264('0x58')](_0x288ba5[_0xe264('0x34')][_0xe264('0x59')]);}})[_0xe264('0x2a')](respondWithStatusCode(_0x4c2723,null))[_0xe264('0x48')](handleError(_0x4c2723,null));};exports['addContacts']=function(_0x43b44c,_0x3a7d35,_0x562dcc){return db[_0xe264('0x2f')][_0xe264('0x47')]({'where':{'id':_0x43b44c[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x3a7d35,null))[_0xe264('0x2a')](function(_0x5bb037){if(_0x5bb037){var _0x33eeb2=[];var _0x2c16d0={'success':[],'errors':[]};return db[_0xe264('0x5a')][_0xe264('0x51')]()[_0xe264('0x2a')](function(_0x11b1a8){if(_0x43b44c[_0xe264('0x49')]['tags']&&_['isArray'](_0x43b44c[_0xe264('0x49')]['tags'])){if(_0x43b44c[_0xe264('0x49')]['tags'][_0xe264('0x3a')]){_0x43b44c[_0xe264('0x49')][_0xe264('0x5b')]=_0x43b44c[_0xe264('0x49')][_0xe264('0x5b')][_0xe264('0x5c')](';')+';';}else{_0x43b44c['body'][_0xe264('0x5b')]=null;}}else{_0x43b44c['body'][_0xe264('0x5b')]=null;}if(_0x43b44c[_0xe264('0x49')]&&_['isArray'](_0x43b44c[_0xe264('0x49')])){for(var _0x5d8b7c=0x0;_0x5d8b7c<_0x43b44c[_0xe264('0x49')][_0xe264('0x3a')];_0x5d8b7c+=0x1){_0x43b44c[_0xe264('0x49')][_0x5d8b7c][_0xe264('0x56')]=_0x43b44c[_0xe264('0x50')]['id'];_0x33eeb2['push'](_0x43b44c['body'][_0x5d8b7c]);}return BPromise[_0xe264('0x5d')](_0x33eeb2,function(_0x5739bd){return db['CmContact'][_0xe264('0x4f')](_[_0xe264('0x5e')](_0x5739bd,[_0xe264('0x59'),'id'])||{},{'fields':_['keys'](_0x11b1a8),'raw':!![]})[_0xe264('0x2a')](function(_0x542003){_0x2c16d0[_0xe264('0x5f')][_0xe264('0x60')](_0x542003[_0xe264('0x61')]);})[_0xe264('0x48')](function(_0xa3f348){_0x2c16d0[_0xe264('0x62')][_0xe264('0x60')]({'data':_0x5739bd,'error':_0xa3f348['message']});});})[_0xe264('0x2a')](function(_0x1e276e){return _0x2c16d0;})[_0xe264('0x48')](function(_0x5872d7){return _0x5872d7;});}else{_0x3a7d35[_0xe264('0x1b')](0x190)[_0xe264('0x1d')]({'message':_0xe264('0x63')});}});}})[_0xe264('0x2a')](respondWithResult(_0x3a7d35,null))[_0xe264('0x48')](handleError(_0x3a7d35,null));};exports[_0xe264('0x64')]=function(_0x3b2d1e,_0x3b6a83,_0x216adb){var _0x10613d;return db['CmList'][_0xe264('0x47')]({'where':{'id':_0x3b2d1e[_0xe264('0x50')]['id']},'include':[{'model':db[_0xe264('0x65')],'as':'CustomFields'}]})[_0xe264('0x2a')](handleEntityNotFound(_0x3b6a83,null))[_0xe264('0x2a')](function(_0x28ee19){if(_0x28ee19){_0x10613d=_0x28ee19;return db['CmContact']['rawAttributes'];}})[_0xe264('0x2a')](function(_0x12c1a1){if(_0x12c1a1){var _0x3fe29b={};var _0x289c8e={};_0x289c8e['model']=_[_0xe264('0x66')](_[_0xe264('0x45')](_0x12c1a1),_[_0xe264('0x2e')](_0x10613d[_0xe264('0x67')],function(_0x2cc2e2){return util[_0xe264('0x68')](_0xe264('0x69'),_0x2cc2e2['id']);}));_0x289c8e[_0xe264('0x34')]=_['keys'](_0x3b2d1e[_0xe264('0x34')]);_0x289c8e[_0xe264('0x35')]=_[_0xe264('0x36')](_0x289c8e['model'],_0x289c8e[_0xe264('0x34')]);_0x3fe29b[_0xe264('0x38')]=_[_0xe264('0x36')](_0x289c8e['model'],qs['fields'](_0x3b2d1e[_0xe264('0x34')][_0xe264('0x39')]));_0x3fe29b[_0xe264('0x38')]=_0x3fe29b[_0xe264('0x38')][_0xe264('0x3a')]?_0x3fe29b[_0xe264('0x38')]:_0x289c8e[_0xe264('0x37')];if(!_0x3b2d1e[_0xe264('0x34')][_0xe264('0x55')](_0xe264('0x3b'))){_0x3fe29b[_0xe264('0x20')]=qs[_0xe264('0x20')](_0x3b2d1e[_0xe264('0x34')][_0xe264('0x20')]);_0x3fe29b['offset']=qs['offset'](_0x3b2d1e[_0xe264('0x34')][_0xe264('0x1e')]);}_0x3fe29b[_0xe264('0x3c')]=qs[_0xe264('0x3d')](_0x3b2d1e[_0xe264('0x34')]['sort']);_0x3fe29b[_0xe264('0x3e')]=qs['filters'](_['pick'](_0x3b2d1e['query'],_0x289c8e[_0xe264('0x35')]));_0x3fe29b[_0xe264('0x6a')]=!![];if(_0x3b2d1e[_0xe264('0x34')]['filter']){_0x3fe29b['where']=_[_0xe264('0x46')](_0x3fe29b[_0xe264('0x3e')],{'$or':_[_0xe264('0x2e')](_0x3fe29b[_0xe264('0x38')],function(_0x943403){var _0x6f36ea={};_0x6f36ea[_0x943403]={'$like':'%'+_0x3b2d1e['query'][_0xe264('0x40')]+'%'};return _0x6f36ea;})});}_0x3fe29b=_[_0xe264('0x46')]({},_0x3fe29b,_0x3b2d1e['options']);return _0x10613d[_0xe264('0x64')](_0x3fe29b);}})[_0xe264('0x2a')](respondWithResult(_0x3b6a83,null))['catch'](handleError(_0x3b6a83,null));};exports[_0xe264('0x6b')]=function(_0x27b510,_0x292ffd,_0x30590f){var _0x3417a4;return db['CmList'][_0xe264('0x47')]({'where':{'id':_0x27b510[_0xe264('0x50')]['id']},'include':[{'model':db[_0xe264('0x65')],'as':_0xe264('0x67')}]})[_0xe264('0x2a')](handleEntityNotFound(_0x292ffd,null))[_0xe264('0x2a')](function(_0x16501c){if(_0x16501c){_0x3417a4=_0x16501c;return db[_0xe264('0x5a')][_0xe264('0x30')];}})[_0xe264('0x2a')](function(_0x464abb){if(_0x464abb){var _0x5cb422={};var _0xdfb1ee={};_0xdfb1ee[_0xe264('0x37')]=_[_0xe264('0x66')](_[_0xe264('0x45')](_0x464abb),_['map'](_0x3417a4[_0xe264('0x67')],function(_0x2edc0b){return util[_0xe264('0x68')](_0xe264('0x69'),_0x2edc0b['id']);}));_0xdfb1ee[_0xe264('0x34')]=_[_0xe264('0x45')](_0x27b510[_0xe264('0x34')]);_0xdfb1ee['filters']=_['intersection'](_0xdfb1ee[_0xe264('0x37')],_0xdfb1ee[_0xe264('0x34')]);_0x5cb422[_0xe264('0x38')]=_['intersection'](_0xdfb1ee[_0xe264('0x37')],qs['fields'](_0x27b510[_0xe264('0x34')][_0xe264('0x39')]));_0x5cb422[_0xe264('0x38')]=_0x5cb422[_0xe264('0x38')]['length']?_0x5cb422[_0xe264('0x38')]:_0xdfb1ee[_0xe264('0x37')];if(!_0x27b510[_0xe264('0x34')][_0xe264('0x55')]('nolimit')){_0x5cb422[_0xe264('0x20')]=qs[_0xe264('0x20')](_0x27b510['query'][_0xe264('0x20')]);_0x5cb422[_0xe264('0x1e')]=qs['offset'](_0x27b510['query'][_0xe264('0x1e')]);}_0x5cb422['order']=qs[_0xe264('0x3d')](_0x27b510[_0xe264('0x34')]['sort']);_0x5cb422[_0xe264('0x3e')]=qs[_0xe264('0x35')](_[_0xe264('0x3f')](_0x27b510['query'],_0xdfb1ee['filters']));_0x5cb422[_0xe264('0x6a')]=!![];if(_0x27b510[_0xe264('0x34')][_0xe264('0x40')]){_0x5cb422[_0xe264('0x3e')]=_[_0xe264('0x46')](_0x5cb422[_0xe264('0x3e')],{'$or':_[_0xe264('0x2e')](_0x5cb422[_0xe264('0x38')],function(_0x33d4b5){var _0x1c4403={};_0x1c4403[_0x33d4b5]={'$like':'%'+_0x27b510[_0xe264('0x34')][_0xe264('0x40')]+'%'};return _0x1c4403;})});}_0x5cb422=_[_0xe264('0x46')]({},_0x5cb422,_0x27b510['options']);return _0x3417a4[_0xe264('0x64')](_0x5cb422);}})[_0xe264('0x2a')](function(_0x4a438d){if(!_[_0xe264('0x6c')](_0x4a438d)){var _0x20dd6b=toCsv(_0x4a438d);var _0x4af0d4=Date['now']();fs['writeFileSync'](util[_0xe264('0x68')](_0xe264('0x6d'),_0x3417a4['id'],_0x4af0d4),_0x20dd6b);_0x292ffd[_0xe264('0x6e')](_0xe264('0x6f'),'attachment;\x20filename='+util[_0xe264('0x68')](_0xe264('0x70'),_0x3417a4['id'],_0x4af0d4));_0x292ffd['setHeader'](_0xe264('0x71'),_0xe264('0x72'));return _0x292ffd[_0xe264('0x73')](util[_0xe264('0x68')](_0xe264('0x6d'),_0x3417a4['id'],_0x4af0d4));}else{return _0x292ffd[_0xe264('0x2b')](0xcc);}})[_0xe264('0x48')](handleError(_0x292ffd,null));};exports['addCustomField']=function(_0x1a7dc5,_0x82d449,_0x3e6e40){var _0x2132c5;delete _0x1a7dc5['body']['id'];return db['CmList'][_0xe264('0x53')]({'where':{'id':_0x1a7dc5[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x82d449,null))[_0xe264('0x2a')](function(_0x46b3e7){if(_0x46b3e7){return db[_0xe264('0x74')][_0xe264('0x75')](function(_0x334bf6){return db[_0xe264('0x65')][_0xe264('0x4f')](_0x1a7dc5['body'],{'transaction':_0x334bf6})[_0xe264('0x2a')](function(_0xba71e2){_0x2132c5=_0xba71e2;return _0x46b3e7[_0xe264('0x76')](_0xba71e2,{'transaction':_0x334bf6});})[_0xe264('0x2a')](function(){var _0x1fd5eb={'type':db[_0xe264('0x77')][_0xe264('0x78')],'transaction':_0x334bf6};switch(_0x1a7dc5[_0xe264('0x49')]['type']){case'text':_0x1fd5eb[_0xe264('0x32')]=db[_0xe264('0x77')]['TEXT'];break;case _0xe264('0x79'):_0x1fd5eb[_0xe264('0x32')]=db[_0xe264('0x77')]['INTEGER'];break;case'switch':_0x1fd5eb['type']=db[_0xe264('0x77')][_0xe264('0x7a')];_0x1fd5eb[_0xe264('0x7b')]=![];break;default:}return db[_0xe264('0x74')][_0xe264('0x7c')]['addColumn'](_0xe264('0x7d'),util['format'](_0xe264('0x7e'),_0x2132c5['id']),_0x1fd5eb);})[_0xe264('0x2a')](function(){return _0x2132c5;});});}})[_0xe264('0x2a')](respondWithResult(_0x82d449,null))[_0xe264('0x48')](handleError(_0x82d449,null));};exports[_0xe264('0x7f')]=function(_0x3b6395,_0x9234cc,_0x4b427e){var _0x4b2e80={};var _0x3c59a9={};var _0x4ffa8e;var _0xb9d514;return db[_0xe264('0x2f')][_0xe264('0x53')]({'where':{'id':_0x3b6395[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x9234cc,null))[_0xe264('0x2a')](function(_0x55f311){if(_0x55f311){_0x4ffa8e=_0x55f311;_0x3c59a9[_0xe264('0x37')]=_[_0xe264('0x45')](db[_0xe264('0x65')]['rawAttributes']);_0x3c59a9[_0xe264('0x34')]=_[_0xe264('0x45')](_0x3b6395[_0xe264('0x34')]);_0x3c59a9['filters']=_[_0xe264('0x36')](_0x3c59a9[_0xe264('0x37')],_0x3c59a9[_0xe264('0x34')]);_0x4b2e80['attributes']=_[_0xe264('0x36')](_0x3c59a9[_0xe264('0x37')],qs[_0xe264('0x39')](_0x3b6395[_0xe264('0x34')][_0xe264('0x39')]));_0x4b2e80['attributes']=_0x4b2e80[_0xe264('0x38')][_0xe264('0x3a')]?_0x4b2e80[_0xe264('0x38')]:_0x3c59a9[_0xe264('0x37')];_0x4b2e80[_0xe264('0x3c')]=qs[_0xe264('0x3d')](_0x3b6395[_0xe264('0x34')][_0xe264('0x3d')]);_0x4b2e80[_0xe264('0x3e')]=qs['filters'](_[_0xe264('0x3f')](_0x3b6395[_0xe264('0x34')],_0x3c59a9[_0xe264('0x35')]));_0x4b2e80[_0xe264('0x3e')]=_[_0xe264('0x46')](_0x4b2e80['where'],{'$or':[{'ListId':_0x55f311['id']},{'ListId':null}]});if(_0x3b6395[_0xe264('0x34')][_0xe264('0x40')]){_0x4b2e80[_0xe264('0x3e')]=_[_0xe264('0x46')](_0x4b2e80[_0xe264('0x3e')],{'$or':_[_0xe264('0x2e')](_0x4b2e80['attributes'],function(_0x7cf43e){var _0x27ac2e={};_0x27ac2e[_0x7cf43e]={'$like':'%'+_0x3b6395[_0xe264('0x34')][_0xe264('0x40')]+'%'};return _0x27ac2e;})});}_0x4b2e80=_[_0xe264('0x46')]({},_0x4b2e80,_0x3b6395[_0xe264('0x41')]);return db[_0xe264('0x65')][_0xe264('0x80')](_0x4b2e80);}})['then'](respondWithResult(_0x9234cc,null))['catch'](handleError(_0x9234cc,null));};exports['addAgents']=function(_0x251f6d,_0xaa5862,_0x35c2a7){return db['CmList']['find']({'where':{'id':_0x251f6d[_0xe264('0x50')]['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0xaa5862,null))[_0xe264('0x2a')](function(_0x29c5f6){if(_0x29c5f6){return _0x29c5f6[_0xe264('0x81')](_0x251f6d[_0xe264('0x49')][_0xe264('0x59')],_[_0xe264('0x5e')](_0x251f6d[_0xe264('0x49')],[_0xe264('0x59'),'id'])||{})['spread'](function(_0x5e1bc8){for(var _0x4aece2=0x0;_0x4aece2<_0x251f6d[_0xe264('0x49')][_0xe264('0x59')][_0xe264('0x3a')];_0x4aece2+=0x1){socket[_0xe264('0x82')](_0xe264('0x83'),{'UserId':Number(_0x251f6d[_0xe264('0x49')][_0xe264('0x59')][_0x4aece2]),'CmListId':Number(_0x251f6d[_0xe264('0x50')]['id'])});}return _0x5e1bc8;});}})['then'](respondWithResult(_0xaa5862,null))['catch'](handleError(_0xaa5862,null));};exports[_0xe264('0x84')]=function(_0xf1d3a,_0x8bb213,_0x19b103){return db[_0xe264('0x2f')]['find']({'where':{'id':_0xf1d3a['params']['id']}})[_0xe264('0x2a')](handleEntityNotFound(_0x8bb213,null))[_0xe264('0x2a')](function(_0x2443f4){if(_0x2443f4){return _0x2443f4['removeAgents'](_0xf1d3a['query'][_0xe264('0x59')])[_0xe264('0x2a')](function(){if(_['isArray'](_0xf1d3a[_0xe264('0x34')][_0xe264('0x59')])){for(var _0x3c38c0=0x0;_0x3c38c0<_0xf1d3a[_0xe264('0x34')]['ids']['length'];_0x3c38c0+=0x1){socket[_0xe264('0x82')]('userCmList:remove',{'UserId':Number(_0xf1d3a[_0xe264('0x34')][_0xe264('0x59')][_0x3c38c0]),'CmListId':Number(_0xf1d3a[_0xe264('0x50')]['id'])});}}else{socket[_0xe264('0x82')](_0xe264('0x85'),{'UserId':Number(_0xf1d3a[_0xe264('0x34')][_0xe264('0x59')]),'CmListId':Number(_0xf1d3a['params']['id'])});}});}})[_0xe264('0x2a')](respondWithStatusCode(_0x8bb213,null))[_0xe264('0x48')](handleError(_0x8bb213,null));};exports[_0xe264('0x86')]=function(_0x525d98,_0x35c728,_0x54ef4e){var _0x3d74e0={};var _0x40484f={};var _0x4d95b6;var _0x45ffa8;return db['CmList'][_0xe264('0x53')]({'where':{'id':_0x525d98[_0xe264('0x50')]['id']}})['then'](handleEntityNotFound(_0x35c728,null))[_0xe264('0x2a')](function(_0x13311a){if(_0x13311a){_0x4d95b6=_0x13311a;_0x40484f[_0xe264('0x37')]=_[_0xe264('0x45')](db[_0xe264('0x87')][_0xe264('0x30')]);_0x40484f[_0xe264('0x34')]=_[_0xe264('0x45')](_0x525d98[_0xe264('0x34')]);_0x40484f[_0xe264('0x35')]=_[_0xe264('0x36')](_0x40484f[_0xe264('0x37')],_0x40484f[_0xe264('0x34')]);_0x3d74e0[_0xe264('0x38')]=_[_0xe264('0x36')](_0x40484f[_0xe264('0x37')],qs[_0xe264('0x39')](_0x525d98[_0xe264('0x34')][_0xe264('0x39')]));_0x3d74e0[_0xe264('0x38')]=_0x3d74e0[_0xe264('0x38')][_0xe264('0x3a')]?_0x3d74e0['attributes']:_0x40484f['model'];_0x3d74e0[_0xe264('0x3c')]=qs[_0xe264('0x3d')](_0x525d98[_0xe264('0x34')][_0xe264('0x3d')]);_0x3d74e0['where']=qs[_0xe264('0x35')](_[_0xe264('0x3f')](_0x525d98[_0xe264('0x34')],_0x40484f['filters']));if(_0x525d98[_0xe264('0x34')][_0xe264('0x40')]){_0x3d74e0['where']=_[_0xe264('0x46')](_0x3d74e0['where'],{'$or':_[_0xe264('0x2e')](_0x3d74e0[_0xe264('0x38')],function(_0x17e24b){var _0x320e3c={};_0x320e3c[_0x17e24b]={'$like':'%'+_0x525d98[_0xe264('0x34')][_0xe264('0x40')]+'%'};return _0x320e3c;})});}_0x3d74e0=_[_0xe264('0x46')]({},_0x3d74e0,_0x525d98[_0xe264('0x41')]);return _0x4d95b6[_0xe264('0x86')](_0x3d74e0);}})['then'](function(_0x3f1413){if(_0x3f1413){_0x45ffa8=_0x3f1413[_0xe264('0x3a')];if(!_0x525d98['query'][_0xe264('0x55')](_0xe264('0x3b'))){_0x3d74e0[_0xe264('0x20')]=qs[_0xe264('0x20')](_0x525d98[_0xe264('0x34')]['limit']);_0x3d74e0[_0xe264('0x1e')]=qs[_0xe264('0x1e')](_0x525d98[_0xe264('0x34')]['offset']);}return _0x4d95b6['getAgents'](_0x3d74e0);}})['then'](function(_0x4850a7){if(_0x4850a7){return _0x4850a7?{'count':_0x45ffa8,'rows':_0x4850a7}:null;}})[_0xe264('0x2a')](respondWithResult(_0x35c728,null))[_0xe264('0x48')](handleError(_0x35c728,null));}; \ No newline at end of file +var _0x4474=['nolimit','ListId','removeDispositions','ids','addContacts','CmContact','tags','join','push','each','success','message','getContacts','CustomFields','format','cf_%d','order','raw','getContactsCsv','concat','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','findOne','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','omit','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','offset','limit','undefined','count','apply','update','then','destroy','get','Lists','end','name','index','map','CmList','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','filter','options','include','findAll','rows','show','keys','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions'];(function(_0xeeb6dd,_0x3e5f7b){var _0x95d347=function(_0x48de04){while(--_0x48de04){_0xeeb6dd['push'](_0xeeb6dd['shift']());}};_0x95d347(++_0x3e5f7b);}(_0x4474,0x1ea));var _0x4447=function(_0x56feee,_0x4d26c7){_0x56feee=_0x56feee-0x0;var _0x554d3e=_0x4474[_0x56feee];return _0x554d3e;};'use strict';var emlformat=require(_0x4447('0x0'));var rimraf=require(_0x4447('0x1'));var zipdir=require(_0x4447('0x2'));var jsonpatch=require(_0x4447('0x3'));var rp=require(_0x4447('0x4'));var moment=require(_0x4447('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4447('0x6'));var util=require(_0x4447('0x7'));var path=require('path');var sox=require(_0x4447('0x8'));var csv=require(_0x4447('0x9'));var ejs=require(_0x4447('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4447('0xb'));var toCsv=require(_0x4447('0x9'));var querystring=require(_0x4447('0xc'));var Papa=require(_0x4447('0xd'));var Redis=require('ioredis');var authService=require(_0x4447('0xe'));var qs=require(_0x4447('0xf'));var as=require(_0x4447('0x10'));var hardwareService=require(_0x4447('0x11'));var logger=require(_0x4447('0x12'))(_0x4447('0x13'));var utils=require('../../config/utils');var config=require(_0x4447('0x14'));var licenseUtil=require(_0x4447('0x15'));var db=require('../../mysqldb')['db'];config[_0x4447('0x16')]=_[_0x4447('0x17')](config['redis'],{'host':_0x4447('0x18'),'port':0x18eb});var socket=require(_0x4447('0x19'))(new Redis(config[_0x4447('0x16')]));require(_0x4447('0x1a'))[_0x4447('0x1b')](socket);function respondWithStatusCode(_0x514a04,_0x4a9c39){_0x4a9c39=_0x4a9c39||0xcc;return function(_0x1694e9){if(_0x1694e9){return _0x514a04[_0x4447('0x1c')](_0x4a9c39);}return _0x514a04[_0x4447('0x1d')](_0x4a9c39)['end']();};}function respondWithResult(_0x21fffe,_0xe38772){_0xe38772=_0xe38772||0xc8;return function(_0x603bce){if(_0x603bce){return _0x21fffe[_0x4447('0x1d')](_0xe38772)[_0x4447('0x1e')](_0x603bce);}};}function respondWithFilteredResult(_0x21bec1,_0x4f35dc){return function(_0x54126c){if(_0x54126c){var _0x16f967=typeof _0x4f35dc[_0x4447('0x1f')]==='undefined'&&typeof _0x4f35dc[_0x4447('0x20')]===_0x4447('0x21');var _0x46194e=_0x54126c[_0x4447('0x22')];var _0x351e8c=_0x16f967?0x0:_0x4f35dc['offset'];var _0x14434a=_0x16f967?_0x54126c[_0x4447('0x22')]:_0x4f35dc[_0x4447('0x1f')]+_0x4f35dc[_0x4447('0x20')];var _0xa09e04;if(_0x14434a>=_0x46194e){_0x14434a=_0x46194e;_0xa09e04=0xc8;}else{_0xa09e04=0xce;}_0x21bec1['status'](_0xa09e04);return _0x21bec1['set']('Content-Range',_0x351e8c+'-'+_0x14434a+'/'+_0x46194e)['json'](_0x54126c);}return null;};}function patchUpdates(_0x3c84a7){return function(_0x5130f){try{jsonpatch[_0x4447('0x23')](_0x5130f,_0x3c84a7,!![]);}catch(_0x307114){return BPromise['reject'](_0x307114);}return _0x5130f['save']();};}function saveUpdates(_0x416337,_0x3ff663){return function(_0x576ca7){if(_0x576ca7){return _0x576ca7[_0x4447('0x24')](_0x416337)[_0x4447('0x25')](function(_0x3c928b){return _0x3c928b;});}return null;};}function removeEntity(_0x555e06,_0x530721){return function(_0xdac63a){if(_0xdac63a){return _0xdac63a[_0x4447('0x26')]()[_0x4447('0x25')](function(){var _0x38257f=_0xdac63a[_0x4447('0x27')]({'plain':!![]});var _0x5495d7=_0x4447('0x28');return db['UserProfileResource'][_0x4447('0x26')]({'where':{'type':_0x5495d7,'resourceId':_0x38257f['id']}})[_0x4447('0x25')](function(){return _0xdac63a;});})['then'](function(){_0x555e06[_0x4447('0x1d')](0xcc)[_0x4447('0x29')]();});}};}function handleEntityNotFound(_0x2f9c35,_0xd746ae){return function(_0x450315){if(!_0x450315){_0x2f9c35[_0x4447('0x1c')](0x194);}return _0x450315;};}function handleError(_0x4c5059,_0x351c52){_0x351c52=_0x351c52||0x1f4;return function(_0x4ed92e){logger['error'](_0x4ed92e['stack']);if(_0x4ed92e[_0x4447('0x2a')]){delete _0x4ed92e[_0x4447('0x2a')];}_0x4c5059['status'](_0x351c52)['send'](_0x4ed92e);};}exports[_0x4447('0x2b')]=function(_0x84375c,_0x20bb66){var _0x17638={},_0x386859={},_0x3c987d={'count':0x0,'rows':[]};var _0x340a17=_[_0x4447('0x2c')](db[_0x4447('0x2d')][_0x4447('0x2e')],function(_0x5ae3bd){return{'name':_0x5ae3bd[_0x4447('0x2f')],'type':_0x5ae3bd[_0x4447('0x30')]['key']};});_0x386859['model']=_['map'](_0x340a17,_0x4447('0x2a'));_0x386859[_0x4447('0x31')]=_['keys'](_0x84375c[_0x4447('0x31')]);_0x386859['filters']=_[_0x4447('0x32')](_0x386859[_0x4447('0x33')],_0x386859['query']);_0x17638[_0x4447('0x34')]=_[_0x4447('0x32')](_0x386859[_0x4447('0x33')],qs['fields'](_0x84375c[_0x4447('0x31')][_0x4447('0x35')]));_0x17638['attributes']=_0x17638[_0x4447('0x34')][_0x4447('0x36')]?_0x17638[_0x4447('0x34')]:_0x386859[_0x4447('0x33')];if(!_0x84375c[_0x4447('0x31')][_0x4447('0x37')]('nolimit')){_0x17638[_0x4447('0x20')]=qs[_0x4447('0x20')](_0x84375c[_0x4447('0x31')][_0x4447('0x20')]);_0x17638[_0x4447('0x1f')]=qs[_0x4447('0x1f')](_0x84375c['query'][_0x4447('0x1f')]);}_0x17638['order']=qs[_0x4447('0x38')](_0x84375c[_0x4447('0x31')][_0x4447('0x38')]);_0x17638[_0x4447('0x39')]=qs[_0x4447('0x3a')](_[_0x4447('0x3b')](_0x84375c[_0x4447('0x31')],_0x386859[_0x4447('0x3a')]),_0x340a17);if(_0x84375c[_0x4447('0x31')]['filter']){_0x17638[_0x4447('0x39')]=_[_0x4447('0x3c')](_0x17638[_0x4447('0x39')],{'$or':_[_0x4447('0x2c')](_0x340a17,function(_0x1d12e1){if(_0x1d12e1[_0x4447('0x30')]!=='VIRTUAL'){var _0x5373d5={};_0x5373d5[_0x1d12e1['name']]={'$like':'%'+_0x84375c[_0x4447('0x31')][_0x4447('0x3d')]+'%'};return _0x5373d5;}})});}_0x17638=_[_0x4447('0x3c')]({},_0x17638,_0x84375c[_0x4447('0x3e')]);var _0x4a405a={'where':_0x17638['where']};return db[_0x4447('0x2d')][_0x4447('0x22')](_0x4a405a)[_0x4447('0x25')](function(_0x5b9adc){_0x3c987d[_0x4447('0x22')]=_0x5b9adc;if(_0x84375c['query']['includeAll']){_0x17638[_0x4447('0x3f')]=[{'all':!![]}];}return db[_0x4447('0x2d')][_0x4447('0x40')](_0x17638);})[_0x4447('0x25')](function(_0x5c5ff2){_0x3c987d[_0x4447('0x41')]=_0x5c5ff2;return _0x3c987d;})[_0x4447('0x25')](respondWithFilteredResult(_0x20bb66,_0x17638))['catch'](handleError(_0x20bb66,null));};exports[_0x4447('0x42')]=function(_0x35c7d9,_0x10cde9){var _0x1b68c3={'raw':![],'where':{'id':_0x35c7d9['params']['id']}},_0x27ec19={};_0x27ec19['model']=_[_0x4447('0x43')](db[_0x4447('0x2d')][_0x4447('0x2e')]);_0x27ec19[_0x4447('0x31')]=_['keys'](_0x35c7d9[_0x4447('0x31')]);_0x27ec19[_0x4447('0x3a')]=_[_0x4447('0x32')](_0x27ec19['model'],_0x27ec19[_0x4447('0x31')]);_0x1b68c3[_0x4447('0x34')]=_[_0x4447('0x32')](_0x27ec19[_0x4447('0x33')],qs[_0x4447('0x35')](_0x35c7d9['query']['fields']));_0x1b68c3['attributes']=_0x1b68c3[_0x4447('0x34')][_0x4447('0x36')]?_0x1b68c3['attributes']:_0x27ec19[_0x4447('0x33')];if(_0x35c7d9[_0x4447('0x31')][_0x4447('0x44')]){_0x1b68c3[_0x4447('0x3f')]=[{'all':!![]}];}_0x1b68c3=_[_0x4447('0x3c')]({},_0x1b68c3,_0x35c7d9['options']);return db['CmList']['find'](_0x1b68c3)[_0x4447('0x25')](handleEntityNotFound(_0x10cde9,null))[_0x4447('0x25')](respondWithResult(_0x10cde9,null))[_0x4447('0x45')](handleError(_0x10cde9,null));};exports[_0x4447('0x46')]=function(_0x376fd7,_0x51565b){return db[_0x4447('0x2d')]['create'](_0x376fd7[_0x4447('0x47')],{})['then'](function(_0x25287e){var _0x6ad974=_0x376fd7[_0x4447('0x48')][_0x4447('0x27')]({'plain':!![]});if(!_0x6ad974)throw new Error(_0x4447('0x49'));if(_0x6ad974[_0x4447('0x4a')]==='user'){var _0x31adf9=_0x25287e[_0x4447('0x27')]({'plain':!![]});var _0x4ce46a=_0x4447('0x28');return db[_0x4447('0x4b')][_0x4447('0x4c')]({'where':{'name':_0x4ce46a,'userProfileId':_0x6ad974[_0x4447('0x4d')]},'raw':!![]})[_0x4447('0x25')](function(_0x50d709){if(_0x50d709&&_0x50d709[_0x4447('0x4e')]===0x0){return db['UserProfileResource'][_0x4447('0x46')]({'name':_0x31adf9['name'],'resourceId':_0x31adf9['id'],'type':_0x50d709[_0x4447('0x2a')],'sectionId':_0x50d709['id']},{})['then'](function(){return _0x25287e;});}else{return _0x25287e;}})[_0x4447('0x45')](function(_0x475db0){logger[_0x4447('0x4f')](_0x4447('0x50'),_0x475db0);throw _0x475db0;});}return _0x25287e;})[_0x4447('0x25')](respondWithResult(_0x51565b,0xc9))[_0x4447('0x45')](handleError(_0x51565b,null));};exports[_0x4447('0x24')]=function(_0x24008a,_0x29aaf6){if(_0x24008a[_0x4447('0x47')]['id']){delete _0x24008a['body']['id'];}return db['CmList'][_0x4447('0x4c')]({'where':{'id':_0x24008a[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x29aaf6,null))[_0x4447('0x25')](saveUpdates(_0x24008a[_0x4447('0x47')],null))[_0x4447('0x25')](respondWithResult(_0x29aaf6,null))[_0x4447('0x45')](handleError(_0x29aaf6,null));};exports['destroy']=function(_0x2ff0c5,_0x5f1a36){return db[_0x4447('0x2d')][_0x4447('0x4c')]({'where':{'id':_0x2ff0c5[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x5f1a36,null))[_0x4447('0x25')](removeEntity(_0x5f1a36,null))[_0x4447('0x45')](handleError(_0x5f1a36,null));};exports[_0x4447('0x52')]=function(_0x418e8d,_0x2245db){return db[_0x4447('0x2d')]['describe']()['then'](respondWithResult(_0x2245db,null))[_0x4447('0x45')](handleError(_0x2245db,null));};exports[_0x4447('0x53')]=function(_0x106263,_0x5073e1,_0x23397f){if(_0x106263['body']['id']){delete _0x106263[_0x4447('0x47')]['id'];}return db['CmList'][_0x4447('0x4c')]({'where':{'id':_0x106263['params']['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x5073e1,null))[_0x4447('0x25')](function(_0x3a8e00){if(_0x3a8e00){_0x106263[_0x4447('0x47')]['ListId']=_0x3a8e00['id'];return db[_0x4447('0x54')][_0x4447('0x46')](_0x106263[_0x4447('0x47')]);}})[_0x4447('0x25')](respondWithResult(_0x5073e1,null))[_0x4447('0x45')](handleError(_0x5073e1,null));};exports[_0x4447('0x55')]=function(_0x355eb5,_0x3bc8ab,_0x111b19){var _0x3d0da5={'raw':![],'where':{}};var _0x205b9b={};var _0x4eca0e={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x355eb5[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x3bc8ab,null))['then'](function(_0x45bf8c){if(_0x45bf8c){_0x205b9b[_0x4447('0x33')]=_[_0x4447('0x43')](db[_0x4447('0x54')][_0x4447('0x2e')]);_0x205b9b['query']=_['keys'](_0x355eb5[_0x4447('0x31')]);_0x205b9b[_0x4447('0x3a')]=_[_0x4447('0x32')](_0x205b9b[_0x4447('0x33')],_0x205b9b['query']);_0x3d0da5['attributes']=_[_0x4447('0x32')](_0x205b9b[_0x4447('0x33')],qs['fields'](_0x355eb5[_0x4447('0x31')]['fields']));_0x3d0da5[_0x4447('0x34')]=_0x3d0da5['attributes'][_0x4447('0x36')]?_0x3d0da5[_0x4447('0x34')]:_0x205b9b[_0x4447('0x33')];if(!_0x355eb5[_0x4447('0x31')][_0x4447('0x37')](_0x4447('0x56'))){_0x3d0da5[_0x4447('0x20')]=qs[_0x4447('0x20')](_0x355eb5['query'][_0x4447('0x20')]);_0x3d0da5[_0x4447('0x1f')]=qs[_0x4447('0x1f')](_0x355eb5[_0x4447('0x31')]['offset']);}_0x3d0da5['order']=qs[_0x4447('0x38')](_0x355eb5[_0x4447('0x31')]['sort']);_0x3d0da5[_0x4447('0x39')]=qs[_0x4447('0x3a')](_['pick'](_0x355eb5[_0x4447('0x31')],_0x205b9b['filters']));_0x3d0da5[_0x4447('0x39')][_0x4447('0x57')]=_0x45bf8c['id'];if(_0x355eb5[_0x4447('0x31')][_0x4447('0x3d')]){_0x3d0da5[_0x4447('0x39')]=_[_0x4447('0x3c')](_0x3d0da5[_0x4447('0x39')],{'$or':_['map'](_0x3d0da5[_0x4447('0x34')],function(_0x2805b7){var _0x35522b={};_0x35522b[_0x2805b7]={'$like':'%'+_0x355eb5[_0x4447('0x31')][_0x4447('0x3d')]+'%'};return _0x35522b;})});}_0x3d0da5=_['merge']({},_0x3d0da5,_0x355eb5[_0x4447('0x3e')]);return db[_0x4447('0x54')]['count']({'where':_0x3d0da5['where']})[_0x4447('0x25')](function(_0x22360){_0x4eca0e['count']=_0x22360;if(_0x355eb5[_0x4447('0x31')]['includeAll']){_0x3d0da5[_0x4447('0x3f')]=[{'all':!![]}];}return db[_0x4447('0x54')][_0x4447('0x40')](_0x3d0da5);})[_0x4447('0x25')](function(_0x136db4){_0x4eca0e[_0x4447('0x41')]=_0x136db4;return _0x4eca0e;});}})[_0x4447('0x25')](respondWithFilteredResult(_0x3bc8ab,_0x3d0da5))[_0x4447('0x45')](handleError(_0x3bc8ab,null));};exports[_0x4447('0x58')]=function(_0x54bf7a,_0xe3cc43,_0x27b6cd){return db[_0x4447('0x2d')][_0x4447('0x4c')]({'where':{'id':_0x54bf7a['params']['id']}})['then'](handleEntityNotFound(_0xe3cc43,null))[_0x4447('0x25')](function(_0x35954b){if(_0x35954b){return _0x35954b['removeDispositions'](_0x54bf7a['query'][_0x4447('0x59')]);}})[_0x4447('0x25')](respondWithStatusCode(_0xe3cc43,null))[_0x4447('0x45')](handleError(_0xe3cc43,null));};exports[_0x4447('0x5a')]=function(_0x198312,_0xf31b65,_0x2a2efd){return db[_0x4447('0x2d')]['find']({'where':{'id':_0x198312[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0xf31b65,null))['then'](function(_0x45268a){if(_0x45268a){var _0x58de06=[];var _0x512776={'success':[],'errors':[]};return db[_0x4447('0x5b')][_0x4447('0x52')]()[_0x4447('0x25')](function(_0xc7d98e){if(_0x198312['body']['tags']&&_['isArray'](_0x198312[_0x4447('0x47')][_0x4447('0x5c')])){if(_0x198312[_0x4447('0x47')][_0x4447('0x5c')]['length']){_0x198312['body']['tags']=_0x198312[_0x4447('0x47')]['tags'][_0x4447('0x5d')](';')+';';}else{_0x198312[_0x4447('0x47')][_0x4447('0x5c')]=null;}}else{_0x198312['body'][_0x4447('0x5c')]=null;}if(_0x198312['body']&&_['isArray'](_0x198312['body'])){for(var _0x14ed1a=0x0;_0x14ed1a<_0x198312[_0x4447('0x47')][_0x4447('0x36')];_0x14ed1a+=0x1){_0x198312['body'][_0x14ed1a][_0x4447('0x57')]=_0x198312['params']['id'];_0x58de06[_0x4447('0x5e')](_0x198312[_0x4447('0x47')][_0x14ed1a]);}return BPromise[_0x4447('0x5f')](_0x58de06,function(_0x462f49){return db[_0x4447('0x5b')][_0x4447('0x46')](_['omit'](_0x462f49,[_0x4447('0x59'),'id'])||{},{'fields':_[_0x4447('0x43')](_0xc7d98e),'raw':!![]})[_0x4447('0x25')](function(_0x488ae8){_0x512776[_0x4447('0x60')][_0x4447('0x5e')](_0x488ae8['dataValues']);})[_0x4447('0x45')](function(_0x226eca){_0x512776['errors'][_0x4447('0x5e')]({'data':_0x462f49,'error':_0x226eca[_0x4447('0x61')]});});})[_0x4447('0x25')](function(_0x46ce2a){return _0x512776;})[_0x4447('0x45')](function(_0xba65aa){return _0xba65aa;});}else{_0xf31b65[_0x4447('0x1d')](0x190)[_0x4447('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x4447('0x25')](respondWithResult(_0xf31b65,null))[_0x4447('0x45')](handleError(_0xf31b65,null));};exports[_0x4447('0x62')]=function(_0x52f6ce,_0x4daec8,_0x508b19){var _0x1eaae5;return db[_0x4447('0x2d')][_0x4447('0x4c')]({'where':{'id':_0x52f6ce[_0x4447('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4447('0x63')}]})[_0x4447('0x25')](handleEntityNotFound(_0x4daec8,null))['then'](function(_0x489bae){if(_0x489bae){_0x1eaae5=_0x489bae;return db[_0x4447('0x5b')][_0x4447('0x2e')];}})[_0x4447('0x25')](function(_0x985587){if(_0x985587){var _0x3fc1f7={};var _0x502e63={};_0x502e63[_0x4447('0x33')]=_['concat'](_['keys'](_0x985587),_['map'](_0x1eaae5[_0x4447('0x63')],function(_0x2a5143){return util[_0x4447('0x64')](_0x4447('0x65'),_0x2a5143['id']);}));_0x502e63['query']=_[_0x4447('0x43')](_0x52f6ce['query']);_0x502e63[_0x4447('0x3a')]=_[_0x4447('0x32')](_0x502e63[_0x4447('0x33')],_0x502e63[_0x4447('0x31')]);_0x3fc1f7[_0x4447('0x34')]=_[_0x4447('0x32')](_0x502e63[_0x4447('0x33')],qs['fields'](_0x52f6ce['query'][_0x4447('0x35')]));_0x3fc1f7['attributes']=_0x3fc1f7[_0x4447('0x34')]['length']?_0x3fc1f7[_0x4447('0x34')]:_0x502e63['model'];if(!_0x52f6ce[_0x4447('0x31')][_0x4447('0x37')](_0x4447('0x56'))){_0x3fc1f7[_0x4447('0x20')]=qs['limit'](_0x52f6ce[_0x4447('0x31')]['limit']);_0x3fc1f7[_0x4447('0x1f')]=qs['offset'](_0x52f6ce[_0x4447('0x31')][_0x4447('0x1f')]);}_0x3fc1f7[_0x4447('0x66')]=qs['sort'](_0x52f6ce[_0x4447('0x31')][_0x4447('0x38')]);_0x3fc1f7['where']=qs[_0x4447('0x3a')](_['pick'](_0x52f6ce[_0x4447('0x31')],_0x502e63[_0x4447('0x3a')]));_0x3fc1f7[_0x4447('0x67')]=!![];if(_0x52f6ce[_0x4447('0x31')][_0x4447('0x3d')]){_0x3fc1f7['where']=_[_0x4447('0x3c')](_0x3fc1f7[_0x4447('0x39')],{'$or':_[_0x4447('0x2c')](_0x3fc1f7[_0x4447('0x34')],function(_0x408f77){var _0x565e1e={};_0x565e1e[_0x408f77]={'$like':'%'+_0x52f6ce['query'][_0x4447('0x3d')]+'%'};return _0x565e1e;})});}_0x3fc1f7=_[_0x4447('0x3c')]({},_0x3fc1f7,_0x52f6ce[_0x4447('0x3e')]);return _0x1eaae5[_0x4447('0x62')](_0x3fc1f7);}})['then'](respondWithResult(_0x4daec8,null))[_0x4447('0x45')](handleError(_0x4daec8,null));};exports[_0x4447('0x68')]=function(_0x463b16,_0x108255,_0x1f4ddc){var _0x32459a;return db[_0x4447('0x2d')][_0x4447('0x4c')]({'where':{'id':_0x463b16[_0x4447('0x51')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4447('0x63')}]})[_0x4447('0x25')](handleEntityNotFound(_0x108255,null))[_0x4447('0x25')](function(_0x440578){if(_0x440578){_0x32459a=_0x440578;return db[_0x4447('0x5b')]['rawAttributes'];}})['then'](function(_0x4ed109){if(_0x4ed109){var _0x10cdaa={};var _0x122bd1={};_0x122bd1[_0x4447('0x33')]=_[_0x4447('0x69')](_[_0x4447('0x43')](_0x4ed109),_[_0x4447('0x2c')](_0x32459a[_0x4447('0x63')],function(_0x124618){return util['format'](_0x4447('0x65'),_0x124618['id']);}));_0x122bd1['query']=_[_0x4447('0x43')](_0x463b16[_0x4447('0x31')]);_0x122bd1[_0x4447('0x3a')]=_['intersection'](_0x122bd1[_0x4447('0x33')],_0x122bd1['query']);_0x10cdaa['attributes']=_['intersection'](_0x122bd1[_0x4447('0x33')],qs[_0x4447('0x35')](_0x463b16[_0x4447('0x31')][_0x4447('0x35')]));_0x10cdaa[_0x4447('0x34')]=_0x10cdaa[_0x4447('0x34')][_0x4447('0x36')]?_0x10cdaa[_0x4447('0x34')]:_0x122bd1[_0x4447('0x33')];if(!_0x463b16[_0x4447('0x31')][_0x4447('0x37')](_0x4447('0x56'))){_0x10cdaa[_0x4447('0x20')]=qs[_0x4447('0x20')](_0x463b16['query'][_0x4447('0x20')]);_0x10cdaa[_0x4447('0x1f')]=qs[_0x4447('0x1f')](_0x463b16[_0x4447('0x31')][_0x4447('0x1f')]);}_0x10cdaa[_0x4447('0x66')]=qs[_0x4447('0x38')](_0x463b16[_0x4447('0x31')][_0x4447('0x38')]);_0x10cdaa['where']=qs[_0x4447('0x3a')](_[_0x4447('0x3b')](_0x463b16[_0x4447('0x31')],_0x122bd1[_0x4447('0x3a')]));_0x10cdaa[_0x4447('0x67')]=!![];if(_0x463b16[_0x4447('0x31')][_0x4447('0x3d')]){_0x10cdaa['where']=_['merge'](_0x10cdaa[_0x4447('0x39')],{'$or':_[_0x4447('0x2c')](_0x10cdaa[_0x4447('0x34')],function(_0x299771){var _0x4e8639={};_0x4e8639[_0x299771]={'$like':'%'+_0x463b16[_0x4447('0x31')][_0x4447('0x3d')]+'%'};return _0x4e8639;})});}_0x10cdaa=_[_0x4447('0x3c')]({},_0x10cdaa,_0x463b16[_0x4447('0x3e')]);return _0x32459a[_0x4447('0x62')](_0x10cdaa);}})[_0x4447('0x25')](function(_0x3fb607){if(!_[_0x4447('0x6a')](_0x3fb607)){var _0x2881c6=toCsv(_0x3fb607);var _0x2c6072=Date[_0x4447('0x6b')]();fs[_0x4447('0x6c')](util[_0x4447('0x64')]('/tmp/list_%d_%s.csv',_0x32459a['id'],_0x2c6072),_0x2881c6);_0x108255[_0x4447('0x6d')](_0x4447('0x6e'),_0x4447('0x6f')+util[_0x4447('0x64')](_0x4447('0x70'),_0x32459a['id'],_0x2c6072));_0x108255[_0x4447('0x6d')](_0x4447('0x71'),_0x4447('0x72'));return _0x108255['download'](util[_0x4447('0x64')](_0x4447('0x73'),_0x32459a['id'],_0x2c6072));}else{return _0x108255['sendStatus'](0xcc);}})[_0x4447('0x45')](handleError(_0x108255,null));};exports[_0x4447('0x74')]=function(_0x53be85,_0x343e8a,_0xfda82c){var _0x27f0d5;delete _0x53be85['body']['id'];return db['CmList'][_0x4447('0x75')]({'where':{'id':_0x53be85[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x343e8a,null))[_0x4447('0x25')](function(_0x339bf6){if(_0x339bf6){return db[_0x4447('0x76')][_0x4447('0x77')](function(_0x52f9fa){return db[_0x4447('0x78')][_0x4447('0x46')](_0x53be85[_0x4447('0x47')],{'transaction':_0x52f9fa})[_0x4447('0x25')](function(_0x5c3d80){_0x27f0d5=_0x5c3d80;return _0x339bf6[_0x4447('0x79')](_0x5c3d80,{'transaction':_0x52f9fa});})[_0x4447('0x25')](function(){var _0x5188df={'type':db[_0x4447('0x7a')][_0x4447('0x7b')],'transaction':_0x52f9fa};switch(_0x53be85[_0x4447('0x47')][_0x4447('0x30')]){case _0x4447('0x7c'):_0x5188df[_0x4447('0x30')]=db[_0x4447('0x7a')][_0x4447('0x7b')];break;case _0x4447('0x7d'):_0x5188df[_0x4447('0x30')]=db['Sequelize'][_0x4447('0x7e')];break;case'switch':_0x5188df[_0x4447('0x30')]=db['Sequelize'][_0x4447('0x7f')];_0x5188df[_0x4447('0x80')]=![];break;default:}return db[_0x4447('0x76')][_0x4447('0x81')][_0x4447('0x82')](_0x4447('0x83'),util[_0x4447('0x64')](_0x4447('0x84'),_0x27f0d5['id']),_0x5188df);})[_0x4447('0x25')](function(){return _0x27f0d5;});});}})['then'](respondWithResult(_0x343e8a,null))[_0x4447('0x45')](handleError(_0x343e8a,null));};exports[_0x4447('0x85')]=function(_0x590888,_0x3b6bda,_0x36acc6){var _0x4b297a={};var _0xf02b97={};var _0x5bf98b;var _0x142beb;return db['CmList']['findOne']({'where':{'id':_0x590888[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x3b6bda,null))[_0x4447('0x25')](function(_0x89b143){if(_0x89b143){_0x5bf98b=_0x89b143;_0xf02b97[_0x4447('0x33')]=_[_0x4447('0x43')](db[_0x4447('0x78')][_0x4447('0x2e')]);_0xf02b97[_0x4447('0x31')]=_[_0x4447('0x43')](_0x590888[_0x4447('0x31')]);_0xf02b97[_0x4447('0x3a')]=_[_0x4447('0x32')](_0xf02b97[_0x4447('0x33')],_0xf02b97[_0x4447('0x31')]);_0x4b297a[_0x4447('0x34')]=_['intersection'](_0xf02b97[_0x4447('0x33')],qs[_0x4447('0x35')](_0x590888['query'][_0x4447('0x35')]));_0x4b297a[_0x4447('0x34')]=_0x4b297a[_0x4447('0x34')][_0x4447('0x36')]?_0x4b297a[_0x4447('0x34')]:_0xf02b97[_0x4447('0x33')];_0x4b297a['order']=qs[_0x4447('0x38')](_0x590888[_0x4447('0x31')][_0x4447('0x38')]);_0x4b297a['where']=qs[_0x4447('0x3a')](_[_0x4447('0x3b')](_0x590888[_0x4447('0x31')],_0xf02b97['filters']));_0x4b297a[_0x4447('0x39')]=_['merge'](_0x4b297a['where'],{'$or':[{'ListId':_0x89b143['id']},{'ListId':null}]});if(_0x590888[_0x4447('0x31')][_0x4447('0x3d')]){_0x4b297a[_0x4447('0x39')]=_[_0x4447('0x3c')](_0x4b297a[_0x4447('0x39')],{'$or':_[_0x4447('0x2c')](_0x4b297a[_0x4447('0x34')],function(_0xf4dbe0){var _0x3800fe={};_0x3800fe[_0xf4dbe0]={'$like':'%'+_0x590888[_0x4447('0x31')][_0x4447('0x3d')]+'%'};return _0x3800fe;})});}_0x4b297a=_[_0x4447('0x3c')]({},_0x4b297a,_0x590888[_0x4447('0x3e')]);return db[_0x4447('0x78')]['findAndCountAll'](_0x4b297a);}})['then'](respondWithResult(_0x3b6bda,null))[_0x4447('0x45')](handleError(_0x3b6bda,null));};exports[_0x4447('0x86')]=function(_0x4e5ae1,_0x1fef68,_0x102506){return db[_0x4447('0x2d')][_0x4447('0x4c')]({'where':{'id':_0x4e5ae1[_0x4447('0x51')]['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x1fef68,null))[_0x4447('0x25')](function(_0x495b5a){if(_0x495b5a){return _0x495b5a[_0x4447('0x86')](_0x4e5ae1[_0x4447('0x47')][_0x4447('0x59')],_[_0x4447('0x87')](_0x4e5ae1[_0x4447('0x47')],[_0x4447('0x59'),'id'])||{})[_0x4447('0x88')](function(_0x59decb){for(var _0xb30f73=0x0;_0xb30f73<_0x4e5ae1['body']['ids'][_0x4447('0x36')];_0xb30f73+=0x1){socket[_0x4447('0x89')](_0x4447('0x8a'),{'UserId':Number(_0x4e5ae1[_0x4447('0x47')][_0x4447('0x59')][_0xb30f73]),'CmListId':Number(_0x4e5ae1[_0x4447('0x51')]['id'])});}return _0x59decb;});}})[_0x4447('0x25')](respondWithResult(_0x1fef68,null))[_0x4447('0x45')](handleError(_0x1fef68,null));};exports[_0x4447('0x8b')]=function(_0x195b41,_0x18c3a5,_0x3796fd){return db[_0x4447('0x2d')]['find']({'where':{'id':_0x195b41[_0x4447('0x51')]['id']}})['then'](handleEntityNotFound(_0x18c3a5,null))[_0x4447('0x25')](function(_0x3881d9){if(_0x3881d9){return _0x3881d9['removeAgents'](_0x195b41[_0x4447('0x31')][_0x4447('0x59')])[_0x4447('0x25')](function(){if(_[_0x4447('0x8c')](_0x195b41[_0x4447('0x31')][_0x4447('0x59')])){for(var _0x49d27c=0x0;_0x49d27c<_0x195b41[_0x4447('0x31')][_0x4447('0x59')][_0x4447('0x36')];_0x49d27c+=0x1){socket['emit'](_0x4447('0x8d'),{'UserId':Number(_0x195b41[_0x4447('0x31')][_0x4447('0x59')][_0x49d27c]),'CmListId':Number(_0x195b41[_0x4447('0x51')]['id'])});}}else{socket[_0x4447('0x89')]('userCmList:remove',{'UserId':Number(_0x195b41['query']['ids']),'CmListId':Number(_0x195b41[_0x4447('0x51')]['id'])});}});}})[_0x4447('0x25')](respondWithStatusCode(_0x18c3a5,null))[_0x4447('0x45')](handleError(_0x18c3a5,null));};exports[_0x4447('0x8e')]=function(_0x5f3df7,_0x4b1b3e,_0x50058d){var _0x2ef012={};var _0x1c47b4={};var _0x3e3152;var _0x2bfbc6;return db[_0x4447('0x2d')][_0x4447('0x75')]({'where':{'id':_0x5f3df7['params']['id']}})[_0x4447('0x25')](handleEntityNotFound(_0x4b1b3e,null))[_0x4447('0x25')](function(_0x5a67ce){if(_0x5a67ce){_0x3e3152=_0x5a67ce;_0x1c47b4[_0x4447('0x33')]=_[_0x4447('0x43')](db[_0x4447('0x8f')]['rawAttributes']);_0x1c47b4[_0x4447('0x31')]=_['keys'](_0x5f3df7[_0x4447('0x31')]);_0x1c47b4[_0x4447('0x3a')]=_[_0x4447('0x32')](_0x1c47b4[_0x4447('0x33')],_0x1c47b4['query']);_0x2ef012['attributes']=_[_0x4447('0x32')](_0x1c47b4[_0x4447('0x33')],qs[_0x4447('0x35')](_0x5f3df7['query'][_0x4447('0x35')]));_0x2ef012['attributes']=_0x2ef012[_0x4447('0x34')][_0x4447('0x36')]?_0x2ef012[_0x4447('0x34')]:_0x1c47b4[_0x4447('0x33')];_0x2ef012[_0x4447('0x66')]=qs[_0x4447('0x38')](_0x5f3df7['query'][_0x4447('0x38')]);_0x2ef012[_0x4447('0x39')]=qs[_0x4447('0x3a')](_[_0x4447('0x3b')](_0x5f3df7[_0x4447('0x31')],_0x1c47b4['filters']));if(_0x5f3df7['query'][_0x4447('0x3d')]){_0x2ef012[_0x4447('0x39')]=_[_0x4447('0x3c')](_0x2ef012[_0x4447('0x39')],{'$or':_[_0x4447('0x2c')](_0x2ef012['attributes'],function(_0x359a5a){var _0x11264d={};_0x11264d[_0x359a5a]={'$like':'%'+_0x5f3df7[_0x4447('0x31')]['filter']+'%'};return _0x11264d;})});}_0x2ef012=_[_0x4447('0x3c')]({},_0x2ef012,_0x5f3df7['options']);return _0x3e3152[_0x4447('0x8e')](_0x2ef012);}})[_0x4447('0x25')](function(_0x4632f6){if(_0x4632f6){_0x2bfbc6=_0x4632f6[_0x4447('0x36')];if(!_0x5f3df7['query'][_0x4447('0x37')]('nolimit')){_0x2ef012[_0x4447('0x20')]=qs[_0x4447('0x20')](_0x5f3df7['query'][_0x4447('0x20')]);_0x2ef012[_0x4447('0x1f')]=qs[_0x4447('0x1f')](_0x5f3df7['query'][_0x4447('0x1f')]);}return _0x3e3152[_0x4447('0x8e')](_0x2ef012);}})[_0x4447('0x25')](function(_0x382328){if(_0x382328){return _0x382328?{'count':_0x2bfbc6,'rows':_0x382328}:null;}})[_0x4447('0x25')](respondWithResult(_0x4b1b3e,null))[_0x4447('0x45')](handleError(_0x4b1b3e,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d1f747d..e4c2ab3 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x2bc1d7,_0x5242f5){var _0x255810=function(_0x1784c7){while(--_0x1784c7){_0x2bc1d7['push'](_0x2bc1d7['shift']());}};_0x255810(++_0x5242f5);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x5a9017,_0x4312fc){var _0x596e52=function(_0x35843d){while(--_0x35843d){_0x5a9017['push'](_0x5a9017['shift']());}};_0x596e52(++_0x4312fc);}(_0x7217,0x19e));var _0x7721=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7217[_0x5783f4];return _0x28e380;};'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 2faee42..302dd64 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 _0xb43b=['rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash','util','api','moment','bluebird','path'];(function(_0xee88ca,_0x39abe1){var _0x3c930c=function(_0x3136e2){while(--_0x3136e2){_0xee88ca['push'](_0xee88ca['shift']());}};_0x3c930c(++_0x39abe1);}(_0xb43b,0x1b2));var _0xbb43=function(_0x26a4b2,_0x501ac9){_0x26a4b2=_0x26a4b2-0x0;var _0x5dfae7=_0xb43b[_0x26a4b2];return _0x5dfae7;};'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 +var _0xa74f=['cm_lists','../../config/logger','bluebird','request-promise','path','rimraf','./cmList.attributes','define','CmList'];(function(_0x427f38,_0x34f332){var _0x2f39d7=function(_0x593940){while(--_0x593940){_0x427f38['push'](_0x427f38['shift']());}};_0x2f39d7(++_0x34f332);}(_0xa74f,0x9a));var _0xfa74=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xa74f[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa74('0x0'))('api');var moment=require('moment');var BPromise=require(_0xfa74('0x1'));var rp=require(_0xfa74('0x2'));var fs=require('fs');var path=require(_0xfa74('0x3'));var rimraf=require(_0xfa74('0x4'));var config=require('../../config/environment');var attributes=require(_0xfa74('0x5'));module['exports']=function(_0x543cfe,_0x43dd2f){return _0x543cfe[_0xfa74('0x6')](_0xfa74('0x7'),attributes,{'tableName':_0xfa74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 71ee50e..21a4f2b 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 _0x1464=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1d6533,_0xf4e242){var _0x5a6fab=function(_0x3af1da){while(--_0x3af1da){_0x1d6533['push'](_0x1d6533['shift']());}};_0x5a6fab(++_0xf4e242);}(_0x1464,0xa0));var _0x4146=function(_0x4589fd,_0x4c6f26){_0x4589fd=_0x4589fd-0x0;var _0x44084b=_0x1464[_0x4589fd];return _0x44084b;};'use strict';var _=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var moment=require(_0x4146('0x2'));var BPromise=require('bluebird');var rs=require(_0x4146('0x3'));var fs=require('fs');var Redis=require(_0x4146('0x4'));var db=require(_0x4146('0x5'))['db'];var utils=require(_0x4146('0x6'));var logger=require(_0x4146('0x7'))(_0x4146('0x8'));var config=require(_0x4146('0x9'));var jayson=require(_0x4146('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x4146('0xb')]=_[_0x4146('0xc')](config[_0x4146('0xb')],{'host':_0x4146('0xd'),'port':0x18eb});var socket=require(_0x4146('0xe'))(new Redis(config[_0x4146('0xb')]));require(_0x4146('0xf'))['register'](socket);function respondWithRpcPromise(_0x33086e,_0x54d544,_0x2ffe71){return new BPromise(function(_0x45cbee,_0x3bfd7b){return client[_0x4146('0x10')](_0x33086e,_0x2ffe71)['then'](function(_0x27818f){logger['info'](_0x4146('0x11'),_0x54d544,_0x4146('0x12'));logger[_0x4146('0x13')](_0x4146('0x14'),_0x54d544,'request\x20sent',JSON[_0x4146('0x15')](_0x27818f));if(_0x27818f[_0x4146('0x16')]){if(_0x27818f[_0x4146('0x16')][_0x4146('0x17')]===0x1f4){logger[_0x4146('0x16')]('CmList,\x20%s,\x20%s',_0x54d544,_0x27818f[_0x4146('0x16')][_0x4146('0x18')]);return _0x3bfd7b(_0x27818f[_0x4146('0x16')]['message']);}logger['error'](_0x4146('0x11'),_0x54d544,_0x27818f[_0x4146('0x16')][_0x4146('0x18')]);return _0x45cbee(_0x27818f[_0x4146('0x16')]['message']);}else{logger['info'](_0x4146('0x11'),_0x54d544,_0x4146('0x12'));_0x45cbee(_0x27818f[_0x4146('0x19')]['message']);}})[_0x4146('0x1a')](function(_0xec3735){logger[_0x4146('0x16')]('CmList,\x20%s,\x20%s',_0x54d544,_0xec3735);_0x3bfd7b(_0xec3735);});});} \ No newline at end of file +var _0xcc08=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','then','CmList,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4744b2,_0x31a62c){var _0x21a363=function(_0x571463){while(--_0x571463){_0x4744b2['push'](_0x4744b2['shift']());}};_0x21a363(++_0x31a62c);}(_0xcc08,0x175));var _0x8cc0=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xcc08[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x8cc0('0x0'));var util=require(_0x8cc0('0x1'));var moment=require(_0x8cc0('0x2'));var BPromise=require(_0x8cc0('0x3'));var rs=require(_0x8cc0('0x4'));var fs=require('fs');var Redis=require(_0x8cc0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cc0('0x6'));var logger=require('../../config/logger')(_0x8cc0('0x7'));var config=require(_0x8cc0('0x8'));var jayson=require(_0x8cc0('0x9'));var client=jayson[_0x8cc0('0xa')]['http']({'port':0x232a});config['redis']=_[_0x8cc0('0xb')](config[_0x8cc0('0xc')],{'host':_0x8cc0('0xd'),'port':0x18eb});var socket=require(_0x8cc0('0xe'))(new Redis(config['redis']));require(_0x8cc0('0xf'))[_0x8cc0('0x10')](socket);function respondWithRpcPromise(_0x1e79ff,_0x240982,_0x3b03f1){return new BPromise(function(_0x9959c4,_0x40edc9){return client['request'](_0x1e79ff,_0x3b03f1)[_0x8cc0('0x11')](function(_0x227a0d){logger['info'](_0x8cc0('0x12'),_0x240982,_0x8cc0('0x13'));logger[_0x8cc0('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x240982,_0x8cc0('0x13'),JSON[_0x8cc0('0x15')](_0x227a0d));if(_0x227a0d[_0x8cc0('0x16')]){if(_0x227a0d[_0x8cc0('0x16')][_0x8cc0('0x17')]===0x1f4){logger[_0x8cc0('0x16')]('CmList,\x20%s,\x20%s',_0x240982,_0x227a0d[_0x8cc0('0x16')][_0x8cc0('0x18')]);return _0x40edc9(_0x227a0d[_0x8cc0('0x16')]['message']);}logger['error'](_0x8cc0('0x12'),_0x240982,_0x227a0d[_0x8cc0('0x16')][_0x8cc0('0x18')]);return _0x9959c4(_0x227a0d['error'][_0x8cc0('0x18')]);}else{logger['info'](_0x8cc0('0x12'),_0x240982,_0x8cc0('0x13'));_0x9959c4(_0x227a0d[_0x8cc0('0x19')][_0x8cc0('0x18')]);}})[_0x8cc0('0x1a')](function(_0x2a9802){logger[_0x8cc0('0x16')]('CmList,\x20%s,\x20%s',_0x240982,_0x2a9802);_0x40edc9(_0x2a9802);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 42d6c23..78d25ba 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 _0x3235=['emit','register','length','cmList:','./cmList.events','save','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3235,0x144));var _0x5323=function(_0x2cc931,_0x2a86ad){_0x2cc931=_0x2cc931-0x0;var _0x386ff0=_0x3235[_0x2cc931];return _0x386ff0;};'use strict';var CmListEvents=require(_0x5323('0x0'));var events=[_0x5323('0x1'),_0x5323('0x2'),_0x5323('0x3')];function createListener(_0x5e7fb5,_0x379c95){return function(_0x5d594e){_0x379c95[_0x5323('0x4')](_0x5e7fb5,_0x5d594e);};}function removeListener(_0x3d6635,_0x3448ce){return function(){CmListEvents['removeListener'](_0x3d6635,_0x3448ce);};}exports[_0x5323('0x5')]=function(_0x1904df){for(var _0x5ef57c=0x0,_0x2af901=events[_0x5323('0x6')];_0x5ef57c<_0x2af901;_0x5ef57c++){var _0x4e359d=events[_0x5ef57c];var _0x5b9e8e=createListener(_0x5323('0x7')+_0x4e359d,_0x1904df);CmListEvents['on'](_0x4e359d,_0x5b9e8e);}}; \ No newline at end of file +var _0x9336=['register','length','./cmList.events','save','remove','update','removeListener'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x9336,0x1ad));var _0x6933=function(_0x314ccd,_0xb410af){_0x314ccd=_0x314ccd-0x0;var _0x27ed35=_0x9336[_0x314ccd];return _0x27ed35;};'use strict';var CmListEvents=require(_0x6933('0x0'));var events=[_0x6933('0x1'),_0x6933('0x2'),_0x6933('0x3')];function createListener(_0x1f420b,_0x2a6386){return function(_0x4901a4){_0x2a6386['emit'](_0x1f420b,_0x4901a4);};}function removeListener(_0x49dbc6,_0x27afa1){return function(){CmListEvents[_0x6933('0x4')](_0x49dbc6,_0x27afa1);};}exports[_0x6933('0x5')]=function(_0x4c9df6){for(var _0x56a0b6=0x0,_0x38e737=events[_0x6933('0x6')];_0x56a0b6<_0x38e737;_0x56a0b6++){var _0x541c31=events[_0x56a0b6];var _0x2338fb=createListener('cmList:'+_0x541c31,_0x4c9df6);CmListEvents['on'](_0x541c31,_0x2338fb);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index bf835ce..aac878c 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 _0xb519=['removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/contacts','addContacts','addCustomField','addAgents','put','/:id','delete','destroy','removeDispositions'];(function(_0x1755f2,_0x20f6ac){var _0x25dfeb=function(_0x94cac1){while(--_0x94cac1){_0x1755f2['push'](_0x1755f2['shift']());}};_0x25dfeb(++_0x20f6ac);}(_0xb519,0x14c));var _0x9b51=function(_0x5a5a32,_0x1b26e1){_0x5a5a32=_0x5a5a32-0x0;var _0x27499f=_0xb519[_0x5a5a32];return _0x27499f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b51('0x0'));var timeout=require(_0x9b51('0x1'));var express=require(_0x9b51('0x2'));var router=express[_0x9b51('0x3')]();var fs_extra=require(_0x9b51('0x4'));var auth=require(_0x9b51('0x5'));var interaction=require(_0x9b51('0x6'));var config=require('../../config/environment');var controller=require(_0x9b51('0x7'));router[_0x9b51('0x8')]('/',auth[_0x9b51('0x9')](),controller[_0x9b51('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x9b51('0x8')]('/:id',auth[_0x9b51('0x9')](),controller[_0x9b51('0xb')]);router[_0x9b51('0x8')](_0x9b51('0xc'),auth[_0x9b51('0x9')](),controller[_0x9b51('0xd')]);router['get']('/:id/contacts',auth[_0x9b51('0x9')](),controller['getContacts']);router[_0x9b51('0x8')](_0x9b51('0xe'),auth['isAuthenticated'](),controller[_0x9b51('0xf')]);router[_0x9b51('0x8')](_0x9b51('0x10'),auth['isAuthenticated'](),controller[_0x9b51('0x11')]);router[_0x9b51('0x8')](_0x9b51('0x12'),auth[_0x9b51('0x9')](),controller[_0x9b51('0x13')]);router[_0x9b51('0x14')]('/',auth[_0x9b51('0x9')](),controller[_0x9b51('0x15')]);router['post'](_0x9b51('0xc'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x9b51('0x16'),auth[_0x9b51('0x9')](),controller[_0x9b51('0x17')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x9b51('0x18')]);router[_0x9b51('0x14')]('/:id/users',auth[_0x9b51('0x9')](),controller[_0x9b51('0x19')]);router[_0x9b51('0x1a')](_0x9b51('0x1b'),auth[_0x9b51('0x9')](),controller['update']);router[_0x9b51('0x1c')](_0x9b51('0x1b'),auth[_0x9b51('0x9')](),controller[_0x9b51('0x1d')]);router['delete'](_0x9b51('0xc'),auth[_0x9b51('0x9')](),controller[_0x9b51('0x1e')]);router['delete'](_0x9b51('0x12'),auth['isAuthenticated'](),controller[_0x9b51('0x1f')]);module[_0x9b51('0x20')]=router; \ No newline at end of file +var _0x47fc=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x47fc,0x123));var _0xc47f=function(_0xb9b73c,_0x11c1d5){_0xb9b73c=_0xb9b73c-0x0;var _0x2bdd53=_0x47fc[_0xb9b73c];return _0x2bdd53;};'use strict';var multer=require(_0xc47f('0x0'));var util=require(_0xc47f('0x1'));var path=require(_0xc47f('0x2'));var timeout=require(_0xc47f('0x3'));var express=require(_0xc47f('0x4'));var router=express[_0xc47f('0x5')]();var fs_extra=require(_0xc47f('0x6'));var auth=require(_0xc47f('0x7'));var interaction=require(_0xc47f('0x8'));var config=require('../../config/environment');var controller=require(_0xc47f('0x9'));router[_0xc47f('0xa')]('/',auth[_0xc47f('0xb')](),controller[_0xc47f('0xc')]);router[_0xc47f('0xa')](_0xc47f('0xd'),auth[_0xc47f('0xb')](),controller[_0xc47f('0xe')]);router[_0xc47f('0xa')](_0xc47f('0xf'),auth['isAuthenticated'](),controller[_0xc47f('0x10')]);router[_0xc47f('0xa')](_0xc47f('0x11'),auth['isAuthenticated'](),controller[_0xc47f('0x12')]);router[_0xc47f('0xa')](_0xc47f('0x13'),auth[_0xc47f('0xb')](),controller[_0xc47f('0x14')]);router[_0xc47f('0xa')](_0xc47f('0x15'),auth['isAuthenticated'](),controller[_0xc47f('0x16')]);router[_0xc47f('0xa')](_0xc47f('0x17'),auth[_0xc47f('0xb')](),controller[_0xc47f('0x18')]);router[_0xc47f('0xa')]('/:id/users',auth[_0xc47f('0xb')](),controller[_0xc47f('0x19')]);router[_0xc47f('0x1a')]('/',auth['isAuthenticated'](),controller[_0xc47f('0x1b')]);router[_0xc47f('0x1a')](_0xc47f('0x11'),auth[_0xc47f('0xb')](),controller[_0xc47f('0x1c')]);router[_0xc47f('0x1a')]('/:id/contacts',auth[_0xc47f('0xb')](),controller[_0xc47f('0x1d')]);router['post'](_0xc47f('0x17'),auth[_0xc47f('0xb')](),controller['addCustomField']);router[_0xc47f('0x1a')]('/:id/users',auth[_0xc47f('0xb')](),controller[_0xc47f('0x1e')]);router[_0xc47f('0x1f')](_0xc47f('0xf'),auth[_0xc47f('0xb')](),controller[_0xc47f('0x20')]);router[_0xc47f('0x21')]('/:id',auth[_0xc47f('0xb')](),controller[_0xc47f('0x22')]);router[_0xc47f('0x21')]('/:id/dispositions',auth[_0xc47f('0xb')](),controller[_0xc47f('0x23')]);router[_0xc47f('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0xc47f('0x24')]);module[_0xc47f('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 17e4f07..fd30a64 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 _0xe5cb=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x2be763,_0x328965){var _0x51a9a4=function(_0x4cfc6d){while(--_0x4cfc6d){_0x2be763['push'](_0x2be763['shift']());}};_0x51a9a4(++_0x328965);}(_0xe5cb,0x10b));var _0xbe5c=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0xe5cb[_0x504df1];return _0x1063b5;};'use strict';var Sequelize=require(_0xbe5c('0x0'));module[_0xbe5c('0x1')]={'name':{'type':Sequelize[_0xbe5c('0x2')],'get':function(_0x5f1dac){return this[_0xbe5c('0x3')](_0xbe5c('0x4'));}},'field':{'type':Sequelize[_0xbe5c('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xbe5c('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x9ff8=['field','STRING','exports','VIRTUAL','getDataValue'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x9ff8,0x197));var _0x89ff=function(_0xaa922f,_0x32a395){_0xaa922f=_0xaa922f-0x0;var _0x2b5e8d=_0x9ff8[_0xaa922f];return _0x2b5e8d;};'use strict';var Sequelize=require('sequelize');module[_0x89ff('0x0')]={'name':{'type':Sequelize[_0x89ff('0x1')],'get':function(_0x3a2112){return this[_0x89ff('0x2')](_0x89ff('0x3'));}},'field':{'type':Sequelize[_0x89ff('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x89ff('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x89ff('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 086e7cd..5b45598 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(_0x5bb35a,_0x8a64db){var _0x383e2d=function(_0xe96574){while(--_0xe96574){_0x5bb35a['push'](_0x5bb35a['shift']());}};_0x383e2d(++_0x8a64db);}(_0x7a54,0x106));var _0x47a5=function(_0x4101af,_0x1853c8){_0x4101af=_0x4101af-0x0;var _0x40b865=_0x7a54[_0x4101af];return _0x40b865;};'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(_0x57a30d,_0x25501a){var _0x5edadf=function(_0x48da9f){while(--_0x48da9f){_0x57a30d['push'](_0x57a30d['shift']());}};_0x5edadf(++_0x25501a);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 c0257fa..4316ebc 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 _0x6423=['api','path','rimraf','./condition.attributes','exports','define','Condition','lodash','util'];(function(_0x189cc2,_0x3a5765){var _0x1c32cf=function(_0x3df852){while(--_0x3df852){_0x189cc2['push'](_0x189cc2['shift']());}};_0x1c32cf(++_0x3a5765);}(_0x6423,0xb2));var _0x3642=function(_0xce8b6a,_0x27e084){_0xce8b6a=_0xce8b6a-0x0;var _0x2a0fea=_0x6423[_0xce8b6a];return _0x2a0fea;};'use strict';var _=require(_0x3642('0x0'));var util=require(_0x3642('0x1'));var logger=require('../../config/logger')(_0x3642('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3642('0x3'));var rimraf=require(_0x3642('0x4'));var config=require('../../config/environment');var attributes=require(_0x3642('0x5'));module[_0x3642('0x6')]=function(_0x18ac14,_0x4b4036){return _0x18ac14[_0x3642('0x7')](_0x3642('0x8'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1604=['util','api','bluebird','request-promise','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash'];(function(_0x4774f4,_0xfad33f){var _0x24ad4f=function(_0x3aacdb){while(--_0x3aacdb){_0x4774f4['push'](_0x4774f4['shift']());}};_0x24ad4f(++_0xfad33f);}(_0x1604,0x153));var _0x4160=function(_0x1c139c,_0x26177b){_0x1c139c=_0x1c139c-0x0;var _0x1c35f1=_0x1604[_0x1c139c];return _0x1c35f1;};'use strict';var _=require(_0x4160('0x0'));var util=require(_0x4160('0x1'));var logger=require('../../config/logger')(_0x4160('0x2'));var moment=require('moment');var BPromise=require(_0x4160('0x3'));var rp=require(_0x4160('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4160('0x5'));var attributes=require(_0x4160('0x6'));module[_0x4160('0x7')]=function(_0xcf96eb,_0x2b59c1){return _0xcf96eb[_0x4160('0x8')]('Condition',attributes,{'tableName':_0x4160('0x9'),'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 4791b22..be77ea8 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 _0x315c=['debug','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0xcb5fc2,_0xd0c820){var _0x56689e=function(_0x5065a4){while(--_0x5065a4){_0xcb5fc2['push'](_0xcb5fc2['shift']());}};_0x56689e(++_0xd0c820);}(_0x315c,0xa0));var _0xc315=function(_0x1fa3c3,_0x526367){_0x1fa3c3=_0x1fa3c3-0x0;var _0xbe7da7=_0x315c[_0x1fa3c3];return _0xbe7da7;};'use strict';var _=require(_0xc315('0x0'));var util=require('util');var moment=require(_0xc315('0x1'));var BPromise=require(_0xc315('0x2'));var rs=require(_0xc315('0x3'));var fs=require('fs');var Redis=require(_0xc315('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc315('0x5'));var logger=require(_0xc315('0x6'))(_0xc315('0x7'));var config=require(_0xc315('0x8'));var jayson=require(_0xc315('0x9'));var client=jayson[_0xc315('0xa')][_0xc315('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c8d30,_0x1d8bbd,_0x21a38c){return new BPromise(function(_0x4febc5,_0x87770){return client['request'](_0x5c8d30,_0x21a38c)[_0xc315('0xc')](function(_0x3ff9a8){logger[_0xc315('0xd')](_0xc315('0xe'),_0x1d8bbd,_0xc315('0xf'));logger[_0xc315('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x1d8bbd,'request\x20sent',JSON[_0xc315('0x11')](_0x3ff9a8));if(_0x3ff9a8['error']){if(_0x3ff9a8[_0xc315('0x12')][_0xc315('0x13')]===0x1f4){logger[_0xc315('0x12')](_0xc315('0xe'),_0x1d8bbd,_0x3ff9a8[_0xc315('0x12')][_0xc315('0x14')]);return _0x87770(_0x3ff9a8[_0xc315('0x12')]['message']);}logger[_0xc315('0x12')](_0xc315('0xe'),_0x1d8bbd,_0x3ff9a8[_0xc315('0x12')]['message']);return _0x4febc5(_0x3ff9a8['error'][_0xc315('0x14')]);}else{logger[_0xc315('0xd')](_0xc315('0xe'),_0x1d8bbd,_0xc315('0xf'));_0x4febc5(_0x3ff9a8['result'][_0xc315('0x14')]);}})[_0xc315('0x15')](function(_0xf5af51){logger[_0xc315('0x12')](_0xc315('0xe'),_0x1d8bbd,_0xf5af51);_0x87770(_0xf5af51);});});} \ No newline at end of file +var _0x5458=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util'];(function(_0x2d98ca,_0x3aa03f){var _0x5f125b=function(_0x21a3ff){while(--_0x21a3ff){_0x2d98ca['push'](_0x2d98ca['shift']());}};_0x5f125b(++_0x3aa03f);}(_0x5458,0x124));var _0x8545=function(_0x52313b,_0x20382a){_0x52313b=_0x52313b-0x0;var _0x4cc77e=_0x5458[_0x52313b];return _0x4cc77e;};'use strict';var _=require(_0x8545('0x0'));var util=require(_0x8545('0x1'));var moment=require(_0x8545('0x2'));var BPromise=require(_0x8545('0x3'));var rs=require(_0x8545('0x4'));var fs=require('fs');var Redis=require(_0x8545('0x5'));var db=require(_0x8545('0x6'))['db'];var utils=require(_0x8545('0x7'));var logger=require(_0x8545('0x8'))('rpc');var config=require(_0x8545('0x9'));var jayson=require(_0x8545('0xa'));var client=jayson[_0x8545('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x36dc78,_0xbda780,_0x56aba0){return new BPromise(function(_0x283821,_0x5b1449){return client[_0x8545('0xc')](_0x36dc78,_0x56aba0)[_0x8545('0xd')](function(_0x2ae9a7){logger[_0x8545('0xe')](_0x8545('0xf'),_0xbda780,_0x8545('0x10'));logger[_0x8545('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0xbda780,_0x8545('0x10'),JSON['stringify'](_0x2ae9a7));if(_0x2ae9a7[_0x8545('0x12')]){if(_0x2ae9a7[_0x8545('0x12')][_0x8545('0x13')]===0x1f4){logger[_0x8545('0x12')]('Condition,\x20%s,\x20%s',_0xbda780,_0x2ae9a7['error'][_0x8545('0x14')]);return _0x5b1449(_0x2ae9a7[_0x8545('0x12')][_0x8545('0x14')]);}logger[_0x8545('0x12')](_0x8545('0xf'),_0xbda780,_0x2ae9a7[_0x8545('0x12')][_0x8545('0x14')]);return _0x283821(_0x2ae9a7[_0x8545('0x12')][_0x8545('0x14')]);}else{logger[_0x8545('0xe')](_0x8545('0xf'),_0xbda780,_0x8545('0x10'));_0x283821(_0x2ae9a7['result']['message']);}})['catch'](function(_0x4949e1){logger[_0x8545('0x12')](_0x8545('0xf'),_0xbda780,_0x4949e1);_0x5b1449(_0x4949e1);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8164924..399f844 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 _0x5aac=['fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','delete','/:id','destroy','exports','util','path'];(function(_0x57070a,_0x22b7c6){var _0x50e130=function(_0x4b72f3){while(--_0x4b72f3){_0x57070a['push'](_0x57070a['shift']());}};_0x50e130(++_0x22b7c6);}(_0x5aac,0xee));var _0xc5aa=function(_0x5410d0,_0xcb3bda){_0x5410d0=_0x5410d0-0x0;var _0x225a7d=_0x5aac[_0x5410d0];return _0x225a7d;};'use strict';var multer=require('multer');var util=require(_0xc5aa('0x0'));var path=require(_0xc5aa('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xc5aa('0x2'));var auth=require(_0xc5aa('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc5aa('0x4'));var controller=require('./condition.controller');router['put']('/:id',auth[_0xc5aa('0x5')](),controller['update']);router[_0xc5aa('0x6')](_0xc5aa('0x7'),auth[_0xc5aa('0x5')](),controller[_0xc5aa('0x8')]);module[_0xc5aa('0x9')]=router; \ No newline at end of file +var _0x1357=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put','/:id','isAuthenticated','update','destroy'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x1357,0x1b3));var _0x7135=function(_0x3e1ce2,_0x4c886c){_0x3e1ce2=_0x3e1ce2-0x0;var _0x1920e4=_0x1357[_0x3e1ce2];return _0x1920e4;};'use strict';var multer=require(_0x7135('0x0'));var util=require(_0x7135('0x1'));var path=require(_0x7135('0x2'));var timeout=require('connect-timeout');var express=require(_0x7135('0x3'));var router=express[_0x7135('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7135('0x5'));var interaction=require(_0x7135('0x6'));var config=require('../../config/environment');var controller=require(_0x7135('0x7'));router[_0x7135('0x8')](_0x7135('0x9'),auth[_0x7135('0xa')](),controller[_0x7135('0xb')]);router['delete'](_0x7135('0x9'),auth['isAuthenticated'](),controller[_0x7135('0xc')]);module[_0x7135('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index af81aca..c10ea9b 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 _0xbaf0=['name','exports','STRING'];(function(_0x4aa4e6,_0x278c45){var _0x322588=function(_0x19279d){while(--_0x19279d){_0x4aa4e6['push'](_0x4aa4e6['shift']());}};_0x322588(++_0x278c45);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x0713=['STRING','name'];(function(_0x56cae1,_0x53ffc2){var _0x19f70e=function(_0xe9c273){while(--_0xe9c273){_0x56cae1['push'](_0x56cae1['shift']());}};_0x19f70e(++_0x53ffc2);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index dc6befe..7c46524 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 _0x48a0=['redis','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','CustomDashboards','error','name','send','index','map','Dashboard','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','params','rawAttributes','include','find','catch','create','user','role','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults'];(function(_0x5b29e2,_0x5baa43){var _0x42f6a0=function(_0x4bc56a){while(--_0x4bc56a){_0x5b29e2['push'](_0x5b29e2['shift']());}};_0x42f6a0(++_0x5baa43);}(_0x48a0,0xf2));var _0x048a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x48a0[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x048a('0x0'));var rimraf=require(_0x048a('0x1'));var zipdir=require(_0x048a('0x2'));var jsonpatch=require(_0x048a('0x3'));var rp=require(_0x048a('0x4'));var moment=require(_0x048a('0x5'));var BPromise=require(_0x048a('0x6'));var Mustache=require(_0x048a('0x7'));var util=require(_0x048a('0x8'));var path=require(_0x048a('0x9'));var sox=require(_0x048a('0xa'));var csv=require(_0x048a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x048a('0xc'));var _=require(_0x048a('0xd'));var squel=require(_0x048a('0xe'));var crypto=require(_0x048a('0xf'));var jsforce=require(_0x048a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x048a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x048a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x048a('0x12'));var as=require(_0x048a('0x13'));var hardwareService=require(_0x048a('0x14'));var logger=require('../../config/logger')(_0x048a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x048a('0x16'))['db'];config['redis']=_[_0x048a('0x17')](config[_0x048a('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x048a('0x19'))(new Redis(config['redis']));require(_0x048a('0x1a'))[_0x048a('0x1b')](socket);function respondWithStatusCode(_0x23be33,_0x2c31cc){_0x2c31cc=_0x2c31cc||0xcc;return function(_0x47fbee){if(_0x47fbee){return _0x23be33[_0x048a('0x1c')](_0x2c31cc);}return _0x23be33[_0x048a('0x1d')](_0x2c31cc)[_0x048a('0x1e')]();};}function respondWithResult(_0x5a2d83,_0x52557b){_0x52557b=_0x52557b||0xc8;return function(_0x112796){if(_0x112796){return _0x5a2d83[_0x048a('0x1d')](_0x52557b)[_0x048a('0x1f')](_0x112796);}};}function respondWithFilteredResult(_0x1d1ee7,_0x376d46){return function(_0x336dd7){if(_0x336dd7){var _0x56c545=typeof _0x376d46['offset']===_0x048a('0x20')&&typeof _0x376d46[_0x048a('0x21')]===_0x048a('0x20');var _0x115fbe=_0x336dd7[_0x048a('0x22')];var _0x327069=_0x56c545?0x0:_0x376d46[_0x048a('0x23')];var _0xc7e4fe=_0x56c545?_0x336dd7['count']:_0x376d46['offset']+_0x376d46[_0x048a('0x21')];var _0x229ba6;if(_0xc7e4fe>=_0x115fbe){_0xc7e4fe=_0x115fbe;_0x229ba6=0xc8;}else{_0x229ba6=0xce;}_0x1d1ee7[_0x048a('0x1d')](_0x229ba6);return _0x1d1ee7[_0x048a('0x24')](_0x048a('0x25'),_0x327069+'-'+_0xc7e4fe+'/'+_0x115fbe)['json'](_0x336dd7);}return null;};}function patchUpdates(_0x2ef657){return function(_0xc62b21){try{jsonpatch[_0x048a('0x26')](_0xc62b21,_0x2ef657,!![]);}catch(_0x3c4a50){return BPromise[_0x048a('0x27')](_0x3c4a50);}return _0xc62b21[_0x048a('0x28')]();};}function saveUpdates(_0x341abd,_0x1a51db){return function(_0x17d271){if(_0x17d271){return _0x17d271['update'](_0x341abd)[_0x048a('0x29')](function(_0x501086){return _0x501086;});}return null;};}function removeEntity(_0x278d7a,_0x26714e){return function(_0x47d689){if(_0x47d689){return _0x47d689[_0x048a('0x2a')]()[_0x048a('0x29')](function(){var _0xb0e793=_0x47d689[_0x048a('0x2b')]({'plain':!![]});var _0x13e618=_0x048a('0x2c');return db['UserProfileResource'][_0x048a('0x2a')]({'where':{'type':_0x13e618,'resourceId':_0xb0e793['id']}})[_0x048a('0x29')](function(){return _0x47d689;});})['then'](function(){_0x278d7a[_0x048a('0x1d')](0xcc)[_0x048a('0x1e')]();});}};}function handleEntityNotFound(_0x3db1c4,_0x3e7255){return function(_0x1c90c5){if(!_0x1c90c5){_0x3db1c4[_0x048a('0x1c')](0x194);}return _0x1c90c5;};}function handleError(_0x1c0619,_0x42fb4b){_0x42fb4b=_0x42fb4b||0x1f4;return function(_0x1b7b11){logger[_0x048a('0x2d')](_0x1b7b11['stack']);if(_0x1b7b11[_0x048a('0x2e')]){delete _0x1b7b11[_0x048a('0x2e')];}_0x1c0619[_0x048a('0x1d')](_0x42fb4b)[_0x048a('0x2f')](_0x1b7b11);};}exports[_0x048a('0x30')]=function(_0x262423,_0x39c873){var _0x27da88={},_0x21a3ea={},_0x559081={'count':0x0,'rows':[]};var _0x2397b3=_[_0x048a('0x31')](db[_0x048a('0x32')]['rawAttributes'],function(_0x3f2cea){return{'name':_0x3f2cea['fieldName'],'type':_0x3f2cea[_0x048a('0x33')][_0x048a('0x34')]};});_0x21a3ea[_0x048a('0x35')]=_[_0x048a('0x31')](_0x2397b3,_0x048a('0x2e'));_0x21a3ea[_0x048a('0x36')]=_[_0x048a('0x37')](_0x262423['query']);_0x21a3ea[_0x048a('0x38')]=_[_0x048a('0x39')](_0x21a3ea[_0x048a('0x35')],_0x21a3ea[_0x048a('0x36')]);_0x27da88[_0x048a('0x3a')]=_[_0x048a('0x39')](_0x21a3ea[_0x048a('0x35')],qs[_0x048a('0x3b')](_0x262423[_0x048a('0x36')][_0x048a('0x3b')]));_0x27da88[_0x048a('0x3a')]=_0x27da88[_0x048a('0x3a')][_0x048a('0x3c')]?_0x27da88[_0x048a('0x3a')]:_0x21a3ea[_0x048a('0x35')];if(!_0x262423[_0x048a('0x36')]['hasOwnProperty'](_0x048a('0x3d'))){_0x27da88[_0x048a('0x21')]=qs['limit'](_0x262423[_0x048a('0x36')]['limit']);_0x27da88[_0x048a('0x23')]=qs[_0x048a('0x23')](_0x262423['query'][_0x048a('0x23')]);}_0x27da88[_0x048a('0x3e')]=qs['sort'](_0x262423[_0x048a('0x36')][_0x048a('0x3f')]);_0x27da88[_0x048a('0x40')]=qs['filters'](_[_0x048a('0x41')](_0x262423[_0x048a('0x36')],_0x21a3ea['filters']),_0x2397b3);if(_0x262423[_0x048a('0x36')][_0x048a('0x42')]){_0x27da88['where']=_[_0x048a('0x43')](_0x27da88[_0x048a('0x40')],{'$or':_['map'](_0x2397b3,function(_0x1af037){if(_0x1af037[_0x048a('0x33')]!==_0x048a('0x44')){var _0x3130b7={};_0x3130b7[_0x1af037[_0x048a('0x2e')]]={'$like':'%'+_0x262423[_0x048a('0x36')]['filter']+'%'};return _0x3130b7;}})});}_0x27da88=_[_0x048a('0x43')]({},_0x27da88,_0x262423['options']);var _0x2570db={'where':_0x27da88['where']};return db[_0x048a('0x32')][_0x048a('0x22')](_0x2570db)['then'](function(_0x5e9911){_0x559081[_0x048a('0x22')]=_0x5e9911;if(_0x262423['query'][_0x048a('0x45')]){_0x27da88['include']=[{'all':!![]}];}return db['Dashboard'][_0x048a('0x46')](_0x27da88);})[_0x048a('0x29')](function(_0x48c40c){_0x559081['rows']=_0x48c40c;return _0x559081;})['then'](respondWithFilteredResult(_0x39c873,_0x27da88))['catch'](handleError(_0x39c873,null));};exports[_0x048a('0x47')]=function(_0x3f0826,_0x1eaadb){var _0x5b5186={'raw':![],'where':{'id':_0x3f0826[_0x048a('0x48')]['id']}},_0x1db81f={};_0x1db81f[_0x048a('0x35')]=_[_0x048a('0x37')](db[_0x048a('0x32')][_0x048a('0x49')]);_0x1db81f[_0x048a('0x36')]=_[_0x048a('0x37')](_0x3f0826[_0x048a('0x36')]);_0x1db81f['filters']=_[_0x048a('0x39')](_0x1db81f['model'],_0x1db81f[_0x048a('0x36')]);_0x5b5186['attributes']=_['intersection'](_0x1db81f[_0x048a('0x35')],qs[_0x048a('0x3b')](_0x3f0826[_0x048a('0x36')][_0x048a('0x3b')]));_0x5b5186[_0x048a('0x3a')]=_0x5b5186[_0x048a('0x3a')][_0x048a('0x3c')]?_0x5b5186[_0x048a('0x3a')]:_0x1db81f[_0x048a('0x35')];if(_0x3f0826[_0x048a('0x36')][_0x048a('0x45')]){_0x5b5186[_0x048a('0x4a')]=[{'all':!![]}];}_0x5b5186=_['merge']({},_0x5b5186,_0x3f0826['options']);return db[_0x048a('0x32')][_0x048a('0x4b')](_0x5b5186)[_0x048a('0x29')](handleEntityNotFound(_0x1eaadb,null))[_0x048a('0x29')](respondWithResult(_0x1eaadb,null))[_0x048a('0x4c')](handleError(_0x1eaadb,null));};exports[_0x048a('0x4d')]=function(_0x430f10,_0x5d6876){return db[_0x048a('0x32')][_0x048a('0x4d')](_0x430f10['body'],{})[_0x048a('0x29')](function(_0x3247a7){var _0x5322c1=_0x430f10[_0x048a('0x4e')]['get']({'plain':!![]});if(!_0x5322c1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5322c1[_0x048a('0x4f')]===_0x048a('0x4e')){var _0xce5d88=_0x3247a7['get']({'plain':!![]});var _0x3e0e80=_0x048a('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x3e0e80,'userProfileId':_0x5322c1['userProfileId']},'raw':!![]})['then'](function(_0x10816b){if(_0x10816b&&_0x10816b['autoAssociation']===0x0){return db[_0x048a('0x50')][_0x048a('0x4d')]({'name':_0xce5d88[_0x048a('0x2e')],'resourceId':_0xce5d88['id'],'type':_0x10816b[_0x048a('0x2e')],'sectionId':_0x10816b['id']},{})[_0x048a('0x29')](function(){return _0x3247a7;});}else{return _0x3247a7;}})[_0x048a('0x4c')](function(_0xcb61ad){logger[_0x048a('0x2d')](_0x048a('0x51'),_0xcb61ad);throw _0xcb61ad;});}return _0x3247a7;})[_0x048a('0x29')](respondWithResult(_0x5d6876,0xc9))[_0x048a('0x4c')](handleError(_0x5d6876,null));};exports[_0x048a('0x52')]=function(_0x120547,_0x22307b){var _0x48f472={'where':{'id':_0x120547['params']['id']}},_0x2fa715={};_0x2fa715[_0x048a('0x35')]=_[_0x048a('0x37')](db[_0x048a('0x32')][_0x048a('0x49')]);_0x48f472['attributes']=_[_0x048a('0x39')](_0x2fa715['model'],qs[_0x048a('0x3b')](_0x120547[_0x048a('0x36')][_0x048a('0x3b')]));_0x48f472[_0x048a('0x3a')]=_0x48f472[_0x048a('0x3a')]['length']?_0x48f472[_0x048a('0x3a')]:_0x2fa715[_0x048a('0x35')];if(_0x120547[_0x048a('0x36')]['includeAll']){_0x48f472[_0x048a('0x4a')]=[{'all':!![]}];}_0x48f472=_['merge']({},_0x48f472,_0x120547[_0x048a('0x53')]);return db[_0x048a('0x32')][_0x048a('0x4b')](_0x48f472)[_0x048a('0x29')](handleEntityNotFound(_0x22307b,null))[_0x048a('0x29')](function(_0x23cbdf){if(_0x23cbdf){var _0x3ea9b3=_0x23cbdf['get']({'plain':!![]});_0x3ea9b3=qs['omit'](_0x3ea9b3,['id',_0x048a('0x54'),_0x048a('0x55')]);_0x120547[_0x048a('0x56')]=_['omit'](_0x120547['body'],['id',_0x048a('0x54'),'updatedAt']);return db[_0x048a('0x32')][_0x048a('0x4d')](_[_0x048a('0x43')](_0x3ea9b3,_0x120547[_0x048a('0x56')]),{'include':_0x120547[_0x048a('0x36')][_0x048a('0x45')]?[{'all':!![]}]:undefined})[_0x048a('0x29')](function(_0x3f2aaf){var _0x3b1188=_0x120547[_0x048a('0x4e')][_0x048a('0x2b')]({'plain':!![]});if(!_0x3b1188)throw new Error(_0x048a('0x57'));if(_0x3b1188[_0x048a('0x4f')]===_0x048a('0x4e')){var _0x491ba5=_0x3f2aaf['get']({'plain':!![]});var _0x4d520f=_0x048a('0x2c');return db[_0x048a('0x58')][_0x048a('0x4b')]({'where':{'name':_0x4d520f,'userProfileId':_0x3b1188[_0x048a('0x59')]},'raw':!![]})[_0x048a('0x29')](function(_0x286b4a){if(_0x286b4a&&_0x286b4a[_0x048a('0x5a')]===0x0){return db[_0x048a('0x50')][_0x048a('0x4d')]({'name':_0x491ba5[_0x048a('0x2e')],'resourceId':_0x491ba5['id'],'type':_0x286b4a[_0x048a('0x2e')],'sectionId':_0x286b4a['id']},{})[_0x048a('0x29')](function(){return _0x3f2aaf;});}else{return _0x3f2aaf;}})[_0x048a('0x4c')](function(_0xc9b17e){logger[_0x048a('0x2d')](_0x048a('0x51'),_0xc9b17e);throw _0xc9b17e;});}return _0x3f2aaf;});}})[_0x048a('0x29')](respondWithResult(_0x22307b,0xc9))[_0x048a('0x4c')](handleError(_0x22307b,null));};exports[_0x048a('0x5b')]=function(_0x3a29ca,_0x901e88){if(_0x3a29ca[_0x048a('0x56')]['id']){delete _0x3a29ca[_0x048a('0x56')]['id'];}return db[_0x048a('0x32')][_0x048a('0x4b')]({'where':{'id':_0x3a29ca[_0x048a('0x48')]['id']}})[_0x048a('0x29')](handleEntityNotFound(_0x901e88,null))['then'](saveUpdates(_0x3a29ca[_0x048a('0x56')],null))[_0x048a('0x29')](respondWithResult(_0x901e88,null))['catch'](handleError(_0x901e88,null));};exports['destroy']=function(_0x16f96e,_0x16cd47){return db['Dashboard']['find']({'where':{'id':_0x16f96e[_0x048a('0x48')]['id']}})[_0x048a('0x29')](handleEntityNotFound(_0x16cd47,null))[_0x048a('0x29')](removeEntity(_0x16cd47,null))['catch'](handleError(_0x16cd47,null));};function widgetAttributes(_0xce5656){try{switch(_0xce5656[_0x048a('0x33')]){case _0x048a('0x5c'):return[{'name':_0x048a('0x5d'),'value':_0xce5656[_0x048a('0x5d')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x0]?_0xce5656[_0x048a('0x5e')][0x0][_0x048a('0x5f')]:undefined)||_0x048a('0x60')}];case _0x048a('0x61'):return[{'name':_0x048a('0x62'),'value':_0xce5656[_0x048a('0x62')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x0]?_0xce5656[_0x048a('0x5e')][0x0][_0x048a('0x5f')]:undefined)||''}];case _0x048a('0x63'):return[{'name':_0x048a('0x64'),'value':_0xce5656[_0x048a('0x64')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x0]?_0xce5656[_0x048a('0x5e')][0x0]['value']:undefined)||_0x048a('0x65')},{'name':_0x048a('0x66'),'value':_0xce5656[_0x048a('0x66')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x1]?_0xce5656[_0x048a('0x5e')][0x1]['value']:undefined)||_0x048a('0x67')},{'name':_0x048a('0x68'),'value':_0xce5656[_0x048a('0x68')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x2]?_0xce5656['attrs'][0x2][_0x048a('0x5f')]:undefined)||0xc}];case _0x048a('0x69'):return[{'name':_0x048a('0x6a'),'value':_0xce5656[_0x048a('0x6a')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x0]?_0xce5656['attrs'][0x0][_0x048a('0x5f')]:undefined)||_0x048a('0x6b')},{'name':'attrVoiceQueues','value':_0xce5656[_0x048a('0x6c')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x1]?_0xce5656[_0x048a('0x5e')][0x1][_0x048a('0x5f')]:undefined)||[]},{'name':'attrFontSize','value':_0xce5656[_0x048a('0x68')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x2]?_0xce5656[_0x048a('0x5e')][0x2][_0x048a('0x5f')]:undefined)||0x14},{'name':_0x048a('0x6d'),'value':_0xce5656[_0x048a('0x6d')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x3]?_0xce5656[_0x048a('0x5e')][0x3][_0x048a('0x5f')]:undefined)||_0x048a('0x6e')},{'name':'attrEmailAccounts','value':_0xce5656[_0x048a('0x6f')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x4]?_0xce5656[_0x048a('0x5e')][0x4][_0x048a('0x5f')]:undefined)||''},{'name':_0x048a('0x70'),'value':_0xce5656['attrFaxAccounts']||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x5]?_0xce5656[_0x048a('0x5e')][0x5][_0x048a('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0xce5656[_0x048a('0x71')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x6]?_0xce5656[_0x048a('0x5e')][0x6]['value']:undefined)||''},{'name':_0x048a('0x72'),'value':_0xce5656['attrOpenchannelAccounts']||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x7]?_0xce5656[_0x048a('0x5e')][0x7][_0x048a('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xce5656[_0x048a('0x73')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x8]?_0xce5656[_0x048a('0x5e')][0x8][_0x048a('0x5f')]:undefined)||''},{'name':'attrChatWebsites','value':_0xce5656[_0x048a('0x74')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x9]?_0xce5656['attrs'][0x9][_0x048a('0x5f')]:undefined)||''}];case _0x048a('0x75'):case _0x048a('0x76'):return[{'name':_0x048a('0x77'),'value':_0xce5656[_0x048a('0x77')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x0]?_0xce5656[_0x048a('0x5e')][0x0][_0x048a('0x5f')]:undefined)||_0x048a('0x6b')},{'name':'attrSerie2','value':_0xce5656[_0x048a('0x78')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x1]?_0xce5656['attrs'][0x1][_0x048a('0x5f')]:undefined)||null},{'name':_0x048a('0x79'),'value':_0xce5656['attrSerie3']||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x2]?_0xce5656['attrs'][0x2][_0x048a('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xce5656[_0x048a('0x6c')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x3]?_0xce5656[_0x048a('0x5e')][0x3]['value']:undefined)||[]},{'name':_0x048a('0x6d'),'value':_0xce5656[_0x048a('0x6d')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x4]?_0xce5656['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x048a('0x6f'),'value':_0xce5656[_0x048a('0x6f')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x5]?_0xce5656[_0x048a('0x5e')][0x5][_0x048a('0x5f')]:undefined)||''},{'name':_0x048a('0x70'),'value':_0xce5656[_0x048a('0x70')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x6]?_0xce5656['attrs'][0x6][_0x048a('0x5f')]:undefined)||''},{'name':_0x048a('0x71'),'value':_0xce5656[_0x048a('0x71')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x7]?_0xce5656['attrs'][0x7][_0x048a('0x5f')]:undefined)||''},{'name':_0x048a('0x72'),'value':_0xce5656[_0x048a('0x72')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0x8]?_0xce5656[_0x048a('0x5e')][0x8][_0x048a('0x5f')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0xce5656[_0x048a('0x73')]||(_0xce5656['attrs']&&_0xce5656[_0x048a('0x5e')][0x9]?_0xce5656[_0x048a('0x5e')][0x9][_0x048a('0x5f')]:undefined)||''},{'name':'attrChatWebsites','value':_0xce5656[_0x048a('0x74')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656['attrs'][0xa]?_0xce5656['attrs'][0xa][_0x048a('0x5f')]:undefined)||''}];case _0x048a('0x7a'):return[{'name':_0x048a('0x7b'),'type':_0xce5656[_0x048a('0x7c')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x0]?_0xce5656[_0x048a('0x5e')][0x0][_0x048a('0x33')]:undefined)||null,'value':_0xce5656[_0x048a('0x7b')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x0]?_0xce5656['attrs'][0x0][_0x048a('0x5f')]:undefined)||null},{'name':_0x048a('0x7d'),'value':_0xce5656[_0x048a('0x7d')]||(_0xce5656[_0x048a('0x5e')]&&_0xce5656[_0x048a('0x5e')][0x1]?_0xce5656['attrs'][0x1][_0x048a('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x564fae){logger[_0x048a('0x2d')]('widgetAttributes:\x20%s',JSON[_0x048a('0x7e')](_0x564fae));return[];}}exports[_0x048a('0x7f')]=function(_0x96e5ae,_0x282eb1,_0xd7b13b){if(_0x96e5ae[_0x048a('0x56')]['id']){delete _0x96e5ae[_0x048a('0x56')]['id'];}return db[_0x048a('0x32')][_0x048a('0x4b')]({'where':{'id':_0x96e5ae[_0x048a('0x48')]['id']}})[_0x048a('0x29')](handleEntityNotFound(_0x282eb1,null))[_0x048a('0x29')](function(_0x5d80b6){if(_0x5d80b6){_0x96e5ae[_0x048a('0x56')][_0x048a('0x80')]=_0x5d80b6['id'];_0x96e5ae['body'][_0x048a('0x5e')]=widgetAttributes(_0x96e5ae[_0x048a('0x56')]);return db[_0x048a('0x81')][_0x048a('0x4d')](_0x96e5ae[_0x048a('0x56')]);}})[_0x048a('0x29')](respondWithResult(_0x282eb1,null))[_0x048a('0x4c')](handleError(_0x282eb1,null));};exports[_0x048a('0x82')]=function(_0x65780c,_0xda5df6,_0x5ba02f){var _0x2668c6={};var _0x178b29={};var _0x226a9f;var _0x1fccc4;return db[_0x048a('0x32')][_0x048a('0x83')]({'where':{'id':_0x65780c[_0x048a('0x48')]['id']}})[_0x048a('0x29')](handleEntityNotFound(_0xda5df6,null))['then'](function(_0x59ed26){if(_0x59ed26){_0x226a9f=_0x59ed26;_0x178b29[_0x048a('0x35')]=_[_0x048a('0x37')](db[_0x048a('0x81')]['rawAttributes']);_0x178b29[_0x048a('0x36')]=_['keys'](_0x65780c[_0x048a('0x36')]);_0x178b29[_0x048a('0x38')]=_[_0x048a('0x39')](_0x178b29['model'],_0x178b29[_0x048a('0x36')]);_0x2668c6[_0x048a('0x3a')]=_['intersection'](_0x178b29[_0x048a('0x35')],qs[_0x048a('0x3b')](_0x65780c[_0x048a('0x36')][_0x048a('0x3b')]));_0x2668c6['attributes']=_0x2668c6[_0x048a('0x3a')][_0x048a('0x3c')]?_0x2668c6[_0x048a('0x3a')]:_0x178b29[_0x048a('0x35')];_0x2668c6[_0x048a('0x3e')]=qs['sort'](_0x65780c[_0x048a('0x36')][_0x048a('0x3f')]);_0x2668c6['where']=qs['filters'](_[_0x048a('0x41')](_0x65780c['query'],_0x178b29['filters']));if(_0x65780c['query']['filter']){_0x2668c6['where']=_[_0x048a('0x43')](_0x2668c6['where'],{'$or':_['map'](_0x2668c6['attributes'],function(_0x5eac27){var _0x4fbb82={};_0x4fbb82[_0x5eac27]={'$like':'%'+_0x65780c[_0x048a('0x36')][_0x048a('0x42')]+'%'};return _0x4fbb82;})});}_0x2668c6=_[_0x048a('0x43')]({},_0x2668c6,_0x65780c['options']);return _0x226a9f['getItems'](_0x2668c6);}})['then'](function(_0x2acda6){if(_0x2acda6){_0x1fccc4=_0x2acda6[_0x048a('0x3c')];if(!_0x65780c['query'][_0x048a('0x84')](_0x048a('0x3d'))){_0x2668c6['limit']=qs['limit'](_0x65780c['query'][_0x048a('0x21')]);_0x2668c6['offset']=qs[_0x048a('0x23')](_0x65780c['query'][_0x048a('0x23')]);}return _0x226a9f[_0x048a('0x82')](_0x2668c6);}})['then'](function(_0x140f3a){if(_0x140f3a){return _0x140f3a?{'count':_0x1fccc4,'rows':_0x140f3a}:null;}})[_0x048a('0x29')](respondWithResult(_0xda5df6,null))[_0x048a('0x4c')](handleError(_0xda5df6,null));}; \ No newline at end of file +var _0x6e27=['redis','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','get','CustomDashboards','UserProfileResource','destroy','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','type','VIRTUAL','options','Dashboard','count','include','findAll','rows','catch','show','merge','create','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','includeAll','omit','createdAt','body','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','find','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','DashboardItem','filter','nolimit','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','defaults'];(function(_0x2a5b54,_0x409fc8){var _0x38baaf=function(_0x40c259){while(--_0x40c259){_0x2a5b54['push'](_0x2a5b54['shift']());}};_0x38baaf(++_0x409fc8);}(_0x6e27,0x168));var _0x76e2=function(_0x5df9f9,_0x392ebb){_0x5df9f9=_0x5df9f9-0x0;var _0x496e24=_0x6e27[_0x5df9f9];return _0x496e24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x76e2('0x1'));var rp=require(_0x76e2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x76e2('0x3'));var util=require(_0x76e2('0x4'));var path=require(_0x76e2('0x5'));var sox=require(_0x76e2('0x6'));var csv=require(_0x76e2('0x7'));var ejs=require(_0x76e2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76e2('0x9'));var squel=require('squel');var crypto=require(_0x76e2('0xa'));var jsforce=require(_0x76e2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x76e2('0x7'));var querystring=require(_0x76e2('0xc'));var Papa=require(_0x76e2('0xd'));var Redis=require(_0x76e2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x76e2('0xf'));var as=require(_0x76e2('0x10'));var hardwareService=require(_0x76e2('0x11'));var logger=require('../../config/logger')(_0x76e2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x76e2('0x13'))['db'];config['redis']=_[_0x76e2('0x14')](config[_0x76e2('0x15')],{'host':_0x76e2('0x16'),'port':0x18eb});var socket=require(_0x76e2('0x17'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0xeb8fbb,_0x43159d){_0x43159d=_0x43159d||0xcc;return function(_0xa94178){if(_0xa94178){return _0xeb8fbb[_0x76e2('0x18')](_0x43159d);}return _0xeb8fbb['status'](_0x43159d)[_0x76e2('0x19')]();};}function respondWithResult(_0x507b55,_0x9fdf14){_0x9fdf14=_0x9fdf14||0xc8;return function(_0x1a9142){if(_0x1a9142){return _0x507b55[_0x76e2('0x1a')](_0x9fdf14)['json'](_0x1a9142);}};}function respondWithFilteredResult(_0x5e0c7d,_0x39a539){return function(_0x3d123e){if(_0x3d123e){var _0x15973d=typeof _0x39a539[_0x76e2('0x1b')]===_0x76e2('0x1c')&&typeof _0x39a539[_0x76e2('0x1d')]==='undefined';var _0x4a2b7b=_0x3d123e['count'];var _0x364fb2=_0x15973d?0x0:_0x39a539[_0x76e2('0x1b')];var _0xa1e30=_0x15973d?_0x3d123e['count']:_0x39a539[_0x76e2('0x1b')]+_0x39a539[_0x76e2('0x1d')];var _0x2e76b0;if(_0xa1e30>=_0x4a2b7b){_0xa1e30=_0x4a2b7b;_0x2e76b0=0xc8;}else{_0x2e76b0=0xce;}_0x5e0c7d['status'](_0x2e76b0);return _0x5e0c7d[_0x76e2('0x1e')](_0x76e2('0x1f'),_0x364fb2+'-'+_0xa1e30+'/'+_0x4a2b7b)[_0x76e2('0x20')](_0x3d123e);}return null;};}function patchUpdates(_0x3bcd3f){return function(_0x146a32){try{jsonpatch[_0x76e2('0x21')](_0x146a32,_0x3bcd3f,!![]);}catch(_0x44a3d8){return BPromise[_0x76e2('0x22')](_0x44a3d8);}return _0x146a32['save']();};}function saveUpdates(_0x379c3e,_0x30f6de){return function(_0x3c7287){if(_0x3c7287){return _0x3c7287[_0x76e2('0x23')](_0x379c3e)[_0x76e2('0x24')](function(_0x5e95c8){return _0x5e95c8;});}return null;};}function removeEntity(_0x238ea9,_0x294e35){return function(_0x369f27){if(_0x369f27){return _0x369f27['destroy']()[_0x76e2('0x24')](function(){var _0x22bfeb=_0x369f27[_0x76e2('0x25')]({'plain':!![]});var _0x2465c3=_0x76e2('0x26');return db[_0x76e2('0x27')][_0x76e2('0x28')]({'where':{'type':_0x2465c3,'resourceId':_0x22bfeb['id']}})[_0x76e2('0x24')](function(){return _0x369f27;});})[_0x76e2('0x24')](function(){_0x238ea9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x132ad4,_0x3c4858){return function(_0x14cfa9){if(!_0x14cfa9){_0x132ad4[_0x76e2('0x18')](0x194);}return _0x14cfa9;};}function handleError(_0x407e54,_0x4a4259){_0x4a4259=_0x4a4259||0x1f4;return function(_0x42e4f1){logger['error'](_0x42e4f1['stack']);if(_0x42e4f1[_0x76e2('0x29')]){delete _0x42e4f1['name'];}_0x407e54[_0x76e2('0x1a')](_0x4a4259)[_0x76e2('0x2a')](_0x42e4f1);};}exports[_0x76e2('0x2b')]=function(_0x311b76,_0x46ecea){var _0x4c498f={},_0x30afcf={},_0x1f66ec={'count':0x0,'rows':[]};var _0x341724=_['map'](db['Dashboard'][_0x76e2('0x2c')],function(_0x2c8fd4){return{'name':_0x2c8fd4[_0x76e2('0x2d')],'type':_0x2c8fd4['type'][_0x76e2('0x2e')]};});_0x30afcf[_0x76e2('0x2f')]=_[_0x76e2('0x30')](_0x341724,_0x76e2('0x29'));_0x30afcf[_0x76e2('0x31')]=_[_0x76e2('0x32')](_0x311b76[_0x76e2('0x31')]);_0x30afcf['filters']=_[_0x76e2('0x33')](_0x30afcf['model'],_0x30afcf[_0x76e2('0x31')]);_0x4c498f['attributes']=_['intersection'](_0x30afcf['model'],qs['fields'](_0x311b76[_0x76e2('0x31')][_0x76e2('0x34')]));_0x4c498f['attributes']=_0x4c498f[_0x76e2('0x35')][_0x76e2('0x36')]?_0x4c498f[_0x76e2('0x35')]:_0x30afcf[_0x76e2('0x2f')];if(!_0x311b76[_0x76e2('0x31')][_0x76e2('0x37')]('nolimit')){_0x4c498f[_0x76e2('0x1d')]=qs['limit'](_0x311b76[_0x76e2('0x31')][_0x76e2('0x1d')]);_0x4c498f['offset']=qs[_0x76e2('0x1b')](_0x311b76['query'][_0x76e2('0x1b')]);}_0x4c498f[_0x76e2('0x38')]=qs['sort'](_0x311b76[_0x76e2('0x31')][_0x76e2('0x39')]);_0x4c498f[_0x76e2('0x3a')]=qs[_0x76e2('0x3b')](_[_0x76e2('0x3c')](_0x311b76[_0x76e2('0x31')],_0x30afcf[_0x76e2('0x3b')]),_0x341724);if(_0x311b76['query']['filter']){_0x4c498f[_0x76e2('0x3a')]=_['merge'](_0x4c498f[_0x76e2('0x3a')],{'$or':_[_0x76e2('0x30')](_0x341724,function(_0xaae888){if(_0xaae888[_0x76e2('0x3d')]!==_0x76e2('0x3e')){var _0x8a4a7={};_0x8a4a7[_0xaae888[_0x76e2('0x29')]]={'$like':'%'+_0x311b76[_0x76e2('0x31')]['filter']+'%'};return _0x8a4a7;}})});}_0x4c498f=_['merge']({},_0x4c498f,_0x311b76[_0x76e2('0x3f')]);var _0x3b74f7={'where':_0x4c498f['where']};return db[_0x76e2('0x40')]['count'](_0x3b74f7)[_0x76e2('0x24')](function(_0x2751e6){_0x1f66ec[_0x76e2('0x41')]=_0x2751e6;if(_0x311b76[_0x76e2('0x31')]['includeAll']){_0x4c498f[_0x76e2('0x42')]=[{'all':!![]}];}return db[_0x76e2('0x40')][_0x76e2('0x43')](_0x4c498f);})['then'](function(_0x14b497){_0x1f66ec[_0x76e2('0x44')]=_0x14b497;return _0x1f66ec;})[_0x76e2('0x24')](respondWithFilteredResult(_0x46ecea,_0x4c498f))[_0x76e2('0x45')](handleError(_0x46ecea,null));};exports[_0x76e2('0x46')]=function(_0x95489b,_0x5059ba){var _0xe85c44={'raw':![],'where':{'id':_0x95489b['params']['id']}},_0x451ade={};_0x451ade[_0x76e2('0x2f')]=_[_0x76e2('0x32')](db[_0x76e2('0x40')][_0x76e2('0x2c')]);_0x451ade[_0x76e2('0x31')]=_[_0x76e2('0x32')](_0x95489b[_0x76e2('0x31')]);_0x451ade[_0x76e2('0x3b')]=_[_0x76e2('0x33')](_0x451ade[_0x76e2('0x2f')],_0x451ade[_0x76e2('0x31')]);_0xe85c44[_0x76e2('0x35')]=_[_0x76e2('0x33')](_0x451ade[_0x76e2('0x2f')],qs[_0x76e2('0x34')](_0x95489b[_0x76e2('0x31')]['fields']));_0xe85c44[_0x76e2('0x35')]=_0xe85c44[_0x76e2('0x35')][_0x76e2('0x36')]?_0xe85c44[_0x76e2('0x35')]:_0x451ade[_0x76e2('0x2f')];if(_0x95489b['query']['includeAll']){_0xe85c44[_0x76e2('0x42')]=[{'all':!![]}];}_0xe85c44=_[_0x76e2('0x47')]({},_0xe85c44,_0x95489b[_0x76e2('0x3f')]);return db[_0x76e2('0x40')]['find'](_0xe85c44)[_0x76e2('0x24')](handleEntityNotFound(_0x5059ba,null))['then'](respondWithResult(_0x5059ba,null))[_0x76e2('0x45')](handleError(_0x5059ba,null));};exports[_0x76e2('0x48')]=function(_0xfbcf46,_0x4f388f){return db['Dashboard']['create'](_0xfbcf46['body'],{})[_0x76e2('0x24')](function(_0x4dbc9e){var _0x5ae5b4=_0xfbcf46[_0x76e2('0x49')]['get']({'plain':!![]});if(!_0x5ae5b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ae5b4[_0x76e2('0x4a')]===_0x76e2('0x49')){var _0x4902dd=_0x4dbc9e[_0x76e2('0x25')]({'plain':!![]});var _0x5b9407=_0x76e2('0x26');return db[_0x76e2('0x4b')]['find']({'where':{'name':_0x5b9407,'userProfileId':_0x5ae5b4['userProfileId']},'raw':!![]})[_0x76e2('0x24')](function(_0x33f76b){if(_0x33f76b&&_0x33f76b[_0x76e2('0x4c')]===0x0){return db[_0x76e2('0x27')][_0x76e2('0x48')]({'name':_0x4902dd[_0x76e2('0x29')],'resourceId':_0x4902dd['id'],'type':_0x33f76b['name'],'sectionId':_0x33f76b['id']},{})[_0x76e2('0x24')](function(){return _0x4dbc9e;});}else{return _0x4dbc9e;}})[_0x76e2('0x45')](function(_0x2b617d){logger[_0x76e2('0x4d')](_0x76e2('0x4e'),_0x2b617d);throw _0x2b617d;});}return _0x4dbc9e;})[_0x76e2('0x24')](respondWithResult(_0x4f388f,0xc9))['catch'](handleError(_0x4f388f,null));};exports['clone']=function(_0x57ceda,_0x35a1a2){var _0x35393d={'where':{'id':_0x57ceda[_0x76e2('0x4f')]['id']}},_0x7d6852={};_0x7d6852[_0x76e2('0x2f')]=_[_0x76e2('0x32')](db[_0x76e2('0x40')]['rawAttributes']);_0x35393d[_0x76e2('0x35')]=_['intersection'](_0x7d6852[_0x76e2('0x2f')],qs[_0x76e2('0x34')](_0x57ceda[_0x76e2('0x31')][_0x76e2('0x34')]));_0x35393d[_0x76e2('0x35')]=_0x35393d[_0x76e2('0x35')][_0x76e2('0x36')]?_0x35393d[_0x76e2('0x35')]:_0x7d6852['model'];if(_0x57ceda[_0x76e2('0x31')][_0x76e2('0x50')]){_0x35393d[_0x76e2('0x42')]=[{'all':!![]}];}_0x35393d=_[_0x76e2('0x47')]({},_0x35393d,_0x57ceda[_0x76e2('0x3f')]);return db['Dashboard']['find'](_0x35393d)[_0x76e2('0x24')](handleEntityNotFound(_0x35a1a2,null))['then'](function(_0x5d3969){if(_0x5d3969){var _0x5b9357=_0x5d3969['get']({'plain':!![]});_0x5b9357=qs[_0x76e2('0x51')](_0x5b9357,['id',_0x76e2('0x52'),'updatedAt']);_0x57ceda[_0x76e2('0x53')]=_['omit'](_0x57ceda[_0x76e2('0x53')],['id',_0x76e2('0x52'),_0x76e2('0x54')]);return db[_0x76e2('0x40')][_0x76e2('0x48')](_[_0x76e2('0x47')](_0x5b9357,_0x57ceda[_0x76e2('0x53')]),{'include':_0x57ceda[_0x76e2('0x31')][_0x76e2('0x50')]?[{'all':!![]}]:undefined})[_0x76e2('0x24')](function(_0x1eb169){var _0x4d2c4f=_0x57ceda[_0x76e2('0x49')]['get']({'plain':!![]});if(!_0x4d2c4f)throw new Error(_0x76e2('0x55'));if(_0x4d2c4f[_0x76e2('0x4a')]==='user'){var _0x525525=_0x1eb169[_0x76e2('0x25')]({'plain':!![]});var _0xac209c=_0x76e2('0x26');return db[_0x76e2('0x4b')]['find']({'where':{'name':_0xac209c,'userProfileId':_0x4d2c4f[_0x76e2('0x56')]},'raw':!![]})[_0x76e2('0x24')](function(_0x1e59ba){if(_0x1e59ba&&_0x1e59ba[_0x76e2('0x4c')]===0x0){return db['UserProfileResource'][_0x76e2('0x48')]({'name':_0x525525[_0x76e2('0x29')],'resourceId':_0x525525['id'],'type':_0x1e59ba[_0x76e2('0x29')],'sectionId':_0x1e59ba['id']},{})[_0x76e2('0x24')](function(){return _0x1eb169;});}else{return _0x1eb169;}})[_0x76e2('0x45')](function(_0x20bda7){logger[_0x76e2('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20bda7);throw _0x20bda7;});}return _0x1eb169;});}})[_0x76e2('0x24')](respondWithResult(_0x35a1a2,0xc9))[_0x76e2('0x45')](handleError(_0x35a1a2,null));};exports[_0x76e2('0x23')]=function(_0x3ce6f4,_0x36fefc){if(_0x3ce6f4[_0x76e2('0x53')]['id']){delete _0x3ce6f4['body']['id'];}return db[_0x76e2('0x40')]['find']({'where':{'id':_0x3ce6f4[_0x76e2('0x4f')]['id']}})[_0x76e2('0x24')](handleEntityNotFound(_0x36fefc,null))[_0x76e2('0x24')](saveUpdates(_0x3ce6f4['body'],null))[_0x76e2('0x24')](respondWithResult(_0x36fefc,null))['catch'](handleError(_0x36fefc,null));};exports[_0x76e2('0x28')]=function(_0x101030,_0x1d6932){return db['Dashboard'][_0x76e2('0x57')]({'where':{'id':_0x101030[_0x76e2('0x4f')]['id']}})[_0x76e2('0x24')](handleEntityNotFound(_0x1d6932,null))[_0x76e2('0x24')](removeEntity(_0x1d6932,null))['catch'](handleError(_0x1d6932,null));};function widgetAttributes(_0x48182c){try{switch(_0x48182c[_0x76e2('0x3d')]){case _0x76e2('0x58'):return[{'name':_0x76e2('0x59'),'value':_0x48182c[_0x76e2('0x59')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x0]?_0x48182c[_0x76e2('0x5a')][0x0][_0x76e2('0x5b')]:undefined)||_0x76e2('0x5c')}];case'custom':return[{'name':_0x76e2('0x5d'),'value':_0x48182c['attrPath']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x0]?_0x48182c['attrs'][0x0][_0x76e2('0x5b')]:undefined)||''}];case _0x76e2('0x5e'):return[{'name':'attrHourFormat','value':_0x48182c[_0x76e2('0x5f')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x0]?_0x48182c[_0x76e2('0x5a')][0x0][_0x76e2('0x5b')]:undefined)||_0x76e2('0x60')},{'name':_0x76e2('0x61'),'value':_0x48182c[_0x76e2('0x61')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x1]?_0x48182c['attrs'][0x1][_0x76e2('0x5b')]:undefined)||'0.00'},{'name':_0x76e2('0x62'),'value':_0x48182c[_0x76e2('0x62')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x2]?_0x48182c[_0x76e2('0x5a')][0x2][_0x76e2('0x5b')]:undefined)||0xc}];case _0x76e2('0x63'):return[{'name':_0x76e2('0x64'),'value':_0x48182c[_0x76e2('0x64')]||(_0x48182c['attrs']&&_0x48182c['attrs'][0x0]?_0x48182c[_0x76e2('0x5a')][0x0][_0x76e2('0x5b')]:undefined)||_0x76e2('0x65')},{'name':'attrVoiceQueues','value':_0x48182c['attrVoiceQueues']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x1]?_0x48182c['attrs'][0x1]['value']:undefined)||[]},{'name':_0x76e2('0x62'),'value':_0x48182c['attrFontSize']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x2]?_0x48182c[_0x76e2('0x5a')][0x2][_0x76e2('0x5b')]:undefined)||0x14},{'name':_0x76e2('0x66'),'value':_0x48182c[_0x76e2('0x66')]||(_0x48182c['attrs']&&_0x48182c['attrs'][0x3]?_0x48182c[_0x76e2('0x5a')][0x3]['value']:undefined)||_0x76e2('0x67')},{'name':_0x76e2('0x68'),'value':_0x48182c[_0x76e2('0x68')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x4]?_0x48182c[_0x76e2('0x5a')][0x4][_0x76e2('0x5b')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x48182c[_0x76e2('0x69')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x5]?_0x48182c[_0x76e2('0x5a')][0x5][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x6a'),'value':_0x48182c[_0x76e2('0x6a')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x6]?_0x48182c[_0x76e2('0x5a')][0x6]['value']:undefined)||''},{'name':_0x76e2('0x6b'),'value':_0x48182c[_0x76e2('0x6b')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x7]?_0x48182c[_0x76e2('0x5a')][0x7][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x6c'),'value':_0x48182c[_0x76e2('0x6c')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x8]?_0x48182c[_0x76e2('0x5a')][0x8][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x6d'),'value':_0x48182c[_0x76e2('0x6d')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x9]?_0x48182c['attrs'][0x9][_0x76e2('0x5b')]:undefined)||''}];case _0x76e2('0x6e'):case _0x76e2('0x6f'):return[{'name':'attrSerie1','value':_0x48182c[_0x76e2('0x70')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x0]?_0x48182c[_0x76e2('0x5a')][0x0][_0x76e2('0x5b')]:undefined)||_0x76e2('0x65')},{'name':_0x76e2('0x71'),'value':_0x48182c['attrSerie2']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x1]?_0x48182c[_0x76e2('0x5a')][0x1]['value']:undefined)||null},{'name':_0x76e2('0x72'),'value':_0x48182c[_0x76e2('0x72')]||(_0x48182c['attrs']&&_0x48182c[_0x76e2('0x5a')][0x2]?_0x48182c[_0x76e2('0x5a')][0x2][_0x76e2('0x5b')]:undefined)||null},{'name':_0x76e2('0x73'),'value':_0x48182c['attrVoiceQueues']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x3]?_0x48182c[_0x76e2('0x5a')][0x3][_0x76e2('0x5b')]:undefined)||[]},{'name':'attrChannel','value':_0x48182c[_0x76e2('0x66')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x4]?_0x48182c[_0x76e2('0x5a')][0x4]['value']:undefined)||_0x76e2('0x67')},{'name':_0x76e2('0x68'),'value':_0x48182c[_0x76e2('0x68')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x5]?_0x48182c[_0x76e2('0x5a')][0x5][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x69'),'value':_0x48182c[_0x76e2('0x69')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x6]?_0x48182c['attrs'][0x6][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x6a'),'value':_0x48182c[_0x76e2('0x6a')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x7]?_0x48182c[_0x76e2('0x5a')][0x7][_0x76e2('0x5b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x48182c[_0x76e2('0x6b')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x8]?_0x48182c['attrs'][0x8]['value']:undefined)||''},{'name':_0x76e2('0x6c'),'value':_0x48182c['attrWhatsappAccounts']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c['attrs'][0x9]?_0x48182c[_0x76e2('0x5a')][0x9][_0x76e2('0x5b')]:undefined)||''},{'name':_0x76e2('0x6d'),'value':_0x48182c['attrChatWebsites']||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0xa]?_0x48182c[_0x76e2('0x5a')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x76e2('0x74'),'type':_0x48182c['reportType']||(_0x48182c['attrs']&&_0x48182c['attrs'][0x0]?_0x48182c['attrs'][0x0]['type']:undefined)||null,'value':_0x48182c[_0x76e2('0x74')]||(_0x48182c[_0x76e2('0x5a')]&&_0x48182c[_0x76e2('0x5a')][0x0]?_0x48182c['attrs'][0x0][_0x76e2('0x5b')]:undefined)||null},{'name':_0x76e2('0x75'),'value':_0x48182c[_0x76e2('0x75')]||(_0x48182c['attrs']&&_0x48182c[_0x76e2('0x5a')][0x1]?_0x48182c[_0x76e2('0x5a')][0x1][_0x76e2('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x3d6e1a){logger['error'](_0x76e2('0x76'),JSON[_0x76e2('0x77')](_0x3d6e1a));return[];}}exports[_0x76e2('0x78')]=function(_0x2a2f72,_0x5c1271,_0x4bbee5){if(_0x2a2f72[_0x76e2('0x53')]['id']){delete _0x2a2f72[_0x76e2('0x53')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x2a2f72[_0x76e2('0x4f')]['id']}})[_0x76e2('0x24')](handleEntityNotFound(_0x5c1271,null))[_0x76e2('0x24')](function(_0x34cf86){if(_0x34cf86){_0x2a2f72[_0x76e2('0x53')][_0x76e2('0x79')]=_0x34cf86['id'];_0x2a2f72[_0x76e2('0x53')][_0x76e2('0x5a')]=widgetAttributes(_0x2a2f72['body']);return db['DashboardItem'][_0x76e2('0x48')](_0x2a2f72['body']);}})[_0x76e2('0x24')](respondWithResult(_0x5c1271,null))[_0x76e2('0x45')](handleError(_0x5c1271,null));};exports[_0x76e2('0x7a')]=function(_0x5d6512,_0x2ea6b9,_0x5431f0){var _0x36479e={};var _0x146190={};var _0x8ca2af;var _0x53aad7;return db[_0x76e2('0x40')][_0x76e2('0x7b')]({'where':{'id':_0x5d6512['params']['id']}})['then'](handleEntityNotFound(_0x2ea6b9,null))[_0x76e2('0x24')](function(_0x43c182){if(_0x43c182){_0x8ca2af=_0x43c182;_0x146190['model']=_['keys'](db[_0x76e2('0x7c')][_0x76e2('0x2c')]);_0x146190[_0x76e2('0x31')]=_['keys'](_0x5d6512['query']);_0x146190['filters']=_['intersection'](_0x146190[_0x76e2('0x2f')],_0x146190[_0x76e2('0x31')]);_0x36479e[_0x76e2('0x35')]=_[_0x76e2('0x33')](_0x146190[_0x76e2('0x2f')],qs[_0x76e2('0x34')](_0x5d6512[_0x76e2('0x31')][_0x76e2('0x34')]));_0x36479e['attributes']=_0x36479e[_0x76e2('0x35')]['length']?_0x36479e[_0x76e2('0x35')]:_0x146190['model'];_0x36479e[_0x76e2('0x38')]=qs['sort'](_0x5d6512[_0x76e2('0x31')][_0x76e2('0x39')]);_0x36479e[_0x76e2('0x3a')]=qs[_0x76e2('0x3b')](_['pick'](_0x5d6512[_0x76e2('0x31')],_0x146190[_0x76e2('0x3b')]));if(_0x5d6512[_0x76e2('0x31')]['filter']){_0x36479e['where']=_[_0x76e2('0x47')](_0x36479e['where'],{'$or':_[_0x76e2('0x30')](_0x36479e[_0x76e2('0x35')],function(_0x5951df){var _0x4d5ab8={};_0x4d5ab8[_0x5951df]={'$like':'%'+_0x5d6512[_0x76e2('0x31')][_0x76e2('0x7d')]+'%'};return _0x4d5ab8;})});}_0x36479e=_[_0x76e2('0x47')]({},_0x36479e,_0x5d6512['options']);return _0x8ca2af[_0x76e2('0x7a')](_0x36479e);}})[_0x76e2('0x24')](function(_0x57edb1){if(_0x57edb1){_0x53aad7=_0x57edb1[_0x76e2('0x36')];if(!_0x5d6512[_0x76e2('0x31')]['hasOwnProperty'](_0x76e2('0x7e'))){_0x36479e[_0x76e2('0x1d')]=qs[_0x76e2('0x1d')](_0x5d6512[_0x76e2('0x31')][_0x76e2('0x1d')]);_0x36479e[_0x76e2('0x1b')]=qs[_0x76e2('0x1b')](_0x5d6512[_0x76e2('0x31')][_0x76e2('0x1b')]);}return _0x8ca2af[_0x76e2('0x7a')](_0x36479e);}})[_0x76e2('0x24')](function(_0x409fcb){if(_0x409fcb){return _0x409fcb?{'count':_0x53aad7,'rows':_0x409fcb}:null;}})[_0x76e2('0x24')](respondWithResult(_0x2ea6b9,null))[_0x76e2('0x45')](handleError(_0x2ea6b9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index e2672b6..4564756 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 _0x35e5=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x40fcf6,_0x20c4a6){var _0x3b3b3e=function(_0x4c683e){while(--_0x4c683e){_0x40fcf6['push'](_0x40fcf6['shift']());}};_0x3b3b3e(++_0x20c4a6);}(_0x35e5,0xc4));var _0x535e=function(_0x37b9e2,_0xb8d648){_0x37b9e2=_0x37b9e2-0x0;var _0x9c630f=_0x35e5[_0x37b9e2];return _0x9c630f;};'use strict';var EventEmitter=require(_0x535e('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x535e('0x1')](0x0);var events={'afterCreate':_0x535e('0x2'),'afterUpdate':_0x535e('0x3'),'afterDestroy':_0x535e('0x4')};function emitEvent(_0x316899){return function(_0x30997d,_0x458d94,_0x337e06){DashboardEvents[_0x535e('0x5')](_0x316899+':'+_0x30997d['id'],_0x30997d);DashboardEvents[_0x535e('0x5')](_0x316899,_0x30997d);_0x337e06(null);};}for(var e in events){if(events[_0x535e('0x6')](e)){var event=events[e];Dashboard[_0x535e('0x7')](e,emitEvent(event));}}module[_0x535e('0x8')]=DashboardEvents; \ No newline at end of file +var _0x69b5=['../../mysqldb','Dashboard','save','update','remove','emit','hook','exports','events'];(function(_0x3f1c72,_0x20a8b7){var _0x5d4877=function(_0x2b00e0){while(--_0x2b00e0){_0x3f1c72['push'](_0x3f1c72['shift']());}};_0x5d4877(++_0x20a8b7);}(_0x69b5,0x18b));var _0x569b=function(_0x3509b9,_0x38bb75){_0x3509b9=_0x3509b9-0x0;var _0x11704f=_0x69b5[_0x3509b9];return _0x11704f;};'use strict';var EventEmitter=require(_0x569b('0x0'));var Dashboard=require(_0x569b('0x1'))['db'][_0x569b('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x569b('0x3'),'afterUpdate':_0x569b('0x4'),'afterDestroy':_0x569b('0x5')};function emitEvent(_0x3353cd){return function(_0x117a59,_0x3afe28,_0x314161){DashboardEvents[_0x569b('0x6')](_0x3353cd+':'+_0x117a59['id'],_0x117a59);DashboardEvents[_0x569b('0x6')](_0x3353cd,_0x117a59);_0x314161(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x569b('0x7')](e,emitEvent(event));}}module[_0x569b('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e31ae65..bd56e76 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 _0x3f45=['Dashboard','dashboards','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','define'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0x3f45,0x1d0));var _0x53f4=function(_0x326a2a,_0x4303a4){_0x326a2a=_0x326a2a-0x0;var _0x1e8f5f=_0x3f45[_0x326a2a];return _0x1e8f5f;};'use strict';var _=require('lodash');var util=require(_0x53f4('0x0'));var logger=require('../../config/logger')(_0x53f4('0x1'));var moment=require(_0x53f4('0x2'));var BPromise=require(_0x53f4('0x3'));var rp=require(_0x53f4('0x4'));var fs=require('fs');var path=require(_0x53f4('0x5'));var rimraf=require('rimraf');var config=require(_0x53f4('0x6'));var attributes=require(_0x53f4('0x7'));module['exports']=function(_0x3e14e6,_0x126739){return _0x3e14e6[_0x53f4('0x8')](_0x53f4('0x9'),attributes,{'tableName':_0x53f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8430=['../../config/logger','moment','request-promise','path','rimraf','./dashboard.attributes','Dashboard','dashboards','util'];(function(_0x361704,_0x3af61c){var _0x258953=function(_0x53ca46){while(--_0x53ca46){_0x361704['push'](_0x361704['shift']());}};_0x258953(++_0x3af61c);}(_0x8430,0xd7));var _0x0843=function(_0x5f0488,_0x6c662f){_0x5f0488=_0x5f0488-0x0;var _0x27740d=_0x8430[_0x5f0488];return _0x27740d;};'use strict';var _=require('lodash');var util=require(_0x0843('0x0'));var logger=require(_0x0843('0x1'))('api');var moment=require(_0x0843('0x2'));var BPromise=require('bluebird');var rp=require(_0x0843('0x3'));var fs=require('fs');var path=require(_0x0843('0x4'));var rimraf=require(_0x0843('0x5'));var config=require('../../config/environment');var attributes=require(_0x0843('0x6'));module['exports']=function(_0x1e4981,_0xc79f33){return _0x1e4981['define'](_0x0843('0x7'),attributes,{'tableName':_0x0843('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 62ae384..b8680be 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 _0x792f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51f9b1,_0x1b95b0){var _0x4b5447=function(_0x13f56e){while(--_0x13f56e){_0x51f9b1['push'](_0x51f9b1['shift']());}};_0x4b5447(++_0x1b95b0);}(_0x792f,0x161));var _0xf792=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0x792f[_0x555ebb];return _0x3c0a4a;};'use strict';var _=require(_0xf792('0x0'));var util=require('util');var moment=require(_0xf792('0x1'));var BPromise=require(_0xf792('0x2'));var rs=require(_0xf792('0x3'));var fs=require('fs');var Redis=require(_0xf792('0x4'));var db=require(_0xf792('0x5'))['db'];var utils=require(_0xf792('0x6'));var logger=require(_0xf792('0x7'))(_0xf792('0x8'));var config=require(_0xf792('0x9'));var jayson=require(_0xf792('0xa'));var client=jayson[_0xf792('0xb')][_0xf792('0xc')]({'port':0x232a});config['redis']=_[_0xf792('0xd')](config[_0xf792('0xe')],{'host':_0xf792('0xf'),'port':0x18eb});var socket=require(_0xf792('0x10'))(new Redis(config['redis']));require(_0xf792('0x11'))['register'](socket);function respondWithRpcPromise(_0x3e9e5e,_0x19178d,_0x4fcbb6){return new BPromise(function(_0x4c3388,_0x2c5a59){return client[_0xf792('0x12')](_0x3e9e5e,_0x4fcbb6)[_0xf792('0x13')](function(_0x531229){logger['info'](_0xf792('0x14'),_0x19178d,'request\x20sent');logger[_0xf792('0x15')](_0xf792('0x16'),_0x19178d,'request\x20sent',JSON['stringify'](_0x531229));if(_0x531229[_0xf792('0x17')]){if(_0x531229[_0xf792('0x17')][_0xf792('0x18')]===0x1f4){logger[_0xf792('0x17')](_0xf792('0x14'),_0x19178d,_0x531229[_0xf792('0x17')][_0xf792('0x19')]);return _0x2c5a59(_0x531229[_0xf792('0x17')][_0xf792('0x19')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x19178d,_0x531229['error']['message']);return _0x4c3388(_0x531229[_0xf792('0x17')][_0xf792('0x19')]);}else{logger[_0xf792('0x1a')]('Dashboard,\x20%s,\x20%s',_0x19178d,_0xf792('0x1b'));_0x4c3388(_0x531229[_0xf792('0x1c')][_0xf792('0x19')]);}})[_0xf792('0x1d')](function(_0x4d3b8a){logger[_0xf792('0x17')](_0xf792('0x14'),_0x19178d,_0x4d3b8a);_0x2c5a59(_0x4d3b8a);});});} \ No newline at end of file +var _0xa319=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboard.socket','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46dedf,_0xa59cac){var _0x3851dc=function(_0x3bd161){while(--_0x3bd161){_0x46dedf['push'](_0x46dedf['shift']());}};_0x3851dc(++_0xa59cac);}(_0xa319,0xa6));var _0x9a31=function(_0x31bb30,_0xe42989){_0x31bb30=_0x31bb30-0x0;var _0x169775=_0xa319[_0x31bb30];return _0x169775;};'use strict';var _=require(_0x9a31('0x0'));var util=require(_0x9a31('0x1'));var moment=require(_0x9a31('0x2'));var BPromise=require(_0x9a31('0x3'));var rs=require(_0x9a31('0x4'));var fs=require('fs');var Redis=require(_0x9a31('0x5'));var db=require(_0x9a31('0x6'))['db'];var utils=require(_0x9a31('0x7'));var logger=require('../../config/logger')(_0x9a31('0x8'));var config=require(_0x9a31('0x9'));var jayson=require(_0x9a31('0xa'));var client=jayson[_0x9a31('0xb')][_0x9a31('0xc')]({'port':0x232a});config['redis']=_[_0x9a31('0xd')](config[_0x9a31('0xe')],{'host':_0x9a31('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a31('0xe')]));require(_0x9a31('0x10'))['register'](socket);function respondWithRpcPromise(_0x1c54b2,_0x230e48,_0x48042d){return new BPromise(function(_0x3e1247,_0x34308c){return client['request'](_0x1c54b2,_0x48042d)[_0x9a31('0x11')](function(_0x5f2d82){logger[_0x9a31('0x12')](_0x9a31('0x13'),_0x230e48,_0x9a31('0x14'));logger['debug'](_0x9a31('0x15'),_0x230e48,'request\x20sent',JSON[_0x9a31('0x16')](_0x5f2d82));if(_0x5f2d82[_0x9a31('0x17')]){if(_0x5f2d82[_0x9a31('0x17')][_0x9a31('0x18')]===0x1f4){logger['error'](_0x9a31('0x13'),_0x230e48,_0x5f2d82[_0x9a31('0x17')][_0x9a31('0x19')]);return _0x34308c(_0x5f2d82[_0x9a31('0x17')]['message']);}logger[_0x9a31('0x17')](_0x9a31('0x13'),_0x230e48,_0x5f2d82[_0x9a31('0x17')]['message']);return _0x3e1247(_0x5f2d82[_0x9a31('0x17')][_0x9a31('0x19')]);}else{logger[_0x9a31('0x12')]('Dashboard,\x20%s,\x20%s',_0x230e48,'request\x20sent');_0x3e1247(_0x5f2d82[_0x9a31('0x1a')][_0x9a31('0x19')]);}})['catch'](function(_0x4f1c82){logger[_0x9a31('0x17')](_0x9a31('0x13'),_0x230e48,_0x4f1c82);_0x34308c(_0x4f1c82);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index e23ca3c..c74c36b 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 _0xa092=['register','length','dashboard:','./dashboard.events','remove','update','emit','removeListener'];(function(_0x154f72,_0x175201){var _0xad8177=function(_0x37a57b){while(--_0x37a57b){_0x154f72['push'](_0x154f72['shift']());}};_0xad8177(++_0x175201);}(_0xa092,0x123));var _0x2a09=function(_0x19d24c,_0x62bc50){_0x19d24c=_0x19d24c-0x0;var _0x2fae8d=_0xa092[_0x19d24c];return _0x2fae8d;};'use strict';var DashboardEvents=require(_0x2a09('0x0'));var events=['save',_0x2a09('0x1'),_0x2a09('0x2')];function createListener(_0x1eee03,_0x1713a9){return function(_0x632529){_0x1713a9[_0x2a09('0x3')](_0x1eee03,_0x632529);};}function removeListener(_0xf02b37,_0x1bcd34){return function(){DashboardEvents[_0x2a09('0x4')](_0xf02b37,_0x1bcd34);};}exports[_0x2a09('0x5')]=function(_0x50bf89){for(var _0x34f57d=0x0,_0x37e947=events[_0x2a09('0x6')];_0x34f57d<_0x37e947;_0x34f57d++){var _0x42869c=events[_0x34f57d];var _0x1153bd=createListener(_0x2a09('0x7')+_0x42869c,_0x50bf89);DashboardEvents['on'](_0x42869c,_0x1153bd);}}; \ No newline at end of file +var _0x11d6=['dashboard:','./dashboard.events','save','remove','update','emit','removeListener','register','length'];(function(_0x145ab5,_0xc98313){var _0x37dd86=function(_0x43a961){while(--_0x43a961){_0x145ab5['push'](_0x145ab5['shift']());}};_0x37dd86(++_0xc98313);}(_0x11d6,0x145));var _0x611d=function(_0x2ae79f,_0x4f3a37){_0x2ae79f=_0x2ae79f-0x0;var _0x3aa14e=_0x11d6[_0x2ae79f];return _0x3aa14e;};'use strict';var DashboardEvents=require(_0x611d('0x0'));var events=[_0x611d('0x1'),_0x611d('0x2'),_0x611d('0x3')];function createListener(_0x386680,_0x1aae13){return function(_0x198d52){_0x1aae13[_0x611d('0x4')](_0x386680,_0x198d52);};}function removeListener(_0x56b00c,_0x4962f8){return function(){DashboardEvents[_0x611d('0x5')](_0x56b00c,_0x4962f8);};}exports[_0x611d('0x6')]=function(_0x34500f){for(var _0x45ecec=0x0,_0x39928b=events[_0x611d('0x7')];_0x45ecec<_0x39928b;_0x45ecec++){var _0x5488ac=events[_0x45ecec];var _0x17ade5=createListener(_0x611d('0x8')+_0x5488ac,_0x34500f);DashboardEvents['on'](_0x5488ac,_0x17ade5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5030d10..c6f0aee 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 _0x4fd8=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x28578d,_0xcf5cf0){var _0x524826=function(_0x4a51b7){while(--_0x4a51b7){_0x28578d['push'](_0x28578d['shift']());}};_0x524826(++_0xcf5cf0);}(_0x4fd8,0x16d));var _0x84fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4fd8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x84fd('0x0'));var util=require('util');var path=require(_0x84fd('0x1'));var timeout=require(_0x84fd('0x2'));var express=require(_0x84fd('0x3'));var router=express[_0x84fd('0x4')]();var fs_extra=require(_0x84fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x84fd('0x6'));var config=require(_0x84fd('0x7'));var controller=require(_0x84fd('0x8'));router[_0x84fd('0x9')]('/',auth[_0x84fd('0xa')](),controller['index']);router[_0x84fd('0x9')](_0x84fd('0xb'),auth[_0x84fd('0xa')](),controller[_0x84fd('0xc')]);router[_0x84fd('0x9')](_0x84fd('0xd'),auth['isAuthenticated'](),controller[_0x84fd('0xe')]);router['post']('/',auth[_0x84fd('0xa')](),controller[_0x84fd('0xf')]);router[_0x84fd('0x10')](_0x84fd('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0x84fd('0x10')](_0x84fd('0xd'),auth['isAuthenticated'](),controller[_0x84fd('0x12')]);router[_0x84fd('0x13')](_0x84fd('0xb'),auth[_0x84fd('0xa')](),controller[_0x84fd('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x84fd('0x15')]);module[_0x84fd('0x16')]=router; \ No newline at end of file +var _0xe532=['index','/:id','show','getItems','post','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x47facc,_0x5600b9){var _0x1d4432=function(_0x468baf){while(--_0x468baf){_0x47facc['push'](_0x47facc['shift']());}};_0x1d4432(++_0x5600b9);}(_0xe532,0x6e));var _0x2e53=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xe532[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x2e53('0x0'));var util=require(_0x2e53('0x1'));var path=require('path');var timeout=require(_0x2e53('0x2'));var express=require(_0x2e53('0x3'));var router=express[_0x2e53('0x4')]();var fs_extra=require(_0x2e53('0x5'));var auth=require(_0x2e53('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2e53('0x7'));var controller=require('./dashboard.controller');router[_0x2e53('0x8')]('/',auth[_0x2e53('0x9')](),controller[_0x2e53('0xa')]);router['get'](_0x2e53('0xb'),auth['isAuthenticated'](),controller[_0x2e53('0xc')]);router[_0x2e53('0x8')]('/:id/items',auth[_0x2e53('0x9')](),controller[_0x2e53('0xd')]);router[_0x2e53('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e53('0xe')](_0x2e53('0xf'),auth[_0x2e53('0x9')](),controller[_0x2e53('0x10')]);router[_0x2e53('0xe')](_0x2e53('0x11'),auth[_0x2e53('0x9')](),controller[_0x2e53('0x12')]);router[_0x2e53('0x13')](_0x2e53('0xb'),auth[_0x2e53('0x9')](),controller[_0x2e53('0x14')]);router[_0x2e53('0x15')]('/:id',auth[_0x2e53('0x9')](),controller[_0x2e53('0x16')]);module[_0x2e53('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e80085b..795b498 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 _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x45969a,_0x28e6da){var _0x2b5dff=function(_0xa3354c){while(--_0xa3354c){_0x45969a['push'](_0x45969a['shift']());}};_0x2b5dff(++_0x28e6da);}(_0x326f,0xd1));var _0xf326=function(_0x429d85,_0x72143b){_0x429d85=_0x429d85-0x0;var _0x2f4845=_0x326f[_0x429d85];return _0x2f4845;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0x90b1=['#2196f3','sequelize','squel','lodash','STRING','TEXT','long','parse','setDataValue','attrs','stringify','INTEGER','#ffffff'];(function(_0x1cfda3,_0x32e81){var _0x45a82f=function(_0x19078e){while(--_0x19078e){_0x1cfda3['push'](_0x1cfda3['shift']());}};_0x45a82f(++_0x32e81);}(_0x90b1,0x1bb));var _0x190b=function(_0x3b8240,_0x4cf6d6){_0x3b8240=_0x3b8240-0x0;var _0x39edd4=_0x90b1[_0x3b8240];return _0x39edd4;};'use strict';var Sequelize=require(_0x190b('0x0'));var squel=require(_0x190b('0x1'));var _=require(_0x190b('0x2'));module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x190b('0x4')](_0x190b('0x5')),'get':function(){try{return JSON[_0x190b('0x6')](this['getDataValue']('attrs'));}catch(_0x5cbebb){return[];}},'set':function(_0x5da9c1){try{this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')](_0x5da9c1));}catch(_0x626aa1){this[_0x190b('0x7')](_0x190b('0x8'),JSON[_0x190b('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x190b('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x190b('0xa')]},'col':{'type':Sequelize[_0x190b('0xa')]},'background':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x190b('0x3')],'allowNull':![],'defaultValue':_0x190b('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x190b('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b18eb79..f46f375 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 _0xae35=['localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','show','params','model','keys','DashboardItem','query','filters','intersection','fields','attributes','length','includeAll','include','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0xae35,0x172));var _0x5ae3=function(_0x4ea48a,_0x4fe78b){_0x4ea48a=_0x4ea48a-0x0;var _0x1206e2=_0xae35[_0x4ea48a];return _0x1206e2;};'use strict';var emlformat=require(_0x5ae3('0x0'));var rimraf=require(_0x5ae3('0x1'));var zipdir=require(_0x5ae3('0x2'));var jsonpatch=require(_0x5ae3('0x3'));var rp=require(_0x5ae3('0x4'));var moment=require(_0x5ae3('0x5'));var BPromise=require(_0x5ae3('0x6'));var Mustache=require(_0x5ae3('0x7'));var util=require('util');var path=require(_0x5ae3('0x8'));var sox=require('sox');var csv=require(_0x5ae3('0x9'));var ejs=require(_0x5ae3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ae3('0xb'));var squel=require(_0x5ae3('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ae3('0xd'));var deskjs=require(_0x5ae3('0xe'));var toCsv=require(_0x5ae3('0x9'));var querystring=require('querystring');var Papa=require(_0x5ae3('0xf'));var Redis=require(_0x5ae3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5ae3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ae3('0x12'));var logger=require(_0x5ae3('0x13'))(_0x5ae3('0x14'));var utils=require(_0x5ae3('0x15'));var config=require(_0x5ae3('0x16'));var licenseUtil=require(_0x5ae3('0x17'));var db=require('../../mysqldb')['db'];config[_0x5ae3('0x18')]=_[_0x5ae3('0x19')](config[_0x5ae3('0x18')],{'host':_0x5ae3('0x1a'),'port':0x18eb});var socket=require(_0x5ae3('0x1b'))(new Redis(config[_0x5ae3('0x18')]));require('./dashboardItem.socket')[_0x5ae3('0x1c')](socket);function respondWithStatusCode(_0x331246,_0x2b6c39){_0x2b6c39=_0x2b6c39||0xcc;return function(_0x79898a){if(_0x79898a){return _0x331246[_0x5ae3('0x1d')](_0x2b6c39);}return _0x331246[_0x5ae3('0x1e')](_0x2b6c39)['end']();};}function respondWithResult(_0x459927,_0x49f802){_0x49f802=_0x49f802||0xc8;return function(_0x34354d){if(_0x34354d){return _0x459927['status'](_0x49f802)[_0x5ae3('0x1f')](_0x34354d);}};}function respondWithFilteredResult(_0x24fecc,_0x10b13a){return function(_0x2d8626){if(_0x2d8626){var _0x3b34eb=typeof _0x10b13a[_0x5ae3('0x20')]===_0x5ae3('0x21')&&typeof _0x10b13a[_0x5ae3('0x22')]==='undefined';var _0x287aab=_0x2d8626[_0x5ae3('0x23')];var _0x5e4246=_0x3b34eb?0x0:_0x10b13a[_0x5ae3('0x20')];var _0x357e35=_0x3b34eb?_0x2d8626['count']:_0x10b13a[_0x5ae3('0x20')]+_0x10b13a['limit'];var _0xef0540;if(_0x357e35>=_0x287aab){_0x357e35=_0x287aab;_0xef0540=0xc8;}else{_0xef0540=0xce;}_0x24fecc[_0x5ae3('0x1e')](_0xef0540);return _0x24fecc[_0x5ae3('0x24')](_0x5ae3('0x25'),_0x5e4246+'-'+_0x357e35+'/'+_0x287aab)[_0x5ae3('0x1f')](_0x2d8626);}return null;};}function patchUpdates(_0x27b83e){return function(_0xea628a){try{jsonpatch[_0x5ae3('0x26')](_0xea628a,_0x27b83e,!![]);}catch(_0x26fe55){return BPromise[_0x5ae3('0x27')](_0x26fe55);}return _0xea628a['save']();};}function saveUpdates(_0x54ac2a,_0x265ad5){return function(_0x10d30b){if(_0x10d30b){return _0x10d30b['update'](_0x54ac2a)[_0x5ae3('0x28')](function(_0x49ec7b){return _0x49ec7b;});}return null;};}function removeEntity(_0x289b97,_0x3c33d2){return function(_0x2f7951){if(_0x2f7951){return _0x2f7951[_0x5ae3('0x29')]()['then'](function(){_0x289b97[_0x5ae3('0x1e')](0xcc)[_0x5ae3('0x2a')]();});}};}function handleEntityNotFound(_0x48c258,_0x8ee010){return function(_0x4dbe22){if(!_0x4dbe22){_0x48c258['sendStatus'](0x194);}return _0x4dbe22;};}function handleError(_0xca3e5e,_0x1abd5d){_0x1abd5d=_0x1abd5d||0x1f4;return function(_0x4f6bd7){logger[_0x5ae3('0x2b')](_0x4f6bd7[_0x5ae3('0x2c')]);if(_0x4f6bd7['name']){delete _0x4f6bd7[_0x5ae3('0x2d')];}_0xca3e5e[_0x5ae3('0x1e')](_0x1abd5d)['send'](_0x4f6bd7);};}exports[_0x5ae3('0x2e')]=function(_0x87574d,_0x58f17f){var _0x37d206={'raw':![],'where':{'id':_0x87574d[_0x5ae3('0x2f')]['id']}},_0xf0bb19={};_0xf0bb19[_0x5ae3('0x30')]=_[_0x5ae3('0x31')](db[_0x5ae3('0x32')]['rawAttributes']);_0xf0bb19[_0x5ae3('0x33')]=_[_0x5ae3('0x31')](_0x87574d[_0x5ae3('0x33')]);_0xf0bb19[_0x5ae3('0x34')]=_[_0x5ae3('0x35')](_0xf0bb19['model'],_0xf0bb19[_0x5ae3('0x33')]);_0x37d206['attributes']=_['intersection'](_0xf0bb19[_0x5ae3('0x30')],qs[_0x5ae3('0x36')](_0x87574d[_0x5ae3('0x33')][_0x5ae3('0x36')]));_0x37d206[_0x5ae3('0x37')]=_0x37d206['attributes'][_0x5ae3('0x38')]?_0x37d206[_0x5ae3('0x37')]:_0xf0bb19[_0x5ae3('0x30')];if(_0x87574d[_0x5ae3('0x33')][_0x5ae3('0x39')]){_0x37d206[_0x5ae3('0x3a')]=[{'all':!![]}];}_0x37d206=_['merge']({},_0x37d206,_0x87574d['options']);return db[_0x5ae3('0x32')][_0x5ae3('0x3b')](_0x37d206)[_0x5ae3('0x28')](handleEntityNotFound(_0x58f17f,null))[_0x5ae3('0x28')](respondWithResult(_0x58f17f,null))['catch'](handleError(_0x58f17f,null));};exports[_0x5ae3('0x29')]=function(_0xec0247,_0x3d2fa6){return db[_0x5ae3('0x32')]['find']({'where':{'id':_0xec0247[_0x5ae3('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3d2fa6,null))['then'](removeEntity(_0x3d2fa6,null))[_0x5ae3('0x3c')](handleError(_0x3d2fa6,null));};function widgetAttributes(_0x3ae16c){try{switch(_0x3ae16c[_0x5ae3('0x3d')]){case _0x5ae3('0x3e'):return[{'name':_0x5ae3('0x3f'),'value':_0x3ae16c['attrUrl']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x0]?_0x3ae16c['attrs'][0x0]['value']:undefined)||_0x5ae3('0x41')}];case _0x5ae3('0x42'):return[{'name':_0x5ae3('0x43'),'value':_0x3ae16c[_0x5ae3('0x43')]||(_0x3ae16c['attrs']&&_0x3ae16c[_0x5ae3('0x40')][0x0]?_0x3ae16c['attrs'][0x0]['value']:undefined)||''}];case _0x5ae3('0x44'):return[{'name':_0x5ae3('0x45'),'value':_0x3ae16c['attrHourFormat']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x0]?_0x3ae16c[_0x5ae3('0x40')][0x0][_0x5ae3('0x46')]:undefined)||_0x5ae3('0x47')},{'name':_0x5ae3('0x48'),'value':_0x3ae16c[_0x5ae3('0x48')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x1]?_0x3ae16c[_0x5ae3('0x40')][0x1]['value']:undefined)||'0.00'},{'name':_0x5ae3('0x49'),'value':_0x3ae16c[_0x5ae3('0x49')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x2]?_0x3ae16c['attrs'][0x2]['value']:undefined)||0xc}];case _0x5ae3('0x4a'):return[{'name':_0x5ae3('0x4b'),'value':_0x3ae16c[_0x5ae3('0x4b')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x0]?_0x3ae16c['attrs'][0x0]['value']:undefined)||_0x5ae3('0x4c')},{'name':_0x5ae3('0x4d'),'value':_0x3ae16c['attrVoiceQueues']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x1]?_0x3ae16c[_0x5ae3('0x40')][0x1][_0x5ae3('0x46')]:undefined)||[]},{'name':_0x5ae3('0x49'),'value':_0x3ae16c[_0x5ae3('0x49')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x2]?_0x3ae16c[_0x5ae3('0x40')][0x2][_0x5ae3('0x46')]:undefined)||0x14},{'name':_0x5ae3('0x4e'),'value':_0x3ae16c['attrChannel']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x3]?_0x3ae16c['attrs'][0x3][_0x5ae3('0x46')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x3ae16c[_0x5ae3('0x4f')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x4]?_0x3ae16c[_0x5ae3('0x40')][0x4][_0x5ae3('0x46')]:undefined)||''},{'name':_0x5ae3('0x50'),'value':_0x3ae16c[_0x5ae3('0x50')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x5]?_0x3ae16c['attrs'][0x5][_0x5ae3('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3ae16c[_0x5ae3('0x51')]||(_0x3ae16c['attrs']&&_0x3ae16c[_0x5ae3('0x40')][0x6]?_0x3ae16c['attrs'][0x6][_0x5ae3('0x46')]:undefined)||''},{'name':_0x5ae3('0x52'),'value':_0x3ae16c[_0x5ae3('0x52')]||(_0x3ae16c['attrs']&&_0x3ae16c[_0x5ae3('0x40')][0x7]?_0x3ae16c['attrs'][0x7][_0x5ae3('0x46')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x3ae16c[_0x5ae3('0x53')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x8]?_0x3ae16c[_0x5ae3('0x40')][0x8]['value']:undefined)||''},{'name':_0x5ae3('0x54'),'value':_0x3ae16c[_0x5ae3('0x54')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x9]?_0x3ae16c[_0x5ae3('0x40')][0x9][_0x5ae3('0x46')]:undefined)||''}];case'multibar-chart':case _0x5ae3('0x55'):return[{'name':_0x5ae3('0x56'),'value':_0x3ae16c['attrSerie1']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x0]?_0x3ae16c[_0x5ae3('0x40')][0x0]['value']:undefined)||_0x5ae3('0x4c')},{'name':_0x5ae3('0x57'),'value':_0x3ae16c[_0x5ae3('0x57')]||(_0x3ae16c['attrs']&&_0x3ae16c['attrs'][0x1]?_0x3ae16c['attrs'][0x1][_0x5ae3('0x46')]:undefined)||null},{'name':_0x5ae3('0x58'),'value':_0x3ae16c[_0x5ae3('0x58')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x2]?_0x3ae16c[_0x5ae3('0x40')][0x2][_0x5ae3('0x46')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x3ae16c[_0x5ae3('0x4d')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x3]?_0x3ae16c[_0x5ae3('0x40')][0x3][_0x5ae3('0x46')]:undefined)||[]},{'name':_0x5ae3('0x4e'),'value':_0x3ae16c[_0x5ae3('0x4e')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x4]?_0x3ae16c[_0x5ae3('0x40')][0x4][_0x5ae3('0x46')]:undefined)||_0x5ae3('0x59')},{'name':_0x5ae3('0x4f'),'value':_0x3ae16c['attrEmailAccounts']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x5]?_0x3ae16c[_0x5ae3('0x40')][0x5][_0x5ae3('0x46')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x3ae16c[_0x5ae3('0x50')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x6]?_0x3ae16c['attrs'][0x6][_0x5ae3('0x46')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3ae16c[_0x5ae3('0x51')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x7]?_0x3ae16c['attrs'][0x7]['value']:undefined)||''},{'name':_0x5ae3('0x52'),'value':_0x3ae16c[_0x5ae3('0x52')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x8]?_0x3ae16c[_0x5ae3('0x40')][0x8]['value']:undefined)||''},{'name':_0x5ae3('0x53'),'value':_0x3ae16c[_0x5ae3('0x53')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c['attrs'][0x9]?_0x3ae16c[_0x5ae3('0x40')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x3ae16c['attrChatWebsites']||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0xa]?_0x3ae16c[_0x5ae3('0x40')][0xa][_0x5ae3('0x46')]:undefined)||''}];case _0x5ae3('0x5a'):return[{'name':'attrReport','type':_0x3ae16c[_0x5ae3('0x5b')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x0]?_0x3ae16c[_0x5ae3('0x40')][0x0]['type']:undefined)||null,'value':_0x3ae16c[_0x5ae3('0x5c')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x0]?_0x3ae16c[_0x5ae3('0x40')][0x0]['value']:undefined)||null},{'name':_0x5ae3('0x5d'),'value':_0x3ae16c[_0x5ae3('0x5d')]||(_0x3ae16c[_0x5ae3('0x40')]&&_0x3ae16c[_0x5ae3('0x40')][0x1]?_0x3ae16c[_0x5ae3('0x40')][0x1][_0x5ae3('0x46')]:undefined)||0x0}];default:return[];}}catch(_0xc87ee9){logger[_0x5ae3('0x2b')](_0x5ae3('0x5e'),JSON[_0x5ae3('0x5f')](_0xc87ee9));return[];}}exports[_0x5ae3('0x60')]=function(_0x1f97b1,_0x688f32){if(_0x1f97b1['body']){_0x1f97b1[_0x5ae3('0x61')]['attrs']=widgetAttributes(_0x1f97b1[_0x5ae3('0x61')]);}return db[_0x5ae3('0x32')][_0x5ae3('0x60')](_0x1f97b1['body'],{})[_0x5ae3('0x28')](respondWithResult(_0x688f32,0xc9))[_0x5ae3('0x3c')](handleError(_0x688f32,null));};exports[_0x5ae3('0x62')]=function(_0x2820b9,_0x4bea77){if(_0x2820b9[_0x5ae3('0x61')]['id']){delete _0x2820b9[_0x5ae3('0x61')]['id'];}_0x2820b9[_0x5ae3('0x61')][_0x5ae3('0x40')]=widgetAttributes(_0x2820b9['body']);return db[_0x5ae3('0x32')][_0x5ae3('0x3b')]({'where':{'id':_0x2820b9[_0x5ae3('0x2f')]['id']}})[_0x5ae3('0x28')](handleEntityNotFound(_0x4bea77,null))[_0x5ae3('0x28')](saveUpdates(_0x2820b9[_0x5ae3('0x61')],null))[_0x5ae3('0x28')](respondWithResult(_0x4bea77,null))[_0x5ae3('0x3c')](handleError(_0x4bea77,null));}; \ No newline at end of file +var _0x5e17=['mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','params','model','DashboardItem','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie2','attrSerie3','web-report','attrReport','stringify','body','create','update','eml-format','bluebird'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x5e17,0x17a));var _0x75e1=function(_0x12428c,_0x1cefd2){_0x12428c=_0x12428c-0x0;var _0x3aabbf=_0x5e17[_0x12428c];return _0x3aabbf;};'use strict';var emlformat=require(_0x75e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x75e1('0x1'));var Mustache=require(_0x75e1('0x2'));var util=require(_0x75e1('0x3'));var path=require(_0x75e1('0x4'));var sox=require(_0x75e1('0x5'));var csv=require(_0x75e1('0x6'));var ejs=require(_0x75e1('0x7'));var fs=require('fs');var fs_extra=require(_0x75e1('0x8'));var _=require(_0x75e1('0x9'));var squel=require(_0x75e1('0xa'));var crypto=require(_0x75e1('0xb'));var jsforce=require(_0x75e1('0xc'));var deskjs=require(_0x75e1('0xd'));var toCsv=require(_0x75e1('0x6'));var querystring=require(_0x75e1('0xe'));var Papa=require('papaparse');var Redis=require(_0x75e1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75e1('0x10'));var hardwareService=require(_0x75e1('0x11'));var logger=require(_0x75e1('0x12'))(_0x75e1('0x13'));var utils=require(_0x75e1('0x14'));var config=require(_0x75e1('0x15'));var licenseUtil=require(_0x75e1('0x16'));var db=require(_0x75e1('0x17'))['db'];config['redis']=_[_0x75e1('0x18')](config[_0x75e1('0x19')],{'host':_0x75e1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75e1('0x19')]));require(_0x75e1('0x1b'))[_0x75e1('0x1c')](socket);function respondWithStatusCode(_0x260f06,_0x582b54){_0x582b54=_0x582b54||0xcc;return function(_0x2686a0){if(_0x2686a0){return _0x260f06[_0x75e1('0x1d')](_0x582b54);}return _0x260f06[_0x75e1('0x1e')](_0x582b54)[_0x75e1('0x1f')]();};}function respondWithResult(_0x3b50fe,_0x125932){_0x125932=_0x125932||0xc8;return function(_0x2fcad5){if(_0x2fcad5){return _0x3b50fe['status'](_0x125932)[_0x75e1('0x20')](_0x2fcad5);}};}function respondWithFilteredResult(_0x14dc9d,_0x2128af){return function(_0x5ac788){if(_0x5ac788){var _0x12a4d9=typeof _0x2128af[_0x75e1('0x21')]==='undefined'&&typeof _0x2128af[_0x75e1('0x22')]===_0x75e1('0x23');var _0x3bbe34=_0x5ac788['count'];var _0x384553=_0x12a4d9?0x0:_0x2128af[_0x75e1('0x21')];var _0x271783=_0x12a4d9?_0x5ac788[_0x75e1('0x24')]:_0x2128af[_0x75e1('0x21')]+_0x2128af['limit'];var _0x216697;if(_0x271783>=_0x3bbe34){_0x271783=_0x3bbe34;_0x216697=0xc8;}else{_0x216697=0xce;}_0x14dc9d['status'](_0x216697);return _0x14dc9d[_0x75e1('0x25')](_0x75e1('0x26'),_0x384553+'-'+_0x271783+'/'+_0x3bbe34)[_0x75e1('0x20')](_0x5ac788);}return null;};}function patchUpdates(_0x50cdc1){return function(_0x4b17d5){try{jsonpatch[_0x75e1('0x27')](_0x4b17d5,_0x50cdc1,!![]);}catch(_0xd3f274){return BPromise[_0x75e1('0x28')](_0xd3f274);}return _0x4b17d5[_0x75e1('0x29')]();};}function saveUpdates(_0x1f81e6,_0x1d7c2e){return function(_0x10cca4){if(_0x10cca4){return _0x10cca4['update'](_0x1f81e6)[_0x75e1('0x2a')](function(_0x23c9d0){return _0x23c9d0;});}return null;};}function removeEntity(_0x1f77d7,_0x2b23a9){return function(_0x1a1092){if(_0x1a1092){return _0x1a1092[_0x75e1('0x2b')]()[_0x75e1('0x2a')](function(){_0x1f77d7[_0x75e1('0x1e')](0xcc)[_0x75e1('0x1f')]();});}};}function handleEntityNotFound(_0x51f300,_0x3ecd50){return function(_0x262a55){if(!_0x262a55){_0x51f300[_0x75e1('0x1d')](0x194);}return _0x262a55;};}function handleError(_0x4da785,_0x24ab1e){_0x24ab1e=_0x24ab1e||0x1f4;return function(_0x537914){logger['error'](_0x537914[_0x75e1('0x2c')]);if(_0x537914[_0x75e1('0x2d')]){delete _0x537914[_0x75e1('0x2d')];}_0x4da785[_0x75e1('0x1e')](_0x24ab1e)[_0x75e1('0x2e')](_0x537914);};}exports['show']=function(_0x77688c,_0x116df7){var _0x142530={'raw':![],'where':{'id':_0x77688c[_0x75e1('0x2f')]['id']}},_0x5e30f1={};_0x5e30f1[_0x75e1('0x30')]=_['keys'](db[_0x75e1('0x31')][_0x75e1('0x32')]);_0x5e30f1[_0x75e1('0x33')]=_[_0x75e1('0x34')](_0x77688c[_0x75e1('0x33')]);_0x5e30f1['filters']=_[_0x75e1('0x35')](_0x5e30f1[_0x75e1('0x30')],_0x5e30f1['query']);_0x142530[_0x75e1('0x36')]=_[_0x75e1('0x35')](_0x5e30f1[_0x75e1('0x30')],qs[_0x75e1('0x37')](_0x77688c[_0x75e1('0x33')][_0x75e1('0x37')]));_0x142530['attributes']=_0x142530[_0x75e1('0x36')]['length']?_0x142530['attributes']:_0x5e30f1[_0x75e1('0x30')];if(_0x77688c[_0x75e1('0x33')][_0x75e1('0x38')]){_0x142530[_0x75e1('0x39')]=[{'all':!![]}];}_0x142530=_[_0x75e1('0x3a')]({},_0x142530,_0x77688c[_0x75e1('0x3b')]);return db[_0x75e1('0x31')][_0x75e1('0x3c')](_0x142530)[_0x75e1('0x2a')](handleEntityNotFound(_0x116df7,null))[_0x75e1('0x2a')](respondWithResult(_0x116df7,null))[_0x75e1('0x3d')](handleError(_0x116df7,null));};exports[_0x75e1('0x2b')]=function(_0x1cf466,_0x5779c8){return db[_0x75e1('0x31')][_0x75e1('0x3c')]({'where':{'id':_0x1cf466[_0x75e1('0x2f')]['id']}})[_0x75e1('0x2a')](handleEntityNotFound(_0x5779c8,null))[_0x75e1('0x2a')](removeEntity(_0x5779c8,null))[_0x75e1('0x3d')](handleError(_0x5779c8,null));};function widgetAttributes(_0x5ac468){try{switch(_0x5ac468[_0x75e1('0x3e')]){case _0x75e1('0x3f'):return[{'name':_0x75e1('0x40'),'value':_0x5ac468[_0x75e1('0x40')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468['attrs'][0x0][_0x75e1('0x42')]:undefined)||_0x75e1('0x43')}];case'custom':return[{'name':_0x75e1('0x44'),'value':_0x5ac468[_0x75e1('0x44')]||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468[_0x75e1('0x41')][0x0][_0x75e1('0x42')]:undefined)||''}];case _0x75e1('0x45'):return[{'name':_0x75e1('0x46'),'value':_0x5ac468[_0x75e1('0x46')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468['attrs'][0x0]?_0x5ac468[_0x75e1('0x41')][0x0][_0x75e1('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x75e1('0x47'),'value':_0x5ac468['attrTimezone']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x1]?_0x5ac468['attrs'][0x1]['value']:undefined)||_0x75e1('0x48')},{'name':'attrFontSize','value':_0x5ac468[_0x75e1('0x49')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x2]?_0x5ac468[_0x75e1('0x41')][0x2]['value']:undefined)||0xc}];case _0x75e1('0x4a'):return[{'name':_0x75e1('0x4b'),'value':_0x5ac468[_0x75e1('0x4b')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468['attrs'][0x0][_0x75e1('0x42')]:undefined)||_0x75e1('0x4c')},{'name':_0x75e1('0x4d'),'value':_0x5ac468[_0x75e1('0x4d')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x1]?_0x5ac468[_0x75e1('0x41')][0x1]['value']:undefined)||[]},{'name':_0x75e1('0x49'),'value':_0x5ac468['attrFontSize']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x2]?_0x5ac468[_0x75e1('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x75e1('0x4e'),'value':_0x5ac468['attrChannel']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x3]?_0x5ac468[_0x75e1('0x41')][0x3][_0x75e1('0x42')]:undefined)||'voice'},{'name':_0x75e1('0x4f'),'value':_0x5ac468[_0x75e1('0x4f')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x4]?_0x5ac468[_0x75e1('0x41')][0x4][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x50'),'value':_0x5ac468[_0x75e1('0x50')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x5]?_0x5ac468[_0x75e1('0x41')][0x5][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x51'),'value':_0x5ac468[_0x75e1('0x51')]||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x6]?_0x5ac468[_0x75e1('0x41')][0x6][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x52'),'value':_0x5ac468['attrOpenchannelAccounts']||(_0x5ac468['attrs']&&_0x5ac468['attrs'][0x7]?_0x5ac468[_0x75e1('0x41')][0x7][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x53'),'value':_0x5ac468['attrWhatsappAccounts']||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x8]?_0x5ac468[_0x75e1('0x41')][0x8][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x54'),'value':_0x5ac468[_0x75e1('0x54')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x9]?_0x5ac468[_0x75e1('0x41')][0x9]['value']:undefined)||''}];case _0x75e1('0x55'):case _0x75e1('0x56'):return[{'name':'attrSerie1','value':_0x5ac468['attrSerie1']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468[_0x75e1('0x41')][0x0][_0x75e1('0x42')]:undefined)||_0x75e1('0x4c')},{'name':_0x75e1('0x57'),'value':_0x5ac468[_0x75e1('0x57')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468['attrs'][0x1]?_0x5ac468['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5ac468[_0x75e1('0x58')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468['attrs'][0x2]?_0x5ac468['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5ac468[_0x75e1('0x4d')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x3]?_0x5ac468[_0x75e1('0x41')][0x3][_0x75e1('0x42')]:undefined)||[]},{'name':'attrChannel','value':_0x5ac468['attrChannel']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x4]?_0x5ac468[_0x75e1('0x41')][0x4][_0x75e1('0x42')]:undefined)||'voice'},{'name':_0x75e1('0x4f'),'value':_0x5ac468[_0x75e1('0x4f')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x5]?_0x5ac468[_0x75e1('0x41')][0x5][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x50'),'value':_0x5ac468[_0x75e1('0x50')]||(_0x5ac468['attrs']&&_0x5ac468['attrs'][0x6]?_0x5ac468['attrs'][0x6][_0x75e1('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5ac468['attrSmsAccounts']||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x7]?_0x5ac468[_0x75e1('0x41')][0x7][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x52'),'value':_0x5ac468['attrOpenchannelAccounts']||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x8]?_0x5ac468['attrs'][0x8][_0x75e1('0x42')]:undefined)||''},{'name':_0x75e1('0x53'),'value':_0x5ac468[_0x75e1('0x53')]||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x9]?_0x5ac468[_0x75e1('0x41')][0x9][_0x75e1('0x42')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5ac468[_0x75e1('0x54')]||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0xa]?_0x5ac468[_0x75e1('0x41')][0xa][_0x75e1('0x42')]:undefined)||''}];case _0x75e1('0x59'):return[{'name':_0x75e1('0x5a'),'type':_0x5ac468['reportType']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468['attrs'][0x0][_0x75e1('0x3e')]:undefined)||null,'value':_0x5ac468['attrReport']||(_0x5ac468['attrs']&&_0x5ac468[_0x75e1('0x41')][0x0]?_0x5ac468[_0x75e1('0x41')][0x0][_0x75e1('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x5ac468['attrRefresh']||(_0x5ac468[_0x75e1('0x41')]&&_0x5ac468[_0x75e1('0x41')][0x1]?_0x5ac468[_0x75e1('0x41')][0x1][_0x75e1('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x5b9111){logger['error']('widgetAttributes:\x20%s',JSON[_0x75e1('0x5b')](_0x5b9111));return[];}}exports['create']=function(_0x5ae929,_0x8d780b){if(_0x5ae929[_0x75e1('0x5c')]){_0x5ae929[_0x75e1('0x5c')][_0x75e1('0x41')]=widgetAttributes(_0x5ae929[_0x75e1('0x5c')]);}return db[_0x75e1('0x31')][_0x75e1('0x5d')](_0x5ae929[_0x75e1('0x5c')],{})[_0x75e1('0x2a')](respondWithResult(_0x8d780b,0xc9))[_0x75e1('0x3d')](handleError(_0x8d780b,null));};exports[_0x75e1('0x5e')]=function(_0x46b6a3,_0x481920){if(_0x46b6a3['body']['id']){delete _0x46b6a3['body']['id'];}_0x46b6a3[_0x75e1('0x5c')]['attrs']=widgetAttributes(_0x46b6a3[_0x75e1('0x5c')]);return db['DashboardItem'][_0x75e1('0x3c')]({'where':{'id':_0x46b6a3[_0x75e1('0x2f')]['id']}})[_0x75e1('0x2a')](handleEntityNotFound(_0x481920,null))['then'](saveUpdates(_0x46b6a3[_0x75e1('0x5c')],null))[_0x75e1('0x2a')](respondWithResult(_0x481920,null))[_0x75e1('0x3d')](handleError(_0x481920,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d9670b5..be045cc 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 _0xf1a2=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0xf1a2,0x1f0));var _0x2f1a=function(_0x183b83,_0x12bba1){_0x183b83=_0x183b83-0x0;var _0x4c7ae1=_0xf1a2[_0x183b83];return _0x4c7ae1;};'use strict';var EventEmitter=require(_0x2f1a('0x0'));var DashboardItem=require(_0x2f1a('0x1'))['db'][_0x2f1a('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2f1a('0x3')](0x0);var events={'afterCreate':_0x2f1a('0x4'),'afterUpdate':_0x2f1a('0x5'),'afterDestroy':_0x2f1a('0x6')};function emitEvent(_0x1ea074){return function(_0x237144,_0x522fe6,_0x37514c){DashboardItemEvents[_0x2f1a('0x7')](_0x1ea074+':'+_0x237144['id'],_0x237144);DashboardItemEvents[_0x2f1a('0x7')](_0x1ea074,_0x237144);_0x37514c(null);};}for(var e in events){if(events[_0x2f1a('0x8')](e)){var event=events[e];DashboardItem[_0x2f1a('0x9')](e,emitEvent(event));}}module[_0x2f1a('0xa')]=DashboardItemEvents; \ No newline at end of file +var _0x6eee=['hook','exports','events','../../mysqldb','DashboardItem','save','update','remove','emit'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x6eee,0x119));var _0xe6ee=function(_0x204173,_0x83fe1c){_0x204173=_0x204173-0x0;var _0x52419a=_0x6eee[_0x204173];return _0x52419a;};'use strict';var EventEmitter=require(_0xe6ee('0x0'));var DashboardItem=require(_0xe6ee('0x1'))['db'][_0xe6ee('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe6ee('0x3'),'afterUpdate':_0xe6ee('0x4'),'afterDestroy':_0xe6ee('0x5')};function emitEvent(_0x53f61b){return function(_0x16b0f8,_0x3c14a9,_0x13f918){DashboardItemEvents[_0xe6ee('0x6')](_0x53f61b+':'+_0x16b0f8['id'],_0x16b0f8);DashboardItemEvents[_0xe6ee('0x6')](_0x53f61b,_0x16b0f8);_0x13f918(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0xe6ee('0x7')](e,emitEvent(event));}}module[_0xe6ee('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index d492573..ed66bd4 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 _0x60bb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x4d6fc2,_0x9893dd){var _0x4cc375=function(_0x26ba9b){while(--_0x26ba9b){_0x4d6fc2['push'](_0x4d6fc2['shift']());}};_0x4cc375(++_0x9893dd);}(_0x60bb,0x164));var _0xb60b=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x60bb[_0x65c0bb];return _0x320bd5;};'use strict';var _=require(_0xb60b('0x0'));var util=require(_0xb60b('0x1'));var logger=require(_0xb60b('0x2'))(_0xb60b('0x3'));var moment=require(_0xb60b('0x4'));var BPromise=require(_0xb60b('0x5'));var rp=require(_0xb60b('0x6'));var fs=require('fs');var path=require(_0xb60b('0x7'));var rimraf=require(_0xb60b('0x8'));var config=require(_0xb60b('0x9'));var attributes=require(_0xb60b('0xa'));module[_0xb60b('0xb')]=function(_0x1863d3,_0x4bf6bd){return _0x1863d3[_0xb60b('0xc')](_0xb60b('0xd'),attributes,{'tableName':_0xb60b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b89=['../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','util','api'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x5b89,0xdd));var _0x95b8=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0x5b89[_0x21de89];return _0x290b7e;};'use strict';var _=require(_0x95b8('0x0'));var util=require(_0x95b8('0x1'));var logger=require('../../config/logger')(_0x95b8('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(_0x95b8('0x3'));var attributes=require(_0x95b8('0x4'));module['exports']=function(_0x569c09,_0x5b50f8){return _0x569c09[_0x95b8('0x5')](_0x95b8('0x6'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 7b5bfea..4caaba8 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 _0x6074=['register','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','./dashboardItem.socket'];(function(_0x15f89d,_0x2111eb){var _0x709b43=function(_0x395499){while(--_0x395499){_0x15f89d['push'](_0x15f89d['shift']());}};_0x709b43(++_0x2111eb);}(_0x6074,0x105));var _0x4607=function(_0x5e28c2,_0x1e48ab){_0x5e28c2=_0x5e28c2-0x0;var _0x1a8cc6=_0x6074[_0x5e28c2];return _0x1a8cc6;};'use strict';var _=require(_0x4607('0x0'));var util=require(_0x4607('0x1'));var moment=require('moment');var BPromise=require(_0x4607('0x2'));var rs=require(_0x4607('0x3'));var fs=require('fs');var Redis=require(_0x4607('0x4'));var db=require(_0x4607('0x5'))['db'];var utils=require(_0x4607('0x6'));var logger=require(_0x4607('0x7'))('rpc');var config=require(_0x4607('0x8'));var jayson=require(_0x4607('0x9'));var client=jayson['client'][_0x4607('0xa')]({'port':0x232a});config[_0x4607('0xb')]=_[_0x4607('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4607('0xb')]));require(_0x4607('0xd'))[_0x4607('0xe')](socket);function respondWithRpcPromise(_0x5b7c4d,_0x2b6c48,_0x2401d9){return new BPromise(function(_0x186823,_0x5da4df){return client[_0x4607('0xf')](_0x5b7c4d,_0x2401d9)['then'](function(_0x43e8f8){logger[_0x4607('0x10')](_0x4607('0x11'),_0x2b6c48,_0x4607('0x12'));logger[_0x4607('0x13')](_0x4607('0x14'),_0x2b6c48,_0x4607('0x12'),JSON['stringify'](_0x43e8f8));if(_0x43e8f8['error']){if(_0x43e8f8['error']['code']===0x1f4){logger[_0x4607('0x15')](_0x4607('0x11'),_0x2b6c48,_0x43e8f8['error'][_0x4607('0x16')]);return _0x5da4df(_0x43e8f8[_0x4607('0x15')][_0x4607('0x16')]);}logger[_0x4607('0x15')](_0x4607('0x11'),_0x2b6c48,_0x43e8f8[_0x4607('0x15')][_0x4607('0x16')]);return _0x186823(_0x43e8f8['error'][_0x4607('0x16')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x2b6c48,_0x4607('0x12'));_0x186823(_0x43e8f8[_0x4607('0x17')][_0x4607('0x16')]);}})[_0x4607('0x18')](function(_0x5624b1){logger[_0x4607('0x15')]('DashboardItem,\x20%s,\x20%s',_0x2b6c48,_0x5624b1);_0x5da4df(_0x5624b1);});});} \ No newline at end of file +var _0x07ce=['client','http','redis','defaults','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','DashboardItem,\x20%s,\x20%s','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x4f419f,_0x3a01aa){var _0x33ad47=function(_0x520c95){while(--_0x520c95){_0x4f419f['push'](_0x4f419f['shift']());}};_0x33ad47(++_0x3a01aa);}(_0x07ce,0xea));var _0xe07c=function(_0x5b7c1e,_0x1f98a9){_0x5b7c1e=_0x5b7c1e-0x0;var _0x53678c=_0x07ce[_0x5b7c1e];return _0x53678c;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe07c('0x0'));var rs=require(_0xe07c('0x1'));var fs=require('fs');var Redis=require(_0xe07c('0x2'));var db=require(_0xe07c('0x3'))['db'];var utils=require(_0xe07c('0x4'));var logger=require('../../config/logger')(_0xe07c('0x5'));var config=require(_0xe07c('0x6'));var jayson=require(_0xe07c('0x7'));var client=jayson[_0xe07c('0x8')][_0xe07c('0x9')]({'port':0x232a});config[_0xe07c('0xa')]=_[_0xe07c('0xb')](config[_0xe07c('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe07c('0xa')]));require('./dashboardItem.socket')[_0xe07c('0xc')](socket);function respondWithRpcPromise(_0x5c96ee,_0x2f614b,_0x68e62){return new BPromise(function(_0x5c47d0,_0x471918){return client[_0xe07c('0xd')](_0x5c96ee,_0x68e62)['then'](function(_0x364922){logger[_0xe07c('0xe')]('DashboardItem,\x20%s,\x20%s',_0x2f614b,'request\x20sent');logger[_0xe07c('0xf')](_0xe07c('0x10'),_0x2f614b,'request\x20sent',JSON['stringify'](_0x364922));if(_0x364922['error']){if(_0x364922[_0xe07c('0x11')][_0xe07c('0x12')]===0x1f4){logger[_0xe07c('0x11')](_0xe07c('0x13'),_0x2f614b,_0x364922['error'][_0xe07c('0x14')]);return _0x471918(_0x364922[_0xe07c('0x11')][_0xe07c('0x14')]);}logger[_0xe07c('0x11')]('DashboardItem,\x20%s,\x20%s',_0x2f614b,_0x364922[_0xe07c('0x11')]['message']);return _0x5c47d0(_0x364922['error'][_0xe07c('0x14')]);}else{logger[_0xe07c('0xe')](_0xe07c('0x13'),_0x2f614b,'request\x20sent');_0x5c47d0(_0x364922['result'][_0xe07c('0x14')]);}})[_0xe07c('0x15')](function(_0x2d4ca4){logger[_0xe07c('0x11')](_0xe07c('0x13'),_0x2f614b,_0x2d4ca4);_0x471918(_0x2d4ca4);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0123c7f..3decbf1 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 _0xbf03=['./dashboardItem.events','remove','update','emit','removeListener','register','length','dashboardItem:'];(function(_0x4566db,_0x5da9a1){var _0x3167e6=function(_0x154ed8){while(--_0x154ed8){_0x4566db['push'](_0x4566db['shift']());}};_0x3167e6(++_0x5da9a1);}(_0xbf03,0x168));var _0x3bf0=function(_0x125f6b,_0x48779f){_0x125f6b=_0x125f6b-0x0;var _0x5bc507=_0xbf03[_0x125f6b];return _0x5bc507;};'use strict';var DashboardItemEvents=require(_0x3bf0('0x0'));var events=['save',_0x3bf0('0x1'),_0x3bf0('0x2')];function createListener(_0x1c904c,_0x9c1b95){return function(_0x544085){_0x9c1b95[_0x3bf0('0x3')](_0x1c904c,_0x544085);};}function removeListener(_0x361ee9,_0x27cc97){return function(){DashboardItemEvents[_0x3bf0('0x4')](_0x361ee9,_0x27cc97);};}exports[_0x3bf0('0x5')]=function(_0x1b6dd8){for(var _0x51a6c5=0x0,_0x50b291=events[_0x3bf0('0x6')];_0x51a6c5<_0x50b291;_0x51a6c5++){var _0x290f77=events[_0x51a6c5];var _0x1678ef=createListener(_0x3bf0('0x7')+_0x290f77,_0x1b6dd8);DashboardItemEvents['on'](_0x290f77,_0x1678ef);}}; \ No newline at end of file +var _0x8138=['remove','update','emit','./dashboardItem.events','save'];(function(_0x45e802,_0x154387){var _0x13cc7a=function(_0x10deaf){while(--_0x10deaf){_0x45e802['push'](_0x45e802['shift']());}};_0x13cc7a(++_0x154387);}(_0x8138,0x125));var _0x8813=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x8138[_0xe51596];return _0x22c705;};'use strict';var DashboardItemEvents=require(_0x8813('0x0'));var events=[_0x8813('0x1'),_0x8813('0x2'),_0x8813('0x3')];function createListener(_0x58f4ec,_0x1a9921){return function(_0x419407){_0x1a9921[_0x8813('0x4')](_0x58f4ec,_0x419407);};}function removeListener(_0x188c8f,_0x432193){return function(){DashboardItemEvents['removeListener'](_0x188c8f,_0x432193);};}exports['register']=function(_0x3eb903){for(var _0x546fa2=0x0,_0xa47b44=events['length'];_0x546fa2<_0xa47b44;_0x546fa2++){var _0x452b10=events[_0x546fa2];var _0x12bed2=createListener('dashboardItem:'+_0x452b10,_0x3eb903);DashboardItemEvents['on'](_0x452b10,_0x12bed2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ddc581b..e90a7ea 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 _0xddf0=['update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','isAuthenticated','show','create','put','/:id'];(function(_0x3f9e58,_0x5811a1){var _0x20ed19=function(_0x45e394){while(--_0x45e394){_0x3f9e58['push'](_0x3f9e58['shift']());}};_0x20ed19(++_0x5811a1);}(_0xddf0,0xb3));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0ddf('0x0'));var util=require('util');var path=require(_0x0ddf('0x1'));var timeout=require(_0x0ddf('0x2'));var express=require(_0x0ddf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0ddf('0x4'));var interaction=require(_0x0ddf('0x5'));var config=require('../../config/environment');var controller=require(_0x0ddf('0x6'));router[_0x0ddf('0x7')]('/:id',auth[_0x0ddf('0x8')](),controller[_0x0ddf('0x9')]);router['post']('/',auth[_0x0ddf('0x8')](),controller[_0x0ddf('0xa')]);router[_0x0ddf('0xb')](_0x0ddf('0xc'),auth['isAuthenticated'](),controller[_0x0ddf('0xd')]);router[_0x0ddf('0xe')](_0x0ddf('0xc'),auth[_0x0ddf('0x8')](),controller['destroy']);module[_0x0ddf('0xf')]=router; \ No newline at end of file +var _0xad1e=['put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','/:id','show','post','isAuthenticated'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xad1e,0x95));var _0xead1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xad1e[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xead1('0x0'));var util=require(_0xead1('0x1'));var path=require('path');var timeout=require(_0xead1('0x2'));var express=require(_0xead1('0x3'));var router=express['Router']();var fs_extra=require(_0xead1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xead1('0x5'));var config=require(_0xead1('0x6'));var controller=require('./dashboardItem.controller');router['get'](_0xead1('0x7'),auth['isAuthenticated'](),controller[_0xead1('0x8')]);router[_0xead1('0x9')]('/',auth[_0xead1('0xa')](),controller['create']);router[_0xead1('0xb')](_0xead1('0x7'),auth[_0xead1('0xa')](),controller[_0xead1('0xc')]);router[_0xead1('0xd')](_0xead1('0x7'),auth[_0xead1('0xa')](),controller[_0xead1('0xe')]);module[_0xead1('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index aa94d30..527eb5b 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 _0xb57c=['first','second','third','sequelize','exports','STRING'];(function(_0x4c9b6a,_0x15f730){var _0x42f268=function(_0x56faf0){while(--_0x56faf0){_0x4c9b6a['push'](_0x4c9b6a['shift']());}};_0x42f268(++_0x15f730);}(_0xb57c,0x1b9));var _0xcb57=function(_0x365aa8,_0x45af85){_0x365aa8=_0x365aa8-0x0;var _0x1d64bd=_0xb57c[_0x365aa8];return _0x1d64bd;};'use strict';var Sequelize=require(_0xcb57('0x0'));module[_0xcb57('0x1')]={'name':{'type':Sequelize[_0xcb57('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xcb57('0x3'),_0xcb57('0x4'),_0xcb57('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xcb57('0x2')]}}; \ No newline at end of file +var _0xc928=['exports','STRING','first','second','third','sequelize'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xc928,0x197));var _0x8c92=function(_0x5396e3,_0x2542a4){_0x5396e3=_0x5396e3-0x0;var _0x2c489e=_0xc928[_0x5396e3];return _0x2c489e;};'use strict';var Sequelize=require(_0x8c92('0x0'));module[_0x8c92('0x1')]={'name':{'type':Sequelize[_0x8c92('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0x8c92('0x3'),_0x8c92('0x4'),_0x8c92('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9f8f128..e46bfa7 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 _0xc80f=['rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition'];(function(_0x338988,_0x1dbc86){var _0xfdf1d0=function(_0x35aeb8){while(--_0x35aeb8){_0x338988['push'](_0x338988['shift']());}};_0xfdf1d0(++_0x1dbc86);}(_0xc80f,0x7e));var _0xfc80=function(_0x1ddacc,_0x324208){_0x1ddacc=_0x1ddacc-0x0;var _0x49cea7=_0xc80f[_0x1ddacc];return _0x49cea7;};'use strict';var emlformat=require(_0xfc80('0x0'));var rimraf=require(_0xfc80('0x1'));var zipdir=require(_0xfc80('0x2'));var jsonpatch=require(_0xfc80('0x3'));var rp=require(_0xfc80('0x4'));var moment=require(_0xfc80('0x5'));var BPromise=require(_0xfc80('0x6'));var Mustache=require(_0xfc80('0x7'));var util=require(_0xfc80('0x8'));var path=require(_0xfc80('0x9'));var sox=require(_0xfc80('0xa'));var csv=require(_0xfc80('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc80('0xc'));var _=require('lodash');var squel=require(_0xfc80('0xd'));var crypto=require(_0xfc80('0xe'));var jsforce=require(_0xfc80('0xf'));var deskjs=require(_0xfc80('0x10'));var toCsv=require(_0xfc80('0xb'));var querystring=require('querystring');var Papa=require(_0xfc80('0x11'));var Redis=require(_0xfc80('0x12'));var authService=require(_0xfc80('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xfc80('0x14'));var hardwareService=require(_0xfc80('0x15'));var logger=require(_0xfc80('0x16'))(_0xfc80('0x17'));var utils=require(_0xfc80('0x18'));var config=require(_0xfc80('0x19'));var licenseUtil=require(_0xfc80('0x1a'));var db=require(_0xfc80('0x1b'))['db'];function respondWithStatusCode(_0xe751c3,_0x44bd5a){_0x44bd5a=_0x44bd5a||0xcc;return function(_0x2013ac){if(_0x2013ac){return _0xe751c3[_0xfc80('0x1c')](_0x44bd5a);}return _0xe751c3[_0xfc80('0x1d')](_0x44bd5a)[_0xfc80('0x1e')]();};}function respondWithResult(_0x293b22,_0x44c8bd){_0x44c8bd=_0x44c8bd||0xc8;return function(_0x28f290){if(_0x28f290){return _0x293b22[_0xfc80('0x1d')](_0x44c8bd)[_0xfc80('0x1f')](_0x28f290);}};}function respondWithFilteredResult(_0x33d42b,_0xca51fd){return function(_0xe78e30){if(_0xe78e30){var _0x2b574f=typeof _0xca51fd[_0xfc80('0x20')]===_0xfc80('0x21')&&typeof _0xca51fd[_0xfc80('0x22')]===_0xfc80('0x21');var _0x2cba5c=_0xe78e30[_0xfc80('0x23')];var _0x4ef1d1=_0x2b574f?0x0:_0xca51fd[_0xfc80('0x20')];var _0x44d6d8=_0x2b574f?_0xe78e30['count']:_0xca51fd['offset']+_0xca51fd[_0xfc80('0x22')];var _0x3316c5;if(_0x44d6d8>=_0x2cba5c){_0x44d6d8=_0x2cba5c;_0x3316c5=0xc8;}else{_0x3316c5=0xce;}_0x33d42b[_0xfc80('0x1d')](_0x3316c5);return _0x33d42b[_0xfc80('0x24')](_0xfc80('0x25'),_0x4ef1d1+'-'+_0x44d6d8+'/'+_0x2cba5c)[_0xfc80('0x1f')](_0xe78e30);}return null;};}function patchUpdates(_0x2a5f19){return function(_0x57cdd1){try{jsonpatch[_0xfc80('0x26')](_0x57cdd1,_0x2a5f19,!![]);}catch(_0x3d2bad){return BPromise[_0xfc80('0x27')](_0x3d2bad);}return _0x57cdd1['save']();};}function saveUpdates(_0x2355da,_0x12a4e7){return function(_0x4beb7d){if(_0x4beb7d){return _0x4beb7d[_0xfc80('0x28')](_0x2355da)[_0xfc80('0x29')](function(_0x5f3e84){return _0x5f3e84;});}return null;};}function removeEntity(_0x35c787,_0x8e0c08){return function(_0x298494){if(_0x298494){return _0x298494[_0xfc80('0x2a')]()[_0xfc80('0x29')](function(){var _0x3b8c10=_0x298494['get']({'plain':!![]});var _0x7d23e2=_0xfc80('0x2b');return db[_0xfc80('0x2c')][_0xfc80('0x2a')]({'where':{'type':_0x7d23e2,'resourceId':_0x3b8c10['id']}})[_0xfc80('0x29')](function(){return _0x298494;});})[_0xfc80('0x29')](function(){_0x35c787[_0xfc80('0x1d')](0xcc)[_0xfc80('0x1e')]();});}};}function handleEntityNotFound(_0x5709e5,_0x1b1f07){return function(_0x52a101){if(!_0x52a101){_0x5709e5['sendStatus'](0x194);}return _0x52a101;};}function handleError(_0x38305d,_0x1f8290){_0x1f8290=_0x1f8290||0x1f4;return function(_0x27eb59){logger[_0xfc80('0x2d')](_0x27eb59[_0xfc80('0x2e')]);if(_0x27eb59[_0xfc80('0x2f')]){delete _0x27eb59['name'];}_0x38305d['status'](_0x1f8290)[_0xfc80('0x30')](_0x27eb59);};}exports[_0xfc80('0x31')]=function(_0x150bed,_0x31c4fd){var _0x315cf3={},_0x574426={},_0x6edecd={'count':0x0,'rows':[]};var _0x2b03dc=_[_0xfc80('0x32')](db[_0xfc80('0x33')][_0xfc80('0x34')],function(_0x5efa9e){return{'name':_0x5efa9e[_0xfc80('0x35')],'type':_0x5efa9e[_0xfc80('0x36')][_0xfc80('0x37')]};});_0x574426['model']=_['map'](_0x2b03dc,_0xfc80('0x2f'));_0x574426['query']=_[_0xfc80('0x38')](_0x150bed[_0xfc80('0x39')]);_0x574426[_0xfc80('0x3a')]=_[_0xfc80('0x3b')](_0x574426[_0xfc80('0x3c')],_0x574426[_0xfc80('0x39')]);_0x315cf3['attributes']=_[_0xfc80('0x3b')](_0x574426[_0xfc80('0x3c')],qs['fields'](_0x150bed[_0xfc80('0x39')][_0xfc80('0x3d')]));_0x315cf3[_0xfc80('0x3e')]=_0x315cf3[_0xfc80('0x3e')]['length']?_0x315cf3[_0xfc80('0x3e')]:_0x574426[_0xfc80('0x3c')];if(!_0x150bed[_0xfc80('0x39')][_0xfc80('0x3f')](_0xfc80('0x40'))){_0x315cf3[_0xfc80('0x22')]=qs[_0xfc80('0x22')](_0x150bed[_0xfc80('0x39')][_0xfc80('0x22')]);_0x315cf3[_0xfc80('0x20')]=qs[_0xfc80('0x20')](_0x150bed[_0xfc80('0x39')][_0xfc80('0x20')]);}_0x315cf3[_0xfc80('0x41')]=qs[_0xfc80('0x42')](_0x150bed[_0xfc80('0x39')][_0xfc80('0x42')]);_0x315cf3['where']=qs[_0xfc80('0x3a')](_[_0xfc80('0x43')](_0x150bed[_0xfc80('0x39')],_0x574426[_0xfc80('0x3a')]),_0x2b03dc);if(_0x150bed[_0xfc80('0x39')][_0xfc80('0x44')]){_0x315cf3[_0xfc80('0x45')]=_[_0xfc80('0x46')](_0x315cf3[_0xfc80('0x45')],{'$or':_[_0xfc80('0x32')](_0x2b03dc,function(_0x365281){if(_0x365281[_0xfc80('0x36')]!==_0xfc80('0x47')){var _0x17a875={};_0x17a875[_0x365281[_0xfc80('0x2f')]]={'$like':'%'+_0x150bed[_0xfc80('0x39')][_0xfc80('0x44')]+'%'};return _0x17a875;}})});}_0x315cf3=_['merge']({},_0x315cf3,_0x150bed['options']);var _0x484524={'where':_0x315cf3[_0xfc80('0x45')]};return db['Disposition'][_0xfc80('0x23')](_0x484524)[_0xfc80('0x29')](function(_0x381dd9){_0x6edecd[_0xfc80('0x23')]=_0x381dd9;if(_0x150bed[_0xfc80('0x39')][_0xfc80('0x48')]){_0x315cf3[_0xfc80('0x49')]=[{'all':!![]}];}return db['Disposition'][_0xfc80('0x4a')](_0x315cf3);})[_0xfc80('0x29')](function(_0x1a69f2){_0x6edecd[_0xfc80('0x4b')]=_0x1a69f2;return _0x6edecd;})[_0xfc80('0x29')](respondWithFilteredResult(_0x31c4fd,_0x315cf3))[_0xfc80('0x4c')](handleError(_0x31c4fd,null));};exports[_0xfc80('0x4d')]=function(_0x21ac71,_0x3de8fc){var _0x2179fd={'raw':!![],'where':{'id':_0x21ac71['params']['id']}},_0x2e2ce5={};_0x2e2ce5[_0xfc80('0x3c')]=_[_0xfc80('0x38')](db[_0xfc80('0x33')][_0xfc80('0x34')]);_0x2e2ce5[_0xfc80('0x39')]=_[_0xfc80('0x38')](_0x21ac71[_0xfc80('0x39')]);_0x2e2ce5[_0xfc80('0x3a')]=_[_0xfc80('0x3b')](_0x2e2ce5['model'],_0x2e2ce5[_0xfc80('0x39')]);_0x2179fd[_0xfc80('0x3e')]=_[_0xfc80('0x3b')](_0x2e2ce5[_0xfc80('0x3c')],qs[_0xfc80('0x3d')](_0x21ac71[_0xfc80('0x39')]['fields']));_0x2179fd['attributes']=_0x2179fd[_0xfc80('0x3e')]['length']?_0x2179fd['attributes']:_0x2e2ce5['model'];if(_0x21ac71[_0xfc80('0x39')][_0xfc80('0x48')]){_0x2179fd[_0xfc80('0x49')]=[{'all':!![]}];}_0x2179fd=_[_0xfc80('0x46')]({},_0x2179fd,_0x21ac71['options']);return db[_0xfc80('0x33')][_0xfc80('0x4e')](_0x2179fd)['then'](handleEntityNotFound(_0x3de8fc,null))['then'](respondWithResult(_0x3de8fc,null))['catch'](handleError(_0x3de8fc,null));};exports[_0xfc80('0x4f')]=function(_0x2495e7,_0x21fd9a){return db[_0xfc80('0x33')][_0xfc80('0x4f')](_0x2495e7['body'],{})[_0xfc80('0x29')](function(_0x9ecbf3){var _0x5de37b=_0x2495e7[_0xfc80('0x50')][_0xfc80('0x51')]({'plain':!![]});if(!_0x5de37b)throw new Error(_0xfc80('0x52'));if(_0x5de37b[_0xfc80('0x53')]===_0xfc80('0x50')){var _0x2b32e9=_0x9ecbf3[_0xfc80('0x51')]({'plain':!![]});var _0xa4965a='Dispositions';return db[_0xfc80('0x54')][_0xfc80('0x4e')]({'where':{'name':_0xa4965a,'userProfileId':_0x5de37b['userProfileId']},'raw':!![]})[_0xfc80('0x29')](function(_0x502d12){if(_0x502d12&&_0x502d12[_0xfc80('0x55')]===0x0){return db[_0xfc80('0x2c')][_0xfc80('0x4f')]({'name':_0x2b32e9['name'],'resourceId':_0x2b32e9['id'],'type':_0x502d12[_0xfc80('0x2f')],'sectionId':_0x502d12['id']},{})['then'](function(){return _0x9ecbf3;});}else{return _0x9ecbf3;}})['catch'](function(_0x5c0b3b){logger[_0xfc80('0x2d')](_0xfc80('0x56'),_0x5c0b3b);throw _0x5c0b3b;});}return _0x9ecbf3;})[_0xfc80('0x29')](respondWithResult(_0x21fd9a,0xc9))['catch'](handleError(_0x21fd9a,null));};exports['update']=function(_0x4f278d,_0x24717b){if(_0x4f278d[_0xfc80('0x57')]['id']){delete _0x4f278d['body']['id'];}return db[_0xfc80('0x33')][_0xfc80('0x4e')]({'where':{'id':_0x4f278d[_0xfc80('0x58')]['id']}})['then'](handleEntityNotFound(_0x24717b,null))['then'](saveUpdates(_0x4f278d['body'],null))[_0xfc80('0x29')](respondWithResult(_0x24717b,null))['catch'](handleError(_0x24717b,null));};exports['destroy']=function(_0x46c2a2,_0x459e6d){return db['Disposition']['find']({'where':{'id':_0x46c2a2[_0xfc80('0x58')]['id']}})['then'](handleEntityNotFound(_0x459e6d,null))[_0xfc80('0x29')](removeEntity(_0x459e6d,null))[_0xfc80('0x4c')](handleError(_0x459e6d,null));}; \ No newline at end of file +var _0x0dbf=['UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','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','apply','reject','save','update','then','destroy','get','Dispositions','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x172090,_0x4a1219){var _0x363fb5=function(_0x3924c5){while(--_0x3924c5){_0x172090['push'](_0x172090['shift']());}};_0x363fb5(++_0x4a1219);}(_0x0dbf,0x1a9));var _0xf0db=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x0dbf[_0x284a61];return _0x220e3c;};'use strict';var emlformat=require(_0xf0db('0x0'));var rimraf=require(_0xf0db('0x1'));var zipdir=require(_0xf0db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0db('0x3'));var Mustache=require(_0xf0db('0x4'));var util=require(_0xf0db('0x5'));var path=require('path');var sox=require(_0xf0db('0x6'));var csv=require(_0xf0db('0x7'));var ejs=require(_0xf0db('0x8'));var fs=require('fs');var fs_extra=require(_0xf0db('0x9'));var _=require(_0xf0db('0xa'));var squel=require(_0xf0db('0xb'));var crypto=require(_0xf0db('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf0db('0x7'));var querystring=require(_0xf0db('0xd'));var Papa=require('papaparse');var Redis=require(_0xf0db('0xe'));var authService=require(_0xf0db('0xf'));var qs=require(_0xf0db('0x10'));var as=require(_0xf0db('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0db('0x12'))(_0xf0db('0x13'));var utils=require(_0xf0db('0x14'));var config=require(_0xf0db('0x15'));var licenseUtil=require(_0xf0db('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ed1a,_0x18a351){_0x18a351=_0x18a351||0xcc;return function(_0x5b6e8b){if(_0x5b6e8b){return _0x10ed1a[_0xf0db('0x17')](_0x18a351);}return _0x10ed1a[_0xf0db('0x18')](_0x18a351)[_0xf0db('0x19')]();};}function respondWithResult(_0x53bef9,_0xc8f9e1){_0xc8f9e1=_0xc8f9e1||0xc8;return function(_0x4fa1c0){if(_0x4fa1c0){return _0x53bef9[_0xf0db('0x18')](_0xc8f9e1)[_0xf0db('0x1a')](_0x4fa1c0);}};}function respondWithFilteredResult(_0x237e6f,_0x445c85){return function(_0x5b13ad){if(_0x5b13ad){var _0x13b5a7=typeof _0x445c85[_0xf0db('0x1b')]===_0xf0db('0x1c')&&typeof _0x445c85['limit']===_0xf0db('0x1c');var _0x4b5986=_0x5b13ad[_0xf0db('0x1d')];var _0x3f3166=_0x13b5a7?0x0:_0x445c85[_0xf0db('0x1b')];var _0xe546d9=_0x13b5a7?_0x5b13ad['count']:_0x445c85[_0xf0db('0x1b')]+_0x445c85[_0xf0db('0x1e')];var _0x346a41;if(_0xe546d9>=_0x4b5986){_0xe546d9=_0x4b5986;_0x346a41=0xc8;}else{_0x346a41=0xce;}_0x237e6f[_0xf0db('0x18')](_0x346a41);return _0x237e6f[_0xf0db('0x1f')](_0xf0db('0x20'),_0x3f3166+'-'+_0xe546d9+'/'+_0x4b5986)[_0xf0db('0x1a')](_0x5b13ad);}return null;};}function patchUpdates(_0x5715af){return function(_0x30f9a2){try{jsonpatch[_0xf0db('0x21')](_0x30f9a2,_0x5715af,!![]);}catch(_0x446270){return BPromise[_0xf0db('0x22')](_0x446270);}return _0x30f9a2[_0xf0db('0x23')]();};}function saveUpdates(_0x2cf6e7,_0x2676b5){return function(_0x2ee523){if(_0x2ee523){return _0x2ee523[_0xf0db('0x24')](_0x2cf6e7)[_0xf0db('0x25')](function(_0x382eaf){return _0x382eaf;});}return null;};}function removeEntity(_0x8bb816,_0x4f1f76){return function(_0x102960){if(_0x102960){return _0x102960[_0xf0db('0x26')]()[_0xf0db('0x25')](function(){var _0x37d989=_0x102960[_0xf0db('0x27')]({'plain':!![]});var _0x3c48ca=_0xf0db('0x28');return db['UserProfileResource'][_0xf0db('0x26')]({'where':{'type':_0x3c48ca,'resourceId':_0x37d989['id']}})['then'](function(){return _0x102960;});})[_0xf0db('0x25')](function(){_0x8bb816[_0xf0db('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e23e1,_0x18eac2){return function(_0x4217d8){if(!_0x4217d8){_0x1e23e1['sendStatus'](0x194);}return _0x4217d8;};}function handleError(_0x8a8c07,_0x343fb8){_0x343fb8=_0x343fb8||0x1f4;return function(_0x3e24f7){logger[_0xf0db('0x29')](_0x3e24f7[_0xf0db('0x2a')]);if(_0x3e24f7[_0xf0db('0x2b')]){delete _0x3e24f7[_0xf0db('0x2b')];}_0x8a8c07[_0xf0db('0x18')](_0x343fb8)[_0xf0db('0x2c')](_0x3e24f7);};}exports[_0xf0db('0x2d')]=function(_0x36b091,_0x3d6b29){var _0x4dd201={},_0x2ae2ef={},_0x246686={'count':0x0,'rows':[]};var _0x2b27d5=_['map'](db[_0xf0db('0x2e')][_0xf0db('0x2f')],function(_0x39b51f){return{'name':_0x39b51f[_0xf0db('0x30')],'type':_0x39b51f[_0xf0db('0x31')][_0xf0db('0x32')]};});_0x2ae2ef[_0xf0db('0x33')]=_[_0xf0db('0x34')](_0x2b27d5,_0xf0db('0x2b'));_0x2ae2ef[_0xf0db('0x35')]=_[_0xf0db('0x36')](_0x36b091[_0xf0db('0x35')]);_0x2ae2ef[_0xf0db('0x37')]=_[_0xf0db('0x38')](_0x2ae2ef[_0xf0db('0x33')],_0x2ae2ef[_0xf0db('0x35')]);_0x4dd201[_0xf0db('0x39')]=_['intersection'](_0x2ae2ef['model'],qs['fields'](_0x36b091[_0xf0db('0x35')][_0xf0db('0x3a')]));_0x4dd201[_0xf0db('0x39')]=_0x4dd201[_0xf0db('0x39')]['length']?_0x4dd201[_0xf0db('0x39')]:_0x2ae2ef[_0xf0db('0x33')];if(!_0x36b091[_0xf0db('0x35')][_0xf0db('0x3b')]('nolimit')){_0x4dd201['limit']=qs[_0xf0db('0x1e')](_0x36b091[_0xf0db('0x35')]['limit']);_0x4dd201[_0xf0db('0x1b')]=qs['offset'](_0x36b091[_0xf0db('0x35')][_0xf0db('0x1b')]);}_0x4dd201[_0xf0db('0x3c')]=qs[_0xf0db('0x3d')](_0x36b091[_0xf0db('0x35')][_0xf0db('0x3d')]);_0x4dd201[_0xf0db('0x3e')]=qs[_0xf0db('0x37')](_['pick'](_0x36b091[_0xf0db('0x35')],_0x2ae2ef[_0xf0db('0x37')]),_0x2b27d5);if(_0x36b091[_0xf0db('0x35')][_0xf0db('0x3f')]){_0x4dd201[_0xf0db('0x3e')]=_[_0xf0db('0x40')](_0x4dd201['where'],{'$or':_[_0xf0db('0x34')](_0x2b27d5,function(_0x416c8b){if(_0x416c8b[_0xf0db('0x31')]!==_0xf0db('0x41')){var _0x50e43c={};_0x50e43c[_0x416c8b[_0xf0db('0x2b')]]={'$like':'%'+_0x36b091[_0xf0db('0x35')][_0xf0db('0x3f')]+'%'};return _0x50e43c;}})});}_0x4dd201=_[_0xf0db('0x40')]({},_0x4dd201,_0x36b091[_0xf0db('0x42')]);var _0x486328={'where':_0x4dd201[_0xf0db('0x3e')]};return db['Disposition'][_0xf0db('0x1d')](_0x486328)[_0xf0db('0x25')](function(_0x1dff47){_0x246686['count']=_0x1dff47;if(_0x36b091['query'][_0xf0db('0x43')]){_0x4dd201[_0xf0db('0x44')]=[{'all':!![]}];}return db[_0xf0db('0x2e')][_0xf0db('0x45')](_0x4dd201);})[_0xf0db('0x25')](function(_0x4f5a60){_0x246686[_0xf0db('0x46')]=_0x4f5a60;return _0x246686;})['then'](respondWithFilteredResult(_0x3d6b29,_0x4dd201))[_0xf0db('0x47')](handleError(_0x3d6b29,null));};exports[_0xf0db('0x48')]=function(_0x2f2b3b,_0x39fd45){var _0x334390={'raw':!![],'where':{'id':_0x2f2b3b[_0xf0db('0x49')]['id']}},_0x125da4={};_0x125da4[_0xf0db('0x33')]=_[_0xf0db('0x36')](db[_0xf0db('0x2e')]['rawAttributes']);_0x125da4[_0xf0db('0x35')]=_[_0xf0db('0x36')](_0x2f2b3b[_0xf0db('0x35')]);_0x125da4['filters']=_['intersection'](_0x125da4['model'],_0x125da4[_0xf0db('0x35')]);_0x334390['attributes']=_[_0xf0db('0x38')](_0x125da4[_0xf0db('0x33')],qs[_0xf0db('0x3a')](_0x2f2b3b[_0xf0db('0x35')][_0xf0db('0x3a')]));_0x334390[_0xf0db('0x39')]=_0x334390[_0xf0db('0x39')][_0xf0db('0x4a')]?_0x334390['attributes']:_0x125da4[_0xf0db('0x33')];if(_0x2f2b3b[_0xf0db('0x35')]['includeAll']){_0x334390[_0xf0db('0x44')]=[{'all':!![]}];}_0x334390=_[_0xf0db('0x40')]({},_0x334390,_0x2f2b3b[_0xf0db('0x42')]);return db[_0xf0db('0x2e')][_0xf0db('0x4b')](_0x334390)['then'](handleEntityNotFound(_0x39fd45,null))[_0xf0db('0x25')](respondWithResult(_0x39fd45,null))[_0xf0db('0x47')](handleError(_0x39fd45,null));};exports[_0xf0db('0x4c')]=function(_0x5b2f26,_0x3c531d){return db['Disposition'][_0xf0db('0x4c')](_0x5b2f26['body'],{})[_0xf0db('0x25')](function(_0x1ba101){var _0x3e9d02=_0x5b2f26[_0xf0db('0x4d')][_0xf0db('0x27')]({'plain':!![]});if(!_0x3e9d02)throw new Error(_0xf0db('0x4e'));if(_0x3e9d02['role']===_0xf0db('0x4d')){var _0x56a78e=_0x1ba101[_0xf0db('0x27')]({'plain':!![]});var _0x54a544=_0xf0db('0x28');return db[_0xf0db('0x4f')]['find']({'where':{'name':_0x54a544,'userProfileId':_0x3e9d02['userProfileId']},'raw':!![]})[_0xf0db('0x25')](function(_0x3f181b){if(_0x3f181b&&_0x3f181b[_0xf0db('0x50')]===0x0){return db[_0xf0db('0x51')]['create']({'name':_0x56a78e[_0xf0db('0x2b')],'resourceId':_0x56a78e['id'],'type':_0x3f181b[_0xf0db('0x2b')],'sectionId':_0x3f181b['id']},{})['then'](function(){return _0x1ba101;});}else{return _0x1ba101;}})[_0xf0db('0x47')](function(_0x3faa48){logger[_0xf0db('0x29')](_0xf0db('0x52'),_0x3faa48);throw _0x3faa48;});}return _0x1ba101;})[_0xf0db('0x25')](respondWithResult(_0x3c531d,0xc9))[_0xf0db('0x47')](handleError(_0x3c531d,null));};exports[_0xf0db('0x24')]=function(_0x4fa688,_0x134aec){if(_0x4fa688[_0xf0db('0x53')]['id']){delete _0x4fa688[_0xf0db('0x53')]['id'];}return db['Disposition'][_0xf0db('0x4b')]({'where':{'id':_0x4fa688[_0xf0db('0x49')]['id']}})[_0xf0db('0x25')](handleEntityNotFound(_0x134aec,null))[_0xf0db('0x25')](saveUpdates(_0x4fa688[_0xf0db('0x53')],null))[_0xf0db('0x25')](respondWithResult(_0x134aec,null))[_0xf0db('0x47')](handleError(_0x134aec,null));};exports[_0xf0db('0x26')]=function(_0x4b2fe1,_0xada2f0){return db[_0xf0db('0x2e')][_0xf0db('0x4b')]({'where':{'id':_0x4b2fe1[_0xf0db('0x49')]['id']}})[_0xf0db('0x25')](handleEntityNotFound(_0xada2f0,null))['then'](removeEntity(_0xada2f0,null))[_0xf0db('0x47')](handleError(_0xada2f0,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c94d64e..f1104a1 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 _0x2637=['./disposition.attributes','exports','Disposition','name_voice','ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x27332e,_0x247ad6){var _0x5882fc=function(_0x263c21){while(--_0x263c21){_0x27332e['push'](_0x27332e['shift']());}};_0x5882fc(++_0x247ad6);}(_0x2637,0x118));var _0x7263=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x2637[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0x7263('0x0'));var util=require(_0x7263('0x1'));var logger=require(_0x7263('0x2'))(_0x7263('0x3'));var moment=require(_0x7263('0x4'));var BPromise=require(_0x7263('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7263('0x6'));var rimraf=require(_0x7263('0x7'));var config=require('../../config/environment');var attributes=require(_0x7263('0x8'));module[_0x7263('0x9')]=function(_0x135681,_0x40d14f){return _0x135681['define'](_0x7263('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x7263('0xb'),'fields':['name',_0x7263('0xc')]},{'unique':!![],'name':_0x7263('0xd'),'fields':[_0x7263('0xe'),_0x7263('0xf')]},{'unique':!![],'name':_0x7263('0x10'),'fields':['name',_0x7263('0x11')]},{'unique':!![],'name':'name_sms','fields':['name',_0x7263('0x12')]},{'unique':!![],'name':_0x7263('0x13'),'fields':[_0x7263('0xe'),'FaxAccountId']},{'unique':!![],'name':_0x7263('0x14'),'fields':[_0x7263('0xe'),_0x7263('0x15')]},{'unique':!![],'name':_0x7263('0x16'),'fields':[_0x7263('0xe'),_0x7263('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb8d=['define','Disposition','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xf3c65e,_0x174d79){var _0x5b2dad=function(_0x13bbc8){while(--_0x13bbc8){_0xf3c65e['push'](_0xf3c65e['shift']());}};_0x5b2dad(++_0x174d79);}(_0xdb8d,0x7d));var _0xddb8=function(_0x1e6bf3,_0x4133b2){_0x1e6bf3=_0x1e6bf3-0x0;var _0x21ea62=_0xdb8d[_0x1e6bf3];return _0x21ea62;};'use strict';var _=require(_0xddb8('0x0'));var util=require('util');var logger=require(_0xddb8('0x1'))('api');var moment=require(_0xddb8('0x2'));var BPromise=require(_0xddb8('0x3'));var rp=require(_0xddb8('0x4'));var fs=require('fs');var path=require(_0xddb8('0x5'));var rimraf=require('rimraf');var config=require(_0xddb8('0x6'));var attributes=require('./disposition.attributes');module['exports']=function(_0x565461,_0x4ef383){return _0x565461[_0xddb8('0x7')](_0xddb8('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0xddb8('0x9'),'fields':[_0xddb8('0xa'),_0xddb8('0xb')]},{'unique':!![],'name':_0xddb8('0xc'),'fields':[_0xddb8('0xa'),_0xddb8('0xd')]},{'unique':!![],'name':_0xddb8('0xe'),'fields':['name',_0xddb8('0xf')]},{'unique':!![],'name':_0xddb8('0x10'),'fields':[_0xddb8('0xa'),_0xddb8('0x11')]},{'unique':!![],'name':_0xddb8('0x12'),'fields':['name','FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0xddb8('0xa'),_0xddb8('0x13')]},{'unique':!![],'name':_0xddb8('0x14'),'fields':[_0xddb8('0xa'),_0xddb8('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index aea0f23..f83ffc3 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(_0x1a40a8,_0x20a924){var _0xdf9cd2=function(_0x204483){while(--_0x204483){_0x1a40a8['push'](_0x1a40a8['shift']());}};_0xdf9cd2(++_0x20a924);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x4abec,_0x233d85){var _0x436ddd=function(_0x2034f7){while(--_0x2034f7){_0x4abec['push'](_0x4abec['shift']());}};_0x436ddd(++_0x233d85);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 b748521..61a5394 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 _0xe62e=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','show','post'];(function(_0x27266d,_0xeee9bd){var _0x20d1d2=function(_0x16b51f){while(--_0x16b51f){_0x27266d['push'](_0x27266d['shift']());}};_0x20d1d2(++_0xeee9bd);}(_0xe62e,0x148));var _0xee62=function(_0x492a9f,_0x28752e){_0x492a9f=_0x492a9f-0x0;var _0xa72548=_0xe62e[_0x492a9f];return _0xa72548;};'use strict';var multer=require(_0xee62('0x0'));var util=require(_0xee62('0x1'));var path=require(_0xee62('0x2'));var timeout=require(_0xee62('0x3'));var express=require(_0xee62('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee62('0x5'));var interaction=require(_0xee62('0x6'));var config=require(_0xee62('0x7'));var controller=require(_0xee62('0x8'));router[_0xee62('0x9')]('/',auth[_0xee62('0xa')](),controller['index']);router[_0xee62('0x9')](_0xee62('0xb'),auth[_0xee62('0xa')](),controller[_0xee62('0xc')]);router[_0xee62('0xd')]('/',auth[_0xee62('0xa')](),controller[_0xee62('0xe')]);router['put']('/:id',auth[_0xee62('0xa')](),controller[_0xee62('0xf')]);router[_0xee62('0x10')](_0xee62('0xb'),auth[_0xee62('0xa')](),controller[_0xee62('0x11')]);module[_0xee62('0x12')]=router; \ No newline at end of file +var _0x1463=['../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show','post','update','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x50f7b3,_0x2b7250){var _0x4ef7ac=function(_0x5af96c){while(--_0x5af96c){_0x50f7b3['push'](_0x50f7b3['shift']());}};_0x4ef7ac(++_0x2b7250);}(_0x1463,0x163));var _0x3146=function(_0x433d94,_0x472e70){_0x433d94=_0x433d94-0x0;var _0x3d3942=_0x1463[_0x433d94];return _0x3d3942;};'use strict';var multer=require('multer');var util=require(_0x3146('0x0'));var path=require('path');var timeout=require(_0x3146('0x1'));var express=require(_0x3146('0x2'));var router=express[_0x3146('0x3')]();var fs_extra=require(_0x3146('0x4'));var auth=require(_0x3146('0x5'));var interaction=require(_0x3146('0x6'));var config=require(_0x3146('0x7'));var controller=require(_0x3146('0x8'));router['get']('/',auth[_0x3146('0x9')](),controller[_0x3146('0xa')]);router[_0x3146('0xb')](_0x3146('0xc'),auth['isAuthenticated'](),controller[_0x3146('0xd')]);router[_0x3146('0xe')]('/',auth[_0x3146('0x9')](),controller['create']);router['put']('/:id',auth[_0x3146('0x9')](),controller[_0x3146('0xf')]);router['delete']('/:id',auth[_0x3146('0x9')](),controller[_0x3146('0x10')]);module[_0x3146('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index efbf5e6..25564e7 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 _0x1c73=['v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','12000'];(function(_0x5bd1a9,_0x313714){var _0x2ba345=function(_0x21b4af){while(--_0x21b4af){_0x5bd1a9['push'](_0x5bd1a9['shift']());}};_0x2ba345(++_0x313714);}(_0x1c73,0x76));var _0x31c7=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0x1c73[_0x593f03];return _0x178299;};'use strict';var Sequelize=require('sequelize');module[_0x31c7('0x0')]={'name':{'type':Sequelize[_0x31c7('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x31c7('0x2')]('yes','no'),'defaultValue':_0x31c7('0x3')},'headerinfo':{'type':Sequelize[_0x31c7('0x1')],'defaultValue':_0x31c7('0x4')},'localstationid':{'type':Sequelize[_0x31c7('0x1')],'unique':_0x31c7('0x5')},'minrate':{'type':Sequelize[_0x31c7('0x2')](_0x31c7('0x6'),_0x31c7('0x7'),_0x31c7('0x8'),_0x31c7('0x9'),'12000',_0x31c7('0xa')),'defaultValue':_0x31c7('0x7')},'maxrate':{'type':Sequelize[_0x31c7('0x2')]('2400',_0x31c7('0x7'),'7200',_0x31c7('0x9'),_0x31c7('0xb'),_0x31c7('0xa')),'defaultValue':_0x31c7('0xa')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x31c7('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x31c7('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x31c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x31c7('0x2')](_0x31c7('0xe'),_0x31c7('0xf'),_0x31c7('0x10'),_0x31c7('0x11')),'defaultValue':_0x31c7('0xe')},'key':{'type':Sequelize[_0x31c7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x31c7('0x12')],'defaultValue':function(){return _0x31c7('0x13');}},'notificationSound':{'type':Sequelize[_0x31c7('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x31c7('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x31c7('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x31c7('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x31c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x31c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x31c7('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x31c7('0x16'),'set':function(_0x991dd){if(!_0x991dd)this['setDataValue'](_0x31c7('0x17'),null);this[_0x31c7('0x18')](_0x31c7('0x19'),_0x991dd);}}}; \ No newline at end of file +var _0x37a2=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDisposition','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','ENUM','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP'];(function(_0x29682e,_0x45ba07){var _0x2a2617=function(_0x16874b){while(--_0x16874b){_0x29682e['push'](_0x29682e['shift']());}};_0x2a2617(++_0x45ba07);}(_0x37a2,0x78));var _0x237a=function(_0x2c1d8f,_0x1310a2){_0x2c1d8f=_0x2c1d8f-0x0;var _0x372163=_0x37a2[_0x2c1d8f];return _0x372163;};'use strict';var Sequelize=require(_0x237a('0x0'));module[_0x237a('0x1')]={'name':{'type':Sequelize[_0x237a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x237a('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0x237a('0x3'),'no'),'defaultValue':_0x237a('0x3')},'headerinfo':{'type':Sequelize[_0x237a('0x2')],'defaultValue':_0x237a('0x4')},'localstationid':{'type':Sequelize[_0x237a('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x237a('0x5'),_0x237a('0x6'),_0x237a('0x7'),_0x237a('0x8'),_0x237a('0x9'),_0x237a('0xa')),'defaultValue':_0x237a('0x6')},'maxrate':{'type':Sequelize[_0x237a('0xb')](_0x237a('0x5'),_0x237a('0x6'),_0x237a('0x7'),_0x237a('0x8'),_0x237a('0x9'),_0x237a('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x237a('0x2')],'defaultValue':_0x237a('0xc')},'gateway':{'type':Sequelize[_0x237a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x237a('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x237a('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x237a('0xe'),_0x237a('0xf'),_0x237a('0x10'),_0x237a('0x11')),'defaultValue':_0x237a('0xe')},'key':{'type':Sequelize[_0x237a('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x237a('0x12')],'defaultValue':function(){return _0x237a('0x13');}},'notificationSound':{'type':Sequelize[_0x237a('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x237a('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x237a('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x237a('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x237a('0x14')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x171eba){if(!_0x171eba)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x237a('0x15')](_0x237a('0x16'),_0x171eba);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index e4ef724..13e3130 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 _0x86ba=['ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','defaults','redis','localhost','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','name','send','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','User','Owner','fullname','Tag','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','system','Fax\x20Extension','appdata','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','push','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'];(function(_0x24ab6c,_0x12372b){var _0x18eedc=function(_0x405971){while(--_0x405971){_0x24ab6c['push'](_0x24ab6c['shift']());}};_0x18eedc(++_0x12372b);}(_0x86ba,0x1aa));var _0xa86b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86ba[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa86b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa86b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa86b('0x2'));var moment=require('moment');var BPromise=require(_0xa86b('0x3'));var Mustache=require(_0xa86b('0x4'));var util=require(_0xa86b('0x5'));var path=require(_0xa86b('0x6'));var sox=require(_0xa86b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa86b('0x8'));var crypto=require(_0xa86b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa86b('0xa'));var querystring=require(_0xa86b('0xb'));var Papa=require('papaparse');var Redis=require(_0xa86b('0xc'));var authService=require(_0xa86b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa86b('0xe'));var hardwareService=require(_0xa86b('0xf'));var logger=require(_0xa86b('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xa86b('0x11'));var licenseUtil=require(_0xa86b('0x12'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa86b('0x13')](config[_0xa86b('0x14')],{'host':_0xa86b('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa86b('0x14')]));require(_0xa86b('0x16'))[_0xa86b('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa86b('0x18')][_0xa86b('0x19')]({'port':0x232c});var client9002=jayson[_0xa86b('0x18')][_0xa86b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x30148a,_0x7573d6,_0x389e31,_0x31dd19){return new BPromise(function(_0x4a73c9,_0xc8512c){var _0x14a61f=_0x31dd19||client;return _0x14a61f[_0xa86b('0x1a')](_0x30148a,_0x389e31)[_0xa86b('0x1b')](function(_0x4cd3df){logger[_0xa86b('0x1c')](_0xa86b('0x1d'),_0x7573d6,'request\x20sent');logger[_0xa86b('0x1e')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x7573d6,_0xa86b('0x1f'),JSON[_0xa86b('0x20')](_0x4cd3df));if(_0x4cd3df[_0xa86b('0x21')]){if(_0x4cd3df[_0xa86b('0x21')][_0xa86b('0x22')]===0x1f4){logger[_0xa86b('0x21')](_0xa86b('0x1d'),_0x7573d6,_0x4cd3df[_0xa86b('0x21')][_0xa86b('0x23')]);return _0xc8512c(_0x4cd3df[_0xa86b('0x21')][_0xa86b('0x23')]);}logger['error'](_0xa86b('0x1d'),_0x7573d6,_0x4cd3df['error']['message']);return _0x4a73c9(_0x4cd3df[_0xa86b('0x21')][_0xa86b('0x23')]);}else{logger[_0xa86b('0x1c')](_0xa86b('0x1d'),_0x7573d6,_0xa86b('0x1f'));_0x4a73c9(_0x4cd3df[_0xa86b('0x24')]['message']);}})[_0xa86b('0x25')](function(_0x1b0119){logger[_0xa86b('0x21')]('FaxAccount,\x20%s,\x20%s',_0x7573d6,_0x1b0119);_0xc8512c(_0x1b0119);});});}function respondWithStatusCode(_0x3a527d,_0x35cb6e){_0x35cb6e=_0x35cb6e||0xcc;return function(_0x1935be){if(_0x1935be){return _0x3a527d['sendStatus'](_0x35cb6e);}return _0x3a527d[_0xa86b('0x26')](_0x35cb6e)[_0xa86b('0x27')]();};}function respondWithResult(_0x183331,_0x14d8db){_0x14d8db=_0x14d8db||0xc8;return function(_0xdbe3b){if(_0xdbe3b){return _0x183331[_0xa86b('0x26')](_0x14d8db)['json'](_0xdbe3b);}};}function respondWithFilteredResult(_0x5b7f3f,_0x49f93e){return function(_0xa02ee2){if(_0xa02ee2){var _0x6d3145=typeof _0x49f93e['offset']===_0xa86b('0x28')&&typeof _0x49f93e[_0xa86b('0x29')]===_0xa86b('0x28');var _0x2ac021=_0xa02ee2[_0xa86b('0x2a')];var _0x73b62e=_0x6d3145?0x0:_0x49f93e[_0xa86b('0x2b')];var _0x401661=_0x6d3145?_0xa02ee2['count']:_0x49f93e[_0xa86b('0x2b')]+_0x49f93e[_0xa86b('0x29')];var _0x24246a;if(_0x401661>=_0x2ac021){_0x401661=_0x2ac021;_0x24246a=0xc8;}else{_0x24246a=0xce;}_0x5b7f3f[_0xa86b('0x26')](_0x24246a);return _0x5b7f3f[_0xa86b('0x2c')](_0xa86b('0x2d'),_0x73b62e+'-'+_0x401661+'/'+_0x2ac021)[_0xa86b('0x2e')](_0xa02ee2);}return null;};}function patchUpdates(_0x2e1dbb){return function(_0xdd9abd){try{jsonpatch['apply'](_0xdd9abd,_0x2e1dbb,!![]);}catch(_0x26e0a2){return BPromise[_0xa86b('0x2f')](_0x26e0a2);}return _0xdd9abd[_0xa86b('0x30')]();};}function saveUpdates(_0xa242a,_0x35fe20){return function(_0x3f5242){if(_0x3f5242){return _0x3f5242[_0xa86b('0x31')](_0xa242a)[_0xa86b('0x1b')](function(_0x5a95e3){return _0x5a95e3;});}return null;};}function removeEntity(_0x3d0d38,_0x4bf302){return function(_0x3261d2){if(_0x3261d2){return _0x3261d2[_0xa86b('0x32')]()[_0xa86b('0x1b')](function(){var _0xc4dc5c=_0x3261d2[_0xa86b('0x33')]({'plain':!![]});var _0x2d5d0c=_0xa86b('0x34');return db[_0xa86b('0x35')]['destroy']({'where':{'type':_0x2d5d0c,'resourceId':_0xc4dc5c['id']}})[_0xa86b('0x1b')](function(){return _0x3261d2;});})[_0xa86b('0x1b')](function(){_0x3d0d38[_0xa86b('0x26')](0xcc)[_0xa86b('0x27')]();});}};}function handleEntityNotFound(_0x504e2e,_0x3a2441){return function(_0x4dcf8d){if(!_0x4dcf8d){_0x504e2e[_0xa86b('0x36')](0x194);}return _0x4dcf8d;};}function handleError(_0x402045,_0x493812){_0x493812=_0x493812||0x1f4;return function(_0x5a9f28){logger['error'](_0x5a9f28['stack']);if(_0x5a9f28[_0xa86b('0x37')]){delete _0x5a9f28['name'];}_0x402045['status'](_0x493812)[_0xa86b('0x38')](_0x5a9f28);};}exports['index']=function(_0x2dbd2a,_0x3b2010){var _0x5f4b06={'include':[{'model':db[_0xa86b('0x39')],'as':'mandatoryDispositionPause'}]},_0x4b0097={},_0x4c39c7={'count':0x0,'rows':[]};var _0x1218b7=_[_0xa86b('0x3a')](db[_0xa86b('0x3b')][_0xa86b('0x3c')],function(_0x41174a){return{'name':_0x41174a[_0xa86b('0x3d')],'type':_0x41174a[_0xa86b('0x3e')][_0xa86b('0x3f')]};});_0x4b0097[_0xa86b('0x40')]=_[_0xa86b('0x3a')](_0x1218b7,_0xa86b('0x37'));_0x4b0097[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x2dbd2a[_0xa86b('0x41')]);_0x4b0097[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x4b0097[_0xa86b('0x40')],_0x4b0097[_0xa86b('0x41')]);_0x5f4b06[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x4b0097['model'],qs['fields'](_0x2dbd2a[_0xa86b('0x41')]['fields']));_0x5f4b06[_0xa86b('0x45')]=_0x5f4b06[_0xa86b('0x45')][_0xa86b('0x46')]?_0x5f4b06[_0xa86b('0x45')]:_0x4b0097[_0xa86b('0x40')];if(!_0x2dbd2a[_0xa86b('0x41')]['hasOwnProperty'](_0xa86b('0x47'))){_0x5f4b06['limit']=qs[_0xa86b('0x29')](_0x2dbd2a[_0xa86b('0x41')][_0xa86b('0x29')]);_0x5f4b06[_0xa86b('0x2b')]=qs['offset'](_0x2dbd2a[_0xa86b('0x41')][_0xa86b('0x2b')]);}_0x5f4b06[_0xa86b('0x48')]=qs[_0xa86b('0x49')](_0x2dbd2a[_0xa86b('0x41')][_0xa86b('0x49')]);_0x5f4b06[_0xa86b('0x4a')]=qs[_0xa86b('0x43')](_['pick'](_0x2dbd2a[_0xa86b('0x41')],_0x4b0097[_0xa86b('0x43')]),_0x1218b7);if(_0x2dbd2a[_0xa86b('0x41')][_0xa86b('0x4b')]){_0x5f4b06[_0xa86b('0x4a')]=_[_0xa86b('0x4c')](_0x5f4b06[_0xa86b('0x4a')],{'$or':_[_0xa86b('0x3a')](_0x1218b7,function(_0x3c849e){if(_0x3c849e[_0xa86b('0x3e')]!==_0xa86b('0x4d')){var _0x5150ff={};_0x5150ff[_0x3c849e[_0xa86b('0x37')]]={'$like':'%'+_0x2dbd2a['query'][_0xa86b('0x4b')]+'%'};return _0x5150ff;}})});}_0x5f4b06=_[_0xa86b('0x4c')]({},_0x5f4b06,_0x2dbd2a[_0xa86b('0x4e')]);var _0x73a06d={'where':_0x5f4b06[_0xa86b('0x4a')]};return db[_0xa86b('0x3b')][_0xa86b('0x2a')](_0x73a06d)['then'](function(_0x365bb8){_0x4c39c7[_0xa86b('0x2a')]=_0x365bb8;if(_0x2dbd2a[_0xa86b('0x41')][_0xa86b('0x4f')]){_0x5f4b06[_0xa86b('0x50')]=[{'all':!![]}];}return db[_0xa86b('0x3b')][_0xa86b('0x51')](_0x5f4b06);})[_0xa86b('0x1b')](function(_0x3bf223){_0x4c39c7[_0xa86b('0x52')]=_0x3bf223;return _0x4c39c7;})[_0xa86b('0x1b')](respondWithFilteredResult(_0x3b2010,_0x5f4b06))[_0xa86b('0x25')](handleError(_0x3b2010,null));};exports[_0xa86b('0x53')]=function(_0x1f5ee5,_0x2b7ea4){var _0x452658={'raw':![],'where':{'id':_0x1f5ee5[_0xa86b('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0xa86b('0x55')}]},_0x286a1d={};_0x286a1d[_0xa86b('0x40')]=_[_0xa86b('0x42')](db['FaxAccount'][_0xa86b('0x3c')]);_0x286a1d[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x1f5ee5[_0xa86b('0x41')]);_0x286a1d[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x286a1d[_0xa86b('0x40')],_0x286a1d[_0xa86b('0x41')]);_0x452658[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x286a1d['model'],qs[_0xa86b('0x56')](_0x1f5ee5[_0xa86b('0x41')][_0xa86b('0x56')]));_0x452658[_0xa86b('0x45')]=_0x452658[_0xa86b('0x45')][_0xa86b('0x46')]?_0x452658[_0xa86b('0x45')]:_0x286a1d[_0xa86b('0x40')];if(_0x1f5ee5[_0xa86b('0x41')][_0xa86b('0x4f')]){_0x452658[_0xa86b('0x50')]=[{'all':!![]}];}_0x452658=_['merge']({},_0x452658,_0x1f5ee5[_0xa86b('0x4e')]);return db[_0xa86b('0x3b')]['find'](_0x452658)[_0xa86b('0x1b')](handleEntityNotFound(_0x2b7ea4,null))[_0xa86b('0x1b')](respondWithResult(_0x2b7ea4,null))['catch'](handleError(_0x2b7ea4,null));};exports[_0xa86b('0x57')]=function(_0x45b61c,_0x23056c){return db[_0xa86b('0x3b')][_0xa86b('0x57')](_0x45b61c[_0xa86b('0x58')],{})['then'](function(_0x4836c5){var _0x55c9a7=_0x45b61c['user'][_0xa86b('0x33')]({'plain':!![]});if(!_0x55c9a7)throw new Error(_0xa86b('0x59'));if(_0x55c9a7['role']===_0xa86b('0x5a')){var _0x5ad653=_0x4836c5[_0xa86b('0x33')]({'plain':!![]});var _0x5137a7=_0xa86b('0x34');return db[_0xa86b('0x5b')][_0xa86b('0x5c')]({'where':{'name':_0x5137a7,'userProfileId':_0x55c9a7[_0xa86b('0x5d')]},'raw':!![]})[_0xa86b('0x1b')](function(_0xb50dc9){if(_0xb50dc9&&_0xb50dc9[_0xa86b('0x5e')]===0x0){return db[_0xa86b('0x35')][_0xa86b('0x57')]({'name':_0x5ad653['name'],'resourceId':_0x5ad653['id'],'type':_0xb50dc9[_0xa86b('0x37')],'sectionId':_0xb50dc9['id']},{})[_0xa86b('0x1b')](function(){return _0x4836c5;});}else{return _0x4836c5;}})[_0xa86b('0x25')](function(_0x392b2d){logger[_0xa86b('0x21')](_0xa86b('0x5f'),_0x392b2d);throw _0x392b2d;});}return _0x4836c5;})['then'](respondWithResult(_0x23056c,0xc9))[_0xa86b('0x25')](handleError(_0x23056c,null));};exports[_0xa86b('0x31')]=function(_0x421795,_0x40b1a6){if(_0x421795[_0xa86b('0x58')]['id']){delete _0x421795[_0xa86b('0x58')]['id'];}return db[_0xa86b('0x3b')][_0xa86b('0x5c')]({'where':{'id':_0x421795[_0xa86b('0x54')]['id']},'include':[{'model':db[_0xa86b('0x39')],'as':_0xa86b('0x55')}]})[_0xa86b('0x1b')](handleEntityNotFound(_0x40b1a6,null))[_0xa86b('0x1b')](saveUpdates(_0x421795[_0xa86b('0x58')],null))[_0xa86b('0x1b')](respondWithResult(_0x40b1a6,null))[_0xa86b('0x25')](handleError(_0x40b1a6,null));};exports[_0xa86b('0x32')]=function(_0x5c4091,_0x403ba6){return db['FaxAccount'][_0xa86b('0x5c')]({'where':{'id':_0x5c4091['params']['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x403ba6,null))['then'](removeEntity(_0x403ba6,null))[_0xa86b('0x25')](handleError(_0x403ba6,null));};exports[_0xa86b('0x60')]=function(_0x5a2b55,_0x58df8f){return db[_0xa86b('0x3b')][_0xa86b('0x60')]()[_0xa86b('0x1b')](respondWithResult(_0x58df8f,null))['catch'](handleError(_0x58df8f,null));};exports[_0xa86b('0x61')]=function(_0x1003b4,_0x2ed140,_0x21c246){if(_0x1003b4[_0xa86b('0x58')]['id']){delete _0x1003b4[_0xa86b('0x58')]['id'];}return db[_0xa86b('0x3b')][_0xa86b('0x5c')]({'where':{'id':_0x1003b4['params']['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x2ed140,null))[_0xa86b('0x1b')](function(_0x5c0171){if(_0x5c0171){_0x1003b4[_0xa86b('0x58')][_0xa86b('0x62')]=_0x5c0171['id'];return db['Disposition']['create'](_0x1003b4['body']);}})[_0xa86b('0x1b')](respondWithResult(_0x2ed140,null))[_0xa86b('0x25')](handleError(_0x2ed140,null));};exports[_0xa86b('0x63')]=function(_0x56b5bf,_0x47d2ab,_0x5dbb67){var _0x402b16={'raw':![],'where':{}};var _0x477366={};var _0x465cce={'count':0x0,'rows':[]};return db[_0xa86b('0x3b')][_0xa86b('0x64')]({'where':{'id':_0x56b5bf[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x47d2ab,null))[_0xa86b('0x1b')](function(_0x1f33d4){if(_0x1f33d4){_0x477366['model']=_[_0xa86b('0x42')](db[_0xa86b('0x65')][_0xa86b('0x3c')]);_0x477366[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x56b5bf[_0xa86b('0x41')]);_0x477366[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x477366['model'],_0x477366['query']);_0x402b16[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x477366[_0xa86b('0x40')],qs[_0xa86b('0x56')](_0x56b5bf[_0xa86b('0x41')]['fields']));_0x402b16[_0xa86b('0x45')]=_0x402b16[_0xa86b('0x45')]['length']?_0x402b16[_0xa86b('0x45')]:_0x477366[_0xa86b('0x40')];if(!_0x56b5bf[_0xa86b('0x41')]['hasOwnProperty'](_0xa86b('0x47'))){_0x402b16[_0xa86b('0x29')]=qs[_0xa86b('0x29')](_0x56b5bf['query'][_0xa86b('0x29')]);_0x402b16[_0xa86b('0x2b')]=qs['offset'](_0x56b5bf[_0xa86b('0x41')]['offset']);}_0x402b16['order']=qs['sort'](_0x56b5bf[_0xa86b('0x41')][_0xa86b('0x49')]);_0x402b16['where']=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x56b5bf[_0xa86b('0x41')],_0x477366['filters']));_0x402b16[_0xa86b('0x4a')][_0xa86b('0x62')]=_0x1f33d4['id'];if(_0x56b5bf[_0xa86b('0x41')][_0xa86b('0x4b')]){_0x402b16[_0xa86b('0x4a')]=_['merge'](_0x402b16['where'],{'$or':_[_0xa86b('0x3a')](_0x402b16[_0xa86b('0x45')],function(_0x390990){var _0x10b410={};_0x10b410[_0x390990]={'$like':'%'+_0x56b5bf[_0xa86b('0x41')][_0xa86b('0x4b')]+'%'};return _0x10b410;})});}_0x402b16=_[_0xa86b('0x4c')]({},_0x402b16,_0x56b5bf[_0xa86b('0x4e')]);return db[_0xa86b('0x65')][_0xa86b('0x2a')]({'where':_0x402b16[_0xa86b('0x4a')]})[_0xa86b('0x1b')](function(_0x4adcc2){_0x465cce[_0xa86b('0x2a')]=_0x4adcc2;if(_0x56b5bf['query'][_0xa86b('0x4f')]){_0x402b16['include']=[{'all':!![]}];}return db[_0xa86b('0x65')][_0xa86b('0x51')](_0x402b16);})[_0xa86b('0x1b')](function(_0x3e5cd0){_0x465cce[_0xa86b('0x52')]=_0x3e5cd0;return _0x465cce;});}})['then'](respondWithFilteredResult(_0x47d2ab,_0x402b16))[_0xa86b('0x25')](handleError(_0x47d2ab,null));};exports[_0xa86b('0x67')]=function(_0x347132,_0x363f0a,_0x662ef8){return db['FaxAccount']['find']({'where':{'id':_0x347132[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x363f0a,null))[_0xa86b('0x1b')](function(_0x388812){if(_0x388812){return _0x388812['removeDispositions'](_0x347132[_0xa86b('0x41')]['ids']);}})[_0xa86b('0x1b')](respondWithStatusCode(_0x363f0a,null))[_0xa86b('0x25')](handleError(_0x363f0a,null));};exports[_0xa86b('0x68')]=function(_0xae5e30,_0x4a6705,_0x48ffbd){if(_0xae5e30[_0xa86b('0x58')]['id']){delete _0xae5e30[_0xa86b('0x58')]['id'];}return db[_0xa86b('0x3b')][_0xa86b('0x5c')]({'where':{'id':_0xae5e30[_0xa86b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4a6705,null))[_0xa86b('0x1b')](function(_0x591bc6){if(_0x591bc6){_0xae5e30[_0xa86b('0x58')][_0xa86b('0x62')]=_0x591bc6['id'];return db[_0xa86b('0x69')][_0xa86b('0x57')](_0xae5e30[_0xa86b('0x58')]);}})[_0xa86b('0x1b')](respondWithResult(_0x4a6705,null))['catch'](handleError(_0x4a6705,null));};exports[_0xa86b('0x6a')]=function(_0x5c029a,_0x2824c4,_0x3cf726){var _0xda7e0={'raw':![],'where':{}};var _0x4cad7e={};var _0x4d6f9e={'count':0x0,'rows':[]};return db[_0xa86b('0x3b')]['findOne']({'where':{'id':_0x5c029a[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x2824c4,null))[_0xa86b('0x1b')](function(_0x5925b4){if(_0x5925b4){_0x4cad7e[_0xa86b('0x40')]=_[_0xa86b('0x42')](db['CannedAnswer'][_0xa86b('0x3c')]);_0x4cad7e[_0xa86b('0x41')]=_['keys'](_0x5c029a['query']);_0x4cad7e[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x4cad7e[_0xa86b('0x40')],_0x4cad7e[_0xa86b('0x41')]);_0xda7e0[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x4cad7e[_0xa86b('0x40')],qs[_0xa86b('0x56')](_0x5c029a[_0xa86b('0x41')][_0xa86b('0x56')]));_0xda7e0['attributes']=_0xda7e0[_0xa86b('0x45')][_0xa86b('0x46')]?_0xda7e0[_0xa86b('0x45')]:_0x4cad7e[_0xa86b('0x40')];if(!_0x5c029a[_0xa86b('0x41')]['hasOwnProperty'](_0xa86b('0x47'))){_0xda7e0[_0xa86b('0x29')]=qs[_0xa86b('0x29')](_0x5c029a['query'][_0xa86b('0x29')]);_0xda7e0[_0xa86b('0x2b')]=qs[_0xa86b('0x2b')](_0x5c029a['query'][_0xa86b('0x2b')]);}_0xda7e0[_0xa86b('0x48')]=qs['sort'](_0x5c029a[_0xa86b('0x41')]['sort']);_0xda7e0[_0xa86b('0x4a')]=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x5c029a['query'],_0x4cad7e[_0xa86b('0x43')]));_0xda7e0[_0xa86b('0x4a')][_0xa86b('0x62')]=_0x5925b4['id'];if(_0x5c029a[_0xa86b('0x41')]['filter']){_0xda7e0[_0xa86b('0x4a')]=_['merge'](_0xda7e0[_0xa86b('0x4a')],{'$or':_['map'](_0xda7e0['attributes'],function(_0x229f62){var _0x499c26={};_0x499c26[_0x229f62]={'$like':'%'+_0x5c029a[_0xa86b('0x41')][_0xa86b('0x4b')]+'%'};return _0x499c26;})});}_0xda7e0=_[_0xa86b('0x4c')]({},_0xda7e0,_0x5c029a[_0xa86b('0x4e')]);return db[_0xa86b('0x69')][_0xa86b('0x2a')]({'where':_0xda7e0[_0xa86b('0x4a')]})['then'](function(_0x58986f){_0x4d6f9e[_0xa86b('0x2a')]=_0x58986f;if(_0x5c029a[_0xa86b('0x41')][_0xa86b('0x4f')]){_0xda7e0[_0xa86b('0x50')]=[{'all':!![]}];}return db[_0xa86b('0x69')][_0xa86b('0x51')](_0xda7e0);})[_0xa86b('0x1b')](function(_0x26f20f){_0x4d6f9e[_0xa86b('0x52')]=_0x26f20f;return _0x4d6f9e;});}})['then'](respondWithFilteredResult(_0x2824c4,_0xda7e0))['catch'](handleError(_0x2824c4,null));};exports['removeAnswers']=function(_0x5e64e7,_0x2a6b21,_0x1f891a){return db[_0xa86b('0x3b')][_0xa86b('0x5c')]({'where':{'id':_0x5e64e7[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x2a6b21,null))[_0xa86b('0x1b')](function(_0x56570c){if(_0x56570c){return _0x56570c[_0xa86b('0x6b')](_0x5e64e7[_0xa86b('0x41')][_0xa86b('0x6c')]);}})[_0xa86b('0x1b')](respondWithStatusCode(_0x2a6b21,null))['catch'](handleError(_0x2a6b21,null));};exports[_0xa86b('0x6d')]=function(_0x1fb65a,_0x188a70,_0x14d361){return db[_0xa86b('0x6e')][_0xa86b('0x5c')]({'where':{'id':_0x1fb65a[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x188a70,null))[_0xa86b('0x1b')](function(_0x4fa45f){if(_0x4fa45f){return _0x4fa45f[_0xa86b('0x6d')](_0x1fb65a[_0xa86b('0x58')][_0xa86b('0x6c')],_[_0xa86b('0x6f')](_0x1fb65a['body'],[_0xa86b('0x6c'),'id'])||{});}})[_0xa86b('0x1b')](respondWithResult(_0x188a70,null))[_0xa86b('0x25')](handleError(_0x188a70,null));};exports[_0xa86b('0x70')]=function(_0x163e00,_0x7975e,_0x1f1e1d){var _0x158f7b={'raw':![],'where':{}};var _0xb04b26={};var _0x1ee176={'count':0x0,'rows':[]};return db[_0xa86b('0x3b')][_0xa86b('0x64')]({'where':{'id':_0x163e00[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x7975e,null))[_0xa86b('0x1b')](function(_0x127d1f){if(_0x127d1f){_0xb04b26['model']=_[_0xa86b('0x42')](db[_0xa86b('0x6e')]['rawAttributes']);_0xb04b26['query']=_[_0xa86b('0x42')](_0x163e00['query']);_0xb04b26[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0xb04b26[_0xa86b('0x40')],_0xb04b26['query']);_0x158f7b[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0xb04b26['model'],qs['fields'](_0x163e00[_0xa86b('0x41')]['fields']));_0x158f7b[_0xa86b('0x45')]=_0x158f7b['attributes']['length']?_0x158f7b['attributes']:_0xb04b26[_0xa86b('0x40')];if(!_0x163e00[_0xa86b('0x41')][_0xa86b('0x71')]('nolimit')){_0x158f7b[_0xa86b('0x29')]=qs[_0xa86b('0x29')](_0x163e00[_0xa86b('0x41')][_0xa86b('0x29')]);_0x158f7b[_0xa86b('0x2b')]=qs['offset'](_0x163e00[_0xa86b('0x41')][_0xa86b('0x2b')]);}_0x158f7b[_0xa86b('0x48')]=qs[_0xa86b('0x49')](_0x163e00[_0xa86b('0x41')][_0xa86b('0x49')]);_0x158f7b[_0xa86b('0x4a')]=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x163e00[_0xa86b('0x41')],_0xb04b26['filters']));_0x158f7b[_0xa86b('0x4a')][_0xa86b('0x62')]=_0x127d1f['id'];if(_0x163e00[_0xa86b('0x41')][_0xa86b('0x4b')]){_0x158f7b[_0xa86b('0x4a')]=_['merge'](_0x158f7b[_0xa86b('0x4a')],{'$or':_['map'](_0x158f7b[_0xa86b('0x45')],function(_0x259422){var _0x26fcc8={};_0x26fcc8[_0x259422]={'$like':'%'+_0x163e00[_0xa86b('0x41')]['filter']+'%'};return _0x26fcc8;})});}_0x158f7b=_['merge']({},_0x158f7b,_0x163e00[_0xa86b('0x4e')]);return db[_0xa86b('0x6e')][_0xa86b('0x2a')]({'where':_0x158f7b['where']})['then'](function(_0xc6cd40){_0x1ee176[_0xa86b('0x2a')]=_0xc6cd40;if(_0x163e00[_0xa86b('0x41')][_0xa86b('0x4f')]){_0x158f7b['include']=[{'model':db[_0xa86b('0x72')],'as':_0xa86b('0x73'),'required':![]},{'model':db[_0xa86b('0x74')],'as':_0xa86b('0x75'),'attributes':[_0xa86b('0x37'),_0xa86b('0x76'),'internal'],'required':![]},{'model':db[_0xa86b('0x77')],'as':'Tags','attributes':['id',_0xa86b('0x37'),'color'],'where':_0x163e00[_0xa86b('0x41')][_0xa86b('0x78')]?{'id':_0x163e00[_0xa86b('0x41')]['tag']}:undefined,'required':_0x163e00['query'][_0xa86b('0x78')]?!![]:![]}];}return db['FaxInteraction'][_0xa86b('0x51')](_0x158f7b);})['then'](function(_0x4e50ea){_0x1ee176['rows']=_0x4e50ea;return _0x1ee176;});}})[_0xa86b('0x1b')](respondWithFilteredResult(_0x7975e,_0x158f7b))[_0xa86b('0x25')](handleError(_0x7975e,null));};exports['addApplications']=function(_0x1e6632,_0xf06b11){var _0x380afa=_0x1e6632[_0xa86b('0x54')]['id'];var _0x580720=_0x1e6632['body'];var _0x1f2795=0xc8;var _0x3aeb7c=null;return db[_0xa86b('0x79')][_0xa86b('0x7a')]({'isolationLevel':db['sequelize']['Transaction'][_0xa86b('0x7b')][_0xa86b('0x7c')]},function(_0x3ae1dc){return db['FaxAccount'][_0xa86b('0x64')]({'where':{'id':_0x380afa},'transaction':_0x3ae1dc})[_0xa86b('0x1b')](function(_0xe58b5a){if(_0xe58b5a){return db['FaxApplication'][_0xa86b('0x32')]({'where':{'FaxAccountId':_0x380afa},'transaction':_0x3ae1dc})[_0xa86b('0x1b')](function(){var _0x32b3f1=_[_0xa86b('0x3a')](_0x580720,function(_0xbef065){_0xbef065[_0xa86b('0x62')]=_0x380afa;return _0xbef065;});return db[_0xa86b('0x7d')][_0xa86b('0x7e')](_0x32b3f1,{'transaction':_0x3ae1dc});});}else{_0x1f2795=0x194;_0x3aeb7c=[];}});})['then'](function(){if(_0x1f2795!==0x194){return db['FaxApplication'][_0xa86b('0x7f')]({'where':{'FaxAccountId':_0x380afa},'order':_0xa86b('0x80')})['then'](function(_0x5d600b){_0x3aeb7c=_0x5d600b;});}})[_0xa86b('0x25')](function(_0xfb36bb){_0x1f2795=0x1f4;logger[_0xa86b('0x21')](_0xfb36bb['stack']);if(_0xfb36bb[_0xa86b('0x37')]){delete _0xfb36bb[_0xa86b('0x37')];}_0x3aeb7c=_0xfb36bb;})[_0xa86b('0x81')](function(){if(_0x3aeb7c===null){_0xf06b11[_0xa86b('0x36')](_0x1f2795);}else{if(_0x1f2795===0x1f4){_0xf06b11[_0xa86b('0x26')](_0x1f2795)[_0xa86b('0x38')](_0x3aeb7c);}else{_0xf06b11[_0xa86b('0x26')](_0x1f2795)[_0xa86b('0x2e')](_0x3aeb7c);}}});};exports['getApplications']=function(_0x249ac8,_0x24ba92,_0x585b89){var _0x3bcb50={};var _0x5ddb3b={};var _0x4f1e3f;var _0x4652be;return db[_0xa86b('0x3b')][_0xa86b('0x64')]({'where':{'id':_0x249ac8[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0x24ba92,null))[_0xa86b('0x1b')](function(_0x18e38d){if(_0x18e38d){_0x4f1e3f=_0x18e38d;_0x5ddb3b['model']=_[_0xa86b('0x42')](db[_0xa86b('0x7d')]['rawAttributes']);_0x5ddb3b[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x249ac8[_0xa86b('0x41')]);_0x5ddb3b[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x5ddb3b[_0xa86b('0x40')],_0x5ddb3b[_0xa86b('0x41')]);_0x3bcb50[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x5ddb3b[_0xa86b('0x40')],qs[_0xa86b('0x56')](_0x249ac8[_0xa86b('0x41')][_0xa86b('0x56')]));_0x3bcb50[_0xa86b('0x45')]=_0x3bcb50['attributes'][_0xa86b('0x46')]?_0x3bcb50['attributes']:_0x5ddb3b[_0xa86b('0x40')];_0x3bcb50[_0xa86b('0x48')]=qs[_0xa86b('0x49')](_0x249ac8[_0xa86b('0x41')]['sort']);_0x3bcb50['where']=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x249ac8[_0xa86b('0x41')],_0x5ddb3b['filters']));if(_0x249ac8[_0xa86b('0x41')][_0xa86b('0x4b')]){_0x3bcb50[_0xa86b('0x4a')]=_[_0xa86b('0x4c')](_0x3bcb50[_0xa86b('0x4a')],{'$or':_[_0xa86b('0x3a')](_0x3bcb50['attributes'],function(_0x357c0b){var _0x5b0dad={};_0x5b0dad[_0x357c0b]={'$like':'%'+_0x249ac8[_0xa86b('0x41')][_0xa86b('0x4b')]+'%'};return _0x5b0dad;})});}_0x3bcb50=_[_0xa86b('0x4c')]({},_0x3bcb50,_0x249ac8[_0xa86b('0x4e')]);return _0x4f1e3f[_0xa86b('0x82')](_0x3bcb50);}})[_0xa86b('0x1b')](function(_0x58f523){if(_0x58f523){_0x4652be=_0x58f523[_0xa86b('0x46')];if(!_0x249ac8['query'][_0xa86b('0x71')](_0xa86b('0x47'))){_0x3bcb50[_0xa86b('0x29')]=qs[_0xa86b('0x29')](_0x249ac8[_0xa86b('0x41')][_0xa86b('0x29')]);_0x3bcb50[_0xa86b('0x2b')]=qs[_0xa86b('0x2b')](_0x249ac8[_0xa86b('0x41')]['offset']);}return _0x4f1e3f['getApplications'](_0x3bcb50);}})[_0xa86b('0x1b')](function(_0x8a06b1){if(_0x8a06b1){return _0x8a06b1?{'count':_0x4652be,'rows':_0x8a06b1}:null;}})['then'](respondWithResult(_0x24ba92,null))[_0xa86b('0x25')](handleError(_0x24ba92,null));};function Extension(_0x3252d9,_0xefe23c,_0x4e09db,_0x39ce45){this['context']='from-voip-provider';this[_0xa86b('0x83')]=_0x3252d9[_0xa86b('0x84')];this['app']=_0x39ce45;this[_0xa86b('0x3e')]=_0xa86b('0x85');this['description']=_0xa86b('0x86');this['FaxAccountId']=_0x3252d9['id'];this[_0xa86b('0x80')]=_0xefe23c;this[_0xa86b('0x87')]=_0x4e09db;}function createExtensionsReciveFax(_0x122a5b){var _0x13ff5d=0x1;var _0xc133ca=[];_0xc133ca['push'](new Extension(_0x122a5b,_0x13ff5d,'','Answer'));_0x13ff5d+=0x1;_0xc133ca['push'](new Extension(_0x122a5b,_0x13ff5d,_0xa86b('0x88'),'Set'));_0x13ff5d+=0x1;for(var _0x1aab23 in _0x122a5b){if(_0x122a5b['hasOwnProperty'](_0x1aab23)&&(_0x1aab23==='ecm'||_0x1aab23===_0xa86b('0x84')||_0x1aab23===_0xa86b('0x89')||_0x1aab23===_0xa86b('0x8a')||_0x1aab23===_0xa86b('0x8b')||_0x1aab23===_0xa86b('0x8c')||_0x1aab23===_0xa86b('0x8d')||_0x1aab23===_0xa86b('0x8e')||_0x1aab23===_0xa86b('0x8f'))){_0xc133ca[_0xa86b('0x90')](new Extension(_0x122a5b,_0x13ff5d,'FAXOPT('+_0x1aab23+')='+_0x122a5b[_0x1aab23],'Set'));_0x13ff5d+=0x1;}}_0xc133ca[_0xa86b('0x90')](new Extension(_0x122a5b,_0x13ff5d,'6',_0xa86b('0x91')));_0x13ff5d+=0x1;_0xc133ca[_0xa86b('0x90')](new Extension(_0x122a5b,_0x13ff5d,_0xa86b('0x92'),_0xa86b('0x93')));_0x13ff5d=0x0;return _0xc133ca;}exports[_0xa86b('0x94')]=function(_0x2fe340,_0x5b3557,_0x34cc28){var _0x1c3b09;return db[_0xa86b('0x79')][_0xa86b('0x7a')](function(_0x4b3d0c){return db[_0xa86b('0x3b')][_0xa86b('0x57')](_0x2fe340['body'],{'transaction':_0x4b3d0c})[_0xa86b('0x1b')](function(_0x29946e){_0x1c3b09=_0x29946e[_0xa86b('0x33')]({'plain':!![]});return db[_0xa86b('0x95')][_0xa86b('0x7e')](createExtensionsReciveFax(_0x1c3b09),{'transaction':_0x4b3d0c});});})[_0xa86b('0x1b')](function(){return _0x1c3b09;})[_0xa86b('0x1b')](respondWithResult(_0x5b3557,null))[_0xa86b('0x25')](handleError(_0x5b3557,null));};exports[_0xa86b('0x96')]=function(_0x33488e,_0x719b2e,_0x493e31){var _0x5c235d;return db[_0xa86b('0x79')][_0xa86b('0x7a')](function(_0x86cdb){return db[_0xa86b('0x3b')]['update'](_0x33488e['body'],{'where':{'id':_0x33488e[_0xa86b('0x58')]['id']},'transaction':_0x86cdb})['then'](function(_0x3bc458){return db['VoiceExtension'][_0xa86b('0x32')]({'where':{'FaxAccountId':_0x33488e[_0xa86b('0x58')]['id']},'transaction':_0x86cdb})[_0xa86b('0x1b')](function(_0x589186){return db[_0xa86b('0x95')][_0xa86b('0x7e')](createExtensionsReciveFax(_[_0xa86b('0x6f')](_0x33488e['body'],[_0xa86b('0x97'),_0xa86b('0x3f'),'createdAt',_0xa86b('0x98'),_0xa86b('0x99'),'ListId'])),{'transaction':_0x86cdb});});});})[_0xa86b('0x1b')](function(){return db[_0xa86b('0x3b')][_0xa86b('0x9a')](_0x33488e[_0xa86b('0x58')]['id']);})[_0xa86b('0x1b')](respondWithResult(_0x719b2e,null))['catch'](handleError(_0x719b2e,null));};exports[_0xa86b('0x9b')]=function(_0x367eb9,_0x332492,_0xda0e4a){var _0x58cf97={'raw':!![],'where':{}};var _0x55c1f2={};var _0x36b3b2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa86b('0x64')]({'where':{'id':_0x367eb9[_0xa86b('0x54')]['id']}})['then'](handleEntityNotFound(_0x332492,null))[_0xa86b('0x1b')](function(_0x42a47b){if(_0x42a47b){_0x55c1f2['model']=_[_0xa86b('0x42')](db[_0xa86b('0x9c')][_0xa86b('0x3c')]);_0x55c1f2[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x367eb9['query']);_0x55c1f2[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x55c1f2[_0xa86b('0x40')],_0x55c1f2['query']);_0x58cf97[_0xa86b('0x45')]=_[_0xa86b('0x44')](_0x55c1f2[_0xa86b('0x40')],qs[_0xa86b('0x56')](_0x367eb9['query'][_0xa86b('0x56')]));_0x58cf97[_0xa86b('0x45')]=_0x58cf97[_0xa86b('0x45')][_0xa86b('0x46')]?_0x58cf97['attributes']:_0x55c1f2['model'];if(!_0x367eb9[_0xa86b('0x41')][_0xa86b('0x71')]('nolimit')){_0x58cf97[_0xa86b('0x29')]=qs[_0xa86b('0x29')](_0x367eb9[_0xa86b('0x41')][_0xa86b('0x29')]);_0x58cf97[_0xa86b('0x2b')]=qs['offset'](_0x367eb9['query'][_0xa86b('0x2b')]);}_0x58cf97[_0xa86b('0x48')]=qs[_0xa86b('0x49')](_0x367eb9[_0xa86b('0x41')]['sort']);_0x58cf97[_0xa86b('0x4a')]=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x367eb9[_0xa86b('0x41')],_0x55c1f2[_0xa86b('0x43')]));_0x58cf97['where'][_0xa86b('0x62')]=_0x42a47b['id'];if(_0x367eb9['query']['filter']){_0x58cf97[_0xa86b('0x4a')]=_[_0xa86b('0x4c')](_0x58cf97['where'],{'$or':_['map'](_0x58cf97[_0xa86b('0x45')],function(_0xbe40d3){var _0x5a820e={};_0x5a820e[_0xbe40d3]={'$like':'%'+_0x367eb9[_0xa86b('0x41')]['filter']+'%'};return _0x5a820e;})});}if(_0x367eb9[_0xa86b('0x41')][_0xa86b('0x9d')]){var _0x35c6d5=_0x367eb9[_0xa86b('0x41')][_0xa86b('0x9d')][_0xa86b('0x9e')](',');var _0x3d1afa={};_0x3d1afa[_0x35c6d5[0x0]]={'$gte':moment(_0x35c6d5[0x1])[_0xa86b('0x9f')](_0xa86b('0xa0'))};_0x58cf97['where']=_[_0xa86b('0x4c')](_0x58cf97[_0xa86b('0x4a')],_0x3d1afa);}_0x58cf97=_[_0xa86b('0x4c')]({},_0x58cf97,_0x367eb9[_0xa86b('0x4e')]);return db[_0xa86b('0x9c')][_0xa86b('0x2a')]({'where':_0x58cf97['where']})[_0xa86b('0x1b')](function(_0x5f4f97){_0x36b3b2[_0xa86b('0x2a')]=_0x5f4f97;if(_0x367eb9[_0xa86b('0x41')][_0xa86b('0x4f')]){_0x58cf97['include']=[{'all':!![]}];}return db[_0xa86b('0x9c')][_0xa86b('0x51')](_0x58cf97);})[_0xa86b('0x1b')](function(_0x5d8589){_0x36b3b2[_0xa86b('0x52')]=_0x5d8589;return _0x36b3b2;});}})[_0xa86b('0x1b')](respondWithFilteredResult(_0x332492,_0x58cf97))['catch'](handleError(_0x332492,null));};exports['send']=function(_0x3cf125,_0x4979f4,_0x374e4f){var _0x55fe6b,_0x4d5209={},_0x3572ea;if(_0x3cf125['body']['to']){_0x3572ea=_0x3cf125[_0xa86b('0x58')]['to'][0x0];}return db['FaxAccount'][_0xa86b('0x5c')]({'where':{'id':_0x3cf125[_0xa86b('0x54')]['id']},'include':[{'model':db[_0xa86b('0xa1')],'as':_0xa86b('0xa2'),'include':[{'model':db[_0xa86b('0x72')],'as':_0xa86b('0xa3'),'where':{'fax':_0x3572ea},'limit':0x1,'order':[[_0xa86b('0x98'),_0xa86b('0xa4')]]}]}]})['then'](handleEntityNotFound(_0x4979f4,null))[_0xa86b('0x1b')](function(_0x57d6d0){_0x55fe6b=_0x57d6d0;if(_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')]&&_0x3cf125['body']['attachments'][_0xa86b('0x46')]){for(var _0x140524=0x0;_0x140524<_0x3cf125['body'][_0xa86b('0xa5')]['length'];_0x140524+=0x1){_0x3cf125['body'][_0xa86b('0xa5')][_0x140524]={'filename':_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][_0x140524][_0xa86b('0x37')],'id':_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][_0x140524]['id'],'path':path[_0xa86b('0xa6')](config[_0xa86b('0xa7')],_0xa86b('0xa8'),_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][_0x140524][_0xa86b('0xa9')])};}}return respondWithRpcPromise(_0xa86b('0xaa'),_0xa86b('0xaa'),{'FaxAccountId':_[_0xa86b('0xab')](_0x3cf125['params']['id'])?undefined:_0x3cf125[_0xa86b('0x54')]['id'],'path':_[_0xa86b('0xab')](_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][0x0][_0xa86b('0x6')])?undefined:_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][0x0][_0xa86b('0x6')],'fax':_[_0xa86b('0xab')](_0x3cf125[_0xa86b('0x58')]['to'][0x0])?undefined:_0x3cf125['body']['to'][0x0]},client9002);})[_0xa86b('0x1b')](function(){if(_0x55fe6b){if(_[_0xa86b('0xab')](_0x3cf125[_0xa86b('0x58')][_0xa86b('0xac')])){_0x3cf125['body'][_0xa86b('0xac')]=util[_0xa86b('0x9f')](_0xa86b('0xad'),_0x55fe6b['name'],_0x55fe6b['fax']);}if(_0x55fe6b['List']){if(_0x55fe6b['List'][_0xa86b('0xa3')]['length']){return _0x55fe6b[_0xa86b('0xa2')][_0xa86b('0xa3')][0x0];}else{return db[_0xa86b('0x72')][_0xa86b('0x57')](_[_0xa86b('0x13')](_0x3cf125[_0xa86b('0x58')],{'firstName':_0x3cf125[_0xa86b('0x58')]['to'][0x0],'phone':_0x3cf125['body']['to'][0x0],'fax':_0x3cf125['body']['to'][0x0],'ListId':_0x55fe6b['ListId']}));}}else{throw new Error(_0xa86b('0xae'));}}else{throw new Error(_0xa86b('0xaf'));}})[_0xa86b('0x1b')](function(_0x26753f){if(_0x26753f){return db[_0xa86b('0x6e')]['find']({'where':{'ContactId':_0x26753f['id'],'closed':![],'FaxAccountId':_0x55fe6b['id']}})[_0xa86b('0x1b')](function(_0xa3a3e9){if(_0xa3a3e9){return[_0xa3a3e9,![]];}return db['FaxInteraction'][_0xa86b('0x57')]({'UserId':_0x3cf125['user']['id'],'ContactId':_0x26753f['id'],'FaxAccountId':_0x55fe6b['id'],'fax':_0x3cf125[_0xa86b('0x58')]['to'][0x0],'firstMsgDirection':_0xa86b('0xb0'),'Messages':[_[_0xa86b('0x4c')](_0x3cf125[_0xa86b('0x58')],{'read':![],'body':_0x3cf125['body'][_0xa86b('0xa5')][0x0][_0xa86b('0xb1')],'FaxAccountId':_0x55fe6b['id'],'UserId':_0x3cf125['user']['id'],'ContactId':_0x26753f['id'],'AttachmentId':_0x3cf125[_0xa86b('0x58')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xa86b('0x9c')],'as':'Messages'}]})[_0xa86b('0x1b')](function(_0x4ec2da){return[_0x4ec2da,!![]];});});}else{throw new Error(_0xa86b('0xb2'));}})['spread'](function(_0x5b7193,_0x3cedff){if(_0x3cedff){return _0x5b7193;}return db[_0xa86b('0x9c')][_0xa86b('0x57')]({'direction':_0xa86b('0xb0'),'read':![],'body':_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][0x0]['filename'],'FaxAccountId':_0x55fe6b['id'],'FaxInteractionId':_0x5b7193['id'],'UserId':_0x3cf125[_0xa86b('0x5a')]['id'],'ContactId':_0x5b7193['ContactId'],'AttachmentId':_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][0x0]['id']})['then'](function(_0x174703){_0x5b7193[_0xa86b('0xb3')][_0xa86b('0xb4')]=[];_0x5b7193[_0xa86b('0xb3')][_0xa86b('0xb4')]['push'](_0x174703['dataValues']);return _0x5b7193;});})[_0xa86b('0x1b')](function(_0x4f26a4){respondWithRpcPromise(_0xa86b('0xb5'),_0xa86b('0xb5'),{'FaxAccountId':_[_0xa86b('0xab')](_0x3cf125[_0xa86b('0x54')]['id'])?undefined:_0x3cf125['params']['id'],'path':_['isNil'](_0x3cf125[_0xa86b('0x58')]['attachments'][0x0]['path'])?undefined:_0x3cf125[_0xa86b('0x58')][_0xa86b('0xa5')][0x0]['path'],'fax':_['isNil'](_0x3cf125[_0xa86b('0x58')]['to'][0x0])?undefined:_0x3cf125[_0xa86b('0x58')]['to'][0x0],'AttachmentId':_0x3cf125['body'][_0xa86b('0xa5')][0x0]['id']},client9002)[_0xa86b('0x1b')](function(_0x5ad1fb){logger['info'](_0xa86b('0xb6'),_0x5ad1fb);})[_0xa86b('0x25')](function(_0x51b267){logger[_0xa86b('0x1c')](_0xa86b('0xb6'),_0x51b267);});return _0x4f26a4;})[_0xa86b('0x1b')](respondWithResult(_0x4979f4,null))['catch'](handleError(_0x4979f4,null));};exports[_0xa86b('0xb7')]=function(_0x4c04fc,_0x3b89d8,_0x4b991c){return db['FaxAccount'][_0xa86b('0x5c')]({'where':{'id':_0x4c04fc[_0xa86b('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b89d8,null))[_0xa86b('0x1b')](function(_0x13fb1f){if(_0x13fb1f){return _0x13fb1f['addAgents'](_0x4c04fc[_0xa86b('0x58')][_0xa86b('0x6c')],_[_0xa86b('0x6f')](_0x4c04fc[_0xa86b('0x58')],[_0xa86b('0x6c'),'id'])||{})[_0xa86b('0xb8')](function(_0x146ee1){for(var _0x2c4608=0x0;_0x2c4608<_0x4c04fc['body'][_0xa86b('0x6c')]['length'];_0x2c4608+=0x1){socket[_0xa86b('0xb9')](_0xa86b('0xba'),{'UserId':Number(_0x4c04fc[_0xa86b('0x58')][_0xa86b('0x6c')][_0x2c4608]),'FaxAccountId':Number(_0x4c04fc[_0xa86b('0x54')]['id'])});}return _0x146ee1;});}})[_0xa86b('0x1b')](respondWithResult(_0x3b89d8,null))[_0xa86b('0x25')](handleError(_0x3b89d8,null));};exports[_0xa86b('0xbb')]=function(_0x26a413,_0x33785f,_0x12c01b){return db[_0xa86b('0x3b')][_0xa86b('0x5c')]({'where':{'id':_0x26a413[_0xa86b('0x54')]['id']}})['then'](handleEntityNotFound(_0x33785f,null))['then'](function(_0x425c1b){if(_0x425c1b){return _0x425c1b['removeAgents'](_0x26a413[_0xa86b('0x41')][_0xa86b('0x6c')])[_0xa86b('0x1b')](function(){if(_[_0xa86b('0xbc')](_0x26a413[_0xa86b('0x41')]['ids'])){for(var _0x536851=0x0;_0x536851<_0x26a413[_0xa86b('0x41')][_0xa86b('0x6c')][_0xa86b('0x46')];_0x536851+=0x1){socket[_0xa86b('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0x26a413[_0xa86b('0x41')][_0xa86b('0x6c')][_0x536851]),'FaxAccountId':Number(_0x26a413[_0xa86b('0x54')]['id'])});}}else{socket['emit'](_0xa86b('0xbd'),{'UserId':Number(_0x26a413[_0xa86b('0x41')]['ids']),'FaxAccountId':Number(_0x26a413['params']['id'])});}});}})[_0xa86b('0x1b')](respondWithStatusCode(_0x33785f,null))['catch'](handleError(_0x33785f,null));};exports[_0xa86b('0xbe')]=function(_0x4dd6d9,_0xc03085,_0x548a72){var _0x21f9bc={};var _0x214625={};var _0x51aec6;var _0x4260f3;return db[_0xa86b('0x3b')][_0xa86b('0x64')]({'where':{'id':_0x4dd6d9[_0xa86b('0x54')]['id']}})[_0xa86b('0x1b')](handleEntityNotFound(_0xc03085,null))[_0xa86b('0x1b')](function(_0x3138ca){if(_0x3138ca){_0x51aec6=_0x3138ca;_0x214625[_0xa86b('0x40')]=_[_0xa86b('0x42')](db['User']['rawAttributes']);_0x214625[_0xa86b('0x41')]=_[_0xa86b('0x42')](_0x4dd6d9[_0xa86b('0x41')]);_0x214625[_0xa86b('0x43')]=_[_0xa86b('0x44')](_0x214625[_0xa86b('0x40')],_0x214625[_0xa86b('0x41')]);_0x21f9bc[_0xa86b('0x45')]=_['intersection'](_0x214625[_0xa86b('0x40')],qs[_0xa86b('0x56')](_0x4dd6d9[_0xa86b('0x41')][_0xa86b('0x56')]));_0x21f9bc[_0xa86b('0x45')]=_0x21f9bc['attributes'][_0xa86b('0x46')]?_0x21f9bc[_0xa86b('0x45')]:_0x214625[_0xa86b('0x40')];_0x21f9bc[_0xa86b('0x48')]=qs[_0xa86b('0x49')](_0x4dd6d9[_0xa86b('0x41')][_0xa86b('0x49')]);_0x21f9bc[_0xa86b('0x4a')]=qs[_0xa86b('0x43')](_[_0xa86b('0x66')](_0x4dd6d9['query'],_0x214625['filters']));if(_0x4dd6d9[_0xa86b('0x41')]['filter']){_0x21f9bc[_0xa86b('0x4a')]=_['merge'](_0x21f9bc[_0xa86b('0x4a')],{'$or':_[_0xa86b('0x3a')](_0x21f9bc[_0xa86b('0x45')],function(_0x2c8090){var _0x23a3fb={};_0x23a3fb[_0x2c8090]={'$like':'%'+_0x4dd6d9[_0xa86b('0x41')][_0xa86b('0x4b')]+'%'};return _0x23a3fb;})});}_0x21f9bc=_['merge']({},_0x21f9bc,_0x4dd6d9[_0xa86b('0x4e')]);return _0x51aec6[_0xa86b('0xbe')](_0x21f9bc);}})[_0xa86b('0x1b')](function(_0x18aa48){if(_0x18aa48){_0x4260f3=_0x18aa48[_0xa86b('0x46')];if(!_0x4dd6d9[_0xa86b('0x41')][_0xa86b('0x71')](_0xa86b('0x47'))){_0x21f9bc['limit']=qs['limit'](_0x4dd6d9[_0xa86b('0x41')][_0xa86b('0x29')]);_0x21f9bc['offset']=qs[_0xa86b('0x2b')](_0x4dd6d9[_0xa86b('0x41')]['offset']);}return _0x51aec6[_0xa86b('0xbe')](_0x21f9bc);}})[_0xa86b('0x1b')](function(_0x5d927c){if(_0x5d927c){return _0x5d927c?{'count':_0x4260f3,'rows':_0x5d927c}:null;}})[_0xa86b('0x1b')](respondWithResult(_0xc03085,null))['catch'](handleError(_0xc03085,null));}; \ No newline at end of file +var _0xcb2c=['FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','save','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','FaxAccount','findAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','update','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','include','rows','removeDispositions','ids','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','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','updateAccountApplications','transaction','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xcb2c,0x165));var _0xccb2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcb2c[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xccb2('0x0'));var rimraf=require(_0xccb2('0x1'));var zipdir=require(_0xccb2('0x2'));var jsonpatch=require(_0xccb2('0x3'));var rp=require(_0xccb2('0x4'));var moment=require('moment');var BPromise=require(_0xccb2('0x5'));var Mustache=require(_0xccb2('0x6'));var util=require('util');var path=require(_0xccb2('0x7'));var sox=require(_0xccb2('0x8'));var csv=require(_0xccb2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccb2('0xa'));var squel=require(_0xccb2('0xb'));var crypto=require(_0xccb2('0xc'));var jsforce=require(_0xccb2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xccb2('0xe'));var Papa=require(_0xccb2('0xf'));var Redis=require('ioredis');var authService=require(_0xccb2('0x10'));var qs=require(_0xccb2('0x11'));var as=require(_0xccb2('0x12'));var hardwareService=require(_0xccb2('0x13'));var logger=require('../../config/logger')(_0xccb2('0x14'));var utils=require(_0xccb2('0x15'));var config=require(_0xccb2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xccb2('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xccb2('0x18'))(new Redis(config[_0xccb2('0x17')]));require(_0xccb2('0x19'))['register'](socket);var jayson=require(_0xccb2('0x1a'));var client=jayson['client'][_0xccb2('0x1b')]({'port':0x232c});var client9002=jayson[_0xccb2('0x1c')][_0xccb2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x41bb5e,_0x27e905,_0x117047,_0x3a6cd5){return new BPromise(function(_0x40dcac,_0x1f2d9a){var _0x4ca090=_0x3a6cd5||client;return _0x4ca090[_0xccb2('0x1d')](_0x41bb5e,_0x117047)[_0xccb2('0x1e')](function(_0x4f47fd){logger[_0xccb2('0x1f')](_0xccb2('0x20'),_0x27e905,_0xccb2('0x21'));logger[_0xccb2('0x22')](_0xccb2('0x23'),_0x27e905,_0xccb2('0x21'),JSON[_0xccb2('0x24')](_0x4f47fd));if(_0x4f47fd[_0xccb2('0x25')]){if(_0x4f47fd['error'][_0xccb2('0x26')]===0x1f4){logger['error'](_0xccb2('0x20'),_0x27e905,_0x4f47fd[_0xccb2('0x25')][_0xccb2('0x27')]);return _0x1f2d9a(_0x4f47fd['error'][_0xccb2('0x27')]);}logger['error'](_0xccb2('0x20'),_0x27e905,_0x4f47fd[_0xccb2('0x25')][_0xccb2('0x27')]);return _0x40dcac(_0x4f47fd[_0xccb2('0x25')]['message']);}else{logger['info'](_0xccb2('0x20'),_0x27e905,'request\x20sent');_0x40dcac(_0x4f47fd[_0xccb2('0x28')][_0xccb2('0x27')]);}})[_0xccb2('0x29')](function(_0x523d42){logger['error']('FaxAccount,\x20%s,\x20%s',_0x27e905,_0x523d42);_0x1f2d9a(_0x523d42);});});}function respondWithStatusCode(_0x4709c1,_0x2c0f93){_0x2c0f93=_0x2c0f93||0xcc;return function(_0x57c872){if(_0x57c872){return _0x4709c1[_0xccb2('0x2a')](_0x2c0f93);}return _0x4709c1['status'](_0x2c0f93)[_0xccb2('0x2b')]();};}function respondWithResult(_0x23c882,_0x852d4b){_0x852d4b=_0x852d4b||0xc8;return function(_0x4fdcc7){if(_0x4fdcc7){return _0x23c882[_0xccb2('0x2c')](_0x852d4b)[_0xccb2('0x2d')](_0x4fdcc7);}};}function respondWithFilteredResult(_0x22570f,_0x4e3945){return function(_0x1c1366){if(_0x1c1366){var _0x523b2a=typeof _0x4e3945[_0xccb2('0x2e')]===_0xccb2('0x2f')&&typeof _0x4e3945[_0xccb2('0x30')]===_0xccb2('0x2f');var _0x2ef9dd=_0x1c1366[_0xccb2('0x31')];var _0x2e00d9=_0x523b2a?0x0:_0x4e3945[_0xccb2('0x2e')];var _0x281a28=_0x523b2a?_0x1c1366[_0xccb2('0x31')]:_0x4e3945[_0xccb2('0x2e')]+_0x4e3945['limit'];var _0x4f204c;if(_0x281a28>=_0x2ef9dd){_0x281a28=_0x2ef9dd;_0x4f204c=0xc8;}else{_0x4f204c=0xce;}_0x22570f['status'](_0x4f204c);return _0x22570f[_0xccb2('0x32')]('Content-Range',_0x2e00d9+'-'+_0x281a28+'/'+_0x2ef9dd)[_0xccb2('0x2d')](_0x1c1366);}return null;};}function patchUpdates(_0x3882df){return function(_0x3be00f){try{jsonpatch['apply'](_0x3be00f,_0x3882df,!![]);}catch(_0x50445b){return BPromise['reject'](_0x50445b);}return _0x3be00f[_0xccb2('0x33')]();};}function saveUpdates(_0x399c86,_0x4d12ca){return function(_0x5a68e9){if(_0x5a68e9){return _0x5a68e9['update'](_0x399c86)[_0xccb2('0x1e')](function(_0x59ac68){return _0x59ac68;});}return null;};}function removeEntity(_0x26dd14,_0xa1899d){return function(_0x3796fe){if(_0x3796fe){return _0x3796fe[_0xccb2('0x34')]()['then'](function(){var _0x4fbb85=_0x3796fe[_0xccb2('0x35')]({'plain':!![]});var _0x3bb11e=_0xccb2('0x36');return db[_0xccb2('0x37')]['destroy']({'where':{'type':_0x3bb11e,'resourceId':_0x4fbb85['id']}})['then'](function(){return _0x3796fe;});})[_0xccb2('0x1e')](function(){_0x26dd14[_0xccb2('0x2c')](0xcc)[_0xccb2('0x2b')]();});}};}function handleEntityNotFound(_0x3295a5,_0x5d3cf2){return function(_0x3aff60){if(!_0x3aff60){_0x3295a5[_0xccb2('0x2a')](0x194);}return _0x3aff60;};}function handleError(_0x2cfd8d,_0x439e57){_0x439e57=_0x439e57||0x1f4;return function(_0x212ade){logger['error'](_0x212ade[_0xccb2('0x38')]);if(_0x212ade[_0xccb2('0x39')]){delete _0x212ade[_0xccb2('0x39')];}_0x2cfd8d[_0xccb2('0x2c')](_0x439e57)[_0xccb2('0x3a')](_0x212ade);};}exports[_0xccb2('0x3b')]=function(_0x3dc719,_0x419d12){var _0x63cef7={'include':[{'model':db[_0xccb2('0x3c')],'as':_0xccb2('0x3d')}]},_0x4815d5={},_0x41a597={'count':0x0,'rows':[]};var _0x33d57a=_[_0xccb2('0x3e')](db['FaxAccount']['rawAttributes'],function(_0xdc4956){return{'name':_0xdc4956['fieldName'],'type':_0xdc4956[_0xccb2('0x3f')][_0xccb2('0x40')]};});_0x4815d5[_0xccb2('0x41')]=_[_0xccb2('0x3e')](_0x33d57a,_0xccb2('0x39'));_0x4815d5['query']=_[_0xccb2('0x42')](_0x3dc719[_0xccb2('0x43')]);_0x4815d5[_0xccb2('0x44')]=_[_0xccb2('0x45')](_0x4815d5[_0xccb2('0x41')],_0x4815d5[_0xccb2('0x43')]);_0x63cef7[_0xccb2('0x46')]=_[_0xccb2('0x45')](_0x4815d5[_0xccb2('0x41')],qs[_0xccb2('0x47')](_0x3dc719[_0xccb2('0x43')]['fields']));_0x63cef7['attributes']=_0x63cef7[_0xccb2('0x46')][_0xccb2('0x48')]?_0x63cef7['attributes']:_0x4815d5[_0xccb2('0x41')];if(!_0x3dc719[_0xccb2('0x43')][_0xccb2('0x49')](_0xccb2('0x4a'))){_0x63cef7[_0xccb2('0x30')]=qs[_0xccb2('0x30')](_0x3dc719[_0xccb2('0x43')]['limit']);_0x63cef7['offset']=qs['offset'](_0x3dc719[_0xccb2('0x43')][_0xccb2('0x2e')]);}_0x63cef7[_0xccb2('0x4b')]=qs[_0xccb2('0x4c')](_0x3dc719[_0xccb2('0x43')]['sort']);_0x63cef7[_0xccb2('0x4d')]=qs[_0xccb2('0x44')](_[_0xccb2('0x4e')](_0x3dc719[_0xccb2('0x43')],_0x4815d5[_0xccb2('0x44')]),_0x33d57a);if(_0x3dc719[_0xccb2('0x43')][_0xccb2('0x4f')]){_0x63cef7[_0xccb2('0x4d')]=_['merge'](_0x63cef7['where'],{'$or':_[_0xccb2('0x3e')](_0x33d57a,function(_0x9cd672){if(_0x9cd672[_0xccb2('0x3f')]!==_0xccb2('0x50')){var _0x3bd503={};_0x3bd503[_0x9cd672[_0xccb2('0x39')]]={'$like':'%'+_0x3dc719['query'][_0xccb2('0x4f')]+'%'};return _0x3bd503;}})});}_0x63cef7=_[_0xccb2('0x51')]({},_0x63cef7,_0x3dc719[_0xccb2('0x52')]);var _0x10b3a7={'where':_0x63cef7[_0xccb2('0x4d')]};return db['FaxAccount']['count'](_0x10b3a7)[_0xccb2('0x1e')](function(_0x38a849){_0x41a597[_0xccb2('0x31')]=_0x38a849;if(_0x3dc719['query'][_0xccb2('0x53')]){_0x63cef7['include']=[{'all':!![]}];}return db[_0xccb2('0x54')][_0xccb2('0x55')](_0x63cef7);})[_0xccb2('0x1e')](function(_0x48d458){_0x41a597['rows']=_0x48d458;return _0x41a597;})[_0xccb2('0x1e')](respondWithFilteredResult(_0x419d12,_0x63cef7))['catch'](handleError(_0x419d12,null));};exports['show']=function(_0x3bb1ec,_0x4221c8){var _0x11eeb2={'raw':![],'where':{'id':_0x3bb1ec['params']['id']},'include':[{'model':db['Pause'],'as':_0xccb2('0x3d')}]},_0xfea05d={};_0xfea05d[_0xccb2('0x41')]=_[_0xccb2('0x42')](db[_0xccb2('0x54')]['rawAttributes']);_0xfea05d['query']=_['keys'](_0x3bb1ec[_0xccb2('0x43')]);_0xfea05d[_0xccb2('0x44')]=_[_0xccb2('0x45')](_0xfea05d['model'],_0xfea05d[_0xccb2('0x43')]);_0x11eeb2['attributes']=_[_0xccb2('0x45')](_0xfea05d[_0xccb2('0x41')],qs['fields'](_0x3bb1ec['query'][_0xccb2('0x47')]));_0x11eeb2[_0xccb2('0x46')]=_0x11eeb2[_0xccb2('0x46')][_0xccb2('0x48')]?_0x11eeb2[_0xccb2('0x46')]:_0xfea05d['model'];if(_0x3bb1ec[_0xccb2('0x43')][_0xccb2('0x53')]){_0x11eeb2['include']=[{'all':!![]}];}_0x11eeb2=_['merge']({},_0x11eeb2,_0x3bb1ec[_0xccb2('0x52')]);return db[_0xccb2('0x54')][_0xccb2('0x56')](_0x11eeb2)[_0xccb2('0x1e')](handleEntityNotFound(_0x4221c8,null))[_0xccb2('0x1e')](respondWithResult(_0x4221c8,null))['catch'](handleError(_0x4221c8,null));};exports['create']=function(_0xccfb3d,_0x5b0f93){return db[_0xccb2('0x54')][_0xccb2('0x57')](_0xccfb3d[_0xccb2('0x58')],{})[_0xccb2('0x1e')](function(_0x5c950c){var _0x36f1c8=_0xccfb3d[_0xccb2('0x59')][_0xccb2('0x35')]({'plain':!![]});if(!_0x36f1c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36f1c8[_0xccb2('0x5a')]===_0xccb2('0x59')){var _0x29744e=_0x5c950c[_0xccb2('0x35')]({'plain':!![]});var _0x10772a=_0xccb2('0x36');return db[_0xccb2('0x5b')][_0xccb2('0x56')]({'where':{'name':_0x10772a,'userProfileId':_0x36f1c8[_0xccb2('0x5c')]},'raw':!![]})[_0xccb2('0x1e')](function(_0x5bb92e){if(_0x5bb92e&&_0x5bb92e[_0xccb2('0x5d')]===0x0){return db[_0xccb2('0x37')][_0xccb2('0x57')]({'name':_0x29744e[_0xccb2('0x39')],'resourceId':_0x29744e['id'],'type':_0x5bb92e[_0xccb2('0x39')],'sectionId':_0x5bb92e['id']},{})[_0xccb2('0x1e')](function(){return _0x5c950c;});}else{return _0x5c950c;}})[_0xccb2('0x29')](function(_0x26eb13){logger[_0xccb2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26eb13);throw _0x26eb13;});}return _0x5c950c;})[_0xccb2('0x1e')](respondWithResult(_0x5b0f93,0xc9))['catch'](handleError(_0x5b0f93,null));};exports[_0xccb2('0x5e')]=function(_0x3b4976,_0x5dba09){if(_0x3b4976[_0xccb2('0x58')]['id']){delete _0x3b4976[_0xccb2('0x58')]['id'];}return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x3b4976[_0xccb2('0x5f')]['id']},'include':[{'model':db['Pause'],'as':_0xccb2('0x3d')}]})[_0xccb2('0x1e')](handleEntityNotFound(_0x5dba09,null))[_0xccb2('0x1e')](saveUpdates(_0x3b4976[_0xccb2('0x58')],null))[_0xccb2('0x1e')](respondWithResult(_0x5dba09,null))['catch'](handleError(_0x5dba09,null));};exports[_0xccb2('0x34')]=function(_0x3c8066,_0x44f10a){return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x3c8066[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0x44f10a,null))[_0xccb2('0x1e')](removeEntity(_0x44f10a,null))[_0xccb2('0x29')](handleError(_0x44f10a,null));};exports[_0xccb2('0x60')]=function(_0xb34e88,_0x2336d9){return db['FaxAccount'][_0xccb2('0x60')]()['then'](respondWithResult(_0x2336d9,null))['catch'](handleError(_0x2336d9,null));};exports[_0xccb2('0x61')]=function(_0x5809f0,_0x14e77b,_0x4c655b){if(_0x5809f0[_0xccb2('0x58')]['id']){delete _0x5809f0[_0xccb2('0x58')]['id'];}return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x5809f0['params']['id']}})['then'](handleEntityNotFound(_0x14e77b,null))[_0xccb2('0x1e')](function(_0x3d514d){if(_0x3d514d){_0x5809f0['body'][_0xccb2('0x62')]=_0x3d514d['id'];return db[_0xccb2('0x63')][_0xccb2('0x57')](_0x5809f0['body']);}})[_0xccb2('0x1e')](respondWithResult(_0x14e77b,null))[_0xccb2('0x29')](handleError(_0x14e77b,null));};exports[_0xccb2('0x64')]=function(_0x3300e9,_0xd3f21f,_0xefda68){var _0xcf4d27={'raw':![],'where':{}};var _0x19b673={};var _0x26d693={'count':0x0,'rows':[]};return db[_0xccb2('0x54')][_0xccb2('0x65')]({'where':{'id':_0x3300e9[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0xd3f21f,null))[_0xccb2('0x1e')](function(_0x163348){if(_0x163348){_0x19b673['model']=_['keys'](db[_0xccb2('0x63')]['rawAttributes']);_0x19b673[_0xccb2('0x43')]=_[_0xccb2('0x42')](_0x3300e9['query']);_0x19b673[_0xccb2('0x44')]=_[_0xccb2('0x45')](_0x19b673[_0xccb2('0x41')],_0x19b673[_0xccb2('0x43')]);_0xcf4d27[_0xccb2('0x46')]=_[_0xccb2('0x45')](_0x19b673[_0xccb2('0x41')],qs['fields'](_0x3300e9[_0xccb2('0x43')][_0xccb2('0x47')]));_0xcf4d27[_0xccb2('0x46')]=_0xcf4d27[_0xccb2('0x46')][_0xccb2('0x48')]?_0xcf4d27[_0xccb2('0x46')]:_0x19b673[_0xccb2('0x41')];if(!_0x3300e9[_0xccb2('0x43')][_0xccb2('0x49')](_0xccb2('0x4a'))){_0xcf4d27[_0xccb2('0x30')]=qs[_0xccb2('0x30')](_0x3300e9[_0xccb2('0x43')][_0xccb2('0x30')]);_0xcf4d27[_0xccb2('0x2e')]=qs[_0xccb2('0x2e')](_0x3300e9[_0xccb2('0x43')]['offset']);}_0xcf4d27[_0xccb2('0x4b')]=qs[_0xccb2('0x4c')](_0x3300e9[_0xccb2('0x43')][_0xccb2('0x4c')]);_0xcf4d27['where']=qs['filters'](_[_0xccb2('0x4e')](_0x3300e9[_0xccb2('0x43')],_0x19b673[_0xccb2('0x44')]));_0xcf4d27[_0xccb2('0x4d')][_0xccb2('0x62')]=_0x163348['id'];if(_0x3300e9[_0xccb2('0x43')][_0xccb2('0x4f')]){_0xcf4d27[_0xccb2('0x4d')]=_['merge'](_0xcf4d27[_0xccb2('0x4d')],{'$or':_[_0xccb2('0x3e')](_0xcf4d27[_0xccb2('0x46')],function(_0x15ef63){var _0x233ac3={};_0x233ac3[_0x15ef63]={'$like':'%'+_0x3300e9[_0xccb2('0x43')][_0xccb2('0x4f')]+'%'};return _0x233ac3;})});}_0xcf4d27=_[_0xccb2('0x51')]({},_0xcf4d27,_0x3300e9[_0xccb2('0x52')]);return db[_0xccb2('0x63')][_0xccb2('0x31')]({'where':_0xcf4d27[_0xccb2('0x4d')]})[_0xccb2('0x1e')](function(_0x4b1822){_0x26d693[_0xccb2('0x31')]=_0x4b1822;if(_0x3300e9['query'][_0xccb2('0x53')]){_0xcf4d27[_0xccb2('0x66')]=[{'all':!![]}];}return db[_0xccb2('0x63')][_0xccb2('0x55')](_0xcf4d27);})[_0xccb2('0x1e')](function(_0x37bc8d){_0x26d693[_0xccb2('0x67')]=_0x37bc8d;return _0x26d693;});}})[_0xccb2('0x1e')](respondWithFilteredResult(_0xd3f21f,_0xcf4d27))['catch'](handleError(_0xd3f21f,null));};exports['removeDispositions']=function(_0x27cbca,_0xda9e8a,_0x3500dd){return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x27cbca[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0xda9e8a,null))['then'](function(_0x1914b6){if(_0x1914b6){return _0x1914b6[_0xccb2('0x68')](_0x27cbca['query'][_0xccb2('0x69')]);}})[_0xccb2('0x1e')](respondWithStatusCode(_0xda9e8a,null))[_0xccb2('0x29')](handleError(_0xda9e8a,null));};exports['addAnswer']=function(_0x13249c,_0x304aa7,_0x5e771e){if(_0x13249c[_0xccb2('0x58')]['id']){delete _0x13249c['body']['id'];}return db['FaxAccount'][_0xccb2('0x56')]({'where':{'id':_0x13249c[_0xccb2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x304aa7,null))['then'](function(_0x28bce3){if(_0x28bce3){_0x13249c[_0xccb2('0x58')]['FaxAccountId']=_0x28bce3['id'];return db[_0xccb2('0x6a')][_0xccb2('0x57')](_0x13249c[_0xccb2('0x58')]);}})[_0xccb2('0x1e')](respondWithResult(_0x304aa7,null))[_0xccb2('0x29')](handleError(_0x304aa7,null));};exports[_0xccb2('0x6b')]=function(_0x402d79,_0x27e11f,_0x4b96a9){var _0x411f58={'raw':![],'where':{}};var _0x36d402={};var _0x283843={'count':0x0,'rows':[]};return db[_0xccb2('0x54')]['findOne']({'where':{'id':_0x402d79[_0xccb2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x27e11f,null))['then'](function(_0x830fe5){if(_0x830fe5){_0x36d402[_0xccb2('0x41')]=_[_0xccb2('0x42')](db[_0xccb2('0x6a')][_0xccb2('0x6c')]);_0x36d402[_0xccb2('0x43')]=_[_0xccb2('0x42')](_0x402d79[_0xccb2('0x43')]);_0x36d402[_0xccb2('0x44')]=_['intersection'](_0x36d402[_0xccb2('0x41')],_0x36d402[_0xccb2('0x43')]);_0x411f58[_0xccb2('0x46')]=_[_0xccb2('0x45')](_0x36d402['model'],qs[_0xccb2('0x47')](_0x402d79['query'][_0xccb2('0x47')]));_0x411f58[_0xccb2('0x46')]=_0x411f58[_0xccb2('0x46')]['length']?_0x411f58[_0xccb2('0x46')]:_0x36d402[_0xccb2('0x41')];if(!_0x402d79[_0xccb2('0x43')]['hasOwnProperty']('nolimit')){_0x411f58['limit']=qs[_0xccb2('0x30')](_0x402d79[_0xccb2('0x43')][_0xccb2('0x30')]);_0x411f58[_0xccb2('0x2e')]=qs['offset'](_0x402d79[_0xccb2('0x43')][_0xccb2('0x2e')]);}_0x411f58[_0xccb2('0x4b')]=qs[_0xccb2('0x4c')](_0x402d79[_0xccb2('0x43')][_0xccb2('0x4c')]);_0x411f58[_0xccb2('0x4d')]=qs[_0xccb2('0x44')](_[_0xccb2('0x4e')](_0x402d79[_0xccb2('0x43')],_0x36d402[_0xccb2('0x44')]));_0x411f58[_0xccb2('0x4d')][_0xccb2('0x62')]=_0x830fe5['id'];if(_0x402d79[_0xccb2('0x43')][_0xccb2('0x4f')]){_0x411f58['where']=_['merge'](_0x411f58[_0xccb2('0x4d')],{'$or':_[_0xccb2('0x3e')](_0x411f58[_0xccb2('0x46')],function(_0x27db62){var _0x2bf23e={};_0x2bf23e[_0x27db62]={'$like':'%'+_0x402d79[_0xccb2('0x43')]['filter']+'%'};return _0x2bf23e;})});}_0x411f58=_['merge']({},_0x411f58,_0x402d79[_0xccb2('0x52')]);return db[_0xccb2('0x6a')][_0xccb2('0x31')]({'where':_0x411f58[_0xccb2('0x4d')]})[_0xccb2('0x1e')](function(_0x23817c){_0x283843['count']=_0x23817c;if(_0x402d79[_0xccb2('0x43')][_0xccb2('0x53')]){_0x411f58[_0xccb2('0x66')]=[{'all':!![]}];}return db['CannedAnswer'][_0xccb2('0x55')](_0x411f58);})['then'](function(_0x3f2671){_0x283843[_0xccb2('0x67')]=_0x3f2671;return _0x283843;});}})[_0xccb2('0x1e')](respondWithFilteredResult(_0x27e11f,_0x411f58))['catch'](handleError(_0x27e11f,null));};exports[_0xccb2('0x6d')]=function(_0x1ccfec,_0x58b839,_0x10ae92){return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x1ccfec['params']['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0x58b839,null))[_0xccb2('0x1e')](function(_0x31f146){if(_0x31f146){return _0x31f146['removeAnswers'](_0x1ccfec[_0xccb2('0x43')][_0xccb2('0x69')]);}})['then'](respondWithStatusCode(_0x58b839,null))['catch'](handleError(_0x58b839,null));};exports[_0xccb2('0x6e')]=function(_0x22430f,_0x1645fc,_0x566c40){return db['FaxInteraction'][_0xccb2('0x56')]({'where':{'id':_0x22430f[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0x1645fc,null))[_0xccb2('0x1e')](function(_0x2254b9){if(_0x2254b9){return _0x2254b9[_0xccb2('0x6e')](_0x22430f['body'][_0xccb2('0x69')],_[_0xccb2('0x6f')](_0x22430f[_0xccb2('0x58')],[_0xccb2('0x69'),'id'])||{});}})[_0xccb2('0x1e')](respondWithResult(_0x1645fc,null))['catch'](handleError(_0x1645fc,null));};exports[_0xccb2('0x70')]=function(_0x393b09,_0x28ce81,_0xe1631c){var _0x5728d3={'raw':![],'where':{}};var _0x5e4f47={};var _0xe95f11={'count':0x0,'rows':[]};return db[_0xccb2('0x54')][_0xccb2('0x65')]({'where':{'id':_0x393b09[_0xccb2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x28ce81,null))[_0xccb2('0x1e')](function(_0x31eccb){if(_0x31eccb){_0x5e4f47[_0xccb2('0x41')]=_[_0xccb2('0x42')](db[_0xccb2('0x71')][_0xccb2('0x6c')]);_0x5e4f47['query']=_[_0xccb2('0x42')](_0x393b09[_0xccb2('0x43')]);_0x5e4f47[_0xccb2('0x44')]=_[_0xccb2('0x45')](_0x5e4f47[_0xccb2('0x41')],_0x5e4f47[_0xccb2('0x43')]);_0x5728d3[_0xccb2('0x46')]=_[_0xccb2('0x45')](_0x5e4f47[_0xccb2('0x41')],qs[_0xccb2('0x47')](_0x393b09[_0xccb2('0x43')]['fields']));_0x5728d3['attributes']=_0x5728d3[_0xccb2('0x46')][_0xccb2('0x48')]?_0x5728d3[_0xccb2('0x46')]:_0x5e4f47[_0xccb2('0x41')];if(!_0x393b09['query'][_0xccb2('0x49')](_0xccb2('0x4a'))){_0x5728d3[_0xccb2('0x30')]=qs[_0xccb2('0x30')](_0x393b09['query']['limit']);_0x5728d3[_0xccb2('0x2e')]=qs[_0xccb2('0x2e')](_0x393b09[_0xccb2('0x43')][_0xccb2('0x2e')]);}_0x5728d3[_0xccb2('0x4b')]=qs['sort'](_0x393b09[_0xccb2('0x43')][_0xccb2('0x4c')]);_0x5728d3[_0xccb2('0x4d')]=qs[_0xccb2('0x44')](_[_0xccb2('0x4e')](_0x393b09[_0xccb2('0x43')],_0x5e4f47['filters']));_0x5728d3['where'][_0xccb2('0x62')]=_0x31eccb['id'];if(_0x393b09[_0xccb2('0x43')][_0xccb2('0x4f')]){_0x5728d3['where']=_[_0xccb2('0x51')](_0x5728d3['where'],{'$or':_['map'](_0x5728d3[_0xccb2('0x46')],function(_0x429b35){var _0x207685={};_0x207685[_0x429b35]={'$like':'%'+_0x393b09[_0xccb2('0x43')][_0xccb2('0x4f')]+'%'};return _0x207685;})});}_0x5728d3=_[_0xccb2('0x51')]({},_0x5728d3,_0x393b09[_0xccb2('0x52')]);return db['FaxInteraction'][_0xccb2('0x31')]({'where':_0x5728d3[_0xccb2('0x4d')]})['then'](function(_0x5822be){_0xe95f11['count']=_0x5822be;if(_0x393b09[_0xccb2('0x43')][_0xccb2('0x53')]){_0x5728d3[_0xccb2('0x66')]=[{'model':db[_0xccb2('0x72')],'as':_0xccb2('0x73'),'required':![]},{'model':db[_0xccb2('0x74')],'as':_0xccb2('0x75'),'attributes':[_0xccb2('0x39'),'fullname',_0xccb2('0x76')],'required':![]},{'model':db[_0xccb2('0x77')],'as':'Tags','attributes':['id',_0xccb2('0x39'),_0xccb2('0x78')],'where':_0x393b09['query'][_0xccb2('0x79')]?{'id':_0x393b09[_0xccb2('0x43')]['tag']}:undefined,'required':_0x393b09[_0xccb2('0x43')][_0xccb2('0x79')]?!![]:![]}];}return db[_0xccb2('0x71')]['findAll'](_0x5728d3);})[_0xccb2('0x1e')](function(_0x4bb591){_0xe95f11[_0xccb2('0x67')]=_0x4bb591;return _0xe95f11;});}})[_0xccb2('0x1e')](respondWithFilteredResult(_0x28ce81,_0x5728d3))[_0xccb2('0x29')](handleError(_0x28ce81,null));};exports[_0xccb2('0x7a')]=function(_0x480e21,_0x481943){var _0x4de0a1=_0x480e21[_0xccb2('0x5f')]['id'];var _0x3f32ba=_0x480e21['body'];var _0x542de0=0xc8;var _0x25efed=null;return db[_0xccb2('0x7b')]['transaction']({'isolationLevel':db[_0xccb2('0x7b')][_0xccb2('0x7c')][_0xccb2('0x7d')][_0xccb2('0x7e')]},function(_0x26856c){return db[_0xccb2('0x54')][_0xccb2('0x65')]({'where':{'id':_0x4de0a1},'transaction':_0x26856c})[_0xccb2('0x1e')](function(_0x3cdd6e){if(_0x3cdd6e){return db[_0xccb2('0x7f')][_0xccb2('0x34')]({'where':{'FaxAccountId':_0x4de0a1},'transaction':_0x26856c})[_0xccb2('0x1e')](function(){var _0x226364=_['map'](_0x3f32ba,function(_0x1a366a){_0x1a366a[_0xccb2('0x62')]=_0x4de0a1;return _0x1a366a;});return db[_0xccb2('0x7f')][_0xccb2('0x80')](_0x226364,{'transaction':_0x26856c});});}else{_0x542de0=0x194;_0x25efed=[];}});})[_0xccb2('0x1e')](function(){if(_0x542de0!==0x194){return db[_0xccb2('0x7f')][_0xccb2('0x81')]({'where':{'FaxAccountId':_0x4de0a1},'order':_0xccb2('0x82')})['then'](function(_0x5a86d2){_0x25efed=_0x5a86d2;});}})[_0xccb2('0x29')](function(_0x359600){_0x542de0=0x1f4;logger[_0xccb2('0x25')](_0x359600[_0xccb2('0x38')]);if(_0x359600['name']){delete _0x359600[_0xccb2('0x39')];}_0x25efed=_0x359600;})['finally'](function(){if(_0x25efed===null){_0x481943['sendStatus'](_0x542de0);}else{if(_0x542de0===0x1f4){_0x481943[_0xccb2('0x2c')](_0x542de0)['send'](_0x25efed);}else{_0x481943['status'](_0x542de0)[_0xccb2('0x2d')](_0x25efed);}}});};exports[_0xccb2('0x83')]=function(_0x1094aa,_0x359638,_0x349046){var _0x5b3275={};var _0x317465={};var _0xeccd0d;var _0x4a8fc9;return db[_0xccb2('0x54')]['findOne']({'where':{'id':_0x1094aa[_0xccb2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x359638,null))['then'](function(_0x358b80){if(_0x358b80){_0xeccd0d=_0x358b80;_0x317465[_0xccb2('0x41')]=_['keys'](db['FaxApplication'][_0xccb2('0x6c')]);_0x317465['query']=_[_0xccb2('0x42')](_0x1094aa[_0xccb2('0x43')]);_0x317465[_0xccb2('0x44')]=_['intersection'](_0x317465['model'],_0x317465[_0xccb2('0x43')]);_0x5b3275['attributes']=_[_0xccb2('0x45')](_0x317465[_0xccb2('0x41')],qs[_0xccb2('0x47')](_0x1094aa[_0xccb2('0x43')][_0xccb2('0x47')]));_0x5b3275['attributes']=_0x5b3275[_0xccb2('0x46')][_0xccb2('0x48')]?_0x5b3275['attributes']:_0x317465[_0xccb2('0x41')];_0x5b3275['order']=qs[_0xccb2('0x4c')](_0x1094aa['query'][_0xccb2('0x4c')]);_0x5b3275[_0xccb2('0x4d')]=qs['filters'](_[_0xccb2('0x4e')](_0x1094aa[_0xccb2('0x43')],_0x317465[_0xccb2('0x44')]));if(_0x1094aa[_0xccb2('0x43')][_0xccb2('0x4f')]){_0x5b3275[_0xccb2('0x4d')]=_[_0xccb2('0x51')](_0x5b3275[_0xccb2('0x4d')],{'$or':_[_0xccb2('0x3e')](_0x5b3275[_0xccb2('0x46')],function(_0x290351){var _0x2126d1={};_0x2126d1[_0x290351]={'$like':'%'+_0x1094aa[_0xccb2('0x43')][_0xccb2('0x4f')]+'%'};return _0x2126d1;})});}_0x5b3275=_[_0xccb2('0x51')]({},_0x5b3275,_0x1094aa[_0xccb2('0x52')]);return _0xeccd0d[_0xccb2('0x83')](_0x5b3275);}})[_0xccb2('0x1e')](function(_0x14f4a1){if(_0x14f4a1){_0x4a8fc9=_0x14f4a1[_0xccb2('0x48')];if(!_0x1094aa[_0xccb2('0x43')][_0xccb2('0x49')](_0xccb2('0x4a'))){_0x5b3275['limit']=qs[_0xccb2('0x30')](_0x1094aa[_0xccb2('0x43')][_0xccb2('0x30')]);_0x5b3275[_0xccb2('0x2e')]=qs[_0xccb2('0x2e')](_0x1094aa[_0xccb2('0x43')][_0xccb2('0x2e')]);}return _0xeccd0d[_0xccb2('0x83')](_0x5b3275);}})[_0xccb2('0x1e')](function(_0x10ca02){if(_0x10ca02){return _0x10ca02?{'count':_0x4a8fc9,'rows':_0x10ca02}:null;}})[_0xccb2('0x1e')](respondWithResult(_0x359638,null))[_0xccb2('0x29')](handleError(_0x359638,null));};function Extension(_0x1610d3,_0x1f1638,_0x12b679,_0x23f8a9){this[_0xccb2('0x84')]=_0xccb2('0x85');this[_0xccb2('0x86')]=_0x1610d3['localstationid'];this[_0xccb2('0x87')]=_0x23f8a9;this[_0xccb2('0x3f')]=_0xccb2('0x88');this[_0xccb2('0x89')]=_0xccb2('0x8a');this['FaxAccountId']=_0x1610d3['id'];this[_0xccb2('0x82')]=_0x1f1638;this[_0xccb2('0x8b')]=_0x12b679;}function createExtensionsReciveFax(_0x3bdf72){var _0x811d09=0x1;var _0x56bb06=[];_0x56bb06[_0xccb2('0x8c')](new Extension(_0x3bdf72,_0x811d09,'',_0xccb2('0x8d')));_0x811d09+=0x1;_0x56bb06[_0xccb2('0x8c')](new Extension(_0x3bdf72,_0x811d09,_0xccb2('0x8e'),_0xccb2('0x8f')));_0x811d09+=0x1;for(var _0x320679 in _0x3bdf72){if(_0x3bdf72['hasOwnProperty'](_0x320679)&&(_0x320679===_0xccb2('0x90')||_0x320679==='localstationid'||_0x320679==='gateway'||_0x320679===_0xccb2('0x91')||_0x320679===_0xccb2('0x92')||_0x320679===_0xccb2('0x93')||_0x320679===_0xccb2('0x94')||_0x320679===_0xccb2('0x95')||_0x320679==='t38timeout')){_0x56bb06[_0xccb2('0x8c')](new Extension(_0x3bdf72,_0x811d09,_0xccb2('0x96')+_0x320679+')='+_0x3bdf72[_0x320679],'Set'));_0x811d09+=0x1;}}_0x56bb06[_0xccb2('0x8c')](new Extension(_0x3bdf72,_0x811d09,'6',_0xccb2('0x97')));_0x811d09+=0x1;_0x56bb06[_0xccb2('0x8c')](new Extension(_0x3bdf72,_0x811d09,_0xccb2('0x98'),_0xccb2('0x99')));_0x811d09=0x0;return _0x56bb06;}exports[_0xccb2('0x9a')]=function(_0x55eb06,_0x42740a,_0x4d1434){var _0x319ab8;return db['sequelize']['transaction'](function(_0x1ecb28){return db[_0xccb2('0x54')][_0xccb2('0x57')](_0x55eb06[_0xccb2('0x58')],{'transaction':_0x1ecb28})['then'](function(_0x5d8ded){_0x319ab8=_0x5d8ded[_0xccb2('0x35')]({'plain':!![]});return db['VoiceExtension'][_0xccb2('0x80')](createExtensionsReciveFax(_0x319ab8),{'transaction':_0x1ecb28});});})[_0xccb2('0x1e')](function(){return _0x319ab8;})[_0xccb2('0x1e')](respondWithResult(_0x42740a,null))[_0xccb2('0x29')](handleError(_0x42740a,null));};exports[_0xccb2('0x9b')]=function(_0x4e8269,_0x3f2878,_0x138348){var _0x2565ce;return db['sequelize'][_0xccb2('0x9c')](function(_0x2b2a86){return db['FaxAccount'][_0xccb2('0x5e')](_0x4e8269[_0xccb2('0x58')],{'where':{'id':_0x4e8269[_0xccb2('0x58')]['id']},'transaction':_0x2b2a86})[_0xccb2('0x1e')](function(_0x4c577b){return db[_0xccb2('0x9d')][_0xccb2('0x34')]({'where':{'FaxAccountId':_0x4e8269[_0xccb2('0x58')]['id']},'transaction':_0x2b2a86})[_0xccb2('0x1e')](function(_0x3111b0){return db[_0xccb2('0x9d')][_0xccb2('0x80')](createExtensionsReciveFax(_['omit'](_0x4e8269[_0xccb2('0x58')],[_0xccb2('0x9e'),'key',_0xccb2('0x9f'),_0xccb2('0xa0'),_0xccb2('0xa1'),_0xccb2('0xa2')])),{'transaction':_0x2b2a86});});});})[_0xccb2('0x1e')](function(){return db[_0xccb2('0x54')][_0xccb2('0xa3')](_0x4e8269[_0xccb2('0x58')]['id']);})[_0xccb2('0x1e')](respondWithResult(_0x3f2878,null))[_0xccb2('0x29')](handleError(_0x3f2878,null));};exports[_0xccb2('0xa4')]=function(_0x39bff3,_0x4bc258,_0x49d317){var _0x3ee7a5={'raw':!![],'where':{}};var _0x2ca757={};var _0x57d726={'count':0x0,'rows':[]};return db[_0xccb2('0x54')][_0xccb2('0x65')]({'where':{'id':_0x39bff3[_0xccb2('0x5f')]['id']}})['then'](handleEntityNotFound(_0x4bc258,null))['then'](function(_0x512a86){if(_0x512a86){_0x2ca757[_0xccb2('0x41')]=_[_0xccb2('0x42')](db[_0xccb2('0xa5')]['rawAttributes']);_0x2ca757[_0xccb2('0x43')]=_[_0xccb2('0x42')](_0x39bff3['query']);_0x2ca757['filters']=_[_0xccb2('0x45')](_0x2ca757[_0xccb2('0x41')],_0x2ca757[_0xccb2('0x43')]);_0x3ee7a5['attributes']=_[_0xccb2('0x45')](_0x2ca757[_0xccb2('0x41')],qs[_0xccb2('0x47')](_0x39bff3[_0xccb2('0x43')]['fields']));_0x3ee7a5['attributes']=_0x3ee7a5[_0xccb2('0x46')][_0xccb2('0x48')]?_0x3ee7a5[_0xccb2('0x46')]:_0x2ca757['model'];if(!_0x39bff3[_0xccb2('0x43')]['hasOwnProperty'](_0xccb2('0x4a'))){_0x3ee7a5[_0xccb2('0x30')]=qs[_0xccb2('0x30')](_0x39bff3[_0xccb2('0x43')][_0xccb2('0x30')]);_0x3ee7a5[_0xccb2('0x2e')]=qs[_0xccb2('0x2e')](_0x39bff3[_0xccb2('0x43')][_0xccb2('0x2e')]);}_0x3ee7a5[_0xccb2('0x4b')]=qs[_0xccb2('0x4c')](_0x39bff3[_0xccb2('0x43')][_0xccb2('0x4c')]);_0x3ee7a5[_0xccb2('0x4d')]=qs[_0xccb2('0x44')](_['pick'](_0x39bff3[_0xccb2('0x43')],_0x2ca757[_0xccb2('0x44')]));_0x3ee7a5[_0xccb2('0x4d')][_0xccb2('0x62')]=_0x512a86['id'];if(_0x39bff3[_0xccb2('0x43')]['filter']){_0x3ee7a5[_0xccb2('0x4d')]=_[_0xccb2('0x51')](_0x3ee7a5['where'],{'$or':_[_0xccb2('0x3e')](_0x3ee7a5[_0xccb2('0x46')],function(_0x296a82){var _0xbbca56={};_0xbbca56[_0x296a82]={'$like':'%'+_0x39bff3[_0xccb2('0x43')][_0xccb2('0x4f')]+'%'};return _0xbbca56;})});}if(_0x39bff3[_0xccb2('0x43')][_0xccb2('0xa6')]){var _0x2e2efb=_0x39bff3['query'][_0xccb2('0xa6')][_0xccb2('0xa7')](',');var _0x53dbfc={};_0x53dbfc[_0x2e2efb[0x0]]={'$gte':moment(_0x2e2efb[0x1])[_0xccb2('0xa8')](_0xccb2('0xa9'))};_0x3ee7a5['where']=_[_0xccb2('0x51')](_0x3ee7a5[_0xccb2('0x4d')],_0x53dbfc);}_0x3ee7a5=_[_0xccb2('0x51')]({},_0x3ee7a5,_0x39bff3[_0xccb2('0x52')]);return db[_0xccb2('0xa5')][_0xccb2('0x31')]({'where':_0x3ee7a5[_0xccb2('0x4d')]})['then'](function(_0x4321ab){_0x57d726[_0xccb2('0x31')]=_0x4321ab;if(_0x39bff3[_0xccb2('0x43')][_0xccb2('0x53')]){_0x3ee7a5[_0xccb2('0x66')]=[{'all':!![]}];}return db[_0xccb2('0xa5')][_0xccb2('0x55')](_0x3ee7a5);})['then'](function(_0x4b9be4){_0x57d726['rows']=_0x4b9be4;return _0x57d726;});}})[_0xccb2('0x1e')](respondWithFilteredResult(_0x4bc258,_0x3ee7a5))[_0xccb2('0x29')](handleError(_0x4bc258,null));};exports[_0xccb2('0x3a')]=function(_0x59ef07,_0x150b9c,_0x227f59){var _0x108a64,_0x3e681f={},_0x463d75;if(_0x59ef07['body']['to']){_0x463d75=_0x59ef07[_0xccb2('0x58')]['to'][0x0];}return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x59ef07['params']['id']},'include':[{'model':db['CmList'],'as':_0xccb2('0xaa'),'include':[{'model':db[_0xccb2('0x72')],'as':'Contacts','where':{'fax':_0x463d75},'limit':0x1,'order':[[_0xccb2('0xa0'),_0xccb2('0xab')]]}]}]})[_0xccb2('0x1e')](handleEntityNotFound(_0x150b9c,null))['then'](function(_0x3a9d83){_0x108a64=_0x3a9d83;if(_0x59ef07[_0xccb2('0x58')]['attachments']&&_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][_0xccb2('0x48')]){for(var _0x2db25f=0x0;_0x2db25f<_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')]['length'];_0x2db25f+=0x1){_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][_0x2db25f]={'filename':_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][_0x2db25f]['name'],'id':_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][_0x2db25f]['id'],'path':path['join'](config['root'],_0xccb2('0xad'),_0x59ef07[_0xccb2('0x58')]['attachments'][_0x2db25f][_0xccb2('0xae')])};}}return respondWithRpcPromise(_0xccb2('0xaf'),_0xccb2('0xaf'),{'FaxAccountId':_[_0xccb2('0xb0')](_0x59ef07[_0xccb2('0x5f')]['id'])?undefined:_0x59ef07[_0xccb2('0x5f')]['id'],'path':_['isNil'](_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0]['path'])?undefined:_0x59ef07[_0xccb2('0x58')]['attachments'][0x0][_0xccb2('0x7')],'fax':_['isNil'](_0x59ef07[_0xccb2('0x58')]['to'][0x0])?undefined:_0x59ef07[_0xccb2('0x58')]['to'][0x0]},client9002);})[_0xccb2('0x1e')](function(){if(_0x108a64){if(_[_0xccb2('0xb0')](_0x59ef07[_0xccb2('0x58')][_0xccb2('0xb1')])){_0x59ef07['body'][_0xccb2('0xb1')]=util['format']('\x22%s\x22\x20<%s>',_0x108a64[_0xccb2('0x39')],_0x108a64[_0xccb2('0xb2')]);}if(_0x108a64[_0xccb2('0xaa')]){if(_0x108a64[_0xccb2('0xaa')][_0xccb2('0xb3')]['length']){return _0x108a64[_0xccb2('0xaa')][_0xccb2('0xb3')][0x0];}else{return db[_0xccb2('0x72')][_0xccb2('0x57')](_[_0xccb2('0xb4')](_0x59ef07[_0xccb2('0x58')],{'firstName':_0x59ef07['body']['to'][0x0],'phone':_0x59ef07[_0xccb2('0x58')]['to'][0x0],'fax':_0x59ef07[_0xccb2('0x58')]['to'][0x0],'ListId':_0x108a64[_0xccb2('0xa2')]}));}}else{throw new Error(_0xccb2('0xb5'));}}else{throw new Error(_0xccb2('0xb6'));}})[_0xccb2('0x1e')](function(_0x384035){if(_0x384035){return db['FaxInteraction'][_0xccb2('0x56')]({'where':{'ContactId':_0x384035['id'],'closed':![],'FaxAccountId':_0x108a64['id']}})[_0xccb2('0x1e')](function(_0x46482b){if(_0x46482b){return[_0x46482b,![]];}return db[_0xccb2('0x71')][_0xccb2('0x57')]({'UserId':_0x59ef07['user']['id'],'ContactId':_0x384035['id'],'FaxAccountId':_0x108a64['id'],'fax':_0x59ef07[_0xccb2('0x58')]['to'][0x0],'firstMsgDirection':_0xccb2('0xb7'),'Messages':[_[_0xccb2('0x51')](_0x59ef07[_0xccb2('0x58')],{'read':![],'body':_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0]['filename'],'FaxAccountId':_0x108a64['id'],'UserId':_0x59ef07[_0xccb2('0x59')]['id'],'ContactId':_0x384035['id'],'AttachmentId':_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0]['id']})]},{'include':[{'model':db[_0xccb2('0xa5')],'as':_0xccb2('0xb8')}]})[_0xccb2('0x1e')](function(_0x5dfd06){return[_0x5dfd06,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xccb2('0xb9')](function(_0x1060a0,_0x142578){if(_0x142578){return _0x1060a0;}return db[_0xccb2('0xa5')]['create']({'direction':_0xccb2('0xb7'),'read':![],'body':_0x59ef07['body'][_0xccb2('0xac')][0x0][_0xccb2('0xba')],'FaxAccountId':_0x108a64['id'],'FaxInteractionId':_0x1060a0['id'],'UserId':_0x59ef07[_0xccb2('0x59')]['id'],'ContactId':_0x1060a0[_0xccb2('0xbb')],'AttachmentId':_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0]['id']})['then'](function(_0x4536ec){_0x1060a0['dataValues'][_0xccb2('0xb8')]=[];_0x1060a0['dataValues'][_0xccb2('0xb8')][_0xccb2('0x8c')](_0x4536ec[_0xccb2('0xbc')]);return _0x1060a0;});})['then'](function(_0x249c49){respondWithRpcPromise(_0xccb2('0xbd'),'SendFax',{'FaxAccountId':_[_0xccb2('0xb0')](_0x59ef07[_0xccb2('0x5f')]['id'])?undefined:_0x59ef07[_0xccb2('0x5f')]['id'],'path':_[_0xccb2('0xb0')](_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0][_0xccb2('0x7')])?undefined:_0x59ef07[_0xccb2('0x58')][_0xccb2('0xac')][0x0]['path'],'fax':_[_0xccb2('0xb0')](_0x59ef07[_0xccb2('0x58')]['to'][0x0])?undefined:_0x59ef07[_0xccb2('0x58')]['to'][0x0],'AttachmentId':_0x59ef07['body'][_0xccb2('0xac')][0x0]['id']},client9002)['then'](function(_0x48001b){logger['info'](_0xccb2('0xbe'),_0x48001b);})[_0xccb2('0x29')](function(_0x54ff9d){logger[_0xccb2('0x1f')](_0xccb2('0xbe'),_0x54ff9d);});return _0x249c49;})[_0xccb2('0x1e')](respondWithResult(_0x150b9c,null))[_0xccb2('0x29')](handleError(_0x150b9c,null));};exports[_0xccb2('0xbf')]=function(_0x34b5cb,_0xae813b,_0x553816){return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x34b5cb[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0xae813b,null))[_0xccb2('0x1e')](function(_0x316e59){if(_0x316e59){return _0x316e59['addAgents'](_0x34b5cb['body'][_0xccb2('0x69')],_[_0xccb2('0x6f')](_0x34b5cb['body'],[_0xccb2('0x69'),'id'])||{})[_0xccb2('0xb9')](function(_0x3bf0ad){for(var _0x1dc6f2=0x0;_0x1dc6f2<_0x34b5cb[_0xccb2('0x58')][_0xccb2('0x69')][_0xccb2('0x48')];_0x1dc6f2+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0x34b5cb[_0xccb2('0x58')][_0xccb2('0x69')][_0x1dc6f2]),'FaxAccountId':Number(_0x34b5cb['params']['id'])});}return _0x3bf0ad;});}})[_0xccb2('0x1e')](respondWithResult(_0xae813b,null))[_0xccb2('0x29')](handleError(_0xae813b,null));};exports[_0xccb2('0xc0')]=function(_0x41016c,_0x20813d,_0x5d9894){return db[_0xccb2('0x54')][_0xccb2('0x56')]({'where':{'id':_0x41016c[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0x20813d,null))[_0xccb2('0x1e')](function(_0xfea45f){if(_0xfea45f){return _0xfea45f[_0xccb2('0xc0')](_0x41016c[_0xccb2('0x43')][_0xccb2('0x69')])[_0xccb2('0x1e')](function(){if(_['isArray'](_0x41016c[_0xccb2('0x43')][_0xccb2('0x69')])){for(var _0x17ea49=0x0;_0x17ea49<_0x41016c[_0xccb2('0x43')][_0xccb2('0x69')][_0xccb2('0x48')];_0x17ea49+=0x1){socket[_0xccb2('0xc1')](_0xccb2('0xc2'),{'UserId':Number(_0x41016c[_0xccb2('0x43')]['ids'][_0x17ea49]),'FaxAccountId':Number(_0x41016c[_0xccb2('0x5f')]['id'])});}}else{socket[_0xccb2('0xc1')](_0xccb2('0xc2'),{'UserId':Number(_0x41016c[_0xccb2('0x43')][_0xccb2('0x69')]),'FaxAccountId':Number(_0x41016c[_0xccb2('0x5f')]['id'])});}});}})[_0xccb2('0x1e')](respondWithStatusCode(_0x20813d,null))[_0xccb2('0x29')](handleError(_0x20813d,null));};exports[_0xccb2('0xc3')]=function(_0x23f789,_0x3dffe3,_0x57fcc3){var _0x2a3c0a={};var _0x3764f7={};var _0x286676;var _0x3360e5;return db[_0xccb2('0x54')][_0xccb2('0x65')]({'where':{'id':_0x23f789[_0xccb2('0x5f')]['id']}})[_0xccb2('0x1e')](handleEntityNotFound(_0x3dffe3,null))[_0xccb2('0x1e')](function(_0x49330a){if(_0x49330a){_0x286676=_0x49330a;_0x3764f7[_0xccb2('0x41')]=_['keys'](db[_0xccb2('0x74')][_0xccb2('0x6c')]);_0x3764f7[_0xccb2('0x43')]=_[_0xccb2('0x42')](_0x23f789['query']);_0x3764f7[_0xccb2('0x44')]=_[_0xccb2('0x45')](_0x3764f7[_0xccb2('0x41')],_0x3764f7[_0xccb2('0x43')]);_0x2a3c0a[_0xccb2('0x46')]=_[_0xccb2('0x45')](_0x3764f7[_0xccb2('0x41')],qs['fields'](_0x23f789[_0xccb2('0x43')][_0xccb2('0x47')]));_0x2a3c0a[_0xccb2('0x46')]=_0x2a3c0a[_0xccb2('0x46')][_0xccb2('0x48')]?_0x2a3c0a[_0xccb2('0x46')]:_0x3764f7[_0xccb2('0x41')];_0x2a3c0a[_0xccb2('0x4b')]=qs['sort'](_0x23f789[_0xccb2('0x43')][_0xccb2('0x4c')]);_0x2a3c0a[_0xccb2('0x4d')]=qs[_0xccb2('0x44')](_[_0xccb2('0x4e')](_0x23f789[_0xccb2('0x43')],_0x3764f7[_0xccb2('0x44')]));if(_0x23f789[_0xccb2('0x43')]['filter']){_0x2a3c0a['where']=_[_0xccb2('0x51')](_0x2a3c0a[_0xccb2('0x4d')],{'$or':_[_0xccb2('0x3e')](_0x2a3c0a['attributes'],function(_0x30ec61){var _0x4169ec={};_0x4169ec[_0x30ec61]={'$like':'%'+_0x23f789[_0xccb2('0x43')][_0xccb2('0x4f')]+'%'};return _0x4169ec;})});}_0x2a3c0a=_[_0xccb2('0x51')]({},_0x2a3c0a,_0x23f789[_0xccb2('0x52')]);return _0x286676[_0xccb2('0xc3')](_0x2a3c0a);}})[_0xccb2('0x1e')](function(_0xbabcb9){if(_0xbabcb9){_0x3360e5=_0xbabcb9[_0xccb2('0x48')];if(!_0x23f789[_0xccb2('0x43')][_0xccb2('0x49')](_0xccb2('0x4a'))){_0x2a3c0a['limit']=qs[_0xccb2('0x30')](_0x23f789[_0xccb2('0x43')][_0xccb2('0x30')]);_0x2a3c0a['offset']=qs[_0xccb2('0x2e')](_0x23f789['query']['offset']);}return _0x286676['getAgents'](_0x2a3c0a);}})[_0xccb2('0x1e')](function(_0x3f52d6){if(_0x3f52d6){return _0x3f52d6?{'count':_0x3360e5,'rows':_0x3f52d6}:null;}})['then'](respondWithResult(_0x3dffe3,null))[_0xccb2('0x29')](handleError(_0x3dffe3,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6df0d3f..bad2275 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 _0x1e90=['events','../../mysqldb','FaxAccount','save','update','remove','emit','hook'];(function(_0x4cf59c,_0x24cbdc){var _0x370ae0=function(_0x36af56){while(--_0x36af56){_0x4cf59c['push'](_0x4cf59c['shift']());}};_0x370ae0(++_0x24cbdc);}(_0x1e90,0x1a8));var _0x01e9=function(_0x4cae3f,_0x1b5ebb){_0x4cae3f=_0x4cae3f-0x0;var _0xadc8c5=_0x1e90[_0x4cae3f];return _0xadc8c5;};'use strict';var EventEmitter=require(_0x01e9('0x0'));var FaxAccount=require(_0x01e9('0x1'))['db'][_0x01e9('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01e9('0x3'),'afterUpdate':_0x01e9('0x4'),'afterDestroy':_0x01e9('0x5')};function emitEvent(_0x22e9bc){return function(_0x26fd5b,_0x41ce07,_0x15eeff){FaxAccountEvents[_0x01e9('0x6')](_0x22e9bc+':'+_0x26fd5b['id'],_0x26fd5b);FaxAccountEvents[_0x01e9('0x6')](_0x22e9bc,_0x26fd5b);_0x15eeff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x01e9('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x208a=['FaxAccount','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3a7700,_0x4c0f80){var _0x37efff=function(_0x41c107){while(--_0x41c107){_0x3a7700['push'](_0x3a7700['shift']());}};_0x37efff(++_0x4c0f80);}(_0x208a,0x134));var _0xa208=function(_0x55be55,_0x1a11cb){_0x55be55=_0x55be55-0x0;var _0x587aa2=_0x208a[_0x55be55];return _0x587aa2;};'use strict';var EventEmitter=require(_0xa208('0x0'));var FaxAccount=require(_0xa208('0x1'))['db'][_0xa208('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa208('0x3'),'afterUpdate':_0xa208('0x4'),'afterDestroy':_0xa208('0x5')};function emitEvent(_0x4b5f74){return function(_0x1d3b8c,_0x3d1603,_0x3abc8c){FaxAccountEvents[_0xa208('0x6')](_0x4b5f74+':'+_0x1d3b8c['id'],_0x1d3b8c);FaxAccountEvents[_0xa208('0x6')](_0x4b5f74,_0x1d3b8c);_0x3abc8c(null);};}for(var e in events){if(events[_0xa208('0x7')](e)){var event=events[e];FaxAccount[_0xa208('0x8')](e,emitEvent(event));}}module[_0xa208('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ccf7ead..066aab6 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 _0xc407=['fax_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','FaxAccount'];(function(_0x5390b3,_0x207725){var _0x42d5be=function(_0x2fb24a){while(--_0x2fb24a){_0x5390b3['push'](_0x5390b3['shift']());}};_0x42d5be(++_0x207725);}(_0xc407,0xab));var _0x7c40=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xc407[_0x2b152a];return _0x2ad4c7;};'use strict';var _=require(_0x7c40('0x0'));var util=require('util');var logger=require(_0x7c40('0x1'))('api');var moment=require(_0x7c40('0x2'));var BPromise=require(_0x7c40('0x3'));var rp=require(_0x7c40('0x4'));var fs=require('fs');var path=require(_0x7c40('0x5'));var rimraf=require('rimraf');var config=require(_0x7c40('0x6'));var attributes=require('./faxAccount.attributes');module[_0x7c40('0x7')]=function(_0x3c7841,_0x553c66){return _0x3c7841['define'](_0x7c40('0x8'),attributes,{'tableName':_0x7c40('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b1d=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7b1d,0xf1));var _0xd7b1=function(_0x18e793,_0x23d80d){_0x18e793=_0x18e793-0x0;var _0x11e744=_0x7b1d[_0x18e793];return _0x11e744;};'use strict';var _=require(_0xd7b1('0x0'));var util=require(_0xd7b1('0x1'));var logger=require(_0xd7b1('0x2'))(_0xd7b1('0x3'));var moment=require('moment');var BPromise=require(_0xd7b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd7b1('0x5'));var config=require(_0xd7b1('0x6'));var attributes=require(_0xd7b1('0x7'));module[_0xd7b1('0x8')]=function(_0x440d84,_0x1159a5){return _0x440d84[_0xd7b1('0x9')](_0xd7b1('0xa'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index c99fad7..0dec075 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 _0xc769=['no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','length','ListId','create','contact','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','unshift','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','map','include','model','info','GetFaxAccount','NotifyFaxAccount','body','fax','CmContact','describe'];(function(_0x4ebe2e,_0xf37ee5){var _0x8d48fd=function(_0x2c550b){while(--_0x2c550b){_0x4ebe2e['push'](_0x4ebe2e['shift']());}};_0x8d48fd(++_0xf37ee5);}(_0xc769,0x89));var _0x9c76=function(_0x344284,_0x7023ef){_0x344284=_0x344284-0x0;var _0x4c618f=_0xc769[_0x344284];return _0x4c618f;};'use strict';var _=require(_0x9c76('0x0'));var util=require(_0x9c76('0x1'));var moment=require('moment');var BPromise=require(_0x9c76('0x2'));var rs=require(_0x9c76('0x3'));var fs=require('fs');var Redis=require(_0x9c76('0x4'));var db=require(_0x9c76('0x5'))['db'];var utils=require(_0x9c76('0x6'));var logger=require(_0x9c76('0x7'))(_0x9c76('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9c76('0x9')]['http']({'port':0x232c});config[_0x9c76('0xa')]=_['defaults'](config[_0x9c76('0xa')],{'host':_0x9c76('0xb'),'port':0x18eb});var socket=require(_0x9c76('0xc'))(new Redis(config[_0x9c76('0xa')]));require(_0x9c76('0xd'))[_0x9c76('0xe')](socket);function respondWithRpcPromise(_0x53e4df,_0x2ce470,_0x53c1b4){return new BPromise(function(_0x5a57d8,_0x84bb83){return client[_0x9c76('0xf')](_0x53e4df,_0x53c1b4)[_0x9c76('0x10')](function(_0x52aa87){logger['info']('FaxAccount,\x20%s,\x20%s',_0x2ce470,_0x9c76('0x11'));logger[_0x9c76('0x12')](_0x9c76('0x13'),_0x2ce470,_0x9c76('0x11'),JSON[_0x9c76('0x14')](_0x52aa87));if(_0x52aa87[_0x9c76('0x15')]){if(_0x52aa87[_0x9c76('0x15')]['code']===0x1f4){logger[_0x9c76('0x15')](_0x9c76('0x16'),_0x2ce470,_0x52aa87['error'][_0x9c76('0x17')]);return _0x84bb83(_0x52aa87['error'][_0x9c76('0x17')]);}logger[_0x9c76('0x15')](_0x9c76('0x16'),_0x2ce470,_0x52aa87[_0x9c76('0x15')][_0x9c76('0x17')]);return _0x5a57d8(_0x52aa87[_0x9c76('0x15')][_0x9c76('0x17')]);}else{logger['info'](_0x9c76('0x16'),_0x2ce470,_0x9c76('0x11'));_0x5a57d8(_0x52aa87[_0x9c76('0x18')][_0x9c76('0x17')]);}})[_0x9c76('0x19')](function(_0x212e2d){logger[_0x9c76('0x15')](_0x9c76('0x16'),_0x2ce470,_0x212e2d);_0x84bb83(_0x212e2d);});});}exports['GetFaxAccount']=function(_0x52eac4){var _0x561517=this;return new Promise(function(_0x5b9295,_0x54d64e){return db[_0x9c76('0x1a')][_0x9c76('0x1b')]({'raw':_0x52eac4[_0x9c76('0x1c')]?_0x52eac4[_0x9c76('0x1c')][_0x9c76('0x1d')]===undefined?!![]:![]:!![],'where':_0x52eac4[_0x9c76('0x1c')]?_0x52eac4[_0x9c76('0x1c')][_0x9c76('0x1e')]||null:null,'attributes':_0x52eac4[_0x9c76('0x1c')]?_0x52eac4[_0x9c76('0x1c')][_0x9c76('0x1f')]||null:null,'limit':_0x52eac4['options']?_0x52eac4[_0x9c76('0x1c')][_0x9c76('0x20')]||null:null,'include':_0x52eac4[_0x9c76('0x1c')]?_0x52eac4[_0x9c76('0x1c')]['include']?_[_0x9c76('0x21')](_0x52eac4[_0x9c76('0x1c')][_0x9c76('0x22')],function(_0x50f352){return{'model':db[_0x50f352[_0x9c76('0x23')]],'as':_0x50f352['as'],'attributes':_0x50f352[_0x9c76('0x1f')],'include':_0x50f352['include']?_[_0x9c76('0x21')](_0x50f352[_0x9c76('0x22')],function(_0x516488){return{'model':db[_0x516488[_0x9c76('0x23')]],'as':_0x516488['as'],'attributes':_0x516488[_0x9c76('0x1f')],'include':_0x516488[_0x9c76('0x22')]?_[_0x9c76('0x21')](_0x516488[_0x9c76('0x22')],function(_0x386fff){return{'model':db[_0x386fff[_0x9c76('0x23')]],'as':_0x386fff['as'],'attributes':_0x386fff[_0x9c76('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2aba69){logger[_0x9c76('0x24')](_0x9c76('0x25'),_0x52eac4);logger[_0x9c76('0x12')](_0x9c76('0x25'),_0x52eac4,JSON[_0x9c76('0x14')](_0x2aba69));_0x5b9295(_0x2aba69);})[_0x9c76('0x19')](function(_0x533965){logger[_0x9c76('0x15')](_0x9c76('0x25'),_0x533965[_0x9c76('0x17')],_0x52eac4);_0x54d64e(_0x561517[_0x9c76('0x15')](0x1f4,_0x533965[_0x9c76('0x17')]));});});};exports[_0x9c76('0x26')]=function(_0x2949fc,_0x3396f9,_0x13a0e1){var _0x25547c=this;return new Promise(function(_0x5ef7d5,_0x19cffd){var _0x117f24={'body':_0x2949fc[_0x9c76('0x27')],'channel':_0x9c76('0x28')};var _0x9e06c4=[];var _0x4b35c7=[];var _0x5ed366={};return db[_0x9c76('0x29')][_0x9c76('0x2a')]()['then'](function(_0x22d4dc){if(!_0x22d4dc){throw new db['Sequelize']['ValidationError'](_0x9c76('0x2b'));}_0x9e06c4=_[_0x9c76('0x2c')](_[_0x9c76('0x2d')](_0x22d4dc),[_0x9c76('0x2e'),_0x9c76('0x2f')]);_0x4b35c7=_['difference'](_[_0x9c76('0x2d')](_0x22d4dc),['createdAt',_0x9c76('0x2f'),'CompanyId','ListId']);if(_0x2949fc[_0x9c76('0x27')]['id']){delete _0x2949fc[_0x9c76('0x27')]['id'];}if(_[_0x9c76('0x30')](_0x2949fc[_0x9c76('0x27')]['from'])){throw new db[(_0x9c76('0x31'))][(_0x9c76('0x32'))](_0x9c76('0x33'));}if(_[_0x9c76('0x30')](_0x2949fc['body'][_0x9c76('0x27')])||_0x2949fc[_0x9c76('0x27')]['body']===''){throw new db[(_0x9c76('0x31'))][(_0x9c76('0x32'))](_0x9c76('0x34'));}if(_['isNil'](_0x2949fc[_0x9c76('0x27')]['mapKey'])){throw new db[(_0x9c76('0x31'))][(_0x9c76('0x32'))](_0x9c76('0x35')+_0x4b35c7);}if(!_['includes'](_0x4b35c7,_0x2949fc['body'][_0x9c76('0x36')])){throw new db['Sequelize']['ValidationError'](_0x9c76('0x37')+_0x4b35c7);}_0x5ed366[_0x2949fc['body'][_0x9c76('0x36')]]=_0x2949fc[_0x9c76('0x27')][_0x9c76('0x38')];})[_0x9c76('0x10')](function(){return db[_0x9c76('0x1a')][_0x9c76('0x39')]({'where':{'id':_0x2949fc[_0x9c76('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0x9c76('0x3b'),'include':[{'model':db[_0x9c76('0x29')],'as':_0x9c76('0x3c'),'where':_0x5ed366,'limit':0x1,'order':[[_0x9c76('0x2f'),_0x9c76('0x3d')]]}]},{'model':db[_0x9c76('0x3e')],'as':_0x9c76('0x3f')}]});})[_0x9c76('0x10')](function(_0x2b93d5){if(_0x2b93d5&&_0x2b93d5[_0x9c76('0x3b')]){var _0x1c68d1=_0x2b93d5[_0x9c76('0x40')]({'plain':!![]});_0x117f24['account']=_0x1c68d1;_0x117f24[_0x9c76('0x41')]=_0x1c68d1['Applications'];_0x117f24[_0x9c76('0x42')]=_0x1c68d1['List'];_0x117f24[_0x9c76('0x41')]=_[_0x9c76('0x43')](_0x117f24[_0x9c76('0x41')],['priority'],[_0x9c76('0x44')]);if(_0x117f24[_0x9c76('0x3a')][_0x9c76('0x3f')]){delete _0x117f24['account'][_0x9c76('0x3f')];}if(_0x117f24[_0x9c76('0x3a')][_0x9c76('0x3b')]&&_0x117f24[_0x9c76('0x3a')]['List']['Contacts'][_0x9c76('0x45')]){return _0x117f24[_0x9c76('0x3a')][_0x9c76('0x3b')][_0x9c76('0x3c')][0x0];}var _0x159fef=_['defaults'](_0x2949fc[_0x9c76('0x27')],{'firstName':_0x2949fc[_0x9c76('0x27')][_0x9c76('0x38')],'ListId':_0x1c68d1[_0x9c76('0x46')]});_0x159fef[_0x2949fc['body']['mapKey']]=_0x2949fc['body']['from'];return db[_0x9c76('0x29')][_0x9c76('0x47')](_0x159fef,{'fields':_0x9e06c4,'raw':!![]});}})[_0x9c76('0x10')](function(_0x71a579){_0x117f24[_0x9c76('0x48')]=_0x71a579;if(_0x71a579){var _0x4d32ec={'ContactId':_0x71a579['id'],'FaxAccountId':_0x2949fc[_0x9c76('0x3a')]['id'],'fax':_0x71a579[_0x9c76('0x28')]};return db['FaxInteraction'][_0x9c76('0x39')]({'where':{'ContactId':_0x71a579['id'],'closed':![],'FaxAccountId':_0x2949fc['account']['id']}})['then'](function(_0x1f687f){if(_0x1f687f){return[_0x1f687f,![]];}return db['FaxInteraction']['create'](_0x4d32ec)['then'](function(_0xae477b){return[_0xae477b,!![]];});});}else{throw new Error(_0x9c76('0x49'));}})[_0x9c76('0x4a')](function(_0x9f7baf,_0x40be09){var _0xa42667=_0x9f7baf['get']({'plain':!![]});if(_0x40be09){if(_0x117f24['account'][_0x9c76('0x4b')]){_0x117f24[_0x9c76('0x41')][_0x9c76('0x4c')]({'id':0x0,'priority':_0x117f24[_0x9c76('0x41')]['length']+0x1,'app':'close','appdata':_0x9c76('0x4d'),'interval':_0x9c76('0x4e')});}_0xa42667['created']=!![];}else{_0xa42667[_0x9c76('0x4f')]=![];}_0x117f24['interaction']=_0xa42667;return db[_0x9c76('0x50')][_0x9c76('0x47')]({'body':_0x2949fc['body'][_0x9c76('0x27')],'FaxAccountId':_0x2949fc[_0x9c76('0x3a')]['id'],'FaxInteractionId':_0x9f7baf['id'],'direction':'in','ContactId':_0x9f7baf[_0x9c76('0x51')],'AttachmentId':_0x2949fc['body'][_0x9c76('0x52')]});})[_0x9c76('0x10')](function(_0x265a65){_0x117f24[_0x9c76('0x17')]=_0x265a65;if(_0x117f24[_0x9c76('0x53')][_0x9c76('0x54')]){return db[_0x9c76('0x55')][_0x9c76('0x39')]({'attributes':['id',_0x9c76('0x56')],'where':{'id':_0x117f24[_0x9c76('0x53')]['UserId']}})[_0x9c76('0x10')](function(_0x4ce956){if(_0x4ce956){_0x117f24['applications'][_0x9c76('0x57')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4ce956[_0x9c76('0x56')]+','+(_0x117f24[_0x9c76('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x9c76('0x4e')});}return respondWithRpcPromise(_0x9c76('0x58'),'startRouting',_0x117f24);});}return respondWithRpcPromise('Start',_0x9c76('0x59'),_0x117f24);})['then'](function(_0x32a3df){_0x5ef7d5(_0x32a3df);})['catch'](function(_0x59ff78){_0x19cffd(_0x25547c[_0x9c76('0x15')](0x1f4,_0x59ff78['message']));});});}; \ No newline at end of file +var _0x088b=['info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','applications','orderBy','priority','asc','length','defaults','contact','FaxInteraction','create','Contact\x20not\x20found','spread','get','autoclose','push','*,*,*,*','created','interaction','FaxMessage','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','./faxAccount.socket','register','request','then'];(function(_0x1591f3,_0x1a083c){var _0x4f001e=function(_0x4e407d){while(--_0x4e407d){_0x1591f3['push'](_0x1591f3['shift']());}};_0x4f001e(++_0x1a083c);}(_0x088b,0x1b7));var _0xb088=function(_0x34cbbf,_0x540ce2){_0x34cbbf=_0x34cbbf-0x0;var _0x3ec76e=_0x088b[_0x34cbbf];return _0x3ec76e;};'use strict';var _=require('lodash');var util=require(_0xb088('0x0'));var moment=require(_0xb088('0x1'));var BPromise=require(_0xb088('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb088('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb088('0x4'));var logger=require(_0xb088('0x5'))(_0xb088('0x6'));var config=require('../../config/environment');var jayson=require(_0xb088('0x7'));var client=jayson[_0xb088('0x8')][_0xb088('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0xb088('0xa')],{'host':_0xb088('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb088('0xa')]));require(_0xb088('0xc'))[_0xb088('0xd')](socket);function respondWithRpcPromise(_0x143806,_0x3a9df1,_0x5582d5){return new BPromise(function(_0x2a67dd,_0x2ecdde){return client[_0xb088('0xe')](_0x143806,_0x5582d5)[_0xb088('0xf')](function(_0x35462b){logger[_0xb088('0x10')](_0xb088('0x11'),_0x3a9df1,'request\x20sent');logger[_0xb088('0x12')](_0xb088('0x13'),_0x3a9df1,_0xb088('0x14'),JSON[_0xb088('0x15')](_0x35462b));if(_0x35462b[_0xb088('0x16')]){if(_0x35462b[_0xb088('0x16')][_0xb088('0x17')]===0x1f4){logger[_0xb088('0x16')](_0xb088('0x11'),_0x3a9df1,_0x35462b['error'][_0xb088('0x18')]);return _0x2ecdde(_0x35462b[_0xb088('0x16')][_0xb088('0x18')]);}logger[_0xb088('0x16')](_0xb088('0x11'),_0x3a9df1,_0x35462b[_0xb088('0x16')][_0xb088('0x18')]);return _0x2a67dd(_0x35462b[_0xb088('0x16')]['message']);}else{logger[_0xb088('0x10')]('FaxAccount,\x20%s,\x20%s',_0x3a9df1,_0xb088('0x14'));_0x2a67dd(_0x35462b[_0xb088('0x19')][_0xb088('0x18')]);}})['catch'](function(_0x12c0e0){logger[_0xb088('0x16')]('FaxAccount,\x20%s,\x20%s',_0x3a9df1,_0x12c0e0);_0x2ecdde(_0x12c0e0);});});}exports[_0xb088('0x1a')]=function(_0x44f103){var _0x3ed88c=this;return new Promise(function(_0x362f5f,_0x495ced){return db[_0xb088('0x1b')][_0xb088('0x1c')]({'raw':_0x44f103[_0xb088('0x1d')]?_0x44f103[_0xb088('0x1d')][_0xb088('0x1e')]===undefined?!![]:![]:!![],'where':_0x44f103[_0xb088('0x1d')]?_0x44f103[_0xb088('0x1d')][_0xb088('0x1f')]||null:null,'attributes':_0x44f103['options']?_0x44f103[_0xb088('0x1d')][_0xb088('0x20')]||null:null,'limit':_0x44f103[_0xb088('0x1d')]?_0x44f103[_0xb088('0x1d')][_0xb088('0x21')]||null:null,'include':_0x44f103[_0xb088('0x1d')]?_0x44f103[_0xb088('0x1d')][_0xb088('0x22')]?_[_0xb088('0x23')](_0x44f103[_0xb088('0x1d')][_0xb088('0x22')],function(_0x8717ef){return{'model':db[_0x8717ef[_0xb088('0x24')]],'as':_0x8717ef['as'],'attributes':_0x8717ef[_0xb088('0x20')],'include':_0x8717ef[_0xb088('0x22')]?_[_0xb088('0x23')](_0x8717ef[_0xb088('0x22')],function(_0x5c3b40){return{'model':db[_0x5c3b40[_0xb088('0x24')]],'as':_0x5c3b40['as'],'attributes':_0x5c3b40['attributes'],'include':_0x5c3b40[_0xb088('0x22')]?_['map'](_0x5c3b40['include'],function(_0x558956){return{'model':db[_0x558956[_0xb088('0x24')]],'as':_0x558956['as'],'attributes':_0x558956[_0xb088('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb088('0xf')](function(_0x2e313e){logger['info'](_0xb088('0x1a'),_0x44f103);logger[_0xb088('0x12')](_0xb088('0x1a'),_0x44f103,JSON[_0xb088('0x15')](_0x2e313e));_0x362f5f(_0x2e313e);})[_0xb088('0x25')](function(_0x4cd6c2){logger[_0xb088('0x16')]('GetFaxAccount',_0x4cd6c2[_0xb088('0x18')],_0x44f103);_0x495ced(_0x3ed88c['error'](0x1f4,_0x4cd6c2[_0xb088('0x18')]));});});};exports[_0xb088('0x26')]=function(_0x142faa,_0x4c10dd,_0x291c33){var _0x336f96=this;return new Promise(function(_0x9d3d6d,_0x287765){var _0x5dc663={'body':_0x142faa[_0xb088('0x27')],'channel':_0xb088('0x28')};var _0x2e8c4f=[];var _0x43771a=[];var _0xf51378={};return db[_0xb088('0x29')]['describe']()[_0xb088('0xf')](function(_0x4bf40b){if(!_0x4bf40b){throw new db[(_0xb088('0x2a'))][(_0xb088('0x2b'))](_0xb088('0x2c'));}_0x2e8c4f=_['difference'](_[_0xb088('0x2d')](_0x4bf40b),[_0xb088('0x2e'),'updatedAt']);_0x43771a=_[_0xb088('0x2f')](_[_0xb088('0x2d')](_0x4bf40b),[_0xb088('0x2e'),_0xb088('0x30'),_0xb088('0x31'),_0xb088('0x32')]);if(_0x142faa[_0xb088('0x27')]['id']){delete _0x142faa[_0xb088('0x27')]['id'];}if(_[_0xb088('0x33')](_0x142faa[_0xb088('0x27')][_0xb088('0x34')])){throw new db[(_0xb088('0x2a'))][(_0xb088('0x2b'))](_0xb088('0x35'));}if(_[_0xb088('0x33')](_0x142faa[_0xb088('0x27')][_0xb088('0x27')])||_0x142faa[_0xb088('0x27')]['body']===''){throw new db[(_0xb088('0x2a'))][(_0xb088('0x2b'))](_0xb088('0x36'));}if(_[_0xb088('0x33')](_0x142faa[_0xb088('0x27')][_0xb088('0x37')])){throw new db[(_0xb088('0x2a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43771a);}if(!_['includes'](_0x43771a,_0x142faa[_0xb088('0x27')][_0xb088('0x37')])){throw new db['Sequelize'][(_0xb088('0x2b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x43771a);}_0xf51378[_0x142faa[_0xb088('0x27')][_0xb088('0x37')]]=_0x142faa[_0xb088('0x27')][_0xb088('0x34')];})[_0xb088('0xf')](function(){return db['FaxAccount'][_0xb088('0x38')]({'where':{'id':_0x142faa[_0xb088('0x39')]['id']},'include':[{'model':db[_0xb088('0x3a')],'as':_0xb088('0x3b'),'include':[{'model':db[_0xb088('0x29')],'as':_0xb088('0x3c'),'where':_0xf51378,'limit':0x1,'order':[[_0xb088('0x30'),_0xb088('0x3d')]]}]},{'model':db[_0xb088('0x3e')],'as':_0xb088('0x3f')}]});})['then'](function(_0x2fdf83){if(_0x2fdf83&&_0x2fdf83[_0xb088('0x3b')]){var _0x54ed52=_0x2fdf83['get']({'plain':!![]});_0x5dc663[_0xb088('0x39')]=_0x54ed52;_0x5dc663[_0xb088('0x40')]=_0x54ed52[_0xb088('0x3f')];_0x5dc663['list']=_0x54ed52[_0xb088('0x3b')];_0x5dc663[_0xb088('0x40')]=_[_0xb088('0x41')](_0x5dc663[_0xb088('0x40')],[_0xb088('0x42')],[_0xb088('0x43')]);if(_0x5dc663[_0xb088('0x39')][_0xb088('0x3f')]){delete _0x5dc663[_0xb088('0x39')][_0xb088('0x3f')];}if(_0x5dc663['account']['List']&&_0x5dc663[_0xb088('0x39')][_0xb088('0x3b')][_0xb088('0x3c')][_0xb088('0x44')]){return _0x5dc663[_0xb088('0x39')]['List'][_0xb088('0x3c')][0x0];}var _0x1e98b0=_[_0xb088('0x45')](_0x142faa[_0xb088('0x27')],{'firstName':_0x142faa[_0xb088('0x27')][_0xb088('0x34')],'ListId':_0x54ed52[_0xb088('0x32')]});_0x1e98b0[_0x142faa[_0xb088('0x27')][_0xb088('0x37')]]=_0x142faa[_0xb088('0x27')]['from'];return db[_0xb088('0x29')]['create'](_0x1e98b0,{'fields':_0x2e8c4f,'raw':!![]});}})[_0xb088('0xf')](function(_0x26be9a){_0x5dc663[_0xb088('0x46')]=_0x26be9a;if(_0x26be9a){var _0x20ebfe={'ContactId':_0x26be9a['id'],'FaxAccountId':_0x142faa[_0xb088('0x39')]['id'],'fax':_0x26be9a[_0xb088('0x28')]};return db[_0xb088('0x47')]['find']({'where':{'ContactId':_0x26be9a['id'],'closed':![],'FaxAccountId':_0x142faa[_0xb088('0x39')]['id']}})['then'](function(_0x511ccf){if(_0x511ccf){return[_0x511ccf,![]];}return db[_0xb088('0x47')][_0xb088('0x48')](_0x20ebfe)[_0xb088('0xf')](function(_0x1b68e0){return[_0x1b68e0,!![]];});});}else{throw new Error(_0xb088('0x49'));}})[_0xb088('0x4a')](function(_0x234c60,_0x5f1632){var _0x1a924c=_0x234c60[_0xb088('0x4b')]({'plain':!![]});if(_0x5f1632){if(_0x5dc663[_0xb088('0x39')][_0xb088('0x4c')]){_0x5dc663[_0xb088('0x40')][_0xb088('0x4d')]({'id':0x0,'priority':_0x5dc663['applications'][_0xb088('0x44')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xb088('0x4e')});}_0x1a924c[_0xb088('0x4f')]=!![];}else{_0x1a924c[_0xb088('0x4f')]=![];}_0x5dc663[_0xb088('0x50')]=_0x1a924c;return db[_0xb088('0x51')][_0xb088('0x48')]({'body':_0x142faa[_0xb088('0x27')][_0xb088('0x27')],'FaxAccountId':_0x142faa[_0xb088('0x39')]['id'],'FaxInteractionId':_0x234c60['id'],'direction':'in','ContactId':_0x234c60[_0xb088('0x52')],'AttachmentId':_0x142faa[_0xb088('0x27')]['AttachmentId']});})[_0xb088('0xf')](function(_0x4eefa9){_0x5dc663['message']=_0x4eefa9;if(_0x5dc663[_0xb088('0x50')][_0xb088('0x53')]){return db[_0xb088('0x54')][_0xb088('0x38')]({'attributes':['id',_0xb088('0x55')],'where':{'id':_0x5dc663['interaction'][_0xb088('0x53')]}})['then'](function(_0xea0ee6){if(_0xea0ee6){_0x5dc663[_0xb088('0x40')][_0xb088('0x56')]({'id':0x0,'priority':0x0,'app':_0xb088('0x57'),'appdata':_0xea0ee6[_0xb088('0x55')]+','+(_0x5dc663[_0xb088('0x39')][_0xb088('0x58')]||0xa),'interval':_0xb088('0x4e')});}return respondWithRpcPromise(_0xb088('0x59'),'startRouting',_0x5dc663);});}return respondWithRpcPromise(_0xb088('0x59'),_0xb088('0x5a'),_0x5dc663);})[_0xb088('0xf')](function(_0x3ab6d9){_0x9d3d6d(_0x3ab6d9);})[_0xb088('0x25')](function(_0x54ad8c){_0x287765(_0x336f96['error'](0x1f4,_0x54ad8c[_0xb088('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9d54260..a4dc014 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 _0xeec3=['length','faxAccount:','./faxAccount.events','remove','update','removeListener','register'];(function(_0x1045c5,_0x1ad9c7){var _0x3d1dd5=function(_0x12f21c){while(--_0x12f21c){_0x1045c5['push'](_0x1045c5['shift']());}};_0x3d1dd5(++_0x1ad9c7);}(_0xeec3,0xbf));var _0x3eec=function(_0x5b657f,_0x4cd9e8){_0x5b657f=_0x5b657f-0x0;var _0x219a3b=_0xeec3[_0x5b657f];return _0x219a3b;};'use strict';var FaxAccountEvents=require(_0x3eec('0x0'));var events=['save',_0x3eec('0x1'),_0x3eec('0x2')];function createListener(_0xade9c6,_0x1087ce){return function(_0x3a2156){_0x1087ce['emit'](_0xade9c6,_0x3a2156);};}function removeListener(_0x44f73e,_0x3f5414){return function(){FaxAccountEvents[_0x3eec('0x3')](_0x44f73e,_0x3f5414);};}exports[_0x3eec('0x4')]=function(_0x3dbf7b){for(var _0x59fde7=0x0,_0x7e904c=events[_0x3eec('0x5')];_0x59fde7<_0x7e904c;_0x59fde7++){var _0x311d2b=events[_0x59fde7];var _0x5c160b=createListener(_0x3eec('0x6')+_0x311d2b,_0x3dbf7b);FaxAccountEvents['on'](_0x311d2b,_0x5c160b);}}; \ No newline at end of file +var _0xaa4d=['register','length','faxAccount:','./faxAccount.events','save','emit','removeListener'];(function(_0xd8768,_0x3fedcb){var _0x46228f=function(_0x65a836){while(--_0x65a836){_0xd8768['push'](_0xd8768['shift']());}};_0x46228f(++_0x3fedcb);}(_0xaa4d,0x1a0));var _0xdaa4=function(_0x163cba,_0x3b18d7){_0x163cba=_0x163cba-0x0;var _0x44f96c=_0xaa4d[_0x163cba];return _0x44f96c;};'use strict';var FaxAccountEvents=require(_0xdaa4('0x0'));var events=[_0xdaa4('0x1'),'remove','update'];function createListener(_0x1b575a,_0x1e7fe0){return function(_0x2ef971){_0x1e7fe0[_0xdaa4('0x2')](_0x1b575a,_0x2ef971);};}function removeListener(_0xea9159,_0x4044fa){return function(){FaxAccountEvents[_0xdaa4('0x3')](_0xea9159,_0x4044fa);};}exports[_0xdaa4('0x4')]=function(_0x4bdeb2){for(var _0x30343f=0x0,_0xb61173=events[_0xdaa4('0x5')];_0x30343f<_0xb61173;_0x30343f++){var _0x18f841=events[_0x30343f];var _0x57663f=createListener(_0xdaa4('0x6')+_0x18f841,_0x4bdeb2);FaxAccountEvents['on'](_0x18f841,_0x57663f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 18ac033..a57904d 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(_0x17d7a1,_0x21bdb4){var _0x496dcd=function(_0x4feec2){while(--_0x4feec2){_0x17d7a1['push'](_0x17d7a1['shift']());}};_0x496dcd(++_0x21bdb4);}(_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['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(_0x2ca993,_0x3ddc39){var _0x53c205=function(_0x41fa25){while(--_0x41fa25){_0x2ca993['push'](_0x2ca993['shift']());}};_0x53c205(++_0x3ddc39);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('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 5f0e62f..bdcc4e3 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 _0x49eb=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x49eb,0x110));var _0xb49e=function(_0x11b8f4,_0x210f0a){_0x11b8f4=_0x11b8f4-0x0;var _0x30972c=_0x49eb[_0x11b8f4];return _0x30972c;};'use strict';var Sequelize=require(_0xb49e('0x0'));module[_0xb49e('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb49e('0x2')],'allowNull':![],'defaultValue':_0xb49e('0x3')},'appdata':{'type':Sequelize[_0xb49e('0x4')]()},'description':{'type':Sequelize[_0xb49e('0x2')]},'interval':{'type':Sequelize[_0xb49e('0x2')],'defaultValue':_0xb49e('0x5')}}; \ No newline at end of file +var _0x9afc=['noop','*,*,*,*','exports','INTEGER','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9afc,0x1d3));var _0xc9af=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0x9afc[_0x813d0a];return _0x241352;};'use strict';var Sequelize=require('sequelize');module[_0xc9af('0x0')]={'priority':{'type':Sequelize[_0xc9af('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc9af('0x2')],'allowNull':![],'defaultValue':_0xc9af('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xc9af('0x2')]},'interval':{'type':Sequelize[_0xc9af('0x2')],'defaultValue':_0xc9af('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 6d49655..2a56dcd 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 _0x7209=['where','merge','options','includeAll','include','FaxApplication','findAll','rows','catch','params','keys','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','reject','update','then','end','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','limit','order','sort','pick','filter'];(function(_0x52a862,_0x474c09){var _0x544829=function(_0x3188d7){while(--_0x3188d7){_0x52a862['push'](_0x52a862['shift']());}};_0x544829(++_0x474c09);}(_0x7209,0x133));var _0x9720=function(_0x444417,_0xc206bf){_0x444417=_0x444417-0x0;var _0x312285=_0x7209[_0x444417];return _0x312285;};'use strict';var emlformat=require(_0x9720('0x0'));var rimraf=require(_0x9720('0x1'));var zipdir=require(_0x9720('0x2'));var jsonpatch=require(_0x9720('0x3'));var rp=require(_0x9720('0x4'));var moment=require(_0x9720('0x5'));var BPromise=require(_0x9720('0x6'));var Mustache=require(_0x9720('0x7'));var util=require(_0x9720('0x8'));var path=require(_0x9720('0x9'));var sox=require(_0x9720('0xa'));var csv=require(_0x9720('0xb'));var ejs=require(_0x9720('0xc'));var fs=require('fs');var fs_extra=require(_0x9720('0xd'));var _=require(_0x9720('0xe'));var squel=require('squel');var crypto=require(_0x9720('0xf'));var jsforce=require(_0x9720('0x10'));var deskjs=require(_0x9720('0x11'));var toCsv=require(_0x9720('0xb'));var querystring=require('querystring');var Papa=require(_0x9720('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9720('0x13'));var as=require(_0x9720('0x14'));var hardwareService=require(_0x9720('0x15'));var logger=require(_0x9720('0x16'))(_0x9720('0x17'));var utils=require(_0x9720('0x18'));var config=require(_0x9720('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9720('0x1a'))['db'];function respondWithStatusCode(_0x223805,_0x307e31){_0x307e31=_0x307e31||0xcc;return function(_0x30a8be){if(_0x30a8be){return _0x223805[_0x9720('0x1b')](_0x307e31);}return _0x223805[_0x9720('0x1c')](_0x307e31)['end']();};}function respondWithResult(_0x5ecc09,_0x30aca5){_0x30aca5=_0x30aca5||0xc8;return function(_0x5de77c){if(_0x5de77c){return _0x5ecc09[_0x9720('0x1c')](_0x30aca5)[_0x9720('0x1d')](_0x5de77c);}};}function respondWithFilteredResult(_0x1c3d21,_0x366eb4){return function(_0x258c43){if(_0x258c43){var _0x2046c5=typeof _0x366eb4[_0x9720('0x1e')]==='undefined'&&typeof _0x366eb4['limit']===_0x9720('0x1f');var _0x3a93a0=_0x258c43[_0x9720('0x20')];var _0x1da63b=_0x2046c5?0x0:_0x366eb4['offset'];var _0x299f9f=_0x2046c5?_0x258c43['count']:_0x366eb4[_0x9720('0x1e')]+_0x366eb4['limit'];var _0x2bf3a1;if(_0x299f9f>=_0x3a93a0){_0x299f9f=_0x3a93a0;_0x2bf3a1=0xc8;}else{_0x2bf3a1=0xce;}_0x1c3d21[_0x9720('0x1c')](_0x2bf3a1);return _0x1c3d21[_0x9720('0x21')]('Content-Range',_0x1da63b+'-'+_0x299f9f+'/'+_0x3a93a0)[_0x9720('0x1d')](_0x258c43);}return null;};}function patchUpdates(_0xe6cba6){return function(_0x1f11ff){try{jsonpatch['apply'](_0x1f11ff,_0xe6cba6,!![]);}catch(_0x1ab27e){return BPromise[_0x9720('0x22')](_0x1ab27e);}return _0x1f11ff['save']();};}function saveUpdates(_0x365ec8,_0x248775){return function(_0x2a0c33){if(_0x2a0c33){return _0x2a0c33[_0x9720('0x23')](_0x365ec8)[_0x9720('0x24')](function(_0x53a199){return _0x53a199;});}return null;};}function removeEntity(_0x3147fd,_0x4ef539){return function(_0x3286d2){if(_0x3286d2){return _0x3286d2['destroy']()['then'](function(){_0x3147fd[_0x9720('0x1c')](0xcc)[_0x9720('0x25')]();});}};}function handleEntityNotFound(_0x49790c,_0x5bf7a7){return function(_0x38d185){if(!_0x38d185){_0x49790c[_0x9720('0x1b')](0x194);}return _0x38d185;};}function handleError(_0x35f5b5,_0x1d37ff){_0x1d37ff=_0x1d37ff||0x1f4;return function(_0x50f44b){logger[_0x9720('0x26')](_0x50f44b['stack']);if(_0x50f44b[_0x9720('0x27')]){delete _0x50f44b[_0x9720('0x27')];}_0x35f5b5['status'](_0x1d37ff)[_0x9720('0x28')](_0x50f44b);};}exports['index']=function(_0x16bbb7,_0x2a85c5){var _0x1f5b3d={},_0x5572fd={},_0x2ab98c={'count':0x0,'rows':[]};var _0x555588=_[_0x9720('0x29')](db['FaxApplication'][_0x9720('0x2a')],function(_0x1ccf8f){return{'name':_0x1ccf8f[_0x9720('0x2b')],'type':_0x1ccf8f[_0x9720('0x2c')][_0x9720('0x2d')]};});_0x5572fd[_0x9720('0x2e')]=_[_0x9720('0x29')](_0x555588,_0x9720('0x27'));_0x5572fd[_0x9720('0x2f')]=_['keys'](_0x16bbb7['query']);_0x5572fd[_0x9720('0x30')]=_[_0x9720('0x31')](_0x5572fd[_0x9720('0x2e')],_0x5572fd[_0x9720('0x2f')]);_0x1f5b3d[_0x9720('0x32')]=_[_0x9720('0x31')](_0x5572fd[_0x9720('0x2e')],qs[_0x9720('0x33')](_0x16bbb7['query'][_0x9720('0x33')]));_0x1f5b3d[_0x9720('0x32')]=_0x1f5b3d[_0x9720('0x32')][_0x9720('0x34')]?_0x1f5b3d['attributes']:_0x5572fd[_0x9720('0x2e')];if(!_0x16bbb7['query']['hasOwnProperty']('nolimit')){_0x1f5b3d[_0x9720('0x35')]=qs['limit'](_0x16bbb7[_0x9720('0x2f')][_0x9720('0x35')]);_0x1f5b3d[_0x9720('0x1e')]=qs[_0x9720('0x1e')](_0x16bbb7[_0x9720('0x2f')][_0x9720('0x1e')]);}_0x1f5b3d[_0x9720('0x36')]=qs[_0x9720('0x37')](_0x16bbb7[_0x9720('0x2f')][_0x9720('0x37')]);_0x1f5b3d['where']=qs[_0x9720('0x30')](_[_0x9720('0x38')](_0x16bbb7[_0x9720('0x2f')],_0x5572fd[_0x9720('0x30')]),_0x555588);if(_0x16bbb7[_0x9720('0x2f')][_0x9720('0x39')]){_0x1f5b3d[_0x9720('0x3a')]=_[_0x9720('0x3b')](_0x1f5b3d[_0x9720('0x3a')],{'$or':_[_0x9720('0x29')](_0x555588,function(_0x5e76bf){if(_0x5e76bf[_0x9720('0x2c')]!=='VIRTUAL'){var _0x228083={};_0x228083[_0x5e76bf[_0x9720('0x27')]]={'$like':'%'+_0x16bbb7[_0x9720('0x2f')][_0x9720('0x39')]+'%'};return _0x228083;}})});}_0x1f5b3d=_[_0x9720('0x3b')]({},_0x1f5b3d,_0x16bbb7[_0x9720('0x3c')]);var _0x5c1da8={'where':_0x1f5b3d[_0x9720('0x3a')]};return db['FaxApplication'][_0x9720('0x20')](_0x5c1da8)[_0x9720('0x24')](function(_0x5ea911){_0x2ab98c[_0x9720('0x20')]=_0x5ea911;if(_0x16bbb7[_0x9720('0x2f')][_0x9720('0x3d')]){_0x1f5b3d[_0x9720('0x3e')]=[{'all':!![]}];}return db[_0x9720('0x3f')][_0x9720('0x40')](_0x1f5b3d);})['then'](function(_0x1c874b){_0x2ab98c[_0x9720('0x41')]=_0x1c874b;return _0x2ab98c;})['then'](respondWithFilteredResult(_0x2a85c5,_0x1f5b3d))[_0x9720('0x42')](handleError(_0x2a85c5,null));};exports['show']=function(_0x19a6b3,_0x222b8b){var _0x5483f7={'raw':!![],'where':{'id':_0x19a6b3[_0x9720('0x43')]['id']}},_0x3ee221={};_0x3ee221['model']=_['keys'](db[_0x9720('0x3f')][_0x9720('0x2a')]);_0x3ee221[_0x9720('0x2f')]=_[_0x9720('0x44')](_0x19a6b3[_0x9720('0x2f')]);_0x3ee221[_0x9720('0x30')]=_[_0x9720('0x31')](_0x3ee221['model'],_0x3ee221[_0x9720('0x2f')]);_0x5483f7['attributes']=_[_0x9720('0x31')](_0x3ee221[_0x9720('0x2e')],qs[_0x9720('0x33')](_0x19a6b3['query'][_0x9720('0x33')]));_0x5483f7[_0x9720('0x32')]=_0x5483f7[_0x9720('0x32')]['length']?_0x5483f7[_0x9720('0x32')]:_0x3ee221[_0x9720('0x2e')];if(_0x19a6b3[_0x9720('0x2f')][_0x9720('0x3d')]){_0x5483f7[_0x9720('0x3e')]=[{'all':!![]}];}_0x5483f7=_[_0x9720('0x3b')]({},_0x5483f7,_0x19a6b3[_0x9720('0x3c')]);return db[_0x9720('0x3f')][_0x9720('0x45')](_0x5483f7)[_0x9720('0x24')](handleEntityNotFound(_0x222b8b,null))[_0x9720('0x24')](respondWithResult(_0x222b8b,null))[_0x9720('0x42')](handleError(_0x222b8b,null));};exports[_0x9720('0x46')]=function(_0x46c21b,_0x56592c){return db['FaxApplication'][_0x9720('0x46')](_0x46c21b['body'],{})[_0x9720('0x24')](respondWithResult(_0x56592c,0xc9))[_0x9720('0x42')](handleError(_0x56592c,null));};exports[_0x9720('0x23')]=function(_0x29bad0,_0xb02e04){if(_0x29bad0[_0x9720('0x47')]['id']){delete _0x29bad0[_0x9720('0x47')]['id'];}return db[_0x9720('0x3f')][_0x9720('0x45')]({'where':{'id':_0x29bad0[_0x9720('0x43')]['id']}})[_0x9720('0x24')](handleEntityNotFound(_0xb02e04,null))[_0x9720('0x24')](saveUpdates(_0x29bad0[_0x9720('0x47')],null))['then'](respondWithResult(_0xb02e04,null))[_0x9720('0x42')](handleError(_0xb02e04,null));};exports[_0x9720('0x48')]=function(_0x432bc7,_0x24222a){return db[_0x9720('0x3f')][_0x9720('0x45')]({'where':{'id':_0x432bc7[_0x9720('0x43')]['id']}})[_0x9720('0x24')](handleEntityNotFound(_0x24222a,null))[_0x9720('0x24')](removeEntity(_0x24222a,null))[_0x9720('0x42')](handleError(_0x24222a,null));}; \ No newline at end of file +var _0x0200=['../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x3f00a6,_0x3c596b){var _0x286ef0=function(_0x2d9e02){while(--_0x2d9e02){_0x3f00a6['push'](_0x3f00a6['shift']());}};_0x286ef0(++_0x3c596b);}(_0x0200,0x110));var _0x0020=function(_0xcfeff4,_0x3f2e19){_0xcfeff4=_0xcfeff4-0x0;var _0xb2fadc=_0x0200[_0xcfeff4];return _0xb2fadc;};'use strict';var emlformat=require(_0x0020('0x0'));var rimraf=require(_0x0020('0x1'));var zipdir=require(_0x0020('0x2'));var jsonpatch=require(_0x0020('0x3'));var rp=require(_0x0020('0x4'));var moment=require('moment');var BPromise=require(_0x0020('0x5'));var Mustache=require(_0x0020('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0020('0x7'));var ejs=require(_0x0020('0x8'));var fs=require('fs');var fs_extra=require(_0x0020('0x9'));var _=require(_0x0020('0xa'));var squel=require(_0x0020('0xb'));var crypto=require(_0x0020('0xc'));var jsforce=require(_0x0020('0xd'));var deskjs=require(_0x0020('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0020('0xf'));var Papa=require(_0x0020('0x10'));var Redis=require(_0x0020('0x11'));var authService=require(_0x0020('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0020('0x13'));var logger=require(_0x0020('0x14'))('api');var utils=require(_0x0020('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0020('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d21f3,_0x411347){_0x411347=_0x411347||0xcc;return function(_0x1f7c51){if(_0x1f7c51){return _0x3d21f3[_0x0020('0x17')](_0x411347);}return _0x3d21f3['status'](_0x411347)[_0x0020('0x18')]();};}function respondWithResult(_0x43992a,_0x1572ff){_0x1572ff=_0x1572ff||0xc8;return function(_0x45fe5e){if(_0x45fe5e){return _0x43992a[_0x0020('0x19')](_0x1572ff)[_0x0020('0x1a')](_0x45fe5e);}};}function respondWithFilteredResult(_0x21cb05,_0x17240b){return function(_0x12fc48){if(_0x12fc48){var _0x31a85e=typeof _0x17240b['offset']===_0x0020('0x1b')&&typeof _0x17240b[_0x0020('0x1c')]===_0x0020('0x1b');var _0x27bd9d=_0x12fc48[_0x0020('0x1d')];var _0x51c610=_0x31a85e?0x0:_0x17240b[_0x0020('0x1e')];var _0x49a056=_0x31a85e?_0x12fc48['count']:_0x17240b[_0x0020('0x1e')]+_0x17240b[_0x0020('0x1c')];var _0x53aa7c;if(_0x49a056>=_0x27bd9d){_0x49a056=_0x27bd9d;_0x53aa7c=0xc8;}else{_0x53aa7c=0xce;}_0x21cb05[_0x0020('0x19')](_0x53aa7c);return _0x21cb05[_0x0020('0x1f')]('Content-Range',_0x51c610+'-'+_0x49a056+'/'+_0x27bd9d)[_0x0020('0x1a')](_0x12fc48);}return null;};}function patchUpdates(_0x1f3900){return function(_0x406f1d){try{jsonpatch[_0x0020('0x20')](_0x406f1d,_0x1f3900,!![]);}catch(_0x32124a){return BPromise[_0x0020('0x21')](_0x32124a);}return _0x406f1d[_0x0020('0x22')]();};}function saveUpdates(_0x3c4606,_0x2f2449){return function(_0x327b26){if(_0x327b26){return _0x327b26[_0x0020('0x23')](_0x3c4606)['then'](function(_0x143379){return _0x143379;});}return null;};}function removeEntity(_0x203ad5,_0x498e93){return function(_0xd56be6){if(_0xd56be6){return _0xd56be6['destroy']()[_0x0020('0x24')](function(){_0x203ad5[_0x0020('0x19')](0xcc)[_0x0020('0x18')]();});}};}function handleEntityNotFound(_0x3796b1,_0x66226){return function(_0x586b43){if(!_0x586b43){_0x3796b1[_0x0020('0x17')](0x194);}return _0x586b43;};}function handleError(_0x474342,_0x366b1f){_0x366b1f=_0x366b1f||0x1f4;return function(_0x563ed1){logger[_0x0020('0x25')](_0x563ed1[_0x0020('0x26')]);if(_0x563ed1[_0x0020('0x27')]){delete _0x563ed1[_0x0020('0x27')];}_0x474342['status'](_0x366b1f)[_0x0020('0x28')](_0x563ed1);};}exports[_0x0020('0x29')]=function(_0x4e3d06,_0xb7512f){var _0x4b0145={},_0xae45b2={},_0x33536b={'count':0x0,'rows':[]};var _0x1d9391=_[_0x0020('0x2a')](db[_0x0020('0x2b')][_0x0020('0x2c')],function(_0xd18e7b){return{'name':_0xd18e7b[_0x0020('0x2d')],'type':_0xd18e7b[_0x0020('0x2e')][_0x0020('0x2f')]};});_0xae45b2[_0x0020('0x30')]=_[_0x0020('0x2a')](_0x1d9391,_0x0020('0x27'));_0xae45b2[_0x0020('0x31')]=_['keys'](_0x4e3d06[_0x0020('0x31')]);_0xae45b2['filters']=_[_0x0020('0x32')](_0xae45b2[_0x0020('0x30')],_0xae45b2['query']);_0x4b0145[_0x0020('0x33')]=_[_0x0020('0x32')](_0xae45b2[_0x0020('0x30')],qs['fields'](_0x4e3d06[_0x0020('0x31')][_0x0020('0x34')]));_0x4b0145[_0x0020('0x33')]=_0x4b0145[_0x0020('0x33')][_0x0020('0x35')]?_0x4b0145[_0x0020('0x33')]:_0xae45b2[_0x0020('0x30')];if(!_0x4e3d06[_0x0020('0x31')][_0x0020('0x36')]('nolimit')){_0x4b0145[_0x0020('0x1c')]=qs[_0x0020('0x1c')](_0x4e3d06['query']['limit']);_0x4b0145[_0x0020('0x1e')]=qs[_0x0020('0x1e')](_0x4e3d06['query'][_0x0020('0x1e')]);}_0x4b0145['order']=qs[_0x0020('0x37')](_0x4e3d06[_0x0020('0x31')]['sort']);_0x4b0145[_0x0020('0x38')]=qs[_0x0020('0x39')](_[_0x0020('0x3a')](_0x4e3d06[_0x0020('0x31')],_0xae45b2[_0x0020('0x39')]),_0x1d9391);if(_0x4e3d06[_0x0020('0x31')][_0x0020('0x3b')]){_0x4b0145[_0x0020('0x38')]=_[_0x0020('0x3c')](_0x4b0145[_0x0020('0x38')],{'$or':_[_0x0020('0x2a')](_0x1d9391,function(_0x3967d6){if(_0x3967d6[_0x0020('0x2e')]!=='VIRTUAL'){var _0x1cc899={};_0x1cc899[_0x3967d6[_0x0020('0x27')]]={'$like':'%'+_0x4e3d06['query']['filter']+'%'};return _0x1cc899;}})});}_0x4b0145=_['merge']({},_0x4b0145,_0x4e3d06[_0x0020('0x3d')]);var _0x41b1f3={'where':_0x4b0145[_0x0020('0x38')]};return db[_0x0020('0x2b')][_0x0020('0x1d')](_0x41b1f3)['then'](function(_0x4d6e2d){_0x33536b[_0x0020('0x1d')]=_0x4d6e2d;if(_0x4e3d06[_0x0020('0x31')][_0x0020('0x3e')]){_0x4b0145[_0x0020('0x3f')]=[{'all':!![]}];}return db[_0x0020('0x2b')][_0x0020('0x40')](_0x4b0145);})[_0x0020('0x24')](function(_0x54f942){_0x33536b[_0x0020('0x41')]=_0x54f942;return _0x33536b;})[_0x0020('0x24')](respondWithFilteredResult(_0xb7512f,_0x4b0145))[_0x0020('0x42')](handleError(_0xb7512f,null));};exports[_0x0020('0x43')]=function(_0x2589ed,_0x435208){var _0xe52d83={'raw':!![],'where':{'id':_0x2589ed['params']['id']}},_0x363b1e={};_0x363b1e[_0x0020('0x30')]=_[_0x0020('0x44')](db[_0x0020('0x2b')][_0x0020('0x2c')]);_0x363b1e[_0x0020('0x31')]=_[_0x0020('0x44')](_0x2589ed[_0x0020('0x31')]);_0x363b1e[_0x0020('0x39')]=_[_0x0020('0x32')](_0x363b1e[_0x0020('0x30')],_0x363b1e['query']);_0xe52d83[_0x0020('0x33')]=_['intersection'](_0x363b1e[_0x0020('0x30')],qs['fields'](_0x2589ed[_0x0020('0x31')]['fields']));_0xe52d83['attributes']=_0xe52d83['attributes'][_0x0020('0x35')]?_0xe52d83[_0x0020('0x33')]:_0x363b1e['model'];if(_0x2589ed[_0x0020('0x31')]['includeAll']){_0xe52d83[_0x0020('0x3f')]=[{'all':!![]}];}_0xe52d83=_[_0x0020('0x3c')]({},_0xe52d83,_0x2589ed[_0x0020('0x3d')]);return db[_0x0020('0x2b')][_0x0020('0x45')](_0xe52d83)[_0x0020('0x24')](handleEntityNotFound(_0x435208,null))['then'](respondWithResult(_0x435208,null))[_0x0020('0x42')](handleError(_0x435208,null));};exports['create']=function(_0x315dc5,_0x3f24fe){return db[_0x0020('0x2b')][_0x0020('0x46')](_0x315dc5[_0x0020('0x47')],{})[_0x0020('0x24')](respondWithResult(_0x3f24fe,0xc9))[_0x0020('0x42')](handleError(_0x3f24fe,null));};exports['update']=function(_0x5d5a97,_0x4ad993){if(_0x5d5a97[_0x0020('0x47')]['id']){delete _0x5d5a97[_0x0020('0x47')]['id'];}return db[_0x0020('0x2b')][_0x0020('0x45')]({'where':{'id':_0x5d5a97[_0x0020('0x48')]['id']}})['then'](handleEntityNotFound(_0x4ad993,null))[_0x0020('0x24')](saveUpdates(_0x5d5a97['body'],null))[_0x0020('0x24')](respondWithResult(_0x4ad993,null))[_0x0020('0x42')](handleError(_0x4ad993,null));};exports['destroy']=function(_0x17f871,_0x3754a9){return db['FaxApplication'][_0x0020('0x45')]({'where':{'id':_0x17f871[_0x0020('0x48')]['id']}})[_0x0020('0x24')](handleEntityNotFound(_0x3754a9,null))[_0x0020('0x24')](removeEntity(_0x3754a9,null))[_0x0020('0x42')](handleError(_0x3754a9,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index d5ec9c0..a90b678 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 _0x408d=['define','fax_applications','utf8mb4','lodash','util','api','moment','bluebird','path','./faxApplication.attributes','exports'];(function(_0x18dc34,_0x205f71){var _0x4ab15b=function(_0x50572f){while(--_0x50572f){_0x18dc34['push'](_0x18dc34['shift']());}};_0x4ab15b(++_0x205f71);}(_0x408d,0x100));var _0xd408=function(_0xb119da,_0x42d325){_0xb119da=_0xb119da-0x0;var _0x3ecb48=_0x408d[_0xb119da];return _0x3ecb48;};'use strict';var _=require(_0xd408('0x0'));var util=require(_0xd408('0x1'));var logger=require('../../config/logger')(_0xd408('0x2'));var moment=require(_0xd408('0x3'));var BPromise=require(_0xd408('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd408('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd408('0x6'));module[_0xd408('0x7')]=function(_0x7d2e04,_0xbc6047){return _0x7d2e04[_0xd408('0x8')]('FaxApplication',attributes,{'tableName':_0xd408('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd408('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x003e=['api','moment','bluebird','request-promise','path','rimraf','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x1e5555,_0x42a83b){var _0x2f0c6b=function(_0x16252a){while(--_0x16252a){_0x1e5555['push'](_0x1e5555['shift']());}};_0x2f0c6b(++_0x42a83b);}(_0x003e,0x1cb));var _0xe003=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0x003e[_0x51639a];return _0x3abae4;};'use strict';var _=require(_0xe003('0x0'));var util=require(_0xe003('0x1'));var logger=require(_0xe003('0x2'))(_0xe003('0x3'));var moment=require(_0xe003('0x4'));var BPromise=require(_0xe003('0x5'));var rp=require(_0xe003('0x6'));var fs=require('fs');var path=require(_0xe003('0x7'));var rimraf=require(_0xe003('0x8'));var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module['exports']=function(_0x39a1e0,_0xf7c4f1){return _0x39a1e0[_0xe003('0x9')](_0xe003('0xa'),attributes,{'tableName':_0xe003('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe003('0xc'),'collate':_0xe003('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index f5818b4..84ca4e5 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 _0xc507=['jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxApplication','update','body','options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc507,0x73));var _0x7c50=function(_0xdbd4f7,_0x4e3bdd){_0xdbd4f7=_0xdbd4f7-0x0;var _0x5c3f9d=_0xc507[_0xdbd4f7];return _0x5c3f9d;};'use strict';var _=require(_0x7c50('0x0'));var util=require(_0x7c50('0x1'));var moment=require(_0x7c50('0x2'));var BPromise=require(_0x7c50('0x3'));var rs=require(_0x7c50('0x4'));var fs=require('fs');var Redis=require(_0x7c50('0x5'));var db=require(_0x7c50('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c50('0x7'))(_0x7c50('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c50('0x9'));var client=jayson[_0x7c50('0xa')][_0x7c50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2eda30,_0x1ace0d,_0x815f20){return new BPromise(function(_0x5efd32,_0x909310){return client[_0x7c50('0xc')](_0x2eda30,_0x815f20)[_0x7c50('0xd')](function(_0x1df00b){logger[_0x7c50('0xe')](_0x7c50('0xf'),_0x1ace0d,_0x7c50('0x10'));logger[_0x7c50('0x11')](_0x7c50('0x12'),_0x1ace0d,'request\x20sent',JSON[_0x7c50('0x13')](_0x1df00b));if(_0x1df00b[_0x7c50('0x14')]){if(_0x1df00b[_0x7c50('0x14')]['code']===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x1ace0d,_0x1df00b[_0x7c50('0x14')][_0x7c50('0x15')]);return _0x909310(_0x1df00b[_0x7c50('0x14')][_0x7c50('0x15')]);}logger[_0x7c50('0x14')]('FaxApplication,\x20%s,\x20%s',_0x1ace0d,_0x1df00b['error'][_0x7c50('0x15')]);return _0x5efd32(_0x1df00b['error']['message']);}else{logger[_0x7c50('0xe')](_0x7c50('0xf'),_0x1ace0d,_0x7c50('0x10'));_0x5efd32(_0x1df00b[_0x7c50('0x16')][_0x7c50('0x15')]);}})[_0x7c50('0x17')](function(_0x2515d7){logger[_0x7c50('0x14')](_0x7c50('0xf'),_0x1ace0d,_0x2515d7);_0x909310(_0x2515d7);});});}exports['UpdateFaxApplication']=function(_0x35ba1f){var _0x580f0d=this;return new Promise(function(_0x333adf,_0x4a9e1c){return db[_0x7c50('0x18')][_0x7c50('0x19')](_0x35ba1f[_0x7c50('0x1a')],{'raw':_0x35ba1f['options']?_0x35ba1f[_0x7c50('0x1b')][_0x7c50('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35ba1f[_0x7c50('0x1b')]?_0x35ba1f[_0x7c50('0x1b')][_0x7c50('0x1d')]||null:null,'attributes':_0x35ba1f[_0x7c50('0x1b')]?_0x35ba1f['options']['attributes']||null:null,'limit':_0x35ba1f[_0x7c50('0x1b')]?_0x35ba1f[_0x7c50('0x1b')][_0x7c50('0x1e')]||null:null})[_0x7c50('0xd')](function(_0x27ef1d){logger[_0x7c50('0xe')]('UpdateFaxApplication',_0x35ba1f);logger[_0x7c50('0x11')]('UpdateFaxApplication',_0x35ba1f,JSON['stringify'](_0x27ef1d));_0x333adf(_0x27ef1d);})['catch'](function(_0x348a13){logger[_0x7c50('0x14')]('UpdateFaxApplication',_0x348a13['message'],_0x35ba1f);_0x4a9e1c(_0x580f0d[_0x7c50('0x14')](0x1f4,_0x348a13[_0x7c50('0x15')]));});});}; \ No newline at end of file +var _0x3077=['update','options','raw','where','attributes','then','lodash','util','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x35f4f3,_0x5061f1){var _0x581075=function(_0x59681d){while(--_0x59681d){_0x35f4f3['push'](_0x35f4f3['shift']());}};_0x581075(++_0x5061f1);}(_0x3077,0xe6));var _0x7307=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3077[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7307('0x0'));var util=require(_0x7307('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7307('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7307('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7307('0x4'));var jayson=require(_0x7307('0x5'));var client=jayson[_0x7307('0x6')][_0x7307('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1443e4,_0x5e0bc9,_0x143b66){return new BPromise(function(_0x587332,_0x541ff1){return client[_0x7307('0x8')](_0x1443e4,_0x143b66)['then'](function(_0x14272d){logger[_0x7307('0x9')](_0x7307('0xa'),_0x5e0bc9,_0x7307('0xb'));logger[_0x7307('0xc')](_0x7307('0xd'),_0x5e0bc9,_0x7307('0xb'),JSON[_0x7307('0xe')](_0x14272d));if(_0x14272d[_0x7307('0xf')]){if(_0x14272d[_0x7307('0xf')][_0x7307('0x10')]===0x1f4){logger[_0x7307('0xf')]('FaxApplication,\x20%s,\x20%s',_0x5e0bc9,_0x14272d[_0x7307('0xf')][_0x7307('0x11')]);return _0x541ff1(_0x14272d[_0x7307('0xf')][_0x7307('0x11')]);}logger[_0x7307('0xf')](_0x7307('0xa'),_0x5e0bc9,_0x14272d[_0x7307('0xf')]['message']);return _0x587332(_0x14272d[_0x7307('0xf')][_0x7307('0x11')]);}else{logger[_0x7307('0x9')](_0x7307('0xa'),_0x5e0bc9,_0x7307('0xb'));_0x587332(_0x14272d[_0x7307('0x12')][_0x7307('0x11')]);}})[_0x7307('0x13')](function(_0x704702){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5e0bc9,_0x704702);_0x541ff1(_0x704702);});});}exports[_0x7307('0x14')]=function(_0x45a3eb){var _0x11f778=this;return new Promise(function(_0x3d4b4f,_0x4d20d6){return db[_0x7307('0x15')][_0x7307('0x16')](_0x45a3eb['body'],{'raw':_0x45a3eb[_0x7307('0x17')]?_0x45a3eb[_0x7307('0x17')][_0x7307('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45a3eb[_0x7307('0x17')]?_0x45a3eb[_0x7307('0x17')][_0x7307('0x19')]||null:null,'attributes':_0x45a3eb[_0x7307('0x17')]?_0x45a3eb['options'][_0x7307('0x1a')]||null:null,'limit':_0x45a3eb[_0x7307('0x17')]?_0x45a3eb[_0x7307('0x17')]['limit']||null:null})[_0x7307('0x1b')](function(_0x3b4a97){logger[_0x7307('0x9')](_0x7307('0x14'),_0x45a3eb);logger[_0x7307('0xc')](_0x7307('0x14'),_0x45a3eb,JSON[_0x7307('0xe')](_0x3b4a97));_0x3d4b4f(_0x3b4a97);})[_0x7307('0x13')](function(_0xd70cb1){logger[_0x7307('0xf')]('UpdateFaxApplication',_0xd70cb1[_0x7307('0x11')],_0x45a3eb);_0x4d20d6(_0x11f778['error'](0x1f4,_0xd70cb1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3dfacbe..e774b33 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 _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x17e6ab,_0x27519b){var _0x3b1aa7=function(_0x5bc0a3){while(--_0x5bc0a3){_0x17e6ab['push'](_0x17e6ab['shift']());}};_0x3b1aa7(++_0x27519b);}(_0x0598,0x92));var _0x8059=function(_0x3c2925,_0x34fe20){_0x3c2925=_0x3c2925-0x0;var _0x162045=_0x0598[_0x3c2925];return _0x162045;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file +var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x2a46b9,_0x1fefae){var _0x243516=function(_0x2e0cc2){while(--_0x2e0cc2){_0x2a46b9['push'](_0x2a46b9['shift']());}};_0x243516(++_0x1fefae);}(_0xa571,0x107));var _0x1a57=function(_0x4633ee,_0xc061fe){_0x4633ee=_0x4633ee-0x0;var _0x5c5ac0=_0xa571[_0x4633ee];return _0x5c5ac0;};'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('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index a27da1c..f28c255 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 _0x98c3=['ENUM','out','BOOLEAN','DATE','STRING'];(function(_0x10d87e,_0x40e1a9){var _0x388336=function(_0x4697cc){while(--_0x4697cc){_0x10d87e['push'](_0x10d87e['shift']());}};_0x388336(++_0x40e1a9);}(_0x98c3,0x1f1));var _0x398c=function(_0x31ed44,_0x2d17ce){_0x31ed44=_0x31ed44-0x0;var _0x55ec71=_0x98c3[_0x31ed44];return _0x55ec71;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x398c('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x398c('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x398c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x398c('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x398c('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x398c('0x3')]('in',_0x398c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x398c('0x3')]('in',_0x398c('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x66c9=['out','sequelize','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x38709f,_0x34ef70){var _0x3d5ee4=function(_0x2766d3){while(--_0x2766d3){_0x38709f['push'](_0x38709f['shift']());}};_0x3d5ee4(++_0x34ef70);}(_0x66c9,0x158));var _0x966c=function(_0x240349,_0x4e4da8){_0x240349=_0x240349-0x0;var _0x2d5e0a=_0x66c9[_0x240349];return _0x2d5e0a;};'use strict';var Sequelize=require(_0x966c('0x0'));module[_0x966c('0x1')]={'closed':{'type':Sequelize[_0x966c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x966c('0x3')]},'secondDisposition':{'type':Sequelize[_0x966c('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x966c('0x3')]},'read1stAt':{'type':Sequelize[_0x966c('0x4')]},'fax':{'type':Sequelize[_0x966c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x966c('0x5')]('in',_0x966c('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x966c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x966c('0x5')]('in',_0x966c('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index a7cba2b..64f05d1 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 _0x4fea=['role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','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.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','catch','show','keys','includeAll','include','options','create','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','merge','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','removeTags','download','join','root','server','files','attachments','Attachment','Messages','mkdirSync','basename','createWriteStream','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','reject','save','update','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','waiting','total','closed','UserId','talking','answered','index','FaxInteraction','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','user_has_fax_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','t.id\x20=\x20it.TagId','search','conditions','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','buildExpression','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user'];(function(_0x399ed6,_0x447989){var _0x28ca48=function(_0x340a38){while(--_0x340a38){_0x399ed6['push'](_0x399ed6['shift']());}};_0x28ca48(++_0x447989);}(_0x4fea,0x1f1));var _0xa4fe=function(_0x54b859,_0x50a222){_0x54b859=_0x54b859-0x0;var _0x370ed0=_0x4fea[_0x54b859];return _0x370ed0;};'use strict';var emlformat=require(_0xa4fe('0x0'));var rimraf=require(_0xa4fe('0x1'));var zipdir=require(_0xa4fe('0x2'));var jsonpatch=require(_0xa4fe('0x3'));var rp=require(_0xa4fe('0x4'));var moment=require(_0xa4fe('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa4fe('0x6'));var sox=require(_0xa4fe('0x7'));var csv=require(_0xa4fe('0x8'));var ejs=require(_0xa4fe('0x9'));var fs=require('fs');var fs_extra=require(_0xa4fe('0xa'));var _=require(_0xa4fe('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa4fe('0xc'));var deskjs=require(_0xa4fe('0xd'));var toCsv=require(_0xa4fe('0x8'));var querystring=require(_0xa4fe('0xe'));var Papa=require(_0xa4fe('0xf'));var Redis=require(_0xa4fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa4fe('0x11'));var as=require(_0xa4fe('0x12'));var hardwareService=require(_0xa4fe('0x13'));var logger=require(_0xa4fe('0x14'))(_0xa4fe('0x15'));var utils=require('../../config/utils');var config=require(_0xa4fe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa4fe('0x17'))['db'];config['redis']=_[_0xa4fe('0x18')](config[_0xa4fe('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa4fe('0x1a'))(new Redis(config[_0xa4fe('0x19')]));require('./faxInteraction.socket')[_0xa4fe('0x1b')](socket);function respondWithStatusCode(_0x263f8f,_0xe2cd7b){_0xe2cd7b=_0xe2cd7b||0xcc;return function(_0x3b6d96){if(_0x3b6d96){return _0x263f8f['sendStatus'](_0xe2cd7b);}return _0x263f8f[_0xa4fe('0x1c')](_0xe2cd7b)[_0xa4fe('0x1d')]();};}function respondWithResult(_0x22225d,_0x2c82ec){_0x2c82ec=_0x2c82ec||0xc8;return function(_0x224b8a){if(_0x224b8a){return _0x22225d[_0xa4fe('0x1c')](_0x2c82ec)[_0xa4fe('0x1e')](_0x224b8a);}};}function respondWithFilteredResult(_0x28ad23,_0x4971dc){return function(_0x11ed3e){if(_0x11ed3e){var _0x23fea3=typeof _0x4971dc[_0xa4fe('0x1f')]==='undefined'&&typeof _0x4971dc[_0xa4fe('0x20')]===_0xa4fe('0x21');var _0x3093de=_0x11ed3e[_0xa4fe('0x22')];var _0x41b55e=_0x23fea3?0x0:_0x4971dc['offset'];var _0x43067a=_0x23fea3?_0x11ed3e[_0xa4fe('0x22')]:_0x4971dc[_0xa4fe('0x1f')]+_0x4971dc[_0xa4fe('0x20')];var _0x456db8;if(_0x43067a>=_0x3093de){_0x43067a=_0x3093de;_0x456db8=0xc8;}else{_0x456db8=0xce;}_0x28ad23[_0xa4fe('0x1c')](_0x456db8);return _0x28ad23['set']('Content-Range',_0x41b55e+'-'+_0x43067a+'/'+_0x3093de)[_0xa4fe('0x1e')](_0x11ed3e);}return null;};}function patchUpdates(_0x135049){return function(_0x4b79af){try{jsonpatch['apply'](_0x4b79af,_0x135049,!![]);}catch(_0xdd9f7c){return BPromise[_0xa4fe('0x23')](_0xdd9f7c);}return _0x4b79af[_0xa4fe('0x24')]();};}function saveUpdates(_0x3455c6,_0x4bda99){return function(_0x74e84b){if(_0x74e84b){return _0x74e84b[_0xa4fe('0x25')](_0x3455c6)[_0xa4fe('0x26')](function(_0x48d248){return _0x48d248;});}return null;};}function removeEntity(_0xbe7800,_0x5e4a95){return function(_0x5e879a){if(_0x5e879a){return _0x5e879a[_0xa4fe('0x27')]()['then'](function(){_0xbe7800[_0xa4fe('0x1c')](0xcc)[_0xa4fe('0x1d')]();});}};}function handleEntityNotFound(_0x2f4b99,_0x3f666f){return function(_0xd09701){if(!_0xd09701){_0x2f4b99[_0xa4fe('0x28')](0x194);}return _0xd09701;};}function handleError(_0x59c90c,_0xeab867){_0xeab867=_0xeab867||0x1f4;return function(_0x2d2496){logger[_0xa4fe('0x29')](_0x2d2496[_0xa4fe('0x2a')]);if(_0x2d2496[_0xa4fe('0x2b')]){delete _0x2d2496[_0xa4fe('0x2b')];}_0x59c90c[_0xa4fe('0x1c')](_0xeab867)[_0xa4fe('0x2c')](_0x2d2496);};}function getInteractionUsers(_0x9de624,_0x491f60){return new BPromise(function(_0x1f0b08,_0x39646c){try{if(_0x491f60[_0x9de624['id']]){_0x9de624[_0xa4fe('0x2d')]=_[_0xa4fe('0x2e')](_0x491f60[_0x9de624['id']],function(_0x559bdf){return{'id':_0x559bdf['id'],'fullname':_0x559bdf[_0xa4fe('0x2f')]};});}}catch(_0x1486e4){_0x39646c(_0x1486e4);}_0x1f0b08(_0x9de624);});}function getInteractionTags(_0x6eb725,_0x5363ad){return new BPromise(function(_0x53f7de,_0x5a3b86){try{if(_0x6eb725[_0xa4fe('0x30')]){_0x6eb725['Tags']=[];_0x6eb725['TagIds'][_0xa4fe('0x31')](',')[_0xa4fe('0x32')](function(_0x2b0c14){_0x6eb725[_0xa4fe('0x33')][_0xa4fe('0x34')](_0x5363ad[_0x2b0c14]);});}delete _0x6eb725['TagIds'];}catch(_0x48f9a3){_0x5a3b86(_0x48f9a3);}_0x53f7de(_0x6eb725);});}function updateFaxInteraction(_0xa1814d,_0x2d4d8d,_0x182eae){return new BPromise(function(_0x36ce09,_0x9b0528){return getInteractionUsers(_0xa1814d,_0x182eae)['then'](function(_0x500b20){return getInteractionTags(_0x500b20,_0x2d4d8d);})[_0xa4fe('0x26')](function(_0x22dd4b){return getStateInteraction(_0x22dd4b);})[_0xa4fe('0x26')](function(_0x1642a3){_0x36ce09(_0x1642a3);})['catch'](function(_0x5cd2ab){_0x9b0528(_0x5cd2ab);});});}function getStateInteraction(_0xaf6ed9){return new BPromise(function(_0x59d254){_0xaf6ed9[_0xa4fe('0x35')]=0x0;_0xaf6ed9['talking']=0x0;_0xaf6ed9['answered']=0x0;_0xaf6ed9['unmanaged']=0x0;_0xaf6ed9[_0xa4fe('0x36')]=0x0;if(!_0xaf6ed9[_0xa4fe('0x37')]&&!_0xaf6ed9[_0xa4fe('0x38')]){_0xaf6ed9[_0xa4fe('0x35')]+=0x1;}if(!_0xaf6ed9['closed']&&_0xaf6ed9[_0xa4fe('0x38')]){_0xaf6ed9[_0xa4fe('0x39')]+=0x1;if(_0xaf6ed9[_0xa4fe('0x35')]){_0xaf6ed9[_0xa4fe('0x35')]-=0x1;}}if(_0xaf6ed9[_0xa4fe('0x37')]&&_0xaf6ed9[_0xa4fe('0x38')]){_0xaf6ed9[_0xa4fe('0x3a')]+=0x1;if(_0xaf6ed9[_0xa4fe('0x39')]){_0xaf6ed9['talking']-=0x1;}}if(_0xaf6ed9[_0xa4fe('0x37')]&&!_0xaf6ed9[_0xa4fe('0x38')]){_0xaf6ed9['unmanaged']+=0x1;if(_0xaf6ed9[_0xa4fe('0x35')]){_0xaf6ed9['waiting']-=0x1;}}_0xaf6ed9[_0xa4fe('0x36')]+=0x1;_0x59d254(_0xaf6ed9);});}exports[_0xa4fe('0x3b')]=function(_0x1b64a4,_0x4fbc1e){var _0x3ede09={},_0x3588db={},_0x541f7d={'count':0x0,'rows':[]};var _0xa93540=_[_0xa4fe('0x2e')](db[_0xa4fe('0x3c')][_0xa4fe('0x3d')],function(_0x4b4fdf){return{'name':_0x4b4fdf['fieldName'],'type':_0x4b4fdf[_0xa4fe('0x3e')][_0xa4fe('0x3f')]};});_0x3588db['model']=_['map'](_0xa93540,'name');_0x3588db['query']=_['keys'](_0x1b64a4[_0xa4fe('0x40')]);_0x3588db[_0xa4fe('0x41')]=_[_0xa4fe('0x42')](_0x3588db[_0xa4fe('0x43')],_0x3588db[_0xa4fe('0x40')]);_0x3ede09[_0xa4fe('0x44')]=_[_0xa4fe('0x42')](_0x3588db[_0xa4fe('0x43')],qs['fields'](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x45')]));_0x3ede09[_0xa4fe('0x44')]=_0x3ede09['attributes'][_0xa4fe('0x46')]?_0x3ede09[_0xa4fe('0x44')]:_0x3588db[_0xa4fe('0x43')];if(!_0x1b64a4['query'][_0xa4fe('0x47')]('nolimit')){_0x3ede09[_0xa4fe('0x20')]=qs[_0xa4fe('0x20')](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x20')]);_0x3ede09['offset']=qs[_0xa4fe('0x1f')](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x1f')]);}_0x3ede09['order']=qs[_0xa4fe('0x48')](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x48')]);_0x3ede09[_0xa4fe('0x49')]=qs[_0xa4fe('0x41')](_[_0xa4fe('0x4a')](_0x1b64a4[_0xa4fe('0x40')],_0x3588db[_0xa4fe('0x41')]),_0xa93540);var _0x115006=[];var _0x8c162b=squel[_0xa4fe('0x4b')]()['field']('id')['field']('name')[_0xa4fe('0x4c')](_0xa4fe('0x4d'))[_0xa4fe('0x4e')](_0xa4fe('0x4f'));var _0x15849d=squel['select']()[_0xa4fe('0x4c')](_0xa4fe('0x50'))['field']('u.fullname')[_0xa4fe('0x4c')](_0xa4fe('0x51'))['from'](_0xa4fe('0x52'),'ui')['left_join'](_0xa4fe('0x53'),'u',_0xa4fe('0x54'));var _0x12d249=squel[_0xa4fe('0x4b')]()[_0xa4fe('0x4e')]('fax_interactions','i')[_0xa4fe('0x55')](_0xa4fe('0x56'),'c',_0xa4fe('0x57'))['left_join'](_0xa4fe('0x53'),'o',_0xa4fe('0x58'))[_0xa4fe('0x55')](_0xa4fe('0x59'),'a',_0xa4fe('0x5a'))[_0xa4fe('0x55')](_0xa4fe('0x5b'),'me',_0xa4fe('0x5c'))[_0xa4fe('0x55')](_0xa4fe('0x5d'),'it','it.FaxInteractionId\x20=\x20i.id')['left_join']('tools_tags','t',_0xa4fe('0x5e'));var _0x46c2b9=squel['expr']();var _0x56e292=[];var _0x11e79a=squel['expr']();var _0xac2c5;if(_0x1b64a4[_0xa4fe('0x40')]['search']){_0xac2c5=as['parseSearch'](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x5f')]);var _0x38355e=_0xac2c5['sqlOperator'];for(var _0x8c354d=0x0;_0x8c354d<_0xac2c5[_0xa4fe('0x60')][_0xa4fe('0x46')];_0x8c354d++){var _0x2557b7=_0xac2c5[_0xa4fe('0x60')][_0x8c354d];var _0x895ca8='i';var _0x59ebec=_['find'](_0xa93540,[_0xa4fe('0x2b'),_0x2557b7[_0xa4fe('0x4c')]]);if(!_0x59ebec){switch(_0x2557b7[_0xa4fe('0x4c')]){case _0xa4fe('0x61'):if(_0x2557b7[_0xa4fe('0x62')]==0x1){_0x12d249[_0xa4fe('0x63')]('`'+_0x2557b7['field']+'`\x20=\x200');}else{_0x12d249[_0xa4fe('0x63')]('`'+_0x2557b7[_0xa4fe('0x4c')]+_0xa4fe('0x64'));}break;case _0xa4fe('0x65'):if(_0x2557b7[_0xa4fe('0x66')]===_0xa4fe('0x67')){if(_0x2557b7[_0xa4fe('0x62')][_0xa4fe('0x31')]('\x20')['length']>0x1){_0x46c2b9[_0x38355e](_0xa4fe('0x68'),qs[_0xa4fe('0x69')](_0x2557b7['value']),null);}else{var _0xf5b596='%'+_0x2557b7[_0xa4fe('0x62')]+'%';_0x46c2b9[_0x38355e](_0xa4fe('0x6a'),_0xf5b596,_0xf5b596,_0xf5b596);}}else{_0x59ebec=_[_0xa4fe('0x6b')](_0xa93540,[_0xa4fe('0x2b'),_0xa4fe('0x6c')]);_0x2557b7['field']=_0xa4fe('0x6c');_0x258b1d=as['buildExpression'](_0x895ca8,_0x59ebec[_0xa4fe('0x3e')],_0x2557b7);_0x46c2b9[_0x38355e](_0x258b1d[_0xa4fe('0x6d')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x6e')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x1d')]);}break;case _0xa4fe('0x6f'):var _0x5bc058=_0x2557b7[_0xa4fe('0x62')]['split'](',')[_0xa4fe('0x2e')](function(_0x353892){return Number(_0x353892);});_0x5bc058[_0xa4fe('0x32')](function(_0x4db1a0){_0x11e79a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4db1a0+',%');});_0x56e292=_[_0xa4fe('0x70')](_0x56e292,_0x5bc058);break;case _0xa4fe('0x71'):if(_0x2557b7[_0xa4fe('0x66')]===_0xa4fe('0x67')){_0x46c2b9[_0x38355e](_0xa4fe('0x72'),'%'+_0x2557b7[_0xa4fe('0x62')]+'%',null);}else{_0x59ebec=_[_0xa4fe('0x6b')](_0xa93540,[_0xa4fe('0x2b'),_0xa4fe('0x38')]);_0x2557b7[_0xa4fe('0x4c')]=_0xa4fe('0x38');_0x258b1d=as['buildExpression'](_0x895ca8,_0x59ebec[_0xa4fe('0x3e')],_0x2557b7);_0x46c2b9[_0x38355e](_0x258b1d[_0xa4fe('0x6d')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x6e')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x1d')]);}break;case _0xa4fe('0x73'):_0x258b1d=as[_0xa4fe('0x74')]('me',null,_0x2557b7);_0x46c2b9[_0x38355e](_0x258b1d[_0xa4fe('0x6d')],_0x258b1d[_0xa4fe('0x62')]['start'],_0x258b1d[_0xa4fe('0x62')]['end']);break;}}else{var _0x258b1d=as[_0xa4fe('0x74')](_0x895ca8,_0x59ebec[_0xa4fe('0x3e')],_0x2557b7);_0x46c2b9[_0x38355e](_0x258b1d[_0xa4fe('0x6d')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x6e')],_0x258b1d[_0xa4fe('0x62')][_0xa4fe('0x1d')]);}}}else{var _0x562de8=_(_0x1b64a4[_0xa4fe('0x40')])['keys']()[_0xa4fe('0x2e')](function(_0x69f15a){return _['some'](_0xa93540,[_0xa4fe('0x2b'),_0x69f15a])?_0x69f15a:undefined;})[_0xa4fe('0x75')]()[_0xa4fe('0x62')]();if(!_['isEmpty'](_0x562de8)){_0x562de8['forEach'](function(_0x1b66d1){if(_0x1b66d1===_0xa4fe('0x76')){_0x12d249[_0xa4fe('0x49')](_0xa4fe('0x77'),[][_0xa4fe('0x78')](_0x1b64a4['query'][_0x1b66d1]));}else if(_0x1b66d1===_0xa4fe('0x79')){var _0x4494f4=JSON[_0xa4fe('0x7a')](_0x1b64a4[_0xa4fe('0x40')][_0x1b66d1])['$gte'];var _0x2fbe14=JSON[_0xa4fe('0x7a')](_0x1b64a4[_0xa4fe('0x40')][_0x1b66d1])[_0xa4fe('0x7b')];_0x12d249[_0xa4fe('0x49')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4494f4,_0x2fbe14);}else{if(_0x1b64a4[_0xa4fe('0x40')][_0x1b66d1]===_0xa4fe('0x7c')){_0x12d249['where']('i.'+_0x1b66d1+_0xa4fe('0x7d'));}else{_0x12d249[_0xa4fe('0x49')]('i.'+_0x1b66d1+_0xa4fe('0x7e'),_0x1b64a4[_0xa4fe('0x40')][_0x1b66d1]);}}});}if(_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x7f')]){if(_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x7f')]==0x1){_0x12d249[_0xa4fe('0x63')](_0xa4fe('0x80'));}else{_0x12d249['having']('`unreadMessages`\x20>\x200');}}if(_0x1b64a4['query'][_0xa4fe('0x81')]){_0x56e292=_[_0xa4fe('0x82')](_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x81')])?_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x81')]:new Array(_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x81')]);_0x56e292[_0xa4fe('0x32')](function(_0x2cfa73){_0x11e79a['or'](_0xa4fe('0x83'),'%,'+_0x2cfa73+',%');});}if(_0x1b64a4[_0xa4fe('0x40')][_0xa4fe('0x84')]){var _0x1b341e=_0x1b64a4[_0xa4fe('0x40')]['filter'][_0xa4fe('0x85')]('\x5c','\x5c\x5c')[_0xa4fe('0x85')](/'/g,'\x27\x27');if(qs[_0xa4fe('0x86')](_0x1b341e)){_0x46c2b9['or'](_0xa4fe('0x87'),_0x1b341e+'%')['or'](_0xa4fe('0x88'),_0x1b341e+'%');}_0x46c2b9['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x1b341e+'%');}}_0x12d249[_0xa4fe('0x49')](_0x46c2b9);_0x12d249['group'](_0xa4fe('0x89'));var _0x3af07b={'type':db[_0xa4fe('0x8a')][_0xa4fe('0x8b')][_0xa4fe('0x8c')],'raw':!![]};var _0x6cfde8=_0x12d249[_0xa4fe('0x8d')]();_0x6cfde8[_0xa4fe('0x4c')](_0xa4fe('0x89'));_0x6cfde8['field'](_0xa4fe('0x8e'),'unreadMessages');if(_0x3ede09[_0xa4fe('0x8f')]){_0x3ede09[_0xa4fe('0x8f')][_0xa4fe('0x32')](function(_0x1559b7){var _0x16d30e=_0x1559b7[0x0]===_0xa4fe('0x90')?_0x1559b7[0x0]:'i.'+_0x1559b7[0x0];_0x12d249[_0xa4fe('0x8f')](_0x16d30e,_0x1559b7[0x1]===_0xa4fe('0x91')?![]:!![]);});}if(!_[_0xa4fe('0x92')](_0x56e292)){_0x12d249[_0xa4fe('0x63')](_0x11e79a);_0x6cfde8['where'](_0xa4fe('0x93'),_0x56e292);}BPromise[_0xa4fe('0x94')]()['then'](function(){if(!_0xac2c5){if(_0x1b64a4['query']['FaxAccountId'])return;_0x6cfde8[_0xa4fe('0x49')](_0xa4fe('0x95'));_0x12d249[_0xa4fe('0x49')](_0xa4fe('0x95'));return;}if(_0x1b64a4[_0xa4fe('0x96')][_0xa4fe('0x97')]!==_0xa4fe('0x98'))return;return _0x1b64a4['user'][_0xa4fe('0x99')]({'attributes':['id'],'raw':!![]})[_0xa4fe('0x26')](function(_0x15b726){if(_[_0xa4fe('0x92')](_0x15b726)){_0x6cfde8['where']('i.FaxAccountId\x20IS\x20NULL');_0x12d249[_0xa4fe('0x49')](_0xa4fe('0x9a'));}else{_0x6cfde8['where']('i.FaxAccountId\x20IN\x20?',_[_0xa4fe('0x2e')](_0x15b726,'id'));_0x12d249[_0xa4fe('0x49')](_0xa4fe('0x77'),_[_0xa4fe('0x2e')](_0x15b726,'id'));}});})['then'](function(){if(_0x1b64a4[_0xa4fe('0x96')][_0xa4fe('0x97')]===_0xa4fe('0x98')&&!_0xac2c5&&!_0x1b64a4['query'][_0xa4fe('0x76')])return[];return db[_0xa4fe('0x9b')]['query'](_0x6cfde8[_0xa4fe('0x9c')](),_0x3af07b);})['then'](function(_0x200502){_0x541f7d[_0xa4fe('0x22')]=_0x200502[_0xa4fe('0x46')];if(_0x541f7d[_0xa4fe('0x22')]===0x0)return[];return db[_0xa4fe('0x9b')][_0xa4fe('0x40')](_0x8c162b[_0xa4fe('0x9c')](),_0x3af07b)['then'](function(_0x5a370f){_0x115006=_['keyBy'](_0x5a370f,'id');_0x3af07b=_['merge'](_0x3af07b,{'model':db[_0xa4fe('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1b64a4['query'][_0xa4fe('0x45')]){_0x3ede09[_0xa4fe('0x44')][_0xa4fe('0x32')](function(_0x2d8b74){_0x12d249['field']('i.'+_0x2d8b74);});}else{_0x12d249['field'](_0xa4fe('0x8e'),_0xa4fe('0x61'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0x9d'),_0xa4fe('0x9e'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0x9f'),_0xa4fe('0xa0'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xa1'),_0xa4fe('0x90'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xa2'));_0x12d249[_0xa4fe('0x4c')]('c.firstName','Contact.firstName');_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xa3'),_0xa4fe('0xa4'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xa5'),_0xa4fe('0xa6'));_0x12d249['field'](_0xa4fe('0xa7'),_0xa4fe('0xa8'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xa9'),'Contact.mobile');_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xaa'),_0xa4fe('0xab'));_0x12d249['field'](_0xa4fe('0xac'),_0xa4fe('0xad'));_0x12d249[_0xa4fe('0x4c')]('o.internal',_0xa4fe('0xae'));_0x12d249[_0xa4fe('0x4c')](_0xa4fe('0xaf'),_0xa4fe('0x30'));}if(_0x3ede09[_0xa4fe('0x20')])_0x12d249[_0xa4fe('0x20')](_0x3ede09[_0xa4fe('0x20')]);if(_0x3ede09[_0xa4fe('0x1f')])_0x12d249[_0xa4fe('0x1f')](_0x3ede09[_0xa4fe('0x1f')]);return db[_0xa4fe('0x9b')][_0xa4fe('0x40')](_0x12d249[_0xa4fe('0x9c')](),_0x3af07b);})['then'](function(_0x73d902){if(_0x73d902[_0xa4fe('0x46')]>0x0)_0x15849d[_0xa4fe('0x49')](_0xa4fe('0xb0'),_[_0xa4fe('0x2e')](_0x73d902,'id'));return db[_0xa4fe('0x9b')][_0xa4fe('0x40')](_0x15849d[_0xa4fe('0x9c')](),_0x3af07b)[_0xa4fe('0x26')](function(_0x161a7c){var _0x536d4e=_[_0xa4fe('0xb1')](_0x161a7c,_0xa4fe('0xb2'));var _0x20a15e=[];_0x73d902[_0xa4fe('0x32')](function(_0x2f3eae){_0x20a15e['push'](updateFaxInteraction(_0x2f3eae,_0x115006,_0x536d4e));});return BPromise[_0xa4fe('0xb3')](_0x20a15e);});});})[_0xa4fe('0x26')](function(_0x5342b3){_0x541f7d[_0xa4fe('0xb4')]=_0x5342b3;return _0x541f7d;})['then'](respondWithFilteredResult(_0x4fbc1e,_0x3ede09))[_0xa4fe('0xb5')](handleError(_0x4fbc1e,null));};exports[_0xa4fe('0xb6')]=function(_0x418f49,_0x2f44fe){var _0x57ef17={'raw':![],'where':{'id':_0x418f49['params']['id']}},_0x579454={};_0x579454[_0xa4fe('0x43')]=_[_0xa4fe('0xb7')](db[_0xa4fe('0x3c')]['rawAttributes']);_0x579454['query']=_[_0xa4fe('0xb7')](_0x418f49['query']);_0x579454['filters']=_[_0xa4fe('0x42')](_0x579454[_0xa4fe('0x43')],_0x579454[_0xa4fe('0x40')]);_0x57ef17[_0xa4fe('0x44')]=_[_0xa4fe('0x42')](_0x579454['model'],qs['fields'](_0x418f49[_0xa4fe('0x40')][_0xa4fe('0x45')]));_0x57ef17[_0xa4fe('0x44')]=_0x57ef17[_0xa4fe('0x44')][_0xa4fe('0x46')]?_0x57ef17['attributes']:_0x579454[_0xa4fe('0x43')];if(_0x418f49[_0xa4fe('0x40')][_0xa4fe('0xb8')]){_0x57ef17[_0xa4fe('0xb9')]=[{'all':!![]}];}_0x57ef17=_['merge']({},_0x57ef17,_0x418f49[_0xa4fe('0xba')]);return db[_0xa4fe('0x3c')]['find'](_0x57ef17)[_0xa4fe('0x26')](handleEntityNotFound(_0x2f44fe,null))[_0xa4fe('0x26')](respondWithResult(_0x2f44fe,null))[_0xa4fe('0xb5')](handleError(_0x2f44fe,null));};exports[_0xa4fe('0xbb')]=function(_0xae8824,_0x5cebea){return db[_0xa4fe('0x3c')][_0xa4fe('0xbb')](_0xae8824['body'],{})['then'](respondWithResult(_0x5cebea,0xc9))[_0xa4fe('0xb5')](handleError(_0x5cebea,null));};exports[_0xa4fe('0x25')]=function(_0x116fb5,_0x508169){if(_0x116fb5['body']['id']){delete _0x116fb5[_0xa4fe('0x73')]['id'];}return db[_0xa4fe('0x3c')][_0xa4fe('0x6b')]({'where':{'id':_0x116fb5[_0xa4fe('0xbc')]['id']}})['then'](handleEntityNotFound(_0x508169,null))[_0xa4fe('0x26')](saveUpdates(_0x116fb5['body'],null))[_0xa4fe('0x26')](respondWithResult(_0x508169,null))['catch'](handleError(_0x508169,null));};exports[_0xa4fe('0x27')]=function(_0x2343dc,_0x3e5aaa){return db[_0xa4fe('0x3c')][_0xa4fe('0x6b')]({'where':{'id':_0x2343dc[_0xa4fe('0xbc')]['id']}})[_0xa4fe('0x26')](handleEntityNotFound(_0x3e5aaa,null))[_0xa4fe('0x26')](removeEntity(_0x3e5aaa,null))['catch'](handleError(_0x3e5aaa,null));};exports[_0xa4fe('0xbd')]=function(_0x38ba6e,_0x324141){return db[_0xa4fe('0x3c')][_0xa4fe('0xbd')]()['then'](respondWithResult(_0x324141,null))['catch'](handleError(_0x324141,null));};exports[_0xa4fe('0xbe')]=function(_0x53a33c,_0x43f06a,_0x302522){return db[_0xa4fe('0xbf')][_0xa4fe('0x6b')]({'where':{'id':_0x53a33c[_0xa4fe('0xbc')]['id']}})[_0xa4fe('0x26')](handleEntityNotFound(_0x43f06a,null))[_0xa4fe('0x26')](function(_0x32d0ed){if(_0x32d0ed){return _0x32d0ed[_0xa4fe('0xbe')](_0x53a33c[_0xa4fe('0x73')][_0xa4fe('0xc0')],_[_0xa4fe('0xc1')](_0x53a33c[_0xa4fe('0x73')],[_0xa4fe('0xc0'),'id'])||{});}})['then'](respondWithResult(_0x43f06a,null))[_0xa4fe('0xb5')](handleError(_0x43f06a,null));};exports[_0xa4fe('0xc2')]=function(_0x4f90d3,_0x5dd6fc,_0x493a39){var _0x55c86f={'raw':![],'where':{}};var _0xdad04b={};var _0x483755={'count':0x0,'rows':[]};return db[_0xa4fe('0x3c')][_0xa4fe('0xc3')]({'where':{'id':_0x4f90d3[_0xa4fe('0xbc')]['id']}})[_0xa4fe('0x26')](handleEntityNotFound(_0x5dd6fc,null))[_0xa4fe('0x26')](function(_0x3498b2){if(_0x3498b2){_0xdad04b[_0xa4fe('0x43')]=_[_0xa4fe('0xb7')](db[_0xa4fe('0xbf')][_0xa4fe('0x3d')]);_0xdad04b[_0xa4fe('0x40')]=_[_0xa4fe('0xb7')](_0x4f90d3[_0xa4fe('0x40')]);_0xdad04b[_0xa4fe('0x41')]=_['intersection'](_0xdad04b['model'],_0xdad04b[_0xa4fe('0x40')]);_0x55c86f[_0xa4fe('0x44')]=_[_0xa4fe('0x42')](_0xdad04b[_0xa4fe('0x43')],qs[_0xa4fe('0x45')](_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0x45')]));_0x55c86f[_0xa4fe('0x44')]=_0x55c86f[_0xa4fe('0x44')][_0xa4fe('0x46')]?_0x55c86f[_0xa4fe('0x44')]:_0xdad04b[_0xa4fe('0x43')];if(!_0x4f90d3['query']['hasOwnProperty']('nolimit')){_0x55c86f[_0xa4fe('0x20')]=qs['limit'](_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0x20')]);_0x55c86f['offset']=qs[_0xa4fe('0x1f')](_0x4f90d3['query'][_0xa4fe('0x1f')]);}_0x55c86f[_0xa4fe('0x8f')]=qs[_0xa4fe('0x48')](_0x4f90d3[_0xa4fe('0x40')]['sort']);_0x55c86f[_0xa4fe('0x49')]=qs[_0xa4fe('0x41')](_[_0xa4fe('0x4a')](_0x4f90d3[_0xa4fe('0x40')],_0xdad04b[_0xa4fe('0x41')]));_0x55c86f[_0xa4fe('0x49')][_0xa4fe('0xb2')]=_0x3498b2['id'];if(_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0x84')]){_0x55c86f[_0xa4fe('0x49')]=_[_0xa4fe('0xc4')](_0x55c86f[_0xa4fe('0x49')],{'$or':_[_0xa4fe('0x2e')](_0x55c86f[_0xa4fe('0x44')],function(_0xccc633){var _0x4d2932={};_0x4d2932[_0xccc633]={'$like':'%'+_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0x84')]+'%'};return _0x4d2932;})});}if(_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0xc5')]){var _0x3ba7f9=_0x4f90d3['query'][_0xa4fe('0xc5')]['split'](',');var _0x1ae359={};_0x1ae359[_0x3ba7f9[0x0]]={'$gte':moment(_0x3ba7f9[0x1])['format'](_0xa4fe('0xc6'))};_0x55c86f[_0xa4fe('0x49')]=_[_0xa4fe('0xc4')](_0x55c86f['where'],_0x1ae359);}_0x55c86f=_[_0xa4fe('0xc4')]({},_0x55c86f,_0x4f90d3['options']);return db['FaxMessage'][_0xa4fe('0x22')]({'where':_0x55c86f[_0xa4fe('0x49')]})['then'](function(_0x1d3b66){_0x483755[_0xa4fe('0x22')]=_0x1d3b66;if(_0x4f90d3[_0xa4fe('0x40')][_0xa4fe('0xb8')]){_0x55c86f[_0xa4fe('0xb9')]=[{'all':!![]}];}return db['FaxMessage'][_0xa4fe('0xc7')](_0x55c86f);})[_0xa4fe('0x26')](function(_0x214f4c){_0x483755[_0xa4fe('0xb4')]=_0x214f4c;return _0x483755;});}})[_0xa4fe('0x26')](respondWithFilteredResult(_0x5dd6fc,_0x55c86f))[_0xa4fe('0xb5')](handleError(_0x5dd6fc,null));};exports[_0xa4fe('0xc8')]=function(_0x571230,_0x5ef1c8,_0x6b5818){return db[_0xa4fe('0x3c')]['find']({'where':{'id':_0x571230[_0xa4fe('0xbc')]['id']}})['then'](handleEntityNotFound(_0x5ef1c8,null))[_0xa4fe('0x26')](function(_0x1d89b4){if(_0x1d89b4){return _0x1d89b4['setTags'](_0x571230[_0xa4fe('0x73')][_0xa4fe('0xc0')],_[_0xa4fe('0xc1')](_0x571230['body'],[_0xa4fe('0xc0'),'id'])||{})[_0xa4fe('0xc9')](function(){return db['Tag']['findAll']({'attributes':['id',_0xa4fe('0x2b'),_0xa4fe('0x4d')],'where':{'id':_0x571230[_0xa4fe('0x73')][_0xa4fe('0xc0')]}});})[_0xa4fe('0x26')](function(_0x1a1000){socket['emit']('faxInteractionTags:save',{'id':Number(_0x571230[_0xa4fe('0xbc')]['id']),'tags':_0x1a1000||[]});return{'id':Number(_0x571230[_0xa4fe('0xbc')]['id']),'tags':_0x1a1000||[]};});}})[_0xa4fe('0x26')](respondWithResult(_0x5ef1c8,null))['catch'](handleError(_0x5ef1c8,null));};exports[_0xa4fe('0xca')]=function(_0x524386,_0x159215,_0x54c337){return db[_0xa4fe('0x3c')]['find']({'where':{'id':_0x524386[_0xa4fe('0xbc')]['id']}})[_0xa4fe('0x26')](handleEntityNotFound(_0x159215,null))[_0xa4fe('0x26')](function(_0x12bfa3){if(_0x12bfa3){return _0x12bfa3[_0xa4fe('0xca')](_0x524386[_0xa4fe('0x40')][_0xa4fe('0xc0')]);}})[_0xa4fe('0x26')](respondWithStatusCode(_0x159215,null))[_0xa4fe('0xb5')](handleError(_0x159215,null));};exports[_0xa4fe('0xcb')]=function(_0x4635d9,_0xba3429){var _0x39e8ae=moment()['unix']()[_0xa4fe('0x9c')]();var _0x7d5fc4=path[_0xa4fe('0xcc')](config[_0xa4fe('0xcd')],_0xa4fe('0xce'),_0xa4fe('0xcf'),'tmp');var _0x41d146=path['join'](config[_0xa4fe('0xcd')],_0xa4fe('0xce'),_0xa4fe('0xcf'),_0xa4fe('0xd0'));var _0x82d58=path[_0xa4fe('0xcc')](_0x7d5fc4,_0x39e8ae);var _0x5b09d4=util['format']('transcript-%d-%s.zip',_0x4635d9[_0xa4fe('0xbc')]['id'],_0x39e8ae);var _0x599bec=path['join'](_0x7d5fc4,_0x5b09d4);var _0x4ae887=[];_0x4ae887['push']({'model':db[_0xa4fe('0xd1')],'as':_0xa4fe('0xd1'),'raw':!![]});var _0x1df094=[{'model':db['FaxMessage'],'as':_0xa4fe('0xd2'),'attributes':['id',_0xa4fe('0x73'),'createdAt'],'include':_0x4ae887}];return db[_0xa4fe('0x3c')][_0xa4fe('0x6b')]({'where':{'id':_0x4635d9['params']['id']},'include':_0x1df094})[_0xa4fe('0x26')](handleEntityNotFound(_0xba3429,null))[_0xa4fe('0x26')](function(_0x4dac9e){if(_0x4dac9e&&_0x4dac9e[_0xa4fe('0xd2')]){var _0x302b81=_0x4dac9e['get']({'plain':!![]});fs[_0xa4fe('0xd3')](_0x82d58);for(var _0x406c52=0x0;_0x406c52<_0x302b81[_0xa4fe('0xd2')][_0xa4fe('0x46')];_0x406c52++){var _0xe39ad9=_0x302b81[_0xa4fe('0xd2')][_0x406c52][_0xa4fe('0xd1')];if(_0xe39ad9){var _0xcfa909=path[_0xa4fe('0xcc')](_0x41d146,_0xe39ad9[_0xa4fe('0xd4')]);if(fs['existsSync'](_0xcfa909)){fs['createReadStream'](_0xcfa909)['pipe'](fs[_0xa4fe('0xd5')](path[_0xa4fe('0xcc')](_0x82d58,_0xe39ad9[_0xa4fe('0xd4')])));}}}return BPromise[_0xa4fe('0x94')]()[_0xa4fe('0x26')](function(){return new BPromise(function(_0x2a9d62,_0x11a749){zipdir(_0x82d58,{'saveTo':_0x599bec},function(_0x3ec566,_0x4e399e){if(_0x3ec566)return _0x11a749(_0x3ec566);return _0x2a9d62(_0x4e399e);});})[_0xa4fe('0x26')](function(){return new BPromise(function(_0x223b3a,_0x3255df){rimraf(_0x82d58,function(_0x476515){if(_0x476515)_0x3255df(_0x476515);return _0x223b3a();});});})[_0xa4fe('0x26')](function(){return _0xba3429[_0xa4fe('0xcb')](_0x599bec,_0x5b09d4,function(_0x10f28e){if(_0x10f28e){console[_0xa4fe('0xd6')](_0xa4fe('0xd7'),_0x10f28e);}else{fs['unlinkSync'](_0x599bec);}});});});}else{return _0xba3429[_0xa4fe('0x28')](0xc8);}})[_0xa4fe('0xb5')](handleError(_0xba3429,null));}; \ No newline at end of file +var _0x1c28=['agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','keyBy','merge','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.email','Contact.phone','c.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','includeAll','include','options','create','describe','FaxMessage','addMessage','ids','getMessages','format','findAll','omit','spread','emit','faxInteractionTags:save','removeTags','join','server','files','tmp','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','waiting','answered','closed','UserId','talking','unmanaged','total','index','FaxInteraction','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','FaxAccountId','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x1c28,0x115));var _0x81c2=function(_0x5f4942,_0x22e744){_0x5f4942=_0x5f4942-0x0;var _0xe1ccbd=_0x1c28[_0x5f4942];return _0xe1ccbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x81c2('0x0'));var zipdir=require(_0x81c2('0x1'));var jsonpatch=require(_0x81c2('0x2'));var rp=require(_0x81c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x81c2('0x4'));var util=require(_0x81c2('0x5'));var path=require(_0x81c2('0x6'));var sox=require(_0x81c2('0x7'));var csv=require(_0x81c2('0x8'));var ejs=require(_0x81c2('0x9'));var fs=require('fs');var fs_extra=require(_0x81c2('0xa'));var _=require(_0x81c2('0xb'));var squel=require('squel');var crypto=require(_0x81c2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x81c2('0xd'));var toCsv=require(_0x81c2('0x8'));var querystring=require(_0x81c2('0xe'));var Papa=require(_0x81c2('0xf'));var Redis=require(_0x81c2('0x10'));var authService=require(_0x81c2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x81c2('0x12'));var hardwareService=require(_0x81c2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x81c2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x81c2('0x15'));var db=require('../../mysqldb')['db'];config[_0x81c2('0x16')]=_['defaults'](config[_0x81c2('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x81c2('0x17'))(new Redis(config['redis']));require(_0x81c2('0x18'))[_0x81c2('0x19')](socket);function respondWithStatusCode(_0x416e59,_0x5342a2){_0x5342a2=_0x5342a2||0xcc;return function(_0x4403a7){if(_0x4403a7){return _0x416e59[_0x81c2('0x1a')](_0x5342a2);}return _0x416e59['status'](_0x5342a2)['end']();};}function respondWithResult(_0x2aad0f,_0x2ce7a8){_0x2ce7a8=_0x2ce7a8||0xc8;return function(_0x42861e){if(_0x42861e){return _0x2aad0f[_0x81c2('0x1b')](_0x2ce7a8)[_0x81c2('0x1c')](_0x42861e);}};}function respondWithFilteredResult(_0x22787b,_0x154040){return function(_0x43dddd){if(_0x43dddd){var _0x4b0193=typeof _0x154040['offset']===_0x81c2('0x1d')&&typeof _0x154040[_0x81c2('0x1e')]===_0x81c2('0x1d');var _0x513e4d=_0x43dddd[_0x81c2('0x1f')];var _0x2c9ea9=_0x4b0193?0x0:_0x154040[_0x81c2('0x20')];var _0x25a15f=_0x4b0193?_0x43dddd[_0x81c2('0x1f')]:_0x154040['offset']+_0x154040[_0x81c2('0x1e')];var _0x40b877;if(_0x25a15f>=_0x513e4d){_0x25a15f=_0x513e4d;_0x40b877=0xc8;}else{_0x40b877=0xce;}_0x22787b[_0x81c2('0x1b')](_0x40b877);return _0x22787b[_0x81c2('0x21')](_0x81c2('0x22'),_0x2c9ea9+'-'+_0x25a15f+'/'+_0x513e4d)[_0x81c2('0x1c')](_0x43dddd);}return null;};}function patchUpdates(_0x226767){return function(_0x3c7b57){try{jsonpatch[_0x81c2('0x23')](_0x3c7b57,_0x226767,!![]);}catch(_0x4ee35b){return BPromise[_0x81c2('0x24')](_0x4ee35b);}return _0x3c7b57[_0x81c2('0x25')]();};}function saveUpdates(_0x253783,_0x137016){return function(_0x597db6){if(_0x597db6){return _0x597db6[_0x81c2('0x26')](_0x253783)[_0x81c2('0x27')](function(_0x445d83){return _0x445d83;});}return null;};}function removeEntity(_0x4a1d75,_0x2ef24c){return function(_0x1f8b36){if(_0x1f8b36){return _0x1f8b36[_0x81c2('0x28')]()[_0x81c2('0x27')](function(){_0x4a1d75[_0x81c2('0x1b')](0xcc)[_0x81c2('0x29')]();});}};}function handleEntityNotFound(_0xb450c2,_0x2c21c6){return function(_0xe6099e){if(!_0xe6099e){_0xb450c2[_0x81c2('0x1a')](0x194);}return _0xe6099e;};}function handleError(_0x41d997,_0x12e2bf){_0x12e2bf=_0x12e2bf||0x1f4;return function(_0x3dae4c){logger[_0x81c2('0x2a')](_0x3dae4c[_0x81c2('0x2b')]);if(_0x3dae4c[_0x81c2('0x2c')]){delete _0x3dae4c['name'];}_0x41d997[_0x81c2('0x1b')](_0x12e2bf)[_0x81c2('0x2d')](_0x3dae4c);};}function getInteractionUsers(_0x3638b3,_0x2c6928){return new BPromise(function(_0x804bc7,_0xf056fc){try{if(_0x2c6928[_0x3638b3['id']]){_0x3638b3[_0x81c2('0x2e')]=_[_0x81c2('0x2f')](_0x2c6928[_0x3638b3['id']],function(_0x273638){return{'id':_0x273638['id'],'fullname':_0x273638[_0x81c2('0x30')]};});}}catch(_0x5737a9){_0xf056fc(_0x5737a9);}_0x804bc7(_0x3638b3);});}function getInteractionTags(_0x5367ce,_0x2dbfc4){return new BPromise(function(_0x55845d,_0x48d7a2){try{if(_0x5367ce[_0x81c2('0x31')]){_0x5367ce[_0x81c2('0x32')]=[];_0x5367ce[_0x81c2('0x31')][_0x81c2('0x33')](',')[_0x81c2('0x34')](function(_0x257c52){_0x5367ce[_0x81c2('0x32')][_0x81c2('0x35')](_0x2dbfc4[_0x257c52]);});}delete _0x5367ce[_0x81c2('0x31')];}catch(_0x5a5538){_0x48d7a2(_0x5a5538);}_0x55845d(_0x5367ce);});}function updateFaxInteraction(_0x57e783,_0x1e8cc8,_0x44328b){return new BPromise(function(_0x53721b,_0x4d266c){return getInteractionUsers(_0x57e783,_0x44328b)[_0x81c2('0x27')](function(_0x562fe3){return getInteractionTags(_0x562fe3,_0x1e8cc8);})[_0x81c2('0x27')](function(_0x3f44d1){return getStateInteraction(_0x3f44d1);})['then'](function(_0x15bead){_0x53721b(_0x15bead);})[_0x81c2('0x36')](function(_0x365c7b){_0x4d266c(_0x365c7b);});});}function getStateInteraction(_0x1e867a){return new BPromise(function(_0x5a455b){_0x1e867a[_0x81c2('0x37')]=0x0;_0x1e867a['talking']=0x0;_0x1e867a[_0x81c2('0x38')]=0x0;_0x1e867a['unmanaged']=0x0;_0x1e867a['total']=0x0;if(!_0x1e867a[_0x81c2('0x39')]&&!_0x1e867a[_0x81c2('0x3a')]){_0x1e867a['waiting']+=0x1;}if(!_0x1e867a[_0x81c2('0x39')]&&_0x1e867a[_0x81c2('0x3a')]){_0x1e867a['talking']+=0x1;if(_0x1e867a[_0x81c2('0x37')]){_0x1e867a[_0x81c2('0x37')]-=0x1;}}if(_0x1e867a[_0x81c2('0x39')]&&_0x1e867a['UserId']){_0x1e867a['answered']+=0x1;if(_0x1e867a[_0x81c2('0x3b')]){_0x1e867a[_0x81c2('0x3b')]-=0x1;}}if(_0x1e867a[_0x81c2('0x39')]&&!_0x1e867a[_0x81c2('0x3a')]){_0x1e867a[_0x81c2('0x3c')]+=0x1;if(_0x1e867a[_0x81c2('0x37')]){_0x1e867a['waiting']-=0x1;}}_0x1e867a[_0x81c2('0x3d')]+=0x1;_0x5a455b(_0x1e867a);});}exports[_0x81c2('0x3e')]=function(_0xdc00ae,_0x3bd349){var _0x58a8b5={},_0x4b9393={},_0x5b0ed2={'count':0x0,'rows':[]};var _0xc088be=_[_0x81c2('0x2f')](db[_0x81c2('0x3f')][_0x81c2('0x40')],function(_0x1847a4){return{'name':_0x1847a4[_0x81c2('0x41')],'type':_0x1847a4[_0x81c2('0x42')]['key']};});_0x4b9393[_0x81c2('0x43')]=_[_0x81c2('0x2f')](_0xc088be,_0x81c2('0x2c'));_0x4b9393[_0x81c2('0x44')]=_[_0x81c2('0x45')](_0xdc00ae[_0x81c2('0x44')]);_0x4b9393[_0x81c2('0x46')]=_['intersection'](_0x4b9393[_0x81c2('0x43')],_0x4b9393[_0x81c2('0x44')]);_0x58a8b5[_0x81c2('0x47')]=_[_0x81c2('0x48')](_0x4b9393[_0x81c2('0x43')],qs[_0x81c2('0x49')](_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x49')]));_0x58a8b5[_0x81c2('0x47')]=_0x58a8b5[_0x81c2('0x47')][_0x81c2('0x4a')]?_0x58a8b5[_0x81c2('0x47')]:_0x4b9393[_0x81c2('0x43')];if(!_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x4b')](_0x81c2('0x4c'))){_0x58a8b5[_0x81c2('0x1e')]=qs['limit'](_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x1e')]);_0x58a8b5[_0x81c2('0x20')]=qs[_0x81c2('0x20')](_0xdc00ae['query'][_0x81c2('0x20')]);}_0x58a8b5[_0x81c2('0x4d')]=qs['sort'](_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x4e')]);_0x58a8b5[_0x81c2('0x4f')]=qs[_0x81c2('0x46')](_[_0x81c2('0x50')](_0xdc00ae[_0x81c2('0x44')],_0x4b9393['filters']),_0xc088be);var _0x2d3dc0=[];var _0x1538ed=squel[_0x81c2('0x51')]()[_0x81c2('0x52')]('id')['field']('name')['field'](_0x81c2('0x53'))[_0x81c2('0x54')]('tools_tags');var _0x467eb3=squel[_0x81c2('0x51')]()[_0x81c2('0x52')]('u.id')[_0x81c2('0x52')](_0x81c2('0x55'))['field'](_0x81c2('0x56'))[_0x81c2('0x54')](_0x81c2('0x57'),'ui')[_0x81c2('0x58')](_0x81c2('0x59'),'u',_0x81c2('0x5a'));var _0x233738=squel[_0x81c2('0x51')]()[_0x81c2('0x54')]('fax_interactions','i')[_0x81c2('0x58')](_0x81c2('0x5b'),'c',_0x81c2('0x5c'))[_0x81c2('0x58')](_0x81c2('0x59'),'o','o.id\x20=\x20i.UserId')[_0x81c2('0x58')]('fax_accounts','a','a.id\x20=\x20i.FaxAccountId')['left_join'](_0x81c2('0x5d'),'me',_0x81c2('0x5e'))[_0x81c2('0x58')](_0x81c2('0x5f'),'it',_0x81c2('0x60'))[_0x81c2('0x58')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x4eeb6e=squel[_0x81c2('0x61')]();var _0x38dcf4=[];var _0x28da89=squel['expr']();var _0x348d14;if(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x62')]){_0x348d14=as[_0x81c2('0x63')](_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x62')]);var _0x4234c3=_0x348d14[_0x81c2('0x64')];for(var _0x42ef38=0x0;_0x42ef38<_0x348d14[_0x81c2('0x65')][_0x81c2('0x4a')];_0x42ef38++){var _0x21b5db=_0x348d14[_0x81c2('0x65')][_0x42ef38];var _0x342425='i';var _0x237361=_[_0x81c2('0x66')](_0xc088be,['name',_0x21b5db[_0x81c2('0x52')]]);if(!_0x237361){switch(_0x21b5db[_0x81c2('0x52')]){case _0x81c2('0x67'):if(_0x21b5db[_0x81c2('0x68')]==0x1){_0x233738[_0x81c2('0x69')]('`'+_0x21b5db[_0x81c2('0x52')]+'`\x20=\x200');}else{_0x233738[_0x81c2('0x69')]('`'+_0x21b5db[_0x81c2('0x52')]+_0x81c2('0x6a'));}break;case _0x81c2('0x6b'):if(_0x21b5db[_0x81c2('0x6c')]===_0x81c2('0x6d')){if(_0x21b5db['value'][_0x81c2('0x33')]('\x20')['length']>0x1){_0x4eeb6e[_0x4234c3]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x81c2('0x6e')](_0x21b5db['value']),null);}else{var _0x231a71='%'+_0x21b5db[_0x81c2('0x68')]+'%';_0x4eeb6e[_0x4234c3](_0x81c2('0x6f'),_0x231a71,_0x231a71,_0x231a71);}}else{_0x237361=_[_0x81c2('0x66')](_0xc088be,['name',_0x81c2('0x70')]);_0x21b5db['field']='ContactId';_0x4f4fe0=as[_0x81c2('0x71')](_0x342425,_0x237361[_0x81c2('0x42')],_0x21b5db);_0x4eeb6e[_0x4234c3](_0x4f4fe0[_0x81c2('0x72')],_0x4f4fe0[_0x81c2('0x68')]['start'],_0x4f4fe0[_0x81c2('0x68')]['end']);}break;case _0x81c2('0x73'):var _0x5a8eb2=_0x21b5db['value']['split'](',')[_0x81c2('0x2f')](function(_0x10a141){return Number(_0x10a141);});_0x5a8eb2[_0x81c2('0x34')](function(_0x176eb4){_0x28da89['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x176eb4+',%');});_0x38dcf4=_[_0x81c2('0x74')](_0x38dcf4,_0x5a8eb2);break;case'User':if(_0x21b5db[_0x81c2('0x6c')]==='$substring'){_0x4eeb6e[_0x4234c3](_0x81c2('0x75'),'%'+_0x21b5db['value']+'%',null);}else{_0x237361=_[_0x81c2('0x66')](_0xc088be,['name',_0x81c2('0x3a')]);_0x21b5db['field']=_0x81c2('0x3a');_0x4f4fe0=as[_0x81c2('0x71')](_0x342425,_0x237361[_0x81c2('0x42')],_0x21b5db);_0x4eeb6e[_0x4234c3](_0x4f4fe0[_0x81c2('0x72')],_0x4f4fe0[_0x81c2('0x68')][_0x81c2('0x76')],_0x4f4fe0[_0x81c2('0x68')][_0x81c2('0x29')]);}break;case _0x81c2('0x77'):_0x4f4fe0=as[_0x81c2('0x71')]('me',null,_0x21b5db);_0x4eeb6e[_0x4234c3](_0x4f4fe0[_0x81c2('0x72')],_0x4f4fe0[_0x81c2('0x68')][_0x81c2('0x76')],_0x4f4fe0['value'][_0x81c2('0x29')]);break;}}else{var _0x4f4fe0=as['buildExpression'](_0x342425,_0x237361['type'],_0x21b5db);_0x4eeb6e[_0x4234c3](_0x4f4fe0[_0x81c2('0x72')],_0x4f4fe0[_0x81c2('0x68')][_0x81c2('0x76')],_0x4f4fe0['value'][_0x81c2('0x29')]);}}}else{var _0x4762f5=_(_0xdc00ae[_0x81c2('0x44')])[_0x81c2('0x45')]()[_0x81c2('0x2f')](function(_0x4cb476){return _[_0x81c2('0x78')](_0xc088be,['name',_0x4cb476])?_0x4cb476:undefined;})['compact']()[_0x81c2('0x68')]();if(!_[_0x81c2('0x79')](_0x4762f5)){_0x4762f5['forEach'](function(_0x158a82){if(_0x158a82===_0x81c2('0x7a')){_0x233738[_0x81c2('0x4f')]('i.FaxAccountId\x20IN\x20?',[][_0x81c2('0x7b')](_0xdc00ae[_0x81c2('0x44')][_0x158a82]));}else if(_0x158a82==='createdAt'){var _0x5d483e=JSON[_0x81c2('0x7c')](_0xdc00ae['query'][_0x158a82])[_0x81c2('0x7d')];var _0x5ac794=JSON[_0x81c2('0x7c')](_0xdc00ae[_0x81c2('0x44')][_0x158a82])[_0x81c2('0x7e')];_0x233738[_0x81c2('0x4f')](_0x81c2('0x7f'),_0x5d483e,_0x5ac794);}else{if(_0xdc00ae[_0x81c2('0x44')][_0x158a82]===_0x81c2('0x80')){_0x233738[_0x81c2('0x4f')]('i.'+_0x158a82+'\x20IS\x20NULL');}else{_0x233738['where']('i.'+_0x158a82+'\x20=\x20?',_0xdc00ae[_0x81c2('0x44')][_0x158a82]);}}});}if(_0xdc00ae['query'][_0x81c2('0x81')]){if(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x81')]==0x1){_0x233738[_0x81c2('0x69')](_0x81c2('0x82'));}else{_0x233738[_0x81c2('0x69')]('`unreadMessages`\x20>\x200');}}if(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x83')]){_0x38dcf4=_[_0x81c2('0x84')](_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x83')])?_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x83')]:new Array(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x83')]);_0x38dcf4[_0x81c2('0x34')](function(_0x3265b0){_0x28da89['or'](_0x81c2('0x85'),'%,'+_0x3265b0+',%');});}if(_0xdc00ae['query']['filter']){var _0x32558d=_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x86')][_0x81c2('0x87')]('\x5c','\x5c\x5c')[_0x81c2('0x87')](/'/g,'\x27\x27');if(qs[_0x81c2('0x88')](_0x32558d)){_0x4eeb6e['or'](_0x81c2('0x89'),_0x32558d+'%')['or'](_0x81c2('0x8a'),_0x32558d+'%');}_0x4eeb6e['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x32558d+'%');}}_0x233738[_0x81c2('0x4f')](_0x4eeb6e);_0x233738[_0x81c2('0x8b')](_0x81c2('0x8c'));var _0xff39e1={'type':db[_0x81c2('0x8d')][_0x81c2('0x8e')][_0x81c2('0x8f')],'raw':!![]};var _0x502960=_0x233738[_0x81c2('0x90')]();_0x502960[_0x81c2('0x52')](_0x81c2('0x8c'));_0x502960[_0x81c2('0x52')](_0x81c2('0x91'),'unreadMessages');if(_0x58a8b5[_0x81c2('0x4d')]){_0x58a8b5['order']['forEach'](function(_0xee101f){var _0x355f39=_0xee101f[0x0]==='contactName'?_0xee101f[0x0]:'i.'+_0xee101f[0x0];_0x233738[_0x81c2('0x4d')](_0x355f39,_0xee101f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x81c2('0x79')](_0x38dcf4)){_0x233738[_0x81c2('0x69')](_0x28da89);_0x502960[_0x81c2('0x4f')](_0x81c2('0x92'),_0x38dcf4);}BPromise[_0x81c2('0x93')]()[_0x81c2('0x27')](function(){if(!_0x348d14){if(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x7a')])return;_0x502960[_0x81c2('0x4f')](_0x81c2('0x94'));_0x233738[_0x81c2('0x4f')](_0x81c2('0x94'));return;}if(_0xdc00ae[_0x81c2('0x95')][_0x81c2('0x96')]!==_0x81c2('0x97'))return;return _0xdc00ae[_0x81c2('0x95')][_0x81c2('0x98')]({'attributes':['id'],'raw':!![]})[_0x81c2('0x27')](function(_0xc8c141){if(_[_0x81c2('0x79')](_0xc8c141)){_0x502960['where'](_0x81c2('0x99'));_0x233738[_0x81c2('0x4f')](_0x81c2('0x99'));}else{_0x502960[_0x81c2('0x4f')](_0x81c2('0x9a'),_[_0x81c2('0x2f')](_0xc8c141,'id'));_0x233738[_0x81c2('0x4f')]('i.FaxAccountId\x20IN\x20?',_[_0x81c2('0x2f')](_0xc8c141,'id'));}});})[_0x81c2('0x27')](function(){if(_0xdc00ae['user'][_0x81c2('0x96')]==='agent'&&!_0x348d14&&!_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x7a')])return[];return db[_0x81c2('0x9b')][_0x81c2('0x44')](_0x502960['toString'](),_0xff39e1);})[_0x81c2('0x27')](function(_0x2cf701){_0x5b0ed2['count']=_0x2cf701['length'];if(_0x5b0ed2['count']===0x0)return[];return db['sequelize'][_0x81c2('0x44')](_0x1538ed['toString'](),_0xff39e1)[_0x81c2('0x27')](function(_0x362281){_0x2d3dc0=_[_0x81c2('0x9c')](_0x362281,'id');_0xff39e1=_[_0x81c2('0x9d')](_0xff39e1,{'model':db[_0x81c2('0x3f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xdc00ae[_0x81c2('0x44')][_0x81c2('0x49')]){_0x58a8b5['attributes'][_0x81c2('0x34')](function(_0x21eb10){_0x233738[_0x81c2('0x52')]('i.'+_0x21eb10);});}else{_0x233738[_0x81c2('0x52')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x233738[_0x81c2('0x52')](_0x81c2('0x9e'),_0x81c2('0x9f'));_0x233738[_0x81c2('0x52')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x233738[_0x81c2('0x52')](_0x81c2('0xa0'),_0x81c2('0xa1'));_0x233738[_0x81c2('0x52')](_0x81c2('0xa2'));_0x233738[_0x81c2('0x52')](_0x81c2('0xa3'),_0x81c2('0xa4'));_0x233738[_0x81c2('0x52')](_0x81c2('0xa5'),'Contact.lastName');_0x233738['field']('c.email',_0x81c2('0xa6'));_0x233738['field']('c.phone',_0x81c2('0xa7'));_0x233738[_0x81c2('0x52')]('c.mobile','Contact.mobile');_0x233738[_0x81c2('0x52')](_0x81c2('0xa8'),'Contact.fax');_0x233738[_0x81c2('0x52')](_0x81c2('0xa9'),'Owner.fullname');_0x233738[_0x81c2('0x52')](_0x81c2('0xaa'),'Owner.internal');_0x233738['field'](_0x81c2('0xab'),_0x81c2('0x31'));}if(_0x58a8b5['limit'])_0x233738[_0x81c2('0x1e')](_0x58a8b5[_0x81c2('0x1e')]);if(_0x58a8b5[_0x81c2('0x20')])_0x233738[_0x81c2('0x20')](_0x58a8b5[_0x81c2('0x20')]);return db[_0x81c2('0x9b')]['query'](_0x233738[_0x81c2('0xac')](),_0xff39e1);})[_0x81c2('0x27')](function(_0x46ba7a){if(_0x46ba7a[_0x81c2('0x4a')]>0x0)_0x467eb3[_0x81c2('0x4f')](_0x81c2('0xad'),_[_0x81c2('0x2f')](_0x46ba7a,'id'));return db[_0x81c2('0x9b')][_0x81c2('0x44')](_0x467eb3[_0x81c2('0xac')](),_0xff39e1)['then'](function(_0x544c54){var _0x296da5=_[_0x81c2('0xae')](_0x544c54,_0x81c2('0xaf'));var _0x2124ea=[];_0x46ba7a[_0x81c2('0x34')](function(_0x360254){_0x2124ea[_0x81c2('0x35')](updateFaxInteraction(_0x360254,_0x2d3dc0,_0x296da5));});return BPromise[_0x81c2('0xb0')](_0x2124ea);});});})[_0x81c2('0x27')](function(_0x5e176e){_0x5b0ed2[_0x81c2('0xb1')]=_0x5e176e;return _0x5b0ed2;})[_0x81c2('0x27')](respondWithFilteredResult(_0x3bd349,_0x58a8b5))[_0x81c2('0x36')](handleError(_0x3bd349,null));};exports[_0x81c2('0xb2')]=function(_0x1aafd9,_0x843c48){var _0x10ed24={'raw':![],'where':{'id':_0x1aafd9[_0x81c2('0xb3')]['id']}},_0x5c0369={};_0x5c0369[_0x81c2('0x43')]=_['keys'](db[_0x81c2('0x3f')][_0x81c2('0x40')]);_0x5c0369[_0x81c2('0x44')]=_['keys'](_0x1aafd9[_0x81c2('0x44')]);_0x5c0369['filters']=_['intersection'](_0x5c0369['model'],_0x5c0369[_0x81c2('0x44')]);_0x10ed24[_0x81c2('0x47')]=_[_0x81c2('0x48')](_0x5c0369[_0x81c2('0x43')],qs[_0x81c2('0x49')](_0x1aafd9[_0x81c2('0x44')][_0x81c2('0x49')]));_0x10ed24[_0x81c2('0x47')]=_0x10ed24['attributes'][_0x81c2('0x4a')]?_0x10ed24[_0x81c2('0x47')]:_0x5c0369['model'];if(_0x1aafd9[_0x81c2('0x44')][_0x81c2('0xb4')]){_0x10ed24[_0x81c2('0xb5')]=[{'all':!![]}];}_0x10ed24=_[_0x81c2('0x9d')]({},_0x10ed24,_0x1aafd9[_0x81c2('0xb6')]);return db[_0x81c2('0x3f')][_0x81c2('0x66')](_0x10ed24)[_0x81c2('0x27')](handleEntityNotFound(_0x843c48,null))[_0x81c2('0x27')](respondWithResult(_0x843c48,null))[_0x81c2('0x36')](handleError(_0x843c48,null));};exports['create']=function(_0x43033f,_0x41e0db){return db[_0x81c2('0x3f')][_0x81c2('0xb7')](_0x43033f[_0x81c2('0x77')],{})[_0x81c2('0x27')](respondWithResult(_0x41e0db,0xc9))['catch'](handleError(_0x41e0db,null));};exports[_0x81c2('0x26')]=function(_0x58a67c,_0x5f2970){if(_0x58a67c[_0x81c2('0x77')]['id']){delete _0x58a67c[_0x81c2('0x77')]['id'];}return db[_0x81c2('0x3f')][_0x81c2('0x66')]({'where':{'id':_0x58a67c['params']['id']}})[_0x81c2('0x27')](handleEntityNotFound(_0x5f2970,null))[_0x81c2('0x27')](saveUpdates(_0x58a67c[_0x81c2('0x77')],null))[_0x81c2('0x27')](respondWithResult(_0x5f2970,null))[_0x81c2('0x36')](handleError(_0x5f2970,null));};exports[_0x81c2('0x28')]=function(_0x270815,_0x4fa003){return db[_0x81c2('0x3f')][_0x81c2('0x66')]({'where':{'id':_0x270815[_0x81c2('0xb3')]['id']}})[_0x81c2('0x27')](handleEntityNotFound(_0x4fa003,null))[_0x81c2('0x27')](removeEntity(_0x4fa003,null))[_0x81c2('0x36')](handleError(_0x4fa003,null));};exports[_0x81c2('0xb8')]=function(_0x1c1c65,_0x2abd12){return db[_0x81c2('0x3f')][_0x81c2('0xb8')]()[_0x81c2('0x27')](respondWithResult(_0x2abd12,null))[_0x81c2('0x36')](handleError(_0x2abd12,null));};exports['addMessage']=function(_0x12c212,_0x48a131,_0x2fa6aa){return db[_0x81c2('0xb9')][_0x81c2('0x66')]({'where':{'id':_0x12c212[_0x81c2('0xb3')]['id']}})[_0x81c2('0x27')](handleEntityNotFound(_0x48a131,null))['then'](function(_0x325fb1){if(_0x325fb1){return _0x325fb1[_0x81c2('0xba')](_0x12c212[_0x81c2('0x77')][_0x81c2('0xbb')],_['omit'](_0x12c212[_0x81c2('0x77')],['ids','id'])||{});}})[_0x81c2('0x27')](respondWithResult(_0x48a131,null))['catch'](handleError(_0x48a131,null));};exports[_0x81c2('0xbc')]=function(_0x112d6c,_0x1daf5d,_0x3058e2){var _0x323bb5={'raw':![],'where':{}};var _0x531f55={};var _0x4bee00={'count':0x0,'rows':[]};return db[_0x81c2('0x3f')]['findOne']({'where':{'id':_0x112d6c[_0x81c2('0xb3')]['id']}})[_0x81c2('0x27')](handleEntityNotFound(_0x1daf5d,null))['then'](function(_0x224bee){if(_0x224bee){_0x531f55[_0x81c2('0x43')]=_[_0x81c2('0x45')](db[_0x81c2('0xb9')]['rawAttributes']);_0x531f55[_0x81c2('0x44')]=_['keys'](_0x112d6c['query']);_0x531f55['filters']=_[_0x81c2('0x48')](_0x531f55[_0x81c2('0x43')],_0x531f55[_0x81c2('0x44')]);_0x323bb5[_0x81c2('0x47')]=_[_0x81c2('0x48')](_0x531f55['model'],qs['fields'](_0x112d6c[_0x81c2('0x44')][_0x81c2('0x49')]));_0x323bb5[_0x81c2('0x47')]=_0x323bb5['attributes'][_0x81c2('0x4a')]?_0x323bb5[_0x81c2('0x47')]:_0x531f55['model'];if(!_0x112d6c[_0x81c2('0x44')][_0x81c2('0x4b')](_0x81c2('0x4c'))){_0x323bb5[_0x81c2('0x1e')]=qs[_0x81c2('0x1e')](_0x112d6c[_0x81c2('0x44')]['limit']);_0x323bb5[_0x81c2('0x20')]=qs[_0x81c2('0x20')](_0x112d6c[_0x81c2('0x44')][_0x81c2('0x20')]);}_0x323bb5['order']=qs['sort'](_0x112d6c[_0x81c2('0x44')][_0x81c2('0x4e')]);_0x323bb5[_0x81c2('0x4f')]=qs[_0x81c2('0x46')](_[_0x81c2('0x50')](_0x112d6c[_0x81c2('0x44')],_0x531f55[_0x81c2('0x46')]));_0x323bb5[_0x81c2('0x4f')][_0x81c2('0xaf')]=_0x224bee['id'];if(_0x112d6c[_0x81c2('0x44')]['filter']){_0x323bb5[_0x81c2('0x4f')]=_[_0x81c2('0x9d')](_0x323bb5[_0x81c2('0x4f')],{'$or':_[_0x81c2('0x2f')](_0x323bb5['attributes'],function(_0x14ac4a){var _0x4847c3={};_0x4847c3[_0x14ac4a]={'$like':'%'+_0x112d6c[_0x81c2('0x44')][_0x81c2('0x86')]+'%'};return _0x4847c3;})});}if(_0x112d6c[_0x81c2('0x44')]['$gte']){var _0x14fd3b=_0x112d6c[_0x81c2('0x44')][_0x81c2('0x7d')][_0x81c2('0x33')](',');var _0x5cf6f7={};_0x5cf6f7[_0x14fd3b[0x0]]={'$gte':moment(_0x14fd3b[0x1])[_0x81c2('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')};_0x323bb5[_0x81c2('0x4f')]=_[_0x81c2('0x9d')](_0x323bb5[_0x81c2('0x4f')],_0x5cf6f7);}_0x323bb5=_[_0x81c2('0x9d')]({},_0x323bb5,_0x112d6c[_0x81c2('0xb6')]);return db[_0x81c2('0xb9')]['count']({'where':_0x323bb5[_0x81c2('0x4f')]})[_0x81c2('0x27')](function(_0x13625c){_0x4bee00[_0x81c2('0x1f')]=_0x13625c;if(_0x112d6c['query'][_0x81c2('0xb4')]){_0x323bb5['include']=[{'all':!![]}];}return db[_0x81c2('0xb9')][_0x81c2('0xbe')](_0x323bb5);})[_0x81c2('0x27')](function(_0x12c631){_0x4bee00[_0x81c2('0xb1')]=_0x12c631;return _0x4bee00;});}})[_0x81c2('0x27')](respondWithFilteredResult(_0x1daf5d,_0x323bb5))[_0x81c2('0x36')](handleError(_0x1daf5d,null));};exports['addTags']=function(_0x36dbff,_0x1f5d39,_0x185dcd){return db[_0x81c2('0x3f')][_0x81c2('0x66')]({'where':{'id':_0x36dbff[_0x81c2('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1f5d39,null))[_0x81c2('0x27')](function(_0x39f31c){if(_0x39f31c){return _0x39f31c['setTags'](_0x36dbff[_0x81c2('0x77')][_0x81c2('0xbb')],_[_0x81c2('0xbf')](_0x36dbff['body'],[_0x81c2('0xbb'),'id'])||{})[_0x81c2('0xc0')](function(){return db[_0x81c2('0x73')][_0x81c2('0xbe')]({'attributes':['id',_0x81c2('0x2c'),_0x81c2('0x53')],'where':{'id':_0x36dbff[_0x81c2('0x77')][_0x81c2('0xbb')]}});})[_0x81c2('0x27')](function(_0x4808d9){socket[_0x81c2('0xc1')](_0x81c2('0xc2'),{'id':Number(_0x36dbff[_0x81c2('0xb3')]['id']),'tags':_0x4808d9||[]});return{'id':Number(_0x36dbff[_0x81c2('0xb3')]['id']),'tags':_0x4808d9||[]};});}})['then'](respondWithResult(_0x1f5d39,null))[_0x81c2('0x36')](handleError(_0x1f5d39,null));};exports[_0x81c2('0xc3')]=function(_0x3350cb,_0xba816d,_0x599287){return db['FaxInteraction'][_0x81c2('0x66')]({'where':{'id':_0x3350cb[_0x81c2('0xb3')]['id']}})[_0x81c2('0x27')](handleEntityNotFound(_0xba816d,null))[_0x81c2('0x27')](function(_0x2e35a8){if(_0x2e35a8){return _0x2e35a8['removeTags'](_0x3350cb['query'][_0x81c2('0xbb')]);}})[_0x81c2('0x27')](respondWithStatusCode(_0xba816d,null))[_0x81c2('0x36')](handleError(_0xba816d,null));};exports['download']=function(_0x32f377,_0x549059){var _0x367daa=moment()['unix']()[_0x81c2('0xac')]();var _0x285a94=path[_0x81c2('0xc4')](config['root'],_0x81c2('0xc5'),_0x81c2('0xc6'),_0x81c2('0xc7'));var _0x3b7634=path[_0x81c2('0xc4')](config['root'],_0x81c2('0xc5'),'files','attachments');var _0x43949b=path[_0x81c2('0xc4')](_0x285a94,_0x367daa);var _0x569b06=util[_0x81c2('0xbd')](_0x81c2('0xc8'),_0x32f377[_0x81c2('0xb3')]['id'],_0x367daa);var _0x1aadfa=path[_0x81c2('0xc4')](_0x285a94,_0x569b06);var _0x1914a5=[];_0x1914a5[_0x81c2('0x35')]({'model':db[_0x81c2('0xc9')],'as':_0x81c2('0xc9'),'raw':!![]});var _0x115793=[{'model':db[_0x81c2('0xb9')],'as':'Messages','attributes':['id',_0x81c2('0x77'),_0x81c2('0xca')],'include':_0x1914a5}];return db[_0x81c2('0x3f')][_0x81c2('0x66')]({'where':{'id':_0x32f377['params']['id']},'include':_0x115793})[_0x81c2('0x27')](handleEntityNotFound(_0x549059,null))['then'](function(_0x207207){if(_0x207207&&_0x207207[_0x81c2('0xcb')]){var _0x109a20=_0x207207[_0x81c2('0xcc')]({'plain':!![]});fs[_0x81c2('0xcd')](_0x43949b);for(var _0x3a992e=0x0;_0x3a992e<_0x109a20['Messages']['length'];_0x3a992e++){var _0x4f9e02=_0x109a20[_0x81c2('0xcb')][_0x3a992e]['Attachment'];if(_0x4f9e02){var _0x2e72f6=path[_0x81c2('0xc4')](_0x3b7634,_0x4f9e02[_0x81c2('0xce')]);if(fs[_0x81c2('0xcf')](_0x2e72f6)){fs[_0x81c2('0xd0')](_0x2e72f6)[_0x81c2('0xd1')](fs[_0x81c2('0xd2')](path['join'](_0x43949b,_0x4f9e02[_0x81c2('0xce')])));}}}return BPromise[_0x81c2('0x93')]()['then'](function(){return new BPromise(function(_0x2d3633,_0x59d2aa){zipdir(_0x43949b,{'saveTo':_0x1aadfa},function(_0xf24cff,_0x28218a){if(_0xf24cff)return _0x59d2aa(_0xf24cff);return _0x2d3633(_0x28218a);});})[_0x81c2('0x27')](function(){return new BPromise(function(_0x1ac401,_0x41ca02){rimraf(_0x43949b,function(_0x164d78){if(_0x164d78)_0x41ca02(_0x164d78);return _0x1ac401();});});})['then'](function(){return _0x549059[_0x81c2('0xd3')](_0x1aadfa,_0x569b06,function(_0x108c49){if(_0x108c49){console[_0x81c2('0xd4')](_0x81c2('0xd5'),_0x108c49);}else{fs['unlinkSync'](_0x1aadfa);}});});});}else{return _0x549059['sendStatus'](0xc8);}})[_0x81c2('0x36')](handleError(_0x549059,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d84b980..c692319 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 _0x5ecd=['update','getUsers','then','setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ecd,0x1ae));var _0xd5ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ecd[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0xd5ec('0x0')];var FaxMessage=require(_0xd5ec('0x1'))['db'][_0xd5ec('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd5ec('0x3')](0x0);var events={'afterCreate':_0xd5ec('0x4'),'afterUpdate':_0xd5ec('0x5'),'afterDestroy':'remove'};function emitEvent(_0xf3ded8){return function(_0x371880,_0x383889,_0x7ed65b){_0x371880[_0xd5ec('0x6')]({'attributes':['id'],'raw':!![]})[_0xd5ec('0x7')](function(_0x33d78b){_0x371880[_0xd5ec('0x8')]('Users',_0x33d78b['map'](function(_0x15991e){return{'id':_0x15991e['id']};}));return FaxMessage[_0xd5ec('0x9')]({'where':{'FaxInteractionId':_0x371880['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xb6730b){_0x371880[_0xd5ec('0x8')](_0xd5ec('0xa'),_0xb6730b['length']);FaxInteractionEvents[_0xd5ec('0xb')](_0xf3ded8+':'+_0x371880['id'],_0x371880);FaxInteractionEvents[_0xd5ec('0xb')](_0xf3ded8,_0x371880);_0x7ed65b(null);})[_0xd5ec('0xc')](_0x7ed65b(null));};}for(var e in events){if(events[_0xd5ec('0xd')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xd5ec('0xe')]=FaxInteractionEvents; \ No newline at end of file +var _0x66e4=['catch','hasOwnProperty','exports','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','map','findAll','length','emit'];(function(_0x27097d,_0xd56df0){var _0x40a23b=function(_0x2f9045){while(--_0x2f9045){_0x27097d['push'](_0x27097d['shift']());}};_0x40a23b(++_0xd56df0);}(_0x66e4,0x1f0));var _0x466e=function(_0x46d9c6,_0x5be5ac){_0x46d9c6=_0x46d9c6-0x0;var _0x29b414=_0x66e4[_0x46d9c6];return _0x29b414;};'use strict';var EventEmitter=require(_0x466e('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x466e('0x1')];var FaxMessage=require(_0x466e('0x2'))['db'][_0x466e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x466e('0x4')](0x0);var events={'afterCreate':_0x466e('0x5'),'afterUpdate':'update','afterDestroy':_0x466e('0x6')};function emitEvent(_0x3405f0){return function(_0x45fccf,_0x2f6510,_0x1e5484){_0x45fccf[_0x466e('0x7')]({'attributes':['id'],'raw':!![]})[_0x466e('0x8')](function(_0x5cc427){_0x45fccf[_0x466e('0x9')]('Users',_0x5cc427[_0x466e('0xa')](function(_0x3c6576){return{'id':_0x3c6576['id']};}));return FaxMessage[_0x466e('0xb')]({'where':{'FaxInteractionId':_0x45fccf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x466e('0x8')](function(_0x39e99d){_0x45fccf[_0x466e('0x9')]('unreadMessages',_0x39e99d[_0x466e('0xc')]);FaxInteractionEvents['emit'](_0x3405f0+':'+_0x45fccf['id'],_0x45fccf);FaxInteractionEvents[_0x466e('0xd')](_0x3405f0,_0x45fccf);_0x1e5484(null);})[_0x466e('0xe')](_0x1e5484(null));};}for(var e in events){if(events[_0x466e('0xf')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x466e('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b0aa379..0563809 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 _0x8597=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','fax_interactions','changed','closed','closedAt','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8597,0xe1));var _0x7859=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x8597[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x7859('0x0'));var util=require('util');var logger=require(_0x7859('0x1'))(_0x7859('0x2'));var moment=require(_0x7859('0x3'));var BPromise=require(_0x7859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7859('0x5'));var rimraf=require(_0x7859('0x6'));var config=require(_0x7859('0x7'));var attributes=require(_0x7859('0x8'));module[_0x7859('0x9')]=function(_0x5b3e77,_0x14fd59){return _0x5b3e77['define']('FaxInteraction',attributes,{'tableName':_0x7859('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1611ce,_0x1eaebf,_0x3f026b){if(_0x1611ce[_0x7859('0xb')](_0x7859('0xc'))){_0x1611ce[_0x7859('0xd')]=moment()[_0x7859('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3f026b(null,_0x1611ce);}}});}; \ No newline at end of file +var _0x76a7=['./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x76a7,0x14b));var _0x776a=function(_0x107ad4,_0xab04b2){_0x107ad4=_0x107ad4-0x0;var _0x24b7e3=_0x76a7[_0x107ad4];return _0x24b7e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x776a('0x0'))('api');var moment=require(_0x776a('0x1'));var BPromise=require(_0x776a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x776a('0x3'));var rimraf=require(_0x776a('0x4'));var config=require('../../config/environment');var attributes=require(_0x776a('0x5'));module[_0x776a('0x6')]=function(_0x40f383,_0x42bdd5){return _0x40f383[_0x776a('0x7')](_0x776a('0x8'),attributes,{'tableName':_0x776a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3afa9d,_0x5621b0,_0x2e93ef){if(_0x3afa9d[_0x776a('0xa')](_0x776a('0xb'))){_0x3afa9d['closedAt']=moment()[_0x776a('0xc')](_0x776a('0xd'));}_0x2e93ef(null,_0x3afa9d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 6aa206d..2f45b94 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 _0x228f=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','info','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','find','addTags','ids'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x228f,0x1bb));var _0xf228=function(_0x19b409,_0x2a3d2d){_0x19b409=_0x19b409-0x0;var _0x53ff5b=_0x228f[_0x19b409];return _0x53ff5b;};'use strict';var _=require(_0xf228('0x0'));var util=require(_0xf228('0x1'));var moment=require(_0xf228('0x2'));var BPromise=require(_0xf228('0x3'));var rs=require(_0xf228('0x4'));var fs=require('fs');var Redis=require(_0xf228('0x5'));var db=require(_0xf228('0x6'))['db'];var utils=require(_0xf228('0x7'));var logger=require(_0xf228('0x8'))(_0xf228('0x9'));var config=require(_0xf228('0xa'));var jayson=require(_0xf228('0xb'));var client=jayson[_0xf228('0xc')][_0xf228('0xd')]({'port':0x232a});config['redis']=_[_0xf228('0xe')](config['redis'],{'host':_0xf228('0xf'),'port':0x18eb});var socket=require(_0xf228('0x10'))(new Redis(config[_0xf228('0x11')]));require(_0xf228('0x12'))['register'](socket);function respondWithRpcPromise(_0x5a1c1e,_0x439b6a,_0x1d3c96){return new BPromise(function(_0x16d86d,_0x45ba80){return client['request'](_0x5a1c1e,_0x1d3c96)[_0xf228('0x13')](function(_0x36802b){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x439b6a,_0xf228('0x14'));logger[_0xf228('0x15')](_0xf228('0x16'),_0x439b6a,'request\x20sent',JSON[_0xf228('0x17')](_0x36802b));if(_0x36802b[_0xf228('0x18')]){if(_0x36802b[_0xf228('0x18')][_0xf228('0x19')]===0x1f4){logger[_0xf228('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x439b6a,_0x36802b[_0xf228('0x18')][_0xf228('0x1a')]);return _0x45ba80(_0x36802b[_0xf228('0x18')][_0xf228('0x1a')]);}logger['error'](_0xf228('0x1b'),_0x439b6a,_0x36802b[_0xf228('0x18')][_0xf228('0x1a')]);return _0x16d86d(_0x36802b['error'][_0xf228('0x1a')]);}else{logger[_0xf228('0x1c')]('FaxInteraction,\x20%s,\x20%s',_0x439b6a,_0xf228('0x14'));_0x16d86d(_0x36802b[_0xf228('0x1d')][_0xf228('0x1a')]);}})[_0xf228('0x1e')](function(_0x1a7a6e){logger[_0xf228('0x18')](_0xf228('0x1b'),_0x439b6a,_0x1a7a6e);_0x45ba80(_0x1a7a6e);});});}exports[_0xf228('0x1f')]=function(_0xfdd418){var _0x12ec79=this;return new Promise(function(_0x1610b7,_0x1a704e){return db[_0xf228('0x20')]['update'](_0xfdd418[_0xf228('0x21')],{'raw':_0xfdd418[_0xf228('0x22')]?_0xfdd418[_0xf228('0x22')][_0xf228('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfdd418['options']?_0xfdd418['options'][_0xf228('0x24')]||null:null,'attributes':_0xfdd418['options']?_0xfdd418['options'][_0xf228('0x25')]||null:null,'limit':_0xfdd418[_0xf228('0x22')]?_0xfdd418[_0xf228('0x22')]['limit']||null:null})[_0xf228('0x13')](function(_0x22e8a4){logger[_0xf228('0x1c')](_0xf228('0x1f'),_0xfdd418);logger[_0xf228('0x15')](_0xf228('0x1f'),_0xfdd418,JSON[_0xf228('0x17')](_0x22e8a4));_0x1610b7(_0x22e8a4);})[_0xf228('0x1e')](function(_0x25cfeb){logger[_0xf228('0x18')]('UpdateFaxInteraction',_0x25cfeb[_0xf228('0x1a')],_0xfdd418);_0x1a704e(_0x12ec79[_0xf228('0x18')](0x1f4,_0x25cfeb[_0xf228('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x21062a){return new Promise(function(_0x835fd0,_0x43da1f){return db[_0xf228('0x20')][_0xf228('0x26')]({'where':_0x21062a[_0xf228('0x22')]?_0x21062a[_0xf228('0x22')]['where']||null:null})['then'](function(_0x2f0c1e){if(_0x2f0c1e){return _0x2f0c1e[_0xf228('0x27')](_0x21062a[_0xf228('0x21')][_0xf228('0x28')],_[_0xf228('0x29')](_0x21062a['body'],['ids','id'])||{});}})[_0xf228('0x2a')](function(_0x497b5a){logger[_0xf228('0x1c')]('AddTags',_0x21062a);logger[_0xf228('0x15')](_0xf228('0x2b'),_0x21062a,JSON[_0xf228('0x17')](_0x497b5a));_0x835fd0(_0x497b5a);})[_0xf228('0x1e')](function(_0x4831f3){logger[_0xf228('0x18')](_0xf228('0x2b'),_0x4831f3['message'],_0x21062a);_0x43da1f(_this[_0xf228('0x18')](0x1f4,_0x4831f3[_0xf228('0x1a')]));});});}; \ No newline at end of file +var _0x5cd2=['where','attributes','limit','then','debug','AddTagsToFaxInteraction','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options'];(function(_0x2f325a,_0x47b83c){var _0x3bad9e=function(_0x3a304e){while(--_0x3a304e){_0x2f325a['push'](_0x2f325a['shift']());}};_0x3bad9e(++_0x47b83c);}(_0x5cd2,0x187));var _0x25cd=function(_0x48b38e,_0x17e15e){_0x48b38e=_0x48b38e-0x0;var _0x1cd05d=_0x5cd2[_0x48b38e];return _0x1cd05d;};'use strict';var _=require(_0x25cd('0x0'));var util=require(_0x25cd('0x1'));var moment=require(_0x25cd('0x2'));var BPromise=require(_0x25cd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x25cd('0x4'));var logger=require(_0x25cd('0x5'))(_0x25cd('0x6'));var config=require(_0x25cd('0x7'));var jayson=require(_0x25cd('0x8'));var client=jayson['client'][_0x25cd('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x25cd('0xa')],{'host':_0x25cd('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25cd('0xa')]));require(_0x25cd('0xc'))[_0x25cd('0xd')](socket);function respondWithRpcPromise(_0x42fe92,_0x52e648,_0x2921a0){return new BPromise(function(_0x4b918c,_0x101b55){return client[_0x25cd('0xe')](_0x42fe92,_0x2921a0)['then'](function(_0x56ff20){logger[_0x25cd('0xf')](_0x25cd('0x10'),_0x52e648,_0x25cd('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x52e648,_0x25cd('0x11'),JSON[_0x25cd('0x12')](_0x56ff20));if(_0x56ff20[_0x25cd('0x13')]){if(_0x56ff20[_0x25cd('0x13')][_0x25cd('0x14')]===0x1f4){logger[_0x25cd('0x13')](_0x25cd('0x10'),_0x52e648,_0x56ff20[_0x25cd('0x13')][_0x25cd('0x15')]);return _0x101b55(_0x56ff20[_0x25cd('0x13')][_0x25cd('0x15')]);}logger['error'](_0x25cd('0x10'),_0x52e648,_0x56ff20[_0x25cd('0x13')][_0x25cd('0x15')]);return _0x4b918c(_0x56ff20['error'][_0x25cd('0x15')]);}else{logger['info'](_0x25cd('0x10'),_0x52e648,_0x25cd('0x11'));_0x4b918c(_0x56ff20['result'][_0x25cd('0x15')]);}})[_0x25cd('0x16')](function(_0x1ebef5){logger[_0x25cd('0x13')](_0x25cd('0x10'),_0x52e648,_0x1ebef5);_0x101b55(_0x1ebef5);});});}exports[_0x25cd('0x17')]=function(_0x7baca4){var _0x19578f=this;return new Promise(function(_0x5e832b,_0x5365bf){return db[_0x25cd('0x18')][_0x25cd('0x19')](_0x7baca4['body'],{'raw':_0x7baca4[_0x25cd('0x1a')]?_0x7baca4[_0x25cd('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7baca4['options']?_0x7baca4[_0x25cd('0x1a')][_0x25cd('0x1b')]||null:null,'attributes':_0x7baca4['options']?_0x7baca4['options'][_0x25cd('0x1c')]||null:null,'limit':_0x7baca4[_0x25cd('0x1a')]?_0x7baca4[_0x25cd('0x1a')][_0x25cd('0x1d')]||null:null})[_0x25cd('0x1e')](function(_0x95dedb){logger['info'](_0x25cd('0x17'),_0x7baca4);logger[_0x25cd('0x1f')](_0x25cd('0x17'),_0x7baca4,JSON['stringify'](_0x95dedb));_0x5e832b(_0x95dedb);})['catch'](function(_0x3d649f){logger[_0x25cd('0x13')]('UpdateFaxInteraction',_0x3d649f[_0x25cd('0x15')],_0x7baca4);_0x5365bf(_0x19578f['error'](0x1f4,_0x3d649f[_0x25cd('0x15')]));});});};exports[_0x25cd('0x20')]=function(_0x4f2fcb){return new Promise(function(_0x26a99a,_0x16deef){return db[_0x25cd('0x18')]['find']({'where':_0x4f2fcb[_0x25cd('0x1a')]?_0x4f2fcb['options'][_0x25cd('0x1b')]||null:null})[_0x25cd('0x1e')](function(_0x57ab96){if(_0x57ab96){return _0x57ab96[_0x25cd('0x21')](_0x4f2fcb[_0x25cd('0x22')][_0x25cd('0x23')],_['omit'](_0x4f2fcb['body'],[_0x25cd('0x23'),'id'])||{});}})[_0x25cd('0x24')](function(_0x3e12b6){logger['info'](_0x25cd('0x25'),_0x4f2fcb);logger[_0x25cd('0x1f')](_0x25cd('0x25'),_0x4f2fcb,JSON[_0x25cd('0x12')](_0x3e12b6));_0x26a99a(_0x3e12b6);})[_0x25cd('0x16')](function(_0x108acb){logger[_0x25cd('0x13')](_0x25cd('0x25'),_0x108acb[_0x25cd('0x15')],_0x4f2fcb);_0x16deef(_this[_0x25cd('0x13')](0x1f4,_0x108acb[_0x25cd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 147c346..a969992 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 _0x0352=['./faxInteraction.events','save','update','emit','length','faxInteraction:'];(function(_0x825f5a,_0x546de4){var _0x3123f5=function(_0x4b37d0){while(--_0x4b37d0){_0x825f5a['push'](_0x825f5a['shift']());}};_0x3123f5(++_0x546de4);}(_0x0352,0x96));var _0x2035=function(_0x1d04be,_0x4d344d){_0x1d04be=_0x1d04be-0x0;var _0x44e750=_0x0352[_0x1d04be];return _0x44e750;};'use strict';var FaxInteractionEvents=require(_0x2035('0x0'));var events=[_0x2035('0x1'),'remove',_0x2035('0x2')];function createListener(_0x41d4d0,_0x559428){return function(_0x1ad805){_0x559428[_0x2035('0x3')](_0x41d4d0,_0x1ad805);};}function removeListener(_0x5ec384,_0x2718fd){return function(){FaxInteractionEvents['removeListener'](_0x5ec384,_0x2718fd);};}exports['register']=function(_0x5a332a){for(var _0x20648a=0x0,_0x1c42e4=events[_0x2035('0x4')];_0x20648a<_0x1c42e4;_0x20648a++){var _0x32cbea=events[_0x20648a];var _0x2972e9=createListener(_0x2035('0x5')+_0x32cbea,_0x5a332a);FaxInteractionEvents['on'](_0x32cbea,_0x2972e9);}}; \ No newline at end of file +var _0x4e07=['update','emit','removeListener','register','length','faxInteraction:','remove'];(function(_0x5f41ae,_0x44627c){var _0x1c1823=function(_0x3bc5ff){while(--_0x3bc5ff){_0x5f41ae['push'](_0x5f41ae['shift']());}};_0x1c1823(++_0x44627c);}(_0x4e07,0xae));var _0x74e0=function(_0x455640,_0x320c02){_0x455640=_0x455640-0x0;var _0x56e005=_0x4e07[_0x455640];return _0x56e005;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x74e0('0x0'),_0x74e0('0x1')];function createListener(_0x4537de,_0x50bb6e){return function(_0x2d56ab){_0x50bb6e[_0x74e0('0x2')](_0x4537de,_0x2d56ab);};}function removeListener(_0x393951,_0x5abfeb){return function(){FaxInteractionEvents[_0x74e0('0x3')](_0x393951,_0x5abfeb);};}exports[_0x74e0('0x4')]=function(_0x107db4){for(var _0x5b2e4e=0x0,_0x49ae4e=events[_0x74e0('0x5')];_0x5b2e4e<_0x49ae4e;_0x5b2e4e++){var _0x4df863=events[_0x5b2e4e];var _0x5bc3aa=createListener(_0x74e0('0x6')+_0x4df863,_0x107db4);FaxInteractionEvents['on'](_0x4df863,_0x5bc3aa);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index ff9f57f..384b338 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 _0x324d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','express'];(function(_0xa881cd,_0x380adb){var _0x3da03c=function(_0x388614){while(--_0x388614){_0xa881cd['push'](_0xa881cd['shift']());}};_0x3da03c(++_0x380adb);}(_0x324d,0x170));var _0xd324=function(_0x10f5a8,_0x1c4d5f){_0x10f5a8=_0x10f5a8-0x0;var _0x2d9dc8=_0x324d[_0x10f5a8];return _0x2d9dc8;};'use strict';var multer=require(_0xd324('0x0'));var util=require(_0xd324('0x1'));var path=require('path');var timeout=require(_0xd324('0x2'));var express=require(_0xd324('0x3'));var router=express[_0xd324('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd324('0x5'));var interaction=require(_0xd324('0x6'));var config=require(_0xd324('0x7'));var controller=require(_0xd324('0x8'));router[_0xd324('0x9')]('/',auth[_0xd324('0xa')](),controller[_0xd324('0xb')]);router['get'](_0xd324('0xc'),auth[_0xd324('0xa')](),controller[_0xd324('0xd')]);router['get'](_0xd324('0xe'),auth[_0xd324('0xa')](),controller[_0xd324('0xf')]);router[_0xd324('0x9')](_0xd324('0x10'),auth[_0xd324('0xa')](),controller[_0xd324('0x11')]);router[_0xd324('0x9')](_0xd324('0x12'),auth[_0xd324('0xa')](),controller['download']);router[_0xd324('0x13')]('/',auth[_0xd324('0xa')](),controller['create']);router[_0xd324('0x13')]('/:id/messages',auth[_0xd324('0xa')](),controller[_0xd324('0x14')]);router[_0xd324('0x13')](_0xd324('0x15'),auth['isAuthenticated'](),interaction[_0xd324('0x16')](_0xd324('0x17'),_0xd324('0x18')),controller['addTags']);router['put'](_0xd324('0xe'),auth['isAuthenticated'](),interaction[_0xd324('0x16')](_0xd324('0x17'),_0xd324('0x19')),controller[_0xd324('0x1a')]);router['delete'](_0xd324('0xe'),auth[_0xd324('0xa')](),interaction[_0xd324('0x16')](_0xd324('0x17'),_0xd324('0x1b')),controller[_0xd324('0x1c')]);router[_0xd324('0x1d')](_0xd324('0x15'),auth['isAuthenticated'](),controller['removeTags']);module[_0xd324('0x1e')]=router; \ No newline at end of file +var _0x8f20=['fs-extra','../../components/interaction/service','./faxInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','delete','destroy','multer','connect-timeout','express','Router'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x8f20,0x175));var _0x08f2=function(_0x2215c2,_0xc39a17){_0x2215c2=_0x2215c2-0x0;var _0x40ba4f=_0x8f20[_0x2215c2];return _0x40ba4f;};'use strict';var multer=require(_0x08f2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x08f2('0x1'));var express=require(_0x08f2('0x2'));var router=express[_0x08f2('0x3')]();var fs_extra=require(_0x08f2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08f2('0x5'));var config=require('../../config/environment');var controller=require(_0x08f2('0x6'));router['get']('/',auth[_0x08f2('0x7')](),controller[_0x08f2('0x8')]);router[_0x08f2('0x9')](_0x08f2('0xa'),auth[_0x08f2('0x7')](),controller[_0x08f2('0xb')]);router[_0x08f2('0x9')](_0x08f2('0xc'),auth[_0x08f2('0x7')](),controller[_0x08f2('0xd')]);router[_0x08f2('0x9')](_0x08f2('0xe'),auth[_0x08f2('0x7')](),controller[_0x08f2('0xf')]);router[_0x08f2('0x9')](_0x08f2('0x10'),auth['isAuthenticated'](),controller[_0x08f2('0x11')]);router[_0x08f2('0x12')]('/',auth['isAuthenticated'](),controller[_0x08f2('0x13')]);router[_0x08f2('0x12')](_0x08f2('0xe'),auth[_0x08f2('0x7')](),controller['addMessage']);router['post'](_0x08f2('0x14'),auth[_0x08f2('0x7')](),interaction['tracked'](_0x08f2('0x15'),_0x08f2('0x16')),controller[_0x08f2('0x17')]);router[_0x08f2('0x18')]('/:id',auth[_0x08f2('0x7')](),interaction[_0x08f2('0x19')]('fax',_0x08f2('0x1a')),controller['update']);router[_0x08f2('0x1b')](_0x08f2('0xc'),auth[_0x08f2('0x7')](),interaction['tracked']('fax','faxinteraction:destroy'),controller[_0x08f2('0x1c')]);router[_0x08f2('0x1b')](_0x08f2('0x14'),auth[_0x08f2('0x7')](),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 353e2d2..c57f86d 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 _0xdab2=['sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2dab('0x0'));module[_0x2dab('0x1')]={'body':{'type':Sequelize['TEXT'](_0x2dab('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2dab('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2dab('0x4')]('in',_0x2dab('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x2dab('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x2dab('0x7')]}}; \ No newline at end of file +var _0x7aaf=['TEXT','medium','out','sequelize'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x2d6d04,_0xe413b3){_0x2d6d04=_0x2d6d04-0x0;var _0x553d4e=_0x7aaf[_0x2d6d04];return _0x553d4e;};'use strict';var Sequelize=require(_0xf7aa('0x0'));module['exports']={'body':{'type':Sequelize[_0xf7aa('0x1')](_0xf7aa('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf7aa('0x3')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xf7aa('0x1')],'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 5ff7ff2..a56fe73 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 _0xe017=['name','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','params','keys','find','body','catch','describe','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','reject','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','fullname','motionChannel','rejectmessage','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','destroy','then','stack'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0xe017,0x176));var _0x7e01=function(_0x4e600e,_0x5cb8e4){_0x4e600e=_0x4e600e-0x0;var _0x103aaa=_0xe017[_0x4e600e];return _0x103aaa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e01('0x0'));var zipdir=require(_0x7e01('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e01('0x2'));var moment=require(_0x7e01('0x3'));var BPromise=require(_0x7e01('0x4'));var Mustache=require(_0x7e01('0x5'));var util=require(_0x7e01('0x6'));var path=require(_0x7e01('0x7'));var sox=require(_0x7e01('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e01('0x9'));var _=require('lodash');var squel=require(_0x7e01('0xa'));var crypto=require(_0x7e01('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7e01('0xc'));var toCsv=require(_0x7e01('0xd'));var querystring=require(_0x7e01('0xe'));var Papa=require(_0x7e01('0xf'));var Redis=require('ioredis');var authService=require(_0x7e01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7e01('0x11'));var hardwareService=require(_0x7e01('0x12'));var logger=require(_0x7e01('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7e01('0x14'));var db=require('../../mysqldb')['db'];config[_0x7e01('0x15')]=_[_0x7e01('0x16')](config['redis'],{'host':_0x7e01('0x17'),'port':0x18eb});var socket=require(_0x7e01('0x18'))(new Redis(config[_0x7e01('0x15')]));require(_0x7e01('0x19'))[_0x7e01('0x1a')](socket);var jayson=require(_0x7e01('0x1b'));var client=jayson[_0x7e01('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7e01('0x1c')][_0x7e01('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x18f1da,_0x1667b2,_0x1300a9,_0x268106){return new BPromise(function(_0x16bf27,_0x42c158){var _0x1df577=_0x268106||client;return _0x1df577[_0x7e01('0x1e')](_0x18f1da,_0x1300a9)['then'](function(_0x1802b1){logger[_0x7e01('0x1f')](_0x7e01('0x20'),_0x1667b2,_0x7e01('0x21'));logger[_0x7e01('0x22')](_0x7e01('0x23'),_0x1667b2,'request\x20sent',JSON['stringify'](_0x1802b1));if(_0x1802b1[_0x7e01('0x24')]){if(_0x1802b1[_0x7e01('0x24')]['code']===0x1f4){logger[_0x7e01('0x24')](_0x7e01('0x20'),_0x1667b2,_0x1802b1['error'][_0x7e01('0x25')]);return _0x42c158(_0x1802b1[_0x7e01('0x24')][_0x7e01('0x25')]);}logger[_0x7e01('0x24')](_0x7e01('0x20'),_0x1667b2,_0x1802b1[_0x7e01('0x24')][_0x7e01('0x25')]);return _0x16bf27(_0x1802b1[_0x7e01('0x24')]['message']);}else{logger[_0x7e01('0x1f')](_0x7e01('0x20'),_0x1667b2,_0x7e01('0x21'));_0x16bf27(_0x1802b1[_0x7e01('0x26')][_0x7e01('0x25')]);}})['catch'](function(_0x25c0f2){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1667b2,_0x25c0f2);_0x42c158(_0x25c0f2);});});}function respondWithStatusCode(_0x246bf1,_0x4e7831){_0x4e7831=_0x4e7831||0xcc;return function(_0x13c07b){if(_0x13c07b){return _0x246bf1[_0x7e01('0x27')](_0x4e7831);}return _0x246bf1[_0x7e01('0x28')](_0x4e7831)['end']();};}function respondWithResult(_0x4fcffa,_0xe33c37){_0xe33c37=_0xe33c37||0xc8;return function(_0x2f8c2a){if(_0x2f8c2a){return _0x4fcffa['status'](_0xe33c37)[_0x7e01('0x29')](_0x2f8c2a);}};}function respondWithFilteredResult(_0x2257c1,_0x73fa87){return function(_0x575544){if(_0x575544){var _0x2a975f=typeof _0x73fa87[_0x7e01('0x2a')]===_0x7e01('0x2b')&&typeof _0x73fa87[_0x7e01('0x2c')]===_0x7e01('0x2b');var _0x18ee7c=_0x575544['count'];var _0x3bc7c5=_0x2a975f?0x0:_0x73fa87[_0x7e01('0x2a')];var _0x419235=_0x2a975f?_0x575544['count']:_0x73fa87[_0x7e01('0x2a')]+_0x73fa87[_0x7e01('0x2c')];var _0x5b54f4;if(_0x419235>=_0x18ee7c){_0x419235=_0x18ee7c;_0x5b54f4=0xc8;}else{_0x5b54f4=0xce;}_0x2257c1['status'](_0x5b54f4);return _0x2257c1[_0x7e01('0x2d')]('Content-Range',_0x3bc7c5+'-'+_0x419235+'/'+_0x18ee7c)[_0x7e01('0x29')](_0x575544);}return null;};}function patchUpdates(_0x3c2b6d){return function(_0x57483){try{jsonpatch[_0x7e01('0x2e')](_0x57483,_0x3c2b6d,!![]);}catch(_0x466279){return BPromise['reject'](_0x466279);}return _0x57483[_0x7e01('0x2f')]();};}function saveUpdates(_0x2feb3c,_0x1801af){return function(_0x52ae18){if(_0x52ae18){return _0x52ae18[_0x7e01('0x30')](_0x2feb3c)['then'](function(_0x157118){return _0x157118;});}return null;};}function removeEntity(_0x2a90b8,_0x315cf4){return function(_0x38f872){if(_0x38f872){return _0x38f872[_0x7e01('0x31')]()[_0x7e01('0x32')](function(){_0x2a90b8[_0x7e01('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5215a9,_0x336a6c){return function(_0x24f814){if(!_0x24f814){_0x5215a9[_0x7e01('0x27')](0x194);}return _0x24f814;};}function handleError(_0xa26cd0,_0x8d9afd){_0x8d9afd=_0x8d9afd||0x1f4;return function(_0x3fd12a){logger[_0x7e01('0x24')](_0x3fd12a[_0x7e01('0x33')]);if(_0x3fd12a[_0x7e01('0x34')]){delete _0x3fd12a['name'];}_0xa26cd0[_0x7e01('0x28')](_0x8d9afd)['send'](_0x3fd12a);};}exports['index']=function(_0x49ea86,_0xdec835){var _0x4365ca={},_0x251844={},_0x449375={'count':0x0,'rows':[]};var _0x5c2027=_['map'](db[_0x7e01('0x35')][_0x7e01('0x36')],function(_0xe13da4){return{'name':_0xe13da4[_0x7e01('0x37')],'type':_0xe13da4[_0x7e01('0x38')][_0x7e01('0x39')]};});_0x251844[_0x7e01('0x3a')]=_[_0x7e01('0x3b')](_0x5c2027,_0x7e01('0x34'));_0x251844[_0x7e01('0x3c')]=_['keys'](_0x49ea86['query']);_0x251844[_0x7e01('0x3d')]=_['intersection'](_0x251844[_0x7e01('0x3a')],_0x251844['query']);_0x4365ca[_0x7e01('0x3e')]=_[_0x7e01('0x3f')](_0x251844['model'],qs[_0x7e01('0x40')](_0x49ea86[_0x7e01('0x3c')][_0x7e01('0x40')]));_0x4365ca[_0x7e01('0x3e')]=_0x4365ca[_0x7e01('0x3e')][_0x7e01('0x41')]?_0x4365ca[_0x7e01('0x3e')]:_0x251844[_0x7e01('0x3a')];if(!_0x49ea86['query'][_0x7e01('0x42')](_0x7e01('0x43'))){_0x4365ca[_0x7e01('0x2c')]=qs[_0x7e01('0x2c')](_0x49ea86['query'][_0x7e01('0x2c')]);_0x4365ca[_0x7e01('0x2a')]=qs['offset'](_0x49ea86[_0x7e01('0x3c')]['offset']);}_0x4365ca[_0x7e01('0x44')]=qs['sort'](_0x49ea86['query'][_0x7e01('0x45')]);_0x4365ca[_0x7e01('0x46')]=qs[_0x7e01('0x3d')](_[_0x7e01('0x47')](_0x49ea86[_0x7e01('0x3c')],_0x251844['filters']),_0x5c2027);if(_0x49ea86['query'][_0x7e01('0x48')]){_0x4365ca['where']=_[_0x7e01('0x49')](_0x4365ca['where'],{'$or':_[_0x7e01('0x3b')](_0x5c2027,function(_0x2fdc1e){if(_0x2fdc1e[_0x7e01('0x38')]!=='VIRTUAL'){var _0x3bc4cd={};_0x3bc4cd[_0x2fdc1e[_0x7e01('0x34')]]={'$like':'%'+_0x49ea86[_0x7e01('0x3c')][_0x7e01('0x48')]+'%'};return _0x3bc4cd;}})});}_0x4365ca=_[_0x7e01('0x49')]({},_0x4365ca,_0x49ea86[_0x7e01('0x4a')]);var _0x14574b={'where':_0x4365ca['where']};return db[_0x7e01('0x35')][_0x7e01('0x4b')](_0x14574b)[_0x7e01('0x32')](function(_0x33dd6c){_0x449375['count']=_0x33dd6c;if(_0x49ea86[_0x7e01('0x3c')][_0x7e01('0x4c')]){_0x4365ca[_0x7e01('0x4d')]=[{'all':!![]}];}return db['FaxMessage'][_0x7e01('0x4e')](_0x4365ca);})[_0x7e01('0x32')](function(_0xce81b){_0x449375[_0x7e01('0x4f')]=_0xce81b;return _0x449375;})['then'](respondWithFilteredResult(_0xdec835,_0x4365ca))['catch'](handleError(_0xdec835,null));};exports['show']=function(_0x43b9af,_0xb34c09){var _0x3b280c={'raw':!![],'where':{'id':_0x43b9af[_0x7e01('0x50')]['id']}},_0x494c98={};_0x494c98[_0x7e01('0x3a')]=_[_0x7e01('0x51')](db[_0x7e01('0x35')][_0x7e01('0x36')]);_0x494c98[_0x7e01('0x3c')]=_[_0x7e01('0x51')](_0x43b9af[_0x7e01('0x3c')]);_0x494c98[_0x7e01('0x3d')]=_[_0x7e01('0x3f')](_0x494c98[_0x7e01('0x3a')],_0x494c98[_0x7e01('0x3c')]);_0x3b280c[_0x7e01('0x3e')]=_[_0x7e01('0x3f')](_0x494c98['model'],qs[_0x7e01('0x40')](_0x43b9af[_0x7e01('0x3c')][_0x7e01('0x40')]));_0x3b280c[_0x7e01('0x3e')]=_0x3b280c['attributes'][_0x7e01('0x41')]?_0x3b280c[_0x7e01('0x3e')]:_0x494c98['model'];if(_0x43b9af[_0x7e01('0x3c')][_0x7e01('0x4c')]){_0x3b280c['include']=[{'all':!![]}];}_0x3b280c=_[_0x7e01('0x49')]({},_0x3b280c,_0x43b9af[_0x7e01('0x4a')]);return db['FaxMessage'][_0x7e01('0x52')](_0x3b280c)[_0x7e01('0x32')](handleEntityNotFound(_0xb34c09,null))[_0x7e01('0x32')](respondWithResult(_0xb34c09,null))['catch'](handleError(_0xb34c09,null));};exports[_0x7e01('0x30')]=function(_0x560e48,_0x37fe84){if(_0x560e48['body']['id']){delete _0x560e48['body']['id'];}return db[_0x7e01('0x35')][_0x7e01('0x52')]({'where':{'id':_0x560e48[_0x7e01('0x50')]['id']}})[_0x7e01('0x32')](handleEntityNotFound(_0x37fe84,null))['then'](saveUpdates(_0x560e48[_0x7e01('0x53')],null))[_0x7e01('0x32')](respondWithResult(_0x37fe84,null))[_0x7e01('0x54')](handleError(_0x37fe84,null));};exports[_0x7e01('0x31')]=function(_0x3045e2,_0x59a770){return db[_0x7e01('0x35')]['find']({'where':{'id':_0x3045e2[_0x7e01('0x50')]['id']}})[_0x7e01('0x32')](handleEntityNotFound(_0x59a770,null))['then'](removeEntity(_0x59a770,null))[_0x7e01('0x54')](handleError(_0x59a770,null));};exports[_0x7e01('0x55')]=function(_0x2c5d1b,_0x7b2afa){return db['FaxMessage'][_0x7e01('0x55')]()[_0x7e01('0x32')](respondWithResult(_0x7b2afa,null))[_0x7e01('0x54')](handleError(_0x7b2afa,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['accept']=function(_0x593aeb,_0x3be550,_0x9631a0){var _0x4138cb={'agent':{},'channel':_0x7e01('0x56')};if(_0x593aeb[_0x7e01('0x53')]['id']){delete _0x593aeb['body']['id'];}_0x593aeb[_0x7e01('0x53')][_0x7e01('0x57')]=!![];_0x593aeb[_0x7e01('0x53')][_0x7e01('0x58')]=moment()[_0x7e01('0x59')](_0x7e01('0x5a'));_0x593aeb['body'][_0x7e01('0x5b')]=_0x593aeb['body'][_0x7e01('0x5b')]||_0x593aeb[_0x7e01('0x5c')]['id'];_0x4138cb[_0x7e01('0x5d')]['id']=_0x593aeb[_0x7e01('0x53')][_0x7e01('0x5b')];return db['FaxMessage'][_0x7e01('0x52')]({'where':{'id':_0x593aeb[_0x7e01('0x50')]['id'],'UserId':null}})[_0x7e01('0x32')](handleEntityNotFound(_0x3be550,null))[_0x7e01('0x32')](saveUpdates(_0x593aeb[_0x7e01('0x53')],null))[_0x7e01('0x32')](function(_0x3b5fb2){if(_0x3b5fb2){_0x4138cb[_0x7e01('0x25')]=_0x3b5fb2[_0x7e01('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0x7e01('0x52')]({'where':{'id':_0x3b5fb2[_0x7e01('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x3be550,null))[_0x7e01('0x32')](function(_0x3af91f){if(_0x3af91f){return _0x3af91f['update']({'UserId':_0x593aeb[_0x7e01('0x53')][_0x7e01('0x5b')],'read1stAt':_[_0x7e01('0x60')](_0x3af91f[_0x7e01('0x61')])?moment()[_0x7e01('0x59')](_0x7e01('0x5a')):undefined});}return null;})[_0x7e01('0x32')](function(_0x575dc0){if(_0x575dc0){_0x4138cb[_0x7e01('0x62')]=_0x575dc0['get']({'plain':!![]});interaction_log[_0x7e01('0x1f')](_0x7e01('0x63'),_0x593aeb['user']['id'],_0x593aeb[_0x7e01('0x5c')][_0x7e01('0x34')],_0x593aeb[_0x7e01('0x5c')][_0x7e01('0x64')],_0x4138cb[_0x7e01('0x62')]['id'],_0x593aeb[_0x7e01('0x53')]?JSON[_0x7e01('0x65')](_0x593aeb[_0x7e01('0x53')]):_0x7e01('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4138cb);}return null;})[_0x7e01('0x32')](function(_0xbdd59c){var _0x2a82f9=_0x7e01('0x67')+_0xbdd59c[_0x7e01('0x25')][_0x7e01('0x68')];return db[_0x7e01('0x69')][_0x7e01('0x3c')](_0x2a82f9,{'type':db[_0x7e01('0x6a')]['QueryTypes'][_0x7e01('0x6b')],'raw':!![]})[_0x7e01('0x32')](function(_0x459526){return _0x459526;});})[_0x7e01('0x32')](function(_0x1be549){if(_0x1be549){_0x4138cb[_0x7e01('0x25')][_0x7e01('0x6c')]=_0x1be549[0x0];if(!_0x593aeb[_0x7e01('0x53')]['UserId'])return;return db[_0x7e01('0x6d')][_0x7e01('0x52')]({'where':{'id':_0x593aeb[_0x7e01('0x53')]['UserId'],'role':'agent'},'attributes':['id',_0x7e01('0x34'),'fullname',_0x7e01('0x6e'),_0x7e01('0x6f')],'raw':!![]});}return null;})['then'](function(_0x3aef24){if(!_0x3aef24)return null;_0x4138cb[_0x7e01('0x25')][_0x7e01('0x5d')]=_0x3aef24;return _0x4138cb;})['then'](function(_0x385f10){if(_0x385f10){if(_0x593aeb['body'][_0x7e01('0x70')]){_0x4138cb[_0x7e01('0x25')][_0x7e01('0x71')]=util[_0x7e01('0x59')](_0x7e01('0x72'),_0x593aeb[_0x7e01('0x5c')][_0x7e01('0x34')]);_0x4138cb[_0x7e01('0x25')][_0x7e01('0x73')]=_0x4138cb[_0x7e01('0x73')];_0x4138cb[_0x7e01('0x25')]['motionChannel']=_0x4138cb['channel'];_0x4138cb['message'][_0x7e01('0x74')]=_0x7e01('0x75');return respondWithRpcPromise(_0x7e01('0x76'),'EventManager',{'event':_0x7e01('0x77'),'message':_0x4138cb['message']},client9002)[_0x7e01('0x32')](function(){return _0x4138cb;});}return _0x4138cb;}return null;})[_0x7e01('0x32')](respondWithResult(_0x3be550,null))[_0x7e01('0x54')](handleError(_0x3be550,null));};var interaction_log=require(_0x7e01('0x13'))('fax-interactions');exports[_0x7e01('0x78')]=function(_0xa62b0b,_0x4aca4d,_0x59ee70){var _0x4dafb2={'agent':{},'channel':_0x7e01('0x56')};if(_0xa62b0b[_0x7e01('0x53')]['id']){delete _0xa62b0b['body']['id'];}_0xa62b0b[_0x7e01('0x53')][_0x7e01('0x5b')]=_0xa62b0b[_0x7e01('0x53')][_0x7e01('0x5b')]||_0xa62b0b[_0x7e01('0x5c')]['id'];_0x4dafb2[_0x7e01('0x5d')]['id']=_0xa62b0b[_0x7e01('0x53')][_0x7e01('0x5b')];return db[_0x7e01('0x35')][_0x7e01('0x52')]({'where':{'id':_0xa62b0b[_0x7e01('0x50')]['id'],'UserId':null}})[_0x7e01('0x32')](handleEntityNotFound(_0x4aca4d,null))[_0x7e01('0x32')](function(_0xd7bb78){if(_0xd7bb78){_0x4dafb2[_0x7e01('0x25')]=_0xd7bb78['get']({'plain':!![]});return db[_0x7e01('0x79')][_0x7e01('0x52')]({'where':{'id':_0xd7bb78[_0x7e01('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x4aca4d,null))[_0x7e01('0x32')](function(_0x21a6eb){if(_0x21a6eb){_0x4dafb2[_0x7e01('0x62')]=_0x21a6eb[_0x7e01('0x5e')]({'plain':!![]});interaction_log[_0x7e01('0x1f')](_0x7e01('0x7a'),_0xa62b0b[_0x7e01('0x5c')]['id'],_0xa62b0b[_0x7e01('0x5c')][_0x7e01('0x34')],_0xa62b0b[_0x7e01('0x5c')]['role'],_0x4dafb2[_0x7e01('0x62')]['id'],_0xa62b0b[_0x7e01('0x53')]?JSON[_0x7e01('0x65')](_0xa62b0b[_0x7e01('0x53')]):'null');return respondWithRpcPromise(_0x7e01('0x7b'),_0x7e01('0x7c'),_0x4dafb2);}return null;})[_0x7e01('0x32')](function(_0x4e48c6){var _0x47d11a=_0x7e01('0x67')+_0x4e48c6[_0x7e01('0x25')][_0x7e01('0x68')];return db[_0x7e01('0x69')]['query'](_0x47d11a,{'type':db[_0x7e01('0x6a')][_0x7e01('0x7d')][_0x7e01('0x6b')],'raw':!![]})[_0x7e01('0x32')](function(_0x43a314){return _0x43a314;});})[_0x7e01('0x32')](function(_0x5cef56){if(_0x5cef56){_0x4dafb2[_0x7e01('0x25')][_0x7e01('0x6c')]=_0x5cef56[0x0];if(!_0xa62b0b[_0x7e01('0x53')][_0x7e01('0x5b')])return;return db['User'][_0x7e01('0x52')]({'where':{'id':_0xa62b0b[_0x7e01('0x53')][_0x7e01('0x5b')],'role':_0x7e01('0x5d')},'attributes':['id','name',_0x7e01('0x7e'),_0x7e01('0x6e'),_0x7e01('0x6f')],'raw':!![]});}return null;})[_0x7e01('0x32')](function(_0x28a4de){if(!_0x28a4de)return null;_0x4dafb2[_0x7e01('0x25')]['agent']=_0x28a4de;return _0x4dafb2;})[_0x7e01('0x32')](function(_0x3e24bf){if(_0x3e24bf){_0x3e24bf[_0x7e01('0x25')]['interface']=util['format'](_0x7e01('0x72'),_0xa62b0b['user'][_0x7e01('0x34')]);_0x3e24bf['message']['channel']=_0x4dafb2[_0x7e01('0x73')];_0x3e24bf[_0x7e01('0x25')][_0x7e01('0x7f')]=_0x4dafb2[_0x7e01('0x73')];_0x3e24bf[_0x7e01('0x25')][_0x7e01('0x74')]='reject';respondWithRpcPromise(_0x7e01('0x76'),_0x7e01('0x76'),{'event':_0x7e01('0x80'),'message':_0x3e24bf[_0x7e01('0x25')]},client9002);return _0x4dafb2;}return null;})['then'](respondWithResult(_0x4aca4d,null))[_0x7e01('0x54')](handleError(_0x4aca4d,null));};exports['create']=function(_0x1f5557,_0x113061){var _0x51323c;return db['FaxMessage']['create'](_0x1f5557['body'],{})['then'](function(_0x511ffe){_0x51323c=_0x511ffe;return db[_0x7e01('0x81')][_0x7e01('0x82')]({'where':{'id':_0x51323c[_0x7e01('0x68')]}});})['then'](function(_0x5b915e){if(_[_0x7e01('0x60')](_0x5b915e)){return;}else{_0x51323c[_0x7e01('0x56')]=_0x5b915e[_0x7e01('0x56')];return db[_0x7e01('0x83')]['findOne']({'where':{'id':_0x51323c[_0x7e01('0x84')]}});}})['then'](function(_0x4652f2){return respondWithRpcPromise(_0x7e01('0x85'),_0x7e01('0x85'),{'FaxAccountId':_[_0x7e01('0x60')](_0x1f5557[_0x7e01('0x53')])?undefined:_0x1f5557[_0x7e01('0x53')][_0x7e01('0x86')],'path':_[_0x7e01('0x60')](_0x4652f2)?undefined:util[_0x7e01('0x59')](_0x7e01('0x87'),_0x4652f2[_0x7e01('0x88')]),'fax':_[_0x7e01('0x60')](_0x51323c[_0x7e01('0x56')])?undefined:_0x51323c['fax'],'AttachmentId':_0x51323c[_0x7e01('0x84')]},client9002);})['then'](respondWithResult(_0x113061,0xc9))[_0x7e01('0x54')](handleError(_0x113061,null));};exports[_0x7e01('0x89')]=function(_0x37c0f5,_0x3ccafc){var _0x18272a=path[_0x7e01('0x8a')](config['root'],_0x7e01('0x8b'),_0x7e01('0x8c'),_0x7e01('0x8d'));return db[_0x7e01('0x35')][_0x7e01('0x52')]({'where':{'id':_0x37c0f5[_0x7e01('0x50')]['id']},'include':[{'model':db[_0x7e01('0x83')],'as':'Attachment'}]})[_0x7e01('0x32')](handleEntityNotFound(_0x3ccafc,null))[_0x7e01('0x32')](function(_0x5a1775){if(_0x5a1775){return _0x3ccafc[_0x7e01('0x89')](path['join'](_0x18272a,_0x5a1775[_0x7e01('0x83')][_0x7e01('0x88')]));}})[_0x7e01('0x54')](handleError(_0x3ccafc,null));}; \ No newline at end of file +var _0xc315=['create','CmContact','Attachment','findOne','AttachmentId','SendFax','isNil','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','join','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','register','client','http','request','info','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','length','find','body','params','destroy','fax-interactions','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','FaxInteraction','FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','SIP/%s','channel','accept','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','fullname','interface','motionChannel','rejectmessage'];(function(_0x2c24a7,_0x426dc2){var _0x4eaac9=function(_0x3784ec){while(--_0x3784ec){_0x2c24a7['push'](_0x2c24a7['shift']());}};_0x4eaac9(++_0x426dc2);}(_0xc315,0x1cb));var _0x5c31=function(_0x583be6,_0x4a62ab){_0x583be6=_0x583be6-0x0;var _0x3b2f73=_0xc315[_0x583be6];return _0x3b2f73;};'use strict';var emlformat=require(_0x5c31('0x0'));var rimraf=require(_0x5c31('0x1'));var zipdir=require(_0x5c31('0x2'));var jsonpatch=require(_0x5c31('0x3'));var rp=require('request-promise');var moment=require(_0x5c31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c31('0x5'));var util=require('util');var path=require(_0x5c31('0x6'));var sox=require(_0x5c31('0x7'));var csv=require(_0x5c31('0x8'));var ejs=require(_0x5c31('0x9'));var fs=require('fs');var fs_extra=require(_0x5c31('0xa'));var _=require(_0x5c31('0xb'));var squel=require(_0x5c31('0xc'));var crypto=require(_0x5c31('0xd'));var jsforce=require(_0x5c31('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5c31('0xf'));var Papa=require(_0x5c31('0x10'));var Redis=require(_0x5c31('0x11'));var authService=require(_0x5c31('0x12'));var qs=require(_0x5c31('0x13'));var as=require(_0x5c31('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c31('0x15'))(_0x5c31('0x16'));var utils=require(_0x5c31('0x17'));var config=require(_0x5c31('0x18'));var licenseUtil=require(_0x5c31('0x19'));var db=require(_0x5c31('0x1a'))['db'];config['redis']=_[_0x5c31('0x1b')](config['redis'],{'host':_0x5c31('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5c31('0x1d')]));require('./faxMessage.socket')[_0x5c31('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5c31('0x1f')][_0x5c31('0x20')]({'port':0x232c});var client9002=jayson[_0x5c31('0x1f')][_0x5c31('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x319ce1,_0x25d99a,_0x3a8966,_0x3811d8){return new BPromise(function(_0xab61b5,_0x4127c2){var _0x42cb5c=_0x3811d8||client;return _0x42cb5c[_0x5c31('0x21')](_0x319ce1,_0x3a8966)['then'](function(_0x5161d2){logger[_0x5c31('0x22')]('FaxMessage,\x20%s,\x20%s',_0x25d99a,_0x5c31('0x23'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x25d99a,'request\x20sent',JSON[_0x5c31('0x24')](_0x5161d2));if(_0x5161d2[_0x5c31('0x25')]){if(_0x5161d2[_0x5c31('0x25')][_0x5c31('0x26')]===0x1f4){logger[_0x5c31('0x25')](_0x5c31('0x27'),_0x25d99a,_0x5161d2[_0x5c31('0x25')][_0x5c31('0x28')]);return _0x4127c2(_0x5161d2['error'][_0x5c31('0x28')]);}logger[_0x5c31('0x25')]('FaxMessage,\x20%s,\x20%s',_0x25d99a,_0x5161d2[_0x5c31('0x25')][_0x5c31('0x28')]);return _0xab61b5(_0x5161d2[_0x5c31('0x25')]['message']);}else{logger[_0x5c31('0x22')](_0x5c31('0x27'),_0x25d99a,_0x5c31('0x23'));_0xab61b5(_0x5161d2[_0x5c31('0x29')][_0x5c31('0x28')]);}})[_0x5c31('0x2a')](function(_0x25913d){logger[_0x5c31('0x25')](_0x5c31('0x27'),_0x25d99a,_0x25913d);_0x4127c2(_0x25913d);});});}function respondWithStatusCode(_0x512c62,_0xb2ffe8){_0xb2ffe8=_0xb2ffe8||0xcc;return function(_0x26dd9a){if(_0x26dd9a){return _0x512c62[_0x5c31('0x2b')](_0xb2ffe8);}return _0x512c62[_0x5c31('0x2c')](_0xb2ffe8)[_0x5c31('0x2d')]();};}function respondWithResult(_0x4d39a9,_0x574473){_0x574473=_0x574473||0xc8;return function(_0x3900f4){if(_0x3900f4){return _0x4d39a9['status'](_0x574473)[_0x5c31('0x2e')](_0x3900f4);}};}function respondWithFilteredResult(_0x4d87e2,_0x1b6143){return function(_0x3d122f){if(_0x3d122f){var _0x2de112=typeof _0x1b6143[_0x5c31('0x2f')]==='undefined'&&typeof _0x1b6143['limit']===_0x5c31('0x30');var _0x37751b=_0x3d122f['count'];var _0x52d51e=_0x2de112?0x0:_0x1b6143['offset'];var _0x226ad3=_0x2de112?_0x3d122f['count']:_0x1b6143['offset']+_0x1b6143[_0x5c31('0x31')];var _0x2244e1;if(_0x226ad3>=_0x37751b){_0x226ad3=_0x37751b;_0x2244e1=0xc8;}else{_0x2244e1=0xce;}_0x4d87e2[_0x5c31('0x2c')](_0x2244e1);return _0x4d87e2[_0x5c31('0x32')](_0x5c31('0x33'),_0x52d51e+'-'+_0x226ad3+'/'+_0x37751b)['json'](_0x3d122f);}return null;};}function patchUpdates(_0x1407fc){return function(_0x3f6945){try{jsonpatch[_0x5c31('0x34')](_0x3f6945,_0x1407fc,!![]);}catch(_0x392fff){return BPromise[_0x5c31('0x35')](_0x392fff);}return _0x3f6945['save']();};}function saveUpdates(_0xd82f60,_0x3b4b8b){return function(_0x4692dd){if(_0x4692dd){return _0x4692dd[_0x5c31('0x36')](_0xd82f60)[_0x5c31('0x37')](function(_0x3277df){return _0x3277df;});}return null;};}function removeEntity(_0xa39835,_0x33a6a4){return function(_0x983b9f){if(_0x983b9f){return _0x983b9f['destroy']()[_0x5c31('0x37')](function(){_0xa39835[_0x5c31('0x2c')](0xcc)[_0x5c31('0x2d')]();});}};}function handleEntityNotFound(_0x422dfe,_0xe67fd5){return function(_0x107c96){if(!_0x107c96){_0x422dfe['sendStatus'](0x194);}return _0x107c96;};}function handleError(_0x12a753,_0x505da5){_0x505da5=_0x505da5||0x1f4;return function(_0x539641){logger[_0x5c31('0x25')](_0x539641[_0x5c31('0x38')]);if(_0x539641[_0x5c31('0x39')]){delete _0x539641[_0x5c31('0x39')];}_0x12a753[_0x5c31('0x2c')](_0x505da5)['send'](_0x539641);};}exports[_0x5c31('0x3a')]=function(_0x5cefc0,_0x5af917){var _0x3ad27c={},_0x190e74={},_0x4fd334={'count':0x0,'rows':[]};var _0x3592c2=_[_0x5c31('0x3b')](db[_0x5c31('0x3c')][_0x5c31('0x3d')],function(_0x49b95e){return{'name':_0x49b95e[_0x5c31('0x3e')],'type':_0x49b95e[_0x5c31('0x3f')][_0x5c31('0x40')]};});_0x190e74['model']=_[_0x5c31('0x3b')](_0x3592c2,_0x5c31('0x39'));_0x190e74[_0x5c31('0x41')]=_[_0x5c31('0x42')](_0x5cefc0['query']);_0x190e74[_0x5c31('0x43')]=_[_0x5c31('0x44')](_0x190e74[_0x5c31('0x45')],_0x190e74[_0x5c31('0x41')]);_0x3ad27c['attributes']=_['intersection'](_0x190e74['model'],qs['fields'](_0x5cefc0[_0x5c31('0x41')][_0x5c31('0x46')]));_0x3ad27c[_0x5c31('0x47')]=_0x3ad27c[_0x5c31('0x47')]['length']?_0x3ad27c[_0x5c31('0x47')]:_0x190e74[_0x5c31('0x45')];if(!_0x5cefc0['query'][_0x5c31('0x48')](_0x5c31('0x49'))){_0x3ad27c[_0x5c31('0x31')]=qs[_0x5c31('0x31')](_0x5cefc0[_0x5c31('0x41')][_0x5c31('0x31')]);_0x3ad27c[_0x5c31('0x2f')]=qs[_0x5c31('0x2f')](_0x5cefc0[_0x5c31('0x41')][_0x5c31('0x2f')]);}_0x3ad27c[_0x5c31('0x4a')]=qs[_0x5c31('0x4b')](_0x5cefc0[_0x5c31('0x41')][_0x5c31('0x4b')]);_0x3ad27c[_0x5c31('0x4c')]=qs[_0x5c31('0x43')](_[_0x5c31('0x4d')](_0x5cefc0[_0x5c31('0x41')],_0x190e74[_0x5c31('0x43')]),_0x3592c2);if(_0x5cefc0['query'][_0x5c31('0x4e')]){_0x3ad27c[_0x5c31('0x4c')]=_[_0x5c31('0x4f')](_0x3ad27c[_0x5c31('0x4c')],{'$or':_[_0x5c31('0x3b')](_0x3592c2,function(_0x4c5597){if(_0x4c5597['type']!==_0x5c31('0x50')){var _0x5c48e9={};_0x5c48e9[_0x4c5597[_0x5c31('0x39')]]={'$like':'%'+_0x5cefc0[_0x5c31('0x41')][_0x5c31('0x4e')]+'%'};return _0x5c48e9;}})});}_0x3ad27c=_['merge']({},_0x3ad27c,_0x5cefc0[_0x5c31('0x51')]);var _0x253c81={'where':_0x3ad27c[_0x5c31('0x4c')]};return db[_0x5c31('0x3c')][_0x5c31('0x52')](_0x253c81)[_0x5c31('0x37')](function(_0x4d7ca6){_0x4fd334[_0x5c31('0x52')]=_0x4d7ca6;if(_0x5cefc0[_0x5c31('0x41')]['includeAll']){_0x3ad27c[_0x5c31('0x53')]=[{'all':!![]}];}return db[_0x5c31('0x3c')][_0x5c31('0x54')](_0x3ad27c);})[_0x5c31('0x37')](function(_0x762420){_0x4fd334[_0x5c31('0x55')]=_0x762420;return _0x4fd334;})[_0x5c31('0x37')](respondWithFilteredResult(_0x5af917,_0x3ad27c))['catch'](handleError(_0x5af917,null));};exports[_0x5c31('0x56')]=function(_0x1b990e,_0x843037){var _0x4421ee={'raw':!![],'where':{'id':_0x1b990e['params']['id']}},_0xf8293b={};_0xf8293b[_0x5c31('0x45')]=_['keys'](db['FaxMessage'][_0x5c31('0x3d')]);_0xf8293b['query']=_[_0x5c31('0x42')](_0x1b990e[_0x5c31('0x41')]);_0xf8293b[_0x5c31('0x43')]=_[_0x5c31('0x44')](_0xf8293b[_0x5c31('0x45')],_0xf8293b[_0x5c31('0x41')]);_0x4421ee['attributes']=_['intersection'](_0xf8293b[_0x5c31('0x45')],qs['fields'](_0x1b990e['query'][_0x5c31('0x46')]));_0x4421ee[_0x5c31('0x47')]=_0x4421ee[_0x5c31('0x47')][_0x5c31('0x57')]?_0x4421ee[_0x5c31('0x47')]:_0xf8293b['model'];if(_0x1b990e[_0x5c31('0x41')]['includeAll']){_0x4421ee[_0x5c31('0x53')]=[{'all':!![]}];}_0x4421ee=_[_0x5c31('0x4f')]({},_0x4421ee,_0x1b990e[_0x5c31('0x51')]);return db[_0x5c31('0x3c')][_0x5c31('0x58')](_0x4421ee)[_0x5c31('0x37')](handleEntityNotFound(_0x843037,null))[_0x5c31('0x37')](respondWithResult(_0x843037,null))[_0x5c31('0x2a')](handleError(_0x843037,null));};exports[_0x5c31('0x36')]=function(_0x38dc27,_0xf7f79b){if(_0x38dc27[_0x5c31('0x59')]['id']){delete _0x38dc27[_0x5c31('0x59')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x38dc27[_0x5c31('0x5a')]['id']}})[_0x5c31('0x37')](handleEntityNotFound(_0xf7f79b,null))['then'](saveUpdates(_0x38dc27[_0x5c31('0x59')],null))[_0x5c31('0x37')](respondWithResult(_0xf7f79b,null))[_0x5c31('0x2a')](handleError(_0xf7f79b,null));};exports[_0x5c31('0x5b')]=function(_0x1f0783,_0x59d279){return db[_0x5c31('0x3c')][_0x5c31('0x58')]({'where':{'id':_0x1f0783[_0x5c31('0x5a')]['id']}})['then'](handleEntityNotFound(_0x59d279,null))[_0x5c31('0x37')](removeEntity(_0x59d279,null))[_0x5c31('0x2a')](handleError(_0x59d279,null));};exports['describe']=function(_0x49dedc,_0x35486a){return db[_0x5c31('0x3c')]['describe']()['then'](respondWithResult(_0x35486a,null))[_0x5c31('0x2a')](handleError(_0x35486a,null));};var interaction_log=require('../../config/logger')(_0x5c31('0x5c'));exports['accept']=function(_0x3077de,_0xeb6015,_0x4a1709){var _0x4a2d06={'agent':{},'channel':_0x5c31('0x5d')};if(_0x3077de[_0x5c31('0x59')]['id']){delete _0x3077de[_0x5c31('0x59')]['id'];}_0x3077de[_0x5c31('0x59')][_0x5c31('0x5e')]=!![];_0x3077de['body'][_0x5c31('0x5f')]=moment()[_0x5c31('0x60')](_0x5c31('0x61'));_0x3077de[_0x5c31('0x59')][_0x5c31('0x62')]=_0x3077de[_0x5c31('0x59')][_0x5c31('0x62')]||_0x3077de[_0x5c31('0x63')]['id'];_0x4a2d06['agent']['id']=_0x3077de[_0x5c31('0x59')][_0x5c31('0x62')];return db['FaxMessage'][_0x5c31('0x58')]({'where':{'id':_0x3077de['params']['id'],'UserId':null}})[_0x5c31('0x37')](handleEntityNotFound(_0xeb6015,null))[_0x5c31('0x37')](saveUpdates(_0x3077de[_0x5c31('0x59')],null))[_0x5c31('0x37')](function(_0x4bb1a3){if(_0x4bb1a3){_0x4a2d06['message']=_0x4bb1a3['get']({'plain':!![]});return db[_0x5c31('0x64')][_0x5c31('0x58')]({'where':{'id':_0x4bb1a3[_0x5c31('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xeb6015,null))[_0x5c31('0x37')](function(_0x21e901){if(_0x21e901){return _0x21e901['update']({'UserId':_0x3077de['body'][_0x5c31('0x62')],'read1stAt':_['isNil'](_0x21e901[_0x5c31('0x66')])?moment()[_0x5c31('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5c31('0x37')](function(_0xfe0dff){if(_0xfe0dff){_0x4a2d06[_0x5c31('0x67')]=_0xfe0dff[_0x5c31('0x68')]({'plain':!![]});interaction_log['info'](_0x5c31('0x69'),_0x3077de[_0x5c31('0x63')]['id'],_0x3077de['user'][_0x5c31('0x39')],_0x3077de[_0x5c31('0x63')][_0x5c31('0x6a')],_0x4a2d06[_0x5c31('0x67')]['id'],_0x3077de[_0x5c31('0x59')]?JSON['stringify'](_0x3077de['body']):_0x5c31('0x6b'));return respondWithRpcPromise(_0x5c31('0x6c'),'acceptMessage',_0x4a2d06);}return null;})['then'](function(_0x5b47fd){var _0x4d1fe2=_0x5c31('0x6d')+_0x5b47fd[_0x5c31('0x28')]['ContactId'];return db[_0x5c31('0x6e')][_0x5c31('0x41')](_0x4d1fe2,{'type':db[_0x5c31('0x6f')][_0x5c31('0x70')][_0x5c31('0x71')],'raw':!![]})[_0x5c31('0x37')](function(_0x4ceaa9){return _0x4ceaa9;});})[_0x5c31('0x37')](function(_0x341548){if(_0x341548){_0x4a2d06[_0x5c31('0x28')][_0x5c31('0x72')]=_0x341548[0x0];if(!_0x3077de['body'][_0x5c31('0x62')])return;return db[_0x5c31('0x73')][_0x5c31('0x58')]({'where':{'id':_0x3077de[_0x5c31('0x59')]['UserId'],'role':_0x5c31('0x74')},'attributes':['id',_0x5c31('0x39'),'fullname',_0x5c31('0x75'),_0x5c31('0x76')],'raw':!![]});}return null;})['then'](function(_0x35e942){if(!_0x35e942)return null;_0x4a2d06[_0x5c31('0x28')][_0x5c31('0x74')]=_0x35e942;return _0x4a2d06;})[_0x5c31('0x37')](function(_0x1d28a2){if(_0x1d28a2){if(_0x3077de[_0x5c31('0x59')][_0x5c31('0x77')]){_0x4a2d06[_0x5c31('0x28')]['interface']=util['format'](_0x5c31('0x78'),_0x3077de[_0x5c31('0x63')]['name']);_0x4a2d06[_0x5c31('0x28')][_0x5c31('0x79')]=_0x4a2d06[_0x5c31('0x79')];_0x4a2d06[_0x5c31('0x28')]['motionChannel']=_0x4a2d06['channel'];_0x4a2d06[_0x5c31('0x28')]['event']=_0x5c31('0x7a');return respondWithRpcPromise(_0x5c31('0x7b'),_0x5c31('0x7b'),{'event':_0x5c31('0x7c'),'message':_0x4a2d06['message']},client9002)[_0x5c31('0x37')](function(){return _0x4a2d06;});}return _0x4a2d06;}return null;})['then'](respondWithResult(_0xeb6015,null))[_0x5c31('0x2a')](handleError(_0xeb6015,null));};var interaction_log=require(_0x5c31('0x15'))(_0x5c31('0x5c'));exports[_0x5c31('0x35')]=function(_0x15083b,_0x18a29d,_0x77ac7e){var _0x57c72a={'agent':{},'channel':_0x5c31('0x5d')};if(_0x15083b[_0x5c31('0x59')]['id']){delete _0x15083b[_0x5c31('0x59')]['id'];}_0x15083b[_0x5c31('0x59')][_0x5c31('0x62')]=_0x15083b[_0x5c31('0x59')][_0x5c31('0x62')]||_0x15083b[_0x5c31('0x63')]['id'];_0x57c72a['agent']['id']=_0x15083b[_0x5c31('0x59')][_0x5c31('0x62')];return db[_0x5c31('0x3c')][_0x5c31('0x58')]({'where':{'id':_0x15083b[_0x5c31('0x5a')]['id'],'UserId':null}})[_0x5c31('0x37')](handleEntityNotFound(_0x18a29d,null))[_0x5c31('0x37')](function(_0x4e2f93){if(_0x4e2f93){_0x57c72a['message']=_0x4e2f93[_0x5c31('0x68')]({'plain':!![]});return db['FaxInteraction'][_0x5c31('0x58')]({'where':{'id':_0x4e2f93[_0x5c31('0x65')]}});}return null;})[_0x5c31('0x37')](handleEntityNotFound(_0x18a29d,null))[_0x5c31('0x37')](function(_0x1e96bf){if(_0x1e96bf){_0x57c72a['interaction']=_0x1e96bf[_0x5c31('0x68')]({'plain':!![]});interaction_log[_0x5c31('0x22')](_0x5c31('0x7d'),_0x15083b[_0x5c31('0x63')]['id'],_0x15083b[_0x5c31('0x63')][_0x5c31('0x39')],_0x15083b[_0x5c31('0x63')][_0x5c31('0x6a')],_0x57c72a[_0x5c31('0x67')]['id'],_0x15083b[_0x5c31('0x59')]?JSON[_0x5c31('0x24')](_0x15083b[_0x5c31('0x59')]):_0x5c31('0x6b'));return respondWithRpcPromise(_0x5c31('0x7e'),_0x5c31('0x7f'),_0x57c72a);}return null;})[_0x5c31('0x37')](function(_0x590fcf){var _0x147ae2=_0x5c31('0x6d')+_0x590fcf[_0x5c31('0x28')][_0x5c31('0x80')];return db[_0x5c31('0x6e')][_0x5c31('0x41')](_0x147ae2,{'type':db[_0x5c31('0x6f')][_0x5c31('0x70')]['SELECT'],'raw':!![]})[_0x5c31('0x37')](function(_0x4d8965){return _0x4d8965;});})[_0x5c31('0x37')](function(_0x58b9c1){if(_0x58b9c1){_0x57c72a[_0x5c31('0x28')][_0x5c31('0x72')]=_0x58b9c1[0x0];if(!_0x15083b['body'][_0x5c31('0x62')])return;return db['User'][_0x5c31('0x58')]({'where':{'id':_0x15083b[_0x5c31('0x59')][_0x5c31('0x62')],'role':'agent'},'attributes':['id',_0x5c31('0x39'),_0x5c31('0x81'),_0x5c31('0x75'),_0x5c31('0x76')],'raw':!![]});}return null;})[_0x5c31('0x37')](function(_0x99a5a8){if(!_0x99a5a8)return null;_0x57c72a['message'][_0x5c31('0x74')]=_0x99a5a8;return _0x57c72a;})[_0x5c31('0x37')](function(_0x39b578){if(_0x39b578){_0x39b578[_0x5c31('0x28')][_0x5c31('0x82')]=util[_0x5c31('0x60')]('SIP/%s',_0x15083b[_0x5c31('0x63')][_0x5c31('0x39')]);_0x39b578[_0x5c31('0x28')][_0x5c31('0x79')]=_0x57c72a['channel'];_0x39b578[_0x5c31('0x28')][_0x5c31('0x83')]=_0x57c72a['channel'];_0x39b578[_0x5c31('0x28')]['event']=_0x5c31('0x35');respondWithRpcPromise('EventManager',_0x5c31('0x7b'),{'event':_0x5c31('0x84'),'message':_0x39b578['message']},client9002);return _0x57c72a;}return null;})[_0x5c31('0x37')](respondWithResult(_0x18a29d,null))[_0x5c31('0x2a')](handleError(_0x18a29d,null));};exports[_0x5c31('0x85')]=function(_0xe9542f,_0x51129b){var _0x1a2791;return db[_0x5c31('0x3c')][_0x5c31('0x85')](_0xe9542f[_0x5c31('0x59')],{})[_0x5c31('0x37')](function(_0x4ed63e){_0x1a2791=_0x4ed63e;return db[_0x5c31('0x86')]['findOne']({'where':{'id':_0x1a2791[_0x5c31('0x80')]}});})[_0x5c31('0x37')](function(_0x135076){if(_['isNil'](_0x135076)){return;}else{_0x1a2791[_0x5c31('0x5d')]=_0x135076['fax'];return db[_0x5c31('0x87')][_0x5c31('0x88')]({'where':{'id':_0x1a2791[_0x5c31('0x89')]}});}})[_0x5c31('0x37')](function(_0x3cb32d){return respondWithRpcPromise(_0x5c31('0x8a'),'SendFax',{'FaxAccountId':_[_0x5c31('0x8b')](_0xe9542f['body'])?undefined:_0xe9542f[_0x5c31('0x59')][_0x5c31('0x8c')],'path':_[_0x5c31('0x8b')](_0x3cb32d)?undefined:util[_0x5c31('0x60')](_0x5c31('0x8d'),_0x3cb32d['basename']),'fax':_[_0x5c31('0x8b')](_0x1a2791[_0x5c31('0x5d')])?undefined:_0x1a2791['fax'],'AttachmentId':_0x1a2791[_0x5c31('0x89')]},client9002);})['then'](respondWithResult(_0x51129b,0xc9))[_0x5c31('0x2a')](handleError(_0x51129b,null));};exports[_0x5c31('0x8e')]=function(_0x12f2b6,_0x3894d5){var _0x42ba05=path['join'](config[_0x5c31('0x8f')],_0x5c31('0x90'),_0x5c31('0x91'),_0x5c31('0x92'));return db[_0x5c31('0x3c')][_0x5c31('0x58')]({'where':{'id':_0x12f2b6[_0x5c31('0x5a')]['id']},'include':[{'model':db[_0x5c31('0x87')],'as':_0x5c31('0x87')}]})[_0x5c31('0x37')](handleEntityNotFound(_0x3894d5,null))[_0x5c31('0x37')](function(_0x22b9f6){if(_0x22b9f6){return _0x3894d5['download'](path[_0x5c31('0x93')](_0x42ba05,_0x22b9f6['Attachment']['basename']));}})[_0x5c31('0x2a')](handleError(_0x3894d5,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index fb89646..1896937 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 _0x1fcc=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x222b97,_0x576e48){var _0x4742bb=function(_0x4cf75e){while(--_0x4cf75e){_0x222b97['push'](_0x222b97['shift']());}};_0x4742bb(++_0x576e48);}(_0x1fcc,0x125));var _0xc1fc=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0x1fcc[_0x1a0ef3];return _0x2b86da;};'use strict';var EventEmitter=require(_0xc1fc('0x0'));var FaxMessage=require(_0xc1fc('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc1fc('0x2')](0x0);var events={'afterCreate':_0xc1fc('0x3'),'afterUpdate':_0xc1fc('0x4'),'afterDestroy':_0xc1fc('0x5')};function emitEvent(_0x30234a){return function(_0x2e6a9b,_0xf9bb59,_0x51605f){FaxMessageEvents[_0xc1fc('0x6')](_0x30234a+':'+_0x2e6a9b['id'],_0x2e6a9b);FaxMessageEvents[_0xc1fc('0x6')](_0x30234a,_0x2e6a9b);_0x51605f(null);};}for(var e in events){if(events[_0xc1fc('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xc1fc('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x2e88=['../../mysqldb','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2ff1f6,_0x1bc588){var _0xbae96d=function(_0x505c67){while(--_0x505c67){_0x2ff1f6['push'](_0x2ff1f6['shift']());}};_0xbae96d(++_0x1bc588);}(_0x2e88,0x95));var _0x82e8=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x2e88[_0x3daa8c];return _0x2b1bd7;};'use strict';var EventEmitter=require(_0x82e8('0x0'));var FaxMessage=require(_0x82e8('0x1'))['db'][_0x82e8('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x82e8('0x3')](0x0);var events={'afterCreate':_0x82e8('0x4'),'afterUpdate':_0x82e8('0x5'),'afterDestroy':'remove'};function emitEvent(_0x40c9c5){return function(_0x1d7415,_0x576435,_0x3aed37){FaxMessageEvents[_0x82e8('0x6')](_0x40c9c5+':'+_0x1d7415['id'],_0x1d7415);FaxMessageEvents['emit'](_0x40c9c5,_0x1d7415);_0x3aed37(null);};}for(var e in events){if(events[_0x82e8('0x7')](e)){var event=events[e];FaxMessage[_0x82e8('0x8')](e,emitEvent(event));}}module[_0x82e8('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index c4f0ed9..458ba90 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 _0xb6bf=['FULLTEXT','get','direction','out','secret','isNil','UserId','FaxInteraction','findOne','toLowerCase','error','utf8mb4','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','fax_messages','fti_fax_messages','body'];(function(_0x5e1ca7,_0xfbbac8){var _0x3a50cb=function(_0x1c726a){while(--_0x1c726a){_0x5e1ca7['push'](_0x5e1ca7['shift']());}};_0x3a50cb(++_0xfbbac8);}(_0xb6bf,0xb4));var _0xfb6b=function(_0x10049a,_0x32997f){_0x10049a=_0x10049a-0x0;var _0x31fa19=_0xb6bf[_0x10049a];return _0x31fa19;};'use strict';var _=require(_0xfb6b('0x0'));var util=require(_0xfb6b('0x1'));var logger=require('../../config/logger')(_0xfb6b('0x2'));var moment=require(_0xfb6b('0x3'));var BPromise=require(_0xfb6b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb6b('0x5'));var rimraf=require(_0xfb6b('0x6'));var config=require(_0xfb6b('0x7'));var attributes=require(_0xfb6b('0x8'));module['exports']=function(_0x4c623d,_0x290c1b){return _0x4c623d['define']('FaxMessage',attributes,{'tableName':_0xfb6b('0x9'),'paranoid':![],'indexes':[{'name':_0xfb6b('0xa'),'fields':[_0xfb6b('0xb')],'type':_0xfb6b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2db7c7,_0x32997f,_0x261b1a){var _0x1d6241=_0x4c623d['models'];var _0x1cd983=_0x2db7c7[_0xfb6b('0xd')]({'plain':!![]});if(_0x1cd983[_0xfb6b('0xe')]['toLowerCase']()==='in'||_0x1cd983['direction']['toLowerCase']()===_0xfb6b('0xf')&&!_0x1cd983[_0xfb6b('0x10')]&&!_[_0xfb6b('0x11')](_0x1cd983[_0xfb6b('0x12')])){_0x1d6241[_0xfb6b('0x13')][_0xfb6b('0x14')]({'where':{'id':_0x1cd983['FaxInteractionId']}})['then'](function(_0x279189){if(_0x279189){_0x279189['update']({'lastMsgAt':_0x1cd983['createdAt'],'lastMsgDirection':_0x1cd983[_0xfb6b('0xe')][_0xfb6b('0x15')]()});}})['catch'](function(_0x5d6d29){console[_0xfb6b('0x16')](_0x5d6d29);});}_0x261b1a();}},'charset':_0xfb6b('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x2101=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','out'];(function(_0x1d90f3,_0x2068d2){var _0x1f2938=function(_0x1e124e){while(--_0x1e124e){_0x1d90f3['push'](_0x1d90f3['shift']());}};_0x1f2938(++_0x2068d2);}(_0x2101,0x15b));var _0x1210=function(_0x59ec9c,_0x16bcab){_0x59ec9c=_0x59ec9c-0x0;var _0x23a17f=_0x2101[_0x59ec9c];return _0x23a17f;};'use strict';var _=require('lodash');var util=require(_0x1210('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1210('0x1'));var BPromise=require(_0x1210('0x2'));var rp=require(_0x1210('0x3'));var fs=require('fs');var path=require(_0x1210('0x4'));var rimraf=require(_0x1210('0x5'));var config=require('../../config/environment');var attributes=require(_0x1210('0x6'));module['exports']=function(_0x7a64ce,_0xe557ea){return _0x7a64ce[_0x1210('0x7')](_0x1210('0x8'),attributes,{'tableName':_0x1210('0x9'),'paranoid':![],'indexes':[{'name':_0x1210('0xa'),'fields':[_0x1210('0xb')],'type':_0x1210('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x176596,_0x4aa05a,_0xe54bf5){var _0x590674=_0x7a64ce[_0x1210('0xd')];var _0x68dee6=_0x176596[_0x1210('0xe')]({'plain':!![]});if(_0x68dee6['direction'][_0x1210('0xf')]()==='in'||_0x68dee6['direction'][_0x1210('0xf')]()===_0x1210('0x10')&&!_0x68dee6['secret']&&!_['isNil'](_0x68dee6['UserId'])){_0x590674[_0x1210('0x11')][_0x1210('0x12')]({'where':{'id':_0x68dee6[_0x1210('0x13')]}})[_0x1210('0x14')](function(_0x1f3498){if(_0x1f3498){_0x1f3498[_0x1210('0x15')]({'lastMsgAt':_0x68dee6[_0x1210('0x16')],'lastMsgDirection':_0x68dee6[_0x1210('0x17')][_0x1210('0xf')]()});}})[_0x1210('0x18')](function(_0x5199e1){console[_0x1210('0x19')](_0x5199e1);});}_0xe54bf5();}},'charset':_0x1210('0x1a'),'collate':_0x1210('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index f2669cd..ac7f56e 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7bae,0x13b));var _0xe7ba=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7bae[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0xed1f=['jayson/promise','client','http','redis','defaults','localhost','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','CreateFaxMessage','FaxMessage','create','body','options','raw','info','catch','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xed1f,0x6a));var _0xfed1=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xed1f[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});config[_0xfed1('0xe')]=_[_0xfed1('0xf')](config[_0xfed1('0xe')],{'host':_0xfed1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed1('0xe')]));require(_0xfed1('0x11'))['register'](socket);function respondWithRpcPromise(_0x1414be,_0x7bf48c,_0x4a564e){return new BPromise(function(_0x3ce017,_0x48c338){return client[_0xfed1('0x12')](_0x1414be,_0x4a564e)[_0xfed1('0x13')](function(_0x4a8369){logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));logger['debug'](_0xfed1('0x16'),_0x7bf48c,'request\x20sent',JSON['stringify'](_0x4a8369));if(_0x4a8369[_0xfed1('0x17')]){if(_0x4a8369[_0xfed1('0x17')]['code']===0x1f4){logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369['error'][_0xfed1('0x18')]);return _0x48c338(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}logger[_0xfed1('0x17')]('FaxMessage,\x20%s,\x20%s',_0x7bf48c,_0x4a8369[_0xfed1('0x17')]['message']);return _0x3ce017(_0x4a8369[_0xfed1('0x17')][_0xfed1('0x18')]);}else{logger['info'](_0xfed1('0x14'),_0x7bf48c,_0xfed1('0x15'));_0x3ce017(_0x4a8369['result']['message']);}})['catch'](function(_0x1e5afb){logger['error'](_0xfed1('0x14'),_0x7bf48c,_0x1e5afb);_0x48c338(_0x1e5afb);});});}exports[_0xfed1('0x19')]=function(_0x51a860){var _0x94cb84=this;return new Promise(function(_0x65f14b,_0x59ee9d){return db[_0xfed1('0x1a')][_0xfed1('0x1b')](_0x51a860[_0xfed1('0x1c')],{'raw':_0x51a860[_0xfed1('0x1d')]?_0x51a860['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x446558){logger[_0xfed1('0x1f')](_0xfed1('0x19'),_0x51a860);logger['debug'](_0xfed1('0x19'),_0x51a860,JSON['stringify'](_0x446558));_0x65f14b(_0x446558);})[_0xfed1('0x20')](function(_0x2793b7){logger[_0xfed1('0x17')](_0xfed1('0x19'),_0x2793b7[_0xfed1('0x18')],_0x51a860);_0x59ee9d(_0x94cb84[_0xfed1('0x17')](0x1f4,_0x2793b7['message']));});});};exports[_0xfed1('0x21')]=function(_0xcb1cdc){var _0x49072b=this;return new Promise(function(_0x1d6c72,_0x2b9dd2){return db[_0xfed1('0x1a')][_0xfed1('0x22')](_0xcb1cdc[_0xfed1('0x1c')],{'raw':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')]['where']||null:null,'attributes':_0xcb1cdc['options']?_0xcb1cdc[_0xfed1('0x1d')][_0xfed1('0x23')]||null:null,'limit':_0xcb1cdc[_0xfed1('0x1d')]?_0xcb1cdc['options'][_0xfed1('0x24')]||null:null})[_0xfed1('0x13')](function(_0x13f414){logger[_0xfed1('0x1f')](_0xfed1('0x21'),_0xcb1cdc);logger[_0xfed1('0x25')]('UpdateFaxMessage',_0xcb1cdc,JSON[_0xfed1('0x26')](_0x13f414));_0x1d6c72(_0x13f414);})[_0xfed1('0x20')](function(_0x4fc309){logger['error'](_0xfed1('0x21'),_0x4fc309[_0xfed1('0x18')],_0xcb1cdc);_0x2b9dd2(_0x49072b[_0xfed1('0x17')](0x1f4,_0x4fc309[_0xfed1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 91fa45e..92d8148 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 _0x3b4a=['./faxMessage.events','remove','emit','length'];(function(_0x46e62c,_0x466b58){var _0x459276=function(_0x424891){while(--_0x424891){_0x46e62c['push'](_0x46e62c['shift']());}};_0x459276(++_0x466b58);}(_0x3b4a,0x114));var _0xa3b4=function(_0x18b165,_0x40a7ea){_0x18b165=_0x18b165-0x0;var _0x1d8e19=_0x3b4a[_0x18b165];return _0x1d8e19;};'use strict';var FaxMessageEvents=require(_0xa3b4('0x0'));var events=['save',_0xa3b4('0x1'),'update'];function createListener(_0x568f74,_0x170ce2){return function(_0x539141){_0x170ce2[_0xa3b4('0x2')](_0x568f74,_0x539141);};}function removeListener(_0x4b341c,_0x28fc46){return function(){FaxMessageEvents['removeListener'](_0x4b341c,_0x28fc46);};}exports['register']=function(_0x90da56){for(var _0x37e35d=0x0,_0x3dc488=events[_0xa3b4('0x3')];_0x37e35d<_0x3dc488;_0x37e35d++){var _0xe7e5ff=events[_0x37e35d];var _0x574525=createListener('faxMessage:'+_0xe7e5ff,_0x90da56);FaxMessageEvents['on'](_0xe7e5ff,_0x574525);}}; \ No newline at end of file +var _0x36dc=['./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2ee6f6,_0x36c49b){var _0x29beec=function(_0xe53013){while(--_0xe53013){_0x2ee6f6['push'](_0x2ee6f6['shift']());}};_0x29beec(++_0x36c49b);}(_0x36dc,0x1da));var _0xc36d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x36dc[_0x2641f9];return _0x585741;};'use strict';var FaxMessageEvents=require(_0xc36d('0x0'));var events=[_0xc36d('0x1'),_0xc36d('0x2'),_0xc36d('0x3')];function createListener(_0x3ab312,_0x1a0a75){return function(_0x3bbfb7){_0x1a0a75[_0xc36d('0x4')](_0x3ab312,_0x3bbfb7);};}function removeListener(_0x367cce,_0x113162){return function(){FaxMessageEvents[_0xc36d('0x5')](_0x367cce,_0x113162);};}exports['register']=function(_0x386927){for(var _0x26f052=0x0,_0x198d34=events['length'];_0x26f052<_0x198d34;_0x26f052++){var _0x388539=events[_0x26f052];var _0x151295=createListener('faxMessage:'+_0x388539,_0x386927);FaxMessageEvents['on'](_0x388539,_0x151295);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0881b99..ff66c89 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 _0x2bc6=['reject','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','/:id/reject'];(function(_0x5ce0ef,_0x3f813e){var _0x6baf39=function(_0x5d0844){while(--_0x5d0844){_0x5ce0ef['push'](_0x5ce0ef['shift']());}};_0x6baf39(++_0x3f813e);}(_0x2bc6,0x163));var _0x62bc=function(_0x4dfe7f,_0x119573){_0x4dfe7f=_0x4dfe7f-0x0;var _0x943afe=_0x2bc6[_0x4dfe7f];return _0x943afe;};'use strict';var multer=require(_0x62bc('0x0'));var util=require(_0x62bc('0x1'));var path=require(_0x62bc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x62bc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x62bc('0x4'));var controller=require(_0x62bc('0x5'));router['get']('/',auth[_0x62bc('0x6')](),controller[_0x62bc('0x7')]);router[_0x62bc('0x8')](_0x62bc('0x9'),auth[_0x62bc('0x6')](),controller[_0x62bc('0xa')]);router['get'](_0x62bc('0xb'),auth[_0x62bc('0x6')](),controller[_0x62bc('0xc')]);router[_0x62bc('0x8')]('/:id/download',auth[_0x62bc('0x6')](),controller[_0x62bc('0xd')]);router[_0x62bc('0xe')]('/',auth['isAuthenticated'](),interaction[_0x62bc('0xf')](_0x62bc('0x10'),_0x62bc('0x11')),controller[_0x62bc('0x12')]);router[_0x62bc('0x13')](_0x62bc('0xb'),auth[_0x62bc('0x6')](),controller['update']);router[_0x62bc('0x13')](_0x62bc('0x14'),auth['isAuthenticated'](),controller[_0x62bc('0x15')]);router[_0x62bc('0x13')](_0x62bc('0x16'),auth['isAuthenticated'](),controller[_0x62bc('0x17')]);router[_0x62bc('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x62bc('0x19')]);module[_0x62bc('0x1a')]=router; \ No newline at end of file +var _0xf290=['/:id','show','/:id/download','download','post','fax','create','put','update','accept','/:id/reject','reject','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe'];(function(_0x27c7dd,_0x3cda2a){var _0x4be6ff=function(_0x2d9821){while(--_0x2d9821){_0x27c7dd['push'](_0x27c7dd['shift']());}};_0x4be6ff(++_0x3cda2a);}(_0xf290,0xde));var _0x0f29=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xf290[_0x4bcf38];return _0x4a89be;};'use strict';var multer=require('multer');var util=require(_0x0f29('0x0'));var path=require('path');var timeout=require(_0x0f29('0x1'));var express=require('express');var router=express[_0x0f29('0x2')]();var fs_extra=require(_0x0f29('0x3'));var auth=require(_0x0f29('0x4'));var interaction=require(_0x0f29('0x5'));var config=require(_0x0f29('0x6'));var controller=require('./faxMessage.controller');router[_0x0f29('0x7')]('/',auth['isAuthenticated'](),controller[_0x0f29('0x8')]);router[_0x0f29('0x7')](_0x0f29('0x9'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xb')]);router[_0x0f29('0x7')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xd')]);router[_0x0f29('0x7')](_0x0f29('0xe'),auth[_0x0f29('0xa')](),controller[_0x0f29('0xf')]);router[_0x0f29('0x10')]('/',auth[_0x0f29('0xa')](),interaction['tracked'](_0x0f29('0x11'),'faxmessage:create'),controller[_0x0f29('0x12')]);router[_0x0f29('0x13')](_0x0f29('0xc'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x14')]);router[_0x0f29('0x13')]('/:id/accept',auth[_0x0f29('0xa')](),controller[_0x0f29('0x15')]);router[_0x0f29('0x13')](_0x0f29('0x16'),auth[_0x0f29('0xa')](),controller[_0x0f29('0x17')]);router[_0x0f29('0x18')](_0x0f29('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0f29('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 4872b02..9c73dc4 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 _0xd09b=['name','ENUM','rrmemory','beepall','roundrobin','INTEGER','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd09b,0x1da));var _0xbd09=function(_0x906c91,_0x4fb003){_0x906c91=_0x906c91-0x0;var _0x4f4620=_0xd09b[_0x906c91];return _0x4f4620;};'use strict';var Sequelize=require(_0xbd09('0x0'));module[_0xbd09('0x1')]={'name':{'type':Sequelize[_0xbd09('0x2')],'unique':_0xbd09('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbd09('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbd09('0x4')](_0xbd09('0x5'),_0xbd09('0x6'),_0xbd09('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbd09('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa1ae=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0xcc0c87,_0x3eef80){var _0x51fab0=function(_0x22719d){while(--_0x22719d){_0xcc0c87['push'](_0xcc0c87['shift']());}};_0x51fab0(++_0x3eef80);}(_0xa1ae,0x134));var _0xea1a=function(_0x3d9f33,_0x2016c2){_0x3d9f33=_0x3d9f33-0x0;var _0x5c7bb3=_0xa1ae[_0x3d9f33];return _0x5c7bb3;};'use strict';var Sequelize=require(_0xea1a('0x0'));module['exports']={'name':{'type':Sequelize[_0xea1a('0x1')],'unique':_0xea1a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xea1a('0x1')]},'timeout':{'type':Sequelize[_0xea1a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea1a('0x4')](_0xea1a('0x5'),_0xea1a('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xea1a('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 9197778..bc1c6a3 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 _0xdde2=['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','toString','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy','FaxQueues','UserProfileResource','end','error','name','send','index','FaxQueue','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','rawAttributes','options','create','body','get','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','describe','getMembers','findOne','hasOwnProperty','FaxQueueId','map','UserFaxQueue','findAndCountAll','UserId','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','flatMap','sequelize'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0xdde2,0xa4));var _0x2dde=function(_0x26f300,_0x3115c0){_0x26f300=_0x26f300-0x0;var _0x53bf7c=_0xdde2[_0x26f300];return _0x53bf7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dde('0x0'));var zipdir=require(_0x2dde('0x1'));var jsonpatch=require(_0x2dde('0x2'));var rp=require(_0x2dde('0x3'));var moment=require('moment');var BPromise=require(_0x2dde('0x4'));var Mustache=require('mustache');var util=require(_0x2dde('0x5'));var path=require('path');var sox=require(_0x2dde('0x6'));var csv=require(_0x2dde('0x7'));var ejs=require(_0x2dde('0x8'));var fs=require('fs');var fs_extra=require(_0x2dde('0x9'));var _=require('lodash');var squel=require(_0x2dde('0xa'));var crypto=require(_0x2dde('0xb'));var jsforce=require(_0x2dde('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dde('0xd'));var Papa=require(_0x2dde('0xe'));var Redis=require(_0x2dde('0xf'));var authService=require(_0x2dde('0x10'));var qs=require(_0x2dde('0x11'));var as=require(_0x2dde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dde('0x13'))(_0x2dde('0x14'));var utils=require(_0x2dde('0x15'));var config=require(_0x2dde('0x16'));var licenseUtil=require(_0x2dde('0x17'));var db=require(_0x2dde('0x18'))['db'];config['redis']=_[_0x2dde('0x19')](config[_0x2dde('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dde('0x1b'))(new Redis(config['redis']));require(_0x2dde('0x1c'))[_0x2dde('0x1d')](socket);function respondWithStatusCode(_0x3df53d,_0x3ceb84){_0x3ceb84=_0x3ceb84||0xcc;return function(_0x2ea43d){if(_0x2ea43d){return _0x3df53d[_0x2dde('0x1e')](_0x3ceb84);}return _0x3df53d[_0x2dde('0x1f')](_0x3ceb84)['end']();};}function respondWithResult(_0x5b817f,_0x351f4a){_0x351f4a=_0x351f4a||0xc8;return function(_0x469e5a){if(_0x469e5a){return _0x5b817f[_0x2dde('0x1f')](_0x351f4a)['json'](_0x469e5a);}};}function respondWithFilteredResult(_0x597823,_0x4e62d1){return function(_0x104d5c){if(_0x104d5c){var _0x4b0884=typeof _0x4e62d1['offset']===_0x2dde('0x20')&&typeof _0x4e62d1['limit']==='undefined';var _0xd61d1e=_0x104d5c[_0x2dde('0x21')];var _0xd35674=_0x4b0884?0x0:_0x4e62d1[_0x2dde('0x22')];var _0x350b42=_0x4b0884?_0x104d5c[_0x2dde('0x21')]:_0x4e62d1['offset']+_0x4e62d1['limit'];var _0x1f874a;if(_0x350b42>=_0xd61d1e){_0x350b42=_0xd61d1e;_0x1f874a=0xc8;}else{_0x1f874a=0xce;}_0x597823[_0x2dde('0x1f')](_0x1f874a);return _0x597823[_0x2dde('0x23')](_0x2dde('0x24'),_0xd35674+'-'+_0x350b42+'/'+_0xd61d1e)[_0x2dde('0x25')](_0x104d5c);}return null;};}function patchUpdates(_0x1ac662){return function(_0x3fab4f){try{jsonpatch[_0x2dde('0x26')](_0x3fab4f,_0x1ac662,!![]);}catch(_0x25ac14){return BPromise[_0x2dde('0x27')](_0x25ac14);}return _0x3fab4f['save']();};}function saveUpdates(_0x125648,_0x5a7a51){return function(_0x1e4ab3){if(_0x1e4ab3){return _0x1e4ab3['update'](_0x125648)[_0x2dde('0x28')](function(_0x59948c){return _0x59948c;});}return null;};}function removeEntity(_0x592641,_0x40da64){return function(_0x2ff986){if(_0x2ff986){return _0x2ff986[_0x2dde('0x29')]()[_0x2dde('0x28')](function(){var _0x4f0ee1=_0x2ff986['get']({'plain':!![]});var _0x2b8fef=_0x2dde('0x2a');return db[_0x2dde('0x2b')]['destroy']({'where':{'type':_0x2b8fef,'resourceId':_0x4f0ee1['id']}})[_0x2dde('0x28')](function(){return _0x2ff986;});})['then'](function(){_0x592641[_0x2dde('0x1f')](0xcc)[_0x2dde('0x2c')]();});}};}function handleEntityNotFound(_0x449630,_0x1359a4){return function(_0x7d4921){if(!_0x7d4921){_0x449630[_0x2dde('0x1e')](0x194);}return _0x7d4921;};}function handleError(_0x5f0c52,_0x544fca){_0x544fca=_0x544fca||0x1f4;return function(_0x5808d0){logger[_0x2dde('0x2d')](_0x5808d0['stack']);if(_0x5808d0[_0x2dde('0x2e')]){delete _0x5808d0['name'];}_0x5f0c52[_0x2dde('0x1f')](_0x544fca)[_0x2dde('0x2f')](_0x5808d0);};}exports[_0x2dde('0x30')]=function(_0x2d6bc2,_0x488ac6){var _0x548480={},_0x247696={},_0x2c3f50={'count':0x0,'rows':[]};var _0x59f57e=_['map'](db[_0x2dde('0x31')]['rawAttributes'],function(_0x2c7cc6){return{'name':_0x2c7cc6[_0x2dde('0x32')],'type':_0x2c7cc6[_0x2dde('0x33')]['key']};});_0x247696[_0x2dde('0x34')]=_['map'](_0x59f57e,_0x2dde('0x2e'));_0x247696[_0x2dde('0x35')]=_['keys'](_0x2d6bc2[_0x2dde('0x35')]);_0x247696['filters']=_[_0x2dde('0x36')](_0x247696[_0x2dde('0x34')],_0x247696[_0x2dde('0x35')]);_0x548480[_0x2dde('0x37')]=_['intersection'](_0x247696[_0x2dde('0x34')],qs['fields'](_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x38')]));_0x548480['attributes']=_0x548480[_0x2dde('0x37')][_0x2dde('0x39')]?_0x548480[_0x2dde('0x37')]:_0x247696[_0x2dde('0x34')];if(!_0x2d6bc2[_0x2dde('0x35')]['hasOwnProperty'](_0x2dde('0x3a'))){_0x548480[_0x2dde('0x3b')]=qs['limit'](_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x3b')]);_0x548480['offset']=qs[_0x2dde('0x22')](_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x22')]);}_0x548480[_0x2dde('0x3c')]=qs[_0x2dde('0x3d')](_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x3d')]);_0x548480[_0x2dde('0x3e')]=qs[_0x2dde('0x3f')](_[_0x2dde('0x40')](_0x2d6bc2[_0x2dde('0x35')],_0x247696[_0x2dde('0x3f')]),_0x59f57e);if(_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x41')]){_0x548480[_0x2dde('0x3e')]=_[_0x2dde('0x42')](_0x548480['where'],{'$or':_['map'](_0x59f57e,function(_0x149843){if(_0x149843[_0x2dde('0x33')]!==_0x2dde('0x43')){var _0x28ed17={};_0x28ed17[_0x149843[_0x2dde('0x2e')]]={'$like':'%'+_0x2d6bc2[_0x2dde('0x35')]['filter']+'%'};return _0x28ed17;}})});}_0x548480=_[_0x2dde('0x42')]({},_0x548480,_0x2d6bc2['options']);var _0x2f21f7={'where':_0x548480[_0x2dde('0x3e')]};return db[_0x2dde('0x31')]['count'](_0x2f21f7)['then'](function(_0xbe8212){_0x2c3f50['count']=_0xbe8212;if(_0x2d6bc2[_0x2dde('0x35')][_0x2dde('0x44')]){_0x548480[_0x2dde('0x45')]=[{'all':!![]}];}return db[_0x2dde('0x31')][_0x2dde('0x46')](_0x548480);})[_0x2dde('0x28')](function(_0x44f679){_0x2c3f50[_0x2dde('0x47')]=_0x44f679;return _0x2c3f50;})[_0x2dde('0x28')](respondWithFilteredResult(_0x488ac6,_0x548480))['catch'](handleError(_0x488ac6,null));};exports['show']=function(_0x1650e6,_0x459f52){var _0x454cef={'raw':!![],'where':{'id':_0x1650e6[_0x2dde('0x48')]['id']}},_0x551360={};_0x551360[_0x2dde('0x34')]=_[_0x2dde('0x49')](db[_0x2dde('0x31')][_0x2dde('0x4a')]);_0x551360[_0x2dde('0x35')]=_[_0x2dde('0x49')](_0x1650e6[_0x2dde('0x35')]);_0x551360[_0x2dde('0x3f')]=_[_0x2dde('0x36')](_0x551360['model'],_0x551360[_0x2dde('0x35')]);_0x454cef['attributes']=_['intersection'](_0x551360[_0x2dde('0x34')],qs['fields'](_0x1650e6[_0x2dde('0x35')][_0x2dde('0x38')]));_0x454cef['attributes']=_0x454cef[_0x2dde('0x37')][_0x2dde('0x39')]?_0x454cef[_0x2dde('0x37')]:_0x551360[_0x2dde('0x34')];if(_0x1650e6['query'][_0x2dde('0x44')]){_0x454cef[_0x2dde('0x45')]=[{'all':!![]}];}_0x454cef=_[_0x2dde('0x42')]({},_0x454cef,_0x1650e6[_0x2dde('0x4b')]);return db['FaxQueue']['find'](_0x454cef)[_0x2dde('0x28')](handleEntityNotFound(_0x459f52,null))[_0x2dde('0x28')](respondWithResult(_0x459f52,null))['catch'](handleError(_0x459f52,null));};exports[_0x2dde('0x4c')]=function(_0x180141,_0x51e942){return db[_0x2dde('0x31')]['create'](_0x180141[_0x2dde('0x4d')],{})[_0x2dde('0x28')](function(_0x2b896c){var _0x267d1d=_0x180141['user'][_0x2dde('0x4e')]({'plain':!![]});if(!_0x267d1d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x267d1d['role']===_0x2dde('0x4f')){var _0xfb9668=_0x2b896c[_0x2dde('0x4e')]({'plain':!![]});var _0x29a99f='FaxQueues';return db[_0x2dde('0x50')][_0x2dde('0x51')]({'where':{'name':_0x29a99f,'userProfileId':_0x267d1d['userProfileId']},'raw':!![]})[_0x2dde('0x28')](function(_0x5c3efb){if(_0x5c3efb&&_0x5c3efb[_0x2dde('0x52')]===0x0){return db[_0x2dde('0x2b')][_0x2dde('0x4c')]({'name':_0xfb9668[_0x2dde('0x2e')],'resourceId':_0xfb9668['id'],'type':_0x5c3efb[_0x2dde('0x2e')],'sectionId':_0x5c3efb['id']},{})[_0x2dde('0x28')](function(){return _0x2b896c;});}else{return _0x2b896c;}})['catch'](function(_0x200747){logger[_0x2dde('0x2d')](_0x2dde('0x53'),_0x200747);throw _0x200747;});}return _0x2b896c;})['then'](respondWithResult(_0x51e942,0xc9))[_0x2dde('0x54')](handleError(_0x51e942,null));};exports[_0x2dde('0x55')]=function(_0x3a32e5,_0x10672c){if(_0x3a32e5[_0x2dde('0x4d')]['id']){delete _0x3a32e5['body']['id'];}return db[_0x2dde('0x31')][_0x2dde('0x51')]({'where':{'id':_0x3a32e5[_0x2dde('0x48')]['id']}})['then'](handleEntityNotFound(_0x10672c,null))[_0x2dde('0x28')](saveUpdates(_0x3a32e5['body'],null))['then'](respondWithResult(_0x10672c,null))[_0x2dde('0x54')](handleError(_0x10672c,null));};exports[_0x2dde('0x29')]=function(_0x437e62,_0x3ba445){return db['FaxQueue'][_0x2dde('0x51')]({'where':{'id':_0x437e62[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](handleEntityNotFound(_0x3ba445,null))[_0x2dde('0x28')](removeEntity(_0x3ba445,null))[_0x2dde('0x54')](handleError(_0x3ba445,null));};exports[_0x2dde('0x56')]=function(_0x46164e,_0x4e11c6){return db[_0x2dde('0x31')]['describe']()[_0x2dde('0x28')](respondWithResult(_0x4e11c6,null))['catch'](handleError(_0x4e11c6,null));};exports[_0x2dde('0x57')]=function(_0x293500,_0x53ba3e,_0x302df6){var _0x250fd6={'raw':!![],'where':{}},_0xeefacf={},_0x278dee;return db[_0x2dde('0x31')][_0x2dde('0x58')]({'where':{'id':_0x293500[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](handleEntityNotFound(_0x53ba3e,null))[_0x2dde('0x28')](function(_0x226b89){if(_0x226b89){_0x278dee=_0x226b89[_0x2dde('0x4e')]({'plain':!![]});_0xeefacf[_0x2dde('0x34')]=_[_0x2dde('0x49')](db['UserFaxQueue']['rawAttributes']);_0xeefacf[_0x2dde('0x35')]=_[_0x2dde('0x49')](_0x293500[_0x2dde('0x35')]);_0xeefacf[_0x2dde('0x3f')]=_[_0x2dde('0x36')](_0xeefacf[_0x2dde('0x34')],_0xeefacf['query']);_0x250fd6[_0x2dde('0x37')]=_[_0x2dde('0x36')](_0xeefacf['model'],qs[_0x2dde('0x38')](_0x293500[_0x2dde('0x35')][_0x2dde('0x38')]));_0x250fd6[_0x2dde('0x37')]=_0x250fd6['attributes'][_0x2dde('0x39')]?_0x250fd6[_0x2dde('0x37')]:_0xeefacf[_0x2dde('0x34')];if(!_0x293500[_0x2dde('0x35')][_0x2dde('0x59')]('nolimit')){_0x250fd6[_0x2dde('0x3b')]=qs[_0x2dde('0x3b')](_0x293500[_0x2dde('0x35')][_0x2dde('0x3b')]);_0x250fd6['offset']=qs[_0x2dde('0x22')](_0x293500[_0x2dde('0x35')][_0x2dde('0x22')]);}_0x250fd6[_0x2dde('0x3c')]=qs[_0x2dde('0x3d')](_0x293500[_0x2dde('0x35')]['sort']);_0x250fd6['where']=qs['filters'](_['pick'](_0x293500[_0x2dde('0x35')],_0xeefacf[_0x2dde('0x3f')]));_0x250fd6[_0x2dde('0x3e')][_0x2dde('0x5a')]=_0x226b89['id'];if(_0x293500['query'][_0x2dde('0x41')]){_0x250fd6[_0x2dde('0x3e')]=_[_0x2dde('0x42')](_0x250fd6['where'],{'$or':_[_0x2dde('0x5b')](_0x250fd6['attributes'],function(_0x4d34fc){var _0x4c1e55={};_0x4c1e55[_0x4d34fc]={'$like':'%'+_0x293500[_0x2dde('0x35')][_0x2dde('0x41')]+'%'};return _0x4c1e55;})});}_0x250fd6=_[_0x2dde('0x42')]({},_0x250fd6,_0x293500[_0x2dde('0x4b')]);return db[_0x2dde('0x5c')][_0x2dde('0x46')](_0x250fd6);}})[_0x2dde('0x28')](function(_0x104d33){if(_0x104d33){return db['User'][_0x2dde('0x5d')]({'where':{'id':_['map'](_0x104d33,_0x2dde('0x5e')),'role':'agent'},'attributes':['id',_0x2dde('0x2e'),_0x2dde('0x5f'),_0x2dde('0x60'),_0x2dde('0x61')]});}})['then'](function(_0x4d7fee){if(_0x4d7fee){return{'count':_0x4d7fee[_0x2dde('0x21')],'rows':_[_0x2dde('0x5b')](_0x4d7fee['rows'],function(_0x50c071){return{'membername':_0x50c071[_0x2dde('0x2e')],'UserId':_0x50c071['id'],'queue_name':_0x278dee['name'],'FaxQueueId':_0x278dee['id'],'interface':util['format'](_0x2dde('0x62'),_0x2dde('0x63'),_0x50c071[_0x2dde('0x2e')]),'penalty':0x0,'paused':_0x50c071[_0x2dde('0x5f')],'createdAt':_0x50c071['createdAt'],'updatedAt':_0x50c071['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53ba3e,_0x250fd6))[_0x2dde('0x54')](handleError(_0x53ba3e,null));};exports[_0x2dde('0x64')]=function(_0x3fffba,_0x4ed941,_0x10b1f5){var _0x372b70={};var _0x313644={};var _0x4dc01e;var _0x4e0465;return db['FaxQueue'][_0x2dde('0x58')]({'where':{'id':_0x3fffba[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](handleEntityNotFound(_0x4ed941,null))['then'](function(_0x1d3b9e){if(_0x1d3b9e){_0x4dc01e=_0x1d3b9e;_0x313644[_0x2dde('0x34')]=_[_0x2dde('0x49')](db[_0x2dde('0x65')]['rawAttributes']);_0x313644[_0x2dde('0x35')]=_[_0x2dde('0x49')](_0x3fffba[_0x2dde('0x35')]);_0x313644[_0x2dde('0x3f')]=_[_0x2dde('0x36')](_0x313644[_0x2dde('0x34')],_0x313644[_0x2dde('0x35')]);_0x372b70['attributes']=_[_0x2dde('0x36')](_0x313644[_0x2dde('0x34')],qs[_0x2dde('0x38')](_0x3fffba['query'][_0x2dde('0x38')]));_0x372b70[_0x2dde('0x37')]=_0x372b70[_0x2dde('0x37')][_0x2dde('0x39')]?_0x372b70[_0x2dde('0x37')]:_0x313644[_0x2dde('0x34')];_0x372b70[_0x2dde('0x3c')]=qs[_0x2dde('0x3d')](_0x3fffba[_0x2dde('0x35')][_0x2dde('0x3d')]);_0x372b70['where']=qs[_0x2dde('0x3f')](_['pick'](_0x3fffba['query'],_0x313644['filters']));if(_0x3fffba[_0x2dde('0x35')][_0x2dde('0x41')]){_0x372b70['where']=_['merge'](_0x372b70['where'],{'$or':_['map'](_0x372b70[_0x2dde('0x37')],function(_0x4cbc01){var _0x5995ee={};_0x5995ee[_0x4cbc01]={'$like':'%'+_0x3fffba[_0x2dde('0x35')][_0x2dde('0x41')]+'%'};return _0x5995ee;})});}_0x372b70=_[_0x2dde('0x42')]({},_0x372b70,_0x3fffba[_0x2dde('0x4b')]);return _0x4dc01e[_0x2dde('0x64')](_0x372b70);}})['then'](function(_0x508821){if(_0x508821){_0x4e0465=_0x508821[_0x2dde('0x39')];if(!_0x3fffba[_0x2dde('0x35')]['hasOwnProperty'](_0x2dde('0x3a'))){_0x372b70[_0x2dde('0x3b')]=qs[_0x2dde('0x3b')](_0x3fffba[_0x2dde('0x35')][_0x2dde('0x3b')]);_0x372b70[_0x2dde('0x22')]=qs['offset'](_0x3fffba['query'][_0x2dde('0x22')]);}return _0x4dc01e[_0x2dde('0x64')](_0x372b70);}})['then'](function(_0x3ada70){if(_0x3ada70){return _0x3ada70?{'count':_0x4e0465,'rows':_0x3ada70}:null;}})[_0x2dde('0x28')](respondWithResult(_0x4ed941,null))['catch'](handleError(_0x4ed941,null));};exports[_0x2dde('0x66')]=function(_0x1e659a,_0x1a56de,_0x4d124f){var _0x88063b=_0x1e659a['body'][_0x2dde('0x67')];return db[_0x2dde('0x65')]['findAll']({'where':{'id':_0x88063b},'attributes':['id'],'include':[{'model':db[_0x2dde('0x68')],'as':_0x2dde('0x69'),'attributes':['id',_0x2dde('0x2e'),_0x2dde('0x6a'),_0x2dde('0x6b'),'interface'],'raw':!![]}]})['then'](function(_0x51f71e){if(_0x51f71e){var _0x218b29=_[_0x2dde('0x6c')](_0x51f71e,function(_0x1d7072){var _0x34c690=_0x1d7072[_0x2dde('0x4e')]({'plain':!![]});return _0x34c690[_0x2dde('0x69')];});return db[_0x2dde('0x31')][_0x2dde('0x51')]({'where':{'id':_0x1e659a[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](function(_0x4e530c){return db[_0x2dde('0x6d')][_0x2dde('0x6e')](function(_0x197d67){return _0x4e530c['addTeams'](_0x88063b,{'transaction':_0x197d67})[_0x2dde('0x28')](function(){return BPromise['each'](_0x218b29,function(_0x30a71a){return db[_0x2dde('0x5c')][_0x2dde('0x6f')]({'where':{'UserId':_0x30a71a['id'],'FaxQueueId':_0x1e659a[_0x2dde('0x48')]['id']},'transaction':_0x197d67});});})[_0x2dde('0x28')](function(){_0x218b29[_0x2dde('0x70')](function(_0x4c2d12){socket[_0x2dde('0x71')](_0x2dde('0x72'),{'UserId':_0x4c2d12['id'],'FaxQueueId':_0x4e530c['id']});});});});});}})[_0x2dde('0x28')](respondWithStatusCode(_0x1a56de,null))[_0x2dde('0x54')](handleError(_0x1a56de,null));};exports[_0x2dde('0x73')]=function(_0x490d1a,_0x4b6055,_0x4c75a4){return db[_0x2dde('0x65')][_0x2dde('0x46')]({'where':{'id':_0x490d1a[_0x2dde('0x35')][_0x2dde('0x67')]},'attributes':['id'],'include':[{'model':db[_0x2dde('0x68')],'as':_0x2dde('0x69'),'attributes':['id'],'raw':!![]}]})[_0x2dde('0x28')](handleEntityNotFound(_0x4b6055,null))[_0x2dde('0x28')](function(_0x303314){var _0x2f5b90=_['map'](_0x303314,'id');var _0x1d9081=[];var _0x8f134f=[];var _0x2ef514=squel[_0x2dde('0x74')]();_0x2ef514[_0x2dde('0x75')](_0x2dde('0x76'))[_0x2dde('0x77')](_0x2dde('0x78'),'tq')['join'](_0x2dde('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2dde('0x3e')](_0x2dde('0x7a'),_0x490d1a[_0x2dde('0x48')]['id']);for(var _0x4693b3=0x0;_0x4693b3<_0x303314[_0x2dde('0x39')];_0x4693b3+=0x1){let _0x3f1742=_0x303314[_0x4693b3];for(var _0x519b52=0x0;_0x519b52<_0x3f1742['Agents'][_0x2dde('0x39')];_0x519b52+=0x1){let _0x560106=_0x3f1742[_0x2dde('0x69')][_0x519b52];var _0x6a2019=_0x2ef514[_0x2dde('0x7b')]();_0x6a2019[_0x2dde('0x3e')](_0x2dde('0x7c'),_0x560106['id']);_0x8f134f[_0x2dde('0x7d')](db['sequelize']['query'](_0x6a2019[_0x2dde('0x7e')](),{'type':db[_0x2dde('0x6d')]['QueryTypes']['SELECT']})['then'](function(_0x2991c1){if(_0x2991c1['length']===0x1){return _0x560106['id'];}else{var _0x271763=_['every'](_[_0x2dde('0x5b')](_0x2991c1,'TeamId'),function(_0x497184){return _['includes'](_0x2f5b90,_0x497184);});if(_0x271763){return _0x560106['id'];}}}));}}return BPromise['all'](_0x8f134f)['then'](function(_0x166c3a){_0x1d9081=_(_0x1d9081)[_0x2dde('0x7f')](_0x166c3a)[_0x2dde('0x80')]()[_0x2dde('0x81')]();return db[_0x2dde('0x31')][_0x2dde('0x51')]({'where':{'id':_0x490d1a['params']['id']}})['then'](function(_0xeb4728){return db[_0x2dde('0x6d')]['transaction'](function(_0x3ab2ae){return _0xeb4728[_0x2dde('0x73')](_0x490d1a[_0x2dde('0x35')][_0x2dde('0x67')],{'transaction':_0x3ab2ae})[_0x2dde('0x28')](function(){if(!_['isEmpty'](_0x1d9081)){return _0xeb4728[_0x2dde('0x82')](_0x1d9081,{'transaction':_0x3ab2ae});}})['then'](function(){_0x1d9081['forEach'](function(_0x1a95f0){socket[_0x2dde('0x71')]('userFaxQueue:remove',{'UserId':_0x1a95f0,'FaxQueueId':_0xeb4728['id']});});});});});});})[_0x2dde('0x28')](respondWithStatusCode(_0x4b6055,null))[_0x2dde('0x54')](handleError(_0x4b6055,null));};exports[_0x2dde('0x83')]=function(_0x14f5d4,_0x3b1b9f,_0x17f710){return db['FaxQueue'][_0x2dde('0x51')]({'where':{'id':_0x14f5d4[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](handleEntityNotFound(_0x3b1b9f,null))[_0x2dde('0x28')](function(_0x2f5f7b){if(_0x2f5f7b){return _0x2f5f7b[_0x2dde('0x83')](_0x14f5d4[_0x2dde('0x4d')][_0x2dde('0x67')],_[_0x2dde('0x84')](_0x14f5d4['body'],[_0x2dde('0x67'),'id'])||{})[_0x2dde('0x85')](function(_0x578ded){for(var _0x1c412e=0x0;_0x1c412e<_0x14f5d4[_0x2dde('0x4d')][_0x2dde('0x67')][_0x2dde('0x39')];_0x1c412e+=0x1){socket['emit']('userFaxQueue:save',{'UserId':Number(_0x14f5d4[_0x2dde('0x4d')][_0x2dde('0x67')][_0x1c412e]),'FaxQueueId':Number(_0x14f5d4[_0x2dde('0x48')]['id'])});}return _0x578ded;});}})[_0x2dde('0x28')](respondWithResult(_0x3b1b9f,null))[_0x2dde('0x54')](handleError(_0x3b1b9f,null));};exports[_0x2dde('0x82')]=function(_0x10c316,_0x56de0d,_0xe61649){return db[_0x2dde('0x31')][_0x2dde('0x51')]({'where':{'id':_0x10c316['params']['id']}})['then'](handleEntityNotFound(_0x56de0d,null))[_0x2dde('0x28')](function(_0x37af81){if(_0x37af81){return _0x37af81[_0x2dde('0x82')](_0x10c316['query']['ids'])[_0x2dde('0x28')](function(){if(_[_0x2dde('0x86')](_0x10c316[_0x2dde('0x35')][_0x2dde('0x67')])){for(var _0x48bc4e=0x0;_0x48bc4e<_0x10c316[_0x2dde('0x35')]['ids'][_0x2dde('0x39')];_0x48bc4e+=0x1){socket[_0x2dde('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x10c316[_0x2dde('0x35')][_0x2dde('0x67')][_0x48bc4e]),'FaxQueueId':Number(_0x10c316[_0x2dde('0x48')]['id'])});}}else{socket[_0x2dde('0x71')](_0x2dde('0x87'),{'UserId':Number(_0x10c316[_0x2dde('0x35')][_0x2dde('0x67')]),'FaxQueueId':Number(_0x10c316[_0x2dde('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x56de0d,null))[_0x2dde('0x54')](handleError(_0x56de0d,null));};exports[_0x2dde('0x88')]=function(_0x7be270,_0x20f33c,_0xccca0b){var _0x2644c5={};var _0x4f04a5={};var _0x29abe2;var _0x440d9a;return db[_0x2dde('0x31')][_0x2dde('0x58')]({'where':{'id':_0x7be270[_0x2dde('0x48')]['id']}})[_0x2dde('0x28')](handleEntityNotFound(_0x20f33c,null))[_0x2dde('0x28')](function(_0x26c1f2){if(_0x26c1f2){_0x29abe2=_0x26c1f2;_0x4f04a5['model']=_[_0x2dde('0x49')](db[_0x2dde('0x68')]['rawAttributes']);_0x4f04a5['query']=_[_0x2dde('0x49')](_0x7be270[_0x2dde('0x35')]);_0x4f04a5['filters']=_[_0x2dde('0x36')](_0x4f04a5[_0x2dde('0x34')],_0x4f04a5[_0x2dde('0x35')]);_0x2644c5['attributes']=_['intersection'](_0x4f04a5[_0x2dde('0x34')],qs[_0x2dde('0x38')](_0x7be270[_0x2dde('0x35')][_0x2dde('0x38')]));_0x2644c5['attributes']=_0x2644c5[_0x2dde('0x37')][_0x2dde('0x39')]?_0x2644c5[_0x2dde('0x37')]:_0x4f04a5[_0x2dde('0x34')];_0x2644c5['order']=qs[_0x2dde('0x3d')](_0x7be270[_0x2dde('0x35')][_0x2dde('0x3d')]);_0x2644c5[_0x2dde('0x3e')]=qs['filters'](_[_0x2dde('0x40')](_0x7be270[_0x2dde('0x35')],_0x4f04a5['filters']));if(_0x7be270[_0x2dde('0x35')][_0x2dde('0x41')]){_0x2644c5['where']=_[_0x2dde('0x42')](_0x2644c5['where'],{'$or':_[_0x2dde('0x5b')](_0x2644c5[_0x2dde('0x37')],function(_0x44e3f4){var _0x3568b2={};_0x3568b2[_0x44e3f4]={'$like':'%'+_0x7be270[_0x2dde('0x35')][_0x2dde('0x41')]+'%'};return _0x3568b2;})});}_0x2644c5=_[_0x2dde('0x42')]({},_0x2644c5,_0x7be270[_0x2dde('0x4b')]);return _0x29abe2[_0x2dde('0x88')](_0x2644c5);}})[_0x2dde('0x28')](function(_0x36dcfb){if(_0x36dcfb){_0x440d9a=_0x36dcfb['length'];if(!_0x7be270[_0x2dde('0x35')][_0x2dde('0x59')](_0x2dde('0x3a'))){_0x2644c5[_0x2dde('0x3b')]=qs[_0x2dde('0x3b')](_0x7be270[_0x2dde('0x35')][_0x2dde('0x3b')]);_0x2644c5[_0x2dde('0x22')]=qs[_0x2dde('0x22')](_0x7be270[_0x2dde('0x35')]['offset']);}return _0x29abe2[_0x2dde('0x88')](_0x2644c5);}})[_0x2dde('0x28')](function(_0x1bb3e7){if(_0x1bb3e7){return _0x1bb3e7?{'count':_0x440d9a,'rows':_0x1bb3e7}:null;}})['then'](respondWithResult(_0x20f33c,null))[_0x2dde('0x54')](handleError(_0x20f33c,null));}; \ No newline at end of file +var _0x1afe=['Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','limit','offset','order','where','pick','merge','VIRTUAL','filter','options','FaxQueue','findAll','rows','catch','show','params','filters','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','sort','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','Team','hasOwnProperty','getTeams','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','join','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','addAgents','omit','spread','userFaxQueue:save','userFaxQueue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','undefined','count','set'];(function(_0x3909cc,_0x1943c2){var _0x15d17e=function(_0x23e936){while(--_0x23e936){_0x3909cc['push'](_0x3909cc['shift']());}};_0x15d17e(++_0x1943c2);}(_0x1afe,0x6b));var _0xe1af=function(_0x4d1d7e,_0x7f2b63){_0x4d1d7e=_0x4d1d7e-0x0;var _0x472741=_0x1afe[_0x4d1d7e];return _0x472741;};'use strict';var emlformat=require(_0xe1af('0x0'));var rimraf=require(_0xe1af('0x1'));var zipdir=require(_0xe1af('0x2'));var jsonpatch=require(_0xe1af('0x3'));var rp=require(_0xe1af('0x4'));var moment=require(_0xe1af('0x5'));var BPromise=require(_0xe1af('0x6'));var Mustache=require(_0xe1af('0x7'));var util=require(_0xe1af('0x8'));var path=require('path');var sox=require(_0xe1af('0x9'));var csv=require(_0xe1af('0xa'));var ejs=require(_0xe1af('0xb'));var fs=require('fs');var fs_extra=require(_0xe1af('0xc'));var _=require(_0xe1af('0xd'));var squel=require('squel');var crypto=require(_0xe1af('0xe'));var jsforce=require(_0xe1af('0xf'));var deskjs=require(_0xe1af('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe1af('0x11'));var Papa=require(_0xe1af('0x12'));var Redis=require(_0xe1af('0x13'));var authService=require(_0xe1af('0x14'));var qs=require(_0xe1af('0x15'));var as=require(_0xe1af('0x16'));var hardwareService=require(_0xe1af('0x17'));var logger=require(_0xe1af('0x18'))(_0xe1af('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe1af('0x1a'))['db'];config[_0xe1af('0x1b')]=_[_0xe1af('0x1c')](config['redis'],{'host':_0xe1af('0x1d'),'port':0x18eb});var socket=require(_0xe1af('0x1e'))(new Redis(config[_0xe1af('0x1b')]));require(_0xe1af('0x1f'))['register'](socket);function respondWithStatusCode(_0x14493b,_0x3c684e){_0x3c684e=_0x3c684e||0xcc;return function(_0x59ee67){if(_0x59ee67){return _0x14493b[_0xe1af('0x20')](_0x3c684e);}return _0x14493b[_0xe1af('0x21')](_0x3c684e)[_0xe1af('0x22')]();};}function respondWithResult(_0x43bc23,_0x93faee){_0x93faee=_0x93faee||0xc8;return function(_0x28e5ae){if(_0x28e5ae){return _0x43bc23[_0xe1af('0x21')](_0x93faee)[_0xe1af('0x23')](_0x28e5ae);}};}function respondWithFilteredResult(_0x5c4f47,_0x31b4f4){return function(_0x16db16){if(_0x16db16){var _0x479942=typeof _0x31b4f4['offset']==='undefined'&&typeof _0x31b4f4['limit']===_0xe1af('0x24');var _0x4d9385=_0x16db16['count'];var _0x11a4e9=_0x479942?0x0:_0x31b4f4['offset'];var _0x3e8c1a=_0x479942?_0x16db16[_0xe1af('0x25')]:_0x31b4f4['offset']+_0x31b4f4['limit'];var _0x28d2a1;if(_0x3e8c1a>=_0x4d9385){_0x3e8c1a=_0x4d9385;_0x28d2a1=0xc8;}else{_0x28d2a1=0xce;}_0x5c4f47['status'](_0x28d2a1);return _0x5c4f47[_0xe1af('0x26')](_0xe1af('0x27'),_0x11a4e9+'-'+_0x3e8c1a+'/'+_0x4d9385)[_0xe1af('0x23')](_0x16db16);}return null;};}function patchUpdates(_0x3060ab){return function(_0x1ee3a8){try{jsonpatch['apply'](_0x1ee3a8,_0x3060ab,!![]);}catch(_0x2200ab){return BPromise[_0xe1af('0x28')](_0x2200ab);}return _0x1ee3a8[_0xe1af('0x29')]();};}function saveUpdates(_0x2d7174,_0x5156c6){return function(_0x4b4079){if(_0x4b4079){return _0x4b4079[_0xe1af('0x2a')](_0x2d7174)['then'](function(_0x8c5c5d){return _0x8c5c5d;});}return null;};}function removeEntity(_0x198f5f,_0x3fa8b4){return function(_0x1697c9){if(_0x1697c9){return _0x1697c9['destroy']()[_0xe1af('0x2b')](function(){var _0x56d093=_0x1697c9[_0xe1af('0x2c')]({'plain':!![]});var _0x69fee3='FaxQueues';return db[_0xe1af('0x2d')][_0xe1af('0x2e')]({'where':{'type':_0x69fee3,'resourceId':_0x56d093['id']}})['then'](function(){return _0x1697c9;});})['then'](function(){_0x198f5f[_0xe1af('0x21')](0xcc)[_0xe1af('0x22')]();});}};}function handleEntityNotFound(_0x25eb24,_0x35291e){return function(_0x5d6f99){if(!_0x5d6f99){_0x25eb24['sendStatus'](0x194);}return _0x5d6f99;};}function handleError(_0x524e49,_0x1c0693){_0x1c0693=_0x1c0693||0x1f4;return function(_0x986930){logger[_0xe1af('0x2f')](_0x986930[_0xe1af('0x30')]);if(_0x986930[_0xe1af('0x31')]){delete _0x986930[_0xe1af('0x31')];}_0x524e49['status'](_0x1c0693)[_0xe1af('0x32')](_0x986930);};}exports[_0xe1af('0x33')]=function(_0x4ef3a1,_0x331f67){var _0xd77531={},_0x107233={},_0x1da880={'count':0x0,'rows':[]};var _0x41c9cf=_[_0xe1af('0x34')](db['FaxQueue'][_0xe1af('0x35')],function(_0x3ee280){return{'name':_0x3ee280[_0xe1af('0x36')],'type':_0x3ee280[_0xe1af('0x37')][_0xe1af('0x38')]};});_0x107233[_0xe1af('0x39')]=_['map'](_0x41c9cf,_0xe1af('0x31'));_0x107233[_0xe1af('0x3a')]=_[_0xe1af('0x3b')](_0x4ef3a1[_0xe1af('0x3a')]);_0x107233['filters']=_[_0xe1af('0x3c')](_0x107233[_0xe1af('0x39')],_0x107233[_0xe1af('0x3a')]);_0xd77531[_0xe1af('0x3d')]=_['intersection'](_0x107233['model'],qs[_0xe1af('0x3e')](_0x4ef3a1['query'][_0xe1af('0x3e')]));_0xd77531[_0xe1af('0x3d')]=_0xd77531[_0xe1af('0x3d')]['length']?_0xd77531[_0xe1af('0x3d')]:_0x107233[_0xe1af('0x39')];if(!_0x4ef3a1[_0xe1af('0x3a')]['hasOwnProperty']('nolimit')){_0xd77531['limit']=qs['limit'](_0x4ef3a1[_0xe1af('0x3a')][_0xe1af('0x3f')]);_0xd77531[_0xe1af('0x40')]=qs[_0xe1af('0x40')](_0x4ef3a1[_0xe1af('0x3a')][_0xe1af('0x40')]);}_0xd77531[_0xe1af('0x41')]=qs['sort'](_0x4ef3a1['query']['sort']);_0xd77531[_0xe1af('0x42')]=qs['filters'](_[_0xe1af('0x43')](_0x4ef3a1[_0xe1af('0x3a')],_0x107233['filters']),_0x41c9cf);if(_0x4ef3a1[_0xe1af('0x3a')]['filter']){_0xd77531['where']=_[_0xe1af('0x44')](_0xd77531['where'],{'$or':_['map'](_0x41c9cf,function(_0x4eaeb0){if(_0x4eaeb0['type']!==_0xe1af('0x45')){var _0x14b6a3={};_0x14b6a3[_0x4eaeb0['name']]={'$like':'%'+_0x4ef3a1[_0xe1af('0x3a')][_0xe1af('0x46')]+'%'};return _0x14b6a3;}})});}_0xd77531=_['merge']({},_0xd77531,_0x4ef3a1[_0xe1af('0x47')]);var _0x1b3d2d={'where':_0xd77531[_0xe1af('0x42')]};return db[_0xe1af('0x48')][_0xe1af('0x25')](_0x1b3d2d)[_0xe1af('0x2b')](function(_0x28ccb2){_0x1da880[_0xe1af('0x25')]=_0x28ccb2;if(_0x4ef3a1[_0xe1af('0x3a')]['includeAll']){_0xd77531['include']=[{'all':!![]}];}return db['FaxQueue'][_0xe1af('0x49')](_0xd77531);})['then'](function(_0x5be1e5){_0x1da880[_0xe1af('0x4a')]=_0x5be1e5;return _0x1da880;})[_0xe1af('0x2b')](respondWithFilteredResult(_0x331f67,_0xd77531))[_0xe1af('0x4b')](handleError(_0x331f67,null));};exports[_0xe1af('0x4c')]=function(_0x57cd96,_0x4288c4){var _0x3b9fc4={'raw':!![],'where':{'id':_0x57cd96[_0xe1af('0x4d')]['id']}},_0x4b18da={};_0x4b18da['model']=_['keys'](db['FaxQueue'][_0xe1af('0x35')]);_0x4b18da[_0xe1af('0x3a')]=_[_0xe1af('0x3b')](_0x57cd96[_0xe1af('0x3a')]);_0x4b18da[_0xe1af('0x4e')]=_[_0xe1af('0x3c')](_0x4b18da['model'],_0x4b18da['query']);_0x3b9fc4['attributes']=_[_0xe1af('0x3c')](_0x4b18da[_0xe1af('0x39')],qs[_0xe1af('0x3e')](_0x57cd96[_0xe1af('0x3a')][_0xe1af('0x3e')]));_0x3b9fc4['attributes']=_0x3b9fc4[_0xe1af('0x3d')][_0xe1af('0x4f')]?_0x3b9fc4['attributes']:_0x4b18da['model'];if(_0x57cd96[_0xe1af('0x3a')]['includeAll']){_0x3b9fc4[_0xe1af('0x50')]=[{'all':!![]}];}_0x3b9fc4=_[_0xe1af('0x44')]({},_0x3b9fc4,_0x57cd96[_0xe1af('0x47')]);return db[_0xe1af('0x48')][_0xe1af('0x51')](_0x3b9fc4)[_0xe1af('0x2b')](handleEntityNotFound(_0x4288c4,null))['then'](respondWithResult(_0x4288c4,null))[_0xe1af('0x4b')](handleError(_0x4288c4,null));};exports[_0xe1af('0x52')]=function(_0x264e58,_0x5966c8){return db[_0xe1af('0x48')]['create'](_0x264e58[_0xe1af('0x53')],{})[_0xe1af('0x2b')](function(_0x1e213d){var _0x4b8dfa=_0x264e58[_0xe1af('0x54')][_0xe1af('0x2c')]({'plain':!![]});if(!_0x4b8dfa)throw new Error(_0xe1af('0x55'));if(_0x4b8dfa[_0xe1af('0x56')]===_0xe1af('0x54')){var _0x40caa4=_0x1e213d[_0xe1af('0x2c')]({'plain':!![]});var _0x1d5a18=_0xe1af('0x57');return db['UserProfileSection'][_0xe1af('0x51')]({'where':{'name':_0x1d5a18,'userProfileId':_0x4b8dfa['userProfileId']},'raw':!![]})[_0xe1af('0x2b')](function(_0x568333){if(_0x568333&&_0x568333[_0xe1af('0x58')]===0x0){return db[_0xe1af('0x2d')][_0xe1af('0x52')]({'name':_0x40caa4[_0xe1af('0x31')],'resourceId':_0x40caa4['id'],'type':_0x568333[_0xe1af('0x31')],'sectionId':_0x568333['id']},{})[_0xe1af('0x2b')](function(){return _0x1e213d;});}else{return _0x1e213d;}})[_0xe1af('0x4b')](function(_0x4a4fa3){logger['error'](_0xe1af('0x59'),_0x4a4fa3);throw _0x4a4fa3;});}return _0x1e213d;})[_0xe1af('0x2b')](respondWithResult(_0x5966c8,0xc9))['catch'](handleError(_0x5966c8,null));};exports[_0xe1af('0x2a')]=function(_0x5e189b,_0x1c0e80){if(_0x5e189b['body']['id']){delete _0x5e189b[_0xe1af('0x53')]['id'];}return db['FaxQueue'][_0xe1af('0x51')]({'where':{'id':_0x5e189b[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](handleEntityNotFound(_0x1c0e80,null))[_0xe1af('0x2b')](saveUpdates(_0x5e189b[_0xe1af('0x53')],null))[_0xe1af('0x2b')](respondWithResult(_0x1c0e80,null))[_0xe1af('0x4b')](handleError(_0x1c0e80,null));};exports[_0xe1af('0x2e')]=function(_0x37374d,_0x408049){return db[_0xe1af('0x48')][_0xe1af('0x51')]({'where':{'id':_0x37374d[_0xe1af('0x4d')]['id']}})['then'](handleEntityNotFound(_0x408049,null))[_0xe1af('0x2b')](removeEntity(_0x408049,null))[_0xe1af('0x4b')](handleError(_0x408049,null));};exports[_0xe1af('0x5a')]=function(_0x243c9e,_0x5e07d7){return db[_0xe1af('0x48')]['describe']()[_0xe1af('0x2b')](respondWithResult(_0x5e07d7,null))[_0xe1af('0x4b')](handleError(_0x5e07d7,null));};exports['getMembers']=function(_0x3b8356,_0x3101b1,_0x290a3e){var _0xddf210={'raw':!![],'where':{}},_0x5e41cd={},_0x4a7cee;return db[_0xe1af('0x48')][_0xe1af('0x5b')]({'where':{'id':_0x3b8356[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](handleEntityNotFound(_0x3101b1,null))['then'](function(_0x18a760){if(_0x18a760){_0x4a7cee=_0x18a760[_0xe1af('0x2c')]({'plain':!![]});_0x5e41cd[_0xe1af('0x39')]=_[_0xe1af('0x3b')](db['UserFaxQueue'][_0xe1af('0x35')]);_0x5e41cd['query']=_[_0xe1af('0x3b')](_0x3b8356[_0xe1af('0x3a')]);_0x5e41cd[_0xe1af('0x4e')]=_['intersection'](_0x5e41cd[_0xe1af('0x39')],_0x5e41cd[_0xe1af('0x3a')]);_0xddf210['attributes']=_[_0xe1af('0x3c')](_0x5e41cd['model'],qs['fields'](_0x3b8356['query'][_0xe1af('0x3e')]));_0xddf210['attributes']=_0xddf210[_0xe1af('0x3d')]['length']?_0xddf210[_0xe1af('0x3d')]:_0x5e41cd[_0xe1af('0x39')];if(!_0x3b8356['query']['hasOwnProperty']('nolimit')){_0xddf210[_0xe1af('0x3f')]=qs[_0xe1af('0x3f')](_0x3b8356[_0xe1af('0x3a')]['limit']);_0xddf210[_0xe1af('0x40')]=qs[_0xe1af('0x40')](_0x3b8356['query']['offset']);}_0xddf210['order']=qs[_0xe1af('0x5c')](_0x3b8356[_0xe1af('0x3a')][_0xe1af('0x5c')]);_0xddf210['where']=qs[_0xe1af('0x4e')](_[_0xe1af('0x43')](_0x3b8356['query'],_0x5e41cd[_0xe1af('0x4e')]));_0xddf210[_0xe1af('0x42')][_0xe1af('0x5d')]=_0x18a760['id'];if(_0x3b8356[_0xe1af('0x3a')][_0xe1af('0x46')]){_0xddf210['where']=_[_0xe1af('0x44')](_0xddf210[_0xe1af('0x42')],{'$or':_[_0xe1af('0x34')](_0xddf210[_0xe1af('0x3d')],function(_0x15ec5e){var _0x4d9cca={};_0x4d9cca[_0x15ec5e]={'$like':'%'+_0x3b8356[_0xe1af('0x3a')][_0xe1af('0x46')]+'%'};return _0x4d9cca;})});}_0xddf210=_[_0xe1af('0x44')]({},_0xddf210,_0x3b8356[_0xe1af('0x47')]);return db[_0xe1af('0x5e')][_0xe1af('0x49')](_0xddf210);}})[_0xe1af('0x2b')](function(_0xb90ed9){if(_0xb90ed9){return db['User'][_0xe1af('0x5f')]({'where':{'id':_[_0xe1af('0x34')](_0xb90ed9,_0xe1af('0x60')),'role':_0xe1af('0x61')},'attributes':['id',_0xe1af('0x31'),_0xe1af('0x62'),'updatedAt',_0xe1af('0x63')]});}})['then'](function(_0x3a8272){if(_0x3a8272){return{'count':_0x3a8272[_0xe1af('0x25')],'rows':_[_0xe1af('0x34')](_0x3a8272[_0xe1af('0x4a')],function(_0x14815c){return{'membername':_0x14815c[_0xe1af('0x31')],'UserId':_0x14815c['id'],'queue_name':_0x4a7cee['name'],'FaxQueueId':_0x4a7cee['id'],'interface':util[_0xe1af('0x64')](_0xe1af('0x65'),_0xe1af('0x66'),_0x14815c['name']),'penalty':0x0,'paused':_0x14815c[_0xe1af('0x62')],'createdAt':_0x14815c[_0xe1af('0x63')],'updatedAt':_0x14815c[_0xe1af('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe1af('0x2b')](respondWithFilteredResult(_0x3101b1,_0xddf210))[_0xe1af('0x4b')](handleError(_0x3101b1,null));};exports['getTeams']=function(_0x519ca5,_0x2de148,_0xd3b6c1){var _0x3720bb={};var _0x16e009={};var _0x2be541;var _0x519d20;return db[_0xe1af('0x48')][_0xe1af('0x5b')]({'where':{'id':_0x519ca5['params']['id']}})['then'](handleEntityNotFound(_0x2de148,null))[_0xe1af('0x2b')](function(_0x343de1){if(_0x343de1){_0x2be541=_0x343de1;_0x16e009[_0xe1af('0x39')]=_['keys'](db[_0xe1af('0x68')][_0xe1af('0x35')]);_0x16e009[_0xe1af('0x3a')]=_[_0xe1af('0x3b')](_0x519ca5[_0xe1af('0x3a')]);_0x16e009['filters']=_['intersection'](_0x16e009[_0xe1af('0x39')],_0x16e009[_0xe1af('0x3a')]);_0x3720bb['attributes']=_[_0xe1af('0x3c')](_0x16e009['model'],qs[_0xe1af('0x3e')](_0x519ca5[_0xe1af('0x3a')][_0xe1af('0x3e')]));_0x3720bb[_0xe1af('0x3d')]=_0x3720bb[_0xe1af('0x3d')]['length']?_0x3720bb[_0xe1af('0x3d')]:_0x16e009[_0xe1af('0x39')];_0x3720bb[_0xe1af('0x41')]=qs[_0xe1af('0x5c')](_0x519ca5['query'][_0xe1af('0x5c')]);_0x3720bb[_0xe1af('0x42')]=qs[_0xe1af('0x4e')](_[_0xe1af('0x43')](_0x519ca5['query'],_0x16e009['filters']));if(_0x519ca5[_0xe1af('0x3a')]['filter']){_0x3720bb[_0xe1af('0x42')]=_[_0xe1af('0x44')](_0x3720bb[_0xe1af('0x42')],{'$or':_['map'](_0x3720bb['attributes'],function(_0x3d4b81){var _0x1dccfc={};_0x1dccfc[_0x3d4b81]={'$like':'%'+_0x519ca5[_0xe1af('0x3a')][_0xe1af('0x46')]+'%'};return _0x1dccfc;})});}_0x3720bb=_['merge']({},_0x3720bb,_0x519ca5['options']);return _0x2be541['getTeams'](_0x3720bb);}})[_0xe1af('0x2b')](function(_0x115bfc){if(_0x115bfc){_0x519d20=_0x115bfc[_0xe1af('0x4f')];if(!_0x519ca5['query'][_0xe1af('0x69')]('nolimit')){_0x3720bb[_0xe1af('0x3f')]=qs[_0xe1af('0x3f')](_0x519ca5['query'][_0xe1af('0x3f')]);_0x3720bb[_0xe1af('0x40')]=qs[_0xe1af('0x40')](_0x519ca5[_0xe1af('0x3a')][_0xe1af('0x40')]);}return _0x2be541[_0xe1af('0x6a')](_0x3720bb);}})[_0xe1af('0x2b')](function(_0x277d61){if(_0x277d61){return _0x277d61?{'count':_0x519d20,'rows':_0x277d61}:null;}})[_0xe1af('0x2b')](respondWithResult(_0x2de148,null))[_0xe1af('0x4b')](handleError(_0x2de148,null));};exports[_0xe1af('0x6b')]=function(_0x37e977,_0x43419c,_0x1f6109){var _0x25f423=_0x37e977[_0xe1af('0x53')][_0xe1af('0x6c')];return db['Team']['findAll']({'where':{'id':_0x25f423},'attributes':['id'],'include':[{'model':db[_0xe1af('0x6d')],'as':_0xe1af('0x6e'),'attributes':['id',_0xe1af('0x31'),_0xe1af('0x6f'),_0xe1af('0x70'),_0xe1af('0x71')],'raw':!![]}]})[_0xe1af('0x2b')](function(_0x2823ff){if(_0x2823ff){var _0x418101=_[_0xe1af('0x72')](_0x2823ff,function(_0x769ead){var _0x31c4a2=_0x769ead[_0xe1af('0x2c')]({'plain':!![]});return _0x31c4a2['Agents'];});return db['FaxQueue'][_0xe1af('0x51')]({'where':{'id':_0x37e977[_0xe1af('0x4d')]['id']}})['then'](function(_0xdb1143){return db[_0xe1af('0x73')][_0xe1af('0x74')](function(_0x1ca363){return _0xdb1143['addTeams'](_0x25f423,{'transaction':_0x1ca363})[_0xe1af('0x2b')](function(){return BPromise[_0xe1af('0x75')](_0x418101,function(_0xf15485){return db[_0xe1af('0x5e')][_0xe1af('0x76')]({'where':{'UserId':_0xf15485['id'],'FaxQueueId':_0x37e977[_0xe1af('0x4d')]['id']},'transaction':_0x1ca363});});})[_0xe1af('0x2b')](function(){_0x418101[_0xe1af('0x77')](function(_0xf83f62){socket[_0xe1af('0x78')]('userFaxQueue:save',{'UserId':_0xf83f62['id'],'FaxQueueId':_0xdb1143['id']});});});});});}})[_0xe1af('0x2b')](respondWithStatusCode(_0x43419c,null))[_0xe1af('0x4b')](handleError(_0x43419c,null));};exports['removeTeams']=function(_0x2dc5a8,_0x21351e,_0x2cfca5){return db[_0xe1af('0x68')]['findAll']({'where':{'id':_0x2dc5a8[_0xe1af('0x3a')][_0xe1af('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xe1af('0x6d')],'as':_0xe1af('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21351e,null))[_0xe1af('0x2b')](function(_0x280665){var _0x519e75=_[_0xe1af('0x34')](_0x280665,'id');var _0x4c3c68=[];var _0x1ebbea=[];var _0x210732=squel[_0xe1af('0x79')]();_0x210732['field'](_0xe1af('0x7a'))['from']('team_has_fax_queues','tq')[_0xe1af('0x7b')](_0xe1af('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xe1af('0x42')](_0xe1af('0x7d'),_0x2dc5a8[_0xe1af('0x4d')]['id']);for(var _0x48cf0f=0x0;_0x48cf0f<_0x280665[_0xe1af('0x4f')];_0x48cf0f+=0x1){let _0x2da17d=_0x280665[_0x48cf0f];for(var _0x20b22b=0x0;_0x20b22b<_0x2da17d[_0xe1af('0x6e')]['length'];_0x20b22b+=0x1){let _0x14d25b=_0x2da17d[_0xe1af('0x6e')][_0x20b22b];var _0x7b551e=_0x210732['clone']();_0x7b551e[_0xe1af('0x42')](_0xe1af('0x7e'),_0x14d25b['id']);_0x1ebbea['push'](db['sequelize']['query'](_0x7b551e['toString'](),{'type':db['sequelize'][_0xe1af('0x7f')][_0xe1af('0x80')]})[_0xe1af('0x2b')](function(_0x4669eb){if(_0x4669eb[_0xe1af('0x4f')]===0x1){return _0x14d25b['id'];}else{var _0x165f58=_[_0xe1af('0x81')](_['map'](_0x4669eb,_0xe1af('0x82')),function(_0x427300){return _[_0xe1af('0x83')](_0x519e75,_0x427300);});if(_0x165f58){return _0x14d25b['id'];}}}));}}return BPromise[_0xe1af('0x84')](_0x1ebbea)['then'](function(_0xe0c8b8){_0x4c3c68=_(_0x4c3c68)[_0xe1af('0x85')](_0xe0c8b8)[_0xe1af('0x86')]()[_0xe1af('0x87')]();return db[_0xe1af('0x48')]['find']({'where':{'id':_0x2dc5a8[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](function(_0x2b7146){return db[_0xe1af('0x73')][_0xe1af('0x74')](function(_0xdf65e2){return _0x2b7146[_0xe1af('0x88')](_0x2dc5a8[_0xe1af('0x3a')]['ids'],{'transaction':_0xdf65e2})[_0xe1af('0x2b')](function(){if(!_[_0xe1af('0x89')](_0x4c3c68)){return _0x2b7146[_0xe1af('0x8a')](_0x4c3c68,{'transaction':_0xdf65e2});}})['then'](function(){_0x4c3c68[_0xe1af('0x77')](function(_0x4b9faf){socket['emit']('userFaxQueue:remove',{'UserId':_0x4b9faf,'FaxQueueId':_0x2b7146['id']});});});});});});})['then'](respondWithStatusCode(_0x21351e,null))[_0xe1af('0x4b')](handleError(_0x21351e,null));};exports[_0xe1af('0x8b')]=function(_0x2ca54e,_0x38ef66,_0x2d96a7){return db['FaxQueue'][_0xe1af('0x51')]({'where':{'id':_0x2ca54e[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](handleEntityNotFound(_0x38ef66,null))['then'](function(_0x5cd9ef){if(_0x5cd9ef){return _0x5cd9ef['addAgents'](_0x2ca54e[_0xe1af('0x53')][_0xe1af('0x6c')],_[_0xe1af('0x8c')](_0x2ca54e['body'],[_0xe1af('0x6c'),'id'])||{})[_0xe1af('0x8d')](function(_0x56e172){for(var _0x7b8d85=0x0;_0x7b8d85<_0x2ca54e[_0xe1af('0x53')][_0xe1af('0x6c')]['length'];_0x7b8d85+=0x1){socket['emit'](_0xe1af('0x8e'),{'UserId':Number(_0x2ca54e[_0xe1af('0x53')][_0xe1af('0x6c')][_0x7b8d85]),'FaxQueueId':Number(_0x2ca54e[_0xe1af('0x4d')]['id'])});}return _0x56e172;});}})[_0xe1af('0x2b')](respondWithResult(_0x38ef66,null))['catch'](handleError(_0x38ef66,null));};exports['removeAgents']=function(_0x2198cb,_0x57614b,_0x1ea6b7){return db['FaxQueue']['find']({'where':{'id':_0x2198cb[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](handleEntityNotFound(_0x57614b,null))[_0xe1af('0x2b')](function(_0x2e9f18){if(_0x2e9f18){return _0x2e9f18['removeAgents'](_0x2198cb[_0xe1af('0x3a')]['ids'])[_0xe1af('0x2b')](function(){if(_['isArray'](_0x2198cb[_0xe1af('0x3a')]['ids'])){for(var _0x486f70=0x0;_0x486f70<_0x2198cb[_0xe1af('0x3a')][_0xe1af('0x6c')][_0xe1af('0x4f')];_0x486f70+=0x1){socket[_0xe1af('0x78')](_0xe1af('0x8f'),{'UserId':Number(_0x2198cb[_0xe1af('0x3a')][_0xe1af('0x6c')][_0x486f70]),'FaxQueueId':Number(_0x2198cb['params']['id'])});}}else{socket[_0xe1af('0x78')](_0xe1af('0x8f'),{'UserId':Number(_0x2198cb[_0xe1af('0x3a')]['ids']),'FaxQueueId':Number(_0x2198cb[_0xe1af('0x4d')]['id'])});}});}})[_0xe1af('0x2b')](respondWithStatusCode(_0x57614b,null))['catch'](handleError(_0x57614b,null));};exports[_0xe1af('0x90')]=function(_0x28b8f9,_0x56bf57,_0x475724){var _0x52a268={};var _0xa5e6ae={};var _0x2b5467;var _0x452899;return db[_0xe1af('0x48')][_0xe1af('0x5b')]({'where':{'id':_0x28b8f9[_0xe1af('0x4d')]['id']}})[_0xe1af('0x2b')](handleEntityNotFound(_0x56bf57,null))[_0xe1af('0x2b')](function(_0x320610){if(_0x320610){_0x2b5467=_0x320610;_0xa5e6ae[_0xe1af('0x39')]=_[_0xe1af('0x3b')](db['User'][_0xe1af('0x35')]);_0xa5e6ae[_0xe1af('0x3a')]=_['keys'](_0x28b8f9['query']);_0xa5e6ae[_0xe1af('0x4e')]=_['intersection'](_0xa5e6ae['model'],_0xa5e6ae[_0xe1af('0x3a')]);_0x52a268[_0xe1af('0x3d')]=_[_0xe1af('0x3c')](_0xa5e6ae['model'],qs[_0xe1af('0x3e')](_0x28b8f9[_0xe1af('0x3a')][_0xe1af('0x3e')]));_0x52a268[_0xe1af('0x3d')]=_0x52a268[_0xe1af('0x3d')][_0xe1af('0x4f')]?_0x52a268[_0xe1af('0x3d')]:_0xa5e6ae[_0xe1af('0x39')];_0x52a268[_0xe1af('0x41')]=qs['sort'](_0x28b8f9['query'][_0xe1af('0x5c')]);_0x52a268[_0xe1af('0x42')]=qs['filters'](_[_0xe1af('0x43')](_0x28b8f9[_0xe1af('0x3a')],_0xa5e6ae['filters']));if(_0x28b8f9[_0xe1af('0x3a')]['filter']){_0x52a268[_0xe1af('0x42')]=_[_0xe1af('0x44')](_0x52a268[_0xe1af('0x42')],{'$or':_[_0xe1af('0x34')](_0x52a268['attributes'],function(_0x336ce4){var _0x105150={};_0x105150[_0x336ce4]={'$like':'%'+_0x28b8f9[_0xe1af('0x3a')][_0xe1af('0x46')]+'%'};return _0x105150;})});}_0x52a268=_['merge']({},_0x52a268,_0x28b8f9[_0xe1af('0x47')]);return _0x2b5467[_0xe1af('0x90')](_0x52a268);}})[_0xe1af('0x2b')](function(_0x46abdb){if(_0x46abdb){_0x452899=_0x46abdb[_0xe1af('0x4f')];if(!_0x28b8f9['query'][_0xe1af('0x69')](_0xe1af('0x91'))){_0x52a268['limit']=qs[_0xe1af('0x3f')](_0x28b8f9[_0xe1af('0x3a')]['limit']);_0x52a268[_0xe1af('0x40')]=qs[_0xe1af('0x40')](_0x28b8f9[_0xe1af('0x3a')][_0xe1af('0x40')]);}return _0x2b5467[_0xe1af('0x90')](_0x52a268);}})[_0xe1af('0x2b')](function(_0x5ec55f){if(_0x5ec55f){return _0x5ec55f?{'count':_0x452899,'rows':_0x5ec55f}:null;}})['then'](respondWithResult(_0x56bf57,null))[_0xe1af('0x4b')](handleError(_0x56bf57,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 911d51a..8911283 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 _0xde28=['save','update','emit','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xde28,0xb9));var _0x8de2=function(_0x2a54df,_0x45ea17){_0x2a54df=_0x2a54df-0x0;var _0x1d5f05=_0xde28[_0x2a54df];return _0x1d5f05;};'use strict';var EventEmitter=require(_0x8de2('0x0'));var FaxQueue=require(_0x8de2('0x1'))['db'][_0x8de2('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8de2('0x3')](0x0);var events={'afterCreate':_0x8de2('0x4'),'afterUpdate':_0x8de2('0x5'),'afterDestroy':'remove'};function emitEvent(_0xbf05d8){return function(_0x5d6b63,_0x5b5121,_0x586c5e){FaxQueueEvents[_0x8de2('0x6')](_0xbf05d8+':'+_0x5d6b63['id'],_0x5d6b63);FaxQueueEvents['emit'](_0xbf05d8,_0x5d6b63);_0x586c5e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x8de2('0x7')](e,emitEvent(event));}}module[_0x8de2('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x9bcb=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x21b928,_0x2d5b2f){var _0x5c2b3c=function(_0x1c1f01){while(--_0x1c1f01){_0x21b928['push'](_0x21b928['shift']());}};_0x5c2b3c(++_0x2d5b2f);}(_0x9bcb,0x17f));var _0xb9bc=function(_0x35d941,_0x2694e0){_0x35d941=_0x35d941-0x0;var _0x46f682=_0x9bcb[_0x35d941];return _0x46f682;};'use strict';var EventEmitter=require(_0xb9bc('0x0'));var FaxQueue=require(_0xb9bc('0x1'))['db'][_0xb9bc('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb9bc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb9bc('0x4')};function emitEvent(_0x2193f5){return function(_0x45adc0,_0xbf6ef0,_0x5009aa){FaxQueueEvents[_0xb9bc('0x5')](_0x2193f5+':'+_0x45adc0['id'],_0x45adc0);FaxQueueEvents[_0xb9bc('0x5')](_0x2193f5,_0x45adc0);_0x5009aa(null);};}for(var e in events){if(events[_0xb9bc('0x6')](e)){var event=events[e];FaxQueue[_0xb9bc('0x7')](e,emitEvent(event));}}module[_0xb9bc('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 e6dd530..546da8d 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 _0x23bb=['request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1c5ffe,_0x561035){var _0x43e4b0=function(_0xdff26b){while(--_0xdff26b){_0x1c5ffe['push'](_0x1c5ffe['shift']());}};_0x43e4b0(++_0x561035);}(_0x23bb,0xff));var _0xb23b=function(_0x346047,_0x4b6669){_0x346047=_0x346047-0x0;var _0x536fed=_0x23bb[_0x346047];return _0x536fed;};'use strict';var _=require(_0xb23b('0x0'));var util=require(_0xb23b('0x1'));var logger=require(_0xb23b('0x2'))('api');var moment=require(_0xb23b('0x3'));var BPromise=require(_0xb23b('0x4'));var rp=require(_0xb23b('0x5'));var fs=require('fs');var path=require(_0xb23b('0x6'));var rimraf=require(_0xb23b('0x7'));var config=require(_0xb23b('0x8'));var attributes=require(_0xb23b('0x9'));module[_0xb23b('0xa')]=function(_0x865327,_0x4196f5){return _0x865327[_0xb23b('0xb')]('FaxQueue',attributes,{'tableName':_0xb23b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55f8=['FaxQueue','fax_queues','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x55f8,0x65));var _0x855f=function(_0x4d3043,_0x18cc28){_0x4d3043=_0x4d3043-0x0;var _0x1b58e4=_0x55f8[_0x4d3043];return _0x1b58e4;};'use strict';var _=require(_0x855f('0x0'));var util=require('util');var logger=require(_0x855f('0x1'))(_0x855f('0x2'));var moment=require(_0x855f('0x3'));var BPromise=require('bluebird');var rp=require(_0x855f('0x4'));var fs=require('fs');var path=require(_0x855f('0x5'));var rimraf=require('rimraf');var config=require(_0x855f('0x6'));var attributes=require('./faxQueue.attributes');module[_0x855f('0x7')]=function(_0xc5bd10,_0x55ad06){return _0xc5bd10[_0x855f('0x8')](_0x855f('0x9'),attributes,{'tableName':_0x855f('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 d383271..298fc83 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 _0x32d5=['localhost','socket.io-emitter','register','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetFaxQueue','FaxQueue','options','where','attributes','map','include','model','catch','ShowFaxQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x7553ff,_0x121304){var _0x399cce=function(_0x1e015b){while(--_0x1e015b){_0x7553ff['push'](_0x7553ff['shift']());}};_0x399cce(++_0x121304);}(_0x32d5,0xa3));var _0x532d=function(_0x30ae21,_0x39d7c8){_0x30ae21=_0x30ae21-0x0;var _0x3c255c=_0x32d5[_0x30ae21];return _0x3c255c;};'use strict';var _=require(_0x532d('0x0'));var util=require(_0x532d('0x1'));var moment=require('moment');var BPromise=require(_0x532d('0x2'));var rs=require(_0x532d('0x3'));var fs=require('fs');var Redis=require(_0x532d('0x4'));var db=require(_0x532d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x532d('0x6'));var config=require(_0x532d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x532d('0x8')][_0x532d('0x9')]({'port':0x232a});config[_0x532d('0xa')]=_[_0x532d('0xb')](config['redis'],{'host':_0x532d('0xc'),'port':0x18eb});var socket=require(_0x532d('0xd'))(new Redis(config[_0x532d('0xa')]));require('./faxQueue.socket')[_0x532d('0xe')](socket);function respondWithRpcPromise(_0x2f79ec,_0x22b00a,_0x5e8355){return new BPromise(function(_0x28bc8a,_0x484d00){return client['request'](_0x2f79ec,_0x5e8355)[_0x532d('0xf')](function(_0x277424){logger[_0x532d('0x10')](_0x532d('0x11'),_0x22b00a,'request\x20sent');logger[_0x532d('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x22b00a,_0x532d('0x13'),JSON[_0x532d('0x14')](_0x277424));if(_0x277424[_0x532d('0x15')]){if(_0x277424[_0x532d('0x15')][_0x532d('0x16')]===0x1f4){logger[_0x532d('0x15')]('FaxQueue,\x20%s,\x20%s',_0x22b00a,_0x277424[_0x532d('0x15')][_0x532d('0x17')]);return _0x484d00(_0x277424[_0x532d('0x15')][_0x532d('0x17')]);}logger[_0x532d('0x15')](_0x532d('0x11'),_0x22b00a,_0x277424[_0x532d('0x15')][_0x532d('0x17')]);return _0x28bc8a(_0x277424[_0x532d('0x15')][_0x532d('0x17')]);}else{logger[_0x532d('0x10')]('FaxQueue,\x20%s,\x20%s',_0x22b00a,'request\x20sent');_0x28bc8a(_0x277424[_0x532d('0x18')][_0x532d('0x17')]);}})['catch'](function(_0x54ff3e){logger[_0x532d('0x15')](_0x532d('0x11'),_0x22b00a,_0x54ff3e);_0x484d00(_0x54ff3e);});});}exports[_0x532d('0x19')]=function(_0x4f112e){var _0xd8a1ba=this;return new Promise(function(_0x38d3fb,_0x315650){return db[_0x532d('0x1a')]['findAll']({'raw':_0x4f112e['options']?_0x4f112e[_0x532d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4f112e[_0x532d('0x1b')]?_0x4f112e[_0x532d('0x1b')][_0x532d('0x1c')]||null:null,'attributes':_0x4f112e['options']?_0x4f112e[_0x532d('0x1b')][_0x532d('0x1d')]||null:null,'limit':_0x4f112e[_0x532d('0x1b')]?_0x4f112e['options']['limit']||null:null,'include':_0x4f112e['options']?_0x4f112e[_0x532d('0x1b')]['include']?_[_0x532d('0x1e')](_0x4f112e[_0x532d('0x1b')][_0x532d('0x1f')],function(_0x248bda){return{'model':db[_0x248bda[_0x532d('0x20')]],'as':_0x248bda['as'],'attributes':_0x248bda[_0x532d('0x1d')],'include':_0x248bda[_0x532d('0x1f')]?_[_0x532d('0x1e')](_0x248bda[_0x532d('0x1f')],function(_0x576584){return{'model':db[_0x576584[_0x532d('0x20')]],'as':_0x576584['as'],'attributes':_0x576584[_0x532d('0x1d')],'include':_0x576584['include']?_[_0x532d('0x1e')](_0x576584[_0x532d('0x1f')],function(_0x4d3545){return{'model':db[_0x4d3545['model']],'as':_0x4d3545['as'],'attributes':_0x4d3545['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x520430){logger[_0x532d('0x10')](_0x532d('0x19'),_0x4f112e);logger[_0x532d('0x12')](_0x532d('0x19'),_0x4f112e,JSON[_0x532d('0x14')](_0x520430));_0x38d3fb(_0x520430);})[_0x532d('0x21')](function(_0x33d4d5){logger[_0x532d('0x15')](_0x532d('0x19'),_0x33d4d5[_0x532d('0x17')],_0x4f112e);_0x315650(_0xd8a1ba[_0x532d('0x15')](0x1f4,_0x33d4d5['message']));});});};exports['ShowFaxQueue']=function(_0x57f916){var _0x17f7c2=this;return new Promise(function(_0x38f469,_0x24aee2){return db[_0x532d('0x1a')]['find']({'raw':_0x57f916[_0x532d('0x1b')]?_0x57f916['options']['raw']===undefined?!![]:![]:!![],'where':_0x57f916[_0x532d('0x1b')]?_0x57f916[_0x532d('0x1b')][_0x532d('0x1c')]||null:null,'attributes':_0x57f916[_0x532d('0x1b')]?_0x57f916[_0x532d('0x1b')][_0x532d('0x1d')]||null:null,'include':_0x57f916[_0x532d('0x1b')]?_0x57f916[_0x532d('0x1b')][_0x532d('0x1f')]?_[_0x532d('0x1e')](_0x57f916[_0x532d('0x1b')][_0x532d('0x1f')],function(_0x3510cb){return{'model':db[_0x3510cb[_0x532d('0x20')]],'as':_0x3510cb['as'],'attributes':_0x3510cb[_0x532d('0x1d')],'include':_0x3510cb[_0x532d('0x1f')]?_[_0x532d('0x1e')](_0x3510cb['include'],function(_0x2c9bab){return{'model':db[_0x2c9bab[_0x532d('0x20')]],'as':_0x2c9bab['as'],'attributes':_0x2c9bab['attributes'],'include':_0x2c9bab[_0x532d('0x1f')]?_[_0x532d('0x1e')](_0x2c9bab[_0x532d('0x1f')],function(_0x301ea0){return{'model':db[_0x301ea0['model']],'as':_0x301ea0['as'],'attributes':_0x301ea0[_0x532d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x532d('0xf')](function(_0x9a1e36){logger[_0x532d('0x10')]('ShowFaxQueue',_0x57f916);logger[_0x532d('0x12')](_0x532d('0x22'),_0x57f916,JSON[_0x532d('0x14')](_0x9a1e36));_0x38f469(_0x9a1e36);})[_0x532d('0x21')](function(_0x2f8fc1){logger[_0x532d('0x15')](_0x532d('0x22'),_0x2f8fc1[_0x532d('0x17')],_0x57f916);_0x24aee2(_0x17f7c2[_0x532d('0x15')](0x1f4,_0x2f8fc1[_0x532d('0x17')]));});});}; \ No newline at end of file +var _0xb0e4=['defaults','localhost','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3f9fef,_0x3577bf){var _0x4f29c7=function(_0x219433){while(--_0x219433){_0x3f9fef['push'](_0x3f9fef['shift']());}};_0x4f29c7(++_0x3577bf);}(_0xb0e4,0x99));var _0x4b0e=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xb0e4[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x4b0e('0x0'));var util=require(_0x4b0e('0x1'));var moment=require(_0x4b0e('0x2'));var BPromise=require(_0x4b0e('0x3'));var rs=require(_0x4b0e('0x4'));var fs=require('fs');var Redis=require(_0x4b0e('0x5'));var db=require(_0x4b0e('0x6'))['db'];var utils=require(_0x4b0e('0x7'));var logger=require(_0x4b0e('0x8'))(_0x4b0e('0x9'));var config=require(_0x4b0e('0xa'));var jayson=require(_0x4b0e('0xb'));var client=jayson[_0x4b0e('0xc')][_0x4b0e('0xd')]({'port':0x232a});config[_0x4b0e('0xe')]=_[_0x4b0e('0xf')](config[_0x4b0e('0xe')],{'host':_0x4b0e('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b0e('0xe')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x176670,_0x616923,_0x325431){return new BPromise(function(_0x2a3696,_0x41afb5){return client[_0x4b0e('0x11')](_0x176670,_0x325431)[_0x4b0e('0x12')](function(_0x5757c1){logger[_0x4b0e('0x13')](_0x4b0e('0x14'),_0x616923,_0x4b0e('0x15'));logger[_0x4b0e('0x16')](_0x4b0e('0x17'),_0x616923,'request\x20sent',JSON[_0x4b0e('0x18')](_0x5757c1));if(_0x5757c1['error']){if(_0x5757c1[_0x4b0e('0x19')][_0x4b0e('0x1a')]===0x1f4){logger[_0x4b0e('0x19')](_0x4b0e('0x14'),_0x616923,_0x5757c1[_0x4b0e('0x19')][_0x4b0e('0x1b')]);return _0x41afb5(_0x5757c1[_0x4b0e('0x19')]['message']);}logger[_0x4b0e('0x19')](_0x4b0e('0x14'),_0x616923,_0x5757c1[_0x4b0e('0x19')]['message']);return _0x2a3696(_0x5757c1[_0x4b0e('0x19')][_0x4b0e('0x1b')]);}else{logger[_0x4b0e('0x13')](_0x4b0e('0x14'),_0x616923,_0x4b0e('0x15'));_0x2a3696(_0x5757c1[_0x4b0e('0x1c')][_0x4b0e('0x1b')]);}})[_0x4b0e('0x1d')](function(_0xbd91f3){logger[_0x4b0e('0x19')]('FaxQueue,\x20%s,\x20%s',_0x616923,_0xbd91f3);_0x41afb5(_0xbd91f3);});});}exports['GetFaxQueue']=function(_0x34daeb){var _0xf4e456=this;return new Promise(function(_0x57f9d6,_0x49e5d2){return db[_0x4b0e('0x1e')][_0x4b0e('0x1f')]({'raw':_0x34daeb['options']?_0x34daeb[_0x4b0e('0x20')][_0x4b0e('0x21')]===undefined?!![]:![]:!![],'where':_0x34daeb[_0x4b0e('0x20')]?_0x34daeb[_0x4b0e('0x20')][_0x4b0e('0x22')]||null:null,'attributes':_0x34daeb[_0x4b0e('0x20')]?_0x34daeb['options'][_0x4b0e('0x23')]||null:null,'limit':_0x34daeb[_0x4b0e('0x20')]?_0x34daeb[_0x4b0e('0x20')]['limit']||null:null,'include':_0x34daeb[_0x4b0e('0x20')]?_0x34daeb[_0x4b0e('0x20')][_0x4b0e('0x24')]?_[_0x4b0e('0x25')](_0x34daeb[_0x4b0e('0x20')][_0x4b0e('0x24')],function(_0x834359){return{'model':db[_0x834359[_0x4b0e('0x26')]],'as':_0x834359['as'],'attributes':_0x834359[_0x4b0e('0x23')],'include':_0x834359['include']?_[_0x4b0e('0x25')](_0x834359['include'],function(_0x417be3){return{'model':db[_0x417be3[_0x4b0e('0x26')]],'as':_0x417be3['as'],'attributes':_0x417be3[_0x4b0e('0x23')],'include':_0x417be3['include']?_[_0x4b0e('0x25')](_0x417be3[_0x4b0e('0x24')],function(_0x8ba4db){return{'model':db[_0x8ba4db[_0x4b0e('0x26')]],'as':_0x8ba4db['as'],'attributes':_0x8ba4db[_0x4b0e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4b0e('0x12')](function(_0x21c56d){logger[_0x4b0e('0x13')](_0x4b0e('0x27'),_0x34daeb);logger[_0x4b0e('0x16')](_0x4b0e('0x27'),_0x34daeb,JSON[_0x4b0e('0x18')](_0x21c56d));_0x57f9d6(_0x21c56d);})[_0x4b0e('0x1d')](function(_0x2ef904){logger[_0x4b0e('0x19')](_0x4b0e('0x27'),_0x2ef904[_0x4b0e('0x1b')],_0x34daeb);_0x49e5d2(_0xf4e456[_0x4b0e('0x19')](0x1f4,_0x2ef904[_0x4b0e('0x1b')]));});});};exports[_0x4b0e('0x28')]=function(_0x2a8f5a){var _0x5cb6d5=this;return new Promise(function(_0x1b5e03,_0x80149d){return db[_0x4b0e('0x1e')][_0x4b0e('0x29')]({'raw':_0x2a8f5a[_0x4b0e('0x20')]?_0x2a8f5a[_0x4b0e('0x20')][_0x4b0e('0x21')]===undefined?!![]:![]:!![],'where':_0x2a8f5a[_0x4b0e('0x20')]?_0x2a8f5a[_0x4b0e('0x20')][_0x4b0e('0x22')]||null:null,'attributes':_0x2a8f5a[_0x4b0e('0x20')]?_0x2a8f5a[_0x4b0e('0x20')][_0x4b0e('0x23')]||null:null,'include':_0x2a8f5a[_0x4b0e('0x20')]?_0x2a8f5a[_0x4b0e('0x20')][_0x4b0e('0x24')]?_['map'](_0x2a8f5a[_0x4b0e('0x20')][_0x4b0e('0x24')],function(_0x230b2a){return{'model':db[_0x230b2a[_0x4b0e('0x26')]],'as':_0x230b2a['as'],'attributes':_0x230b2a[_0x4b0e('0x23')],'include':_0x230b2a[_0x4b0e('0x24')]?_[_0x4b0e('0x25')](_0x230b2a['include'],function(_0x23c3ce){return{'model':db[_0x23c3ce[_0x4b0e('0x26')]],'as':_0x23c3ce['as'],'attributes':_0x23c3ce[_0x4b0e('0x23')],'include':_0x23c3ce['include']?_[_0x4b0e('0x25')](_0x23c3ce['include'],function(_0x1b21ed){return{'model':db[_0x1b21ed[_0x4b0e('0x26')]],'as':_0x1b21ed['as'],'attributes':_0x1b21ed['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b0e('0x12')](function(_0x4684dc){logger[_0x4b0e('0x13')](_0x4b0e('0x28'),_0x2a8f5a);logger[_0x4b0e('0x16')](_0x4b0e('0x28'),_0x2a8f5a,JSON[_0x4b0e('0x18')](_0x4684dc));_0x1b5e03(_0x4684dc);})[_0x4b0e('0x1d')](function(_0x19e3f0){logger['error'](_0x4b0e('0x28'),_0x19e3f0['message'],_0x2a8f5a);_0x80149d(_0x5cb6d5[_0x4b0e('0x19')](0x1f4,_0x19e3f0[_0x4b0e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cd3fba8..2cfff64 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 _0xc741=['./faxQueue.events','save','remove','update','emit','removeListener','faxQueue:'];(function(_0xe7a4b5,_0x200412){var _0xe5bb55=function(_0x3ab258){while(--_0x3ab258){_0xe7a4b5['push'](_0xe7a4b5['shift']());}};_0xe5bb55(++_0x200412);}(_0xc741,0xe7));var _0x1c74=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc741[_0x8c43de];return _0xa6591b;};'use strict';var FaxQueueEvents=require(_0x1c74('0x0'));var events=[_0x1c74('0x1'),_0x1c74('0x2'),_0x1c74('0x3')];function createListener(_0x405405,_0x29ebc0){return function(_0x3054bb){_0x29ebc0[_0x1c74('0x4')](_0x405405,_0x3054bb);};}function removeListener(_0x1785e3,_0x15193c){return function(){FaxQueueEvents[_0x1c74('0x5')](_0x1785e3,_0x15193c);};}exports['register']=function(_0x169fbc){for(var _0x1fb5f0=0x0,_0x3abc3d=events['length'];_0x1fb5f0<_0x3abc3d;_0x1fb5f0++){var _0x508c9d=events[_0x1fb5f0];var _0x56ef07=createListener(_0x1c74('0x6')+_0x508c9d,_0x169fbc);FaxQueueEvents['on'](_0x508c9d,_0x56ef07);}}; \ No newline at end of file +var _0xa906=['./faxQueue.events','remove','removeListener'];(function(_0x49a05f,_0x48f046){var _0x572b78=function(_0x4998ad){while(--_0x4998ad){_0x49a05f['push'](_0x49a05f['shift']());}};_0x572b78(++_0x48f046);}(_0xa906,0x1e3));var _0x6a90=function(_0x3fb3aa,_0x3169ab){_0x3fb3aa=_0x3fb3aa-0x0;var _0x10a8c0=_0xa906[_0x3fb3aa];return _0x10a8c0;};'use strict';var FaxQueueEvents=require(_0x6a90('0x0'));var events=['save',_0x6a90('0x1'),'update'];function createListener(_0x4c4166,_0xae4e61){return function(_0x14d21a){_0xae4e61['emit'](_0x4c4166,_0x14d21a);};}function removeListener(_0x5f307e,_0x442d26){return function(){FaxQueueEvents[_0x6a90('0x2')](_0x5f307e,_0x442d26);};}exports['register']=function(_0x88b473){for(var _0xae4bb4=0x0,_0x219261=events['length'];_0xae4bb4<_0x219261;_0xae4bb4++){var _0x49fa45=events[_0xae4bb4];var _0x427a66=createListener('faxQueue:'+_0x49fa45,_0x88b473);FaxQueueEvents['on'](_0x49fa45,_0x427a66);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6d8c81b..c2c217a 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb22=['/:id/members','getMembers','getTeams','getAgents','post','/:id/teams','addTeams','/:id/users','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x5b13c3,_0x378e0a){var _0x3d6780=function(_0x6327a6){while(--_0x6327a6){_0x5b13c3['push'](_0x5b13c3['shift']());}};_0x3d6780(++_0x378e0a);}(_0xcb22,0xc8));var _0x2cb2=function(_0x14eba6,_0x395ec9){_0x14eba6=_0x14eba6-0x0;var _0x37f5ad=_0xcb22[_0x14eba6];return _0x37f5ad;};'use strict';var multer=require(_0x2cb2('0x0'));var util=require(_0x2cb2('0x1'));var path=require(_0x2cb2('0x2'));var timeout=require(_0x2cb2('0x3'));var express=require(_0x2cb2('0x4'));var router=express[_0x2cb2('0x5')]();var fs_extra=require(_0x2cb2('0x6'));var auth=require(_0x2cb2('0x7'));var interaction=require(_0x2cb2('0x8'));var config=require(_0x2cb2('0x9'));var controller=require(_0x2cb2('0xa'));router['get']('/',auth[_0x2cb2('0xb')](),controller[_0x2cb2('0xc')]);router[_0x2cb2('0xd')](_0x2cb2('0xe'),auth[_0x2cb2('0xb')](),controller['describe']);router[_0x2cb2('0xd')](_0x2cb2('0xf'),auth['isAuthenticated'](),controller[_0x2cb2('0x10')]);router[_0x2cb2('0xd')](_0x2cb2('0x11'),auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x12')]);router[_0x2cb2('0xd')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2cb2('0x13')]);router[_0x2cb2('0xd')]('/:id/users',auth['isAuthenticated'](),controller[_0x2cb2('0x14')]);router['post']('/',auth[_0x2cb2('0xb')](),controller['create']);router[_0x2cb2('0x15')](_0x2cb2('0x16'),auth['isAuthenticated'](),controller[_0x2cb2('0x17')]);router[_0x2cb2('0x15')](_0x2cb2('0x18'),auth['isAuthenticated'](),controller[_0x2cb2('0x19')]);router[_0x2cb2('0x1a')]('/:id',auth[_0x2cb2('0xb')](),controller['update']);router[_0x2cb2('0x1b')](_0x2cb2('0xf'),auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x1c')]);router[_0x2cb2('0x1b')](_0x2cb2('0x16'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2cb2('0xb')](),controller[_0x2cb2('0x1d')]);module[_0x2cb2('0x1e')]=router; \ No newline at end of file +var _0x50a5=['exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeAgents'];(function(_0x56d922,_0x57d132){var _0x6ab6e8=function(_0x306f62){while(--_0x306f62){_0x56d922['push'](_0x56d922['shift']());}};_0x6ab6e8(++_0x57d132);}(_0x50a5,0xd1));var _0x550a=function(_0x561383,_0x45db94){_0x561383=_0x561383-0x0;var _0x42985d=_0x50a5[_0x561383];return _0x42985d;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x550a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var controller=require(_0x550a('0x5'));router[_0x550a('0x6')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0x8')]);router[_0x550a('0x6')](_0x550a('0x9'),auth[_0x550a('0x7')](),controller[_0x550a('0xa')]);router[_0x550a('0x6')](_0x550a('0xb'),auth[_0x550a('0x7')](),controller['show']);router[_0x550a('0x6')](_0x550a('0xc'),auth[_0x550a('0x7')](),controller[_0x550a('0xd')]);router[_0x550a('0x6')](_0x550a('0xe'),auth['isAuthenticated'](),controller[_0x550a('0xf')]);router[_0x550a('0x6')](_0x550a('0x10'),auth[_0x550a('0x7')](),controller[_0x550a('0x11')]);router[_0x550a('0x12')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0x13')]);router['post'](_0x550a('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x550a('0x12')](_0x550a('0x10'),auth['isAuthenticated'](),controller[_0x550a('0x14')]);router['put'](_0x550a('0xb'),auth['isAuthenticated'](),controller[_0x550a('0x15')]);router[_0x550a('0x16')](_0x550a('0xb'),auth[_0x550a('0x7')](),controller[_0x550a('0x17')]);router[_0x550a('0x16')]('/:id/teams',auth[_0x550a('0x7')](),controller['removeTeams']);router[_0x550a('0x16')](_0x550a('0x10'),auth[_0x550a('0x7')](),controller[_0x550a('0x18')]);module[_0x550a('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 8b108a4..7a70301 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 _0xf01c=['STRING','DATE','moment','sequelize','exports'];(function(_0x5d4a2b,_0xaabd31){var _0x34529b=function(_0x35b06f){while(--_0x35b06f){_0x5d4a2b['push'](_0x5d4a2b['shift']());}};_0x34529b(++_0xaabd31);}(_0xf01c,0x165));var _0xcf01=function(_0x2db9ff,_0x2836f5){_0x2db9ff=_0x2db9ff-0x0;var _0x521d16=_0xf01c[_0x2db9ff];return _0x521d16;};'use strict';var moment=require(_0xcf01('0x0'));var Sequelize=require(_0xcf01('0x1'));module[_0xcf01('0x2')]={'uniqueid':{'type':Sequelize[_0xcf01('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcf01('0x4')]},'leaveAt':{'type':Sequelize[_0xcf01('0x4')]},'acceptAt':{'type':Sequelize[_0xcf01('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcf01('0x3')]}}; \ No newline at end of file +var _0x02a6=['STRING','DATE','moment','sequelize'];(function(_0x2d8e15,_0x100bba){var _0x5c8f62=function(_0x253899){while(--_0x253899){_0x2d8e15['push'](_0x2d8e15['shift']());}};_0x5c8f62(++_0x100bba);}(_0x02a6,0x72));var _0x602a=function(_0x60628f,_0x2c2e4c){_0x60628f=_0x60628f-0x0;var _0x53612f=_0x02a6[_0x60628f];return _0x53612f;};'use strict';var moment=require(_0x602a('0x0'));var Sequelize=require(_0x602a('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x602a('0x2')]},'joinAt':{'type':Sequelize[_0x602a('0x3')]},'leaveAt':{'type':Sequelize[_0x602a('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x602a('0x3')]},'reason':{'type':Sequelize[_0x602a('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 346e3a4..e1f4eb2 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 _0xd73a=['show','keys','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','send','map','rawAttributes','fieldName','key','model','name','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','FaxQueueReport','include','rows','catch'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xd73a,0x171));var _0xad73=function(_0x2c5ed8,_0x4154f4){_0x2c5ed8=_0x2c5ed8-0x0;var _0x1c9be8=_0xd73a[_0x2c5ed8];return _0x1c9be8;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1045be,_0x241ff5){_0x241ff5=_0x241ff5||0xcc;return function(_0x488787){if(_0x488787){return _0x1045be[_0xad73('0x18')](_0x241ff5);}return _0x1045be[_0xad73('0x19')](_0x241ff5)[_0xad73('0x1a')]();};}function respondWithResult(_0x27a9d2,_0x15f72d){_0x15f72d=_0x15f72d||0xc8;return function(_0x82fe13){if(_0x82fe13){return _0x27a9d2['status'](_0x15f72d)[_0xad73('0x1b')](_0x82fe13);}};}function respondWithFilteredResult(_0x35c2c5,_0x4336fa){return function(_0x155548){if(_0x155548){var _0x2f0dcd=typeof _0x4336fa[_0xad73('0x1c')]===_0xad73('0x1d')&&typeof _0x4336fa[_0xad73('0x1e')]===_0xad73('0x1d');var _0xad072c=_0x155548['count'];var _0x47381a=_0x2f0dcd?0x0:_0x4336fa['offset'];var _0x5bd242=_0x2f0dcd?_0x155548[_0xad73('0x1f')]:_0x4336fa[_0xad73('0x1c')]+_0x4336fa[_0xad73('0x1e')];var _0x578068;if(_0x5bd242>=_0xad072c){_0x5bd242=_0xad072c;_0x578068=0xc8;}else{_0x578068=0xce;}_0x35c2c5[_0xad73('0x19')](_0x578068);return _0x35c2c5[_0xad73('0x20')]('Content-Range',_0x47381a+'-'+_0x5bd242+'/'+_0xad072c)[_0xad73('0x1b')](_0x155548);}return null;};}function patchUpdates(_0x4289df){return function(_0x3e02ed){try{jsonpatch[_0xad73('0x21')](_0x3e02ed,_0x4289df,!![]);}catch(_0x2e6cdb){return BPromise[_0xad73('0x22')](_0x2e6cdb);}return _0x3e02ed[_0xad73('0x23')]();};}function saveUpdates(_0x497c3d,_0xfe2758){return function(_0x31f5c4){if(_0x31f5c4){return _0x31f5c4[_0xad73('0x24')](_0x497c3d)[_0xad73('0x25')](function(_0xb3e0b0){return _0xb3e0b0;});}return null;};}function removeEntity(_0x2a1295,_0xbfb297){return function(_0x439f09){if(_0x439f09){return _0x439f09[_0xad73('0x26')]()[_0xad73('0x25')](function(){_0x2a1295[_0xad73('0x19')](0xcc)[_0xad73('0x1a')]();});}};}function handleEntityNotFound(_0x182805,_0xfec523){return function(_0x1b7d84){if(!_0x1b7d84){_0x182805[_0xad73('0x18')](0x194);}return _0x1b7d84;};}function handleError(_0x34f8c4,_0x920ffc){_0x920ffc=_0x920ffc||0x1f4;return function(_0xb7700c){logger[_0xad73('0x27')](_0xb7700c['stack']);if(_0xb7700c['name']){delete _0xb7700c['name'];}_0x34f8c4[_0xad73('0x19')](_0x920ffc)[_0xad73('0x28')](_0xb7700c);};}exports['index']=function(_0x3f1f80,_0x54a8f9){var _0x54eadc={},_0x1f826c={},_0x377273={'count':0x0,'rows':[]};var _0x34fe4d=_[_0xad73('0x29')](db['FaxQueueReport'][_0xad73('0x2a')],function(_0x3fab83){return{'name':_0x3fab83[_0xad73('0x2b')],'type':_0x3fab83['type'][_0xad73('0x2c')]};});_0x1f826c[_0xad73('0x2d')]=_[_0xad73('0x29')](_0x34fe4d,_0xad73('0x2e'));_0x1f826c[_0xad73('0x2f')]=_['keys'](_0x3f1f80['query']);_0x1f826c['filters']=_[_0xad73('0x30')](_0x1f826c['model'],_0x1f826c[_0xad73('0x2f')]);_0x54eadc['attributes']=_[_0xad73('0x30')](_0x1f826c[_0xad73('0x2d')],qs['fields'](_0x3f1f80['query'][_0xad73('0x31')]));_0x54eadc[_0xad73('0x32')]=_0x54eadc['attributes']['length']?_0x54eadc[_0xad73('0x32')]:_0x1f826c['model'];if(!_0x3f1f80[_0xad73('0x2f')][_0xad73('0x33')]('nolimit')){_0x54eadc[_0xad73('0x1e')]=qs['limit'](_0x3f1f80[_0xad73('0x2f')][_0xad73('0x1e')]);_0x54eadc[_0xad73('0x1c')]=qs[_0xad73('0x1c')](_0x3f1f80[_0xad73('0x2f')][_0xad73('0x1c')]);}_0x54eadc[_0xad73('0x34')]=qs[_0xad73('0x35')](_0x3f1f80[_0xad73('0x2f')]['sort']);_0x54eadc[_0xad73('0x36')]=qs[_0xad73('0x37')](_['pick'](_0x3f1f80[_0xad73('0x2f')],_0x1f826c[_0xad73('0x37')]),_0x34fe4d);if(_0x3f1f80[_0xad73('0x2f')][_0xad73('0x38')]){_0x54eadc[_0xad73('0x36')]=_[_0xad73('0x39')](_0x54eadc[_0xad73('0x36')],{'$or':_[_0xad73('0x29')](_0x34fe4d,function(_0x18e9ec){if(_0x18e9ec['type']!==_0xad73('0x3a')){var _0x390c2a={};_0x390c2a[_0x18e9ec[_0xad73('0x2e')]]={'$like':'%'+_0x3f1f80['query']['filter']+'%'};return _0x390c2a;}})});}_0x54eadc=_[_0xad73('0x39')]({},_0x54eadc,_0x3f1f80['options']);var _0x539e3a={'where':_0x54eadc[_0xad73('0x36')]};return db[_0xad73('0x3b')][_0xad73('0x1f')](_0x539e3a)[_0xad73('0x25')](function(_0x4e68b5){_0x377273[_0xad73('0x1f')]=_0x4e68b5;if(_0x3f1f80[_0xad73('0x2f')]['includeAll']){_0x54eadc[_0xad73('0x3c')]=[{'all':!![]}];}return db[_0xad73('0x3b')]['findAll'](_0x54eadc);})[_0xad73('0x25')](function(_0x46f3e8){_0x377273[_0xad73('0x3d')]=_0x46f3e8;return _0x377273;})['then'](respondWithFilteredResult(_0x54a8f9,_0x54eadc))[_0xad73('0x3e')](handleError(_0x54a8f9,null));};exports[_0xad73('0x3f')]=function(_0xfa6386,_0x3d2ef0){var _0x1f46bf={'raw':!![],'where':{'id':_0xfa6386['params']['id']}},_0x4ee68d={};_0x4ee68d['model']=_[_0xad73('0x40')](db[_0xad73('0x3b')][_0xad73('0x2a')]);_0x4ee68d[_0xad73('0x2f')]=_[_0xad73('0x40')](_0xfa6386[_0xad73('0x2f')]);_0x4ee68d[_0xad73('0x37')]=_['intersection'](_0x4ee68d[_0xad73('0x2d')],_0x4ee68d[_0xad73('0x2f')]);_0x1f46bf['attributes']=_['intersection'](_0x4ee68d[_0xad73('0x2d')],qs[_0xad73('0x31')](_0xfa6386[_0xad73('0x2f')][_0xad73('0x31')]));_0x1f46bf['attributes']=_0x1f46bf[_0xad73('0x32')][_0xad73('0x41')]?_0x1f46bf[_0xad73('0x32')]:_0x4ee68d['model'];if(_0xfa6386[_0xad73('0x2f')][_0xad73('0x42')]){_0x1f46bf[_0xad73('0x3c')]=[{'all':!![]}];}_0x1f46bf=_[_0xad73('0x39')]({},_0x1f46bf,_0xfa6386['options']);return db['FaxQueueReport'][_0xad73('0x43')](_0x1f46bf)[_0xad73('0x25')](handleEntityNotFound(_0x3d2ef0,null))[_0xad73('0x25')](respondWithResult(_0x3d2ef0,null))[_0xad73('0x3e')](handleError(_0x3d2ef0,null));};exports[_0xad73('0x44')]=function(_0x449afb,_0x21d57f){return db[_0xad73('0x3b')][_0xad73('0x44')](_0x449afb['body'],{})['then'](respondWithResult(_0x21d57f,0xc9))[_0xad73('0x3e')](handleError(_0x21d57f,null));};exports[_0xad73('0x24')]=function(_0xd5f21,_0x5b6e41){if(_0xd5f21[_0xad73('0x45')]['id']){delete _0xd5f21[_0xad73('0x45')]['id'];}return db[_0xad73('0x3b')][_0xad73('0x43')]({'where':{'id':_0xd5f21['params']['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x5b6e41,null))[_0xad73('0x25')](saveUpdates(_0xd5f21[_0xad73('0x45')],null))['then'](respondWithResult(_0x5b6e41,null))[_0xad73('0x3e')](handleError(_0x5b6e41,null));};exports[_0xad73('0x26')]=function(_0x3e884f,_0x15478a){return db['FaxQueueReport']['find']({'where':{'id':_0x3e884f[_0xad73('0x46')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x15478a,null))[_0xad73('0x25')](removeEntity(_0x15478a,null))['catch'](handleError(_0x15478a,null));};exports[_0xad73('0x47')]=function(_0xe01f9a,_0x1e412f){return db[_0xad73('0x3b')][_0xad73('0x47')]()[_0xad73('0x25')](respondWithResult(_0x1e412f,null))[_0xad73('0x3e')](handleError(_0x1e412f,null));}; \ No newline at end of file +var _0x50c1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','destroy','then','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','FaxQueueReport','findAll','rows','show','params','rawAttributes','includeAll','include','options','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4f96eb,_0x6970c5){var _0x258617=function(_0x4a71d6){while(--_0x4a71d6){_0x4f96eb['push'](_0x4f96eb['shift']());}};_0x258617(++_0x6970c5);}(_0x50c1,0x1a5));var _0x150c=function(_0x283462,_0x511288){_0x283462=_0x283462-0x0;var _0x4e2741=_0x50c1[_0x283462];return _0x4e2741;};'use strict';var emlformat=require(_0x150c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x150c('0x1'));var rp=require(_0x150c('0x2'));var moment=require(_0x150c('0x3'));var BPromise=require(_0x150c('0x4'));var Mustache=require(_0x150c('0x5'));var util=require(_0x150c('0x6'));var path=require(_0x150c('0x7'));var sox=require(_0x150c('0x8'));var csv=require(_0x150c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x150c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x150c('0xb'));var deskjs=require(_0x150c('0xc'));var toCsv=require(_0x150c('0x9'));var querystring=require(_0x150c('0xd'));var Papa=require(_0x150c('0xe'));var Redis=require(_0x150c('0xf'));var authService=require(_0x150c('0x10'));var qs=require(_0x150c('0x11'));var as=require(_0x150c('0x12'));var hardwareService=require(_0x150c('0x13'));var logger=require('../../config/logger')(_0x150c('0x14'));var utils=require(_0x150c('0x15'));var config=require(_0x150c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x150c('0x17'))['db'];function respondWithStatusCode(_0x4e2f73,_0x4c513d){_0x4c513d=_0x4c513d||0xcc;return function(_0x2c9a8a){if(_0x2c9a8a){return _0x4e2f73[_0x150c('0x18')](_0x4c513d);}return _0x4e2f73[_0x150c('0x19')](_0x4c513d)[_0x150c('0x1a')]();};}function respondWithResult(_0x293b98,_0x17205c){_0x17205c=_0x17205c||0xc8;return function(_0x333600){if(_0x333600){return _0x293b98[_0x150c('0x19')](_0x17205c)[_0x150c('0x1b')](_0x333600);}};}function respondWithFilteredResult(_0x3c6772,_0x11bc9e){return function(_0x2c0626){if(_0x2c0626){var _0x5c657f=typeof _0x11bc9e[_0x150c('0x1c')]==='undefined'&&typeof _0x11bc9e[_0x150c('0x1d')]==='undefined';var _0x59ae9e=_0x2c0626[_0x150c('0x1e')];var _0x40c0d0=_0x5c657f?0x0:_0x11bc9e[_0x150c('0x1c')];var _0x3c5a84=_0x5c657f?_0x2c0626['count']:_0x11bc9e[_0x150c('0x1c')]+_0x11bc9e[_0x150c('0x1d')];var _0x9a9d64;if(_0x3c5a84>=_0x59ae9e){_0x3c5a84=_0x59ae9e;_0x9a9d64=0xc8;}else{_0x9a9d64=0xce;}_0x3c6772[_0x150c('0x19')](_0x9a9d64);return _0x3c6772[_0x150c('0x1f')](_0x150c('0x20'),_0x40c0d0+'-'+_0x3c5a84+'/'+_0x59ae9e)['json'](_0x2c0626);}return null;};}function patchUpdates(_0x220c15){return function(_0x365de8){try{jsonpatch['apply'](_0x365de8,_0x220c15,!![]);}catch(_0x12e158){return BPromise['reject'](_0x12e158);}return _0x365de8[_0x150c('0x21')]();};}function saveUpdates(_0x25503b,_0x29a2f){return function(_0x1c41f4){if(_0x1c41f4){return _0x1c41f4[_0x150c('0x22')](_0x25503b)['then'](function(_0x68b03b){return _0x68b03b;});}return null;};}function removeEntity(_0x3f9044,_0x332173){return function(_0x188536){if(_0x188536){return _0x188536[_0x150c('0x23')]()[_0x150c('0x24')](function(){_0x3f9044[_0x150c('0x19')](0xcc)[_0x150c('0x1a')]();});}};}function handleEntityNotFound(_0x3b1ce6,_0x54d11c){return function(_0x54b8dd){if(!_0x54b8dd){_0x3b1ce6[_0x150c('0x18')](0x194);}return _0x54b8dd;};}function handleError(_0x27aba8,_0x29a87c){_0x29a87c=_0x29a87c||0x1f4;return function(_0x5daf46){logger['error'](_0x5daf46[_0x150c('0x25')]);if(_0x5daf46[_0x150c('0x26')]){delete _0x5daf46[_0x150c('0x26')];}_0x27aba8[_0x150c('0x19')](_0x29a87c)[_0x150c('0x27')](_0x5daf46);};}exports[_0x150c('0x28')]=function(_0x420628,_0x522c2e){var _0x4b345f={},_0xbf4922={},_0x4021ea={'count':0x0,'rows':[]};var _0x3234ea=_[_0x150c('0x29')](db['FaxQueueReport']['rawAttributes'],function(_0x3acbc8){return{'name':_0x3acbc8[_0x150c('0x2a')],'type':_0x3acbc8[_0x150c('0x2b')]['key']};});_0xbf4922[_0x150c('0x2c')]=_['map'](_0x3234ea,_0x150c('0x26'));_0xbf4922[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x420628['query']);_0xbf4922['filters']=_[_0x150c('0x2f')](_0xbf4922['model'],_0xbf4922[_0x150c('0x2d')]);_0x4b345f[_0x150c('0x30')]=_[_0x150c('0x2f')](_0xbf4922[_0x150c('0x2c')],qs[_0x150c('0x31')](_0x420628[_0x150c('0x2d')][_0x150c('0x31')]));_0x4b345f['attributes']=_0x4b345f[_0x150c('0x30')][_0x150c('0x32')]?_0x4b345f['attributes']:_0xbf4922[_0x150c('0x2c')];if(!_0x420628[_0x150c('0x2d')][_0x150c('0x33')]('nolimit')){_0x4b345f[_0x150c('0x1d')]=qs[_0x150c('0x1d')](_0x420628[_0x150c('0x2d')]['limit']);_0x4b345f[_0x150c('0x1c')]=qs['offset'](_0x420628['query'][_0x150c('0x1c')]);}_0x4b345f['order']=qs['sort'](_0x420628[_0x150c('0x2d')][_0x150c('0x34')]);_0x4b345f[_0x150c('0x35')]=qs[_0x150c('0x36')](_[_0x150c('0x37')](_0x420628[_0x150c('0x2d')],_0xbf4922[_0x150c('0x36')]),_0x3234ea);if(_0x420628['query'][_0x150c('0x38')]){_0x4b345f[_0x150c('0x35')]=_[_0x150c('0x39')](_0x4b345f['where'],{'$or':_[_0x150c('0x29')](_0x3234ea,function(_0x401f9c){if(_0x401f9c[_0x150c('0x2b')]!==_0x150c('0x3a')){var _0x36afad={};_0x36afad[_0x401f9c['name']]={'$like':'%'+_0x420628[_0x150c('0x2d')][_0x150c('0x38')]+'%'};return _0x36afad;}})});}_0x4b345f=_[_0x150c('0x39')]({},_0x4b345f,_0x420628['options']);var _0x172787={'where':_0x4b345f[_0x150c('0x35')]};return db[_0x150c('0x3b')][_0x150c('0x1e')](_0x172787)[_0x150c('0x24')](function(_0x534d75){_0x4021ea[_0x150c('0x1e')]=_0x534d75;if(_0x420628['query']['includeAll']){_0x4b345f['include']=[{'all':!![]}];}return db[_0x150c('0x3b')][_0x150c('0x3c')](_0x4b345f);})[_0x150c('0x24')](function(_0x4503d8){_0x4021ea[_0x150c('0x3d')]=_0x4503d8;return _0x4021ea;})[_0x150c('0x24')](respondWithFilteredResult(_0x522c2e,_0x4b345f))['catch'](handleError(_0x522c2e,null));};exports[_0x150c('0x3e')]=function(_0x5c897a,_0x36f85c){var _0x16bc55={'raw':!![],'where':{'id':_0x5c897a[_0x150c('0x3f')]['id']}},_0x2a9ce4={};_0x2a9ce4[_0x150c('0x2c')]=_[_0x150c('0x2e')](db[_0x150c('0x3b')][_0x150c('0x40')]);_0x2a9ce4[_0x150c('0x2d')]=_[_0x150c('0x2e')](_0x5c897a['query']);_0x2a9ce4['filters']=_['intersection'](_0x2a9ce4['model'],_0x2a9ce4['query']);_0x16bc55[_0x150c('0x30')]=_[_0x150c('0x2f')](_0x2a9ce4[_0x150c('0x2c')],qs['fields'](_0x5c897a[_0x150c('0x2d')]['fields']));_0x16bc55[_0x150c('0x30')]=_0x16bc55[_0x150c('0x30')][_0x150c('0x32')]?_0x16bc55[_0x150c('0x30')]:_0x2a9ce4[_0x150c('0x2c')];if(_0x5c897a[_0x150c('0x2d')][_0x150c('0x41')]){_0x16bc55[_0x150c('0x42')]=[{'all':!![]}];}_0x16bc55=_[_0x150c('0x39')]({},_0x16bc55,_0x5c897a[_0x150c('0x43')]);return db[_0x150c('0x3b')]['find'](_0x16bc55)['then'](handleEntityNotFound(_0x36f85c,null))['then'](respondWithResult(_0x36f85c,null))[_0x150c('0x44')](handleError(_0x36f85c,null));};exports[_0x150c('0x45')]=function(_0xdd0bb,_0x68a748){return db[_0x150c('0x3b')][_0x150c('0x45')](_0xdd0bb[_0x150c('0x46')],{})[_0x150c('0x24')](respondWithResult(_0x68a748,0xc9))[_0x150c('0x44')](handleError(_0x68a748,null));};exports['update']=function(_0x61eaaf,_0x5e5c5d){if(_0x61eaaf[_0x150c('0x46')]['id']){delete _0x61eaaf['body']['id'];}return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x61eaaf[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x5e5c5d,null))['then'](saveUpdates(_0x61eaaf[_0x150c('0x46')],null))[_0x150c('0x24')](respondWithResult(_0x5e5c5d,null))[_0x150c('0x44')](handleError(_0x5e5c5d,null));};exports[_0x150c('0x23')]=function(_0x22f54d,_0x610f61){return db[_0x150c('0x3b')][_0x150c('0x47')]({'where':{'id':_0x22f54d[_0x150c('0x3f')]['id']}})[_0x150c('0x24')](handleEntityNotFound(_0x610f61,null))[_0x150c('0x24')](removeEntity(_0x610f61,null))[_0x150c('0x44')](handleError(_0x610f61,null));};exports[_0x150c('0x48')]=function(_0x5c9062,_0x5961a5){return db['FaxQueueReport'][_0x150c('0x48')]()[_0x150c('0x24')](respondWithResult(_0x5961a5,null))['catch'](handleError(_0x5961a5,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a9fed31..94f8642 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x124452,_0xe57836){var _0x175ae5=function(_0x40953c){while(--_0x40953c){_0x124452['push'](_0x124452['shift']());}};_0x175ae5(++_0xe57836);}(_0x7a54,0x106));var _0x47a5=function(_0x10606d,_0x3cc7f3){_0x10606d=_0x10606d-0x0;var _0x1ed29d=_0x7a54[_0x10606d];return _0x1ed29d;};'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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x1fac18,_0x27050e){var _0x52cb79=function(_0x139ee7){while(--_0x139ee7){_0x1fac18['push'](_0x1fac18['shift']());}};_0x52cb79(++_0x27050e);}(_0xf494,0x1c6));var _0x4f49=function(_0x3a12ed,_0x59d470){_0x3a12ed=_0x3a12ed-0x0;var _0x407dea=_0xf494[_0x3a12ed];return _0x407dea;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 9e5fb80..5d4e0c6 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 _0xa13a=['create','body','options','raw','then','debug','update','where','limit','UpdateFaxQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateFaxQueueReport'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xa13a,0x1ae));var _0xaa13=function(_0x34f791,_0x590525){_0x34f791=_0x34f791-0x0;var _0x55b31a=_0xa13a[_0x34f791];return _0x55b31a;};'use strict';var _=require(_0xaa13('0x0'));var util=require(_0xaa13('0x1'));var moment=require('moment');var BPromise=require(_0xaa13('0x2'));var rs=require(_0xaa13('0x3'));var fs=require('fs');var Redis=require(_0xaa13('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa13('0x5'));var logger=require(_0xaa13('0x6'))('rpc');var config=require(_0xaa13('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xaa13('0x8')][_0xaa13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20af66,_0x2fe9ef,_0x5c5de9){return new BPromise(function(_0x1cdd6b,_0xd88d75){return client[_0xaa13('0xa')](_0x20af66,_0x5c5de9)['then'](function(_0x49e463){logger[_0xaa13('0xb')](_0xaa13('0xc'),_0x2fe9ef,_0xaa13('0xd'));logger['debug']('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x2fe9ef,_0xaa13('0xd'),JSON[_0xaa13('0xe')](_0x49e463));if(_0x49e463[_0xaa13('0xf')]){if(_0x49e463[_0xaa13('0xf')]['code']===0x1f4){logger[_0xaa13('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x2fe9ef,_0x49e463['error'][_0xaa13('0x10')]);return _0xd88d75(_0x49e463[_0xaa13('0xf')]['message']);}logger[_0xaa13('0xf')](_0xaa13('0xc'),_0x2fe9ef,_0x49e463['error'][_0xaa13('0x10')]);return _0x1cdd6b(_0x49e463['error'][_0xaa13('0x10')]);}else{logger[_0xaa13('0xb')](_0xaa13('0xc'),_0x2fe9ef,_0xaa13('0xd'));_0x1cdd6b(_0x49e463[_0xaa13('0x11')][_0xaa13('0x10')]);}})[_0xaa13('0x12')](function(_0x244082){logger[_0xaa13('0xf')](_0xaa13('0xc'),_0x2fe9ef,_0x244082);_0xd88d75(_0x244082);});});}exports[_0xaa13('0x13')]=function(_0x35960b){var _0x23992a=this;return new Promise(function(_0xd788ae,_0x27c802){return db['FaxQueueReport'][_0xaa13('0x14')](_0x35960b[_0xaa13('0x15')],{'raw':_0x35960b[_0xaa13('0x16')]?_0x35960b[_0xaa13('0x16')][_0xaa13('0x17')]===undefined?!![]:![]:!![]})[_0xaa13('0x18')](function(_0x5b0852){logger[_0xaa13('0xb')](_0xaa13('0x13'),_0x35960b);logger[_0xaa13('0x19')](_0xaa13('0x13'),_0x35960b,JSON[_0xaa13('0xe')](_0x5b0852));_0xd788ae(_0x5b0852);})[_0xaa13('0x12')](function(_0xf5bcc6){logger[_0xaa13('0xf')](_0xaa13('0x13'),_0xf5bcc6['message'],_0x35960b);_0x27c802(_0x23992a[_0xaa13('0xf')](0x1f4,_0xf5bcc6['message']));});});};exports['UpdateFaxQueueReport']=function(_0x24f319){var _0x361d91=this;return new Promise(function(_0x5a496b,_0x9cbf00){return db['FaxQueueReport'][_0xaa13('0x1a')](_0x24f319['body'],{'raw':_0x24f319[_0xaa13('0x16')]?_0x24f319[_0xaa13('0x16')][_0xaa13('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24f319[_0xaa13('0x16')]?_0x24f319['options'][_0xaa13('0x1b')]||null:null,'attributes':_0x24f319[_0xaa13('0x16')]?_0x24f319[_0xaa13('0x16')]['attributes']||null:null,'limit':_0x24f319[_0xaa13('0x16')]?_0x24f319[_0xaa13('0x16')][_0xaa13('0x1c')]||null:null})[_0xaa13('0x18')](function(_0x33f8c6){logger[_0xaa13('0xb')](_0xaa13('0x1d'),_0x24f319);logger[_0xaa13('0x19')](_0xaa13('0x1d'),_0x24f319,JSON['stringify'](_0x33f8c6));_0x5a496b(_0x33f8c6);})[_0xaa13('0x12')](function(_0x4ef8aa){logger[_0xaa13('0xf')]('UpdateFaxQueueReport',_0x4ef8aa[_0xaa13('0x10')],_0x24f319);_0x9cbf00(_0x361d91[_0xaa13('0xf')](0x1f4,_0x4ef8aa[_0xaa13('0x10')]));});});}; \ No newline at end of file +var _0xdcea=['result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','catch','limit','UpdateFaxQueueReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2317af,_0x1332d3){var _0x3cb58d=function(_0x4e75a0){while(--_0x4e75a0){_0x2317af['push'](_0x2317af['shift']());}};_0x3cb58d(++_0x1332d3);}(_0xdcea,0x87));var _0xadce=function(_0x1fa841,_0x37a70c){_0x1fa841=_0x1fa841-0x0;var _0x384b67=_0xdcea[_0x1fa841];return _0x384b67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xadce('0x0'));var BPromise=require(_0xadce('0x1'));var rs=require(_0xadce('0x2'));var fs=require('fs');var Redis=require(_0xadce('0x3'));var db=require(_0xadce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xadce('0x5'))(_0xadce('0x6'));var config=require(_0xadce('0x7'));var jayson=require(_0xadce('0x8'));var client=jayson['client'][_0xadce('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x213cb7,_0x5f50f9,_0x22b2fb){return new BPromise(function(_0x25c8d3,_0x36c3d6){return client[_0xadce('0xa')](_0x213cb7,_0x22b2fb)[_0xadce('0xb')](function(_0x512c65){logger['info'](_0xadce('0xc'),_0x5f50f9,_0xadce('0xd'));logger[_0xadce('0xe')](_0xadce('0xf'),_0x5f50f9,_0xadce('0xd'),JSON['stringify'](_0x512c65));if(_0x512c65[_0xadce('0x10')]){if(_0x512c65[_0xadce('0x10')][_0xadce('0x11')]===0x1f4){logger['error'](_0xadce('0xc'),_0x5f50f9,_0x512c65[_0xadce('0x10')][_0xadce('0x12')]);return _0x36c3d6(_0x512c65[_0xadce('0x10')][_0xadce('0x12')]);}logger[_0xadce('0x10')](_0xadce('0xc'),_0x5f50f9,_0x512c65[_0xadce('0x10')][_0xadce('0x12')]);return _0x25c8d3(_0x512c65['error'][_0xadce('0x12')]);}else{logger[_0xadce('0x13')](_0xadce('0xc'),_0x5f50f9,_0xadce('0xd'));_0x25c8d3(_0x512c65[_0xadce('0x14')][_0xadce('0x12')]);}})['catch'](function(_0xb34ead){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x5f50f9,_0xb34ead);_0x36c3d6(_0xb34ead);});});}exports[_0xadce('0x15')]=function(_0x10e6a4){var _0x4e4fac=this;return new Promise(function(_0x3feb5b,_0x59bcb6){return db[_0xadce('0x16')][_0xadce('0x17')](_0x10e6a4[_0xadce('0x18')],{'raw':_0x10e6a4[_0xadce('0x19')]?_0x10e6a4[_0xadce('0x19')][_0xadce('0x1a')]===undefined?!![]:![]:!![]})[_0xadce('0xb')](function(_0x2b55a2){logger[_0xadce('0x13')](_0xadce('0x15'),_0x10e6a4);logger[_0xadce('0xe')]('CreateFaxQueueReport',_0x10e6a4,JSON[_0xadce('0x1b')](_0x2b55a2));_0x3feb5b(_0x2b55a2);})[_0xadce('0x1c')](function(_0x4ce1ea){logger['error'](_0xadce('0x15'),_0x4ce1ea[_0xadce('0x12')],_0x10e6a4);_0x59bcb6(_0x4e4fac['error'](0x1f4,_0x4ce1ea['message']));});});};exports['UpdateFaxQueueReport']=function(_0x5dccb0){var _0x22190b=this;return new Promise(function(_0x53261a,_0x5de2e5){return db[_0xadce('0x16')]['update'](_0x5dccb0[_0xadce('0x18')],{'raw':_0x5dccb0['options']?_0x5dccb0[_0xadce('0x19')][_0xadce('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dccb0[_0xadce('0x19')]?_0x5dccb0['options']['where']||null:null,'attributes':_0x5dccb0[_0xadce('0x19')]?_0x5dccb0[_0xadce('0x19')]['attributes']||null:null,'limit':_0x5dccb0[_0xadce('0x19')]?_0x5dccb0[_0xadce('0x19')][_0xadce('0x1d')]||null:null})[_0xadce('0xb')](function(_0x46c7cf){logger[_0xadce('0x13')](_0xadce('0x1e'),_0x5dccb0);logger[_0xadce('0xe')](_0xadce('0x1e'),_0x5dccb0,JSON['stringify'](_0x46c7cf));_0x53261a(_0x46c7cf);})[_0xadce('0x1c')](function(_0x257a01){logger['error']('UpdateFaxQueueReport',_0x257a01[_0xadce('0x12')],_0x5dccb0);_0x5de2e5(_0x22190b['error'](0x1f4,_0x257a01[_0xadce('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 00f6005..8cecc90 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 _0xdef2=['exports','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','put','delete','destroy'];(function(_0x3cdf50,_0x3e8eb2){var _0x22d47a=function(_0xdc5336){while(--_0xdc5336){_0x3cdf50['push'](_0x3cdf50['shift']());}};_0x22d47a(++_0x3e8eb2);}(_0xdef2,0x166));var _0x2def=function(_0x4635e5,_0x5590a9){_0x4635e5=_0x4635e5-0x0;var _0x5a187b=_0xdef2[_0x4635e5];return _0x5a187b;};'use strict';var multer=require('multer');var util=require(_0x2def('0x0'));var path=require(_0x2def('0x1'));var timeout=require(_0x2def('0x2'));var express=require(_0x2def('0x3'));var router=express[_0x2def('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2def('0x5'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x2def('0x6')]('/',auth[_0x2def('0x7')](),controller[_0x2def('0x8')]);router[_0x2def('0x6')](_0x2def('0x9'),auth['isAuthenticated'](),controller[_0x2def('0xa')]);router[_0x2def('0x6')](_0x2def('0xb'),auth[_0x2def('0x7')](),controller['show']);router[_0x2def('0xc')]('/',auth[_0x2def('0x7')](),controller['create']);router[_0x2def('0xd')](_0x2def('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2def('0xe')](_0x2def('0xb'),auth[_0x2def('0x7')](),controller[_0x2def('0xf')]);module[_0x2def('0x10')]=router; \ No newline at end of file +var _0x67e1=['post','create','put','update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x67e1,0x148));var _0x167e=function(_0x585fdf,_0x17a751){_0x585fdf=_0x585fdf-0x0;var _0x561956=_0x67e1[_0x585fdf];return _0x561956;};'use strict';var multer=require('multer');var util=require(_0x167e('0x0'));var path=require(_0x167e('0x1'));var timeout=require(_0x167e('0x2'));var express=require(_0x167e('0x3'));var router=express['Router']();var fs_extra=require(_0x167e('0x4'));var auth=require(_0x167e('0x5'));var interaction=require(_0x167e('0x6'));var config=require('../../config/environment');var controller=require(_0x167e('0x7'));router[_0x167e('0x8')]('/',auth[_0x167e('0x9')](),controller[_0x167e('0xa')]);router[_0x167e('0x8')]('/describe',auth[_0x167e('0x9')](),controller[_0x167e('0xb')]);router[_0x167e('0x8')](_0x167e('0xc'),auth['isAuthenticated'](),controller[_0x167e('0xd')]);router[_0x167e('0xe')]('/',auth[_0x167e('0x9')](),controller[_0x167e('0xf')]);router[_0x167e('0x10')]('/:id',auth[_0x167e('0x9')](),controller[_0x167e('0x11')]);router[_0x167e('0x12')](_0x167e('0xc'),auth[_0x167e('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 3669a58..f2a4abd 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x35201e,_0x34341b){var _0x4bc5b7=function(_0x504ba7){while(--_0x504ba7){_0x35201e['push'](_0x35201e['shift']());}};_0x4bc5b7(++_0x34341b);}(_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 +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x156696,_0x3a9a2e){var _0x5ab7c4=function(_0x26179a){while(--_0x26179a){_0x156696['push'](_0x156696['shift']());}};_0x5ab7c4(++_0x3a9a2e);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 1df0046..a2e3448 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 _0x2dfe=['includeAll','include','FaxTransferReport','findAll','rows','catch','params','fields','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','count','limit','Content-Range','apply','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options'];(function(_0x5df35c,_0x2ab072){var _0x5233be=function(_0x52649a){while(--_0x52649a){_0x5df35c['push'](_0x5df35c['shift']());}};_0x5233be(++_0x2ab072);}(_0x2dfe,0xf7));var _0xe2df=function(_0x51c846,_0x8d8df9){_0x51c846=_0x51c846-0x0;var _0x409189=_0x2dfe[_0x51c846];return _0x409189;};'use strict';var emlformat=require(_0xe2df('0x0'));var rimraf=require(_0xe2df('0x1'));var zipdir=require(_0xe2df('0x2'));var jsonpatch=require(_0xe2df('0x3'));var rp=require(_0xe2df('0x4'));var moment=require(_0xe2df('0x5'));var BPromise=require(_0xe2df('0x6'));var Mustache=require(_0xe2df('0x7'));var util=require(_0xe2df('0x8'));var path=require(_0xe2df('0x9'));var sox=require('sox');var csv=require(_0xe2df('0xa'));var ejs=require(_0xe2df('0xb'));var fs=require('fs');var fs_extra=require(_0xe2df('0xc'));var _=require(_0xe2df('0xd'));var squel=require('squel');var crypto=require(_0xe2df('0xe'));var jsforce=require(_0xe2df('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe2df('0x10'));var Papa=require(_0xe2df('0x11'));var Redis=require('ioredis');var authService=require(_0xe2df('0x12'));var qs=require(_0xe2df('0x13'));var as=require(_0xe2df('0x14'));var hardwareService=require(_0xe2df('0x15'));var logger=require(_0xe2df('0x16'))(_0xe2df('0x17'));var utils=require(_0xe2df('0x18'));var config=require(_0xe2df('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2df('0x1a'))['db'];function respondWithStatusCode(_0x22c979,_0x38efcf){_0x38efcf=_0x38efcf||0xcc;return function(_0x75a7ae){if(_0x75a7ae){return _0x22c979[_0xe2df('0x1b')](_0x38efcf);}return _0x22c979[_0xe2df('0x1c')](_0x38efcf)[_0xe2df('0x1d')]();};}function respondWithResult(_0x5edf23,_0xf357bb){_0xf357bb=_0xf357bb||0xc8;return function(_0x2a97e7){if(_0x2a97e7){return _0x5edf23[_0xe2df('0x1c')](_0xf357bb)[_0xe2df('0x1e')](_0x2a97e7);}};}function respondWithFilteredResult(_0x2d3914,_0x2472e2){return function(_0x2c1648){if(_0x2c1648){var _0x2964ff=typeof _0x2472e2[_0xe2df('0x1f')]==='undefined'&&typeof _0x2472e2['limit']===_0xe2df('0x20');var _0x26378b=_0x2c1648[_0xe2df('0x21')];var _0x2eb7ea=_0x2964ff?0x0:_0x2472e2[_0xe2df('0x1f')];var _0x22198c=_0x2964ff?_0x2c1648[_0xe2df('0x21')]:_0x2472e2[_0xe2df('0x1f')]+_0x2472e2[_0xe2df('0x22')];var _0x36c2e9;if(_0x22198c>=_0x26378b){_0x22198c=_0x26378b;_0x36c2e9=0xc8;}else{_0x36c2e9=0xce;}_0x2d3914[_0xe2df('0x1c')](_0x36c2e9);return _0x2d3914['set'](_0xe2df('0x23'),_0x2eb7ea+'-'+_0x22198c+'/'+_0x26378b)['json'](_0x2c1648);}return null;};}function patchUpdates(_0x4a3e32){return function(_0x4f023d){try{jsonpatch[_0xe2df('0x24')](_0x4f023d,_0x4a3e32,!![]);}catch(_0x9c2251){return BPromise['reject'](_0x9c2251);}return _0x4f023d[_0xe2df('0x25')]();};}function saveUpdates(_0x43bc91,_0xcb57a2){return function(_0x616b75){if(_0x616b75){return _0x616b75[_0xe2df('0x26')](_0x43bc91)[_0xe2df('0x27')](function(_0x4de652){return _0x4de652;});}return null;};}function removeEntity(_0x2345cb,_0xf88fdb){return function(_0x2247b9){if(_0x2247b9){return _0x2247b9['destroy']()[_0xe2df('0x27')](function(){_0x2345cb[_0xe2df('0x1c')](0xcc)[_0xe2df('0x1d')]();});}};}function handleEntityNotFound(_0x440d22,_0x5de70a){return function(_0x278ac5){if(!_0x278ac5){_0x440d22['sendStatus'](0x194);}return _0x278ac5;};}function handleError(_0x131539,_0x149a3e){_0x149a3e=_0x149a3e||0x1f4;return function(_0xc59f0a){logger['error'](_0xc59f0a[_0xe2df('0x28')]);if(_0xc59f0a[_0xe2df('0x29')]){delete _0xc59f0a[_0xe2df('0x29')];}_0x131539[_0xe2df('0x1c')](_0x149a3e)[_0xe2df('0x2a')](_0xc59f0a);};}exports[_0xe2df('0x2b')]=function(_0x466634,_0x4c3295){var _0x24b96d={},_0x193f2e={},_0x542afc={'count':0x0,'rows':[]};var _0x9b4c09=_[_0xe2df('0x2c')](db['FaxTransferReport'][_0xe2df('0x2d')],function(_0x307615){return{'name':_0x307615[_0xe2df('0x2e')],'type':_0x307615[_0xe2df('0x2f')][_0xe2df('0x30')]};});_0x193f2e[_0xe2df('0x31')]=_['map'](_0x9b4c09,_0xe2df('0x29'));_0x193f2e[_0xe2df('0x32')]=_[_0xe2df('0x33')](_0x466634[_0xe2df('0x32')]);_0x193f2e[_0xe2df('0x34')]=_[_0xe2df('0x35')](_0x193f2e[_0xe2df('0x31')],_0x193f2e[_0xe2df('0x32')]);_0x24b96d[_0xe2df('0x36')]=_[_0xe2df('0x35')](_0x193f2e['model'],qs['fields'](_0x466634[_0xe2df('0x32')]['fields']));_0x24b96d['attributes']=_0x24b96d[_0xe2df('0x36')][_0xe2df('0x37')]?_0x24b96d[_0xe2df('0x36')]:_0x193f2e[_0xe2df('0x31')];if(!_0x466634['query'][_0xe2df('0x38')]('nolimit')){_0x24b96d[_0xe2df('0x22')]=qs[_0xe2df('0x22')](_0x466634['query'][_0xe2df('0x22')]);_0x24b96d[_0xe2df('0x1f')]=qs[_0xe2df('0x1f')](_0x466634[_0xe2df('0x32')][_0xe2df('0x1f')]);}_0x24b96d[_0xe2df('0x39')]=qs[_0xe2df('0x3a')](_0x466634[_0xe2df('0x32')][_0xe2df('0x3a')]);_0x24b96d['where']=qs[_0xe2df('0x34')](_[_0xe2df('0x3b')](_0x466634[_0xe2df('0x32')],_0x193f2e[_0xe2df('0x34')]),_0x9b4c09);if(_0x466634[_0xe2df('0x32')][_0xe2df('0x3c')]){_0x24b96d[_0xe2df('0x3d')]=_[_0xe2df('0x3e')](_0x24b96d[_0xe2df('0x3d')],{'$or':_[_0xe2df('0x2c')](_0x9b4c09,function(_0x18f77f){if(_0x18f77f['type']!==_0xe2df('0x3f')){var _0x3a8b04={};_0x3a8b04[_0x18f77f[_0xe2df('0x29')]]={'$like':'%'+_0x466634[_0xe2df('0x32')]['filter']+'%'};return _0x3a8b04;}})});}_0x24b96d=_[_0xe2df('0x3e')]({},_0x24b96d,_0x466634[_0xe2df('0x40')]);var _0x532f91={'where':_0x24b96d[_0xe2df('0x3d')]};return db['FaxTransferReport'][_0xe2df('0x21')](_0x532f91)[_0xe2df('0x27')](function(_0x3a8f41){_0x542afc[_0xe2df('0x21')]=_0x3a8f41;if(_0x466634[_0xe2df('0x32')][_0xe2df('0x41')]){_0x24b96d[_0xe2df('0x42')]=[{'all':!![]}];}return db[_0xe2df('0x43')][_0xe2df('0x44')](_0x24b96d);})[_0xe2df('0x27')](function(_0x37fd6b){_0x542afc[_0xe2df('0x45')]=_0x37fd6b;return _0x542afc;})[_0xe2df('0x27')](respondWithFilteredResult(_0x4c3295,_0x24b96d))[_0xe2df('0x46')](handleError(_0x4c3295,null));};exports['show']=function(_0x3a446c,_0x30e0ee){var _0x7b7e78={'raw':!![],'where':{'id':_0x3a446c[_0xe2df('0x47')]['id']}},_0x221b2b={};_0x221b2b[_0xe2df('0x31')]=_[_0xe2df('0x33')](db['FaxTransferReport']['rawAttributes']);_0x221b2b[_0xe2df('0x32')]=_['keys'](_0x3a446c[_0xe2df('0x32')]);_0x221b2b[_0xe2df('0x34')]=_['intersection'](_0x221b2b[_0xe2df('0x31')],_0x221b2b[_0xe2df('0x32')]);_0x7b7e78['attributes']=_[_0xe2df('0x35')](_0x221b2b[_0xe2df('0x31')],qs[_0xe2df('0x48')](_0x3a446c['query'][_0xe2df('0x48')]));_0x7b7e78['attributes']=_0x7b7e78['attributes']['length']?_0x7b7e78[_0xe2df('0x36')]:_0x221b2b[_0xe2df('0x31')];if(_0x3a446c[_0xe2df('0x32')]['includeAll']){_0x7b7e78[_0xe2df('0x42')]=[{'all':!![]}];}_0x7b7e78=_['merge']({},_0x7b7e78,_0x3a446c[_0xe2df('0x40')]);return db[_0xe2df('0x43')][_0xe2df('0x49')](_0x7b7e78)[_0xe2df('0x27')](handleEntityNotFound(_0x30e0ee,null))[_0xe2df('0x27')](respondWithResult(_0x30e0ee,null))[_0xe2df('0x46')](handleError(_0x30e0ee,null));};exports[_0xe2df('0x4a')]=function(_0x1db136,_0x2f1bbe){return db[_0xe2df('0x43')]['create'](_0x1db136[_0xe2df('0x4b')],{})[_0xe2df('0x27')](respondWithResult(_0x2f1bbe,0xc9))[_0xe2df('0x46')](handleError(_0x2f1bbe,null));};exports['update']=function(_0x593be4,_0x452699){if(_0x593be4['body']['id']){delete _0x593be4['body']['id'];}return db[_0xe2df('0x43')][_0xe2df('0x49')]({'where':{'id':_0x593be4['params']['id']}})[_0xe2df('0x27')](handleEntityNotFound(_0x452699,null))[_0xe2df('0x27')](saveUpdates(_0x593be4[_0xe2df('0x4b')],null))[_0xe2df('0x27')](respondWithResult(_0x452699,null))['catch'](handleError(_0x452699,null));};exports[_0xe2df('0x4c')]=function(_0x20e0d5,_0x55300d){return db[_0xe2df('0x43')]['find']({'where':{'id':_0x20e0d5['params']['id']}})[_0xe2df('0x27')](handleEntityNotFound(_0x55300d,null))[_0xe2df('0x27')](removeEntity(_0x55300d,null))[_0xe2df('0x46')](handleError(_0x55300d,null));};exports[_0xe2df('0x4d')]=function(_0x5b752c,_0x2b898e){return db[_0xe2df('0x43')][_0xe2df('0x4d')]()[_0xe2df('0x27')](respondWithResult(_0x2b898e,null))['catch'](handleError(_0x2b898e,null));}; \ No newline at end of file +var _0xce29=['count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','FaxTransferReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','findAll','show','params','rawAttributes','includeAll','include','options','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit'];(function(_0x19e833,_0x412717){var _0x529a0e=function(_0x3060d9){while(--_0x3060d9){_0x19e833['push'](_0x19e833['shift']());}};_0x529a0e(++_0x412717);}(_0xce29,0x10f));var _0x9ce2=function(_0x257773,_0x4b13b9){_0x257773=_0x257773-0x0;var _0xa012b5=_0xce29[_0x257773];return _0xa012b5;};'use strict';var emlformat=require(_0x9ce2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ce2('0x1'));var jsonpatch=require(_0x9ce2('0x2'));var rp=require(_0x9ce2('0x3'));var moment=require('moment');var BPromise=require(_0x9ce2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9ce2('0x5'));var sox=require(_0x9ce2('0x6'));var csv=require(_0x9ce2('0x7'));var ejs=require(_0x9ce2('0x8'));var fs=require('fs');var fs_extra=require(_0x9ce2('0x9'));var _=require(_0x9ce2('0xa'));var squel=require(_0x9ce2('0xb'));var crypto=require(_0x9ce2('0xc'));var jsforce=require(_0x9ce2('0xd'));var deskjs=require(_0x9ce2('0xe'));var toCsv=require(_0x9ce2('0x7'));var querystring=require(_0x9ce2('0xf'));var Papa=require('papaparse');var Redis=require(_0x9ce2('0x10'));var authService=require(_0x9ce2('0x11'));var qs=require(_0x9ce2('0x12'));var as=require(_0x9ce2('0x13'));var hardwareService=require(_0x9ce2('0x14'));var logger=require(_0x9ce2('0x15'))(_0x9ce2('0x16'));var utils=require(_0x9ce2('0x17'));var config=require(_0x9ce2('0x18'));var licenseUtil=require(_0x9ce2('0x19'));var db=require(_0x9ce2('0x1a'))['db'];function respondWithStatusCode(_0x17ccd4,_0x59fd8f){_0x59fd8f=_0x59fd8f||0xcc;return function(_0x5d05b6){if(_0x5d05b6){return _0x17ccd4[_0x9ce2('0x1b')](_0x59fd8f);}return _0x17ccd4[_0x9ce2('0x1c')](_0x59fd8f)['end']();};}function respondWithResult(_0x1ca99a,_0x1c1a6c){_0x1c1a6c=_0x1c1a6c||0xc8;return function(_0x305389){if(_0x305389){return _0x1ca99a[_0x9ce2('0x1c')](_0x1c1a6c)[_0x9ce2('0x1d')](_0x305389);}};}function respondWithFilteredResult(_0x8f80bf,_0x26a767){return function(_0x3fabb7){if(_0x3fabb7){var _0x4d4159=typeof _0x26a767[_0x9ce2('0x1e')]===_0x9ce2('0x1f')&&typeof _0x26a767[_0x9ce2('0x20')]==='undefined';var _0x3200f7=_0x3fabb7[_0x9ce2('0x21')];var _0x49efc7=_0x4d4159?0x0:_0x26a767['offset'];var _0x315285=_0x4d4159?_0x3fabb7[_0x9ce2('0x21')]:_0x26a767[_0x9ce2('0x1e')]+_0x26a767[_0x9ce2('0x20')];var _0x375199;if(_0x315285>=_0x3200f7){_0x315285=_0x3200f7;_0x375199=0xc8;}else{_0x375199=0xce;}_0x8f80bf[_0x9ce2('0x1c')](_0x375199);return _0x8f80bf[_0x9ce2('0x22')](_0x9ce2('0x23'),_0x49efc7+'-'+_0x315285+'/'+_0x3200f7)[_0x9ce2('0x1d')](_0x3fabb7);}return null;};}function patchUpdates(_0x2edaba){return function(_0x5c54af){try{jsonpatch[_0x9ce2('0x24')](_0x5c54af,_0x2edaba,!![]);}catch(_0x25d332){return BPromise['reject'](_0x25d332);}return _0x5c54af[_0x9ce2('0x25')]();};}function saveUpdates(_0x4cff76,_0x538c9f){return function(_0x2caddd){if(_0x2caddd){return _0x2caddd[_0x9ce2('0x26')](_0x4cff76)['then'](function(_0x5655f9){return _0x5655f9;});}return null;};}function removeEntity(_0x31eb5d,_0x2fb01e){return function(_0x20ab35){if(_0x20ab35){return _0x20ab35[_0x9ce2('0x27')]()[_0x9ce2('0x28')](function(){_0x31eb5d[_0x9ce2('0x1c')](0xcc)[_0x9ce2('0x29')]();});}};}function handleEntityNotFound(_0x4f1221,_0x39c31d){return function(_0x238280){if(!_0x238280){_0x4f1221[_0x9ce2('0x1b')](0x194);}return _0x238280;};}function handleError(_0x420ffd,_0x2bba7d){_0x2bba7d=_0x2bba7d||0x1f4;return function(_0xcbad7){logger[_0x9ce2('0x2a')](_0xcbad7[_0x9ce2('0x2b')]);if(_0xcbad7[_0x9ce2('0x2c')]){delete _0xcbad7['name'];}_0x420ffd['status'](_0x2bba7d)[_0x9ce2('0x2d')](_0xcbad7);};}exports[_0x9ce2('0x2e')]=function(_0x3bc3da,_0x17f431){var _0x2a7c45={},_0x4513e5={},_0x51ad0f={'count':0x0,'rows':[]};var _0x5e497d=_[_0x9ce2('0x2f')](db[_0x9ce2('0x30')]['rawAttributes'],function(_0x16b34e){return{'name':_0x16b34e[_0x9ce2('0x31')],'type':_0x16b34e[_0x9ce2('0x32')]['key']};});_0x4513e5[_0x9ce2('0x33')]=_[_0x9ce2('0x2f')](_0x5e497d,'name');_0x4513e5[_0x9ce2('0x34')]=_[_0x9ce2('0x35')](_0x3bc3da[_0x9ce2('0x34')]);_0x4513e5[_0x9ce2('0x36')]=_[_0x9ce2('0x37')](_0x4513e5[_0x9ce2('0x33')],_0x4513e5['query']);_0x2a7c45[_0x9ce2('0x38')]=_[_0x9ce2('0x37')](_0x4513e5[_0x9ce2('0x33')],qs['fields'](_0x3bc3da[_0x9ce2('0x34')][_0x9ce2('0x39')]));_0x2a7c45[_0x9ce2('0x38')]=_0x2a7c45['attributes'][_0x9ce2('0x3a')]?_0x2a7c45[_0x9ce2('0x38')]:_0x4513e5[_0x9ce2('0x33')];if(!_0x3bc3da[_0x9ce2('0x34')][_0x9ce2('0x3b')]('nolimit')){_0x2a7c45[_0x9ce2('0x20')]=qs[_0x9ce2('0x20')](_0x3bc3da[_0x9ce2('0x34')][_0x9ce2('0x20')]);_0x2a7c45[_0x9ce2('0x1e')]=qs['offset'](_0x3bc3da[_0x9ce2('0x34')][_0x9ce2('0x1e')]);}_0x2a7c45['order']=qs['sort'](_0x3bc3da['query'][_0x9ce2('0x3c')]);_0x2a7c45[_0x9ce2('0x3d')]=qs[_0x9ce2('0x36')](_[_0x9ce2('0x3e')](_0x3bc3da[_0x9ce2('0x34')],_0x4513e5[_0x9ce2('0x36')]),_0x5e497d);if(_0x3bc3da['query']['filter']){_0x2a7c45['where']=_[_0x9ce2('0x3f')](_0x2a7c45[_0x9ce2('0x3d')],{'$or':_[_0x9ce2('0x2f')](_0x5e497d,function(_0x358591){if(_0x358591[_0x9ce2('0x32')]!=='VIRTUAL'){var _0x1d4b5d={};_0x1d4b5d[_0x358591[_0x9ce2('0x2c')]]={'$like':'%'+_0x3bc3da[_0x9ce2('0x34')][_0x9ce2('0x40')]+'%'};return _0x1d4b5d;}})});}_0x2a7c45=_[_0x9ce2('0x3f')]({},_0x2a7c45,_0x3bc3da['options']);var _0x5938b9={'where':_0x2a7c45['where']};return db[_0x9ce2('0x30')]['count'](_0x5938b9)[_0x9ce2('0x28')](function(_0x4dc948){_0x51ad0f[_0x9ce2('0x21')]=_0x4dc948;if(_0x3bc3da['query']['includeAll']){_0x2a7c45['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0x9ce2('0x41')](_0x2a7c45);})[_0x9ce2('0x28')](function(_0x2f725c){_0x51ad0f['rows']=_0x2f725c;return _0x51ad0f;})[_0x9ce2('0x28')](respondWithFilteredResult(_0x17f431,_0x2a7c45))['catch'](handleError(_0x17f431,null));};exports[_0x9ce2('0x42')]=function(_0x3687fb,_0x37a453){var _0x4c16d3={'raw':!![],'where':{'id':_0x3687fb[_0x9ce2('0x43')]['id']}},_0x10fe70={};_0x10fe70['model']=_[_0x9ce2('0x35')](db[_0x9ce2('0x30')][_0x9ce2('0x44')]);_0x10fe70[_0x9ce2('0x34')]=_[_0x9ce2('0x35')](_0x3687fb[_0x9ce2('0x34')]);_0x10fe70[_0x9ce2('0x36')]=_['intersection'](_0x10fe70['model'],_0x10fe70[_0x9ce2('0x34')]);_0x4c16d3[_0x9ce2('0x38')]=_[_0x9ce2('0x37')](_0x10fe70['model'],qs[_0x9ce2('0x39')](_0x3687fb[_0x9ce2('0x34')][_0x9ce2('0x39')]));_0x4c16d3[_0x9ce2('0x38')]=_0x4c16d3[_0x9ce2('0x38')][_0x9ce2('0x3a')]?_0x4c16d3['attributes']:_0x10fe70[_0x9ce2('0x33')];if(_0x3687fb['query'][_0x9ce2('0x45')]){_0x4c16d3[_0x9ce2('0x46')]=[{'all':!![]}];}_0x4c16d3=_[_0x9ce2('0x3f')]({},_0x4c16d3,_0x3687fb[_0x9ce2('0x47')]);return db[_0x9ce2('0x30')][_0x9ce2('0x48')](_0x4c16d3)[_0x9ce2('0x28')](handleEntityNotFound(_0x37a453,null))[_0x9ce2('0x28')](respondWithResult(_0x37a453,null))[_0x9ce2('0x49')](handleError(_0x37a453,null));};exports['create']=function(_0x26b1e7,_0xbed21c){return db[_0x9ce2('0x30')][_0x9ce2('0x4a')](_0x26b1e7['body'],{})['then'](respondWithResult(_0xbed21c,0xc9))['catch'](handleError(_0xbed21c,null));};exports[_0x9ce2('0x26')]=function(_0x59026a,_0x426797){if(_0x59026a['body']['id']){delete _0x59026a[_0x9ce2('0x4b')]['id'];}return db[_0x9ce2('0x30')]['find']({'where':{'id':_0x59026a[_0x9ce2('0x43')]['id']}})['then'](handleEntityNotFound(_0x426797,null))[_0x9ce2('0x28')](saveUpdates(_0x59026a[_0x9ce2('0x4b')],null))[_0x9ce2('0x28')](respondWithResult(_0x426797,null))[_0x9ce2('0x49')](handleError(_0x426797,null));};exports['destroy']=function(_0xe5bc1d,_0x1f60b0){return db[_0x9ce2('0x30')]['find']({'where':{'id':_0xe5bc1d['params']['id']}})[_0x9ce2('0x28')](handleEntityNotFound(_0x1f60b0,null))['then'](removeEntity(_0x1f60b0,null))[_0x9ce2('0x49')](handleError(_0x1f60b0,null));};exports['describe']=function(_0x1a7d94,_0x5d6013){return db[_0x9ce2('0x30')]['describe']()[_0x9ce2('0x28')](respondWithResult(_0x5d6013,null))[_0x9ce2('0x49')](handleError(_0x5d6013,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a6d5e32..95a2c9e 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 _0x1b97=['bluebird','request-promise','rimraf','exports','FaxTransferReport','uniqueid','lodash','util','moment'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x1b97,0x15c));var _0x71b9=function(_0x5a9b6a,_0x5570d6){_0x5a9b6a=_0x5a9b6a-0x0;var _0x57a480=_0x1b97[_0x5a9b6a];return _0x57a480;};'use strict';var _=require(_0x71b9('0x0'));var util=require(_0x71b9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x71b9('0x2'));var BPromise=require(_0x71b9('0x3'));var rp=require(_0x71b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x71b9('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x71b9('0x6')]=function(_0xaaa54b,_0x3de7da){return _0xaaa54b['define'](_0x71b9('0x7'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x71b9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6343=['../../config/logger','api','rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid'];(function(_0x41a04f,_0x51e497){var _0x211f50=function(_0x28aa67){while(--_0x28aa67){_0x41a04f['push'](_0x41a04f['shift']());}};_0x211f50(++_0x51e497);}(_0x6343,0x168));var _0x3634=function(_0x181d27,_0x134374){_0x181d27=_0x181d27-0x0;var _0x475f04=_0x6343[_0x181d27];return _0x475f04;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3634('0x0'))(_0x3634('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3634('0x2'));var config=require(_0x3634('0x3'));var attributes=require('./faxTransferReport.attributes');module[_0x3634('0x4')]=function(_0x388c18,_0x4bb496){return _0x388c18[_0x3634('0x5')](_0x3634('0x6'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3634('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index a32699a..939aeac 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 _0x52d1=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug'];(function(_0x115af7,_0x39220d){var _0x4403f4=function(_0x38bcf2){while(--_0x38bcf2){_0x115af7['push'](_0x115af7['shift']());}};_0x4403f4(++_0x39220d);}(_0x52d1,0xd0));var _0x152d=function(_0x438368,_0x32d5f6){_0x438368=_0x438368-0x0;var _0x1a21cb=_0x52d1[_0x438368];return _0x1a21cb;};'use strict';var _=require(_0x152d('0x0'));var util=require(_0x152d('0x1'));var moment=require(_0x152d('0x2'));var BPromise=require(_0x152d('0x3'));var rs=require(_0x152d('0x4'));var fs=require('fs');var Redis=require(_0x152d('0x5'));var db=require(_0x152d('0x6'))['db'];var utils=require(_0x152d('0x7'));var logger=require(_0x152d('0x8'))(_0x152d('0x9'));var config=require(_0x152d('0xa'));var jayson=require(_0x152d('0xb'));var client=jayson['client'][_0x152d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d9bc7,_0xfddb36,_0x3c2ce1){return new BPromise(function(_0x56aca4,_0x367de8){return client[_0x152d('0xd')](_0x5d9bc7,_0x3c2ce1)[_0x152d('0xe')](function(_0x6d41c5){logger[_0x152d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0xfddb36,'request\x20sent');logger[_0x152d('0x10')](_0x152d('0x11'),_0xfddb36,'request\x20sent',JSON[_0x152d('0x12')](_0x6d41c5));if(_0x6d41c5[_0x152d('0x13')]){if(_0x6d41c5[_0x152d('0x13')][_0x152d('0x14')]===0x1f4){logger[_0x152d('0x13')](_0x152d('0x15'),_0xfddb36,_0x6d41c5['error'][_0x152d('0x16')]);return _0x367de8(_0x6d41c5[_0x152d('0x13')][_0x152d('0x16')]);}logger[_0x152d('0x13')](_0x152d('0x15'),_0xfddb36,_0x6d41c5[_0x152d('0x13')]['message']);return _0x56aca4(_0x6d41c5[_0x152d('0x13')][_0x152d('0x16')]);}else{logger['info'](_0x152d('0x15'),_0xfddb36,_0x152d('0x17'));_0x56aca4(_0x6d41c5[_0x152d('0x18')][_0x152d('0x16')]);}})['catch'](function(_0x5b71f8){logger[_0x152d('0x13')](_0x152d('0x15'),_0xfddb36,_0x5b71f8);_0x367de8(_0x5b71f8);});});} \ No newline at end of file +var _0xd3ca=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x273ed2,_0x4b145d){var _0x3ba67d=function(_0x35a425){while(--_0x35a425){_0x273ed2['push'](_0x273ed2['shift']());}};_0x3ba67d(++_0x4b145d);}(_0xd3ca,0x65));var _0xad3c=function(_0xe2ee23,_0x4fbdde){_0xe2ee23=_0xe2ee23-0x0;var _0x2ae642=_0xd3ca[_0xe2ee23];return _0x2ae642;};'use strict';var _=require(_0xad3c('0x0'));var util=require('util');var moment=require(_0xad3c('0x1'));var BPromise=require(_0xad3c('0x2'));var rs=require(_0xad3c('0x3'));var fs=require('fs');var Redis=require(_0xad3c('0x4'));var db=require(_0xad3c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xad3c('0x6'));var jayson=require(_0xad3c('0x7'));var client=jayson[_0xad3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23ad8c,_0x23a320,_0x473de2){return new BPromise(function(_0x4e8bb2,_0x580236){return client[_0xad3c('0x9')](_0x23ad8c,_0x473de2)[_0xad3c('0xa')](function(_0x17cab3){logger[_0xad3c('0xb')](_0xad3c('0xc'),_0x23a320,_0xad3c('0xd'));logger[_0xad3c('0xe')](_0xad3c('0xf'),_0x23a320,_0xad3c('0xd'),JSON[_0xad3c('0x10')](_0x17cab3));if(_0x17cab3[_0xad3c('0x11')]){if(_0x17cab3[_0xad3c('0x11')][_0xad3c('0x12')]===0x1f4){logger[_0xad3c('0x11')](_0xad3c('0xc'),_0x23a320,_0x17cab3[_0xad3c('0x11')][_0xad3c('0x13')]);return _0x580236(_0x17cab3[_0xad3c('0x11')][_0xad3c('0x13')]);}logger[_0xad3c('0x11')](_0xad3c('0xc'),_0x23a320,_0x17cab3['error'][_0xad3c('0x13')]);return _0x4e8bb2(_0x17cab3[_0xad3c('0x11')][_0xad3c('0x13')]);}else{logger[_0xad3c('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x23a320,_0xad3c('0xd'));_0x4e8bb2(_0x17cab3[_0xad3c('0x14')]['message']);}})[_0xad3c('0x15')](function(_0x1b1214){logger[_0xad3c('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x23a320,_0x1b1214);_0x580236(_0x1b1214);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 37263b5..bfcefc5 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 _0xacd7=['/describe','describe','get','/:id','show','post','create','put','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated'];(function(_0x3fe33e,_0xf105a2){var _0x2ca2bc=function(_0x3e83cd){while(--_0x3e83cd){_0x3fe33e['push'](_0x3fe33e['shift']());}};_0x2ca2bc(++_0xf105a2);}(_0xacd7,0x108));var _0x7acd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xacd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7acd('0x0'));var util=require(_0x7acd('0x1'));var path=require(_0x7acd('0x2'));var timeout=require(_0x7acd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7acd('0x4'));var interaction=require(_0x7acd('0x5'));var config=require('../../config/environment');var controller=require(_0x7acd('0x6'));router['get']('/',auth[_0x7acd('0x7')](),controller['index']);router['get'](_0x7acd('0x8'),auth['isAuthenticated'](),controller[_0x7acd('0x9')]);router[_0x7acd('0xa')](_0x7acd('0xb'),auth[_0x7acd('0x7')](),controller[_0x7acd('0xc')]);router[_0x7acd('0xd')]('/',auth[_0x7acd('0x7')](),controller[_0x7acd('0xe')]);router[_0x7acd('0xf')](_0x7acd('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7acd('0xb'),auth[_0x7acd('0x7')](),controller[_0x7acd('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4eb8=['./faxTransferReport.controller','get','/describe','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x21bf1b,_0x3e0700){var _0x438794=function(_0x4718ad){while(--_0x4718ad){_0x21bf1b['push'](_0x21bf1b['shift']());}};_0x438794(++_0x3e0700);}(_0x4eb8,0xdd));var _0x84eb=function(_0xf48d27,_0xc761af){_0xf48d27=_0xf48d27-0x0;var _0x172722=_0x4eb8[_0xf48d27];return _0x172722;};'use strict';var multer=require(_0x84eb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x84eb('0x1'));var express=require(_0x84eb('0x2'));var router=express[_0x84eb('0x3')]();var fs_extra=require(_0x84eb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x84eb('0x5'));var config=require(_0x84eb('0x6'));var controller=require(_0x84eb('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x84eb('0x8')](_0x84eb('0x9'),auth[_0x84eb('0xa')](),controller['describe']);router[_0x84eb('0x8')](_0x84eb('0xb'),auth['isAuthenticated'](),controller[_0x84eb('0xc')]);router['post']('/',auth[_0x84eb('0xa')](),controller[_0x84eb('0xd')]);router[_0x84eb('0xe')](_0x84eb('0xb'),auth[_0x84eb('0xa')](),controller[_0x84eb('0xf')]);router[_0x84eb('0x10')](_0x84eb('0xb'),auth[_0x84eb('0xa')](),controller[_0x84eb('0x11')]);module[_0x84eb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c6d9c5f..c2507c0 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 _0xf720=['addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','isAuthenticated','index','get','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations'];(function(_0x2fbfc2,_0x505ec7){var _0x5c3a72=function(_0x18f06a){while(--_0x18f06a){_0x2fbfc2['push'](_0x2fbfc2['shift']());}};_0x5c3a72(++_0x505ec7);}(_0xf720,0x119));var _0x0f72=function(_0x28c297,_0x159562){_0x28c297=_0x28c297-0x0;var _0x1800ae=_0xf720[_0x28c297];return _0x1800ae;};'use strict';var multer=require(_0x0f72('0x0'));var util=require(_0x0f72('0x1'));var path=require(_0x0f72('0x2'));var timeout=require(_0x0f72('0x3'));var express=require(_0x0f72('0x4'));var router=express[_0x0f72('0x5')]();var fs_extra=require(_0x0f72('0x6'));var auth=require(_0x0f72('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f72('0x8'));router['get']('/',auth[_0x0f72('0x9')](),controller[_0x0f72('0xa')]);router[_0x0f72('0xb')]('/:id',auth[_0x0f72('0x9')](),controller[_0x0f72('0xc')]);router['get']('/:id/configurations',auth[_0x0f72('0x9')](),controller[_0x0f72('0xd')]);router[_0x0f72('0xb')](_0x0f72('0xe'),auth[_0x0f72('0x9')](),controller[_0x0f72('0xf')]);router[_0x0f72('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f72('0x10')](_0x0f72('0x11'),auth[_0x0f72('0x9')](),controller[_0x0f72('0x12')]);router['put'](_0x0f72('0x13'),auth['isAuthenticated'](),controller[_0x0f72('0x14')]);router['delete'](_0x0f72('0x13'),auth[_0x0f72('0x9')](),controller[_0x0f72('0x15')]);module[_0x0f72('0x16')]=router; \ No newline at end of file +var _0xc2c5=['../../config/environment','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','update','delete','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5be791,_0x94dd5a){var _0x2ea8b8=function(_0x4423c0){while(--_0x4423c0){_0x5be791['push'](_0x5be791['shift']());}};_0x2ea8b8(++_0x94dd5a);}(_0xc2c5,0x1b2));var _0x5c2c=function(_0x53d210,_0x4874c7){_0x53d210=_0x53d210-0x0;var _0x4ea418=_0xc2c5[_0x53d210];return _0x4ea418;};'use strict';var multer=require('multer');var util=require(_0x5c2c('0x0'));var path=require(_0x5c2c('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c2c('0x2'));var router=express['Router']();var fs_extra=require(_0x5c2c('0x3'));var auth=require(_0x5c2c('0x4'));var interaction=require(_0x5c2c('0x5'));var config=require(_0x5c2c('0x6'));var controller=require('./intDeskAccount.controller');router[_0x5c2c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c2c('0x7')](_0x5c2c('0x8'),auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xa')]);router[_0x5c2c('0x7')]('/:id/configurations',auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xb')]);router['get'](_0x5c2c('0xc'),auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xd')]);router[_0x5c2c('0xe')]('/',auth[_0x5c2c('0x9')](),controller[_0x5c2c('0xf')]);router[_0x5c2c('0xe')](_0x5c2c('0x10'),auth[_0x5c2c('0x9')](),controller['addConfiguration']);router['put'](_0x5c2c('0x8'),auth[_0x5c2c('0x9')](),controller[_0x5c2c('0x11')]);router[_0x5c2c('0x12')](_0x5c2c('0x8'),auth[_0x5c2c('0x9')](),controller['destroy']);module[_0x5c2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 61c9414..c0b08bb 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 _0x6477=['exports','STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x6477,0x1cd));var _0x7647=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x6477[_0x2bcd1f];return _0x2381ca;};'use strict';var Sequelize=require(_0x7647('0x0'));module[_0x7647('0x1')]={'name':{'type':Sequelize[_0x7647('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7647('0x2')]},'authType':{'type':Sequelize[_0x7647('0x3')](_0x7647('0x4')),'defaultValue':_0x7647('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x7647('0x2')]},'consumerSecret':{'type':Sequelize[_0x7647('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x7647('0x2')]},'serverUrl':{'type':Sequelize[_0x7647('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7647('0x3')](_0x7647('0x5'),'newTab'),'defaultValue':_0x7647('0x5')}}; \ No newline at end of file +var _0x4a8b=['exports','STRING','basic','integrationTab','newTab'];(function(_0x113504,_0x586138){var _0x1f8051=function(_0x1e48c6){while(--_0x1e48c6){_0x113504['push'](_0x113504['shift']());}};_0x1f8051(++_0x586138);}(_0x4a8b,0x14f));var _0xb4a8=function(_0x438472,_0x3a446d){_0x438472=_0x438472-0x0;var _0x176019=_0x4a8b[_0x438472];return _0x176019;};'use strict';var Sequelize=require('sequelize');module[_0xb4a8('0x0')]={'name':{'type':Sequelize[_0xb4a8('0x1')]},'description':{'type':Sequelize[_0xb4a8('0x1')]},'username':{'type':Sequelize[_0xb4a8('0x1')]},'remoteUri':{'type':Sequelize[_0xb4a8('0x1')]},'authType':{'type':Sequelize['ENUM'](_0xb4a8('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xb4a8('0x1')]},'consumerSecret':{'type':Sequelize[_0xb4a8('0x1')]},'token':{'type':Sequelize[_0xb4a8('0x1')]},'tokenSecret':{'type':Sequelize[_0xb4a8('0x1')]},'serverUrl':{'type':Sequelize[_0xb4a8('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb4a8('0x3'),_0xb4a8('0x4')),'defaultValue':_0xb4a8('0x3')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b3f7b23..e8a5940 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 _0xdbff=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','entries','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','DeskConfiguration','order','getConfigurations','nolimit'];(function(_0x2cec6b,_0x4bd85a){var _0x1cd617=function(_0x34cc52){while(--_0x34cc52){_0x2cec6b['push'](_0x2cec6b['shift']());}};_0x1cd617(++_0x4bd85a);}(_0xdbff,0x9d));var _0xfdbf=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xdbff[_0x18cd5b];return _0x5eaa52;};'use strict';var emlformat=require(_0xfdbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfdbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfdbf('0x2'));var moment=require('moment');var BPromise=require(_0xfdbf('0x3'));var Mustache=require(_0xfdbf('0x4'));var util=require(_0xfdbf('0x5'));var path=require(_0xfdbf('0x6'));var sox=require(_0xfdbf('0x7'));var csv=require('to-csv');var ejs=require(_0xfdbf('0x8'));var fs=require('fs');var fs_extra=require(_0xfdbf('0x9'));var _=require(_0xfdbf('0xa'));var squel=require(_0xfdbf('0xb'));var crypto=require(_0xfdbf('0xc'));var jsforce=require(_0xfdbf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfdbf('0xe'));var querystring=require(_0xfdbf('0xf'));var Papa=require(_0xfdbf('0x10'));var Redis=require(_0xfdbf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfdbf('0x12'));var as=require(_0xfdbf('0x13'));var hardwareService=require(_0xfdbf('0x14'));var logger=require(_0xfdbf('0x15'))(_0xfdbf('0x16'));var utils=require(_0xfdbf('0x17'));var config=require(_0xfdbf('0x18'));var licenseUtil=require(_0xfdbf('0x19'));var db=require(_0xfdbf('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xd5c72d,_0x44ad2f){_0x44ad2f=_0x44ad2f||0xcc;return function(_0x5ccd71){if(_0x5ccd71){return _0xd5c72d[_0xfdbf('0x1b')](_0x44ad2f);}return _0xd5c72d[_0xfdbf('0x1c')](_0x44ad2f)[_0xfdbf('0x1d')]();};}function respondWithResult(_0x11cedb,_0x3a7cdb){_0x3a7cdb=_0x3a7cdb||0xc8;return function(_0x34cf37){if(_0x34cf37){return _0x11cedb['status'](_0x3a7cdb)[_0xfdbf('0x1e')](_0x34cf37);}};}function respondWithFilteredResult(_0xe2da1b,_0x391792){return function(_0x3aec6e){if(_0x3aec6e){var _0x27f694=typeof _0x391792['offset']==='undefined'&&typeof _0x391792[_0xfdbf('0x1f')]==='undefined';var _0x5365e8=_0x3aec6e[_0xfdbf('0x20')];var _0x17da7f=_0x27f694?0x0:_0x391792['offset'];var _0x23d1b2=_0x27f694?_0x3aec6e['count']:_0x391792['offset']+_0x391792[_0xfdbf('0x1f')];var _0x575872;if(_0x23d1b2>=_0x5365e8){_0x23d1b2=_0x5365e8;_0x575872=0xc8;}else{_0x575872=0xce;}_0xe2da1b[_0xfdbf('0x1c')](_0x575872);return _0xe2da1b[_0xfdbf('0x21')](_0xfdbf('0x22'),_0x17da7f+'-'+_0x23d1b2+'/'+_0x5365e8)[_0xfdbf('0x1e')](_0x3aec6e);}return null;};}function patchUpdates(_0x275c4a){return function(_0x5eb8f2){try{jsonpatch[_0xfdbf('0x23')](_0x5eb8f2,_0x275c4a,!![]);}catch(_0x30e539){return BPromise[_0xfdbf('0x24')](_0x30e539);}return _0x5eb8f2[_0xfdbf('0x25')]();};}function saveUpdates(_0x3b031d,_0x5bc973){return function(_0x91c598){if(_0x91c598){return _0x91c598[_0xfdbf('0x26')](_0x3b031d)[_0xfdbf('0x27')](function(_0x168991){return _0x168991;});}return null;};}function removeEntity(_0x102cf8,_0x8bcf78){return function(_0x1e92e7){if(_0x1e92e7){return _0x1e92e7[_0xfdbf('0x28')]()[_0xfdbf('0x27')](function(){_0x102cf8[_0xfdbf('0x1c')](0xcc)[_0xfdbf('0x1d')]();});}};}function handleEntityNotFound(_0x5268ae,_0x50e84f){return function(_0x2addc3){if(!_0x2addc3){_0x5268ae[_0xfdbf('0x1b')](0x194);}return _0x2addc3;};}function handleError(_0x55690c,_0x147c1c){_0x147c1c=_0x147c1c||0x1f4;return function(_0x3752a1){logger['error'](_0x3752a1[_0xfdbf('0x29')]);if(_0x3752a1[_0xfdbf('0x2a')]){delete _0x3752a1[_0xfdbf('0x2a')];}_0x55690c[_0xfdbf('0x1c')](_0x147c1c)[_0xfdbf('0x2b')](_0x3752a1);};}exports[_0xfdbf('0x2c')]=function(_0x392e64,_0x9fbd85){var _0x3b9939={},_0x3c17c7={},_0x1e844b={'count':0x0,'rows':[]};var _0x3010a4=_[_0xfdbf('0x2d')](db['DeskAccount'][_0xfdbf('0x2e')],function(_0x194210){return{'name':_0x194210[_0xfdbf('0x2f')],'type':_0x194210[_0xfdbf('0x30')][_0xfdbf('0x31')]};});_0x3c17c7[_0xfdbf('0x32')]=_[_0xfdbf('0x2d')](_0x3010a4,'name');_0x3c17c7['query']=_['keys'](_0x392e64[_0xfdbf('0x33')]);_0x3c17c7['filters']=_['intersection'](_0x3c17c7[_0xfdbf('0x32')],_0x3c17c7['query']);_0x3b9939['attributes']=_[_0xfdbf('0x34')](_0x3c17c7[_0xfdbf('0x32')],qs['fields'](_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x35')]));_0x3b9939['attributes']=_0x3b9939['attributes'][_0xfdbf('0x36')]?_0x3b9939[_0xfdbf('0x37')]:_0x3c17c7[_0xfdbf('0x32')];if(!_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x38')]('nolimit')){_0x3b9939[_0xfdbf('0x1f')]=qs['limit'](_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x1f')]);_0x3b9939['offset']=qs[_0xfdbf('0x39')](_0x392e64[_0xfdbf('0x33')]['offset']);}_0x3b9939['order']=qs[_0xfdbf('0x3a')](_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x3a')]);_0x3b9939[_0xfdbf('0x3b')]=qs[_0xfdbf('0x3c')](_[_0xfdbf('0x3d')](_0x392e64[_0xfdbf('0x33')],_0x3c17c7[_0xfdbf('0x3c')]),_0x3010a4);if(_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x3e')]){_0x3b9939['where']=_[_0xfdbf('0x3f')](_0x3b9939['where'],{'$or':_[_0xfdbf('0x2d')](_0x3010a4,function(_0x4c3c74){if(_0x4c3c74['type']!==_0xfdbf('0x40')){var _0x321f21={};_0x321f21[_0x4c3c74['name']]={'$like':'%'+_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x3e')]+'%'};return _0x321f21;}})});}_0x3b9939=_[_0xfdbf('0x3f')]({},_0x3b9939,_0x392e64[_0xfdbf('0x41')]);var _0x49da2e={'where':_0x3b9939[_0xfdbf('0x3b')]};return db[_0xfdbf('0x42')][_0xfdbf('0x20')](_0x49da2e)['then'](function(_0xfc6c69){_0x1e844b[_0xfdbf('0x20')]=_0xfc6c69;if(_0x392e64[_0xfdbf('0x33')][_0xfdbf('0x43')]){_0x3b9939[_0xfdbf('0x44')]=[{'all':!![]}];}return db[_0xfdbf('0x42')][_0xfdbf('0x45')](_0x3b9939);})['then'](function(_0x52945b){_0x1e844b[_0xfdbf('0x46')]=_0x52945b;return _0x1e844b;})[_0xfdbf('0x27')](respondWithFilteredResult(_0x9fbd85,_0x3b9939))[_0xfdbf('0x47')](handleError(_0x9fbd85,null));};exports[_0xfdbf('0x48')]=function(_0x577d75,_0x143acf){var _0x15096b={'raw':![],'where':{'id':_0x577d75[_0xfdbf('0x49')]['id']}},_0x6b6045={};_0x6b6045[_0xfdbf('0x32')]=_[_0xfdbf('0x4a')](db[_0xfdbf('0x42')]['rawAttributes']);_0x6b6045['query']=_[_0xfdbf('0x4a')](_0x577d75[_0xfdbf('0x33')]);_0x6b6045['filters']=_['intersection'](_0x6b6045[_0xfdbf('0x32')],_0x6b6045[_0xfdbf('0x33')]);_0x15096b[_0xfdbf('0x37')]=_[_0xfdbf('0x34')](_0x6b6045['model'],qs['fields'](_0x577d75[_0xfdbf('0x33')][_0xfdbf('0x35')]));_0x15096b['attributes']=_0x15096b[_0xfdbf('0x37')][_0xfdbf('0x36')]?_0x15096b[_0xfdbf('0x37')]:_0x6b6045[_0xfdbf('0x32')];if(_0x577d75[_0xfdbf('0x33')]['includeAll']){_0x15096b['include']=[{'all':!![]}];}_0x15096b=_[_0xfdbf('0x3f')]({},_0x15096b,_0x577d75[_0xfdbf('0x41')]);return db[_0xfdbf('0x42')][_0xfdbf('0x4b')](_0x15096b)[_0xfdbf('0x27')](handleEntityNotFound(_0x143acf,null))[_0xfdbf('0x27')](respondWithResult(_0x143acf,null))[_0xfdbf('0x47')](handleError(_0x143acf,null));};exports['create']=function(_0x3406fe,_0x2d5218){return db[_0xfdbf('0x42')][_0xfdbf('0x4c')](_0x3406fe[_0xfdbf('0x4d')],{})[_0xfdbf('0x27')](respondWithResult(_0x2d5218,0xc9))[_0xfdbf('0x47')](handleError(_0x2d5218,null));};exports[_0xfdbf('0x26')]=function(_0x19ceec,_0x4501a9){if(_0x19ceec['body']['id']){delete _0x19ceec['body']['id'];}return db['DeskAccount'][_0xfdbf('0x4b')]({'where':{'id':_0x19ceec[_0xfdbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x4501a9,null))[_0xfdbf('0x27')](saveUpdates(_0x19ceec[_0xfdbf('0x4d')],null))[_0xfdbf('0x27')](respondWithResult(_0x4501a9,null))[_0xfdbf('0x47')](handleError(_0x4501a9,null));};exports[_0xfdbf('0x28')]=function(_0x26914b,_0x29cc9e){return db[_0xfdbf('0x42')][_0xfdbf('0x4b')]({'where':{'id':_0x26914b[_0xfdbf('0x49')]['id']}})['then'](handleEntityNotFound(_0x29cc9e,null))[_0xfdbf('0x27')](removeEntity(_0x29cc9e,null))[_0xfdbf('0x47')](handleError(_0x29cc9e,null));};exports['getConfigurations']=function(_0x1c4e4d,_0x4fa17c,_0x4c2341){var _0x304605={};var _0x5cb8ef={};var _0x335456;var _0x1c90c2;return db['DeskAccount'][_0xfdbf('0x4e')]({'where':{'id':_0x1c4e4d[_0xfdbf('0x49')]['id']}})[_0xfdbf('0x27')](handleEntityNotFound(_0x4fa17c,null))[_0xfdbf('0x27')](function(_0x5038a6){if(_0x5038a6){_0x335456=_0x5038a6;_0x5cb8ef['model']=_[_0xfdbf('0x4a')](db[_0xfdbf('0x4f')][_0xfdbf('0x2e')]);_0x5cb8ef['query']=_['keys'](_0x1c4e4d[_0xfdbf('0x33')]);_0x5cb8ef[_0xfdbf('0x3c')]=_[_0xfdbf('0x34')](_0x5cb8ef[_0xfdbf('0x32')],_0x5cb8ef[_0xfdbf('0x33')]);_0x304605[_0xfdbf('0x37')]=_[_0xfdbf('0x34')](_0x5cb8ef[_0xfdbf('0x32')],qs['fields'](_0x1c4e4d[_0xfdbf('0x33')]['fields']));_0x304605[_0xfdbf('0x37')]=_0x304605['attributes'][_0xfdbf('0x36')]?_0x304605['attributes']:_0x5cb8ef[_0xfdbf('0x32')];_0x304605[_0xfdbf('0x50')]=qs[_0xfdbf('0x3a')](_0x1c4e4d[_0xfdbf('0x33')]['sort']);_0x304605[_0xfdbf('0x3b')]=qs['filters'](_[_0xfdbf('0x3d')](_0x1c4e4d[_0xfdbf('0x33')],_0x5cb8ef[_0xfdbf('0x3c')]));if(_0x1c4e4d[_0xfdbf('0x33')][_0xfdbf('0x3e')]){_0x304605[_0xfdbf('0x3b')]=_['merge'](_0x304605[_0xfdbf('0x3b')],{'$or':_[_0xfdbf('0x2d')](_0x304605['attributes'],function(_0x26a890){var _0x2a73ff={};_0x2a73ff[_0x26a890]={'$like':'%'+_0x1c4e4d[_0xfdbf('0x33')]['filter']+'%'};return _0x2a73ff;})});}_0x304605=_['merge']({},_0x304605,_0x1c4e4d['options']);return _0x335456[_0xfdbf('0x51')](_0x304605);}})['then'](function(_0x4155c3){if(_0x4155c3){_0x1c90c2=_0x4155c3[_0xfdbf('0x36')];if(!_0x1c4e4d[_0xfdbf('0x33')][_0xfdbf('0x38')](_0xfdbf('0x52'))){_0x304605[_0xfdbf('0x1f')]=qs[_0xfdbf('0x1f')](_0x1c4e4d[_0xfdbf('0x33')][_0xfdbf('0x1f')]);_0x304605['offset']=qs[_0xfdbf('0x39')](_0x1c4e4d[_0xfdbf('0x33')][_0xfdbf('0x39')]);}return _0x335456[_0xfdbf('0x51')](_0x304605);}})[_0xfdbf('0x27')](function(_0xb67c62){if(_0xb67c62){return _0xb67c62?{'count':_0x1c90c2,'rows':_0xb67c62}:null;}})['then'](respondWithResult(_0x4fa17c,null))['catch'](handleError(_0x4fa17c,null));};exports[_0xfdbf('0x53')]=function(_0x38d2be,_0x6d47a7,_0x1575e7){if(_0x38d2be[_0xfdbf('0x4d')]['id']){delete _0x38d2be[_0xfdbf('0x4d')]['id'];}return db[_0xfdbf('0x42')][_0xfdbf('0x4e')]({'where':{'id':_0x38d2be['params']['id']}})['then'](handleEntityNotFound(_0x6d47a7,null))[_0xfdbf('0x27')](function(_0x37e9a1){if(_0x37e9a1){_0x38d2be[_0xfdbf('0x4d')][_0xfdbf('0x54')]=_0x37e9a1['id'];_0x38d2be[_0xfdbf('0x4d')][_0xfdbf('0x55')]=integrations[_0xfdbf('0x56')](_0x38d2be['body'][_0xfdbf('0x57')],_0x38d2be[_0xfdbf('0x4d')]['type']);_0x38d2be[_0xfdbf('0x4d')][_0xfdbf('0x58')]=integrations[_0xfdbf('0x59')](_0x38d2be[_0xfdbf('0x4d')]['channel'],_0x38d2be[_0xfdbf('0x4d')]['type']);return db[_0xfdbf('0x4f')][_0xfdbf('0x4c')](_0x38d2be[_0xfdbf('0x4d')],{'include':[{'model':db[_0xfdbf('0x5a')],'as':_0xfdbf('0x55')},{'model':db[_0xfdbf('0x5a')],'as':_0xfdbf('0x58')}]});}return null;})['then'](respondWithResult(_0x6d47a7,null))['catch'](handleError(_0x6d47a7,null));};exports[_0xfdbf('0x5b')]=function(_0x73594a,_0x26478b,_0x565147){var _0x5b1f75=[{'name':_0xfdbf('0x5c'),'label':_0xfdbf('0x5c'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3b2abb='';return db['DeskAccount']['findOne']({'where':{'id':_0x73594a['params']['id']},'attributes':['id',_0xfdbf('0x5d'),'authType','username',_0xfdbf('0x5e'),_0xfdbf('0x5f'),_0xfdbf('0x60'),_0xfdbf('0x61'),_0xfdbf('0x62')]})[_0xfdbf('0x27')](handleEntityNotFound(_0x26478b,null))['then'](function(_0x5d8613){if(_0x5d8613){_0x3b2abb=_0x5d8613[_0xfdbf('0x5d')];var _0x50074e=_0x3b2abb[_0xfdbf('0x63')](-0x1);if(_0x50074e==='/'){_0x3b2abb=_0x3b2abb[_0xfdbf('0x64')](0x0,_0x3b2abb[_0xfdbf('0x65')](_0x50074e));}var _0x213b23={'method':_0xfdbf('0x66'),'uri':util['format']('%s/custom_fields',_0x3b2abb),'headers':{'Content-Type':_0xfdbf('0x67'),'Accept':_0xfdbf('0x67')},'json':!![]};if(_0x5d8613[_0xfdbf('0x68')]===_0xfdbf('0x69')){_0x213b23[_0xfdbf('0x6a')][_0xfdbf('0x6b')]=util[_0xfdbf('0x6c')](_0xfdbf('0x6d'),new Buffer(util[_0xfdbf('0x6c')](_0xfdbf('0x6e'),_0x5d8613['username'],_0x5d8613[_0xfdbf('0x5e')]))[_0xfdbf('0x6f')](_0xfdbf('0x70')));}return rp(_0x213b23)[_0xfdbf('0x27')](function(_0x341a10){return _0x5b1f75['concat'](_[_0xfdbf('0x2d')](_0x341a10['_embedded'][_0xfdbf('0x71')],function(_0x53c1f1){return{'id':_0x53c1f1[_0xfdbf('0x2a')],'name':_0x53c1f1[_0xfdbf('0x2a')],'type':_0x53c1f1[_0xfdbf('0x30')],'active':_0x53c1f1['active'],'label':_0x53c1f1[_0xfdbf('0x72')],'custom':!![]};}));});}})[_0xfdbf('0x27')](function(_0x306c62){return{'count':_0x306c62[_0xfdbf('0x36')],'rows':_0x306c62};})[_0xfdbf('0x27')](respondWithResult(_0x26478b,null))[_0xfdbf('0x47')](function(_0x48bd9){var _0x38e85b=_0x73594a[_0xfdbf('0x33')][_0xfdbf('0x73')]?0x1f4:_0x48bd9[_0xfdbf('0x74')]||0x1f4;logger[_0xfdbf('0x75')](_0xfdbf('0x76'),_0xfdbf('0x5b'),_0x38e85b,JSON['stringify'](_0x48bd9));delete _0x48bd9[_0xfdbf('0x2a')];if(_0x38e85b===0x191){_0x38e85b=0x190;}_0x26478b['status'](_0x38e85b)[_0xfdbf('0x2b')](_0x73594a[_0xfdbf('0x33')][_0xfdbf('0x73')]?{'message':_0xfdbf('0x77'),'statusCode':_0x48bd9[_0xfdbf('0x74')]}:_0x48bd9);});}; \ No newline at end of file +var _0x9202=['active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','find','catch','body','params','getConfigurations','DeskConfiguration','hasOwnProperty','nolimit','addConfiguration','findOne','Subjects','getSubjects','getDescriptions','channel','DeskField','getFields','priority','username','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','Authorization','Basic\x20%s','toString','base64','concat','_embedded'];(function(_0x40094f,_0x4637d5){var _0x21bd78=function(_0x173f34){while(--_0x173f34){_0x40094f['push'](_0x40094f['shift']());}};_0x21bd78(++_0x4637d5);}(_0x9202,0x13f));var _0x2920=function(_0x526392,_0x3c79e4){_0x526392=_0x526392-0x0;var _0x4e78b0=_0x9202[_0x526392];return _0x4e78b0;};'use strict';var emlformat=require(_0x2920('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2920('0x1'));var moment=require(_0x2920('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2920('0x3'));var util=require(_0x2920('0x4'));var path=require(_0x2920('0x5'));var sox=require(_0x2920('0x6'));var csv=require(_0x2920('0x7'));var ejs=require(_0x2920('0x8'));var fs=require('fs');var fs_extra=require(_0x2920('0x9'));var _=require('lodash');var squel=require(_0x2920('0xa'));var crypto=require(_0x2920('0xb'));var jsforce=require(_0x2920('0xc'));var deskjs=require(_0x2920('0xd'));var toCsv=require(_0x2920('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2920('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x2920('0xf'));var hardwareService=require(_0x2920('0x10'));var logger=require('../../config/logger')(_0x2920('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2920('0x12'))['db'];var integrations=require(_0x2920('0x13'));function respondWithStatusCode(_0x5774fc,_0x45d6e5){_0x45d6e5=_0x45d6e5||0xcc;return function(_0x31471d){if(_0x31471d){return _0x5774fc[_0x2920('0x14')](_0x45d6e5);}return _0x5774fc[_0x2920('0x15')](_0x45d6e5)['end']();};}function respondWithResult(_0x1484cb,_0xdf3f79){_0xdf3f79=_0xdf3f79||0xc8;return function(_0x4421e0){if(_0x4421e0){return _0x1484cb[_0x2920('0x15')](_0xdf3f79)[_0x2920('0x16')](_0x4421e0);}};}function respondWithFilteredResult(_0x3d724e,_0x39dde1){return function(_0x11b0bf){if(_0x11b0bf){var _0x5fa03=typeof _0x39dde1[_0x2920('0x17')]===_0x2920('0x18')&&typeof _0x39dde1['limit']===_0x2920('0x18');var _0x5df717=_0x11b0bf[_0x2920('0x19')];var _0x43cfd5=_0x5fa03?0x0:_0x39dde1[_0x2920('0x17')];var _0x4911cc=_0x5fa03?_0x11b0bf[_0x2920('0x19')]:_0x39dde1[_0x2920('0x17')]+_0x39dde1[_0x2920('0x1a')];var _0x395d2a;if(_0x4911cc>=_0x5df717){_0x4911cc=_0x5df717;_0x395d2a=0xc8;}else{_0x395d2a=0xce;}_0x3d724e[_0x2920('0x15')](_0x395d2a);return _0x3d724e[_0x2920('0x1b')]('Content-Range',_0x43cfd5+'-'+_0x4911cc+'/'+_0x5df717)[_0x2920('0x16')](_0x11b0bf);}return null;};}function patchUpdates(_0x2e4130){return function(_0xf4e4a6){try{jsonpatch[_0x2920('0x1c')](_0xf4e4a6,_0x2e4130,!![]);}catch(_0x416710){return BPromise['reject'](_0x416710);}return _0xf4e4a6[_0x2920('0x1d')]();};}function saveUpdates(_0x447df7,_0x26408b){return function(_0x1f97b4){if(_0x1f97b4){return _0x1f97b4[_0x2920('0x1e')](_0x447df7)[_0x2920('0x1f')](function(_0x124c2f){return _0x124c2f;});}return null;};}function removeEntity(_0x436cfa,_0x4159e7){return function(_0x298ed3){if(_0x298ed3){return _0x298ed3[_0x2920('0x20')]()[_0x2920('0x1f')](function(){_0x436cfa[_0x2920('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bdc43,_0xeda40f){return function(_0x5a41c5){if(!_0x5a41c5){_0x4bdc43[_0x2920('0x14')](0x194);}return _0x5a41c5;};}function handleError(_0x597f3f,_0x19d0bc){_0x19d0bc=_0x19d0bc||0x1f4;return function(_0x20a01b){logger['error'](_0x20a01b['stack']);if(_0x20a01b[_0x2920('0x21')]){delete _0x20a01b[_0x2920('0x21')];}_0x597f3f[_0x2920('0x15')](_0x19d0bc)[_0x2920('0x22')](_0x20a01b);};}exports[_0x2920('0x23')]=function(_0x13b2e1,_0x7d171){var _0x2496f1={},_0x4b0d74={},_0x6c09={'count':0x0,'rows':[]};var _0x28b023=_[_0x2920('0x24')](db[_0x2920('0x25')][_0x2920('0x26')],function(_0x1df0b6){return{'name':_0x1df0b6[_0x2920('0x27')],'type':_0x1df0b6[_0x2920('0x28')]['key']};});_0x4b0d74[_0x2920('0x29')]=_[_0x2920('0x24')](_0x28b023,_0x2920('0x21'));_0x4b0d74[_0x2920('0x2a')]=_[_0x2920('0x2b')](_0x13b2e1[_0x2920('0x2a')]);_0x4b0d74[_0x2920('0x2c')]=_[_0x2920('0x2d')](_0x4b0d74[_0x2920('0x29')],_0x4b0d74[_0x2920('0x2a')]);_0x2496f1['attributes']=_['intersection'](_0x4b0d74['model'],qs[_0x2920('0x2e')](_0x13b2e1['query']['fields']));_0x2496f1[_0x2920('0x2f')]=_0x2496f1['attributes'][_0x2920('0x30')]?_0x2496f1[_0x2920('0x2f')]:_0x4b0d74['model'];if(!_0x13b2e1['query']['hasOwnProperty']('nolimit')){_0x2496f1[_0x2920('0x1a')]=qs[_0x2920('0x1a')](_0x13b2e1[_0x2920('0x2a')][_0x2920('0x1a')]);_0x2496f1['offset']=qs[_0x2920('0x17')](_0x13b2e1[_0x2920('0x2a')][_0x2920('0x17')]);}_0x2496f1[_0x2920('0x31')]=qs[_0x2920('0x32')](_0x13b2e1['query'][_0x2920('0x32')]);_0x2496f1['where']=qs[_0x2920('0x2c')](_[_0x2920('0x33')](_0x13b2e1[_0x2920('0x2a')],_0x4b0d74[_0x2920('0x2c')]),_0x28b023);if(_0x13b2e1[_0x2920('0x2a')][_0x2920('0x34')]){_0x2496f1[_0x2920('0x35')]=_[_0x2920('0x36')](_0x2496f1['where'],{'$or':_[_0x2920('0x24')](_0x28b023,function(_0x3835e7){if(_0x3835e7[_0x2920('0x28')]!==_0x2920('0x37')){var _0x5df7ef={};_0x5df7ef[_0x3835e7[_0x2920('0x21')]]={'$like':'%'+_0x13b2e1['query'][_0x2920('0x34')]+'%'};return _0x5df7ef;}})});}_0x2496f1=_[_0x2920('0x36')]({},_0x2496f1,_0x13b2e1[_0x2920('0x38')]);var _0x494c59={'where':_0x2496f1[_0x2920('0x35')]};return db['DeskAccount'][_0x2920('0x19')](_0x494c59)['then'](function(_0x53e7ad){_0x6c09[_0x2920('0x19')]=_0x53e7ad;if(_0x13b2e1[_0x2920('0x2a')]['includeAll']){_0x2496f1[_0x2920('0x39')]=[{'all':!![]}];}return db[_0x2920('0x25')][_0x2920('0x3a')](_0x2496f1);})[_0x2920('0x1f')](function(_0x5d4fd7){_0x6c09[_0x2920('0x3b')]=_0x5d4fd7;return _0x6c09;})[_0x2920('0x1f')](respondWithFilteredResult(_0x7d171,_0x2496f1))['catch'](handleError(_0x7d171,null));};exports['show']=function(_0x33cdda,_0x473f23){var _0x53f212={'raw':![],'where':{'id':_0x33cdda['params']['id']}},_0x434825={};_0x434825[_0x2920('0x29')]=_['keys'](db['DeskAccount'][_0x2920('0x26')]);_0x434825[_0x2920('0x2a')]=_[_0x2920('0x2b')](_0x33cdda[_0x2920('0x2a')]);_0x434825[_0x2920('0x2c')]=_[_0x2920('0x2d')](_0x434825[_0x2920('0x29')],_0x434825[_0x2920('0x2a')]);_0x53f212[_0x2920('0x2f')]=_[_0x2920('0x2d')](_0x434825[_0x2920('0x29')],qs[_0x2920('0x2e')](_0x33cdda['query']['fields']));_0x53f212[_0x2920('0x2f')]=_0x53f212[_0x2920('0x2f')]['length']?_0x53f212[_0x2920('0x2f')]:_0x434825[_0x2920('0x29')];if(_0x33cdda[_0x2920('0x2a')]['includeAll']){_0x53f212[_0x2920('0x39')]=[{'all':!![]}];}_0x53f212=_['merge']({},_0x53f212,_0x33cdda['options']);return db[_0x2920('0x25')][_0x2920('0x3c')](_0x53f212)[_0x2920('0x1f')](handleEntityNotFound(_0x473f23,null))['then'](respondWithResult(_0x473f23,null))[_0x2920('0x3d')](handleError(_0x473f23,null));};exports['create']=function(_0x220898,_0x44cdf0){return db[_0x2920('0x25')]['create'](_0x220898[_0x2920('0x3e')],{})[_0x2920('0x1f')](respondWithResult(_0x44cdf0,0xc9))['catch'](handleError(_0x44cdf0,null));};exports[_0x2920('0x1e')]=function(_0x5a7d3d,_0x7f5ece){if(_0x5a7d3d[_0x2920('0x3e')]['id']){delete _0x5a7d3d[_0x2920('0x3e')]['id'];}return db[_0x2920('0x25')][_0x2920('0x3c')]({'where':{'id':_0x5a7d3d[_0x2920('0x3f')]['id']}})[_0x2920('0x1f')](handleEntityNotFound(_0x7f5ece,null))[_0x2920('0x1f')](saveUpdates(_0x5a7d3d[_0x2920('0x3e')],null))[_0x2920('0x1f')](respondWithResult(_0x7f5ece,null))[_0x2920('0x3d')](handleError(_0x7f5ece,null));};exports[_0x2920('0x20')]=function(_0x85c1c1,_0x30f3bb){return db[_0x2920('0x25')][_0x2920('0x3c')]({'where':{'id':_0x85c1c1['params']['id']}})[_0x2920('0x1f')](handleEntityNotFound(_0x30f3bb,null))[_0x2920('0x1f')](removeEntity(_0x30f3bb,null))['catch'](handleError(_0x30f3bb,null));};exports[_0x2920('0x40')]=function(_0x29f480,_0x367a2b,_0x52462a){var _0x595ddc={};var _0x3eb7cd={};var _0x246e54;var _0x42cf74;return db['DeskAccount']['findOne']({'where':{'id':_0x29f480[_0x2920('0x3f')]['id']}})[_0x2920('0x1f')](handleEntityNotFound(_0x367a2b,null))[_0x2920('0x1f')](function(_0x3c1314){if(_0x3c1314){_0x246e54=_0x3c1314;_0x3eb7cd['model']=_[_0x2920('0x2b')](db[_0x2920('0x41')][_0x2920('0x26')]);_0x3eb7cd[_0x2920('0x2a')]=_[_0x2920('0x2b')](_0x29f480[_0x2920('0x2a')]);_0x3eb7cd[_0x2920('0x2c')]=_[_0x2920('0x2d')](_0x3eb7cd['model'],_0x3eb7cd[_0x2920('0x2a')]);_0x595ddc[_0x2920('0x2f')]=_[_0x2920('0x2d')](_0x3eb7cd['model'],qs['fields'](_0x29f480[_0x2920('0x2a')][_0x2920('0x2e')]));_0x595ddc[_0x2920('0x2f')]=_0x595ddc['attributes']['length']?_0x595ddc[_0x2920('0x2f')]:_0x3eb7cd[_0x2920('0x29')];_0x595ddc[_0x2920('0x31')]=qs[_0x2920('0x32')](_0x29f480[_0x2920('0x2a')][_0x2920('0x32')]);_0x595ddc['where']=qs[_0x2920('0x2c')](_[_0x2920('0x33')](_0x29f480[_0x2920('0x2a')],_0x3eb7cd[_0x2920('0x2c')]));if(_0x29f480['query'][_0x2920('0x34')]){_0x595ddc[_0x2920('0x35')]=_[_0x2920('0x36')](_0x595ddc[_0x2920('0x35')],{'$or':_[_0x2920('0x24')](_0x595ddc[_0x2920('0x2f')],function(_0x2a74d0){var _0x4efd19={};_0x4efd19[_0x2a74d0]={'$like':'%'+_0x29f480[_0x2920('0x2a')][_0x2920('0x34')]+'%'};return _0x4efd19;})});}_0x595ddc=_[_0x2920('0x36')]({},_0x595ddc,_0x29f480['options']);return _0x246e54[_0x2920('0x40')](_0x595ddc);}})[_0x2920('0x1f')](function(_0x2c7964){if(_0x2c7964){_0x42cf74=_0x2c7964[_0x2920('0x30')];if(!_0x29f480[_0x2920('0x2a')][_0x2920('0x42')](_0x2920('0x43'))){_0x595ddc[_0x2920('0x1a')]=qs['limit'](_0x29f480[_0x2920('0x2a')][_0x2920('0x1a')]);_0x595ddc[_0x2920('0x17')]=qs[_0x2920('0x17')](_0x29f480[_0x2920('0x2a')][_0x2920('0x17')]);}return _0x246e54[_0x2920('0x40')](_0x595ddc);}})['then'](function(_0x2c327a){if(_0x2c327a){return _0x2c327a?{'count':_0x42cf74,'rows':_0x2c327a}:null;}})[_0x2920('0x1f')](respondWithResult(_0x367a2b,null))['catch'](handleError(_0x367a2b,null));};exports[_0x2920('0x44')]=function(_0x33f6f3,_0x3fe745,_0xcdeb3b){if(_0x33f6f3[_0x2920('0x3e')]['id']){delete _0x33f6f3['body']['id'];}return db[_0x2920('0x25')][_0x2920('0x45')]({'where':{'id':_0x33f6f3[_0x2920('0x3f')]['id']}})[_0x2920('0x1f')](handleEntityNotFound(_0x3fe745,null))['then'](function(_0x3b1b76){if(_0x3b1b76){_0x33f6f3[_0x2920('0x3e')]['AccountId']=_0x3b1b76['id'];_0x33f6f3['body'][_0x2920('0x46')]=integrations[_0x2920('0x47')](_0x33f6f3[_0x2920('0x3e')]['channel'],_0x33f6f3['body'][_0x2920('0x28')]);_0x33f6f3['body']['Descriptions']=integrations[_0x2920('0x48')](_0x33f6f3[_0x2920('0x3e')][_0x2920('0x49')],_0x33f6f3['body']['type']);return db[_0x2920('0x41')]['create'](_0x33f6f3[_0x2920('0x3e')],{'include':[{'model':db[_0x2920('0x4a')],'as':'Subjects'},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})[_0x2920('0x1f')](respondWithResult(_0x3fe745,null))[_0x2920('0x3d')](handleError(_0x3fe745,null));};exports[_0x2920('0x4b')]=function(_0x25da35,_0x2fd602,_0x1e613a){var _0x3d57f0=[{'name':_0x2920('0x4c'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x26dd78='';return db[_0x2920('0x25')][_0x2920('0x45')]({'where':{'id':_0x25da35[_0x2920('0x3f')]['id']},'attributes':['id','remoteUri','authType',_0x2920('0x4d'),_0x2920('0x4e'),_0x2920('0x4f'),_0x2920('0x50'),_0x2920('0x51'),_0x2920('0x52')]})[_0x2920('0x1f')](handleEntityNotFound(_0x2fd602,null))['then'](function(_0x181146){if(_0x181146){_0x26dd78=_0x181146[_0x2920('0x53')];var _0x275a09=_0x26dd78['slice'](-0x1);if(_0x275a09==='/'){_0x26dd78=_0x26dd78[_0x2920('0x54')](0x0,_0x26dd78[_0x2920('0x55')](_0x275a09));}var _0x442d80={'method':_0x2920('0x56'),'uri':util[_0x2920('0x57')](_0x2920('0x58'),_0x26dd78),'headers':{'Content-Type':_0x2920('0x59'),'Accept':'application/json'},'json':!![]};if(_0x181146[_0x2920('0x5a')]==='basic'){_0x442d80['headers'][_0x2920('0x5b')]=util[_0x2920('0x57')](_0x2920('0x5c'),new Buffer(util[_0x2920('0x57')]('%s:%s',_0x181146[_0x2920('0x4d')],_0x181146['password']))[_0x2920('0x5d')](_0x2920('0x5e')));}return rp(_0x442d80)['then'](function(_0x4ddad7){return _0x3d57f0[_0x2920('0x5f')](_['map'](_0x4ddad7[_0x2920('0x60')]['entries'],function(_0xd9bb95){return{'id':_0xd9bb95['name'],'name':_0xd9bb95[_0x2920('0x21')],'type':_0xd9bb95[_0x2920('0x28')],'active':_0xd9bb95[_0x2920('0x61')],'label':_0xd9bb95[_0x2920('0x62')],'custom':!![]};}));});}})[_0x2920('0x1f')](function(_0x3f87d9){return{'count':_0x3f87d9[_0x2920('0x30')],'rows':_0x3f87d9};})['then'](respondWithResult(_0x2fd602,null))['catch'](function(_0x10b86a){var _0x1d56e7=_0x25da35[_0x2920('0x2a')][_0x2920('0x63')]?0x1f4:_0x10b86a[_0x2920('0x64')]||0x1f4;logger[_0x2920('0x65')](_0x2920('0x66'),'getFields',_0x1d56e7,JSON['stringify'](_0x10b86a));delete _0x10b86a[_0x2920('0x21')];if(_0x1d56e7===0x191){_0x1d56e7=0x190;}_0x2fd602[_0x2920('0x15')](_0x1d56e7)[_0x2920('0x22')](_0x25da35[_0x2920('0x2a')][_0x2920('0x63')]?{'message':_0x2920('0x67'),'statusCode':_0x10b86a['statusCode']}:_0x10b86a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index bf7473d..e404baa 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 _0x8245=['api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x2ef251,_0x3687e5){var _0x5c931b=function(_0x3e1e36){while(--_0x3e1e36){_0x2ef251['push'](_0x2ef251['shift']());}};_0x5c931b(++_0x3687e5);}(_0x8245,0x129));var _0x5824=function(_0xf71ec9,_0x47b951){_0xf71ec9=_0xf71ec9-0x0;var _0x12ef58=_0x8245[_0xf71ec9];return _0x12ef58;};'use strict';var _=require(_0x5824('0x0'));var util=require(_0x5824('0x1'));var logger=require('../../config/logger')(_0x5824('0x2'));var moment=require(_0x5824('0x3'));var BPromise=require(_0x5824('0x4'));var rp=require(_0x5824('0x5'));var fs=require('fs');var path=require(_0x5824('0x6'));var rimraf=require(_0x5824('0x7'));var config=require('../../config/environment');var attributes=require(_0x5824('0x8'));var integrations=require(_0x5824('0x9'));module[_0x5824('0xa')]=function(_0x325be3,_0x851f95){return _0x325be3['define'](_0x5824('0xb'),attributes,{'tableName':_0x5824('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a9c=['bluebird','request-promise','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','define','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x55e484,_0x1a8d3a){var _0x19f446=function(_0x1d3bba){while(--_0x1d3bba){_0x55e484['push'](_0x55e484['shift']());}};_0x19f446(++_0x1a8d3a);}(_0x3a9c,0xa7));var _0xc3a9=function(_0x14cef1,_0x5350ef){_0x14cef1=_0x14cef1-0x0;var _0x9c921f=_0x3a9c[_0x14cef1];return _0x9c921f;};'use strict';var _=require(_0xc3a9('0x0'));var util=require(_0xc3a9('0x1'));var logger=require(_0xc3a9('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc3a9('0x3'));var rp=require(_0xc3a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3a9('0x5'));var config=require('../../config/environment');var attributes=require(_0xc3a9('0x6'));var integrations=require(_0xc3a9('0x7'));module['exports']=function(_0x80cf90,_0x342b5e){return _0x80cf90[_0xc3a9('0x8')]('DeskAccount',attributes,{'tableName':_0xc3a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 4b87480..39cee92 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 _0xa3b3=['DeskAccount','findAll','options','raw','where','limit','map','model','attributes','include','GetDeskAccount','stringify','catch','ShowDeskAccount','find','lodash','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x45d370,_0x1ef0ef){var _0xeb016e=function(_0x494489){while(--_0x494489){_0x45d370['push'](_0x45d370['shift']());}};_0xeb016e(++_0x1ef0ef);}(_0xa3b3,0x18f));var _0x3a3b=function(_0xeea946,_0x22e261){_0xeea946=_0xeea946-0x0;var _0x2945eb=_0xa3b3[_0xeea946];return _0x2945eb;};'use strict';var _=require(_0x3a3b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a3b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a3b('0x2'));var logger=require(_0x3a3b('0x3'))('rpc');var config=require(_0x3a3b('0x4'));var jayson=require(_0x3a3b('0x5'));var client=jayson[_0x3a3b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d6076,_0x412a25,_0x4d9f53){return new BPromise(function(_0x79bc22,_0x2e5832){return client[_0x3a3b('0x7')](_0x3d6076,_0x4d9f53)[_0x3a3b('0x8')](function(_0x4e537d){logger[_0x3a3b('0x9')](_0x3a3b('0xa'),_0x412a25,_0x3a3b('0xb'));logger[_0x3a3b('0xc')](_0x3a3b('0xd'),_0x412a25,_0x3a3b('0xb'),JSON['stringify'](_0x4e537d));if(_0x4e537d['error']){if(_0x4e537d[_0x3a3b('0xe')][_0x3a3b('0xf')]===0x1f4){logger[_0x3a3b('0xe')](_0x3a3b('0xa'),_0x412a25,_0x4e537d[_0x3a3b('0xe')][_0x3a3b('0x10')]);return _0x2e5832(_0x4e537d[_0x3a3b('0xe')][_0x3a3b('0x10')]);}logger[_0x3a3b('0xe')]('DeskAccount,\x20%s,\x20%s',_0x412a25,_0x4e537d[_0x3a3b('0xe')][_0x3a3b('0x10')]);return _0x79bc22(_0x4e537d[_0x3a3b('0xe')]['message']);}else{logger['info'](_0x3a3b('0xa'),_0x412a25,_0x3a3b('0xb'));_0x79bc22(_0x4e537d['result'][_0x3a3b('0x10')]);}})['catch'](function(_0x5ab9ef){logger[_0x3a3b('0xe')](_0x3a3b('0xa'),_0x412a25,_0x5ab9ef);_0x2e5832(_0x5ab9ef);});});}exports['GetDeskAccount']=function(_0x27ce43){var _0xff6a7d=this;return new Promise(function(_0x5471c7,_0x127fc6){return db[_0x3a3b('0x11')][_0x3a3b('0x12')]({'raw':_0x27ce43[_0x3a3b('0x13')]?_0x27ce43['options'][_0x3a3b('0x14')]===undefined?!![]:![]:!![],'where':_0x27ce43[_0x3a3b('0x13')]?_0x27ce43['options'][_0x3a3b('0x15')]||null:null,'attributes':_0x27ce43['options']?_0x27ce43['options']['attributes']||null:null,'limit':_0x27ce43[_0x3a3b('0x13')]?_0x27ce43['options'][_0x3a3b('0x16')]||null:null,'include':_0x27ce43['options']?_0x27ce43[_0x3a3b('0x13')]['include']?_[_0x3a3b('0x17')](_0x27ce43['options']['include'],function(_0x43253a){return{'model':db[_0x43253a[_0x3a3b('0x18')]],'as':_0x43253a['as'],'attributes':_0x43253a[_0x3a3b('0x19')],'include':_0x43253a[_0x3a3b('0x1a')]?_['map'](_0x43253a[_0x3a3b('0x1a')],function(_0x3cc853){return{'model':db[_0x3cc853[_0x3a3b('0x18')]],'as':_0x3cc853['as'],'attributes':_0x3cc853[_0x3a3b('0x19')],'include':_0x3cc853[_0x3a3b('0x1a')]?_[_0x3a3b('0x17')](_0x3cc853[_0x3a3b('0x1a')],function(_0x109879){return{'model':db[_0x109879[_0x3a3b('0x18')]],'as':_0x109879['as'],'attributes':_0x109879[_0x3a3b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3a3b('0x8')](function(_0x40e57e){logger['info'](_0x3a3b('0x1b'),_0x27ce43);logger[_0x3a3b('0xc')](_0x3a3b('0x1b'),_0x27ce43,JSON[_0x3a3b('0x1c')](_0x40e57e));_0x5471c7(_0x40e57e);})[_0x3a3b('0x1d')](function(_0x8d9d42){logger['error'](_0x3a3b('0x1b'),_0x8d9d42[_0x3a3b('0x10')],_0x27ce43);_0x127fc6(_0xff6a7d[_0x3a3b('0xe')](0x1f4,_0x8d9d42[_0x3a3b('0x10')]));});});};exports[_0x3a3b('0x1e')]=function(_0x1d593a){var _0x36f556=this;return new Promise(function(_0x5a2bff,_0x35dcd8){return db[_0x3a3b('0x11')][_0x3a3b('0x1f')]({'raw':_0x1d593a[_0x3a3b('0x13')]?_0x1d593a[_0x3a3b('0x13')][_0x3a3b('0x14')]===undefined?!![]:![]:!![],'where':_0x1d593a[_0x3a3b('0x13')]?_0x1d593a[_0x3a3b('0x13')][_0x3a3b('0x15')]||null:null,'attributes':_0x1d593a[_0x3a3b('0x13')]?_0x1d593a[_0x3a3b('0x13')][_0x3a3b('0x19')]||null:null,'include':_0x1d593a[_0x3a3b('0x13')]?_0x1d593a[_0x3a3b('0x13')][_0x3a3b('0x1a')]?_[_0x3a3b('0x17')](_0x1d593a[_0x3a3b('0x13')][_0x3a3b('0x1a')],function(_0x4170f1){return{'model':db[_0x4170f1[_0x3a3b('0x18')]],'as':_0x4170f1['as'],'attributes':_0x4170f1[_0x3a3b('0x19')],'include':_0x4170f1['include']?_[_0x3a3b('0x17')](_0x4170f1[_0x3a3b('0x1a')],function(_0x21c7e2){return{'model':db[_0x21c7e2[_0x3a3b('0x18')]],'as':_0x21c7e2['as'],'attributes':_0x21c7e2[_0x3a3b('0x19')],'include':_0x21c7e2['include']?_[_0x3a3b('0x17')](_0x21c7e2[_0x3a3b('0x1a')],function(_0x461307){return{'model':db[_0x461307[_0x3a3b('0x18')]],'as':_0x461307['as'],'attributes':_0x461307['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a3b('0x8')](function(_0xb67e75){logger[_0x3a3b('0x9')]('ShowDeskAccount',_0x1d593a);logger['debug'](_0x3a3b('0x1e'),_0x1d593a,JSON[_0x3a3b('0x1c')](_0xb67e75));_0x5a2bff(_0xb67e75);})[_0x3a3b('0x1d')](function(_0x36265d){logger['error'](_0x3a3b('0x1e'),_0x36265d['message'],_0x1d593a);_0x35dcd8(_0x36f556['error'](0x1f4,_0x36265d[_0x3a3b('0x10')]));});});}; \ No newline at end of file +var _0x94b1=['attributes','limit','include','model','map','catch','ShowDeskAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','findAll','raw','options','where'];(function(_0x37efd8,_0x2382aa){var _0x54890b=function(_0x424ab7){while(--_0x424ab7){_0x37efd8['push'](_0x37efd8['shift']());}};_0x54890b(++_0x2382aa);}(_0x94b1,0x98));var _0x194b=function(_0x2c9aab,_0x341e01){_0x2c9aab=_0x2c9aab-0x0;var _0x3ea98c=_0x94b1[_0x2c9aab];return _0x3ea98c;};'use strict';var _=require(_0x194b('0x0'));var util=require(_0x194b('0x1'));var moment=require(_0x194b('0x2'));var BPromise=require(_0x194b('0x3'));var rs=require(_0x194b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x194b('0x5'))['db'];var utils=require(_0x194b('0x6'));var logger=require(_0x194b('0x7'))(_0x194b('0x8'));var config=require(_0x194b('0x9'));var jayson=require(_0x194b('0xa'));var client=jayson['client'][_0x194b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b501c,_0x36ff8d,_0x48a8a0){return new BPromise(function(_0x9a027b,_0x2cd5b3){return client['request'](_0x4b501c,_0x48a8a0)[_0x194b('0xc')](function(_0x2b325d){logger[_0x194b('0xd')]('DeskAccount,\x20%s,\x20%s',_0x36ff8d,_0x194b('0xe'));logger[_0x194b('0xf')](_0x194b('0x10'),_0x36ff8d,_0x194b('0xe'),JSON[_0x194b('0x11')](_0x2b325d));if(_0x2b325d[_0x194b('0x12')]){if(_0x2b325d['error'][_0x194b('0x13')]===0x1f4){logger[_0x194b('0x12')](_0x194b('0x14'),_0x36ff8d,_0x2b325d[_0x194b('0x12')][_0x194b('0x15')]);return _0x2cd5b3(_0x2b325d[_0x194b('0x12')][_0x194b('0x15')]);}logger['error'](_0x194b('0x14'),_0x36ff8d,_0x2b325d[_0x194b('0x12')][_0x194b('0x15')]);return _0x9a027b(_0x2b325d[_0x194b('0x12')]['message']);}else{logger['info'](_0x194b('0x14'),_0x36ff8d,_0x194b('0xe'));_0x9a027b(_0x2b325d[_0x194b('0x16')][_0x194b('0x15')]);}})['catch'](function(_0x1b5236){logger[_0x194b('0x12')]('DeskAccount,\x20%s,\x20%s',_0x36ff8d,_0x1b5236);_0x2cd5b3(_0x1b5236);});});}exports[_0x194b('0x17')]=function(_0x39911c){var _0x25ff05=this;return new Promise(function(_0x428444,_0x1b60d9){return db['DeskAccount'][_0x194b('0x18')]({'raw':_0x39911c['options']?_0x39911c['options'][_0x194b('0x19')]===undefined?!![]:![]:!![],'where':_0x39911c['options']?_0x39911c[_0x194b('0x1a')][_0x194b('0x1b')]||null:null,'attributes':_0x39911c[_0x194b('0x1a')]?_0x39911c[_0x194b('0x1a')][_0x194b('0x1c')]||null:null,'limit':_0x39911c[_0x194b('0x1a')]?_0x39911c[_0x194b('0x1a')][_0x194b('0x1d')]||null:null,'include':_0x39911c[_0x194b('0x1a')]?_0x39911c[_0x194b('0x1a')][_0x194b('0x1e')]?_['map'](_0x39911c[_0x194b('0x1a')][_0x194b('0x1e')],function(_0x108cdc){return{'model':db[_0x108cdc[_0x194b('0x1f')]],'as':_0x108cdc['as'],'attributes':_0x108cdc[_0x194b('0x1c')],'include':_0x108cdc[_0x194b('0x1e')]?_['map'](_0x108cdc[_0x194b('0x1e')],function(_0x2a6452){return{'model':db[_0x2a6452[_0x194b('0x1f')]],'as':_0x2a6452['as'],'attributes':_0x2a6452[_0x194b('0x1c')],'include':_0x2a6452['include']?_[_0x194b('0x20')](_0x2a6452['include'],function(_0x5f4cf0){return{'model':db[_0x5f4cf0[_0x194b('0x1f')]],'as':_0x5f4cf0['as'],'attributes':_0x5f4cf0[_0x194b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x194b('0xc')](function(_0x4a43ad){logger[_0x194b('0xd')]('GetDeskAccount',_0x39911c);logger[_0x194b('0xf')](_0x194b('0x17'),_0x39911c,JSON[_0x194b('0x11')](_0x4a43ad));_0x428444(_0x4a43ad);})[_0x194b('0x21')](function(_0x29e640){logger['error'](_0x194b('0x17'),_0x29e640[_0x194b('0x15')],_0x39911c);_0x1b60d9(_0x25ff05['error'](0x1f4,_0x29e640[_0x194b('0x15')]));});});};exports[_0x194b('0x22')]=function(_0x12cc56){var _0x29e747=this;return new Promise(function(_0x1c36d4,_0x41934d){return db['DeskAccount'][_0x194b('0x23')]({'raw':_0x12cc56[_0x194b('0x1a')]?_0x12cc56[_0x194b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x12cc56[_0x194b('0x1a')]?_0x12cc56[_0x194b('0x1a')][_0x194b('0x1b')]||null:null,'attributes':_0x12cc56['options']?_0x12cc56[_0x194b('0x1a')][_0x194b('0x1c')]||null:null,'include':_0x12cc56[_0x194b('0x1a')]?_0x12cc56[_0x194b('0x1a')][_0x194b('0x1e')]?_[_0x194b('0x20')](_0x12cc56[_0x194b('0x1a')]['include'],function(_0x37ee0e){return{'model':db[_0x37ee0e['model']],'as':_0x37ee0e['as'],'attributes':_0x37ee0e[_0x194b('0x1c')],'include':_0x37ee0e[_0x194b('0x1e')]?_[_0x194b('0x20')](_0x37ee0e[_0x194b('0x1e')],function(_0x2df10b){return{'model':db[_0x2df10b[_0x194b('0x1f')]],'as':_0x2df10b['as'],'attributes':_0x2df10b[_0x194b('0x1c')],'include':_0x2df10b[_0x194b('0x1e')]?_[_0x194b('0x20')](_0x2df10b[_0x194b('0x1e')],function(_0x15ce8a){return{'model':db[_0x15ce8a['model']],'as':_0x15ce8a['as'],'attributes':_0x15ce8a[_0x194b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x194b('0xc')](function(_0x58ca51){logger[_0x194b('0xd')]('ShowDeskAccount',_0x12cc56);logger['debug']('ShowDeskAccount',_0x12cc56,JSON['stringify'](_0x58ca51));_0x1c36d4(_0x58ca51);})[_0x194b('0x21')](function(_0x38c62c){logger['error']('ShowDeskAccount',_0x38c62c[_0x194b('0x15')],_0x12cc56);_0x41934d(_0x29e747['error'](0x1f4,_0x38c62c[_0x194b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index d7bc3c3..7ae07d5 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x119523,_0x44a800){var _0x3e47f6=function(_0x324bc1){while(--_0x324bc1){_0x119523['push'](_0x119523['shift']());}};_0x3e47f6(++_0x44a800);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +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(_0x233166,_0x54cd05){var _0x13ce9e=function(_0x135821){while(--_0x135821){_0x233166['push'](_0x233166['shift']());}};_0x13ce9e(++_0x54cd05);}(_0x34e8,0x12c));var _0x834e=function(_0x8cee09,_0x3fb5e9){_0x8cee09=_0x8cee09-0x0;var _0x3d6d77=_0x34e8[_0x8cee09];return _0x3d6d77;};'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 diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6da6d27..2e9322f 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 _0xefe2=['sequelize','STRING'];(function(_0x5923bf,_0x294af6){var _0xca02bc=function(_0x5cc3e0){while(--_0x5cc3e0){_0x5923bf['push'](_0x5923bf['shift']());}};_0xca02bc(++_0x294af6);}(_0xefe2,0x196));var _0x2efe=function(_0x3628b7,_0x3325be){_0x3628b7=_0x3628b7-0x0;var _0x6bce10=_0xefe2[_0x3628b7];return _0x6bce10;};'use strict';var Sequelize=require(_0x2efe('0x0'));module['exports']={'name':{'type':Sequelize[_0x2efe('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ec5=['STRING'];(function(_0x57e539,_0x36305c){var _0xe1b58b=function(_0x7423f8){while(--_0x7423f8){_0x57e539['push'](_0x57e539['shift']());}};_0xe1b58b(++_0x36305c);}(_0x8ec5,0x14a));var _0x58ec=function(_0x3e25ea,_0x41281a){_0x3e25ea=_0x3e25ea-0x0;var _0x164edc=_0x8ec5[_0x3e25ea];return _0x164edc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x58ec('0x0')]},'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 0de98aa..0678b97 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 _0xfcc9=['pick','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','getFields','findOne','DeskField','getSubjects'];(function(_0x3015ff,_0x1290e4){var _0x59b33a=function(_0x9950d7){while(--_0x9950d7){_0x3015ff['push'](_0x3015ff['shift']());}};_0x59b33a(++_0x1290e4);}(_0xfcc9,0xab));var _0x9fcc=function(_0x1182bd,_0x52ebf2){_0x1182bd=_0x1182bd-0x0;var _0x5c868b=_0xfcc9[_0x1182bd];return _0x5c868b;};'use strict';var emlformat=require(_0x9fcc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9fcc('0x1'));var jsonpatch=require(_0x9fcc('0x2'));var rp=require('request-promise');var moment=require(_0x9fcc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9fcc('0x4'));var util=require(_0x9fcc('0x5'));var path=require(_0x9fcc('0x6'));var sox=require(_0x9fcc('0x7'));var csv=require(_0x9fcc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fcc('0x9'));var _=require(_0x9fcc('0xa'));var squel=require(_0x9fcc('0xb'));var crypto=require(_0x9fcc('0xc'));var jsforce=require(_0x9fcc('0xd'));var deskjs=require(_0x9fcc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9fcc('0xf'));var Papa=require(_0x9fcc('0x10'));var Redis=require(_0x9fcc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9fcc('0x12'));var as=require(_0x9fcc('0x13'));var hardwareService=require(_0x9fcc('0x14'));var logger=require('../../config/logger')(_0x9fcc('0x15'));var utils=require(_0x9fcc('0x16'));var config=require(_0x9fcc('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x764f91,_0x2dc32a){_0x2dc32a=_0x2dc32a||0xcc;return function(_0x5c0f28){if(_0x5c0f28){return _0x764f91[_0x9fcc('0x18')](_0x2dc32a);}return _0x764f91[_0x9fcc('0x19')](_0x2dc32a)[_0x9fcc('0x1a')]();};}function respondWithResult(_0x13ad31,_0x1c7b43){_0x1c7b43=_0x1c7b43||0xc8;return function(_0xd5f41a){if(_0xd5f41a){return _0x13ad31['status'](_0x1c7b43)[_0x9fcc('0x1b')](_0xd5f41a);}};}function respondWithFilteredResult(_0x1889cf,_0x4f048e){return function(_0x529211){if(_0x529211){var _0x4424c0=typeof _0x4f048e[_0x9fcc('0x1c')]===_0x9fcc('0x1d')&&typeof _0x4f048e[_0x9fcc('0x1e')]==='undefined';var _0x366965=_0x529211[_0x9fcc('0x1f')];var _0x4bd395=_0x4424c0?0x0:_0x4f048e[_0x9fcc('0x1c')];var _0x1c9d37=_0x4424c0?_0x529211[_0x9fcc('0x1f')]:_0x4f048e['offset']+_0x4f048e['limit'];var _0x5cadec;if(_0x1c9d37>=_0x366965){_0x1c9d37=_0x366965;_0x5cadec=0xc8;}else{_0x5cadec=0xce;}_0x1889cf[_0x9fcc('0x19')](_0x5cadec);return _0x1889cf['set'](_0x9fcc('0x20'),_0x4bd395+'-'+_0x1c9d37+'/'+_0x366965)['json'](_0x529211);}return null;};}function patchUpdates(_0x473ad8){return function(_0x174b6a){try{jsonpatch[_0x9fcc('0x21')](_0x174b6a,_0x473ad8,!![]);}catch(_0x52992d){return BPromise[_0x9fcc('0x22')](_0x52992d);}return _0x174b6a[_0x9fcc('0x23')]();};}function saveUpdates(_0x130b33,_0x14c7d7){return function(_0x10ece4){if(_0x10ece4){return _0x10ece4[_0x9fcc('0x24')](_0x130b33)[_0x9fcc('0x25')](function(_0xf79e13){return _0xf79e13;});}return null;};}function removeEntity(_0x50611c,_0xce3b49){return function(_0x241cc2){if(_0x241cc2){return _0x241cc2[_0x9fcc('0x26')]()['then'](function(){_0x50611c['status'](0xcc)[_0x9fcc('0x1a')]();});}};}function handleEntityNotFound(_0xf3bcae,_0x317abb){return function(_0x3104e6){if(!_0x3104e6){_0xf3bcae['sendStatus'](0x194);}return _0x3104e6;};}function handleError(_0x46cb27,_0x4f0c45){_0x4f0c45=_0x4f0c45||0x1f4;return function(_0xd51860){logger['error'](_0xd51860[_0x9fcc('0x27')]);if(_0xd51860[_0x9fcc('0x28')]){delete _0xd51860['name'];}_0x46cb27[_0x9fcc('0x19')](_0x4f0c45)[_0x9fcc('0x29')](_0xd51860);};}exports['index']=function(_0x2cc273,_0x422ab8){var _0x460f6c={},_0x1aa240={},_0x376e09={'count':0x0,'rows':[]};var _0xd391d9=_[_0x9fcc('0x2a')](db[_0x9fcc('0x2b')][_0x9fcc('0x2c')],function(_0x1ee813){return{'name':_0x1ee813[_0x9fcc('0x2d')],'type':_0x1ee813[_0x9fcc('0x2e')]['key']};});_0x1aa240[_0x9fcc('0x2f')]=_[_0x9fcc('0x2a')](_0xd391d9,_0x9fcc('0x28'));_0x1aa240[_0x9fcc('0x30')]=_[_0x9fcc('0x31')](_0x2cc273[_0x9fcc('0x30')]);_0x1aa240[_0x9fcc('0x32')]=_[_0x9fcc('0x33')](_0x1aa240[_0x9fcc('0x2f')],_0x1aa240[_0x9fcc('0x30')]);_0x460f6c['attributes']=_['intersection'](_0x1aa240[_0x9fcc('0x2f')],qs[_0x9fcc('0x34')](_0x2cc273['query'][_0x9fcc('0x34')]));_0x460f6c[_0x9fcc('0x35')]=_0x460f6c[_0x9fcc('0x35')][_0x9fcc('0x36')]?_0x460f6c[_0x9fcc('0x35')]:_0x1aa240['model'];if(!_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x37')](_0x9fcc('0x38'))){_0x460f6c['limit']=qs[_0x9fcc('0x1e')](_0x2cc273[_0x9fcc('0x30')]['limit']);_0x460f6c[_0x9fcc('0x1c')]=qs['offset'](_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x1c')]);}_0x460f6c[_0x9fcc('0x39')]=qs[_0x9fcc('0x3a')](_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x3a')]);_0x460f6c[_0x9fcc('0x3b')]=qs[_0x9fcc('0x32')](_['pick'](_0x2cc273[_0x9fcc('0x30')],_0x1aa240[_0x9fcc('0x32')]),_0xd391d9);if(_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x3c')]){_0x460f6c['where']=_[_0x9fcc('0x3d')](_0x460f6c['where'],{'$or':_[_0x9fcc('0x2a')](_0xd391d9,function(_0x4eb8da){if(_0x4eb8da[_0x9fcc('0x2e')]!==_0x9fcc('0x3e')){var _0x10eb28={};_0x10eb28[_0x4eb8da[_0x9fcc('0x28')]]={'$like':'%'+_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x3c')]+'%'};return _0x10eb28;}})});}_0x460f6c=_[_0x9fcc('0x3d')]({},_0x460f6c,_0x2cc273['options']);var _0xa2c6c1={'where':_0x460f6c[_0x9fcc('0x3b')]};return db[_0x9fcc('0x2b')][_0x9fcc('0x1f')](_0xa2c6c1)[_0x9fcc('0x25')](function(_0x588049){_0x376e09[_0x9fcc('0x1f')]=_0x588049;if(_0x2cc273[_0x9fcc('0x30')][_0x9fcc('0x3f')]){_0x460f6c[_0x9fcc('0x40')]=[{'all':!![]}];}return db[_0x9fcc('0x2b')][_0x9fcc('0x41')](_0x460f6c);})[_0x9fcc('0x25')](function(_0x2fcbc4){_0x376e09[_0x9fcc('0x42')]=_0x2fcbc4;return _0x376e09;})[_0x9fcc('0x25')](respondWithFilteredResult(_0x422ab8,_0x460f6c))[_0x9fcc('0x43')](handleError(_0x422ab8,null));};exports[_0x9fcc('0x44')]=function(_0x4b5d3a,_0x1e8a95){var _0x15d126={'raw':![],'where':{'id':_0x4b5d3a['params']['id']}},_0x348ba8={};_0x348ba8[_0x9fcc('0x2f')]=_[_0x9fcc('0x31')](db[_0x9fcc('0x2b')][_0x9fcc('0x2c')]);_0x348ba8[_0x9fcc('0x30')]=_[_0x9fcc('0x31')](_0x4b5d3a[_0x9fcc('0x30')]);_0x348ba8['filters']=_['intersection'](_0x348ba8[_0x9fcc('0x2f')],_0x348ba8[_0x9fcc('0x30')]);_0x15d126[_0x9fcc('0x35')]=_['intersection'](_0x348ba8[_0x9fcc('0x2f')],qs[_0x9fcc('0x34')](_0x4b5d3a['query'][_0x9fcc('0x34')]));_0x15d126[_0x9fcc('0x35')]=_0x15d126[_0x9fcc('0x35')][_0x9fcc('0x36')]?_0x15d126['attributes']:_0x348ba8[_0x9fcc('0x2f')];if(_0x4b5d3a[_0x9fcc('0x30')][_0x9fcc('0x3f')]){_0x15d126['include']=[{'all':!![]}];}_0x15d126=_['merge']({},_0x15d126,_0x4b5d3a[_0x9fcc('0x45')]);return db['DeskConfiguration'][_0x9fcc('0x46')](_0x15d126)[_0x9fcc('0x25')](handleEntityNotFound(_0x1e8a95,null))[_0x9fcc('0x25')](respondWithResult(_0x1e8a95,null))[_0x9fcc('0x43')](handleError(_0x1e8a95,null));};exports[_0x9fcc('0x47')]=function(_0x43518d,_0x2038da){return db[_0x9fcc('0x2b')][_0x9fcc('0x47')](_0x43518d[_0x9fcc('0x48')],{})[_0x9fcc('0x25')](respondWithResult(_0x2038da,0xc9))[_0x9fcc('0x43')](handleError(_0x2038da,null));};exports[_0x9fcc('0x24')]=function(_0x4e89a6,_0x2a5499){if(_0x4e89a6[_0x9fcc('0x48')]['id']){delete _0x4e89a6[_0x9fcc('0x48')]['id'];}return db[_0x9fcc('0x2b')]['find']({'where':{'id':_0x4e89a6[_0x9fcc('0x49')]['id']}})['then'](handleEntityNotFound(_0x2a5499,null))[_0x9fcc('0x25')](saveUpdates(_0x4e89a6[_0x9fcc('0x48')],null))['then'](respondWithResult(_0x2a5499,null))['catch'](handleError(_0x2a5499,null));};exports[_0x9fcc('0x26')]=function(_0x301751,_0x3eb2c2){return db[_0x9fcc('0x2b')]['find']({'where':{'id':_0x301751[_0x9fcc('0x49')]['id']}})[_0x9fcc('0x25')](handleEntityNotFound(_0x3eb2c2,null))[_0x9fcc('0x25')](removeEntity(_0x3eb2c2,null))['catch'](handleError(_0x3eb2c2,null));};exports[_0x9fcc('0x4a')]=function(_0x811da7,_0x49b223,_0x5ce701){var _0x2f504c={};var _0x3f0508={};var _0x46d7a6;var _0x4866f7;return db[_0x9fcc('0x2b')][_0x9fcc('0x4b')]({'where':{'id':_0x811da7['params']['id']}})['then'](handleEntityNotFound(_0x49b223,null))['then'](function(_0x2a01e1){if(_0x2a01e1){_0x46d7a6=_0x2a01e1;_0x3f0508[_0x9fcc('0x2f')]=_[_0x9fcc('0x31')](db[_0x9fcc('0x4c')][_0x9fcc('0x2c')]);_0x3f0508['query']=_['keys'](_0x811da7[_0x9fcc('0x30')]);_0x3f0508[_0x9fcc('0x32')]=_[_0x9fcc('0x33')](_0x3f0508[_0x9fcc('0x2f')],_0x3f0508['query']);_0x2f504c[_0x9fcc('0x35')]=_[_0x9fcc('0x33')](_0x3f0508['model'],qs[_0x9fcc('0x34')](_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x34')]));_0x2f504c[_0x9fcc('0x35')]=_0x2f504c['attributes'][_0x9fcc('0x36')]?_0x2f504c[_0x9fcc('0x35')]:_0x3f0508[_0x9fcc('0x2f')];_0x2f504c[_0x9fcc('0x39')]=qs[_0x9fcc('0x3a')](_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x3a')]);_0x2f504c['where']=qs[_0x9fcc('0x32')](_['pick'](_0x811da7[_0x9fcc('0x30')],_0x3f0508[_0x9fcc('0x32')]));if(_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x3c')]){_0x2f504c[_0x9fcc('0x3b')]=_[_0x9fcc('0x3d')](_0x2f504c[_0x9fcc('0x3b')],{'$or':_[_0x9fcc('0x2a')](_0x2f504c[_0x9fcc('0x35')],function(_0x4f4d68){var _0x400f89={};_0x400f89[_0x4f4d68]={'$like':'%'+_0x811da7['query']['filter']+'%'};return _0x400f89;})});}_0x2f504c=_[_0x9fcc('0x3d')]({},_0x2f504c,_0x811da7[_0x9fcc('0x45')]);return _0x46d7a6['getFields'](_0x2f504c);}})[_0x9fcc('0x25')](function(_0x5bf9d9){if(_0x5bf9d9){_0x4866f7=_0x5bf9d9[_0x9fcc('0x36')];if(!_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x37')]('nolimit')){_0x2f504c[_0x9fcc('0x1e')]=qs[_0x9fcc('0x1e')](_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x1e')]);_0x2f504c[_0x9fcc('0x1c')]=qs[_0x9fcc('0x1c')](_0x811da7[_0x9fcc('0x30')][_0x9fcc('0x1c')]);}return _0x46d7a6['getFields'](_0x2f504c);}})[_0x9fcc('0x25')](function(_0x2c8124){if(_0x2c8124){return _0x2c8124?{'count':_0x4866f7,'rows':_0x2c8124}:null;}})[_0x9fcc('0x25')](respondWithResult(_0x49b223,null))[_0x9fcc('0x43')](handleError(_0x49b223,null));};exports[_0x9fcc('0x4d')]=function(_0x542d30,_0x860d78,_0x3ba40b){var _0x331b8c={};var _0xdc1ff8={};var _0x5d9a00;var _0x32bf36;return db['DeskConfiguration'][_0x9fcc('0x4b')]({'where':{'id':_0x542d30[_0x9fcc('0x49')]['id']}})[_0x9fcc('0x25')](handleEntityNotFound(_0x860d78,null))['then'](function(_0x3edf7e){if(_0x3edf7e){_0x5d9a00=_0x3edf7e;_0xdc1ff8[_0x9fcc('0x2f')]=_[_0x9fcc('0x31')](db[_0x9fcc('0x4c')][_0x9fcc('0x2c')]);_0xdc1ff8[_0x9fcc('0x30')]=_['keys'](_0x542d30['query']);_0xdc1ff8[_0x9fcc('0x32')]=_['intersection'](_0xdc1ff8[_0x9fcc('0x2f')],_0xdc1ff8[_0x9fcc('0x30')]);_0x331b8c[_0x9fcc('0x35')]=_['intersection'](_0xdc1ff8[_0x9fcc('0x2f')],qs['fields'](_0x542d30[_0x9fcc('0x30')][_0x9fcc('0x34')]));_0x331b8c[_0x9fcc('0x35')]=_0x331b8c[_0x9fcc('0x35')][_0x9fcc('0x36')]?_0x331b8c['attributes']:_0xdc1ff8[_0x9fcc('0x2f')];_0x331b8c[_0x9fcc('0x39')]=qs[_0x9fcc('0x3a')](_0x542d30[_0x9fcc('0x30')][_0x9fcc('0x3a')]);_0x331b8c[_0x9fcc('0x3b')]=qs[_0x9fcc('0x32')](_[_0x9fcc('0x4e')](_0x542d30[_0x9fcc('0x30')],_0xdc1ff8['filters']));if(_0x542d30[_0x9fcc('0x30')][_0x9fcc('0x3c')]){_0x331b8c[_0x9fcc('0x3b')]=_[_0x9fcc('0x3d')](_0x331b8c[_0x9fcc('0x3b')],{'$or':_[_0x9fcc('0x2a')](_0x331b8c[_0x9fcc('0x35')],function(_0x2ad1c8){var _0xa452b={};_0xa452b[_0x2ad1c8]={'$like':'%'+_0x542d30[_0x9fcc('0x30')][_0x9fcc('0x3c')]+'%'};return _0xa452b;})});}_0x331b8c=_[_0x9fcc('0x3d')]({},_0x331b8c,_0x542d30['options']);return _0x5d9a00[_0x9fcc('0x4d')](_0x331b8c);}})[_0x9fcc('0x25')](function(_0x147851){if(_0x147851){_0x32bf36=_0x147851[_0x9fcc('0x36')];if(!_0x542d30['query'][_0x9fcc('0x37')]('nolimit')){_0x331b8c[_0x9fcc('0x1e')]=qs[_0x9fcc('0x1e')](_0x542d30[_0x9fcc('0x30')]['limit']);_0x331b8c[_0x9fcc('0x1c')]=qs[_0x9fcc('0x1c')](_0x542d30[_0x9fcc('0x30')]['offset']);}return _0x5d9a00['getSubjects'](_0x331b8c);}})[_0x9fcc('0x25')](function(_0x2ac288){if(_0x2ac288){return _0x2ac288?{'count':_0x32bf36,'rows':_0x2ac288}:null;}})[_0x9fcc('0x25')](respondWithResult(_0x860d78,null))[_0x9fcc('0x43')](handleError(_0x860d78,null));};exports[_0x9fcc('0x4f')]=function(_0x17d678,_0x196f60,_0xcbca4a){var _0x389ff2={};var _0x5108de={};var _0x4740aa;var _0x4e579d;return db[_0x9fcc('0x2b')]['findOne']({'where':{'id':_0x17d678[_0x9fcc('0x49')]['id']}})['then'](handleEntityNotFound(_0x196f60,null))[_0x9fcc('0x25')](function(_0x51ff08){if(_0x51ff08){_0x4740aa=_0x51ff08;_0x5108de[_0x9fcc('0x2f')]=_[_0x9fcc('0x31')](db['DeskField'][_0x9fcc('0x2c')]);_0x5108de[_0x9fcc('0x30')]=_[_0x9fcc('0x31')](_0x17d678[_0x9fcc('0x30')]);_0x5108de[_0x9fcc('0x32')]=_['intersection'](_0x5108de[_0x9fcc('0x2f')],_0x5108de[_0x9fcc('0x30')]);_0x389ff2[_0x9fcc('0x35')]=_[_0x9fcc('0x33')](_0x5108de[_0x9fcc('0x2f')],qs['fields'](_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x34')]));_0x389ff2[_0x9fcc('0x35')]=_0x389ff2['attributes'][_0x9fcc('0x36')]?_0x389ff2[_0x9fcc('0x35')]:_0x5108de[_0x9fcc('0x2f')];_0x389ff2[_0x9fcc('0x39')]=qs[_0x9fcc('0x3a')](_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x3a')]);_0x389ff2[_0x9fcc('0x3b')]=qs[_0x9fcc('0x32')](_[_0x9fcc('0x4e')](_0x17d678[_0x9fcc('0x30')],_0x5108de[_0x9fcc('0x32')]));if(_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x3c')]){_0x389ff2[_0x9fcc('0x3b')]=_[_0x9fcc('0x3d')](_0x389ff2['where'],{'$or':_[_0x9fcc('0x2a')](_0x389ff2['attributes'],function(_0x5f1678){var _0x5637cf={};_0x5637cf[_0x5f1678]={'$like':'%'+_0x17d678['query']['filter']+'%'};return _0x5637cf;})});}_0x389ff2=_[_0x9fcc('0x3d')]({},_0x389ff2,_0x17d678['options']);return _0x4740aa['getDescriptions'](_0x389ff2);}})[_0x9fcc('0x25')](function(_0x5d44ea){if(_0x5d44ea){_0x4e579d=_0x5d44ea[_0x9fcc('0x36')];if(!_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x37')]('nolimit')){_0x389ff2[_0x9fcc('0x1e')]=qs[_0x9fcc('0x1e')](_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x1e')]);_0x389ff2[_0x9fcc('0x1c')]=qs[_0x9fcc('0x1c')](_0x17d678[_0x9fcc('0x30')][_0x9fcc('0x1c')]);}return _0x4740aa[_0x9fcc('0x4f')](_0x389ff2);}})[_0x9fcc('0x25')](function(_0x545895){if(_0x545895){return _0x545895?{'count':_0x4e579d,'rows':_0x545895}:null;}})[_0x9fcc('0x25')](respondWithResult(_0x196f60,null))[_0x9fcc('0x43')](handleError(_0x196f60,null));};exports[_0x9fcc('0x50')]=function(_0x354ad8,_0x31318d,_0x49843c){var _0x4292e8={};var _0x19f475={};var _0x2c5687;var _0x4db029;return db[_0x9fcc('0x2b')][_0x9fcc('0x4b')]({'where':{'id':_0x354ad8[_0x9fcc('0x49')]['id']}})[_0x9fcc('0x25')](handleEntityNotFound(_0x31318d,null))[_0x9fcc('0x25')](function(_0x3f1385){if(_0x3f1385){_0x2c5687=_0x3f1385;_0x19f475[_0x9fcc('0x2f')]=_[_0x9fcc('0x31')](db['Tag'][_0x9fcc('0x2c')]);_0x19f475[_0x9fcc('0x30')]=_[_0x9fcc('0x31')](_0x354ad8[_0x9fcc('0x30')]);_0x19f475[_0x9fcc('0x32')]=_[_0x9fcc('0x33')](_0x19f475[_0x9fcc('0x2f')],_0x19f475[_0x9fcc('0x30')]);_0x4292e8[_0x9fcc('0x35')]=_[_0x9fcc('0x33')](_0x19f475['model'],qs[_0x9fcc('0x34')](_0x354ad8[_0x9fcc('0x30')][_0x9fcc('0x34')]));_0x4292e8[_0x9fcc('0x35')]=_0x4292e8[_0x9fcc('0x35')][_0x9fcc('0x36')]?_0x4292e8['attributes']:_0x19f475[_0x9fcc('0x2f')];_0x4292e8[_0x9fcc('0x39')]=qs[_0x9fcc('0x3a')](_0x354ad8[_0x9fcc('0x30')][_0x9fcc('0x3a')]);_0x4292e8['where']=qs['filters'](_[_0x9fcc('0x4e')](_0x354ad8[_0x9fcc('0x30')],_0x19f475['filters']));if(_0x354ad8[_0x9fcc('0x30')][_0x9fcc('0x3c')]){_0x4292e8[_0x9fcc('0x3b')]=_['merge'](_0x4292e8[_0x9fcc('0x3b')],{'$or':_[_0x9fcc('0x2a')](_0x4292e8[_0x9fcc('0x35')],function(_0x46e9d8){var _0x477be0={};_0x477be0[_0x46e9d8]={'$like':'%'+_0x354ad8[_0x9fcc('0x30')][_0x9fcc('0x3c')]+'%'};return _0x477be0;})});}_0x4292e8=_[_0x9fcc('0x3d')]({},_0x4292e8,_0x354ad8[_0x9fcc('0x45')]);return _0x2c5687['getTags'](_0x4292e8);}})['then'](function(_0x1667c8){if(_0x1667c8){_0x4db029=_0x1667c8[_0x9fcc('0x36')];if(!_0x354ad8[_0x9fcc('0x30')][_0x9fcc('0x37')]('nolimit')){_0x4292e8[_0x9fcc('0x1e')]=qs['limit'](_0x354ad8['query']['limit']);_0x4292e8['offset']=qs[_0x9fcc('0x1c')](_0x354ad8[_0x9fcc('0x30')]['offset']);}return _0x2c5687[_0x9fcc('0x50')](_0x4292e8);}})['then'](function(_0x5d0d9f){if(_0x5d0d9f){return _0x5d0d9f?{'count':_0x4db029,'rows':_0x5d0d9f}:null;}})[_0x9fcc('0x25')](respondWithResult(_0x31318d,null))[_0x9fcc('0x43')](handleError(_0x31318d,null));};exports[_0x9fcc('0x51')]=function(_0x460cdb,_0x1a5881,_0x43ab05){if(_0x460cdb[_0x9fcc('0x48')]['id']){delete _0x460cdb[_0x9fcc('0x48')]['id'];}return db[_0x9fcc('0x2b')]['findOne']({'where':{'id':_0x460cdb[_0x9fcc('0x49')]['id']}})[_0x9fcc('0x25')](handleEntityNotFound(_0x1a5881,null))[_0x9fcc('0x25')](function(_0x21e04c){if(_0x21e04c){return _0x21e04c[_0x9fcc('0x51')](_0x460cdb['body'][_0x9fcc('0x52')]||[]);}return null;})['then'](respondWithResult(_0x1a5881,null))[_0x9fcc('0x43')](handleError(_0x1a5881,null));}; \ No newline at end of file +var _0x5534=['status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','params','includeAll','include','find','create','body','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x644b8,_0xbf002e){var _0x56a4fe=function(_0x2292fd){while(--_0x2292fd){_0x644b8['push'](_0x644b8['shift']());}};_0x56a4fe(++_0xbf002e);}(_0x5534,0x172));var _0x4553=function(_0x2eddf4,_0x17cef3){_0x2eddf4=_0x2eddf4-0x0;var _0x1cd4f9=_0x5534[_0x2eddf4];return _0x1cd4f9;};'use strict';var emlformat=require(_0x4553('0x0'));var rimraf=require(_0x4553('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4553('0x2'));var util=require(_0x4553('0x3'));var path=require(_0x4553('0x4'));var sox=require(_0x4553('0x5'));var csv=require(_0x4553('0x6'));var ejs=require(_0x4553('0x7'));var fs=require('fs');var fs_extra=require(_0x4553('0x8'));var _=require(_0x4553('0x9'));var squel=require('squel');var crypto=require(_0x4553('0xa'));var jsforce=require(_0x4553('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4553('0x6'));var querystring=require(_0x4553('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4553('0xd'));var qs=require(_0x4553('0xe'));var as=require(_0x4553('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4553('0x10'))(_0x4553('0x11'));var utils=require('../../config/utils');var config=require(_0x4553('0x12'));var licenseUtil=require(_0x4553('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x237ea0,_0x190a87){_0x190a87=_0x190a87||0xcc;return function(_0x1d0c29){if(_0x1d0c29){return _0x237ea0['sendStatus'](_0x190a87);}return _0x237ea0[_0x4553('0x14')](_0x190a87)[_0x4553('0x15')]();};}function respondWithResult(_0x49b3d4,_0x44f436){_0x44f436=_0x44f436||0xc8;return function(_0x5947c5){if(_0x5947c5){return _0x49b3d4[_0x4553('0x14')](_0x44f436)['json'](_0x5947c5);}};}function respondWithFilteredResult(_0x42c2a5,_0x30181e){return function(_0x442ab2){if(_0x442ab2){var _0x16bdf9=typeof _0x30181e[_0x4553('0x16')]===_0x4553('0x17')&&typeof _0x30181e[_0x4553('0x18')]===_0x4553('0x17');var _0x10e6b6=_0x442ab2[_0x4553('0x19')];var _0x27ead3=_0x16bdf9?0x0:_0x30181e[_0x4553('0x16')];var _0x4b514c=_0x16bdf9?_0x442ab2[_0x4553('0x19')]:_0x30181e[_0x4553('0x16')]+_0x30181e['limit'];var _0x50954c;if(_0x4b514c>=_0x10e6b6){_0x4b514c=_0x10e6b6;_0x50954c=0xc8;}else{_0x50954c=0xce;}_0x42c2a5[_0x4553('0x14')](_0x50954c);return _0x42c2a5[_0x4553('0x1a')](_0x4553('0x1b'),_0x27ead3+'-'+_0x4b514c+'/'+_0x10e6b6)[_0x4553('0x1c')](_0x442ab2);}return null;};}function patchUpdates(_0x11c55d){return function(_0x44b226){try{jsonpatch['apply'](_0x44b226,_0x11c55d,!![]);}catch(_0x2d93b2){return BPromise['reject'](_0x2d93b2);}return _0x44b226['save']();};}function saveUpdates(_0x494e65,_0x1a3a01){return function(_0x3904e4){if(_0x3904e4){return _0x3904e4[_0x4553('0x1d')](_0x494e65)[_0x4553('0x1e')](function(_0x66b8be){return _0x66b8be;});}return null;};}function removeEntity(_0x546179,_0x3f335c){return function(_0x175a74){if(_0x175a74){return _0x175a74[_0x4553('0x1f')]()[_0x4553('0x1e')](function(){_0x546179[_0x4553('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bf7c,_0x77f1c5){return function(_0x5ebd0b){if(!_0x5ebd0b){_0x29bf7c['sendStatus'](0x194);}return _0x5ebd0b;};}function handleError(_0x1d5654,_0x5a55fa){_0x5a55fa=_0x5a55fa||0x1f4;return function(_0x3fef95){logger[_0x4553('0x20')](_0x3fef95[_0x4553('0x21')]);if(_0x3fef95[_0x4553('0x22')]){delete _0x3fef95[_0x4553('0x22')];}_0x1d5654[_0x4553('0x14')](_0x5a55fa)[_0x4553('0x23')](_0x3fef95);};}exports[_0x4553('0x24')]=function(_0x4e8bad,_0x3b313f){var _0x398e99={},_0x32f559={},_0x5345e9={'count':0x0,'rows':[]};var _0x3ec6d0=_[_0x4553('0x25')](db[_0x4553('0x26')][_0x4553('0x27')],function(_0x4f7a8a){return{'name':_0x4f7a8a[_0x4553('0x28')],'type':_0x4f7a8a[_0x4553('0x29')][_0x4553('0x2a')]};});_0x32f559[_0x4553('0x2b')]=_[_0x4553('0x25')](_0x3ec6d0,_0x4553('0x22'));_0x32f559['query']=_[_0x4553('0x2c')](_0x4e8bad['query']);_0x32f559[_0x4553('0x2d')]=_[_0x4553('0x2e')](_0x32f559[_0x4553('0x2b')],_0x32f559[_0x4553('0x2f')]);_0x398e99['attributes']=_[_0x4553('0x2e')](_0x32f559[_0x4553('0x2b')],qs[_0x4553('0x30')](_0x4e8bad[_0x4553('0x2f')]['fields']));_0x398e99[_0x4553('0x31')]=_0x398e99[_0x4553('0x31')][_0x4553('0x32')]?_0x398e99[_0x4553('0x31')]:_0x32f559['model'];if(!_0x4e8bad['query'][_0x4553('0x33')](_0x4553('0x34'))){_0x398e99[_0x4553('0x18')]=qs[_0x4553('0x18')](_0x4e8bad[_0x4553('0x2f')][_0x4553('0x18')]);_0x398e99[_0x4553('0x16')]=qs[_0x4553('0x16')](_0x4e8bad[_0x4553('0x2f')][_0x4553('0x16')]);}_0x398e99[_0x4553('0x35')]=qs[_0x4553('0x36')](_0x4e8bad['query'][_0x4553('0x36')]);_0x398e99[_0x4553('0x37')]=qs['filters'](_[_0x4553('0x38')](_0x4e8bad[_0x4553('0x2f')],_0x32f559[_0x4553('0x2d')]),_0x3ec6d0);if(_0x4e8bad[_0x4553('0x2f')][_0x4553('0x39')]){_0x398e99['where']=_[_0x4553('0x3a')](_0x398e99[_0x4553('0x37')],{'$or':_[_0x4553('0x25')](_0x3ec6d0,function(_0x33c9d0){if(_0x33c9d0[_0x4553('0x29')]!==_0x4553('0x3b')){var _0x8935e6={};_0x8935e6[_0x33c9d0[_0x4553('0x22')]]={'$like':'%'+_0x4e8bad[_0x4553('0x2f')][_0x4553('0x39')]+'%'};return _0x8935e6;}})});}_0x398e99=_['merge']({},_0x398e99,_0x4e8bad[_0x4553('0x3c')]);var _0x3800f3={'where':_0x398e99[_0x4553('0x37')]};return db[_0x4553('0x26')][_0x4553('0x19')](_0x3800f3)[_0x4553('0x1e')](function(_0x106a21){_0x5345e9[_0x4553('0x19')]=_0x106a21;if(_0x4e8bad[_0x4553('0x2f')]['includeAll']){_0x398e99['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x398e99);})['then'](function(_0x3c4e36){_0x5345e9[_0x4553('0x3d')]=_0x3c4e36;return _0x5345e9;})[_0x4553('0x1e')](respondWithFilteredResult(_0x3b313f,_0x398e99))[_0x4553('0x3e')](handleError(_0x3b313f,null));};exports[_0x4553('0x3f')]=function(_0x2362f0,_0x491c3d){var _0x6d2b94={'raw':![],'where':{'id':_0x2362f0[_0x4553('0x40')]['id']}},_0x535803={};_0x535803[_0x4553('0x2b')]=_['keys'](db[_0x4553('0x26')][_0x4553('0x27')]);_0x535803[_0x4553('0x2f')]=_[_0x4553('0x2c')](_0x2362f0[_0x4553('0x2f')]);_0x535803['filters']=_['intersection'](_0x535803[_0x4553('0x2b')],_0x535803[_0x4553('0x2f')]);_0x6d2b94[_0x4553('0x31')]=_[_0x4553('0x2e')](_0x535803[_0x4553('0x2b')],qs[_0x4553('0x30')](_0x2362f0['query'][_0x4553('0x30')]));_0x6d2b94[_0x4553('0x31')]=_0x6d2b94[_0x4553('0x31')][_0x4553('0x32')]?_0x6d2b94['attributes']:_0x535803['model'];if(_0x2362f0[_0x4553('0x2f')][_0x4553('0x41')]){_0x6d2b94[_0x4553('0x42')]=[{'all':!![]}];}_0x6d2b94=_['merge']({},_0x6d2b94,_0x2362f0[_0x4553('0x3c')]);return db[_0x4553('0x26')][_0x4553('0x43')](_0x6d2b94)[_0x4553('0x1e')](handleEntityNotFound(_0x491c3d,null))[_0x4553('0x1e')](respondWithResult(_0x491c3d,null))['catch'](handleError(_0x491c3d,null));};exports[_0x4553('0x44')]=function(_0x452be7,_0x4df1cc){return db[_0x4553('0x26')]['create'](_0x452be7[_0x4553('0x45')],{})['then'](respondWithResult(_0x4df1cc,0xc9))[_0x4553('0x3e')](handleError(_0x4df1cc,null));};exports['update']=function(_0x199146,_0x2bd5cb){if(_0x199146[_0x4553('0x45')]['id']){delete _0x199146[_0x4553('0x45')]['id'];}return db[_0x4553('0x26')][_0x4553('0x43')]({'where':{'id':_0x199146[_0x4553('0x40')]['id']}})['then'](handleEntityNotFound(_0x2bd5cb,null))[_0x4553('0x1e')](saveUpdates(_0x199146[_0x4553('0x45')],null))['then'](respondWithResult(_0x2bd5cb,null))['catch'](handleError(_0x2bd5cb,null));};exports[_0x4553('0x1f')]=function(_0x23fcf3,_0x2369de){return db['DeskConfiguration']['find']({'where':{'id':_0x23fcf3[_0x4553('0x40')]['id']}})[_0x4553('0x1e')](handleEntityNotFound(_0x2369de,null))[_0x4553('0x1e')](removeEntity(_0x2369de,null))[_0x4553('0x3e')](handleError(_0x2369de,null));};exports[_0x4553('0x46')]=function(_0x52f4de,_0x588aaf,_0x5f3645){var _0x11f405={};var _0x37ab5a={};var _0x5ba439;var _0x46304e;return db[_0x4553('0x26')]['findOne']({'where':{'id':_0x52f4de[_0x4553('0x40')]['id']}})[_0x4553('0x1e')](handleEntityNotFound(_0x588aaf,null))[_0x4553('0x1e')](function(_0x396113){if(_0x396113){_0x5ba439=_0x396113;_0x37ab5a['model']=_[_0x4553('0x2c')](db[_0x4553('0x47')][_0x4553('0x27')]);_0x37ab5a[_0x4553('0x2f')]=_[_0x4553('0x2c')](_0x52f4de[_0x4553('0x2f')]);_0x37ab5a[_0x4553('0x2d')]=_[_0x4553('0x2e')](_0x37ab5a[_0x4553('0x2b')],_0x37ab5a[_0x4553('0x2f')]);_0x11f405[_0x4553('0x31')]=_[_0x4553('0x2e')](_0x37ab5a[_0x4553('0x2b')],qs[_0x4553('0x30')](_0x52f4de[_0x4553('0x2f')][_0x4553('0x30')]));_0x11f405['attributes']=_0x11f405[_0x4553('0x31')][_0x4553('0x32')]?_0x11f405[_0x4553('0x31')]:_0x37ab5a[_0x4553('0x2b')];_0x11f405['order']=qs[_0x4553('0x36')](_0x52f4de[_0x4553('0x2f')][_0x4553('0x36')]);_0x11f405[_0x4553('0x37')]=qs['filters'](_[_0x4553('0x38')](_0x52f4de[_0x4553('0x2f')],_0x37ab5a[_0x4553('0x2d')]));if(_0x52f4de[_0x4553('0x2f')][_0x4553('0x39')]){_0x11f405[_0x4553('0x37')]=_['merge'](_0x11f405[_0x4553('0x37')],{'$or':_['map'](_0x11f405[_0x4553('0x31')],function(_0x931441){var _0x8f99cb={};_0x8f99cb[_0x931441]={'$like':'%'+_0x52f4de[_0x4553('0x2f')][_0x4553('0x39')]+'%'};return _0x8f99cb;})});}_0x11f405=_[_0x4553('0x3a')]({},_0x11f405,_0x52f4de['options']);return _0x5ba439[_0x4553('0x46')](_0x11f405);}})[_0x4553('0x1e')](function(_0x420bf3){if(_0x420bf3){_0x46304e=_0x420bf3[_0x4553('0x32')];if(!_0x52f4de[_0x4553('0x2f')][_0x4553('0x33')](_0x4553('0x34'))){_0x11f405[_0x4553('0x18')]=qs[_0x4553('0x18')](_0x52f4de['query'][_0x4553('0x18')]);_0x11f405[_0x4553('0x16')]=qs[_0x4553('0x16')](_0x52f4de['query'][_0x4553('0x16')]);}return _0x5ba439['getFields'](_0x11f405);}})[_0x4553('0x1e')](function(_0x3ea312){if(_0x3ea312){return _0x3ea312?{'count':_0x46304e,'rows':_0x3ea312}:null;}})[_0x4553('0x1e')](respondWithResult(_0x588aaf,null))[_0x4553('0x3e')](handleError(_0x588aaf,null));};exports[_0x4553('0x48')]=function(_0x1b0f62,_0x115a36,_0x89c93f){var _0x2fe3b9={};var _0x39a573={};var _0x4e205d;var _0x410057;return db['DeskConfiguration'][_0x4553('0x49')]({'where':{'id':_0x1b0f62[_0x4553('0x40')]['id']}})[_0x4553('0x1e')](handleEntityNotFound(_0x115a36,null))[_0x4553('0x1e')](function(_0x17ff63){if(_0x17ff63){_0x4e205d=_0x17ff63;_0x39a573[_0x4553('0x2b')]=_[_0x4553('0x2c')](db['DeskField']['rawAttributes']);_0x39a573[_0x4553('0x2f')]=_['keys'](_0x1b0f62[_0x4553('0x2f')]);_0x39a573[_0x4553('0x2d')]=_['intersection'](_0x39a573['model'],_0x39a573[_0x4553('0x2f')]);_0x2fe3b9['attributes']=_[_0x4553('0x2e')](_0x39a573['model'],qs[_0x4553('0x30')](_0x1b0f62[_0x4553('0x2f')][_0x4553('0x30')]));_0x2fe3b9['attributes']=_0x2fe3b9[_0x4553('0x31')]['length']?_0x2fe3b9[_0x4553('0x31')]:_0x39a573[_0x4553('0x2b')];_0x2fe3b9[_0x4553('0x35')]=qs['sort'](_0x1b0f62[_0x4553('0x2f')][_0x4553('0x36')]);_0x2fe3b9[_0x4553('0x37')]=qs[_0x4553('0x2d')](_[_0x4553('0x38')](_0x1b0f62[_0x4553('0x2f')],_0x39a573[_0x4553('0x2d')]));if(_0x1b0f62['query'][_0x4553('0x39')]){_0x2fe3b9['where']=_[_0x4553('0x3a')](_0x2fe3b9['where'],{'$or':_[_0x4553('0x25')](_0x2fe3b9[_0x4553('0x31')],function(_0x16b5c5){var _0x23d977={};_0x23d977[_0x16b5c5]={'$like':'%'+_0x1b0f62[_0x4553('0x2f')][_0x4553('0x39')]+'%'};return _0x23d977;})});}_0x2fe3b9=_[_0x4553('0x3a')]({},_0x2fe3b9,_0x1b0f62[_0x4553('0x3c')]);return _0x4e205d['getSubjects'](_0x2fe3b9);}})[_0x4553('0x1e')](function(_0x108ffe){if(_0x108ffe){_0x410057=_0x108ffe[_0x4553('0x32')];if(!_0x1b0f62[_0x4553('0x2f')][_0x4553('0x33')](_0x4553('0x34'))){_0x2fe3b9['limit']=qs[_0x4553('0x18')](_0x1b0f62[_0x4553('0x2f')][_0x4553('0x18')]);_0x2fe3b9['offset']=qs['offset'](_0x1b0f62[_0x4553('0x2f')][_0x4553('0x16')]);}return _0x4e205d[_0x4553('0x48')](_0x2fe3b9);}})['then'](function(_0x4874a0){if(_0x4874a0){return _0x4874a0?{'count':_0x410057,'rows':_0x4874a0}:null;}})[_0x4553('0x1e')](respondWithResult(_0x115a36,null))[_0x4553('0x3e')](handleError(_0x115a36,null));};exports[_0x4553('0x4a')]=function(_0x5c6679,_0x80f1a0,_0x5eabb1){var _0x3bff4c={};var _0x48e9be={};var _0x59f59c;var _0x49bb29;return db[_0x4553('0x26')][_0x4553('0x49')]({'where':{'id':_0x5c6679[_0x4553('0x40')]['id']}})[_0x4553('0x1e')](handleEntityNotFound(_0x80f1a0,null))['then'](function(_0x4547f4){if(_0x4547f4){_0x59f59c=_0x4547f4;_0x48e9be[_0x4553('0x2b')]=_[_0x4553('0x2c')](db['DeskField'][_0x4553('0x27')]);_0x48e9be[_0x4553('0x2f')]=_[_0x4553('0x2c')](_0x5c6679[_0x4553('0x2f')]);_0x48e9be[_0x4553('0x2d')]=_[_0x4553('0x2e')](_0x48e9be[_0x4553('0x2b')],_0x48e9be['query']);_0x3bff4c[_0x4553('0x31')]=_[_0x4553('0x2e')](_0x48e9be['model'],qs[_0x4553('0x30')](_0x5c6679['query'][_0x4553('0x30')]));_0x3bff4c[_0x4553('0x31')]=_0x3bff4c[_0x4553('0x31')]['length']?_0x3bff4c[_0x4553('0x31')]:_0x48e9be['model'];_0x3bff4c[_0x4553('0x35')]=qs[_0x4553('0x36')](_0x5c6679[_0x4553('0x2f')][_0x4553('0x36')]);_0x3bff4c[_0x4553('0x37')]=qs[_0x4553('0x2d')](_[_0x4553('0x38')](_0x5c6679[_0x4553('0x2f')],_0x48e9be[_0x4553('0x2d')]));if(_0x5c6679['query'][_0x4553('0x39')]){_0x3bff4c[_0x4553('0x37')]=_['merge'](_0x3bff4c['where'],{'$or':_[_0x4553('0x25')](_0x3bff4c[_0x4553('0x31')],function(_0x13e499){var _0x5758d6={};_0x5758d6[_0x13e499]={'$like':'%'+_0x5c6679[_0x4553('0x2f')][_0x4553('0x39')]+'%'};return _0x5758d6;})});}_0x3bff4c=_[_0x4553('0x3a')]({},_0x3bff4c,_0x5c6679[_0x4553('0x3c')]);return _0x59f59c[_0x4553('0x4a')](_0x3bff4c);}})[_0x4553('0x1e')](function(_0x9973b5){if(_0x9973b5){_0x49bb29=_0x9973b5[_0x4553('0x32')];if(!_0x5c6679[_0x4553('0x2f')]['hasOwnProperty'](_0x4553('0x34'))){_0x3bff4c['limit']=qs[_0x4553('0x18')](_0x5c6679[_0x4553('0x2f')][_0x4553('0x18')]);_0x3bff4c['offset']=qs[_0x4553('0x16')](_0x5c6679[_0x4553('0x2f')][_0x4553('0x16')]);}return _0x59f59c['getDescriptions'](_0x3bff4c);}})[_0x4553('0x1e')](function(_0x5f0fa4){if(_0x5f0fa4){return _0x5f0fa4?{'count':_0x49bb29,'rows':_0x5f0fa4}:null;}})['then'](respondWithResult(_0x80f1a0,null))[_0x4553('0x3e')](handleError(_0x80f1a0,null));};exports[_0x4553('0x4b')]=function(_0x24eb35,_0x61ef9,_0x38ee3d){var _0x2c52c2={};var _0x164b80={};var _0x380953;var _0x4a646b;return db[_0x4553('0x26')][_0x4553('0x49')]({'where':{'id':_0x24eb35[_0x4553('0x40')]['id']}})[_0x4553('0x1e')](handleEntityNotFound(_0x61ef9,null))[_0x4553('0x1e')](function(_0x81bc2a){if(_0x81bc2a){_0x380953=_0x81bc2a;_0x164b80[_0x4553('0x2b')]=_['keys'](db['Tag'][_0x4553('0x27')]);_0x164b80[_0x4553('0x2f')]=_['keys'](_0x24eb35['query']);_0x164b80[_0x4553('0x2d')]=_[_0x4553('0x2e')](_0x164b80[_0x4553('0x2b')],_0x164b80[_0x4553('0x2f')]);_0x2c52c2[_0x4553('0x31')]=_['intersection'](_0x164b80[_0x4553('0x2b')],qs[_0x4553('0x30')](_0x24eb35['query'][_0x4553('0x30')]));_0x2c52c2[_0x4553('0x31')]=_0x2c52c2[_0x4553('0x31')][_0x4553('0x32')]?_0x2c52c2[_0x4553('0x31')]:_0x164b80[_0x4553('0x2b')];_0x2c52c2[_0x4553('0x35')]=qs[_0x4553('0x36')](_0x24eb35[_0x4553('0x2f')][_0x4553('0x36')]);_0x2c52c2['where']=qs['filters'](_[_0x4553('0x38')](_0x24eb35[_0x4553('0x2f')],_0x164b80[_0x4553('0x2d')]));if(_0x24eb35['query'][_0x4553('0x39')]){_0x2c52c2[_0x4553('0x37')]=_[_0x4553('0x3a')](_0x2c52c2['where'],{'$or':_['map'](_0x2c52c2[_0x4553('0x31')],function(_0x5335ec){var _0x36f080={};_0x36f080[_0x5335ec]={'$like':'%'+_0x24eb35[_0x4553('0x2f')]['filter']+'%'};return _0x36f080;})});}_0x2c52c2=_[_0x4553('0x3a')]({},_0x2c52c2,_0x24eb35[_0x4553('0x3c')]);return _0x380953[_0x4553('0x4b')](_0x2c52c2);}})[_0x4553('0x1e')](function(_0x3fe97e){if(_0x3fe97e){_0x4a646b=_0x3fe97e[_0x4553('0x32')];if(!_0x24eb35[_0x4553('0x2f')][_0x4553('0x33')](_0x4553('0x34'))){_0x2c52c2[_0x4553('0x18')]=qs[_0x4553('0x18')](_0x24eb35[_0x4553('0x2f')][_0x4553('0x18')]);_0x2c52c2[_0x4553('0x16')]=qs[_0x4553('0x16')](_0x24eb35['query'][_0x4553('0x16')]);}return _0x380953[_0x4553('0x4b')](_0x2c52c2);}})[_0x4553('0x1e')](function(_0x51bcde){if(_0x51bcde){return _0x51bcde?{'count':_0x4a646b,'rows':_0x51bcde}:null;}})[_0x4553('0x1e')](respondWithResult(_0x61ef9,null))[_0x4553('0x3e')](handleError(_0x61ef9,null));};exports['setTags']=function(_0x3d06d0,_0x145c20,_0x1b17f2){if(_0x3d06d0[_0x4553('0x45')]['id']){delete _0x3d06d0[_0x4553('0x45')]['id'];}return db[_0x4553('0x26')][_0x4553('0x49')]({'where':{'id':_0x3d06d0[_0x4553('0x40')]['id']}})['then'](handleEntityNotFound(_0x145c20,null))[_0x4553('0x1e')](function(_0x3f0a09){if(_0x3f0a09){return _0x3f0a09[_0x4553('0x4c')](_0x3d06d0['body'][_0x4553('0x4d')]||[]);}return null;})[_0x4553('0x1e')](respondWithResult(_0x145c20,null))[_0x4553('0x3e')](handleError(_0x145c20,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 5497d88..e80a42f 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 _0x634e=['int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x49804d,_0x3f3aa4){var _0x3c35f1=function(_0x462e6c){while(--_0x462e6c){_0x49804d['push'](_0x49804d['shift']());}};_0x3c35f1(++_0x3f3aa4);}(_0x634e,0x1b9));var _0xe634=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x634e[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0xe634('0x0'));var util=require(_0xe634('0x1'));var logger=require(_0xe634('0x2'))(_0xe634('0x3'));var moment=require(_0xe634('0x4'));var BPromise=require('bluebird');var rp=require(_0xe634('0x5'));var fs=require('fs');var path=require(_0xe634('0x6'));var rimraf=require(_0xe634('0x7'));var config=require(_0xe634('0x8'));var attributes=require(_0xe634('0x9'));module['exports']=function(_0x39644c,_0x4a186f){return _0x39644c['define']('DeskConfiguration',attributes,{'tableName':_0xe634('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf756=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports'];(function(_0x1610a4,_0x416bf5){var _0x476d45=function(_0x4d409b){while(--_0x4d409b){_0x1610a4['push'](_0x1610a4['shift']());}};_0x476d45(++_0x416bf5);}(_0xf756,0x18e));var _0x6f75=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xf756[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x6f75('0x0'));var util=require(_0x6f75('0x1'));var logger=require(_0x6f75('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6f75('0x3'));var rp=require(_0x6f75('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6f75('0x5'));var attributes=require('./intDeskConfiguration.attributes');module[_0x6f75('0x6')]=function(_0x573ef8,_0x584488){return _0x573ef8['define'](_0x6f75('0x7'),attributes,{'tableName':_0x6f75('0x8'),'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 47545f1..3d877e6 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 _0x5b12=['DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x5b12,0xa3));var _0x25b1=function(_0x1293fc,_0x57212a){_0x1293fc=_0x1293fc-0x0;var _0x1c519e=_0x5b12[_0x1293fc];return _0x1c519e;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});} \ No newline at end of file +var _0x0d64=['error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3450cf,_0x2fcf03){var _0x49faa8=function(_0x45d14d){while(--_0x45d14d){_0x3450cf['push'](_0x3450cf['shift']());}};_0x49faa8(++_0x2fcf03);}(_0x0d64,0xad));var _0x40d6=function(_0x343aa1,_0x443588){_0x343aa1=_0x343aa1-0x0;var _0x145484=_0x0d64[_0x343aa1];return _0x145484;};'use strict';var _=require(_0x40d6('0x0'));var util=require(_0x40d6('0x1'));var moment=require(_0x40d6('0x2'));var BPromise=require(_0x40d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40d6('0x5'));var logger=require(_0x40d6('0x6'))(_0x40d6('0x7'));var config=require(_0x40d6('0x8'));var jayson=require(_0x40d6('0x9'));var client=jayson[_0x40d6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283147,_0x1ae4fa,_0x2da2b4){return new BPromise(function(_0x21685a,_0x55a9f9){return client[_0x40d6('0xb')](_0x283147,_0x2da2b4)[_0x40d6('0xc')](function(_0x53d005){logger['info'](_0x40d6('0xd'),_0x1ae4fa,_0x40d6('0xe'));logger[_0x40d6('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1ae4fa,_0x40d6('0xe'),JSON['stringify'](_0x53d005));if(_0x53d005[_0x40d6('0x10')]){if(_0x53d005[_0x40d6('0x10')]['code']===0x1f4){logger[_0x40d6('0x10')](_0x40d6('0xd'),_0x1ae4fa,_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);return _0x55a9f9(_0x53d005[_0x40d6('0x10')]['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x1ae4fa,_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);return _0x21685a(_0x53d005[_0x40d6('0x10')][_0x40d6('0x11')]);}else{logger[_0x40d6('0x12')](_0x40d6('0xd'),_0x1ae4fa,_0x40d6('0xe'));_0x21685a(_0x53d005[_0x40d6('0x13')][_0x40d6('0x11')]);}})[_0x40d6('0x14')](function(_0x4092f3){logger[_0x40d6('0x10')](_0x40d6('0xd'),_0x1ae4fa,_0x4092f3);_0x55a9f9(_0x4092f3);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index edf30de..7144121 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 _0xfdc6=['isAuthenticated','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id'];(function(_0x46bfa0,_0x47c2ea){var _0x950bb9=function(_0x397292){while(--_0x397292){_0x46bfa0['push'](_0x46bfa0['shift']());}};_0x950bb9(++_0x47c2ea);}(_0xfdc6,0xf3));var _0x6fdc=function(_0x47199b,_0x16e824){_0x47199b=_0x47199b-0x0;var _0x390911=_0xfdc6[_0x47199b];return _0x390911;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6fdc('0x0'));var timeout=require(_0x6fdc('0x1'));var express=require('express');var router=express[_0x6fdc('0x2')]();var fs_extra=require(_0x6fdc('0x3'));var auth=require(_0x6fdc('0x4'));var interaction=require(_0x6fdc('0x5'));var config=require(_0x6fdc('0x6'));var controller=require('./intDeskField.controller');router[_0x6fdc('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6fdc('0x8'),auth[_0x6fdc('0x9')](),controller[_0x6fdc('0xa')]);router[_0x6fdc('0xb')]('/',auth['isAuthenticated'](),controller[_0x6fdc('0xc')]);router[_0x6fdc('0xd')](_0x6fdc('0x8'),auth[_0x6fdc('0x9')](),controller[_0x6fdc('0xe')]);router[_0x6fdc('0xf')](_0x6fdc('0x8'),auth[_0x6fdc('0x9')](),controller[_0x6fdc('0x10')]);module[_0x6fdc('0x11')]=router; \ No newline at end of file +var _0xd9b4=['get','/:id','show','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','isAuthenticated','index'];(function(_0xb4e961,_0x379b19){var _0x1091ae=function(_0x375775){while(--_0x375775){_0xb4e961['push'](_0xb4e961['shift']());}};_0x1091ae(++_0x379b19);}(_0xd9b4,0x1c0));var _0x4d9b=function(_0x324791,_0x409770){_0x324791=_0x324791-0x0;var _0x42fd9b=_0xd9b4[_0x324791];return _0x42fd9b;};'use strict';var multer=require(_0x4d9b('0x0'));var util=require(_0x4d9b('0x1'));var path=require(_0x4d9b('0x2'));var timeout=require(_0x4d9b('0x3'));var express=require(_0x4d9b('0x4'));var router=express[_0x4d9b('0x5')]();var fs_extra=require(_0x4d9b('0x6'));var auth=require(_0x4d9b('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4d9b('0x8'));router['get']('/',auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xa')]);router[_0x4d9b('0xb')](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller[_0x4d9b('0xd')]);router['post']('/',auth[_0x4d9b('0x9')](),controller['create']);router[_0x4d9b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4d9b('0xf')]);router['delete'](_0x4d9b('0xc'),auth[_0x4d9b('0x9')](),controller['destroy']);module[_0x4d9b('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2fe674d..5dacf1e 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 _0xb86e=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x26d4ca,_0xa2b4a0){var _0x5583f9=function(_0x11d39b){while(--_0x11d39b){_0x26d4ca['push'](_0x26d4ca['shift']());}};_0x5583f9(++_0xa2b4a0);}(_0xb86e,0x1a0));var _0xeb86=function(_0x2d45db,_0x5e7381){_0x2d45db=_0x2d45db-0x0;var _0x700544=_0xb86e[_0x2d45db];return _0x700544;};'use strict';var Sequelize=require(_0xeb86('0x0'));module['exports']={'type':{'type':Sequelize[_0xeb86('0x1')](_0xeb86('0x2'),_0xeb86('0x3'),_0xeb86('0x4'),_0xeb86('0x5'),_0xeb86('0x6')),'defaultValue':_0xeb86('0x2')},'content':{'type':Sequelize[_0xeb86('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xeb86('0x1')]('string','variable',_0xeb86('0x4'))},'keyContent':{'type':Sequelize[_0xeb86('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xeb86('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeb86('0x7')]}}; \ No newline at end of file +var _0xfd8b=['sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0xfd8b,0xaa));var _0xbfd8=function(_0x3f0b1f,_0x5554cb){_0x3f0b1f=_0x3f0b1f-0x0;var _0x123659=_0xfd8b[_0x3f0b1f];return _0x123659;};'use strict';var Sequelize=require(_0xbfd8('0x0'));module[_0xbfd8('0x1')]={'type':{'type':Sequelize[_0xbfd8('0x2')](_0xbfd8('0x3'),_0xbfd8('0x4'),'customVariable',_0xbfd8('0x5'),_0xbfd8('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xbfd8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbfd8('0x2')](_0xbfd8('0x3'),_0xbfd8('0x4'),_0xbfd8('0x8'))},'keyContent':{'type':Sequelize[_0xbfd8('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbfd8('0x7')]},'customField':{'type':Sequelize[_0xbfd8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbfd8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 6d86ebd..ac25790 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 _0x56b9=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','show','params','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56b9,0x196));var _0x956b=function(_0x4ad6e4,_0x103161){_0x4ad6e4=_0x4ad6e4-0x0;var _0x11e62a=_0x56b9[_0x4ad6e4];return _0x11e62a;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require(_0x956b('0x1'));var zipdir=require(_0x956b('0x2'));var jsonpatch=require(_0x956b('0x3'));var rp=require(_0x956b('0x4'));var moment=require(_0x956b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x956b('0x6'));var util=require('util');var path=require(_0x956b('0x7'));var sox=require(_0x956b('0x8'));var csv=require(_0x956b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require(_0x956b('0xd'));var jsforce=require(_0x956b('0xe'));var deskjs=require(_0x956b('0xf'));var toCsv=require(_0x956b('0x9'));var querystring=require(_0x956b('0x10'));var Papa=require('papaparse');var Redis=require(_0x956b('0x11'));var authService=require(_0x956b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x956b('0x13'));var hardwareService=require(_0x956b('0x14'));var logger=require(_0x956b('0x15'))(_0x956b('0x16'));var utils=require(_0x956b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x18'));var db=require(_0x956b('0x19'))['db'];function respondWithStatusCode(_0x2bc65c,_0x2fcd69){_0x2fcd69=_0x2fcd69||0xcc;return function(_0x3683bc){if(_0x3683bc){return _0x2bc65c[_0x956b('0x1a')](_0x2fcd69);}return _0x2bc65c[_0x956b('0x1b')](_0x2fcd69)[_0x956b('0x1c')]();};}function respondWithResult(_0x4338ce,_0x2346bd){_0x2346bd=_0x2346bd||0xc8;return function(_0x389c3b){if(_0x389c3b){return _0x4338ce['status'](_0x2346bd)[_0x956b('0x1d')](_0x389c3b);}};}function respondWithFilteredResult(_0x32a806,_0xe68d03){return function(_0x4e4029){if(_0x4e4029){var _0x96ea9d=typeof _0xe68d03[_0x956b('0x1e')]===_0x956b('0x1f')&&typeof _0xe68d03[_0x956b('0x20')]===_0x956b('0x1f');var _0x2bece3=_0x4e4029[_0x956b('0x21')];var _0x57dff2=_0x96ea9d?0x0:_0xe68d03[_0x956b('0x1e')];var _0xc4cdb3=_0x96ea9d?_0x4e4029[_0x956b('0x21')]:_0xe68d03['offset']+_0xe68d03[_0x956b('0x20')];var _0x45211c;if(_0xc4cdb3>=_0x2bece3){_0xc4cdb3=_0x2bece3;_0x45211c=0xc8;}else{_0x45211c=0xce;}_0x32a806['status'](_0x45211c);return _0x32a806['set'](_0x956b('0x22'),_0x57dff2+'-'+_0xc4cdb3+'/'+_0x2bece3)[_0x956b('0x1d')](_0x4e4029);}return null;};}function patchUpdates(_0x21fee6){return function(_0x53cb2d){try{jsonpatch[_0x956b('0x23')](_0x53cb2d,_0x21fee6,!![]);}catch(_0x2a4cb5){return BPromise[_0x956b('0x24')](_0x2a4cb5);}return _0x53cb2d[_0x956b('0x25')]();};}function saveUpdates(_0x33edf1,_0x840935){return function(_0x4ad9bb){if(_0x4ad9bb){return _0x4ad9bb[_0x956b('0x26')](_0x33edf1)[_0x956b('0x27')](function(_0x1f9ff6){return _0x1f9ff6;});}return null;};}function removeEntity(_0x3605cd,_0x2b315d){return function(_0x1ecd0a){if(_0x1ecd0a){return _0x1ecd0a[_0x956b('0x28')]()[_0x956b('0x27')](function(){_0x3605cd[_0x956b('0x1b')](0xcc)[_0x956b('0x1c')]();});}};}function handleEntityNotFound(_0x32f727,_0x512a68){return function(_0x502875){if(!_0x502875){_0x32f727[_0x956b('0x1a')](0x194);}return _0x502875;};}function handleError(_0x2606bf,_0x3af7fd){_0x3af7fd=_0x3af7fd||0x1f4;return function(_0x21ab02){logger[_0x956b('0x29')](_0x21ab02[_0x956b('0x2a')]);if(_0x21ab02[_0x956b('0x2b')]){delete _0x21ab02['name'];}_0x2606bf[_0x956b('0x1b')](_0x3af7fd)[_0x956b('0x2c')](_0x21ab02);};}exports[_0x956b('0x2d')]=function(_0x3d33ad,_0x3d17a0){var _0x33fb5e={},_0x1f692e={},_0x9c0e2e={'count':0x0,'rows':[]};var _0x15c32e=_[_0x956b('0x2e')](db[_0x956b('0x2f')][_0x956b('0x30')],function(_0x1c5f3d){return{'name':_0x1c5f3d[_0x956b('0x31')],'type':_0x1c5f3d[_0x956b('0x32')][_0x956b('0x33')]};});_0x1f692e[_0x956b('0x34')]=_[_0x956b('0x2e')](_0x15c32e,_0x956b('0x2b'));_0x1f692e[_0x956b('0x35')]=_[_0x956b('0x36')](_0x3d33ad['query']);_0x1f692e[_0x956b('0x37')]=_[_0x956b('0x38')](_0x1f692e[_0x956b('0x34')],_0x1f692e[_0x956b('0x35')]);_0x33fb5e[_0x956b('0x39')]=_[_0x956b('0x38')](_0x1f692e[_0x956b('0x34')],qs[_0x956b('0x3a')](_0x3d33ad['query']['fields']));_0x33fb5e[_0x956b('0x39')]=_0x33fb5e[_0x956b('0x39')][_0x956b('0x3b')]?_0x33fb5e[_0x956b('0x39')]:_0x1f692e[_0x956b('0x34')];if(!_0x3d33ad[_0x956b('0x35')][_0x956b('0x3c')]('nolimit')){_0x33fb5e[_0x956b('0x20')]=qs['limit'](_0x3d33ad['query'][_0x956b('0x20')]);_0x33fb5e[_0x956b('0x1e')]=qs[_0x956b('0x1e')](_0x3d33ad[_0x956b('0x35')][_0x956b('0x1e')]);}_0x33fb5e[_0x956b('0x3d')]=qs[_0x956b('0x3e')](_0x3d33ad['query'][_0x956b('0x3e')]);_0x33fb5e[_0x956b('0x3f')]=qs['filters'](_[_0x956b('0x40')](_0x3d33ad[_0x956b('0x35')],_0x1f692e['filters']),_0x15c32e);if(_0x3d33ad[_0x956b('0x35')]['filter']){_0x33fb5e[_0x956b('0x3f')]=_[_0x956b('0x41')](_0x33fb5e[_0x956b('0x3f')],{'$or':_[_0x956b('0x2e')](_0x15c32e,function(_0x5c8326){if(_0x5c8326['type']!==_0x956b('0x42')){var _0x328c5e={};_0x328c5e[_0x5c8326[_0x956b('0x2b')]]={'$like':'%'+_0x3d33ad[_0x956b('0x35')][_0x956b('0x43')]+'%'};return _0x328c5e;}})});}_0x33fb5e=_[_0x956b('0x41')]({},_0x33fb5e,_0x3d33ad['options']);var _0x3548cf={'where':_0x33fb5e[_0x956b('0x3f')]};return db['DeskField'][_0x956b('0x21')](_0x3548cf)['then'](function(_0x5b84f9){_0x9c0e2e[_0x956b('0x21')]=_0x5b84f9;if(_0x3d33ad[_0x956b('0x35')]['includeAll']){_0x33fb5e[_0x956b('0x44')]=[{'all':!![]}];}return db[_0x956b('0x2f')]['findAll'](_0x33fb5e);})[_0x956b('0x27')](function(_0x591823){_0x9c0e2e['rows']=_0x591823;return _0x9c0e2e;})[_0x956b('0x27')](respondWithFilteredResult(_0x3d17a0,_0x33fb5e))[_0x956b('0x45')](handleError(_0x3d17a0,null));};exports[_0x956b('0x46')]=function(_0x55f7dd,_0x41657f){var _0x1b8197={'raw':!![],'where':{'id':_0x55f7dd[_0x956b('0x47')]['id']}},_0x3b3fe6={};_0x3b3fe6[_0x956b('0x34')]=_[_0x956b('0x36')](db[_0x956b('0x2f')][_0x956b('0x30')]);_0x3b3fe6[_0x956b('0x35')]=_[_0x956b('0x36')](_0x55f7dd[_0x956b('0x35')]);_0x3b3fe6['filters']=_[_0x956b('0x38')](_0x3b3fe6[_0x956b('0x34')],_0x3b3fe6[_0x956b('0x35')]);_0x1b8197['attributes']=_[_0x956b('0x38')](_0x3b3fe6[_0x956b('0x34')],qs['fields'](_0x55f7dd['query']['fields']));_0x1b8197[_0x956b('0x39')]=_0x1b8197[_0x956b('0x39')][_0x956b('0x3b')]?_0x1b8197[_0x956b('0x39')]:_0x3b3fe6[_0x956b('0x34')];if(_0x55f7dd[_0x956b('0x35')][_0x956b('0x48')]){_0x1b8197[_0x956b('0x44')]=[{'all':!![]}];}_0x1b8197=_[_0x956b('0x41')]({},_0x1b8197,_0x55f7dd[_0x956b('0x49')]);return db['DeskField']['find'](_0x1b8197)['then'](handleEntityNotFound(_0x41657f,null))['then'](respondWithResult(_0x41657f,null))['catch'](handleError(_0x41657f,null));};exports[_0x956b('0x4a')]=function(_0x280efc,_0x32621b){return db[_0x956b('0x2f')][_0x956b('0x4a')](_0x280efc['body'],{})[_0x956b('0x27')](respondWithResult(_0x32621b,0xc9))[_0x956b('0x45')](handleError(_0x32621b,null));};exports[_0x956b('0x26')]=function(_0x4f1cfd,_0x49f331){if(_0x4f1cfd[_0x956b('0x4b')]['id']){delete _0x4f1cfd[_0x956b('0x4b')]['id'];}return db['DeskField'][_0x956b('0x4c')]({'where':{'id':_0x4f1cfd[_0x956b('0x47')]['id']}})[_0x956b('0x27')](handleEntityNotFound(_0x49f331,null))['then'](saveUpdates(_0x4f1cfd[_0x956b('0x4b')],null))['then'](respondWithResult(_0x49f331,null))[_0x956b('0x45')](handleError(_0x49f331,null));};exports[_0x956b('0x28')]=function(_0x343f7e,_0x1a35fd){return db[_0x956b('0x2f')][_0x956b('0x4c')]({'where':{'id':_0x343f7e[_0x956b('0x47')]['id']}})[_0x956b('0x27')](handleEntityNotFound(_0x1a35fd,null))[_0x956b('0x27')](removeEntity(_0x1a35fd,null))[_0x956b('0x45')](handleError(_0x1a35fd,null));}; \ No newline at end of file +var _0xa680=['error','name','index','map','DeskField','rawAttributes','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy'];(function(_0x1862bd,_0x212361){var _0x49f0aa=function(_0x581f4b){while(--_0x581f4b){_0x1862bd['push'](_0x1862bd['shift']());}};_0x49f0aa(++_0x212361);}(_0xa680,0xb0));var _0x0a68=function(_0x2abce6,_0x2661d1){_0x2abce6=_0x2abce6-0x0;var _0x2f9d54=_0xa680[_0x2abce6];return _0x2f9d54;};'use strict';var emlformat=require(_0x0a68('0x0'));var rimraf=require(_0x0a68('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a68('0x2'));var moment=require(_0x0a68('0x3'));var BPromise=require(_0x0a68('0x4'));var Mustache=require(_0x0a68('0x5'));var util=require('util');var path=require(_0x0a68('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a68('0x7'));var _=require(_0x0a68('0x8'));var squel=require(_0x0a68('0x9'));var crypto=require(_0x0a68('0xa'));var jsforce=require(_0x0a68('0xb'));var deskjs=require(_0x0a68('0xc'));var toCsv=require(_0x0a68('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0a68('0xe'));var authService=require(_0x0a68('0xf'));var qs=require(_0x0a68('0x10'));var as=require(_0x0a68('0x11'));var hardwareService=require(_0x0a68('0x12'));var logger=require(_0x0a68('0x13'))(_0x0a68('0x14'));var utils=require(_0x0a68('0x15'));var config=require(_0x0a68('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a68('0x17'))['db'];function respondWithStatusCode(_0x6baaf,_0x1f1306){_0x1f1306=_0x1f1306||0xcc;return function(_0x10fa2d){if(_0x10fa2d){return _0x6baaf[_0x0a68('0x18')](_0x1f1306);}return _0x6baaf[_0x0a68('0x19')](_0x1f1306)[_0x0a68('0x1a')]();};}function respondWithResult(_0x2b0d2e,_0x4b4716){_0x4b4716=_0x4b4716||0xc8;return function(_0x4c2a93){if(_0x4c2a93){return _0x2b0d2e[_0x0a68('0x19')](_0x4b4716)[_0x0a68('0x1b')](_0x4c2a93);}};}function respondWithFilteredResult(_0x38587a,_0x50cb26){return function(_0x34707e){if(_0x34707e){var _0x5ad51a=typeof _0x50cb26[_0x0a68('0x1c')]===_0x0a68('0x1d')&&typeof _0x50cb26['limit']===_0x0a68('0x1d');var _0xc9ac2b=_0x34707e[_0x0a68('0x1e')];var _0x367e5e=_0x5ad51a?0x0:_0x50cb26[_0x0a68('0x1c')];var _0x104f62=_0x5ad51a?_0x34707e['count']:_0x50cb26['offset']+_0x50cb26['limit'];var _0x2ba411;if(_0x104f62>=_0xc9ac2b){_0x104f62=_0xc9ac2b;_0x2ba411=0xc8;}else{_0x2ba411=0xce;}_0x38587a[_0x0a68('0x19')](_0x2ba411);return _0x38587a[_0x0a68('0x1f')]('Content-Range',_0x367e5e+'-'+_0x104f62+'/'+_0xc9ac2b)['json'](_0x34707e);}return null;};}function patchUpdates(_0x36e9b0){return function(_0x91b85e){try{jsonpatch[_0x0a68('0x20')](_0x91b85e,_0x36e9b0,!![]);}catch(_0x2f89fd){return BPromise['reject'](_0x2f89fd);}return _0x91b85e[_0x0a68('0x21')]();};}function saveUpdates(_0x3c6967,_0x207696){return function(_0x4b98fa){if(_0x4b98fa){return _0x4b98fa[_0x0a68('0x22')](_0x3c6967)[_0x0a68('0x23')](function(_0x5f2ec2){return _0x5f2ec2;});}return null;};}function removeEntity(_0x4b7251,_0x58d72b){return function(_0x2fde6a){if(_0x2fde6a){return _0x2fde6a[_0x0a68('0x24')]()['then'](function(){_0x4b7251['status'](0xcc)[_0x0a68('0x1a')]();});}};}function handleEntityNotFound(_0x4fc58e,_0x790d22){return function(_0x5335b0){if(!_0x5335b0){_0x4fc58e[_0x0a68('0x18')](0x194);}return _0x5335b0;};}function handleError(_0x35a540,_0x255467){_0x255467=_0x255467||0x1f4;return function(_0x42b203){logger[_0x0a68('0x25')](_0x42b203['stack']);if(_0x42b203[_0x0a68('0x26')]){delete _0x42b203[_0x0a68('0x26')];}_0x35a540[_0x0a68('0x19')](_0x255467)['send'](_0x42b203);};}exports[_0x0a68('0x27')]=function(_0x2d8985,_0x489012){var _0x354420={},_0x2fb1da={},_0x524a08={'count':0x0,'rows':[]};var _0x3349b2=_[_0x0a68('0x28')](db[_0x0a68('0x29')][_0x0a68('0x2a')],function(_0x53c2a5){return{'name':_0x53c2a5['fieldName'],'type':_0x53c2a5[_0x0a68('0x2b')]['key']};});_0x2fb1da['model']=_[_0x0a68('0x28')](_0x3349b2,_0x0a68('0x26'));_0x2fb1da[_0x0a68('0x2c')]=_[_0x0a68('0x2d')](_0x2d8985['query']);_0x2fb1da['filters']=_[_0x0a68('0x2e')](_0x2fb1da[_0x0a68('0x2f')],_0x2fb1da[_0x0a68('0x2c')]);_0x354420[_0x0a68('0x30')]=_[_0x0a68('0x2e')](_0x2fb1da['model'],qs['fields'](_0x2d8985['query'][_0x0a68('0x31')]));_0x354420[_0x0a68('0x30')]=_0x354420[_0x0a68('0x30')][_0x0a68('0x32')]?_0x354420[_0x0a68('0x30')]:_0x2fb1da['model'];if(!_0x2d8985['query'][_0x0a68('0x33')](_0x0a68('0x34'))){_0x354420[_0x0a68('0x35')]=qs[_0x0a68('0x35')](_0x2d8985['query'][_0x0a68('0x35')]);_0x354420[_0x0a68('0x1c')]=qs[_0x0a68('0x1c')](_0x2d8985[_0x0a68('0x2c')][_0x0a68('0x1c')]);}_0x354420[_0x0a68('0x36')]=qs[_0x0a68('0x37')](_0x2d8985['query'][_0x0a68('0x37')]);_0x354420[_0x0a68('0x38')]=qs[_0x0a68('0x39')](_[_0x0a68('0x3a')](_0x2d8985[_0x0a68('0x2c')],_0x2fb1da[_0x0a68('0x39')]),_0x3349b2);if(_0x2d8985[_0x0a68('0x2c')][_0x0a68('0x3b')]){_0x354420['where']=_[_0x0a68('0x3c')](_0x354420[_0x0a68('0x38')],{'$or':_[_0x0a68('0x28')](_0x3349b2,function(_0x2d02fc){if(_0x2d02fc[_0x0a68('0x2b')]!==_0x0a68('0x3d')){var _0x5e1eb1={};_0x5e1eb1[_0x2d02fc[_0x0a68('0x26')]]={'$like':'%'+_0x2d8985[_0x0a68('0x2c')][_0x0a68('0x3b')]+'%'};return _0x5e1eb1;}})});}_0x354420=_[_0x0a68('0x3c')]({},_0x354420,_0x2d8985[_0x0a68('0x3e')]);var _0x394ce9={'where':_0x354420[_0x0a68('0x38')]};return db[_0x0a68('0x29')][_0x0a68('0x1e')](_0x394ce9)[_0x0a68('0x23')](function(_0x593add){_0x524a08[_0x0a68('0x1e')]=_0x593add;if(_0x2d8985['query']['includeAll']){_0x354420[_0x0a68('0x3f')]=[{'all':!![]}];}return db['DeskField'][_0x0a68('0x40')](_0x354420);})[_0x0a68('0x23')](function(_0x41e49e){_0x524a08['rows']=_0x41e49e;return _0x524a08;})[_0x0a68('0x23')](respondWithFilteredResult(_0x489012,_0x354420))[_0x0a68('0x41')](handleError(_0x489012,null));};exports['show']=function(_0x370761,_0x38f39b){var _0x55967a={'raw':!![],'where':{'id':_0x370761[_0x0a68('0x42')]['id']}},_0x195557={};_0x195557[_0x0a68('0x2f')]=_['keys'](db['DeskField'][_0x0a68('0x2a')]);_0x195557[_0x0a68('0x2c')]=_[_0x0a68('0x2d')](_0x370761[_0x0a68('0x2c')]);_0x195557['filters']=_[_0x0a68('0x2e')](_0x195557['model'],_0x195557['query']);_0x55967a[_0x0a68('0x30')]=_[_0x0a68('0x2e')](_0x195557[_0x0a68('0x2f')],qs[_0x0a68('0x31')](_0x370761['query'][_0x0a68('0x31')]));_0x55967a[_0x0a68('0x30')]=_0x55967a[_0x0a68('0x30')][_0x0a68('0x32')]?_0x55967a['attributes']:_0x195557['model'];if(_0x370761[_0x0a68('0x2c')][_0x0a68('0x43')]){_0x55967a['include']=[{'all':!![]}];}_0x55967a=_[_0x0a68('0x3c')]({},_0x55967a,_0x370761[_0x0a68('0x3e')]);return db[_0x0a68('0x29')][_0x0a68('0x44')](_0x55967a)[_0x0a68('0x23')](handleEntityNotFound(_0x38f39b,null))[_0x0a68('0x23')](respondWithResult(_0x38f39b,null))[_0x0a68('0x41')](handleError(_0x38f39b,null));};exports[_0x0a68('0x45')]=function(_0x158c4f,_0x367671){return db[_0x0a68('0x29')][_0x0a68('0x45')](_0x158c4f[_0x0a68('0x46')],{})[_0x0a68('0x23')](respondWithResult(_0x367671,0xc9))[_0x0a68('0x41')](handleError(_0x367671,null));};exports[_0x0a68('0x22')]=function(_0x403c07,_0x4b8a03){if(_0x403c07['body']['id']){delete _0x403c07['body']['id'];}return db['DeskField'][_0x0a68('0x44')]({'where':{'id':_0x403c07[_0x0a68('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b8a03,null))[_0x0a68('0x23')](saveUpdates(_0x403c07[_0x0a68('0x46')],null))['then'](respondWithResult(_0x4b8a03,null))[_0x0a68('0x41')](handleError(_0x4b8a03,null));};exports[_0x0a68('0x24')]=function(_0x591d5c,_0x357919){return db[_0x0a68('0x29')]['find']({'where':{'id':_0x591d5c[_0x0a68('0x42')]['id']}})['then'](handleEntityNotFound(_0x357919,null))['then'](removeEntity(_0x357919,null))['catch'](handleError(_0x357919,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ede4562..c5c64ed 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 _0x618c=['DeskField','int_desk_fields','desk_unique_index','idField','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','exports','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x618c,0xd0));var _0xc618=function(_0x4c1a5e,_0x59dd6f){_0x4c1a5e=_0x4c1a5e-0x0;var _0x3044fd=_0x618c[_0x4c1a5e];return _0x3044fd;};'use strict';var _=require(_0xc618('0x0'));var util=require('util');var logger=require(_0xc618('0x1'))('api');var moment=require(_0xc618('0x2'));var BPromise=require(_0xc618('0x3'));var rp=require(_0xc618('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc618('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module[_0xc618('0x6')]=function(_0x569e8a,_0x15eaec){return _0x569e8a[_0xc618('0x7')](_0xc618('0x8'),attributes,{'tableName':_0xc618('0x9'),'paranoid':![],'indexes':[{'name':_0xc618('0xa'),'fields':[_0xc618('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcec8=['DeskField','int_desk_fields','idField','FieldId','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xcec8,0xb4));var _0x8cec=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xcec8[_0x27dba4];return _0x35ec9d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8cec('0x0'));var moment=require(_0x8cec('0x1'));var BPromise=require(_0x8cec('0x2'));var rp=require(_0x8cec('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8cec('0x4'));var attributes=require(_0x8cec('0x5'));module[_0x8cec('0x6')]=function(_0xae88d8,_0x418c5e){return _0xae88d8['define'](_0x8cec('0x7'),attributes,{'tableName':_0x8cec('0x8'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x8cec('0x9'),_0x8cec('0xa')],'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 652c9ba..07034e1 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 _0x9967=['info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','DeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x428b95,_0xc26413){var _0x253d3c=function(_0x5d06cf){while(--_0x5d06cf){_0x428b95['push'](_0x428b95['shift']());}};_0x253d3c(++_0xc26413);}(_0x9967,0x1ee));var _0x7996=function(_0xc33272,_0x5056c1){_0xc33272=_0xc33272-0x0;var _0x57fce1=_0x9967[_0xc33272];return _0x57fce1;};'use strict';var _=require('lodash');var util=require(_0x7996('0x0'));var moment=require(_0x7996('0x1'));var BPromise=require(_0x7996('0x2'));var rs=require(_0x7996('0x3'));var fs=require('fs');var Redis=require(_0x7996('0x4'));var db=require(_0x7996('0x5'))['db'];var utils=require(_0x7996('0x6'));var logger=require(_0x7996('0x7'))('rpc');var config=require(_0x7996('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7996('0x9')][_0x7996('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52aa59,_0x3e8cb5,_0x286bf1){return new BPromise(function(_0x559ebf,_0x28dc25){return client['request'](_0x52aa59,_0x286bf1)[_0x7996('0xb')](function(_0x573108){logger[_0x7996('0xc')]('DeskField,\x20%s,\x20%s',_0x3e8cb5,_0x7996('0xd'));logger[_0x7996('0xe')](_0x7996('0xf'),_0x3e8cb5,'request\x20sent',JSON['stringify'](_0x573108));if(_0x573108['error']){if(_0x573108[_0x7996('0x10')][_0x7996('0x11')]===0x1f4){logger['error'](_0x7996('0x12'),_0x3e8cb5,_0x573108[_0x7996('0x10')][_0x7996('0x13')]);return _0x28dc25(_0x573108['error']['message']);}logger[_0x7996('0x10')]('DeskField,\x20%s,\x20%s',_0x3e8cb5,_0x573108['error'][_0x7996('0x13')]);return _0x559ebf(_0x573108[_0x7996('0x10')][_0x7996('0x13')]);}else{logger[_0x7996('0xc')]('DeskField,\x20%s,\x20%s',_0x3e8cb5,'request\x20sent');_0x559ebf(_0x573108[_0x7996('0x14')][_0x7996('0x13')]);}})[_0x7996('0x15')](function(_0x45df5a){logger[_0x7996('0x10')](_0x7996('0x12'),_0x3e8cb5,_0x45df5a);_0x28dc25(_0x45df5a);});});} \ No newline at end of file +var _0x9e2f=['info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x1c8413,_0x49c3e7){var _0x12eca7=function(_0x146926){while(--_0x146926){_0x1c8413['push'](_0x1c8413['shift']());}};_0x12eca7(++_0x49c3e7);}(_0x9e2f,0x1d6));var _0xf9e2=function(_0x37e3f8,_0x5b84d8){_0x37e3f8=_0x37e3f8-0x0;var _0x2167a2=_0x9e2f[_0x37e3f8];return _0x2167a2;};'use strict';var _=require(_0xf9e2('0x0'));var util=require(_0xf9e2('0x1'));var moment=require(_0xf9e2('0x2'));var BPromise=require(_0xf9e2('0x3'));var rs=require(_0xf9e2('0x4'));var fs=require('fs');var Redis=require(_0xf9e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf9e2('0x6'))(_0xf9e2('0x7'));var config=require(_0xf9e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf9e2('0x9')][_0xf9e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ff40,_0x375cdd,_0x34d877){return new BPromise(function(_0x4a3b6d,_0x4dc8e7){return client[_0xf9e2('0xb')](_0x34ff40,_0x34d877)[_0xf9e2('0xc')](function(_0x2dc296){logger[_0xf9e2('0xd')](_0xf9e2('0xe'),_0x375cdd,_0xf9e2('0xf'));logger[_0xf9e2('0x10')](_0xf9e2('0x11'),_0x375cdd,_0xf9e2('0xf'),JSON['stringify'](_0x2dc296));if(_0x2dc296[_0xf9e2('0x12')]){if(_0x2dc296['error'][_0xf9e2('0x13')]===0x1f4){logger[_0xf9e2('0x12')](_0xf9e2('0xe'),_0x375cdd,_0x2dc296[_0xf9e2('0x12')][_0xf9e2('0x14')]);return _0x4dc8e7(_0x2dc296[_0xf9e2('0x12')]['message']);}logger[_0xf9e2('0x12')](_0xf9e2('0xe'),_0x375cdd,_0x2dc296[_0xf9e2('0x12')]['message']);return _0x4a3b6d(_0x2dc296[_0xf9e2('0x12')]['message']);}else{logger[_0xf9e2('0xd')](_0xf9e2('0xe'),_0x375cdd,_0xf9e2('0xf'));_0x4a3b6d(_0x2dc296[_0xf9e2('0x15')]['message']);}})[_0xf9e2('0x16')](function(_0x46d965){logger[_0xf9e2('0x12')](_0xf9e2('0xe'),_0x375cdd,_0x46d965);_0x4dc8e7(_0x46d965);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8ee0b4d..fe07fd8 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 _0xfb0d=['getConfigurations','/:id/fields','getFields','post','create','put','update','delete','util','connect-timeout','Router','../../config/environment','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x58383f,_0x3ec27a){var _0x339915=function(_0x58e57d){while(--_0x58e57d){_0x58383f['push'](_0x58383f['shift']());}};_0x339915(++_0x3ec27a);}(_0xfb0d,0x1dc));var _0xdfb0=function(_0x3ae0b9,_0x283a4d){_0x3ae0b9=_0x3ae0b9-0x0;var _0x33c9df=_0xfb0d[_0x3ae0b9];return _0x33c9df;};'use strict';var multer=require('multer');var util=require(_0xdfb0('0x0'));var path=require('path');var timeout=require(_0xdfb0('0x1'));var express=require('express');var router=express[_0xdfb0('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdfb0('0x3'));var controller=require(_0xdfb0('0x4'));router[_0xdfb0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdfb0('0x5')](_0xdfb0('0x6'),auth[_0xdfb0('0x7')](),controller[_0xdfb0('0x8')]);router[_0xdfb0('0x5')](_0xdfb0('0x9'),auth[_0xdfb0('0x7')](),controller[_0xdfb0('0xa')]);router[_0xdfb0('0x5')](_0xdfb0('0xb'),auth[_0xdfb0('0x7')](),controller[_0xdfb0('0xc')]);router[_0xdfb0('0xd')]('/',auth[_0xdfb0('0x7')](),controller[_0xdfb0('0xe')]);router[_0xdfb0('0xd')](_0xdfb0('0x9'),auth[_0xdfb0('0x7')](),controller['addConfiguration']);router[_0xdfb0('0xf')](_0xdfb0('0x6'),auth['isAuthenticated'](),controller[_0xdfb0('0x10')]);router[_0xdfb0('0x11')](_0xdfb0('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a59=['create','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','./intDynamics365Account.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields'];(function(_0x2ed235,_0x47f748){var _0xeef0af=function(_0x2ef32b){while(--_0x2ef32b){_0x2ed235['push'](_0x2ed235['shift']());}};_0xeef0af(++_0x47f748);}(_0x0a59,0x8f));var _0x90a5=function(_0x3c397e,_0x4df845){_0x3c397e=_0x3c397e-0x0;var _0x2afe9b=_0x0a59[_0x3c397e];return _0x2afe9b;};'use strict';var multer=require(_0x90a5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x90a5('0x1'));var express=require('express');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('../../config/environment');var controller=require(_0x90a5('0x2'));router['get']('/',auth[_0x90a5('0x3')](),controller[_0x90a5('0x4')]);router[_0x90a5('0x5')](_0x90a5('0x6'),auth['isAuthenticated'](),controller[_0x90a5('0x7')]);router[_0x90a5('0x5')](_0x90a5('0x8'),auth[_0x90a5('0x3')](),controller['getConfigurations']);router[_0x90a5('0x5')](_0x90a5('0x9'),auth[_0x90a5('0x3')](),controller['getFields']);router['post']('/',auth[_0x90a5('0x3')](),controller[_0x90a5('0xa')]);router['post'](_0x90a5('0x8'),auth[_0x90a5('0x3')](),controller[_0x90a5('0xb')]);router[_0x90a5('0xc')](_0x90a5('0x6'),auth['isAuthenticated'](),controller[_0x90a5('0xd')]);router[_0x90a5('0xe')]('/:id',auth[_0x90a5('0x3')](),controller[_0x90a5('0xf')]);module[_0x90a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f44e47b..8751972 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 _0x2327=['exports','STRING'];(function(_0x399b64,_0x39ce40){var _0xd497ff=function(_0x538939){while(--_0x538939){_0x399b64['push'](_0x399b64['shift']());}};_0xd497ff(++_0x39ce40);}(_0x2327,0x13c));var _0x7232=function(_0x4871f4,_0x2c1f0){_0x4871f4=_0x4871f4-0x0;var _0x565f30=_0x2327[_0x4871f4];return _0x565f30;};'use strict';var Sequelize=require('sequelize');module[_0x7232('0x0')]={'name':{'type':Sequelize[_0x7232('0x1')]},'username':{'type':Sequelize[_0x7232('0x1')]},'password':{'type':Sequelize[_0x7232('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x7232('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x7232('0x1')]}}; \ No newline at end of file +var _0xc1b2=['sequelize','exports','STRING'];(function(_0x36a9ba,_0x14fd6a){var _0x11b908=function(_0x635cb5){while(--_0x635cb5){_0x36a9ba['push'](_0x36a9ba['shift']());}};_0x11b908(++_0x14fd6a);}(_0xc1b2,0xc0));var _0x2c1b=function(_0x3bb477,_0x28d590){_0x3bb477=_0x3bb477-0x0;var _0x313450=_0xc1b2[_0x3bb477];return _0x313450;};'use strict';var Sequelize=require(_0x2c1b('0x0'));module[_0x2c1b('0x1')]={'name':{'type':Sequelize[_0x2c1b('0x2')]},'username':{'type':Sequelize[_0x2c1b('0x2')]},'password':{'type':Sequelize[_0x2c1b('0x2')]},'remoteUri':{'type':Sequelize[_0x2c1b('0x2')]},'tenantId':{'type':Sequelize[_0x2c1b('0x2')]},'clientId':{'type':Sequelize[_0x2c1b('0x2')]},'clientSecret':{'type':Sequelize[_0x2c1b('0x2')]},'serverUrl':{'type':Sequelize[_0x2c1b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2c1b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index dd9586b..90383ff 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 _0xdefc=['statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Account','type','key','model','map','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','include','create','body','find','getConfigurations','findOne','Dynamics365Configuration','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridyominame','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','password','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','Wrong\x20credentials'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xdefc,0x1b3));var _0xcdef=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0xdefc[_0x2f6233];return _0x1c9c36;};'use strict';var emlformat=require(_0xcdef('0x0'));var rimraf=require(_0xcdef('0x1'));var zipdir=require(_0xcdef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcdef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcdef('0x4'));var util=require(_0xcdef('0x5'));var path=require(_0xcdef('0x6'));var sox=require(_0xcdef('0x7'));var csv=require(_0xcdef('0x8'));var ejs=require(_0xcdef('0x9'));var fs=require('fs');var fs_extra=require(_0xcdef('0xa'));var _=require('lodash');var squel=require(_0xcdef('0xb'));var crypto=require('crypto');var jsforce=require(_0xcdef('0xc'));var deskjs=require(_0xcdef('0xd'));var toCsv=require(_0xcdef('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcdef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcdef('0xf'));var as=require(_0xcdef('0x10'));var hardwareService=require(_0xcdef('0x11'));var logger=require(_0xcdef('0x12'))(_0xcdef('0x13'));var utils=require(_0xcdef('0x14'));var config=require(_0xcdef('0x15'));var licenseUtil=require(_0xcdef('0x16'));var db=require(_0xcdef('0x17'))['db'];var integrations=require(_0xcdef('0x18'));function respondWithStatusCode(_0x21c400,_0x418c26){_0x418c26=_0x418c26||0xcc;return function(_0x15671f){if(_0x15671f){return _0x21c400[_0xcdef('0x19')](_0x418c26);}return _0x21c400['status'](_0x418c26)[_0xcdef('0x1a')]();};}function respondWithResult(_0x4b64a3,_0x50f19e){_0x50f19e=_0x50f19e||0xc8;return function(_0xe17ef){if(_0xe17ef){return _0x4b64a3[_0xcdef('0x1b')](_0x50f19e)['json'](_0xe17ef);}};}function respondWithFilteredResult(_0x28c0d4,_0x6e0906){return function(_0x4d173b){if(_0x4d173b){var _0x37ab2d=typeof _0x6e0906[_0xcdef('0x1c')]===_0xcdef('0x1d')&&typeof _0x6e0906[_0xcdef('0x1e')]===_0xcdef('0x1d');var _0x562e98=_0x4d173b[_0xcdef('0x1f')];var _0x25cad1=_0x37ab2d?0x0:_0x6e0906[_0xcdef('0x1c')];var _0x13dd7d=_0x37ab2d?_0x4d173b[_0xcdef('0x1f')]:_0x6e0906[_0xcdef('0x1c')]+_0x6e0906['limit'];var _0x35ccd3;if(_0x13dd7d>=_0x562e98){_0x13dd7d=_0x562e98;_0x35ccd3=0xc8;}else{_0x35ccd3=0xce;}_0x28c0d4['status'](_0x35ccd3);return _0x28c0d4['set'](_0xcdef('0x20'),_0x25cad1+'-'+_0x13dd7d+'/'+_0x562e98)[_0xcdef('0x21')](_0x4d173b);}return null;};}function patchUpdates(_0x4c4421){return function(_0x44402a){try{jsonpatch[_0xcdef('0x22')](_0x44402a,_0x4c4421,!![]);}catch(_0x415d58){return BPromise[_0xcdef('0x23')](_0x415d58);}return _0x44402a[_0xcdef('0x24')]();};}function saveUpdates(_0x2894cf,_0x4f91a1){return function(_0x399c82){if(_0x399c82){return _0x399c82[_0xcdef('0x25')](_0x2894cf)[_0xcdef('0x26')](function(_0x4ca6dc){return _0x4ca6dc;});}return null;};}function removeEntity(_0x528167,_0x2df6e1){return function(_0x87debd){if(_0x87debd){return _0x87debd[_0xcdef('0x27')]()['then'](function(){_0x528167['status'](0xcc)[_0xcdef('0x1a')]();});}};}function handleEntityNotFound(_0x31ad40,_0x45794f){return function(_0x12d823){if(!_0x12d823){_0x31ad40['sendStatus'](0x194);}return _0x12d823;};}function handleError(_0x14601b,_0x21ce9b){_0x21ce9b=_0x21ce9b||0x1f4;return function(_0x3f0fc8){logger[_0xcdef('0x28')](_0x3f0fc8[_0xcdef('0x29')]);if(_0x3f0fc8[_0xcdef('0x2a')]){delete _0x3f0fc8[_0xcdef('0x2a')];}_0x14601b['status'](_0x21ce9b)[_0xcdef('0x2b')](_0x3f0fc8);};}exports[_0xcdef('0x2c')]=function(_0x3a1767,_0x4d575f){var _0x42eae9={},_0x1e7b3e={},_0x248e51={'count':0x0,'rows':[]};var _0x4416b4=_['map'](db[_0xcdef('0x2d')]['rawAttributes'],function(_0x267457){return{'name':_0x267457['fieldName'],'type':_0x267457[_0xcdef('0x2e')][_0xcdef('0x2f')]};});_0x1e7b3e[_0xcdef('0x30')]=_[_0xcdef('0x31')](_0x4416b4,_0xcdef('0x2a'));_0x1e7b3e[_0xcdef('0x32')]=_[_0xcdef('0x33')](_0x3a1767[_0xcdef('0x32')]);_0x1e7b3e['filters']=_[_0xcdef('0x34')](_0x1e7b3e[_0xcdef('0x30')],_0x1e7b3e[_0xcdef('0x32')]);_0x42eae9['attributes']=_['intersection'](_0x1e7b3e[_0xcdef('0x30')],qs[_0xcdef('0x35')](_0x3a1767['query']['fields']));_0x42eae9[_0xcdef('0x36')]=_0x42eae9[_0xcdef('0x36')][_0xcdef('0x37')]?_0x42eae9[_0xcdef('0x36')]:_0x1e7b3e[_0xcdef('0x30')];if(!_0x3a1767[_0xcdef('0x32')]['hasOwnProperty']('nolimit')){_0x42eae9['limit']=qs['limit'](_0x3a1767[_0xcdef('0x32')][_0xcdef('0x1e')]);_0x42eae9[_0xcdef('0x1c')]=qs['offset'](_0x3a1767[_0xcdef('0x32')]['offset']);}_0x42eae9[_0xcdef('0x38')]=qs[_0xcdef('0x39')](_0x3a1767[_0xcdef('0x32')][_0xcdef('0x39')]);_0x42eae9[_0xcdef('0x3a')]=qs[_0xcdef('0x3b')](_[_0xcdef('0x3c')](_0x3a1767[_0xcdef('0x32')],_0x1e7b3e[_0xcdef('0x3b')]),_0x4416b4);if(_0x3a1767['query'][_0xcdef('0x3d')]){_0x42eae9[_0xcdef('0x3a')]=_[_0xcdef('0x3e')](_0x42eae9[_0xcdef('0x3a')],{'$or':_[_0xcdef('0x31')](_0x4416b4,function(_0x3b487d){if(_0x3b487d[_0xcdef('0x2e')]!==_0xcdef('0x3f')){var _0x7b719b={};_0x7b719b[_0x3b487d[_0xcdef('0x2a')]]={'$like':'%'+_0x3a1767[_0xcdef('0x32')]['filter']+'%'};return _0x7b719b;}})});}_0x42eae9=_[_0xcdef('0x3e')]({},_0x42eae9,_0x3a1767[_0xcdef('0x40')]);var _0x36f4b6={'where':_0x42eae9[_0xcdef('0x3a')]};return db['Dynamics365Account'][_0xcdef('0x1f')](_0x36f4b6)['then'](function(_0x57bda9){_0x248e51['count']=_0x57bda9;if(_0x3a1767[_0xcdef('0x32')][_0xcdef('0x41')]){_0x42eae9['include']=[{'all':!![]}];}return db[_0xcdef('0x2d')]['findAll'](_0x42eae9);})['then'](function(_0x523c14){_0x248e51[_0xcdef('0x42')]=_0x523c14;return _0x248e51;})['then'](respondWithFilteredResult(_0x4d575f,_0x42eae9))[_0xcdef('0x43')](handleError(_0x4d575f,null));};exports['show']=function(_0x51f80a,_0x20eb7e){var _0x4b8362={'raw':![],'where':{'id':_0x51f80a[_0xcdef('0x44')]['id']}},_0x5ce041={};_0x5ce041[_0xcdef('0x30')]=_[_0xcdef('0x33')](db[_0xcdef('0x2d')][_0xcdef('0x45')]);_0x5ce041[_0xcdef('0x32')]=_[_0xcdef('0x33')](_0x51f80a[_0xcdef('0x32')]);_0x5ce041[_0xcdef('0x3b')]=_[_0xcdef('0x34')](_0x5ce041[_0xcdef('0x30')],_0x5ce041[_0xcdef('0x32')]);_0x4b8362[_0xcdef('0x36')]=_[_0xcdef('0x34')](_0x5ce041[_0xcdef('0x30')],qs[_0xcdef('0x35')](_0x51f80a[_0xcdef('0x32')][_0xcdef('0x35')]));_0x4b8362['attributes']=_0x4b8362[_0xcdef('0x36')]['length']?_0x4b8362['attributes']:_0x5ce041[_0xcdef('0x30')];if(_0x51f80a[_0xcdef('0x32')]['includeAll']){_0x4b8362[_0xcdef('0x46')]=[{'all':!![]}];}_0x4b8362=_[_0xcdef('0x3e')]({},_0x4b8362,_0x51f80a['options']);return db[_0xcdef('0x2d')]['find'](_0x4b8362)[_0xcdef('0x26')](handleEntityNotFound(_0x20eb7e,null))[_0xcdef('0x26')](respondWithResult(_0x20eb7e,null))[_0xcdef('0x43')](handleError(_0x20eb7e,null));};exports[_0xcdef('0x47')]=function(_0x1a73fb,_0x33a5df){return db[_0xcdef('0x2d')][_0xcdef('0x47')](_0x1a73fb[_0xcdef('0x48')],{})['then'](respondWithResult(_0x33a5df,0xc9))[_0xcdef('0x43')](handleError(_0x33a5df,null));};exports[_0xcdef('0x25')]=function(_0x22b486,_0x5c02a2){if(_0x22b486[_0xcdef('0x48')]['id']){delete _0x22b486[_0xcdef('0x48')]['id'];}return db[_0xcdef('0x2d')][_0xcdef('0x49')]({'where':{'id':_0x22b486[_0xcdef('0x44')]['id']}})[_0xcdef('0x26')](handleEntityNotFound(_0x5c02a2,null))['then'](saveUpdates(_0x22b486[_0xcdef('0x48')],null))[_0xcdef('0x26')](respondWithResult(_0x5c02a2,null))[_0xcdef('0x43')](handleError(_0x5c02a2,null));};exports[_0xcdef('0x27')]=function(_0x1a5153,_0x2e1065){return db['Dynamics365Account'][_0xcdef('0x49')]({'where':{'id':_0x1a5153[_0xcdef('0x44')]['id']}})[_0xcdef('0x26')](handleEntityNotFound(_0x2e1065,null))['then'](removeEntity(_0x2e1065,null))[_0xcdef('0x43')](handleError(_0x2e1065,null));};exports[_0xcdef('0x4a')]=function(_0x55bed6,_0x4fff92,_0x2f162a){var _0x3a6c35={};var _0x2b4931={};var _0x33afc9;var _0x1ab54f;return db[_0xcdef('0x2d')][_0xcdef('0x4b')]({'where':{'id':_0x55bed6[_0xcdef('0x44')]['id']}})[_0xcdef('0x26')](handleEntityNotFound(_0x4fff92,null))[_0xcdef('0x26')](function(_0x1e1a65){if(_0x1e1a65){_0x33afc9=_0x1e1a65;_0x2b4931[_0xcdef('0x30')]=_[_0xcdef('0x33')](db[_0xcdef('0x4c')]['rawAttributes']);_0x2b4931[_0xcdef('0x32')]=_[_0xcdef('0x33')](_0x55bed6[_0xcdef('0x32')]);_0x2b4931[_0xcdef('0x3b')]=_[_0xcdef('0x34')](_0x2b4931[_0xcdef('0x30')],_0x2b4931[_0xcdef('0x32')]);_0x3a6c35[_0xcdef('0x36')]=_[_0xcdef('0x34')](_0x2b4931[_0xcdef('0x30')],qs[_0xcdef('0x35')](_0x55bed6[_0xcdef('0x32')][_0xcdef('0x35')]));_0x3a6c35[_0xcdef('0x36')]=_0x3a6c35[_0xcdef('0x36')][_0xcdef('0x37')]?_0x3a6c35[_0xcdef('0x36')]:_0x2b4931[_0xcdef('0x30')];_0x3a6c35[_0xcdef('0x38')]=qs[_0xcdef('0x39')](_0x55bed6[_0xcdef('0x32')]['sort']);_0x3a6c35[_0xcdef('0x3a')]=qs[_0xcdef('0x3b')](_[_0xcdef('0x3c')](_0x55bed6[_0xcdef('0x32')],_0x2b4931[_0xcdef('0x3b')]));if(_0x55bed6['query'][_0xcdef('0x3d')]){_0x3a6c35[_0xcdef('0x3a')]=_['merge'](_0x3a6c35[_0xcdef('0x3a')],{'$or':_[_0xcdef('0x31')](_0x3a6c35[_0xcdef('0x36')],function(_0x1d8748){var _0x925f87={};_0x925f87[_0x1d8748]={'$like':'%'+_0x55bed6[_0xcdef('0x32')][_0xcdef('0x3d')]+'%'};return _0x925f87;})});}_0x3a6c35=_[_0xcdef('0x3e')]({},_0x3a6c35,_0x55bed6[_0xcdef('0x40')]);return _0x33afc9[_0xcdef('0x4a')](_0x3a6c35);}})[_0xcdef('0x26')](function(_0x318118){if(_0x318118){_0x1ab54f=_0x318118[_0xcdef('0x37')];if(!_0x55bed6['query'][_0xcdef('0x4d')](_0xcdef('0x4e'))){_0x3a6c35[_0xcdef('0x1e')]=qs['limit'](_0x55bed6[_0xcdef('0x32')][_0xcdef('0x1e')]);_0x3a6c35[_0xcdef('0x1c')]=qs[_0xcdef('0x1c')](_0x55bed6['query']['offset']);}return _0x33afc9[_0xcdef('0x4a')](_0x3a6c35);}})[_0xcdef('0x26')](function(_0x4b135c){if(_0x4b135c){return _0x4b135c?{'count':_0x1ab54f,'rows':_0x4b135c}:null;}})[_0xcdef('0x26')](respondWithResult(_0x4fff92,null))[_0xcdef('0x43')](handleError(_0x4fff92,null));};exports[_0xcdef('0x4f')]=function(_0x203f0e,_0x231121,_0x373497){if(_0x203f0e['body']['id']){delete _0x203f0e[_0xcdef('0x48')]['id'];}return db[_0xcdef('0x2d')][_0xcdef('0x4b')]({'where':{'id':_0x203f0e[_0xcdef('0x44')]['id']}})[_0xcdef('0x26')](handleEntityNotFound(_0x231121,null))[_0xcdef('0x26')](function(_0x1449af){if(_0x1449af){_0x203f0e[_0xcdef('0x48')][_0xcdef('0x50')]=_0x1449af['id'];_0x203f0e[_0xcdef('0x48')][_0xcdef('0x51')]=integrations[_0xcdef('0x52')](_0x203f0e[_0xcdef('0x48')]['channel'],_0x203f0e['body']['type']);_0x203f0e[_0xcdef('0x48')][_0xcdef('0x53')]=integrations[_0xcdef('0x54')](_0x203f0e[_0xcdef('0x48')]['channel'],_0x203f0e[_0xcdef('0x48')][_0xcdef('0x2e')]);return db[_0xcdef('0x4c')][_0xcdef('0x47')](_0x203f0e[_0xcdef('0x48')],{'include':[{'model':db[_0xcdef('0x55')],'as':_0xcdef('0x51')},{'model':db['Dynamics365Field'],'as':_0xcdef('0x53')}]});}return null;})[_0xcdef('0x26')](respondWithResult(_0x231121,null))['catch'](handleError(_0x231121,null));};exports['getFields']=function(_0x153aff,_0x11e104,_0x202e12){var _0x177454=_0x153aff[_0xcdef('0x32')][_0xcdef('0x56')];var _0x330aba=_0x177454===_0xcdef('0x57')?_0xcdef('0x58'):_0xcdef('0x59');var _0x30ad28='';var _0x29c100='';var _0x3c7c41='';var _0x28be93='';var _0x281fe8='';var _0x4be0e2='';var _0x201d3e='';var _0x4bc706='';var _0x14f930=[_0xcdef('0x5a'),_0xcdef('0x5b'),_0xcdef('0x5c'),_0xcdef('0x5d'),'caseorigincode',_0xcdef('0x5e'),_0xcdef('0x5f'),_0xcdef('0x60'),_0xcdef('0x61'),_0xcdef('0x62')];var _0x4aeb28=['accountidname',_0xcdef('0x63'),_0xcdef('0x64'),_0xcdef('0x65'),_0xcdef('0x66'),_0xcdef('0x67'),'contractdetailidname',_0xcdef('0x68'),_0xcdef('0x69'),_0xcdef('0x6a'),'createdbyname',_0xcdef('0x6b'),_0xcdef('0x6c'),_0xcdef('0x6d'),'createdonbehalfbyyominame',_0xcdef('0x6e'),'customeridtype',_0xcdef('0x6f'),'emailaddress','entitlementidname',_0xcdef('0x70'),_0xcdef('0x71'),_0xcdef('0x72'),_0xcdef('0x73'),_0xcdef('0x74'),_0xcdef('0x75'),_0xcdef('0x76'),_0xcdef('0x77'),_0xcdef('0x78'),'lastonholdtime',_0xcdef('0x79'),_0xcdef('0x7a'),'modifiedbyexternalpartyyominame','modifiedbyname',_0xcdef('0x7b'),_0xcdef('0x7c'),_0xcdef('0x7d'),_0xcdef('0x7e'),_0xcdef('0x7f'),_0xcdef('0x80'),_0xcdef('0x81'),_0xcdef('0x82'),'overriddencreatedon',_0xcdef('0x83'),_0xcdef('0x84'),_0xcdef('0x85'),'parentcaseidname','primarycontactidname',_0xcdef('0x86'),_0xcdef('0x87'),_0xcdef('0x88'),'productserialnumber',_0xcdef('0x89'),_0xcdef('0x8a'),_0xcdef('0x8b'),'responsiblecontactidname',_0xcdef('0x8c'),_0xcdef('0x8d'),_0xcdef('0x8e'),_0xcdef('0x8f'),'socialprofileidname',_0xcdef('0x90'),_0xcdef('0x91'),_0xcdef('0x92'),_0xcdef('0x93'),'timezoneruleversionnumber',_0xcdef('0x94'),_0xcdef('0x95'),_0xcdef('0x96'),_0xcdef('0x97')];var _0x10bd29=_0x14f930[_0xcdef('0x98')](_0x4aeb28);return db[_0xcdef('0x2d')][_0xcdef('0x4b')]({'where':{'id':_0x153aff[_0xcdef('0x44')]['id']},'attributes':['id',_0xcdef('0x99'),'password','remoteUri',_0xcdef('0x9a'),_0xcdef('0x9b'),_0xcdef('0x9c')]})[_0xcdef('0x26')](handleEntityNotFound(_0x11e104,null))['then'](function(_0x3957c5){if(_0x3957c5){_0x4bc706=_0x3957c5['remoteUri'];var _0x2daa05=_0x4bc706[_0xcdef('0x9d')](-0x1);if(_0x2daa05==='/'){_0x4bc706=_0x4bc706[_0xcdef('0x9e')](0x0,_0x4bc706[_0xcdef('0x9f')](_0x2daa05));}_0x201d3e=util['format'](_0xcdef('0xa0'),_0x4bc706);var _0x35d330={'method':'POST','uri':_0xcdef('0xa1')+_0x3957c5[_0xcdef('0x9a')]+_0xcdef('0xa2'),'form':{'client_id':_0x3957c5[_0xcdef('0x9b')],'resource':_0x4bc706,'username':_0x3957c5['username'],'password':_0x3957c5[_0xcdef('0xa3')],'grant_type':'password','client_secret':_0x3957c5['clientSecret']},'json':!![]};return rp(_0x35d330);}})[_0xcdef('0x26')](function(_0x5142e1){_0x4be0e2=_0x5142e1[_0xcdef('0xa4')];var _0x34cc31={'method':_0xcdef('0xa5'),'uri':encodeURI(_0x201d3e+_0xcdef('0xa6')+_0x330aba+'\x27'),'headers':{'Authorization':_0xcdef('0xa7')+_0x4be0e2,'If-None-Match':null,'OData-Version':_0xcdef('0xa8')},'json':!![]};return rp(_0x34cc31);})[_0xcdef('0x26')](function(_0x593edb){var _0x2670b9=_0x593edb[_0xcdef('0xa9')][0x0];var _0x2ca25a=_0x2670b9[_0xcdef('0xaa')];var _0x32a6f5={'method':_0xcdef('0xa5'),'uri':_0x201d3e+_0xcdef('0xab')+_0x2ca25a+_0xcdef('0xac'),'headers':{'Authorization':_0xcdef('0xa7')+_0x4be0e2,'If-None-Match':null,'OData-Version':_0xcdef('0xa8')},'json':!![]};return rp(_0x32a6f5);})[_0xcdef('0x26')](function(_0x3320ad){_0x30ad28=_0x3320ad;_0x29c100=_0x30ad28[_0xcdef('0xad')];_0x29c100=_[_0xcdef('0xae')](_0x29c100,function(_0x331969){return!_0x10bd29[_0xcdef('0xaf')](_0x331969['LogicalName']);});var _0x34f2da=[];var _0x8bd533=[];_0x29c100[_0xcdef('0xb0')](function(_0x441c76){if(_0x441c76[_0xcdef('0xb1')]){var _0x71a244=_0x441c76['@odata.type'][_0xcdef('0x9e')](_0x441c76[_0xcdef('0xb1')][_0xcdef('0x9f')]('.')+0x1);if(_0x71a244===_0xcdef('0xb2')){_0x34f2da['push'](getSelectList(_0x201d3e,_0x177454,_0x8bd533,_0x30ad28[_0xcdef('0xaa')],_0x441c76['MetadataId'],_0x4be0e2));}}});return Promise['all'](_0x34f2da);})[_0xcdef('0x26')](function(_0x463534){_0x3c7c41=_0x463534[0x0];var _0x4b9fcc=[];var _0x48b8a7=[];_0x29c100[_0xcdef('0xb0')](function(_0xf80414){if(!_[_0xcdef('0xb3')](_0xf80414[_0xcdef('0xb1')])){var _0x30a84f=_0xf80414[_0xcdef('0xb1')][_0xcdef('0x9e')](_0xf80414[_0xcdef('0xb1')]['lastIndexOf']('.')+0x1);if(_0x30a84f===_0xcdef('0xb4')){_0x4b9fcc[_0xcdef('0xb5')](getBooleanList(_0x201d3e,_0x177454,_0x48b8a7,_0x30ad28[_0xcdef('0xaa')],_0xf80414[_0xcdef('0xaa')],_0x4be0e2));}}});return Promise[_0xcdef('0xb6')](_0x4b9fcc);})[_0xcdef('0x26')](function(_0x5cacad){_0x28be93=_0x5cacad[0x0];var _0x34c42c=[];var _0xd27a6b=[];_0x29c100[_0xcdef('0xb0')](function(_0x5534d3){if(_0x5534d3['@odata.type']){var _0x25116c=_0x5534d3['@odata.type'][_0xcdef('0x9e')](_0x5534d3['@odata.type'][_0xcdef('0x9f')]('.')+0x1);if(_0x25116c==='StringAttributeMetadata'||_0x25116c===_0xcdef('0xb7')||_0x25116c===_0xcdef('0xb8')||_0x25116c===_0xcdef('0xb9')||_0x25116c==='MemoAttributeMetadata'||_0x25116c===_0xcdef('0xba')||_0x25116c===_0xcdef('0xbb')||_0x25116c===_0xcdef('0xbc')||_0x25116c==='StateAttributeMetadata'||_0x25116c===_0xcdef('0xbd')){_0x34c42c['push'](getInputList(_0x201d3e,_0x177454,_0x25116c,_0xd27a6b,_0x30ad28[_0xcdef('0xaa')],_0x5534d3[_0xcdef('0xaa')],_0x4be0e2));}}});return Promise[_0xcdef('0xb6')](_0x34c42c);})[_0xcdef('0x26')](function(_0x2d5154){_0x281fe8=_0x2d5154[0x0];var _0x4c968c=_0x3c7c41[_0xcdef('0x98')](_0x28be93)[_0xcdef('0x98')](_0x281fe8);var _0x20cd0a={'count':_0x4c968c[_0xcdef('0x37')],'rows':_0x4c968c};return _0x20cd0a;})[_0xcdef('0x26')](respondWithResult(_0x11e104,null))[_0xcdef('0x43')](function(_0x127506){var _0x12cc3d=_0x153aff[_0xcdef('0x32')]['test']?0x1f4:_0x127506['statusCode']||0x1f4;logger[_0xcdef('0x28')](_0x127506['stack']);delete _0x127506[_0xcdef('0x2a')];if(_0x12cc3d===0x191){_0x12cc3d=0x190;}_0x11e104[_0xcdef('0x1b')](_0x12cc3d)[_0xcdef('0x2b')](_0x153aff[_0xcdef('0x32')][_0xcdef('0xbe')]?{'message':_0xcdef('0xbf'),'statusCode':_0x127506[_0xcdef('0xc0')]}:_0x127506);});};function getSelectList(_0x163738,_0x2c5fc6,_0x1f3f53,_0xdb6c5e,_0x1c95ae,_0x1c9f91){var _0x1fc81f={'method':_0xcdef('0xa5'),'uri':_0x163738+_0xcdef('0xab')+_0xdb6c5e+_0xcdef('0xc1')+_0x1c95ae+_0xcdef('0xc2')+_0xcdef('0xc3'),'headers':{'Authorization':'Bearer\x20'+_0x1c9f91,'If-None-Match':null,'OData-Version':_0xcdef('0xa8')},'json':!![]};return rp(_0x1fc81f)[_0xcdef('0x26')](function(_0x25f957){var _0x5806cb=[];var _0x12041f=_0x25f957[_0xcdef('0xc4')][_0xcdef('0xc5')];_0x12041f[_0xcdef('0xb0')](function(_0x447266){_0x5806cb[_0xcdef('0xb5')]({'name':_0x447266[_0xcdef('0xc6')][_0xcdef('0xc7')][_0xcdef('0xc6')],'value':String(_0x447266[_0xcdef('0xc8')])});});var _0x148366={'id':_0x2c5fc6+'_'+_0x25f957['LogicalName'],'name':_0x25f957['DisplayName'][_0xcdef('0xc7')][_0xcdef('0xc6')],'custom':![],'options':_0x5806cb};_0x1f3f53['push'](_0x148366);return _0x1f3f53;});}function getBooleanList(_0x4b0cd7,_0x8789de,_0x35c855,_0x48e8e0,_0x330645,_0x4aa888){var _0x1d7048={'method':_0xcdef('0xa5'),'uri':_0x4b0cd7+_0xcdef('0xab')+_0x48e8e0+')/Attributes('+_0x330645+_0xcdef('0xc9'),'headers':{'Authorization':_0xcdef('0xa7')+_0x4aa888,'If-None-Match':null,'OData-Version':_0xcdef('0xa8')},'json':!![]};return rp(_0x1d7048)['then'](function(_0x2471c8){var _0x3ea22e=[];_0x3ea22e[_0xcdef('0xb5')]({'name':_0x2471c8[_0xcdef('0xc4')][_0xcdef('0xca')][_0xcdef('0xc6')][_0xcdef('0xc7')]['Label'],'value':'true'},{'name':_0x2471c8[_0xcdef('0xc4')][_0xcdef('0xcb')][_0xcdef('0xc6')]['UserLocalizedLabel'][_0xcdef('0xc6')],'value':_0xcdef('0xcc')});var _0x398157={'id':_0x8789de+'_'+_0x2471c8[_0xcdef('0xcd')],'name':_0x2471c8[_0xcdef('0xce')][_0xcdef('0xc7')][_0xcdef('0xc6')],'custom':![],'options':_0x3ea22e};_0x35c855['push'](_0x398157);return _0x35c855;});}function getInputList(_0x3040d8,_0x45baf5,_0x55b7f3,_0x30a5f9,_0x349b8f,_0x4897e5,_0x24320d){var _0x2c7565={'method':'GET','uri':_0x3040d8+_0xcdef('0xab')+_0x349b8f+_0xcdef('0xc1')+_0x4897e5+_0xcdef('0xcf')+_0x55b7f3+_0xcdef('0xd0'),'headers':{'Authorization':_0xcdef('0xa7')+_0x24320d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2c7565)[_0xcdef('0x26')](function(_0xe1e69e){var _0x186cc5={'id':_0x45baf5+'_'+_0xe1e69e[_0xcdef('0xcd')],'name':_0xe1e69e['DisplayName']['UserLocalizedLabel']?_0xe1e69e[_0xcdef('0xce')]['UserLocalizedLabel']['Label']:_0xe1e69e[_0xcdef('0xcd')],'custom':![],'options':[]};_0x30a5f9[_0xcdef('0xb5')](_0x186cc5);return _0x30a5f9;});} \ No newline at end of file +var _0x2dd3=['description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','transactioncurrencyidname','traversedpath','versionnumber','password','remoteUri','clientId','clientSecret','slice','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','GET','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','?$select=DisplayName,LogicalName','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','send','index','fieldName','key','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','Dynamics365Account','include','params','rawAttributes','includeAll','find','catch','create','body','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','Dynamics365Configuration','getFields','ticketType','PhoneCall'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x2dd3,0x6e));var _0x32dd=function(_0x9d426d,_0x1c0041){_0x9d426d=_0x9d426d-0x0;var _0x4ec3d9=_0x2dd3[_0x9d426d];return _0x4ec3d9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x32dd('0x0'));var zipdir=require(_0x32dd('0x1'));var jsonpatch=require(_0x32dd('0x2'));var rp=require(_0x32dd('0x3'));var moment=require(_0x32dd('0x4'));var BPromise=require(_0x32dd('0x5'));var Mustache=require('mustache');var util=require(_0x32dd('0x6'));var path=require(_0x32dd('0x7'));var sox=require(_0x32dd('0x8'));var csv=require(_0x32dd('0x9'));var ejs=require(_0x32dd('0xa'));var fs=require('fs');var fs_extra=require(_0x32dd('0xb'));var _=require(_0x32dd('0xc'));var squel=require(_0x32dd('0xd'));var crypto=require(_0x32dd('0xe'));var jsforce=require(_0x32dd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x32dd('0x9'));var querystring=require('querystring');var Papa=require(_0x32dd('0x10'));var Redis=require(_0x32dd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x32dd('0x12'));var as=require(_0x32dd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32dd('0x14'))(_0x32dd('0x15'));var utils=require(_0x32dd('0x16'));var config=require(_0x32dd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x32dd('0x18'))['db'];var integrations=require(_0x32dd('0x19'));function respondWithStatusCode(_0x19d460,_0x3ff59a){_0x3ff59a=_0x3ff59a||0xcc;return function(_0x4f884){if(_0x4f884){return _0x19d460[_0x32dd('0x1a')](_0x3ff59a);}return _0x19d460[_0x32dd('0x1b')](_0x3ff59a)[_0x32dd('0x1c')]();};}function respondWithResult(_0x4e139a,_0x147e5b){_0x147e5b=_0x147e5b||0xc8;return function(_0x183431){if(_0x183431){return _0x4e139a[_0x32dd('0x1b')](_0x147e5b)[_0x32dd('0x1d')](_0x183431);}};}function respondWithFilteredResult(_0x1c917b,_0x552f68){return function(_0x458555){if(_0x458555){var _0x313441=typeof _0x552f68[_0x32dd('0x1e')]==='undefined'&&typeof _0x552f68['limit']==='undefined';var _0x35d4f5=_0x458555[_0x32dd('0x1f')];var _0x575047=_0x313441?0x0:_0x552f68[_0x32dd('0x1e')];var _0x13551b=_0x313441?_0x458555['count']:_0x552f68[_0x32dd('0x1e')]+_0x552f68[_0x32dd('0x20')];var _0x4dd8b5;if(_0x13551b>=_0x35d4f5){_0x13551b=_0x35d4f5;_0x4dd8b5=0xc8;}else{_0x4dd8b5=0xce;}_0x1c917b[_0x32dd('0x1b')](_0x4dd8b5);return _0x1c917b[_0x32dd('0x21')](_0x32dd('0x22'),_0x575047+'-'+_0x13551b+'/'+_0x35d4f5)[_0x32dd('0x1d')](_0x458555);}return null;};}function patchUpdates(_0x598d41){return function(_0x546dd9){try{jsonpatch['apply'](_0x546dd9,_0x598d41,!![]);}catch(_0x1a33e6){return BPromise[_0x32dd('0x23')](_0x1a33e6);}return _0x546dd9['save']();};}function saveUpdates(_0xe1ff88,_0x548b10){return function(_0x1e5eec){if(_0x1e5eec){return _0x1e5eec[_0x32dd('0x24')](_0xe1ff88)[_0x32dd('0x25')](function(_0x29d36d){return _0x29d36d;});}return null;};}function removeEntity(_0x854608,_0x33afd0){return function(_0xd27aa0){if(_0xd27aa0){return _0xd27aa0[_0x32dd('0x26')]()['then'](function(){_0x854608[_0x32dd('0x1b')](0xcc)[_0x32dd('0x1c')]();});}};}function handleEntityNotFound(_0x30f0ba,_0x3449ef){return function(_0x4c7103){if(!_0x4c7103){_0x30f0ba[_0x32dd('0x1a')](0x194);}return _0x4c7103;};}function handleError(_0x45be5f,_0x3d3397){_0x3d3397=_0x3d3397||0x1f4;return function(_0x59d4f8){logger[_0x32dd('0x27')](_0x59d4f8[_0x32dd('0x28')]);if(_0x59d4f8['name']){delete _0x59d4f8['name'];}_0x45be5f[_0x32dd('0x1b')](_0x3d3397)[_0x32dd('0x29')](_0x59d4f8);};}exports[_0x32dd('0x2a')]=function(_0xf41aff,_0x49e43b){var _0x3ff917={},_0x439178={},_0x1eb823={'count':0x0,'rows':[]};var _0x22f98f=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x51a770){return{'name':_0x51a770[_0x32dd('0x2b')],'type':_0x51a770['type'][_0x32dd('0x2c')]};});_0x439178[_0x32dd('0x2d')]=_[_0x32dd('0x2e')](_0x22f98f,_0x32dd('0x2f'));_0x439178[_0x32dd('0x30')]=_[_0x32dd('0x31')](_0xf41aff[_0x32dd('0x30')]);_0x439178[_0x32dd('0x32')]=_['intersection'](_0x439178[_0x32dd('0x2d')],_0x439178['query']);_0x3ff917['attributes']=_[_0x32dd('0x33')](_0x439178[_0x32dd('0x2d')],qs[_0x32dd('0x34')](_0xf41aff['query'][_0x32dd('0x34')]));_0x3ff917[_0x32dd('0x35')]=_0x3ff917[_0x32dd('0x35')][_0x32dd('0x36')]?_0x3ff917[_0x32dd('0x35')]:_0x439178['model'];if(!_0xf41aff[_0x32dd('0x30')][_0x32dd('0x37')](_0x32dd('0x38'))){_0x3ff917[_0x32dd('0x20')]=qs[_0x32dd('0x20')](_0xf41aff[_0x32dd('0x30')][_0x32dd('0x20')]);_0x3ff917['offset']=qs[_0x32dd('0x1e')](_0xf41aff[_0x32dd('0x30')][_0x32dd('0x1e')]);}_0x3ff917['order']=qs[_0x32dd('0x39')](_0xf41aff[_0x32dd('0x30')][_0x32dd('0x39')]);_0x3ff917['where']=qs['filters'](_['pick'](_0xf41aff[_0x32dd('0x30')],_0x439178['filters']),_0x22f98f);if(_0xf41aff[_0x32dd('0x30')][_0x32dd('0x3a')]){_0x3ff917[_0x32dd('0x3b')]=_[_0x32dd('0x3c')](_0x3ff917['where'],{'$or':_[_0x32dd('0x2e')](_0x22f98f,function(_0x274de7){if(_0x274de7['type']!==_0x32dd('0x3d')){var _0x50343d={};_0x50343d[_0x274de7[_0x32dd('0x2f')]]={'$like':'%'+_0xf41aff['query']['filter']+'%'};return _0x50343d;}})});}_0x3ff917=_[_0x32dd('0x3c')]({},_0x3ff917,_0xf41aff[_0x32dd('0x3e')]);var _0x276c44={'where':_0x3ff917[_0x32dd('0x3b')]};return db[_0x32dd('0x3f')][_0x32dd('0x1f')](_0x276c44)[_0x32dd('0x25')](function(_0x5ae2e2){_0x1eb823[_0x32dd('0x1f')]=_0x5ae2e2;if(_0xf41aff['query']['includeAll']){_0x3ff917[_0x32dd('0x40')]=[{'all':!![]}];}return db[_0x32dd('0x3f')]['findAll'](_0x3ff917);})[_0x32dd('0x25')](function(_0x42980e){_0x1eb823['rows']=_0x42980e;return _0x1eb823;})[_0x32dd('0x25')](respondWithFilteredResult(_0x49e43b,_0x3ff917))['catch'](handleError(_0x49e43b,null));};exports['show']=function(_0x17ebc3,_0x10fa52){var _0x2aadfe={'raw':![],'where':{'id':_0x17ebc3[_0x32dd('0x41')]['id']}},_0x518069={};_0x518069[_0x32dd('0x2d')]=_['keys'](db[_0x32dd('0x3f')][_0x32dd('0x42')]);_0x518069['query']=_['keys'](_0x17ebc3[_0x32dd('0x30')]);_0x518069[_0x32dd('0x32')]=_[_0x32dd('0x33')](_0x518069[_0x32dd('0x2d')],_0x518069['query']);_0x2aadfe[_0x32dd('0x35')]=_[_0x32dd('0x33')](_0x518069[_0x32dd('0x2d')],qs[_0x32dd('0x34')](_0x17ebc3[_0x32dd('0x30')]['fields']));_0x2aadfe[_0x32dd('0x35')]=_0x2aadfe['attributes'][_0x32dd('0x36')]?_0x2aadfe['attributes']:_0x518069[_0x32dd('0x2d')];if(_0x17ebc3[_0x32dd('0x30')][_0x32dd('0x43')]){_0x2aadfe[_0x32dd('0x40')]=[{'all':!![]}];}_0x2aadfe=_[_0x32dd('0x3c')]({},_0x2aadfe,_0x17ebc3['options']);return db[_0x32dd('0x3f')][_0x32dd('0x44')](_0x2aadfe)[_0x32dd('0x25')](handleEntityNotFound(_0x10fa52,null))[_0x32dd('0x25')](respondWithResult(_0x10fa52,null))[_0x32dd('0x45')](handleError(_0x10fa52,null));};exports[_0x32dd('0x46')]=function(_0x5e5105,_0x21716b){return db[_0x32dd('0x3f')]['create'](_0x5e5105[_0x32dd('0x47')],{})['then'](respondWithResult(_0x21716b,0xc9))[_0x32dd('0x45')](handleError(_0x21716b,null));};exports['update']=function(_0x4d5ef3,_0x3485ea){if(_0x4d5ef3[_0x32dd('0x47')]['id']){delete _0x4d5ef3['body']['id'];}return db[_0x32dd('0x3f')]['find']({'where':{'id':_0x4d5ef3[_0x32dd('0x41')]['id']}})['then'](handleEntityNotFound(_0x3485ea,null))[_0x32dd('0x25')](saveUpdates(_0x4d5ef3[_0x32dd('0x47')],null))[_0x32dd('0x25')](respondWithResult(_0x3485ea,null))[_0x32dd('0x45')](handleError(_0x3485ea,null));};exports['destroy']=function(_0x1e6ba2,_0x284fac){return db['Dynamics365Account']['find']({'where':{'id':_0x1e6ba2[_0x32dd('0x41')]['id']}})[_0x32dd('0x25')](handleEntityNotFound(_0x284fac,null))[_0x32dd('0x25')](removeEntity(_0x284fac,null))[_0x32dd('0x45')](handleError(_0x284fac,null));};exports[_0x32dd('0x48')]=function(_0x2dc81c,_0xdee491,_0x414b51){var _0x1cc247={};var _0xb7e828={};var _0x6028df;var _0x2be2f0;return db[_0x32dd('0x3f')][_0x32dd('0x49')]({'where':{'id':_0x2dc81c[_0x32dd('0x41')]['id']}})[_0x32dd('0x25')](handleEntityNotFound(_0xdee491,null))[_0x32dd('0x25')](function(_0x281173){if(_0x281173){_0x6028df=_0x281173;_0xb7e828[_0x32dd('0x2d')]=_[_0x32dd('0x31')](db['Dynamics365Configuration']['rawAttributes']);_0xb7e828['query']=_[_0x32dd('0x31')](_0x2dc81c[_0x32dd('0x30')]);_0xb7e828[_0x32dd('0x32')]=_[_0x32dd('0x33')](_0xb7e828[_0x32dd('0x2d')],_0xb7e828[_0x32dd('0x30')]);_0x1cc247[_0x32dd('0x35')]=_[_0x32dd('0x33')](_0xb7e828[_0x32dd('0x2d')],qs[_0x32dd('0x34')](_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x34')]));_0x1cc247[_0x32dd('0x35')]=_0x1cc247[_0x32dd('0x35')]['length']?_0x1cc247[_0x32dd('0x35')]:_0xb7e828['model'];_0x1cc247[_0x32dd('0x4a')]=qs[_0x32dd('0x39')](_0x2dc81c['query'][_0x32dd('0x39')]);_0x1cc247[_0x32dd('0x3b')]=qs[_0x32dd('0x32')](_[_0x32dd('0x4b')](_0x2dc81c[_0x32dd('0x30')],_0xb7e828['filters']));if(_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x3a')]){_0x1cc247[_0x32dd('0x3b')]=_['merge'](_0x1cc247[_0x32dd('0x3b')],{'$or':_[_0x32dd('0x2e')](_0x1cc247[_0x32dd('0x35')],function(_0x251020){var _0x556850={};_0x556850[_0x251020]={'$like':'%'+_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x3a')]+'%'};return _0x556850;})});}_0x1cc247=_['merge']({},_0x1cc247,_0x2dc81c[_0x32dd('0x3e')]);return _0x6028df[_0x32dd('0x48')](_0x1cc247);}})[_0x32dd('0x25')](function(_0x3e49a9){if(_0x3e49a9){_0x2be2f0=_0x3e49a9['length'];if(!_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x37')](_0x32dd('0x38'))){_0x1cc247[_0x32dd('0x20')]=qs[_0x32dd('0x20')](_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x20')]);_0x1cc247['offset']=qs[_0x32dd('0x1e')](_0x2dc81c[_0x32dd('0x30')][_0x32dd('0x1e')]);}return _0x6028df[_0x32dd('0x48')](_0x1cc247);}})['then'](function(_0x234b0b){if(_0x234b0b){return _0x234b0b?{'count':_0x2be2f0,'rows':_0x234b0b}:null;}})['then'](respondWithResult(_0xdee491,null))[_0x32dd('0x45')](handleError(_0xdee491,null));};exports[_0x32dd('0x4c')]=function(_0x24936a,_0x406b75,_0xc35eb0){if(_0x24936a['body']['id']){delete _0x24936a[_0x32dd('0x47')]['id'];}return db[_0x32dd('0x3f')][_0x32dd('0x49')]({'where':{'id':_0x24936a[_0x32dd('0x41')]['id']}})[_0x32dd('0x25')](handleEntityNotFound(_0x406b75,null))['then'](function(_0xa68edd){if(_0xa68edd){_0x24936a[_0x32dd('0x47')][_0x32dd('0x4d')]=_0xa68edd['id'];_0x24936a[_0x32dd('0x47')][_0x32dd('0x4e')]=integrations[_0x32dd('0x4f')](_0x24936a['body']['channel'],_0x24936a[_0x32dd('0x47')][_0x32dd('0x50')]);_0x24936a['body'][_0x32dd('0x51')]=integrations[_0x32dd('0x52')](_0x24936a[_0x32dd('0x47')][_0x32dd('0x53')],_0x24936a[_0x32dd('0x47')][_0x32dd('0x50')]);return db[_0x32dd('0x54')][_0x32dd('0x46')](_0x24936a['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x32dd('0x51')}]});}return null;})[_0x32dd('0x25')](respondWithResult(_0x406b75,null))['catch'](handleError(_0x406b75,null));};exports[_0x32dd('0x55')]=function(_0x2f1119,_0x17c89e,_0x45a66c){var _0x311d4e=_0x2f1119[_0x32dd('0x30')][_0x32dd('0x56')];var _0x11296a=_0x311d4e==='incident'?'Incident':_0x32dd('0x57');var _0x533909='';var _0x4af0e2='';var _0xf5f7f8='';var _0x448972='';var _0x2337f1='';var _0x425702='';var _0x24a1bf='';var _0x1221c3='';var _0x4525f3=['title',_0x32dd('0x58'),'customerid',_0x32dd('0x59'),_0x32dd('0x5a'),_0x32dd('0x5b'),_0x32dd('0x5c'),_0x32dd('0x5d'),'directioncode','phonecall_activity_parties'];var _0x1c4a8e=[_0x32dd('0x5e'),'accountidyominame',_0x32dd('0x5f'),'billedserviceunits','contactidname',_0x32dd('0x60'),_0x32dd('0x61'),'contractidname',_0x32dd('0x62'),_0x32dd('0x63'),_0x32dd('0x64'),_0x32dd('0x65'),_0x32dd('0x66'),_0x32dd('0x67'),'createdonbehalfbyyominame',_0x32dd('0x68'),'customeridtype',_0x32dd('0x69'),_0x32dd('0x6a'),_0x32dd('0x6b'),_0x32dd('0x6c'),_0x32dd('0x6d'),'escalatedon',_0x32dd('0x6e'),_0x32dd('0x6f'),'followupby',_0x32dd('0x70'),_0x32dd('0x71'),_0x32dd('0x72'),_0x32dd('0x73'),_0x32dd('0x74'),'modifiedbyexternalpartyname',_0x32dd('0x75'),'modifiedbyname',_0x32dd('0x76'),'modifiedon','modifiedonbehalfbyname',_0x32dd('0x77'),_0x32dd('0x78'),_0x32dd('0x79'),_0x32dd('0x7a'),_0x32dd('0x7b'),'overriddencreatedon','owneridname',_0x32dd('0x7c'),_0x32dd('0x7d'),_0x32dd('0x7e'),_0x32dd('0x7f'),'primarycontactidyominame',_0x32dd('0x80'),'productidname',_0x32dd('0x81'),'resolveby',_0x32dd('0x82'),_0x32dd('0x83'),_0x32dd('0x84'),_0x32dd('0x85'),_0x32dd('0x86'),_0x32dd('0x87'),_0x32dd('0x88'),_0x32dd('0x89'),'statecode','statuscode',_0x32dd('0x8a'),'ticketnumber','timezoneruleversionnumber',_0x32dd('0x8b'),_0x32dd('0x8c'),'utcconversiontimezonecode',_0x32dd('0x8d')];var _0x3c54be=_0x4525f3['concat'](_0x1c4a8e);return db['Dynamics365Account'][_0x32dd('0x49')]({'where':{'id':_0x2f1119[_0x32dd('0x41')]['id']},'attributes':['id','username',_0x32dd('0x8e'),_0x32dd('0x8f'),'tenantId',_0x32dd('0x90'),_0x32dd('0x91')]})['then'](handleEntityNotFound(_0x17c89e,null))[_0x32dd('0x25')](function(_0x15a890){if(_0x15a890){_0x1221c3=_0x15a890[_0x32dd('0x8f')];var _0x72375f=_0x1221c3[_0x32dd('0x92')](-0x1);if(_0x72375f==='/'){_0x1221c3=_0x1221c3[_0x32dd('0x93')](0x0,_0x1221c3['lastIndexOf'](_0x72375f));}_0x24a1bf=util[_0x32dd('0x94')](_0x32dd('0x95'),_0x1221c3);var _0x508820={'method':_0x32dd('0x96'),'uri':_0x32dd('0x97')+_0x15a890[_0x32dd('0x98')]+_0x32dd('0x99'),'form':{'client_id':_0x15a890[_0x32dd('0x90')],'resource':_0x1221c3,'username':_0x15a890[_0x32dd('0x9a')],'password':_0x15a890[_0x32dd('0x8e')],'grant_type':_0x32dd('0x8e'),'client_secret':_0x15a890['clientSecret']},'json':!![]};return rp(_0x508820);}})[_0x32dd('0x25')](function(_0x2f7597){_0x425702=_0x2f7597[_0x32dd('0x9b')];var _0x51d92c={'method':'GET','uri':encodeURI(_0x24a1bf+_0x32dd('0x9c')+_0x11296a+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x425702,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x51d92c);})['then'](function(_0x3dcc39){var _0x18dc42=_0x3dcc39[_0x32dd('0x9d')][0x0];var _0x1da98c=_0x18dc42[_0x32dd('0x9e')];var _0x4c7cb3={'method':_0x32dd('0x9f'),'uri':_0x24a1bf+_0x32dd('0xa0')+_0x1da98c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x425702,'If-None-Match':null,'OData-Version':_0x32dd('0xa1')},'json':!![]};return rp(_0x4c7cb3);})[_0x32dd('0x25')](function(_0x513c3d){_0x533909=_0x513c3d;_0x4af0e2=_0x533909[_0x32dd('0xa2')];_0x4af0e2=_[_0x32dd('0xa3')](_0x4af0e2,function(_0xb8d8e7){return!_0x3c54be[_0x32dd('0xa4')](_0xb8d8e7[_0x32dd('0xa5')]);});var _0x294d56=[];var _0x447337=[];_0x4af0e2[_0x32dd('0xa6')](function(_0x31db97){if(_0x31db97['@odata.type']){var _0x4507fb=_0x31db97[_0x32dd('0xa7')][_0x32dd('0x93')](_0x31db97[_0x32dd('0xa7')][_0x32dd('0xa8')]('.')+0x1);if(_0x4507fb===_0x32dd('0xa9')){_0x294d56[_0x32dd('0xaa')](getSelectList(_0x24a1bf,_0x311d4e,_0x447337,_0x533909['MetadataId'],_0x31db97[_0x32dd('0x9e')],_0x425702));}}});return Promise[_0x32dd('0xab')](_0x294d56);})['then'](function(_0x245a9d){_0xf5f7f8=_0x245a9d[0x0];var _0x58b996=[];var _0xdc44b9=[];_0x4af0e2[_0x32dd('0xa6')](function(_0x449d1c){if(!_[_0x32dd('0xac')](_0x449d1c[_0x32dd('0xa7')])){var _0x52ad9a=_0x449d1c[_0x32dd('0xa7')][_0x32dd('0x93')](_0x449d1c[_0x32dd('0xa7')][_0x32dd('0xa8')]('.')+0x1);if(_0x52ad9a==='BooleanAttributeMetadata'){_0x58b996[_0x32dd('0xaa')](getBooleanList(_0x24a1bf,_0x311d4e,_0xdc44b9,_0x533909[_0x32dd('0x9e')],_0x449d1c['MetadataId'],_0x425702));}}});return Promise[_0x32dd('0xab')](_0x58b996);})['then'](function(_0x3d3ccf){_0x448972=_0x3d3ccf[0x0];var _0x53df86=[];var _0x4254f1=[];_0x4af0e2[_0x32dd('0xa6')](function(_0x5b2958){if(_0x5b2958[_0x32dd('0xa7')]){var _0xcb2bfc=_0x5b2958[_0x32dd('0xa7')]['substring'](_0x5b2958[_0x32dd('0xa7')][_0x32dd('0xa8')]('.')+0x1);if(_0xcb2bfc===_0x32dd('0xad')||_0xcb2bfc===_0x32dd('0xae')||_0xcb2bfc===_0x32dd('0xaf')||_0xcb2bfc===_0x32dd('0xb0')||_0xcb2bfc==='MemoAttributeMetadata'||_0xcb2bfc==='DateTimeAttributeMetadata'||_0xcb2bfc===_0x32dd('0xb1')||_0xcb2bfc===_0x32dd('0xb2')||_0xcb2bfc==='StateAttributeMetadata'||_0xcb2bfc===_0x32dd('0xb3')){_0x53df86[_0x32dd('0xaa')](getInputList(_0x24a1bf,_0x311d4e,_0xcb2bfc,_0x4254f1,_0x533909[_0x32dd('0x9e')],_0x5b2958[_0x32dd('0x9e')],_0x425702));}}});return Promise['all'](_0x53df86);})[_0x32dd('0x25')](function(_0x21e31e){_0x2337f1=_0x21e31e[0x0];var _0x3839a9=_0xf5f7f8[_0x32dd('0xb4')](_0x448972)['concat'](_0x2337f1);var _0x3111c9={'count':_0x3839a9[_0x32dd('0x36')],'rows':_0x3839a9};return _0x3111c9;})[_0x32dd('0x25')](respondWithResult(_0x17c89e,null))[_0x32dd('0x45')](function(_0x229479){var _0x9cce7e=_0x2f1119['query'][_0x32dd('0xb5')]?0x1f4:_0x229479[_0x32dd('0xb6')]||0x1f4;logger[_0x32dd('0x27')](_0x229479[_0x32dd('0x28')]);delete _0x229479[_0x32dd('0x2f')];if(_0x9cce7e===0x191){_0x9cce7e=0x190;}_0x17c89e[_0x32dd('0x1b')](_0x9cce7e)[_0x32dd('0x29')](_0x2f1119[_0x32dd('0x30')][_0x32dd('0xb5')]?{'message':_0x32dd('0xb7'),'statusCode':_0x229479['statusCode']}:_0x229479);});};function getSelectList(_0x23eabd,_0x44dd4f,_0x5c79c3,_0x2eb396,_0x31c0e0,_0x126306){var _0x1bfea1={'method':'GET','uri':_0x23eabd+_0x32dd('0xa0')+_0x2eb396+_0x32dd('0xb8')+_0x31c0e0+_0x32dd('0xb9')+_0x32dd('0xba'),'headers':{'Authorization':_0x32dd('0xbb')+_0x126306,'If-None-Match':null,'OData-Version':_0x32dd('0xa1')},'json':!![]};return rp(_0x1bfea1)[_0x32dd('0x25')](function(_0x509b5b){var _0x5b52dc=[];var _0x11790d=_0x509b5b[_0x32dd('0xbc')][_0x32dd('0xbd')];_0x11790d[_0x32dd('0xa6')](function(_0x37e6a6){_0x5b52dc[_0x32dd('0xaa')]({'name':_0x37e6a6[_0x32dd('0xbe')][_0x32dd('0xbf')][_0x32dd('0xbe')],'value':String(_0x37e6a6[_0x32dd('0xc0')])});});var _0x35e46c={'id':_0x44dd4f+'_'+_0x509b5b[_0x32dd('0xa5')],'name':_0x509b5b[_0x32dd('0xc1')][_0x32dd('0xbf')][_0x32dd('0xbe')],'custom':![],'options':_0x5b52dc};_0x5c79c3[_0x32dd('0xaa')](_0x35e46c);return _0x5c79c3;});}function getBooleanList(_0x393908,_0x5cb5c8,_0x2fd0c6,_0x50280e,_0x5cbd3a,_0x2bbd0d){var _0xe41d6b={'method':'GET','uri':_0x393908+_0x32dd('0xa0')+_0x50280e+')/Attributes('+_0x5cbd3a+_0x32dd('0xc2'),'headers':{'Authorization':_0x32dd('0xbb')+_0x2bbd0d,'If-None-Match':null,'OData-Version':_0x32dd('0xa1')},'json':!![]};return rp(_0xe41d6b)[_0x32dd('0x25')](function(_0x539d01){var _0x557d9a=[];_0x557d9a[_0x32dd('0xaa')]({'name':_0x539d01[_0x32dd('0xbc')][_0x32dd('0xc3')][_0x32dd('0xbe')]['UserLocalizedLabel'][_0x32dd('0xbe')],'value':'true'},{'name':_0x539d01['OptionSet'][_0x32dd('0xc4')][_0x32dd('0xbe')][_0x32dd('0xbf')]['Label'],'value':'false'});var _0x5c8a54={'id':_0x5cb5c8+'_'+_0x539d01['LogicalName'],'name':_0x539d01[_0x32dd('0xc1')][_0x32dd('0xbf')][_0x32dd('0xbe')],'custom':![],'options':_0x557d9a};_0x2fd0c6[_0x32dd('0xaa')](_0x5c8a54);return _0x2fd0c6;});}function getInputList(_0x224fd0,_0x4067b3,_0x5d80dd,_0x52f3a6,_0x5c8f1b,_0x1d06d3,_0x256048){var _0x36af31={'method':_0x32dd('0x9f'),'uri':_0x224fd0+_0x32dd('0xa0')+_0x5c8f1b+_0x32dd('0xb8')+_0x1d06d3+')/Microsoft.Dynamics.CRM.'+_0x5d80dd+_0x32dd('0xc5'),'headers':{'Authorization':_0x32dd('0xbb')+_0x256048,'If-None-Match':null,'OData-Version':_0x32dd('0xa1')},'json':!![]};return rp(_0x36af31)[_0x32dd('0x25')](function(_0x3a67d0){var _0x4ce9b2={'id':_0x4067b3+'_'+_0x3a67d0[_0x32dd('0xa5')],'name':_0x3a67d0[_0x32dd('0xc1')]['UserLocalizedLabel']?_0x3a67d0[_0x32dd('0xc1')][_0x32dd('0xbf')][_0x32dd('0xbe')]:_0x3a67d0['LogicalName'],'custom':![],'options':[]};_0x52f3a6['push'](_0x4ce9b2);return _0x52f3a6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d71c9c0..5b67c6e 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x55af42,_0x546c34){var _0x1b0e64=function(_0x9105e3){while(--_0x9105e3){_0x55af42['push'](_0x55af42['shift']());}};_0x1b0e64(++_0x546c34);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb7e7[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 6a64214..53440f3 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 _0xdb1d=['result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','debug','Dynamics365Account','find','then','ShowDynamics365Account','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0xdb1d,0xcf));var _0xddb1=function(_0x319137,_0x42e6bd){_0x319137=_0x319137-0x0;var _0x146b90=_0xdb1d[_0x319137];return _0x146b90;};'use strict';var _=require(_0xddb1('0x0'));var util=require('util');var moment=require(_0xddb1('0x1'));var BPromise=require(_0xddb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddb1('0x3'));var db=require(_0xddb1('0x4'))['db'];var utils=require(_0xddb1('0x5'));var logger=require(_0xddb1('0x6'))(_0xddb1('0x7'));var config=require(_0xddb1('0x8'));var jayson=require(_0xddb1('0x9'));var client=jayson[_0xddb1('0xa')][_0xddb1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x100372,_0x588986,_0x5802bc){return new BPromise(function(_0x13d896,_0x48e00a){return client[_0xddb1('0xc')](_0x100372,_0x5802bc)['then'](function(_0x434e5d){logger[_0xddb1('0xd')](_0xddb1('0xe'),_0x588986,'request\x20sent');logger['debug'](_0xddb1('0xf'),_0x588986,_0xddb1('0x10'),JSON[_0xddb1('0x11')](_0x434e5d));if(_0x434e5d[_0xddb1('0x12')]){if(_0x434e5d['error'][_0xddb1('0x13')]===0x1f4){logger[_0xddb1('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x588986,_0x434e5d[_0xddb1('0x12')][_0xddb1('0x14')]);return _0x48e00a(_0x434e5d[_0xddb1('0x12')]['message']);}logger[_0xddb1('0x12')](_0xddb1('0xe'),_0x588986,_0x434e5d['error'][_0xddb1('0x14')]);return _0x13d896(_0x434e5d[_0xddb1('0x12')]['message']);}else{logger[_0xddb1('0xd')](_0xddb1('0xe'),_0x588986,'request\x20sent');_0x13d896(_0x434e5d[_0xddb1('0x15')]['message']);}})[_0xddb1('0x16')](function(_0x3d5abb){logger['error'](_0xddb1('0xe'),_0x588986,_0x3d5abb);_0x48e00a(_0x3d5abb);});});}exports[_0xddb1('0x17')]=function(_0x40b2fc){var _0x44af38=this;return new Promise(function(_0x215f9a,_0x5a3d02){return db['Dynamics365Account'][_0xddb1('0x18')]({'raw':_0x40b2fc['options']?_0x40b2fc[_0xddb1('0x19')][_0xddb1('0x1a')]===undefined?!![]:![]:!![],'where':_0x40b2fc['options']?_0x40b2fc[_0xddb1('0x19')][_0xddb1('0x1b')]||null:null,'attributes':_0x40b2fc[_0xddb1('0x19')]?_0x40b2fc[_0xddb1('0x19')][_0xddb1('0x1c')]||null:null,'limit':_0x40b2fc[_0xddb1('0x19')]?_0x40b2fc['options'][_0xddb1('0x1d')]||null:null,'include':_0x40b2fc[_0xddb1('0x19')]?_0x40b2fc['options'][_0xddb1('0x1e')]?_['map'](_0x40b2fc['options'][_0xddb1('0x1e')],function(_0x2ba8be){return{'model':db[_0x2ba8be['model']],'as':_0x2ba8be['as'],'attributes':_0x2ba8be['attributes'],'include':_0x2ba8be[_0xddb1('0x1e')]?_[_0xddb1('0x1f')](_0x2ba8be[_0xddb1('0x1e')],function(_0xe4d8d0){return{'model':db[_0xe4d8d0[_0xddb1('0x20')]],'as':_0xe4d8d0['as'],'attributes':_0xe4d8d0[_0xddb1('0x1c')],'include':_0xe4d8d0['include']?_['map'](_0xe4d8d0[_0xddb1('0x1e')],function(_0x4090a7){return{'model':db[_0x4090a7['model']],'as':_0x4090a7['as'],'attributes':_0x4090a7[_0xddb1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cf99a){logger['info'](_0xddb1('0x17'),_0x40b2fc);logger[_0xddb1('0x21')](_0xddb1('0x17'),_0x40b2fc,JSON[_0xddb1('0x11')](_0x3cf99a));_0x215f9a(_0x3cf99a);})['catch'](function(_0x3d8f2d){logger['error'](_0xddb1('0x17'),_0x3d8f2d[_0xddb1('0x14')],_0x40b2fc);_0x5a3d02(_0x44af38[_0xddb1('0x12')](0x1f4,_0x3d8f2d[_0xddb1('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x5d1188){var _0x57489c=this;return new Promise(function(_0x51c5b1,_0x236bb5){return db[_0xddb1('0x22')][_0xddb1('0x23')]({'raw':_0x5d1188[_0xddb1('0x19')]?_0x5d1188[_0xddb1('0x19')][_0xddb1('0x1a')]===undefined?!![]:![]:!![],'where':_0x5d1188[_0xddb1('0x19')]?_0x5d1188[_0xddb1('0x19')][_0xddb1('0x1b')]||null:null,'attributes':_0x5d1188[_0xddb1('0x19')]?_0x5d1188[_0xddb1('0x19')][_0xddb1('0x1c')]||null:null,'include':_0x5d1188[_0xddb1('0x19')]?_0x5d1188['options'][_0xddb1('0x1e')]?_['map'](_0x5d1188['options'][_0xddb1('0x1e')],function(_0x43528f){return{'model':db[_0x43528f[_0xddb1('0x20')]],'as':_0x43528f['as'],'attributes':_0x43528f[_0xddb1('0x1c')],'include':_0x43528f[_0xddb1('0x1e')]?_['map'](_0x43528f[_0xddb1('0x1e')],function(_0x5131cd){return{'model':db[_0x5131cd['model']],'as':_0x5131cd['as'],'attributes':_0x5131cd[_0xddb1('0x1c')],'include':_0x5131cd[_0xddb1('0x1e')]?_[_0xddb1('0x1f')](_0x5131cd[_0xddb1('0x1e')],function(_0x1a8cb1){return{'model':db[_0x1a8cb1['model']],'as':_0x1a8cb1['as'],'attributes':_0x1a8cb1['attributes']};}):[]};}):[]};}):[]:[]})[_0xddb1('0x24')](function(_0x4c6e34){logger[_0xddb1('0xd')]('ShowDynamics365Account',_0x5d1188);logger[_0xddb1('0x21')](_0xddb1('0x25'),_0x5d1188,JSON[_0xddb1('0x11')](_0x4c6e34));_0x51c5b1(_0x4c6e34);})[_0xddb1('0x16')](function(_0x4bc4d2){logger[_0xddb1('0x12')](_0xddb1('0x25'),_0x4bc4d2[_0xddb1('0x14')],_0x5d1188);_0x236bb5(_0x57489c[_0xddb1('0x12')](0x1f4,_0x4bc4d2[_0xddb1('0x14')]));});});}; \ No newline at end of file +var _0x997b=['../../config/environment','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','findAll','options','where','attributes','include','map','model','ShowDynamics365Account','Dynamics365Account','find','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x997b,0x111));var _0xb997=function(_0x3fff00,_0xd32d32){_0x3fff00=_0x3fff00-0x0;var _0x57021f=_0x997b[_0x3fff00];return _0x57021f;};'use strict';var _=require('lodash');var util=require(_0xb997('0x0'));var moment=require(_0xb997('0x1'));var BPromise=require(_0xb997('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb997('0x3'));var db=require(_0xb997('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb997('0x5'))(_0xb997('0x6'));var config=require(_0xb997('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb997('0x8')][_0xb997('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e1fc,_0x40150f,_0x233146){return new BPromise(function(_0x39c01b,_0x4a990a){return client[_0xb997('0xa')](_0x49e1fc,_0x233146)[_0xb997('0xb')](function(_0x29246a){logger['info'](_0xb997('0xc'),_0x40150f,_0xb997('0xd'));logger[_0xb997('0xe')](_0xb997('0xf'),_0x40150f,_0xb997('0xd'),JSON[_0xb997('0x10')](_0x29246a));if(_0x29246a[_0xb997('0x11')]){if(_0x29246a['error'][_0xb997('0x12')]===0x1f4){logger['error'](_0xb997('0xc'),_0x40150f,_0x29246a[_0xb997('0x11')][_0xb997('0x13')]);return _0x4a990a(_0x29246a['error'][_0xb997('0x13')]);}logger[_0xb997('0x11')](_0xb997('0xc'),_0x40150f,_0x29246a[_0xb997('0x11')][_0xb997('0x13')]);return _0x39c01b(_0x29246a[_0xb997('0x11')][_0xb997('0x13')]);}else{logger[_0xb997('0x14')](_0xb997('0xc'),_0x40150f,_0xb997('0xd'));_0x39c01b(_0x29246a[_0xb997('0x15')][_0xb997('0x13')]);}})[_0xb997('0x16')](function(_0x5463b4){logger[_0xb997('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x40150f,_0x5463b4);_0x4a990a(_0x5463b4);});});}exports[_0xb997('0x17')]=function(_0x3daec1){var _0x187f6d=this;return new Promise(function(_0x5d0899,_0x6d9ead){return db['Dynamics365Account'][_0xb997('0x18')]({'raw':_0x3daec1[_0xb997('0x19')]?_0x3daec1[_0xb997('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3daec1['options']?_0x3daec1[_0xb997('0x19')][_0xb997('0x1a')]||null:null,'attributes':_0x3daec1[_0xb997('0x19')]?_0x3daec1[_0xb997('0x19')][_0xb997('0x1b')]||null:null,'limit':_0x3daec1[_0xb997('0x19')]?_0x3daec1[_0xb997('0x19')]['limit']||null:null,'include':_0x3daec1[_0xb997('0x19')]?_0x3daec1[_0xb997('0x19')][_0xb997('0x1c')]?_[_0xb997('0x1d')](_0x3daec1[_0xb997('0x19')]['include'],function(_0x5acbc6){return{'model':db[_0x5acbc6[_0xb997('0x1e')]],'as':_0x5acbc6['as'],'attributes':_0x5acbc6['attributes'],'include':_0x5acbc6[_0xb997('0x1c')]?_[_0xb997('0x1d')](_0x5acbc6[_0xb997('0x1c')],function(_0x32247b){return{'model':db[_0x32247b['model']],'as':_0x32247b['as'],'attributes':_0x32247b[_0xb997('0x1b')],'include':_0x32247b[_0xb997('0x1c')]?_['map'](_0x32247b[_0xb997('0x1c')],function(_0x4ff941){return{'model':db[_0x4ff941[_0xb997('0x1e')]],'as':_0x4ff941['as'],'attributes':_0x4ff941[_0xb997('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb997('0xb')](function(_0x37ec7c){logger['info'](_0xb997('0x17'),_0x3daec1);logger[_0xb997('0xe')](_0xb997('0x17'),_0x3daec1,JSON[_0xb997('0x10')](_0x37ec7c));_0x5d0899(_0x37ec7c);})[_0xb997('0x16')](function(_0x14d9ad){logger[_0xb997('0x11')]('GetDynamics365Account',_0x14d9ad[_0xb997('0x13')],_0x3daec1);_0x6d9ead(_0x187f6d[_0xb997('0x11')](0x1f4,_0x14d9ad['message']));});});};exports[_0xb997('0x1f')]=function(_0x30fbe8){var _0x1bc232=this;return new Promise(function(_0x3b279f,_0x12cf5e){return db[_0xb997('0x20')][_0xb997('0x21')]({'raw':_0x30fbe8[_0xb997('0x19')]?_0x30fbe8[_0xb997('0x19')][_0xb997('0x22')]===undefined?!![]:![]:!![],'where':_0x30fbe8[_0xb997('0x19')]?_0x30fbe8[_0xb997('0x19')][_0xb997('0x1a')]||null:null,'attributes':_0x30fbe8[_0xb997('0x19')]?_0x30fbe8[_0xb997('0x19')][_0xb997('0x1b')]||null:null,'include':_0x30fbe8[_0xb997('0x19')]?_0x30fbe8['options'][_0xb997('0x1c')]?_['map'](_0x30fbe8['options'][_0xb997('0x1c')],function(_0x51ddb){return{'model':db[_0x51ddb['model']],'as':_0x51ddb['as'],'attributes':_0x51ddb[_0xb997('0x1b')],'include':_0x51ddb[_0xb997('0x1c')]?_[_0xb997('0x1d')](_0x51ddb[_0xb997('0x1c')],function(_0x7e4bb1){return{'model':db[_0x7e4bb1['model']],'as':_0x7e4bb1['as'],'attributes':_0x7e4bb1[_0xb997('0x1b')],'include':_0x7e4bb1[_0xb997('0x1c')]?_[_0xb997('0x1d')](_0x7e4bb1[_0xb997('0x1c')],function(_0x1aef42){return{'model':db[_0x1aef42['model']],'as':_0x1aef42['as'],'attributes':_0x1aef42[_0xb997('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb997('0xb')](function(_0x276457){logger[_0xb997('0x14')](_0xb997('0x1f'),_0x30fbe8);logger['debug']('ShowDynamics365Account',_0x30fbe8,JSON[_0xb997('0x10')](_0x276457));_0x3b279f(_0x276457);})['catch'](function(_0x2c3047){logger[_0xb997('0x11')](_0xb997('0x1f'),_0x2c3047[_0xb997('0x13')],_0x30fbe8);_0x12cf5e(_0x1bc232[_0xb997('0x11')](0x1f4,_0x2c3047[_0xb997('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 0447f86..561315c 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 _0xf164=['/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','getFields','/:id/descriptions','getDescriptions','post','create','update'];(function(_0x45d2c5,_0x59053e){var _0x24a3a1=function(_0x3673a3){while(--_0x3673a3){_0x45d2c5['push'](_0x45d2c5['shift']());}};_0x24a3a1(++_0x59053e);}(_0xf164,0xcb));var _0x4f16=function(_0x5eae84,_0x193d5e){_0x5eae84=_0x5eae84-0x0;var _0x5b44cc=_0xf164[_0x5eae84];return _0x5b44cc;};'use strict';var multer=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var path=require(_0x4f16('0x2'));var timeout=require(_0x4f16('0x3'));var express=require(_0x4f16('0x4'));var router=express['Router']();var fs_extra=require(_0x4f16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4f16('0x6'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x4f16('0x7')]('/',auth[_0x4f16('0x8')](),controller[_0x4f16('0x9')]);router[_0x4f16('0x7')]('/:id',auth[_0x4f16('0x8')](),controller['show']);router['get'](_0x4f16('0xa'),auth[_0x4f16('0x8')](),controller[_0x4f16('0xb')]);router[_0x4f16('0x7')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x4f16('0x7')](_0x4f16('0xc'),auth['isAuthenticated'](),controller[_0x4f16('0xd')]);router[_0x4f16('0xe')]('/',auth[_0x4f16('0x8')](),controller[_0x4f16('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4f16('0x10')]);router['delete'](_0x4f16('0x11'),auth['isAuthenticated'](),controller[_0x4f16('0x12')]);module[_0x4f16('0x13')]=router; \ No newline at end of file +var _0xd5f1=['/:id','show','get','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated'];(function(_0x58f6d1,_0x347bcc){var _0x33e526=function(_0x1ae576){while(--_0x1ae576){_0x58f6d1['push'](_0x58f6d1['shift']());}};_0x33e526(++_0x347bcc);}(_0xd5f1,0x1b1));var _0x1d5f=function(_0x23345f,_0xc1cd34){_0x23345f=_0x23345f-0x0;var _0x1865e0=_0xd5f1[_0x23345f];return _0x1865e0;};'use strict';var multer=require(_0x1d5f('0x0'));var util=require(_0x1d5f('0x1'));var path=require(_0x1d5f('0x2'));var timeout=require(_0x1d5f('0x3'));var express=require('express');var router=express[_0x1d5f('0x4')]();var fs_extra=require(_0x1d5f('0x5'));var auth=require(_0x1d5f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth[_0x1d5f('0x7')](),controller['index']);router['get'](_0x1d5f('0x8'),auth[_0x1d5f('0x7')](),controller[_0x1d5f('0x9')]);router[_0x1d5f('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1d5f('0xb')]);router[_0x1d5f('0xa')](_0x1d5f('0xc'),auth[_0x1d5f('0x7')](),controller[_0x1d5f('0xd')]);router[_0x1d5f('0xa')]('/:id/descriptions',auth[_0x1d5f('0x7')](),controller[_0x1d5f('0xe')]);router[_0x1d5f('0xf')]('/',auth[_0x1d5f('0x7')](),controller[_0x1d5f('0x10')]);router[_0x1d5f('0x11')]('/:id',auth[_0x1d5f('0x7')](),controller['update']);router[_0x1d5f('0x12')](_0x1d5f('0x8'),auth[_0x1d5f('0x7')](),controller[_0x1d5f('0x13')]);module[_0x1d5f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 3f7d3da..a613c29 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 _0xed64=['nothing','sequelize','ENUM','incident','contact'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0xed64,0xec));var _0x4ed6=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0xed64[_0x1e06f1];return _0x34f77e;};'use strict';var Sequelize=require(_0x4ed6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4ed6('0x1')](_0x4ed6('0x2'),'phonecall'),'defaultValue':_0x4ed6('0x2')},'moduleCreate':{'type':Sequelize[_0x4ed6('0x1')](_0x4ed6('0x3'),_0x4ed6('0x4')),'defaultValue':_0x4ed6('0x3'),'allowNull':![]}}; \ No newline at end of file +var _0x7ea1=['nothing','sequelize','exports','STRING','incident','phonecall','contact'];(function(_0x2ef714,_0x49e1c4){var _0x252ab0=function(_0x868e73){while(--_0x868e73){_0x2ef714['push'](_0x2ef714['shift']());}};_0x252ab0(++_0x49e1c4);}(_0x7ea1,0x197));var _0x17ea=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x7ea1[_0x1fafa5];return _0xcf08c9;};'use strict';var Sequelize=require(_0x17ea('0x0'));module[_0x17ea('0x1')]={'name':{'type':Sequelize[_0x17ea('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x17ea('0x3'),_0x17ea('0x4')),'defaultValue':_0x17ea('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x17ea('0x5'),_0x17ea('0x6')),'defaultValue':'contact','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 52bb2f1..0a7e8a9 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 _0x0a8f=['findAll','rows','catch','show','params','includeAll','create','update','body','find','getFields','Dynamics365Field','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','destroy','stack','index','map','Dynamics365Configuration','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','name','options','then','include'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x0a8f,0x176));var _0xf0a8=function(_0x245e6c,_0x4d22c9){_0x245e6c=_0x245e6c-0x0;var _0x226cfe=_0x0a8f[_0x245e6c];return _0x226cfe;};'use strict';var emlformat=require(_0xf0a8('0x0'));var rimraf=require(_0xf0a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a8('0x2'));var rp=require(_0xf0a8('0x3'));var moment=require(_0xf0a8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0a8('0x5'));var path=require('path');var sox=require(_0xf0a8('0x6'));var csv=require(_0xf0a8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0a8('0x8'));var _=require('lodash');var squel=require(_0xf0a8('0x9'));var crypto=require(_0xf0a8('0xa'));var jsforce=require(_0xf0a8('0xb'));var deskjs=require(_0xf0a8('0xc'));var toCsv=require(_0xf0a8('0x7'));var querystring=require(_0xf0a8('0xd'));var Papa=require(_0xf0a8('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf0a8('0xf'));var as=require(_0xf0a8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0a8('0x11'));var utils=require(_0xf0a8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf0a8('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x300f9a,_0x19104e){_0x19104e=_0x19104e||0xcc;return function(_0x40750c){if(_0x40750c){return _0x300f9a[_0xf0a8('0x14')](_0x19104e);}return _0x300f9a[_0xf0a8('0x15')](_0x19104e)[_0xf0a8('0x16')]();};}function respondWithResult(_0x463ce3,_0x177a04){_0x177a04=_0x177a04||0xc8;return function(_0x4f6c5b){if(_0x4f6c5b){return _0x463ce3[_0xf0a8('0x15')](_0x177a04)[_0xf0a8('0x17')](_0x4f6c5b);}};}function respondWithFilteredResult(_0x4e249c,_0x2ed2e6){return function(_0x5d498d){if(_0x5d498d){var _0x28def6=typeof _0x2ed2e6[_0xf0a8('0x18')]===_0xf0a8('0x19')&&typeof _0x2ed2e6['limit']===_0xf0a8('0x19');var _0x458887=_0x5d498d['count'];var _0x6187f5=_0x28def6?0x0:_0x2ed2e6[_0xf0a8('0x18')];var _0x2ed0cd=_0x28def6?_0x5d498d[_0xf0a8('0x1a')]:_0x2ed2e6['offset']+_0x2ed2e6[_0xf0a8('0x1b')];var _0x5f4487;if(_0x2ed0cd>=_0x458887){_0x2ed0cd=_0x458887;_0x5f4487=0xc8;}else{_0x5f4487=0xce;}_0x4e249c[_0xf0a8('0x15')](_0x5f4487);return _0x4e249c[_0xf0a8('0x1c')]('Content-Range',_0x6187f5+'-'+_0x2ed0cd+'/'+_0x458887)[_0xf0a8('0x17')](_0x5d498d);}return null;};}function patchUpdates(_0x42c319){return function(_0x5edbc2){try{jsonpatch[_0xf0a8('0x1d')](_0x5edbc2,_0x42c319,!![]);}catch(_0x531b82){return BPromise[_0xf0a8('0x1e')](_0x531b82);}return _0x5edbc2['save']();};}function saveUpdates(_0xe774ad,_0x577dc2){return function(_0x821169){if(_0x821169){return _0x821169['update'](_0xe774ad)['then'](function(_0x714e22){return _0x714e22;});}return null;};}function removeEntity(_0x290719,_0x114e2d){return function(_0x206793){if(_0x206793){return _0x206793[_0xf0a8('0x1f')]()['then'](function(){_0x290719[_0xf0a8('0x15')](0xcc)[_0xf0a8('0x16')]();});}};}function handleEntityNotFound(_0x31f731,_0x289301){return function(_0x33cee7){if(!_0x33cee7){_0x31f731['sendStatus'](0x194);}return _0x33cee7;};}function handleError(_0x16bb2d,_0x4b5941){_0x4b5941=_0x4b5941||0x1f4;return function(_0x2c1636){logger['error'](_0x2c1636[_0xf0a8('0x20')]);if(_0x2c1636['name']){delete _0x2c1636['name'];}_0x16bb2d[_0xf0a8('0x15')](_0x4b5941)['send'](_0x2c1636);};}exports[_0xf0a8('0x21')]=function(_0x32a490,_0x49fb61){var _0x5bb3a6={},_0x5ce346={},_0x56343b={'count':0x0,'rows':[]};var _0xca3d02=_[_0xf0a8('0x22')](db[_0xf0a8('0x23')][_0xf0a8('0x24')],function(_0x6c99a5){return{'name':_0x6c99a5['fieldName'],'type':_0x6c99a5[_0xf0a8('0x25')]['key']};});_0x5ce346['model']=_[_0xf0a8('0x22')](_0xca3d02,'name');_0x5ce346[_0xf0a8('0x26')]=_[_0xf0a8('0x27')](_0x32a490['query']);_0x5ce346['filters']=_[_0xf0a8('0x28')](_0x5ce346['model'],_0x5ce346[_0xf0a8('0x26')]);_0x5bb3a6['attributes']=_[_0xf0a8('0x28')](_0x5ce346[_0xf0a8('0x29')],qs[_0xf0a8('0x2a')](_0x32a490[_0xf0a8('0x26')][_0xf0a8('0x2a')]));_0x5bb3a6[_0xf0a8('0x2b')]=_0x5bb3a6[_0xf0a8('0x2b')][_0xf0a8('0x2c')]?_0x5bb3a6[_0xf0a8('0x2b')]:_0x5ce346[_0xf0a8('0x29')];if(!_0x32a490[_0xf0a8('0x26')][_0xf0a8('0x2d')](_0xf0a8('0x2e'))){_0x5bb3a6[_0xf0a8('0x1b')]=qs[_0xf0a8('0x1b')](_0x32a490[_0xf0a8('0x26')][_0xf0a8('0x1b')]);_0x5bb3a6[_0xf0a8('0x18')]=qs['offset'](_0x32a490['query'][_0xf0a8('0x18')]);}_0x5bb3a6[_0xf0a8('0x2f')]=qs['sort'](_0x32a490[_0xf0a8('0x26')][_0xf0a8('0x30')]);_0x5bb3a6[_0xf0a8('0x31')]=qs[_0xf0a8('0x32')](_[_0xf0a8('0x33')](_0x32a490[_0xf0a8('0x26')],_0x5ce346[_0xf0a8('0x32')]),_0xca3d02);if(_0x32a490[_0xf0a8('0x26')][_0xf0a8('0x34')]){_0x5bb3a6[_0xf0a8('0x31')]=_[_0xf0a8('0x35')](_0x5bb3a6[_0xf0a8('0x31')],{'$or':_[_0xf0a8('0x22')](_0xca3d02,function(_0x3a3ba4){if(_0x3a3ba4[_0xf0a8('0x25')]!=='VIRTUAL'){var _0x26fa3d={};_0x26fa3d[_0x3a3ba4[_0xf0a8('0x36')]]={'$like':'%'+_0x32a490[_0xf0a8('0x26')]['filter']+'%'};return _0x26fa3d;}})});}_0x5bb3a6=_[_0xf0a8('0x35')]({},_0x5bb3a6,_0x32a490[_0xf0a8('0x37')]);var _0x200698={'where':_0x5bb3a6[_0xf0a8('0x31')]};return db[_0xf0a8('0x23')][_0xf0a8('0x1a')](_0x200698)[_0xf0a8('0x38')](function(_0x55624f){_0x56343b[_0xf0a8('0x1a')]=_0x55624f;if(_0x32a490[_0xf0a8('0x26')]['includeAll']){_0x5bb3a6[_0xf0a8('0x39')]=[{'all':!![]}];}return db[_0xf0a8('0x23')][_0xf0a8('0x3a')](_0x5bb3a6);})['then'](function(_0x4bbcfc){_0x56343b[_0xf0a8('0x3b')]=_0x4bbcfc;return _0x56343b;})['then'](respondWithFilteredResult(_0x49fb61,_0x5bb3a6))[_0xf0a8('0x3c')](handleError(_0x49fb61,null));};exports[_0xf0a8('0x3d')]=function(_0x3c802f,_0x401a9b){var _0x3dc300={'raw':![],'where':{'id':_0x3c802f[_0xf0a8('0x3e')]['id']}},_0x414803={};_0x414803[_0xf0a8('0x29')]=_[_0xf0a8('0x27')](db[_0xf0a8('0x23')][_0xf0a8('0x24')]);_0x414803[_0xf0a8('0x26')]=_[_0xf0a8('0x27')](_0x3c802f[_0xf0a8('0x26')]);_0x414803[_0xf0a8('0x32')]=_[_0xf0a8('0x28')](_0x414803[_0xf0a8('0x29')],_0x414803[_0xf0a8('0x26')]);_0x3dc300['attributes']=_[_0xf0a8('0x28')](_0x414803[_0xf0a8('0x29')],qs[_0xf0a8('0x2a')](_0x3c802f[_0xf0a8('0x26')]['fields']));_0x3dc300['attributes']=_0x3dc300[_0xf0a8('0x2b')][_0xf0a8('0x2c')]?_0x3dc300[_0xf0a8('0x2b')]:_0x414803[_0xf0a8('0x29')];if(_0x3c802f['query'][_0xf0a8('0x3f')]){_0x3dc300[_0xf0a8('0x39')]=[{'all':!![]}];}_0x3dc300=_[_0xf0a8('0x35')]({},_0x3dc300,_0x3c802f[_0xf0a8('0x37')]);return db[_0xf0a8('0x23')]['find'](_0x3dc300)[_0xf0a8('0x38')](handleEntityNotFound(_0x401a9b,null))[_0xf0a8('0x38')](respondWithResult(_0x401a9b,null))[_0xf0a8('0x3c')](handleError(_0x401a9b,null));};exports[_0xf0a8('0x40')]=function(_0x23fa8a,_0x58474f){return db['Dynamics365Configuration'][_0xf0a8('0x40')](_0x23fa8a['body'],{})[_0xf0a8('0x38')](respondWithResult(_0x58474f,0xc9))[_0xf0a8('0x3c')](handleError(_0x58474f,null));};exports[_0xf0a8('0x41')]=function(_0x32c7ff,_0x59de19){if(_0x32c7ff[_0xf0a8('0x42')]['id']){delete _0x32c7ff[_0xf0a8('0x42')]['id'];}return db[_0xf0a8('0x23')][_0xf0a8('0x43')]({'where':{'id':_0x32c7ff['params']['id']}})[_0xf0a8('0x38')](handleEntityNotFound(_0x59de19,null))[_0xf0a8('0x38')](saveUpdates(_0x32c7ff[_0xf0a8('0x42')],null))[_0xf0a8('0x38')](respondWithResult(_0x59de19,null))[_0xf0a8('0x3c')](handleError(_0x59de19,null));};exports[_0xf0a8('0x1f')]=function(_0x19c606,_0x202285){return db[_0xf0a8('0x23')][_0xf0a8('0x43')]({'where':{'id':_0x19c606[_0xf0a8('0x3e')]['id']}})[_0xf0a8('0x38')](handleEntityNotFound(_0x202285,null))[_0xf0a8('0x38')](removeEntity(_0x202285,null))['catch'](handleError(_0x202285,null));};exports[_0xf0a8('0x44')]=function(_0x2197a9,_0x546fe4,_0x5775db){var _0x5c0052={};var _0x12cb65={};var _0x5a5ac9;var _0x18167e;return db[_0xf0a8('0x23')]['findOne']({'where':{'id':_0x2197a9['params']['id']}})['then'](handleEntityNotFound(_0x546fe4,null))['then'](function(_0x182e33){if(_0x182e33){_0x5a5ac9=_0x182e33;_0x12cb65[_0xf0a8('0x29')]=_[_0xf0a8('0x27')](db[_0xf0a8('0x45')][_0xf0a8('0x24')]);_0x12cb65[_0xf0a8('0x26')]=_['keys'](_0x2197a9['query']);_0x12cb65[_0xf0a8('0x32')]=_[_0xf0a8('0x28')](_0x12cb65['model'],_0x12cb65['query']);_0x5c0052[_0xf0a8('0x2b')]=_[_0xf0a8('0x28')](_0x12cb65['model'],qs[_0xf0a8('0x2a')](_0x2197a9[_0xf0a8('0x26')][_0xf0a8('0x2a')]));_0x5c0052[_0xf0a8('0x2b')]=_0x5c0052[_0xf0a8('0x2b')][_0xf0a8('0x2c')]?_0x5c0052[_0xf0a8('0x2b')]:_0x12cb65['model'];_0x5c0052[_0xf0a8('0x2f')]=qs[_0xf0a8('0x30')](_0x2197a9[_0xf0a8('0x26')][_0xf0a8('0x30')]);_0x5c0052[_0xf0a8('0x31')]=qs[_0xf0a8('0x32')](_[_0xf0a8('0x33')](_0x2197a9['query'],_0x12cb65[_0xf0a8('0x32')]));if(_0x2197a9[_0xf0a8('0x26')][_0xf0a8('0x34')]){_0x5c0052[_0xf0a8('0x31')]=_[_0xf0a8('0x35')](_0x5c0052[_0xf0a8('0x31')],{'$or':_['map'](_0x5c0052[_0xf0a8('0x2b')],function(_0x4855b8){var _0x429c48={};_0x429c48[_0x4855b8]={'$like':'%'+_0x2197a9[_0xf0a8('0x26')][_0xf0a8('0x34')]+'%'};return _0x429c48;})});}_0x5c0052=_[_0xf0a8('0x35')]({},_0x5c0052,_0x2197a9[_0xf0a8('0x37')]);return _0x5a5ac9[_0xf0a8('0x44')](_0x5c0052);}})['then'](function(_0x3e4ee4){if(_0x3e4ee4){_0x18167e=_0x3e4ee4[_0xf0a8('0x2c')];if(!_0x2197a9['query']['hasOwnProperty'](_0xf0a8('0x2e'))){_0x5c0052['limit']=qs[_0xf0a8('0x1b')](_0x2197a9[_0xf0a8('0x26')][_0xf0a8('0x1b')]);_0x5c0052[_0xf0a8('0x18')]=qs['offset'](_0x2197a9['query'][_0xf0a8('0x18')]);}return _0x5a5ac9[_0xf0a8('0x44')](_0x5c0052);}})[_0xf0a8('0x38')](function(_0x2db794){if(_0x2db794){return _0x2db794?{'count':_0x18167e,'rows':_0x2db794}:null;}})[_0xf0a8('0x38')](respondWithResult(_0x546fe4,null))[_0xf0a8('0x3c')](handleError(_0x546fe4,null));};exports['getSubjects']=function(_0x27766f,_0x314b75,_0x37acff){var _0x33b2e6={};var _0x143cf5={};var _0x429477;var _0x4f8178;return db['Dynamics365Configuration'][_0xf0a8('0x46')]({'where':{'id':_0x27766f['params']['id']}})[_0xf0a8('0x38')](handleEntityNotFound(_0x314b75,null))[_0xf0a8('0x38')](function(_0x559794){if(_0x559794){_0x429477=_0x559794;_0x143cf5[_0xf0a8('0x29')]=_['keys'](db['Dynamics365Field'][_0xf0a8('0x24')]);_0x143cf5[_0xf0a8('0x26')]=_[_0xf0a8('0x27')](_0x27766f[_0xf0a8('0x26')]);_0x143cf5['filters']=_['intersection'](_0x143cf5['model'],_0x143cf5['query']);_0x33b2e6['attributes']=_['intersection'](_0x143cf5[_0xf0a8('0x29')],qs[_0xf0a8('0x2a')](_0x27766f['query'][_0xf0a8('0x2a')]));_0x33b2e6[_0xf0a8('0x2b')]=_0x33b2e6[_0xf0a8('0x2b')][_0xf0a8('0x2c')]?_0x33b2e6[_0xf0a8('0x2b')]:_0x143cf5[_0xf0a8('0x29')];_0x33b2e6[_0xf0a8('0x2f')]=qs['sort'](_0x27766f[_0xf0a8('0x26')][_0xf0a8('0x30')]);_0x33b2e6[_0xf0a8('0x31')]=qs['filters'](_['pick'](_0x27766f[_0xf0a8('0x26')],_0x143cf5[_0xf0a8('0x32')]));if(_0x27766f[_0xf0a8('0x26')][_0xf0a8('0x34')]){_0x33b2e6['where']=_['merge'](_0x33b2e6[_0xf0a8('0x31')],{'$or':_['map'](_0x33b2e6[_0xf0a8('0x2b')],function(_0x494447){var _0x57a3ff={};_0x57a3ff[_0x494447]={'$like':'%'+_0x27766f['query'][_0xf0a8('0x34')]+'%'};return _0x57a3ff;})});}_0x33b2e6=_['merge']({},_0x33b2e6,_0x27766f[_0xf0a8('0x37')]);return _0x429477['getSubjects'](_0x33b2e6);}})[_0xf0a8('0x38')](function(_0x1b530f){if(_0x1b530f){_0x4f8178=_0x1b530f[_0xf0a8('0x2c')];if(!_0x27766f[_0xf0a8('0x26')]['hasOwnProperty'](_0xf0a8('0x2e'))){_0x33b2e6[_0xf0a8('0x1b')]=qs[_0xf0a8('0x1b')](_0x27766f[_0xf0a8('0x26')][_0xf0a8('0x1b')]);_0x33b2e6[_0xf0a8('0x18')]=qs[_0xf0a8('0x18')](_0x27766f['query']['offset']);}return _0x429477['getSubjects'](_0x33b2e6);}})['then'](function(_0x519639){if(_0x519639){return _0x519639?{'count':_0x4f8178,'rows':_0x519639}:null;}})[_0xf0a8('0x38')](respondWithResult(_0x314b75,null))[_0xf0a8('0x3c')](handleError(_0x314b75,null));};exports[_0xf0a8('0x47')]=function(_0x72a0b2,_0x170377,_0x4274f7){var _0x5b0e47={};var _0x105d80={};var _0x410855;var _0x34f930;return db[_0xf0a8('0x23')][_0xf0a8('0x46')]({'where':{'id':_0x72a0b2['params']['id']}})['then'](handleEntityNotFound(_0x170377,null))[_0xf0a8('0x38')](function(_0x43732e){if(_0x43732e){_0x410855=_0x43732e;_0x105d80[_0xf0a8('0x29')]=_[_0xf0a8('0x27')](db['Dynamics365Field']['rawAttributes']);_0x105d80[_0xf0a8('0x26')]=_['keys'](_0x72a0b2[_0xf0a8('0x26')]);_0x105d80[_0xf0a8('0x32')]=_[_0xf0a8('0x28')](_0x105d80[_0xf0a8('0x29')],_0x105d80[_0xf0a8('0x26')]);_0x5b0e47[_0xf0a8('0x2b')]=_[_0xf0a8('0x28')](_0x105d80[_0xf0a8('0x29')],qs[_0xf0a8('0x2a')](_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x2a')]));_0x5b0e47[_0xf0a8('0x2b')]=_0x5b0e47[_0xf0a8('0x2b')]['length']?_0x5b0e47['attributes']:_0x105d80[_0xf0a8('0x29')];_0x5b0e47['order']=qs[_0xf0a8('0x30')](_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x30')]);_0x5b0e47['where']=qs[_0xf0a8('0x32')](_[_0xf0a8('0x33')](_0x72a0b2[_0xf0a8('0x26')],_0x105d80[_0xf0a8('0x32')]));if(_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x34')]){_0x5b0e47[_0xf0a8('0x31')]=_[_0xf0a8('0x35')](_0x5b0e47[_0xf0a8('0x31')],{'$or':_[_0xf0a8('0x22')](_0x5b0e47['attributes'],function(_0x25e55b){var _0x5a4a1d={};_0x5a4a1d[_0x25e55b]={'$like':'%'+_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x34')]+'%'};return _0x5a4a1d;})});}_0x5b0e47=_['merge']({},_0x5b0e47,_0x72a0b2[_0xf0a8('0x37')]);return _0x410855[_0xf0a8('0x47')](_0x5b0e47);}})['then'](function(_0x175236){if(_0x175236){_0x34f930=_0x175236[_0xf0a8('0x2c')];if(!_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x2d')](_0xf0a8('0x2e'))){_0x5b0e47[_0xf0a8('0x1b')]=qs[_0xf0a8('0x1b')](_0x72a0b2[_0xf0a8('0x26')]['limit']);_0x5b0e47[_0xf0a8('0x18')]=qs[_0xf0a8('0x18')](_0x72a0b2[_0xf0a8('0x26')][_0xf0a8('0x18')]);}return _0x410855['getDescriptions'](_0x5b0e47);}})[_0xf0a8('0x38')](function(_0x3a99db){if(_0x3a99db){return _0x3a99db?{'count':_0x34f930,'rows':_0x3a99db}:null;}})[_0xf0a8('0x38')](respondWithResult(_0x170377,null))[_0xf0a8('0x3c')](handleError(_0x170377,null));}; \ No newline at end of file +var _0x9fa9=['type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','status','stack','name','map','Dynamics365Configuration','fieldName'];(function(_0x561583,_0x411bb9){var _0x4e3664=function(_0x1b2212){while(--_0x1b2212){_0x561583['push'](_0x561583['shift']());}};_0x4e3664(++_0x411bb9);}(_0x9fa9,0x1ae));var _0x99fa=function(_0x49ff63,_0x3a20db){_0x49ff63=_0x49ff63-0x0;var _0x4c0c68=_0x9fa9[_0x49ff63];return _0x4c0c68;};'use strict';var emlformat=require(_0x99fa('0x0'));var rimraf=require(_0x99fa('0x1'));var zipdir=require(_0x99fa('0x2'));var jsonpatch=require(_0x99fa('0x3'));var rp=require(_0x99fa('0x4'));var moment=require('moment');var BPromise=require(_0x99fa('0x5'));var Mustache=require(_0x99fa('0x6'));var util=require('util');var path=require(_0x99fa('0x7'));var sox=require(_0x99fa('0x8'));var csv=require('to-csv');var ejs=require(_0x99fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x99fa('0xa'));var squel=require(_0x99fa('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x99fa('0xc'));var querystring=require(_0x99fa('0xd'));var Papa=require('papaparse');var Redis=require(_0x99fa('0xe'));var authService=require(_0x99fa('0xf'));var qs=require(_0x99fa('0x10'));var as=require(_0x99fa('0x11'));var hardwareService=require(_0x99fa('0x12'));var logger=require(_0x99fa('0x13'))(_0x99fa('0x14'));var utils=require('../../config/utils');var config=require(_0x99fa('0x15'));var licenseUtil=require(_0x99fa('0x16'));var db=require(_0x99fa('0x17'))['db'];function respondWithStatusCode(_0x5dd311,_0xc87779){_0xc87779=_0xc87779||0xcc;return function(_0x16f395){if(_0x16f395){return _0x5dd311[_0x99fa('0x18')](_0xc87779);}return _0x5dd311['status'](_0xc87779)['end']();};}function respondWithResult(_0x403e12,_0x2125f3){_0x2125f3=_0x2125f3||0xc8;return function(_0x532ddf){if(_0x532ddf){return _0x403e12['status'](_0x2125f3)[_0x99fa('0x19')](_0x532ddf);}};}function respondWithFilteredResult(_0x3cf4cf,_0xa92fe7){return function(_0x8c2e41){if(_0x8c2e41){var _0x57897c=typeof _0xa92fe7[_0x99fa('0x1a')]===_0x99fa('0x1b')&&typeof _0xa92fe7[_0x99fa('0x1c')]===_0x99fa('0x1b');var _0x10026a=_0x8c2e41[_0x99fa('0x1d')];var _0x5f386b=_0x57897c?0x0:_0xa92fe7[_0x99fa('0x1a')];var _0x3ad021=_0x57897c?_0x8c2e41[_0x99fa('0x1d')]:_0xa92fe7[_0x99fa('0x1a')]+_0xa92fe7[_0x99fa('0x1c')];var _0x59931f;if(_0x3ad021>=_0x10026a){_0x3ad021=_0x10026a;_0x59931f=0xc8;}else{_0x59931f=0xce;}_0x3cf4cf['status'](_0x59931f);return _0x3cf4cf[_0x99fa('0x1e')](_0x99fa('0x1f'),_0x5f386b+'-'+_0x3ad021+'/'+_0x10026a)[_0x99fa('0x19')](_0x8c2e41);}return null;};}function patchUpdates(_0x385436){return function(_0x186281){try{jsonpatch[_0x99fa('0x20')](_0x186281,_0x385436,!![]);}catch(_0x2ec2fa){return BPromise[_0x99fa('0x21')](_0x2ec2fa);}return _0x186281[_0x99fa('0x22')]();};}function saveUpdates(_0xa20b7e,_0x39d298){return function(_0x1baf3a){if(_0x1baf3a){return _0x1baf3a[_0x99fa('0x23')](_0xa20b7e)['then'](function(_0x3ad214){return _0x3ad214;});}return null;};}function removeEntity(_0x51e060,_0x276ca0){return function(_0x28cb0f){if(_0x28cb0f){return _0x28cb0f[_0x99fa('0x24')]()[_0x99fa('0x25')](function(){_0x51e060[_0x99fa('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b067,_0x58bd41){return function(_0x4e13c3){if(!_0x4e13c3){_0x5b067['sendStatus'](0x194);}return _0x4e13c3;};}function handleError(_0x5d6c94,_0xbd6aff){_0xbd6aff=_0xbd6aff||0x1f4;return function(_0x8acf74){logger['error'](_0x8acf74[_0x99fa('0x27')]);if(_0x8acf74['name']){delete _0x8acf74[_0x99fa('0x28')];}_0x5d6c94[_0x99fa('0x26')](_0xbd6aff)['send'](_0x8acf74);};}exports['index']=function(_0x152053,_0x8d7793){var _0x2fe798={},_0x34bd2f={},_0x3eaa4a={'count':0x0,'rows':[]};var _0x5eae9=_[_0x99fa('0x29')](db[_0x99fa('0x2a')]['rawAttributes'],function(_0x4090aa){return{'name':_0x4090aa[_0x99fa('0x2b')],'type':_0x4090aa[_0x99fa('0x2c')][_0x99fa('0x2d')]};});_0x34bd2f['model']=_[_0x99fa('0x29')](_0x5eae9,_0x99fa('0x28'));_0x34bd2f[_0x99fa('0x2e')]=_[_0x99fa('0x2f')](_0x152053['query']);_0x34bd2f[_0x99fa('0x30')]=_[_0x99fa('0x31')](_0x34bd2f[_0x99fa('0x32')],_0x34bd2f[_0x99fa('0x2e')]);_0x2fe798[_0x99fa('0x33')]=_['intersection'](_0x34bd2f[_0x99fa('0x32')],qs[_0x99fa('0x34')](_0x152053[_0x99fa('0x2e')][_0x99fa('0x34')]));_0x2fe798[_0x99fa('0x33')]=_0x2fe798['attributes'][_0x99fa('0x35')]?_0x2fe798[_0x99fa('0x33')]:_0x34bd2f['model'];if(!_0x152053[_0x99fa('0x2e')][_0x99fa('0x36')](_0x99fa('0x37'))){_0x2fe798[_0x99fa('0x1c')]=qs[_0x99fa('0x1c')](_0x152053[_0x99fa('0x2e')][_0x99fa('0x1c')]);_0x2fe798['offset']=qs[_0x99fa('0x1a')](_0x152053[_0x99fa('0x2e')][_0x99fa('0x1a')]);}_0x2fe798[_0x99fa('0x38')]=qs[_0x99fa('0x39')](_0x152053[_0x99fa('0x2e')][_0x99fa('0x39')]);_0x2fe798[_0x99fa('0x3a')]=qs[_0x99fa('0x30')](_[_0x99fa('0x3b')](_0x152053['query'],_0x34bd2f['filters']),_0x5eae9);if(_0x152053['query'][_0x99fa('0x3c')]){_0x2fe798['where']=_[_0x99fa('0x3d')](_0x2fe798[_0x99fa('0x3a')],{'$or':_[_0x99fa('0x29')](_0x5eae9,function(_0x427f7a){if(_0x427f7a['type']!==_0x99fa('0x3e')){var _0x332a6f={};_0x332a6f[_0x427f7a[_0x99fa('0x28')]]={'$like':'%'+_0x152053[_0x99fa('0x2e')][_0x99fa('0x3c')]+'%'};return _0x332a6f;}})});}_0x2fe798=_[_0x99fa('0x3d')]({},_0x2fe798,_0x152053['options']);var _0x4ea81e={'where':_0x2fe798[_0x99fa('0x3a')]};return db[_0x99fa('0x2a')][_0x99fa('0x1d')](_0x4ea81e)[_0x99fa('0x25')](function(_0x44050a){_0x3eaa4a[_0x99fa('0x1d')]=_0x44050a;if(_0x152053[_0x99fa('0x2e')][_0x99fa('0x3f')]){_0x2fe798['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x99fa('0x40')](_0x2fe798);})[_0x99fa('0x25')](function(_0x51eecf){_0x3eaa4a[_0x99fa('0x41')]=_0x51eecf;return _0x3eaa4a;})['then'](respondWithFilteredResult(_0x8d7793,_0x2fe798))[_0x99fa('0x42')](handleError(_0x8d7793,null));};exports[_0x99fa('0x43')]=function(_0x25d223,_0x25eb52){var _0x5c5b53={'raw':![],'where':{'id':_0x25d223[_0x99fa('0x44')]['id']}},_0x358b52={};_0x358b52[_0x99fa('0x32')]=_[_0x99fa('0x2f')](db[_0x99fa('0x2a')][_0x99fa('0x45')]);_0x358b52['query']=_[_0x99fa('0x2f')](_0x25d223['query']);_0x358b52[_0x99fa('0x30')]=_[_0x99fa('0x31')](_0x358b52['model'],_0x358b52['query']);_0x5c5b53[_0x99fa('0x33')]=_[_0x99fa('0x31')](_0x358b52[_0x99fa('0x32')],qs[_0x99fa('0x34')](_0x25d223['query'][_0x99fa('0x34')]));_0x5c5b53[_0x99fa('0x33')]=_0x5c5b53[_0x99fa('0x33')][_0x99fa('0x35')]?_0x5c5b53[_0x99fa('0x33')]:_0x358b52[_0x99fa('0x32')];if(_0x25d223[_0x99fa('0x2e')][_0x99fa('0x3f')]){_0x5c5b53['include']=[{'all':!![]}];}_0x5c5b53=_['merge']({},_0x5c5b53,_0x25d223[_0x99fa('0x46')]);return db[_0x99fa('0x2a')][_0x99fa('0x47')](_0x5c5b53)[_0x99fa('0x25')](handleEntityNotFound(_0x25eb52,null))[_0x99fa('0x25')](respondWithResult(_0x25eb52,null))[_0x99fa('0x42')](handleError(_0x25eb52,null));};exports[_0x99fa('0x48')]=function(_0x3fed28,_0x2603f7){return db['Dynamics365Configuration']['create'](_0x3fed28['body'],{})['then'](respondWithResult(_0x2603f7,0xc9))[_0x99fa('0x42')](handleError(_0x2603f7,null));};exports[_0x99fa('0x23')]=function(_0x185b77,_0x42cb7e){if(_0x185b77['body']['id']){delete _0x185b77[_0x99fa('0x49')]['id'];}return db[_0x99fa('0x2a')]['find']({'where':{'id':_0x185b77['params']['id']}})[_0x99fa('0x25')](handleEntityNotFound(_0x42cb7e,null))[_0x99fa('0x25')](saveUpdates(_0x185b77[_0x99fa('0x49')],null))['then'](respondWithResult(_0x42cb7e,null))[_0x99fa('0x42')](handleError(_0x42cb7e,null));};exports[_0x99fa('0x24')]=function(_0x460ef6,_0x4189de){return db[_0x99fa('0x2a')][_0x99fa('0x47')]({'where':{'id':_0x460ef6[_0x99fa('0x44')]['id']}})[_0x99fa('0x25')](handleEntityNotFound(_0x4189de,null))[_0x99fa('0x25')](removeEntity(_0x4189de,null))['catch'](handleError(_0x4189de,null));};exports[_0x99fa('0x4a')]=function(_0x11e896,_0x28fe24,_0x5cc78f){var _0x28cb91={};var _0x59d8c8={};var _0x1b8f70;var _0xb46fc1;return db[_0x99fa('0x2a')][_0x99fa('0x4b')]({'where':{'id':_0x11e896[_0x99fa('0x44')]['id']}})[_0x99fa('0x25')](handleEntityNotFound(_0x28fe24,null))['then'](function(_0xa809e4){if(_0xa809e4){_0x1b8f70=_0xa809e4;_0x59d8c8['model']=_['keys'](db[_0x99fa('0x4c')][_0x99fa('0x45')]);_0x59d8c8[_0x99fa('0x2e')]=_[_0x99fa('0x2f')](_0x11e896[_0x99fa('0x2e')]);_0x59d8c8[_0x99fa('0x30')]=_['intersection'](_0x59d8c8[_0x99fa('0x32')],_0x59d8c8[_0x99fa('0x2e')]);_0x28cb91[_0x99fa('0x33')]=_[_0x99fa('0x31')](_0x59d8c8[_0x99fa('0x32')],qs[_0x99fa('0x34')](_0x11e896[_0x99fa('0x2e')][_0x99fa('0x34')]));_0x28cb91[_0x99fa('0x33')]=_0x28cb91[_0x99fa('0x33')][_0x99fa('0x35')]?_0x28cb91['attributes']:_0x59d8c8[_0x99fa('0x32')];_0x28cb91[_0x99fa('0x38')]=qs[_0x99fa('0x39')](_0x11e896[_0x99fa('0x2e')][_0x99fa('0x39')]);_0x28cb91['where']=qs[_0x99fa('0x30')](_[_0x99fa('0x3b')](_0x11e896[_0x99fa('0x2e')],_0x59d8c8['filters']));if(_0x11e896['query'][_0x99fa('0x3c')]){_0x28cb91['where']=_['merge'](_0x28cb91['where'],{'$or':_['map'](_0x28cb91['attributes'],function(_0x4ae617){var _0x412b2b={};_0x412b2b[_0x4ae617]={'$like':'%'+_0x11e896['query'][_0x99fa('0x3c')]+'%'};return _0x412b2b;})});}_0x28cb91=_[_0x99fa('0x3d')]({},_0x28cb91,_0x11e896['options']);return _0x1b8f70['getFields'](_0x28cb91);}})[_0x99fa('0x25')](function(_0x12dc05){if(_0x12dc05){_0xb46fc1=_0x12dc05[_0x99fa('0x35')];if(!_0x11e896[_0x99fa('0x2e')][_0x99fa('0x36')](_0x99fa('0x37'))){_0x28cb91[_0x99fa('0x1c')]=qs[_0x99fa('0x1c')](_0x11e896[_0x99fa('0x2e')][_0x99fa('0x1c')]);_0x28cb91[_0x99fa('0x1a')]=qs[_0x99fa('0x1a')](_0x11e896[_0x99fa('0x2e')][_0x99fa('0x1a')]);}return _0x1b8f70[_0x99fa('0x4a')](_0x28cb91);}})[_0x99fa('0x25')](function(_0x32f3a4){if(_0x32f3a4){return _0x32f3a4?{'count':_0xb46fc1,'rows':_0x32f3a4}:null;}})[_0x99fa('0x25')](respondWithResult(_0x28fe24,null))[_0x99fa('0x42')](handleError(_0x28fe24,null));};exports[_0x99fa('0x4d')]=function(_0xcbcfd2,_0x4cfacb,_0x3f309){var _0x333ccd={};var _0x4072f6={};var _0x1d5dec;var _0x511d90;return db[_0x99fa('0x2a')][_0x99fa('0x4b')]({'where':{'id':_0xcbcfd2['params']['id']}})[_0x99fa('0x25')](handleEntityNotFound(_0x4cfacb,null))[_0x99fa('0x25')](function(_0x30a233){if(_0x30a233){_0x1d5dec=_0x30a233;_0x4072f6[_0x99fa('0x32')]=_[_0x99fa('0x2f')](db['Dynamics365Field'][_0x99fa('0x45')]);_0x4072f6[_0x99fa('0x2e')]=_[_0x99fa('0x2f')](_0xcbcfd2[_0x99fa('0x2e')]);_0x4072f6['filters']=_['intersection'](_0x4072f6[_0x99fa('0x32')],_0x4072f6['query']);_0x333ccd['attributes']=_[_0x99fa('0x31')](_0x4072f6[_0x99fa('0x32')],qs[_0x99fa('0x34')](_0xcbcfd2['query'][_0x99fa('0x34')]));_0x333ccd[_0x99fa('0x33')]=_0x333ccd['attributes'][_0x99fa('0x35')]?_0x333ccd[_0x99fa('0x33')]:_0x4072f6[_0x99fa('0x32')];_0x333ccd[_0x99fa('0x38')]=qs[_0x99fa('0x39')](_0xcbcfd2[_0x99fa('0x2e')][_0x99fa('0x39')]);_0x333ccd[_0x99fa('0x3a')]=qs['filters'](_[_0x99fa('0x3b')](_0xcbcfd2[_0x99fa('0x2e')],_0x4072f6[_0x99fa('0x30')]));if(_0xcbcfd2[_0x99fa('0x2e')][_0x99fa('0x3c')]){_0x333ccd[_0x99fa('0x3a')]=_[_0x99fa('0x3d')](_0x333ccd['where'],{'$or':_[_0x99fa('0x29')](_0x333ccd[_0x99fa('0x33')],function(_0x45cdd0){var _0x54b399={};_0x54b399[_0x45cdd0]={'$like':'%'+_0xcbcfd2[_0x99fa('0x2e')][_0x99fa('0x3c')]+'%'};return _0x54b399;})});}_0x333ccd=_[_0x99fa('0x3d')]({},_0x333ccd,_0xcbcfd2[_0x99fa('0x46')]);return _0x1d5dec[_0x99fa('0x4d')](_0x333ccd);}})[_0x99fa('0x25')](function(_0x19420b){if(_0x19420b){_0x511d90=_0x19420b['length'];if(!_0xcbcfd2['query'][_0x99fa('0x36')](_0x99fa('0x37'))){_0x333ccd[_0x99fa('0x1c')]=qs[_0x99fa('0x1c')](_0xcbcfd2[_0x99fa('0x2e')][_0x99fa('0x1c')]);_0x333ccd[_0x99fa('0x1a')]=qs['offset'](_0xcbcfd2[_0x99fa('0x2e')][_0x99fa('0x1a')]);}return _0x1d5dec[_0x99fa('0x4d')](_0x333ccd);}})['then'](function(_0x4c317b){if(_0x4c317b){return _0x4c317b?{'count':_0x511d90,'rows':_0x4c317b}:null;}})['then'](respondWithResult(_0x4cfacb,null))[_0x99fa('0x42')](handleError(_0x4cfacb,null));};exports[_0x99fa('0x4e')]=function(_0x4161ee,_0x41d154,_0x17d101){var _0x2992f8={};var _0x401cfe={};var _0x4cefd7;var _0x10aebe;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4161ee['params']['id']}})[_0x99fa('0x25')](handleEntityNotFound(_0x41d154,null))[_0x99fa('0x25')](function(_0x2ee779){if(_0x2ee779){_0x4cefd7=_0x2ee779;_0x401cfe['model']=_['keys'](db[_0x99fa('0x4c')]['rawAttributes']);_0x401cfe[_0x99fa('0x2e')]=_[_0x99fa('0x2f')](_0x4161ee[_0x99fa('0x2e')]);_0x401cfe[_0x99fa('0x30')]=_[_0x99fa('0x31')](_0x401cfe['model'],_0x401cfe[_0x99fa('0x2e')]);_0x2992f8['attributes']=_[_0x99fa('0x31')](_0x401cfe['model'],qs[_0x99fa('0x34')](_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x34')]));_0x2992f8['attributes']=_0x2992f8[_0x99fa('0x33')]['length']?_0x2992f8[_0x99fa('0x33')]:_0x401cfe[_0x99fa('0x32')];_0x2992f8[_0x99fa('0x38')]=qs[_0x99fa('0x39')](_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x39')]);_0x2992f8[_0x99fa('0x3a')]=qs['filters'](_[_0x99fa('0x3b')](_0x4161ee[_0x99fa('0x2e')],_0x401cfe['filters']));if(_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x3c')]){_0x2992f8[_0x99fa('0x3a')]=_[_0x99fa('0x3d')](_0x2992f8[_0x99fa('0x3a')],{'$or':_[_0x99fa('0x29')](_0x2992f8[_0x99fa('0x33')],function(_0x1fda12){var _0x5a0d75={};_0x5a0d75[_0x1fda12]={'$like':'%'+_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x3c')]+'%'};return _0x5a0d75;})});}_0x2992f8=_[_0x99fa('0x3d')]({},_0x2992f8,_0x4161ee[_0x99fa('0x46')]);return _0x4cefd7[_0x99fa('0x4e')](_0x2992f8);}})['then'](function(_0x3450e0){if(_0x3450e0){_0x10aebe=_0x3450e0[_0x99fa('0x35')];if(!_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x36')](_0x99fa('0x37'))){_0x2992f8[_0x99fa('0x1c')]=qs['limit'](_0x4161ee[_0x99fa('0x2e')][_0x99fa('0x1c')]);_0x2992f8['offset']=qs[_0x99fa('0x1a')](_0x4161ee['query'][_0x99fa('0x1a')]);}return _0x4cefd7[_0x99fa('0x4e')](_0x2992f8);}})[_0x99fa('0x25')](function(_0x5e8841){if(_0x5e8841){return _0x5e8841?{'count':_0x10aebe,'rows':_0x5e8841}:null;}})[_0x99fa('0x25')](respondWithResult(_0x41d154,null))[_0x99fa('0x42')](handleError(_0x41d154,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 00010cb..2a46897 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 _0x8d0e=['define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x5e2128,_0xe2107e){var _0x2bbc88=function(_0x23ce4d){while(--_0x23ce4d){_0x5e2128['push'](_0x5e2128['shift']());}};_0x2bbc88(++_0xe2107e);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x2461c9,_0x5e61da){_0x2461c9=_0x2461c9-0x0;var _0x4b2189=_0x8d0e[_0x2461c9];return _0x4b2189;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe14d,0x1ee));var _0xde14=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe14d[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('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 ec1d1ce..b88abf7 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 _0x72c3=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x72c3,0xde));var _0x372c=function(_0xfcccca,_0x3c5e66){_0xfcccca=_0xfcccca-0x0;var _0x39de4b=_0x72c3[_0xfcccca];return _0x39de4b;};'use strict';var _=require('lodash');var util=require(_0x372c('0x0'));var moment=require(_0x372c('0x1'));var BPromise=require(_0x372c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x372c('0x3'));var db=require(_0x372c('0x4'))['db'];var utils=require(_0x372c('0x5'));var logger=require(_0x372c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x372c('0x7'));var client=jayson[_0x372c('0x8')][_0x372c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3531ee,_0x3011ed,_0x1fae50){return new BPromise(function(_0x4563b2,_0x330731){return client[_0x372c('0xa')](_0x3531ee,_0x1fae50)[_0x372c('0xb')](function(_0x1dd74c){logger[_0x372c('0xc')](_0x372c('0xd'),_0x3011ed,_0x372c('0xe'));logger[_0x372c('0xf')](_0x372c('0x10'),_0x3011ed,'request\x20sent',JSON[_0x372c('0x11')](_0x1dd74c));if(_0x1dd74c['error']){if(_0x1dd74c['error'][_0x372c('0x12')]===0x1f4){logger['error'](_0x372c('0xd'),_0x3011ed,_0x1dd74c[_0x372c('0x13')][_0x372c('0x14')]);return _0x330731(_0x1dd74c[_0x372c('0x13')][_0x372c('0x14')]);}logger[_0x372c('0x13')](_0x372c('0xd'),_0x3011ed,_0x1dd74c[_0x372c('0x13')]['message']);return _0x4563b2(_0x1dd74c[_0x372c('0x13')][_0x372c('0x14')]);}else{logger[_0x372c('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3011ed,_0x372c('0xe'));_0x4563b2(_0x1dd74c[_0x372c('0x15')][_0x372c('0x14')]);}})[_0x372c('0x16')](function(_0x380d9e){logger[_0x372c('0x13')](_0x372c('0xd'),_0x3011ed,_0x380d9e);_0x330731(_0x380d9e);});});} \ No newline at end of file +var _0x532e=['message','info','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1a1d9d,_0x302579){var _0x402817=function(_0x28f894){while(--_0x28f894){_0x1a1d9d['push'](_0x1a1d9d['shift']());}};_0x402817(++_0x302579);}(_0x532e,0x1de));var _0xe532=function(_0xd86a22,_0x58034d){_0xd86a22=_0xd86a22-0x0;var _0x2cc68b=_0x532e[_0xd86a22];return _0x2cc68b;};'use strict';var _=require('lodash');var util=require(_0xe532('0x0'));var moment=require(_0xe532('0x1'));var BPromise=require('bluebird');var rs=require(_0xe532('0x2'));var fs=require('fs');var Redis=require(_0xe532('0x3'));var db=require(_0xe532('0x4'))['db'];var utils=require(_0xe532('0x5'));var logger=require(_0xe532('0x6'))(_0xe532('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe532('0x8')][_0xe532('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39e631,_0x4948e6,_0x135aa9){return new BPromise(function(_0x260117,_0x1be52a){return client['request'](_0x39e631,_0x135aa9)[_0xe532('0xa')](function(_0x48bfb8){logger['info'](_0xe532('0xb'),_0x4948e6,'request\x20sent');logger['debug'](_0xe532('0xc'),_0x4948e6,_0xe532('0xd'),JSON[_0xe532('0xe')](_0x48bfb8));if(_0x48bfb8[_0xe532('0xf')]){if(_0x48bfb8[_0xe532('0xf')]['code']===0x1f4){logger['error'](_0xe532('0xb'),_0x4948e6,_0x48bfb8[_0xe532('0xf')][_0xe532('0x10')]);return _0x1be52a(_0x48bfb8[_0xe532('0xf')]['message']);}logger[_0xe532('0xf')](_0xe532('0xb'),_0x4948e6,_0x48bfb8[_0xe532('0xf')][_0xe532('0x10')]);return _0x260117(_0x48bfb8[_0xe532('0xf')][_0xe532('0x10')]);}else{logger[_0xe532('0x11')](_0xe532('0xb'),_0x4948e6,_0xe532('0xd'));_0x260117(_0x48bfb8['result']['message']);}})[_0xe532('0x12')](function(_0x5ad5ba){logger[_0xe532('0xf')](_0xe532('0xb'),_0x4948e6,_0x5ad5ba);_0x1be52a(_0x5ad5ba);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 98b3e94..2f3765a 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 _0x2987=['create','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post'];(function(_0x59393a,_0x2207cc){var _0x5e5d02=function(_0x95f94d){while(--_0x95f94d){_0x59393a['push'](_0x59393a['shift']());}};_0x5e5d02(++_0x2207cc);}(_0x2987,0x1a6));var _0x7298=function(_0x5cb6f3,_0x4085bc){_0x5cb6f3=_0x5cb6f3-0x0;var _0x225ffe=_0x2987[_0x5cb6f3];return _0x225ffe;};'use strict';var multer=require(_0x7298('0x0'));var util=require(_0x7298('0x1'));var path=require(_0x7298('0x2'));var timeout=require('connect-timeout');var express=require(_0x7298('0x3'));var router=express[_0x7298('0x4')]();var fs_extra=require(_0x7298('0x5'));var auth=require(_0x7298('0x6'));var interaction=require(_0x7298('0x7'));var config=require(_0x7298('0x8'));var controller=require(_0x7298('0x9'));router[_0x7298('0xa')]('/',auth[_0x7298('0xb')](),controller['index']);router[_0x7298('0xa')](_0x7298('0xc'),auth[_0x7298('0xb')](),controller[_0x7298('0xd')]);router[_0x7298('0xe')]('/',auth[_0x7298('0xb')](),controller[_0x7298('0xf')]);router[_0x7298('0x10')](_0x7298('0xc'),auth['isAuthenticated'](),controller[_0x7298('0x11')]);router['delete'](_0x7298('0xc'),auth[_0x7298('0xb')](),controller['destroy']);module[_0x7298('0x12')]=router; \ No newline at end of file +var _0xbcd7=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x99a64a,_0x485bd3){var _0x7cc0e3=function(_0x243775){while(--_0x243775){_0x99a64a['push'](_0x99a64a['shift']());}};_0x7cc0e3(++_0x485bd3);}(_0xbcd7,0xd6));var _0x7bcd=function(_0x24d476,_0xae6df6){_0x24d476=_0x24d476-0x0;var _0x25f3ae=_0xbcd7[_0x24d476];return _0x25f3ae;};'use strict';var multer=require(_0x7bcd('0x0'));var util=require(_0x7bcd('0x1'));var path=require(_0x7bcd('0x2'));var timeout=require(_0x7bcd('0x3'));var express=require(_0x7bcd('0x4'));var router=express['Router']();var fs_extra=require(_0x7bcd('0x5'));var auth=require(_0x7bcd('0x6'));var interaction=require(_0x7bcd('0x7'));var config=require(_0x7bcd('0x8'));var controller=require(_0x7bcd('0x9'));router[_0x7bcd('0xa')]('/',auth[_0x7bcd('0xb')](),controller[_0x7bcd('0xc')]);router[_0x7bcd('0xa')]('/:id',auth[_0x7bcd('0xb')](),controller['show']);router[_0x7bcd('0xd')]('/',auth[_0x7bcd('0xb')](),controller[_0x7bcd('0xe')]);router[_0x7bcd('0xf')](_0x7bcd('0x10'),auth['isAuthenticated'](),controller[_0x7bcd('0x11')]);router[_0x7bcd('0x12')](_0x7bcd('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x7bcd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0fb0b7a..092ce73 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 _0xfbd6=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0xa7fe75,_0x143a00){var _0x3c7406=function(_0x42013b){while(--_0x42013b){_0xa7fe75['push'](_0xa7fe75['shift']());}};_0x3c7406(++_0x143a00);}(_0xfbd6,0x75));var _0x6fbd=function(_0x342123,_0x3b4064){_0x342123=_0x342123-0x0;var _0x1656c6=_0xfbd6[_0x342123];return _0x1656c6;};'use strict';var Sequelize=require(_0x6fbd('0x0'));module[_0x6fbd('0x1')]={'type':{'type':Sequelize[_0x6fbd('0x2')](_0x6fbd('0x3'),_0x6fbd('0x4'),_0x6fbd('0x5'),_0x6fbd('0x6'),_0x6fbd('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6fbd('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6fbd('0x3'),'variable',_0x6fbd('0x5'))},'keyContent':{'type':Sequelize[_0x6fbd('0x8')]},'idField':{'type':Sequelize[_0x6fbd('0x8')]},'nameField':{'type':Sequelize[_0x6fbd('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6fbd('0x8')]}}; \ No newline at end of file +var _0x9025=['variable','customVariable','keyValue','string','STRING','sequelize','exports','ENUM'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x9025,0x13d));var _0x5902=function(_0x3e7714,_0x4bd4bf){_0x3e7714=_0x3e7714-0x0;var _0x29edfe=_0x9025[_0x3e7714];return _0x29edfe;};'use strict';var Sequelize=require(_0x5902('0x0'));module[_0x5902('0x1')]={'type':{'type':Sequelize[_0x5902('0x2')]('string',_0x5902('0x3'),_0x5902('0x4'),_0x5902('0x5'),'picklist'),'defaultValue':_0x5902('0x6')},'content':{'type':Sequelize[_0x5902('0x7')]},'key':{'type':Sequelize[_0x5902('0x7')]},'keyType':{'type':Sequelize[_0x5902('0x2')](_0x5902('0x6'),_0x5902('0x3'),_0x5902('0x4'))},'keyContent':{'type':Sequelize[_0x5902('0x7')]},'idField':{'type':Sequelize[_0x5902('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5902('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index eb0b22b..48d67d8 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 _0x7434=['fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','destroy','eml-format','zip-dir','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','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x3f074b,_0x4219c9){var _0x200812=function(_0x4d1887){while(--_0x4d1887){_0x3f074b['push'](_0x3f074b['shift']());}};_0x200812(++_0x4219c9);}(_0x7434,0x195));var _0x4743=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7434[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x4743('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4743('0x1'));var jsonpatch=require(_0x4743('0x2'));var rp=require(_0x4743('0x3'));var moment=require('moment');var BPromise=require(_0x4743('0x4'));var Mustache=require(_0x4743('0x5'));var util=require(_0x4743('0x6'));var path=require(_0x4743('0x7'));var sox=require(_0x4743('0x8'));var csv=require('to-csv');var ejs=require(_0x4743('0x9'));var fs=require('fs');var fs_extra=require(_0x4743('0xa'));var _=require(_0x4743('0xb'));var squel=require(_0x4743('0xc'));var crypto=require(_0x4743('0xd'));var jsforce=require(_0x4743('0xe'));var deskjs=require(_0x4743('0xf'));var toCsv=require(_0x4743('0x10'));var querystring=require(_0x4743('0x11'));var Papa=require('papaparse');var Redis=require(_0x4743('0x12'));var authService=require(_0x4743('0x13'));var qs=require(_0x4743('0x14'));var as=require(_0x4743('0x15'));var hardwareService=require(_0x4743('0x16'));var logger=require(_0x4743('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4743('0x18'));var licenseUtil=require(_0x4743('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47337e,_0x51075e){_0x51075e=_0x51075e||0xcc;return function(_0x5a6c4e){if(_0x5a6c4e){return _0x47337e[_0x4743('0x1a')](_0x51075e);}return _0x47337e[_0x4743('0x1b')](_0x51075e)[_0x4743('0x1c')]();};}function respondWithResult(_0xb1251a,_0x41c447){_0x41c447=_0x41c447||0xc8;return function(_0x2a8bd2){if(_0x2a8bd2){return _0xb1251a[_0x4743('0x1b')](_0x41c447)[_0x4743('0x1d')](_0x2a8bd2);}};}function respondWithFilteredResult(_0x2a4d07,_0x2cc409){return function(_0x395233){if(_0x395233){var _0x3e237d=typeof _0x2cc409['offset']===_0x4743('0x1e')&&typeof _0x2cc409[_0x4743('0x1f')]==='undefined';var _0x36fbf3=_0x395233[_0x4743('0x20')];var _0x5a880c=_0x3e237d?0x0:_0x2cc409[_0x4743('0x21')];var _0xcd63e8=_0x3e237d?_0x395233[_0x4743('0x20')]:_0x2cc409['offset']+_0x2cc409[_0x4743('0x1f')];var _0x49f41a;if(_0xcd63e8>=_0x36fbf3){_0xcd63e8=_0x36fbf3;_0x49f41a=0xc8;}else{_0x49f41a=0xce;}_0x2a4d07[_0x4743('0x1b')](_0x49f41a);return _0x2a4d07[_0x4743('0x22')](_0x4743('0x23'),_0x5a880c+'-'+_0xcd63e8+'/'+_0x36fbf3)[_0x4743('0x1d')](_0x395233);}return null;};}function patchUpdates(_0x149035){return function(_0x2f0c23){try{jsonpatch[_0x4743('0x24')](_0x2f0c23,_0x149035,!![]);}catch(_0x2572d0){return BPromise[_0x4743('0x25')](_0x2572d0);}return _0x2f0c23[_0x4743('0x26')]();};}function saveUpdates(_0x3f372d,_0x3d48fb){return function(_0x3def11){if(_0x3def11){return _0x3def11[_0x4743('0x27')](_0x3f372d)[_0x4743('0x28')](function(_0x2c9a77){return _0x2c9a77;});}return null;};}function removeEntity(_0x3fc6aa,_0x4f765b){return function(_0x419fcd){if(_0x419fcd){return _0x419fcd['destroy']()['then'](function(){_0x3fc6aa[_0x4743('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2937cb,_0x6e895d){return function(_0x2cff75){if(!_0x2cff75){_0x2937cb['sendStatus'](0x194);}return _0x2cff75;};}function handleError(_0x45b024,_0x430350){_0x430350=_0x430350||0x1f4;return function(_0x8e0eaa){logger['error'](_0x8e0eaa[_0x4743('0x29')]);if(_0x8e0eaa[_0x4743('0x2a')]){delete _0x8e0eaa[_0x4743('0x2a')];}_0x45b024[_0x4743('0x1b')](_0x430350)[_0x4743('0x2b')](_0x8e0eaa);};}exports[_0x4743('0x2c')]=function(_0x564779,_0x177526){var _0x5709a9={},_0x3d8358={},_0x3b4d00={'count':0x0,'rows':[]};var _0x3eb48f=_[_0x4743('0x2d')](db[_0x4743('0x2e')][_0x4743('0x2f')],function(_0x3fd051){return{'name':_0x3fd051[_0x4743('0x30')],'type':_0x3fd051[_0x4743('0x31')][_0x4743('0x32')]};});_0x3d8358[_0x4743('0x33')]=_[_0x4743('0x2d')](_0x3eb48f,_0x4743('0x2a'));_0x3d8358['query']=_[_0x4743('0x34')](_0x564779[_0x4743('0x35')]);_0x3d8358[_0x4743('0x36')]=_[_0x4743('0x37')](_0x3d8358[_0x4743('0x33')],_0x3d8358['query']);_0x5709a9[_0x4743('0x38')]=_[_0x4743('0x37')](_0x3d8358[_0x4743('0x33')],qs[_0x4743('0x39')](_0x564779[_0x4743('0x35')][_0x4743('0x39')]));_0x5709a9['attributes']=_0x5709a9[_0x4743('0x38')]['length']?_0x5709a9[_0x4743('0x38')]:_0x3d8358[_0x4743('0x33')];if(!_0x564779[_0x4743('0x35')][_0x4743('0x3a')](_0x4743('0x3b'))){_0x5709a9[_0x4743('0x1f')]=qs[_0x4743('0x1f')](_0x564779[_0x4743('0x35')][_0x4743('0x1f')]);_0x5709a9[_0x4743('0x21')]=qs[_0x4743('0x21')](_0x564779[_0x4743('0x35')][_0x4743('0x21')]);}_0x5709a9['order']=qs[_0x4743('0x3c')](_0x564779['query'][_0x4743('0x3c')]);_0x5709a9[_0x4743('0x3d')]=qs[_0x4743('0x36')](_['pick'](_0x564779['query'],_0x3d8358[_0x4743('0x36')]),_0x3eb48f);if(_0x564779[_0x4743('0x35')][_0x4743('0x3e')]){_0x5709a9[_0x4743('0x3d')]=_[_0x4743('0x3f')](_0x5709a9[_0x4743('0x3d')],{'$or':_[_0x4743('0x2d')](_0x3eb48f,function(_0x41208f){if(_0x41208f[_0x4743('0x31')]!==_0x4743('0x40')){var _0x4bcd5d={};_0x4bcd5d[_0x41208f['name']]={'$like':'%'+_0x564779['query']['filter']+'%'};return _0x4bcd5d;}})});}_0x5709a9=_['merge']({},_0x5709a9,_0x564779[_0x4743('0x41')]);var _0x599fff={'where':_0x5709a9[_0x4743('0x3d')]};return db['Dynamics365Field']['count'](_0x599fff)[_0x4743('0x28')](function(_0x2f35cb){_0x3b4d00[_0x4743('0x20')]=_0x2f35cb;if(_0x564779[_0x4743('0x35')][_0x4743('0x42')]){_0x5709a9[_0x4743('0x43')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x4743('0x44')](_0x5709a9);})[_0x4743('0x28')](function(_0x19b052){_0x3b4d00[_0x4743('0x45')]=_0x19b052;return _0x3b4d00;})['then'](respondWithFilteredResult(_0x177526,_0x5709a9))['catch'](handleError(_0x177526,null));};exports[_0x4743('0x46')]=function(_0x4426e7,_0x1e8272){var _0x18e5a0={'raw':!![],'where':{'id':_0x4426e7[_0x4743('0x47')]['id']}},_0x559a80={};_0x559a80['model']=_[_0x4743('0x34')](db[_0x4743('0x2e')][_0x4743('0x2f')]);_0x559a80[_0x4743('0x35')]=_['keys'](_0x4426e7['query']);_0x559a80[_0x4743('0x36')]=_[_0x4743('0x37')](_0x559a80['model'],_0x559a80['query']);_0x18e5a0['attributes']=_[_0x4743('0x37')](_0x559a80[_0x4743('0x33')],qs[_0x4743('0x39')](_0x4426e7[_0x4743('0x35')][_0x4743('0x39')]));_0x18e5a0[_0x4743('0x38')]=_0x18e5a0[_0x4743('0x38')]['length']?_0x18e5a0[_0x4743('0x38')]:_0x559a80[_0x4743('0x33')];if(_0x4426e7['query'][_0x4743('0x42')]){_0x18e5a0['include']=[{'all':!![]}];}_0x18e5a0=_['merge']({},_0x18e5a0,_0x4426e7[_0x4743('0x41')]);return db[_0x4743('0x2e')]['find'](_0x18e5a0)['then'](handleEntityNotFound(_0x1e8272,null))[_0x4743('0x28')](respondWithResult(_0x1e8272,null))['catch'](handleError(_0x1e8272,null));};exports[_0x4743('0x48')]=function(_0x112413,_0x2ce586){return db['Dynamics365Field'][_0x4743('0x48')](_0x112413['body'],{})[_0x4743('0x28')](respondWithResult(_0x2ce586,0xc9))[_0x4743('0x49')](handleError(_0x2ce586,null));};exports[_0x4743('0x27')]=function(_0x4bd596,_0xd8c7ec){if(_0x4bd596[_0x4743('0x4a')]['id']){delete _0x4bd596[_0x4743('0x4a')]['id'];}return db[_0x4743('0x2e')][_0x4743('0x4b')]({'where':{'id':_0x4bd596[_0x4743('0x47')]['id']}})['then'](handleEntityNotFound(_0xd8c7ec,null))[_0x4743('0x28')](saveUpdates(_0x4bd596[_0x4743('0x4a')],null))[_0x4743('0x28')](respondWithResult(_0xd8c7ec,null))['catch'](handleError(_0xd8c7ec,null));};exports[_0x4743('0x4c')]=function(_0x33ca18,_0x7e72d4){return db['Dynamics365Field']['find']({'where':{'id':_0x33ca18['params']['id']}})['then'](handleEntityNotFound(_0x7e72d4,null))[_0x4743('0x28')](removeEntity(_0x7e72d4,null))['catch'](handleError(_0x7e72d4,null));}; \ No newline at end of file +var _0x7e88=['limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','keys','create','body','params','find','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x7e88,0x11c));var _0x87e8=function(_0x5c37e9,_0xa19b35){_0x5c37e9=_0x5c37e9-0x0;var _0x231b3e=_0x7e88[_0x5c37e9];return _0x231b3e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x87e8('0x0'));var zipdir=require(_0x87e8('0x1'));var jsonpatch=require(_0x87e8('0x2'));var rp=require('request-promise');var moment=require(_0x87e8('0x3'));var BPromise=require(_0x87e8('0x4'));var Mustache=require('mustache');var util=require(_0x87e8('0x5'));var path=require(_0x87e8('0x6'));var sox=require(_0x87e8('0x7'));var csv=require(_0x87e8('0x8'));var ejs=require(_0x87e8('0x9'));var fs=require('fs');var fs_extra=require(_0x87e8('0xa'));var _=require(_0x87e8('0xb'));var squel=require(_0x87e8('0xc'));var crypto=require(_0x87e8('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x87e8('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x87e8('0xf'));var Redis=require(_0x87e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x87e8('0x12'));var logger=require(_0x87e8('0x13'))(_0x87e8('0x14'));var utils=require(_0x87e8('0x15'));var config=require(_0x87e8('0x16'));var licenseUtil=require(_0x87e8('0x17'));var db=require(_0x87e8('0x18'))['db'];function respondWithStatusCode(_0x4a2a36,_0x1a8ec7){_0x1a8ec7=_0x1a8ec7||0xcc;return function(_0x5101e1){if(_0x5101e1){return _0x4a2a36[_0x87e8('0x19')](_0x1a8ec7);}return _0x4a2a36['status'](_0x1a8ec7)[_0x87e8('0x1a')]();};}function respondWithResult(_0x2b9280,_0x3cef89){_0x3cef89=_0x3cef89||0xc8;return function(_0x589900){if(_0x589900){return _0x2b9280[_0x87e8('0x1b')](_0x3cef89)[_0x87e8('0x1c')](_0x589900);}};}function respondWithFilteredResult(_0x1c6e0f,_0x362664){return function(_0x16df8e){if(_0x16df8e){var _0x3e77c8=typeof _0x362664['offset']==='undefined'&&typeof _0x362664['limit']===_0x87e8('0x1d');var _0x22bdc8=_0x16df8e[_0x87e8('0x1e')];var _0x16291f=_0x3e77c8?0x0:_0x362664[_0x87e8('0x1f')];var _0x277e35=_0x3e77c8?_0x16df8e[_0x87e8('0x1e')]:_0x362664[_0x87e8('0x1f')]+_0x362664[_0x87e8('0x20')];var _0x29e9fa;if(_0x277e35>=_0x22bdc8){_0x277e35=_0x22bdc8;_0x29e9fa=0xc8;}else{_0x29e9fa=0xce;}_0x1c6e0f[_0x87e8('0x1b')](_0x29e9fa);return _0x1c6e0f[_0x87e8('0x21')](_0x87e8('0x22'),_0x16291f+'-'+_0x277e35+'/'+_0x22bdc8)[_0x87e8('0x1c')](_0x16df8e);}return null;};}function patchUpdates(_0x3564ac){return function(_0x3074d1){try{jsonpatch[_0x87e8('0x23')](_0x3074d1,_0x3564ac,!![]);}catch(_0x15fb9e){return BPromise[_0x87e8('0x24')](_0x15fb9e);}return _0x3074d1[_0x87e8('0x25')]();};}function saveUpdates(_0x49c0b1,_0xd56ec){return function(_0x55ab52){if(_0x55ab52){return _0x55ab52[_0x87e8('0x26')](_0x49c0b1)[_0x87e8('0x27')](function(_0xc1cc0a){return _0xc1cc0a;});}return null;};}function removeEntity(_0x30a059,_0xa77e59){return function(_0xdf61eb){if(_0xdf61eb){return _0xdf61eb[_0x87e8('0x28')]()['then'](function(){_0x30a059['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b5353,_0x53980d){return function(_0xbbac7){if(!_0xbbac7){_0x4b5353[_0x87e8('0x19')](0x194);}return _0xbbac7;};}function handleError(_0x3bbaaf,_0x1384b0){_0x1384b0=_0x1384b0||0x1f4;return function(_0x160863){logger[_0x87e8('0x29')](_0x160863[_0x87e8('0x2a')]);if(_0x160863['name']){delete _0x160863[_0x87e8('0x2b')];}_0x3bbaaf[_0x87e8('0x1b')](_0x1384b0)[_0x87e8('0x2c')](_0x160863);};}exports[_0x87e8('0x2d')]=function(_0x4504b2,_0x2af218){var _0x2a0a55={},_0x190729={},_0x5d0752={'count':0x0,'rows':[]};var _0x4a42c6=_[_0x87e8('0x2e')](db[_0x87e8('0x2f')][_0x87e8('0x30')],function(_0x69a73a){return{'name':_0x69a73a[_0x87e8('0x31')],'type':_0x69a73a[_0x87e8('0x32')][_0x87e8('0x33')]};});_0x190729[_0x87e8('0x34')]=_[_0x87e8('0x2e')](_0x4a42c6,_0x87e8('0x2b'));_0x190729[_0x87e8('0x35')]=_['keys'](_0x4504b2[_0x87e8('0x35')]);_0x190729[_0x87e8('0x36')]=_[_0x87e8('0x37')](_0x190729[_0x87e8('0x34')],_0x190729[_0x87e8('0x35')]);_0x2a0a55['attributes']=_[_0x87e8('0x37')](_0x190729['model'],qs[_0x87e8('0x38')](_0x4504b2[_0x87e8('0x35')][_0x87e8('0x38')]));_0x2a0a55[_0x87e8('0x39')]=_0x2a0a55[_0x87e8('0x39')][_0x87e8('0x3a')]?_0x2a0a55[_0x87e8('0x39')]:_0x190729[_0x87e8('0x34')];if(!_0x4504b2[_0x87e8('0x35')][_0x87e8('0x3b')](_0x87e8('0x3c'))){_0x2a0a55[_0x87e8('0x20')]=qs['limit'](_0x4504b2['query'][_0x87e8('0x20')]);_0x2a0a55[_0x87e8('0x1f')]=qs['offset'](_0x4504b2[_0x87e8('0x35')][_0x87e8('0x1f')]);}_0x2a0a55[_0x87e8('0x3d')]=qs[_0x87e8('0x3e')](_0x4504b2[_0x87e8('0x35')][_0x87e8('0x3e')]);_0x2a0a55[_0x87e8('0x3f')]=qs[_0x87e8('0x36')](_[_0x87e8('0x40')](_0x4504b2[_0x87e8('0x35')],_0x190729[_0x87e8('0x36')]),_0x4a42c6);if(_0x4504b2['query'][_0x87e8('0x41')]){_0x2a0a55['where']=_['merge'](_0x2a0a55[_0x87e8('0x3f')],{'$or':_[_0x87e8('0x2e')](_0x4a42c6,function(_0x1b1b85){if(_0x1b1b85[_0x87e8('0x32')]!==_0x87e8('0x42')){var _0x355f50={};_0x355f50[_0x1b1b85['name']]={'$like':'%'+_0x4504b2[_0x87e8('0x35')][_0x87e8('0x41')]+'%'};return _0x355f50;}})});}_0x2a0a55=_[_0x87e8('0x43')]({},_0x2a0a55,_0x4504b2[_0x87e8('0x44')]);var _0x3dfe87={'where':_0x2a0a55[_0x87e8('0x3f')]};return db['Dynamics365Field']['count'](_0x3dfe87)[_0x87e8('0x27')](function(_0x4312fa){_0x5d0752['count']=_0x4312fa;if(_0x4504b2[_0x87e8('0x35')][_0x87e8('0x45')]){_0x2a0a55[_0x87e8('0x46')]=[{'all':!![]}];}return db[_0x87e8('0x2f')][_0x87e8('0x47')](_0x2a0a55);})[_0x87e8('0x27')](function(_0x37b362){_0x5d0752[_0x87e8('0x48')]=_0x37b362;return _0x5d0752;})['then'](respondWithFilteredResult(_0x2af218,_0x2a0a55))[_0x87e8('0x49')](handleError(_0x2af218,null));};exports['show']=function(_0x8941bb,_0x580223){var _0x15111e={'raw':!![],'where':{'id':_0x8941bb['params']['id']}},_0x510d3b={};_0x510d3b['model']=_[_0x87e8('0x4a')](db[_0x87e8('0x2f')]['rawAttributes']);_0x510d3b[_0x87e8('0x35')]=_[_0x87e8('0x4a')](_0x8941bb[_0x87e8('0x35')]);_0x510d3b[_0x87e8('0x36')]=_[_0x87e8('0x37')](_0x510d3b[_0x87e8('0x34')],_0x510d3b['query']);_0x15111e[_0x87e8('0x39')]=_[_0x87e8('0x37')](_0x510d3b['model'],qs[_0x87e8('0x38')](_0x8941bb[_0x87e8('0x35')][_0x87e8('0x38')]));_0x15111e[_0x87e8('0x39')]=_0x15111e[_0x87e8('0x39')]['length']?_0x15111e['attributes']:_0x510d3b[_0x87e8('0x34')];if(_0x8941bb['query']['includeAll']){_0x15111e[_0x87e8('0x46')]=[{'all':!![]}];}_0x15111e=_['merge']({},_0x15111e,_0x8941bb[_0x87e8('0x44')]);return db[_0x87e8('0x2f')]['find'](_0x15111e)['then'](handleEntityNotFound(_0x580223,null))[_0x87e8('0x27')](respondWithResult(_0x580223,null))[_0x87e8('0x49')](handleError(_0x580223,null));};exports[_0x87e8('0x4b')]=function(_0x239a39,_0x1a19bf){return db['Dynamics365Field'][_0x87e8('0x4b')](_0x239a39[_0x87e8('0x4c')],{})[_0x87e8('0x27')](respondWithResult(_0x1a19bf,0xc9))[_0x87e8('0x49')](handleError(_0x1a19bf,null));};exports[_0x87e8('0x26')]=function(_0x1ba12e,_0x3fb393){if(_0x1ba12e[_0x87e8('0x4c')]['id']){delete _0x1ba12e[_0x87e8('0x4c')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0x1ba12e[_0x87e8('0x4d')]['id']}})[_0x87e8('0x27')](handleEntityNotFound(_0x3fb393,null))[_0x87e8('0x27')](saveUpdates(_0x1ba12e[_0x87e8('0x4c')],null))[_0x87e8('0x27')](respondWithResult(_0x3fb393,null))[_0x87e8('0x49')](handleError(_0x3fb393,null));};exports[_0x87e8('0x28')]=function(_0x468794,_0x57f73c){return db[_0x87e8('0x2f')][_0x87e8('0x4e')]({'where':{'id':_0x468794['params']['id']}})[_0x87e8('0x27')](handleEntityNotFound(_0x57f73c,null))['then'](removeEntity(_0x57f73c,null))[_0x87e8('0x49')](handleError(_0x57f73c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 54d8f84..09f38b5 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 _0xa8e0=['define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes','exports'];(function(_0x1646f7,_0x254a85){var _0x4aaffd=function(_0x330796){while(--_0x330796){_0x1646f7['push'](_0x1646f7['shift']());}};_0x4aaffd(++_0x254a85);}(_0xa8e0,0x110));var _0x0a8e=function(_0x414fd2,_0x465216){_0x414fd2=_0x414fd2-0x0;var _0x1bb94f=_0xa8e0[_0x414fd2];return _0x1bb94f;};'use strict';var _=require('lodash');var util=require(_0x0a8e('0x0'));var logger=require(_0x0a8e('0x1'))('api');var moment=require(_0x0a8e('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a8e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a8e('0x4'));var config=require(_0x0a8e('0x5'));var attributes=require(_0x0a8e('0x6'));module[_0x0a8e('0x7')]=function(_0x2753bf,_0x12ac2b){return _0x2753bf[_0x0a8e('0x8')](_0x0a8e('0x9'),attributes,{'tableName':_0x0a8e('0xa'),'paranoid':![],'indexes':[{'name':_0x0a8e('0xb'),'fields':[_0x0a8e('0xc'),_0x0a8e('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc99b=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','idField','lodash'];(function(_0x23f865,_0x37b35c){var _0x40cdc0=function(_0x952c4){while(--_0x952c4){_0x23f865['push'](_0x23f865['shift']());}};_0x40cdc0(++_0x37b35c);}(_0xc99b,0xa7));var _0xbc99=function(_0xcb19e1,_0x465489){_0xcb19e1=_0xcb19e1-0x0;var _0x121872=_0xc99b[_0xcb19e1];return _0x121872;};'use strict';var _=require(_0xbc99('0x0'));var util=require(_0xbc99('0x1'));var logger=require(_0xbc99('0x2'))(_0xbc99('0x3'));var moment=require(_0xbc99('0x4'));var BPromise=require(_0xbc99('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc99('0x6'));var rimraf=require(_0xbc99('0x7'));var config=require(_0xbc99('0x8'));var attributes=require(_0xbc99('0x9'));module['exports']=function(_0x19440c,_0xf54e88){return _0x19440c[_0xbc99('0xa')](_0xbc99('0xb'),attributes,{'tableName':_0xbc99('0xc'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xbc99('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index e2f3033..b0f8b14 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 _0x3611=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x235fae,_0x235409){var _0x2d22cb=function(_0x525d7c){while(--_0x525d7c){_0x235fae['push'](_0x235fae['shift']());}};_0x2d22cb(++_0x235409);}(_0x3611,0xb5));var _0x1361=function(_0x263613,_0x51e7b4){_0x263613=_0x263613-0x0;var _0x24b8ca=_0x3611[_0x263613];return _0x24b8ca;};'use strict';var _=require(_0x1361('0x0'));var util=require(_0x1361('0x1'));var moment=require(_0x1361('0x2'));var BPromise=require(_0x1361('0x3'));var rs=require(_0x1361('0x4'));var fs=require('fs');var Redis=require(_0x1361('0x5'));var db=require(_0x1361('0x6'))['db'];var utils=require(_0x1361('0x7'));var logger=require(_0x1361('0x8'))(_0x1361('0x9'));var config=require('../../config/environment');var jayson=require(_0x1361('0xa'));var client=jayson['client'][_0x1361('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d5d0e,_0x14fa5d,_0xa8a9de){return new BPromise(function(_0xae74c1,_0x33dd2f){return client[_0x1361('0xc')](_0x1d5d0e,_0xa8a9de)[_0x1361('0xd')](function(_0x30bc12){logger[_0x1361('0xe')](_0x1361('0xf'),_0x14fa5d,'request\x20sent');logger['debug'](_0x1361('0x10'),_0x14fa5d,'request\x20sent',JSON[_0x1361('0x11')](_0x30bc12));if(_0x30bc12[_0x1361('0x12')]){if(_0x30bc12[_0x1361('0x12')]['code']===0x1f4){logger[_0x1361('0x12')](_0x1361('0xf'),_0x14fa5d,_0x30bc12['error'][_0x1361('0x13')]);return _0x33dd2f(_0x30bc12[_0x1361('0x12')][_0x1361('0x13')]);}logger[_0x1361('0x12')](_0x1361('0xf'),_0x14fa5d,_0x30bc12['error'][_0x1361('0x13')]);return _0xae74c1(_0x30bc12['error'][_0x1361('0x13')]);}else{logger[_0x1361('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x14fa5d,'request\x20sent');_0xae74c1(_0x30bc12[_0x1361('0x14')][_0x1361('0x13')]);}})[_0x1361('0x15')](function(_0x278f9d){logger['error'](_0x1361('0xf'),_0x14fa5d,_0x278f9d);_0x33dd2f(_0x278f9d);});});} \ No newline at end of file +var _0x773a=['code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c81ac,_0x55117f){var _0x47d959=function(_0x196256){while(--_0x196256){_0x4c81ac['push'](_0x4c81ac['shift']());}};_0x47d959(++_0x55117f);}(_0x773a,0x66));var _0xa773=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x773a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa773('0x0'));var util=require(_0xa773('0x1'));var moment=require(_0xa773('0x2'));var BPromise=require(_0xa773('0x3'));var rs=require(_0xa773('0x4'));var fs=require('fs');var Redis=require(_0xa773('0x5'));var db=require(_0xa773('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa773('0x7'))(_0xa773('0x8'));var config=require(_0xa773('0x9'));var jayson=require(_0xa773('0xa'));var client=jayson[_0xa773('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x175f0,_0x41f74d,_0x53cce8){return new BPromise(function(_0x48963b,_0x3a324c){return client['request'](_0x175f0,_0x53cce8)[_0xa773('0xc')](function(_0x1ad01a){logger['info'](_0xa773('0xd'),_0x41f74d,'request\x20sent');logger[_0xa773('0xe')](_0xa773('0xf'),_0x41f74d,'request\x20sent',JSON[_0xa773('0x10')](_0x1ad01a));if(_0x1ad01a['error']){if(_0x1ad01a[_0xa773('0x11')][_0xa773('0x12')]===0x1f4){logger[_0xa773('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x41f74d,_0x1ad01a[_0xa773('0x11')][_0xa773('0x13')]);return _0x3a324c(_0x1ad01a[_0xa773('0x11')][_0xa773('0x13')]);}logger[_0xa773('0x11')](_0xa773('0xd'),_0x41f74d,_0x1ad01a['error'][_0xa773('0x13')]);return _0x48963b(_0x1ad01a[_0xa773('0x11')][_0xa773('0x13')]);}else{logger[_0xa773('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x41f74d,_0xa773('0x15'));_0x48963b(_0x1ad01a[_0xa773('0x16')][_0xa773('0x13')]);}})[_0xa773('0x17')](function(_0x1490d2){logger['error'](_0xa773('0xd'),_0x41f74d,_0x1490d2);_0x3a324c(_0x1490d2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7ddb117..676289c 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 _0x56c5=['/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','index'];(function(_0x27197d,_0x116505){var _0xb88878=function(_0x53452a){while(--_0x53452a){_0x27197d['push'](_0x27197d['shift']());}};_0xb88878(++_0x116505);}(_0x56c5,0x107));var _0x556c=function(_0x11110e,_0x17c1c6){_0x11110e=_0x11110e-0x0;var _0xf68147=_0x56c5[_0x11110e];return _0xf68147;};'use strict';var multer=require(_0x556c('0x0'));var util=require(_0x556c('0x1'));var path=require(_0x556c('0x2'));var timeout=require(_0x556c('0x3'));var express=require(_0x556c('0x4'));var router=express['Router']();var fs_extra=require(_0x556c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x556c('0x6'));var config=require('../../config/environment');var controller=require(_0x556c('0x7'));router[_0x556c('0x8')]('/',auth['isAuthenticated'](),controller[_0x556c('0x9')]);router[_0x556c('0x8')](_0x556c('0xa'),auth[_0x556c('0xb')](),controller[_0x556c('0xc')]);router[_0x556c('0x8')](_0x556c('0xd'),auth[_0x556c('0xb')](),controller[_0x556c('0xe')]);router['get'](_0x556c('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x556c('0x10')]('/',auth[_0x556c('0xb')](),controller[_0x556c('0x11')]);router[_0x556c('0x10')]('/:id/configurations',auth[_0x556c('0xb')](),controller[_0x556c('0x12')]);router['put'](_0x556c('0xa'),auth['isAuthenticated'](),controller[_0x556c('0x13')]);router['delete'](_0x556c('0xa'),auth[_0x556c('0xb')](),controller['destroy']);module[_0x556c('0x14')]=router; \ No newline at end of file +var _0x0082=['../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','create','addConfiguration','update','delete','multer','path','connect-timeout','Router','fs-extra'];(function(_0x26cfa0,_0x26acd2){var _0x35ed90=function(_0x507249){while(--_0x507249){_0x26cfa0['push'](_0x26cfa0['shift']());}};_0x35ed90(++_0x26acd2);}(_0x0082,0x13b));var _0x2008=function(_0x52670e,_0x4de501){_0x52670e=_0x52670e-0x0;var _0xec1194=_0x0082[_0x52670e];return _0xec1194;};'use strict';var multer=require(_0x2008('0x0'));var util=require('util');var path=require(_0x2008('0x1'));var timeout=require(_0x2008('0x2'));var express=require('express');var router=express[_0x2008('0x3')]();var fs_extra=require(_0x2008('0x4'));var auth=require(_0x2008('0x5'));var interaction=require(_0x2008('0x6'));var config=require('../../config/environment');var controller=require(_0x2008('0x7'));router[_0x2008('0x8')]('/',auth['isAuthenticated'](),controller[_0x2008('0x9')]);router[_0x2008('0x8')](_0x2008('0xa'),auth[_0x2008('0xb')](),controller[_0x2008('0xc')]);router[_0x2008('0x8')](_0x2008('0xd'),auth[_0x2008('0xb')](),controller[_0x2008('0xe')]);router['get'](_0x2008('0xf'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x2008('0xb')](),controller[_0x2008('0x10')]);router['post'](_0x2008('0xd'),auth['isAuthenticated'](),controller[_0x2008('0x11')]);router['put']('/:id',auth[_0x2008('0xb')](),controller[_0x2008('0x12')]);router[_0x2008('0x13')]('/:id',auth[_0x2008('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 998f41b..b7a4139 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 _0x056b=['username','remoteUri','exports','STRING'];(function(_0x36f8cc,_0x4de343){var _0x4e2cd4=function(_0x50a38c){while(--_0x50a38c){_0x36f8cc['push'](_0x36f8cc['shift']());}};_0x4e2cd4(++_0x4de343);}(_0x056b,0xb6));var _0xb056=function(_0x4e82bb,_0x4c39d5){_0x4e82bb=_0x4e82bb-0x0;var _0x1b5ac5=_0x056b[_0x4e82bb];return _0x1b5ac5;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')]},'description':{'type':Sequelize[_0xb056('0x1')]},'username':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x2')},'apiKey':{'type':Sequelize[_0xb056('0x1')]},'remoteUri':{'type':Sequelize[_0xb056('0x1')],'unique':_0xb056('0x3')},'serverUrl':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2272=['sequelize','exports','STRING','remoteUri'];(function(_0x5b8b97,_0x6b4dfa){var _0x1fdf84=function(_0x2ced4c){while(--_0x2ced4c){_0x5b8b97['push'](_0x5b8b97['shift']());}};_0x1fdf84(++_0x6b4dfa);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x2227('0x0'));module[_0x2227('0x1')]={'name':{'type':Sequelize[_0x2227('0x2')]},'description':{'type':Sequelize[_0x2227('0x2')]},'username':{'type':Sequelize[_0x2227('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x2227('0x2')]},'remoteUri':{'type':Sequelize[_0x2227('0x2')],'unique':_0x2227('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 37795cd..636db1b 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 _0xbc8b=['base64','requester','subject','agent','group','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','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','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','FreshdeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString'];(function(_0x1c942b,_0x2ba250){var _0x266775=function(_0x2867a8){while(--_0x2867a8){_0x1c942b['push'](_0x1c942b['shift']());}};_0x266775(++_0x2ba250);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xbc8b[_0x3635ce];return _0x97ecd0;};'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'];var integrations=require(_0xbbc8('0x1a'));function respondWithStatusCode(_0x1c4b00,_0x55b386){_0x55b386=_0x55b386||0xcc;return function(_0x5b4b1b){if(_0x5b4b1b){return _0x1c4b00[_0xbbc8('0x1b')](_0x55b386);}return _0x1c4b00['status'](_0x55b386)[_0xbbc8('0x1c')]();};}function respondWithResult(_0x2add43,_0x1c76df){_0x1c76df=_0x1c76df||0xc8;return function(_0x1126c7){if(_0x1126c7){return _0x2add43[_0xbbc8('0x1d')](_0x1c76df)[_0xbbc8('0x1e')](_0x1126c7);}};}function respondWithFilteredResult(_0x292cc2,_0x1cd58e){return function(_0x38bf2f){if(_0x38bf2f){var _0x20e656=typeof _0x1cd58e[_0xbbc8('0x1f')]===_0xbbc8('0x20')&&typeof _0x1cd58e[_0xbbc8('0x21')]===_0xbbc8('0x20');var _0x5b070e=_0x38bf2f[_0xbbc8('0x22')];var _0x218cae=_0x20e656?0x0:_0x1cd58e[_0xbbc8('0x1f')];var _0x291abf=_0x20e656?_0x38bf2f['count']:_0x1cd58e[_0xbbc8('0x1f')]+_0x1cd58e['limit'];var _0xc5ea1e;if(_0x291abf>=_0x5b070e){_0x291abf=_0x5b070e;_0xc5ea1e=0xc8;}else{_0xc5ea1e=0xce;}_0x292cc2[_0xbbc8('0x1d')](_0xc5ea1e);return _0x292cc2['set'](_0xbbc8('0x23'),_0x218cae+'-'+_0x291abf+'/'+_0x5b070e)[_0xbbc8('0x1e')](_0x38bf2f);}return null;};}function patchUpdates(_0x14b069){return function(_0x283526){try{jsonpatch[_0xbbc8('0x24')](_0x283526,_0x14b069,!![]);}catch(_0x35391d){return BPromise[_0xbbc8('0x25')](_0x35391d);}return _0x283526['save']();};}function saveUpdates(_0x14af5b,_0x5a1e00){return function(_0x80fb90){if(_0x80fb90){return _0x80fb90[_0xbbc8('0x26')](_0x14af5b)[_0xbbc8('0x27')](function(_0x37acb1){return _0x37acb1;});}return null;};}function removeEntity(_0x354312,_0x521c11){return function(_0xd3200c){if(_0xd3200c){return _0xd3200c[_0xbbc8('0x28')]()['then'](function(){_0x354312['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee2dd,_0x31fc9b){return function(_0xe6be9d){if(!_0xe6be9d){_0x2ee2dd[_0xbbc8('0x1b')](0x194);}return _0xe6be9d;};}function handleError(_0x1a0129,_0x15fd05){_0x15fd05=_0x15fd05||0x1f4;return function(_0x407acd){logger[_0xbbc8('0x29')](_0x407acd['stack']);if(_0x407acd[_0xbbc8('0x2a')]){delete _0x407acd[_0xbbc8('0x2a')];}_0x1a0129[_0xbbc8('0x1d')](_0x15fd05)['send'](_0x407acd);};}exports[_0xbbc8('0x2b')]=function(_0x239e64,_0x4b0e0c){var _0x130758={},_0x56ce6b={},_0x57cc7e={'count':0x0,'rows':[]};var _0x2939f8=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x24ec93){return{'name':_0x24ec93[_0xbbc8('0x2f')],'type':_0x24ec93['type']['key']};});_0x56ce6b[_0xbbc8('0x30')]=_[_0xbbc8('0x2c')](_0x2939f8,_0xbbc8('0x2a'));_0x56ce6b['query']=_[_0xbbc8('0x31')](_0x239e64[_0xbbc8('0x32')]);_0x56ce6b[_0xbbc8('0x33')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],_0x56ce6b[_0xbbc8('0x32')]);_0x130758[_0xbbc8('0x35')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x239e64[_0xbbc8('0x32')]['fields']));_0x130758[_0xbbc8('0x35')]=_0x130758[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x130758[_0xbbc8('0x35')]:_0x56ce6b[_0xbbc8('0x30')];if(!_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x130758[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x239e64['query'][_0xbbc8('0x21')]);_0x130758[_0xbbc8('0x1f')]=qs[_0xbbc8('0x1f')](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x1f')]);}_0x130758[_0xbbc8('0x3a')]=qs['sort'](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3b')]);_0x130758[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_['pick'](_0x239e64[_0xbbc8('0x32')],_0x56ce6b[_0xbbc8('0x33')]),_0x2939f8);if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3d')]){_0x130758[_0xbbc8('0x3c')]=_['merge'](_0x130758[_0xbbc8('0x3c')],{'$or':_[_0xbbc8('0x2c')](_0x2939f8,function(_0x2a2d68){if(_0x2a2d68[_0xbbc8('0x3e')]!=='VIRTUAL'){var _0x545bc3={};_0x545bc3[_0x2a2d68[_0xbbc8('0x2a')]]={'$like':'%'+_0x239e64['query'][_0xbbc8('0x3d')]+'%'};return _0x545bc3;}})});}_0x130758=_[_0xbbc8('0x3f')]({},_0x130758,_0x239e64[_0xbbc8('0x40')]);var _0x5ed5d2={'where':_0x130758[_0xbbc8('0x3c')]};return db['FreshdeskAccount']['count'](_0x5ed5d2)[_0xbbc8('0x27')](function(_0x37e803){_0x57cc7e['count']=_0x37e803;if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x41')]){_0x130758['include']=[{'all':!![]}];}return db[_0xbbc8('0x2d')][_0xbbc8('0x42')](_0x130758);})[_0xbbc8('0x27')](function(_0x52c836){_0x57cc7e[_0xbbc8('0x43')]=_0x52c836;return _0x57cc7e;})[_0xbbc8('0x27')](respondWithFilteredResult(_0x4b0e0c,_0x130758))[_0xbbc8('0x44')](handleError(_0x4b0e0c,null));};exports['show']=function(_0x3e7e54,_0x1dfbce){var _0x3dd5f6={'raw':![],'where':{'id':_0x3e7e54[_0xbbc8('0x45')]['id']}},_0x3d6405={};_0x3d6405[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')]);_0x3d6405['query']=_[_0xbbc8('0x31')](_0x3e7e54[_0xbbc8('0x32')]);_0x3d6405[_0xbbc8('0x33')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],_0x3d6405[_0xbbc8('0x32')]);_0x3dd5f6[_0xbbc8('0x35')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],qs['fields'](_0x3e7e54[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x3dd5f6[_0xbbc8('0x35')]=_0x3dd5f6['attributes'][_0xbbc8('0x37')]?_0x3dd5f6[_0xbbc8('0x35')]:_0x3d6405[_0xbbc8('0x30')];if(_0x3e7e54['query'][_0xbbc8('0x41')]){_0x3dd5f6[_0xbbc8('0x46')]=[{'all':!![]}];}_0x3dd5f6=_[_0xbbc8('0x3f')]({},_0x3dd5f6,_0x3e7e54[_0xbbc8('0x40')]);return db[_0xbbc8('0x2d')]['find'](_0x3dd5f6)[_0xbbc8('0x27')](handleEntityNotFound(_0x1dfbce,null))['then'](respondWithResult(_0x1dfbce,null))[_0xbbc8('0x44')](handleError(_0x1dfbce,null));};exports[_0xbbc8('0x47')]=function(_0x528b53,_0x4f3133){return db[_0xbbc8('0x2d')]['create'](_0x528b53[_0xbbc8('0x48')],{})[_0xbbc8('0x27')](respondWithResult(_0x4f3133,0xc9))[_0xbbc8('0x44')](handleError(_0x4f3133,null));};exports[_0xbbc8('0x26')]=function(_0x387dbf,_0x3d3a3a){if(_0x387dbf[_0xbbc8('0x48')]['id']){delete _0x387dbf['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x387dbf['params']['id']}})['then'](handleEntityNotFound(_0x3d3a3a,null))[_0xbbc8('0x27')](saveUpdates(_0x387dbf['body'],null))[_0xbbc8('0x27')](respondWithResult(_0x3d3a3a,null))[_0xbbc8('0x44')](handleError(_0x3d3a3a,null));};exports[_0xbbc8('0x28')]=function(_0x45262e,_0x228502){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x45262e[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x228502,null))[_0xbbc8('0x27')](removeEntity(_0x228502,null))[_0xbbc8('0x44')](handleError(_0x228502,null));};exports['getConfigurations']=function(_0x44510b,_0x46fa8d,_0x241b89){var _0x11414f={};var _0x40ac43={};var _0x219e4d;var _0x8fa10a;return db[_0xbbc8('0x2d')]['findOne']({'where':{'id':_0x44510b[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x46fa8d,null))[_0xbbc8('0x27')](function(_0x2ebdf9){if(_0x2ebdf9){_0x219e4d=_0x2ebdf9;_0x40ac43[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x4a')]['rawAttributes']);_0x40ac43[_0xbbc8('0x32')]=_[_0xbbc8('0x31')](_0x44510b[_0xbbc8('0x32')]);_0x40ac43['filters']=_[_0xbbc8('0x34')](_0x40ac43['model'],_0x40ac43[_0xbbc8('0x32')]);_0x11414f['attributes']=_[_0xbbc8('0x34')](_0x40ac43[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x11414f[_0xbbc8('0x35')]=_0x11414f[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x11414f[_0xbbc8('0x35')]:_0x40ac43[_0xbbc8('0x30')];_0x11414f['order']=qs[_0xbbc8('0x3b')](_0x44510b['query']['sort']);_0x11414f[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_[_0xbbc8('0x4b')](_0x44510b[_0xbbc8('0x32')],_0x40ac43[_0xbbc8('0x33')]));if(_0x44510b[_0xbbc8('0x32')]['filter']){_0x11414f[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x11414f['where'],{'$or':_[_0xbbc8('0x2c')](_0x11414f['attributes'],function(_0x45066b){var _0x20485c={};_0x20485c[_0x45066b]={'$like':'%'+_0x44510b[_0xbbc8('0x32')]['filter']+'%'};return _0x20485c;})});}_0x11414f=_['merge']({},_0x11414f,_0x44510b[_0xbbc8('0x40')]);return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x1419ba){if(_0x1419ba){_0x8fa10a=_0x1419ba[_0xbbc8('0x37')];if(!_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x38')]('nolimit')){_0x11414f[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x21')]);_0x11414f['offset']=qs[_0xbbc8('0x1f')](_0x44510b['query']['offset']);}return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x107727){if(_0x107727){return _0x107727?{'count':_0x8fa10a,'rows':_0x107727}:null;}})[_0xbbc8('0x27')](respondWithResult(_0x46fa8d,null))[_0xbbc8('0x44')](handleError(_0x46fa8d,null));};exports['addConfiguration']=function(_0x113a4a,_0xd1b4af,_0x392184){if(_0x113a4a[_0xbbc8('0x48')]['id']){delete _0x113a4a['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x113a4a[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0xd1b4af,null))[_0xbbc8('0x27')](function(_0xabda07){if(_0xabda07){_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4e')]=_0xabda07['id'];_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4f')]=integrations[_0xbbc8('0x50')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);_0x113a4a['body']['Descriptions']=integrations[_0xbbc8('0x51')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);return db[_0xbbc8('0x4a')][_0xbbc8('0x47')](_0x113a4a[_0xbbc8('0x48')],{'include':[{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x4f')},{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x53')}]});}return null;})[_0xbbc8('0x27')](respondWithResult(_0xd1b4af,null))['catch'](handleError(_0xd1b4af,null));};exports[_0xbbc8('0x54')]=function(_0x2a7747,_0x295393,_0x393039){var _0x3a2c0e='';return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x2a7747['params']['id']},'attributes':['id',_0xbbc8('0x55'),_0xbbc8('0x56')]})['then'](handleEntityNotFound(_0x295393,null))[_0xbbc8('0x27')](function(_0x350007){if(_0x350007){_0x3a2c0e=_0x350007[_0xbbc8('0x55')];var _0x4184a0=_0x3a2c0e[_0xbbc8('0x57')](-0x1);if(_0x4184a0==='/'){_0x3a2c0e=_0x3a2c0e[_0xbbc8('0x58')](0x0,_0x3a2c0e[_0xbbc8('0x59')](_0x4184a0));}return rp({'method':_0xbbc8('0x5a'),'uri':util[_0xbbc8('0x5b')](_0xbbc8('0x5c'),_0x3a2c0e,_0xbbc8('0x5d')),'headers':{'Authorization':util[_0xbbc8('0x5b')](_0xbbc8('0x5e'),new Buffer(util[_0xbbc8('0x5b')](_0xbbc8('0x5f'),_0x350007['apiKey']))[_0xbbc8('0x60')](_0xbbc8('0x61')))},'json':!![]});}})[_0xbbc8('0x27')](function(_0x7e96db){if(_0x7e96db){var _0x42b954=[_0xbbc8('0x62'),_0xbbc8('0x63'),_0xbbc8('0x64'),'description',_0xbbc8('0x1d'),'priority','group','source','ticket_type',_0xbbc8('0x65'),'company'];_[_0xbbc8('0x66')](_0x7e96db,function(_0x35d6a6){return _0x42b954[_0xbbc8('0x67')](_0x35d6a6[_0xbbc8('0x2a')])||!_0x35d6a6['default']&&_0x35d6a6['type']!==_0xbbc8('0x68')&&_0x35d6a6[_0xbbc8('0x3e')]!==_0xbbc8('0x69');});return{'count':_0x7e96db[_0xbbc8('0x37')],'rows':_['map'](_0x7e96db,function(_0x596c70){return{'id':_0x596c70[_0xbbc8('0x2a')],'name':_0x596c70['label'],'custom':!_0x596c70[_0xbbc8('0x6a')],'options':_0x596c70[_0xbbc8('0x6b')]?_['map'](_0x596c70['choices'],function(_0x33ad43){return{'name':_[_0xbbc8('0x6c')](_0x33ad43),'value':_0x33ad43};}):[]};})};}})[_0xbbc8('0x27')](respondWithResult(_0x295393,null))[_0xbbc8('0x44')](function(_0x284d81){var _0x1014cc=_0x2a7747['query']['test']?0x1f4:_0x284d81[_0xbbc8('0x6d')]||0x1f4;logger[_0xbbc8('0x29')](_0xbbc8('0x6e'),'getFields',_0x1014cc,JSON[_0xbbc8('0x6f')](_0x284d81));delete _0x284d81[_0xbbc8('0x2a')];if(_0x1014cc===0x191){_0x1014cc=0x190;}_0x295393['status'](_0x1014cc)[_0xbbc8('0x70')](_0x2a7747[_0xbbc8('0x32')][_0xbbc8('0x71')]?{'message':_0xbbc8('0x72'),'statusCode':_0x284d81['statusCode']}:_0x284d81);});}; \ No newline at end of file +var _0x6075=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','map','FreshdeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','apiKey','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','requester','subject','agent','group','source','ticket_type','company','includes','default','custom_text','custom_dropdown','label','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','ejs','lodash'];(function(_0x35e709,_0x1b9931){var _0x26e815=function(_0x278adf){while(--_0x278adf){_0x35e709['push'](_0x35e709['shift']());}};_0x26e815(++_0x1b9931);}(_0x6075,0x142));var _0x5607=function(_0x2d24b0,_0x4a3cf0){_0x2d24b0=_0x2d24b0-0x0;var _0x1793c8=_0x6075[_0x2d24b0];return _0x1793c8;};'use strict';var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5607('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5607('0x5'));var csv=require('to-csv');var ejs=require(_0x5607('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5607('0x7'));var squel=require('squel');var crypto=require(_0x5607('0x8'));var jsforce=require(_0x5607('0x9'));var deskjs=require(_0x5607('0xa'));var toCsv=require(_0x5607('0xb'));var querystring=require(_0x5607('0xc'));var Papa=require(_0x5607('0xd'));var Redis=require(_0x5607('0xe'));var authService=require(_0x5607('0xf'));var qs=require(_0x5607('0x10'));var as=require(_0x5607('0x11'));var hardwareService=require(_0x5607('0x12'));var logger=require(_0x5607('0x13'))(_0x5607('0x14'));var utils=require('../../config/utils');var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require(_0x5607('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x8d61f1,_0x4166c7){_0x4166c7=_0x4166c7||0xcc;return function(_0x5b4f19){if(_0x5b4f19){return _0x8d61f1[_0x5607('0x18')](_0x4166c7);}return _0x8d61f1[_0x5607('0x19')](_0x4166c7)['end']();};}function respondWithResult(_0x44642d,_0x514d22){_0x514d22=_0x514d22||0xc8;return function(_0x28cf69){if(_0x28cf69){return _0x44642d[_0x5607('0x19')](_0x514d22)[_0x5607('0x1a')](_0x28cf69);}};}function respondWithFilteredResult(_0x381634,_0x5ba100){return function(_0x17ede4){if(_0x17ede4){var _0x127f46=typeof _0x5ba100[_0x5607('0x1b')]===_0x5607('0x1c')&&typeof _0x5ba100[_0x5607('0x1d')]===_0x5607('0x1c');var _0x1ec815=_0x17ede4[_0x5607('0x1e')];var _0xf3ca5e=_0x127f46?0x0:_0x5ba100[_0x5607('0x1b')];var _0xb5d5d1=_0x127f46?_0x17ede4[_0x5607('0x1e')]:_0x5ba100['offset']+_0x5ba100['limit'];var _0x49f89c;if(_0xb5d5d1>=_0x1ec815){_0xb5d5d1=_0x1ec815;_0x49f89c=0xc8;}else{_0x49f89c=0xce;}_0x381634['status'](_0x49f89c);return _0x381634[_0x5607('0x1f')](_0x5607('0x20'),_0xf3ca5e+'-'+_0xb5d5d1+'/'+_0x1ec815)[_0x5607('0x1a')](_0x17ede4);}return null;};}function patchUpdates(_0x28cd0e){return function(_0x16cf94){try{jsonpatch[_0x5607('0x21')](_0x16cf94,_0x28cd0e,!![]);}catch(_0x2811ee){return BPromise[_0x5607('0x22')](_0x2811ee);}return _0x16cf94['save']();};}function saveUpdates(_0x5bb8c7,_0x3e0cbb){return function(_0x407194){if(_0x407194){return _0x407194[_0x5607('0x23')](_0x5bb8c7)['then'](function(_0x2bfa58){return _0x2bfa58;});}return null;};}function removeEntity(_0x82265b,_0x158211){return function(_0x20157b){if(_0x20157b){return _0x20157b[_0x5607('0x24')]()[_0x5607('0x25')](function(){_0x82265b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x294ed1,_0x2234c4){return function(_0x3cb951){if(!_0x3cb951){_0x294ed1['sendStatus'](0x194);}return _0x3cb951;};}function handleError(_0x4a0f55,_0x1b4e3f){_0x1b4e3f=_0x1b4e3f||0x1f4;return function(_0x55e623){logger[_0x5607('0x26')](_0x55e623[_0x5607('0x27')]);if(_0x55e623[_0x5607('0x28')]){delete _0x55e623[_0x5607('0x28')];}_0x4a0f55[_0x5607('0x19')](_0x1b4e3f)['send'](_0x55e623);};}exports['index']=function(_0x3cbaa1,_0x261b36){var _0x207b11={},_0x464ffa={},_0x361ad3={'count':0x0,'rows':[]};var _0x219229=_[_0x5607('0x29')](db[_0x5607('0x2a')]['rawAttributes'],function(_0x29d16e){return{'name':_0x29d16e[_0x5607('0x2b')],'type':_0x29d16e[_0x5607('0x2c')][_0x5607('0x2d')]};});_0x464ffa[_0x5607('0x2e')]=_[_0x5607('0x29')](_0x219229,_0x5607('0x28'));_0x464ffa[_0x5607('0x2f')]=_[_0x5607('0x30')](_0x3cbaa1[_0x5607('0x2f')]);_0x464ffa['filters']=_[_0x5607('0x31')](_0x464ffa['model'],_0x464ffa[_0x5607('0x2f')]);_0x207b11[_0x5607('0x32')]=_[_0x5607('0x31')](_0x464ffa[_0x5607('0x2e')],qs[_0x5607('0x33')](_0x3cbaa1['query'][_0x5607('0x33')]));_0x207b11[_0x5607('0x32')]=_0x207b11[_0x5607('0x32')][_0x5607('0x34')]?_0x207b11[_0x5607('0x32')]:_0x464ffa[_0x5607('0x2e')];if(!_0x3cbaa1[_0x5607('0x2f')][_0x5607('0x35')](_0x5607('0x36'))){_0x207b11['limit']=qs[_0x5607('0x1d')](_0x3cbaa1[_0x5607('0x2f')][_0x5607('0x1d')]);_0x207b11[_0x5607('0x1b')]=qs['offset'](_0x3cbaa1['query'][_0x5607('0x1b')]);}_0x207b11[_0x5607('0x37')]=qs[_0x5607('0x38')](_0x3cbaa1[_0x5607('0x2f')]['sort']);_0x207b11[_0x5607('0x39')]=qs[_0x5607('0x3a')](_[_0x5607('0x3b')](_0x3cbaa1['query'],_0x464ffa[_0x5607('0x3a')]),_0x219229);if(_0x3cbaa1['query'][_0x5607('0x3c')]){_0x207b11[_0x5607('0x39')]=_[_0x5607('0x3d')](_0x207b11[_0x5607('0x39')],{'$or':_[_0x5607('0x29')](_0x219229,function(_0x42c7c3){if(_0x42c7c3[_0x5607('0x2c')]!==_0x5607('0x3e')){var _0x2a2176={};_0x2a2176[_0x42c7c3[_0x5607('0x28')]]={'$like':'%'+_0x3cbaa1[_0x5607('0x2f')][_0x5607('0x3c')]+'%'};return _0x2a2176;}})});}_0x207b11=_[_0x5607('0x3d')]({},_0x207b11,_0x3cbaa1['options']);var _0x2de7ef={'where':_0x207b11['where']};return db[_0x5607('0x2a')][_0x5607('0x1e')](_0x2de7ef)[_0x5607('0x25')](function(_0x270f6c){_0x361ad3[_0x5607('0x1e')]=_0x270f6c;if(_0x3cbaa1[_0x5607('0x2f')][_0x5607('0x3f')]){_0x207b11[_0x5607('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x5607('0x41')](_0x207b11);})['then'](function(_0x5751a9){_0x361ad3['rows']=_0x5751a9;return _0x361ad3;})[_0x5607('0x25')](respondWithFilteredResult(_0x261b36,_0x207b11))[_0x5607('0x42')](handleError(_0x261b36,null));};exports['show']=function(_0x3cfc39,_0xf45c0){var _0x198d1a={'raw':![],'where':{'id':_0x3cfc39[_0x5607('0x43')]['id']}},_0x31c267={};_0x31c267[_0x5607('0x2e')]=_[_0x5607('0x30')](db[_0x5607('0x2a')]['rawAttributes']);_0x31c267[_0x5607('0x2f')]=_['keys'](_0x3cfc39[_0x5607('0x2f')]);_0x31c267[_0x5607('0x3a')]=_[_0x5607('0x31')](_0x31c267[_0x5607('0x2e')],_0x31c267[_0x5607('0x2f')]);_0x198d1a[_0x5607('0x32')]=_[_0x5607('0x31')](_0x31c267[_0x5607('0x2e')],qs[_0x5607('0x33')](_0x3cfc39[_0x5607('0x2f')][_0x5607('0x33')]));_0x198d1a['attributes']=_0x198d1a[_0x5607('0x32')][_0x5607('0x34')]?_0x198d1a[_0x5607('0x32')]:_0x31c267[_0x5607('0x2e')];if(_0x3cfc39['query'][_0x5607('0x3f')]){_0x198d1a[_0x5607('0x40')]=[{'all':!![]}];}_0x198d1a=_['merge']({},_0x198d1a,_0x3cfc39[_0x5607('0x44')]);return db[_0x5607('0x2a')][_0x5607('0x45')](_0x198d1a)['then'](handleEntityNotFound(_0xf45c0,null))[_0x5607('0x25')](respondWithResult(_0xf45c0,null))[_0x5607('0x42')](handleError(_0xf45c0,null));};exports[_0x5607('0x46')]=function(_0x186e0d,_0x3cdbe9){return db['FreshdeskAccount'][_0x5607('0x46')](_0x186e0d['body'],{})[_0x5607('0x25')](respondWithResult(_0x3cdbe9,0xc9))[_0x5607('0x42')](handleError(_0x3cdbe9,null));};exports[_0x5607('0x23')]=function(_0x4a36dd,_0x1f097b){if(_0x4a36dd[_0x5607('0x47')]['id']){delete _0x4a36dd[_0x5607('0x47')]['id'];}return db[_0x5607('0x2a')][_0x5607('0x45')]({'where':{'id':_0x4a36dd[_0x5607('0x43')]['id']}})[_0x5607('0x25')](handleEntityNotFound(_0x1f097b,null))[_0x5607('0x25')](saveUpdates(_0x4a36dd[_0x5607('0x47')],null))[_0x5607('0x25')](respondWithResult(_0x1f097b,null))[_0x5607('0x42')](handleError(_0x1f097b,null));};exports[_0x5607('0x24')]=function(_0x14a3aa,_0x48f25e){return db[_0x5607('0x2a')]['find']({'where':{'id':_0x14a3aa[_0x5607('0x43')]['id']}})['then'](handleEntityNotFound(_0x48f25e,null))[_0x5607('0x25')](removeEntity(_0x48f25e,null))[_0x5607('0x42')](handleError(_0x48f25e,null));};exports[_0x5607('0x48')]=function(_0x26eda1,_0x1681d8,_0x1b7780){var _0x2757cd={};var _0x11eca5={};var _0x3bd213;var _0x46924c;return db[_0x5607('0x2a')][_0x5607('0x49')]({'where':{'id':_0x26eda1[_0x5607('0x43')]['id']}})[_0x5607('0x25')](handleEntityNotFound(_0x1681d8,null))[_0x5607('0x25')](function(_0x3da5eb){if(_0x3da5eb){_0x3bd213=_0x3da5eb;_0x11eca5['model']=_['keys'](db[_0x5607('0x4a')]['rawAttributes']);_0x11eca5[_0x5607('0x2f')]=_[_0x5607('0x30')](_0x26eda1['query']);_0x11eca5[_0x5607('0x3a')]=_['intersection'](_0x11eca5[_0x5607('0x2e')],_0x11eca5[_0x5607('0x2f')]);_0x2757cd[_0x5607('0x32')]=_['intersection'](_0x11eca5[_0x5607('0x2e')],qs[_0x5607('0x33')](_0x26eda1['query'][_0x5607('0x33')]));_0x2757cd['attributes']=_0x2757cd['attributes']['length']?_0x2757cd[_0x5607('0x32')]:_0x11eca5[_0x5607('0x2e')];_0x2757cd[_0x5607('0x37')]=qs[_0x5607('0x38')](_0x26eda1[_0x5607('0x2f')]['sort']);_0x2757cd[_0x5607('0x39')]=qs[_0x5607('0x3a')](_[_0x5607('0x3b')](_0x26eda1[_0x5607('0x2f')],_0x11eca5[_0x5607('0x3a')]));if(_0x26eda1[_0x5607('0x2f')]['filter']){_0x2757cd[_0x5607('0x39')]=_[_0x5607('0x3d')](_0x2757cd[_0x5607('0x39')],{'$or':_['map'](_0x2757cd[_0x5607('0x32')],function(_0x2e5e41){var _0xae9cec={};_0xae9cec[_0x2e5e41]={'$like':'%'+_0x26eda1['query']['filter']+'%'};return _0xae9cec;})});}_0x2757cd=_[_0x5607('0x3d')]({},_0x2757cd,_0x26eda1[_0x5607('0x44')]);return _0x3bd213[_0x5607('0x48')](_0x2757cd);}})[_0x5607('0x25')](function(_0x4ffc32){if(_0x4ffc32){_0x46924c=_0x4ffc32['length'];if(!_0x26eda1[_0x5607('0x2f')]['hasOwnProperty'](_0x5607('0x36'))){_0x2757cd['limit']=qs[_0x5607('0x1d')](_0x26eda1['query'][_0x5607('0x1d')]);_0x2757cd[_0x5607('0x1b')]=qs[_0x5607('0x1b')](_0x26eda1['query'][_0x5607('0x1b')]);}return _0x3bd213[_0x5607('0x48')](_0x2757cd);}})[_0x5607('0x25')](function(_0x13fc19){if(_0x13fc19){return _0x13fc19?{'count':_0x46924c,'rows':_0x13fc19}:null;}})[_0x5607('0x25')](respondWithResult(_0x1681d8,null))['catch'](handleError(_0x1681d8,null));};exports[_0x5607('0x4b')]=function(_0x4682ed,_0x2070e1,_0x296493){if(_0x4682ed['body']['id']){delete _0x4682ed[_0x5607('0x47')]['id'];}return db[_0x5607('0x2a')][_0x5607('0x49')]({'where':{'id':_0x4682ed[_0x5607('0x43')]['id']}})[_0x5607('0x25')](handleEntityNotFound(_0x2070e1,null))[_0x5607('0x25')](function(_0x154176){if(_0x154176){_0x4682ed[_0x5607('0x47')]['AccountId']=_0x154176['id'];_0x4682ed[_0x5607('0x47')][_0x5607('0x4c')]=integrations[_0x5607('0x4d')](_0x4682ed[_0x5607('0x47')][_0x5607('0x4e')],_0x4682ed[_0x5607('0x47')][_0x5607('0x2c')]);_0x4682ed[_0x5607('0x47')][_0x5607('0x4f')]=integrations[_0x5607('0x50')](_0x4682ed[_0x5607('0x47')][_0x5607('0x4e')],_0x4682ed['body'][_0x5607('0x2c')]);return db['FreshdeskConfiguration'][_0x5607('0x46')](_0x4682ed[_0x5607('0x47')],{'include':[{'model':db[_0x5607('0x51')],'as':_0x5607('0x4c')},{'model':db['FreshdeskField'],'as':_0x5607('0x4f')}]});}return null;})['then'](respondWithResult(_0x2070e1,null))[_0x5607('0x42')](handleError(_0x2070e1,null));};exports['getFields']=function(_0x17fa4f,_0x3aa308,_0xf6a11e){var _0x4faede='';return db[_0x5607('0x2a')]['findOne']({'where':{'id':_0x17fa4f[_0x5607('0x43')]['id']},'attributes':['id','remoteUri',_0x5607('0x52')]})[_0x5607('0x25')](handleEntityNotFound(_0x3aa308,null))[_0x5607('0x25')](function(_0x54ba8e){if(_0x54ba8e){_0x4faede=_0x54ba8e['remoteUri'];var _0x4770b4=_0x4faede['slice'](-0x1);if(_0x4770b4==='/'){_0x4faede=_0x4faede[_0x5607('0x53')](0x0,_0x4faede['lastIndexOf'](_0x4770b4));}return rp({'method':_0x5607('0x54'),'uri':util[_0x5607('0x55')](_0x5607('0x56'),_0x4faede,_0x5607('0x57')),'headers':{'Authorization':util[_0x5607('0x55')](_0x5607('0x58'),new Buffer(util[_0x5607('0x55')]('%s:X',_0x54ba8e[_0x5607('0x52')]))[_0x5607('0x59')]('base64'))},'json':!![]});}})[_0x5607('0x25')](function(_0x1f006b){if(_0x1f006b){var _0x4c4219=[_0x5607('0x5a'),_0x5607('0x5b'),_0x5607('0x5c'),'description',_0x5607('0x19'),'priority',_0x5607('0x5d'),_0x5607('0x5e'),_0x5607('0x5f'),'group',_0x5607('0x60')];_['remove'](_0x1f006b,function(_0x15fbe1){return _0x4c4219[_0x5607('0x61')](_0x15fbe1[_0x5607('0x28')])||!_0x15fbe1[_0x5607('0x62')]&&_0x15fbe1[_0x5607('0x2c')]!==_0x5607('0x63')&&_0x15fbe1[_0x5607('0x2c')]!==_0x5607('0x64');});return{'count':_0x1f006b['length'],'rows':_[_0x5607('0x29')](_0x1f006b,function(_0x2e0e47){return{'id':_0x2e0e47[_0x5607('0x28')],'name':_0x2e0e47[_0x5607('0x65')],'custom':!_0x2e0e47[_0x5607('0x62')],'options':_0x2e0e47[_0x5607('0x66')]?_[_0x5607('0x29')](_0x2e0e47[_0x5607('0x66')],function(_0xfab136){return{'name':_['capitalize'](_0xfab136),'value':_0xfab136};}):[]};})};}})[_0x5607('0x25')](respondWithResult(_0x3aa308,null))['catch'](function(_0x4e82b0){var _0x20f26a=_0x17fa4f[_0x5607('0x2f')][_0x5607('0x67')]?0x1f4:_0x4e82b0[_0x5607('0x68')]||0x1f4;logger[_0x5607('0x26')](_0x5607('0x69'),_0x5607('0x6a'),_0x20f26a,JSON[_0x5607('0x6b')](_0x4e82b0));delete _0x4e82b0[_0x5607('0x28')];if(_0x20f26a===0x191){_0x20f26a=0x190;}_0x3aa308[_0x5607('0x19')](_0x20f26a)[_0x5607('0x6c')](_0x17fa4f['query'][_0x5607('0x67')]?{'message':_0x5607('0x6d'),'statusCode':_0x4e82b0[_0x5607('0x68')]}:_0x4e82b0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ba98b40..9278030 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 _0x2a7f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2a7f,0x10d));var _0xf2a7=function(_0x30ed18,_0x5324b5){_0x30ed18=_0x30ed18-0x0;var _0x18916b=_0x2a7f[_0x30ed18];return _0x18916b;};'use strict';var _=require(_0xf2a7('0x0'));var util=require(_0xf2a7('0x1'));var logger=require(_0xf2a7('0x2'))(_0xf2a7('0x3'));var moment=require(_0xf2a7('0x4'));var BPromise=require(_0xf2a7('0x5'));var rp=require(_0xf2a7('0x6'));var fs=require('fs');var path=require(_0xf2a7('0x7'));var rimraf=require(_0xf2a7('0x8'));var config=require(_0xf2a7('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xf2a7('0xa')]=function(_0xf45395,_0x2f0a6b){return _0xf45395[_0xf2a7('0xb')]('FreshdeskAccount',attributes,{'tableName':_0xf2a7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf060=['exports','define','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','./intFreshdeskAccount.attributes','../../components/integrations/configuration'];(function(_0x523ca2,_0x5ae301){var _0x20d863=function(_0x4884dd){while(--_0x4884dd){_0x523ca2['push'](_0x523ca2['shift']());}};_0x20d863(++_0x5ae301);}(_0xf060,0x93));var _0x0f06=function(_0x3a196b,_0x1a03c4){_0x3a196b=_0x3a196b-0x0;var _0x192dd8=_0xf060[_0x3a196b];return _0x192dd8;};'use strict';var _=require(_0x0f06('0x0'));var util=require(_0x0f06('0x1'));var logger=require('../../config/logger')(_0x0f06('0x2'));var moment=require(_0x0f06('0x3'));var BPromise=require(_0x0f06('0x4'));var rp=require(_0x0f06('0x5'));var fs=require('fs');var path=require(_0x0f06('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0f06('0x7'));var integrations=require(_0x0f06('0x8'));module[_0x0f06('0x9')]=function(_0x181d87,_0x59fa03){return _0x181d87[_0x0f06('0xa')]('FreshdeskAccount',attributes,{'tableName':_0x0f06('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2816ef6..a372aa0 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 _0x9745=['request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','include','map','attributes','ShowFreshdeskAccount','find','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x52f986,_0x10b1e5){var _0x21013c=function(_0x4602fd){while(--_0x4602fd){_0x52f986['push'](_0x52f986['shift']());}};_0x21013c(++_0x10b1e5);}(_0x9745,0x12d));var _0x5974=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x9745[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x5974('0x0'));var util=require(_0x5974('0x1'));var moment=require(_0x5974('0x2'));var BPromise=require(_0x5974('0x3'));var rs=require(_0x5974('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5974('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5974('0x6'))(_0x5974('0x7'));var config=require(_0x5974('0x8'));var jayson=require(_0x5974('0x9'));var client=jayson['client'][_0x5974('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56f732,_0x25f5d5,_0x4a2688){return new BPromise(function(_0x51e58b,_0x58cf5c){return client[_0x5974('0xb')](_0x56f732,_0x4a2688)[_0x5974('0xc')](function(_0x1bfa2a){logger[_0x5974('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x25f5d5,_0x5974('0xe'));logger[_0x5974('0xf')](_0x5974('0x10'),_0x25f5d5,_0x5974('0xe'),JSON[_0x5974('0x11')](_0x1bfa2a));if(_0x1bfa2a[_0x5974('0x12')]){if(_0x1bfa2a[_0x5974('0x12')]['code']===0x1f4){logger[_0x5974('0x12')](_0x5974('0x13'),_0x25f5d5,_0x1bfa2a[_0x5974('0x12')][_0x5974('0x14')]);return _0x58cf5c(_0x1bfa2a[_0x5974('0x12')]['message']);}logger[_0x5974('0x12')](_0x5974('0x13'),_0x25f5d5,_0x1bfa2a[_0x5974('0x12')]['message']);return _0x51e58b(_0x1bfa2a[_0x5974('0x12')][_0x5974('0x14')]);}else{logger['info'](_0x5974('0x13'),_0x25f5d5,'request\x20sent');_0x51e58b(_0x1bfa2a[_0x5974('0x15')][_0x5974('0x14')]);}})[_0x5974('0x16')](function(_0x74733a){logger[_0x5974('0x12')](_0x5974('0x13'),_0x25f5d5,_0x74733a);_0x58cf5c(_0x74733a);});});}exports[_0x5974('0x17')]=function(_0x7491da){var _0x36e714=this;return new Promise(function(_0x57a437,_0x462576){return db[_0x5974('0x18')][_0x5974('0x19')]({'raw':_0x7491da[_0x5974('0x1a')]?_0x7491da[_0x5974('0x1a')][_0x5974('0x1b')]===undefined?!![]:![]:!![],'where':_0x7491da[_0x5974('0x1a')]?_0x7491da['options'][_0x5974('0x1c')]||null:null,'attributes':_0x7491da['options']?_0x7491da['options']['attributes']||null:null,'limit':_0x7491da[_0x5974('0x1a')]?_0x7491da['options']['limit']||null:null,'include':_0x7491da['options']?_0x7491da['options'][_0x5974('0x1d')]?_['map'](_0x7491da[_0x5974('0x1a')]['include'],function(_0x305696){return{'model':db[_0x305696['model']],'as':_0x305696['as'],'attributes':_0x305696['attributes'],'include':_0x305696[_0x5974('0x1d')]?_[_0x5974('0x1e')](_0x305696[_0x5974('0x1d')],function(_0x5970d7){return{'model':db[_0x5970d7['model']],'as':_0x5970d7['as'],'attributes':_0x5970d7['attributes'],'include':_0x5970d7['include']?_[_0x5974('0x1e')](_0x5970d7[_0x5974('0x1d')],function(_0x31a7ef){return{'model':db[_0x31a7ef['model']],'as':_0x31a7ef['as'],'attributes':_0x31a7ef[_0x5974('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5974('0xc')](function(_0x5775e8){logger[_0x5974('0xd')](_0x5974('0x17'),_0x7491da);logger['debug'](_0x5974('0x17'),_0x7491da,JSON[_0x5974('0x11')](_0x5775e8));_0x57a437(_0x5775e8);})['catch'](function(_0x1f5f68){logger[_0x5974('0x12')]('GetFreshdeskAccount',_0x1f5f68[_0x5974('0x14')],_0x7491da);_0x462576(_0x36e714[_0x5974('0x12')](0x1f4,_0x1f5f68[_0x5974('0x14')]));});});};exports[_0x5974('0x20')]=function(_0x4dec25){var _0x9aa29b=this;return new Promise(function(_0x2730a1,_0x395891){return db['FreshdeskAccount'][_0x5974('0x21')]({'raw':_0x4dec25['options']?_0x4dec25[_0x5974('0x1a')][_0x5974('0x1b')]===undefined?!![]:![]:!![],'where':_0x4dec25['options']?_0x4dec25[_0x5974('0x1a')][_0x5974('0x1c')]||null:null,'attributes':_0x4dec25[_0x5974('0x1a')]?_0x4dec25[_0x5974('0x1a')][_0x5974('0x1f')]||null:null,'include':_0x4dec25['options']?_0x4dec25[_0x5974('0x1a')][_0x5974('0x1d')]?_[_0x5974('0x1e')](_0x4dec25['options']['include'],function(_0x4bd61f){return{'model':db[_0x4bd61f[_0x5974('0x22')]],'as':_0x4bd61f['as'],'attributes':_0x4bd61f[_0x5974('0x1f')],'include':_0x4bd61f[_0x5974('0x1d')]?_[_0x5974('0x1e')](_0x4bd61f[_0x5974('0x1d')],function(_0x2bda54){return{'model':db[_0x2bda54['model']],'as':_0x2bda54['as'],'attributes':_0x2bda54[_0x5974('0x1f')],'include':_0x2bda54[_0x5974('0x1d')]?_['map'](_0x2bda54['include'],function(_0x368501){return{'model':db[_0x368501[_0x5974('0x22')]],'as':_0x368501['as'],'attributes':_0x368501[_0x5974('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ed09d){logger[_0x5974('0xd')]('ShowFreshdeskAccount',_0x4dec25);logger[_0x5974('0xf')](_0x5974('0x20'),_0x4dec25,JSON['stringify'](_0x3ed09d));_0x2730a1(_0x3ed09d);})['catch'](function(_0x38fec8){logger[_0x5974('0x12')]('ShowFreshdeskAccount',_0x38fec8['message'],_0x4dec25);_0x395891(_0x9aa29b[_0x5974('0x12')](0x1f4,_0x38fec8[_0x5974('0x14')]));});});}; \ No newline at end of file +var _0x91a6=['model','attributes','ShowFreshdeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','limit','map','include'];(function(_0x435610,_0x1ca288){var _0x22f0f2=function(_0x5488cd){while(--_0x5488cd){_0x435610['push'](_0x435610['shift']());}};_0x22f0f2(++_0x1ca288);}(_0x91a6,0x12d));var _0x691a=function(_0x4be661,_0x53e777){_0x4be661=_0x4be661-0x0;var _0x367970=_0x91a6[_0x4be661];return _0x367970;};'use strict';var _=require(_0x691a('0x0'));var util=require(_0x691a('0x1'));var moment=require(_0x691a('0x2'));var BPromise=require(_0x691a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x691a('0x4'));var db=require(_0x691a('0x5'))['db'];var utils=require(_0x691a('0x6'));var logger=require(_0x691a('0x7'))(_0x691a('0x8'));var config=require('../../config/environment');var jayson=require(_0x691a('0x9'));var client=jayson[_0x691a('0xa')][_0x691a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45e12c,_0x28bb61,_0x1aec86){return new BPromise(function(_0x395efc,_0x5c7bfd){return client[_0x691a('0xc')](_0x45e12c,_0x1aec86)[_0x691a('0xd')](function(_0x5d03fe){logger[_0x691a('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x28bb61,'request\x20sent');logger[_0x691a('0xf')](_0x691a('0x10'),_0x28bb61,_0x691a('0x11'),JSON[_0x691a('0x12')](_0x5d03fe));if(_0x5d03fe[_0x691a('0x13')]){if(_0x5d03fe[_0x691a('0x13')][_0x691a('0x14')]===0x1f4){logger['error'](_0x691a('0x15'),_0x28bb61,_0x5d03fe[_0x691a('0x13')]['message']);return _0x5c7bfd(_0x5d03fe['error'][_0x691a('0x16')]);}logger['error'](_0x691a('0x15'),_0x28bb61,_0x5d03fe[_0x691a('0x13')][_0x691a('0x16')]);return _0x395efc(_0x5d03fe[_0x691a('0x13')][_0x691a('0x16')]);}else{logger['info'](_0x691a('0x15'),_0x28bb61,_0x691a('0x11'));_0x395efc(_0x5d03fe['result']['message']);}})[_0x691a('0x17')](function(_0x19929f){logger[_0x691a('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x28bb61,_0x19929f);_0x5c7bfd(_0x19929f);});});}exports[_0x691a('0x18')]=function(_0x5dc06d){var _0x384494=this;return new Promise(function(_0x2de184,_0x3ebf3c){return db[_0x691a('0x19')][_0x691a('0x1a')]({'raw':_0x5dc06d[_0x691a('0x1b')]?_0x5dc06d[_0x691a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5dc06d['options']?_0x5dc06d[_0x691a('0x1b')][_0x691a('0x1c')]||null:null,'attributes':_0x5dc06d[_0x691a('0x1b')]?_0x5dc06d['options']['attributes']||null:null,'limit':_0x5dc06d[_0x691a('0x1b')]?_0x5dc06d[_0x691a('0x1b')][_0x691a('0x1d')]||null:null,'include':_0x5dc06d['options']?_0x5dc06d[_0x691a('0x1b')]['include']?_[_0x691a('0x1e')](_0x5dc06d[_0x691a('0x1b')][_0x691a('0x1f')],function(_0x38c44a){return{'model':db[_0x38c44a[_0x691a('0x20')]],'as':_0x38c44a['as'],'attributes':_0x38c44a[_0x691a('0x21')],'include':_0x38c44a[_0x691a('0x1f')]?_[_0x691a('0x1e')](_0x38c44a[_0x691a('0x1f')],function(_0x57cccf){return{'model':db[_0x57cccf['model']],'as':_0x57cccf['as'],'attributes':_0x57cccf[_0x691a('0x21')],'include':_0x57cccf['include']?_[_0x691a('0x1e')](_0x57cccf[_0x691a('0x1f')],function(_0x6527a4){return{'model':db[_0x6527a4[_0x691a('0x20')]],'as':_0x6527a4['as'],'attributes':_0x6527a4[_0x691a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x691a('0xd')](function(_0x37071e){logger[_0x691a('0xe')](_0x691a('0x18'),_0x5dc06d);logger['debug'](_0x691a('0x18'),_0x5dc06d,JSON[_0x691a('0x12')](_0x37071e));_0x2de184(_0x37071e);})[_0x691a('0x17')](function(_0x481fcd){logger[_0x691a('0x13')](_0x691a('0x18'),_0x481fcd[_0x691a('0x16')],_0x5dc06d);_0x3ebf3c(_0x384494[_0x691a('0x13')](0x1f4,_0x481fcd[_0x691a('0x16')]));});});};exports[_0x691a('0x22')]=function(_0x11be62){var _0x21a65a=this;return new Promise(function(_0x3665d8,_0x5cabfb){return db[_0x691a('0x19')][_0x691a('0x23')]({'raw':_0x11be62[_0x691a('0x1b')]?_0x11be62[_0x691a('0x1b')][_0x691a('0x24')]===undefined?!![]:![]:!![],'where':_0x11be62[_0x691a('0x1b')]?_0x11be62['options'][_0x691a('0x1c')]||null:null,'attributes':_0x11be62[_0x691a('0x1b')]?_0x11be62[_0x691a('0x1b')]['attributes']||null:null,'include':_0x11be62[_0x691a('0x1b')]?_0x11be62[_0x691a('0x1b')]['include']?_['map'](_0x11be62[_0x691a('0x1b')]['include'],function(_0x66e930){return{'model':db[_0x66e930[_0x691a('0x20')]],'as':_0x66e930['as'],'attributes':_0x66e930['attributes'],'include':_0x66e930[_0x691a('0x1f')]?_['map'](_0x66e930[_0x691a('0x1f')],function(_0x38484e){return{'model':db[_0x38484e[_0x691a('0x20')]],'as':_0x38484e['as'],'attributes':_0x38484e[_0x691a('0x21')],'include':_0x38484e[_0x691a('0x1f')]?_['map'](_0x38484e['include'],function(_0x63f3bb){return{'model':db[_0x63f3bb[_0x691a('0x20')]],'as':_0x63f3bb['as'],'attributes':_0x63f3bb[_0x691a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x691a('0xd')](function(_0x1a6c19){logger[_0x691a('0xe')]('ShowFreshdeskAccount',_0x11be62);logger['debug'](_0x691a('0x22'),_0x11be62,JSON[_0x691a('0x12')](_0x1a6c19));_0x3665d8(_0x1a6c19);})[_0x691a('0x17')](function(_0x2160a3){logger['error'](_0x691a('0x22'),_0x2160a3[_0x691a('0x16')],_0x11be62);_0x5cabfb(_0x21a65a[_0x691a('0x13')](0x1f4,_0x2160a3[_0x691a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 601af46..64e8421 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 _0x18c4=['/:id','getFields','getSubjects','getDescriptions','/:id/tags','post','create','put','delete','destroy','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index'];(function(_0x42f85c,_0x232f68){var _0x11b73d=function(_0x33b1fb){while(--_0x33b1fb){_0x42f85c['push'](_0x42f85c['shift']());}};_0x11b73d(++_0x232f68);}(_0x18c4,0x15e));var _0x418c=function(_0x1f9854,_0x26747b){_0x1f9854=_0x1f9854-0x0;var _0x405e5e=_0x18c4[_0x1f9854];return _0x405e5e;};'use strict';var multer=require('multer');var util=require(_0x418c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x418c('0x1'));var router=express['Router']();var fs_extra=require(_0x418c('0x2'));var auth=require(_0x418c('0x3'));var interaction=require(_0x418c('0x4'));var config=require(_0x418c('0x5'));var controller=require(_0x418c('0x6'));router[_0x418c('0x7')]('/',auth[_0x418c('0x8')](),controller[_0x418c('0x9')]);router[_0x418c('0x7')](_0x418c('0xa'),auth[_0x418c('0x8')](),controller['show']);router['get']('/:id/fields',auth[_0x418c('0x8')](),controller[_0x418c('0xb')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x418c('0xc')]);router[_0x418c('0x7')]('/:id/descriptions',auth[_0x418c('0x8')](),controller[_0x418c('0xd')]);router[_0x418c('0x7')](_0x418c('0xe'),auth['isAuthenticated'](),controller['getTags']);router[_0x418c('0xf')]('/',auth[_0x418c('0x8')](),controller[_0x418c('0x10')]);router[_0x418c('0xf')](_0x418c('0xe'),auth[_0x418c('0x8')](),controller['setTags']);router[_0x418c('0x11')](_0x418c('0xa'),auth[_0x418c('0x8')](),controller['update']);router[_0x418c('0x12')](_0x418c('0xa'),auth['isAuthenticated'](),controller[_0x418c('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6121=['getTags','create','setTags','put','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags'];(function(_0x262512,_0x13be96){var _0x9f02a5=function(_0x340bfb){while(--_0x340bfb){_0x262512['push'](_0x262512['shift']());}};_0x9f02a5(++_0x13be96);}(_0x6121,0x1e1));var _0x1612=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6121[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x1612('0x0'));var path=require(_0x1612('0x1'));var timeout=require(_0x1612('0x2'));var express=require('express');var router=express[_0x1612('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1612('0x4'));var interaction=require(_0x1612('0x5'));var config=require(_0x1612('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x1612('0x7')]('/',auth[_0x1612('0x8')](),controller[_0x1612('0x9')]);router['get'](_0x1612('0xa'),auth['isAuthenticated'](),controller[_0x1612('0xb')]);router[_0x1612('0x7')](_0x1612('0xc'),auth['isAuthenticated'](),controller[_0x1612('0xd')]);router[_0x1612('0x7')](_0x1612('0xe'),auth[_0x1612('0x8')](),controller[_0x1612('0xf')]);router[_0x1612('0x7')](_0x1612('0x10'),auth[_0x1612('0x8')](),controller[_0x1612('0x11')]);router['get'](_0x1612('0x12'),auth[_0x1612('0x8')](),controller[_0x1612('0x13')]);router['post']('/',auth[_0x1612('0x8')](),controller[_0x1612('0x14')]);router['post']('/:id/tags',auth[_0x1612('0x8')](),controller[_0x1612('0x15')]);router[_0x1612('0x16')](_0x1612('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x1612('0x17')](_0x1612('0xa'),auth[_0x1612('0x8')](),controller[_0x1612('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 4e49500..bee5c9b 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 _0x2eb0=['sequelize','exports','STRING'];(function(_0xc8f5a3,_0x4a02a5){var _0x55041a=function(_0x43fe7d){while(--_0x43fe7d){_0xc8f5a3['push'](_0xc8f5a3['shift']());}};_0x55041a(++_0x4a02a5);}(_0x2eb0,0x156));var _0x02eb=function(_0x43eb89,_0x46770c){_0x43eb89=_0x43eb89-0x0;var _0x245a86=_0x2eb0[_0x43eb89];return _0x245a86;};'use strict';var Sequelize=require(_0x02eb('0x0'));module[_0x02eb('0x1')]={'name':{'type':Sequelize[_0x02eb('0x2')]},'description':{'type':Sequelize[_0x02eb('0x2')]}}; \ No newline at end of file +var _0x77a3=['exports','STRING','sequelize'];(function(_0x587983,_0xb56ecc){var _0x3e9b81=function(_0x3b3f1d){while(--_0x3b3f1d){_0x587983['push'](_0x587983['shift']());}};_0x3e9b81(++_0xb56ecc);}(_0x77a3,0xef));var _0x377a=function(_0x53629a,_0x2eeda8){_0x53629a=_0x53629a-0x0;var _0x375684=_0x77a3[_0x53629a];return _0x375684;};'use strict';var Sequelize=require(_0x377a('0x0'));module[_0x377a('0x1')]={'name':{'type':Sequelize[_0x377a('0x2')]},'description':{'type':Sequelize[_0x377a('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1f52ee2..a8874c3 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 _0x32b3=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','includeAll','include','findAll','catch','show','params','length','options','find','create','body','getFields','findOne','FreshdeskField','merge','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x51ef03,_0x3cc2a7){var _0x501ade=function(_0x3bcd16){while(--_0x3bcd16){_0x51ef03['push'](_0x51ef03['shift']());}};_0x501ade(++_0x3cc2a7);}(_0x32b3,0x1de));var _0x332b=function(_0x2eab1d,_0x54edd4){_0x2eab1d=_0x2eab1d-0x0;var _0x37cfed=_0x32b3[_0x2eab1d];return _0x37cfed;};'use strict';var emlformat=require(_0x332b('0x0'));var rimraf=require(_0x332b('0x1'));var zipdir=require(_0x332b('0x2'));var jsonpatch=require(_0x332b('0x3'));var rp=require(_0x332b('0x4'));var moment=require(_0x332b('0x5'));var BPromise=require(_0x332b('0x6'));var Mustache=require(_0x332b('0x7'));var util=require(_0x332b('0x8'));var path=require(_0x332b('0x9'));var sox=require(_0x332b('0xa'));var csv=require('to-csv');var ejs=require(_0x332b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x332b('0xc'));var crypto=require(_0x332b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x332b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x332b('0xf'));var Papa=require('papaparse');var Redis=require(_0x332b('0x10'));var authService=require(_0x332b('0x11'));var qs=require(_0x332b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x332b('0x13'));var logger=require('../../config/logger')(_0x332b('0x14'));var utils=require(_0x332b('0x15'));var config=require(_0x332b('0x16'));var licenseUtil=require(_0x332b('0x17'));var db=require(_0x332b('0x18'))['db'];function respondWithStatusCode(_0x5e5a36,_0x1eb63e){_0x1eb63e=_0x1eb63e||0xcc;return function(_0x342b27){if(_0x342b27){return _0x5e5a36[_0x332b('0x19')](_0x1eb63e);}return _0x5e5a36[_0x332b('0x1a')](_0x1eb63e)[_0x332b('0x1b')]();};}function respondWithResult(_0x35599f,_0x114148){_0x114148=_0x114148||0xc8;return function(_0x5e0baa){if(_0x5e0baa){return _0x35599f[_0x332b('0x1a')](_0x114148)[_0x332b('0x1c')](_0x5e0baa);}};}function respondWithFilteredResult(_0x2dc20e,_0x130d9b){return function(_0x68d9e4){if(_0x68d9e4){var _0x48464e=typeof _0x130d9b[_0x332b('0x1d')]==='undefined'&&typeof _0x130d9b[_0x332b('0x1e')]==='undefined';var _0x4f1ea2=_0x68d9e4['count'];var _0x3a6271=_0x48464e?0x0:_0x130d9b[_0x332b('0x1d')];var _0x5e37f9=_0x48464e?_0x68d9e4[_0x332b('0x1f')]:_0x130d9b['offset']+_0x130d9b['limit'];var _0x44153f;if(_0x5e37f9>=_0x4f1ea2){_0x5e37f9=_0x4f1ea2;_0x44153f=0xc8;}else{_0x44153f=0xce;}_0x2dc20e[_0x332b('0x1a')](_0x44153f);return _0x2dc20e[_0x332b('0x20')](_0x332b('0x21'),_0x3a6271+'-'+_0x5e37f9+'/'+_0x4f1ea2)[_0x332b('0x1c')](_0x68d9e4);}return null;};}function patchUpdates(_0x5b06c4){return function(_0x554596){try{jsonpatch[_0x332b('0x22')](_0x554596,_0x5b06c4,!![]);}catch(_0x1b2c5a){return BPromise['reject'](_0x1b2c5a);}return _0x554596[_0x332b('0x23')]();};}function saveUpdates(_0x4ce385,_0x579f63){return function(_0x2a1985){if(_0x2a1985){return _0x2a1985[_0x332b('0x24')](_0x4ce385)[_0x332b('0x25')](function(_0x5c6d99){return _0x5c6d99;});}return null;};}function removeEntity(_0x57bd6b,_0x66aa7){return function(_0x223633){if(_0x223633){return _0x223633[_0x332b('0x26')]()[_0x332b('0x25')](function(){_0x57bd6b[_0x332b('0x1a')](0xcc)[_0x332b('0x1b')]();});}};}function handleEntityNotFound(_0x5de116,_0x57989d){return function(_0x3af1a0){if(!_0x3af1a0){_0x5de116[_0x332b('0x19')](0x194);}return _0x3af1a0;};}function handleError(_0xf005ba,_0x5a2331){_0x5a2331=_0x5a2331||0x1f4;return function(_0x4d2828){logger[_0x332b('0x27')](_0x4d2828[_0x332b('0x28')]);if(_0x4d2828[_0x332b('0x29')]){delete _0x4d2828[_0x332b('0x29')];}_0xf005ba[_0x332b('0x1a')](_0x5a2331)[_0x332b('0x2a')](_0x4d2828);};}exports[_0x332b('0x2b')]=function(_0x59bdfa,_0x48ed04){var _0x824967={},_0x445f61={},_0x49beb9={'count':0x0,'rows':[]};var _0x433b2e=_['map'](db[_0x332b('0x2c')][_0x332b('0x2d')],function(_0x3b72c0){return{'name':_0x3b72c0['fieldName'],'type':_0x3b72c0[_0x332b('0x2e')]['key']};});_0x445f61[_0x332b('0x2f')]=_['map'](_0x433b2e,'name');_0x445f61['query']=_[_0x332b('0x30')](_0x59bdfa[_0x332b('0x31')]);_0x445f61[_0x332b('0x32')]=_[_0x332b('0x33')](_0x445f61['model'],_0x445f61[_0x332b('0x31')]);_0x824967['attributes']=_[_0x332b('0x33')](_0x445f61[_0x332b('0x2f')],qs['fields'](_0x59bdfa[_0x332b('0x31')][_0x332b('0x34')]));_0x824967['attributes']=_0x824967[_0x332b('0x35')]['length']?_0x824967[_0x332b('0x35')]:_0x445f61[_0x332b('0x2f')];if(!_0x59bdfa[_0x332b('0x31')][_0x332b('0x36')](_0x332b('0x37'))){_0x824967[_0x332b('0x1e')]=qs[_0x332b('0x1e')](_0x59bdfa['query'][_0x332b('0x1e')]);_0x824967[_0x332b('0x1d')]=qs['offset'](_0x59bdfa[_0x332b('0x31')][_0x332b('0x1d')]);}_0x824967[_0x332b('0x38')]=qs[_0x332b('0x39')](_0x59bdfa['query'][_0x332b('0x39')]);_0x824967[_0x332b('0x3a')]=qs[_0x332b('0x32')](_[_0x332b('0x3b')](_0x59bdfa[_0x332b('0x31')],_0x445f61[_0x332b('0x32')]),_0x433b2e);if(_0x59bdfa[_0x332b('0x31')][_0x332b('0x3c')]){_0x824967[_0x332b('0x3a')]=_['merge'](_0x824967[_0x332b('0x3a')],{'$or':_[_0x332b('0x3d')](_0x433b2e,function(_0x28620d){if(_0x28620d[_0x332b('0x2e')]!=='VIRTUAL'){var _0x10b27a={};_0x10b27a[_0x28620d['name']]={'$like':'%'+_0x59bdfa['query'][_0x332b('0x3c')]+'%'};return _0x10b27a;}})});}_0x824967=_['merge']({},_0x824967,_0x59bdfa['options']);var _0x3454a8={'where':_0x824967['where']};return db[_0x332b('0x2c')][_0x332b('0x1f')](_0x3454a8)['then'](function(_0xe3c8d7){_0x49beb9[_0x332b('0x1f')]=_0xe3c8d7;if(_0x59bdfa[_0x332b('0x31')][_0x332b('0x3e')]){_0x824967[_0x332b('0x3f')]=[{'all':!![]}];}return db[_0x332b('0x2c')][_0x332b('0x40')](_0x824967);})['then'](function(_0xd16004){_0x49beb9['rows']=_0xd16004;return _0x49beb9;})[_0x332b('0x25')](respondWithFilteredResult(_0x48ed04,_0x824967))[_0x332b('0x41')](handleError(_0x48ed04,null));};exports[_0x332b('0x42')]=function(_0xb2c7db,_0x47215d){var _0x5a74ae={'raw':![],'where':{'id':_0xb2c7db[_0x332b('0x43')]['id']}},_0x25d228={};_0x25d228[_0x332b('0x2f')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x25d228[_0x332b('0x31')]=_[_0x332b('0x30')](_0xb2c7db['query']);_0x25d228['filters']=_['intersection'](_0x25d228[_0x332b('0x2f')],_0x25d228['query']);_0x5a74ae['attributes']=_[_0x332b('0x33')](_0x25d228['model'],qs[_0x332b('0x34')](_0xb2c7db[_0x332b('0x31')][_0x332b('0x34')]));_0x5a74ae[_0x332b('0x35')]=_0x5a74ae[_0x332b('0x35')][_0x332b('0x44')]?_0x5a74ae[_0x332b('0x35')]:_0x25d228[_0x332b('0x2f')];if(_0xb2c7db['query'][_0x332b('0x3e')]){_0x5a74ae[_0x332b('0x3f')]=[{'all':!![]}];}_0x5a74ae=_['merge']({},_0x5a74ae,_0xb2c7db[_0x332b('0x45')]);return db[_0x332b('0x2c')][_0x332b('0x46')](_0x5a74ae)['then'](handleEntityNotFound(_0x47215d,null))[_0x332b('0x25')](respondWithResult(_0x47215d,null))[_0x332b('0x41')](handleError(_0x47215d,null));};exports[_0x332b('0x47')]=function(_0x450fc1,_0xeeaa22){return db[_0x332b('0x2c')][_0x332b('0x47')](_0x450fc1['body'],{})[_0x332b('0x25')](respondWithResult(_0xeeaa22,0xc9))['catch'](handleError(_0xeeaa22,null));};exports[_0x332b('0x24')]=function(_0xd7669f,_0x27fd27){if(_0xd7669f[_0x332b('0x48')]['id']){delete _0xd7669f[_0x332b('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x332b('0x46')]({'where':{'id':_0xd7669f[_0x332b('0x43')]['id']}})['then'](handleEntityNotFound(_0x27fd27,null))[_0x332b('0x25')](saveUpdates(_0xd7669f['body'],null))[_0x332b('0x25')](respondWithResult(_0x27fd27,null))['catch'](handleError(_0x27fd27,null));};exports[_0x332b('0x26')]=function(_0x4423fe,_0x5d2382){return db['FreshdeskConfiguration'][_0x332b('0x46')]({'where':{'id':_0x4423fe['params']['id']}})['then'](handleEntityNotFound(_0x5d2382,null))[_0x332b('0x25')](removeEntity(_0x5d2382,null))[_0x332b('0x41')](handleError(_0x5d2382,null));};exports[_0x332b('0x49')]=function(_0x15b984,_0x49825c,_0x6910b0){var _0x47c54f={};var _0x244b5a={};var _0x4f3f60;var _0x13fc4d;return db['FreshdeskConfiguration'][_0x332b('0x4a')]({'where':{'id':_0x15b984[_0x332b('0x43')]['id']}})[_0x332b('0x25')](handleEntityNotFound(_0x49825c,null))[_0x332b('0x25')](function(_0x147e79){if(_0x147e79){_0x4f3f60=_0x147e79;_0x244b5a['model']=_['keys'](db[_0x332b('0x4b')][_0x332b('0x2d')]);_0x244b5a['query']=_[_0x332b('0x30')](_0x15b984[_0x332b('0x31')]);_0x244b5a[_0x332b('0x32')]=_[_0x332b('0x33')](_0x244b5a[_0x332b('0x2f')],_0x244b5a[_0x332b('0x31')]);_0x47c54f[_0x332b('0x35')]=_[_0x332b('0x33')](_0x244b5a[_0x332b('0x2f')],qs['fields'](_0x15b984[_0x332b('0x31')][_0x332b('0x34')]));_0x47c54f['attributes']=_0x47c54f['attributes'][_0x332b('0x44')]?_0x47c54f[_0x332b('0x35')]:_0x244b5a[_0x332b('0x2f')];_0x47c54f['order']=qs[_0x332b('0x39')](_0x15b984[_0x332b('0x31')]['sort']);_0x47c54f[_0x332b('0x3a')]=qs[_0x332b('0x32')](_['pick'](_0x15b984['query'],_0x244b5a['filters']));if(_0x15b984[_0x332b('0x31')][_0x332b('0x3c')]){_0x47c54f[_0x332b('0x3a')]=_['merge'](_0x47c54f[_0x332b('0x3a')],{'$or':_[_0x332b('0x3d')](_0x47c54f[_0x332b('0x35')],function(_0x44a801){var _0x23b8dd={};_0x23b8dd[_0x44a801]={'$like':'%'+_0x15b984[_0x332b('0x31')][_0x332b('0x3c')]+'%'};return _0x23b8dd;})});}_0x47c54f=_['merge']({},_0x47c54f,_0x15b984[_0x332b('0x45')]);return _0x4f3f60[_0x332b('0x49')](_0x47c54f);}})[_0x332b('0x25')](function(_0x3adace){if(_0x3adace){_0x13fc4d=_0x3adace['length'];if(!_0x15b984[_0x332b('0x31')][_0x332b('0x36')](_0x332b('0x37'))){_0x47c54f[_0x332b('0x1e')]=qs['limit'](_0x15b984[_0x332b('0x31')][_0x332b('0x1e')]);_0x47c54f[_0x332b('0x1d')]=qs[_0x332b('0x1d')](_0x15b984['query'][_0x332b('0x1d')]);}return _0x4f3f60[_0x332b('0x49')](_0x47c54f);}})[_0x332b('0x25')](function(_0x194ea4){if(_0x194ea4){return _0x194ea4?{'count':_0x13fc4d,'rows':_0x194ea4}:null;}})['then'](respondWithResult(_0x49825c,null))['catch'](handleError(_0x49825c,null));};exports['getSubjects']=function(_0x477c27,_0x1b97f2,_0x27bdba){var _0x2c7957={};var _0x364575={};var _0x22eeb0;var _0xc1c441;return db[_0x332b('0x2c')][_0x332b('0x4a')]({'where':{'id':_0x477c27[_0x332b('0x43')]['id']}})[_0x332b('0x25')](handleEntityNotFound(_0x1b97f2,null))[_0x332b('0x25')](function(_0x100f39){if(_0x100f39){_0x22eeb0=_0x100f39;_0x364575['model']=_[_0x332b('0x30')](db[_0x332b('0x4b')][_0x332b('0x2d')]);_0x364575[_0x332b('0x31')]=_[_0x332b('0x30')](_0x477c27[_0x332b('0x31')]);_0x364575[_0x332b('0x32')]=_[_0x332b('0x33')](_0x364575['model'],_0x364575[_0x332b('0x31')]);_0x2c7957[_0x332b('0x35')]=_[_0x332b('0x33')](_0x364575[_0x332b('0x2f')],qs[_0x332b('0x34')](_0x477c27[_0x332b('0x31')][_0x332b('0x34')]));_0x2c7957[_0x332b('0x35')]=_0x2c7957[_0x332b('0x35')][_0x332b('0x44')]?_0x2c7957[_0x332b('0x35')]:_0x364575[_0x332b('0x2f')];_0x2c7957[_0x332b('0x38')]=qs[_0x332b('0x39')](_0x477c27[_0x332b('0x31')][_0x332b('0x39')]);_0x2c7957[_0x332b('0x3a')]=qs[_0x332b('0x32')](_[_0x332b('0x3b')](_0x477c27['query'],_0x364575[_0x332b('0x32')]));if(_0x477c27['query']['filter']){_0x2c7957['where']=_[_0x332b('0x4c')](_0x2c7957['where'],{'$or':_[_0x332b('0x3d')](_0x2c7957[_0x332b('0x35')],function(_0x34d981){var _0x4121ca={};_0x4121ca[_0x34d981]={'$like':'%'+_0x477c27['query']['filter']+'%'};return _0x4121ca;})});}_0x2c7957=_[_0x332b('0x4c')]({},_0x2c7957,_0x477c27[_0x332b('0x45')]);return _0x22eeb0[_0x332b('0x4d')](_0x2c7957);}})[_0x332b('0x25')](function(_0x3af29b){if(_0x3af29b){_0xc1c441=_0x3af29b[_0x332b('0x44')];if(!_0x477c27[_0x332b('0x31')][_0x332b('0x36')]('nolimit')){_0x2c7957[_0x332b('0x1e')]=qs[_0x332b('0x1e')](_0x477c27[_0x332b('0x31')][_0x332b('0x1e')]);_0x2c7957['offset']=qs[_0x332b('0x1d')](_0x477c27[_0x332b('0x31')][_0x332b('0x1d')]);}return _0x22eeb0[_0x332b('0x4d')](_0x2c7957);}})[_0x332b('0x25')](function(_0x6186e5){if(_0x6186e5){return _0x6186e5?{'count':_0xc1c441,'rows':_0x6186e5}:null;}})[_0x332b('0x25')](respondWithResult(_0x1b97f2,null))[_0x332b('0x41')](handleError(_0x1b97f2,null));};exports[_0x332b('0x4e')]=function(_0x47eaa2,_0x2b3514,_0x427c36){var _0x4431f4={};var _0x40c552={};var _0x4e5755;var _0x22e530;return db[_0x332b('0x2c')][_0x332b('0x4a')]({'where':{'id':_0x47eaa2['params']['id']}})[_0x332b('0x25')](handleEntityNotFound(_0x2b3514,null))[_0x332b('0x25')](function(_0x2c6306){if(_0x2c6306){_0x4e5755=_0x2c6306;_0x40c552[_0x332b('0x2f')]=_['keys'](db[_0x332b('0x4b')]['rawAttributes']);_0x40c552['query']=_['keys'](_0x47eaa2['query']);_0x40c552[_0x332b('0x32')]=_[_0x332b('0x33')](_0x40c552[_0x332b('0x2f')],_0x40c552['query']);_0x4431f4[_0x332b('0x35')]=_[_0x332b('0x33')](_0x40c552[_0x332b('0x2f')],qs['fields'](_0x47eaa2[_0x332b('0x31')]['fields']));_0x4431f4[_0x332b('0x35')]=_0x4431f4[_0x332b('0x35')]['length']?_0x4431f4[_0x332b('0x35')]:_0x40c552[_0x332b('0x2f')];_0x4431f4[_0x332b('0x38')]=qs[_0x332b('0x39')](_0x47eaa2['query'][_0x332b('0x39')]);_0x4431f4['where']=qs[_0x332b('0x32')](_[_0x332b('0x3b')](_0x47eaa2['query'],_0x40c552[_0x332b('0x32')]));if(_0x47eaa2['query'][_0x332b('0x3c')]){_0x4431f4['where']=_[_0x332b('0x4c')](_0x4431f4['where'],{'$or':_[_0x332b('0x3d')](_0x4431f4['attributes'],function(_0x4a4f22){var _0x1b70f3={};_0x1b70f3[_0x4a4f22]={'$like':'%'+_0x47eaa2[_0x332b('0x31')][_0x332b('0x3c')]+'%'};return _0x1b70f3;})});}_0x4431f4=_[_0x332b('0x4c')]({},_0x4431f4,_0x47eaa2['options']);return _0x4e5755['getDescriptions'](_0x4431f4);}})[_0x332b('0x25')](function(_0x31a2a2){if(_0x31a2a2){_0x22e530=_0x31a2a2['length'];if(!_0x47eaa2['query']['hasOwnProperty'](_0x332b('0x37'))){_0x4431f4[_0x332b('0x1e')]=qs['limit'](_0x47eaa2[_0x332b('0x31')]['limit']);_0x4431f4['offset']=qs[_0x332b('0x1d')](_0x47eaa2[_0x332b('0x31')][_0x332b('0x1d')]);}return _0x4e5755[_0x332b('0x4e')](_0x4431f4);}})[_0x332b('0x25')](function(_0x4bb6bb){if(_0x4bb6bb){return _0x4bb6bb?{'count':_0x22e530,'rows':_0x4bb6bb}:null;}})[_0x332b('0x25')](respondWithResult(_0x2b3514,null))[_0x332b('0x41')](handleError(_0x2b3514,null));};exports[_0x332b('0x4f')]=function(_0x480b8e,_0x23012a,_0x454c13){var _0x4b3a5e={};var _0x15f4d6={};var _0x525c96;var _0x4ddf9b;return db[_0x332b('0x2c')][_0x332b('0x4a')]({'where':{'id':_0x480b8e['params']['id']}})[_0x332b('0x25')](handleEntityNotFound(_0x23012a,null))['then'](function(_0x4f1da3){if(_0x4f1da3){_0x525c96=_0x4f1da3;_0x15f4d6[_0x332b('0x2f')]=_['keys'](db[_0x332b('0x50')][_0x332b('0x2d')]);_0x15f4d6['query']=_[_0x332b('0x30')](_0x480b8e[_0x332b('0x31')]);_0x15f4d6['filters']=_[_0x332b('0x33')](_0x15f4d6[_0x332b('0x2f')],_0x15f4d6['query']);_0x4b3a5e[_0x332b('0x35')]=_['intersection'](_0x15f4d6[_0x332b('0x2f')],qs[_0x332b('0x34')](_0x480b8e[_0x332b('0x31')][_0x332b('0x34')]));_0x4b3a5e[_0x332b('0x35')]=_0x4b3a5e[_0x332b('0x35')][_0x332b('0x44')]?_0x4b3a5e['attributes']:_0x15f4d6[_0x332b('0x2f')];_0x4b3a5e[_0x332b('0x38')]=qs['sort'](_0x480b8e[_0x332b('0x31')][_0x332b('0x39')]);_0x4b3a5e[_0x332b('0x3a')]=qs[_0x332b('0x32')](_[_0x332b('0x3b')](_0x480b8e[_0x332b('0x31')],_0x15f4d6['filters']));if(_0x480b8e[_0x332b('0x31')][_0x332b('0x3c')]){_0x4b3a5e[_0x332b('0x3a')]=_['merge'](_0x4b3a5e[_0x332b('0x3a')],{'$or':_[_0x332b('0x3d')](_0x4b3a5e[_0x332b('0x35')],function(_0x21daf3){var _0x38f1f8={};_0x38f1f8[_0x21daf3]={'$like':'%'+_0x480b8e['query'][_0x332b('0x3c')]+'%'};return _0x38f1f8;})});}_0x4b3a5e=_['merge']({},_0x4b3a5e,_0x480b8e[_0x332b('0x45')]);return _0x525c96[_0x332b('0x4f')](_0x4b3a5e);}})[_0x332b('0x25')](function(_0x512b03){if(_0x512b03){_0x4ddf9b=_0x512b03[_0x332b('0x44')];if(!_0x480b8e[_0x332b('0x31')][_0x332b('0x36')]('nolimit')){_0x4b3a5e[_0x332b('0x1e')]=qs[_0x332b('0x1e')](_0x480b8e[_0x332b('0x31')][_0x332b('0x1e')]);_0x4b3a5e[_0x332b('0x1d')]=qs[_0x332b('0x1d')](_0x480b8e[_0x332b('0x31')]['offset']);}return _0x525c96['getTags'](_0x4b3a5e);}})[_0x332b('0x25')](function(_0x404ccb){if(_0x404ccb){return _0x404ccb?{'count':_0x4ddf9b,'rows':_0x404ccb}:null;}})[_0x332b('0x25')](respondWithResult(_0x23012a,null))[_0x332b('0x41')](handleError(_0x23012a,null));};exports[_0x332b('0x51')]=function(_0x485979,_0x569950,_0xa6f7d9){if(_0x485979[_0x332b('0x48')]['id']){delete _0x485979['body']['id'];}return db[_0x332b('0x2c')][_0x332b('0x4a')]({'where':{'id':_0x485979[_0x332b('0x43')]['id']}})[_0x332b('0x25')](handleEntityNotFound(_0x569950,null))[_0x332b('0x25')](function(_0x5bc829){if(_0x5bc829){return _0x5bc829[_0x332b('0x51')](_0x485979[_0x332b('0x48')][_0x332b('0x52')]||[]);}return null;})[_0x332b('0x25')](respondWithResult(_0x569950,null))[_0x332b('0x41')](handleError(_0x569950,null));}; \ No newline at end of file +var _0xb9ee=['apply','reject','save','update','then','destroy','error','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb9ee,0x17a));var _0xeb9e=function(_0xe26c86,_0x541146){_0xe26c86=_0xe26c86-0x0;var _0x3d4dd7=_0xb9ee[_0xe26c86];return _0x3d4dd7;};'use strict';var emlformat=require(_0xeb9e('0x0'));var rimraf=require(_0xeb9e('0x1'));var zipdir=require(_0xeb9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb9e('0x3'));var BPromise=require(_0xeb9e('0x4'));var Mustache=require(_0xeb9e('0x5'));var util=require(_0xeb9e('0x6'));var path=require(_0xeb9e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeb9e('0x8'));var fs=require('fs');var fs_extra=require(_0xeb9e('0x9'));var _=require(_0xeb9e('0xa'));var squel=require('squel');var crypto=require(_0xeb9e('0xb'));var jsforce=require(_0xeb9e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeb9e('0xd'));var querystring=require(_0xeb9e('0xe'));var Papa=require(_0xeb9e('0xf'));var Redis=require('ioredis');var authService=require(_0xeb9e('0x10'));var qs=require(_0xeb9e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb9e('0x12'));var logger=require('../../config/logger')(_0xeb9e('0x13'));var utils=require(_0xeb9e('0x14'));var config=require(_0xeb9e('0x15'));var licenseUtil=require(_0xeb9e('0x16'));var db=require(_0xeb9e('0x17'))['db'];function respondWithStatusCode(_0xbd2ee8,_0x2bc8ed){_0x2bc8ed=_0x2bc8ed||0xcc;return function(_0x5b48ec){if(_0x5b48ec){return _0xbd2ee8[_0xeb9e('0x18')](_0x2bc8ed);}return _0xbd2ee8[_0xeb9e('0x19')](_0x2bc8ed)['end']();};}function respondWithResult(_0x35f00e,_0x19a4df){_0x19a4df=_0x19a4df||0xc8;return function(_0xf6bfd6){if(_0xf6bfd6){return _0x35f00e[_0xeb9e('0x19')](_0x19a4df)[_0xeb9e('0x1a')](_0xf6bfd6);}};}function respondWithFilteredResult(_0x2bbbb2,_0x56d007){return function(_0x2c4e1f){if(_0x2c4e1f){var _0x439d35=typeof _0x56d007[_0xeb9e('0x1b')]===_0xeb9e('0x1c')&&typeof _0x56d007[_0xeb9e('0x1d')]===_0xeb9e('0x1c');var _0x504349=_0x2c4e1f[_0xeb9e('0x1e')];var _0x1e0cb0=_0x439d35?0x0:_0x56d007[_0xeb9e('0x1b')];var _0xcafcfc=_0x439d35?_0x2c4e1f[_0xeb9e('0x1e')]:_0x56d007[_0xeb9e('0x1b')]+_0x56d007[_0xeb9e('0x1d')];var _0x3c0558;if(_0xcafcfc>=_0x504349){_0xcafcfc=_0x504349;_0x3c0558=0xc8;}else{_0x3c0558=0xce;}_0x2bbbb2[_0xeb9e('0x19')](_0x3c0558);return _0x2bbbb2['set'](_0xeb9e('0x1f'),_0x1e0cb0+'-'+_0xcafcfc+'/'+_0x504349)[_0xeb9e('0x1a')](_0x2c4e1f);}return null;};}function patchUpdates(_0x554e72){return function(_0x15553a){try{jsonpatch[_0xeb9e('0x20')](_0x15553a,_0x554e72,!![]);}catch(_0x857d6b){return BPromise[_0xeb9e('0x21')](_0x857d6b);}return _0x15553a[_0xeb9e('0x22')]();};}function saveUpdates(_0x2a9c15,_0x23964c){return function(_0x1cf6ac){if(_0x1cf6ac){return _0x1cf6ac[_0xeb9e('0x23')](_0x2a9c15)[_0xeb9e('0x24')](function(_0x469dde){return _0x469dde;});}return null;};}function removeEntity(_0x805656,_0x55d5c0){return function(_0x52751d){if(_0x52751d){return _0x52751d[_0xeb9e('0x25')]()[_0xeb9e('0x24')](function(){_0x805656[_0xeb9e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22063f,_0x550f7f){return function(_0x352ceb){if(!_0x352ceb){_0x22063f[_0xeb9e('0x18')](0x194);}return _0x352ceb;};}function handleError(_0x342c51,_0x252bb8){_0x252bb8=_0x252bb8||0x1f4;return function(_0x71fc43){logger[_0xeb9e('0x26')](_0x71fc43['stack']);if(_0x71fc43[_0xeb9e('0x27')]){delete _0x71fc43[_0xeb9e('0x27')];}_0x342c51['status'](_0x252bb8)[_0xeb9e('0x28')](_0x71fc43);};}exports['index']=function(_0x1e70ff,_0x2aac58){var _0x5d1a38={},_0x2d36fb={},_0x53ffd8={'count':0x0,'rows':[]};var _0x30935c=_[_0xeb9e('0x29')](db[_0xeb9e('0x2a')][_0xeb9e('0x2b')],function(_0x23b8f7){return{'name':_0x23b8f7[_0xeb9e('0x2c')],'type':_0x23b8f7[_0xeb9e('0x2d')]['key']};});_0x2d36fb[_0xeb9e('0x2e')]=_[_0xeb9e('0x29')](_0x30935c,_0xeb9e('0x27'));_0x2d36fb[_0xeb9e('0x2f')]=_['keys'](_0x1e70ff[_0xeb9e('0x2f')]);_0x2d36fb[_0xeb9e('0x30')]=_[_0xeb9e('0x31')](_0x2d36fb[_0xeb9e('0x2e')],_0x2d36fb[_0xeb9e('0x2f')]);_0x5d1a38[_0xeb9e('0x32')]=_['intersection'](_0x2d36fb[_0xeb9e('0x2e')],qs[_0xeb9e('0x33')](_0x1e70ff['query'][_0xeb9e('0x33')]));_0x5d1a38['attributes']=_0x5d1a38['attributes'][_0xeb9e('0x34')]?_0x5d1a38[_0xeb9e('0x32')]:_0x2d36fb['model'];if(!_0x1e70ff[_0xeb9e('0x2f')][_0xeb9e('0x35')](_0xeb9e('0x36'))){_0x5d1a38[_0xeb9e('0x1d')]=qs['limit'](_0x1e70ff[_0xeb9e('0x2f')]['limit']);_0x5d1a38[_0xeb9e('0x1b')]=qs[_0xeb9e('0x1b')](_0x1e70ff['query']['offset']);}_0x5d1a38[_0xeb9e('0x37')]=qs[_0xeb9e('0x38')](_0x1e70ff[_0xeb9e('0x2f')][_0xeb9e('0x38')]);_0x5d1a38['where']=qs[_0xeb9e('0x30')](_[_0xeb9e('0x39')](_0x1e70ff[_0xeb9e('0x2f')],_0x2d36fb[_0xeb9e('0x30')]),_0x30935c);if(_0x1e70ff['query'][_0xeb9e('0x3a')]){_0x5d1a38[_0xeb9e('0x3b')]=_[_0xeb9e('0x3c')](_0x5d1a38[_0xeb9e('0x3b')],{'$or':_[_0xeb9e('0x29')](_0x30935c,function(_0x53730f){if(_0x53730f[_0xeb9e('0x2d')]!==_0xeb9e('0x3d')){var _0x15697c={};_0x15697c[_0x53730f[_0xeb9e('0x27')]]={'$like':'%'+_0x1e70ff['query']['filter']+'%'};return _0x15697c;}})});}_0x5d1a38=_['merge']({},_0x5d1a38,_0x1e70ff[_0xeb9e('0x3e')]);var _0x28e2cc={'where':_0x5d1a38['where']};return db['FreshdeskConfiguration']['count'](_0x28e2cc)[_0xeb9e('0x24')](function(_0x28ce2e){_0x53ffd8[_0xeb9e('0x1e')]=_0x28ce2e;if(_0x1e70ff['query'][_0xeb9e('0x3f')]){_0x5d1a38[_0xeb9e('0x40')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xeb9e('0x41')](_0x5d1a38);})[_0xeb9e('0x24')](function(_0x1085be){_0x53ffd8[_0xeb9e('0x42')]=_0x1085be;return _0x53ffd8;})[_0xeb9e('0x24')](respondWithFilteredResult(_0x2aac58,_0x5d1a38))[_0xeb9e('0x43')](handleError(_0x2aac58,null));};exports[_0xeb9e('0x44')]=function(_0x334db9,_0x52d10f){var _0x2f2f71={'raw':![],'where':{'id':_0x334db9[_0xeb9e('0x45')]['id']}},_0x5b5fb3={};_0x5b5fb3['model']=_['keys'](db[_0xeb9e('0x2a')][_0xeb9e('0x2b')]);_0x5b5fb3[_0xeb9e('0x2f')]=_[_0xeb9e('0x46')](_0x334db9['query']);_0x5b5fb3[_0xeb9e('0x30')]=_[_0xeb9e('0x31')](_0x5b5fb3[_0xeb9e('0x2e')],_0x5b5fb3[_0xeb9e('0x2f')]);_0x2f2f71[_0xeb9e('0x32')]=_[_0xeb9e('0x31')](_0x5b5fb3['model'],qs['fields'](_0x334db9['query'][_0xeb9e('0x33')]));_0x2f2f71[_0xeb9e('0x32')]=_0x2f2f71[_0xeb9e('0x32')][_0xeb9e('0x34')]?_0x2f2f71[_0xeb9e('0x32')]:_0x5b5fb3['model'];if(_0x334db9[_0xeb9e('0x2f')][_0xeb9e('0x3f')]){_0x2f2f71[_0xeb9e('0x40')]=[{'all':!![]}];}_0x2f2f71=_[_0xeb9e('0x3c')]({},_0x2f2f71,_0x334db9[_0xeb9e('0x3e')]);return db[_0xeb9e('0x2a')]['find'](_0x2f2f71)[_0xeb9e('0x24')](handleEntityNotFound(_0x52d10f,null))[_0xeb9e('0x24')](respondWithResult(_0x52d10f,null))[_0xeb9e('0x43')](handleError(_0x52d10f,null));};exports['create']=function(_0x3f51b0,_0x15b482){return db['FreshdeskConfiguration'][_0xeb9e('0x47')](_0x3f51b0[_0xeb9e('0x48')],{})['then'](respondWithResult(_0x15b482,0xc9))[_0xeb9e('0x43')](handleError(_0x15b482,null));};exports[_0xeb9e('0x23')]=function(_0x401e46,_0x41b521){if(_0x401e46[_0xeb9e('0x48')]['id']){delete _0x401e46[_0xeb9e('0x48')]['id'];}return db[_0xeb9e('0x2a')][_0xeb9e('0x49')]({'where':{'id':_0x401e46['params']['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x41b521,null))['then'](saveUpdates(_0x401e46['body'],null))[_0xeb9e('0x24')](respondWithResult(_0x41b521,null))[_0xeb9e('0x43')](handleError(_0x41b521,null));};exports[_0xeb9e('0x25')]=function(_0xb5207e,_0x5505fc){return db[_0xeb9e('0x2a')]['find']({'where':{'id':_0xb5207e[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x5505fc,null))['then'](removeEntity(_0x5505fc,null))['catch'](handleError(_0x5505fc,null));};exports[_0xeb9e('0x4a')]=function(_0x4d4754,_0x17fbfd,_0x3f2555){var _0x2433cc={};var _0x4986af={};var _0x17f638;var _0x36b277;return db[_0xeb9e('0x2a')][_0xeb9e('0x4b')]({'where':{'id':_0x4d4754[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x17fbfd,null))[_0xeb9e('0x24')](function(_0x20fac9){if(_0x20fac9){_0x17f638=_0x20fac9;_0x4986af['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x4986af['query']=_[_0xeb9e('0x46')](_0x4d4754[_0xeb9e('0x2f')]);_0x4986af[_0xeb9e('0x30')]=_[_0xeb9e('0x31')](_0x4986af[_0xeb9e('0x2e')],_0x4986af[_0xeb9e('0x2f')]);_0x2433cc[_0xeb9e('0x32')]=_['intersection'](_0x4986af[_0xeb9e('0x2e')],qs[_0xeb9e('0x33')](_0x4d4754[_0xeb9e('0x2f')]['fields']));_0x2433cc[_0xeb9e('0x32')]=_0x2433cc[_0xeb9e('0x32')][_0xeb9e('0x34')]?_0x2433cc['attributes']:_0x4986af['model'];_0x2433cc[_0xeb9e('0x37')]=qs[_0xeb9e('0x38')](_0x4d4754['query'][_0xeb9e('0x38')]);_0x2433cc[_0xeb9e('0x3b')]=qs['filters'](_['pick'](_0x4d4754['query'],_0x4986af['filters']));if(_0x4d4754['query'][_0xeb9e('0x3a')]){_0x2433cc[_0xeb9e('0x3b')]=_['merge'](_0x2433cc[_0xeb9e('0x3b')],{'$or':_['map'](_0x2433cc['attributes'],function(_0x352a2a){var _0x2ac7bd={};_0x2ac7bd[_0x352a2a]={'$like':'%'+_0x4d4754[_0xeb9e('0x2f')][_0xeb9e('0x3a')]+'%'};return _0x2ac7bd;})});}_0x2433cc=_[_0xeb9e('0x3c')]({},_0x2433cc,_0x4d4754[_0xeb9e('0x3e')]);return _0x17f638[_0xeb9e('0x4a')](_0x2433cc);}})[_0xeb9e('0x24')](function(_0x35192b){if(_0x35192b){_0x36b277=_0x35192b['length'];if(!_0x4d4754[_0xeb9e('0x2f')][_0xeb9e('0x35')]('nolimit')){_0x2433cc[_0xeb9e('0x1d')]=qs[_0xeb9e('0x1d')](_0x4d4754[_0xeb9e('0x2f')][_0xeb9e('0x1d')]);_0x2433cc['offset']=qs[_0xeb9e('0x1b')](_0x4d4754[_0xeb9e('0x2f')]['offset']);}return _0x17f638[_0xeb9e('0x4a')](_0x2433cc);}})[_0xeb9e('0x24')](function(_0x2984fc){if(_0x2984fc){return _0x2984fc?{'count':_0x36b277,'rows':_0x2984fc}:null;}})[_0xeb9e('0x24')](respondWithResult(_0x17fbfd,null))['catch'](handleError(_0x17fbfd,null));};exports['getSubjects']=function(_0x2e4207,_0x1e4dc0,_0x5ec47d){var _0x38365b={};var _0x2cb3e8={};var _0xe5ed69;var _0x83f98a;return db[_0xeb9e('0x2a')][_0xeb9e('0x4b')]({'where':{'id':_0x2e4207[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x1e4dc0,null))['then'](function(_0x16145e){if(_0x16145e){_0xe5ed69=_0x16145e;_0x2cb3e8[_0xeb9e('0x2e')]=_[_0xeb9e('0x46')](db[_0xeb9e('0x4c')][_0xeb9e('0x2b')]);_0x2cb3e8[_0xeb9e('0x2f')]=_[_0xeb9e('0x46')](_0x2e4207[_0xeb9e('0x2f')]);_0x2cb3e8[_0xeb9e('0x30')]=_[_0xeb9e('0x31')](_0x2cb3e8[_0xeb9e('0x2e')],_0x2cb3e8[_0xeb9e('0x2f')]);_0x38365b[_0xeb9e('0x32')]=_[_0xeb9e('0x31')](_0x2cb3e8[_0xeb9e('0x2e')],qs['fields'](_0x2e4207[_0xeb9e('0x2f')][_0xeb9e('0x33')]));_0x38365b[_0xeb9e('0x32')]=_0x38365b['attributes'][_0xeb9e('0x34')]?_0x38365b[_0xeb9e('0x32')]:_0x2cb3e8[_0xeb9e('0x2e')];_0x38365b[_0xeb9e('0x37')]=qs[_0xeb9e('0x38')](_0x2e4207['query']['sort']);_0x38365b[_0xeb9e('0x3b')]=qs[_0xeb9e('0x30')](_[_0xeb9e('0x39')](_0x2e4207[_0xeb9e('0x2f')],_0x2cb3e8[_0xeb9e('0x30')]));if(_0x2e4207['query'][_0xeb9e('0x3a')]){_0x38365b[_0xeb9e('0x3b')]=_[_0xeb9e('0x3c')](_0x38365b[_0xeb9e('0x3b')],{'$or':_[_0xeb9e('0x29')](_0x38365b['attributes'],function(_0x5d3ae2){var _0x7b3be8={};_0x7b3be8[_0x5d3ae2]={'$like':'%'+_0x2e4207[_0xeb9e('0x2f')][_0xeb9e('0x3a')]+'%'};return _0x7b3be8;})});}_0x38365b=_[_0xeb9e('0x3c')]({},_0x38365b,_0x2e4207[_0xeb9e('0x3e')]);return _0xe5ed69[_0xeb9e('0x4d')](_0x38365b);}})[_0xeb9e('0x24')](function(_0x269ebe){if(_0x269ebe){_0x83f98a=_0x269ebe[_0xeb9e('0x34')];if(!_0x2e4207[_0xeb9e('0x2f')][_0xeb9e('0x35')](_0xeb9e('0x36'))){_0x38365b[_0xeb9e('0x1d')]=qs[_0xeb9e('0x1d')](_0x2e4207['query'][_0xeb9e('0x1d')]);_0x38365b[_0xeb9e('0x1b')]=qs[_0xeb9e('0x1b')](_0x2e4207[_0xeb9e('0x2f')]['offset']);}return _0xe5ed69[_0xeb9e('0x4d')](_0x38365b);}})[_0xeb9e('0x24')](function(_0x14248d){if(_0x14248d){return _0x14248d?{'count':_0x83f98a,'rows':_0x14248d}:null;}})[_0xeb9e('0x24')](respondWithResult(_0x1e4dc0,null))['catch'](handleError(_0x1e4dc0,null));};exports[_0xeb9e('0x4e')]=function(_0x1c4121,_0x3ace0d,_0x15f978){var _0x27d61b={};var _0x201ad9={};var _0x53be0f;var _0x15fe67;return db[_0xeb9e('0x2a')][_0xeb9e('0x4b')]({'where':{'id':_0x1c4121[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x3ace0d,null))['then'](function(_0x17f709){if(_0x17f709){_0x53be0f=_0x17f709;_0x201ad9['model']=_[_0xeb9e('0x46')](db['FreshdeskField'][_0xeb9e('0x2b')]);_0x201ad9[_0xeb9e('0x2f')]=_[_0xeb9e('0x46')](_0x1c4121['query']);_0x201ad9[_0xeb9e('0x30')]=_[_0xeb9e('0x31')](_0x201ad9[_0xeb9e('0x2e')],_0x201ad9['query']);_0x27d61b['attributes']=_[_0xeb9e('0x31')](_0x201ad9[_0xeb9e('0x2e')],qs['fields'](_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x33')]));_0x27d61b[_0xeb9e('0x32')]=_0x27d61b[_0xeb9e('0x32')][_0xeb9e('0x34')]?_0x27d61b[_0xeb9e('0x32')]:_0x201ad9[_0xeb9e('0x2e')];_0x27d61b[_0xeb9e('0x37')]=qs[_0xeb9e('0x38')](_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x38')]);_0x27d61b[_0xeb9e('0x3b')]=qs[_0xeb9e('0x30')](_['pick'](_0x1c4121[_0xeb9e('0x2f')],_0x201ad9[_0xeb9e('0x30')]));if(_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x3a')]){_0x27d61b[_0xeb9e('0x3b')]=_[_0xeb9e('0x3c')](_0x27d61b['where'],{'$or':_['map'](_0x27d61b[_0xeb9e('0x32')],function(_0x303f24){var _0x4b7331={};_0x4b7331[_0x303f24]={'$like':'%'+_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x3a')]+'%'};return _0x4b7331;})});}_0x27d61b=_[_0xeb9e('0x3c')]({},_0x27d61b,_0x1c4121[_0xeb9e('0x3e')]);return _0x53be0f['getDescriptions'](_0x27d61b);}})['then'](function(_0x154d86){if(_0x154d86){_0x15fe67=_0x154d86[_0xeb9e('0x34')];if(!_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x35')](_0xeb9e('0x36'))){_0x27d61b[_0xeb9e('0x1d')]=qs[_0xeb9e('0x1d')](_0x1c4121['query']['limit']);_0x27d61b[_0xeb9e('0x1b')]=qs[_0xeb9e('0x1b')](_0x1c4121[_0xeb9e('0x2f')][_0xeb9e('0x1b')]);}return _0x53be0f[_0xeb9e('0x4e')](_0x27d61b);}})[_0xeb9e('0x24')](function(_0x2037a6){if(_0x2037a6){return _0x2037a6?{'count':_0x15fe67,'rows':_0x2037a6}:null;}})[_0xeb9e('0x24')](respondWithResult(_0x3ace0d,null))['catch'](handleError(_0x3ace0d,null));};exports[_0xeb9e('0x4f')]=function(_0x54122f,_0x38a439,_0x3b6313){var _0x3900df={};var _0xd03f6={};var _0x2012e9;var _0x872129;return db[_0xeb9e('0x2a')][_0xeb9e('0x4b')]({'where':{'id':_0x54122f[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x38a439,null))[_0xeb9e('0x24')](function(_0x5c93a5){if(_0x5c93a5){_0x2012e9=_0x5c93a5;_0xd03f6[_0xeb9e('0x2e')]=_[_0xeb9e('0x46')](db[_0xeb9e('0x50')][_0xeb9e('0x2b')]);_0xd03f6['query']=_[_0xeb9e('0x46')](_0x54122f['query']);_0xd03f6['filters']=_[_0xeb9e('0x31')](_0xd03f6[_0xeb9e('0x2e')],_0xd03f6[_0xeb9e('0x2f')]);_0x3900df[_0xeb9e('0x32')]=_[_0xeb9e('0x31')](_0xd03f6[_0xeb9e('0x2e')],qs[_0xeb9e('0x33')](_0x54122f[_0xeb9e('0x2f')][_0xeb9e('0x33')]));_0x3900df[_0xeb9e('0x32')]=_0x3900df[_0xeb9e('0x32')][_0xeb9e('0x34')]?_0x3900df[_0xeb9e('0x32')]:_0xd03f6[_0xeb9e('0x2e')];_0x3900df['order']=qs[_0xeb9e('0x38')](_0x54122f[_0xeb9e('0x2f')][_0xeb9e('0x38')]);_0x3900df[_0xeb9e('0x3b')]=qs[_0xeb9e('0x30')](_[_0xeb9e('0x39')](_0x54122f[_0xeb9e('0x2f')],_0xd03f6[_0xeb9e('0x30')]));if(_0x54122f[_0xeb9e('0x2f')][_0xeb9e('0x3a')]){_0x3900df['where']=_[_0xeb9e('0x3c')](_0x3900df[_0xeb9e('0x3b')],{'$or':_[_0xeb9e('0x29')](_0x3900df[_0xeb9e('0x32')],function(_0xb5a281){var _0x5b5138={};_0x5b5138[_0xb5a281]={'$like':'%'+_0x54122f['query']['filter']+'%'};return _0x5b5138;})});}_0x3900df=_[_0xeb9e('0x3c')]({},_0x3900df,_0x54122f['options']);return _0x2012e9[_0xeb9e('0x4f')](_0x3900df);}})[_0xeb9e('0x24')](function(_0x1bd127){if(_0x1bd127){_0x872129=_0x1bd127['length'];if(!_0x54122f['query'][_0xeb9e('0x35')](_0xeb9e('0x36'))){_0x3900df['limit']=qs[_0xeb9e('0x1d')](_0x54122f['query']['limit']);_0x3900df[_0xeb9e('0x1b')]=qs[_0xeb9e('0x1b')](_0x54122f['query']['offset']);}return _0x2012e9[_0xeb9e('0x4f')](_0x3900df);}})[_0xeb9e('0x24')](function(_0x1117c6){if(_0x1117c6){return _0x1117c6?{'count':_0x872129,'rows':_0x1117c6}:null;}})[_0xeb9e('0x24')](respondWithResult(_0x38a439,null))['catch'](handleError(_0x38a439,null));};exports[_0xeb9e('0x51')]=function(_0x41dc82,_0x104792,_0x484544){if(_0x41dc82[_0xeb9e('0x48')]['id']){delete _0x41dc82['body']['id'];}return db['FreshdeskConfiguration'][_0xeb9e('0x4b')]({'where':{'id':_0x41dc82[_0xeb9e('0x45')]['id']}})[_0xeb9e('0x24')](handleEntityNotFound(_0x104792,null))[_0xeb9e('0x24')](function(_0x54daf8){if(_0x54daf8){return _0x54daf8[_0xeb9e('0x51')](_0x41dc82[_0xeb9e('0x48')]['ids']||[]);}return null;})[_0xeb9e('0x24')](respondWithResult(_0x104792,null))[_0xeb9e('0x43')](handleError(_0x104792,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f095e6d..ebc112b 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 _0x9751=['moment','bluebird','path','rimraf','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','util','api'];(function(_0x141b7c,_0x2017fd){var _0x38c545=function(_0x2ca43a){while(--_0x2ca43a){_0x141b7c['push'](_0x141b7c['shift']());}};_0x38c545(++_0x2017fd);}(_0x9751,0x1c1));var _0x1975=function(_0x3842cb,_0x426d6e){_0x3842cb=_0x3842cb-0x0;var _0xa94e3c=_0x9751[_0x3842cb];return _0xa94e3c;};'use strict';var _=require('lodash');var util=require(_0x1975('0x0'));var logger=require('../../config/logger')(_0x1975('0x1'));var moment=require(_0x1975('0x2'));var BPromise=require(_0x1975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1975('0x4'));var rimraf=require(_0x1975('0x5'));var config=require('../../config/environment');var attributes=require(_0x1975('0x6'));module[_0x1975('0x7')]=function(_0x23ebd6,_0x215dff){return _0x23ebd6[_0x1975('0x8')](_0x1975('0x9'),attributes,{'tableName':_0x1975('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89ea=['rimraf','../../config/environment','exports','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x89ea,0xfc));var _0xa89e=function(_0x166e33,_0x127e77){_0x166e33=_0x166e33-0x0;var _0x1a2409=_0x89ea[_0x166e33];return _0x1a2409;};'use strict';var _=require(_0xa89e('0x0'));var util=require(_0xa89e('0x1'));var logger=require(_0xa89e('0x2'))(_0xa89e('0x3'));var moment=require(_0xa89e('0x4'));var BPromise=require(_0xa89e('0x5'));var rp=require(_0xa89e('0x6'));var fs=require('fs');var path=require(_0xa89e('0x7'));var rimraf=require(_0xa89e('0x8'));var config=require(_0xa89e('0x9'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xa89e('0xa')]=function(_0xa59219,_0x1750e7){return _0xa59219['define'](_0xa89e('0xb'),attributes,{'tableName':_0xa89e('0xc'),'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 2c25ac5..0c7a766 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 _0x0298=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0298,0x9d));var _0x8029=function(_0xa7429c,_0x3f6c95){_0xa7429c=_0xa7429c-0x0;var _0x57aacc=_0x0298[_0xa7429c];return _0x57aacc;};'use strict';var _=require(_0x8029('0x0'));var util=require('util');var moment=require(_0x8029('0x1'));var BPromise=require(_0x8029('0x2'));var rs=require(_0x8029('0x3'));var fs=require('fs');var Redis=require(_0x8029('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8029('0x5'));var logger=require(_0x8029('0x6'))('rpc');var config=require(_0x8029('0x7'));var jayson=require(_0x8029('0x8'));var client=jayson[_0x8029('0x9')][_0x8029('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c9571,_0x45a9de,_0x4b8fd3){return new BPromise(function(_0xb3fc68,_0x35b702){return client[_0x8029('0xb')](_0x5c9571,_0x4b8fd3)[_0x8029('0xc')](function(_0x1508ac){logger[_0x8029('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x45a9de,_0x8029('0xe'));logger[_0x8029('0xf')](_0x8029('0x10'),_0x45a9de,'request\x20sent',JSON[_0x8029('0x11')](_0x1508ac));if(_0x1508ac[_0x8029('0x12')]){if(_0x1508ac[_0x8029('0x12')]['code']===0x1f4){logger[_0x8029('0x12')](_0x8029('0x13'),_0x45a9de,_0x1508ac['error'][_0x8029('0x14')]);return _0x35b702(_0x1508ac['error'][_0x8029('0x14')]);}logger[_0x8029('0x12')](_0x8029('0x13'),_0x45a9de,_0x1508ac['error'][_0x8029('0x14')]);return _0xb3fc68(_0x1508ac[_0x8029('0x12')][_0x8029('0x14')]);}else{logger[_0x8029('0xd')](_0x8029('0x13'),_0x45a9de,_0x8029('0xe'));_0xb3fc68(_0x1508ac[_0x8029('0x15')]['message']);}})[_0x8029('0x16')](function(_0x42f035){logger[_0x8029('0x12')](_0x8029('0x13'),_0x45a9de,_0x42f035);_0x35b702(_0x42f035);});});} \ No newline at end of file +var _0x05bf=['FreshdeskConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3775ba,_0x500c2c){var _0xb885c2=function(_0xc8e59b){while(--_0xc8e59b){_0x3775ba['push'](_0x3775ba['shift']());}};_0xb885c2(++_0x500c2c);}(_0x05bf,0x88));var _0xf05b=function(_0x543942,_0x4600e5){_0x543942=_0x543942-0x0;var _0x280e6d=_0x05bf[_0x543942];return _0x280e6d;};'use strict';var _=require('lodash');var util=require(_0xf05b('0x0'));var moment=require(_0xf05b('0x1'));var BPromise=require(_0xf05b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf05b('0x3'));var db=require(_0xf05b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf05b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf05b('0x6'));var client=jayson[_0xf05b('0x7')][_0xf05b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43be20,_0x18998d,_0x4e8e6c){return new BPromise(function(_0x5e591b,_0x281351){return client[_0xf05b('0x9')](_0x43be20,_0x4e8e6c)[_0xf05b('0xa')](function(_0x2322cc){logger[_0xf05b('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x18998d,_0xf05b('0xc'));logger[_0xf05b('0xd')](_0xf05b('0xe'),_0x18998d,'request\x20sent',JSON[_0xf05b('0xf')](_0x2322cc));if(_0x2322cc[_0xf05b('0x10')]){if(_0x2322cc[_0xf05b('0x10')][_0xf05b('0x11')]===0x1f4){logger[_0xf05b('0x10')](_0xf05b('0x12'),_0x18998d,_0x2322cc[_0xf05b('0x10')][_0xf05b('0x13')]);return _0x281351(_0x2322cc[_0xf05b('0x10')]['message']);}logger[_0xf05b('0x10')](_0xf05b('0x12'),_0x18998d,_0x2322cc[_0xf05b('0x10')]['message']);return _0x5e591b(_0x2322cc[_0xf05b('0x10')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x18998d,_0xf05b('0xc'));_0x5e591b(_0x2322cc[_0xf05b('0x14')][_0xf05b('0x13')]);}})[_0xf05b('0x15')](function(_0x422c9b){logger[_0xf05b('0x10')](_0xf05b('0x12'),_0x18998d,_0x422c9b);_0x281351(_0x422c9b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index fca6b66..20ff85c 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 _0x26cd=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5593c7,_0x280f63){var _0x13dd96=function(_0x321f97){while(--_0x321f97){_0x5593c7['push'](_0x5593c7['shift']());}};_0x13dd96(++_0x280f63);}(_0x26cd,0x1a1));var _0xd26c=function(_0x54782f,_0x256a2a){_0x54782f=_0x54782f-0x0;var _0x28e521=_0x26cd[_0x54782f];return _0x28e521;};'use strict';var multer=require('multer');var util=require(_0xd26c('0x0'));var path=require(_0xd26c('0x1'));var timeout=require(_0xd26c('0x2'));var express=require(_0xd26c('0x3'));var router=express[_0xd26c('0x4')]();var fs_extra=require(_0xd26c('0x5'));var auth=require(_0xd26c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd26c('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xd26c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd26c('0x9')]);router[_0xd26c('0x8')](_0xd26c('0xa'),auth[_0xd26c('0xb')](),controller[_0xd26c('0xc')]);router[_0xd26c('0xd')]('/',auth[_0xd26c('0xb')](),controller[_0xd26c('0xe')]);router[_0xd26c('0xf')](_0xd26c('0xa'),auth[_0xd26c('0xb')](),controller[_0xd26c('0x10')]);router[_0xd26c('0x11')](_0xd26c('0xa'),auth[_0xd26c('0xb')](),controller[_0xd26c('0x12')]);module[_0xd26c('0x13')]=router; \ No newline at end of file +var _0xccc0=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','get','create','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0x5dcd8f,_0x5471c3){var _0x3a13f0=function(_0x18e08a){while(--_0x18e08a){_0x5dcd8f['push'](_0x5dcd8f['shift']());}};_0x3a13f0(++_0x5471c3);}(_0xccc0,0x16d));var _0x0ccc=function(_0x3cf94e,_0x42c5bc){_0x3cf94e=_0x3cf94e-0x0;var _0xe73ad2=_0xccc0[_0x3cf94e];return _0xe73ad2;};'use strict';var multer=require('multer');var util=require(_0x0ccc('0x0'));var path=require(_0x0ccc('0x1'));var timeout=require(_0x0ccc('0x2'));var express=require(_0x0ccc('0x3'));var router=express[_0x0ccc('0x4')]();var fs_extra=require(_0x0ccc('0x5'));var auth=require(_0x0ccc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ccc('0x7'));var controller=require(_0x0ccc('0x8'));router['get']('/',auth[_0x0ccc('0x9')](),controller['index']);router[_0x0ccc('0xa')]('/:id',auth[_0x0ccc('0x9')](),controller['show']);router['post']('/',auth[_0x0ccc('0x9')](),controller[_0x0ccc('0xb')]);router['put'](_0x0ccc('0xc'),auth[_0x0ccc('0x9')](),controller[_0x0ccc('0xd')]);router[_0x0ccc('0xe')](_0x0ccc('0xc'),auth[_0x0ccc('0x9')](),controller[_0x0ccc('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8fa0fa8..bb90d0c 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 _0x985e=['STRING','sequelize','string','variable','customVariable','keyValue'];(function(_0x3802a0,_0x33cbcd){var _0x132c01=function(_0x1fb6fc){while(--_0x1fb6fc){_0x3802a0['push'](_0x3802a0['shift']());}};_0x132c01(++_0x33cbcd);}(_0x985e,0x127));var _0xe985=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0x985e[_0x16765f];return _0x1326d4;};'use strict';var Sequelize=require(_0xe985('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe985('0x1'),_0xe985('0x2'),_0xe985('0x3'),_0xe985('0x4'),'picklist'),'defaultValue':_0xe985('0x1')},'content':{'type':Sequelize[_0xe985('0x5')]},'key':{'type':Sequelize[_0xe985('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xe985('0x1'),_0xe985('0x2'),_0xe985('0x3'))},'keyContent':{'type':Sequelize[_0xe985('0x5')]},'idField':{'type':Sequelize[_0xe985('0x5')]},'nameField':{'type':Sequelize[_0xe985('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf207=['STRING','BOOLEAN','ENUM','string','variable','customVariable','picklist'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0xf207,0x175));var _0x7f20=function(_0x35dfe6,_0x4244fa){_0x35dfe6=_0x35dfe6-0x0;var _0x59651c=_0xf207[_0x35dfe6];return _0x59651c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7f20('0x0')](_0x7f20('0x1'),_0x7f20('0x2'),_0x7f20('0x3'),'keyValue',_0x7f20('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7f20('0x5')]},'key':{'type':Sequelize[_0x7f20('0x5')]},'keyType':{'type':Sequelize[_0x7f20('0x0')]('string',_0x7f20('0x2'),_0x7f20('0x3'))},'keyContent':{'type':Sequelize[_0x7f20('0x5')]},'idField':{'type':Sequelize[_0x7f20('0x5')]},'nameField':{'type':Sequelize[_0x7f20('0x5')]},'customField':{'type':Sequelize[_0x7f20('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 6570071..b8af0b8 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 _0x1752=['name','send','index','map','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','FreshdeskField','includeAll','findAll','catch','show','params','fields','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack'];(function(_0x5db1d6,_0x5461f5){var _0xc0f0e2=function(_0x212196){while(--_0x212196){_0x5db1d6['push'](_0x5db1d6['shift']());}};_0xc0f0e2(++_0x5461f5);}(_0x1752,0xa5));var _0x2175=function(_0x47da75,_0x55d4d1){_0x47da75=_0x47da75-0x0;var _0x1b4fdc=_0x1752[_0x47da75];return _0x1b4fdc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2175('0x0'));var zipdir=require(_0x2175('0x1'));var jsonpatch=require(_0x2175('0x2'));var rp=require(_0x2175('0x3'));var moment=require(_0x2175('0x4'));var BPromise=require(_0x2175('0x5'));var Mustache=require('mustache');var util=require(_0x2175('0x6'));var path=require(_0x2175('0x7'));var sox=require(_0x2175('0x8'));var csv=require(_0x2175('0x9'));var ejs=require(_0x2175('0xa'));var fs=require('fs');var fs_extra=require(_0x2175('0xb'));var _=require(_0x2175('0xc'));var squel=require(_0x2175('0xd'));var crypto=require(_0x2175('0xe'));var jsforce=require(_0x2175('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2175('0x9'));var querystring=require(_0x2175('0x10'));var Papa=require(_0x2175('0x11'));var Redis=require(_0x2175('0x12'));var authService=require(_0x2175('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2175('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2175('0x15'))['db'];function respondWithStatusCode(_0x5bc446,_0x43be3c){_0x43be3c=_0x43be3c||0xcc;return function(_0x393c02){if(_0x393c02){return _0x5bc446['sendStatus'](_0x43be3c);}return _0x5bc446[_0x2175('0x16')](_0x43be3c)[_0x2175('0x17')]();};}function respondWithResult(_0x45df73,_0x3bc01f){_0x3bc01f=_0x3bc01f||0xc8;return function(_0x21d4cd){if(_0x21d4cd){return _0x45df73[_0x2175('0x16')](_0x3bc01f)[_0x2175('0x18')](_0x21d4cd);}};}function respondWithFilteredResult(_0x413688,_0x5d84db){return function(_0x55b798){if(_0x55b798){var _0x371b42=typeof _0x5d84db[_0x2175('0x19')]===_0x2175('0x1a')&&typeof _0x5d84db['limit']==='undefined';var _0x588b0b=_0x55b798[_0x2175('0x1b')];var _0x377586=_0x371b42?0x0:_0x5d84db['offset'];var _0x53576c=_0x371b42?_0x55b798[_0x2175('0x1b')]:_0x5d84db[_0x2175('0x19')]+_0x5d84db[_0x2175('0x1c')];var _0x51628d;if(_0x53576c>=_0x588b0b){_0x53576c=_0x588b0b;_0x51628d=0xc8;}else{_0x51628d=0xce;}_0x413688[_0x2175('0x16')](_0x51628d);return _0x413688['set'](_0x2175('0x1d'),_0x377586+'-'+_0x53576c+'/'+_0x588b0b)['json'](_0x55b798);}return null;};}function patchUpdates(_0x37818a){return function(_0x4ec36c){try{jsonpatch['apply'](_0x4ec36c,_0x37818a,!![]);}catch(_0x5344af){return BPromise[_0x2175('0x1e')](_0x5344af);}return _0x4ec36c['save']();};}function saveUpdates(_0x28c4b8,_0x46ea57){return function(_0x2dd77b){if(_0x2dd77b){return _0x2dd77b[_0x2175('0x1f')](_0x28c4b8)[_0x2175('0x20')](function(_0x12d150){return _0x12d150;});}return null;};}function removeEntity(_0x5ac63e,_0x49d4b9){return function(_0x3d849e){if(_0x3d849e){return _0x3d849e[_0x2175('0x21')]()[_0x2175('0x20')](function(){_0x5ac63e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x9c6374,_0xe252f0){return function(_0x2204cd){if(!_0x2204cd){_0x9c6374['sendStatus'](0x194);}return _0x2204cd;};}function handleError(_0x224fa3,_0x4d2120){_0x4d2120=_0x4d2120||0x1f4;return function(_0x5e696c){logger[_0x2175('0x22')](_0x5e696c[_0x2175('0x23')]);if(_0x5e696c[_0x2175('0x24')]){delete _0x5e696c[_0x2175('0x24')];}_0x224fa3[_0x2175('0x16')](_0x4d2120)[_0x2175('0x25')](_0x5e696c);};}exports[_0x2175('0x26')]=function(_0x40d8c8,_0x1b807b){var _0x1c721d={},_0x7b6edb={},_0x56dcf9={'count':0x0,'rows':[]};var _0x20fccf=_[_0x2175('0x27')](db['FreshdeskField']['rawAttributes'],function(_0x3d64ac){return{'name':_0x3d64ac['fieldName'],'type':_0x3d64ac[_0x2175('0x28')]['key']};});_0x7b6edb['model']=_['map'](_0x20fccf,_0x2175('0x24'));_0x7b6edb[_0x2175('0x29')]=_[_0x2175('0x2a')](_0x40d8c8[_0x2175('0x29')]);_0x7b6edb['filters']=_[_0x2175('0x2b')](_0x7b6edb[_0x2175('0x2c')],_0x7b6edb['query']);_0x1c721d[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x7b6edb['model'],qs['fields'](_0x40d8c8['query']['fields']));_0x1c721d[_0x2175('0x2d')]=_0x1c721d[_0x2175('0x2d')][_0x2175('0x2e')]?_0x1c721d[_0x2175('0x2d')]:_0x7b6edb[_0x2175('0x2c')];if(!_0x40d8c8[_0x2175('0x29')][_0x2175('0x2f')](_0x2175('0x30'))){_0x1c721d['limit']=qs['limit'](_0x40d8c8['query']['limit']);_0x1c721d['offset']=qs[_0x2175('0x19')](_0x40d8c8[_0x2175('0x29')]['offset']);}_0x1c721d[_0x2175('0x31')]=qs[_0x2175('0x32')](_0x40d8c8[_0x2175('0x29')][_0x2175('0x32')]);_0x1c721d[_0x2175('0x33')]=qs[_0x2175('0x34')](_['pick'](_0x40d8c8[_0x2175('0x29')],_0x7b6edb[_0x2175('0x34')]),_0x20fccf);if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]){_0x1c721d[_0x2175('0x33')]=_[_0x2175('0x36')](_0x1c721d[_0x2175('0x33')],{'$or':_[_0x2175('0x27')](_0x20fccf,function(_0x38c212){if(_0x38c212[_0x2175('0x28')]!==_0x2175('0x37')){var _0x4be65c={};_0x4be65c[_0x38c212[_0x2175('0x24')]]={'$like':'%'+_0x40d8c8[_0x2175('0x29')][_0x2175('0x35')]+'%'};return _0x4be65c;}})});}_0x1c721d=_['merge']({},_0x1c721d,_0x40d8c8['options']);var _0x932bb6={'where':_0x1c721d['where']};return db[_0x2175('0x38')][_0x2175('0x1b')](_0x932bb6)[_0x2175('0x20')](function(_0x4989df){_0x56dcf9['count']=_0x4989df;if(_0x40d8c8[_0x2175('0x29')][_0x2175('0x39')]){_0x1c721d['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x2175('0x3a')](_0x1c721d);})[_0x2175('0x20')](function(_0x61784d){_0x56dcf9['rows']=_0x61784d;return _0x56dcf9;})[_0x2175('0x20')](respondWithFilteredResult(_0x1b807b,_0x1c721d))[_0x2175('0x3b')](handleError(_0x1b807b,null));};exports[_0x2175('0x3c')]=function(_0x5a6679,_0x49cf7d){var _0x459cee={'raw':!![],'where':{'id':_0x5a6679[_0x2175('0x3d')]['id']}},_0x47f60d={};_0x47f60d[_0x2175('0x2c')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x47f60d[_0x2175('0x29')]=_['keys'](_0x5a6679['query']);_0x47f60d[_0x2175('0x34')]=_['intersection'](_0x47f60d[_0x2175('0x2c')],_0x47f60d[_0x2175('0x29')]);_0x459cee[_0x2175('0x2d')]=_[_0x2175('0x2b')](_0x47f60d[_0x2175('0x2c')],qs[_0x2175('0x3e')](_0x5a6679['query'][_0x2175('0x3e')]));_0x459cee[_0x2175('0x2d')]=_0x459cee[_0x2175('0x2d')][_0x2175('0x2e')]?_0x459cee[_0x2175('0x2d')]:_0x47f60d[_0x2175('0x2c')];if(_0x5a6679['query'][_0x2175('0x39')]){_0x459cee[_0x2175('0x3f')]=[{'all':!![]}];}_0x459cee=_[_0x2175('0x36')]({},_0x459cee,_0x5a6679['options']);return db[_0x2175('0x38')]['find'](_0x459cee)['then'](handleEntityNotFound(_0x49cf7d,null))[_0x2175('0x20')](respondWithResult(_0x49cf7d,null))[_0x2175('0x3b')](handleError(_0x49cf7d,null));};exports[_0x2175('0x40')]=function(_0x5ee4aa,_0x32d6eb){return db[_0x2175('0x38')][_0x2175('0x40')](_0x5ee4aa[_0x2175('0x41')],{})[_0x2175('0x20')](respondWithResult(_0x32d6eb,0xc9))['catch'](handleError(_0x32d6eb,null));};exports['update']=function(_0xdb0a97,_0xeaabe3){if(_0xdb0a97[_0x2175('0x41')]['id']){delete _0xdb0a97[_0x2175('0x41')]['id'];}return db[_0x2175('0x38')]['find']({'where':{'id':_0xdb0a97[_0x2175('0x3d')]['id']}})[_0x2175('0x20')](handleEntityNotFound(_0xeaabe3,null))[_0x2175('0x20')](saveUpdates(_0xdb0a97['body'],null))['then'](respondWithResult(_0xeaabe3,null))[_0x2175('0x3b')](handleError(_0xeaabe3,null));};exports['destroy']=function(_0x5af419,_0x5bab81){return db['FreshdeskField'][_0x2175('0x42')]({'where':{'id':_0x5af419[_0x2175('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5bab81,null))['then'](removeEntity(_0x5bab81,null))['catch'](handleError(_0x5bab81,null));}; \ No newline at end of file +var _0x8ce3=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','FreshdeskField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x8ce3,0xc3));var _0x38ce=function(_0x47c958,_0x3cfe09){_0x47c958=_0x47c958-0x0;var _0x573eab=_0x8ce3[_0x47c958];return _0x573eab;};'use strict';var emlformat=require(_0x38ce('0x0'));var rimraf=require(_0x38ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38ce('0x2'));var rp=require(_0x38ce('0x3'));var moment=require(_0x38ce('0x4'));var BPromise=require(_0x38ce('0x5'));var Mustache=require(_0x38ce('0x6'));var util=require(_0x38ce('0x7'));var path=require(_0x38ce('0x8'));var sox=require(_0x38ce('0x9'));var csv=require('to-csv');var ejs=require(_0x38ce('0xa'));var fs=require('fs');var fs_extra=require(_0x38ce('0xb'));var _=require('lodash');var squel=require(_0x38ce('0xc'));var crypto=require(_0x38ce('0xd'));var jsforce=require(_0x38ce('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x38ce('0xf'));var querystring=require('querystring');var Papa=require(_0x38ce('0x10'));var Redis=require('ioredis');var authService=require(_0x38ce('0x11'));var qs=require(_0x38ce('0x12'));var as=require(_0x38ce('0x13'));var hardwareService=require(_0x38ce('0x14'));var logger=require(_0x38ce('0x15'))(_0x38ce('0x16'));var utils=require(_0x38ce('0x17'));var config=require(_0x38ce('0x18'));var licenseUtil=require(_0x38ce('0x19'));var db=require(_0x38ce('0x1a'))['db'];function respondWithStatusCode(_0x42e234,_0x3ef662){_0x3ef662=_0x3ef662||0xcc;return function(_0x28b554){if(_0x28b554){return _0x42e234[_0x38ce('0x1b')](_0x3ef662);}return _0x42e234[_0x38ce('0x1c')](_0x3ef662)[_0x38ce('0x1d')]();};}function respondWithResult(_0x56a09f,_0x48ba7c){_0x48ba7c=_0x48ba7c||0xc8;return function(_0x3c4d7f){if(_0x3c4d7f){return _0x56a09f[_0x38ce('0x1c')](_0x48ba7c)[_0x38ce('0x1e')](_0x3c4d7f);}};}function respondWithFilteredResult(_0x55be6a,_0x2f3b99){return function(_0x54fcd3){if(_0x54fcd3){var _0x2771ec=typeof _0x2f3b99[_0x38ce('0x1f')]==='undefined'&&typeof _0x2f3b99[_0x38ce('0x20')]===_0x38ce('0x21');var _0x1dfaba=_0x54fcd3['count'];var _0xe4099a=_0x2771ec?0x0:_0x2f3b99[_0x38ce('0x1f')];var _0x3df527=_0x2771ec?_0x54fcd3[_0x38ce('0x22')]:_0x2f3b99[_0x38ce('0x1f')]+_0x2f3b99[_0x38ce('0x20')];var _0x2d4218;if(_0x3df527>=_0x1dfaba){_0x3df527=_0x1dfaba;_0x2d4218=0xc8;}else{_0x2d4218=0xce;}_0x55be6a['status'](_0x2d4218);return _0x55be6a[_0x38ce('0x23')](_0x38ce('0x24'),_0xe4099a+'-'+_0x3df527+'/'+_0x1dfaba)[_0x38ce('0x1e')](_0x54fcd3);}return null;};}function patchUpdates(_0x303391){return function(_0x30b060){try{jsonpatch[_0x38ce('0x25')](_0x30b060,_0x303391,!![]);}catch(_0x323490){return BPromise[_0x38ce('0x26')](_0x323490);}return _0x30b060[_0x38ce('0x27')]();};}function saveUpdates(_0x3cf50b,_0x1aace7){return function(_0x580cf3){if(_0x580cf3){return _0x580cf3[_0x38ce('0x28')](_0x3cf50b)[_0x38ce('0x29')](function(_0xe40e9c){return _0xe40e9c;});}return null;};}function removeEntity(_0xcf5d9e,_0x4a56b0){return function(_0x2c85e6){if(_0x2c85e6){return _0x2c85e6[_0x38ce('0x2a')]()['then'](function(){_0xcf5d9e[_0x38ce('0x1c')](0xcc)[_0x38ce('0x1d')]();});}};}function handleEntityNotFound(_0x43b479,_0x5b330c){return function(_0x4a7e8e){if(!_0x4a7e8e){_0x43b479[_0x38ce('0x1b')](0x194);}return _0x4a7e8e;};}function handleError(_0x28ab4c,_0x142d72){_0x142d72=_0x142d72||0x1f4;return function(_0x21d4e7){logger[_0x38ce('0x2b')](_0x21d4e7[_0x38ce('0x2c')]);if(_0x21d4e7[_0x38ce('0x2d')]){delete _0x21d4e7[_0x38ce('0x2d')];}_0x28ab4c[_0x38ce('0x1c')](_0x142d72)[_0x38ce('0x2e')](_0x21d4e7);};}exports[_0x38ce('0x2f')]=function(_0x381703,_0x50692a){var _0x1212dd={},_0x1538a0={},_0x5b4a7a={'count':0x0,'rows':[]};var _0x229ac2=_[_0x38ce('0x30')](db['FreshdeskField'][_0x38ce('0x31')],function(_0x282ee4){return{'name':_0x282ee4['fieldName'],'type':_0x282ee4[_0x38ce('0x32')]['key']};});_0x1538a0[_0x38ce('0x33')]=_[_0x38ce('0x30')](_0x229ac2,_0x38ce('0x2d'));_0x1538a0[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x381703[_0x38ce('0x34')]);_0x1538a0[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x1538a0['model'],_0x1538a0['query']);_0x1212dd[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x1538a0[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x381703[_0x38ce('0x34')]['fields']));_0x1212dd[_0x38ce('0x38')]=_0x1212dd[_0x38ce('0x38')][_0x38ce('0x3a')]?_0x1212dd[_0x38ce('0x38')]:_0x1538a0[_0x38ce('0x33')];if(!_0x381703[_0x38ce('0x34')][_0x38ce('0x3b')]('nolimit')){_0x1212dd[_0x38ce('0x20')]=qs[_0x38ce('0x20')](_0x381703['query'][_0x38ce('0x20')]);_0x1212dd[_0x38ce('0x1f')]=qs[_0x38ce('0x1f')](_0x381703[_0x38ce('0x34')][_0x38ce('0x1f')]);}_0x1212dd[_0x38ce('0x3c')]=qs[_0x38ce('0x3d')](_0x381703[_0x38ce('0x34')]['sort']);_0x1212dd[_0x38ce('0x3e')]=qs[_0x38ce('0x36')](_[_0x38ce('0x3f')](_0x381703[_0x38ce('0x34')],_0x1538a0['filters']),_0x229ac2);if(_0x381703[_0x38ce('0x34')]['filter']){_0x1212dd[_0x38ce('0x3e')]=_[_0x38ce('0x40')](_0x1212dd[_0x38ce('0x3e')],{'$or':_[_0x38ce('0x30')](_0x229ac2,function(_0x43d629){if(_0x43d629[_0x38ce('0x32')]!=='VIRTUAL'){var _0x1c3fd5={};_0x1c3fd5[_0x43d629['name']]={'$like':'%'+_0x381703[_0x38ce('0x34')][_0x38ce('0x41')]+'%'};return _0x1c3fd5;}})});}_0x1212dd=_[_0x38ce('0x40')]({},_0x1212dd,_0x381703[_0x38ce('0x42')]);var _0x277e94={'where':_0x1212dd[_0x38ce('0x3e')]};return db['FreshdeskField'][_0x38ce('0x22')](_0x277e94)[_0x38ce('0x29')](function(_0x318ff8){_0x5b4a7a[_0x38ce('0x22')]=_0x318ff8;if(_0x381703[_0x38ce('0x34')][_0x38ce('0x43')]){_0x1212dd['include']=[{'all':!![]}];}return db['FreshdeskField'][_0x38ce('0x44')](_0x1212dd);})[_0x38ce('0x29')](function(_0x174c86){_0x5b4a7a[_0x38ce('0x45')]=_0x174c86;return _0x5b4a7a;})[_0x38ce('0x29')](respondWithFilteredResult(_0x50692a,_0x1212dd))[_0x38ce('0x46')](handleError(_0x50692a,null));};exports[_0x38ce('0x47')]=function(_0x570a3d,_0x43b4fc){var _0x30cfe3={'raw':!![],'where':{'id':_0x570a3d[_0x38ce('0x48')]['id']}},_0x5a689b={};_0x5a689b[_0x38ce('0x33')]=_[_0x38ce('0x35')](db['FreshdeskField'][_0x38ce('0x31')]);_0x5a689b[_0x38ce('0x34')]=_[_0x38ce('0x35')](_0x570a3d[_0x38ce('0x34')]);_0x5a689b[_0x38ce('0x36')]=_[_0x38ce('0x37')](_0x5a689b['model'],_0x5a689b[_0x38ce('0x34')]);_0x30cfe3[_0x38ce('0x38')]=_[_0x38ce('0x37')](_0x5a689b[_0x38ce('0x33')],qs[_0x38ce('0x39')](_0x570a3d[_0x38ce('0x34')]['fields']));_0x30cfe3[_0x38ce('0x38')]=_0x30cfe3[_0x38ce('0x38')]['length']?_0x30cfe3['attributes']:_0x5a689b['model'];if(_0x570a3d[_0x38ce('0x34')][_0x38ce('0x43')]){_0x30cfe3['include']=[{'all':!![]}];}_0x30cfe3=_['merge']({},_0x30cfe3,_0x570a3d[_0x38ce('0x42')]);return db['FreshdeskField'][_0x38ce('0x49')](_0x30cfe3)['then'](handleEntityNotFound(_0x43b4fc,null))[_0x38ce('0x29')](respondWithResult(_0x43b4fc,null))[_0x38ce('0x46')](handleError(_0x43b4fc,null));};exports['create']=function(_0x1d9ef8,_0x17a8cf){return db['FreshdeskField'][_0x38ce('0x4a')](_0x1d9ef8[_0x38ce('0x4b')],{})[_0x38ce('0x29')](respondWithResult(_0x17a8cf,0xc9))[_0x38ce('0x46')](handleError(_0x17a8cf,null));};exports[_0x38ce('0x28')]=function(_0x25a299,_0x58cc6f){if(_0x25a299[_0x38ce('0x4b')]['id']){delete _0x25a299[_0x38ce('0x4b')]['id'];}return db['FreshdeskField'][_0x38ce('0x49')]({'where':{'id':_0x25a299[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x58cc6f,null))[_0x38ce('0x29')](saveUpdates(_0x25a299[_0x38ce('0x4b')],null))[_0x38ce('0x29')](respondWithResult(_0x58cc6f,null))[_0x38ce('0x46')](handleError(_0x58cc6f,null));};exports['destroy']=function(_0x3e1522,_0x34a118){return db[_0x38ce('0x4c')][_0x38ce('0x49')]({'where':{'id':_0x3e1522[_0x38ce('0x48')]['id']}})[_0x38ce('0x29')](handleEntityNotFound(_0x34a118,null))['then'](removeEntity(_0x34a118,null))['catch'](handleError(_0x34a118,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 96bdc8c..295aeba 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 _0xfa2f=['define','freshdesk_unique_index','idField','FieldId','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x19152c,_0x4cedfc){var _0xc1a675=function(_0x9e184b){while(--_0x9e184b){_0x19152c['push'](_0x19152c['shift']());}};_0xc1a675(++_0x4cedfc);}(_0xfa2f,0xe8));var _0xffa2=function(_0x397f6e,_0x30363f){_0x397f6e=_0x397f6e-0x0;var _0x4e0e4a=_0xfa2f[_0x397f6e];return _0x4e0e4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xffa2('0x0'))('api');var moment=require(_0xffa2('0x1'));var BPromise=require(_0xffa2('0x2'));var rp=require(_0xffa2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffa2('0x4'));var config=require(_0xffa2('0x5'));var attributes=require(_0xffa2('0x6'));module[_0xffa2('0x7')]=function(_0x25fd81,_0x2c7708){return _0x25fd81[_0xffa2('0x8')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xffa2('0x9'),'fields':[_0xffa2('0xa'),_0xffa2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc01b=['FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xc01b,0x74));var _0xbc01=function(_0x55fe2c,_0x51b208){_0x55fe2c=_0x55fe2c-0x0;var _0x4d8bc6=_0xc01b[_0x55fe2c];return _0x4d8bc6;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var logger=require(_0xbc01('0x2'))(_0xbc01('0x3'));var moment=require(_0xbc01('0x4'));var BPromise=require(_0xbc01('0x5'));var rp=require(_0xbc01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbc01('0x7'));var config=require(_0xbc01('0x8'));var attributes=require(_0xbc01('0x9'));module[_0xbc01('0xa')]=function(_0x279549,_0xdfa6b6){return _0x279549[_0xbc01('0xb')](_0xbc01('0xc'),attributes,{'tableName':_0xbc01('0xd'),'paranoid':![],'indexes':[{'name':_0xbc01('0xe'),'fields':[_0xbc01('0xf'),'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 9f5e16b..a44a1bb 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 _0x653b=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','code','message','error','result','util'];(function(_0x1a42ac,_0x5edb6d){var _0x559c0b=function(_0x254fac){while(--_0x254fac){_0x1a42ac['push'](_0x1a42ac['shift']());}};_0x559c0b(++_0x5edb6d);}(_0x653b,0x9f));var _0xb653=function(_0x5b2d38,_0x3c461a){_0x5b2d38=_0x5b2d38-0x0;var _0x2f7806=_0x653b[_0x5b2d38];return _0x2f7806;};'use strict';var _=require('lodash');var util=require(_0xb653('0x0'));var moment=require(_0xb653('0x1'));var BPromise=require('bluebird');var rs=require(_0xb653('0x2'));var fs=require('fs');var Redis=require(_0xb653('0x3'));var db=require(_0xb653('0x4'))['db'];var utils=require(_0xb653('0x5'));var logger=require('../../config/logger')(_0xb653('0x6'));var config=require(_0xb653('0x7'));var jayson=require(_0xb653('0x8'));var client=jayson[_0xb653('0x9')][_0xb653('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x218eee,_0x30ad8a,_0x4f5111){return new BPromise(function(_0x55279a,_0x5d4049){return client['request'](_0x218eee,_0x4f5111)[_0xb653('0xb')](function(_0x3a42af){logger[_0xb653('0xc')](_0xb653('0xd'),_0x30ad8a,_0xb653('0xe'));logger[_0xb653('0xf')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x30ad8a,_0xb653('0xe'),JSON['stringify'](_0x3a42af));if(_0x3a42af['error']){if(_0x3a42af['error'][_0xb653('0x10')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x30ad8a,_0x3a42af['error'][_0xb653('0x11')]);return _0x5d4049(_0x3a42af['error']['message']);}logger[_0xb653('0x12')](_0xb653('0xd'),_0x30ad8a,_0x3a42af[_0xb653('0x12')][_0xb653('0x11')]);return _0x55279a(_0x3a42af[_0xb653('0x12')][_0xb653('0x11')]);}else{logger[_0xb653('0xc')](_0xb653('0xd'),_0x30ad8a,'request\x20sent');_0x55279a(_0x3a42af[_0xb653('0x13')][_0xb653('0x11')]);}})['catch'](function(_0x42c8ea){logger[_0xb653('0x12')](_0xb653('0xd'),_0x30ad8a,_0x42c8ea);_0x5d4049(_0x42c8ea);});});} \ No newline at end of file +var _0x311a=['FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x40189f,_0x526880){var _0xfc3842=function(_0x449c23){while(--_0x449c23){_0x40189f['push'](_0x40189f['shift']());}};_0xfc3842(++_0x526880);}(_0x311a,0xf9));var _0xa311=function(_0x859750,_0x397a13){_0x859750=_0x859750-0x0;var _0x3c88b4=_0x311a[_0x859750];return _0x3c88b4;};'use strict';var _=require(_0xa311('0x0'));var util=require(_0xa311('0x1'));var moment=require('moment');var BPromise=require(_0xa311('0x2'));var rs=require(_0xa311('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa311('0x4'))['db'];var utils=require(_0xa311('0x5'));var logger=require(_0xa311('0x6'))(_0xa311('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa311('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x178e41,_0x56b30c,_0x238d54){return new BPromise(function(_0x255452,_0x372645){return client[_0xa311('0x9')](_0x178e41,_0x238d54)[_0xa311('0xa')](function(_0x32c471){logger[_0xa311('0xb')](_0xa311('0xc'),_0x56b30c,_0xa311('0xd'));logger[_0xa311('0xe')](_0xa311('0xf'),_0x56b30c,_0xa311('0xd'),JSON[_0xa311('0x10')](_0x32c471));if(_0x32c471[_0xa311('0x11')]){if(_0x32c471[_0xa311('0x11')][_0xa311('0x12')]===0x1f4){logger['error'](_0xa311('0xc'),_0x56b30c,_0x32c471[_0xa311('0x11')][_0xa311('0x13')]);return _0x372645(_0x32c471[_0xa311('0x11')][_0xa311('0x13')]);}logger[_0xa311('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x56b30c,_0x32c471['error'][_0xa311('0x13')]);return _0x255452(_0x32c471[_0xa311('0x11')]['message']);}else{logger[_0xa311('0xb')](_0xa311('0xc'),_0x56b30c,_0xa311('0xd'));_0x255452(_0x32c471[_0xa311('0x14')][_0xa311('0x13')]);}})[_0xa311('0x15')](function(_0x604dad){logger['error'](_0xa311('0xc'),_0x56b30c,_0x604dad);_0x372645(_0x604dad);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index ae9b874..409af57 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 _0xa902=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0xa902,0x8d));var _0x2a90=function(_0x29dce3,_0x4ab903){_0x29dce3=_0x29dce3-0x0;var _0x3b9abf=_0xa902[_0x29dce3];return _0x3b9abf;};'use strict';var multer=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var path=require(_0x2a90('0x2'));var timeout=require(_0x2a90('0x3'));var express=require(_0x2a90('0x4'));var router=express['Router']();var fs_extra=require(_0x2a90('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2a90('0x6'));var controller=require(_0x2a90('0x7'));router[_0x2a90('0x8')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0xa')]);router[_0x2a90('0x8')]('/:id',auth[_0x2a90('0x9')](),controller['show']);router['get'](_0x2a90('0xb'),auth[_0x2a90('0x9')](),controller[_0x2a90('0xc')]);router[_0x2a90('0x8')](_0x2a90('0xd'),auth['isAuthenticated'](),controller[_0x2a90('0xe')]);router[_0x2a90('0xf')]('/',auth[_0x2a90('0x9')](),controller[_0x2a90('0x10')]);router['post'](_0x2a90('0xb'),auth['isAuthenticated'](),controller[_0x2a90('0x11')]);router['put'](_0x2a90('0x12'),auth['isAuthenticated'](),controller[_0x2a90('0x13')]);router[_0x2a90('0x14')](_0x2a90('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x593e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0x593e,0xcb));var _0xe593=function(_0x110fb8,_0xa49316){_0x110fb8=_0x110fb8-0x0;var _0x308258=_0x593e[_0x110fb8];return _0x308258;};'use strict';var multer=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var path=require(_0xe593('0x2'));var timeout=require(_0xe593('0x3'));var express=require(_0xe593('0x4'));var router=express[_0xe593('0x5')]();var fs_extra=require(_0xe593('0x6'));var auth=require(_0xe593('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xe593('0x8'));var controller=require(_0xe593('0x9'));router[_0xe593('0xa')]('/',auth[_0xe593('0xb')](),controller[_0xe593('0xc')]);router[_0xe593('0xa')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0xe')]);router[_0xe593('0xa')]('/:id/configurations',auth[_0xe593('0xb')](),controller[_0xe593('0xf')]);router[_0xe593('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe593('0x10')]);router[_0xe593('0x11')]('/',auth[_0xe593('0xb')](),controller['create']);router[_0xe593('0x11')](_0xe593('0x12'),auth[_0xe593('0xb')](),controller[_0xe593('0x13')]);router[_0xe593('0x14')](_0xe593('0xd'),auth[_0xe593('0xb')](),controller[_0xe593('0x15')]);router[_0xe593('0x16')](_0xe593('0xd'),auth['isAuthenticated'](),controller[_0xe593('0x17')]);module[_0xe593('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d8963b9..43db428 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 _0xadb5=['remoteUri','exports','STRING','username'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xadb5,0xad));var _0x5adb=function(_0x43b76a,_0x5b888c){_0x43b76a=_0x43b76a-0x0;var _0x1b3d7b=_0xadb5[_0x43b76a];return _0x1b3d7b;};'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 +var _0xef0f=['sequelize','STRING','remoteUri'];(function(_0x140d0c,_0x416b91){var _0x20887e=function(_0x63650f){while(--_0x63650f){_0x140d0c['push'](_0x140d0c['shift']());}};_0x20887e(++_0x416b91);}(_0xef0f,0x168));var _0xfef0=function(_0xa1cf31,_0x33373a){_0xa1cf31=_0xa1cf31-0x0;var _0x5cd5ff=_0xef0f[_0xa1cf31];return _0x5cd5ff;};'use strict';var Sequelize=require(_0xfef0('0x0'));module['exports']={'name':{'type':Sequelize[_0xfef0('0x1')]},'description':{'type':Sequelize[_0xfef0('0x1')]},'username':{'type':Sequelize[_0xfef0('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfef0('0x1')]},'remoteUri':{'type':Sequelize[_0xfef0('0x1')],'unique':_0xfef0('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index c869b42..b953f49 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 _0x47da=['destroy','then','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','keys','filters','intersection','attributes','fields','query','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','getConfigurations','findOne','order','hasOwnProperty','nolimit','getDescriptions','FreshsalesConfiguration','Subjects','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','util','path','ejs','fs-extra','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update'];(function(_0x5f0627,_0x72504a){var _0x490fe6=function(_0x421e95){while(--_0x421e95){_0x5f0627['push'](_0x5f0627['shift']());}};_0x490fe6(++_0x72504a);}(_0x47da,0x99));var _0xa47d=function(_0x48f03d,_0x40ca13){_0x48f03d=_0x48f03d-0x0;var _0x25ccdb=_0x47da[_0x48f03d];return _0x25ccdb;};'use strict';var emlformat=require(_0xa47d('0x0'));var rimraf=require(_0xa47d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa47d('0x2'));var rp=require('request-promise');var moment=require(_0xa47d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa47d('0x4'));var path=require(_0xa47d('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa47d('0x6'));var fs=require('fs');var fs_extra=require(_0xa47d('0x7'));var _=require('lodash');var squel=require(_0xa47d('0x8'));var crypto=require('crypto');var jsforce=require(_0xa47d('0x9'));var deskjs=require(_0xa47d('0xa'));var toCsv=require(_0xa47d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa47d('0xc'));var qs=require(_0xa47d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa47d('0xe'));var logger=require(_0xa47d('0xf'))('api');var utils=require(_0xa47d('0x10'));var config=require(_0xa47d('0x11'));var licenseUtil=require(_0xa47d('0x12'));var db=require(_0xa47d('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1263d2,_0x204cd2){_0x204cd2=_0x204cd2||0xcc;return function(_0x3eee5a){if(_0x3eee5a){return _0x1263d2[_0xa47d('0x14')](_0x204cd2);}return _0x1263d2[_0xa47d('0x15')](_0x204cd2)[_0xa47d('0x16')]();};}function respondWithResult(_0x120461,_0x490f25){_0x490f25=_0x490f25||0xc8;return function(_0x52b62d){if(_0x52b62d){return _0x120461[_0xa47d('0x15')](_0x490f25)['json'](_0x52b62d);}};}function respondWithFilteredResult(_0x5b763d,_0x506642){return function(_0x363713){if(_0x363713){var _0x386039=typeof _0x506642[_0xa47d('0x17')]===_0xa47d('0x18')&&typeof _0x506642[_0xa47d('0x19')]===_0xa47d('0x18');var _0xaebfba=_0x363713['count'];var _0x4433cd=_0x386039?0x0:_0x506642['offset'];var _0x2d677b=_0x386039?_0x363713[_0xa47d('0x1a')]:_0x506642[_0xa47d('0x17')]+_0x506642[_0xa47d('0x19')];var _0x147fa2;if(_0x2d677b>=_0xaebfba){_0x2d677b=_0xaebfba;_0x147fa2=0xc8;}else{_0x147fa2=0xce;}_0x5b763d[_0xa47d('0x15')](_0x147fa2);return _0x5b763d['set'](_0xa47d('0x1b'),_0x4433cd+'-'+_0x2d677b+'/'+_0xaebfba)[_0xa47d('0x1c')](_0x363713);}return null;};}function patchUpdates(_0x21c77e){return function(_0x2949df){try{jsonpatch[_0xa47d('0x1d')](_0x2949df,_0x21c77e,!![]);}catch(_0x3ceb5b){return BPromise[_0xa47d('0x1e')](_0x3ceb5b);}return _0x2949df[_0xa47d('0x1f')]();};}function saveUpdates(_0x2540b2,_0x43319a){return function(_0x4516b9){if(_0x4516b9){return _0x4516b9[_0xa47d('0x20')](_0x2540b2)['then'](function(_0x40ea73){return _0x40ea73;});}return null;};}function removeEntity(_0x292d0f,_0x112c5f){return function(_0x22eeb1){if(_0x22eeb1){return _0x22eeb1[_0xa47d('0x21')]()[_0xa47d('0x22')](function(){_0x292d0f[_0xa47d('0x15')](0xcc)[_0xa47d('0x16')]();});}};}function handleEntityNotFound(_0xcbe25f,_0x20bdff){return function(_0x281564){if(!_0x281564){_0xcbe25f['sendStatus'](0x194);}return _0x281564;};}function handleError(_0x4dba63,_0x5a0c1e){_0x5a0c1e=_0x5a0c1e||0x1f4;return function(_0x20dd1e){logger['error'](_0x20dd1e[_0xa47d('0x23')]);if(_0x20dd1e[_0xa47d('0x24')]){delete _0x20dd1e[_0xa47d('0x24')];}_0x4dba63[_0xa47d('0x15')](_0x5a0c1e)[_0xa47d('0x25')](_0x20dd1e);};}exports[_0xa47d('0x26')]=function(_0x1ef199,_0x35c7da){var _0x176e49={},_0x5526ee={},_0x19890f={'count':0x0,'rows':[]};var _0x3a910b=_[_0xa47d('0x27')](db[_0xa47d('0x28')][_0xa47d('0x29')],function(_0x2824a3){return{'name':_0x2824a3[_0xa47d('0x2a')],'type':_0x2824a3[_0xa47d('0x2b')]['key']};});_0x5526ee[_0xa47d('0x2c')]=_[_0xa47d('0x27')](_0x3a910b,'name');_0x5526ee['query']=_[_0xa47d('0x2d')](_0x1ef199['query']);_0x5526ee[_0xa47d('0x2e')]=_[_0xa47d('0x2f')](_0x5526ee['model'],_0x5526ee['query']);_0x176e49[_0xa47d('0x30')]=_[_0xa47d('0x2f')](_0x5526ee[_0xa47d('0x2c')],qs['fields'](_0x1ef199['query'][_0xa47d('0x31')]));_0x176e49[_0xa47d('0x30')]=_0x176e49[_0xa47d('0x30')]['length']?_0x176e49[_0xa47d('0x30')]:_0x5526ee[_0xa47d('0x2c')];if(!_0x1ef199['query']['hasOwnProperty']('nolimit')){_0x176e49['limit']=qs[_0xa47d('0x19')](_0x1ef199[_0xa47d('0x32')][_0xa47d('0x19')]);_0x176e49[_0xa47d('0x17')]=qs[_0xa47d('0x17')](_0x1ef199[_0xa47d('0x32')][_0xa47d('0x17')]);}_0x176e49['order']=qs[_0xa47d('0x33')](_0x1ef199[_0xa47d('0x32')]['sort']);_0x176e49[_0xa47d('0x34')]=qs[_0xa47d('0x2e')](_[_0xa47d('0x35')](_0x1ef199[_0xa47d('0x32')],_0x5526ee['filters']),_0x3a910b);if(_0x1ef199[_0xa47d('0x32')][_0xa47d('0x36')]){_0x176e49[_0xa47d('0x34')]=_['merge'](_0x176e49[_0xa47d('0x34')],{'$or':_[_0xa47d('0x27')](_0x3a910b,function(_0x5d0a40){if(_0x5d0a40[_0xa47d('0x2b')]!==_0xa47d('0x37')){var _0x44b0cf={};_0x44b0cf[_0x5d0a40[_0xa47d('0x24')]]={'$like':'%'+_0x1ef199['query']['filter']+'%'};return _0x44b0cf;}})});}_0x176e49=_[_0xa47d('0x38')]({},_0x176e49,_0x1ef199[_0xa47d('0x39')]);var _0x26f173={'where':_0x176e49[_0xa47d('0x34')]};return db['FreshsalesAccount'][_0xa47d('0x1a')](_0x26f173)[_0xa47d('0x22')](function(_0x5f33ce){_0x19890f[_0xa47d('0x1a')]=_0x5f33ce;if(_0x1ef199[_0xa47d('0x32')][_0xa47d('0x3a')]){_0x176e49[_0xa47d('0x3b')]=[{'all':!![]}];}return db[_0xa47d('0x28')][_0xa47d('0x3c')](_0x176e49);})['then'](function(_0x4589ac){_0x19890f[_0xa47d('0x3d')]=_0x4589ac;return _0x19890f;})[_0xa47d('0x22')](respondWithFilteredResult(_0x35c7da,_0x176e49))[_0xa47d('0x3e')](handleError(_0x35c7da,null));};exports[_0xa47d('0x3f')]=function(_0x24c3d8,_0xb5fd4d){var _0x506e57={'raw':![],'where':{'id':_0x24c3d8[_0xa47d('0x40')]['id']}},_0x49b3e8={};_0x49b3e8[_0xa47d('0x2c')]=_[_0xa47d('0x2d')](db[_0xa47d('0x28')][_0xa47d('0x29')]);_0x49b3e8['query']=_[_0xa47d('0x2d')](_0x24c3d8[_0xa47d('0x32')]);_0x49b3e8[_0xa47d('0x2e')]=_[_0xa47d('0x2f')](_0x49b3e8[_0xa47d('0x2c')],_0x49b3e8['query']);_0x506e57[_0xa47d('0x30')]=_[_0xa47d('0x2f')](_0x49b3e8[_0xa47d('0x2c')],qs[_0xa47d('0x31')](_0x24c3d8[_0xa47d('0x32')][_0xa47d('0x31')]));_0x506e57[_0xa47d('0x30')]=_0x506e57[_0xa47d('0x30')][_0xa47d('0x41')]?_0x506e57['attributes']:_0x49b3e8[_0xa47d('0x2c')];if(_0x24c3d8['query'][_0xa47d('0x3a')]){_0x506e57[_0xa47d('0x3b')]=[{'all':!![]}];}_0x506e57=_[_0xa47d('0x38')]({},_0x506e57,_0x24c3d8[_0xa47d('0x39')]);return db[_0xa47d('0x28')]['find'](_0x506e57)[_0xa47d('0x22')](handleEntityNotFound(_0xb5fd4d,null))['then'](respondWithResult(_0xb5fd4d,null))['catch'](handleError(_0xb5fd4d,null));};exports[_0xa47d('0x42')]=function(_0x4d5b04,_0x4a17e1){return db[_0xa47d('0x28')]['create'](_0x4d5b04[_0xa47d('0x43')],{})[_0xa47d('0x22')](respondWithResult(_0x4a17e1,0xc9))[_0xa47d('0x3e')](handleError(_0x4a17e1,null));};exports[_0xa47d('0x20')]=function(_0x55833a,_0x218485){if(_0x55833a[_0xa47d('0x43')]['id']){delete _0x55833a['body']['id'];}return db[_0xa47d('0x28')]['find']({'where':{'id':_0x55833a[_0xa47d('0x40')]['id']}})[_0xa47d('0x22')](handleEntityNotFound(_0x218485,null))['then'](saveUpdates(_0x55833a[_0xa47d('0x43')],null))[_0xa47d('0x22')](respondWithResult(_0x218485,null))[_0xa47d('0x3e')](handleError(_0x218485,null));};exports[_0xa47d('0x21')]=function(_0xe0a84,_0xec570a){return db['FreshsalesAccount']['find']({'where':{'id':_0xe0a84[_0xa47d('0x40')]['id']}})[_0xa47d('0x22')](handleEntityNotFound(_0xec570a,null))['then'](removeEntity(_0xec570a,null))[_0xa47d('0x3e')](handleError(_0xec570a,null));};exports[_0xa47d('0x44')]=function(_0x517fae,_0x165028,_0x304abf){var _0x473f04={};var _0x14441f={};var _0x25f85a;var _0x412da3;return db[_0xa47d('0x28')][_0xa47d('0x45')]({'where':{'id':_0x517fae[_0xa47d('0x40')]['id']}})[_0xa47d('0x22')](handleEntityNotFound(_0x165028,null))[_0xa47d('0x22')](function(_0xd9cb61){if(_0xd9cb61){_0x25f85a=_0xd9cb61;_0x14441f[_0xa47d('0x2c')]=_[_0xa47d('0x2d')](db['FreshsalesConfiguration'][_0xa47d('0x29')]);_0x14441f[_0xa47d('0x32')]=_[_0xa47d('0x2d')](_0x517fae['query']);_0x14441f[_0xa47d('0x2e')]=_[_0xa47d('0x2f')](_0x14441f[_0xa47d('0x2c')],_0x14441f[_0xa47d('0x32')]);_0x473f04[_0xa47d('0x30')]=_[_0xa47d('0x2f')](_0x14441f[_0xa47d('0x2c')],qs[_0xa47d('0x31')](_0x517fae[_0xa47d('0x32')]['fields']));_0x473f04[_0xa47d('0x30')]=_0x473f04[_0xa47d('0x30')]['length']?_0x473f04['attributes']:_0x14441f[_0xa47d('0x2c')];_0x473f04[_0xa47d('0x46')]=qs[_0xa47d('0x33')](_0x517fae[_0xa47d('0x32')][_0xa47d('0x33')]);_0x473f04[_0xa47d('0x34')]=qs[_0xa47d('0x2e')](_[_0xa47d('0x35')](_0x517fae[_0xa47d('0x32')],_0x14441f[_0xa47d('0x2e')]));if(_0x517fae[_0xa47d('0x32')][_0xa47d('0x36')]){_0x473f04[_0xa47d('0x34')]=_['merge'](_0x473f04[_0xa47d('0x34')],{'$or':_[_0xa47d('0x27')](_0x473f04[_0xa47d('0x30')],function(_0x23f382){var _0xce6b74={};_0xce6b74[_0x23f382]={'$like':'%'+_0x517fae[_0xa47d('0x32')]['filter']+'%'};return _0xce6b74;})});}_0x473f04=_[_0xa47d('0x38')]({},_0x473f04,_0x517fae[_0xa47d('0x39')]);return _0x25f85a[_0xa47d('0x44')](_0x473f04);}})[_0xa47d('0x22')](function(_0x363fbf){if(_0x363fbf){_0x412da3=_0x363fbf[_0xa47d('0x41')];if(!_0x517fae[_0xa47d('0x32')][_0xa47d('0x47')](_0xa47d('0x48'))){_0x473f04[_0xa47d('0x19')]=qs[_0xa47d('0x19')](_0x517fae[_0xa47d('0x32')]['limit']);_0x473f04['offset']=qs[_0xa47d('0x17')](_0x517fae[_0xa47d('0x32')][_0xa47d('0x17')]);}return _0x25f85a[_0xa47d('0x44')](_0x473f04);}})[_0xa47d('0x22')](function(_0x287f78){if(_0x287f78){return _0x287f78?{'count':_0x412da3,'rows':_0x287f78}:null;}})[_0xa47d('0x22')](respondWithResult(_0x165028,null))[_0xa47d('0x3e')](handleError(_0x165028,null));};exports['addConfiguration']=function(_0x359d14,_0x2d00cf,_0x102957){if(_0x359d14[_0xa47d('0x43')]['id']){delete _0x359d14[_0xa47d('0x43')]['id'];}return db[_0xa47d('0x28')][_0xa47d('0x45')]({'where':{'id':_0x359d14[_0xa47d('0x40')]['id']}})[_0xa47d('0x22')](handleEntityNotFound(_0x2d00cf,null))[_0xa47d('0x22')](function(_0x13668e){if(_0x13668e){_0x359d14[_0xa47d('0x43')]['AccountId']=_0x13668e['id'];_0x359d14[_0xa47d('0x43')]['Subjects']=integrations['getSubjects'](_0x359d14[_0xa47d('0x43')]['channel'],_0x359d14[_0xa47d('0x43')][_0xa47d('0x2b')]);_0x359d14[_0xa47d('0x43')]['Descriptions']=integrations[_0xa47d('0x49')](_0x359d14[_0xa47d('0x43')]['channel'],_0x359d14['body'][_0xa47d('0x2b')]);return db[_0xa47d('0x4a')][_0xa47d('0x42')](_0x359d14['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xa47d('0x4b')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})[_0xa47d('0x22')](respondWithResult(_0x2d00cf,null))[_0xa47d('0x3e')](handleError(_0x2d00cf,null));};exports[_0xa47d('0x4c')]=function(_0x13c811,_0x1532b8,_0x54cc0f){var _0x4f72e0='';var _0x40dc10='';return db[_0xa47d('0x28')]['findOne']({'where':{'id':_0x13c811['params']['id']},'attributes':['id',_0xa47d('0x4d'),_0xa47d('0x4e'),_0xa47d('0x4f')]})[_0xa47d('0x22')](handleEntityNotFound(_0x1532b8,null))['then'](function(_0x179a85){if(_0x179a85){_0x40dc10=_0x179a85[_0xa47d('0x4d')];_0x4f72e0=_0x179a85[_0xa47d('0x4e')];var _0x39eb72=_0x179a85[_0xa47d('0x4e')][_0xa47d('0x50')](-0x1);if(_0x39eb72==='/'){_0x4f72e0=_0x4f72e0['substring'](0x0,_0x4f72e0[_0xa47d('0x51')](_0x39eb72));}return rp({'method':_0xa47d('0x52'),'uri':util['format'](_0xa47d('0x53'),_0x4f72e0,_0xa47d('0x54')),'headers':{'Authorization':_0xa47d('0x55')+_0x179a85[_0xa47d('0x4f')]},'json':!![]});}})[_0xa47d('0x22')](function(_0x2d6f9e){if(_0x2d6f9e){var _0x23f332=_0x2d6f9e[_0xa47d('0x56')];var _0x2553d9=![];var _0x13ff3e=null;for(_0x13ff3e=0x0;_0x13ff3e<_0x23f332[_0xa47d('0x41')];_0x13ff3e++){if(_0x23f332[_0x13ff3e][_0xa47d('0x57')]===_0x40dc10){_0x2553d9=!![];}}if(_0x2553d9){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa47d('0x58')});}}})['then'](respondWithResult(_0x1532b8,null))[_0xa47d('0x3e')](function(_0xb16a84){var _0x25f8c6=_0x13c811[_0xa47d('0x32')][_0xa47d('0x59')]?0x1f4:_0xb16a84[_0xa47d('0x5a')]||0x1f4;logger[_0xa47d('0x5b')]('getFields,\x20%s,\x20%s,\x20%s',_0xa47d('0x4c'),_0x25f8c6,JSON['stringify'](_0xb16a84));delete _0xb16a84[_0xa47d('0x24')];if(_0x25f8c6===0x191){_0x25f8c6=0x190;}_0x1532b8['status'](_0x25f8c6)['send'](_0x13c811['query'][_0xa47d('0x59')]?{'message':_0xa47d('0x5c'),'statusCode':_0xb16a84[_0xa47d('0x5a')]}:_0xb16a84);});}; \ No newline at end of file +var _0x3850=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then','error','name','send','index','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','merge','where','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','order','filter','map','addConfiguration','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x44caf3,_0x26a2fc){var _0x42fa94=function(_0x4a291a){while(--_0x4a291a){_0x44caf3['push'](_0x44caf3['shift']());}};_0x42fa94(++_0x26a2fc);}(_0x3850,0x1e4));var _0x0385=function(_0x48c5e7,_0x365fcb){_0x48c5e7=_0x48c5e7-0x0;var _0x24efad=_0x3850[_0x48c5e7];return _0x24efad;};'use strict';var emlformat=require(_0x0385('0x0'));var rimraf=require(_0x0385('0x1'));var zipdir=require(_0x0385('0x2'));var jsonpatch=require(_0x0385('0x3'));var rp=require('request-promise');var moment=require(_0x0385('0x4'));var BPromise=require(_0x0385('0x5'));var Mustache=require('mustache');var util=require(_0x0385('0x6'));var path=require(_0x0385('0x7'));var sox=require(_0x0385('0x8'));var csv=require(_0x0385('0x9'));var ejs=require(_0x0385('0xa'));var fs=require('fs');var fs_extra=require(_0x0385('0xb'));var _=require(_0x0385('0xc'));var squel=require(_0x0385('0xd'));var crypto=require('crypto');var jsforce=require(_0x0385('0xe'));var deskjs=require(_0x0385('0xf'));var toCsv=require(_0x0385('0x9'));var querystring=require(_0x0385('0x10'));var Papa=require(_0x0385('0x11'));var Redis=require(_0x0385('0x12'));var authService=require(_0x0385('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0385('0x14'));var hardwareService=require(_0x0385('0x15'));var logger=require('../../config/logger')(_0x0385('0x16'));var utils=require('../../config/utils');var config=require(_0x0385('0x17'));var licenseUtil=require(_0x0385('0x18'));var db=require(_0x0385('0x19'))['db'];var integrations=require(_0x0385('0x1a'));function respondWithStatusCode(_0x3248d3,_0x240f8b){_0x240f8b=_0x240f8b||0xcc;return function(_0x2a5c43){if(_0x2a5c43){return _0x3248d3[_0x0385('0x1b')](_0x240f8b);}return _0x3248d3[_0x0385('0x1c')](_0x240f8b)[_0x0385('0x1d')]();};}function respondWithResult(_0x2d1ac5,_0x2a9ce8){_0x2a9ce8=_0x2a9ce8||0xc8;return function(_0x6c289c){if(_0x6c289c){return _0x2d1ac5[_0x0385('0x1c')](_0x2a9ce8)[_0x0385('0x1e')](_0x6c289c);}};}function respondWithFilteredResult(_0x59c381,_0x3719f1){return function(_0x1e7cf8){if(_0x1e7cf8){var _0x9ef78a=typeof _0x3719f1[_0x0385('0x1f')]===_0x0385('0x20')&&typeof _0x3719f1[_0x0385('0x21')]===_0x0385('0x20');var _0x36729d=_0x1e7cf8['count'];var _0x1cf2e9=_0x9ef78a?0x0:_0x3719f1[_0x0385('0x1f')];var _0x3bcce2=_0x9ef78a?_0x1e7cf8[_0x0385('0x22')]:_0x3719f1[_0x0385('0x1f')]+_0x3719f1[_0x0385('0x21')];var _0x45f860;if(_0x3bcce2>=_0x36729d){_0x3bcce2=_0x36729d;_0x45f860=0xc8;}else{_0x45f860=0xce;}_0x59c381[_0x0385('0x1c')](_0x45f860);return _0x59c381[_0x0385('0x23')]('Content-Range',_0x1cf2e9+'-'+_0x3bcce2+'/'+_0x36729d)['json'](_0x1e7cf8);}return null;};}function patchUpdates(_0x3aee95){return function(_0x40ffc7){try{jsonpatch[_0x0385('0x24')](_0x40ffc7,_0x3aee95,!![]);}catch(_0x37ff2f){return BPromise['reject'](_0x37ff2f);}return _0x40ffc7['save']();};}function saveUpdates(_0x37878c,_0x1fd480){return function(_0x36213a){if(_0x36213a){return _0x36213a[_0x0385('0x25')](_0x37878c)['then'](function(_0x3a611f){return _0x3a611f;});}return null;};}function removeEntity(_0x222cc5,_0x9800af){return function(_0x2c46b1){if(_0x2c46b1){return _0x2c46b1[_0x0385('0x26')]()[_0x0385('0x27')](function(){_0x222cc5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15bf77,_0x61a540){return function(_0x4bb5d3){if(!_0x4bb5d3){_0x15bf77[_0x0385('0x1b')](0x194);}return _0x4bb5d3;};}function handleError(_0x41a2d6,_0x1d79d0){_0x1d79d0=_0x1d79d0||0x1f4;return function(_0x3fb74a){logger[_0x0385('0x28')](_0x3fb74a['stack']);if(_0x3fb74a[_0x0385('0x29')]){delete _0x3fb74a[_0x0385('0x29')];}_0x41a2d6[_0x0385('0x1c')](_0x1d79d0)[_0x0385('0x2a')](_0x3fb74a);};}exports[_0x0385('0x2b')]=function(_0xc8c554,_0x14464d){var _0x55f969={},_0x2d8af3={},_0x102afc={'count':0x0,'rows':[]};var _0x35580e=_['map'](db[_0x0385('0x2c')][_0x0385('0x2d')],function(_0xfd9683){return{'name':_0xfd9683[_0x0385('0x2e')],'type':_0xfd9683[_0x0385('0x2f')]['key']};});_0x2d8af3[_0x0385('0x30')]=_['map'](_0x35580e,'name');_0x2d8af3[_0x0385('0x31')]=_[_0x0385('0x32')](_0xc8c554[_0x0385('0x31')]);_0x2d8af3['filters']=_[_0x0385('0x33')](_0x2d8af3[_0x0385('0x30')],_0x2d8af3['query']);_0x55f969[_0x0385('0x34')]=_['intersection'](_0x2d8af3[_0x0385('0x30')],qs['fields'](_0xc8c554[_0x0385('0x31')][_0x0385('0x35')]));_0x55f969[_0x0385('0x34')]=_0x55f969[_0x0385('0x34')][_0x0385('0x36')]?_0x55f969['attributes']:_0x2d8af3[_0x0385('0x30')];if(!_0xc8c554[_0x0385('0x31')][_0x0385('0x37')]('nolimit')){_0x55f969[_0x0385('0x21')]=qs[_0x0385('0x21')](_0xc8c554[_0x0385('0x31')][_0x0385('0x21')]);_0x55f969[_0x0385('0x1f')]=qs[_0x0385('0x1f')](_0xc8c554[_0x0385('0x31')][_0x0385('0x1f')]);}_0x55f969['order']=qs[_0x0385('0x38')](_0xc8c554[_0x0385('0x31')][_0x0385('0x38')]);_0x55f969['where']=qs[_0x0385('0x39')](_[_0x0385('0x3a')](_0xc8c554[_0x0385('0x31')],_0x2d8af3[_0x0385('0x39')]),_0x35580e);if(_0xc8c554[_0x0385('0x31')]['filter']){_0x55f969['where']=_[_0x0385('0x3b')](_0x55f969[_0x0385('0x3c')],{'$or':_['map'](_0x35580e,function(_0x52317d){if(_0x52317d[_0x0385('0x2f')]!==_0x0385('0x3d')){var _0x454d7f={};_0x454d7f[_0x52317d[_0x0385('0x29')]]={'$like':'%'+_0xc8c554['query']['filter']+'%'};return _0x454d7f;}})});}_0x55f969=_[_0x0385('0x3b')]({},_0x55f969,_0xc8c554[_0x0385('0x3e')]);var _0x34d760={'where':_0x55f969[_0x0385('0x3c')]};return db[_0x0385('0x2c')][_0x0385('0x22')](_0x34d760)[_0x0385('0x27')](function(_0x5dae71){_0x102afc[_0x0385('0x22')]=_0x5dae71;if(_0xc8c554[_0x0385('0x31')]['includeAll']){_0x55f969[_0x0385('0x3f')]=[{'all':!![]}];}return db[_0x0385('0x2c')]['findAll'](_0x55f969);})[_0x0385('0x27')](function(_0x55e0ab){_0x102afc[_0x0385('0x40')]=_0x55e0ab;return _0x102afc;})[_0x0385('0x27')](respondWithFilteredResult(_0x14464d,_0x55f969))[_0x0385('0x41')](handleError(_0x14464d,null));};exports[_0x0385('0x42')]=function(_0x6d136a,_0x268aca){var _0x1cbbc7={'raw':![],'where':{'id':_0x6d136a[_0x0385('0x43')]['id']}},_0x49d54b={};_0x49d54b['model']=_['keys'](db['FreshsalesAccount'][_0x0385('0x2d')]);_0x49d54b[_0x0385('0x31')]=_[_0x0385('0x32')](_0x6d136a[_0x0385('0x31')]);_0x49d54b['filters']=_[_0x0385('0x33')](_0x49d54b[_0x0385('0x30')],_0x49d54b[_0x0385('0x31')]);_0x1cbbc7[_0x0385('0x34')]=_[_0x0385('0x33')](_0x49d54b[_0x0385('0x30')],qs[_0x0385('0x35')](_0x6d136a[_0x0385('0x31')][_0x0385('0x35')]));_0x1cbbc7[_0x0385('0x34')]=_0x1cbbc7[_0x0385('0x34')]['length']?_0x1cbbc7[_0x0385('0x34')]:_0x49d54b[_0x0385('0x30')];if(_0x6d136a[_0x0385('0x31')][_0x0385('0x44')]){_0x1cbbc7['include']=[{'all':!![]}];}_0x1cbbc7=_['merge']({},_0x1cbbc7,_0x6d136a[_0x0385('0x3e')]);return db[_0x0385('0x2c')][_0x0385('0x45')](_0x1cbbc7)[_0x0385('0x27')](handleEntityNotFound(_0x268aca,null))[_0x0385('0x27')](respondWithResult(_0x268aca,null))[_0x0385('0x41')](handleError(_0x268aca,null));};exports['create']=function(_0x2d2a64,_0x50a16d){return db['FreshsalesAccount'][_0x0385('0x46')](_0x2d2a64['body'],{})[_0x0385('0x27')](respondWithResult(_0x50a16d,0xc9))[_0x0385('0x41')](handleError(_0x50a16d,null));};exports['update']=function(_0x5c6021,_0x283ffb){if(_0x5c6021[_0x0385('0x47')]['id']){delete _0x5c6021[_0x0385('0x47')]['id'];}return db[_0x0385('0x2c')][_0x0385('0x45')]({'where':{'id':_0x5c6021[_0x0385('0x43')]['id']}})[_0x0385('0x27')](handleEntityNotFound(_0x283ffb,null))[_0x0385('0x27')](saveUpdates(_0x5c6021[_0x0385('0x47')],null))[_0x0385('0x27')](respondWithResult(_0x283ffb,null))[_0x0385('0x41')](handleError(_0x283ffb,null));};exports[_0x0385('0x26')]=function(_0x2231bd,_0x22a7c6){return db[_0x0385('0x2c')][_0x0385('0x45')]({'where':{'id':_0x2231bd[_0x0385('0x43')]['id']}})[_0x0385('0x27')](handleEntityNotFound(_0x22a7c6,null))['then'](removeEntity(_0x22a7c6,null))[_0x0385('0x41')](handleError(_0x22a7c6,null));};exports[_0x0385('0x48')]=function(_0x5decc8,_0x3467a2,_0x48f8d2){var _0x127f7f={};var _0x4f364b={};var _0x1193fa;var _0x1f40d3;return db[_0x0385('0x2c')][_0x0385('0x49')]({'where':{'id':_0x5decc8['params']['id']}})[_0x0385('0x27')](handleEntityNotFound(_0x3467a2,null))[_0x0385('0x27')](function(_0x2e6f06){if(_0x2e6f06){_0x1193fa=_0x2e6f06;_0x4f364b[_0x0385('0x30')]=_[_0x0385('0x32')](db['FreshsalesConfiguration'][_0x0385('0x2d')]);_0x4f364b[_0x0385('0x31')]=_[_0x0385('0x32')](_0x5decc8['query']);_0x4f364b[_0x0385('0x39')]=_[_0x0385('0x33')](_0x4f364b[_0x0385('0x30')],_0x4f364b[_0x0385('0x31')]);_0x127f7f[_0x0385('0x34')]=_['intersection'](_0x4f364b[_0x0385('0x30')],qs[_0x0385('0x35')](_0x5decc8['query'][_0x0385('0x35')]));_0x127f7f[_0x0385('0x34')]=_0x127f7f['attributes']['length']?_0x127f7f[_0x0385('0x34')]:_0x4f364b['model'];_0x127f7f[_0x0385('0x4a')]=qs['sort'](_0x5decc8[_0x0385('0x31')][_0x0385('0x38')]);_0x127f7f[_0x0385('0x3c')]=qs['filters'](_[_0x0385('0x3a')](_0x5decc8[_0x0385('0x31')],_0x4f364b[_0x0385('0x39')]));if(_0x5decc8[_0x0385('0x31')][_0x0385('0x4b')]){_0x127f7f['where']=_[_0x0385('0x3b')](_0x127f7f[_0x0385('0x3c')],{'$or':_[_0x0385('0x4c')](_0x127f7f[_0x0385('0x34')],function(_0x1ee2fd){var _0x3ff362={};_0x3ff362[_0x1ee2fd]={'$like':'%'+_0x5decc8[_0x0385('0x31')][_0x0385('0x4b')]+'%'};return _0x3ff362;})});}_0x127f7f=_[_0x0385('0x3b')]({},_0x127f7f,_0x5decc8[_0x0385('0x3e')]);return _0x1193fa[_0x0385('0x48')](_0x127f7f);}})['then'](function(_0x2f370b){if(_0x2f370b){_0x1f40d3=_0x2f370b[_0x0385('0x36')];if(!_0x5decc8[_0x0385('0x31')]['hasOwnProperty']('nolimit')){_0x127f7f[_0x0385('0x21')]=qs['limit'](_0x5decc8[_0x0385('0x31')][_0x0385('0x21')]);_0x127f7f['offset']=qs['offset'](_0x5decc8[_0x0385('0x31')][_0x0385('0x1f')]);}return _0x1193fa['getConfigurations'](_0x127f7f);}})[_0x0385('0x27')](function(_0x2e872d){if(_0x2e872d){return _0x2e872d?{'count':_0x1f40d3,'rows':_0x2e872d}:null;}})[_0x0385('0x27')](respondWithResult(_0x3467a2,null))['catch'](handleError(_0x3467a2,null));};exports[_0x0385('0x4d')]=function(_0x336ff3,_0x5a5b6f,_0xe0361e){if(_0x336ff3[_0x0385('0x47')]['id']){delete _0x336ff3['body']['id'];}return db['FreshsalesAccount'][_0x0385('0x49')]({'where':{'id':_0x336ff3[_0x0385('0x43')]['id']}})['then'](handleEntityNotFound(_0x5a5b6f,null))[_0x0385('0x27')](function(_0x2e9b40){if(_0x2e9b40){_0x336ff3[_0x0385('0x47')]['AccountId']=_0x2e9b40['id'];_0x336ff3[_0x0385('0x47')]['Subjects']=integrations[_0x0385('0x4e')](_0x336ff3[_0x0385('0x47')][_0x0385('0x4f')],_0x336ff3[_0x0385('0x47')][_0x0385('0x2f')]);_0x336ff3[_0x0385('0x47')][_0x0385('0x50')]=integrations['getDescriptions'](_0x336ff3[_0x0385('0x47')][_0x0385('0x4f')],_0x336ff3['body']['type']);return db[_0x0385('0x51')][_0x0385('0x46')](_0x336ff3[_0x0385('0x47')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x0385('0x52')],'as':_0x0385('0x50')}]});}return null;})[_0x0385('0x27')](respondWithResult(_0x5a5b6f,null))[_0x0385('0x41')](handleError(_0x5a5b6f,null));};exports[_0x0385('0x53')]=function(_0x5cc536,_0x232953,_0x11f3af){var _0x10a3bb='';var _0x55e97='';return db[_0x0385('0x2c')][_0x0385('0x49')]({'where':{'id':_0x5cc536[_0x0385('0x43')]['id']},'attributes':['id',_0x0385('0x54'),_0x0385('0x55'),_0x0385('0x56')]})[_0x0385('0x27')](handleEntityNotFound(_0x232953,null))['then'](function(_0x2912c1){if(_0x2912c1){_0x55e97=_0x2912c1[_0x0385('0x54')];_0x10a3bb=_0x2912c1[_0x0385('0x55')];var _0x372c35=_0x2912c1['remoteUri'][_0x0385('0x57')](-0x1);if(_0x372c35==='/'){_0x10a3bb=_0x10a3bb['substring'](0x0,_0x10a3bb[_0x0385('0x58')](_0x372c35));}return rp({'method':_0x0385('0x59'),'uri':util['format'](_0x0385('0x5a'),_0x10a3bb,_0x0385('0x5b')),'headers':{'Authorization':_0x0385('0x5c')+_0x2912c1[_0x0385('0x56')]},'json':!![]});}})[_0x0385('0x27')](function(_0x5d03e4){if(_0x5d03e4){var _0x1ed384=_0x5d03e4[_0x0385('0x5d')];var _0x2355e1=![];var _0x4899eb=null;for(_0x4899eb=0x0;_0x4899eb<_0x1ed384['length'];_0x4899eb++){if(_0x1ed384[_0x4899eb][_0x0385('0x5e')]===_0x55e97){_0x2355e1=!![];}}if(_0x2355e1){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0385('0x5f')});}}})[_0x0385('0x27')](respondWithResult(_0x232953,null))[_0x0385('0x41')](function(_0x176b19){var _0x1ca758=_0x5cc536[_0x0385('0x31')][_0x0385('0x60')]?0x1f4:_0x176b19['statusCode']||0x1f4;logger[_0x0385('0x28')](_0x0385('0x61'),_0x0385('0x53'),_0x1ca758,JSON[_0x0385('0x62')](_0x176b19));delete _0x176b19[_0x0385('0x29')];if(_0x1ca758===0x191){_0x1ca758=0x190;}_0x232953[_0x0385('0x1c')](_0x1ca758)[_0x0385('0x2a')](_0x5cc536[_0x0385('0x31')][_0x0385('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x176b19['statusCode']}:_0x176b19);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ae3b832..813d051 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 _0xd046=['rimraf','./intFreshsalesAccount.attributes','int_freshsales_accounts','util','../../config/logger','api','bluebird'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0xd046,0x129));var _0x6d04=function(_0x3220bf,_0x26044a){_0x3220bf=_0x3220bf-0x0;var _0x58eac3=_0xd046[_0x3220bf];return _0x58eac3;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xf3b4e7,_0x1968c4){return _0xf3b4e7['define']('FreshsalesAccount',attributes,{'tableName':_0x6d04('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0120=['../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1cb58c,_0x25f078){var _0x442dda=function(_0x45919d){while(--_0x45919d){_0x1cb58c['push'](_0x1cb58c['shift']());}};_0x442dda(++_0x25f078);}(_0x0120,0x6f));var _0x0012=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x0120[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var logger=require(_0x0012('0x2'))(_0x0012('0x3'));var moment=require(_0x0012('0x4'));var BPromise=require(_0x0012('0x5'));var rp=require(_0x0012('0x6'));var fs=require('fs');var path=require(_0x0012('0x7'));var rimraf=require(_0x0012('0x8'));var config=require(_0x0012('0x9'));var attributes=require(_0x0012('0xa'));var integrations=require(_0x0012('0xb'));module['exports']=function(_0x4b396c,_0x59980a){return _0x4b396c[_0x0012('0xc')](_0x0012('0xd'),attributes,{'tableName':_0x0012('0xe'),'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 1fcd388..768a6c0 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 _0x0adf=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','findAll','options','where','attributes','limit','include','map','model','GetFreshsalesAccount','find','raw','ShowFreshsalesAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent'];(function(_0x48dbf2,_0x39e8c1){var _0x12d880=function(_0x91c972){while(--_0x91c972){_0x48dbf2['push'](_0x48dbf2['shift']());}};_0x12d880(++_0x39e8c1);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x46299d,_0x177a21){_0x46299d=_0x46299d-0x0;var _0x3f1d5f=_0x0adf[_0x46299d];return _0x3f1d5f;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0ad('0x3'));var fs=require('fs');var Redis=require(_0xf0ad('0x4'));var db=require(_0xf0ad('0x5'))['db'];var utils=require(_0xf0ad('0x6'));var logger=require(_0xf0ad('0x7'))(_0xf0ad('0x8'));var config=require(_0xf0ad('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf0ad('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eca0e,_0x44cf37,_0x170574){return new BPromise(function(_0x41c99d,_0xa9a315){return client[_0xf0ad('0xb')](_0x2eca0e,_0x170574)[_0xf0ad('0xc')](function(_0x5bdf69){logger[_0xf0ad('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0xf0ad('0xe'));logger[_0xf0ad('0xf')](_0xf0ad('0x10'),_0x44cf37,_0xf0ad('0xe'),JSON[_0xf0ad('0x11')](_0x5bdf69));if(_0x5bdf69['error']){if(_0x5bdf69['error'][_0xf0ad('0x12')]===0x1f4){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x5bdf69[_0xf0ad('0x13')]['message']);return _0xa9a315(_0x5bdf69[_0xf0ad('0x13')][_0xf0ad('0x15')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x44cf37,_0x5bdf69['error'][_0xf0ad('0x15')]);return _0x41c99d(_0x5bdf69['error'][_0xf0ad('0x15')]);}else{logger[_0xf0ad('0xd')](_0xf0ad('0x14'),_0x44cf37,_0xf0ad('0xe'));_0x41c99d(_0x5bdf69[_0xf0ad('0x16')]['message']);}})[_0xf0ad('0x17')](function(_0x285ab0){logger[_0xf0ad('0x13')](_0xf0ad('0x14'),_0x44cf37,_0x285ab0);_0xa9a315(_0x285ab0);});});}exports['GetFreshsalesAccount']=function(_0x4e9970){var _0x2466e8=this;return new Promise(function(_0x46fb20,_0x49f2ec){return db[_0xf0ad('0x18')][_0xf0ad('0x19')]({'raw':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4e9970['options']?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1b')]||null:null,'attributes':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'limit':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970['options'][_0xf0ad('0x1d')]||null:null,'include':_0x4e9970[_0xf0ad('0x1a')]?_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4e9970[_0xf0ad('0x1a')][_0xf0ad('0x1e')],function(_0x276322){return{'model':db[_0x276322[_0xf0ad('0x20')]],'as':_0x276322['as'],'attributes':_0x276322[_0xf0ad('0x1c')],'include':_0x276322[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x276322[_0xf0ad('0x1e')],function(_0x456f81){return{'model':db[_0x456f81[_0xf0ad('0x20')]],'as':_0x456f81['as'],'attributes':_0x456f81['attributes'],'include':_0x456f81[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x456f81[_0xf0ad('0x1e')],function(_0x7377d7){return{'model':db[_0x7377d7[_0xf0ad('0x20')]],'as':_0x7377d7['as'],'attributes':_0x7377d7[_0xf0ad('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cbe00){logger[_0xf0ad('0xd')](_0xf0ad('0x21'),_0x4e9970);logger[_0xf0ad('0xf')](_0xf0ad('0x21'),_0x4e9970,JSON[_0xf0ad('0x11')](_0x2cbe00));_0x46fb20(_0x2cbe00);})[_0xf0ad('0x17')](function(_0x1bee71){logger[_0xf0ad('0x13')](_0xf0ad('0x21'),_0x1bee71[_0xf0ad('0x15')],_0x4e9970);_0x49f2ec(_0x2466e8['error'](0x1f4,_0x1bee71[_0xf0ad('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x83f211){var _0x57a1f3=this;return new Promise(function(_0x25ed0b,_0x320174){return db[_0xf0ad('0x18')][_0xf0ad('0x22')]({'raw':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x23')]===undefined?!![]:![]:!![],'where':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options']['where']||null:null,'attributes':_0x83f211[_0xf0ad('0x1a')]?_0x83f211[_0xf0ad('0x1a')][_0xf0ad('0x1c')]||null:null,'include':_0x83f211[_0xf0ad('0x1a')]?_0x83f211['options'][_0xf0ad('0x1e')]?_['map'](_0x83f211[_0xf0ad('0x1a')]['include'],function(_0x4136b9){return{'model':db[_0x4136b9['model']],'as':_0x4136b9['as'],'attributes':_0x4136b9[_0xf0ad('0x1c')],'include':_0x4136b9[_0xf0ad('0x1e')]?_[_0xf0ad('0x1f')](_0x4136b9[_0xf0ad('0x1e')],function(_0x42f87f){return{'model':db[_0x42f87f[_0xf0ad('0x20')]],'as':_0x42f87f['as'],'attributes':_0x42f87f[_0xf0ad('0x1c')],'include':_0x42f87f[_0xf0ad('0x1e')]?_['map'](_0x42f87f[_0xf0ad('0x1e')],function(_0x54b59d){return{'model':db[_0x54b59d[_0xf0ad('0x20')]],'as':_0x54b59d['as'],'attributes':_0x54b59d['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0ad('0xc')](function(_0x25246b){logger[_0xf0ad('0xd')](_0xf0ad('0x24'),_0x83f211);logger[_0xf0ad('0xf')]('ShowFreshsalesAccount',_0x83f211,JSON[_0xf0ad('0x11')](_0x25246b));_0x25ed0b(_0x25246b);})[_0xf0ad('0x17')](function(_0x1d57d1){logger[_0xf0ad('0x13')](_0xf0ad('0x24'),_0x1d57d1[_0xf0ad('0x15')],_0x83f211);_0x320174(_0x57a1f3[_0xf0ad('0x13')](0x1f4,_0x1d57d1['message']));});});}; \ No newline at end of file +var _0x7b84=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','where','attributes','limit','map','model','include','GetFreshsalesAccount','ShowFreshsalesAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x7b84,0x17c));var _0x47b8=function(_0x28da14,_0x42e6cd){_0x28da14=_0x28da14-0x0;var _0x56d23d=_0x7b84[_0x28da14];return _0x56d23d;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});}exports['GetFreshsalesAccount']=function(_0x4f7317){var _0x299195=this;return new Promise(function(_0x36faf1,_0x2797ac){return db['FreshsalesAccount']['findAll']({'raw':_0x4f7317['options']?_0x4f7317[_0x47b8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1b')]||null:null,'attributes':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317['options'][_0x47b8('0x1c')]||null:null,'limit':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')][_0x47b8('0x1d')]||null:null,'include':_0x4f7317[_0x47b8('0x1a')]?_0x4f7317[_0x47b8('0x1a')]['include']?_[_0x47b8('0x1e')](_0x4f7317[_0x47b8('0x1a')]['include'],function(_0x22e7dd){return{'model':db[_0x22e7dd[_0x47b8('0x1f')]],'as':_0x22e7dd['as'],'attributes':_0x22e7dd[_0x47b8('0x1c')],'include':_0x22e7dd[_0x47b8('0x20')]?_['map'](_0x22e7dd[_0x47b8('0x20')],function(_0x332c23){return{'model':db[_0x332c23[_0x47b8('0x1f')]],'as':_0x332c23['as'],'attributes':_0x332c23[_0x47b8('0x1c')],'include':_0x332c23[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x332c23[_0x47b8('0x20')],function(_0x568c1e){return{'model':db[_0x568c1e[_0x47b8('0x1f')]],'as':_0x568c1e['as'],'attributes':_0x568c1e[_0x47b8('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x195a66){logger[_0x47b8('0xf')](_0x47b8('0x21'),_0x4f7317);logger[_0x47b8('0x12')]('GetFreshsalesAccount',_0x4f7317,JSON[_0x47b8('0x14')](_0x195a66));_0x36faf1(_0x195a66);})['catch'](function(_0x2c89fc){logger[_0x47b8('0x15')](_0x47b8('0x21'),_0x2c89fc[_0x47b8('0x17')],_0x4f7317);_0x2797ac(_0x299195['error'](0x1f4,_0x2c89fc[_0x47b8('0x17')]));});});};exports[_0x47b8('0x22')]=function(_0x402e7c){var _0x1b6c0a=this;return new Promise(function(_0x132f37,_0x197cb5){return db['FreshsalesAccount']['find']({'raw':_0x402e7c['options']?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x23')]===undefined?!![]:![]:!![],'where':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c['options']['where']||null:null,'attributes':_0x402e7c['options']?_0x402e7c['options'][_0x47b8('0x1c')]||null:null,'include':_0x402e7c[_0x47b8('0x1a')]?_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x402e7c[_0x47b8('0x1a')][_0x47b8('0x20')],function(_0x460dcc){return{'model':db[_0x460dcc[_0x47b8('0x1f')]],'as':_0x460dcc['as'],'attributes':_0x460dcc['attributes'],'include':_0x460dcc['include']?_[_0x47b8('0x1e')](_0x460dcc[_0x47b8('0x20')],function(_0x531dd2){return{'model':db[_0x531dd2['model']],'as':_0x531dd2['as'],'attributes':_0x531dd2[_0x47b8('0x1c')],'include':_0x531dd2[_0x47b8('0x20')]?_[_0x47b8('0x1e')](_0x531dd2['include'],function(_0x240ab6){return{'model':db[_0x240ab6[_0x47b8('0x1f')]],'as':_0x240ab6['as'],'attributes':_0x240ab6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f1892){logger['info'](_0x47b8('0x22'),_0x402e7c);logger[_0x47b8('0x12')](_0x47b8('0x22'),_0x402e7c,JSON[_0x47b8('0x14')](_0x4f1892));_0x132f37(_0x4f1892);})[_0x47b8('0x19')](function(_0x3c24c1){logger['error']('ShowFreshsalesAccount',_0x3c24c1[_0x47b8('0x17')],_0x402e7c);_0x197cb5(_0x1b6c0a[_0x47b8('0x15')](0x1f4,_0x3c24c1[_0x47b8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 9db71bc..65b1b89 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 _0x7243=['Router','fs-extra','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getDescriptions','getFields','create','update','destroy','multer','util','connect-timeout'];(function(_0x594b48,_0x1e591f){var _0x2875a9=function(_0x3fcde9){while(--_0x3fcde9){_0x594b48['push'](_0x594b48['shift']());}};_0x2875a9(++_0x1e591f);}(_0x7243,0x195));var _0x3724=function(_0x19a481,_0x5b42af){_0x19a481=_0x19a481-0x0;var _0x1f0fa6=_0x7243[_0x19a481];return _0x1f0fa6;};'use strict';var multer=require(_0x3724('0x0'));var util=require(_0x3724('0x1'));var path=require('path');var timeout=require(_0x3724('0x2'));var express=require('express');var router=express[_0x3724('0x3')]();var fs_extra=require(_0x3724('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3724('0x5'));router[_0x3724('0x6')]('/',auth['isAuthenticated'](),controller[_0x3724('0x7')]);router[_0x3724('0x6')](_0x3724('0x8'),auth[_0x3724('0x9')](),controller[_0x3724('0xa')]);router[_0x3724('0x6')](_0x3724('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3724('0x6')]('/:id/descriptions',auth[_0x3724('0x9')](),controller[_0x3724('0xc')]);router['get']('/:id/fields',auth[_0x3724('0x9')](),controller[_0x3724('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3724('0xe')]);router['put'](_0x3724('0x8'),auth[_0x3724('0x9')](),controller[_0x3724('0xf')]);router['delete'](_0x3724('0x8'),auth[_0x3724('0x9')](),controller[_0x3724('0x10')]);module['exports']=router; \ No newline at end of file +var _0x753a=['getFields','post','create','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','/:id','show','get','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','/:id/fields'];(function(_0x2da11d,_0x1c3a1d){var _0x509abc=function(_0x1f2ef9){while(--_0x1f2ef9){_0x2da11d['push'](_0x2da11d['shift']());}};_0x509abc(++_0x1c3a1d);}(_0x753a,0x1ce));var _0xa753=function(_0x28977e,_0x1a480e){_0x28977e=_0x28977e-0x0;var _0x43b7e8=_0x753a[_0x28977e];return _0x43b7e8;};'use strict';var multer=require('multer');var util=require(_0xa753('0x0'));var path=require(_0xa753('0x1'));var timeout=require('connect-timeout');var express=require(_0xa753('0x2'));var router=express[_0xa753('0x3')]();var fs_extra=require(_0xa753('0x4'));var auth=require(_0xa753('0x5'));var interaction=require(_0xa753('0x6'));var config=require(_0xa753('0x7'));var controller=require(_0xa753('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa753('0x9')]);router['get'](_0xa753('0xa'),auth['isAuthenticated'](),controller[_0xa753('0xb')]);router[_0xa753('0xc')]('/:id/subjects',auth[_0xa753('0xd')](),controller[_0xa753('0xe')]);router[_0xa753('0xc')](_0xa753('0xf'),auth[_0xa753('0xd')](),controller[_0xa753('0x10')]);router[_0xa753('0xc')](_0xa753('0x11'),auth[_0xa753('0xd')](),controller[_0xa753('0x12')]);router[_0xa753('0x13')]('/',auth[_0xa753('0xd')](),controller[_0xa753('0x14')]);router['put']('/:id',auth[_0xa753('0xd')](),controller[_0xa753('0x15')]);router['delete'](_0xa753('0xa'),auth[_0xa753('0xd')](),controller[_0xa753('0x16')]);module[_0xa753('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1d603a2..73cf81e 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 _0xa689=['sequelize','exports','STRING'];(function(_0x1f2f89,_0x49fe3b){var _0x1725f7=function(_0x3a666){while(--_0x3a666){_0x1f2f89['push'](_0x1f2f89['shift']());}};_0x1725f7(++_0x49fe3b);}(_0xa689,0x159));var _0x9a68=function(_0x51ab33,_0x71a8a8){_0x51ab33=_0x51ab33-0x0;var _0x5e1298=_0xa689[_0x51ab33];return _0x5e1298;};'use strict';var Sequelize=require(_0x9a68('0x0'));module[_0x9a68('0x1')]={'name':{'type':Sequelize[_0x9a68('0x2')]},'description':{'type':Sequelize[_0x9a68('0x2')]}}; \ No newline at end of file +var _0x45c0=['STRING'];(function(_0x47a40b,_0x443ecf){var _0x19610c=function(_0x4b8ce1){while(--_0x4b8ce1){_0x47a40b['push'](_0x47a40b['shift']());}};_0x19610c(++_0x443ecf);}(_0x45c0,0xd3));var _0x045c=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x45c0[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x045c('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 8182868..e06454e 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 _0xc99b=['options','find','catch','create','body','getSubjects','findOne','FreshsalesField','rawAttributes','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','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','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','index','map','FreshsalesConfiguration','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','params','intersection'];(function(_0x485cae,_0x61daab){var _0x5c41f1=function(_0x198a9a){while(--_0x198a9a){_0x485cae['push'](_0x485cae['shift']());}};_0x5c41f1(++_0x61daab);}(_0xc99b,0x19b));var _0xbc99=function(_0x437472,_0x31db2d){_0x437472=_0x437472-0x0;var _0x217fce=_0xc99b[_0x437472];return _0x217fce;};'use strict';var emlformat=require(_0xbc99('0x0'));var rimraf=require(_0xbc99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc99('0x2'));var rp=require(_0xbc99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc99('0x4'));var path=require(_0xbc99('0x5'));var sox=require(_0xbc99('0x6'));var csv=require(_0xbc99('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc99('0x8'));var _=require(_0xbc99('0x9'));var squel=require(_0xbc99('0xa'));var crypto=require(_0xbc99('0xb'));var jsforce=require(_0xbc99('0xc'));var deskjs=require(_0xbc99('0xd'));var toCsv=require(_0xbc99('0x7'));var querystring=require(_0xbc99('0xe'));var Papa=require(_0xbc99('0xf'));var Redis=require(_0xbc99('0x10'));var authService=require(_0xbc99('0x11'));var qs=require(_0xbc99('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc99('0x13'));var logger=require(_0xbc99('0x14'))(_0xbc99('0x15'));var utils=require(_0xbc99('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbc99('0x17'));var db=require(_0xbc99('0x18'))['db'];function respondWithStatusCode(_0x2e2e1a,_0x2dfd1b){_0x2dfd1b=_0x2dfd1b||0xcc;return function(_0x12f083){if(_0x12f083){return _0x2e2e1a['sendStatus'](_0x2dfd1b);}return _0x2e2e1a[_0xbc99('0x19')](_0x2dfd1b)['end']();};}function respondWithResult(_0x57c152,_0x3e1589){_0x3e1589=_0x3e1589||0xc8;return function(_0x7f4b6d){if(_0x7f4b6d){return _0x57c152[_0xbc99('0x19')](_0x3e1589)[_0xbc99('0x1a')](_0x7f4b6d);}};}function respondWithFilteredResult(_0x5b1921,_0x1dc15a){return function(_0x3d1c19){if(_0x3d1c19){var _0x3c682b=typeof _0x1dc15a[_0xbc99('0x1b')]===_0xbc99('0x1c')&&typeof _0x1dc15a[_0xbc99('0x1d')]===_0xbc99('0x1c');var _0x527daa=_0x3d1c19[_0xbc99('0x1e')];var _0x244807=_0x3c682b?0x0:_0x1dc15a[_0xbc99('0x1b')];var _0x19fcf3=_0x3c682b?_0x3d1c19[_0xbc99('0x1e')]:_0x1dc15a['offset']+_0x1dc15a[_0xbc99('0x1d')];var _0x31e9e0;if(_0x19fcf3>=_0x527daa){_0x19fcf3=_0x527daa;_0x31e9e0=0xc8;}else{_0x31e9e0=0xce;}_0x5b1921[_0xbc99('0x19')](_0x31e9e0);return _0x5b1921['set']('Content-Range',_0x244807+'-'+_0x19fcf3+'/'+_0x527daa)[_0xbc99('0x1a')](_0x3d1c19);}return null;};}function patchUpdates(_0x3f2323){return function(_0x39c41f){try{jsonpatch[_0xbc99('0x1f')](_0x39c41f,_0x3f2323,!![]);}catch(_0x46a610){return BPromise[_0xbc99('0x20')](_0x46a610);}return _0x39c41f[_0xbc99('0x21')]();};}function saveUpdates(_0x4873b4,_0x217741){return function(_0x1c5213){if(_0x1c5213){return _0x1c5213[_0xbc99('0x22')](_0x4873b4)['then'](function(_0x3facfd){return _0x3facfd;});}return null;};}function removeEntity(_0x24e383,_0x299e09){return function(_0x8dca5c){if(_0x8dca5c){return _0x8dca5c[_0xbc99('0x23')]()[_0xbc99('0x24')](function(){_0x24e383[_0xbc99('0x19')](0xcc)[_0xbc99('0x25')]();});}};}function handleEntityNotFound(_0x1dfe37,_0x15e9c3){return function(_0x54d0d6){if(!_0x54d0d6){_0x1dfe37[_0xbc99('0x26')](0x194);}return _0x54d0d6;};}function handleError(_0x19c91b,_0x135ece){_0x135ece=_0x135ece||0x1f4;return function(_0x411a37){logger[_0xbc99('0x27')](_0x411a37[_0xbc99('0x28')]);if(_0x411a37[_0xbc99('0x29')]){delete _0x411a37[_0xbc99('0x29')];}_0x19c91b['status'](_0x135ece)['send'](_0x411a37);};}exports[_0xbc99('0x2a')]=function(_0x9c58d3,_0x148457){var _0x37dea3={},_0x503e04={},_0x24e125={'count':0x0,'rows':[]};var _0x5ef9d9=_[_0xbc99('0x2b')](db[_0xbc99('0x2c')]['rawAttributes'],function(_0x40376d){return{'name':_0x40376d[_0xbc99('0x2d')],'type':_0x40376d['type']['key']};});_0x503e04[_0xbc99('0x2e')]=_['map'](_0x5ef9d9,'name');_0x503e04[_0xbc99('0x2f')]=_[_0xbc99('0x30')](_0x9c58d3[_0xbc99('0x2f')]);_0x503e04[_0xbc99('0x31')]=_['intersection'](_0x503e04[_0xbc99('0x2e')],_0x503e04[_0xbc99('0x2f')]);_0x37dea3['attributes']=_['intersection'](_0x503e04[_0xbc99('0x2e')],qs[_0xbc99('0x32')](_0x9c58d3['query'][_0xbc99('0x32')]));_0x37dea3['attributes']=_0x37dea3[_0xbc99('0x33')][_0xbc99('0x34')]?_0x37dea3[_0xbc99('0x33')]:_0x503e04[_0xbc99('0x2e')];if(!_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x35')](_0xbc99('0x36'))){_0x37dea3[_0xbc99('0x1d')]=qs[_0xbc99('0x1d')](_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x1d')]);_0x37dea3['offset']=qs[_0xbc99('0x1b')](_0x9c58d3['query'][_0xbc99('0x1b')]);}_0x37dea3[_0xbc99('0x37')]=qs['sort'](_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x38')]);_0x37dea3[_0xbc99('0x39')]=qs['filters'](_[_0xbc99('0x3a')](_0x9c58d3[_0xbc99('0x2f')],_0x503e04['filters']),_0x5ef9d9);if(_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x3b')]){_0x37dea3[_0xbc99('0x39')]=_['merge'](_0x37dea3[_0xbc99('0x39')],{'$or':_['map'](_0x5ef9d9,function(_0x41a430){if(_0x41a430[_0xbc99('0x3c')]!==_0xbc99('0x3d')){var _0x3fff19={};_0x3fff19[_0x41a430[_0xbc99('0x29')]]={'$like':'%'+_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x3b')]+'%'};return _0x3fff19;}})});}_0x37dea3=_[_0xbc99('0x3e')]({},_0x37dea3,_0x9c58d3['options']);var _0x33a56b={'where':_0x37dea3[_0xbc99('0x39')]};return db[_0xbc99('0x2c')]['count'](_0x33a56b)[_0xbc99('0x24')](function(_0x4ccf44){_0x24e125[_0xbc99('0x1e')]=_0x4ccf44;if(_0x9c58d3[_0xbc99('0x2f')][_0xbc99('0x3f')]){_0x37dea3[_0xbc99('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xbc99('0x41')](_0x37dea3);})[_0xbc99('0x24')](function(_0x4f94f8){_0x24e125['rows']=_0x4f94f8;return _0x24e125;})['then'](respondWithFilteredResult(_0x148457,_0x37dea3))['catch'](handleError(_0x148457,null));};exports[_0xbc99('0x42')]=function(_0x2aaf20,_0x4b6579){var _0x1fe6bf={'raw':![],'where':{'id':_0x2aaf20[_0xbc99('0x43')]['id']}},_0x412c96={};_0x412c96[_0xbc99('0x2e')]=_[_0xbc99('0x30')](db[_0xbc99('0x2c')]['rawAttributes']);_0x412c96[_0xbc99('0x2f')]=_[_0xbc99('0x30')](_0x2aaf20['query']);_0x412c96['filters']=_[_0xbc99('0x44')](_0x412c96[_0xbc99('0x2e')],_0x412c96['query']);_0x1fe6bf[_0xbc99('0x33')]=_[_0xbc99('0x44')](_0x412c96['model'],qs[_0xbc99('0x32')](_0x2aaf20[_0xbc99('0x2f')][_0xbc99('0x32')]));_0x1fe6bf[_0xbc99('0x33')]=_0x1fe6bf[_0xbc99('0x33')]['length']?_0x1fe6bf[_0xbc99('0x33')]:_0x412c96[_0xbc99('0x2e')];if(_0x2aaf20[_0xbc99('0x2f')]['includeAll']){_0x1fe6bf[_0xbc99('0x40')]=[{'all':!![]}];}_0x1fe6bf=_['merge']({},_0x1fe6bf,_0x2aaf20[_0xbc99('0x45')]);return db['FreshsalesConfiguration'][_0xbc99('0x46')](_0x1fe6bf)[_0xbc99('0x24')](handleEntityNotFound(_0x4b6579,null))[_0xbc99('0x24')](respondWithResult(_0x4b6579,null))[_0xbc99('0x47')](handleError(_0x4b6579,null));};exports['create']=function(_0x347dc0,_0x52c316){return db[_0xbc99('0x2c')][_0xbc99('0x48')](_0x347dc0[_0xbc99('0x49')],{})[_0xbc99('0x24')](respondWithResult(_0x52c316,0xc9))[_0xbc99('0x47')](handleError(_0x52c316,null));};exports[_0xbc99('0x22')]=function(_0x2de71d,_0x197fcc){if(_0x2de71d[_0xbc99('0x49')]['id']){delete _0x2de71d[_0xbc99('0x49')]['id'];}return db['FreshsalesConfiguration'][_0xbc99('0x46')]({'where':{'id':_0x2de71d['params']['id']}})[_0xbc99('0x24')](handleEntityNotFound(_0x197fcc,null))[_0xbc99('0x24')](saveUpdates(_0x2de71d['body'],null))[_0xbc99('0x24')](respondWithResult(_0x197fcc,null))['catch'](handleError(_0x197fcc,null));};exports[_0xbc99('0x23')]=function(_0x3d785a,_0x5a2d72){return db[_0xbc99('0x2c')][_0xbc99('0x46')]({'where':{'id':_0x3d785a[_0xbc99('0x43')]['id']}})[_0xbc99('0x24')](handleEntityNotFound(_0x5a2d72,null))[_0xbc99('0x24')](removeEntity(_0x5a2d72,null))[_0xbc99('0x47')](handleError(_0x5a2d72,null));};exports[_0xbc99('0x4a')]=function(_0x5a0416,_0x5d6458,_0x358803){var _0x3d8860={};var _0x3ffaeb={};var _0x1f5fba;var _0x5781a7;return db[_0xbc99('0x2c')][_0xbc99('0x4b')]({'where':{'id':_0x5a0416[_0xbc99('0x43')]['id']}})[_0xbc99('0x24')](handleEntityNotFound(_0x5d6458,null))[_0xbc99('0x24')](function(_0x5f3ba8){if(_0x5f3ba8){_0x1f5fba=_0x5f3ba8;_0x3ffaeb[_0xbc99('0x2e')]=_['keys'](db[_0xbc99('0x4c')][_0xbc99('0x4d')]);_0x3ffaeb[_0xbc99('0x2f')]=_[_0xbc99('0x30')](_0x5a0416['query']);_0x3ffaeb[_0xbc99('0x31')]=_[_0xbc99('0x44')](_0x3ffaeb[_0xbc99('0x2e')],_0x3ffaeb[_0xbc99('0x2f')]);_0x3d8860[_0xbc99('0x33')]=_[_0xbc99('0x44')](_0x3ffaeb[_0xbc99('0x2e')],qs['fields'](_0x5a0416[_0xbc99('0x2f')]['fields']));_0x3d8860['attributes']=_0x3d8860[_0xbc99('0x33')][_0xbc99('0x34')]?_0x3d8860[_0xbc99('0x33')]:_0x3ffaeb['model'];_0x3d8860[_0xbc99('0x37')]=qs['sort'](_0x5a0416[_0xbc99('0x2f')][_0xbc99('0x38')]);_0x3d8860[_0xbc99('0x39')]=qs[_0xbc99('0x31')](_[_0xbc99('0x3a')](_0x5a0416['query'],_0x3ffaeb[_0xbc99('0x31')]));if(_0x5a0416[_0xbc99('0x2f')]['filter']){_0x3d8860[_0xbc99('0x39')]=_[_0xbc99('0x3e')](_0x3d8860[_0xbc99('0x39')],{'$or':_['map'](_0x3d8860['attributes'],function(_0x4d3ed7){var _0x239f0c={};_0x239f0c[_0x4d3ed7]={'$like':'%'+_0x5a0416[_0xbc99('0x2f')][_0xbc99('0x3b')]+'%'};return _0x239f0c;})});}_0x3d8860=_['merge']({},_0x3d8860,_0x5a0416[_0xbc99('0x45')]);return _0x1f5fba[_0xbc99('0x4a')](_0x3d8860);}})[_0xbc99('0x24')](function(_0x4912e2){if(_0x4912e2){_0x5781a7=_0x4912e2[_0xbc99('0x34')];if(!_0x5a0416[_0xbc99('0x2f')]['hasOwnProperty'](_0xbc99('0x36'))){_0x3d8860[_0xbc99('0x1d')]=qs[_0xbc99('0x1d')](_0x5a0416[_0xbc99('0x2f')]['limit']);_0x3d8860[_0xbc99('0x1b')]=qs['offset'](_0x5a0416[_0xbc99('0x2f')][_0xbc99('0x1b')]);}return _0x1f5fba['getSubjects'](_0x3d8860);}})['then'](function(_0x11daf1){if(_0x11daf1){return _0x11daf1?{'count':_0x5781a7,'rows':_0x11daf1}:null;}})[_0xbc99('0x24')](respondWithResult(_0x5d6458,null))[_0xbc99('0x47')](handleError(_0x5d6458,null));};exports[_0xbc99('0x4e')]=function(_0x178e27,_0xbef914,_0x4f663e){var _0x38524f={};var _0x23ce74={};var _0x2ecc46;var _0x4773ff;return db[_0xbc99('0x2c')][_0xbc99('0x4b')]({'where':{'id':_0x178e27[_0xbc99('0x43')]['id']}})[_0xbc99('0x24')](handleEntityNotFound(_0xbef914,null))[_0xbc99('0x24')](function(_0x42cfbb){if(_0x42cfbb){_0x2ecc46=_0x42cfbb;_0x23ce74[_0xbc99('0x2e')]=_[_0xbc99('0x30')](db[_0xbc99('0x4c')][_0xbc99('0x4d')]);_0x23ce74[_0xbc99('0x2f')]=_[_0xbc99('0x30')](_0x178e27[_0xbc99('0x2f')]);_0x23ce74[_0xbc99('0x31')]=_[_0xbc99('0x44')](_0x23ce74[_0xbc99('0x2e')],_0x23ce74['query']);_0x38524f[_0xbc99('0x33')]=_['intersection'](_0x23ce74[_0xbc99('0x2e')],qs[_0xbc99('0x32')](_0x178e27[_0xbc99('0x2f')][_0xbc99('0x32')]));_0x38524f[_0xbc99('0x33')]=_0x38524f[_0xbc99('0x33')]['length']?_0x38524f[_0xbc99('0x33')]:_0x23ce74[_0xbc99('0x2e')];_0x38524f[_0xbc99('0x37')]=qs['sort'](_0x178e27[_0xbc99('0x2f')][_0xbc99('0x38')]);_0x38524f[_0xbc99('0x39')]=qs[_0xbc99('0x31')](_[_0xbc99('0x3a')](_0x178e27[_0xbc99('0x2f')],_0x23ce74[_0xbc99('0x31')]));if(_0x178e27[_0xbc99('0x2f')][_0xbc99('0x3b')]){_0x38524f[_0xbc99('0x39')]=_[_0xbc99('0x3e')](_0x38524f[_0xbc99('0x39')],{'$or':_[_0xbc99('0x2b')](_0x38524f[_0xbc99('0x33')],function(_0x82e238){var _0x65d2db={};_0x65d2db[_0x82e238]={'$like':'%'+_0x178e27[_0xbc99('0x2f')][_0xbc99('0x3b')]+'%'};return _0x65d2db;})});}_0x38524f=_[_0xbc99('0x3e')]({},_0x38524f,_0x178e27[_0xbc99('0x45')]);return _0x2ecc46['getDescriptions'](_0x38524f);}})[_0xbc99('0x24')](function(_0x33aa46){if(_0x33aa46){_0x4773ff=_0x33aa46[_0xbc99('0x34')];if(!_0x178e27[_0xbc99('0x2f')]['hasOwnProperty'](_0xbc99('0x36'))){_0x38524f['limit']=qs['limit'](_0x178e27['query'][_0xbc99('0x1d')]);_0x38524f[_0xbc99('0x1b')]=qs[_0xbc99('0x1b')](_0x178e27['query'][_0xbc99('0x1b')]);}return _0x2ecc46[_0xbc99('0x4e')](_0x38524f);}})['then'](function(_0x159fe2){if(_0x159fe2){return _0x159fe2?{'count':_0x4773ff,'rows':_0x159fe2}:null;}})[_0xbc99('0x24')](respondWithResult(_0xbef914,null))[_0xbc99('0x47')](handleError(_0xbef914,null));};exports['getFields']=function(_0x5a9c7a,_0x5d55ce,_0x3b1b94){var _0x4baed3={};var _0x494ff6={};var _0xddfa44;var _0x5ca367;return db[_0xbc99('0x2c')][_0xbc99('0x4b')]({'where':{'id':_0x5a9c7a[_0xbc99('0x43')]['id']}})[_0xbc99('0x24')](handleEntityNotFound(_0x5d55ce,null))[_0xbc99('0x24')](function(_0x4b4c9a){if(_0x4b4c9a){_0xddfa44=_0x4b4c9a;_0x494ff6[_0xbc99('0x2e')]=_[_0xbc99('0x30')](db[_0xbc99('0x4c')][_0xbc99('0x4d')]);_0x494ff6[_0xbc99('0x2f')]=_['keys'](_0x5a9c7a[_0xbc99('0x2f')]);_0x494ff6[_0xbc99('0x31')]=_[_0xbc99('0x44')](_0x494ff6[_0xbc99('0x2e')],_0x494ff6[_0xbc99('0x2f')]);_0x4baed3[_0xbc99('0x33')]=_[_0xbc99('0x44')](_0x494ff6[_0xbc99('0x2e')],qs[_0xbc99('0x32')](_0x5a9c7a[_0xbc99('0x2f')][_0xbc99('0x32')]));_0x4baed3[_0xbc99('0x33')]=_0x4baed3[_0xbc99('0x33')][_0xbc99('0x34')]?_0x4baed3[_0xbc99('0x33')]:_0x494ff6[_0xbc99('0x2e')];_0x4baed3[_0xbc99('0x37')]=qs[_0xbc99('0x38')](_0x5a9c7a[_0xbc99('0x2f')][_0xbc99('0x38')]);_0x4baed3[_0xbc99('0x39')]=qs[_0xbc99('0x31')](_['pick'](_0x5a9c7a[_0xbc99('0x2f')],_0x494ff6[_0xbc99('0x31')]));if(_0x5a9c7a[_0xbc99('0x2f')][_0xbc99('0x3b')]){_0x4baed3[_0xbc99('0x39')]=_[_0xbc99('0x3e')](_0x4baed3[_0xbc99('0x39')],{'$or':_[_0xbc99('0x2b')](_0x4baed3[_0xbc99('0x33')],function(_0x268d2a){var _0x5b0e77={};_0x5b0e77[_0x268d2a]={'$like':'%'+_0x5a9c7a['query'][_0xbc99('0x3b')]+'%'};return _0x5b0e77;})});}_0x4baed3=_[_0xbc99('0x3e')]({},_0x4baed3,_0x5a9c7a[_0xbc99('0x45')]);return _0xddfa44[_0xbc99('0x4f')](_0x4baed3);}})[_0xbc99('0x24')](function(_0x3d76b1){if(_0x3d76b1){_0x5ca367=_0x3d76b1[_0xbc99('0x34')];if(!_0x5a9c7a[_0xbc99('0x2f')]['hasOwnProperty'](_0xbc99('0x36'))){_0x4baed3[_0xbc99('0x1d')]=qs[_0xbc99('0x1d')](_0x5a9c7a[_0xbc99('0x2f')][_0xbc99('0x1d')]);_0x4baed3[_0xbc99('0x1b')]=qs[_0xbc99('0x1b')](_0x5a9c7a[_0xbc99('0x2f')][_0xbc99('0x1b')]);}return _0xddfa44[_0xbc99('0x4f')](_0x4baed3);}})[_0xbc99('0x24')](function(_0x3e9dce){if(_0x3e9dce){return _0x3e9dce?{'count':_0x5ca367,'rows':_0x3e9dce}:null;}})[_0xbc99('0x24')](respondWithResult(_0x5d55ce,null))[_0xbc99('0x47')](handleError(_0x5d55ce,null));}; \ No newline at end of file +var _0x0895=['find','create','body','findOne','FreshsalesField','getSubjects','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','findAll','catch','params','keys','options'];(function(_0x29fccd,_0x41da04){var _0x402c8e=function(_0x140f3a){while(--_0x140f3a){_0x29fccd['push'](_0x29fccd['shift']());}};_0x402c8e(++_0x41da04);}(_0x0895,0x198));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5089('0x0'));var zipdir=require(_0x5089('0x1'));var jsonpatch=require(_0x5089('0x2'));var rp=require(_0x5089('0x3'));var moment=require(_0x5089('0x4'));var BPromise=require(_0x5089('0x5'));var Mustache=require(_0x5089('0x6'));var util=require(_0x5089('0x7'));var path=require(_0x5089('0x8'));var sox=require(_0x5089('0x9'));var csv=require('to-csv');var ejs=require(_0x5089('0xa'));var fs=require('fs');var fs_extra=require(_0x5089('0xb'));var _=require(_0x5089('0xc'));var squel=require(_0x5089('0xd'));var crypto=require(_0x5089('0xe'));var jsforce=require(_0x5089('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5089('0x10'));var Papa=require('papaparse');var Redis=require(_0x5089('0x11'));var authService=require(_0x5089('0x12'));var qs=require(_0x5089('0x13'));var as=require(_0x5089('0x14'));var hardwareService=require(_0x5089('0x15'));var logger=require('../../config/logger')(_0x5089('0x16'));var utils=require(_0x5089('0x17'));var config=require(_0x5089('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5089('0x19'))['db'];function respondWithStatusCode(_0x52d25e,_0xb4ccfd){_0xb4ccfd=_0xb4ccfd||0xcc;return function(_0x4dd58b){if(_0x4dd58b){return _0x52d25e[_0x5089('0x1a')](_0xb4ccfd);}return _0x52d25e[_0x5089('0x1b')](_0xb4ccfd)[_0x5089('0x1c')]();};}function respondWithResult(_0x279605,_0x4f789b){_0x4f789b=_0x4f789b||0xc8;return function(_0x560376){if(_0x560376){return _0x279605[_0x5089('0x1b')](_0x4f789b)[_0x5089('0x1d')](_0x560376);}};}function respondWithFilteredResult(_0x38803a,_0x2c535f){return function(_0x50944b){if(_0x50944b){var _0x17d48f=typeof _0x2c535f['offset']===_0x5089('0x1e')&&typeof _0x2c535f[_0x5089('0x1f')]==='undefined';var _0x501e20=_0x50944b[_0x5089('0x20')];var _0x20253a=_0x17d48f?0x0:_0x2c535f[_0x5089('0x21')];var _0x4e57c3=_0x17d48f?_0x50944b[_0x5089('0x20')]:_0x2c535f[_0x5089('0x21')]+_0x2c535f[_0x5089('0x1f')];var _0x21bc0b;if(_0x4e57c3>=_0x501e20){_0x4e57c3=_0x501e20;_0x21bc0b=0xc8;}else{_0x21bc0b=0xce;}_0x38803a[_0x5089('0x1b')](_0x21bc0b);return _0x38803a[_0x5089('0x22')]('Content-Range',_0x20253a+'-'+_0x4e57c3+'/'+_0x501e20)[_0x5089('0x1d')](_0x50944b);}return null;};}function patchUpdates(_0x485c9c){return function(_0x354b84){try{jsonpatch[_0x5089('0x23')](_0x354b84,_0x485c9c,!![]);}catch(_0x42fb74){return BPromise[_0x5089('0x24')](_0x42fb74);}return _0x354b84[_0x5089('0x25')]();};}function saveUpdates(_0x4179dd,_0x4b9279){return function(_0xea06fa){if(_0xea06fa){return _0xea06fa[_0x5089('0x26')](_0x4179dd)[_0x5089('0x27')](function(_0x40559c){return _0x40559c;});}return null;};}function removeEntity(_0x4b9eb4,_0x48e52c){return function(_0x2152ed){if(_0x2152ed){return _0x2152ed[_0x5089('0x28')]()[_0x5089('0x27')](function(){_0x4b9eb4[_0x5089('0x1b')](0xcc)[_0x5089('0x1c')]();});}};}function handleEntityNotFound(_0x5ed47c,_0x92ed39){return function(_0x427029){if(!_0x427029){_0x5ed47c[_0x5089('0x1a')](0x194);}return _0x427029;};}function handleError(_0x25d6dd,_0x39cd75){_0x39cd75=_0x39cd75||0x1f4;return function(_0x419f02){logger[_0x5089('0x29')](_0x419f02[_0x5089('0x2a')]);if(_0x419f02['name']){delete _0x419f02[_0x5089('0x2b')];}_0x25d6dd[_0x5089('0x1b')](_0x39cd75)[_0x5089('0x2c')](_0x419f02);};}exports['index']=function(_0x855ca4,_0xf5c5da){var _0x2bdfc7={},_0x5069dc={},_0x319b0e={'count':0x0,'rows':[]};var _0x48fd71=_[_0x5089('0x2d')](db[_0x5089('0x2e')][_0x5089('0x2f')],function(_0x190c29){return{'name':_0x190c29[_0x5089('0x30')],'type':_0x190c29[_0x5089('0x31')][_0x5089('0x32')]};});_0x5069dc[_0x5089('0x33')]=_[_0x5089('0x2d')](_0x48fd71,_0x5089('0x2b'));_0x5069dc[_0x5089('0x34')]=_['keys'](_0x855ca4[_0x5089('0x34')]);_0x5069dc[_0x5089('0x35')]=_[_0x5089('0x36')](_0x5069dc[_0x5089('0x33')],_0x5069dc[_0x5089('0x34')]);_0x2bdfc7[_0x5089('0x37')]=_[_0x5089('0x36')](_0x5069dc['model'],qs[_0x5089('0x38')](_0x855ca4[_0x5089('0x34')][_0x5089('0x38')]));_0x2bdfc7['attributes']=_0x2bdfc7['attributes'][_0x5089('0x39')]?_0x2bdfc7[_0x5089('0x37')]:_0x5069dc[_0x5089('0x33')];if(!_0x855ca4[_0x5089('0x34')][_0x5089('0x3a')](_0x5089('0x3b'))){_0x2bdfc7[_0x5089('0x1f')]=qs['limit'](_0x855ca4[_0x5089('0x34')][_0x5089('0x1f')]);_0x2bdfc7['offset']=qs[_0x5089('0x21')](_0x855ca4[_0x5089('0x34')][_0x5089('0x21')]);}_0x2bdfc7[_0x5089('0x3c')]=qs['sort'](_0x855ca4[_0x5089('0x34')][_0x5089('0x3d')]);_0x2bdfc7['where']=qs['filters'](_[_0x5089('0x3e')](_0x855ca4[_0x5089('0x34')],_0x5069dc[_0x5089('0x35')]),_0x48fd71);if(_0x855ca4[_0x5089('0x34')][_0x5089('0x3f')]){_0x2bdfc7['where']=_[_0x5089('0x40')](_0x2bdfc7[_0x5089('0x41')],{'$or':_['map'](_0x48fd71,function(_0x452e2c){if(_0x452e2c['type']!==_0x5089('0x42')){var _0x1faa76={};_0x1faa76[_0x452e2c['name']]={'$like':'%'+_0x855ca4[_0x5089('0x34')]['filter']+'%'};return _0x1faa76;}})});}_0x2bdfc7=_[_0x5089('0x40')]({},_0x2bdfc7,_0x855ca4['options']);var _0x4cb65c={'where':_0x2bdfc7['where']};return db[_0x5089('0x2e')][_0x5089('0x20')](_0x4cb65c)[_0x5089('0x27')](function(_0x19f158){_0x319b0e[_0x5089('0x20')]=_0x19f158;if(_0x855ca4[_0x5089('0x34')]['includeAll']){_0x2bdfc7['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x5089('0x43')](_0x2bdfc7);})[_0x5089('0x27')](function(_0x51eff4){_0x319b0e['rows']=_0x51eff4;return _0x319b0e;})[_0x5089('0x27')](respondWithFilteredResult(_0xf5c5da,_0x2bdfc7))[_0x5089('0x44')](handleError(_0xf5c5da,null));};exports['show']=function(_0xbf2583,_0x3f442f){var _0x3d3fb0={'raw':![],'where':{'id':_0xbf2583[_0x5089('0x45')]['id']}},_0xd20a09={};_0xd20a09['model']=_[_0x5089('0x46')](db['FreshsalesConfiguration'][_0x5089('0x2f')]);_0xd20a09[_0x5089('0x34')]=_[_0x5089('0x46')](_0xbf2583['query']);_0xd20a09['filters']=_[_0x5089('0x36')](_0xd20a09['model'],_0xd20a09['query']);_0x3d3fb0['attributes']=_[_0x5089('0x36')](_0xd20a09[_0x5089('0x33')],qs[_0x5089('0x38')](_0xbf2583[_0x5089('0x34')][_0x5089('0x38')]));_0x3d3fb0['attributes']=_0x3d3fb0[_0x5089('0x37')][_0x5089('0x39')]?_0x3d3fb0[_0x5089('0x37')]:_0xd20a09[_0x5089('0x33')];if(_0xbf2583['query']['includeAll']){_0x3d3fb0['include']=[{'all':!![]}];}_0x3d3fb0=_[_0x5089('0x40')]({},_0x3d3fb0,_0xbf2583[_0x5089('0x47')]);return db[_0x5089('0x2e')][_0x5089('0x48')](_0x3d3fb0)[_0x5089('0x27')](handleEntityNotFound(_0x3f442f,null))[_0x5089('0x27')](respondWithResult(_0x3f442f,null))['catch'](handleError(_0x3f442f,null));};exports[_0x5089('0x49')]=function(_0x4aaf18,_0x24a879){return db['FreshsalesConfiguration']['create'](_0x4aaf18[_0x5089('0x4a')],{})[_0x5089('0x27')](respondWithResult(_0x24a879,0xc9))[_0x5089('0x44')](handleError(_0x24a879,null));};exports['update']=function(_0x47be3c,_0x14cc12){if(_0x47be3c['body']['id']){delete _0x47be3c['body']['id'];}return db[_0x5089('0x2e')]['find']({'where':{'id':_0x47be3c[_0x5089('0x45')]['id']}})[_0x5089('0x27')](handleEntityNotFound(_0x14cc12,null))[_0x5089('0x27')](saveUpdates(_0x47be3c[_0x5089('0x4a')],null))[_0x5089('0x27')](respondWithResult(_0x14cc12,null))[_0x5089('0x44')](handleError(_0x14cc12,null));};exports[_0x5089('0x28')]=function(_0x15f599,_0x2fb6fb){return db[_0x5089('0x2e')][_0x5089('0x48')]({'where':{'id':_0x15f599[_0x5089('0x45')]['id']}})[_0x5089('0x27')](handleEntityNotFound(_0x2fb6fb,null))[_0x5089('0x27')](removeEntity(_0x2fb6fb,null))['catch'](handleError(_0x2fb6fb,null));};exports['getSubjects']=function(_0x110f9d,_0x516d0c,_0x3fefbf){var _0x5cecb7={};var _0x30ec06={};var _0x1e6c62;var _0x5c5878;return db[_0x5089('0x2e')][_0x5089('0x4b')]({'where':{'id':_0x110f9d[_0x5089('0x45')]['id']}})[_0x5089('0x27')](handleEntityNotFound(_0x516d0c,null))['then'](function(_0x150762){if(_0x150762){_0x1e6c62=_0x150762;_0x30ec06[_0x5089('0x33')]=_[_0x5089('0x46')](db[_0x5089('0x4c')][_0x5089('0x2f')]);_0x30ec06['query']=_[_0x5089('0x46')](_0x110f9d[_0x5089('0x34')]);_0x30ec06[_0x5089('0x35')]=_['intersection'](_0x30ec06['model'],_0x30ec06[_0x5089('0x34')]);_0x5cecb7['attributes']=_[_0x5089('0x36')](_0x30ec06['model'],qs[_0x5089('0x38')](_0x110f9d[_0x5089('0x34')][_0x5089('0x38')]));_0x5cecb7[_0x5089('0x37')]=_0x5cecb7[_0x5089('0x37')][_0x5089('0x39')]?_0x5cecb7[_0x5089('0x37')]:_0x30ec06[_0x5089('0x33')];_0x5cecb7['order']=qs[_0x5089('0x3d')](_0x110f9d[_0x5089('0x34')][_0x5089('0x3d')]);_0x5cecb7['where']=qs[_0x5089('0x35')](_['pick'](_0x110f9d[_0x5089('0x34')],_0x30ec06[_0x5089('0x35')]));if(_0x110f9d[_0x5089('0x34')][_0x5089('0x3f')]){_0x5cecb7['where']=_['merge'](_0x5cecb7[_0x5089('0x41')],{'$or':_[_0x5089('0x2d')](_0x5cecb7['attributes'],function(_0x18d05c){var _0x4c16a8={};_0x4c16a8[_0x18d05c]={'$like':'%'+_0x110f9d[_0x5089('0x34')][_0x5089('0x3f')]+'%'};return _0x4c16a8;})});}_0x5cecb7=_[_0x5089('0x40')]({},_0x5cecb7,_0x110f9d[_0x5089('0x47')]);return _0x1e6c62['getSubjects'](_0x5cecb7);}})[_0x5089('0x27')](function(_0x411a75){if(_0x411a75){_0x5c5878=_0x411a75[_0x5089('0x39')];if(!_0x110f9d[_0x5089('0x34')][_0x5089('0x3a')](_0x5089('0x3b'))){_0x5cecb7[_0x5089('0x1f')]=qs[_0x5089('0x1f')](_0x110f9d[_0x5089('0x34')][_0x5089('0x1f')]);_0x5cecb7[_0x5089('0x21')]=qs['offset'](_0x110f9d[_0x5089('0x34')][_0x5089('0x21')]);}return _0x1e6c62[_0x5089('0x4d')](_0x5cecb7);}})[_0x5089('0x27')](function(_0x1018ac){if(_0x1018ac){return _0x1018ac?{'count':_0x5c5878,'rows':_0x1018ac}:null;}})[_0x5089('0x27')](respondWithResult(_0x516d0c,null))[_0x5089('0x44')](handleError(_0x516d0c,null));};exports['getDescriptions']=function(_0x11f945,_0xa73c6,_0x5821de){var _0x537bac={};var _0x1b38ed={};var _0x71b16d;var _0x1965c7;return db[_0x5089('0x2e')][_0x5089('0x4b')]({'where':{'id':_0x11f945[_0x5089('0x45')]['id']}})[_0x5089('0x27')](handleEntityNotFound(_0xa73c6,null))[_0x5089('0x27')](function(_0x5cb5a0){if(_0x5cb5a0){_0x71b16d=_0x5cb5a0;_0x1b38ed[_0x5089('0x33')]=_[_0x5089('0x46')](db[_0x5089('0x4c')][_0x5089('0x2f')]);_0x1b38ed[_0x5089('0x34')]=_[_0x5089('0x46')](_0x11f945[_0x5089('0x34')]);_0x1b38ed[_0x5089('0x35')]=_[_0x5089('0x36')](_0x1b38ed[_0x5089('0x33')],_0x1b38ed[_0x5089('0x34')]);_0x537bac['attributes']=_[_0x5089('0x36')](_0x1b38ed[_0x5089('0x33')],qs[_0x5089('0x38')](_0x11f945[_0x5089('0x34')][_0x5089('0x38')]));_0x537bac[_0x5089('0x37')]=_0x537bac[_0x5089('0x37')]['length']?_0x537bac[_0x5089('0x37')]:_0x1b38ed['model'];_0x537bac[_0x5089('0x3c')]=qs['sort'](_0x11f945[_0x5089('0x34')][_0x5089('0x3d')]);_0x537bac[_0x5089('0x41')]=qs['filters'](_[_0x5089('0x3e')](_0x11f945['query'],_0x1b38ed[_0x5089('0x35')]));if(_0x11f945['query'][_0x5089('0x3f')]){_0x537bac[_0x5089('0x41')]=_[_0x5089('0x40')](_0x537bac['where'],{'$or':_[_0x5089('0x2d')](_0x537bac[_0x5089('0x37')],function(_0x180c39){var _0x2e1524={};_0x2e1524[_0x180c39]={'$like':'%'+_0x11f945[_0x5089('0x34')][_0x5089('0x3f')]+'%'};return _0x2e1524;})});}_0x537bac=_['merge']({},_0x537bac,_0x11f945[_0x5089('0x47')]);return _0x71b16d[_0x5089('0x4e')](_0x537bac);}})[_0x5089('0x27')](function(_0x218f90){if(_0x218f90){_0x1965c7=_0x218f90[_0x5089('0x39')];if(!_0x11f945[_0x5089('0x34')][_0x5089('0x3a')](_0x5089('0x3b'))){_0x537bac[_0x5089('0x1f')]=qs[_0x5089('0x1f')](_0x11f945[_0x5089('0x34')][_0x5089('0x1f')]);_0x537bac[_0x5089('0x21')]=qs[_0x5089('0x21')](_0x11f945['query'][_0x5089('0x21')]);}return _0x71b16d[_0x5089('0x4e')](_0x537bac);}})['then'](function(_0x4066e8){if(_0x4066e8){return _0x4066e8?{'count':_0x1965c7,'rows':_0x4066e8}:null;}})['then'](respondWithResult(_0xa73c6,null))[_0x5089('0x44')](handleError(_0xa73c6,null));};exports[_0x5089('0x4f')]=function(_0x2cd3a1,_0x4edd31,_0x1f424d){var _0x80ca8={};var _0x235169={};var _0x5543eb;var _0x3ca74b;return db[_0x5089('0x2e')][_0x5089('0x4b')]({'where':{'id':_0x2cd3a1[_0x5089('0x45')]['id']}})[_0x5089('0x27')](handleEntityNotFound(_0x4edd31,null))['then'](function(_0x36c95a){if(_0x36c95a){_0x5543eb=_0x36c95a;_0x235169[_0x5089('0x33')]=_[_0x5089('0x46')](db[_0x5089('0x4c')][_0x5089('0x2f')]);_0x235169[_0x5089('0x34')]=_['keys'](_0x2cd3a1[_0x5089('0x34')]);_0x235169[_0x5089('0x35')]=_[_0x5089('0x36')](_0x235169[_0x5089('0x33')],_0x235169[_0x5089('0x34')]);_0x80ca8[_0x5089('0x37')]=_[_0x5089('0x36')](_0x235169['model'],qs[_0x5089('0x38')](_0x2cd3a1[_0x5089('0x34')][_0x5089('0x38')]));_0x80ca8[_0x5089('0x37')]=_0x80ca8['attributes'][_0x5089('0x39')]?_0x80ca8['attributes']:_0x235169[_0x5089('0x33')];_0x80ca8[_0x5089('0x3c')]=qs[_0x5089('0x3d')](_0x2cd3a1[_0x5089('0x34')][_0x5089('0x3d')]);_0x80ca8[_0x5089('0x41')]=qs['filters'](_[_0x5089('0x3e')](_0x2cd3a1[_0x5089('0x34')],_0x235169[_0x5089('0x35')]));if(_0x2cd3a1[_0x5089('0x34')]['filter']){_0x80ca8[_0x5089('0x41')]=_[_0x5089('0x40')](_0x80ca8['where'],{'$or':_[_0x5089('0x2d')](_0x80ca8['attributes'],function(_0xd3c5f1){var _0x4097b4={};_0x4097b4[_0xd3c5f1]={'$like':'%'+_0x2cd3a1['query']['filter']+'%'};return _0x4097b4;})});}_0x80ca8=_['merge']({},_0x80ca8,_0x2cd3a1[_0x5089('0x47')]);return _0x5543eb[_0x5089('0x4f')](_0x80ca8);}})[_0x5089('0x27')](function(_0xedf73f){if(_0xedf73f){_0x3ca74b=_0xedf73f[_0x5089('0x39')];if(!_0x2cd3a1[_0x5089('0x34')][_0x5089('0x3a')]('nolimit')){_0x80ca8[_0x5089('0x1f')]=qs[_0x5089('0x1f')](_0x2cd3a1[_0x5089('0x34')][_0x5089('0x1f')]);_0x80ca8[_0x5089('0x21')]=qs['offset'](_0x2cd3a1[_0x5089('0x34')][_0x5089('0x21')]);}return _0x5543eb['getFields'](_0x80ca8);}})[_0x5089('0x27')](function(_0x2e0636){if(_0x2e0636){return _0x2e0636?{'count':_0x3ca74b,'rows':_0x2e0636}:null;}})['then'](respondWithResult(_0x4edd31,null))[_0x5089('0x44')](handleError(_0x4edd31,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 1be2b3a..3209dae 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 _0xeed5=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeed5,0x1ac));var _0x5eed=function(_0x3d75d1,_0x5a89fe){_0x3d75d1=_0x3d75d1-0x0;var _0xa4c014=_0xeed5[_0x3d75d1];return _0xa4c014;};'use strict';var _=require(_0x5eed('0x0'));var util=require(_0x5eed('0x1'));var logger=require(_0x5eed('0x2'))(_0x5eed('0x3'));var moment=require('moment');var BPromise=require(_0x5eed('0x4'));var rp=require(_0x5eed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5eed('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5eed('0x7')]=function(_0x4bebb5,_0x403ddc){return _0x4bebb5[_0x5eed('0x8')](_0x5eed('0x9'),attributes,{'tableName':_0x5eed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbae6=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf329f1,_0x294a3c){var _0x3c6615=function(_0x418c73){while(--_0x418c73){_0xf329f1['push'](_0xf329f1['shift']());}};_0x3c6615(++_0x294a3c);}(_0xbae6,0x170));var _0x6bae=function(_0x444e22,_0x57c00b){_0x444e22=_0x444e22-0x0;var _0x5103d7=_0xbae6[_0x444e22];return _0x5103d7;};'use strict';var _=require(_0x6bae('0x0'));var util=require(_0x6bae('0x1'));var logger=require(_0x6bae('0x2'))(_0x6bae('0x3'));var moment=require(_0x6bae('0x4'));var BPromise=require('bluebird');var rp=require(_0x6bae('0x5'));var fs=require('fs');var path=require(_0x6bae('0x6'));var rimraf=require(_0x6bae('0x7'));var config=require(_0x6bae('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x6bae('0x9')]=function(_0x207005,_0x145eec){return _0x207005[_0x6bae('0xa')](_0x6bae('0xb'),attributes,{'tableName':_0x6bae('0xc'),'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 f3cb14f..41486ae 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 _0xa98a=['error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa98a,0x1bd));var _0xaa98=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa98a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa98('0x0'));var util=require(_0xaa98('0x1'));var moment=require(_0xaa98('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa98('0x5'))(_0xaa98('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa98('0x7'));var client=jayson[_0xaa98('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x436cda,_0x5d1920,_0x34ed3e){return new BPromise(function(_0xf1b213,_0x1a8d59){return client['request'](_0x436cda,_0x34ed3e)[_0xaa98('0x9')](function(_0x1a0793){logger[_0xaa98('0xa')](_0xaa98('0xb'),_0x5d1920,'request\x20sent');logger['debug'](_0xaa98('0xc'),_0x5d1920,_0xaa98('0xd'),JSON[_0xaa98('0xe')](_0x1a0793));if(_0x1a0793[_0xaa98('0xf')]){if(_0x1a0793[_0xaa98('0xf')][_0xaa98('0x10')]===0x1f4){logger[_0xaa98('0xf')](_0xaa98('0xb'),_0x5d1920,_0x1a0793[_0xaa98('0xf')]['message']);return _0x1a8d59(_0x1a0793[_0xaa98('0xf')]['message']);}logger[_0xaa98('0xf')](_0xaa98('0xb'),_0x5d1920,_0x1a0793[_0xaa98('0xf')][_0xaa98('0x11')]);return _0xf1b213(_0x1a0793['error'][_0xaa98('0x11')]);}else{logger[_0xaa98('0xa')](_0xaa98('0xb'),_0x5d1920,_0xaa98('0xd'));_0xf1b213(_0x1a0793[_0xaa98('0x12')]['message']);}})[_0xaa98('0x13')](function(_0x2e3aa6){logger[_0xaa98('0xf')](_0xaa98('0xb'),_0x5d1920,_0x2e3aa6);_0x1a8d59(_0x2e3aa6);});});} \ No newline at end of file +var _0xa70a=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3c572a,_0x151ad4){var _0xf6a4c2=function(_0x113ec1){while(--_0x113ec1){_0x3c572a['push'](_0x3c572a['shift']());}};_0xf6a4c2(++_0x151ad4);}(_0xa70a,0xe7));var _0xaa70=function(_0x50b3fc,_0x116961){_0x50b3fc=_0x50b3fc-0x0;var _0x3937ac=_0xa70a[_0x50b3fc];return _0x3937ac;};'use strict';var _=require(_0xaa70('0x0'));var util=require(_0xaa70('0x1'));var moment=require(_0xaa70('0x2'));var BPromise=require(_0xaa70('0x3'));var rs=require(_0xaa70('0x4'));var fs=require('fs');var Redis=require(_0xaa70('0x5'));var db=require(_0xaa70('0x6'))['db'];var utils=require(_0xaa70('0x7'));var logger=require('../../config/logger')(_0xaa70('0x8'));var config=require('../../config/environment');var jayson=require(_0xaa70('0x9'));var client=jayson[_0xaa70('0xa')][_0xaa70('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48c52b,_0x4bddc1,_0x4f97ef){return new BPromise(function(_0x406f6d,_0x61a2f){return client[_0xaa70('0xc')](_0x48c52b,_0x4f97ef)[_0xaa70('0xd')](function(_0x4b6aec){logger[_0xaa70('0xe')](_0xaa70('0xf'),_0x4bddc1,_0xaa70('0x10'));logger[_0xaa70('0x11')](_0xaa70('0x12'),_0x4bddc1,_0xaa70('0x10'),JSON['stringify'](_0x4b6aec));if(_0x4b6aec[_0xaa70('0x13')]){if(_0x4b6aec['error'][_0xaa70('0x14')]===0x1f4){logger[_0xaa70('0x13')](_0xaa70('0xf'),_0x4bddc1,_0x4b6aec[_0xaa70('0x13')][_0xaa70('0x15')]);return _0x61a2f(_0x4b6aec['error'][_0xaa70('0x15')]);}logger[_0xaa70('0x13')](_0xaa70('0xf'),_0x4bddc1,_0x4b6aec[_0xaa70('0x13')][_0xaa70('0x15')]);return _0x406f6d(_0x4b6aec[_0xaa70('0x13')]['message']);}else{logger[_0xaa70('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4bddc1,_0xaa70('0x10'));_0x406f6d(_0x4b6aec[_0xaa70('0x16')]['message']);}})['catch'](function(_0x2c5981){logger['error'](_0xaa70('0xf'),_0x4bddc1,_0x2c5981);_0x61a2f(_0x2c5981);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 01bb6f9..785cd7d 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 _0xffdc=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create','update','destroy'];(function(_0x46ca27,_0x50b9e1){var _0x194480=function(_0x528ce7){while(--_0x528ce7){_0x46ca27['push'](_0x46ca27['shift']());}};_0x194480(++_0x50b9e1);}(_0xffdc,0x7f));var _0xcffd=function(_0x17f567,_0x243a98){_0x17f567=_0x17f567-0x0;var _0x4285d2=_0xffdc[_0x17f567];return _0x4285d2;};'use strict';var multer=require(_0xcffd('0x0'));var util=require(_0xcffd('0x1'));var path=require('path');var timeout=require(_0xcffd('0x2'));var express=require(_0xcffd('0x3'));var router=express['Router']();var fs_extra=require(_0xcffd('0x4'));var auth=require(_0xcffd('0x5'));var interaction=require(_0xcffd('0x6'));var config=require(_0xcffd('0x7'));var controller=require(_0xcffd('0x8'));router['get']('/',auth[_0xcffd('0x9')](),controller[_0xcffd('0xa')]);router[_0xcffd('0xb')](_0xcffd('0xc'),auth[_0xcffd('0x9')](),controller[_0xcffd('0xd')]);router['post']('/',auth[_0xcffd('0x9')](),controller[_0xcffd('0xe')]);router['put'](_0xcffd('0xc'),auth[_0xcffd('0x9')](),controller[_0xcffd('0xf')]);router['delete'](_0xcffd('0xc'),auth[_0xcffd('0x9')](),controller[_0xcffd('0x10')]);module[_0xcffd('0x11')]=router; \ No newline at end of file +var _0xa4fb=['../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4caade,_0x549ce1){var _0x2041ff=function(_0x402f3a){while(--_0x402f3a){_0x4caade['push'](_0x4caade['shift']());}};_0x2041ff(++_0x549ce1);}(_0xa4fb,0x150));var _0xba4f=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0xa4fb[_0x508685];return _0x976a76;};'use strict';var multer=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var path=require(_0xba4f('0x2'));var timeout=require(_0xba4f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xba4f('0x4'));var auth=require(_0xba4f('0x5'));var interaction=require(_0xba4f('0x6'));var config=require('../../config/environment');var controller=require(_0xba4f('0x7'));router[_0xba4f('0x8')]('/',auth[_0xba4f('0x9')](),controller[_0xba4f('0xa')]);router[_0xba4f('0x8')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('0xc')]);router[_0xba4f('0xd')]('/',auth[_0xba4f('0x9')](),controller['create']);router[_0xba4f('0xe')]('/:id',auth[_0xba4f('0x9')](),controller[_0xba4f('0xf')]);router[_0xba4f('0x10')](_0xba4f('0xb'),auth[_0xba4f('0x9')](),controller[_0xba4f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 8e6c136..befc685 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 _0xd9d4=['customVariable','STRING','sequelize','ENUM','string','variable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd9d4,0x16a));var _0x4d9d=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0xd9d4[_0x592df4];return _0x3b4fe4;};'use strict';var Sequelize=require(_0x4d9d('0x0'));module['exports']={'type':{'type':Sequelize[_0x4d9d('0x1')](_0x4d9d('0x2'),_0x4d9d('0x3'),_0x4d9d('0x4'),'keyValue','picklist'),'defaultValue':_0x4d9d('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4d9d('0x5')]},'keyType':{'type':Sequelize[_0x4d9d('0x1')](_0x4d9d('0x2'),_0x4d9d('0x3'),_0x4d9d('0x4'))},'keyContent':{'type':Sequelize[_0x4d9d('0x5')]},'idField':{'type':Sequelize[_0x4d9d('0x5')]},'nameField':{'type':Sequelize[_0x4d9d('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4d9d('0x5')]}}; \ No newline at end of file +var _0x9b27=['ENUM','string','customVariable','keyValue','STRING','variable','sequelize','exports'];(function(_0x5f5d7f,_0x456b68){var _0x5bffd6=function(_0xa2e1c3){while(--_0xa2e1c3){_0x5f5d7f['push'](_0x5f5d7f['shift']());}};_0x5bffd6(++_0x456b68);}(_0x9b27,0x176));var _0x79b2=function(_0x1b3d60,_0x51583b){_0x1b3d60=_0x1b3d60-0x0;var _0x4abc3d=_0x9b27[_0x1b3d60];return _0x4abc3d;};'use strict';var Sequelize=require(_0x79b2('0x0'));module[_0x79b2('0x1')]={'type':{'type':Sequelize[_0x79b2('0x2')](_0x79b2('0x3'),'variable',_0x79b2('0x4'),_0x79b2('0x5'),'picklist'),'defaultValue':_0x79b2('0x3')},'content':{'type':Sequelize[_0x79b2('0x6')]},'key':{'type':Sequelize[_0x79b2('0x6')]},'keyType':{'type':Sequelize[_0x79b2('0x2')](_0x79b2('0x3'),_0x79b2('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x79b2('0x6')]},'idField':{'type':Sequelize[_0x79b2('0x6')]},'nameField':{'type':Sequelize[_0x79b2('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x79b2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index fb67f05..0507185 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 _0x2c3e=['catch','create','body','find','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','sendStatus','error','name','index','map','FreshsalesField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params'];(function(_0x2201c6,_0x42e648){var _0x446bec=function(_0x144d9b){while(--_0x144d9b){_0x2201c6['push'](_0x2201c6['shift']());}};_0x446bec(++_0x42e648);}(_0x2c3e,0x168));var _0xe2c3=function(_0x3165ab,_0x49ab2b){_0x3165ab=_0x3165ab-0x0;var _0x1b49d4=_0x2c3e[_0x3165ab];return _0x1b49d4;};'use strict';var emlformat=require(_0xe2c3('0x0'));var rimraf=require(_0xe2c3('0x1'));var zipdir=require(_0xe2c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe2c3('0x3'));var BPromise=require(_0xe2c3('0x4'));var Mustache=require(_0xe2c3('0x5'));var util=require(_0xe2c3('0x6'));var path=require(_0xe2c3('0x7'));var sox=require(_0xe2c3('0x8'));var csv=require(_0xe2c3('0x9'));var ejs=require(_0xe2c3('0xa'));var fs=require('fs');var fs_extra=require(_0xe2c3('0xb'));var _=require('lodash');var squel=require(_0xe2c3('0xc'));var crypto=require(_0xe2c3('0xd'));var jsforce=require(_0xe2c3('0xe'));var deskjs=require(_0xe2c3('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe2c3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe2c3('0x11'));var as=require(_0xe2c3('0x12'));var hardwareService=require(_0xe2c3('0x13'));var logger=require(_0xe2c3('0x14'))(_0xe2c3('0x15'));var utils=require(_0xe2c3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3606fa,_0x3427fe){_0x3427fe=_0x3427fe||0xcc;return function(_0x49164e){if(_0x49164e){return _0x3606fa['sendStatus'](_0x3427fe);}return _0x3606fa[_0xe2c3('0x17')](_0x3427fe)[_0xe2c3('0x18')]();};}function respondWithResult(_0x49d73e,_0x13b9b9){_0x13b9b9=_0x13b9b9||0xc8;return function(_0x151c09){if(_0x151c09){return _0x49d73e['status'](_0x13b9b9)[_0xe2c3('0x19')](_0x151c09);}};}function respondWithFilteredResult(_0x4b4131,_0x36e50c){return function(_0x4444ce){if(_0x4444ce){var _0x2f96e8=typeof _0x36e50c[_0xe2c3('0x1a')]===_0xe2c3('0x1b')&&typeof _0x36e50c[_0xe2c3('0x1c')]==='undefined';var _0x4fe54f=_0x4444ce['count'];var _0x183c73=_0x2f96e8?0x0:_0x36e50c[_0xe2c3('0x1a')];var _0x2929d1=_0x2f96e8?_0x4444ce[_0xe2c3('0x1d')]:_0x36e50c[_0xe2c3('0x1a')]+_0x36e50c[_0xe2c3('0x1c')];var _0x46f23d;if(_0x2929d1>=_0x4fe54f){_0x2929d1=_0x4fe54f;_0x46f23d=0xc8;}else{_0x46f23d=0xce;}_0x4b4131['status'](_0x46f23d);return _0x4b4131['set'](_0xe2c3('0x1e'),_0x183c73+'-'+_0x2929d1+'/'+_0x4fe54f)[_0xe2c3('0x19')](_0x4444ce);}return null;};}function patchUpdates(_0x13ace0){return function(_0x39440b){try{jsonpatch[_0xe2c3('0x1f')](_0x39440b,_0x13ace0,!![]);}catch(_0x2d76d5){return BPromise['reject'](_0x2d76d5);}return _0x39440b[_0xe2c3('0x20')]();};}function saveUpdates(_0x328a60,_0x1b413f){return function(_0x5cdc34){if(_0x5cdc34){return _0x5cdc34['update'](_0x328a60)[_0xe2c3('0x21')](function(_0x2a4d0f){return _0x2a4d0f;});}return null;};}function removeEntity(_0xff04c4,_0x5da644){return function(_0x51c94f){if(_0x51c94f){return _0x51c94f['destroy']()['then'](function(){_0xff04c4[_0xe2c3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18037e,_0x1f4a23){return function(_0xbde3b3){if(!_0xbde3b3){_0x18037e[_0xe2c3('0x22')](0x194);}return _0xbde3b3;};}function handleError(_0x170adc,_0x18724d){_0x18724d=_0x18724d||0x1f4;return function(_0x2a6c3a){logger[_0xe2c3('0x23')](_0x2a6c3a['stack']);if(_0x2a6c3a[_0xe2c3('0x24')]){delete _0x2a6c3a[_0xe2c3('0x24')];}_0x170adc[_0xe2c3('0x17')](_0x18724d)['send'](_0x2a6c3a);};}exports[_0xe2c3('0x25')]=function(_0x6fdd12,_0x5e5b5e){var _0x59ab69={},_0x10ba78={},_0x47a94c={'count':0x0,'rows':[]};var _0x3ce774=_[_0xe2c3('0x26')](db[_0xe2c3('0x27')][_0xe2c3('0x28')],function(_0x555212){return{'name':_0x555212['fieldName'],'type':_0x555212[_0xe2c3('0x29')][_0xe2c3('0x2a')]};});_0x10ba78[_0xe2c3('0x2b')]=_[_0xe2c3('0x26')](_0x3ce774,_0xe2c3('0x24'));_0x10ba78[_0xe2c3('0x2c')]=_[_0xe2c3('0x2d')](_0x6fdd12['query']);_0x10ba78[_0xe2c3('0x2e')]=_['intersection'](_0x10ba78[_0xe2c3('0x2b')],_0x10ba78[_0xe2c3('0x2c')]);_0x59ab69[_0xe2c3('0x2f')]=_[_0xe2c3('0x30')](_0x10ba78['model'],qs[_0xe2c3('0x31')](_0x6fdd12['query']['fields']));_0x59ab69['attributes']=_0x59ab69['attributes'][_0xe2c3('0x32')]?_0x59ab69[_0xe2c3('0x2f')]:_0x10ba78[_0xe2c3('0x2b')];if(!_0x6fdd12['query'][_0xe2c3('0x33')](_0xe2c3('0x34'))){_0x59ab69[_0xe2c3('0x1c')]=qs[_0xe2c3('0x1c')](_0x6fdd12[_0xe2c3('0x2c')][_0xe2c3('0x1c')]);_0x59ab69[_0xe2c3('0x1a')]=qs['offset'](_0x6fdd12[_0xe2c3('0x2c')]['offset']);}_0x59ab69[_0xe2c3('0x35')]=qs[_0xe2c3('0x36')](_0x6fdd12[_0xe2c3('0x2c')][_0xe2c3('0x36')]);_0x59ab69[_0xe2c3('0x37')]=qs['filters'](_[_0xe2c3('0x38')](_0x6fdd12[_0xe2c3('0x2c')],_0x10ba78['filters']),_0x3ce774);if(_0x6fdd12[_0xe2c3('0x2c')][_0xe2c3('0x39')]){_0x59ab69['where']=_[_0xe2c3('0x3a')](_0x59ab69[_0xe2c3('0x37')],{'$or':_[_0xe2c3('0x26')](_0x3ce774,function(_0x4cc147){if(_0x4cc147[_0xe2c3('0x29')]!==_0xe2c3('0x3b')){var _0x22642a={};_0x22642a[_0x4cc147[_0xe2c3('0x24')]]={'$like':'%'+_0x6fdd12['query'][_0xe2c3('0x39')]+'%'};return _0x22642a;}})});}_0x59ab69=_['merge']({},_0x59ab69,_0x6fdd12[_0xe2c3('0x3c')]);var _0x3a1654={'where':_0x59ab69[_0xe2c3('0x37')]};return db[_0xe2c3('0x27')][_0xe2c3('0x1d')](_0x3a1654)[_0xe2c3('0x21')](function(_0xc2e4f7){_0x47a94c['count']=_0xc2e4f7;if(_0x6fdd12[_0xe2c3('0x2c')][_0xe2c3('0x3d')]){_0x59ab69[_0xe2c3('0x3e')]=[{'all':!![]}];}return db[_0xe2c3('0x27')][_0xe2c3('0x3f')](_0x59ab69);})['then'](function(_0x2d750a){_0x47a94c[_0xe2c3('0x40')]=_0x2d750a;return _0x47a94c;})[_0xe2c3('0x21')](respondWithFilteredResult(_0x5e5b5e,_0x59ab69))['catch'](handleError(_0x5e5b5e,null));};exports['show']=function(_0x1cca0f,_0x3c9f82){var _0x4a4aff={'raw':!![],'where':{'id':_0x1cca0f[_0xe2c3('0x41')]['id']}},_0x1be0ac={};_0x1be0ac['model']=_[_0xe2c3('0x2d')](db[_0xe2c3('0x27')][_0xe2c3('0x28')]);_0x1be0ac[_0xe2c3('0x2c')]=_[_0xe2c3('0x2d')](_0x1cca0f[_0xe2c3('0x2c')]);_0x1be0ac[_0xe2c3('0x2e')]=_[_0xe2c3('0x30')](_0x1be0ac['model'],_0x1be0ac[_0xe2c3('0x2c')]);_0x4a4aff[_0xe2c3('0x2f')]=_[_0xe2c3('0x30')](_0x1be0ac[_0xe2c3('0x2b')],qs['fields'](_0x1cca0f[_0xe2c3('0x2c')][_0xe2c3('0x31')]));_0x4a4aff[_0xe2c3('0x2f')]=_0x4a4aff[_0xe2c3('0x2f')][_0xe2c3('0x32')]?_0x4a4aff[_0xe2c3('0x2f')]:_0x1be0ac[_0xe2c3('0x2b')];if(_0x1cca0f[_0xe2c3('0x2c')][_0xe2c3('0x3d')]){_0x4a4aff[_0xe2c3('0x3e')]=[{'all':!![]}];}_0x4a4aff=_[_0xe2c3('0x3a')]({},_0x4a4aff,_0x1cca0f[_0xe2c3('0x3c')]);return db['FreshsalesField']['find'](_0x4a4aff)[_0xe2c3('0x21')](handleEntityNotFound(_0x3c9f82,null))['then'](respondWithResult(_0x3c9f82,null))[_0xe2c3('0x42')](handleError(_0x3c9f82,null));};exports[_0xe2c3('0x43')]=function(_0x104fa9,_0x5f4ddd){return db[_0xe2c3('0x27')][_0xe2c3('0x43')](_0x104fa9[_0xe2c3('0x44')],{})['then'](respondWithResult(_0x5f4ddd,0xc9))[_0xe2c3('0x42')](handleError(_0x5f4ddd,null));};exports['update']=function(_0x3ebe56,_0x57bf5e){if(_0x3ebe56['body']['id']){delete _0x3ebe56['body']['id'];}return db['FreshsalesField'][_0xe2c3('0x45')]({'where':{'id':_0x3ebe56[_0xe2c3('0x41')]['id']}})[_0xe2c3('0x21')](handleEntityNotFound(_0x57bf5e,null))[_0xe2c3('0x21')](saveUpdates(_0x3ebe56[_0xe2c3('0x44')],null))[_0xe2c3('0x21')](respondWithResult(_0x57bf5e,null))[_0xe2c3('0x42')](handleError(_0x57bf5e,null));};exports[_0xe2c3('0x46')]=function(_0x3c8da5,_0x3b0bfc){return db[_0xe2c3('0x27')][_0xe2c3('0x45')]({'where':{'id':_0x3c8da5[_0xe2c3('0x41')]['id']}})['then'](handleEntityNotFound(_0x3b0bfc,null))[_0xe2c3('0x21')](removeEntity(_0x3b0bfc,null))[_0xe2c3('0x42')](handleError(_0x3b0bfc,null));}; \ No newline at end of file +var _0x1305=['length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','FreshsalesField','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','end','limit','undefined','count','offset','status','set','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x4c2c10,_0x3ee21e){var _0x33801a=function(_0x22325a){while(--_0x22325a){_0x4c2c10['push'](_0x4c2c10['shift']());}};_0x33801a(++_0x3ee21e);}(_0x1305,0xab));var _0x5130=function(_0x115ab6,_0x5ba3a0){_0x115ab6=_0x115ab6-0x0;var _0x4db190=_0x1305[_0x115ab6];return _0x4db190;};'use strict';var emlformat=require(_0x5130('0x0'));var rimraf=require(_0x5130('0x1'));var zipdir=require(_0x5130('0x2'));var jsonpatch=require(_0x5130('0x3'));var rp=require('request-promise');var moment=require(_0x5130('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5130('0x5'));var util=require(_0x5130('0x6'));var path=require(_0x5130('0x7'));var sox=require('sox');var csv=require(_0x5130('0x8'));var ejs=require(_0x5130('0x9'));var fs=require('fs');var fs_extra=require(_0x5130('0xa'));var _=require(_0x5130('0xb'));var squel=require(_0x5130('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5130('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5130('0xe'));var Papa=require('papaparse');var Redis=require(_0x5130('0xf'));var authService=require(_0x5130('0x10'));var qs=require(_0x5130('0x11'));var as=require(_0x5130('0x12'));var hardwareService=require(_0x5130('0x13'));var logger=require(_0x5130('0x14'))(_0x5130('0x15'));var utils=require(_0x5130('0x16'));var config=require(_0x5130('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42fd60,_0x3e8019){_0x3e8019=_0x3e8019||0xcc;return function(_0x1c3f8a){if(_0x1c3f8a){return _0x42fd60['sendStatus'](_0x3e8019);}return _0x42fd60['status'](_0x3e8019)[_0x5130('0x18')]();};}function respondWithResult(_0xfa53b0,_0x3edfe7){_0x3edfe7=_0x3edfe7||0xc8;return function(_0x1d3c7c){if(_0x1d3c7c){return _0xfa53b0['status'](_0x3edfe7)['json'](_0x1d3c7c);}};}function respondWithFilteredResult(_0x180de0,_0x476913){return function(_0x4ac99c){if(_0x4ac99c){var _0x147d4f=typeof _0x476913['offset']==='undefined'&&typeof _0x476913[_0x5130('0x19')]===_0x5130('0x1a');var _0x16e234=_0x4ac99c[_0x5130('0x1b')];var _0x8a7a6b=_0x147d4f?0x0:_0x476913['offset'];var _0x4fd050=_0x147d4f?_0x4ac99c[_0x5130('0x1b')]:_0x476913[_0x5130('0x1c')]+_0x476913['limit'];var _0x28eb53;if(_0x4fd050>=_0x16e234){_0x4fd050=_0x16e234;_0x28eb53=0xc8;}else{_0x28eb53=0xce;}_0x180de0[_0x5130('0x1d')](_0x28eb53);return _0x180de0[_0x5130('0x1e')]('Content-Range',_0x8a7a6b+'-'+_0x4fd050+'/'+_0x16e234)[_0x5130('0x1f')](_0x4ac99c);}return null;};}function patchUpdates(_0x7e0f1b){return function(_0x2f579d){try{jsonpatch[_0x5130('0x20')](_0x2f579d,_0x7e0f1b,!![]);}catch(_0x49bb2d){return BPromise[_0x5130('0x21')](_0x49bb2d);}return _0x2f579d['save']();};}function saveUpdates(_0x900d54,_0x174caf){return function(_0x1461fa){if(_0x1461fa){return _0x1461fa[_0x5130('0x22')](_0x900d54)[_0x5130('0x23')](function(_0x22bea9){return _0x22bea9;});}return null;};}function removeEntity(_0x197b29,_0x58239d){return function(_0x442838){if(_0x442838){return _0x442838[_0x5130('0x24')]()[_0x5130('0x23')](function(){_0x197b29[_0x5130('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x106ada,_0x4c59cc){return function(_0x49082f){if(!_0x49082f){_0x106ada[_0x5130('0x25')](0x194);}return _0x49082f;};}function handleError(_0x37fd36,_0x46f310){_0x46f310=_0x46f310||0x1f4;return function(_0x1ce647){logger[_0x5130('0x26')](_0x1ce647[_0x5130('0x27')]);if(_0x1ce647[_0x5130('0x28')]){delete _0x1ce647['name'];}_0x37fd36[_0x5130('0x1d')](_0x46f310)[_0x5130('0x29')](_0x1ce647);};}exports[_0x5130('0x2a')]=function(_0x133a1e,_0x3e1a41){var _0x459344={},_0x525d0e={},_0x40140c={'count':0x0,'rows':[]};var _0x3bd293=_[_0x5130('0x2b')](db['FreshsalesField'][_0x5130('0x2c')],function(_0x111119){return{'name':_0x111119['fieldName'],'type':_0x111119[_0x5130('0x2d')][_0x5130('0x2e')]};});_0x525d0e[_0x5130('0x2f')]=_[_0x5130('0x2b')](_0x3bd293,'name');_0x525d0e[_0x5130('0x30')]=_[_0x5130('0x31')](_0x133a1e[_0x5130('0x30')]);_0x525d0e[_0x5130('0x32')]=_[_0x5130('0x33')](_0x525d0e['model'],_0x525d0e['query']);_0x459344[_0x5130('0x34')]=_[_0x5130('0x33')](_0x525d0e[_0x5130('0x2f')],qs[_0x5130('0x35')](_0x133a1e[_0x5130('0x30')][_0x5130('0x35')]));_0x459344[_0x5130('0x34')]=_0x459344[_0x5130('0x34')][_0x5130('0x36')]?_0x459344[_0x5130('0x34')]:_0x525d0e[_0x5130('0x2f')];if(!_0x133a1e[_0x5130('0x30')][_0x5130('0x37')](_0x5130('0x38'))){_0x459344[_0x5130('0x19')]=qs[_0x5130('0x19')](_0x133a1e[_0x5130('0x30')][_0x5130('0x19')]);_0x459344[_0x5130('0x1c')]=qs['offset'](_0x133a1e['query'][_0x5130('0x1c')]);}_0x459344[_0x5130('0x39')]=qs[_0x5130('0x3a')](_0x133a1e[_0x5130('0x30')][_0x5130('0x3a')]);_0x459344[_0x5130('0x3b')]=qs[_0x5130('0x32')](_['pick'](_0x133a1e[_0x5130('0x30')],_0x525d0e[_0x5130('0x32')]),_0x3bd293);if(_0x133a1e['query'][_0x5130('0x3c')]){_0x459344['where']=_[_0x5130('0x3d')](_0x459344['where'],{'$or':_[_0x5130('0x2b')](_0x3bd293,function(_0xebba90){if(_0xebba90[_0x5130('0x2d')]!==_0x5130('0x3e')){var _0x1a020d={};_0x1a020d[_0xebba90[_0x5130('0x28')]]={'$like':'%'+_0x133a1e[_0x5130('0x30')][_0x5130('0x3c')]+'%'};return _0x1a020d;}})});}_0x459344=_[_0x5130('0x3d')]({},_0x459344,_0x133a1e['options']);var _0x1bac3c={'where':_0x459344[_0x5130('0x3b')]};return db[_0x5130('0x3f')][_0x5130('0x1b')](_0x1bac3c)['then'](function(_0xafd7a2){_0x40140c[_0x5130('0x1b')]=_0xafd7a2;if(_0x133a1e['query']['includeAll']){_0x459344[_0x5130('0x40')]=[{'all':!![]}];}return db[_0x5130('0x3f')][_0x5130('0x41')](_0x459344);})[_0x5130('0x23')](function(_0x325682){_0x40140c[_0x5130('0x42')]=_0x325682;return _0x40140c;})['then'](respondWithFilteredResult(_0x3e1a41,_0x459344))['catch'](handleError(_0x3e1a41,null));};exports[_0x5130('0x43')]=function(_0x4790d0,_0x237f83){var _0x36235b={'raw':!![],'where':{'id':_0x4790d0[_0x5130('0x44')]['id']}},_0x4a2901={};_0x4a2901[_0x5130('0x2f')]=_[_0x5130('0x31')](db[_0x5130('0x3f')]['rawAttributes']);_0x4a2901[_0x5130('0x30')]=_['keys'](_0x4790d0['query']);_0x4a2901['filters']=_[_0x5130('0x33')](_0x4a2901[_0x5130('0x2f')],_0x4a2901[_0x5130('0x30')]);_0x36235b[_0x5130('0x34')]=_[_0x5130('0x33')](_0x4a2901[_0x5130('0x2f')],qs[_0x5130('0x35')](_0x4790d0[_0x5130('0x30')][_0x5130('0x35')]));_0x36235b['attributes']=_0x36235b[_0x5130('0x34')][_0x5130('0x36')]?_0x36235b['attributes']:_0x4a2901[_0x5130('0x2f')];if(_0x4790d0[_0x5130('0x30')][_0x5130('0x45')]){_0x36235b['include']=[{'all':!![]}];}_0x36235b=_['merge']({},_0x36235b,_0x4790d0[_0x5130('0x46')]);return db[_0x5130('0x3f')][_0x5130('0x47')](_0x36235b)['then'](handleEntityNotFound(_0x237f83,null))[_0x5130('0x23')](respondWithResult(_0x237f83,null))[_0x5130('0x48')](handleError(_0x237f83,null));};exports[_0x5130('0x49')]=function(_0x2a00ae,_0x4656e0){return db[_0x5130('0x3f')][_0x5130('0x49')](_0x2a00ae[_0x5130('0x4a')],{})[_0x5130('0x23')](respondWithResult(_0x4656e0,0xc9))['catch'](handleError(_0x4656e0,null));};exports[_0x5130('0x22')]=function(_0xb26fc9,_0x17f444){if(_0xb26fc9[_0x5130('0x4a')]['id']){delete _0xb26fc9[_0x5130('0x4a')]['id'];}return db['FreshsalesField'][_0x5130('0x47')]({'where':{'id':_0xb26fc9[_0x5130('0x44')]['id']}})[_0x5130('0x23')](handleEntityNotFound(_0x17f444,null))[_0x5130('0x23')](saveUpdates(_0xb26fc9['body'],null))[_0x5130('0x23')](respondWithResult(_0x17f444,null))[_0x5130('0x48')](handleError(_0x17f444,null));};exports['destroy']=function(_0x474341,_0x3a01b4){return db[_0x5130('0x3f')]['find']({'where':{'id':_0x474341[_0x5130('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a01b4,null))[_0x5130('0x23')](removeEntity(_0x3a01b4,null))[_0x5130('0x48')](handleError(_0x3a01b4,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d99bbba..d364ae9 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 _0x4b17=['./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','../../config/logger','moment','bluebird','path'];(function(_0x12ef53,_0x3491ae){var _0x542de6=function(_0x1e6b60){while(--_0x1e6b60){_0x12ef53['push'](_0x12ef53['shift']());}};_0x542de6(++_0x3491ae);}(_0x4b17,0x10f));var _0x74b1=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x4b17[_0x1314d4];return _0x584ba5;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var logger=require(_0x74b1('0x1'))('api');var moment=require(_0x74b1('0x2'));var BPromise=require(_0x74b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module[_0x74b1('0x6')]=function(_0x379dcc,_0x3873a6){return _0x379dcc[_0x74b1('0x7')](_0x74b1('0x8'),attributes,{'tableName':_0x74b1('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x74b1('0xa'),_0x74b1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8286=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x1e4150,_0x55b02a){var _0x1ce3ee=function(_0x59324e){while(--_0x59324e){_0x1e4150['push'](_0x1e4150['shift']());}};_0x1ce3ee(++_0x55b02a);}(_0x8286,0x66));var _0x6828=function(_0x2be7a6,_0x215f10){_0x2be7a6=_0x2be7a6-0x0;var _0x75d54b=_0x8286[_0x2be7a6];return _0x75d54b;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var logger=require(_0x6828('0x2'))(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var rp=require(_0x6828('0x6'));var fs=require('fs');var path=require(_0x6828('0x7'));var rimraf=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var attributes=require(_0x6828('0xa'));module['exports']=function(_0x31c3d0,_0xe4b9bb){return _0x31c3d0['define'](_0x6828('0xb'),attributes,{'tableName':_0x6828('0xc'),'paranoid':![],'indexes':[{'name':_0x6828('0xd'),'fields':['idField',_0x6828('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 4b247be..fbc87f5 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 _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x245707,_0x24bd9b){var _0x21a7d4=function(_0x377f25){while(--_0x377f25){_0x245707['push'](_0x245707['shift']());}};_0x21a7d4(++_0x24bd9b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file +var _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x17134a,_0x210361){var _0x29f79d=function(_0xdedc48){while(--_0xdedc48){_0x17134a['push'](_0x17134a['shift']());}};_0x29f79d(++_0x210361);}(_0x33af,0xec));var _0xf33a=function(_0x5ce075,_0x20b649){_0x5ce075=_0x5ce075-0x0;var _0x595e7d=_0x33af[_0x5ce075];return _0x595e7d;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 4b7fa07..d6a6495 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(_0x320c19,_0x4e19b9){var _0x2e9bdb=function(_0x20a15e){while(--_0x20a15e){_0x320c19['push'](_0x320c19['shift']());}};_0x2e9bdb(++_0x4e19b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x3fbcaa,_0x4c1bb3){var _0x4018f9=function(_0x6e4139){while(--_0x6e4139){_0x3fbcaa['push'](_0x3fbcaa['shift']());}};_0x4018f9(++_0x4c1bb3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 3097368..f109fcb 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 _0xdf5d=['sequelize','exports','STRING','username','ENUM','integrationTab','newTab'];(function(_0x3fd180,_0x178b55){var _0x160d9e=function(_0x2062ac){while(--_0x2062ac){_0x3fd180['push'](_0x3fd180['shift']());}};_0x160d9e(++_0x178b55);}(_0xdf5d,0x126));var _0xddf5=function(_0x58920d,_0x10e4e5){_0x58920d=_0x58920d-0x0;var _0x5b3f73=_0xdf5d[_0x58920d];return _0x5b3f73;};'use strict';var Sequelize=require(_0xddf5('0x0'));module[_0xddf5('0x1')]={'name':{'type':Sequelize[_0xddf5('0x2')]},'description':{'type':Sequelize[_0xddf5('0x2')]},'username':{'type':Sequelize[_0xddf5('0x2')],'unique':_0xddf5('0x3')},'remoteUri':{'type':Sequelize[_0xddf5('0x2')]},'password':{'type':Sequelize[_0xddf5('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xddf5('0x2')]},'securityToken':{'type':Sequelize[_0xddf5('0x2')]},'serverUrl':{'type':Sequelize[_0xddf5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xddf5('0x4')](_0xddf5('0x5'),_0xddf5('0x6')),'defaultValue':_0xddf5('0x5')}}; \ No newline at end of file +var _0x0837=['exports','STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0xbd44b2,_0x12d751){var _0x496d3c=function(_0x13fd88){while(--_0x13fd88){_0xbd44b2['push'](_0xbd44b2['shift']());}};_0x496d3c(++_0x12d751);}(_0x0837,0x1db));var _0x7083=function(_0x16288c,_0x3c8dd4){_0x16288c=_0x16288c-0x0;var _0x13599f=_0x0837[_0x16288c];return _0x13599f;};'use strict';var Sequelize=require(_0x7083('0x0'));module[_0x7083('0x1')]={'name':{'type':Sequelize[_0x7083('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7083('0x2')],'unique':_0x7083('0x3')},'remoteUri':{'type':Sequelize[_0x7083('0x2')]},'password':{'type':Sequelize[_0x7083('0x2')]},'clientId':{'type':Sequelize[_0x7083('0x2')]},'clientSecret':{'type':Sequelize[_0x7083('0x2')]},'securityToken':{'type':Sequelize[_0x7083('0x2')]},'serverUrl':{'type':Sequelize[_0x7083('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7083('0x4')]('integrationTab',_0x7083('0x5')),'defaultValue':_0x7083('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 039ecec..b5fb9fb 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 _0xe2fb=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','stack','name','index','rawAttributes','type','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','SalesforceAccount','find','create','body','getConfigurations','SalesforceConfiguration','filter','hasOwnProperty','addConfiguration','findOne','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','string','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','False','false','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0xb4541d,_0x27e4a9){var _0x4a61a5=function(_0x294885){while(--_0x294885){_0xb4541d['push'](_0xb4541d['shift']());}};_0x4a61a5(++_0x27e4a9);}(_0xe2fb,0x16a));var _0xbe2f=function(_0xec71a2,_0x25251f){_0xec71a2=_0xec71a2-0x0;var _0x38d339=_0xe2fb[_0xec71a2];return _0x38d339;};'use strict';var emlformat=require(_0xbe2f('0x0'));var rimraf=require(_0xbe2f('0x1'));var zipdir=require(_0xbe2f('0x2'));var jsonpatch=require(_0xbe2f('0x3'));var rp=require(_0xbe2f('0x4'));var moment=require(_0xbe2f('0x5'));var BPromise=require(_0xbe2f('0x6'));var Mustache=require(_0xbe2f('0x7'));var util=require(_0xbe2f('0x8'));var path=require(_0xbe2f('0x9'));var sox=require(_0xbe2f('0xa'));var csv=require(_0xbe2f('0xb'));var ejs=require(_0xbe2f('0xc'));var fs=require('fs');var fs_extra=require(_0xbe2f('0xd'));var _=require(_0xbe2f('0xe'));var squel=require(_0xbe2f('0xf'));var crypto=require(_0xbe2f('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xbe2f('0x11'));var toCsv=require(_0xbe2f('0xb'));var querystring=require(_0xbe2f('0x12'));var Papa=require(_0xbe2f('0x13'));var Redis=require(_0xbe2f('0x14'));var authService=require(_0xbe2f('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xbe2f('0x16'));var hardwareService=require(_0xbe2f('0x17'));var logger=require(_0xbe2f('0x18'))('api');var utils=require(_0xbe2f('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xbe2f('0x1a'));var db=require(_0xbe2f('0x1b'))['db'];var integrations=require(_0xbe2f('0x1c'));function respondWithStatusCode(_0x3614b2,_0x262604){_0x262604=_0x262604||0xcc;return function(_0x4916c5){if(_0x4916c5){return _0x3614b2[_0xbe2f('0x1d')](_0x262604);}return _0x3614b2[_0xbe2f('0x1e')](_0x262604)[_0xbe2f('0x1f')]();};}function respondWithResult(_0x3869c8,_0x2782d0){_0x2782d0=_0x2782d0||0xc8;return function(_0x41140c){if(_0x41140c){return _0x3869c8['status'](_0x2782d0)[_0xbe2f('0x20')](_0x41140c);}};}function respondWithFilteredResult(_0x30cb82,_0x52f912){return function(_0x32a1e3){if(_0x32a1e3){var _0x111694=typeof _0x52f912[_0xbe2f('0x21')]==='undefined'&&typeof _0x52f912[_0xbe2f('0x22')]===_0xbe2f('0x23');var _0x435103=_0x32a1e3[_0xbe2f('0x24')];var _0x3d9820=_0x111694?0x0:_0x52f912[_0xbe2f('0x21')];var _0xe2827e=_0x111694?_0x32a1e3[_0xbe2f('0x24')]:_0x52f912[_0xbe2f('0x21')]+_0x52f912['limit'];var _0x5aff99;if(_0xe2827e>=_0x435103){_0xe2827e=_0x435103;_0x5aff99=0xc8;}else{_0x5aff99=0xce;}_0x30cb82[_0xbe2f('0x1e')](_0x5aff99);return _0x30cb82[_0xbe2f('0x25')](_0xbe2f('0x26'),_0x3d9820+'-'+_0xe2827e+'/'+_0x435103)[_0xbe2f('0x20')](_0x32a1e3);}return null;};}function patchUpdates(_0x2a4b5f){return function(_0x2eadb7){try{jsonpatch[_0xbe2f('0x27')](_0x2eadb7,_0x2a4b5f,!![]);}catch(_0x458a0b){return BPromise['reject'](_0x458a0b);}return _0x2eadb7[_0xbe2f('0x28')]();};}function saveUpdates(_0x4c06e5,_0x5a73fa){return function(_0x139c61){if(_0x139c61){return _0x139c61[_0xbe2f('0x29')](_0x4c06e5)['then'](function(_0x1e079e){return _0x1e079e;});}return null;};}function removeEntity(_0x24a41d,_0x4d2766){return function(_0x48fa86){if(_0x48fa86){return _0x48fa86[_0xbe2f('0x2a')]()[_0xbe2f('0x2b')](function(){_0x24a41d[_0xbe2f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50bc9f,_0x5470e0){return function(_0x43bcb7){if(!_0x43bcb7){_0x50bc9f[_0xbe2f('0x1d')](0x194);}return _0x43bcb7;};}function handleError(_0x516677,_0x1cffeb){_0x1cffeb=_0x1cffeb||0x1f4;return function(_0x1e773b){logger['error'](_0x1e773b[_0xbe2f('0x2c')]);if(_0x1e773b[_0xbe2f('0x2d')]){delete _0x1e773b[_0xbe2f('0x2d')];}_0x516677[_0xbe2f('0x1e')](_0x1cffeb)['send'](_0x1e773b);};}exports[_0xbe2f('0x2e')]=function(_0x339dc9,_0x2b7135){var _0x283774={},_0x8067={},_0x514ef7={'count':0x0,'rows':[]};var _0x47577c=_['map'](db['SalesforceAccount'][_0xbe2f('0x2f')],function(_0x35e3b5){return{'name':_0x35e3b5['fieldName'],'type':_0x35e3b5[_0xbe2f('0x30')]['key']};});_0x8067[_0xbe2f('0x31')]=_[_0xbe2f('0x32')](_0x47577c,'name');_0x8067[_0xbe2f('0x33')]=_[_0xbe2f('0x34')](_0x339dc9[_0xbe2f('0x33')]);_0x8067['filters']=_[_0xbe2f('0x35')](_0x8067[_0xbe2f('0x31')],_0x8067[_0xbe2f('0x33')]);_0x283774[_0xbe2f('0x36')]=_['intersection'](_0x8067[_0xbe2f('0x31')],qs[_0xbe2f('0x37')](_0x339dc9[_0xbe2f('0x33')][_0xbe2f('0x37')]));_0x283774[_0xbe2f('0x36')]=_0x283774['attributes'][_0xbe2f('0x38')]?_0x283774[_0xbe2f('0x36')]:_0x8067[_0xbe2f('0x31')];if(!_0x339dc9['query']['hasOwnProperty'](_0xbe2f('0x39'))){_0x283774[_0xbe2f('0x22')]=qs[_0xbe2f('0x22')](_0x339dc9[_0xbe2f('0x33')][_0xbe2f('0x22')]);_0x283774['offset']=qs[_0xbe2f('0x21')](_0x339dc9[_0xbe2f('0x33')][_0xbe2f('0x21')]);}_0x283774[_0xbe2f('0x3a')]=qs[_0xbe2f('0x3b')](_0x339dc9[_0xbe2f('0x33')][_0xbe2f('0x3b')]);_0x283774[_0xbe2f('0x3c')]=qs[_0xbe2f('0x3d')](_['pick'](_0x339dc9['query'],_0x8067['filters']),_0x47577c);if(_0x339dc9[_0xbe2f('0x33')]['filter']){_0x283774[_0xbe2f('0x3c')]=_[_0xbe2f('0x3e')](_0x283774[_0xbe2f('0x3c')],{'$or':_[_0xbe2f('0x32')](_0x47577c,function(_0x32cfb8){if(_0x32cfb8[_0xbe2f('0x30')]!==_0xbe2f('0x3f')){var _0x31a902={};_0x31a902[_0x32cfb8[_0xbe2f('0x2d')]]={'$like':'%'+_0x339dc9[_0xbe2f('0x33')]['filter']+'%'};return _0x31a902;}})});}_0x283774=_[_0xbe2f('0x3e')]({},_0x283774,_0x339dc9[_0xbe2f('0x40')]);var _0x67637f={'where':_0x283774[_0xbe2f('0x3c')]};return db['SalesforceAccount'][_0xbe2f('0x24')](_0x67637f)['then'](function(_0x412220){_0x514ef7[_0xbe2f('0x24')]=_0x412220;if(_0x339dc9[_0xbe2f('0x33')][_0xbe2f('0x41')]){_0x283774[_0xbe2f('0x42')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xbe2f('0x43')](_0x283774);})['then'](function(_0x1ee009){_0x514ef7[_0xbe2f('0x44')]=_0x1ee009;return _0x514ef7;})['then'](respondWithFilteredResult(_0x2b7135,_0x283774))[_0xbe2f('0x45')](handleError(_0x2b7135,null));};exports[_0xbe2f('0x46')]=function(_0x50f4d9,_0x5e9512){var _0x1f942d={'raw':![],'where':{'id':_0x50f4d9[_0xbe2f('0x47')]['id']}},_0x2916f7={};_0x2916f7[_0xbe2f('0x31')]=_[_0xbe2f('0x34')](db[_0xbe2f('0x48')][_0xbe2f('0x2f')]);_0x2916f7['query']=_[_0xbe2f('0x34')](_0x50f4d9[_0xbe2f('0x33')]);_0x2916f7[_0xbe2f('0x3d')]=_[_0xbe2f('0x35')](_0x2916f7[_0xbe2f('0x31')],_0x2916f7[_0xbe2f('0x33')]);_0x1f942d[_0xbe2f('0x36')]=_[_0xbe2f('0x35')](_0x2916f7[_0xbe2f('0x31')],qs['fields'](_0x50f4d9['query'][_0xbe2f('0x37')]));_0x1f942d[_0xbe2f('0x36')]=_0x1f942d['attributes'][_0xbe2f('0x38')]?_0x1f942d[_0xbe2f('0x36')]:_0x2916f7['model'];if(_0x50f4d9[_0xbe2f('0x33')][_0xbe2f('0x41')]){_0x1f942d[_0xbe2f('0x42')]=[{'all':!![]}];}_0x1f942d=_[_0xbe2f('0x3e')]({},_0x1f942d,_0x50f4d9['options']);return db[_0xbe2f('0x48')][_0xbe2f('0x49')](_0x1f942d)[_0xbe2f('0x2b')](handleEntityNotFound(_0x5e9512,null))[_0xbe2f('0x2b')](respondWithResult(_0x5e9512,null))[_0xbe2f('0x45')](handleError(_0x5e9512,null));};exports[_0xbe2f('0x4a')]=function(_0xfe774b,_0x92116a){return db[_0xbe2f('0x48')]['create'](_0xfe774b['body'],{})[_0xbe2f('0x2b')](respondWithResult(_0x92116a,0xc9))[_0xbe2f('0x45')](handleError(_0x92116a,null));};exports[_0xbe2f('0x29')]=function(_0x45d78f,_0x3482f1){if(_0x45d78f[_0xbe2f('0x4b')]['id']){delete _0x45d78f['body']['id'];}return db[_0xbe2f('0x48')][_0xbe2f('0x49')]({'where':{'id':_0x45d78f[_0xbe2f('0x47')]['id']}})[_0xbe2f('0x2b')](handleEntityNotFound(_0x3482f1,null))[_0xbe2f('0x2b')](saveUpdates(_0x45d78f['body'],null))[_0xbe2f('0x2b')](respondWithResult(_0x3482f1,null))['catch'](handleError(_0x3482f1,null));};exports[_0xbe2f('0x2a')]=function(_0x1c524d,_0x3605a0){return db[_0xbe2f('0x48')][_0xbe2f('0x49')]({'where':{'id':_0x1c524d[_0xbe2f('0x47')]['id']}})[_0xbe2f('0x2b')](handleEntityNotFound(_0x3605a0,null))[_0xbe2f('0x2b')](removeEntity(_0x3605a0,null))[_0xbe2f('0x45')](handleError(_0x3605a0,null));};exports[_0xbe2f('0x4c')]=function(_0x3353d1,_0x409ca6,_0x14a7a4){var _0x43ee73={};var _0x39b84b={};var _0x52eea7;var _0xa6ec18;return db[_0xbe2f('0x48')]['findOne']({'where':{'id':_0x3353d1['params']['id']}})[_0xbe2f('0x2b')](handleEntityNotFound(_0x409ca6,null))['then'](function(_0x4c5bee){if(_0x4c5bee){_0x52eea7=_0x4c5bee;_0x39b84b[_0xbe2f('0x31')]=_['keys'](db[_0xbe2f('0x4d')][_0xbe2f('0x2f')]);_0x39b84b['query']=_[_0xbe2f('0x34')](_0x3353d1['query']);_0x39b84b[_0xbe2f('0x3d')]=_[_0xbe2f('0x35')](_0x39b84b[_0xbe2f('0x31')],_0x39b84b[_0xbe2f('0x33')]);_0x43ee73['attributes']=_[_0xbe2f('0x35')](_0x39b84b[_0xbe2f('0x31')],qs[_0xbe2f('0x37')](_0x3353d1['query'][_0xbe2f('0x37')]));_0x43ee73[_0xbe2f('0x36')]=_0x43ee73[_0xbe2f('0x36')][_0xbe2f('0x38')]?_0x43ee73['attributes']:_0x39b84b['model'];_0x43ee73[_0xbe2f('0x3a')]=qs[_0xbe2f('0x3b')](_0x3353d1[_0xbe2f('0x33')][_0xbe2f('0x3b')]);_0x43ee73[_0xbe2f('0x3c')]=qs[_0xbe2f('0x3d')](_['pick'](_0x3353d1['query'],_0x39b84b[_0xbe2f('0x3d')]));if(_0x3353d1['query'][_0xbe2f('0x4e')]){_0x43ee73['where']=_[_0xbe2f('0x3e')](_0x43ee73[_0xbe2f('0x3c')],{'$or':_['map'](_0x43ee73['attributes'],function(_0x23f695){var _0x39e1c5={};_0x39e1c5[_0x23f695]={'$like':'%'+_0x3353d1['query'][_0xbe2f('0x4e')]+'%'};return _0x39e1c5;})});}_0x43ee73=_[_0xbe2f('0x3e')]({},_0x43ee73,_0x3353d1[_0xbe2f('0x40')]);return _0x52eea7[_0xbe2f('0x4c')](_0x43ee73);}})[_0xbe2f('0x2b')](function(_0x3baeb0){if(_0x3baeb0){_0xa6ec18=_0x3baeb0[_0xbe2f('0x38')];if(!_0x3353d1[_0xbe2f('0x33')][_0xbe2f('0x4f')](_0xbe2f('0x39'))){_0x43ee73[_0xbe2f('0x22')]=qs[_0xbe2f('0x22')](_0x3353d1[_0xbe2f('0x33')][_0xbe2f('0x22')]);_0x43ee73[_0xbe2f('0x21')]=qs[_0xbe2f('0x21')](_0x3353d1[_0xbe2f('0x33')]['offset']);}return _0x52eea7[_0xbe2f('0x4c')](_0x43ee73);}})['then'](function(_0x53b259){if(_0x53b259){return _0x53b259?{'count':_0xa6ec18,'rows':_0x53b259}:null;}})[_0xbe2f('0x2b')](respondWithResult(_0x409ca6,null))[_0xbe2f('0x45')](handleError(_0x409ca6,null));};exports[_0xbe2f('0x50')]=function(_0x173807,_0x47cda3,_0x13600e){if(_0x173807[_0xbe2f('0x4b')]['id']){delete _0x173807[_0xbe2f('0x4b')]['id'];}return db[_0xbe2f('0x48')][_0xbe2f('0x51')]({'where':{'id':_0x173807[_0xbe2f('0x47')]['id']}})[_0xbe2f('0x2b')](handleEntityNotFound(_0x47cda3,null))['then'](function(_0x87f792){if(_0x87f792){_0x173807[_0xbe2f('0x4b')]['AccountId']=_0x87f792['id'];_0x173807[_0xbe2f('0x4b')]['Subjects']=integrations[_0xbe2f('0x52')](_0x173807[_0xbe2f('0x4b')]['channel'],_0x173807[_0xbe2f('0x4b')]['type']);_0x173807[_0xbe2f('0x4b')][_0xbe2f('0x53')]=integrations[_0xbe2f('0x54')](_0x173807[_0xbe2f('0x4b')][_0xbe2f('0x55')],_0x173807[_0xbe2f('0x4b')][_0xbe2f('0x30')]);return db['SalesforceConfiguration']['create'](_0x173807[_0xbe2f('0x4b')],{'include':[{'model':db[_0xbe2f('0x56')],'as':'Subjects'},{'model':db[_0xbe2f('0x56')],'as':_0xbe2f('0x53')}]});}return null;})[_0xbe2f('0x2b')](respondWithResult(_0x47cda3,null))[_0xbe2f('0x45')](handleError(_0x47cda3,null));};exports['getFields']=function(_0x370a4b,_0x24eb0e,_0x440a67){var _0x41ebac;var _0x3f9e10='';var _0x374928='Task';return db[_0xbe2f('0x48')][_0xbe2f('0x51')]({'where':{'id':_0x370a4b[_0xbe2f('0x47')]['id']},'attributes':['id',_0xbe2f('0x57'),_0xbe2f('0x58'),_0xbe2f('0x59'),_0xbe2f('0x5a'),_0xbe2f('0x5b'),_0xbe2f('0x5c')]})[_0xbe2f('0x2b')](handleEntityNotFound(_0x24eb0e,null))[_0xbe2f('0x2b')](function(_0x46f7a8){if(_0x46f7a8){_0x3f9e10=_0x46f7a8[_0xbe2f('0x57')];var _0x15b300=_0x3f9e10[_0xbe2f('0x5d')](-0x1);if(_0x15b300==='/'){_0x3f9e10=_0x3f9e10['substring'](0x0,_0x3f9e10[_0xbe2f('0x5e')](_0x15b300));}_0x41ebac=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f9e10,'clientId':_0x46f7a8[_0xbe2f('0x58')],'clientSecret':_0x46f7a8[_0xbe2f('0x59')]}});return _0x41ebac['login'](_0x46f7a8['username'],_0x46f7a8['password']['concat'](_0x46f7a8[_0xbe2f('0x5c')]));}})[_0xbe2f('0x2b')](function(_0x210e85){if(_0x210e85){if(!_[_0xbe2f('0x5f')](_0x370a4b['query'][_0xbe2f('0x60')])){_0x374928=_0x370a4b[_0xbe2f('0x33')][_0xbe2f('0x60')];}return _0x41ebac[_0xbe2f('0x61')](_0x374928)[_0xbe2f('0x62')]();}})[_0xbe2f('0x2b')](function(_0x1fec42){var _0x34e1db=[_0xbe2f('0x63'),'ActivityDate','IsReminderSet',_0xbe2f('0x64'),_0xbe2f('0x65'),'Description'];var _0x3bd364=[_0xbe2f('0x66'),'int',_0xbe2f('0x67'),_0xbe2f('0x68'),_0xbe2f('0x69'),_0xbe2f('0x6a'),_0xbe2f('0x6b')];if(_0x1fec42){_[_0xbe2f('0x6c')](_0x1fec42[_0xbe2f('0x37')],function(_0x1a6297){return _0x34e1db[_0xbe2f('0x6d')](_0x1a6297[_0xbe2f('0x2d')])||!_0x3bd364[_0xbe2f('0x6d')](_0x1a6297[_0xbe2f('0x30')]);});return{'count':_0x1fec42[_0xbe2f('0x37')]['length'],'rows':_[_0xbe2f('0x32')](_0x1fec42[_0xbe2f('0x37')],function(_0x6831d0){return{'id':_0x6831d0['name'],'name':_0x6831d0[_0xbe2f('0x6e')],'custom':_0x6831d0[_0xbe2f('0x6f')],'options':_0x6831d0[_0xbe2f('0x70')][_0xbe2f('0x38')]>0x0?_[_0xbe2f('0x32')](_0x6831d0[_0xbe2f('0x70')],function(_0x470136){return{'name':_0x470136[_0xbe2f('0x6e')],'value':_0x470136[_0xbe2f('0x71')]};}):_0x6831d0[_0xbe2f('0x30')]==_0xbe2f('0x68')?[{'name':_0xbe2f('0x72'),'value':'true'},{'name':_0xbe2f('0x73'),'value':_0xbe2f('0x74')}]:[]};})};}})[_0xbe2f('0x2b')](respondWithResult(_0x24eb0e,null))['catch'](function(_0x40dada){var _0x18fcff=_0x370a4b['query']['test']?0x1f4:_0x40dada['statusCode']||0x1f4;logger[_0xbe2f('0x75')](_0xbe2f('0x76'),_0xbe2f('0x77'),_0x18fcff,JSON[_0xbe2f('0x78')](_0x40dada));delete _0x40dada[_0xbe2f('0x2d')];if(_0x18fcff===0x191){_0x18fcff=0x190;}_0x24eb0e[_0xbe2f('0x1e')](_0x18fcff)[_0xbe2f('0x79')](_0x370a4b[_0xbe2f('0x33')][_0xbe2f('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x40dada[_0xbe2f('0x7b')]}:_0x40dada);});}; \ No newline at end of file +var _0x59bc=['Connection','username','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','Subject','Description','string','int','picklist','boolean','email','phone','remove','includes','label','picklistValues','value','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','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','catch','show','params','find','create','body','update','destroy','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceConfiguration','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','securityToken','slice','lastIndexOf'];(function(_0x3c38b0,_0xe5302a){var _0x4612f9=function(_0x2da26e){while(--_0x2da26e){_0x3c38b0['push'](_0x3c38b0['shift']());}};_0x4612f9(++_0xe5302a);}(_0x59bc,0x11c));var _0xc59b=function(_0x125505,_0x18b643){_0x125505=_0x125505-0x0;var _0xe628a0=_0x59bc[_0x125505];return _0xe628a0;};'use strict';var emlformat=require(_0xc59b('0x0'));var rimraf=require(_0xc59b('0x1'));var zipdir=require(_0xc59b('0x2'));var jsonpatch=require(_0xc59b('0x3'));var rp=require(_0xc59b('0x4'));var moment=require('moment');var BPromise=require(_0xc59b('0x5'));var Mustache=require('mustache');var util=require(_0xc59b('0x6'));var path=require('path');var sox=require(_0xc59b('0x7'));var csv=require(_0xc59b('0x8'));var ejs=require(_0xc59b('0x9'));var fs=require('fs');var fs_extra=require(_0xc59b('0xa'));var _=require(_0xc59b('0xb'));var squel=require(_0xc59b('0xc'));var crypto=require(_0xc59b('0xd'));var jsforce=require(_0xc59b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc59b('0x8'));var querystring=require(_0xc59b('0xf'));var Papa=require('papaparse');var Redis=require(_0xc59b('0x10'));var authService=require(_0xc59b('0x11'));var qs=require(_0xc59b('0x12'));var as=require(_0xc59b('0x13'));var hardwareService=require(_0xc59b('0x14'));var logger=require(_0xc59b('0x15'))(_0xc59b('0x16'));var utils=require(_0xc59b('0x17'));var config=require(_0xc59b('0x18'));var licenseUtil=require(_0xc59b('0x19'));var db=require(_0xc59b('0x1a'))['db'];var integrations=require(_0xc59b('0x1b'));function respondWithStatusCode(_0x32dc90,_0x3a8d06){_0x3a8d06=_0x3a8d06||0xcc;return function(_0x12a7ff){if(_0x12a7ff){return _0x32dc90[_0xc59b('0x1c')](_0x3a8d06);}return _0x32dc90[_0xc59b('0x1d')](_0x3a8d06)[_0xc59b('0x1e')]();};}function respondWithResult(_0x483d64,_0x125694){_0x125694=_0x125694||0xc8;return function(_0x1c1346){if(_0x1c1346){return _0x483d64['status'](_0x125694)[_0xc59b('0x1f')](_0x1c1346);}};}function respondWithFilteredResult(_0x40f3ad,_0x4f5db9){return function(_0x4f8072){if(_0x4f8072){var _0x264b86=typeof _0x4f5db9[_0xc59b('0x20')]===_0xc59b('0x21')&&typeof _0x4f5db9['limit']===_0xc59b('0x21');var _0x25b20d=_0x4f8072[_0xc59b('0x22')];var _0x2f993c=_0x264b86?0x0:_0x4f5db9['offset'];var _0x4857b5=_0x264b86?_0x4f8072[_0xc59b('0x22')]:_0x4f5db9['offset']+_0x4f5db9[_0xc59b('0x23')];var _0x321c32;if(_0x4857b5>=_0x25b20d){_0x4857b5=_0x25b20d;_0x321c32=0xc8;}else{_0x321c32=0xce;}_0x40f3ad[_0xc59b('0x1d')](_0x321c32);return _0x40f3ad[_0xc59b('0x24')]('Content-Range',_0x2f993c+'-'+_0x4857b5+'/'+_0x25b20d)['json'](_0x4f8072);}return null;};}function patchUpdates(_0x636506){return function(_0xa2324a){try{jsonpatch[_0xc59b('0x25')](_0xa2324a,_0x636506,!![]);}catch(_0x4c8058){return BPromise[_0xc59b('0x26')](_0x4c8058);}return _0xa2324a[_0xc59b('0x27')]();};}function saveUpdates(_0x1968fa,_0x361c6b){return function(_0x2ae1df){if(_0x2ae1df){return _0x2ae1df['update'](_0x1968fa)['then'](function(_0x41c2d8){return _0x41c2d8;});}return null;};}function removeEntity(_0x374b0d,_0x6d7f09){return function(_0x82eabd){if(_0x82eabd){return _0x82eabd['destroy']()[_0xc59b('0x28')](function(){_0x374b0d[_0xc59b('0x1d')](0xcc)[_0xc59b('0x1e')]();});}};}function handleEntityNotFound(_0x190ff0,_0x54465c){return function(_0x420ef9){if(!_0x420ef9){_0x190ff0[_0xc59b('0x1c')](0x194);}return _0x420ef9;};}function handleError(_0x4bf51f,_0xdf70b5){_0xdf70b5=_0xdf70b5||0x1f4;return function(_0x2a060e){logger['error'](_0x2a060e[_0xc59b('0x29')]);if(_0x2a060e[_0xc59b('0x2a')]){delete _0x2a060e['name'];}_0x4bf51f[_0xc59b('0x1d')](_0xdf70b5)[_0xc59b('0x2b')](_0x2a060e);};}exports[_0xc59b('0x2c')]=function(_0x560c65,_0x1d391c){var _0x3ea9f7={},_0x217e46={},_0x137f87={'count':0x0,'rows':[]};var _0x104611=_[_0xc59b('0x2d')](db['SalesforceAccount'][_0xc59b('0x2e')],function(_0x2b2a9d){return{'name':_0x2b2a9d[_0xc59b('0x2f')],'type':_0x2b2a9d[_0xc59b('0x30')][_0xc59b('0x31')]};});_0x217e46['model']=_[_0xc59b('0x2d')](_0x104611,_0xc59b('0x2a'));_0x217e46[_0xc59b('0x32')]=_[_0xc59b('0x33')](_0x560c65[_0xc59b('0x32')]);_0x217e46['filters']=_[_0xc59b('0x34')](_0x217e46['model'],_0x217e46[_0xc59b('0x32')]);_0x3ea9f7['attributes']=_['intersection'](_0x217e46[_0xc59b('0x35')],qs[_0xc59b('0x36')](_0x560c65[_0xc59b('0x32')]['fields']));_0x3ea9f7[_0xc59b('0x37')]=_0x3ea9f7[_0xc59b('0x37')][_0xc59b('0x38')]?_0x3ea9f7['attributes']:_0x217e46[_0xc59b('0x35')];if(!_0x560c65[_0xc59b('0x32')]['hasOwnProperty'](_0xc59b('0x39'))){_0x3ea9f7['limit']=qs[_0xc59b('0x23')](_0x560c65[_0xc59b('0x32')][_0xc59b('0x23')]);_0x3ea9f7[_0xc59b('0x20')]=qs[_0xc59b('0x20')](_0x560c65[_0xc59b('0x32')][_0xc59b('0x20')]);}_0x3ea9f7[_0xc59b('0x3a')]=qs[_0xc59b('0x3b')](_0x560c65[_0xc59b('0x32')][_0xc59b('0x3b')]);_0x3ea9f7['where']=qs['filters'](_[_0xc59b('0x3c')](_0x560c65['query'],_0x217e46[_0xc59b('0x3d')]),_0x104611);if(_0x560c65[_0xc59b('0x32')][_0xc59b('0x3e')]){_0x3ea9f7[_0xc59b('0x3f')]=_[_0xc59b('0x40')](_0x3ea9f7['where'],{'$or':_[_0xc59b('0x2d')](_0x104611,function(_0x124262){if(_0x124262[_0xc59b('0x30')]!==_0xc59b('0x41')){var _0x35e602={};_0x35e602[_0x124262[_0xc59b('0x2a')]]={'$like':'%'+_0x560c65[_0xc59b('0x32')][_0xc59b('0x3e')]+'%'};return _0x35e602;}})});}_0x3ea9f7=_[_0xc59b('0x40')]({},_0x3ea9f7,_0x560c65[_0xc59b('0x42')]);var _0x5a59c4={'where':_0x3ea9f7[_0xc59b('0x3f')]};return db[_0xc59b('0x43')][_0xc59b('0x22')](_0x5a59c4)[_0xc59b('0x28')](function(_0x1576dc){_0x137f87[_0xc59b('0x22')]=_0x1576dc;if(_0x560c65['query'][_0xc59b('0x44')]){_0x3ea9f7[_0xc59b('0x45')]=[{'all':!![]}];}return db[_0xc59b('0x43')][_0xc59b('0x46')](_0x3ea9f7);})[_0xc59b('0x28')](function(_0x4b6cef){_0x137f87['rows']=_0x4b6cef;return _0x137f87;})['then'](respondWithFilteredResult(_0x1d391c,_0x3ea9f7))[_0xc59b('0x47')](handleError(_0x1d391c,null));};exports[_0xc59b('0x48')]=function(_0x2172df,_0x331b25){var _0x2d2784={'raw':![],'where':{'id':_0x2172df[_0xc59b('0x49')]['id']}},_0x3e7b0e={};_0x3e7b0e['model']=_['keys'](db[_0xc59b('0x43')][_0xc59b('0x2e')]);_0x3e7b0e[_0xc59b('0x32')]=_[_0xc59b('0x33')](_0x2172df['query']);_0x3e7b0e[_0xc59b('0x3d')]=_[_0xc59b('0x34')](_0x3e7b0e[_0xc59b('0x35')],_0x3e7b0e[_0xc59b('0x32')]);_0x2d2784[_0xc59b('0x37')]=_[_0xc59b('0x34')](_0x3e7b0e[_0xc59b('0x35')],qs['fields'](_0x2172df[_0xc59b('0x32')][_0xc59b('0x36')]));_0x2d2784[_0xc59b('0x37')]=_0x2d2784[_0xc59b('0x37')][_0xc59b('0x38')]?_0x2d2784[_0xc59b('0x37')]:_0x3e7b0e[_0xc59b('0x35')];if(_0x2172df[_0xc59b('0x32')][_0xc59b('0x44')]){_0x2d2784[_0xc59b('0x45')]=[{'all':!![]}];}_0x2d2784=_[_0xc59b('0x40')]({},_0x2d2784,_0x2172df[_0xc59b('0x42')]);return db['SalesforceAccount'][_0xc59b('0x4a')](_0x2d2784)[_0xc59b('0x28')](handleEntityNotFound(_0x331b25,null))[_0xc59b('0x28')](respondWithResult(_0x331b25,null))[_0xc59b('0x47')](handleError(_0x331b25,null));};exports[_0xc59b('0x4b')]=function(_0x319c33,_0x2e02ad){return db['SalesforceAccount'][_0xc59b('0x4b')](_0x319c33[_0xc59b('0x4c')],{})['then'](respondWithResult(_0x2e02ad,0xc9))[_0xc59b('0x47')](handleError(_0x2e02ad,null));};exports[_0xc59b('0x4d')]=function(_0x4fb11a,_0x1da503){if(_0x4fb11a['body']['id']){delete _0x4fb11a[_0xc59b('0x4c')]['id'];}return db[_0xc59b('0x43')]['find']({'where':{'id':_0x4fb11a[_0xc59b('0x49')]['id']}})[_0xc59b('0x28')](handleEntityNotFound(_0x1da503,null))[_0xc59b('0x28')](saveUpdates(_0x4fb11a[_0xc59b('0x4c')],null))[_0xc59b('0x28')](respondWithResult(_0x1da503,null))[_0xc59b('0x47')](handleError(_0x1da503,null));};exports[_0xc59b('0x4e')]=function(_0x5b4ed7,_0x4dbc96){return db[_0xc59b('0x43')]['find']({'where':{'id':_0x5b4ed7[_0xc59b('0x49')]['id']}})[_0xc59b('0x28')](handleEntityNotFound(_0x4dbc96,null))[_0xc59b('0x28')](removeEntity(_0x4dbc96,null))['catch'](handleError(_0x4dbc96,null));};exports[_0xc59b('0x4f')]=function(_0x5174bf,_0x5b55bf,_0x1b72bc){var _0x107d56={};var _0x604efe={};var _0x31b6f1;var _0x3d2eea;return db[_0xc59b('0x43')]['findOne']({'where':{'id':_0x5174bf[_0xc59b('0x49')]['id']}})[_0xc59b('0x28')](handleEntityNotFound(_0x5b55bf,null))[_0xc59b('0x28')](function(_0x3d5b22){if(_0x3d5b22){_0x31b6f1=_0x3d5b22;_0x604efe[_0xc59b('0x35')]=_[_0xc59b('0x33')](db['SalesforceConfiguration'][_0xc59b('0x2e')]);_0x604efe[_0xc59b('0x32')]=_[_0xc59b('0x33')](_0x5174bf[_0xc59b('0x32')]);_0x604efe[_0xc59b('0x3d')]=_['intersection'](_0x604efe[_0xc59b('0x35')],_0x604efe[_0xc59b('0x32')]);_0x107d56[_0xc59b('0x37')]=_[_0xc59b('0x34')](_0x604efe[_0xc59b('0x35')],qs[_0xc59b('0x36')](_0x5174bf['query'][_0xc59b('0x36')]));_0x107d56[_0xc59b('0x37')]=_0x107d56[_0xc59b('0x37')][_0xc59b('0x38')]?_0x107d56['attributes']:_0x604efe[_0xc59b('0x35')];_0x107d56[_0xc59b('0x3a')]=qs[_0xc59b('0x3b')](_0x5174bf[_0xc59b('0x32')][_0xc59b('0x3b')]);_0x107d56[_0xc59b('0x3f')]=qs[_0xc59b('0x3d')](_[_0xc59b('0x3c')](_0x5174bf[_0xc59b('0x32')],_0x604efe['filters']));if(_0x5174bf[_0xc59b('0x32')]['filter']){_0x107d56['where']=_['merge'](_0x107d56[_0xc59b('0x3f')],{'$or':_[_0xc59b('0x2d')](_0x107d56[_0xc59b('0x37')],function(_0x285e20){var _0x1dc0a3={};_0x1dc0a3[_0x285e20]={'$like':'%'+_0x5174bf[_0xc59b('0x32')][_0xc59b('0x3e')]+'%'};return _0x1dc0a3;})});}_0x107d56=_['merge']({},_0x107d56,_0x5174bf['options']);return _0x31b6f1[_0xc59b('0x4f')](_0x107d56);}})['then'](function(_0x721c4){if(_0x721c4){_0x3d2eea=_0x721c4[_0xc59b('0x38')];if(!_0x5174bf['query'][_0xc59b('0x50')]('nolimit')){_0x107d56[_0xc59b('0x23')]=qs[_0xc59b('0x23')](_0x5174bf[_0xc59b('0x32')][_0xc59b('0x23')]);_0x107d56[_0xc59b('0x20')]=qs[_0xc59b('0x20')](_0x5174bf[_0xc59b('0x32')][_0xc59b('0x20')]);}return _0x31b6f1[_0xc59b('0x4f')](_0x107d56);}})['then'](function(_0x4e281c){if(_0x4e281c){return _0x4e281c?{'count':_0x3d2eea,'rows':_0x4e281c}:null;}})[_0xc59b('0x28')](respondWithResult(_0x5b55bf,null))['catch'](handleError(_0x5b55bf,null));};exports[_0xc59b('0x51')]=function(_0x42a18e,_0x2b1c99,_0x67c3b4){if(_0x42a18e[_0xc59b('0x4c')]['id']){delete _0x42a18e['body']['id'];}return db[_0xc59b('0x43')]['findOne']({'where':{'id':_0x42a18e[_0xc59b('0x49')]['id']}})[_0xc59b('0x28')](handleEntityNotFound(_0x2b1c99,null))[_0xc59b('0x28')](function(_0x5abc51){if(_0x5abc51){_0x42a18e[_0xc59b('0x4c')][_0xc59b('0x52')]=_0x5abc51['id'];_0x42a18e['body'][_0xc59b('0x53')]=integrations[_0xc59b('0x54')](_0x42a18e[_0xc59b('0x4c')]['channel'],_0x42a18e[_0xc59b('0x4c')][_0xc59b('0x30')]);_0x42a18e[_0xc59b('0x4c')]['Descriptions']=integrations['getDescriptions'](_0x42a18e['body'][_0xc59b('0x55')],_0x42a18e[_0xc59b('0x4c')]['type']);return db[_0xc59b('0x56')][_0xc59b('0x4b')](_0x42a18e['body'],{'include':[{'model':db['SalesforceField'],'as':_0xc59b('0x53')},{'model':db[_0xc59b('0x57')],'as':_0xc59b('0x58')}]});}return null;})['then'](respondWithResult(_0x2b1c99,null))[_0xc59b('0x47')](handleError(_0x2b1c99,null));};exports[_0xc59b('0x59')]=function(_0xa7eae9,_0x1a7813,_0x522584){var _0x3496c7;var _0x3d453e='';var _0x540e56=_0xc59b('0x5a');return db['SalesforceAccount']['findOne']({'where':{'id':_0xa7eae9['params']['id']},'attributes':['id',_0xc59b('0x5b'),_0xc59b('0x5c'),_0xc59b('0x5d'),'username','password',_0xc59b('0x5e')]})[_0xc59b('0x28')](handleEntityNotFound(_0x1a7813,null))[_0xc59b('0x28')](function(_0x2d90f5){if(_0x2d90f5){_0x3d453e=_0x2d90f5[_0xc59b('0x5b')];var _0x9b92e8=_0x3d453e[_0xc59b('0x5f')](-0x1);if(_0x9b92e8==='/'){_0x3d453e=_0x3d453e['substring'](0x0,_0x3d453e[_0xc59b('0x60')](_0x9b92e8));}_0x3496c7=new jsforce[(_0xc59b('0x61'))]({'oauth2':{'loginUrl':_0x3d453e,'clientId':_0x2d90f5[_0xc59b('0x5c')],'clientSecret':_0x2d90f5[_0xc59b('0x5d')]}});return _0x3496c7['login'](_0x2d90f5[_0xc59b('0x62')],_0x2d90f5['password'][_0xc59b('0x63')](_0x2d90f5[_0xc59b('0x5e')]));}})['then'](function(_0x541611){if(_0x541611){if(!_['isNil'](_0xa7eae9[_0xc59b('0x32')][_0xc59b('0x64')])){_0x540e56=_0xa7eae9[_0xc59b('0x32')]['ticketType'];}return _0x3496c7[_0xc59b('0x65')](_0x540e56)['describe']();}})[_0xc59b('0x28')](function(_0x13a902){var _0x126cdf=[_0xc59b('0x66'),_0xc59b('0x67'),_0xc59b('0x68'),'IsRecurrence',_0xc59b('0x69'),_0xc59b('0x6a')];var _0x2f3993=[_0xc59b('0x6b'),_0xc59b('0x6c'),_0xc59b('0x6d'),_0xc59b('0x6e'),_0xc59b('0x6f'),'textarea',_0xc59b('0x70')];if(_0x13a902){_[_0xc59b('0x71')](_0x13a902[_0xc59b('0x36')],function(_0x9c07cb){return _0x126cdf['includes'](_0x9c07cb[_0xc59b('0x2a')])||!_0x2f3993[_0xc59b('0x72')](_0x9c07cb[_0xc59b('0x30')]);});return{'count':_0x13a902[_0xc59b('0x36')][_0xc59b('0x38')],'rows':_['map'](_0x13a902[_0xc59b('0x36')],function(_0x6705cb){return{'id':_0x6705cb[_0xc59b('0x2a')],'name':_0x6705cb[_0xc59b('0x73')],'custom':_0x6705cb['custom'],'options':_0x6705cb[_0xc59b('0x74')][_0xc59b('0x38')]>0x0?_[_0xc59b('0x2d')](_0x6705cb['picklistValues'],function(_0x52c85f){return{'name':_0x52c85f[_0xc59b('0x73')],'value':_0x52c85f[_0xc59b('0x75')]};}):_0x6705cb['type']==_0xc59b('0x6e')?[{'name':_0xc59b('0x76'),'value':_0xc59b('0x77')},{'name':_0xc59b('0x78'),'value':_0xc59b('0x79')}]:[]};})};}})[_0xc59b('0x28')](respondWithResult(_0x1a7813,null))[_0xc59b('0x47')](function(_0x4a6393){var _0x1fe3e1=_0xa7eae9[_0xc59b('0x32')][_0xc59b('0x7a')]?0x1f4:_0x4a6393[_0xc59b('0x7b')]||0x1f4;logger['error'](_0xc59b('0x7c'),_0xc59b('0x59'),_0x1fe3e1,JSON[_0xc59b('0x7d')](_0x4a6393));delete _0x4a6393[_0xc59b('0x2a')];if(_0x1fe3e1===0x191){_0x1fe3e1=0x190;}_0x1a7813[_0xc59b('0x1d')](_0x1fe3e1)[_0xc59b('0x2b')](_0xa7eae9[_0xc59b('0x32')][_0xc59b('0x7a')]?{'message':_0xc59b('0x7e'),'statusCode':_0x4a6393[_0xc59b('0x7b')]}:_0x4a6393);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index b9b65b2..7536f26 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 _0xf491=['lodash','util','../../config/logger','bluebird','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration'];(function(_0x47dd5c,_0x1df546){var _0x36aa98=function(_0x3029e3){while(--_0x3029e3){_0x47dd5c['push'](_0x47dd5c['shift']());}};_0x36aa98(++_0x1df546);}(_0xf491,0x178));var _0x1f49=function(_0x3d1fdc,_0x28b2bc){_0x3d1fdc=_0x3d1fdc-0x0;var _0xffbd83=_0xf491[_0x3d1fdc];return _0xffbd83;};'use strict';var _=require(_0x1f49('0x0'));var util=require(_0x1f49('0x1'));var logger=require(_0x1f49('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1f49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f49('0x4'));var rimraf=require('rimraf');var config=require(_0x1f49('0x5'));var attributes=require(_0x1f49('0x6'));var integrations=require(_0x1f49('0x7'));module['exports']=function(_0x4c04bb,_0xe91160){return _0x4c04bb['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe51b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x5a2199,_0x5bebe6){var _0xe34487=function(_0x1d5871){while(--_0x1d5871){_0x5a2199['push'](_0x5a2199['shift']());}};_0xe34487(++_0x5bebe6);}(_0xe51b,0x177));var _0xbe51=function(_0x3cd025,_0x1e2adf){_0x3cd025=_0x3cd025-0x0;var _0xaa86eb=_0xe51b[_0x3cd025];return _0xaa86eb;};'use strict';var _=require(_0xbe51('0x0'));var util=require(_0xbe51('0x1'));var logger=require(_0xbe51('0x2'))(_0xbe51('0x3'));var moment=require(_0xbe51('0x4'));var BPromise=require(_0xbe51('0x5'));var rp=require(_0xbe51('0x6'));var fs=require('fs');var path=require(_0xbe51('0x7'));var rimraf=require(_0xbe51('0x8'));var config=require(_0xbe51('0x9'));var attributes=require(_0xbe51('0xa'));var integrations=require(_0xbe51('0xb'));module['exports']=function(_0xef2c01,_0x352060){return _0xef2c01[_0xbe51('0xc')](_0xbe51('0xd'),attributes,{'tableName':_0xbe51('0xe'),'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 a62d4cb..36c8f80 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 _0x5595=['error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0xfd2af3,_0x5bbb2b){var _0x142339=function(_0x415ac1){while(--_0x415ac1){_0xfd2af3['push'](_0xfd2af3['shift']());}};_0x142339(++_0x5bbb2b);}(_0x5595,0x1d9));var _0x5559=function(_0x23b68a,_0x2c8946){_0x23b68a=_0x23b68a-0x0;var _0x3ee031=_0x5595[_0x23b68a];return _0x3ee031;};'use strict';var _=require(_0x5559('0x0'));var util=require(_0x5559('0x1'));var moment=require('moment');var BPromise=require(_0x5559('0x2'));var rs=require(_0x5559('0x3'));var fs=require('fs');var Redis=require(_0x5559('0x4'));var db=require(_0x5559('0x5'))['db'];var utils=require(_0x5559('0x6'));var logger=require(_0x5559('0x7'))('rpc');var config=require(_0x5559('0x8'));var jayson=require(_0x5559('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x294172,_0x36eaa3,_0x43cb7d){return new BPromise(function(_0xcbee2c,_0xd34fb7){return client[_0x5559('0xa')](_0x294172,_0x43cb7d)[_0x5559('0xb')](function(_0x81a550){logger[_0x5559('0xc')](_0x5559('0xd'),_0x36eaa3,'request\x20sent');logger[_0x5559('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x36eaa3,_0x5559('0xf'),JSON[_0x5559('0x10')](_0x81a550));if(_0x81a550[_0x5559('0x11')]){if(_0x81a550[_0x5559('0x11')][_0x5559('0x12')]===0x1f4){logger[_0x5559('0x11')](_0x5559('0xd'),_0x36eaa3,_0x81a550[_0x5559('0x11')][_0x5559('0x13')]);return _0xd34fb7(_0x81a550['error'][_0x5559('0x13')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x36eaa3,_0x81a550[_0x5559('0x11')][_0x5559('0x13')]);return _0xcbee2c(_0x81a550[_0x5559('0x11')][_0x5559('0x13')]);}else{logger['info'](_0x5559('0xd'),_0x36eaa3,_0x5559('0xf'));_0xcbee2c(_0x81a550[_0x5559('0x14')][_0x5559('0x13')]);}})[_0x5559('0x15')](function(_0x35b464){logger[_0x5559('0x11')](_0x5559('0xd'),_0x36eaa3,_0x35b464);_0xd34fb7(_0x35b464);});});}exports[_0x5559('0x16')]=function(_0x154f08){var _0x4ca122=this;return new Promise(function(_0x58b110,_0x1c3139){return db[_0x5559('0x17')][_0x5559('0x18')]({'raw':_0x154f08[_0x5559('0x19')]?_0x154f08[_0x5559('0x19')][_0x5559('0x1a')]===undefined?!![]:![]:!![],'where':_0x154f08[_0x5559('0x19')]?_0x154f08[_0x5559('0x19')][_0x5559('0x1b')]||null:null,'attributes':_0x154f08['options']?_0x154f08[_0x5559('0x19')][_0x5559('0x1c')]||null:null,'limit':_0x154f08[_0x5559('0x19')]?_0x154f08[_0x5559('0x19')][_0x5559('0x1d')]||null:null,'include':_0x154f08['options']?_0x154f08[_0x5559('0x19')][_0x5559('0x1e')]?_[_0x5559('0x1f')](_0x154f08[_0x5559('0x19')][_0x5559('0x1e')],function(_0x184d03){return{'model':db[_0x184d03[_0x5559('0x20')]],'as':_0x184d03['as'],'attributes':_0x184d03['attributes'],'include':_0x184d03[_0x5559('0x1e')]?_['map'](_0x184d03[_0x5559('0x1e')],function(_0x3dda80){return{'model':db[_0x3dda80['model']],'as':_0x3dda80['as'],'attributes':_0x3dda80[_0x5559('0x1c')],'include':_0x3dda80['include']?_[_0x5559('0x1f')](_0x3dda80[_0x5559('0x1e')],function(_0x98d662){return{'model':db[_0x98d662[_0x5559('0x20')]],'as':_0x98d662['as'],'attributes':_0x98d662[_0x5559('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x31b48b){logger['info'](_0x5559('0x16'),_0x154f08);logger[_0x5559('0xe')](_0x5559('0x16'),_0x154f08,JSON[_0x5559('0x10')](_0x31b48b));_0x58b110(_0x31b48b);})[_0x5559('0x15')](function(_0x4ca990){logger['error']('GetSalesforceAccount',_0x4ca990['message'],_0x154f08);_0x1c3139(_0x4ca122[_0x5559('0x11')](0x1f4,_0x4ca990['message']));});});};exports[_0x5559('0x21')]=function(_0x5662fd){var _0x153044=this;return new Promise(function(_0x4d9bf1,_0x38a62e){return db['SalesforceAccount'][_0x5559('0x22')]({'raw':_0x5662fd[_0x5559('0x19')]?_0x5662fd['options'][_0x5559('0x1a')]===undefined?!![]:![]:!![],'where':_0x5662fd[_0x5559('0x19')]?_0x5662fd[_0x5559('0x19')][_0x5559('0x1b')]||null:null,'attributes':_0x5662fd[_0x5559('0x19')]?_0x5662fd[_0x5559('0x19')][_0x5559('0x1c')]||null:null,'include':_0x5662fd[_0x5559('0x19')]?_0x5662fd[_0x5559('0x19')]['include']?_[_0x5559('0x1f')](_0x5662fd[_0x5559('0x19')][_0x5559('0x1e')],function(_0x3d52bf){return{'model':db[_0x3d52bf[_0x5559('0x20')]],'as':_0x3d52bf['as'],'attributes':_0x3d52bf[_0x5559('0x1c')],'include':_0x3d52bf['include']?_['map'](_0x3d52bf[_0x5559('0x1e')],function(_0x17d70e){return{'model':db[_0x17d70e['model']],'as':_0x17d70e['as'],'attributes':_0x17d70e[_0x5559('0x1c')],'include':_0x17d70e['include']?_['map'](_0x17d70e[_0x5559('0x1e')],function(_0x1edb7f){return{'model':db[_0x1edb7f[_0x5559('0x20')]],'as':_0x1edb7f['as'],'attributes':_0x1edb7f[_0x5559('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5559('0xb')](function(_0x3473de){logger[_0x5559('0xc')](_0x5559('0x21'),_0x5662fd);logger[_0x5559('0xe')]('ShowSalesforceAccount',_0x5662fd,JSON[_0x5559('0x10')](_0x3473de));_0x4d9bf1(_0x3473de);})[_0x5559('0x15')](function(_0x5486a5){logger[_0x5559('0x11')](_0x5559('0x21'),_0x5486a5[_0x5559('0x13')],_0x5662fd);_0x38a62e(_0x153044['error'](0x1f4,_0x5486a5[_0x5559('0x13')]));});});}; \ No newline at end of file +var _0x38b8=['ShowSalesforceAccount','raw','info','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','map','model'];(function(_0x45bf48,_0x5dd33e){var _0x5299a0=function(_0x7f8235){while(--_0x7f8235){_0x45bf48['push'](_0x45bf48['shift']());}};_0x5299a0(++_0x5dd33e);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x838b('0x0'));var util=require('util');var moment=require(_0x838b('0x1'));var BPromise=require(_0x838b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x838b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x838b('0x4'))(_0x838b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x838b('0x6')][_0x838b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c516c,_0x2d3e96,_0x15184b){return new BPromise(function(_0x4b9530,_0x552245){return client[_0x838b('0x8')](_0x5c516c,_0x15184b)[_0x838b('0x9')](function(_0x31ba84){logger['info'](_0x838b('0xa'),_0x2d3e96,'request\x20sent');logger[_0x838b('0xb')](_0x838b('0xc'),_0x2d3e96,_0x838b('0xd'),JSON[_0x838b('0xe')](_0x31ba84));if(_0x31ba84[_0x838b('0xf')]){if(_0x31ba84[_0x838b('0xf')]['code']===0x1f4){logger[_0x838b('0xf')](_0x838b('0xa'),_0x2d3e96,_0x31ba84[_0x838b('0xf')][_0x838b('0x10')]);return _0x552245(_0x31ba84[_0x838b('0xf')][_0x838b('0x10')]);}logger[_0x838b('0xf')](_0x838b('0xa'),_0x2d3e96,_0x31ba84[_0x838b('0xf')]['message']);return _0x4b9530(_0x31ba84[_0x838b('0xf')]['message']);}else{logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2d3e96,_0x838b('0xd'));_0x4b9530(_0x31ba84[_0x838b('0x11')][_0x838b('0x10')]);}})[_0x838b('0x12')](function(_0x94e893){logger['error'](_0x838b('0xa'),_0x2d3e96,_0x94e893);_0x552245(_0x94e893);});});}exports[_0x838b('0x13')]=function(_0x44a62c){var _0x1e4f5f=this;return new Promise(function(_0x48c4ab,_0x1163ff){return db[_0x838b('0x14')]['findAll']({'raw':_0x44a62c[_0x838b('0x15')]?_0x44a62c[_0x838b('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x44a62c[_0x838b('0x15')]?_0x44a62c[_0x838b('0x15')][_0x838b('0x16')]||null:null,'attributes':_0x44a62c['options']?_0x44a62c[_0x838b('0x15')][_0x838b('0x17')]||null:null,'limit':_0x44a62c[_0x838b('0x15')]?_0x44a62c[_0x838b('0x15')][_0x838b('0x18')]||null:null,'include':_0x44a62c[_0x838b('0x15')]?_0x44a62c[_0x838b('0x15')][_0x838b('0x19')]?_[_0x838b('0x1a')](_0x44a62c[_0x838b('0x15')][_0x838b('0x19')],function(_0xba76){return{'model':db[_0xba76[_0x838b('0x1b')]],'as':_0xba76['as'],'attributes':_0xba76[_0x838b('0x17')],'include':_0xba76['include']?_[_0x838b('0x1a')](_0xba76['include'],function(_0x51adc6){return{'model':db[_0x51adc6[_0x838b('0x1b')]],'as':_0x51adc6['as'],'attributes':_0x51adc6[_0x838b('0x17')],'include':_0x51adc6[_0x838b('0x19')]?_['map'](_0x51adc6[_0x838b('0x19')],function(_0x27f385){return{'model':db[_0x27f385['model']],'as':_0x27f385['as'],'attributes':_0x27f385[_0x838b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x838b('0x9')](function(_0x59fa16){logger['info']('GetSalesforceAccount',_0x44a62c);logger['debug']('GetSalesforceAccount',_0x44a62c,JSON['stringify'](_0x59fa16));_0x48c4ab(_0x59fa16);})[_0x838b('0x12')](function(_0x227876){logger['error']('GetSalesforceAccount',_0x227876[_0x838b('0x10')],_0x44a62c);_0x1163ff(_0x1e4f5f[_0x838b('0xf')](0x1f4,_0x227876[_0x838b('0x10')]));});});};exports[_0x838b('0x1c')]=function(_0x16c081){var _0x3c6c08=this;return new Promise(function(_0xc7b054,_0x3ebc0c){return db[_0x838b('0x14')]['find']({'raw':_0x16c081[_0x838b('0x15')]?_0x16c081[_0x838b('0x15')][_0x838b('0x1d')]===undefined?!![]:![]:!![],'where':_0x16c081[_0x838b('0x15')]?_0x16c081['options'][_0x838b('0x16')]||null:null,'attributes':_0x16c081[_0x838b('0x15')]?_0x16c081[_0x838b('0x15')][_0x838b('0x17')]||null:null,'include':_0x16c081[_0x838b('0x15')]?_0x16c081['options'][_0x838b('0x19')]?_[_0x838b('0x1a')](_0x16c081[_0x838b('0x15')][_0x838b('0x19')],function(_0x489637){return{'model':db[_0x489637[_0x838b('0x1b')]],'as':_0x489637['as'],'attributes':_0x489637[_0x838b('0x17')],'include':_0x489637['include']?_[_0x838b('0x1a')](_0x489637[_0x838b('0x19')],function(_0x277bb0){return{'model':db[_0x277bb0[_0x838b('0x1b')]],'as':_0x277bb0['as'],'attributes':_0x277bb0[_0x838b('0x17')],'include':_0x277bb0['include']?_[_0x838b('0x1a')](_0x277bb0[_0x838b('0x19')],function(_0x5e42ad){return{'model':db[_0x5e42ad[_0x838b('0x1b')]],'as':_0x5e42ad['as'],'attributes':_0x5e42ad['attributes']};}):[]};}):[]};}):[]:[]})[_0x838b('0x9')](function(_0x57931c){logger[_0x838b('0x1e')]('ShowSalesforceAccount',_0x16c081);logger[_0x838b('0xb')](_0x838b('0x1c'),_0x16c081,JSON[_0x838b('0xe')](_0x57931c));_0xc7b054(_0x57931c);})[_0x838b('0x12')](function(_0x476db0){logger[_0x838b('0xf')](_0x838b('0x1c'),_0x476db0[_0x838b('0x10')],_0x16c081);_0x3ebc0c(_0x3c6c08[_0x838b('0xf')](0x1f4,_0x476db0[_0x838b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 397f456..63b777a 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x45563c,_0x3c918c){var _0x2b1c84=function(_0x21e9e6){while(--_0x21e9e6){_0x45563c['push'](_0x45563c['shift']());}};_0x2b1c84(++_0x3c918c);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f270b,_0x6d65e3){_0x2f270b=_0x2f270b-0x0;var _0x9069b2=_0x2ef3[_0x2f270b];return _0x9069b2;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x57b823,_0x3e5075){var _0x5770b5=function(_0x225749){while(--_0x225749){_0x57b823['push'](_0x57b823['shift']());}};_0x5770b5(++_0x3e5075);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 9afe36e..a7baec7 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 _0x0fab=['exports','STRING','ENUM','Case','contact','lead','account','contact_lead','nothing','sequelize'];(function(_0x2918e8,_0xf2f0fe){var _0x596d51=function(_0x1382d9){while(--_0x1382d9){_0x2918e8['push'](_0x2918e8['shift']());}};_0x596d51(++_0xf2f0fe);}(_0x0fab,0x153));var _0xb0fa=function(_0x20425c,_0x347566){_0x20425c=_0x20425c-0x0;var _0x419791=_0x0fab[_0x20425c];return _0x419791;};'use strict';var Sequelize=require(_0xb0fa('0x0'));module[_0xb0fa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb0fa('0x2')]},'ticketType':{'type':Sequelize[_0xb0fa('0x3')]('Task',_0xb0fa('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xb0fa('0x3')]('contact_lead',_0xb0fa('0x5'),_0xb0fa('0x6'),'account_contact_lead',_0xb0fa('0x7')),'defaultValue':_0xb0fa('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0xb0fa('0x9'),'contact','lead',_0xb0fa('0x7')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xb0fa('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xb0fa('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xb0fa('0x2')]}}; \ No newline at end of file +var _0x6881=['contact','lead','contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task','Case'];(function(_0x9be28f,_0x231334){var _0xa9f52d=function(_0x239dad){while(--_0x239dad){_0x9be28f['push'](_0x9be28f['shift']());}};_0xa9f52d(++_0x231334);}(_0x6881,0x1bd));var _0x1688=function(_0x1a7610,_0x558b3e){_0x1a7610=_0x1a7610-0x0;var _0x5a45d7=_0x6881[_0x1a7610];return _0x5a45d7;};'use strict';var Sequelize=require(_0x1688('0x0'));module[_0x1688('0x1')]={'name':{'type':Sequelize[_0x1688('0x2')]},'description':{'type':Sequelize[_0x1688('0x2')]},'ticketType':{'type':Sequelize[_0x1688('0x3')](_0x1688('0x4'),_0x1688('0x5')),'defaultValue':_0x1688('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x1688('0x6'),_0x1688('0x7'),'account_contact_lead','account'),'defaultValue':_0x1688('0x8')},'moduleCreate':{'type':Sequelize[_0x1688('0x3')](_0x1688('0x9'),_0x1688('0x6'),'lead',_0x1688('0xa')),'defaultValue':_0x1688('0x7')},'leadId':{'type':Sequelize[_0x1688('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x1688('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x1688('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x1688('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 06a726f..e24b729 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 _0x441a=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','findOne','SalesforceField','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0x441a,0x1df));var _0xa441=function(_0x277107,_0x3420dc){_0x277107=_0x277107-0x0;var _0x1da046=_0x441a[_0x277107];return _0x1da046;};'use strict';var emlformat=require(_0xa441('0x0'));var rimraf=require(_0xa441('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa441('0x2'));var rp=require('request-promise');var moment=require(_0xa441('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa441('0x4'));var util=require(_0xa441('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa441('0x6'));var ejs=require(_0xa441('0x7'));var fs=require('fs');var fs_extra=require(_0xa441('0x8'));var _=require(_0xa441('0x9'));var squel=require(_0xa441('0xa'));var crypto=require(_0xa441('0xb'));var jsforce=require(_0xa441('0xc'));var deskjs=require(_0xa441('0xd'));var toCsv=require(_0xa441('0x6'));var querystring=require(_0xa441('0xe'));var Papa=require(_0xa441('0xf'));var Redis=require(_0xa441('0x10'));var authService=require(_0xa441('0x11'));var qs=require(_0xa441('0x12'));var as=require(_0xa441('0x13'));var hardwareService=require(_0xa441('0x14'));var logger=require('../../config/logger')(_0xa441('0x15'));var utils=require('../../config/utils');var config=require(_0xa441('0x16'));var licenseUtil=require(_0xa441('0x17'));var db=require(_0xa441('0x18'))['db'];function respondWithStatusCode(_0x383b09,_0x3c3640){_0x3c3640=_0x3c3640||0xcc;return function(_0x58cb00){if(_0x58cb00){return _0x383b09[_0xa441('0x19')](_0x3c3640);}return _0x383b09[_0xa441('0x1a')](_0x3c3640)[_0xa441('0x1b')]();};}function respondWithResult(_0x495504,_0x587932){_0x587932=_0x587932||0xc8;return function(_0x111b55){if(_0x111b55){return _0x495504[_0xa441('0x1a')](_0x587932)[_0xa441('0x1c')](_0x111b55);}};}function respondWithFilteredResult(_0xcf5bd1,_0x470f60){return function(_0x36c2d8){if(_0x36c2d8){var _0x2b20f7=typeof _0x470f60[_0xa441('0x1d')]===_0xa441('0x1e')&&typeof _0x470f60[_0xa441('0x1f')]===_0xa441('0x1e');var _0x589533=_0x36c2d8[_0xa441('0x20')];var _0xa3e147=_0x2b20f7?0x0:_0x470f60[_0xa441('0x1d')];var _0x58898e=_0x2b20f7?_0x36c2d8[_0xa441('0x20')]:_0x470f60[_0xa441('0x1d')]+_0x470f60[_0xa441('0x1f')];var _0x5b1fd5;if(_0x58898e>=_0x589533){_0x58898e=_0x589533;_0x5b1fd5=0xc8;}else{_0x5b1fd5=0xce;}_0xcf5bd1[_0xa441('0x1a')](_0x5b1fd5);return _0xcf5bd1[_0xa441('0x21')](_0xa441('0x22'),_0xa3e147+'-'+_0x58898e+'/'+_0x589533)[_0xa441('0x1c')](_0x36c2d8);}return null;};}function patchUpdates(_0x25b45d){return function(_0x326b8b){try{jsonpatch[_0xa441('0x23')](_0x326b8b,_0x25b45d,!![]);}catch(_0x56ca17){return BPromise['reject'](_0x56ca17);}return _0x326b8b[_0xa441('0x24')]();};}function saveUpdates(_0x1fc5a2,_0x5ab5c5){return function(_0x5b3ad3){if(_0x5b3ad3){return _0x5b3ad3[_0xa441('0x25')](_0x1fc5a2)['then'](function(_0x5b1682){return _0x5b1682;});}return null;};}function removeEntity(_0x3dddc8,_0x3708d1){return function(_0x395400){if(_0x395400){return _0x395400['destroy']()[_0xa441('0x26')](function(){_0x3dddc8[_0xa441('0x1a')](0xcc)[_0xa441('0x1b')]();});}};}function handleEntityNotFound(_0x5718c5,_0x29d071){return function(_0x51a265){if(!_0x51a265){_0x5718c5[_0xa441('0x19')](0x194);}return _0x51a265;};}function handleError(_0x34a8e9,_0x28aa07){_0x28aa07=_0x28aa07||0x1f4;return function(_0x490e62){logger[_0xa441('0x27')](_0x490e62[_0xa441('0x28')]);if(_0x490e62['name']){delete _0x490e62[_0xa441('0x29')];}_0x34a8e9[_0xa441('0x1a')](_0x28aa07)[_0xa441('0x2a')](_0x490e62);};}exports[_0xa441('0x2b')]=function(_0x57b287,_0x2b2b1b){var _0x566b9e={},_0x1e68b9={},_0x41422e={'count':0x0,'rows':[]};var _0x99648b=_['map'](db[_0xa441('0x2c')][_0xa441('0x2d')],function(_0x524bdc){return{'name':_0x524bdc[_0xa441('0x2e')],'type':_0x524bdc[_0xa441('0x2f')][_0xa441('0x30')]};});_0x1e68b9[_0xa441('0x31')]=_[_0xa441('0x32')](_0x99648b,_0xa441('0x29'));_0x1e68b9[_0xa441('0x33')]=_[_0xa441('0x34')](_0x57b287[_0xa441('0x33')]);_0x1e68b9['filters']=_[_0xa441('0x35')](_0x1e68b9[_0xa441('0x31')],_0x1e68b9[_0xa441('0x33')]);_0x566b9e[_0xa441('0x36')]=_[_0xa441('0x35')](_0x1e68b9[_0xa441('0x31')],qs['fields'](_0x57b287['query'][_0xa441('0x37')]));_0x566b9e[_0xa441('0x36')]=_0x566b9e[_0xa441('0x36')][_0xa441('0x38')]?_0x566b9e['attributes']:_0x1e68b9[_0xa441('0x31')];if(!_0x57b287['query']['hasOwnProperty'](_0xa441('0x39'))){_0x566b9e[_0xa441('0x1f')]=qs[_0xa441('0x1f')](_0x57b287['query'][_0xa441('0x1f')]);_0x566b9e['offset']=qs[_0xa441('0x1d')](_0x57b287[_0xa441('0x33')][_0xa441('0x1d')]);}_0x566b9e[_0xa441('0x3a')]=qs[_0xa441('0x3b')](_0x57b287[_0xa441('0x33')]['sort']);_0x566b9e['where']=qs[_0xa441('0x3c')](_[_0xa441('0x3d')](_0x57b287[_0xa441('0x33')],_0x1e68b9[_0xa441('0x3c')]),_0x99648b);if(_0x57b287[_0xa441('0x33')][_0xa441('0x3e')]){_0x566b9e[_0xa441('0x3f')]=_['merge'](_0x566b9e['where'],{'$or':_[_0xa441('0x32')](_0x99648b,function(_0x2f2a7c){if(_0x2f2a7c[_0xa441('0x2f')]!==_0xa441('0x40')){var _0x5b14c7={};_0x5b14c7[_0x2f2a7c['name']]={'$like':'%'+_0x57b287[_0xa441('0x33')]['filter']+'%'};return _0x5b14c7;}})});}_0x566b9e=_[_0xa441('0x41')]({},_0x566b9e,_0x57b287[_0xa441('0x42')]);var _0x44d8f1={'where':_0x566b9e['where']};return db[_0xa441('0x2c')][_0xa441('0x20')](_0x44d8f1)[_0xa441('0x26')](function(_0x3a3b11){_0x41422e['count']=_0x3a3b11;if(_0x57b287[_0xa441('0x33')][_0xa441('0x43')]){_0x566b9e['include']=[{'all':!![]}];}return db[_0xa441('0x2c')][_0xa441('0x44')](_0x566b9e);})[_0xa441('0x26')](function(_0x1e2557){_0x41422e[_0xa441('0x45')]=_0x1e2557;return _0x41422e;})[_0xa441('0x26')](respondWithFilteredResult(_0x2b2b1b,_0x566b9e))[_0xa441('0x46')](handleError(_0x2b2b1b,null));};exports[_0xa441('0x47')]=function(_0x18cb0f,_0x1f8f6c){var _0x84ecd8={'raw':![],'where':{'id':_0x18cb0f[_0xa441('0x48')]['id']}},_0x109ee2={};_0x109ee2[_0xa441('0x31')]=_[_0xa441('0x34')](db[_0xa441('0x2c')][_0xa441('0x2d')]);_0x109ee2[_0xa441('0x33')]=_['keys'](_0x18cb0f['query']);_0x109ee2['filters']=_[_0xa441('0x35')](_0x109ee2[_0xa441('0x31')],_0x109ee2[_0xa441('0x33')]);_0x84ecd8[_0xa441('0x36')]=_[_0xa441('0x35')](_0x109ee2['model'],qs[_0xa441('0x37')](_0x18cb0f[_0xa441('0x33')][_0xa441('0x37')]));_0x84ecd8['attributes']=_0x84ecd8[_0xa441('0x36')]['length']?_0x84ecd8[_0xa441('0x36')]:_0x109ee2[_0xa441('0x31')];if(_0x18cb0f['query'][_0xa441('0x43')]){_0x84ecd8[_0xa441('0x49')]=[{'all':!![]}];}_0x84ecd8=_[_0xa441('0x41')]({},_0x84ecd8,_0x18cb0f[_0xa441('0x42')]);return db[_0xa441('0x2c')][_0xa441('0x4a')](_0x84ecd8)[_0xa441('0x26')](handleEntityNotFound(_0x1f8f6c,null))['then'](respondWithResult(_0x1f8f6c,null))['catch'](handleError(_0x1f8f6c,null));};exports[_0xa441('0x4b')]=function(_0x3f3017,_0x2b33d0){return db[_0xa441('0x2c')]['create'](_0x3f3017[_0xa441('0x4c')],{})[_0xa441('0x26')](respondWithResult(_0x2b33d0,0xc9))['catch'](handleError(_0x2b33d0,null));};exports[_0xa441('0x25')]=function(_0x4d01f1,_0x384985){if(_0x4d01f1['body']['id']){delete _0x4d01f1[_0xa441('0x4c')]['id'];}return db[_0xa441('0x2c')][_0xa441('0x4a')]({'where':{'id':_0x4d01f1[_0xa441('0x48')]['id']}})[_0xa441('0x26')](handleEntityNotFound(_0x384985,null))['then'](saveUpdates(_0x4d01f1['body'],null))[_0xa441('0x26')](respondWithResult(_0x384985,null))['catch'](handleError(_0x384985,null));};exports[_0xa441('0x4d')]=function(_0x39aa4c,_0x4aa06c){return db['SalesforceConfiguration']['find']({'where':{'id':_0x39aa4c[_0xa441('0x48')]['id']}})[_0xa441('0x26')](handleEntityNotFound(_0x4aa06c,null))[_0xa441('0x26')](removeEntity(_0x4aa06c,null))[_0xa441('0x46')](handleError(_0x4aa06c,null));};exports['getFields']=function(_0x227697,_0x5c37ce,_0x5f00b5){var _0x3ce395={};var _0x389fce={};var _0x53fdfc;var _0x24db93;return db[_0xa441('0x2c')][_0xa441('0x4e')]({'where':{'id':_0x227697[_0xa441('0x48')]['id']}})[_0xa441('0x26')](handleEntityNotFound(_0x5c37ce,null))[_0xa441('0x26')](function(_0x236e3d){if(_0x236e3d){_0x53fdfc=_0x236e3d;_0x389fce[_0xa441('0x31')]=_[_0xa441('0x34')](db[_0xa441('0x4f')][_0xa441('0x2d')]);_0x389fce['query']=_[_0xa441('0x34')](_0x227697['query']);_0x389fce['filters']=_['intersection'](_0x389fce[_0xa441('0x31')],_0x389fce['query']);_0x3ce395[_0xa441('0x36')]=_[_0xa441('0x35')](_0x389fce['model'],qs[_0xa441('0x37')](_0x227697[_0xa441('0x33')][_0xa441('0x37')]));_0x3ce395[_0xa441('0x36')]=_0x3ce395[_0xa441('0x36')]['length']?_0x3ce395[_0xa441('0x36')]:_0x389fce[_0xa441('0x31')];_0x3ce395['order']=qs[_0xa441('0x3b')](_0x227697[_0xa441('0x33')][_0xa441('0x3b')]);_0x3ce395[_0xa441('0x3f')]=qs['filters'](_[_0xa441('0x3d')](_0x227697[_0xa441('0x33')],_0x389fce[_0xa441('0x3c')]));if(_0x227697[_0xa441('0x33')][_0xa441('0x3e')]){_0x3ce395[_0xa441('0x3f')]=_[_0xa441('0x41')](_0x3ce395[_0xa441('0x3f')],{'$or':_['map'](_0x3ce395['attributes'],function(_0x2c9621){var _0x47818d={};_0x47818d[_0x2c9621]={'$like':'%'+_0x227697[_0xa441('0x33')][_0xa441('0x3e')]+'%'};return _0x47818d;})});}_0x3ce395=_['merge']({},_0x3ce395,_0x227697[_0xa441('0x42')]);return _0x53fdfc['getFields'](_0x3ce395);}})[_0xa441('0x26')](function(_0x5362f8){if(_0x5362f8){_0x24db93=_0x5362f8[_0xa441('0x38')];if(!_0x227697['query'][_0xa441('0x50')](_0xa441('0x39'))){_0x3ce395[_0xa441('0x1f')]=qs[_0xa441('0x1f')](_0x227697[_0xa441('0x33')][_0xa441('0x1f')]);_0x3ce395['offset']=qs[_0xa441('0x1d')](_0x227697[_0xa441('0x33')][_0xa441('0x1d')]);}return _0x53fdfc[_0xa441('0x51')](_0x3ce395);}})['then'](function(_0x178e1a){if(_0x178e1a){return _0x178e1a?{'count':_0x24db93,'rows':_0x178e1a}:null;}})['then'](respondWithResult(_0x5c37ce,null))[_0xa441('0x46')](handleError(_0x5c37ce,null));};exports[_0xa441('0x52')]=function(_0x57ae1a,_0x3b86b2,_0x1ed107){var _0x194b07={};var _0x387261={};var _0x1c1040;var _0x26b64d;return db[_0xa441('0x2c')][_0xa441('0x4e')]({'where':{'id':_0x57ae1a[_0xa441('0x48')]['id']}})[_0xa441('0x26')](handleEntityNotFound(_0x3b86b2,null))['then'](function(_0x26aa3f){if(_0x26aa3f){_0x1c1040=_0x26aa3f;_0x387261[_0xa441('0x31')]=_[_0xa441('0x34')](db[_0xa441('0x4f')][_0xa441('0x2d')]);_0x387261[_0xa441('0x33')]=_[_0xa441('0x34')](_0x57ae1a[_0xa441('0x33')]);_0x387261[_0xa441('0x3c')]=_[_0xa441('0x35')](_0x387261[_0xa441('0x31')],_0x387261[_0xa441('0x33')]);_0x194b07[_0xa441('0x36')]=_[_0xa441('0x35')](_0x387261['model'],qs[_0xa441('0x37')](_0x57ae1a[_0xa441('0x33')]['fields']));_0x194b07[_0xa441('0x36')]=_0x194b07[_0xa441('0x36')][_0xa441('0x38')]?_0x194b07[_0xa441('0x36')]:_0x387261[_0xa441('0x31')];_0x194b07[_0xa441('0x3a')]=qs['sort'](_0x57ae1a[_0xa441('0x33')][_0xa441('0x3b')]);_0x194b07[_0xa441('0x3f')]=qs[_0xa441('0x3c')](_['pick'](_0x57ae1a[_0xa441('0x33')],_0x387261[_0xa441('0x3c')]));if(_0x57ae1a[_0xa441('0x33')][_0xa441('0x3e')]){_0x194b07['where']=_[_0xa441('0x41')](_0x194b07[_0xa441('0x3f')],{'$or':_[_0xa441('0x32')](_0x194b07[_0xa441('0x36')],function(_0x94ac6f){var _0x4b25fe={};_0x4b25fe[_0x94ac6f]={'$like':'%'+_0x57ae1a[_0xa441('0x33')][_0xa441('0x3e')]+'%'};return _0x4b25fe;})});}_0x194b07=_[_0xa441('0x41')]({},_0x194b07,_0x57ae1a['options']);return _0x1c1040[_0xa441('0x52')](_0x194b07);}})[_0xa441('0x26')](function(_0x31ea23){if(_0x31ea23){_0x26b64d=_0x31ea23['length'];if(!_0x57ae1a[_0xa441('0x33')][_0xa441('0x50')]('nolimit')){_0x194b07[_0xa441('0x1f')]=qs[_0xa441('0x1f')](_0x57ae1a[_0xa441('0x33')][_0xa441('0x1f')]);_0x194b07[_0xa441('0x1d')]=qs[_0xa441('0x1d')](_0x57ae1a['query'][_0xa441('0x1d')]);}return _0x1c1040[_0xa441('0x52')](_0x194b07);}})[_0xa441('0x26')](function(_0x33e6c4){if(_0x33e6c4){return _0x33e6c4?{'count':_0x26b64d,'rows':_0x33e6c4}:null;}})[_0xa441('0x26')](respondWithResult(_0x3b86b2,null))[_0xa441('0x46')](handleError(_0x3b86b2,null));};exports[_0xa441('0x53')]=function(_0x585f86,_0x562de5,_0x1c3a72){var _0x45b9f5={};var _0x26ac7b={};var _0x3199d3;var _0xabd053;return db[_0xa441('0x2c')][_0xa441('0x4e')]({'where':{'id':_0x585f86[_0xa441('0x48')]['id']}})['then'](handleEntityNotFound(_0x562de5,null))[_0xa441('0x26')](function(_0x4aabd6){if(_0x4aabd6){_0x3199d3=_0x4aabd6;_0x26ac7b['model']=_[_0xa441('0x34')](db[_0xa441('0x4f')][_0xa441('0x2d')]);_0x26ac7b[_0xa441('0x33')]=_[_0xa441('0x34')](_0x585f86[_0xa441('0x33')]);_0x26ac7b[_0xa441('0x3c')]=_['intersection'](_0x26ac7b[_0xa441('0x31')],_0x26ac7b[_0xa441('0x33')]);_0x45b9f5[_0xa441('0x36')]=_[_0xa441('0x35')](_0x26ac7b[_0xa441('0x31')],qs['fields'](_0x585f86[_0xa441('0x33')][_0xa441('0x37')]));_0x45b9f5[_0xa441('0x36')]=_0x45b9f5[_0xa441('0x36')]['length']?_0x45b9f5[_0xa441('0x36')]:_0x26ac7b[_0xa441('0x31')];_0x45b9f5[_0xa441('0x3a')]=qs['sort'](_0x585f86[_0xa441('0x33')][_0xa441('0x3b')]);_0x45b9f5[_0xa441('0x3f')]=qs[_0xa441('0x3c')](_[_0xa441('0x3d')](_0x585f86[_0xa441('0x33')],_0x26ac7b['filters']));if(_0x585f86[_0xa441('0x33')][_0xa441('0x3e')]){_0x45b9f5[_0xa441('0x3f')]=_[_0xa441('0x41')](_0x45b9f5[_0xa441('0x3f')],{'$or':_['map'](_0x45b9f5[_0xa441('0x36')],function(_0x20d575){var _0x3029cd={};_0x3029cd[_0x20d575]={'$like':'%'+_0x585f86['query']['filter']+'%'};return _0x3029cd;})});}_0x45b9f5=_[_0xa441('0x41')]({},_0x45b9f5,_0x585f86[_0xa441('0x42')]);return _0x3199d3[_0xa441('0x53')](_0x45b9f5);}})[_0xa441('0x26')](function(_0x504f15){if(_0x504f15){_0xabd053=_0x504f15['length'];if(!_0x585f86[_0xa441('0x33')][_0xa441('0x50')](_0xa441('0x39'))){_0x45b9f5['limit']=qs[_0xa441('0x1f')](_0x585f86[_0xa441('0x33')][_0xa441('0x1f')]);_0x45b9f5['offset']=qs['offset'](_0x585f86[_0xa441('0x33')][_0xa441('0x1d')]);}return _0x3199d3[_0xa441('0x53')](_0x45b9f5);}})[_0xa441('0x26')](function(_0x1226cd){if(_0x1226cd){return _0x1226cd?{'count':_0xabd053,'rows':_0x1226cd}:null;}})[_0xa441('0x26')](respondWithResult(_0x562de5,null))['catch'](handleError(_0x562de5,null));}; \ No newline at end of file +var _0x4cc6=['attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','body','getFields','findOne','order','getSubjects','nolimit','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','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','status','stack','name','send','index','SalesforceConfiguration','rawAttributes','type','key','model','query','keys','filters'];(function(_0x208f09,_0x4ba174){var _0x37e566=function(_0x2c50b6){while(--_0x2c50b6){_0x208f09['push'](_0x208f09['shift']());}};_0x37e566(++_0x4ba174);}(_0x4cc6,0x164));var _0x64cc=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x4cc6[_0xf10840];return _0x1fdf7e;};'use strict';var emlformat=require(_0x64cc('0x0'));var rimraf=require(_0x64cc('0x1'));var zipdir=require(_0x64cc('0x2'));var jsonpatch=require(_0x64cc('0x3'));var rp=require(_0x64cc('0x4'));var moment=require(_0x64cc('0x5'));var BPromise=require(_0x64cc('0x6'));var Mustache=require(_0x64cc('0x7'));var util=require('util');var path=require(_0x64cc('0x8'));var sox=require(_0x64cc('0x9'));var csv=require(_0x64cc('0xa'));var ejs=require(_0x64cc('0xb'));var fs=require('fs');var fs_extra=require(_0x64cc('0xc'));var _=require(_0x64cc('0xd'));var squel=require(_0x64cc('0xe'));var crypto=require(_0x64cc('0xf'));var jsforce=require(_0x64cc('0x10'));var deskjs=require(_0x64cc('0x11'));var toCsv=require(_0x64cc('0xa'));var querystring=require(_0x64cc('0x12'));var Papa=require(_0x64cc('0x13'));var Redis=require(_0x64cc('0x14'));var authService=require(_0x64cc('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x64cc('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x64cc('0x17'));var utils=require(_0x64cc('0x18'));var config=require(_0x64cc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x64cc('0x1a'))['db'];function respondWithStatusCode(_0x2aa3d6,_0x1ee12e){_0x1ee12e=_0x1ee12e||0xcc;return function(_0x416858){if(_0x416858){return _0x2aa3d6[_0x64cc('0x1b')](_0x1ee12e);}return _0x2aa3d6['status'](_0x1ee12e)[_0x64cc('0x1c')]();};}function respondWithResult(_0x1d1faa,_0x5e9150){_0x5e9150=_0x5e9150||0xc8;return function(_0x360b21){if(_0x360b21){return _0x1d1faa['status'](_0x5e9150)['json'](_0x360b21);}};}function respondWithFilteredResult(_0x20239d,_0x1225f9){return function(_0x5d44ad){if(_0x5d44ad){var _0xf85d1d=typeof _0x1225f9[_0x64cc('0x1d')]===_0x64cc('0x1e')&&typeof _0x1225f9[_0x64cc('0x1f')]===_0x64cc('0x1e');var _0x1482dc=_0x5d44ad[_0x64cc('0x20')];var _0x16b17c=_0xf85d1d?0x0:_0x1225f9[_0x64cc('0x1d')];var _0x2b75cd=_0xf85d1d?_0x5d44ad[_0x64cc('0x20')]:_0x1225f9[_0x64cc('0x1d')]+_0x1225f9[_0x64cc('0x1f')];var _0x4ccf25;if(_0x2b75cd>=_0x1482dc){_0x2b75cd=_0x1482dc;_0x4ccf25=0xc8;}else{_0x4ccf25=0xce;}_0x20239d['status'](_0x4ccf25);return _0x20239d[_0x64cc('0x21')](_0x64cc('0x22'),_0x16b17c+'-'+_0x2b75cd+'/'+_0x1482dc)[_0x64cc('0x23')](_0x5d44ad);}return null;};}function patchUpdates(_0x115ea1){return function(_0x5385eb){try{jsonpatch[_0x64cc('0x24')](_0x5385eb,_0x115ea1,!![]);}catch(_0x44a979){return BPromise[_0x64cc('0x25')](_0x44a979);}return _0x5385eb['save']();};}function saveUpdates(_0x280002,_0x456e4e){return function(_0x413422){if(_0x413422){return _0x413422[_0x64cc('0x26')](_0x280002)[_0x64cc('0x27')](function(_0x27178b){return _0x27178b;});}return null;};}function removeEntity(_0x43788a,_0x4e7775){return function(_0x6b7cbe){if(_0x6b7cbe){return _0x6b7cbe[_0x64cc('0x28')]()['then'](function(){_0x43788a[_0x64cc('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x331ec5,_0x281fda){return function(_0x4e7719){if(!_0x4e7719){_0x331ec5[_0x64cc('0x1b')](0x194);}return _0x4e7719;};}function handleError(_0x5bba41,_0x4c5457){_0x4c5457=_0x4c5457||0x1f4;return function(_0x4198e3){logger['error'](_0x4198e3[_0x64cc('0x2a')]);if(_0x4198e3['name']){delete _0x4198e3[_0x64cc('0x2b')];}_0x5bba41['status'](_0x4c5457)[_0x64cc('0x2c')](_0x4198e3);};}exports[_0x64cc('0x2d')]=function(_0x36e88d,_0x5c2eb6){var _0x265b24={},_0x493011={},_0x4812db={'count':0x0,'rows':[]};var _0x122086=_['map'](db[_0x64cc('0x2e')][_0x64cc('0x2f')],function(_0x105936){return{'name':_0x105936['fieldName'],'type':_0x105936[_0x64cc('0x30')][_0x64cc('0x31')]};});_0x493011[_0x64cc('0x32')]=_['map'](_0x122086,'name');_0x493011[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0x36e88d[_0x64cc('0x33')]);_0x493011[_0x64cc('0x35')]=_['intersection'](_0x493011[_0x64cc('0x32')],_0x493011[_0x64cc('0x33')]);_0x265b24[_0x64cc('0x36')]=_[_0x64cc('0x37')](_0x493011[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0x36e88d[_0x64cc('0x33')]['fields']));_0x265b24[_0x64cc('0x36')]=_0x265b24[_0x64cc('0x36')][_0x64cc('0x39')]?_0x265b24[_0x64cc('0x36')]:_0x493011['model'];if(!_0x36e88d[_0x64cc('0x33')][_0x64cc('0x3a')]('nolimit')){_0x265b24[_0x64cc('0x1f')]=qs[_0x64cc('0x1f')](_0x36e88d[_0x64cc('0x33')][_0x64cc('0x1f')]);_0x265b24[_0x64cc('0x1d')]=qs[_0x64cc('0x1d')](_0x36e88d[_0x64cc('0x33')][_0x64cc('0x1d')]);}_0x265b24['order']=qs[_0x64cc('0x3b')](_0x36e88d[_0x64cc('0x33')][_0x64cc('0x3b')]);_0x265b24[_0x64cc('0x3c')]=qs[_0x64cc('0x35')](_[_0x64cc('0x3d')](_0x36e88d[_0x64cc('0x33')],_0x493011['filters']),_0x122086);if(_0x36e88d['query'][_0x64cc('0x3e')]){_0x265b24[_0x64cc('0x3c')]=_[_0x64cc('0x3f')](_0x265b24[_0x64cc('0x3c')],{'$or':_[_0x64cc('0x40')](_0x122086,function(_0xbaba59){if(_0xbaba59[_0x64cc('0x30')]!==_0x64cc('0x41')){var _0x3e84c9={};_0x3e84c9[_0xbaba59['name']]={'$like':'%'+_0x36e88d['query'][_0x64cc('0x3e')]+'%'};return _0x3e84c9;}})});}_0x265b24=_['merge']({},_0x265b24,_0x36e88d[_0x64cc('0x42')]);var _0x578688={'where':_0x265b24[_0x64cc('0x3c')]};return db['SalesforceConfiguration'][_0x64cc('0x20')](_0x578688)['then'](function(_0x2cb5c5){_0x4812db[_0x64cc('0x20')]=_0x2cb5c5;if(_0x36e88d[_0x64cc('0x33')][_0x64cc('0x43')]){_0x265b24['include']=[{'all':!![]}];}return db[_0x64cc('0x2e')][_0x64cc('0x44')](_0x265b24);})[_0x64cc('0x27')](function(_0x1f0e7a){_0x4812db[_0x64cc('0x45')]=_0x1f0e7a;return _0x4812db;})[_0x64cc('0x27')](respondWithFilteredResult(_0x5c2eb6,_0x265b24))[_0x64cc('0x46')](handleError(_0x5c2eb6,null));};exports['show']=function(_0x3d5d0a,_0xa54546){var _0x4a331b={'raw':![],'where':{'id':_0x3d5d0a[_0x64cc('0x47')]['id']}},_0x15de93={};_0x15de93[_0x64cc('0x32')]=_[_0x64cc('0x34')](db[_0x64cc('0x2e')][_0x64cc('0x2f')]);_0x15de93[_0x64cc('0x33')]=_['keys'](_0x3d5d0a[_0x64cc('0x33')]);_0x15de93['filters']=_[_0x64cc('0x37')](_0x15de93[_0x64cc('0x32')],_0x15de93[_0x64cc('0x33')]);_0x4a331b[_0x64cc('0x36')]=_[_0x64cc('0x37')](_0x15de93[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0x3d5d0a[_0x64cc('0x33')]['fields']));_0x4a331b[_0x64cc('0x36')]=_0x4a331b['attributes'][_0x64cc('0x39')]?_0x4a331b['attributes']:_0x15de93[_0x64cc('0x32')];if(_0x3d5d0a[_0x64cc('0x33')][_0x64cc('0x43')]){_0x4a331b[_0x64cc('0x48')]=[{'all':!![]}];}_0x4a331b=_['merge']({},_0x4a331b,_0x3d5d0a[_0x64cc('0x42')]);return db[_0x64cc('0x2e')][_0x64cc('0x49')](_0x4a331b)[_0x64cc('0x27')](handleEntityNotFound(_0xa54546,null))[_0x64cc('0x27')](respondWithResult(_0xa54546,null))[_0x64cc('0x46')](handleError(_0xa54546,null));};exports[_0x64cc('0x4a')]=function(_0x3c5b52,_0x583c6a){return db[_0x64cc('0x2e')][_0x64cc('0x4a')](_0x3c5b52[_0x64cc('0x4b')],{})['then'](respondWithResult(_0x583c6a,0xc9))['catch'](handleError(_0x583c6a,null));};exports[_0x64cc('0x26')]=function(_0x4fdfe8,_0x5664ef){if(_0x4fdfe8[_0x64cc('0x4b')]['id']){delete _0x4fdfe8[_0x64cc('0x4b')]['id'];}return db[_0x64cc('0x2e')]['find']({'where':{'id':_0x4fdfe8['params']['id']}})[_0x64cc('0x27')](handleEntityNotFound(_0x5664ef,null))[_0x64cc('0x27')](saveUpdates(_0x4fdfe8[_0x64cc('0x4b')],null))['then'](respondWithResult(_0x5664ef,null))[_0x64cc('0x46')](handleError(_0x5664ef,null));};exports[_0x64cc('0x28')]=function(_0x1bc391,_0x438bf8){return db['SalesforceConfiguration']['find']({'where':{'id':_0x1bc391[_0x64cc('0x47')]['id']}})[_0x64cc('0x27')](handleEntityNotFound(_0x438bf8,null))['then'](removeEntity(_0x438bf8,null))[_0x64cc('0x46')](handleError(_0x438bf8,null));};exports[_0x64cc('0x4c')]=function(_0xc6cb97,_0x3d9259,_0xaf42e4){var _0x54234b={};var _0x31533e={};var _0x4ac600;var _0x156d8a;return db[_0x64cc('0x2e')][_0x64cc('0x4d')]({'where':{'id':_0xc6cb97[_0x64cc('0x47')]['id']}})[_0x64cc('0x27')](handleEntityNotFound(_0x3d9259,null))[_0x64cc('0x27')](function(_0x17d83c){if(_0x17d83c){_0x4ac600=_0x17d83c;_0x31533e[_0x64cc('0x32')]=_[_0x64cc('0x34')](db['SalesforceField'][_0x64cc('0x2f')]);_0x31533e[_0x64cc('0x33')]=_['keys'](_0xc6cb97[_0x64cc('0x33')]);_0x31533e[_0x64cc('0x35')]=_[_0x64cc('0x37')](_0x31533e[_0x64cc('0x32')],_0x31533e[_0x64cc('0x33')]);_0x54234b[_0x64cc('0x36')]=_[_0x64cc('0x37')](_0x31533e['model'],qs[_0x64cc('0x38')](_0xc6cb97[_0x64cc('0x33')]['fields']));_0x54234b[_0x64cc('0x36')]=_0x54234b['attributes'][_0x64cc('0x39')]?_0x54234b[_0x64cc('0x36')]:_0x31533e['model'];_0x54234b[_0x64cc('0x4e')]=qs[_0x64cc('0x3b')](_0xc6cb97[_0x64cc('0x33')][_0x64cc('0x3b')]);_0x54234b['where']=qs[_0x64cc('0x35')](_['pick'](_0xc6cb97[_0x64cc('0x33')],_0x31533e[_0x64cc('0x35')]));if(_0xc6cb97[_0x64cc('0x33')][_0x64cc('0x3e')]){_0x54234b[_0x64cc('0x3c')]=_[_0x64cc('0x3f')](_0x54234b[_0x64cc('0x3c')],{'$or':_['map'](_0x54234b[_0x64cc('0x36')],function(_0xed0763){var _0xdd943c={};_0xdd943c[_0xed0763]={'$like':'%'+_0xc6cb97[_0x64cc('0x33')]['filter']+'%'};return _0xdd943c;})});}_0x54234b=_['merge']({},_0x54234b,_0xc6cb97['options']);return _0x4ac600[_0x64cc('0x4c')](_0x54234b);}})[_0x64cc('0x27')](function(_0x210165){if(_0x210165){_0x156d8a=_0x210165[_0x64cc('0x39')];if(!_0xc6cb97[_0x64cc('0x33')][_0x64cc('0x3a')]('nolimit')){_0x54234b[_0x64cc('0x1f')]=qs[_0x64cc('0x1f')](_0xc6cb97[_0x64cc('0x33')][_0x64cc('0x1f')]);_0x54234b[_0x64cc('0x1d')]=qs[_0x64cc('0x1d')](_0xc6cb97['query'][_0x64cc('0x1d')]);}return _0x4ac600[_0x64cc('0x4c')](_0x54234b);}})[_0x64cc('0x27')](function(_0x273599){if(_0x273599){return _0x273599?{'count':_0x156d8a,'rows':_0x273599}:null;}})[_0x64cc('0x27')](respondWithResult(_0x3d9259,null))[_0x64cc('0x46')](handleError(_0x3d9259,null));};exports[_0x64cc('0x4f')]=function(_0x32a1f8,_0x4c1feb,_0x14f2b0){var _0x2ae579={};var _0x21be90={};var _0x25f075;var _0x37a63d;return db[_0x64cc('0x2e')]['findOne']({'where':{'id':_0x32a1f8[_0x64cc('0x47')]['id']}})[_0x64cc('0x27')](handleEntityNotFound(_0x4c1feb,null))[_0x64cc('0x27')](function(_0x2a819f){if(_0x2a819f){_0x25f075=_0x2a819f;_0x21be90[_0x64cc('0x32')]=_[_0x64cc('0x34')](db['SalesforceField']['rawAttributes']);_0x21be90[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0x32a1f8[_0x64cc('0x33')]);_0x21be90[_0x64cc('0x35')]=_['intersection'](_0x21be90[_0x64cc('0x32')],_0x21be90[_0x64cc('0x33')]);_0x2ae579['attributes']=_['intersection'](_0x21be90[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0x32a1f8['query'][_0x64cc('0x38')]));_0x2ae579[_0x64cc('0x36')]=_0x2ae579[_0x64cc('0x36')][_0x64cc('0x39')]?_0x2ae579['attributes']:_0x21be90[_0x64cc('0x32')];_0x2ae579[_0x64cc('0x4e')]=qs[_0x64cc('0x3b')](_0x32a1f8['query']['sort']);_0x2ae579[_0x64cc('0x3c')]=qs[_0x64cc('0x35')](_[_0x64cc('0x3d')](_0x32a1f8[_0x64cc('0x33')],_0x21be90['filters']));if(_0x32a1f8['query'][_0x64cc('0x3e')]){_0x2ae579[_0x64cc('0x3c')]=_['merge'](_0x2ae579[_0x64cc('0x3c')],{'$or':_[_0x64cc('0x40')](_0x2ae579[_0x64cc('0x36')],function(_0x581fa5){var _0x1acf50={};_0x1acf50[_0x581fa5]={'$like':'%'+_0x32a1f8[_0x64cc('0x33')][_0x64cc('0x3e')]+'%'};return _0x1acf50;})});}_0x2ae579=_['merge']({},_0x2ae579,_0x32a1f8[_0x64cc('0x42')]);return _0x25f075[_0x64cc('0x4f')](_0x2ae579);}})[_0x64cc('0x27')](function(_0x30dab7){if(_0x30dab7){_0x37a63d=_0x30dab7['length'];if(!_0x32a1f8[_0x64cc('0x33')][_0x64cc('0x3a')](_0x64cc('0x50'))){_0x2ae579[_0x64cc('0x1f')]=qs[_0x64cc('0x1f')](_0x32a1f8[_0x64cc('0x33')]['limit']);_0x2ae579[_0x64cc('0x1d')]=qs[_0x64cc('0x1d')](_0x32a1f8[_0x64cc('0x33')][_0x64cc('0x1d')]);}return _0x25f075['getSubjects'](_0x2ae579);}})[_0x64cc('0x27')](function(_0x349c20){if(_0x349c20){return _0x349c20?{'count':_0x37a63d,'rows':_0x349c20}:null;}})[_0x64cc('0x27')](respondWithResult(_0x4c1feb,null))[_0x64cc('0x46')](handleError(_0x4c1feb,null));};exports[_0x64cc('0x51')]=function(_0x467099,_0x2db826,_0x4cffca){var _0x2d6574={};var _0x40fc98={};var _0x5c0036;var _0x1740ef;return db[_0x64cc('0x2e')]['findOne']({'where':{'id':_0x467099['params']['id']}})['then'](handleEntityNotFound(_0x2db826,null))[_0x64cc('0x27')](function(_0x22ac29){if(_0x22ac29){_0x5c0036=_0x22ac29;_0x40fc98[_0x64cc('0x32')]=_[_0x64cc('0x34')](db['SalesforceField'][_0x64cc('0x2f')]);_0x40fc98[_0x64cc('0x33')]=_[_0x64cc('0x34')](_0x467099[_0x64cc('0x33')]);_0x40fc98[_0x64cc('0x35')]=_['intersection'](_0x40fc98['model'],_0x40fc98[_0x64cc('0x33')]);_0x2d6574['attributes']=_['intersection'](_0x40fc98[_0x64cc('0x32')],qs[_0x64cc('0x38')](_0x467099['query'][_0x64cc('0x38')]));_0x2d6574[_0x64cc('0x36')]=_0x2d6574['attributes'][_0x64cc('0x39')]?_0x2d6574[_0x64cc('0x36')]:_0x40fc98['model'];_0x2d6574[_0x64cc('0x4e')]=qs[_0x64cc('0x3b')](_0x467099[_0x64cc('0x33')][_0x64cc('0x3b')]);_0x2d6574[_0x64cc('0x3c')]=qs[_0x64cc('0x35')](_[_0x64cc('0x3d')](_0x467099[_0x64cc('0x33')],_0x40fc98[_0x64cc('0x35')]));if(_0x467099[_0x64cc('0x33')][_0x64cc('0x3e')]){_0x2d6574[_0x64cc('0x3c')]=_[_0x64cc('0x3f')](_0x2d6574[_0x64cc('0x3c')],{'$or':_[_0x64cc('0x40')](_0x2d6574[_0x64cc('0x36')],function(_0x619094){var _0x1c9909={};_0x1c9909[_0x619094]={'$like':'%'+_0x467099[_0x64cc('0x33')][_0x64cc('0x3e')]+'%'};return _0x1c9909;})});}_0x2d6574=_[_0x64cc('0x3f')]({},_0x2d6574,_0x467099[_0x64cc('0x42')]);return _0x5c0036['getDescriptions'](_0x2d6574);}})[_0x64cc('0x27')](function(_0x41ecdc){if(_0x41ecdc){_0x1740ef=_0x41ecdc[_0x64cc('0x39')];if(!_0x467099[_0x64cc('0x33')][_0x64cc('0x3a')](_0x64cc('0x50'))){_0x2d6574['limit']=qs[_0x64cc('0x1f')](_0x467099[_0x64cc('0x33')][_0x64cc('0x1f')]);_0x2d6574['offset']=qs['offset'](_0x467099['query'][_0x64cc('0x1d')]);}return _0x5c0036[_0x64cc('0x51')](_0x2d6574);}})['then'](function(_0x4c39e8){if(_0x4c39e8){return _0x4c39e8?{'count':_0x1740ef,'rows':_0x4c39e8}:null;}})[_0x64cc('0x27')](respondWithResult(_0x2db826,null))[_0x64cc('0x46')](handleError(_0x2db826,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index f391a07..1834dea 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 _0x3ee2=['exports','define','SalesforceConfiguration','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x25210b,_0x6b899d){var _0x374cf7=function(_0x4875ca){while(--_0x4875ca){_0x25210b['push'](_0x25210b['shift']());}};_0x374cf7(++_0x6b899d);}(_0x3ee2,0xb3));var _0x23ee=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x3ee2[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0x23ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x23ee('0x1'));var moment=require(_0x23ee('0x2'));var BPromise=require(_0x23ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23ee('0x4'));var rimraf=require(_0x23ee('0x5'));var config=require(_0x23ee('0x6'));var attributes=require(_0x23ee('0x7'));module[_0x23ee('0x8')]=function(_0x89a3d3,_0x3ffc2c){return _0x89a3d3[_0x23ee('0x9')](_0x23ee('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc896=['api','moment','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','lodash','util'];(function(_0x291c87,_0x3bd033){var _0x175f49=function(_0x55e0e3){while(--_0x55e0e3){_0x291c87['push'](_0x291c87['shift']());}};_0x175f49(++_0x3bd033);}(_0xc896,0x1b6));var _0x6c89=function(_0x572f04,_0x1ebcf5){_0x572f04=_0x572f04-0x0;var _0x2970d8=_0xc896[_0x572f04];return _0x2970d8;};'use strict';var _=require(_0x6c89('0x0'));var util=require(_0x6c89('0x1'));var logger=require('../../config/logger')(_0x6c89('0x2'));var moment=require(_0x6c89('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c89('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c89('0x5'));var config=require(_0x6c89('0x6'));var attributes=require(_0x6c89('0x7'));module['exports']=function(_0x51502f,_0x16a512){return _0x51502f[_0x6c89('0x8')](_0x6c89('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index bd001fd..97d73cc 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 _0xbc2e=['client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3bba57,_0x440aad){var _0x1f13b7=function(_0x8ec7f6){while(--_0x8ec7f6){_0x3bba57['push'](_0x3bba57['shift']());}};_0x1f13b7(++_0x440aad);}(_0xbc2e,0x81));var _0xebc2=function(_0x119d74,_0x3f5abd){_0x119d74=_0x119d74-0x0;var _0x1d4217=_0xbc2e[_0x119d74];return _0x1d4217;};'use strict';var _=require('lodash');var util=require(_0xebc2('0x0'));var moment=require(_0xebc2('0x1'));var BPromise=require('bluebird');var rs=require(_0xebc2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebc2('0x3'))['db'];var utils=require(_0xebc2('0x4'));var logger=require(_0xebc2('0x5'))(_0xebc2('0x6'));var config=require(_0xebc2('0x7'));var jayson=require(_0xebc2('0x8'));var client=jayson[_0xebc2('0x9')][_0xebc2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27444b,_0x4e279d,_0x395970){return new BPromise(function(_0x49d76e,_0x6eac1b){return client['request'](_0x27444b,_0x395970)[_0xebc2('0xb')](function(_0x5e11ae){logger[_0xebc2('0xc')](_0xebc2('0xd'),_0x4e279d,'request\x20sent');logger[_0xebc2('0xe')](_0xebc2('0xf'),_0x4e279d,_0xebc2('0x10'),JSON[_0xebc2('0x11')](_0x5e11ae));if(_0x5e11ae['error']){if(_0x5e11ae[_0xebc2('0x12')][_0xebc2('0x13')]===0x1f4){logger['error'](_0xebc2('0xd'),_0x4e279d,_0x5e11ae[_0xebc2('0x12')][_0xebc2('0x14')]);return _0x6eac1b(_0x5e11ae['error'][_0xebc2('0x14')]);}logger[_0xebc2('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4e279d,_0x5e11ae[_0xebc2('0x12')][_0xebc2('0x14')]);return _0x49d76e(_0x5e11ae[_0xebc2('0x12')][_0xebc2('0x14')]);}else{logger[_0xebc2('0xc')](_0xebc2('0xd'),_0x4e279d,_0xebc2('0x10'));_0x49d76e(_0x5e11ae[_0xebc2('0x15')][_0xebc2('0x14')]);}})[_0xebc2('0x16')](function(_0x19265a){logger[_0xebc2('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4e279d,_0x19265a);_0x6eac1b(_0x19265a);});});} \ No newline at end of file +var _0xb695=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x47da0e,_0x4aeec3){var _0x2bed70=function(_0x2d78fa){while(--_0x2d78fa){_0x47da0e['push'](_0x47da0e['shift']());}};_0x2bed70(++_0x4aeec3);}(_0xb695,0x15f));var _0x5b69=function(_0x38ccdc,_0x2d868a){_0x38ccdc=_0x38ccdc-0x0;var _0xba5779=_0xb695[_0x38ccdc];return _0xba5779;};'use strict';var _=require(_0x5b69('0x0'));var util=require(_0x5b69('0x1'));var moment=require('moment');var BPromise=require(_0x5b69('0x2'));var rs=require(_0x5b69('0x3'));var fs=require('fs');var Redis=require(_0x5b69('0x4'));var db=require(_0x5b69('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b69('0x6'))(_0x5b69('0x7'));var config=require(_0x5b69('0x8'));var jayson=require(_0x5b69('0x9'));var client=jayson[_0x5b69('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e5d86,_0x1ad16c,_0x575c9b){return new BPromise(function(_0xbab039,_0x2f8f86){return client[_0x5b69('0xb')](_0x3e5d86,_0x575c9b)[_0x5b69('0xc')](function(_0x224022){logger[_0x5b69('0xd')](_0x5b69('0xe'),_0x1ad16c,_0x5b69('0xf'));logger[_0x5b69('0x10')](_0x5b69('0x11'),_0x1ad16c,_0x5b69('0xf'),JSON['stringify'](_0x224022));if(_0x224022[_0x5b69('0x12')]){if(_0x224022[_0x5b69('0x12')][_0x5b69('0x13')]===0x1f4){logger[_0x5b69('0x12')](_0x5b69('0xe'),_0x1ad16c,_0x224022[_0x5b69('0x12')][_0x5b69('0x14')]);return _0x2f8f86(_0x224022[_0x5b69('0x12')]['message']);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x1ad16c,_0x224022[_0x5b69('0x12')]['message']);return _0xbab039(_0x224022[_0x5b69('0x12')]['message']);}else{logger[_0x5b69('0xd')](_0x5b69('0xe'),_0x1ad16c,_0x5b69('0xf'));_0xbab039(_0x224022[_0x5b69('0x15')][_0x5b69('0x14')]);}})[_0x5b69('0x16')](function(_0x4ee027){logger[_0x5b69('0x12')](_0x5b69('0xe'),_0x1ad16c,_0x4ee027);_0x2f8f86(_0x4ee027);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3486222..7d0544a 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 _0x4ad9=['isAuthenticated','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x4ad9,0x14b));var _0x94ad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ad9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x94ad('0x0'));var util=require(_0x94ad('0x1'));var path=require('path');var timeout=require(_0x94ad('0x2'));var express=require(_0x94ad('0x3'));var router=express[_0x94ad('0x4')]();var fs_extra=require(_0x94ad('0x5'));var auth=require(_0x94ad('0x6'));var interaction=require(_0x94ad('0x7'));var config=require(_0x94ad('0x8'));var controller=require(_0x94ad('0x9'));router[_0x94ad('0xa')]('/',auth[_0x94ad('0xb')](),controller['index']);router[_0x94ad('0xa')](_0x94ad('0xc'),auth[_0x94ad('0xb')](),controller[_0x94ad('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x94ad('0xe')]('/:id',auth[_0x94ad('0xb')](),controller[_0x94ad('0xf')]);router[_0x94ad('0x10')](_0x94ad('0xc'),auth[_0x94ad('0xb')](),controller[_0x94ad('0x11')]);module[_0x94ad('0x12')]=router; \ No newline at end of file +var _0x6cbb=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','put','update','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x3c7b91,_0x5b3e20){var _0x3bc225=function(_0x6b0dc3){while(--_0x6b0dc3){_0x3c7b91['push'](_0x3c7b91['shift']());}};_0x3bc225(++_0x5b3e20);}(_0x6cbb,0x11c));var _0xb6cb=function(_0x4bc7a6,_0x181997){_0x4bc7a6=_0x4bc7a6-0x0;var _0x54675d=_0x6cbb[_0x4bc7a6];return _0x54675d;};'use strict';var multer=require(_0xb6cb('0x0'));var util=require('util');var path=require(_0xb6cb('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6cb('0x2'));var router=express[_0xb6cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb6cb('0x4'));var interaction=require(_0xb6cb('0x5'));var config=require(_0xb6cb('0x6'));var controller=require(_0xb6cb('0x7'));router[_0xb6cb('0x8')]('/',auth['isAuthenticated'](),controller[_0xb6cb('0x9')]);router[_0xb6cb('0x8')](_0xb6cb('0xa'),auth['isAuthenticated'](),controller[_0xb6cb('0xb')]);router[_0xb6cb('0xc')]('/',auth[_0xb6cb('0xd')](),controller['create']);router[_0xb6cb('0xe')](_0xb6cb('0xa'),auth[_0xb6cb('0xd')](),controller[_0xb6cb('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb6cb('0x10')]);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 eae05d1..26a88f5 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 _0xa913=['customVariable','picklist','STRING','exports','ENUM','string','variable'];(function(_0x1ddd0,_0x15f9f4){var _0x4d86d0=function(_0x3173d7){while(--_0x3173d7){_0x1ddd0['push'](_0x1ddd0['shift']());}};_0x4d86d0(++_0x15f9f4);}(_0xa913,0x10d));var _0x3a91=function(_0x439418,_0x192422){_0x439418=_0x439418-0x0;var _0x2fb526=_0xa913[_0x439418];return _0x2fb526;};'use strict';var Sequelize=require('sequelize');module[_0x3a91('0x0')]={'type':{'type':Sequelize[_0x3a91('0x1')](_0x3a91('0x2'),_0x3a91('0x3'),_0x3a91('0x4'),'keyValue',_0x3a91('0x5')),'defaultValue':_0x3a91('0x2')},'content':{'type':Sequelize[_0x3a91('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3a91('0x1')](_0x3a91('0x2'),'variable',_0x3a91('0x4'))},'keyContent':{'type':Sequelize[_0x3a91('0x6')]},'idField':{'type':Sequelize[_0x3a91('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x019b=['keyValue','STRING','customVariable','sequelize','ENUM','string','variable'];(function(_0x5d9651,_0xd0eda1){var _0x5e7138=function(_0x40a065){while(--_0x40a065){_0x5d9651['push'](_0x5d9651['shift']());}};_0x5e7138(++_0xd0eda1);}(_0x019b,0xab));var _0xb019=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x019b[_0x2defb5];return _0x229c53;};'use strict';var Sequelize=require(_0xb019('0x0'));module['exports']={'type':{'type':Sequelize[_0xb019('0x1')](_0xb019('0x2'),_0xb019('0x3'),'customVariable',_0xb019('0x4'),'picklist'),'defaultValue':_0xb019('0x2')},'content':{'type':Sequelize[_0xb019('0x5')]},'key':{'type':Sequelize[_0xb019('0x5')]},'keyType':{'type':Sequelize[_0xb019('0x1')](_0xb019('0x2'),_0xb019('0x3'),_0xb019('0x6'))},'keyContent':{'type':Sequelize[_0xb019('0x5')]},'idField':{'type':Sequelize[_0xb019('0x5')]},'variableName':{'type':Sequelize[_0xb019('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e43da3a..b7cfa0c 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 _0x059d=['rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','destroy','error','index','map','SalesforceField','fieldName','key','keys','query','filters','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','name','options','then','includeAll','include','findAll','catch','show','rawAttributes','intersection','create','body','params','find','eml-format'];(function(_0x454e4e,_0x52db86){var _0x5e7f00=function(_0x1c3c08){while(--_0x1c3c08){_0x454e4e['push'](_0x454e4e['shift']());}};_0x5e7f00(++_0x52db86);}(_0x059d,0x8f));var _0xd059=function(_0x1b4f51,_0x2e6994){_0x1b4f51=_0x1b4f51-0x0;var _0x3a6836=_0x059d[_0x1b4f51];return _0x3a6836;};'use strict';var emlformat=require(_0xd059('0x0'));var rimraf=require(_0xd059('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd059('0x2'));var rp=require('request-promise');var moment=require(_0xd059('0x3'));var BPromise=require(_0xd059('0x4'));var Mustache=require(_0xd059('0x5'));var util=require(_0xd059('0x6'));var path=require('path');var sox=require(_0xd059('0x7'));var csv=require('to-csv');var ejs=require(_0xd059('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd059('0x9'));var squel=require('squel');var crypto=require(_0xd059('0xa'));var jsforce=require(_0xd059('0xb'));var deskjs=require(_0xd059('0xc'));var toCsv=require(_0xd059('0xd'));var querystring=require(_0xd059('0xe'));var Papa=require('papaparse');var Redis=require(_0xd059('0xf'));var authService=require(_0xd059('0x10'));var qs=require(_0xd059('0x11'));var as=require(_0xd059('0x12'));var hardwareService=require(_0xd059('0x13'));var logger=require(_0xd059('0x14'))(_0xd059('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd059('0x16'));var db=require(_0xd059('0x17'))['db'];function respondWithStatusCode(_0x307807,_0x41cca8){_0x41cca8=_0x41cca8||0xcc;return function(_0x149642){if(_0x149642){return _0x307807['sendStatus'](_0x41cca8);}return _0x307807[_0xd059('0x18')](_0x41cca8)[_0xd059('0x19')]();};}function respondWithResult(_0x4ea292,_0x16c837){_0x16c837=_0x16c837||0xc8;return function(_0x143247){if(_0x143247){return _0x4ea292['status'](_0x16c837)[_0xd059('0x1a')](_0x143247);}};}function respondWithFilteredResult(_0x28703f,_0x331528){return function(_0x381bbd){if(_0x381bbd){var _0x2e7ce0=typeof _0x331528[_0xd059('0x1b')]==='undefined'&&typeof _0x331528[_0xd059('0x1c')]===_0xd059('0x1d');var _0x4bf98c=_0x381bbd[_0xd059('0x1e')];var _0x46e6e5=_0x2e7ce0?0x0:_0x331528[_0xd059('0x1b')];var _0xdb48cc=_0x2e7ce0?_0x381bbd[_0xd059('0x1e')]:_0x331528['offset']+_0x331528['limit'];var _0x3e4021;if(_0xdb48cc>=_0x4bf98c){_0xdb48cc=_0x4bf98c;_0x3e4021=0xc8;}else{_0x3e4021=0xce;}_0x28703f[_0xd059('0x18')](_0x3e4021);return _0x28703f[_0xd059('0x1f')]('Content-Range',_0x46e6e5+'-'+_0xdb48cc+'/'+_0x4bf98c)['json'](_0x381bbd);}return null;};}function patchUpdates(_0x29ceff){return function(_0x592496){try{jsonpatch[_0xd059('0x20')](_0x592496,_0x29ceff,!![]);}catch(_0x634b8b){return BPromise[_0xd059('0x21')](_0x634b8b);}return _0x592496[_0xd059('0x22')]();};}function saveUpdates(_0x3a656d,_0x135c2a){return function(_0x44d45c){if(_0x44d45c){return _0x44d45c[_0xd059('0x23')](_0x3a656d)['then'](function(_0x39f8ca){return _0x39f8ca;});}return null;};}function removeEntity(_0x2ad182,_0x4bb23f){return function(_0x3bfa2b){if(_0x3bfa2b){return _0x3bfa2b[_0xd059('0x24')]()['then'](function(){_0x2ad182[_0xd059('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eea25,_0x4e731f){return function(_0xf09619){if(!_0xf09619){_0x3eea25['sendStatus'](0x194);}return _0xf09619;};}function handleError(_0x6a7060,_0x5145ce){_0x5145ce=_0x5145ce||0x1f4;return function(_0x11b961){logger[_0xd059('0x25')](_0x11b961['stack']);if(_0x11b961['name']){delete _0x11b961['name'];}_0x6a7060[_0xd059('0x18')](_0x5145ce)['send'](_0x11b961);};}exports[_0xd059('0x26')]=function(_0x184dc6,_0x581377){var _0x4cb4f4={},_0x1bc0a0={},_0xb97665={'count':0x0,'rows':[]};var _0x3bea44=_[_0xd059('0x27')](db[_0xd059('0x28')]['rawAttributes'],function(_0x278287){return{'name':_0x278287[_0xd059('0x29')],'type':_0x278287['type'][_0xd059('0x2a')]};});_0x1bc0a0['model']=_[_0xd059('0x27')](_0x3bea44,'name');_0x1bc0a0['query']=_[_0xd059('0x2b')](_0x184dc6[_0xd059('0x2c')]);_0x1bc0a0[_0xd059('0x2d')]=_['intersection'](_0x1bc0a0['model'],_0x1bc0a0[_0xd059('0x2c')]);_0x4cb4f4['attributes']=_['intersection'](_0x1bc0a0['model'],qs['fields'](_0x184dc6['query'][_0xd059('0x2e')]));_0x4cb4f4[_0xd059('0x2f')]=_0x4cb4f4[_0xd059('0x2f')][_0xd059('0x30')]?_0x4cb4f4[_0xd059('0x2f')]:_0x1bc0a0[_0xd059('0x31')];if(!_0x184dc6[_0xd059('0x2c')][_0xd059('0x32')](_0xd059('0x33'))){_0x4cb4f4['limit']=qs['limit'](_0x184dc6['query'][_0xd059('0x1c')]);_0x4cb4f4[_0xd059('0x1b')]=qs[_0xd059('0x1b')](_0x184dc6[_0xd059('0x2c')]['offset']);}_0x4cb4f4[_0xd059('0x34')]=qs['sort'](_0x184dc6[_0xd059('0x2c')][_0xd059('0x35')]);_0x4cb4f4[_0xd059('0x36')]=qs[_0xd059('0x2d')](_[_0xd059('0x37')](_0x184dc6['query'],_0x1bc0a0[_0xd059('0x2d')]),_0x3bea44);if(_0x184dc6[_0xd059('0x2c')][_0xd059('0x38')]){_0x4cb4f4[_0xd059('0x36')]=_['merge'](_0x4cb4f4['where'],{'$or':_[_0xd059('0x27')](_0x3bea44,function(_0x53cc2e){if(_0x53cc2e[_0xd059('0x39')]!=='VIRTUAL'){var _0x13d94e={};_0x13d94e[_0x53cc2e[_0xd059('0x3a')]]={'$like':'%'+_0x184dc6[_0xd059('0x2c')][_0xd059('0x38')]+'%'};return _0x13d94e;}})});}_0x4cb4f4=_['merge']({},_0x4cb4f4,_0x184dc6[_0xd059('0x3b')]);var _0x21e8f3={'where':_0x4cb4f4['where']};return db['SalesforceField']['count'](_0x21e8f3)[_0xd059('0x3c')](function(_0x129f46){_0xb97665['count']=_0x129f46;if(_0x184dc6[_0xd059('0x2c')][_0xd059('0x3d')]){_0x4cb4f4[_0xd059('0x3e')]=[{'all':!![]}];}return db[_0xd059('0x28')][_0xd059('0x3f')](_0x4cb4f4);})['then'](function(_0x414cd6){_0xb97665['rows']=_0x414cd6;return _0xb97665;})['then'](respondWithFilteredResult(_0x581377,_0x4cb4f4))[_0xd059('0x40')](handleError(_0x581377,null));};exports[_0xd059('0x41')]=function(_0x1cab7b,_0x1c7d69){var _0x25c620={'raw':!![],'where':{'id':_0x1cab7b['params']['id']}},_0x33a3a7={};_0x33a3a7[_0xd059('0x31')]=_[_0xd059('0x2b')](db[_0xd059('0x28')][_0xd059('0x42')]);_0x33a3a7[_0xd059('0x2c')]=_[_0xd059('0x2b')](_0x1cab7b['query']);_0x33a3a7[_0xd059('0x2d')]=_[_0xd059('0x43')](_0x33a3a7[_0xd059('0x31')],_0x33a3a7[_0xd059('0x2c')]);_0x25c620['attributes']=_[_0xd059('0x43')](_0x33a3a7['model'],qs[_0xd059('0x2e')](_0x1cab7b[_0xd059('0x2c')]['fields']));_0x25c620[_0xd059('0x2f')]=_0x25c620['attributes'][_0xd059('0x30')]?_0x25c620[_0xd059('0x2f')]:_0x33a3a7[_0xd059('0x31')];if(_0x1cab7b['query']['includeAll']){_0x25c620[_0xd059('0x3e')]=[{'all':!![]}];}_0x25c620=_['merge']({},_0x25c620,_0x1cab7b[_0xd059('0x3b')]);return db[_0xd059('0x28')]['find'](_0x25c620)[_0xd059('0x3c')](handleEntityNotFound(_0x1c7d69,null))[_0xd059('0x3c')](respondWithResult(_0x1c7d69,null))[_0xd059('0x40')](handleError(_0x1c7d69,null));};exports[_0xd059('0x44')]=function(_0x7e4783,_0xff26fb){return db[_0xd059('0x28')][_0xd059('0x44')](_0x7e4783[_0xd059('0x45')],{})[_0xd059('0x3c')](respondWithResult(_0xff26fb,0xc9))[_0xd059('0x40')](handleError(_0xff26fb,null));};exports['update']=function(_0x464299,_0x2e0634){if(_0x464299[_0xd059('0x45')]['id']){delete _0x464299['body']['id'];}return db[_0xd059('0x28')]['find']({'where':{'id':_0x464299[_0xd059('0x46')]['id']}})[_0xd059('0x3c')](handleEntityNotFound(_0x2e0634,null))[_0xd059('0x3c')](saveUpdates(_0x464299[_0xd059('0x45')],null))[_0xd059('0x3c')](respondWithResult(_0x2e0634,null))[_0xd059('0x40')](handleError(_0x2e0634,null));};exports[_0xd059('0x24')]=function(_0xe9651b,_0x5787f5){return db[_0xd059('0x28')][_0xd059('0x47')]({'where':{'id':_0xe9651b[_0xd059('0x46')]['id']}})['then'](handleEntityNotFound(_0x5787f5,null))[_0xd059('0x3c')](removeEntity(_0x5787f5,null))[_0xd059('0x40')](handleError(_0x5787f5,null));}; \ No newline at end of file +var _0xf194=['json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','SalesforceField','includeAll','include','findAll','rows','catch','params','options','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x609988,_0x507944){var _0x159984=function(_0x39d9ce){while(--_0x39d9ce){_0x609988['push'](_0x609988['shift']());}};_0x159984(++_0x507944);}(_0xf194,0x19b));var _0x4f19=function(_0xc0ed23,_0x22649f){_0xc0ed23=_0xc0ed23-0x0;var _0x3b3213=_0xf194[_0xc0ed23];return _0x3b3213;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f19('0x0'));var zipdir=require(_0x4f19('0x1'));var jsonpatch=require(_0x4f19('0x2'));var rp=require(_0x4f19('0x3'));var moment=require(_0x4f19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4f19('0x5'));var util=require(_0x4f19('0x6'));var path=require('path');var sox=require(_0x4f19('0x7'));var csv=require(_0x4f19('0x8'));var ejs=require(_0x4f19('0x9'));var fs=require('fs');var fs_extra=require(_0x4f19('0xa'));var _=require(_0x4f19('0xb'));var squel=require(_0x4f19('0xc'));var crypto=require(_0x4f19('0xd'));var jsforce=require(_0x4f19('0xe'));var deskjs=require(_0x4f19('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f19('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4f19('0x11'));var qs=require(_0x4f19('0x12'));var as=require(_0x4f19('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4f19('0x14'));var utils=require(_0x4f19('0x15'));var config=require(_0x4f19('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f19('0x17'))['db'];function respondWithStatusCode(_0x41bf1f,_0x978cd2){_0x978cd2=_0x978cd2||0xcc;return function(_0x492bae){if(_0x492bae){return _0x41bf1f[_0x4f19('0x18')](_0x978cd2);}return _0x41bf1f[_0x4f19('0x19')](_0x978cd2)[_0x4f19('0x1a')]();};}function respondWithResult(_0x4e1c13,_0x3ed149){_0x3ed149=_0x3ed149||0xc8;return function(_0x30918c){if(_0x30918c){return _0x4e1c13[_0x4f19('0x19')](_0x3ed149)[_0x4f19('0x1b')](_0x30918c);}};}function respondWithFilteredResult(_0xd9645f,_0x4f5ab1){return function(_0x4d9b78){if(_0x4d9b78){var _0x4a4acf=typeof _0x4f5ab1['offset']===_0x4f19('0x1c')&&typeof _0x4f5ab1[_0x4f19('0x1d')]===_0x4f19('0x1c');var _0x565255=_0x4d9b78[_0x4f19('0x1e')];var _0xd5e0f1=_0x4a4acf?0x0:_0x4f5ab1[_0x4f19('0x1f')];var _0x34bd46=_0x4a4acf?_0x4d9b78[_0x4f19('0x1e')]:_0x4f5ab1[_0x4f19('0x1f')]+_0x4f5ab1[_0x4f19('0x1d')];var _0x3f5fd0;if(_0x34bd46>=_0x565255){_0x34bd46=_0x565255;_0x3f5fd0=0xc8;}else{_0x3f5fd0=0xce;}_0xd9645f[_0x4f19('0x19')](_0x3f5fd0);return _0xd9645f[_0x4f19('0x20')](_0x4f19('0x21'),_0xd5e0f1+'-'+_0x34bd46+'/'+_0x565255)[_0x4f19('0x1b')](_0x4d9b78);}return null;};}function patchUpdates(_0x428e05){return function(_0x5c92ef){try{jsonpatch[_0x4f19('0x22')](_0x5c92ef,_0x428e05,!![]);}catch(_0x319f5c){return BPromise[_0x4f19('0x23')](_0x319f5c);}return _0x5c92ef[_0x4f19('0x24')]();};}function saveUpdates(_0x44a56c,_0x483ec6){return function(_0x72e699){if(_0x72e699){return _0x72e699[_0x4f19('0x25')](_0x44a56c)[_0x4f19('0x26')](function(_0x33e626){return _0x33e626;});}return null;};}function removeEntity(_0x375584,_0x13fbbd){return function(_0x496643){if(_0x496643){return _0x496643['destroy']()[_0x4f19('0x26')](function(){_0x375584[_0x4f19('0x19')](0xcc)[_0x4f19('0x1a')]();});}};}function handleEntityNotFound(_0x34c4d5,_0x315739){return function(_0x16c219){if(!_0x16c219){_0x34c4d5[_0x4f19('0x18')](0x194);}return _0x16c219;};}function handleError(_0x2a54b1,_0x57fafa){_0x57fafa=_0x57fafa||0x1f4;return function(_0x30c834){logger[_0x4f19('0x27')](_0x30c834[_0x4f19('0x28')]);if(_0x30c834[_0x4f19('0x29')]){delete _0x30c834['name'];}_0x2a54b1['status'](_0x57fafa)['send'](_0x30c834);};}exports[_0x4f19('0x2a')]=function(_0x1a108d,_0x55163d){var _0x5c7d1d={},_0x19c709={},_0x174b8d={'count':0x0,'rows':[]};var _0x271337=_[_0x4f19('0x2b')](db['SalesforceField'][_0x4f19('0x2c')],function(_0x34df5b){return{'name':_0x34df5b['fieldName'],'type':_0x34df5b[_0x4f19('0x2d')]['key']};});_0x19c709[_0x4f19('0x2e')]=_[_0x4f19('0x2b')](_0x271337,'name');_0x19c709[_0x4f19('0x2f')]=_[_0x4f19('0x30')](_0x1a108d['query']);_0x19c709[_0x4f19('0x31')]=_[_0x4f19('0x32')](_0x19c709['model'],_0x19c709[_0x4f19('0x2f')]);_0x5c7d1d[_0x4f19('0x33')]=_[_0x4f19('0x32')](_0x19c709['model'],qs[_0x4f19('0x34')](_0x1a108d[_0x4f19('0x2f')][_0x4f19('0x34')]));_0x5c7d1d[_0x4f19('0x33')]=_0x5c7d1d[_0x4f19('0x33')][_0x4f19('0x35')]?_0x5c7d1d[_0x4f19('0x33')]:_0x19c709['model'];if(!_0x1a108d[_0x4f19('0x2f')]['hasOwnProperty'](_0x4f19('0x36'))){_0x5c7d1d['limit']=qs[_0x4f19('0x1d')](_0x1a108d[_0x4f19('0x2f')][_0x4f19('0x1d')]);_0x5c7d1d[_0x4f19('0x1f')]=qs[_0x4f19('0x1f')](_0x1a108d[_0x4f19('0x2f')]['offset']);}_0x5c7d1d[_0x4f19('0x37')]=qs[_0x4f19('0x38')](_0x1a108d['query'][_0x4f19('0x38')]);_0x5c7d1d[_0x4f19('0x39')]=qs[_0x4f19('0x31')](_['pick'](_0x1a108d[_0x4f19('0x2f')],_0x19c709[_0x4f19('0x31')]),_0x271337);if(_0x1a108d['query'][_0x4f19('0x3a')]){_0x5c7d1d[_0x4f19('0x39')]=_[_0x4f19('0x3b')](_0x5c7d1d[_0x4f19('0x39')],{'$or':_[_0x4f19('0x2b')](_0x271337,function(_0x5f2890){if(_0x5f2890[_0x4f19('0x2d')]!==_0x4f19('0x3c')){var _0x4b13df={};_0x4b13df[_0x5f2890[_0x4f19('0x29')]]={'$like':'%'+_0x1a108d[_0x4f19('0x2f')][_0x4f19('0x3a')]+'%'};return _0x4b13df;}})});}_0x5c7d1d=_[_0x4f19('0x3b')]({},_0x5c7d1d,_0x1a108d['options']);var _0x5e840f={'where':_0x5c7d1d[_0x4f19('0x39')]};return db[_0x4f19('0x3d')]['count'](_0x5e840f)[_0x4f19('0x26')](function(_0x4b441d){_0x174b8d['count']=_0x4b441d;if(_0x1a108d['query'][_0x4f19('0x3e')]){_0x5c7d1d[_0x4f19('0x3f')]=[{'all':!![]}];}return db[_0x4f19('0x3d')][_0x4f19('0x40')](_0x5c7d1d);})[_0x4f19('0x26')](function(_0x11ab98){_0x174b8d[_0x4f19('0x41')]=_0x11ab98;return _0x174b8d;})[_0x4f19('0x26')](respondWithFilteredResult(_0x55163d,_0x5c7d1d))[_0x4f19('0x42')](handleError(_0x55163d,null));};exports['show']=function(_0x140e9e,_0x183964){var _0x3a6349={'raw':!![],'where':{'id':_0x140e9e[_0x4f19('0x43')]['id']}},_0x30f4de={};_0x30f4de[_0x4f19('0x2e')]=_[_0x4f19('0x30')](db[_0x4f19('0x3d')]['rawAttributes']);_0x30f4de[_0x4f19('0x2f')]=_[_0x4f19('0x30')](_0x140e9e[_0x4f19('0x2f')]);_0x30f4de[_0x4f19('0x31')]=_[_0x4f19('0x32')](_0x30f4de[_0x4f19('0x2e')],_0x30f4de[_0x4f19('0x2f')]);_0x3a6349['attributes']=_[_0x4f19('0x32')](_0x30f4de[_0x4f19('0x2e')],qs[_0x4f19('0x34')](_0x140e9e['query']['fields']));_0x3a6349[_0x4f19('0x33')]=_0x3a6349[_0x4f19('0x33')][_0x4f19('0x35')]?_0x3a6349['attributes']:_0x30f4de[_0x4f19('0x2e')];if(_0x140e9e[_0x4f19('0x2f')][_0x4f19('0x3e')]){_0x3a6349[_0x4f19('0x3f')]=[{'all':!![]}];}_0x3a6349=_[_0x4f19('0x3b')]({},_0x3a6349,_0x140e9e[_0x4f19('0x44')]);return db[_0x4f19('0x3d')]['find'](_0x3a6349)[_0x4f19('0x26')](handleEntityNotFound(_0x183964,null))[_0x4f19('0x26')](respondWithResult(_0x183964,null))[_0x4f19('0x42')](handleError(_0x183964,null));};exports[_0x4f19('0x45')]=function(_0x324ce1,_0x3829d5){return db[_0x4f19('0x3d')][_0x4f19('0x45')](_0x324ce1['body'],{})[_0x4f19('0x26')](respondWithResult(_0x3829d5,0xc9))[_0x4f19('0x42')](handleError(_0x3829d5,null));};exports['update']=function(_0x4f5080,_0x17f794){if(_0x4f5080['body']['id']){delete _0x4f5080[_0x4f19('0x46')]['id'];}return db[_0x4f19('0x3d')][_0x4f19('0x47')]({'where':{'id':_0x4f5080['params']['id']}})[_0x4f19('0x26')](handleEntityNotFound(_0x17f794,null))['then'](saveUpdates(_0x4f5080[_0x4f19('0x46')],null))['then'](respondWithResult(_0x17f794,null))['catch'](handleError(_0x17f794,null));};exports[_0x4f19('0x48')]=function(_0x218433,_0x44034c){return db['SalesforceField']['find']({'where':{'id':_0x218433[_0x4f19('0x43')]['id']}})[_0x4f19('0x26')](handleEntityNotFound(_0x44034c,null))[_0x4f19('0x26')](removeEntity(_0x44034c,null))['catch'](handleError(_0x44034c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 7f452c1..c089dad 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 _0xa31d=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId'];(function(_0x25cb87,_0xc2d352){var _0x3a7537=function(_0x53516a){while(--_0x53516a){_0x25cb87['push'](_0x25cb87['shift']());}};_0x3a7537(++_0xc2d352);}(_0xa31d,0x82));var _0xda31=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xa31d[_0x497b1e];return _0x3f72e1;};'use strict';var _=require('lodash');var util=require(_0xda31('0x0'));var logger=require(_0xda31('0x1'))(_0xda31('0x2'));var moment=require('moment');var BPromise=require(_0xda31('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xda31('0x4'));var rimraf=require(_0xda31('0x5'));var config=require(_0xda31('0x6'));var attributes=require(_0xda31('0x7'));module[_0xda31('0x8')]=function(_0x4ceb3a,_0x39ebf2){return _0x4ceb3a['define'](_0xda31('0x9'),attributes,{'tableName':_0xda31('0xa'),'paranoid':![],'indexes':[{'name':_0xda31('0xb'),'fields':['idField',_0xda31('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x60dd=['salesforce_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x60dd,0x103));var _0xd60d=function(_0x535264,_0x285d49){_0x535264=_0x535264-0x0;var _0x3a2dab=_0x60dd[_0x535264];return _0x3a2dab;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require('../../config/logger')(_0xd60d('0x2'));var moment=require('moment');var BPromise=require(_0xd60d('0x3'));var rp=require(_0xd60d('0x4'));var fs=require('fs');var path=require(_0xd60d('0x5'));var rimraf=require(_0xd60d('0x6'));var config=require(_0xd60d('0x7'));var attributes=require(_0xd60d('0x8'));module[_0xd60d('0x9')]=function(_0x57eef4,_0x3a7153){return _0x57eef4[_0xd60d('0xa')](_0xd60d('0xb'),attributes,{'tableName':_0xd60d('0xc'),'paranoid':![],'indexes':[{'name':_0xd60d('0xd'),'fields':[_0xd60d('0xe'),_0xd60d('0xf')],'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 e3a6c67..e00db67 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 _0x3be6=['message','result','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3be6,0x75));var _0x63be=function(_0x25b022,_0x394a08){_0x25b022=_0x25b022-0x0;var _0x2e13a5=_0x3be6[_0x25b022];return _0x2e13a5;};'use strict';var _=require(_0x63be('0x0'));var util=require(_0x63be('0x1'));var moment=require(_0x63be('0x2'));var BPromise=require(_0x63be('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x63be('0x4'));var logger=require('../../config/logger')(_0x63be('0x5'));var config=require(_0x63be('0x6'));var jayson=require(_0x63be('0x7'));var client=jayson[_0x63be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314871,_0x496d60,_0x1892f9){return new BPromise(function(_0x360358,_0x80dc73){return client['request'](_0x314871,_0x1892f9)[_0x63be('0x9')](function(_0x3fc9cf){logger[_0x63be('0xa')](_0x63be('0xb'),_0x496d60,_0x63be('0xc'));logger[_0x63be('0xd')](_0x63be('0xe'),_0x496d60,_0x63be('0xc'),JSON['stringify'](_0x3fc9cf));if(_0x3fc9cf[_0x63be('0xf')]){if(_0x3fc9cf[_0x63be('0xf')]['code']===0x1f4){logger[_0x63be('0xf')](_0x63be('0xb'),_0x496d60,_0x3fc9cf[_0x63be('0xf')][_0x63be('0x10')]);return _0x80dc73(_0x3fc9cf[_0x63be('0xf')]['message']);}logger['error'](_0x63be('0xb'),_0x496d60,_0x3fc9cf[_0x63be('0xf')][_0x63be('0x10')]);return _0x360358(_0x3fc9cf[_0x63be('0xf')][_0x63be('0x10')]);}else{logger[_0x63be('0xa')](_0x63be('0xb'),_0x496d60,_0x63be('0xc'));_0x360358(_0x3fc9cf[_0x63be('0x11')][_0x63be('0x10')]);}})[_0x63be('0x12')](function(_0x1ab693){logger[_0x63be('0xf')](_0x63be('0xb'),_0x496d60,_0x1ab693);_0x80dc73(_0x1ab693);});});} \ No newline at end of file +var _0xca57=['moment','bluebird','ioredis','../../mysqldb','rpc','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1030e0,_0xb11f73){var _0xa9bb57=function(_0x3ea211){while(--_0x3ea211){_0x1030e0['push'](_0x1030e0['shift']());}};_0xa9bb57(++_0xb11f73);}(_0xca57,0x1b7));var _0x7ca5=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xca57[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x7ca5('0x0'));var util=require(_0x7ca5('0x1'));var moment=require(_0x7ca5('0x2'));var BPromise=require(_0x7ca5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ca5('0x4'));var db=require(_0x7ca5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7ca5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ca5('0x7')][_0x7ca5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46996e,_0x535bb2,_0x484730){return new BPromise(function(_0x357790,_0x5616f4){return client[_0x7ca5('0x9')](_0x46996e,_0x484730)[_0x7ca5('0xa')](function(_0x3ea94f){logger[_0x7ca5('0xb')](_0x7ca5('0xc'),_0x535bb2,_0x7ca5('0xd'));logger[_0x7ca5('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x535bb2,'request\x20sent',JSON[_0x7ca5('0xf')](_0x3ea94f));if(_0x3ea94f[_0x7ca5('0x10')]){if(_0x3ea94f['error'][_0x7ca5('0x11')]===0x1f4){logger[_0x7ca5('0x10')](_0x7ca5('0xc'),_0x535bb2,_0x3ea94f[_0x7ca5('0x10')][_0x7ca5('0x12')]);return _0x5616f4(_0x3ea94f['error']['message']);}logger[_0x7ca5('0x10')](_0x7ca5('0xc'),_0x535bb2,_0x3ea94f[_0x7ca5('0x10')]['message']);return _0x357790(_0x3ea94f[_0x7ca5('0x10')][_0x7ca5('0x12')]);}else{logger[_0x7ca5('0xb')](_0x7ca5('0xc'),_0x535bb2,_0x7ca5('0xd'));_0x357790(_0x3ea94f[_0x7ca5('0x13')]['message']);}})[_0x7ca5('0x14')](function(_0x45dc59){logger[_0x7ca5('0x10')]('SalesforceField,\x20%s,\x20%s',_0x535bb2,_0x45dc59);_0x5616f4(_0x45dc59);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 0b9a9d2..9c0f615 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 _0x3b34=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','destroy','exports'];(function(_0x4eaf2c,_0x20c39d){var _0x5bf7c6=function(_0x55b303){while(--_0x55b303){_0x4eaf2c['push'](_0x4eaf2c['shift']());}};_0x5bf7c6(++_0x20c39d);}(_0x3b34,0x108));var _0x43b3=function(_0x76a80e,_0x3b1cb8){_0x76a80e=_0x76a80e-0x0;var _0x253724=_0x3b34[_0x76a80e];return _0x253724;};'use strict';var multer=require(_0x43b3('0x0'));var util=require(_0x43b3('0x1'));var path=require(_0x43b3('0x2'));var timeout=require(_0x43b3('0x3'));var express=require(_0x43b3('0x4'));var router=express[_0x43b3('0x5')]();var fs_extra=require(_0x43b3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x43b3('0x7'));var config=require(_0x43b3('0x8'));var controller=require(_0x43b3('0x9'));router[_0x43b3('0xa')]('/',auth[_0x43b3('0xb')](),controller[_0x43b3('0xc')]);router['get'](_0x43b3('0xd'),auth['isAuthenticated'](),controller[_0x43b3('0xe')]);router[_0x43b3('0xa')](_0x43b3('0xf'),auth[_0x43b3('0xb')](),controller[_0x43b3('0x10')]);router['get']('/:id/fields',auth[_0x43b3('0xb')](),controller[_0x43b3('0x11')]);router[_0x43b3('0x12')]('/',auth[_0x43b3('0xb')](),controller[_0x43b3('0x13')]);router[_0x43b3('0x12')](_0x43b3('0xf'),auth[_0x43b3('0xb')](),controller[_0x43b3('0x14')]);router[_0x43b3('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x43b3('0xd'),auth['isAuthenticated'](),controller[_0x43b3('0x16')]);module[_0x43b3('0x17')]=router; \ No newline at end of file +var _0xa39b=['show','/:id/fields','post','create','/:id/configurations','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id'];(function(_0x419560,_0x16a92c){var _0x52a0a9=function(_0x1cdc67){while(--_0x1cdc67){_0x419560['push'](_0x419560['shift']());}};_0x52a0a9(++_0x16a92c);}(_0xa39b,0x199));var _0xba39=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa39b[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xba39('0x0'));var path=require(_0xba39('0x1'));var timeout=require(_0xba39('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xba39('0x3'));var config=require(_0xba39('0x4'));var controller=require(_0xba39('0x5'));router[_0xba39('0x6')]('/',auth[_0xba39('0x7')](),controller['index']);router[_0xba39('0x6')](_0xba39('0x8'),auth[_0xba39('0x7')](),controller[_0xba39('0x9')]);router['get']('/:id/configurations',auth[_0xba39('0x7')](),controller['getConfigurations']);router[_0xba39('0x6')](_0xba39('0xa'),auth[_0xba39('0x7')](),controller['getFields']);router[_0xba39('0xb')]('/',auth[_0xba39('0x7')](),controller[_0xba39('0xc')]);router[_0xba39('0xb')](_0xba39('0xd'),auth[_0xba39('0x7')](),controller['addConfiguration']);router[_0xba39('0xe')](_0xba39('0x8'),auth[_0xba39('0x7')](),controller[_0xba39('0xf')]);router[_0xba39('0x10')](_0xba39('0x8'),auth[_0xba39('0x7')](),controller[_0xba39('0x11')]);module[_0xba39('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 6a72945..47c7aa1 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 _0x6854=['remoteUri','sequelize','STRING','username'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0x6854,0x1cd));var _0x4685=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0x6854[_0xdd2bfa];return _0x55397e;};'use strict';var Sequelize=require(_0x4685('0x0'));module['exports']={'name':{'type':Sequelize[_0x4685('0x1')]},'description':{'type':Sequelize[_0x4685('0x1')]},'username':{'type':Sequelize[_0x4685('0x1')],'unique':_0x4685('0x2')},'password':{'type':Sequelize[_0x4685('0x1')]},'email':{'type':Sequelize[_0x4685('0x1')]},'remoteUri':{'type':Sequelize[_0x4685('0x1')],'unique':_0x4685('0x3')},'serverUrl':{'type':Sequelize[_0x4685('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5715=['username','remoteUri','sequelize','exports','STRING'];(function(_0x156259,_0x276ddf){var _0x3dafd7=function(_0x18c419){while(--_0x18c419){_0x156259['push'](_0x156259['shift']());}};_0x3dafd7(++_0x276ddf);}(_0x5715,0x110));var _0x5571=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x5715[_0x43a1b8];return _0x324ecc;};'use strict';var Sequelize=require(_0x5571('0x0'));module[_0x5571('0x1')]={'name':{'type':Sequelize[_0x5571('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x5571('0x2')],'unique':_0x5571('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5571('0x4')},'serverUrl':{'type':Sequelize[_0x5571('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 13f53a3..0dd647d 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 _0xd71e=['name','send','index','ServicenowAccount','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','show','params','keys','options','find','create','body','catch','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','reopened_time','work_notes','correlation_display','delivery_task','assignment_group','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','urgency','problem_id','company','reassignment_count','activity_due','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','location','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','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','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','stack'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd71e,0x12e));var _0xed71=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd71e[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xed71('0x0'));var rimraf=require(_0xed71('0x1'));var zipdir=require(_0xed71('0x2'));var jsonpatch=require(_0xed71('0x3'));var rp=require(_0xed71('0x4'));var moment=require('moment');var BPromise=require(_0xed71('0x5'));var Mustache=require(_0xed71('0x6'));var util=require('util');var path=require(_0xed71('0x7'));var sox=require(_0xed71('0x8'));var csv=require(_0xed71('0x9'));var ejs=require(_0xed71('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed71('0xb'));var squel=require(_0xed71('0xc'));var crypto=require(_0xed71('0xd'));var jsforce=require(_0xed71('0xe'));var deskjs=require(_0xed71('0xf'));var toCsv=require(_0xed71('0x9'));var querystring=require(_0xed71('0x10'));var Papa=require('papaparse');var Redis=require(_0xed71('0x11'));var authService=require(_0xed71('0x12'));var qs=require(_0xed71('0x13'));var as=require(_0xed71('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed71('0x15'))(_0xed71('0x16'));var utils=require(_0xed71('0x17'));var config=require(_0xed71('0x18'));var licenseUtil=require(_0xed71('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0xed71('0x1a'));function respondWithStatusCode(_0x20064c,_0x5ef22e){_0x5ef22e=_0x5ef22e||0xcc;return function(_0x141c48){if(_0x141c48){return _0x20064c['sendStatus'](_0x5ef22e);}return _0x20064c[_0xed71('0x1b')](_0x5ef22e)['end']();};}function respondWithResult(_0x23c795,_0x2f5d53){_0x2f5d53=_0x2f5d53||0xc8;return function(_0x58c43a){if(_0x58c43a){return _0x23c795[_0xed71('0x1b')](_0x2f5d53)[_0xed71('0x1c')](_0x58c43a);}};}function respondWithFilteredResult(_0x300eea,_0x37f254){return function(_0x295cac){if(_0x295cac){var _0x18360c=typeof _0x37f254[_0xed71('0x1d')]===_0xed71('0x1e')&&typeof _0x37f254[_0xed71('0x1f')]===_0xed71('0x1e');var _0x169b9f=_0x295cac[_0xed71('0x20')];var _0x5c3d14=_0x18360c?0x0:_0x37f254['offset'];var _0x13c06e=_0x18360c?_0x295cac[_0xed71('0x20')]:_0x37f254[_0xed71('0x1d')]+_0x37f254['limit'];var _0xbbc1c3;if(_0x13c06e>=_0x169b9f){_0x13c06e=_0x169b9f;_0xbbc1c3=0xc8;}else{_0xbbc1c3=0xce;}_0x300eea['status'](_0xbbc1c3);return _0x300eea['set'](_0xed71('0x21'),_0x5c3d14+'-'+_0x13c06e+'/'+_0x169b9f)[_0xed71('0x1c')](_0x295cac);}return null;};}function patchUpdates(_0xfb9e28){return function(_0x4db84c){try{jsonpatch['apply'](_0x4db84c,_0xfb9e28,!![]);}catch(_0x4c4338){return BPromise[_0xed71('0x22')](_0x4c4338);}return _0x4db84c['save']();};}function saveUpdates(_0x7a2874,_0x39921c){return function(_0x17f852){if(_0x17f852){return _0x17f852[_0xed71('0x23')](_0x7a2874)[_0xed71('0x24')](function(_0x3beb2e){return _0x3beb2e;});}return null;};}function removeEntity(_0x4d97fb,_0x29bfb9){return function(_0x588262){if(_0x588262){return _0x588262[_0xed71('0x25')]()['then'](function(){_0x4d97fb[_0xed71('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f589f,_0x3c2a9c){return function(_0x346b86){if(!_0x346b86){_0x2f589f['sendStatus'](0x194);}return _0x346b86;};}function handleError(_0x11a680,_0x418050){_0x418050=_0x418050||0x1f4;return function(_0x4d92bd){logger[_0xed71('0x26')](_0x4d92bd[_0xed71('0x27')]);if(_0x4d92bd[_0xed71('0x28')]){delete _0x4d92bd[_0xed71('0x28')];}_0x11a680['status'](_0x418050)[_0xed71('0x29')](_0x4d92bd);};}exports[_0xed71('0x2a')]=function(_0x51d03f,_0x4272b7){var _0x5a5063={},_0x6a670c={},_0x2fdfe2={'count':0x0,'rows':[]};var _0x39ecc8=_['map'](db[_0xed71('0x2b')][_0xed71('0x2c')],function(_0xf86336){return{'name':_0xf86336[_0xed71('0x2d')],'type':_0xf86336['type'][_0xed71('0x2e')]};});_0x6a670c['model']=_[_0xed71('0x2f')](_0x39ecc8,_0xed71('0x28'));_0x6a670c[_0xed71('0x30')]=_['keys'](_0x51d03f[_0xed71('0x30')]);_0x6a670c[_0xed71('0x31')]=_[_0xed71('0x32')](_0x6a670c[_0xed71('0x33')],_0x6a670c['query']);_0x5a5063['attributes']=_[_0xed71('0x32')](_0x6a670c[_0xed71('0x33')],qs[_0xed71('0x34')](_0x51d03f[_0xed71('0x30')][_0xed71('0x34')]));_0x5a5063[_0xed71('0x35')]=_0x5a5063[_0xed71('0x35')][_0xed71('0x36')]?_0x5a5063[_0xed71('0x35')]:_0x6a670c['model'];if(!_0x51d03f[_0xed71('0x30')][_0xed71('0x37')](_0xed71('0x38'))){_0x5a5063[_0xed71('0x1f')]=qs[_0xed71('0x1f')](_0x51d03f[_0xed71('0x30')][_0xed71('0x1f')]);_0x5a5063[_0xed71('0x1d')]=qs[_0xed71('0x1d')](_0x51d03f[_0xed71('0x30')][_0xed71('0x1d')]);}_0x5a5063[_0xed71('0x39')]=qs[_0xed71('0x3a')](_0x51d03f[_0xed71('0x30')][_0xed71('0x3a')]);_0x5a5063[_0xed71('0x3b')]=qs[_0xed71('0x31')](_[_0xed71('0x3c')](_0x51d03f[_0xed71('0x30')],_0x6a670c[_0xed71('0x31')]),_0x39ecc8);if(_0x51d03f[_0xed71('0x30')][_0xed71('0x3d')]){_0x5a5063[_0xed71('0x3b')]=_['merge'](_0x5a5063[_0xed71('0x3b')],{'$or':_[_0xed71('0x2f')](_0x39ecc8,function(_0x5f01c4){if(_0x5f01c4[_0xed71('0x3e')]!==_0xed71('0x3f')){var _0x4415f0={};_0x4415f0[_0x5f01c4['name']]={'$like':'%'+_0x51d03f['query'][_0xed71('0x3d')]+'%'};return _0x4415f0;}})});}_0x5a5063=_[_0xed71('0x40')]({},_0x5a5063,_0x51d03f['options']);var _0x5d0091={'where':_0x5a5063[_0xed71('0x3b')]};return db[_0xed71('0x2b')][_0xed71('0x20')](_0x5d0091)['then'](function(_0x5cd45e){_0x2fdfe2['count']=_0x5cd45e;if(_0x51d03f[_0xed71('0x30')][_0xed71('0x41')]){_0x5a5063[_0xed71('0x42')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xed71('0x43')](_0x5a5063);})['then'](function(_0x287d59){_0x2fdfe2['rows']=_0x287d59;return _0x2fdfe2;})['then'](respondWithFilteredResult(_0x4272b7,_0x5a5063))['catch'](handleError(_0x4272b7,null));};exports[_0xed71('0x44')]=function(_0x43200a,_0x191540){var _0xd07bff={'raw':![],'where':{'id':_0x43200a[_0xed71('0x45')]['id']}},_0xb2413d={};_0xb2413d[_0xed71('0x33')]=_[_0xed71('0x46')](db[_0xed71('0x2b')][_0xed71('0x2c')]);_0xb2413d['query']=_['keys'](_0x43200a[_0xed71('0x30')]);_0xb2413d[_0xed71('0x31')]=_[_0xed71('0x32')](_0xb2413d[_0xed71('0x33')],_0xb2413d[_0xed71('0x30')]);_0xd07bff[_0xed71('0x35')]=_['intersection'](_0xb2413d['model'],qs[_0xed71('0x34')](_0x43200a[_0xed71('0x30')][_0xed71('0x34')]));_0xd07bff['attributes']=_0xd07bff[_0xed71('0x35')][_0xed71('0x36')]?_0xd07bff['attributes']:_0xb2413d[_0xed71('0x33')];if(_0x43200a[_0xed71('0x30')][_0xed71('0x41')]){_0xd07bff['include']=[{'all':!![]}];}_0xd07bff=_['merge']({},_0xd07bff,_0x43200a[_0xed71('0x47')]);return db['ServicenowAccount'][_0xed71('0x48')](_0xd07bff)[_0xed71('0x24')](handleEntityNotFound(_0x191540,null))[_0xed71('0x24')](respondWithResult(_0x191540,null))['catch'](handleError(_0x191540,null));};exports[_0xed71('0x49')]=function(_0x411728,_0x213604){return db[_0xed71('0x2b')][_0xed71('0x49')](_0x411728['body'],{})[_0xed71('0x24')](respondWithResult(_0x213604,0xc9))['catch'](handleError(_0x213604,null));};exports[_0xed71('0x23')]=function(_0x5d9e79,_0x4eaf35){if(_0x5d9e79['body']['id']){delete _0x5d9e79[_0xed71('0x4a')]['id'];}return db[_0xed71('0x2b')][_0xed71('0x48')]({'where':{'id':_0x5d9e79[_0xed71('0x45')]['id']}})['then'](handleEntityNotFound(_0x4eaf35,null))[_0xed71('0x24')](saveUpdates(_0x5d9e79[_0xed71('0x4a')],null))[_0xed71('0x24')](respondWithResult(_0x4eaf35,null))[_0xed71('0x4b')](handleError(_0x4eaf35,null));};exports[_0xed71('0x25')]=function(_0x4b0798,_0x266abd){return db[_0xed71('0x2b')][_0xed71('0x48')]({'where':{'id':_0x4b0798['params']['id']}})['then'](handleEntityNotFound(_0x266abd,null))[_0xed71('0x24')](removeEntity(_0x266abd,null))[_0xed71('0x4b')](handleError(_0x266abd,null));};exports[_0xed71('0x4c')]=function(_0xcde293,_0x3707a9,_0x495dde){var _0x11d1c6={};var _0x25aaa4={};var _0x533b11;var _0x3f0708;return db[_0xed71('0x2b')][_0xed71('0x4d')]({'where':{'id':_0xcde293[_0xed71('0x45')]['id']}})[_0xed71('0x24')](handleEntityNotFound(_0x3707a9,null))['then'](function(_0x5ce2c0){if(_0x5ce2c0){_0x533b11=_0x5ce2c0;_0x25aaa4[_0xed71('0x33')]=_[_0xed71('0x46')](db[_0xed71('0x4e')][_0xed71('0x2c')]);_0x25aaa4[_0xed71('0x30')]=_[_0xed71('0x46')](_0xcde293[_0xed71('0x30')]);_0x25aaa4['filters']=_[_0xed71('0x32')](_0x25aaa4['model'],_0x25aaa4[_0xed71('0x30')]);_0x11d1c6['attributes']=_[_0xed71('0x32')](_0x25aaa4['model'],qs[_0xed71('0x34')](_0xcde293['query'][_0xed71('0x34')]));_0x11d1c6['attributes']=_0x11d1c6[_0xed71('0x35')][_0xed71('0x36')]?_0x11d1c6['attributes']:_0x25aaa4[_0xed71('0x33')];_0x11d1c6[_0xed71('0x39')]=qs[_0xed71('0x3a')](_0xcde293[_0xed71('0x30')][_0xed71('0x3a')]);_0x11d1c6[_0xed71('0x3b')]=qs[_0xed71('0x31')](_[_0xed71('0x3c')](_0xcde293[_0xed71('0x30')],_0x25aaa4[_0xed71('0x31')]));if(_0xcde293[_0xed71('0x30')][_0xed71('0x3d')]){_0x11d1c6[_0xed71('0x3b')]=_[_0xed71('0x40')](_0x11d1c6[_0xed71('0x3b')],{'$or':_[_0xed71('0x2f')](_0x11d1c6[_0xed71('0x35')],function(_0x26baa3){var _0x1c7d93={};_0x1c7d93[_0x26baa3]={'$like':'%'+_0xcde293['query'][_0xed71('0x3d')]+'%'};return _0x1c7d93;})});}_0x11d1c6=_['merge']({},_0x11d1c6,_0xcde293[_0xed71('0x47')]);return _0x533b11[_0xed71('0x4c')](_0x11d1c6);}})[_0xed71('0x24')](function(_0x525b26){if(_0x525b26){_0x3f0708=_0x525b26[_0xed71('0x36')];if(!_0xcde293[_0xed71('0x30')][_0xed71('0x37')](_0xed71('0x38'))){_0x11d1c6[_0xed71('0x1f')]=qs['limit'](_0xcde293[_0xed71('0x30')][_0xed71('0x1f')]);_0x11d1c6[_0xed71('0x1d')]=qs['offset'](_0xcde293['query'][_0xed71('0x1d')]);}return _0x533b11[_0xed71('0x4c')](_0x11d1c6);}})[_0xed71('0x24')](function(_0x8c8311){if(_0x8c8311){return _0x8c8311?{'count':_0x3f0708,'rows':_0x8c8311}:null;}})[_0xed71('0x24')](respondWithResult(_0x3707a9,null))[_0xed71('0x4b')](handleError(_0x3707a9,null));};exports['addConfiguration']=function(_0x32d364,_0x36b1f5,_0x2e9b17){if(_0x32d364[_0xed71('0x4a')]['id']){delete _0x32d364['body']['id'];}return db[_0xed71('0x2b')]['findOne']({'where':{'id':_0x32d364['params']['id']}})['then'](handleEntityNotFound(_0x36b1f5,null))[_0xed71('0x24')](function(_0x37bee0){if(_0x37bee0){_0x32d364[_0xed71('0x4a')]['AccountId']=_0x37bee0['id'];_0x32d364[_0xed71('0x4a')][_0xed71('0x4f')]=integrations[_0xed71('0x50')](_0x32d364['body'][_0xed71('0x51')],_0x32d364[_0xed71('0x4a')][_0xed71('0x3e')]);_0x32d364['body'][_0xed71('0x52')]=integrations['getDescriptions'](_0x32d364[_0xed71('0x4a')][_0xed71('0x51')],_0x32d364['body'][_0xed71('0x3e')]);return db[_0xed71('0x4e')]['create'](_0x32d364[_0xed71('0x4a')],{'include':[{'model':db[_0xed71('0x53')],'as':_0xed71('0x4f')},{'model':db[_0xed71('0x53')],'as':_0xed71('0x52')}]});}return null;})[_0xed71('0x24')](respondWithResult(_0x36b1f5,null))[_0xed71('0x4b')](handleError(_0x36b1f5,null));};exports[_0xed71('0x54')]=function(_0x4a4a38,_0x1a3718,_0x57bf76){var _0x1e13f1=['made_sla',_0xed71('0x55'),_0xed71('0x56'),_0xed71('0x57'),_0xed71('0x58'),_0xed71('0x59'),_0xed71('0x5a'),'severity',_0xed71('0x5b')];var _0x4d2238=[_0xed71('0x5c'),'made_sla',_0xed71('0x5d'),_0xed71('0x5e'),_0xed71('0x5f'),'sys_updated_on',_0xed71('0x60'),_0xed71('0x55'),'approval_history',_0xed71('0x61'),'resolved_by',_0xed71('0x62'),_0xed71('0x63'),_0xed71('0x64'),_0xed71('0x65'),_0xed71('0x66'),_0xed71('0x67'),'sys_created_by',_0xed71('0x56'),'order',_0xed71('0x68'),_0xed71('0x69'),_0xed71('0x6a'),_0xed71('0x6b'),_0xed71('0x6c'),_0xed71('0x6d'),'work_notes_list',_0xed71('0x6e'),'priority',_0xed71('0x6f'),_0xed71('0x70'),_0xed71('0x71'),'expected_start',_0xed71('0x72'),_0xed71('0x73'),_0xed71('0x74'),'work_end',_0xed71('0x75'),'resolved_at','caller_id','approval_set',_0xed71('0x57'),_0xed71('0x76'),'short_description','close_code',_0xed71('0x77'),_0xed71('0x78'),'work_start',_0xed71('0x79'),'business_stc','additional_assignee_list','description',_0xed71('0x7a'),_0xed71('0x59'),'sys_class_name',_0xed71('0x7b'),_0xed71('0x7c'),_0xed71('0x7d'),_0xed71('0x7e'),_0xed71('0x7f'),'contact_type','reopened_by','incident_state',_0xed71('0x80'),_0xed71('0x81'),_0xed71('0x82'),_0xed71('0x83'),_0xed71('0x84'),'assigned_to','severity',_0xed71('0x85'),'sla_due',_0xed71('0x86'),_0xed71('0x87'),_0xed71('0x88'),'sys_mod_count',_0xed71('0x89'),_0xed71('0x8a'),_0xed71('0x8b'),_0xed71('0x8c'),'correlation_id',_0xed71('0x8d'),_0xed71('0x5b')];var _0x139272='';var _0xc34805='';var _0x6b5b48=[];var _0x4d7021='';var _0x309580='';var _0x2f35db=[];var _0x21ec42='';var _0x4d24d9='';var _0x2aa54b={};var _0xb198d1='';return db[_0xed71('0x2b')][_0xed71('0x4d')]({'where':{'id':_0x4a4a38['params']['id']},'attributes':['id',_0xed71('0x8e'),_0xed71('0x8f'),'email',_0xed71('0x90'),_0xed71('0x91')]})[_0xed71('0x24')](handleEntityNotFound(_0x1a3718,null))[_0xed71('0x24')](function(_0xeaadbe){if(_0xeaadbe){_0xb198d1=_0xeaadbe[_0xed71('0x90')];var _0xb9ac9e=_0xb198d1[_0xed71('0x92')](-0x1);if(_0xb9ac9e==='/'){_0xb198d1=_0xb198d1[_0xed71('0x93')](0x0,_0xb198d1[_0xed71('0x94')](_0xb9ac9e));}_0x4d24d9=util[_0xed71('0x95')]('%s/api/now/doc/table/schema/',_0xb198d1);_0x21ec42=util[_0xed71('0x95')]('%s/api/now/table/',_0xb198d1);_0x2aa54b={'user':_0xeaadbe[_0xed71('0x8e')],'pass':_0xeaadbe[_0xed71('0x8f')]};var _0x4692c5={'method':_0xed71('0x96'),'uri':_0x4d24d9+_0xed71('0x97'),'auth':_0x2aa54b,'json':!![]};return rp(_0x4692c5);}})['then'](function(_0x43ec60){if(_0x43ec60[_0xed71('0x98')][_0xed71('0x36')]>0x0){_0x139272=_0x43ec60[_0xed71('0x98')];}console[_0xed71('0x99')](_0xed71('0x9a'),_0x139272);_0x2f35db=[];_0xc34805=Object[_0xed71('0x9b')]([],_0x139272);_[_0xed71('0x9c')](_0xc34805,function(_0x4cb2cc){return!_0x1e13f1[_0xed71('0x9d')](_0x4cb2cc[_0xed71('0x28')]);});_0xc34805[_0xed71('0x9e')](function(_0x2025ba){var _0x498c8f=createFieldObject(_0x21ec42,_0x2aa54b,_0x2025ba[_0xed71('0x9f')],_0x2025ba['name'],_0x2025ba[_0xed71('0xa0')],![]);_0x2f35db[_0xed71('0xa1')](_0x498c8f);});return Promise[_0xed71('0xa2')](_0x2f35db);})[_0xed71('0x24')](function(_0x237e9d){_0x6b5b48=_0x237e9d;_0x4d7021=Object['assign']([],_0x139272);console[_0xed71('0x99')]('TCL:\x20_object',_0x139272);_[_0xed71('0x9c')](_0x4d7021,function(_0x270b43){return _0x4d2238[_0xed71('0x9d')](_0x270b43[_0xed71('0x28')]);});console['log'](_0xed71('0xa3'),_0x4d7021);_0x2f35db=[];_0x4d7021[_0xed71('0x9e')](function(_0x3d1109){var _0x48563c=createFieldObject(_0x21ec42,_0x2aa54b,_0x3d1109[_0xed71('0x9f')],_0x3d1109[_0xed71('0x28')],_0x3d1109[_0xed71('0xa0')],!![]);_0x2f35db[_0xed71('0xa1')](_0x48563c);});return Promise[_0xed71('0xa2')](_0x2f35db);})['then'](function(_0x2b418b){_0x309580=_0x2b418b;var _0x7c23f8=_0x6b5b48[_0xed71('0xa4')](_0x309580);return{'count':_0x7c23f8[_0xed71('0x36')],'rows':_0x7c23f8};})[_0xed71('0x24')](respondWithResult(_0x1a3718,null))[_0xed71('0x4b')](function(_0x24d7aa){console['log'](_0xed71('0xa5')+_0x24d7aa);var _0xe76ad8=_0x4a4a38[_0xed71('0x30')][_0xed71('0xa6')]?0x1f4:_0x24d7aa[_0xed71('0xa7')]||0x1f4;logger[_0xed71('0x26')](_0x24d7aa[_0xed71('0x27')]);delete _0x24d7aa[_0xed71('0x28')];if(_0xe76ad8===0x191){_0xe76ad8=0x190;}_0x1a3718['status'](_0xe76ad8)['send'](_0x4a4a38[_0xed71('0x30')][_0xed71('0xa6')]?{'message':_0xed71('0xa8'),'statusCode':_0x24d7aa[_0xed71('0xa7')]}:_0x24d7aa);});};function createFieldObject(_0x43c870,_0x57708a,_0xa0fb50,_0xd7ff8,_0x46ff41,_0x2e35f5){return new Promise(function(_0x158db4,_0x4f76ad){var _0x124015={'id':_0xd7ff8,'name':_0x46ff41,'custom':_0x2e35f5};if(_0xa0fb50===_0xed71('0xa9')){_0x124015[_0xed71('0x47')]=[{'name':'True','value':'true'},{'name':'False','value':'false'}];_0x158db4(_0x124015);}else{var _0x5543bb={'method':_0xed71('0x96'),'uri':_0x43c870+'sys_choice?sysparm_query=name=incident^element='+_0xd7ff8,'auth':_0x57708a,'json':!![]};return rp(_0x5543bb)[_0xed71('0x24')](function(_0x2c965d){var _0x1a63eb=[];if(_0x2c965d[_0xed71('0x98')][_0xed71('0x36')]>0x0){_0x2c965d['result'][_0xed71('0x9e')](function(_0x533a6d){if(_0x533a6d['inactive']==='false'){var _0x5f1b79={'name':_0x533a6d['label'],'value':_0x533a6d[_0xed71('0xaa')]};_0x1a63eb[_0xed71('0xa1')](_0x5f1b79);}});}_0x124015[_0xed71('0x47')]=_0x1a63eb;if(_0x124015[_0xed71('0x47')]['length']>0x0){_0x158db4(_0x124015);}else{if(_0x2e35f5==![]){_0x158db4();}else{_0x158db4(_0x124015);}}});}});} \ No newline at end of file +var _0xa9f5=['crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','where','pick','merge','filter','options','ServicenowAccount','count','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','getConfigurations','ServicenowConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','incident_state','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','password','remoteUri','lastIndexOf','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','log','remove','includes','forEach','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','push','concat','ServiceNow\x20error:\x20','test','send','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel'];(function(_0x13ed96,_0x34440b){var _0x413bfb=function(_0x2d5889){while(--_0x2d5889){_0x13ed96['push'](_0x13ed96['shift']());}};_0x413bfb(++_0x34440b);}(_0xa9f5,0x164));var _0x5a9f=function(_0x25bfe9,_0x320665){_0x25bfe9=_0x25bfe9-0x0;var _0x4042dd=_0xa9f5[_0x25bfe9];return _0x4042dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a9f('0x0'));var zipdir=require(_0x5a9f('0x1'));var jsonpatch=require(_0x5a9f('0x2'));var rp=require('request-promise');var moment=require(_0x5a9f('0x3'));var BPromise=require(_0x5a9f('0x4'));var Mustache=require(_0x5a9f('0x5'));var util=require(_0x5a9f('0x6'));var path=require(_0x5a9f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a9f('0x8'));var fs=require('fs');var fs_extra=require(_0x5a9f('0x9'));var _=require(_0x5a9f('0xa'));var squel=require(_0x5a9f('0xb'));var crypto=require(_0x5a9f('0xc'));var jsforce=require(_0x5a9f('0xd'));var deskjs=require(_0x5a9f('0xe'));var toCsv=require(_0x5a9f('0xf'));var querystring=require('querystring');var Papa=require(_0x5a9f('0x10'));var Redis=require(_0x5a9f('0x11'));var authService=require(_0x5a9f('0x12'));var qs=require(_0x5a9f('0x13'));var as=require(_0x5a9f('0x14'));var hardwareService=require(_0x5a9f('0x15'));var logger=require('../../config/logger')(_0x5a9f('0x16'));var utils=require(_0x5a9f('0x17'));var config=require(_0x5a9f('0x18'));var licenseUtil=require(_0x5a9f('0x19'));var db=require(_0x5a9f('0x1a'))['db'];var integrations=require(_0x5a9f('0x1b'));function respondWithStatusCode(_0x3346aa,_0x58fbff){_0x58fbff=_0x58fbff||0xcc;return function(_0x15fd43){if(_0x15fd43){return _0x3346aa[_0x5a9f('0x1c')](_0x58fbff);}return _0x3346aa[_0x5a9f('0x1d')](_0x58fbff)[_0x5a9f('0x1e')]();};}function respondWithResult(_0x2582cc,_0xf1b769){_0xf1b769=_0xf1b769||0xc8;return function(_0x193b59){if(_0x193b59){return _0x2582cc[_0x5a9f('0x1d')](_0xf1b769)['json'](_0x193b59);}};}function respondWithFilteredResult(_0x4b0ea7,_0x23059c){return function(_0x4e39e0){if(_0x4e39e0){var _0x5ade70=typeof _0x23059c[_0x5a9f('0x1f')]===_0x5a9f('0x20')&&typeof _0x23059c['limit']===_0x5a9f('0x20');var _0x182f67=_0x4e39e0['count'];var _0x3da261=_0x5ade70?0x0:_0x23059c[_0x5a9f('0x1f')];var _0x4936f6=_0x5ade70?_0x4e39e0['count']:_0x23059c[_0x5a9f('0x1f')]+_0x23059c[_0x5a9f('0x21')];var _0x330ac1;if(_0x4936f6>=_0x182f67){_0x4936f6=_0x182f67;_0x330ac1=0xc8;}else{_0x330ac1=0xce;}_0x4b0ea7[_0x5a9f('0x1d')](_0x330ac1);return _0x4b0ea7['set'](_0x5a9f('0x22'),_0x3da261+'-'+_0x4936f6+'/'+_0x182f67)[_0x5a9f('0x23')](_0x4e39e0);}return null;};}function patchUpdates(_0x1d25b9){return function(_0x205c62){try{jsonpatch[_0x5a9f('0x24')](_0x205c62,_0x1d25b9,!![]);}catch(_0x57a9dc){return BPromise[_0x5a9f('0x25')](_0x57a9dc);}return _0x205c62[_0x5a9f('0x26')]();};}function saveUpdates(_0xf01b7d,_0x150a12){return function(_0x6e41a0){if(_0x6e41a0){return _0x6e41a0[_0x5a9f('0x27')](_0xf01b7d)[_0x5a9f('0x28')](function(_0x23f203){return _0x23f203;});}return null;};}function removeEntity(_0x361096,_0x53f39d){return function(_0x382ad5){if(_0x382ad5){return _0x382ad5[_0x5a9f('0x29')]()[_0x5a9f('0x28')](function(){_0x361096[_0x5a9f('0x1d')](0xcc)[_0x5a9f('0x1e')]();});}};}function handleEntityNotFound(_0x34f68e,_0x4c1179){return function(_0x1e1348){if(!_0x1e1348){_0x34f68e[_0x5a9f('0x1c')](0x194);}return _0x1e1348;};}function handleError(_0x329352,_0x2dc7da){_0x2dc7da=_0x2dc7da||0x1f4;return function(_0x43a801){logger[_0x5a9f('0x2a')](_0x43a801[_0x5a9f('0x2b')]);if(_0x43a801[_0x5a9f('0x2c')]){delete _0x43a801[_0x5a9f('0x2c')];}_0x329352[_0x5a9f('0x1d')](_0x2dc7da)['send'](_0x43a801);};}exports[_0x5a9f('0x2d')]=function(_0x272abd,_0x334e58){var _0x981d77={},_0x52dd42={},_0x53153b={'count':0x0,'rows':[]};var _0x5534ee=_[_0x5a9f('0x2e')](db['ServicenowAccount'][_0x5a9f('0x2f')],function(_0x2eb2e3){return{'name':_0x2eb2e3['fieldName'],'type':_0x2eb2e3[_0x5a9f('0x30')]['key']};});_0x52dd42[_0x5a9f('0x31')]=_[_0x5a9f('0x2e')](_0x5534ee,_0x5a9f('0x2c'));_0x52dd42[_0x5a9f('0x32')]=_['keys'](_0x272abd['query']);_0x52dd42[_0x5a9f('0x33')]=_[_0x5a9f('0x34')](_0x52dd42[_0x5a9f('0x31')],_0x52dd42[_0x5a9f('0x32')]);_0x981d77[_0x5a9f('0x35')]=_[_0x5a9f('0x34')](_0x52dd42[_0x5a9f('0x31')],qs[_0x5a9f('0x36')](_0x272abd[_0x5a9f('0x32')][_0x5a9f('0x36')]));_0x981d77['attributes']=_0x981d77[_0x5a9f('0x35')]['length']?_0x981d77['attributes']:_0x52dd42[_0x5a9f('0x31')];if(!_0x272abd[_0x5a9f('0x32')]['hasOwnProperty'](_0x5a9f('0x37'))){_0x981d77['limit']=qs[_0x5a9f('0x21')](_0x272abd['query'][_0x5a9f('0x21')]);_0x981d77[_0x5a9f('0x1f')]=qs[_0x5a9f('0x1f')](_0x272abd[_0x5a9f('0x32')][_0x5a9f('0x1f')]);}_0x981d77[_0x5a9f('0x38')]=qs['sort'](_0x272abd[_0x5a9f('0x32')]['sort']);_0x981d77[_0x5a9f('0x39')]=qs['filters'](_[_0x5a9f('0x3a')](_0x272abd[_0x5a9f('0x32')],_0x52dd42[_0x5a9f('0x33')]),_0x5534ee);if(_0x272abd[_0x5a9f('0x32')]['filter']){_0x981d77[_0x5a9f('0x39')]=_[_0x5a9f('0x3b')](_0x981d77[_0x5a9f('0x39')],{'$or':_[_0x5a9f('0x2e')](_0x5534ee,function(_0x2a3021){if(_0x2a3021[_0x5a9f('0x30')]!=='VIRTUAL'){var _0x4cb0b6={};_0x4cb0b6[_0x2a3021[_0x5a9f('0x2c')]]={'$like':'%'+_0x272abd[_0x5a9f('0x32')][_0x5a9f('0x3c')]+'%'};return _0x4cb0b6;}})});}_0x981d77=_[_0x5a9f('0x3b')]({},_0x981d77,_0x272abd[_0x5a9f('0x3d')]);var _0x4823b8={'where':_0x981d77[_0x5a9f('0x39')]};return db[_0x5a9f('0x3e')][_0x5a9f('0x3f')](_0x4823b8)[_0x5a9f('0x28')](function(_0x140a14){_0x53153b[_0x5a9f('0x3f')]=_0x140a14;if(_0x272abd['query'][_0x5a9f('0x40')]){_0x981d77[_0x5a9f('0x41')]=[{'all':!![]}];}return db[_0x5a9f('0x3e')][_0x5a9f('0x42')](_0x981d77);})[_0x5a9f('0x28')](function(_0x3e76de){_0x53153b[_0x5a9f('0x43')]=_0x3e76de;return _0x53153b;})[_0x5a9f('0x28')](respondWithFilteredResult(_0x334e58,_0x981d77))[_0x5a9f('0x44')](handleError(_0x334e58,null));};exports[_0x5a9f('0x45')]=function(_0x16aad0,_0x10dd36){var _0x5b098f={'raw':![],'where':{'id':_0x16aad0['params']['id']}},_0x15076a={};_0x15076a[_0x5a9f('0x31')]=_[_0x5a9f('0x46')](db[_0x5a9f('0x3e')][_0x5a9f('0x2f')]);_0x15076a[_0x5a9f('0x32')]=_[_0x5a9f('0x46')](_0x16aad0[_0x5a9f('0x32')]);_0x15076a['filters']=_['intersection'](_0x15076a['model'],_0x15076a[_0x5a9f('0x32')]);_0x5b098f[_0x5a9f('0x35')]=_['intersection'](_0x15076a[_0x5a9f('0x31')],qs[_0x5a9f('0x36')](_0x16aad0[_0x5a9f('0x32')][_0x5a9f('0x36')]));_0x5b098f['attributes']=_0x5b098f[_0x5a9f('0x35')][_0x5a9f('0x47')]?_0x5b098f[_0x5a9f('0x35')]:_0x15076a[_0x5a9f('0x31')];if(_0x16aad0['query'][_0x5a9f('0x40')]){_0x5b098f[_0x5a9f('0x41')]=[{'all':!![]}];}_0x5b098f=_[_0x5a9f('0x3b')]({},_0x5b098f,_0x16aad0[_0x5a9f('0x3d')]);return db['ServicenowAccount'][_0x5a9f('0x48')](_0x5b098f)['then'](handleEntityNotFound(_0x10dd36,null))[_0x5a9f('0x28')](respondWithResult(_0x10dd36,null))[_0x5a9f('0x44')](handleError(_0x10dd36,null));};exports['create']=function(_0x353bb3,_0x109d48){return db[_0x5a9f('0x3e')][_0x5a9f('0x49')](_0x353bb3[_0x5a9f('0x4a')],{})[_0x5a9f('0x28')](respondWithResult(_0x109d48,0xc9))['catch'](handleError(_0x109d48,null));};exports[_0x5a9f('0x27')]=function(_0x4b78a8,_0x499d76){if(_0x4b78a8[_0x5a9f('0x4a')]['id']){delete _0x4b78a8[_0x5a9f('0x4a')]['id'];}return db[_0x5a9f('0x3e')][_0x5a9f('0x48')]({'where':{'id':_0x4b78a8[_0x5a9f('0x4b')]['id']}})[_0x5a9f('0x28')](handleEntityNotFound(_0x499d76,null))[_0x5a9f('0x28')](saveUpdates(_0x4b78a8['body'],null))[_0x5a9f('0x28')](respondWithResult(_0x499d76,null))[_0x5a9f('0x44')](handleError(_0x499d76,null));};exports['destroy']=function(_0x526b7f,_0x130704){return db['ServicenowAccount'][_0x5a9f('0x48')]({'where':{'id':_0x526b7f[_0x5a9f('0x4b')]['id']}})[_0x5a9f('0x28')](handleEntityNotFound(_0x130704,null))[_0x5a9f('0x28')](removeEntity(_0x130704,null))[_0x5a9f('0x44')](handleError(_0x130704,null));};exports[_0x5a9f('0x4c')]=function(_0x12d2d5,_0x330a9a,_0x814654){var _0x1a7880={};var _0x6c2332={};var _0x30d723;var _0x35dacf;return db[_0x5a9f('0x3e')]['findOne']({'where':{'id':_0x12d2d5['params']['id']}})['then'](handleEntityNotFound(_0x330a9a,null))[_0x5a9f('0x28')](function(_0x1243c8){if(_0x1243c8){_0x30d723=_0x1243c8;_0x6c2332[_0x5a9f('0x31')]=_[_0x5a9f('0x46')](db[_0x5a9f('0x4d')]['rawAttributes']);_0x6c2332[_0x5a9f('0x32')]=_['keys'](_0x12d2d5['query']);_0x6c2332[_0x5a9f('0x33')]=_[_0x5a9f('0x34')](_0x6c2332['model'],_0x6c2332[_0x5a9f('0x32')]);_0x1a7880['attributes']=_[_0x5a9f('0x34')](_0x6c2332['model'],qs[_0x5a9f('0x36')](_0x12d2d5['query'][_0x5a9f('0x36')]));_0x1a7880[_0x5a9f('0x35')]=_0x1a7880[_0x5a9f('0x35')]['length']?_0x1a7880[_0x5a9f('0x35')]:_0x6c2332[_0x5a9f('0x31')];_0x1a7880[_0x5a9f('0x38')]=qs[_0x5a9f('0x4e')](_0x12d2d5['query'][_0x5a9f('0x4e')]);_0x1a7880['where']=qs['filters'](_['pick'](_0x12d2d5[_0x5a9f('0x32')],_0x6c2332[_0x5a9f('0x33')]));if(_0x12d2d5[_0x5a9f('0x32')][_0x5a9f('0x3c')]){_0x1a7880[_0x5a9f('0x39')]=_['merge'](_0x1a7880[_0x5a9f('0x39')],{'$or':_[_0x5a9f('0x2e')](_0x1a7880[_0x5a9f('0x35')],function(_0x3030f9){var _0x3a184c={};_0x3a184c[_0x3030f9]={'$like':'%'+_0x12d2d5[_0x5a9f('0x32')]['filter']+'%'};return _0x3a184c;})});}_0x1a7880=_['merge']({},_0x1a7880,_0x12d2d5[_0x5a9f('0x3d')]);return _0x30d723[_0x5a9f('0x4c')](_0x1a7880);}})['then'](function(_0x2f1be6){if(_0x2f1be6){_0x35dacf=_0x2f1be6[_0x5a9f('0x47')];if(!_0x12d2d5['query'][_0x5a9f('0x4f')]('nolimit')){_0x1a7880[_0x5a9f('0x21')]=qs['limit'](_0x12d2d5[_0x5a9f('0x32')]['limit']);_0x1a7880[_0x5a9f('0x1f')]=qs[_0x5a9f('0x1f')](_0x12d2d5[_0x5a9f('0x32')][_0x5a9f('0x1f')]);}return _0x30d723[_0x5a9f('0x4c')](_0x1a7880);}})[_0x5a9f('0x28')](function(_0x403c9d){if(_0x403c9d){return _0x403c9d?{'count':_0x35dacf,'rows':_0x403c9d}:null;}})[_0x5a9f('0x28')](respondWithResult(_0x330a9a,null))[_0x5a9f('0x44')](handleError(_0x330a9a,null));};exports[_0x5a9f('0x50')]=function(_0x5d5529,_0x5072fb,_0x7f2c53){if(_0x5d5529[_0x5a9f('0x4a')]['id']){delete _0x5d5529['body']['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x5d5529[_0x5a9f('0x4b')]['id']}})[_0x5a9f('0x28')](handleEntityNotFound(_0x5072fb,null))[_0x5a9f('0x28')](function(_0x33c85d){if(_0x33c85d){_0x5d5529[_0x5a9f('0x4a')][_0x5a9f('0x51')]=_0x33c85d['id'];_0x5d5529[_0x5a9f('0x4a')][_0x5a9f('0x52')]=integrations[_0x5a9f('0x53')](_0x5d5529['body'][_0x5a9f('0x54')],_0x5d5529[_0x5a9f('0x4a')]['type']);_0x5d5529['body'][_0x5a9f('0x55')]=integrations['getDescriptions'](_0x5d5529['body'][_0x5a9f('0x54')],_0x5d5529[_0x5a9f('0x4a')][_0x5a9f('0x30')]);return db['ServicenowConfiguration'][_0x5a9f('0x49')](_0x5d5529['body'],{'include':[{'model':db[_0x5a9f('0x56')],'as':_0x5a9f('0x52')},{'model':db['ServicenowField'],'as':'Descriptions'}]});}return null;})[_0x5a9f('0x28')](respondWithResult(_0x5072fb,null))['catch'](handleError(_0x5072fb,null));};exports['getFields']=function(_0x57cdcb,_0x45a72d,_0x32c3ec){var _0x5e07a7=[_0x5a9f('0x57'),_0x5a9f('0x58'),_0x5a9f('0x59'),_0x5a9f('0x5a'),'close_code','notify',_0x5a9f('0x5b'),'severity',_0x5a9f('0x5c')];var _0x4689ed=[_0x5a9f('0x5d'),_0x5a9f('0x57'),_0x5a9f('0x5e'),_0x5a9f('0x5f'),'upon_reject',_0x5a9f('0x60'),_0x5a9f('0x61'),_0x5a9f('0x58'),_0x5a9f('0x62'),'number',_0x5a9f('0x63'),'sys_updated_by',_0x5a9f('0x64'),_0x5a9f('0x65'),_0x5a9f('0x66'),'sys_domain','state',_0x5a9f('0x67'),_0x5a9f('0x59'),_0x5a9f('0x38'),_0x5a9f('0x68'),_0x5a9f('0x69'),_0x5a9f('0x6a'),_0x5a9f('0x6b'),'impact',_0x5a9f('0x6c'),_0x5a9f('0x6d'),_0x5a9f('0x6e'),_0x5a9f('0x6f'),_0x5a9f('0x70'),'rfc',_0x5a9f('0x71'),_0x5a9f('0x72'),_0x5a9f('0x73'),_0x5a9f('0x74'),_0x5a9f('0x75'),_0x5a9f('0x76'),_0x5a9f('0x77'),_0x5a9f('0x78'),_0x5a9f('0x79'),_0x5a9f('0x7a'),_0x5a9f('0x5a'),'work_notes','short_description',_0x5a9f('0x7b'),_0x5a9f('0x7c'),_0x5a9f('0x7d'),_0x5a9f('0x7e'),_0x5a9f('0x7f'),_0x5a9f('0x80'),_0x5a9f('0x81'),_0x5a9f('0x82'),'calendar_duration',_0x5a9f('0x83'),_0x5a9f('0x84'),_0x5a9f('0x85'),_0x5a9f('0x86'),_0x5a9f('0x87'),_0x5a9f('0x88'),'sys_id','contact_type',_0x5a9f('0x89'),_0x5a9f('0x5b'),_0x5a9f('0x8a'),_0x5a9f('0x8b'),'company',_0x5a9f('0x8c'),_0x5a9f('0x8d'),_0x5a9f('0x8e'),'severity',_0x5a9f('0x8f'),'sla_due','approval',_0x5a9f('0x90'),_0x5a9f('0x91'),_0x5a9f('0x92'),'reopen_count','sys_tags',_0x5a9f('0x93'),_0x5a9f('0x94'),_0x5a9f('0x95'),_0x5a9f('0x96'),'category'];var _0x165297='';var _0x275c46='';var _0x4dcafc=[];var _0x47e5de='';var _0x25637e='';var _0x554971=[];var _0x1d74f4='';var _0x106220='';var _0x2a6f78={};var _0x3d3447='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x57cdcb[_0x5a9f('0x4b')]['id']},'attributes':['id','username',_0x5a9f('0x97'),'email','remoteUri','serverUrl']})[_0x5a9f('0x28')](handleEntityNotFound(_0x45a72d,null))['then'](function(_0x57cfc7){if(_0x57cfc7){_0x3d3447=_0x57cfc7[_0x5a9f('0x98')];var _0x1d809d=_0x3d3447['slice'](-0x1);if(_0x1d809d==='/'){_0x3d3447=_0x3d3447['substring'](0x0,_0x3d3447[_0x5a9f('0x99')](_0x1d809d));}_0x106220=util['format']('%s/api/now/doc/table/schema/',_0x3d3447);_0x1d74f4=util[_0x5a9f('0x9a')](_0x5a9f('0x9b'),_0x3d3447);_0x2a6f78={'user':_0x57cfc7[_0x5a9f('0x9c')],'pass':_0x57cfc7['password']};var _0x516192={'method':_0x5a9f('0x9d'),'uri':_0x106220+_0x5a9f('0x9e'),'auth':_0x2a6f78,'json':!![]};return rp(_0x516192);}})[_0x5a9f('0x28')](function(_0x27b345){if(_0x27b345['result']['length']>0x0){_0x165297=_0x27b345[_0x5a9f('0x9f')];}console[_0x5a9f('0xa0')]('incident\x20table\x20objects',_0x165297);_0x554971=[];_0x275c46=Object['assign']([],_0x165297);_[_0x5a9f('0xa1')](_0x275c46,function(_0x536997){return!_0x5e07a7[_0x5a9f('0xa2')](_0x536997['name']);});_0x275c46[_0x5a9f('0xa3')](function(_0x526652){var _0x3f6811=createFieldObject(_0x1d74f4,_0x2a6f78,_0x526652['internalType'],_0x526652['name'],_0x526652[_0x5a9f('0xa4')],![]);_0x554971['push'](_0x3f6811);});return Promise[_0x5a9f('0xa5')](_0x554971);})[_0x5a9f('0x28')](function(_0x3d0a3a){_0x4dcafc=_0x3d0a3a;_0x47e5de=Object[_0x5a9f('0xa6')]([],_0x165297);console[_0x5a9f('0xa0')](_0x5a9f('0xa7'),_0x165297);_['remove'](_0x47e5de,function(_0x48adf8){return _0x4689ed[_0x5a9f('0xa2')](_0x48adf8[_0x5a9f('0x2c')]);});console['log'](_0x5a9f('0xa8'),_0x47e5de);_0x554971=[];_0x47e5de[_0x5a9f('0xa3')](function(_0x26db3f){var _0x5d87a9=createFieldObject(_0x1d74f4,_0x2a6f78,_0x26db3f[_0x5a9f('0xa9')],_0x26db3f[_0x5a9f('0x2c')],_0x26db3f[_0x5a9f('0xa4')],!![]);_0x554971[_0x5a9f('0xaa')](_0x5d87a9);});return Promise[_0x5a9f('0xa5')](_0x554971);})[_0x5a9f('0x28')](function(_0x8e3fa){_0x25637e=_0x8e3fa;var _0xbbc26e=_0x4dcafc[_0x5a9f('0xab')](_0x25637e);return{'count':_0xbbc26e[_0x5a9f('0x47')],'rows':_0xbbc26e};})[_0x5a9f('0x28')](respondWithResult(_0x45a72d,null))[_0x5a9f('0x44')](function(_0x5f4109){console[_0x5a9f('0xa0')](_0x5a9f('0xac')+_0x5f4109);var _0x53d6d8=_0x57cdcb[_0x5a9f('0x32')][_0x5a9f('0xad')]?0x1f4:_0x5f4109['statusCode']||0x1f4;logger[_0x5a9f('0x2a')](_0x5f4109[_0x5a9f('0x2b')]);delete _0x5f4109['name'];if(_0x53d6d8===0x191){_0x53d6d8=0x190;}_0x45a72d[_0x5a9f('0x1d')](_0x53d6d8)[_0x5a9f('0xae')](_0x57cdcb[_0x5a9f('0x32')][_0x5a9f('0xad')]?{'message':_0x5a9f('0xaf'),'statusCode':_0x5f4109['statusCode']}:_0x5f4109);});};function createFieldObject(_0x2da1fd,_0x37bb1e,_0x46551f,_0x17c27e,_0x1f0dcd,_0x5cb44c){return new Promise(function(_0x480d80,_0x3c2ab6){var _0x4a8be2={'id':_0x17c27e,'name':_0x1f0dcd,'custom':_0x5cb44c};if(_0x46551f===_0x5a9f('0xb0')){_0x4a8be2[_0x5a9f('0x3d')]=[{'name':_0x5a9f('0xb1'),'value':_0x5a9f('0xb2')},{'name':_0x5a9f('0xb3'),'value':'false'}];_0x480d80(_0x4a8be2);}else{var _0x15c3ff={'method':_0x5a9f('0x9d'),'uri':_0x2da1fd+_0x5a9f('0xb4')+_0x17c27e,'auth':_0x37bb1e,'json':!![]};return rp(_0x15c3ff)[_0x5a9f('0x28')](function(_0x5b05c3){var _0x391851=[];if(_0x5b05c3[_0x5a9f('0x9f')][_0x5a9f('0x47')]>0x0){_0x5b05c3[_0x5a9f('0x9f')][_0x5a9f('0xa3')](function(_0x482895){if(_0x482895[_0x5a9f('0xb5')]===_0x5a9f('0xb6')){var _0x41d0bc={'name':_0x482895['label'],'value':_0x482895[_0x5a9f('0xb7')]};_0x391851['push'](_0x41d0bc);}});}_0x4a8be2['options']=_0x391851;if(_0x4a8be2[_0x5a9f('0x3d')]['length']>0x0){_0x480d80(_0x4a8be2);}else{if(_0x5cb44c==![]){_0x480d80();}else{_0x480d80(_0x4a8be2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 74056ba..f05540f 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 _0xee14=['ServicenowAccount','int_servicenow_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define'];(function(_0x157c0d,_0x15f30a){var _0x469cc9=function(_0x488765){while(--_0x488765){_0x157c0d['push'](_0x157c0d['shift']());}};_0x469cc9(++_0x15f30a);}(_0xee14,0x13a));var _0x4ee1=function(_0x193dcf,_0x33a3bc){_0x193dcf=_0x193dcf-0x0;var _0x58481a=_0xee14[_0x193dcf];return _0x58481a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var moment=require(_0x4ee1('0x2'));var BPromise=require(_0x4ee1('0x3'));var rp=require(_0x4ee1('0x4'));var fs=require('fs');var path=require(_0x4ee1('0x5'));var rimraf=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var attributes=require(_0x4ee1('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x4ee1('0x9')]=function(_0x573700,_0x327c18){return _0x573700[_0x4ee1('0xa')](_0x4ee1('0xb'),attributes,{'tableName':_0x4ee1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd51=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','../../config/logger','api','moment','bluebird'];(function(_0x367ce0,_0x377331){var _0x311d58=function(_0x599661){while(--_0x599661){_0x367ce0['push'](_0x367ce0['shift']());}};_0x311d58(++_0x377331);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x4aef12,_0x388b76){_0x4aef12=_0x4aef12-0x0;var _0x2e6c4e=_0xbd51[_0x4aef12];return _0x2e6c4e;};'use strict';var _=require(_0x1bd5('0x0'));var util=require('util');var logger=require(_0x1bd5('0x1'))(_0x1bd5('0x2'));var moment=require(_0x1bd5('0x3'));var BPromise=require(_0x1bd5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1bd5('0x5'));var integrations=require(_0x1bd5('0x6'));module[_0x1bd5('0x7')]=function(_0x59ddfb,_0x29abea){return _0x59ddfb[_0x1bd5('0x8')](_0x1bd5('0x9'),attributes,{'tableName':_0x1bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 83b04b9..6c46cdc 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 _0xb4b5=['../../config/environment','client','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','include','map','debug','ShowServicenowAccount','find','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0xabe65e,_0x455177){var _0x3da843=function(_0x2e8c31){while(--_0x2e8c31){_0xabe65e['push'](_0xabe65e['shift']());}};_0x3da843(++_0x455177);}(_0xb4b5,0x159));var _0x5b4b=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xb4b5[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0x5b4b('0x0'));var util=require(_0x5b4b('0x1'));var moment=require(_0x5b4b('0x2'));var BPromise=require(_0x5b4b('0x3'));var rs=require(_0x5b4b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b4b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b4b('0x6'))('rpc');var config=require(_0x5b4b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5b4b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eab36,_0x3d8fb6,_0x1f2b39){return new BPromise(function(_0x1b6309,_0x4052e5){return client['request'](_0x5eab36,_0x1f2b39)[_0x5b4b('0x9')](function(_0xa4ae69){logger['info'](_0x5b4b('0xa'),_0x3d8fb6,_0x5b4b('0xb'));logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3d8fb6,_0x5b4b('0xb'),JSON[_0x5b4b('0xc')](_0xa4ae69));if(_0xa4ae69['error']){if(_0xa4ae69[_0x5b4b('0xd')][_0x5b4b('0xe')]===0x1f4){logger[_0x5b4b('0xd')](_0x5b4b('0xa'),_0x3d8fb6,_0xa4ae69[_0x5b4b('0xd')][_0x5b4b('0xf')]);return _0x4052e5(_0xa4ae69[_0x5b4b('0xd')]['message']);}logger[_0x5b4b('0xd')](_0x5b4b('0xa'),_0x3d8fb6,_0xa4ae69[_0x5b4b('0xd')][_0x5b4b('0xf')]);return _0x1b6309(_0xa4ae69['error'][_0x5b4b('0xf')]);}else{logger[_0x5b4b('0x10')](_0x5b4b('0xa'),_0x3d8fb6,'request\x20sent');_0x1b6309(_0xa4ae69[_0x5b4b('0x11')][_0x5b4b('0xf')]);}})[_0x5b4b('0x12')](function(_0x1be4aa){logger[_0x5b4b('0xd')](_0x5b4b('0xa'),_0x3d8fb6,_0x1be4aa);_0x4052e5(_0x1be4aa);});});}exports[_0x5b4b('0x13')]=function(_0x15beb3){var _0x36655c=this;return new Promise(function(_0x734854,_0x2fa612){return db[_0x5b4b('0x14')][_0x5b4b('0x15')]({'raw':_0x15beb3['options']?_0x15beb3[_0x5b4b('0x16')][_0x5b4b('0x17')]===undefined?!![]:![]:!![],'where':_0x15beb3[_0x5b4b('0x16')]?_0x15beb3[_0x5b4b('0x16')][_0x5b4b('0x18')]||null:null,'attributes':_0x15beb3[_0x5b4b('0x16')]?_0x15beb3[_0x5b4b('0x16')][_0x5b4b('0x19')]||null:null,'limit':_0x15beb3[_0x5b4b('0x16')]?_0x15beb3['options']['limit']||null:null,'include':_0x15beb3[_0x5b4b('0x16')]?_0x15beb3[_0x5b4b('0x16')][_0x5b4b('0x1a')]?_[_0x5b4b('0x1b')](_0x15beb3[_0x5b4b('0x16')]['include'],function(_0x5374d5){return{'model':db[_0x5374d5['model']],'as':_0x5374d5['as'],'attributes':_0x5374d5[_0x5b4b('0x19')],'include':_0x5374d5[_0x5b4b('0x1a')]?_[_0x5b4b('0x1b')](_0x5374d5['include'],function(_0x4a2365){return{'model':db[_0x4a2365['model']],'as':_0x4a2365['as'],'attributes':_0x4a2365['attributes'],'include':_0x4a2365[_0x5b4b('0x1a')]?_['map'](_0x4a2365[_0x5b4b('0x1a')],function(_0x4f3b3c){return{'model':db[_0x4f3b3c['model']],'as':_0x4f3b3c['as'],'attributes':_0x4f3b3c[_0x5b4b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5b4b('0x9')](function(_0x57a351){logger[_0x5b4b('0x10')]('GetServicenowAccount',_0x15beb3);logger[_0x5b4b('0x1c')](_0x5b4b('0x13'),_0x15beb3,JSON[_0x5b4b('0xc')](_0x57a351));_0x734854(_0x57a351);})[_0x5b4b('0x12')](function(_0x43bc8b){logger[_0x5b4b('0xd')](_0x5b4b('0x13'),_0x43bc8b[_0x5b4b('0xf')],_0x15beb3);_0x2fa612(_0x36655c[_0x5b4b('0xd')](0x1f4,_0x43bc8b['message']));});});};exports[_0x5b4b('0x1d')]=function(_0x204586){var _0x421324=this;return new Promise(function(_0x1deadf,_0x810d71){return db[_0x5b4b('0x14')][_0x5b4b('0x1e')]({'raw':_0x204586['options']?_0x204586[_0x5b4b('0x16')][_0x5b4b('0x17')]===undefined?!![]:![]:!![],'where':_0x204586['options']?_0x204586[_0x5b4b('0x16')][_0x5b4b('0x18')]||null:null,'attributes':_0x204586[_0x5b4b('0x16')]?_0x204586['options']['attributes']||null:null,'include':_0x204586[_0x5b4b('0x16')]?_0x204586[_0x5b4b('0x16')]['include']?_[_0x5b4b('0x1b')](_0x204586['options'][_0x5b4b('0x1a')],function(_0x4bc614){return{'model':db[_0x4bc614[_0x5b4b('0x1f')]],'as':_0x4bc614['as'],'attributes':_0x4bc614['attributes'],'include':_0x4bc614['include']?_[_0x5b4b('0x1b')](_0x4bc614[_0x5b4b('0x1a')],function(_0x1c5d16){return{'model':db[_0x1c5d16[_0x5b4b('0x1f')]],'as':_0x1c5d16['as'],'attributes':_0x1c5d16[_0x5b4b('0x19')],'include':_0x1c5d16['include']?_['map'](_0x1c5d16[_0x5b4b('0x1a')],function(_0x55976c){return{'model':db[_0x55976c[_0x5b4b('0x1f')]],'as':_0x55976c['as'],'attributes':_0x55976c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b4b('0x9')](function(_0x213351){logger[_0x5b4b('0x10')](_0x5b4b('0x1d'),_0x204586);logger['debug'](_0x5b4b('0x1d'),_0x204586,JSON[_0x5b4b('0xc')](_0x213351));_0x1deadf(_0x213351);})[_0x5b4b('0x12')](function(_0xdc133b){logger['error'](_0x5b4b('0x1d'),_0xdc133b['message'],_0x204586);_0x810d71(_0x421324[_0x5b4b('0xd')](0x1f4,_0xdc133b[_0x5b4b('0xf')]));});});}; \ No newline at end of file +var _0xcf65=['options','where','attributes','include','map','model','then','GetServicenowAccount','stringify','ShowServicenowAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','error','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','findAll'];(function(_0x2e476a,_0x1c655d){var _0x188142=function(_0x4936ef){while(--_0x4936ef){_0x2e476a['push'](_0x2e476a['shift']());}};_0x188142(++_0x1c655d);}(_0xcf65,0xb1));var _0x5cf6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xcf65[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x5cf6('0x0'));var moment=require(_0x5cf6('0x1'));var BPromise=require(_0x5cf6('0x2'));var rs=require(_0x5cf6('0x3'));var fs=require('fs');var Redis=require(_0x5cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5cf6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x5cf6('0x6'));var jayson=require(_0x5cf6('0x7'));var client=jayson[_0x5cf6('0x8')][_0x5cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf946c,_0x1538d6,_0x3f561f){return new BPromise(function(_0x2bde9b,_0x59fc43){return client[_0x5cf6('0xa')](_0xbf946c,_0x3f561f)['then'](function(_0x42c136){logger[_0x5cf6('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x1538d6,_0x5cf6('0xc'));logger[_0x5cf6('0xd')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x1538d6,_0x5cf6('0xc'),JSON['stringify'](_0x42c136));if(_0x42c136[_0x5cf6('0xe')]){if(_0x42c136['error']['code']===0x1f4){logger[_0x5cf6('0xe')](_0x5cf6('0xf'),_0x1538d6,_0x42c136[_0x5cf6('0xe')][_0x5cf6('0x10')]);return _0x59fc43(_0x42c136[_0x5cf6('0xe')][_0x5cf6('0x10')]);}logger['error'](_0x5cf6('0xf'),_0x1538d6,_0x42c136[_0x5cf6('0xe')]['message']);return _0x2bde9b(_0x42c136[_0x5cf6('0xe')][_0x5cf6('0x10')]);}else{logger['info'](_0x5cf6('0xf'),_0x1538d6,'request\x20sent');_0x2bde9b(_0x42c136[_0x5cf6('0x11')][_0x5cf6('0x10')]);}})[_0x5cf6('0x12')](function(_0x33a98a){logger['error'](_0x5cf6('0xf'),_0x1538d6,_0x33a98a);_0x59fc43(_0x33a98a);});});}exports['GetServicenowAccount']=function(_0x38f88a){var _0x35bbc8=this;return new Promise(function(_0x546ca8,_0x4016dc){return db[_0x5cf6('0x13')][_0x5cf6('0x14')]({'raw':_0x38f88a['options']?_0x38f88a[_0x5cf6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x38f88a['options']?_0x38f88a[_0x5cf6('0x15')][_0x5cf6('0x16')]||null:null,'attributes':_0x38f88a[_0x5cf6('0x15')]?_0x38f88a[_0x5cf6('0x15')][_0x5cf6('0x17')]||null:null,'limit':_0x38f88a[_0x5cf6('0x15')]?_0x38f88a[_0x5cf6('0x15')]['limit']||null:null,'include':_0x38f88a[_0x5cf6('0x15')]?_0x38f88a[_0x5cf6('0x15')][_0x5cf6('0x18')]?_[_0x5cf6('0x19')](_0x38f88a[_0x5cf6('0x15')][_0x5cf6('0x18')],function(_0x5939fd){return{'model':db[_0x5939fd['model']],'as':_0x5939fd['as'],'attributes':_0x5939fd['attributes'],'include':_0x5939fd[_0x5cf6('0x18')]?_[_0x5cf6('0x19')](_0x5939fd[_0x5cf6('0x18')],function(_0x98656b){return{'model':db[_0x98656b[_0x5cf6('0x1a')]],'as':_0x98656b['as'],'attributes':_0x98656b[_0x5cf6('0x17')],'include':_0x98656b[_0x5cf6('0x18')]?_[_0x5cf6('0x19')](_0x98656b[_0x5cf6('0x18')],function(_0x13f3f9){return{'model':db[_0x13f3f9['model']],'as':_0x13f3f9['as'],'attributes':_0x13f3f9[_0x5cf6('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5cf6('0x1b')](function(_0xc159e4){logger[_0x5cf6('0xb')]('GetServicenowAccount',_0x38f88a);logger[_0x5cf6('0xd')](_0x5cf6('0x1c'),_0x38f88a,JSON[_0x5cf6('0x1d')](_0xc159e4));_0x546ca8(_0xc159e4);})[_0x5cf6('0x12')](function(_0x5b6cb0){logger[_0x5cf6('0xe')]('GetServicenowAccount',_0x5b6cb0[_0x5cf6('0x10')],_0x38f88a);_0x4016dc(_0x35bbc8[_0x5cf6('0xe')](0x1f4,_0x5b6cb0[_0x5cf6('0x10')]));});});};exports[_0x5cf6('0x1e')]=function(_0x1618a4){var _0x3f9b37=this;return new Promise(function(_0xf3d798,_0x5d09ee){return db[_0x5cf6('0x13')][_0x5cf6('0x1f')]({'raw':_0x1618a4[_0x5cf6('0x15')]?_0x1618a4['options'][_0x5cf6('0x20')]===undefined?!![]:![]:!![],'where':_0x1618a4['options']?_0x1618a4['options'][_0x5cf6('0x16')]||null:null,'attributes':_0x1618a4['options']?_0x1618a4[_0x5cf6('0x15')][_0x5cf6('0x17')]||null:null,'include':_0x1618a4[_0x5cf6('0x15')]?_0x1618a4[_0x5cf6('0x15')]['include']?_[_0x5cf6('0x19')](_0x1618a4[_0x5cf6('0x15')][_0x5cf6('0x18')],function(_0x4bbb86){return{'model':db[_0x4bbb86[_0x5cf6('0x1a')]],'as':_0x4bbb86['as'],'attributes':_0x4bbb86['attributes'],'include':_0x4bbb86['include']?_['map'](_0x4bbb86['include'],function(_0x194b51){return{'model':db[_0x194b51['model']],'as':_0x194b51['as'],'attributes':_0x194b51[_0x5cf6('0x17')],'include':_0x194b51[_0x5cf6('0x18')]?_[_0x5cf6('0x19')](_0x194b51['include'],function(_0x237e12){return{'model':db[_0x237e12[_0x5cf6('0x1a')]],'as':_0x237e12['as'],'attributes':_0x237e12[_0x5cf6('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43cd88){logger[_0x5cf6('0xb')](_0x5cf6('0x1e'),_0x1618a4);logger[_0x5cf6('0xd')]('ShowServicenowAccount',_0x1618a4,JSON[_0x5cf6('0x1d')](_0x43cd88));_0xf3d798(_0x43cd88);})['catch'](function(_0x42258b){logger[_0x5cf6('0xe')](_0x5cf6('0x1e'),_0x42258b['message'],_0x1618a4);_0x5d09ee(_0x3f9b37[_0x5cf6('0xe')](0x1f4,_0x42258b[_0x5cf6('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d39c860..bdd9d0f 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 _0x7808=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','/:id/fields','getFields'];(function(_0x8b5d5e,_0x301f65){var _0x5177b0=function(_0x3283e1){while(--_0x3283e1){_0x8b5d5e['push'](_0x8b5d5e['shift']());}};_0x5177b0(++_0x301f65);}(_0x7808,0x1c5));var _0x8780=function(_0x413493,_0x42274c){_0x413493=_0x413493-0x0;var _0xbcd1ad=_0x7808[_0x413493];return _0xbcd1ad;};'use strict';var multer=require(_0x8780('0x0'));var util=require(_0x8780('0x1'));var path=require(_0x8780('0x2'));var timeout=require('connect-timeout');var express=require(_0x8780('0x3'));var router=express[_0x8780('0x4')]();var fs_extra=require(_0x8780('0x5'));var auth=require(_0x8780('0x6'));var interaction=require(_0x8780('0x7'));var config=require(_0x8780('0x8'));var controller=require(_0x8780('0x9'));router[_0x8780('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8780('0xa')](_0x8780('0xb'),auth[_0x8780('0xc')](),controller['show']);router[_0x8780('0xa')](_0x8780('0xd'),auth[_0x8780('0xc')](),controller[_0x8780('0xe')]);router['get'](_0x8780('0xf'),auth['isAuthenticated'](),controller[_0x8780('0x10')]);router[_0x8780('0xa')](_0x8780('0x11'),auth[_0x8780('0xc')](),controller[_0x8780('0x12')]);router[_0x8780('0x13')]('/',auth[_0x8780('0xc')](),controller[_0x8780('0x14')]);router[_0x8780('0x15')]('/:id',auth[_0x8780('0xc')](),controller[_0x8780('0x16')]);router[_0x8780('0x17')](_0x8780('0xb'),auth[_0x8780('0xc')](),controller[_0x8780('0x18')]);module[_0x8780('0x19')]=router; \ No newline at end of file +var _0x8d21=['/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/subjects'];(function(_0x2ce80d,_0x3d8096){var _0x55f60b=function(_0x44bf6a){while(--_0x44bf6a){_0x2ce80d['push'](_0x2ce80d['shift']());}};_0x55f60b(++_0x3d8096);}(_0x8d21,0x1bf));var _0x18d2=function(_0x3465b0,_0x2a8fcc){_0x3465b0=_0x3465b0-0x0;var _0x59cc3b=_0x8d21[_0x3465b0];return _0x59cc3b;};'use strict';var multer=require(_0x18d2('0x0'));var util=require('util');var path=require(_0x18d2('0x1'));var timeout=require(_0x18d2('0x2'));var express=require(_0x18d2('0x3'));var router=express[_0x18d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18d2('0x5'));var interaction=require(_0x18d2('0x6'));var config=require(_0x18d2('0x7'));var controller=require(_0x18d2('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x18d2('0x9')]);router[_0x18d2('0xa')](_0x18d2('0xb'),auth[_0x18d2('0xc')](),controller[_0x18d2('0xd')]);router[_0x18d2('0xa')]('/:id/fields',auth[_0x18d2('0xc')](),controller['getFields']);router[_0x18d2('0xa')](_0x18d2('0xe'),auth[_0x18d2('0xc')](),controller['getSubjects']);router[_0x18d2('0xa')](_0x18d2('0xf'),auth[_0x18d2('0xc')](),controller[_0x18d2('0x10')]);router[_0x18d2('0x11')]('/',auth[_0x18d2('0xc')](),controller[_0x18d2('0x12')]);router['put'](_0x18d2('0xb'),auth['isAuthenticated'](),controller[_0x18d2('0x13')]);router[_0x18d2('0x14')](_0x18d2('0xb'),auth[_0x18d2('0xc')](),controller['destroy']);module[_0x18d2('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index bf29f90..190c34b 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 _0x207f=['sequelize'];(function(_0x417a3b,_0x430225){var _0x2dfc72=function(_0xacae0c){while(--_0xacae0c){_0x417a3b['push'](_0x417a3b['shift']());}};_0x2dfc72(++_0x430225);}(_0x207f,0xb7));var _0xf207=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x207f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xf207('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1b56=['STRING'];(function(_0x1050c1,_0x298610){var _0x1438c7=function(_0x5c0e39){while(--_0x5c0e39){_0x1050c1['push'](_0x1050c1['shift']());}};_0x1438c7(++_0x298610);}(_0x1b56,0x17b));var _0x61b5=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x1b56[_0x303c30];return _0x43161b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x61b5('0x0')]},'description':{'type':Sequelize[_0x61b5('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 7f977c5..cdb94d1 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 _0x85d5=['crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','error','name','index','map','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','ServicenowConfiguration','then','includeAll','include','rows','params','rawAttributes','find','catch','create','body','findOne','ServicenowField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x85d5,0x129));var _0x585d=function(_0x1a3bd6,_0x3f4661){_0x1a3bd6=_0x1a3bd6-0x0;var _0x181e73=_0x85d5[_0x1a3bd6];return _0x181e73;};'use strict';var emlformat=require(_0x585d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x585d('0x1'));var jsonpatch=require(_0x585d('0x2'));var rp=require(_0x585d('0x3'));var moment=require(_0x585d('0x4'));var BPromise=require(_0x585d('0x5'));var Mustache=require(_0x585d('0x6'));var util=require('util');var path=require(_0x585d('0x7'));var sox=require(_0x585d('0x8'));var csv=require(_0x585d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x585d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x585d('0xb'));var jsforce=require(_0x585d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x585d('0xd'));var Redis=require(_0x585d('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x585d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x585d('0x10'))(_0x585d('0x11'));var utils=require(_0x585d('0x12'));var config=require(_0x585d('0x13'));var licenseUtil=require(_0x585d('0x14'));var db=require(_0x585d('0x15'))['db'];function respondWithStatusCode(_0x4745bf,_0x287ce2){_0x287ce2=_0x287ce2||0xcc;return function(_0x844e55){if(_0x844e55){return _0x4745bf[_0x585d('0x16')](_0x287ce2);}return _0x4745bf[_0x585d('0x17')](_0x287ce2)[_0x585d('0x18')]();};}function respondWithResult(_0x5d0cbb,_0x1af773){_0x1af773=_0x1af773||0xc8;return function(_0x1b2ba5){if(_0x1b2ba5){return _0x5d0cbb[_0x585d('0x17')](_0x1af773)['json'](_0x1b2ba5);}};}function respondWithFilteredResult(_0x17e8a4,_0x54657d){return function(_0x3f1751){if(_0x3f1751){var _0x32f903=typeof _0x54657d['offset']===_0x585d('0x19')&&typeof _0x54657d[_0x585d('0x1a')]===_0x585d('0x19');var _0x1175f7=_0x3f1751[_0x585d('0x1b')];var _0x19826c=_0x32f903?0x0:_0x54657d['offset'];var _0x27df36=_0x32f903?_0x3f1751[_0x585d('0x1b')]:_0x54657d[_0x585d('0x1c')]+_0x54657d[_0x585d('0x1a')];var _0x2dae7e;if(_0x27df36>=_0x1175f7){_0x27df36=_0x1175f7;_0x2dae7e=0xc8;}else{_0x2dae7e=0xce;}_0x17e8a4[_0x585d('0x17')](_0x2dae7e);return _0x17e8a4[_0x585d('0x1d')](_0x585d('0x1e'),_0x19826c+'-'+_0x27df36+'/'+_0x1175f7)['json'](_0x3f1751);}return null;};}function patchUpdates(_0x225c0f){return function(_0x5b1645){try{jsonpatch[_0x585d('0x1f')](_0x5b1645,_0x225c0f,!![]);}catch(_0x28239d){return BPromise[_0x585d('0x20')](_0x28239d);}return _0x5b1645[_0x585d('0x21')]();};}function saveUpdates(_0x4969e1,_0x47777c){return function(_0x213642){if(_0x213642){return _0x213642[_0x585d('0x22')](_0x4969e1)['then'](function(_0x3cb633){return _0x3cb633;});}return null;};}function removeEntity(_0xf5c88b,_0x2223a9){return function(_0x441fd5){if(_0x441fd5){return _0x441fd5[_0x585d('0x23')]()['then'](function(){_0xf5c88b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x349c60,_0x50b426){return function(_0xde8e49){if(!_0xde8e49){_0x349c60[_0x585d('0x16')](0x194);}return _0xde8e49;};}function handleError(_0xe927a1,_0x3c497e){_0x3c497e=_0x3c497e||0x1f4;return function(_0x2c1304){logger[_0x585d('0x24')](_0x2c1304['stack']);if(_0x2c1304[_0x585d('0x25')]){delete _0x2c1304[_0x585d('0x25')];}_0xe927a1[_0x585d('0x17')](_0x3c497e)['send'](_0x2c1304);};}exports[_0x585d('0x26')]=function(_0x5ef8b4,_0x2a5523){var _0x4557f0={},_0x55a0d5={},_0x1f5c90={'count':0x0,'rows':[]};var _0xf9b546=_[_0x585d('0x27')](db['ServicenowConfiguration']['rawAttributes'],function(_0x3387db){return{'name':_0x3387db[_0x585d('0x28')],'type':_0x3387db['type'][_0x585d('0x29')]};});_0x55a0d5[_0x585d('0x2a')]=_[_0x585d('0x27')](_0xf9b546,_0x585d('0x25'));_0x55a0d5['query']=_[_0x585d('0x2b')](_0x5ef8b4[_0x585d('0x2c')]);_0x55a0d5[_0x585d('0x2d')]=_[_0x585d('0x2e')](_0x55a0d5[_0x585d('0x2a')],_0x55a0d5[_0x585d('0x2c')]);_0x4557f0['attributes']=_['intersection'](_0x55a0d5['model'],qs[_0x585d('0x2f')](_0x5ef8b4[_0x585d('0x2c')][_0x585d('0x2f')]));_0x4557f0[_0x585d('0x30')]=_0x4557f0[_0x585d('0x30')][_0x585d('0x31')]?_0x4557f0[_0x585d('0x30')]:_0x55a0d5[_0x585d('0x2a')];if(!_0x5ef8b4[_0x585d('0x2c')][_0x585d('0x32')](_0x585d('0x33'))){_0x4557f0[_0x585d('0x1a')]=qs[_0x585d('0x1a')](_0x5ef8b4[_0x585d('0x2c')]['limit']);_0x4557f0[_0x585d('0x1c')]=qs[_0x585d('0x1c')](_0x5ef8b4[_0x585d('0x2c')]['offset']);}_0x4557f0[_0x585d('0x34')]=qs[_0x585d('0x35')](_0x5ef8b4[_0x585d('0x2c')]['sort']);_0x4557f0[_0x585d('0x36')]=qs['filters'](_[_0x585d('0x37')](_0x5ef8b4[_0x585d('0x2c')],_0x55a0d5['filters']),_0xf9b546);if(_0x5ef8b4[_0x585d('0x2c')]['filter']){_0x4557f0[_0x585d('0x36')]=_[_0x585d('0x38')](_0x4557f0[_0x585d('0x36')],{'$or':_['map'](_0xf9b546,function(_0x2ac47b){if(_0x2ac47b[_0x585d('0x39')]!==_0x585d('0x3a')){var _0x53060a={};_0x53060a[_0x2ac47b[_0x585d('0x25')]]={'$like':'%'+_0x5ef8b4['query'][_0x585d('0x3b')]+'%'};return _0x53060a;}})});}_0x4557f0=_['merge']({},_0x4557f0,_0x5ef8b4[_0x585d('0x3c')]);var _0x428442={'where':_0x4557f0[_0x585d('0x36')]};return db[_0x585d('0x3d')][_0x585d('0x1b')](_0x428442)[_0x585d('0x3e')](function(_0x3bc167){_0x1f5c90[_0x585d('0x1b')]=_0x3bc167;if(_0x5ef8b4[_0x585d('0x2c')][_0x585d('0x3f')]){_0x4557f0[_0x585d('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x4557f0);})[_0x585d('0x3e')](function(_0x38dc57){_0x1f5c90[_0x585d('0x41')]=_0x38dc57;return _0x1f5c90;})['then'](respondWithFilteredResult(_0x2a5523,_0x4557f0))['catch'](handleError(_0x2a5523,null));};exports['show']=function(_0xcace58,_0x553462){var _0x1d99e5={'raw':![],'where':{'id':_0xcace58[_0x585d('0x42')]['id']}},_0x4b632e={};_0x4b632e[_0x585d('0x2a')]=_[_0x585d('0x2b')](db[_0x585d('0x3d')][_0x585d('0x43')]);_0x4b632e[_0x585d('0x2c')]=_[_0x585d('0x2b')](_0xcace58['query']);_0x4b632e[_0x585d('0x2d')]=_['intersection'](_0x4b632e[_0x585d('0x2a')],_0x4b632e[_0x585d('0x2c')]);_0x1d99e5[_0x585d('0x30')]=_[_0x585d('0x2e')](_0x4b632e[_0x585d('0x2a')],qs[_0x585d('0x2f')](_0xcace58['query'][_0x585d('0x2f')]));_0x1d99e5['attributes']=_0x1d99e5[_0x585d('0x30')][_0x585d('0x31')]?_0x1d99e5[_0x585d('0x30')]:_0x4b632e['model'];if(_0xcace58[_0x585d('0x2c')][_0x585d('0x3f')]){_0x1d99e5[_0x585d('0x40')]=[{'all':!![]}];}_0x1d99e5=_['merge']({},_0x1d99e5,_0xcace58['options']);return db[_0x585d('0x3d')][_0x585d('0x44')](_0x1d99e5)[_0x585d('0x3e')](handleEntityNotFound(_0x553462,null))[_0x585d('0x3e')](respondWithResult(_0x553462,null))[_0x585d('0x45')](handleError(_0x553462,null));};exports['create']=function(_0x330cc8,_0x21dc19){return db['ServicenowConfiguration'][_0x585d('0x46')](_0x330cc8[_0x585d('0x47')],{})[_0x585d('0x3e')](respondWithResult(_0x21dc19,0xc9))[_0x585d('0x45')](handleError(_0x21dc19,null));};exports['update']=function(_0x565dd7,_0x164c24){if(_0x565dd7['body']['id']){delete _0x565dd7[_0x585d('0x47')]['id'];}return db[_0x585d('0x3d')][_0x585d('0x44')]({'where':{'id':_0x565dd7[_0x585d('0x42')]['id']}})[_0x585d('0x3e')](handleEntityNotFound(_0x164c24,null))['then'](saveUpdates(_0x565dd7[_0x585d('0x47')],null))[_0x585d('0x3e')](respondWithResult(_0x164c24,null))[_0x585d('0x45')](handleError(_0x164c24,null));};exports[_0x585d('0x23')]=function(_0x2faeb4,_0x559761){return db[_0x585d('0x3d')][_0x585d('0x44')]({'where':{'id':_0x2faeb4[_0x585d('0x42')]['id']}})[_0x585d('0x3e')](handleEntityNotFound(_0x559761,null))[_0x585d('0x3e')](removeEntity(_0x559761,null))[_0x585d('0x45')](handleError(_0x559761,null));};exports['getFields']=function(_0x2c1b6a,_0x3bc011,_0x1e1fb6){var _0x4b484f={};var _0x42b0f1={};var _0x537218;var _0x175578;return db[_0x585d('0x3d')][_0x585d('0x48')]({'where':{'id':_0x2c1b6a[_0x585d('0x42')]['id']}})['then'](handleEntityNotFound(_0x3bc011,null))[_0x585d('0x3e')](function(_0x3f6290){if(_0x3f6290){_0x537218=_0x3f6290;_0x42b0f1[_0x585d('0x2a')]=_['keys'](db[_0x585d('0x49')][_0x585d('0x43')]);_0x42b0f1[_0x585d('0x2c')]=_[_0x585d('0x2b')](_0x2c1b6a[_0x585d('0x2c')]);_0x42b0f1[_0x585d('0x2d')]=_[_0x585d('0x2e')](_0x42b0f1[_0x585d('0x2a')],_0x42b0f1[_0x585d('0x2c')]);_0x4b484f['attributes']=_[_0x585d('0x2e')](_0x42b0f1[_0x585d('0x2a')],qs[_0x585d('0x2f')](_0x2c1b6a[_0x585d('0x2c')][_0x585d('0x2f')]));_0x4b484f[_0x585d('0x30')]=_0x4b484f[_0x585d('0x30')][_0x585d('0x31')]?_0x4b484f[_0x585d('0x30')]:_0x42b0f1[_0x585d('0x2a')];_0x4b484f[_0x585d('0x34')]=qs[_0x585d('0x35')](_0x2c1b6a[_0x585d('0x2c')]['sort']);_0x4b484f[_0x585d('0x36')]=qs[_0x585d('0x2d')](_[_0x585d('0x37')](_0x2c1b6a[_0x585d('0x2c')],_0x42b0f1[_0x585d('0x2d')]));if(_0x2c1b6a[_0x585d('0x2c')][_0x585d('0x3b')]){_0x4b484f['where']=_[_0x585d('0x38')](_0x4b484f[_0x585d('0x36')],{'$or':_['map'](_0x4b484f['attributes'],function(_0x2748e3){var _0x59628a={};_0x59628a[_0x2748e3]={'$like':'%'+_0x2c1b6a['query'][_0x585d('0x3b')]+'%'};return _0x59628a;})});}_0x4b484f=_['merge']({},_0x4b484f,_0x2c1b6a['options']);return _0x537218['getFields'](_0x4b484f);}})[_0x585d('0x3e')](function(_0x1c23f5){if(_0x1c23f5){_0x175578=_0x1c23f5[_0x585d('0x31')];if(!_0x2c1b6a[_0x585d('0x2c')]['hasOwnProperty']('nolimit')){_0x4b484f[_0x585d('0x1a')]=qs[_0x585d('0x1a')](_0x2c1b6a[_0x585d('0x2c')][_0x585d('0x1a')]);_0x4b484f[_0x585d('0x1c')]=qs[_0x585d('0x1c')](_0x2c1b6a['query'][_0x585d('0x1c')]);}return _0x537218[_0x585d('0x4a')](_0x4b484f);}})[_0x585d('0x3e')](function(_0x11b0de){if(_0x11b0de){return _0x11b0de?{'count':_0x175578,'rows':_0x11b0de}:null;}})[_0x585d('0x3e')](respondWithResult(_0x3bc011,null))[_0x585d('0x45')](handleError(_0x3bc011,null));};exports['getSubjects']=function(_0x3476df,_0x47239e,_0x4c1bce){var _0x163dd0={};var _0x3d78f6={};var _0x22f808;var _0x182324;return db[_0x585d('0x3d')][_0x585d('0x48')]({'where':{'id':_0x3476df[_0x585d('0x42')]['id']}})[_0x585d('0x3e')](handleEntityNotFound(_0x47239e,null))[_0x585d('0x3e')](function(_0x47c961){if(_0x47c961){_0x22f808=_0x47c961;_0x3d78f6[_0x585d('0x2a')]=_[_0x585d('0x2b')](db['ServicenowField'][_0x585d('0x43')]);_0x3d78f6[_0x585d('0x2c')]=_[_0x585d('0x2b')](_0x3476df[_0x585d('0x2c')]);_0x3d78f6['filters']=_['intersection'](_0x3d78f6[_0x585d('0x2a')],_0x3d78f6['query']);_0x163dd0['attributes']=_[_0x585d('0x2e')](_0x3d78f6[_0x585d('0x2a')],qs[_0x585d('0x2f')](_0x3476df[_0x585d('0x2c')][_0x585d('0x2f')]));_0x163dd0[_0x585d('0x30')]=_0x163dd0[_0x585d('0x30')][_0x585d('0x31')]?_0x163dd0[_0x585d('0x30')]:_0x3d78f6[_0x585d('0x2a')];_0x163dd0[_0x585d('0x34')]=qs['sort'](_0x3476df[_0x585d('0x2c')]['sort']);_0x163dd0['where']=qs['filters'](_[_0x585d('0x37')](_0x3476df[_0x585d('0x2c')],_0x3d78f6[_0x585d('0x2d')]));if(_0x3476df[_0x585d('0x2c')][_0x585d('0x3b')]){_0x163dd0[_0x585d('0x36')]=_[_0x585d('0x38')](_0x163dd0[_0x585d('0x36')],{'$or':_['map'](_0x163dd0[_0x585d('0x30')],function(_0x5337c3){var _0x26f955={};_0x26f955[_0x5337c3]={'$like':'%'+_0x3476df['query']['filter']+'%'};return _0x26f955;})});}_0x163dd0=_[_0x585d('0x38')]({},_0x163dd0,_0x3476df[_0x585d('0x3c')]);return _0x22f808[_0x585d('0x4b')](_0x163dd0);}})[_0x585d('0x3e')](function(_0x154cf6){if(_0x154cf6){_0x182324=_0x154cf6[_0x585d('0x31')];if(!_0x3476df[_0x585d('0x2c')][_0x585d('0x32')]('nolimit')){_0x163dd0[_0x585d('0x1a')]=qs['limit'](_0x3476df['query']['limit']);_0x163dd0['offset']=qs[_0x585d('0x1c')](_0x3476df[_0x585d('0x2c')][_0x585d('0x1c')]);}return _0x22f808[_0x585d('0x4b')](_0x163dd0);}})[_0x585d('0x3e')](function(_0x47078e){if(_0x47078e){return _0x47078e?{'count':_0x182324,'rows':_0x47078e}:null;}})[_0x585d('0x3e')](respondWithResult(_0x47239e,null))[_0x585d('0x45')](handleError(_0x47239e,null));};exports[_0x585d('0x4c')]=function(_0xefd080,_0x5f5bcd,_0x3eda6f){var _0x50c0f4={};var _0x29508c={};var _0xb35c6f;var _0x304c53;return db[_0x585d('0x3d')][_0x585d('0x48')]({'where':{'id':_0xefd080[_0x585d('0x42')]['id']}})[_0x585d('0x3e')](handleEntityNotFound(_0x5f5bcd,null))[_0x585d('0x3e')](function(_0x7ee313){if(_0x7ee313){_0xb35c6f=_0x7ee313;_0x29508c[_0x585d('0x2a')]=_[_0x585d('0x2b')](db[_0x585d('0x49')][_0x585d('0x43')]);_0x29508c[_0x585d('0x2c')]=_[_0x585d('0x2b')](_0xefd080[_0x585d('0x2c')]);_0x29508c[_0x585d('0x2d')]=_[_0x585d('0x2e')](_0x29508c[_0x585d('0x2a')],_0x29508c[_0x585d('0x2c')]);_0x50c0f4[_0x585d('0x30')]=_['intersection'](_0x29508c[_0x585d('0x2a')],qs[_0x585d('0x2f')](_0xefd080[_0x585d('0x2c')][_0x585d('0x2f')]));_0x50c0f4[_0x585d('0x30')]=_0x50c0f4['attributes'][_0x585d('0x31')]?_0x50c0f4[_0x585d('0x30')]:_0x29508c[_0x585d('0x2a')];_0x50c0f4[_0x585d('0x34')]=qs[_0x585d('0x35')](_0xefd080['query'][_0x585d('0x35')]);_0x50c0f4['where']=qs[_0x585d('0x2d')](_[_0x585d('0x37')](_0xefd080[_0x585d('0x2c')],_0x29508c[_0x585d('0x2d')]));if(_0xefd080[_0x585d('0x2c')][_0x585d('0x3b')]){_0x50c0f4[_0x585d('0x36')]=_[_0x585d('0x38')](_0x50c0f4[_0x585d('0x36')],{'$or':_[_0x585d('0x27')](_0x50c0f4[_0x585d('0x30')],function(_0x55b64d){var _0x15964d={};_0x15964d[_0x55b64d]={'$like':'%'+_0xefd080[_0x585d('0x2c')][_0x585d('0x3b')]+'%'};return _0x15964d;})});}_0x50c0f4=_['merge']({},_0x50c0f4,_0xefd080[_0x585d('0x3c')]);return _0xb35c6f[_0x585d('0x4c')](_0x50c0f4);}})[_0x585d('0x3e')](function(_0x573d99){if(_0x573d99){_0x304c53=_0x573d99['length'];if(!_0xefd080['query'][_0x585d('0x32')](_0x585d('0x33'))){_0x50c0f4['limit']=qs[_0x585d('0x1a')](_0xefd080['query'][_0x585d('0x1a')]);_0x50c0f4[_0x585d('0x1c')]=qs[_0x585d('0x1c')](_0xefd080[_0x585d('0x2c')]['offset']);}return _0xb35c6f[_0x585d('0x4c')](_0x50c0f4);}})[_0x585d('0x3e')](function(_0x53a0f9){if(_0x53a0f9){return _0x53a0f9?{'count':_0x304c53,'rows':_0x53a0f9}:null;}})['then'](respondWithResult(_0x5f5bcd,null))[_0x585d('0x45')](handleError(_0x5f5bcd,null));}; \ No newline at end of file +var _0x13ae=['type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','ServicenowConfiguration','includeAll','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','status','send','index','map','rawAttributes','fieldName'];(function(_0x266dbf,_0x40360a){var _0x724564=function(_0x373fe7){while(--_0x373fe7){_0x266dbf['push'](_0x266dbf['shift']());}};_0x724564(++_0x40360a);}(_0x13ae,0x163));var _0xe13a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x13ae[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require(_0xe13a('0x0'));var rimraf=require(_0xe13a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe13a('0x2'));var rp=require(_0xe13a('0x3'));var moment=require('moment');var BPromise=require(_0xe13a('0x4'));var Mustache=require(_0xe13a('0x5'));var util=require(_0xe13a('0x6'));var path=require(_0xe13a('0x7'));var sox=require('sox');var csv=require(_0xe13a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe13a('0x9'));var _=require(_0xe13a('0xa'));var squel=require('squel');var crypto=require(_0xe13a('0xb'));var jsforce=require(_0xe13a('0xc'));var deskjs=require(_0xe13a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe13a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe13a('0xf'));var hardwareService=require(_0xe13a('0x10'));var logger=require(_0xe13a('0x11'))(_0xe13a('0x12'));var utils=require(_0xe13a('0x13'));var config=require(_0xe13a('0x14'));var licenseUtil=require(_0xe13a('0x15'));var db=require(_0xe13a('0x16'))['db'];function respondWithStatusCode(_0x161d4b,_0x467848){_0x467848=_0x467848||0xcc;return function(_0x2ba6b2){if(_0x2ba6b2){return _0x161d4b[_0xe13a('0x17')](_0x467848);}return _0x161d4b['status'](_0x467848)['end']();};}function respondWithResult(_0x1faf47,_0x267ac2){_0x267ac2=_0x267ac2||0xc8;return function(_0x4ec7db){if(_0x4ec7db){return _0x1faf47['status'](_0x267ac2)[_0xe13a('0x18')](_0x4ec7db);}};}function respondWithFilteredResult(_0x5ed836,_0x198aa6){return function(_0x17209d){if(_0x17209d){var _0x63276c=typeof _0x198aa6[_0xe13a('0x19')]===_0xe13a('0x1a')&&typeof _0x198aa6[_0xe13a('0x1b')]===_0xe13a('0x1a');var _0x48940f=_0x17209d[_0xe13a('0x1c')];var _0x36c6af=_0x63276c?0x0:_0x198aa6[_0xe13a('0x19')];var _0x38970f=_0x63276c?_0x17209d['count']:_0x198aa6['offset']+_0x198aa6[_0xe13a('0x1b')];var _0x2bee7a;if(_0x38970f>=_0x48940f){_0x38970f=_0x48940f;_0x2bee7a=0xc8;}else{_0x2bee7a=0xce;}_0x5ed836['status'](_0x2bee7a);return _0x5ed836[_0xe13a('0x1d')](_0xe13a('0x1e'),_0x36c6af+'-'+_0x38970f+'/'+_0x48940f)[_0xe13a('0x18')](_0x17209d);}return null;};}function patchUpdates(_0x198489){return function(_0x161834){try{jsonpatch[_0xe13a('0x1f')](_0x161834,_0x198489,!![]);}catch(_0x1b846e){return BPromise[_0xe13a('0x20')](_0x1b846e);}return _0x161834[_0xe13a('0x21')]();};}function saveUpdates(_0x1f3d87,_0x5afa79){return function(_0x1a88a1){if(_0x1a88a1){return _0x1a88a1[_0xe13a('0x22')](_0x1f3d87)[_0xe13a('0x23')](function(_0xdbd497){return _0xdbd497;});}return null;};}function removeEntity(_0x233d27,_0x5e2b24){return function(_0x340dc0){if(_0x340dc0){return _0x340dc0[_0xe13a('0x24')]()['then'](function(){_0x233d27['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54d5b2,_0x1b51e8){return function(_0xd75f57){if(!_0xd75f57){_0x54d5b2[_0xe13a('0x17')](0x194);}return _0xd75f57;};}function handleError(_0x417b10,_0x5e528b){_0x5e528b=_0x5e528b||0x1f4;return function(_0x5daa2b){logger['error'](_0x5daa2b[_0xe13a('0x25')]);if(_0x5daa2b[_0xe13a('0x26')]){delete _0x5daa2b[_0xe13a('0x26')];}_0x417b10[_0xe13a('0x27')](_0x5e528b)[_0xe13a('0x28')](_0x5daa2b);};}exports[_0xe13a('0x29')]=function(_0x2c3e35,_0x542fbe){var _0x59f183={},_0x3b885f={},_0x3c9faa={'count':0x0,'rows':[]};var _0x10938c=_[_0xe13a('0x2a')](db['ServicenowConfiguration'][_0xe13a('0x2b')],function(_0x3389ae){return{'name':_0x3389ae[_0xe13a('0x2c')],'type':_0x3389ae[_0xe13a('0x2d')][_0xe13a('0x2e')]};});_0x3b885f[_0xe13a('0x2f')]=_['map'](_0x10938c,_0xe13a('0x26'));_0x3b885f[_0xe13a('0x30')]=_[_0xe13a('0x31')](_0x2c3e35[_0xe13a('0x30')]);_0x3b885f[_0xe13a('0x32')]=_[_0xe13a('0x33')](_0x3b885f['model'],_0x3b885f['query']);_0x59f183['attributes']=_[_0xe13a('0x33')](_0x3b885f[_0xe13a('0x2f')],qs[_0xe13a('0x34')](_0x2c3e35[_0xe13a('0x30')]['fields']));_0x59f183[_0xe13a('0x35')]=_0x59f183[_0xe13a('0x35')][_0xe13a('0x36')]?_0x59f183[_0xe13a('0x35')]:_0x3b885f[_0xe13a('0x2f')];if(!_0x2c3e35[_0xe13a('0x30')][_0xe13a('0x37')](_0xe13a('0x38'))){_0x59f183[_0xe13a('0x1b')]=qs[_0xe13a('0x1b')](_0x2c3e35[_0xe13a('0x30')]['limit']);_0x59f183[_0xe13a('0x19')]=qs[_0xe13a('0x19')](_0x2c3e35[_0xe13a('0x30')]['offset']);}_0x59f183[_0xe13a('0x39')]=qs[_0xe13a('0x3a')](_0x2c3e35[_0xe13a('0x30')][_0xe13a('0x3a')]);_0x59f183[_0xe13a('0x3b')]=qs['filters'](_[_0xe13a('0x3c')](_0x2c3e35[_0xe13a('0x30')],_0x3b885f['filters']),_0x10938c);if(_0x2c3e35['query'][_0xe13a('0x3d')]){_0x59f183[_0xe13a('0x3b')]=_['merge'](_0x59f183['where'],{'$or':_[_0xe13a('0x2a')](_0x10938c,function(_0x5b9306){if(_0x5b9306['type']!==_0xe13a('0x3e')){var _0x1f7475={};_0x1f7475[_0x5b9306[_0xe13a('0x26')]]={'$like':'%'+_0x2c3e35['query'][_0xe13a('0x3d')]+'%'};return _0x1f7475;}})});}_0x59f183=_[_0xe13a('0x3f')]({},_0x59f183,_0x2c3e35[_0xe13a('0x40')]);var _0x5de110={'where':_0x59f183[_0xe13a('0x3b')]};return db['ServicenowConfiguration'][_0xe13a('0x1c')](_0x5de110)[_0xe13a('0x23')](function(_0x47e85c){_0x3c9faa[_0xe13a('0x1c')]=_0x47e85c;if(_0x2c3e35[_0xe13a('0x30')]['includeAll']){_0x59f183['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xe13a('0x41')](_0x59f183);})[_0xe13a('0x23')](function(_0x5af9a7){_0x3c9faa[_0xe13a('0x42')]=_0x5af9a7;return _0x3c9faa;})[_0xe13a('0x23')](respondWithFilteredResult(_0x542fbe,_0x59f183))[_0xe13a('0x43')](handleError(_0x542fbe,null));};exports['show']=function(_0x191b5d,_0x1a24c0){var _0x3ebec2={'raw':![],'where':{'id':_0x191b5d[_0xe13a('0x44')]['id']}},_0x26090e={};_0x26090e[_0xe13a('0x2f')]=_[_0xe13a('0x31')](db[_0xe13a('0x45')][_0xe13a('0x2b')]);_0x26090e[_0xe13a('0x30')]=_[_0xe13a('0x31')](_0x191b5d[_0xe13a('0x30')]);_0x26090e[_0xe13a('0x32')]=_[_0xe13a('0x33')](_0x26090e[_0xe13a('0x2f')],_0x26090e[_0xe13a('0x30')]);_0x3ebec2['attributes']=_['intersection'](_0x26090e[_0xe13a('0x2f')],qs[_0xe13a('0x34')](_0x191b5d[_0xe13a('0x30')]['fields']));_0x3ebec2['attributes']=_0x3ebec2[_0xe13a('0x35')]['length']?_0x3ebec2[_0xe13a('0x35')]:_0x26090e[_0xe13a('0x2f')];if(_0x191b5d['query'][_0xe13a('0x46')]){_0x3ebec2[_0xe13a('0x47')]=[{'all':!![]}];}_0x3ebec2=_['merge']({},_0x3ebec2,_0x191b5d[_0xe13a('0x40')]);return db[_0xe13a('0x45')][_0xe13a('0x48')](_0x3ebec2)[_0xe13a('0x23')](handleEntityNotFound(_0x1a24c0,null))[_0xe13a('0x23')](respondWithResult(_0x1a24c0,null))[_0xe13a('0x43')](handleError(_0x1a24c0,null));};exports[_0xe13a('0x49')]=function(_0x12e31e,_0x3d7bf1){return db[_0xe13a('0x45')][_0xe13a('0x49')](_0x12e31e[_0xe13a('0x4a')],{})[_0xe13a('0x23')](respondWithResult(_0x3d7bf1,0xc9))[_0xe13a('0x43')](handleError(_0x3d7bf1,null));};exports[_0xe13a('0x22')]=function(_0x2393e2,_0xf985cc){if(_0x2393e2[_0xe13a('0x4a')]['id']){delete _0x2393e2[_0xe13a('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xe13a('0x48')]({'where':{'id':_0x2393e2[_0xe13a('0x44')]['id']}})[_0xe13a('0x23')](handleEntityNotFound(_0xf985cc,null))[_0xe13a('0x23')](saveUpdates(_0x2393e2[_0xe13a('0x4a')],null))[_0xe13a('0x23')](respondWithResult(_0xf985cc,null))[_0xe13a('0x43')](handleError(_0xf985cc,null));};exports[_0xe13a('0x24')]=function(_0xcb6eb,_0xcae41d){return db['ServicenowConfiguration'][_0xe13a('0x48')]({'where':{'id':_0xcb6eb[_0xe13a('0x44')]['id']}})[_0xe13a('0x23')](handleEntityNotFound(_0xcae41d,null))[_0xe13a('0x23')](removeEntity(_0xcae41d,null))[_0xe13a('0x43')](handleError(_0xcae41d,null));};exports[_0xe13a('0x4b')]=function(_0x413b39,_0x549351,_0x2498ce){var _0x24b671={};var _0x420556={};var _0xf59660;var _0x453eb0;return db['ServicenowConfiguration'][_0xe13a('0x4c')]({'where':{'id':_0x413b39[_0xe13a('0x44')]['id']}})[_0xe13a('0x23')](handleEntityNotFound(_0x549351,null))[_0xe13a('0x23')](function(_0x10769e){if(_0x10769e){_0xf59660=_0x10769e;_0x420556[_0xe13a('0x2f')]=_[_0xe13a('0x31')](db[_0xe13a('0x4d')]['rawAttributes']);_0x420556['query']=_[_0xe13a('0x31')](_0x413b39[_0xe13a('0x30')]);_0x420556[_0xe13a('0x32')]=_['intersection'](_0x420556[_0xe13a('0x2f')],_0x420556[_0xe13a('0x30')]);_0x24b671[_0xe13a('0x35')]=_[_0xe13a('0x33')](_0x420556[_0xe13a('0x2f')],qs['fields'](_0x413b39[_0xe13a('0x30')]['fields']));_0x24b671[_0xe13a('0x35')]=_0x24b671['attributes'][_0xe13a('0x36')]?_0x24b671[_0xe13a('0x35')]:_0x420556[_0xe13a('0x2f')];_0x24b671[_0xe13a('0x39')]=qs[_0xe13a('0x3a')](_0x413b39['query'][_0xe13a('0x3a')]);_0x24b671[_0xe13a('0x3b')]=qs[_0xe13a('0x32')](_['pick'](_0x413b39['query'],_0x420556['filters']));if(_0x413b39[_0xe13a('0x30')][_0xe13a('0x3d')]){_0x24b671[_0xe13a('0x3b')]=_[_0xe13a('0x3f')](_0x24b671[_0xe13a('0x3b')],{'$or':_[_0xe13a('0x2a')](_0x24b671[_0xe13a('0x35')],function(_0x39d126){var _0x1365fc={};_0x1365fc[_0x39d126]={'$like':'%'+_0x413b39[_0xe13a('0x30')]['filter']+'%'};return _0x1365fc;})});}_0x24b671=_[_0xe13a('0x3f')]({},_0x24b671,_0x413b39['options']);return _0xf59660['getFields'](_0x24b671);}})['then'](function(_0x1f65ae){if(_0x1f65ae){_0x453eb0=_0x1f65ae[_0xe13a('0x36')];if(!_0x413b39[_0xe13a('0x30')][_0xe13a('0x37')](_0xe13a('0x38'))){_0x24b671[_0xe13a('0x1b')]=qs[_0xe13a('0x1b')](_0x413b39[_0xe13a('0x30')][_0xe13a('0x1b')]);_0x24b671['offset']=qs['offset'](_0x413b39[_0xe13a('0x30')][_0xe13a('0x19')]);}return _0xf59660[_0xe13a('0x4b')](_0x24b671);}})[_0xe13a('0x23')](function(_0x48d47c){if(_0x48d47c){return _0x48d47c?{'count':_0x453eb0,'rows':_0x48d47c}:null;}})[_0xe13a('0x23')](respondWithResult(_0x549351,null))[_0xe13a('0x43')](handleError(_0x549351,null));};exports[_0xe13a('0x4e')]=function(_0xe07a82,_0x3584ee,_0x2ec72b){var _0xb3c867={};var _0x1fd05e={};var _0x2e59e2;var _0x177d8c;return db[_0xe13a('0x45')][_0xe13a('0x4c')]({'where':{'id':_0xe07a82[_0xe13a('0x44')]['id']}})[_0xe13a('0x23')](handleEntityNotFound(_0x3584ee,null))['then'](function(_0x38721a){if(_0x38721a){_0x2e59e2=_0x38721a;_0x1fd05e[_0xe13a('0x2f')]=_[_0xe13a('0x31')](db[_0xe13a('0x4d')]['rawAttributes']);_0x1fd05e[_0xe13a('0x30')]=_[_0xe13a('0x31')](_0xe07a82[_0xe13a('0x30')]);_0x1fd05e['filters']=_[_0xe13a('0x33')](_0x1fd05e[_0xe13a('0x2f')],_0x1fd05e[_0xe13a('0x30')]);_0xb3c867[_0xe13a('0x35')]=_[_0xe13a('0x33')](_0x1fd05e['model'],qs['fields'](_0xe07a82[_0xe13a('0x30')][_0xe13a('0x34')]));_0xb3c867['attributes']=_0xb3c867[_0xe13a('0x35')][_0xe13a('0x36')]?_0xb3c867[_0xe13a('0x35')]:_0x1fd05e['model'];_0xb3c867['order']=qs[_0xe13a('0x3a')](_0xe07a82[_0xe13a('0x30')][_0xe13a('0x3a')]);_0xb3c867['where']=qs[_0xe13a('0x32')](_[_0xe13a('0x3c')](_0xe07a82[_0xe13a('0x30')],_0x1fd05e[_0xe13a('0x32')]));if(_0xe07a82[_0xe13a('0x30')][_0xe13a('0x3d')]){_0xb3c867[_0xe13a('0x3b')]=_[_0xe13a('0x3f')](_0xb3c867[_0xe13a('0x3b')],{'$or':_['map'](_0xb3c867[_0xe13a('0x35')],function(_0xc17d7f){var _0xfbd31e={};_0xfbd31e[_0xc17d7f]={'$like':'%'+_0xe07a82[_0xe13a('0x30')][_0xe13a('0x3d')]+'%'};return _0xfbd31e;})});}_0xb3c867=_[_0xe13a('0x3f')]({},_0xb3c867,_0xe07a82[_0xe13a('0x40')]);return _0x2e59e2[_0xe13a('0x4e')](_0xb3c867);}})[_0xe13a('0x23')](function(_0xf8f26c){if(_0xf8f26c){_0x177d8c=_0xf8f26c['length'];if(!_0xe07a82[_0xe13a('0x30')][_0xe13a('0x37')](_0xe13a('0x38'))){_0xb3c867[_0xe13a('0x1b')]=qs[_0xe13a('0x1b')](_0xe07a82['query']['limit']);_0xb3c867[_0xe13a('0x19')]=qs['offset'](_0xe07a82[_0xe13a('0x30')]['offset']);}return _0x2e59e2[_0xe13a('0x4e')](_0xb3c867);}})[_0xe13a('0x23')](function(_0x4ddb0a){if(_0x4ddb0a){return _0x4ddb0a?{'count':_0x177d8c,'rows':_0x4ddb0a}:null;}})[_0xe13a('0x23')](respondWithResult(_0x3584ee,null))['catch'](handleError(_0x3584ee,null));};exports[_0xe13a('0x4f')]=function(_0x2621b6,_0x16fbd2,_0x583b0f){var _0x1691e2={};var _0x4a7fef={};var _0xc695a2;var _0x1c588c;return db[_0xe13a('0x45')][_0xe13a('0x4c')]({'where':{'id':_0x2621b6['params']['id']}})[_0xe13a('0x23')](handleEntityNotFound(_0x16fbd2,null))[_0xe13a('0x23')](function(_0x3f71f6){if(_0x3f71f6){_0xc695a2=_0x3f71f6;_0x4a7fef[_0xe13a('0x2f')]=_[_0xe13a('0x31')](db['ServicenowField'][_0xe13a('0x2b')]);_0x4a7fef[_0xe13a('0x30')]=_[_0xe13a('0x31')](_0x2621b6[_0xe13a('0x30')]);_0x4a7fef[_0xe13a('0x32')]=_[_0xe13a('0x33')](_0x4a7fef[_0xe13a('0x2f')],_0x4a7fef[_0xe13a('0x30')]);_0x1691e2[_0xe13a('0x35')]=_['intersection'](_0x4a7fef[_0xe13a('0x2f')],qs[_0xe13a('0x34')](_0x2621b6[_0xe13a('0x30')][_0xe13a('0x34')]));_0x1691e2['attributes']=_0x1691e2[_0xe13a('0x35')]['length']?_0x1691e2[_0xe13a('0x35')]:_0x4a7fef[_0xe13a('0x2f')];_0x1691e2['order']=qs[_0xe13a('0x3a')](_0x2621b6[_0xe13a('0x30')][_0xe13a('0x3a')]);_0x1691e2[_0xe13a('0x3b')]=qs[_0xe13a('0x32')](_['pick'](_0x2621b6['query'],_0x4a7fef[_0xe13a('0x32')]));if(_0x2621b6[_0xe13a('0x30')][_0xe13a('0x3d')]){_0x1691e2[_0xe13a('0x3b')]=_['merge'](_0x1691e2[_0xe13a('0x3b')],{'$or':_[_0xe13a('0x2a')](_0x1691e2[_0xe13a('0x35')],function(_0x579cb7){var _0x1a72f4={};_0x1a72f4[_0x579cb7]={'$like':'%'+_0x2621b6[_0xe13a('0x30')][_0xe13a('0x3d')]+'%'};return _0x1a72f4;})});}_0x1691e2=_[_0xe13a('0x3f')]({},_0x1691e2,_0x2621b6[_0xe13a('0x40')]);return _0xc695a2[_0xe13a('0x4f')](_0x1691e2);}})['then'](function(_0x175111){if(_0x175111){_0x1c588c=_0x175111[_0xe13a('0x36')];if(!_0x2621b6[_0xe13a('0x30')][_0xe13a('0x37')](_0xe13a('0x38'))){_0x1691e2[_0xe13a('0x1b')]=qs[_0xe13a('0x1b')](_0x2621b6[_0xe13a('0x30')][_0xe13a('0x1b')]);_0x1691e2[_0xe13a('0x19')]=qs['offset'](_0x2621b6[_0xe13a('0x30')]['offset']);}return _0xc695a2[_0xe13a('0x4f')](_0x1691e2);}})[_0xe13a('0x23')](function(_0x36dc0c){if(_0x36dc0c){return _0x36dc0c?{'count':_0x1c588c,'rows':_0x36dc0c}:null;}})['then'](respondWithResult(_0x16fbd2,null))[_0xe13a('0x43')](handleError(_0x16fbd2,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index bb909da..019582e 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 _0x2547=['rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x288e34,_0x102f3a){var _0xa96660=function(_0xdaa62c){while(--_0xdaa62c){_0x288e34['push'](_0x288e34['shift']());}};_0xa96660(++_0x102f3a);}(_0x2547,0x1cd));var _0x7254=function(_0x160339,_0x4a06ba){_0x160339=_0x160339-0x0;var _0x3ba77f=_0x2547[_0x160339];return _0x3ba77f;};'use strict';var _=require('lodash');var util=require(_0x7254('0x0'));var logger=require(_0x7254('0x1'))(_0x7254('0x2'));var moment=require(_0x7254('0x3'));var BPromise=require(_0x7254('0x4'));var rp=require(_0x7254('0x5'));var fs=require('fs');var path=require(_0x7254('0x6'));var rimraf=require(_0x7254('0x7'));var config=require('../../config/environment');var attributes=require(_0x7254('0x8'));module[_0x7254('0x9')]=function(_0x67f427,_0x119f66){return _0x67f427['define'](_0x7254('0xa'),attributes,{'tableName':_0x7254('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd7b=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x3e7993,_0x2d0955){var _0x212c3e=function(_0x4c361c){while(--_0x4c361c){_0x3e7993['push'](_0x3e7993['shift']());}};_0x212c3e(++_0x2d0955);}(_0xfd7b,0xd1));var _0xbfd7=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0xfd7b[_0x18abd2];return _0x1dcad6;};'use strict';var _=require(_0xbfd7('0x0'));var util=require(_0xbfd7('0x1'));var logger=require(_0xbfd7('0x2'))('api');var moment=require(_0xbfd7('0x3'));var BPromise=require(_0xbfd7('0x4'));var rp=require(_0xbfd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfd7('0x6'));var config=require(_0xbfd7('0x7'));var attributes=require(_0xbfd7('0x8'));module['exports']=function(_0x134ee5,_0x3d054f){return _0x134ee5['define'](_0xbfd7('0x9'),attributes,{'tableName':_0xbfd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 4ad7ce5..4ca12e2 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 _0x4cad=['ServicenowConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','message'];(function(_0x23faba,_0x354cb8){var _0x369994=function(_0x463980){while(--_0x463980){_0x23faba['push'](_0x23faba['shift']());}};_0x369994(++_0x354cb8);}(_0x4cad,0x179));var _0xd4ca=function(_0x13f407,_0x2d47bc){_0x13f407=_0x13f407-0x0;var _0x21e225=_0x4cad[_0x13f407];return _0x21e225;};'use strict';var _=require(_0xd4ca('0x0'));var util=require(_0xd4ca('0x1'));var moment=require(_0xd4ca('0x2'));var BPromise=require(_0xd4ca('0x3'));var rs=require(_0xd4ca('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4ca('0x5'))['db'];var utils=require(_0xd4ca('0x6'));var logger=require(_0xd4ca('0x7'))(_0xd4ca('0x8'));var config=require(_0xd4ca('0x9'));var jayson=require(_0xd4ca('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x535e0f,_0x4fe3d7,_0x543a99){return new BPromise(function(_0x8ed0a5,_0x116084){return client[_0xd4ca('0xb')](_0x535e0f,_0x543a99)[_0xd4ca('0xc')](function(_0x2420e8){logger[_0xd4ca('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4fe3d7,_0xd4ca('0xe'));logger[_0xd4ca('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4fe3d7,_0xd4ca('0xe'),JSON[_0xd4ca('0x10')](_0x2420e8));if(_0x2420e8['error']){if(_0x2420e8[_0xd4ca('0x11')]['code']===0x1f4){logger[_0xd4ca('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4fe3d7,_0x2420e8[_0xd4ca('0x11')][_0xd4ca('0x12')]);return _0x116084(_0x2420e8[_0xd4ca('0x11')][_0xd4ca('0x12')]);}logger['error'](_0xd4ca('0x13'),_0x4fe3d7,_0x2420e8[_0xd4ca('0x11')][_0xd4ca('0x12')]);return _0x8ed0a5(_0x2420e8[_0xd4ca('0x11')][_0xd4ca('0x12')]);}else{logger[_0xd4ca('0xd')](_0xd4ca('0x13'),_0x4fe3d7,_0xd4ca('0xe'));_0x8ed0a5(_0x2420e8[_0xd4ca('0x14')]['message']);}})[_0xd4ca('0x15')](function(_0x2bd161){logger[_0xd4ca('0x11')](_0xd4ca('0x13'),_0x4fe3d7,_0x2bd161);_0x116084(_0x2bd161);});});} \ No newline at end of file +var _0x9627=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9627,0x8a));var _0x7962=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9627[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x7962('0x0'));var util=require('util');var moment=require(_0x7962('0x1'));var BPromise=require(_0x7962('0x2'));var rs=require(_0x7962('0x3'));var fs=require('fs');var Redis=require(_0x7962('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7962('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x7962('0x6'));var jayson=require(_0x7962('0x7'));var client=jayson[_0x7962('0x8')][_0x7962('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34202a,_0x54b615,_0xcaa306){return new BPromise(function(_0x1446d1,_0x27072f){return client[_0x7962('0xa')](_0x34202a,_0xcaa306)[_0x7962('0xb')](function(_0x6e25f5){logger[_0x7962('0xc')](_0x7962('0xd'),_0x54b615,_0x7962('0xe'));logger[_0x7962('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x54b615,_0x7962('0xe'),JSON[_0x7962('0x10')](_0x6e25f5));if(_0x6e25f5[_0x7962('0x11')]){if(_0x6e25f5[_0x7962('0x11')][_0x7962('0x12')]===0x1f4){logger[_0x7962('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x54b615,_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);return _0x27072f(_0x6e25f5[_0x7962('0x11')]['message']);}logger[_0x7962('0x11')](_0x7962('0xd'),_0x54b615,_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);return _0x1446d1(_0x6e25f5[_0x7962('0x11')][_0x7962('0x13')]);}else{logger[_0x7962('0xc')](_0x7962('0xd'),_0x54b615,_0x7962('0xe'));_0x1446d1(_0x6e25f5[_0x7962('0x14')][_0x7962('0x13')]);}})[_0x7962('0x15')](function(_0x390fc8){logger[_0x7962('0x11')](_0x7962('0xd'),_0x54b615,_0x390fc8);_0x27072f(_0x390fc8);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 7a174cf..9675d20 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 _0x95a4=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get'];(function(_0x5e577d,_0x299d1b){var _0x4e724b=function(_0x3b62c1){while(--_0x3b62c1){_0x5e577d['push'](_0x5e577d['shift']());}};_0x4e724b(++_0x299d1b);}(_0x95a4,0x184));var _0x495a=function(_0x198688,_0x545f46){_0x198688=_0x198688-0x0;var _0x5045e8=_0x95a4[_0x198688];return _0x5045e8;};'use strict';var multer=require(_0x495a('0x0'));var util=require(_0x495a('0x1'));var path=require(_0x495a('0x2'));var timeout=require('connect-timeout');var express=require(_0x495a('0x3'));var router=express[_0x495a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x495a('0x5'));var config=require(_0x495a('0x6'));var controller=require('./intServicenowField.controller');router[_0x495a('0x7')]('/',auth[_0x495a('0x8')](),controller[_0x495a('0x9')]);router[_0x495a('0x7')](_0x495a('0xa'),auth['isAuthenticated'](),controller[_0x495a('0xb')]);router['post']('/',auth[_0x495a('0x8')](),controller[_0x495a('0xc')]);router[_0x495a('0xd')](_0x495a('0xa'),auth[_0x495a('0x8')](),controller[_0x495a('0xe')]);router[_0x495a('0xf')](_0x495a('0xa'),auth[_0x495a('0x8')](),controller[_0x495a('0x10')]);module[_0x495a('0x11')]=router; \ No newline at end of file +var _0x64f5=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0x64f5,0xd6));var _0x564f=function(_0x433ef6,_0xfb9389){_0x433ef6=_0x433ef6-0x0;var _0x568cfd=_0x64f5[_0x433ef6];return _0x568cfd;};'use strict';var multer=require(_0x564f('0x0'));var util=require('util');var path=require(_0x564f('0x1'));var timeout=require(_0x564f('0x2'));var express=require(_0x564f('0x3'));var router=express[_0x564f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x564f('0x5'));var interaction=require(_0x564f('0x6'));var config=require('../../config/environment');var controller=require(_0x564f('0x7'));router[_0x564f('0x8')]('/',auth[_0x564f('0x9')](),controller['index']);router[_0x564f('0x8')](_0x564f('0xa'),auth[_0x564f('0x9')](),controller[_0x564f('0xb')]);router[_0x564f('0xc')]('/',auth[_0x564f('0x9')](),controller[_0x564f('0xd')]);router[_0x564f('0xe')](_0x564f('0xa'),auth[_0x564f('0x9')](),controller[_0x564f('0xf')]);router[_0x564f('0x10')](_0x564f('0xa'),auth[_0x564f('0x9')](),controller[_0x564f('0x11')]);module[_0x564f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 3f31f76..b676eff 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 _0xc706=['string','customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x155965,_0x10c46c){var _0x4ebed9=function(_0x4811d0){while(--_0x4811d0){_0x155965['push'](_0x155965['shift']());}};_0x4ebed9(++_0x10c46c);}(_0xc706,0x180));var _0x6c70=function(_0x4dae00,_0x15b194){_0x4dae00=_0x4dae00-0x0;var _0x16bf42=_0xc706[_0x4dae00];return _0x16bf42;};'use strict';var Sequelize=require(_0x6c70('0x0'));module[_0x6c70('0x1')]={'type':{'type':Sequelize[_0x6c70('0x2')](_0x6c70('0x3'),'variable',_0x6c70('0x4'),'keyValue',_0x6c70('0x5')),'defaultValue':_0x6c70('0x3')},'content':{'type':Sequelize[_0x6c70('0x6')]},'key':{'type':Sequelize[_0x6c70('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x6c70('0x3'),_0x6c70('0x7'),_0x6c70('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6c70('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6c70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6c70('0x6')]}}; \ No newline at end of file +var _0x6317=['picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0x6317,0xca));var _0x7631=function(_0x52fde2,_0x1fa5f5){_0x52fde2=_0x52fde2-0x0;var _0x18bb9=_0x6317[_0x52fde2];return _0x18bb9;};'use strict';var Sequelize=require(_0x7631('0x0'));module['exports']={'type':{'type':Sequelize[_0x7631('0x1')](_0x7631('0x2'),_0x7631('0x3'),'customVariable',_0x7631('0x4'),_0x7631('0x5')),'defaultValue':_0x7631('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7631('0x6')]},'keyType':{'type':Sequelize[_0x7631('0x1')](_0x7631('0x2'),_0x7631('0x3'),_0x7631('0x7'))},'keyContent':{'type':Sequelize[_0x7631('0x6')]},'idField':{'type':Sequelize[_0x7631('0x6')]},'nameField':{'type':Sequelize[_0x7631('0x6')]},'customField':{'type':Sequelize[_0x7631('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 744a823..1033ca3 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 _0x453b=['zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','show','params','include','catch','create','body','find','eml-format'];(function(_0x1d27b1,_0x582136){var _0x45198b=function(_0x4819f4){while(--_0x4819f4){_0x1d27b1['push'](_0x1d27b1['shift']());}};_0x45198b(++_0x582136);}(_0x453b,0x15d));var _0xb453=function(_0x21c69c,_0x1b7535){_0x21c69c=_0x21c69c-0x0;var _0x2acd03=_0x453b[_0x21c69c];return _0x2acd03;};'use strict';var emlformat=require(_0xb453('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb453('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb453('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb453('0x3'));var util=require(_0xb453('0x4'));var path=require(_0xb453('0x5'));var sox=require(_0xb453('0x6'));var csv=require(_0xb453('0x7'));var ejs=require(_0xb453('0x8'));var fs=require('fs');var fs_extra=require(_0xb453('0x9'));var _=require(_0xb453('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb453('0xb'));var deskjs=require(_0xb453('0xc'));var toCsv=require(_0xb453('0x7'));var querystring=require(_0xb453('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb453('0xe'));var qs=require(_0xb453('0xf'));var as=require(_0xb453('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb453('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xb453('0x12'));var licenseUtil=require(_0xb453('0x13'));var db=require(_0xb453('0x14'))['db'];function respondWithStatusCode(_0x5ad0f0,_0x1bcb8f){_0x1bcb8f=_0x1bcb8f||0xcc;return function(_0x39dac7){if(_0x39dac7){return _0x5ad0f0[_0xb453('0x15')](_0x1bcb8f);}return _0x5ad0f0[_0xb453('0x16')](_0x1bcb8f)[_0xb453('0x17')]();};}function respondWithResult(_0xc9af08,_0x2dff41){_0x2dff41=_0x2dff41||0xc8;return function(_0x361271){if(_0x361271){return _0xc9af08[_0xb453('0x16')](_0x2dff41)[_0xb453('0x18')](_0x361271);}};}function respondWithFilteredResult(_0x2bf280,_0x57d42e){return function(_0x58ab61){if(_0x58ab61){var _0x4835a8=typeof _0x57d42e['offset']==='undefined'&&typeof _0x57d42e[_0xb453('0x19')]===_0xb453('0x1a');var _0x55e674=_0x58ab61[_0xb453('0x1b')];var _0x2038af=_0x4835a8?0x0:_0x57d42e['offset'];var _0x2f4feb=_0x4835a8?_0x58ab61[_0xb453('0x1b')]:_0x57d42e['offset']+_0x57d42e[_0xb453('0x19')];var _0x31a568;if(_0x2f4feb>=_0x55e674){_0x2f4feb=_0x55e674;_0x31a568=0xc8;}else{_0x31a568=0xce;}_0x2bf280[_0xb453('0x16')](_0x31a568);return _0x2bf280[_0xb453('0x1c')](_0xb453('0x1d'),_0x2038af+'-'+_0x2f4feb+'/'+_0x55e674)[_0xb453('0x18')](_0x58ab61);}return null;};}function patchUpdates(_0x26ca23){return function(_0x439648){try{jsonpatch['apply'](_0x439648,_0x26ca23,!![]);}catch(_0x5e9f1b){return BPromise['reject'](_0x5e9f1b);}return _0x439648[_0xb453('0x1e')]();};}function saveUpdates(_0x49c76d,_0x5f0b8b){return function(_0x36939a){if(_0x36939a){return _0x36939a[_0xb453('0x1f')](_0x49c76d)[_0xb453('0x20')](function(_0x3cb685){return _0x3cb685;});}return null;};}function removeEntity(_0x46e4b9,_0x202e97){return function(_0x20678c){if(_0x20678c){return _0x20678c[_0xb453('0x21')]()['then'](function(){_0x46e4b9[_0xb453('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132ff6,_0x2745bd){return function(_0x5e860c){if(!_0x5e860c){_0x132ff6[_0xb453('0x15')](0x194);}return _0x5e860c;};}function handleError(_0x1654e2,_0x332e64){_0x332e64=_0x332e64||0x1f4;return function(_0x1f87a4){logger[_0xb453('0x22')](_0x1f87a4['stack']);if(_0x1f87a4['name']){delete _0x1f87a4[_0xb453('0x23')];}_0x1654e2[_0xb453('0x16')](_0x332e64)['send'](_0x1f87a4);};}exports[_0xb453('0x24')]=function(_0x5220f4,_0x52f708){var _0x35697e={},_0x30d389={},_0x25eae6={'count':0x0,'rows':[]};var _0x3fffd7=_[_0xb453('0x25')](db[_0xb453('0x26')][_0xb453('0x27')],function(_0x3c3b2a){return{'name':_0x3c3b2a[_0xb453('0x28')],'type':_0x3c3b2a['type'][_0xb453('0x29')]};});_0x30d389[_0xb453('0x2a')]=_['map'](_0x3fffd7,'name');_0x30d389['query']=_[_0xb453('0x2b')](_0x5220f4[_0xb453('0x2c')]);_0x30d389[_0xb453('0x2d')]=_[_0xb453('0x2e')](_0x30d389[_0xb453('0x2a')],_0x30d389['query']);_0x35697e['attributes']=_[_0xb453('0x2e')](_0x30d389[_0xb453('0x2a')],qs[_0xb453('0x2f')](_0x5220f4[_0xb453('0x2c')][_0xb453('0x2f')]));_0x35697e['attributes']=_0x35697e[_0xb453('0x30')][_0xb453('0x31')]?_0x35697e[_0xb453('0x30')]:_0x30d389['model'];if(!_0x5220f4['query'][_0xb453('0x32')]('nolimit')){_0x35697e[_0xb453('0x19')]=qs[_0xb453('0x19')](_0x5220f4[_0xb453('0x2c')][_0xb453('0x19')]);_0x35697e[_0xb453('0x33')]=qs[_0xb453('0x33')](_0x5220f4['query'][_0xb453('0x33')]);}_0x35697e[_0xb453('0x34')]=qs[_0xb453('0x35')](_0x5220f4['query'][_0xb453('0x35')]);_0x35697e[_0xb453('0x36')]=qs['filters'](_[_0xb453('0x37')](_0x5220f4[_0xb453('0x2c')],_0x30d389[_0xb453('0x2d')]),_0x3fffd7);if(_0x5220f4[_0xb453('0x2c')]['filter']){_0x35697e[_0xb453('0x36')]=_[_0xb453('0x38')](_0x35697e[_0xb453('0x36')],{'$or':_[_0xb453('0x25')](_0x3fffd7,function(_0x336499){if(_0x336499[_0xb453('0x39')]!==_0xb453('0x3a')){var _0x315e94={};_0x315e94[_0x336499['name']]={'$like':'%'+_0x5220f4[_0xb453('0x2c')][_0xb453('0x3b')]+'%'};return _0x315e94;}})});}_0x35697e=_[_0xb453('0x38')]({},_0x35697e,_0x5220f4['options']);var _0x17cdf0={'where':_0x35697e[_0xb453('0x36')]};return db[_0xb453('0x26')][_0xb453('0x1b')](_0x17cdf0)[_0xb453('0x20')](function(_0x910799){_0x25eae6[_0xb453('0x1b')]=_0x910799;if(_0x5220f4[_0xb453('0x2c')][_0xb453('0x3c')]){_0x35697e['include']=[{'all':!![]}];}return db['ServicenowField'][_0xb453('0x3d')](_0x35697e);})[_0xb453('0x20')](function(_0x33a6a9){_0x25eae6[_0xb453('0x3e')]=_0x33a6a9;return _0x25eae6;})['then'](respondWithFilteredResult(_0x52f708,_0x35697e))['catch'](handleError(_0x52f708,null));};exports[_0xb453('0x3f')]=function(_0x5ab73f,_0x22cf4d){var _0x20d067={'raw':!![],'where':{'id':_0x5ab73f[_0xb453('0x40')]['id']}},_0x3ed4ab={};_0x3ed4ab[_0xb453('0x2a')]=_[_0xb453('0x2b')](db[_0xb453('0x26')]['rawAttributes']);_0x3ed4ab[_0xb453('0x2c')]=_[_0xb453('0x2b')](_0x5ab73f[_0xb453('0x2c')]);_0x3ed4ab['filters']=_['intersection'](_0x3ed4ab[_0xb453('0x2a')],_0x3ed4ab['query']);_0x20d067['attributes']=_[_0xb453('0x2e')](_0x3ed4ab[_0xb453('0x2a')],qs[_0xb453('0x2f')](_0x5ab73f[_0xb453('0x2c')][_0xb453('0x2f')]));_0x20d067[_0xb453('0x30')]=_0x20d067['attributes'][_0xb453('0x31')]?_0x20d067['attributes']:_0x3ed4ab[_0xb453('0x2a')];if(_0x5ab73f[_0xb453('0x2c')]['includeAll']){_0x20d067[_0xb453('0x41')]=[{'all':!![]}];}_0x20d067=_[_0xb453('0x38')]({},_0x20d067,_0x5ab73f['options']);return db['ServicenowField']['find'](_0x20d067)[_0xb453('0x20')](handleEntityNotFound(_0x22cf4d,null))[_0xb453('0x20')](respondWithResult(_0x22cf4d,null))[_0xb453('0x42')](handleError(_0x22cf4d,null));};exports['create']=function(_0x21f5f8,_0x271c9c){return db['ServicenowField'][_0xb453('0x43')](_0x21f5f8[_0xb453('0x44')],{})[_0xb453('0x20')](respondWithResult(_0x271c9c,0xc9))['catch'](handleError(_0x271c9c,null));};exports[_0xb453('0x1f')]=function(_0x210e2d,_0x17fd01){if(_0x210e2d[_0xb453('0x44')]['id']){delete _0x210e2d['body']['id'];}return db[_0xb453('0x26')][_0xb453('0x45')]({'where':{'id':_0x210e2d[_0xb453('0x40')]['id']}})[_0xb453('0x20')](handleEntityNotFound(_0x17fd01,null))[_0xb453('0x20')](saveUpdates(_0x210e2d['body'],null))[_0xb453('0x20')](respondWithResult(_0x17fd01,null))[_0xb453('0x42')](handleError(_0x17fd01,null));};exports[_0xb453('0x21')]=function(_0x5254d6,_0x437ba7){return db['ServicenowField'][_0xb453('0x45')]({'where':{'id':_0x5254d6[_0xb453('0x40')]['id']}})[_0xb453('0x20')](handleEntityNotFound(_0x437ba7,null))['then'](removeEntity(_0x437ba7,null))['catch'](handleError(_0x437ba7,null));}; \ No newline at end of file +var _0x55d7=['where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','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','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','offset','undefined','limit','count','set','Content-Range','json','save','then','destroy','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','order','sort'];(function(_0x48d12f,_0x5b66db){var _0x47fadc=function(_0x408a80){while(--_0x408a80){_0x48d12f['push'](_0x48d12f['shift']());}};_0x47fadc(++_0x5b66db);}(_0x55d7,0x107));var _0x755d=function(_0x5bf35e,_0x4ccc17){_0x5bf35e=_0x5bf35e-0x0;var _0x35b3d7=_0x55d7[_0x5bf35e];return _0x35b3d7;};'use strict';var emlformat=require(_0x755d('0x0'));var rimraf=require(_0x755d('0x1'));var zipdir=require(_0x755d('0x2'));var jsonpatch=require(_0x755d('0x3'));var rp=require(_0x755d('0x4'));var moment=require(_0x755d('0x5'));var BPromise=require(_0x755d('0x6'));var Mustache=require(_0x755d('0x7'));var util=require(_0x755d('0x8'));var path=require(_0x755d('0x9'));var sox=require(_0x755d('0xa'));var csv=require(_0x755d('0xb'));var ejs=require(_0x755d('0xc'));var fs=require('fs');var fs_extra=require(_0x755d('0xd'));var _=require(_0x755d('0xe'));var squel=require(_0x755d('0xf'));var crypto=require(_0x755d('0x10'));var jsforce=require(_0x755d('0x11'));var deskjs=require(_0x755d('0x12'));var toCsv=require(_0x755d('0xb'));var querystring=require(_0x755d('0x13'));var Papa=require(_0x755d('0x14'));var Redis=require(_0x755d('0x15'));var authService=require(_0x755d('0x16'));var qs=require(_0x755d('0x17'));var as=require(_0x755d('0x18'));var hardwareService=require(_0x755d('0x19'));var logger=require(_0x755d('0x1a'))(_0x755d('0x1b'));var utils=require(_0x755d('0x1c'));var config=require('../../config/environment');var licenseUtil=require(_0x755d('0x1d'));var db=require(_0x755d('0x1e'))['db'];function respondWithStatusCode(_0x1ea5f3,_0x3cd370){_0x3cd370=_0x3cd370||0xcc;return function(_0x3536aa){if(_0x3536aa){return _0x1ea5f3[_0x755d('0x1f')](_0x3cd370);}return _0x1ea5f3[_0x755d('0x20')](_0x3cd370)[_0x755d('0x21')]();};}function respondWithResult(_0x1f8664,_0x14fb79){_0x14fb79=_0x14fb79||0xc8;return function(_0x1317e4){if(_0x1317e4){return _0x1f8664['status'](_0x14fb79)['json'](_0x1317e4);}};}function respondWithFilteredResult(_0x4afd52,_0x232db7){return function(_0x5d5364){if(_0x5d5364){var _0x2a99d4=typeof _0x232db7[_0x755d('0x22')]===_0x755d('0x23')&&typeof _0x232db7[_0x755d('0x24')]===_0x755d('0x23');var _0x4dbfbb=_0x5d5364['count'];var _0x5ee9b6=_0x2a99d4?0x0:_0x232db7[_0x755d('0x22')];var _0x169341=_0x2a99d4?_0x5d5364[_0x755d('0x25')]:_0x232db7[_0x755d('0x22')]+_0x232db7[_0x755d('0x24')];var _0x429df5;if(_0x169341>=_0x4dbfbb){_0x169341=_0x4dbfbb;_0x429df5=0xc8;}else{_0x429df5=0xce;}_0x4afd52[_0x755d('0x20')](_0x429df5);return _0x4afd52[_0x755d('0x26')](_0x755d('0x27'),_0x5ee9b6+'-'+_0x169341+'/'+_0x4dbfbb)[_0x755d('0x28')](_0x5d5364);}return null;};}function patchUpdates(_0x1b9c67){return function(_0xd9187c){try{jsonpatch['apply'](_0xd9187c,_0x1b9c67,!![]);}catch(_0x5f469f){return BPromise['reject'](_0x5f469f);}return _0xd9187c[_0x755d('0x29')]();};}function saveUpdates(_0xece621,_0x328e4e){return function(_0xfe0b63){if(_0xfe0b63){return _0xfe0b63['update'](_0xece621)[_0x755d('0x2a')](function(_0x562d2f){return _0x562d2f;});}return null;};}function removeEntity(_0x2156b2,_0x2099a9){return function(_0x4c1de9){if(_0x4c1de9){return _0x4c1de9[_0x755d('0x2b')]()[_0x755d('0x2a')](function(){_0x2156b2[_0x755d('0x20')](0xcc)[_0x755d('0x21')]();});}};}function handleEntityNotFound(_0x29ed63,_0x3f675f){return function(_0x4429fc){if(!_0x4429fc){_0x29ed63['sendStatus'](0x194);}return _0x4429fc;};}function handleError(_0xcff8b2,_0x52258e){_0x52258e=_0x52258e||0x1f4;return function(_0x300565){logger[_0x755d('0x2c')](_0x300565[_0x755d('0x2d')]);if(_0x300565[_0x755d('0x2e')]){delete _0x300565[_0x755d('0x2e')];}_0xcff8b2[_0x755d('0x20')](_0x52258e)['send'](_0x300565);};}exports[_0x755d('0x2f')]=function(_0x3ccc7c,_0x4ea095){var _0x15f5e7={},_0x12ee03={},_0x22fccc={'count':0x0,'rows':[]};var _0x1c811e=_[_0x755d('0x30')](db[_0x755d('0x31')][_0x755d('0x32')],function(_0x35bfc0){return{'name':_0x35bfc0[_0x755d('0x33')],'type':_0x35bfc0[_0x755d('0x34')][_0x755d('0x35')]};});_0x12ee03['model']=_[_0x755d('0x30')](_0x1c811e,_0x755d('0x2e'));_0x12ee03['query']=_[_0x755d('0x36')](_0x3ccc7c['query']);_0x12ee03[_0x755d('0x37')]=_[_0x755d('0x38')](_0x12ee03[_0x755d('0x39')],_0x12ee03['query']);_0x15f5e7[_0x755d('0x3a')]=_[_0x755d('0x38')](_0x12ee03['model'],qs[_0x755d('0x3b')](_0x3ccc7c['query'][_0x755d('0x3b')]));_0x15f5e7[_0x755d('0x3a')]=_0x15f5e7[_0x755d('0x3a')][_0x755d('0x3c')]?_0x15f5e7['attributes']:_0x12ee03[_0x755d('0x39')];if(!_0x3ccc7c[_0x755d('0x3d')][_0x755d('0x3e')]('nolimit')){_0x15f5e7[_0x755d('0x24')]=qs[_0x755d('0x24')](_0x3ccc7c['query'][_0x755d('0x24')]);_0x15f5e7[_0x755d('0x22')]=qs[_0x755d('0x22')](_0x3ccc7c[_0x755d('0x3d')][_0x755d('0x22')]);}_0x15f5e7[_0x755d('0x3f')]=qs[_0x755d('0x40')](_0x3ccc7c[_0x755d('0x3d')][_0x755d('0x40')]);_0x15f5e7[_0x755d('0x41')]=qs[_0x755d('0x37')](_[_0x755d('0x42')](_0x3ccc7c[_0x755d('0x3d')],_0x12ee03[_0x755d('0x37')]),_0x1c811e);if(_0x3ccc7c[_0x755d('0x3d')]['filter']){_0x15f5e7[_0x755d('0x41')]=_['merge'](_0x15f5e7[_0x755d('0x41')],{'$or':_[_0x755d('0x30')](_0x1c811e,function(_0x4ac95a){if(_0x4ac95a[_0x755d('0x34')]!==_0x755d('0x43')){var _0x301950={};_0x301950[_0x4ac95a['name']]={'$like':'%'+_0x3ccc7c[_0x755d('0x3d')][_0x755d('0x44')]+'%'};return _0x301950;}})});}_0x15f5e7=_[_0x755d('0x45')]({},_0x15f5e7,_0x3ccc7c[_0x755d('0x46')]);var _0x22312b={'where':_0x15f5e7[_0x755d('0x41')]};return db[_0x755d('0x31')][_0x755d('0x25')](_0x22312b)[_0x755d('0x2a')](function(_0x487081){_0x22fccc['count']=_0x487081;if(_0x3ccc7c[_0x755d('0x3d')][_0x755d('0x47')]){_0x15f5e7[_0x755d('0x48')]=[{'all':!![]}];}return db['ServicenowField'][_0x755d('0x49')](_0x15f5e7);})[_0x755d('0x2a')](function(_0x245ba0){_0x22fccc[_0x755d('0x4a')]=_0x245ba0;return _0x22fccc;})[_0x755d('0x2a')](respondWithFilteredResult(_0x4ea095,_0x15f5e7))[_0x755d('0x4b')](handleError(_0x4ea095,null));};exports[_0x755d('0x4c')]=function(_0x53c04f,_0xaf45c3){var _0x294d74={'raw':!![],'where':{'id':_0x53c04f['params']['id']}},_0x47ca8e={};_0x47ca8e[_0x755d('0x39')]=_[_0x755d('0x36')](db['ServicenowField'][_0x755d('0x32')]);_0x47ca8e[_0x755d('0x3d')]=_[_0x755d('0x36')](_0x53c04f['query']);_0x47ca8e['filters']=_[_0x755d('0x38')](_0x47ca8e[_0x755d('0x39')],_0x47ca8e['query']);_0x294d74[_0x755d('0x3a')]=_['intersection'](_0x47ca8e['model'],qs[_0x755d('0x3b')](_0x53c04f['query'][_0x755d('0x3b')]));_0x294d74[_0x755d('0x3a')]=_0x294d74['attributes']['length']?_0x294d74[_0x755d('0x3a')]:_0x47ca8e[_0x755d('0x39')];if(_0x53c04f[_0x755d('0x3d')][_0x755d('0x47')]){_0x294d74['include']=[{'all':!![]}];}_0x294d74=_[_0x755d('0x45')]({},_0x294d74,_0x53c04f[_0x755d('0x46')]);return db[_0x755d('0x31')][_0x755d('0x4d')](_0x294d74)[_0x755d('0x2a')](handleEntityNotFound(_0xaf45c3,null))[_0x755d('0x2a')](respondWithResult(_0xaf45c3,null))[_0x755d('0x4b')](handleError(_0xaf45c3,null));};exports[_0x755d('0x4e')]=function(_0x343601,_0x8d496e){return db[_0x755d('0x31')][_0x755d('0x4e')](_0x343601['body'],{})[_0x755d('0x2a')](respondWithResult(_0x8d496e,0xc9))['catch'](handleError(_0x8d496e,null));};exports[_0x755d('0x4f')]=function(_0x90cc48,_0x5566df){if(_0x90cc48[_0x755d('0x50')]['id']){delete _0x90cc48[_0x755d('0x50')]['id'];}return db[_0x755d('0x31')]['find']({'where':{'id':_0x90cc48[_0x755d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5566df,null))[_0x755d('0x2a')](saveUpdates(_0x90cc48[_0x755d('0x50')],null))[_0x755d('0x2a')](respondWithResult(_0x5566df,null))[_0x755d('0x4b')](handleError(_0x5566df,null));};exports['destroy']=function(_0x139aa9,_0x3ac81b){return db[_0x755d('0x31')][_0x755d('0x4d')]({'where':{'id':_0x139aa9['params']['id']}})[_0x755d('0x2a')](handleEntityNotFound(_0x3ac81b,null))['then'](removeEntity(_0x3ac81b,null))[_0x755d('0x4b')](handleError(_0x3ac81b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 3992c86..ca3eb08 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 _0xd8d0=['int_servicenow_fields','idField','FieldId','util','api','moment','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x4b20d1,_0x394d61){var _0x492361=function(_0x4c0b25){while(--_0x4c0b25){_0x4b20d1['push'](_0x4b20d1['shift']());}};_0x492361(++_0x394d61);}(_0xd8d0,0xfa));var _0x0d8d=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xd8d0[_0x51020b];return _0x371e47;};'use strict';var _=require('lodash');var util=require(_0x0d8d('0x0'));var logger=require('../../config/logger')(_0x0d8d('0x1'));var moment=require(_0x0d8d('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d8d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d8d('0x4'));var config=require(_0x0d8d('0x5'));var attributes=require(_0x0d8d('0x6'));module[_0x0d8d('0x7')]=function(_0x3f493d,_0x520194){return _0x3f493d[_0x0d8d('0x8')](_0x0d8d('0x9'),attributes,{'tableName':_0x0d8d('0xa'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x0d8d('0xb'),_0x0d8d('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47d9=['FieldId','lodash','util','api','moment','bluebird','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index'];(function(_0x11160d,_0x413adc){var _0x21520a=function(_0x272f3c){while(--_0x272f3c){_0x11160d['push'](_0x11160d['shift']());}};_0x21520a(++_0x413adc);}(_0x47d9,0x11f));var _0x947d=function(_0x85eda0,_0x52271e){_0x85eda0=_0x85eda0-0x0;var _0x5e747c=_0x47d9[_0x85eda0];return _0x5e747c;};'use strict';var _=require(_0x947d('0x0'));var util=require(_0x947d('0x1'));var logger=require('../../config/logger')(_0x947d('0x2'));var moment=require(_0x947d('0x3'));var BPromise=require(_0x947d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x947d('0x5'));var config=require('../../config/environment');var attributes=require(_0x947d('0x6'));module[_0x947d('0x7')]=function(_0x3c0316,_0x423d14){return _0x3c0316[_0x947d('0x8')](_0x947d('0x9'),attributes,{'tableName':_0x947d('0xa'),'paranoid':![],'indexes':[{'name':_0x947d('0xb'),'fields':['idField',_0x947d('0xc')],'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 68d85c8..148660d 100644 --- a/server/api/intServicenowField/intServicenowField.rpc.js +++ b/server/api/intServicenowField/intServicenowField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0xcf27e3,_0x229a8d){var _0x46fda6=function(_0x22cf9b){while(--_0x22cf9b){_0xcf27e3['push'](_0xcf27e3['shift']());}};_0x46fda6(++_0x229a8d);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4c57af,_0x1168e1){_0x4c57af=_0x4c57af-0x0;var _0x434f84=_0x9ffd[_0x4c57af];return _0x434f84;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x17038f,_0x481b21){var _0x5ad02f=function(_0x5e5958){while(--_0x5e5958){_0x17038f['push'](_0x17038f['shift']());}};_0x5ad02f(++_0x481b21);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 970031c..ff017d0 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(_0x3d910c,_0xa0437e){var _0x2e2f58=function(_0x1c2b7f){while(--_0x1c2b7f){_0x3d910c['push'](_0x3d910c['shift']());}};_0x2e2f58(++_0xa0437e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5364f2,_0x43be51){var _0x3f1bc5=function(_0x2efaf3){while(--_0x2efaf3){_0x5364f2['push'](_0x5364f2['shift']());}};_0x3f1bc5(++_0x43be51);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f690549..a514533 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(_0x554015,_0x5989d3){var _0x48943d=function(_0xf36f56){while(--_0xf36f56){_0x554015['push'](_0x554015['shift']());}};_0x48943d(++_0x5989d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x1df0cf,_0x7465f5){var _0x1812ed=function(_0x2a8da1){while(--_0x2a8da1){_0x1df0cf['push'](_0x1df0cf['shift']());}};_0x1812ed(++_0x7465f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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 ef90f0f..470e548 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 _0x2f69=['where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','getConfigurations','SugarcrmConfiguration','options','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','get_module_fields','JSON','Calls','module_fields','label','values','value','test','statusCode','send','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','SugarcrmAccount','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5620fe,_0x53c7de){var _0x519454=function(_0x371755){while(--_0x371755){_0x5620fe['push'](_0x5620fe['shift']());}};_0x519454(++_0x53c7de);}(_0x2f69,0x1aa));var _0x92f6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2f69[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x92f6('0x0'));var rimraf=require(_0x92f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92f6('0x2'));var rp=require(_0x92f6('0x3'));var moment=require(_0x92f6('0x4'));var BPromise=require(_0x92f6('0x5'));var Mustache=require(_0x92f6('0x6'));var util=require(_0x92f6('0x7'));var path=require('path');var sox=require(_0x92f6('0x8'));var csv=require(_0x92f6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x92f6('0xa'));var crypto=require(_0x92f6('0xb'));var jsforce=require(_0x92f6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x92f6('0x9'));var querystring=require(_0x92f6('0xd'));var Papa=require(_0x92f6('0xe'));var Redis=require(_0x92f6('0xf'));var authService=require(_0x92f6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x92f6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x92f6('0x12'))(_0x92f6('0x13'));var utils=require(_0x92f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x92f6('0x15'));var db=require(_0x92f6('0x16'))['db'];var integrations=require(_0x92f6('0x17'));function respondWithStatusCode(_0x383637,_0x2a20de){_0x2a20de=_0x2a20de||0xcc;return function(_0x502685){if(_0x502685){return _0x383637['sendStatus'](_0x2a20de);}return _0x383637[_0x92f6('0x18')](_0x2a20de)[_0x92f6('0x19')]();};}function respondWithResult(_0x4a5dd8,_0x3feca4){_0x3feca4=_0x3feca4||0xc8;return function(_0x30d6f9){if(_0x30d6f9){return _0x4a5dd8[_0x92f6('0x18')](_0x3feca4)[_0x92f6('0x1a')](_0x30d6f9);}};}function respondWithFilteredResult(_0x16c6d0,_0x7f3ffd){return function(_0x201a0f){if(_0x201a0f){var _0x385ed9=typeof _0x7f3ffd[_0x92f6('0x1b')]===_0x92f6('0x1c')&&typeof _0x7f3ffd[_0x92f6('0x1d')]===_0x92f6('0x1c');var _0xf1a120=_0x201a0f[_0x92f6('0x1e')];var _0x5a29f3=_0x385ed9?0x0:_0x7f3ffd[_0x92f6('0x1b')];var _0x4749e2=_0x385ed9?_0x201a0f['count']:_0x7f3ffd[_0x92f6('0x1b')]+_0x7f3ffd['limit'];var _0xea632e;if(_0x4749e2>=_0xf1a120){_0x4749e2=_0xf1a120;_0xea632e=0xc8;}else{_0xea632e=0xce;}_0x16c6d0[_0x92f6('0x18')](_0xea632e);return _0x16c6d0[_0x92f6('0x1f')]('Content-Range',_0x5a29f3+'-'+_0x4749e2+'/'+_0xf1a120)[_0x92f6('0x1a')](_0x201a0f);}return null;};}function patchUpdates(_0x135643){return function(_0x6b5777){try{jsonpatch[_0x92f6('0x20')](_0x6b5777,_0x135643,!![]);}catch(_0x2dab54){return BPromise[_0x92f6('0x21')](_0x2dab54);}return _0x6b5777[_0x92f6('0x22')]();};}function saveUpdates(_0x51b5d5,_0x491092){return function(_0x452582){if(_0x452582){return _0x452582['update'](_0x51b5d5)[_0x92f6('0x23')](function(_0x2c130f){return _0x2c130f;});}return null;};}function removeEntity(_0x394878,_0x3d9e8b){return function(_0x57ff93){if(_0x57ff93){return _0x57ff93[_0x92f6('0x24')]()['then'](function(){_0x394878[_0x92f6('0x18')](0xcc)[_0x92f6('0x19')]();});}};}function handleEntityNotFound(_0x2e013d,_0x2316f2){return function(_0x58c4bf){if(!_0x58c4bf){_0x2e013d[_0x92f6('0x25')](0x194);}return _0x58c4bf;};}function handleError(_0x3d63d6,_0x130f8e){_0x130f8e=_0x130f8e||0x1f4;return function(_0x4f6244){logger[_0x92f6('0x26')](_0x4f6244[_0x92f6('0x27')]);if(_0x4f6244[_0x92f6('0x28')]){delete _0x4f6244[_0x92f6('0x28')];}_0x3d63d6[_0x92f6('0x18')](_0x130f8e)['send'](_0x4f6244);};}exports[_0x92f6('0x29')]=function(_0x12ff26,_0x4867d1){var _0x4ff00f={},_0x3dec89={},_0x5b0d6b={'count':0x0,'rows':[]};var _0x471600=_['map'](db[_0x92f6('0x2a')]['rawAttributes'],function(_0x20cd0f){return{'name':_0x20cd0f[_0x92f6('0x2b')],'type':_0x20cd0f[_0x92f6('0x2c')]['key']};});_0x3dec89[_0x92f6('0x2d')]=_[_0x92f6('0x2e')](_0x471600,_0x92f6('0x28'));_0x3dec89[_0x92f6('0x2f')]=_[_0x92f6('0x30')](_0x12ff26[_0x92f6('0x2f')]);_0x3dec89[_0x92f6('0x31')]=_[_0x92f6('0x32')](_0x3dec89[_0x92f6('0x2d')],_0x3dec89[_0x92f6('0x2f')]);_0x4ff00f['attributes']=_[_0x92f6('0x32')](_0x3dec89[_0x92f6('0x2d')],qs['fields'](_0x12ff26['query'][_0x92f6('0x33')]));_0x4ff00f[_0x92f6('0x34')]=_0x4ff00f['attributes'][_0x92f6('0x35')]?_0x4ff00f[_0x92f6('0x34')]:_0x3dec89[_0x92f6('0x2d')];if(!_0x12ff26[_0x92f6('0x2f')][_0x92f6('0x36')](_0x92f6('0x37'))){_0x4ff00f[_0x92f6('0x1d')]=qs[_0x92f6('0x1d')](_0x12ff26['query'][_0x92f6('0x1d')]);_0x4ff00f[_0x92f6('0x1b')]=qs[_0x92f6('0x1b')](_0x12ff26['query'][_0x92f6('0x1b')]);}_0x4ff00f[_0x92f6('0x38')]=qs[_0x92f6('0x39')](_0x12ff26[_0x92f6('0x2f')][_0x92f6('0x39')]);_0x4ff00f[_0x92f6('0x3a')]=qs[_0x92f6('0x31')](_[_0x92f6('0x3b')](_0x12ff26[_0x92f6('0x2f')],_0x3dec89[_0x92f6('0x31')]),_0x471600);if(_0x12ff26[_0x92f6('0x2f')][_0x92f6('0x3c')]){_0x4ff00f[_0x92f6('0x3a')]=_['merge'](_0x4ff00f[_0x92f6('0x3a')],{'$or':_[_0x92f6('0x2e')](_0x471600,function(_0x3ad663){if(_0x3ad663[_0x92f6('0x2c')]!==_0x92f6('0x3d')){var _0x1b3fc4={};_0x1b3fc4[_0x3ad663[_0x92f6('0x28')]]={'$like':'%'+_0x12ff26[_0x92f6('0x2f')][_0x92f6('0x3c')]+'%'};return _0x1b3fc4;}})});}_0x4ff00f=_[_0x92f6('0x3e')]({},_0x4ff00f,_0x12ff26['options']);var _0x311d2c={'where':_0x4ff00f[_0x92f6('0x3a')]};return db[_0x92f6('0x2a')]['count'](_0x311d2c)[_0x92f6('0x23')](function(_0x386d1d){_0x5b0d6b['count']=_0x386d1d;if(_0x12ff26[_0x92f6('0x2f')]['includeAll']){_0x4ff00f[_0x92f6('0x3f')]=[{'all':!![]}];}return db[_0x92f6('0x2a')][_0x92f6('0x40')](_0x4ff00f);})[_0x92f6('0x23')](function(_0x3eacb9){_0x5b0d6b[_0x92f6('0x41')]=_0x3eacb9;return _0x5b0d6b;})[_0x92f6('0x23')](respondWithFilteredResult(_0x4867d1,_0x4ff00f))[_0x92f6('0x42')](handleError(_0x4867d1,null));};exports[_0x92f6('0x43')]=function(_0x180eb5,_0x23ca46){var _0x200c75={'raw':![],'where':{'id':_0x180eb5[_0x92f6('0x44')]['id']}},_0x28d3a4={};_0x28d3a4[_0x92f6('0x2d')]=_['keys'](db[_0x92f6('0x2a')][_0x92f6('0x45')]);_0x28d3a4[_0x92f6('0x2f')]=_[_0x92f6('0x30')](_0x180eb5[_0x92f6('0x2f')]);_0x28d3a4[_0x92f6('0x31')]=_['intersection'](_0x28d3a4[_0x92f6('0x2d')],_0x28d3a4['query']);_0x200c75[_0x92f6('0x34')]=_[_0x92f6('0x32')](_0x28d3a4[_0x92f6('0x2d')],qs[_0x92f6('0x33')](_0x180eb5['query'][_0x92f6('0x33')]));_0x200c75[_0x92f6('0x34')]=_0x200c75[_0x92f6('0x34')][_0x92f6('0x35')]?_0x200c75['attributes']:_0x28d3a4[_0x92f6('0x2d')];if(_0x180eb5['query'][_0x92f6('0x46')]){_0x200c75[_0x92f6('0x3f')]=[{'all':!![]}];}_0x200c75=_[_0x92f6('0x3e')]({},_0x200c75,_0x180eb5['options']);return db[_0x92f6('0x2a')][_0x92f6('0x47')](_0x200c75)['then'](handleEntityNotFound(_0x23ca46,null))['then'](respondWithResult(_0x23ca46,null))[_0x92f6('0x42')](handleError(_0x23ca46,null));};exports[_0x92f6('0x48')]=function(_0x29974c,_0x33ffed){return db[_0x92f6('0x2a')][_0x92f6('0x48')](_0x29974c[_0x92f6('0x49')],{})[_0x92f6('0x23')](respondWithResult(_0x33ffed,0xc9))[_0x92f6('0x42')](handleError(_0x33ffed,null));};exports[_0x92f6('0x4a')]=function(_0x65283c,_0x53860a){if(_0x65283c[_0x92f6('0x49')]['id']){delete _0x65283c[_0x92f6('0x49')]['id'];}return db[_0x92f6('0x2a')][_0x92f6('0x47')]({'where':{'id':_0x65283c[_0x92f6('0x44')]['id']}})[_0x92f6('0x23')](handleEntityNotFound(_0x53860a,null))[_0x92f6('0x23')](saveUpdates(_0x65283c[_0x92f6('0x49')],null))[_0x92f6('0x23')](respondWithResult(_0x53860a,null))['catch'](handleError(_0x53860a,null));};exports['destroy']=function(_0x263217,_0x3eaf3b){return db['SugarcrmAccount']['find']({'where':{'id':_0x263217[_0x92f6('0x44')]['id']}})[_0x92f6('0x23')](handleEntityNotFound(_0x3eaf3b,null))['then'](removeEntity(_0x3eaf3b,null))['catch'](handleError(_0x3eaf3b,null));};exports[_0x92f6('0x4b')]=function(_0x26b4ad,_0x1ec43f,_0xc57fdd){var _0x1a54fe={};var _0x1509fc={};var _0x1e0b6c;var _0x3b6e12;return db[_0x92f6('0x2a')]['findOne']({'where':{'id':_0x26b4ad[_0x92f6('0x44')]['id']}})[_0x92f6('0x23')](handleEntityNotFound(_0x1ec43f,null))[_0x92f6('0x23')](function(_0x496793){if(_0x496793){_0x1e0b6c=_0x496793;_0x1509fc[_0x92f6('0x2d')]=_[_0x92f6('0x30')](db[_0x92f6('0x4c')][_0x92f6('0x45')]);_0x1509fc['query']=_[_0x92f6('0x30')](_0x26b4ad[_0x92f6('0x2f')]);_0x1509fc['filters']=_['intersection'](_0x1509fc[_0x92f6('0x2d')],_0x1509fc[_0x92f6('0x2f')]);_0x1a54fe[_0x92f6('0x34')]=_[_0x92f6('0x32')](_0x1509fc[_0x92f6('0x2d')],qs[_0x92f6('0x33')](_0x26b4ad[_0x92f6('0x2f')][_0x92f6('0x33')]));_0x1a54fe[_0x92f6('0x34')]=_0x1a54fe[_0x92f6('0x34')][_0x92f6('0x35')]?_0x1a54fe[_0x92f6('0x34')]:_0x1509fc[_0x92f6('0x2d')];_0x1a54fe[_0x92f6('0x38')]=qs[_0x92f6('0x39')](_0x26b4ad[_0x92f6('0x2f')]['sort']);_0x1a54fe[_0x92f6('0x3a')]=qs[_0x92f6('0x31')](_[_0x92f6('0x3b')](_0x26b4ad[_0x92f6('0x2f')],_0x1509fc[_0x92f6('0x31')]));if(_0x26b4ad[_0x92f6('0x2f')][_0x92f6('0x3c')]){_0x1a54fe[_0x92f6('0x3a')]=_['merge'](_0x1a54fe[_0x92f6('0x3a')],{'$or':_[_0x92f6('0x2e')](_0x1a54fe[_0x92f6('0x34')],function(_0x3ceb44){var _0xdd5295={};_0xdd5295[_0x3ceb44]={'$like':'%'+_0x26b4ad[_0x92f6('0x2f')][_0x92f6('0x3c')]+'%'};return _0xdd5295;})});}_0x1a54fe=_[_0x92f6('0x3e')]({},_0x1a54fe,_0x26b4ad[_0x92f6('0x4d')]);return _0x1e0b6c[_0x92f6('0x4b')](_0x1a54fe);}})[_0x92f6('0x23')](function(_0x236057){if(_0x236057){_0x3b6e12=_0x236057['length'];if(!_0x26b4ad[_0x92f6('0x2f')][_0x92f6('0x36')]('nolimit')){_0x1a54fe[_0x92f6('0x1d')]=qs[_0x92f6('0x1d')](_0x26b4ad[_0x92f6('0x2f')][_0x92f6('0x1d')]);_0x1a54fe[_0x92f6('0x1b')]=qs['offset'](_0x26b4ad[_0x92f6('0x2f')]['offset']);}return _0x1e0b6c[_0x92f6('0x4b')](_0x1a54fe);}})[_0x92f6('0x23')](function(_0x2d9902){if(_0x2d9902){return _0x2d9902?{'count':_0x3b6e12,'rows':_0x2d9902}:null;}})[_0x92f6('0x23')](respondWithResult(_0x1ec43f,null))[_0x92f6('0x42')](handleError(_0x1ec43f,null));};exports['addConfiguration']=function(_0x254943,_0x184895,_0x51743a){if(_0x254943[_0x92f6('0x49')]['id']){delete _0x254943[_0x92f6('0x49')]['id'];}return db[_0x92f6('0x2a')][_0x92f6('0x4e')]({'where':{'id':_0x254943[_0x92f6('0x44')]['id']}})['then'](handleEntityNotFound(_0x184895,null))[_0x92f6('0x23')](function(_0x21a885){if(_0x21a885){_0x254943[_0x92f6('0x49')][_0x92f6('0x4f')]=_0x21a885['id'];_0x254943[_0x92f6('0x49')][_0x92f6('0x50')]=integrations[_0x92f6('0x51')](_0x254943[_0x92f6('0x49')][_0x92f6('0x52')],_0x254943['body']['type']);_0x254943[_0x92f6('0x49')][_0x92f6('0x53')]=integrations['getDescriptions'](_0x254943[_0x92f6('0x49')][_0x92f6('0x52')],_0x254943['body'][_0x92f6('0x2c')]);return db[_0x92f6('0x4c')][_0x92f6('0x48')](_0x254943[_0x92f6('0x49')],{'include':[{'model':db[_0x92f6('0x54')],'as':'Subjects'},{'model':db[_0x92f6('0x54')],'as':'Descriptions'}]});}return null;})[_0x92f6('0x23')](respondWithResult(_0x184895,null))[_0x92f6('0x42')](handleError(_0x184895,null));};exports[_0x92f6('0x55')]=function(_0x51cd88,_0x77cca2,_0x48d503){var _0x38116c='';var _0x915e8b=['id',_0x92f6('0x28'),_0x92f6('0x56'),_0x92f6('0x57'),_0x92f6('0x58'),_0x92f6('0x59'),_0x92f6('0x5a'),'duration_minutes',_0x92f6('0x5b'),_0x92f6('0x5c'),_0x92f6('0x5d'),_0x92f6('0x5e')];return db[_0x92f6('0x2a')][_0x92f6('0x4e')]({'where':{'id':_0x51cd88[_0x92f6('0x44')]['id']},'attributes':['id',_0x92f6('0x5f'),_0x92f6('0x60'),'remoteUri']})['then'](handleEntityNotFound(_0x77cca2,null))[_0x92f6('0x23')](function(_0x7621ae){if(_0x7621ae){_0x38116c=_0x7621ae[_0x92f6('0x61')];var _0x51a22c=_0x38116c[_0x92f6('0x62')](-0x1);if(_0x51a22c==='/'){_0x38116c=_0x38116c[_0x92f6('0x63')](0x0,_0x38116c[_0x92f6('0x64')](_0x51a22c));}return rp({'method':_0x92f6('0x65'),'uri':util['format'](_0x92f6('0x66'),_0x38116c,_0x92f6('0x67')),'json':!![],'form':{'method':_0x92f6('0x68'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x92f6('0x69')]({'user_auth':{'user_name':_0x7621ae[_0x92f6('0x5f')],'password':_0x7621ae[_0x92f6('0x60')],'encryption':_0x92f6('0x6a')},'application':_0x92f6('0x6b')})}});}})[_0x92f6('0x23')](function(_0x383467){if(_0x383467&&_0x383467[_0x92f6('0x28')]!==_0x92f6('0x6c')&&_0x383467[_0x92f6('0x28')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x92f6('0x6d')](_0x92f6('0x66'),_0x38116c,_0x92f6('0x67')),'json':!![],'form':{'method':_0x92f6('0x6e'),'input_type':_0x92f6('0x6f'),'response_type':_0x92f6('0x6f'),'rest_data':JSON[_0x92f6('0x69')]({'session':_0x383467['id'],'module_name':_0x92f6('0x70')})}})[_0x92f6('0x23')](function(_0x52af84){if(_0x52af84){var _0x4fe52a=_['values'](_0x52af84[_0x92f6('0x71')]);_['remove'](_0x4fe52a,function(_0x30ae42){return _0x915e8b['includes'](_0x30ae42[_0x92f6('0x28')]);});return{'count':_0x4fe52a[_0x92f6('0x35')],'rows':_[_0x92f6('0x2e')](_0x4fe52a,function(_0x49c5bc){return{'id':_0x49c5bc[_0x92f6('0x28')],'name':_0x49c5bc[_0x92f6('0x72')],'custom':_['endsWith'](_0x49c5bc['name'],'_c')?!![]:![],'options':_0x49c5bc[_0x92f6('0x4d')]?_[_0x92f6('0x2e')](_[_0x92f6('0x73')](_0x49c5bc[_0x92f6('0x4d')]),function(_0x30b83f){return{'name':_0x30b83f[_0x92f6('0x74')],'value':_0x30b83f[_0x92f6('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x77cca2,null))[_0x92f6('0x42')](function(_0x15631c){var _0x531d19=_0x51cd88[_0x92f6('0x2f')][_0x92f6('0x75')]?0x1f4:_0x15631c[_0x92f6('0x76')]||0x1f4;logger[_0x92f6('0x26')]('getFields,\x20%s,\x20%s,\x20%s',_0x92f6('0x55'),_0x531d19,JSON[_0x92f6('0x69')](_0x15631c));delete _0x15631c[_0x92f6('0x28')];if(_0x531d19===0x191){_0x531d19=0x190;}_0x77cca2[_0x92f6('0x18')](_0x531d19)[_0x92f6('0x77')](_0x51cd88['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x15631c['statusCode']}:_0x15631c);});}else{var _0x4dd2ab=0x1f4;_0x77cca2[_0x92f6('0x18')](_0x4dd2ab)[_0x92f6('0x77')]({'message':_0x92f6('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x5978=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','destroy','then','error','name','send','index','SugarcrmAccount','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','params','getConfigurations','SugarcrmConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','SugarcrmField','Subjects','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','substring','POST','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','get_module_fields','module_fields','includes','endsWith','values','value','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x1485a8,_0x5bcba0){var _0x1469fe=function(_0x108e2d){while(--_0x108e2d){_0x1485a8['push'](_0x1485a8['shift']());}};_0x1469fe(++_0x5bcba0);}(_0x5978,0xdd));var _0x8597=function(_0x47b7d3,_0x2d8faa){_0x47b7d3=_0x47b7d3-0x0;var _0x433d60=_0x5978[_0x47b7d3];return _0x433d60;};'use strict';var emlformat=require(_0x8597('0x0'));var rimraf=require(_0x8597('0x1'));var zipdir=require(_0x8597('0x2'));var jsonpatch=require(_0x8597('0x3'));var rp=require(_0x8597('0x4'));var moment=require('moment');var BPromise=require(_0x8597('0x5'));var Mustache=require('mustache');var util=require(_0x8597('0x6'));var path=require(_0x8597('0x7'));var sox=require('sox');var csv=require(_0x8597('0x8'));var ejs=require(_0x8597('0x9'));var fs=require('fs');var fs_extra=require(_0x8597('0xa'));var _=require(_0x8597('0xb'));var squel=require(_0x8597('0xc'));var crypto=require('crypto');var jsforce=require(_0x8597('0xd'));var deskjs=require(_0x8597('0xe'));var toCsv=require(_0x8597('0x8'));var querystring=require(_0x8597('0xf'));var Papa=require(_0x8597('0x10'));var Redis=require(_0x8597('0x11'));var authService=require(_0x8597('0x12'));var qs=require(_0x8597('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8597('0x14'));var logger=require(_0x8597('0x15'))(_0x8597('0x16'));var utils=require(_0x8597('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8597('0x18'));var db=require(_0x8597('0x19'))['db'];var integrations=require(_0x8597('0x1a'));function respondWithStatusCode(_0x3f31d7,_0x3f2549){_0x3f2549=_0x3f2549||0xcc;return function(_0x1c476a){if(_0x1c476a){return _0x3f31d7[_0x8597('0x1b')](_0x3f2549);}return _0x3f31d7[_0x8597('0x1c')](_0x3f2549)[_0x8597('0x1d')]();};}function respondWithResult(_0x37dc18,_0x37fd69){_0x37fd69=_0x37fd69||0xc8;return function(_0x30bd5f){if(_0x30bd5f){return _0x37dc18[_0x8597('0x1c')](_0x37fd69)[_0x8597('0x1e')](_0x30bd5f);}};}function respondWithFilteredResult(_0x1a856c,_0x495cc1){return function(_0x43f558){if(_0x43f558){var _0x5cf32b=typeof _0x495cc1['offset']==='undefined'&&typeof _0x495cc1[_0x8597('0x1f')]===_0x8597('0x20');var _0x322fef=_0x43f558[_0x8597('0x21')];var _0x1af3c3=_0x5cf32b?0x0:_0x495cc1[_0x8597('0x22')];var _0x3424cb=_0x5cf32b?_0x43f558[_0x8597('0x21')]:_0x495cc1[_0x8597('0x22')]+_0x495cc1['limit'];var _0x87821c;if(_0x3424cb>=_0x322fef){_0x3424cb=_0x322fef;_0x87821c=0xc8;}else{_0x87821c=0xce;}_0x1a856c[_0x8597('0x1c')](_0x87821c);return _0x1a856c['set'](_0x8597('0x23'),_0x1af3c3+'-'+_0x3424cb+'/'+_0x322fef)[_0x8597('0x1e')](_0x43f558);}return null;};}function patchUpdates(_0x43c6fe){return function(_0xb94fac){try{jsonpatch[_0x8597('0x24')](_0xb94fac,_0x43c6fe,!![]);}catch(_0x5e0d59){return BPromise[_0x8597('0x25')](_0x5e0d59);}return _0xb94fac['save']();};}function saveUpdates(_0xbe8cb8,_0x1dce2d){return function(_0x3c8daa){if(_0x3c8daa){return _0x3c8daa[_0x8597('0x26')](_0xbe8cb8)['then'](function(_0x577143){return _0x577143;});}return null;};}function removeEntity(_0x41d6ee,_0x507c0e){return function(_0xfeea8){if(_0xfeea8){return _0xfeea8[_0x8597('0x27')]()[_0x8597('0x28')](function(){_0x41d6ee[_0x8597('0x1c')](0xcc)[_0x8597('0x1d')]();});}};}function handleEntityNotFound(_0x4fe597,_0xd3e581){return function(_0x19ef4e){if(!_0x19ef4e){_0x4fe597[_0x8597('0x1b')](0x194);}return _0x19ef4e;};}function handleError(_0x3c0459,_0x55dac8){_0x55dac8=_0x55dac8||0x1f4;return function(_0x501d5a){logger[_0x8597('0x29')](_0x501d5a['stack']);if(_0x501d5a[_0x8597('0x2a')]){delete _0x501d5a[_0x8597('0x2a')];}_0x3c0459[_0x8597('0x1c')](_0x55dac8)[_0x8597('0x2b')](_0x501d5a);};}exports[_0x8597('0x2c')]=function(_0xae28b1,_0x7ef3de){var _0x2c6905={},_0x5d0694={},_0x2ed1db={'count':0x0,'rows':[]};var _0x3b45fc=_['map'](db[_0x8597('0x2d')]['rawAttributes'],function(_0x1f06c1){return{'name':_0x1f06c1[_0x8597('0x2e')],'type':_0x1f06c1[_0x8597('0x2f')][_0x8597('0x30')]};});_0x5d0694['model']=_[_0x8597('0x31')](_0x3b45fc,_0x8597('0x2a'));_0x5d0694[_0x8597('0x32')]=_[_0x8597('0x33')](_0xae28b1[_0x8597('0x32')]);_0x5d0694['filters']=_['intersection'](_0x5d0694[_0x8597('0x34')],_0x5d0694[_0x8597('0x32')]);_0x2c6905[_0x8597('0x35')]=_[_0x8597('0x36')](_0x5d0694['model'],qs[_0x8597('0x37')](_0xae28b1[_0x8597('0x32')]['fields']));_0x2c6905[_0x8597('0x35')]=_0x2c6905[_0x8597('0x35')][_0x8597('0x38')]?_0x2c6905[_0x8597('0x35')]:_0x5d0694[_0x8597('0x34')];if(!_0xae28b1[_0x8597('0x32')][_0x8597('0x39')](_0x8597('0x3a'))){_0x2c6905[_0x8597('0x1f')]=qs['limit'](_0xae28b1[_0x8597('0x32')]['limit']);_0x2c6905[_0x8597('0x22')]=qs[_0x8597('0x22')](_0xae28b1[_0x8597('0x32')][_0x8597('0x22')]);}_0x2c6905[_0x8597('0x3b')]=qs[_0x8597('0x3c')](_0xae28b1[_0x8597('0x32')][_0x8597('0x3c')]);_0x2c6905[_0x8597('0x3d')]=qs[_0x8597('0x3e')](_[_0x8597('0x3f')](_0xae28b1['query'],_0x5d0694[_0x8597('0x3e')]),_0x3b45fc);if(_0xae28b1[_0x8597('0x32')][_0x8597('0x40')]){_0x2c6905[_0x8597('0x3d')]=_[_0x8597('0x41')](_0x2c6905[_0x8597('0x3d')],{'$or':_[_0x8597('0x31')](_0x3b45fc,function(_0x529261){if(_0x529261['type']!==_0x8597('0x42')){var _0x1343a6={};_0x1343a6[_0x529261[_0x8597('0x2a')]]={'$like':'%'+_0xae28b1['query'][_0x8597('0x40')]+'%'};return _0x1343a6;}})});}_0x2c6905=_[_0x8597('0x41')]({},_0x2c6905,_0xae28b1[_0x8597('0x43')]);var _0x359c17={'where':_0x2c6905['where']};return db[_0x8597('0x2d')][_0x8597('0x21')](_0x359c17)['then'](function(_0x32c7aa){_0x2ed1db[_0x8597('0x21')]=_0x32c7aa;if(_0xae28b1['query'][_0x8597('0x44')]){_0x2c6905[_0x8597('0x45')]=[{'all':!![]}];}return db[_0x8597('0x2d')][_0x8597('0x46')](_0x2c6905);})[_0x8597('0x28')](function(_0x1e256b){_0x2ed1db[_0x8597('0x47')]=_0x1e256b;return _0x2ed1db;})[_0x8597('0x28')](respondWithFilteredResult(_0x7ef3de,_0x2c6905))[_0x8597('0x48')](handleError(_0x7ef3de,null));};exports[_0x8597('0x49')]=function(_0x8369cf,_0x533135){var _0x4b1aa2={'raw':![],'where':{'id':_0x8369cf['params']['id']}},_0x270e9a={};_0x270e9a['model']=_[_0x8597('0x33')](db[_0x8597('0x2d')][_0x8597('0x4a')]);_0x270e9a['query']=_['keys'](_0x8369cf[_0x8597('0x32')]);_0x270e9a[_0x8597('0x3e')]=_['intersection'](_0x270e9a[_0x8597('0x34')],_0x270e9a[_0x8597('0x32')]);_0x4b1aa2[_0x8597('0x35')]=_[_0x8597('0x36')](_0x270e9a[_0x8597('0x34')],qs[_0x8597('0x37')](_0x8369cf[_0x8597('0x32')][_0x8597('0x37')]));_0x4b1aa2[_0x8597('0x35')]=_0x4b1aa2[_0x8597('0x35')][_0x8597('0x38')]?_0x4b1aa2[_0x8597('0x35')]:_0x270e9a['model'];if(_0x8369cf['query'][_0x8597('0x44')]){_0x4b1aa2[_0x8597('0x45')]=[{'all':!![]}];}_0x4b1aa2=_['merge']({},_0x4b1aa2,_0x8369cf['options']);return db[_0x8597('0x2d')][_0x8597('0x4b')](_0x4b1aa2)[_0x8597('0x28')](handleEntityNotFound(_0x533135,null))['then'](respondWithResult(_0x533135,null))[_0x8597('0x48')](handleError(_0x533135,null));};exports['create']=function(_0x41a834,_0x8de21b){return db[_0x8597('0x2d')][_0x8597('0x4c')](_0x41a834[_0x8597('0x4d')],{})[_0x8597('0x28')](respondWithResult(_0x8de21b,0xc9))[_0x8597('0x48')](handleError(_0x8de21b,null));};exports[_0x8597('0x26')]=function(_0x4456fc,_0x417ecb){if(_0x4456fc['body']['id']){delete _0x4456fc[_0x8597('0x4d')]['id'];}return db['SugarcrmAccount'][_0x8597('0x4b')]({'where':{'id':_0x4456fc[_0x8597('0x4e')]['id']}})[_0x8597('0x28')](handleEntityNotFound(_0x417ecb,null))[_0x8597('0x28')](saveUpdates(_0x4456fc[_0x8597('0x4d')],null))[_0x8597('0x28')](respondWithResult(_0x417ecb,null))[_0x8597('0x48')](handleError(_0x417ecb,null));};exports[_0x8597('0x27')]=function(_0x2fccf4,_0x4291d0){return db['SugarcrmAccount'][_0x8597('0x4b')]({'where':{'id':_0x2fccf4[_0x8597('0x4e')]['id']}})[_0x8597('0x28')](handleEntityNotFound(_0x4291d0,null))[_0x8597('0x28')](removeEntity(_0x4291d0,null))['catch'](handleError(_0x4291d0,null));};exports[_0x8597('0x4f')]=function(_0x24f4be,_0x34256a,_0x1cf97e){var _0x89cc11={};var _0x588d6f={};var _0x1bdd52;var _0x4db6e0;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x24f4be[_0x8597('0x4e')]['id']}})[_0x8597('0x28')](handleEntityNotFound(_0x34256a,null))[_0x8597('0x28')](function(_0x1b2ac7){if(_0x1b2ac7){_0x1bdd52=_0x1b2ac7;_0x588d6f[_0x8597('0x34')]=_[_0x8597('0x33')](db[_0x8597('0x50')][_0x8597('0x4a')]);_0x588d6f[_0x8597('0x32')]=_[_0x8597('0x33')](_0x24f4be[_0x8597('0x32')]);_0x588d6f[_0x8597('0x3e')]=_[_0x8597('0x36')](_0x588d6f[_0x8597('0x34')],_0x588d6f[_0x8597('0x32')]);_0x89cc11[_0x8597('0x35')]=_['intersection'](_0x588d6f[_0x8597('0x34')],qs[_0x8597('0x37')](_0x24f4be[_0x8597('0x32')][_0x8597('0x37')]));_0x89cc11['attributes']=_0x89cc11[_0x8597('0x35')][_0x8597('0x38')]?_0x89cc11[_0x8597('0x35')]:_0x588d6f[_0x8597('0x34')];_0x89cc11[_0x8597('0x3b')]=qs[_0x8597('0x3c')](_0x24f4be[_0x8597('0x32')][_0x8597('0x3c')]);_0x89cc11[_0x8597('0x3d')]=qs[_0x8597('0x3e')](_[_0x8597('0x3f')](_0x24f4be[_0x8597('0x32')],_0x588d6f['filters']));if(_0x24f4be[_0x8597('0x32')][_0x8597('0x40')]){_0x89cc11[_0x8597('0x3d')]=_[_0x8597('0x41')](_0x89cc11[_0x8597('0x3d')],{'$or':_[_0x8597('0x31')](_0x89cc11[_0x8597('0x35')],function(_0x47f2e3){var _0xad3165={};_0xad3165[_0x47f2e3]={'$like':'%'+_0x24f4be[_0x8597('0x32')][_0x8597('0x40')]+'%'};return _0xad3165;})});}_0x89cc11=_[_0x8597('0x41')]({},_0x89cc11,_0x24f4be[_0x8597('0x43')]);return _0x1bdd52[_0x8597('0x4f')](_0x89cc11);}})[_0x8597('0x28')](function(_0x47e3b8){if(_0x47e3b8){_0x4db6e0=_0x47e3b8[_0x8597('0x38')];if(!_0x24f4be[_0x8597('0x32')][_0x8597('0x39')](_0x8597('0x3a'))){_0x89cc11['limit']=qs[_0x8597('0x1f')](_0x24f4be[_0x8597('0x32')][_0x8597('0x1f')]);_0x89cc11[_0x8597('0x22')]=qs['offset'](_0x24f4be['query']['offset']);}return _0x1bdd52[_0x8597('0x4f')](_0x89cc11);}})['then'](function(_0x559f34){if(_0x559f34){return _0x559f34?{'count':_0x4db6e0,'rows':_0x559f34}:null;}})['then'](respondWithResult(_0x34256a,null))[_0x8597('0x48')](handleError(_0x34256a,null));};exports['addConfiguration']=function(_0x5dd1a5,_0x382334,_0x46030e){if(_0x5dd1a5['body']['id']){delete _0x5dd1a5[_0x8597('0x4d')]['id'];}return db[_0x8597('0x2d')][_0x8597('0x51')]({'where':{'id':_0x5dd1a5[_0x8597('0x4e')]['id']}})[_0x8597('0x28')](handleEntityNotFound(_0x382334,null))[_0x8597('0x28')](function(_0x2b3eb5){if(_0x2b3eb5){_0x5dd1a5[_0x8597('0x4d')][_0x8597('0x52')]=_0x2b3eb5['id'];_0x5dd1a5[_0x8597('0x4d')]['Subjects']=integrations[_0x8597('0x53')](_0x5dd1a5['body'][_0x8597('0x54')],_0x5dd1a5[_0x8597('0x4d')][_0x8597('0x2f')]);_0x5dd1a5[_0x8597('0x4d')][_0x8597('0x55')]=integrations['getDescriptions'](_0x5dd1a5[_0x8597('0x4d')][_0x8597('0x54')],_0x5dd1a5[_0x8597('0x4d')][_0x8597('0x2f')]);return db['SugarcrmConfiguration'][_0x8597('0x4c')](_0x5dd1a5[_0x8597('0x4d')],{'include':[{'model':db[_0x8597('0x56')],'as':_0x8597('0x57')},{'model':db[_0x8597('0x56')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x382334,null))[_0x8597('0x48')](handleError(_0x382334,null));};exports[_0x8597('0x58')]=function(_0x15b763,_0x43f97b,_0x3c9049){var _0x562c72='';var _0x5221ec=['id','name','assigned_user_id',_0x8597('0x59'),_0x8597('0x5a'),_0x8597('0x5b'),_0x8597('0x5c'),_0x8597('0x5d'),_0x8597('0x5e'),_0x8597('0x5f'),_0x8597('0x60'),_0x8597('0x61')];return db[_0x8597('0x2d')][_0x8597('0x51')]({'where':{'id':_0x15b763['params']['id']},'attributes':['id',_0x8597('0x62'),_0x8597('0x63'),_0x8597('0x64')]})[_0x8597('0x28')](handleEntityNotFound(_0x43f97b,null))['then'](function(_0x169ea3){if(_0x169ea3){_0x562c72=_0x169ea3[_0x8597('0x64')];var _0x45d01d=_0x562c72['slice'](-0x1);if(_0x45d01d==='/'){_0x562c72=_0x562c72[_0x8597('0x65')](0x0,_0x562c72['lastIndexOf'](_0x45d01d));}return rp({'method':_0x8597('0x66'),'uri':util[_0x8597('0x67')]('%s%s',_0x562c72,_0x8597('0x68')),'json':!![],'form':{'method':'login','input_type':_0x8597('0x69'),'response_type':_0x8597('0x69'),'rest_data':JSON[_0x8597('0x6a')]({'user_auth':{'user_name':_0x169ea3[_0x8597('0x62')],'password':_0x169ea3[_0x8597('0x63')],'encryption':_0x8597('0x6b')},'application':_0x8597('0x6c')})}});}})['then'](function(_0x2c7b8e){if(_0x2c7b8e&&_0x2c7b8e[_0x8597('0x2a')]!=='Invalid\x20Login'&&_0x2c7b8e[_0x8597('0x2a')]!==_0x8597('0x6d')){return rp({'method':_0x8597('0x66'),'uri':util[_0x8597('0x67')]('%s%s',_0x562c72,_0x8597('0x68')),'json':!![],'form':{'method':_0x8597('0x6e'),'input_type':_0x8597('0x69'),'response_type':'JSON','rest_data':JSON[_0x8597('0x6a')]({'session':_0x2c7b8e['id'],'module_name':'Calls'})}})[_0x8597('0x28')](function(_0xf813c0){if(_0xf813c0){var _0xdf061d=_['values'](_0xf813c0[_0x8597('0x6f')]);_['remove'](_0xdf061d,function(_0x33cb1d){return _0x5221ec[_0x8597('0x70')](_0x33cb1d[_0x8597('0x2a')]);});return{'count':_0xdf061d['length'],'rows':_[_0x8597('0x31')](_0xdf061d,function(_0x5c5388){return{'id':_0x5c5388['name'],'name':_0x5c5388['label'],'custom':_[_0x8597('0x71')](_0x5c5388[_0x8597('0x2a')],'_c')?!![]:![],'options':_0x5c5388[_0x8597('0x43')]?_['map'](_[_0x8597('0x72')](_0x5c5388['options']),function(_0x2a970e){return{'name':_0x2a970e[_0x8597('0x73')],'value':_0x2a970e['name']};}):[]};})};}})[_0x8597('0x28')](respondWithResult(_0x43f97b,null))[_0x8597('0x48')](function(_0x2cc19e){var _0x10a040=_0x15b763['query'][_0x8597('0x74')]?0x1f4:_0x2cc19e['statusCode']||0x1f4;logger[_0x8597('0x29')]('getFields,\x20%s,\x20%s,\x20%s',_0x8597('0x58'),_0x10a040,JSON[_0x8597('0x6a')](_0x2cc19e));delete _0x2cc19e[_0x8597('0x2a')];if(_0x10a040===0x191){_0x10a040=0x190;}_0x43f97b[_0x8597('0x1c')](_0x10a040)[_0x8597('0x2b')](_0x15b763[_0x8597('0x32')][_0x8597('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x2cc19e[_0x8597('0x75')]}:_0x2cc19e);});}else{var _0x55354f=0x1f4;_0x43f97b[_0x8597('0x1c')](_0x55354f)[_0x8597('0x2b')]({'message':_0x8597('0x76'),'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 65d9f35..b226d23 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 _0xd5ab=['api','moment','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','../../config/logger'];(function(_0x6c98ec,_0x5416ed){var _0x1e634d=function(_0x143ef5){while(--_0x143ef5){_0x6c98ec['push'](_0x6c98ec['shift']());}};_0x1e634d(++_0x5416ed);}(_0xd5ab,0x14e));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd5a('0x0'));var util=require('util');var logger=require(_0xbd5a('0x1'))(_0xbd5a('0x2'));var moment=require(_0xbd5a('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd5a('0x4'));var fs=require('fs');var path=require(_0xbd5a('0x5'));var rimraf=require('rimraf');var config=require(_0xbd5a('0x6'));var attributes=require(_0xbd5a('0x7'));var integrations=require(_0xbd5a('0x8'));module[_0xbd5a('0x9')]=function(_0x18fcba,_0x319241){return _0x18fcba[_0xbd5a('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xbd5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dde=['int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x503fb,_0xfcb3d5){_0x503fb=_0x503fb-0x0;var _0x3f6bf4=_0x9dde[_0x503fb];return _0x3f6bf4;};'use strict';var _=require('lodash');var util=require(_0xe9dd('0x0'));var logger=require(_0xe9dd('0x1'))(_0xe9dd('0x2'));var moment=require(_0xe9dd('0x3'));var BPromise=require(_0xe9dd('0x4'));var rp=require(_0xe9dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9dd('0x6'));var config=require('../../config/environment');var attributes=require(_0xe9dd('0x7'));var integrations=require(_0xe9dd('0x8'));module[_0xe9dd('0x9')]=function(_0x427222,_0x1b05f6){return _0x427222[_0xe9dd('0xa')](_0xe9dd('0xb'),attributes,{'tableName':_0xe9dd('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 83d1b01..d0d9404 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 _0x29b2=['client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetSugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x49cea3,_0x4d37d8){var _0x2e2b84=function(_0x32952b){while(--_0x32952b){_0x49cea3['push'](_0x49cea3['shift']());}};_0x2e2b84(++_0x4d37d8);}(_0x29b2,0x10f));var _0x229b=function(_0x11e91f,_0x2e6199){_0x11e91f=_0x11e91f-0x0;var _0x40b052=_0x29b2[_0x11e91f];return _0x40b052;};'use strict';var _=require(_0x229b('0x0'));var util=require(_0x229b('0x1'));var moment=require(_0x229b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x229b('0x3'));var db=require(_0x229b('0x4'))['db'];var utils=require(_0x229b('0x5'));var logger=require('../../config/logger')(_0x229b('0x6'));var config=require(_0x229b('0x7'));var jayson=require(_0x229b('0x8'));var client=jayson[_0x229b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55ec15,_0x243465,_0x975dd3){return new BPromise(function(_0x35df47,_0x592760){return client[_0x229b('0xa')](_0x55ec15,_0x975dd3)[_0x229b('0xb')](function(_0x52e587){logger['info'](_0x229b('0xc'),_0x243465,_0x229b('0xd'));logger[_0x229b('0xe')](_0x229b('0xf'),_0x243465,_0x229b('0xd'),JSON['stringify'](_0x52e587));if(_0x52e587[_0x229b('0x10')]){if(_0x52e587[_0x229b('0x10')][_0x229b('0x11')]===0x1f4){logger[_0x229b('0x10')](_0x229b('0xc'),_0x243465,_0x52e587[_0x229b('0x10')]['message']);return _0x592760(_0x52e587[_0x229b('0x10')][_0x229b('0x12')]);}logger[_0x229b('0x10')](_0x229b('0xc'),_0x243465,_0x52e587['error'][_0x229b('0x12')]);return _0x35df47(_0x52e587['error']['message']);}else{logger[_0x229b('0x13')](_0x229b('0xc'),_0x243465,'request\x20sent');_0x35df47(_0x52e587['result']['message']);}})[_0x229b('0x14')](function(_0x2c9e69){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x243465,_0x2c9e69);_0x592760(_0x2c9e69);});});}exports[_0x229b('0x15')]=function(_0x54b64b){var _0x2233a6=this;return new Promise(function(_0x22cda9,_0x5db8b0){return db['SugarcrmAccount'][_0x229b('0x16')]({'raw':_0x54b64b[_0x229b('0x17')]?_0x54b64b[_0x229b('0x17')][_0x229b('0x18')]===undefined?!![]:![]:!![],'where':_0x54b64b[_0x229b('0x17')]?_0x54b64b['options'][_0x229b('0x19')]||null:null,'attributes':_0x54b64b['options']?_0x54b64b[_0x229b('0x17')][_0x229b('0x1a')]||null:null,'limit':_0x54b64b[_0x229b('0x17')]?_0x54b64b[_0x229b('0x17')][_0x229b('0x1b')]||null:null,'include':_0x54b64b['options']?_0x54b64b['options'][_0x229b('0x1c')]?_[_0x229b('0x1d')](_0x54b64b[_0x229b('0x17')][_0x229b('0x1c')],function(_0x13261b){return{'model':db[_0x13261b[_0x229b('0x1e')]],'as':_0x13261b['as'],'attributes':_0x13261b['attributes'],'include':_0x13261b['include']?_[_0x229b('0x1d')](_0x13261b[_0x229b('0x1c')],function(_0x5f4759){return{'model':db[_0x5f4759[_0x229b('0x1e')]],'as':_0x5f4759['as'],'attributes':_0x5f4759[_0x229b('0x1a')],'include':_0x5f4759[_0x229b('0x1c')]?_['map'](_0x5f4759['include'],function(_0xf49b69){return{'model':db[_0xf49b69['model']],'as':_0xf49b69['as'],'attributes':_0xf49b69['attributes']};}):[]};}):[]};}):[]:[]})[_0x229b('0xb')](function(_0x4ff2c5){logger[_0x229b('0x13')]('GetSugarcrmAccount',_0x54b64b);logger[_0x229b('0xe')](_0x229b('0x15'),_0x54b64b,JSON[_0x229b('0x1f')](_0x4ff2c5));_0x22cda9(_0x4ff2c5);})[_0x229b('0x14')](function(_0x77ee30){logger[_0x229b('0x10')](_0x229b('0x15'),_0x77ee30[_0x229b('0x12')],_0x54b64b);_0x5db8b0(_0x2233a6[_0x229b('0x10')](0x1f4,_0x77ee30[_0x229b('0x12')]));});});};exports[_0x229b('0x20')]=function(_0x54fadb){var _0x50700f=this;return new Promise(function(_0x38586d,_0x32b78c){return db[_0x229b('0x21')][_0x229b('0x22')]({'raw':_0x54fadb['options']?_0x54fadb['options'][_0x229b('0x18')]===undefined?!![]:![]:!![],'where':_0x54fadb[_0x229b('0x17')]?_0x54fadb['options'][_0x229b('0x19')]||null:null,'attributes':_0x54fadb[_0x229b('0x17')]?_0x54fadb['options'][_0x229b('0x1a')]||null:null,'include':_0x54fadb[_0x229b('0x17')]?_0x54fadb['options']['include']?_[_0x229b('0x1d')](_0x54fadb['options'][_0x229b('0x1c')],function(_0x48e1a9){return{'model':db[_0x48e1a9[_0x229b('0x1e')]],'as':_0x48e1a9['as'],'attributes':_0x48e1a9['attributes'],'include':_0x48e1a9[_0x229b('0x1c')]?_['map'](_0x48e1a9[_0x229b('0x1c')],function(_0x43890f){return{'model':db[_0x43890f[_0x229b('0x1e')]],'as':_0x43890f['as'],'attributes':_0x43890f['attributes'],'include':_0x43890f['include']?_[_0x229b('0x1d')](_0x43890f['include'],function(_0x36cc50){return{'model':db[_0x36cc50[_0x229b('0x1e')]],'as':_0x36cc50['as'],'attributes':_0x36cc50[_0x229b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b9cb7){logger['info'](_0x229b('0x20'),_0x54fadb);logger['debug'](_0x229b('0x20'),_0x54fadb,JSON[_0x229b('0x1f')](_0x3b9cb7));_0x38586d(_0x3b9cb7);})[_0x229b('0x14')](function(_0x3fdcd8){logger['error']('ShowSugarcrmAccount',_0x3fdcd8[_0x229b('0x12')],_0x54fadb);_0x32b78c(_0x50700f[_0x229b('0x10')](0x1f4,_0x3fdcd8[_0x229b('0x12')]));});});}; \ No newline at end of file +var _0xfa84=['map','GetSugarcrmAccount','find','raw','ShowSugarcrmAccount','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','SugarcrmAccount','findAll','options','where','limit','include','model','attributes'];(function(_0x9042a,_0x4a6c2d){var _0x23a7a9=function(_0x514411){while(--_0x514411){_0x9042a['push'](_0x9042a['shift']());}};_0x23a7a9(++_0x4a6c2d);}(_0xfa84,0xbe));var _0x4fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa84[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4fa8('0x0'));var util=require(_0x4fa8('0x1'));var moment=require(_0x4fa8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fa8('0x3'));var db=require(_0x4fa8('0x4'))['db'];var utils=require(_0x4fa8('0x5'));var logger=require(_0x4fa8('0x6'))(_0x4fa8('0x7'));var config=require(_0x4fa8('0x8'));var jayson=require(_0x4fa8('0x9'));var client=jayson[_0x4fa8('0xa')][_0x4fa8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d34fb,_0x3e700c,_0x24c19f){return new BPromise(function(_0x111544,_0x3ac1e9){return client[_0x4fa8('0xc')](_0x2d34fb,_0x24c19f)[_0x4fa8('0xd')](function(_0x3dcaf1){logger['info'](_0x4fa8('0xe'),_0x3e700c,_0x4fa8('0xf'));logger[_0x4fa8('0x10')](_0x4fa8('0x11'),_0x3e700c,'request\x20sent',JSON[_0x4fa8('0x12')](_0x3dcaf1));if(_0x3dcaf1[_0x4fa8('0x13')]){if(_0x3dcaf1[_0x4fa8('0x13')][_0x4fa8('0x14')]===0x1f4){logger[_0x4fa8('0x13')](_0x4fa8('0xe'),_0x3e700c,_0x3dcaf1[_0x4fa8('0x13')][_0x4fa8('0x15')]);return _0x3ac1e9(_0x3dcaf1['error'][_0x4fa8('0x15')]);}logger[_0x4fa8('0x13')](_0x4fa8('0xe'),_0x3e700c,_0x3dcaf1[_0x4fa8('0x13')]['message']);return _0x111544(_0x3dcaf1[_0x4fa8('0x13')][_0x4fa8('0x15')]);}else{logger[_0x4fa8('0x16')](_0x4fa8('0xe'),_0x3e700c,_0x4fa8('0xf'));_0x111544(_0x3dcaf1['result']['message']);}})[_0x4fa8('0x17')](function(_0x408b60){logger[_0x4fa8('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x3e700c,_0x408b60);_0x3ac1e9(_0x408b60);});});}exports['GetSugarcrmAccount']=function(_0xc2c9a){var _0x55fb15=this;return new Promise(function(_0xebe50b,_0x47976c){return db[_0x4fa8('0x18')][_0x4fa8('0x19')]({'raw':_0xc2c9a[_0x4fa8('0x1a')]?_0xc2c9a[_0x4fa8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xc2c9a[_0x4fa8('0x1a')]?_0xc2c9a[_0x4fa8('0x1a')][_0x4fa8('0x1b')]||null:null,'attributes':_0xc2c9a[_0x4fa8('0x1a')]?_0xc2c9a[_0x4fa8('0x1a')]['attributes']||null:null,'limit':_0xc2c9a[_0x4fa8('0x1a')]?_0xc2c9a[_0x4fa8('0x1a')][_0x4fa8('0x1c')]||null:null,'include':_0xc2c9a['options']?_0xc2c9a[_0x4fa8('0x1a')]['include']?_['map'](_0xc2c9a[_0x4fa8('0x1a')][_0x4fa8('0x1d')],function(_0x23d53c){return{'model':db[_0x23d53c[_0x4fa8('0x1e')]],'as':_0x23d53c['as'],'attributes':_0x23d53c[_0x4fa8('0x1f')],'include':_0x23d53c[_0x4fa8('0x1d')]?_['map'](_0x23d53c['include'],function(_0x38e093){return{'model':db[_0x38e093[_0x4fa8('0x1e')]],'as':_0x38e093['as'],'attributes':_0x38e093['attributes'],'include':_0x38e093[_0x4fa8('0x1d')]?_[_0x4fa8('0x20')](_0x38e093[_0x4fa8('0x1d')],function(_0x563db2){return{'model':db[_0x563db2[_0x4fa8('0x1e')]],'as':_0x563db2['as'],'attributes':_0x563db2[_0x4fa8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4fa8('0xd')](function(_0x413b0){logger[_0x4fa8('0x16')](_0x4fa8('0x21'),_0xc2c9a);logger[_0x4fa8('0x10')](_0x4fa8('0x21'),_0xc2c9a,JSON[_0x4fa8('0x12')](_0x413b0));_0xebe50b(_0x413b0);})['catch'](function(_0x251014){logger[_0x4fa8('0x13')](_0x4fa8('0x21'),_0x251014[_0x4fa8('0x15')],_0xc2c9a);_0x47976c(_0x55fb15['error'](0x1f4,_0x251014[_0x4fa8('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x51a5b9){var _0x4e6c97=this;return new Promise(function(_0x436b72,_0x1efed8){return db['SugarcrmAccount'][_0x4fa8('0x22')]({'raw':_0x51a5b9[_0x4fa8('0x1a')]?_0x51a5b9[_0x4fa8('0x1a')][_0x4fa8('0x23')]===undefined?!![]:![]:!![],'where':_0x51a5b9['options']?_0x51a5b9[_0x4fa8('0x1a')][_0x4fa8('0x1b')]||null:null,'attributes':_0x51a5b9[_0x4fa8('0x1a')]?_0x51a5b9[_0x4fa8('0x1a')][_0x4fa8('0x1f')]||null:null,'include':_0x51a5b9[_0x4fa8('0x1a')]?_0x51a5b9[_0x4fa8('0x1a')][_0x4fa8('0x1d')]?_[_0x4fa8('0x20')](_0x51a5b9[_0x4fa8('0x1a')][_0x4fa8('0x1d')],function(_0xafff61){return{'model':db[_0xafff61[_0x4fa8('0x1e')]],'as':_0xafff61['as'],'attributes':_0xafff61[_0x4fa8('0x1f')],'include':_0xafff61[_0x4fa8('0x1d')]?_[_0x4fa8('0x20')](_0xafff61[_0x4fa8('0x1d')],function(_0x406192){return{'model':db[_0x406192[_0x4fa8('0x1e')]],'as':_0x406192['as'],'attributes':_0x406192[_0x4fa8('0x1f')],'include':_0x406192[_0x4fa8('0x1d')]?_[_0x4fa8('0x20')](_0x406192[_0x4fa8('0x1d')],function(_0x59ad6a){return{'model':db[_0x59ad6a[_0x4fa8('0x1e')]],'as':_0x59ad6a['as'],'attributes':_0x59ad6a[_0x4fa8('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4fa8('0xd')](function(_0x5a2990){logger[_0x4fa8('0x16')](_0x4fa8('0x24'),_0x51a5b9);logger[_0x4fa8('0x10')](_0x4fa8('0x24'),_0x51a5b9,JSON[_0x4fa8('0x12')](_0x5a2990));_0x436b72(_0x5a2990);})['catch'](function(_0x28ddfc){logger[_0x4fa8('0x13')]('ShowSugarcrmAccount',_0x28ddfc[_0x4fa8('0x15')],_0x51a5b9);_0x1efed8(_0x4e6c97[_0x4fa8('0x13')](0x1f4,_0x28ddfc[_0x4fa8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index df4befd..812769e 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 _0x040c=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/descriptions','post','create','put','update','delete','destroy'];(function(_0x18c937,_0x32d230){var _0xc920b3=function(_0x3f8610){while(--_0x3f8610){_0x18c937['push'](_0x18c937['shift']());}};_0xc920b3(++_0x32d230);}(_0x040c,0xf1));var _0xc040=function(_0x46a50b,_0x2faec0){_0x46a50b=_0x46a50b-0x0;var _0x297bc9=_0x040c[_0x46a50b];return _0x297bc9;};'use strict';var multer=require(_0xc040('0x0'));var util=require('util');var path=require(_0xc040('0x1'));var timeout=require(_0xc040('0x2'));var express=require(_0xc040('0x3'));var router=express[_0xc040('0x4')]();var fs_extra=require(_0xc040('0x5'));var auth=require(_0xc040('0x6'));var interaction=require(_0xc040('0x7'));var config=require(_0xc040('0x8'));var controller=require(_0xc040('0x9'));router[_0xc040('0xa')]('/',auth[_0xc040('0xb')](),controller[_0xc040('0xc')]);router[_0xc040('0xa')](_0xc040('0xd'),auth[_0xc040('0xb')](),controller[_0xc040('0xe')]);router[_0xc040('0xa')](_0xc040('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xc040('0xa')]('/:id/subjects',auth[_0xc040('0xb')](),controller['getSubjects']);router[_0xc040('0xa')](_0xc040('0x10'),auth[_0xc040('0xb')](),controller['getDescriptions']);router[_0xc040('0x11')]('/',auth[_0xc040('0xb')](),controller[_0xc040('0x12')]);router[_0xc040('0x13')](_0xc040('0xd'),auth[_0xc040('0xb')](),controller[_0xc040('0x14')]);router[_0xc040('0x15')](_0xc040('0xd'),auth['isAuthenticated'](),controller[_0xc040('0x16')]);module[_0xc040('0x17')]=router; \ No newline at end of file +var _0x8436=['isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x8436,0x7a));var _0x6843=function(_0xbd64a9,_0x31ec97){_0xbd64a9=_0xbd64a9-0x0;var _0x4dacc9=_0x8436[_0xbd64a9];return _0x4dacc9;};'use strict';var multer=require(_0x6843('0x0'));var util=require(_0x6843('0x1'));var path=require(_0x6843('0x2'));var timeout=require('connect-timeout');var express=require(_0x6843('0x3'));var router=express[_0x6843('0x4')]();var fs_extra=require(_0x6843('0x5'));var auth=require(_0x6843('0x6'));var interaction=require(_0x6843('0x7'));var config=require(_0x6843('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x6843('0x9')]('/',auth[_0x6843('0xa')](),controller['index']);router[_0x6843('0x9')](_0x6843('0xb'),auth[_0x6843('0xa')](),controller[_0x6843('0xc')]);router[_0x6843('0x9')](_0x6843('0xd'),auth[_0x6843('0xa')](),controller['getFields']);router[_0x6843('0x9')](_0x6843('0xe'),auth[_0x6843('0xa')](),controller[_0x6843('0xf')]);router[_0x6843('0x9')](_0x6843('0x10'),auth[_0x6843('0xa')](),controller['getDescriptions']);router[_0x6843('0x11')]('/',auth[_0x6843('0xa')](),controller[_0x6843('0x12')]);router[_0x6843('0x13')](_0x6843('0xb'),auth[_0x6843('0xa')](),controller[_0x6843('0x14')]);router['delete'](_0x6843('0xb'),auth['isAuthenticated'](),controller[_0x6843('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 8ade88f..0acd5b9 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 _0x5d93=['sequelize','STRING'];(function(_0x150a84,_0x5a275c){var _0x4996a5=function(_0x29a40f){while(--_0x29a40f){_0x150a84['push'](_0x150a84['shift']());}};_0x4996a5(++_0x5a275c);}(_0x5d93,0x92));var _0x35d9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5d93[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x35d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x35d9('0x1')]},'description':{'type':Sequelize[_0x35d9('0x1')]}}; \ No newline at end of file +var _0x23ca=['exports','STRING','sequelize'];(function(_0x1b1604,_0x368535){var _0x57918d=function(_0x176c51){while(--_0x176c51){_0x1b1604['push'](_0x1b1604['shift']());}};_0x57918d(++_0x368535);}(_0x23ca,0x1e2));var _0xa23c=function(_0x114e73,_0x1ccb13){_0x114e73=_0x114e73-0x0;var _0x673e28=_0x23ca[_0x114e73];return _0x673e28;};'use strict';var Sequelize=require(_0xa23c('0x0'));module[_0xa23c('0x1')]={'name':{'type':Sequelize[_0xa23c('0x2')]},'description':{'type':Sequelize[_0xa23c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f20abbf..02a1281 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 _0x5904=['filter','merge','options','includeAll','findAll','rows','show','keys','rawAttributes','include','find','catch','create','body','update','params','SugarcrmField','getFields','nolimit','getSubjects','hasOwnProperty','findOne','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','SugarcrmConfiguration','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','VIRTUAL'];(function(_0x3a37df,_0x46c381){var _0x33845c=function(_0x276b10){while(--_0x276b10){_0x3a37df['push'](_0x3a37df['shift']());}};_0x33845c(++_0x46c381);}(_0x5904,0x110));var _0x4590=function(_0x3d04af,_0x19f97e){_0x3d04af=_0x3d04af-0x0;var _0x1fe631=_0x5904[_0x3d04af];return _0x1fe631;};'use strict';var emlformat=require(_0x4590('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4590('0x1'));var jsonpatch=require(_0x4590('0x2'));var rp=require('request-promise');var moment=require(_0x4590('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4590('0x4'));var util=require(_0x4590('0x5'));var path=require('path');var sox=require(_0x4590('0x6'));var csv=require(_0x4590('0x7'));var ejs=require(_0x4590('0x8'));var fs=require('fs');var fs_extra=require(_0x4590('0x9'));var _=require(_0x4590('0xa'));var squel=require(_0x4590('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4590('0xc'));var toCsv=require(_0x4590('0x7'));var querystring=require(_0x4590('0xd'));var Papa=require(_0x4590('0xe'));var Redis=require(_0x4590('0xf'));var authService=require(_0x4590('0x10'));var qs=require(_0x4590('0x11'));var as=require(_0x4590('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4590('0x13'))('api');var utils=require(_0x4590('0x14'));var config=require(_0x4590('0x15'));var licenseUtil=require(_0x4590('0x16'));var db=require(_0x4590('0x17'))['db'];function respondWithStatusCode(_0x3626ac,_0xc568b4){_0xc568b4=_0xc568b4||0xcc;return function(_0x3729ff){if(_0x3729ff){return _0x3626ac[_0x4590('0x18')](_0xc568b4);}return _0x3626ac[_0x4590('0x19')](_0xc568b4)['end']();};}function respondWithResult(_0x26cb1d,_0x18db6c){_0x18db6c=_0x18db6c||0xc8;return function(_0x361d37){if(_0x361d37){return _0x26cb1d[_0x4590('0x19')](_0x18db6c)['json'](_0x361d37);}};}function respondWithFilteredResult(_0x13be07,_0x4aa108){return function(_0x23daba){if(_0x23daba){var _0x47ef2c=typeof _0x4aa108['offset']===_0x4590('0x1a')&&typeof _0x4aa108[_0x4590('0x1b')]===_0x4590('0x1a');var _0x111be3=_0x23daba[_0x4590('0x1c')];var _0x3398a=_0x47ef2c?0x0:_0x4aa108['offset'];var _0x539589=_0x47ef2c?_0x23daba[_0x4590('0x1c')]:_0x4aa108[_0x4590('0x1d')]+_0x4aa108[_0x4590('0x1b')];var _0x27e9b3;if(_0x539589>=_0x111be3){_0x539589=_0x111be3;_0x27e9b3=0xc8;}else{_0x27e9b3=0xce;}_0x13be07[_0x4590('0x19')](_0x27e9b3);return _0x13be07[_0x4590('0x1e')](_0x4590('0x1f'),_0x3398a+'-'+_0x539589+'/'+_0x111be3)['json'](_0x23daba);}return null;};}function patchUpdates(_0x1b0e69){return function(_0x5624cc){try{jsonpatch[_0x4590('0x20')](_0x5624cc,_0x1b0e69,!![]);}catch(_0x18b1ee){return BPromise[_0x4590('0x21')](_0x18b1ee);}return _0x5624cc[_0x4590('0x22')]();};}function saveUpdates(_0x11bd25,_0x555893){return function(_0x398ee8){if(_0x398ee8){return _0x398ee8['update'](_0x11bd25)[_0x4590('0x23')](function(_0x3e4fa0){return _0x3e4fa0;});}return null;};}function removeEntity(_0x57ea68,_0x331377){return function(_0x4f3668){if(_0x4f3668){return _0x4f3668[_0x4590('0x24')]()[_0x4590('0x23')](function(){_0x57ea68['status'](0xcc)[_0x4590('0x25')]();});}};}function handleEntityNotFound(_0x47565f,_0x344b81){return function(_0x1ce640){if(!_0x1ce640){_0x47565f[_0x4590('0x18')](0x194);}return _0x1ce640;};}function handleError(_0xa0448a,_0x11a877){_0x11a877=_0x11a877||0x1f4;return function(_0x2fcc3a){logger[_0x4590('0x26')](_0x2fcc3a[_0x4590('0x27')]);if(_0x2fcc3a['name']){delete _0x2fcc3a[_0x4590('0x28')];}_0xa0448a[_0x4590('0x19')](_0x11a877)[_0x4590('0x29')](_0x2fcc3a);};}exports[_0x4590('0x2a')]=function(_0x11a97a,_0x39038c){var _0x51de65={},_0x23f6db={},_0x57b1c0={'count':0x0,'rows':[]};var _0x41065a=_[_0x4590('0x2b')](db[_0x4590('0x2c')]['rawAttributes'],function(_0x21f3c2){return{'name':_0x21f3c2[_0x4590('0x2d')],'type':_0x21f3c2[_0x4590('0x2e')][_0x4590('0x2f')]};});_0x23f6db['model']=_[_0x4590('0x2b')](_0x41065a,_0x4590('0x28'));_0x23f6db[_0x4590('0x30')]=_['keys'](_0x11a97a[_0x4590('0x30')]);_0x23f6db[_0x4590('0x31')]=_[_0x4590('0x32')](_0x23f6db[_0x4590('0x33')],_0x23f6db[_0x4590('0x30')]);_0x51de65['attributes']=_[_0x4590('0x32')](_0x23f6db[_0x4590('0x33')],qs[_0x4590('0x34')](_0x11a97a[_0x4590('0x30')][_0x4590('0x34')]));_0x51de65[_0x4590('0x35')]=_0x51de65[_0x4590('0x35')][_0x4590('0x36')]?_0x51de65[_0x4590('0x35')]:_0x23f6db[_0x4590('0x33')];if(!_0x11a97a[_0x4590('0x30')]['hasOwnProperty']('nolimit')){_0x51de65[_0x4590('0x1b')]=qs[_0x4590('0x1b')](_0x11a97a['query'][_0x4590('0x1b')]);_0x51de65[_0x4590('0x1d')]=qs[_0x4590('0x1d')](_0x11a97a[_0x4590('0x30')][_0x4590('0x1d')]);}_0x51de65[_0x4590('0x37')]=qs[_0x4590('0x38')](_0x11a97a[_0x4590('0x30')][_0x4590('0x38')]);_0x51de65[_0x4590('0x39')]=qs['filters'](_[_0x4590('0x3a')](_0x11a97a[_0x4590('0x30')],_0x23f6db['filters']),_0x41065a);if(_0x11a97a['query']['filter']){_0x51de65[_0x4590('0x39')]=_['merge'](_0x51de65[_0x4590('0x39')],{'$or':_['map'](_0x41065a,function(_0x282708){if(_0x282708[_0x4590('0x2e')]!==_0x4590('0x3b')){var _0x5ccc2e={};_0x5ccc2e[_0x282708['name']]={'$like':'%'+_0x11a97a[_0x4590('0x30')][_0x4590('0x3c')]+'%'};return _0x5ccc2e;}})});}_0x51de65=_[_0x4590('0x3d')]({},_0x51de65,_0x11a97a[_0x4590('0x3e')]);var _0x4de3e0={'where':_0x51de65['where']};return db[_0x4590('0x2c')][_0x4590('0x1c')](_0x4de3e0)[_0x4590('0x23')](function(_0x1f30fa){_0x57b1c0[_0x4590('0x1c')]=_0x1f30fa;if(_0x11a97a['query'][_0x4590('0x3f')]){_0x51de65['include']=[{'all':!![]}];}return db[_0x4590('0x2c')][_0x4590('0x40')](_0x51de65);})[_0x4590('0x23')](function(_0x52973a){_0x57b1c0[_0x4590('0x41')]=_0x52973a;return _0x57b1c0;})['then'](respondWithFilteredResult(_0x39038c,_0x51de65))['catch'](handleError(_0x39038c,null));};exports[_0x4590('0x42')]=function(_0x3c0b02,_0x4d92c4){var _0x3fbebc={'raw':![],'where':{'id':_0x3c0b02['params']['id']}},_0xde9503={};_0xde9503['model']=_[_0x4590('0x43')](db[_0x4590('0x2c')][_0x4590('0x44')]);_0xde9503['query']=_[_0x4590('0x43')](_0x3c0b02['query']);_0xde9503[_0x4590('0x31')]=_[_0x4590('0x32')](_0xde9503['model'],_0xde9503['query']);_0x3fbebc[_0x4590('0x35')]=_[_0x4590('0x32')](_0xde9503['model'],qs[_0x4590('0x34')](_0x3c0b02['query'][_0x4590('0x34')]));_0x3fbebc[_0x4590('0x35')]=_0x3fbebc['attributes'][_0x4590('0x36')]?_0x3fbebc[_0x4590('0x35')]:_0xde9503['model'];if(_0x3c0b02[_0x4590('0x30')]['includeAll']){_0x3fbebc[_0x4590('0x45')]=[{'all':!![]}];}_0x3fbebc=_[_0x4590('0x3d')]({},_0x3fbebc,_0x3c0b02['options']);return db[_0x4590('0x2c')][_0x4590('0x46')](_0x3fbebc)[_0x4590('0x23')](handleEntityNotFound(_0x4d92c4,null))['then'](respondWithResult(_0x4d92c4,null))[_0x4590('0x47')](handleError(_0x4d92c4,null));};exports['create']=function(_0xd7bd3b,_0x30f70f){return db[_0x4590('0x2c')][_0x4590('0x48')](_0xd7bd3b[_0x4590('0x49')],{})[_0x4590('0x23')](respondWithResult(_0x30f70f,0xc9))[_0x4590('0x47')](handleError(_0x30f70f,null));};exports[_0x4590('0x4a')]=function(_0x2333d3,_0x15a433){if(_0x2333d3['body']['id']){delete _0x2333d3[_0x4590('0x49')]['id'];}return db['SugarcrmConfiguration'][_0x4590('0x46')]({'where':{'id':_0x2333d3[_0x4590('0x4b')]['id']}})['then'](handleEntityNotFound(_0x15a433,null))[_0x4590('0x23')](saveUpdates(_0x2333d3[_0x4590('0x49')],null))['then'](respondWithResult(_0x15a433,null))['catch'](handleError(_0x15a433,null));};exports[_0x4590('0x24')]=function(_0x255f6c,_0x221239){return db[_0x4590('0x2c')][_0x4590('0x46')]({'where':{'id':_0x255f6c[_0x4590('0x4b')]['id']}})[_0x4590('0x23')](handleEntityNotFound(_0x221239,null))[_0x4590('0x23')](removeEntity(_0x221239,null))[_0x4590('0x47')](handleError(_0x221239,null));};exports['getFields']=function(_0xefeb3a,_0xfc74f6,_0x5228f2){var _0x32ec69={};var _0x422db9={};var _0x7fd5da;var _0x12d56a;return db[_0x4590('0x2c')]['findOne']({'where':{'id':_0xefeb3a[_0x4590('0x4b')]['id']}})[_0x4590('0x23')](handleEntityNotFound(_0xfc74f6,null))[_0x4590('0x23')](function(_0x2e35cd){if(_0x2e35cd){_0x7fd5da=_0x2e35cd;_0x422db9[_0x4590('0x33')]=_[_0x4590('0x43')](db[_0x4590('0x4c')][_0x4590('0x44')]);_0x422db9[_0x4590('0x30')]=_[_0x4590('0x43')](_0xefeb3a[_0x4590('0x30')]);_0x422db9['filters']=_['intersection'](_0x422db9[_0x4590('0x33')],_0x422db9[_0x4590('0x30')]);_0x32ec69['attributes']=_[_0x4590('0x32')](_0x422db9[_0x4590('0x33')],qs[_0x4590('0x34')](_0xefeb3a['query'][_0x4590('0x34')]));_0x32ec69[_0x4590('0x35')]=_0x32ec69[_0x4590('0x35')]['length']?_0x32ec69[_0x4590('0x35')]:_0x422db9['model'];_0x32ec69[_0x4590('0x37')]=qs[_0x4590('0x38')](_0xefeb3a['query'][_0x4590('0x38')]);_0x32ec69['where']=qs[_0x4590('0x31')](_['pick'](_0xefeb3a[_0x4590('0x30')],_0x422db9[_0x4590('0x31')]));if(_0xefeb3a[_0x4590('0x30')]['filter']){_0x32ec69[_0x4590('0x39')]=_['merge'](_0x32ec69[_0x4590('0x39')],{'$or':_[_0x4590('0x2b')](_0x32ec69[_0x4590('0x35')],function(_0x219f20){var _0x540f69={};_0x540f69[_0x219f20]={'$like':'%'+_0xefeb3a['query'][_0x4590('0x3c')]+'%'};return _0x540f69;})});}_0x32ec69=_[_0x4590('0x3d')]({},_0x32ec69,_0xefeb3a[_0x4590('0x3e')]);return _0x7fd5da[_0x4590('0x4d')](_0x32ec69);}})['then'](function(_0x22b211){if(_0x22b211){_0x12d56a=_0x22b211[_0x4590('0x36')];if(!_0xefeb3a[_0x4590('0x30')]['hasOwnProperty'](_0x4590('0x4e'))){_0x32ec69[_0x4590('0x1b')]=qs['limit'](_0xefeb3a[_0x4590('0x30')][_0x4590('0x1b')]);_0x32ec69[_0x4590('0x1d')]=qs[_0x4590('0x1d')](_0xefeb3a[_0x4590('0x30')][_0x4590('0x1d')]);}return _0x7fd5da[_0x4590('0x4d')](_0x32ec69);}})['then'](function(_0xfdf402){if(_0xfdf402){return _0xfdf402?{'count':_0x12d56a,'rows':_0xfdf402}:null;}})[_0x4590('0x23')](respondWithResult(_0xfc74f6,null))['catch'](handleError(_0xfc74f6,null));};exports['getSubjects']=function(_0x216e5f,_0x5cf15a,_0x39d7b0){var _0x395ab5={};var _0x51ce37={};var _0x58992e;var _0x2144f6;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x216e5f[_0x4590('0x4b')]['id']}})[_0x4590('0x23')](handleEntityNotFound(_0x5cf15a,null))[_0x4590('0x23')](function(_0x2f6315){if(_0x2f6315){_0x58992e=_0x2f6315;_0x51ce37[_0x4590('0x33')]=_[_0x4590('0x43')](db[_0x4590('0x4c')][_0x4590('0x44')]);_0x51ce37[_0x4590('0x30')]=_[_0x4590('0x43')](_0x216e5f[_0x4590('0x30')]);_0x51ce37[_0x4590('0x31')]=_['intersection'](_0x51ce37['model'],_0x51ce37[_0x4590('0x30')]);_0x395ab5[_0x4590('0x35')]=_[_0x4590('0x32')](_0x51ce37[_0x4590('0x33')],qs['fields'](_0x216e5f[_0x4590('0x30')][_0x4590('0x34')]));_0x395ab5[_0x4590('0x35')]=_0x395ab5[_0x4590('0x35')][_0x4590('0x36')]?_0x395ab5['attributes']:_0x51ce37[_0x4590('0x33')];_0x395ab5[_0x4590('0x37')]=qs[_0x4590('0x38')](_0x216e5f[_0x4590('0x30')][_0x4590('0x38')]);_0x395ab5[_0x4590('0x39')]=qs[_0x4590('0x31')](_[_0x4590('0x3a')](_0x216e5f[_0x4590('0x30')],_0x51ce37[_0x4590('0x31')]));if(_0x216e5f[_0x4590('0x30')][_0x4590('0x3c')]){_0x395ab5[_0x4590('0x39')]=_[_0x4590('0x3d')](_0x395ab5[_0x4590('0x39')],{'$or':_[_0x4590('0x2b')](_0x395ab5[_0x4590('0x35')],function(_0x1687b8){var _0x17d4e3={};_0x17d4e3[_0x1687b8]={'$like':'%'+_0x216e5f['query'][_0x4590('0x3c')]+'%'};return _0x17d4e3;})});}_0x395ab5=_[_0x4590('0x3d')]({},_0x395ab5,_0x216e5f[_0x4590('0x3e')]);return _0x58992e[_0x4590('0x4f')](_0x395ab5);}})[_0x4590('0x23')](function(_0xde1bb0){if(_0xde1bb0){_0x2144f6=_0xde1bb0['length'];if(!_0x216e5f[_0x4590('0x30')][_0x4590('0x50')]('nolimit')){_0x395ab5[_0x4590('0x1b')]=qs[_0x4590('0x1b')](_0x216e5f[_0x4590('0x30')][_0x4590('0x1b')]);_0x395ab5['offset']=qs[_0x4590('0x1d')](_0x216e5f['query']['offset']);}return _0x58992e['getSubjects'](_0x395ab5);}})['then'](function(_0x427d7c){if(_0x427d7c){return _0x427d7c?{'count':_0x2144f6,'rows':_0x427d7c}:null;}})[_0x4590('0x23')](respondWithResult(_0x5cf15a,null))['catch'](handleError(_0x5cf15a,null));};exports['getDescriptions']=function(_0x1c7c4f,_0xccef1c,_0x2ec19d){var _0x24a51b={};var _0x2e26bc={};var _0x2335fb;var _0x28e8f3;return db[_0x4590('0x2c')][_0x4590('0x51')]({'where':{'id':_0x1c7c4f[_0x4590('0x4b')]['id']}})[_0x4590('0x23')](handleEntityNotFound(_0xccef1c,null))[_0x4590('0x23')](function(_0xcd010d){if(_0xcd010d){_0x2335fb=_0xcd010d;_0x2e26bc[_0x4590('0x33')]=_[_0x4590('0x43')](db[_0x4590('0x4c')][_0x4590('0x44')]);_0x2e26bc[_0x4590('0x30')]=_[_0x4590('0x43')](_0x1c7c4f[_0x4590('0x30')]);_0x2e26bc[_0x4590('0x31')]=_['intersection'](_0x2e26bc['model'],_0x2e26bc['query']);_0x24a51b[_0x4590('0x35')]=_[_0x4590('0x32')](_0x2e26bc[_0x4590('0x33')],qs['fields'](_0x1c7c4f[_0x4590('0x30')][_0x4590('0x34')]));_0x24a51b[_0x4590('0x35')]=_0x24a51b[_0x4590('0x35')][_0x4590('0x36')]?_0x24a51b[_0x4590('0x35')]:_0x2e26bc['model'];_0x24a51b[_0x4590('0x37')]=qs['sort'](_0x1c7c4f[_0x4590('0x30')]['sort']);_0x24a51b[_0x4590('0x39')]=qs[_0x4590('0x31')](_[_0x4590('0x3a')](_0x1c7c4f[_0x4590('0x30')],_0x2e26bc['filters']));if(_0x1c7c4f[_0x4590('0x30')][_0x4590('0x3c')]){_0x24a51b[_0x4590('0x39')]=_['merge'](_0x24a51b[_0x4590('0x39')],{'$or':_['map'](_0x24a51b[_0x4590('0x35')],function(_0x5a4a4e){var _0xf0e22a={};_0xf0e22a[_0x5a4a4e]={'$like':'%'+_0x1c7c4f['query'][_0x4590('0x3c')]+'%'};return _0xf0e22a;})});}_0x24a51b=_[_0x4590('0x3d')]({},_0x24a51b,_0x1c7c4f[_0x4590('0x3e')]);return _0x2335fb[_0x4590('0x52')](_0x24a51b);}})[_0x4590('0x23')](function(_0x58cd6e){if(_0x58cd6e){_0x28e8f3=_0x58cd6e[_0x4590('0x36')];if(!_0x1c7c4f[_0x4590('0x30')]['hasOwnProperty'](_0x4590('0x4e'))){_0x24a51b[_0x4590('0x1b')]=qs['limit'](_0x1c7c4f[_0x4590('0x30')][_0x4590('0x1b')]);_0x24a51b['offset']=qs[_0x4590('0x1d')](_0x1c7c4f[_0x4590('0x30')][_0x4590('0x1d')]);}return _0x2335fb[_0x4590('0x52')](_0x24a51b);}})[_0x4590('0x23')](function(_0x99a9e5){if(_0x99a9e5){return _0x99a9e5?{'count':_0x28e8f3,'rows':_0x99a9e5}:null;}})[_0x4590('0x23')](respondWithResult(_0xccef1c,null))[_0x4590('0x47')](handleError(_0xccef1c,null));}; \ No newline at end of file +var _0xdeb1=['find','catch','create','body','findOne','pick','getFields','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','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/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x1ea010,_0xb8caf4){var _0x23cab1=function(_0x1ae29e){while(--_0x1ae29e){_0x1ea010['push'](_0x1ea010['shift']());}};_0x23cab1(++_0xb8caf4);}(_0xdeb1,0x14e));var _0x1deb=function(_0x538527,_0x5465e4){_0x538527=_0x538527-0x0;var _0x28c6b0=_0xdeb1[_0x538527];return _0x28c6b0;};'use strict';var emlformat=require(_0x1deb('0x0'));var rimraf=require(_0x1deb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1deb('0x2'));var moment=require('moment');var BPromise=require(_0x1deb('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1deb('0x4'));var sox=require(_0x1deb('0x5'));var csv=require(_0x1deb('0x6'));var ejs=require(_0x1deb('0x7'));var fs=require('fs');var fs_extra=require(_0x1deb('0x8'));var _=require(_0x1deb('0x9'));var squel=require('squel');var crypto=require(_0x1deb('0xa'));var jsforce=require(_0x1deb('0xb'));var deskjs=require(_0x1deb('0xc'));var toCsv=require(_0x1deb('0x6'));var querystring=require(_0x1deb('0xd'));var Papa=require(_0x1deb('0xe'));var Redis=require(_0x1deb('0xf'));var authService=require(_0x1deb('0x10'));var qs=require(_0x1deb('0x11'));var as=require(_0x1deb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1deb('0x13'))('api');var utils=require(_0x1deb('0x14'));var config=require(_0x1deb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1deb('0x16'))['db'];function respondWithStatusCode(_0x37d522,_0xfbeed6){_0xfbeed6=_0xfbeed6||0xcc;return function(_0x18706){if(_0x18706){return _0x37d522['sendStatus'](_0xfbeed6);}return _0x37d522[_0x1deb('0x17')](_0xfbeed6)[_0x1deb('0x18')]();};}function respondWithResult(_0x385731,_0xf47232){_0xf47232=_0xf47232||0xc8;return function(_0x45fdfa){if(_0x45fdfa){return _0x385731['status'](_0xf47232)['json'](_0x45fdfa);}};}function respondWithFilteredResult(_0x2238bb,_0x5c6646){return function(_0x124b30){if(_0x124b30){var _0x3a2d53=typeof _0x5c6646[_0x1deb('0x19')]===_0x1deb('0x1a')&&typeof _0x5c6646['limit']===_0x1deb('0x1a');var _0x511871=_0x124b30[_0x1deb('0x1b')];var _0x3914b9=_0x3a2d53?0x0:_0x5c6646[_0x1deb('0x19')];var _0x2e2a41=_0x3a2d53?_0x124b30[_0x1deb('0x1b')]:_0x5c6646[_0x1deb('0x19')]+_0x5c6646[_0x1deb('0x1c')];var _0x497155;if(_0x2e2a41>=_0x511871){_0x2e2a41=_0x511871;_0x497155=0xc8;}else{_0x497155=0xce;}_0x2238bb[_0x1deb('0x17')](_0x497155);return _0x2238bb[_0x1deb('0x1d')](_0x1deb('0x1e'),_0x3914b9+'-'+_0x2e2a41+'/'+_0x511871)[_0x1deb('0x1f')](_0x124b30);}return null;};}function patchUpdates(_0x4d58a4){return function(_0x450a54){try{jsonpatch['apply'](_0x450a54,_0x4d58a4,!![]);}catch(_0x416320){return BPromise[_0x1deb('0x20')](_0x416320);}return _0x450a54[_0x1deb('0x21')]();};}function saveUpdates(_0x4e86b0,_0x28d8f8){return function(_0x991aaf){if(_0x991aaf){return _0x991aaf[_0x1deb('0x22')](_0x4e86b0)[_0x1deb('0x23')](function(_0x123634){return _0x123634;});}return null;};}function removeEntity(_0x4695c1,_0x32fb46){return function(_0x22f2af){if(_0x22f2af){return _0x22f2af[_0x1deb('0x24')]()[_0x1deb('0x23')](function(){_0x4695c1[_0x1deb('0x17')](0xcc)[_0x1deb('0x18')]();});}};}function handleEntityNotFound(_0x33cd96,_0x292d21){return function(_0x318bac){if(!_0x318bac){_0x33cd96[_0x1deb('0x25')](0x194);}return _0x318bac;};}function handleError(_0xff8fee,_0x2220fb){_0x2220fb=_0x2220fb||0x1f4;return function(_0x49f8bd){logger[_0x1deb('0x26')](_0x49f8bd[_0x1deb('0x27')]);if(_0x49f8bd[_0x1deb('0x28')]){delete _0x49f8bd[_0x1deb('0x28')];}_0xff8fee[_0x1deb('0x17')](_0x2220fb)['send'](_0x49f8bd);};}exports[_0x1deb('0x29')]=function(_0x4398d6,_0x25b712){var _0x63c97b={},_0x4a3134={},_0x136f44={'count':0x0,'rows':[]};var _0xfad91d=_[_0x1deb('0x2a')](db[_0x1deb('0x2b')][_0x1deb('0x2c')],function(_0x5f441c){return{'name':_0x5f441c[_0x1deb('0x2d')],'type':_0x5f441c['type'][_0x1deb('0x2e')]};});_0x4a3134[_0x1deb('0x2f')]=_[_0x1deb('0x2a')](_0xfad91d,_0x1deb('0x28'));_0x4a3134[_0x1deb('0x30')]=_['keys'](_0x4398d6[_0x1deb('0x30')]);_0x4a3134['filters']=_[_0x1deb('0x31')](_0x4a3134[_0x1deb('0x2f')],_0x4a3134[_0x1deb('0x30')]);_0x63c97b[_0x1deb('0x32')]=_[_0x1deb('0x31')](_0x4a3134[_0x1deb('0x2f')],qs[_0x1deb('0x33')](_0x4398d6[_0x1deb('0x30')]['fields']));_0x63c97b[_0x1deb('0x32')]=_0x63c97b['attributes'][_0x1deb('0x34')]?_0x63c97b['attributes']:_0x4a3134['model'];if(!_0x4398d6[_0x1deb('0x30')][_0x1deb('0x35')](_0x1deb('0x36'))){_0x63c97b[_0x1deb('0x1c')]=qs['limit'](_0x4398d6[_0x1deb('0x30')][_0x1deb('0x1c')]);_0x63c97b[_0x1deb('0x19')]=qs['offset'](_0x4398d6[_0x1deb('0x30')][_0x1deb('0x19')]);}_0x63c97b[_0x1deb('0x37')]=qs[_0x1deb('0x38')](_0x4398d6[_0x1deb('0x30')]['sort']);_0x63c97b[_0x1deb('0x39')]=qs[_0x1deb('0x3a')](_['pick'](_0x4398d6['query'],_0x4a3134['filters']),_0xfad91d);if(_0x4398d6['query']['filter']){_0x63c97b[_0x1deb('0x39')]=_[_0x1deb('0x3b')](_0x63c97b['where'],{'$or':_[_0x1deb('0x2a')](_0xfad91d,function(_0x4fb4a5){if(_0x4fb4a5[_0x1deb('0x3c')]!==_0x1deb('0x3d')){var _0x48bbe2={};_0x48bbe2[_0x4fb4a5[_0x1deb('0x28')]]={'$like':'%'+_0x4398d6[_0x1deb('0x30')][_0x1deb('0x3e')]+'%'};return _0x48bbe2;}})});}_0x63c97b=_['merge']({},_0x63c97b,_0x4398d6[_0x1deb('0x3f')]);var _0x26b643={'where':_0x63c97b[_0x1deb('0x39')]};return db[_0x1deb('0x2b')]['count'](_0x26b643)[_0x1deb('0x23')](function(_0x4595bb){_0x136f44[_0x1deb('0x1b')]=_0x4595bb;if(_0x4398d6[_0x1deb('0x30')][_0x1deb('0x40')]){_0x63c97b[_0x1deb('0x41')]=[{'all':!![]}];}return db[_0x1deb('0x2b')][_0x1deb('0x42')](_0x63c97b);})[_0x1deb('0x23')](function(_0xeec48f){_0x136f44[_0x1deb('0x43')]=_0xeec48f;return _0x136f44;})[_0x1deb('0x23')](respondWithFilteredResult(_0x25b712,_0x63c97b))['catch'](handleError(_0x25b712,null));};exports[_0x1deb('0x44')]=function(_0x27e1bb,_0xcec3bf){var _0x138265={'raw':![],'where':{'id':_0x27e1bb[_0x1deb('0x45')]['id']}},_0x24d100={};_0x24d100[_0x1deb('0x2f')]=_[_0x1deb('0x46')](db['SugarcrmConfiguration'][_0x1deb('0x2c')]);_0x24d100[_0x1deb('0x30')]=_['keys'](_0x27e1bb[_0x1deb('0x30')]);_0x24d100[_0x1deb('0x3a')]=_[_0x1deb('0x31')](_0x24d100[_0x1deb('0x2f')],_0x24d100['query']);_0x138265['attributes']=_[_0x1deb('0x31')](_0x24d100[_0x1deb('0x2f')],qs[_0x1deb('0x33')](_0x27e1bb[_0x1deb('0x30')][_0x1deb('0x33')]));_0x138265['attributes']=_0x138265[_0x1deb('0x32')]['length']?_0x138265['attributes']:_0x24d100[_0x1deb('0x2f')];if(_0x27e1bb['query']['includeAll']){_0x138265[_0x1deb('0x41')]=[{'all':!![]}];}_0x138265=_[_0x1deb('0x3b')]({},_0x138265,_0x27e1bb[_0x1deb('0x3f')]);return db[_0x1deb('0x2b')][_0x1deb('0x47')](_0x138265)['then'](handleEntityNotFound(_0xcec3bf,null))['then'](respondWithResult(_0xcec3bf,null))[_0x1deb('0x48')](handleError(_0xcec3bf,null));};exports[_0x1deb('0x49')]=function(_0x1fa46b,_0x2a4c4e){return db[_0x1deb('0x2b')][_0x1deb('0x49')](_0x1fa46b[_0x1deb('0x4a')],{})[_0x1deb('0x23')](respondWithResult(_0x2a4c4e,0xc9))['catch'](handleError(_0x2a4c4e,null));};exports[_0x1deb('0x22')]=function(_0x7f3411,_0x173c98){if(_0x7f3411[_0x1deb('0x4a')]['id']){delete _0x7f3411[_0x1deb('0x4a')]['id'];}return db['SugarcrmConfiguration'][_0x1deb('0x47')]({'where':{'id':_0x7f3411[_0x1deb('0x45')]['id']}})[_0x1deb('0x23')](handleEntityNotFound(_0x173c98,null))[_0x1deb('0x23')](saveUpdates(_0x7f3411[_0x1deb('0x4a')],null))[_0x1deb('0x23')](respondWithResult(_0x173c98,null))[_0x1deb('0x48')](handleError(_0x173c98,null));};exports['destroy']=function(_0x4c739a,_0x53e3d6){return db[_0x1deb('0x2b')][_0x1deb('0x47')]({'where':{'id':_0x4c739a[_0x1deb('0x45')]['id']}})['then'](handleEntityNotFound(_0x53e3d6,null))[_0x1deb('0x23')](removeEntity(_0x53e3d6,null))[_0x1deb('0x48')](handleError(_0x53e3d6,null));};exports['getFields']=function(_0xf6a500,_0x1edfae,_0x4cd2cb){var _0x5456c8={};var _0x259843={};var _0x10ed48;var _0x19e4de;return db[_0x1deb('0x2b')][_0x1deb('0x4b')]({'where':{'id':_0xf6a500['params']['id']}})[_0x1deb('0x23')](handleEntityNotFound(_0x1edfae,null))[_0x1deb('0x23')](function(_0x385d72){if(_0x385d72){_0x10ed48=_0x385d72;_0x259843[_0x1deb('0x2f')]=_['keys'](db['SugarcrmField'][_0x1deb('0x2c')]);_0x259843[_0x1deb('0x30')]=_[_0x1deb('0x46')](_0xf6a500[_0x1deb('0x30')]);_0x259843[_0x1deb('0x3a')]=_[_0x1deb('0x31')](_0x259843['model'],_0x259843[_0x1deb('0x30')]);_0x5456c8[_0x1deb('0x32')]=_[_0x1deb('0x31')](_0x259843[_0x1deb('0x2f')],qs[_0x1deb('0x33')](_0xf6a500[_0x1deb('0x30')][_0x1deb('0x33')]));_0x5456c8[_0x1deb('0x32')]=_0x5456c8[_0x1deb('0x32')][_0x1deb('0x34')]?_0x5456c8[_0x1deb('0x32')]:_0x259843[_0x1deb('0x2f')];_0x5456c8[_0x1deb('0x37')]=qs[_0x1deb('0x38')](_0xf6a500[_0x1deb('0x30')][_0x1deb('0x38')]);_0x5456c8[_0x1deb('0x39')]=qs[_0x1deb('0x3a')](_[_0x1deb('0x4c')](_0xf6a500['query'],_0x259843[_0x1deb('0x3a')]));if(_0xf6a500['query'][_0x1deb('0x3e')]){_0x5456c8[_0x1deb('0x39')]=_[_0x1deb('0x3b')](_0x5456c8[_0x1deb('0x39')],{'$or':_[_0x1deb('0x2a')](_0x5456c8[_0x1deb('0x32')],function(_0x2b99a0){var _0x18fb94={};_0x18fb94[_0x2b99a0]={'$like':'%'+_0xf6a500['query'][_0x1deb('0x3e')]+'%'};return _0x18fb94;})});}_0x5456c8=_[_0x1deb('0x3b')]({},_0x5456c8,_0xf6a500['options']);return _0x10ed48[_0x1deb('0x4d')](_0x5456c8);}})['then'](function(_0x5f5c9f){if(_0x5f5c9f){_0x19e4de=_0x5f5c9f[_0x1deb('0x34')];if(!_0xf6a500[_0x1deb('0x30')][_0x1deb('0x35')](_0x1deb('0x36'))){_0x5456c8[_0x1deb('0x1c')]=qs[_0x1deb('0x1c')](_0xf6a500[_0x1deb('0x30')][_0x1deb('0x1c')]);_0x5456c8['offset']=qs[_0x1deb('0x19')](_0xf6a500[_0x1deb('0x30')]['offset']);}return _0x10ed48[_0x1deb('0x4d')](_0x5456c8);}})[_0x1deb('0x23')](function(_0x557dca){if(_0x557dca){return _0x557dca?{'count':_0x19e4de,'rows':_0x557dca}:null;}})['then'](respondWithResult(_0x1edfae,null))[_0x1deb('0x48')](handleError(_0x1edfae,null));};exports['getSubjects']=function(_0x469e6c,_0x443523,_0x2fd8f6){var _0x452dae={};var _0x357460={};var _0x44e226;var _0x1f264a;return db[_0x1deb('0x2b')]['findOne']({'where':{'id':_0x469e6c[_0x1deb('0x45')]['id']}})['then'](handleEntityNotFound(_0x443523,null))[_0x1deb('0x23')](function(_0x3a4507){if(_0x3a4507){_0x44e226=_0x3a4507;_0x357460[_0x1deb('0x2f')]=_[_0x1deb('0x46')](db[_0x1deb('0x4e')]['rawAttributes']);_0x357460['query']=_[_0x1deb('0x46')](_0x469e6c['query']);_0x357460['filters']=_[_0x1deb('0x31')](_0x357460['model'],_0x357460[_0x1deb('0x30')]);_0x452dae[_0x1deb('0x32')]=_['intersection'](_0x357460[_0x1deb('0x2f')],qs['fields'](_0x469e6c[_0x1deb('0x30')]['fields']));_0x452dae[_0x1deb('0x32')]=_0x452dae[_0x1deb('0x32')][_0x1deb('0x34')]?_0x452dae[_0x1deb('0x32')]:_0x357460[_0x1deb('0x2f')];_0x452dae[_0x1deb('0x37')]=qs[_0x1deb('0x38')](_0x469e6c[_0x1deb('0x30')][_0x1deb('0x38')]);_0x452dae['where']=qs[_0x1deb('0x3a')](_[_0x1deb('0x4c')](_0x469e6c['query'],_0x357460[_0x1deb('0x3a')]));if(_0x469e6c['query'][_0x1deb('0x3e')]){_0x452dae[_0x1deb('0x39')]=_['merge'](_0x452dae[_0x1deb('0x39')],{'$or':_[_0x1deb('0x2a')](_0x452dae[_0x1deb('0x32')],function(_0x3614e4){var _0x5482b5={};_0x5482b5[_0x3614e4]={'$like':'%'+_0x469e6c[_0x1deb('0x30')][_0x1deb('0x3e')]+'%'};return _0x5482b5;})});}_0x452dae=_[_0x1deb('0x3b')]({},_0x452dae,_0x469e6c[_0x1deb('0x3f')]);return _0x44e226['getSubjects'](_0x452dae);}})[_0x1deb('0x23')](function(_0x10aba6){if(_0x10aba6){_0x1f264a=_0x10aba6[_0x1deb('0x34')];if(!_0x469e6c['query'][_0x1deb('0x35')](_0x1deb('0x36'))){_0x452dae[_0x1deb('0x1c')]=qs[_0x1deb('0x1c')](_0x469e6c[_0x1deb('0x30')][_0x1deb('0x1c')]);_0x452dae[_0x1deb('0x19')]=qs[_0x1deb('0x19')](_0x469e6c[_0x1deb('0x30')][_0x1deb('0x19')]);}return _0x44e226[_0x1deb('0x4f')](_0x452dae);}})[_0x1deb('0x23')](function(_0x3c4c27){if(_0x3c4c27){return _0x3c4c27?{'count':_0x1f264a,'rows':_0x3c4c27}:null;}})[_0x1deb('0x23')](respondWithResult(_0x443523,null))[_0x1deb('0x48')](handleError(_0x443523,null));};exports[_0x1deb('0x50')]=function(_0x2534f9,_0x100eb2,_0x4db6ba){var _0x4a976={};var _0x119318={};var _0x369560;var _0x31c929;return db[_0x1deb('0x2b')]['findOne']({'where':{'id':_0x2534f9[_0x1deb('0x45')]['id']}})[_0x1deb('0x23')](handleEntityNotFound(_0x100eb2,null))[_0x1deb('0x23')](function(_0x1316d5){if(_0x1316d5){_0x369560=_0x1316d5;_0x119318[_0x1deb('0x2f')]=_[_0x1deb('0x46')](db[_0x1deb('0x4e')][_0x1deb('0x2c')]);_0x119318[_0x1deb('0x30')]=_[_0x1deb('0x46')](_0x2534f9[_0x1deb('0x30')]);_0x119318[_0x1deb('0x3a')]=_['intersection'](_0x119318[_0x1deb('0x2f')],_0x119318[_0x1deb('0x30')]);_0x4a976[_0x1deb('0x32')]=_[_0x1deb('0x31')](_0x119318[_0x1deb('0x2f')],qs[_0x1deb('0x33')](_0x2534f9[_0x1deb('0x30')][_0x1deb('0x33')]));_0x4a976[_0x1deb('0x32')]=_0x4a976['attributes'][_0x1deb('0x34')]?_0x4a976[_0x1deb('0x32')]:_0x119318[_0x1deb('0x2f')];_0x4a976[_0x1deb('0x37')]=qs[_0x1deb('0x38')](_0x2534f9[_0x1deb('0x30')]['sort']);_0x4a976[_0x1deb('0x39')]=qs['filters'](_[_0x1deb('0x4c')](_0x2534f9['query'],_0x119318[_0x1deb('0x3a')]));if(_0x2534f9['query'][_0x1deb('0x3e')]){_0x4a976[_0x1deb('0x39')]=_[_0x1deb('0x3b')](_0x4a976[_0x1deb('0x39')],{'$or':_['map'](_0x4a976[_0x1deb('0x32')],function(_0x3f6964){var _0x254686={};_0x254686[_0x3f6964]={'$like':'%'+_0x2534f9[_0x1deb('0x30')][_0x1deb('0x3e')]+'%'};return _0x254686;})});}_0x4a976=_['merge']({},_0x4a976,_0x2534f9[_0x1deb('0x3f')]);return _0x369560[_0x1deb('0x50')](_0x4a976);}})['then'](function(_0x101245){if(_0x101245){_0x31c929=_0x101245[_0x1deb('0x34')];if(!_0x2534f9[_0x1deb('0x30')][_0x1deb('0x35')]('nolimit')){_0x4a976[_0x1deb('0x1c')]=qs[_0x1deb('0x1c')](_0x2534f9['query'][_0x1deb('0x1c')]);_0x4a976['offset']=qs[_0x1deb('0x19')](_0x2534f9['query']['offset']);}return _0x369560[_0x1deb('0x50')](_0x4a976);}})[_0x1deb('0x23')](function(_0x4dbcf9){if(_0x4dbcf9){return _0x4dbcf9?{'count':_0x31c929,'rows':_0x4dbcf9}:null;}})['then'](respondWithResult(_0x100eb2,null))[_0x1deb('0x48')](handleError(_0x100eb2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 551dcc0..e8c49de 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 _0x840a=['lodash','../../config/logger','moment','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x3f035b,_0x2bc133){var _0x4ac9d2=function(_0x270ecf){while(--_0x270ecf){_0x3f035b['push'](_0x3f035b['shift']());}};_0x4ac9d2(++_0x2bc133);}(_0x840a,0x1ad));var _0xa840=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x840a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa840('0x0'));var util=require('util');var logger=require(_0xa840('0x1'))('api');var moment=require(_0xa840('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa840('0x3'));var rimraf=require(_0xa840('0x4'));var config=require(_0xa840('0x5'));var attributes=require(_0xa840('0x6'));module[_0xa840('0x7')]=function(_0x292a06,_0x34b90d){return _0x292a06[_0xa840('0x8')](_0xa840('0x9'),attributes,{'tableName':_0xa840('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6409=['path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59b4b2,_0x3dcd17){var _0x35a915=function(_0x92c88d){while(--_0x92c88d){_0x59b4b2['push'](_0x59b4b2['shift']());}};_0x35a915(++_0x3dcd17);}(_0x6409,0x1c0));var _0x9640=function(_0x29f014,_0x4873a1){_0x29f014=_0x29f014-0x0;var _0x2b6e21=_0x6409[_0x29f014];return _0x2b6e21;};'use strict';var _=require(_0x9640('0x0'));var util=require(_0x9640('0x1'));var logger=require(_0x9640('0x2'))(_0x9640('0x3'));var moment=require(_0x9640('0x4'));var BPromise=require(_0x9640('0x5'));var rp=require(_0x9640('0x6'));var fs=require('fs');var path=require(_0x9640('0x7'));var rimraf=require(_0x9640('0x8'));var config=require(_0x9640('0x9'));var attributes=require(_0x9640('0xa'));module[_0x9640('0xb')]=function(_0x5528ce,_0x71ebe2){return _0x5528ce['define'](_0x9640('0xc'),attributes,{'tableName':'int_sugarcrm_configurations','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 84ed06a..a4a27b7 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 _0xbad2=['util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SugarcrmConfiguration,\x20%s,\x20%s','info','request\x20sent','catch'];(function(_0x36bfe3,_0x358938){var _0x9b0436=function(_0x86e47d){while(--_0x86e47d){_0x36bfe3['push'](_0x36bfe3['shift']());}};_0x9b0436(++_0x358938);}(_0xbad2,0x18c));var _0x2bad=function(_0x404102,_0x43e4a9){_0x404102=_0x404102-0x0;var _0x3b532c=_0xbad2[_0x404102];return _0x3b532c;};'use strict';var _=require('lodash');var util=require(_0x2bad('0x0'));var moment=require(_0x2bad('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2bad('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2bad('0x3'));var logger=require(_0x2bad('0x4'))(_0x2bad('0x5'));var config=require('../../config/environment');var jayson=require(_0x2bad('0x6'));var client=jayson['client'][_0x2bad('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e8933,_0x12780c,_0xdde97){return new BPromise(function(_0x3a0ffe,_0x7d6682){return client[_0x2bad('0x8')](_0x4e8933,_0xdde97)['then'](function(_0x537c6a){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x12780c,'request\x20sent');logger['debug'](_0x2bad('0x9'),_0x12780c,'request\x20sent',JSON[_0x2bad('0xa')](_0x537c6a));if(_0x537c6a[_0x2bad('0xb')]){if(_0x537c6a[_0x2bad('0xb')][_0x2bad('0xc')]===0x1f4){logger[_0x2bad('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x12780c,_0x537c6a['error'][_0x2bad('0xd')]);return _0x7d6682(_0x537c6a['error']['message']);}logger[_0x2bad('0xb')](_0x2bad('0xe'),_0x12780c,_0x537c6a[_0x2bad('0xb')]['message']);return _0x3a0ffe(_0x537c6a[_0x2bad('0xb')][_0x2bad('0xd')]);}else{logger[_0x2bad('0xf')](_0x2bad('0xe'),_0x12780c,_0x2bad('0x10'));_0x3a0ffe(_0x537c6a['result']['message']);}})[_0x2bad('0x11')](function(_0x18195e){logger[_0x2bad('0xb')](_0x2bad('0xe'),_0x12780c,_0x18195e);_0x7d6682(_0x18195e);});});} \ No newline at end of file +var _0xa289=['error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xa289,0x1a6));var _0x9a28=function(_0x2421eb,_0x39a522){_0x2421eb=_0x2421eb-0x0;var _0x500ac3=_0xa289[_0x2421eb];return _0x500ac3;};'use strict';var _=require(_0x9a28('0x0'));var util=require('util');var moment=require(_0x9a28('0x1'));var BPromise=require(_0x9a28('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a28('0x3'));var db=require(_0x9a28('0x4'))['db'];var utils=require(_0x9a28('0x5'));var logger=require(_0x9a28('0x6'))('rpc');var config=require(_0x9a28('0x7'));var jayson=require(_0x9a28('0x8'));var client=jayson[_0x9a28('0x9')][_0x9a28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4449a8,_0x491415,_0x4470e9){return new BPromise(function(_0x490e9e,_0x4be8ce){return client[_0x9a28('0xb')](_0x4449a8,_0x4470e9)[_0x9a28('0xc')](function(_0x24d7b1){logger[_0x9a28('0xd')](_0x9a28('0xe'),_0x491415,'request\x20sent');logger[_0x9a28('0xf')](_0x9a28('0x10'),_0x491415,'request\x20sent',JSON[_0x9a28('0x11')](_0x24d7b1));if(_0x24d7b1[_0x9a28('0x12')]){if(_0x24d7b1[_0x9a28('0x12')][_0x9a28('0x13')]===0x1f4){logger[_0x9a28('0x12')](_0x9a28('0xe'),_0x491415,_0x24d7b1['error'][_0x9a28('0x14')]);return _0x4be8ce(_0x24d7b1[_0x9a28('0x12')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x491415,_0x24d7b1[_0x9a28('0x12')][_0x9a28('0x14')]);return _0x490e9e(_0x24d7b1['error'][_0x9a28('0x14')]);}else{logger[_0x9a28('0xd')](_0x9a28('0xe'),_0x491415,'request\x20sent');_0x490e9e(_0x24d7b1['result'][_0x9a28('0x14')]);}})[_0x9a28('0x15')](function(_0x305e0d){logger['error'](_0x9a28('0xe'),_0x491415,_0x305e0d);_0x4be8ce(_0x305e0d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 208cda3..3c0caed 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 _0xabc2=['index','/:id','isAuthenticated','post','create','put','delete','destroy','multer','util','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x1d4218,_0x44a613){var _0x5a4378=function(_0x57b56f){while(--_0x57b56f){_0x1d4218['push'](_0x1d4218['shift']());}};_0x5a4378(++_0x44a613);}(_0xabc2,0x198));var _0x2abc=function(_0x4c6bfd,_0x20f5af){_0x4c6bfd=_0x4c6bfd-0x0;var _0x39c9bb=_0xabc2[_0x4c6bfd];return _0x39c9bb;};'use strict';var multer=require(_0x2abc('0x0'));var util=require(_0x2abc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2abc('0x2'));var router=express[_0x2abc('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2abc('0x4'));var config=require(_0x2abc('0x5'));var controller=require(_0x2abc('0x6'));router[_0x2abc('0x7')]('/',auth['isAuthenticated'](),controller[_0x2abc('0x8')]);router[_0x2abc('0x7')](_0x2abc('0x9'),auth[_0x2abc('0xa')](),controller['show']);router[_0x2abc('0xb')]('/',auth[_0x2abc('0xa')](),controller[_0x2abc('0xc')]);router[_0x2abc('0xd')](_0x2abc('0x9'),auth[_0x2abc('0xa')](),controller['update']);router[_0x2abc('0xe')](_0x2abc('0x9'),auth[_0x2abc('0xa')](),controller[_0x2abc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x6d50=['get','isAuthenticated','index','/:id','show','post','create','put','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intSugarcrmField.controller'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x6d50,0x91));var _0x06d5=function(_0x5256a9,_0x28e861){_0x5256a9=_0x5256a9-0x0;var _0xe74ed1=_0x6d50[_0x5256a9];return _0xe74ed1;};'use strict';var multer=require(_0x06d5('0x0'));var util=require(_0x06d5('0x1'));var path=require(_0x06d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x06d5('0x3'));var router=express[_0x06d5('0x4')]();var fs_extra=require(_0x06d5('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x06d5('0x6'));var controller=require(_0x06d5('0x7'));router[_0x06d5('0x8')]('/',auth[_0x06d5('0x9')](),controller[_0x06d5('0xa')]);router[_0x06d5('0x8')](_0x06d5('0xb'),auth[_0x06d5('0x9')](),controller[_0x06d5('0xc')]);router[_0x06d5('0xd')]('/',auth[_0x06d5('0x9')](),controller[_0x06d5('0xe')]);router[_0x06d5('0xf')](_0x06d5('0xb'),auth[_0x06d5('0x9')](),controller['update']);router['delete'](_0x06d5('0xb'),auth[_0x06d5('0x9')](),controller['destroy']);module[_0x06d5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4e59c98..9c91428 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 _0x17fe=['STRING','BOOLEAN','exports','ENUM','string','variable','picklist','customVariable'];(function(_0x4cb095,_0x58da07){var _0x2b565d=function(_0x4d41b3){while(--_0x4d41b3){_0x4cb095['push'](_0x4cb095['shift']());}};_0x2b565d(++_0x58da07);}(_0x17fe,0x12a));var _0xe17f=function(_0x2d7e3b,_0x5ba8df){_0x2d7e3b=_0x2d7e3b-0x0;var _0x1caa82=_0x17fe[_0x2d7e3b];return _0x1caa82;};'use strict';var Sequelize=require('sequelize');module[_0xe17f('0x0')]={'type':{'type':Sequelize[_0xe17f('0x1')](_0xe17f('0x2'),_0xe17f('0x3'),'customVariable','keyValue',_0xe17f('0x4')),'defaultValue':_0xe17f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xe17f('0x2'),_0xe17f('0x3'),_0xe17f('0x5'))},'keyContent':{'type':Sequelize[_0xe17f('0x6')]},'idField':{'type':Sequelize[_0xe17f('0x6')]},'nameField':{'type':Sequelize[_0xe17f('0x6')]},'customField':{'type':Sequelize[_0xe17f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe17f('0x6')]}}; \ No newline at end of file +var _0x91a8=['string','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x48391a,_0x3e5711){var _0x5e7240=function(_0xe0ba20){while(--_0xe0ba20){_0x48391a['push'](_0x48391a['shift']());}};_0x5e7240(++_0x3e5711);}(_0x91a8,0x74));var _0x891a=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0x91a8[_0x125ff8];return _0x2d9ef;};'use strict';var Sequelize=require(_0x891a('0x0'));module[_0x891a('0x1')]={'type':{'type':Sequelize[_0x891a('0x2')](_0x891a('0x3'),'variable','customVariable',_0x891a('0x4'),'picklist'),'defaultValue':_0x891a('0x3')},'content':{'type':Sequelize[_0x891a('0x5')]},'key':{'type':Sequelize[_0x891a('0x5')]},'keyType':{'type':Sequelize[_0x891a('0x2')](_0x891a('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x891a('0x5')]},'idField':{'type':Sequelize[_0x891a('0x5')]},'nameField':{'type':Sequelize[_0x891a('0x5')]},'customField':{'type':Sequelize[_0x891a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x891a('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 49e6d4e..c7fc318 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 _0x56f6=['where','merge','VIRTUAL','name','options','include','findAll','catch','show','params','includeAll','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','error','stack','map','SugarcrmField','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','pick','filters','filter'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x56f6,0xe7));var _0x656f=function(_0x10fa59,_0x3b353f){_0x10fa59=_0x10fa59-0x0;var _0x42d552=_0x56f6[_0x10fa59];return _0x42d552;};'use strict';var emlformat=require(_0x656f('0x0'));var rimraf=require(_0x656f('0x1'));var zipdir=require(_0x656f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x656f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x656f('0x4'));var path=require(_0x656f('0x5'));var sox=require(_0x656f('0x6'));var csv=require(_0x656f('0x7'));var ejs=require(_0x656f('0x8'));var fs=require('fs');var fs_extra=require(_0x656f('0x9'));var _=require(_0x656f('0xa'));var squel=require(_0x656f('0xb'));var crypto=require(_0x656f('0xc'));var jsforce=require(_0x656f('0xd'));var deskjs=require(_0x656f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x656f('0xf'));var Papa=require('papaparse');var Redis=require(_0x656f('0x10'));var authService=require(_0x656f('0x11'));var qs=require(_0x656f('0x12'));var as=require(_0x656f('0x13'));var hardwareService=require(_0x656f('0x14'));var logger=require('../../config/logger')(_0x656f('0x15'));var utils=require(_0x656f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x656f('0x17'));var db=require(_0x656f('0x18'))['db'];function respondWithStatusCode(_0x118809,_0x29bb09){_0x29bb09=_0x29bb09||0xcc;return function(_0x59f3c7){if(_0x59f3c7){return _0x118809['sendStatus'](_0x29bb09);}return _0x118809[_0x656f('0x19')](_0x29bb09)['end']();};}function respondWithResult(_0x5b0d80,_0xf25368){_0xf25368=_0xf25368||0xc8;return function(_0x555e5c){if(_0x555e5c){return _0x5b0d80[_0x656f('0x19')](_0xf25368)[_0x656f('0x1a')](_0x555e5c);}};}function respondWithFilteredResult(_0x5ee4f7,_0x1f9f4b){return function(_0x664335){if(_0x664335){var _0x2ee1b8=typeof _0x1f9f4b[_0x656f('0x1b')]==='undefined'&&typeof _0x1f9f4b['limit']===_0x656f('0x1c');var _0x8a767e=_0x664335[_0x656f('0x1d')];var _0x4a5dde=_0x2ee1b8?0x0:_0x1f9f4b[_0x656f('0x1b')];var _0x160913=_0x2ee1b8?_0x664335['count']:_0x1f9f4b['offset']+_0x1f9f4b[_0x656f('0x1e')];var _0x3579b5;if(_0x160913>=_0x8a767e){_0x160913=_0x8a767e;_0x3579b5=0xc8;}else{_0x3579b5=0xce;}_0x5ee4f7[_0x656f('0x19')](_0x3579b5);return _0x5ee4f7[_0x656f('0x1f')]('Content-Range',_0x4a5dde+'-'+_0x160913+'/'+_0x8a767e)[_0x656f('0x1a')](_0x664335);}return null;};}function patchUpdates(_0xfabe4){return function(_0x4a79de){try{jsonpatch[_0x656f('0x20')](_0x4a79de,_0xfabe4,!![]);}catch(_0x1432d6){return BPromise[_0x656f('0x21')](_0x1432d6);}return _0x4a79de[_0x656f('0x22')]();};}function saveUpdates(_0x28a929,_0xef66ae){return function(_0x247170){if(_0x247170){return _0x247170[_0x656f('0x23')](_0x28a929)['then'](function(_0x4fb9e8){return _0x4fb9e8;});}return null;};}function removeEntity(_0x2ce8c9,_0x5c39e1){return function(_0x2b27c6){if(_0x2b27c6){return _0x2b27c6['destroy']()[_0x656f('0x24')](function(){_0x2ce8c9[_0x656f('0x19')](0xcc)[_0x656f('0x25')]();});}};}function handleEntityNotFound(_0x3c6e4d,_0x26f108){return function(_0x20f163){if(!_0x20f163){_0x3c6e4d['sendStatus'](0x194);}return _0x20f163;};}function handleError(_0x3a3809,_0x4249b6){_0x4249b6=_0x4249b6||0x1f4;return function(_0x1c6882){logger[_0x656f('0x26')](_0x1c6882[_0x656f('0x27')]);if(_0x1c6882['name']){delete _0x1c6882['name'];}_0x3a3809['status'](_0x4249b6)['send'](_0x1c6882);};}exports['index']=function(_0xa66c0b,_0x33abd6){var _0x2af010={},_0x13aadc={},_0x2fc7be={'count':0x0,'rows':[]};var _0x4dcdc9=_[_0x656f('0x28')](db[_0x656f('0x29')][_0x656f('0x2a')],function(_0x46d493){return{'name':_0x46d493['fieldName'],'type':_0x46d493[_0x656f('0x2b')][_0x656f('0x2c')]};});_0x13aadc[_0x656f('0x2d')]=_[_0x656f('0x28')](_0x4dcdc9,'name');_0x13aadc['query']=_[_0x656f('0x2e')](_0xa66c0b[_0x656f('0x2f')]);_0x13aadc['filters']=_[_0x656f('0x30')](_0x13aadc[_0x656f('0x2d')],_0x13aadc['query']);_0x2af010[_0x656f('0x31')]=_[_0x656f('0x30')](_0x13aadc['model'],qs[_0x656f('0x32')](_0xa66c0b['query'][_0x656f('0x32')]));_0x2af010[_0x656f('0x31')]=_0x2af010['attributes'][_0x656f('0x33')]?_0x2af010[_0x656f('0x31')]:_0x13aadc[_0x656f('0x2d')];if(!_0xa66c0b['query'][_0x656f('0x34')]('nolimit')){_0x2af010[_0x656f('0x1e')]=qs[_0x656f('0x1e')](_0xa66c0b['query'][_0x656f('0x1e')]);_0x2af010[_0x656f('0x1b')]=qs['offset'](_0xa66c0b[_0x656f('0x2f')]['offset']);}_0x2af010[_0x656f('0x35')]=qs['sort'](_0xa66c0b[_0x656f('0x2f')]['sort']);_0x2af010['where']=qs['filters'](_[_0x656f('0x36')](_0xa66c0b[_0x656f('0x2f')],_0x13aadc[_0x656f('0x37')]),_0x4dcdc9);if(_0xa66c0b[_0x656f('0x2f')][_0x656f('0x38')]){_0x2af010[_0x656f('0x39')]=_[_0x656f('0x3a')](_0x2af010[_0x656f('0x39')],{'$or':_[_0x656f('0x28')](_0x4dcdc9,function(_0x45fdbc){if(_0x45fdbc[_0x656f('0x2b')]!==_0x656f('0x3b')){var _0x15edda={};_0x15edda[_0x45fdbc[_0x656f('0x3c')]]={'$like':'%'+_0xa66c0b[_0x656f('0x2f')]['filter']+'%'};return _0x15edda;}})});}_0x2af010=_['merge']({},_0x2af010,_0xa66c0b[_0x656f('0x3d')]);var _0x48c45c={'where':_0x2af010[_0x656f('0x39')]};return db[_0x656f('0x29')][_0x656f('0x1d')](_0x48c45c)[_0x656f('0x24')](function(_0x1cb7be){_0x2fc7be[_0x656f('0x1d')]=_0x1cb7be;if(_0xa66c0b[_0x656f('0x2f')]['includeAll']){_0x2af010[_0x656f('0x3e')]=[{'all':!![]}];}return db[_0x656f('0x29')][_0x656f('0x3f')](_0x2af010);})[_0x656f('0x24')](function(_0x5ac574){_0x2fc7be['rows']=_0x5ac574;return _0x2fc7be;})[_0x656f('0x24')](respondWithFilteredResult(_0x33abd6,_0x2af010))[_0x656f('0x40')](handleError(_0x33abd6,null));};exports[_0x656f('0x41')]=function(_0x89ead0,_0x15d198){var _0x4c827e={'raw':!![],'where':{'id':_0x89ead0[_0x656f('0x42')]['id']}},_0x5920f9={};_0x5920f9[_0x656f('0x2d')]=_['keys'](db['SugarcrmField']['rawAttributes']);_0x5920f9[_0x656f('0x2f')]=_[_0x656f('0x2e')](_0x89ead0[_0x656f('0x2f')]);_0x5920f9['filters']=_['intersection'](_0x5920f9[_0x656f('0x2d')],_0x5920f9[_0x656f('0x2f')]);_0x4c827e[_0x656f('0x31')]=_['intersection'](_0x5920f9['model'],qs[_0x656f('0x32')](_0x89ead0[_0x656f('0x2f')][_0x656f('0x32')]));_0x4c827e[_0x656f('0x31')]=_0x4c827e['attributes']['length']?_0x4c827e[_0x656f('0x31')]:_0x5920f9['model'];if(_0x89ead0[_0x656f('0x2f')][_0x656f('0x43')]){_0x4c827e[_0x656f('0x3e')]=[{'all':!![]}];}_0x4c827e=_[_0x656f('0x3a')]({},_0x4c827e,_0x89ead0[_0x656f('0x3d')]);return db[_0x656f('0x29')][_0x656f('0x44')](_0x4c827e)[_0x656f('0x24')](handleEntityNotFound(_0x15d198,null))[_0x656f('0x24')](respondWithResult(_0x15d198,null))[_0x656f('0x40')](handleError(_0x15d198,null));};exports[_0x656f('0x45')]=function(_0x55f176,_0x279507){return db[_0x656f('0x29')][_0x656f('0x45')](_0x55f176[_0x656f('0x46')],{})['then'](respondWithResult(_0x279507,0xc9))[_0x656f('0x40')](handleError(_0x279507,null));};exports[_0x656f('0x23')]=function(_0x37130b,_0x1ba922){if(_0x37130b[_0x656f('0x46')]['id']){delete _0x37130b[_0x656f('0x46')]['id'];}return db[_0x656f('0x29')][_0x656f('0x44')]({'where':{'id':_0x37130b[_0x656f('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ba922,null))[_0x656f('0x24')](saveUpdates(_0x37130b[_0x656f('0x46')],null))[_0x656f('0x24')](respondWithResult(_0x1ba922,null))[_0x656f('0x40')](handleError(_0x1ba922,null));};exports[_0x656f('0x47')]=function(_0x287591,_0x346d6a){return db[_0x656f('0x29')]['find']({'where':{'id':_0x287591['params']['id']}})['then'](handleEntityNotFound(_0x346d6a,null))[_0x656f('0x24')](removeEntity(_0x346d6a,null))[_0x656f('0x40')](handleError(_0x346d6a,null));}; \ No newline at end of file +var _0xd489=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','destroy','then','end','error','stack','index','map','SugarcrmField','rawAttributes','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3277b1,_0x3a7424){var _0x2ddcdb=function(_0x212124){while(--_0x212124){_0x3277b1['push'](_0x3277b1['shift']());}};_0x2ddcdb(++_0x3a7424);}(_0xd489,0x141));var _0x9d48=function(_0x16b1c8,_0x2f9bf9){_0x16b1c8=_0x16b1c8-0x0;var _0x397d87=_0xd489[_0x16b1c8];return _0x397d87;};'use strict';var emlformat=require(_0x9d48('0x0'));var rimraf=require(_0x9d48('0x1'));var zipdir=require(_0x9d48('0x2'));var jsonpatch=require(_0x9d48('0x3'));var rp=require(_0x9d48('0x4'));var moment=require('moment');var BPromise=require(_0x9d48('0x5'));var Mustache=require('mustache');var util=require(_0x9d48('0x6'));var path=require(_0x9d48('0x7'));var sox=require(_0x9d48('0x8'));var csv=require('to-csv');var ejs=require(_0x9d48('0x9'));var fs=require('fs');var fs_extra=require(_0x9d48('0xa'));var _=require(_0x9d48('0xb'));var squel=require(_0x9d48('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d48('0xd'));var deskjs=require(_0x9d48('0xe'));var toCsv=require(_0x9d48('0xf'));var querystring=require('querystring');var Papa=require(_0x9d48('0x10'));var Redis=require(_0x9d48('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9d48('0x12'));var as=require(_0x9d48('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d48('0x14'))(_0x9d48('0x15'));var utils=require(_0x9d48('0x16'));var config=require(_0x9d48('0x17'));var licenseUtil=require(_0x9d48('0x18'));var db=require(_0x9d48('0x19'))['db'];function respondWithStatusCode(_0x906403,_0x3bf08c){_0x3bf08c=_0x3bf08c||0xcc;return function(_0x3302da){if(_0x3302da){return _0x906403[_0x9d48('0x1a')](_0x3bf08c);}return _0x906403[_0x9d48('0x1b')](_0x3bf08c)['end']();};}function respondWithResult(_0x2b137a,_0x51062d){_0x51062d=_0x51062d||0xc8;return function(_0x44494d){if(_0x44494d){return _0x2b137a[_0x9d48('0x1b')](_0x51062d)[_0x9d48('0x1c')](_0x44494d);}};}function respondWithFilteredResult(_0x362630,_0x5157eb){return function(_0x23cf00){if(_0x23cf00){var _0x20db93=typeof _0x5157eb['offset']==='undefined'&&typeof _0x5157eb[_0x9d48('0x1d')]===_0x9d48('0x1e');var _0x4595ad=_0x23cf00[_0x9d48('0x1f')];var _0x49ad1e=_0x20db93?0x0:_0x5157eb['offset'];var _0x28bc83=_0x20db93?_0x23cf00[_0x9d48('0x1f')]:_0x5157eb[_0x9d48('0x20')]+_0x5157eb['limit'];var _0x37918c;if(_0x28bc83>=_0x4595ad){_0x28bc83=_0x4595ad;_0x37918c=0xc8;}else{_0x37918c=0xce;}_0x362630[_0x9d48('0x1b')](_0x37918c);return _0x362630[_0x9d48('0x21')](_0x9d48('0x22'),_0x49ad1e+'-'+_0x28bc83+'/'+_0x4595ad)[_0x9d48('0x1c')](_0x23cf00);}return null;};}function patchUpdates(_0x44a616){return function(_0x48a4e8){try{jsonpatch[_0x9d48('0x23')](_0x48a4e8,_0x44a616,!![]);}catch(_0x762d19){return BPromise['reject'](_0x762d19);}return _0x48a4e8[_0x9d48('0x24')]();};}function saveUpdates(_0x3cf5de,_0x31d325){return function(_0x16d2dc){if(_0x16d2dc){return _0x16d2dc[_0x9d48('0x25')](_0x3cf5de)['then'](function(_0x5b147a){return _0x5b147a;});}return null;};}function removeEntity(_0x41592b,_0x4fe135){return function(_0x5e34b0){if(_0x5e34b0){return _0x5e34b0[_0x9d48('0x26')]()[_0x9d48('0x27')](function(){_0x41592b[_0x9d48('0x1b')](0xcc)[_0x9d48('0x28')]();});}};}function handleEntityNotFound(_0xb00f9e,_0x37db7d){return function(_0x40c438){if(!_0x40c438){_0xb00f9e[_0x9d48('0x1a')](0x194);}return _0x40c438;};}function handleError(_0x6738c9,_0x272bc2){_0x272bc2=_0x272bc2||0x1f4;return function(_0x557f37){logger[_0x9d48('0x29')](_0x557f37[_0x9d48('0x2a')]);if(_0x557f37['name']){delete _0x557f37['name'];}_0x6738c9[_0x9d48('0x1b')](_0x272bc2)['send'](_0x557f37);};}exports[_0x9d48('0x2b')]=function(_0xcba6dd,_0x1e149b){var _0x598eaf={},_0x451d94={},_0x47b12e={'count':0x0,'rows':[]};var _0x29c051=_[_0x9d48('0x2c')](db[_0x9d48('0x2d')][_0x9d48('0x2e')],function(_0x110a06){return{'name':_0x110a06['fieldName'],'type':_0x110a06[_0x9d48('0x2f')][_0x9d48('0x30')]};});_0x451d94[_0x9d48('0x31')]=_['map'](_0x29c051,_0x9d48('0x32'));_0x451d94[_0x9d48('0x33')]=_[_0x9d48('0x34')](_0xcba6dd['query']);_0x451d94[_0x9d48('0x35')]=_[_0x9d48('0x36')](_0x451d94[_0x9d48('0x31')],_0x451d94['query']);_0x598eaf['attributes']=_[_0x9d48('0x36')](_0x451d94[_0x9d48('0x31')],qs[_0x9d48('0x37')](_0xcba6dd[_0x9d48('0x33')][_0x9d48('0x37')]));_0x598eaf[_0x9d48('0x38')]=_0x598eaf[_0x9d48('0x38')][_0x9d48('0x39')]?_0x598eaf['attributes']:_0x451d94[_0x9d48('0x31')];if(!_0xcba6dd['query'][_0x9d48('0x3a')](_0x9d48('0x3b'))){_0x598eaf['limit']=qs[_0x9d48('0x1d')](_0xcba6dd[_0x9d48('0x33')]['limit']);_0x598eaf[_0x9d48('0x20')]=qs[_0x9d48('0x20')](_0xcba6dd[_0x9d48('0x33')][_0x9d48('0x20')]);}_0x598eaf[_0x9d48('0x3c')]=qs[_0x9d48('0x3d')](_0xcba6dd['query']['sort']);_0x598eaf[_0x9d48('0x3e')]=qs['filters'](_[_0x9d48('0x3f')](_0xcba6dd[_0x9d48('0x33')],_0x451d94[_0x9d48('0x35')]),_0x29c051);if(_0xcba6dd[_0x9d48('0x33')][_0x9d48('0x40')]){_0x598eaf[_0x9d48('0x3e')]=_[_0x9d48('0x41')](_0x598eaf[_0x9d48('0x3e')],{'$or':_[_0x9d48('0x2c')](_0x29c051,function(_0x3ba4f2){if(_0x3ba4f2[_0x9d48('0x2f')]!==_0x9d48('0x42')){var _0x226eb6={};_0x226eb6[_0x3ba4f2[_0x9d48('0x32')]]={'$like':'%'+_0xcba6dd[_0x9d48('0x33')][_0x9d48('0x40')]+'%'};return _0x226eb6;}})});}_0x598eaf=_[_0x9d48('0x41')]({},_0x598eaf,_0xcba6dd[_0x9d48('0x43')]);var _0x333777={'where':_0x598eaf[_0x9d48('0x3e')]};return db['SugarcrmField'][_0x9d48('0x1f')](_0x333777)[_0x9d48('0x27')](function(_0x3c3308){_0x47b12e[_0x9d48('0x1f')]=_0x3c3308;if(_0xcba6dd['query'][_0x9d48('0x44')]){_0x598eaf[_0x9d48('0x45')]=[{'all':!![]}];}return db[_0x9d48('0x2d')][_0x9d48('0x46')](_0x598eaf);})['then'](function(_0x39250f){_0x47b12e[_0x9d48('0x47')]=_0x39250f;return _0x47b12e;})[_0x9d48('0x27')](respondWithFilteredResult(_0x1e149b,_0x598eaf))[_0x9d48('0x48')](handleError(_0x1e149b,null));};exports[_0x9d48('0x49')]=function(_0x4e06da,_0x17f384){var _0x1ef83f={'raw':!![],'where':{'id':_0x4e06da[_0x9d48('0x4a')]['id']}},_0x4fb055={};_0x4fb055['model']=_[_0x9d48('0x34')](db[_0x9d48('0x2d')][_0x9d48('0x2e')]);_0x4fb055[_0x9d48('0x33')]=_[_0x9d48('0x34')](_0x4e06da[_0x9d48('0x33')]);_0x4fb055[_0x9d48('0x35')]=_[_0x9d48('0x36')](_0x4fb055[_0x9d48('0x31')],_0x4fb055['query']);_0x1ef83f[_0x9d48('0x38')]=_['intersection'](_0x4fb055[_0x9d48('0x31')],qs[_0x9d48('0x37')](_0x4e06da['query'][_0x9d48('0x37')]));_0x1ef83f[_0x9d48('0x38')]=_0x1ef83f['attributes']['length']?_0x1ef83f[_0x9d48('0x38')]:_0x4fb055[_0x9d48('0x31')];if(_0x4e06da[_0x9d48('0x33')][_0x9d48('0x44')]){_0x1ef83f[_0x9d48('0x45')]=[{'all':!![]}];}_0x1ef83f=_[_0x9d48('0x41')]({},_0x1ef83f,_0x4e06da['options']);return db[_0x9d48('0x2d')]['find'](_0x1ef83f)[_0x9d48('0x27')](handleEntityNotFound(_0x17f384,null))['then'](respondWithResult(_0x17f384,null))[_0x9d48('0x48')](handleError(_0x17f384,null));};exports[_0x9d48('0x4b')]=function(_0x1c9507,_0x5e9087){return db['SugarcrmField'][_0x9d48('0x4b')](_0x1c9507[_0x9d48('0x4c')],{})[_0x9d48('0x27')](respondWithResult(_0x5e9087,0xc9))[_0x9d48('0x48')](handleError(_0x5e9087,null));};exports[_0x9d48('0x25')]=function(_0x2cdca9,_0x401074){if(_0x2cdca9[_0x9d48('0x4c')]['id']){delete _0x2cdca9['body']['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x2cdca9[_0x9d48('0x4a')]['id']}})['then'](handleEntityNotFound(_0x401074,null))[_0x9d48('0x27')](saveUpdates(_0x2cdca9[_0x9d48('0x4c')],null))['then'](respondWithResult(_0x401074,null))['catch'](handleError(_0x401074,null));};exports[_0x9d48('0x26')]=function(_0x22e930,_0x18f4a1){return db[_0x9d48('0x2d')]['find']({'where':{'id':_0x22e930[_0x9d48('0x4a')]['id']}})[_0x9d48('0x27')](handleEntityNotFound(_0x18f4a1,null))[_0x9d48('0x27')](removeEntity(_0x18f4a1,null))[_0x9d48('0x48')](handleError(_0x18f4a1,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f157ac6..9ef6935 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 _0x4aa4=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','util'];(function(_0x3ee6a5,_0x4e6a90){var _0x6c6f35=function(_0x527760){while(--_0x527760){_0x3ee6a5['push'](_0x3ee6a5['shift']());}};_0x6c6f35(++_0x4e6a90);}(_0x4aa4,0x1c7));var _0x44aa=function(_0x3470f7,_0x102f36){_0x3470f7=_0x3470f7-0x0;var _0x7a39a3=_0x4aa4[_0x3470f7];return _0x7a39a3;};'use strict';var _=require('lodash');var util=require(_0x44aa('0x0'));var logger=require('../../config/logger')(_0x44aa('0x1'));var moment=require('moment');var BPromise=require(_0x44aa('0x2'));var rp=require(_0x44aa('0x3'));var fs=require('fs');var path=require(_0x44aa('0x4'));var rimraf=require('rimraf');var config=require(_0x44aa('0x5'));var attributes=require(_0x44aa('0x6'));module['exports']=function(_0x4ab440,_0x33e668){return _0x4ab440[_0x44aa('0x7')](_0x44aa('0x8'),attributes,{'tableName':_0x44aa('0x9'),'paranoid':![],'indexes':[{'name':_0x44aa('0xa'),'fields':['idField',_0x44aa('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cec=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','lodash','../../config/logger'];(function(_0x271444,_0x3721fd){var _0x15016a=function(_0x134388){while(--_0x134388){_0x271444['push'](_0x271444['shift']());}};_0x15016a(++_0x3721fd);}(_0x9cec,0xdb));var _0xc9ce=function(_0x56ac40,_0x3eb56c){_0x56ac40=_0x56ac40-0x0;var _0x5e32c3=_0x9cec[_0x56ac40];return _0x5e32c3;};'use strict';var _=require(_0xc9ce('0x0'));var util=require('util');var logger=require(_0xc9ce('0x1'))('api');var moment=require(_0xc9ce('0x2'));var BPromise=require(_0xc9ce('0x3'));var rp=require(_0xc9ce('0x4'));var fs=require('fs');var path=require(_0xc9ce('0x5'));var rimraf=require(_0xc9ce('0x6'));var config=require(_0xc9ce('0x7'));var attributes=require(_0xc9ce('0x8'));module[_0xc9ce('0x9')]=function(_0x4bf6cb,_0x4182f4){return _0x4bf6cb[_0xc9ce('0xa')](_0xc9ce('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc9ce('0xc'),'fields':['idField','FieldId'],'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 d431267..47fc84a 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 _0x53bc=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x563726,_0x377362){var _0xa76ef6=function(_0x2eaecb){while(--_0x2eaecb){_0x563726['push'](_0x563726['shift']());}};_0xa76ef6(++_0x377362);}(_0x53bc,0x19c));var _0xc53b=function(_0x19cc7e,_0x7cca51){_0x19cc7e=_0x19cc7e-0x0;var _0x4e0485=_0x53bc[_0x19cc7e];return _0x4e0485;};'use strict';var _=require(_0xc53b('0x0'));var util=require(_0xc53b('0x1'));var moment=require(_0xc53b('0x2'));var BPromise=require(_0xc53b('0x3'));var rs=require(_0xc53b('0x4'));var fs=require('fs');var Redis=require(_0xc53b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53b('0x6'));var logger=require(_0xc53b('0x7'))(_0xc53b('0x8'));var config=require('../../config/environment');var jayson=require(_0xc53b('0x9'));var client=jayson[_0xc53b('0xa')][_0xc53b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10ca90,_0x1b4f84,_0x20fd81){return new BPromise(function(_0x5b9853,_0xce7177){return client[_0xc53b('0xc')](_0x10ca90,_0x20fd81)[_0xc53b('0xd')](function(_0x1bf8b2){logger['info'](_0xc53b('0xe'),_0x1b4f84,_0xc53b('0xf'));logger['debug'](_0xc53b('0x10'),_0x1b4f84,'request\x20sent',JSON['stringify'](_0x1bf8b2));if(_0x1bf8b2[_0xc53b('0x11')]){if(_0x1bf8b2[_0xc53b('0x11')][_0xc53b('0x12')]===0x1f4){logger[_0xc53b('0x11')](_0xc53b('0xe'),_0x1b4f84,_0x1bf8b2[_0xc53b('0x11')][_0xc53b('0x13')]);return _0xce7177(_0x1bf8b2[_0xc53b('0x11')][_0xc53b('0x13')]);}logger[_0xc53b('0x11')](_0xc53b('0xe'),_0x1b4f84,_0x1bf8b2[_0xc53b('0x11')][_0xc53b('0x13')]);return _0x5b9853(_0x1bf8b2['error'][_0xc53b('0x13')]);}else{logger['info'](_0xc53b('0xe'),_0x1b4f84,_0xc53b('0xf'));_0x5b9853(_0x1bf8b2[_0xc53b('0x14')][_0xc53b('0x13')]);}})[_0xc53b('0x15')](function(_0x3820be){logger[_0xc53b('0x11')](_0xc53b('0xe'),_0x1b4f84,_0x3820be);_0xce7177(_0x3820be);});});} \ No newline at end of file +var _0x76f8=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x36734a,_0xdd12e1){var _0x565da1=function(_0x4e27d3){while(--_0x4e27d3){_0x36734a['push'](_0x36734a['shift']());}};_0x565da1(++_0xdd12e1);}(_0x76f8,0x138));var _0x876f=function(_0x1003c8,_0x50a38c){_0x1003c8=_0x1003c8-0x0;var _0x47ffb3=_0x76f8[_0x1003c8];return _0x47ffb3;};'use strict';var _=require(_0x876f('0x0'));var util=require(_0x876f('0x1'));var moment=require(_0x876f('0x2'));var BPromise=require(_0x876f('0x3'));var rs=require(_0x876f('0x4'));var fs=require('fs');var Redis=require(_0x876f('0x5'));var db=require(_0x876f('0x6'))['db'];var utils=require(_0x876f('0x7'));var logger=require(_0x876f('0x8'))(_0x876f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x876f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1029c8,_0x530fc3,_0x1a1c42){return new BPromise(function(_0xdd68b3,_0x18ef0f){return client[_0x876f('0xb')](_0x1029c8,_0x1a1c42)[_0x876f('0xc')](function(_0x52a7f0){logger[_0x876f('0xd')](_0x876f('0xe'),_0x530fc3,_0x876f('0xf'));logger[_0x876f('0x10')](_0x876f('0x11'),_0x530fc3,_0x876f('0xf'),JSON[_0x876f('0x12')](_0x52a7f0));if(_0x52a7f0['error']){if(_0x52a7f0[_0x876f('0x13')][_0x876f('0x14')]===0x1f4){logger[_0x876f('0x13')](_0x876f('0xe'),_0x530fc3,_0x52a7f0[_0x876f('0x13')]['message']);return _0x18ef0f(_0x52a7f0[_0x876f('0x13')]['message']);}logger[_0x876f('0x13')](_0x876f('0xe'),_0x530fc3,_0x52a7f0[_0x876f('0x13')][_0x876f('0x15')]);return _0xdd68b3(_0x52a7f0['error'][_0x876f('0x15')]);}else{logger[_0x876f('0xd')](_0x876f('0xe'),_0x530fc3,'request\x20sent');_0xdd68b3(_0x52a7f0[_0x876f('0x16')][_0x876f('0x15')]);}})[_0x876f('0x17')](function(_0x381fe5){logger['error'](_0x876f('0xe'),_0x530fc3,_0x381fe5);_0x18ef0f(_0x381fe5);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 660ed49..38f3a5f 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 _0x1ef8=['get','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','update','delete','destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x1ef8,0xd5));var _0x81ef=function(_0x4fe1bd,_0x7028ec){_0x4fe1bd=_0x4fe1bd-0x0;var _0x258a5b=_0x1ef8[_0x4fe1bd];return _0x258a5b;};'use strict';var multer=require(_0x81ef('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x81ef('0x1')]();var fs_extra=require(_0x81ef('0x2'));var auth=require(_0x81ef('0x3'));var interaction=require(_0x81ef('0x4'));var config=require(_0x81ef('0x5'));var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x81ef('0x6')]);router[_0x81ef('0x7')](_0x81ef('0x8'),auth[_0x81ef('0x9')](),controller['show']);router[_0x81ef('0x7')](_0x81ef('0xa'),auth[_0x81ef('0x9')](),controller[_0x81ef('0xb')]);router[_0x81ef('0x7')]('/:id/fields',auth[_0x81ef('0x9')](),controller[_0x81ef('0xc')]);router['post']('/',auth[_0x81ef('0x9')](),controller[_0x81ef('0xd')]);router[_0x81ef('0xe')](_0x81ef('0xa'),auth[_0x81ef('0x9')](),controller[_0x81ef('0xf')]);router[_0x81ef('0x10')](_0x81ef('0x8'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x11')]);router[_0x81ef('0x12')](_0x81ef('0x8'),auth[_0x81ef('0x9')](),controller[_0x81ef('0x13')]);module['exports']=router; \ No newline at end of file +var _0x1703=['addConfiguration','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1703,0x16a));var _0x3170=function(_0x3034d6,_0x507544){_0x3034d6=_0x3034d6-0x0;var _0x181fff=_0x1703[_0x3034d6];return _0x181fff;};'use strict';var multer=require('multer');var util=require(_0x3170('0x0'));var path=require('path');var timeout=require(_0x3170('0x1'));var express=require(_0x3170('0x2'));var router=express[_0x3170('0x3')]();var fs_extra=require(_0x3170('0x4'));var auth=require(_0x3170('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3170('0x6'));var controller=require('./intVtigerAccount.controller');router[_0x3170('0x7')]('/',auth[_0x3170('0x8')](),controller[_0x3170('0x9')]);router['get'](_0x3170('0xa'),auth[_0x3170('0x8')](),controller[_0x3170('0xb')]);router[_0x3170('0x7')](_0x3170('0xc'),auth[_0x3170('0x8')](),controller[_0x3170('0xd')]);router[_0x3170('0x7')]('/:id/fields',auth[_0x3170('0x8')](),controller[_0x3170('0xe')]);router[_0x3170('0xf')]('/',auth[_0x3170('0x8')](),controller['create']);router[_0x3170('0xf')]('/:id/configurations',auth[_0x3170('0x8')](),controller[_0x3170('0x10')]);router['put'](_0x3170('0xa'),auth['isAuthenticated'](),controller[_0x3170('0x11')]);router[_0x3170('0x12')](_0x3170('0xa'),auth[_0x3170('0x8')](),controller[_0x3170('0x13')]);module[_0x3170('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5ad8429..e0e9241 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 _0xc213=['HelpDesk','sequelize','exports','STRING'];(function(_0x9f8340,_0x1a6628){var _0x214eec=function(_0x5774ae){while(--_0x5774ae){_0x9f8340['push'](_0x9f8340['shift']());}};_0x214eec(++_0x1a6628);}(_0xc213,0x1f1));var _0x3c21=function(_0x399163,_0x1a5163){_0x399163=_0x399163-0x0;var _0x26e981=_0xc213[_0x399163];return _0x26e981;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'name':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![],'defaultValue':_0x3c21('0x3')},'remoteUri':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3c21('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xd213=['HelpDesk','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd213,0x17e));var _0x3d21=function(_0x2f52f6,_0x463684){_0x2f52f6=_0x2f52f6-0x0;var _0xc2dc78=_0xd213[_0x2f52f6];return _0xc2dc78;};'use strict';var Sequelize=require('sequelize');module[_0x3d21('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3d21('0x1')]},'username':{'type':Sequelize[_0x3d21('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3d21('0x1')],'allowNull':![],'defaultValue':_0x3d21('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3d21('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6e0d30f..20e7f11 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 _0x727c=['hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','merge','find','create','body','catch','params','getConfigurations','findOne','VtigerConfiguration','order','Subjects','getSubjects','channel','Descriptions','VtigerField','md5','getFields','description','remoteUri','serverUrl','username','accessKey','moduleName','slice','format','%s/webservice.php','GET','getchallenge','success','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','intersection','fields','length'];(function(_0x630174,_0x3d5454){var _0x2e411c=function(_0x380838){while(--_0x380838){_0x630174['push'](_0x630174['shift']());}};_0x2e411c(++_0x3d5454);}(_0x727c,0x133));var _0xc727=function(_0x3e2c1e,_0x1e8d40){_0x3e2c1e=_0x3e2c1e-0x0;var _0x1c6666=_0x727c[_0x3e2c1e];return _0x1c6666;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc727('0x0'));var jsonpatch=require(_0xc727('0x1'));var rp=require('request-promise');var moment=require(_0xc727('0x2'));var BPromise=require(_0xc727('0x3'));var Mustache=require(_0xc727('0x4'));var util=require(_0xc727('0x5'));var path=require(_0xc727('0x6'));var sox=require(_0xc727('0x7'));var csv=require(_0xc727('0x8'));var ejs=require(_0xc727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc727('0xa'));var crypto=require(_0xc727('0xb'));var jsforce=require(_0xc727('0xc'));var deskjs=require(_0xc727('0xd'));var toCsv=require(_0xc727('0x8'));var querystring=require(_0xc727('0xe'));var Papa=require(_0xc727('0xf'));var Redis=require(_0xc727('0x10'));var authService=require(_0xc727('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc727('0x12'));var hardwareService=require(_0xc727('0x13'));var logger=require(_0xc727('0x14'))(_0xc727('0x15'));var utils=require(_0xc727('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc727('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x20a8ea,_0x43c67d){_0x43c67d=_0x43c67d||0xcc;return function(_0x1b809a){if(_0x1b809a){return _0x20a8ea[_0xc727('0x18')](_0x43c67d);}return _0x20a8ea['status'](_0x43c67d)[_0xc727('0x19')]();};}function respondWithResult(_0x5155c8,_0x48f228){_0x48f228=_0x48f228||0xc8;return function(_0xd26952){if(_0xd26952){return _0x5155c8[_0xc727('0x1a')](_0x48f228)[_0xc727('0x1b')](_0xd26952);}};}function respondWithFilteredResult(_0x470ee0,_0x35ebeb){return function(_0x3814d6){if(_0x3814d6){var _0x4f612b=typeof _0x35ebeb[_0xc727('0x1c')]===_0xc727('0x1d')&&typeof _0x35ebeb[_0xc727('0x1e')]===_0xc727('0x1d');var _0x191d59=_0x3814d6[_0xc727('0x1f')];var _0x2e2d6e=_0x4f612b?0x0:_0x35ebeb[_0xc727('0x1c')];var _0x4454ea=_0x4f612b?_0x3814d6[_0xc727('0x1f')]:_0x35ebeb[_0xc727('0x1c')]+_0x35ebeb[_0xc727('0x1e')];var _0x2acb6e;if(_0x4454ea>=_0x191d59){_0x4454ea=_0x191d59;_0x2acb6e=0xc8;}else{_0x2acb6e=0xce;}_0x470ee0[_0xc727('0x1a')](_0x2acb6e);return _0x470ee0['set'](_0xc727('0x20'),_0x2e2d6e+'-'+_0x4454ea+'/'+_0x191d59)[_0xc727('0x1b')](_0x3814d6);}return null;};}function patchUpdates(_0x5b4140){return function(_0x3c1667){try{jsonpatch[_0xc727('0x21')](_0x3c1667,_0x5b4140,!![]);}catch(_0x151784){return BPromise[_0xc727('0x22')](_0x151784);}return _0x3c1667[_0xc727('0x23')]();};}function saveUpdates(_0x4cbbb3,_0x4c36a9){return function(_0x53dd9a){if(_0x53dd9a){return _0x53dd9a[_0xc727('0x24')](_0x4cbbb3)[_0xc727('0x25')](function(_0xd4442b){return _0xd4442b;});}return null;};}function removeEntity(_0x528e2f,_0x145f6a){return function(_0x5c4a54){if(_0x5c4a54){return _0x5c4a54[_0xc727('0x26')]()[_0xc727('0x25')](function(){_0x528e2f['status'](0xcc)[_0xc727('0x19')]();});}};}function handleEntityNotFound(_0x23636f,_0x5867fb){return function(_0x3ffdf0){if(!_0x3ffdf0){_0x23636f[_0xc727('0x18')](0x194);}return _0x3ffdf0;};}function handleError(_0xce282a,_0x5f2208){_0x5f2208=_0x5f2208||0x1f4;return function(_0x2fddf0){logger['error'](_0x2fddf0[_0xc727('0x27')]);if(_0x2fddf0[_0xc727('0x28')]){delete _0x2fddf0[_0xc727('0x28')];}_0xce282a['status'](_0x5f2208)[_0xc727('0x29')](_0x2fddf0);};}exports['index']=function(_0x595e5c,_0x466a39){var _0x587fa1={},_0x2db752={},_0x106e39={'count':0x0,'rows':[]};var _0x36f259=_[_0xc727('0x2a')](db[_0xc727('0x2b')][_0xc727('0x2c')],function(_0x2e2ba1){return{'name':_0x2e2ba1[_0xc727('0x2d')],'type':_0x2e2ba1[_0xc727('0x2e')][_0xc727('0x2f')]};});_0x2db752['model']=_[_0xc727('0x2a')](_0x36f259,_0xc727('0x28'));_0x2db752['query']=_[_0xc727('0x30')](_0x595e5c['query']);_0x2db752[_0xc727('0x31')]=_['intersection'](_0x2db752[_0xc727('0x32')],_0x2db752[_0xc727('0x33')]);_0x587fa1[_0xc727('0x34')]=_[_0xc727('0x35')](_0x2db752[_0xc727('0x32')],qs[_0xc727('0x36')](_0x595e5c[_0xc727('0x33')][_0xc727('0x36')]));_0x587fa1[_0xc727('0x34')]=_0x587fa1[_0xc727('0x34')][_0xc727('0x37')]?_0x587fa1[_0xc727('0x34')]:_0x2db752['model'];if(!_0x595e5c[_0xc727('0x33')][_0xc727('0x38')](_0xc727('0x39'))){_0x587fa1[_0xc727('0x1e')]=qs[_0xc727('0x1e')](_0x595e5c[_0xc727('0x33')][_0xc727('0x1e')]);_0x587fa1['offset']=qs[_0xc727('0x1c')](_0x595e5c[_0xc727('0x33')][_0xc727('0x1c')]);}_0x587fa1['order']=qs['sort'](_0x595e5c[_0xc727('0x33')][_0xc727('0x3a')]);_0x587fa1['where']=qs[_0xc727('0x31')](_[_0xc727('0x3b')](_0x595e5c[_0xc727('0x33')],_0x2db752[_0xc727('0x31')]),_0x36f259);if(_0x595e5c['query'][_0xc727('0x3c')]){_0x587fa1[_0xc727('0x3d')]=_['merge'](_0x587fa1[_0xc727('0x3d')],{'$or':_['map'](_0x36f259,function(_0x136292){if(_0x136292[_0xc727('0x2e')]!==_0xc727('0x3e')){var _0x5131f8={};_0x5131f8[_0x136292[_0xc727('0x28')]]={'$like':'%'+_0x595e5c[_0xc727('0x33')]['filter']+'%'};return _0x5131f8;}})});}_0x587fa1=_['merge']({},_0x587fa1,_0x595e5c[_0xc727('0x3f')]);var _0x134b97={'where':_0x587fa1[_0xc727('0x3d')]};return db[_0xc727('0x2b')]['count'](_0x134b97)[_0xc727('0x25')](function(_0x42797e){_0x106e39[_0xc727('0x1f')]=_0x42797e;if(_0x595e5c[_0xc727('0x33')][_0xc727('0x40')]){_0x587fa1[_0xc727('0x41')]=[{'all':!![]}];}return db[_0xc727('0x2b')][_0xc727('0x42')](_0x587fa1);})[_0xc727('0x25')](function(_0x489357){_0x106e39[_0xc727('0x43')]=_0x489357;return _0x106e39;})[_0xc727('0x25')](respondWithFilteredResult(_0x466a39,_0x587fa1))['catch'](handleError(_0x466a39,null));};exports['show']=function(_0xdcb21d,_0x1b5164){var _0x119572={'raw':![],'where':{'id':_0xdcb21d['params']['id']}},_0x194132={};_0x194132['model']=_[_0xc727('0x30')](db[_0xc727('0x2b')][_0xc727('0x2c')]);_0x194132['query']=_[_0xc727('0x30')](_0xdcb21d['query']);_0x194132['filters']=_[_0xc727('0x35')](_0x194132['model'],_0x194132[_0xc727('0x33')]);_0x119572['attributes']=_[_0xc727('0x35')](_0x194132['model'],qs[_0xc727('0x36')](_0xdcb21d[_0xc727('0x33')][_0xc727('0x36')]));_0x119572[_0xc727('0x34')]=_0x119572[_0xc727('0x34')][_0xc727('0x37')]?_0x119572[_0xc727('0x34')]:_0x194132[_0xc727('0x32')];if(_0xdcb21d[_0xc727('0x33')][_0xc727('0x40')]){_0x119572[_0xc727('0x41')]=[{'all':!![]}];}_0x119572=_[_0xc727('0x44')]({},_0x119572,_0xdcb21d['options']);return db['VtigerAccount'][_0xc727('0x45')](_0x119572)['then'](handleEntityNotFound(_0x1b5164,null))[_0xc727('0x25')](respondWithResult(_0x1b5164,null))['catch'](handleError(_0x1b5164,null));};exports[_0xc727('0x46')]=function(_0x35d9bd,_0x2e8db3){return db[_0xc727('0x2b')][_0xc727('0x46')](_0x35d9bd[_0xc727('0x47')],{})['then'](respondWithResult(_0x2e8db3,0xc9))[_0xc727('0x48')](handleError(_0x2e8db3,null));};exports[_0xc727('0x24')]=function(_0x283dab,_0x51b26f){if(_0x283dab[_0xc727('0x47')]['id']){delete _0x283dab[_0xc727('0x47')]['id'];}return db[_0xc727('0x2b')][_0xc727('0x45')]({'where':{'id':_0x283dab[_0xc727('0x49')]['id']}})[_0xc727('0x25')](handleEntityNotFound(_0x51b26f,null))[_0xc727('0x25')](saveUpdates(_0x283dab[_0xc727('0x47')],null))[_0xc727('0x25')](respondWithResult(_0x51b26f,null))[_0xc727('0x48')](handleError(_0x51b26f,null));};exports[_0xc727('0x26')]=function(_0x5ae029,_0x2451ba){return db[_0xc727('0x2b')][_0xc727('0x45')]({'where':{'id':_0x5ae029['params']['id']}})['then'](handleEntityNotFound(_0x2451ba,null))[_0xc727('0x25')](removeEntity(_0x2451ba,null))['catch'](handleError(_0x2451ba,null));};exports[_0xc727('0x4a')]=function(_0xaf8d2,_0x528d5c,_0x111360){var _0x15ee90={};var _0x4c1c1e={};var _0x253e6e;var _0x59afe3;return db['VtigerAccount'][_0xc727('0x4b')]({'where':{'id':_0xaf8d2['params']['id']}})['then'](handleEntityNotFound(_0x528d5c,null))[_0xc727('0x25')](function(_0x28b917){if(_0x28b917){_0x253e6e=_0x28b917;_0x4c1c1e[_0xc727('0x32')]=_[_0xc727('0x30')](db[_0xc727('0x4c')]['rawAttributes']);_0x4c1c1e[_0xc727('0x33')]=_['keys'](_0xaf8d2[_0xc727('0x33')]);_0x4c1c1e['filters']=_[_0xc727('0x35')](_0x4c1c1e[_0xc727('0x32')],_0x4c1c1e[_0xc727('0x33')]);_0x15ee90[_0xc727('0x34')]=_['intersection'](_0x4c1c1e[_0xc727('0x32')],qs[_0xc727('0x36')](_0xaf8d2[_0xc727('0x33')][_0xc727('0x36')]));_0x15ee90[_0xc727('0x34')]=_0x15ee90[_0xc727('0x34')][_0xc727('0x37')]?_0x15ee90[_0xc727('0x34')]:_0x4c1c1e[_0xc727('0x32')];_0x15ee90[_0xc727('0x4d')]=qs[_0xc727('0x3a')](_0xaf8d2['query']['sort']);_0x15ee90[_0xc727('0x3d')]=qs['filters'](_[_0xc727('0x3b')](_0xaf8d2[_0xc727('0x33')],_0x4c1c1e['filters']));if(_0xaf8d2['query'][_0xc727('0x3c')]){_0x15ee90['where']=_[_0xc727('0x44')](_0x15ee90[_0xc727('0x3d')],{'$or':_['map'](_0x15ee90[_0xc727('0x34')],function(_0x87458d){var _0x201229={};_0x201229[_0x87458d]={'$like':'%'+_0xaf8d2[_0xc727('0x33')][_0xc727('0x3c')]+'%'};return _0x201229;})});}_0x15ee90=_[_0xc727('0x44')]({},_0x15ee90,_0xaf8d2[_0xc727('0x3f')]);return _0x253e6e[_0xc727('0x4a')](_0x15ee90);}})[_0xc727('0x25')](function(_0x338cfb){if(_0x338cfb){_0x59afe3=_0x338cfb['length'];if(!_0xaf8d2[_0xc727('0x33')][_0xc727('0x38')]('nolimit')){_0x15ee90['limit']=qs[_0xc727('0x1e')](_0xaf8d2[_0xc727('0x33')][_0xc727('0x1e')]);_0x15ee90['offset']=qs[_0xc727('0x1c')](_0xaf8d2[_0xc727('0x33')]['offset']);}return _0x253e6e[_0xc727('0x4a')](_0x15ee90);}})[_0xc727('0x25')](function(_0x2a5eb3){if(_0x2a5eb3){return _0x2a5eb3?{'count':_0x59afe3,'rows':_0x2a5eb3}:null;}})[_0xc727('0x25')](respondWithResult(_0x528d5c,null))[_0xc727('0x48')](handleError(_0x528d5c,null));};exports['addConfiguration']=function(_0x529ad0,_0x5778c5,_0x440164){if(_0x529ad0['body']['id']){delete _0x529ad0[_0xc727('0x47')]['id'];}return db[_0xc727('0x2b')][_0xc727('0x4b')]({'where':{'id':_0x529ad0['params']['id']}})[_0xc727('0x25')](handleEntityNotFound(_0x5778c5,null))['then'](function(_0x16386d){if(_0x16386d){_0x529ad0['body']['AccountId']=_0x16386d['id'];_0x529ad0[_0xc727('0x47')][_0xc727('0x4e')]=integrations[_0xc727('0x4f')](_0x529ad0[_0xc727('0x47')][_0xc727('0x50')],_0x529ad0[_0xc727('0x47')]['type']);_0x529ad0[_0xc727('0x47')][_0xc727('0x51')]=integrations['getDescriptions'](_0x529ad0['body']['channel'],_0x529ad0[_0xc727('0x47')][_0xc727('0x2e')]);return db[_0xc727('0x4c')][_0xc727('0x46')](_0x529ad0[_0xc727('0x47')],{'include':[{'model':db['VtigerField'],'as':_0xc727('0x4e')},{'model':db[_0xc727('0x52')],'as':'Descriptions'}]});}return null;})[_0xc727('0x25')](respondWithResult(_0x5778c5,null))[_0xc727('0x48')](handleError(_0x5778c5,null));};var md5=require(_0xc727('0x53'));exports[_0xc727('0x54')]=function(_0x209e38,_0x9e56aa,_0x49c82b){var _0x4eaf77=null;var _0x3c330b=null;var _0xb41522=null;var _0x141225=null;var _0x578970='';return db['VtigerAccount'][_0xc727('0x4b')]({'where':{'id':_0x209e38[_0xc727('0x49')]['id']},'attributes':['id','name','username',_0xc727('0x55'),'moduleName',_0xc727('0x56'),_0xc727('0x57'),'accessKey']})[_0xc727('0x25')](handleEntityNotFound(_0x9e56aa,null))[_0xc727('0x25')](function(_0x40a9bc){if(_0x40a9bc){_0x4eaf77=_0x40a9bc[_0xc727('0x58')];_0x3c330b=_0x40a9bc[_0xc727('0x59')];_0xb41522=_0x40a9bc[_0xc727('0x5a')];_0x578970=_0x40a9bc[_0xc727('0x56')];var _0x45cdb9=_0x578970[_0xc727('0x5b')](-0x1);if(_0x45cdb9==='/'){_0x578970=_0x578970['substring'](0x0,_0x578970['lastIndexOf'](_0x45cdb9));}_0x141225=util[_0xc727('0x5c')](_0xc727('0x5d'),_0x578970);var _0x5f19e1={'method':_0xc727('0x5e'),'uri':_0x141225,'qs':{'operation':_0xc727('0x5f'),'username':_0x40a9bc[_0xc727('0x58')]},'json':!![]};return rp(_0x5f19e1);}})[_0xc727('0x25')](function(_0x44b7eb){if(_0x44b7eb[_0xc727('0x60')]){var _0x246342={'method':'POST','uri':_0x141225,'form':{'operation':'login','username':_0x4eaf77,'accessKey':md5(_0x44b7eb[_0xc727('0x61')][_0xc727('0x62')]+_0x3c330b)},'json':!![]};return rp(_0x246342);}})[_0xc727('0x25')](function(_0x4ad4b7){if(_0x4ad4b7[_0xc727('0x60')]){var _0x3d4310={'method':_0xc727('0x5e'),'uri':_0x141225,'qs':{'operation':_0xc727('0x63'),'username':_0x4eaf77,'sessionName':_0x4ad4b7[_0xc727('0x61')][_0xc727('0x64')],'elementType':_0xb41522},'json':!![]};return rp(_0x3d4310);}})[_0xc727('0x25')](function(_0xdb2493){if(_0xdb2493[_0xc727('0x60')]){var _0x38f070=[_0xc727('0x65'),_0xc727('0x66'),'owner'];_[_0xc727('0x67')](_0xdb2493[_0xc727('0x61')][_0xc727('0x36')],function(_0x441b13){return _0x38f070[_0xc727('0x68')](_0x441b13['type'][_0xc727('0x28')]);});_['remove'](_0xdb2493[_0xc727('0x61')]['fields'],function(_0x145d37){return _0x145d37[_0xc727('0x69')]===_0xc727('0x6a');});return{'count':_0xdb2493['result']['fields']['length'],'rows':_[_0xc727('0x2a')](_0xdb2493[_0xc727('0x61')][_0xc727('0x36')],function(_0x1aacb0){return{'id':_0x1aacb0[_0xc727('0x28')],'name':_0x1aacb0['label'],'custom':_[_0xc727('0x6b')](_0x1aacb0['name'],_0xc727('0x6c'))?!![]:![],'options':_0x1aacb0[_0xc727('0x2e')][_0xc727('0x28')]===_0xc727('0x6d')&&_0x1aacb0[_0xc727('0x2e')][_0xc727('0x6e')][_0xc727('0x37')]>0x0?_[_0xc727('0x2a')](_0x1aacb0[_0xc727('0x2e')]['picklistValues'],function(_0xc88fd3){return{'name':_0xc88fd3[_0xc727('0x6f')],'value':_0xc88fd3[_0xc727('0x70')]};}):[]};})};}})[_0xc727('0x25')](respondWithResult(_0x9e56aa,null))[_0xc727('0x48')](function(_0x23f707){console[_0xc727('0x71')](_0xc727('0x72')+_0x23f707);var _0x44cf36=_0x209e38['query'][_0xc727('0x73')]?0x1f4:_0x23f707[_0xc727('0x74')]||0x1f4;logger[_0xc727('0x75')](_0xc727('0x76'),_0xc727('0x54'),_0x44cf36,JSON[_0xc727('0x77')](_0x23f707));delete _0x23f707[_0xc727('0x28')];if(_0x44cf36===0x191){_0x44cf36=0x190;}_0x9e56aa[_0xc727('0x1a')](_0x44cf36)['send'](_0x209e38['query'][_0xc727('0x73')]?{'message':_0xc727('0x78'),'statusCode':_0x23f707[_0xc727('0x74')]}:_0x23f707);});}; \ No newline at end of file +var _0xd68c=['fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','map','options','VtigerAccount','includeAll','findAll','rows','show','include','find','catch','create','body','getConfigurations','findOne','params','order','nolimit','AccountId','channel','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','format','GET','POST','login','result','success','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','rimraf','zip-dir'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xd68c,0x73));var _0xcd68=function(_0x47beda,_0xf71fef){_0x47beda=_0x47beda-0x0;var _0x3a744f=_0xd68c[_0x47beda];return _0x3a744f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd68('0x0'));var zipdir=require(_0xcd68('0x1'));var jsonpatch=require(_0xcd68('0x2'));var rp=require(_0xcd68('0x3'));var moment=require(_0xcd68('0x4'));var BPromise=require(_0xcd68('0x5'));var Mustache=require('mustache');var util=require(_0xcd68('0x6'));var path=require(_0xcd68('0x7'));var sox=require('sox');var csv=require(_0xcd68('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd68('0x9'));var _=require(_0xcd68('0xa'));var squel=require(_0xcd68('0xb'));var crypto=require('crypto');var jsforce=require(_0xcd68('0xc'));var deskjs=require(_0xcd68('0xd'));var toCsv=require(_0xcd68('0x8'));var querystring=require(_0xcd68('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcd68('0xf'));var qs=require(_0xcd68('0x10'));var as=require(_0xcd68('0x11'));var hardwareService=require(_0xcd68('0x12'));var logger=require('../../config/logger')(_0xcd68('0x13'));var utils=require(_0xcd68('0x14'));var config=require(_0xcd68('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x344b60,_0x4e8a90){_0x4e8a90=_0x4e8a90||0xcc;return function(_0x14fca7){if(_0x14fca7){return _0x344b60[_0xcd68('0x16')](_0x4e8a90);}return _0x344b60[_0xcd68('0x17')](_0x4e8a90)[_0xcd68('0x18')]();};}function respondWithResult(_0x444def,_0x562ba2){_0x562ba2=_0x562ba2||0xc8;return function(_0x3b8d0f){if(_0x3b8d0f){return _0x444def[_0xcd68('0x17')](_0x562ba2)[_0xcd68('0x19')](_0x3b8d0f);}};}function respondWithFilteredResult(_0x37b453,_0x158e79){return function(_0x4653db){if(_0x4653db){var _0x377615=typeof _0x158e79[_0xcd68('0x1a')]===_0xcd68('0x1b')&&typeof _0x158e79['limit']==='undefined';var _0x32cf54=_0x4653db['count'];var _0x1fd3e4=_0x377615?0x0:_0x158e79['offset'];var _0x219456=_0x377615?_0x4653db[_0xcd68('0x1c')]:_0x158e79[_0xcd68('0x1a')]+_0x158e79[_0xcd68('0x1d')];var _0x585910;if(_0x219456>=_0x32cf54){_0x219456=_0x32cf54;_0x585910=0xc8;}else{_0x585910=0xce;}_0x37b453[_0xcd68('0x17')](_0x585910);return _0x37b453['set'](_0xcd68('0x1e'),_0x1fd3e4+'-'+_0x219456+'/'+_0x32cf54)['json'](_0x4653db);}return null;};}function patchUpdates(_0x5e4892){return function(_0x2b5d14){try{jsonpatch[_0xcd68('0x1f')](_0x2b5d14,_0x5e4892,!![]);}catch(_0x29b140){return BPromise[_0xcd68('0x20')](_0x29b140);}return _0x2b5d14[_0xcd68('0x21')]();};}function saveUpdates(_0x2a2ae8,_0x729f3d){return function(_0x2dfae4){if(_0x2dfae4){return _0x2dfae4[_0xcd68('0x22')](_0x2a2ae8)[_0xcd68('0x23')](function(_0x491441){return _0x491441;});}return null;};}function removeEntity(_0x3634b5,_0x456893){return function(_0x4df40d){if(_0x4df40d){return _0x4df40d[_0xcd68('0x24')]()[_0xcd68('0x23')](function(){_0x3634b5[_0xcd68('0x17')](0xcc)[_0xcd68('0x18')]();});}};}function handleEntityNotFound(_0x53c341,_0x43fec8){return function(_0x363dcf){if(!_0x363dcf){_0x53c341[_0xcd68('0x16')](0x194);}return _0x363dcf;};}function handleError(_0x248da4,_0xcb57a0){_0xcb57a0=_0xcb57a0||0x1f4;return function(_0x11ae2f){logger[_0xcd68('0x25')](_0x11ae2f['stack']);if(_0x11ae2f[_0xcd68('0x26')]){delete _0x11ae2f[_0xcd68('0x26')];}_0x248da4[_0xcd68('0x17')](_0xcb57a0)[_0xcd68('0x27')](_0x11ae2f);};}exports['index']=function(_0x3fcdbc,_0x2fe163){var _0x4eb3d9={},_0x198f1b={},_0x2b17ee={'count':0x0,'rows':[]};var _0x4791ce=_['map'](db['VtigerAccount'][_0xcd68('0x28')],function(_0x6dc388){return{'name':_0x6dc388[_0xcd68('0x29')],'type':_0x6dc388[_0xcd68('0x2a')][_0xcd68('0x2b')]};});_0x198f1b[_0xcd68('0x2c')]=_['map'](_0x4791ce,'name');_0x198f1b[_0xcd68('0x2d')]=_[_0xcd68('0x2e')](_0x3fcdbc[_0xcd68('0x2d')]);_0x198f1b[_0xcd68('0x2f')]=_[_0xcd68('0x30')](_0x198f1b[_0xcd68('0x2c')],_0x198f1b['query']);_0x4eb3d9[_0xcd68('0x31')]=_[_0xcd68('0x30')](_0x198f1b['model'],qs[_0xcd68('0x32')](_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x32')]));_0x4eb3d9[_0xcd68('0x31')]=_0x4eb3d9['attributes'][_0xcd68('0x33')]?_0x4eb3d9['attributes']:_0x198f1b[_0xcd68('0x2c')];if(!_0x3fcdbc['query'][_0xcd68('0x34')]('nolimit')){_0x4eb3d9[_0xcd68('0x1d')]=qs[_0xcd68('0x1d')](_0x3fcdbc[_0xcd68('0x2d')]['limit']);_0x4eb3d9[_0xcd68('0x1a')]=qs[_0xcd68('0x1a')](_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x1a')]);}_0x4eb3d9['order']=qs[_0xcd68('0x35')](_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x35')]);_0x4eb3d9[_0xcd68('0x36')]=qs[_0xcd68('0x2f')](_[_0xcd68('0x37')](_0x3fcdbc[_0xcd68('0x2d')],_0x198f1b[_0xcd68('0x2f')]),_0x4791ce);if(_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x38')]){_0x4eb3d9[_0xcd68('0x36')]=_[_0xcd68('0x39')](_0x4eb3d9['where'],{'$or':_[_0xcd68('0x3a')](_0x4791ce,function(_0x248d1b){if(_0x248d1b[_0xcd68('0x2a')]!=='VIRTUAL'){var _0x151c9d={};_0x151c9d[_0x248d1b['name']]={'$like':'%'+_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x38')]+'%'};return _0x151c9d;}})});}_0x4eb3d9=_[_0xcd68('0x39')]({},_0x4eb3d9,_0x3fcdbc[_0xcd68('0x3b')]);var _0x13b08c={'where':_0x4eb3d9[_0xcd68('0x36')]};return db[_0xcd68('0x3c')][_0xcd68('0x1c')](_0x13b08c)[_0xcd68('0x23')](function(_0x34200a){_0x2b17ee[_0xcd68('0x1c')]=_0x34200a;if(_0x3fcdbc[_0xcd68('0x2d')][_0xcd68('0x3d')]){_0x4eb3d9['include']=[{'all':!![]}];}return db[_0xcd68('0x3c')][_0xcd68('0x3e')](_0x4eb3d9);})[_0xcd68('0x23')](function(_0x389da7){_0x2b17ee[_0xcd68('0x3f')]=_0x389da7;return _0x2b17ee;})[_0xcd68('0x23')](respondWithFilteredResult(_0x2fe163,_0x4eb3d9))['catch'](handleError(_0x2fe163,null));};exports[_0xcd68('0x40')]=function(_0x2ec6fa,_0x5b2000){var _0x12a436={'raw':![],'where':{'id':_0x2ec6fa['params']['id']}},_0x3b16b7={};_0x3b16b7[_0xcd68('0x2c')]=_[_0xcd68('0x2e')](db[_0xcd68('0x3c')][_0xcd68('0x28')]);_0x3b16b7['query']=_[_0xcd68('0x2e')](_0x2ec6fa[_0xcd68('0x2d')]);_0x3b16b7[_0xcd68('0x2f')]=_['intersection'](_0x3b16b7[_0xcd68('0x2c')],_0x3b16b7[_0xcd68('0x2d')]);_0x12a436[_0xcd68('0x31')]=_[_0xcd68('0x30')](_0x3b16b7[_0xcd68('0x2c')],qs['fields'](_0x2ec6fa[_0xcd68('0x2d')][_0xcd68('0x32')]));_0x12a436[_0xcd68('0x31')]=_0x12a436[_0xcd68('0x31')]['length']?_0x12a436[_0xcd68('0x31')]:_0x3b16b7['model'];if(_0x2ec6fa['query']['includeAll']){_0x12a436[_0xcd68('0x41')]=[{'all':!![]}];}_0x12a436=_['merge']({},_0x12a436,_0x2ec6fa[_0xcd68('0x3b')]);return db[_0xcd68('0x3c')][_0xcd68('0x42')](_0x12a436)[_0xcd68('0x23')](handleEntityNotFound(_0x5b2000,null))[_0xcd68('0x23')](respondWithResult(_0x5b2000,null))[_0xcd68('0x43')](handleError(_0x5b2000,null));};exports[_0xcd68('0x44')]=function(_0x12b098,_0x2d9d78){return db[_0xcd68('0x3c')][_0xcd68('0x44')](_0x12b098[_0xcd68('0x45')],{})[_0xcd68('0x23')](respondWithResult(_0x2d9d78,0xc9))[_0xcd68('0x43')](handleError(_0x2d9d78,null));};exports['update']=function(_0xaae0fb,_0x5c3316){if(_0xaae0fb[_0xcd68('0x45')]['id']){delete _0xaae0fb[_0xcd68('0x45')]['id'];}return db['VtigerAccount'][_0xcd68('0x42')]({'where':{'id':_0xaae0fb['params']['id']}})[_0xcd68('0x23')](handleEntityNotFound(_0x5c3316,null))[_0xcd68('0x23')](saveUpdates(_0xaae0fb[_0xcd68('0x45')],null))[_0xcd68('0x23')](respondWithResult(_0x5c3316,null))[_0xcd68('0x43')](handleError(_0x5c3316,null));};exports['destroy']=function(_0x18fe1d,_0x3b02cd){return db['VtigerAccount'][_0xcd68('0x42')]({'where':{'id':_0x18fe1d['params']['id']}})[_0xcd68('0x23')](handleEntityNotFound(_0x3b02cd,null))[_0xcd68('0x23')](removeEntity(_0x3b02cd,null))['catch'](handleError(_0x3b02cd,null));};exports[_0xcd68('0x46')]=function(_0x92f8b,_0x3aa528,_0x542408){var _0x3a93ac={};var _0x35aeae={};var _0x28162f;var _0x5bbaff;return db[_0xcd68('0x3c')][_0xcd68('0x47')]({'where':{'id':_0x92f8b[_0xcd68('0x48')]['id']}})['then'](handleEntityNotFound(_0x3aa528,null))[_0xcd68('0x23')](function(_0x583f0b){if(_0x583f0b){_0x28162f=_0x583f0b;_0x35aeae[_0xcd68('0x2c')]=_['keys'](db['VtigerConfiguration'][_0xcd68('0x28')]);_0x35aeae['query']=_[_0xcd68('0x2e')](_0x92f8b['query']);_0x35aeae[_0xcd68('0x2f')]=_[_0xcd68('0x30')](_0x35aeae[_0xcd68('0x2c')],_0x35aeae[_0xcd68('0x2d')]);_0x3a93ac[_0xcd68('0x31')]=_[_0xcd68('0x30')](_0x35aeae['model'],qs[_0xcd68('0x32')](_0x92f8b[_0xcd68('0x2d')][_0xcd68('0x32')]));_0x3a93ac[_0xcd68('0x31')]=_0x3a93ac[_0xcd68('0x31')]['length']?_0x3a93ac[_0xcd68('0x31')]:_0x35aeae[_0xcd68('0x2c')];_0x3a93ac[_0xcd68('0x49')]=qs[_0xcd68('0x35')](_0x92f8b['query']['sort']);_0x3a93ac[_0xcd68('0x36')]=qs['filters'](_[_0xcd68('0x37')](_0x92f8b[_0xcd68('0x2d')],_0x35aeae[_0xcd68('0x2f')]));if(_0x92f8b[_0xcd68('0x2d')]['filter']){_0x3a93ac[_0xcd68('0x36')]=_['merge'](_0x3a93ac[_0xcd68('0x36')],{'$or':_[_0xcd68('0x3a')](_0x3a93ac[_0xcd68('0x31')],function(_0x3c5f51){var _0x511f50={};_0x511f50[_0x3c5f51]={'$like':'%'+_0x92f8b['query'][_0xcd68('0x38')]+'%'};return _0x511f50;})});}_0x3a93ac=_[_0xcd68('0x39')]({},_0x3a93ac,_0x92f8b[_0xcd68('0x3b')]);return _0x28162f[_0xcd68('0x46')](_0x3a93ac);}})[_0xcd68('0x23')](function(_0x4a9710){if(_0x4a9710){_0x5bbaff=_0x4a9710[_0xcd68('0x33')];if(!_0x92f8b['query'][_0xcd68('0x34')](_0xcd68('0x4a'))){_0x3a93ac[_0xcd68('0x1d')]=qs[_0xcd68('0x1d')](_0x92f8b['query'][_0xcd68('0x1d')]);_0x3a93ac[_0xcd68('0x1a')]=qs[_0xcd68('0x1a')](_0x92f8b['query']['offset']);}return _0x28162f[_0xcd68('0x46')](_0x3a93ac);}})['then'](function(_0x36e866){if(_0x36e866){return _0x36e866?{'count':_0x5bbaff,'rows':_0x36e866}:null;}})[_0xcd68('0x23')](respondWithResult(_0x3aa528,null))[_0xcd68('0x43')](handleError(_0x3aa528,null));};exports['addConfiguration']=function(_0x1e8a0b,_0x20e1bd,_0x51e902){if(_0x1e8a0b[_0xcd68('0x45')]['id']){delete _0x1e8a0b[_0xcd68('0x45')]['id'];}return db[_0xcd68('0x3c')]['findOne']({'where':{'id':_0x1e8a0b['params']['id']}})[_0xcd68('0x23')](handleEntityNotFound(_0x20e1bd,null))['then'](function(_0x3e9dd5){if(_0x3e9dd5){_0x1e8a0b['body'][_0xcd68('0x4b')]=_0x3e9dd5['id'];_0x1e8a0b[_0xcd68('0x45')]['Subjects']=integrations['getSubjects'](_0x1e8a0b[_0xcd68('0x45')][_0xcd68('0x4c')],_0x1e8a0b[_0xcd68('0x45')]['type']);_0x1e8a0b[_0xcd68('0x45')][_0xcd68('0x4d')]=integrations[_0xcd68('0x4e')](_0x1e8a0b['body']['channel'],_0x1e8a0b[_0xcd68('0x45')][_0xcd68('0x2a')]);return db['VtigerConfiguration'][_0xcd68('0x44')](_0x1e8a0b['body'],{'include':[{'model':db[_0xcd68('0x4f')],'as':_0xcd68('0x50')},{'model':db[_0xcd68('0x4f')],'as':_0xcd68('0x4d')}]});}return null;})[_0xcd68('0x23')](respondWithResult(_0x20e1bd,null))[_0xcd68('0x43')](handleError(_0x20e1bd,null));};var md5=require(_0xcd68('0x51'));exports[_0xcd68('0x52')]=function(_0x4dc07b,_0xd75773,_0x2c4029){var _0x250951=null;var _0x3b1168=null;var _0x4b58c2=null;var _0x59668a=null;var _0x482f25='';return db[_0xcd68('0x3c')][_0xcd68('0x47')]({'where':{'id':_0x4dc07b[_0xcd68('0x48')]['id']},'attributes':['id',_0xcd68('0x26'),'username',_0xcd68('0x53'),_0xcd68('0x54'),'remoteUri',_0xcd68('0x55'),_0xcd68('0x56')]})[_0xcd68('0x23')](handleEntityNotFound(_0xd75773,null))[_0xcd68('0x23')](function(_0x3f9c4e){if(_0x3f9c4e){_0x250951=_0x3f9c4e[_0xcd68('0x57')];_0x3b1168=_0x3f9c4e[_0xcd68('0x56')];_0x4b58c2=_0x3f9c4e[_0xcd68('0x54')];_0x482f25=_0x3f9c4e[_0xcd68('0x58')];var _0x12a8a9=_0x482f25[_0xcd68('0x59')](-0x1);if(_0x12a8a9==='/'){_0x482f25=_0x482f25[_0xcd68('0x5a')](0x0,_0x482f25[_0xcd68('0x5b')](_0x12a8a9));}_0x59668a=util[_0xcd68('0x5c')]('%s/webservice.php',_0x482f25);var _0x31f493={'method':_0xcd68('0x5d'),'uri':_0x59668a,'qs':{'operation':'getchallenge','username':_0x3f9c4e['username']},'json':!![]};return rp(_0x31f493);}})[_0xcd68('0x23')](function(_0x37e939){if(_0x37e939['success']){var _0x722e17={'method':_0xcd68('0x5e'),'uri':_0x59668a,'form':{'operation':_0xcd68('0x5f'),'username':_0x250951,'accessKey':md5(_0x37e939[_0xcd68('0x60')]['token']+_0x3b1168)},'json':!![]};return rp(_0x722e17);}})['then'](function(_0x1018fa){if(_0x1018fa[_0xcd68('0x61')]){var _0x5e58d0={'method':_0xcd68('0x5d'),'uri':_0x59668a,'qs':{'operation':'describe','username':_0x250951,'sessionName':_0x1018fa['result'][_0xcd68('0x62')],'elementType':_0x4b58c2},'json':!![]};return rp(_0x5e58d0);}})['then'](function(_0x5d61c6){if(_0x5d61c6[_0xcd68('0x61')]){var _0x4cac28=[_0xcd68('0x63'),_0xcd68('0x64'),_0xcd68('0x65')];_[_0xcd68('0x66')](_0x5d61c6['result'][_0xcd68('0x32')],function(_0x579f93){return _0x4cac28[_0xcd68('0x67')](_0x579f93[_0xcd68('0x2a')]['name']);});_['remove'](_0x5d61c6['result'][_0xcd68('0x32')],function(_0x2e2fd8){return _0x2e2fd8[_0xcd68('0x68')]===_0xcd68('0x69');});return{'count':_0x5d61c6[_0xcd68('0x60')][_0xcd68('0x32')][_0xcd68('0x33')],'rows':_['map'](_0x5d61c6['result'][_0xcd68('0x32')],function(_0x196242){return{'id':_0x196242['name'],'name':_0x196242['label'],'custom':_[_0xcd68('0x6a')](_0x196242[_0xcd68('0x26')],_0xcd68('0x6b'))?!![]:![],'options':_0x196242[_0xcd68('0x2a')][_0xcd68('0x26')]===_0xcd68('0x6c')&&_0x196242['type'][_0xcd68('0x6d')]['length']>0x0?_[_0xcd68('0x3a')](_0x196242[_0xcd68('0x2a')]['picklistValues'],function(_0x2719a7){return{'name':_0x2719a7['label'],'value':_0x2719a7[_0xcd68('0x6e')]};}):[]};})};}})[_0xcd68('0x23')](respondWithResult(_0xd75773,null))['catch'](function(_0x14f278){console[_0xcd68('0x6f')](_0xcd68('0x70')+_0x14f278);var _0x367e16=_0x4dc07b[_0xcd68('0x2d')][_0xcd68('0x71')]?0x1f4:_0x14f278[_0xcd68('0x72')]||0x1f4;logger[_0xcd68('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x367e16,JSON[_0xcd68('0x73')](_0x14f278));delete _0x14f278['name'];if(_0x367e16===0x191){_0x367e16=0x190;}_0xd75773['status'](_0x367e16)[_0xcd68('0x27')](_0x4dc07b[_0xcd68('0x2d')]['test']?{'message':_0xcd68('0x74'),'statusCode':_0x14f278[_0xcd68('0x72')]}:_0x14f278);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5cca233..e0bc907 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 _0x9b09=['util','api','moment','request-promise','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x1e719d,_0x28be37){var _0x7e1c99=function(_0x550edf){while(--_0x550edf){_0x1e719d['push'](_0x1e719d['shift']());}};_0x7e1c99(++_0x28be37);}(_0x9b09,0x1ad));var _0x99b0=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0x9b09[_0x5a95fa];return _0x1a61b8;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var logger=require('../../config/logger')(_0x99b0('0x2'));var moment=require(_0x99b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x99b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99b0('0x5'));var config=require('../../config/environment');var attributes=require(_0x99b0('0x6'));var integrations=require(_0x99b0('0x7'));module['exports']=function(_0x466c23,_0x220c95){return _0x466c23['define'](_0x99b0('0x8'),attributes,{'tableName':_0x99b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc748=['../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerAccount.attributes','int_vtiger_accounts','util'];(function(_0x445d69,_0x5ab72f){var _0x28ede3=function(_0x5e113c){while(--_0x5e113c){_0x445d69['push'](_0x445d69['shift']());}};_0x28ede3(++_0x5ab72f);}(_0xc748,0x13a));var _0x8c74=function(_0x6c0b0a,_0x496391){_0x6c0b0a=_0x6c0b0a-0x0;var _0x5f456a=_0xc748[_0x6c0b0a];return _0x5f456a;};'use strict';var _=require('lodash');var util=require(_0x8c74('0x0'));var logger=require(_0x8c74('0x1'))(_0x8c74('0x2'));var moment=require(_0x8c74('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c74('0x4'));var fs=require('fs');var path=require(_0x8c74('0x5'));var rimraf=require(_0x8c74('0x6'));var config=require('../../config/environment');var attributes=require(_0x8c74('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x187800,_0x5f3a4c){return _0x187800['define']('VtigerAccount',attributes,{'tableName':_0x8c74('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index acb7145..578da10 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 _0xbdb7=['model','map','ShowVtigerAccount','find','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','options','raw','attributes','limit','include'];(function(_0x321ddc,_0x58f72a){var _0x277f53=function(_0x3ebc0e){while(--_0x3ebc0e){_0x321ddc['push'](_0x321ddc['shift']());}};_0x277f53(++_0x58f72a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4f3cf6,_0x1d8c0b){_0x4f3cf6=_0x4f3cf6-0x0;var _0x26309f=_0xbdb7[_0x4f3cf6];return _0x26309f;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}exports[_0x7bdb('0x15')]=function(_0x5723f4){var _0x2aff6a=this;return new Promise(function(_0x4ffd4b,_0x41f540){return db[_0x7bdb('0x16')]['findAll']({'raw':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')]['where']||null:null,'attributes':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x19')]||null:null,'limit':_0x5723f4['options']?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1a')]||null:null,'include':_0x5723f4[_0x7bdb('0x17')]?_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_['map'](_0x5723f4[_0x7bdb('0x17')][_0x7bdb('0x1b')],function(_0x40c447){return{'model':db[_0x40c447[_0x7bdb('0x1c')]],'as':_0x40c447['as'],'attributes':_0x40c447['attributes'],'include':_0x40c447['include']?_[_0x7bdb('0x1d')](_0x40c447['include'],function(_0x47abaf){return{'model':db[_0x47abaf['model']],'as':_0x47abaf['as'],'attributes':_0x47abaf[_0x7bdb('0x19')],'include':_0x47abaf['include']?_[_0x7bdb('0x1d')](_0x47abaf[_0x7bdb('0x1b')],function(_0x3ec129){return{'model':db[_0x3ec129[_0x7bdb('0x1c')]],'as':_0x3ec129['as'],'attributes':_0x3ec129[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10e818){logger[_0x7bdb('0xb')](_0x7bdb('0x15'),_0x5723f4);logger[_0x7bdb('0xe')](_0x7bdb('0x15'),_0x5723f4,JSON[_0x7bdb('0x10')](_0x10e818));_0x4ffd4b(_0x10e818);})[_0x7bdb('0x14')](function(_0xd2d7be){logger[_0x7bdb('0x11')](_0x7bdb('0x15'),_0xd2d7be[_0x7bdb('0x12')],_0x5723f4);_0x41f540(_0x2aff6a[_0x7bdb('0x11')](0x1f4,_0xd2d7be['message']));});});};exports[_0x7bdb('0x1e')]=function(_0x23fc3a){var _0x8f7672=this;return new Promise(function(_0x9f5c1,_0x29eac5){return db['VtigerAccount'][_0x7bdb('0x1f')]({'raw':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x18')]===undefined?!![]:![]:!![],'where':_0x23fc3a['options']?_0x23fc3a['options']['where']||null:null,'attributes':_0x23fc3a[_0x7bdb('0x17')]?_0x23fc3a['options'][_0x7bdb('0x19')]||null:null,'include':_0x23fc3a['options']?_0x23fc3a[_0x7bdb('0x17')][_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x23fc3a['options'][_0x7bdb('0x1b')],function(_0x514713){return{'model':db[_0x514713['model']],'as':_0x514713['as'],'attributes':_0x514713[_0x7bdb('0x19')],'include':_0x514713['include']?_[_0x7bdb('0x1d')](_0x514713['include'],function(_0x5ee47d){return{'model':db[_0x5ee47d[_0x7bdb('0x1c')]],'as':_0x5ee47d['as'],'attributes':_0x5ee47d[_0x7bdb('0x19')],'include':_0x5ee47d[_0x7bdb('0x1b')]?_[_0x7bdb('0x1d')](_0x5ee47d[_0x7bdb('0x1b')],function(_0x2bb28a){return{'model':db[_0x2bb28a['model']],'as':_0x2bb28a['as'],'attributes':_0x2bb28a[_0x7bdb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0x20')](function(_0x329ecf){logger[_0x7bdb('0xb')](_0x7bdb('0x1e'),_0x23fc3a);logger[_0x7bdb('0xe')](_0x7bdb('0x1e'),_0x23fc3a,JSON[_0x7bdb('0x10')](_0x329ecf));_0x9f5c1(_0x329ecf);})[_0x7bdb('0x14')](function(_0x4e1c97){logger['error'](_0x7bdb('0x1e'),_0x4e1c97[_0x7bdb('0x12')],_0x23fc3a);_0x29eac5(_0x8f7672[_0x7bdb('0x11')](0x1f4,_0x4e1c97[_0x7bdb('0x12')]));});});}; \ No newline at end of file +var _0x80ed=['then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVtigerAccount','VtigerAccount','find','raw','debug','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x80ed,0x11c));var _0xd80e=function(_0x47b55b,_0x34f16e){_0x47b55b=_0x47b55b-0x0;var _0x452eee=_0x80ed[_0x47b55b];return _0x452eee;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var moment=require(_0xd80e('0x1'));var BPromise=require(_0xd80e('0x2'));var rs=require(_0xd80e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd80e('0x4'))['db'];var utils=require(_0xd80e('0x5'));var logger=require(_0xd80e('0x6'))(_0xd80e('0x7'));var config=require('../../config/environment');var jayson=require(_0xd80e('0x8'));var client=jayson[_0xd80e('0x9')][_0xd80e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51c361,_0x411b3a,_0x438f7d){return new BPromise(function(_0x3b4f35,_0x1bacd3){return client[_0xd80e('0xb')](_0x51c361,_0x438f7d)[_0xd80e('0xc')](function(_0x3063ff){logger[_0xd80e('0xd')](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));logger['debug'](_0xd80e('0x10'),_0x411b3a,_0xd80e('0xf'),JSON[_0xd80e('0x11')](_0x3063ff));if(_0x3063ff[_0xd80e('0x12')]){if(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x13')]===0x1f4){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')]['message']);return _0x1bacd3(_0x3063ff['error']['message']);}logger['error'](_0xd80e('0xe'),_0x411b3a,_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);return _0x3b4f35(_0x3063ff[_0xd80e('0x12')][_0xd80e('0x14')]);}else{logger['info'](_0xd80e('0xe'),_0x411b3a,_0xd80e('0xf'));_0x3b4f35(_0x3063ff[_0xd80e('0x15')][_0xd80e('0x14')]);}})[_0xd80e('0x16')](function(_0xc25d82){logger[_0xd80e('0x12')](_0xd80e('0xe'),_0x411b3a,_0xc25d82);_0x1bacd3(_0xc25d82);});});}exports['GetVtigerAccount']=function(_0x21ceec){var _0x1cc576=this;return new Promise(function(_0x3b543d,_0x34e239){return db['VtigerAccount'][_0xd80e('0x17')]({'raw':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')]['attributes']||null:null,'limit':_0x21ceec['options']?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1a')]||null:null,'include':_0x21ceec[_0xd80e('0x18')]?_0x21ceec[_0xd80e('0x18')][_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x21ceec[_0xd80e('0x18')]['include'],function(_0x1fbf8a){return{'model':db[_0x1fbf8a[_0xd80e('0x1d')]],'as':_0x1fbf8a['as'],'attributes':_0x1fbf8a[_0xd80e('0x1e')],'include':_0x1fbf8a['include']?_[_0xd80e('0x1c')](_0x1fbf8a[_0xd80e('0x1b')],function(_0xe9bb59){return{'model':db[_0xe9bb59['model']],'as':_0xe9bb59['as'],'attributes':_0xe9bb59['attributes'],'include':_0xe9bb59['include']?_[_0xd80e('0x1c')](_0xe9bb59['include'],function(_0x9f9287){return{'model':db[_0x9f9287[_0xd80e('0x1d')]],'as':_0x9f9287['as'],'attributes':_0x9f9287['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0xe1c04a){logger[_0xd80e('0xd')](_0xd80e('0x1f'),_0x21ceec);logger['debug'](_0xd80e('0x1f'),_0x21ceec,JSON[_0xd80e('0x11')](_0xe1c04a));_0x3b543d(_0xe1c04a);})[_0xd80e('0x16')](function(_0x39088b){logger[_0xd80e('0x12')](_0xd80e('0x1f'),_0x39088b[_0xd80e('0x14')],_0x21ceec);_0x34e239(_0x1cc576[_0xd80e('0x12')](0x1f4,_0x39088b['message']));});});};exports['ShowVtigerAccount']=function(_0x30f9bd){var _0x1303eb=this;return new Promise(function(_0x400220,_0x32360c){return db[_0xd80e('0x20')][_0xd80e('0x21')]({'raw':_0x30f9bd['options']?_0x30f9bd['options'][_0xd80e('0x22')]===undefined?!![]:![]:!![],'where':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x19')]||null:null,'attributes':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1e')]||null:null,'include':_0x30f9bd[_0xd80e('0x18')]?_0x30f9bd['options']['include']?_[_0xd80e('0x1c')](_0x30f9bd[_0xd80e('0x18')][_0xd80e('0x1b')],function(_0x12d113){return{'model':db[_0x12d113[_0xd80e('0x1d')]],'as':_0x12d113['as'],'attributes':_0x12d113[_0xd80e('0x1e')],'include':_0x12d113[_0xd80e('0x1b')]?_[_0xd80e('0x1c')](_0x12d113[_0xd80e('0x1b')],function(_0x192c08){return{'model':db[_0x192c08['model']],'as':_0x192c08['as'],'attributes':_0x192c08[_0xd80e('0x1e')],'include':_0x192c08['include']?_[_0xd80e('0x1c')](_0x192c08[_0xd80e('0x1b')],function(_0x366b80){return{'model':db[_0x366b80[_0xd80e('0x1d')]],'as':_0x366b80['as'],'attributes':_0x366b80['attributes']};}):[]};}):[]};}):[]:[]})[_0xd80e('0xc')](function(_0x54a969){logger[_0xd80e('0xd')]('ShowVtigerAccount',_0x30f9bd);logger[_0xd80e('0x23')](_0xd80e('0x24'),_0x30f9bd,JSON['stringify'](_0x54a969));_0x400220(_0x54a969);})[_0xd80e('0x16')](function(_0x41ac0d){logger[_0xd80e('0x12')]('ShowVtigerAccount',_0x41ac0d[_0xd80e('0x14')],_0x30f9bd);_0x32360c(_0x1303eb[_0xd80e('0x12')](0x1f4,_0x41ac0d[_0xd80e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 584b80f..3c22d1d 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 _0x1100=['/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields'];(function(_0x18fd0b,_0xe0f9ed){var _0x3b19a3=function(_0xde37ae){while(--_0xde37ae){_0x18fd0b['push'](_0x18fd0b['shift']());}};_0x3b19a3(++_0xe0f9ed);}(_0x1100,0xbb));var _0x0110=function(_0x2f2436,_0x58092e){_0x2f2436=_0x2f2436-0x0;var _0x44883d=_0x1100[_0x2f2436];return _0x44883d;};'use strict';var multer=require(_0x0110('0x0'));var util=require(_0x0110('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0110('0x2'));var router=express[_0x0110('0x3')]();var fs_extra=require(_0x0110('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0110('0x5'));var config=require('../../config/environment');var controller=require(_0x0110('0x6'));router[_0x0110('0x7')]('/',auth[_0x0110('0x8')](),controller[_0x0110('0x9')]);router['get'](_0x0110('0xa'),auth[_0x0110('0x8')](),controller['show']);router['get'](_0x0110('0xb'),auth['isAuthenticated'](),controller[_0x0110('0xc')]);router['get']('/:id/subjects',auth[_0x0110('0x8')](),controller['getSubjects']);router['get'](_0x0110('0xd'),auth['isAuthenticated'](),controller[_0x0110('0xe')]);router[_0x0110('0xf')]('/',auth[_0x0110('0x8')](),controller[_0x0110('0x10')]);router[_0x0110('0x11')](_0x0110('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x0110('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0110('0x13')]=router; \ No newline at end of file +var _0x595d=['../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x595d,0x96));var _0xd595=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x595d[_0x146a85];return _0x1b59bf;};'use strict';var multer=require('multer');var util=require(_0xd595('0x0'));var path=require(_0xd595('0x1'));var timeout=require(_0xd595('0x2'));var express=require(_0xd595('0x3'));var router=express['Router']();var fs_extra=require(_0xd595('0x4'));var auth=require(_0xd595('0x5'));var interaction=require(_0xd595('0x6'));var config=require(_0xd595('0x7'));var controller=require(_0xd595('0x8'));router['get']('/',auth[_0xd595('0x9')](),controller[_0xd595('0xa')]);router[_0xd595('0xb')](_0xd595('0xc'),auth[_0xd595('0x9')](),controller[_0xd595('0xd')]);router[_0xd595('0xb')](_0xd595('0xe'),auth[_0xd595('0x9')](),controller[_0xd595('0xf')]);router['get']('/:id/subjects',auth[_0xd595('0x9')](),controller[_0xd595('0x10')]);router[_0xd595('0xb')](_0xd595('0x11'),auth[_0xd595('0x9')](),controller[_0xd595('0x12')]);router[_0xd595('0x13')]('/',auth[_0xd595('0x9')](),controller[_0xd595('0x14')]);router[_0xd595('0x15')](_0xd595('0xc'),auth[_0xd595('0x9')](),controller[_0xd595('0x16')]);router[_0xd595('0x17')](_0xd595('0xc'),auth[_0xd595('0x9')](),controller[_0xd595('0x18')]);module[_0xd595('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 52bdfd3..89fd1d2 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 _0xc7a2=['sequelize','exports','STRING'];(function(_0x2a3115,_0x184f8a){var _0x1b76bc=function(_0x5989e1){while(--_0x5989e1){_0x2a3115['push'](_0x2a3115['shift']());}};_0x1b76bc(++_0x184f8a);}(_0xc7a2,0x1bf));var _0x2c7a=function(_0x5880d8,_0x30b0a5){_0x5880d8=_0x5880d8-0x0;var _0x88264a=_0xc7a2[_0x5880d8];return _0x88264a;};'use strict';var Sequelize=require(_0x2c7a('0x0'));module[_0x2c7a('0x1')]={'name':{'type':Sequelize[_0x2c7a('0x2')]},'description':{'type':Sequelize[_0x2c7a('0x2')]}}; \ No newline at end of file +var _0x619c=['STRING','sequelize','exports'];(function(_0x23c206,_0x25ace7){var _0x35bdc1=function(_0xa419ce){while(--_0xa419ce){_0x23c206['push'](_0x23c206['shift']());}};_0x35bdc1(++_0x25ace7);}(_0x619c,0xb8));var _0xc619=function(_0x2e2fa6,_0x121fe8){_0x2e2fa6=_0x2e2fa6-0x0;var _0x80f241=_0x619c[_0x2e2fa6];return _0x80f241;};'use strict';var Sequelize=require(_0xc619('0x0'));module[_0xc619('0x1')]={'name':{'type':Sequelize[_0xc619('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8f60742..69e523b 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 _0xec60=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','intersection','fields','find','create','body','getFields','getSubjects','hasOwnProperty','getDescriptions','findOne','VtigerField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x2d88e5,_0x1dd741){var _0x30b0c8=function(_0x546658){while(--_0x546658){_0x2d88e5['push'](_0x2d88e5['shift']());}};_0x30b0c8(++_0x1dd741);}(_0xec60,0x1de));var _0x0ec6=function(_0x7082b4,_0x297880){_0x7082b4=_0x7082b4-0x0;var _0x325258=_0xec60[_0x7082b4];return _0x325258;};'use strict';var emlformat=require(_0x0ec6('0x0'));var rimraf=require(_0x0ec6('0x1'));var zipdir=require(_0x0ec6('0x2'));var jsonpatch=require(_0x0ec6('0x3'));var rp=require(_0x0ec6('0x4'));var moment=require(_0x0ec6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0ec6('0x6'));var util=require(_0x0ec6('0x7'));var path=require('path');var sox=require(_0x0ec6('0x8'));var csv=require('to-csv');var ejs=require(_0x0ec6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ec6('0xa'));var squel=require(_0x0ec6('0xb'));var crypto=require(_0x0ec6('0xc'));var jsforce=require(_0x0ec6('0xd'));var deskjs=require(_0x0ec6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0ec6('0xf'));var Papa=require(_0x0ec6('0x10'));var Redis=require(_0x0ec6('0x11'));var authService=require(_0x0ec6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0ec6('0x13'));var logger=require(_0x0ec6('0x14'))('api');var utils=require(_0x0ec6('0x15'));var config=require(_0x0ec6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ec6('0x17'))['db'];function respondWithStatusCode(_0x4afb40,_0x4d3630){_0x4d3630=_0x4d3630||0xcc;return function(_0x374366){if(_0x374366){return _0x4afb40[_0x0ec6('0x18')](_0x4d3630);}return _0x4afb40['status'](_0x4d3630)[_0x0ec6('0x19')]();};}function respondWithResult(_0x9ce720,_0x25a54a){_0x25a54a=_0x25a54a||0xc8;return function(_0x1e9614){if(_0x1e9614){return _0x9ce720[_0x0ec6('0x1a')](_0x25a54a)[_0x0ec6('0x1b')](_0x1e9614);}};}function respondWithFilteredResult(_0x3704d9,_0x5345c5){return function(_0x21459a){if(_0x21459a){var _0x327b15=typeof _0x5345c5[_0x0ec6('0x1c')]===_0x0ec6('0x1d')&&typeof _0x5345c5['limit']===_0x0ec6('0x1d');var _0x1a3e18=_0x21459a[_0x0ec6('0x1e')];var _0x57a1dc=_0x327b15?0x0:_0x5345c5[_0x0ec6('0x1c')];var _0x165f44=_0x327b15?_0x21459a[_0x0ec6('0x1e')]:_0x5345c5[_0x0ec6('0x1c')]+_0x5345c5['limit'];var _0x5687e3;if(_0x165f44>=_0x1a3e18){_0x165f44=_0x1a3e18;_0x5687e3=0xc8;}else{_0x5687e3=0xce;}_0x3704d9['status'](_0x5687e3);return _0x3704d9[_0x0ec6('0x1f')](_0x0ec6('0x20'),_0x57a1dc+'-'+_0x165f44+'/'+_0x1a3e18)[_0x0ec6('0x1b')](_0x21459a);}return null;};}function patchUpdates(_0x20bd82){return function(_0x245617){try{jsonpatch[_0x0ec6('0x21')](_0x245617,_0x20bd82,!![]);}catch(_0x1a1d4e){return BPromise[_0x0ec6('0x22')](_0x1a1d4e);}return _0x245617[_0x0ec6('0x23')]();};}function saveUpdates(_0x231d14,_0x3d8385){return function(_0x1498db){if(_0x1498db){return _0x1498db[_0x0ec6('0x24')](_0x231d14)[_0x0ec6('0x25')](function(_0x580a49){return _0x580a49;});}return null;};}function removeEntity(_0x58c20a,_0x37c49d){return function(_0x18f320){if(_0x18f320){return _0x18f320[_0x0ec6('0x26')]()[_0x0ec6('0x25')](function(){_0x58c20a[_0x0ec6('0x1a')](0xcc)[_0x0ec6('0x19')]();});}};}function handleEntityNotFound(_0x413087,_0x5e0e50){return function(_0x4ed8e4){if(!_0x4ed8e4){_0x413087[_0x0ec6('0x18')](0x194);}return _0x4ed8e4;};}function handleError(_0x110f80,_0x47db32){_0x47db32=_0x47db32||0x1f4;return function(_0x38103f){logger[_0x0ec6('0x27')](_0x38103f[_0x0ec6('0x28')]);if(_0x38103f[_0x0ec6('0x29')]){delete _0x38103f[_0x0ec6('0x29')];}_0x110f80[_0x0ec6('0x1a')](_0x47db32)[_0x0ec6('0x2a')](_0x38103f);};}exports[_0x0ec6('0x2b')]=function(_0x5718af,_0x560be4){var _0x4d6268={},_0x2f93e5={},_0x165bf6={'count':0x0,'rows':[]};var _0x143aea=_['map'](db[_0x0ec6('0x2c')][_0x0ec6('0x2d')],function(_0x34598b){return{'name':_0x34598b[_0x0ec6('0x2e')],'type':_0x34598b[_0x0ec6('0x2f')][_0x0ec6('0x30')]};});_0x2f93e5[_0x0ec6('0x31')]=_[_0x0ec6('0x32')](_0x143aea,_0x0ec6('0x29'));_0x2f93e5[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x5718af[_0x0ec6('0x33')]);_0x2f93e5[_0x0ec6('0x35')]=_['intersection'](_0x2f93e5['model'],_0x2f93e5['query']);_0x4d6268[_0x0ec6('0x36')]=_['intersection'](_0x2f93e5[_0x0ec6('0x31')],qs['fields'](_0x5718af[_0x0ec6('0x33')]['fields']));_0x4d6268[_0x0ec6('0x36')]=_0x4d6268[_0x0ec6('0x36')][_0x0ec6('0x37')]?_0x4d6268[_0x0ec6('0x36')]:_0x2f93e5[_0x0ec6('0x31')];if(!_0x5718af['query']['hasOwnProperty'](_0x0ec6('0x38'))){_0x4d6268['limit']=qs[_0x0ec6('0x39')](_0x5718af[_0x0ec6('0x33')]['limit']);_0x4d6268['offset']=qs['offset'](_0x5718af[_0x0ec6('0x33')][_0x0ec6('0x1c')]);}_0x4d6268[_0x0ec6('0x3a')]=qs[_0x0ec6('0x3b')](_0x5718af['query'][_0x0ec6('0x3b')]);_0x4d6268[_0x0ec6('0x3c')]=qs[_0x0ec6('0x35')](_[_0x0ec6('0x3d')](_0x5718af[_0x0ec6('0x33')],_0x2f93e5[_0x0ec6('0x35')]),_0x143aea);if(_0x5718af[_0x0ec6('0x33')][_0x0ec6('0x3e')]){_0x4d6268[_0x0ec6('0x3c')]=_[_0x0ec6('0x3f')](_0x4d6268[_0x0ec6('0x3c')],{'$or':_['map'](_0x143aea,function(_0x2cf010){if(_0x2cf010[_0x0ec6('0x2f')]!==_0x0ec6('0x40')){var _0x3221d9={};_0x3221d9[_0x2cf010['name']]={'$like':'%'+_0x5718af[_0x0ec6('0x33')][_0x0ec6('0x3e')]+'%'};return _0x3221d9;}})});}_0x4d6268=_[_0x0ec6('0x3f')]({},_0x4d6268,_0x5718af[_0x0ec6('0x41')]);var _0x1b9db8={'where':_0x4d6268['where']};return db[_0x0ec6('0x2c')]['count'](_0x1b9db8)[_0x0ec6('0x25')](function(_0x4e8a8b){_0x165bf6['count']=_0x4e8a8b;if(_0x5718af['query'][_0x0ec6('0x42')]){_0x4d6268[_0x0ec6('0x43')]=[{'all':!![]}];}return db[_0x0ec6('0x2c')]['findAll'](_0x4d6268);})[_0x0ec6('0x25')](function(_0x652e9d){_0x165bf6['rows']=_0x652e9d;return _0x165bf6;})[_0x0ec6('0x25')](respondWithFilteredResult(_0x560be4,_0x4d6268))[_0x0ec6('0x44')](handleError(_0x560be4,null));};exports[_0x0ec6('0x45')]=function(_0x4fb637,_0x30dc80){var _0x54cafd={'raw':![],'where':{'id':_0x4fb637[_0x0ec6('0x46')]['id']}},_0x3ca2c9={};_0x3ca2c9[_0x0ec6('0x31')]=_[_0x0ec6('0x34')](db[_0x0ec6('0x2c')][_0x0ec6('0x2d')]);_0x3ca2c9['query']=_[_0x0ec6('0x34')](_0x4fb637[_0x0ec6('0x33')]);_0x3ca2c9['filters']=_[_0x0ec6('0x47')](_0x3ca2c9[_0x0ec6('0x31')],_0x3ca2c9[_0x0ec6('0x33')]);_0x54cafd[_0x0ec6('0x36')]=_[_0x0ec6('0x47')](_0x3ca2c9[_0x0ec6('0x31')],qs[_0x0ec6('0x48')](_0x4fb637[_0x0ec6('0x33')][_0x0ec6('0x48')]));_0x54cafd[_0x0ec6('0x36')]=_0x54cafd[_0x0ec6('0x36')][_0x0ec6('0x37')]?_0x54cafd[_0x0ec6('0x36')]:_0x3ca2c9[_0x0ec6('0x31')];if(_0x4fb637[_0x0ec6('0x33')][_0x0ec6('0x42')]){_0x54cafd[_0x0ec6('0x43')]=[{'all':!![]}];}_0x54cafd=_['merge']({},_0x54cafd,_0x4fb637['options']);return db[_0x0ec6('0x2c')][_0x0ec6('0x49')](_0x54cafd)[_0x0ec6('0x25')](handleEntityNotFound(_0x30dc80,null))['then'](respondWithResult(_0x30dc80,null))[_0x0ec6('0x44')](handleError(_0x30dc80,null));};exports[_0x0ec6('0x4a')]=function(_0x31b7a3,_0x5f24a9){return db['VtigerConfiguration'][_0x0ec6('0x4a')](_0x31b7a3[_0x0ec6('0x4b')],{})[_0x0ec6('0x25')](respondWithResult(_0x5f24a9,0xc9))[_0x0ec6('0x44')](handleError(_0x5f24a9,null));};exports[_0x0ec6('0x24')]=function(_0x138926,_0x2d55fa){if(_0x138926['body']['id']){delete _0x138926[_0x0ec6('0x4b')]['id'];}return db[_0x0ec6('0x2c')][_0x0ec6('0x49')]({'where':{'id':_0x138926[_0x0ec6('0x46')]['id']}})[_0x0ec6('0x25')](handleEntityNotFound(_0x2d55fa,null))[_0x0ec6('0x25')](saveUpdates(_0x138926['body'],null))[_0x0ec6('0x25')](respondWithResult(_0x2d55fa,null))[_0x0ec6('0x44')](handleError(_0x2d55fa,null));};exports[_0x0ec6('0x26')]=function(_0x579587,_0x3f00f3){return db[_0x0ec6('0x2c')][_0x0ec6('0x49')]({'where':{'id':_0x579587['params']['id']}})[_0x0ec6('0x25')](handleEntityNotFound(_0x3f00f3,null))[_0x0ec6('0x25')](removeEntity(_0x3f00f3,null))[_0x0ec6('0x44')](handleError(_0x3f00f3,null));};exports[_0x0ec6('0x4c')]=function(_0x3cc7aa,_0x4109da,_0x4aa465){var _0x5ce82e={};var _0x2d854b={};var _0x19a1ef;var _0x1f9297;return db[_0x0ec6('0x2c')]['findOne']({'where':{'id':_0x3cc7aa[_0x0ec6('0x46')]['id']}})[_0x0ec6('0x25')](handleEntityNotFound(_0x4109da,null))[_0x0ec6('0x25')](function(_0x52c00a){if(_0x52c00a){_0x19a1ef=_0x52c00a;_0x2d854b[_0x0ec6('0x31')]=_[_0x0ec6('0x34')](db['VtigerField'][_0x0ec6('0x2d')]);_0x2d854b[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x3cc7aa['query']);_0x2d854b[_0x0ec6('0x35')]=_[_0x0ec6('0x47')](_0x2d854b[_0x0ec6('0x31')],_0x2d854b[_0x0ec6('0x33')]);_0x5ce82e[_0x0ec6('0x36')]=_[_0x0ec6('0x47')](_0x2d854b[_0x0ec6('0x31')],qs[_0x0ec6('0x48')](_0x3cc7aa[_0x0ec6('0x33')]['fields']));_0x5ce82e['attributes']=_0x5ce82e['attributes'][_0x0ec6('0x37')]?_0x5ce82e[_0x0ec6('0x36')]:_0x2d854b[_0x0ec6('0x31')];_0x5ce82e['order']=qs['sort'](_0x3cc7aa['query'][_0x0ec6('0x3b')]);_0x5ce82e[_0x0ec6('0x3c')]=qs['filters'](_[_0x0ec6('0x3d')](_0x3cc7aa[_0x0ec6('0x33')],_0x2d854b[_0x0ec6('0x35')]));if(_0x3cc7aa[_0x0ec6('0x33')]['filter']){_0x5ce82e[_0x0ec6('0x3c')]=_[_0x0ec6('0x3f')](_0x5ce82e['where'],{'$or':_['map'](_0x5ce82e['attributes'],function(_0x37fca0){var _0x3fb4e8={};_0x3fb4e8[_0x37fca0]={'$like':'%'+_0x3cc7aa['query']['filter']+'%'};return _0x3fb4e8;})});}_0x5ce82e=_[_0x0ec6('0x3f')]({},_0x5ce82e,_0x3cc7aa[_0x0ec6('0x41')]);return _0x19a1ef[_0x0ec6('0x4c')](_0x5ce82e);}})[_0x0ec6('0x25')](function(_0x57e671){if(_0x57e671){_0x1f9297=_0x57e671[_0x0ec6('0x37')];if(!_0x3cc7aa['query']['hasOwnProperty']('nolimit')){_0x5ce82e[_0x0ec6('0x39')]=qs[_0x0ec6('0x39')](_0x3cc7aa['query'][_0x0ec6('0x39')]);_0x5ce82e[_0x0ec6('0x1c')]=qs[_0x0ec6('0x1c')](_0x3cc7aa[_0x0ec6('0x33')][_0x0ec6('0x1c')]);}return _0x19a1ef['getFields'](_0x5ce82e);}})['then'](function(_0x87c83){if(_0x87c83){return _0x87c83?{'count':_0x1f9297,'rows':_0x87c83}:null;}})[_0x0ec6('0x25')](respondWithResult(_0x4109da,null))['catch'](handleError(_0x4109da,null));};exports[_0x0ec6('0x4d')]=function(_0x147425,_0x2314e4,_0x4a316a){var _0x72d4bc={};var _0x25d2fc={};var _0x5dae49;var _0x440bb9;return db[_0x0ec6('0x2c')]['findOne']({'where':{'id':_0x147425[_0x0ec6('0x46')]['id']}})[_0x0ec6('0x25')](handleEntityNotFound(_0x2314e4,null))['then'](function(_0x2dfe6e){if(_0x2dfe6e){_0x5dae49=_0x2dfe6e;_0x25d2fc[_0x0ec6('0x31')]=_[_0x0ec6('0x34')](db['VtigerField'][_0x0ec6('0x2d')]);_0x25d2fc[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x147425[_0x0ec6('0x33')]);_0x25d2fc['filters']=_[_0x0ec6('0x47')](_0x25d2fc[_0x0ec6('0x31')],_0x25d2fc['query']);_0x72d4bc['attributes']=_[_0x0ec6('0x47')](_0x25d2fc['model'],qs[_0x0ec6('0x48')](_0x147425[_0x0ec6('0x33')]['fields']));_0x72d4bc[_0x0ec6('0x36')]=_0x72d4bc['attributes'][_0x0ec6('0x37')]?_0x72d4bc[_0x0ec6('0x36')]:_0x25d2fc['model'];_0x72d4bc[_0x0ec6('0x3a')]=qs[_0x0ec6('0x3b')](_0x147425[_0x0ec6('0x33')][_0x0ec6('0x3b')]);_0x72d4bc[_0x0ec6('0x3c')]=qs[_0x0ec6('0x35')](_[_0x0ec6('0x3d')](_0x147425[_0x0ec6('0x33')],_0x25d2fc[_0x0ec6('0x35')]));if(_0x147425[_0x0ec6('0x33')][_0x0ec6('0x3e')]){_0x72d4bc[_0x0ec6('0x3c')]=_[_0x0ec6('0x3f')](_0x72d4bc[_0x0ec6('0x3c')],{'$or':_[_0x0ec6('0x32')](_0x72d4bc[_0x0ec6('0x36')],function(_0x34f02f){var _0x4c5352={};_0x4c5352[_0x34f02f]={'$like':'%'+_0x147425[_0x0ec6('0x33')][_0x0ec6('0x3e')]+'%'};return _0x4c5352;})});}_0x72d4bc=_['merge']({},_0x72d4bc,_0x147425[_0x0ec6('0x41')]);return _0x5dae49['getSubjects'](_0x72d4bc);}})[_0x0ec6('0x25')](function(_0x5a3341){if(_0x5a3341){_0x440bb9=_0x5a3341[_0x0ec6('0x37')];if(!_0x147425[_0x0ec6('0x33')][_0x0ec6('0x4e')](_0x0ec6('0x38'))){_0x72d4bc['limit']=qs[_0x0ec6('0x39')](_0x147425[_0x0ec6('0x33')][_0x0ec6('0x39')]);_0x72d4bc[_0x0ec6('0x1c')]=qs[_0x0ec6('0x1c')](_0x147425['query'][_0x0ec6('0x1c')]);}return _0x5dae49[_0x0ec6('0x4d')](_0x72d4bc);}})[_0x0ec6('0x25')](function(_0x1cb548){if(_0x1cb548){return _0x1cb548?{'count':_0x440bb9,'rows':_0x1cb548}:null;}})[_0x0ec6('0x25')](respondWithResult(_0x2314e4,null))[_0x0ec6('0x44')](handleError(_0x2314e4,null));};exports[_0x0ec6('0x4f')]=function(_0x2911f7,_0x3590cf,_0x3ba596){var _0xce47bb={};var _0xe1cd67={};var _0x59997d;var _0x40bc93;return db['VtigerConfiguration'][_0x0ec6('0x50')]({'where':{'id':_0x2911f7[_0x0ec6('0x46')]['id']}})[_0x0ec6('0x25')](handleEntityNotFound(_0x3590cf,null))[_0x0ec6('0x25')](function(_0x1fa9c6){if(_0x1fa9c6){_0x59997d=_0x1fa9c6;_0xe1cd67[_0x0ec6('0x31')]=_['keys'](db[_0x0ec6('0x51')]['rawAttributes']);_0xe1cd67[_0x0ec6('0x33')]=_[_0x0ec6('0x34')](_0x2911f7['query']);_0xe1cd67[_0x0ec6('0x35')]=_[_0x0ec6('0x47')](_0xe1cd67[_0x0ec6('0x31')],_0xe1cd67[_0x0ec6('0x33')]);_0xce47bb[_0x0ec6('0x36')]=_[_0x0ec6('0x47')](_0xe1cd67[_0x0ec6('0x31')],qs[_0x0ec6('0x48')](_0x2911f7[_0x0ec6('0x33')][_0x0ec6('0x48')]));_0xce47bb[_0x0ec6('0x36')]=_0xce47bb[_0x0ec6('0x36')][_0x0ec6('0x37')]?_0xce47bb[_0x0ec6('0x36')]:_0xe1cd67[_0x0ec6('0x31')];_0xce47bb[_0x0ec6('0x3a')]=qs[_0x0ec6('0x3b')](_0x2911f7['query'][_0x0ec6('0x3b')]);_0xce47bb[_0x0ec6('0x3c')]=qs[_0x0ec6('0x35')](_[_0x0ec6('0x3d')](_0x2911f7[_0x0ec6('0x33')],_0xe1cd67[_0x0ec6('0x35')]));if(_0x2911f7[_0x0ec6('0x33')][_0x0ec6('0x3e')]){_0xce47bb[_0x0ec6('0x3c')]=_[_0x0ec6('0x3f')](_0xce47bb[_0x0ec6('0x3c')],{'$or':_['map'](_0xce47bb[_0x0ec6('0x36')],function(_0x378bfb){var _0x2a5e3d={};_0x2a5e3d[_0x378bfb]={'$like':'%'+_0x2911f7[_0x0ec6('0x33')][_0x0ec6('0x3e')]+'%'};return _0x2a5e3d;})});}_0xce47bb=_[_0x0ec6('0x3f')]({},_0xce47bb,_0x2911f7['options']);return _0x59997d[_0x0ec6('0x4f')](_0xce47bb);}})[_0x0ec6('0x25')](function(_0x1e707f){if(_0x1e707f){_0x40bc93=_0x1e707f['length'];if(!_0x2911f7[_0x0ec6('0x33')]['hasOwnProperty'](_0x0ec6('0x38'))){_0xce47bb[_0x0ec6('0x39')]=qs[_0x0ec6('0x39')](_0x2911f7[_0x0ec6('0x33')][_0x0ec6('0x39')]);_0xce47bb['offset']=qs[_0x0ec6('0x1c')](_0x2911f7[_0x0ec6('0x33')][_0x0ec6('0x1c')]);}return _0x59997d[_0x0ec6('0x4f')](_0xce47bb);}})[_0x0ec6('0x25')](function(_0x4372c3){if(_0x4372c3){return _0x4372c3?{'count':_0x40bc93,'rows':_0x4372c3}:null;}})['then'](respondWithResult(_0x3590cf,null))[_0x0ec6('0x44')](handleError(_0x3590cf,null));}; \ No newline at end of file +var _0xa3d4=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','rows','catch','params','include','create','body','destroy','getFields','order','pick','getSubjects','findOne','getDescriptions','VtigerField','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x249caa,_0x56fe9e){var _0x10b94a=function(_0x563b33){while(--_0x563b33){_0x249caa['push'](_0x249caa['shift']());}};_0x10b94a(++_0x56fe9e);}(_0xa3d4,0x12e));var _0x4a3d=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xa3d4[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a3d('0x0'));var zipdir=require(_0x4a3d('0x1'));var jsonpatch=require(_0x4a3d('0x2'));var rp=require('request-promise');var moment=require(_0x4a3d('0x3'));var BPromise=require(_0x4a3d('0x4'));var Mustache=require(_0x4a3d('0x5'));var util=require(_0x4a3d('0x6'));var path=require(_0x4a3d('0x7'));var sox=require(_0x4a3d('0x8'));var csv=require(_0x4a3d('0x9'));var ejs=require(_0x4a3d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4a3d('0xb'));var squel=require(_0x4a3d('0xc'));var crypto=require(_0x4a3d('0xd'));var jsforce=require(_0x4a3d('0xe'));var deskjs=require(_0x4a3d('0xf'));var toCsv=require(_0x4a3d('0x9'));var querystring=require(_0x4a3d('0x10'));var Papa=require(_0x4a3d('0x11'));var Redis=require(_0x4a3d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4a3d('0x13'));var as=require(_0x4a3d('0x14'));var hardwareService=require(_0x4a3d('0x15'));var logger=require(_0x4a3d('0x16'))(_0x4a3d('0x17'));var utils=require('../../config/utils');var config=require(_0x4a3d('0x18'));var licenseUtil=require(_0x4a3d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57e9be,_0x4d9d3a){_0x4d9d3a=_0x4d9d3a||0xcc;return function(_0x48c787){if(_0x48c787){return _0x57e9be[_0x4a3d('0x1a')](_0x4d9d3a);}return _0x57e9be['status'](_0x4d9d3a)[_0x4a3d('0x1b')]();};}function respondWithResult(_0x3debb5,_0x263044){_0x263044=_0x263044||0xc8;return function(_0x32edc6){if(_0x32edc6){return _0x3debb5[_0x4a3d('0x1c')](_0x263044)[_0x4a3d('0x1d')](_0x32edc6);}};}function respondWithFilteredResult(_0x1d7bbc,_0x4e4e0b){return function(_0x40b9b5){if(_0x40b9b5){var _0x1542da=typeof _0x4e4e0b['offset']===_0x4a3d('0x1e')&&typeof _0x4e4e0b[_0x4a3d('0x1f')]===_0x4a3d('0x1e');var _0x9798a6=_0x40b9b5[_0x4a3d('0x20')];var _0x353846=_0x1542da?0x0:_0x4e4e0b['offset'];var _0x3962bc=_0x1542da?_0x40b9b5['count']:_0x4e4e0b[_0x4a3d('0x21')]+_0x4e4e0b[_0x4a3d('0x1f')];var _0x3bbe93;if(_0x3962bc>=_0x9798a6){_0x3962bc=_0x9798a6;_0x3bbe93=0xc8;}else{_0x3bbe93=0xce;}_0x1d7bbc[_0x4a3d('0x1c')](_0x3bbe93);return _0x1d7bbc[_0x4a3d('0x22')](_0x4a3d('0x23'),_0x353846+'-'+_0x3962bc+'/'+_0x9798a6)[_0x4a3d('0x1d')](_0x40b9b5);}return null;};}function patchUpdates(_0x581859){return function(_0xe8a64a){try{jsonpatch[_0x4a3d('0x24')](_0xe8a64a,_0x581859,!![]);}catch(_0x433df8){return BPromise[_0x4a3d('0x25')](_0x433df8);}return _0xe8a64a['save']();};}function saveUpdates(_0x3ce2d6,_0x19baae){return function(_0x152129){if(_0x152129){return _0x152129[_0x4a3d('0x26')](_0x3ce2d6)[_0x4a3d('0x27')](function(_0x1befe1){return _0x1befe1;});}return null;};}function removeEntity(_0x3d2eff,_0x5274fd){return function(_0x5117c1){if(_0x5117c1){return _0x5117c1['destroy']()[_0x4a3d('0x27')](function(){_0x3d2eff[_0x4a3d('0x1c')](0xcc)[_0x4a3d('0x1b')]();});}};}function handleEntityNotFound(_0x4de65b,_0xea1199){return function(_0x2f043d){if(!_0x2f043d){_0x4de65b[_0x4a3d('0x1a')](0x194);}return _0x2f043d;};}function handleError(_0x46eec2,_0x4a0f80){_0x4a0f80=_0x4a0f80||0x1f4;return function(_0x7be114){logger[_0x4a3d('0x28')](_0x7be114[_0x4a3d('0x29')]);if(_0x7be114[_0x4a3d('0x2a')]){delete _0x7be114['name'];}_0x46eec2['status'](_0x4a0f80)[_0x4a3d('0x2b')](_0x7be114);};}exports[_0x4a3d('0x2c')]=function(_0x42c9a6,_0xc0785a){var _0x360f76={},_0x41b804={},_0x3b9b40={'count':0x0,'rows':[]};var _0x24b821=_[_0x4a3d('0x2d')](db[_0x4a3d('0x2e')][_0x4a3d('0x2f')],function(_0x39cc1e){return{'name':_0x39cc1e[_0x4a3d('0x30')],'type':_0x39cc1e[_0x4a3d('0x31')][_0x4a3d('0x32')]};});_0x41b804['model']=_[_0x4a3d('0x2d')](_0x24b821,_0x4a3d('0x2a'));_0x41b804['query']=_[_0x4a3d('0x33')](_0x42c9a6[_0x4a3d('0x34')]);_0x41b804[_0x4a3d('0x35')]=_[_0x4a3d('0x36')](_0x41b804['model'],_0x41b804[_0x4a3d('0x34')]);_0x360f76[_0x4a3d('0x37')]=_[_0x4a3d('0x36')](_0x41b804['model'],qs[_0x4a3d('0x38')](_0x42c9a6[_0x4a3d('0x34')]['fields']));_0x360f76['attributes']=_0x360f76['attributes'][_0x4a3d('0x39')]?_0x360f76['attributes']:_0x41b804[_0x4a3d('0x3a')];if(!_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x3b')](_0x4a3d('0x3c'))){_0x360f76['limit']=qs['limit'](_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x1f')]);_0x360f76[_0x4a3d('0x21')]=qs[_0x4a3d('0x21')](_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x21')]);}_0x360f76['order']=qs['sort'](_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x3d')]);_0x360f76['where']=qs[_0x4a3d('0x35')](_['pick'](_0x42c9a6['query'],_0x41b804[_0x4a3d('0x35')]),_0x24b821);if(_0x42c9a6[_0x4a3d('0x34')]['filter']){_0x360f76[_0x4a3d('0x3e')]=_[_0x4a3d('0x3f')](_0x360f76[_0x4a3d('0x3e')],{'$or':_[_0x4a3d('0x2d')](_0x24b821,function(_0x338afd){if(_0x338afd[_0x4a3d('0x31')]!=='VIRTUAL'){var _0x58263a={};_0x58263a[_0x338afd[_0x4a3d('0x2a')]]={'$like':'%'+_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x40')]+'%'};return _0x58263a;}})});}_0x360f76=_[_0x4a3d('0x3f')]({},_0x360f76,_0x42c9a6[_0x4a3d('0x41')]);var _0x1711e7={'where':_0x360f76[_0x4a3d('0x3e')]};return db[_0x4a3d('0x2e')][_0x4a3d('0x20')](_0x1711e7)[_0x4a3d('0x27')](function(_0x3e4887){_0x3b9b40[_0x4a3d('0x20')]=_0x3e4887;if(_0x42c9a6[_0x4a3d('0x34')][_0x4a3d('0x42')]){_0x360f76['include']=[{'all':!![]}];}return db[_0x4a3d('0x2e')]['findAll'](_0x360f76);})[_0x4a3d('0x27')](function(_0x578719){_0x3b9b40[_0x4a3d('0x43')]=_0x578719;return _0x3b9b40;})[_0x4a3d('0x27')](respondWithFilteredResult(_0xc0785a,_0x360f76))[_0x4a3d('0x44')](handleError(_0xc0785a,null));};exports['show']=function(_0x364c29,_0x36dc2){var _0x37108c={'raw':![],'where':{'id':_0x364c29[_0x4a3d('0x45')]['id']}},_0x4bd2bc={};_0x4bd2bc[_0x4a3d('0x3a')]=_[_0x4a3d('0x33')](db[_0x4a3d('0x2e')][_0x4a3d('0x2f')]);_0x4bd2bc[_0x4a3d('0x34')]=_[_0x4a3d('0x33')](_0x364c29['query']);_0x4bd2bc[_0x4a3d('0x35')]=_[_0x4a3d('0x36')](_0x4bd2bc[_0x4a3d('0x3a')],_0x4bd2bc['query']);_0x37108c[_0x4a3d('0x37')]=_[_0x4a3d('0x36')](_0x4bd2bc['model'],qs['fields'](_0x364c29[_0x4a3d('0x34')][_0x4a3d('0x38')]));_0x37108c[_0x4a3d('0x37')]=_0x37108c[_0x4a3d('0x37')][_0x4a3d('0x39')]?_0x37108c['attributes']:_0x4bd2bc[_0x4a3d('0x3a')];if(_0x364c29[_0x4a3d('0x34')]['includeAll']){_0x37108c[_0x4a3d('0x46')]=[{'all':!![]}];}_0x37108c=_[_0x4a3d('0x3f')]({},_0x37108c,_0x364c29[_0x4a3d('0x41')]);return db[_0x4a3d('0x2e')]['find'](_0x37108c)[_0x4a3d('0x27')](handleEntityNotFound(_0x36dc2,null))[_0x4a3d('0x27')](respondWithResult(_0x36dc2,null))['catch'](handleError(_0x36dc2,null));};exports[_0x4a3d('0x47')]=function(_0x5213db,_0x4bebb6){return db[_0x4a3d('0x2e')][_0x4a3d('0x47')](_0x5213db[_0x4a3d('0x48')],{})[_0x4a3d('0x27')](respondWithResult(_0x4bebb6,0xc9))[_0x4a3d('0x44')](handleError(_0x4bebb6,null));};exports[_0x4a3d('0x26')]=function(_0x40c156,_0x499f14){if(_0x40c156[_0x4a3d('0x48')]['id']){delete _0x40c156[_0x4a3d('0x48')]['id'];}return db[_0x4a3d('0x2e')]['find']({'where':{'id':_0x40c156[_0x4a3d('0x45')]['id']}})['then'](handleEntityNotFound(_0x499f14,null))['then'](saveUpdates(_0x40c156['body'],null))[_0x4a3d('0x27')](respondWithResult(_0x499f14,null))[_0x4a3d('0x44')](handleError(_0x499f14,null));};exports[_0x4a3d('0x49')]=function(_0x5aff22,_0x9118bf){return db[_0x4a3d('0x2e')]['find']({'where':{'id':_0x5aff22[_0x4a3d('0x45')]['id']}})['then'](handleEntityNotFound(_0x9118bf,null))[_0x4a3d('0x27')](removeEntity(_0x9118bf,null))[_0x4a3d('0x44')](handleError(_0x9118bf,null));};exports[_0x4a3d('0x4a')]=function(_0x16ca5b,_0x8ad5c3,_0x2952a3){var _0x7c0eae={};var _0xa87154={};var _0x4b0d32;var _0x18b1bb;return db[_0x4a3d('0x2e')]['findOne']({'where':{'id':_0x16ca5b['params']['id']}})['then'](handleEntityNotFound(_0x8ad5c3,null))[_0x4a3d('0x27')](function(_0x25c0c0){if(_0x25c0c0){_0x4b0d32=_0x25c0c0;_0xa87154[_0x4a3d('0x3a')]=_[_0x4a3d('0x33')](db['VtigerField'][_0x4a3d('0x2f')]);_0xa87154[_0x4a3d('0x34')]=_[_0x4a3d('0x33')](_0x16ca5b[_0x4a3d('0x34')]);_0xa87154[_0x4a3d('0x35')]=_[_0x4a3d('0x36')](_0xa87154[_0x4a3d('0x3a')],_0xa87154[_0x4a3d('0x34')]);_0x7c0eae[_0x4a3d('0x37')]=_[_0x4a3d('0x36')](_0xa87154['model'],qs[_0x4a3d('0x38')](_0x16ca5b[_0x4a3d('0x34')][_0x4a3d('0x38')]));_0x7c0eae['attributes']=_0x7c0eae[_0x4a3d('0x37')]['length']?_0x7c0eae['attributes']:_0xa87154[_0x4a3d('0x3a')];_0x7c0eae[_0x4a3d('0x4b')]=qs['sort'](_0x16ca5b[_0x4a3d('0x34')][_0x4a3d('0x3d')]);_0x7c0eae[_0x4a3d('0x3e')]=qs[_0x4a3d('0x35')](_[_0x4a3d('0x4c')](_0x16ca5b[_0x4a3d('0x34')],_0xa87154[_0x4a3d('0x35')]));if(_0x16ca5b['query']['filter']){_0x7c0eae[_0x4a3d('0x3e')]=_[_0x4a3d('0x3f')](_0x7c0eae[_0x4a3d('0x3e')],{'$or':_[_0x4a3d('0x2d')](_0x7c0eae[_0x4a3d('0x37')],function(_0x1cb97d){var _0x482dfb={};_0x482dfb[_0x1cb97d]={'$like':'%'+_0x16ca5b[_0x4a3d('0x34')]['filter']+'%'};return _0x482dfb;})});}_0x7c0eae=_['merge']({},_0x7c0eae,_0x16ca5b[_0x4a3d('0x41')]);return _0x4b0d32[_0x4a3d('0x4a')](_0x7c0eae);}})[_0x4a3d('0x27')](function(_0x329b57){if(_0x329b57){_0x18b1bb=_0x329b57[_0x4a3d('0x39')];if(!_0x16ca5b[_0x4a3d('0x34')][_0x4a3d('0x3b')]('nolimit')){_0x7c0eae['limit']=qs[_0x4a3d('0x1f')](_0x16ca5b['query']['limit']);_0x7c0eae['offset']=qs['offset'](_0x16ca5b[_0x4a3d('0x34')][_0x4a3d('0x21')]);}return _0x4b0d32[_0x4a3d('0x4a')](_0x7c0eae);}})[_0x4a3d('0x27')](function(_0x38d62a){if(_0x38d62a){return _0x38d62a?{'count':_0x18b1bb,'rows':_0x38d62a}:null;}})[_0x4a3d('0x27')](respondWithResult(_0x8ad5c3,null))[_0x4a3d('0x44')](handleError(_0x8ad5c3,null));};exports[_0x4a3d('0x4d')]=function(_0x432adc,_0x50f86a,_0x553781){var _0x223a67={};var _0xfabf62={};var _0x146992;var _0x1b2eff;return db['VtigerConfiguration'][_0x4a3d('0x4e')]({'where':{'id':_0x432adc['params']['id']}})[_0x4a3d('0x27')](handleEntityNotFound(_0x50f86a,null))[_0x4a3d('0x27')](function(_0x2354fc){if(_0x2354fc){_0x146992=_0x2354fc;_0xfabf62[_0x4a3d('0x3a')]=_['keys'](db['VtigerField']['rawAttributes']);_0xfabf62[_0x4a3d('0x34')]=_[_0x4a3d('0x33')](_0x432adc[_0x4a3d('0x34')]);_0xfabf62['filters']=_[_0x4a3d('0x36')](_0xfabf62[_0x4a3d('0x3a')],_0xfabf62[_0x4a3d('0x34')]);_0x223a67['attributes']=_[_0x4a3d('0x36')](_0xfabf62['model'],qs[_0x4a3d('0x38')](_0x432adc['query'][_0x4a3d('0x38')]));_0x223a67[_0x4a3d('0x37')]=_0x223a67[_0x4a3d('0x37')][_0x4a3d('0x39')]?_0x223a67[_0x4a3d('0x37')]:_0xfabf62[_0x4a3d('0x3a')];_0x223a67[_0x4a3d('0x4b')]=qs['sort'](_0x432adc[_0x4a3d('0x34')][_0x4a3d('0x3d')]);_0x223a67['where']=qs[_0x4a3d('0x35')](_[_0x4a3d('0x4c')](_0x432adc[_0x4a3d('0x34')],_0xfabf62[_0x4a3d('0x35')]));if(_0x432adc[_0x4a3d('0x34')][_0x4a3d('0x40')]){_0x223a67[_0x4a3d('0x3e')]=_['merge'](_0x223a67['where'],{'$or':_[_0x4a3d('0x2d')](_0x223a67[_0x4a3d('0x37')],function(_0xcc87df){var _0x3b9f96={};_0x3b9f96[_0xcc87df]={'$like':'%'+_0x432adc[_0x4a3d('0x34')]['filter']+'%'};return _0x3b9f96;})});}_0x223a67=_['merge']({},_0x223a67,_0x432adc[_0x4a3d('0x41')]);return _0x146992[_0x4a3d('0x4d')](_0x223a67);}})[_0x4a3d('0x27')](function(_0x2c13ab){if(_0x2c13ab){_0x1b2eff=_0x2c13ab[_0x4a3d('0x39')];if(!_0x432adc[_0x4a3d('0x34')][_0x4a3d('0x3b')](_0x4a3d('0x3c'))){_0x223a67[_0x4a3d('0x1f')]=qs[_0x4a3d('0x1f')](_0x432adc[_0x4a3d('0x34')]['limit']);_0x223a67[_0x4a3d('0x21')]=qs[_0x4a3d('0x21')](_0x432adc['query'][_0x4a3d('0x21')]);}return _0x146992[_0x4a3d('0x4d')](_0x223a67);}})[_0x4a3d('0x27')](function(_0x59512e){if(_0x59512e){return _0x59512e?{'count':_0x1b2eff,'rows':_0x59512e}:null;}})[_0x4a3d('0x27')](respondWithResult(_0x50f86a,null))[_0x4a3d('0x44')](handleError(_0x50f86a,null));};exports[_0x4a3d('0x4f')]=function(_0x2dbd32,_0xfe882f,_0x190a32){var _0x4b43be={};var _0xb8a403={};var _0x2f5676;var _0x2f2a44;return db[_0x4a3d('0x2e')][_0x4a3d('0x4e')]({'where':{'id':_0x2dbd32['params']['id']}})['then'](handleEntityNotFound(_0xfe882f,null))['then'](function(_0x47b1c9){if(_0x47b1c9){_0x2f5676=_0x47b1c9;_0xb8a403[_0x4a3d('0x3a')]=_[_0x4a3d('0x33')](db[_0x4a3d('0x50')][_0x4a3d('0x2f')]);_0xb8a403[_0x4a3d('0x34')]=_['keys'](_0x2dbd32[_0x4a3d('0x34')]);_0xb8a403[_0x4a3d('0x35')]=_['intersection'](_0xb8a403[_0x4a3d('0x3a')],_0xb8a403[_0x4a3d('0x34')]);_0x4b43be['attributes']=_[_0x4a3d('0x36')](_0xb8a403['model'],qs[_0x4a3d('0x38')](_0x2dbd32['query'][_0x4a3d('0x38')]));_0x4b43be['attributes']=_0x4b43be[_0x4a3d('0x37')][_0x4a3d('0x39')]?_0x4b43be[_0x4a3d('0x37')]:_0xb8a403[_0x4a3d('0x3a')];_0x4b43be[_0x4a3d('0x4b')]=qs[_0x4a3d('0x3d')](_0x2dbd32[_0x4a3d('0x34')][_0x4a3d('0x3d')]);_0x4b43be[_0x4a3d('0x3e')]=qs[_0x4a3d('0x35')](_[_0x4a3d('0x4c')](_0x2dbd32[_0x4a3d('0x34')],_0xb8a403[_0x4a3d('0x35')]));if(_0x2dbd32[_0x4a3d('0x34')][_0x4a3d('0x40')]){_0x4b43be[_0x4a3d('0x3e')]=_[_0x4a3d('0x3f')](_0x4b43be['where'],{'$or':_[_0x4a3d('0x2d')](_0x4b43be['attributes'],function(_0xc45db1){var _0x1f8090={};_0x1f8090[_0xc45db1]={'$like':'%'+_0x2dbd32[_0x4a3d('0x34')][_0x4a3d('0x40')]+'%'};return _0x1f8090;})});}_0x4b43be=_[_0x4a3d('0x3f')]({},_0x4b43be,_0x2dbd32[_0x4a3d('0x41')]);return _0x2f5676[_0x4a3d('0x4f')](_0x4b43be);}})['then'](function(_0x50c47b){if(_0x50c47b){_0x2f2a44=_0x50c47b[_0x4a3d('0x39')];if(!_0x2dbd32['query'][_0x4a3d('0x3b')](_0x4a3d('0x3c'))){_0x4b43be[_0x4a3d('0x1f')]=qs[_0x4a3d('0x1f')](_0x2dbd32[_0x4a3d('0x34')][_0x4a3d('0x1f')]);_0x4b43be['offset']=qs[_0x4a3d('0x21')](_0x2dbd32['query'][_0x4a3d('0x21')]);}return _0x2f5676[_0x4a3d('0x4f')](_0x4b43be);}})[_0x4a3d('0x27')](function(_0x5011fc){if(_0x5011fc){return _0x5011fc?{'count':_0x2f2a44,'rows':_0x5011fc}:null;}})[_0x4a3d('0x27')](respondWithResult(_0xfe882f,null))[_0x4a3d('0x44')](handleError(_0xfe882f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index fec20e5..780bffd 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 _0x9ef8=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9ef8,0x1b3));var _0x89ef=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x9ef8[_0x1bb6aa];return _0x2ef28e;};'use strict';var _=require(_0x89ef('0x0'));var util=require(_0x89ef('0x1'));var logger=require(_0x89ef('0x2'))(_0x89ef('0x3'));var moment=require(_0x89ef('0x4'));var BPromise=require(_0x89ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x89ef('0x6'));var rimraf=require(_0x89ef('0x7'));var config=require(_0x89ef('0x8'));var attributes=require(_0x89ef('0x9'));module[_0x89ef('0xa')]=function(_0x5562b5,_0x30b63b){return _0x5562b5[_0x89ef('0xb')]('VtigerConfiguration',attributes,{'tableName':_0x89ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4da=['exports','VtigerConfiguration','lodash','util','../../config/logger','request-promise','../../config/environment'];(function(_0x4808d3,_0x3353c6){var _0x3057fa=function(_0x535a58){while(--_0x535a58){_0x4808d3['push'](_0x4808d3['shift']());}};_0x3057fa(++_0x3353c6);}(_0xd4da,0xe2));var _0xad4d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xd4da[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xad4d('0x0'));var util=require(_0xad4d('0x1'));var logger=require(_0xad4d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad4d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xad4d('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module[_0xad4d('0x5')]=function(_0x33dadc,_0x3849ff){return _0x33dadc['define'](_0xad4d('0x6'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 28638b9..1e0d465 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 _0x3150=['then','info','request\x20sent','debug','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x3150,0x171));var _0x0315=function(_0x4a1b76,_0x399f09){_0x4a1b76=_0x4a1b76-0x0;var _0x24feb3=_0x3150[_0x4a1b76];return _0x24feb3;};'use strict';var _=require('lodash');var util=require(_0x0315('0x0'));var moment=require(_0x0315('0x1'));var BPromise=require(_0x0315('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0315('0x3'));var db=require(_0x0315('0x4'))['db'];var utils=require(_0x0315('0x5'));var logger=require(_0x0315('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0315('0x7'));var client=jayson[_0x0315('0x8')][_0x0315('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b2e96,_0x33e02d,_0x136053){return new BPromise(function(_0x3c502d,_0x30e196){return client[_0x0315('0xa')](_0x1b2e96,_0x136053)[_0x0315('0xb')](function(_0xf425ed){logger[_0x0315('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x33e02d,_0x0315('0xd'));logger[_0x0315('0xe')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x33e02d,_0x0315('0xd'),JSON[_0x0315('0xf')](_0xf425ed));if(_0xf425ed[_0x0315('0x10')]){if(_0xf425ed[_0x0315('0x10')][_0x0315('0x11')]===0x1f4){logger[_0x0315('0x10')](_0x0315('0x12'),_0x33e02d,_0xf425ed['error'][_0x0315('0x13')]);return _0x30e196(_0xf425ed[_0x0315('0x10')][_0x0315('0x13')]);}logger[_0x0315('0x10')](_0x0315('0x12'),_0x33e02d,_0xf425ed[_0x0315('0x10')][_0x0315('0x13')]);return _0x3c502d(_0xf425ed[_0x0315('0x10')][_0x0315('0x13')]);}else{logger[_0x0315('0xc')](_0x0315('0x12'),_0x33e02d,_0x0315('0xd'));_0x3c502d(_0xf425ed['result']['message']);}})['catch'](function(_0x45cf12){logger[_0x0315('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x33e02d,_0x45cf12);_0x30e196(_0x45cf12);});});} \ No newline at end of file +var _0x6e0e=['jayson/promise','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x325649,_0x7d503a){var _0xe98e9d=function(_0x122f4b){while(--_0x122f4b){_0x325649['push'](_0x325649['shift']());}};_0xe98e9d(++_0x7d503a);}(_0x6e0e,0x16d));var _0xe6e0=function(_0x30443c,_0x40ad66){_0x30443c=_0x30443c-0x0;var _0x39ce16=_0x6e0e[_0x30443c];return _0x39ce16;};'use strict';var _=require(_0xe6e0('0x0'));var util=require(_0xe6e0('0x1'));var moment=require(_0xe6e0('0x2'));var BPromise=require(_0xe6e0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6e0('0x4'));var db=require(_0xe6e0('0x5'))['db'];var utils=require(_0xe6e0('0x6'));var logger=require(_0xe6e0('0x7'))('rpc');var config=require(_0xe6e0('0x8'));var jayson=require(_0xe6e0('0x9'));var client=jayson['client'][_0xe6e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb43a9d,_0x12ba83,_0x18987e){return new BPromise(function(_0x40c474,_0x211920){return client['request'](_0xb43a9d,_0x18987e)[_0xe6e0('0xb')](function(_0x26fc0c){logger[_0xe6e0('0xc')](_0xe6e0('0xd'),_0x12ba83,_0xe6e0('0xe'));logger[_0xe6e0('0xf')](_0xe6e0('0x10'),_0x12ba83,_0xe6e0('0xe'),JSON[_0xe6e0('0x11')](_0x26fc0c));if(_0x26fc0c['error']){if(_0x26fc0c['error']['code']===0x1f4){logger[_0xe6e0('0x12')](_0xe6e0('0xd'),_0x12ba83,_0x26fc0c[_0xe6e0('0x12')][_0xe6e0('0x13')]);return _0x211920(_0x26fc0c[_0xe6e0('0x12')][_0xe6e0('0x13')]);}logger['error'](_0xe6e0('0xd'),_0x12ba83,_0x26fc0c[_0xe6e0('0x12')][_0xe6e0('0x13')]);return _0x40c474(_0x26fc0c[_0xe6e0('0x12')][_0xe6e0('0x13')]);}else{logger[_0xe6e0('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x12ba83,'request\x20sent');_0x40c474(_0x26fc0c[_0xe6e0('0x14')][_0xe6e0('0x13')]);}})[_0xe6e0('0x15')](function(_0x5eeece){logger['error'](_0xe6e0('0xd'),_0x12ba83,_0x5eeece);_0x211920(_0x5eeece);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 6678280..56c5f1b 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 _0xc54d=['isAuthenticated','index','get','show','put','/:id','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2e3def,_0x762a41){var _0x2e3f77=function(_0x56e861){while(--_0x56e861){_0x2e3def['push'](_0x2e3def['shift']());}};_0x2e3f77(++_0x762a41);}(_0xc54d,0x179));var _0xdc54=function(_0x521f06,_0x1f8e7c){_0x521f06=_0x521f06-0x0;var _0x410a40=_0xc54d[_0x521f06];return _0x410a40;};'use strict';var multer=require(_0xdc54('0x0'));var util=require(_0xdc54('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdc54('0x2')]();var fs_extra=require(_0xdc54('0x3'));var auth=require(_0xdc54('0x4'));var interaction=require(_0xdc54('0x5'));var config=require(_0xdc54('0x6'));var controller=require('./intVtigerField.controller');router['get']('/',auth[_0xdc54('0x7')](),controller[_0xdc54('0x8')]);router[_0xdc54('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdc54('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdc54('0xb')](_0xdc54('0xc'),auth[_0xdc54('0x7')](),controller[_0xdc54('0xd')]);router[_0xdc54('0xe')](_0xdc54('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xdc54('0xf')]=router; \ No newline at end of file +var _0xa3a8=['./intVtigerField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x41d698,_0x34699e){var _0x3cdfb7=function(_0x3dad9a){while(--_0x3dad9a){_0x41d698['push'](_0x41d698['shift']());}};_0x3cdfb7(++_0x34699e);}(_0xa3a8,0xa4));var _0x8a3a=function(_0x29b98e,_0x4cb2a1){_0x29b98e=_0x29b98e-0x0;var _0x2b0980=_0xa3a8[_0x29b98e];return _0x2b0980;};'use strict';var multer=require(_0x8a3a('0x0'));var util=require('util');var path=require(_0x8a3a('0x1'));var timeout=require(_0x8a3a('0x2'));var express=require(_0x8a3a('0x3'));var router=express[_0x8a3a('0x4')]();var fs_extra=require(_0x8a3a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8a3a('0x6'));var controller=require(_0x8a3a('0x7'));router[_0x8a3a('0x8')]('/',auth[_0x8a3a('0x9')](),controller[_0x8a3a('0xa')]);router[_0x8a3a('0x8')](_0x8a3a('0xb'),auth[_0x8a3a('0x9')](),controller['show']);router[_0x8a3a('0xc')]('/',auth[_0x8a3a('0x9')](),controller[_0x8a3a('0xd')]);router[_0x8a3a('0xe')](_0x8a3a('0xb'),auth[_0x8a3a('0x9')](),controller[_0x8a3a('0xf')]);router[_0x8a3a('0x10')](_0x8a3a('0xb'),auth[_0x8a3a('0x9')](),controller[_0x8a3a('0x11')]);module[_0x8a3a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1a657f8..934e5ef 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 _0x77f2=['BOOLEAN','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x77f2,0x135));var _0x277f=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x77f2[_0x220f3f];return _0x1f170e;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x277f('0x0')](_0x277f('0x1'),_0x277f('0x2'),_0x277f('0x3'),_0x277f('0x4'),'picklist'),'defaultValue':_0x277f('0x1')},'content':{'type':Sequelize[_0x277f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x277f('0x0')]('string',_0x277f('0x2'),_0x277f('0x3'))},'keyContent':{'type':Sequelize[_0x277f('0x5')]},'idField':{'type':Sequelize[_0x277f('0x5')]},'nameField':{'type':Sequelize[_0x277f('0x5')]},'customField':{'type':Sequelize[_0x277f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x277f('0x5')]}}; \ No newline at end of file +var _0x80fa=['customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x14f959,_0x47f64d){var _0x31de4c=function(_0x3d2dc3){while(--_0x3d2dc3){_0x14f959['push'](_0x14f959['shift']());}};_0x31de4c(++_0x47f64d);}(_0x80fa,0x124));var _0xa80f=function(_0x32a667,_0x231149){_0x32a667=_0x32a667-0x0;var _0x56d220=_0x80fa[_0x32a667];return _0x56d220;};'use strict';var Sequelize=require(_0xa80f('0x0'));module['exports']={'type':{'type':Sequelize[_0xa80f('0x1')](_0xa80f('0x2'),_0xa80f('0x3'),_0xa80f('0x4'),_0xa80f('0x5'),'picklist'),'defaultValue':_0xa80f('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa80f('0x6')]},'keyType':{'type':Sequelize[_0xa80f('0x1')](_0xa80f('0x2'),_0xa80f('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa80f('0x6')]},'idField':{'type':Sequelize[_0xa80f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa80f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa80f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 860ff2b..6fdca33 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 _0xabed=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','catch','show','params','includeAll','include','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','Content-Range','reject','save','then','destroy','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key'];(function(_0x4425b1,_0x5819e5){var _0x2cb6ab=function(_0x40f084){while(--_0x40f084){_0x4425b1['push'](_0x4425b1['shift']());}};_0x2cb6ab(++_0x5819e5);}(_0xabed,0xab));var _0xdabe=function(_0x5de214,_0x107e9d){_0x5de214=_0x5de214-0x0;var _0x4df627=_0xabed[_0x5de214];return _0x4df627;};'use strict';var emlformat=require(_0xdabe('0x0'));var rimraf=require(_0xdabe('0x1'));var zipdir=require(_0xdabe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdabe('0x3'));var BPromise=require(_0xdabe('0x4'));var Mustache=require('mustache');var util=require(_0xdabe('0x5'));var path=require(_0xdabe('0x6'));var sox=require('sox');var csv=require(_0xdabe('0x7'));var ejs=require(_0xdabe('0x8'));var fs=require('fs');var fs_extra=require(_0xdabe('0x9'));var _=require(_0xdabe('0xa'));var squel=require(_0xdabe('0xb'));var crypto=require(_0xdabe('0xc'));var jsforce=require(_0xdabe('0xd'));var deskjs=require(_0xdabe('0xe'));var toCsv=require(_0xdabe('0x7'));var querystring=require(_0xdabe('0xf'));var Papa=require('papaparse');var Redis=require(_0xdabe('0x10'));var authService=require(_0xdabe('0x11'));var qs=require(_0xdabe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdabe('0x13'));var logger=require(_0xdabe('0x14'))(_0xdabe('0x15'));var utils=require('../../config/utils');var config=require(_0xdabe('0x16'));var licenseUtil=require(_0xdabe('0x17'));var db=require(_0xdabe('0x18'))['db'];function respondWithStatusCode(_0x104334,_0xf6800e){_0xf6800e=_0xf6800e||0xcc;return function(_0xe22cc1){if(_0xe22cc1){return _0x104334['sendStatus'](_0xf6800e);}return _0x104334[_0xdabe('0x19')](_0xf6800e)[_0xdabe('0x1a')]();};}function respondWithResult(_0x98deb1,_0x371db1){_0x371db1=_0x371db1||0xc8;return function(_0xb24f0){if(_0xb24f0){return _0x98deb1[_0xdabe('0x19')](_0x371db1)[_0xdabe('0x1b')](_0xb24f0);}};}function respondWithFilteredResult(_0x5d5ad7,_0x2e2e17){return function(_0x3e4544){if(_0x3e4544){var _0xf7bbed=typeof _0x2e2e17[_0xdabe('0x1c')]==='undefined'&&typeof _0x2e2e17['limit']==='undefined';var _0x117938=_0x3e4544[_0xdabe('0x1d')];var _0x42989b=_0xf7bbed?0x0:_0x2e2e17[_0xdabe('0x1c')];var _0x2a46ed=_0xf7bbed?_0x3e4544[_0xdabe('0x1d')]:_0x2e2e17[_0xdabe('0x1c')]+_0x2e2e17[_0xdabe('0x1e')];var _0x40b62c;if(_0x2a46ed>=_0x117938){_0x2a46ed=_0x117938;_0x40b62c=0xc8;}else{_0x40b62c=0xce;}_0x5d5ad7[_0xdabe('0x19')](_0x40b62c);return _0x5d5ad7['set'](_0xdabe('0x1f'),_0x42989b+'-'+_0x2a46ed+'/'+_0x117938)[_0xdabe('0x1b')](_0x3e4544);}return null;};}function patchUpdates(_0xd9f4f6){return function(_0x3ba073){try{jsonpatch['apply'](_0x3ba073,_0xd9f4f6,!![]);}catch(_0x45c6cb){return BPromise[_0xdabe('0x20')](_0x45c6cb);}return _0x3ba073[_0xdabe('0x21')]();};}function saveUpdates(_0x4e629f,_0x3ba963){return function(_0x2396bd){if(_0x2396bd){return _0x2396bd['update'](_0x4e629f)[_0xdabe('0x22')](function(_0x299d03){return _0x299d03;});}return null;};}function removeEntity(_0x3eaea2,_0x2cf1aa){return function(_0xefde6f){if(_0xefde6f){return _0xefde6f[_0xdabe('0x23')]()['then'](function(){_0x3eaea2[_0xdabe('0x19')](0xcc)[_0xdabe('0x1a')]();});}};}function handleEntityNotFound(_0x3f0bc4,_0x3b8097){return function(_0xd25ad7){if(!_0xd25ad7){_0x3f0bc4['sendStatus'](0x194);}return _0xd25ad7;};}function handleError(_0x4c91d1,_0x3882ca){_0x3882ca=_0x3882ca||0x1f4;return function(_0x123651){logger[_0xdabe('0x24')](_0x123651['stack']);if(_0x123651[_0xdabe('0x25')]){delete _0x123651[_0xdabe('0x25')];}_0x4c91d1[_0xdabe('0x19')](_0x3882ca)[_0xdabe('0x26')](_0x123651);};}exports[_0xdabe('0x27')]=function(_0x5c387a,_0x4013b6){var _0x3a979e={},_0x4b8e0e={},_0x3594b7={'count':0x0,'rows':[]};var _0x53f00b=_[_0xdabe('0x28')](db[_0xdabe('0x29')][_0xdabe('0x2a')],function(_0x295ece){return{'name':_0x295ece[_0xdabe('0x2b')],'type':_0x295ece['type'][_0xdabe('0x2c')]};});_0x4b8e0e[_0xdabe('0x2d')]=_[_0xdabe('0x28')](_0x53f00b,_0xdabe('0x25'));_0x4b8e0e[_0xdabe('0x2e')]=_[_0xdabe('0x2f')](_0x5c387a['query']);_0x4b8e0e[_0xdabe('0x30')]=_[_0xdabe('0x31')](_0x4b8e0e['model'],_0x4b8e0e[_0xdabe('0x2e')]);_0x3a979e[_0xdabe('0x32')]=_['intersection'](_0x4b8e0e['model'],qs[_0xdabe('0x33')](_0x5c387a[_0xdabe('0x2e')]['fields']));_0x3a979e[_0xdabe('0x32')]=_0x3a979e[_0xdabe('0x32')][_0xdabe('0x34')]?_0x3a979e[_0xdabe('0x32')]:_0x4b8e0e['model'];if(!_0x5c387a[_0xdabe('0x2e')][_0xdabe('0x35')](_0xdabe('0x36'))){_0x3a979e[_0xdabe('0x1e')]=qs[_0xdabe('0x1e')](_0x5c387a[_0xdabe('0x2e')][_0xdabe('0x1e')]);_0x3a979e[_0xdabe('0x1c')]=qs['offset'](_0x5c387a['query']['offset']);}_0x3a979e[_0xdabe('0x37')]=qs[_0xdabe('0x38')](_0x5c387a['query']['sort']);_0x3a979e[_0xdabe('0x39')]=qs['filters'](_[_0xdabe('0x3a')](_0x5c387a[_0xdabe('0x2e')],_0x4b8e0e['filters']),_0x53f00b);if(_0x5c387a[_0xdabe('0x2e')][_0xdabe('0x3b')]){_0x3a979e[_0xdabe('0x39')]=_['merge'](_0x3a979e['where'],{'$or':_[_0xdabe('0x28')](_0x53f00b,function(_0x582b33){if(_0x582b33[_0xdabe('0x3c')]!==_0xdabe('0x3d')){var _0x3e048c={};_0x3e048c[_0x582b33[_0xdabe('0x25')]]={'$like':'%'+_0x5c387a[_0xdabe('0x2e')][_0xdabe('0x3b')]+'%'};return _0x3e048c;}})});}_0x3a979e=_[_0xdabe('0x3e')]({},_0x3a979e,_0x5c387a['options']);var _0xffdd48={'where':_0x3a979e[_0xdabe('0x39')]};return db[_0xdabe('0x29')]['count'](_0xffdd48)[_0xdabe('0x22')](function(_0x179d37){_0x3594b7[_0xdabe('0x1d')]=_0x179d37;if(_0x5c387a[_0xdabe('0x2e')]['includeAll']){_0x3a979e['include']=[{'all':!![]}];}return db[_0xdabe('0x29')]['findAll'](_0x3a979e);})[_0xdabe('0x22')](function(_0x3109a1){_0x3594b7['rows']=_0x3109a1;return _0x3594b7;})[_0xdabe('0x22')](respondWithFilteredResult(_0x4013b6,_0x3a979e))[_0xdabe('0x3f')](handleError(_0x4013b6,null));};exports[_0xdabe('0x40')]=function(_0x4b5a88,_0x74a81d){var _0x45623e={'raw':!![],'where':{'id':_0x4b5a88[_0xdabe('0x41')]['id']}},_0xa34745={};_0xa34745[_0xdabe('0x2d')]=_[_0xdabe('0x2f')](db[_0xdabe('0x29')][_0xdabe('0x2a')]);_0xa34745[_0xdabe('0x2e')]=_[_0xdabe('0x2f')](_0x4b5a88[_0xdabe('0x2e')]);_0xa34745['filters']=_[_0xdabe('0x31')](_0xa34745['model'],_0xa34745[_0xdabe('0x2e')]);_0x45623e['attributes']=_['intersection'](_0xa34745[_0xdabe('0x2d')],qs[_0xdabe('0x33')](_0x4b5a88[_0xdabe('0x2e')]['fields']));_0x45623e[_0xdabe('0x32')]=_0x45623e[_0xdabe('0x32')][_0xdabe('0x34')]?_0x45623e[_0xdabe('0x32')]:_0xa34745['model'];if(_0x4b5a88[_0xdabe('0x2e')][_0xdabe('0x42')]){_0x45623e[_0xdabe('0x43')]=[{'all':!![]}];}_0x45623e=_['merge']({},_0x45623e,_0x4b5a88[_0xdabe('0x44')]);return db['VtigerField'][_0xdabe('0x45')](_0x45623e)['then'](handleEntityNotFound(_0x74a81d,null))[_0xdabe('0x22')](respondWithResult(_0x74a81d,null))[_0xdabe('0x3f')](handleError(_0x74a81d,null));};exports[_0xdabe('0x46')]=function(_0x2e2c04,_0x4721a9){return db['VtigerField'][_0xdabe('0x46')](_0x2e2c04['body'],{})['then'](respondWithResult(_0x4721a9,0xc9))[_0xdabe('0x3f')](handleError(_0x4721a9,null));};exports['update']=function(_0x2a8e9d,_0x2d403e){if(_0x2a8e9d['body']['id']){delete _0x2a8e9d[_0xdabe('0x47')]['id'];}return db[_0xdabe('0x29')]['find']({'where':{'id':_0x2a8e9d[_0xdabe('0x41')]['id']}})['then'](handleEntityNotFound(_0x2d403e,null))[_0xdabe('0x22')](saveUpdates(_0x2a8e9d[_0xdabe('0x47')],null))['then'](respondWithResult(_0x2d403e,null))[_0xdabe('0x3f')](handleError(_0x2d403e,null));};exports['destroy']=function(_0xc47dc4,_0x44a470){return db[_0xdabe('0x29')][_0xdabe('0x45')]({'where':{'id':_0xc47dc4['params']['id']}})[_0xdabe('0x22')](handleEntityNotFound(_0x44a470,null))['then'](removeEntity(_0x44a470,null))[_0xdabe('0x3f')](handleError(_0x44a470,null));}; \ No newline at end of file +var _0xc792=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','Content-Range','apply','save','then','end','name','map','VtigerField','fieldName','type','key','query','keys','attributes','intersection','fields','length','model','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','create','update','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x438746,_0x425401){var _0x1a7fec=function(_0xbb8930){while(--_0xbb8930){_0x438746['push'](_0x438746['shift']());}};_0x1a7fec(++_0x425401);}(_0xc792,0xcc));var _0x2c79=function(_0x2bc09e,_0x1ae747){_0x2bc09e=_0x2bc09e-0x0;var _0x3f7c75=_0xc792[_0x2bc09e];return _0x3f7c75;};'use strict';var emlformat=require(_0x2c79('0x0'));var rimraf=require(_0x2c79('0x1'));var zipdir=require(_0x2c79('0x2'));var jsonpatch=require(_0x2c79('0x3'));var rp=require(_0x2c79('0x4'));var moment=require(_0x2c79('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2c79('0x6'));var util=require(_0x2c79('0x7'));var path=require(_0x2c79('0x8'));var sox=require(_0x2c79('0x9'));var csv=require(_0x2c79('0xa'));var ejs=require(_0x2c79('0xb'));var fs=require('fs');var fs_extra=require(_0x2c79('0xc'));var _=require(_0x2c79('0xd'));var squel=require(_0x2c79('0xe'));var crypto=require(_0x2c79('0xf'));var jsforce=require(_0x2c79('0x10'));var deskjs=require(_0x2c79('0x11'));var toCsv=require(_0x2c79('0xa'));var querystring=require(_0x2c79('0x12'));var Papa=require(_0x2c79('0x13'));var Redis=require(_0x2c79('0x14'));var authService=require(_0x2c79('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c79('0x16'));var logger=require(_0x2c79('0x17'))(_0x2c79('0x18'));var utils=require(_0x2c79('0x19'));var config=require(_0x2c79('0x1a'));var licenseUtil=require(_0x2c79('0x1b'));var db=require(_0x2c79('0x1c'))['db'];function respondWithStatusCode(_0x779626,_0x2bbb56){_0x2bbb56=_0x2bbb56||0xcc;return function(_0x517f98){if(_0x517f98){return _0x779626[_0x2c79('0x1d')](_0x2bbb56);}return _0x779626['status'](_0x2bbb56)['end']();};}function respondWithResult(_0x186282,_0x3ce333){_0x3ce333=_0x3ce333||0xc8;return function(_0x509304){if(_0x509304){return _0x186282[_0x2c79('0x1e')](_0x3ce333)[_0x2c79('0x1f')](_0x509304);}};}function respondWithFilteredResult(_0x432e6c,_0x4e1c21){return function(_0x1fc2c1){if(_0x1fc2c1){var _0xacce0d=typeof _0x4e1c21['offset']===_0x2c79('0x20')&&typeof _0x4e1c21[_0x2c79('0x21')]===_0x2c79('0x20');var _0x3e0b67=_0x1fc2c1[_0x2c79('0x22')];var _0xf7459b=_0xacce0d?0x0:_0x4e1c21['offset'];var _0x5db655=_0xacce0d?_0x1fc2c1[_0x2c79('0x22')]:_0x4e1c21['offset']+_0x4e1c21[_0x2c79('0x21')];var _0x24ab13;if(_0x5db655>=_0x3e0b67){_0x5db655=_0x3e0b67;_0x24ab13=0xc8;}else{_0x24ab13=0xce;}_0x432e6c['status'](_0x24ab13);return _0x432e6c['set'](_0x2c79('0x23'),_0xf7459b+'-'+_0x5db655+'/'+_0x3e0b67)['json'](_0x1fc2c1);}return null;};}function patchUpdates(_0x34de38){return function(_0x344e83){try{jsonpatch[_0x2c79('0x24')](_0x344e83,_0x34de38,!![]);}catch(_0x22fe07){return BPromise['reject'](_0x22fe07);}return _0x344e83[_0x2c79('0x25')]();};}function saveUpdates(_0x9dd276,_0x2cc3ce){return function(_0x1276a8){if(_0x1276a8){return _0x1276a8['update'](_0x9dd276)[_0x2c79('0x26')](function(_0x561e71){return _0x561e71;});}return null;};}function removeEntity(_0x1d5585,_0x2bc732){return function(_0x4f40b4){if(_0x4f40b4){return _0x4f40b4['destroy']()[_0x2c79('0x26')](function(){_0x1d5585['status'](0xcc)[_0x2c79('0x27')]();});}};}function handleEntityNotFound(_0xd18829,_0x25a31b){return function(_0x184078){if(!_0x184078){_0xd18829['sendStatus'](0x194);}return _0x184078;};}function handleError(_0x5f2976,_0x2b6a0f){_0x2b6a0f=_0x2b6a0f||0x1f4;return function(_0x48e51f){logger['error'](_0x48e51f['stack']);if(_0x48e51f[_0x2c79('0x28')]){delete _0x48e51f['name'];}_0x5f2976[_0x2c79('0x1e')](_0x2b6a0f)['send'](_0x48e51f);};}exports['index']=function(_0x444d9c,_0x29bb0f){var _0x40b760={},_0x44ac34={},_0x4ba3c0={'count':0x0,'rows':[]};var _0xfb0bdb=_[_0x2c79('0x29')](db[_0x2c79('0x2a')]['rawAttributes'],function(_0x8315e1){return{'name':_0x8315e1[_0x2c79('0x2b')],'type':_0x8315e1[_0x2c79('0x2c')][_0x2c79('0x2d')]};});_0x44ac34['model']=_[_0x2c79('0x29')](_0xfb0bdb,_0x2c79('0x28'));_0x44ac34[_0x2c79('0x2e')]=_[_0x2c79('0x2f')](_0x444d9c[_0x2c79('0x2e')]);_0x44ac34['filters']=_['intersection'](_0x44ac34['model'],_0x44ac34['query']);_0x40b760[_0x2c79('0x30')]=_[_0x2c79('0x31')](_0x44ac34['model'],qs[_0x2c79('0x32')](_0x444d9c[_0x2c79('0x2e')][_0x2c79('0x32')]));_0x40b760['attributes']=_0x40b760[_0x2c79('0x30')][_0x2c79('0x33')]?_0x40b760[_0x2c79('0x30')]:_0x44ac34[_0x2c79('0x34')];if(!_0x444d9c[_0x2c79('0x2e')]['hasOwnProperty']('nolimit')){_0x40b760[_0x2c79('0x21')]=qs[_0x2c79('0x21')](_0x444d9c[_0x2c79('0x2e')][_0x2c79('0x21')]);_0x40b760['offset']=qs[_0x2c79('0x35')](_0x444d9c['query'][_0x2c79('0x35')]);}_0x40b760['order']=qs[_0x2c79('0x36')](_0x444d9c[_0x2c79('0x2e')][_0x2c79('0x36')]);_0x40b760[_0x2c79('0x37')]=qs[_0x2c79('0x38')](_[_0x2c79('0x39')](_0x444d9c[_0x2c79('0x2e')],_0x44ac34[_0x2c79('0x38')]),_0xfb0bdb);if(_0x444d9c['query'][_0x2c79('0x3a')]){_0x40b760['where']=_[_0x2c79('0x3b')](_0x40b760['where'],{'$or':_['map'](_0xfb0bdb,function(_0x2f315e){if(_0x2f315e[_0x2c79('0x2c')]!==_0x2c79('0x3c')){var _0x139e8a={};_0x139e8a[_0x2f315e[_0x2c79('0x28')]]={'$like':'%'+_0x444d9c[_0x2c79('0x2e')][_0x2c79('0x3a')]+'%'};return _0x139e8a;}})});}_0x40b760=_[_0x2c79('0x3b')]({},_0x40b760,_0x444d9c[_0x2c79('0x3d')]);var _0x1b4192={'where':_0x40b760[_0x2c79('0x37')]};return db[_0x2c79('0x2a')][_0x2c79('0x22')](_0x1b4192)[_0x2c79('0x26')](function(_0x44811d){_0x4ba3c0[_0x2c79('0x22')]=_0x44811d;if(_0x444d9c[_0x2c79('0x2e')][_0x2c79('0x3e')]){_0x40b760[_0x2c79('0x3f')]=[{'all':!![]}];}return db[_0x2c79('0x2a')][_0x2c79('0x40')](_0x40b760);})[_0x2c79('0x26')](function(_0x3b2466){_0x4ba3c0['rows']=_0x3b2466;return _0x4ba3c0;})[_0x2c79('0x26')](respondWithFilteredResult(_0x29bb0f,_0x40b760))['catch'](handleError(_0x29bb0f,null));};exports[_0x2c79('0x41')]=function(_0x1f2d36,_0x1266f9){var _0x5ec085={'raw':!![],'where':{'id':_0x1f2d36[_0x2c79('0x42')]['id']}},_0x3acc75={};_0x3acc75[_0x2c79('0x34')]=_[_0x2c79('0x2f')](db[_0x2c79('0x2a')]['rawAttributes']);_0x3acc75[_0x2c79('0x2e')]=_[_0x2c79('0x2f')](_0x1f2d36[_0x2c79('0x2e')]);_0x3acc75['filters']=_[_0x2c79('0x31')](_0x3acc75[_0x2c79('0x34')],_0x3acc75[_0x2c79('0x2e')]);_0x5ec085[_0x2c79('0x30')]=_[_0x2c79('0x31')](_0x3acc75['model'],qs['fields'](_0x1f2d36[_0x2c79('0x2e')]['fields']));_0x5ec085[_0x2c79('0x30')]=_0x5ec085[_0x2c79('0x30')]['length']?_0x5ec085[_0x2c79('0x30')]:_0x3acc75[_0x2c79('0x34')];if(_0x1f2d36['query']['includeAll']){_0x5ec085[_0x2c79('0x3f')]=[{'all':!![]}];}_0x5ec085=_[_0x2c79('0x3b')]({},_0x5ec085,_0x1f2d36[_0x2c79('0x3d')]);return db[_0x2c79('0x2a')]['find'](_0x5ec085)[_0x2c79('0x26')](handleEntityNotFound(_0x1266f9,null))[_0x2c79('0x26')](respondWithResult(_0x1266f9,null))['catch'](handleError(_0x1266f9,null));};exports[_0x2c79('0x43')]=function(_0x3df969,_0x2b4f8b){return db[_0x2c79('0x2a')][_0x2c79('0x43')](_0x3df969['body'],{})[_0x2c79('0x26')](respondWithResult(_0x2b4f8b,0xc9))['catch'](handleError(_0x2b4f8b,null));};exports[_0x2c79('0x44')]=function(_0x1021cb,_0x202407){if(_0x1021cb[_0x2c79('0x45')]['id']){delete _0x1021cb['body']['id'];}return db[_0x2c79('0x2a')][_0x2c79('0x46')]({'where':{'id':_0x1021cb['params']['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x202407,null))['then'](saveUpdates(_0x1021cb[_0x2c79('0x45')],null))[_0x2c79('0x26')](respondWithResult(_0x202407,null))['catch'](handleError(_0x202407,null));};exports['destroy']=function(_0x23c3e2,_0x52e91d){return db[_0x2c79('0x2a')]['find']({'where':{'id':_0x23c3e2[_0x2c79('0x42')]['id']}})[_0x2c79('0x26')](handleEntityNotFound(_0x52e91d,null))[_0x2c79('0x26')](removeEntity(_0x52e91d,null))[_0x2c79('0x47')](handleError(_0x52e91d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 9e5ed73..bd286b9 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 _0x2c7c=['./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x4a8416,_0x20d5b6){var _0x859dce=function(_0x540f97){while(--_0x540f97){_0x4a8416['push'](_0x4a8416['shift']());}};_0x859dce(++_0x20d5b6);}(_0x2c7c,0xbb));var _0xc2c7=function(_0x29dd78,_0x1dee92){_0x29dd78=_0x29dd78-0x0;var _0x42eaa9=_0x2c7c[_0x29dd78];return _0x42eaa9;};'use strict';var _=require(_0xc2c7('0x0'));var util=require(_0xc2c7('0x1'));var logger=require(_0xc2c7('0x2'))(_0xc2c7('0x3'));var moment=require(_0xc2c7('0x4'));var BPromise=require(_0xc2c7('0x5'));var rp=require(_0xc2c7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc2c7('0x7'));var attributes=require(_0xc2c7('0x8'));module[_0xc2c7('0x9')]=function(_0x1344ef,_0x2d43f5){return _0x1344ef[_0xc2c7('0xa')](_0xc2c7('0xb'),attributes,{'tableName':_0xc2c7('0xc'),'paranoid':![],'indexes':[{'name':_0xc2c7('0xd'),'fields':['idField',_0xc2c7('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x299d=['api','moment','bluebird','request-promise','path','../../config/environment','exports','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x3d0393,_0x145fd4){var _0x1a7d0c=function(_0xb6850d){while(--_0xb6850d){_0x3d0393['push'](_0x3d0393['shift']());}};_0x1a7d0c(++_0x145fd4);}(_0x299d,0x1be));var _0xd299=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x299d[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd299('0x0'));var util=require('util');var logger=require(_0xd299('0x1'))(_0xd299('0x2'));var moment=require(_0xd299('0x3'));var BPromise=require(_0xd299('0x4'));var rp=require(_0xd299('0x5'));var fs=require('fs');var path=require(_0xd299('0x6'));var rimraf=require('rimraf');var config=require(_0xd299('0x7'));var attributes=require('./intVtigerField.attributes');module[_0xd299('0x8')]=function(_0x4fea0e,_0x3ab998){return _0x4fea0e['define'](_0xd299('0x9'),attributes,{'tableName':_0xd299('0xa'),'paranoid':![],'indexes':[{'name':_0xd299('0xb'),'fields':[_0xd299('0xc'),_0xd299('0xd')],'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 4719f4a..2c6fb45 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 _0x9556=['info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x43d9b3,_0x277a53){var _0x20b3a0=function(_0x559de2){while(--_0x559de2){_0x43d9b3['push'](_0x43d9b3['shift']());}};_0x20b3a0(++_0x277a53);}(_0x9556,0x17b));var _0x6955=function(_0x385eb7,_0x34aae2){_0x385eb7=_0x385eb7-0x0;var _0x5d5c36=_0x9556[_0x385eb7];return _0x5d5c36;};'use strict';var _=require('lodash');var util=require(_0x6955('0x0'));var moment=require(_0x6955('0x1'));var BPromise=require(_0x6955('0x2'));var rs=require(_0x6955('0x3'));var fs=require('fs');var Redis=require(_0x6955('0x4'));var db=require(_0x6955('0x5'))['db'];var utils=require(_0x6955('0x6'));var logger=require('../../config/logger')(_0x6955('0x7'));var config=require('../../config/environment');var jayson=require(_0x6955('0x8'));var client=jayson[_0x6955('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x197179,_0x2ccced,_0x57006d){return new BPromise(function(_0x58b1a3,_0x2ee78c){return client[_0x6955('0xa')](_0x197179,_0x57006d)[_0x6955('0xb')](function(_0x14bc15){logger[_0x6955('0xc')](_0x6955('0xd'),_0x2ccced,'request\x20sent');logger[_0x6955('0xe')](_0x6955('0xf'),_0x2ccced,'request\x20sent',JSON[_0x6955('0x10')](_0x14bc15));if(_0x14bc15[_0x6955('0x11')]){if(_0x14bc15[_0x6955('0x11')][_0x6955('0x12')]===0x1f4){logger[_0x6955('0x11')](_0x6955('0xd'),_0x2ccced,_0x14bc15[_0x6955('0x11')]['message']);return _0x2ee78c(_0x14bc15[_0x6955('0x11')][_0x6955('0x13')]);}logger[_0x6955('0x11')](_0x6955('0xd'),_0x2ccced,_0x14bc15['error'][_0x6955('0x13')]);return _0x58b1a3(_0x14bc15[_0x6955('0x11')]['message']);}else{logger['info'](_0x6955('0xd'),_0x2ccced,_0x6955('0x14'));_0x58b1a3(_0x14bc15[_0x6955('0x15')][_0x6955('0x13')]);}})[_0x6955('0x16')](function(_0x136bce){logger[_0x6955('0x11')]('VtigerField,\x20%s,\x20%s',_0x2ccced,_0x136bce);_0x2ee78c(_0x136bce);});});} \ No newline at end of file +var _0x9b65=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9b65,0x1d2));var _0x59b6=function(_0x4fd5df,_0x470622){_0x4fd5df=_0x4fd5df-0x0;var _0x5dd4b0=_0x9b65[_0x4fd5df];return _0x5dd4b0;};'use strict';var _=require(_0x59b6('0x0'));var util=require(_0x59b6('0x1'));var moment=require('moment');var BPromise=require(_0x59b6('0x2'));var rs=require(_0x59b6('0x3'));var fs=require('fs');var Redis=require(_0x59b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x59b6('0x5'));var logger=require(_0x59b6('0x6'))(_0x59b6('0x7'));var config=require(_0x59b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x59b6('0x9')][_0x59b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37fd0,_0x33e166,_0x3a52d8){return new BPromise(function(_0x3ab88d,_0x4431d0){return client['request'](_0x37fd0,_0x3a52d8)[_0x59b6('0xb')](function(_0x192b29){logger['info'](_0x59b6('0xc'),_0x33e166,_0x59b6('0xd'));logger[_0x59b6('0xe')](_0x59b6('0xf'),_0x33e166,_0x59b6('0xd'),JSON[_0x59b6('0x10')](_0x192b29));if(_0x192b29['error']){if(_0x192b29[_0x59b6('0x11')][_0x59b6('0x12')]===0x1f4){logger[_0x59b6('0x11')](_0x59b6('0xc'),_0x33e166,_0x192b29[_0x59b6('0x11')][_0x59b6('0x13')]);return _0x4431d0(_0x192b29[_0x59b6('0x11')]['message']);}logger[_0x59b6('0x11')]('VtigerField,\x20%s,\x20%s',_0x33e166,_0x192b29['error'][_0x59b6('0x13')]);return _0x3ab88d(_0x192b29['error'][_0x59b6('0x13')]);}else{logger['info'](_0x59b6('0xc'),_0x33e166,'request\x20sent');_0x3ab88d(_0x192b29[_0x59b6('0x14')][_0x59b6('0x13')]);}})[_0x59b6('0x15')](function(_0x53ce38){logger['error'](_0x59b6('0xc'),_0x33e166,_0x53ce38);_0x4431d0(_0x53ce38);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 26e6d62..332f307 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 _0xddb3=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3a3b5b,_0x52aa31){var _0x19e2e8=function(_0x7e017a){while(--_0x7e017a){_0x3a3b5b['push'](_0x3a3b5b['shift']());}};_0x19e2e8(++_0x52aa31);}(_0xddb3,0x1e5));var _0x3ddb=function(_0x472f23,_0xc2cbbb){_0x472f23=_0x472f23-0x0;var _0x1f7131=_0xddb3[_0x472f23];return _0x1f7131;};'use strict';var multer=require(_0x3ddb('0x0'));var util=require('util');var path=require(_0x3ddb('0x1'));var timeout=require(_0x3ddb('0x2'));var express=require(_0x3ddb('0x3'));var router=express[_0x3ddb('0x4')]();var fs_extra=require(_0x3ddb('0x5'));var auth=require(_0x3ddb('0x6'));var interaction=require(_0x3ddb('0x7'));var config=require(_0x3ddb('0x8'));var controller=require(_0x3ddb('0x9'));router[_0x3ddb('0xa')]('/',auth[_0x3ddb('0xb')](),controller[_0x3ddb('0xc')]);router[_0x3ddb('0xa')](_0x3ddb('0xd'),auth[_0x3ddb('0xb')](),controller[_0x3ddb('0xe')]);router[_0x3ddb('0xa')]('/:id/configurations',auth[_0x3ddb('0xb')](),controller['getConfigurations']);router['get'](_0x3ddb('0xf'),auth[_0x3ddb('0xb')](),controller[_0x3ddb('0x10')]);router[_0x3ddb('0x11')]('/',auth['isAuthenticated'](),controller[_0x3ddb('0x12')]);router['post'](_0x3ddb('0x13'),auth[_0x3ddb('0xb')](),controller[_0x3ddb('0x14')]);router['put']('/:id',auth[_0x3ddb('0xb')](),controller[_0x3ddb('0x15')]);router[_0x3ddb('0x16')](_0x3ddb('0xd'),auth['isAuthenticated'](),controller[_0x3ddb('0x17')]);module[_0x3ddb('0x18')]=router; \ No newline at end of file +var _0xf975=['./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../config/environment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf975,0x162));var _0x5f97=function(_0x69eff8,_0x598f44){_0x69eff8=_0x69eff8-0x0;var _0x3706a5=_0xf975[_0x69eff8];return _0x3706a5;};'use strict';var multer=require(_0x5f97('0x0'));var util=require('util');var path=require(_0x5f97('0x1'));var timeout=require('connect-timeout');var express=require(_0x5f97('0x2'));var router=express[_0x5f97('0x3')]();var fs_extra=require(_0x5f97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5f97('0x5'));var controller=require(_0x5f97('0x6'));router[_0x5f97('0x7')]('/',auth[_0x5f97('0x8')](),controller[_0x5f97('0x9')]);router['get'](_0x5f97('0xa'),auth[_0x5f97('0x8')](),controller[_0x5f97('0xb')]);router[_0x5f97('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x5f97('0xc')]);router[_0x5f97('0x7')](_0x5f97('0xd'),auth[_0x5f97('0x8')](),controller[_0x5f97('0xe')]);router[_0x5f97('0xf')]('/',auth[_0x5f97('0x8')](),controller[_0x5f97('0x10')]);router['post'](_0x5f97('0x11'),auth[_0x5f97('0x8')](),controller[_0x5f97('0x12')]);router[_0x5f97('0x13')](_0x5f97('0xa'),auth[_0x5f97('0x8')](),controller[_0x5f97('0x14')]);router[_0x5f97('0x15')]('/:id',auth[_0x5f97('0x8')](),controller[_0x5f97('0x16')]);module[_0x5f97('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 46d74f4..5995272 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 _0x8aad=['integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','token','password'];(function(_0x55fa73,_0x5cf41f){var _0x4f9350=function(_0x2337e5){while(--_0x2337e5){_0x55fa73['push'](_0x55fa73['shift']());}};_0x4f9350(++_0x5cf41f);}(_0x8aad,0x146));var _0xd8aa=function(_0x64e777,_0x25748a){_0x64e777=_0x64e777-0x0;var _0x4fd113=_0x8aad[_0x64e777];return _0x4fd113;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'password':{'type':Sequelize[_0xd8aa('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x4')},'authType':{'type':Sequelize['ENUM']('password',_0xd8aa('0x5')),'defaultValue':_0xd8aa('0x6')},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xd8aa('0x7'),_0xd8aa('0x8')),'defaultValue':_0xd8aa('0x7')}}; \ No newline at end of file +var _0x8ed7=['STRING','remoteUri','ENUM','password','token','integrationTab','exports'];(function(_0xe33285,_0x7f474){var _0x31ca6b=function(_0x51b2a6){while(--_0x51b2a6){_0xe33285['push'](_0xe33285['shift']());}};_0x31ca6b(++_0x7f474);}(_0x8ed7,0x8b));var _0x78ed=function(_0x39187b,_0x2a6214){_0x39187b=_0x39187b-0x0;var _0x2cf25f=_0x8ed7[_0x39187b];return _0x2cf25f;};'use strict';var Sequelize=require('sequelize');module[_0x78ed('0x0')]={'name':{'type':Sequelize[_0x78ed('0x1')]},'description':{'type':Sequelize[_0x78ed('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0x78ed('0x1')]},'token':{'type':Sequelize[_0x78ed('0x1')]},'remoteUri':{'type':Sequelize[_0x78ed('0x1')],'unique':_0x78ed('0x2')},'authType':{'type':Sequelize[_0x78ed('0x3')](_0x78ed('0x4'),_0x78ed('0x5')),'defaultValue':_0x78ed('0x4')},'serverUrl':{'type':Sequelize[_0x78ed('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x78ed('0x6'),'newTab'),'defaultValue':_0x78ed('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2a2e35e..45e2928 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 _0xe706=['getConfigurations','findOne','ZendeskConfiguration','pick','hasOwnProperty','AccountId','Subjects','getSubjects','Descriptions','channel','ZendeskField','getFields','username','token','authType','remoteUri','slice','substring','GET','format','password','headers','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','ticket_fields','title','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','limit','status','set','Content-Range','apply','reject','save','update','then','stack','name','send','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','show','includeAll','include','find','create','body','catch','params'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0xe706,0xa3));var _0x6e70=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0xe706[_0xb1ee0e];return _0x376116;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var integrations=require(_0x6e70('0x1d'));function respondWithStatusCode(_0x3b38f3,_0x310eb7){_0x310eb7=_0x310eb7||0xcc;return function(_0xa1eb74){if(_0xa1eb74){return _0x3b38f3[_0x6e70('0x1e')](_0x310eb7);}return _0x3b38f3['status'](_0x310eb7)['end']();};}function respondWithResult(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xc8;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['status'](_0x257e81)[_0x6e70('0x1f')](_0x5a37a6);}};}function respondWithFilteredResult(_0x22c50c,_0x5d9263){return function(_0x24f3ac){if(_0x24f3ac){var _0x5c3fe7=typeof _0x5d9263[_0x6e70('0x20')]===_0x6e70('0x21')&&typeof _0x5d9263['limit']==='undefined';var _0x3bd572=_0x24f3ac['count'];var _0x28a21f=_0x5c3fe7?0x0:_0x5d9263[_0x6e70('0x20')];var _0x53acdc=_0x5c3fe7?_0x24f3ac['count']:_0x5d9263[_0x6e70('0x20')]+_0x5d9263[_0x6e70('0x22')];var _0x2368eb;if(_0x53acdc>=_0x3bd572){_0x53acdc=_0x3bd572;_0x2368eb=0xc8;}else{_0x2368eb=0xce;}_0x22c50c[_0x6e70('0x23')](_0x2368eb);return _0x22c50c[_0x6e70('0x24')](_0x6e70('0x25'),_0x28a21f+'-'+_0x53acdc+'/'+_0x3bd572)[_0x6e70('0x1f')](_0x24f3ac);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x26')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x27')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x28')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x29')](_0x27b294)[_0x6e70('0x2a')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2a')](function(){_0x10fc91[_0x6e70('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ecdf1,_0x1196ed){return function(_0x5f268f){if(!_0x5f268f){_0x3ecdf1[_0x6e70('0x1e')](0x194);}return _0x5f268f;};}function handleError(_0x67fb43,_0x2bb231){_0x2bb231=_0x2bb231||0x1f4;return function(_0x4a67ac){logger['error'](_0x4a67ac[_0x6e70('0x2b')]);if(_0x4a67ac[_0x6e70('0x2c')]){delete _0x4a67ac[_0x6e70('0x2c')];}_0x67fb43[_0x6e70('0x23')](_0x2bb231)[_0x6e70('0x2d')](_0x4a67ac);};}exports['index']=function(_0x1952ea,_0x406f29){var _0xecf336={},_0x2864a0={},_0x396a67={'count':0x0,'rows':[]};var _0x20a225=_[_0x6e70('0x2e')](db[_0x6e70('0x2f')][_0x6e70('0x30')],function(_0x3a5d30){return{'name':_0x3a5d30['fieldName'],'type':_0x3a5d30[_0x6e70('0x31')]['key']};});_0x2864a0[_0x6e70('0x32')]=_['map'](_0x20a225,_0x6e70('0x2c'));_0x2864a0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1952ea['query']);_0x2864a0[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x2864a0['model'],_0x2864a0[_0x6e70('0x33')]);_0xecf336[_0x6e70('0x37')]=_['intersection'](_0x2864a0[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x38')]));_0xecf336[_0x6e70('0x37')]=_0xecf336[_0x6e70('0x37')][_0x6e70('0x39')]?_0xecf336[_0x6e70('0x37')]:_0x2864a0[_0x6e70('0x32')];if(!_0x1952ea[_0x6e70('0x33')]['hasOwnProperty'](_0x6e70('0x3a'))){_0xecf336['limit']=qs[_0x6e70('0x22')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x22')]);_0xecf336[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x20')]);}_0xecf336[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3c')]);_0xecf336[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_['pick'](_0x1952ea['query'],_0x2864a0['filters']),_0x20a225);if(_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]){_0xecf336[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0xecf336[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x20a225,function(_0x572a71){if(_0x572a71[_0x6e70('0x31')]!==_0x6e70('0x40')){var _0x1c5cde={};_0x1c5cde[_0x572a71[_0x6e70('0x2c')]]={'$like':'%'+_0x1952ea[_0x6e70('0x33')][_0x6e70('0x3e')]+'%'};return _0x1c5cde;}})});}_0xecf336=_[_0x6e70('0x3f')]({},_0xecf336,_0x1952ea[_0x6e70('0x41')]);var _0x5be100={'where':_0xecf336[_0x6e70('0x3d')]};return db[_0x6e70('0x2f')][_0x6e70('0x42')](_0x5be100)[_0x6e70('0x2a')](function(_0x201da9){_0x396a67[_0x6e70('0x42')]=_0x201da9;if(_0x1952ea[_0x6e70('0x33')]['includeAll']){_0xecf336['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x6e70('0x43')](_0xecf336);})[_0x6e70('0x2a')](function(_0x83847b){_0x396a67[_0x6e70('0x44')]=_0x83847b;return _0x396a67;})[_0x6e70('0x2a')](respondWithFilteredResult(_0x406f29,_0xecf336))['catch'](handleError(_0x406f29,null));};exports[_0x6e70('0x45')]=function(_0x2a58d7,_0x2a2aca){var _0x52b197={'raw':![],'where':{'id':_0x2a58d7['params']['id']}},_0x544ad0={};_0x544ad0[_0x6e70('0x32')]=_['keys'](db[_0x6e70('0x2f')][_0x6e70('0x30')]);_0x544ad0[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x2a58d7['query']);_0x544ad0[_0x6e70('0x35')]=_['intersection'](_0x544ad0[_0x6e70('0x32')],_0x544ad0[_0x6e70('0x33')]);_0x52b197[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x544ad0['model'],qs[_0x6e70('0x38')](_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x38')]));_0x52b197[_0x6e70('0x37')]=_0x52b197[_0x6e70('0x37')][_0x6e70('0x39')]?_0x52b197[_0x6e70('0x37')]:_0x544ad0['model'];if(_0x2a58d7[_0x6e70('0x33')][_0x6e70('0x46')]){_0x52b197[_0x6e70('0x47')]=[{'all':!![]}];}_0x52b197=_[_0x6e70('0x3f')]({},_0x52b197,_0x2a58d7[_0x6e70('0x41')]);return db[_0x6e70('0x2f')][_0x6e70('0x48')](_0x52b197)['then'](handleEntityNotFound(_0x2a2aca,null))[_0x6e70('0x2a')](respondWithResult(_0x2a2aca,null))['catch'](handleError(_0x2a2aca,null));};exports[_0x6e70('0x49')]=function(_0x3836e4,_0x4b351e){return db['ZendeskAccount'][_0x6e70('0x49')](_0x3836e4[_0x6e70('0x4a')],{})[_0x6e70('0x2a')](respondWithResult(_0x4b351e,0xc9))['catch'](handleError(_0x4b351e,null));};exports['update']=function(_0x238ebb,_0x11ac3d){if(_0x238ebb[_0x6e70('0x4a')]['id']){delete _0x238ebb[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x238ebb['params']['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x11ac3d,null))[_0x6e70('0x2a')](saveUpdates(_0x238ebb[_0x6e70('0x4a')],null))[_0x6e70('0x2a')](respondWithResult(_0x11ac3d,null))[_0x6e70('0x4b')](handleError(_0x11ac3d,null));};exports['destroy']=function(_0x4ae901,_0x2c5538){return db[_0x6e70('0x2f')][_0x6e70('0x48')]({'where':{'id':_0x4ae901[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x2c5538,null))['then'](removeEntity(_0x2c5538,null))[_0x6e70('0x4b')](handleError(_0x2c5538,null));};exports[_0x6e70('0x4d')]=function(_0x1fa320,_0x23ebfb,_0x3aba34){var _0x4a111a={};var _0x1142cd={};var _0x1dd242;var _0x2c20d3;return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x1fa320[_0x6e70('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23ebfb,null))[_0x6e70('0x2a')](function(_0x8d425d){if(_0x8d425d){_0x1dd242=_0x8d425d;_0x1142cd['model']=_[_0x6e70('0x34')](db[_0x6e70('0x4f')]['rawAttributes']);_0x1142cd[_0x6e70('0x33')]=_[_0x6e70('0x34')](_0x1fa320[_0x6e70('0x33')]);_0x1142cd[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x1142cd['model'],_0x1142cd[_0x6e70('0x33')]);_0x4a111a[_0x6e70('0x37')]=_[_0x6e70('0x36')](_0x1142cd[_0x6e70('0x32')],qs[_0x6e70('0x38')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x38')]));_0x4a111a[_0x6e70('0x37')]=_0x4a111a[_0x6e70('0x37')][_0x6e70('0x39')]?_0x4a111a[_0x6e70('0x37')]:_0x1142cd[_0x6e70('0x32')];_0x4a111a[_0x6e70('0x3b')]=qs[_0x6e70('0x3c')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3c')]);_0x4a111a[_0x6e70('0x3d')]=qs[_0x6e70('0x35')](_[_0x6e70('0x50')](_0x1fa320[_0x6e70('0x33')],_0x1142cd['filters']));if(_0x1fa320[_0x6e70('0x33')][_0x6e70('0x3e')]){_0x4a111a[_0x6e70('0x3d')]=_[_0x6e70('0x3f')](_0x4a111a[_0x6e70('0x3d')],{'$or':_[_0x6e70('0x2e')](_0x4a111a['attributes'],function(_0x42bd85){var _0x6cabf0={};_0x6cabf0[_0x42bd85]={'$like':'%'+_0x1fa320['query'][_0x6e70('0x3e')]+'%'};return _0x6cabf0;})});}_0x4a111a=_[_0x6e70('0x3f')]({},_0x4a111a,_0x1fa320[_0x6e70('0x41')]);return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2f9be4){if(_0x2f9be4){_0x2c20d3=_0x2f9be4[_0x6e70('0x39')];if(!_0x1fa320[_0x6e70('0x33')][_0x6e70('0x51')](_0x6e70('0x3a'))){_0x4a111a[_0x6e70('0x22')]=qs[_0x6e70('0x22')](_0x1fa320['query']['limit']);_0x4a111a[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x1fa320[_0x6e70('0x33')][_0x6e70('0x20')]);}return _0x1dd242['getConfigurations'](_0x4a111a);}})['then'](function(_0x2e972b){if(_0x2e972b){return _0x2e972b?{'count':_0x2c20d3,'rows':_0x2e972b}:null;}})[_0x6e70('0x2a')](respondWithResult(_0x23ebfb,null))['catch'](handleError(_0x23ebfb,null));};exports['addConfiguration']=function(_0x355708,_0x47fbed,_0x2a8fb7){if(_0x355708[_0x6e70('0x4a')]['id']){delete _0x355708[_0x6e70('0x4a')]['id'];}return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x355708[_0x6e70('0x4c')]['id']}})[_0x6e70('0x2a')](handleEntityNotFound(_0x47fbed,null))[_0x6e70('0x2a')](function(_0x570115){if(_0x570115){_0x355708[_0x6e70('0x4a')][_0x6e70('0x52')]=_0x570115['id'];_0x355708[_0x6e70('0x4a')][_0x6e70('0x53')]=integrations[_0x6e70('0x54')](_0x355708['body']['channel'],_0x355708['body'][_0x6e70('0x31')]);_0x355708[_0x6e70('0x4a')][_0x6e70('0x55')]=integrations['getDescriptions'](_0x355708['body'][_0x6e70('0x56')],_0x355708[_0x6e70('0x4a')][_0x6e70('0x31')]);return db[_0x6e70('0x4f')][_0x6e70('0x49')](_0x355708[_0x6e70('0x4a')],{'include':[{'model':db['ZendeskField'],'as':_0x6e70('0x53')},{'model':db[_0x6e70('0x57')],'as':_0x6e70('0x55')}]});}return null;})[_0x6e70('0x2a')](respondWithResult(_0x47fbed,null))['catch'](handleError(_0x47fbed,null));};exports[_0x6e70('0x58')]=function(_0x531097,_0x5b4046,_0x30487b){var _0x3249a5='';return db[_0x6e70('0x2f')][_0x6e70('0x4e')]({'where':{'id':_0x531097[_0x6e70('0x4c')]['id']},'attributes':['id',_0x6e70('0x59'),'password',_0x6e70('0x5a'),_0x6e70('0x5b'),_0x6e70('0x5c')]})[_0x6e70('0x2a')](handleEntityNotFound(_0x5b4046,null))[_0x6e70('0x2a')](function(_0x13c092){if(_0x13c092){_0x3249a5=_0x13c092[_0x6e70('0x5c')];var _0xd9b4a9=_0x3249a5[_0x6e70('0x5d')](-0x1);if(_0xd9b4a9==='/'){_0x3249a5=_0x3249a5[_0x6e70('0x5e')](0x0,_0x3249a5['lastIndexOf'](_0xd9b4a9));}var _0x44c877={'method':_0x6e70('0x5f'),'uri':util[_0x6e70('0x60')]('%s/%s',_0x3249a5,'ticket_fields'),'json':!![]};switch(_0x13c092[_0x6e70('0x5b')]){case _0x6e70('0x61'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util['format']('%s:%s',_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x61')]))['toString'](_0x6e70('0x64')))};break;case _0x6e70('0x5a'):_0x44c877[_0x6e70('0x62')]={'Authorization':util[_0x6e70('0x60')](_0x6e70('0x63'),new Buffer(util[_0x6e70('0x60')](_0x6e70('0x65'),_0x13c092[_0x6e70('0x59')],_0x13c092[_0x6e70('0x5a')]))[_0x6e70('0x66')](_0x6e70('0x64')))};break;default:throw new db[(_0x6e70('0x67'))][(_0x6e70('0x68'))](_0x6e70('0x69'));}return rp(_0x44c877);}})['then'](function(_0x5b3cb0){if(_0x5b3cb0){var _0x39ed95=['subject',_0x6e70('0x6a'),'group','assignee'];_[_0x6e70('0x6b')](_0x5b3cb0['ticket_fields'],function(_0x576069){return _0x39ed95[_0x6e70('0x6c')](_0x576069[_0x6e70('0x31')]);});return{'count':_0x5b3cb0[_0x6e70('0x6d')]['length'],'rows':_['map'](_0x5b3cb0['ticket_fields'],function(_0x3e7be7){return{'id':_0x3e7be7['id'],'name':_0x3e7be7['position']>0x7?_0x3e7be7[_0x6e70('0x6e')]:_0x3e7be7[_0x6e70('0x31')],'custom':_0x3e7be7[_0x6e70('0x6f')]>0x7?!![]:![],'options':_0x3e7be7[_0x6e70('0x70')]?_0x3e7be7[_0x6e70('0x70')]:_0x3e7be7[_0x6e70('0x71')]?_0x3e7be7[_0x6e70('0x71')]:[]};})};}})['then'](respondWithResult(_0x5b4046,null))[_0x6e70('0x4b')](function(_0x2493b0){var _0xb649a6=_0x531097['query'][_0x6e70('0x72')]?0x1f4:_0x2493b0[_0x6e70('0x73')]||0x1f4;logger[_0x6e70('0x74')](_0x6e70('0x75'),_0x6e70('0x58'),_0xb649a6,JSON[_0x6e70('0x76')](_0x2493b0));delete _0x2493b0[_0x6e70('0x2c')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x5b4046[_0x6e70('0x23')](_0xb649a6)[_0x6e70('0x2d')](_0x531097['query'][_0x6e70('0x72')]?{'message':_0x6e70('0x77'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file +var _0x1339=['Sequelize','Unknown\x20authentication\x20type','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','update','then','name','send','map','fieldName','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','body','destroy','params','findOne','pick','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','GET','%s/%s','authType','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','base64'];(function(_0x551fbe,_0x3a78b3){var _0x5b02ac=function(_0x1948ec){while(--_0x1948ec){_0x551fbe['push'](_0x551fbe['shift']());}};_0x5b02ac(++_0x3a78b3);}(_0x1339,0x1ed));var _0x9133=function(_0x22f014,_0x733c8b){_0x22f014=_0x22f014-0x0;var _0x396fca=_0x1339[_0x22f014];return _0x396fca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9133('0x1a'));function respondWithStatusCode(_0x7cc59e,_0x4bbfdc){_0x4bbfdc=_0x4bbfdc||0xcc;return function(_0x5283a3){if(_0x5283a3){return _0x7cc59e[_0x9133('0x1b')](_0x4bbfdc);}return _0x7cc59e['status'](_0x4bbfdc)[_0x9133('0x1c')]();};}function respondWithResult(_0x439e1a,_0x17dfd1){_0x17dfd1=_0x17dfd1||0xc8;return function(_0x464ec5){if(_0x464ec5){return _0x439e1a[_0x9133('0x1d')](_0x17dfd1)[_0x9133('0x1e')](_0x464ec5);}};}function respondWithFilteredResult(_0x49cc5d,_0x13f8fc){return function(_0x1e23ce){if(_0x1e23ce){var _0x4f4f14=typeof _0x13f8fc[_0x9133('0x1f')]===_0x9133('0x20')&&typeof _0x13f8fc[_0x9133('0x21')]===_0x9133('0x20');var _0x4a2c4f=_0x1e23ce[_0x9133('0x22')];var _0x573998=_0x4f4f14?0x0:_0x13f8fc[_0x9133('0x1f')];var _0x5d4a77=_0x4f4f14?_0x1e23ce[_0x9133('0x22')]:_0x13f8fc[_0x9133('0x1f')]+_0x13f8fc['limit'];var _0x38dd60;if(_0x5d4a77>=_0x4a2c4f){_0x5d4a77=_0x4a2c4f;_0x38dd60=0xc8;}else{_0x38dd60=0xce;}_0x49cc5d['status'](_0x38dd60);return _0x49cc5d[_0x9133('0x23')]('Content-Range',_0x573998+'-'+_0x5d4a77+'/'+_0x4a2c4f)['json'](_0x1e23ce);}return null;};}function patchUpdates(_0x2f7354){return function(_0x577de4){try{jsonpatch[_0x9133('0x24')](_0x577de4,_0x2f7354,!![]);}catch(_0x4c1088){return BPromise['reject'](_0x4c1088);}return _0x577de4['save']();};}function saveUpdates(_0x2e99a1,_0x2dcfb8){return function(_0x4da09c){if(_0x4da09c){return _0x4da09c[_0x9133('0x25')](_0x2e99a1)[_0x9133('0x26')](function(_0xff08d5){return _0xff08d5;});}return null;};}function removeEntity(_0x26190c,_0x4f26e8){return function(_0xdb7a98){if(_0xdb7a98){return _0xdb7a98['destroy']()[_0x9133('0x26')](function(){_0x26190c[_0x9133('0x1d')](0xcc)[_0x9133('0x1c')]();});}};}function handleEntityNotFound(_0x14c1cb,_0x4483ef){return function(_0xe829b){if(!_0xe829b){_0x14c1cb[_0x9133('0x1b')](0x194);}return _0xe829b;};}function handleError(_0x313d43,_0x1b6b3e){_0x1b6b3e=_0x1b6b3e||0x1f4;return function(_0x46050b){logger['error'](_0x46050b['stack']);if(_0x46050b[_0x9133('0x27')]){delete _0x46050b[_0x9133('0x27')];}_0x313d43[_0x9133('0x1d')](_0x1b6b3e)[_0x9133('0x28')](_0x46050b);};}exports['index']=function(_0x4ecd9e,_0x3e2404){var _0x45966d={},_0x188c49={},_0x26d351={'count':0x0,'rows':[]};var _0x390f50=_[_0x9133('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x5a27c1){return{'name':_0x5a27c1[_0x9133('0x2a')],'type':_0x5a27c1['type'][_0x9133('0x2b')]};});_0x188c49[_0x9133('0x2c')]=_['map'](_0x390f50,_0x9133('0x27'));_0x188c49['query']=_[_0x9133('0x2d')](_0x4ecd9e[_0x9133('0x2e')]);_0x188c49[_0x9133('0x2f')]=_['intersection'](_0x188c49[_0x9133('0x2c')],_0x188c49[_0x9133('0x2e')]);_0x45966d[_0x9133('0x30')]=_['intersection'](_0x188c49[_0x9133('0x2c')],qs[_0x9133('0x31')](_0x4ecd9e[_0x9133('0x2e')]['fields']));_0x45966d[_0x9133('0x30')]=_0x45966d[_0x9133('0x30')][_0x9133('0x32')]?_0x45966d[_0x9133('0x30')]:_0x188c49['model'];if(!_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x33')]('nolimit')){_0x45966d[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x21')]);_0x45966d[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x1f')]);}_0x45966d[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4ecd9e[_0x9133('0x2e')]['sort']);_0x45966d[_0x9133('0x36')]=qs[_0x9133('0x2f')](_['pick'](_0x4ecd9e[_0x9133('0x2e')],_0x188c49[_0x9133('0x2f')]),_0x390f50);if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]){_0x45966d[_0x9133('0x36')]=_[_0x9133('0x38')](_0x45966d['where'],{'$or':_['map'](_0x390f50,function(_0x33c05b){if(_0x33c05b[_0x9133('0x39')]!==_0x9133('0x3a')){var _0x112514={};_0x112514[_0x33c05b[_0x9133('0x27')]]={'$like':'%'+_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x37')]+'%'};return _0x112514;}})});}_0x45966d=_[_0x9133('0x38')]({},_0x45966d,_0x4ecd9e[_0x9133('0x3b')]);var _0x5a3f73={'where':_0x45966d[_0x9133('0x36')]};return db[_0x9133('0x3c')][_0x9133('0x22')](_0x5a3f73)[_0x9133('0x26')](function(_0x3df6ca){_0x26d351['count']=_0x3df6ca;if(_0x4ecd9e[_0x9133('0x2e')][_0x9133('0x3d')]){_0x45966d[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x3c')]['findAll'](_0x45966d);})[_0x9133('0x26')](function(_0x1293f1){_0x26d351[_0x9133('0x3f')]=_0x1293f1;return _0x26d351;})[_0x9133('0x26')](respondWithFilteredResult(_0x3e2404,_0x45966d))[_0x9133('0x40')](handleError(_0x3e2404,null));};exports[_0x9133('0x41')]=function(_0x3b2287,_0x4ca1a3){var _0x7f6cd9={'raw':![],'where':{'id':_0x3b2287['params']['id']}},_0x5e0fde={};_0x5e0fde[_0x9133('0x2c')]=_[_0x9133('0x2d')](db[_0x9133('0x3c')][_0x9133('0x42')]);_0x5e0fde[_0x9133('0x2e')]=_[_0x9133('0x2d')](_0x3b2287[_0x9133('0x2e')]);_0x5e0fde[_0x9133('0x2f')]=_[_0x9133('0x43')](_0x5e0fde['model'],_0x5e0fde[_0x9133('0x2e')]);_0x7f6cd9[_0x9133('0x30')]=_[_0x9133('0x43')](_0x5e0fde['model'],qs['fields'](_0x3b2287[_0x9133('0x2e')][_0x9133('0x31')]));_0x7f6cd9['attributes']=_0x7f6cd9[_0x9133('0x30')][_0x9133('0x32')]?_0x7f6cd9[_0x9133('0x30')]:_0x5e0fde[_0x9133('0x2c')];if(_0x3b2287[_0x9133('0x2e')]['includeAll']){_0x7f6cd9[_0x9133('0x3e')]=[{'all':!![]}];}_0x7f6cd9=_[_0x9133('0x38')]({},_0x7f6cd9,_0x3b2287[_0x9133('0x3b')]);return db['ZendeskAccount'][_0x9133('0x44')](_0x7f6cd9)[_0x9133('0x26')](handleEntityNotFound(_0x4ca1a3,null))['then'](respondWithResult(_0x4ca1a3,null))['catch'](handleError(_0x4ca1a3,null));};exports[_0x9133('0x45')]=function(_0x2cd935,_0x4446fe){return db[_0x9133('0x3c')][_0x9133('0x45')](_0x2cd935[_0x9133('0x46')],{})[_0x9133('0x26')](respondWithResult(_0x4446fe,0xc9))[_0x9133('0x40')](handleError(_0x4446fe,null));};exports[_0x9133('0x25')]=function(_0xf07fbb,_0x3d6a49){if(_0xf07fbb[_0x9133('0x46')]['id']){delete _0xf07fbb['body']['id'];}return db['ZendeskAccount'][_0x9133('0x44')]({'where':{'id':_0xf07fbb['params']['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3d6a49,null))[_0x9133('0x26')](saveUpdates(_0xf07fbb[_0x9133('0x46')],null))[_0x9133('0x26')](respondWithResult(_0x3d6a49,null))['catch'](handleError(_0x3d6a49,null));};exports[_0x9133('0x47')]=function(_0x25750f,_0x799772){return db['ZendeskAccount'][_0x9133('0x44')]({'where':{'id':_0x25750f[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x799772,null))['then'](removeEntity(_0x799772,null))[_0x9133('0x40')](handleError(_0x799772,null));};exports['getConfigurations']=function(_0x2342f4,_0x3c4b67,_0x304673){var _0x9fa963={};var _0x4f58fe={};var _0x4a346c;var _0x2f09f6;return db[_0x9133('0x3c')][_0x9133('0x49')]({'where':{'id':_0x2342f4[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x3c4b67,null))['then'](function(_0x554bb9){if(_0x554bb9){_0x4a346c=_0x554bb9;_0x4f58fe[_0x9133('0x2c')]=_[_0x9133('0x2d')](db['ZendeskConfiguration'][_0x9133('0x42')]);_0x4f58fe[_0x9133('0x2e')]=_['keys'](_0x2342f4['query']);_0x4f58fe['filters']=_[_0x9133('0x43')](_0x4f58fe['model'],_0x4f58fe[_0x9133('0x2e')]);_0x9fa963[_0x9133('0x30')]=_[_0x9133('0x43')](_0x4f58fe[_0x9133('0x2c')],qs['fields'](_0x2342f4[_0x9133('0x2e')]['fields']));_0x9fa963[_0x9133('0x30')]=_0x9fa963[_0x9133('0x30')][_0x9133('0x32')]?_0x9fa963[_0x9133('0x30')]:_0x4f58fe[_0x9133('0x2c')];_0x9fa963[_0x9133('0x34')]=qs['sort'](_0x2342f4['query']['sort']);_0x9fa963[_0x9133('0x36')]=qs[_0x9133('0x2f')](_[_0x9133('0x4a')](_0x2342f4['query'],_0x4f58fe[_0x9133('0x2f')]));if(_0x2342f4[_0x9133('0x2e')][_0x9133('0x37')]){_0x9fa963[_0x9133('0x36')]=_[_0x9133('0x38')](_0x9fa963[_0x9133('0x36')],{'$or':_[_0x9133('0x29')](_0x9fa963[_0x9133('0x30')],function(_0x59bb26){var _0x464954={};_0x464954[_0x59bb26]={'$like':'%'+_0x2342f4['query'][_0x9133('0x37')]+'%'};return _0x464954;})});}_0x9fa963=_['merge']({},_0x9fa963,_0x2342f4[_0x9133('0x3b')]);return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x540b02){if(_0x540b02){_0x2f09f6=_0x540b02[_0x9133('0x32')];if(!_0x2342f4[_0x9133('0x2e')][_0x9133('0x33')](_0x9133('0x4c'))){_0x9fa963[_0x9133('0x21')]=qs[_0x9133('0x21')](_0x2342f4[_0x9133('0x2e')][_0x9133('0x21')]);_0x9fa963[_0x9133('0x1f')]=qs[_0x9133('0x1f')](_0x2342f4[_0x9133('0x2e')]['offset']);}return _0x4a346c[_0x9133('0x4b')](_0x9fa963);}})['then'](function(_0x23d61f){if(_0x23d61f){return _0x23d61f?{'count':_0x2f09f6,'rows':_0x23d61f}:null;}})[_0x9133('0x26')](respondWithResult(_0x3c4b67,null))[_0x9133('0x40')](handleError(_0x3c4b67,null));};exports[_0x9133('0x4d')]=function(_0xd37001,_0x52d4c8,_0x35bc72){if(_0xd37001[_0x9133('0x46')]['id']){delete _0xd37001[_0x9133('0x46')]['id'];}return db[_0x9133('0x3c')]['findOne']({'where':{'id':_0xd37001[_0x9133('0x48')]['id']}})[_0x9133('0x26')](handleEntityNotFound(_0x52d4c8,null))[_0x9133('0x26')](function(_0x31e978){if(_0x31e978){_0xd37001['body']['AccountId']=_0x31e978['id'];_0xd37001[_0x9133('0x46')][_0x9133('0x4e')]=integrations[_0x9133('0x4f')](_0xd37001[_0x9133('0x46')][_0x9133('0x50')],_0xd37001[_0x9133('0x46')]['type']);_0xd37001[_0x9133('0x46')][_0x9133('0x51')]=integrations[_0x9133('0x52')](_0xd37001[_0x9133('0x46')]['channel'],_0xd37001[_0x9133('0x46')]['type']);return db[_0x9133('0x53')][_0x9133('0x45')](_0xd37001[_0x9133('0x46')],{'include':[{'model':db[_0x9133('0x54')],'as':_0x9133('0x4e')},{'model':db[_0x9133('0x54')],'as':_0x9133('0x51')}]});}return null;})[_0x9133('0x26')](respondWithResult(_0x52d4c8,null))['catch'](handleError(_0x52d4c8,null));};exports[_0x9133('0x55')]=function(_0x1fcd01,_0x10afd7,_0x152283){var _0x406861='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x1fcd01['params']['id']},'attributes':['id',_0x9133('0x56'),_0x9133('0x57'),_0x9133('0x58'),'authType',_0x9133('0x59')]})[_0x9133('0x26')](handleEntityNotFound(_0x10afd7,null))[_0x9133('0x26')](function(_0x3e660c){if(_0x3e660c){_0x406861=_0x3e660c[_0x9133('0x59')];var _0x4cab23=_0x406861[_0x9133('0x5a')](-0x1);if(_0x4cab23==='/'){_0x406861=_0x406861[_0x9133('0x5b')](0x0,_0x406861['lastIndexOf'](_0x4cab23));}var _0x41f924={'method':_0x9133('0x5c'),'uri':util['format'](_0x9133('0x5d'),_0x406861,'ticket_fields'),'json':!![]};switch(_0x3e660c[_0x9133('0x5e')]){case _0x9133('0x57'):_0x41f924[_0x9133('0x5f')]={'Authorization':util[_0x9133('0x60')](_0x9133('0x61'),new Buffer(util['format'](_0x9133('0x62'),_0x3e660c[_0x9133('0x56')],_0x3e660c[_0x9133('0x57')]))[_0x9133('0x63')]('base64'))};break;case _0x9133('0x58'):_0x41f924[_0x9133('0x5f')]={'Authorization':util[_0x9133('0x60')](_0x9133('0x61'),new Buffer(util[_0x9133('0x60')](_0x9133('0x64'),_0x3e660c[_0x9133('0x56')],_0x3e660c[_0x9133('0x58')]))[_0x9133('0x63')](_0x9133('0x65')))};break;default:throw new db[(_0x9133('0x66'))]['ValidationError'](_0x9133('0x67'));}return rp(_0x41f924);}})[_0x9133('0x26')](function(_0x242974){if(_0x242974){var _0x12ae5f=['subject',_0x9133('0x68'),'group',_0x9133('0x69')];_[_0x9133('0x6a')](_0x242974[_0x9133('0x6b')],function(_0x530984){return _0x12ae5f[_0x9133('0x6c')](_0x530984[_0x9133('0x39')]);});return{'count':_0x242974[_0x9133('0x6b')]['length'],'rows':_[_0x9133('0x29')](_0x242974[_0x9133('0x6b')],function(_0x5013f8){return{'id':_0x5013f8['id'],'name':_0x5013f8[_0x9133('0x6d')]>0x7?_0x5013f8[_0x9133('0x6e')]:_0x5013f8[_0x9133('0x39')],'custom':_0x5013f8['position']>0x7?!![]:![],'options':_0x5013f8[_0x9133('0x6f')]?_0x5013f8['system_field_options']:_0x5013f8[_0x9133('0x70')]?_0x5013f8[_0x9133('0x70')]:[]};})};}})[_0x9133('0x26')](respondWithResult(_0x10afd7,null))['catch'](function(_0x2bd590){var _0x54f9ad=_0x1fcd01[_0x9133('0x2e')][_0x9133('0x71')]?0x1f4:_0x2bd590[_0x9133('0x72')]||0x1f4;logger[_0x9133('0x73')](_0x9133('0x74'),_0x9133('0x55'),_0x54f9ad,JSON[_0x9133('0x75')](_0x2bd590));delete _0x2bd590[_0x9133('0x27')];if(_0x54f9ad===0x191){_0x54f9ad=0x190;}_0x10afd7['status'](_0x54f9ad)[_0x9133('0x28')](_0x1fcd01[_0x9133('0x2e')][_0x9133('0x71')]?{'message':_0x9133('0x76'),'statusCode':_0x2bd590[_0x9133('0x72')]}:_0x2bd590);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 989e340..f002ed5 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 _0x3383=['../../components/integrations/configuration','exports','ZendeskAccount','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xe303af,_0x102abc){var _0x545a48=function(_0x29cc61){while(--_0x29cc61){_0xe303af['push'](_0xe303af['shift']());}};_0x545a48(++_0x102abc);}(_0x3383,0x1a7));var _0x3338=function(_0x2f5b29,_0x5df8e0){_0x2f5b29=_0x2f5b29-0x0;var _0x257472=_0x3383[_0x2f5b29];return _0x257472;};'use strict';var _=require(_0x3338('0x0'));var util=require(_0x3338('0x1'));var logger=require(_0x3338('0x2'))(_0x3338('0x3'));var moment=require('moment');var BPromise=require(_0x3338('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3338('0x5'));var rimraf=require(_0x3338('0x6'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x3338('0x7'));module[_0x3338('0x8')]=function(_0x461b38,_0x330e78){return _0x461b38['define'](_0x3338('0x9'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1941=['define','int_zendesk_accounts','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskAccount.attributes','exports'];(function(_0x302c47,_0xce44ea){var _0x21baa2=function(_0x5644ba){while(--_0x5644ba){_0x302c47['push'](_0x302c47['shift']());}};_0x21baa2(++_0xce44ea);}(_0x1941,0x10a));var _0x1194=function(_0x2f2247,_0x427250){_0x2f2247=_0x2f2247-0x0;var _0xbd84d8=_0x1941[_0x2f2247];return _0xbd84d8;};'use strict';var _=require('lodash');var util=require(_0x1194('0x0'));var logger=require(_0x1194('0x1'))(_0x1194('0x2'));var moment=require(_0x1194('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1194('0x4'));var rimraf=require(_0x1194('0x5'));var config=require(_0x1194('0x6'));var attributes=require(_0x1194('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1194('0x8')]=function(_0x25b642,_0x4895c6){return _0x25b642[_0x1194('0x9')]('ZendeskAccount',attributes,{'tableName':_0x1194('0xa'),'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 96a698d..cd5dcb3 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 _0x528c=['code','message','result','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','GetZendeskAccount','catch','ShowZendeskAccount','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x473698,_0x18f49e){var _0x14b0ac=function(_0x441765){while(--_0x441765){_0x473698['push'](_0x473698['shift']());}};_0x14b0ac(++_0x18f49e);}(_0x528c,0xe8));var _0xc528=function(_0x3b91b1,_0x2db589){_0x3b91b1=_0x3b91b1-0x0;var _0x2ad6fc=_0x528c[_0x3b91b1];return _0x2ad6fc;};'use strict';var _=require(_0xc528('0x0'));var util=require('util');var moment=require(_0xc528('0x1'));var BPromise=require('bluebird');var rs=require(_0xc528('0x2'));var fs=require('fs');var Redis=require(_0xc528('0x3'));var db=require(_0xc528('0x4'))['db'];var utils=require(_0xc528('0x5'));var logger=require(_0xc528('0x6'))(_0xc528('0x7'));var config=require(_0xc528('0x8'));var jayson=require(_0xc528('0x9'));var client=jayson[_0xc528('0xa')][_0xc528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44b2af,_0x3d7947,_0x3409bd){return new BPromise(function(_0x44772c,_0x287414){return client['request'](_0x44b2af,_0x3409bd)[_0xc528('0xc')](function(_0x4d495b){logger[_0xc528('0xd')](_0xc528('0xe'),_0x3d7947,_0xc528('0xf'));logger[_0xc528('0x10')](_0xc528('0x11'),_0x3d7947,_0xc528('0xf'),JSON[_0xc528('0x12')](_0x4d495b));if(_0x4d495b[_0xc528('0x13')]){if(_0x4d495b[_0xc528('0x13')][_0xc528('0x14')]===0x1f4){logger['error'](_0xc528('0xe'),_0x3d7947,_0x4d495b['error'][_0xc528('0x15')]);return _0x287414(_0x4d495b[_0xc528('0x13')]['message']);}logger[_0xc528('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x3d7947,_0x4d495b[_0xc528('0x13')][_0xc528('0x15')]);return _0x44772c(_0x4d495b[_0xc528('0x13')][_0xc528('0x15')]);}else{logger[_0xc528('0xd')](_0xc528('0xe'),_0x3d7947,'request\x20sent');_0x44772c(_0x4d495b[_0xc528('0x16')]['message']);}})['catch'](function(_0xacaf19){logger[_0xc528('0x13')](_0xc528('0xe'),_0x3d7947,_0xacaf19);_0x287414(_0xacaf19);});});}exports['GetZendeskAccount']=function(_0x410f75){var _0x2bc005=this;return new Promise(function(_0x4fa4ca,_0xfe4c5d){return db[_0xc528('0x17')][_0xc528('0x18')]({'raw':_0x410f75['options']?_0x410f75[_0xc528('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x410f75['options']?_0x410f75[_0xc528('0x19')][_0xc528('0x1a')]||null:null,'attributes':_0x410f75[_0xc528('0x19')]?_0x410f75[_0xc528('0x19')][_0xc528('0x1b')]||null:null,'limit':_0x410f75[_0xc528('0x19')]?_0x410f75[_0xc528('0x19')][_0xc528('0x1c')]||null:null,'include':_0x410f75['options']?_0x410f75[_0xc528('0x19')][_0xc528('0x1d')]?_[_0xc528('0x1e')](_0x410f75['options'][_0xc528('0x1d')],function(_0x588010){return{'model':db[_0x588010[_0xc528('0x1f')]],'as':_0x588010['as'],'attributes':_0x588010[_0xc528('0x1b')],'include':_0x588010['include']?_[_0xc528('0x1e')](_0x588010[_0xc528('0x1d')],function(_0x541877){return{'model':db[_0x541877[_0xc528('0x1f')]],'as':_0x541877['as'],'attributes':_0x541877[_0xc528('0x1b')],'include':_0x541877[_0xc528('0x1d')]?_[_0xc528('0x1e')](_0x541877[_0xc528('0x1d')],function(_0x369ea6){return{'model':db[_0x369ea6[_0xc528('0x1f')]],'as':_0x369ea6['as'],'attributes':_0x369ea6[_0xc528('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xf2247){logger[_0xc528('0xd')](_0xc528('0x20'),_0x410f75);logger[_0xc528('0x10')](_0xc528('0x20'),_0x410f75,JSON[_0xc528('0x12')](_0xf2247));_0x4fa4ca(_0xf2247);})[_0xc528('0x21')](function(_0x1b60a7){logger[_0xc528('0x13')](_0xc528('0x20'),_0x1b60a7[_0xc528('0x15')],_0x410f75);_0xfe4c5d(_0x2bc005[_0xc528('0x13')](0x1f4,_0x1b60a7['message']));});});};exports[_0xc528('0x22')]=function(_0x5d82f1){var _0x176cf2=this;return new Promise(function(_0xfc1a76,_0x1f3c2a){return db[_0xc528('0x17')]['find']({'raw':_0x5d82f1[_0xc528('0x19')]?_0x5d82f1['options'][_0xc528('0x23')]===undefined?!![]:![]:!![],'where':_0x5d82f1[_0xc528('0x19')]?_0x5d82f1[_0xc528('0x19')][_0xc528('0x1a')]||null:null,'attributes':_0x5d82f1[_0xc528('0x19')]?_0x5d82f1[_0xc528('0x19')][_0xc528('0x1b')]||null:null,'include':_0x5d82f1['options']?_0x5d82f1[_0xc528('0x19')][_0xc528('0x1d')]?_[_0xc528('0x1e')](_0x5d82f1[_0xc528('0x19')][_0xc528('0x1d')],function(_0x3d622a){return{'model':db[_0x3d622a[_0xc528('0x1f')]],'as':_0x3d622a['as'],'attributes':_0x3d622a[_0xc528('0x1b')],'include':_0x3d622a[_0xc528('0x1d')]?_[_0xc528('0x1e')](_0x3d622a[_0xc528('0x1d')],function(_0x4e67cf){return{'model':db[_0x4e67cf[_0xc528('0x1f')]],'as':_0x4e67cf['as'],'attributes':_0x4e67cf[_0xc528('0x1b')],'include':_0x4e67cf[_0xc528('0x1d')]?_[_0xc528('0x1e')](_0x4e67cf[_0xc528('0x1d')],function(_0x86c9a4){return{'model':db[_0x86c9a4[_0xc528('0x1f')]],'as':_0x86c9a4['as'],'attributes':_0x86c9a4[_0xc528('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cc98){logger[_0xc528('0xd')](_0xc528('0x22'),_0x5d82f1);logger['debug'](_0xc528('0x22'),_0x5d82f1,JSON[_0xc528('0x12')](_0x29cc98));_0xfc1a76(_0x29cc98);})[_0xc528('0x21')](function(_0x108ed2){logger[_0xc528('0x13')](_0xc528('0x22'),_0x108ed2[_0xc528('0x15')],_0x5d82f1);_0x1f3c2a(_0x176cf2[_0xc528('0x13')](0x1f4,_0x108ed2[_0xc528('0x15')]));});});}; \ No newline at end of file +var _0xee5c=['http','request','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZendeskAccount,\x20%s,\x20%s','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','limit','include','map','attributes','model','then','ShowZendeskAccount','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xee5c,0xcd));var _0xcee5=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0xee5c[_0x4bfade];return _0x272465;};'use strict';var _=require(_0xcee5('0x0'));var util=require(_0xcee5('0x1'));var moment=require('moment');var BPromise=require(_0xcee5('0x2'));var rs=require(_0xcee5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcee5('0x4'))['db'];var utils=require(_0xcee5('0x5'));var logger=require(_0xcee5('0x6'))(_0xcee5('0x7'));var config=require(_0xcee5('0x8'));var jayson=require(_0xcee5('0x9'));var client=jayson[_0xcee5('0xa')][_0xcee5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b5a8e,_0xa2caf5,_0x47c8a0){return new BPromise(function(_0xf6f9ea,_0x3da0bf){return client[_0xcee5('0xc')](_0x4b5a8e,_0x47c8a0)['then'](function(_0x3c2765){logger[_0xcee5('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0xa2caf5,_0xcee5('0xe'));logger[_0xcee5('0xf')](_0xcee5('0x10'),_0xa2caf5,_0xcee5('0xe'),JSON[_0xcee5('0x11')](_0x3c2765));if(_0x3c2765[_0xcee5('0x12')]){if(_0x3c2765[_0xcee5('0x12')]['code']===0x1f4){logger[_0xcee5('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0xa2caf5,_0x3c2765[_0xcee5('0x12')][_0xcee5('0x13')]);return _0x3da0bf(_0x3c2765['error'][_0xcee5('0x13')]);}logger[_0xcee5('0x12')](_0xcee5('0x14'),_0xa2caf5,_0x3c2765[_0xcee5('0x12')][_0xcee5('0x13')]);return _0xf6f9ea(_0x3c2765[_0xcee5('0x12')][_0xcee5('0x13')]);}else{logger['info'](_0xcee5('0x14'),_0xa2caf5,_0xcee5('0xe'));_0xf6f9ea(_0x3c2765[_0xcee5('0x15')]['message']);}})[_0xcee5('0x16')](function(_0x43df75){logger[_0xcee5('0x12')](_0xcee5('0x14'),_0xa2caf5,_0x43df75);_0x3da0bf(_0x43df75);});});}exports[_0xcee5('0x17')]=function(_0x1c21d6){var _0x4819b8=this;return new Promise(function(_0x37285c,_0x41022e){return db[_0xcee5('0x18')][_0xcee5('0x19')]({'raw':_0x1c21d6['options']?_0x1c21d6[_0xcee5('0x1a')][_0xcee5('0x1b')]===undefined?!![]:![]:!![],'where':_0x1c21d6[_0xcee5('0x1a')]?_0x1c21d6[_0xcee5('0x1a')]['where']||null:null,'attributes':_0x1c21d6[_0xcee5('0x1a')]?_0x1c21d6[_0xcee5('0x1a')]['attributes']||null:null,'limit':_0x1c21d6['options']?_0x1c21d6[_0xcee5('0x1a')][_0xcee5('0x1c')]||null:null,'include':_0x1c21d6[_0xcee5('0x1a')]?_0x1c21d6[_0xcee5('0x1a')][_0xcee5('0x1d')]?_[_0xcee5('0x1e')](_0x1c21d6[_0xcee5('0x1a')][_0xcee5('0x1d')],function(_0x27ea1c){return{'model':db[_0x27ea1c['model']],'as':_0x27ea1c['as'],'attributes':_0x27ea1c[_0xcee5('0x1f')],'include':_0x27ea1c[_0xcee5('0x1d')]?_[_0xcee5('0x1e')](_0x27ea1c['include'],function(_0x3625c3){return{'model':db[_0x3625c3[_0xcee5('0x20')]],'as':_0x3625c3['as'],'attributes':_0x3625c3[_0xcee5('0x1f')],'include':_0x3625c3[_0xcee5('0x1d')]?_[_0xcee5('0x1e')](_0x3625c3[_0xcee5('0x1d')],function(_0x31c944){return{'model':db[_0x31c944[_0xcee5('0x20')]],'as':_0x31c944['as'],'attributes':_0x31c944[_0xcee5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcee5('0x21')](function(_0x50732e){logger[_0xcee5('0xd')](_0xcee5('0x17'),_0x1c21d6);logger[_0xcee5('0xf')]('GetZendeskAccount',_0x1c21d6,JSON[_0xcee5('0x11')](_0x50732e));_0x37285c(_0x50732e);})[_0xcee5('0x16')](function(_0x373378){logger[_0xcee5('0x12')]('GetZendeskAccount',_0x373378[_0xcee5('0x13')],_0x1c21d6);_0x41022e(_0x4819b8['error'](0x1f4,_0x373378['message']));});});};exports[_0xcee5('0x22')]=function(_0x5e589c){var _0x449d7a=this;return new Promise(function(_0x1c0e37,_0xd2a70a){return db[_0xcee5('0x18')]['find']({'raw':_0x5e589c[_0xcee5('0x1a')]?_0x5e589c[_0xcee5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5e589c['options']?_0x5e589c[_0xcee5('0x1a')][_0xcee5('0x23')]||null:null,'attributes':_0x5e589c[_0xcee5('0x1a')]?_0x5e589c[_0xcee5('0x1a')][_0xcee5('0x1f')]||null:null,'include':_0x5e589c[_0xcee5('0x1a')]?_0x5e589c[_0xcee5('0x1a')]['include']?_['map'](_0x5e589c[_0xcee5('0x1a')]['include'],function(_0x3d2a1a){return{'model':db[_0x3d2a1a[_0xcee5('0x20')]],'as':_0x3d2a1a['as'],'attributes':_0x3d2a1a[_0xcee5('0x1f')],'include':_0x3d2a1a['include']?_['map'](_0x3d2a1a[_0xcee5('0x1d')],function(_0x2f6003){return{'model':db[_0x2f6003[_0xcee5('0x20')]],'as':_0x2f6003['as'],'attributes':_0x2f6003['attributes'],'include':_0x2f6003[_0xcee5('0x1d')]?_['map'](_0x2f6003['include'],function(_0x387ecf){return{'model':db[_0x387ecf[_0xcee5('0x20')]],'as':_0x387ecf['as'],'attributes':_0x387ecf['attributes']};}):[]};}):[]};}):[]:[]})[_0xcee5('0x21')](function(_0x52e7d0){logger[_0xcee5('0xd')]('ShowZendeskAccount',_0x5e589c);logger[_0xcee5('0xf')](_0xcee5('0x22'),_0x5e589c,JSON[_0xcee5('0x11')](_0x52e7d0));_0x1c0e37(_0x52e7d0);})[_0xcee5('0x16')](function(_0x352191){logger['error']('ShowZendeskAccount',_0x352191['message'],_0x5e589c);_0xd2a70a(_0x449d7a[_0xcee5('0x12')](0x1f4,_0x352191[_0xcee5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7b435d1..46afe39 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 _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x1282a3,_0x1c5adf){var _0xb9d84=function(_0x5e9d45){while(--_0x5e9d45){_0x1282a3['push'](_0x1282a3['shift']());}};_0xb9d84(++_0x1c5adf);}(_0x5c00,0x17e));var _0x05c0=function(_0x101134,_0x1ed1d3){_0x101134=_0x101134-0x0;var _0xc47acc=_0x5c00[_0x101134];return _0xc47acc;};'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('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file +var _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x39d095,_0x48309a){var _0x3626dc=function(_0x3474de){while(--_0x3474de){_0x39d095['push'](_0x39d095['shift']());}};_0x3626dc(++_0x48309a);}(_0xac4a,0x13f));var _0xaac4=function(_0x29d079,_0x1c01ec){_0x29d079=_0x29d079-0x0;var _0x20bf89=_0xac4a[_0x29d079];return _0x20bf89;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 5a8f514..08e692b 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 _0x5ac4=['sequelize'];(function(_0x399400,_0x4c2fc9){var _0xcb6385=function(_0x4d77c7){while(--_0x4d77c7){_0x399400['push'](_0x399400['shift']());}};_0xcb6385(++_0x4c2fc9);}(_0x5ac4,0x6a));var _0x45ac=function(_0x35082f,_0x57ea69){_0x35082f=_0x35082f-0x0;var _0x1ae051=_0x5ac4[_0x35082f];return _0x1ae051;};'use strict';var Sequelize=require(_0x45ac('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6e76=['STRING','sequelize','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6e76,0x70));var _0x66e7=function(_0x5a2bae,_0x30f635){_0x5a2bae=_0x5a2bae-0x0;var _0x4cd950=_0x6e76[_0x5a2bae];return _0x4cd950;};'use strict';var Sequelize=require(_0x66e7('0x0'));module[_0x66e7('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x66e7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index dac14ce..b6e07f9 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 _0xb83e=['params','keys','length','include','find','create','body','getFields','findOne','sort','filter','hasOwnProperty','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','limit','undefined','count','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','type','key','model','query','attributes','intersection','fields','nolimit','offset','order','where','filters','pick','merge','options','includeAll','findAll','rows','catch','show'];(function(_0x3dda69,_0x2f43c1){var _0x33903d=function(_0xa88db5){while(--_0xa88db5){_0x3dda69['push'](_0x3dda69['shift']());}};_0x33903d(++_0x2f43c1);}(_0xb83e,0x10e));var _0xeb83=function(_0x3400aa,_0x259590){_0x3400aa=_0x3400aa-0x0;var _0x4620be=_0xb83e[_0x3400aa];return _0x4620be;};'use strict';var emlformat=require(_0xeb83('0x0'));var rimraf=require(_0xeb83('0x1'));var zipdir=require(_0xeb83('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb83('0x3'));var moment=require(_0xeb83('0x4'));var BPromise=require(_0xeb83('0x5'));var Mustache=require(_0xeb83('0x6'));var util=require(_0xeb83('0x7'));var path=require('path');var sox=require(_0xeb83('0x8'));var csv=require(_0xeb83('0x9'));var ejs=require(_0xeb83('0xa'));var fs=require('fs');var fs_extra=require(_0xeb83('0xb'));var _=require('lodash');var squel=require(_0xeb83('0xc'));var crypto=require(_0xeb83('0xd'));var jsforce=require(_0xeb83('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeb83('0x9'));var querystring=require(_0xeb83('0xf'));var Papa=require(_0xeb83('0x10'));var Redis=require(_0xeb83('0x11'));var authService=require(_0xeb83('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeb83('0x13'));var hardwareService=require(_0xeb83('0x14'));var logger=require(_0xeb83('0x15'))(_0xeb83('0x16'));var utils=require('../../config/utils');var config=require(_0xeb83('0x17'));var licenseUtil=require(_0xeb83('0x18'));var db=require(_0xeb83('0x19'))['db'];function respondWithStatusCode(_0x49f726,_0x57cb19){_0x57cb19=_0x57cb19||0xcc;return function(_0x1f37fb){if(_0x1f37fb){return _0x49f726[_0xeb83('0x1a')](_0x57cb19);}return _0x49f726[_0xeb83('0x1b')](_0x57cb19)['end']();};}function respondWithResult(_0x46a90d,_0x462ab5){_0x462ab5=_0x462ab5||0xc8;return function(_0x4bc4e4){if(_0x4bc4e4){return _0x46a90d[_0xeb83('0x1b')](_0x462ab5)['json'](_0x4bc4e4);}};}function respondWithFilteredResult(_0x59147c,_0x350b9e){return function(_0x27525d){if(_0x27525d){var _0x57f486=typeof _0x350b9e['offset']==='undefined'&&typeof _0x350b9e[_0xeb83('0x1c')]===_0xeb83('0x1d');var _0x6bf996=_0x27525d[_0xeb83('0x1e')];var _0x532af1=_0x57f486?0x0:_0x350b9e['offset'];var _0x101cea=_0x57f486?_0x27525d['count']:_0x350b9e['offset']+_0x350b9e[_0xeb83('0x1c')];var _0x8ccc2;if(_0x101cea>=_0x6bf996){_0x101cea=_0x6bf996;_0x8ccc2=0xc8;}else{_0x8ccc2=0xce;}_0x59147c['status'](_0x8ccc2);return _0x59147c['set'](_0xeb83('0x1f'),_0x532af1+'-'+_0x101cea+'/'+_0x6bf996)[_0xeb83('0x20')](_0x27525d);}return null;};}function patchUpdates(_0x48aa73){return function(_0x2817fb){try{jsonpatch[_0xeb83('0x21')](_0x2817fb,_0x48aa73,!![]);}catch(_0x4cf917){return BPromise[_0xeb83('0x22')](_0x4cf917);}return _0x2817fb['save']();};}function saveUpdates(_0x9c0297,_0x4e5752){return function(_0x3b4bfe){if(_0x3b4bfe){return _0x3b4bfe[_0xeb83('0x23')](_0x9c0297)[_0xeb83('0x24')](function(_0x465a32){return _0x465a32;});}return null;};}function removeEntity(_0x188251,_0x39d811){return function(_0x2c1474){if(_0x2c1474){return _0x2c1474[_0xeb83('0x25')]()['then'](function(){_0x188251['status'](0xcc)[_0xeb83('0x26')]();});}};}function handleEntityNotFound(_0x207e8e,_0x2f3709){return function(_0x45b26a){if(!_0x45b26a){_0x207e8e[_0xeb83('0x1a')](0x194);}return _0x45b26a;};}function handleError(_0xfa75be,_0x5365a0){_0x5365a0=_0x5365a0||0x1f4;return function(_0x416e63){logger[_0xeb83('0x27')](_0x416e63[_0xeb83('0x28')]);if(_0x416e63[_0xeb83('0x29')]){delete _0x416e63[_0xeb83('0x29')];}_0xfa75be['status'](_0x5365a0)[_0xeb83('0x2a')](_0x416e63);};}exports['index']=function(_0x994048,_0x12fe27){var _0x1cb614={},_0x387ba4={},_0x273d0d={'count':0x0,'rows':[]};var _0x35984b=_[_0xeb83('0x2b')](db[_0xeb83('0x2c')][_0xeb83('0x2d')],function(_0x523ea5){return{'name':_0x523ea5['fieldName'],'type':_0x523ea5[_0xeb83('0x2e')][_0xeb83('0x2f')]};});_0x387ba4[_0xeb83('0x30')]=_[_0xeb83('0x2b')](_0x35984b,_0xeb83('0x29'));_0x387ba4['query']=_['keys'](_0x994048[_0xeb83('0x31')]);_0x387ba4['filters']=_['intersection'](_0x387ba4[_0xeb83('0x30')],_0x387ba4['query']);_0x1cb614[_0xeb83('0x32')]=_[_0xeb83('0x33')](_0x387ba4[_0xeb83('0x30')],qs[_0xeb83('0x34')](_0x994048['query']['fields']));_0x1cb614[_0xeb83('0x32')]=_0x1cb614[_0xeb83('0x32')]['length']?_0x1cb614[_0xeb83('0x32')]:_0x387ba4[_0xeb83('0x30')];if(!_0x994048[_0xeb83('0x31')]['hasOwnProperty'](_0xeb83('0x35'))){_0x1cb614['limit']=qs[_0xeb83('0x1c')](_0x994048['query'][_0xeb83('0x1c')]);_0x1cb614[_0xeb83('0x36')]=qs['offset'](_0x994048['query'][_0xeb83('0x36')]);}_0x1cb614[_0xeb83('0x37')]=qs['sort'](_0x994048['query']['sort']);_0x1cb614[_0xeb83('0x38')]=qs[_0xeb83('0x39')](_[_0xeb83('0x3a')](_0x994048[_0xeb83('0x31')],_0x387ba4[_0xeb83('0x39')]),_0x35984b);if(_0x994048[_0xeb83('0x31')]['filter']){_0x1cb614[_0xeb83('0x38')]=_[_0xeb83('0x3b')](_0x1cb614[_0xeb83('0x38')],{'$or':_[_0xeb83('0x2b')](_0x35984b,function(_0x31d74c){if(_0x31d74c['type']!=='VIRTUAL'){var _0x1b5a32={};_0x1b5a32[_0x31d74c[_0xeb83('0x29')]]={'$like':'%'+_0x994048[_0xeb83('0x31')]['filter']+'%'};return _0x1b5a32;}})});}_0x1cb614=_['merge']({},_0x1cb614,_0x994048[_0xeb83('0x3c')]);var _0x293487={'where':_0x1cb614['where']};return db[_0xeb83('0x2c')][_0xeb83('0x1e')](_0x293487)[_0xeb83('0x24')](function(_0xad3966){_0x273d0d[_0xeb83('0x1e')]=_0xad3966;if(_0x994048[_0xeb83('0x31')][_0xeb83('0x3d')]){_0x1cb614['include']=[{'all':!![]}];}return db[_0xeb83('0x2c')][_0xeb83('0x3e')](_0x1cb614);})['then'](function(_0x2534f4){_0x273d0d[_0xeb83('0x3f')]=_0x2534f4;return _0x273d0d;})['then'](respondWithFilteredResult(_0x12fe27,_0x1cb614))[_0xeb83('0x40')](handleError(_0x12fe27,null));};exports[_0xeb83('0x41')]=function(_0x8548f3,_0xbb3a63){var _0x202c7f={'raw':![],'where':{'id':_0x8548f3[_0xeb83('0x42')]['id']}},_0x234492={};_0x234492[_0xeb83('0x30')]=_[_0xeb83('0x43')](db['ZendeskConfiguration'][_0xeb83('0x2d')]);_0x234492[_0xeb83('0x31')]=_[_0xeb83('0x43')](_0x8548f3[_0xeb83('0x31')]);_0x234492[_0xeb83('0x39')]=_[_0xeb83('0x33')](_0x234492['model'],_0x234492[_0xeb83('0x31')]);_0x202c7f[_0xeb83('0x32')]=_[_0xeb83('0x33')](_0x234492[_0xeb83('0x30')],qs[_0xeb83('0x34')](_0x8548f3['query'][_0xeb83('0x34')]));_0x202c7f['attributes']=_0x202c7f['attributes'][_0xeb83('0x44')]?_0x202c7f[_0xeb83('0x32')]:_0x234492[_0xeb83('0x30')];if(_0x8548f3[_0xeb83('0x31')][_0xeb83('0x3d')]){_0x202c7f[_0xeb83('0x45')]=[{'all':!![]}];}_0x202c7f=_[_0xeb83('0x3b')]({},_0x202c7f,_0x8548f3[_0xeb83('0x3c')]);return db[_0xeb83('0x2c')][_0xeb83('0x46')](_0x202c7f)[_0xeb83('0x24')](handleEntityNotFound(_0xbb3a63,null))[_0xeb83('0x24')](respondWithResult(_0xbb3a63,null))[_0xeb83('0x40')](handleError(_0xbb3a63,null));};exports['create']=function(_0x3b379d,_0x2cf757){return db[_0xeb83('0x2c')][_0xeb83('0x47')](_0x3b379d['body'],{})[_0xeb83('0x24')](respondWithResult(_0x2cf757,0xc9))[_0xeb83('0x40')](handleError(_0x2cf757,null));};exports['update']=function(_0x59080d,_0x161ec0){if(_0x59080d['body']['id']){delete _0x59080d[_0xeb83('0x48')]['id'];}return db['ZendeskConfiguration'][_0xeb83('0x46')]({'where':{'id':_0x59080d[_0xeb83('0x42')]['id']}})[_0xeb83('0x24')](handleEntityNotFound(_0x161ec0,null))[_0xeb83('0x24')](saveUpdates(_0x59080d[_0xeb83('0x48')],null))[_0xeb83('0x24')](respondWithResult(_0x161ec0,null))['catch'](handleError(_0x161ec0,null));};exports[_0xeb83('0x25')]=function(_0x29dbf1,_0x5252c7){return db[_0xeb83('0x2c')][_0xeb83('0x46')]({'where':{'id':_0x29dbf1[_0xeb83('0x42')]['id']}})['then'](handleEntityNotFound(_0x5252c7,null))[_0xeb83('0x24')](removeEntity(_0x5252c7,null))[_0xeb83('0x40')](handleError(_0x5252c7,null));};exports[_0xeb83('0x49')]=function(_0x3fdaf4,_0x1d3bd1,_0x3f2e8b){var _0x54c5df={};var _0x5590d4={};var _0x286bc7;var _0x43a13b;return db[_0xeb83('0x2c')][_0xeb83('0x4a')]({'where':{'id':_0x3fdaf4[_0xeb83('0x42')]['id']}})['then'](handleEntityNotFound(_0x1d3bd1,null))[_0xeb83('0x24')](function(_0x2a4dcb){if(_0x2a4dcb){_0x286bc7=_0x2a4dcb;_0x5590d4[_0xeb83('0x30')]=_[_0xeb83('0x43')](db['ZendeskField'][_0xeb83('0x2d')]);_0x5590d4[_0xeb83('0x31')]=_[_0xeb83('0x43')](_0x3fdaf4[_0xeb83('0x31')]);_0x5590d4[_0xeb83('0x39')]=_['intersection'](_0x5590d4['model'],_0x5590d4[_0xeb83('0x31')]);_0x54c5df[_0xeb83('0x32')]=_[_0xeb83('0x33')](_0x5590d4[_0xeb83('0x30')],qs[_0xeb83('0x34')](_0x3fdaf4[_0xeb83('0x31')][_0xeb83('0x34')]));_0x54c5df[_0xeb83('0x32')]=_0x54c5df[_0xeb83('0x32')][_0xeb83('0x44')]?_0x54c5df[_0xeb83('0x32')]:_0x5590d4[_0xeb83('0x30')];_0x54c5df[_0xeb83('0x37')]=qs[_0xeb83('0x4b')](_0x3fdaf4['query']['sort']);_0x54c5df['where']=qs[_0xeb83('0x39')](_[_0xeb83('0x3a')](_0x3fdaf4['query'],_0x5590d4[_0xeb83('0x39')]));if(_0x3fdaf4[_0xeb83('0x31')]['filter']){_0x54c5df['where']=_[_0xeb83('0x3b')](_0x54c5df['where'],{'$or':_[_0xeb83('0x2b')](_0x54c5df[_0xeb83('0x32')],function(_0x16b91a){var _0x1cd63c={};_0x1cd63c[_0x16b91a]={'$like':'%'+_0x3fdaf4[_0xeb83('0x31')][_0xeb83('0x4c')]+'%'};return _0x1cd63c;})});}_0x54c5df=_[_0xeb83('0x3b')]({},_0x54c5df,_0x3fdaf4[_0xeb83('0x3c')]);return _0x286bc7[_0xeb83('0x49')](_0x54c5df);}})[_0xeb83('0x24')](function(_0x129c92){if(_0x129c92){_0x43a13b=_0x129c92['length'];if(!_0x3fdaf4[_0xeb83('0x31')][_0xeb83('0x4d')](_0xeb83('0x35'))){_0x54c5df[_0xeb83('0x1c')]=qs['limit'](_0x3fdaf4[_0xeb83('0x31')][_0xeb83('0x1c')]);_0x54c5df['offset']=qs['offset'](_0x3fdaf4[_0xeb83('0x31')][_0xeb83('0x36')]);}return _0x286bc7[_0xeb83('0x49')](_0x54c5df);}})[_0xeb83('0x24')](function(_0x2df27e){if(_0x2df27e){return _0x2df27e?{'count':_0x43a13b,'rows':_0x2df27e}:null;}})[_0xeb83('0x24')](respondWithResult(_0x1d3bd1,null))[_0xeb83('0x40')](handleError(_0x1d3bd1,null));};exports['getSubjects']=function(_0x16298f,_0x28c3ee,_0x56e2ac){var _0x31d0ac={};var _0x5eb8ad={};var _0x1f9094;var _0x1913c2;return db['ZendeskConfiguration'][_0xeb83('0x4a')]({'where':{'id':_0x16298f[_0xeb83('0x42')]['id']}})[_0xeb83('0x24')](handleEntityNotFound(_0x28c3ee,null))[_0xeb83('0x24')](function(_0x575bf2){if(_0x575bf2){_0x1f9094=_0x575bf2;_0x5eb8ad[_0xeb83('0x30')]=_[_0xeb83('0x43')](db[_0xeb83('0x4e')][_0xeb83('0x2d')]);_0x5eb8ad[_0xeb83('0x31')]=_[_0xeb83('0x43')](_0x16298f[_0xeb83('0x31')]);_0x5eb8ad[_0xeb83('0x39')]=_['intersection'](_0x5eb8ad[_0xeb83('0x30')],_0x5eb8ad[_0xeb83('0x31')]);_0x31d0ac[_0xeb83('0x32')]=_[_0xeb83('0x33')](_0x5eb8ad['model'],qs[_0xeb83('0x34')](_0x16298f[_0xeb83('0x31')]['fields']));_0x31d0ac[_0xeb83('0x32')]=_0x31d0ac[_0xeb83('0x32')][_0xeb83('0x44')]?_0x31d0ac['attributes']:_0x5eb8ad['model'];_0x31d0ac['order']=qs[_0xeb83('0x4b')](_0x16298f[_0xeb83('0x31')][_0xeb83('0x4b')]);_0x31d0ac['where']=qs[_0xeb83('0x39')](_[_0xeb83('0x3a')](_0x16298f[_0xeb83('0x31')],_0x5eb8ad[_0xeb83('0x39')]));if(_0x16298f['query'][_0xeb83('0x4c')]){_0x31d0ac[_0xeb83('0x38')]=_[_0xeb83('0x3b')](_0x31d0ac[_0xeb83('0x38')],{'$or':_[_0xeb83('0x2b')](_0x31d0ac[_0xeb83('0x32')],function(_0x4e04dd){var _0x802dbd={};_0x802dbd[_0x4e04dd]={'$like':'%'+_0x16298f[_0xeb83('0x31')][_0xeb83('0x4c')]+'%'};return _0x802dbd;})});}_0x31d0ac=_[_0xeb83('0x3b')]({},_0x31d0ac,_0x16298f[_0xeb83('0x3c')]);return _0x1f9094[_0xeb83('0x4f')](_0x31d0ac);}})[_0xeb83('0x24')](function(_0x2f3e5c){if(_0x2f3e5c){_0x1913c2=_0x2f3e5c[_0xeb83('0x44')];if(!_0x16298f[_0xeb83('0x31')][_0xeb83('0x4d')](_0xeb83('0x35'))){_0x31d0ac[_0xeb83('0x1c')]=qs[_0xeb83('0x1c')](_0x16298f[_0xeb83('0x31')]['limit']);_0x31d0ac[_0xeb83('0x36')]=qs['offset'](_0x16298f['query'][_0xeb83('0x36')]);}return _0x1f9094['getSubjects'](_0x31d0ac);}})['then'](function(_0x187d43){if(_0x187d43){return _0x187d43?{'count':_0x1913c2,'rows':_0x187d43}:null;}})['then'](respondWithResult(_0x28c3ee,null))[_0xeb83('0x40')](handleError(_0x28c3ee,null));};exports[_0xeb83('0x50')]=function(_0x2654c9,_0x43979e,_0x49e64d){var _0x13fbf3={};var _0x5d78bd={};var _0x137acb;var _0x264a20;return db['ZendeskConfiguration'][_0xeb83('0x4a')]({'where':{'id':_0x2654c9['params']['id']}})[_0xeb83('0x24')](handleEntityNotFound(_0x43979e,null))[_0xeb83('0x24')](function(_0x4a2216){if(_0x4a2216){_0x137acb=_0x4a2216;_0x5d78bd['model']=_[_0xeb83('0x43')](db[_0xeb83('0x4e')][_0xeb83('0x2d')]);_0x5d78bd[_0xeb83('0x31')]=_[_0xeb83('0x43')](_0x2654c9[_0xeb83('0x31')]);_0x5d78bd[_0xeb83('0x39')]=_['intersection'](_0x5d78bd[_0xeb83('0x30')],_0x5d78bd[_0xeb83('0x31')]);_0x13fbf3[_0xeb83('0x32')]=_[_0xeb83('0x33')](_0x5d78bd['model'],qs[_0xeb83('0x34')](_0x2654c9[_0xeb83('0x31')][_0xeb83('0x34')]));_0x13fbf3['attributes']=_0x13fbf3['attributes'][_0xeb83('0x44')]?_0x13fbf3[_0xeb83('0x32')]:_0x5d78bd[_0xeb83('0x30')];_0x13fbf3[_0xeb83('0x37')]=qs[_0xeb83('0x4b')](_0x2654c9[_0xeb83('0x31')]['sort']);_0x13fbf3[_0xeb83('0x38')]=qs[_0xeb83('0x39')](_['pick'](_0x2654c9[_0xeb83('0x31')],_0x5d78bd[_0xeb83('0x39')]));if(_0x2654c9[_0xeb83('0x31')][_0xeb83('0x4c')]){_0x13fbf3[_0xeb83('0x38')]=_[_0xeb83('0x3b')](_0x13fbf3[_0xeb83('0x38')],{'$or':_[_0xeb83('0x2b')](_0x13fbf3[_0xeb83('0x32')],function(_0x22ee13){var _0x5ae200={};_0x5ae200[_0x22ee13]={'$like':'%'+_0x2654c9[_0xeb83('0x31')][_0xeb83('0x4c')]+'%'};return _0x5ae200;})});}_0x13fbf3=_['merge']({},_0x13fbf3,_0x2654c9['options']);return _0x137acb[_0xeb83('0x50')](_0x13fbf3);}})['then'](function(_0x29910e){if(_0x29910e){_0x264a20=_0x29910e[_0xeb83('0x44')];if(!_0x2654c9[_0xeb83('0x31')][_0xeb83('0x4d')]('nolimit')){_0x13fbf3[_0xeb83('0x1c')]=qs[_0xeb83('0x1c')](_0x2654c9['query'][_0xeb83('0x1c')]);_0x13fbf3[_0xeb83('0x36')]=qs[_0xeb83('0x36')](_0x2654c9['query'][_0xeb83('0x36')]);}return _0x137acb['getDescriptions'](_0x13fbf3);}})['then'](function(_0x1e5a4c){if(_0x1e5a4c){return _0x1e5a4c?{'count':_0x264a20,'rows':_0x1e5a4c}:null;}})['then'](respondWithResult(_0x43979e,null))[_0xeb83('0x40')](handleError(_0x43979e,null));};exports[_0xeb83('0x51')]=function(_0x3eecb9,_0x599f10,_0x129e9e){var _0x2e6124={};var _0x295d0d={};var _0x43e325;var _0x46ecc0;return db[_0xeb83('0x2c')][_0xeb83('0x4a')]({'where':{'id':_0x3eecb9['params']['id']}})[_0xeb83('0x24')](handleEntityNotFound(_0x599f10,null))[_0xeb83('0x24')](function(_0x2ad1d5){if(_0x2ad1d5){_0x43e325=_0x2ad1d5;_0x295d0d[_0xeb83('0x30')]=_[_0xeb83('0x43')](db[_0xeb83('0x52')][_0xeb83('0x2d')]);_0x295d0d[_0xeb83('0x31')]=_[_0xeb83('0x43')](_0x3eecb9[_0xeb83('0x31')]);_0x295d0d[_0xeb83('0x39')]=_['intersection'](_0x295d0d[_0xeb83('0x30')],_0x295d0d[_0xeb83('0x31')]);_0x2e6124[_0xeb83('0x32')]=_['intersection'](_0x295d0d[_0xeb83('0x30')],qs[_0xeb83('0x34')](_0x3eecb9['query']['fields']));_0x2e6124[_0xeb83('0x32')]=_0x2e6124[_0xeb83('0x32')][_0xeb83('0x44')]?_0x2e6124['attributes']:_0x295d0d[_0xeb83('0x30')];_0x2e6124[_0xeb83('0x37')]=qs[_0xeb83('0x4b')](_0x3eecb9[_0xeb83('0x31')]['sort']);_0x2e6124[_0xeb83('0x38')]=qs[_0xeb83('0x39')](_[_0xeb83('0x3a')](_0x3eecb9['query'],_0x295d0d[_0xeb83('0x39')]));if(_0x3eecb9[_0xeb83('0x31')][_0xeb83('0x4c')]){_0x2e6124[_0xeb83('0x38')]=_[_0xeb83('0x3b')](_0x2e6124[_0xeb83('0x38')],{'$or':_[_0xeb83('0x2b')](_0x2e6124[_0xeb83('0x32')],function(_0x17ddbb){var _0x35d17a={};_0x35d17a[_0x17ddbb]={'$like':'%'+_0x3eecb9[_0xeb83('0x31')][_0xeb83('0x4c')]+'%'};return _0x35d17a;})});}_0x2e6124=_['merge']({},_0x2e6124,_0x3eecb9['options']);return _0x43e325[_0xeb83('0x51')](_0x2e6124);}})[_0xeb83('0x24')](function(_0x52a150){if(_0x52a150){_0x46ecc0=_0x52a150[_0xeb83('0x44')];if(!_0x3eecb9[_0xeb83('0x31')][_0xeb83('0x4d')](_0xeb83('0x35'))){_0x2e6124[_0xeb83('0x1c')]=qs['limit'](_0x3eecb9[_0xeb83('0x31')][_0xeb83('0x1c')]);_0x2e6124[_0xeb83('0x36')]=qs[_0xeb83('0x36')](_0x3eecb9['query'][_0xeb83('0x36')]);}return _0x43e325['getTags'](_0x2e6124);}})[_0xeb83('0x24')](function(_0x3ab286){if(_0x3ab286){return _0x3ab286?{'count':_0x46ecc0,'rows':_0x3ab286}:null;}})[_0xeb83('0x24')](respondWithResult(_0x599f10,null))['catch'](handleError(_0x599f10,null));};exports[_0xeb83('0x53')]=function(_0xa13159,_0x5ab6a4,_0x265419){if(_0xa13159['body']['id']){delete _0xa13159[_0xeb83('0x48')]['id'];}return db[_0xeb83('0x2c')][_0xeb83('0x4a')]({'where':{'id':_0xa13159['params']['id']}})[_0xeb83('0x24')](handleEntityNotFound(_0x5ab6a4,null))[_0xeb83('0x24')](function(_0x523521){if(_0x523521){return _0x523521['setTags'](_0xa13159['body']['ids']||[]);}return null;})[_0xeb83('0x24')](respondWithResult(_0x5ab6a4,null))[_0xeb83('0x40')](handleError(_0x5ab6a4,null));}; \ No newline at end of file +var _0xcb8e=['getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','length','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','findOne','getFields','hasOwnProperty','getSubjects','ZendeskField','nolimit'];(function(_0x2c654f,_0x11ce94){var _0xa53d15=function(_0x4db4a9){while(--_0x4db4a9){_0x2c654f['push'](_0x2c654f['shift']());}};_0xa53d15(++_0x11ce94);}(_0xcb8e,0x150));var _0xecb8=function(_0x773c36,_0x1244f3){_0x773c36=_0x773c36-0x0;var _0xff4620=_0xcb8e[_0x773c36];return _0xff4620;};'use strict';var emlformat=require(_0xecb8('0x0'));var rimraf=require(_0xecb8('0x1'));var zipdir=require(_0xecb8('0x2'));var jsonpatch=require(_0xecb8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecb8('0x4'));var Mustache=require(_0xecb8('0x5'));var util=require(_0xecb8('0x6'));var path=require(_0xecb8('0x7'));var sox=require('sox');var csv=require(_0xecb8('0x8'));var ejs=require(_0xecb8('0x9'));var fs=require('fs');var fs_extra=require(_0xecb8('0xa'));var _=require(_0xecb8('0xb'));var squel=require(_0xecb8('0xc'));var crypto=require(_0xecb8('0xd'));var jsforce=require(_0xecb8('0xe'));var deskjs=require(_0xecb8('0xf'));var toCsv=require(_0xecb8('0x8'));var querystring=require('querystring');var Papa=require(_0xecb8('0x10'));var Redis=require(_0xecb8('0x11'));var authService=require(_0xecb8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xecb8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xecb8('0x14'));var utils=require(_0xecb8('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xecb8('0x16'));var db=require(_0xecb8('0x17'))['db'];function respondWithStatusCode(_0x257de1,_0x5a8e07){_0x5a8e07=_0x5a8e07||0xcc;return function(_0x4763ea){if(_0x4763ea){return _0x257de1['sendStatus'](_0x5a8e07);}return _0x257de1[_0xecb8('0x18')](_0x5a8e07)[_0xecb8('0x19')]();};}function respondWithResult(_0x2d6936,_0x4a32c3){_0x4a32c3=_0x4a32c3||0xc8;return function(_0xebd47b){if(_0xebd47b){return _0x2d6936['status'](_0x4a32c3)[_0xecb8('0x1a')](_0xebd47b);}};}function respondWithFilteredResult(_0x1a64e6,_0x3637c8){return function(_0x4f3baa){if(_0x4f3baa){var _0x39a219=typeof _0x3637c8[_0xecb8('0x1b')]===_0xecb8('0x1c')&&typeof _0x3637c8[_0xecb8('0x1d')]===_0xecb8('0x1c');var _0x55e66e=_0x4f3baa['count'];var _0xc2f383=_0x39a219?0x0:_0x3637c8[_0xecb8('0x1b')];var _0x442807=_0x39a219?_0x4f3baa[_0xecb8('0x1e')]:_0x3637c8[_0xecb8('0x1b')]+_0x3637c8[_0xecb8('0x1d')];var _0x353cbd;if(_0x442807>=_0x55e66e){_0x442807=_0x55e66e;_0x353cbd=0xc8;}else{_0x353cbd=0xce;}_0x1a64e6[_0xecb8('0x18')](_0x353cbd);return _0x1a64e6['set'](_0xecb8('0x1f'),_0xc2f383+'-'+_0x442807+'/'+_0x55e66e)['json'](_0x4f3baa);}return null;};}function patchUpdates(_0x43e681){return function(_0x3c4ec9){try{jsonpatch[_0xecb8('0x20')](_0x3c4ec9,_0x43e681,!![]);}catch(_0x2d15a9){return BPromise['reject'](_0x2d15a9);}return _0x3c4ec9[_0xecb8('0x21')]();};}function saveUpdates(_0x241aef,_0x57053d){return function(_0x1f09ab){if(_0x1f09ab){return _0x1f09ab['update'](_0x241aef)[_0xecb8('0x22')](function(_0x324a7b){return _0x324a7b;});}return null;};}function removeEntity(_0x2727e9,_0x486c71){return function(_0x559852){if(_0x559852){return _0x559852[_0xecb8('0x23')]()[_0xecb8('0x22')](function(){_0x2727e9[_0xecb8('0x18')](0xcc)[_0xecb8('0x19')]();});}};}function handleEntityNotFound(_0x5828d3,_0x53d2df){return function(_0x3b0df5){if(!_0x3b0df5){_0x5828d3['sendStatus'](0x194);}return _0x3b0df5;};}function handleError(_0x4769e0,_0x5f4d83){_0x5f4d83=_0x5f4d83||0x1f4;return function(_0x31171f){logger[_0xecb8('0x24')](_0x31171f[_0xecb8('0x25')]);if(_0x31171f[_0xecb8('0x26')]){delete _0x31171f[_0xecb8('0x26')];}_0x4769e0['status'](_0x5f4d83)[_0xecb8('0x27')](_0x31171f);};}exports['index']=function(_0x3a8723,_0x149b6e){var _0x1b9fd1={},_0x55bea3={},_0x438665={'count':0x0,'rows':[]};var _0x34140d=_['map'](db[_0xecb8('0x28')][_0xecb8('0x29')],function(_0x3d13c6){return{'name':_0x3d13c6[_0xecb8('0x2a')],'type':_0x3d13c6[_0xecb8('0x2b')][_0xecb8('0x2c')]};});_0x55bea3[_0xecb8('0x2d')]=_[_0xecb8('0x2e')](_0x34140d,_0xecb8('0x26'));_0x55bea3[_0xecb8('0x2f')]=_[_0xecb8('0x30')](_0x3a8723['query']);_0x55bea3['filters']=_['intersection'](_0x55bea3[_0xecb8('0x2d')],_0x55bea3[_0xecb8('0x2f')]);_0x1b9fd1['attributes']=_['intersection'](_0x55bea3[_0xecb8('0x2d')],qs[_0xecb8('0x31')](_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x31')]));_0x1b9fd1[_0xecb8('0x32')]=_0x1b9fd1[_0xecb8('0x32')][_0xecb8('0x33')]?_0x1b9fd1['attributes']:_0x55bea3[_0xecb8('0x2d')];if(!_0x3a8723[_0xecb8('0x2f')]['hasOwnProperty']('nolimit')){_0x1b9fd1[_0xecb8('0x1d')]=qs['limit'](_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x1d')]);_0x1b9fd1[_0xecb8('0x1b')]=qs[_0xecb8('0x1b')](_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x1b')]);}_0x1b9fd1[_0xecb8('0x34')]=qs['sort'](_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x35')]);_0x1b9fd1['where']=qs[_0xecb8('0x36')](_[_0xecb8('0x37')](_0x3a8723[_0xecb8('0x2f')],_0x55bea3[_0xecb8('0x36')]),_0x34140d);if(_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x38')]){_0x1b9fd1['where']=_[_0xecb8('0x39')](_0x1b9fd1[_0xecb8('0x3a')],{'$or':_[_0xecb8('0x2e')](_0x34140d,function(_0x3aa93b){if(_0x3aa93b['type']!==_0xecb8('0x3b')){var _0x543c67={};_0x543c67[_0x3aa93b['name']]={'$like':'%'+_0x3a8723[_0xecb8('0x2f')]['filter']+'%'};return _0x543c67;}})});}_0x1b9fd1=_[_0xecb8('0x39')]({},_0x1b9fd1,_0x3a8723[_0xecb8('0x3c')]);var _0x5a1850={'where':_0x1b9fd1[_0xecb8('0x3a')]};return db[_0xecb8('0x28')][_0xecb8('0x1e')](_0x5a1850)[_0xecb8('0x22')](function(_0x22637d){_0x438665[_0xecb8('0x1e')]=_0x22637d;if(_0x3a8723[_0xecb8('0x2f')][_0xecb8('0x3d')]){_0x1b9fd1[_0xecb8('0x3e')]=[{'all':!![]}];}return db[_0xecb8('0x28')][_0xecb8('0x3f')](_0x1b9fd1);})[_0xecb8('0x22')](function(_0x5cda69){_0x438665[_0xecb8('0x40')]=_0x5cda69;return _0x438665;})[_0xecb8('0x22')](respondWithFilteredResult(_0x149b6e,_0x1b9fd1))[_0xecb8('0x41')](handleError(_0x149b6e,null));};exports[_0xecb8('0x42')]=function(_0x237358,_0xc246a3){var _0x13e9fc={'raw':![],'where':{'id':_0x237358[_0xecb8('0x43')]['id']}},_0x21f0c4={};_0x21f0c4[_0xecb8('0x2d')]=_[_0xecb8('0x30')](db[_0xecb8('0x28')][_0xecb8('0x29')]);_0x21f0c4[_0xecb8('0x2f')]=_[_0xecb8('0x30')](_0x237358[_0xecb8('0x2f')]);_0x21f0c4[_0xecb8('0x36')]=_['intersection'](_0x21f0c4[_0xecb8('0x2d')],_0x21f0c4[_0xecb8('0x2f')]);_0x13e9fc[_0xecb8('0x32')]=_[_0xecb8('0x44')](_0x21f0c4['model'],qs[_0xecb8('0x31')](_0x237358[_0xecb8('0x2f')][_0xecb8('0x31')]));_0x13e9fc[_0xecb8('0x32')]=_0x13e9fc[_0xecb8('0x32')][_0xecb8('0x33')]?_0x13e9fc[_0xecb8('0x32')]:_0x21f0c4[_0xecb8('0x2d')];if(_0x237358['query'][_0xecb8('0x3d')]){_0x13e9fc['include']=[{'all':!![]}];}_0x13e9fc=_['merge']({},_0x13e9fc,_0x237358[_0xecb8('0x3c')]);return db[_0xecb8('0x28')][_0xecb8('0x45')](_0x13e9fc)[_0xecb8('0x22')](handleEntityNotFound(_0xc246a3,null))[_0xecb8('0x22')](respondWithResult(_0xc246a3,null))['catch'](handleError(_0xc246a3,null));};exports['create']=function(_0x5a3692,_0x5a4e1f){return db[_0xecb8('0x28')][_0xecb8('0x46')](_0x5a3692[_0xecb8('0x47')],{})[_0xecb8('0x22')](respondWithResult(_0x5a4e1f,0xc9))['catch'](handleError(_0x5a4e1f,null));};exports[_0xecb8('0x48')]=function(_0x2b9f80,_0x3f1596){if(_0x2b9f80['body']['id']){delete _0x2b9f80[_0xecb8('0x47')]['id'];}return db[_0xecb8('0x28')]['find']({'where':{'id':_0x2b9f80['params']['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x3f1596,null))[_0xecb8('0x22')](saveUpdates(_0x2b9f80[_0xecb8('0x47')],null))[_0xecb8('0x22')](respondWithResult(_0x3f1596,null))['catch'](handleError(_0x3f1596,null));};exports[_0xecb8('0x23')]=function(_0x3a7ae1,_0x13af1a){return db[_0xecb8('0x28')][_0xecb8('0x45')]({'where':{'id':_0x3a7ae1[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x13af1a,null))[_0xecb8('0x22')](removeEntity(_0x13af1a,null))['catch'](handleError(_0x13af1a,null));};exports['getFields']=function(_0x1cf28e,_0x5b6150,_0x48145e){var _0x214feb={};var _0xfbc8e={};var _0x39f1e7;var _0xfa2d47;return db[_0xecb8('0x28')][_0xecb8('0x49')]({'where':{'id':_0x1cf28e[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x5b6150,null))[_0xecb8('0x22')](function(_0x35628a){if(_0x35628a){_0x39f1e7=_0x35628a;_0xfbc8e[_0xecb8('0x2d')]=_[_0xecb8('0x30')](db['ZendeskField'][_0xecb8('0x29')]);_0xfbc8e['query']=_['keys'](_0x1cf28e[_0xecb8('0x2f')]);_0xfbc8e[_0xecb8('0x36')]=_[_0xecb8('0x44')](_0xfbc8e['model'],_0xfbc8e[_0xecb8('0x2f')]);_0x214feb[_0xecb8('0x32')]=_[_0xecb8('0x44')](_0xfbc8e[_0xecb8('0x2d')],qs[_0xecb8('0x31')](_0x1cf28e[_0xecb8('0x2f')]['fields']));_0x214feb[_0xecb8('0x32')]=_0x214feb[_0xecb8('0x32')][_0xecb8('0x33')]?_0x214feb[_0xecb8('0x32')]:_0xfbc8e[_0xecb8('0x2d')];_0x214feb[_0xecb8('0x34')]=qs[_0xecb8('0x35')](_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x35')]);_0x214feb[_0xecb8('0x3a')]=qs[_0xecb8('0x36')](_['pick'](_0x1cf28e[_0xecb8('0x2f')],_0xfbc8e[_0xecb8('0x36')]));if(_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x38')]){_0x214feb[_0xecb8('0x3a')]=_[_0xecb8('0x39')](_0x214feb[_0xecb8('0x3a')],{'$or':_[_0xecb8('0x2e')](_0x214feb[_0xecb8('0x32')],function(_0x145604){var _0x1dfcb9={};_0x1dfcb9[_0x145604]={'$like':'%'+_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x38')]+'%'};return _0x1dfcb9;})});}_0x214feb=_[_0xecb8('0x39')]({},_0x214feb,_0x1cf28e['options']);return _0x39f1e7[_0xecb8('0x4a')](_0x214feb);}})[_0xecb8('0x22')](function(_0x55a95d){if(_0x55a95d){_0xfa2d47=_0x55a95d[_0xecb8('0x33')];if(!_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x4b')]('nolimit')){_0x214feb[_0xecb8('0x1d')]=qs[_0xecb8('0x1d')](_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x1d')]);_0x214feb[_0xecb8('0x1b')]=qs[_0xecb8('0x1b')](_0x1cf28e[_0xecb8('0x2f')][_0xecb8('0x1b')]);}return _0x39f1e7[_0xecb8('0x4a')](_0x214feb);}})[_0xecb8('0x22')](function(_0xadbd84){if(_0xadbd84){return _0xadbd84?{'count':_0xfa2d47,'rows':_0xadbd84}:null;}})[_0xecb8('0x22')](respondWithResult(_0x5b6150,null))['catch'](handleError(_0x5b6150,null));};exports[_0xecb8('0x4c')]=function(_0x2d3440,_0x3a1dc1,_0x1995ee){var _0x21c016={};var _0x4d6061={};var _0x422e22;var _0x5aee59;return db[_0xecb8('0x28')][_0xecb8('0x49')]({'where':{'id':_0x2d3440[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x3a1dc1,null))['then'](function(_0x2d19c0){if(_0x2d19c0){_0x422e22=_0x2d19c0;_0x4d6061[_0xecb8('0x2d')]=_[_0xecb8('0x30')](db[_0xecb8('0x4d')][_0xecb8('0x29')]);_0x4d6061[_0xecb8('0x2f')]=_[_0xecb8('0x30')](_0x2d3440[_0xecb8('0x2f')]);_0x4d6061[_0xecb8('0x36')]=_[_0xecb8('0x44')](_0x4d6061[_0xecb8('0x2d')],_0x4d6061['query']);_0x21c016['attributes']=_[_0xecb8('0x44')](_0x4d6061['model'],qs[_0xecb8('0x31')](_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x31')]));_0x21c016[_0xecb8('0x32')]=_0x21c016[_0xecb8('0x32')][_0xecb8('0x33')]?_0x21c016['attributes']:_0x4d6061[_0xecb8('0x2d')];_0x21c016[_0xecb8('0x34')]=qs[_0xecb8('0x35')](_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x35')]);_0x21c016[_0xecb8('0x3a')]=qs[_0xecb8('0x36')](_[_0xecb8('0x37')](_0x2d3440['query'],_0x4d6061[_0xecb8('0x36')]));if(_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x38')]){_0x21c016[_0xecb8('0x3a')]=_[_0xecb8('0x39')](_0x21c016[_0xecb8('0x3a')],{'$or':_[_0xecb8('0x2e')](_0x21c016[_0xecb8('0x32')],function(_0x37dae6){var _0x389d6b={};_0x389d6b[_0x37dae6]={'$like':'%'+_0x2d3440['query'][_0xecb8('0x38')]+'%'};return _0x389d6b;})});}_0x21c016=_['merge']({},_0x21c016,_0x2d3440[_0xecb8('0x3c')]);return _0x422e22[_0xecb8('0x4c')](_0x21c016);}})[_0xecb8('0x22')](function(_0x151fcf){if(_0x151fcf){_0x5aee59=_0x151fcf[_0xecb8('0x33')];if(!_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x4b')](_0xecb8('0x4e'))){_0x21c016['limit']=qs['limit'](_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x1d')]);_0x21c016[_0xecb8('0x1b')]=qs['offset'](_0x2d3440[_0xecb8('0x2f')][_0xecb8('0x1b')]);}return _0x422e22[_0xecb8('0x4c')](_0x21c016);}})[_0xecb8('0x22')](function(_0x314de7){if(_0x314de7){return _0x314de7?{'count':_0x5aee59,'rows':_0x314de7}:null;}})[_0xecb8('0x22')](respondWithResult(_0x3a1dc1,null))[_0xecb8('0x41')](handleError(_0x3a1dc1,null));};exports['getDescriptions']=function(_0x482f20,_0x1ba380,_0x1f9b91){var _0x3637e2={};var _0x38bc31={};var _0x172b4e;var _0x5779cb;return db[_0xecb8('0x28')][_0xecb8('0x49')]({'where':{'id':_0x482f20[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x1ba380,null))[_0xecb8('0x22')](function(_0x16bc65){if(_0x16bc65){_0x172b4e=_0x16bc65;_0x38bc31[_0xecb8('0x2d')]=_[_0xecb8('0x30')](db[_0xecb8('0x4d')][_0xecb8('0x29')]);_0x38bc31['query']=_['keys'](_0x482f20[_0xecb8('0x2f')]);_0x38bc31[_0xecb8('0x36')]=_[_0xecb8('0x44')](_0x38bc31[_0xecb8('0x2d')],_0x38bc31[_0xecb8('0x2f')]);_0x3637e2[_0xecb8('0x32')]=_[_0xecb8('0x44')](_0x38bc31[_0xecb8('0x2d')],qs[_0xecb8('0x31')](_0x482f20[_0xecb8('0x2f')][_0xecb8('0x31')]));_0x3637e2['attributes']=_0x3637e2[_0xecb8('0x32')]['length']?_0x3637e2[_0xecb8('0x32')]:_0x38bc31[_0xecb8('0x2d')];_0x3637e2[_0xecb8('0x34')]=qs[_0xecb8('0x35')](_0x482f20[_0xecb8('0x2f')][_0xecb8('0x35')]);_0x3637e2[_0xecb8('0x3a')]=qs[_0xecb8('0x36')](_[_0xecb8('0x37')](_0x482f20[_0xecb8('0x2f')],_0x38bc31[_0xecb8('0x36')]));if(_0x482f20['query']['filter']){_0x3637e2['where']=_[_0xecb8('0x39')](_0x3637e2[_0xecb8('0x3a')],{'$or':_[_0xecb8('0x2e')](_0x3637e2['attributes'],function(_0x26f5a5){var _0x39f64d={};_0x39f64d[_0x26f5a5]={'$like':'%'+_0x482f20[_0xecb8('0x2f')][_0xecb8('0x38')]+'%'};return _0x39f64d;})});}_0x3637e2=_[_0xecb8('0x39')]({},_0x3637e2,_0x482f20['options']);return _0x172b4e[_0xecb8('0x4f')](_0x3637e2);}})[_0xecb8('0x22')](function(_0x4a5354){if(_0x4a5354){_0x5779cb=_0x4a5354[_0xecb8('0x33')];if(!_0x482f20[_0xecb8('0x2f')][_0xecb8('0x4b')](_0xecb8('0x4e'))){_0x3637e2[_0xecb8('0x1d')]=qs[_0xecb8('0x1d')](_0x482f20[_0xecb8('0x2f')][_0xecb8('0x1d')]);_0x3637e2[_0xecb8('0x1b')]=qs[_0xecb8('0x1b')](_0x482f20[_0xecb8('0x2f')][_0xecb8('0x1b')]);}return _0x172b4e[_0xecb8('0x4f')](_0x3637e2);}})[_0xecb8('0x22')](function(_0x160392){if(_0x160392){return _0x160392?{'count':_0x5779cb,'rows':_0x160392}:null;}})[_0xecb8('0x22')](respondWithResult(_0x1ba380,null))[_0xecb8('0x41')](handleError(_0x1ba380,null));};exports[_0xecb8('0x50')]=function(_0x3883e8,_0x42a912,_0x10464e){var _0x214da3={};var _0xc24e62={};var _0x41730a;var _0x4d6ed6;return db[_0xecb8('0x28')]['findOne']({'where':{'id':_0x3883e8[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x42a912,null))['then'](function(_0x432ced){if(_0x432ced){_0x41730a=_0x432ced;_0xc24e62[_0xecb8('0x2d')]=_[_0xecb8('0x30')](db[_0xecb8('0x51')][_0xecb8('0x29')]);_0xc24e62[_0xecb8('0x2f')]=_[_0xecb8('0x30')](_0x3883e8[_0xecb8('0x2f')]);_0xc24e62['filters']=_[_0xecb8('0x44')](_0xc24e62[_0xecb8('0x2d')],_0xc24e62[_0xecb8('0x2f')]);_0x214da3['attributes']=_[_0xecb8('0x44')](_0xc24e62[_0xecb8('0x2d')],qs['fields'](_0x3883e8['query'][_0xecb8('0x31')]));_0x214da3[_0xecb8('0x32')]=_0x214da3['attributes']['length']?_0x214da3[_0xecb8('0x32')]:_0xc24e62['model'];_0x214da3[_0xecb8('0x34')]=qs[_0xecb8('0x35')](_0x3883e8[_0xecb8('0x2f')][_0xecb8('0x35')]);_0x214da3[_0xecb8('0x3a')]=qs[_0xecb8('0x36')](_[_0xecb8('0x37')](_0x3883e8['query'],_0xc24e62[_0xecb8('0x36')]));if(_0x3883e8[_0xecb8('0x2f')][_0xecb8('0x38')]){_0x214da3[_0xecb8('0x3a')]=_[_0xecb8('0x39')](_0x214da3[_0xecb8('0x3a')],{'$or':_[_0xecb8('0x2e')](_0x214da3[_0xecb8('0x32')],function(_0x565488){var _0xab8c10={};_0xab8c10[_0x565488]={'$like':'%'+_0x3883e8[_0xecb8('0x2f')][_0xecb8('0x38')]+'%'};return _0xab8c10;})});}_0x214da3=_[_0xecb8('0x39')]({},_0x214da3,_0x3883e8['options']);return _0x41730a[_0xecb8('0x50')](_0x214da3);}})[_0xecb8('0x22')](function(_0x535c91){if(_0x535c91){_0x4d6ed6=_0x535c91[_0xecb8('0x33')];if(!_0x3883e8[_0xecb8('0x2f')][_0xecb8('0x4b')](_0xecb8('0x4e'))){_0x214da3[_0xecb8('0x1d')]=qs[_0xecb8('0x1d')](_0x3883e8[_0xecb8('0x2f')][_0xecb8('0x1d')]);_0x214da3[_0xecb8('0x1b')]=qs[_0xecb8('0x1b')](_0x3883e8['query']['offset']);}return _0x41730a['getTags'](_0x214da3);}})[_0xecb8('0x22')](function(_0x4329d1){if(_0x4329d1){return _0x4329d1?{'count':_0x4d6ed6,'rows':_0x4329d1}:null;}})[_0xecb8('0x22')](respondWithResult(_0x42a912,null))[_0xecb8('0x41')](handleError(_0x42a912,null));};exports['setTags']=function(_0x41a5e2,_0x3729c6,_0x3293e9){if(_0x41a5e2[_0xecb8('0x47')]['id']){delete _0x41a5e2[_0xecb8('0x47')]['id'];}return db[_0xecb8('0x28')][_0xecb8('0x49')]({'where':{'id':_0x41a5e2[_0xecb8('0x43')]['id']}})[_0xecb8('0x22')](handleEntityNotFound(_0x3729c6,null))[_0xecb8('0x22')](function(_0x29311d){if(_0x29311d){return _0x29311d['setTags'](_0x41a5e2['body'][_0xecb8('0x52')]||[]);}return null;})[_0xecb8('0x22')](respondWithResult(_0x3729c6,null))[_0xecb8('0x41')](handleError(_0x3729c6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 95755df..40c2f3d 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 _0x28f2=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations'];(function(_0x2af501,_0x453862){var _0x30f661=function(_0x2bff35){while(--_0x2bff35){_0x2af501['push'](_0x2af501['shift']());}};_0x30f661(++_0x453862);}(_0x28f2,0x193));var _0x228f=function(_0x103c0e,_0x5b207d){_0x103c0e=_0x103c0e-0x0;var _0x515b6a=_0x28f2[_0x103c0e];return _0x515b6a;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var logger=require(_0x228f('0x2'))(_0x228f('0x3'));var moment=require(_0x228f('0x4'));var BPromise=require('bluebird');var rp=require(_0x228f('0x5'));var fs=require('fs');var path=require(_0x228f('0x6'));var rimraf=require(_0x228f('0x7'));var config=require(_0x228f('0x8'));var attributes=require(_0x228f('0x9'));module[_0x228f('0xa')]=function(_0x32c5c3,_0x485423){return _0x32c5c3[_0x228f('0xb')]('ZendeskConfiguration',attributes,{'tableName':_0x228f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c00=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','moment','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3cc29f,_0x353898){_0x3cc29f=_0x3cc29f-0x0;var _0x5609de=_0x9c00[_0x3cc29f];return _0x5609de;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x09c0('0x2'));var BPromise=require(_0x09c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09c0('0x4'));var rimraf=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var attributes=require(_0x09c0('0x7'));module[_0x09c0('0x8')]=function(_0x5914eb,_0x4d5fc3){return _0x5914eb[_0x09c0('0x9')](_0x09c0('0xa'),attributes,{'tableName':_0x09c0('0xb'),'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 7057674..d8d60a1 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 _0xefe6=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefe6,0xa4));var _0x6efe=function(_0x51376f,_0x3dbff2){_0x51376f=_0x51376f-0x0;var _0x4514e2=_0xefe6[_0x51376f];return _0x4514e2;};'use strict';var _=require(_0x6efe('0x0'));var util=require(_0x6efe('0x1'));var moment=require(_0x6efe('0x2'));var BPromise=require(_0x6efe('0x3'));var rs=require(_0x6efe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6efe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6efe('0x6'))(_0x6efe('0x7'));var config=require('../../config/environment');var jayson=require(_0x6efe('0x8'));var client=jayson[_0x6efe('0x9')][_0x6efe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41ef41,_0x542974,_0x2652f9){return new BPromise(function(_0x8a70b7,_0x1e80f9){return client[_0x6efe('0xb')](_0x41ef41,_0x2652f9)[_0x6efe('0xc')](function(_0xb29d0d){logger[_0x6efe('0xd')](_0x6efe('0xe'),_0x542974,_0x6efe('0xf'));logger[_0x6efe('0x10')](_0x6efe('0x11'),_0x542974,_0x6efe('0xf'),JSON[_0x6efe('0x12')](_0xb29d0d));if(_0xb29d0d[_0x6efe('0x13')]){if(_0xb29d0d[_0x6efe('0x13')][_0x6efe('0x14')]===0x1f4){logger[_0x6efe('0x13')](_0x6efe('0xe'),_0x542974,_0xb29d0d['error'][_0x6efe('0x15')]);return _0x1e80f9(_0xb29d0d[_0x6efe('0x13')][_0x6efe('0x15')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x542974,_0xb29d0d['error'][_0x6efe('0x15')]);return _0x8a70b7(_0xb29d0d['error']['message']);}else{logger[_0x6efe('0xd')](_0x6efe('0xe'),_0x542974,_0x6efe('0xf'));_0x8a70b7(_0xb29d0d[_0x6efe('0x16')][_0x6efe('0x15')]);}})['catch'](function(_0x41d89b){logger[_0x6efe('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x542974,_0x41d89b);_0x1e80f9(_0x41d89b);});});} \ No newline at end of file +var _0x03ba=['rpc','../../config/environment','jayson/promise','client','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x442506,_0x30a06b){var _0x5a92a5=function(_0x5d28aa){while(--_0x5d28aa){_0x442506['push'](_0x442506['shift']());}};_0x5a92a5(++_0x30a06b);}(_0x03ba,0xe8));var _0xa03b=function(_0x129e9d,_0x20de1e){_0x129e9d=_0x129e9d-0x0;var _0x3859c4=_0x03ba[_0x129e9d];return _0x3859c4;};'use strict';var _=require(_0xa03b('0x0'));var util=require(_0xa03b('0x1'));var moment=require(_0xa03b('0x2'));var BPromise=require(_0xa03b('0x3'));var rs=require(_0xa03b('0x4'));var fs=require('fs');var Redis=require(_0xa03b('0x5'));var db=require(_0xa03b('0x6'))['db'];var utils=require(_0xa03b('0x7'));var logger=require('../../config/logger')(_0xa03b('0x8'));var config=require(_0xa03b('0x9'));var jayson=require(_0xa03b('0xa'));var client=jayson[_0xa03b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x432812,_0x266ed9,_0x26d744){return new BPromise(function(_0x204423,_0xf8d294){return client[_0xa03b('0xc')](_0x432812,_0x26d744)['then'](function(_0x26f88d){logger[_0xa03b('0xd')](_0xa03b('0xe'),_0x266ed9,_0xa03b('0xf'));logger[_0xa03b('0x10')](_0xa03b('0x11'),_0x266ed9,_0xa03b('0xf'),JSON[_0xa03b('0x12')](_0x26f88d));if(_0x26f88d[_0xa03b('0x13')]){if(_0x26f88d[_0xa03b('0x13')][_0xa03b('0x14')]===0x1f4){logger[_0xa03b('0x13')](_0xa03b('0xe'),_0x266ed9,_0x26f88d[_0xa03b('0x13')][_0xa03b('0x15')]);return _0xf8d294(_0x26f88d[_0xa03b('0x13')]['message']);}logger[_0xa03b('0x13')](_0xa03b('0xe'),_0x266ed9,_0x26f88d['error']['message']);return _0x204423(_0x26f88d[_0xa03b('0x13')][_0xa03b('0x15')]);}else{logger[_0xa03b('0xd')](_0xa03b('0xe'),_0x266ed9,_0xa03b('0xf'));_0x204423(_0x26f88d[_0xa03b('0x16')]['message']);}})[_0xa03b('0x17')](function(_0x3c8ece){logger['error'](_0xa03b('0xe'),_0x266ed9,_0x3c8ece);_0xf8d294(_0x3c8ece);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 436c08e..91e87a6 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 _0xe714=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','multer','util'];(function(_0x8991fa,_0x319167){var _0x947050=function(_0x9887ed){while(--_0x9887ed){_0x8991fa['push'](_0x8991fa['shift']());}};_0x947050(++_0x319167);}(_0xe714,0x10e));var _0x4e71=function(_0x3a2fad,_0x3532a7){_0x3a2fad=_0x3a2fad-0x0;var _0x3e4298=_0xe714[_0x3a2fad];return _0x3e4298;};'use strict';var multer=require(_0x4e71('0x0'));var util=require(_0x4e71('0x1'));var path=require(_0x4e71('0x2'));var timeout=require(_0x4e71('0x3'));var express=require('express');var router=express[_0x4e71('0x4')]();var fs_extra=require(_0x4e71('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4e71('0x6'));var config=require('../../config/environment');var controller=require(_0x4e71('0x7'));router[_0x4e71('0x8')]('/',auth[_0x4e71('0x9')](),controller[_0x4e71('0xa')]);router['get'](_0x4e71('0xb'),auth[_0x4e71('0x9')](),controller[_0x4e71('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4e71('0xd')]);router[_0x4e71('0xe')](_0x4e71('0xb'),auth[_0x4e71('0x9')](),controller['update']);router[_0x4e71('0xf')](_0x4e71('0xb'),auth['isAuthenticated'](),controller[_0x4e71('0x10')]);module['exports']=router; \ No newline at end of file +var _0x66dc=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x475ada,_0x5120dc){var _0x4ce5fe=function(_0x26f888){while(--_0x26f888){_0x475ada['push'](_0x475ada['shift']());}};_0x4ce5fe(++_0x5120dc);}(_0x66dc,0xb3));var _0xc66d=function(_0x14be36,_0x139b7c){_0x14be36=_0x14be36-0x0;var _0x270a32=_0x66dc[_0x14be36];return _0x270a32;};'use strict';var multer=require(_0xc66d('0x0'));var util=require('util');var path=require(_0xc66d('0x1'));var timeout=require(_0xc66d('0x2'));var express=require(_0xc66d('0x3'));var router=express[_0xc66d('0x4')]();var fs_extra=require(_0xc66d('0x5'));var auth=require(_0xc66d('0x6'));var interaction=require(_0xc66d('0x7'));var config=require(_0xc66d('0x8'));var controller=require(_0xc66d('0x9'));router[_0xc66d('0xa')]('/',auth[_0xc66d('0xb')](),controller[_0xc66d('0xc')]);router[_0xc66d('0xa')](_0xc66d('0xd'),auth[_0xc66d('0xb')](),controller[_0xc66d('0xe')]);router[_0xc66d('0xf')]('/',auth[_0xc66d('0xb')](),controller[_0xc66d('0x10')]);router[_0xc66d('0x11')]('/:id',auth[_0xc66d('0xb')](),controller[_0xc66d('0x12')]);router[_0xc66d('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xc66d('0x14')]);module[_0xc66d('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 11fff15..ba5fd44 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 _0x4150=['STRING','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist','ENUM'];(function(_0x2d9b45,_0x21ddf0){var _0x13817f=function(_0x2c7e26){while(--_0x2c7e26){_0x2d9b45['push'](_0x2d9b45['shift']());}};_0x13817f(++_0x21ddf0);}(_0x4150,0xd1));var _0x0415=function(_0x20fefb,_0x148b51){_0x20fefb=_0x20fefb-0x0;var _0x4ba458=_0x4150[_0x20fefb];return _0x4ba458;};'use strict';var Sequelize=require(_0x0415('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0415('0x1'),_0x0415('0x2'),_0x0415('0x3'),_0x0415('0x4'),_0x0415('0x5')),'defaultValue':_0x0415('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0415('0x6')](_0x0415('0x1'),_0x0415('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x0415('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0415('0x7')]},'customField':{'type':Sequelize[_0x0415('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0415('0x7')]}}; \ No newline at end of file +var _0x5ef7=['exports','string','variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize'];(function(_0xe33d82,_0x5e6a3e){var _0x3c8d54=function(_0x9dff31){while(--_0x9dff31){_0xe33d82['push'](_0xe33d82['shift']());}};_0x3c8d54(++_0x5e6a3e);}(_0x5ef7,0xd7));var _0x75ef=function(_0x520ac6,_0x3cc594){_0x520ac6=_0x520ac6-0x0;var _0x48699d=_0x5ef7[_0x520ac6];return _0x48699d;};'use strict';var Sequelize=require(_0x75ef('0x0'));module[_0x75ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x75ef('0x2'),_0x75ef('0x3'),_0x75ef('0x4'),_0x75ef('0x5'),'picklist'),'defaultValue':_0x75ef('0x2')},'content':{'type':Sequelize[_0x75ef('0x6')]},'key':{'type':Sequelize[_0x75ef('0x6')]},'keyType':{'type':Sequelize[_0x75ef('0x7')](_0x75ef('0x2'),_0x75ef('0x3'),_0x75ef('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x75ef('0x6')]},'nameField':{'type':Sequelize[_0x75ef('0x6')]},'customField':{'type':Sequelize[_0x75ef('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x75ef('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d673e36..f491c7e 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 _0xa15b=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','name','send','index','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','filter','ZendeskField','includeAll','include','catch','show','params','keys'];(function(_0x26556d,_0x1174a8){var _0x2bb878=function(_0x5776bc){while(--_0x5776bc){_0x26556d['push'](_0x26556d['shift']());}};_0x2bb878(++_0x1174a8);}(_0xa15b,0x1e6));var _0xba15=function(_0x1aed9c,_0x186bfe){_0x1aed9c=_0x1aed9c-0x0;var _0x12215f=_0xa15b[_0x1aed9c];return _0x12215f;};'use strict';var emlformat=require(_0xba15('0x0'));var rimraf=require(_0xba15('0x1'));var zipdir=require(_0xba15('0x2'));var jsonpatch=require(_0xba15('0x3'));var rp=require(_0xba15('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba15('0x5'));var util=require(_0xba15('0x6'));var path=require(_0xba15('0x7'));var sox=require(_0xba15('0x8'));var csv=require(_0xba15('0x9'));var ejs=require(_0xba15('0xa'));var fs=require('fs');var fs_extra=require(_0xba15('0xb'));var _=require(_0xba15('0xc'));var squel=require(_0xba15('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba15('0xe'));var toCsv=require(_0xba15('0x9'));var querystring=require(_0xba15('0xf'));var Papa=require(_0xba15('0x10'));var Redis=require(_0xba15('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba15('0x12'));var logger=require(_0xba15('0x13'))(_0xba15('0x14'));var utils=require('../../config/utils');var config=require(_0xba15('0x15'));var licenseUtil=require(_0xba15('0x16'));var db=require(_0xba15('0x17'))['db'];function respondWithStatusCode(_0x112e51,_0x2bd012){_0x2bd012=_0x2bd012||0xcc;return function(_0x53d830){if(_0x53d830){return _0x112e51['sendStatus'](_0x2bd012);}return _0x112e51[_0xba15('0x18')](_0x2bd012)['end']();};}function respondWithResult(_0x2ab799,_0x31a23a){_0x31a23a=_0x31a23a||0xc8;return function(_0x4f5f61){if(_0x4f5f61){return _0x2ab799[_0xba15('0x18')](_0x31a23a)[_0xba15('0x19')](_0x4f5f61);}};}function respondWithFilteredResult(_0x224c5b,_0x231051){return function(_0x152a79){if(_0x152a79){var _0x556e1f=typeof _0x231051['offset']===_0xba15('0x1a')&&typeof _0x231051[_0xba15('0x1b')]===_0xba15('0x1a');var _0x640ade=_0x152a79[_0xba15('0x1c')];var _0x3bf15e=_0x556e1f?0x0:_0x231051[_0xba15('0x1d')];var _0x244347=_0x556e1f?_0x152a79[_0xba15('0x1c')]:_0x231051[_0xba15('0x1d')]+_0x231051[_0xba15('0x1b')];var _0x2e14b4;if(_0x244347>=_0x640ade){_0x244347=_0x640ade;_0x2e14b4=0xc8;}else{_0x2e14b4=0xce;}_0x224c5b['status'](_0x2e14b4);return _0x224c5b['set'](_0xba15('0x1e'),_0x3bf15e+'-'+_0x244347+'/'+_0x640ade)[_0xba15('0x19')](_0x152a79);}return null;};}function patchUpdates(_0x11f604){return function(_0x306965){try{jsonpatch[_0xba15('0x1f')](_0x306965,_0x11f604,!![]);}catch(_0x346b9a){return BPromise[_0xba15('0x20')](_0x346b9a);}return _0x306965[_0xba15('0x21')]();};}function saveUpdates(_0x6576e6,_0x557d63){return function(_0x22d06f){if(_0x22d06f){return _0x22d06f[_0xba15('0x22')](_0x6576e6)['then'](function(_0x26b713){return _0x26b713;});}return null;};}function removeEntity(_0xfe42f8,_0x19e86d){return function(_0x5f2d36){if(_0x5f2d36){return _0x5f2d36[_0xba15('0x23')]()[_0xba15('0x24')](function(){_0xfe42f8[_0xba15('0x18')](0xcc)[_0xba15('0x25')]();});}};}function handleEntityNotFound(_0x530383,_0x1ea440){return function(_0x55e038){if(!_0x55e038){_0x530383[_0xba15('0x26')](0x194);}return _0x55e038;};}function handleError(_0x17f653,_0x3aa75c){_0x3aa75c=_0x3aa75c||0x1f4;return function(_0x2adb25){logger['error'](_0x2adb25['stack']);if(_0x2adb25[_0xba15('0x27')]){delete _0x2adb25['name'];}_0x17f653[_0xba15('0x18')](_0x3aa75c)[_0xba15('0x28')](_0x2adb25);};}exports[_0xba15('0x29')]=function(_0xbda9e5,_0x3d3de4){var _0x3965e9={},_0x46ce0e={},_0x53fa05={'count':0x0,'rows':[]};var _0x12344b=_['map'](db['ZendeskField'][_0xba15('0x2a')],function(_0x4b624a){return{'name':_0x4b624a['fieldName'],'type':_0x4b624a[_0xba15('0x2b')][_0xba15('0x2c')]};});_0x46ce0e[_0xba15('0x2d')]=_[_0xba15('0x2e')](_0x12344b,'name');_0x46ce0e['query']=_['keys'](_0xbda9e5[_0xba15('0x2f')]);_0x46ce0e[_0xba15('0x30')]=_[_0xba15('0x31')](_0x46ce0e['model'],_0x46ce0e[_0xba15('0x2f')]);_0x3965e9['attributes']=_['intersection'](_0x46ce0e[_0xba15('0x2d')],qs[_0xba15('0x32')](_0xbda9e5['query'][_0xba15('0x32')]));_0x3965e9[_0xba15('0x33')]=_0x3965e9[_0xba15('0x33')]['length']?_0x3965e9['attributes']:_0x46ce0e[_0xba15('0x2d')];if(!_0xbda9e5['query'][_0xba15('0x34')]('nolimit')){_0x3965e9['limit']=qs[_0xba15('0x1b')](_0xbda9e5['query'][_0xba15('0x1b')]);_0x3965e9[_0xba15('0x1d')]=qs[_0xba15('0x1d')](_0xbda9e5[_0xba15('0x2f')][_0xba15('0x1d')]);}_0x3965e9[_0xba15('0x35')]=qs[_0xba15('0x36')](_0xbda9e5[_0xba15('0x2f')][_0xba15('0x36')]);_0x3965e9['where']=qs[_0xba15('0x30')](_[_0xba15('0x37')](_0xbda9e5['query'],_0x46ce0e[_0xba15('0x30')]),_0x12344b);if(_0xbda9e5[_0xba15('0x2f')]['filter']){_0x3965e9[_0xba15('0x38')]=_[_0xba15('0x39')](_0x3965e9[_0xba15('0x38')],{'$or':_[_0xba15('0x2e')](_0x12344b,function(_0x29d560){if(_0x29d560[_0xba15('0x2b')]!=='VIRTUAL'){var _0x3ae369={};_0x3ae369[_0x29d560[_0xba15('0x27')]]={'$like':'%'+_0xbda9e5[_0xba15('0x2f')][_0xba15('0x3a')]+'%'};return _0x3ae369;}})});}_0x3965e9=_[_0xba15('0x39')]({},_0x3965e9,_0xbda9e5['options']);var _0x424451={'where':_0x3965e9[_0xba15('0x38')]};return db[_0xba15('0x3b')][_0xba15('0x1c')](_0x424451)[_0xba15('0x24')](function(_0x3ac4e2){_0x53fa05[_0xba15('0x1c')]=_0x3ac4e2;if(_0xbda9e5[_0xba15('0x2f')][_0xba15('0x3c')]){_0x3965e9[_0xba15('0x3d')]=[{'all':!![]}];}return db[_0xba15('0x3b')]['findAll'](_0x3965e9);})[_0xba15('0x24')](function(_0x9a9180){_0x53fa05['rows']=_0x9a9180;return _0x53fa05;})['then'](respondWithFilteredResult(_0x3d3de4,_0x3965e9))[_0xba15('0x3e')](handleError(_0x3d3de4,null));};exports[_0xba15('0x3f')]=function(_0x8b8482,_0x90261e){var _0x400314={'raw':!![],'where':{'id':_0x8b8482[_0xba15('0x40')]['id']}},_0x4c36db={};_0x4c36db[_0xba15('0x2d')]=_[_0xba15('0x41')](db['ZendeskField']['rawAttributes']);_0x4c36db[_0xba15('0x2f')]=_[_0xba15('0x41')](_0x8b8482[_0xba15('0x2f')]);_0x4c36db[_0xba15('0x30')]=_[_0xba15('0x31')](_0x4c36db[_0xba15('0x2d')],_0x4c36db[_0xba15('0x2f')]);_0x400314[_0xba15('0x33')]=_[_0xba15('0x31')](_0x4c36db['model'],qs[_0xba15('0x32')](_0x8b8482[_0xba15('0x2f')][_0xba15('0x32')]));_0x400314[_0xba15('0x33')]=_0x400314['attributes']['length']?_0x400314[_0xba15('0x33')]:_0x4c36db[_0xba15('0x2d')];if(_0x8b8482[_0xba15('0x2f')][_0xba15('0x3c')]){_0x400314[_0xba15('0x3d')]=[{'all':!![]}];}_0x400314=_[_0xba15('0x39')]({},_0x400314,_0x8b8482['options']);return db[_0xba15('0x3b')][_0xba15('0x42')](_0x400314)[_0xba15('0x24')](handleEntityNotFound(_0x90261e,null))[_0xba15('0x24')](respondWithResult(_0x90261e,null))[_0xba15('0x3e')](handleError(_0x90261e,null));};exports[_0xba15('0x43')]=function(_0x423b8e,_0x5ba399){return db[_0xba15('0x3b')][_0xba15('0x43')](_0x423b8e[_0xba15('0x44')],{})[_0xba15('0x24')](respondWithResult(_0x5ba399,0xc9))[_0xba15('0x3e')](handleError(_0x5ba399,null));};exports[_0xba15('0x22')]=function(_0x4e02a0,_0x335c26){if(_0x4e02a0['body']['id']){delete _0x4e02a0[_0xba15('0x44')]['id'];}return db[_0xba15('0x3b')][_0xba15('0x42')]({'where':{'id':_0x4e02a0[_0xba15('0x40')]['id']}})['then'](handleEntityNotFound(_0x335c26,null))[_0xba15('0x24')](saveUpdates(_0x4e02a0['body'],null))[_0xba15('0x24')](respondWithResult(_0x335c26,null))['catch'](handleError(_0x335c26,null));};exports['destroy']=function(_0x1e3920,_0x3354d2){return db[_0xba15('0x3b')][_0xba15('0x42')]({'where':{'id':_0x1e3920[_0xba15('0x40')]['id']}})[_0xba15('0x24')](handleEntityNotFound(_0x3354d2,null))[_0xba15('0x24')](removeEntity(_0x3354d2,null))[_0xba15('0x3e')](handleError(_0x3354d2,null));}; \ No newline at end of file +var _0x3d62=['Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','type','query','keys','filters','model','attributes','intersection','fields','length','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set'];(function(_0xbdffd9,_0x3d4ef9){var _0x3ba135=function(_0x86fd8a){while(--_0x86fd8a){_0xbdffd9['push'](_0xbdffd9['shift']());}};_0x3ba135(++_0x3d4ef9);}(_0x3d62,0x70));var _0x23d6=function(_0x57ac4d,_0x4da159){_0x57ac4d=_0x57ac4d-0x0;var _0x1caeaf=_0x3d62[_0x57ac4d];return _0x1caeaf;};'use strict';var emlformat=require(_0x23d6('0x0'));var rimraf=require(_0x23d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23d6('0x2'));var moment=require(_0x23d6('0x3'));var BPromise=require(_0x23d6('0x4'));var Mustache=require(_0x23d6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x23d6('0x6'));var csv=require(_0x23d6('0x7'));var ejs=require(_0x23d6('0x8'));var fs=require('fs');var fs_extra=require(_0x23d6('0x9'));var _=require('lodash');var squel=require(_0x23d6('0xa'));var crypto=require(_0x23d6('0xb'));var jsforce=require(_0x23d6('0xc'));var deskjs=require(_0x23d6('0xd'));var toCsv=require(_0x23d6('0x7'));var querystring=require(_0x23d6('0xe'));var Papa=require(_0x23d6('0xf'));var Redis=require(_0x23d6('0x10'));var authService=require(_0x23d6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23d6('0x12'));var hardwareService=require(_0x23d6('0x13'));var logger=require(_0x23d6('0x14'))(_0x23d6('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23d6('0x16'));var db=require(_0x23d6('0x17'))['db'];function respondWithStatusCode(_0x2b4fdf,_0x1ab61c){_0x1ab61c=_0x1ab61c||0xcc;return function(_0x2cdfd1){if(_0x2cdfd1){return _0x2b4fdf[_0x23d6('0x18')](_0x1ab61c);}return _0x2b4fdf[_0x23d6('0x19')](_0x1ab61c)['end']();};}function respondWithResult(_0x4a7a76,_0x366075){_0x366075=_0x366075||0xc8;return function(_0x522522){if(_0x522522){return _0x4a7a76[_0x23d6('0x19')](_0x366075)[_0x23d6('0x1a')](_0x522522);}};}function respondWithFilteredResult(_0x5850e7,_0x36ac17){return function(_0x59644e){if(_0x59644e){var _0x40322c=typeof _0x36ac17[_0x23d6('0x1b')]===_0x23d6('0x1c')&&typeof _0x36ac17['limit']==='undefined';var _0x20043c=_0x59644e[_0x23d6('0x1d')];var _0x33ab98=_0x40322c?0x0:_0x36ac17[_0x23d6('0x1b')];var _0x32d25b=_0x40322c?_0x59644e[_0x23d6('0x1d')]:_0x36ac17[_0x23d6('0x1b')]+_0x36ac17[_0x23d6('0x1e')];var _0x5469fc;if(_0x32d25b>=_0x20043c){_0x32d25b=_0x20043c;_0x5469fc=0xc8;}else{_0x5469fc=0xce;}_0x5850e7[_0x23d6('0x19')](_0x5469fc);return _0x5850e7[_0x23d6('0x1f')](_0x23d6('0x20'),_0x33ab98+'-'+_0x32d25b+'/'+_0x20043c)[_0x23d6('0x1a')](_0x59644e);}return null;};}function patchUpdates(_0x544777){return function(_0xee497e){try{jsonpatch[_0x23d6('0x21')](_0xee497e,_0x544777,!![]);}catch(_0x34dec3){return BPromise['reject'](_0x34dec3);}return _0xee497e[_0x23d6('0x22')]();};}function saveUpdates(_0x3cda7d,_0x5027e5){return function(_0x5111b6){if(_0x5111b6){return _0x5111b6[_0x23d6('0x23')](_0x3cda7d)[_0x23d6('0x24')](function(_0x38c62f){return _0x38c62f;});}return null;};}function removeEntity(_0x448c9c,_0x526fd2){return function(_0x22f2d5){if(_0x22f2d5){return _0x22f2d5[_0x23d6('0x25')]()['then'](function(){_0x448c9c[_0x23d6('0x19')](0xcc)[_0x23d6('0x26')]();});}};}function handleEntityNotFound(_0x42b1c3,_0xb49f9b){return function(_0x257656){if(!_0x257656){_0x42b1c3[_0x23d6('0x18')](0x194);}return _0x257656;};}function handleError(_0x4d1897,_0x304825){_0x304825=_0x304825||0x1f4;return function(_0x3583ad){logger[_0x23d6('0x27')](_0x3583ad[_0x23d6('0x28')]);if(_0x3583ad[_0x23d6('0x29')]){delete _0x3583ad[_0x23d6('0x29')];}_0x4d1897['status'](_0x304825)[_0x23d6('0x2a')](_0x3583ad);};}exports[_0x23d6('0x2b')]=function(_0x4d652c,_0x532fa9){var _0x456b54={},_0x3ce074={},_0x5ed138={'count':0x0,'rows':[]};var _0x2e5d4a=_[_0x23d6('0x2c')](db[_0x23d6('0x2d')]['rawAttributes'],function(_0xa3448c){return{'name':_0xa3448c['fieldName'],'type':_0xa3448c[_0x23d6('0x2e')]['key']};});_0x3ce074['model']=_['map'](_0x2e5d4a,_0x23d6('0x29'));_0x3ce074[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x4d652c[_0x23d6('0x2f')]);_0x3ce074[_0x23d6('0x31')]=_['intersection'](_0x3ce074[_0x23d6('0x32')],_0x3ce074[_0x23d6('0x2f')]);_0x456b54[_0x23d6('0x33')]=_[_0x23d6('0x34')](_0x3ce074[_0x23d6('0x32')],qs[_0x23d6('0x35')](_0x4d652c['query']['fields']));_0x456b54[_0x23d6('0x33')]=_0x456b54[_0x23d6('0x33')][_0x23d6('0x36')]?_0x456b54['attributes']:_0x3ce074[_0x23d6('0x32')];if(!_0x4d652c[_0x23d6('0x2f')]['hasOwnProperty']('nolimit')){_0x456b54[_0x23d6('0x1e')]=qs[_0x23d6('0x1e')](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x1e')]);_0x456b54['offset']=qs['offset'](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x1b')]);}_0x456b54[_0x23d6('0x37')]=qs[_0x23d6('0x38')](_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x38')]);_0x456b54['where']=qs['filters'](_[_0x23d6('0x39')](_0x4d652c[_0x23d6('0x2f')],_0x3ce074['filters']),_0x2e5d4a);if(_0x4d652c['query'][_0x23d6('0x3a')]){_0x456b54[_0x23d6('0x3b')]=_[_0x23d6('0x3c')](_0x456b54['where'],{'$or':_[_0x23d6('0x2c')](_0x2e5d4a,function(_0xf8be82){if(_0xf8be82[_0x23d6('0x2e')]!=='VIRTUAL'){var _0x40adb8={};_0x40adb8[_0xf8be82['name']]={'$like':'%'+_0x4d652c[_0x23d6('0x2f')]['filter']+'%'};return _0x40adb8;}})});}_0x456b54=_[_0x23d6('0x3c')]({},_0x456b54,_0x4d652c[_0x23d6('0x3d')]);var _0x5d1a41={'where':_0x456b54[_0x23d6('0x3b')]};return db['ZendeskField']['count'](_0x5d1a41)[_0x23d6('0x24')](function(_0x11dcac){_0x5ed138['count']=_0x11dcac;if(_0x4d652c[_0x23d6('0x2f')][_0x23d6('0x3e')]){_0x456b54[_0x23d6('0x3f')]=[{'all':!![]}];}return db[_0x23d6('0x2d')][_0x23d6('0x40')](_0x456b54);})[_0x23d6('0x24')](function(_0x150012){_0x5ed138[_0x23d6('0x41')]=_0x150012;return _0x5ed138;})[_0x23d6('0x24')](respondWithFilteredResult(_0x532fa9,_0x456b54))['catch'](handleError(_0x532fa9,null));};exports[_0x23d6('0x42')]=function(_0x416eac,_0x20d065){var _0x22580d={'raw':!![],'where':{'id':_0x416eac[_0x23d6('0x43')]['id']}},_0xa499f3={};_0xa499f3[_0x23d6('0x32')]=_[_0x23d6('0x30')](db[_0x23d6('0x2d')]['rawAttributes']);_0xa499f3[_0x23d6('0x2f')]=_[_0x23d6('0x30')](_0x416eac['query']);_0xa499f3[_0x23d6('0x31')]=_[_0x23d6('0x34')](_0xa499f3[_0x23d6('0x32')],_0xa499f3[_0x23d6('0x2f')]);_0x22580d[_0x23d6('0x33')]=_[_0x23d6('0x34')](_0xa499f3[_0x23d6('0x32')],qs[_0x23d6('0x35')](_0x416eac[_0x23d6('0x2f')][_0x23d6('0x35')]));_0x22580d[_0x23d6('0x33')]=_0x22580d[_0x23d6('0x33')]['length']?_0x22580d[_0x23d6('0x33')]:_0xa499f3[_0x23d6('0x32')];if(_0x416eac['query'][_0x23d6('0x3e')]){_0x22580d[_0x23d6('0x3f')]=[{'all':!![]}];}_0x22580d=_[_0x23d6('0x3c')]({},_0x22580d,_0x416eac[_0x23d6('0x3d')]);return db[_0x23d6('0x2d')]['find'](_0x22580d)['then'](handleEntityNotFound(_0x20d065,null))[_0x23d6('0x24')](respondWithResult(_0x20d065,null))[_0x23d6('0x44')](handleError(_0x20d065,null));};exports[_0x23d6('0x45')]=function(_0x3cb7de,_0x5a7954){return db[_0x23d6('0x2d')][_0x23d6('0x45')](_0x3cb7de[_0x23d6('0x46')],{})[_0x23d6('0x24')](respondWithResult(_0x5a7954,0xc9))['catch'](handleError(_0x5a7954,null));};exports[_0x23d6('0x23')]=function(_0xc57b00,_0x3035a3){if(_0xc57b00[_0x23d6('0x46')]['id']){delete _0xc57b00['body']['id'];}return db['ZendeskField'][_0x23d6('0x47')]({'where':{'id':_0xc57b00[_0x23d6('0x43')]['id']}})[_0x23d6('0x24')](handleEntityNotFound(_0x3035a3,null))[_0x23d6('0x24')](saveUpdates(_0xc57b00[_0x23d6('0x46')],null))[_0x23d6('0x24')](respondWithResult(_0x3035a3,null))[_0x23d6('0x44')](handleError(_0x3035a3,null));};exports[_0x23d6('0x25')]=function(_0xe0b023,_0xca98b8){return db[_0x23d6('0x2d')][_0x23d6('0x47')]({'where':{'id':_0xe0b023[_0x23d6('0x43')]['id']}})[_0x23d6('0x24')](handleEntityNotFound(_0xca98b8,null))['then'](removeEntity(_0xca98b8,null))[_0x23d6('0x44')](handleError(_0xca98b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 17f0e10..20a9edb 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 _0x343d=['moment','bluebird','request-promise','path','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x41983a,_0x35e329){var _0x196cea=function(_0x4cb56b){while(--_0x4cb56b){_0x41983a['push'](_0x41983a['shift']());}};_0x196cea(++_0x35e329);}(_0x343d,0xbf));var _0xd343=function(_0x27e2c8,_0x5f40a0){_0x27e2c8=_0x27e2c8-0x0;var _0x5454d4=_0x343d[_0x27e2c8];return _0x5454d4;};'use strict';var _=require(_0xd343('0x0'));var util=require(_0xd343('0x1'));var logger=require(_0xd343('0x2'))(_0xd343('0x3'));var moment=require(_0xd343('0x4'));var BPromise=require(_0xd343('0x5'));var rp=require(_0xd343('0x6'));var fs=require('fs');var path=require(_0xd343('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd343('0x8'));module[_0xd343('0x9')]=function(_0x1116f6,_0x546a58){return _0x1116f6[_0xd343('0xa')](_0xd343('0xb'),attributes,{'tableName':_0xd343('0xc'),'paranoid':![],'indexes':[{'name':_0xd343('0xd'),'fields':[_0xd343('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x363c=['path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0x363c,0xe4));var _0xc363=function(_0x1e007a,_0xc87ffe){_0x1e007a=_0x1e007a-0x0;var _0x3cc6d3=_0x363c[_0x1e007a];return _0x3cc6d3;};'use strict';var _=require(_0xc363('0x0'));var util=require(_0xc363('0x1'));var logger=require(_0xc363('0x2'))('api');var moment=require(_0xc363('0x3'));var BPromise=require(_0xc363('0x4'));var rp=require(_0xc363('0x5'));var fs=require('fs');var path=require(_0xc363('0x6'));var rimraf=require(_0xc363('0x7'));var config=require(_0xc363('0x8'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x3ce467,_0x49906b){return _0x3ce467[_0xc363('0x9')](_0xc363('0xa'),attributes,{'tableName':_0xc363('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0xc363('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 70e9bad..ed80b60 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 _0x6f24=['message','result','catch','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2582dd,_0x40b4f1){var _0x5b4476=function(_0x210d49){while(--_0x210d49){_0x2582dd['push'](_0x2582dd['shift']());}};_0x5b4476(++_0x40b4f1);}(_0x6f24,0x159));var _0x46f2=function(_0x286726,_0x20a337){_0x286726=_0x286726-0x0;var _0xcd4fe9=_0x6f24[_0x286726];return _0xcd4fe9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x46f2('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f2('0x1'));var db=require(_0x46f2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x46f2('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x46f2('0x4'));var client=jayson['client'][_0x46f2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1bb6ee,_0x54f408,_0x43de53){return new BPromise(function(_0x2f2669,_0xde8076){return client[_0x46f2('0x6')](_0x1bb6ee,_0x43de53)[_0x46f2('0x7')](function(_0x1ac749){logger[_0x46f2('0x8')](_0x46f2('0x9'),_0x54f408,'request\x20sent');logger[_0x46f2('0xa')](_0x46f2('0xb'),_0x54f408,_0x46f2('0xc'),JSON['stringify'](_0x1ac749));if(_0x1ac749['error']){if(_0x1ac749[_0x46f2('0xd')][_0x46f2('0xe')]===0x1f4){logger[_0x46f2('0xd')](_0x46f2('0x9'),_0x54f408,_0x1ac749['error'][_0x46f2('0xf')]);return _0xde8076(_0x1ac749[_0x46f2('0xd')]['message']);}logger[_0x46f2('0xd')](_0x46f2('0x9'),_0x54f408,_0x1ac749[_0x46f2('0xd')][_0x46f2('0xf')]);return _0x2f2669(_0x1ac749[_0x46f2('0xd')][_0x46f2('0xf')]);}else{logger[_0x46f2('0x8')](_0x46f2('0x9'),_0x54f408,_0x46f2('0xc'));_0x2f2669(_0x1ac749[_0x46f2('0x10')][_0x46f2('0xf')]);}})[_0x46f2('0x11')](function(_0x571a13){logger[_0x46f2('0xd')](_0x46f2('0x9'),_0x54f408,_0x571a13);_0xde8076(_0x571a13);});});} \ No newline at end of file +var _0xabcc=['ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x296cf2,_0x1316df){var _0x3783f6=function(_0x151928){while(--_0x151928){_0x296cf2['push'](_0x296cf2['shift']());}};_0x3783f6(++_0x1316df);}(_0xabcc,0x7d));var _0xcabc=function(_0x1a735a,_0x1839ee){_0x1a735a=_0x1a735a-0x0;var _0x532cb8=_0xabcc[_0x1a735a];return _0x532cb8;};'use strict';var _=require(_0xcabc('0x0'));var util=require('util');var moment=require(_0xcabc('0x1'));var BPromise=require(_0xcabc('0x2'));var rs=require(_0xcabc('0x3'));var fs=require('fs');var Redis=require(_0xcabc('0x4'));var db=require(_0xcabc('0x5'))['db'];var utils=require(_0xcabc('0x6'));var logger=require('../../config/logger')(_0xcabc('0x7'));var config=require(_0xcabc('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b8f04,_0x22e3c9,_0x3f84eb){return new BPromise(function(_0x47ea66,_0xf3fdfc){return client[_0xcabc('0x9')](_0x4b8f04,_0x3f84eb)[_0xcabc('0xa')](function(_0x510ac0){logger[_0xcabc('0xb')](_0xcabc('0xc'),_0x22e3c9,_0xcabc('0xd'));logger[_0xcabc('0xe')](_0xcabc('0xf'),_0x22e3c9,'request\x20sent',JSON['stringify'](_0x510ac0));if(_0x510ac0[_0xcabc('0x10')]){if(_0x510ac0[_0xcabc('0x10')]['code']===0x1f4){logger[_0xcabc('0x10')](_0xcabc('0xc'),_0x22e3c9,_0x510ac0['error'][_0xcabc('0x11')]);return _0xf3fdfc(_0x510ac0[_0xcabc('0x10')]['message']);}logger[_0xcabc('0x10')](_0xcabc('0xc'),_0x22e3c9,_0x510ac0[_0xcabc('0x10')][_0xcabc('0x11')]);return _0x47ea66(_0x510ac0[_0xcabc('0x10')][_0xcabc('0x11')]);}else{logger['info'](_0xcabc('0xc'),_0x22e3c9,_0xcabc('0xd'));_0x47ea66(_0x510ac0[_0xcabc('0x12')][_0xcabc('0x11')]);}})[_0xcabc('0x13')](function(_0x4b22b3){logger[_0xcabc('0x10')](_0xcabc('0xc'),_0x22e3c9,_0x4b22b3);_0xf3fdfc(_0x4b22b3);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index ed63ef9..9d629a5 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 _0xabd9=['getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x2ae210,_0x2a6647){var _0x3b33bb=function(_0x3e9a1b){while(--_0x3e9a1b){_0x2ae210['push'](_0x2ae210['shift']());}};_0x3b33bb(++_0x2a6647);}(_0xabd9,0xd0));var _0x9abd=function(_0x429861,_0x2905b6){_0x429861=_0x429861-0x0;var _0x5a21c8=_0xabd9[_0x429861];return _0x5a21c8;};'use strict';var multer=require(_0x9abd('0x0'));var util=require(_0x9abd('0x1'));var path=require(_0x9abd('0x2'));var timeout=require(_0x9abd('0x3'));var express=require(_0x9abd('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9abd('0x5'));var interaction=require(_0x9abd('0x6'));var config=require(_0x9abd('0x7'));var controller=require('./intZohoAccount.controller');router[_0x9abd('0x8')]('/',auth[_0x9abd('0x9')](),controller['index']);router[_0x9abd('0x8')](_0x9abd('0xa'),auth[_0x9abd('0x9')](),controller['show']);router[_0x9abd('0x8')](_0x9abd('0xb'),auth[_0x9abd('0x9')](),controller[_0x9abd('0xc')]);router[_0x9abd('0x8')]('/:id/fields',auth[_0x9abd('0x9')](),controller[_0x9abd('0xd')]);router[_0x9abd('0xe')]('/',auth[_0x9abd('0x9')](),controller[_0x9abd('0xf')]);router['post'](_0x9abd('0xb'),auth['isAuthenticated'](),controller[_0x9abd('0x10')]);router[_0x9abd('0x11')]('/:id',auth[_0x9abd('0x9')](),controller[_0x9abd('0x12')]);router[_0x9abd('0x13')](_0x9abd('0xa'),auth[_0x9abd('0x9')](),controller[_0x9abd('0x14')]);module[_0x9abd('0x15')]=router; \ No newline at end of file +var _0xc52c=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','addConfiguration','put','update'];(function(_0x1906e0,_0x45a2bf){var _0x5657a6=function(_0x27fa24){while(--_0x27fa24){_0x1906e0['push'](_0x1906e0['shift']());}};_0x5657a6(++_0x45a2bf);}(_0xc52c,0xff));var _0xcc52=function(_0x599c44,_0x2fb16e){_0x599c44=_0x599c44-0x0;var _0x1d6cf6=_0xc52c[_0x599c44];return _0x1d6cf6;};'use strict';var multer=require(_0xcc52('0x0'));var util=require(_0xcc52('0x1'));var path=require(_0xcc52('0x2'));var timeout=require(_0xcc52('0x3'));var express=require(_0xcc52('0x4'));var router=express[_0xcc52('0x5')]();var fs_extra=require(_0xcc52('0x6'));var auth=require(_0xcc52('0x7'));var interaction=require(_0xcc52('0x8'));var config=require(_0xcc52('0x9'));var controller=require(_0xcc52('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc52('0xb')]);router[_0xcc52('0xc')](_0xcc52('0xd'),auth[_0xcc52('0xe')](),controller[_0xcc52('0xf')]);router[_0xcc52('0xc')](_0xcc52('0x10'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xcc52('0xc')](_0xcc52('0x11'),auth[_0xcc52('0xe')](),controller['getFields']);router['post']('/',auth[_0xcc52('0xe')](),controller['create']);router['post'](_0xcc52('0x10'),auth[_0xcc52('0xe')](),controller[_0xcc52('0x12')]);router[_0xcc52('0x13')](_0xcc52('0xd'),auth[_0xcc52('0xe')](),controller[_0xcc52('0x14')]);router['delete'](_0xcc52('0xd'),auth[_0xcc52('0xe')](),controller[_0xcc52('0x15')]);module[_0xcc52('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 5e2bb25..01a5c92 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 _0xa8a8=['exports','STRING','sequelize'];(function(_0x55a699,_0x75f1b0){var _0x195ca9=function(_0x34e404){while(--_0x34e404){_0x55a699['push'](_0x55a699['shift']());}};_0x195ca9(++_0x75f1b0);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2ca194,_0x769cfb){_0x2ca194=_0x2ca194-0x0;var _0x496108=_0xa8a8[_0x2ca194];return _0x496108;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'name':{'type':Sequelize[_0x8a8a('0x2')]},'description':{'type':Sequelize[_0x8a8a('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x8a8a('0x2')]},'clientId':{'type':Sequelize[_0x8a8a('0x2')]},'clientSecret':{'type':Sequelize[_0x8a8a('0x2')]},'serverUrl':{'type':Sequelize[_0x8a8a('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x8a8a('0x2')]},'refreshToken':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file +var _0x4522=['STRING'];(function(_0x29cf54,_0x1be9c5){var _0x35dd6f=function(_0x5cdab2){while(--_0x5cdab2){_0x29cf54['push'](_0x29cf54['shift']());}};_0x35dd6f(++_0x1be9c5);}(_0x4522,0x1a0));var _0x2452=function(_0x2de08b,_0xba6792){_0x2de08b=_0x2de08b-0x0;var _0x28f701=_0x4522[_0x2de08b];return _0x28f701;};'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 diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d187d64..9be9a15 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 _0xdd71=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','include','findAll','rows','catch','show','params','filters','includeAll','merge','options','find','create','body','getConfigurations','ZohoConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientId','serverUrl','code','refreshToken','host','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x41eda5,_0x5a9891){var _0xdea96f=function(_0x54f4ad){while(--_0x54f4ad){_0x41eda5['push'](_0x41eda5['shift']());}};_0xdea96f(++_0x5a9891);}(_0xdd71,0x183));var _0x1dd7=function(_0x56e680,_0x22e953){_0x56e680=_0x56e680-0x0;var _0x20de8d=_0xdd71[_0x56e680];return _0x20de8d;};'use strict';var emlformat=require(_0x1dd7('0x0'));var rimraf=require(_0x1dd7('0x1'));var zipdir=require(_0x1dd7('0x2'));var jsonpatch=require(_0x1dd7('0x3'));var rp=require(_0x1dd7('0x4'));var moment=require(_0x1dd7('0x5'));var BPromise=require(_0x1dd7('0x6'));var Mustache=require(_0x1dd7('0x7'));var util=require('util');var path=require(_0x1dd7('0x8'));var sox=require(_0x1dd7('0x9'));var csv=require(_0x1dd7('0xa'));var ejs=require(_0x1dd7('0xb'));var fs=require('fs');var fs_extra=require(_0x1dd7('0xc'));var _=require(_0x1dd7('0xd'));var squel=require('squel');var crypto=require(_0x1dd7('0xe'));var jsforce=require(_0x1dd7('0xf'));var deskjs=require(_0x1dd7('0x10'));var toCsv=require(_0x1dd7('0xa'));var querystring=require(_0x1dd7('0x11'));var Papa=require(_0x1dd7('0x12'));var Redis=require(_0x1dd7('0x13'));var authService=require(_0x1dd7('0x14'));var qs=require(_0x1dd7('0x15'));var as=require(_0x1dd7('0x16'));var hardwareService=require(_0x1dd7('0x17'));var logger=require('../../config/logger')(_0x1dd7('0x18'));var utils=require('../../config/utils');var config=require(_0x1dd7('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1dd7('0x1a'));function respondWithStatusCode(_0x34af19,_0x548049){_0x548049=_0x548049||0xcc;return function(_0x27c39b){if(_0x27c39b){return _0x34af19[_0x1dd7('0x1b')](_0x548049);}return _0x34af19[_0x1dd7('0x1c')](_0x548049)[_0x1dd7('0x1d')]();};}function respondWithResult(_0x412e28,_0x120682){_0x120682=_0x120682||0xc8;return function(_0x5ca0eb){if(_0x5ca0eb){return _0x412e28[_0x1dd7('0x1c')](_0x120682)['json'](_0x5ca0eb);}};}function respondWithFilteredResult(_0x344163,_0x520747){return function(_0x212262){if(_0x212262){var _0xe448fe=typeof _0x520747[_0x1dd7('0x1e')]===_0x1dd7('0x1f')&&typeof _0x520747[_0x1dd7('0x20')]==='undefined';var _0x255fd8=_0x212262[_0x1dd7('0x21')];var _0x359924=_0xe448fe?0x0:_0x520747[_0x1dd7('0x1e')];var _0x31194b=_0xe448fe?_0x212262[_0x1dd7('0x21')]:_0x520747[_0x1dd7('0x1e')]+_0x520747[_0x1dd7('0x20')];var _0x39d814;if(_0x31194b>=_0x255fd8){_0x31194b=_0x255fd8;_0x39d814=0xc8;}else{_0x39d814=0xce;}_0x344163[_0x1dd7('0x1c')](_0x39d814);return _0x344163[_0x1dd7('0x22')](_0x1dd7('0x23'),_0x359924+'-'+_0x31194b+'/'+_0x255fd8)[_0x1dd7('0x24')](_0x212262);}return null;};}function patchUpdates(_0x2d6961){return function(_0x1d820c){try{jsonpatch[_0x1dd7('0x25')](_0x1d820c,_0x2d6961,!![]);}catch(_0xeee6b5){return BPromise[_0x1dd7('0x26')](_0xeee6b5);}return _0x1d820c[_0x1dd7('0x27')]();};}function saveUpdates(_0x578808,_0x5ef617){return function(_0x17ca34){if(_0x17ca34){return _0x17ca34[_0x1dd7('0x28')](_0x578808)['then'](function(_0x454b16){return _0x454b16;});}return null;};}function removeEntity(_0x224d2a,_0x1d8b95){return function(_0x49424e){if(_0x49424e){return _0x49424e[_0x1dd7('0x29')]()[_0x1dd7('0x2a')](function(){_0x224d2a['status'](0xcc)[_0x1dd7('0x1d')]();});}};}function handleEntityNotFound(_0x982146,_0x80236b){return function(_0x59aef7){if(!_0x59aef7){_0x982146['sendStatus'](0x194);}return _0x59aef7;};}function handleError(_0x534568,_0x5340cd){_0x5340cd=_0x5340cd||0x1f4;return function(_0x23a42c){logger[_0x1dd7('0x2b')](_0x23a42c[_0x1dd7('0x2c')]);if(_0x23a42c[_0x1dd7('0x2d')]){delete _0x23a42c[_0x1dd7('0x2d')];}_0x534568[_0x1dd7('0x1c')](_0x5340cd)[_0x1dd7('0x2e')](_0x23a42c);};}exports[_0x1dd7('0x2f')]=function(_0x4a12f2,_0x5dc6b5){var _0x155f09={},_0x291fd1={},_0x4cec54={'count':0x0,'rows':[]};var _0x561cdd=_['map'](db[_0x1dd7('0x30')][_0x1dd7('0x31')],function(_0x45b969){return{'name':_0x45b969[_0x1dd7('0x32')],'type':_0x45b969[_0x1dd7('0x33')][_0x1dd7('0x34')]};});_0x291fd1[_0x1dd7('0x35')]=_[_0x1dd7('0x36')](_0x561cdd,_0x1dd7('0x2d'));_0x291fd1[_0x1dd7('0x37')]=_[_0x1dd7('0x38')](_0x4a12f2['query']);_0x291fd1['filters']=_[_0x1dd7('0x39')](_0x291fd1['model'],_0x291fd1[_0x1dd7('0x37')]);_0x155f09[_0x1dd7('0x3a')]=_['intersection'](_0x291fd1[_0x1dd7('0x35')],qs[_0x1dd7('0x3b')](_0x4a12f2['query'][_0x1dd7('0x3b')]));_0x155f09[_0x1dd7('0x3a')]=_0x155f09[_0x1dd7('0x3a')][_0x1dd7('0x3c')]?_0x155f09[_0x1dd7('0x3a')]:_0x291fd1[_0x1dd7('0x35')];if(!_0x4a12f2[_0x1dd7('0x37')][_0x1dd7('0x3d')](_0x1dd7('0x3e'))){_0x155f09['limit']=qs[_0x1dd7('0x20')](_0x4a12f2[_0x1dd7('0x37')]['limit']);_0x155f09[_0x1dd7('0x1e')]=qs[_0x1dd7('0x1e')](_0x4a12f2['query'][_0x1dd7('0x1e')]);}_0x155f09[_0x1dd7('0x3f')]=qs['sort'](_0x4a12f2[_0x1dd7('0x37')][_0x1dd7('0x40')]);_0x155f09[_0x1dd7('0x41')]=qs['filters'](_[_0x1dd7('0x42')](_0x4a12f2['query'],_0x291fd1['filters']),_0x561cdd);if(_0x4a12f2[_0x1dd7('0x37')]['filter']){_0x155f09[_0x1dd7('0x41')]=_['merge'](_0x155f09['where'],{'$or':_['map'](_0x561cdd,function(_0x2bd8dd){if(_0x2bd8dd[_0x1dd7('0x33')]!=='VIRTUAL'){var _0x4133a6={};_0x4133a6[_0x2bd8dd[_0x1dd7('0x2d')]]={'$like':'%'+_0x4a12f2[_0x1dd7('0x37')]['filter']+'%'};return _0x4133a6;}})});}_0x155f09=_['merge']({},_0x155f09,_0x4a12f2['options']);var _0x5698f1={'where':_0x155f09['where']};return db['ZohoAccount'][_0x1dd7('0x21')](_0x5698f1)[_0x1dd7('0x2a')](function(_0x345b61){_0x4cec54[_0x1dd7('0x21')]=_0x345b61;if(_0x4a12f2[_0x1dd7('0x37')]['includeAll']){_0x155f09[_0x1dd7('0x43')]=[{'all':!![]}];}return db['ZohoAccount'][_0x1dd7('0x44')](_0x155f09);})[_0x1dd7('0x2a')](function(_0x711e4){_0x4cec54[_0x1dd7('0x45')]=_0x711e4;return _0x4cec54;})[_0x1dd7('0x2a')](respondWithFilteredResult(_0x5dc6b5,_0x155f09))[_0x1dd7('0x46')](handleError(_0x5dc6b5,null));};exports[_0x1dd7('0x47')]=function(_0x3e6a43,_0x24e542){var _0x11a49d={'raw':![],'where':{'id':_0x3e6a43[_0x1dd7('0x48')]['id']}},_0x15a486={};_0x15a486['model']=_[_0x1dd7('0x38')](db['ZohoAccount'][_0x1dd7('0x31')]);_0x15a486[_0x1dd7('0x37')]=_[_0x1dd7('0x38')](_0x3e6a43['query']);_0x15a486[_0x1dd7('0x49')]=_[_0x1dd7('0x39')](_0x15a486[_0x1dd7('0x35')],_0x15a486[_0x1dd7('0x37')]);_0x11a49d['attributes']=_[_0x1dd7('0x39')](_0x15a486['model'],qs['fields'](_0x3e6a43[_0x1dd7('0x37')][_0x1dd7('0x3b')]));_0x11a49d[_0x1dd7('0x3a')]=_0x11a49d['attributes'][_0x1dd7('0x3c')]?_0x11a49d[_0x1dd7('0x3a')]:_0x15a486['model'];if(_0x3e6a43[_0x1dd7('0x37')][_0x1dd7('0x4a')]){_0x11a49d[_0x1dd7('0x43')]=[{'all':!![]}];}_0x11a49d=_[_0x1dd7('0x4b')]({},_0x11a49d,_0x3e6a43[_0x1dd7('0x4c')]);return db['ZohoAccount'][_0x1dd7('0x4d')](_0x11a49d)[_0x1dd7('0x2a')](handleEntityNotFound(_0x24e542,null))[_0x1dd7('0x2a')](respondWithResult(_0x24e542,null))[_0x1dd7('0x46')](handleError(_0x24e542,null));};exports[_0x1dd7('0x4e')]=function(_0x17b80f,_0x322982){return db[_0x1dd7('0x30')][_0x1dd7('0x4e')](_0x17b80f[_0x1dd7('0x4f')],{})['then'](respondWithResult(_0x322982,0xc9))[_0x1dd7('0x46')](handleError(_0x322982,null));};exports[_0x1dd7('0x28')]=function(_0xbb7fd8,_0x66f82f){if(_0xbb7fd8[_0x1dd7('0x4f')]['id']){delete _0xbb7fd8['body']['id'];}return db[_0x1dd7('0x30')][_0x1dd7('0x4d')]({'where':{'id':_0xbb7fd8['params']['id']}})[_0x1dd7('0x2a')](handleEntityNotFound(_0x66f82f,null))[_0x1dd7('0x2a')](saveUpdates(_0xbb7fd8[_0x1dd7('0x4f')],null))['then'](respondWithResult(_0x66f82f,null))[_0x1dd7('0x46')](handleError(_0x66f82f,null));};exports[_0x1dd7('0x29')]=function(_0x38c3fa,_0x54a7a6){return db['ZohoAccount']['find']({'where':{'id':_0x38c3fa[_0x1dd7('0x48')]['id']}})[_0x1dd7('0x2a')](handleEntityNotFound(_0x54a7a6,null))[_0x1dd7('0x2a')](removeEntity(_0x54a7a6,null))[_0x1dd7('0x46')](handleError(_0x54a7a6,null));};exports[_0x1dd7('0x50')]=function(_0x128f90,_0x48b210,_0x271632){var _0x23a234={};var _0x3c789={};var _0x1c5be7;var _0x463ba3;return db[_0x1dd7('0x30')]['findOne']({'where':{'id':_0x128f90[_0x1dd7('0x48')]['id']}})[_0x1dd7('0x2a')](handleEntityNotFound(_0x48b210,null))[_0x1dd7('0x2a')](function(_0x214686){if(_0x214686){_0x1c5be7=_0x214686;_0x3c789['model']=_[_0x1dd7('0x38')](db[_0x1dd7('0x51')][_0x1dd7('0x31')]);_0x3c789['query']=_[_0x1dd7('0x38')](_0x128f90[_0x1dd7('0x37')]);_0x3c789[_0x1dd7('0x49')]=_[_0x1dd7('0x39')](_0x3c789['model'],_0x3c789['query']);_0x23a234[_0x1dd7('0x3a')]=_[_0x1dd7('0x39')](_0x3c789['model'],qs[_0x1dd7('0x3b')](_0x128f90[_0x1dd7('0x37')]['fields']));_0x23a234['attributes']=_0x23a234['attributes'][_0x1dd7('0x3c')]?_0x23a234[_0x1dd7('0x3a')]:_0x3c789[_0x1dd7('0x35')];_0x23a234[_0x1dd7('0x3f')]=qs[_0x1dd7('0x40')](_0x128f90[_0x1dd7('0x37')]['sort']);_0x23a234['where']=qs['filters'](_['pick'](_0x128f90[_0x1dd7('0x37')],_0x3c789[_0x1dd7('0x49')]));if(_0x128f90[_0x1dd7('0x37')]['filter']){_0x23a234[_0x1dd7('0x41')]=_[_0x1dd7('0x4b')](_0x23a234[_0x1dd7('0x41')],{'$or':_[_0x1dd7('0x36')](_0x23a234[_0x1dd7('0x3a')],function(_0x1ea01c){var _0x35a812={};_0x35a812[_0x1ea01c]={'$like':'%'+_0x128f90['query']['filter']+'%'};return _0x35a812;})});}_0x23a234=_[_0x1dd7('0x4b')]({},_0x23a234,_0x128f90[_0x1dd7('0x4c')]);return _0x1c5be7[_0x1dd7('0x50')](_0x23a234);}})['then'](function(_0x1137cc){if(_0x1137cc){_0x463ba3=_0x1137cc['length'];if(!_0x128f90[_0x1dd7('0x37')][_0x1dd7('0x3d')](_0x1dd7('0x3e'))){_0x23a234[_0x1dd7('0x20')]=qs['limit'](_0x128f90[_0x1dd7('0x37')][_0x1dd7('0x20')]);_0x23a234['offset']=qs[_0x1dd7('0x1e')](_0x128f90[_0x1dd7('0x37')][_0x1dd7('0x1e')]);}return _0x1c5be7[_0x1dd7('0x50')](_0x23a234);}})[_0x1dd7('0x2a')](function(_0xf5fa75){if(_0xf5fa75){return _0xf5fa75?{'count':_0x463ba3,'rows':_0xf5fa75}:null;}})[_0x1dd7('0x2a')](respondWithResult(_0x48b210,null))['catch'](handleError(_0x48b210,null));};exports['addConfiguration']=function(_0x3191c2,_0x12fbf8,_0x28e204){if(_0x3191c2['body']['id']){delete _0x3191c2[_0x1dd7('0x4f')]['id'];}return db['ZohoAccount'][_0x1dd7('0x52')]({'where':{'id':_0x3191c2['params']['id']}})[_0x1dd7('0x2a')](handleEntityNotFound(_0x12fbf8,null))['then'](function(_0x2f121c){if(_0x2f121c){_0x3191c2[_0x1dd7('0x4f')][_0x1dd7('0x53')]=_0x2f121c['id'];_0x3191c2[_0x1dd7('0x4f')][_0x1dd7('0x54')]=integrations['getSubjects'](_0x3191c2[_0x1dd7('0x4f')][_0x1dd7('0x55')],_0x3191c2[_0x1dd7('0x4f')][_0x1dd7('0x33')]);_0x3191c2[_0x1dd7('0x4f')][_0x1dd7('0x56')]=integrations[_0x1dd7('0x57')](_0x3191c2['body'][_0x1dd7('0x55')],_0x3191c2['body'][_0x1dd7('0x33')]);return db[_0x1dd7('0x51')][_0x1dd7('0x4e')](_0x3191c2[_0x1dd7('0x4f')],{'include':[{'model':db[_0x1dd7('0x58')],'as':_0x1dd7('0x54')},{'model':db[_0x1dd7('0x58')],'as':_0x1dd7('0x56')}]});}return null;})[_0x1dd7('0x2a')](respondWithResult(_0x12fbf8,null))['catch'](handleError(_0x12fbf8,null));};function getAccessToken(_0x2cbab8){return new Promise(function(_0xba4118,_0x1ee684){var _0x318166;switch(_0x2cbab8[_0x1dd7('0x59')]){case'US':_0x318166=_0x1dd7('0x5a');break;case'AU':_0x318166=_0x1dd7('0x5b');break;case'EU':_0x318166=_0x1dd7('0x5c');break;case'IN':_0x318166=_0x1dd7('0x5d');break;case'CN':_0x318166='https://accounts.zoho.com.cn';break;default:_0x318166=_0x1dd7('0x5c');break;}var _0x13004b={'method':_0x1dd7('0x5e'),'uri':_0x318166+_0x1dd7('0x5f'),'qs':{'refresh_token':_0x2cbab8['refreshToken'],'client_id':_0x2cbab8['clientId'],'client_secret':_0x2cbab8[_0x1dd7('0x60')],'grant_type':_0x1dd7('0x61')},'json':!![]};return rp(_0x13004b)[_0x1dd7('0x2a')](function(_0x22efe9){if(_0x22efe9[_0x1dd7('0x62')]){_0xba4118(_0x22efe9[_0x1dd7('0x62')]);}else{_0x1ee684(_0x1dd7('0x63'));}})[_0x1dd7('0x46')](function(_0x4c3237){_0x1ee684(_0x4c3237);});});}exports[_0x1dd7('0x64')]=function(_0x92f872,_0x1a5f06,_0x2febf6){var _0xc52fb1,_0xa91fb5,_0x4d4018,_0x54cc0a,_0x5ae444;return db[_0x1dd7('0x30')][_0x1dd7('0x52')]({'where':{'id':_0x92f872[_0x1dd7('0x48')]['id']},'attributes':['id','host',_0x1dd7('0x59'),_0x1dd7('0x65'),_0x1dd7('0x60'),_0x1dd7('0x66'),_0x1dd7('0x67'),_0x1dd7('0x68')]})[_0x1dd7('0x2a')](handleEntityNotFound(_0x1a5f06,null))[_0x1dd7('0x2a')](function(_0x2d6c89){_0x5ae444=_0x2d6c89;_0xc52fb1=_0x5ae444[_0x1dd7('0x69')];_0xa91fb5=_0xc52fb1===_0x1dd7('0x6a')?'eu':'com';_0x4d4018=_0x5ae444[_0x1dd7('0x66')];var _0x105d84=_0x4d4018[_0x1dd7('0x6b')](-0x1);if(_0x105d84==='/'||_0x105d84==='\x5c'||_0x105d84===':'){_0x4d4018=_0x4d4018[_0x1dd7('0x6c')](0x0,_0x4d4018[_0x1dd7('0x6d')](_0x105d84));}if(!_0x5ae444[_0x1dd7('0x68')]){throw new Error(_0x1dd7('0x6e'));}return getAccessToken(_0x5ae444);})[_0x1dd7('0x2a')](function(_0x26a799){if(_0x26a799){return rp({'method':_0x1dd7('0x6f'),'uri':util['format'](_0x1dd7('0x70'),_0xa91fb5),'qs':{'module':_0x1dd7('0x71')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x26a799},'json':!![]});}})[_0x1dd7('0x2a')](function(_0x125bc8){if(_0x125bc8){if(_0x125bc8[_0x1dd7('0x72')]&&_0x125bc8[_0x1dd7('0x72')][_0x1dd7('0x2b')]){throw new Error(_0x125bc8[_0x1dd7('0x72')][_0x1dd7('0x2b')]['message']);}var _0xe7f120=[];var _0x5a2523=[];var _0x2a245f=[_0x1dd7('0x73'),_0x1dd7('0x74'),_0x1dd7('0x75'),_0x1dd7('0x76'),_0x1dd7('0x77'),'Call_Result',_0x1dd7('0x78'),'Call_Type'];_0x5a2523=_[_0x1dd7('0x79')](_0x125bc8[_0x1dd7('0x3b')],function(_0x3855c3){return _0x2a245f['includes'](_0x3855c3['api_name']);});for(var _0x4babfd=0x0;_0x4babfd<_0x5a2523[_0x1dd7('0x3c')];_0x4babfd++){if(_0x5a2523[_0x4babfd]['system_mandatory']===![]){_0xe7f120[_0x1dd7('0x7a')]({'id':_0x5a2523[_0x4babfd]['id'],'name':_0x5a2523[_0x4babfd][_0x1dd7('0x7b')],'custom':_0x5a2523[_0x4babfd][_0x1dd7('0x7c')],'options':_0x5a2523[_0x4babfd][_0x1dd7('0x7d')]==='picklist'&&_0x5a2523[_0x4babfd][_0x1dd7('0x7e')]['length']>-0x1?_[_0x1dd7('0x36')](_0x5a2523[_0x4babfd][_0x1dd7('0x7e')],function(_0x496421){return{'name':_0x496421,'value':_0x496421};}):[]});}}return{'count':_0xe7f120['length'],'rows':_0xe7f120};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x1a5f06,null))['catch'](function(_0x3ffde6){var _0x4c975f=_0x92f872[_0x1dd7('0x37')][_0x1dd7('0x7f')]?0x1f4:_0x3ffde6[_0x1dd7('0x80')]||0x1f4;logger[_0x1dd7('0x2b')](_0x1dd7('0x81'),_0x1dd7('0x64'),_0x4c975f,JSON['stringify'](_0x3ffde6));delete _0x3ffde6[_0x1dd7('0x2d')];if(_0x4c975f===0x191){_0x4c975f=0x190;}_0x1a5f06[_0x1dd7('0x1c')](_0x4c975f)['send'](_0x92f872[_0x1dd7('0x37')][_0x1dd7('0x7f')]?{'message':_0x1dd7('0x82'),'statusCode':_0x3ffde6[_0x1dd7('0x80')]}:_0x3ffde6);});}; \ No newline at end of file +var _0x6071=['sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','map','ZohoAccount','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','getFields','host','clientId','code','com','serverUrl','substring','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','display_label','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration'];(function(_0x11adbd,_0x5055f5){var _0x270029=function(_0x25feb6){while(--_0x25feb6){_0x11adbd['push'](_0x11adbd['shift']());}};_0x270029(++_0x5055f5);}(_0x6071,0x1de));var _0x1607=function(_0x50a6f5,_0x5530dc){_0x50a6f5=_0x50a6f5-0x0;var _0x5c18c4=_0x6071[_0x50a6f5];return _0x5c18c4;};'use strict';var emlformat=require(_0x1607('0x0'));var rimraf=require(_0x1607('0x1'));var zipdir=require(_0x1607('0x2'));var jsonpatch=require(_0x1607('0x3'));var rp=require(_0x1607('0x4'));var moment=require(_0x1607('0x5'));var BPromise=require(_0x1607('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1607('0x7'));var ejs=require(_0x1607('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1607('0x9'));var crypto=require(_0x1607('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1607('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1607('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1607('0xd'));var qs=require(_0x1607('0xe'));var as=require(_0x1607('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1607('0x10'))('api');var utils=require(_0x1607('0x11'));var config=require(_0x1607('0x12'));var licenseUtil=require(_0x1607('0x13'));var db=require(_0x1607('0x14'))['db'];var integrations=require(_0x1607('0x15'));function respondWithStatusCode(_0xace068,_0x481ba6){_0x481ba6=_0x481ba6||0xcc;return function(_0x5b16c7){if(_0x5b16c7){return _0xace068[_0x1607('0x16')](_0x481ba6);}return _0xace068[_0x1607('0x17')](_0x481ba6)[_0x1607('0x18')]();};}function respondWithResult(_0x1f5e4b,_0x656d1c){_0x656d1c=_0x656d1c||0xc8;return function(_0x5ced93){if(_0x5ced93){return _0x1f5e4b[_0x1607('0x17')](_0x656d1c)[_0x1607('0x19')](_0x5ced93);}};}function respondWithFilteredResult(_0x1e0ed4,_0x21cfa5){return function(_0x2d46a0){if(_0x2d46a0){var _0x4ae9d7=typeof _0x21cfa5[_0x1607('0x1a')]===_0x1607('0x1b')&&typeof _0x21cfa5[_0x1607('0x1c')]===_0x1607('0x1b');var _0x183a8b=_0x2d46a0[_0x1607('0x1d')];var _0x595698=_0x4ae9d7?0x0:_0x21cfa5['offset'];var _0x52c052=_0x4ae9d7?_0x2d46a0['count']:_0x21cfa5[_0x1607('0x1a')]+_0x21cfa5[_0x1607('0x1c')];var _0x2f75ff;if(_0x52c052>=_0x183a8b){_0x52c052=_0x183a8b;_0x2f75ff=0xc8;}else{_0x2f75ff=0xce;}_0x1e0ed4['status'](_0x2f75ff);return _0x1e0ed4[_0x1607('0x1e')]('Content-Range',_0x595698+'-'+_0x52c052+'/'+_0x183a8b)[_0x1607('0x19')](_0x2d46a0);}return null;};}function patchUpdates(_0x46d50c){return function(_0x2c28f7){try{jsonpatch[_0x1607('0x1f')](_0x2c28f7,_0x46d50c,!![]);}catch(_0x2a80f2){return BPromise[_0x1607('0x20')](_0x2a80f2);}return _0x2c28f7['save']();};}function saveUpdates(_0xb6149,_0x3a27dc){return function(_0x2991c7){if(_0x2991c7){return _0x2991c7['update'](_0xb6149)[_0x1607('0x21')](function(_0x286051){return _0x286051;});}return null;};}function removeEntity(_0x2daef9,_0x545d84){return function(_0x4160ee){if(_0x4160ee){return _0x4160ee[_0x1607('0x22')]()[_0x1607('0x21')](function(){_0x2daef9[_0x1607('0x17')](0xcc)[_0x1607('0x18')]();});}};}function handleEntityNotFound(_0x4f83fc,_0x325351){return function(_0x45dbbf){if(!_0x45dbbf){_0x4f83fc[_0x1607('0x16')](0x194);}return _0x45dbbf;};}function handleError(_0x15e79b,_0xe298f5){_0xe298f5=_0xe298f5||0x1f4;return function(_0x291d6e){logger[_0x1607('0x23')](_0x291d6e[_0x1607('0x24')]);if(_0x291d6e[_0x1607('0x25')]){delete _0x291d6e[_0x1607('0x25')];}_0x15e79b['status'](_0xe298f5)[_0x1607('0x26')](_0x291d6e);};}exports['index']=function(_0x127bdb,_0x12071d){var _0x102c2d={},_0xac1931={},_0x27ab8d={'count':0x0,'rows':[]};var _0x587ed3=_[_0x1607('0x27')](db[_0x1607('0x28')][_0x1607('0x29')],function(_0x5ebc81){return{'name':_0x5ebc81['fieldName'],'type':_0x5ebc81[_0x1607('0x2a')]['key']};});_0xac1931[_0x1607('0x2b')]=_[_0x1607('0x27')](_0x587ed3,_0x1607('0x25'));_0xac1931[_0x1607('0x2c')]=_[_0x1607('0x2d')](_0x127bdb['query']);_0xac1931[_0x1607('0x2e')]=_[_0x1607('0x2f')](_0xac1931['model'],_0xac1931[_0x1607('0x2c')]);_0x102c2d['attributes']=_['intersection'](_0xac1931[_0x1607('0x2b')],qs[_0x1607('0x30')](_0x127bdb[_0x1607('0x2c')]['fields']));_0x102c2d[_0x1607('0x31')]=_0x102c2d[_0x1607('0x31')][_0x1607('0x32')]?_0x102c2d[_0x1607('0x31')]:_0xac1931[_0x1607('0x2b')];if(!_0x127bdb[_0x1607('0x2c')][_0x1607('0x33')](_0x1607('0x34'))){_0x102c2d['limit']=qs[_0x1607('0x1c')](_0x127bdb['query'][_0x1607('0x1c')]);_0x102c2d[_0x1607('0x1a')]=qs['offset'](_0x127bdb[_0x1607('0x2c')][_0x1607('0x1a')]);}_0x102c2d[_0x1607('0x35')]=qs[_0x1607('0x36')](_0x127bdb['query'][_0x1607('0x36')]);_0x102c2d[_0x1607('0x37')]=qs[_0x1607('0x2e')](_['pick'](_0x127bdb[_0x1607('0x2c')],_0xac1931[_0x1607('0x2e')]),_0x587ed3);if(_0x127bdb[_0x1607('0x2c')][_0x1607('0x38')]){_0x102c2d['where']=_[_0x1607('0x39')](_0x102c2d[_0x1607('0x37')],{'$or':_[_0x1607('0x27')](_0x587ed3,function(_0x1096d2){if(_0x1096d2[_0x1607('0x2a')]!=='VIRTUAL'){var _0x48debd={};_0x48debd[_0x1096d2[_0x1607('0x25')]]={'$like':'%'+_0x127bdb[_0x1607('0x2c')][_0x1607('0x38')]+'%'};return _0x48debd;}})});}_0x102c2d=_['merge']({},_0x102c2d,_0x127bdb[_0x1607('0x3a')]);var _0x257bc1={'where':_0x102c2d['where']};return db[_0x1607('0x28')][_0x1607('0x1d')](_0x257bc1)[_0x1607('0x21')](function(_0x3a9a41){_0x27ab8d[_0x1607('0x1d')]=_0x3a9a41;if(_0x127bdb[_0x1607('0x2c')][_0x1607('0x3b')]){_0x102c2d[_0x1607('0x3c')]=[{'all':!![]}];}return db[_0x1607('0x28')][_0x1607('0x3d')](_0x102c2d);})[_0x1607('0x21')](function(_0x1ed106){_0x27ab8d[_0x1607('0x3e')]=_0x1ed106;return _0x27ab8d;})[_0x1607('0x21')](respondWithFilteredResult(_0x12071d,_0x102c2d))[_0x1607('0x3f')](handleError(_0x12071d,null));};exports[_0x1607('0x40')]=function(_0x486da3,_0x2d0f83){var _0x21be67={'raw':![],'where':{'id':_0x486da3[_0x1607('0x41')]['id']}},_0x1e1838={};_0x1e1838['model']=_['keys'](db[_0x1607('0x28')]['rawAttributes']);_0x1e1838[_0x1607('0x2c')]=_[_0x1607('0x2d')](_0x486da3[_0x1607('0x2c')]);_0x1e1838['filters']=_[_0x1607('0x2f')](_0x1e1838['model'],_0x1e1838['query']);_0x21be67['attributes']=_[_0x1607('0x2f')](_0x1e1838['model'],qs[_0x1607('0x30')](_0x486da3[_0x1607('0x2c')][_0x1607('0x30')]));_0x21be67['attributes']=_0x21be67[_0x1607('0x31')]['length']?_0x21be67[_0x1607('0x31')]:_0x1e1838[_0x1607('0x2b')];if(_0x486da3[_0x1607('0x2c')][_0x1607('0x3b')]){_0x21be67[_0x1607('0x3c')]=[{'all':!![]}];}_0x21be67=_[_0x1607('0x39')]({},_0x21be67,_0x486da3[_0x1607('0x3a')]);return db[_0x1607('0x28')][_0x1607('0x42')](_0x21be67)['then'](handleEntityNotFound(_0x2d0f83,null))[_0x1607('0x21')](respondWithResult(_0x2d0f83,null))[_0x1607('0x3f')](handleError(_0x2d0f83,null));};exports[_0x1607('0x43')]=function(_0x21fde8,_0x182140){return db[_0x1607('0x28')]['create'](_0x21fde8['body'],{})['then'](respondWithResult(_0x182140,0xc9))[_0x1607('0x3f')](handleError(_0x182140,null));};exports[_0x1607('0x44')]=function(_0x57101d,_0x4a24ec){if(_0x57101d[_0x1607('0x45')]['id']){delete _0x57101d[_0x1607('0x45')]['id'];}return db[_0x1607('0x28')][_0x1607('0x42')]({'where':{'id':_0x57101d['params']['id']}})[_0x1607('0x21')](handleEntityNotFound(_0x4a24ec,null))[_0x1607('0x21')](saveUpdates(_0x57101d[_0x1607('0x45')],null))[_0x1607('0x21')](respondWithResult(_0x4a24ec,null))['catch'](handleError(_0x4a24ec,null));};exports['destroy']=function(_0x1c1c27,_0x3736e8){return db[_0x1607('0x28')][_0x1607('0x42')]({'where':{'id':_0x1c1c27[_0x1607('0x41')]['id']}})[_0x1607('0x21')](handleEntityNotFound(_0x3736e8,null))['then'](removeEntity(_0x3736e8,null))[_0x1607('0x3f')](handleError(_0x3736e8,null));};exports[_0x1607('0x46')]=function(_0x1eb0e9,_0x5d0d5f,_0x108961){var _0x846107={};var _0x7cb124={};var _0x5b18b7;var _0x1af972;return db[_0x1607('0x28')][_0x1607('0x47')]({'where':{'id':_0x1eb0e9[_0x1607('0x41')]['id']}})['then'](handleEntityNotFound(_0x5d0d5f,null))[_0x1607('0x21')](function(_0x41d51b){if(_0x41d51b){_0x5b18b7=_0x41d51b;_0x7cb124[_0x1607('0x2b')]=_['keys'](db[_0x1607('0x48')][_0x1607('0x29')]);_0x7cb124[_0x1607('0x2c')]=_[_0x1607('0x2d')](_0x1eb0e9[_0x1607('0x2c')]);_0x7cb124[_0x1607('0x2e')]=_[_0x1607('0x2f')](_0x7cb124[_0x1607('0x2b')],_0x7cb124[_0x1607('0x2c')]);_0x846107[_0x1607('0x31')]=_[_0x1607('0x2f')](_0x7cb124[_0x1607('0x2b')],qs[_0x1607('0x30')](_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x30')]));_0x846107[_0x1607('0x31')]=_0x846107[_0x1607('0x31')][_0x1607('0x32')]?_0x846107[_0x1607('0x31')]:_0x7cb124['model'];_0x846107['order']=qs[_0x1607('0x36')](_0x1eb0e9[_0x1607('0x2c')]['sort']);_0x846107[_0x1607('0x37')]=qs[_0x1607('0x2e')](_[_0x1607('0x49')](_0x1eb0e9[_0x1607('0x2c')],_0x7cb124[_0x1607('0x2e')]));if(_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x38')]){_0x846107[_0x1607('0x37')]=_['merge'](_0x846107[_0x1607('0x37')],{'$or':_['map'](_0x846107[_0x1607('0x31')],function(_0x16be0c){var _0x5b02a8={};_0x5b02a8[_0x16be0c]={'$like':'%'+_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x38')]+'%'};return _0x5b02a8;})});}_0x846107=_[_0x1607('0x39')]({},_0x846107,_0x1eb0e9[_0x1607('0x3a')]);return _0x5b18b7[_0x1607('0x46')](_0x846107);}})['then'](function(_0x220269){if(_0x220269){_0x1af972=_0x220269[_0x1607('0x32')];if(!_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x33')](_0x1607('0x34'))){_0x846107[_0x1607('0x1c')]=qs[_0x1607('0x1c')](_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x1c')]);_0x846107[_0x1607('0x1a')]=qs[_0x1607('0x1a')](_0x1eb0e9[_0x1607('0x2c')][_0x1607('0x1a')]);}return _0x5b18b7['getConfigurations'](_0x846107);}})[_0x1607('0x21')](function(_0x245509){if(_0x245509){return _0x245509?{'count':_0x1af972,'rows':_0x245509}:null;}})[_0x1607('0x21')](respondWithResult(_0x5d0d5f,null))[_0x1607('0x3f')](handleError(_0x5d0d5f,null));};exports[_0x1607('0x4a')]=function(_0x5ae4f5,_0x56bd2d,_0x43c0c1){if(_0x5ae4f5[_0x1607('0x45')]['id']){delete _0x5ae4f5[_0x1607('0x45')]['id'];}return db[_0x1607('0x28')][_0x1607('0x47')]({'where':{'id':_0x5ae4f5['params']['id']}})['then'](handleEntityNotFound(_0x56bd2d,null))['then'](function(_0x1a0add){if(_0x1a0add){_0x5ae4f5[_0x1607('0x45')][_0x1607('0x4b')]=_0x1a0add['id'];_0x5ae4f5[_0x1607('0x45')][_0x1607('0x4c')]=integrations[_0x1607('0x4d')](_0x5ae4f5[_0x1607('0x45')][_0x1607('0x4e')],_0x5ae4f5[_0x1607('0x45')][_0x1607('0x2a')]);_0x5ae4f5[_0x1607('0x45')][_0x1607('0x4f')]=integrations[_0x1607('0x50')](_0x5ae4f5['body']['channel'],_0x5ae4f5[_0x1607('0x45')][_0x1607('0x2a')]);return db['ZohoConfiguration'][_0x1607('0x43')](_0x5ae4f5[_0x1607('0x45')],{'include':[{'model':db[_0x1607('0x51')],'as':'Subjects'},{'model':db[_0x1607('0x51')],'as':_0x1607('0x4f')}]});}return null;})[_0x1607('0x21')](respondWithResult(_0x56bd2d,null))[_0x1607('0x3f')](handleError(_0x56bd2d,null));};function getAccessToken(_0x24e120){return new Promise(function(_0xf48ab2,_0x2c8567){var _0x33b5b5;switch(_0x24e120[_0x1607('0x52')]){case'US':_0x33b5b5=_0x1607('0x53');break;case'AU':_0x33b5b5=_0x1607('0x54');break;case'EU':_0x33b5b5=_0x1607('0x55');break;case'IN':_0x33b5b5=_0x1607('0x56');break;case'CN':_0x33b5b5='https://accounts.zoho.com.cn';break;default:_0x33b5b5=_0x1607('0x55');break;}var _0x3518c0={'method':_0x1607('0x57'),'uri':_0x33b5b5+_0x1607('0x58'),'qs':{'refresh_token':_0x24e120[_0x1607('0x59')],'client_id':_0x24e120['clientId'],'client_secret':_0x24e120[_0x1607('0x5a')],'grant_type':_0x1607('0x5b')},'json':!![]};return rp(_0x3518c0)[_0x1607('0x21')](function(_0x306f67){if(_0x306f67['access_token']){_0xf48ab2(_0x306f67['access_token']);}else{_0x2c8567('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1607('0x3f')](function(_0x575fe5){_0x2c8567(_0x575fe5);});});}exports[_0x1607('0x5c')]=function(_0x33e0ec,_0x315960,_0x5b6eaf){var _0x13df62,_0x423b54,_0x58e7cc,_0x5c6e49,_0xedabdd;return db[_0x1607('0x28')][_0x1607('0x47')]({'where':{'id':_0x33e0ec[_0x1607('0x41')]['id']},'attributes':['id',_0x1607('0x5d'),_0x1607('0x52'),_0x1607('0x5e'),_0x1607('0x5a'),'serverUrl',_0x1607('0x5f'),_0x1607('0x59')]})['then'](handleEntityNotFound(_0x315960,null))[_0x1607('0x21')](function(_0xeb0b2a){_0xedabdd=_0xeb0b2a;_0x13df62=_0xedabdd['host'];_0x423b54=_0x13df62==='zoho.eu'?'eu':_0x1607('0x60');_0x58e7cc=_0xedabdd[_0x1607('0x61')];var _0x38c208=_0x58e7cc['slice'](-0x1);if(_0x38c208==='/'||_0x38c208==='\x5c'||_0x38c208===':'){_0x58e7cc=_0x58e7cc[_0x1607('0x62')](0x0,_0x58e7cc['lastIndexOf'](_0x38c208));}if(!_0xedabdd['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0xedabdd);})[_0x1607('0x21')](function(_0x34ba2c){if(_0x34ba2c){return rp({'method':_0x1607('0x63'),'uri':util[_0x1607('0x64')](_0x1607('0x65'),_0x423b54),'qs':{'module':'Calls'},'headers':{'Authorization':_0x1607('0x66')+_0x34ba2c},'json':!![]});}})[_0x1607('0x21')](function(_0x594586){if(_0x594586){if(_0x594586[_0x1607('0x67')]&&_0x594586[_0x1607('0x67')][_0x1607('0x23')]){throw new Error(_0x594586[_0x1607('0x67')][_0x1607('0x23')][_0x1607('0x68')]);}var _0x3ea3e5=[];var _0x4f294a=[];var _0xa209a7=[_0x1607('0x69'),_0x1607('0x6a'),_0x1607('0x6b'),_0x1607('0x6c'),_0x1607('0x6d'),_0x1607('0x6e'),_0x1607('0x6f'),_0x1607('0x70')];_0x4f294a=_[_0x1607('0x71')](_0x594586[_0x1607('0x30')],function(_0x2c431f){return _0xa209a7[_0x1607('0x72')](_0x2c431f[_0x1607('0x73')]);});for(var _0x17f396=0x0;_0x17f396<_0x4f294a['length'];_0x17f396++){if(_0x4f294a[_0x17f396][_0x1607('0x74')]===![]){_0x3ea3e5['push']({'id':_0x4f294a[_0x17f396]['id'],'name':_0x4f294a[_0x17f396][_0x1607('0x75')],'custom':_0x4f294a[_0x17f396]['custom_field'],'options':_0x4f294a[_0x17f396]['data_type']===_0x1607('0x76')&&_0x4f294a[_0x17f396]['pick_list_values'][_0x1607('0x32')]>-0x1?_[_0x1607('0x27')](_0x4f294a[_0x17f396][_0x1607('0x77')],function(_0x44f456){return{'name':_0x44f456,'value':_0x44f456};}):[]});}}return{'count':_0x3ea3e5[_0x1607('0x32')],'rows':_0x3ea3e5};}else{return{'count':0x0,'rows':[]};}})[_0x1607('0x21')](respondWithResult(_0x315960,null))[_0x1607('0x3f')](function(_0x35b8f0){var _0xf1a0dc=_0x33e0ec[_0x1607('0x2c')][_0x1607('0x78')]?0x1f4:_0x35b8f0[_0x1607('0x79')]||0x1f4;logger[_0x1607('0x23')](_0x1607('0x7a'),_0x1607('0x5c'),_0xf1a0dc,JSON[_0x1607('0x7b')](_0x35b8f0));delete _0x35b8f0[_0x1607('0x25')];if(_0xf1a0dc===0x191){_0xf1a0dc=0x190;}_0x315960[_0x1607('0x17')](_0xf1a0dc)[_0x1607('0x26')](_0x33e0ec[_0x1607('0x2c')][_0x1607('0x78')]?{'message':_0x1607('0x7c'),'statusCode':_0x35b8f0[_0x1607('0x79')]}:_0x35b8f0);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index ff5e4dc..b377a43 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 _0x6500=['lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','name','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','error','inspect','substring','https://accounts.zoho.eu','authorization_code','then','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed','serverUrl','clientId','clientSecret','code','host','slice'];(function(_0x23905e,_0x3c9623){var _0x2e6939=function(_0x2ba294){while(--_0x2ba294){_0x23905e['push'](_0x23905e['shift']());}};_0x2e6939(++_0x3c9623);}(_0x6500,0x13b));var _0x0650=function(_0x23e8ed,_0x3ba371){_0x23e8ed=_0x23e8ed-0x0;var _0x1fbecb=_0x6500[_0x23e8ed];return _0x1fbecb;};'use strict';var _=require('lodash');var util=require(_0x0650('0x0'));var logger=require(_0x0650('0x1'))(_0x0650('0x2'));var moment=require('moment');var BPromise=require(_0x0650('0x3'));var rp=require(_0x0650('0x4'));var fs=require('fs');var path=require(_0x0650('0x5'));var rimraf=require(_0x0650('0x6'));var config=require(_0x0650('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x0650('0x8'));module[_0x0650('0x9')]=function(_0x5645e5,_0xc02b3){return _0x5645e5[_0x0650('0xa')](_0x0650('0xb'),attributes,{'tableName':_0x0650('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26e11c,_0x528179,_0x419a9d){if(_0x26e11c['changed'](_0x0650('0xd'))||_0x26e11c[_0x0650('0xe')](_0x0650('0xf'))||_0x26e11c['changed'](_0x0650('0x10'))||_0x26e11c[_0x0650('0xe')](_0x0650('0x11'))||_0x26e11c[_0x0650('0xe')](_0x0650('0x12'))||_0x26e11c['changed'](_0x0650('0x13'))){var _0x49bc00,_0x630eef;_0x49bc00=_0x26e11c[_0x0650('0xf')];var _0x59ef66=_0x49bc00[_0x0650('0x14')](-0x1);if(_0x59ef66==='/'||_0x59ef66==='\x5c'||_0x59ef66===':'){_0x49bc00=_0x49bc00['substring'](0x0,_0x49bc00[_0x0650('0x15')](_0x59ef66));}switch(_0x26e11c[_0x0650('0xd')]){case'US':_0x630eef=_0x0650('0x16');break;case'AU':_0x630eef=_0x0650('0x17');break;case'IN':_0x630eef=_0x0650('0x18');break;case'CN':_0x630eef=_0x0650('0x19');break;default:_0x630eef='https://accounts.zoho.eu';break;}var _0x576023={'method':_0x0650('0x1a'),'uri':_0x630eef+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x26e11c[_0x0650('0x10')],'client_secret':_0x26e11c[_0x0650('0x11')],'redirect_uri':_0x26e11c[_0x0650('0xf')],'code':_0x26e11c[_0x0650('0x12')]},'headers':{'Content-Type':_0x0650('0x1b')}};return rp(_0x576023)['then'](function(_0x2ef8c0){var _0x2a93cc=JSON[_0x0650('0x1c')](_0x2ef8c0);if(_0x2a93cc[_0x0650('0x1d')]){_0x26e11c[_0x0650('0x1e')]=_0x2a93cc[_0x0650('0x1d')];logger[_0x0650('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26e11c[_0x0650('0x20')],_0x26e11c['id']));}else{logger['error'](util[_0x0650('0x21')](_0x0650('0x22'),_0x26e11c[_0x0650('0x20')],_0x26e11c['id']),util['inspect'](_0x2a93cc,{'showHidden':![],'depth':null}));}return _0x419a9d(null,_0x528179);})[_0x0650('0x23')](function(_0x47d43f){logger[_0x0650('0x24')](util[_0x0650('0x21')](_0x0650('0x22'),_0x26e11c[_0x0650('0x20')],_0x26e11c['id']),util[_0x0650('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x419a9d(_0x47d43f);});}else{return _0x419a9d(null,_0x528179);}},'beforeUpdate':function(_0x1128c0,_0x49d848,_0x107091){if(_0x1128c0[_0x0650('0xe')](_0x0650('0xd'))||_0x1128c0[_0x0650('0xe')](_0x0650('0xf'))||_0x1128c0[_0x0650('0xe')](_0x0650('0x10'))||_0x1128c0[_0x0650('0xe')](_0x0650('0x11'))||_0x1128c0[_0x0650('0xe')](_0x0650('0x12'))||_0x1128c0[_0x0650('0xe')](_0x0650('0x13'))){var _0x289a30,_0xafa1ef;_0x289a30=_0x1128c0[_0x0650('0xf')];var _0x4c8f78=_0x289a30[_0x0650('0x14')](-0x1);if(_0x4c8f78==='/'||_0x4c8f78==='\x5c'||_0x4c8f78===':'){_0x289a30=_0x289a30[_0x0650('0x26')](0x0,_0x289a30[_0x0650('0x15')](_0x4c8f78));}switch(_0x1128c0[_0x0650('0xd')]){case'US':_0xafa1ef=_0x0650('0x16');break;case'AU':_0xafa1ef=_0x0650('0x17');break;case'IN':_0xafa1ef=_0x0650('0x18');break;case'CN':_0xafa1ef=_0x0650('0x19');break;default:_0xafa1ef=_0x0650('0x27');break;}var _0x5483c0={'method':_0x0650('0x1a'),'uri':_0xafa1ef+'/oauth/v2/token','form':{'grant_type':_0x0650('0x28'),'client_id':_0x1128c0['clientId'],'client_secret':_0x1128c0['clientSecret'],'redirect_uri':_0x1128c0[_0x0650('0xf')],'code':_0x1128c0[_0x0650('0x12')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5483c0)[_0x0650('0x29')](function(_0x345626){var _0x4997b1=JSON['parse'](_0x345626);if(_0x4997b1['refresh_token']){_0x1128c0[_0x0650('0x1e')]=_0x4997b1[_0x0650('0x1d')];logger[_0x0650('0x1f')](util[_0x0650('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1128c0[_0x0650('0x20')],_0x1128c0['id']));}else{logger[_0x0650('0x24')](util[_0x0650('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1128c0[_0x0650('0x20')],_0x1128c0['id']),util[_0x0650('0x25')](_0x4997b1,{'showHidden':![],'depth':null}));}return _0x107091(null,_0x49d848);})[_0x0650('0x23')](function(_0x31460f){logger[_0x0650('0x24')](util[_0x0650('0x21')](_0x0650('0x22'),_0x1128c0[_0x0650('0x20')],_0x1128c0['id']),util[_0x0650('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x107091(_0x31460f);});}else{return _0x107091(null,_0x49d848);}}}});}; \ No newline at end of file +var _0x405f=['format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','code','host','https://accounts.zoho.eu','catch','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','changed','zone','clientId','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','POST','authorization_code','clientSecret','serverUrl','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info'];(function(_0x294f9c,_0x50d535){var _0x37f327=function(_0x46d8f9){while(--_0x46d8f9){_0x294f9c['push'](_0x294f9c['shift']());}};_0x37f327(++_0x50d535);}(_0x405f,0xd2));var _0xf405=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x405f[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xf405('0x0'));var util=require(_0xf405('0x1'));var logger=require(_0xf405('0x2'))(_0xf405('0x3'));var moment=require(_0xf405('0x4'));var BPromise=require('bluebird');var rp=require(_0xf405('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf405('0x6'));var config=require('../../config/environment');var attributes=require(_0xf405('0x7'));var integrations=require(_0xf405('0x8'));module[_0xf405('0x9')]=function(_0xeed88b,_0x2fcc43){return _0xeed88b[_0xf405('0xa')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xe4191d,_0x546e91,_0x598ae0){if(_0xe4191d[_0xf405('0xb')](_0xf405('0xc'))||_0xe4191d[_0xf405('0xb')]('serverUrl')||_0xe4191d['changed'](_0xf405('0xd'))||_0xe4191d['changed']('clientSecret')||_0xe4191d[_0xf405('0xb')]('code')||_0xe4191d['changed']('host')){var _0x4566fb,_0x2f89da;_0x4566fb=_0xe4191d['serverUrl'];var _0x4c71cc=_0x4566fb[_0xf405('0xe')](-0x1);if(_0x4c71cc==='/'||_0x4c71cc==='\x5c'||_0x4c71cc===':'){_0x4566fb=_0x4566fb[_0xf405('0xf')](0x0,_0x4566fb[_0xf405('0x10')](_0x4c71cc));}switch(_0xe4191d[_0xf405('0xc')]){case'US':_0x2f89da=_0xf405('0x11');break;case'AU':_0x2f89da=_0xf405('0x12');break;case'IN':_0x2f89da=_0xf405('0x13');break;case'CN':_0x2f89da='https://accounts.zoho.com.cn';break;default:_0x2f89da='https://accounts.zoho.eu';break;}var _0x12b251={'method':_0xf405('0x14'),'uri':_0x2f89da+'/oauth/v2/token','form':{'grant_type':_0xf405('0x15'),'client_id':_0xe4191d[_0xf405('0xd')],'client_secret':_0xe4191d[_0xf405('0x16')],'redirect_uri':_0xe4191d[_0xf405('0x17')],'code':_0xe4191d['code']},'headers':{'Content-Type':_0xf405('0x18')}};return rp(_0x12b251)[_0xf405('0x19')](function(_0x33529d){var _0x15ebf7=JSON[_0xf405('0x1a')](_0x33529d);if(_0x15ebf7[_0xf405('0x1b')]){_0xe4191d[_0xf405('0x1c')]=_0x15ebf7[_0xf405('0x1b')];logger[_0xf405('0x1d')](util[_0xf405('0x1e')](_0xf405('0x1f'),_0xe4191d[_0xf405('0x20')],_0xe4191d['id']));}else{logger[_0xf405('0x21')](util[_0xf405('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xe4191d[_0xf405('0x20')],_0xe4191d['id']),util[_0xf405('0x22')](_0x15ebf7,{'showHidden':![],'depth':null}));}return _0x598ae0(null,_0x546e91);})['catch'](function(_0x248c07){logger['error'](util[_0xf405('0x1e')](_0xf405('0x23'),_0xe4191d[_0xf405('0x20')],_0xe4191d['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x598ae0(_0x248c07);});}else{return _0x598ae0(null,_0x546e91);}},'beforeUpdate':function(_0x30103a,_0x397694,_0x4c9b2a){if(_0x30103a[_0xf405('0xb')](_0xf405('0xc'))||_0x30103a[_0xf405('0xb')](_0xf405('0x17'))||_0x30103a[_0xf405('0xb')](_0xf405('0xd'))||_0x30103a[_0xf405('0xb')](_0xf405('0x16'))||_0x30103a[_0xf405('0xb')](_0xf405('0x24'))||_0x30103a[_0xf405('0xb')](_0xf405('0x25'))){var _0x12b276,_0x118f28;_0x12b276=_0x30103a[_0xf405('0x17')];var _0x23d138=_0x12b276['slice'](-0x1);if(_0x23d138==='/'||_0x23d138==='\x5c'||_0x23d138===':'){_0x12b276=_0x12b276[_0xf405('0xf')](0x0,_0x12b276['lastIndexOf'](_0x23d138));}switch(_0x30103a['zone']){case'US':_0x118f28=_0xf405('0x11');break;case'AU':_0x118f28=_0xf405('0x12');break;case'IN':_0x118f28=_0xf405('0x13');break;case'CN':_0x118f28='https://accounts.zoho.com.cn';break;default:_0x118f28=_0xf405('0x26');break;}var _0x338ff2={'method':_0xf405('0x14'),'uri':_0x118f28+'/oauth/v2/token','form':{'grant_type':_0xf405('0x15'),'client_id':_0x30103a[_0xf405('0xd')],'client_secret':_0x30103a['clientSecret'],'redirect_uri':_0x30103a[_0xf405('0x17')],'code':_0x30103a[_0xf405('0x24')]},'headers':{'Content-Type':_0xf405('0x18')}};return rp(_0x338ff2)['then'](function(_0x355307){var _0x71e401=JSON['parse'](_0x355307);if(_0x71e401[_0xf405('0x1b')]){_0x30103a[_0xf405('0x1c')]=_0x71e401[_0xf405('0x1b')];logger[_0xf405('0x1d')](util[_0xf405('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x30103a[_0xf405('0x20')],_0x30103a['id']));}else{logger[_0xf405('0x21')](util['format'](_0xf405('0x23'),_0x30103a[_0xf405('0x20')],_0x30103a['id']),util[_0xf405('0x22')](_0x71e401,{'showHidden':![],'depth':null}));}return _0x4c9b2a(null,_0x397694);})[_0xf405('0x27')](function(_0x29060a){logger[_0xf405('0x21')](util[_0xf405('0x1e')](_0xf405('0x23'),_0x30103a[_0xf405('0x20')],_0x30103a['id']),util[_0xf405('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x4c9b2a(_0x29060a);});}else{return _0x4c9b2a(null,_0x397694);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 8f7545e..a3cdb32 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 _0x9a18=['debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','limit','map','include','model','attributes','ShowZohoAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x9a18,0x187));var _0x89a1=function(_0xa436e9,_0x533f67){_0xa436e9=_0xa436e9-0x0;var _0xf56163=_0x9a18[_0xa436e9];return _0xf56163;};'use strict';var _=require(_0x89a1('0x0'));var util=require('util');var moment=require(_0x89a1('0x1'));var BPromise=require(_0x89a1('0x2'));var rs=require(_0x89a1('0x3'));var fs=require('fs');var Redis=require(_0x89a1('0x4'));var db=require(_0x89a1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x89a1('0x6'))(_0x89a1('0x7'));var config=require(_0x89a1('0x8'));var jayson=require(_0x89a1('0x9'));var client=jayson[_0x89a1('0xa')][_0x89a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ec780,_0xcde361,_0x5da9e6){return new BPromise(function(_0x55ac1e,_0x3bba21){return client['request'](_0x3ec780,_0x5da9e6)[_0x89a1('0xc')](function(_0x541951){logger[_0x89a1('0xd')](_0x89a1('0xe'),_0xcde361,_0x89a1('0xf'));logger[_0x89a1('0x10')](_0x89a1('0x11'),_0xcde361,_0x89a1('0xf'),JSON[_0x89a1('0x12')](_0x541951));if(_0x541951[_0x89a1('0x13')]){if(_0x541951[_0x89a1('0x13')][_0x89a1('0x14')]===0x1f4){logger[_0x89a1('0x13')]('ZohoAccount,\x20%s,\x20%s',_0xcde361,_0x541951['error'][_0x89a1('0x15')]);return _0x3bba21(_0x541951[_0x89a1('0x13')][_0x89a1('0x15')]);}logger[_0x89a1('0x13')]('ZohoAccount,\x20%s,\x20%s',_0xcde361,_0x541951[_0x89a1('0x13')][_0x89a1('0x15')]);return _0x55ac1e(_0x541951['error'][_0x89a1('0x15')]);}else{logger[_0x89a1('0xd')](_0x89a1('0xe'),_0xcde361,_0x89a1('0xf'));_0x55ac1e(_0x541951[_0x89a1('0x16')][_0x89a1('0x15')]);}})[_0x89a1('0x17')](function(_0x325a5a){logger['error'](_0x89a1('0xe'),_0xcde361,_0x325a5a);_0x3bba21(_0x325a5a);});});}exports[_0x89a1('0x18')]=function(_0x1dbb4a){var _0xa6a057=this;return new Promise(function(_0x24b2bf,_0x573d37){return db[_0x89a1('0x19')][_0x89a1('0x1a')]({'raw':_0x1dbb4a[_0x89a1('0x1b')]?_0x1dbb4a['options'][_0x89a1('0x1c')]===undefined?!![]:![]:!![],'where':_0x1dbb4a[_0x89a1('0x1b')]?_0x1dbb4a[_0x89a1('0x1b')][_0x89a1('0x1d')]||null:null,'attributes':_0x1dbb4a[_0x89a1('0x1b')]?_0x1dbb4a[_0x89a1('0x1b')]['attributes']||null:null,'limit':_0x1dbb4a[_0x89a1('0x1b')]?_0x1dbb4a['options'][_0x89a1('0x1e')]||null:null,'include':_0x1dbb4a[_0x89a1('0x1b')]?_0x1dbb4a[_0x89a1('0x1b')]['include']?_[_0x89a1('0x1f')](_0x1dbb4a[_0x89a1('0x1b')][_0x89a1('0x20')],function(_0x2a4f97){return{'model':db[_0x2a4f97[_0x89a1('0x21')]],'as':_0x2a4f97['as'],'attributes':_0x2a4f97[_0x89a1('0x22')],'include':_0x2a4f97[_0x89a1('0x20')]?_[_0x89a1('0x1f')](_0x2a4f97[_0x89a1('0x20')],function(_0x581493){return{'model':db[_0x581493['model']],'as':_0x581493['as'],'attributes':_0x581493[_0x89a1('0x22')],'include':_0x581493[_0x89a1('0x20')]?_[_0x89a1('0x1f')](_0x581493[_0x89a1('0x20')],function(_0x16c8d7){return{'model':db[_0x16c8d7['model']],'as':_0x16c8d7['as'],'attributes':_0x16c8d7[_0x89a1('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x550333){logger[_0x89a1('0xd')](_0x89a1('0x18'),_0x1dbb4a);logger[_0x89a1('0x10')](_0x89a1('0x18'),_0x1dbb4a,JSON[_0x89a1('0x12')](_0x550333));_0x24b2bf(_0x550333);})[_0x89a1('0x17')](function(_0x320109){logger[_0x89a1('0x13')](_0x89a1('0x18'),_0x320109['message'],_0x1dbb4a);_0x573d37(_0xa6a057[_0x89a1('0x13')](0x1f4,_0x320109[_0x89a1('0x15')]));});});};exports[_0x89a1('0x23')]=function(_0x4515ea){var _0x2b1ece=this;return new Promise(function(_0x27de6d,_0x4495a0){return db['ZohoAccount'][_0x89a1('0x24')]({'raw':_0x4515ea[_0x89a1('0x1b')]?_0x4515ea[_0x89a1('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4515ea[_0x89a1('0x1b')]?_0x4515ea[_0x89a1('0x1b')][_0x89a1('0x1d')]||null:null,'attributes':_0x4515ea[_0x89a1('0x1b')]?_0x4515ea[_0x89a1('0x1b')][_0x89a1('0x22')]||null:null,'include':_0x4515ea[_0x89a1('0x1b')]?_0x4515ea[_0x89a1('0x1b')][_0x89a1('0x20')]?_[_0x89a1('0x1f')](_0x4515ea[_0x89a1('0x1b')][_0x89a1('0x20')],function(_0xdcc7d7){return{'model':db[_0xdcc7d7[_0x89a1('0x21')]],'as':_0xdcc7d7['as'],'attributes':_0xdcc7d7[_0x89a1('0x22')],'include':_0xdcc7d7[_0x89a1('0x20')]?_[_0x89a1('0x1f')](_0xdcc7d7[_0x89a1('0x20')],function(_0x4b4f5f){return{'model':db[_0x4b4f5f[_0x89a1('0x21')]],'as':_0x4b4f5f['as'],'attributes':_0x4b4f5f[_0x89a1('0x22')],'include':_0x4b4f5f[_0x89a1('0x20')]?_[_0x89a1('0x1f')](_0x4b4f5f[_0x89a1('0x20')],function(_0x2cf63f){return{'model':db[_0x2cf63f['model']],'as':_0x2cf63f['as'],'attributes':_0x2cf63f[_0x89a1('0x22')]};}):[]};}):[]};}):[]:[]})[_0x89a1('0xc')](function(_0x480afa){logger[_0x89a1('0xd')]('ShowZohoAccount',_0x4515ea);logger[_0x89a1('0x10')](_0x89a1('0x23'),_0x4515ea,JSON[_0x89a1('0x12')](_0x480afa));_0x27de6d(_0x480afa);})[_0x89a1('0x17')](function(_0x14bcfd){logger['error'](_0x89a1('0x23'),_0x14bcfd[_0x89a1('0x15')],_0x4515ea);_0x4495a0(_0x2b1ece[_0x89a1('0x13')](0x1f4,_0x14bcfd['message']));});});}; \ No newline at end of file +var _0xfa25=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','GetZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowZohoAccount','ZohoAccount','find','util'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xfa25,0xd1));var _0x5fa2=function(_0x400b31,_0x12b86e){_0x400b31=_0x400b31-0x0;var _0x194fba=_0xfa25[_0x400b31];return _0x194fba;};'use strict';var _=require('lodash');var util=require(_0x5fa2('0x0'));var moment=require(_0x5fa2('0x1'));var BPromise=require(_0x5fa2('0x2'));var rs=require(_0x5fa2('0x3'));var fs=require('fs');var Redis=require(_0x5fa2('0x4'));var db=require(_0x5fa2('0x5'))['db'];var utils=require(_0x5fa2('0x6'));var logger=require(_0x5fa2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fa2('0x8'));var client=jayson[_0x5fa2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53a560,_0x2a9a69,_0x4b04ea){return new BPromise(function(_0x35c145,_0x9c9f1c){return client[_0x5fa2('0xa')](_0x53a560,_0x4b04ea)['then'](function(_0x36778e){logger[_0x5fa2('0xb')](_0x5fa2('0xc'),_0x2a9a69,'request\x20sent');logger[_0x5fa2('0xd')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2a9a69,'request\x20sent',JSON[_0x5fa2('0xe')](_0x36778e));if(_0x36778e[_0x5fa2('0xf')]){if(_0x36778e['error'][_0x5fa2('0x10')]===0x1f4){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x9c9f1c(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);return _0x35c145(_0x36778e[_0x5fa2('0xf')][_0x5fa2('0x11')]);}else{logger[_0x5fa2('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x2a9a69,_0x5fa2('0x12'));_0x35c145(_0x36778e[_0x5fa2('0x13')][_0x5fa2('0x11')]);}})['catch'](function(_0x4e20d1){logger[_0x5fa2('0xf')](_0x5fa2('0xc'),_0x2a9a69,_0x4e20d1);_0x9c9f1c(_0x4e20d1);});});}exports[_0x5fa2('0x14')]=function(_0x522f1c){var _0x427205=this;return new Promise(function(_0x593815,_0x41be51){return db['ZohoAccount'][_0x5fa2('0x15')]({'raw':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c['options'][_0x5fa2('0x17')]===undefined?!![]:![]:!![],'where':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x18')]||null:null,'attributes':_0x522f1c['options']?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x19')]||null:null,'limit':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1a')]||null:null,'include':_0x522f1c[_0x5fa2('0x16')]?_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x522f1c[_0x5fa2('0x16')][_0x5fa2('0x1b')],function(_0x2cac01){return{'model':db[_0x2cac01[_0x5fa2('0x1d')]],'as':_0x2cac01['as'],'attributes':_0x2cac01['attributes'],'include':_0x2cac01[_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x2cac01[_0x5fa2('0x1b')],function(_0x45af15){return{'model':db[_0x45af15['model']],'as':_0x45af15['as'],'attributes':_0x45af15['attributes'],'include':_0x45af15[_0x5fa2('0x1b')]?_[_0x5fa2('0x1c')](_0x45af15['include'],function(_0x12b99b){return{'model':db[_0x12b99b[_0x5fa2('0x1d')]],'as':_0x12b99b['as'],'attributes':_0x12b99b[_0x5fa2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5fa2('0x1e')](function(_0x18cbd7){logger[_0x5fa2('0xb')]('GetZohoAccount',_0x522f1c);logger[_0x5fa2('0xd')](_0x5fa2('0x14'),_0x522f1c,JSON[_0x5fa2('0xe')](_0x18cbd7));_0x593815(_0x18cbd7);})[_0x5fa2('0x1f')](function(_0x4fd561){logger[_0x5fa2('0xf')](_0x5fa2('0x14'),_0x4fd561['message'],_0x522f1c);_0x41be51(_0x427205['error'](0x1f4,_0x4fd561['message']));});});};exports[_0x5fa2('0x20')]=function(_0xc5a40c){var _0x5a0d50=this;return new Promise(function(_0x22f054,_0x3d1d41){return db[_0x5fa2('0x21')][_0x5fa2('0x22')]({'raw':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options'][_0x5fa2('0x17')]===undefined?!![]:![]:!![],'where':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c[_0x5fa2('0x16')][_0x5fa2('0x18')]||null:null,'attributes':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options'][_0x5fa2('0x19')]||null:null,'include':_0xc5a40c[_0x5fa2('0x16')]?_0xc5a40c['options']['include']?_['map'](_0xc5a40c[_0x5fa2('0x16')][_0x5fa2('0x1b')],function(_0x293948){return{'model':db[_0x293948['model']],'as':_0x293948['as'],'attributes':_0x293948[_0x5fa2('0x19')],'include':_0x293948[_0x5fa2('0x1b')]?_['map'](_0x293948['include'],function(_0x3ba30e){return{'model':db[_0x3ba30e['model']],'as':_0x3ba30e['as'],'attributes':_0x3ba30e[_0x5fa2('0x19')],'include':_0x3ba30e[_0x5fa2('0x1b')]?_['map'](_0x3ba30e[_0x5fa2('0x1b')],function(_0x5e7419){return{'model':db[_0x5e7419[_0x5fa2('0x1d')]],'as':_0x5e7419['as'],'attributes':_0x5e7419['attributes']};}):[]};}):[]};}):[]:[]})[_0x5fa2('0x1e')](function(_0x2e9614){logger['info'](_0x5fa2('0x20'),_0xc5a40c);logger[_0x5fa2('0xd')](_0x5fa2('0x20'),_0xc5a40c,JSON[_0x5fa2('0xe')](_0x2e9614));_0x22f054(_0x2e9614);})[_0x5fa2('0x1f')](function(_0x2e0a26){logger[_0x5fa2('0xf')](_0x5fa2('0x20'),_0x2e0a26[_0x5fa2('0x11')],_0xc5a40c);_0x3d1d41(_0x5a0d50[_0x5fa2('0xf')](0x1f4,_0x2e0a26[_0x5fa2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d145b8d..1799d7b 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 _0x5e39=['/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intZohoConfiguration.controller','get'];(function(_0x30c777,_0x50717d){var _0x443511=function(_0x2e7da2){while(--_0x2e7da2){_0x30c777['push'](_0x30c777['shift']());}};_0x443511(++_0x50717d);}(_0x5e39,0x195));var _0x95e3=function(_0x102635,_0x65edc){_0x102635=_0x102635-0x0;var _0x28eddc=_0x5e39[_0x102635];return _0x28eddc;};'use strict';var multer=require('multer');var util=require(_0x95e3('0x0'));var path=require(_0x95e3('0x1'));var timeout=require(_0x95e3('0x2'));var express=require(_0x95e3('0x3'));var router=express[_0x95e3('0x4')]();var fs_extra=require(_0x95e3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x95e3('0x6'));var config=require('../../config/environment');var controller=require(_0x95e3('0x7'));router[_0x95e3('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x95e3('0x9'),auth[_0x95e3('0xa')](),controller[_0x95e3('0xb')]);router[_0x95e3('0x8')](_0x95e3('0xc'),auth[_0x95e3('0xa')](),controller['getFields']);router[_0x95e3('0x8')](_0x95e3('0xd'),auth['isAuthenticated'](),controller[_0x95e3('0xe')]);router[_0x95e3('0x8')](_0x95e3('0xf'),auth['isAuthenticated'](),controller[_0x95e3('0x10')]);router[_0x95e3('0x11')]('/',auth[_0x95e3('0xa')](),controller[_0x95e3('0x12')]);router[_0x95e3('0x13')](_0x95e3('0x9'),auth[_0x95e3('0xa')](),controller[_0x95e3('0x14')]);router['delete'](_0x95e3('0x9'),auth[_0x95e3('0xa')](),controller[_0x95e3('0x15')]);module[_0x95e3('0x16')]=router; \ No newline at end of file +var _0xafe0=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x1bfa3d,_0x35eff7){var _0x4f12c1=function(_0x53000c){while(--_0x53000c){_0x1bfa3d['push'](_0x1bfa3d['shift']());}};_0x4f12c1(++_0x35eff7);}(_0xafe0,0x89));var _0x0afe=function(_0x2ae5ce,_0x481760){_0x2ae5ce=_0x2ae5ce-0x0;var _0x3ccd3c=_0xafe0[_0x2ae5ce];return _0x3ccd3c;};'use strict';var multer=require(_0x0afe('0x0'));var util=require(_0x0afe('0x1'));var path=require(_0x0afe('0x2'));var timeout=require(_0x0afe('0x3'));var express=require('express');var router=express[_0x0afe('0x4')]();var fs_extra=require(_0x0afe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0afe('0x6'));var config=require(_0x0afe('0x7'));var controller=require(_0x0afe('0x8'));router[_0x0afe('0x9')]('/',auth[_0x0afe('0xa')](),controller[_0x0afe('0xb')]);router['get']('/:id',auth[_0x0afe('0xa')](),controller[_0x0afe('0xc')]);router[_0x0afe('0x9')](_0x0afe('0xd'),auth[_0x0afe('0xa')](),controller[_0x0afe('0xe')]);router[_0x0afe('0x9')](_0x0afe('0xf'),auth[_0x0afe('0xa')](),controller[_0x0afe('0x10')]);router[_0x0afe('0x9')](_0x0afe('0x11'),auth[_0x0afe('0xa')](),controller[_0x0afe('0x12')]);router['post']('/',auth[_0x0afe('0xa')](),controller['create']);router[_0x0afe('0x13')](_0x0afe('0x14'),auth[_0x0afe('0xa')](),controller[_0x0afe('0x15')]);router[_0x0afe('0x16')](_0x0afe('0x14'),auth[_0x0afe('0xa')](),controller[_0x0afe('0x17')]);module[_0x0afe('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 36b48ca..1d1f4c2 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 _0x406a=['contact_lead','sequelize','STRING','ENUM','lead','contact','nothing'];(function(_0xbfaa32,_0x5d898c){var _0x139c82=function(_0x19b2c9){while(--_0x19b2c9){_0xbfaa32['push'](_0xbfaa32['shift']());}};_0x139c82(++_0x5d898c);}(_0x406a,0xfd));var _0xa406=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x406a[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0xa406('0x0'));module['exports']={'name':{'type':Sequelize[_0xa406('0x1')]},'moduleCreate':{'type':Sequelize[_0xa406('0x2')](_0xa406('0x3'),_0xa406('0x4'),_0xa406('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa406('0x2')]('contact_lead','contact',_0xa406('0x3')),'defaultValue':_0xa406('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf352=['nothing','lead','ENUM','contact_lead','sequelize','exports','STRING','contact'];(function(_0x474e9f,_0x1e0ed3){var _0xda7b70=function(_0x241ceb){while(--_0x241ceb){_0x474e9f['push'](_0x474e9f['shift']());}};_0xda7b70(++_0x1e0ed3);}(_0xf352,0x1ac));var _0x2f35=function(_0x26f669,_0x3983d7){_0x26f669=_0x26f669-0x0;var _0x1bead5=_0xf352[_0x26f669];return _0x1bead5;};'use strict';var Sequelize=require(_0x2f35('0x0'));module[_0x2f35('0x1')]={'name':{'type':Sequelize[_0x2f35('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0x2f35('0x3'),_0x2f35('0x4')),'defaultValue':_0x2f35('0x5')},'moduleSearch':{'type':Sequelize[_0x2f35('0x6')](_0x2f35('0x7'),_0x2f35('0x3'),_0x2f35('0x5')),'defaultValue':_0x2f35('0x7')},'description':{'type':Sequelize[_0x2f35('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 9a22a28..7233db8 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 _0x8010=['querystring','papaparse','ioredis','../../components/auth/service','../../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','reject','save','update','then','error','name','index','map','ZohoConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','include','options','find','body','findOne','ZohoField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x179291,_0x63102c){var _0x3fa7c1=function(_0x247208){while(--_0x247208){_0x179291['push'](_0x179291['shift']());}};_0x3fa7c1(++_0x63102c);}(_0x8010,0x1d1));var _0x0801=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8010[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0801('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0801('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0801('0x2'));var BPromise=require(_0x0801('0x3'));var Mustache=require(_0x0801('0x4'));var util=require('util');var path=require(_0x0801('0x5'));var sox=require(_0x0801('0x6'));var csv=require('to-csv');var ejs=require(_0x0801('0x7'));var fs=require('fs');var fs_extra=require(_0x0801('0x8'));var _=require(_0x0801('0x9'));var squel=require(_0x0801('0xa'));var crypto=require(_0x0801('0xb'));var jsforce=require(_0x0801('0xc'));var deskjs=require(_0x0801('0xd'));var toCsv=require(_0x0801('0xe'));var querystring=require(_0x0801('0xf'));var Papa=require(_0x0801('0x10'));var Redis=require(_0x0801('0x11'));var authService=require(_0x0801('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0801('0x13'));var hardwareService=require(_0x0801('0x14'));var logger=require(_0x0801('0x15'))(_0x0801('0x16'));var utils=require(_0x0801('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0801('0x18'));var db=require(_0x0801('0x19'))['db'];function respondWithStatusCode(_0x1904d8,_0x51f1cf){_0x51f1cf=_0x51f1cf||0xcc;return function(_0x17a4e7){if(_0x17a4e7){return _0x1904d8[_0x0801('0x1a')](_0x51f1cf);}return _0x1904d8[_0x0801('0x1b')](_0x51f1cf)[_0x0801('0x1c')]();};}function respondWithResult(_0x1a4e17,_0x53dac5){_0x53dac5=_0x53dac5||0xc8;return function(_0xd27b73){if(_0xd27b73){return _0x1a4e17[_0x0801('0x1b')](_0x53dac5)[_0x0801('0x1d')](_0xd27b73);}};}function respondWithFilteredResult(_0x50cf66,_0x43d5db){return function(_0x26f137){if(_0x26f137){var _0x38f3e6=typeof _0x43d5db[_0x0801('0x1e')]===_0x0801('0x1f')&&typeof _0x43d5db[_0x0801('0x20')]===_0x0801('0x1f');var _0x10e326=_0x26f137[_0x0801('0x21')];var _0x37cdeb=_0x38f3e6?0x0:_0x43d5db[_0x0801('0x1e')];var _0xe11524=_0x38f3e6?_0x26f137[_0x0801('0x21')]:_0x43d5db[_0x0801('0x1e')]+_0x43d5db[_0x0801('0x20')];var _0x4396ac;if(_0xe11524>=_0x10e326){_0xe11524=_0x10e326;_0x4396ac=0xc8;}else{_0x4396ac=0xce;}_0x50cf66['status'](_0x4396ac);return _0x50cf66[_0x0801('0x22')](_0x0801('0x23'),_0x37cdeb+'-'+_0xe11524+'/'+_0x10e326)[_0x0801('0x1d')](_0x26f137);}return null;};}function patchUpdates(_0x325ebf){return function(_0x25e856){try{jsonpatch['apply'](_0x25e856,_0x325ebf,!![]);}catch(_0x1fdc9a){return BPromise[_0x0801('0x24')](_0x1fdc9a);}return _0x25e856[_0x0801('0x25')]();};}function saveUpdates(_0x42e360,_0xc2724){return function(_0x565b44){if(_0x565b44){return _0x565b44[_0x0801('0x26')](_0x42e360)[_0x0801('0x27')](function(_0xd5e975){return _0xd5e975;});}return null;};}function removeEntity(_0x266c0a,_0x2021d7){return function(_0x1a04e9){if(_0x1a04e9){return _0x1a04e9['destroy']()[_0x0801('0x27')](function(){_0x266c0a[_0x0801('0x1b')](0xcc)[_0x0801('0x1c')]();});}};}function handleEntityNotFound(_0x4fe5b4,_0x430746){return function(_0x5cf081){if(!_0x5cf081){_0x4fe5b4[_0x0801('0x1a')](0x194);}return _0x5cf081;};}function handleError(_0x2b31a6,_0x43f577){_0x43f577=_0x43f577||0x1f4;return function(_0x2900ac){logger[_0x0801('0x28')](_0x2900ac['stack']);if(_0x2900ac[_0x0801('0x29')]){delete _0x2900ac[_0x0801('0x29')];}_0x2b31a6['status'](_0x43f577)['send'](_0x2900ac);};}exports[_0x0801('0x2a')]=function(_0x5466c2,_0x42b733){var _0x9a7c7={},_0x20c5e4={},_0x52653f={'count':0x0,'rows':[]};var _0x311f32=_[_0x0801('0x2b')](db[_0x0801('0x2c')][_0x0801('0x2d')],function(_0xe629f1){return{'name':_0xe629f1[_0x0801('0x2e')],'type':_0xe629f1['type']['key']};});_0x20c5e4[_0x0801('0x2f')]=_['map'](_0x311f32,_0x0801('0x29'));_0x20c5e4[_0x0801('0x30')]=_[_0x0801('0x31')](_0x5466c2[_0x0801('0x30')]);_0x20c5e4[_0x0801('0x32')]=_[_0x0801('0x33')](_0x20c5e4[_0x0801('0x2f')],_0x20c5e4[_0x0801('0x30')]);_0x9a7c7[_0x0801('0x34')]=_[_0x0801('0x33')](_0x20c5e4[_0x0801('0x2f')],qs[_0x0801('0x35')](_0x5466c2[_0x0801('0x30')][_0x0801('0x35')]));_0x9a7c7[_0x0801('0x34')]=_0x9a7c7[_0x0801('0x34')][_0x0801('0x36')]?_0x9a7c7[_0x0801('0x34')]:_0x20c5e4[_0x0801('0x2f')];if(!_0x5466c2[_0x0801('0x30')][_0x0801('0x37')](_0x0801('0x38'))){_0x9a7c7[_0x0801('0x20')]=qs[_0x0801('0x20')](_0x5466c2['query'][_0x0801('0x20')]);_0x9a7c7['offset']=qs[_0x0801('0x1e')](_0x5466c2[_0x0801('0x30')][_0x0801('0x1e')]);}_0x9a7c7[_0x0801('0x39')]=qs[_0x0801('0x3a')](_0x5466c2['query']['sort']);_0x9a7c7[_0x0801('0x3b')]=qs[_0x0801('0x32')](_[_0x0801('0x3c')](_0x5466c2['query'],_0x20c5e4[_0x0801('0x32')]),_0x311f32);if(_0x5466c2[_0x0801('0x30')]['filter']){_0x9a7c7[_0x0801('0x3b')]=_[_0x0801('0x3d')](_0x9a7c7[_0x0801('0x3b')],{'$or':_[_0x0801('0x2b')](_0x311f32,function(_0x22771c){if(_0x22771c[_0x0801('0x3e')]!==_0x0801('0x3f')){var _0x15c3b1={};_0x15c3b1[_0x22771c['name']]={'$like':'%'+_0x5466c2[_0x0801('0x30')][_0x0801('0x40')]+'%'};return _0x15c3b1;}})});}_0x9a7c7=_[_0x0801('0x3d')]({},_0x9a7c7,_0x5466c2['options']);var _0x449ee={'where':_0x9a7c7[_0x0801('0x3b')]};return db[_0x0801('0x2c')][_0x0801('0x21')](_0x449ee)[_0x0801('0x27')](function(_0x376997){_0x52653f[_0x0801('0x21')]=_0x376997;if(_0x5466c2[_0x0801('0x30')][_0x0801('0x41')]){_0x9a7c7['include']=[{'all':!![]}];}return db[_0x0801('0x2c')][_0x0801('0x42')](_0x9a7c7);})[_0x0801('0x27')](function(_0x97359f){_0x52653f[_0x0801('0x43')]=_0x97359f;return _0x52653f;})[_0x0801('0x27')](respondWithFilteredResult(_0x42b733,_0x9a7c7))[_0x0801('0x44')](handleError(_0x42b733,null));};exports[_0x0801('0x45')]=function(_0x2933b0,_0x4ae7c2){var _0x32e2b3={'raw':![],'where':{'id':_0x2933b0[_0x0801('0x46')]['id']}},_0x95ebf1={};_0x95ebf1[_0x0801('0x2f')]=_[_0x0801('0x31')](db[_0x0801('0x2c')][_0x0801('0x2d')]);_0x95ebf1['query']=_[_0x0801('0x31')](_0x2933b0[_0x0801('0x30')]);_0x95ebf1[_0x0801('0x32')]=_[_0x0801('0x33')](_0x95ebf1[_0x0801('0x2f')],_0x95ebf1[_0x0801('0x30')]);_0x32e2b3[_0x0801('0x34')]=_[_0x0801('0x33')](_0x95ebf1[_0x0801('0x2f')],qs[_0x0801('0x35')](_0x2933b0[_0x0801('0x30')][_0x0801('0x35')]));_0x32e2b3[_0x0801('0x34')]=_0x32e2b3[_0x0801('0x34')][_0x0801('0x36')]?_0x32e2b3[_0x0801('0x34')]:_0x95ebf1[_0x0801('0x2f')];if(_0x2933b0[_0x0801('0x30')][_0x0801('0x41')]){_0x32e2b3[_0x0801('0x47')]=[{'all':!![]}];}_0x32e2b3=_[_0x0801('0x3d')]({},_0x32e2b3,_0x2933b0[_0x0801('0x48')]);return db['ZohoConfiguration'][_0x0801('0x49')](_0x32e2b3)[_0x0801('0x27')](handleEntityNotFound(_0x4ae7c2,null))[_0x0801('0x27')](respondWithResult(_0x4ae7c2,null))[_0x0801('0x44')](handleError(_0x4ae7c2,null));};exports['create']=function(_0x42d3d8,_0x11e5c1){return db[_0x0801('0x2c')]['create'](_0x42d3d8[_0x0801('0x4a')],{})[_0x0801('0x27')](respondWithResult(_0x11e5c1,0xc9))[_0x0801('0x44')](handleError(_0x11e5c1,null));};exports[_0x0801('0x26')]=function(_0x59ea5a,_0x43bf62){if(_0x59ea5a['body']['id']){delete _0x59ea5a[_0x0801('0x4a')]['id'];}return db['ZohoConfiguration'][_0x0801('0x49')]({'where':{'id':_0x59ea5a[_0x0801('0x46')]['id']}})[_0x0801('0x27')](handleEntityNotFound(_0x43bf62,null))[_0x0801('0x27')](saveUpdates(_0x59ea5a[_0x0801('0x4a')],null))[_0x0801('0x27')](respondWithResult(_0x43bf62,null))['catch'](handleError(_0x43bf62,null));};exports['destroy']=function(_0x34a167,_0x304f5f){return db[_0x0801('0x2c')]['find']({'where':{'id':_0x34a167['params']['id']}})['then'](handleEntityNotFound(_0x304f5f,null))[_0x0801('0x27')](removeEntity(_0x304f5f,null))[_0x0801('0x44')](handleError(_0x304f5f,null));};exports['getFields']=function(_0x2736cd,_0x46e6a1,_0x260e77){var _0x3d8612={};var _0x571c9e={};var _0x300af4;var _0x3db56a;return db[_0x0801('0x2c')][_0x0801('0x4b')]({'where':{'id':_0x2736cd[_0x0801('0x46')]['id']}})[_0x0801('0x27')](handleEntityNotFound(_0x46e6a1,null))[_0x0801('0x27')](function(_0x10355d){if(_0x10355d){_0x300af4=_0x10355d;_0x571c9e['model']=_['keys'](db[_0x0801('0x4c')][_0x0801('0x2d')]);_0x571c9e[_0x0801('0x30')]=_['keys'](_0x2736cd[_0x0801('0x30')]);_0x571c9e[_0x0801('0x32')]=_[_0x0801('0x33')](_0x571c9e[_0x0801('0x2f')],_0x571c9e[_0x0801('0x30')]);_0x3d8612['attributes']=_[_0x0801('0x33')](_0x571c9e[_0x0801('0x2f')],qs[_0x0801('0x35')](_0x2736cd['query'][_0x0801('0x35')]));_0x3d8612[_0x0801('0x34')]=_0x3d8612[_0x0801('0x34')][_0x0801('0x36')]?_0x3d8612['attributes']:_0x571c9e[_0x0801('0x2f')];_0x3d8612[_0x0801('0x39')]=qs[_0x0801('0x3a')](_0x2736cd[_0x0801('0x30')][_0x0801('0x3a')]);_0x3d8612['where']=qs[_0x0801('0x32')](_[_0x0801('0x3c')](_0x2736cd[_0x0801('0x30')],_0x571c9e[_0x0801('0x32')]));if(_0x2736cd['query']['filter']){_0x3d8612['where']=_[_0x0801('0x3d')](_0x3d8612[_0x0801('0x3b')],{'$or':_[_0x0801('0x2b')](_0x3d8612[_0x0801('0x34')],function(_0x505f74){var _0x4bbc6b={};_0x4bbc6b[_0x505f74]={'$like':'%'+_0x2736cd['query'][_0x0801('0x40')]+'%'};return _0x4bbc6b;})});}_0x3d8612=_[_0x0801('0x3d')]({},_0x3d8612,_0x2736cd['options']);return _0x300af4[_0x0801('0x4d')](_0x3d8612);}})[_0x0801('0x27')](function(_0x17b831){if(_0x17b831){_0x3db56a=_0x17b831[_0x0801('0x36')];if(!_0x2736cd['query'][_0x0801('0x37')](_0x0801('0x38'))){_0x3d8612[_0x0801('0x20')]=qs[_0x0801('0x20')](_0x2736cd['query'][_0x0801('0x20')]);_0x3d8612[_0x0801('0x1e')]=qs[_0x0801('0x1e')](_0x2736cd['query'][_0x0801('0x1e')]);}return _0x300af4[_0x0801('0x4d')](_0x3d8612);}})[_0x0801('0x27')](function(_0x3277fc){if(_0x3277fc){return _0x3277fc?{'count':_0x3db56a,'rows':_0x3277fc}:null;}})[_0x0801('0x27')](respondWithResult(_0x46e6a1,null))[_0x0801('0x44')](handleError(_0x46e6a1,null));};exports['getSubjects']=function(_0x5550b1,_0x277679,_0x360521){var _0x2fb84a={};var _0x138655={};var _0x3646b3;var _0x102287;return db[_0x0801('0x2c')][_0x0801('0x4b')]({'where':{'id':_0x5550b1['params']['id']}})[_0x0801('0x27')](handleEntityNotFound(_0x277679,null))[_0x0801('0x27')](function(_0x36f623){if(_0x36f623){_0x3646b3=_0x36f623;_0x138655[_0x0801('0x2f')]=_[_0x0801('0x31')](db[_0x0801('0x4c')][_0x0801('0x2d')]);_0x138655[_0x0801('0x30')]=_[_0x0801('0x31')](_0x5550b1[_0x0801('0x30')]);_0x138655[_0x0801('0x32')]=_[_0x0801('0x33')](_0x138655[_0x0801('0x2f')],_0x138655[_0x0801('0x30')]);_0x2fb84a['attributes']=_[_0x0801('0x33')](_0x138655[_0x0801('0x2f')],qs['fields'](_0x5550b1[_0x0801('0x30')][_0x0801('0x35')]));_0x2fb84a['attributes']=_0x2fb84a[_0x0801('0x34')][_0x0801('0x36')]?_0x2fb84a[_0x0801('0x34')]:_0x138655[_0x0801('0x2f')];_0x2fb84a['order']=qs[_0x0801('0x3a')](_0x5550b1[_0x0801('0x30')][_0x0801('0x3a')]);_0x2fb84a[_0x0801('0x3b')]=qs[_0x0801('0x32')](_[_0x0801('0x3c')](_0x5550b1['query'],_0x138655['filters']));if(_0x5550b1[_0x0801('0x30')][_0x0801('0x40')]){_0x2fb84a['where']=_[_0x0801('0x3d')](_0x2fb84a[_0x0801('0x3b')],{'$or':_['map'](_0x2fb84a['attributes'],function(_0x35fb51){var _0x357d10={};_0x357d10[_0x35fb51]={'$like':'%'+_0x5550b1[_0x0801('0x30')][_0x0801('0x40')]+'%'};return _0x357d10;})});}_0x2fb84a=_[_0x0801('0x3d')]({},_0x2fb84a,_0x5550b1[_0x0801('0x48')]);return _0x3646b3[_0x0801('0x4e')](_0x2fb84a);}})['then'](function(_0x16ff4d){if(_0x16ff4d){_0x102287=_0x16ff4d[_0x0801('0x36')];if(!_0x5550b1[_0x0801('0x30')]['hasOwnProperty']('nolimit')){_0x2fb84a[_0x0801('0x20')]=qs[_0x0801('0x20')](_0x5550b1['query']['limit']);_0x2fb84a[_0x0801('0x1e')]=qs[_0x0801('0x1e')](_0x5550b1[_0x0801('0x30')][_0x0801('0x1e')]);}return _0x3646b3[_0x0801('0x4e')](_0x2fb84a);}})[_0x0801('0x27')](function(_0x450dd7){if(_0x450dd7){return _0x450dd7?{'count':_0x102287,'rows':_0x450dd7}:null;}})[_0x0801('0x27')](respondWithResult(_0x277679,null))[_0x0801('0x44')](handleError(_0x277679,null));};exports[_0x0801('0x4f')]=function(_0x4cfc52,_0x2cc59b,_0x4c3d94){var _0x1440d1={};var _0x5baa5e={};var _0x3ae962;var _0x52001f;return db['ZohoConfiguration'][_0x0801('0x4b')]({'where':{'id':_0x4cfc52[_0x0801('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cc59b,null))[_0x0801('0x27')](function(_0x2a24d8){if(_0x2a24d8){_0x3ae962=_0x2a24d8;_0x5baa5e[_0x0801('0x2f')]=_[_0x0801('0x31')](db[_0x0801('0x4c')][_0x0801('0x2d')]);_0x5baa5e[_0x0801('0x30')]=_[_0x0801('0x31')](_0x4cfc52['query']);_0x5baa5e[_0x0801('0x32')]=_[_0x0801('0x33')](_0x5baa5e[_0x0801('0x2f')],_0x5baa5e['query']);_0x1440d1['attributes']=_['intersection'](_0x5baa5e[_0x0801('0x2f')],qs['fields'](_0x4cfc52[_0x0801('0x30')][_0x0801('0x35')]));_0x1440d1[_0x0801('0x34')]=_0x1440d1[_0x0801('0x34')][_0x0801('0x36')]?_0x1440d1[_0x0801('0x34')]:_0x5baa5e[_0x0801('0x2f')];_0x1440d1[_0x0801('0x39')]=qs[_0x0801('0x3a')](_0x4cfc52[_0x0801('0x30')][_0x0801('0x3a')]);_0x1440d1[_0x0801('0x3b')]=qs[_0x0801('0x32')](_[_0x0801('0x3c')](_0x4cfc52[_0x0801('0x30')],_0x5baa5e['filters']));if(_0x4cfc52[_0x0801('0x30')][_0x0801('0x40')]){_0x1440d1['where']=_['merge'](_0x1440d1['where'],{'$or':_[_0x0801('0x2b')](_0x1440d1[_0x0801('0x34')],function(_0x2e5f0e){var _0x4d35f1={};_0x4d35f1[_0x2e5f0e]={'$like':'%'+_0x4cfc52['query'][_0x0801('0x40')]+'%'};return _0x4d35f1;})});}_0x1440d1=_[_0x0801('0x3d')]({},_0x1440d1,_0x4cfc52[_0x0801('0x48')]);return _0x3ae962['getDescriptions'](_0x1440d1);}})[_0x0801('0x27')](function(_0x55a1c5){if(_0x55a1c5){_0x52001f=_0x55a1c5[_0x0801('0x36')];if(!_0x4cfc52[_0x0801('0x30')][_0x0801('0x37')](_0x0801('0x38'))){_0x1440d1[_0x0801('0x20')]=qs[_0x0801('0x20')](_0x4cfc52['query'][_0x0801('0x20')]);_0x1440d1['offset']=qs[_0x0801('0x1e')](_0x4cfc52[_0x0801('0x30')][_0x0801('0x1e')]);}return _0x3ae962[_0x0801('0x4f')](_0x1440d1);}})[_0x0801('0x27')](function(_0x511f26){if(_0x511f26){return _0x511f26?{'count':_0x52001f,'rows':_0x511f26}:null;}})[_0x0801('0x27')](respondWithResult(_0x2cc59b,null))[_0x0801('0x44')](handleError(_0x2cc59b,null));}; \ No newline at end of file +var _0xbb78=['getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','catch','params','includeAll','find','create','body','getFields','findOne','ZohoField'];(function(_0x2bc1bf,_0x15c2a4){var _0x1f221c=function(_0x19b0eb){while(--_0x19b0eb){_0x2bc1bf['push'](_0x2bc1bf['shift']());}};_0x1f221c(++_0x15c2a4);}(_0xbb78,0xf2));var _0x8bb7=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xbb78[_0x17b6e3];return _0x3906f3;};'use strict';var emlformat=require(_0x8bb7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bb7('0x1'));var jsonpatch=require(_0x8bb7('0x2'));var rp=require(_0x8bb7('0x3'));var moment=require(_0x8bb7('0x4'));var BPromise=require(_0x8bb7('0x5'));var Mustache=require(_0x8bb7('0x6'));var util=require(_0x8bb7('0x7'));var path=require(_0x8bb7('0x8'));var sox=require(_0x8bb7('0x9'));var csv=require(_0x8bb7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bb7('0xb'));var _=require(_0x8bb7('0xc'));var squel=require(_0x8bb7('0xd'));var crypto=require('crypto');var jsforce=require(_0x8bb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8bb7('0xf'));var Papa=require(_0x8bb7('0x10'));var Redis=require(_0x8bb7('0x11'));var authService=require(_0x8bb7('0x12'));var qs=require(_0x8bb7('0x13'));var as=require(_0x8bb7('0x14'));var hardwareService=require(_0x8bb7('0x15'));var logger=require(_0x8bb7('0x16'))(_0x8bb7('0x17'));var utils=require(_0x8bb7('0x18'));var config=require(_0x8bb7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8bb7('0x1a'))['db'];function respondWithStatusCode(_0x336210,_0x284ae8){_0x284ae8=_0x284ae8||0xcc;return function(_0x5dee73){if(_0x5dee73){return _0x336210[_0x8bb7('0x1b')](_0x284ae8);}return _0x336210[_0x8bb7('0x1c')](_0x284ae8)['end']();};}function respondWithResult(_0x11b2f9,_0x2ca909){_0x2ca909=_0x2ca909||0xc8;return function(_0x37a5d5){if(_0x37a5d5){return _0x11b2f9[_0x8bb7('0x1c')](_0x2ca909)[_0x8bb7('0x1d')](_0x37a5d5);}};}function respondWithFilteredResult(_0x521e15,_0x5e803e){return function(_0x37791a){if(_0x37791a){var _0x16903d=typeof _0x5e803e[_0x8bb7('0x1e')]===_0x8bb7('0x1f')&&typeof _0x5e803e[_0x8bb7('0x20')]===_0x8bb7('0x1f');var _0x29de17=_0x37791a[_0x8bb7('0x21')];var _0x22bdce=_0x16903d?0x0:_0x5e803e[_0x8bb7('0x1e')];var _0x27ca46=_0x16903d?_0x37791a[_0x8bb7('0x21')]:_0x5e803e[_0x8bb7('0x1e')]+_0x5e803e[_0x8bb7('0x20')];var _0x221e2d;if(_0x27ca46>=_0x29de17){_0x27ca46=_0x29de17;_0x221e2d=0xc8;}else{_0x221e2d=0xce;}_0x521e15[_0x8bb7('0x1c')](_0x221e2d);return _0x521e15[_0x8bb7('0x22')](_0x8bb7('0x23'),_0x22bdce+'-'+_0x27ca46+'/'+_0x29de17)[_0x8bb7('0x1d')](_0x37791a);}return null;};}function patchUpdates(_0x343080){return function(_0x4799ac){try{jsonpatch['apply'](_0x4799ac,_0x343080,!![]);}catch(_0x2c0a4b){return BPromise[_0x8bb7('0x24')](_0x2c0a4b);}return _0x4799ac[_0x8bb7('0x25')]();};}function saveUpdates(_0x3b744d,_0x2360fc){return function(_0x280e5d){if(_0x280e5d){return _0x280e5d[_0x8bb7('0x26')](_0x3b744d)[_0x8bb7('0x27')](function(_0x577a25){return _0x577a25;});}return null;};}function removeEntity(_0x14d399,_0xed2d84){return function(_0x172caa){if(_0x172caa){return _0x172caa[_0x8bb7('0x28')]()[_0x8bb7('0x27')](function(){_0x14d399['status'](0xcc)[_0x8bb7('0x29')]();});}};}function handleEntityNotFound(_0x3a5f42,_0x180828){return function(_0x526906){if(!_0x526906){_0x3a5f42['sendStatus'](0x194);}return _0x526906;};}function handleError(_0x5c263e,_0x1136da){_0x1136da=_0x1136da||0x1f4;return function(_0x1a6c4d){logger[_0x8bb7('0x2a')](_0x1a6c4d[_0x8bb7('0x2b')]);if(_0x1a6c4d['name']){delete _0x1a6c4d[_0x8bb7('0x2c')];}_0x5c263e[_0x8bb7('0x1c')](_0x1136da)['send'](_0x1a6c4d);};}exports[_0x8bb7('0x2d')]=function(_0x25fb8b,_0x9e5ba4){var _0xa3b2ca={},_0x938d22={},_0x2fdb71={'count':0x0,'rows':[]};var _0x54fc6d=_[_0x8bb7('0x2e')](db[_0x8bb7('0x2f')][_0x8bb7('0x30')],function(_0x146911){return{'name':_0x146911[_0x8bb7('0x31')],'type':_0x146911[_0x8bb7('0x32')]['key']};});_0x938d22[_0x8bb7('0x33')]=_[_0x8bb7('0x2e')](_0x54fc6d,'name');_0x938d22['query']=_[_0x8bb7('0x34')](_0x25fb8b['query']);_0x938d22[_0x8bb7('0x35')]=_[_0x8bb7('0x36')](_0x938d22[_0x8bb7('0x33')],_0x938d22[_0x8bb7('0x37')]);_0xa3b2ca[_0x8bb7('0x38')]=_[_0x8bb7('0x36')](_0x938d22['model'],qs[_0x8bb7('0x39')](_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x39')]));_0xa3b2ca[_0x8bb7('0x38')]=_0xa3b2ca['attributes'][_0x8bb7('0x3a')]?_0xa3b2ca[_0x8bb7('0x38')]:_0x938d22[_0x8bb7('0x33')];if(!_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x3b')](_0x8bb7('0x3c'))){_0xa3b2ca[_0x8bb7('0x20')]=qs[_0x8bb7('0x20')](_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x20')]);_0xa3b2ca[_0x8bb7('0x1e')]=qs['offset'](_0x25fb8b['query'][_0x8bb7('0x1e')]);}_0xa3b2ca[_0x8bb7('0x3d')]=qs['sort'](_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x3e')]);_0xa3b2ca[_0x8bb7('0x3f')]=qs[_0x8bb7('0x35')](_[_0x8bb7('0x40')](_0x25fb8b[_0x8bb7('0x37')],_0x938d22['filters']),_0x54fc6d);if(_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x41')]){_0xa3b2ca[_0x8bb7('0x3f')]=_[_0x8bb7('0x42')](_0xa3b2ca[_0x8bb7('0x3f')],{'$or':_[_0x8bb7('0x2e')](_0x54fc6d,function(_0xe56024){if(_0xe56024[_0x8bb7('0x32')]!=='VIRTUAL'){var _0x56b759={};_0x56b759[_0xe56024[_0x8bb7('0x2c')]]={'$like':'%'+_0x25fb8b[_0x8bb7('0x37')][_0x8bb7('0x41')]+'%'};return _0x56b759;}})});}_0xa3b2ca=_[_0x8bb7('0x42')]({},_0xa3b2ca,_0x25fb8b[_0x8bb7('0x43')]);var _0x407473={'where':_0xa3b2ca[_0x8bb7('0x3f')]};return db['ZohoConfiguration'][_0x8bb7('0x21')](_0x407473)[_0x8bb7('0x27')](function(_0x32f07f){_0x2fdb71[_0x8bb7('0x21')]=_0x32f07f;if(_0x25fb8b[_0x8bb7('0x37')]['includeAll']){_0xa3b2ca[_0x8bb7('0x44')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0xa3b2ca);})['then'](function(_0x5c848b){_0x2fdb71['rows']=_0x5c848b;return _0x2fdb71;})[_0x8bb7('0x27')](respondWithFilteredResult(_0x9e5ba4,_0xa3b2ca))[_0x8bb7('0x45')](handleError(_0x9e5ba4,null));};exports['show']=function(_0xed2d35,_0x58ce98){var _0xb04e4f={'raw':![],'where':{'id':_0xed2d35[_0x8bb7('0x46')]['id']}},_0x2deda5={};_0x2deda5[_0x8bb7('0x33')]=_[_0x8bb7('0x34')](db['ZohoConfiguration'][_0x8bb7('0x30')]);_0x2deda5[_0x8bb7('0x37')]=_[_0x8bb7('0x34')](_0xed2d35[_0x8bb7('0x37')]);_0x2deda5[_0x8bb7('0x35')]=_[_0x8bb7('0x36')](_0x2deda5[_0x8bb7('0x33')],_0x2deda5['query']);_0xb04e4f['attributes']=_[_0x8bb7('0x36')](_0x2deda5['model'],qs[_0x8bb7('0x39')](_0xed2d35[_0x8bb7('0x37')][_0x8bb7('0x39')]));_0xb04e4f[_0x8bb7('0x38')]=_0xb04e4f[_0x8bb7('0x38')][_0x8bb7('0x3a')]?_0xb04e4f[_0x8bb7('0x38')]:_0x2deda5['model'];if(_0xed2d35[_0x8bb7('0x37')][_0x8bb7('0x47')]){_0xb04e4f[_0x8bb7('0x44')]=[{'all':!![]}];}_0xb04e4f=_[_0x8bb7('0x42')]({},_0xb04e4f,_0xed2d35['options']);return db[_0x8bb7('0x2f')][_0x8bb7('0x48')](_0xb04e4f)[_0x8bb7('0x27')](handleEntityNotFound(_0x58ce98,null))[_0x8bb7('0x27')](respondWithResult(_0x58ce98,null))[_0x8bb7('0x45')](handleError(_0x58ce98,null));};exports[_0x8bb7('0x49')]=function(_0x4db7e9,_0x38f4f9){return db[_0x8bb7('0x2f')]['create'](_0x4db7e9[_0x8bb7('0x4a')],{})['then'](respondWithResult(_0x38f4f9,0xc9))['catch'](handleError(_0x38f4f9,null));};exports[_0x8bb7('0x26')]=function(_0x4e7e2a,_0x2a1552){if(_0x4e7e2a[_0x8bb7('0x4a')]['id']){delete _0x4e7e2a[_0x8bb7('0x4a')]['id'];}return db[_0x8bb7('0x2f')][_0x8bb7('0x48')]({'where':{'id':_0x4e7e2a[_0x8bb7('0x46')]['id']}})['then'](handleEntityNotFound(_0x2a1552,null))[_0x8bb7('0x27')](saveUpdates(_0x4e7e2a[_0x8bb7('0x4a')],null))['then'](respondWithResult(_0x2a1552,null))[_0x8bb7('0x45')](handleError(_0x2a1552,null));};exports[_0x8bb7('0x28')]=function(_0x14f0f5,_0x553042){return db['ZohoConfiguration'][_0x8bb7('0x48')]({'where':{'id':_0x14f0f5[_0x8bb7('0x46')]['id']}})['then'](handleEntityNotFound(_0x553042,null))['then'](removeEntity(_0x553042,null))['catch'](handleError(_0x553042,null));};exports[_0x8bb7('0x4b')]=function(_0x22ae26,_0x5158ed,_0x144c72){var _0x10c02c={};var _0x329a39={};var _0x5cb88b;var _0x42daff;return db[_0x8bb7('0x2f')][_0x8bb7('0x4c')]({'where':{'id':_0x22ae26['params']['id']}})['then'](handleEntityNotFound(_0x5158ed,null))[_0x8bb7('0x27')](function(_0x216c78){if(_0x216c78){_0x5cb88b=_0x216c78;_0x329a39[_0x8bb7('0x33')]=_[_0x8bb7('0x34')](db[_0x8bb7('0x4d')][_0x8bb7('0x30')]);_0x329a39[_0x8bb7('0x37')]=_['keys'](_0x22ae26['query']);_0x329a39[_0x8bb7('0x35')]=_[_0x8bb7('0x36')](_0x329a39[_0x8bb7('0x33')],_0x329a39[_0x8bb7('0x37')]);_0x10c02c[_0x8bb7('0x38')]=_[_0x8bb7('0x36')](_0x329a39[_0x8bb7('0x33')],qs[_0x8bb7('0x39')](_0x22ae26['query'][_0x8bb7('0x39')]));_0x10c02c['attributes']=_0x10c02c[_0x8bb7('0x38')]['length']?_0x10c02c[_0x8bb7('0x38')]:_0x329a39[_0x8bb7('0x33')];_0x10c02c[_0x8bb7('0x3d')]=qs[_0x8bb7('0x3e')](_0x22ae26[_0x8bb7('0x37')][_0x8bb7('0x3e')]);_0x10c02c['where']=qs['filters'](_[_0x8bb7('0x40')](_0x22ae26['query'],_0x329a39[_0x8bb7('0x35')]));if(_0x22ae26['query']['filter']){_0x10c02c[_0x8bb7('0x3f')]=_[_0x8bb7('0x42')](_0x10c02c[_0x8bb7('0x3f')],{'$or':_['map'](_0x10c02c[_0x8bb7('0x38')],function(_0x5a1b2c){var _0x410626={};_0x410626[_0x5a1b2c]={'$like':'%'+_0x22ae26[_0x8bb7('0x37')][_0x8bb7('0x41')]+'%'};return _0x410626;})});}_0x10c02c=_['merge']({},_0x10c02c,_0x22ae26['options']);return _0x5cb88b[_0x8bb7('0x4b')](_0x10c02c);}})[_0x8bb7('0x27')](function(_0x3a90c3){if(_0x3a90c3){_0x42daff=_0x3a90c3[_0x8bb7('0x3a')];if(!_0x22ae26[_0x8bb7('0x37')][_0x8bb7('0x3b')](_0x8bb7('0x3c'))){_0x10c02c[_0x8bb7('0x20')]=qs[_0x8bb7('0x20')](_0x22ae26['query'][_0x8bb7('0x20')]);_0x10c02c[_0x8bb7('0x1e')]=qs['offset'](_0x22ae26[_0x8bb7('0x37')][_0x8bb7('0x1e')]);}return _0x5cb88b[_0x8bb7('0x4b')](_0x10c02c);}})[_0x8bb7('0x27')](function(_0x2beea1){if(_0x2beea1){return _0x2beea1?{'count':_0x42daff,'rows':_0x2beea1}:null;}})[_0x8bb7('0x27')](respondWithResult(_0x5158ed,null))[_0x8bb7('0x45')](handleError(_0x5158ed,null));};exports['getSubjects']=function(_0x43bf0f,_0x3b9545,_0x1f5c59){var _0x6e02b={};var _0x21afb6={};var _0x5d2d0a;var _0xb76a6b;return db['ZohoConfiguration'][_0x8bb7('0x4c')]({'where':{'id':_0x43bf0f[_0x8bb7('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b9545,null))[_0x8bb7('0x27')](function(_0x403a9b){if(_0x403a9b){_0x5d2d0a=_0x403a9b;_0x21afb6[_0x8bb7('0x33')]=_[_0x8bb7('0x34')](db[_0x8bb7('0x4d')]['rawAttributes']);_0x21afb6[_0x8bb7('0x37')]=_[_0x8bb7('0x34')](_0x43bf0f[_0x8bb7('0x37')]);_0x21afb6[_0x8bb7('0x35')]=_['intersection'](_0x21afb6[_0x8bb7('0x33')],_0x21afb6['query']);_0x6e02b[_0x8bb7('0x38')]=_[_0x8bb7('0x36')](_0x21afb6[_0x8bb7('0x33')],qs[_0x8bb7('0x39')](_0x43bf0f[_0x8bb7('0x37')][_0x8bb7('0x39')]));_0x6e02b[_0x8bb7('0x38')]=_0x6e02b['attributes'][_0x8bb7('0x3a')]?_0x6e02b[_0x8bb7('0x38')]:_0x21afb6['model'];_0x6e02b['order']=qs['sort'](_0x43bf0f['query'][_0x8bb7('0x3e')]);_0x6e02b['where']=qs[_0x8bb7('0x35')](_['pick'](_0x43bf0f[_0x8bb7('0x37')],_0x21afb6[_0x8bb7('0x35')]));if(_0x43bf0f[_0x8bb7('0x37')]['filter']){_0x6e02b[_0x8bb7('0x3f')]=_[_0x8bb7('0x42')](_0x6e02b[_0x8bb7('0x3f')],{'$or':_[_0x8bb7('0x2e')](_0x6e02b[_0x8bb7('0x38')],function(_0x13e3e6){var _0x4dd919={};_0x4dd919[_0x13e3e6]={'$like':'%'+_0x43bf0f[_0x8bb7('0x37')][_0x8bb7('0x41')]+'%'};return _0x4dd919;})});}_0x6e02b=_[_0x8bb7('0x42')]({},_0x6e02b,_0x43bf0f[_0x8bb7('0x43')]);return _0x5d2d0a[_0x8bb7('0x4e')](_0x6e02b);}})[_0x8bb7('0x27')](function(_0x268f24){if(_0x268f24){_0xb76a6b=_0x268f24[_0x8bb7('0x3a')];if(!_0x43bf0f[_0x8bb7('0x37')][_0x8bb7('0x3b')](_0x8bb7('0x3c'))){_0x6e02b[_0x8bb7('0x20')]=qs['limit'](_0x43bf0f[_0x8bb7('0x37')][_0x8bb7('0x20')]);_0x6e02b['offset']=qs[_0x8bb7('0x1e')](_0x43bf0f['query'][_0x8bb7('0x1e')]);}return _0x5d2d0a['getSubjects'](_0x6e02b);}})[_0x8bb7('0x27')](function(_0xb45047){if(_0xb45047){return _0xb45047?{'count':_0xb76a6b,'rows':_0xb45047}:null;}})[_0x8bb7('0x27')](respondWithResult(_0x3b9545,null))[_0x8bb7('0x45')](handleError(_0x3b9545,null));};exports['getDescriptions']=function(_0x162a55,_0x588728,_0x145143){var _0x47d6d9={};var _0x8603fe={};var _0x195935;var _0x3cafad;return db['ZohoConfiguration'][_0x8bb7('0x4c')]({'where':{'id':_0x162a55[_0x8bb7('0x46')]['id']}})[_0x8bb7('0x27')](handleEntityNotFound(_0x588728,null))['then'](function(_0x3d8381){if(_0x3d8381){_0x195935=_0x3d8381;_0x8603fe[_0x8bb7('0x33')]=_[_0x8bb7('0x34')](db[_0x8bb7('0x4d')]['rawAttributes']);_0x8603fe[_0x8bb7('0x37')]=_[_0x8bb7('0x34')](_0x162a55[_0x8bb7('0x37')]);_0x8603fe['filters']=_['intersection'](_0x8603fe[_0x8bb7('0x33')],_0x8603fe[_0x8bb7('0x37')]);_0x47d6d9[_0x8bb7('0x38')]=_[_0x8bb7('0x36')](_0x8603fe[_0x8bb7('0x33')],qs[_0x8bb7('0x39')](_0x162a55['query'][_0x8bb7('0x39')]));_0x47d6d9[_0x8bb7('0x38')]=_0x47d6d9[_0x8bb7('0x38')][_0x8bb7('0x3a')]?_0x47d6d9['attributes']:_0x8603fe[_0x8bb7('0x33')];_0x47d6d9[_0x8bb7('0x3d')]=qs[_0x8bb7('0x3e')](_0x162a55[_0x8bb7('0x37')][_0x8bb7('0x3e')]);_0x47d6d9[_0x8bb7('0x3f')]=qs[_0x8bb7('0x35')](_[_0x8bb7('0x40')](_0x162a55[_0x8bb7('0x37')],_0x8603fe['filters']));if(_0x162a55[_0x8bb7('0x37')]['filter']){_0x47d6d9[_0x8bb7('0x3f')]=_[_0x8bb7('0x42')](_0x47d6d9[_0x8bb7('0x3f')],{'$or':_[_0x8bb7('0x2e')](_0x47d6d9[_0x8bb7('0x38')],function(_0x302b26){var _0x163f4f={};_0x163f4f[_0x302b26]={'$like':'%'+_0x162a55[_0x8bb7('0x37')][_0x8bb7('0x41')]+'%'};return _0x163f4f;})});}_0x47d6d9=_['merge']({},_0x47d6d9,_0x162a55[_0x8bb7('0x43')]);return _0x195935[_0x8bb7('0x4f')](_0x47d6d9);}})[_0x8bb7('0x27')](function(_0x39c97c){if(_0x39c97c){_0x3cafad=_0x39c97c[_0x8bb7('0x3a')];if(!_0x162a55[_0x8bb7('0x37')][_0x8bb7('0x3b')]('nolimit')){_0x47d6d9[_0x8bb7('0x20')]=qs[_0x8bb7('0x20')](_0x162a55['query'][_0x8bb7('0x20')]);_0x47d6d9['offset']=qs[_0x8bb7('0x1e')](_0x162a55['query'][_0x8bb7('0x1e')]);}return _0x195935['getDescriptions'](_0x47d6d9);}})['then'](function(_0xf3c361){if(_0xf3c361){return _0xf3c361?{'count':_0x3cafad,'rows':_0xf3c361}:null;}})[_0x8bb7('0x27')](respondWithResult(_0x588728,null))[_0x8bb7('0x45')](handleError(_0x588728,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4b63d81..d402f43 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 _0x4fc7=['path','exports','ZohoConfiguration','util','moment','bluebird','request-promise'];(function(_0x1eb517,_0x19d104){var _0x3fa633=function(_0x136c0b){while(--_0x136c0b){_0x1eb517['push'](_0x1eb517['shift']());}};_0x3fa633(++_0x19d104);}(_0x4fc7,0x1a0));var _0x74fc=function(_0x2fff8b,_0x178b28){_0x2fff8b=_0x2fff8b-0x0;var _0x513899=_0x4fc7[_0x2fff8b];return _0x513899;};'use strict';var _=require('lodash');var util=require(_0x74fc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x74fc('0x1'));var BPromise=require(_0x74fc('0x2'));var rp=require(_0x74fc('0x3'));var fs=require('fs');var path=require(_0x74fc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x74fc('0x5')]=function(_0x2e7b96,_0x5749cf){return _0x2e7b96['define'](_0x74fc('0x6'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x406c=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment','bluebird','request-promise'];(function(_0x3c6417,_0x570bcf){var _0x281a6e=function(_0x12ea22){while(--_0x12ea22){_0x3c6417['push'](_0x3c6417['shift']());}};_0x281a6e(++_0x570bcf);}(_0x406c,0x6a));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc406('0x0'));var util=require(_0xc406('0x1'));var logger=require('../../config/logger')(_0xc406('0x2'));var moment=require(_0xc406('0x3'));var BPromise=require(_0xc406('0x4'));var rp=require(_0xc406('0x5'));var fs=require('fs');var path=require(_0xc406('0x6'));var rimraf=require(_0xc406('0x7'));var config=require(_0xc406('0x8'));var attributes=require(_0xc406('0x9'));module[_0xc406('0xa')]=function(_0xb9bee,_0x41573b){return _0xb9bee[_0xc406('0xb')](_0xc406('0xc'),attributes,{'tableName':_0xc406('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 5cfef38..779108b 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 _0xe1a9=['stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xe1a9,0x89));var _0x9e1a=function(_0x18087d,_0x46eddc){_0x18087d=_0x18087d-0x0;var _0x5d8b17=_0xe1a9[_0x18087d];return _0x5d8b17;};'use strict';var _=require(_0x9e1a('0x0'));var util=require('util');var moment=require(_0x9e1a('0x1'));var BPromise=require(_0x9e1a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e1a('0x3'))['db'];var utils=require(_0x9e1a('0x4'));var logger=require(_0x9e1a('0x5'))(_0x9e1a('0x6'));var config=require(_0x9e1a('0x7'));var jayson=require(_0x9e1a('0x8'));var client=jayson[_0x9e1a('0x9')][_0x9e1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53a8e2,_0x1fe781,_0x3ba72a){return new BPromise(function(_0x827e5c,_0xce876b){return client['request'](_0x53a8e2,_0x3ba72a)[_0x9e1a('0xb')](function(_0x4f2380){logger[_0x9e1a('0xc')](_0x9e1a('0xd'),_0x1fe781,_0x9e1a('0xe'));logger[_0x9e1a('0xf')](_0x9e1a('0x10'),_0x1fe781,_0x9e1a('0xe'),JSON[_0x9e1a('0x11')](_0x4f2380));if(_0x4f2380['error']){if(_0x4f2380[_0x9e1a('0x12')][_0x9e1a('0x13')]===0x1f4){logger[_0x9e1a('0x12')](_0x9e1a('0xd'),_0x1fe781,_0x4f2380[_0x9e1a('0x12')]['message']);return _0xce876b(_0x4f2380[_0x9e1a('0x12')][_0x9e1a('0x14')]);}logger[_0x9e1a('0x12')](_0x9e1a('0xd'),_0x1fe781,_0x4f2380[_0x9e1a('0x12')][_0x9e1a('0x14')]);return _0x827e5c(_0x4f2380[_0x9e1a('0x12')][_0x9e1a('0x14')]);}else{logger[_0x9e1a('0xc')](_0x9e1a('0xd'),_0x1fe781,_0x9e1a('0xe'));_0x827e5c(_0x4f2380['result'][_0x9e1a('0x14')]);}})[_0x9e1a('0x15')](function(_0x444dcc){logger['error'](_0x9e1a('0xd'),_0x1fe781,_0x444dcc);_0xce876b(_0x444dcc);});});} \ No newline at end of file +var _0x56f0=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','moment','bluebird'];(function(_0x45c53a,_0x1a9460){var _0xc8fca6=function(_0x14df4f){while(--_0x14df4f){_0x45c53a['push'](_0x45c53a['shift']());}};_0xc8fca6(++_0x1a9460);}(_0x56f0,0x80));var _0x056f=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0x56f0[_0x516ffb];return _0x319667;};'use strict';var _=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var moment=require(_0x056f('0x2'));var BPromise=require(_0x056f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x056f('0x4'));var db=require(_0x056f('0x5'))['db'];var utils=require(_0x056f('0x6'));var logger=require(_0x056f('0x7'))(_0x056f('0x8'));var config=require(_0x056f('0x9'));var jayson=require(_0x056f('0xa'));var client=jayson[_0x056f('0xb')][_0x056f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36d3d2,_0x1f1a7d,_0x23e793){return new BPromise(function(_0x4fa8b4,_0x4d031e){return client['request'](_0x36d3d2,_0x23e793)[_0x056f('0xd')](function(_0x182b3e){logger[_0x056f('0xe')](_0x056f('0xf'),_0x1f1a7d,_0x056f('0x10'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1f1a7d,'request\x20sent',JSON[_0x056f('0x11')](_0x182b3e));if(_0x182b3e['error']){if(_0x182b3e['error'][_0x056f('0x12')]===0x1f4){logger['error'](_0x056f('0xf'),_0x1f1a7d,_0x182b3e[_0x056f('0x13')][_0x056f('0x14')]);return _0x4d031e(_0x182b3e['error'][_0x056f('0x14')]);}logger[_0x056f('0x13')]('ZohoConfiguration,\x20%s,\x20%s',_0x1f1a7d,_0x182b3e['error'][_0x056f('0x14')]);return _0x4fa8b4(_0x182b3e[_0x056f('0x13')][_0x056f('0x14')]);}else{logger[_0x056f('0xe')](_0x056f('0xf'),_0x1f1a7d,_0x056f('0x10'));_0x4fa8b4(_0x182b3e[_0x056f('0x15')]['message']);}})['catch'](function(_0x135243){logger[_0x056f('0x13')](_0x056f('0xf'),_0x1f1a7d,_0x135243);_0x4d031e(_0x135243);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 47f27b7..034eaa4 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 _0x0ca2=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports'];(function(_0x324b1e,_0x3d45ab){var _0x8bc793=function(_0x516b13){while(--_0x516b13){_0x324b1e['push'](_0x324b1e['shift']());}};_0x8bc793(++_0x3d45ab);}(_0x0ca2,0x144));var _0x20ca=function(_0x117581,_0x307e77){_0x117581=_0x117581-0x0;var _0x25cfa7=_0x0ca2[_0x117581];return _0x25cfa7;};'use strict';var multer=require(_0x20ca('0x0'));var util=require(_0x20ca('0x1'));var path=require('path');var timeout=require(_0x20ca('0x2'));var express=require(_0x20ca('0x3'));var router=express['Router']();var fs_extra=require(_0x20ca('0x4'));var auth=require(_0x20ca('0x5'));var interaction=require(_0x20ca('0x6'));var config=require('../../config/environment');var controller=require(_0x20ca('0x7'));router['get']('/',auth[_0x20ca('0x8')](),controller[_0x20ca('0x9')]);router[_0x20ca('0xa')](_0x20ca('0xb'),auth['isAuthenticated'](),controller[_0x20ca('0xc')]);router['post']('/',auth[_0x20ca('0x8')](),controller['create']);router[_0x20ca('0xd')](_0x20ca('0xb'),auth[_0x20ca('0x8')](),controller[_0x20ca('0xe')]);router[_0x20ca('0xf')]('/:id',auth[_0x20ca('0x8')](),controller[_0x20ca('0x10')]);module[_0x20ca('0x11')]=router; \ No newline at end of file +var _0x1e63=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports','path','connect-timeout'];(function(_0x5f26e9,_0x343b7e){var _0x261e3e=function(_0x31ecda){while(--_0x31ecda){_0x5f26e9['push'](_0x5f26e9['shift']());}};_0x261e3e(++_0x343b7e);}(_0x1e63,0x102));var _0x31e6=function(_0x5c743c,_0x155a05){_0x5c743c=_0x5c743c-0x0;var _0x4b361f=_0x1e63[_0x5c743c];return _0x4b361f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x31e6('0x0'));var timeout=require(_0x31e6('0x1'));var express=require(_0x31e6('0x2'));var router=express[_0x31e6('0x3')]();var fs_extra=require(_0x31e6('0x4'));var auth=require(_0x31e6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x31e6('0x6'));var controller=require(_0x31e6('0x7'));router[_0x31e6('0x8')]('/',auth[_0x31e6('0x9')](),controller[_0x31e6('0xa')]);router[_0x31e6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x31e6('0xb')]);router[_0x31e6('0xc')]('/',auth[_0x31e6('0x9')](),controller[_0x31e6('0xd')]);router[_0x31e6('0xe')]('/:id',auth[_0x31e6('0x9')](),controller[_0x31e6('0xf')]);router[_0x31e6('0x10')](_0x31e6('0x11'),auth[_0x31e6('0x9')](),controller[_0x31e6('0x12')]);module[_0x31e6('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 5c086f8..b17c243 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 _0x7f15=['STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist','string'];(function(_0x122e9b,_0x391bf4){var _0x22c247=function(_0x1b2c65){while(--_0x1b2c65){_0x122e9b['push'](_0x122e9b['shift']());}};_0x22c247(++_0x391bf4);}(_0x7f15,0x161));var _0x57f1=function(_0x356588,_0x4fd954){_0x356588=_0x356588-0x0;var _0x512843=_0x7f15[_0x356588];return _0x512843;};'use strict';var Sequelize=require(_0x57f1('0x0'));module[_0x57f1('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x57f1('0x2'),_0x57f1('0x3'),_0x57f1('0x4'),_0x57f1('0x5')),'defaultValue':_0x57f1('0x6')},'content':{'type':Sequelize[_0x57f1('0x7')]},'key':{'type':Sequelize[_0x57f1('0x7')]},'keyType':{'type':Sequelize[_0x57f1('0x8')](_0x57f1('0x6'),_0x57f1('0x2'),_0x57f1('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x57f1('0x7')]},'nameField':{'type':Sequelize[_0x57f1('0x7')]},'customField':{'type':Sequelize[_0x57f1('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x57f1('0x7')]}}; \ No newline at end of file +var _0xbd3a=['picklist','STRING','ENUM','sequelize','exports','string','variable','customVariable','keyValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd3a,0x1e0));var _0xabd3=function(_0x52090d,_0x2b65b3){_0x52090d=_0x52090d-0x0;var _0x53cbf0=_0xbd3a[_0x52090d];return _0x53cbf0;};'use strict';var Sequelize=require(_0xabd3('0x0'));module[_0xabd3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xabd3('0x2'),_0xabd3('0x3'),_0xabd3('0x4'),_0xabd3('0x5'),_0xabd3('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xabd3('0x7')]},'key':{'type':Sequelize[_0xabd3('0x7')]},'keyType':{'type':Sequelize[_0xabd3('0x8')]('string','variable',_0xabd3('0x4'))},'keyContent':{'type':Sequelize[_0xabd3('0x7')]},'idField':{'type':Sequelize[_0xabd3('0x7')]},'nameField':{'type':Sequelize[_0xabd3('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabd3('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 557cc00..eb2053b 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 _0x17ba=['filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','ZohoField','fieldName','type','key','query','keys','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x17ba,0x1af));var _0xa17b=function(_0x4409d0,_0x18ceba){_0x4409d0=_0x4409d0-0x0;var _0x2215f0=_0x17ba[_0x4409d0];return _0x2215f0;};'use strict';var emlformat=require(_0xa17b('0x0'));var rimraf=require(_0xa17b('0x1'));var zipdir=require(_0xa17b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa17b('0x3'));var moment=require(_0xa17b('0x4'));var BPromise=require(_0xa17b('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa17b('0x6'));var _=require(_0xa17b('0x7'));var squel=require(_0xa17b('0x8'));var crypto=require(_0xa17b('0x9'));var jsforce=require(_0xa17b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa17b('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa17b('0xc'));var authService=require(_0xa17b('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa17b('0xe'));var hardwareService=require(_0xa17b('0xf'));var logger=require(_0xa17b('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa17b('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a05e8,_0x327274){_0x327274=_0x327274||0xcc;return function(_0x12fcb0){if(_0x12fcb0){return _0x3a05e8[_0xa17b('0x12')](_0x327274);}return _0x3a05e8[_0xa17b('0x13')](_0x327274)['end']();};}function respondWithResult(_0x325e65,_0x273878){_0x273878=_0x273878||0xc8;return function(_0xa2b6ae){if(_0xa2b6ae){return _0x325e65[_0xa17b('0x13')](_0x273878)['json'](_0xa2b6ae);}};}function respondWithFilteredResult(_0x2779be,_0x487e48){return function(_0x4c747d){if(_0x4c747d){var _0x581cd9=typeof _0x487e48[_0xa17b('0x14')]==='undefined'&&typeof _0x487e48[_0xa17b('0x15')]===_0xa17b('0x16');var _0x22745e=_0x4c747d['count'];var _0x1c3a64=_0x581cd9?0x0:_0x487e48[_0xa17b('0x14')];var _0xd11e50=_0x581cd9?_0x4c747d[_0xa17b('0x17')]:_0x487e48['offset']+_0x487e48[_0xa17b('0x15')];var _0x2863e2;if(_0xd11e50>=_0x22745e){_0xd11e50=_0x22745e;_0x2863e2=0xc8;}else{_0x2863e2=0xce;}_0x2779be[_0xa17b('0x13')](_0x2863e2);return _0x2779be['set']('Content-Range',_0x1c3a64+'-'+_0xd11e50+'/'+_0x22745e)[_0xa17b('0x18')](_0x4c747d);}return null;};}function patchUpdates(_0xb13fbd){return function(_0x5d41a5){try{jsonpatch[_0xa17b('0x19')](_0x5d41a5,_0xb13fbd,!![]);}catch(_0x368835){return BPromise[_0xa17b('0x1a')](_0x368835);}return _0x5d41a5[_0xa17b('0x1b')]();};}function saveUpdates(_0x23c4aa,_0x5d7697){return function(_0x3caf19){if(_0x3caf19){return _0x3caf19[_0xa17b('0x1c')](_0x23c4aa)[_0xa17b('0x1d')](function(_0x58f76d){return _0x58f76d;});}return null;};}function removeEntity(_0x4f3804,_0x216e35){return function(_0x4ce6eb){if(_0x4ce6eb){return _0x4ce6eb[_0xa17b('0x1e')]()['then'](function(){_0x4f3804[_0xa17b('0x13')](0xcc)[_0xa17b('0x1f')]();});}};}function handleEntityNotFound(_0x282e07,_0x44823c){return function(_0x224d6){if(!_0x224d6){_0x282e07[_0xa17b('0x12')](0x194);}return _0x224d6;};}function handleError(_0x4c4b87,_0x4bcfa9){_0x4bcfa9=_0x4bcfa9||0x1f4;return function(_0x532c77){logger[_0xa17b('0x20')](_0x532c77['stack']);if(_0x532c77[_0xa17b('0x21')]){delete _0x532c77[_0xa17b('0x21')];}_0x4c4b87[_0xa17b('0x13')](_0x4bcfa9)[_0xa17b('0x22')](_0x532c77);};}exports[_0xa17b('0x23')]=function(_0x4385e2,_0x28fbc2){var _0x10c5c2={},_0x495387={},_0x4d2d0b={'count':0x0,'rows':[]};var _0x5bd0db=_[_0xa17b('0x24')](db[_0xa17b('0x25')]['rawAttributes'],function(_0x9b17d5){return{'name':_0x9b17d5[_0xa17b('0x26')],'type':_0x9b17d5[_0xa17b('0x27')][_0xa17b('0x28')]};});_0x495387['model']=_[_0xa17b('0x24')](_0x5bd0db,_0xa17b('0x21'));_0x495387[_0xa17b('0x29')]=_[_0xa17b('0x2a')](_0x4385e2['query']);_0x495387['filters']=_['intersection'](_0x495387[_0xa17b('0x2b')],_0x495387['query']);_0x10c5c2['attributes']=_['intersection'](_0x495387[_0xa17b('0x2b')],qs['fields'](_0x4385e2[_0xa17b('0x29')][_0xa17b('0x2c')]));_0x10c5c2['attributes']=_0x10c5c2[_0xa17b('0x2d')][_0xa17b('0x2e')]?_0x10c5c2['attributes']:_0x495387[_0xa17b('0x2b')];if(!_0x4385e2['query'][_0xa17b('0x2f')](_0xa17b('0x30'))){_0x10c5c2['limit']=qs[_0xa17b('0x15')](_0x4385e2[_0xa17b('0x29')][_0xa17b('0x15')]);_0x10c5c2[_0xa17b('0x14')]=qs[_0xa17b('0x14')](_0x4385e2['query']['offset']);}_0x10c5c2[_0xa17b('0x31')]=qs[_0xa17b('0x32')](_0x4385e2['query'][_0xa17b('0x32')]);_0x10c5c2[_0xa17b('0x33')]=qs[_0xa17b('0x34')](_['pick'](_0x4385e2['query'],_0x495387[_0xa17b('0x34')]),_0x5bd0db);if(_0x4385e2[_0xa17b('0x29')][_0xa17b('0x35')]){_0x10c5c2[_0xa17b('0x33')]=_[_0xa17b('0x36')](_0x10c5c2[_0xa17b('0x33')],{'$or':_[_0xa17b('0x24')](_0x5bd0db,function(_0xbe2040){if(_0xbe2040[_0xa17b('0x27')]!==_0xa17b('0x37')){var _0x3c4ba3={};_0x3c4ba3[_0xbe2040['name']]={'$like':'%'+_0x4385e2['query'][_0xa17b('0x35')]+'%'};return _0x3c4ba3;}})});}_0x10c5c2=_[_0xa17b('0x36')]({},_0x10c5c2,_0x4385e2[_0xa17b('0x38')]);var _0x5892cb={'where':_0x10c5c2[_0xa17b('0x33')]};return db[_0xa17b('0x25')][_0xa17b('0x17')](_0x5892cb)[_0xa17b('0x1d')](function(_0x532407){_0x4d2d0b[_0xa17b('0x17')]=_0x532407;if(_0x4385e2['query'][_0xa17b('0x39')]){_0x10c5c2['include']=[{'all':!![]}];}return db[_0xa17b('0x25')][_0xa17b('0x3a')](_0x10c5c2);})[_0xa17b('0x1d')](function(_0x42b6cd){_0x4d2d0b[_0xa17b('0x3b')]=_0x42b6cd;return _0x4d2d0b;})[_0xa17b('0x1d')](respondWithFilteredResult(_0x28fbc2,_0x10c5c2))['catch'](handleError(_0x28fbc2,null));};exports[_0xa17b('0x3c')]=function(_0x374250,_0x3e3313){var _0x4ea22e={'raw':!![],'where':{'id':_0x374250[_0xa17b('0x3d')]['id']}},_0x55b8c5={};_0x55b8c5[_0xa17b('0x2b')]=_['keys'](db['ZohoField'][_0xa17b('0x3e')]);_0x55b8c5['query']=_[_0xa17b('0x2a')](_0x374250[_0xa17b('0x29')]);_0x55b8c5[_0xa17b('0x34')]=_[_0xa17b('0x3f')](_0x55b8c5['model'],_0x55b8c5['query']);_0x4ea22e[_0xa17b('0x2d')]=_[_0xa17b('0x3f')](_0x55b8c5[_0xa17b('0x2b')],qs[_0xa17b('0x2c')](_0x374250[_0xa17b('0x29')][_0xa17b('0x2c')]));_0x4ea22e[_0xa17b('0x2d')]=_0x4ea22e[_0xa17b('0x2d')][_0xa17b('0x2e')]?_0x4ea22e[_0xa17b('0x2d')]:_0x55b8c5[_0xa17b('0x2b')];if(_0x374250[_0xa17b('0x29')][_0xa17b('0x39')]){_0x4ea22e[_0xa17b('0x40')]=[{'all':!![]}];}_0x4ea22e=_[_0xa17b('0x36')]({},_0x4ea22e,_0x374250[_0xa17b('0x38')]);return db[_0xa17b('0x25')][_0xa17b('0x41')](_0x4ea22e)[_0xa17b('0x1d')](handleEntityNotFound(_0x3e3313,null))['then'](respondWithResult(_0x3e3313,null))['catch'](handleError(_0x3e3313,null));};exports[_0xa17b('0x42')]=function(_0x2eb692,_0xaa37e2){return db[_0xa17b('0x25')][_0xa17b('0x42')](_0x2eb692[_0xa17b('0x43')],{})[_0xa17b('0x1d')](respondWithResult(_0xaa37e2,0xc9))['catch'](handleError(_0xaa37e2,null));};exports['update']=function(_0x366779,_0x2ca54f){if(_0x366779[_0xa17b('0x43')]['id']){delete _0x366779[_0xa17b('0x43')]['id'];}return db['ZohoField'][_0xa17b('0x41')]({'where':{'id':_0x366779['params']['id']}})['then'](handleEntityNotFound(_0x2ca54f,null))[_0xa17b('0x1d')](saveUpdates(_0x366779[_0xa17b('0x43')],null))[_0xa17b('0x1d')](respondWithResult(_0x2ca54f,null))[_0xa17b('0x44')](handleError(_0x2ca54f,null));};exports['destroy']=function(_0x74dbe5,_0x34d09c){return db[_0xa17b('0x25')][_0xa17b('0x41')]({'where':{'id':_0x74dbe5['params']['id']}})[_0xa17b('0x1d')](handleEntityNotFound(_0x34d09c,null))[_0xa17b('0x1d')](removeEntity(_0x34d09c,null))['catch'](handleError(_0x34d09c,null));}; \ No newline at end of file +var _0x555e=['bluebird','mustache','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','send','index','type','key','model','map','query','keys','filters','intersection','attributes','nolimit','order','where','filter','merge','VIRTUAL','options','includeAll','include','ZohoField','rows','catch','show','params','rawAttributes','length','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x170772,_0x1f1ee7){var _0x3ef69c=function(_0x4cde12){while(--_0x4cde12){_0x170772['push'](_0x170772['shift']());}};_0x3ef69c(++_0x1f1ee7);}(_0x555e,0x159));var _0xe555=function(_0x4997fb,_0xab57b){_0x4997fb=_0x4997fb-0x0;var _0x3da0d1=_0x555e[_0x4997fb];return _0x3da0d1;};'use strict';var emlformat=require(_0xe555('0x0'));var rimraf=require(_0xe555('0x1'));var zipdir=require(_0xe555('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe555('0x3'));var moment=require(_0xe555('0x4'));var BPromise=require(_0xe555('0x5'));var Mustache=require(_0xe555('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe555('0x7'));var ejs=require(_0xe555('0x8'));var fs=require('fs');var fs_extra=require(_0xe555('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe555('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe555('0xb'));var toCsv=require(_0xe555('0x7'));var querystring=require(_0xe555('0xc'));var Papa=require(_0xe555('0xd'));var Redis=require(_0xe555('0xe'));var authService=require(_0xe555('0xf'));var qs=require(_0xe555('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe555('0x11'));var logger=require(_0xe555('0x12'))(_0xe555('0x13'));var utils=require(_0xe555('0x14'));var config=require(_0xe555('0x15'));var licenseUtil=require(_0xe555('0x16'));var db=require(_0xe555('0x17'))['db'];function respondWithStatusCode(_0x18da19,_0x4820d1){_0x4820d1=_0x4820d1||0xcc;return function(_0x163571){if(_0x163571){return _0x18da19[_0xe555('0x18')](_0x4820d1);}return _0x18da19[_0xe555('0x19')](_0x4820d1)[_0xe555('0x1a')]();};}function respondWithResult(_0x20772e,_0x5c4027){_0x5c4027=_0x5c4027||0xc8;return function(_0x72418c){if(_0x72418c){return _0x20772e[_0xe555('0x19')](_0x5c4027)[_0xe555('0x1b')](_0x72418c);}};}function respondWithFilteredResult(_0x1b7f6c,_0x3dad33){return function(_0x4ac60f){if(_0x4ac60f){var _0x2f8b3a=typeof _0x3dad33[_0xe555('0x1c')]===_0xe555('0x1d')&&typeof _0x3dad33[_0xe555('0x1e')]===_0xe555('0x1d');var _0x50a60e=_0x4ac60f[_0xe555('0x1f')];var _0x39e319=_0x2f8b3a?0x0:_0x3dad33[_0xe555('0x1c')];var _0x39afd7=_0x2f8b3a?_0x4ac60f[_0xe555('0x1f')]:_0x3dad33[_0xe555('0x1c')]+_0x3dad33[_0xe555('0x1e')];var _0x2f3ffb;if(_0x39afd7>=_0x50a60e){_0x39afd7=_0x50a60e;_0x2f3ffb=0xc8;}else{_0x2f3ffb=0xce;}_0x1b7f6c['status'](_0x2f3ffb);return _0x1b7f6c[_0xe555('0x20')]('Content-Range',_0x39e319+'-'+_0x39afd7+'/'+_0x50a60e)['json'](_0x4ac60f);}return null;};}function patchUpdates(_0x55a53c){return function(_0x127be6){try{jsonpatch[_0xe555('0x21')](_0x127be6,_0x55a53c,!![]);}catch(_0x4e720a){return BPromise['reject'](_0x4e720a);}return _0x127be6[_0xe555('0x22')]();};}function saveUpdates(_0x403031,_0x2a96c7){return function(_0x340872){if(_0x340872){return _0x340872['update'](_0x403031)[_0xe555('0x23')](function(_0x2de6d6){return _0x2de6d6;});}return null;};}function removeEntity(_0x44f794,_0x68ac46){return function(_0x3f5fe7){if(_0x3f5fe7){return _0x3f5fe7['destroy']()[_0xe555('0x23')](function(){_0x44f794[_0xe555('0x19')](0xcc)[_0xe555('0x1a')]();});}};}function handleEntityNotFound(_0x5f3fe6,_0x3bcffa){return function(_0x2b02f6){if(!_0x2b02f6){_0x5f3fe6[_0xe555('0x18')](0x194);}return _0x2b02f6;};}function handleError(_0x5ba36e,_0x40338b){_0x40338b=_0x40338b||0x1f4;return function(_0x1f6900){logger[_0xe555('0x24')](_0x1f6900[_0xe555('0x25')]);if(_0x1f6900[_0xe555('0x26')]){delete _0x1f6900[_0xe555('0x26')];}_0x5ba36e[_0xe555('0x19')](_0x40338b)[_0xe555('0x27')](_0x1f6900);};}exports[_0xe555('0x28')]=function(_0x4e8aef,_0x1d5058){var _0x1fe1f5={},_0xf6576e={},_0x127bcc={'count':0x0,'rows':[]};var _0x2b09d1=_['map'](db['ZohoField']['rawAttributes'],function(_0x37d45d){return{'name':_0x37d45d['fieldName'],'type':_0x37d45d[_0xe555('0x29')][_0xe555('0x2a')]};});_0xf6576e[_0xe555('0x2b')]=_[_0xe555('0x2c')](_0x2b09d1,_0xe555('0x26'));_0xf6576e[_0xe555('0x2d')]=_[_0xe555('0x2e')](_0x4e8aef[_0xe555('0x2d')]);_0xf6576e[_0xe555('0x2f')]=_[_0xe555('0x30')](_0xf6576e['model'],_0xf6576e[_0xe555('0x2d')]);_0x1fe1f5[_0xe555('0x31')]=_[_0xe555('0x30')](_0xf6576e[_0xe555('0x2b')],qs['fields'](_0x4e8aef[_0xe555('0x2d')]['fields']));_0x1fe1f5['attributes']=_0x1fe1f5['attributes']['length']?_0x1fe1f5[_0xe555('0x31')]:_0xf6576e[_0xe555('0x2b')];if(!_0x4e8aef[_0xe555('0x2d')]['hasOwnProperty'](_0xe555('0x32'))){_0x1fe1f5[_0xe555('0x1e')]=qs[_0xe555('0x1e')](_0x4e8aef[_0xe555('0x2d')]['limit']);_0x1fe1f5[_0xe555('0x1c')]=qs[_0xe555('0x1c')](_0x4e8aef['query'][_0xe555('0x1c')]);}_0x1fe1f5[_0xe555('0x33')]=qs['sort'](_0x4e8aef[_0xe555('0x2d')]['sort']);_0x1fe1f5[_0xe555('0x34')]=qs[_0xe555('0x2f')](_['pick'](_0x4e8aef[_0xe555('0x2d')],_0xf6576e[_0xe555('0x2f')]),_0x2b09d1);if(_0x4e8aef[_0xe555('0x2d')][_0xe555('0x35')]){_0x1fe1f5[_0xe555('0x34')]=_[_0xe555('0x36')](_0x1fe1f5[_0xe555('0x34')],{'$or':_[_0xe555('0x2c')](_0x2b09d1,function(_0x2758c4){if(_0x2758c4[_0xe555('0x29')]!==_0xe555('0x37')){var _0x4bc010={};_0x4bc010[_0x2758c4[_0xe555('0x26')]]={'$like':'%'+_0x4e8aef[_0xe555('0x2d')][_0xe555('0x35')]+'%'};return _0x4bc010;}})});}_0x1fe1f5=_[_0xe555('0x36')]({},_0x1fe1f5,_0x4e8aef[_0xe555('0x38')]);var _0x26f350={'where':_0x1fe1f5['where']};return db['ZohoField'][_0xe555('0x1f')](_0x26f350)[_0xe555('0x23')](function(_0x199123){_0x127bcc[_0xe555('0x1f')]=_0x199123;if(_0x4e8aef['query'][_0xe555('0x39')]){_0x1fe1f5[_0xe555('0x3a')]=[{'all':!![]}];}return db[_0xe555('0x3b')]['findAll'](_0x1fe1f5);})['then'](function(_0x5ec7da){_0x127bcc[_0xe555('0x3c')]=_0x5ec7da;return _0x127bcc;})[_0xe555('0x23')](respondWithFilteredResult(_0x1d5058,_0x1fe1f5))[_0xe555('0x3d')](handleError(_0x1d5058,null));};exports[_0xe555('0x3e')]=function(_0xd8a09e,_0x56cf32){var _0x12081f={'raw':!![],'where':{'id':_0xd8a09e[_0xe555('0x3f')]['id']}},_0x312f8b={};_0x312f8b[_0xe555('0x2b')]=_['keys'](db[_0xe555('0x3b')][_0xe555('0x40')]);_0x312f8b[_0xe555('0x2d')]=_['keys'](_0xd8a09e['query']);_0x312f8b[_0xe555('0x2f')]=_[_0xe555('0x30')](_0x312f8b['model'],_0x312f8b['query']);_0x12081f['attributes']=_[_0xe555('0x30')](_0x312f8b[_0xe555('0x2b')],qs['fields'](_0xd8a09e[_0xe555('0x2d')]['fields']));_0x12081f[_0xe555('0x31')]=_0x12081f['attributes'][_0xe555('0x41')]?_0x12081f[_0xe555('0x31')]:_0x312f8b['model'];if(_0xd8a09e[_0xe555('0x2d')][_0xe555('0x39')]){_0x12081f[_0xe555('0x3a')]=[{'all':!![]}];}_0x12081f=_[_0xe555('0x36')]({},_0x12081f,_0xd8a09e['options']);return db[_0xe555('0x3b')][_0xe555('0x42')](_0x12081f)[_0xe555('0x23')](handleEntityNotFound(_0x56cf32,null))[_0xe555('0x23')](respondWithResult(_0x56cf32,null))[_0xe555('0x3d')](handleError(_0x56cf32,null));};exports[_0xe555('0x43')]=function(_0x35f98f,_0x360627){return db[_0xe555('0x3b')]['create'](_0x35f98f[_0xe555('0x44')],{})[_0xe555('0x23')](respondWithResult(_0x360627,0xc9))[_0xe555('0x3d')](handleError(_0x360627,null));};exports['update']=function(_0x14e37d,_0x10a2f2){if(_0x14e37d[_0xe555('0x44')]['id']){delete _0x14e37d[_0xe555('0x44')]['id'];}return db[_0xe555('0x3b')][_0xe555('0x42')]({'where':{'id':_0x14e37d[_0xe555('0x3f')]['id']}})['then'](handleEntityNotFound(_0x10a2f2,null))[_0xe555('0x23')](saveUpdates(_0x14e37d[_0xe555('0x44')],null))[_0xe555('0x23')](respondWithResult(_0x10a2f2,null))[_0xe555('0x3d')](handleError(_0x10a2f2,null));};exports[_0xe555('0x45')]=function(_0x3bd2ea,_0x537144){return db['ZohoField'][_0xe555('0x42')]({'where':{'id':_0x3bd2ea['params']['id']}})[_0xe555('0x23')](handleEntityNotFound(_0x537144,null))[_0xe555('0x23')](removeEntity(_0x537144,null))[_0xe555('0x3d')](handleError(_0x537144,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d4843d7..b98473d 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 _0x6d11=['exports','define','ZohoField','int_zoho_fields','lodash','util','../../config/logger','moment','request-promise','path','./intZohoField.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6d11,0xbf));var _0x16d1=function(_0x54e950,_0x14daff){_0x54e950=_0x54e950-0x0;var _0x38b733=_0x6d11[_0x54e950];return _0x38b733;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('api');var moment=require(_0x16d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x16d1('0x4'));var fs=require('fs');var path=require(_0x16d1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16d1('0x6'));module[_0x16d1('0x7')]=function(_0x3eb9e2,_0x38626d){return _0x3eb9e2[_0x16d1('0x8')](_0x16d1('0x9'),attributes,{'tableName':_0x16d1('0xa'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf61e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x3b4b1d,_0x15029e){var _0x488c36=function(_0x56c8b3){while(--_0x56c8b3){_0x3b4b1d['push'](_0x3b4b1d['shift']());}};_0x488c36(++_0x15029e);}(_0xf61e,0x191));var _0xef61=function(_0xf4aafd,_0x33b39f){_0xf4aafd=_0xf4aafd-0x0;var _0x5d6651=_0xf61e[_0xf4aafd];return _0x5d6651;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 927247d..5816761 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 _0xdb39=['error','code','message','ZohoField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','debug','request\x20sent','stringify'];(function(_0x2f4788,_0x8a3f82){var _0x19fe92=function(_0xf4d457){while(--_0xf4d457){_0x2f4788['push'](_0x2f4788['shift']());}};_0x19fe92(++_0x8a3f82);}(_0xdb39,0x8a));var _0x9db3=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0xdb39[_0x1e6db3];return _0x1de886;};'use strict';var _=require(_0x9db3('0x0'));var util=require(_0x9db3('0x1'));var moment=require(_0x9db3('0x2'));var BPromise=require(_0x9db3('0x3'));var rs=require(_0x9db3('0x4'));var fs=require('fs');var Redis=require(_0x9db3('0x5'));var db=require(_0x9db3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9db3('0x7'))(_0x9db3('0x8'));var config=require(_0x9db3('0x9'));var jayson=require(_0x9db3('0xa'));var client=jayson['client'][_0x9db3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2175e2,_0x1fd9a8,_0x27c88e){return new BPromise(function(_0x3292c3,_0x536cdb){return client['request'](_0x2175e2,_0x27c88e)['then'](function(_0x32b86e){logger[_0x9db3('0xc')]('ZohoField,\x20%s,\x20%s',_0x1fd9a8,'request\x20sent');logger[_0x9db3('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x1fd9a8,_0x9db3('0xe'),JSON[_0x9db3('0xf')](_0x32b86e));if(_0x32b86e[_0x9db3('0x10')]){if(_0x32b86e['error'][_0x9db3('0x11')]===0x1f4){logger[_0x9db3('0x10')]('ZohoField,\x20%s,\x20%s',_0x1fd9a8,_0x32b86e[_0x9db3('0x10')][_0x9db3('0x12')]);return _0x536cdb(_0x32b86e['error']['message']);}logger[_0x9db3('0x10')]('ZohoField,\x20%s,\x20%s',_0x1fd9a8,_0x32b86e['error']['message']);return _0x3292c3(_0x32b86e[_0x9db3('0x10')]['message']);}else{logger[_0x9db3('0xc')](_0x9db3('0x13'),_0x1fd9a8,_0x9db3('0xe'));_0x3292c3(_0x32b86e[_0x9db3('0x14')]['message']);}})[_0x9db3('0x15')](function(_0x451b55){logger[_0x9db3('0x10')](_0x9db3('0x13'),_0x1fd9a8,_0x451b55);_0x536cdb(_0x451b55);});});} \ No newline at end of file +var _0xa421=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x45c373,_0x24370f){var _0x4b4fb8=function(_0x1cac8a){while(--_0x1cac8a){_0x45c373['push'](_0x45c373['shift']());}};_0x4b4fb8(++_0x24370f);}(_0xa421,0x73));var _0x1a42=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xa421[_0x257642];return _0x3d813b;};'use strict';var _=require(_0x1a42('0x0'));var util=require(_0x1a42('0x1'));var moment=require(_0x1a42('0x2'));var BPromise=require(_0x1a42('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a42('0x4'));var db=require(_0x1a42('0x5'))['db'];var utils=require(_0x1a42('0x6'));var logger=require(_0x1a42('0x7'))(_0x1a42('0x8'));var config=require(_0x1a42('0x9'));var jayson=require(_0x1a42('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f2ed2,_0x17e3e7,_0x176e05){return new BPromise(function(_0x176766,_0x3b5452){return client[_0x1a42('0xb')](_0x4f2ed2,_0x176e05)['then'](function(_0x4c71a1){logger[_0x1a42('0xc')](_0x1a42('0xd'),_0x17e3e7,_0x1a42('0xe'));logger[_0x1a42('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x17e3e7,'request\x20sent',JSON['stringify'](_0x4c71a1));if(_0x4c71a1['error']){if(_0x4c71a1[_0x1a42('0x10')]['code']===0x1f4){logger['error'](_0x1a42('0xd'),_0x17e3e7,_0x4c71a1[_0x1a42('0x10')][_0x1a42('0x11')]);return _0x3b5452(_0x4c71a1[_0x1a42('0x10')][_0x1a42('0x11')]);}logger['error'](_0x1a42('0xd'),_0x17e3e7,_0x4c71a1['error'][_0x1a42('0x11')]);return _0x176766(_0x4c71a1[_0x1a42('0x10')][_0x1a42('0x11')]);}else{logger[_0x1a42('0xc')](_0x1a42('0xd'),_0x17e3e7,_0x1a42('0xe'));_0x176766(_0x4c71a1[_0x1a42('0x12')]['message']);}})[_0x1a42('0x13')](function(_0x105882){logger[_0x1a42('0x10')](_0x1a42('0xd'),_0x17e3e7,_0x105882);_0x3b5452(_0x105882);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index de5f8fb..a4cd061 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3bdce7,_0x4b10ca){var _0x2e56ce=function(_0x37d2a5){while(--_0x37d2a5){_0x3bdce7['push'](_0x3bdce7['shift']());}};_0x2e56ce(++_0x4b10ca);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x556634,_0x520958){_0x556634=_0x556634-0x0;var _0x4429fd=_0xcb91[_0x556634];return _0x4429fd;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 6756846..c72cee0 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 _0x8a11=['unique_name_and_version','app.js','STRING','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x34f03d,_0x317f12){var _0x5754fe=function(_0x1ccd99){while(--_0x1ccd99){_0x34f03d['push'](_0x34f03d['shift']());}};_0x5754fe(++_0x317f12);}(_0x8a11,0x196));var _0x18a1=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x8a11[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require(_0x18a1('0x0'));module[_0x18a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x18a1('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x18a1('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x18a1('0x3')},'filename':{'type':Sequelize[_0x18a1('0x4')]},'path':{'type':Sequelize[_0x18a1('0x4')]},'type':{'type':Sequelize[_0x18a1('0x4')]},'size':{'type':Sequelize[_0x18a1('0x5')]},'active':{'type':Sequelize[_0x18a1('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x18a1('0x4')]},'logo':{'type':Sequelize[_0x18a1('0x4')]},'state':{'type':Sequelize[_0x18a1('0x4')],'unique':_0x18a1('0x7')},'description':{'type':Sequelize[_0x18a1('0x4')]},'title':{'type':Sequelize[_0x18a1('0x4')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x18a1('0x4')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8017=['sequelize','STRING','unique_name_and_version','app.js','state'];(function(_0x502211,_0x30c0e7){var _0x323391=function(_0x6ebdc0){while(--_0x6ebdc0){_0x502211['push'](_0x502211['shift']());}};_0x323391(++_0x30c0e7);}(_0x8017,0x154));var _0x7801=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0x8017[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x7801('0x0'));module['exports']={'name':{'type':Sequelize[_0x7801('0x1')],'allowNull':![],'unique':_0x7801('0x2')},'version':{'type':Sequelize[_0x7801('0x1')],'allowNull':![],'unique':_0x7801('0x2')},'main':{'type':Sequelize[_0x7801('0x1')],'defaultValue':_0x7801('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x7801('0x1')]},'type':{'type':Sequelize[_0x7801('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x7801('0x1')]},'logo':{'type':Sequelize[_0x7801('0x1')]},'state':{'type':Sequelize[_0x7801('0x1')],'unique':_0x7801('0x4')},'description':{'type':Sequelize[_0x7801('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7801('0x1')]},'link':{'type':Sequelize[_0x7801('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9d5446b..934e191 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 _0x5fab=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../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','destroy','end','sendStatus','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0x5fab,0x177));var _0xb5fa=function(_0x4482af,_0x2df282){_0x4482af=_0x4482af-0x0;var _0x1874e5=_0x5fab[_0x4482af];return _0x1874e5;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['Integration'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')](_0x33eb2c[_0xb5fa('0x4d')],{})[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,0xc9))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x3a39f2,_0x52f5d8){if(_0x3a39f2['body']['id']){delete _0x3a39f2[_0xb5fa('0x4d')]['id'];}return db['Integration'][_0xb5fa('0x4a')]({'where':{'id':_0x3a39f2[_0xb5fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x52f5d8,null))[_0xb5fa('0x43')](saveUpdates(_0x3a39f2[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x52f5d8,null))[_0xb5fa('0x4b')](handleError(_0x52f5d8,null));};exports[_0xb5fa('0x26')]=function(_0x3ffee0,_0x51d5f7){return db[_0xb5fa('0x2d')]['find']({'where':{'id':_0x3ffee0[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x51d5f7,null))[_0xb5fa('0x43')](removeEntity(_0x51d5f7,null))['catch'](handleError(_0x51d5f7,null));}; \ No newline at end of file +var _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15bbf8,_0x204441){_0x15bbf8=_0x15bbf8-0x0;var _0x4cbe4d=_0x5f2f[_0x15bbf8];return _0x4cbe4d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 04b2dd8..8cbe217 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 _0x372e=['rimraf','./integration.attributes','exports','define','Integration','integrations','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x128cb2,_0x148b2f){var _0x17c6ce=function(_0x293377){while(--_0x293377){_0x128cb2['push'](_0x128cb2['shift']());}};_0x17c6ce(++_0x148b2f);}(_0x372e,0x1da));var _0xe372=function(_0xe6f2a3,_0x59f4ee){_0xe6f2a3=_0xe6f2a3-0x0;var _0x573882=_0x372e[_0xe6f2a3];return _0x573882;};'use strict';var _=require('lodash');var util=require(_0xe372('0x0'));var logger=require(_0xe372('0x1'))(_0xe372('0x2'));var moment=require('moment');var BPromise=require(_0xe372('0x3'));var rp=require(_0xe372('0x4'));var fs=require('fs');var path=require(_0xe372('0x5'));var rimraf=require(_0xe372('0x6'));var config=require('../../config/environment');var attributes=require(_0xe372('0x7'));module[_0xe372('0x8')]=function(_0x30c9c5,_0x564758){return _0x30c9c5[_0xe372('0x9')](_0xe372('0xa'),attributes,{'tableName':_0xe372('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ee=['bluebird','rimraf','../../config/environment','exports','define','Integration','integrations','lodash','../../config/logger','api'];(function(_0x19c76,_0x42968a){var _0x585f2d=function(_0x2fda47){while(--_0x2fda47){_0x19c76['push'](_0x19c76['shift']());}};_0x585f2d(++_0x42968a);}(_0x32ee,0xd9));var _0xe32e=function(_0x4da79c,_0x53bc05){_0x4da79c=_0x4da79c-0x0;var _0x9af716=_0x32ee[_0x4da79c];return _0x9af716;};'use strict';var _=require(_0xe32e('0x0'));var util=require('util');var logger=require(_0xe32e('0x1'))(_0xe32e('0x2'));var moment=require('moment');var BPromise=require(_0xe32e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe32e('0x4'));var config=require(_0xe32e('0x5'));var attributes=require('./integration.attributes');module[_0xe32e('0x6')]=function(_0x4b4e34,_0x3cedec){return _0x4b4e34[_0xe32e('0x7')](_0xe32e('0x8'),attributes,{'tableName':_0xe32e('0x9'),'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 1125e7c..7fe34d2 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x19b6a7,_0x1d3432){var _0x3fdda7=function(_0x4ed477){while(--_0x4ed477){_0x19b6a7['push'](_0x19b6a7['shift']());}};_0x3fdda7(++_0x1d3432);}(_0x5f2f,0x73));var _0xf5f2=function(_0x475b2e,_0x325e40){_0x475b2e=_0x475b2e-0x0;var _0x57eaa0=_0x5f2f[_0x475b2e];return _0x57eaa0;};'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')]('Integration,\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 _0xdd4f=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x4540ff,_0x23286d){var _0x157f4b=function(_0x34a97d){while(--_0x34a97d){_0x4540ff['push'](_0x4540ff['shift']());}};_0x157f4b(++_0x23286d);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2085f3,_0x1164b4){_0x2085f3=_0x2085f3-0x0;var _0x1ee060=_0xdd4f[_0x2085f3];return _0x1ee060;};'use strict';var _=require(_0xfdd4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfdd4('0x1'));var fs=require('fs');var Redis=require(_0xfdd4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdd4('0x3'));var logger=require(_0xfdd4('0x4'))(_0xfdd4('0x5'));var config=require('../../config/environment');var jayson=require(_0xfdd4('0x6'));var client=jayson[_0xfdd4('0x7')][_0xfdd4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x307ac6,_0x3c72d4,_0x51acd6){return new BPromise(function(_0x3cd8e6,_0x563ae6){return client[_0xfdd4('0x9')](_0x307ac6,_0x51acd6)[_0xfdd4('0xa')](function(_0x1e823e){logger['info'](_0xfdd4('0xb'),_0x3c72d4,'request\x20sent');logger[_0xfdd4('0xc')](_0xfdd4('0xd'),_0x3c72d4,_0xfdd4('0xe'),JSON[_0xfdd4('0xf')](_0x1e823e));if(_0x1e823e[_0xfdd4('0x10')]){if(_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x11')]===0x1f4){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e[_0xfdd4('0x10')][_0xfdd4('0x12')]);return _0x563ae6(_0x1e823e['error'][_0xfdd4('0x12')]);}logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x1e823e['error'][_0xfdd4('0x12')]);return _0x3cd8e6(_0x1e823e['error'][_0xfdd4('0x12')]);}else{logger[_0xfdd4('0x13')](_0xfdd4('0xb'),_0x3c72d4,_0xfdd4('0xe'));_0x3cd8e6(_0x1e823e[_0xfdd4('0x14')]['message']);}})['catch'](function(_0x559c77){logger[_0xfdd4('0x10')](_0xfdd4('0xb'),_0x3c72d4,_0x559c77);_0x563ae6(_0x559c77);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0ef30bb..900b700 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 _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x25a5ac,_0x5ceab8){var _0x20bf18=function(_0x2d3f7e){while(--_0x2d3f7e){_0x25a5ac['push'](_0x25a5ac['shift']());}};_0x20bf18(++_0x5ceab8);}(_0x955f,0x1eb));var _0xf955=function(_0x2b4f5b,_0x51ffac){_0x2b4f5b=_0x2b4f5b-0x0;var _0x5e813a=_0x955f[_0x2b4f5b];return _0x5e813a;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./integrationReport.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0xd')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router['put'](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0xf')]);router[_0xf955('0x10')](_0xf955('0xb'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0xd943,0x15d));var _0x3d94=function(_0x52219d,_0x4fd4e4){_0x52219d=_0x52219d-0x0;var _0xb24612=_0xd943[_0x52219d];return _0xb24612;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index cd0e632..95759fd 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 _0xbf9f=['SENT','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0xbf9f,0x1a7));var _0xfbf9=function(_0x1b8644,_0x4dd28e){_0x1b8644=_0x1b8644-0x0;var _0x25e945=_0xbf9f[_0x1b8644];return _0x25e945;};'use strict';var Sequelize=require(_0xfbf9('0x0'));module['exports']={'integration':{'type':Sequelize[_0xfbf9('0x1')]},'eventChannel':{'type':Sequelize[_0xfbf9('0x1')]},'exitStatus':{'type':Sequelize[_0xfbf9('0x1')]},'ticketId':{'type':Sequelize[_0xfbf9('0x1')]},'integrationId':{'type':Sequelize[_0xfbf9('0x2')]},'contacts':{'type':Sequelize[_0xfbf9('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xfbf9('0x1')]},'calleridname':{'type':Sequelize[_0xfbf9('0x1')]},'queue':{'type':Sequelize[_0xfbf9('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xfbf9('0x1')]},'agentcalledAt':{'type':Sequelize[_0xfbf9('0x3')]},'agentconnectAt':{'type':Sequelize[_0xfbf9('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xfbf9('0x3')]},'talktime':{'type':Sequelize[_0xfbf9('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xfbf9('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xfbf9('0x3')]},'agentdump':{'type':Sequelize[_0xfbf9('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xfbf9('0x3')]},'lastevent':{'type':Sequelize[_0xfbf9('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xfbf9('0x2')]},'channelstatedesc':{'type':Sequelize[_0xfbf9('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xfbf9('0x1')]},'language':{'type':Sequelize[_0xfbf9('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfbf9('0x1')]},'exten':{'type':Sequelize[_0xfbf9('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xfbf9('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xfbf9('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xfbf9('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xfbf9('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xfbf9('0x1')]},'destcontext':{'type':Sequelize[_0xfbf9('0x1')]},'destexten':{'type':Sequelize[_0xfbf9('0x1')]},'destpriority':{'type':Sequelize[_0xfbf9('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xfbf9('0x1')]},'inReplyTo':{'type':Sequelize[_0xfbf9('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xfbf9('0x1')]},'cc':{'type':Sequelize[_0xfbf9('0x1')]},'attachment':{'type':Sequelize[_0xfbf9('0x5')]},'html':{'type':Sequelize[_0xfbf9('0x5')]},'text':{'type':Sequelize[_0xfbf9('0x5')]},'status':{'type':Sequelize[_0xfbf9('0x6')](_0xfbf9('0x7'),'SENDING',_0xfbf9('0x8'),_0xfbf9('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xfbf9('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xfbf9('0x2')]}}; \ No newline at end of file +var _0x32ba=['FAILED','sequelize','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED'];(function(_0x3f511f,_0x464151){var _0x59a173=function(_0x19b1a7){while(--_0x19b1a7){_0x3f511f['push'](_0x3f511f['shift']());}};_0x59a173(++_0x464151);}(_0x32ba,0x105));var _0xa32b=function(_0x16a637,_0x5eb627){_0x16a637=_0x16a637-0x0;var _0x25126d=_0x32ba[_0x16a637];return _0x25126d;};'use strict';var Sequelize=require(_0xa32b('0x0'));module['exports']={'integration':{'type':Sequelize[_0xa32b('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xa32b('0x1')]},'ticketId':{'type':Sequelize[_0xa32b('0x1')]},'integrationId':{'type':Sequelize[_0xa32b('0x2')]},'contacts':{'type':Sequelize[_0xa32b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa32b('0x1')]},'queue':{'type':Sequelize[_0xa32b('0x1')]},'interface':{'type':Sequelize[_0xa32b('0x1')]},'membername':{'type':Sequelize[_0xa32b('0x1')]},'agentcalledAt':{'type':Sequelize[_0xa32b('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xa32b('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xa32b('0x3')]},'talktime':{'type':Sequelize[_0xa32b('0x2')]},'agentacw':{'type':Sequelize[_0xa32b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa32b('0x2')]},'reason':{'type':Sequelize[_0xa32b('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xa32b('0x1')]},'channel':{'type':Sequelize[_0xa32b('0x1')]},'channelstate':{'type':Sequelize[_0xa32b('0x2')]},'channelstatedesc':{'type':Sequelize[_0xa32b('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa32b('0x1')]},'connectedlinename':{'type':Sequelize[_0xa32b('0x1')]},'language':{'type':Sequelize[_0xa32b('0x1')]},'accountcode':{'type':Sequelize[_0xa32b('0x1')]},'context':{'type':Sequelize[_0xa32b('0x1')]},'exten':{'type':Sequelize[_0xa32b('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xa32b('0x1')]},'destchannelstate':{'type':Sequelize[_0xa32b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa32b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xa32b('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa32b('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa32b('0x1')]},'destcontext':{'type':Sequelize[_0xa32b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xa32b('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xa32b('0x1')]},'inReplyTo':{'type':Sequelize[_0xa32b('0x1')]},'subject':{'type':Sequelize[_0xa32b('0x1')]},'from':{'type':Sequelize[_0xa32b('0x1')]},'to':{'type':Sequelize[_0xa32b('0x1')]},'cc':{'type':Sequelize[_0xa32b('0x1')]},'attachment':{'type':Sequelize[_0xa32b('0x5')]},'html':{'type':Sequelize[_0xa32b('0x5')]},'text':{'type':Sequelize[_0xa32b('0x5')]},'status':{'type':Sequelize['ENUM'](_0xa32b('0x6'),_0xa32b('0x7'),_0xa32b('0x8'),_0xa32b('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xa32b('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index b62b3f9..27d60f6 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 _0xbc76=['map','IntegrationReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','stack','name','send','index'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0xbc76,0x1db));var _0x6bc7=function(_0x57b5e5,_0x508c49){_0x57b5e5=_0x57b5e5-0x0;var _0x5bdd43=_0xbc76[_0x57b5e5];return _0x5bdd43;};'use strict';var emlformat=require(_0x6bc7('0x0'));var rimraf=require(_0x6bc7('0x1'));var zipdir=require(_0x6bc7('0x2'));var jsonpatch=require(_0x6bc7('0x3'));var rp=require('request-promise');var moment=require(_0x6bc7('0x4'));var BPromise=require(_0x6bc7('0x5'));var Mustache=require(_0x6bc7('0x6'));var util=require(_0x6bc7('0x7'));var path=require(_0x6bc7('0x8'));var sox=require(_0x6bc7('0x9'));var csv=require(_0x6bc7('0xa'));var ejs=require(_0x6bc7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6bc7('0xc'));var squel=require(_0x6bc7('0xd'));var crypto=require('crypto');var jsforce=require(_0x6bc7('0xe'));var deskjs=require(_0x6bc7('0xf'));var toCsv=require(_0x6bc7('0xa'));var querystring=require(_0x6bc7('0x10'));var Papa=require('papaparse');var Redis=require(_0x6bc7('0x11'));var authService=require(_0x6bc7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6bc7('0x13'));var hardwareService=require(_0x6bc7('0x14'));var logger=require(_0x6bc7('0x15'))('api');var utils=require(_0x6bc7('0x16'));var config=require(_0x6bc7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6bc7('0x18'))['db'];function respondWithStatusCode(_0x46a024,_0x1242f0){_0x1242f0=_0x1242f0||0xcc;return function(_0x14233d){if(_0x14233d){return _0x46a024[_0x6bc7('0x19')](_0x1242f0);}return _0x46a024['status'](_0x1242f0)[_0x6bc7('0x1a')]();};}function respondWithResult(_0x4954b3,_0x304aed){_0x304aed=_0x304aed||0xc8;return function(_0x4dba60){if(_0x4dba60){return _0x4954b3[_0x6bc7('0x1b')](_0x304aed)[_0x6bc7('0x1c')](_0x4dba60);}};}function respondWithFilteredResult(_0x2dc828,_0xfe7afd){return function(_0x5340b6){if(_0x5340b6){var _0x22f4e1=typeof _0xfe7afd['offset']===_0x6bc7('0x1d')&&typeof _0xfe7afd[_0x6bc7('0x1e')]===_0x6bc7('0x1d');var _0x29ee6b=_0x5340b6['count'];var _0x32c483=_0x22f4e1?0x0:_0xfe7afd['offset'];var _0x426af6=_0x22f4e1?_0x5340b6[_0x6bc7('0x1f')]:_0xfe7afd[_0x6bc7('0x20')]+_0xfe7afd[_0x6bc7('0x1e')];var _0x32d6f2;if(_0x426af6>=_0x29ee6b){_0x426af6=_0x29ee6b;_0x32d6f2=0xc8;}else{_0x32d6f2=0xce;}_0x2dc828[_0x6bc7('0x1b')](_0x32d6f2);return _0x2dc828[_0x6bc7('0x21')]('Content-Range',_0x32c483+'-'+_0x426af6+'/'+_0x29ee6b)['json'](_0x5340b6);}return null;};}function patchUpdates(_0x9d8229){return function(_0x448f08){try{jsonpatch[_0x6bc7('0x22')](_0x448f08,_0x9d8229,!![]);}catch(_0x4802a3){return BPromise['reject'](_0x4802a3);}return _0x448f08[_0x6bc7('0x23')]();};}function saveUpdates(_0x2fcf26,_0x2771a0){return function(_0x4efa69){if(_0x4efa69){return _0x4efa69[_0x6bc7('0x24')](_0x2fcf26)[_0x6bc7('0x25')](function(_0x46154b){return _0x46154b;});}return null;};}function removeEntity(_0x333289,_0x315e31){return function(_0xd025b1){if(_0xd025b1){return _0xd025b1[_0x6bc7('0x26')]()['then'](function(){_0x333289[_0x6bc7('0x1b')](0xcc)[_0x6bc7('0x1a')]();});}};}function handleEntityNotFound(_0x16237a,_0x3b6726){return function(_0x4ee095){if(!_0x4ee095){_0x16237a[_0x6bc7('0x19')](0x194);}return _0x4ee095;};}function handleError(_0x5b1aad,_0x111bb3){_0x111bb3=_0x111bb3||0x1f4;return function(_0x2768aa){logger['error'](_0x2768aa[_0x6bc7('0x27')]);if(_0x2768aa[_0x6bc7('0x28')]){delete _0x2768aa[_0x6bc7('0x28')];}_0x5b1aad[_0x6bc7('0x1b')](_0x111bb3)[_0x6bc7('0x29')](_0x2768aa);};}exports[_0x6bc7('0x2a')]=function(_0xec512d,_0x4460fc){var _0x3eed23={},_0x2ea90b={},_0x42d9e7={'count':0x0,'rows':[]};var _0x734f9e=_[_0x6bc7('0x2b')](db[_0x6bc7('0x2c')][_0x6bc7('0x2d')],function(_0x1a4375){return{'name':_0x1a4375[_0x6bc7('0x2e')],'type':_0x1a4375['type'][_0x6bc7('0x2f')]};});_0x2ea90b[_0x6bc7('0x30')]=_[_0x6bc7('0x2b')](_0x734f9e,_0x6bc7('0x28'));_0x2ea90b['query']=_[_0x6bc7('0x31')](_0xec512d[_0x6bc7('0x32')]);_0x2ea90b[_0x6bc7('0x33')]=_[_0x6bc7('0x34')](_0x2ea90b[_0x6bc7('0x30')],_0x2ea90b['query']);_0x3eed23[_0x6bc7('0x35')]=_[_0x6bc7('0x34')](_0x2ea90b[_0x6bc7('0x30')],qs[_0x6bc7('0x36')](_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x36')]));_0x3eed23[_0x6bc7('0x35')]=_0x3eed23['attributes'][_0x6bc7('0x37')]?_0x3eed23[_0x6bc7('0x35')]:_0x2ea90b[_0x6bc7('0x30')];if(!_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x38')]('nolimit')){_0x3eed23[_0x6bc7('0x1e')]=qs[_0x6bc7('0x1e')](_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x1e')]);_0x3eed23[_0x6bc7('0x20')]=qs[_0x6bc7('0x20')](_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x20')]);}_0x3eed23[_0x6bc7('0x39')]=qs[_0x6bc7('0x3a')](_0xec512d['query']['sort']);_0x3eed23[_0x6bc7('0x3b')]=qs['filters'](_['pick'](_0xec512d[_0x6bc7('0x32')],_0x2ea90b[_0x6bc7('0x33')]),_0x734f9e);if(_0xec512d['query'][_0x6bc7('0x3c')]){_0x3eed23[_0x6bc7('0x3b')]=_[_0x6bc7('0x3d')](_0x3eed23[_0x6bc7('0x3b')],{'$or':_[_0x6bc7('0x2b')](_0x734f9e,function(_0x54998d){if(_0x54998d[_0x6bc7('0x3e')]!=='VIRTUAL'){var _0x4cedae={};_0x4cedae[_0x54998d[_0x6bc7('0x28')]]={'$like':'%'+_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x3c')]+'%'};return _0x4cedae;}})});}_0x3eed23=_[_0x6bc7('0x3d')]({},_0x3eed23,_0xec512d['options']);var _0x10cc8c={'where':_0x3eed23[_0x6bc7('0x3b')]};return db[_0x6bc7('0x2c')]['count'](_0x10cc8c)[_0x6bc7('0x25')](function(_0x3584e9){_0x42d9e7[_0x6bc7('0x1f')]=_0x3584e9;if(_0xec512d[_0x6bc7('0x32')][_0x6bc7('0x3f')]){_0x3eed23['include']=[{'all':!![]}];}return db[_0x6bc7('0x2c')][_0x6bc7('0x40')](_0x3eed23);})[_0x6bc7('0x25')](function(_0x51cb4d){_0x42d9e7[_0x6bc7('0x41')]=_0x51cb4d;return _0x42d9e7;})['then'](respondWithFilteredResult(_0x4460fc,_0x3eed23))[_0x6bc7('0x42')](handleError(_0x4460fc,null));};exports[_0x6bc7('0x43')]=function(_0x5194f5,_0x57c4dc){var _0x28ffd4={'raw':![],'where':{'id':_0x5194f5[_0x6bc7('0x44')]['id']}},_0x2edfe9={};_0x2edfe9[_0x6bc7('0x30')]=_[_0x6bc7('0x31')](db[_0x6bc7('0x2c')][_0x6bc7('0x2d')]);_0x2edfe9[_0x6bc7('0x32')]=_[_0x6bc7('0x31')](_0x5194f5[_0x6bc7('0x32')]);_0x2edfe9['filters']=_['intersection'](_0x2edfe9[_0x6bc7('0x30')],_0x2edfe9[_0x6bc7('0x32')]);_0x28ffd4['attributes']=_['intersection'](_0x2edfe9[_0x6bc7('0x30')],qs[_0x6bc7('0x36')](_0x5194f5['query'][_0x6bc7('0x36')]));_0x28ffd4[_0x6bc7('0x35')]=_0x28ffd4[_0x6bc7('0x35')][_0x6bc7('0x37')]?_0x28ffd4[_0x6bc7('0x35')]:_0x2edfe9['model'];if(_0x5194f5[_0x6bc7('0x32')][_0x6bc7('0x3f')]){_0x28ffd4[_0x6bc7('0x45')]=[{'all':!![]}];}_0x28ffd4=_['merge']({},_0x28ffd4,_0x5194f5['options']);return db[_0x6bc7('0x2c')][_0x6bc7('0x46')](_0x28ffd4)['then'](handleEntityNotFound(_0x57c4dc,null))[_0x6bc7('0x25')](respondWithResult(_0x57c4dc,null))[_0x6bc7('0x42')](handleError(_0x57c4dc,null));};exports['create']=function(_0x31708d,_0x1999d7){return db[_0x6bc7('0x2c')][_0x6bc7('0x47')](_0x31708d['body'],{})[_0x6bc7('0x25')](respondWithResult(_0x1999d7,0xc9))[_0x6bc7('0x42')](handleError(_0x1999d7,null));};exports[_0x6bc7('0x24')]=function(_0xbc2dbe,_0x17850d){if(_0xbc2dbe[_0x6bc7('0x48')]['id']){delete _0xbc2dbe[_0x6bc7('0x48')]['id'];}return db[_0x6bc7('0x2c')][_0x6bc7('0x46')]({'where':{'id':_0xbc2dbe[_0x6bc7('0x44')]['id']}})['then'](handleEntityNotFound(_0x17850d,null))[_0x6bc7('0x25')](saveUpdates(_0xbc2dbe[_0x6bc7('0x48')],null))[_0x6bc7('0x25')](respondWithResult(_0x17850d,null))['catch'](handleError(_0x17850d,null));};exports[_0x6bc7('0x26')]=function(_0x13d1a7,_0x4f4f1a){return db[_0x6bc7('0x2c')][_0x6bc7('0x46')]({'where':{'id':_0x13d1a7[_0x6bc7('0x44')]['id']}})[_0x6bc7('0x25')](handleEntityNotFound(_0x4f4f1a,null))[_0x6bc7('0x25')](removeEntity(_0x4f4f1a,null))[_0x6bc7('0x42')](handleError(_0x4f4f1a,null));};exports[_0x6bc7('0x49')]=function(_0x460622,_0x56833f){return db[_0x6bc7('0x2c')][_0x6bc7('0x49')]()['then'](respondWithResult(_0x56833f,null))[_0x6bc7('0x42')](handleError(_0x56833f,null));}; \ No newline at end of file +var _0xf02e=['body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','findAll','rows','catch','show','params','includeAll','include','merge','options','create'];(function(_0x1131d6,_0x11257a){var _0x3a4e6e=function(_0x21acf7){while(--_0x21acf7){_0x1131d6['push'](_0x1131d6['shift']());}};_0x3a4e6e(++_0x11257a);}(_0xf02e,0x1be));var _0xef02=function(_0x143b8f,_0x34492c){_0x143b8f=_0x143b8f-0x0;var _0x480fa6=_0xf02e[_0x143b8f];return _0x480fa6;};'use strict';var emlformat=require(_0xef02('0x0'));var rimraf=require(_0xef02('0x1'));var zipdir=require(_0xef02('0x2'));var jsonpatch=require(_0xef02('0x3'));var rp=require(_0xef02('0x4'));var moment=require(_0xef02('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xef02('0x6'));var path=require(_0xef02('0x7'));var sox=require(_0xef02('0x8'));var csv=require(_0xef02('0x9'));var ejs=require(_0xef02('0xa'));var fs=require('fs');var fs_extra=require(_0xef02('0xb'));var _=require(_0xef02('0xc'));var squel=require(_0xef02('0xd'));var crypto=require('crypto');var jsforce=require(_0xef02('0xe'));var deskjs=require(_0xef02('0xf'));var toCsv=require(_0xef02('0x9'));var querystring=require(_0xef02('0x10'));var Papa=require(_0xef02('0x11'));var Redis=require(_0xef02('0x12'));var authService=require(_0xef02('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef02('0x14'));var logger=require(_0xef02('0x15'))(_0xef02('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xef02('0x17'));var db=require(_0xef02('0x18'))['db'];function respondWithStatusCode(_0x14e192,_0x353fc6){_0x353fc6=_0x353fc6||0xcc;return function(_0xf88f5c){if(_0xf88f5c){return _0x14e192['sendStatus'](_0x353fc6);}return _0x14e192['status'](_0x353fc6)[_0xef02('0x19')]();};}function respondWithResult(_0x56b92b,_0x4536fb){_0x4536fb=_0x4536fb||0xc8;return function(_0xe1579c){if(_0xe1579c){return _0x56b92b[_0xef02('0x1a')](_0x4536fb)[_0xef02('0x1b')](_0xe1579c);}};}function respondWithFilteredResult(_0x33b483,_0x3faa40){return function(_0x7178c5){if(_0x7178c5){var _0x1de1f8=typeof _0x3faa40[_0xef02('0x1c')]===_0xef02('0x1d')&&typeof _0x3faa40['limit']==='undefined';var _0x5751d3=_0x7178c5[_0xef02('0x1e')];var _0xfc0805=_0x1de1f8?0x0:_0x3faa40[_0xef02('0x1c')];var _0xcfdc1e=_0x1de1f8?_0x7178c5['count']:_0x3faa40[_0xef02('0x1c')]+_0x3faa40[_0xef02('0x1f')];var _0x550554;if(_0xcfdc1e>=_0x5751d3){_0xcfdc1e=_0x5751d3;_0x550554=0xc8;}else{_0x550554=0xce;}_0x33b483['status'](_0x550554);return _0x33b483[_0xef02('0x20')](_0xef02('0x21'),_0xfc0805+'-'+_0xcfdc1e+'/'+_0x5751d3)[_0xef02('0x1b')](_0x7178c5);}return null;};}function patchUpdates(_0x476642){return function(_0x15e7ce){try{jsonpatch[_0xef02('0x22')](_0x15e7ce,_0x476642,!![]);}catch(_0x34f90b){return BPromise[_0xef02('0x23')](_0x34f90b);}return _0x15e7ce[_0xef02('0x24')]();};}function saveUpdates(_0x5f22af,_0x368a4d){return function(_0x4cd224){if(_0x4cd224){return _0x4cd224[_0xef02('0x25')](_0x5f22af)['then'](function(_0x406096){return _0x406096;});}return null;};}function removeEntity(_0x49c567,_0x5bcc4e){return function(_0x4ebec8){if(_0x4ebec8){return _0x4ebec8[_0xef02('0x26')]()[_0xef02('0x27')](function(){_0x49c567[_0xef02('0x1a')](0xcc)[_0xef02('0x19')]();});}};}function handleEntityNotFound(_0x4d587b,_0x1aec32){return function(_0x27bfcc){if(!_0x27bfcc){_0x4d587b[_0xef02('0x28')](0x194);}return _0x27bfcc;};}function handleError(_0x121f51,_0x1bb934){_0x1bb934=_0x1bb934||0x1f4;return function(_0x4f613e){logger[_0xef02('0x29')](_0x4f613e[_0xef02('0x2a')]);if(_0x4f613e[_0xef02('0x2b')]){delete _0x4f613e[_0xef02('0x2b')];}_0x121f51[_0xef02('0x1a')](_0x1bb934)[_0xef02('0x2c')](_0x4f613e);};}exports['index']=function(_0x5c80d9,_0x4008ee){var _0xf29661={},_0x5d1206={},_0x36261b={'count':0x0,'rows':[]};var _0x3905b9=_[_0xef02('0x2d')](db[_0xef02('0x2e')][_0xef02('0x2f')],function(_0x48c974){return{'name':_0x48c974['fieldName'],'type':_0x48c974[_0xef02('0x30')][_0xef02('0x31')]};});_0x5d1206[_0xef02('0x32')]=_['map'](_0x3905b9,_0xef02('0x2b'));_0x5d1206[_0xef02('0x33')]=_[_0xef02('0x34')](_0x5c80d9[_0xef02('0x33')]);_0x5d1206[_0xef02('0x35')]=_[_0xef02('0x36')](_0x5d1206[_0xef02('0x32')],_0x5d1206[_0xef02('0x33')]);_0xf29661[_0xef02('0x37')]=_[_0xef02('0x36')](_0x5d1206[_0xef02('0x32')],qs[_0xef02('0x38')](_0x5c80d9[_0xef02('0x33')]['fields']));_0xf29661[_0xef02('0x37')]=_0xf29661[_0xef02('0x37')][_0xef02('0x39')]?_0xf29661[_0xef02('0x37')]:_0x5d1206['model'];if(!_0x5c80d9['query']['hasOwnProperty']('nolimit')){_0xf29661[_0xef02('0x1f')]=qs[_0xef02('0x1f')](_0x5c80d9[_0xef02('0x33')][_0xef02('0x1f')]);_0xf29661[_0xef02('0x1c')]=qs[_0xef02('0x1c')](_0x5c80d9['query'][_0xef02('0x1c')]);}_0xf29661[_0xef02('0x3a')]=qs[_0xef02('0x3b')](_0x5c80d9[_0xef02('0x33')][_0xef02('0x3b')]);_0xf29661['where']=qs[_0xef02('0x35')](_['pick'](_0x5c80d9['query'],_0x5d1206[_0xef02('0x35')]),_0x3905b9);if(_0x5c80d9[_0xef02('0x33')]['filter']){_0xf29661[_0xef02('0x3c')]=_['merge'](_0xf29661[_0xef02('0x3c')],{'$or':_['map'](_0x3905b9,function(_0x23865e){if(_0x23865e[_0xef02('0x30')]!=='VIRTUAL'){var _0x332e31={};_0x332e31[_0x23865e[_0xef02('0x2b')]]={'$like':'%'+_0x5c80d9[_0xef02('0x33')][_0xef02('0x3d')]+'%'};return _0x332e31;}})});}_0xf29661=_['merge']({},_0xf29661,_0x5c80d9['options']);var _0x276654={'where':_0xf29661[_0xef02('0x3c')]};return db['IntegrationReport'][_0xef02('0x1e')](_0x276654)[_0xef02('0x27')](function(_0x3aed08){_0x36261b[_0xef02('0x1e')]=_0x3aed08;if(_0x5c80d9[_0xef02('0x33')]['includeAll']){_0xf29661['include']=[{'all':!![]}];}return db[_0xef02('0x2e')][_0xef02('0x3e')](_0xf29661);})[_0xef02('0x27')](function(_0x4fdca2){_0x36261b[_0xef02('0x3f')]=_0x4fdca2;return _0x36261b;})[_0xef02('0x27')](respondWithFilteredResult(_0x4008ee,_0xf29661))[_0xef02('0x40')](handleError(_0x4008ee,null));};exports[_0xef02('0x41')]=function(_0x36a08d,_0x3dc46f){var _0xfb08c2={'raw':![],'where':{'id':_0x36a08d[_0xef02('0x42')]['id']}},_0x21dbd={};_0x21dbd[_0xef02('0x32')]=_[_0xef02('0x34')](db[_0xef02('0x2e')]['rawAttributes']);_0x21dbd[_0xef02('0x33')]=_[_0xef02('0x34')](_0x36a08d['query']);_0x21dbd['filters']=_[_0xef02('0x36')](_0x21dbd[_0xef02('0x32')],_0x21dbd[_0xef02('0x33')]);_0xfb08c2['attributes']=_[_0xef02('0x36')](_0x21dbd[_0xef02('0x32')],qs[_0xef02('0x38')](_0x36a08d[_0xef02('0x33')]['fields']));_0xfb08c2['attributes']=_0xfb08c2['attributes'][_0xef02('0x39')]?_0xfb08c2[_0xef02('0x37')]:_0x21dbd['model'];if(_0x36a08d['query'][_0xef02('0x43')]){_0xfb08c2[_0xef02('0x44')]=[{'all':!![]}];}_0xfb08c2=_[_0xef02('0x45')]({},_0xfb08c2,_0x36a08d[_0xef02('0x46')]);return db[_0xef02('0x2e')]['find'](_0xfb08c2)[_0xef02('0x27')](handleEntityNotFound(_0x3dc46f,null))['then'](respondWithResult(_0x3dc46f,null))['catch'](handleError(_0x3dc46f,null));};exports[_0xef02('0x47')]=function(_0x568de0,_0x8df21d){return db['IntegrationReport']['create'](_0x568de0[_0xef02('0x48')],{})['then'](respondWithResult(_0x8df21d,0xc9))[_0xef02('0x40')](handleError(_0x8df21d,null));};exports['update']=function(_0x2bee48,_0x4e5400){if(_0x2bee48[_0xef02('0x48')]['id']){delete _0x2bee48[_0xef02('0x48')]['id'];}return db[_0xef02('0x2e')][_0xef02('0x49')]({'where':{'id':_0x2bee48['params']['id']}})[_0xef02('0x27')](handleEntityNotFound(_0x4e5400,null))['then'](saveUpdates(_0x2bee48['body'],null))[_0xef02('0x27')](respondWithResult(_0x4e5400,null))[_0xef02('0x40')](handleError(_0x4e5400,null));};exports[_0xef02('0x26')]=function(_0x10e8d6,_0x37146b){return db['IntegrationReport']['find']({'where':{'id':_0x10e8d6[_0xef02('0x42')]['id']}})['then'](handleEntityNotFound(_0x37146b,null))[_0xef02('0x27')](removeEntity(_0x37146b,null))['catch'](handleError(_0x37146b,null));};exports['describe']=function(_0x4bbfa8,_0x265fdc){return db[_0xef02('0x2e')]['describe']()[_0xef02('0x27')](respondWithResult(_0x265fdc,null))[_0xef02('0x40')](handleError(_0x265fdc,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 5b998d6..541384b 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 _0x8a89=['moment','bluebird','request-promise','rimraf','../../config/environment','define','IntegrationReport','report_integration','../../config/logger','api'];(function(_0x510fad,_0x283c39){var _0x249cc9=function(_0x5a9740){while(--_0x5a9740){_0x510fad['push'](_0x510fad['shift']());}};_0x249cc9(++_0x283c39);}(_0x8a89,0x148));var _0x98a8=function(_0x43de22,_0x1eced6){_0x43de22=_0x43de22-0x0;var _0x4b15ee=_0x8a89[_0x43de22];return _0x4b15ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x98a8('0x0'))(_0x98a8('0x1'));var moment=require(_0x98a8('0x2'));var BPromise=require(_0x98a8('0x3'));var rp=require(_0x98a8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98a8('0x5'));var config=require(_0x98a8('0x6'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x4947d7,_0x581f89){return _0x4947d7[_0x98a8('0x7')](_0x98a8('0x8'),attributes,{'tableName':_0x98a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','path','rimraf'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x323f,0xba));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require(_0xf323('0x1'))(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf323('0x4'));var rimraf=require(_0xf323('0x5'));var config=require(_0xf323('0x6'));var attributes=require(_0xf323('0x7'));module[_0xf323('0x8')]=function(_0x50f543,_0x38a434){return _0x50f543[_0xf323('0x9')](_0xf323('0xa'),attributes,{'tableName':_0xf323('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 2074d87..e8fb998 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 _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2ad5a7,_0x5195dc){var _0x359b08=function(_0x541e11){while(--_0x541e11){_0x2ad5a7['push'](_0x2ad5a7['shift']());}};_0x359b08(++_0x5195dc);}(_0x57ca,0x108));var _0xa57c=function(_0x3cf63e,_0x3024c7){_0x3cf63e=_0x3cf63e-0x0;var _0x4c2767=_0x57ca[_0x3cf63e];return _0x4c2767;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x23d35d,_0x39c88e){var _0x15e742=function(_0x207d62){while(--_0x207d62){_0x23d35d['push'](_0x23d35d['shift']());}};_0x15e742(++_0x39c88e);}(_0x5fab,0x177));var _0xb5fa=function(_0x2095ed,_0x156cfb){_0x2095ed=_0x2095ed-0x0;var _0x22dbb0=_0x5fab[_0x2095ed];return _0x22dbb0;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index ceec28b..e368a9f 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 _0x5b20=['/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','index','/:id','show','get'];(function(_0x370700,_0x13e1ef){var _0x2c176d=function(_0x37ffc3){while(--_0x37ffc3){_0x370700['push'](_0x370700['shift']());}};_0x2c176d(++_0x13e1ef);}(_0x5b20,0x86));var _0x05b2=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x5b20[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x05b2('0x0'));var util=require(_0x05b2('0x1'));var path=require(_0x05b2('0x2'));var timeout=require(_0x05b2('0x3'));var express=require(_0x05b2('0x4'));var router=express[_0x05b2('0x5')]();var fs_extra=require(_0x05b2('0x6'));var auth=require(_0x05b2('0x7'));var interaction=require(_0x05b2('0x8'));var config=require(_0x05b2('0x9'));var controller=require(_0x05b2('0xa'));router['get']('/',auth[_0x05b2('0xb')](),controller[_0x05b2('0xc')]);router['get'](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller[_0x05b2('0xe')]);router[_0x05b2('0xf')](_0x05b2('0x10'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x11')]);router[_0x05b2('0x12')]('/',auth[_0x05b2('0xb')](),controller[_0x05b2('0x13')]);router[_0x05b2('0x12')](_0x05b2('0x10'),auth[_0x05b2('0xb')](),controller[_0x05b2('0x14')]);router[_0x05b2('0x12')](_0x05b2('0x15'),auth['isAuthenticated'](),controller[_0x05b2('0x16')]);router[_0x05b2('0x17')](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller['update']);router[_0x05b2('0x18')](_0x05b2('0xd'),auth[_0x05b2('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdca7=['isAuthenticated','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','./interval.controller','get','show','/:id/sub_intervals'];(function(_0x401b3e,_0xed8de5){var _0x4f290f=function(_0xa45f77){while(--_0xa45f77){_0x401b3e['push'](_0x401b3e['shift']());}};_0x4f290f(++_0xed8de5);}(_0xdca7,0xe6));var _0x7dca=function(_0x221c76,_0x2ec0b1){_0x221c76=_0x221c76-0x0;var _0x300520=_0xdca7[_0x221c76];return _0x300520;};'use strict';var multer=require(_0x7dca('0x0'));var util=require('util');var path=require(_0x7dca('0x1'));var timeout=require(_0x7dca('0x2'));var express=require(_0x7dca('0x3'));var router=express['Router']();var fs_extra=require(_0x7dca('0x4'));var auth=require(_0x7dca('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7dca('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x7dca('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7dca('0x8')]);router[_0x7dca('0x7')](_0x7dca('0x9'),auth[_0x7dca('0xa')](),controller[_0x7dca('0xb')]);router[_0x7dca('0xc')]('/',auth[_0x7dca('0xa')](),controller[_0x7dca('0xd')]);router[_0x7dca('0xc')](_0x7dca('0x9'),auth[_0x7dca('0xa')](),controller[_0x7dca('0xe')]);router['post'](_0x7dca('0xf'),auth[_0x7dca('0xa')](),controller['addIntervals']);router[_0x7dca('0x10')](_0x7dca('0x11'),auth[_0x7dca('0xa')](),controller['update']);router['delete'](_0x7dca('0x11'),auth[_0x7dca('0xa')](),controller[_0x7dca('0x12')]);module[_0x7dca('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c8ca8f9..245b6c8 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 _0xc762=['sequelize','STRING'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0xc762,0x198));var _0x2c76=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xc762[_0x260e4b];return _0x18dfba;};'use strict';var Sequelize=require(_0x2c76('0x0'));module['exports']={'name':{'type':Sequelize[_0x2c76('0x1')]},'description':{'type':Sequelize[_0x2c76('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x92bd=['sequelize','exports','STRING'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x92bd,0x99));var _0xd92b=function(_0x1d4eac,_0x10d64b){_0x1d4eac=_0x1d4eac-0x0;var _0x2c7b9a=_0x92bd[_0x1d4eac];return _0x2c7b9a;};'use strict';var Sequelize=require(_0xd92b('0x0'));module[_0xd92b('0x1')]={'name':{'type':Sequelize[_0xd92b('0x2')]},'description':{'type':Sequelize[_0xd92b('0x2')]},'interval':{'type':Sequelize[_0xd92b('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 189d524..bf31c39 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 _0x4b8e=['order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Interval','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','limit'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x4b8e,0x81));var _0xe4b8=function(_0x1d930e,_0x20d8b8){_0x1d930e=_0x1d930e-0x0;var _0x5bbd66=_0x4b8e[_0x1d930e];return _0x5bbd66;};'use strict';var emlformat=require(_0xe4b8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4b8('0x1'));var jsonpatch=require(_0xe4b8('0x2'));var rp=require(_0xe4b8('0x3'));var moment=require(_0xe4b8('0x4'));var BPromise=require(_0xe4b8('0x5'));var Mustache=require(_0xe4b8('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe4b8('0x7'));var csv=require(_0xe4b8('0x8'));var ejs=require(_0xe4b8('0x9'));var fs=require('fs');var fs_extra=require(_0xe4b8('0xa'));var _=require(_0xe4b8('0xb'));var squel=require(_0xe4b8('0xc'));var crypto=require(_0xe4b8('0xd'));var jsforce=require(_0xe4b8('0xe'));var deskjs=require(_0xe4b8('0xf'));var toCsv=require(_0xe4b8('0x8'));var querystring=require(_0xe4b8('0x10'));var Papa=require(_0xe4b8('0x11'));var Redis=require(_0xe4b8('0x12'));var authService=require(_0xe4b8('0x13'));var qs=require(_0xe4b8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4b8('0x15'));var logger=require(_0xe4b8('0x16'))(_0xe4b8('0x17'));var utils=require('../../config/utils');var config=require(_0xe4b8('0x18'));var licenseUtil=require(_0xe4b8('0x19'));var db=require(_0xe4b8('0x1a'))['db'];var extensions=require(_0xe4b8('0x1b'));function respondWithStatusCode(_0x266842,_0x336a78){_0x336a78=_0x336a78||0xcc;return function(_0x17145b){if(_0x17145b){return _0x266842[_0xe4b8('0x1c')](_0x336a78);}return _0x266842[_0xe4b8('0x1d')](_0x336a78)[_0xe4b8('0x1e')]();};}function respondWithResult(_0x35580a,_0x117e0f){_0x117e0f=_0x117e0f||0xc8;return function(_0x29b910){if(_0x29b910){return _0x35580a[_0xe4b8('0x1d')](_0x117e0f)[_0xe4b8('0x1f')](_0x29b910);}};}function respondWithFilteredResult(_0x2eae91,_0x1e40d3){return function(_0x252592){if(_0x252592){var _0x38a290=typeof _0x1e40d3[_0xe4b8('0x20')]==='undefined'&&typeof _0x1e40d3['limit']===_0xe4b8('0x21');var _0x5ce8d2=_0x252592[_0xe4b8('0x22')];var _0x1dbab6=_0x38a290?0x0:_0x1e40d3[_0xe4b8('0x20')];var _0x42c02c=_0x38a290?_0x252592['count']:_0x1e40d3[_0xe4b8('0x20')]+_0x1e40d3['limit'];var _0x479f10;if(_0x42c02c>=_0x5ce8d2){_0x42c02c=_0x5ce8d2;_0x479f10=0xc8;}else{_0x479f10=0xce;}_0x2eae91[_0xe4b8('0x1d')](_0x479f10);return _0x2eae91[_0xe4b8('0x23')](_0xe4b8('0x24'),_0x1dbab6+'-'+_0x42c02c+'/'+_0x5ce8d2)[_0xe4b8('0x1f')](_0x252592);}return null;};}function patchUpdates(_0x300041){return function(_0x2e10b2){try{jsonpatch[_0xe4b8('0x25')](_0x2e10b2,_0x300041,!![]);}catch(_0x29098f){return BPromise[_0xe4b8('0x26')](_0x29098f);}return _0x2e10b2[_0xe4b8('0x27')]();};}function saveUpdates(_0x4c7712,_0x392bc4){return function(_0x48ea96){if(_0x48ea96){return _0x48ea96[_0xe4b8('0x28')](_0x4c7712)[_0xe4b8('0x29')](function(_0x197ef7){return _0x197ef7;});}return null;};}function removeEntity(_0x4066f2,_0x39876b){return function(_0x112e1e){if(_0x112e1e){return _0x112e1e[_0xe4b8('0x2a')]()[_0xe4b8('0x29')](function(){var _0x37121a=_0x112e1e[_0xe4b8('0x2b')]({'plain':!![]});var _0x5b1a29=_0xe4b8('0x2c');return db[_0xe4b8('0x2d')][_0xe4b8('0x2a')]({'where':{'type':_0x5b1a29,'resourceId':_0x37121a['id']}})[_0xe4b8('0x29')](function(){return _0x112e1e;});})[_0xe4b8('0x29')](function(){_0x4066f2['status'](0xcc)[_0xe4b8('0x1e')]();});}};}function handleEntityNotFound(_0x49fccf,_0x14ffbd){return function(_0x2f7611){if(!_0x2f7611){_0x49fccf[_0xe4b8('0x1c')](0x194);}return _0x2f7611;};}function handleError(_0x1e20a0,_0x11a0b2){_0x11a0b2=_0x11a0b2||0x1f4;return function(_0x50c5cc){logger[_0xe4b8('0x2e')](_0x50c5cc[_0xe4b8('0x2f')]);if(_0x50c5cc[_0xe4b8('0x30')]){delete _0x50c5cc[_0xe4b8('0x30')];}_0x1e20a0[_0xe4b8('0x1d')](_0x11a0b2)['send'](_0x50c5cc);};}exports[_0xe4b8('0x31')]=function(_0x44e09e,_0x16ad41){var _0x5c3240={},_0x31739e={},_0x15fbe2={'count':0x0,'rows':[]};var _0x5244d5=_['map'](db['Interval'][_0xe4b8('0x32')],function(_0x5772a7){return{'name':_0x5772a7[_0xe4b8('0x33')],'type':_0x5772a7[_0xe4b8('0x34')][_0xe4b8('0x35')]};});_0x31739e[_0xe4b8('0x36')]=_[_0xe4b8('0x37')](_0x5244d5,'name');_0x31739e[_0xe4b8('0x38')]=_[_0xe4b8('0x39')](_0x44e09e[_0xe4b8('0x38')]);_0x31739e['filters']=_[_0xe4b8('0x3a')](_0x31739e[_0xe4b8('0x36')],_0x31739e['query']);_0x5c3240['attributes']=_['intersection'](_0x31739e[_0xe4b8('0x36')],qs[_0xe4b8('0x3b')](_0x44e09e[_0xe4b8('0x38')][_0xe4b8('0x3b')]));_0x5c3240[_0xe4b8('0x3c')]=_0x5c3240['attributes'][_0xe4b8('0x3d')]?_0x5c3240[_0xe4b8('0x3c')]:_0x31739e['model'];if(!_0x44e09e[_0xe4b8('0x38')]['hasOwnProperty']('nolimit')){_0x5c3240[_0xe4b8('0x3e')]=qs['limit'](_0x44e09e[_0xe4b8('0x38')]['limit']);_0x5c3240[_0xe4b8('0x20')]=qs[_0xe4b8('0x20')](_0x44e09e[_0xe4b8('0x38')][_0xe4b8('0x20')]);}_0x5c3240[_0xe4b8('0x3f')]=qs['sort'](_0x44e09e[_0xe4b8('0x38')][_0xe4b8('0x40')]);_0x5c3240['where']=qs[_0xe4b8('0x41')](_[_0xe4b8('0x42')](_0x44e09e[_0xe4b8('0x38')],_0x31739e['filters']),_0x5244d5);if(_0x44e09e[_0xe4b8('0x38')][_0xe4b8('0x43')]){_0x5c3240[_0xe4b8('0x44')]=_[_0xe4b8('0x45')](_0x5c3240[_0xe4b8('0x44')],{'$or':_['map'](_0x5244d5,function(_0x10c50d){if(_0x10c50d[_0xe4b8('0x34')]!==_0xe4b8('0x46')){var _0x59a070={};_0x59a070[_0x10c50d[_0xe4b8('0x30')]]={'$like':'%'+_0x44e09e[_0xe4b8('0x38')]['filter']+'%'};return _0x59a070;}})});}_0x5c3240=_[_0xe4b8('0x45')]({},_0x5c3240,_0x44e09e[_0xe4b8('0x47')]);var _0x26cc3d={'where':_0x5c3240['where']};return db[_0xe4b8('0x48')][_0xe4b8('0x22')](_0x26cc3d)[_0xe4b8('0x29')](function(_0x112e1d){_0x15fbe2[_0xe4b8('0x22')]=_0x112e1d;if(_0x44e09e['query'][_0xe4b8('0x49')]){_0x5c3240[_0xe4b8('0x4a')]=[{'all':!![]}];}return db[_0xe4b8('0x48')][_0xe4b8('0x4b')](_0x5c3240);})[_0xe4b8('0x29')](function(_0x47c73e){_0x15fbe2[_0xe4b8('0x4c')]=_0x47c73e;return _0x15fbe2;})[_0xe4b8('0x29')](respondWithFilteredResult(_0x16ad41,_0x5c3240))[_0xe4b8('0x4d')](handleError(_0x16ad41,null));};exports[_0xe4b8('0x4e')]=function(_0x175773,_0x9403c5){var _0x68f5f7={'raw':!![],'where':{'id':_0x175773[_0xe4b8('0x4f')]['id']}},_0x2f0f72={};_0x2f0f72[_0xe4b8('0x36')]=_[_0xe4b8('0x39')](db['Interval']['rawAttributes']);_0x2f0f72[_0xe4b8('0x38')]=_[_0xe4b8('0x39')](_0x175773[_0xe4b8('0x38')]);_0x2f0f72['filters']=_[_0xe4b8('0x3a')](_0x2f0f72[_0xe4b8('0x36')],_0x2f0f72[_0xe4b8('0x38')]);_0x68f5f7[_0xe4b8('0x3c')]=_[_0xe4b8('0x3a')](_0x2f0f72['model'],qs[_0xe4b8('0x3b')](_0x175773['query'][_0xe4b8('0x3b')]));_0x68f5f7[_0xe4b8('0x3c')]=_0x68f5f7[_0xe4b8('0x3c')][_0xe4b8('0x3d')]?_0x68f5f7[_0xe4b8('0x3c')]:_0x2f0f72['model'];if(_0x175773['query'][_0xe4b8('0x49')]){_0x68f5f7[_0xe4b8('0x4a')]=[{'all':!![]}];}_0x68f5f7=_[_0xe4b8('0x45')]({},_0x68f5f7,_0x175773[_0xe4b8('0x47')]);return db[_0xe4b8('0x48')][_0xe4b8('0x50')](_0x68f5f7)['then'](handleEntityNotFound(_0x9403c5,null))['then'](respondWithResult(_0x9403c5,null))[_0xe4b8('0x4d')](handleError(_0x9403c5,null));};exports[_0xe4b8('0x51')]=function(_0x10b8f5,_0x3e394f){return db['Interval'][_0xe4b8('0x51')](_0x10b8f5[_0xe4b8('0x52')],{})[_0xe4b8('0x29')](function(_0x238d23){var _0x1d276e=_0x10b8f5[_0xe4b8('0x53')][_0xe4b8('0x2b')]({'plain':!![]});if(!_0x1d276e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d276e[_0xe4b8('0x54')]===_0xe4b8('0x53')){var _0x1ed441=_0x238d23['get']({'plain':!![]});var _0x1b8e68=_0xe4b8('0x2c');return db['UserProfileSection'][_0xe4b8('0x50')]({'where':{'name':_0x1b8e68,'userProfileId':_0x1d276e[_0xe4b8('0x55')]},'raw':!![]})[_0xe4b8('0x29')](function(_0x4ee830){if(_0x4ee830&&_0x4ee830[_0xe4b8('0x56')]===0x0){return db[_0xe4b8('0x2d')][_0xe4b8('0x51')]({'name':_0x1ed441[_0xe4b8('0x30')],'resourceId':_0x1ed441['id'],'type':_0x4ee830['name'],'sectionId':_0x4ee830['id']},{})[_0xe4b8('0x29')](function(){return _0x238d23;});}else{return _0x238d23;}})[_0xe4b8('0x4d')](function(_0x4af06){logger[_0xe4b8('0x2e')](_0xe4b8('0x57'),_0x4af06);throw _0x4af06;});}return _0x238d23;})['then'](respondWithResult(_0x3e394f,0xc9))[_0xe4b8('0x4d')](handleError(_0x3e394f,null));};exports[_0xe4b8('0x28')]=function(_0x4c7aa4,_0x36e51a){if(_0x4c7aa4[_0xe4b8('0x52')]['id']){delete _0x4c7aa4[_0xe4b8('0x52')]['id'];}return db['Interval'][_0xe4b8('0x50')]({'where':{'id':_0x4c7aa4[_0xe4b8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x36e51a,null))[_0xe4b8('0x29')](saveUpdates(_0x4c7aa4[_0xe4b8('0x52')],null))[_0xe4b8('0x29')](respondWithResult(_0x36e51a,null))[_0xe4b8('0x4d')](handleError(_0x36e51a,null));};exports[_0xe4b8('0x2a')]=function(_0x16aeb3,_0x56ebf1){return db['Interval']['find']({'where':{'id':_0x16aeb3['params']['id']}})[_0xe4b8('0x29')](handleEntityNotFound(_0x56ebf1,null))[_0xe4b8('0x29')](removeEntity(_0x56ebf1,null))['catch'](handleError(_0x56ebf1,null));};exports[_0xe4b8('0x58')]=function(_0x7621ae,_0x54dcca,_0x2b2430){if(_0x7621ae[_0xe4b8('0x52')]['id']){delete _0x7621ae[_0xe4b8('0x52')]['id'];}return db[_0xe4b8('0x48')]['find']({'where':{'id':_0x7621ae[_0xe4b8('0x4f')]['id']}})[_0xe4b8('0x29')](handleEntityNotFound(_0x54dcca,null))[_0xe4b8('0x29')](function(_0xc6cc40){if(_0xc6cc40){_0x7621ae[_0xe4b8('0x52')][_0xe4b8('0x59')]=_0xc6cc40['id'];return db[_0xe4b8('0x48')][_0xe4b8('0x51')](_0x7621ae[_0xe4b8('0x52')]);}})['then'](respondWithResult(_0x54dcca,null))[_0xe4b8('0x4d')](handleError(_0x54dcca,null));};exports[_0xe4b8('0x5a')]=function(_0x47a13c,_0x2a15c6,_0x23748d){var _0x2d3b23={};var _0x48ca56={};var _0x5ab0c8;var _0x5e63f7;return db[_0xe4b8('0x48')][_0xe4b8('0x5b')]({'where':{'id':_0x47a13c[_0xe4b8('0x4f')]['id']}})[_0xe4b8('0x29')](handleEntityNotFound(_0x2a15c6,null))[_0xe4b8('0x29')](function(_0x28615e){if(_0x28615e){_0x5ab0c8=_0x28615e;_0x48ca56[_0xe4b8('0x36')]=_[_0xe4b8('0x39')](db[_0xe4b8('0x48')][_0xe4b8('0x32')]);_0x48ca56[_0xe4b8('0x38')]=_['keys'](_0x47a13c[_0xe4b8('0x38')]);_0x48ca56['filters']=_[_0xe4b8('0x3a')](_0x48ca56['model'],_0x48ca56[_0xe4b8('0x38')]);_0x2d3b23['attributes']=_[_0xe4b8('0x3a')](_0x48ca56[_0xe4b8('0x36')],qs[_0xe4b8('0x3b')](_0x47a13c[_0xe4b8('0x38')]['fields']));_0x2d3b23[_0xe4b8('0x3c')]=_0x2d3b23[_0xe4b8('0x3c')][_0xe4b8('0x3d')]?_0x2d3b23[_0xe4b8('0x3c')]:_0x48ca56[_0xe4b8('0x36')];_0x2d3b23[_0xe4b8('0x3f')]=qs[_0xe4b8('0x40')](_0x47a13c[_0xe4b8('0x38')][_0xe4b8('0x40')]);_0x2d3b23[_0xe4b8('0x44')]=qs[_0xe4b8('0x41')](_[_0xe4b8('0x42')](_0x47a13c[_0xe4b8('0x38')],_0x48ca56[_0xe4b8('0x41')]));if(_0x47a13c[_0xe4b8('0x38')][_0xe4b8('0x43')]){_0x2d3b23[_0xe4b8('0x44')]=_[_0xe4b8('0x45')](_0x2d3b23[_0xe4b8('0x44')],{'$or':_[_0xe4b8('0x37')](_0x2d3b23[_0xe4b8('0x3c')],function(_0x475a75){var _0x4b7be5={};_0x4b7be5[_0x475a75]={'$like':'%'+_0x47a13c['query'][_0xe4b8('0x43')]+'%'};return _0x4b7be5;})});}_0x2d3b23=_[_0xe4b8('0x45')]({},_0x2d3b23,_0x47a13c[_0xe4b8('0x47')]);return _0x5ab0c8['getIntervals'](_0x2d3b23);}})['then'](function(_0x4f532b){if(_0x4f532b){_0x5e63f7=_0x4f532b['length'];if(!_0x47a13c['query']['hasOwnProperty']('nolimit')){_0x2d3b23[_0xe4b8('0x3e')]=qs[_0xe4b8('0x3e')](_0x47a13c[_0xe4b8('0x38')][_0xe4b8('0x3e')]);_0x2d3b23['offset']=qs['offset'](_0x47a13c[_0xe4b8('0x38')][_0xe4b8('0x20')]);}return _0x5ab0c8[_0xe4b8('0x5a')](_0x2d3b23);}})[_0xe4b8('0x29')](function(_0x1bc82c){if(_0x1bc82c){return _0x1bc82c?{'count':_0x5e63f7,'rows':_0x1bc82c}:null;}})[_0xe4b8('0x29')](respondWithResult(_0x2a15c6,null))[_0xe4b8('0x4d')](handleError(_0x2a15c6,null));};exports[_0xe4b8('0x5c')]=function(_0x24a256,_0x310a22,_0x4ab224){return db['Interval']['findOne']({'where':{'id':_0x24a256['params']['id']}})[_0xe4b8('0x29')](handleEntityNotFound(_0x310a22,null))[_0xe4b8('0x29')](function(_0x43d657){if(_0x43d657){return db[_0xe4b8('0x5d')][_0xe4b8('0x5e')](function(_0x5d4266){return db[_0xe4b8('0x48')][_0xe4b8('0x2a')]({'where':{'IntervalId':_0x24a256[_0xe4b8('0x4f')]['id']},'transaction':_0x5d4266})[_0xe4b8('0x29')](function(_0x175e37){var _0x2cd664=_[_0xe4b8('0x37')](_0x24a256[_0xe4b8('0x52')],function(_0x51ee9f){delete _0x51ee9f['id'];_0x51ee9f[_0xe4b8('0x59')]=_0x24a256[_0xe4b8('0x4f')]['id'];return _0x51ee9f;});return db[_0xe4b8('0x48')][_0xe4b8('0x5f')](_0x2cd664,{'transaction':_0x5d4266});});})['then'](function(){return db[_0xe4b8('0x48')]['findAll']({'where':{'IntervalId':_0x24a256[_0xe4b8('0x4f')]['id']}});});}})[_0xe4b8('0x29')](respondWithResult(_0x310a22,null))[_0xe4b8('0x4d')](handleError(_0x310a22,null));}; \ No newline at end of file +var _0xd58d=['order','sort','where','pick','filters','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','map','addIntervals','sequelize','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','Intervals','sendStatus','error','stack','name','index','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4d48d6,_0x597d0d){var _0x1199c9=function(_0x1166d2){while(--_0x1166d2){_0x4d48d6['push'](_0x4d48d6['shift']());}};_0x1199c9(++_0x597d0d);}(_0xd58d,0xd6));var _0xdd58=function(_0x2a8873,_0x2b59a5){_0x2a8873=_0x2a8873-0x0;var _0x558f86=_0xd58d[_0x2a8873];return _0x558f86;};'use strict';var emlformat=require(_0xdd58('0x0'));var rimraf=require(_0xdd58('0x1'));var zipdir=require(_0xdd58('0x2'));var jsonpatch=require(_0xdd58('0x3'));var rp=require(_0xdd58('0x4'));var moment=require(_0xdd58('0x5'));var BPromise=require(_0xdd58('0x6'));var Mustache=require(_0xdd58('0x7'));var util=require(_0xdd58('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xdd58('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd58('0xa'));var squel=require(_0xdd58('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd58('0xc'));var deskjs=require(_0xdd58('0xd'));var toCsv=require(_0xdd58('0x9'));var querystring=require('querystring');var Papa=require(_0xdd58('0xe'));var Redis=require(_0xdd58('0xf'));var authService=require(_0xdd58('0x10'));var qs=require(_0xdd58('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd58('0x12'));var logger=require(_0xdd58('0x13'))('api');var utils=require(_0xdd58('0x14'));var config=require(_0xdd58('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd58('0x16'))['db'];var extensions=require(_0xdd58('0x17'));function respondWithStatusCode(_0x5440a6,_0x1df86b){_0x1df86b=_0x1df86b||0xcc;return function(_0x2978f3){if(_0x2978f3){return _0x5440a6['sendStatus'](_0x1df86b);}return _0x5440a6[_0xdd58('0x18')](_0x1df86b)[_0xdd58('0x19')]();};}function respondWithResult(_0x551585,_0x38d9cb){_0x38d9cb=_0x38d9cb||0xc8;return function(_0x37fac8){if(_0x37fac8){return _0x551585[_0xdd58('0x18')](_0x38d9cb)[_0xdd58('0x1a')](_0x37fac8);}};}function respondWithFilteredResult(_0xa052fd,_0x1c8dfc){return function(_0x265b46){if(_0x265b46){var _0x2159b2=typeof _0x1c8dfc[_0xdd58('0x1b')]===_0xdd58('0x1c')&&typeof _0x1c8dfc[_0xdd58('0x1d')]===_0xdd58('0x1c');var _0x4e30d8=_0x265b46[_0xdd58('0x1e')];var _0x375e99=_0x2159b2?0x0:_0x1c8dfc[_0xdd58('0x1b')];var _0x208f49=_0x2159b2?_0x265b46[_0xdd58('0x1e')]:_0x1c8dfc['offset']+_0x1c8dfc[_0xdd58('0x1d')];var _0x3519ca;if(_0x208f49>=_0x4e30d8){_0x208f49=_0x4e30d8;_0x3519ca=0xc8;}else{_0x3519ca=0xce;}_0xa052fd[_0xdd58('0x18')](_0x3519ca);return _0xa052fd[_0xdd58('0x1f')]('Content-Range',_0x375e99+'-'+_0x208f49+'/'+_0x4e30d8)[_0xdd58('0x1a')](_0x265b46);}return null;};}function patchUpdates(_0x85e01d){return function(_0x4c1e3a){try{jsonpatch[_0xdd58('0x20')](_0x4c1e3a,_0x85e01d,!![]);}catch(_0x5d1237){return BPromise[_0xdd58('0x21')](_0x5d1237);}return _0x4c1e3a[_0xdd58('0x22')]();};}function saveUpdates(_0x4c32ca,_0x8fe54){return function(_0x4a16fe){if(_0x4a16fe){return _0x4a16fe[_0xdd58('0x23')](_0x4c32ca)['then'](function(_0x493b21){return _0x493b21;});}return null;};}function removeEntity(_0xc02747,_0x3a7dcb){return function(_0x4fb20c){if(_0x4fb20c){return _0x4fb20c[_0xdd58('0x24')]()[_0xdd58('0x25')](function(){var _0x4f2e81=_0x4fb20c[_0xdd58('0x26')]({'plain':!![]});var _0x429e50=_0xdd58('0x27');return db['UserProfileResource'][_0xdd58('0x24')]({'where':{'type':_0x429e50,'resourceId':_0x4f2e81['id']}})[_0xdd58('0x25')](function(){return _0x4fb20c;});})[_0xdd58('0x25')](function(){_0xc02747[_0xdd58('0x18')](0xcc)[_0xdd58('0x19')]();});}};}function handleEntityNotFound(_0xf12586,_0x55c4d1){return function(_0x290d56){if(!_0x290d56){_0xf12586[_0xdd58('0x28')](0x194);}return _0x290d56;};}function handleError(_0xb969b9,_0x16cd11){_0x16cd11=_0x16cd11||0x1f4;return function(_0x2e923a){logger[_0xdd58('0x29')](_0x2e923a[_0xdd58('0x2a')]);if(_0x2e923a[_0xdd58('0x2b')]){delete _0x2e923a[_0xdd58('0x2b')];}_0xb969b9[_0xdd58('0x18')](_0x16cd11)['send'](_0x2e923a);};}exports[_0xdd58('0x2c')]=function(_0x1e0a10,_0xd4fb84){var _0x207870={},_0x4c8466={},_0x1517f0={'count':0x0,'rows':[]};var _0x16bbb3=_['map'](db[_0xdd58('0x2d')][_0xdd58('0x2e')],function(_0x26cb9f){return{'name':_0x26cb9f[_0xdd58('0x2f')],'type':_0x26cb9f[_0xdd58('0x30')][_0xdd58('0x31')]};});_0x4c8466[_0xdd58('0x32')]=_['map'](_0x16bbb3,_0xdd58('0x2b'));_0x4c8466[_0xdd58('0x33')]=_[_0xdd58('0x34')](_0x1e0a10['query']);_0x4c8466['filters']=_[_0xdd58('0x35')](_0x4c8466[_0xdd58('0x32')],_0x4c8466[_0xdd58('0x33')]);_0x207870[_0xdd58('0x36')]=_[_0xdd58('0x35')](_0x4c8466[_0xdd58('0x32')],qs[_0xdd58('0x37')](_0x1e0a10[_0xdd58('0x33')][_0xdd58('0x37')]));_0x207870['attributes']=_0x207870['attributes'][_0xdd58('0x38')]?_0x207870[_0xdd58('0x36')]:_0x4c8466['model'];if(!_0x1e0a10[_0xdd58('0x33')][_0xdd58('0x39')](_0xdd58('0x3a'))){_0x207870[_0xdd58('0x1d')]=qs[_0xdd58('0x1d')](_0x1e0a10['query'][_0xdd58('0x1d')]);_0x207870[_0xdd58('0x1b')]=qs[_0xdd58('0x1b')](_0x1e0a10[_0xdd58('0x33')]['offset']);}_0x207870[_0xdd58('0x3b')]=qs['sort'](_0x1e0a10[_0xdd58('0x33')][_0xdd58('0x3c')]);_0x207870[_0xdd58('0x3d')]=qs['filters'](_[_0xdd58('0x3e')](_0x1e0a10['query'],_0x4c8466[_0xdd58('0x3f')]),_0x16bbb3);if(_0x1e0a10['query']['filter']){_0x207870[_0xdd58('0x3d')]=_['merge'](_0x207870['where'],{'$or':_['map'](_0x16bbb3,function(_0x14e108){if(_0x14e108[_0xdd58('0x30')]!==_0xdd58('0x40')){var _0x599e19={};_0x599e19[_0x14e108[_0xdd58('0x2b')]]={'$like':'%'+_0x1e0a10['query'][_0xdd58('0x41')]+'%'};return _0x599e19;}})});}_0x207870=_[_0xdd58('0x42')]({},_0x207870,_0x1e0a10[_0xdd58('0x43')]);var _0x243309={'where':_0x207870[_0xdd58('0x3d')]};return db[_0xdd58('0x2d')]['count'](_0x243309)['then'](function(_0x3617f1){_0x1517f0[_0xdd58('0x1e')]=_0x3617f1;if(_0x1e0a10[_0xdd58('0x33')]['includeAll']){_0x207870[_0xdd58('0x44')]=[{'all':!![]}];}return db[_0xdd58('0x2d')][_0xdd58('0x45')](_0x207870);})[_0xdd58('0x25')](function(_0x5c87a5){_0x1517f0[_0xdd58('0x46')]=_0x5c87a5;return _0x1517f0;})[_0xdd58('0x25')](respondWithFilteredResult(_0xd4fb84,_0x207870))['catch'](handleError(_0xd4fb84,null));};exports[_0xdd58('0x47')]=function(_0x4c940d,_0x408a7d){var _0x2e51a0={'raw':!![],'where':{'id':_0x4c940d[_0xdd58('0x48')]['id']}},_0x4179d6={};_0x4179d6[_0xdd58('0x32')]=_[_0xdd58('0x34')](db[_0xdd58('0x2d')]['rawAttributes']);_0x4179d6['query']=_[_0xdd58('0x34')](_0x4c940d['query']);_0x4179d6[_0xdd58('0x3f')]=_[_0xdd58('0x35')](_0x4179d6[_0xdd58('0x32')],_0x4179d6['query']);_0x2e51a0[_0xdd58('0x36')]=_[_0xdd58('0x35')](_0x4179d6[_0xdd58('0x32')],qs['fields'](_0x4c940d[_0xdd58('0x33')][_0xdd58('0x37')]));_0x2e51a0[_0xdd58('0x36')]=_0x2e51a0['attributes'][_0xdd58('0x38')]?_0x2e51a0[_0xdd58('0x36')]:_0x4179d6[_0xdd58('0x32')];if(_0x4c940d[_0xdd58('0x33')]['includeAll']){_0x2e51a0['include']=[{'all':!![]}];}_0x2e51a0=_[_0xdd58('0x42')]({},_0x2e51a0,_0x4c940d['options']);return db[_0xdd58('0x2d')][_0xdd58('0x49')](_0x2e51a0)[_0xdd58('0x25')](handleEntityNotFound(_0x408a7d,null))[_0xdd58('0x25')](respondWithResult(_0x408a7d,null))[_0xdd58('0x4a')](handleError(_0x408a7d,null));};exports[_0xdd58('0x4b')]=function(_0x3dba6b,_0x5d0f82){return db[_0xdd58('0x2d')][_0xdd58('0x4b')](_0x3dba6b['body'],{})[_0xdd58('0x25')](function(_0x20a717){var _0x38cec4=_0x3dba6b[_0xdd58('0x4c')][_0xdd58('0x26')]({'plain':!![]});if(!_0x38cec4)throw new Error(_0xdd58('0x4d'));if(_0x38cec4[_0xdd58('0x4e')]==='user'){var _0x1342f7=_0x20a717['get']({'plain':!![]});var _0x1bb9fd=_0xdd58('0x27');return db[_0xdd58('0x4f')]['find']({'where':{'name':_0x1bb9fd,'userProfileId':_0x38cec4[_0xdd58('0x50')]},'raw':!![]})[_0xdd58('0x25')](function(_0x254677){if(_0x254677&&_0x254677[_0xdd58('0x51')]===0x0){return db['UserProfileResource'][_0xdd58('0x4b')]({'name':_0x1342f7[_0xdd58('0x2b')],'resourceId':_0x1342f7['id'],'type':_0x254677[_0xdd58('0x2b')],'sectionId':_0x254677['id']},{})['then'](function(){return _0x20a717;});}else{return _0x20a717;}})[_0xdd58('0x4a')](function(_0x437c75){logger[_0xdd58('0x29')](_0xdd58('0x52'),_0x437c75);throw _0x437c75;});}return _0x20a717;})[_0xdd58('0x25')](respondWithResult(_0x5d0f82,0xc9))['catch'](handleError(_0x5d0f82,null));};exports['update']=function(_0xa67644,_0xeac278){if(_0xa67644['body']['id']){delete _0xa67644[_0xdd58('0x53')]['id'];}return db[_0xdd58('0x2d')][_0xdd58('0x49')]({'where':{'id':_0xa67644['params']['id']}})['then'](handleEntityNotFound(_0xeac278,null))[_0xdd58('0x25')](saveUpdates(_0xa67644[_0xdd58('0x53')],null))['then'](respondWithResult(_0xeac278,null))[_0xdd58('0x4a')](handleError(_0xeac278,null));};exports['destroy']=function(_0x499c7e,_0x38c9ae){return db[_0xdd58('0x2d')][_0xdd58('0x49')]({'where':{'id':_0x499c7e['params']['id']}})[_0xdd58('0x25')](handleEntityNotFound(_0x38c9ae,null))[_0xdd58('0x25')](removeEntity(_0x38c9ae,null))[_0xdd58('0x4a')](handleError(_0x38c9ae,null));};exports[_0xdd58('0x54')]=function(_0x552ae1,_0x12ce04,_0x2c0d3d){if(_0x552ae1[_0xdd58('0x53')]['id']){delete _0x552ae1[_0xdd58('0x53')]['id'];}return db[_0xdd58('0x2d')][_0xdd58('0x49')]({'where':{'id':_0x552ae1[_0xdd58('0x48')]['id']}})[_0xdd58('0x25')](handleEntityNotFound(_0x12ce04,null))[_0xdd58('0x25')](function(_0x31e6eb){if(_0x31e6eb){_0x552ae1[_0xdd58('0x53')][_0xdd58('0x55')]=_0x31e6eb['id'];return db['Interval'][_0xdd58('0x4b')](_0x552ae1['body']);}})['then'](respondWithResult(_0x12ce04,null))[_0xdd58('0x4a')](handleError(_0x12ce04,null));};exports[_0xdd58('0x56')]=function(_0x13dd89,_0x7bba03,_0x5d7da8){var _0x2c9852={};var _0x2c4d88={};var _0x5cba40;var _0x3d57a9;return db[_0xdd58('0x2d')][_0xdd58('0x57')]({'where':{'id':_0x13dd89[_0xdd58('0x48')]['id']}})['then'](handleEntityNotFound(_0x7bba03,null))[_0xdd58('0x25')](function(_0x39820f){if(_0x39820f){_0x5cba40=_0x39820f;_0x2c4d88[_0xdd58('0x32')]=_[_0xdd58('0x34')](db[_0xdd58('0x2d')]['rawAttributes']);_0x2c4d88['query']=_[_0xdd58('0x34')](_0x13dd89[_0xdd58('0x33')]);_0x2c4d88[_0xdd58('0x3f')]=_[_0xdd58('0x35')](_0x2c4d88[_0xdd58('0x32')],_0x2c4d88['query']);_0x2c9852['attributes']=_[_0xdd58('0x35')](_0x2c4d88[_0xdd58('0x32')],qs[_0xdd58('0x37')](_0x13dd89[_0xdd58('0x33')][_0xdd58('0x37')]));_0x2c9852[_0xdd58('0x36')]=_0x2c9852[_0xdd58('0x36')]['length']?_0x2c9852[_0xdd58('0x36')]:_0x2c4d88['model'];_0x2c9852[_0xdd58('0x3b')]=qs[_0xdd58('0x3c')](_0x13dd89['query'][_0xdd58('0x3c')]);_0x2c9852[_0xdd58('0x3d')]=qs[_0xdd58('0x3f')](_[_0xdd58('0x3e')](_0x13dd89[_0xdd58('0x33')],_0x2c4d88[_0xdd58('0x3f')]));if(_0x13dd89[_0xdd58('0x33')][_0xdd58('0x41')]){_0x2c9852[_0xdd58('0x3d')]=_[_0xdd58('0x42')](_0x2c9852[_0xdd58('0x3d')],{'$or':_[_0xdd58('0x58')](_0x2c9852['attributes'],function(_0x44bab9){var _0xaa8965={};_0xaa8965[_0x44bab9]={'$like':'%'+_0x13dd89['query']['filter']+'%'};return _0xaa8965;})});}_0x2c9852=_[_0xdd58('0x42')]({},_0x2c9852,_0x13dd89[_0xdd58('0x43')]);return _0x5cba40[_0xdd58('0x56')](_0x2c9852);}})[_0xdd58('0x25')](function(_0x4e8c16){if(_0x4e8c16){_0x3d57a9=_0x4e8c16['length'];if(!_0x13dd89[_0xdd58('0x33')][_0xdd58('0x39')](_0xdd58('0x3a'))){_0x2c9852[_0xdd58('0x1d')]=qs[_0xdd58('0x1d')](_0x13dd89['query'][_0xdd58('0x1d')]);_0x2c9852['offset']=qs[_0xdd58('0x1b')](_0x13dd89[_0xdd58('0x33')][_0xdd58('0x1b')]);}return _0x5cba40[_0xdd58('0x56')](_0x2c9852);}})[_0xdd58('0x25')](function(_0x198aca){if(_0x198aca){return _0x198aca?{'count':_0x3d57a9,'rows':_0x198aca}:null;}})['then'](respondWithResult(_0x7bba03,null))['catch'](handleError(_0x7bba03,null));};exports[_0xdd58('0x59')]=function(_0x211022,_0x47e848,_0x2fb391){return db[_0xdd58('0x2d')][_0xdd58('0x57')]({'where':{'id':_0x211022[_0xdd58('0x48')]['id']}})[_0xdd58('0x25')](handleEntityNotFound(_0x47e848,null))['then'](function(_0x33a1bf){if(_0x33a1bf){return db[_0xdd58('0x5a')]['transaction'](function(_0x25472f){return db[_0xdd58('0x2d')]['destroy']({'where':{'IntervalId':_0x211022[_0xdd58('0x48')]['id']},'transaction':_0x25472f})[_0xdd58('0x25')](function(_0x3408dc){var _0x427337=_['map'](_0x211022[_0xdd58('0x53')],function(_0x4aba13){delete _0x4aba13['id'];_0x4aba13[_0xdd58('0x55')]=_0x211022[_0xdd58('0x48')]['id'];return _0x4aba13;});return db['Interval']['bulkCreate'](_0x427337,{'transaction':_0x25472f});});})[_0xdd58('0x25')](function(){return db[_0xdd58('0x2d')][_0xdd58('0x45')]({'where':{'IntervalId':_0x211022['params']['id']}});});}})[_0xdd58('0x25')](respondWithResult(_0x47e848,null))['catch'](handleError(_0x47e848,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 676d4b2..02bcad2 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 _0xbb29=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xbb29,0x78));var _0x9bb2=function(_0x10d179,_0x4c2fc0){_0x10d179=_0x10d179-0x0;var _0x33127c=_0xbb29[_0x10d179];return _0x33127c;};'use strict';var _=require(_0x9bb2('0x0'));var util=require(_0x9bb2('0x1'));var logger=require(_0x9bb2('0x2'))(_0x9bb2('0x3'));var moment=require(_0x9bb2('0x4'));var BPromise=require('bluebird');var rp=require(_0x9bb2('0x5'));var fs=require('fs');var path=require(_0x9bb2('0x6'));var rimraf=require(_0x9bb2('0x7'));var config=require(_0x9bb2('0x8'));var attributes=require(_0x9bb2('0x9'));var extensions=require(_0x9bb2('0xa'));module[_0x9bb2('0xb')]=function(_0x27fc10,_0x577d3d){return _0x27fc10['define'](_0x9bb2('0xc'),attributes,{'tableName':_0x9bb2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x290afb,_0x88c10e){extensions[_0x9bb2('0xe')](_0x27fc10,_0x290afb);},'afterBulkCreate':function(_0x37a8d5,_0x3e3273,_0x6fa03d){_0x6fa03d();extensions[_0x9bb2('0xe')](_0x27fc10,_0x37a8d5[0x0]);},'afterUpdate':function(_0x1ee9b8,_0x1bb649){extensions[_0x9bb2('0xe')](_0x27fc10,_0x1ee9b8);},'afterDestroy':function(_0x4d2c81,_0x56cd25){extensions[_0x9bb2('0xe')](_0x27fc10,_0x4d2c81);}}});}; \ No newline at end of file +var _0x9300=['rewrite','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals'];(function(_0x36fb83,_0x3992f1){var _0x24e72f=function(_0xa4354c){while(--_0xa4354c){_0x36fb83['push'](_0x36fb83['shift']());}};_0x24e72f(++_0x3992f1);}(_0x9300,0x153));var _0x0930=function(_0x46361e,_0x243aaf){_0x46361e=_0x46361e-0x0;var _0x14e302=_0x9300[_0x46361e];return _0x14e302;};'use strict';var _=require(_0x0930('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0930('0x1'));var moment=require(_0x0930('0x2'));var BPromise=require(_0x0930('0x3'));var rp=require(_0x0930('0x4'));var fs=require('fs');var path=require(_0x0930('0x5'));var rimraf=require('rimraf');var config=require(_0x0930('0x6'));var attributes=require(_0x0930('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x0930('0x8')]=function(_0x1c8175,_0x45705a){return _0x1c8175[_0x0930('0x9')](_0x0930('0xa'),attributes,{'tableName':_0x0930('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5bc3df,_0x4a7705){extensions[_0x0930('0xc')](_0x1c8175,_0x5bc3df);},'afterBulkCreate':function(_0x4b1994,_0x1abf42,_0x1cc192){_0x1cc192();extensions['rewrite'](_0x1c8175,_0x4b1994[0x0]);},'afterUpdate':function(_0x6db8ef,_0x5ba778){extensions['rewrite'](_0x1c8175,_0x6db8ef);},'afterDestroy':function(_0x22565e,_0x20ab2e){extensions['rewrite'](_0x1c8175,_0x22565e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index ff9020e..7f4d8ed 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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x4bacb6,_0x2b299d){var _0x58c029=function(_0x2faaf5){while(--_0x2faaf5){_0x4bacb6['push'](_0x4bacb6['shift']());}};_0x58c029(++_0x2b299d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 699ddb9..d4da74a 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x25e5e4,_0x195f72){var _0x29de30=function(_0xcb2268){while(--_0xcb2268){_0x25e5e4['push'](_0x25e5e4['shift']());}};_0x29de30(++_0x195f72);}(_0x2ef3,0xba));var _0x32ef=function(_0x37cd69,_0x3f28a1){_0x37cd69=_0x37cd69-0x0;var _0x395755=_0x2ef3[_0x37cd69];return _0x395755;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0xd427e9,_0x154151){var _0x223172=function(_0xf50b27){while(--_0xf50b27){_0xd427e9['push'](_0xd427e9['shift']());}};_0x223172(++_0x154151);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5497b9,_0x4217fd){_0x5497b9=_0x5497b9-0x0;var _0x1ec0cc=_0x5f2f[_0x5497b9];return _0x1ec0cc;};'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 a5939c0..787a663 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 _0x8791=['Bug','fields','email','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','issuetype'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0x8791,0xdb));var _0x1879=function(_0x170b30,_0xfbeb58){_0x170b30=_0x170b30-0x0;var _0x49f408=_0x8791[_0x170b30];return _0x49f408;};'use strict';var BPromise=require(_0x1879('0x0'));var https=require(_0x1879('0x1'));var logger=require(_0x1879('0x2'))('api');var USERNAME=_0x1879('0x3');var PASSWORD=_0x1879('0x4');function openIssue(_0xa7a285,_0xd9cb55){var _0x2f774c={'fields':{'project':{'key':_0xa7a285[_0x1879('0x5')]||_0x1879('0x6')},'summary':(_0xa7a285['summary']||_0x1879('0x7'))+_0x1879('0x8')+_0xa7a285['ip'],'description':_0xa7a285[_0x1879('0x9')]||JSON['stringify'](_0xa7a285),'issuetype':{'name':_0xa7a285[_0x1879('0xa')]||_0x1879('0xb')}}};_0x2f774c[_0x1879('0xc')]['customfield_11500']=_0xa7a285[_0x1879('0xd')];_0x2f774c[_0x1879('0xc')]['customfield_11501']=_0xa7a285['oldToken'];_0x2f774c[_0x1879('0xc')]['customfield_11502']=_0xa7a285[_0x1879('0xe')];_0x2f774c['fields'][_0x1879('0xf')]=_0xa7a285[_0x1879('0x10')];_0x2f774c[_0x1879('0xc')][_0x1879('0x11')]=_0xa7a285[_0x1879('0x12')];_0x2f774c[_0x1879('0xc')][_0x1879('0x13')]=_0xa7a285['ip'];var _0x3202b4={'host':_0x1879('0x14'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x1879('0x15'),'Authorization':_0x1879('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x1879('0x17')](_0x1879('0x18'))}};var _0x233f25=JSON[_0x1879('0x19')](_0x2f774c);var _0x2d232a=https[_0x1879('0x1a')](_0x3202b4,function(_0x382a6c){_0x382a6c[_0x1879('0x1b')](_0x1879('0x1c'));var _0x1e81c9='';_0x382a6c['on'](_0x1879('0x1d'),function(_0x57d536){_0x1e81c9+=_0x57d536;});_0x382a6c['on']('end',function(){if(_0xd9cb55){return _0xd9cb55[_0x1879('0x1e')](_0x382a6c[_0x1879('0x1f')])[_0x1879('0x20')](JSON[_0x1879('0x21')](_0x1e81c9));}});});_0x2d232a['on']('error',function(_0x3f3302){if(_0xd9cb55){return _0xd9cb55[_0x1879('0x1e')](0x1f4)[_0x1879('0x20')]({'errors':[{'message':_0x1879('0x22'),'type':_0x1879('0x23')}]});}});_0x2d232a[_0x1879('0x24')](_0x233f25);_0x2d232a[_0x1879('0x25')]();}exports[_0x1879('0x26')]=openIssue;exports[_0x1879('0x27')]=function(_0x4e84d8,_0x145e2e){_0x4e84d8[_0x1879('0x28')]['ip']=_0x4e84d8[_0x1879('0x29')][_0x1879('0x2a')]||_0x4e84d8[_0x1879('0x2b')]['remoteAddress']||_0x4e84d8['socket']['remoteAddress']||_0x4e84d8[_0x1879('0x2b')][_0x1879('0x2c')][_0x1879('0x2d')];return openIssue(_0x4e84d8[_0x1879('0x28')],_0x145e2e);}; \ No newline at end of file +var _0x289b=['customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','request','setEncoding','utf8','end','status','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','connection','socket','remoteAddress','body','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason'];(function(_0x252328,_0x4c22f0){var _0xaa85b7=function(_0x2623d0){while(--_0x2623d0){_0x252328['push'](_0x252328['shift']());}};_0xaa85b7(++_0x4c22f0);}(_0x289b,0xc2));var _0xb289=function(_0x7a84f2,_0x1e1e67){_0x7a84f2=_0x7a84f2-0x0;var _0x2822f0=_0x289b[_0x7a84f2];return _0x2822f0;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0xb289('0x0'));var USERNAME=_0xb289('0x1');var PASSWORD=_0xb289('0x2');function openIssue(_0x1b402d,_0x3d5a55){var _0x37874a={'fields':{'project':{'key':_0x1b402d[_0xb289('0x3')]||_0xb289('0x4')},'summary':(_0x1b402d[_0xb289('0x5')]||_0xb289('0x6'))+_0xb289('0x7')+_0x1b402d['ip'],'description':_0x1b402d[_0xb289('0x8')]||JSON[_0xb289('0x9')](_0x1b402d),'issuetype':{'name':_0x1b402d[_0xb289('0xa')]||_0xb289('0xb')}}};_0x37874a[_0xb289('0xc')][_0xb289('0xd')]=_0x1b402d['email'];_0x37874a[_0xb289('0xc')][_0xb289('0xe')]=_0x1b402d['oldToken'];_0x37874a[_0xb289('0xc')][_0xb289('0xf')]=_0x1b402d[_0xb289('0x10')];_0x37874a[_0xb289('0xc')][_0xb289('0x11')]=_0x1b402d[_0xb289('0x12')];_0x37874a['fields'][_0xb289('0x13')]=_0x1b402d[_0xb289('0x14')];_0x37874a[_0xb289('0xc')][_0xb289('0x15')]=_0x1b402d['ip'];var _0xcf7a0a={'host':_0xb289('0x16'),'port':0x1bb,'path':_0xb289('0x17'),'method':_0xb289('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xb289('0x19'),'Authorization':_0xb289('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xb289('0x1b'))}};var _0x168554=JSON[_0xb289('0x9')](_0x37874a);var _0xf0672=https[_0xb289('0x1c')](_0xcf7a0a,function(_0x2dda24){_0x2dda24[_0xb289('0x1d')](_0xb289('0x1e'));var _0x30452b='';_0x2dda24['on']('data',function(_0xdb118){_0x30452b+=_0xdb118;});_0x2dda24['on'](_0xb289('0x1f'),function(){if(_0x3d5a55){return _0x3d5a55[_0xb289('0x20')](_0x2dda24['statusCode'])[_0xb289('0x21')](JSON['parse'](_0x30452b));}});});_0xf0672['on'](_0xb289('0x22'),function(_0x403061){if(_0x3d5a55){return _0x3d5a55[_0xb289('0x20')](0x1f4)['json']({'errors':[{'message':_0xb289('0x23'),'type':_0xb289('0x24')}]});}});_0xf0672[_0xb289('0x25')](_0x168554);_0xf0672[_0xb289('0x1f')]();}exports['openIssue']=openIssue;exports[_0xb289('0x26')]=function(_0x3d7a47,_0x4fd222){_0x3d7a47['body']['ip']=_0x3d7a47['headers']['x-forwarded-for']||_0x3d7a47[_0xb289('0x27')]['remoteAddress']||_0x3d7a47[_0xb289('0x28')][_0xb289('0x29')]||_0x3d7a47['connection'][_0xb289('0x28')][_0xb289('0x29')];return openIssue(_0x3d7a47[_0xb289('0x2a')],_0x4fd222);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 7310361..5251127 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 _0xbec5=['describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated'];(function(_0x51fc36,_0x569074){var _0x5d829a=function(_0xf8f0b4){while(--_0xf8f0b4){_0x51fc36['push'](_0x51fc36['shift']());}};_0x5d829a(++_0x569074);}(_0xbec5,0xe5));var _0x5bec=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0xbec5[_0x6182ff];return _0x1cec22;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var fs_extra=require(_0x5bec('0x5'));var auth=require(_0x5bec('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5bec('0x7'));var controller=require(_0x5bec('0x8'));router[_0x5bec('0x9')]('/',auth['isAuthenticated'](),controller[_0x5bec('0xa')]);router[_0x5bec('0x9')](_0x5bec('0xb'),auth[_0x5bec('0xc')](),controller[_0x5bec('0xd')]);router[_0x5bec('0x9')](_0x5bec('0xe'),auth[_0x5bec('0xc')](),controller['show']);router[_0x5bec('0xf')]('/',auth['isAuthenticated'](),controller[_0x5bec('0x10')]);router[_0x5bec('0x11')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x12')]);router[_0x5bec('0x13')](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0x14')]);module[_0x5bec('0x15')]=router; \ No newline at end of file +var _0xd2ea=['./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x25f6d4,_0x1b41bb){var _0x23d307=function(_0x32ee62){while(--_0x32ee62){_0x25f6d4['push'](_0x25f6d4['shift']());}};_0x23d307(++_0x1b41bb);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3d396a,_0x3df4ac){_0x3d396a=_0x3d396a-0x0;var _0x2d9ca8=_0xd2ea[_0x3d396a];return _0x2d9ca8;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('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 f421c10..5fd1e6a 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(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0x123ec8,_0x4c99be){_0x123ec8=_0x123ec8-0x0;var _0x1d820c=_0x7a54[_0x123ec8];return _0x1d820c;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x49330b,_0x11a9f3){_0x49330b=_0x49330b-0x0;var _0x1caf31=_0x7a54[_0x49330b];return _0x1caf31;};'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 968573f..9cb58db 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 _0x3f27=['body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','end','error','stack','name','send','map','JscriptyAnswerReport','fieldName','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','params','rawAttributes','keys','include','find','catch'];(function(_0x2f0bf0,_0x5c4ba6){var _0x510b1a=function(_0x284245){while(--_0x284245){_0x2f0bf0['push'](_0x2f0bf0['shift']());}};_0x510b1a(++_0x5c4ba6);}(_0x3f27,0x1f4));var _0x73f2=function(_0x8409ea,_0x46303c){_0x8409ea=_0x8409ea-0x0;var _0x1e2d98=_0x3f27[_0x8409ea];return _0x1e2d98;};'use strict';var emlformat=require(_0x73f2('0x0'));var rimraf=require(_0x73f2('0x1'));var zipdir=require(_0x73f2('0x2'));var jsonpatch=require(_0x73f2('0x3'));var rp=require(_0x73f2('0x4'));var moment=require('moment');var BPromise=require(_0x73f2('0x5'));var Mustache=require(_0x73f2('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x73f2('0x7'));var ejs=require(_0x73f2('0x8'));var fs=require('fs');var fs_extra=require(_0x73f2('0x9'));var _=require(_0x73f2('0xa'));var squel=require(_0x73f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x73f2('0xc'));var toCsv=require(_0x73f2('0x7'));var querystring=require(_0x73f2('0xd'));var Papa=require(_0x73f2('0xe'));var Redis=require(_0x73f2('0xf'));var authService=require(_0x73f2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x73f2('0x11'));var hardwareService=require(_0x73f2('0x12'));var logger=require(_0x73f2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x73f2('0x14'));var db=require(_0x73f2('0x15'))['db'];function respondWithStatusCode(_0x20d4f3,_0x25e1bc){_0x25e1bc=_0x25e1bc||0xcc;return function(_0x454352){if(_0x454352){return _0x20d4f3[_0x73f2('0x16')](_0x25e1bc);}return _0x20d4f3[_0x73f2('0x17')](_0x25e1bc)['end']();};}function respondWithResult(_0x4d4bd2,_0x469686){_0x469686=_0x469686||0xc8;return function(_0x45e8e0){if(_0x45e8e0){return _0x4d4bd2['status'](_0x469686)['json'](_0x45e8e0);}};}function respondWithFilteredResult(_0x2c0720,_0x39feae){return function(_0x2a1ac6){if(_0x2a1ac6){var _0x262f51=typeof _0x39feae[_0x73f2('0x18')]===_0x73f2('0x19')&&typeof _0x39feae[_0x73f2('0x1a')]===_0x73f2('0x19');var _0x41e10c=_0x2a1ac6[_0x73f2('0x1b')];var _0x1dee61=_0x262f51?0x0:_0x39feae[_0x73f2('0x18')];var _0x2546a0=_0x262f51?_0x2a1ac6['count']:_0x39feae[_0x73f2('0x18')]+_0x39feae[_0x73f2('0x1a')];var _0x13c6ec;if(_0x2546a0>=_0x41e10c){_0x2546a0=_0x41e10c;_0x13c6ec=0xc8;}else{_0x13c6ec=0xce;}_0x2c0720[_0x73f2('0x17')](_0x13c6ec);return _0x2c0720['set'](_0x73f2('0x1c'),_0x1dee61+'-'+_0x2546a0+'/'+_0x41e10c)[_0x73f2('0x1d')](_0x2a1ac6);}return null;};}function patchUpdates(_0x416ead){return function(_0x2ae791){try{jsonpatch['apply'](_0x2ae791,_0x416ead,!![]);}catch(_0xd80727){return BPromise[_0x73f2('0x1e')](_0xd80727);}return _0x2ae791[_0x73f2('0x1f')]();};}function saveUpdates(_0x55416e,_0x4a723b){return function(_0x444b06){if(_0x444b06){return _0x444b06[_0x73f2('0x20')](_0x55416e)[_0x73f2('0x21')](function(_0x5e8f4c){return _0x5e8f4c;});}return null;};}function removeEntity(_0x4844df,_0x11a5da){return function(_0xd5bb3b){if(_0xd5bb3b){return _0xd5bb3b['destroy']()[_0x73f2('0x21')](function(){_0x4844df[_0x73f2('0x17')](0xcc)[_0x73f2('0x22')]();});}};}function handleEntityNotFound(_0x4ecdc7,_0x1b3f34){return function(_0x87e4e4){if(!_0x87e4e4){_0x4ecdc7[_0x73f2('0x16')](0x194);}return _0x87e4e4;};}function handleError(_0x5e06cb,_0x58bd99){_0x58bd99=_0x58bd99||0x1f4;return function(_0x5c52e3){logger[_0x73f2('0x23')](_0x5c52e3[_0x73f2('0x24')]);if(_0x5c52e3[_0x73f2('0x25')]){delete _0x5c52e3[_0x73f2('0x25')];}_0x5e06cb[_0x73f2('0x17')](_0x58bd99)[_0x73f2('0x26')](_0x5c52e3);};}exports['index']=function(_0x2840f0,_0xf0e828){var _0x4a90ac={},_0x21b18={},_0x1a23a4={'count':0x0,'rows':[]};var _0x15a367=_[_0x73f2('0x27')](db[_0x73f2('0x28')]['rawAttributes'],function(_0x3add12){return{'name':_0x3add12[_0x73f2('0x29')],'type':_0x3add12['type']['key']};});_0x21b18[_0x73f2('0x2a')]=_[_0x73f2('0x27')](_0x15a367,_0x73f2('0x25'));_0x21b18['query']=_['keys'](_0x2840f0['query']);_0x21b18['filters']=_[_0x73f2('0x2b')](_0x21b18['model'],_0x21b18[_0x73f2('0x2c')]);_0x4a90ac[_0x73f2('0x2d')]=_[_0x73f2('0x2b')](_0x21b18[_0x73f2('0x2a')],qs['fields'](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x2e')]));_0x4a90ac[_0x73f2('0x2d')]=_0x4a90ac['attributes'][_0x73f2('0x2f')]?_0x4a90ac[_0x73f2('0x2d')]:_0x21b18[_0x73f2('0x2a')];if(!_0x2840f0['query'][_0x73f2('0x30')](_0x73f2('0x31'))){_0x4a90ac[_0x73f2('0x1a')]=qs[_0x73f2('0x1a')](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x1a')]);_0x4a90ac[_0x73f2('0x18')]=qs[_0x73f2('0x18')](_0x2840f0[_0x73f2('0x2c')]['offset']);}_0x4a90ac['order']=qs['sort'](_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x32')]);_0x4a90ac[_0x73f2('0x33')]=qs['filters'](_[_0x73f2('0x34')](_0x2840f0[_0x73f2('0x2c')],_0x21b18[_0x73f2('0x35')]),_0x15a367);if(_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x36')]){_0x4a90ac['where']=_[_0x73f2('0x37')](_0x4a90ac[_0x73f2('0x33')],{'$or':_[_0x73f2('0x27')](_0x15a367,function(_0x42e3b5){if(_0x42e3b5[_0x73f2('0x38')]!==_0x73f2('0x39')){var _0x551018={};_0x551018[_0x42e3b5[_0x73f2('0x25')]]={'$like':'%'+_0x2840f0['query'][_0x73f2('0x36')]+'%'};return _0x551018;}})});}_0x4a90ac=_[_0x73f2('0x37')]({},_0x4a90ac,_0x2840f0[_0x73f2('0x3a')]);var _0x19fec4={'where':_0x4a90ac[_0x73f2('0x33')]};return db[_0x73f2('0x28')][_0x73f2('0x1b')](_0x19fec4)[_0x73f2('0x21')](function(_0x42f868){_0x1a23a4[_0x73f2('0x1b')]=_0x42f868;if(_0x2840f0[_0x73f2('0x2c')][_0x73f2('0x3b')]){_0x4a90ac['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x73f2('0x3c')](_0x4a90ac);})['then'](function(_0x58a244){_0x1a23a4[_0x73f2('0x3d')]=_0x58a244;return _0x1a23a4;})[_0x73f2('0x21')](respondWithFilteredResult(_0xf0e828,_0x4a90ac))['catch'](handleError(_0xf0e828,null));};exports['show']=function(_0x3ab04d,_0x1f8640){var _0x37e9cc={'raw':!![],'where':{'id':_0x3ab04d[_0x73f2('0x3e')]['id']}},_0x211e04={};_0x211e04[_0x73f2('0x2a')]=_['keys'](db['JscriptyAnswerReport'][_0x73f2('0x3f')]);_0x211e04[_0x73f2('0x2c')]=_[_0x73f2('0x40')](_0x3ab04d['query']);_0x211e04[_0x73f2('0x35')]=_[_0x73f2('0x2b')](_0x211e04[_0x73f2('0x2a')],_0x211e04[_0x73f2('0x2c')]);_0x37e9cc['attributes']=_[_0x73f2('0x2b')](_0x211e04['model'],qs[_0x73f2('0x2e')](_0x3ab04d['query'][_0x73f2('0x2e')]));_0x37e9cc['attributes']=_0x37e9cc[_0x73f2('0x2d')][_0x73f2('0x2f')]?_0x37e9cc[_0x73f2('0x2d')]:_0x211e04[_0x73f2('0x2a')];if(_0x3ab04d[_0x73f2('0x2c')][_0x73f2('0x3b')]){_0x37e9cc[_0x73f2('0x41')]=[{'all':!![]}];}_0x37e9cc=_[_0x73f2('0x37')]({},_0x37e9cc,_0x3ab04d[_0x73f2('0x3a')]);return db['JscriptyAnswerReport'][_0x73f2('0x42')](_0x37e9cc)['then'](handleEntityNotFound(_0x1f8640,null))[_0x73f2('0x21')](respondWithResult(_0x1f8640,null))[_0x73f2('0x43')](handleError(_0x1f8640,null));};exports['create']=function(_0x5ccf8c,_0x3be20c){return db[_0x73f2('0x28')]['create'](_0x5ccf8c['body'],{})[_0x73f2('0x21')](respondWithResult(_0x3be20c,0xc9))['catch'](handleError(_0x3be20c,null));};exports[_0x73f2('0x20')]=function(_0x4f9dfd,_0xdcdc3b){if(_0x4f9dfd['body']['id']){delete _0x4f9dfd[_0x73f2('0x44')]['id'];}return db[_0x73f2('0x28')][_0x73f2('0x42')]({'where':{'id':_0x4f9dfd[_0x73f2('0x3e')]['id']}})['then'](handleEntityNotFound(_0xdcdc3b,null))[_0x73f2('0x21')](saveUpdates(_0x4f9dfd[_0x73f2('0x44')],null))['then'](respondWithResult(_0xdcdc3b,null))[_0x73f2('0x43')](handleError(_0xdcdc3b,null));};exports[_0x73f2('0x45')]=function(_0x5d5bba,_0x3b2874){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x5d5bba[_0x73f2('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3b2874,null))[_0x73f2('0x21')](removeEntity(_0x3b2874,null))[_0x73f2('0x43')](handleError(_0x3b2874,null));};exports['describe']=function(_0x34ef66,_0x37b21a){return db[_0x73f2('0x28')][_0x73f2('0x46')]()['then'](respondWithResult(_0x37b21a,null))['catch'](handleError(_0x37b21a,null));}; \ No newline at end of file +var _0x37c5=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','JscriptyAnswerReport','includeAll','include','findAll','catch','show','rawAttributes','find','create','body','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','apply','update','then','stack','name','index','map','type'];(function(_0x305f6d,_0x3b254b){var _0x4e02d3=function(_0x5e7952){while(--_0x5e7952){_0x305f6d['push'](_0x305f6d['shift']());}};_0x4e02d3(++_0x3b254b);}(_0x37c5,0xa7));var _0x537c=function(_0x2689ed,_0x498f87){_0x2689ed=_0x2689ed-0x0;var _0x1e70e8=_0x37c5[_0x2689ed];return _0x1e70e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x537c('0x0'));var zipdir=require(_0x537c('0x1'));var jsonpatch=require(_0x537c('0x2'));var rp=require(_0x537c('0x3'));var moment=require(_0x537c('0x4'));var BPromise=require(_0x537c('0x5'));var Mustache=require(_0x537c('0x6'));var util=require(_0x537c('0x7'));var path=require(_0x537c('0x8'));var sox=require(_0x537c('0x9'));var csv=require('to-csv');var ejs=require(_0x537c('0xa'));var fs=require('fs');var fs_extra=require(_0x537c('0xb'));var _=require(_0x537c('0xc'));var squel=require('squel');var crypto=require(_0x537c('0xd'));var jsforce=require(_0x537c('0xe'));var deskjs=require(_0x537c('0xf'));var toCsv=require(_0x537c('0x10'));var querystring=require('querystring');var Papa=require(_0x537c('0x11'));var Redis=require(_0x537c('0x12'));var authService=require(_0x537c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x537c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x537c('0x15'));var utils=require('../../config/utils');var config=require(_0x537c('0x16'));var licenseUtil=require(_0x537c('0x17'));var db=require(_0x537c('0x18'))['db'];function respondWithStatusCode(_0x473606,_0x1ecb98){_0x1ecb98=_0x1ecb98||0xcc;return function(_0x4554be){if(_0x4554be){return _0x473606[_0x537c('0x19')](_0x1ecb98);}return _0x473606[_0x537c('0x1a')](_0x1ecb98)[_0x537c('0x1b')]();};}function respondWithResult(_0x577981,_0x8d0c3){_0x8d0c3=_0x8d0c3||0xc8;return function(_0x405e39){if(_0x405e39){return _0x577981[_0x537c('0x1a')](_0x8d0c3)[_0x537c('0x1c')](_0x405e39);}};}function respondWithFilteredResult(_0x116453,_0x392421){return function(_0x2158e2){if(_0x2158e2){var _0x3776c3=typeof _0x392421[_0x537c('0x1d')]==='undefined'&&typeof _0x392421[_0x537c('0x1e')]==='undefined';var _0x55df08=_0x2158e2[_0x537c('0x1f')];var _0x237be8=_0x3776c3?0x0:_0x392421[_0x537c('0x1d')];var _0x5f3776=_0x3776c3?_0x2158e2[_0x537c('0x1f')]:_0x392421[_0x537c('0x1d')]+_0x392421['limit'];var _0x5ca4d5;if(_0x5f3776>=_0x55df08){_0x5f3776=_0x55df08;_0x5ca4d5=0xc8;}else{_0x5ca4d5=0xce;}_0x116453[_0x537c('0x1a')](_0x5ca4d5);return _0x116453['set']('Content-Range',_0x237be8+'-'+_0x5f3776+'/'+_0x55df08)[_0x537c('0x1c')](_0x2158e2);}return null;};}function patchUpdates(_0x32be40){return function(_0x5cfd81){try{jsonpatch[_0x537c('0x20')](_0x5cfd81,_0x32be40,!![]);}catch(_0x259ab2){return BPromise['reject'](_0x259ab2);}return _0x5cfd81['save']();};}function saveUpdates(_0x1a91d1,_0x47bece){return function(_0x5d8b9e){if(_0x5d8b9e){return _0x5d8b9e[_0x537c('0x21')](_0x1a91d1)[_0x537c('0x22')](function(_0x13fd5e){return _0x13fd5e;});}return null;};}function removeEntity(_0x28a35a,_0x3698bc){return function(_0x26ab7d){if(_0x26ab7d){return _0x26ab7d['destroy']()[_0x537c('0x22')](function(){_0x28a35a[_0x537c('0x1a')](0xcc)[_0x537c('0x1b')]();});}};}function handleEntityNotFound(_0xcd7d47,_0x428e5d){return function(_0x4b6af1){if(!_0x4b6af1){_0xcd7d47['sendStatus'](0x194);}return _0x4b6af1;};}function handleError(_0x59442f,_0x403ff6){_0x403ff6=_0x403ff6||0x1f4;return function(_0x1fa0ca){logger['error'](_0x1fa0ca[_0x537c('0x23')]);if(_0x1fa0ca[_0x537c('0x24')]){delete _0x1fa0ca[_0x537c('0x24')];}_0x59442f['status'](_0x403ff6)['send'](_0x1fa0ca);};}exports[_0x537c('0x25')]=function(_0x44cc94,_0x11c11e){var _0x4e5f18={},_0x49d60b={},_0x5ca8f6={'count':0x0,'rows':[]};var _0x22f82e=_[_0x537c('0x26')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x50788a){return{'name':_0x50788a['fieldName'],'type':_0x50788a[_0x537c('0x27')][_0x537c('0x28')]};});_0x49d60b[_0x537c('0x29')]=_['map'](_0x22f82e,_0x537c('0x24'));_0x49d60b[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x44cc94['query']);_0x49d60b[_0x537c('0x2c')]=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],_0x49d60b['query']);_0x4e5f18['attributes']=_[_0x537c('0x2d')](_0x49d60b[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x2e')]));_0x4e5f18[_0x537c('0x2f')]=_0x4e5f18[_0x537c('0x2f')][_0x537c('0x30')]?_0x4e5f18['attributes']:_0x49d60b['model'];if(!_0x44cc94[_0x537c('0x2a')][_0x537c('0x31')]('nolimit')){_0x4e5f18[_0x537c('0x1e')]=qs[_0x537c('0x1e')](_0x44cc94[_0x537c('0x2a')][_0x537c('0x1e')]);_0x4e5f18[_0x537c('0x1d')]=qs['offset'](_0x44cc94[_0x537c('0x2a')]['offset']);}_0x4e5f18['order']=qs['sort'](_0x44cc94['query'][_0x537c('0x32')]);_0x4e5f18[_0x537c('0x33')]=qs[_0x537c('0x2c')](_[_0x537c('0x34')](_0x44cc94[_0x537c('0x2a')],_0x49d60b[_0x537c('0x2c')]),_0x22f82e);if(_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]){_0x4e5f18[_0x537c('0x33')]=_[_0x537c('0x36')](_0x4e5f18[_0x537c('0x33')],{'$or':_[_0x537c('0x26')](_0x22f82e,function(_0x28b222){if(_0x28b222[_0x537c('0x27')]!=='VIRTUAL'){var _0x42ff20={};_0x42ff20[_0x28b222['name']]={'$like':'%'+_0x44cc94[_0x537c('0x2a')][_0x537c('0x35')]+'%'};return _0x42ff20;}})});}_0x4e5f18=_['merge']({},_0x4e5f18,_0x44cc94[_0x537c('0x37')]);var _0x3a05e1={'where':_0x4e5f18[_0x537c('0x33')]};return db[_0x537c('0x38')]['count'](_0x3a05e1)[_0x537c('0x22')](function(_0x189924){_0x5ca8f6[_0x537c('0x1f')]=_0x189924;if(_0x44cc94['query'][_0x537c('0x39')]){_0x4e5f18[_0x537c('0x3a')]=[{'all':!![]}];}return db[_0x537c('0x38')][_0x537c('0x3b')](_0x4e5f18);})[_0x537c('0x22')](function(_0x3fc07a){_0x5ca8f6['rows']=_0x3fc07a;return _0x5ca8f6;})[_0x537c('0x22')](respondWithFilteredResult(_0x11c11e,_0x4e5f18))[_0x537c('0x3c')](handleError(_0x11c11e,null));};exports[_0x537c('0x3d')]=function(_0x2ce967,_0x1f8350){var _0x2590f={'raw':!![],'where':{'id':_0x2ce967['params']['id']}},_0x2f236e={};_0x2f236e[_0x537c('0x29')]=_['keys'](db[_0x537c('0x38')][_0x537c('0x3e')]);_0x2f236e[_0x537c('0x2a')]=_[_0x537c('0x2b')](_0x2ce967[_0x537c('0x2a')]);_0x2f236e['filters']=_['intersection'](_0x2f236e[_0x537c('0x29')],_0x2f236e[_0x537c('0x2a')]);_0x2590f[_0x537c('0x2f')]=_[_0x537c('0x2d')](_0x2f236e[_0x537c('0x29')],qs[_0x537c('0x2e')](_0x2ce967['query'][_0x537c('0x2e')]));_0x2590f[_0x537c('0x2f')]=_0x2590f[_0x537c('0x2f')][_0x537c('0x30')]?_0x2590f[_0x537c('0x2f')]:_0x2f236e[_0x537c('0x29')];if(_0x2ce967[_0x537c('0x2a')][_0x537c('0x39')]){_0x2590f[_0x537c('0x3a')]=[{'all':!![]}];}_0x2590f=_[_0x537c('0x36')]({},_0x2590f,_0x2ce967[_0x537c('0x37')]);return db[_0x537c('0x38')][_0x537c('0x3f')](_0x2590f)[_0x537c('0x22')](handleEntityNotFound(_0x1f8350,null))['then'](respondWithResult(_0x1f8350,null))[_0x537c('0x3c')](handleError(_0x1f8350,null));};exports[_0x537c('0x40')]=function(_0x5bed3b,_0x2ddc3f){return db[_0x537c('0x38')][_0x537c('0x40')](_0x5bed3b['body'],{})[_0x537c('0x22')](respondWithResult(_0x2ddc3f,0xc9))[_0x537c('0x3c')](handleError(_0x2ddc3f,null));};exports[_0x537c('0x21')]=function(_0x432c00,_0x5b0dad){if(_0x432c00[_0x537c('0x41')]['id']){delete _0x432c00[_0x537c('0x41')]['id'];}return db[_0x537c('0x38')]['find']({'where':{'id':_0x432c00[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x5b0dad,null))[_0x537c('0x22')](saveUpdates(_0x432c00[_0x537c('0x41')],null))[_0x537c('0x22')](respondWithResult(_0x5b0dad,null))[_0x537c('0x3c')](handleError(_0x5b0dad,null));};exports[_0x537c('0x43')]=function(_0x25f216,_0x420f12){return db[_0x537c('0x38')][_0x537c('0x3f')]({'where':{'id':_0x25f216[_0x537c('0x42')]['id']}})['then'](handleEntityNotFound(_0x420f12,null))['then'](removeEntity(_0x420f12,null))[_0x537c('0x3c')](handleError(_0x420f12,null));};exports[_0x537c('0x44')]=function(_0x1d0bff,_0xfa8d30){return db[_0x537c('0x38')][_0x537c('0x44')]()[_0x537c('0x22')](respondWithResult(_0xfa8d30,null))['catch'](handleError(_0xfa8d30,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4f613c2..0283466 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 _0x5610=['JscriptyAnswerReport','report_jscripty_answers','util','api','moment','bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x524251,_0x64a098){var _0x3b1d4c=function(_0x24af4f){while(--_0x24af4f){_0x524251['push'](_0x524251['shift']());}};_0x3b1d4c(++_0x64a098);}(_0x5610,0x1a6));var _0x0561=function(_0x5e2ac3,_0x130ab1){_0x5e2ac3=_0x5e2ac3-0x0;var _0xe8416d=_0x5610[_0x5e2ac3];return _0xe8416d;};'use strict';var _=require('lodash');var util=require(_0x0561('0x0'));var logger=require('../../config/logger')(_0x0561('0x1'));var moment=require(_0x0561('0x2'));var BPromise=require(_0x0561('0x3'));var rp=require(_0x0561('0x4'));var fs=require('fs');var path=require(_0x0561('0x5'));var rimraf=require(_0x0561('0x6'));var config=require('../../config/environment');var attributes=require(_0x0561('0x7'));module[_0x0561('0x8')]=function(_0xf02d3d,_0x3b40d2){return _0xf02d3d[_0x0561('0x9')](_0x0561('0xa'),attributes,{'tableName':_0x0561('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f67=['request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird'];(function(_0x4964f7,_0x5d13e3){var _0x599afa=function(_0x45c7b5){while(--_0x45c7b5){_0x4964f7['push'](_0x4964f7['shift']());}};_0x599afa(++_0x5d13e3);}(_0x4f67,0x7f));var _0x74f6=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0x4f67[_0x152121];return _0x592a85;};'use strict';var _=require('lodash');var util=require(_0x74f6('0x0'));var logger=require(_0x74f6('0x1'))(_0x74f6('0x2'));var moment=require(_0x74f6('0x3'));var BPromise=require(_0x74f6('0x4'));var rp=require(_0x74f6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x74f6('0x6'));var config=require('../../config/environment');var attributes=require(_0x74f6('0x7'));module[_0x74f6('0x8')]=function(_0x1e5f69,_0x34f987){return _0x1e5f69[_0x74f6('0x9')](_0x74f6('0xa'),attributes,{'tableName':_0x74f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 0105e52..e0ea1f7 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 _0xf310=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4e0157,_0x147213){var _0x13a010=function(_0x3d39ea){while(--_0x3d39ea){_0x4e0157['push'](_0x4e0157['shift']());}};_0x13a010(++_0x147213);}(_0xf310,0x1e6));var _0x0f31=function(_0x4496be,_0x2053ee){_0x4496be=_0x4496be-0x0;var _0x31a26d=_0xf310[_0x4496be];return _0x31a26d;};'use strict';var _=require(_0x0f31('0x0'));var util=require(_0x0f31('0x1'));var moment=require(_0x0f31('0x2'));var BPromise=require(_0x0f31('0x3'));var rs=require(_0x0f31('0x4'));var fs=require('fs');var Redis=require(_0x0f31('0x5'));var db=require(_0x0f31('0x6'))['db'];var utils=require(_0x0f31('0x7'));var logger=require(_0x0f31('0x8'))('rpc');var config=require(_0x0f31('0x9'));var jayson=require(_0x0f31('0xa'));var client=jayson[_0x0f31('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x861d1f,_0x5cb9e5,_0x5f02f2){return new BPromise(function(_0x390ace,_0xa01367){return client['request'](_0x861d1f,_0x5f02f2)[_0x0f31('0xc')](function(_0x3670b4){logger[_0x0f31('0xd')](_0x0f31('0xe'),_0x5cb9e5,'request\x20sent');logger[_0x0f31('0xf')](_0x0f31('0x10'),_0x5cb9e5,_0x0f31('0x11'),JSON[_0x0f31('0x12')](_0x3670b4));if(_0x3670b4[_0x0f31('0x13')]){if(_0x3670b4[_0x0f31('0x13')]['code']===0x1f4){logger[_0x0f31('0x13')](_0x0f31('0xe'),_0x5cb9e5,_0x3670b4['error'][_0x0f31('0x14')]);return _0xa01367(_0x3670b4['error']['message']);}logger[_0x0f31('0x13')](_0x0f31('0xe'),_0x5cb9e5,_0x3670b4['error'][_0x0f31('0x14')]);return _0x390ace(_0x3670b4[_0x0f31('0x13')][_0x0f31('0x14')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x5cb9e5,'request\x20sent');_0x390ace(_0x3670b4['result']['message']);}})[_0x0f31('0x15')](function(_0x9d52b1){logger['error'](_0x0f31('0xe'),_0x5cb9e5,_0x9d52b1);_0xa01367(_0x9d52b1);});});} \ No newline at end of file +var _0x3a68=['stringify','error','code','message','request\x20sent','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x1f0656,_0x3b13fa){var _0x125f92=function(_0x54ef21){while(--_0x54ef21){_0x1f0656['push'](_0x1f0656['shift']());}};_0x125f92(++_0x3b13fa);}(_0x3a68,0xd8));var _0x83a6=function(_0x557b71,_0x3b0d4b){_0x557b71=_0x557b71-0x0;var _0x584171=_0x3a68[_0x557b71];return _0x584171;};'use strict';var _=require(_0x83a6('0x0'));var util=require(_0x83a6('0x1'));var moment=require('moment');var BPromise=require(_0x83a6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x83a6('0x4'));var logger=require(_0x83a6('0x5'))(_0x83a6('0x6'));var config=require(_0x83a6('0x7'));var jayson=require(_0x83a6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c4026,_0x193e6a,_0xcd636e){return new BPromise(function(_0x10d34b,_0x2fa0fd){return client[_0x83a6('0x9')](_0x4c4026,_0xcd636e)[_0x83a6('0xa')](function(_0x11006a){logger[_0x83a6('0xb')](_0x83a6('0xc'),_0x193e6a,'request\x20sent');logger[_0x83a6('0xd')](_0x83a6('0xe'),_0x193e6a,'request\x20sent',JSON[_0x83a6('0xf')](_0x11006a));if(_0x11006a[_0x83a6('0x10')]){if(_0x11006a[_0x83a6('0x10')][_0x83a6('0x11')]===0x1f4){logger['error'](_0x83a6('0xc'),_0x193e6a,_0x11006a[_0x83a6('0x10')][_0x83a6('0x12')]);return _0x2fa0fd(_0x11006a['error'][_0x83a6('0x12')]);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x193e6a,_0x11006a['error'][_0x83a6('0x12')]);return _0x10d34b(_0x11006a[_0x83a6('0x10')]['message']);}else{logger['info'](_0x83a6('0xc'),_0x193e6a,_0x83a6('0x13'));_0x10d34b(_0x11006a['result']['message']);}})[_0x83a6('0x14')](function(_0x53402a){logger['error'](_0x83a6('0xc'),_0x193e6a,_0x53402a);_0x2fa0fd(_0x53402a);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e15fc5f..27a1b4a 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 _0x61ac=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','put','destroy','multer','util','path'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x61ac,0x90));var _0xc61a=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x61ac[_0x44c935];return _0x465bee;};'use strict';var multer=require(_0xc61a('0x0'));var util=require(_0xc61a('0x1'));var path=require(_0xc61a('0x2'));var timeout=require('connect-timeout');var express=require(_0xc61a('0x3'));var router=express['Router']();var fs_extra=require(_0xc61a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc61a('0x5'));var config=require(_0xc61a('0x6'));var controller=require('./jscriptyProject.controller');router[_0xc61a('0x7')]('/',auth[_0xc61a('0x8')](),controller['index']);router[_0xc61a('0x7')](_0xc61a('0x9'),auth[_0xc61a('0x8')](),controller[_0xc61a('0xa')]);router[_0xc61a('0x7')](_0xc61a('0xb'),auth[_0xc61a('0x8')](),controller[_0xc61a('0xc')]);router['get']('/:id/answers',auth[_0xc61a('0x8')](),controller[_0xc61a('0xd')]);router[_0xc61a('0x7')](_0xc61a('0xe'),auth[_0xc61a('0x8')](),timeout('30s'),controller[_0xc61a('0xf')]);router[_0xc61a('0x10')]('/',auth['isAuthenticated'](),controller[_0xc61a('0x11')]);router['post'](_0xc61a('0x12'),auth['isAuthenticated'](),controller['clone']);router[_0xc61a('0x13')]('/:id',auth[_0xc61a('0x8')](),controller['update']);router['delete'](_0xc61a('0x9'),auth[_0xc61a('0x8')](),controller[_0xc61a('0x14')]);module['exports']=router; \ No newline at end of file +var _0x43b4=['put','update','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','/:id/sessions','isAuthenticated','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','create','post','/:id/clone','clone'];(function(_0x55da76,_0x46442d){var _0xc33da1=function(_0x4bfa0a){while(--_0x4bfa0a){_0x55da76['push'](_0x55da76['shift']());}};_0xc33da1(++_0x46442d);}(_0x43b4,0xe8));var _0x443b=function(_0x1a60be,_0x457ad7){_0x1a60be=_0x1a60be-0x0;var _0x2dff57=_0x43b4[_0x1a60be];return _0x2dff57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x443b('0x0'));var timeout=require(_0x443b('0x1'));var express=require(_0x443b('0x2'));var router=express[_0x443b('0x3')]();var fs_extra=require(_0x443b('0x4'));var auth=require(_0x443b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x443b('0x6'));var controller=require('./jscriptyProject.controller');router[_0x443b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x443b('0x7')](_0x443b('0x8'),auth['isAuthenticated'](),controller[_0x443b('0x9')]);router[_0x443b('0x7')](_0x443b('0xa'),auth[_0x443b('0xb')](),controller[_0x443b('0xc')]);router[_0x443b('0x7')](_0x443b('0xd'),auth[_0x443b('0xb')](),controller[_0x443b('0xe')]);router['get'](_0x443b('0xf'),auth[_0x443b('0xb')](),timeout('30s'),controller[_0x443b('0x10')]);router['post']('/',auth[_0x443b('0xb')](),controller[_0x443b('0x11')]);router[_0x443b('0x12')](_0x443b('0x13'),auth[_0x443b('0xb')](),controller[_0x443b('0x14')]);router[_0x443b('0x15')](_0x443b('0x8'),auth[_0x443b('0xb')](),controller[_0x443b('0x16')]);router['delete'](_0x443b('0x8'),auth[_0x443b('0xb')](),controller['destroy']);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 9db72e0..d7257cc 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 _0x3a63=['BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','long','setDataValue','formData','isString','format','getDataValue','description'];(function(_0x3ae97b,_0x15f170){var _0x48ccd4=function(_0xa613a0){while(--_0xa613a0){_0x3ae97b['push'](_0x3ae97b['shift']());}};_0x48ccd4(++_0x15f170);}(_0x3a63,0x71));var _0x33a6=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x3a63[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0x33a6('0x0'));var _=require(_0x33a6('0x1'));var util=require(_0x33a6('0x2'));module['exports']={'name':{'type':Sequelize[_0x33a6('0x3')],'unique':_0x33a6('0x4')},'description':{'type':Sequelize[_0x33a6('0x3')]},'formData':{'type':Sequelize[_0x33a6('0x5')](_0x33a6('0x6')),'set':function(_0x193e6e){if(_['isObjectLike'](_0x193e6e)){this[_0x33a6('0x7')](_0x33a6('0x8'),JSON['stringify'](_0x193e6e));}else if(_[_0x33a6('0x9')](_0x193e6e)){this[_0x33a6('0x7')](_0x33a6('0x8'),_0x193e6e);}else{this[_0x33a6('0x7')](_0x33a6('0x8'),util[_0x33a6('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x33a6('0xb')](_0x33a6('0x4'))||'',this[_0x33a6('0xb')](_0x33a6('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x33a6('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x33a6('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d74=['lodash','util','exports','name','STRING','TEXT','long','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x4467b8,_0x409f72){var _0x45ab5a=function(_0x26a04d){while(--_0x26a04d){_0x4467b8['push'](_0x4467b8['shift']());}};_0x45ab5a(++_0x409f72);}(_0x8d74,0x131));var _0x48d7=function(_0x391572,_0x4fdfab){_0x391572=_0x391572-0x0;var _0xeb6c64=_0x8d74[_0x391572];return _0xeb6c64;};'use strict';var Sequelize=require(_0x48d7('0x0'));var _=require(_0x48d7('0x1'));var util=require(_0x48d7('0x2'));module[_0x48d7('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x48d7('0x4')},'description':{'type':Sequelize[_0x48d7('0x5')]},'formData':{'type':Sequelize[_0x48d7('0x6')](_0x48d7('0x7')),'set':function(_0x1a189a){if(_['isObjectLike'](_0x1a189a)){this[_0x48d7('0x8')]('formData',JSON[_0x48d7('0x9')](_0x1a189a));}else if(_[_0x48d7('0xa')](_0x1a189a)){this['setDataValue'](_0x48d7('0xb'),_0x1a189a);}else{this['setDataValue'](_0x48d7('0xb'),util[_0x48d7('0xc')](_0x48d7('0xd'),this[_0x48d7('0xe')](_0x48d7('0x4'))||'',this['getDataValue'](_0x48d7('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x48d7('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f660450..9696eee 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 _0xcd78=['includeAll','include','rows','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','hasOwnProperty','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','save','then','destroy','Projects','UserProfileResource','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count'];(function(_0x59c866,_0x67ec75){var _0x4f8771=function(_0x3fc8c4){while(--_0x3fc8c4){_0x59c866['push'](_0x59c866['shift']());}};_0x4f8771(++_0x67ec75);}(_0xcd78,0xa9));var _0x8cd7=function(_0x1135b1,_0x644ab2){_0x1135b1=_0x1135b1-0x0;var _0x387f6b=_0xcd78[_0x1135b1];return _0x387f6b;};'use strict';var emlformat=require(_0x8cd7('0x0'));var rimraf=require(_0x8cd7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8cd7('0x2'));var rp=require(_0x8cd7('0x3'));var moment=require(_0x8cd7('0x4'));var BPromise=require(_0x8cd7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8cd7('0x6'));var csv=require('to-csv');var ejs=require(_0x8cd7('0x7'));var fs=require('fs');var fs_extra=require(_0x8cd7('0x8'));var _=require(_0x8cd7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cd7('0xa'));var toCsv=require(_0x8cd7('0xb'));var querystring=require(_0x8cd7('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8cd7('0xd'));var qs=require(_0x8cd7('0xe'));var as=require(_0x8cd7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8cd7('0x10'));var licenseUtil=require(_0x8cd7('0x11'));var db=require(_0x8cd7('0x12'))['db'];function respondWithStatusCode(_0x1e1816,_0x2d6488){_0x2d6488=_0x2d6488||0xcc;return function(_0x3772ab){if(_0x3772ab){return _0x1e1816[_0x8cd7('0x13')](_0x2d6488);}return _0x1e1816['status'](_0x2d6488)[_0x8cd7('0x14')]();};}function respondWithResult(_0x204f1c,_0x53b4e9){_0x53b4e9=_0x53b4e9||0xc8;return function(_0x273b36){if(_0x273b36){return _0x204f1c['status'](_0x53b4e9)[_0x8cd7('0x15')](_0x273b36);}};}function respondWithFilteredResult(_0x46222c,_0x11eef9){return function(_0x5e800c){if(_0x5e800c){var _0x47eacb=typeof _0x11eef9[_0x8cd7('0x16')]===_0x8cd7('0x17')&&typeof _0x11eef9[_0x8cd7('0x18')]==='undefined';var _0x5207a5=_0x5e800c['count'];var _0x39b142=_0x47eacb?0x0:_0x11eef9[_0x8cd7('0x16')];var _0x4e21a5=_0x47eacb?_0x5e800c['count']:_0x11eef9[_0x8cd7('0x16')]+_0x11eef9[_0x8cd7('0x18')];var _0x51084f;if(_0x4e21a5>=_0x5207a5){_0x4e21a5=_0x5207a5;_0x51084f=0xc8;}else{_0x51084f=0xce;}_0x46222c[_0x8cd7('0x19')](_0x51084f);return _0x46222c[_0x8cd7('0x1a')]('Content-Range',_0x39b142+'-'+_0x4e21a5+'/'+_0x5207a5)[_0x8cd7('0x15')](_0x5e800c);}return null;};}function patchUpdates(_0x5429f5){return function(_0x51b011){try{jsonpatch[_0x8cd7('0x1b')](_0x51b011,_0x5429f5,!![]);}catch(_0x1964e7){return BPromise['reject'](_0x1964e7);}return _0x51b011[_0x8cd7('0x1c')]();};}function saveUpdates(_0x23c0a0,_0x36ae69){return function(_0x593374){if(_0x593374){return _0x593374['update'](_0x23c0a0)[_0x8cd7('0x1d')](function(_0x3d18e3){return _0x3d18e3;});}return null;};}function removeEntity(_0x3e35b9,_0xc5cd33){return function(_0x523455){if(_0x523455){return _0x523455[_0x8cd7('0x1e')]()['then'](function(){var _0x46ba49=_0x523455['get']({'plain':!![]});var _0xba3de=_0x8cd7('0x1f');return db[_0x8cd7('0x20')][_0x8cd7('0x1e')]({'where':{'type':_0xba3de,'resourceId':_0x46ba49['id']}})[_0x8cd7('0x1d')](function(){return _0x523455;});})[_0x8cd7('0x1d')](function(){_0x3e35b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37c227,_0x58989b){return function(_0x5132dd){if(!_0x5132dd){_0x37c227[_0x8cd7('0x13')](0x194);}return _0x5132dd;};}function handleError(_0x3decd4,_0x40f5d2){_0x40f5d2=_0x40f5d2||0x1f4;return function(_0x342c1c){logger[_0x8cd7('0x21')](_0x342c1c[_0x8cd7('0x22')]);if(_0x342c1c[_0x8cd7('0x23')]){delete _0x342c1c[_0x8cd7('0x23')];}_0x3decd4[_0x8cd7('0x19')](_0x40f5d2)['send'](_0x342c1c);};}exports[_0x8cd7('0x24')]=function(_0x246432,_0x2dc257){var _0x295af4={},_0x3cfde1={},_0x5ac694={'count':0x0,'rows':[]};var _0x1346f0=_[_0x8cd7('0x25')](db[_0x8cd7('0x26')][_0x8cd7('0x27')],function(_0x3e558f){return{'name':_0x3e558f[_0x8cd7('0x28')],'type':_0x3e558f['type'][_0x8cd7('0x29')]};});_0x3cfde1[_0x8cd7('0x2a')]=_[_0x8cd7('0x25')](_0x1346f0,_0x8cd7('0x23'));_0x3cfde1[_0x8cd7('0x2b')]=_[_0x8cd7('0x2c')](_0x246432[_0x8cd7('0x2b')]);_0x3cfde1[_0x8cd7('0x2d')]=_[_0x8cd7('0x2e')](_0x3cfde1[_0x8cd7('0x2a')],_0x3cfde1[_0x8cd7('0x2b')]);_0x295af4[_0x8cd7('0x2f')]=_[_0x8cd7('0x2e')](_0x3cfde1[_0x8cd7('0x2a')],qs[_0x8cd7('0x30')](_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x30')]));_0x295af4[_0x8cd7('0x2f')]=_0x295af4[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0x295af4[_0x8cd7('0x2f')]:_0x3cfde1[_0x8cd7('0x2a')];if(!_0x246432['query']['hasOwnProperty'](_0x8cd7('0x32'))){_0x295af4['limit']=qs['limit'](_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x18')]);_0x295af4['offset']=qs['offset'](_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x16')]);}_0x295af4[_0x8cd7('0x33')]=qs[_0x8cd7('0x34')](_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x34')]);_0x295af4[_0x8cd7('0x35')]=qs['filters'](_[_0x8cd7('0x36')](_0x246432[_0x8cd7('0x2b')],_0x3cfde1[_0x8cd7('0x2d')]),_0x1346f0);if(_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x37')]){_0x295af4[_0x8cd7('0x35')]=_[_0x8cd7('0x38')](_0x295af4[_0x8cd7('0x35')],{'$or':_[_0x8cd7('0x25')](_0x1346f0,function(_0x426355){if(_0x426355[_0x8cd7('0x39')]!==_0x8cd7('0x3a')){var _0x1896b0={};_0x1896b0[_0x426355[_0x8cd7('0x23')]]={'$like':'%'+_0x246432[_0x8cd7('0x2b')][_0x8cd7('0x37')]+'%'};return _0x1896b0;}})});}_0x295af4=_[_0x8cd7('0x38')]({},_0x295af4,_0x246432[_0x8cd7('0x3b')]);var _0x32ba73={'where':_0x295af4['where']};return db[_0x8cd7('0x26')][_0x8cd7('0x3c')](_0x32ba73)[_0x8cd7('0x1d')](function(_0x17ca18){_0x5ac694['count']=_0x17ca18;if(_0x246432['query'][_0x8cd7('0x3d')]){_0x295af4[_0x8cd7('0x3e')]=[{'all':!![]}];}return db[_0x8cd7('0x26')]['findAll'](_0x295af4);})[_0x8cd7('0x1d')](function(_0x60e4e2){_0x5ac694[_0x8cd7('0x3f')]=_0x60e4e2;return _0x5ac694;})[_0x8cd7('0x1d')](respondWithFilteredResult(_0x2dc257,_0x295af4))['catch'](handleError(_0x2dc257,null));};exports[_0x8cd7('0x40')]=function(_0x50ec2f,_0xde758d){var _0xda871c={'raw':![],'where':{'id':_0x50ec2f[_0x8cd7('0x41')]['id']}},_0x455600={};_0x455600[_0x8cd7('0x2a')]=_[_0x8cd7('0x2c')](db['JscriptyProject'][_0x8cd7('0x27')]);_0x455600[_0x8cd7('0x2b')]=_[_0x8cd7('0x2c')](_0x50ec2f[_0x8cd7('0x2b')]);_0x455600['filters']=_[_0x8cd7('0x2e')](_0x455600[_0x8cd7('0x2a')],_0x455600[_0x8cd7('0x2b')]);_0xda871c['attributes']=_[_0x8cd7('0x2e')](_0x455600[_0x8cd7('0x2a')],qs[_0x8cd7('0x30')](_0x50ec2f['query'][_0x8cd7('0x30')]));_0xda871c['attributes']=_0xda871c[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0xda871c['attributes']:_0x455600['model'];if(_0x50ec2f[_0x8cd7('0x2b')]['includeAll']){_0xda871c[_0x8cd7('0x3e')]=[{'all':!![]}];}_0xda871c=_[_0x8cd7('0x38')]({},_0xda871c,_0x50ec2f[_0x8cd7('0x3b')]);return db[_0x8cd7('0x26')]['find'](_0xda871c)[_0x8cd7('0x1d')](handleEntityNotFound(_0xde758d,null))[_0x8cd7('0x1d')](respondWithResult(_0xde758d,null))['catch'](handleError(_0xde758d,null));};exports['create']=function(_0x286c73,_0x7fa08c){return db['JscriptyProject'][_0x8cd7('0x42')](_0x286c73[_0x8cd7('0x43')],{})['then'](function(_0x21791b){var _0x2cf725=_0x286c73[_0x8cd7('0x44')][_0x8cd7('0x45')]({'plain':!![]});if(!_0x2cf725)throw new Error(_0x8cd7('0x46'));if(_0x2cf725['role']===_0x8cd7('0x44')){var _0x3df7aa=_0x21791b[_0x8cd7('0x45')]({'plain':!![]});var _0x16c759='Projects';return db[_0x8cd7('0x47')][_0x8cd7('0x48')]({'where':{'name':_0x16c759,'userProfileId':_0x2cf725[_0x8cd7('0x49')]},'raw':!![]})['then'](function(_0x54ac7f){if(_0x54ac7f&&_0x54ac7f[_0x8cd7('0x4a')]===0x0){return db[_0x8cd7('0x20')]['create']({'name':_0x3df7aa[_0x8cd7('0x23')],'resourceId':_0x3df7aa['id'],'type':_0x54ac7f[_0x8cd7('0x23')],'sectionId':_0x54ac7f['id']},{})[_0x8cd7('0x1d')](function(){return _0x21791b;});}else{return _0x21791b;}})[_0x8cd7('0x4b')](function(_0x5beb0d){logger[_0x8cd7('0x21')](_0x8cd7('0x4c'),_0x5beb0d);throw _0x5beb0d;});}return _0x21791b;})[_0x8cd7('0x1d')](respondWithResult(_0x7fa08c,0xc9))['catch'](handleError(_0x7fa08c,null));};exports[_0x8cd7('0x4d')]=function(_0x5541cb,_0x3e4950){var _0x5b5377={'where':{'id':_0x5541cb[_0x8cd7('0x41')]['id']}},_0x161253={};_0x161253[_0x8cd7('0x2a')]=_[_0x8cd7('0x2c')](db[_0x8cd7('0x26')][_0x8cd7('0x27')]);_0x5b5377[_0x8cd7('0x2f')]=_[_0x8cd7('0x2e')](_0x161253['model'],qs[_0x8cd7('0x30')](_0x5541cb[_0x8cd7('0x2b')][_0x8cd7('0x30')]));_0x5b5377[_0x8cd7('0x2f')]=_0x5b5377['attributes'][_0x8cd7('0x31')]?_0x5b5377[_0x8cd7('0x2f')]:_0x161253[_0x8cd7('0x2a')];if(_0x5541cb[_0x8cd7('0x2b')][_0x8cd7('0x3d')]){_0x5b5377['include']=[{'all':!![]}];}_0x5b5377=_[_0x8cd7('0x38')]({},_0x5b5377,_0x5541cb[_0x8cd7('0x3b')]);return db[_0x8cd7('0x26')][_0x8cd7('0x48')](_0x5b5377)[_0x8cd7('0x1d')](handleEntityNotFound(_0x3e4950,null))['then'](function(_0x233330){if(_0x233330){var _0x38a970=_0x233330[_0x8cd7('0x45')]({'plain':!![]});_0x38a970=qs[_0x8cd7('0x4e')](_0x38a970,['id','createdAt','updatedAt']);_0x5541cb[_0x8cd7('0x43')]=_['omit'](_0x5541cb[_0x8cd7('0x43')],['id',_0x8cd7('0x4f'),_0x8cd7('0x50')]);return db[_0x8cd7('0x26')]['create'](_[_0x8cd7('0x38')](_0x38a970,_0x5541cb[_0x8cd7('0x43')]),{'include':_0x5541cb['query'][_0x8cd7('0x3d')]?[{'all':!![]}]:undefined})[_0x8cd7('0x1d')](function(_0x50db76){var _0x2a5944=_0x5541cb[_0x8cd7('0x44')]['get']({'plain':!![]});if(!_0x2a5944)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a5944['role']===_0x8cd7('0x44')){var _0x2e185a=_0x50db76[_0x8cd7('0x45')]({'plain':!![]});var _0xd0add3='Projects';return db[_0x8cd7('0x47')][_0x8cd7('0x48')]({'where':{'name':_0xd0add3,'userProfileId':_0x2a5944[_0x8cd7('0x49')]},'raw':!![]})[_0x8cd7('0x1d')](function(_0x335fe1){if(_0x335fe1&&_0x335fe1[_0x8cd7('0x4a')]===0x0){return db[_0x8cd7('0x20')][_0x8cd7('0x42')]({'name':_0x2e185a[_0x8cd7('0x23')],'resourceId':_0x2e185a['id'],'type':_0x335fe1[_0x8cd7('0x23')],'sectionId':_0x335fe1['id']},{})[_0x8cd7('0x1d')](function(){return _0x50db76;});}else{return _0x50db76;}})[_0x8cd7('0x4b')](function(_0xa0a641){logger[_0x8cd7('0x21')](_0x8cd7('0x4c'),_0xa0a641);throw _0xa0a641;});}return _0x50db76;});}})[_0x8cd7('0x1d')](respondWithResult(_0x3e4950,0xc9))[_0x8cd7('0x4b')](handleError(_0x3e4950,null));};exports[_0x8cd7('0x51')]=function(_0x157a3c,_0x1120b4){if(_0x157a3c['body']['id']){delete _0x157a3c[_0x8cd7('0x43')]['id'];}return db[_0x8cd7('0x26')][_0x8cd7('0x48')]({'where':{'id':_0x157a3c['params']['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x1120b4,null))[_0x8cd7('0x1d')](saveUpdates(_0x157a3c['body'],null))['then'](respondWithResult(_0x1120b4,null))[_0x8cd7('0x4b')](handleError(_0x1120b4,null));};exports[_0x8cd7('0x1e')]=function(_0x220ad7,_0x3b0119){return db[_0x8cd7('0x26')][_0x8cd7('0x48')]({'where':{'id':_0x220ad7[_0x8cd7('0x41')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x3b0119,null))[_0x8cd7('0x1d')](removeEntity(_0x3b0119,null))[_0x8cd7('0x4b')](handleError(_0x3b0119,null));};exports[_0x8cd7('0x52')]=function(_0x4cf73c,_0x3a65cd,_0x22b213){var _0x2e2252={'raw':!![],'where':{}};var _0x5efa65={};var _0x5847d2={'count':0x0,'rows':[]};return db[_0x8cd7('0x26')][_0x8cd7('0x53')]({'where':{'id':_0x4cf73c[_0x8cd7('0x41')]['id']}})['then'](handleEntityNotFound(_0x3a65cd,null))[_0x8cd7('0x1d')](function(_0x5b6af4){if(_0x5b6af4){_0x5efa65[_0x8cd7('0x2a')]=_[_0x8cd7('0x2c')](db[_0x8cd7('0x54')][_0x8cd7('0x27')]);_0x5efa65[_0x8cd7('0x2b')]=_[_0x8cd7('0x2c')](_0x4cf73c[_0x8cd7('0x2b')]);_0x5efa65[_0x8cd7('0x2d')]=_[_0x8cd7('0x2e')](_0x5efa65[_0x8cd7('0x2a')],_0x5efa65[_0x8cd7('0x2b')]);_0x2e2252[_0x8cd7('0x2f')]=_[_0x8cd7('0x2e')](_0x5efa65['model'],qs[_0x8cd7('0x30')](_0x4cf73c[_0x8cd7('0x2b')][_0x8cd7('0x30')]));_0x2e2252[_0x8cd7('0x2f')]=_0x2e2252[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0x2e2252[_0x8cd7('0x2f')]:_0x5efa65[_0x8cd7('0x2a')];if(!_0x4cf73c[_0x8cd7('0x2b')][_0x8cd7('0x55')](_0x8cd7('0x32'))){_0x2e2252[_0x8cd7('0x18')]=qs[_0x8cd7('0x18')](_0x4cf73c['query']['limit']);_0x2e2252['offset']=qs['offset'](_0x4cf73c[_0x8cd7('0x2b')][_0x8cd7('0x16')]);}_0x2e2252[_0x8cd7('0x33')]=qs[_0x8cd7('0x34')](_0x4cf73c[_0x8cd7('0x2b')]['sort']);_0x2e2252[_0x8cd7('0x35')]=qs[_0x8cd7('0x2d')](_[_0x8cd7('0x36')](_0x4cf73c[_0x8cd7('0x2b')],_0x5efa65[_0x8cd7('0x2d')]));_0x2e2252[_0x8cd7('0x35')][_0x8cd7('0x56')]=_0x5b6af4['id'];if(_0x4cf73c[_0x8cd7('0x2b')][_0x8cd7('0x37')]){_0x2e2252['where']=_['merge'](_0x2e2252[_0x8cd7('0x35')],{'$or':_['map'](_0x2e2252[_0x8cd7('0x2f')],function(_0x1fb914){var _0x436d60={};_0x436d60[_0x1fb914]={'$like':'%'+_0x4cf73c['query'][_0x8cd7('0x37')]+'%'};return _0x436d60;})});}_0x2e2252=_[_0x8cd7('0x38')]({},_0x2e2252,_0x4cf73c[_0x8cd7('0x3b')]);return db['JscriptySessionReport'][_0x8cd7('0x3c')]({'where':_0x2e2252[_0x8cd7('0x35')]})[_0x8cd7('0x1d')](function(_0x265d71){_0x5847d2[_0x8cd7('0x3c')]=_0x265d71;if(_0x4cf73c[_0x8cd7('0x2b')][_0x8cd7('0x3d')]){_0x2e2252[_0x8cd7('0x3e')]=[{'all':!![]}];}return db[_0x8cd7('0x54')][_0x8cd7('0x57')](_0x2e2252);})[_0x8cd7('0x1d')](function(_0x42b21a){_0x5847d2[_0x8cd7('0x3f')]=_0x42b21a;return _0x5847d2;});}})['then'](respondWithFilteredResult(_0x3a65cd,_0x2e2252))[_0x8cd7('0x4b')](handleError(_0x3a65cd,null));};exports[_0x8cd7('0x58')]=function(_0x1bb73d,_0x4c4b4c,_0x1b8ec4){var _0x2e8b49={'raw':!![],'where':{}};var _0xb895cd={};var _0x5e74e2={'count':0x0,'rows':[]};return db[_0x8cd7('0x26')][_0x8cd7('0x53')]({'where':{'id':_0x1bb73d[_0x8cd7('0x41')]['id']}})[_0x8cd7('0x1d')](handleEntityNotFound(_0x4c4b4c,null))[_0x8cd7('0x1d')](function(_0x5e1c29){if(_0x5e1c29){_0xb895cd[_0x8cd7('0x2a')]=_[_0x8cd7('0x2c')](db[_0x8cd7('0x59')][_0x8cd7('0x27')]);_0xb895cd[_0x8cd7('0x2b')]=_[_0x8cd7('0x2c')](_0x1bb73d[_0x8cd7('0x2b')]);_0xb895cd[_0x8cd7('0x2d')]=_['intersection'](_0xb895cd['model'],_0xb895cd['query']);_0x2e8b49[_0x8cd7('0x2f')]=_[_0x8cd7('0x2e')](_0xb895cd[_0x8cd7('0x2a')],qs[_0x8cd7('0x30')](_0x1bb73d[_0x8cd7('0x2b')][_0x8cd7('0x30')]));_0x2e8b49[_0x8cd7('0x2f')]=_0x2e8b49[_0x8cd7('0x2f')][_0x8cd7('0x31')]?_0x2e8b49[_0x8cd7('0x2f')]:_0xb895cd[_0x8cd7('0x2a')];if(!_0x1bb73d[_0x8cd7('0x2b')][_0x8cd7('0x55')](_0x8cd7('0x32'))){_0x2e8b49[_0x8cd7('0x18')]=qs[_0x8cd7('0x18')](_0x1bb73d['query'][_0x8cd7('0x18')]);_0x2e8b49['offset']=qs[_0x8cd7('0x16')](_0x1bb73d[_0x8cd7('0x2b')][_0x8cd7('0x16')]);}_0x2e8b49[_0x8cd7('0x33')]=qs[_0x8cd7('0x34')](_0x1bb73d['query']['sort']);_0x2e8b49[_0x8cd7('0x35')]=qs[_0x8cd7('0x2d')](_[_0x8cd7('0x36')](_0x1bb73d['query'],_0xb895cd[_0x8cd7('0x2d')]));_0x2e8b49['where'][_0x8cd7('0x56')]=_0x5e1c29['id'];if(_0x1bb73d[_0x8cd7('0x2b')]['filter']){_0x2e8b49[_0x8cd7('0x35')]=_[_0x8cd7('0x38')](_0x2e8b49['where'],{'$or':_['map'](_0x2e8b49[_0x8cd7('0x2f')],function(_0x27d966){var _0x4532e4={};_0x4532e4[_0x27d966]={'$like':'%'+_0x1bb73d['query'][_0x8cd7('0x37')]+'%'};return _0x4532e4;})});}_0x2e8b49=_[_0x8cd7('0x38')]({},_0x2e8b49,_0x1bb73d['options']);return db[_0x8cd7('0x59')]['count']({'where':_0x2e8b49[_0x8cd7('0x35')]})[_0x8cd7('0x1d')](function(_0x384345){_0x5e74e2[_0x8cd7('0x3c')]=_0x384345;if(_0x1bb73d[_0x8cd7('0x2b')]['includeAll']){_0x2e8b49['include']=[{'all':!![]}];}return db[_0x8cd7('0x59')][_0x8cd7('0x57')](_0x2e8b49);})[_0x8cd7('0x1d')](function(_0x54d152){_0x5e74e2[_0x8cd7('0x3f')]=_0x54d152;return _0x5e74e2;});}})[_0x8cd7('0x1d')](respondWithFilteredResult(_0x4c4b4c,_0x2e8b49))[_0x8cd7('0x4b')](handleError(_0x4c4b4c,null));};function char(_0x278797){return _0x8cd7('0x5a')===typeof _0x278797?String[_0x8cd7('0x5b')]['apply'](null,arguments):_0x278797;}function needsEncapsulation(_0x1c62e9){return!!_0x1c62e9&&(_0x1c62e9[_0x8cd7('0x5c')]()[_0x8cd7('0x5d')](char(0xd))>=0x0||_0x1c62e9[_0x8cd7('0x5c')]()[_0x8cd7('0x5d')](char(0xa))>=0x0||_0x1c62e9[_0x8cd7('0x5c')]()[_0x8cd7('0x5d')](char(0x2c))>=0x0||_0x1c62e9[_0x8cd7('0x5c')]()[_0x8cd7('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x11fe0a){var _0x5ec0bf=char(0x22),_0x1211bf='\x5c'+char(0x22),_0xaf0b5c=_0x11fe0a[_0x8cd7('0x5c')]()[_0x8cd7('0x5e')](new RegExp(_0x5ec0bf,'g'),_0x1211bf);return _0x5ec0bf+_0xaf0b5c+_0x5ec0bf;}exports['getSummary']=function(_0x180ab4,_0x84214,_0x1efd69){var _0x41e3a4,_0x31d269;var _0x169e9b={'where':{'ProjectId':_0x180ab4[_0x8cd7('0x41')]['id']}};if(_0x180ab4[_0x8cd7('0x2b')][_0x8cd7('0x5f')]){_0x169e9b[_0x8cd7('0x35')][_0x8cd7('0x60')]=JSON[_0x8cd7('0x61')](_0x180ab4['query'][_0x8cd7('0x5f')]);}return db[_0x8cd7('0x54')]['findAll'](_0x169e9b)[_0x8cd7('0x1d')](handleEntityNotFound(_0x84214,null))[_0x8cd7('0x1d')](function(_0x3ee0c6){if(_0x3ee0c6){_0x41e3a4=_0x3ee0c6;return db[_0x8cd7('0x62')]['findAll']({'where':{'SessionId':{'$in':_[_0x8cd7('0x25')](_0x41e3a4,'id')},'ProjectId':_0x180ab4[_0x8cd7('0x41')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x84214,null))[_0x8cd7('0x1d')](function(_0x44b538){if(_0x44b538){_0x31d269=_0x44b538;var _0x3f6319={};for(var _0xd4faad=0x0,_0x1eba01=_0x31d269[_0x8cd7('0x31')];_0xd4faad<_0x1eba01;_0xd4faad++){if(!_0x3f6319[_0x8cd7('0x55')](_0x31d269[_0xd4faad][_0x8cd7('0x63')])){_0x3f6319[_0x31d269[_0xd4faad][_0x8cd7('0x63')]]=needsEncapsulation(_0x31d269[_0xd4faad]['question'])?encapsulate(_0x31d269[_0xd4faad][_0x8cd7('0x64')]):_0x31d269[_0xd4faad][_0x8cd7('0x64')];}}var _0x22dd42=[],_0x6ad60b={};for(var _0x33ce41=0x0,_0x4bdcdd=_0x41e3a4[_0x8cd7('0x31')];_0x33ce41<_0x4bdcdd;_0x33ce41++){_0x6ad60b={'ProjectId':_0x180ab4[_0x8cd7('0x41')]['id'],'SessionId':_0x41e3a4[_0x33ce41]['id'],'StartTime':moment(_0x41e3a4[_0x33ce41][_0x8cd7('0x60')])[_0x8cd7('0x65')](_0x8cd7('0x66'))};for(var _0x1a1705=0x0,_0x5f430a=_0x31d269['length'];_0x1a1705<_0x5f430a;_0x1a1705++){if(_0x31d269[_0x1a1705][_0x8cd7('0x67')]==_0x41e3a4[_0x33ce41]['id']&&_0x3f6319[_0x8cd7('0x55')](_0x31d269[_0x1a1705]['questionId'])){_0x6ad60b[_0x3f6319[_0x31d269[_0x1a1705][_0x8cd7('0x63')]]]=_0x31d269[_0x1a1705][_0x8cd7('0x68')];}}for(var _0x4e01fa in _0x3f6319){if(!_0x6ad60b[_0x8cd7('0x55')](_0x3f6319[_0x4e01fa])){_0x6ad60b[_0x3f6319[_0x4e01fa]]=null;}}_0x22dd42[_0x8cd7('0x69')](_0x6ad60b);}return _0x22dd42;}})[_0x8cd7('0x1d')](function(_0x38acd2){if(!_[_0x8cd7('0x6a')](_0x38acd2)){var _0x18eac6=toCsv(_0x38acd2);var _0x1b446c=Date['now']();fs[_0x8cd7('0x6b')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x180ab4[_0x8cd7('0x41')]['id'],_0x1b446c),_0x18eac6);_0x84214['setHeader']('Content-disposition',_0x8cd7('0x6c')+util[_0x8cd7('0x65')](_0x8cd7('0x6d'),_0x180ab4[_0x8cd7('0x41')]['id'],_0x1b446c));_0x84214[_0x8cd7('0x6e')](_0x8cd7('0x6f'),_0x8cd7('0x70'));return _0x84214[_0x8cd7('0x71')](util[_0x8cd7('0x65')](_0x8cd7('0x72'),_0x180ab4[_0x8cd7('0x41')]['id'],_0x1b446c));}else{return _0x84214[_0x8cd7('0x13')](0xcc);}})[_0x8cd7('0x4b')](handleError(_0x84214,null));}; \ No newline at end of file +var _0x38dc=['pick','filter','VIRTUAL','merge','options','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','omit','createdAt','userProfileId','error','update','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','zip-dir','fast-json-patch','mustache','path','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','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','then','destroy','get','Projects','UserProfileResource','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x51a6e8,_0x3e754a){var _0xda6ca=function(_0x2bc0e4){while(--_0x2bc0e4){_0x51a6e8['push'](_0x51a6e8['shift']());}};_0xda6ca(++_0x3e754a);}(_0x38dc,0x117));var _0xc38d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x38dc[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc38d('0x0'));var jsonpatch=require(_0xc38d('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc38d('0x2'));var util=require('util');var path=require(_0xc38d('0x3'));var sox=require('sox');var csv=require(_0xc38d('0x4'));var ejs=require(_0xc38d('0x5'));var fs=require('fs');var fs_extra=require(_0xc38d('0x6'));var _=require(_0xc38d('0x7'));var squel=require(_0xc38d('0x8'));var crypto=require(_0xc38d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc38d('0xa'));var toCsv=require(_0xc38d('0x4'));var querystring=require(_0xc38d('0xb'));var Papa=require(_0xc38d('0xc'));var Redis=require(_0xc38d('0xd'));var authService=require(_0xc38d('0xe'));var qs=require(_0xc38d('0xf'));var as=require(_0xc38d('0x10'));var hardwareService=require(_0xc38d('0x11'));var logger=require('../../config/logger')(_0xc38d('0x12'));var utils=require('../../config/utils');var config=require(_0xc38d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc38d('0x14'))['db'];function respondWithStatusCode(_0x3f9148,_0x55fadd){_0x55fadd=_0x55fadd||0xcc;return function(_0x5d1a05){if(_0x5d1a05){return _0x3f9148['sendStatus'](_0x55fadd);}return _0x3f9148[_0xc38d('0x15')](_0x55fadd)[_0xc38d('0x16')]();};}function respondWithResult(_0x7fe769,_0x33cb70){_0x33cb70=_0x33cb70||0xc8;return function(_0x21c3f9){if(_0x21c3f9){return _0x7fe769[_0xc38d('0x15')](_0x33cb70)[_0xc38d('0x17')](_0x21c3f9);}};}function respondWithFilteredResult(_0x4a3c4f,_0x73c0c2){return function(_0x5e9785){if(_0x5e9785){var _0x405097=typeof _0x73c0c2[_0xc38d('0x18')]===_0xc38d('0x19')&&typeof _0x73c0c2[_0xc38d('0x1a')]==='undefined';var _0x174bcd=_0x5e9785[_0xc38d('0x1b')];var _0xc01865=_0x405097?0x0:_0x73c0c2['offset'];var _0x27c320=_0x405097?_0x5e9785[_0xc38d('0x1b')]:_0x73c0c2['offset']+_0x73c0c2[_0xc38d('0x1a')];var _0x2f68fb;if(_0x27c320>=_0x174bcd){_0x27c320=_0x174bcd;_0x2f68fb=0xc8;}else{_0x2f68fb=0xce;}_0x4a3c4f[_0xc38d('0x15')](_0x2f68fb);return _0x4a3c4f['set']('Content-Range',_0xc01865+'-'+_0x27c320+'/'+_0x174bcd)[_0xc38d('0x17')](_0x5e9785);}return null;};}function patchUpdates(_0x40654b){return function(_0x4f5f76){try{jsonpatch['apply'](_0x4f5f76,_0x40654b,!![]);}catch(_0x3ab83b){return BPromise[_0xc38d('0x1c')](_0x3ab83b);}return _0x4f5f76['save']();};}function saveUpdates(_0x5571ed,_0x29b63a){return function(_0x2c14cb){if(_0x2c14cb){return _0x2c14cb['update'](_0x5571ed)[_0xc38d('0x1d')](function(_0x35bd12){return _0x35bd12;});}return null;};}function removeEntity(_0x523e36,_0x1e23f5){return function(_0xf42036){if(_0xf42036){return _0xf42036[_0xc38d('0x1e')]()['then'](function(){var _0xf2258f=_0xf42036[_0xc38d('0x1f')]({'plain':!![]});var _0x4a57c5=_0xc38d('0x20');return db[_0xc38d('0x21')][_0xc38d('0x1e')]({'where':{'type':_0x4a57c5,'resourceId':_0xf2258f['id']}})['then'](function(){return _0xf42036;});})[_0xc38d('0x1d')](function(){_0x523e36[_0xc38d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x797c7d,_0x2ee943){return function(_0x5f48a2){if(!_0x5f48a2){_0x797c7d['sendStatus'](0x194);}return _0x5f48a2;};}function handleError(_0x425f3b,_0x5036ae){_0x5036ae=_0x5036ae||0x1f4;return function(_0x40a121){logger['error'](_0x40a121['stack']);if(_0x40a121[_0xc38d('0x22')]){delete _0x40a121[_0xc38d('0x22')];}_0x425f3b[_0xc38d('0x15')](_0x5036ae)['send'](_0x40a121);};}exports[_0xc38d('0x23')]=function(_0x37290c,_0xb046c6){var _0x5a553e={},_0x696ee4={},_0x47354c={'count':0x0,'rows':[]};var _0x9cb572=_['map'](db['JscriptyProject'][_0xc38d('0x24')],function(_0x594ac5){return{'name':_0x594ac5[_0xc38d('0x25')],'type':_0x594ac5[_0xc38d('0x26')][_0xc38d('0x27')]};});_0x696ee4[_0xc38d('0x28')]=_[_0xc38d('0x29')](_0x9cb572,_0xc38d('0x22'));_0x696ee4[_0xc38d('0x2a')]=_[_0xc38d('0x2b')](_0x37290c[_0xc38d('0x2a')]);_0x696ee4[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x696ee4[_0xc38d('0x28')],_0x696ee4[_0xc38d('0x2a')]);_0x5a553e[_0xc38d('0x2e')]=_['intersection'](_0x696ee4[_0xc38d('0x28')],qs['fields'](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x5a553e[_0xc38d('0x2e')]=_0x5a553e[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x5a553e['attributes']:_0x696ee4[_0xc38d('0x28')];if(!_0x37290c['query'][_0xc38d('0x31')](_0xc38d('0x32'))){_0x5a553e[_0xc38d('0x1a')]=qs['limit'](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x1a')]);_0x5a553e[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x37290c[_0xc38d('0x2a')][_0xc38d('0x18')]);}_0x5a553e[_0xc38d('0x33')]=qs['sort'](_0x37290c['query'][_0xc38d('0x34')]);_0x5a553e[_0xc38d('0x35')]=qs[_0xc38d('0x2c')](_[_0xc38d('0x36')](_0x37290c[_0xc38d('0x2a')],_0x696ee4[_0xc38d('0x2c')]),_0x9cb572);if(_0x37290c[_0xc38d('0x2a')][_0xc38d('0x37')]){_0x5a553e[_0xc38d('0x35')]=_['merge'](_0x5a553e[_0xc38d('0x35')],{'$or':_['map'](_0x9cb572,function(_0x8cbf1b){if(_0x8cbf1b[_0xc38d('0x26')]!==_0xc38d('0x38')){var _0x5a9d5d={};_0x5a9d5d[_0x8cbf1b[_0xc38d('0x22')]]={'$like':'%'+_0x37290c[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x5a9d5d;}})});}_0x5a553e=_[_0xc38d('0x39')]({},_0x5a553e,_0x37290c[_0xc38d('0x3a')]);var _0x39e4d0={'where':_0x5a553e[_0xc38d('0x35')]};return db[_0xc38d('0x3b')]['count'](_0x39e4d0)['then'](function(_0x59bfc6){_0x47354c[_0xc38d('0x1b')]=_0x59bfc6;if(_0x37290c[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x5a553e[_0xc38d('0x3d')]=[{'all':!![]}];}return db[_0xc38d('0x3b')][_0xc38d('0x3e')](_0x5a553e);})[_0xc38d('0x1d')](function(_0x4941ed){_0x47354c[_0xc38d('0x3f')]=_0x4941ed;return _0x47354c;})[_0xc38d('0x1d')](respondWithFilteredResult(_0xb046c6,_0x5a553e))[_0xc38d('0x40')](handleError(_0xb046c6,null));};exports[_0xc38d('0x41')]=function(_0x1243cf,_0x351821){var _0x2f00b9={'raw':![],'where':{'id':_0x1243cf[_0xc38d('0x42')]['id']}},_0x46ec86={};_0x46ec86[_0xc38d('0x28')]=_['keys'](db[_0xc38d('0x3b')]['rawAttributes']);_0x46ec86[_0xc38d('0x2a')]=_['keys'](_0x1243cf['query']);_0x46ec86['filters']=_[_0xc38d('0x2d')](_0x46ec86[_0xc38d('0x28')],_0x46ec86[_0xc38d('0x2a')]);_0x2f00b9['attributes']=_[_0xc38d('0x2d')](_0x46ec86['model'],qs[_0xc38d('0x2f')](_0x1243cf[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x2f00b9['attributes']=_0x2f00b9[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x2f00b9[_0xc38d('0x2e')]:_0x46ec86[_0xc38d('0x28')];if(_0x1243cf[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x2f00b9[_0xc38d('0x3d')]=[{'all':!![]}];}_0x2f00b9=_[_0xc38d('0x39')]({},_0x2f00b9,_0x1243cf[_0xc38d('0x3a')]);return db[_0xc38d('0x3b')]['find'](_0x2f00b9)['then'](handleEntityNotFound(_0x351821,null))['then'](respondWithResult(_0x351821,null))[_0xc38d('0x40')](handleError(_0x351821,null));};exports['create']=function(_0x190b09,_0x2280e3){return db[_0xc38d('0x3b')][_0xc38d('0x43')](_0x190b09[_0xc38d('0x44')],{})['then'](function(_0x31c5a7){var _0x2e9c96=_0x190b09[_0xc38d('0x45')][_0xc38d('0x1f')]({'plain':!![]});if(!_0x2e9c96)throw new Error(_0xc38d('0x46'));if(_0x2e9c96[_0xc38d('0x47')]===_0xc38d('0x45')){var _0x3f287b=_0x31c5a7['get']({'plain':!![]});var _0x2bb650=_0xc38d('0x20');return db[_0xc38d('0x48')]['find']({'where':{'name':_0x2bb650,'userProfileId':_0x2e9c96['userProfileId']},'raw':!![]})[_0xc38d('0x1d')](function(_0x1de93b){if(_0x1de93b&&_0x1de93b[_0xc38d('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0x3f287b[_0xc38d('0x22')],'resourceId':_0x3f287b['id'],'type':_0x1de93b[_0xc38d('0x22')],'sectionId':_0x1de93b['id']},{})['then'](function(){return _0x31c5a7;});}else{return _0x31c5a7;}})[_0xc38d('0x40')](function(_0x16bdce){logger['error'](_0xc38d('0x4a'),_0x16bdce);throw _0x16bdce;});}return _0x31c5a7;})['then'](respondWithResult(_0x2280e3,0xc9))['catch'](handleError(_0x2280e3,null));};exports['clone']=function(_0x2de3ea,_0x336063){var _0x4891db={'where':{'id':_0x2de3ea[_0xc38d('0x42')]['id']}},_0x42bf80={};_0x42bf80[_0xc38d('0x28')]=_[_0xc38d('0x2b')](db['JscriptyProject']['rawAttributes']);_0x4891db[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x42bf80[_0xc38d('0x28')],qs[_0xc38d('0x2f')](_0x2de3ea['query'][_0xc38d('0x2f')]));_0x4891db['attributes']=_0x4891db['attributes']['length']?_0x4891db[_0xc38d('0x2e')]:_0x42bf80['model'];if(_0x2de3ea['query'][_0xc38d('0x3c')]){_0x4891db[_0xc38d('0x3d')]=[{'all':!![]}];}_0x4891db=_[_0xc38d('0x39')]({},_0x4891db,_0x2de3ea['options']);return db[_0xc38d('0x3b')][_0xc38d('0x4b')](_0x4891db)[_0xc38d('0x1d')](handleEntityNotFound(_0x336063,null))[_0xc38d('0x1d')](function(_0x324cc6){if(_0x324cc6){var _0x432ede=_0x324cc6['get']({'plain':!![]});_0x432ede=qs[_0xc38d('0x4c')](_0x432ede,['id',_0xc38d('0x4d'),'updatedAt']);_0x2de3ea[_0xc38d('0x44')]=_[_0xc38d('0x4c')](_0x2de3ea[_0xc38d('0x44')],['id',_0xc38d('0x4d'),'updatedAt']);return db['JscriptyProject'][_0xc38d('0x43')](_[_0xc38d('0x39')](_0x432ede,_0x2de3ea['body']),{'include':_0x2de3ea['query'][_0xc38d('0x3c')]?[{'all':!![]}]:undefined})[_0xc38d('0x1d')](function(_0x17b5f8){var _0x459651=_0x2de3ea[_0xc38d('0x45')][_0xc38d('0x1f')]({'plain':!![]});if(!_0x459651)throw new Error(_0xc38d('0x46'));if(_0x459651['role']==='user'){var _0x37be5c=_0x17b5f8['get']({'plain':!![]});var _0x594533=_0xc38d('0x20');return db[_0xc38d('0x48')][_0xc38d('0x4b')]({'where':{'name':_0x594533,'userProfileId':_0x459651[_0xc38d('0x4e')]},'raw':!![]})[_0xc38d('0x1d')](function(_0x203d45){if(_0x203d45&&_0x203d45['autoAssociation']===0x0){return db[_0xc38d('0x21')][_0xc38d('0x43')]({'name':_0x37be5c[_0xc38d('0x22')],'resourceId':_0x37be5c['id'],'type':_0x203d45[_0xc38d('0x22')],'sectionId':_0x203d45['id']},{})[_0xc38d('0x1d')](function(){return _0x17b5f8;});}else{return _0x17b5f8;}})[_0xc38d('0x40')](function(_0x5bdad6){logger[_0xc38d('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bdad6);throw _0x5bdad6;});}return _0x17b5f8;});}})['then'](respondWithResult(_0x336063,0xc9))['catch'](handleError(_0x336063,null));};exports[_0xc38d('0x50')]=function(_0x3ba459,_0xfdee8b){if(_0x3ba459[_0xc38d('0x44')]['id']){delete _0x3ba459['body']['id'];}return db[_0xc38d('0x3b')][_0xc38d('0x4b')]({'where':{'id':_0x3ba459[_0xc38d('0x42')]['id']}})[_0xc38d('0x1d')](handleEntityNotFound(_0xfdee8b,null))[_0xc38d('0x1d')](saveUpdates(_0x3ba459[_0xc38d('0x44')],null))[_0xc38d('0x1d')](respondWithResult(_0xfdee8b,null))[_0xc38d('0x40')](handleError(_0xfdee8b,null));};exports['destroy']=function(_0x30cbfc,_0x18b517){return db['JscriptyProject'][_0xc38d('0x4b')]({'where':{'id':_0x30cbfc['params']['id']}})['then'](handleEntityNotFound(_0x18b517,null))[_0xc38d('0x1d')](removeEntity(_0x18b517,null))[_0xc38d('0x40')](handleError(_0x18b517,null));};exports[_0xc38d('0x51')]=function(_0x259d8c,_0x3383eb,_0x5089a2){var _0x217bf2={'raw':!![],'where':{}};var _0x3ca637={};var _0x33f98a={'count':0x0,'rows':[]};return db[_0xc38d('0x3b')][_0xc38d('0x52')]({'where':{'id':_0x259d8c[_0xc38d('0x42')]['id']}})[_0xc38d('0x1d')](handleEntityNotFound(_0x3383eb,null))[_0xc38d('0x1d')](function(_0x537b11){if(_0x537b11){_0x3ca637[_0xc38d('0x28')]=_[_0xc38d('0x2b')](db[_0xc38d('0x53')]['rawAttributes']);_0x3ca637[_0xc38d('0x2a')]=_[_0xc38d('0x2b')](_0x259d8c[_0xc38d('0x2a')]);_0x3ca637[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x3ca637[_0xc38d('0x28')],_0x3ca637[_0xc38d('0x2a')]);_0x217bf2[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x3ca637['model'],qs[_0xc38d('0x2f')](_0x259d8c['query']['fields']));_0x217bf2[_0xc38d('0x2e')]=_0x217bf2[_0xc38d('0x2e')][_0xc38d('0x30')]?_0x217bf2[_0xc38d('0x2e')]:_0x3ca637[_0xc38d('0x28')];if(!_0x259d8c['query'][_0xc38d('0x31')](_0xc38d('0x32'))){_0x217bf2[_0xc38d('0x1a')]=qs[_0xc38d('0x1a')](_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x1a')]);_0x217bf2[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x259d8c['query']['offset']);}_0x217bf2[_0xc38d('0x33')]=qs[_0xc38d('0x34')](_0x259d8c['query'][_0xc38d('0x34')]);_0x217bf2[_0xc38d('0x35')]=qs['filters'](_[_0xc38d('0x36')](_0x259d8c[_0xc38d('0x2a')],_0x3ca637[_0xc38d('0x2c')]));_0x217bf2[_0xc38d('0x35')][_0xc38d('0x54')]=_0x537b11['id'];if(_0x259d8c[_0xc38d('0x2a')]['filter']){_0x217bf2[_0xc38d('0x35')]=_[_0xc38d('0x39')](_0x217bf2[_0xc38d('0x35')],{'$or':_[_0xc38d('0x29')](_0x217bf2[_0xc38d('0x2e')],function(_0x2c8cea){var _0x41d683={};_0x41d683[_0x2c8cea]={'$like':'%'+_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x41d683;})});}_0x217bf2=_[_0xc38d('0x39')]({},_0x217bf2,_0x259d8c[_0xc38d('0x3a')]);return db['JscriptySessionReport'][_0xc38d('0x1b')]({'where':_0x217bf2['where']})[_0xc38d('0x1d')](function(_0x34b56b){_0x33f98a['count']=_0x34b56b;if(_0x259d8c[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x217bf2[_0xc38d('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc38d('0x3e')](_0x217bf2);})[_0xc38d('0x1d')](function(_0x5ef449){_0x33f98a[_0xc38d('0x3f')]=_0x5ef449;return _0x33f98a;});}})[_0xc38d('0x1d')](respondWithFilteredResult(_0x3383eb,_0x217bf2))[_0xc38d('0x40')](handleError(_0x3383eb,null));};exports[_0xc38d('0x55')]=function(_0x42bfe1,_0x39cb58,_0x89e98b){var _0x1fd36d={'raw':!![],'where':{}};var _0x27b793={};var _0xd3b25e={'count':0x0,'rows':[]};return db[_0xc38d('0x3b')][_0xc38d('0x52')]({'where':{'id':_0x42bfe1[_0xc38d('0x42')]['id']}})['then'](handleEntityNotFound(_0x39cb58,null))[_0xc38d('0x1d')](function(_0x3bb254){if(_0x3bb254){_0x27b793['model']=_[_0xc38d('0x2b')](db['JscriptyAnswerReport'][_0xc38d('0x24')]);_0x27b793['query']=_['keys'](_0x42bfe1[_0xc38d('0x2a')]);_0x27b793[_0xc38d('0x2c')]=_[_0xc38d('0x2d')](_0x27b793[_0xc38d('0x28')],_0x27b793[_0xc38d('0x2a')]);_0x1fd36d[_0xc38d('0x2e')]=_[_0xc38d('0x2d')](_0x27b793[_0xc38d('0x28')],qs[_0xc38d('0x2f')](_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x2f')]));_0x1fd36d[_0xc38d('0x2e')]=_0x1fd36d['attributes'][_0xc38d('0x30')]?_0x1fd36d['attributes']:_0x27b793[_0xc38d('0x28')];if(!_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x31')]('nolimit')){_0x1fd36d[_0xc38d('0x1a')]=qs[_0xc38d('0x1a')](_0x42bfe1[_0xc38d('0x2a')]['limit']);_0x1fd36d[_0xc38d('0x18')]=qs[_0xc38d('0x18')](_0x42bfe1['query'][_0xc38d('0x18')]);}_0x1fd36d[_0xc38d('0x33')]=qs[_0xc38d('0x34')](_0x42bfe1[_0xc38d('0x2a')]['sort']);_0x1fd36d[_0xc38d('0x35')]=qs['filters'](_['pick'](_0x42bfe1[_0xc38d('0x2a')],_0x27b793[_0xc38d('0x2c')]));_0x1fd36d[_0xc38d('0x35')][_0xc38d('0x54')]=_0x3bb254['id'];if(_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x37')]){_0x1fd36d[_0xc38d('0x35')]=_[_0xc38d('0x39')](_0x1fd36d[_0xc38d('0x35')],{'$or':_[_0xc38d('0x29')](_0x1fd36d['attributes'],function(_0x1704b7){var _0x22a371={};_0x22a371[_0x1704b7]={'$like':'%'+_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x37')]+'%'};return _0x22a371;})});}_0x1fd36d=_['merge']({},_0x1fd36d,_0x42bfe1[_0xc38d('0x3a')]);return db[_0xc38d('0x56')][_0xc38d('0x1b')]({'where':_0x1fd36d['where']})[_0xc38d('0x1d')](function(_0x493244){_0xd3b25e[_0xc38d('0x1b')]=_0x493244;if(_0x42bfe1[_0xc38d('0x2a')][_0xc38d('0x3c')]){_0x1fd36d['include']=[{'all':!![]}];}return db[_0xc38d('0x56')][_0xc38d('0x3e')](_0x1fd36d);})['then'](function(_0x2f3ae9){_0xd3b25e['rows']=_0x2f3ae9;return _0xd3b25e;});}})[_0xc38d('0x1d')](respondWithFilteredResult(_0x39cb58,_0x1fd36d))[_0xc38d('0x40')](handleError(_0x39cb58,null));};function char(_0x21a7ad){return _0xc38d('0x57')===typeof _0x21a7ad?String[_0xc38d('0x58')]['apply'](null,arguments):_0x21a7ad;}function needsEncapsulation(_0x3bad85){return!!_0x3bad85&&(_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0xd))>=0x0||_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0xa))>=0x0||_0x3bad85[_0xc38d('0x59')]()['indexOf'](char(0x2c))>=0x0||_0x3bad85[_0xc38d('0x59')]()[_0xc38d('0x5a')](char(0x22))>=0x0);}function encapsulate(_0x3f005e){var _0x31d1b1=char(0x22),_0x5da593='\x5c'+char(0x22),_0x4f3ecb=_0x3f005e['toString']()[_0xc38d('0x5b')](new RegExp(_0x31d1b1,'g'),_0x5da593);return _0x31d1b1+_0x4f3ecb+_0x31d1b1;}exports[_0xc38d('0x5c')]=function(_0x3502c3,_0x128752,_0x2221ce){var _0x551139,_0x2166e9;var _0x1a2f7d={'where':{'ProjectId':_0x3502c3['params']['id']}};if(_0x3502c3[_0xc38d('0x2a')][_0xc38d('0x5d')]){_0x1a2f7d[_0xc38d('0x35')][_0xc38d('0x5e')]=JSON['parse'](_0x3502c3[_0xc38d('0x2a')][_0xc38d('0x5d')]);}return db[_0xc38d('0x53')]['findAll'](_0x1a2f7d)[_0xc38d('0x1d')](handleEntityNotFound(_0x128752,null))[_0xc38d('0x1d')](function(_0x5c2c05){if(_0x5c2c05){_0x551139=_0x5c2c05;return db[_0xc38d('0x5f')][_0xc38d('0x3e')]({'where':{'SessionId':{'$in':_[_0xc38d('0x29')](_0x551139,'id')},'ProjectId':_0x3502c3[_0xc38d('0x42')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x128752,null))[_0xc38d('0x1d')](function(_0x51b573){if(_0x51b573){_0x2166e9=_0x51b573;var _0x4261f6={};for(var _0x45cc1e=0x0,_0x2acec8=_0x2166e9[_0xc38d('0x30')];_0x45cc1e<_0x2acec8;_0x45cc1e++){if(!_0x4261f6['hasOwnProperty'](_0x2166e9[_0x45cc1e][_0xc38d('0x60')])){_0x4261f6[_0x2166e9[_0x45cc1e][_0xc38d('0x60')]]=needsEncapsulation(_0x2166e9[_0x45cc1e][_0xc38d('0x61')])?encapsulate(_0x2166e9[_0x45cc1e][_0xc38d('0x61')]):_0x2166e9[_0x45cc1e]['question'];}}var _0x5ac76d=[],_0x958c12={};for(var _0x26f6c4=0x0,_0x3914ba=_0x551139[_0xc38d('0x30')];_0x26f6c4<_0x3914ba;_0x26f6c4++){_0x958c12={'ProjectId':_0x3502c3[_0xc38d('0x42')]['id'],'SessionId':_0x551139[_0x26f6c4]['id'],'StartTime':moment(_0x551139[_0x26f6c4][_0xc38d('0x5e')])[_0xc38d('0x62')](_0xc38d('0x63'))};for(var _0x44e0a1=0x0,_0x48c79d=_0x2166e9[_0xc38d('0x30')];_0x44e0a1<_0x48c79d;_0x44e0a1++){if(_0x2166e9[_0x44e0a1][_0xc38d('0x64')]==_0x551139[_0x26f6c4]['id']&&_0x4261f6[_0xc38d('0x31')](_0x2166e9[_0x44e0a1][_0xc38d('0x60')])){_0x958c12[_0x4261f6[_0x2166e9[_0x44e0a1][_0xc38d('0x60')]]]=_0x2166e9[_0x44e0a1]['answer'];}}for(var _0x575c69 in _0x4261f6){if(!_0x958c12['hasOwnProperty'](_0x4261f6[_0x575c69])){_0x958c12[_0x4261f6[_0x575c69]]=null;}}_0x5ac76d[_0xc38d('0x65')](_0x958c12);}return _0x5ac76d;}})['then'](function(_0x39d3f3){if(!_[_0xc38d('0x66')](_0x39d3f3)){var _0x24b2f3=toCsv(_0x39d3f3);var _0x198e0b=Date[_0xc38d('0x67')]();fs[_0xc38d('0x68')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3502c3[_0xc38d('0x42')]['id'],_0x198e0b),_0x24b2f3);_0x128752[_0xc38d('0x69')](_0xc38d('0x6a'),_0xc38d('0x6b')+util[_0xc38d('0x62')]('Jscripty_Project_%d_Summary_%s.csv',_0x3502c3[_0xc38d('0x42')]['id'],_0x198e0b));_0x128752[_0xc38d('0x69')]('Content-type',_0xc38d('0x6c'));return _0x128752[_0xc38d('0x6d')](util[_0xc38d('0x62')](_0xc38d('0x6e'),_0x3502c3['params']['id'],_0x198e0b));}else{return _0x128752['sendStatus'](0xcc);}})[_0xc38d('0x40')](handleError(_0x128752,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 526e8a1..26ce9d2 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 _0x5ed2=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x1f34d3,_0x3e2bb7){var _0x42313a=function(_0x582bf8){while(--_0x582bf8){_0x1f34d3['push'](_0x1f34d3['shift']());}};_0x42313a(++_0x3e2bb7);}(_0x5ed2,0x114));var _0x25ed=function(_0x7671bc,_0x171145){_0x7671bc=_0x7671bc-0x0;var _0x55229f=_0x5ed2[_0x7671bc];return _0x55229f;};'use strict';var _=require(_0x25ed('0x0'));var util=require('util');var logger=require(_0x25ed('0x1'))(_0x25ed('0x2'));var moment=require('moment');var BPromise=require(_0x25ed('0x3'));var rp=require(_0x25ed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x25ed('0x5'));var config=require(_0x25ed('0x6'));var attributes=require(_0x25ed('0x7'));module[_0x25ed('0x8')]=function(_0x509ca3,_0x3650fd){return _0x509ca3[_0x25ed('0x9')](_0x25ed('0xa'),attributes,{'tableName':_0x25ed('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81bd=['../../config/environment','./jscriptyProject.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x41ecc1,_0x1133a1){var _0x493bf4=function(_0x107212){while(--_0x107212){_0x41ecc1['push'](_0x41ecc1['shift']());}};_0x493bf4(++_0x1133a1);}(_0x81bd,0x7c));var _0xd81b=function(_0x113cf9,_0x358825){_0x113cf9=_0x113cf9-0x0;var _0x5842ad=_0x81bd[_0x113cf9];return _0x5842ad;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var logger=require(_0xd81b('0x2'))(_0xd81b('0x3'));var moment=require(_0xd81b('0x4'));var BPromise=require(_0xd81b('0x5'));var rp=require(_0xd81b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd81b('0x7'));var config=require(_0xd81b('0x8'));var attributes=require(_0xd81b('0x9'));module['exports']=function(_0x42a0aa,_0x34eb73){return _0x42a0aa[_0xd81b('0xa')]('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 b562637..225b3c1 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x5d0792,_0x486759){var _0x2885a6=function(_0x5da30c){while(--_0x5da30c){_0x5d0792['push'](_0x5d0792['shift']());}};_0x2885a6(++_0x486759);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x38413b,_0x2350d7){var _0x28a5d6=function(_0x32e8dd){while(--_0x32e8dd){_0x38413b['push'](_0x38413b['shift']());}};_0x28a5d6(++_0x2350d7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6b90bd6..880fd43 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 _0x98d4=['../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x98d4,0x184));var _0x498d=function(_0x329558,_0x2bb38d){_0x329558=_0x329558-0x0;var _0x13a0b5=_0x98d4[_0x329558];return _0x13a0b5;};'use strict';var multer=require(_0x498d('0x0'));var util=require(_0x498d('0x1'));var path=require(_0x498d('0x2'));var timeout=require(_0x498d('0x3'));var express=require(_0x498d('0x4'));var router=express[_0x498d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x498d('0x6'));var interaction=require(_0x498d('0x7'));var config=require(_0x498d('0x8'));var controller=require(_0x498d('0x9'));router[_0x498d('0xa')]('/',auth[_0x498d('0xb')](),controller[_0x498d('0xc')]);router[_0x498d('0xa')]('/describe',auth[_0x498d('0xb')](),controller[_0x498d('0xd')]);router[_0x498d('0xa')](_0x498d('0xe'),auth['isAuthenticated'](),controller[_0x498d('0xf')]);router[_0x498d('0x10')]('/',auth[_0x498d('0xb')](),controller[_0x498d('0x11')]);router[_0x498d('0x12')](_0x498d('0xe'),auth[_0x498d('0xb')](),controller['update']);router[_0x498d('0x13')](_0x498d('0xe'),auth[_0x498d('0xb')](),controller[_0x498d('0x14')]);module[_0x498d('0x15')]=router; \ No newline at end of file +var _0x6724=['put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','/:id','show','post','create'];(function(_0x246409,_0x153229){var _0x42c327=function(_0x1444b5){while(--_0x1444b5){_0x246409['push'](_0x246409['shift']());}};_0x42c327(++_0x153229);}(_0x6724,0x146));var _0x4672=function(_0x167936,_0x2bfe83){_0x167936=_0x167936-0x0;var _0x570166=_0x6724[_0x167936];return _0x570166;};'use strict';var multer=require(_0x4672('0x0'));var util=require(_0x4672('0x1'));var path=require(_0x4672('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4672('0x3')]();var fs_extra=require(_0x4672('0x4'));var auth=require(_0x4672('0x5'));var interaction=require(_0x4672('0x6'));var config=require('../../config/environment');var controller=require(_0x4672('0x7'));router[_0x4672('0x8')]('/',auth['isAuthenticated'](),controller[_0x4672('0x9')]);router[_0x4672('0x8')]('/describe',auth[_0x4672('0xa')](),controller[_0x4672('0xb')]);router['get'](_0x4672('0xc'),auth[_0x4672('0xa')](),controller[_0x4672('0xd')]);router[_0x4672('0xe')]('/',auth[_0x4672('0xa')](),controller[_0x4672('0xf')]);router[_0x4672('0x10')](_0x4672('0xc'),auth[_0x4672('0xa')](),controller['update']);router['delete']('/:id',auth[_0x4672('0xa')](),controller[_0x4672('0x11')]);module[_0x4672('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index ce504a9..fc55b54 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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x304440,_0x3cefa8){_0x304440=_0x304440-0x0;var _0x4adc57=_0x7a54[_0x304440];return _0x4adc57;};'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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x34ab0d,_0x75913){_0x34ab0d=_0x34ab0d-0x0;var _0x1cf143=_0x7a54[_0x34ab0d];return _0x1cf143;};'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 0283926..864d0e6 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 _0xd5a6=['filter','merge','VIRTUAL','options','findAll','rows','catch','params','rawAttributes','fields','length','include','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','JscriptyQuestionReport','type','key','keys','filters','intersection','model','query','attributes','hasOwnProperty','order','sort','where','pick'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xd5a6,0x16e));var _0x6d5a=function(_0x288980,_0x2d9b31){_0x288980=_0x288980-0x0;var _0x42687a=_0xd5a6[_0x288980];return _0x42687a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6d5a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d5a('0x1'));var rp=require(_0x6d5a('0x2'));var moment=require(_0x6d5a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6d5a('0x4'));var util=require(_0x6d5a('0x5'));var path=require(_0x6d5a('0x6'));var sox=require(_0x6d5a('0x7'));var csv=require(_0x6d5a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d5a('0x9'));var _=require(_0x6d5a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d5a('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d5a('0xc'));var Papa=require('papaparse');var Redis=require(_0x6d5a('0xd'));var authService=require(_0x6d5a('0xe'));var qs=require(_0x6d5a('0xf'));var as=require(_0x6d5a('0x10'));var hardwareService=require(_0x6d5a('0x11'));var logger=require('../../config/logger')(_0x6d5a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6d5a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x447a89,_0x52283a){_0x52283a=_0x52283a||0xcc;return function(_0x25fe4b){if(_0x25fe4b){return _0x447a89[_0x6d5a('0x14')](_0x52283a);}return _0x447a89[_0x6d5a('0x15')](_0x52283a)[_0x6d5a('0x16')]();};}function respondWithResult(_0x37d723,_0x26a988){_0x26a988=_0x26a988||0xc8;return function(_0x15e912){if(_0x15e912){return _0x37d723[_0x6d5a('0x15')](_0x26a988)[_0x6d5a('0x17')](_0x15e912);}};}function respondWithFilteredResult(_0x51d633,_0x27101b){return function(_0x30dc13){if(_0x30dc13){var _0x1a97b7=typeof _0x27101b[_0x6d5a('0x18')]===_0x6d5a('0x19')&&typeof _0x27101b[_0x6d5a('0x1a')]==='undefined';var _0x3ba422=_0x30dc13[_0x6d5a('0x1b')];var _0x5881e3=_0x1a97b7?0x0:_0x27101b[_0x6d5a('0x18')];var _0x162d4c=_0x1a97b7?_0x30dc13[_0x6d5a('0x1b')]:_0x27101b[_0x6d5a('0x18')]+_0x27101b['limit'];var _0x39f938;if(_0x162d4c>=_0x3ba422){_0x162d4c=_0x3ba422;_0x39f938=0xc8;}else{_0x39f938=0xce;}_0x51d633[_0x6d5a('0x15')](_0x39f938);return _0x51d633[_0x6d5a('0x1c')](_0x6d5a('0x1d'),_0x5881e3+'-'+_0x162d4c+'/'+_0x3ba422)['json'](_0x30dc13);}return null;};}function patchUpdates(_0x20daf5){return function(_0x5d5e1d){try{jsonpatch['apply'](_0x5d5e1d,_0x20daf5,!![]);}catch(_0x4d7992){return BPromise[_0x6d5a('0x1e')](_0x4d7992);}return _0x5d5e1d[_0x6d5a('0x1f')]();};}function saveUpdates(_0x3c18f1,_0x206b80){return function(_0x1d43e3){if(_0x1d43e3){return _0x1d43e3[_0x6d5a('0x20')](_0x3c18f1)['then'](function(_0x778577){return _0x778577;});}return null;};}function removeEntity(_0x1e1812,_0x2798e1){return function(_0x4f1457){if(_0x4f1457){return _0x4f1457[_0x6d5a('0x21')]()[_0x6d5a('0x22')](function(){_0x1e1812[_0x6d5a('0x15')](0xcc)[_0x6d5a('0x16')]();});}};}function handleEntityNotFound(_0xee16ae,_0x5f3be0){return function(_0x4a3d40){if(!_0x4a3d40){_0xee16ae[_0x6d5a('0x14')](0x194);}return _0x4a3d40;};}function handleError(_0xbcc413,_0x4511a4){_0x4511a4=_0x4511a4||0x1f4;return function(_0x37dd74){logger[_0x6d5a('0x23')](_0x37dd74['stack']);if(_0x37dd74[_0x6d5a('0x24')]){delete _0x37dd74[_0x6d5a('0x24')];}_0xbcc413[_0x6d5a('0x15')](_0x4511a4)[_0x6d5a('0x25')](_0x37dd74);};}exports[_0x6d5a('0x26')]=function(_0xa23ace,_0xc2ee5b){var _0x399ca7={},_0x3c9cb5={},_0x4a87c8={'count':0x0,'rows':[]};var _0x3e6ee8=_[_0x6d5a('0x27')](db[_0x6d5a('0x28')]['rawAttributes'],function(_0x10bd77){return{'name':_0x10bd77['fieldName'],'type':_0x10bd77[_0x6d5a('0x29')][_0x6d5a('0x2a')]};});_0x3c9cb5['model']=_[_0x6d5a('0x27')](_0x3e6ee8,_0x6d5a('0x24'));_0x3c9cb5['query']=_[_0x6d5a('0x2b')](_0xa23ace['query']);_0x3c9cb5[_0x6d5a('0x2c')]=_[_0x6d5a('0x2d')](_0x3c9cb5[_0x6d5a('0x2e')],_0x3c9cb5[_0x6d5a('0x2f')]);_0x399ca7[_0x6d5a('0x30')]=_[_0x6d5a('0x2d')](_0x3c9cb5['model'],qs['fields'](_0xa23ace['query']['fields']));_0x399ca7['attributes']=_0x399ca7[_0x6d5a('0x30')]['length']?_0x399ca7[_0x6d5a('0x30')]:_0x3c9cb5[_0x6d5a('0x2e')];if(!_0xa23ace[_0x6d5a('0x2f')][_0x6d5a('0x31')]('nolimit')){_0x399ca7[_0x6d5a('0x1a')]=qs[_0x6d5a('0x1a')](_0xa23ace['query'][_0x6d5a('0x1a')]);_0x399ca7['offset']=qs[_0x6d5a('0x18')](_0xa23ace[_0x6d5a('0x2f')][_0x6d5a('0x18')]);}_0x399ca7[_0x6d5a('0x32')]=qs[_0x6d5a('0x33')](_0xa23ace[_0x6d5a('0x2f')][_0x6d5a('0x33')]);_0x399ca7[_0x6d5a('0x34')]=qs['filters'](_[_0x6d5a('0x35')](_0xa23ace['query'],_0x3c9cb5[_0x6d5a('0x2c')]),_0x3e6ee8);if(_0xa23ace['query'][_0x6d5a('0x36')]){_0x399ca7[_0x6d5a('0x34')]=_[_0x6d5a('0x37')](_0x399ca7[_0x6d5a('0x34')],{'$or':_[_0x6d5a('0x27')](_0x3e6ee8,function(_0x1a6e87){if(_0x1a6e87[_0x6d5a('0x29')]!==_0x6d5a('0x38')){var _0x2f21aa={};_0x2f21aa[_0x1a6e87[_0x6d5a('0x24')]]={'$like':'%'+_0xa23ace[_0x6d5a('0x2f')][_0x6d5a('0x36')]+'%'};return _0x2f21aa;}})});}_0x399ca7=_[_0x6d5a('0x37')]({},_0x399ca7,_0xa23ace[_0x6d5a('0x39')]);var _0x2d13d7={'where':_0x399ca7[_0x6d5a('0x34')]};return db[_0x6d5a('0x28')]['count'](_0x2d13d7)[_0x6d5a('0x22')](function(_0x2e0c05){_0x4a87c8[_0x6d5a('0x1b')]=_0x2e0c05;if(_0xa23ace[_0x6d5a('0x2f')]['includeAll']){_0x399ca7['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6d5a('0x3a')](_0x399ca7);})['then'](function(_0x46330a){_0x4a87c8[_0x6d5a('0x3b')]=_0x46330a;return _0x4a87c8;})['then'](respondWithFilteredResult(_0xc2ee5b,_0x399ca7))[_0x6d5a('0x3c')](handleError(_0xc2ee5b,null));};exports['show']=function(_0x212aa4,_0x3b9ae5){var _0x40efa1={'raw':!![],'where':{'id':_0x212aa4[_0x6d5a('0x3d')]['id']}},_0x14c0b8={};_0x14c0b8[_0x6d5a('0x2e')]=_['keys'](db[_0x6d5a('0x28')][_0x6d5a('0x3e')]);_0x14c0b8[_0x6d5a('0x2f')]=_[_0x6d5a('0x2b')](_0x212aa4[_0x6d5a('0x2f')]);_0x14c0b8[_0x6d5a('0x2c')]=_['intersection'](_0x14c0b8['model'],_0x14c0b8[_0x6d5a('0x2f')]);_0x40efa1[_0x6d5a('0x30')]=_[_0x6d5a('0x2d')](_0x14c0b8[_0x6d5a('0x2e')],qs[_0x6d5a('0x3f')](_0x212aa4[_0x6d5a('0x2f')][_0x6d5a('0x3f')]));_0x40efa1[_0x6d5a('0x30')]=_0x40efa1[_0x6d5a('0x30')][_0x6d5a('0x40')]?_0x40efa1[_0x6d5a('0x30')]:_0x14c0b8[_0x6d5a('0x2e')];if(_0x212aa4[_0x6d5a('0x2f')]['includeAll']){_0x40efa1[_0x6d5a('0x41')]=[{'all':!![]}];}_0x40efa1=_[_0x6d5a('0x37')]({},_0x40efa1,_0x212aa4[_0x6d5a('0x39')]);return db[_0x6d5a('0x28')][_0x6d5a('0x42')](_0x40efa1)[_0x6d5a('0x22')](handleEntityNotFound(_0x3b9ae5,null))[_0x6d5a('0x22')](respondWithResult(_0x3b9ae5,null))[_0x6d5a('0x3c')](handleError(_0x3b9ae5,null));};exports[_0x6d5a('0x43')]=function(_0x1cfbbf,_0x2f1a81){return db[_0x6d5a('0x28')]['create'](_0x1cfbbf[_0x6d5a('0x44')],{})[_0x6d5a('0x22')](respondWithResult(_0x2f1a81,0xc9))['catch'](handleError(_0x2f1a81,null));};exports[_0x6d5a('0x20')]=function(_0x4c07d0,_0x3eb9b8){if(_0x4c07d0[_0x6d5a('0x44')]['id']){delete _0x4c07d0[_0x6d5a('0x44')]['id'];}return db[_0x6d5a('0x28')][_0x6d5a('0x42')]({'where':{'id':_0x4c07d0[_0x6d5a('0x3d')]['id']}})[_0x6d5a('0x22')](handleEntityNotFound(_0x3eb9b8,null))[_0x6d5a('0x22')](saveUpdates(_0x4c07d0['body'],null))['then'](respondWithResult(_0x3eb9b8,null))[_0x6d5a('0x3c')](handleError(_0x3eb9b8,null));};exports[_0x6d5a('0x21')]=function(_0x472639,_0x315df9){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x472639[_0x6d5a('0x3d')]['id']}})[_0x6d5a('0x22')](handleEntityNotFound(_0x315df9,null))[_0x6d5a('0x22')](removeEntity(_0x315df9,null))[_0x6d5a('0x3c')](handleError(_0x315df9,null));};exports[_0x6d5a('0x45')]=function(_0x561c53,_0x4ac18b){return db[_0x6d5a('0x28')]['describe']()[_0x6d5a('0x22')](respondWithResult(_0x4ac18b,null))[_0x6d5a('0x3c')](handleError(_0x4ac18b,null));}; \ No newline at end of file +var _0x2156=['name','send','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x2156,0x113));var _0x6215=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2156[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x6215('0x0'));var rimraf=require(_0x6215('0x1'));var zipdir=require(_0x6215('0x2'));var jsonpatch=require(_0x6215('0x3'));var rp=require(_0x6215('0x4'));var moment=require(_0x6215('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6215('0x6'));var util=require(_0x6215('0x7'));var path=require(_0x6215('0x8'));var sox=require(_0x6215('0x9'));var csv=require(_0x6215('0xa'));var ejs=require(_0x6215('0xb'));var fs=require('fs');var fs_extra=require(_0x6215('0xc'));var _=require(_0x6215('0xd'));var squel=require(_0x6215('0xe'));var crypto=require(_0x6215('0xf'));var jsforce=require(_0x6215('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6215('0x11'));var Papa=require(_0x6215('0x12'));var Redis=require('ioredis');var authService=require(_0x6215('0x13'));var qs=require(_0x6215('0x14'));var as=require(_0x6215('0x15'));var hardwareService=require(_0x6215('0x16'));var logger=require('../../config/logger')(_0x6215('0x17'));var utils=require(_0x6215('0x18'));var config=require(_0x6215('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6215('0x1a'))['db'];function respondWithStatusCode(_0x3b1171,_0x42a188){_0x42a188=_0x42a188||0xcc;return function(_0x9255c2){if(_0x9255c2){return _0x3b1171[_0x6215('0x1b')](_0x42a188);}return _0x3b1171['status'](_0x42a188)['end']();};}function respondWithResult(_0x6a05f7,_0x52d325){_0x52d325=_0x52d325||0xc8;return function(_0x261b10){if(_0x261b10){return _0x6a05f7[_0x6215('0x1c')](_0x52d325)[_0x6215('0x1d')](_0x261b10);}};}function respondWithFilteredResult(_0x3428a9,_0x37bab7){return function(_0x5d0f79){if(_0x5d0f79){var _0x5030cf=typeof _0x37bab7['offset']===_0x6215('0x1e')&&typeof _0x37bab7['limit']===_0x6215('0x1e');var _0x4234d0=_0x5d0f79[_0x6215('0x1f')];var _0x184139=_0x5030cf?0x0:_0x37bab7[_0x6215('0x20')];var _0x3fc66f=_0x5030cf?_0x5d0f79[_0x6215('0x1f')]:_0x37bab7[_0x6215('0x20')]+_0x37bab7['limit'];var _0x111e5b;if(_0x3fc66f>=_0x4234d0){_0x3fc66f=_0x4234d0;_0x111e5b=0xc8;}else{_0x111e5b=0xce;}_0x3428a9['status'](_0x111e5b);return _0x3428a9['set'](_0x6215('0x21'),_0x184139+'-'+_0x3fc66f+'/'+_0x4234d0)['json'](_0x5d0f79);}return null;};}function patchUpdates(_0x6375fd){return function(_0x38131a){try{jsonpatch[_0x6215('0x22')](_0x38131a,_0x6375fd,!![]);}catch(_0x5aee87){return BPromise[_0x6215('0x23')](_0x5aee87);}return _0x38131a[_0x6215('0x24')]();};}function saveUpdates(_0x38be26,_0x1a3092){return function(_0x1b467b){if(_0x1b467b){return _0x1b467b['update'](_0x38be26)[_0x6215('0x25')](function(_0x5719af){return _0x5719af;});}return null;};}function removeEntity(_0x4294fd,_0x2178a3){return function(_0x3945d9){if(_0x3945d9){return _0x3945d9[_0x6215('0x26')]()[_0x6215('0x25')](function(){_0x4294fd[_0x6215('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x268b54,_0x21d154){return function(_0x3e6751){if(!_0x3e6751){_0x268b54[_0x6215('0x1b')](0x194);}return _0x3e6751;};}function handleError(_0x5d42a3,_0x58d0f6){_0x58d0f6=_0x58d0f6||0x1f4;return function(_0x306198){logger[_0x6215('0x27')](_0x306198[_0x6215('0x28')]);if(_0x306198['name']){delete _0x306198[_0x6215('0x29')];}_0x5d42a3[_0x6215('0x1c')](_0x58d0f6)[_0x6215('0x2a')](_0x306198);};}exports['index']=function(_0x3d72b8,_0x20bedf){var _0x1893ca={},_0xadbd99={},_0x5319a3={'count':0x0,'rows':[]};var _0x8c83bf=_['map'](db[_0x6215('0x2b')][_0x6215('0x2c')],function(_0x14c421){return{'name':_0x14c421[_0x6215('0x2d')],'type':_0x14c421[_0x6215('0x2e')][_0x6215('0x2f')]};});_0xadbd99[_0x6215('0x30')]=_[_0x6215('0x31')](_0x8c83bf,_0x6215('0x29'));_0xadbd99[_0x6215('0x32')]=_[_0x6215('0x33')](_0x3d72b8[_0x6215('0x32')]);_0xadbd99[_0x6215('0x34')]=_['intersection'](_0xadbd99[_0x6215('0x30')],_0xadbd99[_0x6215('0x32')]);_0x1893ca[_0x6215('0x35')]=_['intersection'](_0xadbd99[_0x6215('0x30')],qs[_0x6215('0x36')](_0x3d72b8['query'][_0x6215('0x36')]));_0x1893ca[_0x6215('0x35')]=_0x1893ca['attributes']['length']?_0x1893ca[_0x6215('0x35')]:_0xadbd99[_0x6215('0x30')];if(!_0x3d72b8['query'][_0x6215('0x37')](_0x6215('0x38'))){_0x1893ca['limit']=qs[_0x6215('0x39')](_0x3d72b8[_0x6215('0x32')]['limit']);_0x1893ca[_0x6215('0x20')]=qs[_0x6215('0x20')](_0x3d72b8[_0x6215('0x32')][_0x6215('0x20')]);}_0x1893ca[_0x6215('0x3a')]=qs[_0x6215('0x3b')](_0x3d72b8['query'][_0x6215('0x3b')]);_0x1893ca[_0x6215('0x3c')]=qs['filters'](_[_0x6215('0x3d')](_0x3d72b8[_0x6215('0x32')],_0xadbd99[_0x6215('0x34')]),_0x8c83bf);if(_0x3d72b8[_0x6215('0x32')][_0x6215('0x3e')]){_0x1893ca[_0x6215('0x3c')]=_[_0x6215('0x3f')](_0x1893ca[_0x6215('0x3c')],{'$or':_[_0x6215('0x31')](_0x8c83bf,function(_0x8b5ad1){if(_0x8b5ad1[_0x6215('0x2e')]!==_0x6215('0x40')){var _0x39edca={};_0x39edca[_0x8b5ad1['name']]={'$like':'%'+_0x3d72b8[_0x6215('0x32')][_0x6215('0x3e')]+'%'};return _0x39edca;}})});}_0x1893ca=_[_0x6215('0x3f')]({},_0x1893ca,_0x3d72b8['options']);var _0x271a2d={'where':_0x1893ca['where']};return db[_0x6215('0x2b')][_0x6215('0x1f')](_0x271a2d)['then'](function(_0x479ad7){_0x5319a3['count']=_0x479ad7;if(_0x3d72b8[_0x6215('0x32')][_0x6215('0x41')]){_0x1893ca[_0x6215('0x42')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6215('0x43')](_0x1893ca);})[_0x6215('0x25')](function(_0x488c6e){_0x5319a3[_0x6215('0x44')]=_0x488c6e;return _0x5319a3;})[_0x6215('0x25')](respondWithFilteredResult(_0x20bedf,_0x1893ca))[_0x6215('0x45')](handleError(_0x20bedf,null));};exports[_0x6215('0x46')]=function(_0x2a2b43,_0x4004d2){var _0x2f663d={'raw':!![],'where':{'id':_0x2a2b43[_0x6215('0x47')]['id']}},_0x4d950b={};_0x4d950b[_0x6215('0x30')]=_[_0x6215('0x33')](db['JscriptyQuestionReport'][_0x6215('0x2c')]);_0x4d950b[_0x6215('0x32')]=_[_0x6215('0x33')](_0x2a2b43[_0x6215('0x32')]);_0x4d950b[_0x6215('0x34')]=_['intersection'](_0x4d950b[_0x6215('0x30')],_0x4d950b[_0x6215('0x32')]);_0x2f663d[_0x6215('0x35')]=_[_0x6215('0x48')](_0x4d950b[_0x6215('0x30')],qs['fields'](_0x2a2b43[_0x6215('0x32')]['fields']));_0x2f663d[_0x6215('0x35')]=_0x2f663d[_0x6215('0x35')]['length']?_0x2f663d['attributes']:_0x4d950b[_0x6215('0x30')];if(_0x2a2b43[_0x6215('0x32')]['includeAll']){_0x2f663d['include']=[{'all':!![]}];}_0x2f663d=_[_0x6215('0x3f')]({},_0x2f663d,_0x2a2b43[_0x6215('0x49')]);return db[_0x6215('0x2b')][_0x6215('0x4a')](_0x2f663d)[_0x6215('0x25')](handleEntityNotFound(_0x4004d2,null))['then'](respondWithResult(_0x4004d2,null))[_0x6215('0x45')](handleError(_0x4004d2,null));};exports[_0x6215('0x4b')]=function(_0x3de71e,_0x51fbfd){return db['JscriptyQuestionReport']['create'](_0x3de71e['body'],{})['then'](respondWithResult(_0x51fbfd,0xc9))[_0x6215('0x45')](handleError(_0x51fbfd,null));};exports[_0x6215('0x4c')]=function(_0x3b0c39,_0x67d5d2){if(_0x3b0c39[_0x6215('0x4d')]['id']){delete _0x3b0c39['body']['id'];}return db[_0x6215('0x2b')]['find']({'where':{'id':_0x3b0c39[_0x6215('0x47')]['id']}})[_0x6215('0x25')](handleEntityNotFound(_0x67d5d2,null))[_0x6215('0x25')](saveUpdates(_0x3b0c39[_0x6215('0x4d')],null))['then'](respondWithResult(_0x67d5d2,null))[_0x6215('0x45')](handleError(_0x67d5d2,null));};exports[_0x6215('0x26')]=function(_0x17bffa,_0x364c78){return db[_0x6215('0x2b')][_0x6215('0x4a')]({'where':{'id':_0x17bffa[_0x6215('0x47')]['id']}})[_0x6215('0x25')](handleEntityNotFound(_0x364c78,null))[_0x6215('0x25')](removeEntity(_0x364c78,null))['catch'](handleError(_0x364c78,null));};exports[_0x6215('0x4e')]=function(_0x1324f8,_0x188f7a){return db[_0x6215('0x2b')]['describe']()[_0x6215('0x25')](respondWithResult(_0x188f7a,null))[_0x6215('0x45')](handleError(_0x188f7a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0b2925e..a280cf5 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 _0x90b3=['api','moment','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','define','report_jscripty_questions','util','../../config/logger'];(function(_0x7bc6d,_0x52b823){var _0x1901f0=function(_0xa21e5a){while(--_0xa21e5a){_0x7bc6d['push'](_0x7bc6d['shift']());}};_0x1901f0(++_0x52b823);}(_0x90b3,0x116));var _0x390b=function(_0x24e8db,_0x89fc47){_0x24e8db=_0x24e8db-0x0;var _0x576cc1=_0x90b3[_0x24e8db];return _0x576cc1;};'use strict';var _=require('lodash');var util=require(_0x390b('0x0'));var logger=require(_0x390b('0x1'))(_0x390b('0x2'));var moment=require(_0x390b('0x3'));var BPromise=require('bluebird');var rp=require(_0x390b('0x4'));var fs=require('fs');var path=require(_0x390b('0x5'));var rimraf=require('rimraf');var config=require(_0x390b('0x6'));var attributes=require(_0x390b('0x7'));module['exports']=function(_0x424cf5,_0x552526){return _0x424cf5[_0x390b('0x8')]('JscriptyQuestionReport',attributes,{'tableName':_0x390b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5909=['report_jscripty_questions','util','../../config/logger','api','moment','request-promise','rimraf','exports','define','JscriptyQuestionReport'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5909,0x187));var _0x9590=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x5909[_0x1ae31c];return _0x19519d;};'use strict';var _=require('lodash');var util=require(_0x9590('0x0'));var logger=require(_0x9590('0x1'))(_0x9590('0x2'));var moment=require(_0x9590('0x3'));var BPromise=require('bluebird');var rp=require(_0x9590('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9590('0x5'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x9590('0x6')]=function(_0x5c9bef,_0x500a75){return _0x5c9bef[_0x9590('0x7')](_0x9590('0x8'),attributes,{'tableName':_0x9590('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 34d3887..c03a23f 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 _0x690d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','bluebird'];(function(_0x25c288,_0x9b33dc){var _0xc1b9a1=function(_0x2e2422){while(--_0x2e2422){_0x25c288['push'](_0x25c288['shift']());}};_0xc1b9a1(++_0x9b33dc);}(_0x690d,0x163));var _0xd690=function(_0x2ae8e4,_0x3d1394){_0x2ae8e4=_0x2ae8e4-0x0;var _0x6cc1ec=_0x690d[_0x2ae8e4];return _0x6cc1ec;};'use strict';var _=require(_0xd690('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd690('0x1'));var rs=require(_0xd690('0x2'));var fs=require('fs');var Redis=require(_0xd690('0x3'));var db=require(_0xd690('0x4'))['db'];var utils=require(_0xd690('0x5'));var logger=require(_0xd690('0x6'))(_0xd690('0x7'));var config=require('../../config/environment');var jayson=require(_0xd690('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x387cd4,_0x3a2650,_0x56a95a){return new BPromise(function(_0x21601d,_0x4d1b7c){return client[_0xd690('0x9')](_0x387cd4,_0x56a95a)['then'](function(_0x168f9d){logger[_0xd690('0xa')](_0xd690('0xb'),_0x3a2650,'request\x20sent');logger[_0xd690('0xc')](_0xd690('0xd'),_0x3a2650,'request\x20sent',JSON[_0xd690('0xe')](_0x168f9d));if(_0x168f9d[_0xd690('0xf')]){if(_0x168f9d['error'][_0xd690('0x10')]===0x1f4){logger[_0xd690('0xf')](_0xd690('0xb'),_0x3a2650,_0x168f9d[_0xd690('0xf')][_0xd690('0x11')]);return _0x4d1b7c(_0x168f9d[_0xd690('0xf')]['message']);}logger[_0xd690('0xf')](_0xd690('0xb'),_0x3a2650,_0x168f9d[_0xd690('0xf')]['message']);return _0x21601d(_0x168f9d['error']['message']);}else{logger[_0xd690('0xa')](_0xd690('0xb'),_0x3a2650,_0xd690('0x12'));_0x21601d(_0x168f9d[_0xd690('0x13')][_0xd690('0x11')]);}})[_0xd690('0x14')](function(_0x89af7f){logger[_0xd690('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3a2650,_0x89af7f);_0x4d1b7c(_0x89af7f);});});} \ No newline at end of file +var _0x77a7=['error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1c9290,_0x49a6a9){var _0x3786ec=function(_0x538078){while(--_0x538078){_0x1c9290['push'](_0x1c9290['shift']());}};_0x3786ec(++_0x49a6a9);}(_0x77a7,0x1be));var _0x777a=function(_0x1c6a35,_0x59450c){_0x1c6a35=_0x1c6a35-0x0;var _0x5f7f24=_0x77a7[_0x1c6a35];return _0x5f7f24;};'use strict';var _=require(_0x777a('0x0'));var util=require('util');var moment=require(_0x777a('0x1'));var BPromise=require('bluebird');var rs=require(_0x777a('0x2'));var fs=require('fs');var Redis=require(_0x777a('0x3'));var db=require(_0x777a('0x4'))['db'];var utils=require(_0x777a('0x5'));var logger=require(_0x777a('0x6'))(_0x777a('0x7'));var config=require('../../config/environment');var jayson=require(_0x777a('0x8'));var client=jayson[_0x777a('0x9')][_0x777a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c33a5,_0x5db662,_0x5da024){return new BPromise(function(_0x3a36f0,_0x344ca4){return client[_0x777a('0xb')](_0x4c33a5,_0x5da024)[_0x777a('0xc')](function(_0x3ff324){logger['info'](_0x777a('0xd'),_0x5db662,'request\x20sent');logger['debug'](_0x777a('0xe'),_0x5db662,_0x777a('0xf'),JSON['stringify'](_0x3ff324));if(_0x3ff324[_0x777a('0x10')]){if(_0x3ff324[_0x777a('0x10')][_0x777a('0x11')]===0x1f4){logger['error'](_0x777a('0xd'),_0x5db662,_0x3ff324[_0x777a('0x10')][_0x777a('0x12')]);return _0x344ca4(_0x3ff324['error'][_0x777a('0x12')]);}logger[_0x777a('0x10')](_0x777a('0xd'),_0x5db662,_0x3ff324[_0x777a('0x10')][_0x777a('0x12')]);return _0x3a36f0(_0x3ff324[_0x777a('0x10')][_0x777a('0x12')]);}else{logger[_0x777a('0x13')](_0x777a('0xd'),_0x5db662,_0x777a('0xf'));_0x3a36f0(_0x3ff324[_0x777a('0x14')][_0x777a('0x12')]);}})[_0x777a('0x15')](function(_0xaa48ec){logger[_0x777a('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5db662,_0xaa48ec);_0x344ca4(_0xaa48ec);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index f2103f1..ae14987 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 _0xa51b=['fs-extra','../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe','/:id','/:id/questions','getQuestions','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xa51b,0x1b1));var _0xba51=function(_0xcf723e,_0x1ad7af){_0xcf723e=_0xcf723e-0x0;var _0x4ff83b=_0xa51b[_0xcf723e];return _0x4ff83b;};'use strict';var multer=require('multer');var util=require(_0xba51('0x0'));var path=require(_0xba51('0x1'));var timeout=require(_0xba51('0x2'));var express=require(_0xba51('0x3'));var router=express['Router']();var fs_extra=require(_0xba51('0x4'));var auth=require(_0xba51('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba51('0x6'));var controller=require('./jscriptySessionReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xba51('0x7')]);router[_0xba51('0x8')]('/describe',auth[_0xba51('0x9')](),controller[_0xba51('0xa')]);router['get'](_0xba51('0xb'),auth[_0xba51('0x9')](),controller['show']);router[_0xba51('0x8')](_0xba51('0xc'),auth[_0xba51('0x9')](),controller[_0xba51('0xd')]);router['post']('/',auth[_0xba51('0x9')](),controller['create']);router[_0xba51('0xe')](_0xba51('0xb'),auth[_0xba51('0x9')](),controller[_0xba51('0xf')]);router[_0xba51('0x10')](_0xba51('0xb'),auth[_0xba51('0x9')](),controller[_0xba51('0x11')]);module[_0xba51('0x12')]=router; \ No newline at end of file +var _0x70ed=['get','/:id','getQuestions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated'];(function(_0x14bca8,_0x3fcf78){var _0x216370=function(_0x513e18){while(--_0x513e18){_0x14bca8['push'](_0x14bca8['shift']());}};_0x216370(++_0x3fcf78);}(_0x70ed,0x136));var _0xd70e=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0x70ed[_0x7cb10c];return _0x11df59;};'use strict';var multer=require('multer');var util=require(_0xd70e('0x0'));var path=require(_0xd70e('0x1'));var timeout=require(_0xd70e('0x2'));var express=require('express');var router=express[_0xd70e('0x3')]();var fs_extra=require(_0xd70e('0x4'));var auth=require(_0xd70e('0x5'));var interaction=require(_0xd70e('0x6'));var config=require(_0xd70e('0x7'));var controller=require(_0xd70e('0x8'));router['get']('/',auth[_0xd70e('0x9')](),controller['index']);router[_0xd70e('0xa')]('/describe',auth[_0xd70e('0x9')](),controller['describe']);router[_0xd70e('0xa')](_0xd70e('0xb'),auth[_0xd70e('0x9')](),controller['show']);router['get']('/:id/questions',auth[_0xd70e('0x9')](),controller[_0xd70e('0xc')]);router[_0xd70e('0xd')]('/',auth[_0xd70e('0x9')](),controller[_0xd70e('0xe')]);router[_0xd70e('0xf')](_0xd70e('0xb'),auth['isAuthenticated'](),controller[_0xd70e('0x10')]);router[_0xd70e('0x11')](_0xd70e('0xb'),auth[_0xd70e('0x9')](),controller[_0xd70e('0x12')]);module[_0xd70e('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 09f5d28..775b240 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 _0xda17=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue'];(function(_0x33ff14,_0x4cc038){var _0xa5efe1=function(_0x221476){while(--_0x221476){_0x33ff14['push'](_0x33ff14['shift']());}};_0xa5efe1(++_0x4cc038);}(_0xda17,0x1ef));var _0x7da1=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xda17[_0x5608a3];return _0x1ed50a;};'use strict';var moment=require(_0x7da1('0x0'));var Sequelize=require(_0x7da1('0x1'));module[_0x7da1('0x2')]={'starttime':{'type':Sequelize[_0x7da1('0x3')],'set':function(_0x2225de){this[_0x7da1('0x4')](_0x7da1('0x5'),_0x2225de);this['setDataValue'](_0x7da1('0x6'),moment()[_0x7da1('0x7')](_0x7da1('0x8')));}},'endtime':{'type':Sequelize[_0x7da1('0x3')]},'membername':{'type':Sequelize[_0x7da1('0x9')]},'projectname':{'type':Sequelize[_0x7da1('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7da1('0x9')]},'calleridname':{'type':Sequelize[_0x7da1('0x9')]},'calleridnum':{'type':Sequelize[_0x7da1('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1fd4=['endtime','DATE','STRING','moment','setDataValue'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x1fd4,0x10c));var _0x41fd=function(_0x1e699f,_0x3174f2){_0x1e699f=_0x1e699f-0x0;var _0x2719d6=_0x1fd4[_0x1e699f];return _0x2719d6;};'use strict';var moment=require(_0x41fd('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x4f779f){this['setDataValue']('starttime',_0x4f779f);this[_0x41fd('0x1')](_0x41fd('0x2'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x41fd('0x3')]},'membername':{'type':Sequelize[_0x41fd('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x41fd('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x41fd('0x4')]},'calleridnum':{'type':Sequelize[_0x41fd('0x4')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 63cfe3d..a941597 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 _0x8a8b=['nolimit','merge','JscriptyQuestionReport','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../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','save','update','stack','name','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','options','then','includeAll','include','catch','show','params','find','create','body','describe','getQuestions','findOne','hasOwnProperty'];(function(_0x1fb6e2,_0x3a22ce){var _0x354690=function(_0x51f968){while(--_0x51f968){_0x1fb6e2['push'](_0x1fb6e2['shift']());}};_0x354690(++_0x3a22ce);}(_0x8a8b,0xe6));var _0xb8a8=function(_0x2eab0c,_0x49353e){_0x2eab0c=_0x2eab0c-0x0;var _0x1262ff=_0x8a8b[_0x2eab0c];return _0x1262ff;};'use strict';var emlformat=require(_0xb8a8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8a8('0x1'));var jsonpatch=require(_0xb8a8('0x2'));var rp=require(_0xb8a8('0x3'));var moment=require('moment');var BPromise=require(_0xb8a8('0x4'));var Mustache=require(_0xb8a8('0x5'));var util=require(_0xb8a8('0x6'));var path=require(_0xb8a8('0x7'));var sox=require('sox');var csv=require(_0xb8a8('0x8'));var ejs=require(_0xb8a8('0x9'));var fs=require('fs');var fs_extra=require(_0xb8a8('0xa'));var _=require('lodash');var squel=require(_0xb8a8('0xb'));var crypto=require(_0xb8a8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb8a8('0xd'));var Redis=require(_0xb8a8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb8a8('0xf'));var hardwareService=require(_0xb8a8('0x10'));var logger=require(_0xb8a8('0x11'))(_0xb8a8('0x12'));var utils=require(_0xb8a8('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb8a8('0x14'));var db=require(_0xb8a8('0x15'))['db'];function respondWithStatusCode(_0xcc3f8f,_0x4f408f){_0x4f408f=_0x4f408f||0xcc;return function(_0x3f8288){if(_0x3f8288){return _0xcc3f8f[_0xb8a8('0x16')](_0x4f408f);}return _0xcc3f8f[_0xb8a8('0x17')](_0x4f408f)[_0xb8a8('0x18')]();};}function respondWithResult(_0x146523,_0x5524b6){_0x5524b6=_0x5524b6||0xc8;return function(_0x36b734){if(_0x36b734){return _0x146523[_0xb8a8('0x17')](_0x5524b6)[_0xb8a8('0x19')](_0x36b734);}};}function respondWithFilteredResult(_0x5a1be9,_0x508ed1){return function(_0x568bfb){if(_0x568bfb){var _0x58888c=typeof _0x508ed1[_0xb8a8('0x1a')]===_0xb8a8('0x1b')&&typeof _0x508ed1[_0xb8a8('0x1c')]===_0xb8a8('0x1b');var _0x3b9d6b=_0x568bfb['count'];var _0x690ca6=_0x58888c?0x0:_0x508ed1[_0xb8a8('0x1a')];var _0x1b0b69=_0x58888c?_0x568bfb[_0xb8a8('0x1d')]:_0x508ed1[_0xb8a8('0x1a')]+_0x508ed1['limit'];var _0xac78b0;if(_0x1b0b69>=_0x3b9d6b){_0x1b0b69=_0x3b9d6b;_0xac78b0=0xc8;}else{_0xac78b0=0xce;}_0x5a1be9['status'](_0xac78b0);return _0x5a1be9[_0xb8a8('0x1e')](_0xb8a8('0x1f'),_0x690ca6+'-'+_0x1b0b69+'/'+_0x3b9d6b)[_0xb8a8('0x19')](_0x568bfb);}return null;};}function patchUpdates(_0x4db600){return function(_0x2bdf0b){try{jsonpatch[_0xb8a8('0x20')](_0x2bdf0b,_0x4db600,!![]);}catch(_0x4dca88){return BPromise['reject'](_0x4dca88);}return _0x2bdf0b[_0xb8a8('0x21')]();};}function saveUpdates(_0x45a2bb,_0x110705){return function(_0x356621){if(_0x356621){return _0x356621[_0xb8a8('0x22')](_0x45a2bb)['then'](function(_0x2f6956){return _0x2f6956;});}return null;};}function removeEntity(_0x94f71,_0x3c055d){return function(_0x344594){if(_0x344594){return _0x344594['destroy']()['then'](function(){_0x94f71[_0xb8a8('0x17')](0xcc)[_0xb8a8('0x18')]();});}};}function handleEntityNotFound(_0xd83504,_0x450d99){return function(_0x49e3b9){if(!_0x49e3b9){_0xd83504[_0xb8a8('0x16')](0x194);}return _0x49e3b9;};}function handleError(_0x3d836c,_0x4c1c3e){_0x4c1c3e=_0x4c1c3e||0x1f4;return function(_0x436fdf){logger['error'](_0x436fdf[_0xb8a8('0x23')]);if(_0x436fdf[_0xb8a8('0x24')]){delete _0x436fdf[_0xb8a8('0x24')];}_0x3d836c[_0xb8a8('0x17')](_0x4c1c3e)['send'](_0x436fdf);};}exports['index']=function(_0x3b2308,_0x163395){var _0x26e345={},_0x2d188a={},_0x134105={'count':0x0,'rows':[]};var _0x58bf25=_[_0xb8a8('0x25')](db[_0xb8a8('0x26')][_0xb8a8('0x27')],function(_0xcbd394){return{'name':_0xcbd394[_0xb8a8('0x28')],'type':_0xcbd394[_0xb8a8('0x29')][_0xb8a8('0x2a')]};});_0x2d188a['model']=_['map'](_0x58bf25,_0xb8a8('0x24'));_0x2d188a[_0xb8a8('0x2b')]=_[_0xb8a8('0x2c')](_0x3b2308[_0xb8a8('0x2b')]);_0x2d188a[_0xb8a8('0x2d')]=_[_0xb8a8('0x2e')](_0x2d188a[_0xb8a8('0x2f')],_0x2d188a['query']);_0x26e345['attributes']=_[_0xb8a8('0x2e')](_0x2d188a[_0xb8a8('0x2f')],qs['fields'](_0x3b2308[_0xb8a8('0x2b')][_0xb8a8('0x30')]));_0x26e345[_0xb8a8('0x31')]=_0x26e345[_0xb8a8('0x31')][_0xb8a8('0x32')]?_0x26e345[_0xb8a8('0x31')]:_0x2d188a[_0xb8a8('0x2f')];if(!_0x3b2308[_0xb8a8('0x2b')]['hasOwnProperty']('nolimit')){_0x26e345['limit']=qs[_0xb8a8('0x1c')](_0x3b2308[_0xb8a8('0x2b')][_0xb8a8('0x1c')]);_0x26e345['offset']=qs[_0xb8a8('0x1a')](_0x3b2308[_0xb8a8('0x2b')]['offset']);}_0x26e345[_0xb8a8('0x33')]=qs['sort'](_0x3b2308[_0xb8a8('0x2b')][_0xb8a8('0x34')]);_0x26e345[_0xb8a8('0x35')]=qs[_0xb8a8('0x2d')](_[_0xb8a8('0x36')](_0x3b2308[_0xb8a8('0x2b')],_0x2d188a[_0xb8a8('0x2d')]),_0x58bf25);if(_0x3b2308['query'][_0xb8a8('0x37')]){_0x26e345[_0xb8a8('0x35')]=_['merge'](_0x26e345[_0xb8a8('0x35')],{'$or':_[_0xb8a8('0x25')](_0x58bf25,function(_0x3d3bd0){if(_0x3d3bd0['type']!=='VIRTUAL'){var _0x2afcf3={};_0x2afcf3[_0x3d3bd0[_0xb8a8('0x24')]]={'$like':'%'+_0x3b2308[_0xb8a8('0x2b')][_0xb8a8('0x37')]+'%'};return _0x2afcf3;}})});}_0x26e345=_['merge']({},_0x26e345,_0x3b2308[_0xb8a8('0x38')]);var _0x18be58={'where':_0x26e345[_0xb8a8('0x35')]};return db[_0xb8a8('0x26')][_0xb8a8('0x1d')](_0x18be58)[_0xb8a8('0x39')](function(_0x27c002){_0x134105['count']=_0x27c002;if(_0x3b2308[_0xb8a8('0x2b')][_0xb8a8('0x3a')]){_0x26e345[_0xb8a8('0x3b')]=[{'all':!![]}];}return db[_0xb8a8('0x26')]['findAll'](_0x26e345);})[_0xb8a8('0x39')](function(_0x460bcf){_0x134105['rows']=_0x460bcf;return _0x134105;})['then'](respondWithFilteredResult(_0x163395,_0x26e345))[_0xb8a8('0x3c')](handleError(_0x163395,null));};exports[_0xb8a8('0x3d')]=function(_0x4673ce,_0x493299){var _0x2b31ed={'raw':!![],'where':{'id':_0x4673ce[_0xb8a8('0x3e')]['id']}},_0x33ea69={};_0x33ea69[_0xb8a8('0x2f')]=_[_0xb8a8('0x2c')](db[_0xb8a8('0x26')][_0xb8a8('0x27')]);_0x33ea69[_0xb8a8('0x2b')]=_['keys'](_0x4673ce[_0xb8a8('0x2b')]);_0x33ea69[_0xb8a8('0x2d')]=_[_0xb8a8('0x2e')](_0x33ea69[_0xb8a8('0x2f')],_0x33ea69['query']);_0x2b31ed[_0xb8a8('0x31')]=_[_0xb8a8('0x2e')](_0x33ea69[_0xb8a8('0x2f')],qs['fields'](_0x4673ce[_0xb8a8('0x2b')][_0xb8a8('0x30')]));_0x2b31ed[_0xb8a8('0x31')]=_0x2b31ed['attributes']['length']?_0x2b31ed['attributes']:_0x33ea69[_0xb8a8('0x2f')];if(_0x4673ce[_0xb8a8('0x2b')][_0xb8a8('0x3a')]){_0x2b31ed[_0xb8a8('0x3b')]=[{'all':!![]}];}_0x2b31ed=_['merge']({},_0x2b31ed,_0x4673ce[_0xb8a8('0x38')]);return db['JscriptySessionReport'][_0xb8a8('0x3f')](_0x2b31ed)[_0xb8a8('0x39')](handleEntityNotFound(_0x493299,null))[_0xb8a8('0x39')](respondWithResult(_0x493299,null))[_0xb8a8('0x3c')](handleError(_0x493299,null));};exports[_0xb8a8('0x40')]=function(_0x131743,_0x4f44c2){return db[_0xb8a8('0x26')]['create'](_0x131743['body'],{})[_0xb8a8('0x39')](respondWithResult(_0x4f44c2,0xc9))[_0xb8a8('0x3c')](handleError(_0x4f44c2,null));};exports[_0xb8a8('0x22')]=function(_0x34c101,_0x1ad18d){if(_0x34c101['body']['id']){delete _0x34c101[_0xb8a8('0x41')]['id'];}return db[_0xb8a8('0x26')][_0xb8a8('0x3f')]({'where':{'id':_0x34c101[_0xb8a8('0x3e')]['id']}})[_0xb8a8('0x39')](handleEntityNotFound(_0x1ad18d,null))[_0xb8a8('0x39')](saveUpdates(_0x34c101[_0xb8a8('0x41')],null))[_0xb8a8('0x39')](respondWithResult(_0x1ad18d,null))[_0xb8a8('0x3c')](handleError(_0x1ad18d,null));};exports['destroy']=function(_0x339329,_0x405cff){return db[_0xb8a8('0x26')][_0xb8a8('0x3f')]({'where':{'id':_0x339329[_0xb8a8('0x3e')]['id']}})['then'](handleEntityNotFound(_0x405cff,null))['then'](removeEntity(_0x405cff,null))[_0xb8a8('0x3c')](handleError(_0x405cff,null));};exports[_0xb8a8('0x42')]=function(_0x3f4991,_0x49388c){return db[_0xb8a8('0x26')]['describe']()[_0xb8a8('0x39')](respondWithResult(_0x49388c,null))[_0xb8a8('0x3c')](handleError(_0x49388c,null));};exports[_0xb8a8('0x43')]=function(_0x1550b8,_0x3a424a,_0x164140){var _0x1f0438={'raw':!![],'where':{}};var _0x37acf5={};var _0x500ffa={'count':0x0,'rows':[]};return db[_0xb8a8('0x26')][_0xb8a8('0x44')]({'where':{'id':_0x1550b8['params']['id']}})[_0xb8a8('0x39')](handleEntityNotFound(_0x3a424a,null))[_0xb8a8('0x39')](function(_0xaea4eb){if(_0xaea4eb){_0x37acf5[_0xb8a8('0x2f')]=_[_0xb8a8('0x2c')](db['JscriptyQuestionReport'][_0xb8a8('0x27')]);_0x37acf5[_0xb8a8('0x2b')]=_[_0xb8a8('0x2c')](_0x1550b8[_0xb8a8('0x2b')]);_0x37acf5[_0xb8a8('0x2d')]=_[_0xb8a8('0x2e')](_0x37acf5[_0xb8a8('0x2f')],_0x37acf5['query']);_0x1f0438['attributes']=_[_0xb8a8('0x2e')](_0x37acf5[_0xb8a8('0x2f')],qs['fields'](_0x1550b8[_0xb8a8('0x2b')][_0xb8a8('0x30')]));_0x1f0438[_0xb8a8('0x31')]=_0x1f0438[_0xb8a8('0x31')]['length']?_0x1f0438[_0xb8a8('0x31')]:_0x37acf5[_0xb8a8('0x2f')];if(!_0x1550b8[_0xb8a8('0x2b')][_0xb8a8('0x45')](_0xb8a8('0x46'))){_0x1f0438[_0xb8a8('0x1c')]=qs[_0xb8a8('0x1c')](_0x1550b8[_0xb8a8('0x2b')][_0xb8a8('0x1c')]);_0x1f0438[_0xb8a8('0x1a')]=qs[_0xb8a8('0x1a')](_0x1550b8[_0xb8a8('0x2b')]['offset']);}_0x1f0438[_0xb8a8('0x33')]=qs[_0xb8a8('0x34')](_0x1550b8[_0xb8a8('0x2b')]['sort']);_0x1f0438[_0xb8a8('0x35')]=qs[_0xb8a8('0x2d')](_[_0xb8a8('0x36')](_0x1550b8[_0xb8a8('0x2b')],_0x37acf5[_0xb8a8('0x2d')]));_0x1f0438[_0xb8a8('0x35')]['SessionId']=_0xaea4eb['id'];if(_0x1550b8[_0xb8a8('0x2b')]['filter']){_0x1f0438['where']=_[_0xb8a8('0x47')](_0x1f0438[_0xb8a8('0x35')],{'$or':_[_0xb8a8('0x25')](_0x1f0438[_0xb8a8('0x31')],function(_0x3ae33f){var _0x1fbb33={};_0x1fbb33[_0x3ae33f]={'$like':'%'+_0x1550b8['query']['filter']+'%'};return _0x1fbb33;})});}_0x1f0438=_[_0xb8a8('0x47')]({},_0x1f0438,_0x1550b8['options']);return db['JscriptyQuestionReport'][_0xb8a8('0x1d')]({'where':_0x1f0438[_0xb8a8('0x35')]})[_0xb8a8('0x39')](function(_0x2b6cf0){_0x500ffa[_0xb8a8('0x1d')]=_0x2b6cf0;if(_0x1550b8['query'][_0xb8a8('0x3a')]){_0x1f0438['include']=[{'all':!![]}];}return db[_0xb8a8('0x48')][_0xb8a8('0x49')](_0x1f0438);})[_0xb8a8('0x39')](function(_0x3adc36){_0x500ffa[_0xb8a8('0x4a')]=_0x3adc36;return _0x500ffa;});}})[_0xb8a8('0x39')](respondWithFilteredResult(_0x3a424a,_0x1f0438))[_0xb8a8('0x3c')](handleError(_0x3a424a,null));}; \ No newline at end of file +var _0xea6c=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model'];(function(_0x2ef667,_0x296a08){var _0x3251dc=function(_0x3a45a3){while(--_0x3a45a3){_0x2ef667['push'](_0x2ef667['shift']());}};_0x3251dc(++_0x296a08);}(_0xea6c,0x1b6));var _0xcea6=function(_0x100ffb,_0x5a8adc){_0x100ffb=_0x100ffb-0x0;var _0x54e870=_0xea6c[_0x100ffb];return _0x54e870;};'use strict';var emlformat=require(_0xcea6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcea6('0x1'));var jsonpatch=require(_0xcea6('0x2'));var rp=require(_0xcea6('0x3'));var moment=require(_0xcea6('0x4'));var BPromise=require(_0xcea6('0x5'));var Mustache=require(_0xcea6('0x6'));var util=require('util');var path=require(_0xcea6('0x7'));var sox=require('sox');var csv=require(_0xcea6('0x8'));var ejs=require(_0xcea6('0x9'));var fs=require('fs');var fs_extra=require(_0xcea6('0xa'));var _=require(_0xcea6('0xb'));var squel=require(_0xcea6('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcea6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcea6('0xe'));var Papa=require(_0xcea6('0xf'));var Redis=require(_0xcea6('0x10'));var authService=require(_0xcea6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xcea6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcea6('0x13'))('api');var utils=require(_0xcea6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcea6('0x15'));var db=require(_0xcea6('0x16'))['db'];function respondWithStatusCode(_0x32dc91,_0x52a0dd){_0x52a0dd=_0x52a0dd||0xcc;return function(_0x5b3b8d){if(_0x5b3b8d){return _0x32dc91[_0xcea6('0x17')](_0x52a0dd);}return _0x32dc91[_0xcea6('0x18')](_0x52a0dd)[_0xcea6('0x19')]();};}function respondWithResult(_0x199def,_0x189bab){_0x189bab=_0x189bab||0xc8;return function(_0x1c4433){if(_0x1c4433){return _0x199def['status'](_0x189bab)[_0xcea6('0x1a')](_0x1c4433);}};}function respondWithFilteredResult(_0x313641,_0x355df8){return function(_0x4e3199){if(_0x4e3199){var _0x31223a=typeof _0x355df8[_0xcea6('0x1b')]===_0xcea6('0x1c')&&typeof _0x355df8[_0xcea6('0x1d')]===_0xcea6('0x1c');var _0x82883b=_0x4e3199[_0xcea6('0x1e')];var _0x44c374=_0x31223a?0x0:_0x355df8[_0xcea6('0x1b')];var _0x2c3f80=_0x31223a?_0x4e3199[_0xcea6('0x1e')]:_0x355df8[_0xcea6('0x1b')]+_0x355df8[_0xcea6('0x1d')];var _0x57c133;if(_0x2c3f80>=_0x82883b){_0x2c3f80=_0x82883b;_0x57c133=0xc8;}else{_0x57c133=0xce;}_0x313641[_0xcea6('0x18')](_0x57c133);return _0x313641[_0xcea6('0x1f')](_0xcea6('0x20'),_0x44c374+'-'+_0x2c3f80+'/'+_0x82883b)[_0xcea6('0x1a')](_0x4e3199);}return null;};}function patchUpdates(_0x18306d){return function(_0x1b8b9f){try{jsonpatch['apply'](_0x1b8b9f,_0x18306d,!![]);}catch(_0x37d369){return BPromise[_0xcea6('0x21')](_0x37d369);}return _0x1b8b9f['save']();};}function saveUpdates(_0x3bd4d1,_0x12fdfc){return function(_0x162582){if(_0x162582){return _0x162582['update'](_0x3bd4d1)[_0xcea6('0x22')](function(_0x97817e){return _0x97817e;});}return null;};}function removeEntity(_0x43997f,_0x3b8e3f){return function(_0x410019){if(_0x410019){return _0x410019[_0xcea6('0x23')]()[_0xcea6('0x22')](function(){_0x43997f[_0xcea6('0x18')](0xcc)[_0xcea6('0x19')]();});}};}function handleEntityNotFound(_0x1b6ef6,_0x2fd90b){return function(_0x457f4d){if(!_0x457f4d){_0x1b6ef6[_0xcea6('0x17')](0x194);}return _0x457f4d;};}function handleError(_0x4e9a13,_0x360d50){_0x360d50=_0x360d50||0x1f4;return function(_0xda76a5){logger[_0xcea6('0x24')](_0xda76a5[_0xcea6('0x25')]);if(_0xda76a5['name']){delete _0xda76a5[_0xcea6('0x26')];}_0x4e9a13[_0xcea6('0x18')](_0x360d50)[_0xcea6('0x27')](_0xda76a5);};}exports[_0xcea6('0x28')]=function(_0x47ea06,_0x337d43){var _0x2a3f1e={},_0x808940={},_0x533b15={'count':0x0,'rows':[]};var _0x1a9507=_[_0xcea6('0x29')](db[_0xcea6('0x2a')][_0xcea6('0x2b')],function(_0xf66a2){return{'name':_0xf66a2[_0xcea6('0x2c')],'type':_0xf66a2[_0xcea6('0x2d')][_0xcea6('0x2e')]};});_0x808940[_0xcea6('0x2f')]=_['map'](_0x1a9507,_0xcea6('0x26'));_0x808940[_0xcea6('0x30')]=_[_0xcea6('0x31')](_0x47ea06[_0xcea6('0x30')]);_0x808940['filters']=_[_0xcea6('0x32')](_0x808940[_0xcea6('0x2f')],_0x808940[_0xcea6('0x30')]);_0x2a3f1e[_0xcea6('0x33')]=_[_0xcea6('0x32')](_0x808940[_0xcea6('0x2f')],qs['fields'](_0x47ea06[_0xcea6('0x30')][_0xcea6('0x34')]));_0x2a3f1e[_0xcea6('0x33')]=_0x2a3f1e[_0xcea6('0x33')][_0xcea6('0x35')]?_0x2a3f1e[_0xcea6('0x33')]:_0x808940[_0xcea6('0x2f')];if(!_0x47ea06[_0xcea6('0x30')][_0xcea6('0x36')](_0xcea6('0x37'))){_0x2a3f1e[_0xcea6('0x1d')]=qs[_0xcea6('0x1d')](_0x47ea06[_0xcea6('0x30')]['limit']);_0x2a3f1e[_0xcea6('0x1b')]=qs[_0xcea6('0x1b')](_0x47ea06[_0xcea6('0x30')][_0xcea6('0x1b')]);}_0x2a3f1e[_0xcea6('0x38')]=qs[_0xcea6('0x39')](_0x47ea06['query'][_0xcea6('0x39')]);_0x2a3f1e[_0xcea6('0x3a')]=qs[_0xcea6('0x3b')](_[_0xcea6('0x3c')](_0x47ea06['query'],_0x808940[_0xcea6('0x3b')]),_0x1a9507);if(_0x47ea06['query'][_0xcea6('0x3d')]){_0x2a3f1e[_0xcea6('0x3a')]=_[_0xcea6('0x3e')](_0x2a3f1e[_0xcea6('0x3a')],{'$or':_[_0xcea6('0x29')](_0x1a9507,function(_0x43e0fd){if(_0x43e0fd[_0xcea6('0x2d')]!==_0xcea6('0x3f')){var _0xc3b5cb={};_0xc3b5cb[_0x43e0fd['name']]={'$like':'%'+_0x47ea06['query'][_0xcea6('0x3d')]+'%'};return _0xc3b5cb;}})});}_0x2a3f1e=_['merge']({},_0x2a3f1e,_0x47ea06['options']);var _0x34c93a={'where':_0x2a3f1e[_0xcea6('0x3a')]};return db[_0xcea6('0x2a')][_0xcea6('0x1e')](_0x34c93a)[_0xcea6('0x22')](function(_0x2dd53b){_0x533b15[_0xcea6('0x1e')]=_0x2dd53b;if(_0x47ea06[_0xcea6('0x30')][_0xcea6('0x40')]){_0x2a3f1e[_0xcea6('0x41')]=[{'all':!![]}];}return db[_0xcea6('0x2a')]['findAll'](_0x2a3f1e);})[_0xcea6('0x22')](function(_0x436094){_0x533b15[_0xcea6('0x42')]=_0x436094;return _0x533b15;})[_0xcea6('0x22')](respondWithFilteredResult(_0x337d43,_0x2a3f1e))[_0xcea6('0x43')](handleError(_0x337d43,null));};exports[_0xcea6('0x44')]=function(_0x460f0c,_0x51fd42){var _0x17e301={'raw':!![],'where':{'id':_0x460f0c[_0xcea6('0x45')]['id']}},_0x3c5fe0={};_0x3c5fe0['model']=_['keys'](db['JscriptySessionReport'][_0xcea6('0x2b')]);_0x3c5fe0[_0xcea6('0x30')]=_['keys'](_0x460f0c[_0xcea6('0x30')]);_0x3c5fe0[_0xcea6('0x3b')]=_[_0xcea6('0x32')](_0x3c5fe0[_0xcea6('0x2f')],_0x3c5fe0[_0xcea6('0x30')]);_0x17e301['attributes']=_['intersection'](_0x3c5fe0[_0xcea6('0x2f')],qs[_0xcea6('0x34')](_0x460f0c[_0xcea6('0x30')][_0xcea6('0x34')]));_0x17e301[_0xcea6('0x33')]=_0x17e301['attributes']['length']?_0x17e301['attributes']:_0x3c5fe0[_0xcea6('0x2f')];if(_0x460f0c['query']['includeAll']){_0x17e301[_0xcea6('0x41')]=[{'all':!![]}];}_0x17e301=_[_0xcea6('0x3e')]({},_0x17e301,_0x460f0c[_0xcea6('0x46')]);return db[_0xcea6('0x2a')][_0xcea6('0x47')](_0x17e301)[_0xcea6('0x22')](handleEntityNotFound(_0x51fd42,null))[_0xcea6('0x22')](respondWithResult(_0x51fd42,null))[_0xcea6('0x43')](handleError(_0x51fd42,null));};exports[_0xcea6('0x48')]=function(_0x38890c,_0x1419df){return db[_0xcea6('0x2a')][_0xcea6('0x48')](_0x38890c[_0xcea6('0x49')],{})[_0xcea6('0x22')](respondWithResult(_0x1419df,0xc9))[_0xcea6('0x43')](handleError(_0x1419df,null));};exports[_0xcea6('0x4a')]=function(_0x412e84,_0xf4ba97){if(_0x412e84['body']['id']){delete _0x412e84[_0xcea6('0x49')]['id'];}return db[_0xcea6('0x2a')][_0xcea6('0x47')]({'where':{'id':_0x412e84['params']['id']}})[_0xcea6('0x22')](handleEntityNotFound(_0xf4ba97,null))[_0xcea6('0x22')](saveUpdates(_0x412e84[_0xcea6('0x49')],null))[_0xcea6('0x22')](respondWithResult(_0xf4ba97,null))[_0xcea6('0x43')](handleError(_0xf4ba97,null));};exports['destroy']=function(_0x1ea79a,_0x31e944){return db[_0xcea6('0x2a')][_0xcea6('0x47')]({'where':{'id':_0x1ea79a[_0xcea6('0x45')]['id']}})[_0xcea6('0x22')](handleEntityNotFound(_0x31e944,null))['then'](removeEntity(_0x31e944,null))[_0xcea6('0x43')](handleError(_0x31e944,null));};exports['describe']=function(_0x145eb0,_0x1860b2){return db['JscriptySessionReport'][_0xcea6('0x4b')]()[_0xcea6('0x22')](respondWithResult(_0x1860b2,null))[_0xcea6('0x43')](handleError(_0x1860b2,null));};exports[_0xcea6('0x4c')]=function(_0x485290,_0x5807b9,_0xb0279c){var _0x502f5c={'raw':!![],'where':{}};var _0x1e524b={};var _0x1ac2e7={'count':0x0,'rows':[]};return db[_0xcea6('0x2a')][_0xcea6('0x4d')]({'where':{'id':_0x485290['params']['id']}})['then'](handleEntityNotFound(_0x5807b9,null))[_0xcea6('0x22')](function(_0x23cf79){if(_0x23cf79){_0x1e524b[_0xcea6('0x2f')]=_['keys'](db[_0xcea6('0x4e')][_0xcea6('0x2b')]);_0x1e524b[_0xcea6('0x30')]=_['keys'](_0x485290['query']);_0x1e524b[_0xcea6('0x3b')]=_[_0xcea6('0x32')](_0x1e524b[_0xcea6('0x2f')],_0x1e524b[_0xcea6('0x30')]);_0x502f5c['attributes']=_[_0xcea6('0x32')](_0x1e524b[_0xcea6('0x2f')],qs[_0xcea6('0x34')](_0x485290[_0xcea6('0x30')][_0xcea6('0x34')]));_0x502f5c[_0xcea6('0x33')]=_0x502f5c[_0xcea6('0x33')]['length']?_0x502f5c['attributes']:_0x1e524b[_0xcea6('0x2f')];if(!_0x485290[_0xcea6('0x30')][_0xcea6('0x36')](_0xcea6('0x37'))){_0x502f5c[_0xcea6('0x1d')]=qs[_0xcea6('0x1d')](_0x485290[_0xcea6('0x30')][_0xcea6('0x1d')]);_0x502f5c[_0xcea6('0x1b')]=qs[_0xcea6('0x1b')](_0x485290[_0xcea6('0x30')][_0xcea6('0x1b')]);}_0x502f5c[_0xcea6('0x38')]=qs['sort'](_0x485290['query']['sort']);_0x502f5c['where']=qs[_0xcea6('0x3b')](_[_0xcea6('0x3c')](_0x485290[_0xcea6('0x30')],_0x1e524b['filters']));_0x502f5c[_0xcea6('0x3a')][_0xcea6('0x4f')]=_0x23cf79['id'];if(_0x485290['query']['filter']){_0x502f5c[_0xcea6('0x3a')]=_[_0xcea6('0x3e')](_0x502f5c['where'],{'$or':_[_0xcea6('0x29')](_0x502f5c[_0xcea6('0x33')],function(_0x57244c){var _0xc59fc0={};_0xc59fc0[_0x57244c]={'$like':'%'+_0x485290[_0xcea6('0x30')][_0xcea6('0x3d')]+'%'};return _0xc59fc0;})});}_0x502f5c=_[_0xcea6('0x3e')]({},_0x502f5c,_0x485290[_0xcea6('0x46')]);return db[_0xcea6('0x4e')][_0xcea6('0x1e')]({'where':_0x502f5c[_0xcea6('0x3a')]})[_0xcea6('0x22')](function(_0x2ea52c){_0x1ac2e7[_0xcea6('0x1e')]=_0x2ea52c;if(_0x485290[_0xcea6('0x30')][_0xcea6('0x40')]){_0x502f5c[_0xcea6('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xcea6('0x50')](_0x502f5c);})[_0xcea6('0x22')](function(_0xa224cb){_0x1ac2e7[_0xcea6('0x42')]=_0xa224cb;return _0x1ac2e7;});}})['then'](respondWithFilteredResult(_0x5807b9,_0x502f5c))[_0xcea6('0x43')](handleError(_0x5807b9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 0f8f42c..16d862c 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 _0xc6ac=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x648163,_0x241576){var _0x199d4d=function(_0x23055d){while(--_0x23055d){_0x648163['push'](_0x648163['shift']());}};_0x199d4d(++_0x241576);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x433ca2,_0x150e0a){_0x433ca2=_0x433ca2-0x0;var _0x1bdd4f=_0xc6ac[_0x433ca2];return _0x1bdd4f;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e8=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash'];(function(_0x465845,_0x15007c){var _0x314825=function(_0x4f24b8){while(--_0x4f24b8){_0x465845['push'](_0x465845['shift']());}};_0x314825(++_0x15007c);}(_0x44e8,0xd7));var _0x844e=function(_0x1534ff,_0x55e61f){_0x1534ff=_0x1534ff-0x0;var _0x4eb308=_0x44e8[_0x1534ff];return _0x4eb308;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x844e('0x1'));var moment=require(_0x844e('0x2'));var BPromise=require(_0x844e('0x3'));var rp=require(_0x844e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var attributes=require(_0x844e('0x7'));module[_0x844e('0x8')]=function(_0x5c8f67,_0x2f6539){return _0x5c8f67[_0x844e('0x9')](_0x844e('0xa'),attributes,{'tableName':_0x844e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index ff8a46a..4db3580 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 _0x68b3=['rpc','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a7e86,_0x37be3b){var _0x198fa7=function(_0x2aefce){while(--_0x2aefce){_0x1a7e86['push'](_0x1a7e86['shift']());}};_0x198fa7(++_0x37be3b);}(_0x68b3,0x1d8));var _0x368b=function(_0x9a56e1,_0x419b00){_0x9a56e1=_0x9a56e1-0x0;var _0x4b4deb=_0x68b3[_0x9a56e1];return _0x4b4deb;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});} \ No newline at end of file +var _0x9f0e=['../../config/environment','jayson/promise','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1d133e,_0x16f6fa){var _0x26fb32=function(_0x1d4aa6){while(--_0x1d4aa6){_0x1d133e['push'](_0x1d133e['shift']());}};_0x26fb32(++_0x16f6fa);}(_0x9f0e,0x116));var _0xe9f0=function(_0x409666,_0x1a6690){_0x409666=_0x409666-0x0;var _0x267e96=_0x9f0e[_0x409666];return _0x267e96;};'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')]('JscriptySessionReport,\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 diff --git a/server/api/license/index.js b/server/api/license/index.js index 5c89305..51a3084 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 _0x12b1=['fs-extra','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','multer','util','path','connect-timeout','express'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x12b1,0xcd));var _0x112b=function(_0x57c029,_0x302ebd){_0x57c029=_0x57c029-0x0;var _0x6b7d44=_0x12b1[_0x57c029];return _0x6b7d44;};'use strict';var multer=require(_0x112b('0x0'));var util=require(_0x112b('0x1'));var path=require(_0x112b('0x2'));var timeout=require(_0x112b('0x3'));var express=require(_0x112b('0x4'));var router=express['Router']();var fs_extra=require(_0x112b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x112b('0x6'));router[_0x112b('0x7')]('/',controller[_0x112b('0x8')]);router[_0x112b('0x9')](_0x112b('0xa'),auth['isAuthenticated'](),controller[_0x112b('0xb')]);router[_0x112b('0x7')](_0x112b('0xc'),auth[_0x112b('0xd')](),controller[_0x112b('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5cec=['./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4d66fb,_0x98e5a6){var _0x2460ff=function(_0x52112c){while(--_0x52112c){_0x4d66fb['push'](_0x4d66fb['shift']());}};_0x2460ff(++_0x98e5a6);}(_0x5cec,0xa8));var _0xc5ce=function(_0x13bc9c,_0x2debec){_0x13bc9c=_0x13bc9c-0x0;var _0x2dd72b=_0x5cec[_0x13bc9c];return _0x2dd72b;};'use strict';var multer=require(_0xc5ce('0x0'));var util=require('util');var path=require(_0xc5ce('0x1'));var timeout=require(_0xc5ce('0x2'));var express=require(_0xc5ce('0x3'));var router=express[_0xc5ce('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5ce('0x5'));var interaction=require(_0xc5ce('0x6'));var config=require(_0xc5ce('0x7'));var controller=require(_0xc5ce('0x8'));router[_0xc5ce('0x9')]('/',controller['index']);router[_0xc5ce('0xa')](_0xc5ce('0xb'),auth[_0xc5ce('0xc')](),controller[_0xc5ce('0xd')]);router[_0xc5ce('0x9')](_0xc5ce('0xe'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xc5ce('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 721ca20..3df173e 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 _0xafbf=['STRING','INTEGER','exports','TEXT'];(function(_0x1ebee8,_0x1b5aa2){var _0x35d6e5=function(_0x13bba0){while(--_0x13bba0){_0x1ebee8['push'](_0x1ebee8['shift']());}};_0x35d6e5(++_0x1b5aa2);}(_0xafbf,0x86));var _0xfafb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xafbf[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xfafb('0x0')]={'license':{'type':Sequelize[_0xfafb('0x1')]},'data1':{'type':Sequelize[_0xfafb('0x2')]},'data2':{'type':Sequelize[_0xfafb('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xfafb('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7c4=['sequelize','exports','TEXT','STRING'];(function(_0x3e317b,_0x2c64f2){var _0x2bec45=function(_0x114459){while(--_0x114459){_0x3e317b['push'](_0x3e317b['shift']());}};_0x2bec45(++_0x2c64f2);}(_0xb7c4,0x140));var _0x4b7c=function(_0x20396b,_0x539cf4){_0x20396b=_0x20396b-0x0;var _0x3f5c51=_0xb7c4[_0x20396b];return _0x3f5c51;};'use strict';var Sequelize=require(_0x4b7c('0x0'));module[_0x4b7c('0x1')]={'license':{'type':Sequelize[_0x4b7c('0x2')]},'data1':{'type':Sequelize[_0x4b7c('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 7642563..e95f9e9 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 _0xcd05=['body','find','params','get','key','catch','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','text/plain','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','index','keys','License','rawAttributes','query','filters','intersection','attributes','model','fields','merge','getLicense','update'];(function(_0x2465ab,_0x1cfa0b){var _0x553428=function(_0x163ef0){while(--_0x163ef0){_0x2465ab['push'](_0x2465ab['shift']());}};_0x553428(++_0x1cfa0b);}(_0xcd05,0x19f));var _0x5cd0=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0xcd05[_0x3f4dd9];return _0x31c54a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cd0('0x0'));var zipdir=require(_0x5cd0('0x1'));var jsonpatch=require(_0x5cd0('0x2'));var rp=require(_0x5cd0('0x3'));var moment=require(_0x5cd0('0x4'));var BPromise=require(_0x5cd0('0x5'));var Mustache=require(_0x5cd0('0x6'));var util=require('util');var path=require(_0x5cd0('0x7'));var sox=require('sox');var csv=require(_0x5cd0('0x8'));var ejs=require(_0x5cd0('0x9'));var fs=require('fs');var fs_extra=require(_0x5cd0('0xa'));var _=require(_0x5cd0('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5cd0('0xc'));var deskjs=require(_0x5cd0('0xd'));var toCsv=require(_0x5cd0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5cd0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x5cd0('0xf'));var as=require(_0x5cd0('0x10'));var hardwareService=require(_0x5cd0('0x11'));var logger=require(_0x5cd0('0x12'))('api');var utils=require(_0x5cd0('0x13'));var config=require(_0x5cd0('0x14'));var licenseUtil=require(_0x5cd0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x259801,_0xf89d05){_0xf89d05=_0xf89d05||0xcc;return function(_0x11f1c2){if(_0x11f1c2){return _0x259801[_0x5cd0('0x16')](_0xf89d05);}return _0x259801['status'](_0xf89d05)['end']();};}function respondWithResult(_0x3b807b,_0x2df0e0){_0x2df0e0=_0x2df0e0||0xc8;return function(_0x5af842){if(_0x5af842){return _0x3b807b['status'](_0x2df0e0)['json'](_0x5af842);}};}function respondWithFilteredResult(_0x4c56cd,_0x43a4ba){return function(_0x111120){if(_0x111120){var _0x4cf8f7=typeof _0x43a4ba['offset']===_0x5cd0('0x17')&&typeof _0x43a4ba[_0x5cd0('0x18')]===_0x5cd0('0x17');var _0x1b3ddb=_0x111120[_0x5cd0('0x19')];var _0x28a89e=_0x4cf8f7?0x0:_0x43a4ba[_0x5cd0('0x1a')];var _0x4ffc17=_0x4cf8f7?_0x111120['count']:_0x43a4ba[_0x5cd0('0x1a')]+_0x43a4ba['limit'];var _0x18ad64;if(_0x4ffc17>=_0x1b3ddb){_0x4ffc17=_0x1b3ddb;_0x18ad64=0xc8;}else{_0x18ad64=0xce;}_0x4c56cd[_0x5cd0('0x1b')](_0x18ad64);return _0x4c56cd[_0x5cd0('0x1c')](_0x5cd0('0x1d'),_0x28a89e+'-'+_0x4ffc17+'/'+_0x1b3ddb)[_0x5cd0('0x1e')](_0x111120);}return null;};}function patchUpdates(_0x5102ee){return function(_0x566387){try{jsonpatch[_0x5cd0('0x1f')](_0x566387,_0x5102ee,!![]);}catch(_0x598813){return BPromise[_0x5cd0('0x20')](_0x598813);}return _0x566387[_0x5cd0('0x21')]();};}function saveUpdates(_0x29874b,_0x490380){return function(_0x10ec02){if(_0x10ec02){return _0x10ec02['update'](_0x29874b)[_0x5cd0('0x22')](function(_0x1cc9e0){return _0x1cc9e0;});}return null;};}function removeEntity(_0xd8410,_0x3b81ad){return function(_0x44df69){if(_0x44df69){return _0x44df69[_0x5cd0('0x23')]()[_0x5cd0('0x22')](function(){_0xd8410['status'](0xcc)[_0x5cd0('0x24')]();});}};}function handleEntityNotFound(_0x1f4377,_0x4939a0){return function(_0x368891){if(!_0x368891){_0x1f4377[_0x5cd0('0x16')](0x194);}return _0x368891;};}function handleError(_0x4d0e17,_0x53f4d6){_0x53f4d6=_0x53f4d6||0x1f4;return function(_0x2c5cb7){logger[_0x5cd0('0x25')](_0x2c5cb7[_0x5cd0('0x26')]);if(_0x2c5cb7['name']){delete _0x2c5cb7[_0x5cd0('0x27')];}_0x4d0e17[_0x5cd0('0x1b')](_0x53f4d6)[_0x5cd0('0x28')](_0x2c5cb7);};}var utilLicense=require('../../config/license/util');exports[_0x5cd0('0x29')]=function(_0x4217cb,_0x17d8c1){var _0x3a0718={'raw':!![],'where':{'id':0x1}},_0x54d7cf={};_0x54d7cf['model']=_[_0x5cd0('0x2a')](db[_0x5cd0('0x2b')][_0x5cd0('0x2c')]);_0x54d7cf[_0x5cd0('0x2d')]=_[_0x5cd0('0x2a')](_0x4217cb[_0x5cd0('0x2d')]);_0x54d7cf[_0x5cd0('0x2e')]=_[_0x5cd0('0x2f')](_0x54d7cf['model'],_0x54d7cf['query']);_0x3a0718[_0x5cd0('0x30')]=_[_0x5cd0('0x2f')](_0x54d7cf[_0x5cd0('0x31')],qs[_0x5cd0('0x32')](_0x4217cb[_0x5cd0('0x2d')][_0x5cd0('0x32')]));_0x3a0718['attributes']=_0x3a0718[_0x5cd0('0x30')]['length']?_0x3a0718[_0x5cd0('0x30')]:_0x54d7cf[_0x5cd0('0x31')];_0x3a0718=_[_0x5cd0('0x33')]({},_0x3a0718,_0x4217cb['options']);return utilLicense[_0x5cd0('0x34')](_0x3a0718)['then'](respondWithResult(_0x17d8c1,null))['catch'](handleError(_0x17d8c1,null));};exports[_0x5cd0('0x35')]=function(_0x444d0f,_0x2fadd4){if(_0x444d0f[_0x5cd0('0x36')]['id']){delete _0x444d0f[_0x5cd0('0x36')]['id'];}return db[_0x5cd0('0x2b')][_0x5cd0('0x37')]({'where':{'id':_0x444d0f[_0x5cd0('0x38')]['id']}})[_0x5cd0('0x22')](handleEntityNotFound(_0x2fadd4,null))['then'](function(_0x2e81c3){var _0xf957af=_0x2e81c3[_0x5cd0('0x39')]({'plain':!![]});return utilLicense['checkLicense'](_0xf957af,_0x444d0f[_0x5cd0('0x36')][_0x5cd0('0x3a')]);})[_0x5cd0('0x22')](function(_0x2fc952){if(!_0x2fc952['demo']){return saveUpdates(_0x444d0f[_0x5cd0('0x36')],null);}return _0x2fc952;})[_0x5cd0('0x22')](respondWithResult(_0x2fadd4,null))[_0x5cd0('0x3b')](handleError(_0x2fadd4,null));};exports['downloadLogFile']=function(_0x338352,_0x368678){var _0xd865de='license-info.log';var _0x52672d=path['join'](_0x5cd0('0x3c'),_0x5cd0('0x3d'),_0x5cd0('0x3e'),_0xd865de);_0x368678[_0x5cd0('0x3f')](_0x5cd0('0x40'),_0x5cd0('0x41')+_0xd865de);_0x368678[_0x5cd0('0x1c')]('Content-Type',_0x5cd0('0x42'));_0x368678['download'](_0x52672d);}; \ No newline at end of file +var _0x3071=['key','demo','downloadLogFile','license-info.log','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../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','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','model','keys','query','intersection','attributes','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x3071,0x1e2));var _0x1307=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0x3071[_0x11adbd];return _0x270029;};'use strict';var emlformat=require(_0x1307('0x0'));var rimraf=require(_0x1307('0x1'));var zipdir=require(_0x1307('0x2'));var jsonpatch=require(_0x1307('0x3'));var rp=require(_0x1307('0x4'));var moment=require(_0x1307('0x5'));var BPromise=require(_0x1307('0x6'));var Mustache=require(_0x1307('0x7'));var util=require(_0x1307('0x8'));var path=require(_0x1307('0x9'));var sox=require(_0x1307('0xa'));var csv=require(_0x1307('0xb'));var ejs=require(_0x1307('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1307('0xd'));var squel=require(_0x1307('0xe'));var crypto=require(_0x1307('0xf'));var jsforce=require(_0x1307('0x10'));var deskjs=require(_0x1307('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1307('0x12'));var Papa=require(_0x1307('0x13'));var Redis=require('ioredis');var authService=require(_0x1307('0x14'));var qs=require(_0x1307('0x15'));var as=require(_0x1307('0x16'));var hardwareService=require(_0x1307('0x17'));var logger=require(_0x1307('0x18'))(_0x1307('0x19'));var utils=require('../../config/utils');var config=require(_0x1307('0x1a'));var licenseUtil=require(_0x1307('0x1b'));var db=require(_0x1307('0x1c'))['db'];function respondWithStatusCode(_0x2ce3a1,_0x9afd15){_0x9afd15=_0x9afd15||0xcc;return function(_0x503095){if(_0x503095){return _0x2ce3a1['sendStatus'](_0x9afd15);}return _0x2ce3a1[_0x1307('0x1d')](_0x9afd15)[_0x1307('0x1e')]();};}function respondWithResult(_0x4e0273,_0x5c7aa0){_0x5c7aa0=_0x5c7aa0||0xc8;return function(_0x2e4c44){if(_0x2e4c44){return _0x4e0273[_0x1307('0x1d')](_0x5c7aa0)[_0x1307('0x1f')](_0x2e4c44);}};}function respondWithFilteredResult(_0x25e04e,_0x2f0e88){return function(_0x2aa205){if(_0x2aa205){var _0xbe4796=typeof _0x2f0e88[_0x1307('0x20')]===_0x1307('0x21')&&typeof _0x2f0e88[_0x1307('0x22')]===_0x1307('0x21');var _0x5754aa=_0x2aa205[_0x1307('0x23')];var _0xc2b46d=_0xbe4796?0x0:_0x2f0e88['offset'];var _0x493006=_0xbe4796?_0x2aa205[_0x1307('0x23')]:_0x2f0e88['offset']+_0x2f0e88[_0x1307('0x22')];var _0xd65c7e;if(_0x493006>=_0x5754aa){_0x493006=_0x5754aa;_0xd65c7e=0xc8;}else{_0xd65c7e=0xce;}_0x25e04e['status'](_0xd65c7e);return _0x25e04e['set'](_0x1307('0x24'),_0xc2b46d+'-'+_0x493006+'/'+_0x5754aa)[_0x1307('0x1f')](_0x2aa205);}return null;};}function patchUpdates(_0x404f49){return function(_0x377fa2){try{jsonpatch[_0x1307('0x25')](_0x377fa2,_0x404f49,!![]);}catch(_0x2a1a36){return BPromise[_0x1307('0x26')](_0x2a1a36);}return _0x377fa2[_0x1307('0x27')]();};}function saveUpdates(_0x27ac20,_0x52432a){return function(_0x46c15a){if(_0x46c15a){return _0x46c15a[_0x1307('0x28')](_0x27ac20)[_0x1307('0x29')](function(_0x512b19){return _0x512b19;});}return null;};}function removeEntity(_0x55fa45,_0x5853ca){return function(_0x55796c){if(_0x55796c){return _0x55796c[_0x1307('0x2a')]()[_0x1307('0x29')](function(){_0x55fa45[_0x1307('0x1d')](0xcc)[_0x1307('0x1e')]();});}};}function handleEntityNotFound(_0x326f29,_0xa2f7ae){return function(_0x505035){if(!_0x505035){_0x326f29[_0x1307('0x2b')](0x194);}return _0x505035;};}function handleError(_0x1062cb,_0x306f7b){_0x306f7b=_0x306f7b||0x1f4;return function(_0x410dbf){logger[_0x1307('0x2c')](_0x410dbf['stack']);if(_0x410dbf[_0x1307('0x2d')]){delete _0x410dbf['name'];}_0x1062cb['status'](_0x306f7b)[_0x1307('0x2e')](_0x410dbf);};}var utilLicense=require(_0x1307('0x1b'));exports[_0x1307('0x2f')]=function(_0x33834b,_0x5347a1){var _0x18c8d6={'raw':!![],'where':{'id':0x1}},_0x2c722e={};_0x2c722e[_0x1307('0x30')]=_[_0x1307('0x31')](db['License']['rawAttributes']);_0x2c722e[_0x1307('0x32')]=_[_0x1307('0x31')](_0x33834b[_0x1307('0x32')]);_0x2c722e['filters']=_['intersection'](_0x2c722e['model'],_0x2c722e[_0x1307('0x32')]);_0x18c8d6['attributes']=_[_0x1307('0x33')](_0x2c722e[_0x1307('0x30')],qs['fields'](_0x33834b[_0x1307('0x32')]['fields']));_0x18c8d6[_0x1307('0x34')]=_0x18c8d6[_0x1307('0x34')][_0x1307('0x35')]?_0x18c8d6[_0x1307('0x34')]:_0x2c722e[_0x1307('0x30')];_0x18c8d6=_[_0x1307('0x36')]({},_0x18c8d6,_0x33834b[_0x1307('0x37')]);return utilLicense[_0x1307('0x38')](_0x18c8d6)['then'](respondWithResult(_0x5347a1,null))[_0x1307('0x39')](handleError(_0x5347a1,null));};exports[_0x1307('0x28')]=function(_0x4c3001,_0x2f9357){if(_0x4c3001[_0x1307('0x3a')]['id']){delete _0x4c3001[_0x1307('0x3a')]['id'];}return db[_0x1307('0x3b')][_0x1307('0x3c')]({'where':{'id':_0x4c3001[_0x1307('0x3d')]['id']}})[_0x1307('0x29')](handleEntityNotFound(_0x2f9357,null))[_0x1307('0x29')](function(_0x229ec4){var _0x16864d=_0x229ec4[_0x1307('0x3e')]({'plain':!![]});return utilLicense[_0x1307('0x3f')](_0x16864d,_0x4c3001[_0x1307('0x3a')][_0x1307('0x40')]);})[_0x1307('0x29')](function(_0x3e4e89){if(!_0x3e4e89[_0x1307('0x41')]){return saveUpdates(_0x4c3001[_0x1307('0x3a')],null);}return _0x3e4e89;})[_0x1307('0x29')](respondWithResult(_0x2f9357,null))[_0x1307('0x39')](handleError(_0x2f9357,null));};exports[_0x1307('0x42')]=function(_0x2ea8e6,_0x1e6f36){var _0x39abc6=_0x1307('0x43');var _0x259189=path[_0x1307('0x44')]('/var',_0x1307('0x45'),_0x1307('0x46'),_0x39abc6);_0x1e6f36[_0x1307('0x47')](_0x1307('0x48'),_0x1307('0x49')+_0x39abc6);_0x1e6f36[_0x1307('0x4a')](_0x1307('0x4b'),_0x1307('0x4c'));_0x1e6f36[_0x1307('0x4d')](_0x259189);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0ea1593..6cebdaf 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 _0xdf73=['path','rimraf','./license.attributes','define','license','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xffd8b0,_0x12c51f){var _0x301ba0=function(_0x103c05){while(--_0x103c05){_0xffd8b0['push'](_0xffd8b0['shift']());}};_0x301ba0(++_0x12c51f);}(_0xdf73,0x9f));var _0x3df7=function(_0x5cefeb,_0x397abd){_0x5cefeb=_0x5cefeb-0x0;var _0x397374=_0xdf73[_0x5cefeb];return _0x397374;};'use strict';var _=require(_0x3df7('0x0'));var util=require('util');var logger=require(_0x3df7('0x1'))(_0x3df7('0x2'));var moment=require(_0x3df7('0x3'));var BPromise=require(_0x3df7('0x4'));var rp=require(_0x3df7('0x5'));var fs=require('fs');var path=require(_0x3df7('0x6'));var rimraf=require(_0x3df7('0x7'));var config=require('../../config/environment');var attributes=require(_0x3df7('0x8'));module['exports']=function(_0x1366ff,_0x3e9ef7){return _0x1366ff[_0x3df7('0x9')]('License',attributes,{'tableName':_0x3df7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34ff=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','lodash'];(function(_0x410935,_0x2c8960){var _0x2ac9aa=function(_0x2fc327){while(--_0x2fc327){_0x410935['push'](_0x410935['shift']());}};_0x2ac9aa(++_0x2c8960);}(_0x34ff,0x1b7));var _0xf34f=function(_0x21c90d,_0x2d4224){_0x21c90d=_0x21c90d-0x0;var _0x1a036a=_0x34ff[_0x21c90d];return _0x1a036a;};'use strict';var _=require(_0xf34f('0x0'));var util=require(_0xf34f('0x1'));var logger=require(_0xf34f('0x2'))('api');var moment=require(_0xf34f('0x3'));var BPromise=require(_0xf34f('0x4'));var rp=require(_0xf34f('0x5'));var fs=require('fs');var path=require(_0xf34f('0x6'));var rimraf=require(_0xf34f('0x7'));var config=require(_0xf34f('0x8'));var attributes=require(_0xf34f('0x9'));module['exports']=function(_0x150521,_0x3f6333){return _0x150521['define']('License',attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index e4f0439..832d16a 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 _0x5f4b=['request','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x5f4b,0x1d5));var _0xb5f4=function(_0x328030,_0x58f5bc){_0x328030=_0x328030-0x0;var _0x3c39f1=_0x5f4b[_0x328030];return _0x3c39f1;};'use strict';var _=require(_0xb5f4('0x0'));var util=require(_0xb5f4('0x1'));var moment=require(_0xb5f4('0x2'));var BPromise=require(_0xb5f4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5f4('0x4'))['db'];var utils=require(_0xb5f4('0x5'));var logger=require(_0xb5f4('0x6'))(_0xb5f4('0x7'));var config=require(_0xb5f4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb5f4('0x9')][_0xb5f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x150f78,_0x46bcef,_0x7d38d0){return new BPromise(function(_0x46d632,_0xcf67ad){return client[_0xb5f4('0xb')](_0x150f78,_0x7d38d0)['then'](function(_0x37e5ab){logger[_0xb5f4('0xc')]('License,\x20%s,\x20%s',_0x46bcef,_0xb5f4('0xd'));logger['debug'](_0xb5f4('0xe'),_0x46bcef,'request\x20sent',JSON[_0xb5f4('0xf')](_0x37e5ab));if(_0x37e5ab['error']){if(_0x37e5ab[_0xb5f4('0x10')]['code']===0x1f4){logger[_0xb5f4('0x10')](_0xb5f4('0x11'),_0x46bcef,_0x37e5ab[_0xb5f4('0x10')][_0xb5f4('0x12')]);return _0xcf67ad(_0x37e5ab[_0xb5f4('0x10')][_0xb5f4('0x12')]);}logger[_0xb5f4('0x10')](_0xb5f4('0x11'),_0x46bcef,_0x37e5ab[_0xb5f4('0x10')][_0xb5f4('0x12')]);return _0x46d632(_0x37e5ab['error'][_0xb5f4('0x12')]);}else{logger[_0xb5f4('0xc')](_0xb5f4('0x11'),_0x46bcef,_0xb5f4('0xd'));_0x46d632(_0x37e5ab[_0xb5f4('0x13')][_0xb5f4('0x12')]);}})['catch'](function(_0x3b6986){logger[_0xb5f4('0x10')]('License,\x20%s,\x20%s',_0x46bcef,_0x3b6986);_0xcf67ad(_0x3b6986);});});} \ No newline at end of file +var _0xf69a=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','License,\x20%s,\x20%s','result'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0xf69a,0x146));var _0xaf69=function(_0x529870,_0x975245){_0x529870=_0x529870-0x0;var _0x39435f=_0xf69a[_0x529870];return _0x39435f;};'use strict';var _=require(_0xaf69('0x0'));var util=require(_0xaf69('0x1'));var moment=require(_0xaf69('0x2'));var BPromise=require(_0xaf69('0x3'));var rs=require(_0xaf69('0x4'));var fs=require('fs');var Redis=require(_0xaf69('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf69('0x6'))(_0xaf69('0x7'));var config=require(_0xaf69('0x8'));var jayson=require(_0xaf69('0x9'));var client=jayson[_0xaf69('0xa')][_0xaf69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40e30e,_0x4c3b35,_0x51f704){return new BPromise(function(_0x5f1e02,_0x5c5ace){return client[_0xaf69('0xc')](_0x40e30e,_0x51f704)[_0xaf69('0xd')](function(_0x1ac782){logger[_0xaf69('0xe')]('License,\x20%s,\x20%s',_0x4c3b35,'request\x20sent');logger[_0xaf69('0xf')](_0xaf69('0x10'),_0x4c3b35,_0xaf69('0x11'),JSON[_0xaf69('0x12')](_0x1ac782));if(_0x1ac782[_0xaf69('0x13')]){if(_0x1ac782['error'][_0xaf69('0x14')]===0x1f4){logger['error']('License,\x20%s,\x20%s',_0x4c3b35,_0x1ac782[_0xaf69('0x13')]['message']);return _0x5c5ace(_0x1ac782[_0xaf69('0x13')][_0xaf69('0x15')]);}logger['error'](_0xaf69('0x16'),_0x4c3b35,_0x1ac782['error'][_0xaf69('0x15')]);return _0x5f1e02(_0x1ac782[_0xaf69('0x13')][_0xaf69('0x15')]);}else{logger[_0xaf69('0xe')](_0xaf69('0x16'),_0x4c3b35,_0xaf69('0x11'));_0x5f1e02(_0x1ac782[_0xaf69('0x17')][_0xaf69('0x15')]);}})[_0xaf69('0x18')](function(_0x5e5821){logger[_0xaf69('0x13')]('License,\x20%s,\x20%s',_0x4c3b35,_0x5e5821);_0x5c5ace(_0x5e5821);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4da840d..c7db0c9 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 _0x65c4=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','/:id/users','getAgents','post','addAnswer','addImap','addSmtp','/:id/send','put','update','delete','/:id/dispositions','removeDispositions','removeAnswers','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x18ba86,_0x2eeb6f){var _0x31e4be=function(_0xfd3cd4){while(--_0xfd3cd4){_0x18ba86['push'](_0x18ba86['shift']());}};_0x31e4be(++_0x2eeb6f);}(_0x65c4,0x154));var _0x465c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x65c4[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x465c('0x0'));var util=require(_0x465c('0x1'));var path=require(_0x465c('0x2'));var timeout=require(_0x465c('0x3'));var express=require(_0x465c('0x4'));var router=express[_0x465c('0x5')]();var fs_extra=require(_0x465c('0x6'));var auth=require(_0x465c('0x7'));var interaction=require(_0x465c('0x8'));var config=require(_0x465c('0x9'));var controller=require(_0x465c('0xa'));router[_0x465c('0xb')]('/',auth[_0x465c('0xc')](),controller[_0x465c('0xd')]);router[_0x465c('0xb')](_0x465c('0xe'),auth[_0x465c('0xc')](),controller['describe']);router['get'](_0x465c('0xf'),auth[_0x465c('0xc')](),controller[_0x465c('0x10')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x465c('0x11')]);router['get'](_0x465c('0x12'),auth[_0x465c('0xc')](),controller['getAnswers']);router['get'](_0x465c('0x13'),auth[_0x465c('0xc')](),controller['getImap']);router[_0x465c('0xb')](_0x465c('0x14'),auth[_0x465c('0xc')](),controller[_0x465c('0x15')]);router['get'](_0x465c('0x16'),auth[_0x465c('0xc')](),controller[_0x465c('0x17')]);router[_0x465c('0xb')](_0x465c('0x18'),auth[_0x465c('0xc')](),controller[_0x465c('0x19')]);router[_0x465c('0xb')]('/:id/messages',auth[_0x465c('0xc')](),controller['getMessages']);router[_0x465c('0xb')](_0x465c('0x1a'),auth[_0x465c('0xc')](),controller['verifySmtp']);router[_0x465c('0xb')](_0x465c('0x1b'),auth['isAuthenticated'](),controller[_0x465c('0x1c')]);router[_0x465c('0x1d')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0x465c('0x12'),auth[_0x465c('0xc')](),controller[_0x465c('0x1e')]);router[_0x465c('0x1d')]('/',auth['isAuthenticated'](),controller['create']);router[_0x465c('0x1d')]('/:id/in_servers',auth[_0x465c('0xc')](),controller[_0x465c('0x1f')]);router[_0x465c('0x1d')](_0x465c('0x14'),auth[_0x465c('0xc')](),controller[_0x465c('0x20')]);router['post'](_0x465c('0x16'),auth[_0x465c('0xc')](),controller['addInteraction']);router[_0x465c('0x1d')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x465c('0x1d')](_0x465c('0x21'),auth[_0x465c('0xc')](),controller['send']);router[_0x465c('0x1d')](_0x465c('0x1b'),auth['isAuthenticated'](),controller['addAgents']);router[_0x465c('0x22')]('/:id',auth['isAuthenticated'](),controller[_0x465c('0x23')]);router[_0x465c('0x24')](_0x465c('0x25'),auth[_0x465c('0xc')](),controller[_0x465c('0x26')]);router[_0x465c('0x24')](_0x465c('0x12'),auth[_0x465c('0xc')](),controller[_0x465c('0x27')]);router[_0x465c('0x24')](_0x465c('0x13'),auth['isAuthenticated'](),controller['removeImap']);router['delete'](_0x465c('0x14'),auth['isAuthenticated'](),controller[_0x465c('0x28')]);router['delete']('/:id',auth[_0x465c('0xc')](),controller['destroy']);router[_0x465c('0x24')](_0x465c('0x1b'),auth[_0x465c('0xc')](),controller[_0x465c('0x29')]);module[_0x465c('0x2a')]=router; \ No newline at end of file +var _0xb6fa=['delete','removeSmtp','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','describe','/:id','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/interactions','addApplications','send','/:id/users','update','removeDispositions'];(function(_0x28429f,_0x33bafd){var _0x45ffd2=function(_0x5abc86){while(--_0x5abc86){_0x28429f['push'](_0x28429f['shift']());}};_0x45ffd2(++_0x33bafd);}(_0xb6fa,0x1a8));var _0xab6f=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0xb6fa[_0x243217];return _0x478029;};'use strict';var multer=require(_0xab6f('0x0'));var util=require(_0xab6f('0x1'));var path=require('path');var timeout=require(_0xab6f('0x2'));var express=require(_0xab6f('0x3'));var router=express[_0xab6f('0x4')]();var fs_extra=require(_0xab6f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xab6f('0x6'));var controller=require('./mailAccount.controller');router[_0xab6f('0x7')]('/',auth['isAuthenticated'](),controller[_0xab6f('0x8')]);router[_0xab6f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xab6f('0x9')]);router[_0xab6f('0x7')](_0xab6f('0xa'),auth[_0xab6f('0xb')](),controller['show']);router[_0xab6f('0x7')]('/:id/dispositions',auth[_0xab6f('0xb')](),controller[_0xab6f('0xc')]);router[_0xab6f('0x7')](_0xab6f('0xd'),auth[_0xab6f('0xb')](),controller[_0xab6f('0xe')]);router[_0xab6f('0x7')](_0xab6f('0xf'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x10')]);router[_0xab6f('0x7')]('/:id/out_servers',auth[_0xab6f('0xb')](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0xab6f('0xb')](),controller[_0xab6f('0x11')]);router['get'](_0xab6f('0x12'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x13')]);router[_0xab6f('0x7')](_0xab6f('0x14'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x15')]);router[_0xab6f('0x7')](_0xab6f('0x16'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x17')]);router[_0xab6f('0x7')]('/:id/users',auth[_0xab6f('0xb')](),controller['getAgents']);router[_0xab6f('0x18')](_0xab6f('0x19'),auth['isAuthenticated'](),controller[_0xab6f('0x1a')]);router[_0xab6f('0x18')](_0xab6f('0xd'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x1b')]);router['post']('/',auth[_0xab6f('0xb')](),controller[_0xab6f('0x1c')]);router[_0xab6f('0x18')]('/:id/in_servers',auth[_0xab6f('0xb')](),controller[_0xab6f('0x1d')]);router[_0xab6f('0x18')](_0xab6f('0x1e'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x1f')]);router[_0xab6f('0x18')](_0xab6f('0x20'),auth[_0xab6f('0xb')](),controller['addInteraction']);router[_0xab6f('0x18')](_0xab6f('0x12'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x21')]);router[_0xab6f('0x18')]('/:id/send',auth[_0xab6f('0xb')](),controller[_0xab6f('0x22')]);router[_0xab6f('0x18')](_0xab6f('0x23'),auth[_0xab6f('0xb')](),controller['addAgents']);router['put'](_0xab6f('0xa'),auth['isAuthenticated'](),controller[_0xab6f('0x24')]);router['delete'](_0xab6f('0x19'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x25')]);router[_0xab6f('0x26')](_0xab6f('0xd'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xab6f('0x26')]('/:id/in_servers',auth[_0xab6f('0xb')](),controller['removeImap']);router[_0xab6f('0x26')](_0xab6f('0x1e'),auth[_0xab6f('0xb')](),controller[_0xab6f('0x27')]);router[_0xab6f('0x26')]('/:id',auth[_0xab6f('0xb')](),controller[_0xab6f('0x28')]);router[_0xab6f('0x26')](_0xab6f('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xab6f('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 7058241..833ccdb 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 _0xc7fb=['provider','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','hotmail','yahoo','outlook365','getDataValue','custom'];(function(_0x262c65,_0xc8dc44){var _0xdcbb3d=function(_0x5b3a49){while(--_0x5b3a49){_0x262c65['push'](_0x262c65['shift']());}};_0xdcbb3d(++_0xc8dc44);}(_0xc7fb,0x1b1));var _0xbc7f=function(_0x280654,_0x5f346c){_0x280654=_0x280654-0x0;var _0x396404=_0xc7fb[_0x280654];return _0x396404;};'use strict';var Sequelize=require(_0xbc7f('0x0'));module[_0xbc7f('0x1')]={'description':{'type':Sequelize[_0xbc7f('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xbc7f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xbc7f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xbc7f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xbc7f('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xbc7f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xbc7f('0x2')],'allowNull':![],'defaultValue':_0xbc7f('0x4')},'fontSize':{'type':Sequelize[_0xbc7f('0x5')](0x2)[_0xbc7f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbc7f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbc7f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbc7f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbc7f('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xbc7f('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xbc7f('0x3')],'defaultValue':![],'comment':_0xbc7f('0x8'),'set':function(_0x2b1386){if(!_0x2b1386)this[_0xbc7f('0x9')](_0xbc7f('0xa'),null);this[_0xbc7f('0x9')]('mandatoryDisposition',_0x2b1386);}},'provider':{'type':Sequelize[_0xbc7f('0xb')]('gmail',_0xbc7f('0xc'),_0xbc7f('0xd'),_0xbc7f('0xe')),'defaultValue':null,'get':function(){if(!this[_0xbc7f('0xf')]('provider'))return _0xbc7f('0x10');return this['getDataValue'](_0xbc7f('0x11'));},'set':function(_0x59c6fb){if(_0x59c6fb===_0xbc7f('0x10'))_0x59c6fb=null;return this[_0xbc7f('0x9')](_0xbc7f('0x11'),_0x59c6fb);}}}; \ No newline at end of file +var _0x808e=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','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','setDataValue','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize'];(function(_0xfc086,_0x2faefe){var _0x2e87e1=function(_0x30a573){while(--_0x30a573){_0xfc086['push'](_0xfc086['shift']());}};_0x2e87e1(++_0x2faefe);}(_0x808e,0x84));var _0xe808=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x808e[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0xe808('0x0'));module[_0xe808('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe808('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe808('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xe808('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xe808('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xe808('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe808('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xe808('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe808('0x4')],'defaultValue':function(){return _0xe808('0x7');}},'notificationSound':{'type':Sequelize[_0xe808('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe808('0x8')],'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[_0xe808('0x3')],'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[_0xe808('0x3')],'defaultValue':![],'comment':_0xe808('0x9'),'set':function(_0x3ec7c5){if(!_0x3ec7c5)this[_0xe808('0xa')]('mandatoryDispositionPauseId',null);this[_0xe808('0xa')](_0xe808('0xb'),_0x3ec7c5);}},'provider':{'type':Sequelize[_0xe808('0xc')](_0xe808('0xd'),'hotmail',_0xe808('0xe'),_0xe808('0xf')),'defaultValue':null,'get':function(){if(!this[_0xe808('0x10')](_0xe808('0x11')))return'custom';return this[_0xe808('0x10')]('provider');},'set':function(_0x30273f){if(_0x30273f===_0xe808('0x12'))_0x30273f=null;return this['setDataValue'](_0xe808('0x11'),_0x30273f);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 999ee83..05e3bcd 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 _0xa571=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','from','attachments','join','server/files/attachments','secure','sendMail','List\x20not\x20found','List','out','Interaction','Messages','verifySmtp','CloudProvider','auth','OAuth2','data5','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','client','request','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','update','then','destroy','get','MailAccounts','UserProfileResource','end','stack','name','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','find','body','Imap','modernAuthentication','CloudProviderId','describe','Disposition','create','getDispositions','findOne','hasOwnProperty','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','order','removeAnswers','provider','custom','email','ListId','isNil','active','user','username','password','pass','service','host','port','authentication','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','send','getApplications','getMessages','MailMessage'];(function(_0x141c4e,_0x5e86f0){var _0x43073a=function(_0x277b2b){while(--_0x277b2b){_0x141c4e['push'](_0x141c4e['shift']());}};_0x43073a(++_0x5e86f0);}(_0xa571,0xdd));var _0x1a57=function(_0x577935,_0x56535d){_0x577935=_0x577935-0x0;var _0x455214=_0xa571[_0x577935];return _0x455214;};'use strict';var moment=require(_0x1a57('0x0'));var BPromise=require(_0x1a57('0x1'));var util=require(_0x1a57('0x2'));var path=require(_0x1a57('0x3'));var _=require(_0x1a57('0x4'));var juice=require(_0x1a57('0x5'));var Redis=require(_0x1a57('0x6'));var qs=require(_0x1a57('0x7'));var logger=require(_0x1a57('0x8'))(_0x1a57('0x9'));var config=require(_0x1a57('0xa'));var db=require(_0x1a57('0xb'))['db'];config[_0x1a57('0xc')]=_[_0x1a57('0xd')](config[_0x1a57('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x1a57('0xe'))(new Redis(config[_0x1a57('0xc')]));require(_0x1a57('0xf'))[_0x1a57('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1a57('0x11')]['http']({'port':0x232b});function respondWithRpcPromise(_0x450cc6,_0x1fac9a,_0x582bc6,_0x527436){return new BPromise(function(_0x45513b,_0x2b26d3){var _0x236a73=_0x527436||client;return _0x236a73[_0x1a57('0x12')](_0x450cc6,_0x582bc6)['then'](function(_0x22f4cf){logger[_0x1a57('0x13')](_0x1a57('0x14'),_0x1fac9a,'request\x20sent');logger[_0x1a57('0x15')](_0x1a57('0x16'),_0x1fac9a,_0x1a57('0x17'),JSON[_0x1a57('0x18')](_0x22f4cf));if(_0x22f4cf[_0x1a57('0x19')]){if(_0x22f4cf[_0x1a57('0x19')]['code']===0x1f4){logger[_0x1a57('0x19')](_0x1a57('0x14'),_0x1fac9a,_0x22f4cf[_0x1a57('0x19')]['message']);return _0x2b26d3(_0x22f4cf['error'][_0x1a57('0x1a')]);}logger[_0x1a57('0x19')](_0x1a57('0x14'),_0x1fac9a,_0x22f4cf[_0x1a57('0x19')]['message']);return _0x45513b(_0x22f4cf['error']['message']);}else{logger[_0x1a57('0x13')](_0x1a57('0x14'),_0x1fac9a,_0x1a57('0x17'));_0x45513b(_0x22f4cf[_0x1a57('0x1b')][_0x1a57('0x1a')]);}})[_0x1a57('0x1c')](function(_0x2f2cfd){logger['error']('MailAccount,\x20%s,\x20%s',_0x1fac9a,_0x2f2cfd);_0x2b26d3(_0x2f2cfd);});});}function respondWithStatusCode(_0x3ed0c2,_0x3bb6da){_0x3bb6da=_0x3bb6da||0xcc;return function(_0x2672f5){if(_0x2672f5){return _0x3ed0c2[_0x1a57('0x1d')](_0x3bb6da);}return _0x3ed0c2['status'](_0x3bb6da)['end']();};}function respondWithResult(_0xc36195,_0x49b788){_0x49b788=_0x49b788||0xc8;return function(_0x2da39d){if(_0x2da39d){return _0xc36195['status'](_0x49b788)['json'](_0x2da39d);}};}function respondWithFilteredResult(_0x1bb9f9,_0x3f5434){return function(_0x226384){if(_0x226384){var _0x5985bb=typeof _0x3f5434[_0x1a57('0x1e')]===_0x1a57('0x1f')&&typeof _0x3f5434[_0x1a57('0x20')]===_0x1a57('0x1f');var _0x387cfc=_0x226384[_0x1a57('0x21')];var _0x52f712=_0x5985bb?0x0:_0x3f5434[_0x1a57('0x1e')];var _0x53d477=_0x5985bb?_0x226384[_0x1a57('0x21')]:_0x3f5434[_0x1a57('0x1e')]+_0x3f5434['limit'];var _0x44e0e0;if(_0x53d477>=_0x387cfc){_0x53d477=_0x387cfc;_0x44e0e0=0xc8;}else{_0x44e0e0=0xce;}_0x1bb9f9[_0x1a57('0x22')](_0x44e0e0);return _0x1bb9f9[_0x1a57('0x23')](_0x1a57('0x24'),_0x52f712+'-'+_0x53d477+'/'+_0x387cfc)[_0x1a57('0x25')](_0x226384);}return null;};}function saveUpdates(_0x4808d8){return function(_0x30f9ce){if(_0x30f9ce){return _0x30f9ce[_0x1a57('0x26')](_0x4808d8)[_0x1a57('0x27')](function(_0x139cce){return _0x139cce;});}return null;};}function removeEntity(_0xe73d54){return function(_0x45e082){if(_0x45e082){return _0x45e082[_0x1a57('0x28')]()[_0x1a57('0x27')](function(){var _0x3b4078=_0x45e082[_0x1a57('0x29')]({'plain':!![]});var _0x3f8ee7=_0x1a57('0x2a');return db[_0x1a57('0x2b')][_0x1a57('0x28')]({'where':{'type':_0x3f8ee7,'resourceId':_0x3b4078['id']}})[_0x1a57('0x27')](function(){return _0x45e082;});})['then'](function(){_0xe73d54[_0x1a57('0x22')](0xcc)[_0x1a57('0x2c')]();});}};}function handleEntityNotFound(_0x1c7b32){return function(_0x9e3592){if(!_0x9e3592){_0x1c7b32[_0x1a57('0x1d')](0x194);}return _0x9e3592;};}function handleError(_0x1c40b9,_0x4cf686){_0x4cf686=_0x4cf686||0x1f4;return function(_0x3daebb){logger[_0x1a57('0x19')](_0x3daebb[_0x1a57('0x2d')]);if(_0x3daebb['name']){delete _0x3daebb[_0x1a57('0x2e')];}_0x1c40b9[_0x1a57('0x22')](_0x4cf686)['send'](_0x3daebb);};}exports[_0x1a57('0x2f')]=function(_0x1c5d62,_0xa5b76b){var _0x1c5638={'include':[{'model':db[_0x1a57('0x30')],'as':'Imap'},{'model':db[_0x1a57('0x31')],'as':_0x1a57('0x32')},{'model':db[_0x1a57('0x33')],'as':_0x1a57('0x34')}]},_0x4b268b={},_0x453fb8={'count':0x0,'rows':[]};var _0x176080=_[_0x1a57('0x35')](db[_0x1a57('0x36')][_0x1a57('0x37')],function(_0xccf189){return{'name':_0xccf189[_0x1a57('0x38')],'type':_0xccf189[_0x1a57('0x39')][_0x1a57('0x3a')]};});_0x4b268b[_0x1a57('0x3b')]=_[_0x1a57('0x35')](_0x176080,_0x1a57('0x2e'));_0x4b268b[_0x1a57('0x3c')]=_[_0x1a57('0x3d')](_0x1c5d62[_0x1a57('0x3c')]);_0x4b268b[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x4b268b['model'],_0x4b268b[_0x1a57('0x3c')]);_0x1c5638[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x4b268b[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x1c5d62[_0x1a57('0x3c')]['fields']));_0x1c5638[_0x1a57('0x40')]=_0x1c5638[_0x1a57('0x40')][_0x1a57('0x42')]?_0x1c5638[_0x1a57('0x40')]:_0x4b268b[_0x1a57('0x3b')];if(!_0x1c5d62[_0x1a57('0x3c')]['hasOwnProperty'](_0x1a57('0x43'))){_0x1c5638[_0x1a57('0x20')]=qs[_0x1a57('0x20')](_0x1c5d62[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x1c5638['offset']=qs[_0x1a57('0x1e')](_0x1c5d62[_0x1a57('0x3c')][_0x1a57('0x1e')]);}_0x1c5638['order']=qs[_0x1a57('0x44')](_0x1c5d62[_0x1a57('0x3c')][_0x1a57('0x44')]);_0x1c5638[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x1c5d62[_0x1a57('0x3c')],_0x4b268b[_0x1a57('0x3e')]),_0x176080);if(_0x1c5d62[_0x1a57('0x3c')]['filter']){_0x1c5638[_0x1a57('0x45')]=_[_0x1a57('0x47')](_0x1c5638[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x176080,function(_0x5aa61b){if(_0x5aa61b['type']!==_0x1a57('0x48')){var _0x4bace5={};_0x4bace5[_0x5aa61b['name']]={'$like':'%'+_0x1c5d62[_0x1a57('0x3c')][_0x1a57('0x49')]+'%'};return _0x4bace5;}})});}_0x1c5638=_[_0x1a57('0x47')]({},_0x1c5638,_0x1c5d62[_0x1a57('0x4a')]);var _0x415d91={'where':_0x1c5638[_0x1a57('0x45')]};return db[_0x1a57('0x36')][_0x1a57('0x21')](_0x415d91)[_0x1a57('0x27')](function(_0x156cc5){_0x453fb8['count']=_0x156cc5;if(_0x1c5d62[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x1c5638[_0x1a57('0x4c')]=[{'all':!![]}];}return db[_0x1a57('0x36')][_0x1a57('0x4d')](_0x1c5638);})[_0x1a57('0x27')](function(_0x4e3148){_0x453fb8['rows']=_0x4e3148;return _0x453fb8;})[_0x1a57('0x27')](respondWithFilteredResult(_0xa5b76b,_0x1c5638))['catch'](handleError(_0xa5b76b,null));};exports[_0x1a57('0x4e')]=function(_0x39a73d,_0x5ce9ad){var _0x290859={'raw':![],'where':{'id':_0x39a73d[_0x1a57('0x4f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x1a57('0x31')],'as':_0x1a57('0x32')},{'model':db[_0x1a57('0x33')],'as':_0x1a57('0x34')}]},_0x5cb3ea={};_0x5cb3ea[_0x1a57('0x3b')]=_['keys'](db[_0x1a57('0x36')][_0x1a57('0x37')]);_0x5cb3ea[_0x1a57('0x3c')]=_['keys'](_0x39a73d[_0x1a57('0x3c')]);_0x5cb3ea[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x5cb3ea[_0x1a57('0x3b')],_0x5cb3ea['query']);_0x290859[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x5cb3ea['model'],qs['fields'](_0x39a73d[_0x1a57('0x3c')][_0x1a57('0x41')]));_0x290859['attributes']=_0x290859[_0x1a57('0x40')][_0x1a57('0x42')]?_0x290859[_0x1a57('0x40')]:_0x5cb3ea['model'];if(_0x39a73d[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x290859[_0x1a57('0x4c')]=[{'all':!![]}];}_0x290859=_[_0x1a57('0x47')]({},_0x290859,_0x39a73d[_0x1a57('0x4a')]);return db['MailAccount'][_0x1a57('0x50')](_0x290859)[_0x1a57('0x27')](handleEntityNotFound(_0x5ce9ad,null))[_0x1a57('0x27')](respondWithResult(_0x5ce9ad,null))['catch'](handleError(_0x5ce9ad,null));};exports[_0x1a57('0x26')]=function(_0x424839,_0x81cdb7){if(_0x424839[_0x1a57('0x51')]['id']){delete _0x424839['body']['id'];}if(_0x424839['body']['Imap']){if(!_0x424839[_0x1a57('0x51')][_0x1a57('0x52')][_0x1a57('0x53')]){_0x424839[_0x1a57('0x51')][_0x1a57('0x52')][_0x1a57('0x54')]=null;}}if(_0x424839[_0x1a57('0x51')][_0x1a57('0x32')]){if(!_0x424839['body'][_0x1a57('0x32')][_0x1a57('0x53')]){_0x424839['body'][_0x1a57('0x32')]['CloudProviderId']=null;}}return db[_0x1a57('0x36')]['find']({'where':{'id':_0x424839['params']['id']},'include':[{'model':db[_0x1a57('0x30')],'as':_0x1a57('0x52')},{'model':db['MailServerOut'],'as':_0x1a57('0x32')},{'model':db[_0x1a57('0x33')],'as':_0x1a57('0x34')}]})[_0x1a57('0x27')](handleEntityNotFound(_0x81cdb7,null))[_0x1a57('0x27')](saveUpdates(_0x424839[_0x1a57('0x51')],null))[_0x1a57('0x27')](function(_0x370e13){if(_0x370e13&&_0x424839[_0x1a57('0x51')][_0x1a57('0x52')]){return db['MailServerIn'][_0x1a57('0x26')](_0x424839[_0x1a57('0x51')][_0x1a57('0x52')],{'where':{'MailAccountId':_0x370e13['id']}})[_0x1a57('0x27')](function(){return _0x370e13;});}return _0x370e13;})['then'](function(_0x216213){if(_0x216213&&_0x424839[_0x1a57('0x51')][_0x1a57('0x32')]){return db[_0x1a57('0x31')][_0x1a57('0x26')](_0x424839[_0x1a57('0x51')]['Smtp'],{'where':{'MailAccountId':_0x216213['id']}})[_0x1a57('0x27')](function(){return _0x216213;});}return _0x216213;})['then'](respondWithResult(_0x81cdb7,null))[_0x1a57('0x1c')](handleError(_0x81cdb7,null));};exports['describe']=function(_0x249f6a,_0x261e5b){return db[_0x1a57('0x36')][_0x1a57('0x55')]()[_0x1a57('0x27')](respondWithResult(_0x261e5b,null))[_0x1a57('0x1c')](handleError(_0x261e5b,null));};exports['addDisposition']=function(_0x1f9e6e,_0x154e26){if(_0x1f9e6e[_0x1a57('0x51')]['id']){delete _0x1f9e6e[_0x1a57('0x51')]['id'];}return db['MailAccount'][_0x1a57('0x50')]({'where':{'id':_0x1f9e6e[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x154e26,null))[_0x1a57('0x27')](function(_0x4e736d){if(_0x4e736d){_0x1f9e6e[_0x1a57('0x51')]['MailAccountId']=_0x4e736d['id'];return db[_0x1a57('0x56')][_0x1a57('0x57')](_0x1f9e6e[_0x1a57('0x51')]);}})[_0x1a57('0x27')](respondWithResult(_0x154e26,null))[_0x1a57('0x1c')](handleError(_0x154e26,null));};exports[_0x1a57('0x58')]=function(_0x516037,_0x3b1b4f){var _0x15d86b={'raw':![],'where':{}};var _0x59b22d={};var _0x297eb0={'count':0x0,'rows':[]};return db['MailAccount'][_0x1a57('0x59')]({'where':{'id':_0x516037[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x3b1b4f,null))[_0x1a57('0x27')](function(_0x7c8a4f){if(_0x7c8a4f){_0x59b22d[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db[_0x1a57('0x56')]['rawAttributes']);_0x59b22d[_0x1a57('0x3c')]=_[_0x1a57('0x3d')](_0x516037[_0x1a57('0x3c')]);_0x59b22d[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x59b22d['model'],_0x59b22d[_0x1a57('0x3c')]);_0x15d86b[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x59b22d[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x516037[_0x1a57('0x3c')]['fields']));_0x15d86b[_0x1a57('0x40')]=_0x15d86b['attributes'][_0x1a57('0x42')]?_0x15d86b[_0x1a57('0x40')]:_0x59b22d['model'];if(!_0x516037['query'][_0x1a57('0x5a')](_0x1a57('0x43'))){_0x15d86b[_0x1a57('0x20')]=qs[_0x1a57('0x20')](_0x516037[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x15d86b[_0x1a57('0x1e')]=qs['offset'](_0x516037[_0x1a57('0x3c')][_0x1a57('0x1e')]);}_0x15d86b['order']=qs[_0x1a57('0x44')](_0x516037['query'][_0x1a57('0x44')]);_0x15d86b[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x516037[_0x1a57('0x3c')],_0x59b22d[_0x1a57('0x3e')]));_0x15d86b[_0x1a57('0x45')][_0x1a57('0x5b')]=_0x7c8a4f['id'];if(_0x516037[_0x1a57('0x3c')]['filter']){_0x15d86b['where']=_[_0x1a57('0x47')](_0x15d86b[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x15d86b[_0x1a57('0x40')],function(_0x3d0953){var _0x5877de={};_0x5877de[_0x3d0953]={'$like':'%'+_0x516037[_0x1a57('0x3c')][_0x1a57('0x49')]+'%'};return _0x5877de;})});}_0x15d86b=_[_0x1a57('0x47')]({},_0x15d86b,_0x516037[_0x1a57('0x4a')]);return db[_0x1a57('0x56')][_0x1a57('0x21')]({'where':_0x15d86b[_0x1a57('0x45')]})[_0x1a57('0x27')](function(_0x5b37ab){_0x297eb0[_0x1a57('0x21')]=_0x5b37ab;if(_0x516037[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x15d86b[_0x1a57('0x4c')]=[{'all':!![]}];}return db[_0x1a57('0x56')][_0x1a57('0x4d')](_0x15d86b);})[_0x1a57('0x27')](function(_0x2d4a7d){_0x297eb0[_0x1a57('0x5c')]=_0x2d4a7d;return _0x297eb0;});}})[_0x1a57('0x27')](respondWithFilteredResult(_0x3b1b4f,_0x15d86b))[_0x1a57('0x1c')](handleError(_0x3b1b4f,null));};exports[_0x1a57('0x5d')]=function(_0x8b0a5a,_0x2dcd8a){return db[_0x1a57('0x36')]['find']({'where':{'id':_0x8b0a5a['params']['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x2dcd8a,null))[_0x1a57('0x27')](function(_0x21d4d2){if(_0x21d4d2){return _0x21d4d2['removeDispositions'](_0x8b0a5a[_0x1a57('0x3c')][_0x1a57('0x5e')]);}})[_0x1a57('0x27')](respondWithStatusCode(_0x2dcd8a,null))[_0x1a57('0x1c')](handleError(_0x2dcd8a,null));};exports[_0x1a57('0x5f')]=function(_0x4e6aeb,_0x15c380){if(_0x4e6aeb[_0x1a57('0x51')]['id']){delete _0x4e6aeb[_0x1a57('0x51')]['id'];}return db[_0x1a57('0x36')]['find']({'where':{'id':_0x4e6aeb['params']['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x15c380,null))['then'](function(_0x1246e2){if(_0x1246e2){_0x4e6aeb[_0x1a57('0x51')][_0x1a57('0x5b')]=_0x1246e2['id'];return db[_0x1a57('0x60')][_0x1a57('0x57')](_0x4e6aeb[_0x1a57('0x51')]);}})[_0x1a57('0x27')](respondWithResult(_0x15c380,null))[_0x1a57('0x1c')](handleError(_0x15c380,null));};exports['getAnswers']=function(_0x3ca9d2,_0x20ca6f){var _0x21d086={'raw':![],'where':{}};var _0x3ce7b5={};var _0x36aa94={'count':0x0,'rows':[]};return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x3ca9d2[_0x1a57('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20ca6f,null))[_0x1a57('0x27')](function(_0x51baca){if(_0x51baca){_0x3ce7b5[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db['CannedAnswer'][_0x1a57('0x37')]);_0x3ce7b5[_0x1a57('0x3c')]=_['keys'](_0x3ca9d2['query']);_0x3ce7b5[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x3ce7b5[_0x1a57('0x3b')],_0x3ce7b5['query']);_0x21d086[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x3ce7b5[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x3ca9d2[_0x1a57('0x3c')][_0x1a57('0x41')]));_0x21d086[_0x1a57('0x40')]=_0x21d086[_0x1a57('0x40')][_0x1a57('0x42')]?_0x21d086['attributes']:_0x3ce7b5[_0x1a57('0x3b')];if(!_0x3ca9d2['query'][_0x1a57('0x5a')](_0x1a57('0x43'))){_0x21d086[_0x1a57('0x20')]=qs[_0x1a57('0x20')](_0x3ca9d2['query'][_0x1a57('0x20')]);_0x21d086[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x3ca9d2[_0x1a57('0x3c')][_0x1a57('0x1e')]);}_0x21d086[_0x1a57('0x61')]=qs[_0x1a57('0x44')](_0x3ca9d2[_0x1a57('0x3c')][_0x1a57('0x44')]);_0x21d086[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_['pick'](_0x3ca9d2[_0x1a57('0x3c')],_0x3ce7b5[_0x1a57('0x3e')]));_0x21d086['where']['MailAccountId']=_0x51baca['id'];if(_0x3ca9d2[_0x1a57('0x3c')]['filter']){_0x21d086[_0x1a57('0x45')]=_['merge'](_0x21d086[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x21d086[_0x1a57('0x40')],function(_0x5a643e){var _0x5f4faf={};_0x5f4faf[_0x5a643e]={'$like':'%'+_0x3ca9d2[_0x1a57('0x3c')]['filter']+'%'};return _0x5f4faf;})});}_0x21d086=_['merge']({},_0x21d086,_0x3ca9d2[_0x1a57('0x4a')]);return db['CannedAnswer'][_0x1a57('0x21')]({'where':_0x21d086[_0x1a57('0x45')]})['then'](function(_0x4dcc65){_0x36aa94[_0x1a57('0x21')]=_0x4dcc65;if(_0x3ca9d2[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x21d086[_0x1a57('0x4c')]=[{'all':!![]}];}return db[_0x1a57('0x60')]['findAll'](_0x21d086);})['then'](function(_0x23b6d8){_0x36aa94[_0x1a57('0x5c')]=_0x23b6d8;return _0x36aa94;});}})['then'](respondWithFilteredResult(_0x20ca6f,_0x21d086))['catch'](handleError(_0x20ca6f,null));};exports['removeAnswers']=function(_0x44cc22,_0x3d4e5a){return db['MailAccount'][_0x1a57('0x50')]({'where':{'id':_0x44cc22[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x3d4e5a,null))[_0x1a57('0x27')](function(_0x189cb2){if(_0x189cb2){return _0x189cb2[_0x1a57('0x62')](_0x44cc22[_0x1a57('0x3c')][_0x1a57('0x5e')]);}})[_0x1a57('0x27')](respondWithStatusCode(_0x3d4e5a,null))[_0x1a57('0x1c')](handleError(_0x3d4e5a,null));};exports[_0x1a57('0x57')]=function(_0x474555,_0x2d03b0){var _0x30947c={'name':_0x474555[_0x1a57('0x51')]['name'],'key':_0x474555['body'][_0x1a57('0x3a')],'provider':_0x474555[_0x1a57('0x51')][_0x1a57('0x63')]===_0x1a57('0x64')?null:_0x474555['body']['provider'],'email':_0x474555['body'][_0x1a57('0x65')],'ListId':_0x474555[_0x1a57('0x51')][_0x1a57('0x66')],'active':!_[_0x1a57('0x67')](_0x474555[_0x1a57('0x51')][_0x1a57('0x68')])?_0x474555[_0x1a57('0x51')]['active']:!![],'description':_0x474555[_0x1a57('0x51')]['description']||null,'Imap':{},'Smtp':{}};if(_0x30947c['provider']){_0x30947c[_0x1a57('0x52')][_0x1a57('0x69')]=_0x30947c['Smtp'][_0x1a57('0x69')]=_0x474555[_0x1a57('0x51')][_0x1a57('0x6a')];_0x30947c[_0x1a57('0x52')][_0x1a57('0x6b')]=_0x30947c['Smtp'][_0x1a57('0x6c')]=_0x474555[_0x1a57('0x51')]['password'];if(_0x474555[_0x1a57('0x51')][_0x1a57('0x53')]){_0x30947c[_0x1a57('0x52')][_0x1a57('0x53')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x53')]=!![];_0x30947c[_0x1a57('0x52')][_0x1a57('0x54')]=_0x30947c[_0x1a57('0x32')]['CloudProviderId']=_0x474555[_0x1a57('0x51')][_0x1a57('0x54')];_0x30947c[_0x1a57('0x52')][_0x1a57('0x6b')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x6c')]=null;}else{_0x30947c[_0x1a57('0x52')][_0x1a57('0x54')]=_0x30947c[_0x1a57('0x32')]['CloudProviderId']=null;}_0x30947c[_0x1a57('0x52')][_0x1a57('0x6d')]=_0x30947c['Smtp']['service']=null;_0x30947c['Imap'][_0x1a57('0x6e')]=_0x30947c['Smtp'][_0x1a57('0x6e')]=null;_0x30947c[_0x1a57('0x52')][_0x1a57('0x6f')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x6f')]=null;}else{if(_0x474555[_0x1a57('0x51')][_0x1a57('0x70')]){_0x30947c[_0x1a57('0x52')][_0x1a57('0x69')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x69')]=_0x474555[_0x1a57('0x51')]['username'];_0x30947c[_0x1a57('0x52')][_0x1a57('0x6b')]=_0x30947c['Smtp'][_0x1a57('0x6c')]=_0x474555[_0x1a57('0x51')][_0x1a57('0x6b')];}else{_0x30947c['Imap'][_0x1a57('0x70')]=_0x30947c['Smtp'][_0x1a57('0x70')]=![];_0x30947c[_0x1a57('0x52')][_0x1a57('0x69')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x69')]=null;_0x30947c['Imap'][_0x1a57('0x6b')]=_0x30947c[_0x1a57('0x32')][_0x1a57('0x6c')]=null;}_0x30947c[_0x1a57('0x52')][_0x1a57('0x6e')]=_0x474555[_0x1a57('0x51')]['Imap'][_0x1a57('0x6e')];_0x30947c['Imap'][_0x1a57('0x6f')]=_0x474555['body'][_0x1a57('0x52')]['port'];_0x30947c['Smtp'][_0x1a57('0x6e')]=_0x474555[_0x1a57('0x51')]['Smtp'][_0x1a57('0x6e')];_0x30947c[_0x1a57('0x32')][_0x1a57('0x6f')]=_0x474555[_0x1a57('0x51')][_0x1a57('0x32')][_0x1a57('0x6f')];}return db[_0x1a57('0x36')][_0x1a57('0x57')](_0x30947c,{'include':[{'model':db[_0x1a57('0x31')],'as':'Smtp'},{'model':db[_0x1a57('0x30')],'as':_0x1a57('0x52')}]})['then'](function(_0x47abc8){var _0x494142=_0x474555['user'][_0x1a57('0x29')]({'plain':!![]});if(!_0x494142)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x494142[_0x1a57('0x71')]===_0x1a57('0x69')){var _0x15efee=_0x47abc8['get']({'plain':!![]});return db['UserProfileSection'][_0x1a57('0x50')]({'where':{'name':_0x1a57('0x2a'),'userProfileId':_0x494142[_0x1a57('0x72')]},'raw':!![]})[_0x1a57('0x27')](function(_0x18592c){if(_0x18592c&&_0x18592c[_0x1a57('0x73')]===0x0){return db['UserProfileResource'][_0x1a57('0x57')]({'name':_0x15efee['name'],'resourceId':_0x15efee['id'],'type':_0x18592c[_0x1a57('0x2e')],'sectionId':_0x18592c['id']},{})[_0x1a57('0x27')](function(){return _0x47abc8;});}else{return _0x47abc8;}})[_0x1a57('0x1c')](function(_0x290ac8){logger['error'](_0x1a57('0x74'),_0x290ac8);throw _0x290ac8;});}return _0x47abc8;})[_0x1a57('0x27')](respondWithResult(_0x2d03b0,0xc9))[_0x1a57('0x1c')](handleError(_0x2d03b0,null));};exports[_0x1a57('0x75')]=function(_0x5306af,_0x38dede){return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x5306af[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x38dede,null))[_0x1a57('0x27')](function(_0x22fecf){if(_0x22fecf){return _0x22fecf[_0x1a57('0x75')]();}return null;})[_0x1a57('0x27')](respondWithResult(_0x38dede,null))[_0x1a57('0x1c')](handleError(_0x38dede,null));};exports[_0x1a57('0x76')]=function(_0xd64ad3,_0x9b2356){if(_0xd64ad3[_0x1a57('0x51')]['id']){delete _0xd64ad3[_0x1a57('0x51')]['id'];}return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0xd64ad3['params']['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x9b2356,null))[_0x1a57('0x27')](function(_0x50e237){if(_0x50e237){_0xd64ad3[_0x1a57('0x51')][_0x1a57('0x5b')]=_0x50e237['id'];return db[_0x1a57('0x30')]['create'](_0xd64ad3[_0x1a57('0x51')]);}})[_0x1a57('0x27')](respondWithResult(_0x9b2356,null))[_0x1a57('0x1c')](handleError(_0x9b2356,null));};exports[_0x1a57('0x77')]=function(_0x1ebd52,_0x40819f){return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x1ebd52[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x40819f,null))[_0x1a57('0x27')](function(_0x26746e){if(_0x26746e){return _0x26746e[_0x1a57('0x78')](null);}return null;})['then'](respondWithStatusCode(_0x40819f,null))[_0x1a57('0x1c')](handleError(_0x40819f,null));};exports[_0x1a57('0x79')]=function(_0x35e820,_0x16292a){return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x35e820[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x16292a,null))['then'](function(_0x305b3a){if(_0x305b3a){return _0x305b3a['getSmtp']();}return null;})[_0x1a57('0x27')](respondWithResult(_0x16292a,null))[_0x1a57('0x1c')](handleError(_0x16292a,null));};exports[_0x1a57('0x7a')]=function(_0x44b713,_0x1a74c1){if(_0x44b713[_0x1a57('0x51')]['id']){delete _0x44b713['body']['id'];}return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0x44b713[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x1a74c1,null))['then'](function(_0x2d4922){if(_0x2d4922){_0x44b713['body'][_0x1a57('0x5b')]=_0x2d4922['id'];return db[_0x1a57('0x31')][_0x1a57('0x57')](_0x44b713['body']);}})[_0x1a57('0x27')](respondWithResult(_0x1a74c1,null))['catch'](handleError(_0x1a74c1,null));};exports[_0x1a57('0x7b')]=function(_0x1cc001,_0x28a7e8){return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x1cc001[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x28a7e8,null))[_0x1a57('0x27')](function(_0x5a06a8){if(_0x5a06a8){return _0x5a06a8['setSmtp'](null);}return null;})[_0x1a57('0x27')](respondWithStatusCode(_0x28a7e8,null))[_0x1a57('0x1c')](handleError(_0x28a7e8,null));};exports[_0x1a57('0x7c')]=function(_0x4f98a6,_0x4320b6){return db[_0x1a57('0x7d')][_0x1a57('0x50')]({'where':{'id':_0x4f98a6['params']['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x4320b6,null))[_0x1a57('0x27')](function(_0x278f6c){if(_0x278f6c){return _0x278f6c['addInteraction'](_0x4f98a6[_0x1a57('0x51')]['ids'],_[_0x1a57('0x7e')](_0x4f98a6[_0x1a57('0x51')],[_0x1a57('0x5e'),'id'])||{});}})['then'](respondWithResult(_0x4320b6,null))[_0x1a57('0x1c')](handleError(_0x4320b6,null));};exports[_0x1a57('0x7f')]=function(_0x1641d9,_0x1ad909){var _0x6a49ec={'raw':![],'where':{}};var _0xc8fd19={};var _0x2fdf66={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x1641d9[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x1ad909,null))[_0x1a57('0x27')](function(_0x15093f){if(_0x15093f){_0xc8fd19[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db[_0x1a57('0x7d')][_0x1a57('0x37')]);_0xc8fd19['query']=_[_0x1a57('0x3d')](_0x1641d9[_0x1a57('0x3c')]);_0xc8fd19[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0xc8fd19[_0x1a57('0x3b')],_0xc8fd19['query']);_0x6a49ec[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0xc8fd19[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x1641d9[_0x1a57('0x3c')][_0x1a57('0x41')]));_0x6a49ec['attributes']=_0x6a49ec[_0x1a57('0x40')][_0x1a57('0x42')]?_0x6a49ec[_0x1a57('0x40')]:_0xc8fd19[_0x1a57('0x3b')];if(!_0x1641d9['query'][_0x1a57('0x5a')](_0x1a57('0x43'))){_0x6a49ec[_0x1a57('0x20')]=qs['limit'](_0x1641d9[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x6a49ec[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x1641d9[_0x1a57('0x3c')][_0x1a57('0x1e')]);}_0x6a49ec[_0x1a57('0x61')]=qs[_0x1a57('0x44')](_0x1641d9[_0x1a57('0x3c')][_0x1a57('0x44')]);_0x6a49ec[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x1641d9[_0x1a57('0x3c')],_0xc8fd19[_0x1a57('0x3e')]));_0x6a49ec[_0x1a57('0x45')][_0x1a57('0x5b')]=_0x15093f['id'];if(_0x1641d9['query'][_0x1a57('0x49')]){_0x6a49ec[_0x1a57('0x45')]=_[_0x1a57('0x47')](_0x6a49ec['where'],{'$or':_[_0x1a57('0x35')](_0x6a49ec[_0x1a57('0x40')],function(_0x54faf6){var _0x5c02fd={};_0x5c02fd[_0x54faf6]={'$like':'%'+_0x1641d9['query'][_0x1a57('0x49')]+'%'};return _0x5c02fd;})});}_0x6a49ec=_[_0x1a57('0x47')]({},_0x6a49ec,_0x1641d9['options']);return db[_0x1a57('0x7d')][_0x1a57('0x21')]({'where':_0x6a49ec[_0x1a57('0x45')]})[_0x1a57('0x27')](function(_0x3fd011){_0x2fdf66[_0x1a57('0x21')]=_0x3fd011;if(_0x1641d9[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x6a49ec['include']=[{'model':db[_0x1a57('0x80')],'as':_0x1a57('0x81'),'required':![]},{'model':db[_0x1a57('0x82')],'as':'Owner','attributes':[_0x1a57('0x2e'),_0x1a57('0x83'),_0x1a57('0x84')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x1a57('0x2e'),_0x1a57('0x85')],'where':_0x1641d9['query'][_0x1a57('0x86')]?{'id':_0x1641d9['query'][_0x1a57('0x86')]}:undefined,'required':_0x1641d9[_0x1a57('0x3c')]['tag']?!![]:![]}];}return db[_0x1a57('0x7d')]['findAll'](_0x6a49ec);})[_0x1a57('0x27')](function(_0x36fc16){_0x2fdf66[_0x1a57('0x5c')]=_0x36fc16;return _0x2fdf66;});}})[_0x1a57('0x27')](respondWithFilteredResult(_0x1ad909,_0x6a49ec))['catch'](handleError(_0x1ad909,null));};exports[_0x1a57('0x87')]=function addApplications(_0xa4d852,_0x377f19){var _0x4270c2=_0xa4d852['params']['id'];var _0x140efb=_0xa4d852[_0x1a57('0x51')];var _0x47bea9=0xc8;var _0x3c1728=null;return db[_0x1a57('0x88')][_0x1a57('0x89')]({'isolationLevel':db['sequelize'][_0x1a57('0x8a')][_0x1a57('0x8b')][_0x1a57('0x8c')]},function(_0xf30061){return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x4270c2},'transaction':_0xf30061})['then'](function(_0xa3ad5c){if(_0xa3ad5c){return db['MailApplication'][_0x1a57('0x28')]({'where':{'MailAccountId':_0x4270c2},'transaction':_0xf30061})['then'](function(){var _0x974c29=_[_0x1a57('0x35')](_0x140efb,function(_0x221d5d){_0x221d5d['MailAccountId']=_0x4270c2;return _0x221d5d;});return db[_0x1a57('0x8d')][_0x1a57('0x8e')](_0x974c29,{'transaction':_0xf30061});});}else{_0x47bea9=0x194;_0x3c1728=[];}});})[_0x1a57('0x27')](function(){if(_0x47bea9!==0x194){return db[_0x1a57('0x8d')][_0x1a57('0x8f')]({'where':{'MailAccountId':_0x4270c2},'order':_0x1a57('0x90')})[_0x1a57('0x27')](function(_0x549ce8){_0x3c1728=_0x549ce8;});}})[_0x1a57('0x1c')](function(_0x356491){_0x47bea9=0x1f4;logger[_0x1a57('0x19')](_0x356491[_0x1a57('0x2d')]);if(_0x356491[_0x1a57('0x2e')]){delete _0x356491[_0x1a57('0x2e')];}_0x3c1728=_0x356491;})['finally'](function(){if(_0x3c1728===null){_0x377f19[_0x1a57('0x1d')](_0x47bea9);}else{if(_0x47bea9===0x1f4){_0x377f19[_0x1a57('0x22')](_0x47bea9)[_0x1a57('0x91')](_0x3c1728);}else{_0x377f19[_0x1a57('0x22')](_0x47bea9)['json'](_0x3c1728);}}});};exports[_0x1a57('0x92')]=function(_0x51355b,_0x585b2c){var _0x1912ef={};var _0x120598={};var _0x15372d;var _0x258870;return db[_0x1a57('0x36')]['findOne']({'where':{'id':_0x51355b[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x585b2c,null))[_0x1a57('0x27')](function(_0x36aec4){if(_0x36aec4){_0x15372d=_0x36aec4;_0x120598[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db[_0x1a57('0x8d')][_0x1a57('0x37')]);_0x120598[_0x1a57('0x3c')]=_[_0x1a57('0x3d')](_0x51355b['query']);_0x120598[_0x1a57('0x3e')]=_[_0x1a57('0x3f')](_0x120598['model'],_0x120598[_0x1a57('0x3c')]);_0x1912ef[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x120598[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x51355b[_0x1a57('0x3c')]['fields']));_0x1912ef[_0x1a57('0x40')]=_0x1912ef['attributes'][_0x1a57('0x42')]?_0x1912ef[_0x1a57('0x40')]:_0x120598['model'];_0x1912ef[_0x1a57('0x61')]=qs[_0x1a57('0x44')](_0x51355b[_0x1a57('0x3c')]['sort']);_0x1912ef[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x51355b['query'],_0x120598['filters']));if(_0x51355b[_0x1a57('0x3c')][_0x1a57('0x49')]){_0x1912ef[_0x1a57('0x45')]=_[_0x1a57('0x47')](_0x1912ef[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x1912ef[_0x1a57('0x40')],function(_0x39d5e4){var _0x124b5a={};_0x124b5a[_0x39d5e4]={'$like':'%'+_0x51355b[_0x1a57('0x3c')][_0x1a57('0x49')]+'%'};return _0x124b5a;})});}_0x1912ef=_[_0x1a57('0x47')]({},_0x1912ef,_0x51355b['options']);return _0x15372d['getApplications'](_0x1912ef);}})[_0x1a57('0x27')](function(_0x14b234){if(_0x14b234){_0x258870=_0x14b234['length'];if(!_0x51355b[_0x1a57('0x3c')]['hasOwnProperty'](_0x1a57('0x43'))){_0x1912ef[_0x1a57('0x20')]=qs['limit'](_0x51355b[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x1912ef[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x51355b[_0x1a57('0x3c')][_0x1a57('0x1e')]);}return _0x15372d['getApplications'](_0x1912ef);}})['then'](function(_0x29dd32){if(_0x29dd32){return _0x29dd32?{'count':_0x258870,'rows':_0x29dd32}:null;}})['then'](respondWithResult(_0x585b2c,null))[_0x1a57('0x1c')](handleError(_0x585b2c,null));};exports[_0x1a57('0x93')]=function(_0x6a577f,_0x5ba182){var _0x32b9b3={'raw':!![],'where':{}};var _0x3a502c={};var _0x18fe56={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x6a577f[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x5ba182,null))[_0x1a57('0x27')](function(_0x45fd34){if(_0x45fd34){_0x3a502c[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db[_0x1a57('0x94')][_0x1a57('0x37')]);_0x3a502c[_0x1a57('0x3c')]=_[_0x1a57('0x3d')](_0x6a577f[_0x1a57('0x3c')]);_0x3a502c['filters']=_[_0x1a57('0x3f')](_0x3a502c[_0x1a57('0x3b')],_0x3a502c[_0x1a57('0x3c')]);_0x32b9b3[_0x1a57('0x40')]=_[_0x1a57('0x3f')](_0x3a502c[_0x1a57('0x3b')],qs['fields'](_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x41')]));_0x32b9b3[_0x1a57('0x40')]=_0x32b9b3[_0x1a57('0x40')]['length']?_0x32b9b3[_0x1a57('0x40')]:_0x3a502c[_0x1a57('0x3b')];if(!_0x6a577f['query'][_0x1a57('0x5a')](_0x1a57('0x43'))){_0x32b9b3[_0x1a57('0x20')]=qs[_0x1a57('0x20')](_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x32b9b3['offset']=qs[_0x1a57('0x1e')](_0x6a577f[_0x1a57('0x3c')]['offset']);}_0x32b9b3[_0x1a57('0x61')]=qs[_0x1a57('0x44')](_0x6a577f[_0x1a57('0x3c')]['sort']);_0x32b9b3[_0x1a57('0x45')]=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x6a577f[_0x1a57('0x3c')],_0x3a502c[_0x1a57('0x3e')]));_0x32b9b3[_0x1a57('0x45')][_0x1a57('0x5b')]=_0x45fd34['id'];if(_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x49')]){_0x32b9b3[_0x1a57('0x45')]=_[_0x1a57('0x47')](_0x32b9b3[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x32b9b3[_0x1a57('0x40')],function(_0x51e70b){var _0x1d06ca={};_0x1d06ca[_0x51e70b]={'$like':'%'+_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x49')]+'%'};return _0x1d06ca;})});}if(_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x95')]){var _0x1848a2=_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x95')][_0x1a57('0x96')](',');var _0x378635={};_0x378635[_0x1848a2[0x0]]={'$gte':moment(_0x1848a2[0x1])[_0x1a57('0x97')](_0x1a57('0x98'))};_0x32b9b3[_0x1a57('0x45')]=_['merge'](_0x32b9b3[_0x1a57('0x45')],_0x378635);}_0x32b9b3=_['merge']({},_0x32b9b3,_0x6a577f[_0x1a57('0x4a')]);return db[_0x1a57('0x94')][_0x1a57('0x21')]({'where':_0x32b9b3['where']})[_0x1a57('0x27')](function(_0x2ef686){_0x18fe56['count']=_0x2ef686;if(_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x4b')]){_0x32b9b3[_0x1a57('0x4c')]=[{'all':!![]}];}return db[_0x1a57('0x94')]['findAll'](_0x32b9b3);})[_0x1a57('0x27')](function(_0x46fb39){if(_0x6a577f[_0x1a57('0x3c')][_0x1a57('0x99')]===_0x1a57('0x9a')){for(var _0x49f697=0x0;_0x49f697<_0x46fb39[_0x1a57('0x42')];_0x49f697++){_0x46fb39[_0x49f697][_0x1a57('0x51')]=juice(_0x46fb39[_0x49f697][_0x1a57('0x51')]);}}_0x18fe56[_0x1a57('0x5c')]=_0x46fb39;return _0x18fe56;});}})[_0x1a57('0x27')](respondWithFilteredResult(_0x5ba182,_0x32b9b3))[_0x1a57('0x1c')](handleError(_0x5ba182,null));};exports[_0x1a57('0x91')]=function(_0x5e3cc2,_0x543358){var _0x279252,_0x1c4fbe={},_0xf22874;if(_0x5e3cc2[_0x1a57('0x51')]['to']){_0xf22874=_0x5e3cc2[_0x1a57('0x51')]['to']['split'](',')[0x0];}return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0x5e3cc2['params']['id']},'include':[{'model':db[_0x1a57('0x9b')],'as':'List','include':[{'model':db[_0x1a57('0x80')],'as':_0x1a57('0x9c'),'where':{'email':_0xf22874},'limit':0x1,'order':[[_0x1a57('0x9d'),'DESC']]}]},{'model':db[_0x1a57('0x31')],'as':_0x1a57('0x32'),'raw':!![]}]})[_0x1a57('0x27')](handleEntityNotFound(_0x543358,null))[_0x1a57('0x27')](function(_0x13945d){if(_0x13945d){_0x279252=_0x13945d;if(_0x13945d[_0x1a57('0x32')]){if(_[_0x1a57('0x67')](_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9e')])){_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9e')]=util['format']('%s\x20<%s>',_0x13945d[_0x1a57('0x2e')],_0x13945d[_0x1a57('0x65')]||_0x13945d['Smtp']['user']);}if(_0x5e3cc2['body'][_0x1a57('0x9f')]&&_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9f')][_0x1a57('0x42')]){for(var _0x395a07=0x0;_0x395a07<_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9f')][_0x1a57('0x42')];_0x395a07+=0x1){_0x5e3cc2[_0x1a57('0x51')]['attachments'][_0x395a07]={'filename':_0x5e3cc2[_0x1a57('0x51')]['attachments'][_0x395a07][_0x1a57('0x2e')],'path':path[_0x1a57('0xa0')](config['root'],_0x1a57('0xa1'),_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9f')][_0x395a07]['basename'])};}}var _0x216770={'tls':{'rejectUnauthorized':![]}};if(_[_0x1a57('0x67')](_0x13945d[_0x1a57('0x32')][_0x1a57('0x6d')])){if(_0x13945d[_0x1a57('0x32')][_0x1a57('0x70')]){_0x216770['auth']={'user':_0x13945d[_0x1a57('0x32')][_0x1a57('0x69')],'pass':_0x13945d['Smtp'][_0x1a57('0x6c')]};}_0x216770['host']=_0x13945d['Smtp'][_0x1a57('0x6e')];_0x216770[_0x1a57('0x6f')]=_0x13945d[_0x1a57('0x32')][_0x1a57('0x6f')];_0x216770[_0x1a57('0xa2')]=_0x13945d['Smtp']['secure'];}else{_0x216770[_0x1a57('0x6d')]=_0x13945d[_0x1a57('0x32')][_0x1a57('0x6d')];_0x216770['auth']={'user':_0x13945d[_0x1a57('0x32')][_0x1a57('0x69')],'pass':_0x13945d[_0x1a57('0x32')][_0x1a57('0x6c')]};}return respondWithRpcPromise('SendMail',_0x1a57('0xa3'),{'account':_0x216770,'message':_0x5e3cc2[_0x1a57('0x51')]});}else{throw new Error(_0x1a57('0xa4'));}}})[_0x1a57('0x27')](function(_0x15077c){if(_0x15077c){_0x1c4fbe=_0x15077c;if(_0x279252[_0x1a57('0xa5')]){if(_0x279252[_0x1a57('0xa5')][_0x1a57('0x9c')][_0x1a57('0x42')]){return _0x279252[_0x1a57('0xa5')][_0x1a57('0x9c')][0x0];}else{return db[_0x1a57('0x80')][_0x1a57('0x57')](_['defaults'](_0x5e3cc2[_0x1a57('0x51')],{'firstName':_0x5e3cc2[_0x1a57('0x51')]['to'],'email':_0x5e3cc2[_0x1a57('0x51')]['to'],'phone':_0x5e3cc2[_0x1a57('0x51')]['to'],'ListId':_0x279252[_0x1a57('0x66')]}));}}else{throw new Error(_0x1a57('0xa4'));}}})[_0x1a57('0x27')](function(_0x4870e1){if(_0x4870e1){var _0x207060={'UserId':_0x5e3cc2[_0x1a57('0x69')]['id'],'ContactId':_0x4870e1['id'],'MailAccountId':_0x279252['id'],'inReplyTo':_0x1c4fbe['messageId'],'to':_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0x9e')],'cc':_0x5e3cc2[_0x1a57('0x51')]['cc'],'subject':_0x5e3cc2[_0x1a57('0x51')]['subject'],'attach':_0x5e3cc2[_0x1a57('0x51')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x1a57('0x97')](_0x1a57('0x98')),'lastMsgDirection':_0x1a57('0xa6'),'Messages':[_[_0x1a57('0x47')](_0x5e3cc2['body'],{'messageId':_0x1c4fbe['messageId'],'sentAt':moment()[_0x1a57('0x97')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x279252['id'],'UserId':_0x5e3cc2[_0x1a57('0x69')]['id'],'ContactId':_0x4870e1['id']})]};if(_0x5e3cc2[_0x1a57('0x51')][_0x1a57('0xa7')]){_0x207060=_[_0x1a57('0x47')](_0x207060,_0x5e3cc2['body']['Interaction']);}return db[_0x1a57('0x7d')][_0x1a57('0x57')](_0x207060,{'include':[{'model':db[_0x1a57('0x94')],'as':_0x1a57('0xa8')}]});}})['then'](respondWithResult(_0x543358,null))[_0x1a57('0x1c')](handleError(_0x543358,null));};exports[_0x1a57('0xa9')]=function(_0x58edfe,_0x40630e){return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0x58edfe[_0x1a57('0x4f')]['id']},'include':[{'model':db[_0x1a57('0x31')],'as':_0x1a57('0x32'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1a57('0xaa'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x40630e,null))[_0x1a57('0x27')](function(_0x35761a){if(!_0x35761a[_0x1a57('0x32')])return;var _0x3d37b0={'id':_0x35761a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x35761a[_0x1a57('0x63')]!==_0x1a57('0x64')){_0x3d37b0[_0x1a57('0x6d')]=_0x35761a['provider'];}else{_0x3d37b0[_0x1a57('0x6e')]=_0x35761a[_0x1a57('0x32')][_0x1a57('0x6e')];_0x3d37b0['port']=_0x35761a[_0x1a57('0x32')]['port'];_0x3d37b0[_0x1a57('0xa2')]=_0x35761a[_0x1a57('0x32')]['secure'];}if(_0x35761a[_0x1a57('0x32')][_0x1a57('0x70')]){if(_0x35761a['Smtp'][_0x1a57('0x53')]){_0x3d37b0[_0x1a57('0xab')]={'type':_0x1a57('0xac'),'user':_0x35761a[_0x1a57('0x32')]['user'],'accessToken':_0x35761a[_0x1a57('0x32')][_0x1a57('0xaa')][_0x1a57('0xad')]};}else{_0x3d37b0[_0x1a57('0xab')]={'user':_0x35761a[_0x1a57('0x32')][_0x1a57('0x69')],'pass':_0x35761a['Smtp']['pass']};}}return respondWithRpcPromise(_0x1a57('0xae'),_0x1a57('0xa9'),{'account':_0x3d37b0});})[_0x1a57('0x27')](respondWithResult(_0x40630e,null))[_0x1a57('0x1c')](handleError(_0x40630e,null));};exports[_0x1a57('0x28')]=function(_0x1495df,_0xf71bdf){return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0x1495df[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0xf71bdf,null))[_0x1a57('0x27')](function(_0x56d28b){if(_0x56d28b&&_0x56d28b[_0x1a57('0x6d')]){throw new db[(_0x1a57('0xaf'))][(_0x1a57('0xb0'))](_0x1a57('0xb1'));}return _0x56d28b;})[_0x1a57('0x27')](removeEntity(_0xf71bdf,null))['catch'](handleError(_0xf71bdf,null));};exports['addAgents']=function(_0x2f9c50,_0x1ea2a6){return db[_0x1a57('0x36')][_0x1a57('0x50')]({'where':{'id':_0x2f9c50['params']['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x1ea2a6,null))[_0x1a57('0x27')](function(_0x2d6cf1){if(_0x2d6cf1){return _0x2d6cf1[_0x1a57('0xb2')](_0x2f9c50['body'][_0x1a57('0x5e')],_[_0x1a57('0x7e')](_0x2f9c50[_0x1a57('0x51')],[_0x1a57('0x5e'),'id'])||{})[_0x1a57('0xb3')](function(_0x4a7f2b){for(var _0x1674da=0x0;_0x1674da<_0x2f9c50[_0x1a57('0x51')][_0x1a57('0x5e')][_0x1a57('0x42')];_0x1674da+=0x1){socket[_0x1a57('0xb4')]('userMailAccount:save',{'UserId':Number(_0x2f9c50[_0x1a57('0x51')]['ids'][_0x1674da]),'MailAccountId':Number(_0x2f9c50['params']['id'])});}return _0x4a7f2b;});}})[_0x1a57('0x27')](respondWithResult(_0x1ea2a6,null))[_0x1a57('0x1c')](handleError(_0x1ea2a6,null));};exports[_0x1a57('0xb5')]=function(_0x33f862,_0x8bf809){return db[_0x1a57('0x36')]['find']({'where':{'id':_0x33f862[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x8bf809,null))[_0x1a57('0x27')](function(_0x2c244d){if(_0x2c244d){return _0x2c244d['removeAgents'](_0x33f862['query']['ids'])['then'](function(){if(_[_0x1a57('0xb6')](_0x33f862['query'][_0x1a57('0x5e')])){for(var _0x2fddc0=0x0;_0x2fddc0<_0x33f862['query']['ids'][_0x1a57('0x42')];_0x2fddc0+=0x1){socket['emit'](_0x1a57('0xb7'),{'UserId':Number(_0x33f862[_0x1a57('0x3c')][_0x1a57('0x5e')][_0x2fddc0]),'MailAccountId':Number(_0x33f862[_0x1a57('0x4f')]['id'])});}}else{socket[_0x1a57('0xb4')]('userMailAccount:remove',{'UserId':Number(_0x33f862[_0x1a57('0x3c')]['ids']),'MailAccountId':Number(_0x33f862[_0x1a57('0x4f')]['id'])});}});}})[_0x1a57('0x27')](respondWithStatusCode(_0x8bf809,null))[_0x1a57('0x1c')](handleError(_0x8bf809,null));};exports['getAgents']=function(_0x1243a2,_0x2aad94){var _0x2d7d6f={};var _0x20e6d1={};var _0x94db18;var _0x53fef8;return db[_0x1a57('0x36')][_0x1a57('0x59')]({'where':{'id':_0x1243a2[_0x1a57('0x4f')]['id']}})[_0x1a57('0x27')](handleEntityNotFound(_0x2aad94,null))['then'](function(_0x361aa3){if(_0x361aa3){_0x94db18=_0x361aa3;_0x20e6d1[_0x1a57('0x3b')]=_[_0x1a57('0x3d')](db['User'][_0x1a57('0x37')]);_0x20e6d1[_0x1a57('0x3c')]=_[_0x1a57('0x3d')](_0x1243a2['query']);_0x20e6d1['filters']=_[_0x1a57('0x3f')](_0x20e6d1[_0x1a57('0x3b')],_0x20e6d1[_0x1a57('0x3c')]);_0x2d7d6f['attributes']=_[_0x1a57('0x3f')](_0x20e6d1[_0x1a57('0x3b')],qs[_0x1a57('0x41')](_0x1243a2[_0x1a57('0x3c')][_0x1a57('0x41')]));_0x2d7d6f[_0x1a57('0x40')]=_0x2d7d6f['attributes'][_0x1a57('0x42')]?_0x2d7d6f[_0x1a57('0x40')]:_0x20e6d1['model'];_0x2d7d6f[_0x1a57('0x61')]=qs[_0x1a57('0x44')](_0x1243a2['query'][_0x1a57('0x44')]);_0x2d7d6f['where']=qs[_0x1a57('0x3e')](_[_0x1a57('0x46')](_0x1243a2[_0x1a57('0x3c')],_0x20e6d1[_0x1a57('0x3e')]));if(_0x1243a2['query'][_0x1a57('0x49')]){_0x2d7d6f[_0x1a57('0x45')]=_[_0x1a57('0x47')](_0x2d7d6f[_0x1a57('0x45')],{'$or':_[_0x1a57('0x35')](_0x2d7d6f[_0x1a57('0x40')],function(_0x2f6ae7){var _0xf5c57f={};_0xf5c57f[_0x2f6ae7]={'$like':'%'+_0x1243a2[_0x1a57('0x3c')]['filter']+'%'};return _0xf5c57f;})});}_0x2d7d6f=_[_0x1a57('0x47')]({},_0x2d7d6f,_0x1243a2[_0x1a57('0x4a')]);return _0x94db18['getAgents'](_0x2d7d6f);}})[_0x1a57('0x27')](function(_0x4c8c93){if(_0x4c8c93){_0x53fef8=_0x4c8c93[_0x1a57('0x42')];if(!_0x1243a2[_0x1a57('0x3c')][_0x1a57('0x5a')](_0x1a57('0x43'))){_0x2d7d6f[_0x1a57('0x20')]=qs[_0x1a57('0x20')](_0x1243a2[_0x1a57('0x3c')][_0x1a57('0x20')]);_0x2d7d6f[_0x1a57('0x1e')]=qs[_0x1a57('0x1e')](_0x1243a2['query'][_0x1a57('0x1e')]);}return _0x94db18[_0x1a57('0xb8')](_0x2d7d6f);}})[_0x1a57('0x27')](function(_0x58d5b0){if(_0x58d5b0){return _0x58d5b0?{'count':_0x53fef8,'rows':_0x58d5b0}:null;}})[_0x1a57('0x27')](respondWithResult(_0x2aad94,null))[_0x1a57('0x1c')](handleError(_0x2aad94,null));}; \ No newline at end of file +var _0x33f1=['filter','options','includeAll','rows','find','body','modernAuthentication','CloudProviderId','Smtp','describe','addDisposition','params','Disposition','create','getDispositions','findOne','sort','MailAccountId','include','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','provider','custom','ListId','isNil','active','description','user','username','pass','password','service','host','port','authentication','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','CmContact','Owner','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','Contacts','updatedAt','DESC','from','email','attachments','root','server/files/attachments','auth','secure','SendMail','List\x20not\x20found','List','defaults','messageId','attach','Interaction','verifySmtp','CloudProvider','OAuth2','data5','Sequelize','ValidationError','addAgents','omit','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','update','MailAccounts','UserProfileResource','destroy','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x33f1,0x6f));var _0x133f=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0x33f1[_0x28578d];return _0x524826;};'use strict';var moment=require(_0x133f('0x0'));var BPromise=require('bluebird');var util=require(_0x133f('0x1'));var path=require(_0x133f('0x2'));var _=require(_0x133f('0x3'));var juice=require(_0x133f('0x4'));var Redis=require('ioredis');var qs=require(_0x133f('0x5'));var logger=require(_0x133f('0x6'))(_0x133f('0x7'));var config=require(_0x133f('0x8'));var db=require(_0x133f('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x133f('0xa')]));require(_0x133f('0xb'))[_0x133f('0xc')](socket);var jayson=require(_0x133f('0xd'));var client=jayson[_0x133f('0xe')][_0x133f('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x3f745b,_0x13b085,_0x592ce9,_0x41694e){return new BPromise(function(_0xce5c5a,_0x593e17){var _0x3f1ed6=_0x41694e||client;return _0x3f1ed6[_0x133f('0x10')](_0x3f745b,_0x592ce9)[_0x133f('0x11')](function(_0x3932d5){logger['info'](_0x133f('0x12'),_0x13b085,_0x133f('0x13'));logger[_0x133f('0x14')](_0x133f('0x15'),_0x13b085,_0x133f('0x13'),JSON[_0x133f('0x16')](_0x3932d5));if(_0x3932d5[_0x133f('0x17')]){if(_0x3932d5[_0x133f('0x17')][_0x133f('0x18')]===0x1f4){logger['error'](_0x133f('0x12'),_0x13b085,_0x3932d5[_0x133f('0x17')][_0x133f('0x19')]);return _0x593e17(_0x3932d5[_0x133f('0x17')][_0x133f('0x19')]);}logger[_0x133f('0x17')]('MailAccount,\x20%s,\x20%s',_0x13b085,_0x3932d5['error'][_0x133f('0x19')]);return _0xce5c5a(_0x3932d5[_0x133f('0x17')][_0x133f('0x19')]);}else{logger[_0x133f('0x1a')](_0x133f('0x12'),_0x13b085,_0x133f('0x13'));_0xce5c5a(_0x3932d5[_0x133f('0x1b')][_0x133f('0x19')]);}})[_0x133f('0x1c')](function(_0x4e0d36){logger[_0x133f('0x17')]('MailAccount,\x20%s,\x20%s',_0x13b085,_0x4e0d36);_0x593e17(_0x4e0d36);});});}function respondWithStatusCode(_0x10844b,_0x317776){_0x317776=_0x317776||0xcc;return function(_0x1e08a2){if(_0x1e08a2){return _0x10844b[_0x133f('0x1d')](_0x317776);}return _0x10844b[_0x133f('0x1e')](_0x317776)[_0x133f('0x1f')]();};}function respondWithResult(_0x1848a7,_0x3a037b){_0x3a037b=_0x3a037b||0xc8;return function(_0x535841){if(_0x535841){return _0x1848a7[_0x133f('0x1e')](_0x3a037b)[_0x133f('0x20')](_0x535841);}};}function respondWithFilteredResult(_0x46aedc,_0x35422b){return function(_0x24e264){if(_0x24e264){var _0x453ef0=typeof _0x35422b[_0x133f('0x21')]===_0x133f('0x22')&&typeof _0x35422b['limit']===_0x133f('0x22');var _0x38b49d=_0x24e264[_0x133f('0x23')];var _0x28e298=_0x453ef0?0x0:_0x35422b[_0x133f('0x21')];var _0x47803a=_0x453ef0?_0x24e264[_0x133f('0x23')]:_0x35422b[_0x133f('0x21')]+_0x35422b[_0x133f('0x24')];var _0x2fedbd;if(_0x47803a>=_0x38b49d){_0x47803a=_0x38b49d;_0x2fedbd=0xc8;}else{_0x2fedbd=0xce;}_0x46aedc[_0x133f('0x1e')](_0x2fedbd);return _0x46aedc[_0x133f('0x25')]('Content-Range',_0x28e298+'-'+_0x47803a+'/'+_0x38b49d)['json'](_0x24e264);}return null;};}function saveUpdates(_0x1ad5f1){return function(_0x2958ef){if(_0x2958ef){return _0x2958ef[_0x133f('0x26')](_0x1ad5f1)[_0x133f('0x11')](function(_0x544123){return _0x544123;});}return null;};}function removeEntity(_0x9f0b9d){return function(_0x3e8c99){if(_0x3e8c99){return _0x3e8c99['destroy']()[_0x133f('0x11')](function(){var _0x5bc989=_0x3e8c99['get']({'plain':!![]});var _0x7f7073=_0x133f('0x27');return db[_0x133f('0x28')][_0x133f('0x29')]({'where':{'type':_0x7f7073,'resourceId':_0x5bc989['id']}})['then'](function(){return _0x3e8c99;});})['then'](function(){_0x9f0b9d[_0x133f('0x1e')](0xcc)[_0x133f('0x1f')]();});}};}function handleEntityNotFound(_0x391e37){return function(_0x463ca9){if(!_0x463ca9){_0x391e37['sendStatus'](0x194);}return _0x463ca9;};}function handleError(_0x29ea45,_0x26d0c5){_0x26d0c5=_0x26d0c5||0x1f4;return function(_0x7bc920){logger['error'](_0x7bc920[_0x133f('0x2a')]);if(_0x7bc920['name']){delete _0x7bc920[_0x133f('0x2b')];}_0x29ea45[_0x133f('0x1e')](_0x26d0c5)[_0x133f('0x2c')](_0x7bc920);};}exports[_0x133f('0x2d')]=function(_0x4fe645,_0x4ddc67){var _0x4d7dc0={'include':[{'model':db[_0x133f('0x2e')],'as':_0x133f('0x2f')},{'model':db[_0x133f('0x30')],'as':'Smtp'},{'model':db[_0x133f('0x31')],'as':_0x133f('0x32')}]},_0x4db13b={},_0x125626={'count':0x0,'rows':[]};var _0x2ed45e=_[_0x133f('0x33')](db[_0x133f('0x34')][_0x133f('0x35')],function(_0x4f1258){return{'name':_0x4f1258[_0x133f('0x36')],'type':_0x4f1258['type'][_0x133f('0x37')]};});_0x4db13b['model']=_[_0x133f('0x33')](_0x2ed45e,_0x133f('0x2b'));_0x4db13b[_0x133f('0x38')]=_[_0x133f('0x39')](_0x4fe645[_0x133f('0x38')]);_0x4db13b[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x4db13b[_0x133f('0x3c')],_0x4db13b['query']);_0x4d7dc0[_0x133f('0x3d')]=_[_0x133f('0x3b')](_0x4db13b[_0x133f('0x3c')],qs['fields'](_0x4fe645[_0x133f('0x38')][_0x133f('0x3e')]));_0x4d7dc0['attributes']=_0x4d7dc0[_0x133f('0x3d')][_0x133f('0x3f')]?_0x4d7dc0['attributes']:_0x4db13b[_0x133f('0x3c')];if(!_0x4fe645[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x4d7dc0[_0x133f('0x24')]=qs[_0x133f('0x24')](_0x4fe645[_0x133f('0x38')][_0x133f('0x24')]);_0x4d7dc0[_0x133f('0x21')]=qs[_0x133f('0x21')](_0x4fe645['query']['offset']);}_0x4d7dc0[_0x133f('0x42')]=qs['sort'](_0x4fe645[_0x133f('0x38')]['sort']);_0x4d7dc0[_0x133f('0x43')]=qs[_0x133f('0x3a')](_[_0x133f('0x44')](_0x4fe645[_0x133f('0x38')],_0x4db13b['filters']),_0x2ed45e);if(_0x4fe645[_0x133f('0x38')]['filter']){_0x4d7dc0['where']=_[_0x133f('0x45')](_0x4d7dc0[_0x133f('0x43')],{'$or':_[_0x133f('0x33')](_0x2ed45e,function(_0x4c4e23){if(_0x4c4e23['type']!==_0x133f('0x46')){var _0x9b120e={};_0x9b120e[_0x4c4e23[_0x133f('0x2b')]]={'$like':'%'+_0x4fe645[_0x133f('0x38')][_0x133f('0x47')]+'%'};return _0x9b120e;}})});}_0x4d7dc0=_[_0x133f('0x45')]({},_0x4d7dc0,_0x4fe645[_0x133f('0x48')]);var _0x531bc1={'where':_0x4d7dc0[_0x133f('0x43')]};return db[_0x133f('0x34')][_0x133f('0x23')](_0x531bc1)['then'](function(_0x2fbe23){_0x125626[_0x133f('0x23')]=_0x2fbe23;if(_0x4fe645[_0x133f('0x38')][_0x133f('0x49')]){_0x4d7dc0['include']=[{'all':!![]}];}return db[_0x133f('0x34')]['findAll'](_0x4d7dc0);})[_0x133f('0x11')](function(_0x2ecaee){_0x125626[_0x133f('0x4a')]=_0x2ecaee;return _0x125626;})[_0x133f('0x11')](respondWithFilteredResult(_0x4ddc67,_0x4d7dc0))[_0x133f('0x1c')](handleError(_0x4ddc67,null));};exports['show']=function(_0x165db9,_0xaa969f){var _0x118143={'raw':![],'where':{'id':_0x165db9['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x133f('0x2f')},{'model':db[_0x133f('0x30')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2aaab0={};_0x2aaab0['model']=_[_0x133f('0x39')](db[_0x133f('0x34')]['rawAttributes']);_0x2aaab0[_0x133f('0x38')]=_[_0x133f('0x39')](_0x165db9['query']);_0x2aaab0[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x2aaab0['model'],_0x2aaab0['query']);_0x118143[_0x133f('0x3d')]=_[_0x133f('0x3b')](_0x2aaab0['model'],qs[_0x133f('0x3e')](_0x165db9['query'][_0x133f('0x3e')]));_0x118143['attributes']=_0x118143['attributes'][_0x133f('0x3f')]?_0x118143['attributes']:_0x2aaab0[_0x133f('0x3c')];if(_0x165db9[_0x133f('0x38')][_0x133f('0x49')]){_0x118143['include']=[{'all':!![]}];}_0x118143=_[_0x133f('0x45')]({},_0x118143,_0x165db9[_0x133f('0x48')]);return db['MailAccount'][_0x133f('0x4b')](_0x118143)[_0x133f('0x11')](handleEntityNotFound(_0xaa969f,null))['then'](respondWithResult(_0xaa969f,null))[_0x133f('0x1c')](handleError(_0xaa969f,null));};exports[_0x133f('0x26')]=function(_0x1c1dcd,_0x4ae873){if(_0x1c1dcd[_0x133f('0x4c')]['id']){delete _0x1c1dcd[_0x133f('0x4c')]['id'];}if(_0x1c1dcd['body'][_0x133f('0x2f')]){if(!_0x1c1dcd[_0x133f('0x4c')][_0x133f('0x2f')][_0x133f('0x4d')]){_0x1c1dcd[_0x133f('0x4c')][_0x133f('0x2f')][_0x133f('0x4e')]=null;}}if(_0x1c1dcd['body'][_0x133f('0x4f')]){if(!_0x1c1dcd[_0x133f('0x4c')][_0x133f('0x4f')]['modernAuthentication']){_0x1c1dcd['body'][_0x133f('0x4f')][_0x133f('0x4e')]=null;}}return db[_0x133f('0x34')][_0x133f('0x4b')]({'where':{'id':_0x1c1dcd['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x133f('0x2f')},{'model':db[_0x133f('0x30')],'as':_0x133f('0x4f')},{'model':db[_0x133f('0x31')],'as':_0x133f('0x32')}]})[_0x133f('0x11')](handleEntityNotFound(_0x4ae873,null))[_0x133f('0x11')](saveUpdates(_0x1c1dcd['body'],null))[_0x133f('0x11')](function(_0x1e9a65){if(_0x1e9a65&&_0x1c1dcd['body'][_0x133f('0x2f')]){return db[_0x133f('0x2e')][_0x133f('0x26')](_0x1c1dcd['body']['Imap'],{'where':{'MailAccountId':_0x1e9a65['id']}})[_0x133f('0x11')](function(){return _0x1e9a65;});}return _0x1e9a65;})[_0x133f('0x11')](function(_0x47df59){if(_0x47df59&&_0x1c1dcd[_0x133f('0x4c')]['Smtp']){return db['MailServerOut'][_0x133f('0x26')](_0x1c1dcd[_0x133f('0x4c')][_0x133f('0x4f')],{'where':{'MailAccountId':_0x47df59['id']}})[_0x133f('0x11')](function(){return _0x47df59;});}return _0x47df59;})[_0x133f('0x11')](respondWithResult(_0x4ae873,null))['catch'](handleError(_0x4ae873,null));};exports[_0x133f('0x50')]=function(_0x38e606,_0x42b2c0){return db[_0x133f('0x34')][_0x133f('0x50')]()[_0x133f('0x11')](respondWithResult(_0x42b2c0,null))[_0x133f('0x1c')](handleError(_0x42b2c0,null));};exports[_0x133f('0x51')]=function(_0x5bf0ed,_0x59c1bd){if(_0x5bf0ed[_0x133f('0x4c')]['id']){delete _0x5bf0ed[_0x133f('0x4c')]['id'];}return db[_0x133f('0x34')][_0x133f('0x4b')]({'where':{'id':_0x5bf0ed[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x59c1bd,null))[_0x133f('0x11')](function(_0x5b4289){if(_0x5b4289){_0x5bf0ed[_0x133f('0x4c')]['MailAccountId']=_0x5b4289['id'];return db[_0x133f('0x53')][_0x133f('0x54')](_0x5bf0ed[_0x133f('0x4c')]);}})[_0x133f('0x11')](respondWithResult(_0x59c1bd,null))[_0x133f('0x1c')](handleError(_0x59c1bd,null));};exports[_0x133f('0x55')]=function(_0xf88517,_0x150818){var _0x3d76bf={'raw':![],'where':{}};var _0x1c5755={};var _0x22d163={'count':0x0,'rows':[]};return db[_0x133f('0x34')][_0x133f('0x56')]({'where':{'id':_0xf88517[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x150818,null))[_0x133f('0x11')](function(_0x5054c9){if(_0x5054c9){_0x1c5755[_0x133f('0x3c')]=_['keys'](db['Disposition'][_0x133f('0x35')]);_0x1c5755[_0x133f('0x38')]=_[_0x133f('0x39')](_0xf88517[_0x133f('0x38')]);_0x1c5755[_0x133f('0x3a')]=_['intersection'](_0x1c5755[_0x133f('0x3c')],_0x1c5755[_0x133f('0x38')]);_0x3d76bf['attributes']=_[_0x133f('0x3b')](_0x1c5755[_0x133f('0x3c')],qs[_0x133f('0x3e')](_0xf88517[_0x133f('0x38')]['fields']));_0x3d76bf['attributes']=_0x3d76bf[_0x133f('0x3d')]['length']?_0x3d76bf['attributes']:_0x1c5755[_0x133f('0x3c')];if(!_0xf88517[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x3d76bf[_0x133f('0x24')]=qs['limit'](_0xf88517['query']['limit']);_0x3d76bf[_0x133f('0x21')]=qs['offset'](_0xf88517[_0x133f('0x38')][_0x133f('0x21')]);}_0x3d76bf[_0x133f('0x42')]=qs[_0x133f('0x57')](_0xf88517[_0x133f('0x38')][_0x133f('0x57')]);_0x3d76bf[_0x133f('0x43')]=qs['filters'](_[_0x133f('0x44')](_0xf88517[_0x133f('0x38')],_0x1c5755[_0x133f('0x3a')]));_0x3d76bf[_0x133f('0x43')][_0x133f('0x58')]=_0x5054c9['id'];if(_0xf88517[_0x133f('0x38')]['filter']){_0x3d76bf[_0x133f('0x43')]=_[_0x133f('0x45')](_0x3d76bf[_0x133f('0x43')],{'$or':_['map'](_0x3d76bf[_0x133f('0x3d')],function(_0x5342f5){var _0x2d170e={};_0x2d170e[_0x5342f5]={'$like':'%'+_0xf88517[_0x133f('0x38')][_0x133f('0x47')]+'%'};return _0x2d170e;})});}_0x3d76bf=_['merge']({},_0x3d76bf,_0xf88517[_0x133f('0x48')]);return db[_0x133f('0x53')][_0x133f('0x23')]({'where':_0x3d76bf['where']})[_0x133f('0x11')](function(_0x27548a){_0x22d163[_0x133f('0x23')]=_0x27548a;if(_0xf88517[_0x133f('0x38')][_0x133f('0x49')]){_0x3d76bf[_0x133f('0x59')]=[{'all':!![]}];}return db[_0x133f('0x53')][_0x133f('0x5a')](_0x3d76bf);})[_0x133f('0x11')](function(_0x30a058){_0x22d163[_0x133f('0x4a')]=_0x30a058;return _0x22d163;});}})['then'](respondWithFilteredResult(_0x150818,_0x3d76bf))[_0x133f('0x1c')](handleError(_0x150818,null));};exports[_0x133f('0x5b')]=function(_0x37707d,_0x1fdb46){return db[_0x133f('0x34')]['find']({'where':{'id':_0x37707d['params']['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x1fdb46,null))[_0x133f('0x11')](function(_0x2a45cd){if(_0x2a45cd){return _0x2a45cd[_0x133f('0x5b')](_0x37707d[_0x133f('0x38')][_0x133f('0x5c')]);}})[_0x133f('0x11')](respondWithStatusCode(_0x1fdb46,null))[_0x133f('0x1c')](handleError(_0x1fdb46,null));};exports['addAnswer']=function(_0x5d1f94,_0x3c7ddc){if(_0x5d1f94[_0x133f('0x4c')]['id']){delete _0x5d1f94[_0x133f('0x4c')]['id'];}return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x5d1f94[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x3c7ddc,null))[_0x133f('0x11')](function(_0x1389ec){if(_0x1389ec){_0x5d1f94['body'][_0x133f('0x58')]=_0x1389ec['id'];return db[_0x133f('0x5d')]['create'](_0x5d1f94['body']);}})['then'](respondWithResult(_0x3c7ddc,null))['catch'](handleError(_0x3c7ddc,null));};exports[_0x133f('0x5e')]=function(_0x474714,_0x29f47f){var _0x2dba81={'raw':![],'where':{}};var _0x4d59dd={};var _0x2c8e51={'count':0x0,'rows':[]};return db[_0x133f('0x34')][_0x133f('0x56')]({'where':{'id':_0x474714[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x29f47f,null))[_0x133f('0x11')](function(_0x8c338e){if(_0x8c338e){_0x4d59dd[_0x133f('0x3c')]=_[_0x133f('0x39')](db[_0x133f('0x5d')][_0x133f('0x35')]);_0x4d59dd[_0x133f('0x38')]=_[_0x133f('0x39')](_0x474714[_0x133f('0x38')]);_0x4d59dd[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x4d59dd[_0x133f('0x3c')],_0x4d59dd[_0x133f('0x38')]);_0x2dba81[_0x133f('0x3d')]=_['intersection'](_0x4d59dd[_0x133f('0x3c')],qs[_0x133f('0x3e')](_0x474714['query'][_0x133f('0x3e')]));_0x2dba81['attributes']=_0x2dba81[_0x133f('0x3d')][_0x133f('0x3f')]?_0x2dba81[_0x133f('0x3d')]:_0x4d59dd[_0x133f('0x3c')];if(!_0x474714[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x2dba81[_0x133f('0x24')]=qs[_0x133f('0x24')](_0x474714[_0x133f('0x38')][_0x133f('0x24')]);_0x2dba81[_0x133f('0x21')]=qs[_0x133f('0x21')](_0x474714['query']['offset']);}_0x2dba81[_0x133f('0x42')]=qs[_0x133f('0x57')](_0x474714[_0x133f('0x38')][_0x133f('0x57')]);_0x2dba81[_0x133f('0x43')]=qs[_0x133f('0x3a')](_[_0x133f('0x44')](_0x474714[_0x133f('0x38')],_0x4d59dd[_0x133f('0x3a')]));_0x2dba81[_0x133f('0x43')][_0x133f('0x58')]=_0x8c338e['id'];if(_0x474714['query']['filter']){_0x2dba81['where']=_['merge'](_0x2dba81[_0x133f('0x43')],{'$or':_[_0x133f('0x33')](_0x2dba81[_0x133f('0x3d')],function(_0x1389ed){var _0x363a93={};_0x363a93[_0x1389ed]={'$like':'%'+_0x474714['query'][_0x133f('0x47')]+'%'};return _0x363a93;})});}_0x2dba81=_[_0x133f('0x45')]({},_0x2dba81,_0x474714[_0x133f('0x48')]);return db[_0x133f('0x5d')][_0x133f('0x23')]({'where':_0x2dba81[_0x133f('0x43')]})[_0x133f('0x11')](function(_0x2a3dc8){_0x2c8e51[_0x133f('0x23')]=_0x2a3dc8;if(_0x474714[_0x133f('0x38')]['includeAll']){_0x2dba81['include']=[{'all':!![]}];}return db[_0x133f('0x5d')][_0x133f('0x5a')](_0x2dba81);})['then'](function(_0x3b85de){_0x2c8e51['rows']=_0x3b85de;return _0x2c8e51;});}})[_0x133f('0x11')](respondWithFilteredResult(_0x29f47f,_0x2dba81))[_0x133f('0x1c')](handleError(_0x29f47f,null));};exports[_0x133f('0x5f')]=function(_0x5eafc3,_0x631eec){return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x5eafc3[_0x133f('0x52')]['id']}})['then'](handleEntityNotFound(_0x631eec,null))['then'](function(_0x3bc1ab){if(_0x3bc1ab){return _0x3bc1ab[_0x133f('0x5f')](_0x5eafc3[_0x133f('0x38')][_0x133f('0x5c')]);}})[_0x133f('0x11')](respondWithStatusCode(_0x631eec,null))['catch'](handleError(_0x631eec,null));};exports[_0x133f('0x54')]=function(_0x88f091,_0x1779e4){var _0x2d2d4c={'name':_0x88f091['body']['name'],'key':_0x88f091[_0x133f('0x4c')][_0x133f('0x37')],'provider':_0x88f091[_0x133f('0x4c')][_0x133f('0x60')]===_0x133f('0x61')?null:_0x88f091['body']['provider'],'email':_0x88f091[_0x133f('0x4c')]['email'],'ListId':_0x88f091['body'][_0x133f('0x62')],'active':!_[_0x133f('0x63')](_0x88f091[_0x133f('0x4c')][_0x133f('0x64')])?_0x88f091[_0x133f('0x4c')][_0x133f('0x64')]:!![],'description':_0x88f091[_0x133f('0x4c')][_0x133f('0x65')]||null,'Imap':{},'Smtp':{}};if(_0x2d2d4c[_0x133f('0x60')]){_0x2d2d4c[_0x133f('0x2f')][_0x133f('0x66')]=_0x2d2d4c[_0x133f('0x4f')]['user']=_0x88f091[_0x133f('0x4c')][_0x133f('0x67')];_0x2d2d4c['Imap']['password']=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x68')]=_0x88f091['body'][_0x133f('0x69')];if(_0x88f091[_0x133f('0x4c')][_0x133f('0x4d')]){_0x2d2d4c['Imap'][_0x133f('0x4d')]=_0x2d2d4c[_0x133f('0x4f')]['modernAuthentication']=!![];_0x2d2d4c[_0x133f('0x2f')][_0x133f('0x4e')]=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x4e')]=_0x88f091[_0x133f('0x4c')][_0x133f('0x4e')];_0x2d2d4c[_0x133f('0x2f')][_0x133f('0x69')]=_0x2d2d4c['Smtp'][_0x133f('0x68')]=null;}else{_0x2d2d4c['Imap'][_0x133f('0x4e')]=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x4e')]=null;}_0x2d2d4c['Imap'][_0x133f('0x6a')]=_0x2d2d4c['Smtp'][_0x133f('0x6a')]=null;_0x2d2d4c['Imap'][_0x133f('0x6b')]=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x6b')]=null;_0x2d2d4c['Imap'][_0x133f('0x6c')]=_0x2d2d4c['Smtp']['port']=null;}else{if(_0x88f091['body'][_0x133f('0x6d')]){_0x2d2d4c[_0x133f('0x2f')][_0x133f('0x66')]=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x66')]=_0x88f091[_0x133f('0x4c')][_0x133f('0x67')];_0x2d2d4c[_0x133f('0x2f')]['password']=_0x2d2d4c[_0x133f('0x4f')]['pass']=_0x88f091['body'][_0x133f('0x69')];}else{_0x2d2d4c[_0x133f('0x2f')][_0x133f('0x6d')]=_0x2d2d4c['Smtp'][_0x133f('0x6d')]=![];_0x2d2d4c['Imap'][_0x133f('0x66')]=_0x2d2d4c[_0x133f('0x4f')]['user']=null;_0x2d2d4c[_0x133f('0x2f')]['password']=_0x2d2d4c[_0x133f('0x4f')][_0x133f('0x68')]=null;}_0x2d2d4c['Imap'][_0x133f('0x6b')]=_0x88f091[_0x133f('0x4c')][_0x133f('0x2f')]['host'];_0x2d2d4c[_0x133f('0x2f')]['port']=_0x88f091[_0x133f('0x4c')][_0x133f('0x2f')]['port'];_0x2d2d4c['Smtp']['host']=_0x88f091[_0x133f('0x4c')][_0x133f('0x4f')][_0x133f('0x6b')];_0x2d2d4c['Smtp'][_0x133f('0x6c')]=_0x88f091[_0x133f('0x4c')][_0x133f('0x4f')]['port'];}return db[_0x133f('0x34')][_0x133f('0x54')](_0x2d2d4c,{'include':[{'model':db['MailServerOut'],'as':_0x133f('0x4f')},{'model':db['MailServerIn'],'as':_0x133f('0x2f')}]})['then'](function(_0x4c19f5){var _0x44f672=_0x88f091[_0x133f('0x66')]['get']({'plain':!![]});if(!_0x44f672)throw new Error(_0x133f('0x6e'));if(_0x44f672[_0x133f('0x6f')]==='user'){var _0x18d489=_0x4c19f5[_0x133f('0x70')]({'plain':!![]});return db['UserProfileSection'][_0x133f('0x4b')]({'where':{'name':_0x133f('0x27'),'userProfileId':_0x44f672[_0x133f('0x71')]},'raw':!![]})[_0x133f('0x11')](function(_0x573693){if(_0x573693&&_0x573693[_0x133f('0x72')]===0x0){return db[_0x133f('0x28')][_0x133f('0x54')]({'name':_0x18d489[_0x133f('0x2b')],'resourceId':_0x18d489['id'],'type':_0x573693['name'],'sectionId':_0x573693['id']},{})['then'](function(){return _0x4c19f5;});}else{return _0x4c19f5;}})['catch'](function(_0x38d18a){logger[_0x133f('0x17')](_0x133f('0x73'),_0x38d18a);throw _0x38d18a;});}return _0x4c19f5;})['then'](respondWithResult(_0x1779e4,0xc9))[_0x133f('0x1c')](handleError(_0x1779e4,null));};exports[_0x133f('0x74')]=function(_0x4f919d,_0x286654){return db[_0x133f('0x34')][_0x133f('0x56')]({'where':{'id':_0x4f919d[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x286654,null))[_0x133f('0x11')](function(_0x24d2f3){if(_0x24d2f3){return _0x24d2f3['getImap']();}return null;})[_0x133f('0x11')](respondWithResult(_0x286654,null))[_0x133f('0x1c')](handleError(_0x286654,null));};exports[_0x133f('0x75')]=function(_0x1e4aa4,_0x400b49){if(_0x1e4aa4[_0x133f('0x4c')]['id']){delete _0x1e4aa4[_0x133f('0x4c')]['id'];}return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x1e4aa4[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x400b49,null))[_0x133f('0x11')](function(_0x59d994){if(_0x59d994){_0x1e4aa4[_0x133f('0x4c')][_0x133f('0x58')]=_0x59d994['id'];return db['MailServerIn'][_0x133f('0x54')](_0x1e4aa4[_0x133f('0x4c')]);}})[_0x133f('0x11')](respondWithResult(_0x400b49,null))[_0x133f('0x1c')](handleError(_0x400b49,null));};exports[_0x133f('0x76')]=function(_0x43e560,_0x16bf0f){return db[_0x133f('0x34')][_0x133f('0x56')]({'where':{'id':_0x43e560[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x16bf0f,null))[_0x133f('0x11')](function(_0x5556a3){if(_0x5556a3){return _0x5556a3[_0x133f('0x77')](null);}return null;})[_0x133f('0x11')](respondWithStatusCode(_0x16bf0f,null))['catch'](handleError(_0x16bf0f,null));};exports['getSmtp']=function(_0x438945,_0xc1462){return db[_0x133f('0x34')]['findOne']({'where':{'id':_0x438945[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0xc1462,null))[_0x133f('0x11')](function(_0x464554){if(_0x464554){return _0x464554[_0x133f('0x78')]();}return null;})[_0x133f('0x11')](respondWithResult(_0xc1462,null))['catch'](handleError(_0xc1462,null));};exports['addSmtp']=function(_0x10608d,_0x159727){if(_0x10608d[_0x133f('0x4c')]['id']){delete _0x10608d['body']['id'];}return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x10608d[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x159727,null))[_0x133f('0x11')](function(_0x31451e){if(_0x31451e){_0x10608d[_0x133f('0x4c')][_0x133f('0x58')]=_0x31451e['id'];return db['MailServerOut'][_0x133f('0x54')](_0x10608d[_0x133f('0x4c')]);}})['then'](respondWithResult(_0x159727,null))[_0x133f('0x1c')](handleError(_0x159727,null));};exports[_0x133f('0x79')]=function(_0x3c48bd,_0x13e4d8){return db[_0x133f('0x34')]['findOne']({'where':{'id':_0x3c48bd[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x13e4d8,null))[_0x133f('0x11')](function(_0xd6cac8){if(_0xd6cac8){return _0xd6cac8[_0x133f('0x7a')](null);}return null;})['then'](respondWithStatusCode(_0x13e4d8,null))[_0x133f('0x1c')](handleError(_0x13e4d8,null));};exports[_0x133f('0x7b')]=function(_0x69bd2e,_0x25e2ee){return db['MailInteraction']['find']({'where':{'id':_0x69bd2e['params']['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x25e2ee,null))[_0x133f('0x11')](function(_0x3f93ce){if(_0x3f93ce){return _0x3f93ce[_0x133f('0x7b')](_0x69bd2e[_0x133f('0x4c')]['ids'],_['omit'](_0x69bd2e['body'],[_0x133f('0x5c'),'id'])||{});}})[_0x133f('0x11')](respondWithResult(_0x25e2ee,null))[_0x133f('0x1c')](handleError(_0x25e2ee,null));};exports[_0x133f('0x7c')]=function(_0x48a919,_0x24f4fc){var _0x1cca01={'raw':![],'where':{}};var _0x27229b={};var _0xd95fb3={'count':0x0,'rows':[]};return db[_0x133f('0x34')][_0x133f('0x56')]({'where':{'id':_0x48a919[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x24f4fc,null))['then'](function(_0x203ef5){if(_0x203ef5){_0x27229b[_0x133f('0x3c')]=_[_0x133f('0x39')](db[_0x133f('0x7d')][_0x133f('0x35')]);_0x27229b[_0x133f('0x38')]=_[_0x133f('0x39')](_0x48a919[_0x133f('0x38')]);_0x27229b[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x27229b[_0x133f('0x3c')],_0x27229b[_0x133f('0x38')]);_0x1cca01[_0x133f('0x3d')]=_['intersection'](_0x27229b[_0x133f('0x3c')],qs[_0x133f('0x3e')](_0x48a919['query'][_0x133f('0x3e')]));_0x1cca01['attributes']=_0x1cca01[_0x133f('0x3d')][_0x133f('0x3f')]?_0x1cca01[_0x133f('0x3d')]:_0x27229b[_0x133f('0x3c')];if(!_0x48a919[_0x133f('0x38')][_0x133f('0x40')]('nolimit')){_0x1cca01[_0x133f('0x24')]=qs[_0x133f('0x24')](_0x48a919[_0x133f('0x38')]['limit']);_0x1cca01[_0x133f('0x21')]=qs[_0x133f('0x21')](_0x48a919[_0x133f('0x38')][_0x133f('0x21')]);}_0x1cca01[_0x133f('0x42')]=qs['sort'](_0x48a919[_0x133f('0x38')]['sort']);_0x1cca01[_0x133f('0x43')]=qs['filters'](_[_0x133f('0x44')](_0x48a919[_0x133f('0x38')],_0x27229b[_0x133f('0x3a')]));_0x1cca01[_0x133f('0x43')][_0x133f('0x58')]=_0x203ef5['id'];if(_0x48a919[_0x133f('0x38')][_0x133f('0x47')]){_0x1cca01[_0x133f('0x43')]=_[_0x133f('0x45')](_0x1cca01['where'],{'$or':_[_0x133f('0x33')](_0x1cca01[_0x133f('0x3d')],function(_0x49b28e){var _0x153bb9={};_0x153bb9[_0x49b28e]={'$like':'%'+_0x48a919[_0x133f('0x38')]['filter']+'%'};return _0x153bb9;})});}_0x1cca01=_['merge']({},_0x1cca01,_0x48a919[_0x133f('0x48')]);return db['MailInteraction']['count']({'where':_0x1cca01['where']})[_0x133f('0x11')](function(_0x5ac726){_0xd95fb3[_0x133f('0x23')]=_0x5ac726;if(_0x48a919[_0x133f('0x38')]['includeAll']){_0x1cca01['include']=[{'model':db[_0x133f('0x7e')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x133f('0x7f'),'attributes':[_0x133f('0x2b'),'fullname',_0x133f('0x80')],'required':![]},{'model':db[_0x133f('0x81')],'as':_0x133f('0x82'),'attributes':['id',_0x133f('0x2b'),_0x133f('0x83')],'where':_0x48a919['query'][_0x133f('0x84')]?{'id':_0x48a919[_0x133f('0x38')][_0x133f('0x84')]}:undefined,'required':_0x48a919[_0x133f('0x38')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x133f('0x5a')](_0x1cca01);})[_0x133f('0x11')](function(_0x3e0599){_0xd95fb3['rows']=_0x3e0599;return _0xd95fb3;});}})[_0x133f('0x11')](respondWithFilteredResult(_0x24f4fc,_0x1cca01))[_0x133f('0x1c')](handleError(_0x24f4fc,null));};exports[_0x133f('0x85')]=function addApplications(_0x1503fb,_0x160e94){var _0x25f083=_0x1503fb[_0x133f('0x52')]['id'];var _0x22a466=_0x1503fb[_0x133f('0x4c')];var _0x4b2eee=0xc8;var _0x295f8e=null;return db['sequelize'][_0x133f('0x86')]({'isolationLevel':db[_0x133f('0x87')][_0x133f('0x88')][_0x133f('0x89')][_0x133f('0x8a')]},function(_0x3fd394){return db['MailAccount'][_0x133f('0x56')]({'where':{'id':_0x25f083},'transaction':_0x3fd394})[_0x133f('0x11')](function(_0x2cf42e){if(_0x2cf42e){return db[_0x133f('0x8b')][_0x133f('0x29')]({'where':{'MailAccountId':_0x25f083},'transaction':_0x3fd394})['then'](function(){var _0x191f27=_[_0x133f('0x33')](_0x22a466,function(_0x26f982){_0x26f982['MailAccountId']=_0x25f083;return _0x26f982;});return db['MailApplication'][_0x133f('0x8c')](_0x191f27,{'transaction':_0x3fd394});});}else{_0x4b2eee=0x194;_0x295f8e=[];}});})['then'](function(){if(_0x4b2eee!==0x194){return db[_0x133f('0x8b')]['findAndCountAll']({'where':{'MailAccountId':_0x25f083},'order':_0x133f('0x8d')})['then'](function(_0x7900c3){_0x295f8e=_0x7900c3;});}})[_0x133f('0x1c')](function(_0x22601b){_0x4b2eee=0x1f4;logger['error'](_0x22601b[_0x133f('0x2a')]);if(_0x22601b[_0x133f('0x2b')]){delete _0x22601b[_0x133f('0x2b')];}_0x295f8e=_0x22601b;})[_0x133f('0x8e')](function(){if(_0x295f8e===null){_0x160e94[_0x133f('0x1d')](_0x4b2eee);}else{if(_0x4b2eee===0x1f4){_0x160e94[_0x133f('0x1e')](_0x4b2eee)[_0x133f('0x2c')](_0x295f8e);}else{_0x160e94[_0x133f('0x1e')](_0x4b2eee)['json'](_0x295f8e);}}});};exports[_0x133f('0x8f')]=function(_0x4adba7,_0x1ae030){var _0x3a8501={};var _0x5b8169={};var _0x313a61;var _0x10134d;return db['MailAccount']['findOne']({'where':{'id':_0x4adba7[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x1ae030,null))[_0x133f('0x11')](function(_0x3fd418){if(_0x3fd418){_0x313a61=_0x3fd418;_0x5b8169[_0x133f('0x3c')]=_[_0x133f('0x39')](db[_0x133f('0x8b')]['rawAttributes']);_0x5b8169[_0x133f('0x38')]=_[_0x133f('0x39')](_0x4adba7[_0x133f('0x38')]);_0x5b8169[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x5b8169[_0x133f('0x3c')],_0x5b8169['query']);_0x3a8501[_0x133f('0x3d')]=_[_0x133f('0x3b')](_0x5b8169[_0x133f('0x3c')],qs[_0x133f('0x3e')](_0x4adba7[_0x133f('0x38')][_0x133f('0x3e')]));_0x3a8501[_0x133f('0x3d')]=_0x3a8501[_0x133f('0x3d')][_0x133f('0x3f')]?_0x3a8501[_0x133f('0x3d')]:_0x5b8169[_0x133f('0x3c')];_0x3a8501[_0x133f('0x42')]=qs[_0x133f('0x57')](_0x4adba7['query'][_0x133f('0x57')]);_0x3a8501[_0x133f('0x43')]=qs[_0x133f('0x3a')](_['pick'](_0x4adba7[_0x133f('0x38')],_0x5b8169['filters']));if(_0x4adba7[_0x133f('0x38')][_0x133f('0x47')]){_0x3a8501[_0x133f('0x43')]=_[_0x133f('0x45')](_0x3a8501[_0x133f('0x43')],{'$or':_['map'](_0x3a8501[_0x133f('0x3d')],function(_0x303c3e){var _0x159567={};_0x159567[_0x303c3e]={'$like':'%'+_0x4adba7['query'][_0x133f('0x47')]+'%'};return _0x159567;})});}_0x3a8501=_[_0x133f('0x45')]({},_0x3a8501,_0x4adba7[_0x133f('0x48')]);return _0x313a61[_0x133f('0x8f')](_0x3a8501);}})[_0x133f('0x11')](function(_0xe43ca8){if(_0xe43ca8){_0x10134d=_0xe43ca8['length'];if(!_0x4adba7[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x3a8501['limit']=qs[_0x133f('0x24')](_0x4adba7[_0x133f('0x38')][_0x133f('0x24')]);_0x3a8501['offset']=qs['offset'](_0x4adba7[_0x133f('0x38')]['offset']);}return _0x313a61[_0x133f('0x8f')](_0x3a8501);}})[_0x133f('0x11')](function(_0x1f9370){if(_0x1f9370){return _0x1f9370?{'count':_0x10134d,'rows':_0x1f9370}:null;}})[_0x133f('0x11')](respondWithResult(_0x1ae030,null))['catch'](handleError(_0x1ae030,null));};exports['getMessages']=function(_0x4a8595,_0x3ee984){var _0x14c4cd={'raw':!![],'where':{}};var _0x189b50={};var _0x5c3e6f={'count':0x0,'rows':[]};return db[_0x133f('0x34')]['findOne']({'where':{'id':_0x4a8595[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x3ee984,null))[_0x133f('0x11')](function(_0x2f820b){if(_0x2f820b){_0x189b50['model']=_[_0x133f('0x39')](db[_0x133f('0x90')][_0x133f('0x35')]);_0x189b50['query']=_[_0x133f('0x39')](_0x4a8595['query']);_0x189b50[_0x133f('0x3a')]=_[_0x133f('0x3b')](_0x189b50[_0x133f('0x3c')],_0x189b50['query']);_0x14c4cd[_0x133f('0x3d')]=_['intersection'](_0x189b50['model'],qs[_0x133f('0x3e')](_0x4a8595['query'][_0x133f('0x3e')]));_0x14c4cd['attributes']=_0x14c4cd['attributes'][_0x133f('0x3f')]?_0x14c4cd[_0x133f('0x3d')]:_0x189b50['model'];if(!_0x4a8595[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x14c4cd[_0x133f('0x24')]=qs[_0x133f('0x24')](_0x4a8595[_0x133f('0x38')][_0x133f('0x24')]);_0x14c4cd[_0x133f('0x21')]=qs[_0x133f('0x21')](_0x4a8595['query']['offset']);}_0x14c4cd[_0x133f('0x42')]=qs[_0x133f('0x57')](_0x4a8595[_0x133f('0x38')][_0x133f('0x57')]);_0x14c4cd[_0x133f('0x43')]=qs[_0x133f('0x3a')](_[_0x133f('0x44')](_0x4a8595[_0x133f('0x38')],_0x189b50['filters']));_0x14c4cd[_0x133f('0x43')][_0x133f('0x58')]=_0x2f820b['id'];if(_0x4a8595[_0x133f('0x38')][_0x133f('0x47')]){_0x14c4cd[_0x133f('0x43')]=_[_0x133f('0x45')](_0x14c4cd[_0x133f('0x43')],{'$or':_[_0x133f('0x33')](_0x14c4cd[_0x133f('0x3d')],function(_0x234d3d){var _0x925d9a={};_0x925d9a[_0x234d3d]={'$like':'%'+_0x4a8595[_0x133f('0x38')][_0x133f('0x47')]+'%'};return _0x925d9a;})});}if(_0x4a8595[_0x133f('0x38')][_0x133f('0x91')]){var _0x2715e7=_0x4a8595['query']['$gte'][_0x133f('0x92')](',');var _0x36fba5={};_0x36fba5[_0x2715e7[0x0]]={'$gte':moment(_0x2715e7[0x1])[_0x133f('0x93')](_0x133f('0x94'))};_0x14c4cd[_0x133f('0x43')]=_[_0x133f('0x45')](_0x14c4cd[_0x133f('0x43')],_0x36fba5);}_0x14c4cd=_[_0x133f('0x45')]({},_0x14c4cd,_0x4a8595['options']);return db[_0x133f('0x90')]['count']({'where':_0x14c4cd[_0x133f('0x43')]})['then'](function(_0x367aa0){_0x5c3e6f['count']=_0x367aa0;if(_0x4a8595[_0x133f('0x38')]['includeAll']){_0x14c4cd[_0x133f('0x59')]=[{'all':!![]}];}return db[_0x133f('0x90')][_0x133f('0x5a')](_0x14c4cd);})[_0x133f('0x11')](function(_0x317e40){if(_0x4a8595[_0x133f('0x38')]['inlineCss']===_0x133f('0x95')){for(var _0x4967dc=0x0;_0x4967dc<_0x317e40['length'];_0x4967dc++){_0x317e40[_0x4967dc][_0x133f('0x4c')]=juice(_0x317e40[_0x4967dc]['body']);}}_0x5c3e6f[_0x133f('0x4a')]=_0x317e40;return _0x5c3e6f;});}})[_0x133f('0x11')](respondWithFilteredResult(_0x3ee984,_0x14c4cd))[_0x133f('0x1c')](handleError(_0x3ee984,null));};exports[_0x133f('0x2c')]=function(_0x56fa1a,_0xb23c2c){var _0x417395,_0x3d6d21={},_0x3e8361;if(_0x56fa1a[_0x133f('0x4c')]['to']){_0x3e8361=_0x56fa1a[_0x133f('0x4c')]['to'][_0x133f('0x92')](',')[0x0];}return db[_0x133f('0x34')][_0x133f('0x4b')]({'where':{'id':_0x56fa1a[_0x133f('0x52')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x133f('0x96'),'where':{'email':_0x3e8361},'limit':0x1,'order':[[_0x133f('0x97'),_0x133f('0x98')]]}]},{'model':db[_0x133f('0x30')],'as':_0x133f('0x4f'),'raw':!![]}]})[_0x133f('0x11')](handleEntityNotFound(_0xb23c2c,null))[_0x133f('0x11')](function(_0x3b7772){if(_0x3b7772){_0x417395=_0x3b7772;if(_0x3b7772[_0x133f('0x4f')]){if(_['isNil'](_0x56fa1a[_0x133f('0x4c')][_0x133f('0x99')])){_0x56fa1a['body'][_0x133f('0x99')]=util['format']('%s\x20<%s>',_0x3b7772[_0x133f('0x2b')],_0x3b7772[_0x133f('0x9a')]||_0x3b7772[_0x133f('0x4f')][_0x133f('0x66')]);}if(_0x56fa1a[_0x133f('0x4c')][_0x133f('0x9b')]&&_0x56fa1a[_0x133f('0x4c')]['attachments'][_0x133f('0x3f')]){for(var _0x268cbb=0x0;_0x268cbb<_0x56fa1a['body'][_0x133f('0x9b')][_0x133f('0x3f')];_0x268cbb+=0x1){_0x56fa1a[_0x133f('0x4c')][_0x133f('0x9b')][_0x268cbb]={'filename':_0x56fa1a[_0x133f('0x4c')][_0x133f('0x9b')][_0x268cbb][_0x133f('0x2b')],'path':path['join'](config[_0x133f('0x9c')],_0x133f('0x9d'),_0x56fa1a[_0x133f('0x4c')][_0x133f('0x9b')][_0x268cbb]['basename'])};}}var _0x3804e9={'tls':{'rejectUnauthorized':![]}};if(_[_0x133f('0x63')](_0x3b7772[_0x133f('0x4f')]['service'])){if(_0x3b7772[_0x133f('0x4f')][_0x133f('0x6d')]){_0x3804e9[_0x133f('0x9e')]={'user':_0x3b7772[_0x133f('0x4f')][_0x133f('0x66')],'pass':_0x3b7772['Smtp'][_0x133f('0x68')]};}_0x3804e9[_0x133f('0x6b')]=_0x3b7772['Smtp'][_0x133f('0x6b')];_0x3804e9[_0x133f('0x6c')]=_0x3b7772['Smtp'][_0x133f('0x6c')];_0x3804e9[_0x133f('0x9f')]=_0x3b7772[_0x133f('0x4f')][_0x133f('0x9f')];}else{_0x3804e9[_0x133f('0x6a')]=_0x3b7772[_0x133f('0x4f')]['service'];_0x3804e9[_0x133f('0x9e')]={'user':_0x3b7772[_0x133f('0x4f')]['user'],'pass':_0x3b7772[_0x133f('0x4f')][_0x133f('0x68')]};}return respondWithRpcPromise(_0x133f('0xa0'),'sendMail',{'account':_0x3804e9,'message':_0x56fa1a[_0x133f('0x4c')]});}else{throw new Error(_0x133f('0xa1'));}}})[_0x133f('0x11')](function(_0x76cf95){if(_0x76cf95){_0x3d6d21=_0x76cf95;if(_0x417395[_0x133f('0xa2')]){if(_0x417395[_0x133f('0xa2')][_0x133f('0x96')]['length']){return _0x417395['List'][_0x133f('0x96')][0x0];}else{return db[_0x133f('0x7e')][_0x133f('0x54')](_[_0x133f('0xa3')](_0x56fa1a[_0x133f('0x4c')],{'firstName':_0x56fa1a[_0x133f('0x4c')]['to'],'email':_0x56fa1a[_0x133f('0x4c')]['to'],'phone':_0x56fa1a[_0x133f('0x4c')]['to'],'ListId':_0x417395[_0x133f('0x62')]}));}}else{throw new Error(_0x133f('0xa1'));}}})[_0x133f('0x11')](function(_0x441496){if(_0x441496){var _0x56030c={'UserId':_0x56fa1a['user']['id'],'ContactId':_0x441496['id'],'MailAccountId':_0x417395['id'],'inReplyTo':_0x3d6d21[_0x133f('0xa4')],'to':_0x56fa1a[_0x133f('0x4c')]['from'],'cc':_0x56fa1a[_0x133f('0x4c')]['cc'],'subject':_0x56fa1a[_0x133f('0x4c')]['subject'],'attach':_0x56fa1a[_0x133f('0x4c')][_0x133f('0xa5')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x133f('0x94')),'lastMsgDirection':'out','Messages':[_['merge'](_0x56fa1a[_0x133f('0x4c')],{'messageId':_0x3d6d21[_0x133f('0xa4')],'sentAt':moment()['format'](_0x133f('0x94')),'read':!![],'MailAccountId':_0x417395['id'],'UserId':_0x56fa1a[_0x133f('0x66')]['id'],'ContactId':_0x441496['id']})]};if(_0x56fa1a['body'][_0x133f('0xa6')]){_0x56030c=_[_0x133f('0x45')](_0x56030c,_0x56fa1a['body'][_0x133f('0xa6')]);}return db[_0x133f('0x7d')][_0x133f('0x54')](_0x56030c,{'include':[{'model':db[_0x133f('0x90')],'as':'Messages'}]});}})[_0x133f('0x11')](respondWithResult(_0xb23c2c,null))[_0x133f('0x1c')](handleError(_0xb23c2c,null));};exports[_0x133f('0xa7')]=function(_0xa3fe8d,_0x5900e9){return db[_0x133f('0x34')][_0x133f('0x4b')]({'where':{'id':_0xa3fe8d['params']['id']},'include':[{'model':db[_0x133f('0x30')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x133f('0xa8'),'raw':!![]}]}]})[_0x133f('0x11')](handleEntityNotFound(_0x5900e9,null))[_0x133f('0x11')](function(_0x33af79){if(!_0x33af79[_0x133f('0x4f')])return;var _0x3b2b17={'id':_0x33af79['id'],'tls':{'rejectUnauthorized':![]}};if(_0x33af79[_0x133f('0x60')]!==_0x133f('0x61')){_0x3b2b17[_0x133f('0x6a')]=_0x33af79[_0x133f('0x60')];}else{_0x3b2b17[_0x133f('0x6b')]=_0x33af79[_0x133f('0x4f')][_0x133f('0x6b')];_0x3b2b17[_0x133f('0x6c')]=_0x33af79[_0x133f('0x4f')][_0x133f('0x6c')];_0x3b2b17[_0x133f('0x9f')]=_0x33af79[_0x133f('0x4f')][_0x133f('0x9f')];}if(_0x33af79[_0x133f('0x4f')][_0x133f('0x6d')]){if(_0x33af79[_0x133f('0x4f')][_0x133f('0x4d')]){_0x3b2b17[_0x133f('0x9e')]={'type':_0x133f('0xa9'),'user':_0x33af79['Smtp']['user'],'accessToken':_0x33af79[_0x133f('0x4f')]['CloudProvider'][_0x133f('0xaa')]};}else{_0x3b2b17[_0x133f('0x9e')]={'user':_0x33af79[_0x133f('0x4f')][_0x133f('0x66')],'pass':_0x33af79[_0x133f('0x4f')][_0x133f('0x68')]};}}return respondWithRpcPromise('VerifySmtp',_0x133f('0xa7'),{'account':_0x3b2b17});})[_0x133f('0x11')](respondWithResult(_0x5900e9,null))[_0x133f('0x1c')](handleError(_0x5900e9,null));};exports[_0x133f('0x29')]=function(_0x40fd8a,_0x5a2874){return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x40fd8a['params']['id']}})['then'](handleEntityNotFound(_0x5a2874,null))[_0x133f('0x11')](function(_0x15ac78){if(_0x15ac78&&_0x15ac78[_0x133f('0x6a')]){throw new db[(_0x133f('0xab'))][(_0x133f('0xac'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x15ac78;})[_0x133f('0x11')](removeEntity(_0x5a2874,null))['catch'](handleError(_0x5a2874,null));};exports['addAgents']=function(_0x1666c0,_0x142b26){return db['MailAccount'][_0x133f('0x4b')]({'where':{'id':_0x1666c0['params']['id']}})['then'](handleEntityNotFound(_0x142b26,null))[_0x133f('0x11')](function(_0x1dda94){if(_0x1dda94){return _0x1dda94[_0x133f('0xad')](_0x1666c0[_0x133f('0x4c')][_0x133f('0x5c')],_[_0x133f('0xae')](_0x1666c0[_0x133f('0x4c')],[_0x133f('0x5c'),'id'])||{})[_0x133f('0xaf')](function(_0x1c778d){for(var _0x3a1a3c=0x0;_0x3a1a3c<_0x1666c0[_0x133f('0x4c')]['ids'][_0x133f('0x3f')];_0x3a1a3c+=0x1){socket[_0x133f('0xb0')]('userMailAccount:save',{'UserId':Number(_0x1666c0[_0x133f('0x4c')]['ids'][_0x3a1a3c]),'MailAccountId':Number(_0x1666c0[_0x133f('0x52')]['id'])});}return _0x1c778d;});}})[_0x133f('0x11')](respondWithResult(_0x142b26,null))[_0x133f('0x1c')](handleError(_0x142b26,null));};exports['removeAgents']=function(_0x444769,_0x2b46cb){return db[_0x133f('0x34')][_0x133f('0x4b')]({'where':{'id':_0x444769[_0x133f('0x52')]['id']}})[_0x133f('0x11')](handleEntityNotFound(_0x2b46cb,null))[_0x133f('0x11')](function(_0x38b2b0){if(_0x38b2b0){return _0x38b2b0[_0x133f('0xb1')](_0x444769[_0x133f('0x38')][_0x133f('0x5c')])['then'](function(){if(_[_0x133f('0xb2')](_0x444769[_0x133f('0x38')][_0x133f('0x5c')])){for(var _0x108f37=0x0;_0x108f37<_0x444769['query'][_0x133f('0x5c')][_0x133f('0x3f')];_0x108f37+=0x1){socket[_0x133f('0xb0')](_0x133f('0xb3'),{'UserId':Number(_0x444769['query'][_0x133f('0x5c')][_0x108f37]),'MailAccountId':Number(_0x444769['params']['id'])});}}else{socket[_0x133f('0xb0')](_0x133f('0xb3'),{'UserId':Number(_0x444769[_0x133f('0x38')]['ids']),'MailAccountId':Number(_0x444769[_0x133f('0x52')]['id'])});}});}})[_0x133f('0x11')](respondWithStatusCode(_0x2b46cb,null))['catch'](handleError(_0x2b46cb,null));};exports[_0x133f('0xb4')]=function(_0x310c5c,_0x129f98){var _0x40ae9b={};var _0xed212a={};var _0x1c7374;var _0x520427;return db['MailAccount'][_0x133f('0x56')]({'where':{'id':_0x310c5c[_0x133f('0x52')]['id']}})['then'](handleEntityNotFound(_0x129f98,null))[_0x133f('0x11')](function(_0x1a9c31){if(_0x1a9c31){_0x1c7374=_0x1a9c31;_0xed212a[_0x133f('0x3c')]=_[_0x133f('0x39')](db[_0x133f('0xb5')][_0x133f('0x35')]);_0xed212a[_0x133f('0x38')]=_[_0x133f('0x39')](_0x310c5c['query']);_0xed212a[_0x133f('0x3a')]=_['intersection'](_0xed212a[_0x133f('0x3c')],_0xed212a[_0x133f('0x38')]);_0x40ae9b[_0x133f('0x3d')]=_[_0x133f('0x3b')](_0xed212a[_0x133f('0x3c')],qs[_0x133f('0x3e')](_0x310c5c[_0x133f('0x38')][_0x133f('0x3e')]));_0x40ae9b[_0x133f('0x3d')]=_0x40ae9b[_0x133f('0x3d')][_0x133f('0x3f')]?_0x40ae9b[_0x133f('0x3d')]:_0xed212a['model'];_0x40ae9b[_0x133f('0x42')]=qs['sort'](_0x310c5c[_0x133f('0x38')][_0x133f('0x57')]);_0x40ae9b[_0x133f('0x43')]=qs['filters'](_[_0x133f('0x44')](_0x310c5c['query'],_0xed212a[_0x133f('0x3a')]));if(_0x310c5c[_0x133f('0x38')]['filter']){_0x40ae9b[_0x133f('0x43')]=_['merge'](_0x40ae9b['where'],{'$or':_[_0x133f('0x33')](_0x40ae9b[_0x133f('0x3d')],function(_0x1ec907){var _0x20fe6f={};_0x20fe6f[_0x1ec907]={'$like':'%'+_0x310c5c[_0x133f('0x38')]['filter']+'%'};return _0x20fe6f;})});}_0x40ae9b=_['merge']({},_0x40ae9b,_0x310c5c[_0x133f('0x48')]);return _0x1c7374[_0x133f('0xb4')](_0x40ae9b);}})[_0x133f('0x11')](function(_0x413c28){if(_0x413c28){_0x520427=_0x413c28[_0x133f('0x3f')];if(!_0x310c5c[_0x133f('0x38')][_0x133f('0x40')](_0x133f('0x41'))){_0x40ae9b[_0x133f('0x24')]=qs[_0x133f('0x24')](_0x310c5c[_0x133f('0x38')][_0x133f('0x24')]);_0x40ae9b[_0x133f('0x21')]=qs[_0x133f('0x21')](_0x310c5c['query']['offset']);}return _0x1c7374[_0x133f('0xb4')](_0x40ae9b);}})[_0x133f('0x11')](function(_0x2a37e5){if(_0x2a37e5){return _0x2a37e5?{'count':_0x520427,'rows':_0x2a37e5}:null;}})[_0x133f('0x11')](respondWithResult(_0x129f98,null))[_0x133f('0x1c')](handleError(_0x129f98,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 5bd0734..d294c01 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 _0xad1b=['../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4179b3,_0x2eaff2){var _0x5b5c7e=function(_0x568341){while(--_0x568341){_0x4179b3['push'](_0x4179b3['shift']());}};_0x5b5c7e(++_0x2eaff2);}(_0xad1b,0x131));var _0xbad1=function(_0x5e9fa2,_0x555b54){_0x5e9fa2=_0x5e9fa2-0x0;var _0x55dac2=_0xad1b[_0x5e9fa2];return _0x55dac2;};'use strict';var EventEmitter=require(_0xbad1('0x0'));var MailAccount=require(_0xbad1('0x1'))['db'][_0xbad1('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xbad1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbad1('0x4'),'afterDestroy':_0xbad1('0x5')};function emitEvent(_0x1bfd8e){return function(_0x5e7292,_0x1623e7,_0x47af0d){MailAccountEvents[_0xbad1('0x6')](_0x1bfd8e+':'+_0x5e7292['id'],_0x5e7292);MailAccountEvents['emit'](_0x1bfd8e,_0x5e7292);_0x47af0d(null);};}for(var e in events){if(events[_0xbad1('0x7')](e)){var event=events[e];MailAccount[_0xbad1('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x2b0a=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners'];(function(_0x2c4d74,_0x54b518){var _0x1f5498=function(_0x51a6e0){while(--_0x51a6e0){_0x2c4d74['push'](_0x2c4d74['shift']());}};_0x1f5498(++_0x54b518);}(_0x2b0a,0x84));var _0xa2b0=function(_0x597baa,_0x5f56c9){_0x597baa=_0x597baa-0x0;var _0x30e5da=_0x2b0a[_0x597baa];return _0x30e5da;};'use strict';var EventEmitter=require(_0xa2b0('0x0'));var MailAccount=require(_0xa2b0('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa2b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x545b81){return function(_0x1f6a6e,_0x852694,_0x1a285a){MailAccountEvents[_0xa2b0('0x3')](_0x545b81+':'+_0x1f6a6e['id'],_0x1f6a6e);MailAccountEvents[_0xa2b0('0x3')](_0x545b81,_0x1f6a6e);_0x1a285a(null);};}for(var e in events){if(events[_0xa2b0('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 64b9e20..67471ea 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 _0xf815=['rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','util','../../config/logger','api','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf815,0xed));var _0x5f81=function(_0x14859f,_0x3a61c6){_0x14859f=_0x14859f-0x0;var _0x3a407a=_0xf815[_0x14859f];return _0x3a407a;};'use strict';var _=require('lodash');var util=require(_0x5f81('0x0'));var logger=require(_0x5f81('0x1'))(_0x5f81('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5f81('0x3'));var fs=require('fs');var path=require(_0x5f81('0x4'));var rimraf=require(_0x5f81('0x5'));var config=require(_0x5f81('0x6'));var attributes=require(_0x5f81('0x7'));module[_0x5f81('0x8')]=function(_0x330bce,_0x37602a){return _0x330bce[_0x5f81('0x9')](_0x5f81('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd650=['./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd650,0x131));var _0x0d65=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd650[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x0d65('0x0'));var util=require(_0x0d65('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d65('0x2'));var BPromise=require('bluebird');var rp=require(_0x0d65('0x3'));var fs=require('fs');var path=require(_0x0d65('0x4'));var rimraf=require(_0x0d65('0x5'));var config=require(_0x0d65('0x6'));var attributes=require(_0x0d65('0x7'));module[_0x0d65('0x8')]=function(_0x11f766,_0x5553dd){return _0x11f766[_0x0d65('0x9')](_0x0d65('0xa'),attributes,{'tableName':_0x0d65('0xb'),'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 30766f3..e053782 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 _0x89dd=['GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowMailAccount','find','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','DESC','Applications','MailServerOut','List','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','*,*,*,*','ListId','create','List\x20not\x20found','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','interaction','created','contact','attachments','originTo','bcc','originChannel','Email','ChatOfflineMessageId','Attachments','User','name','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./mailAccount.socket','register','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x89dd,0x1f2));var _0xd89d=function(_0x4ba19f,_0x2b2fe9){_0x4ba19f=_0x4ba19f-0x0;var _0x399a1e=_0x89dd[_0x4ba19f];return _0x399a1e;};'use strict';var _=require(_0xd89d('0x0'));var util=require(_0xd89d('0x1'));var moment=require('moment');var BPromise=require(_0xd89d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd89d('0x3'));var db=require(_0xd89d('0x4'))['db'];var utils=require(_0xd89d('0x5'));var logger=require(_0xd89d('0x6'))(_0xd89d('0x7'));var config=require(_0xd89d('0x8'));var jayson=require(_0xd89d('0x9'));var client=jayson[_0xd89d('0xa')]['http']({'port':0x232c});config[_0xd89d('0xb')]=_[_0xd89d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd89d('0xb')]));require(_0xd89d('0xd'))[_0xd89d('0xe')](socket);function respondWithRpcPromise(_0x53eb95,_0x465cb6,_0x5022be){return new BPromise(function(_0x480421,_0xa72910){return client[_0xd89d('0xf')](_0x53eb95,_0x5022be)[_0xd89d('0x10')](function(_0x4c64d3){logger[_0xd89d('0x11')]('MailAccount,\x20%s,\x20%s',_0x465cb6,_0xd89d('0x12'));logger[_0xd89d('0x13')](_0xd89d('0x14'),_0x465cb6,_0xd89d('0x12'),JSON['stringify'](_0x4c64d3));if(_0x4c64d3['error']){if(_0x4c64d3[_0xd89d('0x15')][_0xd89d('0x16')]===0x1f4){logger[_0xd89d('0x15')](_0xd89d('0x17'),_0x465cb6,_0x4c64d3['error'][_0xd89d('0x18')]);return _0xa72910(_0x4c64d3[_0xd89d('0x15')][_0xd89d('0x18')]);}logger[_0xd89d('0x15')](_0xd89d('0x17'),_0x465cb6,_0x4c64d3[_0xd89d('0x15')][_0xd89d('0x18')]);return _0x480421(_0x4c64d3[_0xd89d('0x15')][_0xd89d('0x18')]);}else{logger[_0xd89d('0x11')](_0xd89d('0x17'),_0x465cb6,_0xd89d('0x12'));_0x480421(_0x4c64d3[_0xd89d('0x19')][_0xd89d('0x18')]);}})[_0xd89d('0x1a')](function(_0x3718fa){logger[_0xd89d('0x15')]('MailAccount,\x20%s,\x20%s',_0x465cb6,_0x3718fa);_0xa72910(_0x3718fa);});});}exports[_0xd89d('0x1b')]=function(_0x7e6019){var _0x1d76db=this;return new Promise(function(_0x4669dd,_0x32f4bc){return db[_0xd89d('0x1c')][_0xd89d('0x1d')]({'raw':_0x7e6019[_0xd89d('0x1e')]?_0x7e6019[_0xd89d('0x1e')][_0xd89d('0x1f')]===undefined?!![]:![]:!![],'where':_0x7e6019[_0xd89d('0x1e')]?_0x7e6019[_0xd89d('0x1e')][_0xd89d('0x20')]||null:null,'attributes':_0x7e6019['options']?_0x7e6019[_0xd89d('0x1e')][_0xd89d('0x21')]||null:null,'limit':_0x7e6019[_0xd89d('0x1e')]?_0x7e6019[_0xd89d('0x1e')][_0xd89d('0x22')]||null:null,'include':_0x7e6019[_0xd89d('0x1e')]?_0x7e6019['options'][_0xd89d('0x23')]?_['map'](_0x7e6019[_0xd89d('0x1e')][_0xd89d('0x23')],function(_0x3ac25d){return{'model':db[_0x3ac25d['model']],'as':_0x3ac25d['as'],'attributes':_0x3ac25d[_0xd89d('0x21')],'include':_0x3ac25d[_0xd89d('0x23')]?_[_0xd89d('0x24')](_0x3ac25d['include'],function(_0x33a628){return{'model':db[_0x33a628['model']],'as':_0x33a628['as'],'attributes':_0x33a628[_0xd89d('0x21')],'include':_0x33a628['include']?_['map'](_0x33a628[_0xd89d('0x23')],function(_0x300bd9){return{'model':db[_0x300bd9[_0xd89d('0x25')]],'as':_0x300bd9['as'],'attributes':_0x300bd9[_0xd89d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd89d('0x10')](function(_0x244619){logger['info']('GetMailAccount',_0x7e6019);logger[_0xd89d('0x13')](_0xd89d('0x1b'),_0x7e6019,JSON[_0xd89d('0x26')](_0x244619));_0x4669dd(_0x244619);})[_0xd89d('0x1a')](function(_0x18f5ee){logger[_0xd89d('0x15')](_0xd89d('0x1b'),_0x18f5ee[_0xd89d('0x18')],_0x7e6019);_0x32f4bc(_0x1d76db[_0xd89d('0x15')](0x1f4,_0x18f5ee[_0xd89d('0x18')]));});});};exports[_0xd89d('0x27')]=function(_0x48b50b){var _0x2d6491=this;return new Promise(function(_0x324bc9,_0x2fbb24){return db['MailAccount'][_0xd89d('0x28')]({'raw':_0x48b50b['options']?_0x48b50b[_0xd89d('0x1e')][_0xd89d('0x1f')]===undefined?!![]:![]:!![],'where':_0x48b50b[_0xd89d('0x1e')]?_0x48b50b[_0xd89d('0x1e')][_0xd89d('0x20')]||null:null,'attributes':_0x48b50b[_0xd89d('0x1e')]?_0x48b50b[_0xd89d('0x1e')][_0xd89d('0x21')]||null:null,'include':_0x48b50b[_0xd89d('0x1e')]?_0x48b50b[_0xd89d('0x1e')][_0xd89d('0x23')]?_[_0xd89d('0x24')](_0x48b50b[_0xd89d('0x1e')][_0xd89d('0x23')],function(_0x5a28bd){return{'model':db[_0x5a28bd[_0xd89d('0x25')]],'as':_0x5a28bd['as'],'attributes':_0x5a28bd['attributes'],'include':_0x5a28bd[_0xd89d('0x23')]?_[_0xd89d('0x24')](_0x5a28bd[_0xd89d('0x23')],function(_0x4e656a){return{'model':db[_0x4e656a['model']],'as':_0x4e656a['as'],'attributes':_0x4e656a['attributes'],'include':_0x4e656a[_0xd89d('0x23')]?_[_0xd89d('0x24')](_0x4e656a['include'],function(_0x1763bd){return{'model':db[_0x1763bd[_0xd89d('0x25')]],'as':_0x1763bd['as'],'attributes':_0x1763bd['attributes']};}):[]};}):[]};}):[]:[]})[_0xd89d('0x10')](function(_0x380c83){logger[_0xd89d('0x11')](_0xd89d('0x27'),_0x48b50b);logger['debug'](_0xd89d('0x27'),_0x48b50b,JSON[_0xd89d('0x26')](_0x380c83));_0x324bc9(_0x380c83);})[_0xd89d('0x1a')](function(_0xd5a15b){logger[_0xd89d('0x15')]('ShowMailAccount',_0xd5a15b[_0xd89d('0x18')],_0x48b50b);_0x2fbb24(_0x2d6491[_0xd89d('0x15')](0x1f4,_0xd5a15b[_0xd89d('0x18')]));});});};exports[_0xd89d('0x29')]=function(_0x5dba37){var _0x267459=this;return new Promise(function(_0x3a97b3,_0x54ee10){var _0x442e3c={'body':_0x5dba37[_0xd89d('0x2a')],'channel':_0xd89d('0x2b')};var _0x1151a5=_[_0xd89d('0x2c')](_[_0xd89d('0x2d')](db['CmContact'][_0xd89d('0x2e')]),[_0xd89d('0x2f'),'updatedAt',_0xd89d('0x30'),'ListId']);var _0x1fdfef=![];if(_0x5dba37['body']['id']){delete _0x5dba37['body']['id'];}if(_[_0xd89d('0x31')](_0x5dba37['body'][_0xd89d('0x32')])){return _0x54ee10(_0x267459[_0xd89d('0x15')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xd89d('0x31')](_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x2a')])||_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x2a')]===''){return _0x54ee10(_0x267459[_0xd89d('0x15')](0x1f4,_0xd89d('0x33')));}if(_[_0xd89d('0x31')](_0x5dba37['body'][_0xd89d('0x34')])){return _0x54ee10(_0x267459[_0xd89d('0x15')](0x1f4,_0xd89d('0x35')+_0x1151a5));}if(!_[_0xd89d('0x36')](_0x1151a5,_0x5dba37[_0xd89d('0x2a')]['mapKey'])){return _0x54ee10(_0x267459['error'](0x1f4,_0xd89d('0x37')+_0x1151a5));}var _0x4e9639={};_0x4e9639[_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x34')]]=_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x32')];return db[_0xd89d('0x1c')]['find']({'where':{'id':_0x5dba37[_0xd89d('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd89d('0x39')],'as':'Contacts','where':_0x4e9639,'limit':0x1,'order':[['updatedAt',_0xd89d('0x3a')]]}]},{'model':db['MailApplication'],'as':_0xd89d('0x3b')},{'model':db[_0xd89d('0x3c')],'as':'Smtp'}]})[_0xd89d('0x10')](function(_0x2492b4){if(_0x2492b4&&_0x2492b4[_0xd89d('0x3d')]){var _0x32fe85=_0x2492b4['get']({'plain':!![]});_0x442e3c[_0xd89d('0x38')]=_[_0xd89d('0x3e')](_0x32fe85,[_0xd89d('0x3b'),'List']);_0x442e3c[_0xd89d('0x3f')]=_0x32fe85[_0xd89d('0x3b')];_0x442e3c[_0xd89d('0x40')]=_0x32fe85[_0xd89d('0x3d')];_0x442e3c[_0xd89d('0x3f')]=_[_0xd89d('0x41')](_0x442e3c['applications'],[_0xd89d('0x42')],[_0xd89d('0x43')]);if(_0x442e3c[_0xd89d('0x38')]&&_0x442e3c[_0xd89d('0x38')][_0xd89d('0x44')]){_0x442e3c['applications'][_0xd89d('0x45')]({'id':0x0,'priority':_0x442e3c['applications'][_0xd89d('0x46')]+0x1,'app':_0xd89d('0x47'),'appdata':_0xd89d('0x44'),'interval':_0xd89d('0x48')});}if(_0x442e3c['account']['Applications']){delete _0x442e3c[_0xd89d('0x38')][_0xd89d('0x3b')];}if(_0x442e3c[_0xd89d('0x38')]['List']){delete _0x442e3c[_0xd89d('0x38')][_0xd89d('0x3d')];}if(_0x32fe85[_0xd89d('0x3d')]['Contacts']['length']){return _0x32fe85[_0xd89d('0x3d')]['Contacts'][0x0];}var _0x5e8d5c=_[_0xd89d('0xc')](_0x5dba37[_0xd89d('0x2a')],{'firstName':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x32')],'ListId':_0x32fe85[_0xd89d('0x49')]});_0x5e8d5c[_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x34')]]=_0x5dba37['body'][_0xd89d('0x32')];return db[_0xd89d('0x39')][_0xd89d('0x4a')](_0x5e8d5c);}else{throw new Error(_0xd89d('0x4b'));}})[_0xd89d('0x10')](function(_0x178ea1){_0x442e3c['contact']=_0x178ea1;if(_0x178ea1){if(!_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')]['messageId']){_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x4c')]=rs[_0xd89d('0x4d')]()+'\x20'+_0x5dba37['body']['message'][_0xd89d('0x32')];}var _0x1deafd={'ContactId':_0x178ea1['id'],'MailAccountId':_0x5dba37[_0xd89d('0x38')]['id'],'inReplyTo':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x4c')],'to':_0x5dba37['body']['message'][_0xd89d('0x32')],'cc':_0x5dba37[_0xd89d('0x2a')]['message']['cc'],'subject':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x4e')],'attach':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x4f')],'lastMsgAt':moment()[_0xd89d('0x50')](_0xd89d('0x51')),'lastMsgDirection':'in'};return db[_0xd89d('0x52')][_0xd89d('0x28')]({'where':{'closed':![],'MailAccountId':_0x5dba37[_0xd89d('0x38')]['id']},'include':[{'model':db[_0xd89d('0x53')],'as':_0xd89d('0x54'),'attributes':['messageId'],'where':{'messageId':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x55')]}}]})['then'](function(_0x5b2d84){if(_0x5b2d84){return[_0x5b2d84,![]];}return db[_0xd89d('0x52')]['create'](_0x1deafd)[_0xd89d('0x10')](function(_0x3d3d50){return[_0x3d3d50,!![]];});});}else{throw new Error(_0xd89d('0x56'));}})[_0xd89d('0x57')](function(_0x2662b5,_0xed2aa3){if(_0x2662b5){_0x1fdfef=_0xed2aa3;if(!_0xed2aa3){return _0x2662b5['update']({'inReplyTo':_0x5dba37['body'][_0xd89d('0x18')][_0xd89d('0x4c')],'to':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x32')],'cc':_0x5dba37['body']['message']['cc'],'subject':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x4e')],'attach':_0x2662b5[_0xd89d('0x4f')]?_0x2662b5[_0xd89d('0x4f')]:_0x5dba37['body'][_0xd89d('0x18')][_0xd89d('0x4f')],'substatus':null,'substatusAt':moment()[_0xd89d('0x50')](_0xd89d('0x51')),'lastMsgAt':moment()[_0xd89d('0x50')](_0xd89d('0x51')),'lastMsgDirection':'in'});}else{return _0x2662b5;}}})['then'](function(_0x103f06){_0x442e3c['interaction']=_0x103f06['get']({'plain':!![]});_0x442e3c[_0xd89d('0x58')][_0xd89d('0x59')]=_0x1fdfef;return db[_0xd89d('0x53')][_0xd89d('0x4a')]({'body':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x2a')],'MailAccountId':_0x5dba37[_0xd89d('0x38')]['id'],'MailInteractionId':_0x103f06['id'],'direction':'in','ContactId':_0x442e3c[_0xd89d('0x5a')]['id'],'messageId':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x4c')],'from':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x32')],'to':_0x5dba37['body'][_0xd89d('0x18')]['to'],'cc':_0x5dba37[_0xd89d('0x2a')]['message']['cc'],'subject':_0x5dba37['body'][_0xd89d('0x18')][_0xd89d('0x4e')],'attach':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x4f')],'Attachments':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')][_0xd89d('0x5b')],'originTo':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x5c')],'originCc':_0x5dba37[_0xd89d('0x2a')]['message']['originCc'],'bcc':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x5d')],'ChatWebsiteId':_0x5dba37[_0xd89d('0x2a')][_0xd89d('0x18')]['ChatWebsiteId']||null,'originChannel':_0x5dba37['body'][_0xd89d('0x18')][_0xd89d('0x5e')]||_0xd89d('0x5f'),'ChatOfflineMessageId':_0x5dba37[_0xd89d('0x2a')]['message'][_0xd89d('0x60')]||null},{'include':[{'model':db['Attachment'],'as':_0xd89d('0x61')}]});})[_0xd89d('0x10')](function(_0x218940){_0x442e3c['message']=_0x218940;if(_0x442e3c['interaction']['UserId']){return db[_0xd89d('0x62')][_0xd89d('0x28')]({'attributes':['id',_0xd89d('0x63')],'where':{'id':_0x442e3c['interaction'][_0xd89d('0x64')]}})[_0xd89d('0x10')](function(_0x4d06c9){if(_0x4d06c9){_0x442e3c[_0xd89d('0x3f')][_0xd89d('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d06c9[_0xd89d('0x63')]+','+(_0x442e3c[_0xd89d('0x38')][_0xd89d('0x66')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xd89d('0x67'),_0x442e3c);});}return respondWithRpcPromise(_0xd89d('0x68'),_0xd89d('0x67'),_0x442e3c);})[_0xd89d('0x10')](function(_0xaeea6c){_0x3a97b3(_0xaeea6c);})[_0xd89d('0x1a')](function(_0x37e5ca){_0x54ee10(_0x267459[_0xd89d('0x15')](0x1f4,_0x37e5ca['message']));});});}; \ No newline at end of file +var _0x50ab=['model','attributes','GetMailAccount','ShowMailAccount','MailAccount','find','NotifyMailAccount','body','mail','difference','CmContact','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','asc','push','*,*,*,*','length','defaults','create','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','interaction','originTo','originCc','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','request\x20sent','debug','stringify','error','code','message','MailAccount,\x20%s,\x20%s','result','catch','options','raw','where','limit','map','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x50ab,0x16c));var _0xb50a=function(_0xee3c05,_0x5c27c6){_0xee3c05=_0xee3c05-0x0;var _0x2b2f62=_0x50ab[_0xee3c05];return _0x2b2f62;};'use strict';var _=require(_0xb50a('0x0'));var util=require(_0xb50a('0x1'));var moment=require('moment');var BPromise=require(_0xb50a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb50a('0x3'));var db=require(_0xb50a('0x4'))['db'];var utils=require(_0xb50a('0x5'));var logger=require(_0xb50a('0x6'))(_0xb50a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb50a('0x8'));var client=jayson[_0xb50a('0x9')]['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xb50a('0xa')],{'host':_0xb50a('0xb'),'port':0x18eb});var socket=require(_0xb50a('0xc'))(new Redis(config[_0xb50a('0xa')]));require(_0xb50a('0xd'))[_0xb50a('0xe')](socket);function respondWithRpcPromise(_0x30aa70,_0xce67e6,_0x494aed){return new BPromise(function(_0x5c0f5a,_0x20b22c){return client['request'](_0x30aa70,_0x494aed)[_0xb50a('0xf')](function(_0x15a7d3){logger[_0xb50a('0x10')]('MailAccount,\x20%s,\x20%s',_0xce67e6,_0xb50a('0x11'));logger[_0xb50a('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0xce67e6,'request\x20sent',JSON[_0xb50a('0x13')](_0x15a7d3));if(_0x15a7d3['error']){if(_0x15a7d3[_0xb50a('0x14')][_0xb50a('0x15')]===0x1f4){logger[_0xb50a('0x14')]('MailAccount,\x20%s,\x20%s',_0xce67e6,_0x15a7d3['error'][_0xb50a('0x16')]);return _0x20b22c(_0x15a7d3[_0xb50a('0x14')][_0xb50a('0x16')]);}logger[_0xb50a('0x14')](_0xb50a('0x17'),_0xce67e6,_0x15a7d3[_0xb50a('0x14')][_0xb50a('0x16')]);return _0x5c0f5a(_0x15a7d3[_0xb50a('0x14')]['message']);}else{logger[_0xb50a('0x10')](_0xb50a('0x17'),_0xce67e6,_0xb50a('0x11'));_0x5c0f5a(_0x15a7d3[_0xb50a('0x18')][_0xb50a('0x16')]);}})[_0xb50a('0x19')](function(_0x318ace){logger[_0xb50a('0x14')]('MailAccount,\x20%s,\x20%s',_0xce67e6,_0x318ace);_0x20b22c(_0x318ace);});});}exports['GetMailAccount']=function(_0x20a26e){var _0x5af8c2=this;return new Promise(function(_0x54186f,_0x5548e5){return db['MailAccount']['findAll']({'raw':_0x20a26e['options']?_0x20a26e[_0xb50a('0x1a')][_0xb50a('0x1b')]===undefined?!![]:![]:!![],'where':_0x20a26e[_0xb50a('0x1a')]?_0x20a26e[_0xb50a('0x1a')][_0xb50a('0x1c')]||null:null,'attributes':_0x20a26e[_0xb50a('0x1a')]?_0x20a26e[_0xb50a('0x1a')]['attributes']||null:null,'limit':_0x20a26e[_0xb50a('0x1a')]?_0x20a26e[_0xb50a('0x1a')][_0xb50a('0x1d')]||null:null,'include':_0x20a26e[_0xb50a('0x1a')]?_0x20a26e[_0xb50a('0x1a')]['include']?_[_0xb50a('0x1e')](_0x20a26e[_0xb50a('0x1a')][_0xb50a('0x1f')],function(_0xb26eb){return{'model':db[_0xb26eb[_0xb50a('0x20')]],'as':_0xb26eb['as'],'attributes':_0xb26eb[_0xb50a('0x21')],'include':_0xb26eb[_0xb50a('0x1f')]?_[_0xb50a('0x1e')](_0xb26eb['include'],function(_0xdf435b){return{'model':db[_0xdf435b['model']],'as':_0xdf435b['as'],'attributes':_0xdf435b[_0xb50a('0x21')],'include':_0xdf435b[_0xb50a('0x1f')]?_[_0xb50a('0x1e')](_0xdf435b[_0xb50a('0x1f')],function(_0x1c72ca){return{'model':db[_0x1c72ca[_0xb50a('0x20')]],'as':_0x1c72ca['as'],'attributes':_0x1c72ca[_0xb50a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb482){logger[_0xb50a('0x10')](_0xb50a('0x22'),_0x20a26e);logger[_0xb50a('0x12')](_0xb50a('0x22'),_0x20a26e,JSON['stringify'](_0x3fb482));_0x54186f(_0x3fb482);})[_0xb50a('0x19')](function(_0x4962fa){logger['error'](_0xb50a('0x22'),_0x4962fa['message'],_0x20a26e);_0x5548e5(_0x5af8c2['error'](0x1f4,_0x4962fa['message']));});});};exports[_0xb50a('0x23')]=function(_0x3a20c8){var _0x5c156b=this;return new Promise(function(_0x209c42,_0x49fd42){return db[_0xb50a('0x24')][_0xb50a('0x25')]({'raw':_0x3a20c8['options']?_0x3a20c8[_0xb50a('0x1a')][_0xb50a('0x1b')]===undefined?!![]:![]:!![],'where':_0x3a20c8[_0xb50a('0x1a')]?_0x3a20c8[_0xb50a('0x1a')][_0xb50a('0x1c')]||null:null,'attributes':_0x3a20c8['options']?_0x3a20c8[_0xb50a('0x1a')][_0xb50a('0x21')]||null:null,'include':_0x3a20c8[_0xb50a('0x1a')]?_0x3a20c8[_0xb50a('0x1a')]['include']?_['map'](_0x3a20c8[_0xb50a('0x1a')]['include'],function(_0x4242fe){return{'model':db[_0x4242fe['model']],'as':_0x4242fe['as'],'attributes':_0x4242fe[_0xb50a('0x21')],'include':_0x4242fe[_0xb50a('0x1f')]?_['map'](_0x4242fe[_0xb50a('0x1f')],function(_0x1d3849){return{'model':db[_0x1d3849['model']],'as':_0x1d3849['as'],'attributes':_0x1d3849[_0xb50a('0x21')],'include':_0x1d3849[_0xb50a('0x1f')]?_[_0xb50a('0x1e')](_0x1d3849[_0xb50a('0x1f')],function(_0x521430){return{'model':db[_0x521430[_0xb50a('0x20')]],'as':_0x521430['as'],'attributes':_0x521430[_0xb50a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb50a('0xf')](function(_0x239285){logger['info']('ShowMailAccount',_0x3a20c8);logger[_0xb50a('0x12')](_0xb50a('0x23'),_0x3a20c8,JSON[_0xb50a('0x13')](_0x239285));_0x209c42(_0x239285);})[_0xb50a('0x19')](function(_0x2cd4c4){logger[_0xb50a('0x14')](_0xb50a('0x23'),_0x2cd4c4['message'],_0x3a20c8);_0x49fd42(_0x5c156b[_0xb50a('0x14')](0x1f4,_0x2cd4c4[_0xb50a('0x16')]));});});};exports[_0xb50a('0x26')]=function(_0x400a42){var _0x33a704=this;return new Promise(function(_0x4bacab,_0x3aec34){var _0x126787={'body':_0x400a42[_0xb50a('0x27')],'channel':_0xb50a('0x28')};var _0x3fc136=_[_0xb50a('0x29')](_['keys'](db[_0xb50a('0x2a')]['rawAttributes']),[_0xb50a('0x2b'),'updatedAt',_0xb50a('0x2c'),_0xb50a('0x2d')]);var _0x5cbd1f=![];if(_0x400a42[_0xb50a('0x27')]['id']){delete _0x400a42[_0xb50a('0x27')]['id'];}if(_['isNil'](_0x400a42[_0xb50a('0x27')][_0xb50a('0x2e')])){return _0x3aec34(_0x33a704['error'](0x1f4,_0xb50a('0x2f')));}if(_[_0xb50a('0x30')](_0x400a42[_0xb50a('0x27')][_0xb50a('0x27')])||_0x400a42[_0xb50a('0x27')][_0xb50a('0x27')]===''){return _0x3aec34(_0x33a704[_0xb50a('0x14')](0x1f4,_0xb50a('0x31')));}if(_[_0xb50a('0x30')](_0x400a42[_0xb50a('0x27')][_0xb50a('0x32')])){return _0x3aec34(_0x33a704['error'](0x1f4,_0xb50a('0x33')+_0x3fc136));}if(!_[_0xb50a('0x34')](_0x3fc136,_0x400a42[_0xb50a('0x27')]['mapKey'])){return _0x3aec34(_0x33a704['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fc136));}var _0x39a6f0={};_0x39a6f0[_0x400a42[_0xb50a('0x27')][_0xb50a('0x32')]]=_0x400a42['body'][_0xb50a('0x2e')];return db['MailAccount'][_0xb50a('0x25')]({'where':{'id':_0x400a42[_0xb50a('0x35')]['id']},'include':[{'model':db[_0xb50a('0x36')],'as':_0xb50a('0x37'),'include':[{'model':db[_0xb50a('0x2a')],'as':_0xb50a('0x38'),'where':_0x39a6f0,'limit':0x1,'order':[[_0xb50a('0x39'),_0xb50a('0x3a')]]}]},{'model':db[_0xb50a('0x3b')],'as':_0xb50a('0x3c')},{'model':db[_0xb50a('0x3d')],'as':_0xb50a('0x3e')}]})[_0xb50a('0xf')](function(_0xefb020){if(_0xefb020&&_0xefb020[_0xb50a('0x37')]){var _0xd46c5c=_0xefb020[_0xb50a('0x3f')]({'plain':!![]});_0x126787[_0xb50a('0x35')]=_[_0xb50a('0x40')](_0xd46c5c,[_0xb50a('0x3c'),'List']);_0x126787[_0xb50a('0x41')]=_0xd46c5c[_0xb50a('0x3c')];_0x126787['list']=_0xd46c5c['List'];_0x126787[_0xb50a('0x41')]=_['orderBy'](_0x126787[_0xb50a('0x41')],['priority'],[_0xb50a('0x42')]);if(_0x126787[_0xb50a('0x35')]&&_0x126787[_0xb50a('0x35')]['autoclose']){_0x126787['applications'][_0xb50a('0x43')]({'id':0x0,'priority':_0x126787[_0xb50a('0x41')]['length']+0x1,'app':'close','appdata':'autoclose','interval':_0xb50a('0x44')});}if(_0x126787[_0xb50a('0x35')][_0xb50a('0x3c')]){delete _0x126787[_0xb50a('0x35')][_0xb50a('0x3c')];}if(_0x126787['account'][_0xb50a('0x37')]){delete _0x126787[_0xb50a('0x35')][_0xb50a('0x37')];}if(_0xd46c5c[_0xb50a('0x37')]['Contacts'][_0xb50a('0x45')]){return _0xd46c5c[_0xb50a('0x37')][_0xb50a('0x38')][0x0];}var _0xe080b4=_[_0xb50a('0x46')](_0x400a42[_0xb50a('0x27')],{'firstName':_0x400a42[_0xb50a('0x27')][_0xb50a('0x2e')],'ListId':_0xd46c5c['ListId']});_0xe080b4[_0x400a42[_0xb50a('0x27')][_0xb50a('0x32')]]=_0x400a42[_0xb50a('0x27')][_0xb50a('0x2e')];return db[_0xb50a('0x2a')][_0xb50a('0x47')](_0xe080b4);}else{throw new Error(_0xb50a('0x48'));}})[_0xb50a('0xf')](function(_0x4d2288){_0x126787[_0xb50a('0x49')]=_0x4d2288;if(_0x4d2288){if(!_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x4a')]){_0x400a42['body']['message']['messageId']=rs['generate']()+'\x20'+_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x2e')];}var _0x365ab7={'ContactId':_0x4d2288['id'],'MailAccountId':_0x400a42[_0xb50a('0x35')]['id'],'inReplyTo':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x4a')],'to':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['from'],'cc':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['cc'],'subject':_0x400a42['body'][_0xb50a('0x16')][_0xb50a('0x4b')],'attach':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x4c')],'lastMsgAt':moment()[_0xb50a('0x4d')](_0xb50a('0x4e')),'lastMsgDirection':'in'};return db[_0xb50a('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0x400a42['account']['id']},'include':[{'model':db[_0xb50a('0x50')],'as':'Messages','attributes':[_0xb50a('0x4a')],'where':{'messageId':_0x400a42[_0xb50a('0x27')]['message'][_0xb50a('0x51')]}}]})['then'](function(_0x36f2c6){if(_0x36f2c6){return[_0x36f2c6,![]];}return db[_0xb50a('0x4f')][_0xb50a('0x47')](_0x365ab7)[_0xb50a('0xf')](function(_0x3363b8){return[_0x3363b8,!![]];});});}else{throw new Error(_0xb50a('0x52'));}})[_0xb50a('0x53')](function(_0x542e66,_0x283b3e){if(_0x542e66){_0x5cbd1f=_0x283b3e;if(!_0x283b3e){return _0x542e66[_0xb50a('0x54')]({'inReplyTo':_0x400a42['body'][_0xb50a('0x16')]['messageId'],'to':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['from'],'cc':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['cc'],'subject':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['subject'],'attach':_0x542e66[_0xb50a('0x4c')]?_0x542e66[_0xb50a('0x4c')]:_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['attach'],'substatus':null,'substatusAt':moment()[_0xb50a('0x4d')](_0xb50a('0x4e')),'lastMsgAt':moment()['format'](_0xb50a('0x4e')),'lastMsgDirection':'in'});}else{return _0x542e66;}}})['then'](function(_0x19ffc4){_0x126787[_0xb50a('0x55')]=_0x19ffc4['get']({'plain':!![]});_0x126787[_0xb50a('0x55')]['created']=_0x5cbd1f;return db['MailMessage'][_0xb50a('0x47')]({'body':_0x400a42[_0xb50a('0x27')][_0xb50a('0x27')],'MailAccountId':_0x400a42[_0xb50a('0x35')]['id'],'MailInteractionId':_0x19ffc4['id'],'direction':'in','ContactId':_0x126787[_0xb50a('0x49')]['id'],'messageId':_0x400a42['body']['message'][_0xb50a('0x4a')],'from':_0x400a42[_0xb50a('0x27')]['message']['from'],'to':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['to'],'cc':_0x400a42['body'][_0xb50a('0x16')]['cc'],'subject':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x4b')],'attach':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x4c')],'Attachments':_0x400a42[_0xb50a('0x27')]['message']['attachments'],'originTo':_0x400a42[_0xb50a('0x27')]['message'][_0xb50a('0x56')],'originCc':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x57')],'bcc':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['bcc'],'ChatWebsiteId':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')]['ChatWebsiteId']||null,'originChannel':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x58')]||'Email','ChatOfflineMessageId':_0x400a42[_0xb50a('0x27')][_0xb50a('0x16')][_0xb50a('0x59')]||null},{'include':[{'model':db[_0xb50a('0x5a')],'as':_0xb50a('0x5b')}]});})['then'](function(_0x324827){_0x126787[_0xb50a('0x16')]=_0x324827;if(_0x126787[_0xb50a('0x55')][_0xb50a('0x5c')]){return db[_0xb50a('0x5d')][_0xb50a('0x25')]({'attributes':['id',_0xb50a('0x5e')],'where':{'id':_0x126787['interaction'][_0xb50a('0x5c')]}})['then'](function(_0x321cfe){if(_0x321cfe){_0x126787[_0xb50a('0x41')][_0xb50a('0x5f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x321cfe[_0xb50a('0x5e')]+','+(_0x126787[_0xb50a('0x35')][_0xb50a('0x60')]||0xa),'interval':_0xb50a('0x44')});}return respondWithRpcPromise(_0xb50a('0x61'),_0xb50a('0x62'),_0x126787);});}return respondWithRpcPromise(_0xb50a('0x61'),'startRouting',_0x126787);})[_0xb50a('0xf')](function(_0x3751b1){_0x4bacab(_0x3751b1);})[_0xb50a('0x19')](function(_0x561001){_0x3aec34(_0x33a704[_0xb50a('0x14')](0x1f4,_0x561001[_0xb50a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 148b0d8..8c8b603 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 _0x9fd3=['remove','update','emit','removeListener','register','length','save'];(function(_0x3f073e,_0x551fe8){var _0x502221=function(_0x1851c3){while(--_0x1851c3){_0x3f073e['push'](_0x3f073e['shift']());}};_0x502221(++_0x551fe8);}(_0x9fd3,0x141));var _0x39fd=function(_0x465186,_0x19bdc6){_0x465186=_0x465186-0x0;var _0x64bdd=_0x9fd3[_0x465186];return _0x64bdd;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x39fd('0x0'),_0x39fd('0x1'),_0x39fd('0x2')];function createListener(_0x571305,_0x8cb6a3){return function(_0x553d63){_0x8cb6a3[_0x39fd('0x3')](_0x571305,_0x553d63);};}function removeListener(_0x2c3d7b,_0xbc4461){return function(){MailAccountEvents[_0x39fd('0x4')](_0x2c3d7b,_0xbc4461);};}exports[_0x39fd('0x5')]=function(_0x4c8d78){for(var _0x33d1f8=0x0,_0x3fc5d7=events[_0x39fd('0x6')];_0x33d1f8<_0x3fc5d7;_0x33d1f8++){var _0x3be1ee=events[_0x33d1f8];var _0x13a502=createListener('mailAccount:'+_0x3be1ee,_0x4c8d78);MailAccountEvents['on'](_0x3be1ee,_0x13a502);}}; \ No newline at end of file +var _0x3bb4=['register','length','./mailAccount.events','save','update','emit','removeListener'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x3bb4,0x87));var _0x43bb=function(_0xc7959a,_0x3d551f){_0xc7959a=_0xc7959a-0x0;var _0x557040=_0x3bb4[_0xc7959a];return _0x557040;};'use strict';var MailAccountEvents=require(_0x43bb('0x0'));var events=[_0x43bb('0x1'),'remove',_0x43bb('0x2')];function createListener(_0x3f7dab,_0x533f15){return function(_0x2675d1){_0x533f15[_0x43bb('0x3')](_0x3f7dab,_0x2675d1);};}function removeListener(_0x5baa30,_0x2a1e27){return function(){MailAccountEvents[_0x43bb('0x4')](_0x5baa30,_0x2a1e27);};}exports[_0x43bb('0x5')]=function(_0x485f8e){for(var _0x5eb10a=0x0,_0x41f796=events[_0x43bb('0x6')];_0x5eb10a<_0x41f796;_0x5eb10a++){var _0x5400a4=events[_0x5eb10a];var _0x27ae9c=createListener('mailAccount:'+_0x5400a4,_0x485f8e);MailAccountEvents['on'](_0x5400a4,_0x27ae9c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f1faa94..9338c43 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 _0x5b32=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','update','delete'];(function(_0x252bac,_0x4cdbfe){var _0x2b43d4=function(_0x2e38e3){while(--_0x2e38e3){_0x252bac['push'](_0x252bac['shift']());}};_0x2b43d4(++_0x4cdbfe);}(_0x5b32,0x79));var _0x25b3=function(_0x54d47c,_0x2dcce0){_0x54d47c=_0x54d47c-0x0;var _0x1ab83c=_0x5b32[_0x54d47c];return _0x1ab83c;};'use strict';var multer=require('multer');var util=require(_0x25b3('0x0'));var path=require(_0x25b3('0x1'));var timeout=require(_0x25b3('0x2'));var express=require(_0x25b3('0x3'));var router=express[_0x25b3('0x4')]();var fs_extra=require(_0x25b3('0x5'));var auth=require(_0x25b3('0x6'));var interaction=require(_0x25b3('0x7'));var config=require(_0x25b3('0x8'));var controller=require('./mailApplication.controller');router[_0x25b3('0x9')](_0x25b3('0xa'),auth[_0x25b3('0xb')](),controller[_0x25b3('0xc')]);router['put'](_0x25b3('0xa'),auth[_0x25b3('0xb')](),controller[_0x25b3('0xd')]);router[_0x25b3('0xe')](_0x25b3('0xa'),auth[_0x25b3('0xb')](),controller[_0x25b3('0xf')]);module[_0x25b3('0x10')]=router; \ No newline at end of file +var _0x0740=['./mailApplication.controller','get','/:id','isAuthenticated','update','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ad5a4,_0xd8f7eb){var _0xb750b2=function(_0x37b260){while(--_0x37b260){_0x1ad5a4['push'](_0x1ad5a4['shift']());}};_0xb750b2(++_0xd8f7eb);}(_0x0740,0x70));var _0x0074=function(_0x47c587,_0x3b0904){_0x47c587=_0x47c587-0x0;var _0x49f626=_0x0740[_0x47c587];return _0x49f626;};'use strict';var multer=require(_0x0074('0x0'));var util=require(_0x0074('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0074('0x2'));var router=express[_0x0074('0x3')]();var fs_extra=require(_0x0074('0x4'));var auth=require(_0x0074('0x5'));var interaction=require(_0x0074('0x6'));var config=require(_0x0074('0x7'));var controller=require(_0x0074('0x8'));router[_0x0074('0x9')](_0x0074('0xa'),auth[_0x0074('0xb')](),controller['show']);router['put'](_0x0074('0xa'),auth['isAuthenticated'](),controller[_0x0074('0xc')]);router[_0x0074('0xd')](_0x0074('0xa'),auth[_0x0074('0xb')](),controller[_0x0074('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 211e4b7..4d5baf5 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 _0x4c93=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x4c93,0x10c));var _0x34c9=function(_0x597f18,_0x1706be){_0x597f18=_0x597f18-0x0;var _0x472d25=_0x4c93[_0x597f18];return _0x472d25;};'use strict';var Sequelize=require('sequelize');module[_0x34c9('0x0')]={'priority':{'type':Sequelize[_0x34c9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x34c9('0x2')],'allowNull':![],'defaultValue':_0x34c9('0x3')},'appdata':{'type':Sequelize[_0x34c9('0x4')]()},'description':{'type':Sequelize[_0x34c9('0x2')]},'interval':{'type':Sequelize[_0x34c9('0x2')],'defaultValue':_0x34c9('0x5')}}; \ No newline at end of file +var _0x66d7=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x2f50b6,_0xd09fe3){var _0x54b027=function(_0x680941){while(--_0x680941){_0x2f50b6['push'](_0x2f50b6['shift']());}};_0x54b027(++_0xd09fe3);}(_0x66d7,0x1f2));var _0x766d=function(_0x31ae20,_0x149a6c){_0x31ae20=_0x31ae20-0x0;var _0x5b5f0f=_0x66d7[_0x31ae20];return _0x5b5f0f;};'use strict';var Sequelize=require(_0x766d('0x0'));module[_0x766d('0x1')]={'priority':{'type':Sequelize[_0x766d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x766d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x766d('0x3')],'defaultValue':_0x766d('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index a20e49f..f71ddbf 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(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0xaa88[_0x58ae8a];return _0x2f0b6b;};'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 _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(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0xaa88[_0x3fb030];return _0xd6899b;};'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 diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 23e8118..c1a91fb 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 _0x6621=['define','MailApplication','mail_applications','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6621,0x124));var _0x1662=function(_0x5450ef,_0x3b600d){_0x5450ef=_0x5450ef-0x0;var _0x26c883=_0x6621[_0x5450ef];return _0x26c883;};'use strict';var _=require('lodash');var util=require(_0x1662('0x0'));var logger=require(_0x1662('0x1'))(_0x1662('0x2'));var moment=require(_0x1662('0x3'));var BPromise=require('bluebird');var rp=require(_0x1662('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1662('0x5'));var config=require(_0x1662('0x6'));var attributes=require('./mailApplication.attributes');module[_0x1662('0x7')]=function(_0x55b43c,_0x4497c9){return _0x55b43c[_0x1662('0x8')](_0x1662('0x9'),attributes,{'tableName':_0x1662('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1662('0xb')});}; \ No newline at end of file +var _0x5761=['util','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x5761,0x11d));var _0x1576=function(_0x302f55,_0x31872f){_0x302f55=_0x302f55-0x0;var _0x55ca94=_0x5761[_0x302f55];return _0x55ca94;};'use strict';var _=require(_0x1576('0x0'));var util=require(_0x1576('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1576('0x2'));var BPromise=require(_0x1576('0x3'));var rp=require(_0x1576('0x4'));var fs=require('fs');var path=require(_0x1576('0x5'));var rimraf=require('rimraf');var config=require(_0x1576('0x6'));var attributes=require('./mailApplication.attributes');module[_0x1576('0x7')]=function(_0x17f440,_0x51c22c){return _0x17f440[_0x1576('0x8')](_0x1576('0x9'),attributes,{'tableName':_0x1576('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1576('0xb'),'collate':_0x1576('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 9c916d1..2c4a5a8 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 _0x557f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','catch','MailApplication','body','options','raw','where','attributes','UpdateMailApplication','stringify','util','moment','bluebird','ioredis'];(function(_0x55cfaa,_0x2f49a7){var _0x469c20=function(_0x351df4){while(--_0x351df4){_0x55cfaa['push'](_0x55cfaa['shift']());}};_0x469c20(++_0x2f49a7);}(_0x557f,0x1a0));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf557('0x0'));var moment=require(_0xf557('0x1'));var BPromise=require(_0xf557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf557('0x3'));var db=require(_0xf557('0x4'))['db'];var utils=require(_0xf557('0x5'));var logger=require(_0xf557('0x6'))('rpc');var config=require(_0xf557('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf557('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1134d6,_0x1c67d8,_0x1e3fc1){return new BPromise(function(_0x2205ca,_0x36cc17){return client[_0xf557('0x9')](_0x1134d6,_0x1e3fc1)[_0xf557('0xa')](function(_0x222dcb){logger['info'](_0xf557('0xb'),_0x1c67d8,'request\x20sent');logger[_0xf557('0xc')](_0xf557('0xd'),_0x1c67d8,_0xf557('0xe'),JSON['stringify'](_0x222dcb));if(_0x222dcb[_0xf557('0xf')]){if(_0x222dcb[_0xf557('0xf')][_0xf557('0x10')]===0x1f4){logger['error'](_0xf557('0xb'),_0x1c67d8,_0x222dcb[_0xf557('0xf')][_0xf557('0x11')]);return _0x36cc17(_0x222dcb[_0xf557('0xf')][_0xf557('0x11')]);}logger[_0xf557('0xf')]('MailApplication,\x20%s,\x20%s',_0x1c67d8,_0x222dcb[_0xf557('0xf')][_0xf557('0x11')]);return _0x2205ca(_0x222dcb['error'][_0xf557('0x11')]);}else{logger[_0xf557('0x12')](_0xf557('0xb'),_0x1c67d8,'request\x20sent');_0x2205ca(_0x222dcb['result']['message']);}})[_0xf557('0x13')](function(_0x11bc51){logger['error']('MailApplication,\x20%s,\x20%s',_0x1c67d8,_0x11bc51);_0x36cc17(_0x11bc51);});});}exports['UpdateMailApplication']=function(_0x6cb2db){var _0x13e1d2=this;return new Promise(function(_0x488a1a,_0x16ed88){return db[_0xf557('0x14')]['update'](_0x6cb2db[_0xf557('0x15')],{'raw':_0x6cb2db[_0xf557('0x16')]?_0x6cb2db[_0xf557('0x16')][_0xf557('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6cb2db[_0xf557('0x16')]?_0x6cb2db[_0xf557('0x16')][_0xf557('0x18')]||null:null,'attributes':_0x6cb2db['options']?_0x6cb2db[_0xf557('0x16')][_0xf557('0x19')]||null:null,'limit':_0x6cb2db['options']?_0x6cb2db[_0xf557('0x16')]['limit']||null:null})[_0xf557('0xa')](function(_0x17ad34){logger['info']('UpdateMailApplication',_0x6cb2db);logger[_0xf557('0xc')](_0xf557('0x1a'),_0x6cb2db,JSON[_0xf557('0x1b')](_0x17ad34));_0x488a1a(_0x17ad34);})['catch'](function(_0x10fdb6){logger['error'](_0xf557('0x1a'),_0x10fdb6[_0xf557('0x11')],_0x6cb2db);_0x16ed88(_0x13e1d2[_0xf557('0xf')](0x1f4,_0x10fdb6[_0xf557('0x11')]));});});}; \ No newline at end of file +var _0x42c3=['request\x20sent','code','error','message','result','catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x3bac2b,_0x137306){var _0xbadf45=function(_0xddb85a){while(--_0xddb85a){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xbadf45(++_0x137306);}(_0x42c3,0x1bc));var _0x342c=function(_0x156276,_0x3881b9){_0x156276=_0x156276-0x0;var _0x4cae4f=_0x42c3[_0x156276];return _0x4cae4f;};'use strict';var _=require(_0x342c('0x0'));var util=require(_0x342c('0x1'));var moment=require(_0x342c('0x2'));var BPromise=require('bluebird');var rs=require(_0x342c('0x3'));var fs=require('fs');var Redis=require(_0x342c('0x4'));var db=require(_0x342c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x342c('0x6'))('rpc');var config=require(_0x342c('0x7'));var jayson=require(_0x342c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6d68,_0x364f48,_0x1da228){return new BPromise(function(_0xe659b6,_0x53e9a8){return client[_0x342c('0x9')](_0x3f6d68,_0x1da228)[_0x342c('0xa')](function(_0x3bc287){logger[_0x342c('0xb')](_0x342c('0xc'),_0x364f48,'request\x20sent');logger[_0x342c('0xd')](_0x342c('0xe'),_0x364f48,_0x342c('0xf'),JSON['stringify'](_0x3bc287));if(_0x3bc287['error']){if(_0x3bc287['error'][_0x342c('0x10')]===0x1f4){logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);return _0x53e9a8(_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);}logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);return _0xe659b6(_0x3bc287[_0x342c('0x11')][_0x342c('0x12')]);}else{logger[_0x342c('0xb')](_0x342c('0xc'),_0x364f48,_0x342c('0xf'));_0xe659b6(_0x3bc287[_0x342c('0x13')]['message']);}})[_0x342c('0x14')](function(_0x50a286){logger[_0x342c('0x11')](_0x342c('0xc'),_0x364f48,_0x50a286);_0x53e9a8(_0x50a286);});});}exports[_0x342c('0x15')]=function(_0x4e1355){var _0x32de0a=this;return new Promise(function(_0x2b8ce3,_0x3df147){return db[_0x342c('0x16')][_0x342c('0x17')](_0x4e1355['body'],{'raw':_0x4e1355[_0x342c('0x18')]?_0x4e1355[_0x342c('0x18')][_0x342c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e1355['options']?_0x4e1355[_0x342c('0x18')]['where']||null:null,'attributes':_0x4e1355[_0x342c('0x18')]?_0x4e1355[_0x342c('0x18')][_0x342c('0x1a')]||null:null,'limit':_0x4e1355[_0x342c('0x18')]?_0x4e1355['options']['limit']||null:null})['then'](function(_0x11f394){logger[_0x342c('0xb')]('UpdateMailApplication',_0x4e1355);logger[_0x342c('0xd')]('UpdateMailApplication',_0x4e1355,JSON['stringify'](_0x11f394));_0x2b8ce3(_0x11f394);})[_0x342c('0x14')](function(_0x4a9521){logger[_0x342c('0x11')](_0x342c('0x15'),_0x4a9521[_0x342c('0x12')],_0x4e1355);_0x3df147(_0x32de0a[_0x342c('0x11')](0x1f4,_0x4a9521['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ae8ec7b..b6d0c0c 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 _0x8d5c=['tracked','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','mail','mailinteraction:addtags','addTags','put','update','delete'];(function(_0x509701,_0x5f266d){var _0xf232cc=function(_0x26076e){while(--_0x26076e){_0x509701['push'](_0x509701['shift']());}};_0xf232cc(++_0x5f266d);}(_0x8d5c,0x164));var _0xc8d5=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0x8d5c[_0x3f25b2];return _0xd8caeb;};'use strict';var express=require('express');var router=express[_0xc8d5('0x0')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8d5('0x1'));var controller=require(_0xc8d5('0x2'));router[_0xc8d5('0x3')]('/',auth[_0xc8d5('0x4')](),controller[_0xc8d5('0x5')]);router[_0xc8d5('0x3')](_0xc8d5('0x6'),auth['isAuthenticated'](),controller[_0xc8d5('0x7')]);router[_0xc8d5('0x3')](_0xc8d5('0x8'),auth['isAuthenticated'](),controller[_0xc8d5('0x9')]);router[_0xc8d5('0x3')](_0xc8d5('0xa'),auth[_0xc8d5('0x4')](),controller[_0xc8d5('0xb')]);router[_0xc8d5('0x3')]('/:id/download',auth['isAuthenticated'](),controller[_0xc8d5('0xc')]);router[_0xc8d5('0xd')]('/',auth['isAuthenticated'](),controller[_0xc8d5('0xe')]);router[_0xc8d5('0xd')](_0xc8d5('0xa'),auth[_0xc8d5('0x4')](),controller['addMessage']);router[_0xc8d5('0xd')](_0xc8d5('0xf'),auth[_0xc8d5('0x4')](),interaction['tracked'](_0xc8d5('0x10'),_0xc8d5('0x11')),controller[_0xc8d5('0x12')]);router[_0xc8d5('0x13')](_0xc8d5('0x8'),auth[_0xc8d5('0x4')](),interaction['tracked'](_0xc8d5('0x10'),'mailinteraction:update'),controller[_0xc8d5('0x14')]);router[_0xc8d5('0x15')](_0xc8d5('0x8'),auth[_0xc8d5('0x4')](),interaction[_0xc8d5('0x16')](_0xc8d5('0x10'),_0xc8d5('0x17')),controller[_0xc8d5('0x18')]);router[_0xc8d5('0x15')]('/:id/tags',auth[_0xc8d5('0x4')](),controller[_0xc8d5('0x19')]);module[_0xc8d5('0x1a')]=router; \ No newline at end of file +var _0x89d9=['get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','mail','mailinteraction:addtags','put','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service'];(function(_0x9b2b9f,_0x32978b){var _0x55238a=function(_0x213196){while(--_0x213196){_0x9b2b9f['push'](_0x9b2b9f['shift']());}};_0x55238a(++_0x32978b);}(_0x89d9,0x135));var _0x989d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x89d9[_0x3e5086];return _0xfeb102;};'use strict';var express=require(_0x989d('0x0'));var router=express['Router']();var auth=require(_0x989d('0x1'));var interaction=require(_0x989d('0x2'));var controller=require('./mailInteraction.controller');router[_0x989d('0x3')]('/',auth[_0x989d('0x4')](),controller[_0x989d('0x5')]);router[_0x989d('0x3')](_0x989d('0x6'),auth[_0x989d('0x4')](),controller['describe']);router[_0x989d('0x3')](_0x989d('0x7'),auth[_0x989d('0x4')](),controller[_0x989d('0x8')]);router[_0x989d('0x3')](_0x989d('0x9'),auth[_0x989d('0x4')](),controller['getMessages']);router['get'](_0x989d('0xa'),auth[_0x989d('0x4')](),controller['download']);router[_0x989d('0xb')]('/',auth[_0x989d('0x4')](),controller[_0x989d('0xc')]);router[_0x989d('0xb')](_0x989d('0x9'),auth[_0x989d('0x4')](),controller[_0x989d('0xd')]);router[_0x989d('0xb')](_0x989d('0xe'),auth[_0x989d('0x4')](),interaction['tracked'](_0x989d('0xf'),_0x989d('0x10')),controller['addTags']);router[_0x989d('0x11')]('/:id',auth['isAuthenticated'](),interaction[_0x989d('0x12')](_0x989d('0xf'),_0x989d('0x13')),controller[_0x989d('0x14')]);router[_0x989d('0x15')](_0x989d('0x7'),auth[_0x989d('0x4')](),interaction[_0x989d('0x12')](_0x989d('0xf'),_0x989d('0x16')),controller[_0x989d('0x17')]);router[_0x989d('0x15')](_0x989d('0xe'),auth[_0x989d('0x4')](),controller[_0x989d('0x18')]);module[_0x989d('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 242afd6..9c3037c 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 _0x0f46=['out','iconv','DATE','STRING','TEXT','long','ENUM'];(function(_0x45a790,_0x1e1d61){var _0x296200=function(_0x2e7f28){while(--_0x2e7f28){_0x45a790['push'](_0x45a790['shift']());}};_0x296200(++_0x1e1d61);}(_0x0f46,0x1a5));var _0x60f4=function(_0x246a39,_0x28b4c6){_0x246a39=_0x246a39-0x0;var _0x4646ae=_0x0f46[_0x246a39];return _0x4646ae;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x60f4('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x60f4('0x1')]},'disposition':{'type':Sequelize[_0x60f4('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x60f4('0x2')]},'note':{'type':Sequelize[_0x60f4('0x2')]},'inReplyTo':{'type':Sequelize[_0x60f4('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x60f4('0x3')](_0x60f4('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x60f4('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x60f4('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x60f4('0x5')]('in',_0x60f4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8d40=['BOOLEAN','DATE','out','sequelize','exports','STRING','TEXT','long'];(function(_0x532c51,_0x28e3b8){var _0x23382f=function(_0x2d4fc1){while(--_0x2d4fc1){_0x532c51['push'](_0x532c51['shift']());}};_0x23382f(++_0x28e3b8);}(_0x8d40,0x9b));var _0x08d4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8d40[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x08d4('0x0'));var iconv=require('iconv');module[_0x08d4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x08d4('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x08d4('0x2')]},'inReplyTo':{'type':Sequelize[_0x08d4('0x2')](0x1fe)},'to':{'type':Sequelize[_0x08d4('0x2')]},'cc':{'type':Sequelize[_0x08d4('0x3')](_0x08d4('0x4'))},'subject':{'type':Sequelize[_0x08d4('0x3')]()},'attach':{'type':Sequelize[_0x08d4('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x08d4('0x6')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x08d4('0x6')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x08d4('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x08d4('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 1399866..ba65bac 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 _0x2f74=['compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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.MailAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','unreadMessages','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.subject','i.secondDisposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','ui.MailInteractionId\x20IN\x20?','Setting','enableEmailPreview','push','rows','show','params','keys','intersection','includeAll','include','options','create','body','destroy','describe','addMessage','ids','getMessages','nolimit','pick','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','subject','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','readFileSync','build','writeFileSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','squel','juice','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','map','fullname','TagIds','Tags','forEach','MailMessage','findOne','out','plainBody','-id','trimStart','catch','answered','unmanaged','closed','waiting','UserId','talking','index','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','having','Contact','value','split','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','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','some'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2f74,0x7b));var _0x42f7=function(_0x3ff97b,_0x459934){_0x3ff97b=_0x3ff97b-0x0;var _0x43ab91=_0x2f74[_0x3ff97b];return _0x43ab91;};'use strict';var emlformat=require(_0x42f7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x42f7('0x1'));var moment=require(_0x42f7('0x2'));var BPromise=require(_0x42f7('0x3'));var util=require(_0x42f7('0x4'));var path=require(_0x42f7('0x5'));var fs=require('fs');var _=require(_0x42f7('0x6'));var squel=require(_0x42f7('0x7'));var juice=require(_0x42f7('0x8'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var logger=require(_0x42f7('0x9'))(_0x42f7('0xa'));var config=require(_0x42f7('0xb'));var db=require(_0x42f7('0xc'))['db'];var htmlEntities=require(_0x42f7('0xd'));config[_0x42f7('0xe')]=_[_0x42f7('0xf')](config[_0x42f7('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x42f7('0x10'))(new Redis(config[_0x42f7('0xe')]));require(_0x42f7('0x11'))[_0x42f7('0x12')](socket);function respondWithStatusCode(_0x1f56d2,_0x45a404){_0x45a404=_0x45a404||0xcc;return function(_0x4cb597){if(_0x4cb597){return _0x1f56d2[_0x42f7('0x13')](_0x45a404);}return _0x1f56d2[_0x42f7('0x14')](_0x45a404)[_0x42f7('0x15')]();};}function respondWithResult(_0x3770e8,_0x159c7a){_0x159c7a=_0x159c7a||0xc8;return function(_0x406f85){if(_0x406f85){return _0x3770e8[_0x42f7('0x14')](_0x159c7a)[_0x42f7('0x16')](_0x406f85);}};}function respondWithFilteredResult(_0x4ed9ad,_0x545625){return function(_0x32ab1e){if(_0x32ab1e){var _0xc274ff=typeof _0x545625[_0x42f7('0x17')]===_0x42f7('0x18')&&typeof _0x545625[_0x42f7('0x19')]==='undefined';var _0x344b85=_0x32ab1e['count'];var _0x3e7fd8=_0xc274ff?0x0:_0x545625[_0x42f7('0x17')];var _0x16d842=_0xc274ff?_0x32ab1e[_0x42f7('0x1a')]:_0x545625[_0x42f7('0x17')]+_0x545625[_0x42f7('0x19')];var _0x1ca5ab;if(_0x16d842>=_0x344b85){_0x16d842=_0x344b85;_0x1ca5ab=0xc8;}else{_0x1ca5ab=0xce;}_0x4ed9ad['status'](_0x1ca5ab);return _0x4ed9ad[_0x42f7('0x1b')](_0x42f7('0x1c'),_0x3e7fd8+'-'+_0x16d842+'/'+_0x344b85)[_0x42f7('0x16')](_0x32ab1e);}return null;};}function saveUpdates(_0x61517a){return function(_0x334fc2){if(_0x334fc2){return _0x334fc2[_0x42f7('0x1d')](_0x61517a)['then'](function(_0x2b1910){return _0x2b1910;});}return null;};}function removeEntity(_0x4f0fe4){return function(_0x1ae649){if(_0x1ae649){return _0x1ae649['destroy']()[_0x42f7('0x1e')](function(){_0x4f0fe4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48c679){return function(_0x2592cb){if(!_0x2592cb){_0x48c679[_0x42f7('0x13')](0x194);}return _0x2592cb;};}function handleError(_0x3a04db,_0x2a755a){_0x2a755a=_0x2a755a||0x1f4;return function(_0x419ad0){logger[_0x42f7('0x1f')](_0x419ad0[_0x42f7('0x20')]);if(_0x419ad0[_0x42f7('0x21')]){delete _0x419ad0[_0x42f7('0x21')];}_0x3a04db[_0x42f7('0x14')](_0x2a755a)[_0x42f7('0x22')](_0x419ad0);};}function getInteractionUsers(_0xd6093d,_0x3afb26){return new BPromise(function(_0x44a0cf,_0x553531){try{if(_0x3afb26[_0xd6093d['id']]){_0xd6093d['Users']=_[_0x42f7('0x23')](_0x3afb26[_0xd6093d['id']],function(_0x35f941){return{'id':_0x35f941['id'],'fullname':_0x35f941[_0x42f7('0x24')]};});}}catch(_0x3bb6bc){_0x553531(_0x3bb6bc);}_0x44a0cf(_0xd6093d);});}function getInteractionTags(_0x1e31de,_0x3e0808){return new BPromise(function(_0x8b64e5,_0x64859){try{if(_0x1e31de[_0x42f7('0x25')]){_0x1e31de[_0x42f7('0x26')]=[];_0x1e31de['TagIds']['split'](',')[_0x42f7('0x27')](function(_0x1b0977){_0x1e31de[_0x42f7('0x26')]['push'](_0x3e0808[_0x1b0977]);});}delete _0x1e31de[_0x42f7('0x25')];}catch(_0x2eed6c){_0x64859(_0x2eed6c);}_0x8b64e5(_0x1e31de);});}function getLastMessageText(_0x57a227){return new BPromise(function(_0x59e2ca,_0x36e6d4){return db[_0x42f7('0x28')][_0x42f7('0x29')]({'where':{'$and':[{'MailInteractionId':_0x57a227['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x42f7('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x42f7('0x2b')],'order':_0x42f7('0x2c'),'raw':!![]})[_0x42f7('0x1e')](function(_0x304c10){if(_0x304c10&&_0x304c10[_0x42f7('0x2b')]){_0x57a227['lastMsgText']=_[_0x42f7('0x2d')](_0x304c10[_0x42f7('0x2b')]);}_0x59e2ca(_0x57a227);})[_0x42f7('0x2e')](function(_0xd26ccf){_0x36e6d4(_0xd26ccf);});});}function updateMailInteraction(_0x1ac7e0,_0x5aa45f,_0x27db26,_0x229323){return new BPromise(function(_0x45629b,_0x310872){return getInteractionUsers(_0x1ac7e0,_0x27db26)['then'](function(_0x3ef7a8){return getInteractionTags(_0x3ef7a8,_0x5aa45f);})['then'](function(_0x25007e){return getStateInteraction(_0x25007e);})[_0x42f7('0x1e')](function(_0xec377d){if(_0x229323){_0x45629b(getLastMessageText(_0xec377d));}else{_0x45629b(_0xec377d);}})[_0x42f7('0x2e')](function(_0x14cae3){_0x310872(_0x14cae3);});});}function getStateInteraction(_0x22a45b){return new BPromise(function(_0x372a20){_0x22a45b['waiting']=0x0;_0x22a45b['talking']=0x0;_0x22a45b[_0x42f7('0x2f')]=0x0;_0x22a45b[_0x42f7('0x30')]=0x0;_0x22a45b['total']=0x0;if(!_0x22a45b[_0x42f7('0x31')]&&!_0x22a45b['UserId']){_0x22a45b[_0x42f7('0x32')]+=0x1;}if(!_0x22a45b[_0x42f7('0x31')]&&_0x22a45b['UserId']){_0x22a45b['talking']+=0x1;if(_0x22a45b['waiting']){_0x22a45b[_0x42f7('0x32')]-=0x1;}}if(_0x22a45b['closed']&&_0x22a45b[_0x42f7('0x33')]){_0x22a45b[_0x42f7('0x2f')]+=0x1;if(_0x22a45b[_0x42f7('0x34')]){_0x22a45b[_0x42f7('0x34')]-=0x1;}}if(_0x22a45b[_0x42f7('0x31')]&&!_0x22a45b['UserId']){_0x22a45b[_0x42f7('0x30')]+=0x1;if(_0x22a45b[_0x42f7('0x32')]){_0x22a45b['waiting']-=0x1;}}_0x22a45b['total']+=0x1;_0x372a20(_0x22a45b);});}exports[_0x42f7('0x35')]=function(_0x164553,_0x33bf56){var _0x2204a1={},_0xaa39b4={},_0x14dd48={'count':0x0,'rows':[]};var _0x52e321=_[_0x42f7('0x23')](db['MailInteraction'][_0x42f7('0x36')],function(_0x468818){return{'name':_0x468818[_0x42f7('0x37')],'type':_0x468818['type'][_0x42f7('0x38')]};});_0xaa39b4['model']=_[_0x42f7('0x23')](_0x52e321,_0x42f7('0x21'));_0xaa39b4[_0x42f7('0x39')]=_['keys'](_0x164553[_0x42f7('0x39')]);_0xaa39b4[_0x42f7('0x3a')]=_['intersection'](_0xaa39b4[_0x42f7('0x3b')],_0xaa39b4['query']);_0x2204a1[_0x42f7('0x3c')]=_['intersection'](_0xaa39b4[_0x42f7('0x3b')],qs[_0x42f7('0x3d')](_0x164553['query'][_0x42f7('0x3d')]));_0x2204a1[_0x42f7('0x3c')]=_0x2204a1['attributes'][_0x42f7('0x3e')]?_0x2204a1[_0x42f7('0x3c')]:_0xaa39b4[_0x42f7('0x3b')];if(!_0x164553[_0x42f7('0x39')][_0x42f7('0x3f')]('nolimit')){_0x2204a1[_0x42f7('0x19')]=qs['limit'](_0x164553[_0x42f7('0x39')][_0x42f7('0x19')]);_0x2204a1[_0x42f7('0x17')]=qs[_0x42f7('0x17')](_0x164553['query'][_0x42f7('0x17')]);}_0x2204a1[_0x42f7('0x40')]=qs[_0x42f7('0x41')](_0x164553[_0x42f7('0x39')][_0x42f7('0x41')]);_0x2204a1[_0x42f7('0x42')]=qs['filters'](_['pick'](_0x164553[_0x42f7('0x39')],_0xaa39b4[_0x42f7('0x3a')]),_0x52e321);var _0x4c5bac=[];var _0x2ec174=squel[_0x42f7('0x43')]()[_0x42f7('0x44')]('id')[_0x42f7('0x44')](_0x42f7('0x21'))[_0x42f7('0x44')](_0x42f7('0x45'))[_0x42f7('0x46')](_0x42f7('0x47'));var _0x5334fe=squel[_0x42f7('0x43')]()[_0x42f7('0x44')](_0x42f7('0x48'))[_0x42f7('0x44')](_0x42f7('0x49'))[_0x42f7('0x44')](_0x42f7('0x4a'))[_0x42f7('0x46')]('user_has_mail_interactions','ui')[_0x42f7('0x4b')](_0x42f7('0x4c'),'u',_0x42f7('0x4d'));var _0x1cdb5e=squel[_0x42f7('0x43')]()[_0x42f7('0x46')]('mail_interactions','i')[_0x42f7('0x4b')](_0x42f7('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x42f7('0x4b')]('users','o',_0x42f7('0x4f'))[_0x42f7('0x4b')](_0x42f7('0x50'),'a','a.id\x20=\x20i.MailAccountId')[_0x42f7('0x4b')](_0x42f7('0x51'),'me','me.MailInteractionId\x20=\x20i.id')[_0x42f7('0x4b')](_0x42f7('0x52'),'it',_0x42f7('0x53'))[_0x42f7('0x4b')](_0x42f7('0x47'),'t',_0x42f7('0x54'));var _0x15dcd5=squel[_0x42f7('0x55')]();var _0x4c2b35=[];var _0x17838d=squel[_0x42f7('0x55')]();var _0x61642d;if(_0x164553[_0x42f7('0x39')]['search']){_0x61642d=as[_0x42f7('0x56')](_0x164553['query'][_0x42f7('0x57')]);var _0x1b75e4=_0x61642d[_0x42f7('0x58')];for(var _0x29199d=0x0;_0x29199d<_0x61642d[_0x42f7('0x59')][_0x42f7('0x3e')];_0x29199d++){var _0x35d6b5=_0x61642d[_0x42f7('0x59')][_0x29199d];var _0x515158='i';var _0x2cae0c=_[_0x42f7('0x5a')](_0x52e321,['name',_0x35d6b5['field']]);if(!_0x2cae0c){switch(_0x35d6b5[_0x42f7('0x44')]){case'unreadMessages':if(_0x35d6b5['value']==0x1){_0x1cdb5e[_0x42f7('0x5b')]('`'+_0x35d6b5[_0x42f7('0x44')]+'`\x20=\x200');}else{_0x1cdb5e['having']('`'+_0x35d6b5[_0x42f7('0x44')]+'`\x20>\x200');}break;case _0x42f7('0x5c'):if(_0x35d6b5['operator']==='$substring'){if(_0x35d6b5[_0x42f7('0x5d')][_0x42f7('0x5e')]('\x20')['length']>0x1){_0x15dcd5[_0x1b75e4]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x42f7('0x5f')](_0x35d6b5[_0x42f7('0x5d')]),null);}else{var _0x49029d='%'+_0x35d6b5[_0x42f7('0x5d')]+'%';_0x15dcd5[_0x1b75e4](_0x42f7('0x60'),_0x49029d,_0x49029d,_0x49029d);}}else{_0x2cae0c=_[_0x42f7('0x5a')](_0x52e321,[_0x42f7('0x21'),_0x42f7('0x61')]);_0x35d6b5['field']=_0x42f7('0x61');_0x4f8907=as['buildExpression'](_0x515158,_0x2cae0c[_0x42f7('0x62')],_0x35d6b5);_0x15dcd5[_0x1b75e4](_0x4f8907[_0x42f7('0x63')],_0x4f8907[_0x42f7('0x5d')][_0x42f7('0x64')],_0x4f8907[_0x42f7('0x5d')][_0x42f7('0x15')]);}break;case _0x42f7('0x65'):var _0x4f817c=_0x35d6b5[_0x42f7('0x5d')][_0x42f7('0x5e')](',')['map'](function(_0x469ecd){return Number(_0x469ecd);});_0x4f817c[_0x42f7('0x27')](function(_0x3312c3){_0x17838d['or'](_0x42f7('0x66'),'%,'+_0x3312c3+',%');});_0x4c2b35=_['union'](_0x4c2b35,_0x4f817c);break;case _0x42f7('0x67'):if(_0x35d6b5['operator']===_0x42f7('0x68')){_0x15dcd5[_0x1b75e4](_0x42f7('0x69'),'%'+_0x35d6b5['value']+'%',null);}else{_0x2cae0c=_[_0x42f7('0x5a')](_0x52e321,[_0x42f7('0x21'),_0x42f7('0x33')]);_0x35d6b5[_0x42f7('0x44')]=_0x42f7('0x33');_0x4f8907=as[_0x42f7('0x6a')](_0x515158,_0x2cae0c[_0x42f7('0x62')],_0x35d6b5);_0x15dcd5[_0x1b75e4](_0x4f8907['text'],_0x4f8907[_0x42f7('0x5d')][_0x42f7('0x64')],_0x4f8907[_0x42f7('0x5d')]['end']);}break;case _0x42f7('0x2b'):_0x4f8907=as['buildExpression']('me',null,_0x35d6b5);_0x15dcd5[_0x1b75e4](_0x4f8907[_0x42f7('0x63')],_0x4f8907['value']['start'],_0x4f8907['value'][_0x42f7('0x15')]);break;}}else{var _0x4f8907=as[_0x42f7('0x6a')](_0x515158,_0x2cae0c[_0x42f7('0x62')],_0x35d6b5);_0x15dcd5[_0x1b75e4](_0x4f8907['text'],_0x4f8907['value'][_0x42f7('0x64')],_0x4f8907['value'][_0x42f7('0x15')]);}}}else{var _0x5a0f2d=_(_0x164553[_0x42f7('0x39')])['keys']()[_0x42f7('0x23')](function(_0x3969a9){return _[_0x42f7('0x6b')](_0x52e321,[_0x42f7('0x21'),_0x3969a9])?_0x3969a9:undefined;})[_0x42f7('0x6c')]()[_0x42f7('0x5d')]();if(!_[_0x42f7('0x6d')](_0x5a0f2d)){_0x5a0f2d['forEach'](function(_0x631f1e){if(_0x631f1e===_0x42f7('0x6e')){_0x1cdb5e[_0x42f7('0x42')](_0x42f7('0x6f'),[]['concat'](_0x164553[_0x42f7('0x39')][_0x631f1e]));}else if(_0x631f1e===_0x42f7('0x70')){var _0x3c98a3=JSON['parse'](_0x164553[_0x42f7('0x39')][_0x631f1e])[_0x42f7('0x71')];var _0x2ffd57=JSON['parse'](_0x164553[_0x42f7('0x39')][_0x631f1e])['$lte'];_0x1cdb5e[_0x42f7('0x42')](_0x42f7('0x72'),_0x3c98a3,_0x2ffd57);}else{if(_0x164553[_0x42f7('0x39')][_0x631f1e]===_0x42f7('0x73')){_0x1cdb5e[_0x42f7('0x42')]('i.'+_0x631f1e+_0x42f7('0x74'));}else{_0x1cdb5e[_0x42f7('0x42')]('i.'+_0x631f1e+_0x42f7('0x75'),_0x164553[_0x42f7('0x39')][_0x631f1e]);}}});}if(_0x164553['query']['read']){if(_0x164553[_0x42f7('0x39')][_0x42f7('0x76')]==0x1){_0x1cdb5e['having'](_0x42f7('0x77'));}else{_0x1cdb5e['having'](_0x42f7('0x78'));}}if(_0x164553['query'][_0x42f7('0x79')]){_0x4c2b35=_[_0x42f7('0x7a')](_0x164553['query']['tag'])?_0x164553['query'][_0x42f7('0x79')]:new Array(_0x164553['query'][_0x42f7('0x79')]);_0x4c2b35[_0x42f7('0x27')](function(_0x2a9ef7){_0x17838d['or'](_0x42f7('0x66'),'%,'+_0x2a9ef7+',%');});}if(_0x164553[_0x42f7('0x39')][_0x42f7('0x7b')]){var _0x43a950=_0x164553[_0x42f7('0x39')]['filter'][_0x42f7('0x7c')]('\x5c','\x5c\x5c')[_0x42f7('0x7c')](/'/g,'\x27\x27');if(qs[_0x42f7('0x7d')](_0x43a950)){_0x15dcd5['or'](_0x42f7('0x7e'),_0x43a950+'%');}else if(qs['isEmail'](_0x43a950)){_0x15dcd5['or'](_0x42f7('0x7f'),_0x43a950+'%');}else{_0x15dcd5['or'](_0x42f7('0x80'),qs['getFullTextValue'](_0x43a950))['or'](_0x42f7('0x81'),qs[_0x42f7('0x5f')](_0x43a950));}}}_0x1cdb5e[_0x42f7('0x42')](_0x15dcd5);_0x1cdb5e['group'](_0x42f7('0x82'));var _0x242e02={'type':db[_0x42f7('0x83')][_0x42f7('0x84')][_0x42f7('0x85')],'raw':!![]};var _0x338653=_0x1cdb5e[_0x42f7('0x86')]();_0x338653[_0x42f7('0x44')](_0x42f7('0x82'));_0x338653['field'](_0x42f7('0x87'),'unreadMessages');if(_0x2204a1[_0x42f7('0x40')]){_0x2204a1[_0x42f7('0x40')][_0x42f7('0x27')](function(_0xa68d81){var _0x3d9896=_0xa68d81[0x0]===_0x42f7('0x88')?_0xa68d81[0x0]:'i.'+_0xa68d81[0x0];_0x1cdb5e[_0x42f7('0x40')](_0x3d9896,_0xa68d81[0x1]===_0x42f7('0x89')?![]:!![]);});}if(!_[_0x42f7('0x6d')](_0x4c2b35)){_0x1cdb5e['having'](_0x17838d);_0x338653[_0x42f7('0x42')](_0x42f7('0x8a'),_0x4c2b35);}BPromise[_0x42f7('0x8b')]()[_0x42f7('0x1e')](function(){if(!_0x61642d){if(_0x164553[_0x42f7('0x39')]['MailAccountId'])return;_0x338653[_0x42f7('0x42')](_0x42f7('0x8c'));_0x1cdb5e[_0x42f7('0x42')](_0x42f7('0x8c'));return;}if(_0x164553['user'][_0x42f7('0x8d')]!==_0x42f7('0x8e'))return;return _0x164553[_0x42f7('0x8f')][_0x42f7('0x90')]({'attributes':['id'],'raw':!![]})[_0x42f7('0x1e')](function(_0x57b632){if(_[_0x42f7('0x6d')](_0x57b632)){_0x338653[_0x42f7('0x42')](_0x42f7('0x91'));_0x1cdb5e[_0x42f7('0x42')](_0x42f7('0x91'));}else{_0x338653[_0x42f7('0x42')](_0x42f7('0x6f'),_[_0x42f7('0x23')](_0x57b632,'id'));_0x1cdb5e[_0x42f7('0x42')]('i.MailAccountId\x20IN\x20?',_[_0x42f7('0x23')](_0x57b632,'id'));}});})['then'](function(){if(_0x164553[_0x42f7('0x8f')][_0x42f7('0x8d')]===_0x42f7('0x8e')&&!_0x61642d&&!_0x164553[_0x42f7('0x39')][_0x42f7('0x6e')])return[];return db[_0x42f7('0x92')][_0x42f7('0x39')](_0x338653[_0x42f7('0x93')](),_0x242e02);})[_0x42f7('0x1e')](function(_0x2ef131){_0x14dd48[_0x42f7('0x1a')]=_0x2ef131[_0x42f7('0x3e')];if(_0x14dd48[_0x42f7('0x1a')]===0x0)return[];return db[_0x42f7('0x92')][_0x42f7('0x39')](_0x2ec174[_0x42f7('0x93')](),_0x242e02)['then'](function(_0x4e8408){_0x4c5bac=_[_0x42f7('0x94')](_0x4e8408,'id');_0x242e02=_[_0x42f7('0x95')](_0x242e02,{'model':db[_0x42f7('0x96')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x164553[_0x42f7('0x39')]['fields']){_0x2204a1['attributes'][_0x42f7('0x27')](function(_0x2b15e2){_0x1cdb5e[_0x42f7('0x44')]('i.'+_0x2b15e2);});}else{_0x1cdb5e[_0x42f7('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x42f7('0x97'));_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0x98'),'Account.key');_0x1cdb5e['field'](_0x42f7('0x99'),_0x42f7('0x9a'));_0x1cdb5e[_0x42f7('0x44')]('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',_0x42f7('0x88'));_0x1cdb5e['field']('i.id');_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0x9b'));_0x1cdb5e['field']('i.updatedAt');_0x1cdb5e['field']('i.closed');_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0x9c'));_0x1cdb5e[_0x42f7('0x44')]('i.attach');_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0x9d'));_0x1cdb5e['field'](_0x42f7('0x9e'));_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0x9f'));_0x1cdb5e[_0x42f7('0x44')]('i.disposition');_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0xa0'));_0x1cdb5e['field'](_0x42f7('0xa1'));_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0xa2'));_0x1cdb5e[_0x42f7('0x44')]('i.to');_0x1cdb5e['field'](_0x42f7('0xa3'));_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0xa4'));_0x1cdb5e[_0x42f7('0x44')]('i.UserId');_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0xa5'),_0x42f7('0xa6'));_0x1cdb5e['field']('c.lastName',_0x42f7('0xa7'));_0x1cdb5e[_0x42f7('0x44')]('c.email',_0x42f7('0xa8'));_0x1cdb5e['field'](_0x42f7('0xa9'),_0x42f7('0xaa'));_0x1cdb5e['field'](_0x42f7('0xab'),_0x42f7('0xac'));_0x1cdb5e[_0x42f7('0x44')]('c.fax',_0x42f7('0xad'));_0x1cdb5e[_0x42f7('0x44')](_0x42f7('0xae'),_0x42f7('0xaf'));_0x1cdb5e[_0x42f7('0x44')]('o.internal',_0x42f7('0xb0'));_0x1cdb5e[_0x42f7('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x42f7('0x25'));}if(_0x2204a1['limit'])_0x1cdb5e[_0x42f7('0x19')](_0x2204a1[_0x42f7('0x19')]);if(_0x2204a1[_0x42f7('0x17')])_0x1cdb5e[_0x42f7('0x17')](_0x2204a1[_0x42f7('0x17')]);return db[_0x42f7('0x92')][_0x42f7('0x39')](_0x1cdb5e['toString'](),_0x242e02);})[_0x42f7('0x1e')](function(_0x2c7dc2){if(_0x2c7dc2[_0x42f7('0x3e')]>0x0)_0x5334fe[_0x42f7('0x42')](_0x42f7('0xb1'),_[_0x42f7('0x23')](_0x2c7dc2,'id'));return db[_0x42f7('0x92')][_0x42f7('0x39')](_0x5334fe[_0x42f7('0x93')](),_0x242e02)['then'](function(_0x12250e){var _0x59546e=_['groupBy'](_0x12250e,'MailInteractionId');var _0x197947=[];return db[_0x42f7('0xb2')][_0x42f7('0x29')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0x42f7('0x1e')](function(_0x3c95a3){var _0x504113=_0x3c95a3[_0x42f7('0xb3')];_0x2c7dc2['forEach'](function(_0x5b91d1){_0x197947[_0x42f7('0xb4')](updateMailInteraction(_0x5b91d1,_0x4c5bac,_0x59546e,_0x504113));});return BPromise['all'](_0x197947);});});});})[_0x42f7('0x1e')](function(_0x15c607){_0x14dd48[_0x42f7('0xb5')]=_0x15c607;return _0x14dd48;})[_0x42f7('0x1e')](respondWithFilteredResult(_0x33bf56,_0x2204a1))[_0x42f7('0x2e')](handleError(_0x33bf56,null));};exports[_0x42f7('0xb6')]=function(_0x56a050,_0x56b03e){var _0x1a323e={'raw':![],'where':{'id':_0x56a050[_0x42f7('0xb7')]['id']}},_0x14bf6b={};_0x14bf6b['model']=_[_0x42f7('0xb8')](db['MailInteraction'][_0x42f7('0x36')]);_0x14bf6b['query']=_[_0x42f7('0xb8')](_0x56a050[_0x42f7('0x39')]);_0x14bf6b[_0x42f7('0x3a')]=_['intersection'](_0x14bf6b[_0x42f7('0x3b')],_0x14bf6b[_0x42f7('0x39')]);_0x1a323e[_0x42f7('0x3c')]=_[_0x42f7('0xb9')](_0x14bf6b[_0x42f7('0x3b')],qs[_0x42f7('0x3d')](_0x56a050[_0x42f7('0x39')][_0x42f7('0x3d')]));_0x1a323e[_0x42f7('0x3c')]=_0x1a323e['attributes'][_0x42f7('0x3e')]?_0x1a323e[_0x42f7('0x3c')]:_0x14bf6b[_0x42f7('0x3b')];if(_0x56a050['query'][_0x42f7('0xba')]){_0x1a323e[_0x42f7('0xbb')]=[{'all':!![]}];}_0x1a323e=_[_0x42f7('0x95')]({},_0x1a323e,_0x56a050[_0x42f7('0xbc')]);return db[_0x42f7('0x96')][_0x42f7('0x5a')](_0x1a323e)[_0x42f7('0x1e')](handleEntityNotFound(_0x56b03e,null))[_0x42f7('0x1e')](respondWithResult(_0x56b03e,null))[_0x42f7('0x2e')](handleError(_0x56b03e,null));};exports[_0x42f7('0xbd')]=function(_0x45f164,_0x47ee41){return db[_0x42f7('0x96')][_0x42f7('0xbd')](_0x45f164[_0x42f7('0xbe')],{})['then'](respondWithResult(_0x47ee41,0xc9))['catch'](handleError(_0x47ee41,null));};exports[_0x42f7('0x1d')]=function(_0x4426e1,_0x1faf61){if(_0x4426e1[_0x42f7('0xbe')]['id']){delete _0x4426e1[_0x42f7('0xbe')]['id'];}return db['MailInteraction'][_0x42f7('0x5a')]({'where':{'id':_0x4426e1[_0x42f7('0xb7')]['id']}})[_0x42f7('0x1e')](handleEntityNotFound(_0x1faf61,null))['then'](saveUpdates(_0x4426e1[_0x42f7('0xbe')],null))[_0x42f7('0x1e')](respondWithResult(_0x1faf61,null))[_0x42f7('0x2e')](handleError(_0x1faf61,null));};exports[_0x42f7('0xbf')]=function(_0x91cfdb,_0x171f82){return db[_0x42f7('0x96')]['find']({'where':{'id':_0x91cfdb[_0x42f7('0xb7')]['id']}})[_0x42f7('0x1e')](handleEntityNotFound(_0x171f82,null))[_0x42f7('0x1e')](removeEntity(_0x171f82,null))['catch'](handleError(_0x171f82,null));};exports[_0x42f7('0xc0')]=function(_0x2147f5,_0x4db287){return db['MailInteraction']['describe']()[_0x42f7('0x1e')](respondWithResult(_0x4db287,null))['catch'](handleError(_0x4db287,null));};exports[_0x42f7('0xc1')]=function(_0x301e71,_0x119b99){return db[_0x42f7('0x28')][_0x42f7('0x5a')]({'where':{'id':_0x301e71['params']['id']}})['then'](handleEntityNotFound(_0x119b99,null))[_0x42f7('0x1e')](function(_0x862c12){if(_0x862c12){return _0x862c12[_0x42f7('0xc1')](_0x301e71['body']['ids'],_['omit'](_0x301e71[_0x42f7('0xbe')],[_0x42f7('0xc2'),'id'])||{});}})[_0x42f7('0x1e')](respondWithResult(_0x119b99,null))[_0x42f7('0x2e')](handleError(_0x119b99,null));};exports[_0x42f7('0xc3')]=function(_0x4d5d59,_0x173020){var _0x4dbfd6={'raw':![],'where':{}};var _0x27d39e={};var _0x4449d7={'count':0x0,'rows':[]};return db[_0x42f7('0x96')]['findOne']({'where':{'id':_0x4d5d59[_0x42f7('0xb7')]['id']}})[_0x42f7('0x1e')](handleEntityNotFound(_0x173020,null))[_0x42f7('0x1e')](function(_0x313964){if(_0x313964){_0x27d39e[_0x42f7('0x3b')]=_[_0x42f7('0xb8')](db[_0x42f7('0x28')][_0x42f7('0x36')]);_0x27d39e['query']=_[_0x42f7('0xb8')](_0x4d5d59['query']);_0x27d39e[_0x42f7('0x3a')]=_[_0x42f7('0xb9')](_0x27d39e[_0x42f7('0x3b')],_0x27d39e[_0x42f7('0x39')]);_0x4dbfd6['attributes']=_['intersection'](_0x27d39e[_0x42f7('0x3b')],qs[_0x42f7('0x3d')](_0x4d5d59[_0x42f7('0x39')][_0x42f7('0x3d')]));_0x4dbfd6[_0x42f7('0x3c')]=_0x4dbfd6[_0x42f7('0x3c')][_0x42f7('0x3e')]?_0x4dbfd6[_0x42f7('0x3c')]:_0x27d39e['model'];if(!_0x4d5d59[_0x42f7('0x39')][_0x42f7('0x3f')](_0x42f7('0xc4'))){_0x4dbfd6['limit']=qs['limit'](_0x4d5d59[_0x42f7('0x39')][_0x42f7('0x19')]);_0x4dbfd6['offset']=qs[_0x42f7('0x17')](_0x4d5d59[_0x42f7('0x39')]['offset']);}_0x4dbfd6['order']=qs[_0x42f7('0x41')](_0x4d5d59[_0x42f7('0x39')][_0x42f7('0x41')]);_0x4dbfd6[_0x42f7('0x42')]=qs[_0x42f7('0x3a')](_[_0x42f7('0xc5')](_0x4d5d59[_0x42f7('0x39')],_0x27d39e[_0x42f7('0x3a')]));_0x4dbfd6[_0x42f7('0x42')][_0x42f7('0xc6')]=_0x313964['id'];if(_0x4d5d59[_0x42f7('0x39')][_0x42f7('0x7b')]){_0x4dbfd6[_0x42f7('0x42')]=_['merge'](_0x4dbfd6['where'],{'$or':_[_0x42f7('0x23')](_0x4dbfd6[_0x42f7('0x3c')],function(_0x3eed5d){var _0x541a02={};_0x541a02[_0x3eed5d]={'$like':'%'+_0x4d5d59[_0x42f7('0x39')]['filter']+'%'};return _0x541a02;})});}if(_0x4d5d59['query'][_0x42f7('0x71')]){var _0x2eea22=_0x4d5d59[_0x42f7('0x39')]['$gte'][_0x42f7('0x5e')](',');var _0x1a5e9f={};_0x1a5e9f[_0x2eea22[0x0]]={'$gte':moment(_0x2eea22[0x1])[_0x42f7('0xc7')](_0x42f7('0xc8'))};_0x4dbfd6[_0x42f7('0x42')]=_[_0x42f7('0x95')](_0x4dbfd6[_0x42f7('0x42')],_0x1a5e9f);}_0x4dbfd6=_[_0x42f7('0x95')]({},_0x4dbfd6,_0x4d5d59[_0x42f7('0xbc')]);return db[_0x42f7('0x28')][_0x42f7('0x1a')]({'where':_0x4dbfd6[_0x42f7('0x42')]})[_0x42f7('0x1e')](function(_0xaaf7a7){_0x4449d7[_0x42f7('0x1a')]=_0xaaf7a7;if(_0x4d5d59[_0x42f7('0x39')][_0x42f7('0xba')]){_0x4dbfd6['include']=[{'all':!![]}];}return db[_0x42f7('0x28')][_0x42f7('0xc9')](_0x4dbfd6);})[_0x42f7('0x1e')](function(_0x18d85d){if(_0x4d5d59['query']['inlineCss']==='true'){for(var _0x1f8bb5=0x0;_0x1f8bb5<_0x18d85d[_0x42f7('0x3e')];_0x1f8bb5++){_0x18d85d[_0x1f8bb5]['body']=juice(_0x18d85d[_0x1f8bb5][_0x42f7('0xbe')]);}}_0x4449d7[_0x42f7('0xb5')]=_0x18d85d;return _0x4449d7;});}})[_0x42f7('0x1e')](respondWithFilteredResult(_0x173020,_0x4dbfd6))[_0x42f7('0x2e')](handleError(_0x173020,null));};exports[_0x42f7('0xca')]=function(_0x549f38,_0x50932d){return db[_0x42f7('0x96')]['find']({'where':{'id':_0x549f38[_0x42f7('0xb7')]['id']}})['then'](handleEntityNotFound(_0x50932d,null))[_0x42f7('0x1e')](function(_0xcec1a3){if(_0xcec1a3){return _0xcec1a3[_0x42f7('0xcb')](_0x549f38[_0x42f7('0xbe')]['ids'],_[_0x42f7('0xcc')](_0x549f38[_0x42f7('0xbe')],[_0x42f7('0xc2'),'id'])||{})[_0x42f7('0xcd')](function(){return db[_0x42f7('0x65')]['findAll']({'attributes':['id',_0x42f7('0x21'),_0x42f7('0x45')],'where':{'id':_0x549f38[_0x42f7('0xbe')]['ids']}});})['then'](function(_0x5498be){socket['emit'](_0x42f7('0xce'),{'id':Number(_0x549f38[_0x42f7('0xb7')]['id']),'tags':_0x5498be||[]});return{'id':Number(_0x549f38[_0x42f7('0xb7')]['id']),'tags':_0x5498be||[]};});}})[_0x42f7('0x1e')](respondWithResult(_0x50932d,null))[_0x42f7('0x2e')](handleError(_0x50932d,null));};exports[_0x42f7('0xcf')]=function(_0x16ec39,_0x2c2501){return db['MailInteraction'][_0x42f7('0x5a')]({'where':{'id':_0x16ec39[_0x42f7('0xb7')]['id']}})[_0x42f7('0x1e')](handleEntityNotFound(_0x2c2501,null))[_0x42f7('0x1e')](function(_0x4c5812){if(_0x4c5812){return _0x4c5812[_0x42f7('0xcf')](_0x16ec39['query'][_0x42f7('0xc2')]);}})[_0x42f7('0x1e')](respondWithStatusCode(_0x2c2501,null))['catch'](handleError(_0x2c2501,null));};exports[_0x42f7('0xd0')]=function(_0x178ceb,_0x2b2f22){var _0x2533ec=moment()[_0x42f7('0xd1')]()[_0x42f7('0x93')]();var _0x559155=path[_0x42f7('0xd2')](config[_0x42f7('0xd3')],_0x42f7('0xd4'),'files',_0x42f7('0xd5'));var _0x33df76=path['join'](config[_0x42f7('0xd3')],'server','files','attachments');var _0x456ba5=path['join'](_0x559155,_0x2533ec);var _0x309431=util['format'](_0x42f7('0xd6'),_0x178ceb['params']['id'],_0x2533ec);var _0x474053=path[_0x42f7('0xd2')](_0x559155,_0x309431);var _0x4858a6=[];if(_0x178ceb[_0x42f7('0x39')][_0x42f7('0xd7')]){_0x4858a6[_0x42f7('0xb4')]({'model':db[_0x42f7('0xd8')],'as':_0x42f7('0xd9'),'raw':!![]});}var _0x57fd76=[{'model':db[_0x42f7('0x28')],'as':_0x42f7('0xda'),'attributes':['id','body',_0x42f7('0x46'),'to','cc','bcc',_0x42f7('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0x42f7('0x41')]('id'),'include':_0x4858a6}];return db[_0x42f7('0x96')][_0x42f7('0x5a')]({'where':{'id':_0x178ceb['params']['id']},'include':_0x57fd76})[_0x42f7('0x1e')](handleEntityNotFound(_0x2b2f22,null))[_0x42f7('0x1e')](function(_0x2809c3){if(_0x2809c3&&_0x2809c3['Messages']){var _0x5f1206=_0x2809c3[_0x42f7('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x456ba5);return BPromise[_0x42f7('0xdd')](_0x5f1206[_0x42f7('0xda')],function(_0x2a7eb4,_0x168dda){var _0x5b9ae5={'from':_0x2a7eb4['from'],'to':_0x2a7eb4['to'],'subject':_0x2a7eb4['subject'],'html':htmlEntities[_0x42f7('0xde')](_0x2a7eb4[_0x42f7('0xbe')]),'headers':{'Date':moment(_0x2a7eb4[_0x42f7('0x70')])[_0x42f7('0xc7')](_0x42f7('0xdf'))},'attachments':[]};if(_0x2a7eb4['cc']){_0x5b9ae5[_0x42f7('0xe0')]['Cc']=_0x2a7eb4['cc'];}if(_0x2a7eb4[_0x42f7('0xe1')]){_0x5b9ae5[_0x42f7('0xe0')][_0x42f7('0xe2')]=_0x2a7eb4['bcc'];}return new BPromise(function(_0x58cdf8,_0x5badc7){if(_0x2a7eb4['Attachments']){for(var _0x3eb636=0x0;_0x3eb636<_0x2a7eb4[_0x42f7('0xd9')][_0x42f7('0x3e')];_0x3eb636++){var _0x549810=_0x2a7eb4[_0x42f7('0xd9')][_0x3eb636];var _0x343e37=path[_0x42f7('0xd2')](_0x33df76,_0x549810[_0x42f7('0xe3')]);if(fs['existsSync'](_0x343e37)){_0x5b9ae5[_0x42f7('0xd7')][_0x42f7('0xb4')]({'name':_0x549810[_0x42f7('0x21')],'contentType':_0x549810[_0x42f7('0x62')],'data':fs[_0x42f7('0xe4')](_0x343e37)});}}}emlformat[_0x42f7('0xe5')](_0x5b9ae5,function(_0x2bdd90,_0x461eb2){if(_0x2bdd90)return _0x5badc7(_0x2bdd90);fs[_0x42f7('0xe6')](path['join'](_0x456ba5,util[_0x42f7('0xc7')]('message%d.eml',_0x168dda)),_0x461eb2);return _0x58cdf8(_0x461eb2);});});})[_0x42f7('0x1e')](function(){return new BPromise(function(_0x4654ef,_0x4dd19b){zipdir(_0x456ba5,{'saveTo':_0x474053},function(_0x30e8ff,_0x3c695b){if(_0x30e8ff)return _0x4dd19b(_0x30e8ff);return _0x4654ef(_0x3c695b);});})[_0x42f7('0x1e')](function(){return new BPromise(function(_0x579c46,_0x357183){rimraf(_0x456ba5,function(_0xed6746){if(_0xed6746)_0x357183(_0xed6746);return _0x579c46();});});})[_0x42f7('0x1e')](function(){return _0x2b2f22[_0x42f7('0xd0')](_0x474053,_0x309431,function(_0x4f0c5c){if(!_0x4f0c5c)fs['unlinkSync'](_0x474053);});});});}else{return _0x2b2f22[_0x42f7('0x13')](0xc8);}})[_0x42f7('0x2e')](handleError(_0x2b2f22,null));}; \ No newline at end of file +var _0x446c=['`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','isNumeric','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)','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.thirdDisposition','i.substatus','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.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.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','rows','show','includeAll','include','MailInteraction','create','body','describe','addMessage','ids','omit','getMessages','params','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','spread','Tag','emit','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','get','mkdirSync','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','path','lodash','juice','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','MailMessage','findOne','out','plainBody','-id','trimStart','catch','waiting','talking','total','closed','UserId','unmanaged','index','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','nolimit','order','sort','where','filters','field','color','from','tools_tags','select','u.id','ui.MailInteractionId','left_join','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','operator','$substring','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','some','isEmpty','i.MailAccountId\x20IN\x20?','concat','parse','$gte','$lte','\x20IS\x20NULL','\x20=\x20?','read'];(function(_0x1a80bb,_0x14f9f1){var _0x58dc79=function(_0x113ef8){while(--_0x113ef8){_0x1a80bb['push'](_0x1a80bb['shift']());}};_0x58dc79(++_0x14f9f1);}(_0x446c,0x156));var _0xc446=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x446c[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0xc446('0x0'));var rimraf=require(_0xc446('0x1'));var zipdir=require(_0xc446('0x2'));var moment=require(_0xc446('0x3'));var BPromise=require('bluebird');var util=require(_0xc446('0x4'));var path=require(_0xc446('0x5'));var fs=require('fs');var _=require(_0xc446('0x6'));var squel=require('squel');var juice=require(_0xc446('0x7'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var as=require(_0xc446('0x8'));var logger=require(_0xc446('0x9'))('api');var config=require('../../config/environment');var db=require(_0xc446('0xa'))['db'];var htmlEntities=require(_0xc446('0xb'));config[_0xc446('0xc')]=_[_0xc446('0xd')](config[_0xc446('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc446('0xe'))(new Redis(config[_0xc446('0xc')]));require(_0xc446('0xf'))[_0xc446('0x10')](socket);function respondWithStatusCode(_0x5e225d,_0x242a0d){_0x242a0d=_0x242a0d||0xcc;return function(_0xbb2f6f){if(_0xbb2f6f){return _0x5e225d[_0xc446('0x11')](_0x242a0d);}return _0x5e225d[_0xc446('0x12')](_0x242a0d)[_0xc446('0x13')]();};}function respondWithResult(_0x6a5c0f,_0x1a2099){_0x1a2099=_0x1a2099||0xc8;return function(_0x19083f){if(_0x19083f){return _0x6a5c0f[_0xc446('0x12')](_0x1a2099)[_0xc446('0x14')](_0x19083f);}};}function respondWithFilteredResult(_0x89a7,_0x306814){return function(_0x1cfc0a){if(_0x1cfc0a){var _0x72faac=typeof _0x306814[_0xc446('0x15')]===_0xc446('0x16')&&typeof _0x306814[_0xc446('0x17')]===_0xc446('0x16');var _0x2b09db=_0x1cfc0a['count'];var _0x3ba115=_0x72faac?0x0:_0x306814[_0xc446('0x15')];var _0x412678=_0x72faac?_0x1cfc0a[_0xc446('0x18')]:_0x306814[_0xc446('0x15')]+_0x306814[_0xc446('0x17')];var _0x146be5;if(_0x412678>=_0x2b09db){_0x412678=_0x2b09db;_0x146be5=0xc8;}else{_0x146be5=0xce;}_0x89a7[_0xc446('0x12')](_0x146be5);return _0x89a7[_0xc446('0x19')](_0xc446('0x1a'),_0x3ba115+'-'+_0x412678+'/'+_0x2b09db)['json'](_0x1cfc0a);}return null;};}function saveUpdates(_0x19c4d8){return function(_0x278b21){if(_0x278b21){return _0x278b21['update'](_0x19c4d8)[_0xc446('0x1b')](function(_0x16b806){return _0x16b806;});}return null;};}function removeEntity(_0x42a338){return function(_0x434c94){if(_0x434c94){return _0x434c94[_0xc446('0x1c')]()[_0xc446('0x1b')](function(){_0x42a338[_0xc446('0x12')](0xcc)[_0xc446('0x13')]();});}};}function handleEntityNotFound(_0x218b2b){return function(_0x3eda0f){if(!_0x3eda0f){_0x218b2b['sendStatus'](0x194);}return _0x3eda0f;};}function handleError(_0x35aedc,_0x1ea08b){_0x1ea08b=_0x1ea08b||0x1f4;return function(_0x21dc0e){logger[_0xc446('0x1d')](_0x21dc0e[_0xc446('0x1e')]);if(_0x21dc0e[_0xc446('0x1f')]){delete _0x21dc0e[_0xc446('0x1f')];}_0x35aedc[_0xc446('0x12')](_0x1ea08b)[_0xc446('0x20')](_0x21dc0e);};}function getInteractionUsers(_0x189ee7,_0x3dc2e0){return new BPromise(function(_0x3b1748,_0x25f58d){try{if(_0x3dc2e0[_0x189ee7['id']]){_0x189ee7[_0xc446('0x21')]=_[_0xc446('0x22')](_0x3dc2e0[_0x189ee7['id']],function(_0x1d1585){return{'id':_0x1d1585['id'],'fullname':_0x1d1585[_0xc446('0x23')]};});}}catch(_0x51933d){_0x25f58d(_0x51933d);}_0x3b1748(_0x189ee7);});}function getInteractionTags(_0xb3ab06,_0x24943b){return new BPromise(function(_0x3b0adf,_0x2e5d8d){try{if(_0xb3ab06[_0xc446('0x24')]){_0xb3ab06[_0xc446('0x25')]=[];_0xb3ab06['TagIds']['split'](',')[_0xc446('0x26')](function(_0x1b2dc8){_0xb3ab06[_0xc446('0x25')][_0xc446('0x27')](_0x24943b[_0x1b2dc8]);});}delete _0xb3ab06['TagIds'];}catch(_0x420fcb){_0x2e5d8d(_0x420fcb);}_0x3b0adf(_0xb3ab06);});}function getLastMessageText(_0x8d3429){return new BPromise(function(_0x3a308a,_0x16be29){return db[_0xc446('0x28')][_0xc446('0x29')]({'where':{'$and':[{'MailInteractionId':_0x8d3429['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xc446('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xc446('0x2b')],'order':_0xc446('0x2c'),'raw':!![]})[_0xc446('0x1b')](function(_0x4a1a8c){if(_0x4a1a8c&&_0x4a1a8c['plainBody']){_0x8d3429['lastMsgText']=_[_0xc446('0x2d')](_0x4a1a8c[_0xc446('0x2b')]);}_0x3a308a(_0x8d3429);})[_0xc446('0x2e')](function(_0x26c4b0){_0x16be29(_0x26c4b0);});});}function updateMailInteraction(_0x177752,_0x3244ab,_0x467d9c,_0x47cda3){return new BPromise(function(_0x1567ca,_0x12a69e){return getInteractionUsers(_0x177752,_0x467d9c)[_0xc446('0x1b')](function(_0x21bca6){return getInteractionTags(_0x21bca6,_0x3244ab);})[_0xc446('0x1b')](function(_0x510f39){return getStateInteraction(_0x510f39);})[_0xc446('0x1b')](function(_0x4595c0){if(_0x47cda3){_0x1567ca(getLastMessageText(_0x4595c0));}else{_0x1567ca(_0x4595c0);}})[_0xc446('0x2e')](function(_0x1b76c3){_0x12a69e(_0x1b76c3);});});}function getStateInteraction(_0x2c291c){return new BPromise(function(_0x1e4261){_0x2c291c[_0xc446('0x2f')]=0x0;_0x2c291c[_0xc446('0x30')]=0x0;_0x2c291c['answered']=0x0;_0x2c291c['unmanaged']=0x0;_0x2c291c[_0xc446('0x31')]=0x0;if(!_0x2c291c[_0xc446('0x32')]&&!_0x2c291c[_0xc446('0x33')]){_0x2c291c['waiting']+=0x1;}if(!_0x2c291c[_0xc446('0x32')]&&_0x2c291c[_0xc446('0x33')]){_0x2c291c[_0xc446('0x30')]+=0x1;if(_0x2c291c['waiting']){_0x2c291c['waiting']-=0x1;}}if(_0x2c291c['closed']&&_0x2c291c[_0xc446('0x33')]){_0x2c291c['answered']+=0x1;if(_0x2c291c[_0xc446('0x30')]){_0x2c291c[_0xc446('0x30')]-=0x1;}}if(_0x2c291c['closed']&&!_0x2c291c[_0xc446('0x33')]){_0x2c291c[_0xc446('0x34')]+=0x1;if(_0x2c291c[_0xc446('0x2f')]){_0x2c291c[_0xc446('0x2f')]-=0x1;}}_0x2c291c['total']+=0x1;_0x1e4261(_0x2c291c);});}exports[_0xc446('0x35')]=function(_0xb9c7e6,_0x56481d){var _0x30e61e={},_0x2f0228={},_0x43cf3e={'count':0x0,'rows':[]};var _0x28a8b6=_[_0xc446('0x22')](db['MailInteraction'][_0xc446('0x36')],function(_0x2dadd4){return{'name':_0x2dadd4[_0xc446('0x37')],'type':_0x2dadd4[_0xc446('0x38')][_0xc446('0x39')]};});_0x2f0228['model']=_[_0xc446('0x22')](_0x28a8b6,_0xc446('0x1f'));_0x2f0228[_0xc446('0x3a')]=_[_0xc446('0x3b')](_0xb9c7e6[_0xc446('0x3a')]);_0x2f0228['filters']=_[_0xc446('0x3c')](_0x2f0228['model'],_0x2f0228[_0xc446('0x3a')]);_0x30e61e[_0xc446('0x3d')]=_['intersection'](_0x2f0228[_0xc446('0x3e')],qs[_0xc446('0x3f')](_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x3f')]));_0x30e61e[_0xc446('0x3d')]=_0x30e61e[_0xc446('0x3d')]['length']?_0x30e61e[_0xc446('0x3d')]:_0x2f0228[_0xc446('0x3e')];if(!_0xb9c7e6[_0xc446('0x3a')]['hasOwnProperty'](_0xc446('0x40'))){_0x30e61e[_0xc446('0x17')]=qs[_0xc446('0x17')](_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x17')]);_0x30e61e[_0xc446('0x15')]=qs[_0xc446('0x15')](_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x15')]);}_0x30e61e[_0xc446('0x41')]=qs[_0xc446('0x42')](_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x42')]);_0x30e61e[_0xc446('0x43')]=qs[_0xc446('0x44')](_['pick'](_0xb9c7e6['query'],_0x2f0228[_0xc446('0x44')]),_0x28a8b6);var _0x4545e5=[];var _0x501424=squel['select']()['field']('id')['field'](_0xc446('0x1f'))[_0xc446('0x45')](_0xc446('0x46'))[_0xc446('0x47')](_0xc446('0x48'));var _0x146b7c=squel[_0xc446('0x49')]()[_0xc446('0x45')](_0xc446('0x4a'))[_0xc446('0x45')]('u.fullname')[_0xc446('0x45')](_0xc446('0x4b'))[_0xc446('0x47')]('user_has_mail_interactions','ui')[_0xc446('0x4c')]('users','u',_0xc446('0x4d'));var _0x17d9bf=squel[_0xc446('0x49')]()[_0xc446('0x47')](_0xc446('0x4e'),'i')['left_join'](_0xc446('0x4f'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc446('0x4c')]('users','o',_0xc446('0x50'))['left_join'](_0xc446('0x51'),'a',_0xc446('0x52'))['left_join']('mail_messages','me',_0xc446('0x53'))['left_join'](_0xc446('0x54'),'it',_0xc446('0x55'))[_0xc446('0x4c')](_0xc446('0x48'),'t',_0xc446('0x56'));var _0x3e1574=squel[_0xc446('0x57')]();var _0x4b0827=[];var _0x2aa67d=squel[_0xc446('0x57')]();var _0x102c7d;if(_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x58')]){_0x102c7d=as[_0xc446('0x59')](_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x58')]);var _0x28bd62=_0x102c7d[_0xc446('0x5a')];for(var _0x1616d4=0x0;_0x1616d4<_0x102c7d[_0xc446('0x5b')]['length'];_0x1616d4++){var _0x93969e=_0x102c7d[_0xc446('0x5b')][_0x1616d4];var _0x303f59='i';var _0xba94a8=_['find'](_0x28a8b6,['name',_0x93969e[_0xc446('0x45')]]);if(!_0xba94a8){switch(_0x93969e['field']){case _0xc446('0x5c'):if(_0x93969e[_0xc446('0x5d')]==0x1){_0x17d9bf[_0xc446('0x5e')]('`'+_0x93969e['field']+_0xc446('0x5f'));}else{_0x17d9bf[_0xc446('0x5e')]('`'+_0x93969e[_0xc446('0x45')]+'`\x20>\x200');}break;case'Contact':if(_0x93969e[_0xc446('0x60')]===_0xc446('0x61')){if(_0x93969e[_0xc446('0x5d')][_0xc446('0x62')]('\x20')[_0xc446('0x63')]>0x1){_0x3e1574[_0x28bd62](_0xc446('0x64'),qs[_0xc446('0x65')](_0x93969e[_0xc446('0x5d')]),null);}else{var _0x35ba56='%'+_0x93969e[_0xc446('0x5d')]+'%';_0x3e1574[_0x28bd62](_0xc446('0x66'),_0x35ba56,_0x35ba56,_0x35ba56);}}else{_0xba94a8=_['find'](_0x28a8b6,['name','ContactId']);_0x93969e['field']='ContactId';_0x52db50=as[_0xc446('0x67')](_0x303f59,_0xba94a8[_0xc446('0x38')],_0x93969e);_0x3e1574[_0x28bd62](_0x52db50[_0xc446('0x68')],_0x52db50[_0xc446('0x5d')][_0xc446('0x69')],_0x52db50['value'][_0xc446('0x13')]);}break;case'Tag':var _0x3cec25=_0x93969e[_0xc446('0x5d')][_0xc446('0x62')](',')['map'](function(_0x1e4fa4){return Number(_0x1e4fa4);});_0x3cec25['forEach'](function(_0x22cf84){_0x2aa67d['or'](_0xc446('0x6a'),'%,'+_0x22cf84+',%');});_0x4b0827=_['union'](_0x4b0827,_0x3cec25);break;case _0xc446('0x6b'):if(_0x93969e[_0xc446('0x60')]===_0xc446('0x61')){_0x3e1574[_0x28bd62](_0xc446('0x6c'),'%'+_0x93969e['value']+'%',null);}else{_0xba94a8=_[_0xc446('0x6d')](_0x28a8b6,[_0xc446('0x1f'),_0xc446('0x33')]);_0x93969e[_0xc446('0x45')]='UserId';_0x52db50=as['buildExpression'](_0x303f59,_0xba94a8[_0xc446('0x38')],_0x93969e);_0x3e1574[_0x28bd62](_0x52db50[_0xc446('0x68')],_0x52db50[_0xc446('0x5d')][_0xc446('0x69')],_0x52db50[_0xc446('0x5d')][_0xc446('0x13')]);}break;case _0xc446('0x2b'):_0x52db50=as['buildExpression']('me',null,_0x93969e);_0x3e1574[_0x28bd62](_0x52db50[_0xc446('0x68')],_0x52db50[_0xc446('0x5d')][_0xc446('0x69')],_0x52db50['value']['end']);break;}}else{var _0x52db50=as['buildExpression'](_0x303f59,_0xba94a8['type'],_0x93969e);_0x3e1574[_0x28bd62](_0x52db50[_0xc446('0x68')],_0x52db50['value'][_0xc446('0x69')],_0x52db50[_0xc446('0x5d')][_0xc446('0x13')]);}}}else{var _0x908141=_(_0xb9c7e6[_0xc446('0x3a')])[_0xc446('0x3b')]()[_0xc446('0x22')](function(_0xbf8040){return _[_0xc446('0x6e')](_0x28a8b6,[_0xc446('0x1f'),_0xbf8040])?_0xbf8040:undefined;})['compact']()[_0xc446('0x5d')]();if(!_[_0xc446('0x6f')](_0x908141)){_0x908141[_0xc446('0x26')](function(_0x293441){if(_0x293441==='MailAccountId'){_0x17d9bf[_0xc446('0x43')](_0xc446('0x70'),[][_0xc446('0x71')](_0xb9c7e6[_0xc446('0x3a')][_0x293441]));}else if(_0x293441==='createdAt'){var _0x4d7cc5=JSON[_0xc446('0x72')](_0xb9c7e6[_0xc446('0x3a')][_0x293441])[_0xc446('0x73')];var _0x504082=JSON['parse'](_0xb9c7e6[_0xc446('0x3a')][_0x293441])[_0xc446('0x74')];_0x17d9bf[_0xc446('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4d7cc5,_0x504082);}else{if(_0xb9c7e6[_0xc446('0x3a')][_0x293441]==='null'){_0x17d9bf[_0xc446('0x43')]('i.'+_0x293441+_0xc446('0x75'));}else{_0x17d9bf[_0xc446('0x43')]('i.'+_0x293441+_0xc446('0x76'),_0xb9c7e6[_0xc446('0x3a')][_0x293441]);}}});}if(_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x77')]){if(_0xb9c7e6['query'][_0xc446('0x77')]==0x1){_0x17d9bf[_0xc446('0x5e')](_0xc446('0x78'));}else{_0x17d9bf[_0xc446('0x5e')](_0xc446('0x79'));}}if(_0xb9c7e6['query']['tag']){_0x4b0827=_[_0xc446('0x7a')](_0xb9c7e6['query'][_0xc446('0x7b')])?_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x7b')]:new Array(_0xb9c7e6[_0xc446('0x3a')]['tag']);_0x4b0827[_0xc446('0x26')](function(_0xd309ce){_0x2aa67d['or'](_0xc446('0x6a'),'%,'+_0xd309ce+',%');});}if(_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x7c')]){var _0x361a60=_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x7c')]['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc446('0x7d')](_0x361a60)){_0x3e1574['or']('i.id\x20LIKE\x20?',_0x361a60+'%');}else if(qs['isEmail'](_0x361a60)){_0x3e1574['or'](_0xc446('0x7e'),_0x361a60+'%');}else{_0x3e1574['or'](_0xc446('0x7f'),qs['getFullTextValue'](_0x361a60))['or'](_0xc446('0x80'),qs[_0xc446('0x65')](_0x361a60));}}}_0x17d9bf['where'](_0x3e1574);_0x17d9bf['group'](_0xc446('0x81'));var _0x164780={'type':db[_0xc446('0x82')][_0xc446('0x83')]['SELECT'],'raw':!![]};var _0x38ee5c=_0x17d9bf[_0xc446('0x84')]();_0x38ee5c[_0xc446('0x45')](_0xc446('0x81'));_0x38ee5c[_0xc446('0x45')](_0xc446('0x85'),_0xc446('0x5c'));if(_0x30e61e['order']){_0x30e61e[_0xc446('0x41')][_0xc446('0x26')](function(_0x16cc18){var _0x29431d=_0x16cc18[0x0]===_0xc446('0x86')?_0x16cc18[0x0]:'i.'+_0x16cc18[0x0];_0x17d9bf['order'](_0x29431d,_0x16cc18[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc446('0x6f')](_0x4b0827)){_0x17d9bf['having'](_0x2aa67d);_0x38ee5c['where'](_0xc446('0x87'),_0x4b0827);}BPromise[_0xc446('0x88')]()['then'](function(){if(!_0x102c7d){if(_0xb9c7e6['query'][_0xc446('0x89')])return;_0x38ee5c[_0xc446('0x43')](_0xc446('0x8a'));_0x17d9bf[_0xc446('0x43')](_0xc446('0x8a'));return;}if(_0xb9c7e6[_0xc446('0x8b')][_0xc446('0x8c')]!==_0xc446('0x8d'))return;return _0xb9c7e6[_0xc446('0x8b')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xc446('0x1b')](function(_0x20642f){if(_['isEmpty'](_0x20642f)){_0x38ee5c[_0xc446('0x43')](_0xc446('0x8e'));_0x17d9bf[_0xc446('0x43')](_0xc446('0x8e'));}else{_0x38ee5c[_0xc446('0x43')]('i.MailAccountId\x20IN\x20?',_['map'](_0x20642f,'id'));_0x17d9bf[_0xc446('0x43')](_0xc446('0x70'),_[_0xc446('0x22')](_0x20642f,'id'));}});})[_0xc446('0x1b')](function(){if(_0xb9c7e6[_0xc446('0x8b')][_0xc446('0x8c')]==='agent'&&!_0x102c7d&&!_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x89')])return[];return db[_0xc446('0x8f')][_0xc446('0x3a')](_0x38ee5c[_0xc446('0x90')](),_0x164780);})[_0xc446('0x1b')](function(_0x22acec){_0x43cf3e['count']=_0x22acec[_0xc446('0x63')];if(_0x43cf3e[_0xc446('0x18')]===0x0)return[];return db['sequelize'][_0xc446('0x3a')](_0x501424[_0xc446('0x90')](),_0x164780)['then'](function(_0x1b4858){_0x4545e5=_[_0xc446('0x91')](_0x1b4858,'id');_0x164780=_[_0xc446('0x92')](_0x164780,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb9c7e6[_0xc446('0x3a')][_0xc446('0x3f')]){_0x30e61e[_0xc446('0x3d')][_0xc446('0x26')](function(_0x4ef186){_0x17d9bf[_0xc446('0x45')]('i.'+_0x4ef186);});}else{_0x17d9bf['field'](_0xc446('0x85'),_0xc446('0x5c'));_0x17d9bf['field'](_0xc446('0x93'),_0xc446('0x94'));_0x17d9bf[_0xc446('0x45')](_0xc446('0x95'),'Account.mandatoryDisposition');_0x17d9bf['field'](_0xc446('0x96'),_0xc446('0x86'));_0x17d9bf[_0xc446('0x45')]('i.id');_0x17d9bf['field'](_0xc446('0x97'));_0x17d9bf[_0xc446('0x45')]('i.updatedAt');_0x17d9bf[_0xc446('0x45')](_0xc446('0x98'));_0x17d9bf['field'](_0xc446('0x99'));_0x17d9bf[_0xc446('0x45')]('i.attach');_0x17d9bf[_0xc446('0x45')](_0xc446('0x9a'));_0x17d9bf[_0xc446('0x45')](_0xc446('0x9b'));_0x17d9bf[_0xc446('0x45')]('i.subject');_0x17d9bf[_0xc446('0x45')](_0xc446('0x9c'));_0x17d9bf[_0xc446('0x45')]('i.secondDisposition');_0x17d9bf[_0xc446('0x45')](_0xc446('0x9d'));_0x17d9bf['field'](_0xc446('0x9e'));_0x17d9bf['field']('i.to');_0x17d9bf['field'](_0xc446('0x9f'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xa0'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xa1'));_0x17d9bf['field'](_0xc446('0xa2'),_0xc446('0xa3'));_0x17d9bf[_0xc446('0x45')]('c.lastName','Contact.lastName');_0x17d9bf[_0xc446('0x45')](_0xc446('0xa4'),'Contact.email');_0x17d9bf[_0xc446('0x45')](_0xc446('0xa5'),_0xc446('0xa6'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xa7'),_0xc446('0xa8'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xa9'),_0xc446('0xaa'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xab'),_0xc446('0xac'));_0x17d9bf[_0xc446('0x45')](_0xc446('0xad'),_0xc446('0xae'));_0x17d9bf['field'](_0xc446('0xaf'),'TagIds');}if(_0x30e61e['limit'])_0x17d9bf[_0xc446('0x17')](_0x30e61e['limit']);if(_0x30e61e['offset'])_0x17d9bf[_0xc446('0x15')](_0x30e61e[_0xc446('0x15')]);return db['sequelize']['query'](_0x17d9bf['toString'](),_0x164780);})[_0xc446('0x1b')](function(_0x327a43){if(_0x327a43[_0xc446('0x63')]>0x0)_0x146b7c[_0xc446('0x43')](_0xc446('0xb0'),_[_0xc446('0x22')](_0x327a43,'id'));return db['sequelize']['query'](_0x146b7c[_0xc446('0x90')](),_0x164780)[_0xc446('0x1b')](function(_0x3a4190){var _0x5633f7=_[_0xc446('0xb1')](_0x3a4190,_0xc446('0xb2'));var _0x3eb440=[];return db[_0xc446('0xb3')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0xc446('0x1b')](function(_0xaf19e2){var _0x404d50=_0xaf19e2[_0xc446('0xb4')];_0x327a43['forEach'](function(_0x35c756){_0x3eb440[_0xc446('0x27')](updateMailInteraction(_0x35c756,_0x4545e5,_0x5633f7,_0x404d50));});return BPromise['all'](_0x3eb440);});});});})[_0xc446('0x1b')](function(_0x2d3ccb){_0x43cf3e[_0xc446('0xb5')]=_0x2d3ccb;return _0x43cf3e;})[_0xc446('0x1b')](respondWithFilteredResult(_0x56481d,_0x30e61e))[_0xc446('0x2e')](handleError(_0x56481d,null));};exports[_0xc446('0xb6')]=function(_0x4f0c1a,_0x16951d){var _0x58559b={'raw':![],'where':{'id':_0x4f0c1a['params']['id']}},_0x2bb7ce={};_0x2bb7ce[_0xc446('0x3e')]=_[_0xc446('0x3b')](db['MailInteraction'][_0xc446('0x36')]);_0x2bb7ce[_0xc446('0x3a')]=_[_0xc446('0x3b')](_0x4f0c1a['query']);_0x2bb7ce[_0xc446('0x44')]=_[_0xc446('0x3c')](_0x2bb7ce[_0xc446('0x3e')],_0x2bb7ce[_0xc446('0x3a')]);_0x58559b[_0xc446('0x3d')]=_[_0xc446('0x3c')](_0x2bb7ce[_0xc446('0x3e')],qs[_0xc446('0x3f')](_0x4f0c1a[_0xc446('0x3a')]['fields']));_0x58559b[_0xc446('0x3d')]=_0x58559b[_0xc446('0x3d')][_0xc446('0x63')]?_0x58559b[_0xc446('0x3d')]:_0x2bb7ce[_0xc446('0x3e')];if(_0x4f0c1a['query'][_0xc446('0xb7')]){_0x58559b[_0xc446('0xb8')]=[{'all':!![]}];}_0x58559b=_[_0xc446('0x92')]({},_0x58559b,_0x4f0c1a['options']);return db[_0xc446('0xb9')][_0xc446('0x6d')](_0x58559b)[_0xc446('0x1b')](handleEntityNotFound(_0x16951d,null))[_0xc446('0x1b')](respondWithResult(_0x16951d,null))['catch'](handleError(_0x16951d,null));};exports[_0xc446('0xba')]=function(_0x58be42,_0x4cd32c){return db[_0xc446('0xb9')][_0xc446('0xba')](_0x58be42[_0xc446('0xbb')],{})[_0xc446('0x1b')](respondWithResult(_0x4cd32c,0xc9))[_0xc446('0x2e')](handleError(_0x4cd32c,null));};exports['update']=function(_0x3b48d1,_0x837497){if(_0x3b48d1[_0xc446('0xbb')]['id']){delete _0x3b48d1[_0xc446('0xbb')]['id'];}return db['MailInteraction'][_0xc446('0x6d')]({'where':{'id':_0x3b48d1['params']['id']}})[_0xc446('0x1b')](handleEntityNotFound(_0x837497,null))['then'](saveUpdates(_0x3b48d1[_0xc446('0xbb')],null))['then'](respondWithResult(_0x837497,null))[_0xc446('0x2e')](handleError(_0x837497,null));};exports['destroy']=function(_0x2702a8,_0x4fae73){return db[_0xc446('0xb9')][_0xc446('0x6d')]({'where':{'id':_0x2702a8['params']['id']}})[_0xc446('0x1b')](handleEntityNotFound(_0x4fae73,null))[_0xc446('0x1b')](removeEntity(_0x4fae73,null))[_0xc446('0x2e')](handleError(_0x4fae73,null));};exports[_0xc446('0xbc')]=function(_0x327e5a,_0x49bbe3){return db[_0xc446('0xb9')][_0xc446('0xbc')]()['then'](respondWithResult(_0x49bbe3,null))[_0xc446('0x2e')](handleError(_0x49bbe3,null));};exports[_0xc446('0xbd')]=function(_0x4a5e17,_0x4d0839){return db[_0xc446('0x28')][_0xc446('0x6d')]({'where':{'id':_0x4a5e17['params']['id']}})[_0xc446('0x1b')](handleEntityNotFound(_0x4d0839,null))[_0xc446('0x1b')](function(_0xbf5efe){if(_0xbf5efe){return _0xbf5efe[_0xc446('0xbd')](_0x4a5e17[_0xc446('0xbb')][_0xc446('0xbe')],_[_0xc446('0xbf')](_0x4a5e17[_0xc446('0xbb')],[_0xc446('0xbe'),'id'])||{});}})['then'](respondWithResult(_0x4d0839,null))[_0xc446('0x2e')](handleError(_0x4d0839,null));};exports[_0xc446('0xc0')]=function(_0x5e589b,_0x53c8c6){var _0x4d9f07={'raw':![],'where':{}};var _0x504384={};var _0x15d519={'count':0x0,'rows':[]};return db[_0xc446('0xb9')][_0xc446('0x29')]({'where':{'id':_0x5e589b[_0xc446('0xc1')]['id']}})['then'](handleEntityNotFound(_0x53c8c6,null))[_0xc446('0x1b')](function(_0x1fffd2){if(_0x1fffd2){_0x504384[_0xc446('0x3e')]=_['keys'](db[_0xc446('0x28')]['rawAttributes']);_0x504384[_0xc446('0x3a')]=_[_0xc446('0x3b')](_0x5e589b[_0xc446('0x3a')]);_0x504384['filters']=_[_0xc446('0x3c')](_0x504384[_0xc446('0x3e')],_0x504384['query']);_0x4d9f07['attributes']=_[_0xc446('0x3c')](_0x504384[_0xc446('0x3e')],qs[_0xc446('0x3f')](_0x5e589b[_0xc446('0x3a')][_0xc446('0x3f')]));_0x4d9f07['attributes']=_0x4d9f07[_0xc446('0x3d')][_0xc446('0x63')]?_0x4d9f07[_0xc446('0x3d')]:_0x504384[_0xc446('0x3e')];if(!_0x5e589b[_0xc446('0x3a')][_0xc446('0xc2')]('nolimit')){_0x4d9f07[_0xc446('0x17')]=qs[_0xc446('0x17')](_0x5e589b[_0xc446('0x3a')][_0xc446('0x17')]);_0x4d9f07[_0xc446('0x15')]=qs[_0xc446('0x15')](_0x5e589b[_0xc446('0x3a')][_0xc446('0x15')]);}_0x4d9f07[_0xc446('0x41')]=qs[_0xc446('0x42')](_0x5e589b[_0xc446('0x3a')][_0xc446('0x42')]);_0x4d9f07['where']=qs[_0xc446('0x44')](_[_0xc446('0xc3')](_0x5e589b[_0xc446('0x3a')],_0x504384[_0xc446('0x44')]));_0x4d9f07[_0xc446('0x43')][_0xc446('0xb2')]=_0x1fffd2['id'];if(_0x5e589b[_0xc446('0x3a')][_0xc446('0x7c')]){_0x4d9f07[_0xc446('0x43')]=_[_0xc446('0x92')](_0x4d9f07[_0xc446('0x43')],{'$or':_[_0xc446('0x22')](_0x4d9f07['attributes'],function(_0xd43296){var _0x182cb8={};_0x182cb8[_0xd43296]={'$like':'%'+_0x5e589b[_0xc446('0x3a')][_0xc446('0x7c')]+'%'};return _0x182cb8;})});}if(_0x5e589b[_0xc446('0x3a')]['$gte']){var _0x19b7a7=_0x5e589b[_0xc446('0x3a')]['$gte']['split'](',');var _0x57d39c={};_0x57d39c[_0x19b7a7[0x0]]={'$gte':moment(_0x19b7a7[0x1])[_0xc446('0xc4')](_0xc446('0xc5'))};_0x4d9f07[_0xc446('0x43')]=_[_0xc446('0x92')](_0x4d9f07[_0xc446('0x43')],_0x57d39c);}_0x4d9f07=_['merge']({},_0x4d9f07,_0x5e589b['options']);return db[_0xc446('0x28')][_0xc446('0x18')]({'where':_0x4d9f07[_0xc446('0x43')]})['then'](function(_0x3c1b30){_0x15d519[_0xc446('0x18')]=_0x3c1b30;if(_0x5e589b['query'][_0xc446('0xb7')]){_0x4d9f07['include']=[{'all':!![]}];}return db[_0xc446('0x28')][_0xc446('0xc6')](_0x4d9f07);})['then'](function(_0x59c6ce){if(_0x5e589b[_0xc446('0x3a')][_0xc446('0xc7')]===_0xc446('0xc8')){for(var _0x582bd2=0x0;_0x582bd2<_0x59c6ce[_0xc446('0x63')];_0x582bd2++){_0x59c6ce[_0x582bd2]['body']=juice(_0x59c6ce[_0x582bd2][_0xc446('0xbb')]);}}_0x15d519[_0xc446('0xb5')]=_0x59c6ce;return _0x15d519;});}})[_0xc446('0x1b')](respondWithFilteredResult(_0x53c8c6,_0x4d9f07))['catch'](handleError(_0x53c8c6,null));};exports[_0xc446('0xc9')]=function(_0xe0e7b9,_0x4cbbe0){return db[_0xc446('0xb9')][_0xc446('0x6d')]({'where':{'id':_0xe0e7b9[_0xc446('0xc1')]['id']}})[_0xc446('0x1b')](handleEntityNotFound(_0x4cbbe0,null))[_0xc446('0x1b')](function(_0x1ae574){if(_0x1ae574){return _0x1ae574[_0xc446('0xca')](_0xe0e7b9['body']['ids'],_[_0xc446('0xbf')](_0xe0e7b9[_0xc446('0xbb')],['ids','id'])||{})[_0xc446('0xcb')](function(){return db[_0xc446('0xcc')][_0xc446('0xc6')]({'attributes':['id','name',_0xc446('0x46')],'where':{'id':_0xe0e7b9['body'][_0xc446('0xbe')]}});})[_0xc446('0x1b')](function(_0xd2e008){socket[_0xc446('0xcd')]('mailInteractionTags:save',{'id':Number(_0xe0e7b9['params']['id']),'tags':_0xd2e008||[]});return{'id':Number(_0xe0e7b9['params']['id']),'tags':_0xd2e008||[]};});}})['then'](respondWithResult(_0x4cbbe0,null))[_0xc446('0x2e')](handleError(_0x4cbbe0,null));};exports['removeTags']=function(_0x4e4086,_0x2a0e10){return db[_0xc446('0xb9')]['find']({'where':{'id':_0x4e4086[_0xc446('0xc1')]['id']}})[_0xc446('0x1b')](handleEntityNotFound(_0x2a0e10,null))[_0xc446('0x1b')](function(_0x4199db){if(_0x4199db){return _0x4199db[_0xc446('0xce')](_0x4e4086[_0xc446('0x3a')][_0xc446('0xbe')]);}})['then'](respondWithStatusCode(_0x2a0e10,null))[_0xc446('0x2e')](handleError(_0x2a0e10,null));};exports[_0xc446('0xcf')]=function(_0x3dbd33,_0x364635){var _0xc116a6=moment()[_0xc446('0xd0')]()[_0xc446('0x90')]();var _0xbfc676=path[_0xc446('0xd1')](config[_0xc446('0xd2')],_0xc446('0xd3'),'files','tmp');var _0x5cf80b=path[_0xc446('0xd1')](config[_0xc446('0xd2')],_0xc446('0xd3'),_0xc446('0xd4'),'attachments');var _0x228586=path[_0xc446('0xd1')](_0xbfc676,_0xc116a6);var _0x20d3cb=util[_0xc446('0xc4')](_0xc446('0xd5'),_0x3dbd33[_0xc446('0xc1')]['id'],_0xc116a6);var _0x66d652=path[_0xc446('0xd1')](_0xbfc676,_0x20d3cb);var _0x47c012=[];if(_0x3dbd33[_0xc446('0x3a')][_0xc446('0xd6')]){_0x47c012[_0xc446('0x27')]({'model':db[_0xc446('0xd7')],'as':_0xc446('0xd8'),'raw':!![]});}var _0x50fadf=[{'model':db['MailMessage'],'as':_0xc446('0xd9'),'attributes':['id',_0xc446('0xbb'),'from','to','cc',_0xc446('0xda'),'subject','createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x47c012}];return db['MailInteraction'][_0xc446('0x6d')]({'where':{'id':_0x3dbd33['params']['id']},'include':_0x50fadf})[_0xc446('0x1b')](handleEntityNotFound(_0x364635,null))[_0xc446('0x1b')](function(_0x3a141e){if(_0x3a141e&&_0x3a141e[_0xc446('0xd9')]){var _0xd9d509=_0x3a141e[_0xc446('0xdb')]({'plain':!![]});fs[_0xc446('0xdc')](_0x228586);return BPromise['each'](_0xd9d509[_0xc446('0xd9')],function(_0x92e31e,_0x5cc310){var _0x200108={'from':_0x92e31e[_0xc446('0x47')],'to':_0x92e31e['to'],'subject':_0x92e31e[_0xc446('0xdd')],'html':htmlEntities['decode'](_0x92e31e[_0xc446('0xbb')]),'headers':{'Date':moment(_0x92e31e['createdAt'])['format'](_0xc446('0xde'))},'attachments':[]};if(_0x92e31e['cc']){_0x200108[_0xc446('0xdf')]['Cc']=_0x92e31e['cc'];}if(_0x92e31e[_0xc446('0xda')]){_0x200108[_0xc446('0xdf')][_0xc446('0xe0')]=_0x92e31e[_0xc446('0xda')];}return new BPromise(function(_0x1fc27f,_0x131b79){if(_0x92e31e['Attachments']){for(var _0x4eaca9=0x0;_0x4eaca9<_0x92e31e[_0xc446('0xd8')]['length'];_0x4eaca9++){var _0x5e64e3=_0x92e31e['Attachments'][_0x4eaca9];var _0x25054a=path['join'](_0x5cf80b,_0x5e64e3[_0xc446('0xe1')]);if(fs[_0xc446('0xe2')](_0x25054a)){_0x200108[_0xc446('0xd6')][_0xc446('0x27')]({'name':_0x5e64e3[_0xc446('0x1f')],'contentType':_0x5e64e3[_0xc446('0x38')],'data':fs[_0xc446('0xe3')](_0x25054a)});}}}emlformat['build'](_0x200108,function(_0x1753f5,_0x3dc942){if(_0x1753f5)return _0x131b79(_0x1753f5);fs[_0xc446('0xe4')](path[_0xc446('0xd1')](_0x228586,util[_0xc446('0xc4')](_0xc446('0xe5'),_0x5cc310)),_0x3dc942);return _0x1fc27f(_0x3dc942);});});})[_0xc446('0x1b')](function(){return new BPromise(function(_0x3e7658,_0x322c65){zipdir(_0x228586,{'saveTo':_0x66d652},function(_0x102e65,_0x323f2d){if(_0x102e65)return _0x322c65(_0x102e65);return _0x3e7658(_0x323f2d);});})[_0xc446('0x1b')](function(){return new BPromise(function(_0x93aa23,_0x40148e){rimraf(_0x228586,function(_0x453139){if(_0x453139)_0x40148e(_0x453139);return _0x93aa23();});});})[_0xc446('0x1b')](function(){return _0x364635[_0xc446('0xcf')](_0x66d652,_0x20d3cb,function(_0x1cda44){if(!_0x1cda44)fs[_0xc446('0xe6')](_0x66d652);});});});}else{return _0x364635[_0xc446('0x11')](0xc8);}})[_0xc446('0x2e')](handleError(_0x364635,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 1d38834..1b2cb3e 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 _0xab2e=['catch','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','then','setDataValue','Users','map','unreadMessages','length','emit'];(function(_0x47792b,_0x7bec64){var _0x9bd201=function(_0x4e82dc){while(--_0x4e82dc){_0x47792b['push'](_0x47792b['shift']());}};_0x9bd201(++_0x7bec64);}(_0xab2e,0x188));var _0xeab2=function(_0x2fdf3f,_0x31079e){_0x2fdf3f=_0x2fdf3f-0x0;var _0xc58ba=_0xab2e[_0x2fdf3f];return _0xc58ba;};'use strict';var EventEmitter=require(_0xeab2('0x0'));var MailInteraction=require(_0xeab2('0x1'))['db'][_0xeab2('0x2')];var MailMessage=require(_0xeab2('0x1'))['db'][_0xeab2('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xeab2('0x4')](0x0);var events={'afterCreate':_0xeab2('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x11b08c){return function(_0x1efbae,_0x1ad3ba,_0x49a51e){_0x1efbae['getUsers']({'attributes':['id'],'raw':!![]})[_0xeab2('0x6')](function(_0x16e3bb){_0x1efbae[_0xeab2('0x7')](_0xeab2('0x8'),_0x16e3bb[_0xeab2('0x9')](function(_0x50513b){return{'id':_0x50513b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1efbae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeab2('0x6')](function(_0x4918c9){_0x1efbae[_0xeab2('0x7')](_0xeab2('0xa'),_0x4918c9[_0xeab2('0xb')]);MailInteractionEvents['emit'](_0x11b08c+':'+_0x1efbae['id'],_0x1efbae);MailInteractionEvents[_0xeab2('0xc')](_0x11b08c,_0x1efbae);_0x49a51e(null);})[_0xeab2('0xd')](_0x49a51e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xeab2('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xa7a2=['MailInteraction','MailMessage','remove','getUsers','setDataValue','Users','findAll','then','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4ec6e2,_0x5b9e29){var _0x2dfda4=function(_0x1bdb39){while(--_0x1bdb39){_0x4ec6e2['push'](_0x4ec6e2['shift']());}};_0x2dfda4(++_0x5b9e29);}(_0xa7a2,0x11b));var _0x2a7a=function(_0x3c9e56,_0x54dc48){_0x3c9e56=_0x3c9e56-0x0;var _0x3b0a5c=_0xa7a2[_0x3c9e56];return _0x3b0a5c;};'use strict';var EventEmitter=require(_0x2a7a('0x0'));var MailInteraction=require(_0x2a7a('0x1'))['db'][_0x2a7a('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x2a7a('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2a7a('0x4')};function emitEvent(_0x5362a9){return function(_0x1c1c4f,_0x363603,_0x45fa43){_0x1c1c4f[_0x2a7a('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x46ae46){_0x1c1c4f[_0x2a7a('0x6')](_0x2a7a('0x7'),_0x46ae46['map'](function(_0x5ce57d){return{'id':_0x5ce57d['id']};}));return MailMessage[_0x2a7a('0x8')]({'where':{'MailInteractionId':_0x1c1c4f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2a7a('0x9')](function(_0xae070d){_0x1c1c4f[_0x2a7a('0x6')]('unreadMessages',_0xae070d[_0x2a7a('0xa')]);MailInteractionEvents[_0x2a7a('0xb')](_0x5362a9+':'+_0x1c1c4f['id'],_0x1c1c4f);MailInteractionEvents[_0x2a7a('0xb')](_0x5362a9,_0x1c1c4f);_0x45fa43(null);})[_0x2a7a('0xc')](_0x45fa43(null));};}for(var e in events){if(events[_0x2a7a('0xd')](e)){var event=events[e];MailInteraction[_0x2a7a('0xe')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 27f0de0..d2655c0 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 _0x68ac=['./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','MailMessage','update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x495af6,_0x4ea873){var _0x1a0cdc=function(_0x2f09df){while(--_0x2f09df){_0x495af6['push'](_0x495af6['shift']());}};_0x1a0cdc(++_0x4ea873);}(_0x68ac,0x85));var _0xc68a=function(_0x3f3ffb,_0x253e9c){_0x3f3ffb=_0x3f3ffb-0x0;var _0x49238a=_0x68ac[_0x3f3ffb];return _0x49238a;};'use strict';var _=require(_0xc68a('0x0'));var util=require(_0xc68a('0x1'));var logger=require(_0xc68a('0x2'))(_0xc68a('0x3'));var moment=require(_0xc68a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc68a('0x5'));var config=require(_0xc68a('0x6'));var attributes=require(_0xc68a('0x7'));module[_0xc68a('0x8')]=function(_0x3772cf,_0x245fd3){return _0x3772cf[_0xc68a('0x9')](_0xc68a('0xa'),attributes,{'tableName':_0xc68a('0xb'),'paranoid':![],'indexes':[{'name':_0xc68a('0xc'),'fields':[_0xc68a('0xd'),'to'],'type':_0xc68a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52ce2c,_0x51fe1c,_0x7d379){if(_0x52ce2c[_0xc68a('0xf')]){_0x52ce2c[_0xc68a('0x10')]=moment()[_0xc68a('0x11')](_0xc68a('0x12'));}if(_0x52ce2c[_0xc68a('0x13')]){_0x52ce2c['closedAt']=moment()[_0xc68a('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7d379(null,_0x51fe1c);},'beforeUpdate':function(_0x123cfd,_0x57b861,_0x2c600b){if(_0x123cfd[_0xc68a('0x14')](_0xc68a('0xf'))){_0x123cfd[_0xc68a('0x10')]=_0x123cfd[_0xc68a('0xf')]?moment()[_0xc68a('0x11')](_0xc68a('0x12')):null;}if(_0x123cfd[_0xc68a('0x14')]('closed')){_0x123cfd[_0xc68a('0x15')]=moment()[_0xc68a('0x11')](_0xc68a('0x12'));_0x123cfd[_0xc68a('0xf')]=null;_0x123cfd[_0xc68a('0x10')]=null;}_0x2c600b(null,_0x123cfd);},'afterUpdate':function(_0x494b37,_0x22a4c5,_0x1ba451){var _0x394d96=_0x3772cf[_0xc68a('0x16')];var _0x16a1e4=_0x494b37[_0xc68a('0x17')]({'plain':!![]});if(_0x16a1e4[_0xc68a('0x13')]){return _0x394d96[_0xc68a('0x18')][_0xc68a('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x16a1e4['id']}})['then'](function(){_0x1ba451();})['catch'](function(_0x5448ad){_0x1ba451(_0x5448ad);});}else{_0x1ba451();}}},'charset':_0xc68a('0x1a'),'collate':_0xc68a('0x1b')});}; \ No newline at end of file +var _0xee99=['closed','closedAt','format','changed','substatusAt','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','fti_mail_interactions','subject','FULLTEXT','substatus'];(function(_0x48a4a5,_0x4b8b15){var _0xb9fa9d=function(_0x2ea719){while(--_0x2ea719){_0x48a4a5['push'](_0x48a4a5['shift']());}};_0xb9fa9d(++_0x4b8b15);}(_0xee99,0x12f));var _0x9ee9=function(_0xed2a3d,_0xc2b5cc){_0xed2a3d=_0xed2a3d-0x0;var _0x31a5b3=_0xee99[_0xed2a3d];return _0x31a5b3;};'use strict';var _=require(_0x9ee9('0x0'));var util=require(_0x9ee9('0x1'));var logger=require(_0x9ee9('0x2'))(_0x9ee9('0x3'));var moment=require(_0x9ee9('0x4'));var BPromise=require(_0x9ee9('0x5'));var rp=require(_0x9ee9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ee9('0x7'));var config=require(_0x9ee9('0x8'));var attributes=require(_0x9ee9('0x9'));module['exports']=function(_0x38e0bb,_0x2bf21f){return _0x38e0bb[_0x9ee9('0xa')](_0x9ee9('0xb'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x9ee9('0xc'),'fields':[_0x9ee9('0xd'),'to'],'type':_0x9ee9('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x502540,_0x5d2389,_0x386477){if(_0x502540[_0x9ee9('0xf')]){_0x502540['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x502540[_0x9ee9('0x10')]){_0x502540[_0x9ee9('0x11')]=moment()[_0x9ee9('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x386477(null,_0x5d2389);},'beforeUpdate':function(_0x38da06,_0x51c048,_0x5d1144){if(_0x38da06[_0x9ee9('0x13')](_0x9ee9('0xf'))){_0x38da06[_0x9ee9('0x14')]=_0x38da06['substatus']?moment()[_0x9ee9('0x12')](_0x9ee9('0x15')):null;}if(_0x38da06[_0x9ee9('0x13')](_0x9ee9('0x10'))){_0x38da06[_0x9ee9('0x11')]=moment()['format'](_0x9ee9('0x15'));_0x38da06[_0x9ee9('0xf')]=null;_0x38da06[_0x9ee9('0x14')]=null;}_0x5d1144(null,_0x38da06);},'afterUpdate':function(_0x50085a,_0x227aa8,_0x37e173){var _0x2ee886=_0x38e0bb[_0x9ee9('0x16')];var _0x28c98a=_0x50085a[_0x9ee9('0x17')]({'plain':!![]});if(_0x28c98a[_0x9ee9('0x10')]){return _0x2ee886[_0x9ee9('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x28c98a['id']}})[_0x9ee9('0x19')](function(){_0x37e173();})[_0x9ee9('0x1a')](function(_0x169d7f){_0x37e173(_0x169d7f);});}else{_0x37e173();}}},'charset':_0x9ee9('0x1b'),'collate':_0x9ee9('0x1c')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ff0ca1d..ea35caf 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 _0x4760=['catch','MailInteraction','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','debug','stringify','AddTagsToMailInteraction','addTags','ids','omit','spread','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction,\x20%s,\x20%s','result'];(function(_0x3cbcb5,_0x493804){var _0x3714f7=function(_0x50bdf3){while(--_0x50bdf3){_0x3cbcb5['push'](_0x3cbcb5['shift']());}};_0x3714f7(++_0x493804);}(_0x4760,0xe8));var _0x0476=function(_0x187ff3,_0x24134f){_0x187ff3=_0x187ff3-0x0;var _0x335996=_0x4760[_0x187ff3];return _0x335996;};'use strict';var _=require(_0x0476('0x0'));var util=require(_0x0476('0x1'));var moment=require(_0x0476('0x2'));var BPromise=require(_0x0476('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0476('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0476('0x5'));var logger=require(_0x0476('0x6'))(_0x0476('0x7'));var config=require(_0x0476('0x8'));var jayson=require(_0x0476('0x9'));var client=jayson[_0x0476('0xa')][_0x0476('0xb')]({'port':0x232a});config[_0x0476('0xc')]=_[_0x0476('0xd')](config['redis'],{'host':_0x0476('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0476('0xf'))[_0x0476('0x10')](socket);function respondWithRpcPromise(_0x125102,_0x3128c4,_0x3aa2ba){return new BPromise(function(_0x4bf893,_0x47745a){return client['request'](_0x125102,_0x3aa2ba)[_0x0476('0x11')](function(_0x257a20){logger[_0x0476('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3128c4,_0x0476('0x13'));logger['debug'](_0x0476('0x14'),_0x3128c4,_0x0476('0x13'),JSON['stringify'](_0x257a20));if(_0x257a20[_0x0476('0x15')]){if(_0x257a20[_0x0476('0x15')][_0x0476('0x16')]===0x1f4){logger[_0x0476('0x15')]('MailInteraction,\x20%s,\x20%s',_0x3128c4,_0x257a20['error'][_0x0476('0x17')]);return _0x47745a(_0x257a20[_0x0476('0x15')][_0x0476('0x17')]);}logger[_0x0476('0x15')](_0x0476('0x18'),_0x3128c4,_0x257a20[_0x0476('0x15')][_0x0476('0x17')]);return _0x4bf893(_0x257a20[_0x0476('0x15')]['message']);}else{logger[_0x0476('0x12')](_0x0476('0x18'),_0x3128c4,'request\x20sent');_0x4bf893(_0x257a20[_0x0476('0x19')]['message']);}})[_0x0476('0x1a')](function(_0x27008d){logger[_0x0476('0x15')](_0x0476('0x18'),_0x3128c4,_0x27008d);_0x47745a(_0x27008d);});});}exports['UpdateMailInteraction']=function(_0x470b45){var _0x1878ed=this;return new Promise(function(_0x287d11,_0x13faae){return db[_0x0476('0x1b')][_0x0476('0x1c')](_0x470b45[_0x0476('0x1d')],{'raw':_0x470b45[_0x0476('0x1e')]?_0x470b45[_0x0476('0x1e')][_0x0476('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x470b45['options']?_0x470b45[_0x0476('0x1e')][_0x0476('0x20')]||null:null,'attributes':_0x470b45[_0x0476('0x1e')]?_0x470b45['options'][_0x0476('0x21')]||null:null,'limit':_0x470b45[_0x0476('0x1e')]?_0x470b45['options'][_0x0476('0x22')]||null:null})['then'](function(_0x4e504c){logger['info'](_0x0476('0x23'),_0x470b45);logger[_0x0476('0x24')](_0x0476('0x23'),_0x470b45,JSON[_0x0476('0x25')](_0x4e504c));_0x287d11(_0x4e504c);})['catch'](function(_0x204c81){logger[_0x0476('0x15')](_0x0476('0x23'),_0x204c81['message'],_0x470b45);_0x13faae(_0x1878ed['error'](0x1f4,_0x204c81[_0x0476('0x17')]));});});};exports[_0x0476('0x26')]=function(_0x232be7){return new Promise(function(_0x2dc573,_0x4988fd){return db[_0x0476('0x1b')]['find']({'where':_0x232be7[_0x0476('0x1e')]?_0x232be7[_0x0476('0x1e')]['where']||null:null})['then'](function(_0x3b8cc6){if(_0x3b8cc6){return _0x3b8cc6[_0x0476('0x27')](_0x232be7[_0x0476('0x1d')][_0x0476('0x28')],_[_0x0476('0x29')](_0x232be7[_0x0476('0x1d')],['ids','id'])||{});}})[_0x0476('0x2a')](function(_0x44134d){logger[_0x0476('0x12')]('AddTags',_0x232be7);logger[_0x0476('0x24')]('AddTags',_0x232be7,JSON[_0x0476('0x25')](_0x44134d));_0x2dc573(_0x44134d);})[_0x0476('0x1a')](function(_0x8a9b77){logger['error']('AddTags',_0x8a9b77[_0x0476('0x17')],_0x232be7);_0x4988fd(_this[_0x0476('0x15')](0x1f4,_0x8a9b77[_0x0476('0x17')]));});});}; \ No newline at end of file +var _0x5fa1=['code','message','request\x20sent','catch','body','options','raw','attributes','UpdateMailInteraction','AddTagsToMailInteraction','where','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','debug','stringify','error'];(function(_0x21d7a2,_0x5aecda){var _0x1da981=function(_0x4c86f2){while(--_0x4c86f2){_0x21d7a2['push'](_0x21d7a2['shift']());}};_0x1da981(++_0x5aecda);}(_0x5fa1,0xd2));var _0x15fa=function(_0x340791,_0x5236b0){_0x340791=_0x340791-0x0;var _0xcbabf5=_0x5fa1[_0x340791];return _0xcbabf5;};'use strict';var _=require(_0x15fa('0x0'));var util=require(_0x15fa('0x1'));var moment=require('moment');var BPromise=require(_0x15fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15fa('0x3'));var db=require(_0x15fa('0x4'))['db'];var utils=require(_0x15fa('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x15fa('0x6'));var jayson=require(_0x15fa('0x7'));var client=jayson[_0x15fa('0x8')][_0x15fa('0x9')]({'port':0x232a});config['redis']=_[_0x15fa('0xa')](config[_0x15fa('0xb')],{'host':_0x15fa('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x15fa('0xb')]));require(_0x15fa('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c56f2,_0x4b5d3d,_0x5f3ef9){return new BPromise(function(_0x295c95,_0x41d3e4){return client[_0x15fa('0xe')](_0x3c56f2,_0x5f3ef9)[_0x15fa('0xf')](function(_0x23e51c){logger[_0x15fa('0x10')](_0x15fa('0x11'),_0x4b5d3d,'request\x20sent');logger[_0x15fa('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4b5d3d,'request\x20sent',JSON[_0x15fa('0x13')](_0x23e51c));if(_0x23e51c[_0x15fa('0x14')]){if(_0x23e51c[_0x15fa('0x14')][_0x15fa('0x15')]===0x1f4){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4b5d3d,_0x23e51c[_0x15fa('0x14')][_0x15fa('0x16')]);return _0x41d3e4(_0x23e51c[_0x15fa('0x14')][_0x15fa('0x16')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x4b5d3d,_0x23e51c[_0x15fa('0x14')][_0x15fa('0x16')]);return _0x295c95(_0x23e51c[_0x15fa('0x14')]['message']);}else{logger[_0x15fa('0x10')]('MailInteraction,\x20%s,\x20%s',_0x4b5d3d,_0x15fa('0x17'));_0x295c95(_0x23e51c['result']['message']);}})[_0x15fa('0x18')](function(_0x326283){logger[_0x15fa('0x14')](_0x15fa('0x11'),_0x4b5d3d,_0x326283);_0x41d3e4(_0x326283);});});}exports['UpdateMailInteraction']=function(_0x399024){var _0x5bd382=this;return new Promise(function(_0x33940a,_0x4eee0a){return db['MailInteraction']['update'](_0x399024[_0x15fa('0x19')],{'raw':_0x399024[_0x15fa('0x1a')]?_0x399024['options'][_0x15fa('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399024[_0x15fa('0x1a')]?_0x399024[_0x15fa('0x1a')]['where']||null:null,'attributes':_0x399024[_0x15fa('0x1a')]?_0x399024[_0x15fa('0x1a')][_0x15fa('0x1c')]||null:null,'limit':_0x399024[_0x15fa('0x1a')]?_0x399024['options']['limit']||null:null})[_0x15fa('0xf')](function(_0x15973f){logger[_0x15fa('0x10')](_0x15fa('0x1d'),_0x399024);logger['debug']('UpdateMailInteraction',_0x399024,JSON[_0x15fa('0x13')](_0x15973f));_0x33940a(_0x15973f);})['catch'](function(_0x54919a){logger['error'](_0x15fa('0x1d'),_0x54919a[_0x15fa('0x16')],_0x399024);_0x4eee0a(_0x5bd382[_0x15fa('0x14')](0x1f4,_0x54919a[_0x15fa('0x16')]));});});};exports[_0x15fa('0x1e')]=function(_0x5618ee){return new Promise(function(_0x189cdf,_0x5634ac){return db['MailInteraction']['find']({'where':_0x5618ee[_0x15fa('0x1a')]?_0x5618ee[_0x15fa('0x1a')][_0x15fa('0x1f')]||null:null})[_0x15fa('0xf')](function(_0x2604a8){if(_0x2604a8){return _0x2604a8['addTags'](_0x5618ee[_0x15fa('0x19')]['ids'],_['omit'](_0x5618ee[_0x15fa('0x19')],['ids','id'])||{});}})['spread'](function(_0x1a4e0c){logger['info'](_0x15fa('0x20'),_0x5618ee);logger[_0x15fa('0x12')](_0x15fa('0x20'),_0x5618ee,JSON[_0x15fa('0x13')](_0x1a4e0c));_0x189cdf(_0x1a4e0c);})[_0x15fa('0x18')](function(_0x332d6e){logger[_0x15fa('0x14')]('AddTags',_0x332d6e[_0x15fa('0x16')],_0x5618ee);_0x5634ac(_this['error'](0x1f4,_0x332d6e[_0x15fa('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8728094..bf7e47e 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 _0x7768=['update','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save','remove'];(function(_0x42facb,_0x168820){var _0x4d8c9e=function(_0x431f7f){while(--_0x431f7f){_0x42facb['push'](_0x42facb['shift']());}};_0x4d8c9e(++_0x168820);}(_0x7768,0xe5));var _0x8776=function(_0x526bcd,_0x1668c9){_0x526bcd=_0x526bcd-0x0;var _0x2fcf3e=_0x7768[_0x526bcd];return _0x2fcf3e;};'use strict';var MailInteractionEvents=require(_0x8776('0x0'));var events=[_0x8776('0x1'),_0x8776('0x2'),_0x8776('0x3')];function createListener(_0x376ab5,_0x250831){return function(_0x4b7a47){_0x250831[_0x8776('0x4')](_0x376ab5,_0x4b7a47);};}function removeListener(_0xdd76a3,_0x12b099){return function(){MailInteractionEvents[_0x8776('0x5')](_0xdd76a3,_0x12b099);};}exports['register']=function(_0x5542a9){for(var _0x38ce28=0x0,_0x4ea3ab=events[_0x8776('0x6')];_0x38ce28<_0x4ea3ab;_0x38ce28++){var _0x477148=events[_0x38ce28];var _0x59e7ac=createListener(_0x8776('0x7')+_0x477148,_0x5542a9);MailInteractionEvents['on'](_0x477148,_0x59e7ac);}}; \ No newline at end of file +var _0x6c65=['register','./mailInteraction.events','remove','update','emit'];(function(_0x377b0e,_0x296bb1){var _0x9cbe9d=function(_0x8ee405){while(--_0x8ee405){_0x377b0e['push'](_0x377b0e['shift']());}};_0x9cbe9d(++_0x296bb1);}(_0x6c65,0xab));var _0x56c6=function(_0x2d5820,_0x52295c){_0x2d5820=_0x2d5820-0x0;var _0x46c501=_0x6c65[_0x2d5820];return _0x46c501;};'use strict';var MailInteractionEvents=require(_0x56c6('0x0'));var events=['save',_0x56c6('0x1'),_0x56c6('0x2')];function createListener(_0x510565,_0x2b0e07){return function(_0x3f3577){_0x2b0e07[_0x56c6('0x3')](_0x510565,_0x3f3577);};}function removeListener(_0x361745,_0x4f39e6){return function(){MailInteractionEvents['removeListener'](_0x361745,_0x4f39e6);};}exports[_0x56c6('0x4')]=function(_0x75ed92){for(var _0x4eea62=0x0,_0x2daeb0=events['length'];_0x4eea62<_0x2daeb0;_0x4eea62++){var _0x28497f=events[_0x4eea62];var _0x1cdcc1=createListener('mailInteraction:'+_0x28497f,_0x75ed92);MailInteractionEvents['on'](_0x28497f,_0x1cdcc1);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index f4f65c7..f386c27 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 _0x135b=['isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','/describe'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x135b,0xaf));var _0xb135=function(_0x4470b8,_0x20729d){_0x4470b8=_0x4470b8-0x0;var _0x31961e=_0x135b[_0x4470b8];return _0x31961e;};'use strict';var multer=require(_0xb135('0x0'));var util=require(_0xb135('0x1'));var path=require(_0xb135('0x2'));var timeout=require(_0xb135('0x3'));var express=require('express');var router=express[_0xb135('0x4')]();var fs_extra=require(_0xb135('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb135('0x6'));var config=require(_0xb135('0x7'));var controller=require(_0xb135('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb135('0x9')](_0xb135('0xa'),auth[_0xb135('0xb')](),controller[_0xb135('0xc')]);router['get'](_0xb135('0xd'),auth[_0xb135('0xb')](),controller[_0xb135('0xe')]);router[_0xb135('0x9')](_0xb135('0xf'),auth[_0xb135('0xb')](),controller[_0xb135('0x10')]);router[_0xb135('0x11')]('/',auth[_0xb135('0xb')](),interaction[_0xb135('0x12')](_0xb135('0x13'),_0xb135('0x14')),controller[_0xb135('0x15')]);router[_0xb135('0x16')](_0xb135('0xd'),auth[_0xb135('0xb')](),controller[_0xb135('0x17')]);router[_0xb135('0x16')](_0xb135('0x18'),auth['isAuthenticated'](),controller[_0xb135('0x19')]);router['put'](_0xb135('0x1a'),auth[_0xb135('0xb')](),controller[_0xb135('0x1b')]);router[_0xb135('0x1c')](_0xb135('0xd'),auth[_0xb135('0xb')](),controller[_0xb135('0x1d')]);module[_0xb135('0x1e')]=router; \ No newline at end of file +var _0x847d=['accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','create','put','update','/:id/accept'];(function(_0x4c6d19,_0x149f70){var _0x40b6c7=function(_0x258143){while(--_0x258143){_0x4c6d19['push'](_0x4c6d19['shift']());}};_0x40b6c7(++_0x149f70);}(_0x847d,0x14a));var _0xd847=function(_0xb8cfbe,_0x2e81b6){_0xb8cfbe=_0xb8cfbe-0x0;var _0x227d51=_0x847d[_0xb8cfbe];return _0x227d51;};'use strict';var multer=require('multer');var util=require(_0xd847('0x0'));var path=require(_0xd847('0x1'));var timeout=require(_0xd847('0x2'));var express=require('express');var router=express[_0xd847('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd847('0x4'));var interaction=require(_0xd847('0x5'));var config=require('../../config/environment');var controller=require(_0xd847('0x6'));router[_0xd847('0x7')]('/',auth[_0xd847('0x8')](),controller[_0xd847('0x9')]);router['get'](_0xd847('0xa'),auth[_0xd847('0x8')](),controller[_0xd847('0xb')]);router[_0xd847('0x7')](_0xd847('0xc'),auth[_0xd847('0x8')](),controller[_0xd847('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xd847('0xe')]('/',auth[_0xd847('0x8')](),interaction[_0xd847('0xf')]('mail','mailmessage:create'),controller[_0xd847('0x10')]);router[_0xd847('0x11')](_0xd847('0xc'),auth[_0xd847('0x8')](),controller[_0xd847('0x12')]);router[_0xd847('0x11')](_0xd847('0x13'),auth[_0xd847('0x8')](),controller[_0xd847('0x14')]);router[_0xd847('0x11')](_0xd847('0x15'),auth['isAuthenticated'](),controller[_0xd847('0x16')]);router[_0xd847('0x17')](_0xd847('0xc'),auth[_0xd847('0x8')](),controller[_0xd847('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 54971f0..7243261 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 _0xec2b=['ENUM','out','STRING','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','long','BOOLEAN'];(function(_0x5deb28,_0x349144){var _0x29b2ee=function(_0x55ce29){while(--_0x55ce29){_0x5deb28['push'](_0x5deb28['shift']());}};_0x29b2ee(++_0x349144);}(_0xec2b,0x126));var _0xbec2=function(_0x4f45cc,_0x2d99f0){_0x4f45cc=_0x4f45cc-0x0;var _0x1b9315=_0xec2b[_0x4f45cc];return _0x1b9315;};'use strict';var Sequelize=require(_0xbec2('0x0'));var _=require(_0xbec2('0x1'));module[_0xbec2('0x2')]={'body':{'type':Sequelize[_0xbec2('0x3')](_0xbec2('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbec2('0x3')]('medium')},'read':{'type':Sequelize[_0xbec2('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbec2('0x6')]('in',_0xbec2('0x7')),'defaultValue':_0xbec2('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbec2('0x8')](0x1fe)},'from':{'type':Sequelize[_0xbec2('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0xbec2('0x3')](_0xbec2('0x4'))},'bcc':{'type':Sequelize[_0xbec2('0x3')](_0xbec2('0x4'))},'subject':{'type':Sequelize[_0xbec2('0x3')]},'sentAt':{'type':Sequelize[_0xbec2('0x9')]},'attach':{'type':Sequelize[_0xbec2('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xbec2('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xbec2('0x9')]},'originTo':{'type':Sequelize[_0xbec2('0x3')]('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0xbec2('0x6')](_0xbec2('0xb'),'Chat'),'defaultValue':_0xbec2('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xa039=['INTEGER','Email','lodash','TEXT','long','BOOLEAN','ENUM','STRING','DATE'];(function(_0x4361b6,_0x414635){var _0x4c6878=function(_0x54cfb6){while(--_0x54cfb6){_0x4361b6['push'](_0x4361b6['shift']());}};_0x4c6878(++_0x414635);}(_0xa039,0x1c4));var _0x9a03=function(_0x2f7e56,_0x2274d0){_0x2f7e56=_0x2f7e56-0x0;var _0x35978f=_0xa039[_0x2f7e56];return _0x35978f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9a03('0x0'));module['exports']={'body':{'type':Sequelize[_0x9a03('0x1')](_0x9a03('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9a03('0x1')]('medium')},'read':{'type':Sequelize[_0x9a03('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a03('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x9a03('0x5')]},'to':{'type':Sequelize[_0x9a03('0x1')]('long')},'cc':{'type':Sequelize[_0x9a03('0x1')](_0x9a03('0x2'))},'bcc':{'type':Sequelize[_0x9a03('0x1')](_0x9a03('0x2'))},'subject':{'type':Sequelize[_0x9a03('0x1')]},'sentAt':{'type':Sequelize[_0x9a03('0x6')]},'attach':{'type':Sequelize[_0x9a03('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9a03('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9a03('0x6')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x9a03('0x1')](_0x9a03('0x2'))},'originChannel':{'type':Sequelize[_0x9a03('0x4')](_0x9a03('0x8'),'Chat'),'defaultValue':_0x9a03('0x8'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0d88a3b..a1ecffa 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 _0xbaaf=['headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../mysqldb','defaults','redis','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','show','params','find','body','describe','create','secret','split','findOne','MailAccountId','CmList','Contacts','updatedAt','MailServerOut','Smtp','isNil','service','port','secure','user','pass','auth','attachments','join','root','server/files/attachments','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','mail','UserId','MailInteraction','MailInteractionId','read1stAt','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','fromString','EventManager','acceptmessage','reject','get','interaction','role','null','RejectMessage','rejectMessage','User','event','rejectmessage','unix','toString','files','server','bcc','subject','createdAt','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbaaf,0x149));var _0xfbaa=function(_0x3fa4cf,_0x1acde9){_0x3fa4cf=_0x3fa4cf-0x0;var _0x40a286=_0xbaaf[_0x3fa4cf];return _0x40a286;};'use strict';var emlformat=require('eml-format');var moment=require(_0xfbaa('0x0'));var BPromise=require(_0xfbaa('0x1'));var util=require(_0xfbaa('0x2'));var path=require(_0xfbaa('0x3'));var fs=require('fs');var _=require(_0xfbaa('0x4'));var Redis=require(_0xfbaa('0x5'));var htmlToText=require('html-to-text');var qs=require(_0xfbaa('0x6'));var logger=require(_0xfbaa('0x7'))('api');var interaction_log=require('../../config/logger')(_0xfbaa('0x8'));var config=require('../../config/environment');var db=require(_0xfbaa('0x9'))['db'];config['redis']=_[_0xfbaa('0xa')](config[_0xfbaa('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xfbaa('0xc'))(new Redis(config[_0xfbaa('0xb')]));var htmlEntities=require('html-entities');require(_0xfbaa('0xd'))[_0xfbaa('0xe')](socket);var jayson=require(_0xfbaa('0xf'));var client=jayson[_0xfbaa('0x10')][_0xfbaa('0x11')]({'port':0x232c});var client9003=jayson[_0xfbaa('0x10')][_0xfbaa('0x11')]({'port':0x232b});var client9002=jayson[_0xfbaa('0x10')][_0xfbaa('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x57e680,_0x733cbe,_0x15dd14,_0x4768a1){return new BPromise(function(_0x4a8c03,_0x3375c1){var _0x1fc553=_0x4768a1||client;return _0x1fc553[_0xfbaa('0x12')](_0x57e680,_0x15dd14)[_0xfbaa('0x13')](function(_0x3c1b03){logger[_0xfbaa('0x14')](_0xfbaa('0x15'),_0x733cbe,_0xfbaa('0x16'));logger[_0xfbaa('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x733cbe,'request\x20sent',JSON[_0xfbaa('0x18')](_0x3c1b03));if(_0x3c1b03[_0xfbaa('0x19')]){if(_0x3c1b03['error'][_0xfbaa('0x1a')]===0x1f4){logger[_0xfbaa('0x19')]('MailMessage,\x20%s,\x20%s',_0x733cbe,_0x3c1b03[_0xfbaa('0x19')][_0xfbaa('0x1b')]);return _0x3375c1(_0x3c1b03[_0xfbaa('0x19')][_0xfbaa('0x1b')]);}logger[_0xfbaa('0x19')](_0xfbaa('0x15'),_0x733cbe,_0x3c1b03[_0xfbaa('0x19')][_0xfbaa('0x1b')]);return _0x4a8c03(_0x3c1b03[_0xfbaa('0x19')]['message']);}else{logger[_0xfbaa('0x14')](_0xfbaa('0x15'),_0x733cbe,_0xfbaa('0x16'));_0x4a8c03(_0x3c1b03[_0xfbaa('0x1c')][_0xfbaa('0x1b')]);}})[_0xfbaa('0x1d')](function(_0x133dd6){logger['error'](_0xfbaa('0x15'),_0x733cbe,_0x133dd6);_0x3375c1(_0x133dd6);});});}function respondWithResult(_0x179555,_0x51d842){_0x51d842=_0x51d842||0xc8;return function(_0x2bb025){if(_0x2bb025){return _0x179555[_0xfbaa('0x1e')](_0x51d842)['json'](_0x2bb025);}};}function respondWithFilteredResult(_0x1a1aa7,_0x30048b){return function(_0x2f3ce2){if(_0x2f3ce2){var _0x3dec7d=typeof _0x30048b[_0xfbaa('0x1f')]===_0xfbaa('0x20')&&typeof _0x30048b[_0xfbaa('0x21')]===_0xfbaa('0x20');var _0x9d8650=_0x2f3ce2[_0xfbaa('0x22')];var _0x4610b6=_0x3dec7d?0x0:_0x30048b['offset'];var _0x1abe64=_0x3dec7d?_0x2f3ce2['count']:_0x30048b[_0xfbaa('0x1f')]+_0x30048b[_0xfbaa('0x21')];var _0x31d0c2;if(_0x1abe64>=_0x9d8650){_0x1abe64=_0x9d8650;_0x31d0c2=0xc8;}else{_0x31d0c2=0xce;}_0x1a1aa7[_0xfbaa('0x1e')](_0x31d0c2);return _0x1a1aa7[_0xfbaa('0x23')](_0xfbaa('0x24'),_0x4610b6+'-'+_0x1abe64+'/'+_0x9d8650)[_0xfbaa('0x25')](_0x2f3ce2);}return null;};}function saveUpdates(_0x40d664){return function(_0x308239){if(_0x308239){return _0x308239[_0xfbaa('0x26')](_0x40d664)[_0xfbaa('0x13')](function(_0x2908a3){return _0x2908a3;});}return null;};}function removeEntity(_0x37c9f1){return function(_0x2c31e5){if(_0x2c31e5){return _0x2c31e5[_0xfbaa('0x27')]()['then'](function(){_0x37c9f1[_0xfbaa('0x1e')](0xcc)[_0xfbaa('0x28')]();});}};}function handleEntityNotFound(_0x25435d){return function(_0x46d244){if(!_0x46d244){_0x25435d['sendStatus'](0x194);}return _0x46d244;};}function handleError(_0x26adc9,_0xd0f540){_0xd0f540=_0xd0f540||0x1f4;return function(_0x1e7c09){logger[_0xfbaa('0x19')](_0x1e7c09[_0xfbaa('0x29')]);if(_0x1e7c09[_0xfbaa('0x2a')]){delete _0x1e7c09[_0xfbaa('0x2a')];}_0x26adc9[_0xfbaa('0x1e')](_0xd0f540)[_0xfbaa('0x2b')](_0x1e7c09);};}exports[_0xfbaa('0x2c')]=function(_0x342a1c,_0x155c0e){var _0x3edaf4={},_0x1dfc04={},_0x466130={'count':0x0,'rows':[]};var _0x4b805f=_[_0xfbaa('0x2d')](db['MailMessage'][_0xfbaa('0x2e')],function(_0x3fad84){return{'name':_0x3fad84['fieldName'],'type':_0x3fad84[_0xfbaa('0x2f')][_0xfbaa('0x30')]};});_0x1dfc04[_0xfbaa('0x31')]=_[_0xfbaa('0x2d')](_0x4b805f,'name');_0x1dfc04[_0xfbaa('0x32')]=_[_0xfbaa('0x33')](_0x342a1c[_0xfbaa('0x32')]);_0x1dfc04[_0xfbaa('0x34')]=_[_0xfbaa('0x35')](_0x1dfc04[_0xfbaa('0x31')],_0x1dfc04[_0xfbaa('0x32')]);_0x3edaf4['attributes']=_[_0xfbaa('0x35')](_0x1dfc04[_0xfbaa('0x31')],qs[_0xfbaa('0x36')](_0x342a1c[_0xfbaa('0x32')][_0xfbaa('0x36')]));_0x3edaf4[_0xfbaa('0x37')]=_0x3edaf4['attributes'][_0xfbaa('0x38')]?_0x3edaf4[_0xfbaa('0x37')]:_0x1dfc04['model'];if(!_0x342a1c['query'][_0xfbaa('0x39')](_0xfbaa('0x3a'))){_0x3edaf4[_0xfbaa('0x21')]=qs['limit'](_0x342a1c[_0xfbaa('0x32')][_0xfbaa('0x21')]);_0x3edaf4[_0xfbaa('0x1f')]=qs[_0xfbaa('0x1f')](_0x342a1c['query'][_0xfbaa('0x1f')]);}_0x3edaf4[_0xfbaa('0x3b')]=qs[_0xfbaa('0x3c')](_0x342a1c[_0xfbaa('0x32')][_0xfbaa('0x3c')]);_0x3edaf4[_0xfbaa('0x3d')]=qs[_0xfbaa('0x34')](_[_0xfbaa('0x3e')](_0x342a1c[_0xfbaa('0x32')],_0x1dfc04[_0xfbaa('0x34')]),_0x4b805f);if(_0x342a1c['query'][_0xfbaa('0x3f')]){_0x3edaf4['where']=_[_0xfbaa('0x40')](_0x3edaf4['where'],{'$or':_[_0xfbaa('0x2d')](_0x4b805f,function(_0x4ff89d){if(_0x4ff89d[_0xfbaa('0x2f')]!==_0xfbaa('0x41')){var _0x394abb={};_0x394abb[_0x4ff89d['name']]={'$like':'%'+_0x342a1c['query'][_0xfbaa('0x3f')]+'%'};return _0x394abb;}})});}_0x3edaf4=_[_0xfbaa('0x40')]({},_0x3edaf4,_0x342a1c[_0xfbaa('0x42')]);var _0x3b18eb={'where':_0x3edaf4['where']};return db[_0xfbaa('0x43')][_0xfbaa('0x22')](_0x3b18eb)[_0xfbaa('0x13')](function(_0x5ed5fb){_0x466130['count']=_0x5ed5fb;if(_0x342a1c[_0xfbaa('0x32')][_0xfbaa('0x44')]){_0x3edaf4[_0xfbaa('0x45')]=[{'all':!![]}];}return db[_0xfbaa('0x43')][_0xfbaa('0x46')](_0x3edaf4);})[_0xfbaa('0x13')](function(_0x52f2d3){_0x466130['rows']=_0x52f2d3;return _0x466130;})[_0xfbaa('0x13')](respondWithFilteredResult(_0x155c0e,_0x3edaf4))[_0xfbaa('0x1d')](handleError(_0x155c0e,null));};exports[_0xfbaa('0x47')]=function(_0x5ed14d,_0x238690){var _0x6f26ad={'raw':!![],'where':{'id':_0x5ed14d[_0xfbaa('0x48')]['id']}},_0xcb1aed={};_0xcb1aed['model']=_[_0xfbaa('0x33')](db[_0xfbaa('0x43')]['rawAttributes']);_0xcb1aed[_0xfbaa('0x32')]=_[_0xfbaa('0x33')](_0x5ed14d[_0xfbaa('0x32')]);_0xcb1aed[_0xfbaa('0x34')]=_[_0xfbaa('0x35')](_0xcb1aed['model'],_0xcb1aed[_0xfbaa('0x32')]);_0x6f26ad[_0xfbaa('0x37')]=_[_0xfbaa('0x35')](_0xcb1aed[_0xfbaa('0x31')],qs[_0xfbaa('0x36')](_0x5ed14d[_0xfbaa('0x32')][_0xfbaa('0x36')]));_0x6f26ad[_0xfbaa('0x37')]=_0x6f26ad[_0xfbaa('0x37')][_0xfbaa('0x38')]?_0x6f26ad['attributes']:_0xcb1aed['model'];if(_0x5ed14d[_0xfbaa('0x32')][_0xfbaa('0x44')]){_0x6f26ad[_0xfbaa('0x45')]=[{'all':!![]}];}_0x6f26ad=_['merge']({},_0x6f26ad,_0x5ed14d['options']);return db[_0xfbaa('0x43')][_0xfbaa('0x49')](_0x6f26ad)[_0xfbaa('0x13')](handleEntityNotFound(_0x238690,null))[_0xfbaa('0x13')](respondWithResult(_0x238690,null))[_0xfbaa('0x1d')](handleError(_0x238690,null));};exports[_0xfbaa('0x26')]=function(_0x243dca,_0x56ef04){if(_0x243dca[_0xfbaa('0x4a')]['id']){delete _0x243dca[_0xfbaa('0x4a')]['id'];}return db[_0xfbaa('0x43')][_0xfbaa('0x49')]({'where':{'id':_0x243dca[_0xfbaa('0x48')]['id']}})['then'](handleEntityNotFound(_0x56ef04,null))[_0xfbaa('0x13')](saveUpdates(_0x243dca[_0xfbaa('0x4a')],null))[_0xfbaa('0x13')](respondWithResult(_0x56ef04,null))[_0xfbaa('0x1d')](handleError(_0x56ef04,null));};exports['destroy']=function(_0x3921c3,_0x5735f8){return db['MailMessage']['find']({'where':{'id':_0x3921c3[_0xfbaa('0x48')]['id']}})[_0xfbaa('0x13')](handleEntityNotFound(_0x5735f8,null))[_0xfbaa('0x13')](removeEntity(_0x5735f8,null))[_0xfbaa('0x1d')](handleError(_0x5735f8,null));};exports['describe']=function(_0x45e7c0,_0x100ed2){return db[_0xfbaa('0x43')][_0xfbaa('0x4b')]()[_0xfbaa('0x13')](respondWithResult(_0x100ed2,null))[_0xfbaa('0x1d')](handleError(_0x100ed2,null));};exports[_0xfbaa('0x4c')]=function(_0x124786,_0x500de0){return db[_0xfbaa('0x43')]['create'](_0x124786['body'])['then'](function(_0x4958c5){if(_0x4958c5){if(_0x4958c5['direction']==='out'&&!_0x4958c5[_0xfbaa('0x4d')]){var _0xb7f389,_0x534c12,_0x1e787e;if(_0x124786[_0xfbaa('0x4a')]['to']){_0x534c12=_0x124786[_0xfbaa('0x4a')]['to'][_0xfbaa('0x4e')](',')[0x0];}return db['MailAccount'][_0xfbaa('0x4f')]({'where':{'id':_0x4958c5[_0xfbaa('0x50')]},'include':[{'model':db[_0xfbaa('0x51')],'as':'List','include':[{'model':db['CmContact'],'as':_0xfbaa('0x52'),'where':{'email':_0x534c12},'limit':0x1,'order':[[_0xfbaa('0x53'),'DESC']]}]},{'model':db[_0xfbaa('0x54')],'as':_0xfbaa('0x55'),'raw':!![]}]})['then'](function(_0x256715){_0xb7f389=_0x256715;if(_0xb7f389&&_0xb7f389[_0xfbaa('0x55')]){var _0x320f03={'tls':{'rejectUnauthorized':![]}};if(_[_0xfbaa('0x56')](_0xb7f389[_0xfbaa('0x55')][_0xfbaa('0x57')])){_0x320f03['host']=_0xb7f389['Smtp']['host'];_0x320f03[_0xfbaa('0x58')]=_0xb7f389['Smtp'][_0xfbaa('0x58')];_0x320f03[_0xfbaa('0x59')]=_0xb7f389[_0xfbaa('0x55')]['secure'];if(_0xb7f389[_0xfbaa('0x55')]['authentication']){_0x320f03['auth']={'user':_0xb7f389[_0xfbaa('0x55')][_0xfbaa('0x5a')],'pass':_0xb7f389[_0xfbaa('0x55')][_0xfbaa('0x5b')]};}}else{_0x320f03[_0xfbaa('0x57')]=_0xb7f389[_0xfbaa('0x55')][_0xfbaa('0x57')];_0x320f03[_0xfbaa('0x5c')]={'user':_0xb7f389[_0xfbaa('0x55')][_0xfbaa('0x5a')],'pass':_0xb7f389['Smtp'][_0xfbaa('0x5b')]};_0x320f03[_0xfbaa('0x59')]=_0xb7f389['Smtp']['secure'];}if(_0x124786[_0xfbaa('0x4a')][_0xfbaa('0x5d')]&&_0x124786[_0xfbaa('0x4a')]['attachments']['length']){for(var _0x575ad3=0x0;_0x575ad3<_0x124786[_0xfbaa('0x4a')]['attachments'][_0xfbaa('0x38')];_0x575ad3+=0x1){_0x124786[_0xfbaa('0x4a')][_0xfbaa('0x5d')][_0x575ad3]={'filename':_0x124786[_0xfbaa('0x4a')][_0xfbaa('0x5d')][_0x575ad3]['name'],'path':path[_0xfbaa('0x5e')](config[_0xfbaa('0x5f')],_0xfbaa('0x60'),_0x124786['body'][_0xfbaa('0x5d')][_0x575ad3]['basename'])};}}_0x1e787e={'account':_0x320f03,'message':_0x124786[_0xfbaa('0x4a')]};return;}})[_0xfbaa('0x13')](function(){if(_0xb7f389['List']){if(_0xb7f389[_0xfbaa('0x61')][_0xfbaa('0x52')][_0xfbaa('0x38')]){return _0xb7f389[_0xfbaa('0x61')][_0xfbaa('0x52')][0x0];}else{return db['CmContact'][_0xfbaa('0x4c')](_[_0xfbaa('0xa')](_0x124786['body'],{'firstName':_0x124786['body']['to'],'email':_0x124786[_0xfbaa('0x4a')]['to'],'phone':_0x124786[_0xfbaa('0x4a')]['to'],'ListId':_0xb7f389[_0xfbaa('0x62')]}));}}else{throw new Error(_0xfbaa('0x63'));}})[_0xfbaa('0x13')](function(){if(_0x1e787e){return respondWithRpcPromise(_0xfbaa('0x64'),_0xfbaa('0x65'),_0x1e787e,client9003)[_0xfbaa('0x13')](function(_0x3326df){return _0x4958c5[_0xfbaa('0x26')]({'read':!![],'messageId':_0x3326df[_0xfbaa('0x66')],'sentAt':moment()[_0xfbaa('0x67')](_0xfbaa('0x68'))});})[_0xfbaa('0x1d')](function(_0x11e933){logger['error']('%s',JSON[_0xfbaa('0x18')](_0x11e933));return _0x4958c5;});}return _0x4958c5;});}return _0x4958c5;}})['then'](respondWithResult(_0x500de0,0xc9))['catch'](handleError(_0x500de0,null));};exports['accept']=function(_0x5a05d2,_0x5ed30c){var _0x3c7dfd={'agent':{},'channel':_0xfbaa('0x69')};if(_0x5a05d2['body']['id']){delete _0x5a05d2[_0xfbaa('0x4a')]['id'];}_0x5a05d2[_0xfbaa('0x4a')]['read']=!![];_0x5a05d2[_0xfbaa('0x4a')]['readAt']=moment()[_0xfbaa('0x67')]('YYYY-MM-DD\x20HH:mm:ss');_0x5a05d2['body']['UserId']=_0x5a05d2[_0xfbaa('0x4a')][_0xfbaa('0x6a')]||_0x5a05d2[_0xfbaa('0x5a')]['id'];_0x3c7dfd['agent']['id']=_0x5a05d2['body'][_0xfbaa('0x6a')];return db[_0xfbaa('0x43')][_0xfbaa('0x49')]({'where':{'id':_0x5a05d2[_0xfbaa('0x48')]['id'],'UserId':null}})[_0xfbaa('0x13')](handleEntityNotFound(_0x5ed30c,null))[_0xfbaa('0x13')](saveUpdates(_0x5a05d2[_0xfbaa('0x4a')],null))[_0xfbaa('0x13')](function(_0x39f7de){if(_0x39f7de){_0x3c7dfd[_0xfbaa('0x1b')]=_0x39f7de['get']({'plain':!![]});return db[_0xfbaa('0x6b')]['find']({'where':{'id':_0x39f7de[_0xfbaa('0x6c')]}});}return null;})['then'](handleEntityNotFound(_0x5ed30c,null))[_0xfbaa('0x13')](function(_0x522432){if(_0x522432){return _0x522432[_0xfbaa('0x26')]({'UserId':_0x5a05d2[_0xfbaa('0x4a')][_0xfbaa('0x6a')],'read1stAt':_[_0xfbaa('0x56')](_0x522432[_0xfbaa('0x6d')])?moment()[_0xfbaa('0x67')](_0xfbaa('0x68')):undefined});}return null;})[_0xfbaa('0x13')](function(_0x40170a){if(_0x40170a){_0x3c7dfd['interaction']=_0x40170a['get']({'plain':!![]});interaction_log[_0xfbaa('0x14')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5a05d2[_0xfbaa('0x5a')]['id'],_0x5a05d2[_0xfbaa('0x5a')][_0xfbaa('0x2a')],_0x5a05d2['user']['role'],_0x3c7dfd['interaction']['id'],_0x5a05d2['body']?JSON[_0xfbaa('0x18')](_0x5a05d2[_0xfbaa('0x4a')]):'null');return respondWithRpcPromise(_0xfbaa('0x6e'),_0xfbaa('0x6f'),_0x3c7dfd);}return null;})[_0xfbaa('0x13')](function(_0x2028a6){var _0x576291=_0xfbaa('0x70')+_0x2028a6['message'][_0xfbaa('0x71')];return db[_0xfbaa('0x72')][_0xfbaa('0x32')](_0x576291,{'type':db[_0xfbaa('0x73')][_0xfbaa('0x74')][_0xfbaa('0x75')],'raw':!![]})[_0xfbaa('0x13')](function(_0x544db7){return _0x544db7;});})[_0xfbaa('0x13')](function(_0x57b341){if(_0x57b341){_0x3c7dfd['message'][_0xfbaa('0x76')]=_0x57b341[0x0];if(!_0x5a05d2[_0xfbaa('0x4a')][_0xfbaa('0x6a')])return;return db['User'][_0xfbaa('0x49')]({'where':{'id':_0x5a05d2[_0xfbaa('0x4a')][_0xfbaa('0x6a')],'role':_0xfbaa('0x77')},'attributes':['id','name',_0xfbaa('0x78'),_0xfbaa('0x79'),_0xfbaa('0x7a')],'raw':!![]});}return null;})[_0xfbaa('0x13')](function(_0xc38d7){if(!_0xc38d7)return null;_0x3c7dfd[_0xfbaa('0x1b')][_0xfbaa('0x77')]=_0xc38d7;return _0x3c7dfd;})[_0xfbaa('0x13')](function(_0x4d4378){if(_0x4d4378){if(_0x5a05d2['body']['manual']){_0x3c7dfd[_0xfbaa('0x1b')][_0xfbaa('0x7b')]=util[_0xfbaa('0x67')](_0xfbaa('0x7c'),_0x5a05d2[_0xfbaa('0x5a')][_0xfbaa('0x2a')]);_0x3c7dfd[_0xfbaa('0x1b')][_0xfbaa('0x7d')]=_0x3c7dfd[_0xfbaa('0x7d')];_0x3c7dfd[_0xfbaa('0x1b')][_0xfbaa('0x7e')]=_0x3c7dfd[_0xfbaa('0x7d')];_0x3c7dfd[_0xfbaa('0x1b')]['event']=_0xfbaa('0x7f');_0x3c7dfd['message'][_0xfbaa('0x4a')]=htmlToText[_0xfbaa('0x80')](_0x3c7dfd['message'][_0xfbaa('0x4a')]);return respondWithRpcPromise(_0xfbaa('0x81'),_0xfbaa('0x81'),{'event':_0xfbaa('0x82'),'message':_0x3c7dfd[_0xfbaa('0x1b')]},client9002)[_0xfbaa('0x13')](function(){return _0x3c7dfd;});}return _0x3c7dfd;}return null;})['then'](respondWithResult(_0x5ed30c,null))[_0xfbaa('0x1d')](handleError(_0x5ed30c,null));};exports[_0xfbaa('0x83')]=function(_0x462adb,_0x155c31){var _0x32370a={'agent':{},'channel':'mail'};if(_0x462adb[_0xfbaa('0x4a')]['id']){delete _0x462adb[_0xfbaa('0x4a')]['id'];}_0x462adb[_0xfbaa('0x4a')]['UserId']=_0x462adb[_0xfbaa('0x4a')][_0xfbaa('0x6a')]||_0x462adb['user']['id'];_0x32370a[_0xfbaa('0x77')]['id']=_0x462adb[_0xfbaa('0x4a')][_0xfbaa('0x6a')];return db[_0xfbaa('0x43')][_0xfbaa('0x49')]({'where':{'id':_0x462adb[_0xfbaa('0x48')]['id'],'UserId':null}})[_0xfbaa('0x13')](handleEntityNotFound(_0x155c31,null))[_0xfbaa('0x13')](function(_0x1fdefd){if(_0x1fdefd){_0x32370a['message']=_0x1fdefd[_0xfbaa('0x84')]({'plain':!![]});return db['MailInteraction'][_0xfbaa('0x49')]({'where':{'id':_0x1fdefd['MailInteractionId']}});}return null;})[_0xfbaa('0x13')](handleEntityNotFound(_0x155c31,null))[_0xfbaa('0x13')](function(_0x5e372a){if(_0x5e372a){_0x32370a[_0xfbaa('0x85')]=_0x5e372a[_0xfbaa('0x84')]({'plain':!![]});interaction_log[_0xfbaa('0x14')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x462adb[_0xfbaa('0x5a')]['id'],_0x462adb[_0xfbaa('0x5a')][_0xfbaa('0x2a')],_0x462adb['user'][_0xfbaa('0x86')],_0x32370a[_0xfbaa('0x85')]['id'],_0x462adb[_0xfbaa('0x4a')]?JSON[_0xfbaa('0x18')](_0x462adb[_0xfbaa('0x4a')]):_0xfbaa('0x87'));return respondWithRpcPromise(_0xfbaa('0x88'),_0xfbaa('0x89'),_0x32370a);}return null;})['then'](function(_0xf79f5b){var _0x416359=_0xfbaa('0x70')+_0xf79f5b[_0xfbaa('0x1b')]['ContactId'];return db[_0xfbaa('0x72')]['query'](_0x416359,{'type':db['Sequelize'][_0xfbaa('0x74')][_0xfbaa('0x75')],'raw':!![]})['then'](function(_0x10642a){return _0x10642a;});})[_0xfbaa('0x13')](function(_0x54e259){if(_0x54e259){_0x32370a[_0xfbaa('0x1b')][_0xfbaa('0x76')]=_0x54e259[0x0];if(!_0x462adb[_0xfbaa('0x4a')][_0xfbaa('0x6a')])return;return db[_0xfbaa('0x8a')][_0xfbaa('0x49')]({'where':{'id':_0x462adb[_0xfbaa('0x4a')][_0xfbaa('0x6a')],'role':_0xfbaa('0x77')},'attributes':['id','name',_0xfbaa('0x78'),_0xfbaa('0x79'),_0xfbaa('0x7a')],'raw':!![]});}return null;})[_0xfbaa('0x13')](function(_0x25296d){if(!_0x25296d)return null;_0x32370a[_0xfbaa('0x1b')]['agent']=_0x25296d;return _0x32370a;})[_0xfbaa('0x13')](function(_0x2eec82){if(_0x2eec82){_0x2eec82['message']['interface']=util[_0xfbaa('0x67')](_0xfbaa('0x7c'),_0x462adb['user'][_0xfbaa('0x2a')]);_0x2eec82[_0xfbaa('0x1b')][_0xfbaa('0x7d')]=_0x32370a['channel'];_0x2eec82[_0xfbaa('0x1b')][_0xfbaa('0x7e')]=_0x32370a[_0xfbaa('0x7d')];_0x2eec82[_0xfbaa('0x1b')][_0xfbaa('0x8b')]='reject';_0x2eec82[_0xfbaa('0x1b')][_0xfbaa('0x4a')]=htmlToText['fromString'](_0x32370a[_0xfbaa('0x1b')][_0xfbaa('0x4a')]);respondWithRpcPromise(_0xfbaa('0x81'),_0xfbaa('0x81'),{'event':_0xfbaa('0x8c'),'message':_0x2eec82['message']},client9002);return _0x32370a;}return null;})['then'](respondWithResult(_0x155c31,null))[_0xfbaa('0x1d')](handleError(_0x155c31,null));};exports['download']=function(_0x5a0101,_0x7c40d9){var _0x39cfc0=moment()[_0xfbaa('0x8d')]()[_0xfbaa('0x8e')]();var _0x118fa9=path['join'](config[_0xfbaa('0x5f')],'server',_0xfbaa('0x8f'),'tmp');var _0xd30102=path[_0xfbaa('0x5e')](config[_0xfbaa('0x5f')],_0xfbaa('0x90'),_0xfbaa('0x8f'),_0xfbaa('0x5d'));var _0x23e9d0=util[_0xfbaa('0x67')]('message-%s.eml',_0x39cfc0);return db[_0xfbaa('0x43')][_0xfbaa('0x49')]({'where':{'id':_0x5a0101['params']['id']},'attributes':['id','body','from','to','cc',_0xfbaa('0x91'),_0xfbaa('0x92'),_0xfbaa('0x93')],'include':_0x5a0101['query'][_0xfbaa('0x5d')]?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0xfbaa('0x13')](handleEntityNotFound(_0x7c40d9,null))[_0xfbaa('0x13')](function(_0x98bd17){if(_0x98bd17){var _0xa92646=_0x98bd17;var _0x128d59={'from':_0xa92646[_0xfbaa('0x94')],'to':_0xa92646['to'],'subject':_0xa92646['subject'],'html':htmlEntities[_0xfbaa('0x95')](_0xa92646[_0xfbaa('0x4a')]),'headers':{'Date':moment(_0xa92646[_0xfbaa('0x93')])[_0xfbaa('0x67')](_0xfbaa('0x96'))},'attachments':[]};if(_0x98bd17['cc']){_0x128d59['headers']['Cc']=_0x98bd17['cc'];}if(_0x98bd17[_0xfbaa('0x91')]){_0x128d59[_0xfbaa('0x97')]['Bcc']=_0x98bd17[_0xfbaa('0x91')];}return new BPromise(function(_0x1121eb,_0x521dc3){if(_0x98bd17[_0xfbaa('0x98')]){for(var _0x2bcf21=0x0;_0x2bcf21<_0x98bd17[_0xfbaa('0x98')][_0xfbaa('0x38')];_0x2bcf21++){var _0x4c65bc=_0x98bd17['Attachments'][_0x2bcf21];var _0xbcc957=path['join'](_0xd30102,_0x4c65bc[_0xfbaa('0x99')]);if(fs[_0xfbaa('0x9a')](_0xbcc957)){_0x128d59['attachments']['push']({'name':_0x4c65bc[_0xfbaa('0x2a')],'contentType':_0x4c65bc[_0xfbaa('0x2f')],'data':fs[_0xfbaa('0x9b')](_0xbcc957)});}}}emlformat[_0xfbaa('0x9c')](_0x128d59,function(_0x5f0cff,_0x2d94c3){if(_0x5f0cff)return _0x521dc3(_0x5f0cff);fs[_0xfbaa('0x9d')](path[_0xfbaa('0x5e')](_0x118fa9,_0x23e9d0),_0x2d94c3);return _0x1121eb(_0x2d94c3);});});}})[_0xfbaa('0x13')](function(_0x12bfb7){if(_0x12bfb7){return _0x7c40d9[_0xfbaa('0x9e')](path['join'](_0x118fa9,_0x23e9d0),_0x23e9d0,function(_0x4c6af1){if(!_0x4c6af1)fs[_0xfbaa('0x9f')](path[_0xfbaa('0x5e')](_0x118fa9,_0x23e9d0));});}})['catch'](handleError(_0x7c40d9,null));}; \ No newline at end of file +var _0x9418=['ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','limit','undefined','count','offset','status','set','json','update','destroy','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','body','find','params','describe','create','direction','out','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user','pass','attachments','root','basename','CmContact','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','sequelize','SELECT','interface','reject','rejectmessage','unix','join','files','tmp','server','message-%s.eml','from','bcc','subject','Attachment','Attachments','decode','createdAt'];(function(_0x2703d4,_0x478f5a){var _0x41099a=function(_0x3f5e38){while(--_0x3f5e38){_0x2703d4['push'](_0x2703d4['shift']());}};_0x41099a(++_0x478f5a);}(_0x9418,0xb3));var _0x8941=function(_0xca41dc,_0x22936e){_0xca41dc=_0xca41dc-0x0;var _0x3e125c=_0x9418[_0xca41dc];return _0x3e125c;};'use strict';var emlformat=require(_0x8941('0x0'));var moment=require(_0x8941('0x1'));var BPromise=require(_0x8941('0x2'));var util=require(_0x8941('0x3'));var path=require(_0x8941('0x4'));var fs=require('fs');var _=require(_0x8941('0x5'));var Redis=require('ioredis');var htmlToText=require(_0x8941('0x6'));var qs=require(_0x8941('0x7'));var logger=require(_0x8941('0x8'))(_0x8941('0x9'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x8941('0xa'));var db=require('../../mysqldb')['db'];config[_0x8941('0xb')]=_[_0x8941('0xc')](config[_0x8941('0xb')],{'host':_0x8941('0xd'),'port':0x18eb});var socket=require(_0x8941('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x8941('0xf')](socket);var jayson=require(_0x8941('0x10'));var client=jayson[_0x8941('0x11')][_0x8941('0x12')]({'port':0x232c});var client9003=jayson[_0x8941('0x11')][_0x8941('0x12')]({'port':0x232b});var client9002=jayson[_0x8941('0x11')][_0x8941('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x127df7,_0x3bc815,_0x2e5ecb,_0x4e5eca){return new BPromise(function(_0x27dd17,_0x301c3a){var _0xbd614a=_0x4e5eca||client;return _0xbd614a[_0x8941('0x13')](_0x127df7,_0x2e5ecb)[_0x8941('0x14')](function(_0x170a47){logger['info'](_0x8941('0x15'),_0x3bc815,_0x8941('0x16'));logger['debug'](_0x8941('0x17'),_0x3bc815,_0x8941('0x16'),JSON[_0x8941('0x18')](_0x170a47));if(_0x170a47[_0x8941('0x19')]){if(_0x170a47[_0x8941('0x19')]['code']===0x1f4){logger[_0x8941('0x19')](_0x8941('0x15'),_0x3bc815,_0x170a47[_0x8941('0x19')][_0x8941('0x1a')]);return _0x301c3a(_0x170a47[_0x8941('0x19')][_0x8941('0x1a')]);}logger[_0x8941('0x19')](_0x8941('0x15'),_0x3bc815,_0x170a47[_0x8941('0x19')][_0x8941('0x1a')]);return _0x27dd17(_0x170a47['error'][_0x8941('0x1a')]);}else{logger[_0x8941('0x1b')](_0x8941('0x15'),_0x3bc815,_0x8941('0x16'));_0x27dd17(_0x170a47['result'][_0x8941('0x1a')]);}})['catch'](function(_0x2148ae){logger[_0x8941('0x19')](_0x8941('0x15'),_0x3bc815,_0x2148ae);_0x301c3a(_0x2148ae);});});}function respondWithResult(_0x2ae321,_0x13a875){_0x13a875=_0x13a875||0xc8;return function(_0x51d88a){if(_0x51d88a){return _0x2ae321['status'](_0x13a875)['json'](_0x51d88a);}};}function respondWithFilteredResult(_0x703eec,_0x2a9331){return function(_0x2aa958){if(_0x2aa958){var _0x37d253=typeof _0x2a9331['offset']==='undefined'&&typeof _0x2a9331[_0x8941('0x1c')]===_0x8941('0x1d');var _0x39e1ad=_0x2aa958[_0x8941('0x1e')];var _0x12c90b=_0x37d253?0x0:_0x2a9331['offset'];var _0x42a551=_0x37d253?_0x2aa958[_0x8941('0x1e')]:_0x2a9331[_0x8941('0x1f')]+_0x2a9331['limit'];var _0x28bee1;if(_0x42a551>=_0x39e1ad){_0x42a551=_0x39e1ad;_0x28bee1=0xc8;}else{_0x28bee1=0xce;}_0x703eec[_0x8941('0x20')](_0x28bee1);return _0x703eec[_0x8941('0x21')]('Content-Range',_0x12c90b+'-'+_0x42a551+'/'+_0x39e1ad)[_0x8941('0x22')](_0x2aa958);}return null;};}function saveUpdates(_0x2e87e1){return function(_0x4b35e1){if(_0x4b35e1){return _0x4b35e1[_0x8941('0x23')](_0x2e87e1)[_0x8941('0x14')](function(_0x38aea0){return _0x38aea0;});}return null;};}function removeEntity(_0x2ca6eb){return function(_0x28fefa){if(_0x28fefa){return _0x28fefa[_0x8941('0x24')]()[_0x8941('0x14')](function(){_0x2ca6eb[_0x8941('0x20')](0xcc)[_0x8941('0x25')]();});}};}function handleEntityNotFound(_0x3fb1eb){return function(_0x31b562){if(!_0x31b562){_0x3fb1eb[_0x8941('0x26')](0x194);}return _0x31b562;};}function handleError(_0x1966e9,_0xa3143f){_0xa3143f=_0xa3143f||0x1f4;return function(_0xa8ef8d){logger['error'](_0xa8ef8d[_0x8941('0x27')]);if(_0xa8ef8d['name']){delete _0xa8ef8d[_0x8941('0x28')];}_0x1966e9[_0x8941('0x20')](_0xa3143f)['send'](_0xa8ef8d);};}exports[_0x8941('0x29')]=function(_0x3bc17f,_0x573e43){var _0x12a3eb={},_0x538f0e={},_0x541910={'count':0x0,'rows':[]};var _0x3b1370=_[_0x8941('0x2a')](db[_0x8941('0x2b')][_0x8941('0x2c')],function(_0x1713af){return{'name':_0x1713af[_0x8941('0x2d')],'type':_0x1713af[_0x8941('0x2e')][_0x8941('0x2f')]};});_0x538f0e['model']=_[_0x8941('0x2a')](_0x3b1370,_0x8941('0x28'));_0x538f0e[_0x8941('0x30')]=_[_0x8941('0x31')](_0x3bc17f['query']);_0x538f0e[_0x8941('0x32')]=_[_0x8941('0x33')](_0x538f0e[_0x8941('0x34')],_0x538f0e[_0x8941('0x30')]);_0x12a3eb[_0x8941('0x35')]=_[_0x8941('0x33')](_0x538f0e[_0x8941('0x34')],qs[_0x8941('0x36')](_0x3bc17f[_0x8941('0x30')][_0x8941('0x36')]));_0x12a3eb[_0x8941('0x35')]=_0x12a3eb[_0x8941('0x35')][_0x8941('0x37')]?_0x12a3eb['attributes']:_0x538f0e[_0x8941('0x34')];if(!_0x3bc17f['query']['hasOwnProperty'](_0x8941('0x38'))){_0x12a3eb['limit']=qs[_0x8941('0x1c')](_0x3bc17f[_0x8941('0x30')][_0x8941('0x1c')]);_0x12a3eb[_0x8941('0x1f')]=qs[_0x8941('0x1f')](_0x3bc17f[_0x8941('0x30')]['offset']);}_0x12a3eb[_0x8941('0x39')]=qs[_0x8941('0x3a')](_0x3bc17f[_0x8941('0x30')][_0x8941('0x3a')]);_0x12a3eb[_0x8941('0x3b')]=qs[_0x8941('0x32')](_[_0x8941('0x3c')](_0x3bc17f['query'],_0x538f0e[_0x8941('0x32')]),_0x3b1370);if(_0x3bc17f['query'][_0x8941('0x3d')]){_0x12a3eb[_0x8941('0x3b')]=_[_0x8941('0x3e')](_0x12a3eb[_0x8941('0x3b')],{'$or':_['map'](_0x3b1370,function(_0x3b7feb){if(_0x3b7feb['type']!==_0x8941('0x3f')){var _0x387e1b={};_0x387e1b[_0x3b7feb[_0x8941('0x28')]]={'$like':'%'+_0x3bc17f[_0x8941('0x30')][_0x8941('0x3d')]+'%'};return _0x387e1b;}})});}_0x12a3eb=_[_0x8941('0x3e')]({},_0x12a3eb,_0x3bc17f[_0x8941('0x40')]);var _0x4fe3df={'where':_0x12a3eb[_0x8941('0x3b')]};return db[_0x8941('0x2b')][_0x8941('0x1e')](_0x4fe3df)[_0x8941('0x14')](function(_0x16bf86){_0x541910[_0x8941('0x1e')]=_0x16bf86;if(_0x3bc17f[_0x8941('0x30')][_0x8941('0x41')]){_0x12a3eb[_0x8941('0x42')]=[{'all':!![]}];}return db[_0x8941('0x2b')][_0x8941('0x43')](_0x12a3eb);})[_0x8941('0x14')](function(_0xdc1d33){_0x541910[_0x8941('0x44')]=_0xdc1d33;return _0x541910;})['then'](respondWithFilteredResult(_0x573e43,_0x12a3eb))[_0x8941('0x45')](handleError(_0x573e43,null));};exports[_0x8941('0x46')]=function(_0x19aef7,_0x33cc22){var _0x4ed240={'raw':!![],'where':{'id':_0x19aef7['params']['id']}},_0x2d6d10={};_0x2d6d10[_0x8941('0x34')]=_[_0x8941('0x31')](db[_0x8941('0x2b')]['rawAttributes']);_0x2d6d10[_0x8941('0x30')]=_[_0x8941('0x31')](_0x19aef7[_0x8941('0x30')]);_0x2d6d10['filters']=_[_0x8941('0x33')](_0x2d6d10[_0x8941('0x34')],_0x2d6d10[_0x8941('0x30')]);_0x4ed240[_0x8941('0x35')]=_[_0x8941('0x33')](_0x2d6d10[_0x8941('0x34')],qs[_0x8941('0x36')](_0x19aef7['query']['fields']));_0x4ed240[_0x8941('0x35')]=_0x4ed240[_0x8941('0x35')][_0x8941('0x37')]?_0x4ed240[_0x8941('0x35')]:_0x2d6d10['model'];if(_0x19aef7[_0x8941('0x30')]['includeAll']){_0x4ed240[_0x8941('0x42')]=[{'all':!![]}];}_0x4ed240=_[_0x8941('0x3e')]({},_0x4ed240,_0x19aef7['options']);return db[_0x8941('0x2b')]['find'](_0x4ed240)[_0x8941('0x14')](handleEntityNotFound(_0x33cc22,null))['then'](respondWithResult(_0x33cc22,null))[_0x8941('0x45')](handleError(_0x33cc22,null));};exports['update']=function(_0x1c5657,_0x19cb77){if(_0x1c5657[_0x8941('0x47')]['id']){delete _0x1c5657['body']['id'];}return db[_0x8941('0x2b')]['find']({'where':{'id':_0x1c5657['params']['id']}})['then'](handleEntityNotFound(_0x19cb77,null))[_0x8941('0x14')](saveUpdates(_0x1c5657[_0x8941('0x47')],null))[_0x8941('0x14')](respondWithResult(_0x19cb77,null))[_0x8941('0x45')](handleError(_0x19cb77,null));};exports[_0x8941('0x24')]=function(_0xdaec41,_0x42bdc8){return db[_0x8941('0x2b')][_0x8941('0x48')]({'where':{'id':_0xdaec41[_0x8941('0x49')]['id']}})['then'](handleEntityNotFound(_0x42bdc8,null))[_0x8941('0x14')](removeEntity(_0x42bdc8,null))['catch'](handleError(_0x42bdc8,null));};exports[_0x8941('0x4a')]=function(_0x66ddf7,_0xff37e8){return db[_0x8941('0x2b')]['describe']()[_0x8941('0x14')](respondWithResult(_0xff37e8,null))[_0x8941('0x45')](handleError(_0xff37e8,null));};exports[_0x8941('0x4b')]=function(_0x80ec19,_0x93c00b){return db[_0x8941('0x2b')][_0x8941('0x4b')](_0x80ec19[_0x8941('0x47')])[_0x8941('0x14')](function(_0x2b3a86){if(_0x2b3a86){if(_0x2b3a86[_0x8941('0x4c')]===_0x8941('0x4d')&&!_0x2b3a86['secret']){var _0x11ef21,_0x9a4690,_0x34d2b3;if(_0x80ec19[_0x8941('0x47')]['to']){_0x9a4690=_0x80ec19[_0x8941('0x47')]['to'][_0x8941('0x4e')](',')[0x0];}return db[_0x8941('0x4f')]['findOne']({'where':{'id':_0x2b3a86[_0x8941('0x50')]},'include':[{'model':db[_0x8941('0x51')],'as':_0x8941('0x52'),'include':[{'model':db['CmContact'],'as':_0x8941('0x53'),'where':{'email':_0x9a4690},'limit':0x1,'order':[[_0x8941('0x54'),_0x8941('0x55')]]}]},{'model':db[_0x8941('0x56')],'as':_0x8941('0x57'),'raw':!![]}]})[_0x8941('0x14')](function(_0x1720d3){_0x11ef21=_0x1720d3;if(_0x11ef21&&_0x11ef21[_0x8941('0x57')]){var _0xc4d5d={'tls':{'rejectUnauthorized':![]}};if(_[_0x8941('0x58')](_0x11ef21[_0x8941('0x57')][_0x8941('0x59')])){_0xc4d5d[_0x8941('0x5a')]=_0x11ef21[_0x8941('0x57')][_0x8941('0x5a')];_0xc4d5d['port']=_0x11ef21[_0x8941('0x57')]['port'];_0xc4d5d[_0x8941('0x5b')]=_0x11ef21[_0x8941('0x57')]['secure'];if(_0x11ef21[_0x8941('0x57')][_0x8941('0x5c')]){_0xc4d5d[_0x8941('0x5d')]={'user':_0x11ef21[_0x8941('0x57')][_0x8941('0x5e')],'pass':_0x11ef21[_0x8941('0x57')][_0x8941('0x5f')]};}}else{_0xc4d5d['service']=_0x11ef21[_0x8941('0x57')][_0x8941('0x59')];_0xc4d5d[_0x8941('0x5d')]={'user':_0x11ef21['Smtp'][_0x8941('0x5e')],'pass':_0x11ef21[_0x8941('0x57')][_0x8941('0x5f')]};_0xc4d5d[_0x8941('0x5b')]=_0x11ef21['Smtp'][_0x8941('0x5b')];}if(_0x80ec19[_0x8941('0x47')][_0x8941('0x60')]&&_0x80ec19[_0x8941('0x47')][_0x8941('0x60')][_0x8941('0x37')]){for(var _0x133e2f=0x0;_0x133e2f<_0x80ec19[_0x8941('0x47')]['attachments'][_0x8941('0x37')];_0x133e2f+=0x1){_0x80ec19[_0x8941('0x47')][_0x8941('0x60')][_0x133e2f]={'filename':_0x80ec19[_0x8941('0x47')][_0x8941('0x60')][_0x133e2f][_0x8941('0x28')],'path':path['join'](config[_0x8941('0x61')],'server/files/attachments',_0x80ec19[_0x8941('0x47')][_0x8941('0x60')][_0x133e2f][_0x8941('0x62')])};}}_0x34d2b3={'account':_0xc4d5d,'message':_0x80ec19[_0x8941('0x47')]};return;}})['then'](function(){if(_0x11ef21['List']){if(_0x11ef21[_0x8941('0x52')][_0x8941('0x53')][_0x8941('0x37')]){return _0x11ef21[_0x8941('0x52')]['Contacts'][0x0];}else{return db[_0x8941('0x63')]['create'](_[_0x8941('0xc')](_0x80ec19['body'],{'firstName':_0x80ec19[_0x8941('0x47')]['to'],'email':_0x80ec19[_0x8941('0x47')]['to'],'phone':_0x80ec19['body']['to'],'ListId':_0x11ef21[_0x8941('0x64')]}));}}else{throw new Error(_0x8941('0x65'));}})[_0x8941('0x14')](function(){if(_0x34d2b3){return respondWithRpcPromise(_0x8941('0x66'),_0x8941('0x67'),_0x34d2b3,client9003)['then'](function(_0x3aca4b){return _0x2b3a86[_0x8941('0x23')]({'read':!![],'messageId':_0x3aca4b[_0x8941('0x68')],'sentAt':moment()[_0x8941('0x69')](_0x8941('0x6a'))});})[_0x8941('0x45')](function(_0x33136d){logger[_0x8941('0x19')]('%s',JSON[_0x8941('0x18')](_0x33136d));return _0x2b3a86;});}return _0x2b3a86;});}return _0x2b3a86;}})[_0x8941('0x14')](respondWithResult(_0x93c00b,0xc9))[_0x8941('0x45')](handleError(_0x93c00b,null));};exports[_0x8941('0x6b')]=function(_0x359dc1,_0x483cab){var _0x3e92fa={'agent':{},'channel':_0x8941('0x6c')};if(_0x359dc1['body']['id']){delete _0x359dc1['body']['id'];}_0x359dc1[_0x8941('0x47')][_0x8941('0x6d')]=!![];_0x359dc1[_0x8941('0x47')][_0x8941('0x6e')]=moment()[_0x8941('0x69')](_0x8941('0x6a'));_0x359dc1[_0x8941('0x47')][_0x8941('0x6f')]=_0x359dc1[_0x8941('0x47')]['UserId']||_0x359dc1['user']['id'];_0x3e92fa[_0x8941('0x70')]['id']=_0x359dc1[_0x8941('0x47')]['UserId'];return db[_0x8941('0x2b')]['find']({'where':{'id':_0x359dc1['params']['id'],'UserId':null}})[_0x8941('0x14')](handleEntityNotFound(_0x483cab,null))[_0x8941('0x14')](saveUpdates(_0x359dc1[_0x8941('0x47')],null))[_0x8941('0x14')](function(_0x57e674){if(_0x57e674){_0x3e92fa['message']=_0x57e674[_0x8941('0x71')]({'plain':!![]});return db[_0x8941('0x72')][_0x8941('0x48')]({'where':{'id':_0x57e674[_0x8941('0x73')]}});}return null;})[_0x8941('0x14')](handleEntityNotFound(_0x483cab,null))[_0x8941('0x14')](function(_0x465745){if(_0x465745){return _0x465745[_0x8941('0x23')]({'UserId':_0x359dc1[_0x8941('0x47')][_0x8941('0x6f')],'read1stAt':_[_0x8941('0x58')](_0x465745[_0x8941('0x74')])?moment()['format'](_0x8941('0x6a')):undefined});}return null;})[_0x8941('0x14')](function(_0x181757){if(_0x181757){_0x3e92fa['interaction']=_0x181757['get']({'plain':!![]});interaction_log[_0x8941('0x1b')](_0x8941('0x75'),_0x359dc1['user']['id'],_0x359dc1[_0x8941('0x5e')][_0x8941('0x28')],_0x359dc1[_0x8941('0x5e')][_0x8941('0x76')],_0x3e92fa[_0x8941('0x77')]['id'],_0x359dc1[_0x8941('0x47')]?JSON[_0x8941('0x18')](_0x359dc1[_0x8941('0x47')]):_0x8941('0x78'));return respondWithRpcPromise(_0x8941('0x79'),_0x8941('0x7a'),_0x3e92fa);}return null;})[_0x8941('0x14')](function(_0x3b034d){var _0x3adc42=_0x8941('0x7b')+_0x3b034d['message']['ContactId'];return db['sequelize'][_0x8941('0x30')](_0x3adc42,{'type':db[_0x8941('0x7c')][_0x8941('0x7d')]['SELECT'],'raw':!![]})[_0x8941('0x14')](function(_0x3d0190){return _0x3d0190;});})['then'](function(_0x7d27aa){if(_0x7d27aa){_0x3e92fa[_0x8941('0x1a')][_0x8941('0x7e')]=_0x7d27aa[0x0];if(!_0x359dc1[_0x8941('0x47')]['UserId'])return;return db[_0x8941('0x7f')][_0x8941('0x48')]({'where':{'id':_0x359dc1['body']['UserId'],'role':_0x8941('0x70')},'attributes':['id',_0x8941('0x28'),_0x8941('0x80'),_0x8941('0x81'),_0x8941('0x82')],'raw':!![]});}return null;})[_0x8941('0x14')](function(_0x4c53c7){if(!_0x4c53c7)return null;_0x3e92fa[_0x8941('0x1a')][_0x8941('0x70')]=_0x4c53c7;return _0x3e92fa;})['then'](function(_0x44dbc9){if(_0x44dbc9){if(_0x359dc1[_0x8941('0x47')]['manual']){_0x3e92fa[_0x8941('0x1a')]['interface']=util[_0x8941('0x69')](_0x8941('0x83'),_0x359dc1[_0x8941('0x5e')][_0x8941('0x28')]);_0x3e92fa[_0x8941('0x1a')][_0x8941('0x84')]=_0x3e92fa['channel'];_0x3e92fa[_0x8941('0x1a')][_0x8941('0x85')]=_0x3e92fa[_0x8941('0x84')];_0x3e92fa[_0x8941('0x1a')][_0x8941('0x86')]=_0x8941('0x6b');_0x3e92fa[_0x8941('0x1a')][_0x8941('0x47')]=htmlToText[_0x8941('0x87')](_0x3e92fa[_0x8941('0x1a')][_0x8941('0x47')]);return respondWithRpcPromise(_0x8941('0x88'),_0x8941('0x88'),{'event':_0x8941('0x89'),'message':_0x3e92fa[_0x8941('0x1a')]},client9002)[_0x8941('0x14')](function(){return _0x3e92fa;});}return _0x3e92fa;}return null;})[_0x8941('0x14')](respondWithResult(_0x483cab,null))['catch'](handleError(_0x483cab,null));};exports['reject']=function(_0x4766ab,_0x1a0952){var _0x82435c={'agent':{},'channel':_0x8941('0x6c')};if(_0x4766ab[_0x8941('0x47')]['id']){delete _0x4766ab[_0x8941('0x47')]['id'];}_0x4766ab['body']['UserId']=_0x4766ab['body'][_0x8941('0x6f')]||_0x4766ab[_0x8941('0x5e')]['id'];_0x82435c['agent']['id']=_0x4766ab[_0x8941('0x47')][_0x8941('0x6f')];return db[_0x8941('0x2b')][_0x8941('0x48')]({'where':{'id':_0x4766ab['params']['id'],'UserId':null}})[_0x8941('0x14')](handleEntityNotFound(_0x1a0952,null))[_0x8941('0x14')](function(_0x113ab2){if(_0x113ab2){_0x82435c['message']=_0x113ab2[_0x8941('0x71')]({'plain':!![]});return db['MailInteraction'][_0x8941('0x48')]({'where':{'id':_0x113ab2[_0x8941('0x73')]}});}return null;})[_0x8941('0x14')](handleEntityNotFound(_0x1a0952,null))['then'](function(_0xf9f233){if(_0xf9f233){_0x82435c['interaction']=_0xf9f233[_0x8941('0x71')]({'plain':!![]});interaction_log[_0x8941('0x1b')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4766ab[_0x8941('0x5e')]['id'],_0x4766ab[_0x8941('0x5e')][_0x8941('0x28')],_0x4766ab[_0x8941('0x5e')][_0x8941('0x76')],_0x82435c[_0x8941('0x77')]['id'],_0x4766ab[_0x8941('0x47')]?JSON[_0x8941('0x18')](_0x4766ab[_0x8941('0x47')]):'null');return respondWithRpcPromise(_0x8941('0x8a'),_0x8941('0x8b'),_0x82435c);}return null;})['then'](function(_0x69a9f5){var _0x1c0c2d=_0x8941('0x7b')+_0x69a9f5['message'][_0x8941('0x8c')];return db[_0x8941('0x8d')][_0x8941('0x30')](_0x1c0c2d,{'type':db[_0x8941('0x7c')][_0x8941('0x7d')][_0x8941('0x8e')],'raw':!![]})[_0x8941('0x14')](function(_0x3d65cc){return _0x3d65cc;});})[_0x8941('0x14')](function(_0x2e6f2b){if(_0x2e6f2b){_0x82435c[_0x8941('0x1a')][_0x8941('0x7e')]=_0x2e6f2b[0x0];if(!_0x4766ab[_0x8941('0x47')][_0x8941('0x6f')])return;return db['User']['find']({'where':{'id':_0x4766ab[_0x8941('0x47')][_0x8941('0x6f')],'role':'agent'},'attributes':['id',_0x8941('0x28'),_0x8941('0x80'),_0x8941('0x81'),_0x8941('0x82')],'raw':!![]});}return null;})[_0x8941('0x14')](function(_0x17bede){if(!_0x17bede)return null;_0x82435c[_0x8941('0x1a')][_0x8941('0x70')]=_0x17bede;return _0x82435c;})[_0x8941('0x14')](function(_0x5a6b94){if(_0x5a6b94){_0x5a6b94['message'][_0x8941('0x8f')]=util[_0x8941('0x69')]('SIP/%s',_0x4766ab[_0x8941('0x5e')][_0x8941('0x28')]);_0x5a6b94['message'][_0x8941('0x84')]=_0x82435c[_0x8941('0x84')];_0x5a6b94[_0x8941('0x1a')][_0x8941('0x85')]=_0x82435c[_0x8941('0x84')];_0x5a6b94[_0x8941('0x1a')][_0x8941('0x86')]=_0x8941('0x90');_0x5a6b94[_0x8941('0x1a')][_0x8941('0x47')]=htmlToText[_0x8941('0x87')](_0x82435c[_0x8941('0x1a')]['body']);respondWithRpcPromise(_0x8941('0x88'),'EventManager',{'event':_0x8941('0x91'),'message':_0x5a6b94[_0x8941('0x1a')]},client9002);return _0x82435c;}return null;})[_0x8941('0x14')](respondWithResult(_0x1a0952,null))['catch'](handleError(_0x1a0952,null));};exports['download']=function(_0xeede48,_0x423d2e){var _0x2eeec5=moment()[_0x8941('0x92')]()['toString']();var _0x20299b=path[_0x8941('0x93')](config[_0x8941('0x61')],'server',_0x8941('0x94'),_0x8941('0x95'));var _0x3f53c7=path['join'](config[_0x8941('0x61')],_0x8941('0x96'),_0x8941('0x94'),_0x8941('0x60'));var _0x2f4567=util[_0x8941('0x69')](_0x8941('0x97'),_0x2eeec5);return db['MailMessage']['find']({'where':{'id':_0xeede48[_0x8941('0x49')]['id']},'attributes':['id',_0x8941('0x47'),_0x8941('0x98'),'to','cc',_0x8941('0x99'),_0x8941('0x9a'),'createdAt'],'include':_0xeede48[_0x8941('0x30')][_0x8941('0x60')]?[{'model':db[_0x8941('0x9b')],'as':_0x8941('0x9c')}]:undefined})[_0x8941('0x14')](handleEntityNotFound(_0x423d2e,null))[_0x8941('0x14')](function(_0x4135fa){if(_0x4135fa){var _0x1d6450=_0x4135fa;var _0x1028b1={'from':_0x1d6450['from'],'to':_0x1d6450['to'],'subject':_0x1d6450[_0x8941('0x9a')],'html':htmlEntities[_0x8941('0x9d')](_0x1d6450[_0x8941('0x47')]),'headers':{'Date':moment(_0x1d6450[_0x8941('0x9e')])[_0x8941('0x69')](_0x8941('0x9f'))},'attachments':[]};if(_0x4135fa['cc']){_0x1028b1[_0x8941('0xa0')]['Cc']=_0x4135fa['cc'];}if(_0x4135fa[_0x8941('0x99')]){_0x1028b1[_0x8941('0xa0')][_0x8941('0xa1')]=_0x4135fa[_0x8941('0x99')];}return new BPromise(function(_0x2e8bc5,_0x4629bc){if(_0x4135fa[_0x8941('0x9c')]){for(var _0x4d5d54=0x0;_0x4d5d54<_0x4135fa['Attachments'][_0x8941('0x37')];_0x4d5d54++){var _0x1cbe56=_0x4135fa[_0x8941('0x9c')][_0x4d5d54];var _0x4a0eab=path[_0x8941('0x93')](_0x3f53c7,_0x1cbe56[_0x8941('0x62')]);if(fs[_0x8941('0xa2')](_0x4a0eab)){_0x1028b1[_0x8941('0x60')][_0x8941('0xa3')]({'name':_0x1cbe56[_0x8941('0x28')],'contentType':_0x1cbe56['type'],'data':fs[_0x8941('0xa4')](_0x4a0eab)});}}}emlformat[_0x8941('0xa5')](_0x1028b1,function(_0x2c9d8a,_0x1cc944){if(_0x2c9d8a)return _0x4629bc(_0x2c9d8a);fs[_0x8941('0xa6')](path['join'](_0x20299b,_0x2f4567),_0x1cc944);return _0x2e8bc5(_0x1cc944);});});}})[_0x8941('0x14')](function(_0x2d5b1e){if(_0x2d5b1e){return _0x423d2e[_0x8941('0xa7')](path[_0x8941('0x93')](_0x20299b,_0x2f4567),_0x2f4567,function(_0x516271){if(!_0x516271)fs[_0x8941('0xa8')](path[_0x8941('0x93')](_0x20299b,_0x2f4567));});}})[_0x8941('0x45')](handleError(_0x423d2e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 0fcf21f..60d93ed 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 _0x5dfb=['events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x39e3b7,_0x5123ef){var _0x1e31a7=function(_0x168820){while(--_0x168820){_0x39e3b7['push'](_0x39e3b7['shift']());}};_0x1e31a7(++_0x5123ef);}(_0x5dfb,0xa0));var _0xb5df=function(_0x5d6725,_0x3f6ef9){_0x5d6725=_0x5d6725-0x0;var _0x275399=_0x5dfb[_0x5d6725];return _0x275399;};'use strict';var EventEmitter=require(_0xb5df('0x0'));var MailMessage=require(_0xb5df('0x1'))['db'][_0xb5df('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb5df('0x3')](0x0);var events={'afterCreate':_0xb5df('0x4'),'afterUpdate':'update','afterDestroy':_0xb5df('0x5')};function emitEvent(_0x24df88){return function(_0x46d15a,_0x1140d8,_0x28d62c){MailMessageEvents[_0xb5df('0x6')](_0x24df88+':'+_0x46d15a['id'],_0x46d15a);MailMessageEvents[_0xb5df('0x6')](_0x24df88,_0x46d15a);_0x28d62c(null);};}for(var e in events){if(events[_0xb5df('0x7')](e)){var event=events[e];MailMessage[_0xb5df('0x8')](e,emitEvent(event));}}module[_0xb5df('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xd0fc=['setMaxListeners','update','remove','emit','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x13b17e,_0x473b92){var _0x30eea5=function(_0xe58d1e){while(--_0xe58d1e){_0x13b17e['push'](_0x13b17e['shift']());}};_0x30eea5(++_0x473b92);}(_0xd0fc,0x192));var _0xcd0f=function(_0x4041c2,_0x25c8e4){_0x4041c2=_0x4041c2-0x0;var _0x276b8a=_0xd0fc[_0x4041c2];return _0x276b8a;};'use strict';var EventEmitter=require(_0xcd0f('0x0'));var MailMessage=require(_0xcd0f('0x1'))['db'][_0xcd0f('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xcd0f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd0f('0x4'),'afterDestroy':_0xcd0f('0x5')};function emitEvent(_0x16df36){return function(_0x220c77,_0x160539,_0x51e565){MailMessageEvents[_0xcd0f('0x6')](_0x16df36+':'+_0x220c77['id'],_0x220c77);MailMessageEvents[_0xcd0f('0x6')](_0x16df36,_0x220c77);_0x51e565(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xcd0f('0x7')](e,emitEvent(event));}}module[_0xcd0f('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 0b36a9e..89fdab7 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 _0x3fd7=['rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','models','get','toLowerCase','out','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0x3fd7,0x1e2));var _0x73fd=function(_0x502a8e,_0x238224){_0x502a8e=_0x502a8e-0x0;var _0x5c7054=_0x3fd7[_0x502a8e];return _0x5c7054;};'use strict';var _=require(_0x73fd('0x0'));var util=require(_0x73fd('0x1'));var logger=require(_0x73fd('0x2'))(_0x73fd('0x3'));var moment=require(_0x73fd('0x4'));var BPromise=require(_0x73fd('0x5'));var rp=require(_0x73fd('0x6'));var htmlToText=require(_0x73fd('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73fd('0x8'));var config=require('../../config/environment');var attributes=require(_0x73fd('0x9'));module[_0x73fd('0xa')]=function(_0xd691dc,_0x566602){return _0xd691dc[_0x73fd('0xb')](_0x73fd('0xc'),attributes,{'tableName':_0x73fd('0xd'),'paranoid':![],'indexes':[{'name':_0x73fd('0xe'),'fields':[_0x73fd('0xe')]},{'name':_0x73fd('0xf'),'fields':['plainBody',_0x73fd('0x10')],'type':_0x73fd('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49ac93,_0x2105f0,_0xcbe9b9){if(_0x49ac93[_0x73fd('0x12')]){_0x49ac93[_0x73fd('0x13')]=htmlToText['fromString'](_0x49ac93['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xcbe9b9(null,_0x2105f0);},'afterCreate':function(_0x3eee74,_0x51d1d1,_0x333262){var _0x6a15d5=_0xd691dc[_0x73fd('0x14')];var _0x5d791e=_0x3eee74[_0x73fd('0x15')]({'plain':!![]});if(_0x5d791e['direction'][_0x73fd('0x16')]()==='in'||_0x5d791e['direction'][_0x73fd('0x16')]()===_0x73fd('0x17')&&!_0x5d791e['secret']&&!_[_0x73fd('0x18')](_0x5d791e['UserId'])){_0x6a15d5[_0x73fd('0x19')][_0x73fd('0x1a')]({'where':{'id':_0x5d791e[_0x73fd('0x1b')]}})[_0x73fd('0x1c')](function(_0x5727cf){if(_0x5727cf){_0x5727cf[_0x73fd('0x1d')]({'lastMsgAt':_0x5d791e[_0x73fd('0x1e')],'lastMsgDirection':_0x5d791e[_0x73fd('0x1f')][_0x73fd('0x16')]()});}})[_0x73fd('0x20')](function(_0x26bcae){console[_0x73fd('0x21')](_0x26bcae);});}_0x333262();}},'charset':'utf8mb4','collate':_0x73fd('0x22')});}; \ No newline at end of file +var _0xbf6c=['define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xbf6c,0xa8));var _0xcbf6=function(_0x28c267,_0x3073df){_0x28c267=_0x28c267-0x0;var _0x1ede50=_0xbf6c[_0x28c267];return _0x1ede50;};'use strict';var _=require(_0xcbf6('0x0'));var util=require(_0xcbf6('0x1'));var logger=require(_0xcbf6('0x2'))(_0xcbf6('0x3'));var moment=require(_0xcbf6('0x4'));var BPromise=require(_0xcbf6('0x5'));var rp=require(_0xcbf6('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xcbf6('0x7'));var rimraf=require(_0xcbf6('0x8'));var config=require(_0xcbf6('0x9'));var attributes=require(_0xcbf6('0xa'));module[_0xcbf6('0xb')]=function(_0x4ab997,_0x4c264c){return _0x4ab997[_0xcbf6('0xc')](_0xcbf6('0xd'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xcbf6('0xe'),'fields':[_0xcbf6('0xe')]},{'name':_0xcbf6('0xf'),'fields':[_0xcbf6('0x10'),_0xcbf6('0x11')],'type':_0xcbf6('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4405c0,_0x143e14,_0xfd7427){if(_0x4405c0[_0xcbf6('0x13')]){_0x4405c0['plainBody']=htmlToText[_0xcbf6('0x14')](_0x4405c0[_0xcbf6('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xfd7427(null,_0x143e14);},'afterCreate':function(_0x45aa08,_0x3e04f2,_0x56e9c9){var _0x5a1321=_0x4ab997[_0xcbf6('0x15')];var _0x551b16=_0x45aa08['get']({'plain':!![]});if(_0x551b16[_0xcbf6('0x16')][_0xcbf6('0x17')]()==='in'||_0x551b16['direction'][_0xcbf6('0x17')]()==='out'&&!_0x551b16[_0xcbf6('0x18')]&&!_[_0xcbf6('0x19')](_0x551b16[_0xcbf6('0x1a')])){_0x5a1321[_0xcbf6('0x1b')][_0xcbf6('0x1c')]({'where':{'id':_0x551b16['MailInteractionId']}})[_0xcbf6('0x1d')](function(_0x22f1a4){if(_0x22f1a4){_0x22f1a4[_0xcbf6('0x1e')]({'lastMsgAt':_0x551b16[_0xcbf6('0x1f')],'lastMsgDirection':_0x551b16[_0xcbf6('0x16')][_0xcbf6('0x17')]()});}})[_0xcbf6('0x20')](function(_0x4e4c58){console[_0xcbf6('0x21')](_0x4e4c58);});}_0x56e9c9();}},'charset':_0xcbf6('0x22'),'collate':_0xcbf6('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8362a02..9c5c824 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 _0x4b17=['error','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','debug','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','stringify'];(function(_0x138e16,_0x188259){var _0x509952=function(_0x394028){while(--_0x394028){_0x138e16['push'](_0x138e16['shift']());}};_0x509952(++_0x188259);}(_0x4b17,0x10f));var _0x74b1=function(_0x403f5f,_0x283f67){_0x403f5f=_0x403f5f-0x0;var _0x15b1cd=_0x4b17[_0x403f5f];return _0x15b1cd;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});config[_0x74b1('0x9')]=_[_0x74b1('0xa')](config[_0x74b1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74b1('0xb'))(new Redis(config[_0x74b1('0x9')]));require(_0x74b1('0xc'))[_0x74b1('0xd')](socket);function respondWithRpcPromise(_0xc1952,_0x4eab15,_0x33f4bf){return new BPromise(function(_0x20bd4c,_0x57f3ad){return client[_0x74b1('0xe')](_0xc1952,_0x33f4bf)[_0x74b1('0xf')](function(_0x6434fd){logger[_0x74b1('0x10')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'),JSON[_0x74b1('0x12')](_0x6434fd));if(_0x6434fd['error']){if(_0x6434fd['error']['code']===0x1f4){logger[_0x74b1('0x13')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0x6434fd['error'][_0x74b1('0x14')]);return _0x57f3ad(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}logger[_0x74b1('0x13')](_0x74b1('0x15'),_0x4eab15,_0x6434fd[_0x74b1('0x13')]['message']);return _0x20bd4c(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}else{logger[_0x74b1('0x10')](_0x74b1('0x15'),_0x4eab15,_0x74b1('0x11'));_0x20bd4c(_0x6434fd[_0x74b1('0x16')][_0x74b1('0x14')]);}})['catch'](function(_0xd50f0){logger[_0x74b1('0x13')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0xd50f0);_0x57f3ad(_0xd50f0);});});}exports[_0x74b1('0x17')]=function(_0x38d932){var _0x39f261=this;return new Promise(function(_0x25704e,_0x13bb44){return db[_0x74b1('0x18')][_0x74b1('0x19')](_0x38d932[_0x74b1('0x1a')],{'raw':_0x38d932['options']?_0x38d932[_0x74b1('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x481bf2){logger[_0x74b1('0x10')](_0x74b1('0x17'),_0x38d932);logger[_0x74b1('0x1c')](_0x74b1('0x17'),_0x38d932,JSON[_0x74b1('0x12')](_0x481bf2));_0x25704e(_0x481bf2);})['catch'](function(_0x3c78e5){logger['error'](_0x74b1('0x17'),_0x3c78e5[_0x74b1('0x14')],_0x38d932);_0x13bb44(_0x39f261[_0x74b1('0x13')](0x1f4,_0x3c78e5[_0x74b1('0x14')]));});});}; \ No newline at end of file +var _0xcf66=['redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','MailMessage,\x20%s,\x20%s','info','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults'];(function(_0x6d205c,_0x305498){var _0x3b5e06=function(_0x112835){while(--_0x112835){_0x6d205c['push'](_0x6d205c['shift']());}};_0x3b5e06(++_0x305498);}(_0xcf66,0x71));var _0x6cf6=function(_0x251697,_0x3c20cc){_0x251697=_0x251697-0x0;var _0x4cba02=_0xcf66[_0x251697];return _0x4cba02;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});config['redis']=_[_0x6cf6('0xa')](config[_0x6cf6('0xb')],{'host':_0x6cf6('0xc'),'port':0x18eb});var socket=require(_0x6cf6('0xd'))(new Redis(config[_0x6cf6('0xb')]));require(_0x6cf6('0xe'))['register'](socket);function respondWithRpcPromise(_0x58378c,_0x5b7f4e,_0x8e90e){return new BPromise(function(_0x504c98,_0x1fdf80){return client[_0x6cf6('0xf')](_0x58378c,_0x8e90e)[_0x6cf6('0x10')](function(_0x3f7fc1){logger['info']('MailMessage,\x20%s,\x20%s',_0x5b7f4e,'request\x20sent');logger[_0x6cf6('0x11')](_0x6cf6('0x12'),_0x5b7f4e,_0x6cf6('0x13'),JSON[_0x6cf6('0x14')](_0x3f7fc1));if(_0x3f7fc1[_0x6cf6('0x15')]){if(_0x3f7fc1[_0x6cf6('0x15')]['code']===0x1f4){logger[_0x6cf6('0x15')]('MailMessage,\x20%s,\x20%s',_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x1fdf80(_0x3f7fc1['error'][_0x6cf6('0x16')]);}logger[_0x6cf6('0x15')](_0x6cf6('0x17'),_0x5b7f4e,_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);return _0x504c98(_0x3f7fc1[_0x6cf6('0x15')][_0x6cf6('0x16')]);}else{logger[_0x6cf6('0x18')](_0x6cf6('0x17'),_0x5b7f4e,_0x6cf6('0x13'));_0x504c98(_0x3f7fc1['result'][_0x6cf6('0x16')]);}})[_0x6cf6('0x19')](function(_0x22ab0){logger['error'](_0x6cf6('0x17'),_0x5b7f4e,_0x22ab0);_0x1fdf80(_0x22ab0);});});}exports[_0x6cf6('0x1a')]=function(_0x101e39){var _0x2995b3=this;return new Promise(function(_0x440634,_0x21e903){return db[_0x6cf6('0x1b')]['create'](_0x101e39[_0x6cf6('0x1c')],{'raw':_0x101e39[_0x6cf6('0x1d')]?_0x101e39[_0x6cf6('0x1d')][_0x6cf6('0x1e')]===undefined?!![]:![]:!![]})[_0x6cf6('0x10')](function(_0x470ea4){logger[_0x6cf6('0x18')](_0x6cf6('0x1a'),_0x101e39);logger['debug']('CreateMailMessage',_0x101e39,JSON[_0x6cf6('0x14')](_0x470ea4));_0x440634(_0x470ea4);})['catch'](function(_0x45ce6e){logger[_0x6cf6('0x15')](_0x6cf6('0x1a'),_0x45ce6e[_0x6cf6('0x16')],_0x101e39);_0x21e903(_0x2995b3[_0x6cf6('0x15')](0x1f4,_0x45ce6e[_0x6cf6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 67f82a0..56e0513 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 _0x57af=['./mailMessage.events','remove','update','removeListener','register','length','mailMessage:'];(function(_0x21eec4,_0x5e721f){var _0x8d34a4=function(_0xd8f8f1){while(--_0xd8f8f1){_0x21eec4['push'](_0x21eec4['shift']());}};_0x8d34a4(++_0x5e721f);}(_0x57af,0xcb));var _0xf57a=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x57af[_0x1a36a5];return _0x746243;};'use strict';var MailMessageEvents=require(_0xf57a('0x0'));var events=['save',_0xf57a('0x1'),_0xf57a('0x2')];function createListener(_0x5d5ba3,_0x5a9f02){return function(_0x61656){_0x5a9f02['emit'](_0x5d5ba3,_0x61656);};}function removeListener(_0x25672a,_0x613cb1){return function(){MailMessageEvents[_0xf57a('0x3')](_0x25672a,_0x613cb1);};}exports[_0xf57a('0x4')]=function(_0x5b9f62){for(var _0x4e3799=0x0,_0x3203f7=events[_0xf57a('0x5')];_0x4e3799<_0x3203f7;_0x4e3799++){var _0x1e6c6e=events[_0x4e3799];var _0x3dff7a=createListener(_0xf57a('0x6')+_0x1e6c6e,_0x5b9f62);MailMessageEvents['on'](_0x1e6c6e,_0x3dff7a);}}; \ No newline at end of file +var _0xa4f9=['length','./mailMessage.events','save','update','emit','removeListener','register'];(function(_0x2d5470,_0x1d44c1){var _0x147a88=function(_0x279827){while(--_0x279827){_0x2d5470['push'](_0x2d5470['shift']());}};_0x147a88(++_0x1d44c1);}(_0xa4f9,0x1cf));var _0x9a4f=function(_0x33766e,_0x5ce103){_0x33766e=_0x33766e-0x0;var _0x30b111=_0xa4f9[_0x33766e];return _0x30b111;};'use strict';var MailMessageEvents=require(_0x9a4f('0x0'));var events=[_0x9a4f('0x1'),'remove',_0x9a4f('0x2')];function createListener(_0x3c620d,_0x9d9e15){return function(_0x22c151){_0x9d9e15[_0x9a4f('0x3')](_0x3c620d,_0x22c151);};}function removeListener(_0x248941,_0x3665a4){return function(){MailMessageEvents[_0x9a4f('0x4')](_0x248941,_0x3665a4);};}exports[_0x9a4f('0x5')]=function(_0x35c8d0){for(var _0x4837a6=0x0,_0x441550=events[_0x9a4f('0x6')];_0x4837a6<_0x441550;_0x4837a6++){var _0x3acf82=events[_0x4837a6];var _0x664e61=createListener('mailMessage:'+_0x3acf82,_0x35c8d0);MailMessageEvents['on'](_0x3acf82,_0x664e61);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b816282..7b307b7 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 _0x3c1b=['/:id/users','getAgents','post','/:id/teams','addTeams','put','update','/:id','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','describe','isAuthenticated','show','/:id/members','getTeams'];(function(_0x1acfb9,_0x52bc80){var _0x1416e3=function(_0x1909d1){while(--_0x1909d1){_0x1acfb9['push'](_0x1acfb9['shift']());}};_0x1416e3(++_0x52bc80);}(_0x3c1b,0xf4));var _0xb3c1=function(_0x4f0d4b,_0x17a152){_0x4f0d4b=_0x4f0d4b-0x0;var _0x27cb6b=_0x3c1b[_0x4f0d4b];return _0x27cb6b;};'use strict';var multer=require(_0xb3c1('0x0'));var util=require(_0xb3c1('0x1'));var path=require('path');var timeout=require(_0xb3c1('0x2'));var express=require(_0xb3c1('0x3'));var router=express[_0xb3c1('0x4')]();var fs_extra=require(_0xb3c1('0x5'));var auth=require(_0xb3c1('0x6'));var interaction=require(_0xb3c1('0x7'));var config=require(_0xb3c1('0x8'));var controller=require(_0xb3c1('0x9'));router[_0xb3c1('0xa')]('/',auth['isAuthenticated'](),controller[_0xb3c1('0xb')]);router[_0xb3c1('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb3c1('0xc')]);router[_0xb3c1('0xa')]('/:id',auth[_0xb3c1('0xd')](),controller[_0xb3c1('0xe')]);router[_0xb3c1('0xa')](_0xb3c1('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb3c1('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb3c1('0x10')]);router['get'](_0xb3c1('0x11'),auth['isAuthenticated'](),controller[_0xb3c1('0x12')]);router[_0xb3c1('0x13')]('/',auth[_0xb3c1('0xd')](),controller['create']);router[_0xb3c1('0x13')](_0xb3c1('0x14'),auth[_0xb3c1('0xd')](),controller[_0xb3c1('0x15')]);router[_0xb3c1('0x13')]('/:id/users',auth[_0xb3c1('0xd')](),controller['addAgents']);router[_0xb3c1('0x16')]('/:id',auth[_0xb3c1('0xd')](),controller[_0xb3c1('0x17')]);router['delete'](_0xb3c1('0x18'),auth['isAuthenticated'](),controller['destroy']);router[_0xb3c1('0x19')](_0xb3c1('0x14'),auth[_0xb3c1('0xd')](),controller[_0xb3c1('0x1a')]);router['delete']('/:id/users',auth[_0xb3c1('0xd')](),controller[_0xb3c1('0x1b')]);module[_0xb3c1('0x1c')]=router; \ No newline at end of file +var _0xf315=['/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','delete','removeTeams','removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf315,0x10d));var _0x5f31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf315[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x5f31('0x0'));var path=require('path');var timeout=require(_0x5f31('0x1'));var express=require(_0x5f31('0x2'));var router=express[_0x5f31('0x3')]();var fs_extra=require(_0x5f31('0x4'));var auth=require(_0x5f31('0x5'));var interaction=require(_0x5f31('0x6'));var config=require(_0x5f31('0x7'));var controller=require(_0x5f31('0x8'));router['get']('/',auth[_0x5f31('0x9')](),controller['index']);router[_0x5f31('0xa')](_0x5f31('0xb'),auth[_0x5f31('0x9')](),controller[_0x5f31('0xc')]);router[_0x5f31('0xa')](_0x5f31('0xd'),auth[_0x5f31('0x9')](),controller[_0x5f31('0xe')]);router[_0x5f31('0xa')](_0x5f31('0xf'),auth[_0x5f31('0x9')](),controller[_0x5f31('0x10')]);router[_0x5f31('0xa')](_0x5f31('0x11'),auth[_0x5f31('0x9')](),controller[_0x5f31('0x12')]);router['get'](_0x5f31('0x13'),auth['isAuthenticated'](),controller[_0x5f31('0x14')]);router[_0x5f31('0x15')]('/',auth[_0x5f31('0x9')](),controller[_0x5f31('0x16')]);router[_0x5f31('0x15')]('/:id/teams',auth[_0x5f31('0x9')](),controller[_0x5f31('0x17')]);router[_0x5f31('0x15')](_0x5f31('0x13'),auth[_0x5f31('0x9')](),controller['addAgents']);router['put'](_0x5f31('0xd'),auth[_0x5f31('0x9')](),controller[_0x5f31('0x18')]);router[_0x5f31('0x19')](_0x5f31('0xd'),auth[_0x5f31('0x9')](),controller['destroy']);router[_0x5f31('0x19')]('/:id/teams',auth[_0x5f31('0x9')](),controller[_0x5f31('0x1a')]);router[_0x5f31('0x19')](_0x5f31('0x13'),auth['isAuthenticated'](),controller[_0x5f31('0x1b')]);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 38254bf..85b5988 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 _0x31ed=['ENUM','rrmemory','beepall','roundrobin','sequelize','STRING','name','INTEGER'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x31ed,0x64));var _0xd31e=function(_0x3a961d,_0x21d3bd){_0x3a961d=_0x3a961d-0x0;var _0x1fb225=_0x31ed[_0x3a961d];return _0x1fb225;};'use strict';var Sequelize=require(_0xd31e('0x0'));module['exports']={'name':{'type':Sequelize[_0xd31e('0x1')],'unique':_0xd31e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd31e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd31e('0x4')](_0xd31e('0x5'),_0xd31e('0x6'),_0xd31e('0x7'))}}; \ No newline at end of file +var _0xd47f=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x287e0b,_0x40ec4a){var _0x1fca35=function(_0x55874a){while(--_0x55874a){_0x287e0b['push'](_0x287e0b['shift']());}};_0x1fca35(++_0x40ec4a);}(_0xd47f,0xc1));var _0xfd47=function(_0x5a7e7e,_0x14d5ad){_0x5a7e7e=_0x5a7e7e-0x0;var _0x57e099=_0xd47f[_0x5a7e7e];return _0x57e099;};'use strict';var Sequelize=require(_0xfd47('0x0'));module[_0xfd47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd47('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfd47('0x3')]},'timeout':{'type':Sequelize[_0xfd47('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfd47('0x5')](_0xfd47('0x6'),'beepall',_0xfd47('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index b9f3d6c..9d50a18 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 _0xc882=['redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','then','get','MailQueues','name','send','index','key','model','map','query','attributes','intersection','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','MailQueue','include','rows','catch','show','params','keys','rawAttributes','fields','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','order','pick','MailQueueId','findAll','UserId','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','sequelize','QueryTypes','SELECT','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x58b2ea,_0x4aa146){var _0x406452=function(_0x7dbde7){while(--_0x7dbde7){_0x58b2ea['push'](_0x58b2ea['shift']());}};_0x406452(++_0x4aa146);}(_0xc882,0xff));var _0x2c88=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc882[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x2c88('0x0'));var rimraf=require(_0x2c88('0x1'));var zipdir=require(_0x2c88('0x2'));var jsonpatch=require(_0x2c88('0x3'));var rp=require(_0x2c88('0x4'));var moment=require(_0x2c88('0x5'));var BPromise=require(_0x2c88('0x6'));var Mustache=require(_0x2c88('0x7'));var util=require(_0x2c88('0x8'));var path=require(_0x2c88('0x9'));var sox=require(_0x2c88('0xa'));var csv=require(_0x2c88('0xb'));var ejs=require(_0x2c88('0xc'));var fs=require('fs');var fs_extra=require(_0x2c88('0xd'));var _=require(_0x2c88('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2c88('0xf'));var toCsv=require(_0x2c88('0xb'));var querystring=require('querystring');var Papa=require(_0x2c88('0x10'));var Redis=require(_0x2c88('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2c88('0x12'));var as=require(_0x2c88('0x13'));var hardwareService=require(_0x2c88('0x14'));var logger=require('../../config/logger')(_0x2c88('0x15'));var utils=require(_0x2c88('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2c88('0x17'));var db=require(_0x2c88('0x18'))['db'];config['redis']=_['defaults'](config[_0x2c88('0x19')],{'host':_0x2c88('0x1a'),'port':0x18eb});var socket=require(_0x2c88('0x1b'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x2c88('0x1c')](socket);function respondWithStatusCode(_0x4aa1df,_0x3a1cc0){_0x3a1cc0=_0x3a1cc0||0xcc;return function(_0x10649a){if(_0x10649a){return _0x4aa1df[_0x2c88('0x1d')](_0x3a1cc0);}return _0x4aa1df[_0x2c88('0x1e')](_0x3a1cc0)[_0x2c88('0x1f')]();};}function respondWithResult(_0xa3f02,_0x5039d8){_0x5039d8=_0x5039d8||0xc8;return function(_0x4e13dc){if(_0x4e13dc){return _0xa3f02[_0x2c88('0x1e')](_0x5039d8)['json'](_0x4e13dc);}};}function respondWithFilteredResult(_0x5d77d8,_0x332896){return function(_0xa4cf77){if(_0xa4cf77){var _0x30e93c=typeof _0x332896[_0x2c88('0x20')]===_0x2c88('0x21')&&typeof _0x332896[_0x2c88('0x22')]==='undefined';var _0x1125ef=_0xa4cf77[_0x2c88('0x23')];var _0x23e02a=_0x30e93c?0x0:_0x332896[_0x2c88('0x20')];var _0x4f5374=_0x30e93c?_0xa4cf77[_0x2c88('0x23')]:_0x332896[_0x2c88('0x20')]+_0x332896[_0x2c88('0x22')];var _0x414d9a;if(_0x4f5374>=_0x1125ef){_0x4f5374=_0x1125ef;_0x414d9a=0xc8;}else{_0x414d9a=0xce;}_0x5d77d8['status'](_0x414d9a);return _0x5d77d8[_0x2c88('0x24')]('Content-Range',_0x23e02a+'-'+_0x4f5374+'/'+_0x1125ef)[_0x2c88('0x25')](_0xa4cf77);}return null;};}function patchUpdates(_0x598b4a){return function(_0x2d86e5){try{jsonpatch[_0x2c88('0x26')](_0x2d86e5,_0x598b4a,!![]);}catch(_0x73722){return BPromise[_0x2c88('0x27')](_0x73722);}return _0x2d86e5[_0x2c88('0x28')]();};}function saveUpdates(_0x5f3921,_0x51f30b){return function(_0x43010f){if(_0x43010f){return _0x43010f[_0x2c88('0x29')](_0x5f3921)['then'](function(_0x5d415b){return _0x5d415b;});}return null;};}function removeEntity(_0xdf2891,_0x37a585){return function(_0x437a9c){if(_0x437a9c){return _0x437a9c[_0x2c88('0x2a')]()[_0x2c88('0x2b')](function(){var _0x323f32=_0x437a9c[_0x2c88('0x2c')]({'plain':!![]});var _0x34c8e2=_0x2c88('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x34c8e2,'resourceId':_0x323f32['id']}})['then'](function(){return _0x437a9c;});})[_0x2c88('0x2b')](function(){_0xdf2891[_0x2c88('0x1e')](0xcc)[_0x2c88('0x1f')]();});}};}function handleEntityNotFound(_0x51ed0b,_0x402084){return function(_0x10da45){if(!_0x10da45){_0x51ed0b[_0x2c88('0x1d')](0x194);}return _0x10da45;};}function handleError(_0x269620,_0x1b6e5c){_0x1b6e5c=_0x1b6e5c||0x1f4;return function(_0x49ad23){logger['error'](_0x49ad23['stack']);if(_0x49ad23[_0x2c88('0x2e')]){delete _0x49ad23[_0x2c88('0x2e')];}_0x269620[_0x2c88('0x1e')](_0x1b6e5c)[_0x2c88('0x2f')](_0x49ad23);};}exports[_0x2c88('0x30')]=function(_0x1abe2e,_0x315e61){var _0x2f73d3={},_0x20c1ca={},_0x1bde07={'count':0x0,'rows':[]};var _0x18626d=_['map'](db['MailQueue']['rawAttributes'],function(_0x18d08b){return{'name':_0x18d08b['fieldName'],'type':_0x18d08b['type'][_0x2c88('0x31')]};});_0x20c1ca[_0x2c88('0x32')]=_[_0x2c88('0x33')](_0x18626d,_0x2c88('0x2e'));_0x20c1ca['query']=_['keys'](_0x1abe2e[_0x2c88('0x34')]);_0x20c1ca['filters']=_['intersection'](_0x20c1ca[_0x2c88('0x32')],_0x20c1ca[_0x2c88('0x34')]);_0x2f73d3[_0x2c88('0x35')]=_[_0x2c88('0x36')](_0x20c1ca[_0x2c88('0x32')],qs['fields'](_0x1abe2e[_0x2c88('0x34')]['fields']));_0x2f73d3['attributes']=_0x2f73d3[_0x2c88('0x35')][_0x2c88('0x37')]?_0x2f73d3[_0x2c88('0x35')]:_0x20c1ca[_0x2c88('0x32')];if(!_0x1abe2e[_0x2c88('0x34')][_0x2c88('0x38')](_0x2c88('0x39'))){_0x2f73d3[_0x2c88('0x22')]=qs[_0x2c88('0x22')](_0x1abe2e['query'][_0x2c88('0x22')]);_0x2f73d3[_0x2c88('0x20')]=qs[_0x2c88('0x20')](_0x1abe2e[_0x2c88('0x34')][_0x2c88('0x20')]);}_0x2f73d3['order']=qs['sort'](_0x1abe2e[_0x2c88('0x34')][_0x2c88('0x3a')]);_0x2f73d3[_0x2c88('0x3b')]=qs[_0x2c88('0x3c')](_['pick'](_0x1abe2e[_0x2c88('0x34')],_0x20c1ca[_0x2c88('0x3c')]),_0x18626d);if(_0x1abe2e[_0x2c88('0x34')][_0x2c88('0x3d')]){_0x2f73d3[_0x2c88('0x3b')]=_[_0x2c88('0x3e')](_0x2f73d3[_0x2c88('0x3b')],{'$or':_[_0x2c88('0x33')](_0x18626d,function(_0x429661){if(_0x429661[_0x2c88('0x3f')]!==_0x2c88('0x40')){var _0x19da26={};_0x19da26[_0x429661[_0x2c88('0x2e')]]={'$like':'%'+_0x1abe2e['query'][_0x2c88('0x3d')]+'%'};return _0x19da26;}})});}_0x2f73d3=_[_0x2c88('0x3e')]({},_0x2f73d3,_0x1abe2e[_0x2c88('0x41')]);var _0x4d8cc7={'where':_0x2f73d3[_0x2c88('0x3b')]};return db[_0x2c88('0x42')][_0x2c88('0x23')](_0x4d8cc7)[_0x2c88('0x2b')](function(_0xcae066){_0x1bde07[_0x2c88('0x23')]=_0xcae066;if(_0x1abe2e[_0x2c88('0x34')]['includeAll']){_0x2f73d3[_0x2c88('0x43')]=[{'all':!![]}];}return db[_0x2c88('0x42')]['findAll'](_0x2f73d3);})['then'](function(_0x340544){_0x1bde07[_0x2c88('0x44')]=_0x340544;return _0x1bde07;})['then'](respondWithFilteredResult(_0x315e61,_0x2f73d3))[_0x2c88('0x45')](handleError(_0x315e61,null));};exports[_0x2c88('0x46')]=function(_0x4b039b,_0x53569d){var _0x4af687={'raw':!![],'where':{'id':_0x4b039b[_0x2c88('0x47')]['id']}},_0x163ee0={};_0x163ee0['model']=_[_0x2c88('0x48')](db['MailQueue'][_0x2c88('0x49')]);_0x163ee0[_0x2c88('0x34')]=_[_0x2c88('0x48')](_0x4b039b[_0x2c88('0x34')]);_0x163ee0['filters']=_[_0x2c88('0x36')](_0x163ee0[_0x2c88('0x32')],_0x163ee0[_0x2c88('0x34')]);_0x4af687[_0x2c88('0x35')]=_[_0x2c88('0x36')](_0x163ee0[_0x2c88('0x32')],qs[_0x2c88('0x4a')](_0x4b039b[_0x2c88('0x34')][_0x2c88('0x4a')]));_0x4af687[_0x2c88('0x35')]=_0x4af687[_0x2c88('0x35')][_0x2c88('0x37')]?_0x4af687[_0x2c88('0x35')]:_0x163ee0[_0x2c88('0x32')];if(_0x4b039b[_0x2c88('0x34')][_0x2c88('0x4b')]){_0x4af687[_0x2c88('0x43')]=[{'all':!![]}];}_0x4af687=_['merge']({},_0x4af687,_0x4b039b[_0x2c88('0x41')]);return db[_0x2c88('0x42')]['find'](_0x4af687)[_0x2c88('0x2b')](handleEntityNotFound(_0x53569d,null))[_0x2c88('0x2b')](respondWithResult(_0x53569d,null))[_0x2c88('0x45')](handleError(_0x53569d,null));};exports[_0x2c88('0x4c')]=function(_0x5352ce,_0x2e1fd7){return db[_0x2c88('0x42')][_0x2c88('0x4c')](_0x5352ce[_0x2c88('0x4d')],{})[_0x2c88('0x2b')](function(_0x1b189a){var _0x5e9f2b=_0x5352ce['user'][_0x2c88('0x2c')]({'plain':!![]});if(!_0x5e9f2b)throw new Error(_0x2c88('0x4e'));if(_0x5e9f2b['role']==='user'){var _0x4dd4e4=_0x1b189a['get']({'plain':!![]});var _0x486a5b=_0x2c88('0x2d');return db[_0x2c88('0x4f')][_0x2c88('0x50')]({'where':{'name':_0x486a5b,'userProfileId':_0x5e9f2b['userProfileId']},'raw':!![]})[_0x2c88('0x2b')](function(_0x5da5a0){if(_0x5da5a0&&_0x5da5a0[_0x2c88('0x51')]===0x0){return db[_0x2c88('0x52')]['create']({'name':_0x4dd4e4['name'],'resourceId':_0x4dd4e4['id'],'type':_0x5da5a0[_0x2c88('0x2e')],'sectionId':_0x5da5a0['id']},{})[_0x2c88('0x2b')](function(){return _0x1b189a;});}else{return _0x1b189a;}})[_0x2c88('0x45')](function(_0x54a6c3){logger['error'](_0x2c88('0x53'),_0x54a6c3);throw _0x54a6c3;});}return _0x1b189a;})['then'](respondWithResult(_0x2e1fd7,0xc9))[_0x2c88('0x45')](handleError(_0x2e1fd7,null));};exports[_0x2c88('0x29')]=function(_0x42653b,_0x48ec68){if(_0x42653b[_0x2c88('0x4d')]['id']){delete _0x42653b[_0x2c88('0x4d')]['id'];}return db[_0x2c88('0x42')][_0x2c88('0x50')]({'where':{'id':_0x42653b[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0x48ec68,null))[_0x2c88('0x2b')](saveUpdates(_0x42653b[_0x2c88('0x4d')],null))[_0x2c88('0x2b')](respondWithResult(_0x48ec68,null))['catch'](handleError(_0x48ec68,null));};exports[_0x2c88('0x2a')]=function(_0x1afd42,_0xe913bd){return db[_0x2c88('0x42')][_0x2c88('0x50')]({'where':{'id':_0x1afd42[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0xe913bd,null))['then'](removeEntity(_0xe913bd,null))[_0x2c88('0x45')](handleError(_0xe913bd,null));};exports[_0x2c88('0x54')]=function(_0x190a71,_0x245c47){return db[_0x2c88('0x42')][_0x2c88('0x54')]()[_0x2c88('0x2b')](respondWithResult(_0x245c47,null))[_0x2c88('0x45')](handleError(_0x245c47,null));};exports[_0x2c88('0x55')]=function(_0x1780a9,_0x1aa8ff,_0x256119){var _0x1007dc={'raw':!![],'where':{}},_0x2b33a4={},_0xc35b43;return db[_0x2c88('0x42')][_0x2c88('0x56')]({'where':{'id':_0x1780a9['params']['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0x1aa8ff,null))['then'](function(_0x5702e4){if(_0x5702e4){_0xc35b43=_0x5702e4[_0x2c88('0x2c')]({'plain':!![]});_0x2b33a4[_0x2c88('0x32')]=_[_0x2c88('0x48')](db[_0x2c88('0x57')][_0x2c88('0x49')]);_0x2b33a4[_0x2c88('0x34')]=_['keys'](_0x1780a9[_0x2c88('0x34')]);_0x2b33a4['filters']=_['intersection'](_0x2b33a4[_0x2c88('0x32')],_0x2b33a4[_0x2c88('0x34')]);_0x1007dc[_0x2c88('0x35')]=_[_0x2c88('0x36')](_0x2b33a4[_0x2c88('0x32')],qs['fields'](_0x1780a9[_0x2c88('0x34')]['fields']));_0x1007dc[_0x2c88('0x35')]=_0x1007dc[_0x2c88('0x35')]['length']?_0x1007dc[_0x2c88('0x35')]:_0x2b33a4[_0x2c88('0x32')];if(!_0x1780a9[_0x2c88('0x34')][_0x2c88('0x38')]('nolimit')){_0x1007dc[_0x2c88('0x22')]=qs[_0x2c88('0x22')](_0x1780a9[_0x2c88('0x34')][_0x2c88('0x22')]);_0x1007dc[_0x2c88('0x20')]=qs[_0x2c88('0x20')](_0x1780a9['query'][_0x2c88('0x20')]);}_0x1007dc[_0x2c88('0x58')]=qs[_0x2c88('0x3a')](_0x1780a9[_0x2c88('0x34')][_0x2c88('0x3a')]);_0x1007dc['where']=qs[_0x2c88('0x3c')](_[_0x2c88('0x59')](_0x1780a9[_0x2c88('0x34')],_0x2b33a4[_0x2c88('0x3c')]));_0x1007dc['where'][_0x2c88('0x5a')]=_0x5702e4['id'];if(_0x1780a9['query'][_0x2c88('0x3d')]){_0x1007dc[_0x2c88('0x3b')]=_[_0x2c88('0x3e')](_0x1007dc[_0x2c88('0x3b')],{'$or':_['map'](_0x1007dc[_0x2c88('0x35')],function(_0x2b2887){var _0x5257be={};_0x5257be[_0x2b2887]={'$like':'%'+_0x1780a9[_0x2c88('0x34')][_0x2c88('0x3d')]+'%'};return _0x5257be;})});}_0x1007dc=_['merge']({},_0x1007dc,_0x1780a9[_0x2c88('0x41')]);return db[_0x2c88('0x57')][_0x2c88('0x5b')](_0x1007dc);}})[_0x2c88('0x2b')](function(_0x2f404c){if(_0x2f404c){return db['User']['findAndCountAll']({'where':{'id':_[_0x2c88('0x33')](_0x2f404c,_0x2c88('0x5c')),'role':'agent'},'attributes':['id',_0x2c88('0x2e'),_0x2c88('0x5d'),_0x2c88('0x5e'),'createdAt']});}})[_0x2c88('0x2b')](function(_0x51b12d){if(_0x51b12d){return{'count':_0x51b12d[_0x2c88('0x23')],'rows':_['map'](_0x51b12d[_0x2c88('0x44')],function(_0x2731b2){return{'membername':_0x2731b2[_0x2c88('0x2e')],'UserId':_0x2731b2['id'],'queue_name':_0xc35b43[_0x2c88('0x2e')],'MailQueueId':_0xc35b43['id'],'interface':util[_0x2c88('0x5f')](_0x2c88('0x60'),_0x2c88('0x61'),_0x2731b2[_0x2c88('0x2e')]),'penalty':0x0,'paused':_0x2731b2[_0x2c88('0x5d')],'createdAt':_0x2731b2[_0x2c88('0x62')],'updatedAt':_0x2731b2[_0x2c88('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2c88('0x2b')](respondWithFilteredResult(_0x1aa8ff,_0x1007dc))['catch'](handleError(_0x1aa8ff,null));};exports[_0x2c88('0x63')]=function(_0x26ed2c,_0x50834f,_0x542d3b){var _0x3aa5e2={};var _0x1020de={};var _0x4388fa;var _0x1e88dd;return db['MailQueue'][_0x2c88('0x56')]({'where':{'id':_0x26ed2c[_0x2c88('0x47')]['id']}})['then'](handleEntityNotFound(_0x50834f,null))['then'](function(_0x4146cc){if(_0x4146cc){_0x4388fa=_0x4146cc;_0x1020de['model']=_[_0x2c88('0x48')](db[_0x2c88('0x64')][_0x2c88('0x49')]);_0x1020de[_0x2c88('0x34')]=_[_0x2c88('0x48')](_0x26ed2c[_0x2c88('0x34')]);_0x1020de[_0x2c88('0x3c')]=_[_0x2c88('0x36')](_0x1020de['model'],_0x1020de['query']);_0x3aa5e2[_0x2c88('0x35')]=_[_0x2c88('0x36')](_0x1020de[_0x2c88('0x32')],qs[_0x2c88('0x4a')](_0x26ed2c[_0x2c88('0x34')][_0x2c88('0x4a')]));_0x3aa5e2[_0x2c88('0x35')]=_0x3aa5e2['attributes'][_0x2c88('0x37')]?_0x3aa5e2[_0x2c88('0x35')]:_0x1020de['model'];_0x3aa5e2[_0x2c88('0x58')]=qs[_0x2c88('0x3a')](_0x26ed2c[_0x2c88('0x34')][_0x2c88('0x3a')]);_0x3aa5e2[_0x2c88('0x3b')]=qs[_0x2c88('0x3c')](_[_0x2c88('0x59')](_0x26ed2c[_0x2c88('0x34')],_0x1020de[_0x2c88('0x3c')]));if(_0x26ed2c[_0x2c88('0x34')][_0x2c88('0x3d')]){_0x3aa5e2[_0x2c88('0x3b')]=_[_0x2c88('0x3e')](_0x3aa5e2[_0x2c88('0x3b')],{'$or':_['map'](_0x3aa5e2[_0x2c88('0x35')],function(_0x11dc8f){var _0x46c291={};_0x46c291[_0x11dc8f]={'$like':'%'+_0x26ed2c[_0x2c88('0x34')]['filter']+'%'};return _0x46c291;})});}_0x3aa5e2=_[_0x2c88('0x3e')]({},_0x3aa5e2,_0x26ed2c[_0x2c88('0x41')]);return _0x4388fa['getTeams'](_0x3aa5e2);}})[_0x2c88('0x2b')](function(_0x375046){if(_0x375046){_0x1e88dd=_0x375046[_0x2c88('0x37')];if(!_0x26ed2c['query'][_0x2c88('0x38')](_0x2c88('0x39'))){_0x3aa5e2[_0x2c88('0x22')]=qs[_0x2c88('0x22')](_0x26ed2c[_0x2c88('0x34')]['limit']);_0x3aa5e2['offset']=qs[_0x2c88('0x20')](_0x26ed2c['query'][_0x2c88('0x20')]);}return _0x4388fa[_0x2c88('0x63')](_0x3aa5e2);}})['then'](function(_0x3ef4ee){if(_0x3ef4ee){return _0x3ef4ee?{'count':_0x1e88dd,'rows':_0x3ef4ee}:null;}})[_0x2c88('0x2b')](respondWithResult(_0x50834f,null))[_0x2c88('0x45')](handleError(_0x50834f,null));};exports[_0x2c88('0x65')]=function(_0x222c8f,_0x415de5,_0x2a6125){var _0x2e2898=_0x222c8f['body'][_0x2c88('0x66')];return db['Team'][_0x2c88('0x5b')]({'where':{'id':_0x2e2898},'attributes':['id'],'include':[{'model':db[_0x2c88('0x67')],'as':'Agents','attributes':['id',_0x2c88('0x2e'),_0x2c88('0x68'),_0x2c88('0x69'),_0x2c88('0x6a')],'raw':!![]}]})[_0x2c88('0x2b')](function(_0x5e2de6){if(_0x5e2de6){var _0x275b2e=_[_0x2c88('0x6b')](_0x5e2de6,function(_0x1e79ae){var _0x55d38d=_0x1e79ae[_0x2c88('0x2c')]({'plain':!![]});return _0x55d38d[_0x2c88('0x6c')];});return db['MailQueue'][_0x2c88('0x50')]({'where':{'id':_0x222c8f['params']['id']}})['then'](function(_0x1d31aa){return db['sequelize'][_0x2c88('0x6d')](function(_0x47b7ac){return _0x1d31aa[_0x2c88('0x65')](_0x2e2898,{'transaction':_0x47b7ac})[_0x2c88('0x2b')](function(){return BPromise[_0x2c88('0x6e')](_0x275b2e,function(_0x4e9230){return db[_0x2c88('0x57')][_0x2c88('0x6f')]({'where':{'UserId':_0x4e9230['id'],'MailQueueId':_0x222c8f['params']['id']},'transaction':_0x47b7ac});});})['then'](function(){_0x275b2e[_0x2c88('0x70')](function(_0x36751){socket[_0x2c88('0x71')](_0x2c88('0x72'),{'UserId':_0x36751['id'],'MailQueueId':_0x1d31aa['id']});});});});});}})[_0x2c88('0x2b')](respondWithStatusCode(_0x415de5,null))[_0x2c88('0x45')](handleError(_0x415de5,null));};exports['removeTeams']=function(_0x66b007,_0x2418a4,_0x1198b2){return db[_0x2c88('0x64')][_0x2c88('0x5b')]({'where':{'id':_0x66b007[_0x2c88('0x34')][_0x2c88('0x66')]},'attributes':['id'],'include':[{'model':db[_0x2c88('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2c88('0x2b')](handleEntityNotFound(_0x2418a4,null))[_0x2c88('0x2b')](function(_0x16d4c8){var _0x3dcb31=_[_0x2c88('0x33')](_0x16d4c8,'id');var _0x48b85b=[];var _0x570e08=[];var _0x1d393e=squel[_0x2c88('0x73')]();_0x1d393e[_0x2c88('0x74')](_0x2c88('0x75'))[_0x2c88('0x76')](_0x2c88('0x77'),'tq')[_0x2c88('0x78')]('user_has_teams','ut',_0x2c88('0x79'))[_0x2c88('0x3b')]('MailQueueId\x20=\x20?',_0x66b007['params']['id']);for(var _0x4ccb31=0x0;_0x4ccb31<_0x16d4c8[_0x2c88('0x37')];_0x4ccb31+=0x1){let _0x25097a=_0x16d4c8[_0x4ccb31];for(var _0x567889=0x0;_0x567889<_0x25097a[_0x2c88('0x6c')]['length'];_0x567889+=0x1){let _0x5aaed3=_0x25097a[_0x2c88('0x6c')][_0x567889];var _0x4684fd=_0x1d393e[_0x2c88('0x7a')]();_0x4684fd[_0x2c88('0x3b')](_0x2c88('0x7b'),_0x5aaed3['id']);_0x570e08['push'](db[_0x2c88('0x7c')][_0x2c88('0x34')](_0x4684fd['toString'](),{'type':db[_0x2c88('0x7c')][_0x2c88('0x7d')][_0x2c88('0x7e')]})[_0x2c88('0x2b')](function(_0x492d2f){if(_0x492d2f[_0x2c88('0x37')]===0x1){return _0x5aaed3['id'];}else{var _0xec4901=_[_0x2c88('0x7f')](_[_0x2c88('0x33')](_0x492d2f,'TeamId'),function(_0x25a882){return _['includes'](_0x3dcb31,_0x25a882);});if(_0xec4901){return _0x5aaed3['id'];}}}));}}return BPromise[_0x2c88('0x80')](_0x570e08)[_0x2c88('0x2b')](function(_0x16813d){_0x48b85b=_(_0x48b85b)[_0x2c88('0x81')](_0x16813d)[_0x2c88('0x82')]()[_0x2c88('0x83')]();return db[_0x2c88('0x42')][_0x2c88('0x50')]({'where':{'id':_0x66b007[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](function(_0x32bdcd){return db[_0x2c88('0x7c')]['transaction'](function(_0x283cfa){return _0x32bdcd[_0x2c88('0x84')](_0x66b007[_0x2c88('0x34')][_0x2c88('0x66')],{'transaction':_0x283cfa})[_0x2c88('0x2b')](function(){if(!_[_0x2c88('0x85')](_0x48b85b)){return _0x32bdcd[_0x2c88('0x86')](_0x48b85b,{'transaction':_0x283cfa});}})[_0x2c88('0x2b')](function(){_0x48b85b[_0x2c88('0x70')](function(_0x3ac423){socket[_0x2c88('0x71')](_0x2c88('0x87'),{'UserId':_0x3ac423,'MailQueueId':_0x32bdcd['id']});});});});});});})[_0x2c88('0x2b')](respondWithStatusCode(_0x2418a4,null))[_0x2c88('0x45')](handleError(_0x2418a4,null));};exports[_0x2c88('0x88')]=function(_0x17305e,_0x4eea47,_0x59456d){return db['MailQueue'][_0x2c88('0x50')]({'where':{'id':_0x17305e[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0x4eea47,null))[_0x2c88('0x2b')](function(_0xbd53c6){if(_0xbd53c6){return _0xbd53c6[_0x2c88('0x88')](_0x17305e[_0x2c88('0x4d')][_0x2c88('0x66')],_['omit'](_0x17305e[_0x2c88('0x4d')],[_0x2c88('0x66'),'id'])||{})[_0x2c88('0x89')](function(_0x14c61c){for(var _0x54a939=0x0;_0x54a939<_0x17305e['body'][_0x2c88('0x66')]['length'];_0x54a939+=0x1){socket[_0x2c88('0x71')]('userMailQueue:save',{'UserId':Number(_0x17305e[_0x2c88('0x4d')]['ids'][_0x54a939]),'MailQueueId':Number(_0x17305e['params']['id'])});}return _0x14c61c;});}})[_0x2c88('0x2b')](respondWithResult(_0x4eea47,null))[_0x2c88('0x45')](handleError(_0x4eea47,null));};exports[_0x2c88('0x86')]=function(_0x4649a6,_0x1b22cb,_0x5d685a){return db[_0x2c88('0x42')][_0x2c88('0x50')]({'where':{'id':_0x4649a6[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0x1b22cb,null))['then'](function(_0x14bc7b){if(_0x14bc7b){return _0x14bc7b[_0x2c88('0x86')](_0x4649a6[_0x2c88('0x34')]['ids'])[_0x2c88('0x2b')](function(){if(_[_0x2c88('0x8a')](_0x4649a6[_0x2c88('0x34')]['ids'])){for(var _0x5f3f2a=0x0;_0x5f3f2a<_0x4649a6['query'][_0x2c88('0x66')][_0x2c88('0x37')];_0x5f3f2a+=0x1){socket[_0x2c88('0x71')](_0x2c88('0x87'),{'UserId':Number(_0x4649a6[_0x2c88('0x34')]['ids'][_0x5f3f2a]),'MailQueueId':Number(_0x4649a6['params']['id'])});}}else{socket['emit'](_0x2c88('0x87'),{'UserId':Number(_0x4649a6[_0x2c88('0x34')][_0x2c88('0x66')]),'MailQueueId':Number(_0x4649a6[_0x2c88('0x47')]['id'])});}});}})[_0x2c88('0x2b')](respondWithStatusCode(_0x1b22cb,null))['catch'](handleError(_0x1b22cb,null));};exports[_0x2c88('0x8b')]=function(_0x21e748,_0x1994c7,_0x155578){var _0x51605e={};var _0xbb6f95={};var _0x5ef523;var _0x5d7f62;return db[_0x2c88('0x42')]['findOne']({'where':{'id':_0x21e748[_0x2c88('0x47')]['id']}})[_0x2c88('0x2b')](handleEntityNotFound(_0x1994c7,null))[_0x2c88('0x2b')](function(_0x11a899){if(_0x11a899){_0x5ef523=_0x11a899;_0xbb6f95[_0x2c88('0x32')]=_[_0x2c88('0x48')](db['User'][_0x2c88('0x49')]);_0xbb6f95[_0x2c88('0x34')]=_[_0x2c88('0x48')](_0x21e748['query']);_0xbb6f95[_0x2c88('0x3c')]=_['intersection'](_0xbb6f95['model'],_0xbb6f95[_0x2c88('0x34')]);_0x51605e[_0x2c88('0x35')]=_[_0x2c88('0x36')](_0xbb6f95['model'],qs[_0x2c88('0x4a')](_0x21e748[_0x2c88('0x34')][_0x2c88('0x4a')]));_0x51605e['attributes']=_0x51605e['attributes'][_0x2c88('0x37')]?_0x51605e['attributes']:_0xbb6f95['model'];_0x51605e[_0x2c88('0x58')]=qs[_0x2c88('0x3a')](_0x21e748[_0x2c88('0x34')][_0x2c88('0x3a')]);_0x51605e['where']=qs[_0x2c88('0x3c')](_[_0x2c88('0x59')](_0x21e748[_0x2c88('0x34')],_0xbb6f95[_0x2c88('0x3c')]));if(_0x21e748[_0x2c88('0x34')][_0x2c88('0x3d')]){_0x51605e['where']=_[_0x2c88('0x3e')](_0x51605e[_0x2c88('0x3b')],{'$or':_[_0x2c88('0x33')](_0x51605e[_0x2c88('0x35')],function(_0x1bd588){var _0x33264d={};_0x33264d[_0x1bd588]={'$like':'%'+_0x21e748[_0x2c88('0x34')][_0x2c88('0x3d')]+'%'};return _0x33264d;})});}_0x51605e=_[_0x2c88('0x3e')]({},_0x51605e,_0x21e748['options']);return _0x5ef523['getAgents'](_0x51605e);}})['then'](function(_0x3563f9){if(_0x3563f9){_0x5d7f62=_0x3563f9[_0x2c88('0x37')];if(!_0x21e748[_0x2c88('0x34')]['hasOwnProperty']('nolimit')){_0x51605e[_0x2c88('0x22')]=qs[_0x2c88('0x22')](_0x21e748[_0x2c88('0x34')][_0x2c88('0x22')]);_0x51605e[_0x2c88('0x20')]=qs['offset'](_0x21e748[_0x2c88('0x34')][_0x2c88('0x20')]);}return _0x5ef523[_0x2c88('0x8b')](_0x51605e);}})[_0x2c88('0x2b')](function(_0x348a3f){if(_0x348a3f){return _0x348a3f?{'count':_0x5d7f62,'rows':_0x348a3f}:null;}})[_0x2c88('0x2b')](respondWithResult(_0x1994c7,null))[_0x2c88('0x45')](handleError(_0x1994c7,null));}; \ No newline at end of file +var _0xe6d7=['request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','map','VIRTUAL','merge','options','MailQueue','includeAll','rows','catch','show','params','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','createdAt','format','%s/%s','SIP','mailPause','updatedAt','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','Team','field','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','rimraf','fast-json-patch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x5bd1a9,_0x313714){_0x5bd1a9=_0x5bd1a9-0x0;var _0x2ba345=_0xe6d7[_0x5bd1a9];return _0x2ba345;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7e6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7e6d('0x1'));var rp=require(_0x7e6d('0x2'));var moment=require(_0x7e6d('0x3'));var BPromise=require(_0x7e6d('0x4'));var Mustache=require('mustache');var util=require(_0x7e6d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x7e6d('0x6'));var ejs=require(_0x7e6d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e6d('0x8'));var squel=require(_0x7e6d('0x9'));var crypto=require(_0x7e6d('0xa'));var jsforce=require(_0x7e6d('0xb'));var deskjs=require(_0x7e6d('0xc'));var toCsv=require(_0x7e6d('0x6'));var querystring=require(_0x7e6d('0xd'));var Papa=require(_0x7e6d('0xe'));var Redis=require(_0x7e6d('0xf'));var authService=require(_0x7e6d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7e6d('0x11'));var hardwareService=require(_0x7e6d('0x12'));var logger=require(_0x7e6d('0x13'))(_0x7e6d('0x14'));var utils=require('../../config/utils');var config=require(_0x7e6d('0x15'));var licenseUtil=require(_0x7e6d('0x16'));var db=require('../../mysqldb')['db'];config[_0x7e6d('0x17')]=_[_0x7e6d('0x18')](config[_0x7e6d('0x17')],{'host':_0x7e6d('0x19'),'port':0x18eb});var socket=require(_0x7e6d('0x1a'))(new Redis(config[_0x7e6d('0x17')]));require(_0x7e6d('0x1b'))[_0x7e6d('0x1c')](socket);function respondWithStatusCode(_0x3b93ad,_0x2a610c){_0x2a610c=_0x2a610c||0xcc;return function(_0x5cad83){if(_0x5cad83){return _0x3b93ad['sendStatus'](_0x2a610c);}return _0x3b93ad[_0x7e6d('0x1d')](_0x2a610c)[_0x7e6d('0x1e')]();};}function respondWithResult(_0x5ef607,_0x3cfc3a){_0x3cfc3a=_0x3cfc3a||0xc8;return function(_0x52596b){if(_0x52596b){return _0x5ef607[_0x7e6d('0x1d')](_0x3cfc3a)[_0x7e6d('0x1f')](_0x52596b);}};}function respondWithFilteredResult(_0x27a5f4,_0x1fcd09){return function(_0x5b154b){if(_0x5b154b){var _0x46c4b7=typeof _0x1fcd09[_0x7e6d('0x20')]==='undefined'&&typeof _0x1fcd09[_0x7e6d('0x21')]===_0x7e6d('0x22');var _0x3d3d1b=_0x5b154b[_0x7e6d('0x23')];var _0x55abaf=_0x46c4b7?0x0:_0x1fcd09[_0x7e6d('0x20')];var _0x38bff3=_0x46c4b7?_0x5b154b[_0x7e6d('0x23')]:_0x1fcd09['offset']+_0x1fcd09[_0x7e6d('0x21')];var _0x42a000;if(_0x38bff3>=_0x3d3d1b){_0x38bff3=_0x3d3d1b;_0x42a000=0xc8;}else{_0x42a000=0xce;}_0x27a5f4[_0x7e6d('0x1d')](_0x42a000);return _0x27a5f4[_0x7e6d('0x24')]('Content-Range',_0x55abaf+'-'+_0x38bff3+'/'+_0x3d3d1b)[_0x7e6d('0x1f')](_0x5b154b);}return null;};}function patchUpdates(_0x2ebd41){return function(_0x228985){try{jsonpatch['apply'](_0x228985,_0x2ebd41,!![]);}catch(_0x1ce7bb){return BPromise[_0x7e6d('0x25')](_0x1ce7bb);}return _0x228985[_0x7e6d('0x26')]();};}function saveUpdates(_0x188739,_0x1e90a7){return function(_0xe52193){if(_0xe52193){return _0xe52193[_0x7e6d('0x27')](_0x188739)[_0x7e6d('0x28')](function(_0x37c4f3){return _0x37c4f3;});}return null;};}function removeEntity(_0x23dafe,_0x3c7b36){return function(_0x20dfe2){if(_0x20dfe2){return _0x20dfe2[_0x7e6d('0x29')]()[_0x7e6d('0x28')](function(){var _0x1004f4=_0x20dfe2[_0x7e6d('0x2a')]({'plain':!![]});var _0x5e507d='MailQueues';return db[_0x7e6d('0x2b')][_0x7e6d('0x29')]({'where':{'type':_0x5e507d,'resourceId':_0x1004f4['id']}})['then'](function(){return _0x20dfe2;});})[_0x7e6d('0x28')](function(){_0x23dafe[_0x7e6d('0x1d')](0xcc)[_0x7e6d('0x1e')]();});}};}function handleEntityNotFound(_0x29cabb,_0x58b4ff){return function(_0xc9c26f){if(!_0xc9c26f){_0x29cabb[_0x7e6d('0x2c')](0x194);}return _0xc9c26f;};}function handleError(_0x3f1a6b,_0x42341d){_0x42341d=_0x42341d||0x1f4;return function(_0x113d27){logger[_0x7e6d('0x2d')](_0x113d27[_0x7e6d('0x2e')]);if(_0x113d27[_0x7e6d('0x2f')]){delete _0x113d27[_0x7e6d('0x2f')];}_0x3f1a6b['status'](_0x42341d)['send'](_0x113d27);};}exports[_0x7e6d('0x30')]=function(_0x159e7d,_0x587108){var _0x56599c={},_0x2acac9={},_0x3ac54d={'count':0x0,'rows':[]};var _0x5773e2=_['map'](db['MailQueue'][_0x7e6d('0x31')],function(_0x297439){return{'name':_0x297439[_0x7e6d('0x32')],'type':_0x297439[_0x7e6d('0x33')][_0x7e6d('0x34')]};});_0x2acac9[_0x7e6d('0x35')]=_['map'](_0x5773e2,'name');_0x2acac9[_0x7e6d('0x36')]=_[_0x7e6d('0x37')](_0x159e7d[_0x7e6d('0x36')]);_0x2acac9['filters']=_[_0x7e6d('0x38')](_0x2acac9['model'],_0x2acac9[_0x7e6d('0x36')]);_0x56599c[_0x7e6d('0x39')]=_[_0x7e6d('0x38')](_0x2acac9[_0x7e6d('0x35')],qs[_0x7e6d('0x3a')](_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x3a')]));_0x56599c[_0x7e6d('0x39')]=_0x56599c['attributes'][_0x7e6d('0x3b')]?_0x56599c[_0x7e6d('0x39')]:_0x2acac9[_0x7e6d('0x35')];if(!_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x3c')](_0x7e6d('0x3d'))){_0x56599c['limit']=qs[_0x7e6d('0x21')](_0x159e7d['query']['limit']);_0x56599c['offset']=qs['offset'](_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x20')]);}_0x56599c[_0x7e6d('0x3e')]=qs['sort'](_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x3f')]);_0x56599c['where']=qs['filters'](_[_0x7e6d('0x40')](_0x159e7d[_0x7e6d('0x36')],_0x2acac9[_0x7e6d('0x41')]),_0x5773e2);if(_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x42')]){_0x56599c[_0x7e6d('0x43')]=_['merge'](_0x56599c['where'],{'$or':_[_0x7e6d('0x44')](_0x5773e2,function(_0x2b3078){if(_0x2b3078[_0x7e6d('0x33')]!==_0x7e6d('0x45')){var _0x1c614f={};_0x1c614f[_0x2b3078[_0x7e6d('0x2f')]]={'$like':'%'+_0x159e7d['query']['filter']+'%'};return _0x1c614f;}})});}_0x56599c=_[_0x7e6d('0x46')]({},_0x56599c,_0x159e7d[_0x7e6d('0x47')]);var _0x4d6953={'where':_0x56599c['where']};return db[_0x7e6d('0x48')][_0x7e6d('0x23')](_0x4d6953)[_0x7e6d('0x28')](function(_0x126f10){_0x3ac54d[_0x7e6d('0x23')]=_0x126f10;if(_0x159e7d[_0x7e6d('0x36')][_0x7e6d('0x49')]){_0x56599c['include']=[{'all':!![]}];}return db[_0x7e6d('0x48')]['findAll'](_0x56599c);})[_0x7e6d('0x28')](function(_0x1ea118){_0x3ac54d[_0x7e6d('0x4a')]=_0x1ea118;return _0x3ac54d;})['then'](respondWithFilteredResult(_0x587108,_0x56599c))[_0x7e6d('0x4b')](handleError(_0x587108,null));};exports[_0x7e6d('0x4c')]=function(_0x474cac,_0xb3157e){var _0x3e66df={'raw':!![],'where':{'id':_0x474cac[_0x7e6d('0x4d')]['id']}},_0x5c30e1={};_0x5c30e1['model']=_['keys'](db[_0x7e6d('0x48')]['rawAttributes']);_0x5c30e1[_0x7e6d('0x36')]=_['keys'](_0x474cac[_0x7e6d('0x36')]);_0x5c30e1[_0x7e6d('0x41')]=_['intersection'](_0x5c30e1['model'],_0x5c30e1[_0x7e6d('0x36')]);_0x3e66df['attributes']=_[_0x7e6d('0x38')](_0x5c30e1[_0x7e6d('0x35')],qs[_0x7e6d('0x3a')](_0x474cac['query'][_0x7e6d('0x3a')]));_0x3e66df[_0x7e6d('0x39')]=_0x3e66df['attributes'][_0x7e6d('0x3b')]?_0x3e66df[_0x7e6d('0x39')]:_0x5c30e1[_0x7e6d('0x35')];if(_0x474cac[_0x7e6d('0x36')][_0x7e6d('0x49')]){_0x3e66df[_0x7e6d('0x4e')]=[{'all':!![]}];}_0x3e66df=_['merge']({},_0x3e66df,_0x474cac[_0x7e6d('0x47')]);return db[_0x7e6d('0x48')][_0x7e6d('0x4f')](_0x3e66df)[_0x7e6d('0x28')](handleEntityNotFound(_0xb3157e,null))['then'](respondWithResult(_0xb3157e,null))['catch'](handleError(_0xb3157e,null));};exports[_0x7e6d('0x50')]=function(_0x118edf,_0x2f60cb){return db['MailQueue'][_0x7e6d('0x50')](_0x118edf[_0x7e6d('0x51')],{})[_0x7e6d('0x28')](function(_0x494ed1){var _0x3a686e=_0x118edf['user']['get']({'plain':!![]});if(!_0x3a686e)throw new Error(_0x7e6d('0x52'));if(_0x3a686e[_0x7e6d('0x53')]===_0x7e6d('0x54')){var _0x41e68d=_0x494ed1[_0x7e6d('0x2a')]({'plain':!![]});var _0x396d3b='MailQueues';return db[_0x7e6d('0x55')][_0x7e6d('0x4f')]({'where':{'name':_0x396d3b,'userProfileId':_0x3a686e[_0x7e6d('0x56')]},'raw':!![]})[_0x7e6d('0x28')](function(_0x4ad938){if(_0x4ad938&&_0x4ad938[_0x7e6d('0x57')]===0x0){return db[_0x7e6d('0x2b')][_0x7e6d('0x50')]({'name':_0x41e68d[_0x7e6d('0x2f')],'resourceId':_0x41e68d['id'],'type':_0x4ad938[_0x7e6d('0x2f')],'sectionId':_0x4ad938['id']},{})[_0x7e6d('0x28')](function(){return _0x494ed1;});}else{return _0x494ed1;}})['catch'](function(_0x2338d5){logger[_0x7e6d('0x2d')](_0x7e6d('0x58'),_0x2338d5);throw _0x2338d5;});}return _0x494ed1;})['then'](respondWithResult(_0x2f60cb,0xc9))[_0x7e6d('0x4b')](handleError(_0x2f60cb,null));};exports[_0x7e6d('0x27')]=function(_0x259274,_0x18f572){if(_0x259274['body']['id']){delete _0x259274[_0x7e6d('0x51')]['id'];}return db[_0x7e6d('0x48')]['find']({'where':{'id':_0x259274[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0x18f572,null))[_0x7e6d('0x28')](saveUpdates(_0x259274['body'],null))[_0x7e6d('0x28')](respondWithResult(_0x18f572,null))[_0x7e6d('0x4b')](handleError(_0x18f572,null));};exports[_0x7e6d('0x29')]=function(_0x50944f,_0x13ef87){return db[_0x7e6d('0x48')]['find']({'where':{'id':_0x50944f[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0x13ef87,null))[_0x7e6d('0x28')](removeEntity(_0x13ef87,null))[_0x7e6d('0x4b')](handleError(_0x13ef87,null));};exports[_0x7e6d('0x59')]=function(_0xb71d53,_0x22dae4){return db[_0x7e6d('0x48')][_0x7e6d('0x59')]()[_0x7e6d('0x28')](respondWithResult(_0x22dae4,null))['catch'](handleError(_0x22dae4,null));};exports[_0x7e6d('0x5a')]=function(_0x261d00,_0xa486ae,_0x5d51aa){var _0x33895f={'raw':!![],'where':{}},_0x2d1402={},_0x5cad18;return db[_0x7e6d('0x48')][_0x7e6d('0x5b')]({'where':{'id':_0x261d00[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0xa486ae,null))[_0x7e6d('0x28')](function(_0x29df87){if(_0x29df87){_0x5cad18=_0x29df87['get']({'plain':!![]});_0x2d1402[_0x7e6d('0x35')]=_['keys'](db[_0x7e6d('0x5c')][_0x7e6d('0x31')]);_0x2d1402[_0x7e6d('0x36')]=_[_0x7e6d('0x37')](_0x261d00['query']);_0x2d1402[_0x7e6d('0x41')]=_[_0x7e6d('0x38')](_0x2d1402[_0x7e6d('0x35')],_0x2d1402['query']);_0x33895f[_0x7e6d('0x39')]=_['intersection'](_0x2d1402['model'],qs[_0x7e6d('0x3a')](_0x261d00[_0x7e6d('0x36')]['fields']));_0x33895f[_0x7e6d('0x39')]=_0x33895f[_0x7e6d('0x39')][_0x7e6d('0x3b')]?_0x33895f[_0x7e6d('0x39')]:_0x2d1402[_0x7e6d('0x35')];if(!_0x261d00[_0x7e6d('0x36')][_0x7e6d('0x3c')](_0x7e6d('0x3d'))){_0x33895f[_0x7e6d('0x21')]=qs[_0x7e6d('0x21')](_0x261d00[_0x7e6d('0x36')][_0x7e6d('0x21')]);_0x33895f[_0x7e6d('0x20')]=qs['offset'](_0x261d00[_0x7e6d('0x36')][_0x7e6d('0x20')]);}_0x33895f[_0x7e6d('0x3e')]=qs[_0x7e6d('0x3f')](_0x261d00[_0x7e6d('0x36')]['sort']);_0x33895f[_0x7e6d('0x43')]=qs[_0x7e6d('0x41')](_['pick'](_0x261d00[_0x7e6d('0x36')],_0x2d1402[_0x7e6d('0x41')]));_0x33895f['where']['MailQueueId']=_0x29df87['id'];if(_0x261d00[_0x7e6d('0x36')][_0x7e6d('0x42')]){_0x33895f[_0x7e6d('0x43')]=_['merge'](_0x33895f['where'],{'$or':_[_0x7e6d('0x44')](_0x33895f[_0x7e6d('0x39')],function(_0x209679){var _0x2826e3={};_0x2826e3[_0x209679]={'$like':'%'+_0x261d00[_0x7e6d('0x36')]['filter']+'%'};return _0x2826e3;})});}_0x33895f=_[_0x7e6d('0x46')]({},_0x33895f,_0x261d00[_0x7e6d('0x47')]);return db[_0x7e6d('0x5c')][_0x7e6d('0x5d')](_0x33895f);}})[_0x7e6d('0x28')](function(_0x176880){if(_0x176880){return db[_0x7e6d('0x5e')][_0x7e6d('0x5f')]({'where':{'id':_['map'](_0x176880,_0x7e6d('0x60')),'role':_0x7e6d('0x61')},'attributes':['id',_0x7e6d('0x2f'),'mailPause','updatedAt',_0x7e6d('0x62')]});}})[_0x7e6d('0x28')](function(_0x382ad7){if(_0x382ad7){return{'count':_0x382ad7[_0x7e6d('0x23')],'rows':_[_0x7e6d('0x44')](_0x382ad7['rows'],function(_0xb61957){return{'membername':_0xb61957[_0x7e6d('0x2f')],'UserId':_0xb61957['id'],'queue_name':_0x5cad18['name'],'MailQueueId':_0x5cad18['id'],'interface':util[_0x7e6d('0x63')](_0x7e6d('0x64'),_0x7e6d('0x65'),_0xb61957[_0x7e6d('0x2f')]),'penalty':0x0,'paused':_0xb61957[_0x7e6d('0x66')],'createdAt':_0xb61957[_0x7e6d('0x62')],'updatedAt':_0xb61957[_0x7e6d('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xa486ae,_0x33895f))[_0x7e6d('0x4b')](handleError(_0xa486ae,null));};exports['getTeams']=function(_0x1d1a29,_0xfbfd2e,_0x58923b){var _0x48dbbc={};var _0x418b67={};var _0x5dedbe;var _0x42f968;return db['MailQueue'][_0x7e6d('0x5b')]({'where':{'id':_0x1d1a29[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0xfbfd2e,null))['then'](function(_0x4a2bfd){if(_0x4a2bfd){_0x5dedbe=_0x4a2bfd;_0x418b67[_0x7e6d('0x35')]=_[_0x7e6d('0x37')](db['Team'][_0x7e6d('0x31')]);_0x418b67[_0x7e6d('0x36')]=_[_0x7e6d('0x37')](_0x1d1a29['query']);_0x418b67[_0x7e6d('0x41')]=_[_0x7e6d('0x38')](_0x418b67['model'],_0x418b67[_0x7e6d('0x36')]);_0x48dbbc['attributes']=_[_0x7e6d('0x38')](_0x418b67[_0x7e6d('0x35')],qs[_0x7e6d('0x3a')](_0x1d1a29[_0x7e6d('0x36')]['fields']));_0x48dbbc[_0x7e6d('0x39')]=_0x48dbbc[_0x7e6d('0x39')][_0x7e6d('0x3b')]?_0x48dbbc[_0x7e6d('0x39')]:_0x418b67['model'];_0x48dbbc[_0x7e6d('0x3e')]=qs[_0x7e6d('0x3f')](_0x1d1a29[_0x7e6d('0x36')][_0x7e6d('0x3f')]);_0x48dbbc['where']=qs[_0x7e6d('0x41')](_[_0x7e6d('0x40')](_0x1d1a29[_0x7e6d('0x36')],_0x418b67[_0x7e6d('0x41')]));if(_0x1d1a29[_0x7e6d('0x36')]['filter']){_0x48dbbc[_0x7e6d('0x43')]=_[_0x7e6d('0x46')](_0x48dbbc['where'],{'$or':_[_0x7e6d('0x44')](_0x48dbbc['attributes'],function(_0x298f4b){var _0x597f5c={};_0x597f5c[_0x298f4b]={'$like':'%'+_0x1d1a29[_0x7e6d('0x36')][_0x7e6d('0x42')]+'%'};return _0x597f5c;})});}_0x48dbbc=_[_0x7e6d('0x46')]({},_0x48dbbc,_0x1d1a29[_0x7e6d('0x47')]);return _0x5dedbe[_0x7e6d('0x68')](_0x48dbbc);}})['then'](function(_0x2de636){if(_0x2de636){_0x42f968=_0x2de636[_0x7e6d('0x3b')];if(!_0x1d1a29[_0x7e6d('0x36')][_0x7e6d('0x3c')](_0x7e6d('0x3d'))){_0x48dbbc[_0x7e6d('0x21')]=qs[_0x7e6d('0x21')](_0x1d1a29[_0x7e6d('0x36')]['limit']);_0x48dbbc[_0x7e6d('0x20')]=qs[_0x7e6d('0x20')](_0x1d1a29[_0x7e6d('0x36')]['offset']);}return _0x5dedbe['getTeams'](_0x48dbbc);}})[_0x7e6d('0x28')](function(_0x26b8c6){if(_0x26b8c6){return _0x26b8c6?{'count':_0x42f968,'rows':_0x26b8c6}:null;}})[_0x7e6d('0x28')](respondWithResult(_0xfbfd2e,null))[_0x7e6d('0x4b')](handleError(_0xfbfd2e,null));};exports[_0x7e6d('0x69')]=function(_0x4c84f7,_0x2d9b5e,_0x32e563){var _0x5c044f=_0x4c84f7[_0x7e6d('0x51')][_0x7e6d('0x6a')];return db['Team'][_0x7e6d('0x5d')]({'where':{'id':_0x5c044f},'attributes':['id'],'include':[{'model':db[_0x7e6d('0x5e')],'as':_0x7e6d('0x6b'),'attributes':['id',_0x7e6d('0x2f'),_0x7e6d('0x6c'),_0x7e6d('0x6d'),_0x7e6d('0x6e')],'raw':!![]}]})[_0x7e6d('0x28')](function(_0x2c254d){if(_0x2c254d){var _0x492e05=_['flatMap'](_0x2c254d,function(_0x269d51){var _0x6185e6=_0x269d51[_0x7e6d('0x2a')]({'plain':!![]});return _0x6185e6['Agents'];});return db[_0x7e6d('0x48')][_0x7e6d('0x4f')]({'where':{'id':_0x4c84f7[_0x7e6d('0x4d')]['id']}})['then'](function(_0x49572f){return db[_0x7e6d('0x6f')][_0x7e6d('0x70')](function(_0x57091f){return _0x49572f['addTeams'](_0x5c044f,{'transaction':_0x57091f})[_0x7e6d('0x28')](function(){return BPromise[_0x7e6d('0x71')](_0x492e05,function(_0x48b979){return db[_0x7e6d('0x5c')][_0x7e6d('0x72')]({'where':{'UserId':_0x48b979['id'],'MailQueueId':_0x4c84f7[_0x7e6d('0x4d')]['id']},'transaction':_0x57091f});});})[_0x7e6d('0x28')](function(){_0x492e05[_0x7e6d('0x73')](function(_0x36c627){socket[_0x7e6d('0x74')](_0x7e6d('0x75'),{'UserId':_0x36c627['id'],'MailQueueId':_0x49572f['id']});});});});});}})[_0x7e6d('0x28')](respondWithStatusCode(_0x2d9b5e,null))[_0x7e6d('0x4b')](handleError(_0x2d9b5e,null));};exports[_0x7e6d('0x76')]=function(_0x1df110,_0x5fd26a,_0x37b0c0){return db[_0x7e6d('0x77')]['findAll']({'where':{'id':_0x1df110[_0x7e6d('0x36')][_0x7e6d('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x7e6d('0x5e')],'as':_0x7e6d('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x7e6d('0x28')](handleEntityNotFound(_0x5fd26a,null))[_0x7e6d('0x28')](function(_0x1e6a4f){var _0x5af991=_[_0x7e6d('0x44')](_0x1e6a4f,'id');var _0x5138c2=[];var _0x3a0ab1=[];var _0x4e4776=squel['select']();_0x4e4776[_0x7e6d('0x78')]('tq.TeamId')[_0x7e6d('0x79')](_0x7e6d('0x7a'),'tq')[_0x7e6d('0x7b')](_0x7e6d('0x7c'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7e6d('0x43')](_0x7e6d('0x7d'),_0x1df110[_0x7e6d('0x4d')]['id']);for(var _0x2c59a8=0x0;_0x2c59a8<_0x1e6a4f[_0x7e6d('0x3b')];_0x2c59a8+=0x1){let _0x556076=_0x1e6a4f[_0x2c59a8];for(var _0x50cdff=0x0;_0x50cdff<_0x556076[_0x7e6d('0x6b')][_0x7e6d('0x3b')];_0x50cdff+=0x1){let _0x2867af=_0x556076[_0x7e6d('0x6b')][_0x50cdff];var _0x5311b1=_0x4e4776[_0x7e6d('0x7e')]();_0x5311b1[_0x7e6d('0x43')](_0x7e6d('0x7f'),_0x2867af['id']);_0x3a0ab1['push'](db[_0x7e6d('0x6f')][_0x7e6d('0x36')](_0x5311b1[_0x7e6d('0x80')](),{'type':db[_0x7e6d('0x6f')][_0x7e6d('0x81')]['SELECT']})[_0x7e6d('0x28')](function(_0x3a0970){if(_0x3a0970[_0x7e6d('0x3b')]===0x1){return _0x2867af['id'];}else{var _0x41a9fe=_[_0x7e6d('0x82')](_['map'](_0x3a0970,_0x7e6d('0x83')),function(_0x15fa9e){return _[_0x7e6d('0x84')](_0x5af991,_0x15fa9e);});if(_0x41a9fe){return _0x2867af['id'];}}}));}}return BPromise[_0x7e6d('0x85')](_0x3a0ab1)[_0x7e6d('0x28')](function(_0x59df48){_0x5138c2=_(_0x5138c2)[_0x7e6d('0x86')](_0x59df48)['compact']()[_0x7e6d('0x87')]();return db[_0x7e6d('0x48')][_0x7e6d('0x4f')]({'where':{'id':_0x1df110[_0x7e6d('0x4d')]['id']}})['then'](function(_0x53fae8){return db['sequelize'][_0x7e6d('0x70')](function(_0xcb4e38){return _0x53fae8[_0x7e6d('0x76')](_0x1df110[_0x7e6d('0x36')][_0x7e6d('0x6a')],{'transaction':_0xcb4e38})['then'](function(){if(!_[_0x7e6d('0x88')](_0x5138c2)){return _0x53fae8['removeAgents'](_0x5138c2,{'transaction':_0xcb4e38});}})[_0x7e6d('0x28')](function(){_0x5138c2[_0x7e6d('0x73')](function(_0x3960a2){socket['emit'](_0x7e6d('0x89'),{'UserId':_0x3960a2,'MailQueueId':_0x53fae8['id']});});});});});});})[_0x7e6d('0x28')](respondWithStatusCode(_0x5fd26a,null))[_0x7e6d('0x4b')](handleError(_0x5fd26a,null));};exports[_0x7e6d('0x8a')]=function(_0x4fade6,_0x15c7a1,_0x41d527){return db[_0x7e6d('0x48')]['find']({'where':{'id':_0x4fade6['params']['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0x15c7a1,null))[_0x7e6d('0x28')](function(_0x1282cd){if(_0x1282cd){return _0x1282cd[_0x7e6d('0x8a')](_0x4fade6[_0x7e6d('0x51')][_0x7e6d('0x6a')],_[_0x7e6d('0x8b')](_0x4fade6[_0x7e6d('0x51')],[_0x7e6d('0x6a'),'id'])||{})[_0x7e6d('0x8c')](function(_0x39c5b6){for(var _0x354e1e=0x0;_0x354e1e<_0x4fade6[_0x7e6d('0x51')][_0x7e6d('0x6a')][_0x7e6d('0x3b')];_0x354e1e+=0x1){socket[_0x7e6d('0x74')](_0x7e6d('0x75'),{'UserId':Number(_0x4fade6['body'][_0x7e6d('0x6a')][_0x354e1e]),'MailQueueId':Number(_0x4fade6[_0x7e6d('0x4d')]['id'])});}return _0x39c5b6;});}})[_0x7e6d('0x28')](respondWithResult(_0x15c7a1,null))[_0x7e6d('0x4b')](handleError(_0x15c7a1,null));};exports[_0x7e6d('0x8d')]=function(_0x498146,_0x42a665,_0x179912){return db[_0x7e6d('0x48')]['find']({'where':{'id':_0x498146[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0x42a665,null))[_0x7e6d('0x28')](function(_0x55b4b5){if(_0x55b4b5){return _0x55b4b5[_0x7e6d('0x8d')](_0x498146[_0x7e6d('0x36')][_0x7e6d('0x6a')])[_0x7e6d('0x28')](function(){if(_[_0x7e6d('0x8e')](_0x498146[_0x7e6d('0x36')][_0x7e6d('0x6a')])){for(var _0x2920d2=0x0;_0x2920d2<_0x498146[_0x7e6d('0x36')][_0x7e6d('0x6a')][_0x7e6d('0x3b')];_0x2920d2+=0x1){socket[_0x7e6d('0x74')](_0x7e6d('0x89'),{'UserId':Number(_0x498146[_0x7e6d('0x36')]['ids'][_0x2920d2]),'MailQueueId':Number(_0x498146[_0x7e6d('0x4d')]['id'])});}}else{socket['emit'](_0x7e6d('0x89'),{'UserId':Number(_0x498146['query'][_0x7e6d('0x6a')]),'MailQueueId':Number(_0x498146['params']['id'])});}});}})[_0x7e6d('0x28')](respondWithStatusCode(_0x42a665,null))[_0x7e6d('0x4b')](handleError(_0x42a665,null));};exports[_0x7e6d('0x8f')]=function(_0x56d2cc,_0x43e782,_0x2204fd){var _0x59d631={};var _0x232ea0={};var _0x43659c;var _0x123cc3;return db[_0x7e6d('0x48')][_0x7e6d('0x5b')]({'where':{'id':_0x56d2cc[_0x7e6d('0x4d')]['id']}})[_0x7e6d('0x28')](handleEntityNotFound(_0x43e782,null))[_0x7e6d('0x28')](function(_0x13e3b1){if(_0x13e3b1){_0x43659c=_0x13e3b1;_0x232ea0[_0x7e6d('0x35')]=_[_0x7e6d('0x37')](db['User'][_0x7e6d('0x31')]);_0x232ea0['query']=_[_0x7e6d('0x37')](_0x56d2cc[_0x7e6d('0x36')]);_0x232ea0['filters']=_[_0x7e6d('0x38')](_0x232ea0[_0x7e6d('0x35')],_0x232ea0[_0x7e6d('0x36')]);_0x59d631['attributes']=_[_0x7e6d('0x38')](_0x232ea0[_0x7e6d('0x35')],qs[_0x7e6d('0x3a')](_0x56d2cc[_0x7e6d('0x36')][_0x7e6d('0x3a')]));_0x59d631[_0x7e6d('0x39')]=_0x59d631['attributes']['length']?_0x59d631['attributes']:_0x232ea0[_0x7e6d('0x35')];_0x59d631[_0x7e6d('0x3e')]=qs[_0x7e6d('0x3f')](_0x56d2cc[_0x7e6d('0x36')]['sort']);_0x59d631[_0x7e6d('0x43')]=qs[_0x7e6d('0x41')](_[_0x7e6d('0x40')](_0x56d2cc[_0x7e6d('0x36')],_0x232ea0[_0x7e6d('0x41')]));if(_0x56d2cc[_0x7e6d('0x36')][_0x7e6d('0x42')]){_0x59d631[_0x7e6d('0x43')]=_[_0x7e6d('0x46')](_0x59d631[_0x7e6d('0x43')],{'$or':_[_0x7e6d('0x44')](_0x59d631[_0x7e6d('0x39')],function(_0x58bc1d){var _0x1d52c4={};_0x1d52c4[_0x58bc1d]={'$like':'%'+_0x56d2cc['query'][_0x7e6d('0x42')]+'%'};return _0x1d52c4;})});}_0x59d631=_[_0x7e6d('0x46')]({},_0x59d631,_0x56d2cc[_0x7e6d('0x47')]);return _0x43659c[_0x7e6d('0x8f')](_0x59d631);}})[_0x7e6d('0x28')](function(_0xc87609){if(_0xc87609){_0x123cc3=_0xc87609['length'];if(!_0x56d2cc[_0x7e6d('0x36')][_0x7e6d('0x3c')](_0x7e6d('0x3d'))){_0x59d631['limit']=qs[_0x7e6d('0x21')](_0x56d2cc[_0x7e6d('0x36')][_0x7e6d('0x21')]);_0x59d631[_0x7e6d('0x20')]=qs['offset'](_0x56d2cc['query']['offset']);}return _0x43659c[_0x7e6d('0x8f')](_0x59d631);}})[_0x7e6d('0x28')](function(_0x5b9f70){if(_0x5b9f70){return _0x5b9f70?{'count':_0x123cc3,'rows':_0x5b9f70}:null;}})[_0x7e6d('0x28')](respondWithResult(_0x43e782,null))[_0x7e6d('0x4b')](handleError(_0x43e782,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 6e8abeb..2f8c173 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 _0xbe23=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xbe23,0xc3));var _0x3be2=function(_0x110463,_0x58b03e){_0x110463=_0x110463-0x0;var _0x19574b=_0xbe23[_0x110463];return _0x19574b;};'use strict';var EventEmitter=require(_0x3be2('0x0'));var MailQueue=require(_0x3be2('0x1'))['db'][_0x3be2('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3be2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3be2('0x4'),'afterDestroy':_0x3be2('0x5')};function emitEvent(_0x37fffd){return function(_0x313ba5,_0x26a6c7,_0xe7d395){MailQueueEvents[_0x3be2('0x6')](_0x37fffd+':'+_0x313ba5['id'],_0x313ba5);MailQueueEvents[_0x3be2('0x6')](_0x37fffd,_0x313ba5);_0xe7d395(null);};}for(var e in events){if(events[_0x3be2('0x7')](e)){var event=events[e];MailQueue[_0x3be2('0x8')](e,emitEvent(event));}}module[_0x3be2('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xb6e3=['events','MailQueue','setMaxListeners','update','remove','hasOwnProperty','exports'];(function(_0x47527e,_0x320f30){var _0x4ebc0f=function(_0x8fe1d1){while(--_0x8fe1d1){_0x47527e['push'](_0x47527e['shift']());}};_0x4ebc0f(++_0x320f30);}(_0xb6e3,0x188));var _0x3b6e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb6e3[_0x8c43de];return _0xa6591b;};'use strict';var EventEmitter=require(_0x3b6e('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x3b6e('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x3b6e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b6e('0x3'),'afterDestroy':_0x3b6e('0x4')};function emitEvent(_0x55f6c6){return function(_0x50fe18,_0x3a9af6,_0x357913){MailQueueEvents['emit'](_0x55f6c6+':'+_0x50fe18['id'],_0x50fe18);MailQueueEvents['emit'](_0x55f6c6,_0x50fe18);_0x357913(null);};}for(var e in events){if(events[_0x3b6e('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x3b6e('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index b6efc2a..d44c393 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 _0xdb66=['api','bluebird','path','rimraf','exports','define','mail_queues','../../config/logger'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xdb66,0xff));var _0x6db6=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xdb66[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6db6('0x0'))(_0x6db6('0x1'));var moment=require('moment');var BPromise=require(_0x6db6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6db6('0x3'));var rimraf=require(_0x6db6('0x4'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x6db6('0x5')]=function(_0x3c38ba,_0xb69171){return _0x3c38ba[_0x6db6('0x6')]('MailQueue',attributes,{'tableName':_0x6db6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2107=['bluebird','rimraf','./mailQueue.attributes','exports','define','MailQueue','util','../../config/logger','api','moment'];(function(_0x5e1e38,_0x2647a4){var _0x1e60a0=function(_0x1d9051){while(--_0x1d9051){_0x5e1e38['push'](_0x5e1e38['shift']());}};_0x1e60a0(++_0x2647a4);}(_0x2107,0x1f0));var _0x7210=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0x2107[_0x2d8d69];return _0x39ae22;};'use strict';var _=require('lodash');var util=require(_0x7210('0x0'));var logger=require(_0x7210('0x1'))(_0x7210('0x2'));var moment=require(_0x7210('0x3'));var BPromise=require(_0x7210('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7210('0x5'));var config=require('../../config/environment');var attributes=require(_0x7210('0x6'));module[_0x7210('0x7')]=function(_0x172ae6,_0x50159c){return _0x172ae6[_0x7210('0x8')](_0x7210('0x9'),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 fa98e39..425a237 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 _0xceab=['info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowMailQueue','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then'];(function(_0xb87d55,_0x578ce1){var _0x1c31c8=function(_0x2c0c64){while(--_0x2c0c64){_0xb87d55['push'](_0xb87d55['shift']());}};_0x1c31c8(++_0x578ce1);}(_0xceab,0x106));var _0xbcea=function(_0x5d9a84,_0x40ebd2){_0x5d9a84=_0x5d9a84-0x0;var _0x2f9b46=_0xceab[_0x5d9a84];return _0x2f9b46;};'use strict';var _=require(_0xbcea('0x0'));var util=require('util');var moment=require(_0xbcea('0x1'));var BPromise=require(_0xbcea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbcea('0x3'));var db=require(_0xbcea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbcea('0x5'))(_0xbcea('0x6'));var config=require('../../config/environment');var jayson=require(_0xbcea('0x7'));var client=jayson[_0xbcea('0x8')][_0xbcea('0x9')]({'port':0x232a});config[_0xbcea('0xa')]=_[_0xbcea('0xb')](config['redis'],{'host':_0xbcea('0xc'),'port':0x18eb});var socket=require(_0xbcea('0xd'))(new Redis(config[_0xbcea('0xa')]));require(_0xbcea('0xe'))[_0xbcea('0xf')](socket);function respondWithRpcPromise(_0x4f1d7a,_0x2423fe,_0x59a3bf){return new BPromise(function(_0x1bb846,_0x2f4c85){return client[_0xbcea('0x10')](_0x4f1d7a,_0x59a3bf)[_0xbcea('0x11')](function(_0x276248){logger[_0xbcea('0x12')](_0xbcea('0x13'),_0x2423fe,'request\x20sent');logger[_0xbcea('0x14')](_0xbcea('0x15'),_0x2423fe,_0xbcea('0x16'),JSON['stringify'](_0x276248));if(_0x276248[_0xbcea('0x17')]){if(_0x276248['error']['code']===0x1f4){logger[_0xbcea('0x17')](_0xbcea('0x13'),_0x2423fe,_0x276248[_0xbcea('0x17')][_0xbcea('0x18')]);return _0x2f4c85(_0x276248[_0xbcea('0x17')][_0xbcea('0x18')]);}logger['error'](_0xbcea('0x13'),_0x2423fe,_0x276248['error']['message']);return _0x1bb846(_0x276248['error'][_0xbcea('0x18')]);}else{logger[_0xbcea('0x12')]('MailQueue,\x20%s,\x20%s',_0x2423fe,_0xbcea('0x16'));_0x1bb846(_0x276248[_0xbcea('0x19')][_0xbcea('0x18')]);}})[_0xbcea('0x1a')](function(_0x2665d7){logger[_0xbcea('0x17')](_0xbcea('0x13'),_0x2423fe,_0x2665d7);_0x2f4c85(_0x2665d7);});});}exports[_0xbcea('0x1b')]=function(_0x7ebc8c){var _0x115ef6=this;return new Promise(function(_0x255b79,_0x4bae81){return db[_0xbcea('0x1c')][_0xbcea('0x1d')]({'raw':_0x7ebc8c['options']?_0x7ebc8c[_0xbcea('0x1e')][_0xbcea('0x1f')]===undefined?!![]:![]:!![],'where':_0x7ebc8c[_0xbcea('0x1e')]?_0x7ebc8c[_0xbcea('0x1e')]['where']||null:null,'attributes':_0x7ebc8c['options']?_0x7ebc8c[_0xbcea('0x1e')][_0xbcea('0x20')]||null:null,'limit':_0x7ebc8c[_0xbcea('0x1e')]?_0x7ebc8c['options'][_0xbcea('0x21')]||null:null,'include':_0x7ebc8c['options']?_0x7ebc8c['options']['include']?_[_0xbcea('0x22')](_0x7ebc8c[_0xbcea('0x1e')][_0xbcea('0x23')],function(_0x1a601d){return{'model':db[_0x1a601d[_0xbcea('0x24')]],'as':_0x1a601d['as'],'attributes':_0x1a601d[_0xbcea('0x20')],'include':_0x1a601d[_0xbcea('0x23')]?_[_0xbcea('0x22')](_0x1a601d[_0xbcea('0x23')],function(_0x4eeb4c){return{'model':db[_0x4eeb4c[_0xbcea('0x24')]],'as':_0x4eeb4c['as'],'attributes':_0x4eeb4c[_0xbcea('0x20')],'include':_0x4eeb4c[_0xbcea('0x23')]?_['map'](_0x4eeb4c['include'],function(_0x2358e8){return{'model':db[_0x2358e8[_0xbcea('0x24')]],'as':_0x2358e8['as'],'attributes':_0x2358e8[_0xbcea('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x410b4f){logger[_0xbcea('0x12')](_0xbcea('0x1b'),_0x7ebc8c);logger[_0xbcea('0x14')](_0xbcea('0x1b'),_0x7ebc8c,JSON[_0xbcea('0x25')](_0x410b4f));_0x255b79(_0x410b4f);})[_0xbcea('0x1a')](function(_0x32d3cd){logger[_0xbcea('0x17')](_0xbcea('0x1b'),_0x32d3cd['message'],_0x7ebc8c);_0x4bae81(_0x115ef6['error'](0x1f4,_0x32d3cd[_0xbcea('0x18')]));});});};exports[_0xbcea('0x26')]=function(_0x409137){var _0x146d57=this;return new Promise(function(_0x1de83b,_0x3dc470){return db['MailQueue']['find']({'raw':_0x409137['options']?_0x409137[_0xbcea('0x1e')][_0xbcea('0x1f')]===undefined?!![]:![]:!![],'where':_0x409137[_0xbcea('0x1e')]?_0x409137[_0xbcea('0x1e')][_0xbcea('0x27')]||null:null,'attributes':_0x409137[_0xbcea('0x1e')]?_0x409137[_0xbcea('0x1e')][_0xbcea('0x20')]||null:null,'include':_0x409137['options']?_0x409137['options']['include']?_[_0xbcea('0x22')](_0x409137['options'][_0xbcea('0x23')],function(_0x5292e7){return{'model':db[_0x5292e7['model']],'as':_0x5292e7['as'],'attributes':_0x5292e7[_0xbcea('0x20')],'include':_0x5292e7[_0xbcea('0x23')]?_['map'](_0x5292e7[_0xbcea('0x23')],function(_0x434509){return{'model':db[_0x434509[_0xbcea('0x24')]],'as':_0x434509['as'],'attributes':_0x434509['attributes'],'include':_0x434509[_0xbcea('0x23')]?_['map'](_0x434509[_0xbcea('0x23')],function(_0x261a96){return{'model':db[_0x261a96[_0xbcea('0x24')]],'as':_0x261a96['as'],'attributes':_0x261a96[_0xbcea('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbcea('0x11')](function(_0x18d4db){logger[_0xbcea('0x12')]('ShowMailQueue',_0x409137);logger['debug'](_0xbcea('0x26'),_0x409137,JSON['stringify'](_0x18d4db));_0x1de83b(_0x18d4db);})[_0xbcea('0x1a')](function(_0x4b12dd){logger[_0xbcea('0x17')](_0xbcea('0x26'),_0x4b12dd[_0xbcea('0x18')],_0x409137);_0x3dc470(_0x146d57[_0xbcea('0x17')](0x1f4,_0x4b12dd[_0xbcea('0x18')]));});});}; \ No newline at end of file +var _0x3e0b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0x3e0b,0x1db));var _0xb3e0=function(_0x343854,_0x27a9ef){_0x343854=_0x343854-0x0;var _0x4b1a06=_0x3e0b[_0x343854];return _0x4b1a06;};'use strict';var _=require(_0xb3e0('0x0'));var util=require(_0xb3e0('0x1'));var moment=require(_0xb3e0('0x2'));var BPromise=require(_0xb3e0('0x3'));var rs=require(_0xb3e0('0x4'));var fs=require('fs');var Redis=require(_0xb3e0('0x5'));var db=require(_0xb3e0('0x6'))['db'];var utils=require(_0xb3e0('0x7'));var logger=require(_0xb3e0('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb3e0('0x9'));var client=jayson[_0xb3e0('0xa')][_0xb3e0('0xb')]({'port':0x232a});config[_0xb3e0('0xc')]=_['defaults'](config['redis'],{'host':_0xb3e0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb3e0('0xc')]));require('./mailQueue.socket')[_0xb3e0('0xe')](socket);function respondWithRpcPromise(_0x3029be,_0x3a9de8,_0x570416){return new BPromise(function(_0x417fe5,_0x150f2f){return client[_0xb3e0('0xf')](_0x3029be,_0x570416)[_0xb3e0('0x10')](function(_0x2da20d){logger['info'](_0xb3e0('0x11'),_0x3a9de8,_0xb3e0('0x12'));logger[_0xb3e0('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x3a9de8,_0xb3e0('0x12'),JSON[_0xb3e0('0x14')](_0x2da20d));if(_0x2da20d[_0xb3e0('0x15')]){if(_0x2da20d[_0xb3e0('0x15')][_0xb3e0('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x3a9de8,_0x2da20d[_0xb3e0('0x15')][_0xb3e0('0x17')]);return _0x150f2f(_0x2da20d[_0xb3e0('0x15')]['message']);}logger[_0xb3e0('0x15')]('MailQueue,\x20%s,\x20%s',_0x3a9de8,_0x2da20d['error'][_0xb3e0('0x17')]);return _0x417fe5(_0x2da20d[_0xb3e0('0x15')][_0xb3e0('0x17')]);}else{logger[_0xb3e0('0x18')](_0xb3e0('0x11'),_0x3a9de8,_0xb3e0('0x12'));_0x417fe5(_0x2da20d[_0xb3e0('0x19')][_0xb3e0('0x17')]);}})[_0xb3e0('0x1a')](function(_0x225997){logger[_0xb3e0('0x15')]('MailQueue,\x20%s,\x20%s',_0x3a9de8,_0x225997);_0x150f2f(_0x225997);});});}exports[_0xb3e0('0x1b')]=function(_0x2819f2){var _0x474b25=this;return new Promise(function(_0x538fb6,_0xee1ca2){return db[_0xb3e0('0x1c')][_0xb3e0('0x1d')]({'raw':_0x2819f2['options']?_0x2819f2[_0xb3e0('0x1e')][_0xb3e0('0x1f')]===undefined?!![]:![]:!![],'where':_0x2819f2[_0xb3e0('0x1e')]?_0x2819f2[_0xb3e0('0x1e')][_0xb3e0('0x20')]||null:null,'attributes':_0x2819f2['options']?_0x2819f2[_0xb3e0('0x1e')][_0xb3e0('0x21')]||null:null,'limit':_0x2819f2[_0xb3e0('0x1e')]?_0x2819f2[_0xb3e0('0x1e')][_0xb3e0('0x22')]||null:null,'include':_0x2819f2[_0xb3e0('0x1e')]?_0x2819f2[_0xb3e0('0x1e')][_0xb3e0('0x23')]?_[_0xb3e0('0x24')](_0x2819f2[_0xb3e0('0x1e')]['include'],function(_0x5dcead){return{'model':db[_0x5dcead[_0xb3e0('0x25')]],'as':_0x5dcead['as'],'attributes':_0x5dcead[_0xb3e0('0x21')],'include':_0x5dcead['include']?_[_0xb3e0('0x24')](_0x5dcead[_0xb3e0('0x23')],function(_0x462c86){return{'model':db[_0x462c86[_0xb3e0('0x25')]],'as':_0x462c86['as'],'attributes':_0x462c86[_0xb3e0('0x21')],'include':_0x462c86[_0xb3e0('0x23')]?_[_0xb3e0('0x24')](_0x462c86[_0xb3e0('0x23')],function(_0x5d1f39){return{'model':db[_0x5d1f39[_0xb3e0('0x25')]],'as':_0x5d1f39['as'],'attributes':_0x5d1f39[_0xb3e0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb3e0('0x10')](function(_0x5d9556){logger[_0xb3e0('0x18')]('GetMailQueue',_0x2819f2);logger[_0xb3e0('0x13')](_0xb3e0('0x1b'),_0x2819f2,JSON['stringify'](_0x5d9556));_0x538fb6(_0x5d9556);})[_0xb3e0('0x1a')](function(_0x4d4187){logger['error']('GetMailQueue',_0x4d4187[_0xb3e0('0x17')],_0x2819f2);_0xee1ca2(_0x474b25[_0xb3e0('0x15')](0x1f4,_0x4d4187[_0xb3e0('0x17')]));});});};exports[_0xb3e0('0x26')]=function(_0x3f1f92){var _0x16887d=this;return new Promise(function(_0xccbc7d,_0x4ee3af){return db[_0xb3e0('0x1c')][_0xb3e0('0x27')]({'raw':_0x3f1f92[_0xb3e0('0x1e')]?_0x3f1f92[_0xb3e0('0x1e')][_0xb3e0('0x1f')]===undefined?!![]:![]:!![],'where':_0x3f1f92[_0xb3e0('0x1e')]?_0x3f1f92['options'][_0xb3e0('0x20')]||null:null,'attributes':_0x3f1f92['options']?_0x3f1f92[_0xb3e0('0x1e')][_0xb3e0('0x21')]||null:null,'include':_0x3f1f92[_0xb3e0('0x1e')]?_0x3f1f92[_0xb3e0('0x1e')][_0xb3e0('0x23')]?_[_0xb3e0('0x24')](_0x3f1f92['options'][_0xb3e0('0x23')],function(_0x4387cb){return{'model':db[_0x4387cb[_0xb3e0('0x25')]],'as':_0x4387cb['as'],'attributes':_0x4387cb[_0xb3e0('0x21')],'include':_0x4387cb[_0xb3e0('0x23')]?_[_0xb3e0('0x24')](_0x4387cb[_0xb3e0('0x23')],function(_0x34b274){return{'model':db[_0x34b274['model']],'as':_0x34b274['as'],'attributes':_0x34b274[_0xb3e0('0x21')],'include':_0x34b274['include']?_[_0xb3e0('0x24')](_0x34b274['include'],function(_0x397a20){return{'model':db[_0x397a20[_0xb3e0('0x25')]],'as':_0x397a20['as'],'attributes':_0x397a20[_0xb3e0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb3e0('0x10')](function(_0x4eec9c){logger[_0xb3e0('0x18')](_0xb3e0('0x26'),_0x3f1f92);logger[_0xb3e0('0x13')]('ShowMailQueue',_0x3f1f92,JSON[_0xb3e0('0x14')](_0x4eec9c));_0xccbc7d(_0x4eec9c);})[_0xb3e0('0x1a')](function(_0x1ed33e){logger[_0xb3e0('0x15')](_0xb3e0('0x26'),_0x1ed33e['message'],_0x3f1f92);_0x4ee3af(_0x16887d[_0xb3e0('0x15')](0x1f4,_0x1ed33e[_0xb3e0('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e103054..adb39ec 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 _0xc35b=['length','save','remove'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xc35b,0xa3));var _0xbc35=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc35b[_0x1caf6a];return _0x1bf493;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xbc35('0x0'),_0xbc35('0x1'),'update'];function createListener(_0x4404c1,_0x5e20a9){return function(_0x5033ae){_0x5e20a9['emit'](_0x4404c1,_0x5033ae);};}function removeListener(_0x587d4,_0xd410f4){return function(){MailQueueEvents['removeListener'](_0x587d4,_0xd410f4);};}exports['register']=function(_0x46eb90){for(var _0x1acf44=0x0,_0x2db8fd=events[_0xbc35('0x2')];_0x1acf44<_0x2db8fd;_0x1acf44++){var _0x2ae7b0=events[_0x1acf44];var _0x51b00b=createListener('mailQueue:'+_0x2ae7b0,_0x46eb90);MailQueueEvents['on'](_0x2ae7b0,_0x51b00b);}}; \ No newline at end of file +var _0xf2ba=['mailQueue:','./mailQueue.events','save','removeListener','length'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xf2ba,0xab));var _0xaf2b=function(_0x2616de,_0x56dab8){_0x2616de=_0x2616de-0x0;var _0x19f21a=_0xf2ba[_0x2616de];return _0x19f21a;};'use strict';var MailQueueEvents=require(_0xaf2b('0x0'));var events=[_0xaf2b('0x1'),'remove','update'];function createListener(_0x19f781,_0x278600){return function(_0x53e5d8){_0x278600['emit'](_0x19f781,_0x53e5d8);};}function removeListener(_0x270bcd,_0x470eae){return function(){MailQueueEvents[_0xaf2b('0x2')](_0x270bcd,_0x470eae);};}exports['register']=function(_0x4e6e12){for(var _0x57f9b6=0x0,_0x32081f=events[_0xaf2b('0x3')];_0x57f9b6<_0x32081f;_0x57f9b6++){var _0x59c0e9=events[_0x57f9b6];var _0x429e47=createListener(_0xaf2b('0x4')+_0x59c0e9,_0x4e6e12);MailQueueEvents['on'](_0x59c0e9,_0x429e47);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6d9d528..39c9746 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 _0xee4d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path'];(function(_0x5756f7,_0x5a1047){var _0x40c44d=function(_0x34ffc4){while(--_0x34ffc4){_0x5756f7['push'](_0x5756f7['shift']());}};_0x40c44d(++_0x5a1047);}(_0xee4d,0x1e1));var _0xdee4=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xee4d[_0x15c421];return _0x5e5ed5;};'use strict';var multer=require(_0xdee4('0x0'));var util=require('util');var path=require(_0xdee4('0x1'));var timeout=require(_0xdee4('0x2'));var express=require(_0xdee4('0x3'));var router=express[_0xdee4('0x4')]();var fs_extra=require(_0xdee4('0x5'));var auth=require(_0xdee4('0x6'));var interaction=require(_0xdee4('0x7'));var config=require('../../config/environment');var controller=require(_0xdee4('0x8'));router['get']('/',auth[_0xdee4('0x9')](),controller[_0xdee4('0xa')]);router[_0xdee4('0xb')]('/describe',auth[_0xdee4('0x9')](),controller[_0xdee4('0xc')]);router[_0xdee4('0xb')](_0xdee4('0xd'),auth['isAuthenticated'](),controller[_0xdee4('0xe')]);router[_0xdee4('0xf')]('/',auth['isAuthenticated'](),controller[_0xdee4('0x10')]);router[_0xdee4('0x11')](_0xdee4('0xd'),auth[_0xdee4('0x9')](),controller['update']);router[_0xdee4('0x12')]('/:id',auth[_0xdee4('0x9')](),controller[_0xdee4('0x13')]);module[_0xdee4('0x14')]=router; \ No newline at end of file +var _0x4f45=['fs-extra','../../components/auth/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x4f45,0xa7));var _0x54f4=function(_0x3e0912,_0x393b7a){_0x3e0912=_0x3e0912-0x0;var _0x37474c=_0x4f45[_0x3e0912];return _0x37474c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x54f4('0x0'));var timeout=require(_0x54f4('0x1'));var express=require(_0x54f4('0x2'));var router=express[_0x54f4('0x3')]();var fs_extra=require(_0x54f4('0x4'));var auth=require(_0x54f4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x54f4('0x6'));var controller=require(_0x54f4('0x7'));router['get']('/',auth[_0x54f4('0x8')](),controller[_0x54f4('0x9')]);router[_0x54f4('0xa')]('/describe',auth[_0x54f4('0x8')](),controller[_0x54f4('0xb')]);router[_0x54f4('0xa')](_0x54f4('0xc'),auth[_0x54f4('0x8')](),controller['show']);router['post']('/',auth[_0x54f4('0x8')](),controller[_0x54f4('0xd')]);router[_0x54f4('0xe')](_0x54f4('0xc'),auth['isAuthenticated'](),controller[_0x54f4('0xf')]);router[_0x54f4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x54f4('0x11')]);module[_0x54f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9442f1b..1dd5fce 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 _0x53cf=['STRING','DATE','moment','sequelize','exports'];(function(_0x3d2f2a,_0x5be9ab){var _0x47e301=function(_0x596daf){while(--_0x596daf){_0x3d2f2a['push'](_0x3d2f2a['shift']());}};_0x47e301(++_0x5be9ab);}(_0x53cf,0x1b0));var _0xf53c=function(_0x1d62d3,_0x575072){_0x1d62d3=_0x1d62d3-0x0;var _0x4927e5=_0x53cf[_0x1d62d3];return _0x4927e5;};'use strict';var moment=require(_0xf53c('0x0'));var Sequelize=require(_0xf53c('0x1'));module[_0xf53c('0x2')]={'uniqueid':{'type':Sequelize[_0xf53c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf53c('0x3')]},'joinAt':{'type':Sequelize[_0xf53c('0x4')]},'leaveAt':{'type':Sequelize[_0xf53c('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf53c('0x4')]},'reason':{'type':Sequelize[_0xf53c('0x3')]}}; \ No newline at end of file +var _0x910c=['DATE','moment','sequelize','exports','STRING'];(function(_0x16c135,_0x1a526c){var _0x2d791d=function(_0x115e09){while(--_0x115e09){_0x16c135['push'](_0x16c135['shift']());}};_0x2d791d(++_0x1a526c);}(_0x910c,0x12d));var _0xc910=function(_0xd91aea,_0x90202d){_0xd91aea=_0xd91aea-0x0;var _0xed7cb0=_0x910c[_0xd91aea];return _0xed7cb0;};'use strict';var moment=require(_0xc910('0x0'));var Sequelize=require(_0xc910('0x1'));module[_0xc910('0x2')]={'uniqueid':{'type':Sequelize[_0xc910('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc910('0x3')]},'joinAt':{'type':Sequelize[_0xc910('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc910('0x4')]},'exitAt':{'type':Sequelize[_0xc910('0x4')]},'reason':{'type':Sequelize[_0xc910('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 9a67924..4f328d8 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x1e29db,_0x346253){var _0x3f3d1f=function(_0x5dafef){while(--_0x5dafef){_0x1e29db['push'](_0x1e29db['shift']());}};_0x3f3d1f(++_0x346253);}(_0x2ef3,0xba));var _0x32ef=function(_0x2bbc58,_0x5960e8){_0x2bbc58=_0x2bbc58-0x0;var _0x375a1a=_0x2ef3[_0x2bbc58];return _0x375a1a;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0xfcf0=['nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','describe','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','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xfcf0,0x138));var _0x0fcf=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xfcf0[_0x2341c6];return _0x54c34d;};'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['MailQueueReport']['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')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));};exports[_0x0fcf('0x49')]=function(_0x389d71,_0x3a473c){return db[_0x0fcf('0x2b')][_0x0fcf('0x49')]()[_0x0fcf('0x24')](respondWithResult(_0x3a473c,null))[_0x0fcf('0x42')](handleError(_0x3a473c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index ad4fed1..8570ed1 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 _0x461a=['path','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x461a,0x192));var _0xa461=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x461a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa461('0x0'));var logger=require(_0xa461('0x1'))(_0xa461('0x2'));var moment=require(_0xa461('0x3'));var BPromise=require(_0xa461('0x4'));var rp=require(_0xa461('0x5'));var fs=require('fs');var path=require(_0xa461('0x6'));var rimraf=require('rimraf');var config=require(_0xa461('0x7'));var attributes=require(_0xa461('0x8'));module['exports']=function(_0x227de9,_0x113f3f){return _0x227de9[_0xa461('0x9')](_0xa461('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa461('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bcc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','util','api'];(function(_0x51f2f4,_0x12236c){var _0x1826a3=function(_0x329bcf){while(--_0x329bcf){_0x51f2f4['push'](_0x51f2f4['shift']());}};_0x1826a3(++_0x12236c);}(_0x1bcc,0x11c));var _0xc1bc=function(_0x328fe8,_0x3959b4){_0x328fe8=_0x328fe8-0x0;var _0x28eab1=_0x1bcc[_0x328fe8];return _0x28eab1;};'use strict';var _=require('lodash');var util=require(_0xc1bc('0x0'));var logger=require('../../config/logger')(_0xc1bc('0x1'));var moment=require(_0xc1bc('0x2'));var BPromise=require(_0xc1bc('0x3'));var rp=require(_0xc1bc('0x4'));var fs=require('fs');var path=require(_0xc1bc('0x5'));var rimraf=require(_0xc1bc('0x6'));var config=require(_0xc1bc('0x7'));var attributes=require(_0xc1bc('0x8'));module['exports']=function(_0x19fa5d,_0x116846){return _0x19fa5d[_0xc1bc('0x9')](_0xc1bc('0xa'),attributes,{'tableName':_0xc1bc('0xb'),'paranoid':![],'indexes':[{'name':_0xc1bc('0xc'),'fields':[_0xc1bc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7847eaa..75e0a31 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x29db14,_0x4fcd9f){var _0x5cfc55=function(_0x144719){while(--_0x144719){_0x29db14['push'](_0x29db14['shift']());}};_0x5cfc55(++_0x4fcd9f);}(_0xdb28,0x106));var _0x8db2=function(_0x3edaae,_0x262874){_0x3edaae=_0x3edaae-0x0;var _0x293f6e=_0xdb28[_0x3edaae];return _0x293f6e;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file +var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x2454e7,_0x7fc23c){var _0x348e21=function(_0x50784f){while(--_0x50784f){_0x2454e7['push'](_0x2454e7['shift']());}};_0x348e21(++_0x7fc23c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 23c7fef..89f3efa 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x38ad72,_0x12370e){var _0x930dc=function(_0x16c80d){while(--_0x16c80d){_0x38ad72['push'](_0x38ad72['shift']());}};_0x930dc(++_0x12370e);}(_0xedd9,0xfc));var _0x9edd=function(_0x56aad3,_0x3d48bc){_0x56aad3=_0x56aad3-0x0;var _0x1d165a=_0xedd9[_0x56aad3];return _0x1d165a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3ba0af,_0xccb8a1){var _0x650db7=function(_0x1f1f0a){while(--_0x1f1f0a){_0x3ba0af['push'](_0x3ba0af['shift']());}};_0x650db7(++_0xccb8a1);}(_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 diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b9e1aff..c5fff63 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 _0x6a3e=['BOOLEAN','INTEGER','INBOX','STRING'];(function(_0x4e128b,_0x3c9313){var _0x1020d7=function(_0x28f0cf){while(--_0x28f0cf){_0x4e128b['push'](_0x4e128b['shift']());}};_0x1020d7(++_0x3c9313);}(_0x6a3e,0x187));var _0xe6a3=function(_0x1b6085,_0x3dcac5){_0x1b6085=_0x1b6085-0x0;var _0x42574a=_0x6a3e[_0x1b6085];return _0x42574a;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe6a3('0x0')]},'authentication':{'type':Sequelize[_0xe6a3('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xe6a3('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xe6a3('0x2')]},'tls':{'type':Sequelize[_0xe6a3('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xe6a3('0x3')},'connTimeout':{'type':Sequelize[_0xe6a3('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe6a3('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe6a3('0x0')]},'modernAuthentication':{'type':Sequelize[_0xe6a3('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x6dc9=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x36b886,_0x349b28){var _0x51d44b=function(_0x5e786c){while(--_0x5e786c){_0x36b886['push'](_0x36b886['shift']());}};_0x51d44b(++_0x349b28);}(_0x6dc9,0x195));var _0x96dc=function(_0x1fd955,_0x66b28){_0x1fd955=_0x1fd955-0x0;var _0x1f22ca=_0x6dc9[_0x1fd955];return _0x1f22ca;};'use strict';var Sequelize=require(_0x96dc('0x0'));module['exports']={'description':{'type':Sequelize[_0x96dc('0x1')]},'host':{'type':Sequelize[_0x96dc('0x1')]},'authentication':{'type':Sequelize[_0x96dc('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x96dc('0x3')]},'tls':{'type':Sequelize[_0x96dc('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x96dc('0x4')},'connTimeout':{'type':Sequelize[_0x96dc('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x96dc('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x96dc('0x1')]},'modernAuthentication':{'type':Sequelize[_0x96dc('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 10378a9..58a1fb8 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 _0x5126=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x4886b4,_0x545b2f){var _0x41ea92=function(_0xc549d){while(--_0xc549d){_0x4886b4['push'](_0x4886b4['shift']());}};_0x41ea92(++_0x545b2f);}(_0x5126,0xc0));var _0x6512=function(_0x243c46,_0x2e5fc2){_0x243c46=_0x243c46-0x0;var _0x28066a=_0x5126[_0x243c46];return _0x28066a;};'use strict';var _=require(_0x6512('0x0'));var util=require(_0x6512('0x1'));var logger=require(_0x6512('0x2'))('api');var moment=require(_0x6512('0x3'));var BPromise=require(_0x6512('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6512('0x5'));var rimraf=require('rimraf');var config=require(_0x6512('0x6'));var attributes=require(_0x6512('0x7'));module[_0x6512('0x8')]=function(_0x5ee643,_0x10a0a2){return _0x5ee643[_0x6512('0x9')](_0x6512('0xa'),attributes,{'tableName':_0x6512('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe34e=['MailServerIn','mail_servers_in','util','moment','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','define'];(function(_0x13690d,_0x40f1fb){var _0x3e3024=function(_0x14fd41){while(--_0x14fd41){_0x13690d['push'](_0x13690d['shift']());}};_0x3e3024(++_0x40f1fb);}(_0xe34e,0xda));var _0xee34=function(_0x10ea91,_0x572e2d){_0x10ea91=_0x10ea91-0x0;var _0x206274=_0xe34e[_0x10ea91];return _0x206274;};'use strict';var _=require('lodash');var util=require(_0xee34('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xee34('0x1'));var BPromise=require('bluebird');var rp=require(_0xee34('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee34('0x3'));var config=require(_0xee34('0x4'));var attributes=require(_0xee34('0x5'));module['exports']=function(_0x307b01,_0x10c924){return _0x307b01[_0xee34('0x6')](_0xee34('0x7'),attributes,{'tableName':_0xee34('0x8'),'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 40c8008..e9977a8 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 _0x636f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailServerIn','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5dcff6,_0x4a8796){var _0x2699cd=function(_0x36a328){while(--_0x36a328){_0x5dcff6['push'](_0x5dcff6['shift']());}};_0x2699cd(++_0x4a8796);}(_0x636f,0xa4));var _0xf636=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x636f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf636('0x0'));var moment=require(_0xf636('0x1'));var BPromise=require(_0xf636('0x2'));var rs=require(_0xf636('0x3'));var fs=require('fs');var Redis=require(_0xf636('0x4'));var db=require(_0xf636('0x5'))['db'];var utils=require(_0xf636('0x6'));var logger=require(_0xf636('0x7'))(_0xf636('0x8'));var config=require(_0xf636('0x9'));var jayson=require(_0xf636('0xa'));var client=jayson['client'][_0xf636('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4baa7a,_0x1f4e35,_0x35ac17){return new BPromise(function(_0x49bf11,_0x526061){return client['request'](_0x4baa7a,_0x35ac17)[_0xf636('0xc')](function(_0x313ec0){logger[_0xf636('0xd')](_0xf636('0xe'),_0x1f4e35,_0xf636('0xf'));logger[_0xf636('0x10')](_0xf636('0x11'),_0x1f4e35,'request\x20sent',JSON[_0xf636('0x12')](_0x313ec0));if(_0x313ec0['error']){if(_0x313ec0[_0xf636('0x13')][_0xf636('0x14')]===0x1f4){logger[_0xf636('0x13')](_0xf636('0xe'),_0x1f4e35,_0x313ec0[_0xf636('0x13')][_0xf636('0x15')]);return _0x526061(_0x313ec0[_0xf636('0x13')][_0xf636('0x15')]);}logger['error'](_0xf636('0xe'),_0x1f4e35,_0x313ec0[_0xf636('0x13')][_0xf636('0x15')]);return _0x49bf11(_0x313ec0['error'][_0xf636('0x15')]);}else{logger[_0xf636('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1f4e35,'request\x20sent');_0x49bf11(_0x313ec0[_0xf636('0x16')]['message']);}})[_0xf636('0x17')](function(_0x40c959){logger['error'](_0xf636('0xe'),_0x1f4e35,_0x40c959);_0x526061(_0x40c959);});});}exports['GetMailServerIn']=function(_0x39438f){var _0x1aab76=this;return new Promise(function(_0x3bdce1,_0x13c795){return db[_0xf636('0x18')]['findAll']({'raw':_0x39438f[_0xf636('0x19')]?_0x39438f[_0xf636('0x19')][_0xf636('0x1a')]===undefined?!![]:![]:!![],'where':_0x39438f[_0xf636('0x19')]?_0x39438f[_0xf636('0x19')][_0xf636('0x1b')]||null:null,'attributes':_0x39438f[_0xf636('0x19')]?_0x39438f['options'][_0xf636('0x1c')]||null:null,'limit':_0x39438f[_0xf636('0x19')]?_0x39438f[_0xf636('0x19')][_0xf636('0x1d')]||null:null,'include':_0x39438f[_0xf636('0x19')]?_0x39438f[_0xf636('0x19')][_0xf636('0x1e')]?_['map'](_0x39438f['options']['include'],function(_0x585d32){return{'model':db[_0x585d32['model']],'as':_0x585d32['as'],'attributes':_0x585d32['attributes'],'include':_0x585d32[_0xf636('0x1e')]?_[_0xf636('0x1f')](_0x585d32[_0xf636('0x1e')],function(_0x41d184){return{'model':db[_0x41d184[_0xf636('0x20')]],'as':_0x41d184['as'],'attributes':_0x41d184['attributes'],'include':_0x41d184[_0xf636('0x1e')]?_[_0xf636('0x1f')](_0x41d184[_0xf636('0x1e')],function(_0x4ca1db){return{'model':db[_0x4ca1db['model']],'as':_0x4ca1db['as'],'attributes':_0x4ca1db['attributes']};}):[]};}):[]};}):[]:[]})[_0xf636('0xc')](function(_0x270f5e){logger[_0xf636('0xd')](_0xf636('0x21'),_0x39438f);logger[_0xf636('0x10')](_0xf636('0x21'),_0x39438f,JSON['stringify'](_0x270f5e));_0x3bdce1(_0x270f5e);})[_0xf636('0x17')](function(_0x198b72){logger[_0xf636('0x13')]('GetMailServerIn',_0x198b72[_0xf636('0x15')],_0x39438f);_0x13c795(_0x1aab76[_0xf636('0x13')](0x1f4,_0x198b72[_0xf636('0x15')]));});});}; \ No newline at end of file +var _0x9037=['MailServerIn','findAll','options','raw','where','limit','map','model','attributes','include','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn'];(function(_0x58fb44,_0x47fce2){var _0x44b4f6=function(_0x5d6f44){while(--_0x5d6f44){_0x58fb44['push'](_0x58fb44['shift']());}};_0x44b4f6(++_0x47fce2);}(_0x9037,0xbf));var _0x7903=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9037[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7903('0x0'));var moment=require('moment');var BPromise=require(_0x7903('0x1'));var rs=require(_0x7903('0x2'));var fs=require('fs');var Redis=require(_0x7903('0x3'));var db=require(_0x7903('0x4'))['db'];var utils=require(_0x7903('0x5'));var logger=require(_0x7903('0x6'))(_0x7903('0x7'));var config=require(_0x7903('0x8'));var jayson=require(_0x7903('0x9'));var client=jayson[_0x7903('0xa')][_0x7903('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12aca4,_0x5e9071,_0x334d94){return new BPromise(function(_0x36dcfa,_0x3ef2a0){return client[_0x7903('0xc')](_0x12aca4,_0x334d94)[_0x7903('0xd')](function(_0x8ef1c0){logger['info']('MailServerIn,\x20%s,\x20%s',_0x5e9071,_0x7903('0xe'));logger[_0x7903('0xf')](_0x7903('0x10'),_0x5e9071,_0x7903('0xe'),JSON[_0x7903('0x11')](_0x8ef1c0));if(_0x8ef1c0[_0x7903('0x12')]){if(_0x8ef1c0[_0x7903('0x12')][_0x7903('0x13')]===0x1f4){logger[_0x7903('0x12')]('MailServerIn,\x20%s,\x20%s',_0x5e9071,_0x8ef1c0[_0x7903('0x12')][_0x7903('0x14')]);return _0x3ef2a0(_0x8ef1c0['error'][_0x7903('0x14')]);}logger[_0x7903('0x12')](_0x7903('0x15'),_0x5e9071,_0x8ef1c0['error'][_0x7903('0x14')]);return _0x36dcfa(_0x8ef1c0['error'][_0x7903('0x14')]);}else{logger['info'](_0x7903('0x15'),_0x5e9071,_0x7903('0xe'));_0x36dcfa(_0x8ef1c0[_0x7903('0x16')][_0x7903('0x14')]);}})[_0x7903('0x17')](function(_0x59f56){logger[_0x7903('0x12')](_0x7903('0x15'),_0x5e9071,_0x59f56);_0x3ef2a0(_0x59f56);});});}exports[_0x7903('0x18')]=function(_0xf47c47){var _0x2bdfcf=this;return new Promise(function(_0x45fd67,_0xb424a8){return db[_0x7903('0x19')][_0x7903('0x1a')]({'raw':_0xf47c47['options']?_0xf47c47[_0x7903('0x1b')][_0x7903('0x1c')]===undefined?!![]:![]:!![],'where':_0xf47c47[_0x7903('0x1b')]?_0xf47c47[_0x7903('0x1b')][_0x7903('0x1d')]||null:null,'attributes':_0xf47c47[_0x7903('0x1b')]?_0xf47c47['options']['attributes']||null:null,'limit':_0xf47c47[_0x7903('0x1b')]?_0xf47c47[_0x7903('0x1b')][_0x7903('0x1e')]||null:null,'include':_0xf47c47[_0x7903('0x1b')]?_0xf47c47['options']['include']?_[_0x7903('0x1f')](_0xf47c47['options']['include'],function(_0x240d63){return{'model':db[_0x240d63[_0x7903('0x20')]],'as':_0x240d63['as'],'attributes':_0x240d63[_0x7903('0x21')],'include':_0x240d63[_0x7903('0x22')]?_[_0x7903('0x1f')](_0x240d63['include'],function(_0x3b732d){return{'model':db[_0x3b732d[_0x7903('0x20')]],'as':_0x3b732d['as'],'attributes':_0x3b732d[_0x7903('0x21')],'include':_0x3b732d[_0x7903('0x22')]?_['map'](_0x3b732d['include'],function(_0x410559){return{'model':db[_0x410559[_0x7903('0x20')]],'as':_0x410559['as'],'attributes':_0x410559[_0x7903('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7903('0xd')](function(_0xb64413){logger[_0x7903('0x23')](_0x7903('0x18'),_0xf47c47);logger[_0x7903('0xf')]('GetMailServerIn',_0xf47c47,JSON[_0x7903('0x11')](_0xb64413));_0x45fd67(_0xb64413);})['catch'](function(_0x39e2dc){logger[_0x7903('0x12')](_0x7903('0x18'),_0x39e2dc['message'],_0xf47c47);_0xb424a8(_0x2bdfcf[_0x7903('0x12')](0x1f4,_0x39e2dc[_0x7903('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c20962a..ec8e9aa 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(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 _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(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index dafe57c..5c2ea27 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 _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x3c81,0x102));var _0x13c8=function(_0x3edf7b,_0x5a3c9b){_0x3edf7b=_0x3edf7b-0x0;var _0x5a6fb1=_0x3c81[_0x3edf7b];return _0x5a6fb1;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3c81=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x3c81,0x102));var _0x13c8=function(_0x192bc7,_0x4a66b2){_0x192bc7=_0x192bc7-0x0;var _0x530c89=_0x3c81[_0x192bc7];return _0x530c89;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x13c8('0x2')]},'user':{'type':Sequelize[_0x13c8('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x13c8('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d9ad307..ded9876 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 _0xc7c0=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','then','end','error','name','send','index','map','MailServerOut','fieldName','type','model','query','keys','filters','intersection','attributes','fields','sort','where','pick','filter','options','includeAll','include','catch','show','params','rawAttributes','length','merge','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x4fd109,_0x33c503){var _0x30f0a6=function(_0xc11c0d){while(--_0xc11c0d){_0x4fd109['push'](_0x4fd109['shift']());}};_0x30f0a6(++_0x33c503);}(_0xc7c0,0x104));var _0x0c7c=function(_0xcfad1c,_0x4a9178){_0xcfad1c=_0xcfad1c-0x0;var _0x316e9b=_0xc7c0[_0xcfad1c];return _0x316e9b;};'use strict';var emlformat=require(_0x0c7c('0x0'));var rimraf=require(_0x0c7c('0x1'));var zipdir=require(_0x0c7c('0x2'));var jsonpatch=require(_0x0c7c('0x3'));var rp=require(_0x0c7c('0x4'));var moment=require(_0x0c7c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c7c('0x6'));var path=require(_0x0c7c('0x7'));var sox=require(_0x0c7c('0x8'));var csv=require(_0x0c7c('0x9'));var ejs=require(_0x0c7c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c7c('0xb'));var jsforce=require(_0x0c7c('0xc'));var deskjs=require(_0x0c7c('0xd'));var toCsv=require(_0x0c7c('0x9'));var querystring=require(_0x0c7c('0xe'));var Papa=require('papaparse');var Redis=require(_0x0c7c('0xf'));var authService=require(_0x0c7c('0x10'));var qs=require(_0x0c7c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c7c('0x12'));var logger=require('../../config/logger')(_0x0c7c('0x13'));var utils=require(_0x0c7c('0x14'));var config=require(_0x0c7c('0x15'));var licenseUtil=require(_0x0c7c('0x16'));var db=require(_0x0c7c('0x17'))['db'];function respondWithStatusCode(_0xf4f773,_0x3f0784){_0x3f0784=_0x3f0784||0xcc;return function(_0x50f27f){if(_0x50f27f){return _0xf4f773[_0x0c7c('0x18')](_0x3f0784);}return _0xf4f773[_0x0c7c('0x19')](_0x3f0784)['end']();};}function respondWithResult(_0x45b1f8,_0x185146){_0x185146=_0x185146||0xc8;return function(_0x2708aa){if(_0x2708aa){return _0x45b1f8[_0x0c7c('0x19')](_0x185146)['json'](_0x2708aa);}};}function respondWithFilteredResult(_0x47f016,_0x4ca03b){return function(_0x2f6dda){if(_0x2f6dda){var _0x3c1ef9=typeof _0x4ca03b[_0x0c7c('0x1a')]==='undefined'&&typeof _0x4ca03b[_0x0c7c('0x1b')]===_0x0c7c('0x1c');var _0x3a8746=_0x2f6dda[_0x0c7c('0x1d')];var _0x4cd466=_0x3c1ef9?0x0:_0x4ca03b[_0x0c7c('0x1a')];var _0x429555=_0x3c1ef9?_0x2f6dda[_0x0c7c('0x1d')]:_0x4ca03b[_0x0c7c('0x1a')]+_0x4ca03b[_0x0c7c('0x1b')];var _0x479daf;if(_0x429555>=_0x3a8746){_0x429555=_0x3a8746;_0x479daf=0xc8;}else{_0x479daf=0xce;}_0x47f016[_0x0c7c('0x19')](_0x479daf);return _0x47f016[_0x0c7c('0x1e')](_0x0c7c('0x1f'),_0x4cd466+'-'+_0x429555+'/'+_0x3a8746)[_0x0c7c('0x20')](_0x2f6dda);}return null;};}function patchUpdates(_0x4e61fc){return function(_0x470a7f){try{jsonpatch[_0x0c7c('0x21')](_0x470a7f,_0x4e61fc,!![]);}catch(_0x5df8ac){return BPromise[_0x0c7c('0x22')](_0x5df8ac);}return _0x470a7f[_0x0c7c('0x23')]();};}function saveUpdates(_0x26a502,_0x5d2d2b){return function(_0x36a93d){if(_0x36a93d){return _0x36a93d['update'](_0x26a502)[_0x0c7c('0x24')](function(_0x109a89){return _0x109a89;});}return null;};}function removeEntity(_0x5a15cb,_0x100e62){return function(_0x38cf09){if(_0x38cf09){return _0x38cf09['destroy']()[_0x0c7c('0x24')](function(){_0x5a15cb['status'](0xcc)[_0x0c7c('0x25')]();});}};}function handleEntityNotFound(_0x43efb7,_0x6beaa8){return function(_0x103523){if(!_0x103523){_0x43efb7[_0x0c7c('0x18')](0x194);}return _0x103523;};}function handleError(_0x122d73,_0x275c79){_0x275c79=_0x275c79||0x1f4;return function(_0x38618e){logger[_0x0c7c('0x26')](_0x38618e['stack']);if(_0x38618e[_0x0c7c('0x27')]){delete _0x38618e[_0x0c7c('0x27')];}_0x122d73['status'](_0x275c79)[_0x0c7c('0x28')](_0x38618e);};}exports[_0x0c7c('0x29')]=function(_0xd38556,_0x170b60){var _0x5c514c={},_0x3f7544={},_0x16889f={'count':0x0,'rows':[]};var _0x2a5569=_[_0x0c7c('0x2a')](db[_0x0c7c('0x2b')]['rawAttributes'],function(_0x2985c9){return{'name':_0x2985c9[_0x0c7c('0x2c')],'type':_0x2985c9[_0x0c7c('0x2d')]['key']};});_0x3f7544[_0x0c7c('0x2e')]=_[_0x0c7c('0x2a')](_0x2a5569,_0x0c7c('0x27'));_0x3f7544[_0x0c7c('0x2f')]=_[_0x0c7c('0x30')](_0xd38556[_0x0c7c('0x2f')]);_0x3f7544[_0x0c7c('0x31')]=_[_0x0c7c('0x32')](_0x3f7544['model'],_0x3f7544['query']);_0x5c514c[_0x0c7c('0x33')]=_['intersection'](_0x3f7544[_0x0c7c('0x2e')],qs[_0x0c7c('0x34')](_0xd38556[_0x0c7c('0x2f')][_0x0c7c('0x34')]));_0x5c514c[_0x0c7c('0x33')]=_0x5c514c[_0x0c7c('0x33')]['length']?_0x5c514c['attributes']:_0x3f7544['model'];if(!_0xd38556[_0x0c7c('0x2f')]['hasOwnProperty']('nolimit')){_0x5c514c['limit']=qs[_0x0c7c('0x1b')](_0xd38556[_0x0c7c('0x2f')][_0x0c7c('0x1b')]);_0x5c514c['offset']=qs[_0x0c7c('0x1a')](_0xd38556[_0x0c7c('0x2f')][_0x0c7c('0x1a')]);}_0x5c514c['order']=qs[_0x0c7c('0x35')](_0xd38556['query'][_0x0c7c('0x35')]);_0x5c514c[_0x0c7c('0x36')]=qs[_0x0c7c('0x31')](_[_0x0c7c('0x37')](_0xd38556['query'],_0x3f7544[_0x0c7c('0x31')]),_0x2a5569);if(_0xd38556[_0x0c7c('0x2f')][_0x0c7c('0x38')]){_0x5c514c[_0x0c7c('0x36')]=_['merge'](_0x5c514c[_0x0c7c('0x36')],{'$or':_[_0x0c7c('0x2a')](_0x2a5569,function(_0x58f576){if(_0x58f576[_0x0c7c('0x2d')]!=='VIRTUAL'){var _0x19c789={};_0x19c789[_0x58f576[_0x0c7c('0x27')]]={'$like':'%'+_0xd38556[_0x0c7c('0x2f')][_0x0c7c('0x38')]+'%'};return _0x19c789;}})});}_0x5c514c=_['merge']({},_0x5c514c,_0xd38556[_0x0c7c('0x39')]);var _0x537f66={'where':_0x5c514c[_0x0c7c('0x36')]};return db[_0x0c7c('0x2b')][_0x0c7c('0x1d')](_0x537f66)[_0x0c7c('0x24')](function(_0x3211a6){_0x16889f['count']=_0x3211a6;if(_0xd38556['query'][_0x0c7c('0x3a')]){_0x5c514c[_0x0c7c('0x3b')]=[{'all':!![]}];}return db[_0x0c7c('0x2b')]['findAll'](_0x5c514c);})[_0x0c7c('0x24')](function(_0x42e52a){_0x16889f['rows']=_0x42e52a;return _0x16889f;})[_0x0c7c('0x24')](respondWithFilteredResult(_0x170b60,_0x5c514c))[_0x0c7c('0x3c')](handleError(_0x170b60,null));};exports[_0x0c7c('0x3d')]=function(_0x59b291,_0x3f8bd2){var _0xfd565a={'raw':!![],'where':{'id':_0x59b291[_0x0c7c('0x3e')]['id']}},_0xe756f0={};_0xe756f0[_0x0c7c('0x2e')]=_['keys'](db[_0x0c7c('0x2b')][_0x0c7c('0x3f')]);_0xe756f0['query']=_['keys'](_0x59b291[_0x0c7c('0x2f')]);_0xe756f0[_0x0c7c('0x31')]=_[_0x0c7c('0x32')](_0xe756f0['model'],_0xe756f0[_0x0c7c('0x2f')]);_0xfd565a[_0x0c7c('0x33')]=_[_0x0c7c('0x32')](_0xe756f0[_0x0c7c('0x2e')],qs['fields'](_0x59b291[_0x0c7c('0x2f')][_0x0c7c('0x34')]));_0xfd565a[_0x0c7c('0x33')]=_0xfd565a[_0x0c7c('0x33')][_0x0c7c('0x40')]?_0xfd565a[_0x0c7c('0x33')]:_0xe756f0[_0x0c7c('0x2e')];if(_0x59b291[_0x0c7c('0x2f')][_0x0c7c('0x3a')]){_0xfd565a['include']=[{'all':!![]}];}_0xfd565a=_[_0x0c7c('0x41')]({},_0xfd565a,_0x59b291[_0x0c7c('0x39')]);return db[_0x0c7c('0x2b')][_0x0c7c('0x42')](_0xfd565a)['then'](handleEntityNotFound(_0x3f8bd2,null))[_0x0c7c('0x24')](respondWithResult(_0x3f8bd2,null))['catch'](handleError(_0x3f8bd2,null));};exports[_0x0c7c('0x43')]=function(_0x13133f,_0x44c12c){return db[_0x0c7c('0x2b')][_0x0c7c('0x43')](_0x13133f[_0x0c7c('0x44')],{})[_0x0c7c('0x24')](respondWithResult(_0x44c12c,0xc9))[_0x0c7c('0x3c')](handleError(_0x44c12c,null));};exports[_0x0c7c('0x45')]=function(_0x4a64c6,_0x416df2){if(_0x4a64c6['body']['id']){delete _0x4a64c6[_0x0c7c('0x44')]['id'];}return db['MailServerOut'][_0x0c7c('0x42')]({'where':{'id':_0x4a64c6[_0x0c7c('0x3e')]['id']}})[_0x0c7c('0x24')](handleEntityNotFound(_0x416df2,null))[_0x0c7c('0x24')](saveUpdates(_0x4a64c6[_0x0c7c('0x44')],null))[_0x0c7c('0x24')](respondWithResult(_0x416df2,null))['catch'](handleError(_0x416df2,null));};exports['destroy']=function(_0x19ec3c,_0x30803f){return db['MailServerOut'][_0x0c7c('0x42')]({'where':{'id':_0x19ec3c[_0x0c7c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x30803f,null))['then'](removeEntity(_0x30803f,null))['catch'](handleError(_0x30803f,null));}; \ No newline at end of file +var _0xd961=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','params','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x292f93,_0x2c6e8e){var _0x5a94b1=function(_0x25735e){while(--_0x25735e){_0x292f93['push'](_0x292f93['shift']());}};_0x5a94b1(++_0x2c6e8e);}(_0xd961,0x1ab));var _0x1d96=function(_0x32084f,_0x28fc38){_0x32084f=_0x32084f-0x0;var _0x187302=_0xd961[_0x32084f];return _0x187302;};'use strict';var emlformat=require(_0x1d96('0x0'));var rimraf=require(_0x1d96('0x1'));var zipdir=require(_0x1d96('0x2'));var jsonpatch=require(_0x1d96('0x3'));var rp=require('request-promise');var moment=require(_0x1d96('0x4'));var BPromise=require(_0x1d96('0x5'));var Mustache=require(_0x1d96('0x6'));var util=require(_0x1d96('0x7'));var path=require(_0x1d96('0x8'));var sox=require(_0x1d96('0x9'));var csv=require(_0x1d96('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d96('0xb'));var _=require(_0x1d96('0xc'));var squel=require(_0x1d96('0xd'));var crypto=require(_0x1d96('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1d96('0xf'));var toCsv=require(_0x1d96('0xa'));var querystring=require('querystring');var Papa=require(_0x1d96('0x10'));var Redis=require(_0x1d96('0x11'));var authService=require(_0x1d96('0x12'));var qs=require(_0x1d96('0x13'));var as=require(_0x1d96('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1d96('0x15'));var utils=require(_0x1d96('0x16'));var config=require(_0x1d96('0x17'));var licenseUtil=require(_0x1d96('0x18'));var db=require(_0x1d96('0x19'))['db'];function respondWithStatusCode(_0x2e01cc,_0x36a913){_0x36a913=_0x36a913||0xcc;return function(_0x5c58fc){if(_0x5c58fc){return _0x2e01cc[_0x1d96('0x1a')](_0x36a913);}return _0x2e01cc[_0x1d96('0x1b')](_0x36a913)[_0x1d96('0x1c')]();};}function respondWithResult(_0x48e24f,_0x5d5029){_0x5d5029=_0x5d5029||0xc8;return function(_0x513927){if(_0x513927){return _0x48e24f['status'](_0x5d5029)[_0x1d96('0x1d')](_0x513927);}};}function respondWithFilteredResult(_0x5c7ab2,_0x57bd66){return function(_0x29d28c){if(_0x29d28c){var _0x3dcab4=typeof _0x57bd66['offset']===_0x1d96('0x1e')&&typeof _0x57bd66[_0x1d96('0x1f')]==='undefined';var _0x4a3d2b=_0x29d28c[_0x1d96('0x20')];var _0x635514=_0x3dcab4?0x0:_0x57bd66[_0x1d96('0x21')];var _0x174247=_0x3dcab4?_0x29d28c[_0x1d96('0x20')]:_0x57bd66[_0x1d96('0x21')]+_0x57bd66[_0x1d96('0x1f')];var _0x1157b1;if(_0x174247>=_0x4a3d2b){_0x174247=_0x4a3d2b;_0x1157b1=0xc8;}else{_0x1157b1=0xce;}_0x5c7ab2[_0x1d96('0x1b')](_0x1157b1);return _0x5c7ab2[_0x1d96('0x22')](_0x1d96('0x23'),_0x635514+'-'+_0x174247+'/'+_0x4a3d2b)[_0x1d96('0x1d')](_0x29d28c);}return null;};}function patchUpdates(_0x4886b6){return function(_0x2007f9){try{jsonpatch[_0x1d96('0x24')](_0x2007f9,_0x4886b6,!![]);}catch(_0x1f6b51){return BPromise[_0x1d96('0x25')](_0x1f6b51);}return _0x2007f9['save']();};}function saveUpdates(_0x16bc72,_0x613261){return function(_0x2ffe20){if(_0x2ffe20){return _0x2ffe20[_0x1d96('0x26')](_0x16bc72)['then'](function(_0x5b09b8){return _0x5b09b8;});}return null;};}function removeEntity(_0x5ee2f2,_0x27868f){return function(_0x17c125){if(_0x17c125){return _0x17c125['destroy']()[_0x1d96('0x27')](function(){_0x5ee2f2['status'](0xcc)[_0x1d96('0x1c')]();});}};}function handleEntityNotFound(_0x40bffa,_0x273767){return function(_0x450763){if(!_0x450763){_0x40bffa[_0x1d96('0x1a')](0x194);}return _0x450763;};}function handleError(_0x30ef32,_0x1a1303){_0x1a1303=_0x1a1303||0x1f4;return function(_0x29cbc8){logger[_0x1d96('0x28')](_0x29cbc8[_0x1d96('0x29')]);if(_0x29cbc8[_0x1d96('0x2a')]){delete _0x29cbc8[_0x1d96('0x2a')];}_0x30ef32['status'](_0x1a1303)[_0x1d96('0x2b')](_0x29cbc8);};}exports[_0x1d96('0x2c')]=function(_0x383f5c,_0x78e3e8){var _0x24cca9={},_0x7a6951={},_0xf05e3a={'count':0x0,'rows':[]};var _0x2cdff8=_['map'](db[_0x1d96('0x2d')][_0x1d96('0x2e')],function(_0xcbc7d4){return{'name':_0xcbc7d4[_0x1d96('0x2f')],'type':_0xcbc7d4[_0x1d96('0x30')][_0x1d96('0x31')]};});_0x7a6951['model']=_['map'](_0x2cdff8,_0x1d96('0x2a'));_0x7a6951[_0x1d96('0x32')]=_[_0x1d96('0x33')](_0x383f5c[_0x1d96('0x32')]);_0x7a6951[_0x1d96('0x34')]=_['intersection'](_0x7a6951['model'],_0x7a6951['query']);_0x24cca9[_0x1d96('0x35')]=_[_0x1d96('0x36')](_0x7a6951[_0x1d96('0x37')],qs['fields'](_0x383f5c[_0x1d96('0x32')][_0x1d96('0x38')]));_0x24cca9[_0x1d96('0x35')]=_0x24cca9[_0x1d96('0x35')][_0x1d96('0x39')]?_0x24cca9[_0x1d96('0x35')]:_0x7a6951[_0x1d96('0x37')];if(!_0x383f5c[_0x1d96('0x32')]['hasOwnProperty'](_0x1d96('0x3a'))){_0x24cca9[_0x1d96('0x1f')]=qs['limit'](_0x383f5c[_0x1d96('0x32')][_0x1d96('0x1f')]);_0x24cca9[_0x1d96('0x21')]=qs[_0x1d96('0x21')](_0x383f5c['query']['offset']);}_0x24cca9['order']=qs['sort'](_0x383f5c[_0x1d96('0x32')][_0x1d96('0x3b')]);_0x24cca9[_0x1d96('0x3c')]=qs[_0x1d96('0x34')](_[_0x1d96('0x3d')](_0x383f5c['query'],_0x7a6951[_0x1d96('0x34')]),_0x2cdff8);if(_0x383f5c[_0x1d96('0x32')]['filter']){_0x24cca9['where']=_[_0x1d96('0x3e')](_0x24cca9[_0x1d96('0x3c')],{'$or':_['map'](_0x2cdff8,function(_0x1db094){if(_0x1db094['type']!==_0x1d96('0x3f')){var _0x15cc0a={};_0x15cc0a[_0x1db094[_0x1d96('0x2a')]]={'$like':'%'+_0x383f5c['query'][_0x1d96('0x40')]+'%'};return _0x15cc0a;}})});}_0x24cca9=_['merge']({},_0x24cca9,_0x383f5c['options']);var _0x35bbc6={'where':_0x24cca9[_0x1d96('0x3c')]};return db[_0x1d96('0x2d')][_0x1d96('0x20')](_0x35bbc6)[_0x1d96('0x27')](function(_0x3f3878){_0xf05e3a['count']=_0x3f3878;if(_0x383f5c['query'][_0x1d96('0x41')]){_0x24cca9[_0x1d96('0x42')]=[{'all':!![]}];}return db[_0x1d96('0x2d')]['findAll'](_0x24cca9);})[_0x1d96('0x27')](function(_0x2f24ad){_0xf05e3a[_0x1d96('0x43')]=_0x2f24ad;return _0xf05e3a;})[_0x1d96('0x27')](respondWithFilteredResult(_0x78e3e8,_0x24cca9))[_0x1d96('0x44')](handleError(_0x78e3e8,null));};exports['show']=function(_0x5950f5,_0x15a4b8){var _0x7ed2e6={'raw':!![],'where':{'id':_0x5950f5[_0x1d96('0x45')]['id']}},_0x47a82b={};_0x47a82b['model']=_[_0x1d96('0x33')](db['MailServerOut'][_0x1d96('0x2e')]);_0x47a82b[_0x1d96('0x32')]=_[_0x1d96('0x33')](_0x5950f5[_0x1d96('0x32')]);_0x47a82b[_0x1d96('0x34')]=_[_0x1d96('0x36')](_0x47a82b[_0x1d96('0x37')],_0x47a82b[_0x1d96('0x32')]);_0x7ed2e6['attributes']=_[_0x1d96('0x36')](_0x47a82b[_0x1d96('0x37')],qs['fields'](_0x5950f5['query'][_0x1d96('0x38')]));_0x7ed2e6[_0x1d96('0x35')]=_0x7ed2e6[_0x1d96('0x35')][_0x1d96('0x39')]?_0x7ed2e6[_0x1d96('0x35')]:_0x47a82b[_0x1d96('0x37')];if(_0x5950f5[_0x1d96('0x32')][_0x1d96('0x41')]){_0x7ed2e6['include']=[{'all':!![]}];}_0x7ed2e6=_[_0x1d96('0x3e')]({},_0x7ed2e6,_0x5950f5[_0x1d96('0x46')]);return db[_0x1d96('0x2d')][_0x1d96('0x47')](_0x7ed2e6)[_0x1d96('0x27')](handleEntityNotFound(_0x15a4b8,null))[_0x1d96('0x27')](respondWithResult(_0x15a4b8,null))[_0x1d96('0x44')](handleError(_0x15a4b8,null));};exports[_0x1d96('0x48')]=function(_0x4ab544,_0x25943f){return db['MailServerOut']['create'](_0x4ab544[_0x1d96('0x49')],{})[_0x1d96('0x27')](respondWithResult(_0x25943f,0xc9))[_0x1d96('0x44')](handleError(_0x25943f,null));};exports[_0x1d96('0x26')]=function(_0x3cb0d7,_0x32fefd){if(_0x3cb0d7['body']['id']){delete _0x3cb0d7[_0x1d96('0x49')]['id'];}return db[_0x1d96('0x2d')]['find']({'where':{'id':_0x3cb0d7[_0x1d96('0x45')]['id']}})[_0x1d96('0x27')](handleEntityNotFound(_0x32fefd,null))[_0x1d96('0x27')](saveUpdates(_0x3cb0d7['body'],null))[_0x1d96('0x27')](respondWithResult(_0x32fefd,null))[_0x1d96('0x44')](handleError(_0x32fefd,null));};exports[_0x1d96('0x4a')]=function(_0x440a06,_0x32de60){return db[_0x1d96('0x2d')][_0x1d96('0x47')]({'where':{'id':_0x440a06[_0x1d96('0x45')]['id']}})['then'](handleEntityNotFound(_0x32de60,null))[_0x1d96('0x27')](removeEntity(_0x32de60,null))[_0x1d96('0x44')](handleError(_0x32de60,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index b8ae9dd..8d663c1 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 _0x278d=['moment','bluebird','request-promise','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x278d,0xe8));var _0xd278=function(_0x253d2b,_0x49a0fb){_0x253d2b=_0x253d2b-0x0;var _0x3ce8bd=_0x278d[_0x253d2b];return _0x3ce8bd;};'use strict';var _=require(_0xd278('0x0'));var util=require('util');var logger=require(_0xd278('0x1'))('api');var moment=require(_0xd278('0x2'));var BPromise=require(_0xd278('0x3'));var rp=require(_0xd278('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd278('0x5'));module[_0xd278('0x6')]=function(_0x5dd507,_0x48c087){return _0x5dd507['define'](_0xd278('0x7'),attributes,{'tableName':_0xd278('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6997=['./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1261eb,_0x3246f0){var _0x1b9906=function(_0x2a3da8){while(--_0x2a3da8){_0x1261eb['push'](_0x1261eb['shift']());}};_0x1b9906(++_0x3246f0);}(_0x6997,0x17d));var _0x7699=function(_0x3d6d80,_0x40dca9){_0x3d6d80=_0x3d6d80-0x0;var _0x20b5b2=_0x6997[_0x3d6d80];return _0x20b5b2;};'use strict';var _=require(_0x7699('0x0'));var util=require('util');var logger=require(_0x7699('0x1'))(_0x7699('0x2'));var moment=require(_0x7699('0x3'));var BPromise=require(_0x7699('0x4'));var rp=require(_0x7699('0x5'));var fs=require('fs');var path=require(_0x7699('0x6'));var rimraf=require(_0x7699('0x7'));var config=require(_0x7699('0x8'));var attributes=require(_0x7699('0x9'));module[_0x7699('0xa')]=function(_0x34821c,_0x1434d5){return _0x34821c['define'](_0x7699('0xb'),attributes,{'tableName':_0x7699('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index bfc7ccc..ea96994 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x1c67b3,_0x3fb1ca){var _0x54ecd2=function(_0x4fd560){while(--_0x4fd560){_0x1c67b3['push'](_0x1c67b3['shift']());}};_0x54ecd2(++_0x3fb1ca);}(_0x2ef3,0xba));var _0x32ef=function(_0x5a017b,_0x43cabc){_0x5a017b=_0x5a017b-0x0;var _0xd51acd=_0x2ef3[_0x5a017b];return _0xd51acd;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x13d5d1,_0x454f65){var _0x2fb5e4=function(_0x444dae){while(--_0x444dae){_0x13d5d1['push'](_0x13d5d1['shift']());}};_0x2fb5e4(++_0x454f65);}(_0x1261,0x144));var _0x1126=function(_0x2e9b5b,_0x3e1332){_0x2e9b5b=_0x2e9b5b-0x0;var _0x734c46=_0x1261[_0x2e9b5b];return _0x734c46;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 308fc7a..fe54410 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 _0x39ce=['./mailSubstatus.controller','index','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c1de5,_0x41d0ab){var _0x5741f9=function(_0x4fbbe4){while(--_0x4fbbe4){_0x5c1de5['push'](_0x5c1de5['shift']());}};_0x5741f9(++_0x41d0ab);}(_0x39ce,0x17e));var _0xe39c=function(_0x29e9cf,_0x377744){_0x29e9cf=_0x29e9cf-0x0;var _0x3a84ef=_0x39ce[_0x29e9cf];return _0x3a84ef;};'use strict';var multer=require('multer');var util=require(_0xe39c('0x0'));var path=require(_0xe39c('0x1'));var timeout=require(_0xe39c('0x2'));var express=require(_0xe39c('0x3'));var router=express[_0xe39c('0x4')]();var fs_extra=require(_0xe39c('0x5'));var auth=require(_0xe39c('0x6'));var interaction=require(_0xe39c('0x7'));var config=require(_0xe39c('0x8'));var controller=require(_0xe39c('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe39c('0xa')]);router[_0xe39c('0xb')](_0xe39c('0xc'),auth['isAuthenticated'](),controller[_0xe39c('0xd')]);router[_0xe39c('0xb')](_0xe39c('0xe'),auth[_0xe39c('0xf')](),controller[_0xe39c('0x10')]);router[_0xe39c('0x11')]('/',auth[_0xe39c('0xf')](),controller[_0xe39c('0x12')]);router[_0xe39c('0x13')](_0xe39c('0xe'),auth['isAuthenticated'](),controller[_0xe39c('0x14')]);router[_0xe39c('0x15')]('/:id',auth[_0xe39c('0xf')](),controller['destroy']);module[_0xe39c('0x16')]=router; \ No newline at end of file +var _0x0a34=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a34,0x142));var _0x40a3=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x0a34[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x40a3('0x0'));var util=require('util');var path=require(_0x40a3('0x1'));var timeout=require(_0x40a3('0x2'));var express=require(_0x40a3('0x3'));var router=express[_0x40a3('0x4')]();var fs_extra=require(_0x40a3('0x5'));var auth=require(_0x40a3('0x6'));var interaction=require(_0x40a3('0x7'));var config=require('../../config/environment');var controller=require(_0x40a3('0x8'));router[_0x40a3('0x9')]('/',auth[_0x40a3('0xa')](),controller[_0x40a3('0xb')]);router[_0x40a3('0x9')](_0x40a3('0xc'),auth['isAuthenticated'](),controller[_0x40a3('0xd')]);router['get'](_0x40a3('0xe'),auth[_0x40a3('0xa')](),controller[_0x40a3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x40a3('0x10')]);router[_0x40a3('0x11')](_0x40a3('0xe'),auth[_0x40a3('0xa')](),controller['update']);router[_0x40a3('0x12')](_0x40a3('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x40a3('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 f1a09f0..1b19579 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 _0x4074=['sequelize','exports','STRING'];(function(_0x2be3bd,_0x416bb6){var _0x1a5d36=function(_0x35f411){while(--_0x35f411){_0x2be3bd['push'](_0x2be3bd['shift']());}};_0x1a5d36(++_0x416bb6);}(_0x4074,0xf0));var _0x4407=function(_0x4c37f3,_0x31e2ac){_0x4c37f3=_0x4c37f3-0x0;var _0xd22f62=_0x4074[_0x4c37f3];return _0xd22f62;};'use strict';var Sequelize=require(_0x4407('0x0'));module[_0x4407('0x1')]={'name':{'type':Sequelize[_0x4407('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4407('0x2')]}}; \ No newline at end of file +var _0x86f4=['STRING','name','sequelize','exports'];(function(_0x3dd79f,_0x505dbf){var _0x5c2dc5=function(_0x28737f){while(--_0x28737f){_0x3dd79f['push'](_0x3dd79f['shift']());}};_0x5c2dc5(++_0x505dbf);}(_0x86f4,0x18a));var _0x486f=function(_0x485862,_0x5a2244){_0x485862=_0x485862-0x0;var _0x5bebbc=_0x86f4[_0x485862];return _0x5bebbc;};'use strict';var Sequelize=require(_0x486f('0x0'));module[_0x486f('0x1')]={'name':{'type':Sequelize[_0x486f('0x2')],'unique':_0x486f('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x486f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 14e539f..917e511 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 _0x8e23=['count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined'];(function(_0x119a4c,_0x45f93f){var _0x2c88e9=function(_0x57c0ab){while(--_0x57c0ab){_0x119a4c['push'](_0x119a4c['shift']());}};_0x2c88e9(++_0x45f93f);}(_0x8e23,0xcf));var _0x38e2=function(_0x5ddcfc,_0x3e6fb6){_0x5ddcfc=_0x5ddcfc-0x0;var _0x2fad31=_0x8e23[_0x5ddcfc];return _0x2fad31;};'use strict';var emlformat=require(_0x38e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38e2('0x1'));var jsonpatch=require(_0x38e2('0x2'));var rp=require(_0x38e2('0x3'));var moment=require(_0x38e2('0x4'));var BPromise=require(_0x38e2('0x5'));var Mustache=require(_0x38e2('0x6'));var util=require(_0x38e2('0x7'));var path=require(_0x38e2('0x8'));var sox=require('sox');var csv=require(_0x38e2('0x9'));var ejs=require(_0x38e2('0xa'));var fs=require('fs');var fs_extra=require(_0x38e2('0xb'));var _=require('lodash');var squel=require(_0x38e2('0xc'));var crypto=require(_0x38e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x38e2('0xe'));var toCsv=require(_0x38e2('0x9'));var querystring=require(_0x38e2('0xf'));var Papa=require(_0x38e2('0x10'));var Redis=require(_0x38e2('0x11'));var authService=require(_0x38e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x38e2('0x13'));var hardwareService=require(_0x38e2('0x14'));var logger=require(_0x38e2('0x15'))(_0x38e2('0x16'));var utils=require(_0x38e2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x38e2('0x18'));var db=require(_0x38e2('0x19'))['db'];function respondWithStatusCode(_0x25430a,_0x16de6a){_0x16de6a=_0x16de6a||0xcc;return function(_0x4911c4){if(_0x4911c4){return _0x25430a[_0x38e2('0x1a')](_0x16de6a);}return _0x25430a[_0x38e2('0x1b')](_0x16de6a)[_0x38e2('0x1c')]();};}function respondWithResult(_0x2ff160,_0x5debe1){_0x5debe1=_0x5debe1||0xc8;return function(_0x2be4bc){if(_0x2be4bc){return _0x2ff160[_0x38e2('0x1b')](_0x5debe1)[_0x38e2('0x1d')](_0x2be4bc);}};}function respondWithFilteredResult(_0x77a93b,_0x53f274){return function(_0x1ecf35){if(_0x1ecf35){var _0x2fdc41=typeof _0x53f274[_0x38e2('0x1e')]==='undefined'&&typeof _0x53f274[_0x38e2('0x1f')]===_0x38e2('0x20');var _0x274380=_0x1ecf35['count'];var _0x1cf679=_0x2fdc41?0x0:_0x53f274[_0x38e2('0x1e')];var _0x50ec94=_0x2fdc41?_0x1ecf35[_0x38e2('0x21')]:_0x53f274[_0x38e2('0x1e')]+_0x53f274[_0x38e2('0x1f')];var _0xbd985a;if(_0x50ec94>=_0x274380){_0x50ec94=_0x274380;_0xbd985a=0xc8;}else{_0xbd985a=0xce;}_0x77a93b['status'](_0xbd985a);return _0x77a93b[_0x38e2('0x22')](_0x38e2('0x23'),_0x1cf679+'-'+_0x50ec94+'/'+_0x274380)[_0x38e2('0x1d')](_0x1ecf35);}return null;};}function patchUpdates(_0xfb657e){return function(_0x2c0283){try{jsonpatch[_0x38e2('0x24')](_0x2c0283,_0xfb657e,!![]);}catch(_0x39e68d){return BPromise[_0x38e2('0x25')](_0x39e68d);}return _0x2c0283[_0x38e2('0x26')]();};}function saveUpdates(_0x40d5e9,_0x4bc651){return function(_0x32140b){if(_0x32140b){return _0x32140b[_0x38e2('0x27')](_0x40d5e9)['then'](function(_0x1328dd){return _0x1328dd;});}return null;};}function removeEntity(_0x2f853b,_0x74e95f){return function(_0x1028d7){if(_0x1028d7){return _0x1028d7['destroy']()[_0x38e2('0x28')](function(){_0x2f853b[_0x38e2('0x1b')](0xcc)[_0x38e2('0x1c')]();});}};}function handleEntityNotFound(_0x338e76,_0x4c664e){return function(_0x5a4093){if(!_0x5a4093){_0x338e76[_0x38e2('0x1a')](0x194);}return _0x5a4093;};}function handleError(_0x53f523,_0x3b2700){_0x3b2700=_0x3b2700||0x1f4;return function(_0x375efc){logger[_0x38e2('0x29')](_0x375efc[_0x38e2('0x2a')]);if(_0x375efc[_0x38e2('0x2b')]){delete _0x375efc[_0x38e2('0x2b')];}_0x53f523[_0x38e2('0x1b')](_0x3b2700)[_0x38e2('0x2c')](_0x375efc);};}exports[_0x38e2('0x2d')]=function(_0x572b72,_0x11d166){var _0x4b10db={},_0x25b422={},_0x3bc217={'count':0x0,'rows':[]};var _0x4f3965=_[_0x38e2('0x2e')](db[_0x38e2('0x2f')][_0x38e2('0x30')],function(_0x269abb){return{'name':_0x269abb[_0x38e2('0x31')],'type':_0x269abb[_0x38e2('0x32')][_0x38e2('0x33')]};});_0x25b422['model']=_[_0x38e2('0x2e')](_0x4f3965,'name');_0x25b422[_0x38e2('0x34')]=_['keys'](_0x572b72['query']);_0x25b422['filters']=_[_0x38e2('0x35')](_0x25b422[_0x38e2('0x36')],_0x25b422[_0x38e2('0x34')]);_0x4b10db['attributes']=_[_0x38e2('0x35')](_0x25b422['model'],qs[_0x38e2('0x37')](_0x572b72['query'][_0x38e2('0x37')]));_0x4b10db[_0x38e2('0x38')]=_0x4b10db[_0x38e2('0x38')]['length']?_0x4b10db[_0x38e2('0x38')]:_0x25b422[_0x38e2('0x36')];if(!_0x572b72[_0x38e2('0x34')][_0x38e2('0x39')](_0x38e2('0x3a'))){_0x4b10db[_0x38e2('0x1f')]=qs['limit'](_0x572b72['query'][_0x38e2('0x1f')]);_0x4b10db[_0x38e2('0x1e')]=qs['offset'](_0x572b72[_0x38e2('0x34')]['offset']);}_0x4b10db[_0x38e2('0x3b')]=qs[_0x38e2('0x3c')](_0x572b72[_0x38e2('0x34')][_0x38e2('0x3c')]);_0x4b10db['where']=qs[_0x38e2('0x3d')](_['pick'](_0x572b72[_0x38e2('0x34')],_0x25b422[_0x38e2('0x3d')]),_0x4f3965);if(_0x572b72['query']['filter']){_0x4b10db['where']=_[_0x38e2('0x3e')](_0x4b10db[_0x38e2('0x3f')],{'$or':_['map'](_0x4f3965,function(_0x41b62b){if(_0x41b62b[_0x38e2('0x32')]!==_0x38e2('0x40')){var _0x143633={};_0x143633[_0x41b62b[_0x38e2('0x2b')]]={'$like':'%'+_0x572b72[_0x38e2('0x34')][_0x38e2('0x41')]+'%'};return _0x143633;}})});}_0x4b10db=_[_0x38e2('0x3e')]({},_0x4b10db,_0x572b72[_0x38e2('0x42')]);var _0x1f7af6={'where':_0x4b10db[_0x38e2('0x3f')]};return db[_0x38e2('0x2f')][_0x38e2('0x21')](_0x1f7af6)[_0x38e2('0x28')](function(_0x2c6295){_0x3bc217['count']=_0x2c6295;if(_0x572b72[_0x38e2('0x34')][_0x38e2('0x43')]){_0x4b10db[_0x38e2('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x38e2('0x45')](_0x4b10db);})[_0x38e2('0x28')](function(_0x531ae4){_0x3bc217[_0x38e2('0x46')]=_0x531ae4;return _0x3bc217;})[_0x38e2('0x28')](respondWithFilteredResult(_0x11d166,_0x4b10db))[_0x38e2('0x47')](handleError(_0x11d166,null));};exports['show']=function(_0x4ba027,_0x1377cd){var _0x49521a={'raw':!![],'where':{'id':_0x4ba027[_0x38e2('0x48')]['id']}},_0x5142b6={};_0x5142b6[_0x38e2('0x36')]=_[_0x38e2('0x49')](db[_0x38e2('0x2f')][_0x38e2('0x30')]);_0x5142b6[_0x38e2('0x34')]=_['keys'](_0x4ba027[_0x38e2('0x34')]);_0x5142b6[_0x38e2('0x3d')]=_[_0x38e2('0x35')](_0x5142b6[_0x38e2('0x36')],_0x5142b6['query']);_0x49521a[_0x38e2('0x38')]=_[_0x38e2('0x35')](_0x5142b6[_0x38e2('0x36')],qs[_0x38e2('0x37')](_0x4ba027[_0x38e2('0x34')][_0x38e2('0x37')]));_0x49521a['attributes']=_0x49521a[_0x38e2('0x38')][_0x38e2('0x4a')]?_0x49521a[_0x38e2('0x38')]:_0x5142b6['model'];if(_0x4ba027[_0x38e2('0x34')][_0x38e2('0x43')]){_0x49521a[_0x38e2('0x44')]=[{'all':!![]}];}_0x49521a=_[_0x38e2('0x3e')]({},_0x49521a,_0x4ba027[_0x38e2('0x42')]);return db[_0x38e2('0x2f')]['find'](_0x49521a)['then'](handleEntityNotFound(_0x1377cd,null))[_0x38e2('0x28')](respondWithResult(_0x1377cd,null))['catch'](handleError(_0x1377cd,null));};exports['create']=function(_0x50ad85,_0x3ca374){return db[_0x38e2('0x2f')][_0x38e2('0x4b')](_0x50ad85[_0x38e2('0x4c')],{})[_0x38e2('0x28')](respondWithResult(_0x3ca374,0xc9))[_0x38e2('0x47')](handleError(_0x3ca374,null));};exports['update']=function(_0x96740e,_0x8545c2){if(_0x96740e['body']['id']){delete _0x96740e['body']['id'];}return db[_0x38e2('0x2f')][_0x38e2('0x4d')]({'where':{'id':_0x96740e[_0x38e2('0x48')]['id']}})['then'](handleEntityNotFound(_0x8545c2,null))['then'](saveUpdates(_0x96740e[_0x38e2('0x4c')],null))[_0x38e2('0x28')](respondWithResult(_0x8545c2,null))[_0x38e2('0x47')](handleError(_0x8545c2,null));};exports[_0x38e2('0x4e')]=function(_0x1fb1b4,_0x3e535b){return db[_0x38e2('0x2f')][_0x38e2('0x4d')]({'where':{'id':_0x1fb1b4[_0x38e2('0x48')]['id']}})[_0x38e2('0x28')](handleEntityNotFound(_0x3e535b,null))[_0x38e2('0x28')](removeEntity(_0x3e535b,null))[_0x38e2('0x47')](handleError(_0x3e535b,null));};exports[_0x38e2('0x4f')]=function(_0x512ce7,_0x49768b){return db[_0x38e2('0x2f')]['describe']()[_0x38e2('0x28')](respondWithResult(_0x49768b,null))['catch'](handleError(_0x49768b,null));}; \ No newline at end of file +var _0x436e=['catch','include','create','body','params','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','MailSubstatus','findAll','rows'];(function(_0x995300,_0xe0dd06){var _0x5e4466=function(_0x3587eb){while(--_0x3587eb){_0x995300['push'](_0x995300['shift']());}};_0x5e4466(++_0xe0dd06);}(_0x436e,0x9f));var _0xe436=function(_0x1877c9,_0x5be939){_0x1877c9=_0x1877c9-0x0;var _0x52d27b=_0x436e[_0x1877c9];return _0x52d27b;};'use strict';var emlformat=require(_0xe436('0x0'));var rimraf=require(_0xe436('0x1'));var zipdir=require(_0xe436('0x2'));var jsonpatch=require(_0xe436('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe436('0x4'));var Mustache=require(_0xe436('0x5'));var util=require(_0xe436('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe436('0x7'));var ejs=require(_0xe436('0x8'));var fs=require('fs');var fs_extra=require(_0xe436('0x9'));var _=require(_0xe436('0xa'));var squel=require(_0xe436('0xb'));var crypto=require('crypto');var jsforce=require(_0xe436('0xc'));var deskjs=require(_0xe436('0xd'));var toCsv=require(_0xe436('0x7'));var querystring=require('querystring');var Papa=require(_0xe436('0xe'));var Redis=require(_0xe436('0xf'));var authService=require(_0xe436('0x10'));var qs=require(_0xe436('0x11'));var as=require(_0xe436('0x12'));var hardwareService=require(_0xe436('0x13'));var logger=require(_0xe436('0x14'))(_0xe436('0x15'));var utils=require(_0xe436('0x16'));var config=require(_0xe436('0x17'));var licenseUtil=require(_0xe436('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310e64,_0x48b75e){_0x48b75e=_0x48b75e||0xcc;return function(_0x8dcf3b){if(_0x8dcf3b){return _0x310e64[_0xe436('0x19')](_0x48b75e);}return _0x310e64['status'](_0x48b75e)[_0xe436('0x1a')]();};}function respondWithResult(_0x2561b5,_0x2acb8f){_0x2acb8f=_0x2acb8f||0xc8;return function(_0x4e423d){if(_0x4e423d){return _0x2561b5['status'](_0x2acb8f)[_0xe436('0x1b')](_0x4e423d);}};}function respondWithFilteredResult(_0x21a192,_0x2c50bf){return function(_0x18f077){if(_0x18f077){var _0x320dd4=typeof _0x2c50bf[_0xe436('0x1c')]===_0xe436('0x1d')&&typeof _0x2c50bf['limit']===_0xe436('0x1d');var _0x5e18ca=_0x18f077[_0xe436('0x1e')];var _0x4093b2=_0x320dd4?0x0:_0x2c50bf[_0xe436('0x1c')];var _0x5c98a5=_0x320dd4?_0x18f077[_0xe436('0x1e')]:_0x2c50bf['offset']+_0x2c50bf[_0xe436('0x1f')];var _0x3d5958;if(_0x5c98a5>=_0x5e18ca){_0x5c98a5=_0x5e18ca;_0x3d5958=0xc8;}else{_0x3d5958=0xce;}_0x21a192['status'](_0x3d5958);return _0x21a192[_0xe436('0x20')]('Content-Range',_0x4093b2+'-'+_0x5c98a5+'/'+_0x5e18ca)[_0xe436('0x1b')](_0x18f077);}return null;};}function patchUpdates(_0x169efa){return function(_0x56091){try{jsonpatch[_0xe436('0x21')](_0x56091,_0x169efa,!![]);}catch(_0x3fc44f){return BPromise[_0xe436('0x22')](_0x3fc44f);}return _0x56091[_0xe436('0x23')]();};}function saveUpdates(_0x57f535,_0x499f12){return function(_0x1d2003){if(_0x1d2003){return _0x1d2003[_0xe436('0x24')](_0x57f535)[_0xe436('0x25')](function(_0x65fcb9){return _0x65fcb9;});}return null;};}function removeEntity(_0x208ed0,_0x93e127){return function(_0x262533){if(_0x262533){return _0x262533[_0xe436('0x26')]()['then'](function(){_0x208ed0[_0xe436('0x27')](0xcc)[_0xe436('0x1a')]();});}};}function handleEntityNotFound(_0x2748e4,_0x92a3a0){return function(_0x1964b4){if(!_0x1964b4){_0x2748e4[_0xe436('0x19')](0x194);}return _0x1964b4;};}function handleError(_0x546397,_0x25c7d6){_0x25c7d6=_0x25c7d6||0x1f4;return function(_0x58fbd7){logger[_0xe436('0x28')](_0x58fbd7[_0xe436('0x29')]);if(_0x58fbd7[_0xe436('0x2a')]){delete _0x58fbd7['name'];}_0x546397[_0xe436('0x27')](_0x25c7d6)[_0xe436('0x2b')](_0x58fbd7);};}exports[_0xe436('0x2c')]=function(_0x40c72b,_0x4f4bbb){var _0xa7e2db={},_0xe26afa={},_0x3e40e3={'count':0x0,'rows':[]};var _0x27f977=_[_0xe436('0x2d')](db['MailSubstatus'][_0xe436('0x2e')],function(_0x3a60e3){return{'name':_0x3a60e3[_0xe436('0x2f')],'type':_0x3a60e3[_0xe436('0x30')]['key']};});_0xe26afa[_0xe436('0x31')]=_[_0xe436('0x2d')](_0x27f977,'name');_0xe26afa[_0xe436('0x32')]=_[_0xe436('0x33')](_0x40c72b[_0xe436('0x32')]);_0xe26afa[_0xe436('0x34')]=_[_0xe436('0x35')](_0xe26afa['model'],_0xe26afa[_0xe436('0x32')]);_0xa7e2db['attributes']=_[_0xe436('0x35')](_0xe26afa[_0xe436('0x31')],qs[_0xe436('0x36')](_0x40c72b[_0xe436('0x32')][_0xe436('0x36')]));_0xa7e2db[_0xe436('0x37')]=_0xa7e2db[_0xe436('0x37')][_0xe436('0x38')]?_0xa7e2db['attributes']:_0xe26afa[_0xe436('0x31')];if(!_0x40c72b[_0xe436('0x32')][_0xe436('0x39')]('nolimit')){_0xa7e2db['limit']=qs[_0xe436('0x1f')](_0x40c72b[_0xe436('0x32')][_0xe436('0x1f')]);_0xa7e2db[_0xe436('0x1c')]=qs[_0xe436('0x1c')](_0x40c72b[_0xe436('0x32')][_0xe436('0x1c')]);}_0xa7e2db['order']=qs[_0xe436('0x3a')](_0x40c72b[_0xe436('0x32')]['sort']);_0xa7e2db[_0xe436('0x3b')]=qs[_0xe436('0x34')](_[_0xe436('0x3c')](_0x40c72b[_0xe436('0x32')],_0xe26afa[_0xe436('0x34')]),_0x27f977);if(_0x40c72b[_0xe436('0x32')][_0xe436('0x3d')]){_0xa7e2db[_0xe436('0x3b')]=_[_0xe436('0x3e')](_0xa7e2db[_0xe436('0x3b')],{'$or':_[_0xe436('0x2d')](_0x27f977,function(_0x3e11e1){if(_0x3e11e1[_0xe436('0x30')]!==_0xe436('0x3f')){var _0x45c4d8={};_0x45c4d8[_0x3e11e1[_0xe436('0x2a')]]={'$like':'%'+_0x40c72b[_0xe436('0x32')][_0xe436('0x3d')]+'%'};return _0x45c4d8;}})});}_0xa7e2db=_[_0xe436('0x3e')]({},_0xa7e2db,_0x40c72b[_0xe436('0x40')]);var _0x19724c={'where':_0xa7e2db[_0xe436('0x3b')]};return db['MailSubstatus'][_0xe436('0x1e')](_0x19724c)['then'](function(_0x2484c2){_0x3e40e3[_0xe436('0x1e')]=_0x2484c2;if(_0x40c72b[_0xe436('0x32')][_0xe436('0x41')]){_0xa7e2db['include']=[{'all':!![]}];}return db[_0xe436('0x42')][_0xe436('0x43')](_0xa7e2db);})[_0xe436('0x25')](function(_0x138368){_0x3e40e3[_0xe436('0x44')]=_0x138368;return _0x3e40e3;})[_0xe436('0x25')](respondWithFilteredResult(_0x4f4bbb,_0xa7e2db))[_0xe436('0x45')](handleError(_0x4f4bbb,null));};exports['show']=function(_0x3b5d4a,_0x150753){var _0x1f3822={'raw':!![],'where':{'id':_0x3b5d4a['params']['id']}},_0x2ca243={};_0x2ca243['model']=_[_0xe436('0x33')](db[_0xe436('0x42')][_0xe436('0x2e')]);_0x2ca243[_0xe436('0x32')]=_[_0xe436('0x33')](_0x3b5d4a['query']);_0x2ca243[_0xe436('0x34')]=_[_0xe436('0x35')](_0x2ca243[_0xe436('0x31')],_0x2ca243[_0xe436('0x32')]);_0x1f3822[_0xe436('0x37')]=_[_0xe436('0x35')](_0x2ca243[_0xe436('0x31')],qs[_0xe436('0x36')](_0x3b5d4a[_0xe436('0x32')][_0xe436('0x36')]));_0x1f3822[_0xe436('0x37')]=_0x1f3822[_0xe436('0x37')][_0xe436('0x38')]?_0x1f3822[_0xe436('0x37')]:_0x2ca243['model'];if(_0x3b5d4a[_0xe436('0x32')][_0xe436('0x41')]){_0x1f3822[_0xe436('0x46')]=[{'all':!![]}];}_0x1f3822=_[_0xe436('0x3e')]({},_0x1f3822,_0x3b5d4a['options']);return db[_0xe436('0x42')]['find'](_0x1f3822)[_0xe436('0x25')](handleEntityNotFound(_0x150753,null))['then'](respondWithResult(_0x150753,null))['catch'](handleError(_0x150753,null));};exports[_0xe436('0x47')]=function(_0x5a03a5,_0x5ef9b1){return db['MailSubstatus'][_0xe436('0x47')](_0x5a03a5['body'],{})[_0xe436('0x25')](respondWithResult(_0x5ef9b1,0xc9))[_0xe436('0x45')](handleError(_0x5ef9b1,null));};exports[_0xe436('0x24')]=function(_0x3d92c3,_0x464344){if(_0x3d92c3[_0xe436('0x48')]['id']){delete _0x3d92c3[_0xe436('0x48')]['id'];}return db[_0xe436('0x42')]['find']({'where':{'id':_0x3d92c3[_0xe436('0x49')]['id']}})[_0xe436('0x25')](handleEntityNotFound(_0x464344,null))['then'](saveUpdates(_0x3d92c3[_0xe436('0x48')],null))[_0xe436('0x25')](respondWithResult(_0x464344,null))['catch'](handleError(_0x464344,null));};exports[_0xe436('0x26')]=function(_0x4c1351,_0x26b11f){return db['MailSubstatus'][_0xe436('0x4a')]({'where':{'id':_0x4c1351[_0xe436('0x49')]['id']}})['then'](handleEntityNotFound(_0x26b11f,null))['then'](removeEntity(_0x26b11f,null))[_0xe436('0x45')](handleError(_0x26b11f,null));};exports[_0xe436('0x4b')]=function(_0x12a22a,_0x3c8c0f){return db[_0xe436('0x42')][_0xe436('0x4b')]()[_0xe436('0x25')](respondWithResult(_0x3c8c0f,null))[_0xe436('0x45')](handleError(_0x3c8c0f,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index eecfcc7..67492d7 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 _0xb854=['MailSubstatus','setMaxListeners','update','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xb854,0xd0));var _0x4b85=function(_0x1bc1bc,_0x1a1722){_0x1bc1bc=_0x1bc1bc-0x0;var _0xdb4ef3=_0xb854[_0x1bc1bc];return _0xdb4ef3;};'use strict';var EventEmitter=require(_0x4b85('0x0'));var MailSubstatus=require(_0x4b85('0x1'))['db'][_0x4b85('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4b85('0x3')](0x0);var events={'afterUpdate':_0x4b85('0x4')};function emitEvent(_0x47a223){return function(_0x1b09b2,_0x557074,_0x57810b){MailSubstatusEvents['emit'](_0x47a223+':'+_0x1b09b2['id'],_0x1b09b2);MailSubstatusEvents['emit'](_0x47a223,_0x1b09b2);_0x57810b(null);};}for(var e in events){if(events[_0x4b85('0x5')](e)){var event=events[e];MailSubstatus[_0x4b85('0x6')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x1bbc=['exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x4191cd,_0x2ddcb3){var _0x3ad68c=function(_0x1712d6){while(--_0x1712d6){_0x4191cd['push'](_0x4191cd['shift']());}};_0x3ad68c(++_0x2ddcb3);}(_0x1bbc,0x174));var _0xc1bb=function(_0x212283,_0x517230){_0x212283=_0x212283-0x0;var _0x391557=_0x1bbc[_0x212283];return _0x391557;};'use strict';var EventEmitter=require(_0xc1bb('0x0'));var MailSubstatus=require(_0xc1bb('0x1'))['db'][_0xc1bb('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xc1bb('0x3')](0x0);var events={'afterUpdate':_0xc1bb('0x4')};function emitEvent(_0x18f994){return function(_0x3da3c7,_0x86f08c,_0x5dafad){MailSubstatusEvents[_0xc1bb('0x5')](_0x18f994+':'+_0x3da3c7['id'],_0x3da3c7);MailSubstatusEvents[_0xc1bb('0x5')](_0x18f994,_0x3da3c7);_0x5dafad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xc1bb('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index bd80216..271f840 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 _0x6524=['define','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues','name','then','./mailSubstatus.attributes','exports','models'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x6524,0x8c));var _0x4652=function(_0x1441ca,_0x504637){_0x1441ca=_0x1441ca-0x0;var _0x43104c=_0x6524[_0x1441ca];return _0x43104c;};'use strict';var attributes=require(_0x4652('0x0'));module[_0x4652('0x1')]=function(_0x26b775){var _0x2e4d56=_0x26b775[_0x4652('0x2')];return _0x26b775[_0x4652('0x3')]('MailSubstatus',attributes,{'tableName':_0x4652('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x21d58f,_0x27d1d3,_0x137974){return _0x2e4d56[_0x4652('0x5')][_0x4652('0x6')]({'value':_0x21d58f['name']},{'where':{'field':_0x4652('0x7'),'value':_0x21d58f[_0x4652('0x8')][_0x4652('0x9')]}})[_0x4652('0xa')](function(){_0x137974();})['catch'](function(_0x5a0d46){_0x137974(_0x5a0d46);});}}});}; \ No newline at end of file +var _0xd1b3=['MailSubstatus','mail_substatuses','Condition','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define'];(function(_0x5e81f6,_0x3b306a){var _0x27e9fb=function(_0x486aaa){while(--_0x486aaa){_0x5e81f6['push'](_0x5e81f6['shift']());}};_0x27e9fb(++_0x3b306a);}(_0xd1b3,0xef));var _0x3d1b=function(_0x49eb00,_0x5479a4){_0x49eb00=_0x49eb00-0x0;var _0x484196=_0xd1b3[_0x49eb00];return _0x484196;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x3d1b('0x0')]=function(_0x338689){var _0x1cd0ce=_0x338689[_0x3d1b('0x1')];return _0x338689[_0x3d1b('0x2')](_0x3d1b('0x3'),attributes,{'tableName':_0x3d1b('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x130e87,_0x5ab6fa,_0x5a7ad9){return _0x1cd0ce[_0x3d1b('0x5')]['update']({'value':_0x130e87[_0x3d1b('0x6')]},{'where':{'field':_0x3d1b('0x7'),'value':_0x130e87[_0x3d1b('0x8')][_0x3d1b('0x6')]}})[_0x3d1b('0x9')](function(){_0x5a7ad9();})[_0x3d1b('0xa')](function(_0x4a2f76){_0x5a7ad9(_0x4a2f76);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d9cb384..b2a83b2 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 _0x3ac2=['error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x345f64,_0x212060){var _0x175695=function(_0x45b95e){while(--_0x45b95e){_0x345f64['push'](_0x345f64['shift']());}};_0x175695(++_0x212060);}(_0x3ac2,0x10a));var _0x23ac=function(_0x1b73e5,_0x4849fa){_0x1b73e5=_0x1b73e5-0x0;var _0x18c446=_0x3ac2[_0x1b73e5];return _0x18c446;};'use strict';var _=require(_0x23ac('0x0'));var util=require(_0x23ac('0x1'));var moment=require(_0x23ac('0x2'));var BPromise=require(_0x23ac('0x3'));var rs=require(_0x23ac('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x23ac('0x5'))['db'];var utils=require(_0x23ac('0x6'));var logger=require(_0x23ac('0x7'))(_0x23ac('0x8'));var config=require(_0x23ac('0x9'));var jayson=require(_0x23ac('0xa'));var client=jayson[_0x23ac('0xb')][_0x23ac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x725026,_0x50031f,_0x4de9ed){return new BPromise(function(_0x59d38d,_0x12a28e){return client[_0x23ac('0xd')](_0x725026,_0x4de9ed)[_0x23ac('0xe')](function(_0x411103){logger[_0x23ac('0xf')](_0x23ac('0x10'),_0x50031f,'request\x20sent');logger[_0x23ac('0x11')](_0x23ac('0x12'),_0x50031f,'request\x20sent',JSON[_0x23ac('0x13')](_0x411103));if(_0x411103['error']){if(_0x411103[_0x23ac('0x14')][_0x23ac('0x15')]===0x1f4){logger[_0x23ac('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x50031f,_0x411103['error'][_0x23ac('0x16')]);return _0x12a28e(_0x411103[_0x23ac('0x14')][_0x23ac('0x16')]);}logger['error'](_0x23ac('0x10'),_0x50031f,_0x411103[_0x23ac('0x14')][_0x23ac('0x16')]);return _0x59d38d(_0x411103[_0x23ac('0x14')]['message']);}else{logger[_0x23ac('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x50031f,_0x23ac('0x17'));_0x59d38d(_0x411103[_0x23ac('0x18')][_0x23ac('0x16')]);}})[_0x23ac('0x19')](function(_0x443e49){logger[_0x23ac('0x14')](_0x23ac('0x10'),_0x50031f,_0x443e49);_0x12a28e(_0x443e49);});});} \ No newline at end of file +var _0x9ab0=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x9ab0,0x195));var _0x09ab=function(_0x2baaa1,_0x808ab6){_0x2baaa1=_0x2baaa1-0x0;var _0x6d586c=_0x9ab0[_0x2baaa1];return _0x6d586c;};'use strict';var _=require(_0x09ab('0x0'));var util=require(_0x09ab('0x1'));var moment=require(_0x09ab('0x2'));var BPromise=require(_0x09ab('0x3'));var rs=require(_0x09ab('0x4'));var fs=require('fs');var Redis=require(_0x09ab('0x5'));var db=require(_0x09ab('0x6'))['db'];var utils=require(_0x09ab('0x7'));var logger=require(_0x09ab('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x09ab('0x9')][_0x09ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x241bd1,_0x233f2a,_0x610663){return new BPromise(function(_0x464d64,_0x174a54){return client[_0x09ab('0xb')](_0x241bd1,_0x610663)[_0x09ab('0xc')](function(_0x58c23b){logger[_0x09ab('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));logger[_0x09ab('0xf')](_0x09ab('0x10'),_0x233f2a,'request\x20sent',JSON['stringify'](_0x58c23b));if(_0x58c23b[_0x09ab('0x11')]){if(_0x58c23b[_0x09ab('0x11')]['code']===0x1f4){logger['error'](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x174a54(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);return _0x464d64(_0x58c23b[_0x09ab('0x11')][_0x09ab('0x13')]);}else{logger[_0x09ab('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x233f2a,_0x09ab('0xe'));_0x464d64(_0x58c23b[_0x09ab('0x14')][_0x09ab('0x13')]);}})['catch'](function(_0x21db00){logger[_0x09ab('0x11')](_0x09ab('0x12'),_0x233f2a,_0x21db00);_0x174a54(_0x21db00);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index c7894a7..c67e09c 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 _0x2f44=['get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x36116d,_0x58be21){var _0x356bca=function(_0x3ac19e){while(--_0x3ac19e){_0x36116d['push'](_0x36116d['shift']());}};_0x356bca(++_0x58be21);}(_0x2f44,0x1d9));var _0x42f4=function(_0x9b01d9,_0x4802b0){_0x9b01d9=_0x9b01d9-0x0;var _0x401588=_0x2f44[_0x9b01d9];return _0x401588;};'use strict';var multer=require('multer');var util=require(_0x42f4('0x0'));var path=require(_0x42f4('0x1'));var timeout=require(_0x42f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42f4('0x3'));var interaction=require(_0x42f4('0x4'));var config=require(_0x42f4('0x5'));var controller=require(_0x42f4('0x6'));router[_0x42f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x42f4('0x8')]);router[_0x42f4('0x7')](_0x42f4('0x9'),auth[_0x42f4('0xa')](),controller[_0x42f4('0xb')]);router[_0x42f4('0x7')](_0x42f4('0xc'),auth[_0x42f4('0xa')](),controller['show']);router[_0x42f4('0xd')]('/',auth[_0x42f4('0xa')](),controller[_0x42f4('0xe')]);router[_0x42f4('0xf')](_0x42f4('0xc'),auth['isAuthenticated'](),controller[_0x42f4('0x10')]);router[_0x42f4('0x11')](_0x42f4('0xc'),auth['isAuthenticated'](),controller[_0x42f4('0x12')]);module[_0x42f4('0x13')]=router; \ No newline at end of file +var _0x2b06=['/describe','isAuthenticated','describe','show','post','create','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index'];(function(_0x1ff0b8,_0x4de1c6){var _0x195146=function(_0x21d673){while(--_0x21d673){_0x1ff0b8['push'](_0x1ff0b8['shift']());}};_0x195146(++_0x4de1c6);}(_0x2b06,0x81));var _0x62b0=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x2b06[_0x42ca15];return _0x1c6ded;};'use strict';var multer=require(_0x62b0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62b0('0x1'));var express=require(_0x62b0('0x2'));var router=express[_0x62b0('0x3')]();var fs_extra=require(_0x62b0('0x4'));var auth=require(_0x62b0('0x5'));var interaction=require(_0x62b0('0x6'));var config=require(_0x62b0('0x7'));var controller=require(_0x62b0('0x8'));router[_0x62b0('0x9')]('/',auth['isAuthenticated'](),controller[_0x62b0('0xa')]);router['get'](_0x62b0('0xb'),auth[_0x62b0('0xc')](),controller[_0x62b0('0xd')]);router['get']('/:id',auth[_0x62b0('0xc')](),controller[_0x62b0('0xe')]);router[_0x62b0('0xf')]('/',auth['isAuthenticated'](),controller[_0x62b0('0x10')]);router['put'](_0x62b0('0x11'),auth[_0x62b0('0xc')](),controller['update']);router['delete']('/:id',auth[_0x62b0('0xc')](),controller[_0x62b0('0x12')]);module[_0x62b0('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 9691384..34f2f9c 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4dc2f8,_0x1cce0a){var _0x2e989e=function(_0x582296){while(--_0x582296){_0x4dc2f8['push'](_0x4dc2f8['shift']());}};_0x2e989e(++_0x1cce0a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xf3cd[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x3e3879,_0x175158){var _0x5a0e7d=function(_0x2feb82){while(--_0x2feb82){_0x3e3879['push'](_0x3e3879['shift']());}};_0x5a0e7d(++_0x175158);}(_0x70e0,0x17b));var _0x070e=function(_0x1f9ce9,_0x4ac506){_0x1f9ce9=_0x1f9ce9-0x0;var _0x7e1265=_0x70e0[_0x1f9ce9];return _0x7e1265;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 0b10f1d..8f1b70e 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 _0x4c08=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','rows','catch','show','fields'];(function(_0x4d68ed,_0x211450){var _0x3a8ff4=function(_0x4ca658){while(--_0x4ca658){_0x4d68ed['push'](_0x4d68ed['shift']());}};_0x3a8ff4(++_0x211450);}(_0x4c08,0xf4));var _0x84c0=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0x4c08[_0x515afd];return _0x536d53;};'use strict';var emlformat=require(_0x84c0('0x0'));var rimraf=require(_0x84c0('0x1'));var zipdir=require(_0x84c0('0x2'));var jsonpatch=require(_0x84c0('0x3'));var rp=require(_0x84c0('0x4'));var moment=require('moment');var BPromise=require(_0x84c0('0x5'));var Mustache=require(_0x84c0('0x6'));var util=require(_0x84c0('0x7'));var path=require('path');var sox=require(_0x84c0('0x8'));var csv=require(_0x84c0('0x9'));var ejs=require(_0x84c0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84c0('0xb'));var squel=require(_0x84c0('0xc'));var crypto=require(_0x84c0('0xd'));var jsforce=require(_0x84c0('0xe'));var deskjs=require(_0x84c0('0xf'));var toCsv=require(_0x84c0('0x9'));var querystring=require(_0x84c0('0x10'));var Papa=require(_0x84c0('0x11'));var Redis=require(_0x84c0('0x12'));var authService=require(_0x84c0('0x13'));var qs=require(_0x84c0('0x14'));var as=require(_0x84c0('0x15'));var hardwareService=require(_0x84c0('0x16'));var logger=require(_0x84c0('0x17'))(_0x84c0('0x18'));var utils=require(_0x84c0('0x19'));var config=require(_0x84c0('0x1a'));var licenseUtil=require(_0x84c0('0x1b'));var db=require(_0x84c0('0x1c'))['db'];function respondWithStatusCode(_0x40cd2a,_0x356c3d){_0x356c3d=_0x356c3d||0xcc;return function(_0x17069e){if(_0x17069e){return _0x40cd2a['sendStatus'](_0x356c3d);}return _0x40cd2a[_0x84c0('0x1d')](_0x356c3d)['end']();};}function respondWithResult(_0x42c63c,_0xe5a266){_0xe5a266=_0xe5a266||0xc8;return function(_0x2a61a5){if(_0x2a61a5){return _0x42c63c[_0x84c0('0x1d')](_0xe5a266)[_0x84c0('0x1e')](_0x2a61a5);}};}function respondWithFilteredResult(_0x42f488,_0x3dc70e){return function(_0x4c8069){if(_0x4c8069){var _0x1aa953=typeof _0x3dc70e[_0x84c0('0x1f')]===_0x84c0('0x20')&&typeof _0x3dc70e['limit']===_0x84c0('0x20');var _0x3cd1b8=_0x4c8069[_0x84c0('0x21')];var _0x15210a=_0x1aa953?0x0:_0x3dc70e[_0x84c0('0x1f')];var _0x5071ef=_0x1aa953?_0x4c8069[_0x84c0('0x21')]:_0x3dc70e[_0x84c0('0x1f')]+_0x3dc70e[_0x84c0('0x22')];var _0xe37139;if(_0x5071ef>=_0x3cd1b8){_0x5071ef=_0x3cd1b8;_0xe37139=0xc8;}else{_0xe37139=0xce;}_0x42f488[_0x84c0('0x1d')](_0xe37139);return _0x42f488[_0x84c0('0x23')](_0x84c0('0x24'),_0x15210a+'-'+_0x5071ef+'/'+_0x3cd1b8)['json'](_0x4c8069);}return null;};}function patchUpdates(_0x493f80){return function(_0x17ed80){try{jsonpatch[_0x84c0('0x25')](_0x17ed80,_0x493f80,!![]);}catch(_0x3a04e1){return BPromise[_0x84c0('0x26')](_0x3a04e1);}return _0x17ed80[_0x84c0('0x27')]();};}function saveUpdates(_0x1bc08b,_0x4200ff){return function(_0x5b3b69){if(_0x5b3b69){return _0x5b3b69[_0x84c0('0x28')](_0x1bc08b)[_0x84c0('0x29')](function(_0x5e1b99){return _0x5e1b99;});}return null;};}function removeEntity(_0x1a83db,_0x35c8c9){return function(_0xf8df3b){if(_0xf8df3b){return _0xf8df3b['destroy']()[_0x84c0('0x29')](function(){_0x1a83db['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x549f75,_0x4d7414){return function(_0x282a46){if(!_0x282a46){_0x549f75['sendStatus'](0x194);}return _0x282a46;};}function handleError(_0x5bfe3d,_0x4bb543){_0x4bb543=_0x4bb543||0x1f4;return function(_0x5d0075){logger[_0x84c0('0x2a')](_0x5d0075[_0x84c0('0x2b')]);if(_0x5d0075['name']){delete _0x5d0075[_0x84c0('0x2c')];}_0x5bfe3d[_0x84c0('0x1d')](_0x4bb543)[_0x84c0('0x2d')](_0x5d0075);};}exports['index']=function(_0x5d91d3,_0x21bcfc){var _0xec91f2={},_0x3fb6db={},_0xee3523={'count':0x0,'rows':[]};var _0x3d6b71=_[_0x84c0('0x2e')](db['MailTransferReport'][_0x84c0('0x2f')],function(_0x1afe9d){return{'name':_0x1afe9d[_0x84c0('0x30')],'type':_0x1afe9d['type'][_0x84c0('0x31')]};});_0x3fb6db[_0x84c0('0x32')]=_[_0x84c0('0x2e')](_0x3d6b71,_0x84c0('0x2c'));_0x3fb6db[_0x84c0('0x33')]=_[_0x84c0('0x34')](_0x5d91d3[_0x84c0('0x33')]);_0x3fb6db[_0x84c0('0x35')]=_[_0x84c0('0x36')](_0x3fb6db[_0x84c0('0x32')],_0x3fb6db['query']);_0xec91f2[_0x84c0('0x37')]=_['intersection'](_0x3fb6db[_0x84c0('0x32')],qs['fields'](_0x5d91d3[_0x84c0('0x33')]['fields']));_0xec91f2[_0x84c0('0x37')]=_0xec91f2[_0x84c0('0x37')][_0x84c0('0x38')]?_0xec91f2['attributes']:_0x3fb6db[_0x84c0('0x32')];if(!_0x5d91d3['query'][_0x84c0('0x39')](_0x84c0('0x3a'))){_0xec91f2[_0x84c0('0x22')]=qs[_0x84c0('0x22')](_0x5d91d3[_0x84c0('0x33')][_0x84c0('0x22')]);_0xec91f2[_0x84c0('0x1f')]=qs[_0x84c0('0x1f')](_0x5d91d3[_0x84c0('0x33')][_0x84c0('0x1f')]);}_0xec91f2[_0x84c0('0x3b')]=qs[_0x84c0('0x3c')](_0x5d91d3[_0x84c0('0x33')][_0x84c0('0x3c')]);_0xec91f2[_0x84c0('0x3d')]=qs[_0x84c0('0x35')](_[_0x84c0('0x3e')](_0x5d91d3[_0x84c0('0x33')],_0x3fb6db[_0x84c0('0x35')]),_0x3d6b71);if(_0x5d91d3['query'][_0x84c0('0x3f')]){_0xec91f2[_0x84c0('0x3d')]=_[_0x84c0('0x40')](_0xec91f2[_0x84c0('0x3d')],{'$or':_[_0x84c0('0x2e')](_0x3d6b71,function(_0x4e500e){if(_0x4e500e[_0x84c0('0x41')]!==_0x84c0('0x42')){var _0xee5528={};_0xee5528[_0x4e500e['name']]={'$like':'%'+_0x5d91d3[_0x84c0('0x33')][_0x84c0('0x3f')]+'%'};return _0xee5528;}})});}_0xec91f2=_[_0x84c0('0x40')]({},_0xec91f2,_0x5d91d3[_0x84c0('0x43')]);var _0x2ca17e={'where':_0xec91f2[_0x84c0('0x3d')]};return db['MailTransferReport'][_0x84c0('0x21')](_0x2ca17e)['then'](function(_0x12435a){_0xee3523[_0x84c0('0x21')]=_0x12435a;if(_0x5d91d3[_0x84c0('0x33')][_0x84c0('0x44')]){_0xec91f2[_0x84c0('0x45')]=[{'all':!![]}];}return db[_0x84c0('0x46')][_0x84c0('0x47')](_0xec91f2);})[_0x84c0('0x29')](function(_0x2ebdd8){_0xee3523[_0x84c0('0x48')]=_0x2ebdd8;return _0xee3523;})['then'](respondWithFilteredResult(_0x21bcfc,_0xec91f2))[_0x84c0('0x49')](handleError(_0x21bcfc,null));};exports[_0x84c0('0x4a')]=function(_0x3f632f,_0xfca626){var _0x3c6f79={'raw':!![],'where':{'id':_0x3f632f['params']['id']}},_0x13e01b={};_0x13e01b[_0x84c0('0x32')]=_[_0x84c0('0x34')](db[_0x84c0('0x46')][_0x84c0('0x2f')]);_0x13e01b[_0x84c0('0x33')]=_['keys'](_0x3f632f[_0x84c0('0x33')]);_0x13e01b[_0x84c0('0x35')]=_[_0x84c0('0x36')](_0x13e01b[_0x84c0('0x32')],_0x13e01b[_0x84c0('0x33')]);_0x3c6f79[_0x84c0('0x37')]=_[_0x84c0('0x36')](_0x13e01b[_0x84c0('0x32')],qs[_0x84c0('0x4b')](_0x3f632f['query'][_0x84c0('0x4b')]));_0x3c6f79['attributes']=_0x3c6f79[_0x84c0('0x37')]['length']?_0x3c6f79[_0x84c0('0x37')]:_0x13e01b[_0x84c0('0x32')];if(_0x3f632f['query'][_0x84c0('0x44')]){_0x3c6f79[_0x84c0('0x45')]=[{'all':!![]}];}_0x3c6f79=_[_0x84c0('0x40')]({},_0x3c6f79,_0x3f632f[_0x84c0('0x43')]);return db[_0x84c0('0x46')][_0x84c0('0x4c')](_0x3c6f79)[_0x84c0('0x29')](handleEntityNotFound(_0xfca626,null))[_0x84c0('0x29')](respondWithResult(_0xfca626,null))[_0x84c0('0x49')](handleError(_0xfca626,null));};exports[_0x84c0('0x4d')]=function(_0x558d2c,_0x697ef0){return db[_0x84c0('0x46')][_0x84c0('0x4d')](_0x558d2c['body'],{})['then'](respondWithResult(_0x697ef0,0xc9))[_0x84c0('0x49')](handleError(_0x697ef0,null));};exports[_0x84c0('0x28')]=function(_0x49d909,_0x7446bc){if(_0x49d909['body']['id']){delete _0x49d909[_0x84c0('0x4e')]['id'];}return db[_0x84c0('0x46')]['find']({'where':{'id':_0x49d909['params']['id']}})['then'](handleEntityNotFound(_0x7446bc,null))['then'](saveUpdates(_0x49d909[_0x84c0('0x4e')],null))[_0x84c0('0x29')](respondWithResult(_0x7446bc,null))[_0x84c0('0x49')](handleError(_0x7446bc,null));};exports['destroy']=function(_0x5af909,_0x2485f8){return db[_0x84c0('0x46')][_0x84c0('0x4c')]({'where':{'id':_0x5af909['params']['id']}})[_0x84c0('0x29')](handleEntityNotFound(_0x2485f8,null))[_0x84c0('0x29')](removeEntity(_0x2485f8,null))[_0x84c0('0x49')](handleError(_0x2485f8,null));};exports[_0x84c0('0x4f')]=function(_0x33ea44,_0x25cdc9){return db['MailTransferReport']['describe']()[_0x84c0('0x29')](respondWithResult(_0x25cdc9,null))[_0x84c0('0x49')](handleError(_0x25cdc9,null));}; \ No newline at end of file +var _0x38e9=['status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailTransferReport','fieldName','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','keys','rawAttributes','length','includeAll','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','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/license/util','../../mysqldb'];(function(_0xefc8f1,_0x3070dc){var _0x47673b=function(_0x31c821){while(--_0x31c821){_0xefc8f1['push'](_0xefc8f1['shift']());}};_0x47673b(++_0x3070dc);}(_0x38e9,0x183));var _0x938e=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0x38e9[_0x1034ee];return _0x2922af;};'use strict';var emlformat=require(_0x938e('0x0'));var rimraf=require(_0x938e('0x1'));var zipdir=require(_0x938e('0x2'));var jsonpatch=require(_0x938e('0x3'));var rp=require(_0x938e('0x4'));var moment=require(_0x938e('0x5'));var BPromise=require(_0x938e('0x6'));var Mustache=require(_0x938e('0x7'));var util=require(_0x938e('0x8'));var path=require(_0x938e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x938e('0xa'));var fs=require('fs');var fs_extra=require(_0x938e('0xb'));var _=require(_0x938e('0xc'));var squel=require(_0x938e('0xd'));var crypto=require('crypto');var jsforce=require(_0x938e('0xe'));var deskjs=require(_0x938e('0xf'));var toCsv=require(_0x938e('0x10'));var querystring=require(_0x938e('0x11'));var Papa=require(_0x938e('0x12'));var Redis=require(_0x938e('0x13'));var authService=require(_0x938e('0x14'));var qs=require(_0x938e('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x938e('0x16'));var logger=require(_0x938e('0x17'))(_0x938e('0x18'));var utils=require(_0x938e('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x938e('0x1a'));var db=require(_0x938e('0x1b'))['db'];function respondWithStatusCode(_0x1ddfc3,_0x3ada18){_0x3ada18=_0x3ada18||0xcc;return function(_0x44ce84){if(_0x44ce84){return _0x1ddfc3['sendStatus'](_0x3ada18);}return _0x1ddfc3[_0x938e('0x1c')](_0x3ada18)[_0x938e('0x1d')]();};}function respondWithResult(_0x39999c,_0x3afe53){_0x3afe53=_0x3afe53||0xc8;return function(_0x9c5959){if(_0x9c5959){return _0x39999c['status'](_0x3afe53)[_0x938e('0x1e')](_0x9c5959);}};}function respondWithFilteredResult(_0x63c062,_0x5e7188){return function(_0x448d59){if(_0x448d59){var _0x20b48e=typeof _0x5e7188[_0x938e('0x1f')]==='undefined'&&typeof _0x5e7188['limit']===_0x938e('0x20');var _0x190e97=_0x448d59['count'];var _0x3e2709=_0x20b48e?0x0:_0x5e7188[_0x938e('0x1f')];var _0x2e286a=_0x20b48e?_0x448d59[_0x938e('0x21')]:_0x5e7188[_0x938e('0x1f')]+_0x5e7188['limit'];var _0x2f17a8;if(_0x2e286a>=_0x190e97){_0x2e286a=_0x190e97;_0x2f17a8=0xc8;}else{_0x2f17a8=0xce;}_0x63c062['status'](_0x2f17a8);return _0x63c062[_0x938e('0x22')](_0x938e('0x23'),_0x3e2709+'-'+_0x2e286a+'/'+_0x190e97)[_0x938e('0x1e')](_0x448d59);}return null;};}function patchUpdates(_0x433c90){return function(_0x150b70){try{jsonpatch[_0x938e('0x24')](_0x150b70,_0x433c90,!![]);}catch(_0x34b76d){return BPromise[_0x938e('0x25')](_0x34b76d);}return _0x150b70[_0x938e('0x26')]();};}function saveUpdates(_0x57f6c9,_0x459065){return function(_0x289e8f){if(_0x289e8f){return _0x289e8f[_0x938e('0x27')](_0x57f6c9)[_0x938e('0x28')](function(_0x1c48cf){return _0x1c48cf;});}return null;};}function removeEntity(_0x53af81,_0x254505){return function(_0x31f677){if(_0x31f677){return _0x31f677[_0x938e('0x29')]()[_0x938e('0x28')](function(){_0x53af81[_0x938e('0x1c')](0xcc)[_0x938e('0x1d')]();});}};}function handleEntityNotFound(_0x47cbdf,_0x465e85){return function(_0x40ef52){if(!_0x40ef52){_0x47cbdf[_0x938e('0x2a')](0x194);}return _0x40ef52;};}function handleError(_0x89100e,_0x2d8899){_0x2d8899=_0x2d8899||0x1f4;return function(_0xa2e3ce){logger[_0x938e('0x2b')](_0xa2e3ce[_0x938e('0x2c')]);if(_0xa2e3ce[_0x938e('0x2d')]){delete _0xa2e3ce['name'];}_0x89100e[_0x938e('0x1c')](_0x2d8899)[_0x938e('0x2e')](_0xa2e3ce);};}exports[_0x938e('0x2f')]=function(_0x32c1e5,_0x2b444b){var _0x1be839={},_0x6cf036={},_0x5ae67e={'count':0x0,'rows':[]};var _0x54a275=_[_0x938e('0x30')](db[_0x938e('0x31')]['rawAttributes'],function(_0x494119){return{'name':_0x494119[_0x938e('0x32')],'type':_0x494119['type'][_0x938e('0x33')]};});_0x6cf036[_0x938e('0x34')]=_[_0x938e('0x30')](_0x54a275,_0x938e('0x2d'));_0x6cf036[_0x938e('0x35')]=_['keys'](_0x32c1e5[_0x938e('0x35')]);_0x6cf036[_0x938e('0x36')]=_['intersection'](_0x6cf036['model'],_0x6cf036[_0x938e('0x35')]);_0x1be839[_0x938e('0x37')]=_[_0x938e('0x38')](_0x6cf036[_0x938e('0x34')],qs[_0x938e('0x39')](_0x32c1e5[_0x938e('0x35')][_0x938e('0x39')]));_0x1be839[_0x938e('0x37')]=_0x1be839[_0x938e('0x37')]['length']?_0x1be839[_0x938e('0x37')]:_0x6cf036['model'];if(!_0x32c1e5[_0x938e('0x35')][_0x938e('0x3a')](_0x938e('0x3b'))){_0x1be839['limit']=qs[_0x938e('0x3c')](_0x32c1e5[_0x938e('0x35')]['limit']);_0x1be839['offset']=qs['offset'](_0x32c1e5['query'][_0x938e('0x1f')]);}_0x1be839[_0x938e('0x3d')]=qs['sort'](_0x32c1e5[_0x938e('0x35')][_0x938e('0x3e')]);_0x1be839[_0x938e('0x3f')]=qs[_0x938e('0x36')](_[_0x938e('0x40')](_0x32c1e5['query'],_0x6cf036[_0x938e('0x36')]),_0x54a275);if(_0x32c1e5[_0x938e('0x35')][_0x938e('0x41')]){_0x1be839[_0x938e('0x3f')]=_[_0x938e('0x42')](_0x1be839[_0x938e('0x3f')],{'$or':_['map'](_0x54a275,function(_0x58448c){if(_0x58448c[_0x938e('0x43')]!==_0x938e('0x44')){var _0x42850a={};_0x42850a[_0x58448c[_0x938e('0x2d')]]={'$like':'%'+_0x32c1e5[_0x938e('0x35')][_0x938e('0x41')]+'%'};return _0x42850a;}})});}_0x1be839=_[_0x938e('0x42')]({},_0x1be839,_0x32c1e5[_0x938e('0x45')]);var _0x409542={'where':_0x1be839[_0x938e('0x3f')]};return db['MailTransferReport'][_0x938e('0x21')](_0x409542)[_0x938e('0x28')](function(_0x1d4cfe){_0x5ae67e['count']=_0x1d4cfe;if(_0x32c1e5[_0x938e('0x35')]['includeAll']){_0x1be839[_0x938e('0x46')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x1be839);})[_0x938e('0x28')](function(_0x22bf82){_0x5ae67e[_0x938e('0x47')]=_0x22bf82;return _0x5ae67e;})[_0x938e('0x28')](respondWithFilteredResult(_0x2b444b,_0x1be839))[_0x938e('0x48')](handleError(_0x2b444b,null));};exports[_0x938e('0x49')]=function(_0x40e694,_0x40ddd7){var _0x5e0f44={'raw':!![],'where':{'id':_0x40e694[_0x938e('0x4a')]['id']}},_0x43f283={};_0x43f283['model']=_[_0x938e('0x4b')](db[_0x938e('0x31')][_0x938e('0x4c')]);_0x43f283[_0x938e('0x35')]=_['keys'](_0x40e694[_0x938e('0x35')]);_0x43f283[_0x938e('0x36')]=_['intersection'](_0x43f283[_0x938e('0x34')],_0x43f283[_0x938e('0x35')]);_0x5e0f44[_0x938e('0x37')]=_[_0x938e('0x38')](_0x43f283[_0x938e('0x34')],qs[_0x938e('0x39')](_0x40e694[_0x938e('0x35')]['fields']));_0x5e0f44[_0x938e('0x37')]=_0x5e0f44[_0x938e('0x37')][_0x938e('0x4d')]?_0x5e0f44[_0x938e('0x37')]:_0x43f283[_0x938e('0x34')];if(_0x40e694[_0x938e('0x35')][_0x938e('0x4e')]){_0x5e0f44['include']=[{'all':!![]}];}_0x5e0f44=_[_0x938e('0x42')]({},_0x5e0f44,_0x40e694[_0x938e('0x45')]);return db[_0x938e('0x31')]['find'](_0x5e0f44)['then'](handleEntityNotFound(_0x40ddd7,null))[_0x938e('0x28')](respondWithResult(_0x40ddd7,null))[_0x938e('0x48')](handleError(_0x40ddd7,null));};exports[_0x938e('0x4f')]=function(_0x4d545b,_0x58e17d){return db[_0x938e('0x31')][_0x938e('0x4f')](_0x4d545b[_0x938e('0x50')],{})['then'](respondWithResult(_0x58e17d,0xc9))[_0x938e('0x48')](handleError(_0x58e17d,null));};exports[_0x938e('0x27')]=function(_0x3dc34b,_0xc1fbe4){if(_0x3dc34b['body']['id']){delete _0x3dc34b['body']['id'];}return db[_0x938e('0x31')][_0x938e('0x51')]({'where':{'id':_0x3dc34b[_0x938e('0x4a')]['id']}})[_0x938e('0x28')](handleEntityNotFound(_0xc1fbe4,null))[_0x938e('0x28')](saveUpdates(_0x3dc34b[_0x938e('0x50')],null))[_0x938e('0x28')](respondWithResult(_0xc1fbe4,null))[_0x938e('0x48')](handleError(_0xc1fbe4,null));};exports[_0x938e('0x29')]=function(_0x248c33,_0x57e904){return db[_0x938e('0x31')]['find']({'where':{'id':_0x248c33[_0x938e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x57e904,null))[_0x938e('0x28')](removeEntity(_0x57e904,null))[_0x938e('0x48')](handleError(_0x57e904,null));};exports['describe']=function(_0x1386e4,_0x313e08){return db[_0x938e('0x31')][_0x938e('0x52')]()[_0x938e('0x28')](respondWithResult(_0x313e08,null))['catch'](handleError(_0x313e08,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 3673448..ffe0214 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 _0x2bd6=['moment','request-promise','path','rimraf','./mailTransferReport.attributes','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0xccfb69,_0xdfb7c5){var _0x4e8eaa=function(_0x4f4bfa){while(--_0x4f4bfa){_0xccfb69['push'](_0xccfb69['shift']());}};_0x4e8eaa(++_0xdfb7c5);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x5e9876,_0x16052d){_0x5e9876=_0x5e9876-0x0;var _0x576c48=_0x2bd6[_0x5e9876];return _0x576c48;};'use strict';var _=require(_0x62bd('0x0'));var util=require(_0x62bd('0x1'));var logger=require(_0x62bd('0x2'))(_0x62bd('0x3'));var moment=require(_0x62bd('0x4'));var BPromise=require('bluebird');var rp=require(_0x62bd('0x5'));var fs=require('fs');var path=require(_0x62bd('0x6'));var rimraf=require(_0x62bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x62bd('0x8'));module['exports']=function(_0x4b8aa7,_0x3c267e){return _0x4b8aa7[_0x62bd('0x9')]('MailTransferReport',attributes,{'tableName':_0x62bd('0xa'),'paranoid':![],'indexes':[{'name':_0x62bd('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfda=['exports','MailTransferReport','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x5d1000,_0x17500d){var _0x1337fa=function(_0x26f8ea){while(--_0x26f8ea){_0x5d1000['push'](_0x5d1000['shift']());}};_0x1337fa(++_0x17500d);}(_0xbfda,0x1dc));var _0xabfd=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xbfda[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require(_0xabfd('0x0'));var util=require(_0xabfd('0x1'));var logger=require(_0xabfd('0x2'))('api');var moment=require(_0xabfd('0x3'));var BPromise=require('bluebird');var rp=require(_0xabfd('0x4'));var fs=require('fs');var path=require(_0xabfd('0x5'));var rimraf=require(_0xabfd('0x6'));var config=require(_0xabfd('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0xabfd('0x8')]=function(_0x4c306b,_0x1dbf70){return _0x4c306b['define'](_0xabfd('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xabfd('0xa'),'fields':[_0xabfd('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9d6dd34..cd49089 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 _0x6c89=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x6c89,0x1e8));var _0x96c8=function(_0x9046e9,_0x451c7e){_0x9046e9=_0x9046e9-0x0;var _0x105364=_0x6c89[_0x9046e9];return _0x105364;};'use strict';var _=require(_0x96c8('0x0'));var util=require(_0x96c8('0x1'));var moment=require(_0x96c8('0x2'));var BPromise=require(_0x96c8('0x3'));var rs=require(_0x96c8('0x4'));var fs=require('fs');var Redis=require(_0x96c8('0x5'));var db=require(_0x96c8('0x6'))['db'];var utils=require(_0x96c8('0x7'));var logger=require(_0x96c8('0x8'))('rpc');var config=require(_0x96c8('0x9'));var jayson=require(_0x96c8('0xa'));var client=jayson['client'][_0x96c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe5d550,_0x2919f8,_0x567946){return new BPromise(function(_0x18ef7e,_0x1c958e){return client['request'](_0xe5d550,_0x567946)[_0x96c8('0xc')](function(_0x5cb21a){logger[_0x96c8('0xd')](_0x96c8('0xe'),_0x2919f8,_0x96c8('0xf'));logger[_0x96c8('0x10')](_0x96c8('0x11'),_0x2919f8,_0x96c8('0xf'),JSON['stringify'](_0x5cb21a));if(_0x5cb21a[_0x96c8('0x12')]){if(_0x5cb21a[_0x96c8('0x12')][_0x96c8('0x13')]===0x1f4){logger[_0x96c8('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x2919f8,_0x5cb21a[_0x96c8('0x12')][_0x96c8('0x14')]);return _0x1c958e(_0x5cb21a[_0x96c8('0x12')][_0x96c8('0x14')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2919f8,_0x5cb21a[_0x96c8('0x12')]['message']);return _0x18ef7e(_0x5cb21a['error'][_0x96c8('0x14')]);}else{logger[_0x96c8('0xd')](_0x96c8('0xe'),_0x2919f8,'request\x20sent');_0x18ef7e(_0x5cb21a[_0x96c8('0x15')]['message']);}})[_0x96c8('0x16')](function(_0x3b39a3){logger[_0x96c8('0x12')](_0x96c8('0xe'),_0x2919f8,_0x3b39a3);_0x1c958e(_0x3b39a3);});});} \ No newline at end of file +var _0xb816=['request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x204e08,_0x36ca59){var _0x4dd55e=function(_0x57a456){while(--_0x57a456){_0x204e08['push'](_0x204e08['shift']());}};_0x4dd55e(++_0x36ca59);}(_0xb816,0x89));var _0x6b81=function(_0x20f984,_0x20eb53){_0x20f984=_0x20f984-0x0;var _0x562228=_0xb816[_0x20f984];return _0x562228;};'use strict';var _=require(_0x6b81('0x0'));var util=require('util');var moment=require(_0x6b81('0x1'));var BPromise=require(_0x6b81('0x2'));var rs=require(_0x6b81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6b81('0x4'));var logger=require(_0x6b81('0x5'))(_0x6b81('0x6'));var config=require(_0x6b81('0x7'));var jayson=require(_0x6b81('0x8'));var client=jayson[_0x6b81('0x9')][_0x6b81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c0ea5,_0x3fa54d,_0x6d2088){return new BPromise(function(_0x1b70bc,_0x3b87b3){return client[_0x6b81('0xb')](_0x4c0ea5,_0x6d2088)[_0x6b81('0xc')](function(_0x22a2a3){logger[_0x6b81('0xd')](_0x6b81('0xe'),_0x3fa54d,'request\x20sent');logger[_0x6b81('0xf')](_0x6b81('0x10'),_0x3fa54d,_0x6b81('0x11'),JSON['stringify'](_0x22a2a3));if(_0x22a2a3[_0x6b81('0x12')]){if(_0x22a2a3[_0x6b81('0x12')][_0x6b81('0x13')]===0x1f4){logger[_0x6b81('0x12')](_0x6b81('0xe'),_0x3fa54d,_0x22a2a3['error'][_0x6b81('0x14')]);return _0x3b87b3(_0x22a2a3[_0x6b81('0x12')][_0x6b81('0x14')]);}logger[_0x6b81('0x12')](_0x6b81('0xe'),_0x3fa54d,_0x22a2a3[_0x6b81('0x12')][_0x6b81('0x14')]);return _0x1b70bc(_0x22a2a3[_0x6b81('0x12')]['message']);}else{logger['info'](_0x6b81('0xe'),_0x3fa54d,'request\x20sent');_0x1b70bc(_0x22a2a3[_0x6b81('0x15')][_0x6b81('0x14')]);}})['catch'](function(_0x56d12b){logger[_0x6b81('0x12')](_0x6b81('0xe'),_0x3fa54d,_0x56d12b);_0x3b87b3(_0x56d12b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 1d8e6ee..fd45aa5 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 _0x9e33=['create','put','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9e33,0x1d4));var _0x39e3=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x9e33[_0x1da04e];return _0xdd8c41;};'use strict';var multer=require(_0x39e3('0x0'));var util=require(_0x39e3('0x1'));var path=require('path');var timeout=require(_0x39e3('0x2'));var express=require(_0x39e3('0x3'));var router=express[_0x39e3('0x4')]();var fs_extra=require(_0x39e3('0x5'));var auth=require(_0x39e3('0x6'));var interaction=require(_0x39e3('0x7'));var config=require('../../config/environment');var controller=require(_0x39e3('0x8'));router[_0x39e3('0x9')]('/',auth[_0x39e3('0xa')](),controller[_0x39e3('0xb')]);router[_0x39e3('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x39e3('0xc')]);router[_0x39e3('0x9')]('/:id',auth[_0x39e3('0xa')](),controller[_0x39e3('0xd')]);router[_0x39e3('0xe')]('/',auth[_0x39e3('0xa')](),controller[_0x39e3('0xf')]);router[_0x39e3('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x39e3('0x11')](_0x39e3('0x12'),auth[_0x39e3('0xa')](),controller[_0x39e3('0x13')]);module[_0x39e3('0x14')]=router; \ No newline at end of file +var _0xd964=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports','multer'];(function(_0x431355,_0x4dc704){var _0x5eed0f=function(_0x46e7f1){while(--_0x46e7f1){_0x431355['push'](_0x431355['shift']());}};_0x5eed0f(++_0x4dc704);}(_0xd964,0x167));var _0x4d96=function(_0x1066c9,_0x1724db){_0x1066c9=_0x1066c9-0x0;var _0x9e98b3=_0xd964[_0x1066c9];return _0x9e98b3;};'use strict';var multer=require(_0x4d96('0x0'));var util=require('util');var path=require(_0x4d96('0x1'));var timeout=require('connect-timeout');var express=require(_0x4d96('0x2'));var router=express[_0x4d96('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d96('0x4'));var interaction=require(_0x4d96('0x5'));var config=require(_0x4d96('0x6'));var controller=require(_0x4d96('0x7'));router[_0x4d96('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d96('0x9')]);router['get'](_0x4d96('0xa'),auth[_0x4d96('0xb')](),controller[_0x4d96('0xc')]);router['get']('/:id',auth[_0x4d96('0xb')](),controller['show']);router[_0x4d96('0xd')]('/',auth[_0x4d96('0xb')](),controller[_0x4d96('0xe')]);router[_0x4d96('0xf')](_0x4d96('0x10'),auth['isAuthenticated'](),controller[_0x4d96('0x11')]);router['delete'](_0x4d96('0x10'),auth[_0x4d96('0xb')](),controller[_0x4d96('0x12')]);module[_0x4d96('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 76c3be8..c3ade63 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 _0x9b75=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','diff','seconds','setDataValue'];(function(_0x3654d8,_0x3037f6){var _0x21a69d=function(_0x5ec221){while(--_0x5ec221){_0x3654d8['push'](_0x3654d8['shift']());}};_0x21a69d(++_0x3037f6);}(_0x9b75,0x6f));var _0x59b7=function(_0x5af942,_0x52c89a){_0x5af942=_0x5af942-0x0;var _0x306074=_0x9b75[_0x5af942];return _0x306074;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x59b7('0x0'));module['exports']={'channel':{'type':Sequelize[_0x59b7('0x1')]},'membername':{'type':Sequelize[_0x59b7('0x1')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x59b7('0x2'),'comment':_0x59b7('0x3')},'duration':{'type':Sequelize[_0x59b7('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x59b7('0x5')],'set':function(_0xd4e1d6){var _0x4e68d7=moment(_0xd4e1d6);var _0x29159f=moment(this['getDataValue']('enterAt'));var _0x57397b=_0x4e68d7[_0x59b7('0x6')](_0x29159f,_0x59b7('0x7'));this[_0x59b7('0x8')](_0x59b7('0x9'),_0xd4e1d6);this[_0x59b7('0x8')](_0x59b7('0xa'),_0x57397b>=0x0?_0x57397b:null);}},'data1':{'type':Sequelize[_0x59b7('0x1')],'comment':_0x59b7('0xb')},'data2':{'type':Sequelize[_0x59b7('0x1')],'comment':_0x59b7('0xc')},'data3':{'type':Sequelize[_0x59b7('0x1')],'comment':_0x59b7('0xd')},'data4':{'type':Sequelize[_0x59b7('0x1')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x59b7('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x59b7('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa929=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa929,0xf3));var _0x9a92=function(_0x5a84d7,_0x53d3db){_0x5a84d7=_0x5a84d7-0x0;var _0x4d3c56=_0xa929[_0x5a84d7];return _0x4d3c56;};'use strict';var Sequelize=require(_0x9a92('0x0'));var moment=require(_0x9a92('0x1'));module[_0x9a92('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x9a92('0x3')]},'type':{'type':Sequelize[_0x9a92('0x3')],'defaultValue':_0x9a92('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x9a92('0x5')]},'enterAt':{'type':Sequelize[_0x9a92('0x6')]},'exitAt':{'type':Sequelize[_0x9a92('0x6')],'set':function(_0x5acecd){var _0x3c3f2d=moment(_0x5acecd);var _0x3d17ce=moment(this[_0x9a92('0x7')]('enterAt'));var _0x4e411a=_0x3c3f2d[_0x9a92('0x8')](_0x3d17ce,_0x9a92('0x9'));this['setDataValue'](_0x9a92('0xa'),_0x5acecd);this[_0x9a92('0xb')](_0x9a92('0xc'),_0x4e411a>=0x0?_0x4e411a:null);}},'data1':{'type':Sequelize[_0x9a92('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9a92('0x3')],'comment':_0x9a92('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x9a92('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x9a92('0xf')},'data5':{'type':Sequelize[_0x9a92('0x3')],'comment':_0x9a92('0x10')},'role':{'type':Sequelize[_0x9a92('0x3')]},'internal':{'type':Sequelize[_0x9a92('0x5')]},'uniqueid':{'type':Sequelize[_0x9a92('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b9d1814..85c8b1e 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 _0x008c=['destroy','sendStatus','send','index','MemberReport','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then'];(function(_0x5cc3cb,_0x414dd0){var _0x3ced47=function(_0x567767){while(--_0x567767){_0x5cc3cb['push'](_0x5cc3cb['shift']());}};_0x3ced47(++_0x414dd0);}(_0x008c,0x188));var _0xc008=function(_0x883d31,_0x50f7d0){_0x883d31=_0x883d31-0x0;var _0x4201bb=_0x008c[_0x883d31];return _0x4201bb;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_0x2a7d4f,_0xc008('0x2b'));_0x32390d[_0xc008('0x2c')]=_[_0xc008('0x2d')](_0x25eae4[_0xc008('0x2c')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x32390d[_0xc008('0x29')],_0x32390d[_0xc008('0x2c')]);_0x24c14c[_0xc008('0x30')]=_['intersection'](_0x32390d[_0xc008('0x29')],qs[_0xc008('0x31')](_0x25eae4['query'][_0xc008('0x31')]));_0x24c14c[_0xc008('0x30')]=_0x24c14c[_0xc008('0x30')][_0xc008('0x32')]?_0x24c14c[_0xc008('0x30')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2c')][_0xc008('0x33')](_0xc008('0x34'))){_0x24c14c['limit']=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4[_0xc008('0x2c')][_0xc008('0x1b')]);}_0x24c14c['order']=qs[_0xc008('0x35')](_0x25eae4[_0xc008('0x2c')]['sort']);_0x24c14c[_0xc008('0x36')]=qs[_0xc008('0x2e')](_['pick'](_0x25eae4[_0xc008('0x2c')],_0x32390d[_0xc008('0x2e')]),_0x2a7d4f);if(_0x25eae4[_0xc008('0x2c')]['filter']){_0x24c14c['where']=_['merge'](_0x24c14c[_0xc008('0x36')],{'$or':_['map'](_0x2a7d4f,function(_0x3dd0ac){if(_0x3dd0ac[_0xc008('0x37')]!==_0xc008('0x38')){var _0x440459={};_0x440459[_0x3dd0ac[_0xc008('0x2b')]]={'$like':'%'+_0x25eae4[_0xc008('0x2c')][_0xc008('0x39')]+'%'};return _0x440459;}})});}_0x24c14c=_[_0xc008('0x3a')]({},_0x24c14c,_0x25eae4[_0xc008('0x3b')]);var _0x387dfd={'where':_0x24c14c[_0xc008('0x36')]};return db[_0xc008('0x26')][_0xc008('0x1e')](_0x387dfd)[_0xc008('0x21')](function(_0x4cace5){_0x209591[_0xc008('0x1e')]=_0x4cace5;if(_0x25eae4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x24c14c[_0xc008('0x3d')]=[{'all':!![]}];}return db['MemberReport'][_0xc008('0x3e')](_0x24c14c);})[_0xc008('0x21')](function(_0xc8cb91){_0x209591[_0xc008('0x3f')]=_0xc8cb91;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))['catch'](handleError(_0x529961,null));};exports[_0xc008('0x40')]=function(_0x3323f4,_0x3794b0){var _0x3e9a99={'raw':!![],'where':{'id':_0x3323f4['params']['id']}},_0x7279e8={};_0x7279e8[_0xc008('0x29')]=_[_0xc008('0x2d')](db[_0xc008('0x26')][_0xc008('0x27')]);_0x7279e8['query']=_[_0xc008('0x2d')](_0x3323f4[_0xc008('0x2c')]);_0x7279e8[_0xc008('0x2e')]=_['intersection'](_0x7279e8[_0xc008('0x29')],_0x7279e8['query']);_0x3e9a99[_0xc008('0x30')]=_['intersection'](_0x7279e8[_0xc008('0x29')],qs[_0xc008('0x31')](_0x3323f4['query'][_0xc008('0x31')]));_0x3e9a99[_0xc008('0x30')]=_0x3e9a99[_0xc008('0x30')]['length']?_0x3e9a99[_0xc008('0x30')]:_0x7279e8[_0xc008('0x29')];if(_0x3323f4[_0xc008('0x2c')][_0xc008('0x3c')]){_0x3e9a99[_0xc008('0x3d')]=[{'all':!![]}];}_0x3e9a99=_[_0xc008('0x3a')]({},_0x3e9a99,_0x3323f4['options']);return db['MemberReport']['find'](_0x3e9a99)[_0xc008('0x21')](handleEntityNotFound(_0x3794b0,null))[_0xc008('0x21')](respondWithResult(_0x3794b0,null))[_0xc008('0x41')](handleError(_0x3794b0,null));};exports[_0xc008('0x42')]=function(_0x25289f,_0x24f6a4){return db[_0xc008('0x26')][_0xc008('0x42')](_0x25289f['body'],{})['then'](respondWithResult(_0x24f6a4,0xc9))['catch'](handleError(_0x24f6a4,null));};exports[_0xc008('0x20')]=function(_0x2651cf,_0x158eae){if(_0x2651cf['body']['id']){delete _0x2651cf[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x44')]({'where':{'id':_0x2651cf[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x158eae,null))[_0xc008('0x21')](saveUpdates(_0x2651cf[_0xc008('0x43')],null))[_0xc008('0x21')](respondWithResult(_0x158eae,null))[_0xc008('0x41')](handleError(_0x158eae,null));};exports[_0xc008('0x22')]=function(_0x52c444,_0x4c63d4){return db[_0xc008('0x26')]['find']({'where':{'id':_0x52c444[_0xc008('0x45')]['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x4c63d4,null))[_0xc008('0x21')](removeEntity(_0x4c63d4,null))['catch'](handleError(_0x4c63d4,null));};exports[_0xc008('0x46')]=function(_0x32b435,_0xee64){return db[_0xc008('0x26')][_0xc008('0x46')]()['then'](respondWithResult(_0xee64,null))[_0xc008('0x41')](handleError(_0xee64,null));}; \ No newline at end of file +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(_0x55a428,_0xbbd111){var _0x487b98=function(_0x3e82d8){while(--_0x3e82d8){_0x55a428['push'](_0x55a428['shift']());}};_0x487b98(++_0xbbd111);}(_0x7217,0x19e));var _0x7721=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x7217[_0x102e37];return _0x35a07c;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index cd11ec9..6e7a54f 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 _0xb7a6=['report_member','membername_interface','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb7a6,0x66));var _0x6b7a=function(_0x15714f,_0x518184){_0x15714f=_0x15714f-0x0;var _0x2a8ba5=_0xb7a6[_0x15714f];return _0x2a8ba5;};'use strict';var _=require(_0x6b7a('0x0'));var util=require(_0x6b7a('0x1'));var logger=require('../../config/logger')(_0x6b7a('0x2'));var moment=require(_0x6b7a('0x3'));var BPromise=require(_0x6b7a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6b7a('0x5'));var config=require(_0x6b7a('0x6'));var attributes=require(_0x6b7a('0x7'));module['exports']=function(_0x5df617,_0x122521){return _0x5df617['define']('MemberReport',attributes,{'tableName':_0x6b7a('0x8'),'paranoid':![],'indexes':[{'name':_0x6b7a('0x9'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2713=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','lodash','util','../../config/logger','api'];(function(_0x1fc36a,_0x3a7299){var _0x1a993b=function(_0x342fe3){while(--_0x342fe3){_0x1fc36a['push'](_0x1fc36a['shift']());}};_0x1a993b(++_0x3a7299);}(_0x2713,0x164));var _0x3271=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2713[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var logger=require(_0x3271('0x2'))(_0x3271('0x3'));var moment=require(_0x3271('0x4'));var BPromise=require(_0x3271('0x5'));var rp=require(_0x3271('0x6'));var fs=require('fs');var path=require(_0x3271('0x7'));var rimraf=require(_0x3271('0x8'));var config=require(_0x3271('0x9'));var attributes=require(_0x3271('0xa'));module[_0x3271('0xb')]=function(_0x3cbb91,_0x54acf0){return _0x3cbb91[_0x3271('0xc')](_0x3271('0xd'),attributes,{'tableName':_0x3271('0xe'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ddc971b..c34c77a 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 _0x6363=['then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','message','result','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map','model','stringify','catch','CreateMemberReport','create','body','UpdateMemberReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2a7c65,_0x2b4e00){var _0x172edf=function(_0x43f723){while(--_0x43f723){_0x2a7c65['push'](_0x2a7c65['shift']());}};_0x172edf(++_0x2b4e00);}(_0x6363,0x13a));var _0x3636=function(_0x48bda3,_0x54518b){_0x48bda3=_0x48bda3-0x0;var _0x1ffa0b=_0x6363[_0x48bda3];return _0x1ffa0b;};'use strict';var _=require(_0x3636('0x0'));var util=require('util');var moment=require(_0x3636('0x1'));var BPromise=require(_0x3636('0x2'));var rs=require(_0x3636('0x3'));var fs=require('fs');var Redis=require(_0x3636('0x4'));var db=require(_0x3636('0x5'))['db'];var utils=require(_0x3636('0x6'));var logger=require(_0x3636('0x7'))(_0x3636('0x8'));var config=require(_0x3636('0x9'));var jayson=require(_0x3636('0xa'));var client=jayson[_0x3636('0xb')][_0x3636('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xdc928c,_0x17b2a4,_0x583dec){return new BPromise(function(_0x19f917,_0x47f84e){return client[_0x3636('0xd')](_0xdc928c,_0x583dec)[_0x3636('0xe')](function(_0x23869b){logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));logger[_0x3636('0x12')](_0x3636('0x13'),_0x17b2a4,_0x3636('0x11'),JSON['stringify'](_0x23869b));if(_0x23869b['error']){if(_0x23869b[_0x3636('0x14')]['code']===0x1f4){logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x47f84e(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}logger[_0x3636('0x14')](_0x3636('0x10'),_0x17b2a4,_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);return _0x19f917(_0x23869b[_0x3636('0x14')][_0x3636('0x15')]);}else{logger[_0x3636('0xf')](_0x3636('0x10'),_0x17b2a4,_0x3636('0x11'));_0x19f917(_0x23869b[_0x3636('0x16')][_0x3636('0x15')]);}})['catch'](function(_0x11b53e){logger[_0x3636('0x14')]('MemberReport,\x20%s,\x20%s',_0x17b2a4,_0x11b53e);_0x47f84e(_0x11b53e);});});}exports[_0x3636('0x17')]=function(_0x5aa0ff){var _0x5e85f2=this;return new Promise(function(_0xae6469,_0x337e3d){return db[_0x3636('0x18')][_0x3636('0x19')]({'raw':_0x5aa0ff[_0x3636('0x1a')]?_0x5aa0ff[_0x3636('0x1a')][_0x3636('0x1b')]===undefined?!![]:![]:!![],'where':_0x5aa0ff[_0x3636('0x1a')]?_0x5aa0ff['options']['where']||null:null,'attributes':_0x5aa0ff[_0x3636('0x1a')]?_0x5aa0ff[_0x3636('0x1a')][_0x3636('0x1c')]||null:null,'limit':_0x5aa0ff['options']?_0x5aa0ff[_0x3636('0x1a')][_0x3636('0x1d')]||null:null,'include':_0x5aa0ff[_0x3636('0x1a')]?_0x5aa0ff[_0x3636('0x1a')][_0x3636('0x1e')]?_[_0x3636('0x1f')](_0x5aa0ff['options']['include'],function(_0x368356){return{'model':db[_0x368356['model']],'as':_0x368356['as'],'attributes':_0x368356['attributes'],'include':_0x368356[_0x3636('0x1e')]?_['map'](_0x368356[_0x3636('0x1e')],function(_0x4c24cf){return{'model':db[_0x4c24cf[_0x3636('0x20')]],'as':_0x4c24cf['as'],'attributes':_0x4c24cf[_0x3636('0x1c')],'include':_0x4c24cf[_0x3636('0x1e')]?_[_0x3636('0x1f')](_0x4c24cf[_0x3636('0x1e')],function(_0x20ca8b){return{'model':db[_0x20ca8b[_0x3636('0x20')]],'as':_0x20ca8b['as'],'attributes':_0x20ca8b[_0x3636('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3636('0xe')](function(_0x701651){logger[_0x3636('0xf')]('GetMemberReport',_0x5aa0ff);logger[_0x3636('0x12')](_0x3636('0x17'),_0x5aa0ff,JSON[_0x3636('0x21')](_0x701651));_0xae6469(_0x701651);})[_0x3636('0x22')](function(_0xd37c62){logger[_0x3636('0x14')]('GetMemberReport',_0xd37c62[_0x3636('0x15')],_0x5aa0ff);_0x337e3d(_0x5e85f2[_0x3636('0x14')](0x1f4,_0xd37c62['message']));});});};exports[_0x3636('0x23')]=function(_0x26b6de){var _0x306774=this;return new Promise(function(_0x474ad3,_0x3febfd){return db['MemberReport'][_0x3636('0x24')](_0x26b6de[_0x3636('0x25')],{'raw':_0x26b6de[_0x3636('0x1a')]?_0x26b6de[_0x3636('0x1a')][_0x3636('0x1b')]===undefined?!![]:![]:!![]})[_0x3636('0xe')](function(_0xda41a3){logger[_0x3636('0xf')](_0x3636('0x23'),_0x26b6de);logger['debug']('CreateMemberReport',_0x26b6de,JSON[_0x3636('0x21')](_0xda41a3));_0x474ad3(_0xda41a3);})['catch'](function(_0x4aac94){logger[_0x3636('0x14')](_0x3636('0x23'),_0x4aac94[_0x3636('0x15')],_0x26b6de);_0x3febfd(_0x306774['error'](0x1f4,_0x4aac94[_0x3636('0x15')]));});});};exports[_0x3636('0x26')]=function(_0x25dc94){var _0x3b6c63=this;return new Promise(function(_0x24e873,_0x41021f){return db[_0x3636('0x18')][_0x3636('0x27')](_0x25dc94[_0x3636('0x25')],{'raw':_0x25dc94[_0x3636('0x1a')]?_0x25dc94[_0x3636('0x1a')][_0x3636('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25dc94[_0x3636('0x1a')]?_0x25dc94['options'][_0x3636('0x28')]||null:null,'attributes':_0x25dc94[_0x3636('0x1a')]?_0x25dc94[_0x3636('0x1a')][_0x3636('0x1c')]||null:null,'limit':_0x25dc94['options']?_0x25dc94['options'][_0x3636('0x1d')]||null:null})[_0x3636('0xe')](function(_0x19c213){logger['info'](_0x3636('0x26'),_0x25dc94);logger[_0x3636('0x12')]('UpdateMemberReport',_0x25dc94,JSON['stringify'](_0x19c213));_0x24e873(_0x19c213);})[_0x3636('0x22')](function(_0x5f1a43){logger[_0x3636('0x14')](_0x3636('0x26'),_0x5f1a43[_0x3636('0x15')],_0x25dc94);_0x41021f(_0x3b6c63[_0x3636('0x14')](0x1f4,_0x5f1a43[_0x3636('0x15')]));});});}; \ No newline at end of file +var _0x3d4b=['attributes','then','debug','CreateMemberReport','create','body','where','catch','UpdateMemberReport','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMemberReport','MemberReport','findAll','options','raw','limit','include','model','map'];(function(_0x102d1c,_0x36f1e4){var _0x5b9be5=function(_0x1c827a){while(--_0x1c827a){_0x102d1c['push'](_0x102d1c['shift']());}};_0x5b9be5(++_0x36f1e4);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x2fd96d,_0x371b9d){_0x2fd96d=_0x2fd96d-0x0;var _0x451e85=_0x3d4b[_0x2fd96d];return _0x451e85;};'use strict';var _=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var moment=require('moment');var BPromise=require(_0xb3d4('0x2'));var rs=require(_0xb3d4('0x3'));var fs=require('fs');var Redis=require(_0xb3d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3d4('0x5'));var logger=require(_0xb3d4('0x6'))(_0xb3d4('0x7'));var config=require(_0xb3d4('0x8'));var jayson=require(_0xb3d4('0x9'));var client=jayson[_0xb3d4('0xa')][_0xb3d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x448c49,_0x43bc45,_0x35e0b3){return new BPromise(function(_0xd1d4c4,_0x2eb3b3){return client['request'](_0x448c49,_0x35e0b3)['then'](function(_0x343c8d){logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,_0xb3d4('0xe'));logger['debug'](_0xb3d4('0xf'),_0x43bc45,_0xb3d4('0xe'),JSON[_0xb3d4('0x10')](_0x343c8d));if(_0x343c8d[_0xb3d4('0x11')]){if(_0x343c8d[_0xb3d4('0x11')][_0xb3d4('0x12')]===0x1f4){logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d[_0xb3d4('0x11')]['message']);return _0x2eb3b3(_0x343c8d['error'][_0xb3d4('0x13')]);}logger[_0xb3d4('0x11')](_0xb3d4('0xd'),_0x43bc45,_0x343c8d['error'][_0xb3d4('0x13')]);return _0xd1d4c4(_0x343c8d[_0xb3d4('0x11')]['message']);}else{logger[_0xb3d4('0xc')](_0xb3d4('0xd'),_0x43bc45,'request\x20sent');_0xd1d4c4(_0x343c8d[_0xb3d4('0x14')]['message']);}})['catch'](function(_0x539d5){logger['error'](_0xb3d4('0xd'),_0x43bc45,_0x539d5);_0x2eb3b3(_0x539d5);});});}exports[_0xb3d4('0x15')]=function(_0x1676a5){var _0x270298=this;return new Promise(function(_0x233adc,_0x5688d4){return db[_0xb3d4('0x16')][_0xb3d4('0x17')]({'raw':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'where':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['where']||null:null,'attributes':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')]['attributes']||null:null,'limit':_0x1676a5['options']?_0x1676a5['options'][_0xb3d4('0x1a')]||null:null,'include':_0x1676a5[_0xb3d4('0x18')]?_0x1676a5[_0xb3d4('0x18')][_0xb3d4('0x1b')]?_['map'](_0x1676a5['options'][_0xb3d4('0x1b')],function(_0x51c3a9){return{'model':db[_0x51c3a9[_0xb3d4('0x1c')]],'as':_0x51c3a9['as'],'attributes':_0x51c3a9['attributes'],'include':_0x51c3a9['include']?_[_0xb3d4('0x1d')](_0x51c3a9[_0xb3d4('0x1b')],function(_0x1fdbf6){return{'model':db[_0x1fdbf6['model']],'as':_0x1fdbf6['as'],'attributes':_0x1fdbf6[_0xb3d4('0x1e')],'include':_0x1fdbf6['include']?_['map'](_0x1fdbf6[_0xb3d4('0x1b')],function(_0x5482a4){return{'model':db[_0x5482a4[_0xb3d4('0x1c')]],'as':_0x5482a4['as'],'attributes':_0x5482a4[_0xb3d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb3d4('0x1f')](function(_0x552da8){logger['info'](_0xb3d4('0x15'),_0x1676a5);logger[_0xb3d4('0x20')](_0xb3d4('0x15'),_0x1676a5,JSON['stringify'](_0x552da8));_0x233adc(_0x552da8);})['catch'](function(_0x4921c1){logger[_0xb3d4('0x11')](_0xb3d4('0x15'),_0x4921c1[_0xb3d4('0x13')],_0x1676a5);_0x5688d4(_0x270298['error'](0x1f4,_0x4921c1[_0xb3d4('0x13')]));});});};exports[_0xb3d4('0x21')]=function(_0x37cff4){var _0x5a3fe7=this;return new Promise(function(_0x447200,_0x98a5ff){return db['MemberReport'][_0xb3d4('0x22')](_0x37cff4['body'],{'raw':_0x37cff4['options']?_0x37cff4[_0xb3d4('0x18')][_0xb3d4('0x19')]===undefined?!![]:![]:!![]})[_0xb3d4('0x1f')](function(_0x3204f1){logger[_0xb3d4('0xc')](_0xb3d4('0x21'),_0x37cff4);logger[_0xb3d4('0x20')](_0xb3d4('0x21'),_0x37cff4,JSON[_0xb3d4('0x10')](_0x3204f1));_0x447200(_0x3204f1);})['catch'](function(_0x35ade5){logger[_0xb3d4('0x11')](_0xb3d4('0x21'),_0x35ade5['message'],_0x37cff4);_0x98a5ff(_0x5a3fe7[_0xb3d4('0x11')](0x1f4,_0x35ade5['message']));});});};exports['UpdateMemberReport']=function(_0x56da7d){var _0x45c8ab=this;return new Promise(function(_0x359084,_0x58ae1d){return db[_0xb3d4('0x16')]['update'](_0x56da7d[_0xb3d4('0x23')],{'raw':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d['options'][_0xb3d4('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x24')]||null:null,'attributes':_0x56da7d['options']?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1e')]||null:null,'limit':_0x56da7d[_0xb3d4('0x18')]?_0x56da7d[_0xb3d4('0x18')][_0xb3d4('0x1a')]||null:null})[_0xb3d4('0x1f')](function(_0x265574){logger['info']('UpdateMemberReport',_0x56da7d);logger[_0xb3d4('0x20')]('UpdateMemberReport',_0x56da7d,JSON[_0xb3d4('0x10')](_0x265574));_0x359084(_0x265574);})[_0xb3d4('0x25')](function(_0x5e5b95){logger[_0xb3d4('0x11')](_0xb3d4('0x26'),_0x5e5b95['message'],_0x56da7d);_0x58ae1d(_0x45c8ab[_0xb3d4('0x11')](0x1f4,_0x5e5b95[_0xb3d4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index c9a4e0d..28640db 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 _0x5c4d=['get','index','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller'];(function(_0x2e4342,_0x2cd855){var _0x3d1a5d=function(_0x20166a){while(--_0x20166a){_0x2e4342['push'](_0x2e4342['shift']());}};_0x3d1a5d(++_0x2cd855);}(_0x5c4d,0x18f));var _0xd5c4=function(_0x3005c7,_0x39d5a5){_0x3005c7=_0x3005c7-0x0;var _0x17d49c=_0x5c4d[_0x3005c7];return _0x17d49c;};'use strict';var multer=require(_0xd5c4('0x0'));var util=require('util');var path=require(_0xd5c4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd5c4('0x2'));var auth=require(_0xd5c4('0x3'));var interaction=require(_0xd5c4('0x4'));var config=require('../../config/environment');var controller=require(_0xd5c4('0x5'));router[_0xd5c4('0x6')]('/',controller[_0xd5c4('0x7')]);module[_0xd5c4('0x8')]=router; \ No newline at end of file +var _0x7c1e=['../../config/environment','./migration.controller','get','index','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24371e,_0x43c47b){var _0x581a8e=function(_0x488019){while(--_0x488019){_0x24371e['push'](_0x24371e['shift']());}};_0x581a8e(++_0x43c47b);}(_0x7c1e,0x112));var _0xe7c1=function(_0x5e8fb9,_0x4390b9){_0x5e8fb9=_0x5e8fb9-0x0;var _0x5d0907=_0x7c1e[_0x5e8fb9];return _0x5d0907;};'use strict';var multer=require(_0xe7c1('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe7c1('0x1'));var router=express[_0xe7c1('0x2')]();var fs_extra=require(_0xe7c1('0x3'));var auth=require(_0xe7c1('0x4'));var interaction=require(_0xe7c1('0x5'));var config=require(_0xe7c1('0x6'));var controller=require(_0xe7c1('0x7'));router[_0xe7c1('0x8')]('/',controller[_0xe7c1('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a28c2c4..baa1c08 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 _0x908f=['sequelize','exports','STRING','version'];(function(_0x21801c,_0x281cf0){var _0x4a3057=function(_0x11fd85){while(--_0x11fd85){_0x21801c['push'](_0x21801c['shift']());}};_0x4a3057(++_0x281cf0);}(_0x908f,0x1a0));var _0xf908=function(_0x323106,_0x46bcf3){_0x323106=_0x323106-0x0;var _0x43aec1=_0x908f[_0x323106];return _0x43aec1;};'use strict';var Sequelize=require(_0xf908('0x0'));module[_0xf908('0x1')]={'version':{'type':Sequelize[_0xf908('0x2')],'unique':_0xf908('0x3')}}; \ No newline at end of file +var _0x381a=['version','sequelize','exports','STRING'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x381a,0xf1));var _0xa381=function(_0x1c3d60,_0x400b23){_0x1c3d60=_0x1c3d60-0x0;var _0x5e583e=_0x381a[_0x1c3d60];return _0x5e583e;};'use strict';var Sequelize=require(_0xa381('0x0'));module[_0xa381('0x1')]={'version':{'type':Sequelize[_0xa381('0x2')],'unique':_0xa381('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 8ada9ab..4382ed8 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 _0x764d=['set','apply','reject','save','update','then','error','stack','name','send','map','Migration','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','VIRTUAL','filter','where','include','findAll','rows','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x764d,0xeb));var _0xd764=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x764d[_0x57486e];return _0x5f110b;};'use strict';var emlformat=require(_0xd764('0x0'));var rimraf=require(_0xd764('0x1'));var zipdir=require(_0xd764('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd764('0x3'));var BPromise=require(_0xd764('0x4'));var Mustache=require(_0xd764('0x5'));var util=require(_0xd764('0x6'));var path=require(_0xd764('0x7'));var sox=require(_0xd764('0x8'));var csv=require(_0xd764('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd764('0xa'));var squel=require(_0xd764('0xb'));var crypto=require(_0xd764('0xc'));var jsforce=require(_0xd764('0xd'));var deskjs=require(_0xd764('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd764('0xf'));var Papa=require(_0xd764('0x10'));var Redis=require(_0xd764('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd764('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd764('0x13'));var logger=require(_0xd764('0x14'))('api');var utils=require(_0xd764('0x15'));var config=require(_0xd764('0x16'));var licenseUtil=require(_0xd764('0x17'));var db=require(_0xd764('0x18'))['db'];function respondWithStatusCode(_0x5ce93d,_0x519350){_0x519350=_0x519350||0xcc;return function(_0x381632){if(_0x381632){return _0x5ce93d[_0xd764('0x19')](_0x519350);}return _0x5ce93d[_0xd764('0x1a')](_0x519350)[_0xd764('0x1b')]();};}function respondWithResult(_0x2be68a,_0xf12444){_0xf12444=_0xf12444||0xc8;return function(_0x590679){if(_0x590679){return _0x2be68a[_0xd764('0x1a')](_0xf12444)[_0xd764('0x1c')](_0x590679);}};}function respondWithFilteredResult(_0x323441,_0x424062){return function(_0x542240){if(_0x542240){var _0x39c50c=typeof _0x424062[_0xd764('0x1d')]===_0xd764('0x1e')&&typeof _0x424062[_0xd764('0x1f')]===_0xd764('0x1e');var _0x27ae4a=_0x542240['count'];var _0x3dbda0=_0x39c50c?0x0:_0x424062[_0xd764('0x1d')];var _0x4886db=_0x39c50c?_0x542240[_0xd764('0x20')]:_0x424062[_0xd764('0x1d')]+_0x424062[_0xd764('0x1f')];var _0x5ea572;if(_0x4886db>=_0x27ae4a){_0x4886db=_0x27ae4a;_0x5ea572=0xc8;}else{_0x5ea572=0xce;}_0x323441[_0xd764('0x1a')](_0x5ea572);return _0x323441[_0xd764('0x21')]('Content-Range',_0x3dbda0+'-'+_0x4886db+'/'+_0x27ae4a)[_0xd764('0x1c')](_0x542240);}return null;};}function patchUpdates(_0x55f8e7){return function(_0xfa7b2b){try{jsonpatch[_0xd764('0x22')](_0xfa7b2b,_0x55f8e7,!![]);}catch(_0x56d8fd){return BPromise[_0xd764('0x23')](_0x56d8fd);}return _0xfa7b2b[_0xd764('0x24')]();};}function saveUpdates(_0x526946,_0x95f514){return function(_0x4cc59a){if(_0x4cc59a){return _0x4cc59a[_0xd764('0x25')](_0x526946)[_0xd764('0x26')](function(_0x3a92d5){return _0x3a92d5;});}return null;};}function removeEntity(_0x514723,_0x51dffd){return function(_0x51e280){if(_0x51e280){return _0x51e280['destroy']()[_0xd764('0x26')](function(){_0x514723[_0xd764('0x1a')](0xcc)[_0xd764('0x1b')]();});}};}function handleEntityNotFound(_0xe7a3af,_0xacb658){return function(_0x3e7e09){if(!_0x3e7e09){_0xe7a3af['sendStatus'](0x194);}return _0x3e7e09;};}function handleError(_0x21688b,_0x56f14a){_0x56f14a=_0x56f14a||0x1f4;return function(_0x550c7e){logger[_0xd764('0x27')](_0x550c7e[_0xd764('0x28')]);if(_0x550c7e[_0xd764('0x29')]){delete _0x550c7e[_0xd764('0x29')];}_0x21688b[_0xd764('0x1a')](_0x56f14a)[_0xd764('0x2a')](_0x550c7e);};}exports['index']=function(_0x103aac,_0x1d978e){var _0x41d82c={},_0x24dc70={},_0x22e635={'count':0x0,'rows':[]};var _0x556b55=_[_0xd764('0x2b')](db[_0xd764('0x2c')]['rawAttributes'],function(_0x5e4e7c){return{'name':_0x5e4e7c[_0xd764('0x2d')],'type':_0x5e4e7c[_0xd764('0x2e')][_0xd764('0x2f')]};});_0x24dc70[_0xd764('0x30')]=_[_0xd764('0x2b')](_0x556b55,'name');_0x24dc70[_0xd764('0x31')]=_[_0xd764('0x32')](_0x103aac[_0xd764('0x31')]);_0x24dc70[_0xd764('0x33')]=_['intersection'](_0x24dc70[_0xd764('0x30')],_0x24dc70[_0xd764('0x31')]);_0x41d82c[_0xd764('0x34')]=_['intersection'](_0x24dc70['model'],qs['fields'](_0x103aac[_0xd764('0x31')][_0xd764('0x35')]));_0x41d82c['attributes']=_0x41d82c[_0xd764('0x34')]['length']?_0x41d82c['attributes']:_0x24dc70[_0xd764('0x30')];if(!_0x103aac[_0xd764('0x31')][_0xd764('0x36')](_0xd764('0x37'))){_0x41d82c['limit']=qs['limit'](_0x103aac['query'][_0xd764('0x1f')]);_0x41d82c[_0xd764('0x1d')]=qs[_0xd764('0x1d')](_0x103aac['query']['offset']);}_0x41d82c[_0xd764('0x38')]=qs[_0xd764('0x39')](_0x103aac[_0xd764('0x31')][_0xd764('0x39')]);_0x41d82c['where']=qs[_0xd764('0x33')](_[_0xd764('0x3a')](_0x103aac[_0xd764('0x31')],_0x24dc70['filters']),_0x556b55);if(_0x103aac[_0xd764('0x31')]['filter']){_0x41d82c['where']=_[_0xd764('0x3b')](_0x41d82c['where'],{'$or':_[_0xd764('0x2b')](_0x556b55,function(_0x9294eb){if(_0x9294eb['type']!==_0xd764('0x3c')){var _0x58aeb4={};_0x58aeb4[_0x9294eb['name']]={'$like':'%'+_0x103aac[_0xd764('0x31')][_0xd764('0x3d')]+'%'};return _0x58aeb4;}})});}_0x41d82c=_[_0xd764('0x3b')]({},_0x41d82c,_0x103aac['options']);var _0x285f3a={'where':_0x41d82c[_0xd764('0x3e')]};return db[_0xd764('0x2c')][_0xd764('0x20')](_0x285f3a)[_0xd764('0x26')](function(_0x5adada){_0x22e635[_0xd764('0x20')]=_0x5adada;if(_0x103aac[_0xd764('0x31')]['includeAll']){_0x41d82c[_0xd764('0x3f')]=[{'all':!![]}];}return db[_0xd764('0x2c')][_0xd764('0x40')](_0x41d82c);})[_0xd764('0x26')](function(_0x31c7d5){_0x22e635[_0xd764('0x41')]=_0x31c7d5;return _0x22e635;})['then'](respondWithFilteredResult(_0x1d978e,_0x41d82c))[_0xd764('0x42')](handleError(_0x1d978e,null));}; \ No newline at end of file +var _0xecb4=['reject','update','then','destroy','end','error','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','rimraf','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0xecb4,0xdb));var _0x4ecb=function(_0x404b65,_0x4125eb){_0x404b65=_0x404b65-0x0;var _0x2bb694=_0xecb4[_0x404b65];return _0x2bb694;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ecb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4ecb('0x1'));var Mustache=require('mustache');var util=require(_0x4ecb('0x2'));var path=require(_0x4ecb('0x3'));var sox=require('sox');var csv=require(_0x4ecb('0x4'));var ejs=require(_0x4ecb('0x5'));var fs=require('fs');var fs_extra=require(_0x4ecb('0x6'));var _=require(_0x4ecb('0x7'));var squel=require(_0x4ecb('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ecb('0x9'));var toCsv=require(_0x4ecb('0x4'));var querystring=require(_0x4ecb('0xa'));var Papa=require(_0x4ecb('0xb'));var Redis=require(_0x4ecb('0xc'));var authService=require(_0x4ecb('0xd'));var qs=require(_0x4ecb('0xe'));var as=require(_0x4ecb('0xf'));var hardwareService=require(_0x4ecb('0x10'));var logger=require(_0x4ecb('0x11'))(_0x4ecb('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4ecb('0x13'))['db'];function respondWithStatusCode(_0x4a3126,_0x46178b){_0x46178b=_0x46178b||0xcc;return function(_0x12ea9b){if(_0x12ea9b){return _0x4a3126[_0x4ecb('0x14')](_0x46178b);}return _0x4a3126[_0x4ecb('0x15')](_0x46178b)['end']();};}function respondWithResult(_0x35a249,_0x36e495){_0x36e495=_0x36e495||0xc8;return function(_0x417c76){if(_0x417c76){return _0x35a249[_0x4ecb('0x15')](_0x36e495)[_0x4ecb('0x16')](_0x417c76);}};}function respondWithFilteredResult(_0x42ccf7,_0x50d013){return function(_0x19c3cc){if(_0x19c3cc){var _0x2bccc5=typeof _0x50d013[_0x4ecb('0x17')]===_0x4ecb('0x18')&&typeof _0x50d013[_0x4ecb('0x19')]==='undefined';var _0x112156=_0x19c3cc['count'];var _0x496870=_0x2bccc5?0x0:_0x50d013['offset'];var _0xbdbccf=_0x2bccc5?_0x19c3cc[_0x4ecb('0x1a')]:_0x50d013['offset']+_0x50d013[_0x4ecb('0x19')];var _0x2a8847;if(_0xbdbccf>=_0x112156){_0xbdbccf=_0x112156;_0x2a8847=0xc8;}else{_0x2a8847=0xce;}_0x42ccf7[_0x4ecb('0x15')](_0x2a8847);return _0x42ccf7[_0x4ecb('0x1b')](_0x4ecb('0x1c'),_0x496870+'-'+_0xbdbccf+'/'+_0x112156)['json'](_0x19c3cc);}return null;};}function patchUpdates(_0x598965){return function(_0x8fd908){try{jsonpatch['apply'](_0x8fd908,_0x598965,!![]);}catch(_0x27c591){return BPromise[_0x4ecb('0x1d')](_0x27c591);}return _0x8fd908['save']();};}function saveUpdates(_0x548d00,_0x3c99aa){return function(_0x3a6740){if(_0x3a6740){return _0x3a6740[_0x4ecb('0x1e')](_0x548d00)[_0x4ecb('0x1f')](function(_0x30d242){return _0x30d242;});}return null;};}function removeEntity(_0x439a05,_0x5abebd){return function(_0x322598){if(_0x322598){return _0x322598[_0x4ecb('0x20')]()[_0x4ecb('0x1f')](function(){_0x439a05[_0x4ecb('0x15')](0xcc)[_0x4ecb('0x21')]();});}};}function handleEntityNotFound(_0xd1d919,_0x17ce7f){return function(_0x2a3af0){if(!_0x2a3af0){_0xd1d919[_0x4ecb('0x14')](0x194);}return _0x2a3af0;};}function handleError(_0x35324d,_0xa4f88){_0xa4f88=_0xa4f88||0x1f4;return function(_0x1d5ba7){logger[_0x4ecb('0x22')](_0x1d5ba7['stack']);if(_0x1d5ba7['name']){delete _0x1d5ba7[_0x4ecb('0x23')];}_0x35324d['status'](_0xa4f88)[_0x4ecb('0x24')](_0x1d5ba7);};}exports[_0x4ecb('0x25')]=function(_0x392efe,_0x5c5c54){var _0x472e00={},_0x39af68={},_0x23448d={'count':0x0,'rows':[]};var _0x5597d5=_['map'](db[_0x4ecb('0x26')][_0x4ecb('0x27')],function(_0x19ddb1){return{'name':_0x19ddb1[_0x4ecb('0x28')],'type':_0x19ddb1[_0x4ecb('0x29')][_0x4ecb('0x2a')]};});_0x39af68[_0x4ecb('0x2b')]=_[_0x4ecb('0x2c')](_0x5597d5,_0x4ecb('0x23'));_0x39af68[_0x4ecb('0x2d')]=_[_0x4ecb('0x2e')](_0x392efe['query']);_0x39af68[_0x4ecb('0x2f')]=_[_0x4ecb('0x30')](_0x39af68['model'],_0x39af68[_0x4ecb('0x2d')]);_0x472e00[_0x4ecb('0x31')]=_[_0x4ecb('0x30')](_0x39af68[_0x4ecb('0x2b')],qs[_0x4ecb('0x32')](_0x392efe[_0x4ecb('0x2d')][_0x4ecb('0x32')]));_0x472e00[_0x4ecb('0x31')]=_0x472e00['attributes']['length']?_0x472e00[_0x4ecb('0x31')]:_0x39af68[_0x4ecb('0x2b')];if(!_0x392efe['query'][_0x4ecb('0x33')](_0x4ecb('0x34'))){_0x472e00[_0x4ecb('0x19')]=qs[_0x4ecb('0x19')](_0x392efe['query'][_0x4ecb('0x19')]);_0x472e00['offset']=qs[_0x4ecb('0x17')](_0x392efe['query'][_0x4ecb('0x17')]);}_0x472e00['order']=qs[_0x4ecb('0x35')](_0x392efe['query'][_0x4ecb('0x35')]);_0x472e00[_0x4ecb('0x36')]=qs[_0x4ecb('0x2f')](_['pick'](_0x392efe[_0x4ecb('0x2d')],_0x39af68[_0x4ecb('0x2f')]),_0x5597d5);if(_0x392efe[_0x4ecb('0x2d')][_0x4ecb('0x37')]){_0x472e00['where']=_[_0x4ecb('0x38')](_0x472e00['where'],{'$or':_['map'](_0x5597d5,function(_0x2295db){if(_0x2295db[_0x4ecb('0x29')]!==_0x4ecb('0x39')){var _0x466962={};_0x466962[_0x2295db[_0x4ecb('0x23')]]={'$like':'%'+_0x392efe[_0x4ecb('0x2d')][_0x4ecb('0x37')]+'%'};return _0x466962;}})});}_0x472e00=_[_0x4ecb('0x38')]({},_0x472e00,_0x392efe['options']);var _0x39767d={'where':_0x472e00['where']};return db[_0x4ecb('0x26')][_0x4ecb('0x1a')](_0x39767d)[_0x4ecb('0x1f')](function(_0x59c60b){_0x23448d['count']=_0x59c60b;if(_0x392efe[_0x4ecb('0x2d')][_0x4ecb('0x3a')]){_0x472e00['include']=[{'all':!![]}];}return db[_0x4ecb('0x26')][_0x4ecb('0x3b')](_0x472e00);})[_0x4ecb('0x1f')](function(_0x191404){_0x23448d[_0x4ecb('0x3c')]=_0x191404;return _0x23448d;})[_0x4ecb('0x1f')](respondWithFilteredResult(_0x5c5c54,_0x472e00))[_0x4ecb('0x3d')](handleError(_0x5c5c54,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index d24e03c..ffe4a09 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 _0x9a98=['./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a98,0x1e6));var _0x89a9=function(_0x19ddbf,_0x2371d0){_0x19ddbf=_0x19ddbf-0x0;var _0x1abe42=_0x9a98[_0x19ddbf];return _0x1abe42;};'use strict';var _=require(_0x89a9('0x0'));var util=require(_0x89a9('0x1'));var logger=require(_0x89a9('0x2'))(_0x89a9('0x3'));var moment=require(_0x89a9('0x4'));var BPromise=require(_0x89a9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x89a9('0x6'));var config=require(_0x89a9('0x7'));var attributes=require(_0x89a9('0x8'));module[_0x89a9('0x9')]=function(_0x5aace4,_0x29c0cd){return _0x5aace4[_0x89a9('0xa')](_0x89a9('0xb'),attributes,{'tableName':_0x89a9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb744=['../../config/environment','./migration.attributes','define','Migration','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0xb744,0x148));var _0x4b74=function(_0x116d6d,_0xf7f9df){_0x116d6d=_0x116d6d-0x0;var _0x555a13=_0xb744[_0x116d6d];return _0x555a13;};'use strict';var _=require('lodash');var util=require(_0x4b74('0x0'));var logger=require(_0x4b74('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b74('0x2'));var rp=require(_0x4b74('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4b74('0x4'));var config=require(_0x4b74('0x5'));var attributes=require(_0x4b74('0x6'));module['exports']=function(_0x43604a,_0x119d88){return _0x43604a[_0x4b74('0x7')](_0x4b74('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ccff75c..e2743d3 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 _0x8c99=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x8c99,0x1a8));var _0x98c9=function(_0x242a98,_0x13988e){_0x242a98=_0x242a98-0x0;var _0x580999=_0x8c99[_0x242a98];return _0x580999;};'use strict';var _=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var moment=require(_0x98c9('0x2'));var BPromise=require(_0x98c9('0x3'));var rs=require(_0x98c9('0x4'));var fs=require('fs');var Redis=require(_0x98c9('0x5'));var db=require(_0x98c9('0x6'))['db'];var utils=require(_0x98c9('0x7'));var logger=require(_0x98c9('0x8'))(_0x98c9('0x9'));var config=require(_0x98c9('0xa'));var jayson=require(_0x98c9('0xb'));var client=jayson['client'][_0x98c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed2b6,_0x538465,_0x4af8a6){return new BPromise(function(_0x5b983e,_0xc789b1){return client[_0x98c9('0xd')](_0x2ed2b6,_0x4af8a6)[_0x98c9('0xe')](function(_0x4052cf){logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));logger[_0x98c9('0x12')](_0x98c9('0x13'),_0x538465,_0x98c9('0x11'),JSON[_0x98c9('0x14')](_0x4052cf));if(_0x4052cf['error']){if(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x16')]===0x1f4){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0xc789b1(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0x5b983e(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}else{logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));_0x5b983e(_0x4052cf[_0x98c9('0x18')][_0x98c9('0x17')]);}})[_0x98c9('0x19')](function(_0x2bb8b6){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x2bb8b6);_0xc789b1(_0x2bb8b6);});});} \ No newline at end of file +var _0xf290=['message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf290,0xde));var _0x0f29=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xf290[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('Migration,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index b48b075..f58fdf5 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 _0xd916=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./network.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd916,0x18a));var _0x6d91=function(_0x669298,_0x4791e6){_0x669298=_0x669298-0x0;var _0xeeb1b9=_0xd916[_0x669298];return _0xeeb1b9;};'use strict';var multer=require(_0x6d91('0x0'));var util=require(_0x6d91('0x1'));var path=require(_0x6d91('0x2'));var timeout=require(_0x6d91('0x3'));var express=require(_0x6d91('0x4'));var router=express['Router']();var fs_extra=require(_0x6d91('0x5'));var auth=require(_0x6d91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6d91('0x7'));router[_0x6d91('0x8')]('/',auth['isAuthenticated'](),controller[_0x6d91('0x9')]);router[_0x6d91('0x8')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0xc')]);router[_0x6d91('0xd')]('/',auth[_0x6d91('0xb')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d91('0xe')]);router[_0x6d91('0xf')](_0x6d91('0xa'),auth[_0x6d91('0xb')](),controller[_0x6d91('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6132=['update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','./network.controller','isAuthenticated','index','get','show','create','/:id'];(function(_0x4d60d0,_0x24490b){var _0x9919bc=function(_0x27250d){while(--_0x27250d){_0x4d60d0['push'](_0x4d60d0['shift']());}};_0x9919bc(++_0x24490b);}(_0x6132,0xf3));var _0x2613=function(_0xba9d93,_0x15c966){_0xba9d93=_0xba9d93-0x0;var _0x1f2ab1=_0x6132[_0xba9d93];return _0x1f2ab1;};'use strict';var multer=require('multer');var util=require(_0x2613('0x0'));var path=require('path');var timeout=require(_0x2613('0x1'));var express=require(_0x2613('0x2'));var router=express[_0x2613('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2613('0x4'));var config=require('../../config/environment');var controller=require(_0x2613('0x5'));router['get']('/',auth[_0x2613('0x6')](),controller[_0x2613('0x7')]);router[_0x2613('0x8')]('/:id',auth[_0x2613('0x6')](),controller[_0x2613('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2613('0xa')]);router['put'](_0x2613('0xb'),auth[_0x2613('0x6')](),controller[_0x2613('0xc')]);router[_0x2613('0xd')](_0x2613('0xb'),auth[_0x2613('0x6')](),controller['destroy']);module[_0x2613('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d3ad37e..1579507 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 _0x8453=['STRING','sequelize','stun','turn'];(function(_0x14200b,_0x52764b){var _0x13e121=function(_0x49f1bd){while(--_0x49f1bd){_0x14200b['push'](_0x14200b['shift']());}};_0x13e121(++_0x52764b);}(_0x8453,0x179));var _0x3845=function(_0x48f18b,_0x5a212c){_0x48f18b=_0x48f18b-0x0;var _0xd9031=_0x8453[_0x48f18b];return _0xd9031;};'use strict';var Sequelize=require(_0x3845('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('localnet','externip',_0x3845('0x1'),_0x3845('0x2'))},'value':{'type':Sequelize[_0x3845('0x3')]},'username':{'type':Sequelize[_0x3845('0x3')]},'password':{'type':Sequelize[_0x3845('0x3')]}}; \ No newline at end of file +var _0x12e3=['ENUM','localnet','externip','STRING','exports'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x12e3,0x18f));var _0x312e=function(_0x3f2899,_0x3ac153){_0x3f2899=_0x3f2899-0x0;var _0x214093=_0x12e3[_0x3f2899];return _0x214093;};'use strict';var Sequelize=require('sequelize');module[_0x312e('0x0')]={'type':{'type':Sequelize[_0x312e('0x1')](_0x312e('0x2'),_0x312e('0x3'),'stun','turn')},'value':{'type':Sequelize[_0x312e('0x4')]},'username':{'type':Sequelize[_0x312e('0x4')]},'password':{'type':Sequelize[_0x312e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index f136db4..d9756c9 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 _0x6ff1=['undefined','count','set','Content-Range','save','update','then','name','index','map','Network','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','sequelize','create','body','toUpperCase','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','destroy','server/files/templates/stun_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','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','jayson/promise','client','http','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','json','offset','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ff1,0x10a));var _0x16ff=function(_0x1229c3,_0x3c4e57){_0x1229c3=_0x1229c3-0x0;var _0x2ba327=_0x6ff1[_0x1229c3];return _0x2ba327;};'use strict';var emlformat=require(_0x16ff('0x0'));var rimraf=require(_0x16ff('0x1'));var zipdir=require(_0x16ff('0x2'));var jsonpatch=require(_0x16ff('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16ff('0x4'));var Mustache=require('mustache');var util=require(_0x16ff('0x5'));var path=require(_0x16ff('0x6'));var sox=require(_0x16ff('0x7'));var csv=require(_0x16ff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x16ff('0x9'));var jsforce=require(_0x16ff('0xa'));var deskjs=require(_0x16ff('0xb'));var toCsv=require(_0x16ff('0x8'));var querystring=require(_0x16ff('0xc'));var Papa=require(_0x16ff('0xd'));var Redis=require(_0x16ff('0xe'));var authService=require(_0x16ff('0xf'));var qs=require(_0x16ff('0x10'));var as=require(_0x16ff('0x11'));var hardwareService=require(_0x16ff('0x12'));var logger=require(_0x16ff('0x13'))(_0x16ff('0x14'));var utils=require(_0x16ff('0x15'));var config=require(_0x16ff('0x16'));var licenseUtil=require(_0x16ff('0x17'));var db=require(_0x16ff('0x18'))['db'];var jayson=require(_0x16ff('0x19'));var client=jayson[_0x16ff('0x1a')][_0x16ff('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4a80b0,_0x4f368a,_0x15326e,_0x4351cb){return new BPromise(function(_0x358da3,_0x30bfc2){var _0xc39cfc=_0x4351cb||client;return _0xc39cfc[_0x16ff('0x1c')](_0x4a80b0,_0x15326e)['then'](function(_0x769a85){logger[_0x16ff('0x1d')](_0x16ff('0x1e'),_0x4f368a,'request\x20sent');logger[_0x16ff('0x1f')](_0x16ff('0x20'),_0x4f368a,_0x16ff('0x21'),JSON['stringify'](_0x769a85));if(_0x769a85[_0x16ff('0x22')]){if(_0x769a85[_0x16ff('0x22')]['code']===0x1f4){logger[_0x16ff('0x22')]('Network,\x20%s,\x20%s',_0x4f368a,_0x769a85[_0x16ff('0x22')]['message']);return _0x30bfc2(_0x769a85[_0x16ff('0x22')][_0x16ff('0x23')]);}logger[_0x16ff('0x22')](_0x16ff('0x1e'),_0x4f368a,_0x769a85[_0x16ff('0x22')]['message']);return _0x358da3(_0x769a85[_0x16ff('0x22')]['message']);}else{logger[_0x16ff('0x1d')](_0x16ff('0x1e'),_0x4f368a,_0x16ff('0x21'));_0x358da3(_0x769a85['result'][_0x16ff('0x23')]);}})[_0x16ff('0x24')](function(_0x1df181){logger[_0x16ff('0x22')](_0x16ff('0x1e'),_0x4f368a,_0x1df181);_0x30bfc2(_0x1df181);});});}function respondWithStatusCode(_0x3014da,_0x42a5c7){_0x42a5c7=_0x42a5c7||0xcc;return function(_0x20ee7b){if(_0x20ee7b){return _0x3014da[_0x16ff('0x25')](_0x42a5c7);}return _0x3014da[_0x16ff('0x26')](_0x42a5c7)[_0x16ff('0x27')]();};}function respondWithResult(_0x592239,_0x28ed5e){_0x28ed5e=_0x28ed5e||0xc8;return function(_0x4fed99){if(_0x4fed99){return _0x592239[_0x16ff('0x26')](_0x28ed5e)[_0x16ff('0x28')](_0x4fed99);}};}function respondWithFilteredResult(_0x557f0d,_0xb8cf7){return function(_0x2ceb0f){if(_0x2ceb0f){var _0x26c9c1=typeof _0xb8cf7[_0x16ff('0x29')]==='undefined'&&typeof _0xb8cf7[_0x16ff('0x2a')]===_0x16ff('0x2b');var _0x5a6e5f=_0x2ceb0f[_0x16ff('0x2c')];var _0x151428=_0x26c9c1?0x0:_0xb8cf7[_0x16ff('0x29')];var _0x116b2c=_0x26c9c1?_0x2ceb0f[_0x16ff('0x2c')]:_0xb8cf7[_0x16ff('0x29')]+_0xb8cf7['limit'];var _0xde65e8;if(_0x116b2c>=_0x5a6e5f){_0x116b2c=_0x5a6e5f;_0xde65e8=0xc8;}else{_0xde65e8=0xce;}_0x557f0d[_0x16ff('0x26')](_0xde65e8);return _0x557f0d[_0x16ff('0x2d')](_0x16ff('0x2e'),_0x151428+'-'+_0x116b2c+'/'+_0x5a6e5f)[_0x16ff('0x28')](_0x2ceb0f);}return null;};}function patchUpdates(_0xa25e39){return function(_0x1b5047){try{jsonpatch['apply'](_0x1b5047,_0xa25e39,!![]);}catch(_0x52e5ca){return BPromise['reject'](_0x52e5ca);}return _0x1b5047[_0x16ff('0x2f')]();};}function saveUpdates(_0xb51097,_0x39b064){return function(_0xfa1fe2){if(_0xfa1fe2){return _0xfa1fe2[_0x16ff('0x30')](_0xb51097)[_0x16ff('0x31')](function(_0x2e2d90){return _0x2e2d90;});}return null;};}function removeEntity(_0x45f3a6,_0x21c94b){return function(_0x26860d){if(_0x26860d){return _0x26860d['destroy']()[_0x16ff('0x31')](function(){_0x45f3a6[_0x16ff('0x26')](0xcc)[_0x16ff('0x27')]();});}};}function handleEntityNotFound(_0x57b98c,_0x53f637){return function(_0x51d583){if(!_0x51d583){_0x57b98c[_0x16ff('0x25')](0x194);}return _0x51d583;};}function handleError(_0x44e274,_0x108cda){_0x108cda=_0x108cda||0x1f4;return function(_0x10e0d1){logger[_0x16ff('0x22')](_0x10e0d1['stack']);if(_0x10e0d1[_0x16ff('0x32')]){delete _0x10e0d1[_0x16ff('0x32')];}_0x44e274['status'](_0x108cda)['send'](_0x10e0d1);};}exports[_0x16ff('0x33')]=function(_0x285ff1,_0x11821f){var _0x3ac7ce={},_0x3b17a5={},_0x4ba5d7={'count':0x0,'rows':[]};var _0xfb0905=_[_0x16ff('0x34')](db[_0x16ff('0x35')]['rawAttributes'],function(_0x10cee7){return{'name':_0x10cee7['fieldName'],'type':_0x10cee7[_0x16ff('0x36')]['key']};});_0x3b17a5[_0x16ff('0x37')]=_[_0x16ff('0x34')](_0xfb0905,_0x16ff('0x32'));_0x3b17a5[_0x16ff('0x38')]=_[_0x16ff('0x39')](_0x285ff1[_0x16ff('0x38')]);_0x3b17a5[_0x16ff('0x3a')]=_[_0x16ff('0x3b')](_0x3b17a5['model'],_0x3b17a5[_0x16ff('0x38')]);_0x3ac7ce['attributes']=_[_0x16ff('0x3b')](_0x3b17a5['model'],qs['fields'](_0x285ff1[_0x16ff('0x38')][_0x16ff('0x3c')]));_0x3ac7ce[_0x16ff('0x3d')]=_0x3ac7ce['attributes'][_0x16ff('0x3e')]?_0x3ac7ce[_0x16ff('0x3d')]:_0x3b17a5['model'];if(!_0x285ff1[_0x16ff('0x38')][_0x16ff('0x3f')](_0x16ff('0x40'))){_0x3ac7ce[_0x16ff('0x2a')]=qs[_0x16ff('0x2a')](_0x285ff1[_0x16ff('0x38')][_0x16ff('0x2a')]);_0x3ac7ce[_0x16ff('0x29')]=qs[_0x16ff('0x29')](_0x285ff1[_0x16ff('0x38')][_0x16ff('0x29')]);}_0x3ac7ce[_0x16ff('0x41')]=qs[_0x16ff('0x42')](_0x285ff1[_0x16ff('0x38')]['sort']);_0x3ac7ce['where']=qs['filters'](_[_0x16ff('0x43')](_0x285ff1[_0x16ff('0x38')],_0x3b17a5[_0x16ff('0x3a')]),_0xfb0905);if(_0x285ff1[_0x16ff('0x38')][_0x16ff('0x44')]){_0x3ac7ce[_0x16ff('0x45')]=_['merge'](_0x3ac7ce[_0x16ff('0x45')],{'$or':_[_0x16ff('0x34')](_0xfb0905,function(_0x2783c6){if(_0x2783c6[_0x16ff('0x36')]!==_0x16ff('0x46')){var _0x1e2e22={};_0x1e2e22[_0x2783c6[_0x16ff('0x32')]]={'$like':'%'+_0x285ff1[_0x16ff('0x38')][_0x16ff('0x44')]+'%'};return _0x1e2e22;}})});}_0x3ac7ce=_['merge']({},_0x3ac7ce,_0x285ff1[_0x16ff('0x47')]);var _0x4d94b8={'where':_0x3ac7ce[_0x16ff('0x45')]};return db['Network'][_0x16ff('0x2c')](_0x4d94b8)[_0x16ff('0x31')](function(_0x37145d){_0x4ba5d7[_0x16ff('0x2c')]=_0x37145d;if(_0x285ff1[_0x16ff('0x38')][_0x16ff('0x48')]){_0x3ac7ce['include']=[{'all':!![]}];}return db[_0x16ff('0x35')][_0x16ff('0x49')](_0x3ac7ce);})[_0x16ff('0x31')](function(_0x5066fa){_0x4ba5d7[_0x16ff('0x4a')]=_0x5066fa;return _0x4ba5d7;})[_0x16ff('0x31')](respondWithFilteredResult(_0x11821f,_0x3ac7ce))['catch'](handleError(_0x11821f,null));};exports[_0x16ff('0x4b')]=function(_0x3a7e9a,_0x4cb95b){var _0x2308bf={'raw':!![],'where':{'id':_0x3a7e9a[_0x16ff('0x4c')]['id']}},_0x3d52c1={};_0x3d52c1[_0x16ff('0x37')]=_[_0x16ff('0x39')](db[_0x16ff('0x35')][_0x16ff('0x4d')]);_0x3d52c1[_0x16ff('0x38')]=_['keys'](_0x3a7e9a[_0x16ff('0x38')]);_0x3d52c1['filters']=_[_0x16ff('0x3b')](_0x3d52c1[_0x16ff('0x37')],_0x3d52c1['query']);_0x2308bf[_0x16ff('0x3d')]=_[_0x16ff('0x3b')](_0x3d52c1[_0x16ff('0x37')],qs[_0x16ff('0x3c')](_0x3a7e9a[_0x16ff('0x38')][_0x16ff('0x3c')]));_0x2308bf[_0x16ff('0x3d')]=_0x2308bf[_0x16ff('0x3d')]['length']?_0x2308bf[_0x16ff('0x3d')]:_0x3d52c1['model'];if(_0x3a7e9a[_0x16ff('0x38')]['includeAll']){_0x2308bf['include']=[{'all':!![]}];}_0x2308bf=_['merge']({},_0x2308bf,_0x3a7e9a[_0x16ff('0x47')]);return db['Network']['find'](_0x2308bf)[_0x16ff('0x31')](handleEntityNotFound(_0x4cb95b,null))[_0x16ff('0x31')](respondWithResult(_0x4cb95b,null))[_0x16ff('0x24')](handleError(_0x4cb95b,null));};exports['create']=function(_0x898e51,_0x7cda70,_0x58f981){var _0xabf7d;return db[_0x16ff('0x4e')]['transaction'](function(_0x3c96eb){return db[_0x16ff('0x35')][_0x16ff('0x4f')](_0x898e51[_0x16ff('0x50')],{'raw':!![]})[_0x16ff('0x31')](function(_0xc61b81){_0xabf7d=_0xc61b81;return db[_0x16ff('0x35')]['findAll']({'where':{'type':_0x898e51[_0x16ff('0x50')][_0x16ff('0x36')]},'raw':!![]});})[_0x16ff('0x31')](function(_0x1d0e9e){if(_0xabf7d[_0x16ff('0x36')][_0x16ff('0x51')]()==_0x16ff('0x52')){var _0x2baa36=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x16ff('0x55'));var _0x28ac8b=ejs[_0x16ff('0x56')](_0x2baa36,{'networks':_0x1d0e9e||[]});fs[_0x16ff('0x57')](_0x16ff('0x58'),_0x28ac8b);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x4f'),{'module':_0x16ff('0x5a')});}else if(_0xabf7d[_0x16ff('0x36')][_0x16ff('0x51')]()==_0x16ff('0x5b')){var _0x59b56e=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config[_0x16ff('0x5c')],_0x16ff('0x5d')),'utf8');var _0x4a1777=ejs[_0x16ff('0x56')](_0x59b56e,{'networks':_0x1d0e9e||[]});fs[_0x16ff('0x57')](_0x16ff('0x5e'),_0x4a1777);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x4f'),{'module':_0x16ff('0x5a')});}else{var _0x278976=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config['root'],_0x16ff('0x5f')),_0x16ff('0x55'));var _0xf7f5cb=ejs[_0x16ff('0x56')](_0x278976,{'networks':_0x1d0e9e||[]});fs[_0x16ff('0x57')](util[_0x16ff('0x60')](_0x16ff('0x61'),_0x898e51['body'][_0x16ff('0x36')][_0x16ff('0x62')]()),_0xf7f5cb);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x4f'),{'module':_0x16ff('0x63')});}return null;})[_0x16ff('0x31')](function(){return _0xabf7d;});})[_0x16ff('0x31')](respondWithResult(_0x7cda70,0xc9))[_0x16ff('0x24')](handleError(_0x7cda70,null));};exports[_0x16ff('0x30')]=function(_0x2d88eb,_0x1c3077,_0x3191b0){var _0x1cc438;return db['sequelize']['transaction'](function(_0xaf808b){return db[_0x16ff('0x35')][_0x16ff('0x64')]({'where':{'id':_0x2d88eb[_0x16ff('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1c3077,null))[_0x16ff('0x31')](saveUpdates(_0x2d88eb['body'],null))[_0x16ff('0x31')](function(_0x369f95){if(_0x369f95){_0x1cc438=_0x369f95;return db['Network']['findAll']({'where':{'type':_0x1cc438[_0x16ff('0x36')]},'raw':!![]});}return null;})[_0x16ff('0x31')](function(_0xdaa8f7){if(_0x1cc438['type'][_0x16ff('0x51')]()==_0x16ff('0x52')){var _0x26f058=fs['readFileSync'](path['join'](config[_0x16ff('0x5c')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x2abf45=ejs['render'](_0x26f058,{'networks':_0xdaa8f7||[]});fs[_0x16ff('0x57')](_0x16ff('0x58'),_0x2abf45);return respondWithRpcPromise(_0x16ff('0x59'),'update',{'module':_0x16ff('0x5a')});}else if(_0x1cc438[_0x16ff('0x36')]['toUpperCase']()==_0x16ff('0x5b')){var _0x15d0a3=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config[_0x16ff('0x5c')],_0x16ff('0x5d')),_0x16ff('0x55'));var _0x237b64=ejs[_0x16ff('0x56')](_0x15d0a3,{'networks':_0xdaa8f7||[]});fs['writeFileSync'](_0x16ff('0x5e'),_0x237b64);return respondWithRpcPromise(_0x16ff('0x59'),'update',{'module':'res_stun_monitor.so'});}else{var _0x2db0e0=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config[_0x16ff('0x5c')],'server/files/templates/network.ejs'),'utf8');var _0x133bd5=ejs['render'](_0x2db0e0,{'networks':_0xdaa8f7||[]});fs['writeFileSync'](util['format'](_0x16ff('0x61'),_0x2d88eb[_0x16ff('0x50')][_0x16ff('0x36')]['toLowerCase']()),_0x133bd5);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x30'),{'module':_0x16ff('0x63')});}return null;})['then'](function(_0x2a8e15){if(_0x2a8e15){return _0x1cc438;}return null;});})['then'](respondWithResult(_0x1c3077,null))[_0x16ff('0x24')](handleError(_0x1c3077,null));};exports[_0x16ff('0x65')]=function(_0x2412c6,_0x2ba0b1,_0xe7cd3d){var _0x1a7e21;return db[_0x16ff('0x35')]['find']({'where':{'id':_0x2412c6['params']['id']}})[_0x16ff('0x31')](function(_0x4f9c42){_0x1a7e21=_0x4f9c42;return _0x4f9c42;})[_0x16ff('0x31')](handleEntityNotFound(_0x2ba0b1,null))['then'](removeEntity(_0x2ba0b1,null))['then'](function(){if(_0x1a7e21){return db[_0x16ff('0x35')][_0x16ff('0x49')]({'where':{'type':_0x1a7e21['type']},'raw':!![]});}})[_0x16ff('0x31')](function(_0x3ba995){if(_0x1a7e21[_0x16ff('0x36')][_0x16ff('0x51')]()==_0x16ff('0x52')){var _0x19e2c4=fs[_0x16ff('0x53')](path['join'](config[_0x16ff('0x5c')],_0x16ff('0x66')),'utf8');var _0x5e1cc4=ejs[_0x16ff('0x56')](_0x19e2c4,{'networks':_0x3ba995||[]});fs[_0x16ff('0x57')](_0x16ff('0x58'),_0x5e1cc4);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x65'),{'module':_0x16ff('0x5a')});}else if(_0x1a7e21[_0x16ff('0x36')]['toUpperCase']()==_0x16ff('0x5b')){var _0x1c1382=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config[_0x16ff('0x5c')],_0x16ff('0x5d')),'utf8');var _0x37f02e=ejs[_0x16ff('0x56')](_0x1c1382,{'networks':_0x3ba995||[]});fs[_0x16ff('0x57')]('/etc/asterisk/turn_xcally.conf',_0x37f02e);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x65'),{'module':_0x16ff('0x5a')});}else{var _0x17596b=fs[_0x16ff('0x53')](path[_0x16ff('0x54')](config['root'],'server/files/templates/network.ejs'),_0x16ff('0x55'));var _0x311039=ejs['render'](_0x17596b,{'networks':_0x3ba995||[]});fs['writeFileSync'](util[_0x16ff('0x60')]('/etc/asterisk/sip_xcally_%s.conf',_0x2412c6[_0x16ff('0x50')][_0x16ff('0x36')]['toLowerCase']()),_0x311039);return respondWithRpcPromise(_0x16ff('0x59'),_0x16ff('0x65'),{'module':'chan_sip.so'});}return null;})[_0x16ff('0x24')](handleError(_0x2ba0b1,null));}; \ No newline at end of file +var _0xb534=['fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','include','findAll','show','params','keys','includeAll','find','create','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','toLowerCase','chan_sip.so','update','server/files/templates/turn_multiple.ejs','/etc/asterisk/sip_xcally_%s.conf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','undefined','offset','limit','set','Content-Range','json','save','destroy','stack','name','send','index','Network','rawAttributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb534,0x16e));var _0x4b53=function(_0x1c861e,_0x4a7b3b){_0x1c861e=_0x1c861e-0x0;var _0x4f4c9f=_0xb534[_0x1c861e];return _0x4f4c9f;};'use strict';var emlformat=require(_0x4b53('0x0'));var rimraf=require(_0x4b53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b53('0x2'));var rp=require(_0x4b53('0x3'));var moment=require('moment');var BPromise=require(_0x4b53('0x4'));var Mustache=require(_0x4b53('0x5'));var util=require(_0x4b53('0x6'));var path=require(_0x4b53('0x7'));var sox=require(_0x4b53('0x8'));var csv=require(_0x4b53('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b53('0xa'));var _=require(_0x4b53('0xb'));var squel=require(_0x4b53('0xc'));var crypto=require(_0x4b53('0xd'));var jsforce=require(_0x4b53('0xe'));var deskjs=require(_0x4b53('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b53('0x10'));var Papa=require(_0x4b53('0x11'));var Redis=require(_0x4b53('0x12'));var authService=require(_0x4b53('0x13'));var qs=require(_0x4b53('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b53('0x15'));var logger=require('../../config/logger')(_0x4b53('0x16'));var utils=require('../../config/utils');var config=require(_0x4b53('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b53('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x4b53('0x19')][_0x4b53('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4d8b69,_0x534685,_0x32229c,_0x581a61){return new BPromise(function(_0x4d2bb6,_0x360a41){var _0x2e0fec=_0x581a61||client;return _0x2e0fec[_0x4b53('0x1b')](_0x4d8b69,_0x32229c)[_0x4b53('0x1c')](function(_0x4c5c1e){logger[_0x4b53('0x1d')](_0x4b53('0x1e'),_0x534685,_0x4b53('0x1f'));logger[_0x4b53('0x20')]('Network,\x20%s,\x20%s,\x20%s',_0x534685,'request\x20sent',JSON['stringify'](_0x4c5c1e));if(_0x4c5c1e[_0x4b53('0x21')]){if(_0x4c5c1e[_0x4b53('0x21')][_0x4b53('0x22')]===0x1f4){logger[_0x4b53('0x21')]('Network,\x20%s,\x20%s',_0x534685,_0x4c5c1e[_0x4b53('0x21')]['message']);return _0x360a41(_0x4c5c1e[_0x4b53('0x21')][_0x4b53('0x23')]);}logger[_0x4b53('0x21')](_0x4b53('0x1e'),_0x534685,_0x4c5c1e['error'][_0x4b53('0x23')]);return _0x4d2bb6(_0x4c5c1e[_0x4b53('0x21')][_0x4b53('0x23')]);}else{logger[_0x4b53('0x1d')](_0x4b53('0x1e'),_0x534685,'request\x20sent');_0x4d2bb6(_0x4c5c1e[_0x4b53('0x24')][_0x4b53('0x23')]);}})[_0x4b53('0x25')](function(_0x35e119){logger['error'](_0x4b53('0x1e'),_0x534685,_0x35e119);_0x360a41(_0x35e119);});});}function respondWithStatusCode(_0x668268,_0x3fe92d){_0x3fe92d=_0x3fe92d||0xcc;return function(_0x1ad821){if(_0x1ad821){return _0x668268[_0x4b53('0x26')](_0x3fe92d);}return _0x668268[_0x4b53('0x27')](_0x3fe92d)['end']();};}function respondWithResult(_0x42eff8,_0x285868){_0x285868=_0x285868||0xc8;return function(_0x24ee8d){if(_0x24ee8d){return _0x42eff8['status'](_0x285868)['json'](_0x24ee8d);}};}function respondWithFilteredResult(_0x4193b7,_0x42e011){return function(_0x56e9cc){if(_0x56e9cc){var _0x2f21f1=typeof _0x42e011['offset']==='undefined'&&typeof _0x42e011['limit']===_0x4b53('0x28');var _0x4fbd57=_0x56e9cc['count'];var _0x3239d5=_0x2f21f1?0x0:_0x42e011['offset'];var _0x1ce948=_0x2f21f1?_0x56e9cc['count']:_0x42e011[_0x4b53('0x29')]+_0x42e011[_0x4b53('0x2a')];var _0x5af14c;if(_0x1ce948>=_0x4fbd57){_0x1ce948=_0x4fbd57;_0x5af14c=0xc8;}else{_0x5af14c=0xce;}_0x4193b7[_0x4b53('0x27')](_0x5af14c);return _0x4193b7[_0x4b53('0x2b')](_0x4b53('0x2c'),_0x3239d5+'-'+_0x1ce948+'/'+_0x4fbd57)[_0x4b53('0x2d')](_0x56e9cc);}return null;};}function patchUpdates(_0x2a679f){return function(_0xd46c){try{jsonpatch['apply'](_0xd46c,_0x2a679f,!![]);}catch(_0x2e2e4f){return BPromise['reject'](_0x2e2e4f);}return _0xd46c[_0x4b53('0x2e')]();};}function saveUpdates(_0x59b582,_0x3db39f){return function(_0x246648){if(_0x246648){return _0x246648['update'](_0x59b582)['then'](function(_0x26e1f5){return _0x26e1f5;});}return null;};}function removeEntity(_0x29618b,_0xf66539){return function(_0x3e88a8){if(_0x3e88a8){return _0x3e88a8[_0x4b53('0x2f')]()[_0x4b53('0x1c')](function(){_0x29618b[_0x4b53('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a016f,_0x2d8f5d){return function(_0xa03f2a){if(!_0xa03f2a){_0x2a016f[_0x4b53('0x26')](0x194);}return _0xa03f2a;};}function handleError(_0x1595c2,_0x423eb6){_0x423eb6=_0x423eb6||0x1f4;return function(_0xa12c10){logger[_0x4b53('0x21')](_0xa12c10[_0x4b53('0x30')]);if(_0xa12c10[_0x4b53('0x31')]){delete _0xa12c10[_0x4b53('0x31')];}_0x1595c2[_0x4b53('0x27')](_0x423eb6)[_0x4b53('0x32')](_0xa12c10);};}exports[_0x4b53('0x33')]=function(_0x275f37,_0x27dd99){var _0x2d6627={},_0x81f684={},_0x1f84e5={'count':0x0,'rows':[]};var _0x327056=_['map'](db[_0x4b53('0x34')][_0x4b53('0x35')],function(_0x3d41ba){return{'name':_0x3d41ba[_0x4b53('0x36')],'type':_0x3d41ba[_0x4b53('0x37')][_0x4b53('0x38')]};});_0x81f684[_0x4b53('0x39')]=_['map'](_0x327056,_0x4b53('0x31'));_0x81f684['query']=_['keys'](_0x275f37[_0x4b53('0x3a')]);_0x81f684[_0x4b53('0x3b')]=_[_0x4b53('0x3c')](_0x81f684[_0x4b53('0x39')],_0x81f684['query']);_0x2d6627[_0x4b53('0x3d')]=_['intersection'](_0x81f684[_0x4b53('0x39')],qs['fields'](_0x275f37['query'][_0x4b53('0x3e')]));_0x2d6627[_0x4b53('0x3d')]=_0x2d6627[_0x4b53('0x3d')][_0x4b53('0x3f')]?_0x2d6627['attributes']:_0x81f684[_0x4b53('0x39')];if(!_0x275f37[_0x4b53('0x3a')]['hasOwnProperty'](_0x4b53('0x40'))){_0x2d6627[_0x4b53('0x2a')]=qs[_0x4b53('0x2a')](_0x275f37[_0x4b53('0x3a')]['limit']);_0x2d6627[_0x4b53('0x29')]=qs[_0x4b53('0x29')](_0x275f37[_0x4b53('0x3a')][_0x4b53('0x29')]);}_0x2d6627[_0x4b53('0x41')]=qs[_0x4b53('0x42')](_0x275f37[_0x4b53('0x3a')][_0x4b53('0x42')]);_0x2d6627[_0x4b53('0x43')]=qs[_0x4b53('0x3b')](_[_0x4b53('0x44')](_0x275f37[_0x4b53('0x3a')],_0x81f684[_0x4b53('0x3b')]),_0x327056);if(_0x275f37[_0x4b53('0x3a')][_0x4b53('0x45')]){_0x2d6627[_0x4b53('0x43')]=_[_0x4b53('0x46')](_0x2d6627[_0x4b53('0x43')],{'$or':_[_0x4b53('0x47')](_0x327056,function(_0x246284){if(_0x246284[_0x4b53('0x37')]!==_0x4b53('0x48')){var _0x3680fc={};_0x3680fc[_0x246284[_0x4b53('0x31')]]={'$like':'%'+_0x275f37[_0x4b53('0x3a')]['filter']+'%'};return _0x3680fc;}})});}_0x2d6627=_[_0x4b53('0x46')]({},_0x2d6627,_0x275f37[_0x4b53('0x49')]);var _0x2edee1={'where':_0x2d6627[_0x4b53('0x43')]};return db[_0x4b53('0x34')][_0x4b53('0x4a')](_0x2edee1)[_0x4b53('0x1c')](function(_0x44a216){_0x1f84e5[_0x4b53('0x4a')]=_0x44a216;if(_0x275f37[_0x4b53('0x3a')]['includeAll']){_0x2d6627[_0x4b53('0x4b')]=[{'all':!![]}];}return db[_0x4b53('0x34')][_0x4b53('0x4c')](_0x2d6627);})[_0x4b53('0x1c')](function(_0x74f02b){_0x1f84e5['rows']=_0x74f02b;return _0x1f84e5;})[_0x4b53('0x1c')](respondWithFilteredResult(_0x27dd99,_0x2d6627))['catch'](handleError(_0x27dd99,null));};exports[_0x4b53('0x4d')]=function(_0x58f05d,_0x2cd63a){var _0x457227={'raw':!![],'where':{'id':_0x58f05d[_0x4b53('0x4e')]['id']}},_0x5b4ab0={};_0x5b4ab0[_0x4b53('0x39')]=_[_0x4b53('0x4f')](db[_0x4b53('0x34')][_0x4b53('0x35')]);_0x5b4ab0[_0x4b53('0x3a')]=_['keys'](_0x58f05d[_0x4b53('0x3a')]);_0x5b4ab0['filters']=_[_0x4b53('0x3c')](_0x5b4ab0[_0x4b53('0x39')],_0x5b4ab0[_0x4b53('0x3a')]);_0x457227[_0x4b53('0x3d')]=_[_0x4b53('0x3c')](_0x5b4ab0['model'],qs['fields'](_0x58f05d[_0x4b53('0x3a')][_0x4b53('0x3e')]));_0x457227['attributes']=_0x457227['attributes'][_0x4b53('0x3f')]?_0x457227[_0x4b53('0x3d')]:_0x5b4ab0[_0x4b53('0x39')];if(_0x58f05d[_0x4b53('0x3a')][_0x4b53('0x50')]){_0x457227['include']=[{'all':!![]}];}_0x457227=_['merge']({},_0x457227,_0x58f05d[_0x4b53('0x49')]);return db[_0x4b53('0x34')][_0x4b53('0x51')](_0x457227)['then'](handleEntityNotFound(_0x2cd63a,null))['then'](respondWithResult(_0x2cd63a,null))[_0x4b53('0x25')](handleError(_0x2cd63a,null));};exports[_0x4b53('0x52')]=function(_0x1ec800,_0x4087d0,_0x1d06b9){var _0x35c2be;return db['sequelize'][_0x4b53('0x53')](function(_0x46c16f){return db[_0x4b53('0x34')][_0x4b53('0x52')](_0x1ec800[_0x4b53('0x54')],{'raw':!![]})[_0x4b53('0x1c')](function(_0x655fb5){_0x35c2be=_0x655fb5;return db[_0x4b53('0x34')][_0x4b53('0x4c')]({'where':{'type':_0x1ec800['body'][_0x4b53('0x37')]},'raw':!![]});})[_0x4b53('0x1c')](function(_0x2b6029){if(_0x35c2be[_0x4b53('0x37')][_0x4b53('0x55')]()==_0x4b53('0x56')){var _0x3f8f14=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config[_0x4b53('0x59')],_0x4b53('0x5a')),_0x4b53('0x5b'));var _0x4d0b57=ejs[_0x4b53('0x5c')](_0x3f8f14,{'networks':_0x2b6029||[]});fs[_0x4b53('0x5d')](_0x4b53('0x5e'),_0x4d0b57);return respondWithRpcPromise(_0x4b53('0x5f'),_0x4b53('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x35c2be[_0x4b53('0x37')]['toUpperCase']()==_0x4b53('0x60')){var _0x4a092b=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x3a6bec=ejs[_0x4b53('0x5c')](_0x4a092b,{'networks':_0x2b6029||[]});fs['writeFileSync'](_0x4b53('0x61'),_0x3a6bec);return respondWithRpcPromise('Reload','create',{'module':_0x4b53('0x62')});}else{var _0x38eb12=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config[_0x4b53('0x59')],_0x4b53('0x63')),_0x4b53('0x5b'));var _0x3428ba=ejs[_0x4b53('0x5c')](_0x38eb12,{'networks':_0x2b6029||[]});fs[_0x4b53('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1ec800[_0x4b53('0x54')][_0x4b53('0x37')][_0x4b53('0x64')]()),_0x3428ba);return respondWithRpcPromise('Reload',_0x4b53('0x52'),{'module':_0x4b53('0x65')});}return null;})[_0x4b53('0x1c')](function(){return _0x35c2be;});})[_0x4b53('0x1c')](respondWithResult(_0x4087d0,0xc9))['catch'](handleError(_0x4087d0,null));};exports[_0x4b53('0x66')]=function(_0x15004e,_0x336186,_0x9f26fa){var _0x27c17c;return db['sequelize'][_0x4b53('0x53')](function(_0x2bfce9){return db[_0x4b53('0x34')][_0x4b53('0x51')]({'where':{'id':_0x15004e[_0x4b53('0x4e')]['id']}})[_0x4b53('0x1c')](handleEntityNotFound(_0x336186,null))[_0x4b53('0x1c')](saveUpdates(_0x15004e['body'],null))['then'](function(_0x346ca0){if(_0x346ca0){_0x27c17c=_0x346ca0;return db[_0x4b53('0x34')][_0x4b53('0x4c')]({'where':{'type':_0x27c17c[_0x4b53('0x37')]},'raw':!![]});}return null;})[_0x4b53('0x1c')](function(_0x39a70d){if(_0x27c17c[_0x4b53('0x37')][_0x4b53('0x55')]()==_0x4b53('0x56')){var _0x29a3b4=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config['root'],_0x4b53('0x5a')),'utf8');var _0x286b7f=ejs[_0x4b53('0x5c')](_0x29a3b4,{'networks':_0x39a70d||[]});fs[_0x4b53('0x5d')](_0x4b53('0x5e'),_0x286b7f);return respondWithRpcPromise(_0x4b53('0x5f'),_0x4b53('0x66'),{'module':_0x4b53('0x62')});}else if(_0x27c17c[_0x4b53('0x37')][_0x4b53('0x55')]()==_0x4b53('0x60')){var _0x2181f4=fs['readFileSync'](path['join'](config[_0x4b53('0x59')],_0x4b53('0x67')),'utf8');var _0x44019c=ejs[_0x4b53('0x5c')](_0x2181f4,{'networks':_0x39a70d||[]});fs['writeFileSync'](_0x4b53('0x61'),_0x44019c);return respondWithRpcPromise(_0x4b53('0x5f'),_0x4b53('0x66'),{'module':'res_stun_monitor.so'});}else{var _0x52970a=fs[_0x4b53('0x57')](path['join'](config[_0x4b53('0x59')],_0x4b53('0x63')),'utf8');var _0x1d6ab1=ejs[_0x4b53('0x5c')](_0x52970a,{'networks':_0x39a70d||[]});fs[_0x4b53('0x5d')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x15004e['body']['type'][_0x4b53('0x64')]()),_0x1d6ab1);return respondWithRpcPromise('Reload',_0x4b53('0x66'),{'module':'chan_sip.so'});}return null;})[_0x4b53('0x1c')](function(_0x4eaf21){if(_0x4eaf21){return _0x27c17c;}return null;});})[_0x4b53('0x1c')](respondWithResult(_0x336186,null))[_0x4b53('0x25')](handleError(_0x336186,null));};exports[_0x4b53('0x2f')]=function(_0x47770c,_0x2a5f44,_0x4f11ba){var _0x2a7b8a;return db[_0x4b53('0x34')]['find']({'where':{'id':_0x47770c['params']['id']}})['then'](function(_0x44e55c){_0x2a7b8a=_0x44e55c;return _0x44e55c;})[_0x4b53('0x1c')](handleEntityNotFound(_0x2a5f44,null))[_0x4b53('0x1c')](removeEntity(_0x2a5f44,null))[_0x4b53('0x1c')](function(){if(_0x2a7b8a){return db['Network'][_0x4b53('0x4c')]({'where':{'type':_0x2a7b8a[_0x4b53('0x37')]},'raw':!![]});}})['then'](function(_0x33d953){if(_0x2a7b8a['type'][_0x4b53('0x55')]()=='STUN'){var _0x2f39e7=fs['readFileSync'](path[_0x4b53('0x58')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x4b53('0x5b'));var _0x2a5f7d=ejs['render'](_0x2f39e7,{'networks':_0x33d953||[]});fs[_0x4b53('0x5d')](_0x4b53('0x5e'),_0x2a5f7d);return respondWithRpcPromise(_0x4b53('0x5f'),_0x4b53('0x2f'),{'module':'res_stun_monitor.so'});}else if(_0x2a7b8a['type'][_0x4b53('0x55')]()==_0x4b53('0x60')){var _0x46ecc4=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config[_0x4b53('0x59')],_0x4b53('0x67')),_0x4b53('0x5b'));var _0x6ba635=ejs[_0x4b53('0x5c')](_0x46ecc4,{'networks':_0x33d953||[]});fs['writeFileSync'](_0x4b53('0x61'),_0x6ba635);return respondWithRpcPromise('Reload','destroy',{'module':'res_stun_monitor.so'});}else{var _0x2aa84c=fs[_0x4b53('0x57')](path[_0x4b53('0x58')](config['root'],_0x4b53('0x63')),_0x4b53('0x5b'));var _0x17918f=ejs[_0x4b53('0x5c')](_0x2aa84c,{'networks':_0x33d953||[]});fs[_0x4b53('0x5d')](util['format'](_0x4b53('0x68'),_0x47770c['body']['type'][_0x4b53('0x64')]()),_0x17918f);return respondWithRpcPromise(_0x4b53('0x5f'),_0x4b53('0x2f'),{'module':_0x4b53('0x65')});}return null;})[_0x4b53('0x25')](handleError(_0x2a5f44,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 967d40d..dabe174 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 _0x2f3a=['api','moment','bluebird','request-promise','path','rimraf','./network.attributes','network','lodash'];(function(_0x2d3d18,_0x475f4c){var _0x202f49=function(_0x41abb5){while(--_0x41abb5){_0x2d3d18['push'](_0x2d3d18['shift']());}};_0x202f49(++_0x475f4c);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x4ddd98,_0x143a31){_0x4ddd98=_0x4ddd98-0x0;var _0x474036=_0x2f3a[_0x4ddd98];return _0x474036;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa2f3('0x1'));var moment=require(_0xa2f3('0x2'));var BPromise=require(_0xa2f3('0x3'));var rp=require(_0xa2f3('0x4'));var fs=require('fs');var path=require(_0xa2f3('0x5'));var rimraf=require(_0xa2f3('0x6'));var config=require('../../config/environment');var attributes=require(_0xa2f3('0x7'));module['exports']=function(_0xfe0b09,_0x1ddec0){return _0xfe0b09['define']('Network',attributes,{'tableName':_0xa2f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9b=['rimraf','./network.attributes','Network','network','util','../../config/logger','moment','request-promise','path'];(function(_0x53db8b,_0x1d4e89){var _0x5352e6=function(_0x4a493f){while(--_0x4a493f){_0x53db8b['push'](_0x53db8b['shift']());}};_0x5352e6(++_0x1d4e89);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x3a5105,_0x11f35c){_0x3a5105=_0x3a5105-0x0;var _0x53633f=_0x9d9b[_0x3a5105];return _0x53633f;};'use strict';var _=require('lodash');var util=require(_0xb9d9('0x0'));var logger=require(_0xb9d9('0x1'))('api');var moment=require(_0xb9d9('0x2'));var BPromise=require('bluebird');var rp=require(_0xb9d9('0x3'));var fs=require('fs');var path=require(_0xb9d9('0x4'));var rimraf=require(_0xb9d9('0x5'));var config=require('../../config/environment');var attributes=require(_0xb9d9('0x6'));module['exports']=function(_0x1b1f3c,_0x32cf18){return _0x1b1f3c['define'](_0xb9d9('0x7'),attributes,{'tableName':_0xb9d9('0x8'),'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 3b9f5f7..50063a2 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(_0x4ceae8,_0x30fe75){var _0x307862=function(_0x3c8247){while(--_0x3c8247){_0x4ceae8['push'](_0x4ceae8['shift']());}};_0x307862(++_0x30fe75);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 _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(_0x12e316,_0x3a5522){var _0x2380c2=function(_0x4a6885){while(--_0x4a6885){_0x12e316['push'](_0x12e316['shift']());}};_0x2380c2(++_0x3a5522);}(_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 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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 05bf55c..18c6873 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 _0xf153=['../../config/environment','/describe','isAuthenticated','describe','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','post','/:id/dispositions','addDisposition','/:id/notify','notify','addApplications','/:id/users','addAgents','/:id/send','send','update','destroy','removeDispositions','delete','removeAgents','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xf153,0x1f3));var _0x3f15=function(_0x30f69c,_0xd71a3b){_0x30f69c=_0x30f69c-0x0;var _0x2c3cdf=_0xf153[_0x30f69c];return _0x2c3cdf;};'use strict';var multer=require(_0x3f15('0x0'));var util=require('util');var path=require(_0x3f15('0x1'));var timeout=require('connect-timeout');var express=require(_0x3f15('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3f15('0x3'));var interaction=require(_0x3f15('0x4'));var config=require(_0x3f15('0x5'));var controller=require('./openchannelAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3f15('0x6'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x8')]);router[_0x3f15('0x9')](_0x3f15('0xa'),auth[_0x3f15('0x7')](),controller[_0x3f15('0xb')]);router[_0x3f15('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x3f15('0xc')]);router[_0x3f15('0x9')](_0x3f15('0xd'),auth[_0x3f15('0x7')](),controller[_0x3f15('0xe')]);router[_0x3f15('0x9')](_0x3f15('0xf'),auth['isAuthenticated'](),controller[_0x3f15('0x10')]);router['get'](_0x3f15('0x11'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x12')]);router[_0x3f15('0x9')]('/:id/users',auth[_0x3f15('0x7')](),controller[_0x3f15('0x13')]);router[_0x3f15('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3f15('0x15'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x16')]);router[_0x3f15('0x14')](_0x3f15('0xd'),auth[_0x3f15('0x7')](),controller['addAnswer']);router[_0x3f15('0x14')](_0x3f15('0x17'),controller[_0x3f15('0x18')]);router[_0x3f15('0x14')](_0x3f15('0xf'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x19')]);router['post'](_0x3f15('0x1a'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x1b')]);router[_0x3f15('0x14')](_0x3f15('0x1c'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x1d')]);router['put'](_0x3f15('0xa'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x1e')]);router['delete'](_0x3f15('0xa'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x1f')]);router['delete'](_0x3f15('0x15'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x20')]);router['delete'](_0x3f15('0xd'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3f15('0x21')](_0x3f15('0x1a'),auth[_0x3f15('0x7')](),controller[_0x3f15('0x22')]);module[_0x3f15('0x23')]=router; \ No newline at end of file +var _0x114d=['get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','send','delete','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller'];(function(_0x27e986,_0x5d626d){var _0x3240d8=function(_0x3fe04d){while(--_0x3fe04d){_0x27e986['push'](_0x27e986['shift']());}};_0x3240d8(++_0x5d626d);}(_0x114d,0x12e));var _0xd114=function(_0x390eee,_0x14872e){_0x390eee=_0x390eee-0x0;var _0x2aa4cb=_0x114d[_0x390eee];return _0x2aa4cb;};'use strict';var multer=require('multer');var util=require(_0xd114('0x0'));var path=require(_0xd114('0x1'));var timeout=require(_0xd114('0x2'));var express=require(_0xd114('0x3'));var router=express[_0xd114('0x4')]();var fs_extra=require(_0xd114('0x5'));var auth=require(_0xd114('0x6'));var interaction=require(_0xd114('0x7'));var config=require(_0xd114('0x8'));var controller=require(_0xd114('0x9'));router[_0xd114('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd114('0xa')](_0xd114('0xb'),auth[_0xd114('0xc')](),controller[_0xd114('0xd')]);router[_0xd114('0xa')](_0xd114('0xe'),auth[_0xd114('0xc')](),controller[_0xd114('0xf')]);router['get'](_0xd114('0x10'),auth[_0xd114('0xc')](),controller[_0xd114('0x11')]);router['get'](_0xd114('0x12'),auth[_0xd114('0xc')](),controller[_0xd114('0x13')]);router[_0xd114('0xa')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xd114('0xa')](_0xd114('0x14'),auth[_0xd114('0xc')](),controller[_0xd114('0x15')]);router['get'](_0xd114('0x16'),auth[_0xd114('0xc')](),controller[_0xd114('0x17')]);router[_0xd114('0x18')]('/',auth[_0xd114('0xc')](),controller[_0xd114('0x19')]);router['post'](_0xd114('0x10'),auth[_0xd114('0xc')](),controller[_0xd114('0x1a')]);router['post'](_0xd114('0x12'),auth['isAuthenticated'](),controller[_0xd114('0x1b')]);router[_0xd114('0x18')](_0xd114('0x1c'),controller[_0xd114('0x1d')]);router[_0xd114('0x18')](_0xd114('0x1e'),auth['isAuthenticated'](),controller[_0xd114('0x1f')]);router[_0xd114('0x18')]('/:id/users',auth[_0xd114('0xc')](),controller[_0xd114('0x20')]);router['post'](_0xd114('0x21'),auth['isAuthenticated'](),controller[_0xd114('0x22')]);router['put'](_0xd114('0xe'),auth[_0xd114('0xc')](),controller['update']);router['delete'](_0xd114('0xe'),auth[_0xd114('0xc')](),controller['destroy']);router[_0xd114('0x23')](_0xd114('0x10'),auth[_0xd114('0xc')](),controller[_0xd114('0x24')]);router[_0xd114('0x23')](_0xd114('0x12'),auth[_0xd114('0xc')](),controller[_0xd114('0x25')]);router[_0xd114('0x23')](_0xd114('0x16'),auth['isAuthenticated'](),controller[_0xd114('0x26')]);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 f3f664b..8fc6703 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 _0xa14a=['STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','name','generate'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xa14a,0x13c));var _0xaa14=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xa14a[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0xaa14('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xaa14('0x1'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xaa14('0x2')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xaa14('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xaa14('0x4')],'defaultValue':function(){return _0xaa14('0x5');}},'notificationSound':{'type':Sequelize[_0xaa14('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaa14('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaa14('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xaa14('0x3')]},'queueTransfer':{'type':Sequelize[_0xaa14('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaa14('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaa14('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xaa14('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xaa14('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7cf38a){if(!_0x7cf38a)this[_0xaa14('0x9')](_0xaa14('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x7cf38a);}}}; \ No newline at end of file +var _0xe993=['STRING','name','generate','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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports'];(function(_0xfc0f3c,_0x16122b){var _0x18d720=function(_0x59a4d9){while(--_0x59a4d9){_0xfc0f3c['push'](_0xfc0f3c['shift']());}};_0x18d720(++_0x16122b);}(_0xe993,0xe8));var _0x3e99=function(_0x64b3e0,_0x234fe4){_0x64b3e0=_0x64b3e0-0x0;var _0x4699be=_0xe993[_0x64b3e0];return _0x4699be;};'use strict';var Sequelize=require(_0x3e99('0x0'));var rs=require('randomstring');module[_0x3e99('0x1')]={'name':{'type':Sequelize[_0x3e99('0x2')],'unique':_0x3e99('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3e99('0x2')]},'token':{'type':Sequelize[_0x3e99('0x2')],'defaultValue':function(){return rs[_0x3e99('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x3e99('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3e99('0x5')],'defaultValue':function(){return _0x3e99('0x6');}},'notificationSound':{'type':Sequelize[_0x3e99('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e99('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e99('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3e99('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x3e99('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x3e99('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x107a21){if(!_0x107a21)this['setDataValue'](_0x3e99('0xa'),null);this[_0x3e99('0xb')](_0x3e99('0xc'),_0x107a21);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index f9d9438..f4bc460 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 _0xb5d6=['fieldName','type','key','query','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','OpenchannelAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','create','body','user','role','userProfileId','autoAssociation','update','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','length','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','openchannel','CmContact','Sequelize','ValidationError','difference','updatedAt','createdAt','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','firstName','lastName','OpenchannelInteraction','threadId','externalUrl','ContactId','contact','messageId','interaction','created','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','OpenchannelMessage','spread','dataValues','Messages','push','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','then','destroy','get','OpenchannelAccounts','stack','name','send','index','Pause','map','rawAttributes'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0xb5d6,0x7c));var _0x6b5d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb5d6[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x6b5d('0x0'));var rimraf=require(_0x6b5d('0x1'));var zipdir=require(_0x6b5d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6b5d('0x4'));var util=require(_0x6b5d('0x5'));var path=require(_0x6b5d('0x6'));var sox=require(_0x6b5d('0x7'));var csv=require(_0x6b5d('0x8'));var ejs=require(_0x6b5d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b5d('0xa'));var squel=require(_0x6b5d('0xb'));var crypto=require(_0x6b5d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b5d('0x8'));var querystring=require(_0x6b5d('0xd'));var Papa=require(_0x6b5d('0xe'));var Redis=require(_0x6b5d('0xf'));var authService=require(_0x6b5d('0x10'));var qs=require(_0x6b5d('0x11'));var as=require(_0x6b5d('0x12'));var hardwareService=require(_0x6b5d('0x13'));var logger=require(_0x6b5d('0x14'))(_0x6b5d('0x15'));var utils=require('../../config/utils');var config=require(_0x6b5d('0x16'));var licenseUtil=require(_0x6b5d('0x17'));var db=require(_0x6b5d('0x18'))['db'];config[_0x6b5d('0x19')]=_[_0x6b5d('0x1a')](config['redis'],{'host':_0x6b5d('0x1b'),'port':0x18eb});var socket=require(_0x6b5d('0x1c'))(new Redis(config['redis']));require(_0x6b5d('0x1d'))[_0x6b5d('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6b5d('0x1f')][_0x6b5d('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x563b62,_0x4d6c52,_0x415fd3,_0x374d4b){return new BPromise(function(_0x5b0665,_0x3a07e0){var _0x8c06e8=_0x374d4b||client;return _0x8c06e8[_0x6b5d('0x21')](_0x563b62,_0x415fd3)['then'](function(_0x4dbed1){logger[_0x6b5d('0x22')](_0x6b5d('0x23'),_0x4d6c52,_0x6b5d('0x24'));logger['debug'](_0x6b5d('0x25'),_0x4d6c52,_0x6b5d('0x24'),JSON[_0x6b5d('0x26')](_0x4dbed1));if(_0x4dbed1[_0x6b5d('0x27')]){if(_0x4dbed1['error'][_0x6b5d('0x28')]===0x1f4){logger[_0x6b5d('0x27')](_0x6b5d('0x23'),_0x4d6c52,_0x4dbed1['error'][_0x6b5d('0x29')]);return _0x3a07e0(_0x4dbed1[_0x6b5d('0x27')][_0x6b5d('0x29')]);}logger[_0x6b5d('0x27')](_0x6b5d('0x23'),_0x4d6c52,_0x4dbed1[_0x6b5d('0x27')][_0x6b5d('0x29')]);return _0x5b0665(_0x4dbed1['error'][_0x6b5d('0x29')]);}else{logger['info'](_0x6b5d('0x23'),_0x4d6c52,_0x6b5d('0x24'));_0x5b0665(_0x4dbed1[_0x6b5d('0x2a')][_0x6b5d('0x29')]);}})[_0x6b5d('0x2b')](function(_0x10e4fd){logger[_0x6b5d('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x4d6c52,_0x10e4fd);_0x3a07e0(_0x10e4fd);});});}function respondWithStatusCode(_0x2270a8,_0x4ed0e6){_0x4ed0e6=_0x4ed0e6||0xcc;return function(_0x7d8030){if(_0x7d8030){return _0x2270a8[_0x6b5d('0x2c')](_0x4ed0e6);}return _0x2270a8['status'](_0x4ed0e6)[_0x6b5d('0x2d')]();};}function respondWithResult(_0x323e24,_0x1443d6){_0x1443d6=_0x1443d6||0xc8;return function(_0x9dd25b){if(_0x9dd25b){return _0x323e24['status'](_0x1443d6)[_0x6b5d('0x2e')](_0x9dd25b);}};}function respondWithFilteredResult(_0x33ac14,_0x3ba594){return function(_0xc63fb3){if(_0xc63fb3){var _0x1c33a2=typeof _0x3ba594[_0x6b5d('0x2f')]===_0x6b5d('0x30')&&typeof _0x3ba594[_0x6b5d('0x31')]==='undefined';var _0x59b38c=_0xc63fb3['count'];var _0x5c4f8b=_0x1c33a2?0x0:_0x3ba594[_0x6b5d('0x2f')];var _0x7bf03e=_0x1c33a2?_0xc63fb3[_0x6b5d('0x32')]:_0x3ba594[_0x6b5d('0x2f')]+_0x3ba594[_0x6b5d('0x31')];var _0x1f1a77;if(_0x7bf03e>=_0x59b38c){_0x7bf03e=_0x59b38c;_0x1f1a77=0xc8;}else{_0x1f1a77=0xce;}_0x33ac14[_0x6b5d('0x33')](_0x1f1a77);return _0x33ac14[_0x6b5d('0x34')]('Content-Range',_0x5c4f8b+'-'+_0x7bf03e+'/'+_0x59b38c)[_0x6b5d('0x2e')](_0xc63fb3);}return null;};}function patchUpdates(_0x275993){return function(_0x136777){try{jsonpatch[_0x6b5d('0x35')](_0x136777,_0x275993,!![]);}catch(_0x5585fc){return BPromise[_0x6b5d('0x36')](_0x5585fc);}return _0x136777[_0x6b5d('0x37')]();};}function saveUpdates(_0x179a9b,_0xb51d0d){return function(_0x2285f3){if(_0x2285f3){return _0x2285f3['update'](_0x179a9b)[_0x6b5d('0x38')](function(_0x12a49e){return _0x12a49e;});}return null;};}function removeEntity(_0x53a5a2,_0x453380){return function(_0x5e6415){if(_0x5e6415){return _0x5e6415[_0x6b5d('0x39')]()[_0x6b5d('0x38')](function(){var _0x361523=_0x5e6415[_0x6b5d('0x3a')]({'plain':!![]});var _0x15f611=_0x6b5d('0x3b');return db['UserProfileResource'][_0x6b5d('0x39')]({'where':{'type':_0x15f611,'resourceId':_0x361523['id']}})[_0x6b5d('0x38')](function(){return _0x5e6415;});})[_0x6b5d('0x38')](function(){_0x53a5a2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ffb18,_0x1ef1bb){return function(_0x4fc422){if(!_0x4fc422){_0x4ffb18[_0x6b5d('0x2c')](0x194);}return _0x4fc422;};}function handleError(_0x4a2324,_0x29210a){_0x29210a=_0x29210a||0x1f4;return function(_0x51ca9f){logger[_0x6b5d('0x27')](_0x51ca9f[_0x6b5d('0x3c')]);if(_0x51ca9f[_0x6b5d('0x3d')]){delete _0x51ca9f[_0x6b5d('0x3d')];}_0x4a2324[_0x6b5d('0x33')](_0x29210a)[_0x6b5d('0x3e')](_0x51ca9f);};}exports[_0x6b5d('0x3f')]=function(_0x5478f8,_0x4b7e8b){var _0x5614a8={'include':[{'model':db[_0x6b5d('0x40')],'as':'mandatoryDispositionPause'}]},_0x582cd3={},_0x1424af={'count':0x0,'rows':[]};var _0x2bea5d=_[_0x6b5d('0x41')](db['OpenchannelAccount'][_0x6b5d('0x42')],function(_0x1e8744){return{'name':_0x1e8744[_0x6b5d('0x43')],'type':_0x1e8744[_0x6b5d('0x44')][_0x6b5d('0x45')]};});_0x582cd3['model']=_[_0x6b5d('0x41')](_0x2bea5d,'name');_0x582cd3[_0x6b5d('0x46')]=_['keys'](_0x5478f8['query']);_0x582cd3[_0x6b5d('0x47')]=_['intersection'](_0x582cd3[_0x6b5d('0x48')],_0x582cd3[_0x6b5d('0x46')]);_0x5614a8['attributes']=_[_0x6b5d('0x49')](_0x582cd3[_0x6b5d('0x48')],qs[_0x6b5d('0x4a')](_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x4a')]));_0x5614a8[_0x6b5d('0x4b')]=_0x5614a8[_0x6b5d('0x4b')]['length']?_0x5614a8['attributes']:_0x582cd3[_0x6b5d('0x48')];if(!_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x4c')](_0x6b5d('0x4d'))){_0x5614a8[_0x6b5d('0x31')]=qs[_0x6b5d('0x31')](_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x31')]);_0x5614a8[_0x6b5d('0x2f')]=qs[_0x6b5d('0x2f')](_0x5478f8['query']['offset']);}_0x5614a8[_0x6b5d('0x4e')]=qs[_0x6b5d('0x4f')](_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x5614a8[_0x6b5d('0x50')]=qs[_0x6b5d('0x47')](_[_0x6b5d('0x51')](_0x5478f8[_0x6b5d('0x46')],_0x582cd3[_0x6b5d('0x47')]),_0x2bea5d);if(_0x5478f8[_0x6b5d('0x46')]['filter']){_0x5614a8[_0x6b5d('0x50')]=_[_0x6b5d('0x52')](_0x5614a8[_0x6b5d('0x50')],{'$or':_['map'](_0x2bea5d,function(_0x413694){if(_0x413694[_0x6b5d('0x44')]!==_0x6b5d('0x53')){var _0x3cd029={};_0x3cd029[_0x413694[_0x6b5d('0x3d')]]={'$like':'%'+_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x54')]+'%'};return _0x3cd029;}})});}_0x5614a8=_[_0x6b5d('0x52')]({},_0x5614a8,_0x5478f8[_0x6b5d('0x55')]);var _0xd6f2a3={'where':_0x5614a8['where']};return db[_0x6b5d('0x56')][_0x6b5d('0x32')](_0xd6f2a3)[_0x6b5d('0x38')](function(_0x33929a){_0x1424af['count']=_0x33929a;if(_0x5478f8[_0x6b5d('0x46')][_0x6b5d('0x57')]){_0x5614a8[_0x6b5d('0x58')]=[{'all':!![]}];}return db[_0x6b5d('0x56')][_0x6b5d('0x59')](_0x5614a8);})[_0x6b5d('0x38')](function(_0x13184f){_0x1424af[_0x6b5d('0x5a')]=_0x13184f;return _0x1424af;})['then'](respondWithFilteredResult(_0x4b7e8b,_0x5614a8))['catch'](handleError(_0x4b7e8b,null));};exports[_0x6b5d('0x5b')]=function(_0x5cd9bd,_0x1d7021){var _0x1fb8ad={'raw':![],'where':{'id':_0x5cd9bd[_0x6b5d('0x5c')]['id']},'include':[{'model':db[_0x6b5d('0x40')],'as':_0x6b5d('0x5d')}]},_0x2c224f={};_0x2c224f[_0x6b5d('0x48')]=_[_0x6b5d('0x5e')](db[_0x6b5d('0x56')][_0x6b5d('0x42')]);_0x2c224f[_0x6b5d('0x46')]=_[_0x6b5d('0x5e')](_0x5cd9bd[_0x6b5d('0x46')]);_0x2c224f[_0x6b5d('0x47')]=_[_0x6b5d('0x49')](_0x2c224f[_0x6b5d('0x48')],_0x2c224f[_0x6b5d('0x46')]);_0x1fb8ad['attributes']=_[_0x6b5d('0x49')](_0x2c224f[_0x6b5d('0x48')],qs['fields'](_0x5cd9bd['query'][_0x6b5d('0x4a')]));_0x1fb8ad[_0x6b5d('0x4b')]=_0x1fb8ad[_0x6b5d('0x4b')]['length']?_0x1fb8ad[_0x6b5d('0x4b')]:_0x2c224f[_0x6b5d('0x48')];if(_0x5cd9bd[_0x6b5d('0x46')][_0x6b5d('0x57')]){_0x1fb8ad[_0x6b5d('0x58')]=[{'all':!![]}];}_0x1fb8ad=_['merge']({},_0x1fb8ad,_0x5cd9bd[_0x6b5d('0x55')]);return db[_0x6b5d('0x56')][_0x6b5d('0x5f')](_0x1fb8ad)[_0x6b5d('0x38')](handleEntityNotFound(_0x1d7021,null))[_0x6b5d('0x38')](respondWithResult(_0x1d7021,null))[_0x6b5d('0x2b')](handleError(_0x1d7021,null));};exports[_0x6b5d('0x60')]=function(_0xb1176c,_0x5ac41e){return db['OpenchannelAccount'][_0x6b5d('0x60')](_0xb1176c[_0x6b5d('0x61')],{})[_0x6b5d('0x38')](function(_0x15e7a4){var _0x378d10=_0xb1176c[_0x6b5d('0x62')][_0x6b5d('0x3a')]({'plain':!![]});if(!_0x378d10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x378d10[_0x6b5d('0x63')]===_0x6b5d('0x62')){var _0x4d37bc=_0x15e7a4['get']({'plain':!![]});var _0x5efaad=_0x6b5d('0x3b');return db['UserProfileSection'][_0x6b5d('0x5f')]({'where':{'name':_0x5efaad,'userProfileId':_0x378d10[_0x6b5d('0x64')]},'raw':!![]})['then'](function(_0x1764e3){if(_0x1764e3&&_0x1764e3[_0x6b5d('0x65')]===0x0){return db['UserProfileResource'][_0x6b5d('0x60')]({'name':_0x4d37bc[_0x6b5d('0x3d')],'resourceId':_0x4d37bc['id'],'type':_0x1764e3[_0x6b5d('0x3d')],'sectionId':_0x1764e3['id']},{})[_0x6b5d('0x38')](function(){return _0x15e7a4;});}else{return _0x15e7a4;}})[_0x6b5d('0x2b')](function(_0x698213){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x698213);throw _0x698213;});}return _0x15e7a4;})['then'](respondWithResult(_0x5ac41e,0xc9))[_0x6b5d('0x2b')](handleError(_0x5ac41e,null));};exports[_0x6b5d('0x66')]=function(_0x113030,_0x39a12d){if(_0x113030['body']['id']){delete _0x113030[_0x6b5d('0x61')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x113030['params']['id']},'include':[{'model':db['Pause'],'as':_0x6b5d('0x5d')}]})['then'](handleEntityNotFound(_0x39a12d,null))['then'](saveUpdates(_0x113030[_0x6b5d('0x61')],null))['then'](respondWithResult(_0x39a12d,null))['catch'](handleError(_0x39a12d,null));};exports[_0x6b5d('0x39')]=function(_0x39e16c,_0x5eec79){return db[_0x6b5d('0x56')][_0x6b5d('0x5f')]({'where':{'id':_0x39e16c[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x5eec79,null))[_0x6b5d('0x38')](removeEntity(_0x5eec79,null))[_0x6b5d('0x2b')](handleError(_0x5eec79,null));};exports[_0x6b5d('0x67')]=function(_0x215710,_0x1872b4){return db[_0x6b5d('0x56')][_0x6b5d('0x67')]()[_0x6b5d('0x38')](respondWithResult(_0x1872b4,null))['catch'](handleError(_0x1872b4,null));};exports['addDisposition']=function(_0x3408f3,_0x1c9246,_0x595d2b){if(_0x3408f3['body']['id']){delete _0x3408f3[_0x6b5d('0x61')]['id'];}return db[_0x6b5d('0x56')]['find']({'where':{'id':_0x3408f3[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x1c9246,null))['then'](function(_0xc2e8b2){if(_0xc2e8b2){_0x3408f3['body'][_0x6b5d('0x68')]=_0xc2e8b2['id'];return db[_0x6b5d('0x69')][_0x6b5d('0x60')](_0x3408f3[_0x6b5d('0x61')]);}})[_0x6b5d('0x38')](respondWithResult(_0x1c9246,null))['catch'](handleError(_0x1c9246,null));};exports[_0x6b5d('0x6a')]=function(_0x1237d2,_0x1b7aa9,_0x4a2b44){var _0x3c7a9c={'raw':![],'where':{}};var _0x2670a5={};var _0x116e12={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b5d('0x6b')]({'where':{'id':_0x1237d2[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x1b7aa9,null))[_0x6b5d('0x38')](function(_0x33c0e4){if(_0x33c0e4){_0x2670a5[_0x6b5d('0x48')]=_['keys'](db[_0x6b5d('0x69')][_0x6b5d('0x42')]);_0x2670a5['query']=_[_0x6b5d('0x5e')](_0x1237d2[_0x6b5d('0x46')]);_0x2670a5[_0x6b5d('0x47')]=_[_0x6b5d('0x49')](_0x2670a5[_0x6b5d('0x48')],_0x2670a5['query']);_0x3c7a9c['attributes']=_['intersection'](_0x2670a5[_0x6b5d('0x48')],qs[_0x6b5d('0x4a')](_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x4a')]));_0x3c7a9c[_0x6b5d('0x4b')]=_0x3c7a9c['attributes'][_0x6b5d('0x6c')]?_0x3c7a9c[_0x6b5d('0x4b')]:_0x2670a5[_0x6b5d('0x48')];if(!_0x1237d2['query'][_0x6b5d('0x4c')](_0x6b5d('0x4d'))){_0x3c7a9c[_0x6b5d('0x31')]=qs[_0x6b5d('0x31')](_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x31')]);_0x3c7a9c[_0x6b5d('0x2f')]=qs['offset'](_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x2f')]);}_0x3c7a9c['order']=qs[_0x6b5d('0x4f')](_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x3c7a9c[_0x6b5d('0x50')]=qs['filters'](_[_0x6b5d('0x51')](_0x1237d2[_0x6b5d('0x46')],_0x2670a5[_0x6b5d('0x47')]));_0x3c7a9c[_0x6b5d('0x50')]['OpenchannelAccountId']=_0x33c0e4['id'];if(_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x54')]){_0x3c7a9c['where']=_[_0x6b5d('0x52')](_0x3c7a9c[_0x6b5d('0x50')],{'$or':_[_0x6b5d('0x41')](_0x3c7a9c[_0x6b5d('0x4b')],function(_0x5b76db){var _0x1fdf1b={};_0x1fdf1b[_0x5b76db]={'$like':'%'+_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x54')]+'%'};return _0x1fdf1b;})});}_0x3c7a9c=_['merge']({},_0x3c7a9c,_0x1237d2[_0x6b5d('0x55')]);return db[_0x6b5d('0x69')]['count']({'where':_0x3c7a9c[_0x6b5d('0x50')]})[_0x6b5d('0x38')](function(_0x369d42){_0x116e12[_0x6b5d('0x32')]=_0x369d42;if(_0x1237d2[_0x6b5d('0x46')][_0x6b5d('0x57')]){_0x3c7a9c[_0x6b5d('0x58')]=[{'all':!![]}];}return db[_0x6b5d('0x69')][_0x6b5d('0x59')](_0x3c7a9c);})[_0x6b5d('0x38')](function(_0x112ac4){_0x116e12[_0x6b5d('0x5a')]=_0x112ac4;return _0x116e12;});}})['then'](respondWithFilteredResult(_0x1b7aa9,_0x3c7a9c))[_0x6b5d('0x2b')](handleError(_0x1b7aa9,null));};exports[_0x6b5d('0x6d')]=function(_0x20bfa7,_0x3be707,_0x275d91){return db[_0x6b5d('0x56')][_0x6b5d('0x5f')]({'where':{'id':_0x20bfa7['params']['id']}})['then'](handleEntityNotFound(_0x3be707,null))[_0x6b5d('0x38')](function(_0x1f9c42){if(_0x1f9c42){return _0x1f9c42['removeDispositions'](_0x20bfa7['query'][_0x6b5d('0x6e')]);}})[_0x6b5d('0x38')](respondWithStatusCode(_0x3be707,null))[_0x6b5d('0x2b')](handleError(_0x3be707,null));};exports[_0x6b5d('0x6f')]=function(_0x2951e8,_0x12bc04,_0x350536){if(_0x2951e8['body']['id']){delete _0x2951e8['body']['id'];}return db['OpenchannelAccount'][_0x6b5d('0x5f')]({'where':{'id':_0x2951e8[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x12bc04,null))['then'](function(_0x43660a){if(_0x43660a){_0x2951e8['body']['OpenchannelAccountId']=_0x43660a['id'];return db[_0x6b5d('0x70')][_0x6b5d('0x60')](_0x2951e8[_0x6b5d('0x61')]);}})[_0x6b5d('0x38')](respondWithResult(_0x12bc04,null))[_0x6b5d('0x2b')](handleError(_0x12bc04,null));};exports['getAnswers']=function(_0x5897e9,_0x270687,_0x4f83a5){var _0x42924c={'raw':![],'where':{}};var _0x5eab93={};var _0x14471f={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5897e9['params']['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x270687,null))[_0x6b5d('0x38')](function(_0x1788fa){if(_0x1788fa){_0x5eab93[_0x6b5d('0x48')]=_[_0x6b5d('0x5e')](db[_0x6b5d('0x70')][_0x6b5d('0x42')]);_0x5eab93['query']=_[_0x6b5d('0x5e')](_0x5897e9[_0x6b5d('0x46')]);_0x5eab93[_0x6b5d('0x47')]=_[_0x6b5d('0x49')](_0x5eab93['model'],_0x5eab93[_0x6b5d('0x46')]);_0x42924c['attributes']=_[_0x6b5d('0x49')](_0x5eab93[_0x6b5d('0x48')],qs[_0x6b5d('0x4a')](_0x5897e9['query']['fields']));_0x42924c[_0x6b5d('0x4b')]=_0x42924c[_0x6b5d('0x4b')][_0x6b5d('0x6c')]?_0x42924c['attributes']:_0x5eab93['model'];if(!_0x5897e9['query']['hasOwnProperty']('nolimit')){_0x42924c[_0x6b5d('0x31')]=qs[_0x6b5d('0x31')](_0x5897e9[_0x6b5d('0x46')][_0x6b5d('0x31')]);_0x42924c[_0x6b5d('0x2f')]=qs['offset'](_0x5897e9['query'][_0x6b5d('0x2f')]);}_0x42924c[_0x6b5d('0x4e')]=qs[_0x6b5d('0x4f')](_0x5897e9[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x42924c[_0x6b5d('0x50')]=qs[_0x6b5d('0x47')](_[_0x6b5d('0x51')](_0x5897e9[_0x6b5d('0x46')],_0x5eab93[_0x6b5d('0x47')]));_0x42924c['where'][_0x6b5d('0x68')]=_0x1788fa['id'];if(_0x5897e9[_0x6b5d('0x46')][_0x6b5d('0x54')]){_0x42924c[_0x6b5d('0x50')]=_[_0x6b5d('0x52')](_0x42924c[_0x6b5d('0x50')],{'$or':_[_0x6b5d('0x41')](_0x42924c[_0x6b5d('0x4b')],function(_0x363b2e){var _0x2a7f22={};_0x2a7f22[_0x363b2e]={'$like':'%'+_0x5897e9['query']['filter']+'%'};return _0x2a7f22;})});}_0x42924c=_[_0x6b5d('0x52')]({},_0x42924c,_0x5897e9['options']);return db['CannedAnswer'][_0x6b5d('0x32')]({'where':_0x42924c[_0x6b5d('0x50')]})[_0x6b5d('0x38')](function(_0x1975b9){_0x14471f[_0x6b5d('0x32')]=_0x1975b9;if(_0x5897e9['query'][_0x6b5d('0x57')]){_0x42924c[_0x6b5d('0x58')]=[{'all':!![]}];}return db[_0x6b5d('0x70')][_0x6b5d('0x59')](_0x42924c);})[_0x6b5d('0x38')](function(_0x85b052){_0x14471f['rows']=_0x85b052;return _0x14471f;});}})[_0x6b5d('0x38')](respondWithFilteredResult(_0x270687,_0x42924c))[_0x6b5d('0x2b')](handleError(_0x270687,null));};exports['removeAnswers']=function(_0x3bb20a,_0x35ffdf,_0x2aa00b){return db[_0x6b5d('0x56')][_0x6b5d('0x5f')]({'where':{'id':_0x3bb20a[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x35ffdf,null))[_0x6b5d('0x38')](function(_0x5be4e1){if(_0x5be4e1){return _0x5be4e1[_0x6b5d('0x71')](_0x3bb20a['query'][_0x6b5d('0x6e')]);}})['then'](respondWithStatusCode(_0x35ffdf,null))['catch'](handleError(_0x35ffdf,null));};exports['notify']=function(_0x177904,_0x47eb85,_0x1f49cb){var _0x293e11={'body':_0x177904[_0x6b5d('0x61')],'channel':_0x6b5d('0x72')};var _0x2038b3=[];var _0x1e7266=[];var _0xd5ca84={};var _0x413c1f=![];return db[_0x6b5d('0x73')][_0x6b5d('0x67')]()[_0x6b5d('0x38')](function(_0x2f58ad){if(!_0x2f58ad){throw new db[(_0x6b5d('0x74'))][(_0x6b5d('0x75'))]('no\x20available\x20attributes');}_0x2038b3=_[_0x6b5d('0x76')](_[_0x6b5d('0x5e')](_0x2f58ad),['createdAt',_0x6b5d('0x77')]);_0x1e7266=_['difference'](_[_0x6b5d('0x5e')](_0x2f58ad),[_0x6b5d('0x78'),_0x6b5d('0x77'),'CompanyId',_0x6b5d('0x79')]);if(_0x177904[_0x6b5d('0x61')]['id']){delete _0x177904[_0x6b5d('0x61')]['id'];}if(_[_0x6b5d('0x7a')](_0x177904[_0x6b5d('0x61')][_0x6b5d('0x7b')])){throw new db[(_0x6b5d('0x74'))][(_0x6b5d('0x75'))](_0x6b5d('0x7c'));}if(_[_0x6b5d('0x7a')](_0x177904[_0x6b5d('0x61')][_0x6b5d('0x61')])||_0x177904[_0x6b5d('0x61')][_0x6b5d('0x61')]===''){throw new db[(_0x6b5d('0x74'))][(_0x6b5d('0x75'))](_0x6b5d('0x7d'));}if(_[_0x6b5d('0x7a')](_0x177904[_0x6b5d('0x61')][_0x6b5d('0x7e')])){throw new db[(_0x6b5d('0x74'))][(_0x6b5d('0x75'))](_0x6b5d('0x7f')+_0x1e7266);}if(!_[_0x6b5d('0x80')](_0x1e7266,_0x177904['body'][_0x6b5d('0x7e')])){throw new db['Sequelize'][(_0x6b5d('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1e7266);}_0xd5ca84[_0x177904['body']['mapKey']]=_0x177904['body'][_0x6b5d('0x7b')];})[_0x6b5d('0x38')](function(){return db['OpenchannelAccount'][_0x6b5d('0x5f')]({'where':{'id':_0x177904[_0x6b5d('0x5c')]['id']},'include':[{'model':db[_0x6b5d('0x81')],'as':_0x6b5d('0x82'),'include':[{'model':db[_0x6b5d('0x73')],'as':_0x6b5d('0x83'),'where':_0xd5ca84,'limit':0x1,'order':[['updatedAt',_0x6b5d('0x84')]]}]},{'model':db[_0x6b5d('0x85')],'as':_0x6b5d('0x86')}]});})[_0x6b5d('0x38')](handleEntityNotFound(_0x47eb85,null))[_0x6b5d('0x38')](function(_0x210718){if(_0x210718&&_0x210718[_0x6b5d('0x82')]){_0x293e11[_0x6b5d('0x87')]=_0x210718;_0x293e11[_0x6b5d('0x88')]=_0x210718[_0x6b5d('0x86')];_0x293e11[_0x6b5d('0x89')]=_0x210718[_0x6b5d('0x82')];_0x293e11[_0x6b5d('0x88')]=_[_0x6b5d('0x8a')](_0x293e11[_0x6b5d('0x88')],[_0x6b5d('0x8b')],[_0x6b5d('0x8c')]);if(_0x293e11['account'][_0x6b5d('0x86')]){delete _0x293e11[_0x6b5d('0x87')][_0x6b5d('0x86')];}if(_0x293e11[_0x6b5d('0x87')][_0x6b5d('0x82')]&&_0x293e11[_0x6b5d('0x87')][_0x6b5d('0x82')][_0x6b5d('0x83')][_0x6b5d('0x6c')]){return _0x293e11[_0x6b5d('0x87')][_0x6b5d('0x82')][_0x6b5d('0x83')][0x0];}var _0x2cfdc4=_['defaults'](_0x177904[_0x6b5d('0x61')],{'firstName':_0x177904[_0x6b5d('0x61')][_0x6b5d('0x7b')],'ListId':_0x210718[_0x6b5d('0x79')]});_0x2cfdc4[_0x177904[_0x6b5d('0x61')]['mapKey']]=_0x177904['body']['from'];return db[_0x6b5d('0x73')][_0x6b5d('0x60')](_0x2cfdc4,{'fields':_0x2038b3,'raw':!![]});}})[_0x6b5d('0x38')](handleEntityNotFound(_0x47eb85,null))[_0x6b5d('0x38')](function(_0xdc3d9b){_0x293e11['contact']=_0xdc3d9b;if(_0xdc3d9b){var _0xbfc404={'ContactId':_0xdc3d9b['id'],'OpenchannelAccountId':_0x177904[_0x6b5d('0x5c')]['id'],'from':(_0xdc3d9b[_0x6b5d('0x8d')]||'')+'\x20'+(_0xdc3d9b[_0x6b5d('0x8e')]||'')};var _0x40bc0a={'OpenchannelAccountId':_0x177904[_0x6b5d('0x5c')]['id'],'closed':![]};if(_0x177904['body']['threadId']){_0x40bc0a['threadId']=_0x177904[_0x6b5d('0x61')]['threadId'];return db[_0x6b5d('0x8f')]['find']({'where':_0x40bc0a})[_0x6b5d('0x38')](function(_0x37960a){if(_0x37960a){return[_0x37960a,![]];}_0xbfc404['threadId']=_0x177904[_0x6b5d('0x61')][_0x6b5d('0x90')];_0xbfc404[_0x6b5d('0x91')]=_0x177904['body'][_0x6b5d('0x91')];return db[_0x6b5d('0x8f')][_0x6b5d('0x60')](_0xbfc404)[_0x6b5d('0x38')](function(_0x5066f2){return[_0x5066f2,!![]];});});}else{_0x40bc0a[_0x6b5d('0x90')]=null;}_0x40bc0a[_0x6b5d('0x92')]=_0xdc3d9b['id'];return db['OpenchannelInteraction'][_0x6b5d('0x5f')]({'where':_0x40bc0a})[_0x6b5d('0x38')](function(_0xbb378c){if(_0xbb378c){return[_0xbb378c,![]];}return db[_0x6b5d('0x8f')][_0x6b5d('0x60')](_0xbfc404)['then'](function(_0x29cb50){return[_0x29cb50,!![]];});});}})['spread'](function(_0x3cc214,_0x5286dc){if(_0x3cc214){_0x413c1f=_0x5286dc;if(!_0x5286dc){var _0x255b7d={'from':(_0x293e11[_0x6b5d('0x93')][_0x6b5d('0x8d')]||'')+'\x20'+(_0x293e11[_0x6b5d('0x93')][_0x6b5d('0x8e')]||'')};if(_0x177904[_0x6b5d('0x61')]['threadId']&&_0x177904['body'][_0x6b5d('0x94')]&&_0x177904['body'][_0x6b5d('0x90')]!=_0x177904[_0x6b5d('0x61')]['messageId']){_0x255b7d[_0x6b5d('0x90')]=_0x177904[_0x6b5d('0x61')]['messageId'];}return _0x3cc214[_0x6b5d('0x66')](_0x255b7d);}else{return _0x3cc214;}}})[_0x6b5d('0x38')](function(_0x2ea682){_0x293e11[_0x6b5d('0x95')]=_0x2ea682[_0x6b5d('0x3a')]({'plain':!![]});_0x293e11[_0x6b5d('0x95')][_0x6b5d('0x96')]=_0x413c1f;if(_0x293e11[_0x6b5d('0x95')]['created']){if(_0x293e11[_0x6b5d('0x87')]['autoclose']){_0x293e11['applications']['push']({'id':0x0,'priority':_0x293e11[_0x6b5d('0x88')][_0x6b5d('0x6c')]+0x1,'app':_0x6b5d('0x97'),'appdata':_0x6b5d('0x98'),'interval':_0x6b5d('0x99')});}}return db['OpenchannelMessage'][_0x6b5d('0x60')]({'body':_0x177904[_0x6b5d('0x61')][_0x6b5d('0x61')],'OpenchannelAccountId':_0x177904[_0x6b5d('0x5c')]['id'],'OpenchannelInteractionId':_0x2ea682['id'],'direction':'in','ContactId':_0x293e11[_0x6b5d('0x93')]['id'],'AttachmentId':_0x177904[_0x6b5d('0x61')][_0x6b5d('0x9a')]});})[_0x6b5d('0x38')](function(_0x37e7a5){_0x293e11[_0x6b5d('0x29')]=_0x37e7a5;if(_0x293e11['interaction'][_0x6b5d('0x9b')]){return db[_0x6b5d('0x9c')]['find']({'attributes':['id',_0x6b5d('0x3d')],'where':{'id':_0x293e11[_0x6b5d('0x95')]['UserId']}})['then'](function(_0x35f218){if(_0x35f218){_0x293e11['applications'][_0x6b5d('0x9d')]({'id':0x0,'priority':0x0,'app':_0x6b5d('0x9e'),'appdata':_0x35f218[_0x6b5d('0x3d')]+','+(_0x293e11[_0x6b5d('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x293e11[_0x6b5d('0x9f')]=![];}return respondWithRpcPromise(_0x6b5d('0xa0'),'startRouting',_0x293e11);});}return respondWithRpcPromise(_0x6b5d('0xa0'),_0x6b5d('0xa1'),_0x293e11);})[_0x6b5d('0x38')](function(_0x33b561){respondWithRpcPromise(_0x6b5d('0xa2'),_0x6b5d('0xa2'),{'event':'notify','message':_0x33b561},client9002);return _0x33b561;})['then'](respondWithResult(_0x47eb85,null))[_0x6b5d('0x2b')](handleError(_0x47eb85,null));};exports['addApplications']=function(_0x56295f,_0xc32aef){var _0x1a7a37=_0x56295f[_0x6b5d('0x5c')]['id'];var _0x513fcd=_0x56295f[_0x6b5d('0x61')];var _0x5915ca=0xc8;var _0x56ccee=null;return db[_0x6b5d('0xa3')][_0x6b5d('0xa4')]({'isolationLevel':db[_0x6b5d('0xa3')][_0x6b5d('0xa5')][_0x6b5d('0xa6')][_0x6b5d('0xa7')]},function(_0x2108e3){return db[_0x6b5d('0x56')][_0x6b5d('0x6b')]({'where':{'id':_0x1a7a37},'transaction':_0x2108e3})[_0x6b5d('0x38')](function(_0x1cf884){if(_0x1cf884){return db[_0x6b5d('0x85')][_0x6b5d('0x39')]({'where':{'OpenchannelAccountId':_0x1a7a37},'transaction':_0x2108e3})['then'](function(){var _0x467378=_[_0x6b5d('0x41')](_0x513fcd,function(_0x45dcc6){_0x45dcc6[_0x6b5d('0x68')]=_0x1a7a37;return _0x45dcc6;});return db[_0x6b5d('0x85')]['bulkCreate'](_0x467378,{'transaction':_0x2108e3});});}else{_0x5915ca=0x194;_0x56ccee=[];}});})['then'](function(){if(_0x5915ca!==0x194){return db[_0x6b5d('0x85')][_0x6b5d('0xa8')]({'where':{'OpenchannelAccountId':_0x1a7a37},'order':_0x6b5d('0x8b')})[_0x6b5d('0x38')](function(_0x5a62b3){_0x56ccee=_0x5a62b3;});}})['catch'](function(_0x1014f3){_0x5915ca=0x1f4;logger[_0x6b5d('0x27')](_0x1014f3[_0x6b5d('0x3c')]);if(_0x1014f3['name']){delete _0x1014f3[_0x6b5d('0x3d')];}_0x56ccee=_0x1014f3;})[_0x6b5d('0xa9')](function(){if(_0x56ccee===null){_0xc32aef[_0x6b5d('0x2c')](_0x5915ca);}else{if(_0x5915ca===0x1f4){_0xc32aef['status'](_0x5915ca)[_0x6b5d('0x3e')](_0x56ccee);}else{_0xc32aef['status'](_0x5915ca)[_0x6b5d('0x2e')](_0x56ccee);}}});};exports[_0x6b5d('0xaa')]=function(_0xa09a66,_0x3c039d,_0x369e36){var _0x5f2515={};var _0x419fc6={};var _0x1a31a3;var _0x26f84e;return db[_0x6b5d('0x56')][_0x6b5d('0x6b')]({'where':{'id':_0xa09a66[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x3c039d,null))[_0x6b5d('0x38')](function(_0x1cbdb8){if(_0x1cbdb8){_0x1a31a3=_0x1cbdb8;_0x419fc6[_0x6b5d('0x48')]=_['keys'](db['OpenchannelApplication'][_0x6b5d('0x42')]);_0x419fc6['query']=_[_0x6b5d('0x5e')](_0xa09a66[_0x6b5d('0x46')]);_0x419fc6['filters']=_[_0x6b5d('0x49')](_0x419fc6[_0x6b5d('0x48')],_0x419fc6[_0x6b5d('0x46')]);_0x5f2515['attributes']=_['intersection'](_0x419fc6[_0x6b5d('0x48')],qs['fields'](_0xa09a66[_0x6b5d('0x46')][_0x6b5d('0x4a')]));_0x5f2515[_0x6b5d('0x4b')]=_0x5f2515[_0x6b5d('0x4b')][_0x6b5d('0x6c')]?_0x5f2515[_0x6b5d('0x4b')]:_0x419fc6[_0x6b5d('0x48')];_0x5f2515[_0x6b5d('0x4e')]=qs[_0x6b5d('0x4f')](_0xa09a66[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x5f2515['where']=qs['filters'](_['pick'](_0xa09a66[_0x6b5d('0x46')],_0x419fc6['filters']));if(_0xa09a66[_0x6b5d('0x46')][_0x6b5d('0x54')]){_0x5f2515['where']=_[_0x6b5d('0x52')](_0x5f2515[_0x6b5d('0x50')],{'$or':_['map'](_0x5f2515['attributes'],function(_0x572bca){var _0x50b5d6={};_0x50b5d6[_0x572bca]={'$like':'%'+_0xa09a66[_0x6b5d('0x46')]['filter']+'%'};return _0x50b5d6;})});}_0x5f2515=_[_0x6b5d('0x52')]({},_0x5f2515,_0xa09a66[_0x6b5d('0x55')]);return _0x1a31a3[_0x6b5d('0xaa')](_0x5f2515);}})['then'](function(_0x499b73){if(_0x499b73){_0x26f84e=_0x499b73[_0x6b5d('0x6c')];if(!_0xa09a66['query'][_0x6b5d('0x4c')](_0x6b5d('0x4d'))){_0x5f2515['limit']=qs[_0x6b5d('0x31')](_0xa09a66[_0x6b5d('0x46')][_0x6b5d('0x31')]);_0x5f2515[_0x6b5d('0x2f')]=qs[_0x6b5d('0x2f')](_0xa09a66[_0x6b5d('0x46')][_0x6b5d('0x2f')]);}return _0x1a31a3[_0x6b5d('0xaa')](_0x5f2515);}})[_0x6b5d('0x38')](function(_0x384e73){if(_0x384e73){return _0x384e73?{'count':_0x26f84e,'rows':_0x384e73}:null;}})['then'](respondWithResult(_0x3c039d,null))[_0x6b5d('0x2b')](handleError(_0x3c039d,null));};exports[_0x6b5d('0xab')]=function(_0x1155bf,_0x419291,_0x23b7da){var _0x272427={'raw':![],'where':{}};var _0x361e11={};var _0x18ab0e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6b5d('0x6b')]({'where':{'id':_0x1155bf[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x419291,null))[_0x6b5d('0x38')](function(_0x121870){if(_0x121870){_0x361e11[_0x6b5d('0x48')]=_[_0x6b5d('0x5e')](db[_0x6b5d('0x8f')][_0x6b5d('0x42')]);_0x361e11[_0x6b5d('0x46')]=_[_0x6b5d('0x5e')](_0x1155bf['query']);_0x361e11[_0x6b5d('0x47')]=_[_0x6b5d('0x49')](_0x361e11[_0x6b5d('0x48')],_0x361e11['query']);_0x272427['attributes']=_['intersection'](_0x361e11[_0x6b5d('0x48')],qs['fields'](_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x4a')]));_0x272427['attributes']=_0x272427[_0x6b5d('0x4b')][_0x6b5d('0x6c')]?_0x272427['attributes']:_0x361e11[_0x6b5d('0x48')];if(!_0x1155bf[_0x6b5d('0x46')]['hasOwnProperty']('nolimit')){_0x272427[_0x6b5d('0x31')]=qs[_0x6b5d('0x31')](_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x31')]);_0x272427[_0x6b5d('0x2f')]=qs[_0x6b5d('0x2f')](_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x2f')]);}_0x272427[_0x6b5d('0x4e')]=qs[_0x6b5d('0x4f')](_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x272427['where']=qs[_0x6b5d('0x47')](_[_0x6b5d('0x51')](_0x1155bf[_0x6b5d('0x46')],_0x361e11[_0x6b5d('0x47')]));_0x272427['where'][_0x6b5d('0x68')]=_0x121870['id'];if(_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x54')]){_0x272427[_0x6b5d('0x50')]=_[_0x6b5d('0x52')](_0x272427['where'],{'$or':_['map'](_0x272427[_0x6b5d('0x4b')],function(_0x1e959b){var _0x2a3eb0={};_0x2a3eb0[_0x1e959b]={'$like':'%'+_0x1155bf[_0x6b5d('0x46')]['filter']+'%'};return _0x2a3eb0;})});}_0x272427=_[_0x6b5d('0x52')]({},_0x272427,_0x1155bf[_0x6b5d('0x55')]);return db[_0x6b5d('0x8f')]['count']({'where':_0x272427[_0x6b5d('0x50')]})[_0x6b5d('0x38')](function(_0x23b3f2){_0x18ab0e[_0x6b5d('0x32')]=_0x23b3f2;if(_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0x57')]){_0x272427[_0x6b5d('0x58')]=[{'model':db[_0x6b5d('0x73')],'as':_0x6b5d('0xac'),'required':![]},{'model':db[_0x6b5d('0x9c')],'as':_0x6b5d('0xad'),'attributes':[_0x6b5d('0x3d'),_0x6b5d('0xae'),_0x6b5d('0xaf')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x6b5d('0xb0')],'where':_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0xb1')]?{'id':_0x1155bf[_0x6b5d('0x46')][_0x6b5d('0xb1')]}:undefined,'required':_0x1155bf[_0x6b5d('0x46')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x6b5d('0x59')](_0x272427);})[_0x6b5d('0x38')](function(_0xf67ad3){_0x18ab0e['rows']=_0xf67ad3;return _0x18ab0e;});}})[_0x6b5d('0x38')](respondWithFilteredResult(_0x419291,_0x272427))['catch'](handleError(_0x419291,null));};exports[_0x6b5d('0xb2')]=function(_0x4f1126,_0x27e541,_0xdc83bf){return db[_0x6b5d('0x56')][_0x6b5d('0x5f')]({'where':{'id':_0x4f1126['params']['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x27e541,null))[_0x6b5d('0x38')](function(_0x49b1d9){if(_0x49b1d9){return _0x49b1d9[_0x6b5d('0xb2')](_0x4f1126[_0x6b5d('0x61')]['ids'],_[_0x6b5d('0xb3')](_0x4f1126[_0x6b5d('0x61')],[_0x6b5d('0x6e'),'id'])||{})['spread'](function(_0x13cd35){for(var _0x5d2e42=0x0;_0x5d2e42<_0x4f1126[_0x6b5d('0x61')][_0x6b5d('0x6e')][_0x6b5d('0x6c')];_0x5d2e42+=0x1){socket[_0x6b5d('0xb4')](_0x6b5d('0xb5'),{'UserId':Number(_0x4f1126[_0x6b5d('0x61')]['ids'][_0x5d2e42]),'OpenchannelAccountId':Number(_0x4f1126[_0x6b5d('0x5c')]['id'])});}return _0x13cd35;});}})[_0x6b5d('0x38')](respondWithResult(_0x27e541,null))[_0x6b5d('0x2b')](handleError(_0x27e541,null));};exports[_0x6b5d('0xb6')]=function(_0x810fca,_0x39e5f9,_0x3427ee){return db[_0x6b5d('0x56')]['find']({'where':{'id':_0x810fca[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x39e5f9,null))[_0x6b5d('0x38')](function(_0x216789){if(_0x216789){return _0x216789[_0x6b5d('0xb6')](_0x810fca[_0x6b5d('0x46')]['ids'])[_0x6b5d('0x38')](function(){if(_[_0x6b5d('0xb7')](_0x810fca[_0x6b5d('0x46')]['ids'])){for(var _0x184a40=0x0;_0x184a40<_0x810fca[_0x6b5d('0x46')][_0x6b5d('0x6e')][_0x6b5d('0x6c')];_0x184a40+=0x1){socket['emit'](_0x6b5d('0xb8'),{'UserId':Number(_0x810fca[_0x6b5d('0x46')][_0x6b5d('0x6e')][_0x184a40]),'OpenchannelAccountId':Number(_0x810fca['params']['id'])});}}else{socket[_0x6b5d('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0x810fca[_0x6b5d('0x46')]['ids']),'OpenchannelAccountId':Number(_0x810fca[_0x6b5d('0x5c')]['id'])});}});}})[_0x6b5d('0x38')](respondWithStatusCode(_0x39e5f9,null))[_0x6b5d('0x2b')](handleError(_0x39e5f9,null));};exports[_0x6b5d('0xb9')]=function(_0xb374c7,_0x4ad169,_0x14b13e){var _0x55506e={};var _0x4d0f57={};var _0x54c6b4;var _0x41c0d1;return db[_0x6b5d('0x56')][_0x6b5d('0x6b')]({'where':{'id':_0xb374c7[_0x6b5d('0x5c')]['id']}})[_0x6b5d('0x38')](handleEntityNotFound(_0x4ad169,null))['then'](function(_0x5ce838){if(_0x5ce838){_0x54c6b4=_0x5ce838;_0x4d0f57[_0x6b5d('0x48')]=_['keys'](db['User'][_0x6b5d('0x42')]);_0x4d0f57['query']=_[_0x6b5d('0x5e')](_0xb374c7[_0x6b5d('0x46')]);_0x4d0f57[_0x6b5d('0x47')]=_[_0x6b5d('0x49')](_0x4d0f57[_0x6b5d('0x48')],_0x4d0f57[_0x6b5d('0x46')]);_0x55506e['attributes']=_[_0x6b5d('0x49')](_0x4d0f57['model'],qs[_0x6b5d('0x4a')](_0xb374c7[_0x6b5d('0x46')][_0x6b5d('0x4a')]));_0x55506e['attributes']=_0x55506e[_0x6b5d('0x4b')][_0x6b5d('0x6c')]?_0x55506e[_0x6b5d('0x4b')]:_0x4d0f57[_0x6b5d('0x48')];_0x55506e[_0x6b5d('0x4e')]=qs[_0x6b5d('0x4f')](_0xb374c7[_0x6b5d('0x46')][_0x6b5d('0x4f')]);_0x55506e[_0x6b5d('0x50')]=qs['filters'](_[_0x6b5d('0x51')](_0xb374c7[_0x6b5d('0x46')],_0x4d0f57[_0x6b5d('0x47')]));if(_0xb374c7[_0x6b5d('0x46')]['filter']){_0x55506e[_0x6b5d('0x50')]=_[_0x6b5d('0x52')](_0x55506e[_0x6b5d('0x50')],{'$or':_['map'](_0x55506e[_0x6b5d('0x4b')],function(_0x5c0b50){var _0x134703={};_0x134703[_0x5c0b50]={'$like':'%'+_0xb374c7[_0x6b5d('0x46')][_0x6b5d('0x54')]+'%'};return _0x134703;})});}_0x55506e=_[_0x6b5d('0x52')]({},_0x55506e,_0xb374c7[_0x6b5d('0x55')]);return _0x54c6b4[_0x6b5d('0xb9')](_0x55506e);}})[_0x6b5d('0x38')](function(_0x46c27a){if(_0x46c27a){_0x41c0d1=_0x46c27a[_0x6b5d('0x6c')];if(!_0xb374c7[_0x6b5d('0x46')][_0x6b5d('0x4c')](_0x6b5d('0x4d'))){_0x55506e[_0x6b5d('0x31')]=qs[_0x6b5d('0x31')](_0xb374c7['query'][_0x6b5d('0x31')]);_0x55506e[_0x6b5d('0x2f')]=qs[_0x6b5d('0x2f')](_0xb374c7[_0x6b5d('0x46')][_0x6b5d('0x2f')]);}return _0x54c6b4[_0x6b5d('0xb9')](_0x55506e);}})[_0x6b5d('0x38')](function(_0x2e7835){if(_0x2e7835){return _0x2e7835?{'count':_0x41c0d1,'rows':_0x2e7835}:null;}})[_0x6b5d('0x38')](respondWithResult(_0x4ad169,null))[_0x6b5d('0x2b')](handleError(_0x4ad169,null));};exports[_0x6b5d('0x3e')]=function(_0x35bd51,_0x42d739,_0x5a0385){var _0x432d67,_0x273f98,_0x54db12;if(_[_0x6b5d('0x7a')](_0x35bd51[_0x6b5d('0x61')][_0x6b5d('0x61')])||_0x35bd51['body'][_0x6b5d('0x61')]===''){throw new db[(_0x6b5d('0x74'))][(_0x6b5d('0x75'))](_0x6b5d('0x7d'));}if(_[_0x6b5d('0x7a')](_0x35bd51[_0x6b5d('0x61')]['to'])){}_0x432d67=_0x35bd51[_0x6b5d('0x61')]['to'];return db[_0x6b5d('0x56')][_0x6b5d('0x6b')]({'where':{'id':_0x35bd51[_0x6b5d('0x5c')]['id']}})['then'](handleEntityNotFound(_0x42d739,null))['then'](function(_0x190b6c){if(_0x190b6c){return db[_0x6b5d('0x56')]['find']({'where':{'id':_0x190b6c['id']},'include':[{'model':db[_0x6b5d('0x81')],'as':_0x6b5d('0x82'),'include':[{'model':db['CmContact'],'as':_0x6b5d('0x83'),'where':{[_0x190b6c['mapKey']]:_0x432d67},'limit':0x1,'order':[[_0x6b5d('0x77'),_0x6b5d('0x84')]]}]}]})['then'](handleEntityNotFound(_0x42d739,null))[_0x6b5d('0x38')](function(_0x283484){if(_0x283484&&_0x283484[_0x6b5d('0x82')]){_0x273f98=_0x283484['get']({'plain':!![]});if(_0x273f98[_0x6b5d('0x82')]&&_0x273f98[_0x6b5d('0x82')][_0x6b5d('0x83')]['length']){return _0x273f98[_0x6b5d('0x82')][_0x6b5d('0x83')][0x0];}return db[_0x6b5d('0x73')]['create'](_[_0x6b5d('0x1a')](_0x35bd51[_0x6b5d('0x61')],{'firstName':_0x432d67,[_0x283484[_0x6b5d('0x7e')]]:_0x432d67,'phone':_0x432d67,'ListId':_0x273f98['ListId']}));}})[_0x6b5d('0x38')](handleEntityNotFound(_0x42d739,null))[_0x6b5d('0x38')](function(_0x536aef){if(_0x536aef){_0x54db12=_0x536aef;return db['OpenchannelInteraction'][_0x6b5d('0x5f')]({'where':{'ContactId':_0x54db12['id'],'closed':![],'OpenchannelAccountId':_0x273f98['id']}})[_0x6b5d('0x38')](function(_0x1b3e50){if(_0x1b3e50){return[_0x1b3e50,![]];}return db[_0x6b5d('0x8f')][_0x6b5d('0x60')]({'UserId':_0x35bd51['user']['id'],'ContactId':_0x54db12['id'],'OpenchannelAccountId':_0x273f98['id'],'lastMsgDirection':'out','Messages':[_[_0x6b5d('0x52')](_0x35bd51[_0x6b5d('0x61')],{'read':![],'body':_0x35bd51[_0x6b5d('0x61')][_0x6b5d('0x61')],'OpenchannelAccountId':_0x273f98['id'],'UserId':_0x35bd51[_0x6b5d('0x62')]['id'],'ContactId':_0x54db12['id']})]},{'include':[{'model':db[_0x6b5d('0xba')],'as':'Messages'}]})['then'](function(_0x3f8c83){return[_0x3f8c83,!![]];});});}})[_0x6b5d('0xbb')](function(_0x38f1b4,_0x46476c){if(_0x46476c){return _0x38f1b4;}return db[_0x6b5d('0xba')][_0x6b5d('0x60')](_[_0x6b5d('0x52')](_0x35bd51[_0x6b5d('0x61')],{'read':![],'body':_0x35bd51['body']['body'],'OpenchannelAccountId':_0x273f98['id'],'OpenchannelInteractionId':_0x38f1b4['id'],'UserId':_0x35bd51['user']['id'],'ContactId':_0x54db12['id']}))[_0x6b5d('0x38')](function(_0x15c380){_0x38f1b4['dataValues']['Messages']=[];_0x38f1b4[_0x6b5d('0xbc')][_0x6b5d('0xbd')][_0x6b5d('0xbe')](_0x15c380[_0x6b5d('0xbc')]);return _0x38f1b4;});});}})[_0x6b5d('0x38')](respondWithResult(_0x42d739,null))[_0x6b5d('0x2b')](handleError(_0x42d739,null));}; \ No newline at end of file +var _0x7a36=['length','nolimit','order','sort','pick','merge','where','map','VIRTUAL','options','findAll','rows','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','findOne','filter','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','include','removeAnswers','notify','openchannel','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','lastName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','sequelize','Transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','client','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x41e2d0,_0x52afa6){var _0x59f2a9=function(_0x5e4526){while(--_0x5e4526){_0x41e2d0['push'](_0x41e2d0['shift']());}};_0x59f2a9(++_0x52afa6);}(_0x7a36,0x79));var _0x67a3=function(_0x383a4f,_0x4e84e0){_0x383a4f=_0x383a4f-0x0;var _0x1993ab=_0x7a36[_0x383a4f];return _0x1993ab;};'use strict';var emlformat=require(_0x67a3('0x0'));var rimraf=require(_0x67a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x67a3('0x2'));var rp=require(_0x67a3('0x3'));var moment=require(_0x67a3('0x4'));var BPromise=require(_0x67a3('0x5'));var Mustache=require('mustache');var util=require(_0x67a3('0x6'));var path=require(_0x67a3('0x7'));var sox=require(_0x67a3('0x8'));var csv=require(_0x67a3('0x9'));var ejs=require(_0x67a3('0xa'));var fs=require('fs');var fs_extra=require(_0x67a3('0xb'));var _=require(_0x67a3('0xc'));var squel=require(_0x67a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67a3('0xe'));var toCsv=require(_0x67a3('0x9'));var querystring=require(_0x67a3('0xf'));var Papa=require(_0x67a3('0x10'));var Redis=require(_0x67a3('0x11'));var authService=require(_0x67a3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x67a3('0x13'));var hardwareService=require(_0x67a3('0x14'));var logger=require(_0x67a3('0x15'))(_0x67a3('0x16'));var utils=require('../../config/utils');var config=require(_0x67a3('0x17'));var licenseUtil=require(_0x67a3('0x18'));var db=require(_0x67a3('0x19'))['db'];config[_0x67a3('0x1a')]=_[_0x67a3('0x1b')](config['redis'],{'host':_0x67a3('0x1c'),'port':0x18eb});var socket=require(_0x67a3('0x1d'))(new Redis(config[_0x67a3('0x1a')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x67a3('0x1e')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4598ed,_0x4f382e,_0x931572,_0x58d46d){return new BPromise(function(_0x49a8fc,_0x1c8958){var _0x41fb67=_0x58d46d||client;return _0x41fb67[_0x67a3('0x1f')](_0x4598ed,_0x931572)['then'](function(_0x1b74e6){logger[_0x67a3('0x20')](_0x67a3('0x21'),_0x4f382e,_0x67a3('0x22'));logger[_0x67a3('0x23')](_0x67a3('0x24'),_0x4f382e,_0x67a3('0x22'),JSON[_0x67a3('0x25')](_0x1b74e6));if(_0x1b74e6['error']){if(_0x1b74e6[_0x67a3('0x26')][_0x67a3('0x27')]===0x1f4){logger['error'](_0x67a3('0x21'),_0x4f382e,_0x1b74e6[_0x67a3('0x26')][_0x67a3('0x28')]);return _0x1c8958(_0x1b74e6[_0x67a3('0x26')][_0x67a3('0x28')]);}logger[_0x67a3('0x26')](_0x67a3('0x21'),_0x4f382e,_0x1b74e6[_0x67a3('0x26')][_0x67a3('0x28')]);return _0x49a8fc(_0x1b74e6[_0x67a3('0x26')]['message']);}else{logger[_0x67a3('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x4f382e,_0x67a3('0x22'));_0x49a8fc(_0x1b74e6[_0x67a3('0x29')][_0x67a3('0x28')]);}})[_0x67a3('0x2a')](function(_0x54a6c8){logger[_0x67a3('0x26')](_0x67a3('0x21'),_0x4f382e,_0x54a6c8);_0x1c8958(_0x54a6c8);});});}function respondWithStatusCode(_0xe42688,_0x438fef){_0x438fef=_0x438fef||0xcc;return function(_0x5281a4){if(_0x5281a4){return _0xe42688['sendStatus'](_0x438fef);}return _0xe42688['status'](_0x438fef)[_0x67a3('0x2b')]();};}function respondWithResult(_0x30bf98,_0x136bad){_0x136bad=_0x136bad||0xc8;return function(_0x546218){if(_0x546218){return _0x30bf98[_0x67a3('0x2c')](_0x136bad)[_0x67a3('0x2d')](_0x546218);}};}function respondWithFilteredResult(_0x2090ee,_0x174fc5){return function(_0xfc7db5){if(_0xfc7db5){var _0x25b03a=typeof _0x174fc5[_0x67a3('0x2e')]===_0x67a3('0x2f')&&typeof _0x174fc5[_0x67a3('0x30')]===_0x67a3('0x2f');var _0x16257a=_0xfc7db5['count'];var _0x180572=_0x25b03a?0x0:_0x174fc5[_0x67a3('0x2e')];var _0x56aa25=_0x25b03a?_0xfc7db5[_0x67a3('0x31')]:_0x174fc5[_0x67a3('0x2e')]+_0x174fc5[_0x67a3('0x30')];var _0x22afcf;if(_0x56aa25>=_0x16257a){_0x56aa25=_0x16257a;_0x22afcf=0xc8;}else{_0x22afcf=0xce;}_0x2090ee[_0x67a3('0x2c')](_0x22afcf);return _0x2090ee[_0x67a3('0x32')](_0x67a3('0x33'),_0x180572+'-'+_0x56aa25+'/'+_0x16257a)[_0x67a3('0x2d')](_0xfc7db5);}return null;};}function patchUpdates(_0x5c6758){return function(_0x139b5d){try{jsonpatch['apply'](_0x139b5d,_0x5c6758,!![]);}catch(_0x2cf061){return BPromise[_0x67a3('0x34')](_0x2cf061);}return _0x139b5d[_0x67a3('0x35')]();};}function saveUpdates(_0x185361,_0x595a69){return function(_0x58ee36){if(_0x58ee36){return _0x58ee36[_0x67a3('0x36')](_0x185361)['then'](function(_0x13afe3){return _0x13afe3;});}return null;};}function removeEntity(_0x2d1679,_0x4916d0){return function(_0x836243){if(_0x836243){return _0x836243[_0x67a3('0x37')]()['then'](function(){var _0x159108=_0x836243[_0x67a3('0x38')]({'plain':!![]});var _0x5327a9='OpenchannelAccounts';return db[_0x67a3('0x39')][_0x67a3('0x37')]({'where':{'type':_0x5327a9,'resourceId':_0x159108['id']}})[_0x67a3('0x3a')](function(){return _0x836243;});})[_0x67a3('0x3a')](function(){_0x2d1679['status'](0xcc)[_0x67a3('0x2b')]();});}};}function handleEntityNotFound(_0x3a3a1f,_0x592b2d){return function(_0x38d0e4){if(!_0x38d0e4){_0x3a3a1f[_0x67a3('0x3b')](0x194);}return _0x38d0e4;};}function handleError(_0x41171e,_0x33a30){_0x33a30=_0x33a30||0x1f4;return function(_0x1522a0){logger['error'](_0x1522a0[_0x67a3('0x3c')]);if(_0x1522a0['name']){delete _0x1522a0[_0x67a3('0x3d')];}_0x41171e[_0x67a3('0x2c')](_0x33a30)[_0x67a3('0x3e')](_0x1522a0);};}exports[_0x67a3('0x3f')]=function(_0x10dad2,_0x52ce89){var _0x420b9e={'include':[{'model':db[_0x67a3('0x40')],'as':_0x67a3('0x41')}]},_0x47c15e={},_0x51eacc={'count':0x0,'rows':[]};var _0x36827a=_['map'](db[_0x67a3('0x42')][_0x67a3('0x43')],function(_0x1bf926){return{'name':_0x1bf926[_0x67a3('0x44')],'type':_0x1bf926[_0x67a3('0x45')][_0x67a3('0x46')]};});_0x47c15e[_0x67a3('0x47')]=_['map'](_0x36827a,_0x67a3('0x3d'));_0x47c15e[_0x67a3('0x48')]=_['keys'](_0x10dad2[_0x67a3('0x48')]);_0x47c15e[_0x67a3('0x49')]=_[_0x67a3('0x4a')](_0x47c15e['model'],_0x47c15e[_0x67a3('0x48')]);_0x420b9e[_0x67a3('0x4b')]=_[_0x67a3('0x4a')](_0x47c15e[_0x67a3('0x47')],qs[_0x67a3('0x4c')](_0x10dad2[_0x67a3('0x48')][_0x67a3('0x4c')]));_0x420b9e[_0x67a3('0x4b')]=_0x420b9e[_0x67a3('0x4b')][_0x67a3('0x4d')]?_0x420b9e[_0x67a3('0x4b')]:_0x47c15e[_0x67a3('0x47')];if(!_0x10dad2[_0x67a3('0x48')]['hasOwnProperty'](_0x67a3('0x4e'))){_0x420b9e['limit']=qs['limit'](_0x10dad2['query'][_0x67a3('0x30')]);_0x420b9e[_0x67a3('0x2e')]=qs['offset'](_0x10dad2[_0x67a3('0x48')][_0x67a3('0x2e')]);}_0x420b9e[_0x67a3('0x4f')]=qs[_0x67a3('0x50')](_0x10dad2[_0x67a3('0x48')][_0x67a3('0x50')]);_0x420b9e['where']=qs['filters'](_[_0x67a3('0x51')](_0x10dad2[_0x67a3('0x48')],_0x47c15e['filters']),_0x36827a);if(_0x10dad2['query']['filter']){_0x420b9e['where']=_[_0x67a3('0x52')](_0x420b9e[_0x67a3('0x53')],{'$or':_[_0x67a3('0x54')](_0x36827a,function(_0x18e74f){if(_0x18e74f[_0x67a3('0x45')]!==_0x67a3('0x55')){var _0x448f99={};_0x448f99[_0x18e74f[_0x67a3('0x3d')]]={'$like':'%'+_0x10dad2[_0x67a3('0x48')]['filter']+'%'};return _0x448f99;}})});}_0x420b9e=_[_0x67a3('0x52')]({},_0x420b9e,_0x10dad2[_0x67a3('0x56')]);var _0x521301={'where':_0x420b9e[_0x67a3('0x53')]};return db[_0x67a3('0x42')]['count'](_0x521301)['then'](function(_0x51280c){_0x51eacc[_0x67a3('0x31')]=_0x51280c;if(_0x10dad2['query']['includeAll']){_0x420b9e['include']=[{'all':!![]}];}return db[_0x67a3('0x42')][_0x67a3('0x57')](_0x420b9e);})[_0x67a3('0x3a')](function(_0x116669){_0x51eacc[_0x67a3('0x58')]=_0x116669;return _0x51eacc;})[_0x67a3('0x3a')](respondWithFilteredResult(_0x52ce89,_0x420b9e))[_0x67a3('0x2a')](handleError(_0x52ce89,null));};exports['show']=function(_0x445369,_0xb71e44){var _0x4693d9={'raw':![],'where':{'id':_0x445369[_0x67a3('0x59')]['id']},'include':[{'model':db[_0x67a3('0x40')],'as':_0x67a3('0x41')}]},_0x5ca92d={};_0x5ca92d[_0x67a3('0x47')]=_[_0x67a3('0x5a')](db[_0x67a3('0x42')][_0x67a3('0x43')]);_0x5ca92d[_0x67a3('0x48')]=_[_0x67a3('0x5a')](_0x445369[_0x67a3('0x48')]);_0x5ca92d['filters']=_[_0x67a3('0x4a')](_0x5ca92d['model'],_0x5ca92d[_0x67a3('0x48')]);_0x4693d9['attributes']=_[_0x67a3('0x4a')](_0x5ca92d[_0x67a3('0x47')],qs[_0x67a3('0x4c')](_0x445369['query'][_0x67a3('0x4c')]));_0x4693d9[_0x67a3('0x4b')]=_0x4693d9[_0x67a3('0x4b')]['length']?_0x4693d9[_0x67a3('0x4b')]:_0x5ca92d['model'];if(_0x445369[_0x67a3('0x48')]['includeAll']){_0x4693d9['include']=[{'all':!![]}];}_0x4693d9=_[_0x67a3('0x52')]({},_0x4693d9,_0x445369[_0x67a3('0x56')]);return db['OpenchannelAccount'][_0x67a3('0x5b')](_0x4693d9)[_0x67a3('0x3a')](handleEntityNotFound(_0xb71e44,null))[_0x67a3('0x3a')](respondWithResult(_0xb71e44,null))[_0x67a3('0x2a')](handleError(_0xb71e44,null));};exports[_0x67a3('0x5c')]=function(_0x4c6e9a,_0x114e0d){return db[_0x67a3('0x42')]['create'](_0x4c6e9a[_0x67a3('0x5d')],{})[_0x67a3('0x3a')](function(_0x12dc4e){var _0x505acd=_0x4c6e9a[_0x67a3('0x5e')]['get']({'plain':!![]});if(!_0x505acd)throw new Error(_0x67a3('0x5f'));if(_0x505acd[_0x67a3('0x60')]===_0x67a3('0x5e')){var _0x42a7fa=_0x12dc4e[_0x67a3('0x38')]({'plain':!![]});var _0x4fc58a=_0x67a3('0x61');return db[_0x67a3('0x62')][_0x67a3('0x5b')]({'where':{'name':_0x4fc58a,'userProfileId':_0x505acd[_0x67a3('0x63')]},'raw':!![]})[_0x67a3('0x3a')](function(_0x7205){if(_0x7205&&_0x7205[_0x67a3('0x64')]===0x0){return db[_0x67a3('0x39')][_0x67a3('0x5c')]({'name':_0x42a7fa['name'],'resourceId':_0x42a7fa['id'],'type':_0x7205[_0x67a3('0x3d')],'sectionId':_0x7205['id']},{})[_0x67a3('0x3a')](function(){return _0x12dc4e;});}else{return _0x12dc4e;}})['catch'](function(_0x28b685){logger['error'](_0x67a3('0x65'),_0x28b685);throw _0x28b685;});}return _0x12dc4e;})[_0x67a3('0x3a')](respondWithResult(_0x114e0d,0xc9))[_0x67a3('0x2a')](handleError(_0x114e0d,null));};exports[_0x67a3('0x36')]=function(_0x4c4f23,_0x87ca20){if(_0x4c4f23[_0x67a3('0x5d')]['id']){delete _0x4c4f23[_0x67a3('0x5d')]['id'];}return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x4c4f23['params']['id']},'include':[{'model':db[_0x67a3('0x40')],'as':'mandatoryDispositionPause'}]})[_0x67a3('0x3a')](handleEntityNotFound(_0x87ca20,null))[_0x67a3('0x3a')](saveUpdates(_0x4c4f23[_0x67a3('0x5d')],null))[_0x67a3('0x3a')](respondWithResult(_0x87ca20,null))[_0x67a3('0x2a')](handleError(_0x87ca20,null));};exports[_0x67a3('0x37')]=function(_0x178362,_0x56dfb5){return db[_0x67a3('0x42')]['find']({'where':{'id':_0x178362[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x56dfb5,null))[_0x67a3('0x3a')](removeEntity(_0x56dfb5,null))['catch'](handleError(_0x56dfb5,null));};exports[_0x67a3('0x66')]=function(_0x1a2d8a,_0x4837fe){return db[_0x67a3('0x42')][_0x67a3('0x66')]()[_0x67a3('0x3a')](respondWithResult(_0x4837fe,null))['catch'](handleError(_0x4837fe,null));};exports['addDisposition']=function(_0x15c7e5,_0x153987,_0x48cd1b){if(_0x15c7e5[_0x67a3('0x5d')]['id']){delete _0x15c7e5[_0x67a3('0x5d')]['id'];}return db[_0x67a3('0x42')]['find']({'where':{'id':_0x15c7e5[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x153987,null))[_0x67a3('0x3a')](function(_0x14fb8a){if(_0x14fb8a){_0x15c7e5[_0x67a3('0x5d')][_0x67a3('0x67')]=_0x14fb8a['id'];return db[_0x67a3('0x68')][_0x67a3('0x5c')](_0x15c7e5[_0x67a3('0x5d')]);}})[_0x67a3('0x3a')](respondWithResult(_0x153987,null))[_0x67a3('0x2a')](handleError(_0x153987,null));};exports['getDispositions']=function(_0x32c844,_0x5babd7,_0x1a71aa){var _0x2f55d8={'raw':![],'where':{}};var _0x3c7cd9={};var _0x3932bc={'count':0x0,'rows':[]};return db[_0x67a3('0x42')][_0x67a3('0x69')]({'where':{'id':_0x32c844[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x5babd7,null))[_0x67a3('0x3a')](function(_0x28afa7){if(_0x28afa7){_0x3c7cd9['model']=_[_0x67a3('0x5a')](db[_0x67a3('0x68')][_0x67a3('0x43')]);_0x3c7cd9[_0x67a3('0x48')]=_['keys'](_0x32c844[_0x67a3('0x48')]);_0x3c7cd9[_0x67a3('0x49')]=_[_0x67a3('0x4a')](_0x3c7cd9[_0x67a3('0x47')],_0x3c7cd9[_0x67a3('0x48')]);_0x2f55d8['attributes']=_['intersection'](_0x3c7cd9[_0x67a3('0x47')],qs['fields'](_0x32c844[_0x67a3('0x48')]['fields']));_0x2f55d8[_0x67a3('0x4b')]=_0x2f55d8[_0x67a3('0x4b')][_0x67a3('0x4d')]?_0x2f55d8['attributes']:_0x3c7cd9[_0x67a3('0x47')];if(!_0x32c844['query']['hasOwnProperty']('nolimit')){_0x2f55d8[_0x67a3('0x30')]=qs[_0x67a3('0x30')](_0x32c844[_0x67a3('0x48')][_0x67a3('0x30')]);_0x2f55d8[_0x67a3('0x2e')]=qs['offset'](_0x32c844[_0x67a3('0x48')][_0x67a3('0x2e')]);}_0x2f55d8[_0x67a3('0x4f')]=qs[_0x67a3('0x50')](_0x32c844[_0x67a3('0x48')][_0x67a3('0x50')]);_0x2f55d8[_0x67a3('0x53')]=qs[_0x67a3('0x49')](_[_0x67a3('0x51')](_0x32c844[_0x67a3('0x48')],_0x3c7cd9[_0x67a3('0x49')]));_0x2f55d8['where']['OpenchannelAccountId']=_0x28afa7['id'];if(_0x32c844[_0x67a3('0x48')][_0x67a3('0x6a')]){_0x2f55d8[_0x67a3('0x53')]=_[_0x67a3('0x52')](_0x2f55d8[_0x67a3('0x53')],{'$or':_[_0x67a3('0x54')](_0x2f55d8[_0x67a3('0x4b')],function(_0x158c0c){var _0x30b495={};_0x30b495[_0x158c0c]={'$like':'%'+_0x32c844['query'][_0x67a3('0x6a')]+'%'};return _0x30b495;})});}_0x2f55d8=_[_0x67a3('0x52')]({},_0x2f55d8,_0x32c844[_0x67a3('0x56')]);return db[_0x67a3('0x68')]['count']({'where':_0x2f55d8['where']})[_0x67a3('0x3a')](function(_0x2f22da){_0x3932bc[_0x67a3('0x31')]=_0x2f22da;if(_0x32c844['query'][_0x67a3('0x6b')]){_0x2f55d8['include']=[{'all':!![]}];}return db['Disposition'][_0x67a3('0x57')](_0x2f55d8);})[_0x67a3('0x3a')](function(_0x500bc7){_0x3932bc[_0x67a3('0x58')]=_0x500bc7;return _0x3932bc;});}})[_0x67a3('0x3a')](respondWithFilteredResult(_0x5babd7,_0x2f55d8))[_0x67a3('0x2a')](handleError(_0x5babd7,null));};exports[_0x67a3('0x6c')]=function(_0x383425,_0xcd9aaf,_0x308810){return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x383425[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0xcd9aaf,null))[_0x67a3('0x3a')](function(_0x17ea61){if(_0x17ea61){return _0x17ea61[_0x67a3('0x6c')](_0x383425[_0x67a3('0x48')][_0x67a3('0x6d')]);}})[_0x67a3('0x3a')](respondWithStatusCode(_0xcd9aaf,null))[_0x67a3('0x2a')](handleError(_0xcd9aaf,null));};exports[_0x67a3('0x6e')]=function(_0xaec591,_0x1a4386,_0x5cce88){if(_0xaec591['body']['id']){delete _0xaec591[_0x67a3('0x5d')]['id'];}return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0xaec591[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x1a4386,null))[_0x67a3('0x3a')](function(_0x1fa395){if(_0x1fa395){_0xaec591[_0x67a3('0x5d')]['OpenchannelAccountId']=_0x1fa395['id'];return db[_0x67a3('0x6f')][_0x67a3('0x5c')](_0xaec591[_0x67a3('0x5d')]);}})[_0x67a3('0x3a')](respondWithResult(_0x1a4386,null))[_0x67a3('0x2a')](handleError(_0x1a4386,null));};exports[_0x67a3('0x70')]=function(_0xa41b64,_0x47d0a5,_0x727436){var _0x1239dd={'raw':![],'where':{}};var _0x5424af={};var _0x7c1504={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x67a3('0x69')]({'where':{'id':_0xa41b64[_0x67a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x47d0a5,null))['then'](function(_0x5cb950){if(_0x5cb950){_0x5424af[_0x67a3('0x47')]=_[_0x67a3('0x5a')](db['CannedAnswer'][_0x67a3('0x43')]);_0x5424af[_0x67a3('0x48')]=_[_0x67a3('0x5a')](_0xa41b64[_0x67a3('0x48')]);_0x5424af['filters']=_[_0x67a3('0x4a')](_0x5424af[_0x67a3('0x47')],_0x5424af[_0x67a3('0x48')]);_0x1239dd[_0x67a3('0x4b')]=_[_0x67a3('0x4a')](_0x5424af[_0x67a3('0x47')],qs[_0x67a3('0x4c')](_0xa41b64['query'][_0x67a3('0x4c')]));_0x1239dd[_0x67a3('0x4b')]=_0x1239dd[_0x67a3('0x4b')]['length']?_0x1239dd[_0x67a3('0x4b')]:_0x5424af['model'];if(!_0xa41b64[_0x67a3('0x48')][_0x67a3('0x71')](_0x67a3('0x4e'))){_0x1239dd['limit']=qs[_0x67a3('0x30')](_0xa41b64['query']['limit']);_0x1239dd[_0x67a3('0x2e')]=qs[_0x67a3('0x2e')](_0xa41b64['query']['offset']);}_0x1239dd['order']=qs[_0x67a3('0x50')](_0xa41b64[_0x67a3('0x48')][_0x67a3('0x50')]);_0x1239dd[_0x67a3('0x53')]=qs[_0x67a3('0x49')](_[_0x67a3('0x51')](_0xa41b64['query'],_0x5424af[_0x67a3('0x49')]));_0x1239dd[_0x67a3('0x53')][_0x67a3('0x67')]=_0x5cb950['id'];if(_0xa41b64[_0x67a3('0x48')][_0x67a3('0x6a')]){_0x1239dd['where']=_[_0x67a3('0x52')](_0x1239dd[_0x67a3('0x53')],{'$or':_['map'](_0x1239dd[_0x67a3('0x4b')],function(_0xe1cc13){var _0x2b214e={};_0x2b214e[_0xe1cc13]={'$like':'%'+_0xa41b64[_0x67a3('0x48')][_0x67a3('0x6a')]+'%'};return _0x2b214e;})});}_0x1239dd=_['merge']({},_0x1239dd,_0xa41b64[_0x67a3('0x56')]);return db[_0x67a3('0x6f')][_0x67a3('0x31')]({'where':_0x1239dd[_0x67a3('0x53')]})[_0x67a3('0x3a')](function(_0x4605c8){_0x7c1504[_0x67a3('0x31')]=_0x4605c8;if(_0xa41b64[_0x67a3('0x48')][_0x67a3('0x6b')]){_0x1239dd[_0x67a3('0x72')]=[{'all':!![]}];}return db[_0x67a3('0x6f')][_0x67a3('0x57')](_0x1239dd);})[_0x67a3('0x3a')](function(_0x2c236d){_0x7c1504[_0x67a3('0x58')]=_0x2c236d;return _0x7c1504;});}})['then'](respondWithFilteredResult(_0x47d0a5,_0x1239dd))[_0x67a3('0x2a')](handleError(_0x47d0a5,null));};exports[_0x67a3('0x73')]=function(_0x11c9b5,_0x18fd12,_0x15f0d9){return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x11c9b5[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x18fd12,null))['then'](function(_0x408013){if(_0x408013){return _0x408013[_0x67a3('0x73')](_0x11c9b5[_0x67a3('0x48')][_0x67a3('0x6d')]);}})[_0x67a3('0x3a')](respondWithStatusCode(_0x18fd12,null))['catch'](handleError(_0x18fd12,null));};exports[_0x67a3('0x74')]=function(_0x3420b4,_0x503539,_0x28c441){var _0x3930fc={'body':_0x3420b4[_0x67a3('0x5d')],'channel':_0x67a3('0x75')};var _0x4236a5=[];var _0x4cfc3a=[];var _0xa779f5={};var _0x1b75d6=![];return db['CmContact'][_0x67a3('0x66')]()[_0x67a3('0x3a')](function(_0x11e780){if(!_0x11e780){throw new db[(_0x67a3('0x76'))]['ValidationError'](_0x67a3('0x77'));}_0x4236a5=_[_0x67a3('0x78')](_[_0x67a3('0x5a')](_0x11e780),[_0x67a3('0x79'),_0x67a3('0x7a')]);_0x4cfc3a=_[_0x67a3('0x78')](_[_0x67a3('0x5a')](_0x11e780),[_0x67a3('0x79'),_0x67a3('0x7a'),_0x67a3('0x7b'),_0x67a3('0x7c')]);if(_0x3420b4[_0x67a3('0x5d')]['id']){delete _0x3420b4[_0x67a3('0x5d')]['id'];}if(_[_0x67a3('0x7d')](_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x7e')])){throw new db['Sequelize'][(_0x67a3('0x7f'))](_0x67a3('0x80'));}if(_['isNil'](_0x3420b4['body'][_0x67a3('0x5d')])||_0x3420b4['body']['body']===''){throw new db[(_0x67a3('0x76'))][(_0x67a3('0x7f'))](_0x67a3('0x81'));}if(_['isNil'](_0x3420b4[_0x67a3('0x5d')]['mapKey'])){throw new db[(_0x67a3('0x76'))][(_0x67a3('0x7f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4cfc3a);}if(!_[_0x67a3('0x82')](_0x4cfc3a,_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x83')])){throw new db['Sequelize'][(_0x67a3('0x7f'))](_0x67a3('0x84')+_0x4cfc3a);}_0xa779f5[_0x3420b4['body'][_0x67a3('0x83')]]=_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x7e')];})[_0x67a3('0x3a')](function(){return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x3420b4[_0x67a3('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x67a3('0x85'),'include':[{'model':db[_0x67a3('0x86')],'as':_0x67a3('0x87'),'where':_0xa779f5,'limit':0x1,'order':[[_0x67a3('0x7a'),_0x67a3('0x88')]]}]},{'model':db[_0x67a3('0x89')],'as':_0x67a3('0x8a')}]});})['then'](handleEntityNotFound(_0x503539,null))[_0x67a3('0x3a')](function(_0x3d0515){if(_0x3d0515&&_0x3d0515[_0x67a3('0x85')]){_0x3930fc[_0x67a3('0x8b')]=_0x3d0515;_0x3930fc[_0x67a3('0x8c')]=_0x3d0515[_0x67a3('0x8a')];_0x3930fc[_0x67a3('0x8d')]=_0x3d0515[_0x67a3('0x85')];_0x3930fc[_0x67a3('0x8c')]=_[_0x67a3('0x8e')](_0x3930fc['applications'],[_0x67a3('0x8f')],[_0x67a3('0x90')]);if(_0x3930fc[_0x67a3('0x8b')][_0x67a3('0x8a')]){delete _0x3930fc['account'][_0x67a3('0x8a')];}if(_0x3930fc[_0x67a3('0x8b')][_0x67a3('0x85')]&&_0x3930fc[_0x67a3('0x8b')]['List']['Contacts']['length']){return _0x3930fc[_0x67a3('0x8b')][_0x67a3('0x85')][_0x67a3('0x87')][0x0];}var _0x50ac96=_['defaults'](_0x3420b4['body'],{'firstName':_0x3420b4['body'][_0x67a3('0x7e')],'ListId':_0x3d0515['ListId']});_0x50ac96[_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x83')]]=_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x7e')];return db[_0x67a3('0x86')]['create'](_0x50ac96,{'fields':_0x4236a5,'raw':!![]});}})['then'](handleEntityNotFound(_0x503539,null))[_0x67a3('0x3a')](function(_0x5d4981){_0x3930fc['contact']=_0x5d4981;if(_0x5d4981){var _0x47b2ae={'ContactId':_0x5d4981['id'],'OpenchannelAccountId':_0x3420b4[_0x67a3('0x59')]['id'],'from':(_0x5d4981[_0x67a3('0x91')]||'')+'\x20'+(_0x5d4981['lastName']||'')};var _0x32dbde={'OpenchannelAccountId':_0x3420b4[_0x67a3('0x59')]['id'],'closed':![]};if(_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x92')]){_0x32dbde[_0x67a3('0x92')]=_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x92')];return db[_0x67a3('0x93')][_0x67a3('0x5b')]({'where':_0x32dbde})[_0x67a3('0x3a')](function(_0x54fa1e){if(_0x54fa1e){return[_0x54fa1e,![]];}_0x47b2ae[_0x67a3('0x92')]=_0x3420b4[_0x67a3('0x5d')]['threadId'];_0x47b2ae['externalUrl']=_0x3420b4['body'][_0x67a3('0x94')];return db[_0x67a3('0x93')][_0x67a3('0x5c')](_0x47b2ae)['then'](function(_0x661f53){return[_0x661f53,!![]];});});}else{_0x32dbde[_0x67a3('0x92')]=null;}_0x32dbde[_0x67a3('0x95')]=_0x5d4981['id'];return db[_0x67a3('0x93')][_0x67a3('0x5b')]({'where':_0x32dbde})[_0x67a3('0x3a')](function(_0x40a977){if(_0x40a977){return[_0x40a977,![]];}return db['OpenchannelInteraction'][_0x67a3('0x5c')](_0x47b2ae)['then'](function(_0x5981a1){return[_0x5981a1,!![]];});});}})[_0x67a3('0x96')](function(_0x5ecc60,_0xcda6fc){if(_0x5ecc60){_0x1b75d6=_0xcda6fc;if(!_0xcda6fc){var _0x538468={'from':(_0x3930fc[_0x67a3('0x97')]['firstName']||'')+'\x20'+(_0x3930fc[_0x67a3('0x97')][_0x67a3('0x98')]||'')};if(_0x3420b4['body'][_0x67a3('0x92')]&&_0x3420b4[_0x67a3('0x5d')]['messageId']&&_0x3420b4['body'][_0x67a3('0x92')]!=_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x99')]){_0x538468[_0x67a3('0x92')]=_0x3420b4[_0x67a3('0x5d')][_0x67a3('0x99')];}return _0x5ecc60[_0x67a3('0x36')](_0x538468);}else{return _0x5ecc60;}}})[_0x67a3('0x3a')](function(_0x2f4434){_0x3930fc[_0x67a3('0x9a')]=_0x2f4434['get']({'plain':!![]});_0x3930fc['interaction'][_0x67a3('0x9b')]=_0x1b75d6;if(_0x3930fc[_0x67a3('0x9a')][_0x67a3('0x9b')]){if(_0x3930fc[_0x67a3('0x8b')][_0x67a3('0x9c')]){_0x3930fc[_0x67a3('0x8c')]['push']({'id':0x0,'priority':_0x3930fc[_0x67a3('0x8c')]['length']+0x1,'app':_0x67a3('0x9d'),'appdata':'unmanaged','interval':_0x67a3('0x9e')});}}return db[_0x67a3('0x9f')][_0x67a3('0x5c')]({'body':_0x3420b4['body'][_0x67a3('0x5d')],'OpenchannelAccountId':_0x3420b4['params']['id'],'OpenchannelInteractionId':_0x2f4434['id'],'direction':'in','ContactId':_0x3930fc['contact']['id'],'AttachmentId':_0x3420b4['body'][_0x67a3('0xa0')]});})[_0x67a3('0x3a')](function(_0x5713e5){_0x3930fc[_0x67a3('0x28')]=_0x5713e5;if(_0x3930fc[_0x67a3('0x9a')][_0x67a3('0xa1')]){return db[_0x67a3('0xa2')][_0x67a3('0x5b')]({'attributes':['id','name'],'where':{'id':_0x3930fc[_0x67a3('0x9a')]['UserId']}})[_0x67a3('0x3a')](function(_0xea2b88){if(_0xea2b88){_0x3930fc[_0x67a3('0x8c')][_0x67a3('0xa3')]({'id':0x0,'priority':0x0,'app':_0x67a3('0xa4'),'appdata':_0xea2b88[_0x67a3('0x3d')]+','+(_0x3930fc['account'][_0x67a3('0xa5')]||0xa),'interval':_0x67a3('0x9e')});_0x3930fc[_0x67a3('0xa6')]=![];}return respondWithRpcPromise('Start',_0x67a3('0xa7'),_0x3930fc);});}return respondWithRpcPromise(_0x67a3('0xa8'),'startRouting',_0x3930fc);})[_0x67a3('0x3a')](function(_0x26d930){respondWithRpcPromise(_0x67a3('0xa9'),_0x67a3('0xa9'),{'event':_0x67a3('0x74'),'message':_0x26d930},client9002);return _0x26d930;})['then'](respondWithResult(_0x503539,null))[_0x67a3('0x2a')](handleError(_0x503539,null));};exports['addApplications']=function(_0x17d574,_0x24a4a3){var _0x1bc16c=_0x17d574['params']['id'];var _0x25337a=_0x17d574[_0x67a3('0x5d')];var _0xfc9973=0xc8;var _0x392bed=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x67a3('0xaa')][_0x67a3('0xab')]['ISOLATION_LEVELS'][_0x67a3('0xac')]},function(_0x4f1a59){return db[_0x67a3('0x42')][_0x67a3('0x69')]({'where':{'id':_0x1bc16c},'transaction':_0x4f1a59})[_0x67a3('0x3a')](function(_0xf5b723){if(_0xf5b723){return db[_0x67a3('0x89')][_0x67a3('0x37')]({'where':{'OpenchannelAccountId':_0x1bc16c},'transaction':_0x4f1a59})[_0x67a3('0x3a')](function(){var _0x51ccc1=_[_0x67a3('0x54')](_0x25337a,function(_0x41aa68){_0x41aa68['OpenchannelAccountId']=_0x1bc16c;return _0x41aa68;});return db['OpenchannelApplication'][_0x67a3('0xad')](_0x51ccc1,{'transaction':_0x4f1a59});});}else{_0xfc9973=0x194;_0x392bed=[];}});})[_0x67a3('0x3a')](function(){if(_0xfc9973!==0x194){return db['OpenchannelApplication'][_0x67a3('0xae')]({'where':{'OpenchannelAccountId':_0x1bc16c},'order':_0x67a3('0x8f')})[_0x67a3('0x3a')](function(_0x141ad9){_0x392bed=_0x141ad9;});}})[_0x67a3('0x2a')](function(_0x246cfb){_0xfc9973=0x1f4;logger[_0x67a3('0x26')](_0x246cfb[_0x67a3('0x3c')]);if(_0x246cfb['name']){delete _0x246cfb['name'];}_0x392bed=_0x246cfb;})[_0x67a3('0xaf')](function(){if(_0x392bed===null){_0x24a4a3[_0x67a3('0x3b')](_0xfc9973);}else{if(_0xfc9973===0x1f4){_0x24a4a3[_0x67a3('0x2c')](_0xfc9973)['send'](_0x392bed);}else{_0x24a4a3['status'](_0xfc9973)[_0x67a3('0x2d')](_0x392bed);}}});};exports[_0x67a3('0xb0')]=function(_0x1ea52b,_0x1bc9f6,_0x111e89){var _0x791d23={};var _0xea0480={};var _0x44d32f;var _0x39fd50;return db[_0x67a3('0x42')][_0x67a3('0x69')]({'where':{'id':_0x1ea52b['params']['id']}})['then'](handleEntityNotFound(_0x1bc9f6,null))[_0x67a3('0x3a')](function(_0x25c5ee){if(_0x25c5ee){_0x44d32f=_0x25c5ee;_0xea0480[_0x67a3('0x47')]=_['keys'](db[_0x67a3('0x89')][_0x67a3('0x43')]);_0xea0480['query']=_[_0x67a3('0x5a')](_0x1ea52b['query']);_0xea0480[_0x67a3('0x49')]=_['intersection'](_0xea0480[_0x67a3('0x47')],_0xea0480[_0x67a3('0x48')]);_0x791d23[_0x67a3('0x4b')]=_['intersection'](_0xea0480['model'],qs['fields'](_0x1ea52b[_0x67a3('0x48')][_0x67a3('0x4c')]));_0x791d23[_0x67a3('0x4b')]=_0x791d23[_0x67a3('0x4b')]['length']?_0x791d23[_0x67a3('0x4b')]:_0xea0480['model'];_0x791d23[_0x67a3('0x4f')]=qs[_0x67a3('0x50')](_0x1ea52b[_0x67a3('0x48')][_0x67a3('0x50')]);_0x791d23[_0x67a3('0x53')]=qs[_0x67a3('0x49')](_['pick'](_0x1ea52b['query'],_0xea0480['filters']));if(_0x1ea52b['query']['filter']){_0x791d23[_0x67a3('0x53')]=_[_0x67a3('0x52')](_0x791d23[_0x67a3('0x53')],{'$or':_['map'](_0x791d23[_0x67a3('0x4b')],function(_0x64b957){var _0x3f7d07={};_0x3f7d07[_0x64b957]={'$like':'%'+_0x1ea52b[_0x67a3('0x48')][_0x67a3('0x6a')]+'%'};return _0x3f7d07;})});}_0x791d23=_[_0x67a3('0x52')]({},_0x791d23,_0x1ea52b[_0x67a3('0x56')]);return _0x44d32f[_0x67a3('0xb0')](_0x791d23);}})[_0x67a3('0x3a')](function(_0x11946f){if(_0x11946f){_0x39fd50=_0x11946f[_0x67a3('0x4d')];if(!_0x1ea52b[_0x67a3('0x48')][_0x67a3('0x71')]('nolimit')){_0x791d23['limit']=qs[_0x67a3('0x30')](_0x1ea52b[_0x67a3('0x48')]['limit']);_0x791d23['offset']=qs[_0x67a3('0x2e')](_0x1ea52b[_0x67a3('0x48')][_0x67a3('0x2e')]);}return _0x44d32f[_0x67a3('0xb0')](_0x791d23);}})[_0x67a3('0x3a')](function(_0x435e83){if(_0x435e83){return _0x435e83?{'count':_0x39fd50,'rows':_0x435e83}:null;}})[_0x67a3('0x3a')](respondWithResult(_0x1bc9f6,null))[_0x67a3('0x2a')](handleError(_0x1bc9f6,null));};exports[_0x67a3('0xb1')]=function(_0x522888,_0x19a08f,_0x5a84f0){var _0x59114e={'raw':![],'where':{}};var _0xdb42dc={};var _0x50cce0={'count':0x0,'rows':[]};return db[_0x67a3('0x42')]['findOne']({'where':{'id':_0x522888[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x19a08f,null))['then'](function(_0x217b3e){if(_0x217b3e){_0xdb42dc[_0x67a3('0x47')]=_['keys'](db[_0x67a3('0x93')][_0x67a3('0x43')]);_0xdb42dc[_0x67a3('0x48')]=_[_0x67a3('0x5a')](_0x522888[_0x67a3('0x48')]);_0xdb42dc[_0x67a3('0x49')]=_[_0x67a3('0x4a')](_0xdb42dc['model'],_0xdb42dc[_0x67a3('0x48')]);_0x59114e[_0x67a3('0x4b')]=_[_0x67a3('0x4a')](_0xdb42dc['model'],qs['fields'](_0x522888[_0x67a3('0x48')][_0x67a3('0x4c')]));_0x59114e['attributes']=_0x59114e['attributes'][_0x67a3('0x4d')]?_0x59114e[_0x67a3('0x4b')]:_0xdb42dc[_0x67a3('0x47')];if(!_0x522888[_0x67a3('0x48')]['hasOwnProperty'](_0x67a3('0x4e'))){_0x59114e[_0x67a3('0x30')]=qs[_0x67a3('0x30')](_0x522888[_0x67a3('0x48')][_0x67a3('0x30')]);_0x59114e[_0x67a3('0x2e')]=qs[_0x67a3('0x2e')](_0x522888[_0x67a3('0x48')][_0x67a3('0x2e')]);}_0x59114e[_0x67a3('0x4f')]=qs[_0x67a3('0x50')](_0x522888['query'][_0x67a3('0x50')]);_0x59114e['where']=qs[_0x67a3('0x49')](_[_0x67a3('0x51')](_0x522888[_0x67a3('0x48')],_0xdb42dc[_0x67a3('0x49')]));_0x59114e[_0x67a3('0x53')]['OpenchannelAccountId']=_0x217b3e['id'];if(_0x522888[_0x67a3('0x48')][_0x67a3('0x6a')]){_0x59114e[_0x67a3('0x53')]=_[_0x67a3('0x52')](_0x59114e[_0x67a3('0x53')],{'$or':_['map'](_0x59114e[_0x67a3('0x4b')],function(_0x273c5e){var _0x56bb8a={};_0x56bb8a[_0x273c5e]={'$like':'%'+_0x522888[_0x67a3('0x48')][_0x67a3('0x6a')]+'%'};return _0x56bb8a;})});}_0x59114e=_[_0x67a3('0x52')]({},_0x59114e,_0x522888[_0x67a3('0x56')]);return db['OpenchannelInteraction']['count']({'where':_0x59114e['where']})[_0x67a3('0x3a')](function(_0x25d999){_0x50cce0[_0x67a3('0x31')]=_0x25d999;if(_0x522888[_0x67a3('0x48')][_0x67a3('0x6b')]){_0x59114e['include']=[{'model':db[_0x67a3('0x86')],'as':_0x67a3('0xb2'),'required':![]},{'model':db[_0x67a3('0xa2')],'as':_0x67a3('0xb3'),'attributes':[_0x67a3('0x3d'),_0x67a3('0xb4'),_0x67a3('0xb5')],'required':![]},{'model':db[_0x67a3('0xb6')],'as':_0x67a3('0xb7'),'attributes':['id',_0x67a3('0x3d'),_0x67a3('0xb8')],'where':_0x522888['query'][_0x67a3('0xb9')]?{'id':_0x522888[_0x67a3('0x48')][_0x67a3('0xb9')]}:undefined,'required':_0x522888[_0x67a3('0x48')][_0x67a3('0xb9')]?!![]:![]}];}return db[_0x67a3('0x93')][_0x67a3('0x57')](_0x59114e);})[_0x67a3('0x3a')](function(_0x2e199c){_0x50cce0['rows']=_0x2e199c;return _0x50cce0;});}})[_0x67a3('0x3a')](respondWithFilteredResult(_0x19a08f,_0x59114e))[_0x67a3('0x2a')](handleError(_0x19a08f,null));};exports[_0x67a3('0xba')]=function(_0x45e35b,_0x23fffd,_0x4c5e4f){return db['OpenchannelAccount'][_0x67a3('0x5b')]({'where':{'id':_0x45e35b[_0x67a3('0x59')]['id']}})['then'](handleEntityNotFound(_0x23fffd,null))[_0x67a3('0x3a')](function(_0x28c20c){if(_0x28c20c){return _0x28c20c[_0x67a3('0xba')](_0x45e35b[_0x67a3('0x5d')][_0x67a3('0x6d')],_[_0x67a3('0xbb')](_0x45e35b[_0x67a3('0x5d')],[_0x67a3('0x6d'),'id'])||{})[_0x67a3('0x96')](function(_0x20fd2a){for(var _0x4559bc=0x0;_0x4559bc<_0x45e35b[_0x67a3('0x5d')][_0x67a3('0x6d')][_0x67a3('0x4d')];_0x4559bc+=0x1){socket[_0x67a3('0xbc')]('userOpenchannelAccount:save',{'UserId':Number(_0x45e35b[_0x67a3('0x5d')][_0x67a3('0x6d')][_0x4559bc]),'OpenchannelAccountId':Number(_0x45e35b['params']['id'])});}return _0x20fd2a;});}})[_0x67a3('0x3a')](respondWithResult(_0x23fffd,null))[_0x67a3('0x2a')](handleError(_0x23fffd,null));};exports[_0x67a3('0xbd')]=function(_0x29997a,_0x52031d,_0x224013){return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x29997a['params']['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x52031d,null))[_0x67a3('0x3a')](function(_0x1bb27b){if(_0x1bb27b){return _0x1bb27b[_0x67a3('0xbd')](_0x29997a[_0x67a3('0x48')]['ids'])[_0x67a3('0x3a')](function(){if(_[_0x67a3('0xbe')](_0x29997a[_0x67a3('0x48')][_0x67a3('0x6d')])){for(var _0x44c213=0x0;_0x44c213<_0x29997a['query'][_0x67a3('0x6d')]['length'];_0x44c213+=0x1){socket[_0x67a3('0xbc')](_0x67a3('0xbf'),{'UserId':Number(_0x29997a[_0x67a3('0x48')][_0x67a3('0x6d')][_0x44c213]),'OpenchannelAccountId':Number(_0x29997a[_0x67a3('0x59')]['id'])});}}else{socket[_0x67a3('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x29997a[_0x67a3('0x48')][_0x67a3('0x6d')]),'OpenchannelAccountId':Number(_0x29997a[_0x67a3('0x59')]['id'])});}});}})[_0x67a3('0x3a')](respondWithStatusCode(_0x52031d,null))['catch'](handleError(_0x52031d,null));};exports[_0x67a3('0xc0')]=function(_0x102f0b,_0x495100,_0x16d5a8){var _0x3b3e6a={};var _0x16ff1a={};var _0x2f890b;var _0x14a693;return db[_0x67a3('0x42')]['findOne']({'where':{'id':_0x102f0b['params']['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x495100,null))['then'](function(_0x5d0fdc){if(_0x5d0fdc){_0x2f890b=_0x5d0fdc;_0x16ff1a['model']=_['keys'](db['User'][_0x67a3('0x43')]);_0x16ff1a[_0x67a3('0x48')]=_[_0x67a3('0x5a')](_0x102f0b[_0x67a3('0x48')]);_0x16ff1a['filters']=_[_0x67a3('0x4a')](_0x16ff1a[_0x67a3('0x47')],_0x16ff1a[_0x67a3('0x48')]);_0x3b3e6a[_0x67a3('0x4b')]=_['intersection'](_0x16ff1a[_0x67a3('0x47')],qs[_0x67a3('0x4c')](_0x102f0b[_0x67a3('0x48')][_0x67a3('0x4c')]));_0x3b3e6a[_0x67a3('0x4b')]=_0x3b3e6a[_0x67a3('0x4b')]['length']?_0x3b3e6a[_0x67a3('0x4b')]:_0x16ff1a['model'];_0x3b3e6a['order']=qs[_0x67a3('0x50')](_0x102f0b[_0x67a3('0x48')]['sort']);_0x3b3e6a[_0x67a3('0x53')]=qs['filters'](_[_0x67a3('0x51')](_0x102f0b['query'],_0x16ff1a[_0x67a3('0x49')]));if(_0x102f0b[_0x67a3('0x48')][_0x67a3('0x6a')]){_0x3b3e6a['where']=_[_0x67a3('0x52')](_0x3b3e6a[_0x67a3('0x53')],{'$or':_[_0x67a3('0x54')](_0x3b3e6a['attributes'],function(_0xd08a43){var _0xb44f62={};_0xb44f62[_0xd08a43]={'$like':'%'+_0x102f0b['query'][_0x67a3('0x6a')]+'%'};return _0xb44f62;})});}_0x3b3e6a=_['merge']({},_0x3b3e6a,_0x102f0b[_0x67a3('0x56')]);return _0x2f890b[_0x67a3('0xc0')](_0x3b3e6a);}})['then'](function(_0x192e26){if(_0x192e26){_0x14a693=_0x192e26['length'];if(!_0x102f0b[_0x67a3('0x48')][_0x67a3('0x71')]('nolimit')){_0x3b3e6a['limit']=qs[_0x67a3('0x30')](_0x102f0b[_0x67a3('0x48')][_0x67a3('0x30')]);_0x3b3e6a['offset']=qs[_0x67a3('0x2e')](_0x102f0b[_0x67a3('0x48')]['offset']);}return _0x2f890b['getAgents'](_0x3b3e6a);}})[_0x67a3('0x3a')](function(_0x43fef1){if(_0x43fef1){return _0x43fef1?{'count':_0x14a693,'rows':_0x43fef1}:null;}})[_0x67a3('0x3a')](respondWithResult(_0x495100,null))[_0x67a3('0x2a')](handleError(_0x495100,null));};exports[_0x67a3('0x3e')]=function(_0x54e4d8,_0x397818,_0x77f238){var _0x4b4f65,_0x34b77a,_0x3c6c64;if(_[_0x67a3('0x7d')](_0x54e4d8[_0x67a3('0x5d')][_0x67a3('0x5d')])||_0x54e4d8[_0x67a3('0x5d')][_0x67a3('0x5d')]===''){throw new db[(_0x67a3('0x76'))][(_0x67a3('0x7f'))](_0x67a3('0x81'));}if(_['isNil'](_0x54e4d8[_0x67a3('0x5d')]['to'])){}_0x4b4f65=_0x54e4d8[_0x67a3('0x5d')]['to'];return db[_0x67a3('0x42')][_0x67a3('0x69')]({'where':{'id':_0x54e4d8[_0x67a3('0x59')]['id']}})[_0x67a3('0x3a')](handleEntityNotFound(_0x397818,null))[_0x67a3('0x3a')](function(_0x326978){if(_0x326978){return db[_0x67a3('0x42')][_0x67a3('0x5b')]({'where':{'id':_0x326978['id']},'include':[{'model':db[_0x67a3('0xc1')],'as':_0x67a3('0x85'),'include':[{'model':db['CmContact'],'as':_0x67a3('0x87'),'where':{[_0x326978[_0x67a3('0x83')]]:_0x4b4f65},'limit':0x1,'order':[[_0x67a3('0x7a'),_0x67a3('0x88')]]}]}]})[_0x67a3('0x3a')](handleEntityNotFound(_0x397818,null))[_0x67a3('0x3a')](function(_0x3aeffa){if(_0x3aeffa&&_0x3aeffa[_0x67a3('0x85')]){_0x34b77a=_0x3aeffa[_0x67a3('0x38')]({'plain':!![]});if(_0x34b77a['List']&&_0x34b77a[_0x67a3('0x85')][_0x67a3('0x87')][_0x67a3('0x4d')]){return _0x34b77a[_0x67a3('0x85')][_0x67a3('0x87')][0x0];}return db[_0x67a3('0x86')][_0x67a3('0x5c')](_[_0x67a3('0x1b')](_0x54e4d8[_0x67a3('0x5d')],{'firstName':_0x4b4f65,[_0x3aeffa[_0x67a3('0x83')]]:_0x4b4f65,'phone':_0x4b4f65,'ListId':_0x34b77a[_0x67a3('0x7c')]}));}})[_0x67a3('0x3a')](handleEntityNotFound(_0x397818,null))['then'](function(_0x560945){if(_0x560945){_0x3c6c64=_0x560945;return db[_0x67a3('0x93')][_0x67a3('0x5b')]({'where':{'ContactId':_0x3c6c64['id'],'closed':![],'OpenchannelAccountId':_0x34b77a['id']}})[_0x67a3('0x3a')](function(_0x32c67d){if(_0x32c67d){return[_0x32c67d,![]];}return db['OpenchannelInteraction'][_0x67a3('0x5c')]({'UserId':_0x54e4d8[_0x67a3('0x5e')]['id'],'ContactId':_0x3c6c64['id'],'OpenchannelAccountId':_0x34b77a['id'],'lastMsgDirection':_0x67a3('0xc2'),'Messages':[_[_0x67a3('0x52')](_0x54e4d8['body'],{'read':![],'body':_0x54e4d8[_0x67a3('0x5d')][_0x67a3('0x5d')],'OpenchannelAccountId':_0x34b77a['id'],'UserId':_0x54e4d8[_0x67a3('0x5e')]['id'],'ContactId':_0x3c6c64['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x67a3('0xc3')}]})[_0x67a3('0x3a')](function(_0x120747){return[_0x120747,!![]];});});}})['spread'](function(_0xe2b659,_0xa7981d){if(_0xa7981d){return _0xe2b659;}return db[_0x67a3('0x9f')][_0x67a3('0x5c')](_[_0x67a3('0x52')](_0x54e4d8[_0x67a3('0x5d')],{'read':![],'body':_0x54e4d8[_0x67a3('0x5d')][_0x67a3('0x5d')],'OpenchannelAccountId':_0x34b77a['id'],'OpenchannelInteractionId':_0xe2b659['id'],'UserId':_0x54e4d8[_0x67a3('0x5e')]['id'],'ContactId':_0x3c6c64['id']}))[_0x67a3('0x3a')](function(_0x19e31a){_0xe2b659[_0x67a3('0xc4')]['Messages']=[];_0xe2b659[_0x67a3('0xc4')]['Messages'][_0x67a3('0xc5')](_0x19e31a['dataValues']);return _0xe2b659;});});}})[_0x67a3('0x3a')](respondWithResult(_0x397818,null))[_0x67a3('0x2a')](handleError(_0x397818,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 99991d6..ee1c125 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 _0x1be1=['OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x51e46e,_0x5ca9f7){var _0x5591ec=function(_0x40190b){while(--_0x40190b){_0x51e46e['push'](_0x51e46e['shift']());}};_0x5591ec(++_0x5ca9f7);}(_0x1be1,0x192));var _0x11be=function(_0x54b190,_0x433541){_0x54b190=_0x54b190-0x0;var _0x2dee15=_0x1be1[_0x54b190];return _0x2dee15;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x11be('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x11be('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x11be('0x2'),'afterDestroy':_0x11be('0x3')};function emitEvent(_0x200b2a){return function(_0x318d41,_0x504d3a,_0x3ce56d){OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a+':'+_0x318d41['id'],_0x318d41);OpenchannelAccountEvents[_0x11be('0x4')](_0x200b2a,_0x318d41);_0x3ce56d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x11be('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0x22fb=['hook','exports','OpenchannelAccount','save','update','remove','emit','hasOwnProperty'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x22fb,0x192));var _0xb22f=function(_0x509751,_0x28e4a9){_0x509751=_0x509751-0x0;var _0x4b6c75=_0x22fb[_0x509751];return _0x4b6c75;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xb22f('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb22f('0x1'),'afterUpdate':_0xb22f('0x2'),'afterDestroy':_0xb22f('0x3')};function emitEvent(_0x10d2c4){return function(_0x201512,_0x50cdab,_0x44717d){OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4+':'+_0x201512['id'],_0x201512);OpenchannelAccountEvents[_0xb22f('0x4')](_0x10d2c4,_0x201512);_0x44717d(null);};}for(var e in events){if(events[_0xb22f('0x5')](e)){var event=events[e];OpenchannelAccount[_0xb22f('0x6')](e,emitEvent(event));}}module[_0xb22f('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index e30588b..9879925 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(_0x1ea191,_0x5884ae){var _0x671fa2=function(_0x49c252){while(--_0x49c252){_0x1ea191['push'](_0x1ea191['shift']());}};_0x671fa2(++_0x5884ae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x3637e4,_0x3b7a97){var _0x1544b7=function(_0x5db448){while(--_0x5db448){_0x3637e4['push'](_0x3637e4['shift']());}};_0x1544b7(++_0x3b7a97);}(_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':'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 4db0966..06de6cc 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 _0x41bb=['stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x468d23,_0x4cafc3){var _0x26ee15=function(_0x1af70e){while(--_0x1af70e){_0x468d23['push'](_0x468d23['shift']());}};_0x26ee15(++_0x4cafc3);}(_0x41bb,0xc5));var _0xb41b=function(_0x1f99a0,_0x55a918){_0x1f99a0=_0x1f99a0-0x0;var _0x5ada89=_0x41bb[_0x1f99a0];return _0x5ada89;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xb41b('0xa')],{'host':_0xb41b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb41b('0xa')]));require(_0xb41b('0xc'))[_0xb41b('0xd')](socket);function respondWithRpcPromise(_0xa2aa66,_0x26d531,_0x11f049){return new BPromise(function(_0x5e5c5b,_0x4baa03){return client[_0xb41b('0xe')](_0xa2aa66,_0x11f049)['then'](function(_0x2e906c){logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));logger[_0xb41b('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x26d531,_0xb41b('0x11'),JSON[_0xb41b('0x13')](_0x2e906c));if(_0x2e906c[_0xb41b('0x14')]){if(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x15')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x4baa03(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}logger[_0xb41b('0x14')](_0xb41b('0x10'),_0x26d531,_0x2e906c['error'][_0xb41b('0x16')]);return _0x5e5c5b(_0x2e906c[_0xb41b('0x14')][_0xb41b('0x16')]);}else{logger[_0xb41b('0xf')](_0xb41b('0x10'),_0x26d531,_0xb41b('0x11'));_0x5e5c5b(_0x2e906c[_0xb41b('0x17')]['message']);}})['catch'](function(_0x5da8e3){logger[_0xb41b('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x26d531,_0x5da8e3);_0x4baa03(_0x5da8e3);});});} \ No newline at end of file +var _0x4483=['defaults','localhost','./openchannelAccount.socket','register','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x16545f,_0x10adb1){var _0x4db039=function(_0x150466){while(--_0x150466){_0x16545f['push'](_0x16545f['shift']());}};_0x4db039(++_0x10adb1);}(_0x4483,0x1a3));var _0x3448=function(_0x32319e,_0x1aaa1e){_0x32319e=_0x32319e-0x0;var _0x731911=_0x4483[_0x32319e];return _0x731911;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});config[_0x3448('0xc')]=_[_0x3448('0xd')](config[_0x3448('0xc')],{'host':_0x3448('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3448('0xf'))[_0x3448('0x10')](socket);function respondWithRpcPromise(_0xc36409,_0x6f82ca,_0x3f4364){return new BPromise(function(_0x1e645a,_0x2bdf02){return client[_0x3448('0x11')](_0xc36409,_0x3f4364)[_0x3448('0x12')](function(_0x35bb7b){logger[_0x3448('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x6f82ca,'request\x20sent');logger[_0x3448('0x14')](_0x3448('0x15'),_0x6f82ca,'request\x20sent',JSON[_0x3448('0x16')](_0x35bb7b));if(_0x35bb7b[_0x3448('0x17')]){if(_0x35bb7b[_0x3448('0x17')]['code']===0x1f4){logger[_0x3448('0x17')](_0x3448('0x18'),_0x6f82ca,_0x35bb7b['error'][_0x3448('0x19')]);return _0x2bdf02(_0x35bb7b[_0x3448('0x17')][_0x3448('0x19')]);}logger['error'](_0x3448('0x18'),_0x6f82ca,_0x35bb7b[_0x3448('0x17')][_0x3448('0x19')]);return _0x1e645a(_0x35bb7b[_0x3448('0x17')][_0x3448('0x19')]);}else{logger[_0x3448('0x13')](_0x3448('0x18'),_0x6f82ca,_0x3448('0x1a'));_0x1e645a(_0x35bb7b['result'][_0x3448('0x19')]);}})['catch'](function(_0x48f94a){logger['error'](_0x3448('0x18'),_0x6f82ca,_0x48f94a);_0x2bdf02(_0x48f94a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 6766ac7..da97227 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 _0x65d2=['length','openchannelAccount:','./openchannelAccount.events','save','update','emit','register'];(function(_0x445d20,_0x39643f){var _0x26e5f2=function(_0x1f1e53){while(--_0x1f1e53){_0x445d20['push'](_0x445d20['shift']());}};_0x26e5f2(++_0x39643f);}(_0x65d2,0xb8));var _0x265d=function(_0x3bb617,_0x2002ce){_0x3bb617=_0x3bb617-0x0;var _0x3903f2=_0x65d2[_0x3bb617];return _0x3903f2;};'use strict';var OpenchannelAccountEvents=require(_0x265d('0x0'));var events=[_0x265d('0x1'),'remove',_0x265d('0x2')];function createListener(_0x12fc9b,_0x3a315b){return function(_0x59c81e){_0x3a315b[_0x265d('0x3')](_0x12fc9b,_0x59c81e);};}function removeListener(_0x233dd9,_0x2f91bf){return function(){OpenchannelAccountEvents['removeListener'](_0x233dd9,_0x2f91bf);};}exports[_0x265d('0x4')]=function(_0xd49e24){for(var _0x27dc2d=0x0,_0x1020fa=events[_0x265d('0x5')];_0x27dc2d<_0x1020fa;_0x27dc2d++){var _0x5ca577=events[_0x27dc2d];var _0x36bf91=createListener(_0x265d('0x6')+_0x5ca577,_0xd49e24);OpenchannelAccountEvents['on'](_0x5ca577,_0x36bf91);}}; \ No newline at end of file +var _0x8a1b=['removeListener','register','length','./openchannelAccount.events','save','update','emit'];(function(_0x32dc53,_0x572c4e){var _0x15e9d1=function(_0x2d08a5){while(--_0x2d08a5){_0x32dc53['push'](_0x32dc53['shift']());}};_0x15e9d1(++_0x572c4e);}(_0x8a1b,0xf8));var _0xb8a1=function(_0x9c3492,_0x5ddd93){_0x9c3492=_0x9c3492-0x0;var _0x5c742e=_0x8a1b[_0x9c3492];return _0x5c742e;};'use strict';var OpenchannelAccountEvents=require(_0xb8a1('0x0'));var events=[_0xb8a1('0x1'),'remove',_0xb8a1('0x2')];function createListener(_0x18fcc0,_0x59f68f){return function(_0x4aec5c){_0x59f68f[_0xb8a1('0x3')](_0x18fcc0,_0x4aec5c);};}function removeListener(_0x3b6246,_0x287494){return function(){OpenchannelAccountEvents[_0xb8a1('0x4')](_0x3b6246,_0x287494);};}exports[_0xb8a1('0x5')]=function(_0x4d484f){for(var _0xede883=0x0,_0x444ef7=events[_0xb8a1('0x6')];_0xede883<_0x444ef7;_0xede883++){var _0x3f34e5=events[_0xede883];var _0x2370d3=createListener('openchannelAccount:'+_0x3f34e5,_0x4d484f);OpenchannelAccountEvents['on'](_0x3f34e5,_0x2370d3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 624a758..61ae23d 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 _0x4742=['get','isAuthenticated','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x312835,_0xff273e){var _0x1da8b9=function(_0x193c4){while(--_0x193c4){_0x312835['push'](_0x312835['shift']());}};_0x1da8b9(++_0xff273e);}(_0x4742,0x104));var _0x2474=function(_0x3f30a7,_0x4f1c4e){_0x3f30a7=_0x3f30a7-0x0;var _0x39702e=_0x4742[_0x3f30a7];return _0x39702e;};'use strict';var multer=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var path=require(_0x2474('0x2'));var timeout=require(_0x2474('0x3'));var express=require(_0x2474('0x4'));var router=express[_0x2474('0x5')]();var fs_extra=require(_0x2474('0x6'));var auth=require(_0x2474('0x7'));var interaction=require(_0x2474('0x8'));var config=require(_0x2474('0x9'));var controller=require('./openchannelApplication.controller');router[_0x2474('0xa')]('/',auth[_0x2474('0xb')](),controller['index']);router[_0x2474('0xa')](_0x2474('0xc'),auth['isAuthenticated'](),controller[_0x2474('0xd')]);router['post']('/',auth[_0x2474('0xb')](),controller[_0x2474('0xe')]);router['put'](_0x2474('0xc'),auth[_0x2474('0xb')](),controller[_0x2474('0xf')]);router[_0x2474('0x10')](_0x2474('0xc'),auth[_0x2474('0xb')](),controller[_0x2474('0x11')]);module['exports']=router; \ No newline at end of file +var _0x533e=['/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','create','put','update','delete'];(function(_0x2180a0,_0x5133c6){var _0x4fb1dc=function(_0x49d68c){while(--_0x49d68c){_0x2180a0['push'](_0x2180a0['shift']());}};_0x4fb1dc(++_0x5133c6);}(_0x533e,0xc1));var _0xe533=function(_0x33aadc,_0x49a9c9){_0x33aadc=_0x33aadc-0x0;var _0x11c521=_0x533e[_0x33aadc];return _0x11c521;};'use strict';var multer=require(_0xe533('0x0'));var util=require(_0xe533('0x1'));var path=require(_0xe533('0x2'));var timeout=require(_0xe533('0x3'));var express=require(_0xe533('0x4'));var router=express[_0xe533('0x5')]();var fs_extra=require(_0xe533('0x6'));var auth=require(_0xe533('0x7'));var interaction=require(_0xe533('0x8'));var config=require(_0xe533('0x9'));var controller=require('./openchannelApplication.controller');router[_0xe533('0xa')]('/',auth[_0xe533('0xb')](),controller['index']);router['get']('/:id',auth[_0xe533('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xe533('0xc')]);router[_0xe533('0xd')]('/:id',auth[_0xe533('0xb')](),controller[_0xe533('0xe')]);router[_0xe533('0xf')](_0xe533('0x10'),auth['isAuthenticated'](),controller[_0xe533('0x11')]);module[_0xe533('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a91112f..3e7b7b7 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 _0xd5dd=['STRING','*,*,*,*','sequelize','INTEGER','noop'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd5dd,0x6b));var _0xdd5d=function(_0x4b44c3,_0x47ff82){_0x4b44c3=_0x4b44c3-0x0;var _0x3aab3f=_0xd5dd[_0x4b44c3];return _0x3aab3f;};'use strict';var Sequelize=require(_0xdd5d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xdd5d('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd5d('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdd5d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xdd5d('0x4')}}; \ No newline at end of file +var _0x268c=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x4c1e16,_0x578097){var _0x1b6e2d=function(_0xdc3ec6){while(--_0xdc3ec6){_0x4c1e16['push'](_0x4c1e16['shift']());}};_0x1b6e2d(++_0x578097);}(_0x268c,0x103));var _0xc268=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0x268c[_0x35a140];return _0x30ab82;};'use strict';var Sequelize=require(_0xc268('0x0'));module[_0xc268('0x1')]={'priority':{'type':Sequelize[_0xc268('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc268('0x3')],'allowNull':![],'defaultValue':_0xc268('0x4')},'appdata':{'type':Sequelize[_0xc268('0x5')]()},'description':{'type':Sequelize[_0xc268('0x3')]},'interval':{'type':Sequelize[_0xc268('0x3')],'defaultValue':_0xc268('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 798f6d8..907ecbd 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 _0x77e3=['key','query','keys','filters','intersection','model','attributes','fields','length','order','sort','filter','where','VIRTUAL','name','merge','options','includeAll','include','findAll','show','params','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','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','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','send','map','OpenchannelApplication','rawAttributes','fieldName','type'];(function(_0x59887e,_0x31d750){var _0x1d3936=function(_0x149d39){while(--_0x149d39){_0x59887e['push'](_0x59887e['shift']());}};_0x1d3936(++_0x31d750);}(_0x77e3,0x135));var _0x377e=function(_0x252594,_0x2dec0c){_0x252594=_0x252594-0x0;var _0x1053b7=_0x77e3[_0x252594];return _0x1053b7;};'use strict';var emlformat=require(_0x377e('0x0'));var rimraf=require(_0x377e('0x1'));var zipdir=require(_0x377e('0x2'));var jsonpatch=require(_0x377e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x377e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x377e('0x5'));var sox=require(_0x377e('0x6'));var csv=require(_0x377e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x377e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x377e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x377e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x377e('0xb'));var Papa=require(_0x377e('0xc'));var Redis=require(_0x377e('0xd'));var authService=require(_0x377e('0xe'));var qs=require(_0x377e('0xf'));var as=require(_0x377e('0x10'));var hardwareService=require(_0x377e('0x11'));var logger=require(_0x377e('0x12'))(_0x377e('0x13'));var utils=require(_0x377e('0x14'));var config=require(_0x377e('0x15'));var licenseUtil=require(_0x377e('0x16'));var db=require(_0x377e('0x17'))['db'];function respondWithStatusCode(_0x3360f1,_0x39e732){_0x39e732=_0x39e732||0xcc;return function(_0x4619f3){if(_0x4619f3){return _0x3360f1[_0x377e('0x18')](_0x39e732);}return _0x3360f1['status'](_0x39e732)[_0x377e('0x19')]();};}function respondWithResult(_0x391bd4,_0xf49de6){_0xf49de6=_0xf49de6||0xc8;return function(_0x48f40d){if(_0x48f40d){return _0x391bd4[_0x377e('0x1a')](_0xf49de6)[_0x377e('0x1b')](_0x48f40d);}};}function respondWithFilteredResult(_0x15267f,_0x499291){return function(_0x3aab4a){if(_0x3aab4a){var _0x29b273=typeof _0x499291[_0x377e('0x1c')]===_0x377e('0x1d')&&typeof _0x499291[_0x377e('0x1e')]===_0x377e('0x1d');var _0xdac9a0=_0x3aab4a[_0x377e('0x1f')];var _0x4d2f56=_0x29b273?0x0:_0x499291[_0x377e('0x1c')];var _0xded71d=_0x29b273?_0x3aab4a['count']:_0x499291['offset']+_0x499291['limit'];var _0x564420;if(_0xded71d>=_0xdac9a0){_0xded71d=_0xdac9a0;_0x564420=0xc8;}else{_0x564420=0xce;}_0x15267f[_0x377e('0x1a')](_0x564420);return _0x15267f['set'](_0x377e('0x20'),_0x4d2f56+'-'+_0xded71d+'/'+_0xdac9a0)[_0x377e('0x1b')](_0x3aab4a);}return null;};}function patchUpdates(_0x897e30){return function(_0x5792cc){try{jsonpatch['apply'](_0x5792cc,_0x897e30,!![]);}catch(_0x33c542){return BPromise[_0x377e('0x21')](_0x33c542);}return _0x5792cc[_0x377e('0x22')]();};}function saveUpdates(_0x4ce532,_0x3dc911){return function(_0xf3f0ca){if(_0xf3f0ca){return _0xf3f0ca[_0x377e('0x23')](_0x4ce532)[_0x377e('0x24')](function(_0x478c65){return _0x478c65;});}return null;};}function removeEntity(_0x1d1ea6,_0x1058b2){return function(_0x1f2929){if(_0x1f2929){return _0x1f2929[_0x377e('0x25')]()[_0x377e('0x24')](function(){_0x1d1ea6[_0x377e('0x1a')](0xcc)[_0x377e('0x19')]();});}};}function handleEntityNotFound(_0x536fee,_0x284627){return function(_0x3f33e8){if(!_0x3f33e8){_0x536fee[_0x377e('0x18')](0x194);}return _0x3f33e8;};}function handleError(_0x29f3bf,_0x23a23e){_0x23a23e=_0x23a23e||0x1f4;return function(_0x2c8504){logger[_0x377e('0x26')](_0x2c8504[_0x377e('0x27')]);if(_0x2c8504['name']){delete _0x2c8504['name'];}_0x29f3bf[_0x377e('0x1a')](_0x23a23e)[_0x377e('0x28')](_0x2c8504);};}exports['index']=function(_0x48a41a,_0x3fe193){var _0x23f980={},_0x229de6={},_0x13185e={'count':0x0,'rows':[]};var _0x160ac0=_[_0x377e('0x29')](db[_0x377e('0x2a')][_0x377e('0x2b')],function(_0x34b0f3){return{'name':_0x34b0f3[_0x377e('0x2c')],'type':_0x34b0f3[_0x377e('0x2d')][_0x377e('0x2e')]};});_0x229de6['model']=_[_0x377e('0x29')](_0x160ac0,'name');_0x229de6[_0x377e('0x2f')]=_[_0x377e('0x30')](_0x48a41a[_0x377e('0x2f')]);_0x229de6[_0x377e('0x31')]=_[_0x377e('0x32')](_0x229de6[_0x377e('0x33')],_0x229de6[_0x377e('0x2f')]);_0x23f980[_0x377e('0x34')]=_[_0x377e('0x32')](_0x229de6[_0x377e('0x33')],qs[_0x377e('0x35')](_0x48a41a[_0x377e('0x2f')]['fields']));_0x23f980[_0x377e('0x34')]=_0x23f980[_0x377e('0x34')][_0x377e('0x36')]?_0x23f980['attributes']:_0x229de6[_0x377e('0x33')];if(!_0x48a41a[_0x377e('0x2f')]['hasOwnProperty']('nolimit')){_0x23f980[_0x377e('0x1e')]=qs[_0x377e('0x1e')](_0x48a41a[_0x377e('0x2f')]['limit']);_0x23f980[_0x377e('0x1c')]=qs[_0x377e('0x1c')](_0x48a41a[_0x377e('0x2f')]['offset']);}_0x23f980[_0x377e('0x37')]=qs[_0x377e('0x38')](_0x48a41a[_0x377e('0x2f')][_0x377e('0x38')]);_0x23f980['where']=qs[_0x377e('0x31')](_['pick'](_0x48a41a[_0x377e('0x2f')],_0x229de6['filters']),_0x160ac0);if(_0x48a41a[_0x377e('0x2f')][_0x377e('0x39')]){_0x23f980[_0x377e('0x3a')]=_['merge'](_0x23f980[_0x377e('0x3a')],{'$or':_[_0x377e('0x29')](_0x160ac0,function(_0x397ae3){if(_0x397ae3[_0x377e('0x2d')]!==_0x377e('0x3b')){var _0x5dca73={};_0x5dca73[_0x397ae3[_0x377e('0x3c')]]={'$like':'%'+_0x48a41a['query'][_0x377e('0x39')]+'%'};return _0x5dca73;}})});}_0x23f980=_[_0x377e('0x3d')]({},_0x23f980,_0x48a41a[_0x377e('0x3e')]);var _0x20fb4a={'where':_0x23f980['where']};return db[_0x377e('0x2a')]['count'](_0x20fb4a)[_0x377e('0x24')](function(_0x461d78){_0x13185e[_0x377e('0x1f')]=_0x461d78;if(_0x48a41a['query'][_0x377e('0x3f')]){_0x23f980[_0x377e('0x40')]=[{'all':!![]}];}return db[_0x377e('0x2a')][_0x377e('0x41')](_0x23f980);})[_0x377e('0x24')](function(_0x197cbb){_0x13185e['rows']=_0x197cbb;return _0x13185e;})[_0x377e('0x24')](respondWithFilteredResult(_0x3fe193,_0x23f980))['catch'](handleError(_0x3fe193,null));};exports[_0x377e('0x42')]=function(_0x10b4ab,_0x452b10){var _0x2765ce={'raw':!![],'where':{'id':_0x10b4ab[_0x377e('0x43')]['id']}},_0x522c38={};_0x522c38[_0x377e('0x33')]=_['keys'](db['OpenchannelApplication'][_0x377e('0x2b')]);_0x522c38[_0x377e('0x2f')]=_[_0x377e('0x30')](_0x10b4ab[_0x377e('0x2f')]);_0x522c38[_0x377e('0x31')]=_[_0x377e('0x32')](_0x522c38['model'],_0x522c38[_0x377e('0x2f')]);_0x2765ce[_0x377e('0x34')]=_[_0x377e('0x32')](_0x522c38[_0x377e('0x33')],qs[_0x377e('0x35')](_0x10b4ab['query'][_0x377e('0x35')]));_0x2765ce[_0x377e('0x34')]=_0x2765ce[_0x377e('0x34')][_0x377e('0x36')]?_0x2765ce[_0x377e('0x34')]:_0x522c38[_0x377e('0x33')];if(_0x10b4ab['query'][_0x377e('0x3f')]){_0x2765ce[_0x377e('0x40')]=[{'all':!![]}];}_0x2765ce=_['merge']({},_0x2765ce,_0x10b4ab[_0x377e('0x3e')]);return db[_0x377e('0x2a')][_0x377e('0x44')](_0x2765ce)['then'](handleEntityNotFound(_0x452b10,null))[_0x377e('0x24')](respondWithResult(_0x452b10,null))['catch'](handleError(_0x452b10,null));};exports['create']=function(_0x38e7d2,_0x4ecfc3){return db[_0x377e('0x2a')]['create'](_0x38e7d2[_0x377e('0x45')],{})[_0x377e('0x24')](respondWithResult(_0x4ecfc3,0xc9))[_0x377e('0x46')](handleError(_0x4ecfc3,null));};exports['update']=function(_0x597aef,_0x5b0b9c){if(_0x597aef['body']['id']){delete _0x597aef[_0x377e('0x45')]['id'];}return db[_0x377e('0x2a')][_0x377e('0x44')]({'where':{'id':_0x597aef[_0x377e('0x43')]['id']}})[_0x377e('0x24')](handleEntityNotFound(_0x5b0b9c,null))['then'](saveUpdates(_0x597aef[_0x377e('0x45')],null))['then'](respondWithResult(_0x5b0b9c,null))['catch'](handleError(_0x5b0b9c,null));};exports['destroy']=function(_0x27b038,_0x443fdc){return db[_0x377e('0x2a')][_0x377e('0x44')]({'where':{'id':_0x27b038[_0x377e('0x43')]['id']}})[_0x377e('0x24')](handleEntityNotFound(_0x443fdc,null))['then'](removeEntity(_0x443fdc,null))[_0x377e('0x46')](handleError(_0x443fdc,null));}; \ No newline at end of file +var _0x1d32=['crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','catch','params','includeAll','include','find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0xf81b9a,_0x536bf6){var _0x2105a4=function(_0x3a9569){while(--_0x3a9569){_0xf81b9a['push'](_0xf81b9a['shift']());}};_0x2105a4(++_0x536bf6);}(_0x1d32,0x116));var _0x21d3=function(_0x9cf672,_0x367c4f){_0x9cf672=_0x9cf672-0x0;var _0x2778c1=_0x1d32[_0x9cf672];return _0x2778c1;};'use strict';var emlformat=require(_0x21d3('0x0'));var rimraf=require(_0x21d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21d3('0x2'));var rp=require('request-promise');var moment=require(_0x21d3('0x3'));var BPromise=require(_0x21d3('0x4'));var Mustache=require(_0x21d3('0x5'));var util=require(_0x21d3('0x6'));var path=require(_0x21d3('0x7'));var sox=require(_0x21d3('0x8'));var csv=require(_0x21d3('0x9'));var ejs=require(_0x21d3('0xa'));var fs=require('fs');var fs_extra=require(_0x21d3('0xb'));var _=require(_0x21d3('0xc'));var squel=require(_0x21d3('0xd'));var crypto=require(_0x21d3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x21d3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x21d3('0x10'));var authService=require(_0x21d3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x21d3('0x12'));var hardwareService=require(_0x21d3('0x13'));var logger=require(_0x21d3('0x14'))(_0x21d3('0x15'));var utils=require('../../config/utils');var config=require(_0x21d3('0x16'));var licenseUtil=require(_0x21d3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4950d6,_0x551e17){_0x551e17=_0x551e17||0xcc;return function(_0x5b62a3){if(_0x5b62a3){return _0x4950d6[_0x21d3('0x18')](_0x551e17);}return _0x4950d6[_0x21d3('0x19')](_0x551e17)['end']();};}function respondWithResult(_0xd29f0a,_0x239b24){_0x239b24=_0x239b24||0xc8;return function(_0x54afea){if(_0x54afea){return _0xd29f0a[_0x21d3('0x19')](_0x239b24)[_0x21d3('0x1a')](_0x54afea);}};}function respondWithFilteredResult(_0x2508c,_0x56e565){return function(_0x3a3cdd){if(_0x3a3cdd){var _0x49baa5=typeof _0x56e565['offset']===_0x21d3('0x1b')&&typeof _0x56e565[_0x21d3('0x1c')]===_0x21d3('0x1b');var _0x31c3af=_0x3a3cdd[_0x21d3('0x1d')];var _0x582d5d=_0x49baa5?0x0:_0x56e565[_0x21d3('0x1e')];var _0x5a9a74=_0x49baa5?_0x3a3cdd[_0x21d3('0x1d')]:_0x56e565[_0x21d3('0x1e')]+_0x56e565[_0x21d3('0x1c')];var _0x130562;if(_0x5a9a74>=_0x31c3af){_0x5a9a74=_0x31c3af;_0x130562=0xc8;}else{_0x130562=0xce;}_0x2508c['status'](_0x130562);return _0x2508c[_0x21d3('0x1f')](_0x21d3('0x20'),_0x582d5d+'-'+_0x5a9a74+'/'+_0x31c3af)[_0x21d3('0x1a')](_0x3a3cdd);}return null;};}function patchUpdates(_0x26e4b2){return function(_0x15bb12){try{jsonpatch[_0x21d3('0x21')](_0x15bb12,_0x26e4b2,!![]);}catch(_0x2d2d78){return BPromise[_0x21d3('0x22')](_0x2d2d78);}return _0x15bb12[_0x21d3('0x23')]();};}function saveUpdates(_0x41ec4f,_0xa8d7b8){return function(_0x3262e7){if(_0x3262e7){return _0x3262e7[_0x21d3('0x24')](_0x41ec4f)[_0x21d3('0x25')](function(_0x5143fd){return _0x5143fd;});}return null;};}function removeEntity(_0x45b918,_0x550c34){return function(_0x540adc){if(_0x540adc){return _0x540adc[_0x21d3('0x26')]()[_0x21d3('0x25')](function(){_0x45b918[_0x21d3('0x19')](0xcc)[_0x21d3('0x27')]();});}};}function handleEntityNotFound(_0x3abbab,_0x36fff5){return function(_0x2068da){if(!_0x2068da){_0x3abbab[_0x21d3('0x18')](0x194);}return _0x2068da;};}function handleError(_0x14b6e8,_0x24d595){_0x24d595=_0x24d595||0x1f4;return function(_0x3bce16){logger['error'](_0x3bce16['stack']);if(_0x3bce16[_0x21d3('0x28')]){delete _0x3bce16[_0x21d3('0x28')];}_0x14b6e8[_0x21d3('0x19')](_0x24d595)[_0x21d3('0x29')](_0x3bce16);};}exports[_0x21d3('0x2a')]=function(_0x4e0bb4,_0x49e860){var _0x413cc5={},_0x2ace2a={},_0x1bf9d2={'count':0x0,'rows':[]};var _0x4cebbf=_[_0x21d3('0x2b')](db[_0x21d3('0x2c')][_0x21d3('0x2d')],function(_0x579a5a){return{'name':_0x579a5a[_0x21d3('0x2e')],'type':_0x579a5a[_0x21d3('0x2f')][_0x21d3('0x30')]};});_0x2ace2a[_0x21d3('0x31')]=_[_0x21d3('0x2b')](_0x4cebbf,'name');_0x2ace2a['query']=_[_0x21d3('0x32')](_0x4e0bb4[_0x21d3('0x33')]);_0x2ace2a[_0x21d3('0x34')]=_[_0x21d3('0x35')](_0x2ace2a[_0x21d3('0x31')],_0x2ace2a[_0x21d3('0x33')]);_0x413cc5[_0x21d3('0x36')]=_['intersection'](_0x2ace2a[_0x21d3('0x31')],qs[_0x21d3('0x37')](_0x4e0bb4['query'][_0x21d3('0x37')]));_0x413cc5[_0x21d3('0x36')]=_0x413cc5['attributes'][_0x21d3('0x38')]?_0x413cc5['attributes']:_0x2ace2a[_0x21d3('0x31')];if(!_0x4e0bb4['query'][_0x21d3('0x39')](_0x21d3('0x3a'))){_0x413cc5[_0x21d3('0x1c')]=qs[_0x21d3('0x1c')](_0x4e0bb4[_0x21d3('0x33')]['limit']);_0x413cc5['offset']=qs[_0x21d3('0x1e')](_0x4e0bb4[_0x21d3('0x33')][_0x21d3('0x1e')]);}_0x413cc5[_0x21d3('0x3b')]=qs[_0x21d3('0x3c')](_0x4e0bb4[_0x21d3('0x33')]['sort']);_0x413cc5['where']=qs[_0x21d3('0x34')](_['pick'](_0x4e0bb4['query'],_0x2ace2a['filters']),_0x4cebbf);if(_0x4e0bb4['query'][_0x21d3('0x3d')]){_0x413cc5[_0x21d3('0x3e')]=_[_0x21d3('0x3f')](_0x413cc5[_0x21d3('0x3e')],{'$or':_[_0x21d3('0x2b')](_0x4cebbf,function(_0x18bd09){if(_0x18bd09[_0x21d3('0x2f')]!=='VIRTUAL'){var _0x3e53d6={};_0x3e53d6[_0x18bd09[_0x21d3('0x28')]]={'$like':'%'+_0x4e0bb4['query'][_0x21d3('0x3d')]+'%'};return _0x3e53d6;}})});}_0x413cc5=_[_0x21d3('0x3f')]({},_0x413cc5,_0x4e0bb4[_0x21d3('0x40')]);var _0x26fcee={'where':_0x413cc5[_0x21d3('0x3e')]};return db['OpenchannelApplication'][_0x21d3('0x1d')](_0x26fcee)[_0x21d3('0x25')](function(_0x5a3141){_0x1bf9d2[_0x21d3('0x1d')]=_0x5a3141;if(_0x4e0bb4[_0x21d3('0x33')]['includeAll']){_0x413cc5['include']=[{'all':!![]}];}return db[_0x21d3('0x2c')][_0x21d3('0x41')](_0x413cc5);})['then'](function(_0x2ed00d){_0x1bf9d2['rows']=_0x2ed00d;return _0x1bf9d2;})[_0x21d3('0x25')](respondWithFilteredResult(_0x49e860,_0x413cc5))[_0x21d3('0x42')](handleError(_0x49e860,null));};exports['show']=function(_0x143da3,_0x541dc7){var _0x3efbce={'raw':!![],'where':{'id':_0x143da3[_0x21d3('0x43')]['id']}},_0x2e9935={};_0x2e9935['model']=_[_0x21d3('0x32')](db['OpenchannelApplication'][_0x21d3('0x2d')]);_0x2e9935['query']=_[_0x21d3('0x32')](_0x143da3[_0x21d3('0x33')]);_0x2e9935['filters']=_[_0x21d3('0x35')](_0x2e9935[_0x21d3('0x31')],_0x2e9935[_0x21d3('0x33')]);_0x3efbce['attributes']=_[_0x21d3('0x35')](_0x2e9935['model'],qs[_0x21d3('0x37')](_0x143da3[_0x21d3('0x33')]['fields']));_0x3efbce[_0x21d3('0x36')]=_0x3efbce[_0x21d3('0x36')][_0x21d3('0x38')]?_0x3efbce[_0x21d3('0x36')]:_0x2e9935[_0x21d3('0x31')];if(_0x143da3[_0x21d3('0x33')][_0x21d3('0x44')]){_0x3efbce[_0x21d3('0x45')]=[{'all':!![]}];}_0x3efbce=_[_0x21d3('0x3f')]({},_0x3efbce,_0x143da3['options']);return db['OpenchannelApplication'][_0x21d3('0x46')](_0x3efbce)[_0x21d3('0x25')](handleEntityNotFound(_0x541dc7,null))[_0x21d3('0x25')](respondWithResult(_0x541dc7,null))[_0x21d3('0x42')](handleError(_0x541dc7,null));};exports['create']=function(_0x572dba,_0x50a91f){return db[_0x21d3('0x2c')][_0x21d3('0x47')](_0x572dba['body'],{})[_0x21d3('0x25')](respondWithResult(_0x50a91f,0xc9))['catch'](handleError(_0x50a91f,null));};exports[_0x21d3('0x24')]=function(_0x5a022a,_0x564c06){if(_0x5a022a['body']['id']){delete _0x5a022a[_0x21d3('0x48')]['id'];}return db[_0x21d3('0x2c')][_0x21d3('0x46')]({'where':{'id':_0x5a022a[_0x21d3('0x43')]['id']}})[_0x21d3('0x25')](handleEntityNotFound(_0x564c06,null))[_0x21d3('0x25')](saveUpdates(_0x5a022a[_0x21d3('0x48')],null))[_0x21d3('0x25')](respondWithResult(_0x564c06,null))[_0x21d3('0x42')](handleError(_0x564c06,null));};exports[_0x21d3('0x26')]=function(_0x3c01a8,_0xaa4af){return db[_0x21d3('0x2c')][_0x21d3('0x46')]({'where':{'id':_0x3c01a8[_0x21d3('0x43')]['id']}})[_0x21d3('0x25')](handleEntityNotFound(_0xaa4af,null))[_0x21d3('0x25')](removeEntity(_0xaa4af,null))[_0x21d3('0x42')](handleError(_0xaa4af,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 6b28847..8d4a808 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 _0xf0d6=['moment','request-promise','path','rimraf','./openchannelApplication.attributes','exports','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf0d6,0x183));var _0x6f0d=function(_0x1bdedd,_0x2b53bc){_0x1bdedd=_0x1bdedd-0x0;var _0x22335a=_0xf0d6[_0x1bdedd];return _0x22335a;};'use strict';var _=require(_0x6f0d('0x0'));var util=require('util');var logger=require(_0x6f0d('0x1'))(_0x6f0d('0x2'));var moment=require(_0x6f0d('0x3'));var BPromise=require('bluebird');var rp=require(_0x6f0d('0x4'));var fs=require('fs');var path=require(_0x6f0d('0x5'));var rimraf=require(_0x6f0d('0x6'));var config=require('../../config/environment');var attributes=require(_0x6f0d('0x7'));module[_0x6f0d('0x8')]=function(_0x50bc98,_0x26458e){return _0x50bc98['define'](_0x6f0d('0x9'),attributes,{'tableName':_0x6f0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6f0d('0xb'),'collate':_0x6f0d('0xc')});}; \ No newline at end of file +var _0xf9c5=['./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1f301f,_0x433c95){var _0x383749=function(_0x36a6f4){while(--_0x36a6f4){_0x1f301f['push'](_0x1f301f['shift']());}};_0x383749(++_0x433c95);}(_0xf9c5,0x73));var _0x5f9c=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf9c5[_0x36ed48];return _0x51c63a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f9c('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5f9c('0x1'));var rp=require(_0x5f9c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f9c('0x3'));var config=require(_0x5f9c('0x4'));var attributes=require(_0x5f9c('0x5'));module['exports']=function(_0x453d27,_0x4e8aae){return _0x453d27[_0x5f9c('0x6')](_0x5f9c('0x7'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5f9c('0x8'),'collate':_0x5f9c('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 5f2da6c..2679a6a 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 _0x551c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','util','moment'];(function(_0x37554c,_0x8af708){var _0x57de0e=function(_0x525739){while(--_0x525739){_0x37554c['push'](_0x37554c['shift']());}};_0x57de0e(++_0x8af708);}(_0x551c,0x195));var _0xc551=function(_0x5c3f9d,_0x46774c){_0x5c3f9d=_0x5c3f9d-0x0;var _0xfe63d3=_0x551c[_0x5c3f9d];return _0xfe63d3;};'use strict';var _=require(_0xc551('0x0'));var util=require(_0xc551('0x1'));var moment=require(_0xc551('0x2'));var BPromise=require(_0xc551('0x3'));var rs=require(_0xc551('0x4'));var fs=require('fs');var Redis=require(_0xc551('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc551('0x6'));var logger=require(_0xc551('0x7'))(_0xc551('0x8'));var config=require(_0xc551('0x9'));var jayson=require(_0xc551('0xa'));var client=jayson[_0xc551('0xb')][_0xc551('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43f1c1,_0x20b0c9,_0x4c6797){return new BPromise(function(_0x559e81,_0x1571b7){return client[_0xc551('0xd')](_0x43f1c1,_0x4c6797)[_0xc551('0xe')](function(_0x580b14){logger[_0xc551('0xf')](_0xc551('0x10'),_0x20b0c9,_0xc551('0x11'));logger[_0xc551('0x12')](_0xc551('0x13'),_0x20b0c9,'request\x20sent',JSON[_0xc551('0x14')](_0x580b14));if(_0x580b14[_0xc551('0x15')]){if(_0x580b14[_0xc551('0x15')][_0xc551('0x16')]===0x1f4){logger[_0xc551('0x15')](_0xc551('0x10'),_0x20b0c9,_0x580b14['error']['message']);return _0x1571b7(_0x580b14[_0xc551('0x15')][_0xc551('0x17')]);}logger[_0xc551('0x15')]('OpenchannelApplication,\x20%s,\x20%s',_0x20b0c9,_0x580b14[_0xc551('0x15')][_0xc551('0x17')]);return _0x559e81(_0x580b14[_0xc551('0x15')]['message']);}else{logger[_0xc551('0xf')]('OpenchannelApplication,\x20%s,\x20%s',_0x20b0c9,_0xc551('0x11'));_0x559e81(_0x580b14[_0xc551('0x18')][_0xc551('0x17')]);}})[_0xc551('0x19')](function(_0x476030){logger[_0xc551('0x15')](_0xc551('0x10'),_0x20b0c9,_0x476030);_0x1571b7(_0x476030);});});}exports[_0xc551('0x1a')]=function(_0xd6e4b8){var _0x4f1517=this;return new Promise(function(_0x368c3a,_0x107a26){return db[_0xc551('0x1b')][_0xc551('0x1c')](_0xd6e4b8[_0xc551('0x1d')],{'raw':_0xd6e4b8[_0xc551('0x1e')]?_0xd6e4b8['options'][_0xc551('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd6e4b8[_0xc551('0x1e')]?_0xd6e4b8['options'][_0xc551('0x20')]||null:null,'attributes':_0xd6e4b8[_0xc551('0x1e')]?_0xd6e4b8[_0xc551('0x1e')]['attributes']||null:null,'limit':_0xd6e4b8['options']?_0xd6e4b8[_0xc551('0x1e')][_0xc551('0x21')]||null:null})[_0xc551('0xe')](function(_0x573179){logger[_0xc551('0xf')](_0xc551('0x1a'),_0xd6e4b8);logger[_0xc551('0x12')]('UpdateOpenchannelApplication',_0xd6e4b8,JSON[_0xc551('0x14')](_0x573179));_0x368c3a(_0x573179);})[_0xc551('0x19')](function(_0x2943ac){logger[_0xc551('0x15')](_0xc551('0x1a'),_0x2943ac['message'],_0xd6e4b8);_0x107a26(_0x4f1517[_0xc551('0x15')](0x1f4,_0x2943ac[_0xc551('0x17')]));});});}; \ No newline at end of file +var _0x71a6=['request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','limit','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','OpenchannelApplication,\x20%s,\x20%s'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x71a6,0x66));var _0x671a=function(_0x58eec7,_0x2353db){_0x58eec7=_0x58eec7-0x0;var _0x25c5d3=_0x71a6[_0x58eec7];return _0x25c5d3;};'use strict';var _=require(_0x671a('0x0'));var util=require('util');var moment=require(_0x671a('0x1'));var BPromise=require(_0x671a('0x2'));var rs=require(_0x671a('0x3'));var fs=require('fs');var Redis=require(_0x671a('0x4'));var db=require(_0x671a('0x5'))['db'];var utils=require(_0x671a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x671a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x671a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57c91b,_0x45af40,_0x3b0906){return new BPromise(function(_0x1e39b3,_0x411575){return client['request'](_0x57c91b,_0x3b0906)['then'](function(_0x5562d6){logger['info'](_0x671a('0x9'),_0x45af40,_0x671a('0xa'));logger[_0x671a('0xb')](_0x671a('0xc'),_0x45af40,_0x671a('0xa'),JSON[_0x671a('0xd')](_0x5562d6));if(_0x5562d6['error']){if(_0x5562d6[_0x671a('0xe')][_0x671a('0xf')]===0x1f4){logger[_0x671a('0xe')](_0x671a('0x9'),_0x45af40,_0x5562d6[_0x671a('0xe')]['message']);return _0x411575(_0x5562d6['error'][_0x671a('0x10')]);}logger['error'](_0x671a('0x9'),_0x45af40,_0x5562d6[_0x671a('0xe')]['message']);return _0x1e39b3(_0x5562d6['error']['message']);}else{logger[_0x671a('0x11')](_0x671a('0x9'),_0x45af40,_0x671a('0xa'));_0x1e39b3(_0x5562d6[_0x671a('0x12')][_0x671a('0x10')]);}})[_0x671a('0x13')](function(_0x2fb4c3){logger[_0x671a('0xe')](_0x671a('0x9'),_0x45af40,_0x2fb4c3);_0x411575(_0x2fb4c3);});});}exports[_0x671a('0x14')]=function(_0x218d64){var _0x27c0fd=this;return new Promise(function(_0x92f8b9,_0x419e3f){return db[_0x671a('0x15')][_0x671a('0x16')](_0x218d64['body'],{'raw':_0x218d64[_0x671a('0x17')]?_0x218d64['options'][_0x671a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x218d64[_0x671a('0x17')]?_0x218d64['options'][_0x671a('0x19')]||null:null,'attributes':_0x218d64[_0x671a('0x17')]?_0x218d64[_0x671a('0x17')]['attributes']||null:null,'limit':_0x218d64['options']?_0x218d64[_0x671a('0x17')][_0x671a('0x1a')]||null:null})[_0x671a('0x1b')](function(_0xd816fe){logger[_0x671a('0x11')]('UpdateOpenchannelApplication',_0x218d64);logger[_0x671a('0xb')]('UpdateOpenchannelApplication',_0x218d64,JSON[_0x671a('0xd')](_0xd816fe));_0x92f8b9(_0xd816fe);})[_0x671a('0x13')](function(_0x459f6d){logger[_0x671a('0xe')]('UpdateOpenchannelApplication',_0x459f6d[_0x671a('0x10')],_0x218d64);_0x419e3f(_0x27c0fd['error'](0x1f4,_0x459f6d[_0x671a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 89742b4..943256f 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 _0x3ff1=['/:id/tags','tracked','openchannel','addTags','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','isAuthenticated','get','/:id/messages','/:id/download','download','create','post','addMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ff1,0x72));var _0x13ff=function(_0xe85858,_0x3560be){_0xe85858=_0xe85858-0x0;var _0x27c87e=_0x3ff1[_0xe85858];return _0x27c87e;};'use strict';var multer=require(_0x13ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x13ff('0x1'));var express=require(_0x13ff('0x2'));var router=express[_0x13ff('0x3')]();var fs_extra=require(_0x13ff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x13ff('0x5'));var config=require(_0x13ff('0x6'));var controller=require(_0x13ff('0x7'));router['get']('/',auth[_0x13ff('0x8')](),controller['index']);router['get']('/describe',auth[_0x13ff('0x8')](),controller['describe']);router[_0x13ff('0x9')]('/:id',auth[_0x13ff('0x8')](),controller['show']);router[_0x13ff('0x9')](_0x13ff('0xa'),auth[_0x13ff('0x8')](),controller['getMessages']);router['get'](_0x13ff('0xb'),auth['isAuthenticated'](),controller[_0x13ff('0xc')]);router['post']('/',auth[_0x13ff('0x8')](),controller[_0x13ff('0xd')]);router[_0x13ff('0xe')](_0x13ff('0xa'),auth[_0x13ff('0x8')](),controller[_0x13ff('0xf')]);router['post'](_0x13ff('0x10'),auth[_0x13ff('0x8')](),interaction[_0x13ff('0x11')](_0x13ff('0x12'),'openchannelinteraction:addtags'),controller[_0x13ff('0x13')]);router[_0x13ff('0x14')](_0x13ff('0x15'),auth[_0x13ff('0x8')](),interaction['tracked'](_0x13ff('0x12'),_0x13ff('0x16')),controller['update']);router[_0x13ff('0x17')]('/:id',auth[_0x13ff('0x8')](),interaction['tracked'](_0x13ff('0x12'),_0x13ff('0x18')),controller[_0x13ff('0x19')]);router[_0x13ff('0x17')]('/:id/tags',auth[_0x13ff('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xeafc=['../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','index','isAuthenticated','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x1a5aa7,_0x4d01d7){var _0x252904=function(_0x23b256){while(--_0x23b256){_0x1a5aa7['push'](_0x1a5aa7['shift']());}};_0x252904(++_0x4d01d7);}(_0xeafc,0x7e));var _0xceaf=function(_0x16d64e,_0x3d4575){_0x16d64e=_0x16d64e-0x0;var _0x49ae59=_0xeafc[_0x16d64e];return _0x49ae59;};'use strict';var multer=require(_0xceaf('0x0'));var util=require(_0xceaf('0x1'));var path=require(_0xceaf('0x2'));var timeout=require(_0xceaf('0x3'));var express=require(_0xceaf('0x4'));var router=express['Router']();var fs_extra=require(_0xceaf('0x5'));var auth=require(_0xceaf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xceaf('0x7'));var controller=require(_0xceaf('0x8'));router[_0xceaf('0x9')]('/',auth['isAuthenticated'](),controller[_0xceaf('0xa')]);router[_0xceaf('0x9')]('/describe',auth[_0xceaf('0xb')](),controller['describe']);router[_0xceaf('0x9')](_0xceaf('0xc'),auth[_0xceaf('0xb')](),controller[_0xceaf('0xd')]);router[_0xceaf('0x9')]('/:id/messages',auth[_0xceaf('0xb')](),controller[_0xceaf('0xe')]);router[_0xceaf('0x9')](_0xceaf('0xf'),auth['isAuthenticated'](),controller[_0xceaf('0x10')]);router[_0xceaf('0x11')]('/',auth[_0xceaf('0xb')](),controller[_0xceaf('0x12')]);router[_0xceaf('0x11')](_0xceaf('0x13'),auth[_0xceaf('0xb')](),controller[_0xceaf('0x14')]);router[_0xceaf('0x11')](_0xceaf('0x15'),auth[_0xceaf('0xb')](),interaction[_0xceaf('0x16')](_0xceaf('0x17'),_0xceaf('0x18')),controller[_0xceaf('0x19')]);router[_0xceaf('0x1a')](_0xceaf('0xc'),auth[_0xceaf('0xb')](),interaction['tracked'](_0xceaf('0x17'),_0xceaf('0x1b')),controller[_0xceaf('0x1c')]);router[_0xceaf('0x1d')](_0xceaf('0xc'),auth[_0xceaf('0xb')](),interaction[_0xceaf('0x16')](_0xceaf('0x17'),_0xceaf('0x1e')),controller['destroy']);router[_0xceaf('0x1d')](_0xceaf('0x15'),auth[_0xceaf('0xb')](),controller[_0xceaf('0x1f')]);module[_0xceaf('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 1f9e727..1494baa 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 _0xf23b=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xf23b,0x133));var _0xbf23=function(_0x4e7ffb,_0x1a0eee){_0x4e7ffb=_0x4e7ffb-0x0;var _0x203cf0=_0xf23b[_0x4e7ffb];return _0x203cf0;};'use strict';var Sequelize=require(_0xbf23('0x0'));module[_0xbf23('0x1')]={'closed':{'type':Sequelize[_0xbf23('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbf23('0x3')]},'disposition':{'type':Sequelize[_0xbf23('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xbf23('0x4')]},'note':{'type':Sequelize[_0xbf23('0x4')]},'read1stAt':{'type':Sequelize[_0xbf23('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xbf23('0x4')]},'lastMsgAt':{'type':Sequelize[_0xbf23('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xbf23('0x5')]('in',_0xbf23('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xbf23('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x32ef=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x1b353a,_0x4b9ac3){var _0x599b46=function(_0x3f2d00){while(--_0x3f2d00){_0x1b353a['push'](_0x1b353a['shift']());}};_0x599b46(++_0x4b9ac3);}(_0x32ef,0xf9));var _0xf32e=function(_0x33b8a2,_0x4eef84){_0x33b8a2=_0x33b8a2-0x0;var _0x5f1077=_0x32ef[_0x33b8a2];return _0x5f1077;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'closed':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf32e('0x3')]},'disposition':{'type':Sequelize[_0xf32e('0x4')]},'secondDisposition':{'type':Sequelize[_0xf32e('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf32e('0x4')]},'read1stAt':{'type':Sequelize[_0xf32e('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xf32e('0x4')]},'lastMsgAt':{'type':Sequelize[_0xf32e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xf32e('0x5')]('in',_0xf32e('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xf32e('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xf32e('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 3f1a319..19179cf 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 _0xc78c=['Contact.phone','c.mobile','Contact.mobile','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','options','create','describe','addMessage','OpenchannelMessage','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','ids','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','server','join','root','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','out','System','firstName','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','waiting','talking','answered','unmanaged','total','UserId','closed','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','tools_tags','u.id','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','openchannel_interaction_has_tags','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','buildExpression','text','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','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?','group','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','c.email','Contact.email','c.phone'];(function(_0x18b7cb,_0x1ab098){var _0x11b7f0=function(_0x1437f7){while(--_0x1437f7){_0x18b7cb['push'](_0x18b7cb['shift']());}};_0x11b7f0(++_0x1ab098);}(_0xc78c,0x148));var _0xcc78=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc78c[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xcc78('0x0'));var rimraf=require(_0xcc78('0x1'));var zipdir=require(_0xcc78('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc78('0x3'));var moment=require(_0xcc78('0x4'));var BPromise=require(_0xcc78('0x5'));var Mustache=require(_0xcc78('0x6'));var util=require('util');var path=require(_0xcc78('0x7'));var sox=require(_0xcc78('0x8'));var csv=require(_0xcc78('0x9'));var ejs=require(_0xcc78('0xa'));var fs=require('fs');var fs_extra=require(_0xcc78('0xb'));var _=require(_0xcc78('0xc'));var squel=require(_0xcc78('0xd'));var crypto=require(_0xcc78('0xe'));var jsforce=require(_0xcc78('0xf'));var deskjs=require(_0xcc78('0x10'));var toCsv=require(_0xcc78('0x9'));var querystring=require(_0xcc78('0x11'));var Papa=require(_0xcc78('0x12'));var Redis=require(_0xcc78('0x13'));var authService=require(_0xcc78('0x14'));var qs=require(_0xcc78('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xcc78('0x16'));var hardwareService=require(_0xcc78('0x17'));var logger=require('../../config/logger')(_0xcc78('0x18'));var utils=require('../../config/utils');var config=require(_0xcc78('0x19'));var licenseUtil=require(_0xcc78('0x1a'));var db=require(_0xcc78('0x1b'))['db'];config[_0xcc78('0x1c')]=_[_0xcc78('0x1d')](config['redis'],{'host':_0xcc78('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc78('0x1c')]));require(_0xcc78('0x1f'))[_0xcc78('0x20')](socket);function respondWithStatusCode(_0x547c90,_0x5bec5a){_0x5bec5a=_0x5bec5a||0xcc;return function(_0x43a891){if(_0x43a891){return _0x547c90[_0xcc78('0x21')](_0x5bec5a);}return _0x547c90[_0xcc78('0x22')](_0x5bec5a)[_0xcc78('0x23')]();};}function respondWithResult(_0xcb738,_0x56d887){_0x56d887=_0x56d887||0xc8;return function(_0x2656a0){if(_0x2656a0){return _0xcb738[_0xcc78('0x22')](_0x56d887)[_0xcc78('0x24')](_0x2656a0);}};}function respondWithFilteredResult(_0x146d30,_0x5e200c){return function(_0x40a2d0){if(_0x40a2d0){var _0x5a2d5a=typeof _0x5e200c[_0xcc78('0x25')]==='undefined'&&typeof _0x5e200c[_0xcc78('0x26')]==='undefined';var _0x2e5d07=_0x40a2d0['count'];var _0xe46490=_0x5a2d5a?0x0:_0x5e200c[_0xcc78('0x25')];var _0x2ff18e=_0x5a2d5a?_0x40a2d0[_0xcc78('0x27')]:_0x5e200c[_0xcc78('0x25')]+_0x5e200c[_0xcc78('0x26')];var _0x2488e9;if(_0x2ff18e>=_0x2e5d07){_0x2ff18e=_0x2e5d07;_0x2488e9=0xc8;}else{_0x2488e9=0xce;}_0x146d30[_0xcc78('0x22')](_0x2488e9);return _0x146d30[_0xcc78('0x28')]('Content-Range',_0xe46490+'-'+_0x2ff18e+'/'+_0x2e5d07)[_0xcc78('0x24')](_0x40a2d0);}return null;};}function patchUpdates(_0x2f1970){return function(_0x323321){try{jsonpatch[_0xcc78('0x29')](_0x323321,_0x2f1970,!![]);}catch(_0x361e0f){return BPromise[_0xcc78('0x2a')](_0x361e0f);}return _0x323321[_0xcc78('0x2b')]();};}function saveUpdates(_0x356374,_0x3a4dd7){return function(_0x534396){if(_0x534396){return _0x534396[_0xcc78('0x2c')](_0x356374)[_0xcc78('0x2d')](function(_0x4816b9){return _0x4816b9;});}return null;};}function removeEntity(_0x3379e8,_0x11acee){return function(_0x5b8e01){if(_0x5b8e01){return _0x5b8e01[_0xcc78('0x2e')]()['then'](function(){_0x3379e8[_0xcc78('0x22')](0xcc)[_0xcc78('0x23')]();});}};}function handleEntityNotFound(_0x2ebbaf,_0x2eecfd){return function(_0x5c6148){if(!_0x5c6148){_0x2ebbaf[_0xcc78('0x21')](0x194);}return _0x5c6148;};}function handleError(_0xa4c90b,_0x4c216c){_0x4c216c=_0x4c216c||0x1f4;return function(_0x23d2b6){logger[_0xcc78('0x2f')](_0x23d2b6[_0xcc78('0x30')]);if(_0x23d2b6['name']){delete _0x23d2b6[_0xcc78('0x31')];}_0xa4c90b[_0xcc78('0x22')](_0x4c216c)[_0xcc78('0x32')](_0x23d2b6);};}function getInteractionUsers(_0x2b9ffa,_0x35efb1){return new BPromise(function(_0x5f4a88,_0x49e66f){try{if(_0x35efb1[_0x2b9ffa['id']]){_0x2b9ffa['Users']=_[_0xcc78('0x33')](_0x35efb1[_0x2b9ffa['id']],function(_0x30f99c){return{'id':_0x30f99c['id'],'fullname':_0x30f99c[_0xcc78('0x34')]};});}}catch(_0x416e4f){_0x49e66f(_0x416e4f);}_0x5f4a88(_0x2b9ffa);});}function getInteractionTags(_0x5936ec,_0x1bb636){return new BPromise(function(_0x582e3b,_0x5e137c){try{if(_0x5936ec[_0xcc78('0x35')]){_0x5936ec['Tags']=[];_0x5936ec['TagIds'][_0xcc78('0x36')](',')[_0xcc78('0x37')](function(_0x2c574d){_0x5936ec[_0xcc78('0x38')][_0xcc78('0x39')](_0x1bb636[_0x2c574d]);});}delete _0x5936ec[_0xcc78('0x35')];}catch(_0x4688d8){_0x5e137c(_0x4688d8);}_0x582e3b(_0x5936ec);});}function updateOpenchannelInteraction(_0x2dfc19,_0x3f9b30,_0x5389f1){return new BPromise(function(_0x39a740,_0xa48867){return getInteractionUsers(_0x2dfc19,_0x5389f1)[_0xcc78('0x2d')](function(_0x49c5d8){return getInteractionTags(_0x49c5d8,_0x3f9b30);})['then'](function(_0x1c3b61){return getStateInteraction(_0x1c3b61);})['then'](function(_0x4f9514){_0x39a740(_0x4f9514);})[_0xcc78('0x3a')](function(_0x320284){_0xa48867(_0x320284);});});}function getStateInteraction(_0x3afbe9){return new BPromise(function(_0x41c632){_0x3afbe9[_0xcc78('0x3b')]=0x0;_0x3afbe9[_0xcc78('0x3c')]=0x0;_0x3afbe9[_0xcc78('0x3d')]=0x0;_0x3afbe9[_0xcc78('0x3e')]=0x0;_0x3afbe9[_0xcc78('0x3f')]=0x0;if(!_0x3afbe9['closed']&&!_0x3afbe9[_0xcc78('0x40')]){_0x3afbe9[_0xcc78('0x3b')]+=0x1;}if(!_0x3afbe9[_0xcc78('0x41')]&&_0x3afbe9[_0xcc78('0x40')]){_0x3afbe9['talking']+=0x1;if(_0x3afbe9[_0xcc78('0x3b')]){_0x3afbe9['waiting']-=0x1;}}if(_0x3afbe9[_0xcc78('0x41')]&&_0x3afbe9[_0xcc78('0x40')]){_0x3afbe9[_0xcc78('0x3d')]+=0x1;if(_0x3afbe9[_0xcc78('0x3c')]){_0x3afbe9[_0xcc78('0x3c')]-=0x1;}}if(_0x3afbe9[_0xcc78('0x41')]&&!_0x3afbe9[_0xcc78('0x40')]){_0x3afbe9[_0xcc78('0x3e')]+=0x1;if(_0x3afbe9['waiting']){_0x3afbe9[_0xcc78('0x3b')]-=0x1;}}_0x3afbe9[_0xcc78('0x3f')]+=0x1;_0x41c632(_0x3afbe9);});}exports[_0xcc78('0x42')]=function(_0x3badb2,_0x4fb3d3){var _0x4cbab8={},_0x263ca3={},_0x5807e3={'count':0x0,'rows':[]};var _0x2d49f7=_[_0xcc78('0x33')](db[_0xcc78('0x43')][_0xcc78('0x44')],function(_0x3d1bd3){return{'name':_0x3d1bd3[_0xcc78('0x45')],'type':_0x3d1bd3[_0xcc78('0x46')][_0xcc78('0x47')]};});_0x263ca3[_0xcc78('0x48')]=_[_0xcc78('0x33')](_0x2d49f7,_0xcc78('0x31'));_0x263ca3[_0xcc78('0x49')]=_[_0xcc78('0x4a')](_0x3badb2['query']);_0x263ca3[_0xcc78('0x4b')]=_[_0xcc78('0x4c')](_0x263ca3[_0xcc78('0x48')],_0x263ca3[_0xcc78('0x49')]);_0x4cbab8['attributes']=_[_0xcc78('0x4c')](_0x263ca3[_0xcc78('0x48')],qs[_0xcc78('0x4d')](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x4d')]));_0x4cbab8[_0xcc78('0x4e')]=_0x4cbab8['attributes'][_0xcc78('0x4f')]?_0x4cbab8[_0xcc78('0x4e')]:_0x263ca3[_0xcc78('0x48')];if(!_0x3badb2[_0xcc78('0x49')][_0xcc78('0x50')]('nolimit')){_0x4cbab8[_0xcc78('0x26')]=qs['limit'](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x26')]);_0x4cbab8['offset']=qs[_0xcc78('0x25')](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x25')]);}_0x4cbab8[_0xcc78('0x51')]=qs['sort'](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x52')]);_0x4cbab8[_0xcc78('0x53')]=qs[_0xcc78('0x4b')](_[_0xcc78('0x54')](_0x3badb2[_0xcc78('0x49')],_0x263ca3[_0xcc78('0x4b')]),_0x2d49f7);var _0x48c783=[];var _0x31396d=squel[_0xcc78('0x55')]()['field']('id')[_0xcc78('0x56')]('name')[_0xcc78('0x56')](_0xcc78('0x57'))['from'](_0xcc78('0x58'));var _0x339999=squel[_0xcc78('0x55')]()[_0xcc78('0x56')](_0xcc78('0x59'))[_0xcc78('0x56')]('u.fullname')[_0xcc78('0x56')](_0xcc78('0x5a'))[_0xcc78('0x5b')](_0xcc78('0x5c'),'ui')['left_join'](_0xcc78('0x5d'),'u',_0xcc78('0x5e'));var _0x31b10e=squel['select']()['from'](_0xcc78('0x5f'),'i')[_0xcc78('0x60')](_0xcc78('0x61'),'c',_0xcc78('0x62'))[_0xcc78('0x60')](_0xcc78('0x5d'),'o',_0xcc78('0x63'))['left_join']('openchannel_accounts','a',_0xcc78('0x64'))[_0xcc78('0x60')](_0xcc78('0x65'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xcc78('0x60')](_0xcc78('0x66'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xcc78('0x60')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x46cba2=squel[_0xcc78('0x67')]();var _0x3b6b43=[];var _0x412c89=squel[_0xcc78('0x67')]();var _0x363d28;if(_0x3badb2['query']['search']){_0x363d28=as[_0xcc78('0x68')](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x69')]);var _0x521e25=_0x363d28[_0xcc78('0x6a')];for(var _0x3bc9d0=0x0;_0x3bc9d0<_0x363d28['conditions'][_0xcc78('0x4f')];_0x3bc9d0++){var _0x3934f9=_0x363d28[_0xcc78('0x6b')][_0x3bc9d0];var _0x40173e='i';var _0x3c9ea5=_[_0xcc78('0x6c')](_0x2d49f7,[_0xcc78('0x31'),_0x3934f9[_0xcc78('0x56')]]);if(!_0x3c9ea5){switch(_0x3934f9['field']){case _0xcc78('0x6d'):if(_0x3934f9[_0xcc78('0x6e')]==0x1){_0x31b10e[_0xcc78('0x6f')]('`'+_0x3934f9[_0xcc78('0x56')]+_0xcc78('0x70'));}else{_0x31b10e['having']('`'+_0x3934f9[_0xcc78('0x56')]+'`\x20>\x200');}break;case _0xcc78('0x71'):if(_0x3934f9[_0xcc78('0x72')]==='$substring'){if(_0x3934f9[_0xcc78('0x6e')][_0xcc78('0x36')]('\x20')[_0xcc78('0x4f')]>0x1){_0x46cba2[_0x521e25](_0xcc78('0x73'),qs[_0xcc78('0x74')](_0x3934f9['value']),null);}else{var _0x36c7f2='%'+_0x3934f9['value']+'%';_0x46cba2[_0x521e25](_0xcc78('0x75'),_0x36c7f2,_0x36c7f2,_0x36c7f2);}}else{_0x3c9ea5=_['find'](_0x2d49f7,[_0xcc78('0x31'),_0xcc78('0x76')]);_0x3934f9['field']='ContactId';_0x5c1cac=as['buildExpression'](_0x40173e,_0x3c9ea5['type'],_0x3934f9);_0x46cba2[_0x521e25](_0x5c1cac['text'],_0x5c1cac[_0xcc78('0x6e')][_0xcc78('0x77')],_0x5c1cac['value']['end']);}break;case _0xcc78('0x78'):var _0x23bbae=_0x3934f9[_0xcc78('0x6e')]['split'](',')['map'](function(_0x5230a2){return Number(_0x5230a2);});_0x23bbae[_0xcc78('0x37')](function(_0x2cd48e){_0x412c89['or'](_0xcc78('0x79'),'%,'+_0x2cd48e+',%');});_0x3b6b43=_[_0xcc78('0x7a')](_0x3b6b43,_0x23bbae);break;case'User':if(_0x3934f9[_0xcc78('0x72')]==='$substring'){_0x46cba2[_0x521e25]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3934f9[_0xcc78('0x6e')]+'%',null);}else{_0x3c9ea5=_[_0xcc78('0x6c')](_0x2d49f7,[_0xcc78('0x31'),_0xcc78('0x40')]);_0x3934f9[_0xcc78('0x56')]='UserId';_0x5c1cac=as[_0xcc78('0x7b')](_0x40173e,_0x3c9ea5[_0xcc78('0x46')],_0x3934f9);_0x46cba2[_0x521e25](_0x5c1cac[_0xcc78('0x7c')],_0x5c1cac[_0xcc78('0x6e')][_0xcc78('0x77')],_0x5c1cac[_0xcc78('0x6e')][_0xcc78('0x23')]);}break;case _0xcc78('0x7d'):_0x5c1cac=as[_0xcc78('0x7b')]('me',null,_0x3934f9);_0x46cba2[_0x521e25](_0x5c1cac[_0xcc78('0x7c')],_0x5c1cac[_0xcc78('0x6e')][_0xcc78('0x77')],_0x5c1cac['value']['end']);break;}}else{var _0x5c1cac=as['buildExpression'](_0x40173e,_0x3c9ea5[_0xcc78('0x46')],_0x3934f9);_0x46cba2[_0x521e25](_0x5c1cac[_0xcc78('0x7c')],_0x5c1cac[_0xcc78('0x6e')]['start'],_0x5c1cac[_0xcc78('0x6e')][_0xcc78('0x23')]);}}}else{var _0x230034=_(_0x3badb2['query'])[_0xcc78('0x4a')]()[_0xcc78('0x33')](function(_0xfab512){return _[_0xcc78('0x7e')](_0x2d49f7,['name',_0xfab512])?_0xfab512:undefined;})[_0xcc78('0x7f')]()[_0xcc78('0x6e')]();if(!_[_0xcc78('0x80')](_0x230034)){_0x230034['forEach'](function(_0x2ae96f){if(_0x2ae96f===_0xcc78('0x81')){_0x31b10e[_0xcc78('0x53')](_0xcc78('0x82'),[][_0xcc78('0x83')](_0x3badb2[_0xcc78('0x49')][_0x2ae96f]));}else if(_0x2ae96f==='createdAt'){var _0x50ddd2=JSON['parse'](_0x3badb2[_0xcc78('0x49')][_0x2ae96f])[_0xcc78('0x84')];var _0x2679ef=JSON[_0xcc78('0x85')](_0x3badb2[_0xcc78('0x49')][_0x2ae96f])[_0xcc78('0x86')];_0x31b10e[_0xcc78('0x53')](_0xcc78('0x87'),_0x50ddd2,_0x2679ef);}else{if(_0x3badb2[_0xcc78('0x49')][_0x2ae96f]==='null'){_0x31b10e['where']('i.'+_0x2ae96f+_0xcc78('0x88'));}else{_0x31b10e[_0xcc78('0x53')]('i.'+_0x2ae96f+_0xcc78('0x89'),_0x3badb2[_0xcc78('0x49')][_0x2ae96f]);}}});}if(_0x3badb2['query']['read']){if(_0x3badb2[_0xcc78('0x49')]['read']==0x1){_0x31b10e['having'](_0xcc78('0x8a'));}else{_0x31b10e['having']('`unreadMessages`\x20>\x200');}}if(_0x3badb2[_0xcc78('0x49')][_0xcc78('0x8b')]){_0x3b6b43=_[_0xcc78('0x8c')](_0x3badb2[_0xcc78('0x49')][_0xcc78('0x8b')])?_0x3badb2[_0xcc78('0x49')][_0xcc78('0x8b')]:new Array(_0x3badb2['query'][_0xcc78('0x8b')]);_0x3b6b43[_0xcc78('0x37')](function(_0x541ade){_0x412c89['or'](_0xcc78('0x79'),'%,'+_0x541ade+',%');});}if(_0x3badb2[_0xcc78('0x49')][_0xcc78('0x8d')]){var _0x55fcda=_0x3badb2[_0xcc78('0x49')][_0xcc78('0x8d')][_0xcc78('0x8e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xcc78('0x8f')](_0x55fcda)){_0x46cba2['or'](_0xcc78('0x90'),_0x55fcda+'%');}else{_0x46cba2['or'](_0xcc78('0x91'),qs[_0xcc78('0x74')](_0x55fcda))['or'](_0xcc78('0x92'),_0x55fcda+'%')['or'](_0xcc78('0x93'),_0x55fcda+'%');}}}_0x31b10e[_0xcc78('0x53')](_0x46cba2);_0x31b10e[_0xcc78('0x94')]('i.id');var _0x1b288c={'type':db['Sequelize'][_0xcc78('0x95')]['SELECT'],'raw':!![]};var _0xf2ae20=_0x31b10e[_0xcc78('0x96')]();_0xf2ae20['field'](_0xcc78('0x97'));_0xf2ae20[_0xcc78('0x56')](_0xcc78('0x98'),_0xcc78('0x6d'));if(_0x4cbab8[_0xcc78('0x51')]){_0x4cbab8[_0xcc78('0x51')]['forEach'](function(_0x433c6b){var _0x58e108=_0x433c6b[0x0]===_0xcc78('0x99')?_0x433c6b[0x0]:'i.'+_0x433c6b[0x0];_0x31b10e[_0xcc78('0x51')](_0x58e108,_0x433c6b[0x1]===_0xcc78('0x9a')?![]:!![]);});}if(!_[_0xcc78('0x80')](_0x3b6b43)){_0x31b10e['having'](_0x412c89);_0xf2ae20[_0xcc78('0x53')](_0xcc78('0x9b'),_0x3b6b43);}BPromise[_0xcc78('0x9c')]()[_0xcc78('0x2d')](function(){if(!_0x363d28){if(_0x3badb2[_0xcc78('0x49')][_0xcc78('0x81')])return;_0xf2ae20[_0xcc78('0x53')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x31b10e[_0xcc78('0x53')](_0xcc78('0x9d'));return;}if(_0x3badb2[_0xcc78('0x9e')]['role']!==_0xcc78('0x9f'))return;return _0x3badb2[_0xcc78('0x9e')][_0xcc78('0xa0')]({'attributes':['id'],'raw':!![]})[_0xcc78('0x2d')](function(_0x446c6c){if(_[_0xcc78('0x80')](_0x446c6c)){_0xf2ae20[_0xcc78('0x53')](_0xcc78('0xa1'));_0x31b10e[_0xcc78('0x53')](_0xcc78('0xa1'));}else{_0xf2ae20[_0xcc78('0x53')](_0xcc78('0x82'),_['map'](_0x446c6c,'id'));_0x31b10e[_0xcc78('0x53')](_0xcc78('0x82'),_[_0xcc78('0x33')](_0x446c6c,'id'));}});})[_0xcc78('0x2d')](function(){if(_0x3badb2[_0xcc78('0x9e')]['role']==='agent'&&!_0x363d28&&!_0x3badb2['query']['OpenchannelAccountId'])return[];return db[_0xcc78('0xa2')][_0xcc78('0x49')](_0xf2ae20[_0xcc78('0xa3')](),_0x1b288c);})[_0xcc78('0x2d')](function(_0x50268c){_0x5807e3[_0xcc78('0x27')]=_0x50268c[_0xcc78('0x4f')];if(_0x5807e3[_0xcc78('0x27')]===0x0)return[];return db['sequelize'][_0xcc78('0x49')](_0x31396d[_0xcc78('0xa3')](),_0x1b288c)[_0xcc78('0x2d')](function(_0x40bf7c){_0x48c783=_[_0xcc78('0xa4')](_0x40bf7c,'id');_0x1b288c=_[_0xcc78('0xa5')](_0x1b288c,{'model':db[_0xcc78('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3badb2[_0xcc78('0x49')][_0xcc78('0x4d')]){_0x4cbab8['attributes'][_0xcc78('0x37')](function(_0x487b32){_0x31b10e['field']('i.'+_0x487b32);});}else{_0x31b10e[_0xcc78('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xcc78('0x6d'));_0x31b10e[_0xcc78('0x56')]('a.key',_0xcc78('0xa6'));_0x31b10e[_0xcc78('0x56')](_0xcc78('0xa7'),_0xcc78('0xa8'));_0x31b10e[_0xcc78('0x56')]('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','contactName');_0x31b10e[_0xcc78('0x56')]('i.*');_0x31b10e[_0xcc78('0x56')](_0xcc78('0xa9'),'Contact.firstName');_0x31b10e[_0xcc78('0x56')](_0xcc78('0xaa'),'Contact.lastName');_0x31b10e[_0xcc78('0x56')](_0xcc78('0xab'),_0xcc78('0xac'));_0x31b10e['field'](_0xcc78('0xad'),_0xcc78('0xae'));_0x31b10e[_0xcc78('0x56')](_0xcc78('0xaf'),_0xcc78('0xb0'));_0x31b10e['field']('c.fax','Contact.fax');_0x31b10e[_0xcc78('0x56')]('o.fullname',_0xcc78('0xb1'));_0x31b10e[_0xcc78('0x56')](_0xcc78('0xb2'),'Owner.internal');_0x31b10e[_0xcc78('0x56')](_0xcc78('0xb3'),'TagIds');}if(_0x4cbab8[_0xcc78('0x26')])_0x31b10e['limit'](_0x4cbab8[_0xcc78('0x26')]);if(_0x4cbab8[_0xcc78('0x25')])_0x31b10e[_0xcc78('0x25')](_0x4cbab8[_0xcc78('0x25')]);return db[_0xcc78('0xa2')]['query'](_0x31b10e[_0xcc78('0xa3')](),_0x1b288c);})[_0xcc78('0x2d')](function(_0x3d542b){if(_0x3d542b[_0xcc78('0x4f')]>0x0)_0x339999[_0xcc78('0x53')](_0xcc78('0xb4'),_['map'](_0x3d542b,'id'));return db[_0xcc78('0xa2')][_0xcc78('0x49')](_0x339999['toString'](),_0x1b288c)[_0xcc78('0x2d')](function(_0x29efd9){var _0x4c9e8c=_[_0xcc78('0xb5')](_0x29efd9,_0xcc78('0xb6'));var _0x2e483d=[];_0x3d542b['forEach'](function(_0x2e9eb5){_0x2e483d[_0xcc78('0x39')](updateOpenchannelInteraction(_0x2e9eb5,_0x48c783,_0x4c9e8c));});return BPromise[_0xcc78('0xb7')](_0x2e483d);});});})['then'](function(_0x2c32ca){_0x5807e3[_0xcc78('0xb8')]=_0x2c32ca;return _0x5807e3;})[_0xcc78('0x2d')](respondWithFilteredResult(_0x4fb3d3,_0x4cbab8))[_0xcc78('0x3a')](handleError(_0x4fb3d3,null));};exports[_0xcc78('0xb9')]=function(_0x2e106d,_0x38c3fd){var _0x1488ea={};if(_0x2e106d['query'][_0xcc78('0x46')]&&_0x2e106d['query'][_0xcc78('0x46')]===_0xcc78('0x5b')){_0x1488ea[_0xcc78('0x5b')]=_0x2e106d[_0xcc78('0xba')]['id'];}else{_0x1488ea['id']=_0x2e106d[_0xcc78('0xba')]['id'];}var _0x4f12d3={'raw':![],'where':_0x1488ea},_0x31e3fd={};_0x31e3fd[_0xcc78('0x48')]=_[_0xcc78('0x4a')](db['OpenchannelInteraction'][_0xcc78('0x44')]);_0x31e3fd['query']=_[_0xcc78('0x4a')](_0x2e106d[_0xcc78('0x49')]);_0x31e3fd[_0xcc78('0x4b')]=_[_0xcc78('0x4c')](_0x31e3fd[_0xcc78('0x48')],_0x31e3fd[_0xcc78('0x49')]);_0x4f12d3[_0xcc78('0x4e')]=_[_0xcc78('0x4c')](_0x31e3fd[_0xcc78('0x48')],qs[_0xcc78('0x4d')](_0x2e106d['query'][_0xcc78('0x4d')]));_0x4f12d3[_0xcc78('0x4e')]=_0x4f12d3['attributes'][_0xcc78('0x4f')]?_0x4f12d3[_0xcc78('0x4e')]:_0x31e3fd[_0xcc78('0x48')];if(_0x2e106d[_0xcc78('0x49')][_0xcc78('0xbb')]){_0x4f12d3[_0xcc78('0xbc')]=[{'all':!![]}];}_0x4f12d3=_[_0xcc78('0xa5')]({},_0x4f12d3,_0x2e106d[_0xcc78('0xbd')]);return db['OpenchannelInteraction'][_0xcc78('0x6c')](_0x4f12d3)['then'](handleEntityNotFound(_0x38c3fd,null))[_0xcc78('0x2d')](respondWithResult(_0x38c3fd,null))[_0xcc78('0x3a')](handleError(_0x38c3fd,null));};exports['create']=function(_0x5df362,_0x31db0e){return db[_0xcc78('0x43')][_0xcc78('0xbe')](_0x5df362[_0xcc78('0x7d')],{})[_0xcc78('0x2d')](respondWithResult(_0x31db0e,0xc9))[_0xcc78('0x3a')](handleError(_0x31db0e,null));};exports['update']=function(_0x41ccfc,_0x41654a){if(_0x41ccfc[_0xcc78('0x7d')]['id']){delete _0x41ccfc[_0xcc78('0x7d')]['id'];}return db['OpenchannelInteraction'][_0xcc78('0x6c')]({'where':{'id':_0x41ccfc['params']['id']}})[_0xcc78('0x2d')](handleEntityNotFound(_0x41654a,null))['then'](saveUpdates(_0x41ccfc[_0xcc78('0x7d')],null))['then'](respondWithResult(_0x41654a,null))[_0xcc78('0x3a')](handleError(_0x41654a,null));};exports[_0xcc78('0x2e')]=function(_0x2754e9,_0x53abe7){return db['OpenchannelInteraction'][_0xcc78('0x6c')]({'where':{'id':_0x2754e9[_0xcc78('0xba')]['id']}})[_0xcc78('0x2d')](handleEntityNotFound(_0x53abe7,null))[_0xcc78('0x2d')](removeEntity(_0x53abe7,null))[_0xcc78('0x3a')](handleError(_0x53abe7,null));};exports[_0xcc78('0xbf')]=function(_0x4fae9f,_0x591e0e){return db[_0xcc78('0x43')][_0xcc78('0xbf')]()['then'](respondWithResult(_0x591e0e,null))['catch'](handleError(_0x591e0e,null));};exports[_0xcc78('0xc0')]=function(_0x3d9b47,_0x3134ec,_0x145008){return db[_0xcc78('0xc1')][_0xcc78('0x6c')]({'where':{'id':_0x3d9b47[_0xcc78('0xba')]['id']}})['then'](handleEntityNotFound(_0x3134ec,null))[_0xcc78('0x2d')](function(_0x4690e6){if(_0x4690e6){return _0x4690e6['addMessage'](_0x3d9b47[_0xcc78('0x7d')]['ids'],_[_0xcc78('0xc2')](_0x3d9b47['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3134ec,null))[_0xcc78('0x3a')](handleError(_0x3134ec,null));};exports[_0xcc78('0xc3')]=function(_0x163dc0,_0x2d8b5d,_0x4294f3){var _0x36ad43={'raw':![],'where':{}};var _0x4defbd={};var _0x3e562f={'count':0x0,'rows':[]};return db[_0xcc78('0x43')][_0xcc78('0xc4')]({'where':{'id':_0x163dc0[_0xcc78('0xba')]['id']}})['then'](handleEntityNotFound(_0x2d8b5d,null))['then'](function(_0x19a49e){if(_0x19a49e){_0x4defbd[_0xcc78('0x48')]=_['keys'](db[_0xcc78('0xc1')][_0xcc78('0x44')]);_0x4defbd[_0xcc78('0x49')]=_['keys'](_0x163dc0[_0xcc78('0x49')]);_0x4defbd['filters']=_[_0xcc78('0x4c')](_0x4defbd['model'],_0x4defbd[_0xcc78('0x49')]);_0x36ad43['attributes']=_['intersection'](_0x4defbd[_0xcc78('0x48')],qs[_0xcc78('0x4d')](_0x163dc0[_0xcc78('0x49')]['fields']));_0x36ad43['attributes']=_0x36ad43[_0xcc78('0x4e')][_0xcc78('0x4f')]?_0x36ad43[_0xcc78('0x4e')]:_0x4defbd[_0xcc78('0x48')];if(!_0x163dc0[_0xcc78('0x49')][_0xcc78('0x50')](_0xcc78('0xc5'))){_0x36ad43[_0xcc78('0x26')]=qs[_0xcc78('0x26')](_0x163dc0[_0xcc78('0x49')][_0xcc78('0x26')]);_0x36ad43[_0xcc78('0x25')]=qs[_0xcc78('0x25')](_0x163dc0['query'][_0xcc78('0x25')]);}_0x36ad43[_0xcc78('0x51')]=qs[_0xcc78('0x52')](_0x163dc0['query'][_0xcc78('0x52')]);_0x36ad43[_0xcc78('0x53')]=qs['filters'](_[_0xcc78('0x54')](_0x163dc0[_0xcc78('0x49')],_0x4defbd[_0xcc78('0x4b')]));_0x36ad43['where'][_0xcc78('0xb6')]=_0x19a49e['id'];if(_0x163dc0['query']['filter']){_0x36ad43[_0xcc78('0x53')]=_['merge'](_0x36ad43[_0xcc78('0x53')],{'$or':_[_0xcc78('0x33')](_0x36ad43[_0xcc78('0x4e')],function(_0x3d950f){var _0x51a267={};_0x51a267[_0x3d950f]={'$like':'%'+_0x163dc0[_0xcc78('0x49')][_0xcc78('0x8d')]+'%'};return _0x51a267;})});}if(_0x163dc0[_0xcc78('0x49')][_0xcc78('0x84')]){var _0x34b70a=_0x163dc0[_0xcc78('0x49')]['$gte'][_0xcc78('0x36')](',');var _0x2a6fcb={};_0x2a6fcb[_0x34b70a[0x0]]={'$gte':moment(_0x34b70a[0x1])[_0xcc78('0xc6')](_0xcc78('0xc7'))};_0x36ad43[_0xcc78('0x53')]=_[_0xcc78('0xa5')](_0x36ad43[_0xcc78('0x53')],_0x2a6fcb);}_0x36ad43=_[_0xcc78('0xa5')]({},_0x36ad43,_0x163dc0[_0xcc78('0xbd')]);return db[_0xcc78('0xc1')][_0xcc78('0x27')]({'where':_0x36ad43['where']})[_0xcc78('0x2d')](function(_0x3d5c30){_0x3e562f[_0xcc78('0x27')]=_0x3d5c30;if(_0x163dc0[_0xcc78('0x49')][_0xcc78('0xbb')]){_0x36ad43['include']=[{'all':!![]}];}return db[_0xcc78('0xc1')]['findAll'](_0x36ad43);})[_0xcc78('0x2d')](function(_0x17b20f){_0x3e562f[_0xcc78('0xb8')]=_0x17b20f;return _0x3e562f;});}})[_0xcc78('0x2d')](respondWithFilteredResult(_0x2d8b5d,_0x36ad43))[_0xcc78('0x3a')](handleError(_0x2d8b5d,null));};exports[_0xcc78('0xc8')]=function(_0x540ce6,_0x1f0603,_0x411e83){return db[_0xcc78('0x43')]['find']({'where':{'id':_0x540ce6[_0xcc78('0xba')]['id']}})[_0xcc78('0x2d')](handleEntityNotFound(_0x1f0603,null))[_0xcc78('0x2d')](function(_0x1f7a6c){if(_0x1f7a6c){return _0x1f7a6c[_0xcc78('0xc9')](_0x540ce6[_0xcc78('0x7d')][_0xcc78('0xca')],_[_0xcc78('0xc2')](_0x540ce6[_0xcc78('0x7d')],[_0xcc78('0xca'),'id'])||{})[_0xcc78('0xcb')](function(){return db[_0xcc78('0x78')][_0xcc78('0xcc')]({'attributes':['id',_0xcc78('0x31'),'color'],'where':{'id':_0x540ce6[_0xcc78('0x7d')][_0xcc78('0xca')]}});})[_0xcc78('0x2d')](function(_0x483b96){socket[_0xcc78('0xcd')](_0xcc78('0xce'),{'id':Number(_0x540ce6[_0xcc78('0xba')]['id']),'tags':_0x483b96||[]});return{'id':Number(_0x540ce6['params']['id']),'tags':_0x483b96||[]};});}})[_0xcc78('0x2d')](respondWithResult(_0x1f0603,null))[_0xcc78('0x3a')](handleError(_0x1f0603,null));};exports[_0xcc78('0xcf')]=function(_0x4d9d7f,_0x45286a,_0x32d500){return db[_0xcc78('0x43')][_0xcc78('0x6c')]({'where':{'id':_0x4d9d7f['params']['id']}})[_0xcc78('0x2d')](handleEntityNotFound(_0x45286a,null))[_0xcc78('0x2d')](function(_0x2004b0){if(_0x2004b0){return _0x2004b0[_0xcc78('0xcf')](_0x4d9d7f['query'][_0xcc78('0xca')]);}})[_0xcc78('0x2d')](respondWithStatusCode(_0x45286a,null))[_0xcc78('0x3a')](handleError(_0x45286a,null));};exports[_0xcc78('0xd0')]=function(_0x32be7a,_0x7c7f0c){var _0x4e6ad6=moment()[_0xcc78('0xd1')]()[_0xcc78('0xa3')]();var _0x5c0121=path['join'](config['root'],_0xcc78('0xd2'),'files','tmp');var _0x50f479=path[_0xcc78('0xd3')](config[_0xcc78('0xd4')],_0xcc78('0xd2'),_0xcc78('0xd5'),_0xcc78('0xd6'));var _0x38b6b2=path[_0xcc78('0xd3')](_0x5c0121,_0x4e6ad6);var _0x38e31c=util[_0xcc78('0xc6')](_0xcc78('0xd7'),_0x32be7a['params']['id'],_0x4e6ad6);var _0x53d0cc=path[_0xcc78('0xd3')](_0x5c0121,_0x38e31c);var _0x251d2b=[];_0x251d2b[_0xcc78('0x39')]({'model':db[_0xcc78('0xd8')],'as':'User','attributes':['id',_0xcc78('0x34')],'raw':!![]});_0x251d2b[_0xcc78('0x39')]({'model':db[_0xcc78('0xd9')],'as':'Contact','attributes':['id','firstName',_0xcc78('0xda')],'raw':!![]});if(_0x32be7a[_0xcc78('0x49')][_0xcc78('0xd6')]){_0x251d2b[_0xcc78('0x39')]({'model':db['Attachment'],'as':_0xcc78('0xdb'),'raw':!![]});}var _0x3924c7=[{'model':db['OpenchannelMessage'],'as':_0xcc78('0xdc'),'attributes':['id',_0xcc78('0x7d'),_0xcc78('0xdd'),_0xcc78('0xde'),_0xcc78('0xdf'),'read'],'include':_0x251d2b}];_0x3924c7[_0xcc78('0x39')]({'model':db[_0xcc78('0xe0')],'as':_0xcc78('0xe1'),'attributes':['id',_0xcc78('0x31')]});_0x3924c7['push']({'model':db[_0xcc78('0xd8')],'as':_0xcc78('0xe2'),'attributes':['id',_0xcc78('0x34')]});return db['OpenchannelInteraction'][_0xcc78('0x6c')]({'where':{'id':_0x32be7a[_0xcc78('0xba')]['id']},'include':_0x3924c7})['then'](handleEntityNotFound(_0x7c7f0c,null))[_0xcc78('0x2d')](function(_0x39ebeb){if(_0x39ebeb){var _0x3556ac=_0x39ebeb[_0xcc78('0xe3')]({'plain':!![]});fs[_0xcc78('0xe4')](_0x38b6b2);var _0x33866b={'channel':_0xcc78('0xe5'),'account':_0x3556ac[_0xcc78('0xe1')]['name'],'agent':_0x3556ac['Owner']?_0x3556ac[_0xcc78('0xe2')]['fullname']:_0xcc78('0xe6'),'createdAt':moment(_0x3556ac[_0xcc78('0xdd')])[_0xcc78('0xc6')](_0xcc78('0xc7'))['toString'](),'closedAt':_0x3556ac['closed']?moment(_0x3556ac['closedAt'])[_0xcc78('0xc6')](_0xcc78('0xc7'))[_0xcc78('0xa3')]():'','disposition':_0x3556ac['disposition'],'visibility':_0x3556ac[_0xcc78('0xe7')]?_0xcc78('0xe8'):_0xcc78('0xe9'),'messages':_(_0x3556ac['Messages'])[_0xcc78('0x8d')]({'secret':![]})['map'](function(_0x2fd641){if(_0x2fd641[_0xcc78('0xdb')]){var _0x315654=path[_0xcc78('0xd3')](_0x50f479,_0x2fd641[_0xcc78('0xdb')]['basename']);if(fs[_0xcc78('0xea')](_0x315654)){fs['createReadStream'](_0x315654)[_0xcc78('0xeb')](fs[_0xcc78('0xec')](path[_0xcc78('0xd3')](_0x38b6b2,_0x2fd641[_0xcc78('0xdb')][_0xcc78('0xed')])));}}return{'date':moment(_0x2fd641[_0xcc78('0xdd')])[_0xcc78('0xc6')](_0xcc78('0xc7'))[_0xcc78('0xa3')](),'sender':_0x2fd641[_0xcc78('0xde')]===_0xcc78('0xee')?_0x2fd641[_0xcc78('0xd8')]?_0x2fd641['User'][_0xcc78('0x34')]:_0xcc78('0xef'):_0x2fd641[_0xcc78('0x71')][_0xcc78('0xf0')]+(_0x2fd641[_0xcc78('0x71')][_0xcc78('0xda')]?'\x20'+_0x2fd641['Contact'][_0xcc78('0xda')]:''),'body':_0x2fd641[_0xcc78('0xdb')]?_0x2fd641[_0xcc78('0xdb')][_0xcc78('0xed')]:_0x2fd641[_0xcc78('0x7d')],'direction':_0x2fd641[_0xcc78('0xde')]===_0xcc78('0xee')?'A':'C','secret':_0x2fd641['secret'],'read':_0x2fd641[_0xcc78('0xf1')],'attachment':_0x2fd641['Attachment']};})[_0xcc78('0x6e')]()};return ejs[_0xcc78('0xf2')](path[_0xcc78('0xd3')](config[_0xcc78('0xd4')],_0xcc78('0xd2'),_0xcc78('0xf3'),_0xcc78('0xf4')),{'interaction':_0x33866b})[_0xcc78('0x2d')](function(_0x4083e2){var _0xa9eb6b=path[_0xcc78('0xd3')](_0x38b6b2,_0xcc78('0xf5')+_0x3556ac['id']+'-'+_0x4e6ad6+_0xcc78('0xf6'));var _0x342b99={'path':_0xa9eb6b,'channel':_0xcc78('0xe5'),'interactionId':_0x3556ac['id']};return pdf[_0xcc78('0xf7')](_0x4083e2,_0x342b99);})[_0xcc78('0x2d')](function(){return new BPromise(function(_0x595cc3,_0x168f4c){zipdir(_0x38b6b2,{'saveTo':_0x53d0cc},function(_0x328686,_0x172e32){if(_0x328686)return _0x168f4c(_0x328686);return _0x595cc3(_0x172e32);});})[_0xcc78('0x2d')](function(){return new BPromise(function(_0x301ecb,_0x135529){rimraf(_0x38b6b2,function(_0x1071e3){if(_0x1071e3)_0x135529(_0x1071e3);return _0x301ecb();});});})[_0xcc78('0x2d')](function(){return _0x7c7f0c[_0xcc78('0xd0')](_0x53d0cc,_0x38e31c,function(_0x2e88fa){if(_0x2e88fa){console[_0xcc78('0xf8')](_0xcc78('0xf9'),_0x2e88fa);}else{fs[_0xcc78('0xfa')](_0x53d0cc);}});});});}else{return _0x7c7f0c[_0xcc78('0x21')](0xc8);}})[_0xcc78('0x3a')](handleError(_0x7c7f0c,null));}; \ No newline at end of file +var _0xcf30=['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','DESC','isEmpty','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','attributes','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','create','describe','addMessage','omit','ids','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','include','findAll','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','root','tmp','join','server','files','attachments','transcript-%d-%s.zip','User','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','mkdirSync','Openchannel','Owner','N.A.','closedAt','disposition','threadId','Public','Private','basename','createReadStream','pipe','createWriteStream','System','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','sendStatus','error','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','talking','answered','total','closed','waiting','UserId','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','tools_tags','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','length','unreadMessages','having','Contact','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?','find','ContactId','buildExpression','text','start','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0x4e93a9,_0x413f30){var _0x43013c=function(_0x3a0cf3){while(--_0x3a0cf3){_0x4e93a9['push'](_0x4e93a9['shift']());}};_0x43013c(++_0x413f30);}(_0xcf30,0x6a));var _0x0cf3=function(_0x411e80,_0x292122){_0x411e80=_0x411e80-0x0;var _0x23ad50=_0xcf30[_0x411e80];return _0x23ad50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0cf3('0x0'));var jsonpatch=require(_0x0cf3('0x1'));var rp=require(_0x0cf3('0x2'));var moment=require(_0x0cf3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0cf3('0x4'));var util=require(_0x0cf3('0x5'));var path=require(_0x0cf3('0x6'));var sox=require(_0x0cf3('0x7'));var csv=require(_0x0cf3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cf3('0x9'));var _=require('lodash');var squel=require(_0x0cf3('0xa'));var crypto=require('crypto');var jsforce=require(_0x0cf3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0cf3('0x8'));var querystring=require(_0x0cf3('0xc'));var Papa=require(_0x0cf3('0xd'));var Redis=require(_0x0cf3('0xe'));var authService=require(_0x0cf3('0xf'));var qs=require(_0x0cf3('0x10'));var as=require(_0x0cf3('0x11'));var pdf=require(_0x0cf3('0x12'));var hardwareService=require(_0x0cf3('0x13'));var logger=require(_0x0cf3('0x14'))(_0x0cf3('0x15'));var utils=require('../../config/utils');var config=require(_0x0cf3('0x16'));var licenseUtil=require(_0x0cf3('0x17'));var db=require(_0x0cf3('0x18'))['db'];config[_0x0cf3('0x19')]=_[_0x0cf3('0x1a')](config['redis'],{'host':_0x0cf3('0x1b'),'port':0x18eb});var socket=require(_0x0cf3('0x1c'))(new Redis(config[_0x0cf3('0x19')]));require(_0x0cf3('0x1d'))[_0x0cf3('0x1e')](socket);function respondWithStatusCode(_0x1f3d92,_0x33f3d9){_0x33f3d9=_0x33f3d9||0xcc;return function(_0x97c061){if(_0x97c061){return _0x1f3d92['sendStatus'](_0x33f3d9);}return _0x1f3d92[_0x0cf3('0x1f')](_0x33f3d9)[_0x0cf3('0x20')]();};}function respondWithResult(_0x18fca7,_0x5cf4e6){_0x5cf4e6=_0x5cf4e6||0xc8;return function(_0x272b56){if(_0x272b56){return _0x18fca7[_0x0cf3('0x1f')](_0x5cf4e6)[_0x0cf3('0x21')](_0x272b56);}};}function respondWithFilteredResult(_0xc3cea5,_0x409571){return function(_0x464774){if(_0x464774){var _0x31ce71=typeof _0x409571[_0x0cf3('0x22')]===_0x0cf3('0x23')&&typeof _0x409571[_0x0cf3('0x24')]==='undefined';var _0x147f7d=_0x464774[_0x0cf3('0x25')];var _0x4bc532=_0x31ce71?0x0:_0x409571[_0x0cf3('0x22')];var _0x516d06=_0x31ce71?_0x464774[_0x0cf3('0x25')]:_0x409571[_0x0cf3('0x22')]+_0x409571[_0x0cf3('0x24')];var _0x5aff96;if(_0x516d06>=_0x147f7d){_0x516d06=_0x147f7d;_0x5aff96=0xc8;}else{_0x5aff96=0xce;}_0xc3cea5[_0x0cf3('0x1f')](_0x5aff96);return _0xc3cea5[_0x0cf3('0x26')]('Content-Range',_0x4bc532+'-'+_0x516d06+'/'+_0x147f7d)['json'](_0x464774);}return null;};}function patchUpdates(_0x431449){return function(_0xa3aa60){try{jsonpatch['apply'](_0xa3aa60,_0x431449,!![]);}catch(_0x4d7411){return BPromise[_0x0cf3('0x27')](_0x4d7411);}return _0xa3aa60[_0x0cf3('0x28')]();};}function saveUpdates(_0x588ead,_0x113c3c){return function(_0x1459f6){if(_0x1459f6){return _0x1459f6['update'](_0x588ead)[_0x0cf3('0x29')](function(_0x2044bd){return _0x2044bd;});}return null;};}function removeEntity(_0x23adb1,_0x116305){return function(_0x3de6e4){if(_0x3de6e4){return _0x3de6e4[_0x0cf3('0x2a')]()[_0x0cf3('0x29')](function(){_0x23adb1[_0x0cf3('0x1f')](0xcc)[_0x0cf3('0x20')]();});}};}function handleEntityNotFound(_0x4d98b7,_0x45f010){return function(_0x7f608){if(!_0x7f608){_0x4d98b7[_0x0cf3('0x2b')](0x194);}return _0x7f608;};}function handleError(_0x4ff9b2,_0x1a0794){_0x1a0794=_0x1a0794||0x1f4;return function(_0x4d6701){logger[_0x0cf3('0x2c')](_0x4d6701[_0x0cf3('0x2d')]);if(_0x4d6701['name']){delete _0x4d6701[_0x0cf3('0x2e')];}_0x4ff9b2[_0x0cf3('0x1f')](_0x1a0794)[_0x0cf3('0x2f')](_0x4d6701);};}function getInteractionUsers(_0x5ac592,_0x4a6cd7){return new BPromise(function(_0x385070,_0x26270e){try{if(_0x4a6cd7[_0x5ac592['id']]){_0x5ac592[_0x0cf3('0x30')]=_[_0x0cf3('0x31')](_0x4a6cd7[_0x5ac592['id']],function(_0xbca045){return{'id':_0xbca045['id'],'fullname':_0xbca045[_0x0cf3('0x32')]};});}}catch(_0x424a7b){_0x26270e(_0x424a7b);}_0x385070(_0x5ac592);});}function getInteractionTags(_0x4d49e5,_0x2ea327){return new BPromise(function(_0x52061c,_0x4b17d1){try{if(_0x4d49e5['TagIds']){_0x4d49e5[_0x0cf3('0x33')]=[];_0x4d49e5[_0x0cf3('0x34')][_0x0cf3('0x35')](',')[_0x0cf3('0x36')](function(_0x32ef7f){_0x4d49e5[_0x0cf3('0x33')][_0x0cf3('0x37')](_0x2ea327[_0x32ef7f]);});}delete _0x4d49e5[_0x0cf3('0x34')];}catch(_0x1beb9c){_0x4b17d1(_0x1beb9c);}_0x52061c(_0x4d49e5);});}function updateOpenchannelInteraction(_0x34196f,_0x11aa1c,_0x388bdf){return new BPromise(function(_0x584063,_0x2e71e1){return getInteractionUsers(_0x34196f,_0x388bdf)[_0x0cf3('0x29')](function(_0x111bf6){return getInteractionTags(_0x111bf6,_0x11aa1c);})[_0x0cf3('0x29')](function(_0x42441e){return getStateInteraction(_0x42441e);})[_0x0cf3('0x29')](function(_0x54adde){_0x584063(_0x54adde);})[_0x0cf3('0x38')](function(_0x25e08a){_0x2e71e1(_0x25e08a);});});}function getStateInteraction(_0x487f10){return new BPromise(function(_0x1cdc5d){_0x487f10['waiting']=0x0;_0x487f10[_0x0cf3('0x39')]=0x0;_0x487f10[_0x0cf3('0x3a')]=0x0;_0x487f10['unmanaged']=0x0;_0x487f10[_0x0cf3('0x3b')]=0x0;if(!_0x487f10[_0x0cf3('0x3c')]&&!_0x487f10['UserId']){_0x487f10[_0x0cf3('0x3d')]+=0x1;}if(!_0x487f10[_0x0cf3('0x3c')]&&_0x487f10['UserId']){_0x487f10[_0x0cf3('0x39')]+=0x1;if(_0x487f10[_0x0cf3('0x3d')]){_0x487f10[_0x0cf3('0x3d')]-=0x1;}}if(_0x487f10[_0x0cf3('0x3c')]&&_0x487f10['UserId']){_0x487f10[_0x0cf3('0x3a')]+=0x1;if(_0x487f10['talking']){_0x487f10['talking']-=0x1;}}if(_0x487f10[_0x0cf3('0x3c')]&&!_0x487f10[_0x0cf3('0x3e')]){_0x487f10['unmanaged']+=0x1;if(_0x487f10['waiting']){_0x487f10[_0x0cf3('0x3d')]-=0x1;}}_0x487f10[_0x0cf3('0x3b')]+=0x1;_0x1cdc5d(_0x487f10);});}exports[_0x0cf3('0x3f')]=function(_0x2ae71e,_0x422b76){var _0x41465a={},_0x263c30={},_0x211101={'count':0x0,'rows':[]};var _0x296a70=_['map'](db[_0x0cf3('0x40')][_0x0cf3('0x41')],function(_0x1b9e43){return{'name':_0x1b9e43[_0x0cf3('0x42')],'type':_0x1b9e43[_0x0cf3('0x43')]['key']};});_0x263c30[_0x0cf3('0x44')]=_[_0x0cf3('0x31')](_0x296a70,_0x0cf3('0x2e'));_0x263c30[_0x0cf3('0x45')]=_[_0x0cf3('0x46')](_0x2ae71e['query']);_0x263c30[_0x0cf3('0x47')]=_[_0x0cf3('0x48')](_0x263c30[_0x0cf3('0x44')],_0x263c30['query']);_0x41465a['attributes']=_[_0x0cf3('0x48')](_0x263c30[_0x0cf3('0x44')],qs['fields'](_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x49')]));_0x41465a['attributes']=_0x41465a['attributes']['length']?_0x41465a['attributes']:_0x263c30[_0x0cf3('0x44')];if(!_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x4a')](_0x0cf3('0x4b'))){_0x41465a[_0x0cf3('0x24')]=qs[_0x0cf3('0x24')](_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x24')]);_0x41465a[_0x0cf3('0x22')]=qs[_0x0cf3('0x22')](_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x22')]);}_0x41465a[_0x0cf3('0x4c')]=qs[_0x0cf3('0x4d')](_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x4d')]);_0x41465a[_0x0cf3('0x4e')]=qs[_0x0cf3('0x47')](_[_0x0cf3('0x4f')](_0x2ae71e['query'],_0x263c30['filters']),_0x296a70);var _0x1f7cea=[];var _0x1f189e=squel['select']()[_0x0cf3('0x50')]('id')[_0x0cf3('0x50')](_0x0cf3('0x2e'))[_0x0cf3('0x50')](_0x0cf3('0x51'))[_0x0cf3('0x52')](_0x0cf3('0x53'));var _0x3b14b7=squel['select']()[_0x0cf3('0x50')]('u.id')[_0x0cf3('0x50')](_0x0cf3('0x54'))[_0x0cf3('0x50')]('ui.OpenchannelInteractionId')[_0x0cf3('0x52')]('user_has_openchannel_interactions','ui')[_0x0cf3('0x55')](_0x0cf3('0x56'),'u',_0x0cf3('0x57'));var _0x35108b=squel['select']()['from'](_0x0cf3('0x58'),'i')[_0x0cf3('0x55')](_0x0cf3('0x59'),'c',_0x0cf3('0x5a'))[_0x0cf3('0x55')](_0x0cf3('0x56'),'o','o.id\x20=\x20i.UserId')[_0x0cf3('0x55')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x0cf3('0x55')]('openchannel_messages','me',_0x0cf3('0x5b'))['left_join'](_0x0cf3('0x5c'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x0cf3('0x55')](_0x0cf3('0x53'),'t',_0x0cf3('0x5d'));var _0x574e4f=squel[_0x0cf3('0x5e')]();var _0xbce8b=[];var _0x50c315=squel[_0x0cf3('0x5e')]();var _0x121664;if(_0x2ae71e['query']['search']){_0x121664=as['parseSearch'](_0x2ae71e[_0x0cf3('0x45')]['search']);var _0x34660e=_0x121664[_0x0cf3('0x5f')];for(var _0x2aa3c2=0x0;_0x2aa3c2<_0x121664[_0x0cf3('0x60')][_0x0cf3('0x61')];_0x2aa3c2++){var _0x3b249b=_0x121664[_0x0cf3('0x60')][_0x2aa3c2];var _0x339fda='i';var _0x44dce9=_['find'](_0x296a70,['name',_0x3b249b[_0x0cf3('0x50')]]);if(!_0x44dce9){switch(_0x3b249b[_0x0cf3('0x50')]){case _0x0cf3('0x62'):if(_0x3b249b['value']==0x1){_0x35108b[_0x0cf3('0x63')]('`'+_0x3b249b[_0x0cf3('0x50')]+'`\x20=\x200');}else{_0x35108b[_0x0cf3('0x63')]('`'+_0x3b249b[_0x0cf3('0x50')]+'`\x20>\x200');}break;case _0x0cf3('0x64'):if(_0x3b249b[_0x0cf3('0x65')]===_0x0cf3('0x66')){if(_0x3b249b['value'][_0x0cf3('0x35')]('\x20')[_0x0cf3('0x61')]>0x1){_0x574e4f[_0x34660e](_0x0cf3('0x67'),qs[_0x0cf3('0x68')](_0x3b249b[_0x0cf3('0x69')]),null);}else{var _0x52e69f='%'+_0x3b249b['value']+'%';_0x574e4f[_0x34660e](_0x0cf3('0x6a'),_0x52e69f,_0x52e69f,_0x52e69f);}}else{_0x44dce9=_[_0x0cf3('0x6b')](_0x296a70,[_0x0cf3('0x2e'),_0x0cf3('0x6c')]);_0x3b249b[_0x0cf3('0x50')]=_0x0cf3('0x6c');_0x4748cb=as[_0x0cf3('0x6d')](_0x339fda,_0x44dce9[_0x0cf3('0x43')],_0x3b249b);_0x574e4f[_0x34660e](_0x4748cb[_0x0cf3('0x6e')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x6f')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x20')]);}break;case'Tag':var _0x2ffd93=_0x3b249b['value'][_0x0cf3('0x35')](',')[_0x0cf3('0x31')](function(_0x5e8813){return Number(_0x5e8813);});_0x2ffd93[_0x0cf3('0x36')](function(_0x340b2c){_0x50c315['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x340b2c+',%');});_0xbce8b=_[_0x0cf3('0x70')](_0xbce8b,_0x2ffd93);break;case'User':if(_0x3b249b[_0x0cf3('0x65')]===_0x0cf3('0x66')){_0x574e4f[_0x34660e](_0x0cf3('0x71'),'%'+_0x3b249b['value']+'%',null);}else{_0x44dce9=_[_0x0cf3('0x6b')](_0x296a70,[_0x0cf3('0x2e'),_0x0cf3('0x3e')]);_0x3b249b['field']=_0x0cf3('0x3e');_0x4748cb=as['buildExpression'](_0x339fda,_0x44dce9['type'],_0x3b249b);_0x574e4f[_0x34660e](_0x4748cb[_0x0cf3('0x6e')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x6f')],_0x4748cb['value'][_0x0cf3('0x20')]);}break;case _0x0cf3('0x72'):_0x4748cb=as['buildExpression']('me',null,_0x3b249b);_0x574e4f[_0x34660e](_0x4748cb[_0x0cf3('0x6e')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x6f')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x20')]);break;}}else{var _0x4748cb=as[_0x0cf3('0x6d')](_0x339fda,_0x44dce9[_0x0cf3('0x43')],_0x3b249b);_0x574e4f[_0x34660e](_0x4748cb[_0x0cf3('0x6e')],_0x4748cb['value'][_0x0cf3('0x6f')],_0x4748cb[_0x0cf3('0x69')][_0x0cf3('0x20')]);}}}else{var _0x212652=_(_0x2ae71e[_0x0cf3('0x45')])[_0x0cf3('0x46')]()[_0x0cf3('0x31')](function(_0x2fdc45){return _['some'](_0x296a70,[_0x0cf3('0x2e'),_0x2fdc45])?_0x2fdc45:undefined;})[_0x0cf3('0x73')]()[_0x0cf3('0x69')]();if(!_['isEmpty'](_0x212652)){_0x212652['forEach'](function(_0x15b784){if(_0x15b784===_0x0cf3('0x74')){_0x35108b[_0x0cf3('0x4e')](_0x0cf3('0x75'),[][_0x0cf3('0x76')](_0x2ae71e[_0x0cf3('0x45')][_0x15b784]));}else if(_0x15b784===_0x0cf3('0x77')){var _0x358b76=JSON[_0x0cf3('0x78')](_0x2ae71e[_0x0cf3('0x45')][_0x15b784])[_0x0cf3('0x79')];var _0x46c5b3=JSON[_0x0cf3('0x78')](_0x2ae71e[_0x0cf3('0x45')][_0x15b784])[_0x0cf3('0x7a')];_0x35108b[_0x0cf3('0x4e')](_0x0cf3('0x7b'),_0x358b76,_0x46c5b3);}else{if(_0x2ae71e['query'][_0x15b784]==='null'){_0x35108b[_0x0cf3('0x4e')]('i.'+_0x15b784+_0x0cf3('0x7c'));}else{_0x35108b[_0x0cf3('0x4e')]('i.'+_0x15b784+'\x20=\x20?',_0x2ae71e[_0x0cf3('0x45')][_0x15b784]);}}});}if(_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x7d')]){if(_0x2ae71e[_0x0cf3('0x45')]['read']==0x1){_0x35108b[_0x0cf3('0x63')](_0x0cf3('0x7e'));}else{_0x35108b[_0x0cf3('0x63')](_0x0cf3('0x7f'));}}if(_0x2ae71e['query'][_0x0cf3('0x80')]){_0xbce8b=_[_0x0cf3('0x81')](_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x80')])?_0x2ae71e['query']['tag']:new Array(_0x2ae71e['query'][_0x0cf3('0x80')]);_0xbce8b[_0x0cf3('0x36')](function(_0x94669a){_0x50c315['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x94669a+',%');});}if(_0x2ae71e[_0x0cf3('0x45')]['filter']){var _0x214327=_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x82')][_0x0cf3('0x83')]('\x5c','\x5c\x5c')[_0x0cf3('0x83')](/'/g,'\x27\x27');if(qs[_0x0cf3('0x84')](_0x214327)){_0x574e4f['or'](_0x0cf3('0x85'),_0x214327+'%');}else{_0x574e4f['or'](_0x0cf3('0x86'),qs[_0x0cf3('0x68')](_0x214327))['or']('i.from\x20LIKE\x20?',_0x214327+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x214327+'%');}}}_0x35108b[_0x0cf3('0x4e')](_0x574e4f);_0x35108b[_0x0cf3('0x87')](_0x0cf3('0x88'));var _0x1131ee={'type':db[_0x0cf3('0x89')][_0x0cf3('0x8a')][_0x0cf3('0x8b')],'raw':!![]};var _0x3f366b=_0x35108b['clone']();_0x3f366b[_0x0cf3('0x50')](_0x0cf3('0x88'));_0x3f366b[_0x0cf3('0x50')](_0x0cf3('0x8c'),_0x0cf3('0x62'));if(_0x41465a[_0x0cf3('0x4c')]){_0x41465a[_0x0cf3('0x4c')]['forEach'](function(_0x5101fe){var _0x111b0f=_0x5101fe[0x0]===_0x0cf3('0x8d')?_0x5101fe[0x0]:'i.'+_0x5101fe[0x0];_0x35108b['order'](_0x111b0f,_0x5101fe[0x1]===_0x0cf3('0x8e')?![]:!![]);});}if(!_[_0x0cf3('0x8f')](_0xbce8b)){_0x35108b[_0x0cf3('0x63')](_0x50c315);_0x3f366b[_0x0cf3('0x4e')]('t.id\x20IN\x20?',_0xbce8b);}BPromise[_0x0cf3('0x90')]()[_0x0cf3('0x29')](function(){if(!_0x121664){if(_0x2ae71e['query'][_0x0cf3('0x74')])return;_0x3f366b[_0x0cf3('0x4e')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x35108b[_0x0cf3('0x4e')](_0x0cf3('0x91'));return;}if(_0x2ae71e[_0x0cf3('0x92')]['role']!==_0x0cf3('0x93'))return;return _0x2ae71e[_0x0cf3('0x92')][_0x0cf3('0x94')]({'attributes':['id'],'raw':!![]})[_0x0cf3('0x29')](function(_0x1e1032){if(_[_0x0cf3('0x8f')](_0x1e1032)){_0x3f366b[_0x0cf3('0x4e')](_0x0cf3('0x95'));_0x35108b[_0x0cf3('0x4e')](_0x0cf3('0x95'));}else{_0x3f366b[_0x0cf3('0x4e')](_0x0cf3('0x75'),_[_0x0cf3('0x31')](_0x1e1032,'id'));_0x35108b[_0x0cf3('0x4e')](_0x0cf3('0x75'),_[_0x0cf3('0x31')](_0x1e1032,'id'));}});})[_0x0cf3('0x29')](function(){if(_0x2ae71e[_0x0cf3('0x92')][_0x0cf3('0x96')]===_0x0cf3('0x93')&&!_0x121664&&!_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x74')])return[];return db[_0x0cf3('0x97')]['query'](_0x3f366b['toString'](),_0x1131ee);})[_0x0cf3('0x29')](function(_0x3475bb){_0x211101[_0x0cf3('0x25')]=_0x3475bb[_0x0cf3('0x61')];if(_0x211101['count']===0x0)return[];return db['sequelize']['query'](_0x1f189e[_0x0cf3('0x98')](),_0x1131ee)[_0x0cf3('0x29')](function(_0x32e85d){_0x1f7cea=_[_0x0cf3('0x99')](_0x32e85d,'id');_0x1131ee=_[_0x0cf3('0x9a')](_0x1131ee,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ae71e[_0x0cf3('0x45')][_0x0cf3('0x49')]){_0x41465a[_0x0cf3('0x9b')][_0x0cf3('0x36')](function(_0x131a81){_0x35108b[_0x0cf3('0x50')]('i.'+_0x131a81);});}else{_0x35108b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0cf3('0x62'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0x9c'),'Account.key');_0x35108b[_0x0cf3('0x50')]('a.mandatoryDisposition',_0x0cf3('0x9d'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0x9e'),_0x0cf3('0x8d'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0x9f'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xa0'),_0x0cf3('0xa1'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xa2'),_0x0cf3('0xa3'));_0x35108b['field'](_0x0cf3('0xa4'),_0x0cf3('0xa5'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xa6'),'Contact.phone');_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xa7'),_0x0cf3('0xa8'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xa9'),_0x0cf3('0xaa'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xab'),_0x0cf3('0xac'));_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xad'),'Owner.internal');_0x35108b[_0x0cf3('0x50')](_0x0cf3('0xae'),'TagIds');}if(_0x41465a[_0x0cf3('0x24')])_0x35108b[_0x0cf3('0x24')](_0x41465a[_0x0cf3('0x24')]);if(_0x41465a[_0x0cf3('0x22')])_0x35108b[_0x0cf3('0x22')](_0x41465a['offset']);return db[_0x0cf3('0x97')][_0x0cf3('0x45')](_0x35108b[_0x0cf3('0x98')](),_0x1131ee);})[_0x0cf3('0x29')](function(_0x37905c){if(_0x37905c[_0x0cf3('0x61')]>0x0)_0x3b14b7[_0x0cf3('0x4e')](_0x0cf3('0xaf'),_['map'](_0x37905c,'id'));return db['sequelize'][_0x0cf3('0x45')](_0x3b14b7[_0x0cf3('0x98')](),_0x1131ee)[_0x0cf3('0x29')](function(_0x25c251){var _0x3945e6=_[_0x0cf3('0xb0')](_0x25c251,_0x0cf3('0xb1'));var _0x43c1fa=[];_0x37905c[_0x0cf3('0x36')](function(_0x3ad749){_0x43c1fa[_0x0cf3('0x37')](updateOpenchannelInteraction(_0x3ad749,_0x1f7cea,_0x3945e6));});return BPromise[_0x0cf3('0xb2')](_0x43c1fa);});});})['then'](function(_0x5f35fb){_0x211101[_0x0cf3('0xb3')]=_0x5f35fb;return _0x211101;})[_0x0cf3('0x29')](respondWithFilteredResult(_0x422b76,_0x41465a))['catch'](handleError(_0x422b76,null));};exports[_0x0cf3('0xb4')]=function(_0x4e7629,_0x57cc75){var _0x10b5c4={};if(_0x4e7629[_0x0cf3('0x45')][_0x0cf3('0x43')]&&_0x4e7629['query'][_0x0cf3('0x43')]===_0x0cf3('0x52')){_0x10b5c4[_0x0cf3('0x52')]=_0x4e7629[_0x0cf3('0xb5')]['id'];}else{_0x10b5c4['id']=_0x4e7629['params']['id'];}var _0x1e6c9c={'raw':![],'where':_0x10b5c4},_0x2646c6={};_0x2646c6[_0x0cf3('0x44')]=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x2646c6[_0x0cf3('0x45')]=_[_0x0cf3('0x46')](_0x4e7629[_0x0cf3('0x45')]);_0x2646c6[_0x0cf3('0x47')]=_[_0x0cf3('0x48')](_0x2646c6[_0x0cf3('0x44')],_0x2646c6[_0x0cf3('0x45')]);_0x1e6c9c['attributes']=_[_0x0cf3('0x48')](_0x2646c6['model'],qs[_0x0cf3('0x49')](_0x4e7629['query']['fields']));_0x1e6c9c[_0x0cf3('0x9b')]=_0x1e6c9c['attributes'][_0x0cf3('0x61')]?_0x1e6c9c['attributes']:_0x2646c6['model'];if(_0x4e7629[_0x0cf3('0x45')][_0x0cf3('0xb6')]){_0x1e6c9c['include']=[{'all':!![]}];}_0x1e6c9c=_[_0x0cf3('0x9a')]({},_0x1e6c9c,_0x4e7629['options']);return db[_0x0cf3('0x40')][_0x0cf3('0x6b')](_0x1e6c9c)[_0x0cf3('0x29')](handleEntityNotFound(_0x57cc75,null))[_0x0cf3('0x29')](respondWithResult(_0x57cc75,null))[_0x0cf3('0x38')](handleError(_0x57cc75,null));};exports[_0x0cf3('0xb7')]=function(_0x476288,_0x413946){return db['OpenchannelInteraction'][_0x0cf3('0xb7')](_0x476288[_0x0cf3('0x72')],{})[_0x0cf3('0x29')](respondWithResult(_0x413946,0xc9))[_0x0cf3('0x38')](handleError(_0x413946,null));};exports['update']=function(_0x38bdf9,_0xd8fe32){if(_0x38bdf9[_0x0cf3('0x72')]['id']){delete _0x38bdf9[_0x0cf3('0x72')]['id'];}return db['OpenchannelInteraction'][_0x0cf3('0x6b')]({'where':{'id':_0x38bdf9['params']['id']}})[_0x0cf3('0x29')](handleEntityNotFound(_0xd8fe32,null))[_0x0cf3('0x29')](saveUpdates(_0x38bdf9[_0x0cf3('0x72')],null))['then'](respondWithResult(_0xd8fe32,null))[_0x0cf3('0x38')](handleError(_0xd8fe32,null));};exports[_0x0cf3('0x2a')]=function(_0x28df5d,_0x32da12){return db[_0x0cf3('0x40')][_0x0cf3('0x6b')]({'where':{'id':_0x28df5d['params']['id']}})['then'](handleEntityNotFound(_0x32da12,null))[_0x0cf3('0x29')](removeEntity(_0x32da12,null))[_0x0cf3('0x38')](handleError(_0x32da12,null));};exports[_0x0cf3('0xb8')]=function(_0x2bf00f,_0x584500){return db['OpenchannelInteraction']['describe']()[_0x0cf3('0x29')](respondWithResult(_0x584500,null))[_0x0cf3('0x38')](handleError(_0x584500,null));};exports[_0x0cf3('0xb9')]=function(_0xd130ec,_0xfa1cb0,_0x49a2ee){return db['OpenchannelMessage'][_0x0cf3('0x6b')]({'where':{'id':_0xd130ec[_0x0cf3('0xb5')]['id']}})[_0x0cf3('0x29')](handleEntityNotFound(_0xfa1cb0,null))[_0x0cf3('0x29')](function(_0x2cfac0){if(_0x2cfac0){return _0x2cfac0[_0x0cf3('0xb9')](_0xd130ec['body']['ids'],_[_0x0cf3('0xba')](_0xd130ec[_0x0cf3('0x72')],[_0x0cf3('0xbb'),'id'])||{});}})[_0x0cf3('0x29')](respondWithResult(_0xfa1cb0,null))[_0x0cf3('0x38')](handleError(_0xfa1cb0,null));};exports[_0x0cf3('0xbc')]=function(_0xd0b54f,_0x591c26,_0x370ba4){var _0x6f9a20={'raw':![],'where':{}};var _0x93d5cf={};var _0x547000={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x0cf3('0xbd')]({'where':{'id':_0xd0b54f[_0x0cf3('0xb5')]['id']}})['then'](handleEntityNotFound(_0x591c26,null))[_0x0cf3('0x29')](function(_0x210695){if(_0x210695){_0x93d5cf['model']=_[_0x0cf3('0x46')](db['OpenchannelMessage'][_0x0cf3('0x41')]);_0x93d5cf[_0x0cf3('0x45')]=_[_0x0cf3('0x46')](_0xd0b54f[_0x0cf3('0x45')]);_0x93d5cf[_0x0cf3('0x47')]=_[_0x0cf3('0x48')](_0x93d5cf[_0x0cf3('0x44')],_0x93d5cf[_0x0cf3('0x45')]);_0x6f9a20[_0x0cf3('0x9b')]=_[_0x0cf3('0x48')](_0x93d5cf['model'],qs[_0x0cf3('0x49')](_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0x49')]));_0x6f9a20[_0x0cf3('0x9b')]=_0x6f9a20[_0x0cf3('0x9b')][_0x0cf3('0x61')]?_0x6f9a20[_0x0cf3('0x9b')]:_0x93d5cf['model'];if(!_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0x4a')](_0x0cf3('0x4b'))){_0x6f9a20['limit']=qs['limit'](_0xd0b54f['query'][_0x0cf3('0x24')]);_0x6f9a20[_0x0cf3('0x22')]=qs[_0x0cf3('0x22')](_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0x22')]);}_0x6f9a20[_0x0cf3('0x4c')]=qs[_0x0cf3('0x4d')](_0xd0b54f['query'][_0x0cf3('0x4d')]);_0x6f9a20[_0x0cf3('0x4e')]=qs[_0x0cf3('0x47')](_[_0x0cf3('0x4f')](_0xd0b54f[_0x0cf3('0x45')],_0x93d5cf['filters']));_0x6f9a20[_0x0cf3('0x4e')][_0x0cf3('0xb1')]=_0x210695['id'];if(_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0x82')]){_0x6f9a20[_0x0cf3('0x4e')]=_[_0x0cf3('0x9a')](_0x6f9a20[_0x0cf3('0x4e')],{'$or':_[_0x0cf3('0x31')](_0x6f9a20[_0x0cf3('0x9b')],function(_0x2c9a76){var _0x422500={};_0x422500[_0x2c9a76]={'$like':'%'+_0xd0b54f['query']['filter']+'%'};return _0x422500;})});}if(_0xd0b54f['query'][_0x0cf3('0x79')]){var _0x36f88b=_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0x79')][_0x0cf3('0x35')](',');var _0x5b3d89={};_0x5b3d89[_0x36f88b[0x0]]={'$gte':moment(_0x36f88b[0x1])[_0x0cf3('0xbe')](_0x0cf3('0xbf'))};_0x6f9a20[_0x0cf3('0x4e')]=_['merge'](_0x6f9a20['where'],_0x5b3d89);}_0x6f9a20=_[_0x0cf3('0x9a')]({},_0x6f9a20,_0xd0b54f[_0x0cf3('0xc0')]);return db[_0x0cf3('0xc1')][_0x0cf3('0x25')]({'where':_0x6f9a20[_0x0cf3('0x4e')]})['then'](function(_0x9a0c4b){_0x547000[_0x0cf3('0x25')]=_0x9a0c4b;if(_0xd0b54f[_0x0cf3('0x45')][_0x0cf3('0xb6')]){_0x6f9a20[_0x0cf3('0xc2')]=[{'all':!![]}];}return db[_0x0cf3('0xc1')][_0x0cf3('0xc3')](_0x6f9a20);})[_0x0cf3('0x29')](function(_0x44dbdc){_0x547000[_0x0cf3('0xb3')]=_0x44dbdc;return _0x547000;});}})[_0x0cf3('0x29')](respondWithFilteredResult(_0x591c26,_0x6f9a20))[_0x0cf3('0x38')](handleError(_0x591c26,null));};exports[_0x0cf3('0xc4')]=function(_0x5406f6,_0x1d441c,_0x34c69f){return db['OpenchannelInteraction'][_0x0cf3('0x6b')]({'where':{'id':_0x5406f6[_0x0cf3('0xb5')]['id']}})[_0x0cf3('0x29')](handleEntityNotFound(_0x1d441c,null))[_0x0cf3('0x29')](function(_0x159c8b){if(_0x159c8b){return _0x159c8b[_0x0cf3('0xc5')](_0x5406f6[_0x0cf3('0x72')][_0x0cf3('0xbb')],_[_0x0cf3('0xba')](_0x5406f6[_0x0cf3('0x72')],[_0x0cf3('0xbb'),'id'])||{})['spread'](function(){return db[_0x0cf3('0xc6')][_0x0cf3('0xc3')]({'attributes':['id',_0x0cf3('0x2e'),_0x0cf3('0x51')],'where':{'id':_0x5406f6[_0x0cf3('0x72')]['ids']}});})[_0x0cf3('0x29')](function(_0x1284b9){socket[_0x0cf3('0xc7')](_0x0cf3('0xc8'),{'id':Number(_0x5406f6[_0x0cf3('0xb5')]['id']),'tags':_0x1284b9||[]});return{'id':Number(_0x5406f6[_0x0cf3('0xb5')]['id']),'tags':_0x1284b9||[]};});}})[_0x0cf3('0x29')](respondWithResult(_0x1d441c,null))[_0x0cf3('0x38')](handleError(_0x1d441c,null));};exports[_0x0cf3('0xc9')]=function(_0x3de66b,_0x56d274,_0xbc6b94){return db[_0x0cf3('0x40')][_0x0cf3('0x6b')]({'where':{'id':_0x3de66b[_0x0cf3('0xb5')]['id']}})['then'](handleEntityNotFound(_0x56d274,null))[_0x0cf3('0x29')](function(_0x184811){if(_0x184811){return _0x184811[_0x0cf3('0xc9')](_0x3de66b[_0x0cf3('0x45')][_0x0cf3('0xbb')]);}})['then'](respondWithStatusCode(_0x56d274,null))[_0x0cf3('0x38')](handleError(_0x56d274,null));};exports['download']=function(_0x314bf3,_0x38b55d){var _0x34dc51=moment()[_0x0cf3('0xca')]()[_0x0cf3('0x98')]();var _0x53df45=path['join'](config[_0x0cf3('0xcb')],'server','files',_0x0cf3('0xcc'));var _0x1c263b=path[_0x0cf3('0xcd')](config[_0x0cf3('0xcb')],_0x0cf3('0xce'),_0x0cf3('0xcf'),_0x0cf3('0xd0'));var _0x3b37d4=path[_0x0cf3('0xcd')](_0x53df45,_0x34dc51);var _0x53e50a=util[_0x0cf3('0xbe')](_0x0cf3('0xd1'),_0x314bf3['params']['id'],_0x34dc51);var _0x515e88=path[_0x0cf3('0xcd')](_0x53df45,_0x53e50a);var _0x32d637=[];_0x32d637[_0x0cf3('0x37')]({'model':db[_0x0cf3('0xd2')],'as':_0x0cf3('0xd2'),'attributes':['id',_0x0cf3('0x32')],'raw':!![]});_0x32d637[_0x0cf3('0x37')]({'model':db['CmContact'],'as':_0x0cf3('0x64'),'attributes':['id',_0x0cf3('0xd3'),_0x0cf3('0xd4')],'raw':!![]});if(_0x314bf3['query'][_0x0cf3('0xd0')]){_0x32d637[_0x0cf3('0x37')]({'model':db[_0x0cf3('0xd5')],'as':'Attachment','raw':!![]});}var _0x34c27c=[{'model':db[_0x0cf3('0xc1')],'as':'Messages','attributes':['id',_0x0cf3('0x72'),_0x0cf3('0x77'),_0x0cf3('0xd6'),_0x0cf3('0xd7'),'read'],'include':_0x32d637}];_0x34c27c[_0x0cf3('0x37')]({'model':db[_0x0cf3('0xd8')],'as':'Account','attributes':['id',_0x0cf3('0x2e')]});_0x34c27c[_0x0cf3('0x37')]({'model':db[_0x0cf3('0xd2')],'as':'Owner','attributes':['id','fullname']});return db[_0x0cf3('0x40')]['find']({'where':{'id':_0x314bf3[_0x0cf3('0xb5')]['id']},'include':_0x34c27c})[_0x0cf3('0x29')](handleEntityNotFound(_0x38b55d,null))[_0x0cf3('0x29')](function(_0x55881b){if(_0x55881b){var _0x5e6fe5=_0x55881b['get']({'plain':!![]});fs[_0x0cf3('0xd9')](_0x3b37d4);var _0x2ade0f={'channel':_0x0cf3('0xda'),'account':_0x5e6fe5['Account']['name'],'agent':_0x5e6fe5['Owner']?_0x5e6fe5[_0x0cf3('0xdb')][_0x0cf3('0x32')]:_0x0cf3('0xdc'),'createdAt':moment(_0x5e6fe5[_0x0cf3('0x77')])[_0x0cf3('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0cf3('0x98')](),'closedAt':_0x5e6fe5[_0x0cf3('0x3c')]?moment(_0x5e6fe5[_0x0cf3('0xdd')])[_0x0cf3('0xbe')](_0x0cf3('0xbf'))[_0x0cf3('0x98')]():'','disposition':_0x5e6fe5[_0x0cf3('0xde')],'visibility':_0x5e6fe5[_0x0cf3('0xdf')]?_0x0cf3('0xe0'):_0x0cf3('0xe1'),'messages':_(_0x5e6fe5['Messages'])[_0x0cf3('0x82')]({'secret':![]})[_0x0cf3('0x31')](function(_0x14a22e){if(_0x14a22e[_0x0cf3('0xd5')]){var _0x24cf2f=path[_0x0cf3('0xcd')](_0x1c263b,_0x14a22e[_0x0cf3('0xd5')][_0x0cf3('0xe2')]);if(fs['existsSync'](_0x24cf2f)){fs[_0x0cf3('0xe3')](_0x24cf2f)[_0x0cf3('0xe4')](fs[_0x0cf3('0xe5')](path[_0x0cf3('0xcd')](_0x3b37d4,_0x14a22e[_0x0cf3('0xd5')][_0x0cf3('0xe2')])));}}return{'date':moment(_0x14a22e['createdAt'])[_0x0cf3('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x14a22e['direction']==='out'?_0x14a22e[_0x0cf3('0xd2')]?_0x14a22e[_0x0cf3('0xd2')][_0x0cf3('0x32')]:_0x0cf3('0xe6'):_0x14a22e['Contact']['firstName']+(_0x14a22e[_0x0cf3('0x64')][_0x0cf3('0xd4')]?'\x20'+_0x14a22e[_0x0cf3('0x64')][_0x0cf3('0xd4')]:''),'body':_0x14a22e[_0x0cf3('0xd5')]?_0x14a22e[_0x0cf3('0xd5')][_0x0cf3('0xe2')]:_0x14a22e['body'],'direction':_0x14a22e[_0x0cf3('0xd6')]===_0x0cf3('0xe7')?'A':'C','secret':_0x14a22e[_0x0cf3('0xd7')],'read':_0x14a22e[_0x0cf3('0x7d')],'attachment':_0x14a22e['Attachment']};})[_0x0cf3('0x69')]()};return ejs[_0x0cf3('0xe8')](path['join'](config[_0x0cf3('0xcb')],_0x0cf3('0xce'),_0x0cf3('0xe9'),_0x0cf3('0xea')),{'interaction':_0x2ade0f})[_0x0cf3('0x29')](function(_0x4171a4){var _0x339a7a=path['join'](_0x3b37d4,_0x0cf3('0xeb')+_0x5e6fe5['id']+'-'+_0x34dc51+_0x0cf3('0xec'));var _0x9e308={'path':_0x339a7a,'channel':_0x0cf3('0xda'),'interactionId':_0x5e6fe5['id']};return pdf[_0x0cf3('0xed')](_0x4171a4,_0x9e308);})[_0x0cf3('0x29')](function(){return new BPromise(function(_0x1e96b1,_0x2d0748){zipdir(_0x3b37d4,{'saveTo':_0x515e88},function(_0x2e85ee,_0x321457){if(_0x2e85ee)return _0x2d0748(_0x2e85ee);return _0x1e96b1(_0x321457);});})[_0x0cf3('0x29')](function(){return new BPromise(function(_0x3206ad,_0x3fc7ef){rimraf(_0x3b37d4,function(_0x28f8bb){if(_0x28f8bb)_0x3fc7ef(_0x28f8bb);return _0x3206ad();});});})[_0x0cf3('0x29')](function(){return _0x38b55d['download'](_0x515e88,_0x53e50a,function(_0x91570c){if(_0x91570c){console['log'](_0x0cf3('0xee'),_0x91570c);}else{fs[_0x0cf3('0xef')](_0x515e88);}});});});}else{return _0x38b55d[_0x0cf3('0x2b')](0xc8);}})[_0x0cf3('0x38')](handleError(_0x38b55d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9467e6d..8e4473d 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 _0x073e=['emit','catch','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','getUsers','then','Users','map','unreadMessages','length'];(function(_0x2b0a13,_0xbd8491){var _0x2ccb27=function(_0x271152){while(--_0x271152){_0x2b0a13['push'](_0x2b0a13['shift']());}};_0x2ccb27(++_0xbd8491);}(_0x073e,0x184));var _0xe073=function(_0x417947,_0x51b197){_0x417947=_0x417947-0x0;var _0x4f705c=_0x073e[_0x417947];return _0x4f705c;};'use strict';var EventEmitter=require(_0xe073('0x0'));var OpenchannelInteraction=require(_0xe073('0x1'))['db'][_0xe073('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xe073('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe073('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe073('0x5'),'afterDestroy':'remove'};function emitEvent(_0x48a2ea){return function(_0x23f25f,_0xd50e20,_0x1fbe06){_0x23f25f[_0xe073('0x6')]({'attributes':['id'],'raw':!![]})[_0xe073('0x7')](function(_0x7ba5f0){_0x23f25f['setDataValue'](_0xe073('0x8'),_0x7ba5f0[_0xe073('0x9')](function(_0x115880){return{'id':_0x115880['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x23f25f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe073('0x7')](function(_0x785cbb){_0x23f25f['setDataValue'](_0xe073('0xa'),_0x785cbb[_0xe073('0xb')]);OpenchannelInteractionEvents['emit'](_0x48a2ea+':'+_0x23f25f['id'],_0x23f25f);OpenchannelInteractionEvents[_0xe073('0xc')](_0x48a2ea,_0x23f25f);_0x1fbe06(null);})[_0xe073('0xd')](_0x1fbe06(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe073('0xe')](e,emitEvent(event));}}module[_0xe073('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x26cb=['emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x26cb,0x17d));var _0xb26c=function(_0x4af2b7,_0x1c0b55){_0x4af2b7=_0x4af2b7-0x0;var _0x522f24=_0x26cb[_0x4af2b7];return _0x522f24;};'use strict';var EventEmitter=require(_0xb26c('0x0'));var OpenchannelInteraction=require(_0xb26c('0x1'))['db'][_0xb26c('0x2')];var OpenchannelMessage=require(_0xb26c('0x1'))['db'][_0xb26c('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb26c('0x4'),'afterUpdate':_0xb26c('0x5'),'afterDestroy':_0xb26c('0x6')};function emitEvent(_0x5b25b8){return function(_0x4b51df,_0x35d354,_0x255ab5){_0x4b51df[_0xb26c('0x7')]({'attributes':['id'],'raw':!![]})[_0xb26c('0x8')](function(_0x4efe19){_0x4b51df[_0xb26c('0x9')](_0xb26c('0xa'),_0x4efe19[_0xb26c('0xb')](function(_0x599352){return{'id':_0x599352['id']};}));return OpenchannelMessage[_0xb26c('0xc')]({'where':{'OpenchannelInteractionId':_0x4b51df['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb26c('0x8')](function(_0x59c38e){_0x4b51df[_0xb26c('0x9')](_0xb26c('0xd'),_0x59c38e[_0xb26c('0xe')]);OpenchannelInteractionEvents[_0xb26c('0xf')](_0x5b25b8+':'+_0x4b51df['id'],_0x4b51df);OpenchannelInteractionEvents[_0xb26c('0xf')](_0x5b25b8,_0x4b51df);_0x255ab5(null);})['catch'](_0x255ab5(null));};}for(var e in events){if(events[_0xb26c('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xb26c('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8a78509..554d2dc 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 _0x5c00=['../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0x5c00,0x19b));var _0x05c0=function(_0x49bf83,_0x3a54dc){_0x49bf83=_0x49bf83-0x0;var _0x339b39=_0x5c00[_0x49bf83];return _0x339b39;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))(_0x05c0('0x3'));var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var rp=require(_0x05c0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x05c0('0x7'));var attributes=require(_0x05c0('0x8'));module[_0x05c0('0x9')]=function(_0x4aedc0,_0x33d330){return _0x4aedc0[_0x05c0('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0x05c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x05c0('0xc'),'collate':_0x05c0('0xd'),'hooks':{'beforeUpdate':function(_0x2f5bbd,_0x297917,_0x18ff8f){if(_0x2f5bbd[_0x05c0('0xe')](_0x05c0('0xf'))){_0x2f5bbd[_0x05c0('0x10')]=moment()[_0x05c0('0x11')](_0x05c0('0x12'));}_0x18ff8f(null,_0x2f5bbd);}}});}; \ No newline at end of file +var _0x1d8e=['OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xa383f0,_0x81e49e){var _0x4cc91d=function(_0x51536e){while(--_0x51536e){_0xa383f0['push'](_0xa383f0['shift']());}};_0x4cc91d(++_0x81e49e);}(_0x1d8e,0xcc));var _0xe1d8=function(_0x189d3c,_0x5efebf){_0x189d3c=_0x189d3c-0x0;var _0x485959=_0x1d8e[_0x189d3c];return _0x485959;};'use strict';var _=require(_0xe1d8('0x0'));var util=require(_0xe1d8('0x1'));var logger=require(_0xe1d8('0x2'))(_0xe1d8('0x3'));var moment=require(_0xe1d8('0x4'));var BPromise=require(_0xe1d8('0x5'));var rp=require(_0xe1d8('0x6'));var fs=require('fs');var path=require(_0xe1d8('0x7'));var rimraf=require(_0xe1d8('0x8'));var config=require(_0xe1d8('0x9'));var attributes=require('./openchannelInteraction.attributes');module[_0xe1d8('0xa')]=function(_0x1470ae,_0x336be9){return _0x1470ae[_0xe1d8('0xb')](_0xe1d8('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe1d8('0xd'),'collate':_0xe1d8('0xe'),'hooks':{'beforeUpdate':function(_0x198151,_0x2c6539,_0x32bc5c){if(_0x198151['changed'](_0xe1d8('0xf'))){_0x198151[_0xe1d8('0x10')]=moment()[_0xe1d8('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x32bc5c(null,_0x198151);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 89d9d2f..b5609bd 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 _0x06e7=['../../config/utils','rpc','../../config/environment','http','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToOpenchannelInteraction','find','where','omit','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x1ee467,_0x2c4a56){var _0x13a1af=function(_0x4e1541){while(--_0x4e1541){_0x1ee467['push'](_0x1ee467['shift']());}};_0x13a1af(++_0x2c4a56);}(_0x06e7,0x13c));var _0x706e=function(_0x132c9f,_0x45a6ff){_0x132c9f=_0x132c9f-0x0;var _0x37d957=_0x06e7[_0x132c9f];return _0x37d957;};'use strict';var _=require(_0x706e('0x0'));var util=require(_0x706e('0x1'));var moment=require(_0x706e('0x2'));var BPromise=require(_0x706e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x706e('0x4'));var logger=require('../../config/logger')(_0x706e('0x5'));var config=require(_0x706e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x706e('0x7')]({'port':0x232a});config['redis']=_[_0x706e('0x8')](config[_0x706e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x706e('0xa'))(new Redis(config['redis']));require(_0x706e('0xb'))[_0x706e('0xc')](socket);function respondWithRpcPromise(_0xc7cdd8,_0x429842,_0xbac163){return new BPromise(function(_0xdc8731,_0x1f5afd){return client[_0x706e('0xd')](_0xc7cdd8,_0xbac163)[_0x706e('0xe')](function(_0x2bcac1){logger[_0x706e('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x429842,_0x706e('0x10'));logger[_0x706e('0x11')](_0x706e('0x12'),_0x429842,_0x706e('0x10'),JSON[_0x706e('0x13')](_0x2bcac1));if(_0x2bcac1[_0x706e('0x14')]){if(_0x2bcac1['error'][_0x706e('0x15')]===0x1f4){logger[_0x706e('0x14')](_0x706e('0x16'),_0x429842,_0x2bcac1[_0x706e('0x14')][_0x706e('0x17')]);return _0x1f5afd(_0x2bcac1[_0x706e('0x14')][_0x706e('0x17')]);}logger[_0x706e('0x14')](_0x706e('0x16'),_0x429842,_0x2bcac1['error'][_0x706e('0x17')]);return _0xdc8731(_0x2bcac1[_0x706e('0x14')][_0x706e('0x17')]);}else{logger[_0x706e('0xf')](_0x706e('0x16'),_0x429842,_0x706e('0x10'));_0xdc8731(_0x2bcac1[_0x706e('0x18')][_0x706e('0x17')]);}})['catch'](function(_0xc6fca8){logger[_0x706e('0x14')](_0x706e('0x16'),_0x429842,_0xc6fca8);_0x1f5afd(_0xc6fca8);});});}exports[_0x706e('0x19')]=function(_0x548817){var _0x23233d=this;return new Promise(function(_0x44fbd3,_0xacf5ce){return db[_0x706e('0x1a')][_0x706e('0x1b')](_0x548817[_0x706e('0x1c')],{'raw':_0x548817[_0x706e('0x1d')]?_0x548817['options'][_0x706e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x548817['options']?_0x548817[_0x706e('0x1d')]['where']||null:null,'attributes':_0x548817['options']?_0x548817[_0x706e('0x1d')][_0x706e('0x1f')]||null:null,'limit':_0x548817['options']?_0x548817['options'][_0x706e('0x20')]||null:null})[_0x706e('0xe')](function(_0x5a70b6){logger[_0x706e('0xf')](_0x706e('0x19'),_0x548817);logger['debug'](_0x706e('0x19'),_0x548817,JSON[_0x706e('0x13')](_0x5a70b6));_0x44fbd3(_0x5a70b6);})[_0x706e('0x21')](function(_0x1010a3){logger['error'](_0x706e('0x19'),_0x1010a3[_0x706e('0x17')],_0x548817);_0xacf5ce(_0x23233d[_0x706e('0x14')](0x1f4,_0x1010a3['message']));});});};exports[_0x706e('0x22')]=function(_0xa6cedd){return new Promise(function(_0x4d9087,_0x39b2c4){return db[_0x706e('0x1a')][_0x706e('0x23')]({'where':_0xa6cedd['options']?_0xa6cedd[_0x706e('0x1d')][_0x706e('0x24')]||null:null})[_0x706e('0xe')](function(_0x1dc560){if(_0x1dc560){return _0x1dc560['addTags'](_0xa6cedd[_0x706e('0x1c')]['ids'],_[_0x706e('0x25')](_0xa6cedd[_0x706e('0x1c')],['ids','id'])||{});}})[_0x706e('0x26')](function(_0x3034e8){logger['info'](_0x706e('0x27'),_0xa6cedd);logger[_0x706e('0x11')](_0x706e('0x27'),_0xa6cedd,JSON['stringify'](_0x3034e8));_0x4d9087(_0x3034e8);})[_0x706e('0x21')](function(_0x191dc8){logger[_0x706e('0x14')](_0x706e('0x27'),_0x191dc8['message'],_0xa6cedd);_0x39b2c4(_this['error'](0x1f4,_0x191dc8[_0x706e('0x17')]));});});}; \ No newline at end of file +var _0x5fb5=['catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','attributes','limit','then','debug','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','redis','localhost','register','request','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','OpenchannelInteraction,\x20%s,\x20%s','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fb5,0x15e));var _0x55fb=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x5fb5[_0x8e9386];return _0x4abf26;};'use strict';var _=require(_0x55fb('0x0'));var util=require(_0x55fb('0x1'));var moment=require(_0x55fb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x55fb('0x4'))(_0x55fb('0x5'));var config=require('../../config/environment');var jayson=require(_0x55fb('0x6'));var client=jayson[_0x55fb('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x55fb('0x8')],{'host':_0x55fb('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x55fb('0x8')]));require('./openchannelInteraction.socket')[_0x55fb('0xa')](socket);function respondWithRpcPromise(_0x39d6a9,_0x42aefe,_0x5b78ee){return new BPromise(function(_0x36b72b,_0x36f0ca){return client[_0x55fb('0xb')](_0x39d6a9,_0x5b78ee)['then'](function(_0x44f8cc){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x42aefe,_0x55fb('0xc'));logger['debug'](_0x55fb('0xd'),_0x42aefe,_0x55fb('0xc'),JSON[_0x55fb('0xe')](_0x44f8cc));if(_0x44f8cc['error']){if(_0x44f8cc['error'][_0x55fb('0xf')]===0x1f4){logger[_0x55fb('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x42aefe,_0x44f8cc[_0x55fb('0x10')][_0x55fb('0x11')]);return _0x36f0ca(_0x44f8cc['error']['message']);}logger[_0x55fb('0x10')](_0x55fb('0x12'),_0x42aefe,_0x44f8cc[_0x55fb('0x10')]['message']);return _0x36b72b(_0x44f8cc['error'][_0x55fb('0x11')]);}else{logger[_0x55fb('0x13')](_0x55fb('0x12'),_0x42aefe,_0x55fb('0xc'));_0x36b72b(_0x44f8cc['result'][_0x55fb('0x11')]);}})[_0x55fb('0x14')](function(_0x49062c){logger[_0x55fb('0x10')](_0x55fb('0x12'),_0x42aefe,_0x49062c);_0x36f0ca(_0x49062c);});});}exports[_0x55fb('0x15')]=function(_0x3fe304){var _0x5af871=this;return new Promise(function(_0x5a63fc,_0x139060){return db[_0x55fb('0x16')][_0x55fb('0x17')](_0x3fe304[_0x55fb('0x18')],{'raw':_0x3fe304[_0x55fb('0x19')]?_0x3fe304[_0x55fb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fe304[_0x55fb('0x19')]?_0x3fe304[_0x55fb('0x19')]['where']||null:null,'attributes':_0x3fe304[_0x55fb('0x19')]?_0x3fe304[_0x55fb('0x19')][_0x55fb('0x1a')]||null:null,'limit':_0x3fe304['options']?_0x3fe304[_0x55fb('0x19')][_0x55fb('0x1b')]||null:null})[_0x55fb('0x1c')](function(_0x13388a){logger['info']('UpdateOpenchannelInteraction',_0x3fe304);logger[_0x55fb('0x1d')](_0x55fb('0x15'),_0x3fe304,JSON[_0x55fb('0xe')](_0x13388a));_0x5a63fc(_0x13388a);})[_0x55fb('0x14')](function(_0x4a70fa){logger[_0x55fb('0x10')](_0x55fb('0x15'),_0x4a70fa[_0x55fb('0x11')],_0x3fe304);_0x139060(_0x5af871[_0x55fb('0x10')](0x1f4,_0x4a70fa[_0x55fb('0x11')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x50a3b6){return new Promise(function(_0x3459f3,_0x384771){return db[_0x55fb('0x16')][_0x55fb('0x1e')]({'where':_0x50a3b6['options']?_0x50a3b6[_0x55fb('0x19')][_0x55fb('0x1f')]||null:null})['then'](function(_0x4eafdd){if(_0x4eafdd){return _0x4eafdd[_0x55fb('0x20')](_0x50a3b6[_0x55fb('0x18')][_0x55fb('0x21')],_[_0x55fb('0x22')](_0x50a3b6[_0x55fb('0x18')],[_0x55fb('0x21'),'id'])||{});}})[_0x55fb('0x23')](function(_0xaaffbf){logger[_0x55fb('0x13')](_0x55fb('0x24'),_0x50a3b6);logger['debug'](_0x55fb('0x24'),_0x50a3b6,JSON[_0x55fb('0xe')](_0xaaffbf));_0x3459f3(_0xaaffbf);})[_0x55fb('0x14')](function(_0x365564){logger[_0x55fb('0x10')](_0x55fb('0x24'),_0x365564[_0x55fb('0x11')],_0x50a3b6);_0x384771(_this[_0x55fb('0x10')](0x1f4,_0x365564[_0x55fb('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2c01556..dd910c9 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 _0xccf8=['./openchannelInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x31ce65,_0x503f1c){var _0x2c246d=function(_0x4a4260){while(--_0x4a4260){_0x31ce65['push'](_0x31ce65['shift']());}};_0x2c246d(++_0x503f1c);}(_0xccf8,0x19d));var _0x8ccf=function(_0x315203,_0x237b96){_0x315203=_0x315203-0x0;var _0x88791f=_0xccf8[_0x315203];return _0x88791f;};'use strict';var OpenchannelInteractionEvents=require(_0x8ccf('0x0'));var events=['save',_0x8ccf('0x1'),_0x8ccf('0x2')];function createListener(_0x4f5f0f,_0x1e13a7){return function(_0xcc7c3c){_0x1e13a7[_0x8ccf('0x3')](_0x4f5f0f,_0xcc7c3c);};}function removeListener(_0x3cee7d,_0x345bbc){return function(){OpenchannelInteractionEvents[_0x8ccf('0x4')](_0x3cee7d,_0x345bbc);};}exports[_0x8ccf('0x5')]=function(_0x344caa){for(var _0x3cd9a9=0x0,_0x50a8a0=events[_0x8ccf('0x6')];_0x3cd9a9<_0x50a8a0;_0x3cd9a9++){var _0x134be9=events[_0x3cd9a9];var _0x134970=createListener('openchannelInteraction:'+_0x134be9,_0x344caa);OpenchannelInteractionEvents['on'](_0x134be9,_0x134970);}}; \ No newline at end of file +var _0x2d45=['length','openchannelInteraction:','./openchannelInteraction.events','update','removeListener','register'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2d45,0x1a0));var _0x52d4=function(_0x26bf30,_0x36e354){_0x26bf30=_0x26bf30-0x0;var _0x37bfcb=_0x2d45[_0x26bf30];return _0x37bfcb;};'use strict';var OpenchannelInteractionEvents=require(_0x52d4('0x0'));var events=['save','remove',_0x52d4('0x1')];function createListener(_0xa3a1f0,_0x2b812c){return function(_0x28457b){_0x2b812c['emit'](_0xa3a1f0,_0x28457b);};}function removeListener(_0x1a7aa3,_0x55672d){return function(){OpenchannelInteractionEvents[_0x52d4('0x2')](_0x1a7aa3,_0x55672d);};}exports[_0x52d4('0x3')]=function(_0x26ddd4){for(var _0x9eb0b9=0x0,_0x2d8f0c=events[_0x52d4('0x4')];_0x9eb0b9<_0x2d8f0c;_0x9eb0b9++){var _0x321332=events[_0x9eb0b9];var _0xfa8bef=createListener(_0x52d4('0x5')+_0x321332,_0x26ddd4);OpenchannelInteractionEvents['on'](_0x321332,_0xfa8bef);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index fc28afe..46ba0d0 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x451251,_0x173a02){var _0x296b20=function(_0x1cfa86){while(--_0x1cfa86){_0x451251['push'](_0x451251['shift']());}};_0x296b20(++_0x173a02);}(_0xedd9,0xfc));var _0x9edd=function(_0x34b8fe,_0x1d9033){_0x34b8fe=_0x34b8fe-0x0;var _0xe4660d=_0xedd9[_0x34b8fe];return _0xe4660d;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x21bdfb,_0x3bd120){_0x21bdfb=_0x21bdfb-0x0;var _0x1d57de=_0x70e0[_0x21bdfb];return _0x1d57de;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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 f380eb4..9aaee79 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 _0x1c52=['TEXT','medium','out','STRING','sequelize','exports'];(function(_0x4cc1c1,_0x3ad908){var _0x483778=function(_0x358fc5){while(--_0x358fc5){_0x4cc1c1['push'](_0x4cc1c1['shift']());}};_0x483778(++_0x3ad908);}(_0x1c52,0x7c));var _0x21c5=function(_0xc17883,_0x5275af){_0xc17883=_0xc17883-0x0;var _0x4b17b9=_0x1c52[_0xc17883];return _0x4b17b9;};'use strict';var Sequelize=require(_0x21c5('0x0'));module[_0x21c5('0x1')]={'body':{'type':Sequelize[_0x21c5('0x2')](_0x21c5('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x21c5('0x4')),'defaultValue':_0x21c5('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x21c5('0x5')]},'providerResponse':{'type':Sequelize[_0x21c5('0x2')]}}; \ No newline at end of file +var _0xc893=['BOOLEAN','ENUM','out','DATE','STRING','exports','TEXT'];(function(_0xcee715,_0x430c04){var _0x4d8120=function(_0x525408){while(--_0x525408){_0xcee715['push'](_0xcee715['shift']());}};_0x4d8120(++_0x430c04);}(_0xc893,0x194));var _0x3c89=function(_0x426631,_0x19f779){_0x426631=_0x426631-0x0;var _0x2f0126=_0xc893[_0x426631];return _0x2f0126;};'use strict';var Sequelize=require('sequelize');module[_0x3c89('0x0')]={'body':{'type':Sequelize[_0x3c89('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x3c89('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3c89('0x3')]('in',_0x3c89('0x4')),'defaultValue':_0x3c89('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3c89('0x5')]},'providerName':{'type':Sequelize[_0x3c89('0x6')]},'providerResponse':{'type':Sequelize[_0x3c89('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 0979f7a..a61f3f2 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 _0x5956=['jayson/promise','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','name','send','map','OpenchannelMessage','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','create','body','update','destroy','describe','openchannel-interactions','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','sequelize','QueryTypes','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','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','redis','./openchannelMessage.socket','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5956,0x65));var _0x6595=function(_0x43bc64,_0x489fe3){_0x43bc64=_0x43bc64-0x0;var _0x3ef249=_0x5956[_0x43bc64];return _0x3ef249;};'use strict';var emlformat=require(_0x6595('0x0'));var rimraf=require(_0x6595('0x1'));var zipdir=require(_0x6595('0x2'));var jsonpatch=require(_0x6595('0x3'));var rp=require(_0x6595('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6595('0x5'));var util=require(_0x6595('0x6'));var path=require(_0x6595('0x7'));var sox=require(_0x6595('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6595('0x9'));var squel=require(_0x6595('0xa'));var crypto=require(_0x6595('0xb'));var jsforce=require(_0x6595('0xc'));var deskjs=require(_0x6595('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6595('0xe'));var Papa=require(_0x6595('0xf'));var Redis=require('ioredis');var authService=require(_0x6595('0x10'));var qs=require(_0x6595('0x11'));var as=require(_0x6595('0x12'));var hardwareService=require(_0x6595('0x13'));var logger=require(_0x6595('0x14'))(_0x6595('0x15'));var utils=require('../../config/utils');var config=require(_0x6595('0x16'));var licenseUtil=require(_0x6595('0x17'));var db=require(_0x6595('0x18'))['db'];config['redis']=_[_0x6595('0x19')](config[_0x6595('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6595('0x1a')]));require(_0x6595('0x1b'))[_0x6595('0x1c')](socket);var jayson=require(_0x6595('0x1d'));var client=jayson[_0x6595('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x6595('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe4c83,_0x9b72d3,_0x38a293,_0x554872){return new BPromise(function(_0x4b8516,_0xbad2e7){var _0x51a070=_0x554872||client;return _0x51a070[_0x6595('0x1f')](_0xfe4c83,_0x38a293)[_0x6595('0x20')](function(_0x1e5d24){logger['info'](_0x6595('0x21'),_0x9b72d3,_0x6595('0x22'));logger[_0x6595('0x23')](_0x6595('0x24'),_0x9b72d3,_0x6595('0x22'),JSON[_0x6595('0x25')](_0x1e5d24));if(_0x1e5d24['error']){if(_0x1e5d24['error'][_0x6595('0x26')]===0x1f4){logger[_0x6595('0x27')](_0x6595('0x21'),_0x9b72d3,_0x1e5d24[_0x6595('0x27')][_0x6595('0x28')]);return _0xbad2e7(_0x1e5d24[_0x6595('0x27')][_0x6595('0x28')]);}logger[_0x6595('0x27')](_0x6595('0x21'),_0x9b72d3,_0x1e5d24[_0x6595('0x27')][_0x6595('0x28')]);return _0x4b8516(_0x1e5d24[_0x6595('0x27')][_0x6595('0x28')]);}else{logger[_0x6595('0x29')](_0x6595('0x21'),_0x9b72d3,_0x6595('0x22'));_0x4b8516(_0x1e5d24[_0x6595('0x2a')][_0x6595('0x28')]);}})[_0x6595('0x2b')](function(_0x35c560){logger[_0x6595('0x27')](_0x6595('0x21'),_0x9b72d3,_0x35c560);_0xbad2e7(_0x35c560);});});}function respondWithStatusCode(_0x53b0a6,_0x379c6c){_0x379c6c=_0x379c6c||0xcc;return function(_0x4178d9){if(_0x4178d9){return _0x53b0a6[_0x6595('0x2c')](_0x379c6c);}return _0x53b0a6[_0x6595('0x2d')](_0x379c6c)[_0x6595('0x2e')]();};}function respondWithResult(_0xbc9750,_0x4247b3){_0x4247b3=_0x4247b3||0xc8;return function(_0x2c3336){if(_0x2c3336){return _0xbc9750['status'](_0x4247b3)[_0x6595('0x2f')](_0x2c3336);}};}function respondWithFilteredResult(_0x5d47ee,_0x313f03){return function(_0x494f32){if(_0x494f32){var _0x315ace=typeof _0x313f03['offset']===_0x6595('0x30')&&typeof _0x313f03['limit']===_0x6595('0x30');var _0x37311d=_0x494f32[_0x6595('0x31')];var _0x15f0a8=_0x315ace?0x0:_0x313f03[_0x6595('0x32')];var _0x32afa8=_0x315ace?_0x494f32['count']:_0x313f03[_0x6595('0x32')]+_0x313f03[_0x6595('0x33')];var _0x542bc9;if(_0x32afa8>=_0x37311d){_0x32afa8=_0x37311d;_0x542bc9=0xc8;}else{_0x542bc9=0xce;}_0x5d47ee[_0x6595('0x2d')](_0x542bc9);return _0x5d47ee[_0x6595('0x34')]('Content-Range',_0x15f0a8+'-'+_0x32afa8+'/'+_0x37311d)[_0x6595('0x2f')](_0x494f32);}return null;};}function patchUpdates(_0x3405e4){return function(_0x3b2b22){try{jsonpatch[_0x6595('0x35')](_0x3b2b22,_0x3405e4,!![]);}catch(_0x285692){return BPromise['reject'](_0x285692);}return _0x3b2b22[_0x6595('0x36')]();};}function saveUpdates(_0x5e59b9,_0x1f3525){return function(_0x2bf51e){if(_0x2bf51e){return _0x2bf51e['update'](_0x5e59b9)[_0x6595('0x20')](function(_0x468809){return _0x468809;});}return null;};}function removeEntity(_0x1d2da8,_0xb7307c){return function(_0x345aab){if(_0x345aab){return _0x345aab['destroy']()[_0x6595('0x20')](function(){_0x1d2da8[_0x6595('0x2d')](0xcc)[_0x6595('0x2e')]();});}};}function handleEntityNotFound(_0x36ffdb,_0x9cf8a5){return function(_0x5954f5){if(!_0x5954f5){_0x36ffdb[_0x6595('0x2c')](0x194);}return _0x5954f5;};}function handleError(_0x38411a,_0x4e435a){_0x4e435a=_0x4e435a||0x1f4;return function(_0x4f0a0b){logger[_0x6595('0x27')](_0x4f0a0b['stack']);if(_0x4f0a0b[_0x6595('0x37')]){delete _0x4f0a0b[_0x6595('0x37')];}_0x38411a[_0x6595('0x2d')](_0x4e435a)[_0x6595('0x38')](_0x4f0a0b);};}exports['index']=function(_0x4c2e1c,_0x1d5326){var _0x2bb7b5={},_0x26565f={},_0x4acb5d={'count':0x0,'rows':[]};var _0x524bf0=_[_0x6595('0x39')](db[_0x6595('0x3a')][_0x6595('0x3b')],function(_0x3956ae){return{'name':_0x3956ae['fieldName'],'type':_0x3956ae[_0x6595('0x3c')][_0x6595('0x3d')]};});_0x26565f['model']=_[_0x6595('0x39')](_0x524bf0,_0x6595('0x37'));_0x26565f['query']=_[_0x6595('0x3e')](_0x4c2e1c[_0x6595('0x3f')]);_0x26565f[_0x6595('0x40')]=_[_0x6595('0x41')](_0x26565f[_0x6595('0x42')],_0x26565f['query']);_0x2bb7b5[_0x6595('0x43')]=_[_0x6595('0x41')](_0x26565f[_0x6595('0x42')],qs[_0x6595('0x44')](_0x4c2e1c[_0x6595('0x3f')]['fields']));_0x2bb7b5[_0x6595('0x43')]=_0x2bb7b5['attributes'][_0x6595('0x45')]?_0x2bb7b5[_0x6595('0x43')]:_0x26565f[_0x6595('0x42')];if(!_0x4c2e1c[_0x6595('0x3f')]['hasOwnProperty'](_0x6595('0x46'))){_0x2bb7b5['limit']=qs[_0x6595('0x33')](_0x4c2e1c[_0x6595('0x3f')][_0x6595('0x33')]);_0x2bb7b5[_0x6595('0x32')]=qs[_0x6595('0x32')](_0x4c2e1c[_0x6595('0x3f')][_0x6595('0x32')]);}_0x2bb7b5[_0x6595('0x47')]=qs[_0x6595('0x48')](_0x4c2e1c['query'][_0x6595('0x48')]);_0x2bb7b5[_0x6595('0x49')]=qs[_0x6595('0x40')](_[_0x6595('0x4a')](_0x4c2e1c[_0x6595('0x3f')],_0x26565f[_0x6595('0x40')]),_0x524bf0);if(_0x4c2e1c[_0x6595('0x3f')]['filter']){_0x2bb7b5[_0x6595('0x49')]=_[_0x6595('0x4b')](_0x2bb7b5[_0x6595('0x49')],{'$or':_['map'](_0x524bf0,function(_0x324492){if(_0x324492[_0x6595('0x3c')]!==_0x6595('0x4c')){var _0x3c00d4={};_0x3c00d4[_0x324492[_0x6595('0x37')]]={'$like':'%'+_0x4c2e1c[_0x6595('0x3f')][_0x6595('0x4d')]+'%'};return _0x3c00d4;}})});}_0x2bb7b5=_[_0x6595('0x4b')]({},_0x2bb7b5,_0x4c2e1c[_0x6595('0x4e')]);var _0x26d10c={'where':_0x2bb7b5[_0x6595('0x49')]};return db[_0x6595('0x3a')][_0x6595('0x31')](_0x26d10c)[_0x6595('0x20')](function(_0x4c024f){_0x4acb5d[_0x6595('0x31')]=_0x4c024f;if(_0x4c2e1c[_0x6595('0x3f')][_0x6595('0x4f')]){_0x2bb7b5[_0x6595('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x2bb7b5);})['then'](function(_0x56fff9){_0x4acb5d[_0x6595('0x51')]=_0x56fff9;return _0x4acb5d;})['then'](respondWithFilteredResult(_0x1d5326,_0x2bb7b5))['catch'](handleError(_0x1d5326,null));};exports[_0x6595('0x52')]=function(_0x2df245,_0x1e8c58){var _0x56c7da={'raw':!![],'where':{'id':_0x2df245[_0x6595('0x53')]['id']}},_0x19d77a={};_0x19d77a['model']=_[_0x6595('0x3e')](db['OpenchannelMessage'][_0x6595('0x3b')]);_0x19d77a['query']=_['keys'](_0x2df245[_0x6595('0x3f')]);_0x19d77a['filters']=_['intersection'](_0x19d77a[_0x6595('0x42')],_0x19d77a['query']);_0x56c7da[_0x6595('0x43')]=_[_0x6595('0x41')](_0x19d77a[_0x6595('0x42')],qs[_0x6595('0x44')](_0x2df245[_0x6595('0x3f')][_0x6595('0x44')]));_0x56c7da[_0x6595('0x43')]=_0x56c7da[_0x6595('0x43')][_0x6595('0x45')]?_0x56c7da[_0x6595('0x43')]:_0x19d77a[_0x6595('0x42')];if(_0x2df245[_0x6595('0x3f')][_0x6595('0x4f')]){_0x56c7da[_0x6595('0x50')]=[{'all':!![]}];}_0x56c7da=_[_0x6595('0x4b')]({},_0x56c7da,_0x2df245[_0x6595('0x4e')]);return db[_0x6595('0x3a')][_0x6595('0x54')](_0x56c7da)[_0x6595('0x20')](handleEntityNotFound(_0x1e8c58,null))[_0x6595('0x20')](respondWithResult(_0x1e8c58,null))[_0x6595('0x2b')](handleError(_0x1e8c58,null));};exports[_0x6595('0x55')]=function(_0x4ac660,_0xa11678){return db[_0x6595('0x3a')][_0x6595('0x55')](_0x4ac660[_0x6595('0x56')],{})[_0x6595('0x20')](respondWithResult(_0xa11678,0xc9))[_0x6595('0x2b')](handleError(_0xa11678,null));};exports[_0x6595('0x57')]=function(_0x9c422e,_0x1681b1){if(_0x9c422e['body']['id']){delete _0x9c422e['body']['id'];}return db[_0x6595('0x3a')][_0x6595('0x54')]({'where':{'id':_0x9c422e['params']['id']}})[_0x6595('0x20')](handleEntityNotFound(_0x1681b1,null))[_0x6595('0x20')](saveUpdates(_0x9c422e['body'],null))[_0x6595('0x20')](respondWithResult(_0x1681b1,null))[_0x6595('0x2b')](handleError(_0x1681b1,null));};exports[_0x6595('0x58')]=function(_0x48f674,_0xb28f76){return db[_0x6595('0x3a')][_0x6595('0x54')]({'where':{'id':_0x48f674[_0x6595('0x53')]['id']}})[_0x6595('0x20')](handleEntityNotFound(_0xb28f76,null))['then'](removeEntity(_0xb28f76,null))[_0x6595('0x2b')](handleError(_0xb28f76,null));};exports[_0x6595('0x59')]=function(_0x1a302a,_0x4f73f){return db[_0x6595('0x3a')][_0x6595('0x59')]()[_0x6595('0x20')](respondWithResult(_0x4f73f,null))[_0x6595('0x2b')](handleError(_0x4f73f,null));};var interaction_log=require(_0x6595('0x14'))(_0x6595('0x5a'));exports[_0x6595('0x5b')]=function(_0x15d332,_0x45dad9,_0x18daf8){var _0x314fc5={'agent':{},'channel':_0x6595('0x5c')};if(_0x15d332['body']['id']){delete _0x15d332[_0x6595('0x56')]['id'];}_0x15d332[_0x6595('0x56')]['read']=!![];_0x15d332[_0x6595('0x56')]['readAt']=moment()[_0x6595('0x5d')](_0x6595('0x5e'));_0x15d332['body']['UserId']=_0x15d332['body'][_0x6595('0x5f')]||_0x15d332['user']['id'];_0x314fc5[_0x6595('0x60')]['id']=_0x15d332[_0x6595('0x56')][_0x6595('0x5f')];return db['OpenchannelMessage'][_0x6595('0x54')]({'where':{'id':_0x15d332['params']['id'],'UserId':null}})[_0x6595('0x20')](handleEntityNotFound(_0x45dad9,null))[_0x6595('0x20')](saveUpdates(_0x15d332[_0x6595('0x56')],null))[_0x6595('0x20')](function(_0x5836f1){if(_0x5836f1){_0x314fc5[_0x6595('0x28')]=_0x5836f1[_0x6595('0x61')]({'plain':!![]});return db[_0x6595('0x62')][_0x6595('0x54')]({'where':{'id':_0x5836f1[_0x6595('0x63')]}});}return null;})[_0x6595('0x20')](handleEntityNotFound(_0x45dad9,null))[_0x6595('0x20')](function(_0x4950ad){if(_0x4950ad){return _0x4950ad['update']({'UserId':_0x15d332[_0x6595('0x56')][_0x6595('0x5f')],'read1stAt':_['isNil'](_0x4950ad['read1stAt'])?moment()[_0x6595('0x5d')](_0x6595('0x5e')):undefined});}return null;})[_0x6595('0x20')](function(_0x1d35af){if(_0x1d35af){_0x314fc5[_0x6595('0x64')]=_0x1d35af[_0x6595('0x61')]({'plain':!![]});interaction_log[_0x6595('0x29')](_0x6595('0x65'),_0x15d332[_0x6595('0x66')]['id'],_0x15d332[_0x6595('0x66')]['name'],_0x15d332[_0x6595('0x66')]['role'],_0x314fc5[_0x6595('0x64')]['id'],_0x15d332[_0x6595('0x56')]?JSON[_0x6595('0x25')](_0x15d332['body']):_0x6595('0x67'));return respondWithRpcPromise(_0x6595('0x68'),_0x6595('0x69'),_0x314fc5);}return null;})[_0x6595('0x20')](function(_0x22ac01){var _0x14b21e=_0x6595('0x6a')+_0x22ac01[_0x6595('0x28')][_0x6595('0x6b')];return db['sequelize'][_0x6595('0x3f')](_0x14b21e,{'type':db[_0x6595('0x6c')]['QueryTypes'][_0x6595('0x6d')],'raw':!![]})['then'](function(_0x485588){return _0x485588;});})[_0x6595('0x20')](function(_0x4fd6e1){if(_0x4fd6e1){_0x314fc5[_0x6595('0x28')][_0x6595('0x6e')]=_0x4fd6e1[0x0];if(!_0x15d332['body'][_0x6595('0x5f')])return;return db[_0x6595('0x6f')][_0x6595('0x54')]({'where':{'id':_0x15d332['body'][_0x6595('0x5f')],'role':_0x6595('0x60')},'attributes':['id',_0x6595('0x37'),_0x6595('0x70'),_0x6595('0x71'),_0x6595('0x72')],'raw':!![]});}return null;})[_0x6595('0x20')](function(_0x3cd2c7){if(!_0x3cd2c7)return null;_0x314fc5[_0x6595('0x28')][_0x6595('0x60')]=_0x3cd2c7;return _0x314fc5;})[_0x6595('0x20')](function(_0x222a61){if(_0x222a61){if(_0x15d332[_0x6595('0x56')][_0x6595('0x73')]){_0x314fc5[_0x6595('0x28')]['interface']=util[_0x6595('0x5d')](_0x6595('0x74'),_0x15d332['user'][_0x6595('0x37')]);_0x314fc5['message'][_0x6595('0x75')]=_0x314fc5[_0x6595('0x75')];_0x314fc5[_0x6595('0x28')][_0x6595('0x76')]=_0x314fc5[_0x6595('0x75')];_0x314fc5['message'][_0x6595('0x77')]=_0x6595('0x5b');return respondWithRpcPromise(_0x6595('0x78'),_0x6595('0x78'),{'event':'acceptmessage','message':_0x314fc5['message']},client9002)[_0x6595('0x20')](function(){return _0x314fc5;});}return _0x314fc5;}return null;})[_0x6595('0x20')](respondWithResult(_0x45dad9,null))[_0x6595('0x2b')](handleError(_0x45dad9,null));};var interaction_log=require('../../config/logger')(_0x6595('0x5a'));exports[_0x6595('0x79')]=function(_0x5ec4a7,_0xde59a4,_0x272f73){var _0x179bbb={'agent':{},'channel':_0x6595('0x5c')};if(_0x5ec4a7[_0x6595('0x56')]['id']){delete _0x5ec4a7['body']['id'];}_0x5ec4a7[_0x6595('0x56')][_0x6595('0x5f')]=_0x5ec4a7[_0x6595('0x56')]['UserId']||_0x5ec4a7['user']['id'];_0x179bbb['agent']['id']=_0x5ec4a7['body'][_0x6595('0x5f')];return db[_0x6595('0x3a')][_0x6595('0x54')]({'where':{'id':_0x5ec4a7[_0x6595('0x53')]['id'],'UserId':null}})[_0x6595('0x20')](handleEntityNotFound(_0xde59a4,null))[_0x6595('0x20')](function(_0x43bd4c){if(_0x43bd4c){_0x179bbb[_0x6595('0x28')]=_0x43bd4c[_0x6595('0x61')]({'plain':!![]});return db[_0x6595('0x62')][_0x6595('0x54')]({'where':{'id':_0x43bd4c[_0x6595('0x63')]}});}return null;})['then'](handleEntityNotFound(_0xde59a4,null))[_0x6595('0x20')](function(_0x55e81f){if(_0x55e81f){_0x179bbb[_0x6595('0x64')]=_0x55e81f['get']({'plain':!![]});interaction_log['info'](_0x6595('0x7a'),_0x5ec4a7[_0x6595('0x66')]['id'],_0x5ec4a7[_0x6595('0x66')][_0x6595('0x37')],_0x5ec4a7[_0x6595('0x66')][_0x6595('0x7b')],_0x179bbb[_0x6595('0x64')]['id'],_0x5ec4a7[_0x6595('0x56')]?JSON['stringify'](_0x5ec4a7[_0x6595('0x56')]):_0x6595('0x67'));return respondWithRpcPromise(_0x6595('0x7c'),_0x6595('0x7d'),_0x179bbb);}return null;})[_0x6595('0x20')](function(_0x236d2a){var _0x25df73=_0x6595('0x6a')+_0x236d2a[_0x6595('0x28')][_0x6595('0x6b')];return db[_0x6595('0x7e')][_0x6595('0x3f')](_0x25df73,{'type':db[_0x6595('0x6c')][_0x6595('0x7f')][_0x6595('0x6d')],'raw':!![]})[_0x6595('0x20')](function(_0x3c8c16){return _0x3c8c16;});})[_0x6595('0x20')](function(_0x23ed2a){if(_0x23ed2a){_0x179bbb[_0x6595('0x28')][_0x6595('0x6e')]=_0x23ed2a[0x0];if(!_0x5ec4a7[_0x6595('0x56')][_0x6595('0x5f')])return;return db[_0x6595('0x6f')][_0x6595('0x54')]({'where':{'id':_0x5ec4a7[_0x6595('0x56')]['UserId'],'role':_0x6595('0x60')},'attributes':['id',_0x6595('0x37'),_0x6595('0x70'),_0x6595('0x71'),'internal'],'raw':!![]});}return null;})[_0x6595('0x20')](function(_0x229b1f){if(!_0x229b1f)return null;_0x179bbb[_0x6595('0x28')]['agent']=_0x229b1f;return _0x179bbb;})[_0x6595('0x20')](function(_0x40ba7b){if(_0x40ba7b){_0x40ba7b[_0x6595('0x28')][_0x6595('0x80')]=util['format'](_0x6595('0x74'),_0x5ec4a7[_0x6595('0x66')]['name']);_0x40ba7b[_0x6595('0x28')][_0x6595('0x75')]=_0x179bbb[_0x6595('0x75')];_0x40ba7b[_0x6595('0x28')][_0x6595('0x76')]=_0x179bbb[_0x6595('0x75')];_0x40ba7b['message'][_0x6595('0x77')]='reject';respondWithRpcPromise('EventManager',_0x6595('0x78'),{'event':_0x6595('0x81'),'message':_0x40ba7b[_0x6595('0x28')]},client9002);return _0x179bbb;}return null;})[_0x6595('0x20')](respondWithResult(_0xde59a4,null))[_0x6595('0x2b')](handleError(_0xde59a4,null));}; \ No newline at end of file +var _0xbc0a=['undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','type','key','query','attributes','intersection','model','hasOwnProperty','offset','order','sort','filters','where','merge','filter','options','include','findAll','rows','catch','show','params','keys','fields','length','includeAll','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','OpenchannelInteractionId','update','isNil','read1stAt','interaction','get','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel-interactions','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','internal','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','end','status'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xbc0a,0x1de));var _0xabc0=function(_0x99503e,_0x4ddfec){_0x99503e=_0x99503e-0x0;var _0x48193e=_0xbc0a[_0x99503e];return _0x48193e;};'use strict';var emlformat=require(_0xabc0('0x0'));var rimraf=require(_0xabc0('0x1'));var zipdir=require(_0xabc0('0x2'));var jsonpatch=require(_0xabc0('0x3'));var rp=require('request-promise');var moment=require(_0xabc0('0x4'));var BPromise=require(_0xabc0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xabc0('0x6'));var sox=require(_0xabc0('0x7'));var csv=require(_0xabc0('0x8'));var ejs=require(_0xabc0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xabc0('0xa'));var squel=require(_0xabc0('0xb'));var crypto=require('crypto');var jsforce=require(_0xabc0('0xc'));var deskjs=require(_0xabc0('0xd'));var toCsv=require(_0xabc0('0x8'));var querystring=require(_0xabc0('0xe'));var Papa=require(_0xabc0('0xf'));var Redis=require('ioredis');var authService=require(_0xabc0('0x10'));var qs=require(_0xabc0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabc0('0x12'));var logger=require(_0xabc0('0x13'))(_0xabc0('0x14'));var utils=require(_0xabc0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xabc0('0x16'));var db=require(_0xabc0('0x17'))['db'];config[_0xabc0('0x18')]=_[_0xabc0('0x19')](config['redis'],{'host':_0xabc0('0x1a'),'port':0x18eb});var socket=require(_0xabc0('0x1b'))(new Redis(config[_0xabc0('0x18')]));require('./openchannelMessage.socket')[_0xabc0('0x1c')](socket);var jayson=require(_0xabc0('0x1d'));var client=jayson[_0xabc0('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0xabc0('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x361d10,_0x8c14a1,_0x400ec7,_0x1bca24){return new BPromise(function(_0x5151af,_0x1bbc0f){var _0x2eec87=_0x1bca24||client;return _0x2eec87[_0xabc0('0x20')](_0x361d10,_0x400ec7)[_0xabc0('0x21')](function(_0x301cb6){logger['info'](_0xabc0('0x22'),_0x8c14a1,_0xabc0('0x23'));logger[_0xabc0('0x24')](_0xabc0('0x25'),_0x8c14a1,'request\x20sent',JSON[_0xabc0('0x26')](_0x301cb6));if(_0x301cb6[_0xabc0('0x27')]){if(_0x301cb6[_0xabc0('0x27')][_0xabc0('0x28')]===0x1f4){logger[_0xabc0('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x8c14a1,_0x301cb6[_0xabc0('0x27')][_0xabc0('0x29')]);return _0x1bbc0f(_0x301cb6['error'][_0xabc0('0x29')]);}logger[_0xabc0('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x8c14a1,_0x301cb6[_0xabc0('0x27')][_0xabc0('0x29')]);return _0x5151af(_0x301cb6[_0xabc0('0x27')][_0xabc0('0x29')]);}else{logger[_0xabc0('0x2a')]('OpenchannelMessage,\x20%s,\x20%s',_0x8c14a1,'request\x20sent');_0x5151af(_0x301cb6['result'][_0xabc0('0x29')]);}})['catch'](function(_0x27d91a){logger[_0xabc0('0x27')](_0xabc0('0x22'),_0x8c14a1,_0x27d91a);_0x1bbc0f(_0x27d91a);});});}function respondWithStatusCode(_0x490d99,_0x20b091){_0x20b091=_0x20b091||0xcc;return function(_0x176ea1){if(_0x176ea1){return _0x490d99[_0xabc0('0x2b')](_0x20b091);}return _0x490d99['status'](_0x20b091)[_0xabc0('0x2c')]();};}function respondWithResult(_0x4aaa5d,_0x1bacd3){_0x1bacd3=_0x1bacd3||0xc8;return function(_0x589ddc){if(_0x589ddc){return _0x4aaa5d[_0xabc0('0x2d')](_0x1bacd3)['json'](_0x589ddc);}};}function respondWithFilteredResult(_0x3da559,_0x2e2461){return function(_0x4979e5){if(_0x4979e5){var _0x3fb79a=typeof _0x2e2461['offset']===_0xabc0('0x2e')&&typeof _0x2e2461[_0xabc0('0x2f')]===_0xabc0('0x2e');var _0x564db2=_0x4979e5['count'];var _0x5b91c1=_0x3fb79a?0x0:_0x2e2461['offset'];var _0x446964=_0x3fb79a?_0x4979e5[_0xabc0('0x30')]:_0x2e2461['offset']+_0x2e2461[_0xabc0('0x2f')];var _0x2eb6d9;if(_0x446964>=_0x564db2){_0x446964=_0x564db2;_0x2eb6d9=0xc8;}else{_0x2eb6d9=0xce;}_0x3da559['status'](_0x2eb6d9);return _0x3da559[_0xabc0('0x31')](_0xabc0('0x32'),_0x5b91c1+'-'+_0x446964+'/'+_0x564db2)[_0xabc0('0x33')](_0x4979e5);}return null;};}function patchUpdates(_0x151c5e){return function(_0x575bbc){try{jsonpatch[_0xabc0('0x34')](_0x575bbc,_0x151c5e,!![]);}catch(_0x12c7d8){return BPromise[_0xabc0('0x35')](_0x12c7d8);}return _0x575bbc[_0xabc0('0x36')]();};}function saveUpdates(_0x24590a,_0x30a271){return function(_0xb2ba87){if(_0xb2ba87){return _0xb2ba87['update'](_0x24590a)['then'](function(_0x32fe24){return _0x32fe24;});}return null;};}function removeEntity(_0xd91fb7,_0x1b1069){return function(_0x12db61){if(_0x12db61){return _0x12db61[_0xabc0('0x37')]()[_0xabc0('0x21')](function(){_0xd91fb7['status'](0xcc)[_0xabc0('0x2c')]();});}};}function handleEntityNotFound(_0x32c6d8,_0x159f0d){return function(_0x23a464){if(!_0x23a464){_0x32c6d8['sendStatus'](0x194);}return _0x23a464;};}function handleError(_0x428a31,_0x22bc5f){_0x22bc5f=_0x22bc5f||0x1f4;return function(_0x39455c){logger[_0xabc0('0x27')](_0x39455c['stack']);if(_0x39455c[_0xabc0('0x38')]){delete _0x39455c[_0xabc0('0x38')];}_0x428a31[_0xabc0('0x2d')](_0x22bc5f)[_0xabc0('0x39')](_0x39455c);};}exports[_0xabc0('0x3a')]=function(_0x105b55,_0x3dc1a1){var _0x1d3511={},_0x456ea3={},_0x49019e={'count':0x0,'rows':[]};var _0x1349c6=_[_0xabc0('0x3b')](db[_0xabc0('0x3c')][_0xabc0('0x3d')],function(_0x110a23){return{'name':_0x110a23['fieldName'],'type':_0x110a23[_0xabc0('0x3e')][_0xabc0('0x3f')]};});_0x456ea3['model']=_['map'](_0x1349c6,_0xabc0('0x38'));_0x456ea3[_0xabc0('0x40')]=_['keys'](_0x105b55[_0xabc0('0x40')]);_0x456ea3['filters']=_['intersection'](_0x456ea3['model'],_0x456ea3['query']);_0x1d3511[_0xabc0('0x41')]=_[_0xabc0('0x42')](_0x456ea3[_0xabc0('0x43')],qs['fields'](_0x105b55[_0xabc0('0x40')]['fields']));_0x1d3511[_0xabc0('0x41')]=_0x1d3511[_0xabc0('0x41')]['length']?_0x1d3511[_0xabc0('0x41')]:_0x456ea3['model'];if(!_0x105b55[_0xabc0('0x40')][_0xabc0('0x44')]('nolimit')){_0x1d3511['limit']=qs[_0xabc0('0x2f')](_0x105b55['query']['limit']);_0x1d3511['offset']=qs[_0xabc0('0x45')](_0x105b55['query'][_0xabc0('0x45')]);}_0x1d3511[_0xabc0('0x46')]=qs[_0xabc0('0x47')](_0x105b55[_0xabc0('0x40')][_0xabc0('0x47')]);_0x1d3511['where']=qs[_0xabc0('0x48')](_['pick'](_0x105b55[_0xabc0('0x40')],_0x456ea3[_0xabc0('0x48')]),_0x1349c6);if(_0x105b55[_0xabc0('0x40')]['filter']){_0x1d3511[_0xabc0('0x49')]=_[_0xabc0('0x4a')](_0x1d3511['where'],{'$or':_[_0xabc0('0x3b')](_0x1349c6,function(_0x5da22a){if(_0x5da22a[_0xabc0('0x3e')]!=='VIRTUAL'){var _0x3cf39c={};_0x3cf39c[_0x5da22a['name']]={'$like':'%'+_0x105b55[_0xabc0('0x40')][_0xabc0('0x4b')]+'%'};return _0x3cf39c;}})});}_0x1d3511=_[_0xabc0('0x4a')]({},_0x1d3511,_0x105b55[_0xabc0('0x4c')]);var _0x546517={'where':_0x1d3511[_0xabc0('0x49')]};return db[_0xabc0('0x3c')]['count'](_0x546517)['then'](function(_0x152f32){_0x49019e['count']=_0x152f32;if(_0x105b55['query']['includeAll']){_0x1d3511[_0xabc0('0x4d')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xabc0('0x4e')](_0x1d3511);})[_0xabc0('0x21')](function(_0x3c6a6d){_0x49019e[_0xabc0('0x4f')]=_0x3c6a6d;return _0x49019e;})['then'](respondWithFilteredResult(_0x3dc1a1,_0x1d3511))[_0xabc0('0x50')](handleError(_0x3dc1a1,null));};exports[_0xabc0('0x51')]=function(_0x563147,_0x22f43d){var _0x2d642a={'raw':!![],'where':{'id':_0x563147[_0xabc0('0x52')]['id']}},_0x11cde2={};_0x11cde2[_0xabc0('0x43')]=_[_0xabc0('0x53')](db[_0xabc0('0x3c')][_0xabc0('0x3d')]);_0x11cde2[_0xabc0('0x40')]=_[_0xabc0('0x53')](_0x563147[_0xabc0('0x40')]);_0x11cde2[_0xabc0('0x48')]=_[_0xabc0('0x42')](_0x11cde2[_0xabc0('0x43')],_0x11cde2[_0xabc0('0x40')]);_0x2d642a[_0xabc0('0x41')]=_[_0xabc0('0x42')](_0x11cde2['model'],qs[_0xabc0('0x54')](_0x563147[_0xabc0('0x40')][_0xabc0('0x54')]));_0x2d642a[_0xabc0('0x41')]=_0x2d642a[_0xabc0('0x41')][_0xabc0('0x55')]?_0x2d642a[_0xabc0('0x41')]:_0x11cde2['model'];if(_0x563147['query'][_0xabc0('0x56')]){_0x2d642a[_0xabc0('0x4d')]=[{'all':!![]}];}_0x2d642a=_[_0xabc0('0x4a')]({},_0x2d642a,_0x563147['options']);return db[_0xabc0('0x3c')][_0xabc0('0x57')](_0x2d642a)[_0xabc0('0x21')](handleEntityNotFound(_0x22f43d,null))['then'](respondWithResult(_0x22f43d,null))[_0xabc0('0x50')](handleError(_0x22f43d,null));};exports[_0xabc0('0x58')]=function(_0x25551e,_0x538e70){return db['OpenchannelMessage'][_0xabc0('0x58')](_0x25551e[_0xabc0('0x59')],{})[_0xabc0('0x21')](respondWithResult(_0x538e70,0xc9))[_0xabc0('0x50')](handleError(_0x538e70,null));};exports['update']=function(_0x47a8c4,_0x21d8d0){if(_0x47a8c4[_0xabc0('0x59')]['id']){delete _0x47a8c4[_0xabc0('0x59')]['id'];}return db['OpenchannelMessage'][_0xabc0('0x57')]({'where':{'id':_0x47a8c4[_0xabc0('0x52')]['id']}})[_0xabc0('0x21')](handleEntityNotFound(_0x21d8d0,null))[_0xabc0('0x21')](saveUpdates(_0x47a8c4[_0xabc0('0x59')],null))[_0xabc0('0x21')](respondWithResult(_0x21d8d0,null))[_0xabc0('0x50')](handleError(_0x21d8d0,null));};exports['destroy']=function(_0x315b1e,_0x2c1e6e){return db[_0xabc0('0x3c')][_0xabc0('0x57')]({'where':{'id':_0x315b1e[_0xabc0('0x52')]['id']}})[_0xabc0('0x21')](handleEntityNotFound(_0x2c1e6e,null))[_0xabc0('0x21')](removeEntity(_0x2c1e6e,null))[_0xabc0('0x50')](handleError(_0x2c1e6e,null));};exports[_0xabc0('0x5a')]=function(_0x161bd6,_0x1bae84){return db[_0xabc0('0x3c')][_0xabc0('0x5a')]()[_0xabc0('0x21')](respondWithResult(_0x1bae84,null))[_0xabc0('0x50')](handleError(_0x1bae84,null));};var interaction_log=require(_0xabc0('0x13'))('openchannel-interactions');exports[_0xabc0('0x5b')]=function(_0x44aefc,_0x262b61,_0x372812){var _0x118b6a={'agent':{},'channel':_0xabc0('0x5c')};if(_0x44aefc[_0xabc0('0x59')]['id']){delete _0x44aefc[_0xabc0('0x59')]['id'];}_0x44aefc[_0xabc0('0x59')][_0xabc0('0x5d')]=!![];_0x44aefc[_0xabc0('0x59')][_0xabc0('0x5e')]=moment()[_0xabc0('0x5f')](_0xabc0('0x60'));_0x44aefc[_0xabc0('0x59')]['UserId']=_0x44aefc[_0xabc0('0x59')][_0xabc0('0x61')]||_0x44aefc[_0xabc0('0x62')]['id'];_0x118b6a['agent']['id']=_0x44aefc['body'][_0xabc0('0x61')];return db[_0xabc0('0x3c')][_0xabc0('0x57')]({'where':{'id':_0x44aefc[_0xabc0('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x262b61,null))[_0xabc0('0x21')](saveUpdates(_0x44aefc['body'],null))['then'](function(_0x2599a3){if(_0x2599a3){_0x118b6a[_0xabc0('0x29')]=_0x2599a3['get']({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x2599a3[_0xabc0('0x63')]}});}return null;})[_0xabc0('0x21')](handleEntityNotFound(_0x262b61,null))[_0xabc0('0x21')](function(_0xab0e68){if(_0xab0e68){return _0xab0e68[_0xabc0('0x64')]({'UserId':_0x44aefc[_0xabc0('0x59')][_0xabc0('0x61')],'read1stAt':_[_0xabc0('0x65')](_0xab0e68[_0xabc0('0x66')])?moment()[_0xabc0('0x5f')](_0xabc0('0x60')):undefined});}return null;})[_0xabc0('0x21')](function(_0x3a291a){if(_0x3a291a){_0x118b6a[_0xabc0('0x67')]=_0x3a291a[_0xabc0('0x68')]({'plain':!![]});interaction_log[_0xabc0('0x2a')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44aefc[_0xabc0('0x62')]['id'],_0x44aefc[_0xabc0('0x62')][_0xabc0('0x38')],_0x44aefc[_0xabc0('0x62')][_0xabc0('0x69')],_0x118b6a[_0xabc0('0x67')]['id'],_0x44aefc['body']?JSON[_0xabc0('0x26')](_0x44aefc[_0xabc0('0x59')]):_0xabc0('0x6a'));return respondWithRpcPromise('AcceptMessage',_0xabc0('0x6b'),_0x118b6a);}return null;})[_0xabc0('0x21')](function(_0x4140a6){var _0x1406b4=_0xabc0('0x6c')+_0x4140a6['message'][_0xabc0('0x6d')];return db[_0xabc0('0x6e')][_0xabc0('0x40')](_0x1406b4,{'type':db[_0xabc0('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0xabc0('0x21')](function(_0x92612f){return _0x92612f;});})[_0xabc0('0x21')](function(_0x3f2250){if(_0x3f2250){_0x118b6a[_0xabc0('0x29')][_0xabc0('0x70')]=_0x3f2250[0x0];if(!_0x44aefc[_0xabc0('0x59')][_0xabc0('0x61')])return;return db['User'][_0xabc0('0x57')]({'where':{'id':_0x44aefc[_0xabc0('0x59')][_0xabc0('0x61')],'role':_0xabc0('0x71')},'attributes':['id',_0xabc0('0x38'),_0xabc0('0x72'),_0xabc0('0x73'),'internal'],'raw':!![]});}return null;})[_0xabc0('0x21')](function(_0x46975e){if(!_0x46975e)return null;_0x118b6a[_0xabc0('0x29')][_0xabc0('0x71')]=_0x46975e;return _0x118b6a;})[_0xabc0('0x21')](function(_0x22e9cc){if(_0x22e9cc){if(_0x44aefc[_0xabc0('0x59')][_0xabc0('0x74')]){_0x118b6a['message'][_0xabc0('0x75')]=util[_0xabc0('0x5f')](_0xabc0('0x76'),_0x44aefc[_0xabc0('0x62')][_0xabc0('0x38')]);_0x118b6a[_0xabc0('0x29')][_0xabc0('0x77')]=_0x118b6a[_0xabc0('0x77')];_0x118b6a[_0xabc0('0x29')][_0xabc0('0x78')]=_0x118b6a['channel'];_0x118b6a[_0xabc0('0x29')][_0xabc0('0x79')]='accept';return respondWithRpcPromise('EventManager',_0xabc0('0x7a'),{'event':_0xabc0('0x7b'),'message':_0x118b6a[_0xabc0('0x29')]},client9002)[_0xabc0('0x21')](function(){return _0x118b6a;});}return _0x118b6a;}return null;})[_0xabc0('0x21')](respondWithResult(_0x262b61,null))[_0xabc0('0x50')](handleError(_0x262b61,null));};var interaction_log=require('../../config/logger')(_0xabc0('0x7c'));exports[_0xabc0('0x35')]=function(_0x489f87,_0x492709,_0x3c07ac){var _0x31c94d={'agent':{},'channel':_0xabc0('0x5c')};if(_0x489f87[_0xabc0('0x59')]['id']){delete _0x489f87[_0xabc0('0x59')]['id'];}_0x489f87[_0xabc0('0x59')]['UserId']=_0x489f87[_0xabc0('0x59')][_0xabc0('0x61')]||_0x489f87[_0xabc0('0x62')]['id'];_0x31c94d[_0xabc0('0x71')]['id']=_0x489f87[_0xabc0('0x59')][_0xabc0('0x61')];return db['OpenchannelMessage'][_0xabc0('0x57')]({'where':{'id':_0x489f87[_0xabc0('0x52')]['id'],'UserId':null}})[_0xabc0('0x21')](handleEntityNotFound(_0x492709,null))[_0xabc0('0x21')](function(_0xa483d5){if(_0xa483d5){_0x31c94d[_0xabc0('0x29')]=_0xa483d5[_0xabc0('0x68')]({'plain':!![]});return db[_0xabc0('0x7d')][_0xabc0('0x57')]({'where':{'id':_0xa483d5[_0xabc0('0x63')]}});}return null;})[_0xabc0('0x21')](handleEntityNotFound(_0x492709,null))[_0xabc0('0x21')](function(_0x1cc4c9){if(_0x1cc4c9){_0x31c94d[_0xabc0('0x67')]=_0x1cc4c9['get']({'plain':!![]});interaction_log[_0xabc0('0x2a')](_0xabc0('0x7e'),_0x489f87[_0xabc0('0x62')]['id'],_0x489f87[_0xabc0('0x62')]['name'],_0x489f87[_0xabc0('0x62')][_0xabc0('0x69')],_0x31c94d[_0xabc0('0x67')]['id'],_0x489f87[_0xabc0('0x59')]?JSON[_0xabc0('0x26')](_0x489f87[_0xabc0('0x59')]):'null');return respondWithRpcPromise(_0xabc0('0x7f'),'rejectMessage',_0x31c94d);}return null;})['then'](function(_0x14d105){var _0x33b10d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x14d105['message']['ContactId'];return db[_0xabc0('0x6e')][_0xabc0('0x40')](_0x33b10d,{'type':db[_0xabc0('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x3e6bba){return _0x3e6bba;});})['then'](function(_0x3cc78c){if(_0x3cc78c){_0x31c94d[_0xabc0('0x29')]['contact']=_0x3cc78c[0x0];if(!_0x489f87[_0xabc0('0x59')][_0xabc0('0x61')])return;return db[_0xabc0('0x80')][_0xabc0('0x57')]({'where':{'id':_0x489f87[_0xabc0('0x59')][_0xabc0('0x61')],'role':_0xabc0('0x71')},'attributes':['id','name',_0xabc0('0x72'),_0xabc0('0x73'),_0xabc0('0x81')],'raw':!![]});}return null;})[_0xabc0('0x21')](function(_0x29d7fe){if(!_0x29d7fe)return null;_0x31c94d[_0xabc0('0x29')][_0xabc0('0x71')]=_0x29d7fe;return _0x31c94d;})[_0xabc0('0x21')](function(_0x5c55e){if(_0x5c55e){_0x5c55e['message'][_0xabc0('0x75')]=util[_0xabc0('0x5f')]('SIP/%s',_0x489f87['user'][_0xabc0('0x38')]);_0x5c55e[_0xabc0('0x29')][_0xabc0('0x77')]=_0x31c94d[_0xabc0('0x77')];_0x5c55e[_0xabc0('0x29')][_0xabc0('0x78')]=_0x31c94d['channel'];_0x5c55e[_0xabc0('0x29')]['event']=_0xabc0('0x35');respondWithRpcPromise(_0xabc0('0x7a'),'EventManager',{'event':_0xabc0('0x82'),'message':_0x5c55e[_0xabc0('0x29')]},client9002);return _0x31c94d;}return null;})['then'](respondWithResult(_0x492709,null))[_0xabc0('0x50')](handleError(_0x492709,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index e7e5820..62cfe63 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 _0x4030=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4030,0x189));var _0x0403=function(_0x297b8b,_0x10031d){_0x297b8b=_0x297b8b-0x0;var _0x4566e9=_0x4030[_0x297b8b];return _0x4566e9;};'use strict';var EventEmitter=require(_0x0403('0x0'));var OpenchannelMessage=require(_0x0403('0x1'))['db'][_0x0403('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0403('0x3')](0x0);var events={'afterCreate':_0x0403('0x4'),'afterUpdate':'update','afterDestroy':_0x0403('0x5')};function emitEvent(_0x54d6eb){return function(_0x427f0f,_0x52da94,_0x4cbaf3){OpenchannelMessageEvents['emit'](_0x54d6eb+':'+_0x427f0f['id'],_0x427f0f);OpenchannelMessageEvents[_0x0403('0x6')](_0x54d6eb,_0x427f0f);_0x4cbaf3(null);};}for(var e in events){if(events[_0x0403('0x7')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0403('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbf39=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x489c1d,_0x18048f){var _0x3e5e9d=function(_0x5438e4){while(--_0x5438e4){_0x489c1d['push'](_0x489c1d['shift']());}};_0x3e5e9d(++_0x18048f);}(_0xbf39,0x91));var _0x9bf3=function(_0x446624,_0x920dec){_0x446624=_0x446624-0x0;var _0x3deed4=_0xbf39[_0x446624];return _0x3deed4;};'use strict';var EventEmitter=require(_0x9bf3('0x0'));var OpenchannelMessage=require(_0x9bf3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9bf3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9bf3('0x3')};function emitEvent(_0x556ec9){return function(_0x2975df,_0x17e6d9,_0x4bdb76){OpenchannelMessageEvents[_0x9bf3('0x4')](_0x556ec9+':'+_0x2975df['id'],_0x2975df);OpenchannelMessageEvents[_0x9bf3('0x4')](_0x556ec9,_0x2975df);_0x4bdb76(null);};}for(var e in events){if(events[_0x9bf3('0x5')](e)){var event=events[e];OpenchannelMessage[_0x9bf3('0x6')](e,emitEvent(event));}}module[_0x9bf3('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9047d64..27aa148 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 _0x4fc2=['length','omit','Contact','POST','method','OpenchannelMessage,\x20%s,\x20%s','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','keys','info','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','replyUri'];(function(_0x4ed7,_0x14f3ba){var _0x584b32=function(_0x3203f4){while(--_0x3203f4){_0x4ed7['push'](_0x4ed7['shift']());}};_0x584b32(++_0x14f3ba);}(_0x4fc2,0x111));var _0x24fc=function(_0x486f6b,_0x7db838){_0x486f6b=_0x486f6b-0x0;var _0x45c03c=_0x4fc2[_0x486f6b];return _0x45c03c;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[{'name':_0x24fc('0xb'),'fields':[_0x24fc('0xc')],'type':_0x24fc('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x47349b,_0x5afdf1,_0x44caca){var _0x1819a5=_0x26fcc6[_0x24fc('0xe')];var _0x133438=_0x47349b[_0x24fc('0xf')]({'plain':!![]});if(_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()==='in'||_0x133438[_0x24fc('0x10')]['toLowerCase']()===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]&&!_['isNil'](_0x133438[_0x24fc('0x14')])){_0x1819a5[_0x24fc('0x15')][_0x24fc('0x16')]({'where':{'id':_0x133438[_0x24fc('0x17')]}})[_0x24fc('0x18')](function(_0x326276){if(_0x326276){_0x326276['update']({'lastMsgAt':_0x133438[_0x24fc('0x19')],'lastMsgDirection':_0x133438[_0x24fc('0x10')][_0x24fc('0x11')]()});}})[_0x24fc('0x1a')](function(_0x4acd36){console[_0x24fc('0x1b')](_0x4acd36);});}if(_0x133438['direction']===_0x24fc('0x12')&&!_0x133438[_0x24fc('0x13')]){var _0x218fb6;_0x1819a5[_0x24fc('0x1c')][_0x24fc('0x1d')]()['then'](function(_0x23873c){return _0x1819a5[_0x24fc('0x1e')][_0x24fc('0x1f')]({'where':{'id':_0x133438[_0x24fc('0x20')]},'include':[{'model':_0x1819a5['OpenchannelInteraction'],'as':_0x24fc('0x21'),'where':{'id':_0x133438[_0x24fc('0x17')]},'limit':0x1,'include':[{'model':_0x1819a5[_0x24fc('0x1c')],'as':'Contact','attributes':_[_0x24fc('0x22')](_0x23873c)}]}]});})[_0x24fc('0x18')](function(_0xbf1d6b){_0x218fb6=_0xbf1d6b[_0x24fc('0xf')]({'plain':!![]});if(_0x218fb6&&_0x218fb6['replyUri']){logger[_0x24fc('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x24fc('0x24'),util['format'](_0x24fc('0x25'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x218fb6[_0x24fc('0x21')]&&_0x218fb6['Interactions'][_0x24fc('0x27')]){_0x133438['Interaction']=_[_0x24fc('0x28')](_0x218fb6[_0x24fc('0x21')][0x0],_0x24fc('0x29'));_0x133438[_0x24fc('0x29')]=_0x218fb6[_0x24fc('0x21')][0x0][_0x24fc('0x29')];}var _0x5afdf1={'method':_0x24fc('0x2a'),'uri':encodeURI(_0x218fb6[_0x24fc('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5afdf1[_0x24fc('0x2b')]){case'GET':_0x5afdf1['qs']=_0x133438;break;case _0x24fc('0x2a'):_0x5afdf1[_0x24fc('0xc')]=_0x133438;break;}return rp(_0x5afdf1)[_0x24fc('0x18')](function(_0x5bb4c8){logger[_0x24fc('0x23')](_0x24fc('0x2c'),_0x24fc('0x24'),util[_0x24fc('0x2d')](_0x24fc('0x2e'),_0x133438['id'],_0x218fb6[_0x24fc('0x26')]));if(_0x5bb4c8['body'][_0x24fc('0x2f')]&&_0x5bb4c8[_0x24fc('0xc')][_0x24fc('0x2f')]!=_0x133438[_0x24fc('0x30')][_0x24fc('0x2f')]){return _0x1819a5['OpenchannelInteraction']['update']({'threadId':_0x5bb4c8['body'][_0x24fc('0x2f')]},{'logging':!![],'where':{'id':_0x133438['Interaction']['id']}});}else{return;}})[_0x24fc('0x18')](function(){return _0x47349b[_0x24fc('0x31')]({'read':!![]});})[_0x24fc('0x1a')](function(_0x2086c0){logger['error'](_0x24fc('0x2c'),_0x24fc('0x24'),util['inspect'](_0x2086c0,{'showHidden':![],'depth':null}));_0x44caca();});}else{_0x44caca();}})[_0x24fc('0x32')](function(){_0x44caca();});}else{_0x44caca();}}},'charset':_0x24fc('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x955f=['openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','OpenchannelInteraction','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports','OpenchannelMessage'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x955f,0x1eb));var _0xf955=function(_0x5b0fdb,_0xe56901){_0x5b0fdb=_0x5b0fdb-0x0;var _0x39ef79=_0x955f[_0x5b0fdb];return _0x39ef79;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./openchannelMessage.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xf955('0xa')],'type':_0xf955('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x168ffb,_0x38b190,_0x134c1b){var _0x421e4a=_0x2caff2[_0xf955('0xc')];var _0x4d213a=_0x168ffb[_0xf955('0xd')]({'plain':!![]});if(_0x4d213a['direction'][_0xf955('0xe')]()==='in'||_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()==='out'&&!_0x4d213a[_0xf955('0x10')]&&!_['isNil'](_0x4d213a[_0xf955('0x11')])){_0x421e4a['OpenchannelInteraction'][_0xf955('0x12')]({'where':{'id':_0x4d213a[_0xf955('0x13')]}})[_0xf955('0x14')](function(_0x109bc5){if(_0x109bc5){_0x109bc5[_0xf955('0x15')]({'lastMsgAt':_0x4d213a[_0xf955('0x16')],'lastMsgDirection':_0x4d213a[_0xf955('0xf')][_0xf955('0xe')]()});}})[_0xf955('0x17')](function(_0x24e75c){console['error'](_0x24e75c);});}if(_0x4d213a[_0xf955('0xf')]==='out'&&!_0x4d213a[_0xf955('0x10')]){var _0x3a814f;_0x421e4a[_0xf955('0x18')][_0xf955('0x19')]()['then'](function(_0x5ac6cb){return _0x421e4a[_0xf955('0x1a')][_0xf955('0x1b')]({'where':{'id':_0x4d213a[_0xf955('0x1c')]},'include':[{'model':_0x421e4a['OpenchannelInteraction'],'as':_0xf955('0x1d'),'where':{'id':_0x4d213a[_0xf955('0x13')]},'limit':0x1,'include':[{'model':_0x421e4a[_0xf955('0x18')],'as':_0xf955('0x1e'),'attributes':_[_0xf955('0x1f')](_0x5ac6cb)}]}]});})['then'](function(_0x17d86a){_0x3a814f=_0x17d86a[_0xf955('0xd')]({'plain':!![]});if(_0x3a814f&&_0x3a814f[_0xf955('0x20')]){logger['info'](_0xf955('0x21'),'afterCreate',util[_0xf955('0x22')](_0xf955('0x23'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x3a814f[_0xf955('0x1d')]&&_0x3a814f[_0xf955('0x1d')]['length']){_0x4d213a[_0xf955('0x24')]=_[_0xf955('0x25')](_0x3a814f[_0xf955('0x1d')][0x0],_0xf955('0x1e'));_0x4d213a[_0xf955('0x1e')]=_0x3a814f[_0xf955('0x1d')][0x0][_0xf955('0x1e')];}var _0x38b190={'method':_0xf955('0x26'),'uri':encodeURI(_0x3a814f[_0xf955('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x38b190[_0xf955('0x27')]){case _0xf955('0x28'):_0x38b190['qs']=_0x4d213a;break;case _0xf955('0x26'):_0x38b190[_0xf955('0xa')]=_0x4d213a;break;}return rp(_0x38b190)[_0xf955('0x14')](function(_0x51f3ab){logger[_0xf955('0x29')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x22')](_0xf955('0x2b'),_0x4d213a['id'],_0x3a814f[_0xf955('0x20')]));if(_0x51f3ab['body'][_0xf955('0x2c')]&&_0x51f3ab[_0xf955('0xa')]['threadId']!=_0x4d213a[_0xf955('0x24')][_0xf955('0x2c')]){return _0x421e4a[_0xf955('0x2d')][_0xf955('0x15')]({'threadId':_0x51f3ab['body'][_0xf955('0x2c')]},{'logging':!![],'where':{'id':_0x4d213a['Interaction']['id']}});}else{return;}})[_0xf955('0x14')](function(){return _0x168ffb[_0xf955('0x15')]({'read':!![]});})[_0xf955('0x17')](function(_0x4069fe){logger[_0xf955('0x2e')](_0xf955('0x21'),_0xf955('0x2a'),util[_0xf955('0x2f')](_0x4069fe,{'showHidden':![],'depth':null}));_0x134c1b();});}else{_0x134c1b();}})['finally'](function(){_0x134c1b();});}else{_0x134c1b();}}},'charset':_0xf955('0x30'),'collate':_0xf955('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7f85d3a..3815fa0 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x38cef4,_0x11f344){var _0xab8a01=function(_0x13e2b2){while(--_0x13e2b2){_0x38cef4['push'](_0x38cef4['shift']());}};_0xab8a01(++_0x11f344);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _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(_0x265027,_0x29ca7a){var _0x51afc7=function(_0x13b787){while(--_0x13b787){_0x265027['push'](_0x265027['shift']());}};_0x51afc7(++_0x29ca7a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4087fd,_0x1088d6){_0x4087fd=_0x4087fd-0x0;var _0x143c76=_0x5f2f[_0x4087fd];return _0x143c76;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 9420f41..bdd8c45 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 _0x11e5=['remove','update','emit','openchannelMessage:','./openchannelMessage.events'];(function(_0x495ef8,_0x3b23de){var _0x20e824=function(_0x127ce7){while(--_0x127ce7){_0x495ef8['push'](_0x495ef8['shift']());}};_0x20e824(++_0x3b23de);}(_0x11e5,0x8b));var _0x511e=function(_0x87fb9d,_0x2ba366){_0x87fb9d=_0x87fb9d-0x0;var _0x30dcf6=_0x11e5[_0x87fb9d];return _0x30dcf6;};'use strict';var OpenchannelMessageEvents=require(_0x511e('0x0'));var events=['save',_0x511e('0x1'),_0x511e('0x2')];function createListener(_0x5bba15,_0x2947e4){return function(_0x30fb24){_0x2947e4[_0x511e('0x3')](_0x5bba15,_0x30fb24);};}function removeListener(_0x5cab33,_0x249e4d){return function(){OpenchannelMessageEvents['removeListener'](_0x5cab33,_0x249e4d);};}exports['register']=function(_0x342539){for(var _0x323f8c=0x0,_0x466dec=events['length'];_0x323f8c<_0x466dec;_0x323f8c++){var _0x47cf56=events[_0x323f8c];var _0x3ebc4b=createListener(_0x511e('0x4')+_0x47cf56,_0x342539);OpenchannelMessageEvents['on'](_0x47cf56,_0x3ebc4b);}}; \ No newline at end of file +var _0x35f5=['length','./openchannelMessage.events','remove','update','removeListener'];(function(_0x157292,_0x5f58c3){var _0x527a2b=function(_0x38c7e2){while(--_0x38c7e2){_0x157292['push'](_0x157292['shift']());}};_0x527a2b(++_0x5f58c3);}(_0x35f5,0x100));var _0x535f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x35f5[_0x4565bf];return _0x5610ba;};'use strict';var OpenchannelMessageEvents=require(_0x535f('0x0'));var events=['save',_0x535f('0x1'),_0x535f('0x2')];function createListener(_0x46e486,_0xba4dd7){return function(_0x4fd48a){_0xba4dd7['emit'](_0x46e486,_0x4fd48a);};}function removeListener(_0x5f4a18,_0x3a8b37){return function(){OpenchannelMessageEvents[_0x535f('0x3')](_0x5f4a18,_0x3a8b37);};}exports['register']=function(_0x6b403a){for(var _0x4f9d93=0x0,_0x24a137=events[_0x535f('0x4')];_0x4f9d93<_0x24a137;_0x4f9d93++){var _0x4b3440=events[_0x4f9d93];var _0x30802d=createListener('openchannelMessage:'+_0x4b3440,_0x6b403a);OpenchannelMessageEvents['on'](_0x4b3440,_0x30802d);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6b74a70..27549a2 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 _0xdc55=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','destroy','removeTeams','removeAgents','util','path','express'];(function(_0x55fd0e,_0x2d994b){var _0x4fe939=function(_0x108f83){while(--_0x108f83){_0x55fd0e['push'](_0x55fd0e['shift']());}};_0x4fe939(++_0x2d994b);}(_0xdc55,0x1a6));var _0x5dc5=function(_0x2a4f49,_0x3d15ae){_0x2a4f49=_0x2a4f49-0x0;var _0xf08fba=_0xdc55[_0x2a4f49];return _0xf08fba;};'use strict';var multer=require('multer');var util=require(_0x5dc5('0x0'));var path=require(_0x5dc5('0x1'));var timeout=require('connect-timeout');var express=require(_0x5dc5('0x2'));var router=express['Router']();var fs_extra=require(_0x5dc5('0x3'));var auth=require(_0x5dc5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5dc5('0x5'));var controller=require('./openchannelQueue.controller');router[_0x5dc5('0x6')]('/',auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x8')]);router[_0x5dc5('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x5dc5('0x9')]);router[_0x5dc5('0x6')](_0x5dc5('0xa'),auth['isAuthenticated'](),controller[_0x5dc5('0xb')]);router['get'](_0x5dc5('0xc'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0xd')]);router[_0x5dc5('0x6')](_0x5dc5('0xe'),auth[_0x5dc5('0x7')](),controller['getTeams']);router[_0x5dc5('0x6')](_0x5dc5('0xf'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x10')]);router[_0x5dc5('0x11')]('/',auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x12')]);router[_0x5dc5('0x11')](_0x5dc5('0xe'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x13')]);router[_0x5dc5('0x11')](_0x5dc5('0xf'),auth['isAuthenticated'](),controller[_0x5dc5('0x14')]);router[_0x5dc5('0x15')](_0x5dc5('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5dc5('0xa'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x16')]);router['delete'](_0x5dc5('0xe'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x17')]);router['delete'](_0x5dc5('0xf'),auth[_0x5dc5('0x7')](),controller[_0x5dc5('0x18')]);module['exports']=router; \ No newline at end of file +var _0xbdb1=['addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/members','/:id/teams','getAgents','post','create','addTeams','/:id/users'];(function(_0x4ec5c1,_0x38f8ab){var _0x12fb37=function(_0x4921d6){while(--_0x4921d6){_0x4ec5c1['push'](_0x4ec5c1['shift']());}};_0x12fb37(++_0x38f8ab);}(_0xbdb1,0x120));var _0x1bdb=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0xbdb1[_0x5ac0f0];return _0x4aceec;};'use strict';var multer=require(_0x1bdb('0x0'));var util=require(_0x1bdb('0x1'));var path=require(_0x1bdb('0x2'));var timeout=require(_0x1bdb('0x3'));var express=require('express');var router=express[_0x1bdb('0x4')]();var fs_extra=require(_0x1bdb('0x5'));var auth=require(_0x1bdb('0x6'));var interaction=require(_0x1bdb('0x7'));var config=require(_0x1bdb('0x8'));var controller=require('./openchannelQueue.controller');router[_0x1bdb('0x9')]('/',auth['isAuthenticated'](),controller[_0x1bdb('0xa')]);router[_0x1bdb('0x9')](_0x1bdb('0xb'),auth[_0x1bdb('0xc')](),controller[_0x1bdb('0xd')]);router['get']('/:id',auth[_0x1bdb('0xc')](),controller[_0x1bdb('0xe')]);router[_0x1bdb('0x9')](_0x1bdb('0xf'),auth[_0x1bdb('0xc')](),controller['getMembers']);router['get'](_0x1bdb('0x10'),auth[_0x1bdb('0xc')](),controller['getTeams']);router[_0x1bdb('0x9')]('/:id/users',auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x11')]);router[_0x1bdb('0x12')]('/',auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x13')]);router[_0x1bdb('0x12')](_0x1bdb('0x10'),auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x14')]);router[_0x1bdb('0x12')](_0x1bdb('0x15'),auth['isAuthenticated'](),controller[_0x1bdb('0x16')]);router[_0x1bdb('0x17')](_0x1bdb('0x18'),auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x19')]);router[_0x1bdb('0x1a')](_0x1bdb('0x18'),auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x1b')]);router[_0x1bdb('0x1a')](_0x1bdb('0x10'),auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x1c')]);router['delete']('/:id/users',auth[_0x1bdb('0xc')](),controller[_0x1bdb('0x1d')]);module[_0x1bdb('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index db6c974..fd4ce90 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 _0x28ba=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING','name'];(function(_0x31b1d4,_0x4891a1){var _0x22eb16=function(_0xf581d5){while(--_0xf581d5){_0x31b1d4['push'](_0x31b1d4['shift']());}};_0x22eb16(++_0x4891a1);}(_0x28ba,0xe5));var _0xa28b=function(_0x18c3bb,_0x5c97b2){_0x18c3bb=_0x18c3bb-0x0;var _0x580df2=_0x28ba[_0x18c3bb];return _0x580df2;};'use strict';var Sequelize=require('sequelize');module[_0xa28b('0x0')]={'name':{'type':Sequelize[_0xa28b('0x1')],'unique':_0xa28b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa28b('0x1')]},'timeout':{'type':Sequelize[_0xa28b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa28b('0x4')](_0xa28b('0x5'),_0xa28b('0x6'),_0xa28b('0x7'))}}; \ No newline at end of file +var _0x7e9a=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x2164d9,_0x3f7794){var _0x5984ec=function(_0x3ab9c4){while(--_0x3ab9c4){_0x2164d9['push'](_0x2164d9['shift']());}};_0x5984ec(++_0x3f7794);}(_0x7e9a,0x13f));var _0xa7e9=function(_0x39df27,_0xa87bbc){_0x39df27=_0x39df27-0x0;var _0x467bf6=_0x7e9a[_0x39df27];return _0x467bf6;};'use strict';var Sequelize=require(_0xa7e9('0x0'));module[_0xa7e9('0x1')]={'name':{'type':Sequelize[_0xa7e9('0x2')],'unique':_0xa7e9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa7e9('0x2')]},'timeout':{'type':Sequelize[_0xa7e9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa7e9('0x5'),_0xa7e9('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 4c3a293..4658ad4 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 _0x1ae3=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','undefined','limit','count','set','Content-Range','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','index','map','OpenchannelQueue','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','create','body','user','role','UserProfileSection','autoAssociation','params','describe','UserOpenchannelQueue','rawAttributes','OpenchannelQueueId','User','findAndCountAll','UserId','openchannelPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x1ae3,0x196));var _0x31ae=function(_0x5730a1,_0x33226e){_0x5730a1=_0x5730a1-0x0;var _0x37b7ec=_0x1ae3[_0x5730a1];return _0x37b7ec;};'use strict';var emlformat=require(_0x31ae('0x0'));var rimraf=require(_0x31ae('0x1'));var zipdir=require(_0x31ae('0x2'));var jsonpatch=require(_0x31ae('0x3'));var rp=require(_0x31ae('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x31ae('0x5'));var util=require('util');var path=require(_0x31ae('0x6'));var sox=require(_0x31ae('0x7'));var csv=require(_0x31ae('0x8'));var ejs=require(_0x31ae('0x9'));var fs=require('fs');var fs_extra=require(_0x31ae('0xa'));var _=require(_0x31ae('0xb'));var squel=require(_0x31ae('0xc'));var crypto=require(_0x31ae('0xd'));var jsforce=require(_0x31ae('0xe'));var deskjs=require(_0x31ae('0xf'));var toCsv=require('to-csv');var querystring=require(_0x31ae('0x10'));var Papa=require('papaparse');var Redis=require(_0x31ae('0x11'));var authService=require(_0x31ae('0x12'));var qs=require(_0x31ae('0x13'));var as=require(_0x31ae('0x14'));var hardwareService=require(_0x31ae('0x15'));var logger=require(_0x31ae('0x16'))(_0x31ae('0x17'));var utils=require(_0x31ae('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x31ae('0x19'))['db'];config[_0x31ae('0x1a')]=_[_0x31ae('0x1b')](config[_0x31ae('0x1a')],{'host':_0x31ae('0x1c'),'port':0x18eb});var socket=require(_0x31ae('0x1d'))(new Redis(config[_0x31ae('0x1a')]));require('./openchannelQueue.socket')[_0x31ae('0x1e')](socket);function respondWithStatusCode(_0x5bbf5e,_0x5b23a7){_0x5b23a7=_0x5b23a7||0xcc;return function(_0x220d49){if(_0x220d49){return _0x5bbf5e['sendStatus'](_0x5b23a7);}return _0x5bbf5e[_0x31ae('0x1f')](_0x5b23a7)[_0x31ae('0x20')]();};}function respondWithResult(_0x3b10a9,_0x5748db){_0x5748db=_0x5748db||0xc8;return function(_0x1b32ca){if(_0x1b32ca){return _0x3b10a9[_0x31ae('0x1f')](_0x5748db)['json'](_0x1b32ca);}};}function respondWithFilteredResult(_0x52f635,_0x487e76){return function(_0x522bab){if(_0x522bab){var _0x4ea887=typeof _0x487e76[_0x31ae('0x21')]===_0x31ae('0x22')&&typeof _0x487e76[_0x31ae('0x23')]===_0x31ae('0x22');var _0x498cb=_0x522bab[_0x31ae('0x24')];var _0xf87439=_0x4ea887?0x0:_0x487e76[_0x31ae('0x21')];var _0x366c46=_0x4ea887?_0x522bab[_0x31ae('0x24')]:_0x487e76['offset']+_0x487e76[_0x31ae('0x23')];var _0x434403;if(_0x366c46>=_0x498cb){_0x366c46=_0x498cb;_0x434403=0xc8;}else{_0x434403=0xce;}_0x52f635[_0x31ae('0x1f')](_0x434403);return _0x52f635[_0x31ae('0x25')](_0x31ae('0x26'),_0xf87439+'-'+_0x366c46+'/'+_0x498cb)['json'](_0x522bab);}return null;};}function patchUpdates(_0x49a712){return function(_0x2e5c48){try{jsonpatch['apply'](_0x2e5c48,_0x49a712,!![]);}catch(_0x46503d){return BPromise['reject'](_0x46503d);}return _0x2e5c48['save']();};}function saveUpdates(_0x432ac7,_0x26f878){return function(_0x25e911){if(_0x25e911){return _0x25e911[_0x31ae('0x27')](_0x432ac7)[_0x31ae('0x28')](function(_0x15d503){return _0x15d503;});}return null;};}function removeEntity(_0x277d49,_0x533cd1){return function(_0x24ed21){if(_0x24ed21){return _0x24ed21['destroy']()[_0x31ae('0x28')](function(){var _0x54caa4=_0x24ed21[_0x31ae('0x29')]({'plain':!![]});var _0x414d59=_0x31ae('0x2a');return db[_0x31ae('0x2b')][_0x31ae('0x2c')]({'where':{'type':_0x414d59,'resourceId':_0x54caa4['id']}})[_0x31ae('0x28')](function(){return _0x24ed21;});})[_0x31ae('0x28')](function(){_0x277d49[_0x31ae('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427ac5,_0x185e3e){return function(_0x5f3568){if(!_0x5f3568){_0x427ac5['sendStatus'](0x194);}return _0x5f3568;};}function handleError(_0x3e6df4,_0x2053c0){_0x2053c0=_0x2053c0||0x1f4;return function(_0x133dd8){logger[_0x31ae('0x2d')](_0x133dd8[_0x31ae('0x2e')]);if(_0x133dd8[_0x31ae('0x2f')]){delete _0x133dd8[_0x31ae('0x2f')];}_0x3e6df4[_0x31ae('0x1f')](_0x2053c0)['send'](_0x133dd8);};}exports[_0x31ae('0x30')]=function(_0x251209,_0x28d2d2){var _0x56b9cb={},_0x126bae={},_0x4bac75={'count':0x0,'rows':[]};var _0x5aa7f8=_[_0x31ae('0x31')](db[_0x31ae('0x32')]['rawAttributes'],function(_0xa5999c){return{'name':_0xa5999c[_0x31ae('0x33')],'type':_0xa5999c['type'][_0x31ae('0x34')]};});_0x126bae[_0x31ae('0x35')]=_[_0x31ae('0x31')](_0x5aa7f8,_0x31ae('0x2f'));_0x126bae[_0x31ae('0x36')]=_['keys'](_0x251209['query']);_0x126bae['filters']=_[_0x31ae('0x37')](_0x126bae[_0x31ae('0x35')],_0x126bae[_0x31ae('0x36')]);_0x56b9cb[_0x31ae('0x38')]=_[_0x31ae('0x37')](_0x126bae[_0x31ae('0x35')],qs[_0x31ae('0x39')](_0x251209[_0x31ae('0x36')][_0x31ae('0x39')]));_0x56b9cb['attributes']=_0x56b9cb[_0x31ae('0x38')][_0x31ae('0x3a')]?_0x56b9cb[_0x31ae('0x38')]:_0x126bae[_0x31ae('0x35')];if(!_0x251209[_0x31ae('0x36')][_0x31ae('0x3b')](_0x31ae('0x3c'))){_0x56b9cb[_0x31ae('0x23')]=qs[_0x31ae('0x23')](_0x251209[_0x31ae('0x36')][_0x31ae('0x23')]);_0x56b9cb[_0x31ae('0x21')]=qs[_0x31ae('0x21')](_0x251209[_0x31ae('0x36')][_0x31ae('0x21')]);}_0x56b9cb[_0x31ae('0x3d')]=qs[_0x31ae('0x3e')](_0x251209[_0x31ae('0x36')][_0x31ae('0x3e')]);_0x56b9cb[_0x31ae('0x3f')]=qs[_0x31ae('0x40')](_[_0x31ae('0x41')](_0x251209[_0x31ae('0x36')],_0x126bae[_0x31ae('0x40')]),_0x5aa7f8);if(_0x251209[_0x31ae('0x36')][_0x31ae('0x42')]){_0x56b9cb[_0x31ae('0x3f')]=_[_0x31ae('0x43')](_0x56b9cb[_0x31ae('0x3f')],{'$or':_[_0x31ae('0x31')](_0x5aa7f8,function(_0x5266bc){if(_0x5266bc['type']!==_0x31ae('0x44')){var _0x2206f8={};_0x2206f8[_0x5266bc['name']]={'$like':'%'+_0x251209[_0x31ae('0x36')]['filter']+'%'};return _0x2206f8;}})});}_0x56b9cb=_['merge']({},_0x56b9cb,_0x251209[_0x31ae('0x45')]);var _0x19aa31={'where':_0x56b9cb[_0x31ae('0x3f')]};return db[_0x31ae('0x32')][_0x31ae('0x24')](_0x19aa31)[_0x31ae('0x28')](function(_0x57a0ca){_0x4bac75[_0x31ae('0x24')]=_0x57a0ca;if(_0x251209[_0x31ae('0x36')][_0x31ae('0x46')]){_0x56b9cb[_0x31ae('0x47')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x31ae('0x48')](_0x56b9cb);})[_0x31ae('0x28')](function(_0x485276){_0x4bac75[_0x31ae('0x49')]=_0x485276;return _0x4bac75;})[_0x31ae('0x28')](respondWithFilteredResult(_0x28d2d2,_0x56b9cb))[_0x31ae('0x4a')](handleError(_0x28d2d2,null));};exports['show']=function(_0x210370,_0x135d50){var _0x4d1ed7={'raw':!![],'where':{'id':_0x210370['params']['id']}},_0x45b9a0={};_0x45b9a0[_0x31ae('0x35')]=_[_0x31ae('0x4b')](db[_0x31ae('0x32')]['rawAttributes']);_0x45b9a0['query']=_[_0x31ae('0x4b')](_0x210370[_0x31ae('0x36')]);_0x45b9a0[_0x31ae('0x40')]=_[_0x31ae('0x37')](_0x45b9a0['model'],_0x45b9a0[_0x31ae('0x36')]);_0x4d1ed7[_0x31ae('0x38')]=_['intersection'](_0x45b9a0[_0x31ae('0x35')],qs[_0x31ae('0x39')](_0x210370[_0x31ae('0x36')][_0x31ae('0x39')]));_0x4d1ed7[_0x31ae('0x38')]=_0x4d1ed7[_0x31ae('0x38')][_0x31ae('0x3a')]?_0x4d1ed7['attributes']:_0x45b9a0[_0x31ae('0x35')];if(_0x210370[_0x31ae('0x36')]['includeAll']){_0x4d1ed7['include']=[{'all':!![]}];}_0x4d1ed7=_[_0x31ae('0x43')]({},_0x4d1ed7,_0x210370[_0x31ae('0x45')]);return db[_0x31ae('0x32')][_0x31ae('0x4c')](_0x4d1ed7)[_0x31ae('0x28')](handleEntityNotFound(_0x135d50,null))[_0x31ae('0x28')](respondWithResult(_0x135d50,null))[_0x31ae('0x4a')](handleError(_0x135d50,null));};exports['create']=function(_0x218a46,_0x311677){return db[_0x31ae('0x32')][_0x31ae('0x4d')](_0x218a46[_0x31ae('0x4e')],{})['then'](function(_0x4ae353){var _0x3cb354=_0x218a46[_0x31ae('0x4f')][_0x31ae('0x29')]({'plain':!![]});if(!_0x3cb354)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cb354[_0x31ae('0x50')]===_0x31ae('0x4f')){var _0x2823ca=_0x4ae353['get']({'plain':!![]});var _0x2497db='OpenchannelQueues';return db[_0x31ae('0x51')][_0x31ae('0x4c')]({'where':{'name':_0x2497db,'userProfileId':_0x3cb354['userProfileId']},'raw':!![]})[_0x31ae('0x28')](function(_0x121bcc){if(_0x121bcc&&_0x121bcc[_0x31ae('0x52')]===0x0){return db[_0x31ae('0x2b')]['create']({'name':_0x2823ca[_0x31ae('0x2f')],'resourceId':_0x2823ca['id'],'type':_0x121bcc[_0x31ae('0x2f')],'sectionId':_0x121bcc['id']},{})[_0x31ae('0x28')](function(){return _0x4ae353;});}else{return _0x4ae353;}})[_0x31ae('0x4a')](function(_0x15b1c3){logger[_0x31ae('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15b1c3);throw _0x15b1c3;});}return _0x4ae353;})[_0x31ae('0x28')](respondWithResult(_0x311677,0xc9))[_0x31ae('0x4a')](handleError(_0x311677,null));};exports[_0x31ae('0x27')]=function(_0x377b26,_0x5ab638){if(_0x377b26[_0x31ae('0x4e')]['id']){delete _0x377b26[_0x31ae('0x4e')]['id'];}return db[_0x31ae('0x32')][_0x31ae('0x4c')]({'where':{'id':_0x377b26[_0x31ae('0x53')]['id']}})[_0x31ae('0x28')](handleEntityNotFound(_0x5ab638,null))[_0x31ae('0x28')](saveUpdates(_0x377b26['body'],null))[_0x31ae('0x28')](respondWithResult(_0x5ab638,null))[_0x31ae('0x4a')](handleError(_0x5ab638,null));};exports[_0x31ae('0x2c')]=function(_0x3a5ea1,_0x3c0251){return db[_0x31ae('0x32')][_0x31ae('0x4c')]({'where':{'id':_0x3a5ea1['params']['id']}})[_0x31ae('0x28')](handleEntityNotFound(_0x3c0251,null))[_0x31ae('0x28')](removeEntity(_0x3c0251,null))[_0x31ae('0x4a')](handleError(_0x3c0251,null));};exports['describe']=function(_0x16038d,_0x56f002){return db[_0x31ae('0x32')][_0x31ae('0x54')]()[_0x31ae('0x28')](respondWithResult(_0x56f002,null))['catch'](handleError(_0x56f002,null));};exports['getMembers']=function(_0x406c4c,_0x977047,_0x13a5a3){var _0x4bcf15={'raw':!![],'where':{}},_0x11c469={},_0x3e6533;return db[_0x31ae('0x32')]['findOne']({'where':{'id':_0x406c4c[_0x31ae('0x53')]['id']}})[_0x31ae('0x28')](handleEntityNotFound(_0x977047,null))[_0x31ae('0x28')](function(_0x2e51bd){if(_0x2e51bd){_0x3e6533=_0x2e51bd[_0x31ae('0x29')]({'plain':!![]});_0x11c469[_0x31ae('0x35')]=_[_0x31ae('0x4b')](db[_0x31ae('0x55')][_0x31ae('0x56')]);_0x11c469[_0x31ae('0x36')]=_[_0x31ae('0x4b')](_0x406c4c[_0x31ae('0x36')]);_0x11c469[_0x31ae('0x40')]=_[_0x31ae('0x37')](_0x11c469['model'],_0x11c469[_0x31ae('0x36')]);_0x4bcf15[_0x31ae('0x38')]=_[_0x31ae('0x37')](_0x11c469[_0x31ae('0x35')],qs[_0x31ae('0x39')](_0x406c4c['query']['fields']));_0x4bcf15[_0x31ae('0x38')]=_0x4bcf15[_0x31ae('0x38')][_0x31ae('0x3a')]?_0x4bcf15[_0x31ae('0x38')]:_0x11c469['model'];if(!_0x406c4c[_0x31ae('0x36')][_0x31ae('0x3b')](_0x31ae('0x3c'))){_0x4bcf15[_0x31ae('0x23')]=qs[_0x31ae('0x23')](_0x406c4c[_0x31ae('0x36')][_0x31ae('0x23')]);_0x4bcf15[_0x31ae('0x21')]=qs['offset'](_0x406c4c[_0x31ae('0x36')][_0x31ae('0x21')]);}_0x4bcf15['order']=qs['sort'](_0x406c4c[_0x31ae('0x36')][_0x31ae('0x3e')]);_0x4bcf15[_0x31ae('0x3f')]=qs[_0x31ae('0x40')](_[_0x31ae('0x41')](_0x406c4c[_0x31ae('0x36')],_0x11c469['filters']));_0x4bcf15[_0x31ae('0x3f')][_0x31ae('0x57')]=_0x2e51bd['id'];if(_0x406c4c[_0x31ae('0x36')][_0x31ae('0x42')]){_0x4bcf15['where']=_['merge'](_0x4bcf15[_0x31ae('0x3f')],{'$or':_[_0x31ae('0x31')](_0x4bcf15[_0x31ae('0x38')],function(_0x1a1956){var _0x4f9f04={};_0x4f9f04[_0x1a1956]={'$like':'%'+_0x406c4c[_0x31ae('0x36')][_0x31ae('0x42')]+'%'};return _0x4f9f04;})});}_0x4bcf15=_['merge']({},_0x4bcf15,_0x406c4c[_0x31ae('0x45')]);return db['UserOpenchannelQueue'][_0x31ae('0x48')](_0x4bcf15);}})[_0x31ae('0x28')](function(_0xc8dba){if(_0xc8dba){return db[_0x31ae('0x58')][_0x31ae('0x59')]({'where':{'id':_[_0x31ae('0x31')](_0xc8dba,_0x31ae('0x5a')),'role':'agent'},'attributes':['id',_0x31ae('0x2f'),_0x31ae('0x5b'),_0x31ae('0x5c'),'createdAt']});}})[_0x31ae('0x28')](function(_0x5d8b61){if(_0x5d8b61){return{'count':_0x5d8b61[_0x31ae('0x24')],'rows':_[_0x31ae('0x31')](_0x5d8b61['rows'],function(_0x5afad6){return{'membername':_0x5afad6[_0x31ae('0x2f')],'UserId':_0x5afad6['id'],'queue_name':_0x3e6533[_0x31ae('0x2f')],'OpenchannelQueueId':_0x3e6533['id'],'interface':util[_0x31ae('0x5d')](_0x31ae('0x5e'),_0x31ae('0x5f'),_0x5afad6[_0x31ae('0x2f')]),'penalty':0x0,'paused':_0x5afad6[_0x31ae('0x5b')],'createdAt':_0x5afad6['createdAt'],'updatedAt':_0x5afad6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x31ae('0x28')](respondWithFilteredResult(_0x977047,_0x4bcf15))[_0x31ae('0x4a')](handleError(_0x977047,null));};exports[_0x31ae('0x60')]=function(_0x40c7b1,_0x1a188e,_0x10a6ca){var _0x583eaf={};var _0xa1d405={};var _0x23ff2a;var _0x3eeca9;return db['OpenchannelQueue'][_0x31ae('0x61')]({'where':{'id':_0x40c7b1[_0x31ae('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a188e,null))[_0x31ae('0x28')](function(_0x14dc11){if(_0x14dc11){_0x23ff2a=_0x14dc11;_0xa1d405[_0x31ae('0x35')]=_[_0x31ae('0x4b')](db[_0x31ae('0x62')][_0x31ae('0x56')]);_0xa1d405[_0x31ae('0x36')]=_[_0x31ae('0x4b')](_0x40c7b1[_0x31ae('0x36')]);_0xa1d405[_0x31ae('0x40')]=_[_0x31ae('0x37')](_0xa1d405['model'],_0xa1d405[_0x31ae('0x36')]);_0x583eaf['attributes']=_[_0x31ae('0x37')](_0xa1d405['model'],qs[_0x31ae('0x39')](_0x40c7b1[_0x31ae('0x36')][_0x31ae('0x39')]));_0x583eaf[_0x31ae('0x38')]=_0x583eaf[_0x31ae('0x38')][_0x31ae('0x3a')]?_0x583eaf[_0x31ae('0x38')]:_0xa1d405[_0x31ae('0x35')];_0x583eaf['order']=qs[_0x31ae('0x3e')](_0x40c7b1['query']['sort']);_0x583eaf[_0x31ae('0x3f')]=qs[_0x31ae('0x40')](_[_0x31ae('0x41')](_0x40c7b1[_0x31ae('0x36')],_0xa1d405[_0x31ae('0x40')]));if(_0x40c7b1[_0x31ae('0x36')][_0x31ae('0x42')]){_0x583eaf[_0x31ae('0x3f')]=_['merge'](_0x583eaf[_0x31ae('0x3f')],{'$or':_[_0x31ae('0x31')](_0x583eaf[_0x31ae('0x38')],function(_0x21b88e){var _0x7c7b57={};_0x7c7b57[_0x21b88e]={'$like':'%'+_0x40c7b1[_0x31ae('0x36')][_0x31ae('0x42')]+'%'};return _0x7c7b57;})});}_0x583eaf=_[_0x31ae('0x43')]({},_0x583eaf,_0x40c7b1['options']);return _0x23ff2a['getTeams'](_0x583eaf);}})[_0x31ae('0x28')](function(_0x3fe994){if(_0x3fe994){_0x3eeca9=_0x3fe994[_0x31ae('0x3a')];if(!_0x40c7b1[_0x31ae('0x36')][_0x31ae('0x3b')]('nolimit')){_0x583eaf[_0x31ae('0x23')]=qs[_0x31ae('0x23')](_0x40c7b1[_0x31ae('0x36')][_0x31ae('0x23')]);_0x583eaf[_0x31ae('0x21')]=qs[_0x31ae('0x21')](_0x40c7b1['query']['offset']);}return _0x23ff2a[_0x31ae('0x60')](_0x583eaf);}})[_0x31ae('0x28')](function(_0x28c105){if(_0x28c105){return _0x28c105?{'count':_0x3eeca9,'rows':_0x28c105}:null;}})[_0x31ae('0x28')](respondWithResult(_0x1a188e,null))[_0x31ae('0x4a')](handleError(_0x1a188e,null));};exports[_0x31ae('0x63')]=function(_0x4046c8,_0x4fa998,_0x134e24){var _0x4a4ca4=_0x4046c8[_0x31ae('0x4e')][_0x31ae('0x64')];return db['Team'][_0x31ae('0x48')]({'where':{'id':_0x4a4ca4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x31ae('0x65'),'attributes':['id','name',_0x31ae('0x66'),_0x31ae('0x67'),_0x31ae('0x68')],'raw':!![]}]})[_0x31ae('0x28')](function(_0x3a9ebb){if(_0x3a9ebb){var _0x439b8f=_[_0x31ae('0x69')](_0x3a9ebb,function(_0x4977fb){var _0x1e960a=_0x4977fb[_0x31ae('0x29')]({'plain':!![]});return _0x1e960a['Agents'];});return db[_0x31ae('0x32')]['find']({'where':{'id':_0x4046c8[_0x31ae('0x53')]['id']}})['then'](function(_0x50e33b){return db[_0x31ae('0x6a')][_0x31ae('0x6b')](function(_0x5e3664){return _0x50e33b['addTeams'](_0x4a4ca4,{'transaction':_0x5e3664})[_0x31ae('0x28')](function(){return BPromise['each'](_0x439b8f,function(_0x516fce){return db[_0x31ae('0x55')]['findOrCreate']({'where':{'UserId':_0x516fce['id'],'OpenchannelQueueId':_0x4046c8[_0x31ae('0x53')]['id']},'transaction':_0x5e3664});});})[_0x31ae('0x28')](function(){_0x439b8f[_0x31ae('0x6c')](function(_0x52ee95){socket['emit'](_0x31ae('0x6d'),{'UserId':_0x52ee95['id'],'OpenchannelQueueId':_0x50e33b['id']});});});});});}})['then'](respondWithStatusCode(_0x4fa998,null))[_0x31ae('0x4a')](handleError(_0x4fa998,null));};exports[_0x31ae('0x6e')]=function(_0x140ec3,_0x73e86d,_0x6efa4a){return db['Team'][_0x31ae('0x48')]({'where':{'id':_0x140ec3[_0x31ae('0x36')][_0x31ae('0x64')]},'attributes':['id'],'include':[{'model':db[_0x31ae('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x31ae('0x28')](handleEntityNotFound(_0x73e86d,null))['then'](function(_0x4037e0){var _0x549d67=_[_0x31ae('0x31')](_0x4037e0,'id');var _0x39555d=[];var _0x86be4a=[];var _0x55093d=squel['select']();_0x55093d[_0x31ae('0x6f')](_0x31ae('0x70'))['from']('team_has_openchannel_queues','tq')[_0x31ae('0x71')]('user_has_teams','ut',_0x31ae('0x72'))[_0x31ae('0x3f')](_0x31ae('0x73'),_0x140ec3['params']['id']);for(var _0x3a8cbd=0x0;_0x3a8cbd<_0x4037e0[_0x31ae('0x3a')];_0x3a8cbd+=0x1){let _0x82e238=_0x4037e0[_0x3a8cbd];for(var _0x483ea6=0x0;_0x483ea6<_0x82e238[_0x31ae('0x65')][_0x31ae('0x3a')];_0x483ea6+=0x1){let _0x43b0d8=_0x82e238[_0x31ae('0x65')][_0x483ea6];var _0x1fbfa8=_0x55093d[_0x31ae('0x74')]();_0x1fbfa8[_0x31ae('0x3f')](_0x31ae('0x75'),_0x43b0d8['id']);_0x86be4a[_0x31ae('0x76')](db[_0x31ae('0x6a')][_0x31ae('0x36')](_0x1fbfa8[_0x31ae('0x77')](),{'type':db[_0x31ae('0x6a')][_0x31ae('0x78')][_0x31ae('0x79')]})['then'](function(_0x5e90d1){if(_0x5e90d1['length']===0x1){return _0x43b0d8['id'];}else{var _0x56798d=_[_0x31ae('0x7a')](_[_0x31ae('0x31')](_0x5e90d1,_0x31ae('0x7b')),function(_0x451554){return _[_0x31ae('0x7c')](_0x549d67,_0x451554);});if(_0x56798d){return _0x43b0d8['id'];}}}));}}return BPromise[_0x31ae('0x7d')](_0x86be4a)[_0x31ae('0x28')](function(_0x479058){_0x39555d=_(_0x39555d)[_0x31ae('0x7e')](_0x479058)[_0x31ae('0x7f')]()[_0x31ae('0x80')]();return db['OpenchannelQueue'][_0x31ae('0x4c')]({'where':{'id':_0x140ec3[_0x31ae('0x53')]['id']}})['then'](function(_0x18cafc){return db[_0x31ae('0x6a')]['transaction'](function(_0x24a1a3){return _0x18cafc[_0x31ae('0x6e')](_0x140ec3[_0x31ae('0x36')][_0x31ae('0x64')],{'transaction':_0x24a1a3})['then'](function(){if(!_[_0x31ae('0x81')](_0x39555d)){return _0x18cafc[_0x31ae('0x82')](_0x39555d,{'transaction':_0x24a1a3});}})[_0x31ae('0x28')](function(){_0x39555d[_0x31ae('0x6c')](function(_0x5466ce){socket[_0x31ae('0x83')](_0x31ae('0x84'),{'UserId':_0x5466ce,'OpenchannelQueueId':_0x18cafc['id']});});});});});});})[_0x31ae('0x28')](respondWithStatusCode(_0x73e86d,null))[_0x31ae('0x4a')](handleError(_0x73e86d,null));};exports['addAgents']=function(_0x4e1af6,_0x2c2475,_0x41b1df){return db[_0x31ae('0x32')][_0x31ae('0x4c')]({'where':{'id':_0x4e1af6[_0x31ae('0x53')]['id']}})['then'](handleEntityNotFound(_0x2c2475,null))[_0x31ae('0x28')](function(_0x5a4e69){if(_0x5a4e69){return _0x5a4e69['addAgents'](_0x4e1af6[_0x31ae('0x4e')][_0x31ae('0x64')],_[_0x31ae('0x85')](_0x4e1af6[_0x31ae('0x4e')],['ids','id'])||{})[_0x31ae('0x86')](function(_0x325c25){for(var _0x1af53a=0x0;_0x1af53a<_0x4e1af6[_0x31ae('0x4e')]['ids'][_0x31ae('0x3a')];_0x1af53a+=0x1){socket[_0x31ae('0x83')](_0x31ae('0x6d'),{'UserId':Number(_0x4e1af6[_0x31ae('0x4e')][_0x31ae('0x64')][_0x1af53a]),'OpenchannelQueueId':Number(_0x4e1af6[_0x31ae('0x53')]['id'])});}return _0x325c25;});}})[_0x31ae('0x28')](respondWithResult(_0x2c2475,null))[_0x31ae('0x4a')](handleError(_0x2c2475,null));};exports[_0x31ae('0x82')]=function(_0x293d48,_0x5d35b8,_0x3758ff){return db[_0x31ae('0x32')]['find']({'where':{'id':_0x293d48[_0x31ae('0x53')]['id']}})[_0x31ae('0x28')](handleEntityNotFound(_0x5d35b8,null))[_0x31ae('0x28')](function(_0x5bb9cc){if(_0x5bb9cc){return _0x5bb9cc[_0x31ae('0x82')](_0x293d48[_0x31ae('0x36')][_0x31ae('0x64')])['then'](function(){if(_[_0x31ae('0x87')](_0x293d48[_0x31ae('0x36')][_0x31ae('0x64')])){for(var _0x2100e2=0x0;_0x2100e2<_0x293d48[_0x31ae('0x36')][_0x31ae('0x64')][_0x31ae('0x3a')];_0x2100e2+=0x1){socket['emit'](_0x31ae('0x84'),{'UserId':Number(_0x293d48[_0x31ae('0x36')][_0x31ae('0x64')][_0x2100e2]),'OpenchannelQueueId':Number(_0x293d48[_0x31ae('0x53')]['id'])});}}else{socket[_0x31ae('0x83')]('userOpenchannelQueue:remove',{'UserId':Number(_0x293d48[_0x31ae('0x36')][_0x31ae('0x64')]),'OpenchannelQueueId':Number(_0x293d48[_0x31ae('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x5d35b8,null))[_0x31ae('0x4a')](handleError(_0x5d35b8,null));};exports[_0x31ae('0x88')]=function(_0x47210a,_0x3b734c,_0x48736a){var _0xf14f42={};var _0x137f3e={};var _0x2e4d9a;var _0x2a5137;return db[_0x31ae('0x32')][_0x31ae('0x61')]({'where':{'id':_0x47210a['params']['id']}})[_0x31ae('0x28')](handleEntityNotFound(_0x3b734c,null))[_0x31ae('0x28')](function(_0x5b8919){if(_0x5b8919){_0x2e4d9a=_0x5b8919;_0x137f3e[_0x31ae('0x35')]=_['keys'](db[_0x31ae('0x58')]['rawAttributes']);_0x137f3e[_0x31ae('0x36')]=_['keys'](_0x47210a[_0x31ae('0x36')]);_0x137f3e[_0x31ae('0x40')]=_[_0x31ae('0x37')](_0x137f3e[_0x31ae('0x35')],_0x137f3e[_0x31ae('0x36')]);_0xf14f42[_0x31ae('0x38')]=_[_0x31ae('0x37')](_0x137f3e['model'],qs[_0x31ae('0x39')](_0x47210a[_0x31ae('0x36')][_0x31ae('0x39')]));_0xf14f42[_0x31ae('0x38')]=_0xf14f42[_0x31ae('0x38')]['length']?_0xf14f42[_0x31ae('0x38')]:_0x137f3e[_0x31ae('0x35')];_0xf14f42[_0x31ae('0x3d')]=qs[_0x31ae('0x3e')](_0x47210a[_0x31ae('0x36')]['sort']);_0xf14f42[_0x31ae('0x3f')]=qs[_0x31ae('0x40')](_[_0x31ae('0x41')](_0x47210a[_0x31ae('0x36')],_0x137f3e[_0x31ae('0x40')]));if(_0x47210a[_0x31ae('0x36')][_0x31ae('0x42')]){_0xf14f42['where']=_['merge'](_0xf14f42['where'],{'$or':_['map'](_0xf14f42[_0x31ae('0x38')],function(_0x39f006){var _0x40c08b={};_0x40c08b[_0x39f006]={'$like':'%'+_0x47210a['query']['filter']+'%'};return _0x40c08b;})});}_0xf14f42=_[_0x31ae('0x43')]({},_0xf14f42,_0x47210a[_0x31ae('0x45')]);return _0x2e4d9a['getAgents'](_0xf14f42);}})['then'](function(_0x4bf442){if(_0x4bf442){_0x2a5137=_0x4bf442[_0x31ae('0x3a')];if(!_0x47210a[_0x31ae('0x36')][_0x31ae('0x3b')](_0x31ae('0x3c'))){_0xf14f42[_0x31ae('0x23')]=qs[_0x31ae('0x23')](_0x47210a[_0x31ae('0x36')][_0x31ae('0x23')]);_0xf14f42[_0x31ae('0x21')]=qs[_0x31ae('0x21')](_0x47210a[_0x31ae('0x36')]['offset']);}return _0x2e4d9a[_0x31ae('0x88')](_0xf14f42);}})[_0x31ae('0x28')](function(_0x19362f){if(_0x19362f){return _0x19362f?{'count':_0x2a5137,'rows':_0x19362f}:null;}})['then'](respondWithResult(_0x3b734c,null))[_0x31ae('0x4a')](handleError(_0x3b734c,null));}; \ No newline at end of file +var _0xc73a=['userOpenchannelQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','OpenchannelQueues','error','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','isArray'];(function(_0x55102a,_0xa42c97){var _0x13898c=function(_0x2a1d3f){while(--_0x2a1d3f){_0x55102a['push'](_0x55102a['shift']());}};_0x13898c(++_0xa42c97);}(_0xc73a,0x124));var _0xac73=function(_0x37f4b3,_0x2c8ccf){_0x37f4b3=_0x37f4b3-0x0;var _0x34cc8b=_0xc73a[_0x37f4b3];return _0x34cc8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac73('0x0'));var zipdir=require(_0xac73('0x1'));var jsonpatch=require(_0xac73('0x2'));var rp=require(_0xac73('0x3'));var moment=require(_0xac73('0x4'));var BPromise=require(_0xac73('0x5'));var Mustache=require(_0xac73('0x6'));var util=require(_0xac73('0x7'));var path=require(_0xac73('0x8'));var sox=require(_0xac73('0x9'));var csv=require(_0xac73('0xa'));var ejs=require(_0xac73('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac73('0xc'));var squel=require('squel');var crypto=require(_0xac73('0xd'));var jsforce=require(_0xac73('0xe'));var deskjs=require(_0xac73('0xf'));var toCsv=require('to-csv');var querystring=require(_0xac73('0x10'));var Papa=require(_0xac73('0x11'));var Redis=require(_0xac73('0x12'));var authService=require(_0xac73('0x13'));var qs=require(_0xac73('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac73('0x15'));var logger=require('../../config/logger')(_0xac73('0x16'));var utils=require('../../config/utils');var config=require(_0xac73('0x17'));var licenseUtil=require(_0xac73('0x18'));var db=require(_0xac73('0x19'))['db'];config[_0xac73('0x1a')]=_[_0xac73('0x1b')](config['redis'],{'host':_0xac73('0x1c'),'port':0x18eb});var socket=require(_0xac73('0x1d'))(new Redis(config[_0xac73('0x1a')]));require(_0xac73('0x1e'))[_0xac73('0x1f')](socket);function respondWithStatusCode(_0xea3519,_0x86532){_0x86532=_0x86532||0xcc;return function(_0x2c3821){if(_0x2c3821){return _0xea3519[_0xac73('0x20')](_0x86532);}return _0xea3519[_0xac73('0x21')](_0x86532)[_0xac73('0x22')]();};}function respondWithResult(_0x4a7292,_0x9110d0){_0x9110d0=_0x9110d0||0xc8;return function(_0x3b6a94){if(_0x3b6a94){return _0x4a7292[_0xac73('0x21')](_0x9110d0)[_0xac73('0x23')](_0x3b6a94);}};}function respondWithFilteredResult(_0x4a4cf9,_0x249dac){return function(_0x12dbc1){if(_0x12dbc1){var _0x59a8a6=typeof _0x249dac[_0xac73('0x24')]===_0xac73('0x25')&&typeof _0x249dac['limit']===_0xac73('0x25');var _0x84837c=_0x12dbc1[_0xac73('0x26')];var _0x17b2ce=_0x59a8a6?0x0:_0x249dac[_0xac73('0x24')];var _0x6a2d4b=_0x59a8a6?_0x12dbc1[_0xac73('0x26')]:_0x249dac[_0xac73('0x24')]+_0x249dac[_0xac73('0x27')];var _0x43d16d;if(_0x6a2d4b>=_0x84837c){_0x6a2d4b=_0x84837c;_0x43d16d=0xc8;}else{_0x43d16d=0xce;}_0x4a4cf9['status'](_0x43d16d);return _0x4a4cf9[_0xac73('0x28')](_0xac73('0x29'),_0x17b2ce+'-'+_0x6a2d4b+'/'+_0x84837c)[_0xac73('0x23')](_0x12dbc1);}return null;};}function patchUpdates(_0x1faaf6){return function(_0x347b54){try{jsonpatch[_0xac73('0x2a')](_0x347b54,_0x1faaf6,!![]);}catch(_0x4e5d21){return BPromise[_0xac73('0x2b')](_0x4e5d21);}return _0x347b54[_0xac73('0x2c')]();};}function saveUpdates(_0x12257b,_0x1479be){return function(_0x2baeb5){if(_0x2baeb5){return _0x2baeb5['update'](_0x12257b)[_0xac73('0x2d')](function(_0x3110ec){return _0x3110ec;});}return null;};}function removeEntity(_0x59b57b,_0x9ea527){return function(_0x45831e){if(_0x45831e){return _0x45831e[_0xac73('0x2e')]()[_0xac73('0x2d')](function(){var _0x570036=_0x45831e[_0xac73('0x2f')]({'plain':!![]});var _0x2369c6=_0xac73('0x30');return db['UserProfileResource'][_0xac73('0x2e')]({'where':{'type':_0x2369c6,'resourceId':_0x570036['id']}})[_0xac73('0x2d')](function(){return _0x45831e;});})[_0xac73('0x2d')](function(){_0x59b57b['status'](0xcc)[_0xac73('0x22')]();});}};}function handleEntityNotFound(_0x254822,_0x53d681){return function(_0x202c99){if(!_0x202c99){_0x254822[_0xac73('0x20')](0x194);}return _0x202c99;};}function handleError(_0x222266,_0x4ba606){_0x4ba606=_0x4ba606||0x1f4;return function(_0x5065c5){logger[_0xac73('0x31')](_0x5065c5['stack']);if(_0x5065c5[_0xac73('0x32')]){delete _0x5065c5[_0xac73('0x32')];}_0x222266[_0xac73('0x21')](_0x4ba606)[_0xac73('0x33')](_0x5065c5);};}exports[_0xac73('0x34')]=function(_0x163f58,_0x52baae){var _0xfa9982={},_0x4b65ac={},_0x156562={'count':0x0,'rows':[]};var _0x2efa0e=_[_0xac73('0x35')](db[_0xac73('0x36')][_0xac73('0x37')],function(_0x1dda60){return{'name':_0x1dda60['fieldName'],'type':_0x1dda60[_0xac73('0x38')][_0xac73('0x39')]};});_0x4b65ac[_0xac73('0x3a')]=_[_0xac73('0x35')](_0x2efa0e,'name');_0x4b65ac[_0xac73('0x3b')]=_[_0xac73('0x3c')](_0x163f58[_0xac73('0x3b')]);_0x4b65ac['filters']=_[_0xac73('0x3d')](_0x4b65ac['model'],_0x4b65ac[_0xac73('0x3b')]);_0xfa9982[_0xac73('0x3e')]=_[_0xac73('0x3d')](_0x4b65ac[_0xac73('0x3a')],qs[_0xac73('0x3f')](_0x163f58[_0xac73('0x3b')][_0xac73('0x3f')]));_0xfa9982['attributes']=_0xfa9982[_0xac73('0x3e')][_0xac73('0x40')]?_0xfa9982[_0xac73('0x3e')]:_0x4b65ac[_0xac73('0x3a')];if(!_0x163f58[_0xac73('0x3b')][_0xac73('0x41')](_0xac73('0x42'))){_0xfa9982[_0xac73('0x27')]=qs[_0xac73('0x27')](_0x163f58[_0xac73('0x3b')]['limit']);_0xfa9982[_0xac73('0x24')]=qs[_0xac73('0x24')](_0x163f58['query'][_0xac73('0x24')]);}_0xfa9982[_0xac73('0x43')]=qs[_0xac73('0x44')](_0x163f58[_0xac73('0x3b')][_0xac73('0x44')]);_0xfa9982[_0xac73('0x45')]=qs[_0xac73('0x46')](_[_0xac73('0x47')](_0x163f58[_0xac73('0x3b')],_0x4b65ac[_0xac73('0x46')]),_0x2efa0e);if(_0x163f58[_0xac73('0x3b')][_0xac73('0x48')]){_0xfa9982[_0xac73('0x45')]=_[_0xac73('0x49')](_0xfa9982[_0xac73('0x45')],{'$or':_[_0xac73('0x35')](_0x2efa0e,function(_0x512aed){if(_0x512aed['type']!==_0xac73('0x4a')){var _0x51a5d1={};_0x51a5d1[_0x512aed[_0xac73('0x32')]]={'$like':'%'+_0x163f58[_0xac73('0x3b')][_0xac73('0x48')]+'%'};return _0x51a5d1;}})});}_0xfa9982=_[_0xac73('0x49')]({},_0xfa9982,_0x163f58['options']);var _0x4a279d={'where':_0xfa9982[_0xac73('0x45')]};return db[_0xac73('0x36')][_0xac73('0x26')](_0x4a279d)[_0xac73('0x2d')](function(_0x24d186){_0x156562[_0xac73('0x26')]=_0x24d186;if(_0x163f58[_0xac73('0x3b')][_0xac73('0x4b')]){_0xfa9982[_0xac73('0x4c')]=[{'all':!![]}];}return db[_0xac73('0x36')][_0xac73('0x4d')](_0xfa9982);})[_0xac73('0x2d')](function(_0x3bc6a9){_0x156562[_0xac73('0x4e')]=_0x3bc6a9;return _0x156562;})[_0xac73('0x2d')](respondWithFilteredResult(_0x52baae,_0xfa9982))['catch'](handleError(_0x52baae,null));};exports[_0xac73('0x4f')]=function(_0x58bf0a,_0x179d40){var _0x48f9c0={'raw':!![],'where':{'id':_0x58bf0a['params']['id']}},_0x5e1c6b={};_0x5e1c6b[_0xac73('0x3a')]=_[_0xac73('0x3c')](db[_0xac73('0x36')][_0xac73('0x37')]);_0x5e1c6b['query']=_[_0xac73('0x3c')](_0x58bf0a[_0xac73('0x3b')]);_0x5e1c6b[_0xac73('0x46')]=_['intersection'](_0x5e1c6b[_0xac73('0x3a')],_0x5e1c6b['query']);_0x48f9c0[_0xac73('0x3e')]=_[_0xac73('0x3d')](_0x5e1c6b[_0xac73('0x3a')],qs['fields'](_0x58bf0a[_0xac73('0x3b')][_0xac73('0x3f')]));_0x48f9c0[_0xac73('0x3e')]=_0x48f9c0[_0xac73('0x3e')][_0xac73('0x40')]?_0x48f9c0[_0xac73('0x3e')]:_0x5e1c6b[_0xac73('0x3a')];if(_0x58bf0a[_0xac73('0x3b')][_0xac73('0x4b')]){_0x48f9c0[_0xac73('0x4c')]=[{'all':!![]}];}_0x48f9c0=_[_0xac73('0x49')]({},_0x48f9c0,_0x58bf0a[_0xac73('0x50')]);return db['OpenchannelQueue']['find'](_0x48f9c0)[_0xac73('0x2d')](handleEntityNotFound(_0x179d40,null))['then'](respondWithResult(_0x179d40,null))[_0xac73('0x51')](handleError(_0x179d40,null));};exports[_0xac73('0x52')]=function(_0x20c1fc,_0x500bf7){return db[_0xac73('0x36')][_0xac73('0x52')](_0x20c1fc[_0xac73('0x53')],{})[_0xac73('0x2d')](function(_0x30ad7f){var _0x2a78fa=_0x20c1fc['user'][_0xac73('0x2f')]({'plain':!![]});if(!_0x2a78fa)throw new Error(_0xac73('0x54'));if(_0x2a78fa[_0xac73('0x55')]==='user'){var _0x38958=_0x30ad7f[_0xac73('0x2f')]({'plain':!![]});var _0x183b56='OpenchannelQueues';return db[_0xac73('0x56')][_0xac73('0x57')]({'where':{'name':_0x183b56,'userProfileId':_0x2a78fa[_0xac73('0x58')]},'raw':!![]})[_0xac73('0x2d')](function(_0xcb80f6){if(_0xcb80f6&&_0xcb80f6['autoAssociation']===0x0){return db['UserProfileResource'][_0xac73('0x52')]({'name':_0x38958[_0xac73('0x32')],'resourceId':_0x38958['id'],'type':_0xcb80f6[_0xac73('0x32')],'sectionId':_0xcb80f6['id']},{})['then'](function(){return _0x30ad7f;});}else{return _0x30ad7f;}})[_0xac73('0x51')](function(_0x5d5634){logger[_0xac73('0x31')](_0xac73('0x59'),_0x5d5634);throw _0x5d5634;});}return _0x30ad7f;})[_0xac73('0x2d')](respondWithResult(_0x500bf7,0xc9))[_0xac73('0x51')](handleError(_0x500bf7,null));};exports[_0xac73('0x5a')]=function(_0x3b23cb,_0x24b3ad){if(_0x3b23cb[_0xac73('0x53')]['id']){delete _0x3b23cb[_0xac73('0x53')]['id'];}return db[_0xac73('0x36')]['find']({'where':{'id':_0x3b23cb[_0xac73('0x5b')]['id']}})['then'](handleEntityNotFound(_0x24b3ad,null))['then'](saveUpdates(_0x3b23cb[_0xac73('0x53')],null))[_0xac73('0x2d')](respondWithResult(_0x24b3ad,null))[_0xac73('0x51')](handleError(_0x24b3ad,null));};exports[_0xac73('0x2e')]=function(_0x130bc6,_0x4e3d15){return db[_0xac73('0x36')][_0xac73('0x57')]({'where':{'id':_0x130bc6[_0xac73('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4e3d15,null))[_0xac73('0x2d')](removeEntity(_0x4e3d15,null))[_0xac73('0x51')](handleError(_0x4e3d15,null));};exports[_0xac73('0x5c')]=function(_0x32255e,_0x21fa62){return db[_0xac73('0x36')]['describe']()[_0xac73('0x2d')](respondWithResult(_0x21fa62,null))['catch'](handleError(_0x21fa62,null));};exports[_0xac73('0x5d')]=function(_0xaf5f8e,_0x23bcd2,_0x4ef541){var _0x178b0e={'raw':!![],'where':{}},_0x443ece={},_0x41cc43;return db[_0xac73('0x36')]['findOne']({'where':{'id':_0xaf5f8e['params']['id']}})[_0xac73('0x2d')](handleEntityNotFound(_0x23bcd2,null))[_0xac73('0x2d')](function(_0x29a1e8){if(_0x29a1e8){_0x41cc43=_0x29a1e8[_0xac73('0x2f')]({'plain':!![]});_0x443ece[_0xac73('0x3a')]=_[_0xac73('0x3c')](db[_0xac73('0x5e')][_0xac73('0x37')]);_0x443ece[_0xac73('0x3b')]=_[_0xac73('0x3c')](_0xaf5f8e[_0xac73('0x3b')]);_0x443ece[_0xac73('0x46')]=_[_0xac73('0x3d')](_0x443ece[_0xac73('0x3a')],_0x443ece[_0xac73('0x3b')]);_0x178b0e[_0xac73('0x3e')]=_[_0xac73('0x3d')](_0x443ece[_0xac73('0x3a')],qs[_0xac73('0x3f')](_0xaf5f8e[_0xac73('0x3b')][_0xac73('0x3f')]));_0x178b0e[_0xac73('0x3e')]=_0x178b0e[_0xac73('0x3e')][_0xac73('0x40')]?_0x178b0e[_0xac73('0x3e')]:_0x443ece[_0xac73('0x3a')];if(!_0xaf5f8e[_0xac73('0x3b')][_0xac73('0x41')]('nolimit')){_0x178b0e[_0xac73('0x27')]=qs[_0xac73('0x27')](_0xaf5f8e['query'][_0xac73('0x27')]);_0x178b0e[_0xac73('0x24')]=qs[_0xac73('0x24')](_0xaf5f8e['query'][_0xac73('0x24')]);}_0x178b0e[_0xac73('0x43')]=qs['sort'](_0xaf5f8e['query']['sort']);_0x178b0e[_0xac73('0x45')]=qs[_0xac73('0x46')](_[_0xac73('0x47')](_0xaf5f8e[_0xac73('0x3b')],_0x443ece[_0xac73('0x46')]));_0x178b0e[_0xac73('0x45')][_0xac73('0x5f')]=_0x29a1e8['id'];if(_0xaf5f8e['query'][_0xac73('0x48')]){_0x178b0e['where']=_[_0xac73('0x49')](_0x178b0e[_0xac73('0x45')],{'$or':_[_0xac73('0x35')](_0x178b0e['attributes'],function(_0x52b2eb){var _0x52c991={};_0x52c991[_0x52b2eb]={'$like':'%'+_0xaf5f8e[_0xac73('0x3b')]['filter']+'%'};return _0x52c991;})});}_0x178b0e=_['merge']({},_0x178b0e,_0xaf5f8e[_0xac73('0x50')]);return db[_0xac73('0x5e')][_0xac73('0x4d')](_0x178b0e);}})[_0xac73('0x2d')](function(_0x185b27){if(_0x185b27){return db[_0xac73('0x60')][_0xac73('0x61')]({'where':{'id':_[_0xac73('0x35')](_0x185b27,_0xac73('0x62')),'role':_0xac73('0x63')},'attributes':['id','name',_0xac73('0x64'),'updatedAt',_0xac73('0x65')]});}})[_0xac73('0x2d')](function(_0x2c7c6f){if(_0x2c7c6f){return{'count':_0x2c7c6f[_0xac73('0x26')],'rows':_[_0xac73('0x35')](_0x2c7c6f['rows'],function(_0x5608f9){return{'membername':_0x5608f9[_0xac73('0x32')],'UserId':_0x5608f9['id'],'queue_name':_0x41cc43[_0xac73('0x32')],'OpenchannelQueueId':_0x41cc43['id'],'interface':util[_0xac73('0x66')](_0xac73('0x67'),_0xac73('0x68'),_0x5608f9[_0xac73('0x32')]),'penalty':0x0,'paused':_0x5608f9['openchannelPause'],'createdAt':_0x5608f9[_0xac73('0x65')],'updatedAt':_0x5608f9[_0xac73('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac73('0x2d')](respondWithFilteredResult(_0x23bcd2,_0x178b0e))[_0xac73('0x51')](handleError(_0x23bcd2,null));};exports[_0xac73('0x6a')]=function(_0x376a2c,_0x3cc96b,_0x2984f3){var _0x3801d7={};var _0x56973b={};var _0x57c876;var _0x1418c4;return db[_0xac73('0x36')][_0xac73('0x6b')]({'where':{'id':_0x376a2c[_0xac73('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3cc96b,null))[_0xac73('0x2d')](function(_0x5ec3ac){if(_0x5ec3ac){_0x57c876=_0x5ec3ac;_0x56973b[_0xac73('0x3a')]=_['keys'](db[_0xac73('0x6c')][_0xac73('0x37')]);_0x56973b['query']=_[_0xac73('0x3c')](_0x376a2c['query']);_0x56973b[_0xac73('0x46')]=_['intersection'](_0x56973b[_0xac73('0x3a')],_0x56973b[_0xac73('0x3b')]);_0x3801d7[_0xac73('0x3e')]=_['intersection'](_0x56973b[_0xac73('0x3a')],qs[_0xac73('0x3f')](_0x376a2c['query'][_0xac73('0x3f')]));_0x3801d7[_0xac73('0x3e')]=_0x3801d7['attributes'][_0xac73('0x40')]?_0x3801d7[_0xac73('0x3e')]:_0x56973b[_0xac73('0x3a')];_0x3801d7[_0xac73('0x43')]=qs[_0xac73('0x44')](_0x376a2c[_0xac73('0x3b')][_0xac73('0x44')]);_0x3801d7[_0xac73('0x45')]=qs['filters'](_[_0xac73('0x47')](_0x376a2c['query'],_0x56973b[_0xac73('0x46')]));if(_0x376a2c[_0xac73('0x3b')][_0xac73('0x48')]){_0x3801d7[_0xac73('0x45')]=_[_0xac73('0x49')](_0x3801d7['where'],{'$or':_[_0xac73('0x35')](_0x3801d7['attributes'],function(_0x480702){var _0x509ec1={};_0x509ec1[_0x480702]={'$like':'%'+_0x376a2c[_0xac73('0x3b')][_0xac73('0x48')]+'%'};return _0x509ec1;})});}_0x3801d7=_[_0xac73('0x49')]({},_0x3801d7,_0x376a2c[_0xac73('0x50')]);return _0x57c876['getTeams'](_0x3801d7);}})[_0xac73('0x2d')](function(_0x1beb16){if(_0x1beb16){_0x1418c4=_0x1beb16[_0xac73('0x40')];if(!_0x376a2c[_0xac73('0x3b')]['hasOwnProperty'](_0xac73('0x42'))){_0x3801d7[_0xac73('0x27')]=qs[_0xac73('0x27')](_0x376a2c[_0xac73('0x3b')]['limit']);_0x3801d7[_0xac73('0x24')]=qs[_0xac73('0x24')](_0x376a2c[_0xac73('0x3b')]['offset']);}return _0x57c876[_0xac73('0x6a')](_0x3801d7);}})[_0xac73('0x2d')](function(_0x2e1085){if(_0x2e1085){return _0x2e1085?{'count':_0x1418c4,'rows':_0x2e1085}:null;}})[_0xac73('0x2d')](respondWithResult(_0x3cc96b,null))[_0xac73('0x51')](handleError(_0x3cc96b,null));};exports['addTeams']=function(_0x378b98,_0x4e562f,_0x36afc8){var _0xb54557=_0x378b98[_0xac73('0x53')][_0xac73('0x6d')];return db[_0xac73('0x6c')][_0xac73('0x4d')]({'where':{'id':_0xb54557},'attributes':['id'],'include':[{'model':db[_0xac73('0x60')],'as':_0xac73('0x6e'),'attributes':['id',_0xac73('0x32'),_0xac73('0x6f'),_0xac73('0x70'),_0xac73('0x71')],'raw':!![]}]})[_0xac73('0x2d')](function(_0x20b3d6){if(_0x20b3d6){var _0xfb079=_[_0xac73('0x72')](_0x20b3d6,function(_0x4a9eae){var _0x9c6a0a=_0x4a9eae[_0xac73('0x2f')]({'plain':!![]});return _0x9c6a0a['Agents'];});return db['OpenchannelQueue'][_0xac73('0x57')]({'where':{'id':_0x378b98[_0xac73('0x5b')]['id']}})[_0xac73('0x2d')](function(_0x262b6f){return db[_0xac73('0x73')]['transaction'](function(_0x49b22c){return _0x262b6f[_0xac73('0x74')](_0xb54557,{'transaction':_0x49b22c})['then'](function(){return BPromise['each'](_0xfb079,function(_0x4125c7){return db[_0xac73('0x5e')][_0xac73('0x75')]({'where':{'UserId':_0x4125c7['id'],'OpenchannelQueueId':_0x378b98[_0xac73('0x5b')]['id']},'transaction':_0x49b22c});});})[_0xac73('0x2d')](function(){_0xfb079[_0xac73('0x76')](function(_0x432b96){socket[_0xac73('0x77')](_0xac73('0x78'),{'UserId':_0x432b96['id'],'OpenchannelQueueId':_0x262b6f['id']});});});});});}})[_0xac73('0x2d')](respondWithStatusCode(_0x4e562f,null))[_0xac73('0x51')](handleError(_0x4e562f,null));};exports[_0xac73('0x79')]=function(_0x50cd4c,_0x1714ea,_0x5deaf8){return db['Team'][_0xac73('0x4d')]({'where':{'id':_0x50cd4c[_0xac73('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0xac73('0x60')],'as':_0xac73('0x6e'),'attributes':['id'],'raw':!![]}]})[_0xac73('0x2d')](handleEntityNotFound(_0x1714ea,null))['then'](function(_0x5143ef){var _0x1fafe6=_['map'](_0x5143ef,'id');var _0x2d8d2c=[];var _0xddcde2=[];var _0x2133be=squel[_0xac73('0x7a')]();_0x2133be[_0xac73('0x7b')](_0xac73('0x7c'))['from']('team_has_openchannel_queues','tq')[_0xac73('0x7d')]('user_has_teams','ut',_0xac73('0x7e'))['where']('OpenchannelQueueId\x20=\x20?',_0x50cd4c[_0xac73('0x5b')]['id']);for(var _0x3ea066=0x0;_0x3ea066<_0x5143ef[_0xac73('0x40')];_0x3ea066+=0x1){let _0x3938c9=_0x5143ef[_0x3ea066];for(var _0x5aae0e=0x0;_0x5aae0e<_0x3938c9['Agents'][_0xac73('0x40')];_0x5aae0e+=0x1){let _0x292cb6=_0x3938c9[_0xac73('0x6e')][_0x5aae0e];var _0x138fd1=_0x2133be[_0xac73('0x7f')]();_0x138fd1['where']('ut.UserId\x20=\x20?',_0x292cb6['id']);_0xddcde2['push'](db['sequelize'][_0xac73('0x3b')](_0x138fd1['toString'](),{'type':db[_0xac73('0x73')][_0xac73('0x80')][_0xac73('0x81')]})['then'](function(_0x4f6ba2){if(_0x4f6ba2[_0xac73('0x40')]===0x1){return _0x292cb6['id'];}else{var _0x62c1ad=_[_0xac73('0x82')](_['map'](_0x4f6ba2,_0xac73('0x83')),function(_0x5cf0c5){return _[_0xac73('0x84')](_0x1fafe6,_0x5cf0c5);});if(_0x62c1ad){return _0x292cb6['id'];}}}));}}return BPromise[_0xac73('0x85')](_0xddcde2)[_0xac73('0x2d')](function(_0x32f958){_0x2d8d2c=_(_0x2d8d2c)[_0xac73('0x86')](_0x32f958)[_0xac73('0x87')]()[_0xac73('0x88')]();return db[_0xac73('0x36')][_0xac73('0x57')]({'where':{'id':_0x50cd4c[_0xac73('0x5b')]['id']}})['then'](function(_0x319bf0){return db[_0xac73('0x73')][_0xac73('0x89')](function(_0x4600e9){return _0x319bf0[_0xac73('0x79')](_0x50cd4c['query'][_0xac73('0x6d')],{'transaction':_0x4600e9})['then'](function(){if(!_[_0xac73('0x8a')](_0x2d8d2c)){return _0x319bf0[_0xac73('0x8b')](_0x2d8d2c,{'transaction':_0x4600e9});}})[_0xac73('0x2d')](function(){_0x2d8d2c['forEach'](function(_0x4f90ce){socket[_0xac73('0x77')]('userOpenchannelQueue:remove',{'UserId':_0x4f90ce,'OpenchannelQueueId':_0x319bf0['id']});});});});});});})[_0xac73('0x2d')](respondWithStatusCode(_0x1714ea,null))[_0xac73('0x51')](handleError(_0x1714ea,null));};exports[_0xac73('0x8c')]=function(_0x4d5d9c,_0x1f6b04,_0x278ed8){return db[_0xac73('0x36')][_0xac73('0x57')]({'where':{'id':_0x4d5d9c[_0xac73('0x5b')]['id']}})[_0xac73('0x2d')](handleEntityNotFound(_0x1f6b04,null))[_0xac73('0x2d')](function(_0x14e125){if(_0x14e125){return _0x14e125[_0xac73('0x8c')](_0x4d5d9c[_0xac73('0x53')][_0xac73('0x6d')],_['omit'](_0x4d5d9c[_0xac73('0x53')],[_0xac73('0x6d'),'id'])||{})[_0xac73('0x8d')](function(_0x3ace3c){for(var _0x4d1de8=0x0;_0x4d1de8<_0x4d5d9c[_0xac73('0x53')][_0xac73('0x6d')][_0xac73('0x40')];_0x4d1de8+=0x1){socket[_0xac73('0x77')](_0xac73('0x78'),{'UserId':Number(_0x4d5d9c[_0xac73('0x53')][_0xac73('0x6d')][_0x4d1de8]),'OpenchannelQueueId':Number(_0x4d5d9c[_0xac73('0x5b')]['id'])});}return _0x3ace3c;});}})['then'](respondWithResult(_0x1f6b04,null))['catch'](handleError(_0x1f6b04,null));};exports[_0xac73('0x8b')]=function(_0x463395,_0x4ab9ab,_0x4e42a8){return db['OpenchannelQueue'][_0xac73('0x57')]({'where':{'id':_0x463395['params']['id']}})[_0xac73('0x2d')](handleEntityNotFound(_0x4ab9ab,null))[_0xac73('0x2d')](function(_0x4963c1){if(_0x4963c1){return _0x4963c1['removeAgents'](_0x463395[_0xac73('0x3b')][_0xac73('0x6d')])['then'](function(){if(_[_0xac73('0x8e')](_0x463395['query'][_0xac73('0x6d')])){for(var _0x488906=0x0;_0x488906<_0x463395[_0xac73('0x3b')][_0xac73('0x6d')][_0xac73('0x40')];_0x488906+=0x1){socket[_0xac73('0x77')](_0xac73('0x8f'),{'UserId':Number(_0x463395[_0xac73('0x3b')][_0xac73('0x6d')][_0x488906]),'OpenchannelQueueId':Number(_0x463395[_0xac73('0x5b')]['id'])});}}else{socket[_0xac73('0x77')]('userOpenchannelQueue:remove',{'UserId':Number(_0x463395['query'][_0xac73('0x6d')]),'OpenchannelQueueId':Number(_0x463395['params']['id'])});}});}})[_0xac73('0x2d')](respondWithStatusCode(_0x4ab9ab,null))[_0xac73('0x51')](handleError(_0x4ab9ab,null));};exports['getAgents']=function(_0x21ae58,_0x586995,_0x55554e){var _0x19f68d={};var _0x2bbafc={};var _0x770dfd;var _0x5070c2;return db[_0xac73('0x36')][_0xac73('0x6b')]({'where':{'id':_0x21ae58[_0xac73('0x5b')]['id']}})['then'](handleEntityNotFound(_0x586995,null))[_0xac73('0x2d')](function(_0x463f23){if(_0x463f23){_0x770dfd=_0x463f23;_0x2bbafc[_0xac73('0x3a')]=_[_0xac73('0x3c')](db[_0xac73('0x60')][_0xac73('0x37')]);_0x2bbafc[_0xac73('0x3b')]=_[_0xac73('0x3c')](_0x21ae58[_0xac73('0x3b')]);_0x2bbafc[_0xac73('0x46')]=_['intersection'](_0x2bbafc['model'],_0x2bbafc[_0xac73('0x3b')]);_0x19f68d[_0xac73('0x3e')]=_['intersection'](_0x2bbafc[_0xac73('0x3a')],qs[_0xac73('0x3f')](_0x21ae58[_0xac73('0x3b')][_0xac73('0x3f')]));_0x19f68d[_0xac73('0x3e')]=_0x19f68d[_0xac73('0x3e')][_0xac73('0x40')]?_0x19f68d[_0xac73('0x3e')]:_0x2bbafc[_0xac73('0x3a')];_0x19f68d[_0xac73('0x43')]=qs[_0xac73('0x44')](_0x21ae58[_0xac73('0x3b')]['sort']);_0x19f68d[_0xac73('0x45')]=qs[_0xac73('0x46')](_[_0xac73('0x47')](_0x21ae58[_0xac73('0x3b')],_0x2bbafc['filters']));if(_0x21ae58[_0xac73('0x3b')]['filter']){_0x19f68d[_0xac73('0x45')]=_[_0xac73('0x49')](_0x19f68d['where'],{'$or':_[_0xac73('0x35')](_0x19f68d[_0xac73('0x3e')],function(_0x38785b){var _0x193ac8={};_0x193ac8[_0x38785b]={'$like':'%'+_0x21ae58[_0xac73('0x3b')][_0xac73('0x48')]+'%'};return _0x193ac8;})});}_0x19f68d=_[_0xac73('0x49')]({},_0x19f68d,_0x21ae58[_0xac73('0x50')]);return _0x770dfd[_0xac73('0x90')](_0x19f68d);}})[_0xac73('0x2d')](function(_0x1fa478){if(_0x1fa478){_0x5070c2=_0x1fa478['length'];if(!_0x21ae58[_0xac73('0x3b')][_0xac73('0x41')]('nolimit')){_0x19f68d[_0xac73('0x27')]=qs[_0xac73('0x27')](_0x21ae58['query'][_0xac73('0x27')]);_0x19f68d['offset']=qs['offset'](_0x21ae58[_0xac73('0x3b')][_0xac73('0x24')]);}return _0x770dfd[_0xac73('0x90')](_0x19f68d);}})[_0xac73('0x2d')](function(_0x3d05f3){if(_0x3d05f3){return _0x3d05f3?{'count':_0x5070c2,'rows':_0x3d05f3}:null;}})[_0xac73('0x2d')](respondWithResult(_0x586995,null))[_0xac73('0x51')](handleError(_0x586995,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6dac1b1..e700b0e 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 _0x5860=['events','../../mysqldb','setMaxListeners','update','remove','emit','hook','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5860,0x180));var _0x0586=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0x5860[_0x21f931];return _0x3f083c;};'use strict';var EventEmitter=require(_0x0586('0x0'));var OpenchannelQueue=require(_0x0586('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0586('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0586('0x3'),'afterDestroy':_0x0586('0x4')};function emitEvent(_0x1f8264){return function(_0x4ceef2,_0x386497,_0x2661ac){OpenchannelQueueEvents[_0x0586('0x5')](_0x1f8264+':'+_0x4ceef2['id'],_0x4ceef2);OpenchannelQueueEvents[_0x0586('0x5')](_0x1f8264,_0x4ceef2);_0x2661ac(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x0586('0x6')](e,emitEvent(event));}}module[_0x0586('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x27b8=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0x5af70d,_0x390da0){var _0x5d233f=function(_0x879e){while(--_0x879e){_0x5af70d['push'](_0x5af70d['shift']());}};_0x5d233f(++_0x390da0);}(_0x27b8,0x9f));var _0x827b=function(_0x32c44f,_0x4c6469){_0x32c44f=_0x32c44f-0x0;var _0x262b0a=_0x27b8[_0x32c44f];return _0x262b0a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x827b('0x0'))['db'][_0x827b('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x827b('0x2')](0x0);var events={'afterCreate':_0x827b('0x3'),'afterUpdate':_0x827b('0x4'),'afterDestroy':_0x827b('0x5')};function emitEvent(_0x4216e6){return function(_0x3d8218,_0x11277a,_0x579ce0){OpenchannelQueueEvents[_0x827b('0x6')](_0x4216e6+':'+_0x3d8218['id'],_0x3d8218);OpenchannelQueueEvents['emit'](_0x4216e6,_0x3d8218);_0x579ce0(null);};}for(var e in events){if(events[_0x827b('0x7')](e)){var event=events[e];OpenchannelQueue[_0x827b('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index f4bd471..47ef477 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 _0xed38=['OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xed38,0x1c5));var _0x8ed3=function(_0x3d3e10,_0x47672e){_0x3d3e10=_0x3d3e10-0x0;var _0x193210=_0xed38[_0x3d3e10];return _0x193210;};'use strict';var _=require(_0x8ed3('0x0'));var util=require(_0x8ed3('0x1'));var logger=require(_0x8ed3('0x2'))(_0x8ed3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ed3('0x4'));var fs=require('fs');var path=require(_0x8ed3('0x5'));var rimraf=require('rimraf');var config=require(_0x8ed3('0x6'));var attributes=require(_0x8ed3('0x7'));module[_0x8ed3('0x8')]=function(_0x4d26e1,_0x271349){return _0x4d26e1['define'](_0x8ed3('0x9'),attributes,{'tableName':_0x8ed3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22ec=['rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3ccc28,_0x5036d5){var _0x47dd45=function(_0xd86e79){while(--_0xd86e79){_0x3ccc28['push'](_0x3ccc28['shift']());}};_0x47dd45(++_0x5036d5);}(_0x22ec,0x117));var _0xc22e=function(_0x2c1e80,_0x34cca9){_0x2c1e80=_0x2c1e80-0x0;var _0x53a308=_0x22ec[_0x2c1e80];return _0x53a308;};'use strict';var _=require('lodash');var util=require(_0xc22e('0x0'));var logger=require(_0xc22e('0x1'))(_0xc22e('0x2'));var moment=require(_0xc22e('0x3'));var BPromise=require(_0xc22e('0x4'));var rp=require(_0xc22e('0x5'));var fs=require('fs');var path=require(_0xc22e('0x6'));var rimraf=require(_0xc22e('0x7'));var config=require(_0xc22e('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xc22e('0x9')]=function(_0x5d2896,_0x1739f1){return _0x5d2896[_0xc22e('0xa')](_0xc22e('0xb'),attributes,{'tableName':_0xc22e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 003c220..8ae88b7 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 _0x6cee=['register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model','debug','ShowOpenchannelQueue','then','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket'];(function(_0x1c1727,_0x28192c){var _0x567131=function(_0x17d513){while(--_0x17d513){_0x1c1727['push'](_0x1c1727['shift']());}};_0x567131(++_0x28192c);}(_0x6cee,0x1df));var _0xe6ce=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x6cee[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xe6ce('0x0'));var util=require('util');var moment=require(_0xe6ce('0x1'));var BPromise=require(_0xe6ce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6ce('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6ce('0x4'));var logger=require(_0xe6ce('0x5'))(_0xe6ce('0x6'));var config=require(_0xe6ce('0x7'));var jayson=require(_0xe6ce('0x8'));var client=jayson['client'][_0xe6ce('0x9')]({'port':0x232a});config[_0xe6ce('0xa')]=_[_0xe6ce('0xb')](config['redis'],{'host':_0xe6ce('0xc'),'port':0x18eb});var socket=require(_0xe6ce('0xd'))(new Redis(config[_0xe6ce('0xa')]));require(_0xe6ce('0xe'))[_0xe6ce('0xf')](socket);function respondWithRpcPromise(_0x50d0b0,_0x4fd853,_0x13cf9e){return new BPromise(function(_0x27b800,_0x32c345){return client[_0xe6ce('0x10')](_0x50d0b0,_0x13cf9e)['then'](function(_0x5f00d9){logger[_0xe6ce('0x11')](_0xe6ce('0x12'),_0x4fd853,_0xe6ce('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4fd853,_0xe6ce('0x13'),JSON[_0xe6ce('0x14')](_0x5f00d9));if(_0x5f00d9[_0xe6ce('0x15')]){if(_0x5f00d9[_0xe6ce('0x15')][_0xe6ce('0x16')]===0x1f4){logger[_0xe6ce('0x15')](_0xe6ce('0x12'),_0x4fd853,_0x5f00d9[_0xe6ce('0x15')][_0xe6ce('0x17')]);return _0x32c345(_0x5f00d9['error'][_0xe6ce('0x17')]);}logger[_0xe6ce('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4fd853,_0x5f00d9[_0xe6ce('0x15')][_0xe6ce('0x17')]);return _0x27b800(_0x5f00d9[_0xe6ce('0x15')]['message']);}else{logger[_0xe6ce('0x11')](_0xe6ce('0x12'),_0x4fd853,_0xe6ce('0x13'));_0x27b800(_0x5f00d9['result'][_0xe6ce('0x17')]);}})[_0xe6ce('0x18')](function(_0x122847){logger[_0xe6ce('0x15')](_0xe6ce('0x12'),_0x4fd853,_0x122847);_0x32c345(_0x122847);});});}exports[_0xe6ce('0x19')]=function(_0x192c81){var _0x42cd1d=this;return new Promise(function(_0x289c2f,_0x17d71e){return db[_0xe6ce('0x1a')]['findAll']({'raw':_0x192c81['options']?_0x192c81[_0xe6ce('0x1b')][_0xe6ce('0x1c')]===undefined?!![]:![]:!![],'where':_0x192c81['options']?_0x192c81[_0xe6ce('0x1b')][_0xe6ce('0x1d')]||null:null,'attributes':_0x192c81['options']?_0x192c81[_0xe6ce('0x1b')][_0xe6ce('0x1e')]||null:null,'limit':_0x192c81[_0xe6ce('0x1b')]?_0x192c81[_0xe6ce('0x1b')][_0xe6ce('0x1f')]||null:null,'include':_0x192c81[_0xe6ce('0x1b')]?_0x192c81['options'][_0xe6ce('0x20')]?_[_0xe6ce('0x21')](_0x192c81[_0xe6ce('0x1b')]['include'],function(_0x3af0e3){return{'model':db[_0x3af0e3[_0xe6ce('0x22')]],'as':_0x3af0e3['as'],'attributes':_0x3af0e3['attributes'],'include':_0x3af0e3['include']?_[_0xe6ce('0x21')](_0x3af0e3[_0xe6ce('0x20')],function(_0x5f2abe){return{'model':db[_0x5f2abe[_0xe6ce('0x22')]],'as':_0x5f2abe['as'],'attributes':_0x5f2abe[_0xe6ce('0x1e')],'include':_0x5f2abe[_0xe6ce('0x20')]?_[_0xe6ce('0x21')](_0x5f2abe[_0xe6ce('0x20')],function(_0x576d5a){return{'model':db[_0x576d5a[_0xe6ce('0x22')]],'as':_0x576d5a['as'],'attributes':_0x576d5a[_0xe6ce('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x408ba7){logger[_0xe6ce('0x11')](_0xe6ce('0x19'),_0x192c81);logger[_0xe6ce('0x23')](_0xe6ce('0x19'),_0x192c81,JSON[_0xe6ce('0x14')](_0x408ba7));_0x289c2f(_0x408ba7);})[_0xe6ce('0x18')](function(_0x2b32ef){logger[_0xe6ce('0x15')](_0xe6ce('0x19'),_0x2b32ef[_0xe6ce('0x17')],_0x192c81);_0x17d71e(_0x42cd1d[_0xe6ce('0x15')](0x1f4,_0x2b32ef[_0xe6ce('0x17')]));});});};exports[_0xe6ce('0x24')]=function(_0x11c80f){var _0x15d1a0=this;return new Promise(function(_0x254d82,_0x262e0e){return db['OpenchannelQueue']['find']({'raw':_0x11c80f[_0xe6ce('0x1b')]?_0x11c80f[_0xe6ce('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x11c80f[_0xe6ce('0x1b')]?_0x11c80f[_0xe6ce('0x1b')][_0xe6ce('0x1d')]||null:null,'attributes':_0x11c80f[_0xe6ce('0x1b')]?_0x11c80f[_0xe6ce('0x1b')][_0xe6ce('0x1e')]||null:null,'include':_0x11c80f[_0xe6ce('0x1b')]?_0x11c80f[_0xe6ce('0x1b')][_0xe6ce('0x20')]?_['map'](_0x11c80f['options'][_0xe6ce('0x20')],function(_0x38fe65){return{'model':db[_0x38fe65[_0xe6ce('0x22')]],'as':_0x38fe65['as'],'attributes':_0x38fe65['attributes'],'include':_0x38fe65[_0xe6ce('0x20')]?_[_0xe6ce('0x21')](_0x38fe65[_0xe6ce('0x20')],function(_0x15f043){return{'model':db[_0x15f043[_0xe6ce('0x22')]],'as':_0x15f043['as'],'attributes':_0x15f043[_0xe6ce('0x1e')],'include':_0x15f043[_0xe6ce('0x20')]?_[_0xe6ce('0x21')](_0x15f043[_0xe6ce('0x20')],function(_0x4468df){return{'model':db[_0x4468df[_0xe6ce('0x22')]],'as':_0x4468df['as'],'attributes':_0x4468df['attributes']};}):[]};}):[]};}):[]:[]})[_0xe6ce('0x25')](function(_0x217f6f){logger['info']('ShowOpenchannelQueue',_0x11c80f);logger[_0xe6ce('0x23')](_0xe6ce('0x24'),_0x11c80f,JSON[_0xe6ce('0x14')](_0x217f6f));_0x254d82(_0x217f6f);})[_0xe6ce('0x18')](function(_0x3f28b2){logger['error']('ShowOpenchannelQueue',_0x3f28b2['message'],_0x11c80f);_0x262e0e(_0x15d1a0['error'](0x1f4,_0x3f28b2[_0xe6ce('0x17')]));});});}; \ No newline at end of file +var _0xf6d2=['register','request','then','info','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','include','map','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket'];(function(_0x32cc9a,_0xec746e){var _0x226b80=function(_0x5c266a){while(--_0x5c266a){_0x32cc9a['push'](_0x32cc9a['shift']());}};_0x226b80(++_0xec746e);}(_0xf6d2,0xe4));var _0x2f6d=function(_0x4d867b,_0x14ac64){_0x4d867b=_0x4d867b-0x0;var _0x24fca3=_0xf6d2[_0x4d867b];return _0x24fca3;};'use strict';var _=require(_0x2f6d('0x0'));var util=require('util');var moment=require(_0x2f6d('0x1'));var BPromise=require(_0x2f6d('0x2'));var rs=require(_0x2f6d('0x3'));var fs=require('fs');var Redis=require(_0x2f6d('0x4'));var db=require(_0x2f6d('0x5'))['db'];var utils=require(_0x2f6d('0x6'));var logger=require(_0x2f6d('0x7'))(_0x2f6d('0x8'));var config=require(_0x2f6d('0x9'));var jayson=require(_0x2f6d('0xa'));var client=jayson[_0x2f6d('0xb')][_0x2f6d('0xc')]({'port':0x232a});config[_0x2f6d('0xd')]=_[_0x2f6d('0xe')](config[_0x2f6d('0xd')],{'host':_0x2f6d('0xf'),'port':0x18eb});var socket=require(_0x2f6d('0x10'))(new Redis(config[_0x2f6d('0xd')]));require(_0x2f6d('0x11'))[_0x2f6d('0x12')](socket);function respondWithRpcPromise(_0x16c1f7,_0x5690b9,_0x5d2034){return new BPromise(function(_0x483022,_0x85bf96){return client[_0x2f6d('0x13')](_0x16c1f7,_0x5d2034)[_0x2f6d('0x14')](function(_0x38a196){logger[_0x2f6d('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5690b9,'request\x20sent');logger[_0x2f6d('0x16')](_0x2f6d('0x17'),_0x5690b9,_0x2f6d('0x18'),JSON[_0x2f6d('0x19')](_0x38a196));if(_0x38a196[_0x2f6d('0x1a')]){if(_0x38a196['error']['code']===0x1f4){logger[_0x2f6d('0x1a')](_0x2f6d('0x1b'),_0x5690b9,_0x38a196[_0x2f6d('0x1a')][_0x2f6d('0x1c')]);return _0x85bf96(_0x38a196[_0x2f6d('0x1a')]['message']);}logger[_0x2f6d('0x1a')](_0x2f6d('0x1b'),_0x5690b9,_0x38a196[_0x2f6d('0x1a')][_0x2f6d('0x1c')]);return _0x483022(_0x38a196[_0x2f6d('0x1a')][_0x2f6d('0x1c')]);}else{logger['info'](_0x2f6d('0x1b'),_0x5690b9,_0x2f6d('0x18'));_0x483022(_0x38a196['result'][_0x2f6d('0x1c')]);}})[_0x2f6d('0x1d')](function(_0x467f70){logger[_0x2f6d('0x1a')](_0x2f6d('0x1b'),_0x5690b9,_0x467f70);_0x85bf96(_0x467f70);});});}exports[_0x2f6d('0x1e')]=function(_0x2616f6){var _0x5a4daa=this;return new Promise(function(_0x305cb8,_0x3c92c1){return db[_0x2f6d('0x1f')]['findAll']({'raw':_0x2616f6[_0x2f6d('0x20')]?_0x2616f6['options'][_0x2f6d('0x21')]===undefined?!![]:![]:!![],'where':_0x2616f6['options']?_0x2616f6['options'][_0x2f6d('0x22')]||null:null,'attributes':_0x2616f6[_0x2f6d('0x20')]?_0x2616f6[_0x2f6d('0x20')][_0x2f6d('0x23')]||null:null,'limit':_0x2616f6[_0x2f6d('0x20')]?_0x2616f6[_0x2f6d('0x20')]['limit']||null:null,'include':_0x2616f6[_0x2f6d('0x20')]?_0x2616f6['options'][_0x2f6d('0x24')]?_[_0x2f6d('0x25')](_0x2616f6[_0x2f6d('0x20')][_0x2f6d('0x24')],function(_0x315d84){return{'model':db[_0x315d84[_0x2f6d('0x26')]],'as':_0x315d84['as'],'attributes':_0x315d84[_0x2f6d('0x23')],'include':_0x315d84['include']?_[_0x2f6d('0x25')](_0x315d84[_0x2f6d('0x24')],function(_0x2108e9){return{'model':db[_0x2108e9[_0x2f6d('0x26')]],'as':_0x2108e9['as'],'attributes':_0x2108e9[_0x2f6d('0x23')],'include':_0x2108e9[_0x2f6d('0x24')]?_[_0x2f6d('0x25')](_0x2108e9[_0x2f6d('0x24')],function(_0x3926ba){return{'model':db[_0x3926ba['model']],'as':_0x3926ba['as'],'attributes':_0x3926ba[_0x2f6d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2f6d('0x14')](function(_0x1bb7f0){logger[_0x2f6d('0x15')]('GetOpenchannelQueue',_0x2616f6);logger[_0x2f6d('0x16')]('GetOpenchannelQueue',_0x2616f6,JSON[_0x2f6d('0x19')](_0x1bb7f0));_0x305cb8(_0x1bb7f0);})[_0x2f6d('0x1d')](function(_0x41e5a5){logger[_0x2f6d('0x1a')](_0x2f6d('0x1e'),_0x41e5a5[_0x2f6d('0x1c')],_0x2616f6);_0x3c92c1(_0x5a4daa[_0x2f6d('0x1a')](0x1f4,_0x41e5a5['message']));});});};exports[_0x2f6d('0x27')]=function(_0x5e687f){var _0x2ff041=this;return new Promise(function(_0x4705bf,_0x4991e3){return db['OpenchannelQueue'][_0x2f6d('0x28')]({'raw':_0x5e687f[_0x2f6d('0x20')]?_0x5e687f[_0x2f6d('0x20')][_0x2f6d('0x21')]===undefined?!![]:![]:!![],'where':_0x5e687f[_0x2f6d('0x20')]?_0x5e687f[_0x2f6d('0x20')]['where']||null:null,'attributes':_0x5e687f[_0x2f6d('0x20')]?_0x5e687f[_0x2f6d('0x20')][_0x2f6d('0x23')]||null:null,'include':_0x5e687f[_0x2f6d('0x20')]?_0x5e687f[_0x2f6d('0x20')][_0x2f6d('0x24')]?_['map'](_0x5e687f[_0x2f6d('0x20')][_0x2f6d('0x24')],function(_0x13750b){return{'model':db[_0x13750b['model']],'as':_0x13750b['as'],'attributes':_0x13750b[_0x2f6d('0x23')],'include':_0x13750b[_0x2f6d('0x24')]?_['map'](_0x13750b[_0x2f6d('0x24')],function(_0x571e8b){return{'model':db[_0x571e8b['model']],'as':_0x571e8b['as'],'attributes':_0x571e8b[_0x2f6d('0x23')],'include':_0x571e8b[_0x2f6d('0x24')]?_[_0x2f6d('0x25')](_0x571e8b['include'],function(_0x4a4ddc){return{'model':db[_0x4a4ddc[_0x2f6d('0x26')]],'as':_0x4a4ddc['as'],'attributes':_0x4a4ddc[_0x2f6d('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2f6d('0x14')](function(_0x295c1c){logger[_0x2f6d('0x15')](_0x2f6d('0x27'),_0x5e687f);logger[_0x2f6d('0x16')](_0x2f6d('0x27'),_0x5e687f,JSON['stringify'](_0x295c1c));_0x4705bf(_0x295c1c);})[_0x2f6d('0x1d')](function(_0x2cd7ee){logger[_0x2f6d('0x1a')](_0x2f6d('0x27'),_0x2cd7ee['message'],_0x5e687f);_0x4991e3(_0x2ff041[_0x2f6d('0x1a')](0x1f4,_0x2cd7ee['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cf63684..376a91d 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 _0xa4b8=['register','length','openchannelQueue:','save','remove','update','emit','removeListener'];(function(_0x43291d,_0x166561){var _0x6c48ff=function(_0x5a31a4){while(--_0x5a31a4){_0x43291d['push'](_0x43291d['shift']());}};_0x6c48ff(++_0x166561);}(_0xa4b8,0x1b3));var _0x8a4b=function(_0x5e60e4,_0x22236b){_0x5e60e4=_0x5e60e4-0x0;var _0x3e9bbd=_0xa4b8[_0x5e60e4];return _0x3e9bbd;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x8a4b('0x0'),_0x8a4b('0x1'),_0x8a4b('0x2')];function createListener(_0x4b8cbc,_0x4be54a){return function(_0x3811d8){_0x4be54a[_0x8a4b('0x3')](_0x4b8cbc,_0x3811d8);};}function removeListener(_0x522ca7,_0x406bf5){return function(){OpenchannelQueueEvents[_0x8a4b('0x4')](_0x522ca7,_0x406bf5);};}exports[_0x8a4b('0x5')]=function(_0x2c36ec){for(var _0x143fb6=0x0,_0x1283fd=events[_0x8a4b('0x6')];_0x143fb6<_0x1283fd;_0x143fb6++){var _0x1dfc05=events[_0x143fb6];var _0x6cbc52=createListener(_0x8a4b('0x7')+_0x1dfc05,_0x2c36ec);OpenchannelQueueEvents['on'](_0x1dfc05,_0x6cbc52);}}; \ No newline at end of file +var _0xd90f=['length','openchannelQueue:','./openchannelQueue.events','remove','emit'];(function(_0x4e0e2f,_0x1edeb4){var _0x64d2b2=function(_0x18059a){while(--_0x18059a){_0x4e0e2f['push'](_0x4e0e2f['shift']());}};_0x64d2b2(++_0x1edeb4);}(_0xd90f,0x16f));var _0xfd90=function(_0x2a3e21,_0xac0ae){_0x2a3e21=_0x2a3e21-0x0;var _0x3384c4=_0xd90f[_0x2a3e21];return _0x3384c4;};'use strict';var OpenchannelQueueEvents=require(_0xfd90('0x0'));var events=['save',_0xfd90('0x1'),'update'];function createListener(_0x32c872,_0x5e564a){return function(_0x74adcc){_0x5e564a[_0xfd90('0x2')](_0x32c872,_0x74adcc);};}function removeListener(_0x2b896a,_0x3f9587){return function(){OpenchannelQueueEvents['removeListener'](_0x2b896a,_0x3f9587);};}exports['register']=function(_0x539c9f){for(var _0x1ab3be=0x0,_0x1629fd=events[_0xfd90('0x3')];_0x1ab3be<_0x1629fd;_0x1ab3be++){var _0x26c239=events[_0x1ab3be];var _0x1197c0=createListener(_0xfd90('0x4')+_0x26c239,_0x539c9f);OpenchannelQueueEvents['on'](_0x26c239,_0x1197c0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 1585f98..849518f 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 _0x54ee=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x325673,_0x13c10b){var _0x741c5b=function(_0x33eeb2){while(--_0x33eeb2){_0x325673['push'](_0x325673['shift']());}};_0x741c5b(++_0x13c10b);}(_0x54ee,0xd3));var _0xe54e=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x54ee[_0x5317b5];return _0x3b7ce2;};'use strict';var multer=require(_0xe54e('0x0'));var util=require(_0xe54e('0x1'));var path=require(_0xe54e('0x2'));var timeout=require(_0xe54e('0x3'));var express=require('express');var router=express[_0xe54e('0x4')]();var fs_extra=require(_0xe54e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe54e('0x6'));router[_0xe54e('0x7')]('/',auth['isAuthenticated'](),controller[_0xe54e('0x8')]);router[_0xe54e('0x7')](_0xe54e('0x9'),auth[_0xe54e('0xa')](),controller['describe']);router[_0xe54e('0x7')](_0xe54e('0xb'),auth[_0xe54e('0xa')](),controller[_0xe54e('0xc')]);router[_0xe54e('0xd')]('/',auth[_0xe54e('0xa')](),controller[_0xe54e('0xe')]);router[_0xe54e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe54e('0x10')]);router[_0xe54e('0x11')](_0xe54e('0xb'),auth[_0xe54e('0xa')](),controller['destroy']);module[_0xe54e('0x12')]=router; \ No newline at end of file +var _0xa93f=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa93f,0x17c));var _0xfa93=function(_0x4a3bd9,_0x1187b2){_0x4a3bd9=_0x4a3bd9-0x0;var _0x583ee7=_0xa93f[_0x4a3bd9];return _0x583ee7;};'use strict';var multer=require(_0xfa93('0x0'));var util=require(_0xfa93('0x1'));var path=require(_0xfa93('0x2'));var timeout=require(_0xfa93('0x3'));var express=require(_0xfa93('0x4'));var router=express[_0xfa93('0x5')]();var fs_extra=require(_0xfa93('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfa93('0x7'));var config=require(_0xfa93('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0xfa93('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfa93('0xa'),auth[_0xfa93('0xb')](),controller['describe']);router[_0xfa93('0x9')](_0xfa93('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfa93('0xd')]('/',auth[_0xfa93('0xb')](),controller[_0xfa93('0xe')]);router[_0xfa93('0xf')]('/:id',auth[_0xfa93('0xb')](),controller[_0xfa93('0x10')]);router[_0xfa93('0x11')]('/:id',auth[_0xfa93('0xb')](),controller[_0xfa93('0x12')]);module[_0xfa93('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 66b93e1..22e9214 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 _0x4bfc=['moment','exports','STRING','DATE'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x4bfc,0x1ac));var _0xc4bf=function(_0x152983,_0x5ae82e){_0x152983=_0x152983-0x0;var _0x45c0b6=_0x4bfc[_0x152983];return _0x45c0b6;};'use strict';var moment=require(_0xc4bf('0x0'));var Sequelize=require('sequelize');module[_0xc4bf('0x1')]={'uniqueid':{'type':Sequelize[_0xc4bf('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xc4bf('0x2')]},'joinAt':{'type':Sequelize[_0xc4bf('0x3')]},'leaveAt':{'type':Sequelize[_0xc4bf('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xae35=['moment','sequelize','exports','STRING','DATE'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae35,0x172));var _0x5ae3=function(_0x47be69,_0x26a876){_0x47be69=_0x47be69-0x0;var _0x14d972=_0xae35[_0x47be69];return _0x14d972;};'use strict';var moment=require(_0x5ae3('0x0'));var Sequelize=require(_0x5ae3('0x1'));module[_0x5ae3('0x2')]={'uniqueid':{'type':Sequelize[_0x5ae3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5ae3('0x3')]},'joinAt':{'type':Sequelize[_0x5ae3('0x4')]},'leaveAt':{'type':Sequelize[_0x5ae3('0x4')]},'acceptAt':{'type':Sequelize[_0x5ae3('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x5ae3('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 37ececa..df7e27b 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 _0xe7a8=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','then','destroy','stack','name','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xe7a8,0x159));var _0x8e7a=function(_0x2b0f23,_0x152963){_0x2b0f23=_0x2b0f23-0x0;var _0x4e6ecb=_0xe7a8[_0x2b0f23];return _0x4e6ecb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e7a('0x0'));var zipdir=require(_0x8e7a('0x1'));var jsonpatch=require(_0x8e7a('0x2'));var rp=require('request-promise');var moment=require(_0x8e7a('0x3'));var BPromise=require(_0x8e7a('0x4'));var Mustache=require(_0x8e7a('0x5'));var util=require(_0x8e7a('0x6'));var path=require(_0x8e7a('0x7'));var sox=require(_0x8e7a('0x8'));var csv=require(_0x8e7a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e7a('0xa'));var _=require(_0x8e7a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8e7a('0xc'));var deskjs=require(_0x8e7a('0xd'));var toCsv=require(_0x8e7a('0x9'));var querystring=require(_0x8e7a('0xe'));var Papa=require(_0x8e7a('0xf'));var Redis=require(_0x8e7a('0x10'));var authService=require(_0x8e7a('0x11'));var qs=require(_0x8e7a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e7a('0x13'));var logger=require(_0x8e7a('0x14'))(_0x8e7a('0x15'));var utils=require(_0x8e7a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8e7a('0x17'))['db'];function respondWithStatusCode(_0x38a470,_0x355664){_0x355664=_0x355664||0xcc;return function(_0xac38c4){if(_0xac38c4){return _0x38a470[_0x8e7a('0x18')](_0x355664);}return _0x38a470['status'](_0x355664)[_0x8e7a('0x19')]();};}function respondWithResult(_0x300d77,_0x4bf278){_0x4bf278=_0x4bf278||0xc8;return function(_0xbdb661){if(_0xbdb661){return _0x300d77[_0x8e7a('0x1a')](_0x4bf278)[_0x8e7a('0x1b')](_0xbdb661);}};}function respondWithFilteredResult(_0x4edd9e,_0x4c4a88){return function(_0x4bed7d){if(_0x4bed7d){var _0x34fdf1=typeof _0x4c4a88[_0x8e7a('0x1c')]===_0x8e7a('0x1d')&&typeof _0x4c4a88['limit']===_0x8e7a('0x1d');var _0x54b841=_0x4bed7d[_0x8e7a('0x1e')];var _0x4c6e36=_0x34fdf1?0x0:_0x4c4a88['offset'];var _0x4436f5=_0x34fdf1?_0x4bed7d['count']:_0x4c4a88[_0x8e7a('0x1c')]+_0x4c4a88['limit'];var _0x2ac00d;if(_0x4436f5>=_0x54b841){_0x4436f5=_0x54b841;_0x2ac00d=0xc8;}else{_0x2ac00d=0xce;}_0x4edd9e[_0x8e7a('0x1a')](_0x2ac00d);return _0x4edd9e[_0x8e7a('0x1f')](_0x8e7a('0x20'),_0x4c6e36+'-'+_0x4436f5+'/'+_0x54b841)[_0x8e7a('0x1b')](_0x4bed7d);}return null;};}function patchUpdates(_0x31c869){return function(_0x85c880){try{jsonpatch['apply'](_0x85c880,_0x31c869,!![]);}catch(_0x170876){return BPromise[_0x8e7a('0x21')](_0x170876);}return _0x85c880['save']();};}function saveUpdates(_0x40832c,_0x416fc9){return function(_0x2257b3){if(_0x2257b3){return _0x2257b3['update'](_0x40832c)[_0x8e7a('0x22')](function(_0x39af88){return _0x39af88;});}return null;};}function removeEntity(_0x2f0ec5,_0x31f218){return function(_0x1776d6){if(_0x1776d6){return _0x1776d6[_0x8e7a('0x23')]()[_0x8e7a('0x22')](function(){_0x2f0ec5[_0x8e7a('0x1a')](0xcc)[_0x8e7a('0x19')]();});}};}function handleEntityNotFound(_0x2e58c1,_0x309311){return function(_0x570e5d){if(!_0x570e5d){_0x2e58c1[_0x8e7a('0x18')](0x194);}return _0x570e5d;};}function handleError(_0x4f7d23,_0x3f6bf8){_0x3f6bf8=_0x3f6bf8||0x1f4;return function(_0x509ce6){logger['error'](_0x509ce6[_0x8e7a('0x24')]);if(_0x509ce6[_0x8e7a('0x25')]){delete _0x509ce6[_0x8e7a('0x25')];}_0x4f7d23[_0x8e7a('0x1a')](_0x3f6bf8)['send'](_0x509ce6);};}exports['index']=function(_0x5a1d86,_0x14fca2){var _0x53c5ad={},_0x59dc76={},_0x41c384={'count':0x0,'rows':[]};var _0x5b265c=_['map'](db[_0x8e7a('0x26')][_0x8e7a('0x27')],function(_0x494043){return{'name':_0x494043[_0x8e7a('0x28')],'type':_0x494043[_0x8e7a('0x29')][_0x8e7a('0x2a')]};});_0x59dc76['model']=_['map'](_0x5b265c,_0x8e7a('0x25'));_0x59dc76[_0x8e7a('0x2b')]=_[_0x8e7a('0x2c')](_0x5a1d86[_0x8e7a('0x2b')]);_0x59dc76[_0x8e7a('0x2d')]=_[_0x8e7a('0x2e')](_0x59dc76[_0x8e7a('0x2f')],_0x59dc76['query']);_0x53c5ad['attributes']=_['intersection'](_0x59dc76[_0x8e7a('0x2f')],qs[_0x8e7a('0x30')](_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x30')]));_0x53c5ad['attributes']=_0x53c5ad[_0x8e7a('0x31')][_0x8e7a('0x32')]?_0x53c5ad[_0x8e7a('0x31')]:_0x59dc76[_0x8e7a('0x2f')];if(!_0x5a1d86['query']['hasOwnProperty']('nolimit')){_0x53c5ad['limit']=qs[_0x8e7a('0x33')](_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x33')]);_0x53c5ad[_0x8e7a('0x1c')]=qs[_0x8e7a('0x1c')](_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x1c')]);}_0x53c5ad[_0x8e7a('0x34')]=qs[_0x8e7a('0x35')](_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x35')]);_0x53c5ad[_0x8e7a('0x36')]=qs[_0x8e7a('0x2d')](_[_0x8e7a('0x37')](_0x5a1d86[_0x8e7a('0x2b')],_0x59dc76[_0x8e7a('0x2d')]),_0x5b265c);if(_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x38')]){_0x53c5ad[_0x8e7a('0x36')]=_[_0x8e7a('0x39')](_0x53c5ad[_0x8e7a('0x36')],{'$or':_[_0x8e7a('0x3a')](_0x5b265c,function(_0x561c35){if(_0x561c35['type']!==_0x8e7a('0x3b')){var _0x1e0507={};_0x1e0507[_0x561c35[_0x8e7a('0x25')]]={'$like':'%'+_0x5a1d86[_0x8e7a('0x2b')][_0x8e7a('0x38')]+'%'};return _0x1e0507;}})});}_0x53c5ad=_['merge']({},_0x53c5ad,_0x5a1d86[_0x8e7a('0x3c')]);var _0x5871a2={'where':_0x53c5ad[_0x8e7a('0x36')]};return db[_0x8e7a('0x26')][_0x8e7a('0x1e')](_0x5871a2)['then'](function(_0x4fde9b){_0x41c384['count']=_0x4fde9b;if(_0x5a1d86[_0x8e7a('0x2b')]['includeAll']){_0x53c5ad[_0x8e7a('0x3d')]=[{'all':!![]}];}return db[_0x8e7a('0x26')][_0x8e7a('0x3e')](_0x53c5ad);})['then'](function(_0x251d2a){_0x41c384[_0x8e7a('0x3f')]=_0x251d2a;return _0x41c384;})['then'](respondWithFilteredResult(_0x14fca2,_0x53c5ad))[_0x8e7a('0x40')](handleError(_0x14fca2,null));};exports[_0x8e7a('0x41')]=function(_0x4d57f5,_0x4863be){var _0x3b9efa={'raw':!![],'where':{'id':_0x4d57f5[_0x8e7a('0x42')]['id']}},_0x614ecf={};_0x614ecf[_0x8e7a('0x2f')]=_[_0x8e7a('0x2c')](db['OpenchannelQueueReport'][_0x8e7a('0x27')]);_0x614ecf['query']=_[_0x8e7a('0x2c')](_0x4d57f5['query']);_0x614ecf[_0x8e7a('0x2d')]=_[_0x8e7a('0x2e')](_0x614ecf[_0x8e7a('0x2f')],_0x614ecf[_0x8e7a('0x2b')]);_0x3b9efa[_0x8e7a('0x31')]=_[_0x8e7a('0x2e')](_0x614ecf[_0x8e7a('0x2f')],qs[_0x8e7a('0x30')](_0x4d57f5[_0x8e7a('0x2b')][_0x8e7a('0x30')]));_0x3b9efa['attributes']=_0x3b9efa[_0x8e7a('0x31')][_0x8e7a('0x32')]?_0x3b9efa[_0x8e7a('0x31')]:_0x614ecf['model'];if(_0x4d57f5[_0x8e7a('0x2b')][_0x8e7a('0x43')]){_0x3b9efa['include']=[{'all':!![]}];}_0x3b9efa=_[_0x8e7a('0x39')]({},_0x3b9efa,_0x4d57f5['options']);return db[_0x8e7a('0x26')][_0x8e7a('0x44')](_0x3b9efa)['then'](handleEntityNotFound(_0x4863be,null))[_0x8e7a('0x22')](respondWithResult(_0x4863be,null))[_0x8e7a('0x40')](handleError(_0x4863be,null));};exports['create']=function(_0x4499eb,_0x44ab6f){return db['OpenchannelQueueReport'][_0x8e7a('0x45')](_0x4499eb[_0x8e7a('0x46')],{})[_0x8e7a('0x22')](respondWithResult(_0x44ab6f,0xc9))[_0x8e7a('0x40')](handleError(_0x44ab6f,null));};exports[_0x8e7a('0x47')]=function(_0x3b6a01,_0xcdb171){if(_0x3b6a01['body']['id']){delete _0x3b6a01[_0x8e7a('0x46')]['id'];}return db['OpenchannelQueueReport'][_0x8e7a('0x44')]({'where':{'id':_0x3b6a01['params']['id']}})['then'](handleEntityNotFound(_0xcdb171,null))['then'](saveUpdates(_0x3b6a01[_0x8e7a('0x46')],null))[_0x8e7a('0x22')](respondWithResult(_0xcdb171,null))['catch'](handleError(_0xcdb171,null));};exports[_0x8e7a('0x23')]=function(_0x1d60ae,_0x33857b){return db[_0x8e7a('0x26')]['find']({'where':{'id':_0x1d60ae['params']['id']}})[_0x8e7a('0x22')](handleEntityNotFound(_0x33857b,null))[_0x8e7a('0x22')](removeEntity(_0x33857b,null))[_0x8e7a('0x40')](handleError(_0x33857b,null));};exports['describe']=function(_0x50c7f9,_0x28af9e){return db[_0x8e7a('0x26')][_0x8e7a('0x48')]()[_0x8e7a('0x22')](respondWithResult(_0x28af9e,null))['catch'](handleError(_0x28af9e,null));}; \ No newline at end of file +var _0x5494=['name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','model','nolimit','sort','where','filters','filter','merge','VIRTUAL','include','rows','show','keys','includeAll','create','body','catch','params','find','describe','rimraf','zip-dir','request-promise','moment','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','stack'];(function(_0x3c1e60,_0x270ac3){var _0x3cbd00=function(_0x5ce802){while(--_0x5ce802){_0x3c1e60['push'](_0x3c1e60['shift']());}};_0x3cbd00(++_0x270ac3);}(_0x5494,0x67));var _0x4549=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0x5494[_0x543c51];return _0x360555;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4549('0x0'));var zipdir=require(_0x4549('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4549('0x2'));var moment=require(_0x4549('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4549('0x4'));var path=require(_0x4549('0x5'));var sox=require(_0x4549('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4549('0x7'));var _=require(_0x4549('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4549('0x9'));var deskjs=require(_0x4549('0xa'));var toCsv=require(_0x4549('0xb'));var querystring=require(_0x4549('0xc'));var Papa=require(_0x4549('0xd'));var Redis=require(_0x4549('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4549('0xf'));var as=require(_0x4549('0x10'));var hardwareService=require(_0x4549('0x11'));var logger=require(_0x4549('0x12'))(_0x4549('0x13'));var utils=require(_0x4549('0x14'));var config=require(_0x4549('0x15'));var licenseUtil=require(_0x4549('0x16'));var db=require(_0x4549('0x17'))['db'];function respondWithStatusCode(_0x79bfd3,_0x3fd9b9){_0x3fd9b9=_0x3fd9b9||0xcc;return function(_0x56b97a){if(_0x56b97a){return _0x79bfd3[_0x4549('0x18')](_0x3fd9b9);}return _0x79bfd3['status'](_0x3fd9b9)['end']();};}function respondWithResult(_0x224209,_0xd11149){_0xd11149=_0xd11149||0xc8;return function(_0xf50bcf){if(_0xf50bcf){return _0x224209[_0x4549('0x19')](_0xd11149)[_0x4549('0x1a')](_0xf50bcf);}};}function respondWithFilteredResult(_0x444872,_0xf91a2){return function(_0x2dbf4d){if(_0x2dbf4d){var _0x1c47f1=typeof _0xf91a2[_0x4549('0x1b')]===_0x4549('0x1c')&&typeof _0xf91a2[_0x4549('0x1d')]===_0x4549('0x1c');var _0x2d5a6c=_0x2dbf4d[_0x4549('0x1e')];var _0x1e29ce=_0x1c47f1?0x0:_0xf91a2['offset'];var _0x1ae377=_0x1c47f1?_0x2dbf4d['count']:_0xf91a2[_0x4549('0x1b')]+_0xf91a2[_0x4549('0x1d')];var _0x21eda8;if(_0x1ae377>=_0x2d5a6c){_0x1ae377=_0x2d5a6c;_0x21eda8=0xc8;}else{_0x21eda8=0xce;}_0x444872[_0x4549('0x19')](_0x21eda8);return _0x444872['set'](_0x4549('0x1f'),_0x1e29ce+'-'+_0x1ae377+'/'+_0x2d5a6c)[_0x4549('0x1a')](_0x2dbf4d);}return null;};}function patchUpdates(_0x5aef27){return function(_0x26b7e9){try{jsonpatch['apply'](_0x26b7e9,_0x5aef27,!![]);}catch(_0x4dde0e){return BPromise['reject'](_0x4dde0e);}return _0x26b7e9[_0x4549('0x20')]();};}function saveUpdates(_0x1edbdc,_0x3c0bce){return function(_0x5bf615){if(_0x5bf615){return _0x5bf615[_0x4549('0x21')](_0x1edbdc)[_0x4549('0x22')](function(_0x451218){return _0x451218;});}return null;};}function removeEntity(_0x5e7f51,_0x493d0a){return function(_0x596d62){if(_0x596d62){return _0x596d62[_0x4549('0x23')]()[_0x4549('0x22')](function(){_0x5e7f51[_0x4549('0x19')](0xcc)[_0x4549('0x24')]();});}};}function handleEntityNotFound(_0x4b60ba,_0x3902ac){return function(_0x335241){if(!_0x335241){_0x4b60ba[_0x4549('0x18')](0x194);}return _0x335241;};}function handleError(_0x1c5353,_0x3fcc29){_0x3fcc29=_0x3fcc29||0x1f4;return function(_0x257807){logger[_0x4549('0x25')](_0x257807[_0x4549('0x26')]);if(_0x257807[_0x4549('0x27')]){delete _0x257807[_0x4549('0x27')];}_0x1c5353['status'](_0x3fcc29)[_0x4549('0x28')](_0x257807);};}exports[_0x4549('0x29')]=function(_0x2c5e38,_0x156c08){var _0x5b174b={},_0x5e4d36={},_0x540fb6={'count':0x0,'rows':[]};var _0x2cf956=_[_0x4549('0x2a')](db[_0x4549('0x2b')][_0x4549('0x2c')],function(_0x2582d2){return{'name':_0x2582d2[_0x4549('0x2d')],'type':_0x2582d2['type'][_0x4549('0x2e')]};});_0x5e4d36['model']=_[_0x4549('0x2a')](_0x2cf956,'name');_0x5e4d36[_0x4549('0x2f')]=_['keys'](_0x2c5e38[_0x4549('0x2f')]);_0x5e4d36['filters']=_[_0x4549('0x30')](_0x5e4d36['model'],_0x5e4d36[_0x4549('0x2f')]);_0x5b174b[_0x4549('0x31')]=_[_0x4549('0x30')](_0x5e4d36['model'],qs[_0x4549('0x32')](_0x2c5e38[_0x4549('0x2f')][_0x4549('0x32')]));_0x5b174b[_0x4549('0x31')]=_0x5b174b[_0x4549('0x31')][_0x4549('0x33')]?_0x5b174b['attributes']:_0x5e4d36[_0x4549('0x34')];if(!_0x2c5e38[_0x4549('0x2f')]['hasOwnProperty'](_0x4549('0x35'))){_0x5b174b[_0x4549('0x1d')]=qs[_0x4549('0x1d')](_0x2c5e38[_0x4549('0x2f')][_0x4549('0x1d')]);_0x5b174b[_0x4549('0x1b')]=qs[_0x4549('0x1b')](_0x2c5e38[_0x4549('0x2f')][_0x4549('0x1b')]);}_0x5b174b['order']=qs[_0x4549('0x36')](_0x2c5e38[_0x4549('0x2f')][_0x4549('0x36')]);_0x5b174b[_0x4549('0x37')]=qs[_0x4549('0x38')](_['pick'](_0x2c5e38['query'],_0x5e4d36[_0x4549('0x38')]),_0x2cf956);if(_0x2c5e38[_0x4549('0x2f')][_0x4549('0x39')]){_0x5b174b['where']=_[_0x4549('0x3a')](_0x5b174b['where'],{'$or':_['map'](_0x2cf956,function(_0x446f10){if(_0x446f10['type']!==_0x4549('0x3b')){var _0xd1e19a={};_0xd1e19a[_0x446f10[_0x4549('0x27')]]={'$like':'%'+_0x2c5e38['query'][_0x4549('0x39')]+'%'};return _0xd1e19a;}})});}_0x5b174b=_[_0x4549('0x3a')]({},_0x5b174b,_0x2c5e38['options']);var _0x29ead7={'where':_0x5b174b[_0x4549('0x37')]};return db[_0x4549('0x2b')][_0x4549('0x1e')](_0x29ead7)[_0x4549('0x22')](function(_0x10f0e){_0x540fb6[_0x4549('0x1e')]=_0x10f0e;if(_0x2c5e38[_0x4549('0x2f')]['includeAll']){_0x5b174b[_0x4549('0x3c')]=[{'all':!![]}];}return db[_0x4549('0x2b')]['findAll'](_0x5b174b);})[_0x4549('0x22')](function(_0xc7c68e){_0x540fb6[_0x4549('0x3d')]=_0xc7c68e;return _0x540fb6;})[_0x4549('0x22')](respondWithFilteredResult(_0x156c08,_0x5b174b))['catch'](handleError(_0x156c08,null));};exports[_0x4549('0x3e')]=function(_0x17122e,_0x53b3c5){var _0x3f97c3={'raw':!![],'where':{'id':_0x17122e['params']['id']}},_0x52be8a={};_0x52be8a['model']=_['keys'](db[_0x4549('0x2b')][_0x4549('0x2c')]);_0x52be8a[_0x4549('0x2f')]=_[_0x4549('0x3f')](_0x17122e[_0x4549('0x2f')]);_0x52be8a[_0x4549('0x38')]=_[_0x4549('0x30')](_0x52be8a[_0x4549('0x34')],_0x52be8a[_0x4549('0x2f')]);_0x3f97c3[_0x4549('0x31')]=_[_0x4549('0x30')](_0x52be8a[_0x4549('0x34')],qs['fields'](_0x17122e[_0x4549('0x2f')][_0x4549('0x32')]));_0x3f97c3[_0x4549('0x31')]=_0x3f97c3[_0x4549('0x31')][_0x4549('0x33')]?_0x3f97c3[_0x4549('0x31')]:_0x52be8a[_0x4549('0x34')];if(_0x17122e[_0x4549('0x2f')][_0x4549('0x40')]){_0x3f97c3[_0x4549('0x3c')]=[{'all':!![]}];}_0x3f97c3=_[_0x4549('0x3a')]({},_0x3f97c3,_0x17122e['options']);return db[_0x4549('0x2b')]['find'](_0x3f97c3)[_0x4549('0x22')](handleEntityNotFound(_0x53b3c5,null))[_0x4549('0x22')](respondWithResult(_0x53b3c5,null))['catch'](handleError(_0x53b3c5,null));};exports[_0x4549('0x41')]=function(_0x4ac66a,_0x5629a8){return db['OpenchannelQueueReport']['create'](_0x4ac66a[_0x4549('0x42')],{})[_0x4549('0x22')](respondWithResult(_0x5629a8,0xc9))[_0x4549('0x43')](handleError(_0x5629a8,null));};exports[_0x4549('0x21')]=function(_0x1044c7,_0x1cd1bb){if(_0x1044c7[_0x4549('0x42')]['id']){delete _0x1044c7[_0x4549('0x42')]['id'];}return db[_0x4549('0x2b')]['find']({'where':{'id':_0x1044c7[_0x4549('0x44')]['id']}})['then'](handleEntityNotFound(_0x1cd1bb,null))[_0x4549('0x22')](saveUpdates(_0x1044c7[_0x4549('0x42')],null))[_0x4549('0x22')](respondWithResult(_0x1cd1bb,null))[_0x4549('0x43')](handleError(_0x1cd1bb,null));};exports[_0x4549('0x23')]=function(_0x3bc322,_0x4423e6){return db[_0x4549('0x2b')][_0x4549('0x45')]({'where':{'id':_0x3bc322['params']['id']}})[_0x4549('0x22')](handleEntityNotFound(_0x4423e6,null))[_0x4549('0x22')](removeEntity(_0x4423e6,null))[_0x4549('0x43')](handleError(_0x4423e6,null));};exports[_0x4549('0x46')]=function(_0x258059,_0x4fe2f1){return db[_0x4549('0x2b')][_0x4549('0x46')]()['then'](respondWithResult(_0x4fe2f1,null))['catch'](handleError(_0x4fe2f1,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 311fc37..0e3bb06 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x2eddf6,_0x543459){var _0x3d9adc=function(_0xb8ec3d){while(--_0xb8ec3d){_0x2eddf6['push'](_0x2eddf6['shift']());}};_0x3d9adc(++_0x543459);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x5fc3[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x814b,0x1a2));var _0xb814=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x814b[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index f33dd8a..9a3a77b 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 _0x49f8=['client','http','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','then','stringify','update','raw','where','limit','UpdateOpenchannelQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x34c7f4,_0x789ccf){var _0x3252c4=function(_0x433d9e){while(--_0x433d9e){_0x34c7f4['push'](_0x34c7f4['shift']());}};_0x3252c4(++_0x789ccf);}(_0x49f8,0xff));var _0x849f=function(_0x4f4e4b,_0x46ea73){_0x4f4e4b=_0x4f4e4b-0x0;var _0x23a628=_0x49f8[_0x4f4e4b];return _0x23a628;};'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});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3a5724){var _0x32be69=this;return new Promise(function(_0x15a41c,_0xe404c6){return db[_0x849f('0x13')][_0x849f('0x18')](_0x3a5724[_0x849f('0x14')],{'raw':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1a')]||null:null,'attributes':_0x3a5724['options']?_0x3a5724[_0x849f('0x15')]['attributes']||null:null,'limit':_0x3a5724[_0x849f('0x15')]?_0x3a5724[_0x849f('0x15')][_0x849f('0x1b')]||null:null})[_0x849f('0x16')](function(_0xf0e21f){logger[_0x849f('0x8')]('UpdateOpenchannelQueueReport',_0x3a5724);logger[_0x849f('0xb')](_0x849f('0x1c'),_0x3a5724,JSON[_0x849f('0x17')](_0xf0e21f));_0x15a41c(_0xf0e21f);})['catch'](function(_0x347c93){logger['error'](_0x849f('0x1c'),_0x347c93[_0x849f('0xf')],_0x3a5724);_0xe404c6(_0x32be69[_0x849f('0xd')](0x1f4,_0x347c93[_0x849f('0xf')]));});});}; \ No newline at end of file +var _0x8374=['limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes'];(function(_0x2fad8a,_0x26de69){var _0x494d7d=function(_0x52fe59){while(--_0x52fe59){_0x2fad8a['push'](_0x2fad8a['shift']());}};_0x494d7d(++_0x26de69);}(_0x8374,0x174));var _0x4837=function(_0x3295bb,_0x485115){_0x3295bb=_0x3295bb-0x0;var _0x1d584e=_0x8374[_0x3295bb];return _0x1d584e;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});}exports[_0x4837('0x19')]=function(_0x48b61b){var _0xf21681=this;return new Promise(function(_0x1cb24a,_0x427171){return db[_0x4837('0x1a')][_0x4837('0x1b')](_0x48b61b[_0x4837('0x1c')],{'raw':_0x48b61b[_0x4837('0x1d')]?_0x48b61b['options']['raw']===undefined?!![]:![]:!![]})[_0x4837('0xf')](function(_0x133e9d){logger[_0x4837('0x10')](_0x4837('0x19'),_0x48b61b);logger['debug'](_0x4837('0x19'),_0x48b61b,JSON['stringify'](_0x133e9d));_0x1cb24a(_0x133e9d);})[_0x4837('0x18')](function(_0x5f5631){logger['error'](_0x4837('0x19'),_0x5f5631['message'],_0x48b61b);_0x427171(_0xf21681['error'](0x1f4,_0x5f5631['message']));});});};exports[_0x4837('0x1e')]=function(_0x2d820a){var _0x4bbfbd=this;return new Promise(function(_0x36b841,_0xa10b75){return db['OpenchannelQueueReport'][_0x4837('0x1f')](_0x2d820a[_0x4837('0x1c')],{'raw':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x21')]||null:null,'attributes':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x22')]||null:null,'limit':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x23')]||null:null})[_0x4837('0xf')](function(_0x215858){logger[_0x4837('0x10')]('UpdateOpenchannelQueueReport',_0x2d820a);logger[_0x4837('0x13')](_0x4837('0x1e'),_0x2d820a,JSON[_0x4837('0x24')](_0x215858));_0x36b841(_0x215858);})[_0x4837('0x18')](function(_0x594039){logger[_0x4837('0x15')](_0x4837('0x1e'),_0x594039[_0x4837('0x17')],_0x2d820a);_0xa10b75(_0x4bbfbd[_0x4837('0x15')](0x1f4,_0x594039['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index cbf2680..6ea055a 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 _0xd022=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete'];(function(_0x5c19d8,_0x10e7aa){var _0x558708=function(_0x2eefd7){while(--_0x2eefd7){_0x5c19d8['push'](_0x5c19d8['shift']());}};_0x558708(++_0x10e7aa);}(_0xd022,0x145));var _0x2d02=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xd022[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0x2d02('0x0'));var path=require(_0x2d02('0x1'));var timeout=require(_0x2d02('0x2'));var express=require(_0x2d02('0x3'));var router=express['Router']();var fs_extra=require(_0x2d02('0x4'));var auth=require(_0x2d02('0x5'));var interaction=require(_0x2d02('0x6'));var config=require('../../config/environment');var controller=require(_0x2d02('0x7'));router[_0x2d02('0x8')]('/',auth[_0x2d02('0x9')](),controller[_0x2d02('0xa')]);router[_0x2d02('0x8')](_0x2d02('0xb'),auth[_0x2d02('0x9')](),controller['describe']);router[_0x2d02('0x8')](_0x2d02('0xc'),auth[_0x2d02('0x9')](),controller['show']);router[_0x2d02('0xd')]('/',auth[_0x2d02('0x9')](),controller[_0x2d02('0xe')]);router['put'](_0x2d02('0xc'),auth[_0x2d02('0x9')](),controller[_0x2d02('0xf')]);router[_0x2d02('0x10')]('/:id',auth[_0x2d02('0x9')](),controller[_0x2d02('0x11')]);module[_0x2d02('0x12')]=router; \ No newline at end of file +var _0x78cb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x32d1aa,_0x59d6e0){var _0x84be73=function(_0x3b69dd){while(--_0x3b69dd){_0x32d1aa['push'](_0x32d1aa['shift']());}};_0x84be73(++_0x59d6e0);}(_0x78cb,0x1f3));var _0xb78c=function(_0x24635b,_0xc6a6ab){_0x24635b=_0x24635b-0x0;var _0x2811a1=_0x78cb[_0x24635b];return _0x2811a1;};'use strict';var multer=require(_0xb78c('0x0'));var util=require(_0xb78c('0x1'));var path=require(_0xb78c('0x2'));var timeout=require(_0xb78c('0x3'));var express=require(_0xb78c('0x4'));var router=express[_0xb78c('0x5')]();var fs_extra=require(_0xb78c('0x6'));var auth=require(_0xb78c('0x7'));var interaction=require(_0xb78c('0x8'));var config=require(_0xb78c('0x9'));var controller=require('./openchannelTransferReport.controller');router[_0xb78c('0xa')]('/',auth['isAuthenticated'](),controller[_0xb78c('0xb')]);router[_0xb78c('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb78c('0xc')]);router[_0xb78c('0xa')](_0xb78c('0xd'),auth[_0xb78c('0xe')](),controller[_0xb78c('0xf')]);router[_0xb78c('0x10')]('/',auth['isAuthenticated'](),controller[_0xb78c('0x11')]);router[_0xb78c('0x12')](_0xb78c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xb78c('0x13')](_0xb78c('0xd'),auth[_0xb78c('0xe')](),controller[_0xb78c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 26b1e6b..039fdfa 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x48f7c3,_0x16756f){var _0xfd392=function(_0x195d3f){while(--_0x195d3f){_0x48f7c3['push'](_0x48f7c3['shift']());}};_0xfd392(++_0x16756f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e58f7,_0x530e1c){_0x4e58f7=_0x4e58f7-0x0;var _0x2a7c77=_0xedd9[_0x4e58f7];return _0x2a7c77;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x17153b,_0x465c94){var _0x5d2e13=function(_0x4ed236){while(--_0x4ed236){_0x17153b['push'](_0x17153b['shift']());}};_0x5d2e13(++_0x465c94);}(_0xedd9,0xfc));var _0x9edd=function(_0x21087c,_0x48d89f){_0x21087c=_0x21087c-0x0;var _0x3cadfe=_0xedd9[_0x21087c];return _0x3cadfe;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index cfc2c4a..a14ecff 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 _0x897d=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','OpenchannelTransferReport','rawAttributes','type','model','map','keys','filters','intersection','fields','attributes','length','query','hasOwnProperty','nolimit','limit','sort','where','pick','merge','includeAll','include','findAll','rows','params','catch','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x184eb2,_0x2f6b87){var _0x2bcd6f=function(_0x267893){while(--_0x267893){_0x184eb2['push'](_0x184eb2['shift']());}};_0x2bcd6f(++_0x2f6b87);}(_0x897d,0x80));var _0xd897=function(_0x4823c7,_0x2a2a8d){_0x4823c7=_0x4823c7-0x0;var _0x3f9eba=_0x897d[_0x4823c7];return _0x3f9eba;};'use strict';var emlformat=require(_0xd897('0x0'));var rimraf=require(_0xd897('0x1'));var zipdir=require(_0xd897('0x2'));var jsonpatch=require(_0xd897('0x3'));var rp=require(_0xd897('0x4'));var moment=require(_0xd897('0x5'));var BPromise=require(_0xd897('0x6'));var Mustache=require(_0xd897('0x7'));var util=require(_0xd897('0x8'));var path=require(_0xd897('0x9'));var sox=require(_0xd897('0xa'));var csv=require(_0xd897('0xb'));var ejs=require(_0xd897('0xc'));var fs=require('fs');var fs_extra=require(_0xd897('0xd'));var _=require(_0xd897('0xe'));var squel=require(_0xd897('0xf'));var crypto=require(_0xd897('0x10'));var jsforce=require(_0xd897('0x11'));var deskjs=require(_0xd897('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd897('0x13'));var Redis=require(_0xd897('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd897('0x15'));var as=require(_0xd897('0x16'));var hardwareService=require(_0xd897('0x17'));var logger=require(_0xd897('0x18'))(_0xd897('0x19'));var utils=require(_0xd897('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd897('0x1b'));var db=require(_0xd897('0x1c'))['db'];function respondWithStatusCode(_0x375c9b,_0x4c1467){_0x4c1467=_0x4c1467||0xcc;return function(_0x3ed348){if(_0x3ed348){return _0x375c9b[_0xd897('0x1d')](_0x4c1467);}return _0x375c9b['status'](_0x4c1467)[_0xd897('0x1e')]();};}function respondWithResult(_0x2a72b4,_0x2bfff9){_0x2bfff9=_0x2bfff9||0xc8;return function(_0x362be4){if(_0x362be4){return _0x2a72b4[_0xd897('0x1f')](_0x2bfff9)['json'](_0x362be4);}};}function respondWithFilteredResult(_0x4ea43a,_0xda21fa){return function(_0x33a200){if(_0x33a200){var _0x256b16=typeof _0xda21fa[_0xd897('0x20')]===_0xd897('0x21')&&typeof _0xda21fa['limit']===_0xd897('0x21');var _0x52b91c=_0x33a200[_0xd897('0x22')];var _0x34eec4=_0x256b16?0x0:_0xda21fa[_0xd897('0x20')];var _0x41f2fc=_0x256b16?_0x33a200[_0xd897('0x22')]:_0xda21fa['offset']+_0xda21fa['limit'];var _0x437e4f;if(_0x41f2fc>=_0x52b91c){_0x41f2fc=_0x52b91c;_0x437e4f=0xc8;}else{_0x437e4f=0xce;}_0x4ea43a[_0xd897('0x1f')](_0x437e4f);return _0x4ea43a[_0xd897('0x23')](_0xd897('0x24'),_0x34eec4+'-'+_0x41f2fc+'/'+_0x52b91c)[_0xd897('0x25')](_0x33a200);}return null;};}function patchUpdates(_0x615151){return function(_0x1e2dc4){try{jsonpatch[_0xd897('0x26')](_0x1e2dc4,_0x615151,!![]);}catch(_0x25ade2){return BPromise[_0xd897('0x27')](_0x25ade2);}return _0x1e2dc4['save']();};}function saveUpdates(_0x2673ac,_0x4a6957){return function(_0x3955aa){if(_0x3955aa){return _0x3955aa[_0xd897('0x28')](_0x2673ac)[_0xd897('0x29')](function(_0x52e951){return _0x52e951;});}return null;};}function removeEntity(_0x4e5ab8,_0x54855b){return function(_0x11237e){if(_0x11237e){return _0x11237e[_0xd897('0x2a')]()[_0xd897('0x29')](function(){_0x4e5ab8[_0xd897('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x252fa7,_0x172568){return function(_0x22f4fd){if(!_0x22f4fd){_0x252fa7[_0xd897('0x1d')](0x194);}return _0x22f4fd;};}function handleError(_0x5c3867,_0x54ced8){_0x54ced8=_0x54ced8||0x1f4;return function(_0x4ef0a5){logger[_0xd897('0x2b')](_0x4ef0a5[_0xd897('0x2c')]);if(_0x4ef0a5['name']){delete _0x4ef0a5[_0xd897('0x2d')];}_0x5c3867['status'](_0x54ced8)[_0xd897('0x2e')](_0x4ef0a5);};}exports[_0xd897('0x2f')]=function(_0x29f019,_0x5d9fd4){var _0x2b6f6f={},_0x41849d={},_0x255a02={'count':0x0,'rows':[]};var _0x37c4f3=_['map'](db[_0xd897('0x30')][_0xd897('0x31')],function(_0x425055){return{'name':_0x425055['fieldName'],'type':_0x425055[_0xd897('0x32')]['key']};});_0x41849d[_0xd897('0x33')]=_[_0xd897('0x34')](_0x37c4f3,_0xd897('0x2d'));_0x41849d['query']=_[_0xd897('0x35')](_0x29f019['query']);_0x41849d[_0xd897('0x36')]=_[_0xd897('0x37')](_0x41849d[_0xd897('0x33')],_0x41849d['query']);_0x2b6f6f['attributes']=_[_0xd897('0x37')](_0x41849d[_0xd897('0x33')],qs[_0xd897('0x38')](_0x29f019['query']['fields']));_0x2b6f6f[_0xd897('0x39')]=_0x2b6f6f[_0xd897('0x39')][_0xd897('0x3a')]?_0x2b6f6f[_0xd897('0x39')]:_0x41849d[_0xd897('0x33')];if(!_0x29f019[_0xd897('0x3b')][_0xd897('0x3c')](_0xd897('0x3d'))){_0x2b6f6f[_0xd897('0x3e')]=qs['limit'](_0x29f019['query'][_0xd897('0x3e')]);_0x2b6f6f[_0xd897('0x20')]=qs[_0xd897('0x20')](_0x29f019[_0xd897('0x3b')][_0xd897('0x20')]);}_0x2b6f6f['order']=qs['sort'](_0x29f019['query'][_0xd897('0x3f')]);_0x2b6f6f[_0xd897('0x40')]=qs[_0xd897('0x36')](_[_0xd897('0x41')](_0x29f019['query'],_0x41849d[_0xd897('0x36')]),_0x37c4f3);if(_0x29f019[_0xd897('0x3b')]['filter']){_0x2b6f6f['where']=_['merge'](_0x2b6f6f['where'],{'$or':_['map'](_0x37c4f3,function(_0x28b562){if(_0x28b562['type']!=='VIRTUAL'){var _0x38bc69={};_0x38bc69[_0x28b562[_0xd897('0x2d')]]={'$like':'%'+_0x29f019['query']['filter']+'%'};return _0x38bc69;}})});}_0x2b6f6f=_[_0xd897('0x42')]({},_0x2b6f6f,_0x29f019['options']);var _0x51f817={'where':_0x2b6f6f[_0xd897('0x40')]};return db[_0xd897('0x30')][_0xd897('0x22')](_0x51f817)[_0xd897('0x29')](function(_0x1ec643){_0x255a02[_0xd897('0x22')]=_0x1ec643;if(_0x29f019[_0xd897('0x3b')][_0xd897('0x43')]){_0x2b6f6f[_0xd897('0x44')]=[{'all':!![]}];}return db[_0xd897('0x30')][_0xd897('0x45')](_0x2b6f6f);})[_0xd897('0x29')](function(_0xc230f2){_0x255a02[_0xd897('0x46')]=_0xc230f2;return _0x255a02;})[_0xd897('0x29')](respondWithFilteredResult(_0x5d9fd4,_0x2b6f6f))['catch'](handleError(_0x5d9fd4,null));};exports['show']=function(_0x20feef,_0x3f2e08){var _0x14954a={'raw':!![],'where':{'id':_0x20feef[_0xd897('0x47')]['id']}},_0x201c7e={};_0x201c7e[_0xd897('0x33')]=_[_0xd897('0x35')](db[_0xd897('0x30')][_0xd897('0x31')]);_0x201c7e[_0xd897('0x3b')]=_[_0xd897('0x35')](_0x20feef[_0xd897('0x3b')]);_0x201c7e['filters']=_['intersection'](_0x201c7e[_0xd897('0x33')],_0x201c7e['query']);_0x14954a['attributes']=_[_0xd897('0x37')](_0x201c7e[_0xd897('0x33')],qs[_0xd897('0x38')](_0x20feef['query']['fields']));_0x14954a[_0xd897('0x39')]=_0x14954a[_0xd897('0x39')][_0xd897('0x3a')]?_0x14954a[_0xd897('0x39')]:_0x201c7e[_0xd897('0x33')];if(_0x20feef[_0xd897('0x3b')]['includeAll']){_0x14954a['include']=[{'all':!![]}];}_0x14954a=_[_0xd897('0x42')]({},_0x14954a,_0x20feef['options']);return db['OpenchannelTransferReport']['find'](_0x14954a)['then'](handleEntityNotFound(_0x3f2e08,null))['then'](respondWithResult(_0x3f2e08,null))[_0xd897('0x48')](handleError(_0x3f2e08,null));};exports['create']=function(_0x27b755,_0x1f8663){return db['OpenchannelTransferReport']['create'](_0x27b755[_0xd897('0x49')],{})[_0xd897('0x29')](respondWithResult(_0x1f8663,0xc9))[_0xd897('0x48')](handleError(_0x1f8663,null));};exports[_0xd897('0x28')]=function(_0x93b9b0,_0x2bbff3){if(_0x93b9b0['body']['id']){delete _0x93b9b0['body']['id'];}return db[_0xd897('0x30')][_0xd897('0x4a')]({'where':{'id':_0x93b9b0[_0xd897('0x47')]['id']}})['then'](handleEntityNotFound(_0x2bbff3,null))[_0xd897('0x29')](saveUpdates(_0x93b9b0[_0xd897('0x49')],null))['then'](respondWithResult(_0x2bbff3,null))[_0xd897('0x48')](handleError(_0x2bbff3,null));};exports[_0xd897('0x2a')]=function(_0x58787e,_0x366642){return db[_0xd897('0x30')][_0xd897('0x4a')]({'where':{'id':_0x58787e[_0xd897('0x47')]['id']}})[_0xd897('0x29')](handleEntityNotFound(_0x366642,null))['then'](removeEntity(_0x366642,null))[_0xd897('0x48')](handleError(_0x366642,null));};exports[_0xd897('0x4b')]=function(_0x3eb35e,_0x4e5c44){return db[_0xd897('0x30')][_0xd897('0x4b')]()[_0xd897('0x29')](respondWithResult(_0x4e5c44,null))[_0xd897('0x48')](handleError(_0x4e5c44,null));}; \ No newline at end of file +var _0x66c7=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x49d421,_0x2ffff){var _0x947002=function(_0x14a0b1){while(--_0x14a0b1){_0x49d421['push'](_0x49d421['shift']());}};_0x947002(++_0x2ffff);}(_0x66c7,0x1b4));var _0x766c=function(_0x3f68f7,_0x488ac5){_0x3f68f7=_0x3f68f7-0x0;var _0x40ee9f=_0x66c7[_0x3f68f7];return _0x40ee9f;};'use strict';var emlformat=require(_0x766c('0x0'));var rimraf=require(_0x766c('0x1'));var zipdir=require(_0x766c('0x2'));var jsonpatch=require(_0x766c('0x3'));var rp=require('request-promise');var moment=require(_0x766c('0x4'));var BPromise=require(_0x766c('0x5'));var Mustache=require(_0x766c('0x6'));var util=require('util');var path=require(_0x766c('0x7'));var sox=require(_0x766c('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x766c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x766c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x766c('0xb'));var toCsv=require(_0x766c('0xc'));var querystring=require(_0x766c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x766c('0xe'));var qs=require(_0x766c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x10'))(_0x766c('0x11'));var utils=require(_0x766c('0x12'));var config=require(_0x766c('0x13'));var licenseUtil=require(_0x766c('0x14'));var db=require(_0x766c('0x15'))['db'];function respondWithStatusCode(_0xd70d5c,_0x1304a1){_0x1304a1=_0x1304a1||0xcc;return function(_0xaf64de){if(_0xaf64de){return _0xd70d5c['sendStatus'](_0x1304a1);}return _0xd70d5c[_0x766c('0x16')](_0x1304a1)[_0x766c('0x17')]();};}function respondWithResult(_0x54dd00,_0x54ab59){_0x54ab59=_0x54ab59||0xc8;return function(_0x32ca87){if(_0x32ca87){return _0x54dd00[_0x766c('0x16')](_0x54ab59)['json'](_0x32ca87);}};}function respondWithFilteredResult(_0x3db2fe,_0x1414b6){return function(_0x41b883){if(_0x41b883){var _0xa4ccc=typeof _0x1414b6[_0x766c('0x18')]==='undefined'&&typeof _0x1414b6[_0x766c('0x19')]==='undefined';var _0x387e30=_0x41b883[_0x766c('0x1a')];var _0x293c60=_0xa4ccc?0x0:_0x1414b6[_0x766c('0x18')];var _0x4fc1b3=_0xa4ccc?_0x41b883[_0x766c('0x1a')]:_0x1414b6[_0x766c('0x18')]+_0x1414b6[_0x766c('0x19')];var _0x1d325b;if(_0x4fc1b3>=_0x387e30){_0x4fc1b3=_0x387e30;_0x1d325b=0xc8;}else{_0x1d325b=0xce;}_0x3db2fe[_0x766c('0x16')](_0x1d325b);return _0x3db2fe[_0x766c('0x1b')](_0x766c('0x1c'),_0x293c60+'-'+_0x4fc1b3+'/'+_0x387e30)['json'](_0x41b883);}return null;};}function patchUpdates(_0x51c5dc){return function(_0xf541e6){try{jsonpatch[_0x766c('0x1d')](_0xf541e6,_0x51c5dc,!![]);}catch(_0x5350bd){return BPromise[_0x766c('0x1e')](_0x5350bd);}return _0xf541e6[_0x766c('0x1f')]();};}function saveUpdates(_0x906345,_0x271a08){return function(_0x1d24cb){if(_0x1d24cb){return _0x1d24cb[_0x766c('0x20')](_0x906345)[_0x766c('0x21')](function(_0x56f0cd){return _0x56f0cd;});}return null;};}function removeEntity(_0x2cf202,_0x3a8e9d){return function(_0x15d273){if(_0x15d273){return _0x15d273[_0x766c('0x22')]()['then'](function(){_0x2cf202[_0x766c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x802e41,_0x327128){return function(_0x5c0da7){if(!_0x5c0da7){_0x802e41['sendStatus'](0x194);}return _0x5c0da7;};}function handleError(_0x49dcb1,_0x2803e1){_0x2803e1=_0x2803e1||0x1f4;return function(_0x1cf536){logger[_0x766c('0x23')](_0x1cf536[_0x766c('0x24')]);if(_0x1cf536[_0x766c('0x25')]){delete _0x1cf536[_0x766c('0x25')];}_0x49dcb1[_0x766c('0x16')](_0x2803e1)['send'](_0x1cf536);};}exports['index']=function(_0x330ab4,_0x3bddcd){var _0x188bc4={},_0x4af40e={},_0x1ea3c8={'count':0x0,'rows':[]};var _0x50beb0=_[_0x766c('0x26')](db[_0x766c('0x27')][_0x766c('0x28')],function(_0x917274){return{'name':_0x917274[_0x766c('0x29')],'type':_0x917274[_0x766c('0x2a')][_0x766c('0x2b')]};});_0x4af40e[_0x766c('0x2c')]=_[_0x766c('0x26')](_0x50beb0,_0x766c('0x25'));_0x4af40e[_0x766c('0x2d')]=_[_0x766c('0x2e')](_0x330ab4[_0x766c('0x2d')]);_0x4af40e['filters']=_[_0x766c('0x2f')](_0x4af40e[_0x766c('0x2c')],_0x4af40e[_0x766c('0x2d')]);_0x188bc4[_0x766c('0x30')]=_['intersection'](_0x4af40e[_0x766c('0x2c')],qs[_0x766c('0x31')](_0x330ab4[_0x766c('0x2d')]['fields']));_0x188bc4[_0x766c('0x30')]=_0x188bc4[_0x766c('0x30')][_0x766c('0x32')]?_0x188bc4[_0x766c('0x30')]:_0x4af40e['model'];if(!_0x330ab4['query']['hasOwnProperty'](_0x766c('0x33'))){_0x188bc4[_0x766c('0x19')]=qs[_0x766c('0x19')](_0x330ab4[_0x766c('0x2d')]['limit']);_0x188bc4[_0x766c('0x18')]=qs[_0x766c('0x18')](_0x330ab4['query'][_0x766c('0x18')]);}_0x188bc4[_0x766c('0x34')]=qs[_0x766c('0x35')](_0x330ab4['query'][_0x766c('0x35')]);_0x188bc4[_0x766c('0x36')]=qs[_0x766c('0x37')](_[_0x766c('0x38')](_0x330ab4[_0x766c('0x2d')],_0x4af40e[_0x766c('0x37')]),_0x50beb0);if(_0x330ab4['query'][_0x766c('0x39')]){_0x188bc4[_0x766c('0x36')]=_['merge'](_0x188bc4[_0x766c('0x36')],{'$or':_[_0x766c('0x26')](_0x50beb0,function(_0x1beff6){if(_0x1beff6['type']!==_0x766c('0x3a')){var _0x468e8c={};_0x468e8c[_0x1beff6[_0x766c('0x25')]]={'$like':'%'+_0x330ab4[_0x766c('0x2d')]['filter']+'%'};return _0x468e8c;}})});}_0x188bc4=_[_0x766c('0x3b')]({},_0x188bc4,_0x330ab4['options']);var _0xe7a563={'where':_0x188bc4[_0x766c('0x36')]};return db['OpenchannelTransferReport'][_0x766c('0x1a')](_0xe7a563)['then'](function(_0x2d9c06){_0x1ea3c8[_0x766c('0x1a')]=_0x2d9c06;if(_0x330ab4[_0x766c('0x2d')][_0x766c('0x3c')]){_0x188bc4[_0x766c('0x3d')]=[{'all':!![]}];}return db[_0x766c('0x27')][_0x766c('0x3e')](_0x188bc4);})[_0x766c('0x21')](function(_0x4c6e06){_0x1ea3c8[_0x766c('0x3f')]=_0x4c6e06;return _0x1ea3c8;})[_0x766c('0x21')](respondWithFilteredResult(_0x3bddcd,_0x188bc4))[_0x766c('0x40')](handleError(_0x3bddcd,null));};exports[_0x766c('0x41')]=function(_0x30111b,_0x20449b){var _0x2610de={'raw':!![],'where':{'id':_0x30111b[_0x766c('0x42')]['id']}},_0x4a3bf6={};_0x4a3bf6[_0x766c('0x2c')]=_[_0x766c('0x2e')](db['OpenchannelTransferReport']['rawAttributes']);_0x4a3bf6[_0x766c('0x2d')]=_[_0x766c('0x2e')](_0x30111b['query']);_0x4a3bf6[_0x766c('0x37')]=_[_0x766c('0x2f')](_0x4a3bf6[_0x766c('0x2c')],_0x4a3bf6[_0x766c('0x2d')]);_0x2610de[_0x766c('0x30')]=_[_0x766c('0x2f')](_0x4a3bf6['model'],qs[_0x766c('0x31')](_0x30111b[_0x766c('0x2d')][_0x766c('0x31')]));_0x2610de[_0x766c('0x30')]=_0x2610de[_0x766c('0x30')]['length']?_0x2610de[_0x766c('0x30')]:_0x4a3bf6['model'];if(_0x30111b[_0x766c('0x2d')][_0x766c('0x3c')]){_0x2610de[_0x766c('0x3d')]=[{'all':!![]}];}_0x2610de=_[_0x766c('0x3b')]({},_0x2610de,_0x30111b[_0x766c('0x43')]);return db[_0x766c('0x27')][_0x766c('0x44')](_0x2610de)[_0x766c('0x21')](handleEntityNotFound(_0x20449b,null))[_0x766c('0x21')](respondWithResult(_0x20449b,null))['catch'](handleError(_0x20449b,null));};exports[_0x766c('0x45')]=function(_0x4bf208,_0x3ad9de){return db[_0x766c('0x27')][_0x766c('0x45')](_0x4bf208[_0x766c('0x46')],{})[_0x766c('0x21')](respondWithResult(_0x3ad9de,0xc9))[_0x766c('0x40')](handleError(_0x3ad9de,null));};exports[_0x766c('0x20')]=function(_0x4550ca,_0x1d6c2f){if(_0x4550ca['body']['id']){delete _0x4550ca[_0x766c('0x46')]['id'];}return db[_0x766c('0x27')]['find']({'where':{'id':_0x4550ca['params']['id']}})[_0x766c('0x21')](handleEntityNotFound(_0x1d6c2f,null))[_0x766c('0x21')](saveUpdates(_0x4550ca[_0x766c('0x46')],null))[_0x766c('0x21')](respondWithResult(_0x1d6c2f,null))[_0x766c('0x40')](handleError(_0x1d6c2f,null));};exports[_0x766c('0x22')]=function(_0x1d12dc,_0x1cb939){return db['OpenchannelTransferReport'][_0x766c('0x44')]({'where':{'id':_0x1d12dc[_0x766c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1cb939,null))[_0x766c('0x21')](removeEntity(_0x1cb939,null))['catch'](handleError(_0x1cb939,null));};exports['describe']=function(_0x371f95,_0xb9fc52){return db[_0x766c('0x27')][_0x766c('0x47')]()[_0x766c('0x21')](respondWithResult(_0xb9fc52,null))[_0x766c('0x40')](handleError(_0xb9fc52,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c1b42ab..f350148 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 _0xae88=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x1efd4e,_0x14c4c5){var _0x5c973d=function(_0x40029c){while(--_0x40029c){_0x1efd4e['push'](_0x1efd4e['shift']());}};_0x5c973d(++_0x14c4c5);}(_0xae88,0x95));var _0x8ae8=function(_0x3a6775,_0x310b2b){_0x3a6775=_0x3a6775-0x0;var _0x14ae0e=_0xae88[_0x3a6775];return _0x14ae0e;};'use strict';var _=require(_0x8ae8('0x0'));var util=require(_0x8ae8('0x1'));var logger=require('../../config/logger')(_0x8ae8('0x2'));var moment=require(_0x8ae8('0x3'));var BPromise=require(_0x8ae8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ae8('0x5'));var rimraf=require(_0x8ae8('0x6'));var config=require(_0x8ae8('0x7'));var attributes=require(_0x8ae8('0x8'));module[_0x8ae8('0x9')]=function(_0x840670,_0x1679d2){return _0x840670[_0x8ae8('0xa')](_0x8ae8('0xb'),attributes,{'tableName':_0x8ae8('0xc'),'paranoid':![],'indexes':[{'name':_0x8ae8('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1e24=['./openchannelTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x50b799,_0x395512){var _0x443e84=function(_0x2dbe58){while(--_0x2dbe58){_0x50b799['push'](_0x50b799['shift']());}};_0x443e84(++_0x395512);}(_0x1e24,0x10b));var _0x41e2=function(_0x165082,_0x207ae8){_0x165082=_0x165082-0x0;var _0x21989b=_0x1e24[_0x165082];return _0x21989b;};'use strict';var _=require(_0x41e2('0x0'));var util=require(_0x41e2('0x1'));var logger=require(_0x41e2('0x2'))(_0x41e2('0x3'));var moment=require(_0x41e2('0x4'));var BPromise=require(_0x41e2('0x5'));var rp=require(_0x41e2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41e2('0x7'));var config=require(_0x41e2('0x8'));var attributes=require(_0x41e2('0x9'));module[_0x41e2('0xa')]=function(_0x4e29a3,_0x2deb25){return _0x4e29a3['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x41e2('0xb'),'fields':[_0x41e2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index e2da7b6..04390b0 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 _0xb138=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xb138,0x1dd));var _0x8b13=function(_0x36a0ea,_0x40bad8){_0x36a0ea=_0x36a0ea-0x0;var _0xdd6f75=_0xb138[_0x36a0ea];return _0xdd6f75;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));var BPromise=require(_0x8b13('0x3'));var rs=require(_0x8b13('0x4'));var fs=require('fs');var Redis=require(_0x8b13('0x5'));var db=require(_0x8b13('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b13('0x7'))(_0x8b13('0x8'));var config=require(_0x8b13('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8b13('0xa')][_0x8b13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){return client[_0x8b13('0xc')](_0x5d51b1,_0x33d1a7)[_0x8b13('0xd')](function(_0x58683a){logger['info'](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));logger[_0x8b13('0x10')](_0x8b13('0x11'),_0x3fdf4d,_0x8b13('0xf'),JSON['stringify'](_0x58683a));if(_0x58683a[_0x8b13('0x12')]){if(_0x58683a[_0x8b13('0x12')][_0x8b13('0x13')]===0x1f4){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x58683a[_0x8b13('0x12')]['message']);return _0x498832(_0x58683a['error'][_0x8b13('0x14')]);}logger[_0x8b13('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3fdf4d,_0x58683a['error']['message']);return _0x22e157(_0x58683a[_0x8b13('0x12')][_0x8b13('0x14')]);}else{logger[_0x8b13('0x15')](_0x8b13('0xe'),_0x3fdf4d,_0x8b13('0xf'));_0x22e157(_0x58683a['result'][_0x8b13('0x14')]);}})[_0x8b13('0x16')](function(_0x393bc1){logger[_0x8b13('0x12')](_0x8b13('0xe'),_0x3fdf4d,_0x393bc1);_0x498832(_0x393bc1);});});} \ No newline at end of file +var _0x7118=['info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x517c81,_0x2c891c){var _0x2926b1=function(_0x16b914){while(--_0x16b914){_0x517c81['push'](_0x517c81['shift']());}};_0x2926b1(++_0x2c891c);}(_0x7118,0x159));var _0x8711=function(_0x2deb2b,_0x2dcdc0){_0x2deb2b=_0x2deb2b-0x0;var _0x4fffa7=_0x7118[_0x2deb2b];return _0x4fffa7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8711('0x0'));var BPromise=require(_0x8711('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8711('0x2'));var db=require(_0x8711('0x3'))['db'];var utils=require(_0x8711('0x4'));var logger=require(_0x8711('0x5'))(_0x8711('0x6'));var config=require(_0x8711('0x7'));var jayson=require(_0x8711('0x8'));var client=jayson['client'][_0x8711('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2244c2,_0x1f23a9,_0x3d82f2){return new BPromise(function(_0x189349,_0xa46f29){return client[_0x8711('0xa')](_0x2244c2,_0x3d82f2)[_0x8711('0xb')](function(_0x32a826){logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,'request\x20sent');logger['debug'](_0x8711('0xe'),_0x1f23a9,_0x8711('0xf'),JSON[_0x8711('0x10')](_0x32a826));if(_0x32a826['error']){if(_0x32a826['error'][_0x8711('0x11')]===0x1f4){logger[_0x8711('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1f23a9,_0x32a826['error'][_0x8711('0x13')]);return _0xa46f29(_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);}logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x32a826[_0x8711('0x12')][_0x8711('0x13')]);return _0x189349(_0x32a826['error'][_0x8711('0x13')]);}else{logger[_0x8711('0xc')](_0x8711('0xd'),_0x1f23a9,_0x8711('0xf'));_0x189349(_0x32a826[_0x8711('0x14')][_0x8711('0x13')]);}})['catch'](function(_0x2f96a0){logger[_0x8711('0x12')](_0x8711('0xd'),_0x1f23a9,_0x2f96a0);_0xa46f29(_0x2f96a0);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 6e91bd9..3e1025f 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 _0xbe54=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x3804d4,_0x485bdf){var _0x56c9b0=function(_0x508329){while(--_0x508329){_0x3804d4['push'](_0x3804d4['shift']());}};_0x56c9b0(++_0x485bdf);}(_0xbe54,0xe8));var _0x4be5=function(_0x1443e1,_0x196f77){_0x1443e1=_0x1443e1-0x0;var _0x8f8baa=_0xbe54[_0x1443e1];return _0x8f8baa;};'use strict';var multer=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var path=require(_0x4be5('0x2'));var timeout=require(_0x4be5('0x3'));var express=require('express');var router=express[_0x4be5('0x4')]();var fs_extra=require(_0x4be5('0x5'));var auth=require(_0x4be5('0x6'));var interaction=require(_0x4be5('0x7'));var config=require(_0x4be5('0x8'));var controller=require('./pause.controller');router[_0x4be5('0x9')]('/',auth['isAuthenticated'](),controller[_0x4be5('0xa')]);router['get'](_0x4be5('0xb'),auth[_0x4be5('0xc')](),controller[_0x4be5('0xd')]);router[_0x4be5('0xe')]('/',auth[_0x4be5('0xc')](),controller['create']);router['put'](_0x4be5('0xb'),auth['isAuthenticated'](),controller[_0x4be5('0xf')]);router[_0x4be5('0x10')]('/:id',auth[_0x4be5('0xc')](),controller[_0x4be5('0x11')]);module[_0x4be5('0x12')]=router; \ No newline at end of file +var _0x2ddf=['index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./pause.controller','get','isAuthenticated'];(function(_0x363150,_0x1d1aac){var _0x546cef=function(_0x43cdbf){while(--_0x43cdbf){_0x363150['push'](_0x363150['shift']());}};_0x546cef(++_0x1d1aac);}(_0x2ddf,0x135));var _0xf2dd=function(_0x51a6fe,_0x2d7873){_0x51a6fe=_0x51a6fe-0x0;var _0x403af7=_0x2ddf[_0x51a6fe];return _0x403af7;};'use strict';var multer=require(_0xf2dd('0x0'));var util=require(_0xf2dd('0x1'));var path=require(_0xf2dd('0x2'));var timeout=require(_0xf2dd('0x3'));var express=require(_0xf2dd('0x4'));var router=express[_0xf2dd('0x5')]();var fs_extra=require(_0xf2dd('0x6'));var auth=require(_0xf2dd('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf2dd('0x8'));router[_0xf2dd('0x9')]('/',auth[_0xf2dd('0xa')](),controller[_0xf2dd('0xb')]);router[_0xf2dd('0x9')](_0xf2dd('0xc'),auth['isAuthenticated'](),controller[_0xf2dd('0xd')]);router[_0xf2dd('0xe')]('/',auth[_0xf2dd('0xa')](),controller[_0xf2dd('0xf')]);router[_0xf2dd('0x10')](_0xf2dd('0xc'),auth['isAuthenticated'](),controller[_0xf2dd('0x11')]);router[_0xf2dd('0x12')](_0xf2dd('0xc'),auth[_0xf2dd('0xa')](),controller[_0xf2dd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5ce6ca4..e1a14cf 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 _0xa35e=['exports','STRING','name','sequelize'];(function(_0x7813bb,_0x1d6ef2){var _0x37bf3f=function(_0x3e258f){while(--_0x3e258f){_0x7813bb['push'](_0x7813bb['shift']());}};_0x37bf3f(++_0x1d6ef2);}(_0xa35e,0x183));var _0xea35=function(_0xc6b3f5,_0x4b6068){_0xc6b3f5=_0xc6b3f5-0x0;var _0x384c0e=_0xa35e[_0xc6b3f5];return _0x384c0e;};'use strict';var Sequelize=require(_0xea35('0x0'));module[_0xea35('0x1')]={'name':{'type':Sequelize[_0xea35('0x2')],'unique':_0xea35('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xea35('0x2')]}}; \ No newline at end of file +var _0xd723=['sequelize','exports','STRING','name'];(function(_0x51cf5a,_0x6f132){var _0x1d7d6d=function(_0x3e1465){while(--_0x3e1465){_0x51cf5a['push'](_0x51cf5a['shift']());}};_0x1d7d6d(++_0x6f132);}(_0xd723,0x128));var _0x3d72=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd723[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x3d72('0x0'));module[_0x3d72('0x1')]={'name':{'type':Sequelize[_0x3d72('0x2')],'unique':_0x3d72('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3d72('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2418b12..e757cd3 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 _0x399e=['role','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../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','apply','reject','save','then','destroy','Pauses','UserProfileResource','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user'];(function(_0x291b8f,_0x3b8484){var _0x3b504b=function(_0x319559){while(--_0x319559){_0x291b8f['push'](_0x291b8f['shift']());}};_0x3b504b(++_0x3b8484);}(_0x399e,0x105));var _0xe399=function(_0x3b826d,_0x1d0b68){_0x3b826d=_0x3b826d-0x0;var _0x38e1b3=_0x399e[_0x3b826d];return _0x38e1b3;};'use strict';var emlformat=require(_0xe399('0x0'));var rimraf=require(_0xe399('0x1'));var zipdir=require(_0xe399('0x2'));var jsonpatch=require(_0xe399('0x3'));var rp=require(_0xe399('0x4'));var moment=require(_0xe399('0x5'));var BPromise=require(_0xe399('0x6'));var Mustache=require(_0xe399('0x7'));var util=require(_0xe399('0x8'));var path=require(_0xe399('0x9'));var sox=require(_0xe399('0xa'));var csv=require(_0xe399('0xb'));var ejs=require(_0xe399('0xc'));var fs=require('fs');var fs_extra=require(_0xe399('0xd'));var _=require(_0xe399('0xe'));var squel=require(_0xe399('0xf'));var crypto=require(_0xe399('0x10'));var jsforce=require(_0xe399('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe399('0x12'));var Papa=require('papaparse');var Redis=require(_0xe399('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe399('0x14'));var as=require(_0xe399('0x15'));var hardwareService=require(_0xe399('0x16'));var logger=require(_0xe399('0x17'))(_0xe399('0x18'));var utils=require(_0xe399('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe399('0x1a'));var db=require(_0xe399('0x1b'))['db'];function respondWithStatusCode(_0x5da55c,_0x1c4bb8){_0x1c4bb8=_0x1c4bb8||0xcc;return function(_0x30b1c1){if(_0x30b1c1){return _0x5da55c[_0xe399('0x1c')](_0x1c4bb8);}return _0x5da55c[_0xe399('0x1d')](_0x1c4bb8)[_0xe399('0x1e')]();};}function respondWithResult(_0x545e75,_0x5cce37){_0x5cce37=_0x5cce37||0xc8;return function(_0x919e39){if(_0x919e39){return _0x545e75[_0xe399('0x1d')](_0x5cce37)[_0xe399('0x1f')](_0x919e39);}};}function respondWithFilteredResult(_0x15ec6e,_0x460b2e){return function(_0x5602ad){if(_0x5602ad){var _0x4572b0=typeof _0x460b2e[_0xe399('0x20')]===_0xe399('0x21')&&typeof _0x460b2e[_0xe399('0x22')]===_0xe399('0x21');var _0x5b0541=_0x5602ad[_0xe399('0x23')];var _0x258f8b=_0x4572b0?0x0:_0x460b2e[_0xe399('0x20')];var _0x48c4d1=_0x4572b0?_0x5602ad['count']:_0x460b2e[_0xe399('0x20')]+_0x460b2e['limit'];var _0xdbda11;if(_0x48c4d1>=_0x5b0541){_0x48c4d1=_0x5b0541;_0xdbda11=0xc8;}else{_0xdbda11=0xce;}_0x15ec6e['status'](_0xdbda11);return _0x15ec6e[_0xe399('0x24')]('Content-Range',_0x258f8b+'-'+_0x48c4d1+'/'+_0x5b0541)['json'](_0x5602ad);}return null;};}function patchUpdates(_0x439a98){return function(_0x19d37f){try{jsonpatch[_0xe399('0x25')](_0x19d37f,_0x439a98,!![]);}catch(_0x3a6dd3){return BPromise[_0xe399('0x26')](_0x3a6dd3);}return _0x19d37f[_0xe399('0x27')]();};}function saveUpdates(_0x2bf394,_0x5f08a5){return function(_0x5e6064){if(_0x5e6064){return _0x5e6064['update'](_0x2bf394)[_0xe399('0x28')](function(_0x344c85){return _0x344c85;});}return null;};}function removeEntity(_0x525a49,_0x3dee9b){return function(_0x1fc0f8){if(_0x1fc0f8){return _0x1fc0f8[_0xe399('0x29')]()[_0xe399('0x28')](function(){var _0x4dc4e8=_0x1fc0f8['get']({'plain':!![]});var _0x2ee0f7=_0xe399('0x2a');return db[_0xe399('0x2b')][_0xe399('0x29')]({'where':{'type':_0x2ee0f7,'resourceId':_0x4dc4e8['id']}})[_0xe399('0x28')](function(){return _0x1fc0f8;});})[_0xe399('0x28')](function(){_0x525a49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad4ea,_0x423a35){return function(_0x1ceb1f){if(!_0x1ceb1f){_0x3ad4ea['sendStatus'](0x194);}return _0x1ceb1f;};}function handleError(_0x15fe31,_0x5f35cf){_0x5f35cf=_0x5f35cf||0x1f4;return function(_0x2b5d22){logger['error'](_0x2b5d22[_0xe399('0x2c')]);if(_0x2b5d22[_0xe399('0x2d')]){delete _0x2b5d22[_0xe399('0x2d')];}_0x15fe31[_0xe399('0x1d')](_0x5f35cf)[_0xe399('0x2e')](_0x2b5d22);};}exports['index']=function(_0x4c82f1,_0x26529f){var _0x1b4179={},_0x5ca457={},_0x595184={'count':0x0,'rows':[]};var _0x5d3d72=_[_0xe399('0x2f')](db[_0xe399('0x30')][_0xe399('0x31')],function(_0x462f0e){return{'name':_0x462f0e[_0xe399('0x32')],'type':_0x462f0e[_0xe399('0x33')][_0xe399('0x34')]};});_0x5ca457[_0xe399('0x35')]=_['map'](_0x5d3d72,_0xe399('0x2d'));_0x5ca457[_0xe399('0x36')]=_['keys'](_0x4c82f1['query']);_0x5ca457[_0xe399('0x37')]=_[_0xe399('0x38')](_0x5ca457[_0xe399('0x35')],_0x5ca457['query']);_0x1b4179['attributes']=_[_0xe399('0x38')](_0x5ca457['model'],qs[_0xe399('0x39')](_0x4c82f1[_0xe399('0x36')][_0xe399('0x39')]));_0x1b4179[_0xe399('0x3a')]=_0x1b4179[_0xe399('0x3a')][_0xe399('0x3b')]?_0x1b4179[_0xe399('0x3a')]:_0x5ca457[_0xe399('0x35')];if(!_0x4c82f1[_0xe399('0x36')]['hasOwnProperty'](_0xe399('0x3c'))){_0x1b4179[_0xe399('0x22')]=qs[_0xe399('0x22')](_0x4c82f1[_0xe399('0x36')][_0xe399('0x22')]);_0x1b4179[_0xe399('0x20')]=qs[_0xe399('0x20')](_0x4c82f1['query'][_0xe399('0x20')]);}_0x1b4179[_0xe399('0x3d')]=qs[_0xe399('0x3e')](_0x4c82f1[_0xe399('0x36')][_0xe399('0x3e')]);_0x1b4179[_0xe399('0x3f')]=qs[_0xe399('0x37')](_['pick'](_0x4c82f1[_0xe399('0x36')],_0x5ca457[_0xe399('0x37')]),_0x5d3d72);if(_0x4c82f1[_0xe399('0x36')]['filter']){_0x1b4179[_0xe399('0x3f')]=_[_0xe399('0x40')](_0x1b4179[_0xe399('0x3f')],{'$or':_['map'](_0x5d3d72,function(_0xd68204){if(_0xd68204['type']!==_0xe399('0x41')){var _0x3e09fc={};_0x3e09fc[_0xd68204['name']]={'$like':'%'+_0x4c82f1[_0xe399('0x36')]['filter']+'%'};return _0x3e09fc;}})});}_0x1b4179=_[_0xe399('0x40')]({},_0x1b4179,_0x4c82f1[_0xe399('0x42')]);var _0x1f0d80={'where':_0x1b4179['where']};return db[_0xe399('0x30')][_0xe399('0x23')](_0x1f0d80)[_0xe399('0x28')](function(_0x45901c){_0x595184[_0xe399('0x23')]=_0x45901c;if(_0x4c82f1[_0xe399('0x36')][_0xe399('0x43')]){_0x1b4179[_0xe399('0x44')]=[{'all':!![]}];}return db['Pause'][_0xe399('0x45')](_0x1b4179);})[_0xe399('0x28')](function(_0x15313f){_0x595184[_0xe399('0x46')]=_0x15313f;return _0x595184;})[_0xe399('0x28')](respondWithFilteredResult(_0x26529f,_0x1b4179))[_0xe399('0x47')](handleError(_0x26529f,null));};exports[_0xe399('0x48')]=function(_0x393ad4,_0x182acc){var _0x3575f2={'raw':!![],'where':{'id':_0x393ad4[_0xe399('0x49')]['id']}},_0x1a1901={};_0x1a1901[_0xe399('0x35')]=_[_0xe399('0x4a')](db[_0xe399('0x30')]['rawAttributes']);_0x1a1901['query']=_[_0xe399('0x4a')](_0x393ad4[_0xe399('0x36')]);_0x1a1901[_0xe399('0x37')]=_[_0xe399('0x38')](_0x1a1901[_0xe399('0x35')],_0x1a1901['query']);_0x3575f2['attributes']=_[_0xe399('0x38')](_0x1a1901['model'],qs[_0xe399('0x39')](_0x393ad4['query']['fields']));_0x3575f2[_0xe399('0x3a')]=_0x3575f2[_0xe399('0x3a')][_0xe399('0x3b')]?_0x3575f2['attributes']:_0x1a1901[_0xe399('0x35')];if(_0x393ad4[_0xe399('0x36')][_0xe399('0x43')]){_0x3575f2[_0xe399('0x44')]=[{'all':!![]}];}_0x3575f2=_['merge']({},_0x3575f2,_0x393ad4[_0xe399('0x42')]);return db[_0xe399('0x30')][_0xe399('0x4b')](_0x3575f2)[_0xe399('0x28')](handleEntityNotFound(_0x182acc,null))[_0xe399('0x28')](respondWithResult(_0x182acc,null))[_0xe399('0x47')](handleError(_0x182acc,null));};exports[_0xe399('0x4c')]=function(_0x5bf2f0,_0x22d945){return db[_0xe399('0x30')]['create'](_0x5bf2f0[_0xe399('0x4d')],{})[_0xe399('0x28')](function(_0x64cd6b){var _0x3dee82=_0x5bf2f0[_0xe399('0x4e')]['get']({'plain':!![]});if(!_0x3dee82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3dee82[_0xe399('0x4f')]===_0xe399('0x4e')){var _0x4dabb9=_0x64cd6b[_0xe399('0x50')]({'plain':!![]});var _0x12cec7=_0xe399('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x12cec7,'userProfileId':_0x3dee82[_0xe399('0x51')]},'raw':!![]})[_0xe399('0x28')](function(_0x441857){if(_0x441857&&_0x441857[_0xe399('0x52')]===0x0){return db[_0xe399('0x2b')][_0xe399('0x4c')]({'name':_0x4dabb9['name'],'resourceId':_0x4dabb9['id'],'type':_0x441857[_0xe399('0x2d')],'sectionId':_0x441857['id']},{})[_0xe399('0x28')](function(){return _0x64cd6b;});}else{return _0x64cd6b;}})[_0xe399('0x47')](function(_0xfb1b85){logger[_0xe399('0x53')](_0xe399('0x54'),_0xfb1b85);throw _0xfb1b85;});}return _0x64cd6b;})[_0xe399('0x28')](respondWithResult(_0x22d945,0xc9))[_0xe399('0x47')](handleError(_0x22d945,null));};exports['update']=function(_0x5657b7,_0x354fa2){if(_0x5657b7['body']['id']){delete _0x5657b7[_0xe399('0x4d')]['id'];}return db[_0xe399('0x30')][_0xe399('0x4b')]({'where':{'id':_0x5657b7[_0xe399('0x49')]['id']}})['then'](handleEntityNotFound(_0x354fa2,null))[_0xe399('0x28')](saveUpdates(_0x5657b7[_0xe399('0x4d')],null))[_0xe399('0x28')](respondWithResult(_0x354fa2,null))[_0xe399('0x47')](handleError(_0x354fa2,null));};exports[_0xe399('0x29')]=function(_0x1bba2f,_0x4d756d){return db[_0xe399('0x30')][_0xe399('0x4b')]({'where':{'id':_0x1bba2f['params']['id']}})[_0xe399('0x28')](handleEntityNotFound(_0x4d756d,null))[_0xe399('0x28')](removeEntity(_0x4d756d,null))[_0xe399('0x47')](handleError(_0x4d756d,null));}; \ No newline at end of file +var _0xee6f=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','get','Pauses','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Pause','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format'];(function(_0x2ee33f,_0x3d0577){var _0x239aac=function(_0x1a02c8){while(--_0x1a02c8){_0x2ee33f['push'](_0x2ee33f['shift']());}};_0x239aac(++_0x3d0577);}(_0xee6f,0x1a8));var _0xfee6=function(_0x51026e,_0x193bf5){_0x51026e=_0x51026e-0x0;var _0x5780d1=_0xee6f[_0x51026e];return _0x5780d1;};'use strict';var emlformat=require(_0xfee6('0x0'));var rimraf=require(_0xfee6('0x1'));var zipdir=require(_0xfee6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfee6('0x3'));var moment=require(_0xfee6('0x4'));var BPromise=require(_0xfee6('0x5'));var Mustache=require(_0xfee6('0x6'));var util=require(_0xfee6('0x7'));var path=require(_0xfee6('0x8'));var sox=require('sox');var csv=require(_0xfee6('0x9'));var ejs=require(_0xfee6('0xa'));var fs=require('fs');var fs_extra=require(_0xfee6('0xb'));var _=require('lodash');var squel=require(_0xfee6('0xc'));var crypto=require('crypto');var jsforce=require(_0xfee6('0xd'));var deskjs=require(_0xfee6('0xe'));var toCsv=require(_0xfee6('0x9'));var querystring=require('querystring');var Papa=require(_0xfee6('0xf'));var Redis=require(_0xfee6('0x10'));var authService=require(_0xfee6('0x11'));var qs=require(_0xfee6('0x12'));var as=require(_0xfee6('0x13'));var hardwareService=require(_0xfee6('0x14'));var logger=require(_0xfee6('0x15'))(_0xfee6('0x16'));var utils=require(_0xfee6('0x17'));var config=require(_0xfee6('0x18'));var licenseUtil=require(_0xfee6('0x19'));var db=require(_0xfee6('0x1a'))['db'];function respondWithStatusCode(_0x1c0b12,_0x37418e){_0x37418e=_0x37418e||0xcc;return function(_0x3f5506){if(_0x3f5506){return _0x1c0b12['sendStatus'](_0x37418e);}return _0x1c0b12[_0xfee6('0x1b')](_0x37418e)['end']();};}function respondWithResult(_0x3c959c,_0x249b39){_0x249b39=_0x249b39||0xc8;return function(_0x19f24c){if(_0x19f24c){return _0x3c959c[_0xfee6('0x1b')](_0x249b39)[_0xfee6('0x1c')](_0x19f24c);}};}function respondWithFilteredResult(_0x4d0b36,_0x557df9){return function(_0x1f6bc8){if(_0x1f6bc8){var _0x330373=typeof _0x557df9[_0xfee6('0x1d')]==='undefined'&&typeof _0x557df9[_0xfee6('0x1e')]===_0xfee6('0x1f');var _0x970e7b=_0x1f6bc8[_0xfee6('0x20')];var _0x38d928=_0x330373?0x0:_0x557df9['offset'];var _0x5ba6a6=_0x330373?_0x1f6bc8[_0xfee6('0x20')]:_0x557df9['offset']+_0x557df9['limit'];var _0x29d7aa;if(_0x5ba6a6>=_0x970e7b){_0x5ba6a6=_0x970e7b;_0x29d7aa=0xc8;}else{_0x29d7aa=0xce;}_0x4d0b36[_0xfee6('0x1b')](_0x29d7aa);return _0x4d0b36['set'](_0xfee6('0x21'),_0x38d928+'-'+_0x5ba6a6+'/'+_0x970e7b)[_0xfee6('0x1c')](_0x1f6bc8);}return null;};}function patchUpdates(_0x2fea53){return function(_0x4d6162){try{jsonpatch['apply'](_0x4d6162,_0x2fea53,!![]);}catch(_0x54cfcd){return BPromise['reject'](_0x54cfcd);}return _0x4d6162[_0xfee6('0x22')]();};}function saveUpdates(_0x5f50df,_0x23fe73){return function(_0x507ca2){if(_0x507ca2){return _0x507ca2[_0xfee6('0x23')](_0x5f50df)[_0xfee6('0x24')](function(_0x4f5fba){return _0x4f5fba;});}return null;};}function removeEntity(_0x5cd890,_0x4f91cd){return function(_0x1ddc0c){if(_0x1ddc0c){return _0x1ddc0c[_0xfee6('0x25')]()['then'](function(){var _0x1d9ec7=_0x1ddc0c[_0xfee6('0x26')]({'plain':!![]});var _0x93d088=_0xfee6('0x27');return db[_0xfee6('0x28')]['destroy']({'where':{'type':_0x93d088,'resourceId':_0x1d9ec7['id']}})[_0xfee6('0x24')](function(){return _0x1ddc0c;});})[_0xfee6('0x24')](function(){_0x5cd890[_0xfee6('0x1b')](0xcc)[_0xfee6('0x29')]();});}};}function handleEntityNotFound(_0x2f7c90,_0x5b67e0){return function(_0x25d529){if(!_0x25d529){_0x2f7c90[_0xfee6('0x2a')](0x194);}return _0x25d529;};}function handleError(_0x65e5b2,_0x558f49){_0x558f49=_0x558f49||0x1f4;return function(_0x310021){logger[_0xfee6('0x2b')](_0x310021[_0xfee6('0x2c')]);if(_0x310021['name']){delete _0x310021[_0xfee6('0x2d')];}_0x65e5b2[_0xfee6('0x1b')](_0x558f49)[_0xfee6('0x2e')](_0x310021);};}exports[_0xfee6('0x2f')]=function(_0x2ce81e,_0x49bfb1){var _0x2342ce={},_0x3ef9e9={},_0x4da921={'count':0x0,'rows':[]};var _0x46d028=_[_0xfee6('0x30')](db['Pause'][_0xfee6('0x31')],function(_0x45cc10){return{'name':_0x45cc10['fieldName'],'type':_0x45cc10[_0xfee6('0x32')][_0xfee6('0x33')]};});_0x3ef9e9[_0xfee6('0x34')]=_[_0xfee6('0x30')](_0x46d028,'name');_0x3ef9e9[_0xfee6('0x35')]=_[_0xfee6('0x36')](_0x2ce81e['query']);_0x3ef9e9[_0xfee6('0x37')]=_[_0xfee6('0x38')](_0x3ef9e9[_0xfee6('0x34')],_0x3ef9e9[_0xfee6('0x35')]);_0x2342ce[_0xfee6('0x39')]=_[_0xfee6('0x38')](_0x3ef9e9['model'],qs['fields'](_0x2ce81e[_0xfee6('0x35')][_0xfee6('0x3a')]));_0x2342ce['attributes']=_0x2342ce[_0xfee6('0x39')]['length']?_0x2342ce[_0xfee6('0x39')]:_0x3ef9e9['model'];if(!_0x2ce81e[_0xfee6('0x35')]['hasOwnProperty'](_0xfee6('0x3b'))){_0x2342ce[_0xfee6('0x1e')]=qs[_0xfee6('0x1e')](_0x2ce81e['query'][_0xfee6('0x1e')]);_0x2342ce['offset']=qs[_0xfee6('0x1d')](_0x2ce81e[_0xfee6('0x35')]['offset']);}_0x2342ce[_0xfee6('0x3c')]=qs[_0xfee6('0x3d')](_0x2ce81e[_0xfee6('0x35')][_0xfee6('0x3d')]);_0x2342ce['where']=qs['filters'](_[_0xfee6('0x3e')](_0x2ce81e[_0xfee6('0x35')],_0x3ef9e9['filters']),_0x46d028);if(_0x2ce81e[_0xfee6('0x35')][_0xfee6('0x3f')]){_0x2342ce[_0xfee6('0x40')]=_[_0xfee6('0x41')](_0x2342ce[_0xfee6('0x40')],{'$or':_[_0xfee6('0x30')](_0x46d028,function(_0xdac467){if(_0xdac467['type']!==_0xfee6('0x42')){var _0x35b72d={};_0x35b72d[_0xdac467['name']]={'$like':'%'+_0x2ce81e[_0xfee6('0x35')]['filter']+'%'};return _0x35b72d;}})});}_0x2342ce=_['merge']({},_0x2342ce,_0x2ce81e[_0xfee6('0x43')]);var _0x472847={'where':_0x2342ce[_0xfee6('0x40')]};return db[_0xfee6('0x44')][_0xfee6('0x20')](_0x472847)['then'](function(_0x1429c0){_0x4da921[_0xfee6('0x20')]=_0x1429c0;if(_0x2ce81e[_0xfee6('0x35')][_0xfee6('0x45')]){_0x2342ce['include']=[{'all':!![]}];}return db[_0xfee6('0x44')][_0xfee6('0x46')](_0x2342ce);})[_0xfee6('0x24')](function(_0x4a577c){_0x4da921[_0xfee6('0x47')]=_0x4a577c;return _0x4da921;})[_0xfee6('0x24')](respondWithFilteredResult(_0x49bfb1,_0x2342ce))[_0xfee6('0x48')](handleError(_0x49bfb1,null));};exports['show']=function(_0x2e10be,_0x1f1c74){var _0x994b45={'raw':!![],'where':{'id':_0x2e10be[_0xfee6('0x49')]['id']}},_0x20bf40={};_0x20bf40[_0xfee6('0x34')]=_[_0xfee6('0x36')](db[_0xfee6('0x44')][_0xfee6('0x31')]);_0x20bf40[_0xfee6('0x35')]=_['keys'](_0x2e10be[_0xfee6('0x35')]);_0x20bf40[_0xfee6('0x37')]=_[_0xfee6('0x38')](_0x20bf40[_0xfee6('0x34')],_0x20bf40[_0xfee6('0x35')]);_0x994b45[_0xfee6('0x39')]=_[_0xfee6('0x38')](_0x20bf40[_0xfee6('0x34')],qs[_0xfee6('0x3a')](_0x2e10be[_0xfee6('0x35')][_0xfee6('0x3a')]));_0x994b45['attributes']=_0x994b45[_0xfee6('0x39')][_0xfee6('0x4a')]?_0x994b45['attributes']:_0x20bf40[_0xfee6('0x34')];if(_0x2e10be[_0xfee6('0x35')][_0xfee6('0x45')]){_0x994b45[_0xfee6('0x4b')]=[{'all':!![]}];}_0x994b45=_[_0xfee6('0x41')]({},_0x994b45,_0x2e10be[_0xfee6('0x43')]);return db[_0xfee6('0x44')][_0xfee6('0x4c')](_0x994b45)[_0xfee6('0x24')](handleEntityNotFound(_0x1f1c74,null))[_0xfee6('0x24')](respondWithResult(_0x1f1c74,null))[_0xfee6('0x48')](handleError(_0x1f1c74,null));};exports[_0xfee6('0x4d')]=function(_0x108e99,_0xa3564){return db[_0xfee6('0x44')][_0xfee6('0x4d')](_0x108e99[_0xfee6('0x4e')],{})[_0xfee6('0x24')](function(_0x6dae01){var _0x5b3bbf=_0x108e99[_0xfee6('0x4f')][_0xfee6('0x26')]({'plain':!![]});if(!_0x5b3bbf)throw new Error(_0xfee6('0x50'));if(_0x5b3bbf[_0xfee6('0x51')]==='user'){var _0x5e9423=_0x6dae01[_0xfee6('0x26')]({'plain':!![]});var _0x30470a=_0xfee6('0x27');return db[_0xfee6('0x52')][_0xfee6('0x4c')]({'where':{'name':_0x30470a,'userProfileId':_0x5b3bbf['userProfileId']},'raw':!![]})[_0xfee6('0x24')](function(_0x1582f3){if(_0x1582f3&&_0x1582f3[_0xfee6('0x53')]===0x0){return db[_0xfee6('0x28')]['create']({'name':_0x5e9423['name'],'resourceId':_0x5e9423['id'],'type':_0x1582f3[_0xfee6('0x2d')],'sectionId':_0x1582f3['id']},{})[_0xfee6('0x24')](function(){return _0x6dae01;});}else{return _0x6dae01;}})['catch'](function(_0x5daa8d){logger[_0xfee6('0x2b')](_0xfee6('0x54'),_0x5daa8d);throw _0x5daa8d;});}return _0x6dae01;})[_0xfee6('0x24')](respondWithResult(_0xa3564,0xc9))[_0xfee6('0x48')](handleError(_0xa3564,null));};exports[_0xfee6('0x23')]=function(_0x1751ad,_0x1a3e08){if(_0x1751ad['body']['id']){delete _0x1751ad[_0xfee6('0x4e')]['id'];}return db[_0xfee6('0x44')][_0xfee6('0x4c')]({'where':{'id':_0x1751ad[_0xfee6('0x49')]['id']}})[_0xfee6('0x24')](handleEntityNotFound(_0x1a3e08,null))['then'](saveUpdates(_0x1751ad[_0xfee6('0x4e')],null))[_0xfee6('0x24')](respondWithResult(_0x1a3e08,null))['catch'](handleError(_0x1a3e08,null));};exports[_0xfee6('0x25')]=function(_0x525beb,_0x3dbe42){return db[_0xfee6('0x44')][_0xfee6('0x4c')]({'where':{'id':_0x525beb['params']['id']}})['then'](handleEntityNotFound(_0x3dbe42,null))['then'](removeEntity(_0x3dbe42,null))[_0xfee6('0x48')](handleError(_0x3dbe42,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 14bbbbe..ef8cc39 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 _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0xdb1403,_0x100491){var _0x3ce761=function(_0x43de53){while(--_0x43de53){_0xdb1403['push'](_0xdb1403['shift']());}};_0x3ce761(++_0x100491);}(_0xe14b,0x93));var _0xbe14=function(_0xb2a4d1,_0x328b4e){_0xb2a4d1=_0xb2a4d1-0x0;var _0x13a6d0=_0xe14b[_0xb2a4d1];return _0x13a6d0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_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 71fa821..7927be6 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(_0x4579db,_0x2bd39b){var _0x481160=function(_0x459aad){while(--_0x459aad){_0x4579db['push'](_0x4579db['shift']());}};_0x481160(++_0x2bd39b);}(_0xb10b,0x12a));var _0xbb10=function(_0x2bb398,_0xd7c0dc){_0x2bb398=_0x2bb398-0x0;var _0x4dfefc=_0xb10b[_0x2bb398];return _0x4dfefc;};'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(_0xc41362,_0x5607b1){var _0x1fd019=function(_0x23c514){while(--_0x23c514){_0xc41362['push'](_0xc41362['shift']());}};_0x1fd019(++_0x5607b1);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eff86,_0x2cdd22){_0x5eff86=_0x5eff86-0x0;var _0x4b3010=_0xb10b[_0x5eff86];return _0x4b3010;};'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 e4e7eea..6c72b5a 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 _0xc368=['show','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','put','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xc368,0x7b));var _0x8c36=function(_0x373cd3,_0x337ee7){_0x373cd3=_0x373cd3-0x0;var _0x40d659=_0xc368[_0x373cd3];return _0x40d659;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x8c36('0xe')]);var upload=multer({'storage':multer[_0x8c36('0xf')]({'destination':function(_0x5132f6,_0x36cb13,_0x1c49a0){_0x1c49a0(null,path[_0x8c36('0x10')](config[_0x8c36('0x11')],_0x8c36('0x12')));},'filename':function(_0x451c24,_0xa09884,_0x23eb71){_0xa09884[_0x8c36('0x13')]=_0xa09884[_0x8c36('0x13')][_0x8c36('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23eb71(null,util[_0x8c36('0x15')](_0x8c36('0x16'),path[_0x8c36('0x17')](_0xa09884['originalname'],path[_0x8c36('0x18')](_0xa09884['originalname'])),Date[_0x8c36('0x19')](),path[_0x8c36('0x18')](_0xa09884[_0x8c36('0x13')])));}})});router[_0x8c36('0x1a')]('/',upload[_0x8c36('0x1b')](_0x8c36('0x1c')),controller[_0x8c36('0x1d')]);router[_0x8c36('0x1a')](_0x8c36('0xa'),controller['webhookPost']);router[_0x8c36('0x1e')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x1f')]);router[_0x8c36('0x20')]('/:id',auth[_0x8c36('0x9')](),controller[_0x8c36('0x20')]);module[_0x8c36('0x21')]=router; \ No newline at end of file +var _0x524a=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','basename','now','extname','post','single','file','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./plugin.controller','get','isAuthenticated','webhookGet'];(function(_0xb17c76,_0x54f73d){var _0x2fd163=function(_0x54c704){while(--_0x54c704){_0xb17c76['push'](_0xb17c76['shift']());}};_0x2fd163(++_0x54f73d);}(_0x524a,0xf5));var _0xa524=function(_0x317c1f,_0x2ccd22){_0x317c1f=_0x317c1f-0x0;var _0x975aea=_0x524a[_0x317c1f];return _0x975aea;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/webhook',controller[_0xa524('0xa')]);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xb')]);router[_0xa524('0x8')](_0xa524('0xc'),auth[_0xa524('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xa524('0xd')]({'destination':function(_0x2ebea2,_0x59660a,_0x565fab){_0x565fab(null,path[_0xa524('0xe')](config[_0xa524('0xf')],_0xa524('0x10')));},'filename':function(_0x4936fa,_0x55117f,_0x14a0d6){_0x55117f['originalname']=_0x55117f[_0xa524('0x11')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x14a0d6(null,util[_0xa524('0x12')]('%s-%s%s',path[_0xa524('0x13')](_0x55117f[_0xa524('0x11')],path['extname'](_0x55117f[_0xa524('0x11')])),Date[_0xa524('0x14')](),path[_0xa524('0x15')](_0x55117f[_0xa524('0x11')])));}})});router[_0xa524('0x16')]('/',upload[_0xa524('0x17')](_0xa524('0x18')),controller['upload']);router[_0xa524('0x16')](_0xa524('0x19'),controller[_0xa524('0x1a')]);router[_0xa524('0x1b')](_0xa524('0x1c'),auth[_0xa524('0x9')](),controller[_0xa524('0x1d')]);router[_0xa524('0x1e')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x1e')]);module[_0xa524('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 1df5582..6142380 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 _0x0acf=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always'];(function(_0x19a4a7,_0xb76a5b){var _0x330bb9=function(_0x597af4){while(--_0x597af4){_0x19a4a7['push'](_0x19a4a7['shift']());}};_0x330bb9(++_0xb76a5b);}(_0x0acf,0x152));var _0xf0ac=function(_0x305117,_0x289f1a){_0x305117=_0x305117-0x0;var _0x184cb7=_0x0acf[_0x305117];return _0x184cb7;};'use strict';var Sequelize=require(_0xf0ac('0x0'));module['exports']={'name':{'type':Sequelize[_0xf0ac('0x1')]},'type':{'type':Sequelize[_0xf0ac('0x2')]('html',_0xf0ac('0x3'))},'description':{'type':Sequelize[_0xf0ac('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf0ac('0x1')],'comment':_0xf0ac('0x5')},'active':{'type':Sequelize[_0xf0ac('0x6')],'defaultValue':0x0,'comment':_0xf0ac('0x7')},'sidebar':{'type':Sequelize[_0xf0ac('0x2')](_0xf0ac('0x8'),'agentOnly',_0xf0ac('0x9'),_0xf0ac('0xa')),'defaultValue':_0xf0ac('0x9'),'comment':_0xf0ac('0xb')},'icon':{'type':Sequelize[_0xf0ac('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf0ac('0x1')]},'scriptName':{'type':Sequelize[_0xf0ac('0x1')]},'scriptPath':{'type':Sequelize[_0xf0ac('0x1')]}}; \ No newline at end of file +var _0x74ee=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always'];(function(_0x5564f6,_0x4f03a9){var _0x9d8f46=function(_0x1c7b2f){while(--_0x1c7b2f){_0x5564f6['push'](_0x5564f6['shift']());}};_0x9d8f46(++_0x4f03a9);}(_0x74ee,0x18d));var _0xe74e=function(_0x543744,_0x3ec903){_0x543744=_0x543744-0x0;var _0x2e28e8=_0x74ee[_0x543744];return _0x2e28e8;};'use strict';var Sequelize=require(_0xe74e('0x0'));module['exports']={'name':{'type':Sequelize[_0xe74e('0x1')]},'type':{'type':Sequelize[_0xe74e('0x2')](_0xe74e('0x3'),_0xe74e('0x4'))},'description':{'type':Sequelize[_0xe74e('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0xe74e('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe74e('0x7')},'sidebar':{'type':Sequelize[_0xe74e('0x2')](_0xe74e('0x8'),_0xe74e('0x9'),'always','never'),'defaultValue':_0xe74e('0xa'),'comment':_0xe74e('0xb')},'icon':{'type':Sequelize[_0xe74e('0x1')]},'adminUrl':{'type':Sequelize[_0xe74e('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xe74e('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index c02d261..88a65fc 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 _0x0d79=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','code','ENOENT','Error','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','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','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','undefined','name','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','download','statusCode','webhookPost','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','count','limit','Content-Range','json','apply','update','then','destroy','get','Plugins','UserProfileResource','error','stack','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x5739c3,_0x58007e){var _0x249635=function(_0x49fae1){while(--_0x49fae1){_0x5739c3['push'](_0x5739c3['shift']());}};_0x249635(++_0x58007e);}(_0x0d79,0x1cc));var _0x90d7=function(_0xff780c,_0x3c94eb){_0xff780c=_0xff780c-0x0;var _0x1f0861=_0x0d79[_0xff780c];return _0x1f0861;};'use strict';var emlformat=require(_0x90d7('0x0'));var rimraf=require(_0x90d7('0x1'));var zipdir=require(_0x90d7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90d7('0x3'));var moment=require(_0x90d7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x90d7('0x5'));var util=require('util');var path=require(_0x90d7('0x6'));var sox=require(_0x90d7('0x7'));var csv=require('to-csv');var ejs=require(_0x90d7('0x8'));var fs=require('fs');var fs_extra=require(_0x90d7('0x9'));var _=require(_0x90d7('0xa'));var squel=require(_0x90d7('0xb'));var crypto=require(_0x90d7('0xc'));var jsforce=require(_0x90d7('0xd'));var deskjs=require(_0x90d7('0xe'));var toCsv=require(_0x90d7('0xf'));var querystring=require(_0x90d7('0x10'));var Papa=require('papaparse');var extract=require(_0x90d7('0x11'));var rimraf=require(_0x90d7('0x1'));var archiver=require(_0x90d7('0x12'));var Redis=require(_0x90d7('0x13'));var authService=require(_0x90d7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x90d7('0x15'));var hardwareService=require(_0x90d7('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x90d7('0x17'));var config=require(_0x90d7('0x18'));var licenseUtil=require(_0x90d7('0x19'));var db=require(_0x90d7('0x1a'))['db'];config[_0x90d7('0x1b')]=_['defaults'](config[_0x90d7('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x90d7('0x1c'))(new Redis(config['redis']));require(_0x90d7('0x1d'))[_0x90d7('0x1e')](socket);function respondWithStatusCode(_0x3b1dbb,_0x3df6c6){_0x3df6c6=_0x3df6c6||0xcc;return function(_0x1ed517){if(_0x1ed517){return _0x3b1dbb[_0x90d7('0x1f')](_0x3df6c6);}return _0x3b1dbb[_0x90d7('0x20')](_0x3df6c6)[_0x90d7('0x21')]();};}function respondWithResult(_0x482cff,_0x5e11ca){_0x5e11ca=_0x5e11ca||0xc8;return function(_0x376763){if(_0x376763){return _0x482cff['status'](_0x5e11ca)['json'](_0x376763);}};}function respondWithFilteredResult(_0x39c4ce,_0x238362){return function(_0x444f27){if(_0x444f27){var _0x45a424=typeof _0x238362[_0x90d7('0x22')]==='undefined'&&typeof _0x238362['limit']==='undefined';var _0x1b1078=_0x444f27[_0x90d7('0x23')];var _0x3b9cd5=_0x45a424?0x0:_0x238362[_0x90d7('0x22')];var _0x5888a6=_0x45a424?_0x444f27['count']:_0x238362['offset']+_0x238362[_0x90d7('0x24')];var _0x4ab047;if(_0x5888a6>=_0x1b1078){_0x5888a6=_0x1b1078;_0x4ab047=0xc8;}else{_0x4ab047=0xce;}_0x39c4ce[_0x90d7('0x20')](_0x4ab047);return _0x39c4ce['set'](_0x90d7('0x25'),_0x3b9cd5+'-'+_0x5888a6+'/'+_0x1b1078)[_0x90d7('0x26')](_0x444f27);}return null;};}function patchUpdates(_0x3ee724){return function(_0x55e49a){try{jsonpatch[_0x90d7('0x27')](_0x55e49a,_0x3ee724,!![]);}catch(_0x483679){return BPromise['reject'](_0x483679);}return _0x55e49a['save']();};}function saveUpdates(_0x40028c,_0x22245a){return function(_0x50433c){if(_0x50433c){return _0x50433c[_0x90d7('0x28')](_0x40028c)[_0x90d7('0x29')](function(_0x3ac5be){return _0x3ac5be;});}return null;};}function removeEntity(_0x21351d,_0x2c7287){return function(_0x179798){if(_0x179798){return _0x179798[_0x90d7('0x2a')]()[_0x90d7('0x29')](function(){var _0x75577d=_0x179798[_0x90d7('0x2b')]({'plain':!![]});var _0x29ed42=_0x90d7('0x2c');return db[_0x90d7('0x2d')][_0x90d7('0x2a')]({'where':{'type':_0x29ed42,'resourceId':_0x75577d['id']}})['then'](function(){return _0x179798;});})[_0x90d7('0x29')](function(){_0x21351d[_0x90d7('0x20')](0xcc)[_0x90d7('0x21')]();});}};}function handleEntityNotFound(_0x1849d1,_0x136e86){return function(_0x35e3ad){if(!_0x35e3ad){_0x1849d1[_0x90d7('0x1f')](0x194);}return _0x35e3ad;};}function handleError(_0x244146,_0xb90deb){_0xb90deb=_0xb90deb||0x1f4;return function(_0x528b2f){logger[_0x90d7('0x2e')](_0x528b2f[_0x90d7('0x2f')]);if(_0x528b2f['name']){delete _0x528b2f['name'];}_0x244146[_0x90d7('0x20')](_0xb90deb)[_0x90d7('0x30')](_0x528b2f);};}exports[_0x90d7('0x31')]=function(_0x529ce8,_0x1c866f){var _0x28f72f={},_0x325d06={},_0x805b47={'count':0x0,'rows':[]};var _0x627b5e=_[_0x90d7('0x32')](db[_0x90d7('0x33')][_0x90d7('0x34')],function(_0x372e62){return{'name':_0x372e62[_0x90d7('0x35')],'type':_0x372e62[_0x90d7('0x36')][_0x90d7('0x37')]};});_0x325d06[_0x90d7('0x38')]=_[_0x90d7('0x32')](_0x627b5e,'name');_0x325d06[_0x90d7('0x39')]=_[_0x90d7('0x3a')](_0x529ce8[_0x90d7('0x39')]);_0x325d06[_0x90d7('0x3b')]=_[_0x90d7('0x3c')](_0x325d06['model'],_0x325d06[_0x90d7('0x39')]);_0x28f72f[_0x90d7('0x3d')]=_[_0x90d7('0x3c')](_0x325d06[_0x90d7('0x38')],qs[_0x90d7('0x3e')](_0x529ce8[_0x90d7('0x39')][_0x90d7('0x3e')]));_0x28f72f[_0x90d7('0x3d')]=_0x28f72f[_0x90d7('0x3d')][_0x90d7('0x3f')]?_0x28f72f[_0x90d7('0x3d')]:_0x325d06[_0x90d7('0x38')];if(!_0x529ce8['query'][_0x90d7('0x40')](_0x90d7('0x41'))){_0x28f72f[_0x90d7('0x24')]=qs['limit'](_0x529ce8[_0x90d7('0x39')][_0x90d7('0x24')]);_0x28f72f['offset']=qs[_0x90d7('0x22')](_0x529ce8['query'][_0x90d7('0x22')]);}_0x28f72f[_0x90d7('0x42')]=qs[_0x90d7('0x43')](_0x529ce8[_0x90d7('0x39')][_0x90d7('0x43')]);_0x28f72f[_0x90d7('0x44')]=qs[_0x90d7('0x3b')](_['pick'](_0x529ce8[_0x90d7('0x39')],_0x325d06[_0x90d7('0x3b')]),_0x627b5e);if(_0x529ce8[_0x90d7('0x39')][_0x90d7('0x45')]){_0x28f72f[_0x90d7('0x44')]=_[_0x90d7('0x46')](_0x28f72f[_0x90d7('0x44')],{'$or':_['map'](_0x627b5e,function(_0x2d742d){if(_0x2d742d['type']!==_0x90d7('0x47')){var _0xd9356e={};_0xd9356e[_0x2d742d['name']]={'$like':'%'+_0x529ce8[_0x90d7('0x39')]['filter']+'%'};return _0xd9356e;}})});}_0x28f72f=_['merge']({},_0x28f72f,_0x529ce8[_0x90d7('0x48')]);var _0x3126d7={'where':_0x28f72f[_0x90d7('0x44')]};return db[_0x90d7('0x33')][_0x90d7('0x23')](_0x3126d7)[_0x90d7('0x29')](function(_0x307394){_0x805b47['count']=_0x307394;if(_0x529ce8[_0x90d7('0x39')][_0x90d7('0x49')]){_0x28f72f[_0x90d7('0x4a')]=[{'all':!![]}];}return db[_0x90d7('0x33')][_0x90d7('0x4b')](_0x28f72f);})[_0x90d7('0x29')](function(_0x42a729){_0x805b47[_0x90d7('0x4c')]=_0x42a729;return _0x805b47;})[_0x90d7('0x29')](respondWithFilteredResult(_0x1c866f,_0x28f72f))[_0x90d7('0x4d')](handleError(_0x1c866f,null));};exports['show']=function(_0x427648,_0xf94b09){var _0x5e5d76={'raw':!![],'where':{'id':_0x427648[_0x90d7('0x4e')]['id']}},_0x41d1d1={};_0x41d1d1[_0x90d7('0x38')]=_[_0x90d7('0x3a')](db['Plugin'][_0x90d7('0x34')]);_0x41d1d1[_0x90d7('0x39')]=_['keys'](_0x427648['query']);_0x41d1d1[_0x90d7('0x3b')]=_[_0x90d7('0x3c')](_0x41d1d1[_0x90d7('0x38')],_0x41d1d1['query']);_0x5e5d76['attributes']=_[_0x90d7('0x3c')](_0x41d1d1[_0x90d7('0x38')],qs[_0x90d7('0x3e')](_0x427648[_0x90d7('0x39')][_0x90d7('0x3e')]));_0x5e5d76['attributes']=_0x5e5d76[_0x90d7('0x3d')]['length']?_0x5e5d76[_0x90d7('0x3d')]:_0x41d1d1[_0x90d7('0x38')];if(_0x427648[_0x90d7('0x39')][_0x90d7('0x49')]){_0x5e5d76['include']=[{'all':!![]}];}_0x5e5d76=_[_0x90d7('0x46')]({},_0x5e5d76,_0x427648[_0x90d7('0x48')]);return db['Plugin'][_0x90d7('0x4f')](_0x5e5d76)[_0x90d7('0x29')](handleEntityNotFound(_0xf94b09,null))['then'](respondWithResult(_0xf94b09,null))['catch'](handleError(_0xf94b09,null));};exports['download']=function(_0x11c30f,_0x1bdb0e,_0x54889d){return db[_0x90d7('0x33')]['find']({'where':{'id':_0x11c30f[_0x90d7('0x4e')]['id']},'attributes':['name','path'],'raw':!![]})[_0x90d7('0x29')](handleEntityNotFound(_0x1bdb0e,null))['then'](function(_0x244caf){if(_0x244caf){var _0xf8159f=path[_0x90d7('0x50')](config[_0x90d7('0x51')],_0x90d7('0x52'),util[_0x90d7('0x53')](_0x90d7('0x54'),path[_0x90d7('0x55')](_0x244caf['path'])));var _0x4df6b7=fs[_0x90d7('0x56')](_0xf8159f);var _0xc270c1=archiver(_0x90d7('0x57'),{'zlib':{'level':0x9}});_0xc270c1['on']('warning',function(_0x150ebe){if(_0x150ebe[_0x90d7('0x58')]===_0x90d7('0x59')){logger[_0x90d7('0x2e')](_0x150ebe);}else{throw new db['Sequelize'][(_0x90d7('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xc270c1['on']('error',function(_0x15af19){throw new db[(_0x90d7('0x5b'))][(_0x90d7('0x5a'))](_0x90d7('0x5c'));});_0xc270c1[_0x90d7('0x5d')](_0x4df6b7);_0xc270c1[_0x90d7('0x5e')](_0x90d7('0x5f'),{'cwd':path[_0x90d7('0x50')](config[_0x90d7('0x51')],_0x90d7('0x52'),path['dirname'](_0x244caf[_0x90d7('0x6')])),'ignore':[path[_0x90d7('0x50')](path[_0x90d7('0x55')](_0x244caf[_0x90d7('0x6')]),_0x90d7('0x60')),path[_0x90d7('0x50')](path['basename'](_0x244caf[_0x90d7('0x6')]),_0x90d7('0x61'))],'nodir':!![]})[_0x90d7('0x62')]();_0x4df6b7['on']('close',function(){if(!fs[_0x90d7('0x63')](_0xf8159f)){throw new db['Sequelize'][(_0x90d7('0x5a'))](_0x90d7('0x64'));}return _0x1bdb0e['download'](_0xf8159f,util[_0x90d7('0x53')](_0x90d7('0x54'),path[_0x90d7('0x55')](_0x244caf[_0x90d7('0x6')])),function(_0x483e0b){if(_0x483e0b){throw new db[(_0x90d7('0x5b'))][(_0x90d7('0x5a'))](_0x90d7('0x65'));}fs['unlinkSync'](_0xf8159f);logger[_0x90d7('0x66')](_0x90d7('0x67'));logger[_0x90d7('0x66')](_0x90d7('0x68'));});});}return null;})[_0x90d7('0x4d')](handleError(_0x1bdb0e,null));};exports[_0x90d7('0x69')]=function(_0x52a747,_0x4e3672,_0x34aed6){var _0x3acba2=path[_0x90d7('0x55')](_0x52a747[_0x90d7('0x6a')][_0x90d7('0x6b')],path[_0x90d7('0x6c')](_0x52a747['file'][_0x90d7('0x6b')]));var _0xb32e1f=path['join'](config[_0x90d7('0x51')],_0x90d7('0x52'),_0x52a747[_0x90d7('0x6a')][_0x90d7('0x6b')]);var _0x59a1bc=path['join'](config['root'],_0x90d7('0x52'),_0x3acba2);logger[_0x90d7('0x66')](_0x90d7('0x6d'),_0xb32e1f);logger[_0x90d7('0x66')](_0x90d7('0x6e'),_0x59a1bc);try{fs[_0x90d7('0x6f')](_0xb32e1f,parseInt(_0x90d7('0x70'),0x8));extract(_0xb32e1f,{'dir':_0x59a1bc},function(_0x321074){if(_0x321074){logger['error'](_0x321074);handleError(_0x321074,!![]);};var _0x5b5a81=fs[_0x90d7('0x71')](_0x59a1bc);if(_0x5b5a81[_0x90d7('0x3f')]>0x1){removeReferences(_0xb32e1f,_0x59a1bc);logger[_0x90d7('0x2e')]('Invalid\x20plugin\x20structure');return _0x34aed6(new Error(_0x90d7('0x72')));}var _0x566e4d=fs[_0x90d7('0x73')](path['join'](_0x59a1bc,_0x5b5a81[0x0]));if(_0x566e4d[_0x90d7('0x74')]()){removeReferences(_0xb32e1f,_0x59a1bc);logger[_0x90d7('0x2e')](_0x90d7('0x72'));return _0x34aed6(new Error(_0x90d7('0x72')));}if(_0x566e4d[_0x90d7('0x75')]()){var _0xbdce53=fs[_0x90d7('0x71')](path[_0x90d7('0x50')](_0x59a1bc,_0x5b5a81[0x0]));if(_0xbdce53[_0x90d7('0x3f')]===0x0){removeReferences(_0xb32e1f,_0x59a1bc);logger['error'](_0x90d7('0x72'));return _0x34aed6(new Error(_0x90d7('0x72')));}var _0x1a9351=_0xbdce53[_0x90d7('0x76')](function(_0x11e3d2){return _0x11e3d2==='manifest.json';});if(!_0x1a9351){return _0x34aed6(new Error(_0x90d7('0x77')));}var _0x44176f=fs[_0x90d7('0x78')](path[_0x90d7('0x50')](_0x59a1bc,_0x5b5a81[0x0],_0x90d7('0x79')));var _0x43c4a2=JSON['parse'](_0x44176f);if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7b')]){return _0x34aed6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x36')]){return _0x34aed6(new Error(_0x90d7('0x7c')));}if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7d')]){return _0x34aed6(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7e')]){return _0x34aed6(new Error(_0x90d7('0x7f')));}if(_0x43c4a2['type']===_0x90d7('0x80')){if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]){return _0x34aed6(new Error(_0x90d7('0x82')));}if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')][_0x90d7('0x83')]&&_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')][_0x90d7('0x84')]){return _0x34aed6(new Error(_0x90d7('0x85')));}}else if(_0x43c4a2[_0x90d7('0x36')]===_0x90d7('0x86')){if(_0x90d7('0x7a')==typeof _0x43c4a2['parameters'][_0x90d7('0x87')]){return _0x34aed6(new Error(_0x90d7('0x88')));}if(_0x90d7('0x7a')==typeof _0x43c4a2[_0x90d7('0x7e')]['scriptPath']){return _0x34aed6(new Error(_0x90d7('0x89')));}}else{return _0x34aed6(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5aadbc=_0x43c4a2[_0x90d7('0x7b')];var _0x124a09=_0x43c4a2['description'];var _0x282a0a=_0x43c4a2['type'];var _0x23d21c=_0x43c4a2[_0x90d7('0x8a')]?_0x43c4a2[_0x90d7('0x8a')]:_0x90d7('0x8b');var _0x473553=_0x43c4a2[_0x90d7('0x8c')]?_0x43c4a2[_0x90d7('0x8c')]:_0x90d7('0x8d');var _0x2fb72d='';var _0x45defb='';var _0x1a8270='';var _0x5d2f18='';var _0x52960e=_0x43c4a2['version'];if(_0x282a0a===_0x90d7('0x80')){if(_0x90d7('0x7a')!=typeof _0x43c4a2[_0x90d7('0x7e')]['views'][_0x90d7('0x83')]){var _0xa4cfec=_0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x90d7('0x8e')](_0xa4cfec)){_0x2fb72d=path[_0x90d7('0x50')](_0x90d7('0x8f'),_0x3acba2,_0x5b5a81[0x0],_0xa4cfec);}else{_0x2fb72d=_0xa4cfec;}}else{logger[_0x90d7('0x66')](_0x90d7('0x90'));}if('undefined'!=typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]['agent']){var _0x4efe30=_0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x90d7('0x8e')](_0x4efe30)){_0x45defb=path[_0x90d7('0x50')](_0x90d7('0x8f'),_0x3acba2,_0x5b5a81[0x0],_0x4efe30);}else{_0x45defb=_0x4efe30;}}else{logger[_0x90d7('0x66')](_0x90d7('0x91'));}}else if(_0x282a0a===_0x90d7('0x86')){_0x1a8270=_0x43c4a2['parameters']['scriptName'];_0x5d2f18=_0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x92')];if(_0x90d7('0x7a')!=typeof _0x43c4a2['parameters'][_0x90d7('0x81')]){if(_0x90d7('0x7a')!=typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]['admin']){var _0xa4cfec=_0x43c4a2['parameters'][_0x90d7('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x90d7('0x8e')](_0xa4cfec)){_0x2fb72d=path[_0x90d7('0x50')](_0x90d7('0x8f'),_0x3acba2,_0x5b5a81[0x0],_0xa4cfec);}else{_0x2fb72d=_0xa4cfec;}}if(_0x90d7('0x7a')!=typeof _0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')][_0x90d7('0x84')]){var _0x4efe30=_0x43c4a2[_0x90d7('0x7e')][_0x90d7('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x90d7('0x8e')](_0x4efe30)){_0x45defb=path[_0x90d7('0x50')](_0x90d7('0x8f'),_0x3acba2,_0x5b5a81[0x0],_0x4efe30);}else{_0x45defb=_0x4efe30;}}}}var _0x122308={'name':_0x5aadbc,'description':_0x124a09,'path':path['join'](_0x3acba2,_0x5b5a81[0x0]),'type':_0x282a0a,'sidebar':_0x23d21c,'icon':_0x473553,'adminUrl':_0x2fb72d,'agentUrl':_0x45defb,'scriptName':_0x1a8270,'scriptPath':_0x5d2f18,'version':_0x52960e};removeReferences(_0xb32e1f,null);return db['Plugin'][_0x90d7('0x93')](_0x122308)['then'](function(_0x586745){var _0x26c15d={'role':_0x52a747[_0x90d7('0x94')][_0x90d7('0x95')],'userProfileId':_0x52a747[_0x90d7('0x94')][_0x90d7('0x96')]};if(!_0x26c15d)throw new Error(_0x90d7('0x97'));if(_0x26c15d[_0x90d7('0x95')]==='user'){var _0x4001e9=_0x586745[_0x90d7('0x2b')]({'plain':!![]});return db[_0x90d7('0x98')][_0x90d7('0x4f')]({'where':{'name':_0x90d7('0x2c'),'userProfileId':_0x26c15d['userProfileId']},'raw':!![]})[_0x90d7('0x29')](function(_0x1c94c3){if(_0x1c94c3&&_0x1c94c3[_0x90d7('0x99')]===0x0){return db[_0x90d7('0x2d')][_0x90d7('0x93')]({'name':_0x4001e9['name'],'resourceId':_0x4001e9['id'],'type':_0x1c94c3['name'],'sectionId':_0x1c94c3['id']},{})[_0x90d7('0x29')](function(){return _0x586745;});}else{return _0x586745;}})[_0x90d7('0x4d')](function(_0x35243c){logger['error'](_0x90d7('0x9a'),_0x35243c);throw _0x35243c;});}return _0x586745;})['then'](respondWithResult(_0x4e3672,null))[_0x90d7('0x4d')](handleError(_0x4e3672,null));}});}catch(_0x57ca98){_0x4e3672[_0x90d7('0x20')](0x1f4)['send'](_0x57ca98);}};function removeReferences(_0x479528,_0x234e87){try{if(_0x479528){fs['unlinkSync'](_0x479528);logger[_0x90d7('0x66')](_0x90d7('0x9b'));}if(_0x234e87){rimraf(_0x234e87,function(){});logger[_0x90d7('0x66')](_0x90d7('0x9c'));}}catch(_0x1ef453){logger[_0x90d7('0x2e')](_0x1ef453);}}exports[_0x90d7('0x28')]=function(_0x2f0184,_0x2a0fba,_0x2f5c94){return db[_0x90d7('0x33')]['find']({'where':{'id':_0x2f0184[_0x90d7('0x4e')]['id']}})[_0x90d7('0x29')](handleEntityNotFound(_0x2a0fba,null))[_0x90d7('0x29')](saveUpdates(_0x2f0184[_0x90d7('0x94')],null))['then'](respondWithResult(_0x2a0fba,null))['catch'](handleError(_0x2a0fba,null));};exports[_0x90d7('0x9d')]=function(_0x41d5ac,_0x11ba67,_0x566e25){return db['Plugin']['find']({'where':{'id':_0x41d5ac['params']['id']}})[_0x90d7('0x29')](function(_0x4ba210){if(_0x4ba210){return _0x4ba210['destroy']();}})[_0x90d7('0x29')](function(_0x2e474d){rimraf(path[_0x90d7('0x50')](config[_0x90d7('0x51')],_0x90d7('0x52'),path[_0x90d7('0x9e')](_0x2e474d[_0x90d7('0x6')])),function(){});return _0x2e474d;})[_0x90d7('0x29')](handleEntityNotFound(_0x11ba67,null))[_0x90d7('0x29')](respondWithStatusCode(_0x11ba67,null))[_0x90d7('0x4d')](handleError(_0x11ba67,null));};exports[_0x90d7('0x9f')]=function(_0x531746,_0x38ca0b,_0xac3194){return BPromise[_0x90d7('0xa0')]()[_0x90d7('0x29')](function(){if(!_0x531746['query'][_0x90d7('0x6')]){throw new Error(_0x90d7('0xa1'));}if(!_0x531746[_0x90d7('0x39')][_0x90d7('0xa2')]){throw new Error(_0x90d7('0xa3'));}var _0x42b5ec=_0x531746[_0x90d7('0x39')][_0x90d7('0xa4')]?_0x531746[_0x90d7('0x39')][_0x90d7('0xa4')]+':'+_0x531746[_0x90d7('0x39')]['port']:_0x90d7('0xa5')+_0x531746[_0x90d7('0x39')][_0x90d7('0xa2')];var _0x861bb0=_0x531746[_0x90d7('0x39')][_0x90d7('0x26')]?_0x531746[_0x90d7('0x39')][_0x90d7('0x26')]:!![];var _0x107faf=_0x531746[_0x90d7('0x39')][_0x90d7('0xa6')]?_0x531746[_0x90d7('0x39')][_0x90d7('0xa6')]:null;var _0x5a312f={'method':_0x531746[_0x90d7('0xa7')],'uri':util[_0x90d7('0x53')](_0x90d7('0xa8'),_0x42b5ec,_0x531746[_0x90d7('0x39')][_0x90d7('0x6')]),'json':_0x861bb0,'resolveWithFullResponse':!![],'encoding':_0x107faf,'qs':_0x531746['query']};if(_0x531746[_0x90d7('0xa9')]){_0x5a312f['headers']=_0x531746[_0x90d7('0xa9')];if(_0x5a312f['headers']['content-length']){delete _0x5a312f[_0x90d7('0xa9')][_0x90d7('0xaa')];}}if(_0x5a312f[_0x90d7('0xa9')][_0x90d7('0xab')]){delete _0x5a312f[_0x90d7('0xa9')][_0x90d7('0xab')];}return rp(_0x5a312f);})[_0x90d7('0x29')](function(_0x609aa0){if(_0x609aa0){_0x38ca0b[_0x90d7('0xac')](_0x609aa0['headers']);logger[_0x90d7('0x66')](_0x609aa0[_0x90d7('0x94')]);if(_[_0x90d7('0xad')](_0x531746[_0x90d7('0x39')]['path'],_0x90d7('0xae'))&&_0x609aa0[_0x90d7('0xaf')]==0x1f4){return _0x38ca0b[_0x90d7('0x1f')](_0x609aa0['statusCode']);}else{return _0x38ca0b[_0x90d7('0x20')](_0x609aa0[_0x90d7('0xaf')])[_0x90d7('0x30')](_0x609aa0[_0x90d7('0x94')]);}}else{return _0x38ca0b[_0x90d7('0x1f')](0xc8);}})[_0x90d7('0x4d')](handleError(_0x38ca0b,null));};exports[_0x90d7('0xb0')]=function(_0x554bed,_0x2c3923,_0xa4cb39){return BPromise[_0x90d7('0xa0')]()[_0x90d7('0x29')](function(){if(!_0x554bed[_0x90d7('0x39')]['path']){throw new Error(_0x90d7('0xa1'));}if(!_0x554bed[_0x90d7('0x39')][_0x90d7('0xa2')]){throw new Error(_0x90d7('0xa3'));}var _0x390d00=_0x554bed[_0x90d7('0x39')][_0x90d7('0xa4')]?_0x554bed[_0x90d7('0x39')][_0x90d7('0xa4')]+':'+_0x554bed[_0x90d7('0x39')][_0x90d7('0xa2')]:_0x90d7('0xa5')+_0x554bed['query']['port'];var _0x572d9b=_0x554bed['query'][_0x90d7('0x26')]?_0x554bed[_0x90d7('0x39')][_0x90d7('0x26')]:!![];var _0x59ee54=_0x554bed[_0x90d7('0x39')][_0x90d7('0xa6')]?_0x554bed['query']['encoding']:null;var _0x244d3e={'method':_0x554bed[_0x90d7('0xa7')],'uri':util[_0x90d7('0x53')](_0x90d7('0xa8'),_0x390d00,_0x554bed[_0x90d7('0x39')]['path']),'json':_0x572d9b,'resolveWithFullResponse':!![],'encoding':_0x59ee54,'body':_0x554bed['body']};if(_0x554bed['headers']){_0x244d3e[_0x90d7('0xa9')]=_0x554bed[_0x90d7('0xa9')];if(_0x244d3e[_0x90d7('0xa9')]['content-length']){delete _0x244d3e[_0x90d7('0xa9')][_0x90d7('0xaa')];}}if(_0x244d3e[_0x90d7('0xa9')][_0x90d7('0xab')]){delete _0x244d3e[_0x90d7('0xa9')][_0x90d7('0xab')];}return rp(_0x244d3e);})[_0x90d7('0x29')](function(_0x57be4b){if(_0x57be4b){_0x2c3923['set'](_0x57be4b['headers']);logger['info'](_0x57be4b[_0x90d7('0x94')]);return _0x2c3923['status'](_0x57be4b[_0x90d7('0xaf')])[_0x90d7('0x30')](_0x57be4b[_0x90d7('0x94')]);}else{return _0x2c3923['sendStatus'](0xc8);}})[_0x90d7('0x4d')](handleError(_0x2c3923,null));}; \ No newline at end of file +var _0x8856=['glob','**/*','join','server/files/plugins','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','readFileSync','manifest.json','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','scriptPath','test','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','format','%s%s','headers','content-length','content-type','set','statusCode','sendStatus','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','download','find','path','root','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe'];(function(_0x4e0cfc,_0x283c4f){var _0x3a93a9=function(_0x3112e8){while(--_0x3112e8){_0x4e0cfc['push'](_0x4e0cfc['shift']());}};_0x3a93a9(++_0x283c4f);}(_0x8856,0xf4));var _0x6885=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8856[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6885('0x0'));var rimraf=require(_0x6885('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6885('0x2'));var rp=require(_0x6885('0x3'));var moment=require(_0x6885('0x4'));var BPromise=require(_0x6885('0x5'));var Mustache=require('mustache');var util=require(_0x6885('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6885('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6885('0x8'));var squel=require(_0x6885('0x9'));var crypto=require(_0x6885('0xa'));var jsforce=require(_0x6885('0xb'));var deskjs=require(_0x6885('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6885('0xd'));var Papa=require(_0x6885('0xe'));var extract=require(_0x6885('0xf'));var rimraf=require(_0x6885('0x1'));var archiver=require(_0x6885('0x10'));var Redis=require(_0x6885('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6885('0x12'));var as=require(_0x6885('0x13'));var hardwareService=require(_0x6885('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6885('0x15'));var db=require(_0x6885('0x16'))['db'];config[_0x6885('0x17')]=_[_0x6885('0x18')](config[_0x6885('0x17')],{'host':_0x6885('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6885('0x17')]));require(_0x6885('0x1a'))[_0x6885('0x1b')](socket);function respondWithStatusCode(_0xe1d938,_0x1c2fde){_0x1c2fde=_0x1c2fde||0xcc;return function(_0x2dc88f){if(_0x2dc88f){return _0xe1d938['sendStatus'](_0x1c2fde);}return _0xe1d938[_0x6885('0x1c')](_0x1c2fde)[_0x6885('0x1d')]();};}function respondWithResult(_0x366fd1,_0x478d01){_0x478d01=_0x478d01||0xc8;return function(_0x238ede){if(_0x238ede){return _0x366fd1[_0x6885('0x1c')](_0x478d01)[_0x6885('0x1e')](_0x238ede);}};}function respondWithFilteredResult(_0x3d66b5,_0x418226){return function(_0x2fb474){if(_0x2fb474){var _0x1405da=typeof _0x418226[_0x6885('0x1f')]===_0x6885('0x20')&&typeof _0x418226[_0x6885('0x21')]==='undefined';var _0x522c59=_0x2fb474[_0x6885('0x22')];var _0x69c766=_0x1405da?0x0:_0x418226['offset'];var _0x5d923b=_0x1405da?_0x2fb474[_0x6885('0x22')]:_0x418226[_0x6885('0x1f')]+_0x418226[_0x6885('0x21')];var _0x44c516;if(_0x5d923b>=_0x522c59){_0x5d923b=_0x522c59;_0x44c516=0xc8;}else{_0x44c516=0xce;}_0x3d66b5[_0x6885('0x1c')](_0x44c516);return _0x3d66b5['set']('Content-Range',_0x69c766+'-'+_0x5d923b+'/'+_0x522c59)[_0x6885('0x1e')](_0x2fb474);}return null;};}function patchUpdates(_0x1dca77){return function(_0x1e0d43){try{jsonpatch[_0x6885('0x23')](_0x1e0d43,_0x1dca77,!![]);}catch(_0x388bc1){return BPromise[_0x6885('0x24')](_0x388bc1);}return _0x1e0d43[_0x6885('0x25')]();};}function saveUpdates(_0x3dff0f,_0x5842f3){return function(_0x1176df){if(_0x1176df){return _0x1176df[_0x6885('0x26')](_0x3dff0f)[_0x6885('0x27')](function(_0x3fb37f){return _0x3fb37f;});}return null;};}function removeEntity(_0x38e871,_0x166ab0){return function(_0x425102){if(_0x425102){return _0x425102[_0x6885('0x28')]()[_0x6885('0x27')](function(){var _0x2bb136=_0x425102[_0x6885('0x29')]({'plain':!![]});var _0x43d219=_0x6885('0x2a');return db[_0x6885('0x2b')][_0x6885('0x28')]({'where':{'type':_0x43d219,'resourceId':_0x2bb136['id']}})[_0x6885('0x27')](function(){return _0x425102;});})['then'](function(){_0x38e871[_0x6885('0x1c')](0xcc)[_0x6885('0x1d')]();});}};}function handleEntityNotFound(_0x3205cc,_0x8bc270){return function(_0x2ebe95){if(!_0x2ebe95){_0x3205cc['sendStatus'](0x194);}return _0x2ebe95;};}function handleError(_0x13d237,_0x383635){_0x383635=_0x383635||0x1f4;return function(_0x3d0951){logger[_0x6885('0x2c')](_0x3d0951[_0x6885('0x2d')]);if(_0x3d0951[_0x6885('0x2e')]){delete _0x3d0951['name'];}_0x13d237[_0x6885('0x1c')](_0x383635)[_0x6885('0x2f')](_0x3d0951);};}exports[_0x6885('0x30')]=function(_0x3cd9d1,_0x11e44c){var _0xd10199={},_0x8082c9={},_0x1db30b={'count':0x0,'rows':[]};var _0x3618ea=_[_0x6885('0x31')](db[_0x6885('0x32')]['rawAttributes'],function(_0xe01f44){return{'name':_0xe01f44[_0x6885('0x33')],'type':_0xe01f44[_0x6885('0x34')][_0x6885('0x35')]};});_0x8082c9[_0x6885('0x36')]=_[_0x6885('0x31')](_0x3618ea,_0x6885('0x2e'));_0x8082c9[_0x6885('0x37')]=_[_0x6885('0x38')](_0x3cd9d1['query']);_0x8082c9[_0x6885('0x39')]=_[_0x6885('0x3a')](_0x8082c9[_0x6885('0x36')],_0x8082c9[_0x6885('0x37')]);_0xd10199[_0x6885('0x3b')]=_[_0x6885('0x3a')](_0x8082c9['model'],qs[_0x6885('0x3c')](_0x3cd9d1[_0x6885('0x37')][_0x6885('0x3c')]));_0xd10199[_0x6885('0x3b')]=_0xd10199[_0x6885('0x3b')][_0x6885('0x3d')]?_0xd10199[_0x6885('0x3b')]:_0x8082c9[_0x6885('0x36')];if(!_0x3cd9d1[_0x6885('0x37')][_0x6885('0x3e')](_0x6885('0x3f'))){_0xd10199[_0x6885('0x21')]=qs['limit'](_0x3cd9d1['query'][_0x6885('0x21')]);_0xd10199[_0x6885('0x1f')]=qs['offset'](_0x3cd9d1[_0x6885('0x37')][_0x6885('0x1f')]);}_0xd10199[_0x6885('0x40')]=qs['sort'](_0x3cd9d1['query'][_0x6885('0x41')]);_0xd10199[_0x6885('0x42')]=qs[_0x6885('0x39')](_[_0x6885('0x43')](_0x3cd9d1['query'],_0x8082c9['filters']),_0x3618ea);if(_0x3cd9d1['query'][_0x6885('0x44')]){_0xd10199['where']=_[_0x6885('0x45')](_0xd10199[_0x6885('0x42')],{'$or':_[_0x6885('0x31')](_0x3618ea,function(_0x112c63){if(_0x112c63[_0x6885('0x34')]!==_0x6885('0x46')){var _0x43e382={};_0x43e382[_0x112c63[_0x6885('0x2e')]]={'$like':'%'+_0x3cd9d1[_0x6885('0x37')][_0x6885('0x44')]+'%'};return _0x43e382;}})});}_0xd10199=_[_0x6885('0x45')]({},_0xd10199,_0x3cd9d1[_0x6885('0x47')]);var _0xdef7d={'where':_0xd10199[_0x6885('0x42')]};return db[_0x6885('0x32')][_0x6885('0x22')](_0xdef7d)['then'](function(_0x1035f5){_0x1db30b['count']=_0x1035f5;if(_0x3cd9d1[_0x6885('0x37')]['includeAll']){_0xd10199[_0x6885('0x48')]=[{'all':!![]}];}return db[_0x6885('0x32')]['findAll'](_0xd10199);})[_0x6885('0x27')](function(_0x29ce38){_0x1db30b[_0x6885('0x49')]=_0x29ce38;return _0x1db30b;})[_0x6885('0x27')](respondWithFilteredResult(_0x11e44c,_0xd10199))[_0x6885('0x4a')](handleError(_0x11e44c,null));};exports[_0x6885('0x4b')]=function(_0x598ea2,_0x3aae77){var _0x43f845={'raw':!![],'where':{'id':_0x598ea2[_0x6885('0x4c')]['id']}},_0x43e602={};_0x43e602['model']=_[_0x6885('0x38')](db['Plugin']['rawAttributes']);_0x43e602[_0x6885('0x37')]=_[_0x6885('0x38')](_0x598ea2[_0x6885('0x37')]);_0x43e602['filters']=_[_0x6885('0x3a')](_0x43e602[_0x6885('0x36')],_0x43e602['query']);_0x43f845['attributes']=_[_0x6885('0x3a')](_0x43e602[_0x6885('0x36')],qs['fields'](_0x598ea2[_0x6885('0x37')][_0x6885('0x3c')]));_0x43f845[_0x6885('0x3b')]=_0x43f845[_0x6885('0x3b')][_0x6885('0x3d')]?_0x43f845[_0x6885('0x3b')]:_0x43e602[_0x6885('0x36')];if(_0x598ea2['query']['includeAll']){_0x43f845[_0x6885('0x48')]=[{'all':!![]}];}_0x43f845=_['merge']({},_0x43f845,_0x598ea2[_0x6885('0x47')]);return db[_0x6885('0x32')]['find'](_0x43f845)[_0x6885('0x27')](handleEntityNotFound(_0x3aae77,null))[_0x6885('0x27')](respondWithResult(_0x3aae77,null))[_0x6885('0x4a')](handleError(_0x3aae77,null));};exports[_0x6885('0x4d')]=function(_0x319af0,_0x4b820f,_0x247b74){return db['Plugin'][_0x6885('0x4e')]({'where':{'id':_0x319af0[_0x6885('0x4c')]['id']},'attributes':[_0x6885('0x2e'),_0x6885('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x4b820f,null))[_0x6885('0x27')](function(_0x454522){if(_0x454522){var _0x330b90=path['join'](config[_0x6885('0x50')],'server/files/plugins',util['format'](_0x6885('0x51'),path[_0x6885('0x52')](_0x454522[_0x6885('0x4f')])));var _0x359af3=fs['createWriteStream'](_0x330b90);var _0x4cfde1=archiver('zip',{'zlib':{'level':0x9}});_0x4cfde1['on'](_0x6885('0x53'),function(_0x18af8e){if(_0x18af8e[_0x6885('0x54')]===_0x6885('0x55')){logger['error'](_0x18af8e);}else{throw new db[(_0x6885('0x56'))][(_0x6885('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x4cfde1['on']('error',function(_0x5b0696){throw new db['Sequelize'][(_0x6885('0x57'))](_0x6885('0x58'));});_0x4cfde1[_0x6885('0x59')](_0x359af3);_0x4cfde1[_0x6885('0x5a')](_0x6885('0x5b'),{'cwd':path[_0x6885('0x5c')](config[_0x6885('0x50')],_0x6885('0x5d'),path[_0x6885('0x5e')](_0x454522[_0x6885('0x4f')])),'ignore':[path['join'](path[_0x6885('0x52')](_0x454522[_0x6885('0x4f')]),_0x6885('0x5f')),path['join'](path[_0x6885('0x52')](_0x454522['path']),_0x6885('0x60'))],'nodir':!![]})['finalize']();_0x359af3['on'](_0x6885('0x61'),function(){if(!fs[_0x6885('0x62')](_0x330b90)){throw new db[(_0x6885('0x56'))][(_0x6885('0x57'))](_0x6885('0x63'));}return _0x4b820f['download'](_0x330b90,util['format'](_0x6885('0x51'),path['basename'](_0x454522[_0x6885('0x4f')])),function(_0x4b0119){if(_0x4b0119){throw new db[(_0x6885('0x56'))][(_0x6885('0x57'))](_0x6885('0x64'));}fs[_0x6885('0x65')](_0x330b90);logger[_0x6885('0x66')](_0x6885('0x67'));logger[_0x6885('0x66')](_0x6885('0x68'));});});}return null;})[_0x6885('0x4a')](handleError(_0x4b820f,null));};exports[_0x6885('0x69')]=function(_0x1147eb,_0x3d8cea,_0xb4d188){var _0x448310=path['basename'](_0x1147eb[_0x6885('0x6a')]['filename'],path[_0x6885('0x6b')](_0x1147eb[_0x6885('0x6a')]['filename']));var _0x31f056=path[_0x6885('0x5c')](config[_0x6885('0x50')],_0x6885('0x5d'),_0x1147eb[_0x6885('0x6a')][_0x6885('0x6c')]);var _0xb0255d=path['join'](config[_0x6885('0x50')],_0x6885('0x5d'),_0x448310);logger[_0x6885('0x66')](_0x6885('0x6d'),_0x31f056);logger[_0x6885('0x66')](_0x6885('0x6e'),_0xb0255d);try{fs[_0x6885('0x6f')](_0x31f056,parseInt(_0x6885('0x70'),0x8));extract(_0x31f056,{'dir':_0xb0255d},function(_0x24a7bc){if(_0x24a7bc){logger[_0x6885('0x2c')](_0x24a7bc);handleError(_0x24a7bc,!![]);};var _0x27f211=fs[_0x6885('0x71')](_0xb0255d);if(_0x27f211[_0x6885('0x3d')]>0x1){removeReferences(_0x31f056,_0xb0255d);logger[_0x6885('0x2c')](_0x6885('0x72'));return _0xb4d188(new Error(_0x6885('0x72')));}var _0x27742b=fs['lstatSync'](path[_0x6885('0x5c')](_0xb0255d,_0x27f211[0x0]));if(_0x27742b[_0x6885('0x73')]()){removeReferences(_0x31f056,_0xb0255d);logger[_0x6885('0x2c')](_0x6885('0x72'));return _0xb4d188(new Error('Invalid\x20plugin\x20structure'));}if(_0x27742b[_0x6885('0x74')]()){var _0x10d30a=fs[_0x6885('0x71')](path[_0x6885('0x5c')](_0xb0255d,_0x27f211[0x0]));if(_0x10d30a['length']===0x0){removeReferences(_0x31f056,_0xb0255d);logger['error'](_0x6885('0x72'));return _0xb4d188(new Error('Invalid\x20plugin\x20structure'));}var _0x2bad59=_0x10d30a[_0x6885('0x75')](function(_0x327785){return _0x327785==='manifest.json';});if(!_0x2bad59){return _0xb4d188(new Error('Plugin\x20manifest\x20missing'));}var _0x4cf673=fs[_0x6885('0x76')](path['join'](_0xb0255d,_0x27f211[0x0],_0x6885('0x77')));var _0x213752=JSON[_0x6885('0x78')](_0x4cf673);if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x2e')]){return _0xb4d188(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x213752[_0x6885('0x34')]){return _0xb4d188(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x79')]){return _0xb4d188(new Error(_0x6885('0x7a')));}if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x7b')]){return _0xb4d188(new Error(_0x6885('0x7c')));}if(_0x213752[_0x6885('0x34')]===_0x6885('0x7d')){if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x7b')][_0x6885('0x7e')]){return _0xb4d188(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x7b')][_0x6885('0x7e')][_0x6885('0x7f')]&&'undefined'==typeof _0x213752['parameters'][_0x6885('0x7e')][_0x6885('0x80')]){return _0xb4d188(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x213752[_0x6885('0x34')]===_0x6885('0x81')){if(_0x6885('0x20')==typeof _0x213752[_0x6885('0x7b')][_0x6885('0x82')]){return _0xb4d188(new Error(_0x6885('0x83')));}if(_0x6885('0x20')==typeof _0x213752['parameters']['scriptPath']){return _0xb4d188(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0xb4d188(new Error(_0x6885('0x84')));}var _0x3177e6=_0x213752[_0x6885('0x2e')];var _0x2b9b3d=_0x213752[_0x6885('0x85')];var _0x3b2c36=_0x213752[_0x6885('0x34')];var _0x167f04=_0x213752[_0x6885('0x86')]?_0x213752[_0x6885('0x86')]:'always';var _0x1b7566=_0x213752['icon']?_0x213752['icon']:'icon-apps';var _0x3bb4b7='';var _0x1ae10a='';var _0x4d8893='';var _0xf8aac7='';var _0x52803c=_0x213752[_0x6885('0x79')];if(_0x3b2c36==='html'){if(_0x6885('0x20')!=typeof _0x213752['parameters'][_0x6885('0x7e')]['admin']){var _0x2361a1=_0x213752[_0x6885('0x7b')][_0x6885('0x7e')][_0x6885('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2361a1)){_0x3bb4b7=path[_0x6885('0x5c')](_0x6885('0x87'),_0x448310,_0x27f211[0x0],_0x2361a1);}else{_0x3bb4b7=_0x2361a1;}}else{logger[_0x6885('0x66')](_0x6885('0x88'));}if(_0x6885('0x20')!=typeof _0x213752[_0x6885('0x7b')][_0x6885('0x7e')]['agent']){var _0x1dd1b7=_0x213752[_0x6885('0x7b')][_0x6885('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1dd1b7)){_0x1ae10a=path['join'](_0x6885('0x87'),_0x448310,_0x27f211[0x0],_0x1dd1b7);}else{_0x1ae10a=_0x1dd1b7;}}else{logger['info'](_0x6885('0x89'));}}else if(_0x3b2c36==='script'){_0x4d8893=_0x213752[_0x6885('0x7b')][_0x6885('0x82')];_0xf8aac7=_0x213752['parameters'][_0x6885('0x8a')];if(_0x6885('0x20')!=typeof _0x213752[_0x6885('0x7b')]['views']){if('undefined'!=typeof _0x213752[_0x6885('0x7b')][_0x6885('0x7e')][_0x6885('0x7f')]){var _0x2361a1=_0x213752[_0x6885('0x7b')][_0x6885('0x7e')][_0x6885('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x6885('0x8b')](_0x2361a1)){_0x3bb4b7=path[_0x6885('0x5c')](_0x6885('0x87'),_0x448310,_0x27f211[0x0],_0x2361a1);}else{_0x3bb4b7=_0x2361a1;}}if(_0x6885('0x20')!=typeof _0x213752[_0x6885('0x7b')]['views'][_0x6885('0x80')]){var _0x1dd1b7=_0x213752[_0x6885('0x7b')][_0x6885('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6885('0x8b')](_0x1dd1b7)){_0x1ae10a=path['join'](_0x6885('0x87'),_0x448310,_0x27f211[0x0],_0x1dd1b7);}else{_0x1ae10a=_0x1dd1b7;}}}}var _0x47f955={'name':_0x3177e6,'description':_0x2b9b3d,'path':path['join'](_0x448310,_0x27f211[0x0]),'type':_0x3b2c36,'sidebar':_0x167f04,'icon':_0x1b7566,'adminUrl':_0x3bb4b7,'agentUrl':_0x1ae10a,'scriptName':_0x4d8893,'scriptPath':_0xf8aac7,'version':_0x52803c};removeReferences(_0x31f056,null);return db[_0x6885('0x32')][_0x6885('0x8c')](_0x47f955)[_0x6885('0x27')](function(_0x2e3355){var _0xbf3330={'role':_0x1147eb[_0x6885('0x8d')][_0x6885('0x8e')],'userProfileId':_0x1147eb[_0x6885('0x8d')]['userProfileId']};if(!_0xbf3330)throw new Error(_0x6885('0x8f'));if(_0xbf3330[_0x6885('0x8e')]===_0x6885('0x90')){var _0xe3ccb1=_0x2e3355[_0x6885('0x29')]({'plain':!![]});return db[_0x6885('0x91')][_0x6885('0x4e')]({'where':{'name':'Plugins','userProfileId':_0xbf3330[_0x6885('0x92')]},'raw':!![]})[_0x6885('0x27')](function(_0x580d38){if(_0x580d38&&_0x580d38['autoAssociation']===0x0){return db[_0x6885('0x2b')][_0x6885('0x8c')]({'name':_0xe3ccb1[_0x6885('0x2e')],'resourceId':_0xe3ccb1['id'],'type':_0x580d38[_0x6885('0x2e')],'sectionId':_0x580d38['id']},{})[_0x6885('0x27')](function(){return _0x2e3355;});}else{return _0x2e3355;}})[_0x6885('0x4a')](function(_0x16a698){logger[_0x6885('0x2c')](_0x6885('0x93'),_0x16a698);throw _0x16a698;});}return _0x2e3355;})['then'](respondWithResult(_0x3d8cea,null))['catch'](handleError(_0x3d8cea,null));}});}catch(_0x45f178){_0x3d8cea[_0x6885('0x1c')](0x1f4)[_0x6885('0x2f')](_0x45f178);}};function removeReferences(_0x208489,_0x410579){try{if(_0x208489){fs[_0x6885('0x65')](_0x208489);logger['info'](_0x6885('0x94'));}if(_0x410579){rimraf(_0x410579,function(){});logger[_0x6885('0x66')](_0x6885('0x95'));}}catch(_0x3ebc1e){logger[_0x6885('0x2c')](_0x3ebc1e);}}exports[_0x6885('0x26')]=function(_0x4f0d34,_0x5b07be,_0x3b9997){return db['Plugin'][_0x6885('0x4e')]({'where':{'id':_0x4f0d34[_0x6885('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5b07be,null))[_0x6885('0x27')](saveUpdates(_0x4f0d34[_0x6885('0x8d')],null))[_0x6885('0x27')](respondWithResult(_0x5b07be,null))['catch'](handleError(_0x5b07be,null));};exports[_0x6885('0x96')]=function(_0x430f6f,_0x40190e,_0x1634a5){return db[_0x6885('0x32')][_0x6885('0x4e')]({'where':{'id':_0x430f6f[_0x6885('0x4c')]['id']}})[_0x6885('0x27')](function(_0x37707f){if(_0x37707f){return _0x37707f[_0x6885('0x28')]();}})[_0x6885('0x27')](function(_0x1003c1){rimraf(path['join'](config[_0x6885('0x50')],'server/files/plugins',path[_0x6885('0x5e')](_0x1003c1[_0x6885('0x4f')])),function(){});return _0x1003c1;})[_0x6885('0x27')](handleEntityNotFound(_0x40190e,null))[_0x6885('0x27')](respondWithStatusCode(_0x40190e,null))[_0x6885('0x4a')](handleError(_0x40190e,null));};exports[_0x6885('0x97')]=function(_0x3554b0,_0x321377,_0xd4526a){return BPromise[_0x6885('0x98')]()[_0x6885('0x27')](function(){if(!_0x3554b0[_0x6885('0x37')][_0x6885('0x4f')]){throw new Error(_0x6885('0x99'));}if(!_0x3554b0[_0x6885('0x37')][_0x6885('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x1d9308=_0x3554b0[_0x6885('0x37')][_0x6885('0x9b')]?_0x3554b0[_0x6885('0x37')][_0x6885('0x9b')]+':'+_0x3554b0[_0x6885('0x37')]['port']:_0x6885('0x9c')+_0x3554b0['query']['port'];var _0x1612ea=_0x3554b0[_0x6885('0x37')][_0x6885('0x1e')]?_0x3554b0['query'][_0x6885('0x1e')]:!![];var _0x1f1570=_0x3554b0[_0x6885('0x37')][_0x6885('0x9d')]?_0x3554b0['query']['encoding']:null;var _0x4deb64={'method':_0x3554b0[_0x6885('0x9e')],'uri':util[_0x6885('0x9f')](_0x6885('0xa0'),_0x1d9308,_0x3554b0['query']['path']),'json':_0x1612ea,'resolveWithFullResponse':!![],'encoding':_0x1f1570,'qs':_0x3554b0[_0x6885('0x37')]};if(_0x3554b0[_0x6885('0xa1')]){_0x4deb64['headers']=_0x3554b0[_0x6885('0xa1')];if(_0x4deb64[_0x6885('0xa1')][_0x6885('0xa2')]){delete _0x4deb64[_0x6885('0xa1')][_0x6885('0xa2')];}}if(_0x4deb64[_0x6885('0xa1')][_0x6885('0xa3')]){delete _0x4deb64[_0x6885('0xa1')]['content-type'];}return rp(_0x4deb64);})[_0x6885('0x27')](function(_0x237edc){if(_0x237edc){_0x321377[_0x6885('0xa4')](_0x237edc[_0x6885('0xa1')]);logger[_0x6885('0x66')](_0x237edc['body']);if(_['endsWith'](_0x3554b0[_0x6885('0x37')][_0x6885('0x4f')],_0x6885('0x4d'))&&_0x237edc['statusCode']==0x1f4){return _0x321377['sendStatus'](_0x237edc[_0x6885('0xa5')]);}else{return _0x321377[_0x6885('0x1c')](_0x237edc[_0x6885('0xa5')])[_0x6885('0x2f')](_0x237edc[_0x6885('0x8d')]);}}else{return _0x321377[_0x6885('0xa6')](0xc8);}})[_0x6885('0x4a')](handleError(_0x321377,null));};exports['webhookPost']=function(_0x5c7964,_0x597ee8,_0x5c7f0d){return BPromise['resolve']()[_0x6885('0x27')](function(){if(!_0x5c7964[_0x6885('0x37')][_0x6885('0x4f')]){throw new Error(_0x6885('0x99'));}if(!_0x5c7964[_0x6885('0x37')][_0x6885('0x9a')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x54c7a7=_0x5c7964[_0x6885('0x37')][_0x6885('0x9b')]?_0x5c7964[_0x6885('0x37')][_0x6885('0x9b')]+':'+_0x5c7964[_0x6885('0x37')][_0x6885('0x9a')]:_0x6885('0x9c')+_0x5c7964['query'][_0x6885('0x9a')];var _0x2e7591=_0x5c7964[_0x6885('0x37')][_0x6885('0x1e')]?_0x5c7964[_0x6885('0x37')][_0x6885('0x1e')]:!![];var _0xa550ed=_0x5c7964[_0x6885('0x37')][_0x6885('0x9d')]?_0x5c7964[_0x6885('0x37')][_0x6885('0x9d')]:null;var _0xb574e1={'method':_0x5c7964[_0x6885('0x9e')],'uri':util[_0x6885('0x9f')](_0x6885('0xa0'),_0x54c7a7,_0x5c7964[_0x6885('0x37')]['path']),'json':_0x2e7591,'resolveWithFullResponse':!![],'encoding':_0xa550ed,'body':_0x5c7964['body']};if(_0x5c7964[_0x6885('0xa1')]){_0xb574e1[_0x6885('0xa1')]=_0x5c7964[_0x6885('0xa1')];if(_0xb574e1[_0x6885('0xa1')][_0x6885('0xa2')]){delete _0xb574e1[_0x6885('0xa1')]['content-length'];}}if(_0xb574e1[_0x6885('0xa1')][_0x6885('0xa3')]){delete _0xb574e1[_0x6885('0xa1')][_0x6885('0xa3')];}return rp(_0xb574e1);})[_0x6885('0x27')](function(_0x155110){if(_0x155110){_0x597ee8[_0x6885('0xa4')](_0x155110[_0x6885('0xa1')]);logger[_0x6885('0x66')](_0x155110['body']);return _0x597ee8[_0x6885('0x1c')](_0x155110[_0x6885('0xa5')])[_0x6885('0x2f')](_0x155110['body']);}else{return _0x597ee8[_0x6885('0xa6')](0xc8);}})['catch'](handleError(_0x597ee8,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index f65b714..6614e87 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 _0xd47f=['save','update','remove','emit','hasOwnProperty','events','Plugin','setMaxListeners'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xd47f,0x1bd));var _0xfd47=function(_0x3a2c32,_0x161b37){_0x3a2c32=_0x3a2c32-0x0;var _0x361cd4=_0xd47f[_0x3a2c32];return _0x361cd4;};'use strict';var EventEmitter=require(_0xfd47('0x0'));var Plugin=require('../../mysqldb')['db'][_0xfd47('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xfd47('0x2')](0x0);var events={'afterCreate':_0xfd47('0x3'),'afterUpdate':_0xfd47('0x4'),'afterDestroy':_0xfd47('0x5')};function emitEvent(_0x32a237){return function(_0x35aca2,_0x1701c3,_0x24b68b){PluginEvents[_0xfd47('0x6')](_0x32a237+':'+_0x35aca2['id'],_0x35aca2);PluginEvents[_0xfd47('0x6')](_0x32a237,_0x35aca2);_0x24b68b(null);};}for(var e in events){if(events[_0xfd47('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x9bb8=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20eef0,_0x86f93c){var _0x2ac647=function(_0x1dd164){while(--_0x1dd164){_0x20eef0['push'](_0x20eef0['shift']());}};_0x2ac647(++_0x86f93c);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x89bb('0x0'));var Plugin=require(_0x89bb('0x1'))['db'][_0x89bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x89bb('0x3')](0x0);var events={'afterCreate':_0x89bb('0x4'),'afterUpdate':_0x89bb('0x5'),'afterDestroy':_0x89bb('0x6')};function emitEvent(_0x1af2d3){return function(_0xaa37b7,_0x26ecc2,_0x436902){PluginEvents[_0x89bb('0x7')](_0x1af2d3+':'+_0xaa37b7['id'],_0xaa37b7);PluginEvents['emit'](_0x1af2d3,_0xaa37b7);_0x436902(null);};}for(var e in events){if(events[_0x89bb('0x8')](e)){var event=events[e];Plugin[_0x89bb('0x9')](e,emitEvent(event));}}module[_0x89bb('0xa')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 76516a7..8da0427 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 _0x23a6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x755159,_0x3d58be){var _0x293e1f=function(_0x115926){while(--_0x115926){_0x755159['push'](_0x755159['shift']());}};_0x293e1f(++_0x3d58be);}(_0x23a6,0xff));var _0x623a=function(_0x4ebdcc,_0xab5e4a){_0x4ebdcc=_0x4ebdcc-0x0;var _0x171904=_0x23a6[_0x4ebdcc];return _0x171904;};'use strict';var _=require(_0x623a('0x0'));var util=require(_0x623a('0x1'));var logger=require(_0x623a('0x2'))(_0x623a('0x3'));var moment=require(_0x623a('0x4'));var BPromise=require(_0x623a('0x5'));var rp=require(_0x623a('0x6'));var fs=require('fs');var path=require(_0x623a('0x7'));var rimraf=require(_0x623a('0x8'));var config=require(_0x623a('0x9'));var attributes=require(_0x623a('0xa'));module[_0x623a('0xb')]=function(_0x2b679f,_0x53d83d){return _0x2b679f[_0x623a('0xc')](_0x623a('0xd'),attributes,{'tableName':_0x623a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7253=['api','moment','bluebird','path','rimraf','exports','Plugin','plugins','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7253,0x1f2));var _0x3725=function(_0x331ef4,_0x492058){_0x331ef4=_0x331ef4-0x0;var _0x4fee26=_0x7253[_0x331ef4];return _0x4fee26;};'use strict';var _=require(_0x3725('0x0'));var util=require(_0x3725('0x1'));var logger=require('../../config/logger')(_0x3725('0x2'));var moment=require(_0x3725('0x3'));var BPromise=require(_0x3725('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3725('0x5'));var rimraf=require(_0x3725('0x6'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0x3725('0x7')]=function(_0x3742af,_0x4d511e){return _0x3742af['define'](_0x3725('0x8'),attributes,{'tableName':_0x3725('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 95e0e85..376139c 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 _0x4fb4=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreatePlugin','Plugin','create','body','raw','then','lodash'];(function(_0x179437,_0x30f19f){var _0x13e94f=function(_0x39342b){while(--_0x39342b){_0x179437['push'](_0x179437['shift']());}};_0x13e94f(++_0x30f19f);}(_0x4fb4,0x18b));var _0x44fb=function(_0xfcf3c2,_0x1454e2){_0xfcf3c2=_0xfcf3c2-0x0;var _0x1640eb=_0x4fb4[_0xfcf3c2];return _0x1640eb;};'use strict';var _=require(_0x44fb('0x0'));var util=require(_0x44fb('0x1'));var moment=require(_0x44fb('0x2'));var BPromise=require('bluebird');var rs=require(_0x44fb('0x3'));var fs=require('fs');var Redis=require(_0x44fb('0x4'));var db=require(_0x44fb('0x5'))['db'];var utils=require(_0x44fb('0x6'));var logger=require(_0x44fb('0x7'))('rpc');var config=require(_0x44fb('0x8'));var jayson=require(_0x44fb('0x9'));var client=jayson[_0x44fb('0xa')][_0x44fb('0xb')]({'port':0x232a});config[_0x44fb('0xc')]=_[_0x44fb('0xd')](config[_0x44fb('0xc')],{'host':_0x44fb('0xe'),'port':0x18eb});var socket=require(_0x44fb('0xf'))(new Redis(config[_0x44fb('0xc')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0xc66dcd,_0x4cdc82,_0x5798ee){return new BPromise(function(_0x1c0ce8,_0x159c73){return client[_0x44fb('0x10')](_0xc66dcd,_0x5798ee)['then'](function(_0x42454b){logger[_0x44fb('0x11')](_0x44fb('0x12'),_0x4cdc82,_0x44fb('0x13'));logger[_0x44fb('0x14')](_0x44fb('0x15'),_0x4cdc82,'request\x20sent',JSON[_0x44fb('0x16')](_0x42454b));if(_0x42454b[_0x44fb('0x17')]){if(_0x42454b['error'][_0x44fb('0x18')]===0x1f4){logger[_0x44fb('0x17')]('Plugin,\x20%s,\x20%s',_0x4cdc82,_0x42454b['error'][_0x44fb('0x19')]);return _0x159c73(_0x42454b[_0x44fb('0x17')][_0x44fb('0x19')]);}logger[_0x44fb('0x17')]('Plugin,\x20%s,\x20%s',_0x4cdc82,_0x42454b[_0x44fb('0x17')]['message']);return _0x1c0ce8(_0x42454b['error'][_0x44fb('0x19')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x4cdc82,_0x44fb('0x13'));_0x1c0ce8(_0x42454b['result']['message']);}})[_0x44fb('0x1a')](function(_0x9aa33d){logger['error'](_0x44fb('0x12'),_0x4cdc82,_0x9aa33d);_0x159c73(_0x9aa33d);});});}exports[_0x44fb('0x1b')]=function(_0x552362){var _0x2c98a5=this;return new Promise(function(_0x51923a,_0x283243){return db[_0x44fb('0x1c')][_0x44fb('0x1d')](_0x552362[_0x44fb('0x1e')],{'raw':_0x552362['options']?_0x552362['options'][_0x44fb('0x1f')]===undefined?!![]:![]:!![]})[_0x44fb('0x20')](function(_0xa89f8b){logger[_0x44fb('0x11')](_0x44fb('0x1b'),_0x552362);logger[_0x44fb('0x14')]('CreatePlugin',_0x552362,JSON['stringify'](_0xa89f8b));_0x51923a(_0xa89f8b);})[_0x44fb('0x1a')](function(_0x415c70){logger[_0x44fb('0x17')](_0x44fb('0x1b'),_0x415c70[_0x44fb('0x19')],_0x552362);_0x283243(_0x2c98a5[_0x44fb('0x17')](0x1f4,_0x415c70['message']));});});}; \ No newline at end of file +var _0x813e=['client','http','defaults','socket.io-emitter','redis','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Plugin','create','body','options','raw','then','CreatePlugin','debug','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x23880,_0x202b77){var _0x14a7a7=function(_0x6f35df){while(--_0x6f35df){_0x23880['push'](_0x23880['shift']());}};_0x14a7a7(++_0x202b77);}(_0x813e,0xb3));var _0xe813=function(_0x1e46a5,_0x5b094e){_0x1e46a5=_0x1e46a5-0x0;var _0x35a2cf=_0x813e[_0x1e46a5];return _0x35a2cf;};'use strict';var _=require('lodash');var util=require(_0xe813('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe813('0x1'))['db'];var utils=require(_0xe813('0x2'));var logger=require(_0xe813('0x3'))(_0xe813('0x4'));var config=require(_0xe813('0x5'));var jayson=require(_0xe813('0x6'));var client=jayson[_0xe813('0x7')][_0xe813('0x8')]({'port':0x232a});config['redis']=_[_0xe813('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe813('0xa'))(new Redis(config[_0xe813('0xb')]));require(_0xe813('0xc'))[_0xe813('0xd')](socket);function respondWithRpcPromise(_0x24d221,_0x136c8e,_0x337377){return new BPromise(function(_0x426aa9,_0x180001){return client[_0xe813('0xe')](_0x24d221,_0x337377)['then'](function(_0x50b6a5){logger[_0xe813('0xf')](_0xe813('0x10'),_0x136c8e,_0xe813('0x11'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x136c8e,_0xe813('0x11'),JSON[_0xe813('0x12')](_0x50b6a5));if(_0x50b6a5['error']){if(_0x50b6a5[_0xe813('0x13')]['code']===0x1f4){logger[_0xe813('0x13')](_0xe813('0x10'),_0x136c8e,_0x50b6a5[_0xe813('0x13')][_0xe813('0x14')]);return _0x180001(_0x50b6a5[_0xe813('0x13')]['message']);}logger[_0xe813('0x13')](_0xe813('0x10'),_0x136c8e,_0x50b6a5['error'][_0xe813('0x14')]);return _0x426aa9(_0x50b6a5[_0xe813('0x13')]['message']);}else{logger[_0xe813('0xf')](_0xe813('0x10'),_0x136c8e,_0xe813('0x11'));_0x426aa9(_0x50b6a5[_0xe813('0x15')][_0xe813('0x14')]);}})[_0xe813('0x16')](function(_0x3eb7f9){logger[_0xe813('0x13')](_0xe813('0x10'),_0x136c8e,_0x3eb7f9);_0x180001(_0x3eb7f9);});});}exports['CreatePlugin']=function(_0xbe1fa5){var _0x5249e7=this;return new Promise(function(_0x3acb6a,_0x4188ea){return db[_0xe813('0x17')][_0xe813('0x18')](_0xbe1fa5[_0xe813('0x19')],{'raw':_0xbe1fa5['options']?_0xbe1fa5[_0xe813('0x1a')][_0xe813('0x1b')]===undefined?!![]:![]:!![]})[_0xe813('0x1c')](function(_0x257464){logger[_0xe813('0xf')](_0xe813('0x1d'),_0xbe1fa5);logger[_0xe813('0x1e')](_0xe813('0x1d'),_0xbe1fa5,JSON['stringify'](_0x257464));_0x3acb6a(_0x257464);})[_0xe813('0x16')](function(_0x4ab38e){logger[_0xe813('0x13')](_0xe813('0x1d'),_0x4ab38e[_0xe813('0x14')],_0xbe1fa5);_0x4188ea(_0x5249e7[_0xe813('0x13')](0x1f4,_0x4ab38e[_0xe813('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f1be397..5b0cd01 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 _0x026a=['plugin:','./plugin.events','remove','update','emit','length'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x026a,0xd9));var _0xa026=function(_0x33f6c7,_0x4797ff){_0x33f6c7=_0x33f6c7-0x0;var _0x102980=_0x026a[_0x33f6c7];return _0x102980;};'use strict';var PluginEvents=require(_0xa026('0x0'));var events=['save',_0xa026('0x1'),_0xa026('0x2')];function createListener(_0x29779f,_0x3eda9f){return function(_0x1abae6){_0x3eda9f[_0xa026('0x3')](_0x29779f,_0x1abae6);};}function removeListener(_0x5a5aa4,_0x5ddfa8){return function(){PluginEvents['removeListener'](_0x5a5aa4,_0x5ddfa8);};}exports['register']=function(_0x336b69){for(var _0x2ae530=0x0,_0x50a230=events[_0xa026('0x4')];_0x2ae530<_0x50a230;_0x2ae530++){var _0x1b9d5b=events[_0x2ae530];var _0x2b1f8d=createListener(_0xa026('0x5')+_0x1b9d5b,_0x336b69);PluginEvents['on'](_0x1b9d5b,_0x2b1f8d);}}; \ No newline at end of file +var _0x47fc=['length','plugin:','./plugin.events','save','remove','update','register'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x47fc,0xaa));var _0xc47f=function(_0x4f2918,_0x45656f){_0x4f2918=_0x4f2918-0x0;var _0x3170fa=_0x47fc[_0x4f2918];return _0x3170fa;};'use strict';var PluginEvents=require(_0xc47f('0x0'));var events=[_0xc47f('0x1'),_0xc47f('0x2'),_0xc47f('0x3')];function createListener(_0x4a8a4a,_0x280b80){return function(_0x2022cd){_0x280b80['emit'](_0x4a8a4a,_0x2022cd);};}function removeListener(_0x224bee,_0x59fe41){return function(){PluginEvents['removeListener'](_0x224bee,_0x59fe41);};}exports[_0xc47f('0x4')]=function(_0x22fbbe){for(var _0x2a9d57=0x0,_0x20a7bd=events[_0xc47f('0x5')];_0x2a9d57<_0x20a7bd;_0x2a9d57++){var _0x14716d=events[_0x2a9d57];var _0x44745b=createListener(_0xc47f('0x6')+_0x14716d,_0x22fbbe);PluginEvents['on'](_0x14716d,_0x44745b);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ff11b39..b08e9da 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(_0x3f18e1,_0x56ddbf){var _0x184df9=function(_0x35fb16){while(--_0x35fb16){_0x3f18e1['push'](_0x3f18e1['shift']());}};_0x184df9(++_0x56ddbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x4d97df,_0xc507db){var _0x4519cf=function(_0x36b89c){while(--_0x36b89c){_0x4d97df['push'](_0x4d97df['shift']());}};_0x4519cf(++_0xc507db);}(_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 926f58d..886b20a 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 _0xbdb7=['status','send','npm\x20install','info','index','list','then','express','motion2','length','catch','describe','params','body','join','../../files/plugins','script','cwd','chdir','dirname','start','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','stack','name'];(function(_0x39ba81,_0xcee4a6){var _0x47f5c6=function(_0xecce3){while(--_0xecce3){_0x39ba81['push'](_0x39ba81['shift']());}};_0x47f5c6(++_0xcee4a6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x49a456,_0x76c6d6){_0x49a456=_0x49a456-0x0;var _0x5818aa=_0xbdb7[_0x49a456];return _0x5818aa;};'use strict';var _=require(_0x7bdb('0x0'));var pm2=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var path=require(_0x7bdb('0x4'));var exec=require(_0x7bdb('0x5'))[_0x7bdb('0x6')];var BPromise=require(_0x7bdb('0x7'));function handleEntityNotFound(_0x46c068,_0x47aec5){return function(_0x28542c){if(!_0x28542c){_0x46c068['sendStatus'](0x194);;}return _0x28542c;};}function respondWithResult(_0x4b5fff,_0xffdc86){_0xffdc86=_0xffdc86||0xc8;return function(_0x1e23a3){if(_0x1e23a3){return _0x4b5fff['status'](_0xffdc86)['json'](_0x1e23a3);}return null;};}function handleError(_0x468041,_0x11a877){_0x11a877=_0x11a877||0x1f4;return function(_0x530f81){logger['error'](_0x530f81[_0x7bdb('0x8')]);if(_0x530f81[_0x7bdb('0x9')]){delete _0x530f81[_0x7bdb('0x9')];}_0x468041[_0x7bdb('0xa')](_0x11a877)[_0x7bdb('0xb')](_0x530f81);};}function execChildProcess(){return new BPromise(function(_0x144ff7,_0x297724){exec(_0x7bdb('0xc'),function(_0x5462da,_0x4e5b8e,_0x52b9b9){logger[_0x7bdb('0xd')](_0x4e5b8e);logger[_0x7bdb('0xd')](_0x52b9b9);if(_0x5462da){logger['error'](_0x5462da);return _0x297724(_0x5462da);}return _0x144ff7(_0x4e5b8e);});});}exports[_0x7bdb('0xe')]=function(_0x53021d,_0x5898c1){return pm2[_0x7bdb('0xf')]()[_0x7bdb('0x10')](function(_0x4fd91a){if(_0x4fd91a){var _0x50eeca=_['reject'](_0x4fd91a,function(_0x4476ff){return _0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x11')||_0x4476ff[_0x7bdb('0x9')]===_0x7bdb('0x12');});return{'rows':_0x50eeca,'count':_0x50eeca[_0x7bdb('0x13')]};}return null;})[_0x7bdb('0x10')](respondWithResult(_0x5898c1,null))[_0x7bdb('0x14')](handleError(_0x5898c1,null));};exports['show']=function(_0x1c5750,_0x43f352){return pm2[_0x7bdb('0x15')](_0x1c5750[_0x7bdb('0x16')]['id'])['then'](respondWithResult(_0x43f352,null))[_0x7bdb('0x10')](handleEntityNotFound(_0x43f352,null))[_0x7bdb('0x14')](handleError(_0x43f352,null));};exports['create']=function(_0x3e5f8e,_0x31f78e){if(_0x3e5f8e[_0x7bdb('0x17')][_0x7bdb('0x9')]&&_0x3e5f8e[_0x7bdb('0x17')]['script']){var _0x49f353=path[_0x7bdb('0x18')](__dirname,_0x7bdb('0x19'),_0x3e5f8e['body'][_0x7bdb('0x1a')]);var _0x118ea1=process[_0x7bdb('0x1b')]();process[_0x7bdb('0x1c')](path[_0x7bdb('0x1d')](_0x49f353));return execChildProcess()['then'](function(_0x1d37ac){process[_0x7bdb('0x1c')](_0x118ea1);return pm2[_0x7bdb('0x1e')]({'name':_0x3e5f8e[_0x7bdb('0x17')]['name'],'script':_0x49f353});})['then'](function(_0x3c423f){pm2['dump']();return _0x3c423f[0x0];})['then'](respondWithResult(_0x31f78e,0xc9))['catch'](handleError(_0x31f78e,null));}else{return _0x31f78e[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x1f')});}};exports[_0x7bdb('0x20')]=function(_0x3ec129,_0x7c09cf){if(_0x3ec129[_0x7bdb('0x17')]['id']){delete _0x3ec129['body']['id'];}var _0x10e818={'online':_0x7bdb('0x21'),'stopped':_0x7bdb('0x22')};if(_0x10e818[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')])){return pm2[_0x10e818[_0x3ec129[_0x7bdb('0x17')][_0x7bdb('0xa')]]](_0x3ec129[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](respondWithResult(_0x7c09cf,0xc8))[_0x7bdb('0x14')](handleError(_0x7c09cf,null));}else{return _0x7c09cf[_0x7bdb('0xa')](0x1f4)['send']({'message':_0x7bdb('0x24')});}};exports[_0x7bdb('0x25')]=function(_0x8f7672,_0x9f5c1){if(_0x8f7672[_0x7bdb('0x17')]['id']){delete _0x8f7672['body']['id'];}if(_0x8f7672[_0x7bdb('0x16')]['id']){return pm2[_0x7bdb('0x26')](_0x8f7672[_0x7bdb('0x16')]['id'])[_0x7bdb('0x10')](function(_0x58c6b7){pm2['dump']();return _0x58c6b7[0x0];})['then'](respondWithResult(_0x9f5c1,null))[_0x7bdb('0x14')](handleError(_0x9f5c1,null));}else{return _0x9f5c1['status'](0x1f4)[_0x7bdb('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x9b9b=['Unknown\x20status','delete','Unknown\x20id','../../config/pm2','path','child_process','exec','bluebird','sendStatus','status','json','name','npm\x20install','info','error','index','list','reject','express','motion2','length','then','show','describe','params','catch','create','body','script','join','../../files/plugins','cwd','chdir','dirname','dump','send','update','restart','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9b9b,0x114));var _0xb9b9=function(_0x3ed203,_0x4e3a3c){_0x3ed203=_0x3ed203-0x0;var _0x558502=_0x9b9b[_0x3ed203];return _0x558502;};'use strict';var _=require('lodash');var pm2=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var path=require(_0xb9b9('0x1'));var exec=require(_0xb9b9('0x2'))[_0xb9b9('0x3')];var BPromise=require(_0xb9b9('0x4'));function handleEntityNotFound(_0x1d6ab6,_0x43c8ff){return function(_0x23b016){if(!_0x23b016){_0x1d6ab6[_0xb9b9('0x5')](0x194);;}return _0x23b016;};}function respondWithResult(_0x79dd,_0x3d1a95){_0x3d1a95=_0x3d1a95||0xc8;return function(_0x85eec){if(_0x85eec){return _0x79dd[_0xb9b9('0x6')](_0x3d1a95)[_0xb9b9('0x7')](_0x85eec);}return null;};}function handleError(_0x297cb6,_0x222cba){_0x222cba=_0x222cba||0x1f4;return function(_0x319bb8){logger['error'](_0x319bb8['stack']);if(_0x319bb8[_0xb9b9('0x8')]){delete _0x319bb8[_0xb9b9('0x8')];}_0x297cb6[_0xb9b9('0x6')](_0x222cba)['send'](_0x319bb8);};}function execChildProcess(){return new BPromise(function(_0x3949d0,_0x3b6bb9){exec(_0xb9b9('0x9'),function(_0x4d8856,_0x3430a6,_0x277d86){logger[_0xb9b9('0xa')](_0x3430a6);logger[_0xb9b9('0xa')](_0x277d86);if(_0x4d8856){logger[_0xb9b9('0xb')](_0x4d8856);return _0x3b6bb9(_0x4d8856);}return _0x3949d0(_0x3430a6);});});}exports[_0xb9b9('0xc')]=function(_0x5bd18c,_0x539449){return pm2[_0xb9b9('0xd')]()['then'](function(_0xe78d58){if(_0xe78d58){var _0x50e5d6=_[_0xb9b9('0xe')](_0xe78d58,function(_0x23bac9){return _0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0xf')||_0x23bac9[_0xb9b9('0x8')]===_0xb9b9('0x10');});return{'rows':_0x50e5d6,'count':_0x50e5d6[_0xb9b9('0x11')]};}return null;})[_0xb9b9('0x12')](respondWithResult(_0x539449,null))['catch'](handleError(_0x539449,null));};exports[_0xb9b9('0x13')]=function(_0x48d9ae,_0x403a5b){return pm2[_0xb9b9('0x14')](_0x48d9ae[_0xb9b9('0x15')]['id'])[_0xb9b9('0x12')](respondWithResult(_0x403a5b,null))['then'](handleEntityNotFound(_0x403a5b,null))[_0xb9b9('0x16')](handleError(_0x403a5b,null));};exports[_0xb9b9('0x17')]=function(_0x398f3d,_0xb01198){if(_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')]&&_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]){var _0xb16391=path[_0xb9b9('0x1a')](__dirname,_0xb9b9('0x1b'),_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x19')]);var _0x4e33a0=process[_0xb9b9('0x1c')]();process[_0xb9b9('0x1d')](path[_0xb9b9('0x1e')](_0xb16391));return execChildProcess()['then'](function(_0x9898bc){process[_0xb9b9('0x1d')](_0x4e33a0);return pm2['start']({'name':_0x398f3d[_0xb9b9('0x18')][_0xb9b9('0x8')],'script':_0xb16391});})[_0xb9b9('0x12')](function(_0x40b801){pm2[_0xb9b9('0x1f')]();return _0x40b801[0x0];})['then'](respondWithResult(_0xb01198,0xc9))['catch'](handleError(_0xb01198,null));}else{return _0xb01198[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb9b9('0x21')]=function(_0x134ed6,_0x20ffc1){if(_0x134ed6[_0xb9b9('0x18')]['id']){delete _0x134ed6[_0xb9b9('0x18')]['id'];}var _0x54bf18={'online':_0xb9b9('0x22'),'stopped':'stop'};if(_0x54bf18[_0xb9b9('0x23')](_0x134ed6[_0xb9b9('0x18')]['status'])){return pm2[_0x54bf18[_0x134ed6[_0xb9b9('0x18')][_0xb9b9('0x6')]]](_0x134ed6[_0xb9b9('0x15')]['id'])['then'](respondWithResult(_0x20ffc1,0xc8))[_0xb9b9('0x16')](handleError(_0x20ffc1,null));}else{return _0x20ffc1[_0xb9b9('0x6')](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x24')});}};exports['destroy']=function(_0xc40dda,_0xdbc1f1){if(_0xc40dda['body']['id']){delete _0xc40dda[_0xb9b9('0x18')]['id'];}if(_0xc40dda[_0xb9b9('0x15')]['id']){return pm2[_0xb9b9('0x25')](_0xc40dda[_0xb9b9('0x15')]['id'])['then'](function(_0xd66ace){pm2[_0xb9b9('0x1f')]();return _0xd66ace[0x0];})[_0xb9b9('0x12')](respondWithResult(_0xdbc1f1,null))[_0xb9b9('0x16')](handleError(_0xdbc1f1,null));}else{return _0xdbc1f1['status'](0x1f4)[_0xb9b9('0x20')]({'message':_0xb9b9('0x26')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 0fab87d..d7b6669 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 _0x6df7=['isAuthenticated','getAgents','/queues','getQueues','exports','Router','./realtime.controller','get','/agents'];(function(_0x23991f,_0x3cf4ee){var _0x536c7b=function(_0x1b9249){while(--_0x1b9249){_0x23991f['push'](_0x23991f['shift']());}};_0x536c7b(++_0x3cf4ee);}(_0x6df7,0x15b));var _0x76df=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6df7[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express[_0x76df('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x76df('0x1'));router[_0x76df('0x2')](_0x76df('0x3'),auth[_0x76df('0x4')](),controller[_0x76df('0x5')]);router['get'](_0x76df('0x6'),auth[_0x76df('0x4')](),controller[_0x76df('0x7')]);module[_0x76df('0x8')]=router; \ No newline at end of file +var _0x0f52=['./realtime.controller','get','isAuthenticated','getAgents','getQueues','Router','../../components/auth/service'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0f52,0x17f));var _0x20f5=function(_0x188972,_0x5aaa2d){_0x188972=_0x188972-0x0;var _0x3b0cd1=_0x0f52[_0x188972];return _0x3b0cd1;};'use strict';var express=require('express');var router=express[_0x20f5('0x0')]();var auth=require(_0x20f5('0x1'));var controller=require(_0x20f5('0x2'));router[_0x20f5('0x3')]('/agents',auth[_0x20f5('0x4')](),controller[_0x20f5('0x5')]);router['get']('/queues',auth[_0x20f5('0x4')](),controller[_0x20f5('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index bd93308..90ea396 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 _0x038b=['loggedIn','waiting','talking','paused','voice','outbound','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','busy','pick','filter','length','some','connectedlinenum','internal','getMembers','find','UserId','accountcode','online','voiceStatus','agents','User','Queue','Pause','findAll','QueueId','push','idle','unknown','unavailable','ringing','isNil','chatPause','mailPause','openchannelPause','voicePause','whatsappPause','every','pause','chatStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','getAgents','userpic','lastLoginAt','pauseType','lastPauseAt','faxPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','rawAttributes','type','key','query','getOptions','user','userProfileId','agent','UserProfile','rows','omit','globalStatusFilter','globalStatus','pauseTypeFilter','getQueues','mail','chat','sms','fax','whatsapp','channel','toLowerCase','Invalid\x20channel','fieldName','role','getResources','findAndCountAll','lodash','jayson/promise','../../components/parsers/qs','api','client','http','offset','undefined','count','limit','status','set','Content-Range','json','error','stack','name','send','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','result','merge','catch','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels'];(function(_0x1f8bc0,_0x55d5b7){var _0x4ca1e0=function(_0x23ffd4){while(--_0x23ffd4){_0x1f8bc0['push'](_0x1f8bc0['shift']());}};_0x4ca1e0(++_0x55d5b7);}(_0x038b,0x114));var _0xb038=function(_0x4a2bc5,_0x431a17){_0x4a2bc5=_0x4a2bc5-0x0;var _0x2d9c9b=_0x038b[_0x4a2bc5];return _0x2d9c9b;};'use strict';var util=require('util');var _=require(_0xb038('0x0'));var jayson=require(_0xb038('0x1'));var qs=require(_0xb038('0x2'));var logger=require('../../config/logger')(_0xb038('0x3'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xb038('0x4')][_0xb038('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0xb038('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x11da3a,_0x4fe092){return function(_0x54e1e7){if(_0x54e1e7){var _0x2e3e64=typeof _0x4fe092[_0xb038('0x6')]===_0xb038('0x7')&&typeof _0x4fe092['limit']==='undefined';var _0x462e8f=_0x54e1e7[_0xb038('0x8')];var _0x4d85b4=_0x2e3e64?0x0:_0x4fe092['offset'];var _0xe3d046=_0x2e3e64?_0x54e1e7[_0xb038('0x8')]:_0x4fe092['offset']+_0x4fe092[_0xb038('0x9')];var _0x162ae7;if(_0xe3d046>=_0x462e8f){_0xe3d046=_0x462e8f;_0x162ae7=0xc8;}else{_0x162ae7=0xce;}_0x11da3a[_0xb038('0xa')](_0x162ae7);return _0x11da3a[_0xb038('0xb')](_0xb038('0xc'),_0x4d85b4+'-'+_0xe3d046+'/'+_0x462e8f)[_0xb038('0xd')](_0x54e1e7);}return null;};}function handleError(_0x1e6474,_0x439751){_0x439751=_0x439751||0x1f4;return function(_0x16e4a3){logger[_0xb038('0xe')](_0x16e4a3[_0xb038('0xf')]);if(_0x16e4a3[_0xb038('0x10')]){delete _0x16e4a3[_0xb038('0x10')];}_0x1e6474[_0xb038('0xa')](_0x439751)[_0xb038('0x11')](_0x16e4a3);};}function getRealtimeAgents(){return new Promise(function(_0x13acc7,_0x13f893){return amiClient['request'](_0xb038('0x12'),{})[_0xb038('0x13')](function(_0x183141){if(_0x183141[_0xb038('0xe')])throw new Error(_0xb038('0x14'));var _0x2b4173=_0x183141['result'];return routingClient[_0xb038('0x15')](_0xb038('0x12'),{})[_0xb038('0x13')](function(_0x3b095a){if(_0x3b095a['error'])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');var _0x20cea2=_0x3b095a[_0xb038('0x16')];return _0x13acc7(_[_0xb038('0x17')]({},_0x2b4173,_0x20cea2));});})[_0xb038('0x18')](function(_0x4fd2e8){_0x13f893(_0x4fd2e8);});});}function getRealtimeQueues(_0x222b84,_0x42c8ee){return new Promise(function(_0x3e0ea0,_0x33a377){var _0xc6cd61=_0x42c8ee==='voice'?amiClient:routingClient;return _0xc6cd61[_0xb038('0x15')](_[_0xb038('0x19')](_0x42c8ee)+_0xb038('0x1a'),_0x222b84)[_0xb038('0x13')](function(_0x5f123d){if(_0x5f123d[_0xb038('0xe')])throw new Error(util[_0xb038('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x42c8ee));return _0x3e0ea0(_0x5f123d[_0xb038('0x16')]);})[_0xb038('0x18')](function(_0x573f93){_0x33a377(_0x573f93);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x241329,_0x5337e3){return amiClient[_0xb038('0x15')](_0xb038('0x1c'),{})[_0xb038('0x13')](function(_0x1df7c4){if(_0x1df7c4[_0xb038('0xe')])throw new Error(_0xb038('0x1d'));return _0x241329(_0x1df7c4[_0xb038('0x16')]);})['catch'](function(_0xb6d93f){_0x5337e3(_0xb6d93f);});});}function initializeQueues(_0x33cf3c,_0x226631,_0x5d18c8,_0xa8fe18){var _0x3af191=[_0xb038('0x1e'),'available',_0xb038('0x1f'),_0xb038('0x20'),_0xb038('0x21')];if(_0x5d18c8===_0xb038('0x22')&&_0xa8fe18===_0xb038('0x23')){_0x3af191['push'](_0xb038('0x24'),_0xb038('0x25'),_0xb038('0x26'),_0xb038('0x27'),_0xb038('0x28'),_0xb038('0x29'),_0xb038('0x2a'),_0xb038('0x2b'),_0xb038('0x2c'),_0xb038('0x2d'),_0xb038('0x2e'),_0xb038('0x2f'),_0xb038('0x30'),'dialPredictiveIntervalMaxThreshold',_0xb038('0x31'),'predictiveIntervalAvailable',_0xb038('0x32'),_0xb038('0x33'),_0xb038('0x34'),_0xb038('0x35'),_0xb038('0x36'),_0xb038('0x37'));}return _0x33cf3c[_0xb038('0x38')](function(_0x3e6373){var _0x22fac4=_0x3e6373[_0xb038('0x39')]({'plain':!![]});_0x22fac4['agents']=[];_0x22fac4[_0xb038('0x21')]=0x0;_0x22fac4[_0xb038('0x3a')]=0x0;_0x22fac4[_0xb038('0x1e')]=0x0;_0x22fac4['available']=0x0;_0x22fac4['waiting']=0x0;if(_0x5d18c8==='voice'){_0x22fac4[_0xb038('0x20')]=0x0;_0x22fac4[_0xb038('0x3b')]=0x0;if(_0xa8fe18===_0xb038('0x23')){_0x22fac4[_0xb038('0x24')]=0x0;_0x22fac4[_0xb038('0x25')]=0x0;}}var _0x268f1b=_['find'](_0x226631,['id',_0x22fac4['id']]);if(_0x268f1b)_[_0xb038('0x17')](_0x22fac4,_[_0xb038('0x3c')](_0x268f1b,_0x3af191));return _0x22fac4;});}function updateAgentVoiceStatus(_0x1b6f1e,_0x17c445,_0x48e70b){var _0x456e44=_[_0xb038('0x3d')](_0x48e70b,['queue',_0x17c445['name']]);if(_0x456e44[_0xb038('0x3e')]===0x0)return _0x1b6f1e[_0xb038('0x3b')]=!![];if(_[_0xb038('0x3f')](_0x456e44,[_0xb038('0x40'),_0x1b6f1e[_0xb038('0x41')]['toString']()]))return _0x1b6f1e[_0xb038('0x20')]=!![];if(!_0x1b6f1e[_0xb038('0x20')])return _0x1b6f1e[_0xb038('0x3b')]=!![];}function getVoiceQueueAgents(_0x2d1e57,_0x5dd192,_0x793da9,_0x2a9da0){var _0x7d2f79=_['find'](_0x5dd192,['id',_0x2d1e57['id']]);if(!_0x7d2f79)return _0x2d1e57;return _0x7d2f79[_0xb038('0x42')]({'raw':!![]})['then'](function(_0x36f281){for(var _0x2a539a=0x0;_0x2a539a<_0x36f281[_0xb038('0x3e')];_0x2a539a++){var _0x5ce40c=_[_0xb038('0x43')](_0x793da9,['id',_0x36f281[_0x2a539a][_0xb038('0x44')]]);if(!_0x5ce40c){_0x5ce40c={'id':_0x36f281[_0x2a539a][_0xb038('0x44')],'name':_0x36f281[_0x2a539a]['UserId'],'accountcode':'','online':![]};}var _0x1a164e={'id':_0x5ce40c['id'],'name':_0x5ce40c[_0xb038('0x10')],'internal':_0x5ce40c[_0xb038('0x45')],'online':Boolean(_0x5ce40c[_0xb038('0x46')]),'paused':Boolean(_0x36f281[_0x2a539a]['paused'])};if(_0x5ce40c[_0xb038('0x47')]===_0xb038('0x20'))updateAgentVoiceStatus(_0x1a164e,_0x2d1e57,_0x2a9da0);if(_0x1a164e[_0xb038('0x46')])_0x2d1e57[_0xb038('0x3a')]++;if(_0x1a164e['busy'])_0x2d1e57[_0xb038('0x3b')]++;if(_0x1a164e[_0xb038('0x21')]&&!_0x1a164e['busy']&&!_0x1a164e[_0xb038('0x20')])_0x2d1e57[_0xb038('0x21')]++;_0x2d1e57[_0xb038('0x48')]['push'](_0x1a164e);}return _0x2d1e57;});}function getQueueAgents(_0x5b7fa3,_0x317e51,_0x5495c7){var _0x527eaa=_0xb038('0x49')+_[_0xb038('0x19')](_0x5495c7)+_0xb038('0x4a');var _0x17c904=_0x5495c7+_0xb038('0x4b');return db[_0x527eaa][_0xb038('0x4c')]({'where':{[_[_0xb038('0x19')](_0x5495c7)+_0xb038('0x4d')]:_0x5b7fa3['id']},'raw':!![]})['then'](function(_0x5f0d9d){for(var _0x5e8383=0x0;_0x5e8383<_0x5f0d9d[_0xb038('0x3e')];_0x5e8383++){var _0x3ab2b1=_['find'](_0x317e51,['id',_0x5f0d9d[_0x5e8383][_0xb038('0x44')]]);if(!_0x3ab2b1){_0x3ab2b1={'id':_0x5f0d9d[_0x5e8383][_0xb038('0x44')],'name':_0x5f0d9d[_0x5e8383][_0xb038('0x44')],'online':![],['pauseField']:![]};}var _0x5f24cd={'id':_0x3ab2b1['id'],'name':_0x3ab2b1[_0xb038('0x10')],'online':Boolean(_0x3ab2b1['online']),'paused':Boolean(_0x3ab2b1[_0x17c904])};if(_0x5f24cd['online'])_0x5b7fa3[_0xb038('0x3a')]++;_0x5b7fa3[_0xb038('0x48')][_0xb038('0x4e')](_0x5f24cd);}return _0x5b7fa3;});}function isIdle(_0x15100c){return _0x15100c===_0xb038('0x4f')||_0x15100c===_0xb038('0x50')||_0x15100c===_0xb038('0x51')||_0x15100c===_0xb038('0x52')||_[_0xb038('0x53')](_0x15100c);}function isAgentPaused(_0x3db14f,_0x47b0a5){var _0x2faf54=[_0x3db14f[_0xb038('0x54')],_0x3db14f['faxPause'],_0x3db14f[_0xb038('0x55')],_0x3db14f[_0xb038('0x56')],_0x3db14f['smsPause'],_0x3db14f[_0xb038('0x57')],_0x3db14f[_0xb038('0x58')]];if(!_0x47b0a5)return _[_0xb038('0x59')](_0x2faf54);var _0x32bd6b=_[_0xb038('0x3d')](_0x2faf54);return _0x32bd6b[_0xb038('0x3e')]>0x0&&_0x32bd6b[_0xb038('0x3e')]<_0x2faf54[_0xb038('0x3e')]?!![]:![];}function isAgentIdle(_0x3a291d){if(_0x3a291d['voiceStatus']!==_0xb038('0x4f')&&_0x3a291d[_0xb038('0x57')]){_0x3a291d[_0xb038('0x47')]=_0xb038('0x5a');return![];}return _[_0xb038('0x59')]([_0x3a291d[_0xb038('0x5b')],_0x3a291d['faxStatus'],_0x3a291d[_0xb038('0x5c')],_0x3a291d[_0xb038('0x5d')],_0x3a291d[_0xb038('0x5e')],_0x3a291d[_0xb038('0x47')],_0x3a291d[_0xb038('0x5f')]],isIdle);}function getAgentStatus(_0x24198c){var _0xd7a862='unknown';if(isAgentPaused(_0x24198c))_0xd7a862=_0xb038('0x5a');else if(isAgentPaused(_0x24198c,!![]))_0xd7a862='*pause';else if(isAgentIdle(_0x24198c))_0xd7a862=_0xb038('0x4f');else _0xd7a862=_0xb038('0x3b');return _0xd7a862;}exports[_0xb038('0x60')]=function(_0x998fe3,_0x1518c4){var _0x5ea7df={'count':0x0,'rows':[]},_0x5b10cb={},_0x4e179c,_0x1a07c8,_0x3048bc=[_0xb038('0x61'),_0xb038('0x46'),_0xb038('0x62'),'lastPauseAt',_0xb038('0x63'),_0xb038('0x64'),'internal','address',_0xb038('0x54'),'openchannelPause',_0xb038('0x55'),'smsPause',_0xb038('0x58'),_0xb038('0x65'),_0xb038('0x57'),_0xb038('0x66'),'openchannelCapacity',_0xb038('0x67'),_0xb038('0x68'),_0xb038('0x69'),_0xb038('0x6a'),_0xb038('0x6b'),_0xb038('0x6c'),_0xb038('0x6d'),_0xb038('0x6e'),_0xb038('0x6f'),_0xb038('0x70'),_0xb038('0x5b'),_0xb038('0x5d'),'mailStatus',_0xb038('0x5e'),_0xb038('0x5f'),_0xb038('0x71'),_0xb038('0x47'),_0xb038('0x72'),'openchannelStatusTime',_0xb038('0x73'),'smsStatusTime',_0xb038('0x74'),_0xb038('0x75'),'voiceStatusTime',_0xb038('0x76'),_0xb038('0x77'),_0xb038('0x78'),_0xb038('0x79'),_0xb038('0x7a'),_0xb038('0x7b')],_0x276fac=[_0xb038('0x54'),_0xb038('0x56'),_0xb038('0x55'),_0xb038('0x7c'),'whatsappPause',_0xb038('0x65'),'voicePause',_0xb038('0x46')];Promise[_0xb038('0x7d')]()[_0xb038('0x13')](function(){var _0x36568b=_[_0xb038('0x38')](db[_0xb038('0x49')][_0xb038('0x7e')],function(_0x4c23b2){return{'name':_0x4c23b2['fieldName'],'type':_0x4c23b2[_0xb038('0x7f')][_0xb038('0x80')]};});_0x998fe3[_0xb038('0x81')]['role']='agent';_0x998fe3[_0xb038('0x81')]['online']=!![];_0x5b10cb=qs[_0xb038('0x82')](_0x36568b,_0x998fe3);_0x5b10cb['raw']=!![];if(_0x998fe3[_0xb038('0x83')]['role']===_0xb038('0x83')){var _0x3d0ee1={'params':{'id':_0x998fe3[_0xb038('0x83')][_0xb038('0x84')]},'query':{'section':_0xb038('0x12'),'role':_0xb038('0x85'),'online':!![],'nolimit':_0x998fe3['query']['nolimit'],'sort':_0x998fe3[_0xb038('0x81')]['sort'],'filter':_0x998fe3[_0xb038('0x81')][_0xb038('0x3d')],'raw':!![]}};return db[_0xb038('0x86')]['getResources'](_0x3d0ee1);}return db[_0xb038('0x49')]['findAndCountAll'](_0x5b10cb);})[_0xb038('0x13')](function(_0x218394){_0x5ea7df[_0xb038('0x8')]=_0x218394[_0xb038('0x8')];_0x4e179c=_0x218394[_0xb038('0x87')];return getRealtimeAgents();})[_0xb038('0x13')](function(_0x3e2b92){_0x1a07c8=_0x3e2b92[_0xb038('0x87')];return _0x4e179c[_0xb038('0x38')](function(_0x494fe5){var _0x50a40c=_['find'](_0x1a07c8,['id',_0x494fe5['id']]);if(_0x50a40c)_[_0xb038('0x17')](_0x494fe5,_['pick'](_[_0xb038('0x88')](_0x50a40c,_0x276fac),_0x3048bc));_0x494fe5['globalStatus']=getAgentStatus(_0x494fe5);return _0x494fe5;});})[_0xb038('0x13')](function(_0x240e88){if(_0x998fe3[_0xb038('0x81')][_0xb038('0x89')]){var _0x7c8d01=_[_0xb038('0x3d')](_0x240e88,[_0xb038('0x8a'),_0x998fe3[_0xb038('0x81')][_0xb038('0x89')]]);if(_0x998fe3[_0xb038('0x81')][_0xb038('0x8b')]){_0x7c8d01=_[_0xb038('0x3d')](_0x7c8d01,[_0xb038('0x63'),_0x998fe3[_0xb038('0x81')][_0xb038('0x8b')]]);}}_0x5ea7df[_0xb038('0x87')]=_0x7c8d01||_0x240e88;return _0x5ea7df;})[_0xb038('0x13')](respondWithFilteredResult(_0x1518c4,_0x5b10cb))[_0xb038('0x18')](handleError(_0x1518c4,null));};exports[_0xb038('0x8c')]=function(_0x5d0f38,_0x23adc3){var _0x3c194d=[_0xb038('0x8d'),_0xb038('0x8e'),_0xb038('0x8f'),'openchannel',_0xb038('0x90'),_0xb038('0x91'),_0xb038('0x22')];var _0x80d720={'count':0x0,'rows':[]},_0x34e222={},_0x468b41,_0x2acbf6,_0x2d0313,_0xd5aa6d,_0x4ce25a;Promise['resolve']()[_0xb038('0x13')](function(){if(_0x5d0f38['query'][_0xb038('0x92')]){if(!_['includes'](_0x3c194d,_0x5d0f38['query']['channel'][_0xb038('0x93')]()))throw new Error(_0xb038('0x94'));_0x468b41=_0x5d0f38['query'][_0xb038('0x92')][_0xb038('0x93')]();}var _0x3da280=_[_0xb038('0x19')](_0x468b41)+_0xb038('0x4a');var _0x1f960b=_[_0xb038('0x38')](db[_0x3da280][_0xb038('0x7e')],function(_0x20926a){return{'name':_0x20926a[_0xb038('0x95')],'type':_0x20926a['type'][_0xb038('0x80')]};});_0x34e222=qs[_0xb038('0x82')](_0x1f960b,_0x5d0f38);if(_0x5d0f38[_0xb038('0x83')][_0xb038('0x96')]===_0xb038('0x83')){var _0x222e90={'params':{'id':_0x5d0f38[_0xb038('0x83')]['userProfileId']},'query':{'section':_0x468b41===_0xb038('0x22')&&_0x5d0f38[_0xb038('0x81')][_0xb038('0x7f')]==='outbound'?'QueueCampaigns':_[_0xb038('0x19')](_0x468b41)+_0xb038('0x1a'),'type':_0x5d0f38[_0xb038('0x81')]['type'],'nolimit':!![],'sort':_0xb038('0x10'),'filter':_0x5d0f38[_0xb038('0x81')]['filter']}};return db[_0xb038('0x86')][_0xb038('0x97')](_0x222e90);}return db[_0x3da280][_0xb038('0x98')](_0x34e222);})[_0xb038('0x13')](function(_0x24f810){_0x80d720[_0xb038('0x8')]=_0x24f810[_0xb038('0x8')];_0x2acbf6=_0x24f810[_0xb038('0x87')];return getRealtimeQueues(_0x5d0f38,_0x468b41);})[_0xb038('0x13')](function(_0x3d077c){_0xd5aa6d=_0x3d077c[_0xb038('0x87')];return getRealtimeAgents();})[_0xb038('0x13')](function(_0x2ee9c5){_0x2d0313=_0x2ee9c5[_0xb038('0x87')];if(_0x468b41!='voice')return;return getRealtimeVoiceQueueChannels();})[_0xb038('0x13')](function(_0x3b282b){_0x4ce25a=_0x3b282b?_0x3b282b[_0xb038('0x87')]:[];return initializeQueues(_0x2acbf6,_0xd5aa6d,_0x468b41,_0x5d0f38[_0xb038('0x81')][_0xb038('0x7f')]);})[_0xb038('0x13')](function(_0x3ce0a2){var _0xf9caa5=_0x3ce0a2['map'](function(_0x3e29d2){if(_0x468b41===_0xb038('0x22'))return getVoiceQueueAgents(_0x3e29d2,_0x2acbf6,_0x2d0313,_0x4ce25a);else return getQueueAgents(_0x3e29d2,_0x2d0313,_0x468b41);});return Promise['all'](_0xf9caa5);})[_0xb038('0x13')](function(_0x5080e1){_0x80d720['rows']=_0x5080e1;return _0x80d720;})[_0xb038('0x13')](respondWithFilteredResult(_0x23adc3,_0x34e222))['catch'](handleError(_0x23adc3,null));}; \ No newline at end of file +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(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1261,0x144));var _0x1126=function(_0x27cae4,_0x1fe454){_0x27cae4=_0x27cae4-0x0;var _0x468f66=_0x1261[_0x27cae4];return _0x468f66;};'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 diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 1758b3f..414299f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1669d0,_0x599eb7){var _0x20c1af=function(_0x281502){while(--_0x281502){_0x1669d0['push'](_0x1669d0['shift']());}};_0x20c1af(++_0x599eb7);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x438caa,_0x3c6bb9){var _0x9757e4=function(_0x37ecf1){while(--_0x37ecf1){_0x438caa['push'](_0x438caa['shift']());}};_0x9757e4(++_0x3c6bb9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6864610..d01eb46 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 _0xaee6=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x2f5288,_0x4cd0b1){var _0x37fbd6=function(_0x67ff88){while(--_0x67ff88){_0x2f5288['push'](_0x2f5288['shift']());}};_0x37fbd6(++_0x4cd0b1);}(_0xaee6,0x187));var _0x6aee=function(_0x5c39e6,_0x3550aa){_0x5c39e6=_0x5c39e6-0x0;var _0x865eb8=_0xaee6[_0x5c39e6];return _0x865eb8;};'use strict';var Sequelize=require(_0x6aee('0x0'));module[_0x6aee('0x1')]={'state':{'type':Sequelize[_0x6aee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x6aee('0x3')]},'scheduledat':{'type':Sequelize[_0x6aee('0x4')]},'uniqueid':{'type':Sequelize[_0x6aee('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x6aee('0x4')]},'ringtime':{'type':Sequelize[_0x6aee('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6aee('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6aee('0x3')]}}; \ No newline at end of file +var _0xfe91=['sequelize','STRING','DATE','INTEGER'];(function(_0x2e87c3,_0x17639d){var _0x1761d3=function(_0x1df93f){while(--_0x1df93f){_0x2e87c3['push'](_0x2e87c3['shift']());}};_0x1761d3(++_0x17639d);}(_0xfe91,0xd4));var _0x1fe9=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0xfe91[_0x3e0763];return _0x351ca2;};'use strict';var Sequelize=require(_0x1fe9('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x1fe9('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x1fe9('0x1')]},'starttime':{'type':Sequelize[_0x1fe9('0x2')]},'responsetime':{'type':Sequelize[_0x1fe9('0x2')]},'ringtime':{'type':Sequelize[_0x1fe9('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1fe9('0x1')]},'campaigntype':{'type':Sequelize[_0x1fe9('0x1')]},'membername':{'type':Sequelize[_0x1fe9('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 3a3fde7..18300ab 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 _0x1353=['../../config/environment','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x275080,_0x38d7ef){var _0x4defa7=function(_0x264aca){while(--_0x264aca){_0x275080['push'](_0x275080['shift']());}};_0x4defa7(++_0x38d7ef);}(_0x1353,0x164));var _0x3135=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1353[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3135('0x0'));var util=require(_0x3135('0x1'));var logger=require('../../config/logger')(_0x3135('0x2'));var moment=require(_0x3135('0x3'));var BPromise=require(_0x3135('0x4'));var rp=require(_0x3135('0x5'));var fs=require('fs');var path=require(_0x3135('0x6'));var rimraf=require(_0x3135('0x7'));var config=require(_0x3135('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x3135('0x9')]=function(_0x40a7e4,_0x33dab9){return _0x40a7e4[_0x3135('0xa')](_0x3135('0xb'),attributes,{'tableName':_0x3135('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeed7=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0xeed7,0x1ef));var _0x7eed=function(_0x5da45f,_0xeccc37){_0x5da45f=_0x5da45f-0x0;var _0x4ffaee=_0xeed7[_0x5da45f];return _0x4ffaee;};'use strict';var _=require(_0x7eed('0x0'));var util=require(_0x7eed('0x1'));var logger=require(_0x7eed('0x2'))('api');var moment=require(_0x7eed('0x3'));var BPromise=require(_0x7eed('0x4'));var rp=require(_0x7eed('0x5'));var fs=require('fs');var path=require(_0x7eed('0x6'));var rimraf=require(_0x7eed('0x7'));var config=require(_0x7eed('0x8'));var attributes=require(_0x7eed('0x9'));module[_0x7eed('0xa')]=function(_0x48ac7b,_0x1ea4ec){return _0x48ac7b[_0x7eed('0xb')](_0x7eed('0xc'),attributes,{'tableName':_0x7eed('0xd'),'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 6a7fc1d..21da28d 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 _0xabc1=['../../config/utils','../../config/logger','rpc','jayson/promise','client','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','body','options','raw','then','debug','CreateReportAgentPreview','lodash','util','bluebird','ioredis'];(function(_0x304828,_0x154b36){var _0x1ab51e=function(_0x2a9bc1){while(--_0x2a9bc1){_0x304828['push'](_0x304828['shift']());}};_0x1ab51e(++_0x154b36);}(_0xabc1,0x92));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x1abc('0x0'));var util=require(_0x1abc('0x1'));var moment=require('moment');var BPromise=require(_0x1abc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1abc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1abc('0x4'));var logger=require(_0x1abc('0x5'))(_0x1abc('0x6'));var config=require('../../config/environment');var jayson=require(_0x1abc('0x7'));var client=jayson[_0x1abc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4edc0a,_0x36466b,_0x368773){return new BPromise(function(_0x188384,_0x4586d8){return client['request'](_0x4edc0a,_0x368773)['then'](function(_0x258b54){logger[_0x1abc('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x36466b,_0x1abc('0xa'));logger['debug'](_0x1abc('0xb'),_0x36466b,_0x1abc('0xa'),JSON[_0x1abc('0xc')](_0x258b54));if(_0x258b54[_0x1abc('0xd')]){if(_0x258b54[_0x1abc('0xd')][_0x1abc('0xe')]===0x1f4){logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54['error'][_0x1abc('0x10')]);return _0x4586d8(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}logger[_0x1abc('0xd')](_0x1abc('0xf'),_0x36466b,_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);return _0x188384(_0x258b54[_0x1abc('0xd')][_0x1abc('0x10')]);}else{logger['info'](_0x1abc('0xf'),_0x36466b,_0x1abc('0xa'));_0x188384(_0x258b54[_0x1abc('0x11')]['message']);}})[_0x1abc('0x12')](function(_0x5ae22f){logger['error'](_0x1abc('0xf'),_0x36466b,_0x5ae22f);_0x4586d8(_0x5ae22f);});});}exports['CreateReportAgentPreview']=function(_0x13f268){var _0x2f3154=this;return new Promise(function(_0x4ef478,_0x1e2a2d){return db['ReportAgentPreview']['create'](_0x13f268[_0x1abc('0x13')],{'raw':_0x13f268[_0x1abc('0x14')]?_0x13f268[_0x1abc('0x14')][_0x1abc('0x15')]===undefined?!![]:![]:!![]})[_0x1abc('0x16')](function(_0x1966b0){logger[_0x1abc('0x9')]('CreateReportAgentPreview',_0x13f268);logger[_0x1abc('0x17')](_0x1abc('0x18'),_0x13f268,JSON['stringify'](_0x1966b0));_0x4ef478(_0x1966b0);})[_0x1abc('0x12')](function(_0x1b45a7){logger['error']('CreateReportAgentPreview',_0x1b45a7[_0x1abc('0x10')],_0x13f268);_0x1e2a2d(_0x2f3154[_0x1abc('0xd')](0x1f4,_0x1b45a7['message']));});});}; \ No newline at end of file +var _0x1755=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','stringify','lodash','util','moment','bluebird'];(function(_0x4fa93b,_0x5e6266){var _0x317715=function(_0x931470){while(--_0x931470){_0x4fa93b['push'](_0x4fa93b['shift']());}};_0x317715(++_0x5e6266);}(_0x1755,0xce));var _0x5175=function(_0x151ee1,_0x55bf2a){_0x151ee1=_0x151ee1-0x0;var _0x28eca9=_0x1755[_0x151ee1];return _0x28eca9;};'use strict';var _=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var moment=require(_0x5175('0x2'));var BPromise=require(_0x5175('0x3'));var rs=require(_0x5175('0x4'));var fs=require('fs');var Redis=require(_0x5175('0x5'));var db=require(_0x5175('0x6'))['db'];var utils=require(_0x5175('0x7'));var logger=require(_0x5175('0x8'))(_0x5175('0x9'));var config=require(_0x5175('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5175('0xb')][_0x5175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x446f61,_0x3de62f,_0x17b4d9){return new BPromise(function(_0x35c47e,_0x11c517){return client[_0x5175('0xd')](_0x446f61,_0x17b4d9)['then'](function(_0x37e715){logger[_0x5175('0xe')](_0x5175('0xf'),_0x3de62f,'request\x20sent');logger[_0x5175('0x10')](_0x5175('0x11'),_0x3de62f,_0x5175('0x12'),JSON['stringify'](_0x37e715));if(_0x37e715[_0x5175('0x13')]){if(_0x37e715['error'][_0x5175('0x14')]===0x1f4){logger[_0x5175('0x13')](_0x5175('0xf'),_0x3de62f,_0x37e715['error'][_0x5175('0x15')]);return _0x11c517(_0x37e715[_0x5175('0x13')][_0x5175('0x15')]);}logger[_0x5175('0x13')](_0x5175('0xf'),_0x3de62f,_0x37e715[_0x5175('0x13')][_0x5175('0x15')]);return _0x35c47e(_0x37e715[_0x5175('0x13')][_0x5175('0x15')]);}else{logger[_0x5175('0xe')](_0x5175('0xf'),_0x3de62f,_0x5175('0x12'));_0x35c47e(_0x37e715['result']['message']);}})[_0x5175('0x16')](function(_0xecb438){logger['error'](_0x5175('0xf'),_0x3de62f,_0xecb438);_0x11c517(_0xecb438);});});}exports[_0x5175('0x17')]=function(_0x38e83d){var _0x258740=this;return new Promise(function(_0x2ab5db,_0x1704b5){return db[_0x5175('0x18')][_0x5175('0x19')](_0x38e83d[_0x5175('0x1a')],{'raw':_0x38e83d[_0x5175('0x1b')]?_0x38e83d[_0x5175('0x1b')][_0x5175('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x58946b){logger[_0x5175('0xe')](_0x5175('0x17'),_0x38e83d);logger['debug'](_0x5175('0x17'),_0x38e83d,JSON[_0x5175('0x1d')](_0x58946b));_0x2ab5db(_0x58946b);})['catch'](function(_0x210fd2){logger[_0x5175('0x13')](_0x5175('0x17'),_0x210fd2[_0x5175('0x15')],_0x38e83d);_0x1704b5(_0x258740[_0x5175('0x13')](0x1f4,_0x210fd2[_0x5175('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index d684be9..09917e1 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 _0x0e77=['../../components/auth/service','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','put','/voice/queues/:id','updateVoiceQueue','outbound','/outbound/channels','agents','/agents/:id/capacity','telephones','trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','Router'];(function(_0x1c37a5,_0x59ee51){var _0x389d03=function(_0x51b4f4){while(--_0x51b4f4){_0x1c37a5['push'](_0x1c37a5['shift']());}};_0x389d03(++_0x59ee51);}(_0x0e77,0x1db));var _0x70e7=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0e77[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x70e7('0x0'));var util=require(_0x70e7('0x1'));var path=require(_0x70e7('0x2'));var express=require(_0x70e7('0x3'));var router=express[_0x70e7('0x4')]();var auth=require(_0x70e7('0x5'));var controller=require('./rpc.controller');router[_0x70e7('0x6')]('/voice/channels',auth[_0x70e7('0x7')](),controller['voiceChannels']);router[_0x70e7('0x6')](_0x70e7('0x8'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x9')]);router[_0x70e7('0x6')](_0x70e7('0xa'),auth[_0x70e7('0x7')](),controller[_0x70e7('0xb')]);router[_0x70e7('0x6')](_0x70e7('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x70e7('0xd'),auth['isAuthenticated'](),controller[_0x70e7('0xe')]);router[_0x70e7('0x6')]('/mail/queues',auth[_0x70e7('0x7')](),controller[_0x70e7('0xf')]);router['get'](_0x70e7('0x10'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x11')]);router[_0x70e7('0x6')](_0x70e7('0x12'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x13')]);router[_0x70e7('0x6')](_0x70e7('0x14'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x15')]);router['get'](_0x70e7('0x16'),auth['isAuthenticated'](),controller['whatsappQueues']);router['get'](_0x70e7('0x17'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x18')]);router['get']('/voice/queues/preview/:id',auth[_0x70e7('0x7')](),controller[_0x70e7('0x19')]);router[_0x70e7('0x6')](_0x70e7('0x1a'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x1b')]);router[_0x70e7('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x70e7('0x1c')]);router[_0x70e7('0x6')](_0x70e7('0x1d'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x1e')]);router[_0x70e7('0x6')](_0x70e7('0x1f'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x20')]);router[_0x70e7('0x6')]('/voice/queues/:id',auth[_0x70e7('0x7')](),controller['showVoiceQueues']);router[_0x70e7('0x21')](_0x70e7('0x22'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x23')]);router[_0x70e7('0x6')]('/outbound',auth[_0x70e7('0x7')](),controller[_0x70e7('0x24')]);router[_0x70e7('0x6')](_0x70e7('0x25'),auth[_0x70e7('0x7')](),controller['outboundChannels']);router[_0x70e7('0x6')]('/agents',auth[_0x70e7('0x7')](),controller[_0x70e7('0x26')]);router[_0x70e7('0x21')](_0x70e7('0x27'),auth[_0x70e7('0x7')](),controller['agentCapacity']);router[_0x70e7('0x6')]('/telephones',auth[_0x70e7('0x7')](),controller[_0x70e7('0x28')]);router[_0x70e7('0x6')]('/trunks',auth[_0x70e7('0x7')](),controller[_0x70e7('0x29')]);router[_0x70e7('0x6')](_0x70e7('0x2a'),auth['isAuthenticated'](),controller[_0x70e7('0x2b')]);router[_0x70e7('0x6')]('/fax/accounts',auth[_0x70e7('0x7')](),controller['faxAccounts']);router[_0x70e7('0x6')](_0x70e7('0x2c'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x2d')]);router[_0x70e7('0x6')](_0x70e7('0x2e'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x2f')]);router[_0x70e7('0x6')](_0x70e7('0x30'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x31')]);router[_0x70e7('0x6')](_0x70e7('0x32'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x33')]);router[_0x70e7('0x6')](_0x70e7('0x34'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x35')]);router[_0x70e7('0x6')](_0x70e7('0x36'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x37')]);router[_0x70e7('0x6')](_0x70e7('0x38'),auth[_0x70e7('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0x70e7('0x39')](_0x70e7('0x3a'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x3b')](_0x70e7('0x3c')));router[_0x70e7('0x6')]('/mail/queues/:id',auth[_0x70e7('0x7')](),controller[_0x70e7('0x3d')]);router[_0x70e7('0x39')](_0x70e7('0x3e'),auth['isAuthenticated'](),controller[_0x70e7('0x3b')](_0x70e7('0x3f')));router[_0x70e7('0x6')](_0x70e7('0x40'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x41')]);router['post']('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x70e7('0x3b')](_0x70e7('0x42')));router['get']('/fax/queues/:id',auth[_0x70e7('0x7')](),controller[_0x70e7('0x43')]);router[_0x70e7('0x39')](_0x70e7('0x44'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x3b')]('openchannel'));router[_0x70e7('0x6')](_0x70e7('0x45'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x46')]);router[_0x70e7('0x39')](_0x70e7('0x47'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x3b')](_0x70e7('0x48')));router[_0x70e7('0x39')](_0x70e7('0x49'),auth[_0x70e7('0x7')](),controller[_0x70e7('0x3b')](_0x70e7('0x4a')));router[_0x70e7('0x6')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0x70e7('0x4b')]);router[_0x70e7('0x6')](_0x70e7('0x4c'),auth['isAuthenticated'](),controller[_0x70e7('0x4d')]);router[_0x70e7('0x39')]('/agents/:id/notify',auth[_0x70e7('0x7')](),controller[_0x70e7('0x4e')]);module[_0x70e7('0x4f')]=router; \ No newline at end of file +var _0x109e=['/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','smsQueues','whatsappQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post'];(function(_0x524dfb,_0x954399){var _0x3bec28=function(_0x3d6c89){while(--_0x3d6c89){_0x524dfb['push'](_0x524dfb['shift']());}};_0x3bec28(++_0x954399);}(_0x109e,0xbc));var _0xe109=function(_0x599a4f,_0x328f44){_0x599a4f=_0x599a4f-0x0;var _0x1190b2=_0x109e[_0x599a4f];return _0x1190b2;};'use strict';var multer=require(_0xe109('0x0'));var util=require(_0xe109('0x1'));var path=require(_0xe109('0x2'));var express=require(_0xe109('0x3'));var router=express[_0xe109('0x4')]();var auth=require(_0xe109('0x5'));var controller=require(_0xe109('0x6'));router[_0xe109('0x7')](_0xe109('0x8'),auth[_0xe109('0x9')](),controller[_0xe109('0xa')]);router['get'](_0xe109('0xb'),auth[_0xe109('0x9')](),controller[_0xe109('0xc')]);router['get'](_0xe109('0xd'),auth[_0xe109('0x9')](),controller['voiceChannelStopMixMonitor']);router[_0xe109('0x7')](_0xe109('0xe'),auth[_0xe109('0x9')](),controller[_0xe109('0xf')]);router['get'](_0xe109('0x10'),auth[_0xe109('0x9')](),controller['chatQueues']);router['get'](_0xe109('0x11'),auth[_0xe109('0x9')](),controller[_0xe109('0x12')]);router[_0xe109('0x7')](_0xe109('0x13'),auth[_0xe109('0x9')](),controller[_0xe109('0x14')]);router[_0xe109('0x7')]('/openchannel/queues',auth[_0xe109('0x9')](),controller[_0xe109('0x15')]);router[_0xe109('0x7')](_0xe109('0x16'),auth['isAuthenticated'](),controller[_0xe109('0x17')]);router['get']('/whatsapp/queues',auth[_0xe109('0x9')](),controller[_0xe109('0x18')]);router[_0xe109('0x7')](_0xe109('0x19'),auth['isAuthenticated'](),controller[_0xe109('0x1a')]);router[_0xe109('0x7')]('/voice/queues/preview/:id',auth[_0xe109('0x9')](),controller[_0xe109('0x1b')]);router[_0xe109('0x7')](_0xe109('0x1c'),auth[_0xe109('0x9')](),controller['voiceQueuesChannels']);router['get'](_0xe109('0x1d'),auth[_0xe109('0x9')](),controller['voiceQueuesChannel']);router[_0xe109('0x7')](_0xe109('0x1e'),auth[_0xe109('0x9')](),controller[_0xe109('0x1f')]);router[_0xe109('0x7')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xe109('0x9')](),controller[_0xe109('0x20')]);router[_0xe109('0x7')](_0xe109('0x21'),auth[_0xe109('0x9')](),controller[_0xe109('0x22')]);router[_0xe109('0x23')](_0xe109('0x21'),auth[_0xe109('0x9')](),controller[_0xe109('0x24')]);router[_0xe109('0x7')](_0xe109('0x25'),auth[_0xe109('0x9')](),controller[_0xe109('0x26')]);router['get'](_0xe109('0x27'),auth[_0xe109('0x9')](),controller['outboundChannels']);router['get'](_0xe109('0x28'),auth[_0xe109('0x9')](),controller[_0xe109('0x29')]);router[_0xe109('0x23')](_0xe109('0x2a'),auth['isAuthenticated'](),controller[_0xe109('0x2b')]);router['get'](_0xe109('0x2c'),auth[_0xe109('0x9')](),controller[_0xe109('0x2d')]);router[_0xe109('0x7')](_0xe109('0x2e'),auth[_0xe109('0x9')](),controller[_0xe109('0x2f')]);router['get'](_0xe109('0x30'),auth['isAuthenticated'](),controller[_0xe109('0x31')]);router[_0xe109('0x7')](_0xe109('0x32'),auth[_0xe109('0x9')](),controller[_0xe109('0x33')]);router[_0xe109('0x7')]('/chat/queues/waitinginteractions',auth[_0xe109('0x9')](),controller[_0xe109('0x34')]);router['get']('/mail/queues/waitinginteractions',auth[_0xe109('0x9')](),controller[_0xe109('0x35')]);router[_0xe109('0x7')]('/openchannel/queues/waitinginteractions',auth[_0xe109('0x9')](),controller['openchannelQueuesWaitingInteractions']);router[_0xe109('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0xe109('0x36')]);router[_0xe109('0x7')](_0xe109('0x37'),auth[_0xe109('0x9')](),controller[_0xe109('0x38')]);router[_0xe109('0x7')]('/whatsapp/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xe109('0x39')]);router['get'](_0xe109('0x3a'),auth['isAuthenticated'](),controller[_0xe109('0x3b')]);router[_0xe109('0x3c')](_0xe109('0x3d'),auth[_0xe109('0x9')](),controller[_0xe109('0x3e')](_0xe109('0x3f')));router[_0xe109('0x7')](_0xe109('0x40'),auth[_0xe109('0x9')](),controller[_0xe109('0x41')]);router[_0xe109('0x3c')]('/chat/queues/:id/notify',auth[_0xe109('0x9')](),controller['queueNotify']('chat'));router['get'](_0xe109('0x42'),auth[_0xe109('0x9')](),controller[_0xe109('0x43')]);router[_0xe109('0x3c')]('/fax/queues/:id/notify',auth[_0xe109('0x9')](),controller['queueNotify'](_0xe109('0x44')));router[_0xe109('0x7')]('/fax/queues/:id',auth['isAuthenticated'](),controller[_0xe109('0x45')]);router[_0xe109('0x3c')](_0xe109('0x46'),auth[_0xe109('0x9')](),controller[_0xe109('0x3e')](_0xe109('0x47')));router[_0xe109('0x7')](_0xe109('0x48'),auth[_0xe109('0x9')](),controller[_0xe109('0x49')]);router[_0xe109('0x3c')](_0xe109('0x4a'),auth[_0xe109('0x9')](),controller[_0xe109('0x3e')](_0xe109('0x4b')));router['post'](_0xe109('0x4c'),auth[_0xe109('0x9')](),controller['queueNotify']('whatsapp'));router['get'](_0xe109('0x4d'),auth[_0xe109('0x9')](),controller[_0xe109('0x4e')]);router[_0xe109('0x7')]('/whatsapp/queues/:id',auth[_0xe109('0x9')](),controller[_0xe109('0x4f')]);router['post'](_0xe109('0x50'),auth[_0xe109('0x9')](),controller[_0xe109('0x51')]);module[_0xe109('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d5b1cb2..7a3d94d 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 _0x2bd8=['SmsQueues','showSmsQueues','showWhatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','queue_id','uniq','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','Account','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','\x20Message\x20not\x20found','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','error','message','result','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','format','agent','internal','telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues'];(function(_0x5c0481,_0x58b01a){var _0x1ae74c=function(_0x589a47){while(--_0x589a47){_0x5c0481['push'](_0x5c0481['shift']());}};_0x1ae74c(++_0x58b01a);}(_0x2bd8,0x130));var _0x82bd=function(_0x33b432,_0x2a07a3){_0x33b432=_0x33b432-0x0;var _0x3d9260=_0x2bd8[_0x33b432];return _0x3d9260;};'use strict';var BPromise=require(_0x82bd('0x0'));var moment=require('moment');var _=require(_0x82bd('0x1'));var util=require(_0x82bd('0x2'));var db=require(_0x82bd('0x3'))['db'];var logger=require(_0x82bd('0x4'))(_0x82bd('0x5'));var jayson=require(_0x82bd('0x6'));var amiClient=jayson[_0x82bd('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0x82bd('0x7')][_0x82bd('0x8')]({'port':0x232b});var routingClient=jayson[_0x82bd('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){var _0x1666cf=_0x226f60?_0x226f60:amiClient;return _0x1666cf['request'](_0x19dbb1,_0x77d7a9)['then'](function(_0x51c6ea){if(_0x51c6ea[_0x82bd('0x9')]){if(_0x51c6ea['error']['code']===0x1f4){return _0x4dc3a6(_0x51c6ea[_0x82bd('0x9')]['message']);}return _0x1f7463(_0x51c6ea['error'][_0x82bd('0xa')]);}else{_0x1f7463(_0x51c6ea[_0x82bd('0xb')]);}})['catch'](function(_0x140ad6){_0x4dc3a6(_0x140ad6);});});}function respondWithResult(_0x5f1ab9,_0xfaccf7){_0xfaccf7=_0xfaccf7||0xc8;return function(_0x51e17e){if(_0x51e17e){return _0x5f1ab9[_0x82bd('0xc')](_0xfaccf7)[_0x82bd('0xd')](_0x51e17e);}return _0x5f1ab9[_0x82bd('0xe')](0x194);};}function handleError(_0x2ca530,_0x58d82b){_0x58d82b=_0x58d82b||0x1f4;return function(_0x446ffc){logger[_0x82bd('0x9')](_0x446ffc['stack']);if(_0x446ffc[_0x82bd('0xf')]){delete _0x446ffc['name'];}_0x2ca530[_0x82bd('0xc')](_0x58d82b)[_0x82bd('0x10')](_0x446ffc);};}function findById(_0x2c5155){return function(_0x300982){if(!_[_0x82bd('0x11')](_0x2c5155)&&!_[_0x82bd('0x11')](_0x300982)&&!_[_0x82bd('0x11')](_0x300982[_0x82bd('0x12')])){return _[_0x82bd('0x13')](_0x300982[_0x82bd('0x12')],function(_0x390107){return _0x390107['id']==_0x2c5155;});}return null;};}exports[_0x82bd('0x14')]=function(_0x1c3779,_0x253741){return respondWithRpcPromise('VoiceChannels',_0x1c3779['query'])[_0x82bd('0x15')](respondWithResult(_0x253741,null))[_0x82bd('0x16')](handleError(_0x253741,null));};exports[_0x82bd('0x17')]=function(_0xc9fcdf,_0x34899b){return respondWithRpcPromise(_0x82bd('0x18'),_[_0x82bd('0x19')](_0xc9fcdf[_0x82bd('0x1a')],_0xc9fcdf[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x34899b,null))[_0x82bd('0x16')](handleError(_0x34899b,null));};exports[_0x82bd('0x1c')]=function(_0x1ca91f,_0x3260c4){return respondWithRpcPromise(_0x82bd('0x1d'),_[_0x82bd('0x19')](_0x1ca91f[_0x82bd('0x1a')],_0x1ca91f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3260c4,null))['catch'](handleError(_0x3260c4,null));};exports['voiceQueues']=function(_0x4248be,_0x436ecd){return respondWithRpcPromise(_0x82bd('0x1e'),_0x4248be[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x436ecd,null))[_0x82bd('0x16')](handleError(_0x436ecd,null));};exports[_0x82bd('0x1f')]=function(_0xbef23b,_0x2f0bb6){return respondWithRpcPromise(_0x82bd('0x1e'),_0xbef23b['query'])['then'](findById(_0xbef23b['params']['id']))['then'](respondWithResult(_0x2f0bb6,null))[_0x82bd('0x16')](handleError(_0x2f0bb6,null));};exports[_0x82bd('0x20')]=function(_0x351d3d,_0x190bca){return respondWithRpcPromise(_0x82bd('0x21'),_['merge'](_0x351d3d['body'],_0x351d3d['params']))[_0x82bd('0x15')](respondWithResult(_0x190bca,null))[_0x82bd('0x16')](handleError(_0x190bca,null));};exports[_0x82bd('0x22')]=function(_0x580ba8,_0x166c46){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x82bd('0x19')](_0x580ba8[_0x82bd('0x1a')],_0x580ba8[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x166c46,null))[_0x82bd('0x16')](handleError(_0x166c46,null));};exports[_0x82bd('0x23')]=function(_0x5ca7fc,_0x591b38){return respondWithRpcPromise(_0x82bd('0x24'),_0x5ca7fc[_0x82bd('0x1a')])['then'](respondWithResult(_0x591b38,null))[_0x82bd('0x16')](handleError(_0x591b38,null));};exports['voiceQueuesChannel']=function(_0x578e6e,_0x3b8015){return respondWithRpcPromise(_0x82bd('0x25'),_[_0x82bd('0x19')](_0x578e6e[_0x82bd('0x1a')],_0x578e6e[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0x3b8015,null))[_0x82bd('0x16')](handleError(_0x3b8015,null));};exports[_0x82bd('0x26')]=function(_0x42dc7f,_0xefc6e4){return respondWithRpcPromise(_0x82bd('0x27'),_[_0x82bd('0x19')](_0x42dc7f[_0x82bd('0x1a')],_0x42dc7f[_0x82bd('0x1b')]))[_0x82bd('0x15')](respondWithResult(_0xefc6e4,null))[_0x82bd('0x16')](handleError(_0xefc6e4,null));};exports[_0x82bd('0x28')]=function(_0x4bdcae,_0x59b7ca){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x82bd('0x19')](_0x4bdcae[_0x82bd('0x1a')],_0x4bdcae['params']))[_0x82bd('0x15')](respondWithResult(_0x59b7ca,null))['catch'](handleError(_0x59b7ca,null));};exports['outbound']=function(_0x4c5f8d,_0x2b7675){return respondWithRpcPromise(_0x82bd('0x29'),_0x4c5f8d[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x2b7675,null))[_0x82bd('0x16')](handleError(_0x2b7675,null));};exports['outboundChannels']=function(_0x54e33f,_0x575c14){return respondWithRpcPromise(_0x82bd('0x2a'),_0x54e33f['query'])['then'](respondWithResult(_0x575c14,null))[_0x82bd('0x16')](handleError(_0x575c14,null));};exports[_0x82bd('0x2b')]=function(_0x3192e2,_0x2c5e7d){var _0x3ff054;return respondWithRpcPromise(_0x82bd('0x2c'),_0x3192e2[_0x82bd('0x1a')])[_0x82bd('0x15')](function(_0x18752a){_0x3ff054=_0x18752a;return respondWithRpcPromise('Agents',_0x3192e2['query'],routingClient);})[_0x82bd('0x15')](function(_0x689b3c){return _['merge']({},_0x689b3c,_0x3ff054);})['then'](respondWithResult(_0x2c5e7d,null))[_0x82bd('0x16')](handleError(_0x2c5e7d,null));};exports[_0x82bd('0x2d')]=function(_0x4d310b,_0x121f1f){if(_0x4d310b[_0x82bd('0x2e')]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]&&_0x4d310b[_0x82bd('0x30')]&&_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]){for(var _0x2c429d in _0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]){if(_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')]['hasOwnProperty'](_0x2c429d)){db[_0x82bd('0x31')][_0x82bd('0x32')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b['user']['name'],'type':_0x82bd('0x33'),'exitAt':null,'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]&&_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d]['length']?{'$notIn':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]}:{'$ne':null}}})[_0x82bd('0x15')](function(_0x4b2fb8){var _0x158957=moment()['format'](_0x82bd('0x34'));for(var _0x6d65c6=0x0,_0x587aec=_0x4b2fb8[_0x82bd('0x35')];_0x6d65c6<_0x587aec;_0x6d65c6+=0x1){_0x4b2fb8[_0x6d65c6][_0x82bd('0x36')]({'exitAt':_0x158957});}});for(var _0x54d12e=0x0;_0x54d12e<_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d]['length'];_0x54d12e+=0x1){db[_0x82bd('0x31')][_0x82bd('0x37')]({'where':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')],'type':'INTERACTION','uniqueid':_0x4d310b['body'][_0x82bd('0x2f')][_0x2c429d][_0x54d12e],'exitAt':null},'defaults':{'channel':_0x2c429d,'membername':_0x4d310b[_0x82bd('0x30')]['name'],'interface':_[_0x82bd('0x11')](_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')])?util['format'](_0x82bd('0x39'),_0x4d310b[_0x82bd('0x30')][_0x82bd('0xf')]):_0x4d310b[_0x82bd('0x30')][_0x82bd('0x38')],'type':_0x82bd('0x33'),'enterAt':moment()[_0x82bd('0x3a')](_0x82bd('0x34')),'role':_0x82bd('0x3b'),'internal':_0x4d310b[_0x82bd('0x30')][_0x82bd('0x3c')],'uniqueid':_0x4d310b[_0x82bd('0x2e')][_0x82bd('0x2f')][_0x2c429d][_0x54d12e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x4d310b[_0x82bd('0x1b')]['id'],'capacity':_0x4d310b[_0x82bd('0x2e')]['capacity']},routingClient)[_0x82bd('0x15')](respondWithResult(_0x121f1f,null))[_0x82bd('0x16')](handleError(_0x121f1f,null));};exports[_0x82bd('0x3d')]=function(_0x4237ef,_0x55a2e6){return respondWithRpcPromise('Telephones',_0x4237ef[_0x82bd('0x1a')])['then'](respondWithResult(_0x55a2e6,null))['catch'](handleError(_0x55a2e6,null));};exports[_0x82bd('0x3e')]=function(_0x4c35dd,_0x523cbe){return respondWithRpcPromise(_0x82bd('0x3f'),_0x4c35dd[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x523cbe,null))[_0x82bd('0x16')](handleError(_0x523cbe,null));};exports[_0x82bd('0x40')]=function(_0x1a7402,_0x417c29){return respondWithRpcPromise(_0x82bd('0x41'),_0x1a7402[_0x82bd('0x1a')])[_0x82bd('0x15')](respondWithResult(_0x417c29,null))[_0x82bd('0x16')](handleError(_0x417c29,null));};exports[_0x82bd('0x42')]=function(_0x153fad,_0x1a1cdc){return respondWithRpcPromise(_0x82bd('0x43'),_0x153fad['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x1a1cdc,null))[_0x82bd('0x16')](handleError(_0x1a1cdc,null));};exports[_0x82bd('0x44')]=function(_0x354581,_0x9bf8fa){return respondWithRpcPromise('ChatQueues',_0x354581['query'],routingClient)['then'](findById(_0x354581['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x9bf8fa,null))[_0x82bd('0x16')](handleError(_0x9bf8fa,null));};exports[_0x82bd('0x45')]=function(_0x127f8f,_0x568fc3){return respondWithRpcPromise('MailQueues',_0x127f8f[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x568fc3,null))[_0x82bd('0x16')](handleError(_0x568fc3,null));};exports['showMailQueues']=function(_0x2657bc,_0x2252ef){return respondWithRpcPromise(_0x82bd('0x46'),_0x2657bc[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x2657bc[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x2252ef,null))[_0x82bd('0x16')](handleError(_0x2252ef,null));};exports[_0x82bd('0x47')]=function(_0x20b636,_0x3ae44e){return respondWithRpcPromise(_0x82bd('0x48'),_0x20b636[_0x82bd('0x1a')],mailClient)[_0x82bd('0x15')](respondWithResult(_0x3ae44e,null))[_0x82bd('0x16')](handleError(_0x3ae44e,null));};exports[_0x82bd('0x49')]=function(_0x124ca4,_0x1fa71d){return respondWithRpcPromise('OpenchannelQueues',_0x124ca4[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x1fa71d,null))['catch'](handleError(_0x1fa71d,null));};exports[_0x82bd('0x4a')]=function(_0x4d2305,_0x306247){return respondWithRpcPromise(_0x82bd('0x4b'),_0x4d2305[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x4d2305[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x306247,null))[_0x82bd('0x16')](handleError(_0x306247,null));};exports[_0x82bd('0x4c')]=function(_0x40d6cf,_0x37ede1){return respondWithRpcPromise(_0x82bd('0x4d'),_0x40d6cf['query'],routingClient)['then'](respondWithResult(_0x37ede1,null))[_0x82bd('0x16')](handleError(_0x37ede1,null));};exports[_0x82bd('0x4e')]=function(_0x513e1d,_0x47d136){return respondWithRpcPromise(_0x82bd('0x4d'),_0x513e1d[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x513e1d[_0x82bd('0x1b')]['id']))['then'](respondWithResult(_0x47d136,null))[_0x82bd('0x16')](handleError(_0x47d136,null));};exports['whatsappQueues']=function(_0x1a16c1,_0x6ff77c){return respondWithRpcPromise('WhatsappQueues',_0x1a16c1[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x6ff77c,null))[_0x82bd('0x16')](handleError(_0x6ff77c,null));};exports[_0x82bd('0x4f')]=function(_0x5a5d66,_0x1b5b39){return respondWithRpcPromise(_0x82bd('0x50'),_0x5a5d66[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x5a5d66[_0x82bd('0x1b')]['id']))[_0x82bd('0x15')](respondWithResult(_0x1b5b39,null))[_0x82bd('0x16')](handleError(_0x1b5b39,null));};exports[_0x82bd('0x51')]=function(_0x1384b0,_0x544f10){return respondWithRpcPromise(_0x82bd('0x52'),_0x1384b0['query'],routingClient)['then'](respondWithResult(_0x544f10,null))[_0x82bd('0x16')](handleError(_0x544f10,null));};exports[_0x82bd('0x53')]=function(_0x529cb2,_0x2d2a7e){return respondWithRpcPromise('FaxQueues',_0x529cb2[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](findById(_0x529cb2['params']['id']))[_0x82bd('0x15')](respondWithResult(_0x2d2a7e,null))[_0x82bd('0x16')](handleError(_0x2d2a7e,null));};exports['faxAccounts']=function(_0x505032,_0x5bd3ae){return respondWithRpcPromise(_0x82bd('0x54'),_0x505032[_0x82bd('0x1a')])['then'](respondWithResult(_0x5bd3ae,null))[_0x82bd('0x16')](handleError(_0x5bd3ae,null));};exports[_0x82bd('0x55')]=function(_0x52b73f,_0x5591af){return respondWithRpcPromise(_0x82bd('0x56'),_0x52b73f['query'],routingClient)['then'](respondWithResult(_0x5591af,null))[_0x82bd('0x16')](handleError(_0x5591af,null));};exports[_0x82bd('0x57')]=function(_0x988094,_0x3d1f0d){return respondWithRpcPromise(_0x82bd('0x58'),_0x988094['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x3d1f0d,null))['catch'](handleError(_0x3d1f0d,null));};exports[_0x82bd('0x59')]=function(_0x5e25c3,_0x2fbf08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5e25c3['query'],routingClient)[_0x82bd('0x15')](respondWithResult(_0x2fbf08,null))[_0x82bd('0x16')](handleError(_0x2fbf08,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x282263,_0x15a849){return respondWithRpcPromise(_0x82bd('0x5a'),_0x282263['query'],routingClient)['then'](function(_0x197368){if(_0x282263[_0x82bd('0x1a')]['type']!==undefined){var _0x222f9d=_(_0x197368[_0x82bd('0x12')])['filter']([_0x282263[_0x82bd('0x1a')][_0x82bd('0x5b')],_0x282263[_0x82bd('0x1b')]['id']])[_0x82bd('0x5c')](_0x82bd('0x5d'))[_0x82bd('0x5e')]()['value']();return _0x197368[_0x82bd('0x12')][_0x82bd('0x5f')](function(_0x12bc87){return _0x222f9d['indexOf'](_0x12bc87[_0x82bd('0x5d')])>-0x1;});}else{return _0x197368['rows'][_0x82bd('0x5f')](function(_0x2d9bc0){return _0x2d9bc0[_0x82bd('0x5d')]===parseInt(_0x282263[_0x82bd('0x1b')]['id']);});}})[_0x82bd('0x15')](respondWithResult(_0x15a849,null))['catch'](handleError(_0x15a849,null));};exports[_0x82bd('0x60')]=function(_0x39b9d5,_0x54e547){return respondWithRpcPromise(_0x82bd('0x61'),_0x39b9d5[_0x82bd('0x1a')],routingClient)['then'](respondWithResult(_0x54e547,null))[_0x82bd('0x16')](handleError(_0x54e547,null));};exports[_0x82bd('0x62')]=function(_0x42d4c9,_0x55fe38){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x42d4c9[_0x82bd('0x1a')],routingClient)[_0x82bd('0x15')](respondWithResult(_0x55fe38,null))[_0x82bd('0x16')](handleError(_0x55fe38,null));};exports['faxQueuesWaitingInteractions']=function(_0x465979,_0x4721c3){return respondWithRpcPromise(_0x82bd('0x63'),_0x465979['query'],routingClient)['then'](respondWithResult(_0x4721c3,null))['catch'](handleError(_0x4721c3,null));};exports['queueNotify']=function(_0x437463){return function(_0x45bbf7,_0x4b5bf4){var _0x35d111,_0x546106;var _0x1da93f=_['capitalize'](_0x437463);var _0x43d8a2=_0x437463===_0x82bd('0x64')?_0x82bd('0x65'):'Account';return db[_0x1da93f+_0x82bd('0x66')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x45bbf7[_0x82bd('0x1b')]['id']}})[_0x82bd('0x15')](function(_0xbe937d){if(_['isNil'](_0xbe937d)){throw new Error(_0x1da93f+_0x82bd('0x68'));}_0x35d111=_0xbe937d;return db[_0x1da93f+_0x82bd('0x69')][_0x82bd('0x67')]({'where':{'id':_0x45bbf7['body']['messageId']},'include':[{'model':db[_0x1da93f+'Interaction'],'as':_0x82bd('0x6a')},{'model':db[_0x1da93f+_0x43d8a2],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x1a7f98){if(_[_0x82bd('0x11')](_0x1a7f98)){throw new Error(_0x1da93f+'\x20Message\x20not\x20found');}_0x546106=_0x1a7f98;return _0x1a7f98['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5a8e7f={'uniqueid':_0x437463+'.'+_0x546106['id']+'.'+_0x546106[_0x82bd('0x6a')]['id'],'FromUserId':_0x45bbf7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c')};_0x5a8e7f[_0x1da93f+_0x82bd('0x6d')]=_0x546106['id'];_0x5a8e7f[_0x1da93f+_0x82bd('0x6e')]=_0x546106[_0x82bd('0x6a')]['id'];_0x5a8e7f[_0x82bd('0x6f')+_0x1da93f+_0x43d8a2+'Id']=_0x546106['Account']['id'];_0x5a8e7f['To'+_0x1da93f+_0x82bd('0x70')]=_0x35d111['id'];return db[_0x1da93f+_0x82bd('0x71')][_0x82bd('0x72')](_0x5a8e7f);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x437463,'interaction':_0x546106[_0x82bd('0x6a')],'message':_0x546106,'account':_0x546106[_0x82bd('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0x82bd('0x6c'),'appdata':_0x35d111[_0x82bd('0xf')]+','+(_0x546106[_0x82bd('0x6b')][_0x82bd('0x74')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})[_0x82bd('0x15')](respondWithResult(_0x4b5bf4,null))['catch'](handleError(_0x4b5bf4,null));};};exports[_0x82bd('0x76')]=function(_0x3d14c7,_0x57c71c){var _0x588d7f,_0x5ca4b5;if(_['isNil'](_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')])){throw new Error(_0x82bd('0x78'));}var _0x2eda47=_0x3d14c7[_0x82bd('0x2e')][_0x82bd('0x77')];var _0x17f2aa=_[_0x82bd('0x79')](_0x2eda47);var _0x534fee=_0x2eda47===_0x82bd('0x64')?'Website':_0x82bd('0x6b');return db[_0x82bd('0x7a')][_0x82bd('0x67')]({'raw':!![],'where':{'id':_0x3d14c7[_0x82bd('0x1b')]['id'],'role':'agent'}})[_0x82bd('0x15')](function(_0x2c92d8){if(_[_0x82bd('0x11')](_0x2c92d8)){throw new Error(_0x82bd('0x7b'));}_0x588d7f=_0x2c92d8;return db[_0x17f2aa+'Message'][_0x82bd('0x67')]({'where':{'id':_0x3d14c7[_0x82bd('0x2e')]['messageId']},'include':[{'model':db[_0x17f2aa+'Interaction'],'as':'Interaction'},{'model':db[_0x17f2aa+_0x534fee],'as':_0x82bd('0x6b')}]});})[_0x82bd('0x15')](function(_0x291587){if(_[_0x82bd('0x11')](_0x291587)){throw new Error(_0x17f2aa+_0x82bd('0x7c'));}_0x5ca4b5=_0x291587;return _0x291587[_0x82bd('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x82bd('0x15')](function(){var _0x8f45e2={'uniqueid':_0x2eda47+'.'+_0x5ca4b5['id']+'.'+_0x5ca4b5[_0x82bd('0x6a')]['id'],'FromUserId':_0x3d14c7[_0x82bd('0x30')]['id'],'type':_0x82bd('0x6c'),'ToUserId':_0x588d7f['id']};_0x8f45e2[_0x17f2aa+_0x82bd('0x6d')]=_0x5ca4b5['id'];_0x8f45e2[_0x17f2aa+_0x82bd('0x6e')]=_0x5ca4b5[_0x82bd('0x6a')]['id'];_0x8f45e2[_0x82bd('0x6f')+_0x17f2aa+_0x534fee+'Id']=_0x5ca4b5[_0x82bd('0x6b')]['id'];return db[_0x17f2aa+_0x82bd('0x71')][_0x82bd('0x72')](_0x8f45e2);})[_0x82bd('0x15')](function(){return respondWithRpcPromise(_0x82bd('0x73'),{'channel':_0x2eda47,'interaction':_0x5ca4b5[_0x82bd('0x6a')],'message':_0x5ca4b5,'account':_0x5ca4b5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x588d7f[_0x82bd('0xf')]+','+(_0x5ca4b5[_0x82bd('0x6b')][_0x82bd('0x7e')]||0x12c),'interval':_0x82bd('0x75')}]},routingClient);})['then'](respondWithResult(_0x57c71c,null))['catch'](handleError(_0x57c71c,null));}; \ No newline at end of file +var _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x12952a,_0x53340b){var _0x265cb4=function(_0x25fe32){while(--_0x25fe32){_0x12952a['push'](_0x12952a['shift']());}};_0x265cb4(++_0x53340b);}(_0x2d17,0x17e));var _0x72d1=function(_0x178934,_0x49aca1){_0x178934=_0x178934-0x0;var _0x42400b=_0x2d17[_0x178934];return _0x42400b;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3918845..96a20de 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 _0xdb76=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post','create','put','update','delete','destroy'];(function(_0x52abaa,_0x4aa040){var _0xab8159=function(_0xb024d8){while(--_0xb024d8){_0x52abaa['push'](_0x52abaa['shift']());}};_0xab8159(++_0x4aa040);}(_0xdb76,0x18f));var _0x6db7=function(_0x1582e9,_0x43095a){_0x1582e9=_0x1582e9-0x0;var _0x1e6bc7=_0xdb76[_0x1582e9];return _0x1e6bc7;};'use strict';var multer=require(_0x6db7('0x0'));var util=require(_0x6db7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6db7('0x2'));var router=express[_0x6db7('0x3')]();var fs_extra=require(_0x6db7('0x4'));var auth=require(_0x6db7('0x5'));var interaction=require(_0x6db7('0x6'));var config=require(_0x6db7('0x7'));var controller=require(_0x6db7('0x8'));router[_0x6db7('0x9')]('/',auth[_0x6db7('0xa')](),controller[_0x6db7('0xb')]);router[_0x6db7('0x9')](_0x6db7('0xc'),auth[_0x6db7('0xa')](),controller[_0x6db7('0xd')]);router[_0x6db7('0x9')](_0x6db7('0xe'),auth[_0x6db7('0xa')](),controller['run']);router[_0x6db7('0xf')]('/',auth[_0x6db7('0xa')](),controller[_0x6db7('0x10')]);router[_0x6db7('0x11')](_0x6db7('0xc'),auth['isAuthenticated'](),controller[_0x6db7('0x12')]);router[_0x6db7('0x13')](_0x6db7('0xc'),auth[_0x6db7('0xa')](),controller[_0x6db7('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2689=['create','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/run','run','post'];(function(_0x174803,_0x1ec29a){var _0x57f409=function(_0x2cae6c){while(--_0x2cae6c){_0x174803['push'](_0x174803['shift']());}};_0x57f409(++_0x1ec29a);}(_0x2689,0x193));var _0x9268=function(_0x220025,_0x401d3e){_0x220025=_0x220025-0x0;var _0x276146=_0x2689[_0x220025];return _0x276146;};'use strict';var multer=require(_0x9268('0x0'));var util=require('util');var path=require(_0x9268('0x1'));var timeout=require(_0x9268('0x2'));var express=require('express');var router=express[_0x9268('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9268('0x4'));var interaction=require(_0x9268('0x5'));var config=require(_0x9268('0x6'));var controller=require('./schedule.controller');router[_0x9268('0x7')]('/',auth['isAuthenticated'](),controller[_0x9268('0x8')]);router[_0x9268('0x7')](_0x9268('0x9'),auth[_0x9268('0xa')](),controller[_0x9268('0xb')]);router['get'](_0x9268('0xc'),auth[_0x9268('0xa')](),controller[_0x9268('0xd')]);router[_0x9268('0xe')]('/',auth[_0x9268('0xa')](),controller[_0x9268('0xf')]);router[_0x9268('0x10')](_0x9268('0x9'),auth['isAuthenticated'](),controller[_0x9268('0x11')]);router['delete'](_0x9268('0x9'),auth[_0x9268('0xa')](),controller['destroy']);module[_0x9268('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 44f26e6..1fee82a 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 _0x7cdc=['years','quarters','months','days','hours','minutes','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER'];(function(_0x2eb6f2,_0xde2a17){var _0x3329b1=function(_0xecccb2){while(--_0xecccb2){_0x2eb6f2['push'](_0x2eb6f2['shift']());}};_0x3329b1(++_0xde2a17);}(_0x7cdc,0x1e8));var _0xc7cd=function(_0x5e003a,_0xc1907a){_0x5e003a=_0x5e003a-0x0;var _0x329a46=_0x7cdc[_0x5e003a];return _0x329a46;};'use strict';var Sequelize=require(_0xc7cd('0x0'));module[_0xc7cd('0x1')]={'name':{'type':Sequelize[_0xc7cd('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc7cd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xc7cd('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xc7cd('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xc7cd('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xc7cd('0x6'),_0xc7cd('0x7'),_0xc7cd('0x8'),'weeks',_0xc7cd('0x9'),_0xc7cd('0xa'),_0xc7cd('0xb')),'allowNull':![],'defaultValue':_0xc7cd('0x9')},'output':{'type':Sequelize[_0xc7cd('0xc')](_0xc7cd('0xd'),_0xc7cd('0xe'),_0xc7cd('0xf')),'allowNull':![],'defaultValue':_0xc7cd('0xd')},'type':{'type':Sequelize[_0xc7cd('0xc')](_0xc7cd('0x10'),_0xc7cd('0x11')),'allowNull':![],'defaultValue':_0xc7cd('0x10')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xc7cd('0x2')]},'cc':{'type':Sequelize[_0xc7cd('0x12')]},'bcc':{'type':Sequelize[_0xc7cd('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x9982=['ENUM','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default','TEXT','sequelize','exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0xf8f57b,_0x1fabdd){var _0x20bf73=function(_0x254235){while(--_0x254235){_0xf8f57b['push'](_0xf8f57b['shift']());}};_0x20bf73(++_0x1fabdd);}(_0x9982,0x1ce));var _0x2998=function(_0x58aff1,_0x4d8805){_0x58aff1=_0x58aff1-0x0;var _0x1c730f=_0x9982[_0x58aff1];return _0x1c730f;};'use strict';var Sequelize=require(_0x2998('0x0'));module[_0x2998('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2998('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2998('0x3')},'startAt':{'type':Sequelize[_0x2998('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x2998('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x2998('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2998('0x6')]('years',_0x2998('0x7'),_0x2998('0x8'),_0x2998('0x9'),_0x2998('0xa'),_0x2998('0xb'),_0x2998('0xc')),'allowNull':![],'defaultValue':_0x2998('0xa')},'output':{'type':Sequelize['ENUM'](_0x2998('0xd'),_0x2998('0xe'),_0x2998('0xf')),'allowNull':![],'defaultValue':_0x2998('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0x2998('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x2998('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x2998('0x11')]},'bcc':{'type':Sequelize[_0x2998('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x2998('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index ceb8ac0..eb7db5c 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 _0x4a37=['query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','Schedule','includeAll','include','rows','catch','params','keys','create','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','reject','update','then','destroy','Scheduler','UserProfileResource','end','sendStatus','name','send','map','rawAttributes','fieldName','type','key','model'];(function(_0x3c2280,_0x23ad17){var _0x22545b=function(_0x25e725){while(--_0x25e725){_0x3c2280['push'](_0x3c2280['shift']());}};_0x22545b(++_0x23ad17);}(_0x4a37,0x114));var _0x74a3=function(_0x586b9c,_0x470a78){_0x586b9c=_0x586b9c-0x0;var _0x198b5f=_0x4a37[_0x586b9c];return _0x198b5f;};'use strict';var emlformat=require(_0x74a3('0x0'));var rimraf=require(_0x74a3('0x1'));var zipdir=require(_0x74a3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74a3('0x3'));var moment=require(_0x74a3('0x4'));var BPromise=require(_0x74a3('0x5'));var Mustache=require(_0x74a3('0x6'));var util=require(_0x74a3('0x7'));var path=require(_0x74a3('0x8'));var sox=require(_0x74a3('0x9'));var csv=require(_0x74a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x74a3('0xb'));var _=require(_0x74a3('0xc'));var squel=require('squel');var crypto=require(_0x74a3('0xd'));var jsforce=require(_0x74a3('0xe'));var deskjs=require(_0x74a3('0xf'));var toCsv=require(_0x74a3('0xa'));var querystring=require(_0x74a3('0x10'));var Papa=require('papaparse');var Redis=require(_0x74a3('0x11'));var authService=require(_0x74a3('0x12'));var qs=require(_0x74a3('0x13'));var as=require(_0x74a3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74a3('0x15'))('api');var utils=require(_0x74a3('0x16'));var config=require(_0x74a3('0x17'));var licenseUtil=require(_0x74a3('0x18'));var db=require(_0x74a3('0x19'))['db'];function respondWithStatusCode(_0x5e53f8,_0xef4a59){_0xef4a59=_0xef4a59||0xcc;return function(_0x1b55e9){if(_0x1b55e9){return _0x5e53f8['sendStatus'](_0xef4a59);}return _0x5e53f8[_0x74a3('0x1a')](_0xef4a59)['end']();};}function respondWithResult(_0x4ece8c,_0x38d961){_0x38d961=_0x38d961||0xc8;return function(_0x50ffc2){if(_0x50ffc2){return _0x4ece8c[_0x74a3('0x1a')](_0x38d961)[_0x74a3('0x1b')](_0x50ffc2);}};}function respondWithFilteredResult(_0x237a64,_0x1fa68c){return function(_0x318e43){if(_0x318e43){var _0x3f691d=typeof _0x1fa68c[_0x74a3('0x1c')]===_0x74a3('0x1d')&&typeof _0x1fa68c['limit']==='undefined';var _0x459839=_0x318e43[_0x74a3('0x1e')];var _0x5236b4=_0x3f691d?0x0:_0x1fa68c[_0x74a3('0x1c')];var _0x255cec=_0x3f691d?_0x318e43['count']:_0x1fa68c[_0x74a3('0x1c')]+_0x1fa68c[_0x74a3('0x1f')];var _0x490302;if(_0x255cec>=_0x459839){_0x255cec=_0x459839;_0x490302=0xc8;}else{_0x490302=0xce;}_0x237a64['status'](_0x490302);return _0x237a64['set']('Content-Range',_0x5236b4+'-'+_0x255cec+'/'+_0x459839)[_0x74a3('0x1b')](_0x318e43);}return null;};}function patchUpdates(_0x1ab4ff){return function(_0x134c44){try{jsonpatch['apply'](_0x134c44,_0x1ab4ff,!![]);}catch(_0xa401bf){return BPromise[_0x74a3('0x20')](_0xa401bf);}return _0x134c44['save']();};}function saveUpdates(_0x911bc2,_0x20108a){return function(_0x24be77){if(_0x24be77){return _0x24be77[_0x74a3('0x21')](_0x911bc2)[_0x74a3('0x22')](function(_0x1f5dbe){return _0x1f5dbe;});}return null;};}function removeEntity(_0x63a1d9,_0x3cdc43){return function(_0x458c3b){if(_0x458c3b){return _0x458c3b[_0x74a3('0x23')]()['then'](function(){var _0x16bbbf=_0x458c3b['get']({'plain':!![]});var _0x71fa59=_0x74a3('0x24');return db[_0x74a3('0x25')][_0x74a3('0x23')]({'where':{'type':_0x71fa59,'resourceId':_0x16bbbf['id']}})[_0x74a3('0x22')](function(){return _0x458c3b;});})['then'](function(){_0x63a1d9[_0x74a3('0x1a')](0xcc)[_0x74a3('0x26')]();});}};}function handleEntityNotFound(_0x375a7d,_0x18c8e8){return function(_0x4ee9c7){if(!_0x4ee9c7){_0x375a7d[_0x74a3('0x27')](0x194);}return _0x4ee9c7;};}function handleError(_0xb710c1,_0x13772b){_0x13772b=_0x13772b||0x1f4;return function(_0x59670d){logger['error'](_0x59670d['stack']);if(_0x59670d[_0x74a3('0x28')]){delete _0x59670d[_0x74a3('0x28')];}_0xb710c1['status'](_0x13772b)[_0x74a3('0x29')](_0x59670d);};}exports['index']=function(_0x319b27,_0x16489d){var _0x11e17f={},_0x4c41d1={},_0x138d77={'count':0x0,'rows':[]};var _0x407177=_[_0x74a3('0x2a')](db['Schedule'][_0x74a3('0x2b')],function(_0x41517d){return{'name':_0x41517d[_0x74a3('0x2c')],'type':_0x41517d[_0x74a3('0x2d')][_0x74a3('0x2e')]};});_0x4c41d1[_0x74a3('0x2f')]=_['map'](_0x407177,_0x74a3('0x28'));_0x4c41d1[_0x74a3('0x30')]=_['keys'](_0x319b27[_0x74a3('0x30')]);_0x4c41d1[_0x74a3('0x31')]=_['intersection'](_0x4c41d1[_0x74a3('0x2f')],_0x4c41d1['query']);_0x11e17f[_0x74a3('0x32')]=_[_0x74a3('0x33')](_0x4c41d1[_0x74a3('0x2f')],qs[_0x74a3('0x34')](_0x319b27[_0x74a3('0x30')][_0x74a3('0x34')]));_0x11e17f['attributes']=_0x11e17f[_0x74a3('0x32')][_0x74a3('0x35')]?_0x11e17f[_0x74a3('0x32')]:_0x4c41d1[_0x74a3('0x2f')];if(!_0x319b27[_0x74a3('0x30')]['hasOwnProperty'](_0x74a3('0x36'))){_0x11e17f[_0x74a3('0x1f')]=qs['limit'](_0x319b27[_0x74a3('0x30')][_0x74a3('0x1f')]);_0x11e17f[_0x74a3('0x1c')]=qs[_0x74a3('0x1c')](_0x319b27[_0x74a3('0x30')][_0x74a3('0x1c')]);}_0x11e17f[_0x74a3('0x37')]=qs[_0x74a3('0x38')](_0x319b27['query'][_0x74a3('0x38')]);_0x11e17f['where']=qs['filters'](_['pick'](_0x319b27[_0x74a3('0x30')],_0x4c41d1['filters']),_0x407177);if(_0x319b27[_0x74a3('0x30')][_0x74a3('0x39')]){_0x11e17f['where']=_['merge'](_0x11e17f[_0x74a3('0x3a')],{'$or':_[_0x74a3('0x2a')](_0x407177,function(_0x38efcd){if(_0x38efcd[_0x74a3('0x2d')]!==_0x74a3('0x3b')){var _0x5704aa={};_0x5704aa[_0x38efcd['name']]={'$like':'%'+_0x319b27[_0x74a3('0x30')]['filter']+'%'};return _0x5704aa;}})});}_0x11e17f=_[_0x74a3('0x3c')]({},_0x11e17f,_0x319b27['options']);var _0x353ddc={'where':_0x11e17f[_0x74a3('0x3a')]};return db[_0x74a3('0x3d')][_0x74a3('0x1e')](_0x353ddc)[_0x74a3('0x22')](function(_0x31353d){_0x138d77[_0x74a3('0x1e')]=_0x31353d;if(_0x319b27[_0x74a3('0x30')][_0x74a3('0x3e')]){_0x11e17f[_0x74a3('0x3f')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x11e17f);})[_0x74a3('0x22')](function(_0x12576e){_0x138d77[_0x74a3('0x40')]=_0x12576e;return _0x138d77;})[_0x74a3('0x22')](respondWithFilteredResult(_0x16489d,_0x11e17f))[_0x74a3('0x41')](handleError(_0x16489d,null));};exports['show']=function(_0x3446bf,_0x5a3ae8){var _0x1e5429={'raw':![],'where':{'id':_0x3446bf[_0x74a3('0x42')]['id']}},_0x1bda53={};_0x1bda53[_0x74a3('0x2f')]=_['keys'](db[_0x74a3('0x3d')][_0x74a3('0x2b')]);_0x1bda53['query']=_[_0x74a3('0x43')](_0x3446bf['query']);_0x1bda53[_0x74a3('0x31')]=_[_0x74a3('0x33')](_0x1bda53[_0x74a3('0x2f')],_0x1bda53[_0x74a3('0x30')]);_0x1e5429[_0x74a3('0x32')]=_[_0x74a3('0x33')](_0x1bda53[_0x74a3('0x2f')],qs['fields'](_0x3446bf[_0x74a3('0x30')][_0x74a3('0x34')]));_0x1e5429[_0x74a3('0x32')]=_0x1e5429[_0x74a3('0x32')]['length']?_0x1e5429['attributes']:_0x1bda53['model'];if(_0x3446bf[_0x74a3('0x30')][_0x74a3('0x3e')]){_0x1e5429[_0x74a3('0x3f')]=[{'all':!![]}];}_0x1e5429=_['merge']({},_0x1e5429,_0x3446bf['options']);return db['Schedule']['find'](_0x1e5429)[_0x74a3('0x22')](handleEntityNotFound(_0x5a3ae8,null))[_0x74a3('0x22')](respondWithResult(_0x5a3ae8,null))[_0x74a3('0x41')](handleError(_0x5a3ae8,null));};exports['create']=function(_0x16ed42,_0x44dd88){return db[_0x74a3('0x3d')][_0x74a3('0x44')](_0x16ed42['body'],{})['then'](function(_0x3b3984){var _0x24055e=_0x16ed42[_0x74a3('0x45')][_0x74a3('0x46')]({'plain':!![]});if(!_0x24055e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24055e[_0x74a3('0x47')]===_0x74a3('0x45')){var _0x397388=_0x3b3984[_0x74a3('0x46')]({'plain':!![]});var _0x3a2036='Scheduler';return db[_0x74a3('0x48')][_0x74a3('0x49')]({'where':{'name':_0x3a2036,'userProfileId':_0x24055e[_0x74a3('0x4a')]},'raw':!![]})[_0x74a3('0x22')](function(_0x41039d){if(_0x41039d&&_0x41039d[_0x74a3('0x4b')]===0x0){return db['UserProfileResource'][_0x74a3('0x44')]({'name':_0x397388[_0x74a3('0x28')],'resourceId':_0x397388['id'],'type':_0x41039d[_0x74a3('0x28')],'sectionId':_0x41039d['id']},{})[_0x74a3('0x22')](function(){return _0x3b3984;});}else{return _0x3b3984;}})[_0x74a3('0x41')](function(_0x42c569){logger[_0x74a3('0x4c')](_0x74a3('0x4d'),_0x42c569);throw _0x42c569;});}return _0x3b3984;})[_0x74a3('0x22')](respondWithResult(_0x44dd88,0xc9))[_0x74a3('0x41')](handleError(_0x44dd88,null));};exports[_0x74a3('0x21')]=function(_0x49549d,_0xc6ad99){if(_0x49549d[_0x74a3('0x4e')]['id']){delete _0x49549d[_0x74a3('0x4e')]['id'];}return db[_0x74a3('0x3d')][_0x74a3('0x49')]({'where':{'id':_0x49549d[_0x74a3('0x42')]['id']}})[_0x74a3('0x22')](handleEntityNotFound(_0xc6ad99,null))[_0x74a3('0x22')](saveUpdates(_0x49549d['body'],null))['then'](respondWithResult(_0xc6ad99,null))[_0x74a3('0x41')](handleError(_0xc6ad99,null));};exports[_0x74a3('0x23')]=function(_0x104938,_0x4b43c0){return db[_0x74a3('0x3d')][_0x74a3('0x49')]({'where':{'id':_0x104938[_0x74a3('0x42')]['id']}})[_0x74a3('0x22')](handleEntityNotFound(_0x4b43c0,null))[_0x74a3('0x22')](removeEntity(_0x4b43c0,null))[_0x74a3('0x41')](handleError(_0x4b43c0,null));};exports[_0x74a3('0x4f')]=function(_0xef4f4f,_0x1c65ec,_0x57ce2a){var _0x298a7f=require(_0x74a3('0x50'));return db[_0x74a3('0x3d')][_0x74a3('0x49')]({'where':{'id':_0xef4f4f['params']['id']},'raw':!![]})[_0x74a3('0x22')](handleEntityNotFound(_0x1c65ec,null))[_0x74a3('0x22')](function(){_0x298a7f['run'](_0xef4f4f[_0x74a3('0x42')]['id']);})['then'](respondWithStatusCode(_0x1c65ec,null))[_0x74a3('0x41')](handleError(_0x1c65ec,null));}; \ No newline at end of file +var _0x7269=['undefined','limit','count','set','apply','save','update','then','get','Scheduler','UserProfileResource','destroy','error','name','map','Schedule','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset'];(function(_0x41075f,_0x3bfee2){var _0x101296=function(_0x386aa0){while(--_0x386aa0){_0x41075f['push'](_0x41075f['shift']());}};_0x101296(++_0x3bfee2);}(_0x7269,0xcc));var _0x9726=function(_0x55c4f3,_0x2eda9d){_0x55c4f3=_0x55c4f3-0x0;var _0x31722f=_0x7269[_0x55c4f3];return _0x31722f;};'use strict';var emlformat=require(_0x9726('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9726('0x1'));var jsonpatch=require(_0x9726('0x2'));var rp=require(_0x9726('0x3'));var moment=require('moment');var BPromise=require(_0x9726('0x4'));var Mustache=require(_0x9726('0x5'));var util=require(_0x9726('0x6'));var path=require('path');var sox=require(_0x9726('0x7'));var csv=require(_0x9726('0x8'));var ejs=require(_0x9726('0x9'));var fs=require('fs');var fs_extra=require(_0x9726('0xa'));var _=require('lodash');var squel=require(_0x9726('0xb'));var crypto=require(_0x9726('0xc'));var jsforce=require(_0x9726('0xd'));var deskjs=require(_0x9726('0xe'));var toCsv=require(_0x9726('0x8'));var querystring=require('querystring');var Papa=require(_0x9726('0xf'));var Redis=require('ioredis');var authService=require(_0x9726('0x10'));var qs=require(_0x9726('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9726('0x12'));var logger=require('../../config/logger')(_0x9726('0x13'));var utils=require(_0x9726('0x14'));var config=require(_0x9726('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9726('0x16'))['db'];function respondWithStatusCode(_0x3ca589,_0x2e417b){_0x2e417b=_0x2e417b||0xcc;return function(_0x538ff5){if(_0x538ff5){return _0x3ca589[_0x9726('0x17')](_0x2e417b);}return _0x3ca589[_0x9726('0x18')](_0x2e417b)[_0x9726('0x19')]();};}function respondWithResult(_0x5a57ab,_0x1d702d){_0x1d702d=_0x1d702d||0xc8;return function(_0x33be3){if(_0x33be3){return _0x5a57ab[_0x9726('0x18')](_0x1d702d)['json'](_0x33be3);}};}function respondWithFilteredResult(_0x337394,_0x3ec66f){return function(_0x585e77){if(_0x585e77){var _0x56dd3c=typeof _0x3ec66f[_0x9726('0x1a')]===_0x9726('0x1b')&&typeof _0x3ec66f[_0x9726('0x1c')]==='undefined';var _0x129709=_0x585e77[_0x9726('0x1d')];var _0xc7341c=_0x56dd3c?0x0:_0x3ec66f[_0x9726('0x1a')];var _0x3365cc=_0x56dd3c?_0x585e77['count']:_0x3ec66f[_0x9726('0x1a')]+_0x3ec66f[_0x9726('0x1c')];var _0x592930;if(_0x3365cc>=_0x129709){_0x3365cc=_0x129709;_0x592930=0xc8;}else{_0x592930=0xce;}_0x337394[_0x9726('0x18')](_0x592930);return _0x337394[_0x9726('0x1e')]('Content-Range',_0xc7341c+'-'+_0x3365cc+'/'+_0x129709)['json'](_0x585e77);}return null;};}function patchUpdates(_0xb4050e){return function(_0x280b4c){try{jsonpatch[_0x9726('0x1f')](_0x280b4c,_0xb4050e,!![]);}catch(_0x2a5c03){return BPromise['reject'](_0x2a5c03);}return _0x280b4c[_0x9726('0x20')]();};}function saveUpdates(_0x5c71fa,_0xd81620){return function(_0x197f61){if(_0x197f61){return _0x197f61[_0x9726('0x21')](_0x5c71fa)[_0x9726('0x22')](function(_0x527b9d){return _0x527b9d;});}return null;};}function removeEntity(_0x4818e6,_0x4bbaf0){return function(_0x3af115){if(_0x3af115){return _0x3af115['destroy']()[_0x9726('0x22')](function(){var _0x5caecb=_0x3af115[_0x9726('0x23')]({'plain':!![]});var _0x12b5ce=_0x9726('0x24');return db[_0x9726('0x25')][_0x9726('0x26')]({'where':{'type':_0x12b5ce,'resourceId':_0x5caecb['id']}})[_0x9726('0x22')](function(){return _0x3af115;});})[_0x9726('0x22')](function(){_0x4818e6[_0x9726('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55b1d6,_0x39a37c){return function(_0x464857){if(!_0x464857){_0x55b1d6['sendStatus'](0x194);}return _0x464857;};}function handleError(_0x5b7da3,_0x187ef5){_0x187ef5=_0x187ef5||0x1f4;return function(_0x4ed1df){logger[_0x9726('0x27')](_0x4ed1df['stack']);if(_0x4ed1df[_0x9726('0x28')]){delete _0x4ed1df[_0x9726('0x28')];}_0x5b7da3['status'](_0x187ef5)['send'](_0x4ed1df);};}exports['index']=function(_0xaad34f,_0x5d67d0){var _0x5af9ee={},_0x1f3519={},_0x53476f={'count':0x0,'rows':[]};var _0x69a222=_[_0x9726('0x29')](db[_0x9726('0x2a')][_0x9726('0x2b')],function(_0x12718e){return{'name':_0x12718e['fieldName'],'type':_0x12718e[_0x9726('0x2c')]['key']};});_0x1f3519[_0x9726('0x2d')]=_['map'](_0x69a222,_0x9726('0x28'));_0x1f3519[_0x9726('0x2e')]=_[_0x9726('0x2f')](_0xaad34f[_0x9726('0x2e')]);_0x1f3519['filters']=_[_0x9726('0x30')](_0x1f3519[_0x9726('0x2d')],_0x1f3519[_0x9726('0x2e')]);_0x5af9ee[_0x9726('0x31')]=_[_0x9726('0x30')](_0x1f3519[_0x9726('0x2d')],qs['fields'](_0xaad34f[_0x9726('0x2e')][_0x9726('0x32')]));_0x5af9ee[_0x9726('0x31')]=_0x5af9ee[_0x9726('0x31')][_0x9726('0x33')]?_0x5af9ee[_0x9726('0x31')]:_0x1f3519[_0x9726('0x2d')];if(!_0xaad34f[_0x9726('0x2e')][_0x9726('0x34')](_0x9726('0x35'))){_0x5af9ee['limit']=qs[_0x9726('0x1c')](_0xaad34f[_0x9726('0x2e')][_0x9726('0x1c')]);_0x5af9ee['offset']=qs[_0x9726('0x1a')](_0xaad34f[_0x9726('0x2e')][_0x9726('0x1a')]);}_0x5af9ee['order']=qs[_0x9726('0x36')](_0xaad34f[_0x9726('0x2e')][_0x9726('0x36')]);_0x5af9ee[_0x9726('0x37')]=qs[_0x9726('0x38')](_['pick'](_0xaad34f[_0x9726('0x2e')],_0x1f3519[_0x9726('0x38')]),_0x69a222);if(_0xaad34f[_0x9726('0x2e')][_0x9726('0x39')]){_0x5af9ee[_0x9726('0x37')]=_[_0x9726('0x3a')](_0x5af9ee[_0x9726('0x37')],{'$or':_[_0x9726('0x29')](_0x69a222,function(_0x488204){if(_0x488204[_0x9726('0x2c')]!==_0x9726('0x3b')){var _0x1c2f18={};_0x1c2f18[_0x488204['name']]={'$like':'%'+_0xaad34f[_0x9726('0x2e')][_0x9726('0x39')]+'%'};return _0x1c2f18;}})});}_0x5af9ee=_[_0x9726('0x3a')]({},_0x5af9ee,_0xaad34f[_0x9726('0x3c')]);var _0xa6aeb1={'where':_0x5af9ee[_0x9726('0x37')]};return db[_0x9726('0x2a')][_0x9726('0x1d')](_0xa6aeb1)[_0x9726('0x22')](function(_0x55bdbb){_0x53476f[_0x9726('0x1d')]=_0x55bdbb;if(_0xaad34f[_0x9726('0x2e')][_0x9726('0x3d')]){_0x5af9ee[_0x9726('0x3e')]=[{'all':!![]}];}return db['Schedule'][_0x9726('0x3f')](_0x5af9ee);})[_0x9726('0x22')](function(_0xf50d7b){_0x53476f[_0x9726('0x40')]=_0xf50d7b;return _0x53476f;})[_0x9726('0x22')](respondWithFilteredResult(_0x5d67d0,_0x5af9ee))['catch'](handleError(_0x5d67d0,null));};exports[_0x9726('0x41')]=function(_0x9e1c93,_0x2df0f6){var _0x4c0f56={'raw':![],'where':{'id':_0x9e1c93[_0x9726('0x42')]['id']}},_0x29fc4d={};_0x29fc4d[_0x9726('0x2d')]=_[_0x9726('0x2f')](db[_0x9726('0x2a')][_0x9726('0x2b')]);_0x29fc4d['query']=_[_0x9726('0x2f')](_0x9e1c93[_0x9726('0x2e')]);_0x29fc4d[_0x9726('0x38')]=_[_0x9726('0x30')](_0x29fc4d[_0x9726('0x2d')],_0x29fc4d[_0x9726('0x2e')]);_0x4c0f56['attributes']=_[_0x9726('0x30')](_0x29fc4d[_0x9726('0x2d')],qs['fields'](_0x9e1c93['query'][_0x9726('0x32')]));_0x4c0f56[_0x9726('0x31')]=_0x4c0f56[_0x9726('0x31')]['length']?_0x4c0f56[_0x9726('0x31')]:_0x29fc4d['model'];if(_0x9e1c93[_0x9726('0x2e')][_0x9726('0x3d')]){_0x4c0f56['include']=[{'all':!![]}];}_0x4c0f56=_['merge']({},_0x4c0f56,_0x9e1c93['options']);return db[_0x9726('0x2a')][_0x9726('0x43')](_0x4c0f56)['then'](handleEntityNotFound(_0x2df0f6,null))[_0x9726('0x22')](respondWithResult(_0x2df0f6,null))[_0x9726('0x44')](handleError(_0x2df0f6,null));};exports[_0x9726('0x45')]=function(_0xe9a757,_0x179add){return db[_0x9726('0x2a')][_0x9726('0x45')](_0xe9a757[_0x9726('0x46')],{})[_0x9726('0x22')](function(_0x17528f){var _0x246f9c=_0xe9a757[_0x9726('0x47')]['get']({'plain':!![]});if(!_0x246f9c)throw new Error(_0x9726('0x48'));if(_0x246f9c[_0x9726('0x49')]===_0x9726('0x47')){var _0x327e2b=_0x17528f[_0x9726('0x23')]({'plain':!![]});var _0xcdf4d9=_0x9726('0x24');return db[_0x9726('0x4a')][_0x9726('0x43')]({'where':{'name':_0xcdf4d9,'userProfileId':_0x246f9c['userProfileId']},'raw':!![]})[_0x9726('0x22')](function(_0x3edf1c){if(_0x3edf1c&&_0x3edf1c['autoAssociation']===0x0){return db[_0x9726('0x25')]['create']({'name':_0x327e2b[_0x9726('0x28')],'resourceId':_0x327e2b['id'],'type':_0x3edf1c['name'],'sectionId':_0x3edf1c['id']},{})[_0x9726('0x22')](function(){return _0x17528f;});}else{return _0x17528f;}})[_0x9726('0x44')](function(_0x3d3860){logger[_0x9726('0x27')](_0x9726('0x4b'),_0x3d3860);throw _0x3d3860;});}return _0x17528f;})[_0x9726('0x22')](respondWithResult(_0x179add,0xc9))[_0x9726('0x44')](handleError(_0x179add,null));};exports['update']=function(_0x226ccf,_0x365227){if(_0x226ccf[_0x9726('0x46')]['id']){delete _0x226ccf['body']['id'];}return db[_0x9726('0x2a')][_0x9726('0x43')]({'where':{'id':_0x226ccf[_0x9726('0x42')]['id']}})[_0x9726('0x22')](handleEntityNotFound(_0x365227,null))['then'](saveUpdates(_0x226ccf[_0x9726('0x46')],null))['then'](respondWithResult(_0x365227,null))['catch'](handleError(_0x365227,null));};exports[_0x9726('0x26')]=function(_0x58ff96,_0x5156d5){return db['Schedule'][_0x9726('0x43')]({'where':{'id':_0x58ff96[_0x9726('0x42')]['id']}})[_0x9726('0x22')](handleEntityNotFound(_0x5156d5,null))[_0x9726('0x22')](removeEntity(_0x5156d5,null))[_0x9726('0x44')](handleError(_0x5156d5,null));};exports['run']=function(_0x14466c,_0x20da6a,_0x20b552){var _0x50c4ec=require('../../config/schedule');return db['Schedule'][_0x9726('0x43')]({'where':{'id':_0x14466c[_0x9726('0x42')]['id']},'raw':!![]})[_0x9726('0x22')](handleEntityNotFound(_0x20da6a,null))[_0x9726('0x22')](function(){_0x50c4ec[_0x9726('0x4c')](_0x14466c[_0x9726('0x42')]['id']);})['then'](respondWithStatusCode(_0x20da6a,null))['catch'](handleError(_0x20da6a,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index aeba034..be751e6 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 _0xf7a7=['path','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','bluebird'];(function(_0x5ae3d8,_0x5ed67f){var _0x34723d=function(_0x26a985){while(--_0x26a985){_0x5ae3d8['push'](_0x5ae3d8['shift']());}};_0x34723d(++_0x5ed67f);}(_0xf7a7,0xc2));var _0x7f7a=function(_0x357b45,_0x3d3e85){_0x357b45=_0x357b45-0x0;var _0x3182bf=_0xf7a7[_0x357b45];return _0x3182bf;};'use strict';var _=require(_0x7f7a('0x0'));var util=require(_0x7f7a('0x1'));var logger=require(_0x7f7a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7f7a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f7a('0x4'));var rimraf=require(_0x7f7a('0x5'));var config=require(_0x7f7a('0x6'));var attributes=require(_0x7f7a('0x7'));module[_0x7f7a('0x8')]=function(_0x4ef92d,_0x48765f){return _0x4ef92d[_0x7f7a('0x9')](_0x7f7a('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabd8=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x1a8651,_0x5252e4){var _0x50984b=function(_0x37ebfb){while(--_0x37ebfb){_0x1a8651['push'](_0x1a8651['shift']());}};_0x50984b(++_0x5252e4);}(_0xabd8,0x1b5));var _0x8abd=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0xabd8[_0x22868f];return _0x97bc75;};'use strict';var _=require(_0x8abd('0x0'));var util=require(_0x8abd('0x1'));var logger=require(_0x8abd('0x2'))(_0x8abd('0x3'));var moment=require(_0x8abd('0x4'));var BPromise=require(_0x8abd('0x5'));var rp=require(_0x8abd('0x6'));var fs=require('fs');var path=require(_0x8abd('0x7'));var rimraf=require(_0x8abd('0x8'));var config=require(_0x8abd('0x9'));var attributes=require(_0x8abd('0xa'));module['exports']=function(_0x9a703c,_0x38f932){return _0x9a703c[_0x8abd('0xb')](_0x8abd('0xc'),attributes,{'tableName':_0x8abd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 398dc5e..fa36d14 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 _0xeb10=['code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xeb10,0xe6));var _0x0eb1=function(_0x2f3b04,_0x272732){_0x2f3b04=_0x2f3b04-0x0;var _0x15471b=_0xeb10[_0x2f3b04];return _0x15471b;};'use strict';var _=require(_0x0eb1('0x0'));var util=require(_0x0eb1('0x1'));var moment=require(_0x0eb1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0eb1('0x3'));var fs=require('fs');var Redis=require(_0x0eb1('0x4'));var db=require(_0x0eb1('0x5'))['db'];var utils=require(_0x0eb1('0x6'));var logger=require(_0x0eb1('0x7'))(_0x0eb1('0x8'));var config=require(_0x0eb1('0x9'));var jayson=require(_0x0eb1('0xa'));var client=jayson[_0x0eb1('0xb')][_0x0eb1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37cd2a,_0x4e4996,_0x9c0b3a){return new BPromise(function(_0x26ae15,_0xd95a61){return client[_0x0eb1('0xd')](_0x37cd2a,_0x9c0b3a)[_0x0eb1('0xe')](function(_0x4122b4){logger[_0x0eb1('0xf')]('Schedule,\x20%s,\x20%s',_0x4e4996,'request\x20sent');logger['debug'](_0x0eb1('0x10'),_0x4e4996,_0x0eb1('0x11'),JSON[_0x0eb1('0x12')](_0x4122b4));if(_0x4122b4['error']){if(_0x4122b4[_0x0eb1('0x13')][_0x0eb1('0x14')]===0x1f4){logger[_0x0eb1('0x13')](_0x0eb1('0x15'),_0x4e4996,_0x4122b4['error']['message']);return _0xd95a61(_0x4122b4[_0x0eb1('0x13')][_0x0eb1('0x16')]);}logger[_0x0eb1('0x13')](_0x0eb1('0x15'),_0x4e4996,_0x4122b4[_0x0eb1('0x13')][_0x0eb1('0x16')]);return _0x26ae15(_0x4122b4['error'][_0x0eb1('0x16')]);}else{logger[_0x0eb1('0xf')](_0x0eb1('0x15'),_0x4e4996,'request\x20sent');_0x26ae15(_0x4122b4[_0x0eb1('0x17')][_0x0eb1('0x16')]);}})[_0x0eb1('0x18')](function(_0x4b579e){logger[_0x0eb1('0x13')](_0x0eb1('0x15'),_0x4e4996,_0x4b579e);_0xd95a61(_0x4b579e);});});} \ No newline at end of file +var _0x45b1=['rpc','jayson/promise','request','then','info','debug','request\x20sent','stringify','error','Schedule,\x20%s,\x20%s','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x45b1,0x174));var _0x145b=function(_0xa5df15,_0x5c59c0){_0xa5df15=_0xa5df15-0x0;var _0x2cc9b7=_0x45b1[_0xa5df15];return _0x2cc9b7;};'use strict';var _=require(_0x145b('0x0'));var util=require('util');var moment=require(_0x145b('0x1'));var BPromise=require('bluebird');var rs=require(_0x145b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x145b('0x3'))['db'];var utils=require(_0x145b('0x4'));var logger=require(_0x145b('0x5'))(_0x145b('0x6'));var config=require('../../config/environment');var jayson=require(_0x145b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cdfc7,_0x21558e,_0x514274){return new BPromise(function(_0xe5afa0,_0x49fe6c){return client[_0x145b('0x8')](_0x4cdfc7,_0x514274)[_0x145b('0x9')](function(_0xed56a9){logger[_0x145b('0xa')]('Schedule,\x20%s,\x20%s',_0x21558e,'request\x20sent');logger[_0x145b('0xb')]('Schedule,\x20%s,\x20%s,\x20%s',_0x21558e,_0x145b('0xc'),JSON[_0x145b('0xd')](_0xed56a9));if(_0xed56a9[_0x145b('0xe')]){if(_0xed56a9[_0x145b('0xe')]['code']===0x1f4){logger[_0x145b('0xe')](_0x145b('0xf'),_0x21558e,_0xed56a9[_0x145b('0xe')]['message']);return _0x49fe6c(_0xed56a9[_0x145b('0xe')][_0x145b('0x10')]);}logger[_0x145b('0xe')](_0x145b('0xf'),_0x21558e,_0xed56a9[_0x145b('0xe')][_0x145b('0x10')]);return _0xe5afa0(_0xed56a9[_0x145b('0xe')]['message']);}else{logger[_0x145b('0xa')]('Schedule,\x20%s,\x20%s',_0x21558e,_0x145b('0xc'));_0xe5afa0(_0xed56a9['result'][_0x145b('0x10')]);}})[_0x145b('0x11')](function(_0x308c30){logger[_0x145b('0xe')](_0x145b('0xf'),_0x21558e,_0x308c30);_0x49fe6c(_0x308c30);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index dc50eeb..53a2c80 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 _0x416f=['get','isAuthenticated','index','/describe','describe','show','create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x27e864,_0x391b19){var _0x4c1c5c=function(_0x48ce0a){while(--_0x48ce0a){_0x27e864['push'](_0x27e864['shift']());}};_0x4c1c5c(++_0x391b19);}(_0x416f,0x131));var _0xf416=function(_0x45e66d,_0x1b334e){_0x45e66d=_0x45e66d-0x0;var _0x298498=_0x416f[_0x45e66d];return _0x298498;};'use strict';var multer=require(_0xf416('0x0'));var util=require(_0xf416('0x1'));var path=require('path');var timeout=require(_0xf416('0x2'));var express=require(_0xf416('0x3'));var router=express[_0xf416('0x4')]();var fs_extra=require(_0xf416('0x5'));var auth=require(_0xf416('0x6'));var interaction=require(_0xf416('0x7'));var config=require(_0xf416('0x8'));var controller=require(_0xf416('0x9'));router[_0xf416('0xa')]('/',auth[_0xf416('0xb')](),controller[_0xf416('0xc')]);router[_0xf416('0xa')](_0xf416('0xd'),auth['isAuthenticated'](),controller[_0xf416('0xe')]);router[_0xf416('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf416('0xf')]);router[_0xf416('0xa')]('/:id/download',auth[_0xf416('0xb')](),controller['download']);router['post']('/',auth[_0xf416('0xb')](),controller[_0xf416('0x10')]);router[_0xf416('0x11')]('/:id',auth[_0xf416('0xb')](),controller['update']);router['delete'](_0xf416('0x12'),auth[_0xf416('0xb')](),controller[_0xf416('0x13')]);module[_0xf416('0x14')]=router; \ No newline at end of file +var _0xbee7=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/:id','show','download','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service'];(function(_0x5acc5a,_0x59b23a){var _0x449ee7=function(_0x47f1e6){while(--_0x47f1e6){_0x5acc5a['push'](_0x5acc5a['shift']());}};_0x449ee7(++_0x59b23a);}(_0xbee7,0x9a));var _0x7bee=function(_0x2c3ead,_0x2c60d6){_0x2c3ead=_0x2c3ead-0x0;var _0x39616e=_0xbee7[_0x2c3ead];return _0x39616e;};'use strict';var multer=require(_0x7bee('0x0'));var util=require(_0x7bee('0x1'));var path=require(_0x7bee('0x2'));var timeout=require('connect-timeout');var express=require(_0x7bee('0x3'));var router=express['Router']();var fs_extra=require(_0x7bee('0x4'));var auth=require(_0x7bee('0x5'));var interaction=require(_0x7bee('0x6'));var config=require(_0x7bee('0x7'));var controller=require(_0x7bee('0x8'));router[_0x7bee('0x9')]('/',auth[_0x7bee('0xa')](),controller[_0x7bee('0xb')]);router[_0x7bee('0x9')]('/describe',auth[_0x7bee('0xa')](),controller['describe']);router[_0x7bee('0x9')](_0x7bee('0xc'),auth[_0x7bee('0xa')](),controller[_0x7bee('0xd')]);router[_0x7bee('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x7bee('0xe')]);router['post']('/',auth[_0x7bee('0xa')](),controller[_0x7bee('0xf')]);router[_0x7bee('0x10')](_0x7bee('0xc'),auth['isAuthenticated'](),controller[_0x7bee('0x11')]);router[_0x7bee('0x12')](_0x7bee('0xc'),auth[_0x7bee('0xa')](),controller['destroy']);module[_0x7bee('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 58a74ed..25254af 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 _0xe8e8=['sequelize','moment','exports','VIRTUAL','extname','value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x2cd225,_0x59e91e){_0x2cd225=_0x2cd225-0x0;var _0x58f005=_0xe8e8[_0x2cd225];return _0x58f005;};'use strict';var Sequelize=require(_0x8e8e('0x0'));var moment=require(_0x8e8e('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x8e8e('0x2')]={'format':{'type':Sequelize[_0x8e8e('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x8e8e('0x4')](this['getDataValue'](_0x8e8e('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x8e8e('0x6')]},'channel':{'type':Sequelize[_0x8e8e('0x6')]},'value':{'type':Sequelize[_0x8e8e('0x6')],'set':function(_0x559147){var _0x2d5ad4=_0x559147['replace'](/\\/g,'/');this[_0x8e8e('0x7')](_0x8e8e('0x5'),_0x2d5ad4);}},'rating':{'type':Sequelize[_0x8e8e('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8e8e('0x8')],'set':function(_0x40be2d){this[_0x8e8e('0x7')](_0x8e8e('0x9'),moment()['subtract'](_0x40be2d,'ms'));this[_0x8e8e('0x7')](_0x8e8e('0xa'),moment());this[_0x8e8e('0x7')](_0x8e8e('0xb'),_0x40be2d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0x9')))[_0x8e8e('0xd')](_0x8e8e('0xe'))[_0x8e8e('0xf')]();}},'closedAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0xa')))[_0x8e8e('0xd')](_0x8e8e('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')]('createdAt'))[_0x8e8e('0xd')](_0x8e8e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0x11')))[_0x8e8e('0xd')](_0x8e8e('0xe'))[_0x8e8e('0xf')]();}}}; \ No newline at end of file +var _0x65c9=['closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x65c9,0x182));var _0x965c=function(_0x3d39b9,_0x268f07){_0x3d39b9=_0x3d39b9-0x0;var _0x132dbd=_0x65c9[_0x3d39b9];return _0x132dbd;};'use strict';var Sequelize=require(_0x965c('0x0'));var moment=require(_0x965c('0x1'));var path=require('path');var config=require(_0x965c('0x2'));module[_0x965c('0x3')]={'format':{'type':Sequelize[_0x965c('0x4')],'get':function(){return this[_0x965c('0x5')](_0x965c('0x6'))?path[_0x965c('0x7')](this[_0x965c('0x5')](_0x965c('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x965c('0x8')]},'channel':{'type':Sequelize[_0x965c('0x8')]},'value':{'type':Sequelize[_0x965c('0x8')],'set':function(_0x849260){var _0x5ec702=_0x849260[_0x965c('0x9')](/\\/g,'/');this[_0x965c('0xa')](_0x965c('0x6'),_0x5ec702);}},'rating':{'type':Sequelize[_0x965c('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x965c('0xb')],'set':function(_0x26d859){this[_0x965c('0xa')]('startedAt',moment()[_0x965c('0xc')](_0x26d859,'ms'));this[_0x965c('0xa')](_0x965c('0xd'),moment());this[_0x965c('0xa')](_0x965c('0xe'),_0x26d859);}},'startedAt':{'type':Sequelize[_0x965c('0xf')],'get':function(){return moment(this[_0x965c('0x5')](_0x965c('0x10')))[_0x965c('0x11')](_0x965c('0x12'))[_0x965c('0x13')]();}},'closedAt':{'type':Sequelize[_0x965c('0xf')],'get':function(){return moment(this[_0x965c('0x5')](_0x965c('0xd')))['format'](_0x965c('0x12'))[_0x965c('0x13')]();}},'createdAt':{'type':Sequelize[_0x965c('0xf')],'get':function(){return moment(this['getDataValue'](_0x965c('0x14')))[_0x965c('0x11')](_0x965c('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x965c('0xf')],'get':function(){return moment(this['getDataValue']('updatedAt'))['format'](_0x965c('0x12'))[_0x965c('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 82bd197..ddae80f 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 _0xb458=['differenceBy','format','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','ScreenRecording','includeAll','rows','catch','show','params','include','create','body','createdAt','closedAt','find','describe','download','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','ScreenRecording\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','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','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x18102f,_0x1c8cb6){var _0x1ad9c0=function(_0x2a2d67){while(--_0x2a2d67){_0x18102f['push'](_0x18102f['shift']());}};_0x1ad9c0(++_0x1c8cb6);}(_0xb458,0x103));var _0x8b45=function(_0x1c384f,_0x5c4bbe){_0x1c384f=_0x1c384f-0x0;var _0x4976f1=_0xb458[_0x1c384f];return _0x4976f1;};'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['ScreenRecording'][_0x8b45('0x2a')],function(_0x36db96){return{'name':_0x36db96[_0x8b45('0x2b')],'type':_0x36db96[_0x8b45('0x2c')][_0x8b45('0x2d')]};});_0xf21bd1[_0x8b45('0x2e')]=_[_0x8b45('0x2f')](_[_0x8b45('0x29')](_0x1ba2d4,'name'),[_0x8b45('0x30')]);_0xf21bd1[_0x8b45('0x31')]=_[_0x8b45('0x32')](_0x461017[_0x8b45('0x31')]);_0xf21bd1[_0x8b45('0x33')]=_['intersection'](_0xf21bd1[_0x8b45('0x2e')],_0xf21bd1['query']);_0x1733a7['attributes']=_[_0x8b45('0x34')](_0xf21bd1[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x461017[_0x8b45('0x31')][_0x8b45('0x35')]));_0x1733a7[_0x8b45('0x36')]=_0x1733a7['attributes'][_0x8b45('0x37')]?_0x1733a7[_0x8b45('0x36')]:_0xf21bd1[_0x8b45('0x2e')];if(!_0x461017[_0x8b45('0x31')]['hasOwnProperty'](_0x8b45('0x38'))){_0x1733a7[_0x8b45('0x1c')]=qs[_0x8b45('0x1c')](_0x461017['query'][_0x8b45('0x1c')]);_0x1733a7[_0x8b45('0x1a')]=qs[_0x8b45('0x1a')](_0x461017['query'][_0x8b45('0x1a')]);}_0x1733a7[_0x8b45('0x39')]=qs[_0x8b45('0x3a')](_0x461017[_0x8b45('0x31')]['sort']);_0x1733a7[_0x8b45('0x3b')]=qs[_0x8b45('0x33')](_[_0x8b45('0x3c')](_0x461017[_0x8b45('0x31')],_0xf21bd1[_0x8b45('0x33')]),_0x1ba2d4);if(_0x461017[_0x8b45('0x31')]['filter']){_0x1733a7['where']=_[_0x8b45('0x3d')](_0x1733a7[_0x8b45('0x3b')],{'$or':_[_0x8b45('0x29')](_0x1ba2d4,function(_0x12d4b2){if(_0x12d4b2[_0x8b45('0x2c')]!=='VIRTUAL'){var _0x120068={};_0x120068[_0x12d4b2['name']]={'$like':'%'+_0x461017[_0x8b45('0x31')][_0x8b45('0x3e')]+'%'};return _0x120068;}})});}_0x1733a7=_[_0x8b45('0x3d')]({},_0x1733a7,_0x461017[_0x8b45('0x3f')]);var _0x254f17={'where':_0x1733a7[_0x8b45('0x3b')]};return db[_0x8b45('0x40')][_0x8b45('0x1d')](_0x254f17)[_0x8b45('0x23')](function(_0x2ca00e){_0x339c73[_0x8b45('0x1d')]=_0x2ca00e;if(_0x461017['query'][_0x8b45('0x41')]){_0x1733a7['include']=[{'all':!![]}];}return db[_0x8b45('0x40')]['findAll'](_0x1733a7);})[_0x8b45('0x23')](function(_0x224c45){_0x339c73[_0x8b45('0x42')]=_0x224c45;return _0x339c73;})[_0x8b45('0x23')](respondWithFilteredResult(_0x234f62,_0x1733a7))[_0x8b45('0x43')](handleError(_0x234f62,null));};exports[_0x8b45('0x44')]=function(_0x58e663,_0x6fbca4){var _0x5916c7={'raw':![],'where':{'id':_0x58e663[_0x8b45('0x45')]['id']}},_0x4c56c8={};_0x4c56c8[_0x8b45('0x2e')]=_[_0x8b45('0x32')](db['ScreenRecording'][_0x8b45('0x2a')]);_0x4c56c8['query']=_[_0x8b45('0x32')](_0x58e663[_0x8b45('0x31')]);_0x4c56c8[_0x8b45('0x33')]=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],_0x4c56c8[_0x8b45('0x31')]);_0x5916c7['attributes']=_[_0x8b45('0x34')](_0x4c56c8[_0x8b45('0x2e')],qs[_0x8b45('0x35')](_0x58e663[_0x8b45('0x31')][_0x8b45('0x35')]));_0x5916c7[_0x8b45('0x36')]=_0x5916c7[_0x8b45('0x36')][_0x8b45('0x37')]?_0x5916c7[_0x8b45('0x36')]:_0x4c56c8[_0x8b45('0x2e')];if(_0x58e663[_0x8b45('0x31')][_0x8b45('0x41')]){_0x5916c7[_0x8b45('0x46')]=[{'all':!![]}];}_0x5916c7=_[_0x8b45('0x3d')]({},_0x5916c7,_0x58e663[_0x8b45('0x3f')]);return db[_0x8b45('0x40')]['find'](_0x5916c7)['then'](handleEntityNotFound(_0x6fbca4,null))['then'](respondWithResult(_0x6fbca4,null))[_0x8b45('0x43')](handleError(_0x6fbca4,null));};exports[_0x8b45('0x47')]=function(_0x3a1621,_0x473530){return db[_0x8b45('0x40')][_0x8b45('0x47')](_0x3a1621[_0x8b45('0x48')],{})[_0x8b45('0x23')](respondWithResult(_0x473530,0xc9))['catch'](handleError(_0x473530,null));};exports[_0x8b45('0x22')]=function(_0x5d5be2,_0x23b5c6){if(_0x5d5be2[_0x8b45('0x48')]['id']){delete _0x5d5be2[_0x8b45('0x48')]['id'];}delete _0x5d5be2[_0x8b45('0x48')]['duration'];delete _0x5d5be2[_0x8b45('0x48')][_0x8b45('0x49')];delete _0x5d5be2['body'][_0x8b45('0x4a')];delete _0x5d5be2[_0x8b45('0x48')]['value'];return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':{'id':_0x5d5be2[_0x8b45('0x45')]['id']}})[_0x8b45('0x23')](handleEntityNotFound(_0x23b5c6,null))[_0x8b45('0x23')](saveUpdates(_0x5d5be2[_0x8b45('0x48')],null))['then'](respondWithResult(_0x23b5c6,null))['catch'](handleError(_0x23b5c6,null));};exports[_0x8b45('0x4c')]=function(_0x2a2e59,_0x2d5b31){return db['ScreenRecording'][_0x8b45('0x4c')]()[_0x8b45('0x23')](respondWithResult(_0x2d5b31,null))[_0x8b45('0x43')](handleError(_0x2d5b31,null));};exports[_0x8b45('0x4d')]=function(_0x2d6b66,_0x597402,_0x34c05d){var _0xa92a05=require('../../components/encryptor');var _0x422da0=![];var _0x4c3f38={};if(_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]&&_0x2d6b66[_0x8b45('0x31')][_0x8b45('0x2c')]==='uniqueid'){_0x4c3f38[_0x8b45('0x4e')]=_0x2d6b66[_0x8b45('0x45')]['id'];}else{_0x4c3f38['id']=_0x2d6b66[_0x8b45('0x45')]['id'];}return db[_0x8b45('0x40')][_0x8b45('0x4b')]({'where':_0x4c3f38,'attributes':['id',_0x8b45('0x4f')],'raw':!![]})[_0x8b45('0x23')](handleEntityNotFound(_0x597402,null))[_0x8b45('0x23')](function(_0x446fe5){if(_0x446fe5){var _0x5ba878=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x446fe5[_0x8b45('0x4f')]);var _0x1851c2=util['format'](_0x8b45('0x53'),_0x5ba878);if(fs[_0x8b45('0x54')](_0x1851c2)){_0x422da0=!![];return _0xa92a05[_0x8b45('0x55')](_0x1851c2,_0x5ba878,config['secrets'][_0x8b45('0x56')])[_0x8b45('0x23')](function(){return _0x446fe5;});}return _0x446fe5;}})[_0x8b45('0x23')](function(_0x9eacc1){if(_0x9eacc1){var _0x5795ca=path[_0x8b45('0x50')](config[_0x8b45('0x51')],_0x8b45('0x52'),_0x9eacc1[_0x8b45('0x4f')]);if(!fs['existsSync'](_0x5795ca)){throw new db[(_0x8b45('0x57'))][(_0x8b45('0x58'))](_0x8b45('0x59'));}if(_0x9eacc1[_0x8b45('0x5a')]){return _0x597402[_0x8b45('0x4d')](_0x5795ca,_0x9eacc1['filename']+path[_0x8b45('0x5b')](_0x5795ca),function(){if(_0x422da0){fs['unlink'](_0x5795ca);}});}else{return _0x597402[_0x8b45('0x4d')](_0x5795ca,function(_0x2f7ab0){if(_0x422da0){fs[_0x8b45('0x5c')](_0x5795ca);}});}}})[_0x8b45('0x43')](function(_0x6a77bd){if(_0x6a77bd[_0x8b45('0x5d')]==='ScreenRecording\x20not\x20found'){_0x597402['status'](0x194)[_0x8b45('0x27')](_0x8b45('0x5e'));}else{return handleError(_0x597402,null);}});};exports['destroy']=function(_0x461c83,_0x239330){return db[_0x8b45('0x40')]['find']({'where':{'id':_0x461c83['params']['id']}})[_0x8b45('0x23')](function(_0x8e5a41){if(_['isNil'](_0x8e5a41)){throw new ReferenceError(_0x8b45('0x5f'));}return _0x8e5a41;})['then'](function(_0xf1ab37){var _0x560c51=path['join'](config[_0x8b45('0x51')],_0x8b45('0x52'),_0xf1ab37['value']);logger[_0x8b45('0x60')](_0x8b45('0x61'),_0x560c51);if(!_[_0x8b45('0x62')](_0xf1ab37[_0x8b45('0x4f')])&&fs[_0x8b45('0x54')](_0x560c51)){logger['info'](_0x8b45('0x63')+_0x560c51+_0x8b45('0x64'));fs[_0x8b45('0x65')](_0x560c51);}_0x560c51=_0x560c51+'.cypher';if(!_['isNil'](_0xf1ab37[_0x8b45('0x4f')])&&fs['existsSync'](_0x560c51)){logger[_0x8b45('0x60')]('File:\x20\x22'+_0x560c51+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x560c51);}return _0xf1ab37;})[_0x8b45('0x23')](function(_0x4df581){if(!_0x4df581)throw new InternalError();return _0x4df581[_0x8b45('0x24')]();})[_0x8b45('0x23')](function(){_0x239330['status'](0xcc)[_0x8b45('0x18')]();})[_0x8b45('0x43')](handleError(_0x239330,null));}; \ No newline at end of file +var _0xd6d6=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','find','create','body','duration','createdAt','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x69929e,_0x399ff2){var _0x48e437=function(_0x222a64){while(--_0x222a64){_0x69929e['push'](_0x69929e['shift']());}};_0x48e437(++_0x399ff2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x203331,_0x228451){_0x203331=_0x203331-0x0;var _0x589a67=_0xd6d6[_0x203331];return _0x589a67;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];function respondWithStatusCode(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xcc;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0x19')](_0xe61c36);}return _0x32146d[_0x6d6d('0x1a')](_0xe61c36)[_0x6d6d('0x1b')]();};}function respondWithResult(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0xc8;return function(_0xd09ea7){if(_0xd09ea7){return _0x2cb2dd[_0x6d6d('0x1a')](_0x5f4154)[_0x6d6d('0x1c')](_0xd09ea7);}};}function respondWithFilteredResult(_0xa3b05d,_0x29cbd8){return function(_0x5d80c0){if(_0x5d80c0){var _0x2e6fdb=typeof _0x29cbd8['offset']===_0x6d6d('0x1d')&&typeof _0x29cbd8[_0x6d6d('0x1e')]===_0x6d6d('0x1d');var _0x4bb3d1=_0x5d80c0['count'];var _0x9e1e18=_0x2e6fdb?0x0:_0x29cbd8[_0x6d6d('0x1f')];var _0x2b59d4=_0x2e6fdb?_0x5d80c0[_0x6d6d('0x20')]:_0x29cbd8['offset']+_0x29cbd8['limit'];var _0x474873;if(_0x2b59d4>=_0x4bb3d1){_0x2b59d4=_0x4bb3d1;_0x474873=0xc8;}else{_0x474873=0xce;}_0xa3b05d['status'](_0x474873);return _0xa3b05d[_0x6d6d('0x21')](_0x6d6d('0x22'),_0x9e1e18+'-'+_0x2b59d4+'/'+_0x4bb3d1)[_0x6d6d('0x1c')](_0x5d80c0);}return null;};}function patchUpdates(_0x450352){return function(_0x40d35b){try{jsonpatch[_0x6d6d('0x23')](_0x40d35b,_0x450352,!![]);}catch(_0x164c67){return BPromise[_0x6d6d('0x24')](_0x164c67);}return _0x40d35b[_0x6d6d('0x25')]();};}function saveUpdates(_0x6f64e3,_0x24b10d){return function(_0x6e58e3){if(_0x6e58e3){return _0x6e58e3[_0x6d6d('0x26')](_0x6f64e3)[_0x6d6d('0x27')](function(_0x1f7f88){return _0x1f7f88;});}return null;};}function removeEntity(_0x25a02e,_0xced622){return function(_0x583b10){if(_0x583b10){return _0x583b10[_0x6d6d('0x28')]()[_0x6d6d('0x27')](function(){_0x25a02e[_0x6d6d('0x1a')](0xcc)[_0x6d6d('0x1b')]();});}};}function handleEntityNotFound(_0xf0df7f,_0x12fab2){return function(_0x554f8e){if(!_0x554f8e){_0xf0df7f[_0x6d6d('0x19')](0x194);}return _0x554f8e;};}function handleError(_0x2b5e31,_0x235451){_0x235451=_0x235451||0x1f4;return function(_0x126ac8){logger[_0x6d6d('0x29')](_0x126ac8[_0x6d6d('0x2a')]);if(_0x126ac8[_0x6d6d('0x2b')]){delete _0x126ac8['name'];}_0x2b5e31[_0x6d6d('0x1a')](_0x235451)[_0x6d6d('0x2c')](_0x126ac8);};}exports['index']=function(_0x553645,_0x3edcce){var _0x5273cd={},_0x8a9a84={},_0x57341f={'count':0x0,'rows':[]};var _0xde3272=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x64d1f7){return{'name':_0x64d1f7[_0x6d6d('0x30')],'type':_0x64d1f7[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x8a9a84[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](_['map'](_0xde3272,_0x6d6d('0x2b')),['format']);_0x8a9a84[_0x6d6d('0x35')]=_[_0x6d6d('0x36')](_0x553645[_0x6d6d('0x35')]);_0x8a9a84[_0x6d6d('0x37')]=_['intersection'](_0x8a9a84[_0x6d6d('0x33')],_0x8a9a84['query']);_0x5273cd[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x8a9a84['model'],qs[_0x6d6d('0x3a')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3a')]));_0x5273cd[_0x6d6d('0x38')]=_0x5273cd[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x5273cd[_0x6d6d('0x38')]:_0x8a9a84[_0x6d6d('0x33')];if(!_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3c')](_0x6d6d('0x3d'))){_0x5273cd[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x553645[_0x6d6d('0x35')]['limit']);_0x5273cd[_0x6d6d('0x1f')]=qs[_0x6d6d('0x1f')](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x1f')]);}_0x5273cd['order']=qs['sort'](_0x553645[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x5273cd[_0x6d6d('0x3f')]=qs['filters'](_[_0x6d6d('0x40')](_0x553645[_0x6d6d('0x35')],_0x8a9a84[_0x6d6d('0x37')]),_0xde3272);if(_0x553645[_0x6d6d('0x35')]['filter']){_0x5273cd['where']=_['merge'](_0x5273cd[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0xde3272,function(_0x33c8f2){if(_0x33c8f2[_0x6d6d('0x31')]!=='VIRTUAL'){var _0x253416={};_0x253416[_0x33c8f2[_0x6d6d('0x2b')]]={'$like':'%'+_0x553645[_0x6d6d('0x35')][_0x6d6d('0x41')]+'%'};return _0x253416;}})});}_0x5273cd=_[_0x6d6d('0x42')]({},_0x5273cd,_0x553645[_0x6d6d('0x43')]);var _0x4b457d={'where':_0x5273cd[_0x6d6d('0x3f')]};return db[_0x6d6d('0x2e')][_0x6d6d('0x20')](_0x4b457d)[_0x6d6d('0x27')](function(_0x32275b){_0x57341f[_0x6d6d('0x20')]=_0x32275b;if(_0x553645[_0x6d6d('0x35')]['includeAll']){_0x5273cd[_0x6d6d('0x44')]=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x5273cd);})[_0x6d6d('0x27')](function(_0xe1aa77){_0x57341f['rows']=_0xe1aa77;return _0x57341f;})[_0x6d6d('0x27')](respondWithFilteredResult(_0x3edcce,_0x5273cd))[_0x6d6d('0x46')](handleError(_0x3edcce,null));};exports['show']=function(_0x452de2,_0x50dc17){var _0x15bf62={'raw':![],'where':{'id':_0x452de2['params']['id']}},_0x43c03c={};_0x43c03c[_0x6d6d('0x33')]=_[_0x6d6d('0x36')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x43c03c[_0x6d6d('0x35')]=_['keys'](_0x452de2['query']);_0x43c03c[_0x6d6d('0x37')]=_['intersection'](_0x43c03c['model'],_0x43c03c[_0x6d6d('0x35')]);_0x15bf62[_0x6d6d('0x38')]=_[_0x6d6d('0x39')](_0x43c03c['model'],qs[_0x6d6d('0x3a')](_0x452de2['query'][_0x6d6d('0x3a')]));_0x15bf62[_0x6d6d('0x38')]=_0x15bf62[_0x6d6d('0x38')][_0x6d6d('0x3b')]?_0x15bf62[_0x6d6d('0x38')]:_0x43c03c[_0x6d6d('0x33')];if(_0x452de2[_0x6d6d('0x35')]['includeAll']){_0x15bf62[_0x6d6d('0x44')]=[{'all':!![]}];}_0x15bf62=_[_0x6d6d('0x42')]({},_0x15bf62,_0x452de2[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x47')](_0x15bf62)[_0x6d6d('0x27')](handleEntityNotFound(_0x50dc17,null))[_0x6d6d('0x27')](respondWithResult(_0x50dc17,null))[_0x6d6d('0x46')](handleError(_0x50dc17,null));};exports[_0x6d6d('0x48')]=function(_0x5e4c04,_0x4d78bb){return db[_0x6d6d('0x2e')][_0x6d6d('0x48')](_0x5e4c04[_0x6d6d('0x49')],{})[_0x6d6d('0x27')](respondWithResult(_0x4d78bb,0xc9))[_0x6d6d('0x46')](handleError(_0x4d78bb,null));};exports['update']=function(_0x47170d,_0x27b396){if(_0x47170d[_0x6d6d('0x49')]['id']){delete _0x47170d[_0x6d6d('0x49')]['id'];}delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4a')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4b')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4c')];delete _0x47170d[_0x6d6d('0x49')][_0x6d6d('0x4d')];return db['ScreenRecording'][_0x6d6d('0x47')]({'where':{'id':_0x47170d[_0x6d6d('0x4e')]['id']}})[_0x6d6d('0x27')](handleEntityNotFound(_0x27b396,null))[_0x6d6d('0x27')](saveUpdates(_0x47170d[_0x6d6d('0x49')],null))['then'](respondWithResult(_0x27b396,null))[_0x6d6d('0x46')](handleError(_0x27b396,null));};exports[_0x6d6d('0x4f')]=function(_0x45340b,_0x4e4c3e){return db['ScreenRecording'][_0x6d6d('0x4f')]()['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x46')](handleError(_0x4e4c3e,null));};exports[_0x6d6d('0x50')]=function(_0x32aaae,_0x268361,_0x4777a5){var _0x18e2de=require(_0x6d6d('0x51'));var _0x26c23a=![];var _0x1a8f33={};if(_0x32aaae[_0x6d6d('0x35')]['type']&&_0x32aaae[_0x6d6d('0x35')][_0x6d6d('0x31')]===_0x6d6d('0x52')){_0x1a8f33[_0x6d6d('0x52')]=_0x32aaae[_0x6d6d('0x4e')]['id'];}else{_0x1a8f33['id']=_0x32aaae[_0x6d6d('0x4e')]['id'];}return db[_0x6d6d('0x2e')]['find']({'where':_0x1a8f33,'attributes':['id','value'],'raw':!![]})[_0x6d6d('0x27')](handleEntityNotFound(_0x268361,null))[_0x6d6d('0x27')](function(_0x5cc644){if(_0x5cc644){var _0x3e98a0=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x5cc644[_0x6d6d('0x4d')]);var _0xc6b96e=util[_0x6d6d('0x56')](_0x6d6d('0x57'),_0x3e98a0);if(fs[_0x6d6d('0x58')](_0xc6b96e)){_0x26c23a=!![];return _0x18e2de[_0x6d6d('0x59')](_0xc6b96e,_0x3e98a0,config[_0x6d6d('0x5a')][_0x6d6d('0x5b')])[_0x6d6d('0x27')](function(){return _0x5cc644;});}return _0x5cc644;}})[_0x6d6d('0x27')](function(_0x3065ea){if(_0x3065ea){var _0x50d8dd=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],'server/files/screen_recordings',_0x3065ea[_0x6d6d('0x4d')]);if(!fs[_0x6d6d('0x58')](_0x50d8dd)){throw new db[(_0x6d6d('0x5c'))][(_0x6d6d('0x5d'))](_0x6d6d('0x5e'));}if(_0x3065ea[_0x6d6d('0x5f')]){return _0x268361[_0x6d6d('0x50')](_0x50d8dd,_0x3065ea[_0x6d6d('0x5f')]+path[_0x6d6d('0x60')](_0x50d8dd),function(){if(_0x26c23a){fs['unlink'](_0x50d8dd);}});}else{return _0x268361['download'](_0x50d8dd,function(_0x22c3a1){if(_0x26c23a){fs[_0x6d6d('0x61')](_0x50d8dd);}});}}})[_0x6d6d('0x46')](function(_0x5de33f){if(_0x5de33f['message']===_0x6d6d('0x5e')){_0x268361['status'](0x194)[_0x6d6d('0x2c')]('Not\x20found');}else{return handleError(_0x268361,null);}});};exports[_0x6d6d('0x28')]=function(_0x367a6f,_0x21f14c){return db[_0x6d6d('0x2e')][_0x6d6d('0x47')]({'where':{'id':_0x367a6f[_0x6d6d('0x4e')]['id']}})['then'](function(_0x41e576){if(_['isNil'](_0x41e576)){throw new ReferenceError(_0x6d6d('0x62'));}return _0x41e576;})['then'](function(_0x2a21d8){var _0x3e48f7=path[_0x6d6d('0x53')](config[_0x6d6d('0x54')],_0x6d6d('0x55'),_0x2a21d8[_0x6d6d('0x4d')]);logger[_0x6d6d('0x63')]('cancellazione\x20fisica\x20documento\x20%s',_0x3e48f7);if(!_['isNil'](_0x2a21d8[_0x6d6d('0x4d')])&&fs['existsSync'](_0x3e48f7)){logger[_0x6d6d('0x63')]('File:\x20\x22'+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}_0x3e48f7=_0x3e48f7+_0x6d6d('0x66');if(!_[_0x6d6d('0x67')](_0x2a21d8[_0x6d6d('0x4d')])&&fs[_0x6d6d('0x58')](_0x3e48f7)){logger['info'](_0x6d6d('0x68')+_0x3e48f7+_0x6d6d('0x64'));fs[_0x6d6d('0x65')](_0x3e48f7);}return _0x2a21d8;})[_0x6d6d('0x27')](function(_0x1ba731){if(!_0x1ba731)throw new InternalError();return _0x1ba731[_0x6d6d('0x28')]();})[_0x6d6d('0x27')](function(){_0x21f14c['status'](0xcc)[_0x6d6d('0x1b')]();})[_0x6d6d('0x46')](handleError(_0x21f14c,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 057672d..42f25d0 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 _0x1563=['../../config/logger','api','moment','path','rimraf','../../config/environment','./screenRecording.attributes','screen_recordings','interactionid','lodash'];(function(_0x44eb6b,_0x4f4686){var _0x5e29fb=function(_0x25dbc2){while(--_0x25dbc2){_0x44eb6b['push'](_0x44eb6b['shift']());}};_0x5e29fb(++_0x4f4686);}(_0x1563,0x1cb));var _0x3156=function(_0x56ca61,_0x187321){_0x56ca61=_0x56ca61-0x0;var _0x1e7bee=_0x1563[_0x56ca61];return _0x1e7bee;};'use strict';var _=require(_0x3156('0x0'));var util=require('util');var logger=require(_0x3156('0x1'))(_0x3156('0x2'));var moment=require(_0x3156('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3156('0x4'));var rimraf=require(_0x3156('0x5'));var config=require(_0x3156('0x6'));var attributes=require(_0x3156('0x7'));module['exports']=function(_0x193378,_0xcd92d2){return _0x193378['define']('ScreenRecording',attributes,{'tableName':_0x3156('0x8'),'paranoid':![],'indexes':[{'name':_0x3156('0x9'),'fields':[_0x3156('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33a2=['screen_recordings','interactionid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x47e50c,_0x540d66){var _0x33a871=function(_0x1e3969){while(--_0x1e3969){_0x47e50c['push'](_0x47e50c['shift']());}};_0x33a871(++_0x540d66);}(_0x33a2,0xe2));var _0x233a=function(_0xaa73a3,_0x313deb){_0xaa73a3=_0xaa73a3-0x0;var _0xae947d=_0x33a2[_0xaa73a3];return _0xae947d;};'use strict';var _=require(_0x233a('0x0'));var util=require(_0x233a('0x1'));var logger=require('../../config/logger')(_0x233a('0x2'));var moment=require(_0x233a('0x3'));var BPromise=require(_0x233a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x233a('0x5'));var rimraf=require(_0x233a('0x6'));var config=require(_0x233a('0x7'));var attributes=require(_0x233a('0x8'));module[_0x233a('0x9')]=function(_0x1cabbc,_0x1c8a84){return _0x1cabbc[_0x233a('0xa')](_0x233a('0xb'),attributes,{'tableName':_0x233a('0xc'),'paranoid':![],'indexes':[{'name':_0x233a('0xd'),'fields':[_0x233a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 09968e8..da05a19 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 _0x2ed3=['stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x84b303,_0x285e2a){var _0x2c87d7=function(_0x27bc4e){while(--_0x27bc4e){_0x84b303['push'](_0x84b303['shift']());}};_0x2c87d7(++_0x285e2a);}(_0x2ed3,0xf5));var _0x32ed=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x2ed3[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x32ed('0x0'));var util=require(_0x32ed('0x1'));var moment=require(_0x32ed('0x2'));var BPromise=require(_0x32ed('0x3'));var rs=require(_0x32ed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x32ed('0x6'));var config=require(_0x32ed('0x7'));var jayson=require(_0x32ed('0x8'));var client=jayson[_0x32ed('0x9')][_0x32ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2abf11,_0x36d2d4,_0x2a6ff9){return new BPromise(function(_0x541ece,_0x3bd1ac){return client['request'](_0x2abf11,_0x2a6ff9)['then'](function(_0x2e8472){logger[_0x32ed('0xb')](_0x32ed('0xc'),_0x36d2d4,'request\x20sent');logger[_0x32ed('0xd')](_0x32ed('0xe'),_0x36d2d4,'request\x20sent',JSON[_0x32ed('0xf')](_0x2e8472));if(_0x2e8472[_0x32ed('0x10')]){if(_0x2e8472[_0x32ed('0x10')]['code']===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x36d2d4,_0x2e8472[_0x32ed('0x10')][_0x32ed('0x11')]);return _0x3bd1ac(_0x2e8472[_0x32ed('0x10')][_0x32ed('0x11')]);}logger[_0x32ed('0x10')](_0x32ed('0xc'),_0x36d2d4,_0x2e8472[_0x32ed('0x10')]['message']);return _0x541ece(_0x2e8472[_0x32ed('0x10')][_0x32ed('0x11')]);}else{logger[_0x32ed('0xb')](_0x32ed('0xc'),_0x36d2d4,_0x32ed('0x12'));_0x541ece(_0x2e8472['result']['message']);}})[_0x32ed('0x13')](function(_0x2dc81c){logger['error'](_0x32ed('0xc'),_0x36d2d4,_0x2dc81c);_0x3bd1ac(_0x2dc81c);});});} \ No newline at end of file +var _0x1f49=['rpc','jayson/promise','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1f49,0x10b));var _0x91f4=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x1f49[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x91f4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x91f4('0x1'));var rs=require(_0x91f4('0x2'));var fs=require('fs');var Redis=require(_0x91f4('0x3'));var db=require(_0x91f4('0x4'))['db'];var utils=require(_0x91f4('0x5'));var logger=require('../../config/logger')(_0x91f4('0x6'));var config=require('../../config/environment');var jayson=require(_0x91f4('0x7'));var client=jayson[_0x91f4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x188857,_0x18e485,_0x3a0efd){return new BPromise(function(_0x1bd1d0,_0x1786b9){return client[_0x91f4('0x9')](_0x188857,_0x3a0efd)[_0x91f4('0xa')](function(_0x3d98c6){logger[_0x91f4('0xb')](_0x91f4('0xc'),_0x18e485,_0x91f4('0xd'));logger[_0x91f4('0xe')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x18e485,_0x91f4('0xd'),JSON[_0x91f4('0xf')](_0x3d98c6));if(_0x3d98c6[_0x91f4('0x10')]){if(_0x3d98c6[_0x91f4('0x10')][_0x91f4('0x11')]===0x1f4){logger[_0x91f4('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x18e485,_0x3d98c6[_0x91f4('0x10')]['message']);return _0x1786b9(_0x3d98c6['error'][_0x91f4('0x12')]);}logger[_0x91f4('0x10')](_0x91f4('0xc'),_0x18e485,_0x3d98c6['error'][_0x91f4('0x12')]);return _0x1bd1d0(_0x3d98c6[_0x91f4('0x10')][_0x91f4('0x12')]);}else{logger[_0x91f4('0xb')](_0x91f4('0xc'),_0x18e485,_0x91f4('0xd'));_0x1bd1d0(_0x3d98c6[_0x91f4('0x13')]['message']);}})[_0x91f4('0x14')](function(_0x3a1292){logger[_0x91f4('0x10')](_0x91f4('0xc'),_0x18e485,_0x3a1292);_0x1786b9(_0x3a1292);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index edb3ab8..f70ee5e 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 _0xd3b1=['getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','originalname','post','single','file','format','extname','addLogoLogin','/:id/preferred','addPreferred','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','/now','getDate','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr'];(function(_0xdeedfb,_0x729de8){var _0x3a2e75=function(_0x30b737){while(--_0x30b737){_0xdeedfb['push'](_0xdeedfb['shift']());}};_0x3a2e75(++_0x729de8);}(_0xd3b1,0xe2));var _0x1d3b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd3b1[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1d3b('0x0'));var util=require(_0x1d3b('0x1'));var path=require('path');var timeout=require(_0x1d3b('0x2'));var express=require(_0x1d3b('0x3'));var router=express[_0x1d3b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d3b('0x5'));var interaction=require(_0x1d3b('0x6'));var config=require(_0x1d3b('0x7'));var controller=require(_0x1d3b('0x8'));router['get']('/',auth[_0x1d3b('0x9')](),controller['index']);router['get'](_0x1d3b('0xa'),controller[_0x1d3b('0xb')]);router[_0x1d3b('0xc')](_0x1d3b('0xd'),controller[_0x1d3b('0xe')]);router[_0x1d3b('0xc')](_0x1d3b('0xf'),controller[_0x1d3b('0x10')]);router[_0x1d3b('0xc')](_0x1d3b('0x11'),controller['getLogoLogin']);router['get'](_0x1d3b('0x12'),controller[_0x1d3b('0x13')]);router[_0x1d3b('0xc')]('/:id/preferred',controller[_0x1d3b('0x14')]);router['get'](_0x1d3b('0x15'),controller[_0x1d3b('0x16')]);var upload=multer({'storage':multer[_0x1d3b('0x17')]({'destination':function(_0x532a0f,_0x509cdb,_0x5ce459){_0x5ce459(null,path[_0x1d3b('0x18')](config[_0x1d3b('0x19')],_0x1d3b('0x1a')));},'filename':function(_0x1b14a4,_0x649121,_0x48743f){_0x48743f(null,util['format'](_0x1d3b('0x1b'),_0x1d3b('0x1c'),path['extname'](_0x649121[_0x1d3b('0x1d')])));}})});router[_0x1d3b('0x1e')](_0x1d3b('0xf'),upload[_0x1d3b('0x1f')](_0x1d3b('0x20')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xe81661,_0x13dcbd,_0x5a0527){_0x5a0527(null,path['join'](config[_0x1d3b('0x19')],_0x1d3b('0x1a')));},'filename':function(_0x2a253d,_0x535f47,_0x3a5227){_0x3a5227(null,util[_0x1d3b('0x21')](_0x1d3b('0x1b'),'logologin',path[_0x1d3b('0x22')](_0x535f47['originalname'])));}})});router['post'](_0x1d3b('0x11'),upload[_0x1d3b('0x1f')](_0x1d3b('0x20')),controller[_0x1d3b('0x23')]);var upload=multer({'storage':multer[_0x1d3b('0x17')]({'destination':function(_0x59bcd8,_0x1684d7,_0x325f30){_0x325f30(null,path[_0x1d3b('0x18')](config[_0x1d3b('0x19')],_0x1d3b('0x1a')));},'filename':function(_0x28e1c5,_0x38f09a,_0x4cf84a){_0x4cf84a(null,util[_0x1d3b('0x21')](_0x1d3b('0x1b'),'preferred',path[_0x1d3b('0x22')](_0x38f09a['originalname'])));}})});router['post'](_0x1d3b('0x24'),upload[_0x1d3b('0x1f')](_0x1d3b('0x20')),controller[_0x1d3b('0x25')]);var upload=multer({'storage':multer[_0x1d3b('0x17')]({'destination':function(_0x12d45e,_0x4dc6a4,_0x558271){_0x558271(null,path[_0x1d3b('0x18')](config[_0x1d3b('0x19')],_0x1d3b('0x1a')));},'filename':function(_0x1e2393,_0x5979e3,_0x2c8604){_0x2c8604(null,util[_0x1d3b('0x21')](_0x1d3b('0x1b'),'favicon',path[_0x1d3b('0x22')](_0x5979e3['originalname'])));}})});router[_0x1d3b('0x1e')](_0x1d3b('0x15'),upload[_0x1d3b('0x1f')](_0x1d3b('0x20')),controller['addFavicon']);router[_0x1d3b('0x26')]('/:id',auth[_0x1d3b('0x9')](),controller[_0x1d3b('0x27')]);module[_0x1d3b('0x28')]=router; \ No newline at end of file +var _0xd029=['single','addLogoLogin','preferred','addPreferred','favicon','addFavicon','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','logo','extname','originalname','post','file','addLogo','server/files/images/logos/','%s%s','logologin'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd029,0x116));var _0x9d02=function(_0x4ef744,_0x5ea936){_0x4ef744=_0x4ef744-0x0;var _0x21357f=_0xd029[_0x4ef744];return _0x21357f;};'use strict';var multer=require(_0x9d02('0x0'));var util=require('util');var path=require(_0x9d02('0x1'));var timeout=require(_0x9d02('0x2'));var express=require('express');var router=express[_0x9d02('0x3')]();var fs_extra=require(_0x9d02('0x4'));var auth=require(_0x9d02('0x5'));var interaction=require(_0x9d02('0x6'));var config=require('../../config/environment');var controller=require(_0x9d02('0x7'));router['get']('/',auth[_0x9d02('0x8')](),controller[_0x9d02('0x9')]);router[_0x9d02('0xa')](_0x9d02('0xb'),controller[_0x9d02('0xc')]);router['get'](_0x9d02('0xd'),controller[_0x9d02('0xe')]);router['get'](_0x9d02('0xf'),controller['getLogo']);router['get'](_0x9d02('0x10'),controller[_0x9d02('0x11')]);router[_0x9d02('0xa')](_0x9d02('0x12'),controller[_0x9d02('0x13')]);router[_0x9d02('0xa')](_0x9d02('0x14'),controller[_0x9d02('0x15')]);router[_0x9d02('0xa')](_0x9d02('0x16'),controller[_0x9d02('0x17')]);var upload=multer({'storage':multer[_0x9d02('0x18')]({'destination':function(_0x134202,_0x2e530f,_0x3d6868){_0x3d6868(null,path[_0x9d02('0x19')](config[_0x9d02('0x1a')],'server/files/images/logos/'));},'filename':function(_0x54d41c,_0x5524d4,_0x351da2){_0x351da2(null,util[_0x9d02('0x1b')]('%s%s',_0x9d02('0x1c'),path[_0x9d02('0x1d')](_0x5524d4[_0x9d02('0x1e')])));}})});router[_0x9d02('0x1f')](_0x9d02('0xf'),upload['single'](_0x9d02('0x20')),controller[_0x9d02('0x21')]);var upload=multer({'storage':multer[_0x9d02('0x18')]({'destination':function(_0x52517c,_0x115ed1,_0x45d515){_0x45d515(null,path['join'](config['root'],_0x9d02('0x22')));},'filename':function(_0x202186,_0x582c45,_0x160a17){_0x160a17(null,util[_0x9d02('0x1b')](_0x9d02('0x23'),_0x9d02('0x24'),path[_0x9d02('0x1d')](_0x582c45['originalname'])));}})});router[_0x9d02('0x1f')]('/:id/logo_login',upload[_0x9d02('0x25')]('file'),controller[_0x9d02('0x26')]);var upload=multer({'storage':multer[_0x9d02('0x18')]({'destination':function(_0x4b2811,_0xffd1b6,_0x4fba8c){_0x4fba8c(null,path[_0x9d02('0x19')](config['root'],_0x9d02('0x22')));},'filename':function(_0x57bdcf,_0x3609e1,_0x53b155){_0x53b155(null,util[_0x9d02('0x1b')](_0x9d02('0x23'),_0x9d02('0x27'),path[_0x9d02('0x1d')](_0x3609e1['originalname'])));}})});router['post']('/:id/preferred',upload[_0x9d02('0x25')]('file'),controller[_0x9d02('0x28')]);var upload=multer({'storage':multer[_0x9d02('0x18')]({'destination':function(_0x4e893a,_0x39b949,_0x4bf22c){_0x4bf22c(null,path[_0x9d02('0x19')](config[_0x9d02('0x1a')],'server/files/images/logos/'));},'filename':function(_0x2b3ab1,_0x4e2486,_0x13ad11){_0x13ad11(null,util['format'](_0x9d02('0x23'),_0x9d02('0x29'),path['extname'](_0x4e2486[_0x9d02('0x1e')])));}})});router[_0x9d02('0x1f')](_0x9d02('0x16'),upload['single'](_0x9d02('0x20')),controller[_0x9d02('0x2a')]);router['put'](_0x9d02('0xd'),auth[_0x9d02('0x8')](),controller[_0x9d02('0x2b')]);module[_0x9d02('0x2c')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index c029dc6..608ea0c 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 _0x3f48=['alternate','UNSIGNED','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x1b6418,_0x422266){var _0x410935=function(_0x491062){while(--_0x491062){_0x1b6418['push'](_0x1b6418['shift']());}};_0x410935(++_0x422266);}(_0x3f48,0x17c));var _0x83f4=function(_0x300808,_0x5a107d){_0x300808=_0x300808-0x0;var _0x503f60=_0x3f48[_0x300808];return _0x503f60;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x83f4('0x0')](0xb),'unique':_0x83f4('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x83f4('0x0')](0xb),'unique':_0x83f4('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x83f4('0x3')],'defaultValue':_0x83f4('0x4')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x83f4('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x83f4('0x3')]},'turnaddr':{'type':Sequelize[_0x83f4('0x3')]},'turnusername':{'type':Sequelize[_0x83f4('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x83f4('0x3')]},'defaultPageTitle':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x83f4('0x6')},'enableEmailPreview':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x83f4('0x7')},'chatTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x83f4('0x3')]},'defaultPreferred':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x83f4('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x83f4('0x3')]},'defaultFavicon':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x83f4('0x3')]},'sentiment':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x83f4('0x0')]},'sentimentRegion':{'type':Sequelize[_0x83f4('0x3')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x83f4('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x83f4('0x0')](0x2)[_0x83f4('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x5},'disabledCookie':{'type':Sequelize[_0x83f4('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x83f4('0x0')],'defaultValue':0x14}}; \ No newline at end of file +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(_0x254ac1,_0x187540){var _0x49b249=function(_0x5ed406){while(--_0x5ed406){_0x254ac1['push'](_0x254ac1['shift']());}};_0x49b249(++_0x187540);}(_0x1c52,0x7c));var _0x21c5=function(_0x12935b,_0x2806eb){_0x12935b=_0x12935b-0x0;var _0x2a5de8=_0x1c52[_0x12935b];return _0x2a5de8;};'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 diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3d7f75b..bd3991d 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 _0x7617=['moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','name','send','index','Setting','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','show','includeAll','update','body','find','params','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','upperFirst','custom','default_logo.svg','Sequelize','\x20not\x20found','download','getLogoLogin','favicon','defaultLogo','existsSync','default_loginLogo.svg','ValidationError','addPreferred','default','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','eml-format','rimraf','fast-json-patch'];(function(_0x51cd5d,_0x3a4329){var _0xb9ae1e=function(_0x3dd975){while(--_0x3dd975){_0x51cd5d['push'](_0x51cd5d['shift']());}};_0xb9ae1e(++_0x3a4329);}(_0x7617,0x1cd));var _0x7761=function(_0x23a1e6,_0x356ac5){_0x23a1e6=_0x23a1e6-0x0;var _0xbbf42b=_0x7617[_0x23a1e6];return _0xbbf42b;};'use strict';var emlformat=require(_0x7761('0x0'));var rimraf=require(_0x7761('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7761('0x2'));var rp=require('request-promise');var moment=require(_0x7761('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x7761('0x4'));var sox=require(_0x7761('0x5'));var csv=require(_0x7761('0x6'));var ejs=require(_0x7761('0x7'));var fs=require('fs');var fs_extra=require(_0x7761('0x8'));var _=require(_0x7761('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7761('0xa'));var deskjs=require(_0x7761('0xb'));var toCsv=require(_0x7761('0x6'));var querystring=require(_0x7761('0xc'));var Papa=require(_0x7761('0xd'));var Redis=require(_0x7761('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7761('0xf'));var as=require(_0x7761('0x10'));var hardwareService=require(_0x7761('0x11'));var logger=require(_0x7761('0x12'))('api');var utils=require(_0x7761('0x13'));var config=require(_0x7761('0x14'));var licenseUtil=require(_0x7761('0x15'));var db=require(_0x7761('0x16'))['db'];var jayson=require(_0x7761('0x17'));var client=jayson[_0x7761('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1624f7,_0x1938e7,_0x3fd190,_0xc37ec3){return new BPromise(function(_0x285512,_0x129e5d){var _0x292f1b=_0xc37ec3||client;return _0x292f1b['request'](_0x1624f7,_0x3fd190)[_0x7761('0x19')](function(_0x1ab8de){logger['info'](_0x7761('0x1a'),_0x1938e7,'request\x20sent');logger[_0x7761('0x1b')]('Setting,\x20%s,\x20%s,\x20%s',_0x1938e7,_0x7761('0x1c'),JSON[_0x7761('0x1d')](_0x1ab8de));if(_0x1ab8de['error']){if(_0x1ab8de['error'][_0x7761('0x1e')]===0x1f4){logger[_0x7761('0x1f')](_0x7761('0x1a'),_0x1938e7,_0x1ab8de[_0x7761('0x1f')]['message']);return _0x129e5d(_0x1ab8de[_0x7761('0x1f')][_0x7761('0x20')]);}logger[_0x7761('0x1f')](_0x7761('0x1a'),_0x1938e7,_0x1ab8de[_0x7761('0x1f')][_0x7761('0x20')]);return _0x285512(_0x1ab8de[_0x7761('0x1f')][_0x7761('0x20')]);}else{logger[_0x7761('0x21')]('Setting,\x20%s,\x20%s',_0x1938e7,_0x7761('0x1c'));_0x285512(_0x1ab8de['result'][_0x7761('0x20')]);}})[_0x7761('0x22')](function(_0x1b7732){logger['error'](_0x7761('0x1a'),_0x1938e7,_0x1b7732);_0x129e5d(_0x1b7732);});});}function respondWithStatusCode(_0x816194,_0x488f90){_0x488f90=_0x488f90||0xcc;return function(_0x370244){if(_0x370244){return _0x816194[_0x7761('0x23')](_0x488f90);}return _0x816194[_0x7761('0x24')](_0x488f90)[_0x7761('0x25')]();};}function respondWithResult(_0x1639c0,_0x34f739){_0x34f739=_0x34f739||0xc8;return function(_0x41f1c4){if(_0x41f1c4){return _0x1639c0[_0x7761('0x24')](_0x34f739)[_0x7761('0x26')](_0x41f1c4);}};}function respondWithFilteredResult(_0x56abb8,_0xed1e00){return function(_0x34676e){if(_0x34676e){var _0x42b3fe=typeof _0xed1e00[_0x7761('0x27')]==='undefined'&&typeof _0xed1e00['limit']===_0x7761('0x28');var _0x1e49f7=_0x34676e[_0x7761('0x29')];var _0x52ff20=_0x42b3fe?0x0:_0xed1e00[_0x7761('0x27')];var _0x423487=_0x42b3fe?_0x34676e[_0x7761('0x29')]:_0xed1e00[_0x7761('0x27')]+_0xed1e00['limit'];var _0x19af03;if(_0x423487>=_0x1e49f7){_0x423487=_0x1e49f7;_0x19af03=0xc8;}else{_0x19af03=0xce;}_0x56abb8[_0x7761('0x24')](_0x19af03);return _0x56abb8[_0x7761('0x2a')](_0x7761('0x2b'),_0x52ff20+'-'+_0x423487+'/'+_0x1e49f7)['json'](_0x34676e);}return null;};}function patchUpdates(_0x56bae9){return function(_0x4f5b28){try{jsonpatch[_0x7761('0x2c')](_0x4f5b28,_0x56bae9,!![]);}catch(_0x1c1378){return BPromise['reject'](_0x1c1378);}return _0x4f5b28[_0x7761('0x2d')]();};}function saveUpdates(_0x185bb4,_0x404fba){return function(_0x58ad52){if(_0x58ad52){return _0x58ad52['update'](_0x185bb4)[_0x7761('0x19')](function(_0x1470d9){return _0x1470d9;});}return null;};}function removeEntity(_0x3ed914,_0x47b904){return function(_0xe95751){if(_0xe95751){return _0xe95751['destroy']()[_0x7761('0x19')](function(){_0x3ed914[_0x7761('0x24')](0xcc)[_0x7761('0x25')]();});}};}function handleEntityNotFound(_0x58fdc8,_0x360333){return function(_0x2175e9){if(!_0x2175e9){_0x58fdc8['sendStatus'](0x194);}return _0x2175e9;};}function handleError(_0x547f33,_0x16fb24){_0x16fb24=_0x16fb24||0x1f4;return function(_0x54b605){logger[_0x7761('0x1f')](_0x54b605['stack']);if(_0x54b605['name']){delete _0x54b605[_0x7761('0x2e')];}_0x547f33['status'](_0x16fb24)[_0x7761('0x2f')](_0x54b605);};}exports[_0x7761('0x30')]=function(_0x436f95,_0x3d1aa3){var _0x50e9a4={},_0x24b137={},_0x250121={'count':0x0,'rows':[]};var _0x3b00a5=_['map'](db[_0x7761('0x31')][_0x7761('0x32')],function(_0x42c697){return{'name':_0x42c697['fieldName'],'type':_0x42c697[_0x7761('0x33')][_0x7761('0x34')]};});_0x24b137[_0x7761('0x35')]=_[_0x7761('0x36')](_0x3b00a5,'name');_0x24b137[_0x7761('0x37')]=_[_0x7761('0x38')](_0x436f95[_0x7761('0x37')]);_0x24b137[_0x7761('0x39')]=_['intersection'](_0x24b137['model'],_0x24b137[_0x7761('0x37')]);_0x50e9a4[_0x7761('0x3a')]=_[_0x7761('0x3b')](_0x24b137[_0x7761('0x35')],qs[_0x7761('0x3c')](_0x436f95[_0x7761('0x37')]['fields']));_0x50e9a4[_0x7761('0x3a')]=_0x50e9a4['attributes'][_0x7761('0x3d')]?_0x50e9a4[_0x7761('0x3a')]:_0x24b137[_0x7761('0x35')];if(!_0x436f95[_0x7761('0x37')][_0x7761('0x3e')](_0x7761('0x3f'))){_0x50e9a4['limit']=qs[_0x7761('0x40')](_0x436f95[_0x7761('0x37')][_0x7761('0x40')]);_0x50e9a4[_0x7761('0x27')]=qs[_0x7761('0x27')](_0x436f95[_0x7761('0x37')]['offset']);}_0x50e9a4[_0x7761('0x41')]=qs[_0x7761('0x42')](_0x436f95[_0x7761('0x37')][_0x7761('0x42')]);_0x50e9a4[_0x7761('0x43')]=qs['filters'](_[_0x7761('0x44')](_0x436f95[_0x7761('0x37')],_0x24b137[_0x7761('0x39')]),_0x3b00a5);if(_0x436f95['query']['filter']){_0x50e9a4['where']=_[_0x7761('0x45')](_0x50e9a4['where'],{'$or':_[_0x7761('0x36')](_0x3b00a5,function(_0xcc1641){if(_0xcc1641[_0x7761('0x33')]!==_0x7761('0x46')){var _0x501fd1={};_0x501fd1[_0xcc1641['name']]={'$like':'%'+_0x436f95[_0x7761('0x37')][_0x7761('0x47')]+'%'};return _0x501fd1;}})});}_0x50e9a4=_[_0x7761('0x45')]({},_0x50e9a4,_0x436f95[_0x7761('0x48')]);var _0x9c0c18={'where':_0x50e9a4['where']};return db[_0x7761('0x31')][_0x7761('0x29')](_0x9c0c18)[_0x7761('0x19')](function(_0x43d80d){_0x250121[_0x7761('0x29')]=_0x43d80d;if(_0x436f95[_0x7761('0x37')]['includeAll']){_0x50e9a4[_0x7761('0x49')]=[{'all':!![]}];}return db[_0x7761('0x31')][_0x7761('0x4a')](_0x50e9a4);})[_0x7761('0x19')](function(_0x408365){_0x250121['rows']=_0x408365;return _0x250121;})[_0x7761('0x19')](respondWithFilteredResult(_0x3d1aa3,_0x50e9a4))[_0x7761('0x22')](handleError(_0x3d1aa3,null));};exports[_0x7761('0x4b')]=function(_0x106494,_0x141ba1){var _0x5a580d={'raw':![],'where':{'id':_0x106494['params']['id']}},_0x2949ce={};_0x2949ce['model']=_[_0x7761('0x38')](db[_0x7761('0x31')]['rawAttributes']);_0x2949ce[_0x7761('0x37')]=_[_0x7761('0x38')](_0x106494[_0x7761('0x37')]);_0x2949ce[_0x7761('0x39')]=_['intersection'](_0x2949ce[_0x7761('0x35')],_0x2949ce[_0x7761('0x37')]);_0x5a580d[_0x7761('0x3a')]=_[_0x7761('0x3b')](_0x2949ce[_0x7761('0x35')],qs[_0x7761('0x3c')](_0x106494[_0x7761('0x37')][_0x7761('0x3c')]));_0x5a580d[_0x7761('0x3a')]=_0x5a580d[_0x7761('0x3a')][_0x7761('0x3d')]?_0x5a580d[_0x7761('0x3a')]:_0x2949ce[_0x7761('0x35')];if(_0x106494[_0x7761('0x37')][_0x7761('0x4c')]){_0x5a580d['include']=[{'all':!![]}];}_0x5a580d=_[_0x7761('0x45')]({},_0x5a580d,_0x106494[_0x7761('0x48')]);return db[_0x7761('0x31')]['find'](_0x5a580d)[_0x7761('0x19')](handleEntityNotFound(_0x141ba1,null))['then'](respondWithResult(_0x141ba1,null))[_0x7761('0x22')](handleError(_0x141ba1,null));};exports[_0x7761('0x4d')]=function(_0x584c10,_0x4123e9){if(_0x584c10['body']['id']){delete _0x584c10[_0x7761('0x4e')]['id'];}return db[_0x7761('0x31')][_0x7761('0x4f')]({'where':{'id':_0x584c10[_0x7761('0x50')]['id']}})[_0x7761('0x19')](handleEntityNotFound(_0x4123e9,null))['then'](saveUpdates(_0x584c10['body'],null))[_0x7761('0x19')](respondWithResult(_0x4123e9,null))[_0x7761('0x22')](handleError(_0x4123e9,null));};exports[_0x7761('0x51')]=function(_0x120dc5,_0x1d5d89,_0x11d133){if(_0x120dc5[_0x7761('0x52')]&&_0x120dc5[_0x7761('0x52')]['filename']){_0x120dc5['body'][_0x7761('0x53')]=_0x120dc5[_0x7761('0x52')][_0x7761('0x54')];}return db[_0x7761('0x31')][_0x7761('0x4f')]({'where':{'id':_0x120dc5[_0x7761('0x50')]['id']}})[_0x7761('0x19')](handleEntityNotFound(_0x1d5d89,null))[_0x7761('0x19')](saveUpdates(_0x120dc5[_0x7761('0x4e')],null))[_0x7761('0x19')](respondWithResult(_0x1d5d89,null))[_0x7761('0x22')](handleError(_0x1d5d89,null));};exports[_0x7761('0x55')]=function(_0x4743e7,_0x4775c7,_0x4e0a1d){if(_0x4743e7[_0x7761('0x52')]&&_0x4743e7[_0x7761('0x52')]['filename']){_0x4743e7[_0x7761('0x4e')][_0x7761('0x56')]=_0x4743e7[_0x7761('0x52')][_0x7761('0x54')];}return db[_0x7761('0x31')]['find']({'where':{'id':_0x4743e7[_0x7761('0x50')]['id']}})[_0x7761('0x19')](handleEntityNotFound(_0x4775c7,null))[_0x7761('0x19')](saveUpdates(_0x4743e7[_0x7761('0x4e')],null))['then'](respondWithResult(_0x4775c7,null))[_0x7761('0x22')](handleError(_0x4775c7,null));};var utilLicense=require(_0x7761('0x15'));exports[_0x7761('0x57')]=function(_0x560721,_0x4059ed,_0x56df09){var _0x3a3b81=_0x7761('0x58');var _0x4530dd={'custom':![]};return utilLicense[_0x7761('0x59')]()[_0x7761('0x19')](function(_0x131ec5){if(_0x131ec5){_0x4530dd=_0x131ec5;}return db[_0x7761('0x31')][_0x7761('0x4f')]({'where':{'id':_0x560721[_0x7761('0x50')]['id']},'attributes':['logo',_0x7761('0x56'),_0x7761('0x5a'),'favicon','defaultLogo',_0x7761('0x5b'),_0x7761('0x5c'),_0x7761('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x4059ed,null))[_0x7761('0x19')](function(_0x8b5fc6){if(_0x8b5fc6){var _0x48c1aa=_0x8b5fc6['logo']&&fs['existsSync'](path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x3a3b81,_['toLower'](_0x8b5fc6[_0x7761('0x53')])))?path['join'](config[_0x7761('0x5f')],_0x3a3b81,_[_0x7761('0x60')](_0x8b5fc6['logo'])):path['join'](config[_0x7761('0x5f')],_0x3a3b81,_[_0x7761('0x60')]('default_logo.svg'));var _0x1245f0='default'+_[_0x7761('0x61')](_0x7761('0x53'));if(_0x8b5fc6[_0x1245f0]||!_0x4530dd[_0x7761('0x62')]){_0x48c1aa=path[_0x7761('0x5e')](config['root'],_0x3a3b81,_[_0x7761('0x60')](_0x7761('0x63')));}if(!fs['existsSync'](_0x48c1aa)){throw new db[(_0x7761('0x64'))]['ValidationError'](_[_0x7761('0x61')]('logo')+_0x7761('0x65'));}return _0x4059ed[_0x7761('0x66')](_0x48c1aa);}})['catch'](handleError(_0x4059ed,null));};var utilLicense=require(_0x7761('0x15'));exports[_0x7761('0x67')]=function(_0x1657c3,_0x4c5b2c,_0x16d863){var _0x1645b4=_0x7761('0x58');var _0x28cba5={'custom':![]};return utilLicense['getLicense']()[_0x7761('0x19')](function(_0x29cff4){if(_0x29cff4){_0x28cba5=_0x29cff4;}return db[_0x7761('0x31')][_0x7761('0x4f')]({'where':{'id':_0x1657c3[_0x7761('0x50')]['id']},'attributes':[_0x7761('0x53'),'loginLogo',_0x7761('0x5a'),_0x7761('0x68'),_0x7761('0x69'),_0x7761('0x5b'),_0x7761('0x5c'),_0x7761('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x4c5b2c,null))[_0x7761('0x19')](function(_0x5724c2){if(_0x5724c2){var _0x54a9da=_0x5724c2[_0x7761('0x56')]&&fs[_0x7761('0x6a')](path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x1645b4,_[_0x7761('0x60')](_0x5724c2[_0x7761('0x56')])))?path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x1645b4,_[_0x7761('0x60')](_0x5724c2[_0x7761('0x56')])):path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x1645b4,_[_0x7761('0x60')](_0x7761('0x6b')));var _0x50a8ff='default'+_[_0x7761('0x61')](_0x7761('0x56'));if(_0x5724c2[_0x50a8ff]||!_0x28cba5[_0x7761('0x62')]){_0x54a9da=path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x1645b4,_[_0x7761('0x60')](_0x7761('0x6b')));}if(!fs[_0x7761('0x6a')](_0x54a9da)){throw new db[(_0x7761('0x64'))][(_0x7761('0x6c'))](_['upperFirst'](_0x7761('0x56'))+_0x7761('0x65'));}return _0x4c5b2c[_0x7761('0x66')](_0x54a9da);}})[_0x7761('0x22')](handleError(_0x4c5b2c,null));};exports['gdpr']=function(_0x561b39,_0x163ece){return db['Setting'][_0x7761('0x4f')]({'where':{'id':_0x561b39['params']['id']},'attributes':['securePassword']})[_0x7761('0x19')](respondWithResult(_0x163ece,null))['catch'](handleError(_0x163ece,null));};exports[_0x7761('0x6d')]=function(_0x38a8a1,_0x843fab,_0x5ea96d){if(_0x38a8a1['file']&&_0x38a8a1['file'][_0x7761('0x54')]){_0x38a8a1[_0x7761('0x4e')][_0x7761('0x5a')]=_0x38a8a1[_0x7761('0x52')][_0x7761('0x54')];}return db['Setting'][_0x7761('0x4f')]({'where':{'id':_0x38a8a1[_0x7761('0x50')]['id']}})[_0x7761('0x19')](handleEntityNotFound(_0x843fab,null))['then'](saveUpdates(_0x38a8a1[_0x7761('0x4e')],null))['then'](respondWithResult(_0x843fab,null))[_0x7761('0x22')](handleError(_0x843fab,null));};var utilLicense=require(_0x7761('0x15'));exports['getPreferred']=function(_0x4eba1b,_0x395da1,_0x49520f){var _0x425fbb='server/files/images/logos';var _0x32a148={'custom':![]};return utilLicense[_0x7761('0x59')]()[_0x7761('0x19')](function(_0x166d7b){if(_0x166d7b){_0x32a148=_0x166d7b;}return db[_0x7761('0x31')]['find']({'where':{'id':_0x4eba1b[_0x7761('0x50')]['id']},'attributes':['logo',_0x7761('0x56'),_0x7761('0x5a'),_0x7761('0x68'),'defaultLogo',_0x7761('0x5b'),'defaultPreferred',_0x7761('0x5d')],'raw':!![]});})[_0x7761('0x19')](handleEntityNotFound(_0x395da1,null))[_0x7761('0x19')](function(_0x517427){if(_0x517427){var _0x5b1ed9=_0x517427[_0x7761('0x5a')]&&fs[_0x7761('0x6a')](path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x425fbb,_[_0x7761('0x60')](_0x517427['preferred'])))?path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x425fbb,_[_0x7761('0x60')](_0x517427[_0x7761('0x5a')])):path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x425fbb,_[_0x7761('0x60')]('default_preferred.png'));var _0x2a8414=_0x7761('0x6e')+_[_0x7761('0x61')]('preferred');if(_0x517427[_0x2a8414]||!_0x32a148[_0x7761('0x62')]||!_0x32a148['preferred']){_0x5b1ed9=path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x425fbb,_[_0x7761('0x60')](_0x7761('0x6f')));}if(!fs['existsSync'](_0x5b1ed9)){throw new db['Sequelize']['ValidationError'](_[_0x7761('0x61')](_0x7761('0x5a'))+_0x7761('0x65'));}return _0x395da1[_0x7761('0x66')](_0x5b1ed9);}})[_0x7761('0x22')](handleError(_0x395da1,null));};exports['addFavicon']=function(_0x5f4e7e,_0x479398,_0x1a2a9d){if(_0x5f4e7e[_0x7761('0x52')]&&_0x5f4e7e[_0x7761('0x52')]['filename']){_0x5f4e7e[_0x7761('0x4e')][_0x7761('0x68')]=_0x5f4e7e[_0x7761('0x52')][_0x7761('0x54')];}return db[_0x7761('0x31')]['find']({'where':{'id':_0x5f4e7e['params']['id']}})[_0x7761('0x19')](handleEntityNotFound(_0x479398,null))[_0x7761('0x19')](saveUpdates(_0x5f4e7e[_0x7761('0x4e')],null))[_0x7761('0x19')](respondWithResult(_0x479398,null))['catch'](handleError(_0x479398,null));};var utilLicense=require(_0x7761('0x15'));exports[_0x7761('0x70')]=function(_0x293af4,_0x6ff94a,_0x2f3197){var _0x39ca15='server/files/images/logos';var _0x3df41b={'custom':![]};return utilLicense[_0x7761('0x59')]()[_0x7761('0x19')](function(_0x25b3c5){if(_0x25b3c5){_0x3df41b=_0x25b3c5;}return db[_0x7761('0x31')][_0x7761('0x4f')]({'where':{'id':_0x293af4['params']['id']},'attributes':[_0x7761('0x53'),_0x7761('0x56'),_0x7761('0x5a'),_0x7761('0x68'),'defaultLogo',_0x7761('0x5b'),_0x7761('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x7761('0x19')](handleEntityNotFound(_0x6ff94a,null))[_0x7761('0x19')](function(_0x2e3a31){if(_0x2e3a31){var _0x3036be=_0x2e3a31[_0x7761('0x68')]&&fs['existsSync'](path[_0x7761('0x5e')](config['root'],_0x39ca15,_[_0x7761('0x60')](_0x2e3a31[_0x7761('0x68')])))?path[_0x7761('0x5e')](config['root'],_0x39ca15,_[_0x7761('0x60')](_0x2e3a31[_0x7761('0x68')])):path[_0x7761('0x5e')](config['root'],_0x39ca15,_[_0x7761('0x60')](_0x7761('0x71')));var _0x1f8829='default'+_[_0x7761('0x61')]('favicon');if(_0x2e3a31[_0x1f8829]||!_0x3df41b[_0x7761('0x62')]){_0x3036be=path[_0x7761('0x5e')](config[_0x7761('0x5f')],_0x39ca15,_['toLower']('default_favicon.ico'));}if(!fs[_0x7761('0x6a')](_0x3036be)){throw new db[(_0x7761('0x64'))][(_0x7761('0x6c'))](_['upperFirst']('favicon')+_0x7761('0x65'));}return _0x6ff94a[_0x7761('0x66')](_0x3036be);}})[_0x7761('0x22')](handleError(_0x6ff94a,null));};exports[_0x7761('0x72')]=function(_0x341d96,_0xa440c2){var _0x1f417f={'offset':moment()['utcOffset']()};_0x1f417f['now']=moment()[_0x7761('0x73')](_0x1f417f[_0x7761('0x27')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xa440c2[_0x7761('0x24')](0xc8)[_0x7761('0x2f')](_0x1f417f);}; \ No newline at end of file +var _0x4092=['type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','Setting','count','includeAll','findAll','rows','show','params','keys','options','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','Sequelize','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x422672,_0x4af79c){var _0x1ae61d=function(_0x40a2ce){while(--_0x40a2ce){_0x422672['push'](_0x422672['shift']());}};_0x1ae61d(++_0x4af79c);}(_0x4092,0x1af));var _0x2409=function(_0x14bbdc,_0x49b365){_0x14bbdc=_0x14bbdc-0x0;var _0x5eac57=_0x4092[_0x14bbdc];return _0x5eac57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2409('0x0'));var zipdir=require(_0x2409('0x1'));var jsonpatch=require(_0x2409('0x2'));var rp=require(_0x2409('0x3'));var moment=require(_0x2409('0x4'));var BPromise=require(_0x2409('0x5'));var Mustache=require(_0x2409('0x6'));var util=require(_0x2409('0x7'));var path=require(_0x2409('0x8'));var sox=require('sox');var csv=require(_0x2409('0x9'));var ejs=require(_0x2409('0xa'));var fs=require('fs');var fs_extra=require(_0x2409('0xb'));var _=require('lodash');var squel=require(_0x2409('0xc'));var crypto=require(_0x2409('0xd'));var jsforce=require(_0x2409('0xe'));var deskjs=require(_0x2409('0xf'));var toCsv=require(_0x2409('0x9'));var querystring=require(_0x2409('0x10'));var Papa=require(_0x2409('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2409('0x12'));var as=require(_0x2409('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2409('0x14'));var utils=require('../../config/utils');var config=require(_0x2409('0x15'));var licenseUtil=require(_0x2409('0x16'));var db=require(_0x2409('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x2409('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x230001,_0x5dd54c,_0x58532f,_0x3d1ad3){return new BPromise(function(_0x3a6f0e,_0x5873d3){var _0x4a6e02=_0x3d1ad3||client;return _0x4a6e02['request'](_0x230001,_0x58532f)[_0x2409('0x19')](function(_0x1f9eda){logger[_0x2409('0x1a')](_0x2409('0x1b'),_0x5dd54c,_0x2409('0x1c'));logger[_0x2409('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x5dd54c,'request\x20sent',JSON['stringify'](_0x1f9eda));if(_0x1f9eda[_0x2409('0x1e')]){if(_0x1f9eda[_0x2409('0x1e')][_0x2409('0x1f')]===0x1f4){logger[_0x2409('0x1e')](_0x2409('0x1b'),_0x5dd54c,_0x1f9eda[_0x2409('0x1e')]['message']);return _0x5873d3(_0x1f9eda['error'][_0x2409('0x20')]);}logger[_0x2409('0x1e')]('Setting,\x20%s,\x20%s',_0x5dd54c,_0x1f9eda['error'][_0x2409('0x20')]);return _0x3a6f0e(_0x1f9eda[_0x2409('0x1e')]['message']);}else{logger['info'](_0x2409('0x1b'),_0x5dd54c,_0x2409('0x1c'));_0x3a6f0e(_0x1f9eda[_0x2409('0x21')][_0x2409('0x20')]);}})[_0x2409('0x22')](function(_0x1253b0){logger[_0x2409('0x1e')]('Setting,\x20%s,\x20%s',_0x5dd54c,_0x1253b0);_0x5873d3(_0x1253b0);});});}function respondWithStatusCode(_0x559c92,_0x17809d){_0x17809d=_0x17809d||0xcc;return function(_0x47f7d7){if(_0x47f7d7){return _0x559c92[_0x2409('0x23')](_0x17809d);}return _0x559c92[_0x2409('0x24')](_0x17809d)['end']();};}function respondWithResult(_0x27e1c9,_0x2be26d){_0x2be26d=_0x2be26d||0xc8;return function(_0x4a3e23){if(_0x4a3e23){return _0x27e1c9[_0x2409('0x24')](_0x2be26d)[_0x2409('0x25')](_0x4a3e23);}};}function respondWithFilteredResult(_0x24fcdb,_0x156707){return function(_0x4a0b91){if(_0x4a0b91){var _0x25d2fb=typeof _0x156707[_0x2409('0x26')]===_0x2409('0x27')&&typeof _0x156707['limit']===_0x2409('0x27');var _0x411e8d=_0x4a0b91['count'];var _0x233e0d=_0x25d2fb?0x0:_0x156707[_0x2409('0x26')];var _0x1ad2b3=_0x25d2fb?_0x4a0b91['count']:_0x156707[_0x2409('0x26')]+_0x156707[_0x2409('0x28')];var _0x4c81e1;if(_0x1ad2b3>=_0x411e8d){_0x1ad2b3=_0x411e8d;_0x4c81e1=0xc8;}else{_0x4c81e1=0xce;}_0x24fcdb[_0x2409('0x24')](_0x4c81e1);return _0x24fcdb[_0x2409('0x29')]('Content-Range',_0x233e0d+'-'+_0x1ad2b3+'/'+_0x411e8d)[_0x2409('0x25')](_0x4a0b91);}return null;};}function patchUpdates(_0x419983){return function(_0x648d2e){try{jsonpatch[_0x2409('0x2a')](_0x648d2e,_0x419983,!![]);}catch(_0x4d092f){return BPromise['reject'](_0x4d092f);}return _0x648d2e[_0x2409('0x2b')]();};}function saveUpdates(_0x8b7d6d,_0x31bc3c){return function(_0x2ce814){if(_0x2ce814){return _0x2ce814[_0x2409('0x2c')](_0x8b7d6d)[_0x2409('0x19')](function(_0x2ac9cd){return _0x2ac9cd;});}return null;};}function removeEntity(_0x4c8988,_0x2a76b8){return function(_0x279dc4){if(_0x279dc4){return _0x279dc4[_0x2409('0x2d')]()[_0x2409('0x19')](function(){_0x4c8988[_0x2409('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b48a9,_0x28d862){return function(_0x50fc42){if(!_0x50fc42){_0x1b48a9[_0x2409('0x23')](0x194);}return _0x50fc42;};}function handleError(_0xa8da4a,_0x50785e){_0x50785e=_0x50785e||0x1f4;return function(_0x3ef828){logger[_0x2409('0x1e')](_0x3ef828[_0x2409('0x2e')]);if(_0x3ef828[_0x2409('0x2f')]){delete _0x3ef828[_0x2409('0x2f')];}_0xa8da4a['status'](_0x50785e)[_0x2409('0x30')](_0x3ef828);};}exports[_0x2409('0x31')]=function(_0x90ac0e,_0x4dd62c){var _0x20ef17={},_0x441070={},_0x3ae903={'count':0x0,'rows':[]};var _0x32684d=_[_0x2409('0x32')](db['Setting'][_0x2409('0x33')],function(_0x2c9a52){return{'name':_0x2c9a52[_0x2409('0x34')],'type':_0x2c9a52[_0x2409('0x35')][_0x2409('0x36')]};});_0x441070[_0x2409('0x37')]=_[_0x2409('0x32')](_0x32684d,_0x2409('0x2f'));_0x441070[_0x2409('0x38')]=_['keys'](_0x90ac0e[_0x2409('0x38')]);_0x441070[_0x2409('0x39')]=_[_0x2409('0x3a')](_0x441070['model'],_0x441070[_0x2409('0x38')]);_0x20ef17[_0x2409('0x3b')]=_[_0x2409('0x3a')](_0x441070[_0x2409('0x37')],qs['fields'](_0x90ac0e[_0x2409('0x38')][_0x2409('0x3c')]));_0x20ef17[_0x2409('0x3b')]=_0x20ef17[_0x2409('0x3b')][_0x2409('0x3d')]?_0x20ef17[_0x2409('0x3b')]:_0x441070[_0x2409('0x37')];if(!_0x90ac0e[_0x2409('0x38')][_0x2409('0x3e')](_0x2409('0x3f'))){_0x20ef17['limit']=qs['limit'](_0x90ac0e[_0x2409('0x38')]['limit']);_0x20ef17[_0x2409('0x26')]=qs[_0x2409('0x26')](_0x90ac0e[_0x2409('0x38')][_0x2409('0x26')]);}_0x20ef17['order']=qs['sort'](_0x90ac0e[_0x2409('0x38')][_0x2409('0x40')]);_0x20ef17['where']=qs[_0x2409('0x39')](_[_0x2409('0x41')](_0x90ac0e['query'],_0x441070[_0x2409('0x39')]),_0x32684d);if(_0x90ac0e[_0x2409('0x38')][_0x2409('0x42')]){_0x20ef17[_0x2409('0x43')]=_['merge'](_0x20ef17[_0x2409('0x43')],{'$or':_['map'](_0x32684d,function(_0x479c63){if(_0x479c63['type']!==_0x2409('0x44')){var _0x4c7c8b={};_0x4c7c8b[_0x479c63['name']]={'$like':'%'+_0x90ac0e[_0x2409('0x38')]['filter']+'%'};return _0x4c7c8b;}})});}_0x20ef17=_[_0x2409('0x45')]({},_0x20ef17,_0x90ac0e['options']);var _0x563315={'where':_0x20ef17[_0x2409('0x43')]};return db[_0x2409('0x46')]['count'](_0x563315)[_0x2409('0x19')](function(_0x288913){_0x3ae903[_0x2409('0x47')]=_0x288913;if(_0x90ac0e[_0x2409('0x38')][_0x2409('0x48')]){_0x20ef17['include']=[{'all':!![]}];}return db[_0x2409('0x46')][_0x2409('0x49')](_0x20ef17);})[_0x2409('0x19')](function(_0xfc710){_0x3ae903[_0x2409('0x4a')]=_0xfc710;return _0x3ae903;})[_0x2409('0x19')](respondWithFilteredResult(_0x4dd62c,_0x20ef17))[_0x2409('0x22')](handleError(_0x4dd62c,null));};exports[_0x2409('0x4b')]=function(_0xed5a05,_0x3f34e1){var _0x3fcec6={'raw':![],'where':{'id':_0xed5a05[_0x2409('0x4c')]['id']}},_0x28962a={};_0x28962a[_0x2409('0x37')]=_[_0x2409('0x4d')](db[_0x2409('0x46')][_0x2409('0x33')]);_0x28962a[_0x2409('0x38')]=_[_0x2409('0x4d')](_0xed5a05[_0x2409('0x38')]);_0x28962a[_0x2409('0x39')]=_[_0x2409('0x3a')](_0x28962a[_0x2409('0x37')],_0x28962a[_0x2409('0x38')]);_0x3fcec6['attributes']=_[_0x2409('0x3a')](_0x28962a[_0x2409('0x37')],qs['fields'](_0xed5a05[_0x2409('0x38')][_0x2409('0x3c')]));_0x3fcec6['attributes']=_0x3fcec6[_0x2409('0x3b')][_0x2409('0x3d')]?_0x3fcec6[_0x2409('0x3b')]:_0x28962a[_0x2409('0x37')];if(_0xed5a05[_0x2409('0x38')][_0x2409('0x48')]){_0x3fcec6['include']=[{'all':!![]}];}_0x3fcec6=_[_0x2409('0x45')]({},_0x3fcec6,_0xed5a05[_0x2409('0x4e')]);return db[_0x2409('0x46')][_0x2409('0x4f')](_0x3fcec6)[_0x2409('0x19')](handleEntityNotFound(_0x3f34e1,null))[_0x2409('0x19')](respondWithResult(_0x3f34e1,null))['catch'](handleError(_0x3f34e1,null));};exports['update']=function(_0x3f093a,_0x9fe065){if(_0x3f093a[_0x2409('0x50')]['id']){delete _0x3f093a[_0x2409('0x50')]['id'];}return db[_0x2409('0x46')]['find']({'where':{'id':_0x3f093a[_0x2409('0x4c')]['id']}})[_0x2409('0x19')](handleEntityNotFound(_0x9fe065,null))[_0x2409('0x19')](saveUpdates(_0x3f093a[_0x2409('0x50')],null))['then'](respondWithResult(_0x9fe065,null))[_0x2409('0x22')](handleError(_0x9fe065,null));};exports[_0x2409('0x51')]=function(_0x15b613,_0x2fab59,_0x38d767){if(_0x15b613[_0x2409('0x52')]&&_0x15b613[_0x2409('0x52')][_0x2409('0x53')]){_0x15b613[_0x2409('0x50')][_0x2409('0x54')]=_0x15b613[_0x2409('0x52')][_0x2409('0x53')];}return db['Setting'][_0x2409('0x4f')]({'where':{'id':_0x15b613[_0x2409('0x4c')]['id']}})[_0x2409('0x19')](handleEntityNotFound(_0x2fab59,null))[_0x2409('0x19')](saveUpdates(_0x15b613['body'],null))[_0x2409('0x19')](respondWithResult(_0x2fab59,null))[_0x2409('0x22')](handleError(_0x2fab59,null));};exports[_0x2409('0x55')]=function(_0x39187a,_0x534553,_0x2e992f){if(_0x39187a[_0x2409('0x52')]&&_0x39187a['file'][_0x2409('0x53')]){_0x39187a[_0x2409('0x50')][_0x2409('0x56')]=_0x39187a[_0x2409('0x52')][_0x2409('0x53')];}return db[_0x2409('0x46')][_0x2409('0x4f')]({'where':{'id':_0x39187a[_0x2409('0x4c')]['id']}})['then'](handleEntityNotFound(_0x534553,null))[_0x2409('0x19')](saveUpdates(_0x39187a[_0x2409('0x50')],null))[_0x2409('0x19')](respondWithResult(_0x534553,null))[_0x2409('0x22')](handleError(_0x534553,null));};var utilLicense=require(_0x2409('0x16'));exports['getLogo']=function(_0x3af648,_0x5cccfe,_0x296f67){var _0x3118ee=_0x2409('0x57');var _0x5f3807={'custom':![]};return utilLicense[_0x2409('0x58')]()[_0x2409('0x19')](function(_0x1f04b9){if(_0x1f04b9){_0x5f3807=_0x1f04b9;}return db[_0x2409('0x46')]['find']({'where':{'id':_0x3af648['params']['id']},'attributes':[_0x2409('0x54'),'loginLogo','preferred',_0x2409('0x59'),_0x2409('0x5a'),_0x2409('0x5b'),_0x2409('0x5c'),_0x2409('0x5d')],'raw':!![]});})[_0x2409('0x19')](handleEntityNotFound(_0x5cccfe,null))[_0x2409('0x19')](function(_0x29af01){if(_0x29af01){var _0x384c8c=_0x29af01['logo']&&fs[_0x2409('0x5e')](path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x3118ee,_[_0x2409('0x61')](_0x29af01['logo'])))?path[_0x2409('0x5f')](config['root'],_0x3118ee,_['toLower'](_0x29af01[_0x2409('0x54')])):path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x3118ee,_['toLower'](_0x2409('0x62')));var _0x5011ca=_0x2409('0x63')+_[_0x2409('0x64')](_0x2409('0x54'));if(_0x29af01[_0x5011ca]||!_0x5f3807[_0x2409('0x65')]){_0x384c8c=path['join'](config[_0x2409('0x60')],_0x3118ee,_[_0x2409('0x61')]('default_logo.svg'));}if(!fs[_0x2409('0x5e')](_0x384c8c)){throw new db['Sequelize'][(_0x2409('0x66'))](_[_0x2409('0x64')](_0x2409('0x54'))+_0x2409('0x67'));}return _0x5cccfe[_0x2409('0x68')](_0x384c8c);}})['catch'](handleError(_0x5cccfe,null));};var utilLicense=require(_0x2409('0x16'));exports[_0x2409('0x69')]=function(_0x337016,_0x134ce7,_0x2246df){var _0x535979=_0x2409('0x57');var _0x259994={'custom':![]};return utilLicense[_0x2409('0x58')]()['then'](function(_0x454e82){if(_0x454e82){_0x259994=_0x454e82;}return db['Setting']['find']({'where':{'id':_0x337016[_0x2409('0x4c')]['id']},'attributes':[_0x2409('0x54'),'loginLogo',_0x2409('0x6a'),_0x2409('0x59'),_0x2409('0x5a'),_0x2409('0x5b'),_0x2409('0x5c'),_0x2409('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x134ce7,null))[_0x2409('0x19')](function(_0xd9a5c6){if(_0xd9a5c6){var _0x51617d=_0xd9a5c6['loginLogo']&&fs['existsSync'](path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x535979,_[_0x2409('0x61')](_0xd9a5c6['loginLogo'])))?path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x535979,_[_0x2409('0x61')](_0xd9a5c6[_0x2409('0x56')])):path['join'](config[_0x2409('0x60')],_0x535979,_[_0x2409('0x61')]('default_loginLogo.svg'));var _0x551198=_0x2409('0x63')+_[_0x2409('0x64')](_0x2409('0x56'));if(_0xd9a5c6[_0x551198]||!_0x259994['custom']){_0x51617d=path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x535979,_[_0x2409('0x61')](_0x2409('0x6b')));}if(!fs[_0x2409('0x5e')](_0x51617d)){throw new db[(_0x2409('0x6c'))][(_0x2409('0x66'))](_[_0x2409('0x64')]('loginLogo')+'\x20not\x20found');}return _0x134ce7[_0x2409('0x68')](_0x51617d);}})[_0x2409('0x22')](handleError(_0x134ce7,null));};exports[_0x2409('0x6d')]=function(_0x273021,_0x4ad527){return db[_0x2409('0x46')][_0x2409('0x4f')]({'where':{'id':_0x273021[_0x2409('0x4c')]['id']},'attributes':[_0x2409('0x6e')]})[_0x2409('0x19')](respondWithResult(_0x4ad527,null))[_0x2409('0x22')](handleError(_0x4ad527,null));};exports[_0x2409('0x6f')]=function(_0xb2a994,_0x4b9ed6,_0x224d2e){if(_0xb2a994[_0x2409('0x52')]&&_0xb2a994[_0x2409('0x52')][_0x2409('0x53')]){_0xb2a994[_0x2409('0x50')][_0x2409('0x6a')]=_0xb2a994[_0x2409('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0xb2a994[_0x2409('0x4c')]['id']}})[_0x2409('0x19')](handleEntityNotFound(_0x4b9ed6,null))[_0x2409('0x19')](saveUpdates(_0xb2a994[_0x2409('0x50')],null))[_0x2409('0x19')](respondWithResult(_0x4b9ed6,null))[_0x2409('0x22')](handleError(_0x4b9ed6,null));};var utilLicense=require('../../config/license/util');exports[_0x2409('0x70')]=function(_0x46126f,_0x48ebc9,_0x15fbfe){var _0xd51315=_0x2409('0x57');var _0x520388={'custom':![]};return utilLicense[_0x2409('0x58')]()[_0x2409('0x19')](function(_0x4de066){if(_0x4de066){_0x520388=_0x4de066;}return db[_0x2409('0x46')][_0x2409('0x4f')]({'where':{'id':_0x46126f[_0x2409('0x4c')]['id']},'attributes':[_0x2409('0x54'),_0x2409('0x56'),_0x2409('0x6a'),_0x2409('0x59'),'defaultLogo','defaultLoginLogo','defaultPreferred',_0x2409('0x5d')],'raw':!![]});})[_0x2409('0x19')](handleEntityNotFound(_0x48ebc9,null))['then'](function(_0x4216a4){if(_0x4216a4){var _0x5b8f91=_0x4216a4[_0x2409('0x6a')]&&fs[_0x2409('0x5e')](path[_0x2409('0x5f')](config[_0x2409('0x60')],_0xd51315,_['toLower'](_0x4216a4[_0x2409('0x6a')])))?path[_0x2409('0x5f')](config[_0x2409('0x60')],_0xd51315,_[_0x2409('0x61')](_0x4216a4[_0x2409('0x6a')])):path[_0x2409('0x5f')](config['root'],_0xd51315,_[_0x2409('0x61')](_0x2409('0x71')));var _0x578af4=_0x2409('0x63')+_[_0x2409('0x64')](_0x2409('0x6a'));if(_0x4216a4[_0x578af4]||!_0x520388[_0x2409('0x65')]||!_0x520388[_0x2409('0x6a')]){_0x5b8f91=path['join'](config['root'],_0xd51315,_[_0x2409('0x61')](_0x2409('0x71')));}if(!fs[_0x2409('0x5e')](_0x5b8f91)){throw new db[(_0x2409('0x6c'))][(_0x2409('0x66'))](_['upperFirst']('preferred')+'\x20not\x20found');}return _0x48ebc9[_0x2409('0x68')](_0x5b8f91);}})[_0x2409('0x22')](handleError(_0x48ebc9,null));};exports[_0x2409('0x72')]=function(_0x53cb8a,_0x2cd34f,_0x5b3643){if(_0x53cb8a[_0x2409('0x52')]&&_0x53cb8a[_0x2409('0x52')][_0x2409('0x53')]){_0x53cb8a['body'][_0x2409('0x59')]=_0x53cb8a[_0x2409('0x52')][_0x2409('0x53')];}return db[_0x2409('0x46')][_0x2409('0x4f')]({'where':{'id':_0x53cb8a[_0x2409('0x4c')]['id']}})[_0x2409('0x19')](handleEntityNotFound(_0x2cd34f,null))[_0x2409('0x19')](saveUpdates(_0x53cb8a[_0x2409('0x50')],null))[_0x2409('0x19')](respondWithResult(_0x2cd34f,null))[_0x2409('0x22')](handleError(_0x2cd34f,null));};var utilLicense=require('../../config/license/util');exports[_0x2409('0x73')]=function(_0x566006,_0x5719b2,_0x5911c0){var _0x33889c='server/files/images/logos';var _0xe28922={'custom':![]};return utilLicense[_0x2409('0x58')]()['then'](function(_0x34cb10){if(_0x34cb10){_0xe28922=_0x34cb10;}return db['Setting'][_0x2409('0x4f')]({'where':{'id':_0x566006[_0x2409('0x4c')]['id']},'attributes':['logo',_0x2409('0x56'),_0x2409('0x6a'),_0x2409('0x59'),'defaultLogo',_0x2409('0x5b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x2409('0x19')](handleEntityNotFound(_0x5719b2,null))['then'](function(_0x110c04){if(_0x110c04){var _0xd6f128=_0x110c04[_0x2409('0x59')]&&fs['existsSync'](path['join'](config[_0x2409('0x60')],_0x33889c,_[_0x2409('0x61')](_0x110c04[_0x2409('0x59')])))?path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x33889c,_[_0x2409('0x61')](_0x110c04[_0x2409('0x59')])):path[_0x2409('0x5f')](config['root'],_0x33889c,_[_0x2409('0x61')](_0x2409('0x74')));var _0x144527=_0x2409('0x63')+_['upperFirst']('favicon');if(_0x110c04[_0x144527]||!_0xe28922[_0x2409('0x65')]){_0xd6f128=path[_0x2409('0x5f')](config[_0x2409('0x60')],_0x33889c,_[_0x2409('0x61')](_0x2409('0x74')));}if(!fs[_0x2409('0x5e')](_0xd6f128)){throw new db['Sequelize'][(_0x2409('0x66'))](_['upperFirst'](_0x2409('0x59'))+_0x2409('0x67'));}return _0x5719b2[_0x2409('0x68')](_0xd6f128);}})[_0x2409('0x22')](handleError(_0x5719b2,null));};exports[_0x2409('0x75')]=function(_0x41b107,_0x1cbc64){var _0x1545e0={'offset':moment()['utcOffset']()};_0x1545e0[_0x2409('0x76')]=moment()['utcOffset'](_0x1545e0['offset'])[_0x2409('0x77')](_0x2409('0x78'));return _0x1cbc64[_0x2409('0x24')](0xc8)['send'](_0x1545e0);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 4855391..347bfb8 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x55ca,0x126));var _0xa55c=function(_0x1466ba,_0x4cd93e){_0x1466ba=_0x1466ba-0x0;var _0x56a71b=_0x55ca[_0x1466ba];return _0x56a71b;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 805a234..a84dcf6 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 _0x0ee9=['stringify','error','code','message','catch','ShowSetting','Setting','options','raw','where','attributes','map','include','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x428f5d,_0x212901){var _0x424cf3=function(_0x769874){while(--_0x769874){_0x428f5d['push'](_0x428f5d['shift']());}};_0x424cf3(++_0x212901);}(_0x0ee9,0x13b));var _0x90ee=function(_0x2a27b3,_0x266dff){_0x2a27b3=_0x2a27b3-0x0;var _0xf8e1b1=_0x0ee9[_0x2a27b3];return _0xf8e1b1;};'use strict';var _=require(_0x90ee('0x0'));var util=require(_0x90ee('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90ee('0x2'));var fs=require('fs');var Redis=require(_0x90ee('0x3'));var db=require(_0x90ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x90ee('0x5'))(_0x90ee('0x6'));var config=require('../../config/environment');var jayson=require(_0x90ee('0x7'));var client=jayson['client'][_0x90ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1310c0,_0x275622,_0x485a9d){return new BPromise(function(_0x1c65e3,_0x30ffc9){return client[_0x90ee('0x9')](_0x1310c0,_0x485a9d)['then'](function(_0x4f380a){logger[_0x90ee('0xa')](_0x90ee('0xb'),_0x275622,'request\x20sent');logger[_0x90ee('0xc')](_0x90ee('0xd'),_0x275622,_0x90ee('0xe'),JSON[_0x90ee('0xf')](_0x4f380a));if(_0x4f380a['error']){if(_0x4f380a[_0x90ee('0x10')][_0x90ee('0x11')]===0x1f4){logger[_0x90ee('0x10')]('Setting,\x20%s,\x20%s',_0x275622,_0x4f380a[_0x90ee('0x10')][_0x90ee('0x12')]);return _0x30ffc9(_0x4f380a[_0x90ee('0x10')]['message']);}logger[_0x90ee('0x10')]('Setting,\x20%s,\x20%s',_0x275622,_0x4f380a['error'][_0x90ee('0x12')]);return _0x1c65e3(_0x4f380a['error'][_0x90ee('0x12')]);}else{logger[_0x90ee('0xa')]('Setting,\x20%s,\x20%s',_0x275622,_0x90ee('0xe'));_0x1c65e3(_0x4f380a['result'][_0x90ee('0x12')]);}})[_0x90ee('0x13')](function(_0xd0729f){logger[_0x90ee('0x10')](_0x90ee('0xb'),_0x275622,_0xd0729f);_0x30ffc9(_0xd0729f);});});}exports[_0x90ee('0x14')]=function(_0x11ecbb){var _0x3fb770=this;return new Promise(function(_0x4c5737,_0x40231b){return db[_0x90ee('0x15')]['find']({'raw':_0x11ecbb[_0x90ee('0x16')]?_0x11ecbb['options'][_0x90ee('0x17')]===undefined?!![]:![]:!![],'where':_0x11ecbb[_0x90ee('0x16')]?_0x11ecbb['options'][_0x90ee('0x18')]||null:null,'attributes':_0x11ecbb[_0x90ee('0x16')]?_0x11ecbb[_0x90ee('0x16')][_0x90ee('0x19')]||null:null,'include':_0x11ecbb['options']?_0x11ecbb[_0x90ee('0x16')]['include']?_[_0x90ee('0x1a')](_0x11ecbb[_0x90ee('0x16')][_0x90ee('0x1b')],function(_0x4c1548){return{'model':db[_0x4c1548[_0x90ee('0x1c')]],'as':_0x4c1548['as'],'attributes':_0x4c1548[_0x90ee('0x19')],'include':_0x4c1548['include']?_[_0x90ee('0x1a')](_0x4c1548[_0x90ee('0x1b')],function(_0x207efa){return{'model':db[_0x207efa[_0x90ee('0x1c')]],'as':_0x207efa['as'],'attributes':_0x207efa[_0x90ee('0x19')],'include':_0x207efa['include']?_[_0x90ee('0x1a')](_0x207efa['include'],function(_0x2b3da6){return{'model':db[_0x2b3da6[_0x90ee('0x1c')]],'as':_0x2b3da6['as'],'attributes':_0x2b3da6['attributes']};}):[]};}):[]};}):[]:[]})[_0x90ee('0x1d')](function(_0x35679d){logger[_0x90ee('0xa')](_0x90ee('0x14'),_0x11ecbb);logger['debug'](_0x90ee('0x14'),_0x11ecbb,JSON[_0x90ee('0xf')](_0x35679d));_0x4c5737(_0x35679d);})[_0x90ee('0x13')](function(_0x299a2c){logger[_0x90ee('0x10')]('ShowSetting',_0x299a2c[_0x90ee('0x12')],_0x11ecbb);_0x40231b(_0x3fb770['error'](0x1f4,_0x299a2c[_0x90ee('0x12')]));});});}; \ No newline at end of file +var _0xe896=['include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSetting','Setting','find','options','raw','where','attributes'];(function(_0x58b62c,_0x3618){var _0x4c36b3=function(_0x2e7f10){while(--_0x2e7f10){_0x58b62c['push'](_0x58b62c['shift']());}};_0x4c36b3(++_0x3618);}(_0xe896,0x87));var _0x6e89=function(_0x148bbc,_0x42cca4){_0x148bbc=_0x148bbc-0x0;var _0x1d7e76=_0xe896[_0x148bbc];return _0x1d7e76;};'use strict';var _=require(_0x6e89('0x0'));var util=require(_0x6e89('0x1'));var moment=require(_0x6e89('0x2'));var BPromise=require(_0x6e89('0x3'));var rs=require(_0x6e89('0x4'));var fs=require('fs');var Redis=require(_0x6e89('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6e89('0x6'))(_0x6e89('0x7'));var config=require(_0x6e89('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6e89('0x9')][_0x6e89('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55cfe1,_0x5e1b21,_0x2b59c8){return new BPromise(function(_0x47ae95,_0x4aa773){return client[_0x6e89('0xb')](_0x55cfe1,_0x2b59c8)[_0x6e89('0xc')](function(_0x4b85e8){logger[_0x6e89('0xd')](_0x6e89('0xe'),_0x5e1b21,_0x6e89('0xf'));logger[_0x6e89('0x10')](_0x6e89('0x11'),_0x5e1b21,_0x6e89('0xf'),JSON[_0x6e89('0x12')](_0x4b85e8));if(_0x4b85e8[_0x6e89('0x13')]){if(_0x4b85e8[_0x6e89('0x13')][_0x6e89('0x14')]===0x1f4){logger[_0x6e89('0x13')](_0x6e89('0xe'),_0x5e1b21,_0x4b85e8[_0x6e89('0x13')][_0x6e89('0x15')]);return _0x4aa773(_0x4b85e8[_0x6e89('0x13')][_0x6e89('0x15')]);}logger[_0x6e89('0x13')](_0x6e89('0xe'),_0x5e1b21,_0x4b85e8[_0x6e89('0x13')][_0x6e89('0x15')]);return _0x47ae95(_0x4b85e8['error'][_0x6e89('0x15')]);}else{logger[_0x6e89('0xd')](_0x6e89('0xe'),_0x5e1b21,_0x6e89('0xf'));_0x47ae95(_0x4b85e8['result'][_0x6e89('0x15')]);}})[_0x6e89('0x16')](function(_0x47d07e){logger['error'](_0x6e89('0xe'),_0x5e1b21,_0x47d07e);_0x4aa773(_0x47d07e);});});}exports[_0x6e89('0x17')]=function(_0x138692){var _0x58afc3=this;return new Promise(function(_0x571857,_0x4ee90f){return db[_0x6e89('0x18')][_0x6e89('0x19')]({'raw':_0x138692['options']?_0x138692[_0x6e89('0x1a')][_0x6e89('0x1b')]===undefined?!![]:![]:!![],'where':_0x138692[_0x6e89('0x1a')]?_0x138692[_0x6e89('0x1a')][_0x6e89('0x1c')]||null:null,'attributes':_0x138692['options']?_0x138692[_0x6e89('0x1a')][_0x6e89('0x1d')]||null:null,'include':_0x138692[_0x6e89('0x1a')]?_0x138692[_0x6e89('0x1a')][_0x6e89('0x1e')]?_['map'](_0x138692['options'][_0x6e89('0x1e')],function(_0x5115de){return{'model':db[_0x5115de['model']],'as':_0x5115de['as'],'attributes':_0x5115de[_0x6e89('0x1d')],'include':_0x5115de['include']?_[_0x6e89('0x1f')](_0x5115de['include'],function(_0xe92c69){return{'model':db[_0xe92c69[_0x6e89('0x20')]],'as':_0xe92c69['as'],'attributes':_0xe92c69[_0x6e89('0x1d')],'include':_0xe92c69[_0x6e89('0x1e')]?_[_0x6e89('0x1f')](_0xe92c69['include'],function(_0xa661b8){return{'model':db[_0xa661b8[_0x6e89('0x20')]],'as':_0xa661b8['as'],'attributes':_0xa661b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e89('0xc')](function(_0x2e1e63){logger['info'](_0x6e89('0x17'),_0x138692);logger[_0x6e89('0x10')](_0x6e89('0x17'),_0x138692,JSON[_0x6e89('0x12')](_0x2e1e63));_0x571857(_0x2e1e63);})[_0x6e89('0x16')](function(_0x2ed978){logger['error'](_0x6e89('0x17'),_0x2ed978[_0x6e89('0x15')],_0x138692);_0x4ee90f(_0x58afc3[_0x6e89('0x13')](0x1f4,_0x2ed978[_0x6e89('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index c73d4b6..d03eff7 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(_0x5e48c6,_0x45914c){var _0x87633e=function(_0x1213f5){while(--_0x1213f5){_0x5e48c6['push'](_0x5e48c6['shift']());}};_0x87633e(++_0x45914c);}(_0x53ec,0x192));var _0xc53e=function(_0x33337f,_0x5d7319){_0x33337f=_0x33337f-0x0;var _0x3d9d50=_0x53ec[_0x33337f];return _0x3d9d50;};'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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x342891,_0x33d3e0){var _0x383330=function(_0x56a5af){while(--_0x56a5af){_0x342891['push'](_0x342891['shift']());}};_0x383330(++_0x33d3e0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'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['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 50107da..09bc021 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 _0xe1e0=['generate','ENUM','twilio','skebby','connectel','clicksend','plivo','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x31b3d1,_0x4ff4d4){var _0x32413c=function(_0x90fe2){while(--_0x90fe2){_0x31b3d1['push'](_0x31b3d1['shift']());}};_0x32413c(++_0x4ff4d4);}(_0xe1e0,0x1b5));var _0x0e1e=function(_0x4c4a26,_0x40f231){_0x4c4a26=_0x4c4a26-0x0;var _0x4c167b=_0xe1e0[_0x4c4a26];return _0x4c167b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x0e1e('0x0'));module[_0x0e1e('0x1')]={'name':{'type':Sequelize[_0x0e1e('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x0e1e('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0e1e('0x3')]();}},'phone':{'type':Sequelize[_0x0e1e('0x2')]},'type':{'type':Sequelize[_0x0e1e('0x4')](_0x0e1e('0x5'),_0x0e1e('0x6'),_0x0e1e('0x7'),_0x0e1e('0x8'),_0x0e1e('0x9'),'clickatell','bandwidth','csc',_0x0e1e('0xa'),_0x0e1e('0xb'))},'accountSid':{'type':Sequelize[_0x0e1e('0x2')]},'authId':{'type':Sequelize[_0x0e1e('0x2')]},'authToken':{'type':Sequelize[_0x0e1e('0x2')]},'smsMethod':{'type':Sequelize[_0x0e1e('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0e1e('0x2')]},'password':{'type':Sequelize[_0x0e1e('0x2')]},'apiKey':{'type':Sequelize[_0x0e1e('0x2')]},'applicationId':{'type':Sequelize[_0x0e1e('0x2')]},'accountId':{'type':Sequelize[_0x0e1e('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x0e1e('0xc')],'defaultValue':function(){return _0x0e1e('0xd');}},'notificationSound':{'type':Sequelize[_0x0e1e('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0e1e('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0e1e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0e1e('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0e1e('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e1e('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0e1e('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0e1e('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x0e1e('0xe')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x29d280){if(!_0x29d280)this[_0x0e1e('0x11')](_0x0e1e('0x12'),null);this[_0x0e1e('0x11')](_0x0e1e('0x13'),_0x29d280);}}}; \ No newline at end of file +var _0x566b=['connectel','clicksend','clickatell','csc','infobip','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','name','STRING','generate','ENUM','twilio'];(function(_0x20f201,_0x4fc563){var _0x39f1e8=function(_0x1137c6){while(--_0x1137c6){_0x20f201['push'](_0x20f201['shift']());}};_0x39f1e8(++_0x4fc563);}(_0x566b,0x116));var _0xb566=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x566b[_0x2f9467];return _0x39894c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb566('0x0'));module[_0xb566('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb566('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xb566('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xb566('0x3')],'defaultValue':function(){return rs[_0xb566('0x4')]();}},'phone':{'type':Sequelize[_0xb566('0x3')]},'type':{'type':Sequelize[_0xb566('0x5')](_0xb566('0x6'),'skebby',_0xb566('0x7'),_0xb566('0x8'),'plivo',_0xb566('0x9'),'bandwidth',_0xb566('0xa'),_0xb566('0xb'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0xb566('0x3')]},'authToken':{'type':Sequelize[_0xb566('0x3')]},'smsMethod':{'type':Sequelize[_0xb566('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xb566('0x3')]},'password':{'type':Sequelize[_0xb566('0x3')]},'apiKey':{'type':Sequelize[_0xb566('0x3')]},'applicationId':{'type':Sequelize[_0xb566('0x3')]},'accountId':{'type':Sequelize[_0xb566('0x3')]},'senderString':{'type':Sequelize[_0xb566('0x3')]},'deliveryReport':{'type':Sequelize[_0xb566('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0xb566('0x3')]},'notificationTemplate':{'type':Sequelize[_0xb566('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb566('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb566('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb566('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb566('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xb566('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb566('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb566('0x10'),'set':function(_0x10cb47){if(!_0x10cb47)this[_0xb566('0x11')]('mandatoryDispositionPauseId',null);this[_0xb566('0x11')](_0xb566('0x12'),_0x10cb47);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 592d396..b236324 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 _0x47cc=['getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','info','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','get','UserProfileResource','end','stack','name','send','index','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','rows','show','params','Pause','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','mandatoryDispositionPause','describe','addDisposition','SmsAccountId','Disposition','findOne','order','findAll','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','sms','SmsApplication','Applications','account','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','MessageSid','skebby','sender','text','clicksend','messageId','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','defaults','contact','SmsInteraction','spread','interaction','autoclose','close','unmanaged','*,*,*,*','created','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally'];(function(_0xbef932,_0x110050){var _0x337f0e=function(_0x50c0a7){while(--_0x50c0a7){_0xbef932['push'](_0xbef932['shift']());}};_0x337f0e(++_0x110050);}(_0x47cc,0x1f4));var _0xc47c=function(_0x370570,_0x53d909){_0x370570=_0x370570-0x0;var _0x114222=_0x47cc[_0x370570];return _0x114222;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc47c('0x0'));var zipdir=require(_0xc47c('0x1'));var jsonpatch=require(_0xc47c('0x2'));var rp=require(_0xc47c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc47c('0x4'));var util=require(_0xc47c('0x5'));var path=require('path');var sox=require(_0xc47c('0x6'));var csv=require(_0xc47c('0x7'));var ejs=require(_0xc47c('0x8'));var fs=require('fs');var fs_extra=require(_0xc47c('0x9'));var _=require(_0xc47c('0xa'));var squel=require(_0xc47c('0xb'));var crypto=require(_0xc47c('0xc'));var jsforce=require(_0xc47c('0xd'));var deskjs=require(_0xc47c('0xe'));var toCsv=require(_0xc47c('0x7'));var querystring=require(_0xc47c('0xf'));var Papa=require(_0xc47c('0x10'));var Redis=require(_0xc47c('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc47c('0x12'));var hardwareService=require(_0xc47c('0x13'));var logger=require(_0xc47c('0x14'))(_0xc47c('0x15'));var utils=require(_0xc47c('0x16'));var config=require(_0xc47c('0x17'));var licenseUtil=require(_0xc47c('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc47c('0x19')],{'host':_0xc47c('0x1a'),'port':0x18eb});var socket=require(_0xc47c('0x1b'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xc47c('0x1c')](socket);var jayson=require(_0xc47c('0x1d'));var client=jayson[_0xc47c('0x1e')][_0xc47c('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x30c78d,_0x17d850,_0x26dda6,_0x1ee6de){return new BPromise(function(_0x5e35c3,_0x310a68){var _0x5c5208=_0x1ee6de||client;return _0x5c5208[_0xc47c('0x20')](_0x30c78d,_0x26dda6)[_0xc47c('0x21')](function(_0xa79891){logger['info']('SmsAccount,\x20%s,\x20%s',_0x17d850,_0xc47c('0x22'));logger[_0xc47c('0x23')](_0xc47c('0x24'),_0x17d850,_0xc47c('0x22'),JSON[_0xc47c('0x25')](_0xa79891));if(_0xa79891['error']){if(_0xa79891['error'][_0xc47c('0x26')]===0x1f4){logger[_0xc47c('0x27')](_0xc47c('0x28'),_0x17d850,_0xa79891[_0xc47c('0x27')][_0xc47c('0x29')]);return _0x310a68(_0xa79891[_0xc47c('0x27')][_0xc47c('0x29')]);}logger[_0xc47c('0x27')]('SmsAccount,\x20%s,\x20%s',_0x17d850,_0xa79891[_0xc47c('0x27')][_0xc47c('0x29')]);return _0x5e35c3(_0xa79891[_0xc47c('0x27')][_0xc47c('0x29')]);}else{logger[_0xc47c('0x2a')](_0xc47c('0x28'),_0x17d850,_0xc47c('0x22'));_0x5e35c3(_0xa79891['result'][_0xc47c('0x29')]);}})[_0xc47c('0x2b')](function(_0x47124a){logger[_0xc47c('0x27')]('SmsAccount,\x20%s,\x20%s',_0x17d850,_0x47124a);_0x310a68(_0x47124a);});});}function respondWithStatusCode(_0x51dad4,_0x12150d){_0x12150d=_0x12150d||0xcc;return function(_0x67bf58){if(_0x67bf58){return _0x51dad4[_0xc47c('0x2c')](_0x12150d);}return _0x51dad4[_0xc47c('0x2d')](_0x12150d)['end']();};}function respondWithResult(_0x5b2438,_0x5ce58f){_0x5ce58f=_0x5ce58f||0xc8;return function(_0x2e1af6){if(_0x2e1af6){return _0x5b2438[_0xc47c('0x2d')](_0x5ce58f)[_0xc47c('0x2e')](_0x2e1af6);}};}function respondWithFilteredResult(_0x1cd21d,_0x12adac){return function(_0x139112){if(_0x139112){var _0x37a906=typeof _0x12adac[_0xc47c('0x2f')]===_0xc47c('0x30')&&typeof _0x12adac[_0xc47c('0x31')]===_0xc47c('0x30');var _0x2cd928=_0x139112['count'];var _0x148b19=_0x37a906?0x0:_0x12adac[_0xc47c('0x2f')];var _0x37a444=_0x37a906?_0x139112[_0xc47c('0x32')]:_0x12adac['offset']+_0x12adac[_0xc47c('0x31')];var _0xe4ff7;if(_0x37a444>=_0x2cd928){_0x37a444=_0x2cd928;_0xe4ff7=0xc8;}else{_0xe4ff7=0xce;}_0x1cd21d[_0xc47c('0x2d')](_0xe4ff7);return _0x1cd21d['set'](_0xc47c('0x33'),_0x148b19+'-'+_0x37a444+'/'+_0x2cd928)[_0xc47c('0x2e')](_0x139112);}return null;};}function patchUpdates(_0x413ec4){return function(_0x271350){try{jsonpatch[_0xc47c('0x34')](_0x271350,_0x413ec4,!![]);}catch(_0x200a4f){return BPromise[_0xc47c('0x35')](_0x200a4f);}return _0x271350['save']();};}function saveUpdates(_0x12ccf9,_0x8377c){return function(_0x2111b8){if(_0x2111b8){return _0x2111b8['update'](_0x12ccf9)['then'](function(_0x10c5ec){return _0x10c5ec;});}return null;};}function removeEntity(_0x54f7e4,_0xd3021){return function(_0x5bb280){if(_0x5bb280){return _0x5bb280[_0xc47c('0x36')]()['then'](function(){var _0x33852b=_0x5bb280[_0xc47c('0x37')]({'plain':!![]});var _0x1cf0bc='SmsAccounts';return db[_0xc47c('0x38')]['destroy']({'where':{'type':_0x1cf0bc,'resourceId':_0x33852b['id']}})[_0xc47c('0x21')](function(){return _0x5bb280;});})[_0xc47c('0x21')](function(){_0x54f7e4[_0xc47c('0x2d')](0xcc)[_0xc47c('0x39')]();});}};}function handleEntityNotFound(_0x30a937,_0x4f3c14){return function(_0x4e54db){if(!_0x4e54db){_0x30a937[_0xc47c('0x2c')](0x194);}return _0x4e54db;};}function handleError(_0x52c7dd,_0x2d1500){_0x2d1500=_0x2d1500||0x1f4;return function(_0x1b5fca){logger[_0xc47c('0x27')](_0x1b5fca[_0xc47c('0x3a')]);if(_0x1b5fca['name']){delete _0x1b5fca[_0xc47c('0x3b')];}_0x52c7dd[_0xc47c('0x2d')](_0x2d1500)[_0xc47c('0x3c')](_0x1b5fca);};}exports[_0xc47c('0x3d')]=function(_0x217880,_0xae5cda){var _0x1b12dd={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x509e69={},_0x442a7b={'count':0x0,'rows':[]};var _0x419200=_[_0xc47c('0x3e')](db[_0xc47c('0x3f')][_0xc47c('0x40')],function(_0x3d3f62){return{'name':_0x3d3f62['fieldName'],'type':_0x3d3f62[_0xc47c('0x41')][_0xc47c('0x42')]};});_0x509e69[_0xc47c('0x43')]=_[_0xc47c('0x3e')](_0x419200,_0xc47c('0x3b'));_0x509e69[_0xc47c('0x44')]=_[_0xc47c('0x45')](_0x217880[_0xc47c('0x44')]);_0x509e69[_0xc47c('0x46')]=_[_0xc47c('0x47')](_0x509e69[_0xc47c('0x43')],_0x509e69['query']);_0x1b12dd['attributes']=_[_0xc47c('0x47')](_0x509e69[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0x217880[_0xc47c('0x44')][_0xc47c('0x48')]));_0x1b12dd[_0xc47c('0x49')]=_0x1b12dd['attributes'][_0xc47c('0x4a')]?_0x1b12dd[_0xc47c('0x49')]:_0x509e69[_0xc47c('0x43')];if(!_0x217880[_0xc47c('0x44')][_0xc47c('0x4b')](_0xc47c('0x4c'))){_0x1b12dd[_0xc47c('0x31')]=qs['limit'](_0x217880[_0xc47c('0x44')][_0xc47c('0x31')]);_0x1b12dd[_0xc47c('0x2f')]=qs[_0xc47c('0x2f')](_0x217880[_0xc47c('0x44')][_0xc47c('0x2f')]);}_0x1b12dd['order']=qs[_0xc47c('0x4d')](_0x217880[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x1b12dd[_0xc47c('0x4e')]=qs[_0xc47c('0x46')](_[_0xc47c('0x4f')](_0x217880[_0xc47c('0x44')],_0x509e69['filters']),_0x419200);if(_0x217880[_0xc47c('0x44')][_0xc47c('0x50')]){_0x1b12dd[_0xc47c('0x4e')]=_[_0xc47c('0x51')](_0x1b12dd[_0xc47c('0x4e')],{'$or':_[_0xc47c('0x3e')](_0x419200,function(_0x2ee528){if(_0x2ee528[_0xc47c('0x41')]!=='VIRTUAL'){var _0x3f04a1={};_0x3f04a1[_0x2ee528[_0xc47c('0x3b')]]={'$like':'%'+_0x217880[_0xc47c('0x44')][_0xc47c('0x50')]+'%'};return _0x3f04a1;}})});}_0x1b12dd=_[_0xc47c('0x51')]({},_0x1b12dd,_0x217880[_0xc47c('0x52')]);var _0x195c51={'where':_0x1b12dd[_0xc47c('0x4e')]};return db[_0xc47c('0x3f')][_0xc47c('0x32')](_0x195c51)[_0xc47c('0x21')](function(_0x2b70b8){_0x442a7b[_0xc47c('0x32')]=_0x2b70b8;if(_0x217880[_0xc47c('0x44')]['includeAll']){_0x1b12dd[_0xc47c('0x53')]=[{'all':!![]}];}return db[_0xc47c('0x3f')]['findAll'](_0x1b12dd);})['then'](function(_0x39083){_0x442a7b[_0xc47c('0x54')]=_0x39083;return _0x442a7b;})['then'](respondWithFilteredResult(_0xae5cda,_0x1b12dd))['catch'](handleError(_0xae5cda,null));};exports[_0xc47c('0x55')]=function(_0xaec1b2,_0x167f10){var _0x1d3df6={'raw':![],'where':{'id':_0xaec1b2[_0xc47c('0x56')]['id']},'include':[{'model':db[_0xc47c('0x57')],'as':'mandatoryDispositionPause'}]},_0x4f39c8={};_0x4f39c8['model']=_['keys'](db[_0xc47c('0x3f')][_0xc47c('0x40')]);_0x4f39c8[_0xc47c('0x44')]=_[_0xc47c('0x45')](_0xaec1b2[_0xc47c('0x44')]);_0x4f39c8[_0xc47c('0x46')]=_[_0xc47c('0x47')](_0x4f39c8['model'],_0x4f39c8[_0xc47c('0x44')]);_0x1d3df6['attributes']=_[_0xc47c('0x47')](_0x4f39c8[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0xaec1b2['query'][_0xc47c('0x48')]));_0x1d3df6[_0xc47c('0x49')]=_0x1d3df6[_0xc47c('0x49')][_0xc47c('0x4a')]?_0x1d3df6[_0xc47c('0x49')]:_0x4f39c8[_0xc47c('0x43')];if(_0xaec1b2[_0xc47c('0x44')][_0xc47c('0x58')]){_0x1d3df6[_0xc47c('0x53')]=[{'all':!![]}];}_0x1d3df6=_['merge']({},_0x1d3df6,_0xaec1b2[_0xc47c('0x52')]);return db[_0xc47c('0x3f')][_0xc47c('0x59')](_0x1d3df6)['then'](handleEntityNotFound(_0x167f10,null))[_0xc47c('0x21')](respondWithResult(_0x167f10,null))[_0xc47c('0x2b')](handleError(_0x167f10,null));};exports[_0xc47c('0x5a')]=function(_0x5b11b7,_0x280f74){return db[_0xc47c('0x3f')][_0xc47c('0x5a')](_0x5b11b7[_0xc47c('0x5b')],{})['then'](function(_0x53da07){var _0x578382=_0x5b11b7['user'][_0xc47c('0x37')]({'plain':!![]});if(!_0x578382)throw new Error(_0xc47c('0x5c'));if(_0x578382[_0xc47c('0x5d')]==='user'){var _0x49e909=_0x53da07[_0xc47c('0x37')]({'plain':!![]});var _0x523b0b=_0xc47c('0x5e');return db[_0xc47c('0x5f')]['find']({'where':{'name':_0x523b0b,'userProfileId':_0x578382['userProfileId']},'raw':!![]})[_0xc47c('0x21')](function(_0x3b3432){if(_0x3b3432&&_0x3b3432['autoAssociation']===0x0){return db[_0xc47c('0x38')][_0xc47c('0x5a')]({'name':_0x49e909[_0xc47c('0x3b')],'resourceId':_0x49e909['id'],'type':_0x3b3432[_0xc47c('0x3b')],'sectionId':_0x3b3432['id']},{})[_0xc47c('0x21')](function(){return _0x53da07;});}else{return _0x53da07;}})['catch'](function(_0x51412d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51412d);throw _0x51412d;});}return _0x53da07;})[_0xc47c('0x21')](respondWithResult(_0x280f74,0xc9))[_0xc47c('0x2b')](handleError(_0x280f74,null));};exports['update']=function(_0x20d4ec,_0x4c1396){if(_0x20d4ec[_0xc47c('0x5b')]['id']){delete _0x20d4ec[_0xc47c('0x5b')]['id'];}return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x20d4ec['params']['id']},'include':[{'model':db[_0xc47c('0x57')],'as':_0xc47c('0x60')}]})[_0xc47c('0x21')](handleEntityNotFound(_0x4c1396,null))[_0xc47c('0x21')](saveUpdates(_0x20d4ec['body'],null))[_0xc47c('0x21')](respondWithResult(_0x4c1396,null))[_0xc47c('0x2b')](handleError(_0x4c1396,null));};exports[_0xc47c('0x36')]=function(_0x5b4352,_0x2092ef){return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x5b4352[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x2092ef,null))[_0xc47c('0x21')](removeEntity(_0x2092ef,null))[_0xc47c('0x2b')](handleError(_0x2092ef,null));};exports[_0xc47c('0x61')]=function(_0x186fc4,_0xa36b4b){return db[_0xc47c('0x3f')][_0xc47c('0x61')]()[_0xc47c('0x21')](respondWithResult(_0xa36b4b,null))['catch'](handleError(_0xa36b4b,null));};exports[_0xc47c('0x62')]=function(_0x5fc3d1,_0x2c1696,_0x5e6850){if(_0x5fc3d1[_0xc47c('0x5b')]['id']){delete _0x5fc3d1[_0xc47c('0x5b')]['id'];}return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x5fc3d1[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x2c1696,null))['then'](function(_0x3b18a){if(_0x3b18a){_0x5fc3d1[_0xc47c('0x5b')][_0xc47c('0x63')]=_0x3b18a['id'];return db[_0xc47c('0x64')]['create'](_0x5fc3d1[_0xc47c('0x5b')]);}})['then'](respondWithResult(_0x2c1696,null))['catch'](handleError(_0x2c1696,null));};exports['getDispositions']=function(_0x599b70,_0x3ef75a,_0x2202af){var _0x169cf1={'raw':![],'where':{}};var _0x197a7e={};var _0x5ea764={'count':0x0,'rows':[]};return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x599b70['params']['id']}})['then'](handleEntityNotFound(_0x3ef75a,null))[_0xc47c('0x21')](function(_0x2beb79){if(_0x2beb79){_0x197a7e[_0xc47c('0x43')]=_[_0xc47c('0x45')](db['Disposition']['rawAttributes']);_0x197a7e[_0xc47c('0x44')]=_['keys'](_0x599b70[_0xc47c('0x44')]);_0x197a7e['filters']=_['intersection'](_0x197a7e[_0xc47c('0x43')],_0x197a7e['query']);_0x169cf1[_0xc47c('0x49')]=_[_0xc47c('0x47')](_0x197a7e['model'],qs[_0xc47c('0x48')](_0x599b70[_0xc47c('0x44')][_0xc47c('0x48')]));_0x169cf1[_0xc47c('0x49')]=_0x169cf1[_0xc47c('0x49')][_0xc47c('0x4a')]?_0x169cf1[_0xc47c('0x49')]:_0x197a7e['model'];if(!_0x599b70[_0xc47c('0x44')][_0xc47c('0x4b')](_0xc47c('0x4c'))){_0x169cf1[_0xc47c('0x31')]=qs[_0xc47c('0x31')](_0x599b70[_0xc47c('0x44')]['limit']);_0x169cf1[_0xc47c('0x2f')]=qs[_0xc47c('0x2f')](_0x599b70[_0xc47c('0x44')][_0xc47c('0x2f')]);}_0x169cf1[_0xc47c('0x66')]=qs[_0xc47c('0x4d')](_0x599b70[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x169cf1[_0xc47c('0x4e')]=qs[_0xc47c('0x46')](_[_0xc47c('0x4f')](_0x599b70['query'],_0x197a7e['filters']));_0x169cf1[_0xc47c('0x4e')]['SmsAccountId']=_0x2beb79['id'];if(_0x599b70[_0xc47c('0x44')]['filter']){_0x169cf1['where']=_[_0xc47c('0x51')](_0x169cf1[_0xc47c('0x4e')],{'$or':_[_0xc47c('0x3e')](_0x169cf1[_0xc47c('0x49')],function(_0x56458b){var _0x4336ad={};_0x4336ad[_0x56458b]={'$like':'%'+_0x599b70['query'][_0xc47c('0x50')]+'%'};return _0x4336ad;})});}_0x169cf1=_[_0xc47c('0x51')]({},_0x169cf1,_0x599b70['options']);return db[_0xc47c('0x64')][_0xc47c('0x32')]({'where':_0x169cf1[_0xc47c('0x4e')]})[_0xc47c('0x21')](function(_0x3951ac){_0x5ea764[_0xc47c('0x32')]=_0x3951ac;if(_0x599b70['query'][_0xc47c('0x58')]){_0x169cf1[_0xc47c('0x53')]=[{'all':!![]}];}return db[_0xc47c('0x64')][_0xc47c('0x67')](_0x169cf1);})['then'](function(_0x3f3d0c){_0x5ea764[_0xc47c('0x54')]=_0x3f3d0c;return _0x5ea764;});}})[_0xc47c('0x21')](respondWithFilteredResult(_0x3ef75a,_0x169cf1))[_0xc47c('0x2b')](handleError(_0x3ef75a,null));};exports[_0xc47c('0x68')]=function(_0x2dbddc,_0xa01ea2,_0x1eb800){return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x2dbddc[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0xa01ea2,null))[_0xc47c('0x21')](function(_0x4b94c4){if(_0x4b94c4){return _0x4b94c4[_0xc47c('0x68')](_0x2dbddc[_0xc47c('0x44')]['ids']);}})[_0xc47c('0x21')](respondWithStatusCode(_0xa01ea2,null))[_0xc47c('0x2b')](handleError(_0xa01ea2,null));};exports['addAnswer']=function(_0x159abf,_0x37e482,_0x1a2cd8){if(_0x159abf['body']['id']){delete _0x159abf[_0xc47c('0x5b')]['id'];}return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x159abf['params']['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x37e482,null))['then'](function(_0x1c6422){if(_0x1c6422){_0x159abf['body'][_0xc47c('0x63')]=_0x1c6422['id'];return db[_0xc47c('0x69')][_0xc47c('0x5a')](_0x159abf[_0xc47c('0x5b')]);}})[_0xc47c('0x21')](respondWithResult(_0x37e482,null))[_0xc47c('0x2b')](handleError(_0x37e482,null));};exports[_0xc47c('0x6a')]=function(_0x3cf8b6,_0x167508,_0x25e83d){var _0x40bca6={'raw':![],'where':{}};var _0xd9fe5={};var _0x3435d1={'count':0x0,'rows':[]};return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x3cf8b6[_0xc47c('0x56')]['id']}})['then'](handleEntityNotFound(_0x167508,null))[_0xc47c('0x21')](function(_0x28fa73){if(_0x28fa73){_0xd9fe5[_0xc47c('0x43')]=_[_0xc47c('0x45')](db[_0xc47c('0x69')][_0xc47c('0x40')]);_0xd9fe5['query']=_[_0xc47c('0x45')](_0x3cf8b6[_0xc47c('0x44')]);_0xd9fe5['filters']=_[_0xc47c('0x47')](_0xd9fe5[_0xc47c('0x43')],_0xd9fe5[_0xc47c('0x44')]);_0x40bca6[_0xc47c('0x49')]=_[_0xc47c('0x47')](_0xd9fe5[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0x3cf8b6[_0xc47c('0x44')][_0xc47c('0x48')]));_0x40bca6[_0xc47c('0x49')]=_0x40bca6[_0xc47c('0x49')]['length']?_0x40bca6['attributes']:_0xd9fe5['model'];if(!_0x3cf8b6[_0xc47c('0x44')][_0xc47c('0x4b')]('nolimit')){_0x40bca6[_0xc47c('0x31')]=qs[_0xc47c('0x31')](_0x3cf8b6['query']['limit']);_0x40bca6[_0xc47c('0x2f')]=qs[_0xc47c('0x2f')](_0x3cf8b6['query'][_0xc47c('0x2f')]);}_0x40bca6[_0xc47c('0x66')]=qs[_0xc47c('0x4d')](_0x3cf8b6[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x40bca6[_0xc47c('0x4e')]=qs[_0xc47c('0x46')](_[_0xc47c('0x4f')](_0x3cf8b6['query'],_0xd9fe5['filters']));_0x40bca6[_0xc47c('0x4e')]['SmsAccountId']=_0x28fa73['id'];if(_0x3cf8b6[_0xc47c('0x44')][_0xc47c('0x50')]){_0x40bca6[_0xc47c('0x4e')]=_[_0xc47c('0x51')](_0x40bca6[_0xc47c('0x4e')],{'$or':_['map'](_0x40bca6[_0xc47c('0x49')],function(_0x326a00){var _0xc0c451={};_0xc0c451[_0x326a00]={'$like':'%'+_0x3cf8b6[_0xc47c('0x44')][_0xc47c('0x50')]+'%'};return _0xc0c451;})});}_0x40bca6=_[_0xc47c('0x51')]({},_0x40bca6,_0x3cf8b6[_0xc47c('0x52')]);return db[_0xc47c('0x69')][_0xc47c('0x32')]({'where':_0x40bca6[_0xc47c('0x4e')]})['then'](function(_0x459b65){_0x3435d1['count']=_0x459b65;if(_0x3cf8b6['query'][_0xc47c('0x58')]){_0x40bca6[_0xc47c('0x53')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc47c('0x67')](_0x40bca6);})[_0xc47c('0x21')](function(_0x5b2b4d){_0x3435d1[_0xc47c('0x54')]=_0x5b2b4d;return _0x3435d1;});}})[_0xc47c('0x21')](respondWithFilteredResult(_0x167508,_0x40bca6))[_0xc47c('0x2b')](handleError(_0x167508,null));};exports[_0xc47c('0x6b')]=function(_0x4ca8b0,_0x45190d,_0x1f5a20){return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x4ca8b0['params']['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x45190d,null))['then'](function(_0x2bbaa5){if(_0x2bbaa5){return _0x2bbaa5[_0xc47c('0x6b')](_0x4ca8b0[_0xc47c('0x44')][_0xc47c('0x6c')]);}})[_0xc47c('0x21')](respondWithStatusCode(_0x45190d,null))[_0xc47c('0x2b')](handleError(_0x45190d,null));};exports['notify']=function(_0x5ec5b1,_0x42e7dd,_0x235fde){var _0x2f66ac={'channel':_0xc47c('0x6d')};var _0x5c37d5=[];var _0x1fee1e=[];var _0x30b0d0={};return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x5ec5b1[_0xc47c('0x56')]['id']},'include':[{'model':db[_0xc47c('0x6e')],'as':_0xc47c('0x6f')}]})[_0xc47c('0x21')](handleEntityNotFound(_0x42e7dd,null))[_0xc47c('0x21')](function(_0x715ee0){_0x2f66ac[_0xc47c('0x70')]=_0x715ee0;_0x2f66ac['applications']=_[_0xc47c('0x71')](_0x715ee0['Applications'],[_0xc47c('0x72')],[_0xc47c('0x73')]);if(_0x2f66ac[_0xc47c('0x70')][_0xc47c('0x6f')]){delete _0x2f66ac[_0xc47c('0x70')][_0xc47c('0x6f')];}return db[_0xc47c('0x74')]['describe']();})[_0xc47c('0x21')](function(_0x574935){if(!_0x574935){throw new db[(_0xc47c('0x75'))][(_0xc47c('0x76'))](_0xc47c('0x77'));}_0x5c37d5=_[_0xc47c('0x78')](_['keys'](_0x574935),[_0xc47c('0x79'),_0xc47c('0x7a')]);_0x1fee1e=_['difference'](_['keys'](_0x574935),['createdAt',_0xc47c('0x7a'),_0xc47c('0x7b'),_0xc47c('0x7c')]);_0x2f66ac[_0xc47c('0x5b')]={'mapKey':_0xc47c('0x7d')};if(_0x2f66ac[_0xc47c('0x70')]['type']){switch(_0x2f66ac[_0xc47c('0x70')][_0xc47c('0x41')]){case _0xc47c('0x7e'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1['body'][_0xc47c('0x80')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x81')];_0x2f66ac[_0xc47c('0x5b')]['messageId']=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x82')];break;case _0xc47c('0x83'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]='+'+_0x5ec5b1['body'][_0xc47c('0x84')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1['body'][_0xc47c('0x85')];break;case'connectel':_0x2f66ac[_0xc47c('0x5b')]['from']=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x7f')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x29')];break;case _0xc47c('0x86'):_0x2f66ac[_0xc47c('0x5b')]['from']=_0x5ec5b1['body'][_0xc47c('0x7f')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')]['body'];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x87')]=_0x5ec5b1[_0xc47c('0x5b')]['message_id'];break;case _0xc47c('0x88'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1[_0xc47c('0x5b')]['From'];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x89')];_0x2f66ac['body']['messageId']=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x8a')];break;case _0xc47c('0x8b'):_0x2f66ac['body']['from']='+'+_0x5ec5b1['body']['results'][0x0][_0xc47c('0x7f')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x8c')][0x0][_0xc47c('0x85')];_0x2f66ac['body'][_0xc47c('0x87')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x8c')][0x0][_0xc47c('0x87')];break;case _0xc47c('0x8d'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x8e')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x8f')][_0xc47c('0x29')];break;case _0xc47c('0x90'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x91')];_0x2f66ac[_0xc47c('0x5b')]['body']=_0x5ec5b1['body'][_0xc47c('0x85')];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x87')]=_0x5ec5b1[_0xc47c('0x5b')]['replyMessageId'];break;case _0xc47c('0x92'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x87')]=_0x5ec5b1[_0xc47c('0x5b')][0x0][_0xc47c('0x29')]['id'];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1[_0xc47c('0x5b')][0x0]['message']['from'];_0x2f66ac['body'][_0xc47c('0x5b')]=_0x5ec5b1['body'][0x0]['message'][_0xc47c('0x85')];break;case _0xc47c('0x93'):_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x7f')];_0x2f66ac[_0xc47c('0x5b')]['body']=_0x5ec5b1[_0xc47c('0x5b')]['message'];_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x87')]=_0x5ec5b1[_0xc47c('0x5b')][_0xc47c('0x94')];break;}}if(_0x2f66ac[_0xc47c('0x5b')]['id']){delete _0x2f66ac[_0xc47c('0x5b')]['id'];}if(_[_0xc47c('0x95')](_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')])){throw new db[(_0xc47c('0x75'))]['ValidationError'](_0xc47c('0x96'));}if(_[_0xc47c('0x95')](_0x2f66ac[_0xc47c('0x5b')]['body'])||_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')]===''){throw new db[(_0xc47c('0x75'))][(_0xc47c('0x76'))](_0xc47c('0x97'));}if(_[_0xc47c('0x95')](_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x98')])){throw new db[(_0xc47c('0x75'))][(_0xc47c('0x76'))](_0xc47c('0x99')+_0x1fee1e);}if(!_[_0xc47c('0x9a')](_0x1fee1e,_0x2f66ac['body'][_0xc47c('0x98')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1fee1e);}_0x30b0d0[_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x98')]]=_0x2f66ac['body'][_0xc47c('0x7f')];return db[_0xc47c('0x9b')][_0xc47c('0x59')]({'where':{'id':_0x2f66ac[_0xc47c('0x70')]['ListId']},'include':[{'model':db[_0xc47c('0x74')],'as':_0xc47c('0x9c'),'where':_0x30b0d0,'limit':0x1,'order':[[_0xc47c('0x7a'),_0xc47c('0x9d')]]}]});})['then'](handleEntityNotFound(_0x42e7dd,null))[_0xc47c('0x21')](function(_0x1f8b2c){if(_0x1f8b2c){_0x2f66ac[_0xc47c('0x9e')]=_['omit'](_0x1f8b2c,[_0xc47c('0x9c')]);if(_0x1f8b2c[_0xc47c('0x9c')][_0xc47c('0x4a')]){return _0x1f8b2c[_0xc47c('0x9c')][0x0];}var _0x1c27f4=_[_0xc47c('0x9f')](_0x2f66ac[_0xc47c('0x5b')],{'firstName':_0x2f66ac[_0xc47c('0x5b')]['from'],'ListId':_0x1f8b2c['id']});_0x1c27f4[_0x2f66ac[_0xc47c('0x5b')]['mapKey']]=_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')];return db[_0xc47c('0x74')][_0xc47c('0x5a')](_0x1c27f4,{'fields':_0x5c37d5,'raw':!![]});}})[_0xc47c('0x21')](handleEntityNotFound(_0x42e7dd,null))[_0xc47c('0x21')](function(_0x1fb413){if(_0x1fb413){_0x2f66ac[_0xc47c('0xa0')]=_0x1fb413;var _0x5d7f10={'ContactId':_0x1fb413['id'],'phone':_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')],'SmsAccountId':_0x5ec5b1[_0xc47c('0x56')]['id']};var _0x1dbf91={'ContactId':_0x1fb413['id'],'SmsAccountId':_0x5ec5b1[_0xc47c('0x56')]['id'],'closed':![]};return db[_0xc47c('0xa1')][_0xc47c('0x59')]({'where':_0x1dbf91})[_0xc47c('0x21')](function(_0x33048e){if(_0x33048e){return[_0x33048e,![]];}return db[_0xc47c('0xa1')][_0xc47c('0x5a')](_0x5d7f10)[_0xc47c('0x21')](function(_0x2b2a52){return[_0x2b2a52,!![]];});});}})[_0xc47c('0xa2')](function(_0x4b1390,_0x157bd0){_0x2f66ac[_0xc47c('0xa3')]=_0x4b1390[_0xc47c('0x37')]({'plain':!![]});_0x2f66ac[_0xc47c('0xa3')]['created']=![];if(_0x157bd0){if(_0x2f66ac[_0xc47c('0x70')][_0xc47c('0xa4')]){_0x2f66ac['applications']['push']({'id':0x0,'priority':_0x2f66ac['applications'][_0xc47c('0x4a')]+0x1,'app':_0xc47c('0xa5'),'appdata':_0xc47c('0xa6'),'interval':_0xc47c('0xa7')});}_0x2f66ac[_0xc47c('0xa3')][_0xc47c('0xa8')]=!![];}return db[_0xc47c('0xa9')]['create']({'phone':_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x7f')],'messageId':_0x2f66ac['body']['messageId'],'body':_0x2f66ac[_0xc47c('0x5b')][_0xc47c('0x5b')],'SmsAccountId':_0x5ec5b1[_0xc47c('0x56')]['id'],'SmsInteractionId':_0x4b1390['id'],'direction':'in','ContactId':_0x4b1390[_0xc47c('0xaa')],'AttachmentId':_0x2f66ac[_0xc47c('0x5b')]['AttachmentId']});})[_0xc47c('0x21')](function(_0x62d9a1){_0x2f66ac[_0xc47c('0x29')]=_0x62d9a1;if(_0x2f66ac['interaction'][_0xc47c('0xab')]){return db[_0xc47c('0xac')]['find']({'attributes':['id',_0xc47c('0x3b')],'where':{'id':_0x2f66ac[_0xc47c('0xa3')][_0xc47c('0xab')]}})['then'](function(_0x4e6de3){if(_0x4e6de3){_0x2f66ac['applications'][_0xc47c('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4e6de3['name']+','+(_0x2f66ac[_0xc47c('0x70')][_0xc47c('0xae')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xc47c('0xaf'),_0xc47c('0xb0'),_0x2f66ac);});}return respondWithRpcPromise(_0xc47c('0xaf'),'startRouting',_0x2f66ac);})[_0xc47c('0x21')](function(_0x52efee){if(_0x52efee){var _0x2b2d0e=0xc8;var _0x5550f5='receiveMessage';logger['info'](_0xc47c('0x24'),_0x5550f5,_0x2b2d0e,_0xc47c('0xb1'));logger[_0xc47c('0x23')](_0xc47c('0xb2'),_0x5550f5,_0x2b2d0e,_0xc47c('0xb1'),JSON['stringify'](_0x52efee));if(_0x2f66ac['account'][_0xc47c('0x41')]==='twilio'){return _0x42e7dd[_0xc47c('0x2d')](_0x2b2d0e)[_0xc47c('0xb3')]('Content-Type','text/xml')['send']('\x0a');}else{return _0x42e7dd[_0xc47c('0x2d')](_0x2b2d0e)['json'](_0x52efee);}}})[_0xc47c('0x2b')](handleError(_0x42e7dd,null));};exports[_0xc47c('0xb4')]=function(_0x8b2302,_0x49565d){var _0x25ac99=_0x8b2302[_0xc47c('0x56')]['id'];var _0x1a1259=_0x8b2302['body'];var _0x458b66=0xc8;var _0x5009a3=null;return db[_0xc47c('0xb5')][_0xc47c('0xb6')]({'isolationLevel':db['sequelize'][_0xc47c('0xb7')][_0xc47c('0xb8')][_0xc47c('0xb9')]},function(_0x2e1479){return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x25ac99},'transaction':_0x2e1479})[_0xc47c('0x21')](function(_0x4582a7){if(_0x4582a7){return db[_0xc47c('0x6e')][_0xc47c('0x36')]({'where':{'SmsAccountId':_0x25ac99},'transaction':_0x2e1479})['then'](function(){var _0x2d6238=_[_0xc47c('0x3e')](_0x1a1259,function(_0x99a9bf){_0x99a9bf[_0xc47c('0x63')]=_0x25ac99;return _0x99a9bf;});return db[_0xc47c('0x6e')]['bulkCreate'](_0x2d6238,{'transaction':_0x2e1479});});}else{_0x458b66=0x194;_0x5009a3=[];}});})[_0xc47c('0x21')](function(){if(_0x458b66!==0x194){return db[_0xc47c('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x25ac99},'order':_0xc47c('0x72')})[_0xc47c('0x21')](function(_0x40c651){_0x5009a3=_0x40c651;});}})[_0xc47c('0x2b')](function(_0x5b0266){_0x458b66=0x1f4;logger[_0xc47c('0x27')](_0x5b0266[_0xc47c('0x3a')]);if(_0x5b0266[_0xc47c('0x3b')]){delete _0x5b0266[_0xc47c('0x3b')];}_0x5009a3=_0x5b0266;})[_0xc47c('0xba')](function(){if(_0x5009a3===null){_0x49565d['sendStatus'](_0x458b66);}else{if(_0x458b66===0x1f4){_0x49565d[_0xc47c('0x2d')](_0x458b66)[_0xc47c('0x3c')](_0x5009a3);}else{_0x49565d[_0xc47c('0x2d')](_0x458b66)['json'](_0x5009a3);}}});};exports[_0xc47c('0xbb')]=function(_0x18bfd5,_0x104283,_0xaa1a4d){var _0x4112c8={};var _0x43f54a={};var _0x2968fe;var _0x255115;return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x18bfd5['params']['id']}})['then'](handleEntityNotFound(_0x104283,null))[_0xc47c('0x21')](function(_0x3f5c6b){if(_0x3f5c6b){_0x2968fe=_0x3f5c6b;_0x43f54a[_0xc47c('0x43')]=_[_0xc47c('0x45')](db[_0xc47c('0x6e')]['rawAttributes']);_0x43f54a[_0xc47c('0x44')]=_['keys'](_0x18bfd5[_0xc47c('0x44')]);_0x43f54a['filters']=_[_0xc47c('0x47')](_0x43f54a['model'],_0x43f54a[_0xc47c('0x44')]);_0x4112c8[_0xc47c('0x49')]=_[_0xc47c('0x47')](_0x43f54a[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0x18bfd5[_0xc47c('0x44')][_0xc47c('0x48')]));_0x4112c8[_0xc47c('0x49')]=_0x4112c8[_0xc47c('0x49')][_0xc47c('0x4a')]?_0x4112c8[_0xc47c('0x49')]:_0x43f54a['model'];_0x4112c8[_0xc47c('0x66')]=qs[_0xc47c('0x4d')](_0x18bfd5[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x4112c8[_0xc47c('0x4e')]=qs['filters'](_[_0xc47c('0x4f')](_0x18bfd5[_0xc47c('0x44')],_0x43f54a[_0xc47c('0x46')]));if(_0x18bfd5['query'][_0xc47c('0x50')]){_0x4112c8[_0xc47c('0x4e')]=_[_0xc47c('0x51')](_0x4112c8['where'],{'$or':_[_0xc47c('0x3e')](_0x4112c8['attributes'],function(_0x643a11){var _0x486ba4={};_0x486ba4[_0x643a11]={'$like':'%'+_0x18bfd5[_0xc47c('0x44')][_0xc47c('0x50')]+'%'};return _0x486ba4;})});}_0x4112c8=_['merge']({},_0x4112c8,_0x18bfd5[_0xc47c('0x52')]);return _0x2968fe[_0xc47c('0xbb')](_0x4112c8);}})[_0xc47c('0x21')](function(_0x5c8c24){if(_0x5c8c24){_0x255115=_0x5c8c24['length'];if(!_0x18bfd5[_0xc47c('0x44')][_0xc47c('0x4b')]('nolimit')){_0x4112c8[_0xc47c('0x31')]=qs['limit'](_0x18bfd5['query'][_0xc47c('0x31')]);_0x4112c8[_0xc47c('0x2f')]=qs['offset'](_0x18bfd5[_0xc47c('0x44')][_0xc47c('0x2f')]);}return _0x2968fe[_0xc47c('0xbb')](_0x4112c8);}})[_0xc47c('0x21')](function(_0x227c77){if(_0x227c77){return _0x227c77?{'count':_0x255115,'rows':_0x227c77}:null;}})[_0xc47c('0x21')](respondWithResult(_0x104283,null))[_0xc47c('0x2b')](handleError(_0x104283,null));};exports[_0xc47c('0xbc')]=function(_0x459e3c,_0x53b28b,_0x4496c2){var _0x1425e4={'raw':![],'where':{}};var _0x16d60d={};var _0x23d232={'count':0x0,'rows':[]};return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x459e3c[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x53b28b,null))['then'](function(_0x2560d9){if(_0x2560d9){_0x16d60d[_0xc47c('0x43')]=_[_0xc47c('0x45')](db[_0xc47c('0xa1')][_0xc47c('0x40')]);_0x16d60d[_0xc47c('0x44')]=_[_0xc47c('0x45')](_0x459e3c[_0xc47c('0x44')]);_0x16d60d[_0xc47c('0x46')]=_[_0xc47c('0x47')](_0x16d60d[_0xc47c('0x43')],_0x16d60d[_0xc47c('0x44')]);_0x1425e4[_0xc47c('0x49')]=_[_0xc47c('0x47')](_0x16d60d[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0x459e3c[_0xc47c('0x44')][_0xc47c('0x48')]));_0x1425e4[_0xc47c('0x49')]=_0x1425e4[_0xc47c('0x49')]['length']?_0x1425e4['attributes']:_0x16d60d[_0xc47c('0x43')];if(!_0x459e3c[_0xc47c('0x44')]['hasOwnProperty'](_0xc47c('0x4c'))){_0x1425e4[_0xc47c('0x31')]=qs[_0xc47c('0x31')](_0x459e3c['query']['limit']);_0x1425e4[_0xc47c('0x2f')]=qs[_0xc47c('0x2f')](_0x459e3c[_0xc47c('0x44')][_0xc47c('0x2f')]);}_0x1425e4[_0xc47c('0x66')]=qs[_0xc47c('0x4d')](_0x459e3c[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x1425e4[_0xc47c('0x4e')]=qs[_0xc47c('0x46')](_[_0xc47c('0x4f')](_0x459e3c[_0xc47c('0x44')],_0x16d60d['filters']));_0x1425e4['where']['SmsAccountId']=_0x2560d9['id'];if(_0x459e3c[_0xc47c('0x44')][_0xc47c('0x50')]){_0x1425e4['where']=_[_0xc47c('0x51')](_0x1425e4[_0xc47c('0x4e')],{'$or':_['map'](_0x1425e4[_0xc47c('0x49')],function(_0x21c0af){var _0x46b2e2={};_0x46b2e2[_0x21c0af]={'$like':'%'+_0x459e3c[_0xc47c('0x44')][_0xc47c('0x50')]+'%'};return _0x46b2e2;})});}_0x1425e4=_[_0xc47c('0x51')]({},_0x1425e4,_0x459e3c[_0xc47c('0x52')]);return db[_0xc47c('0xa1')][_0xc47c('0x32')]({'where':_0x1425e4[_0xc47c('0x4e')]})['then'](function(_0x26a26a){_0x23d232['count']=_0x26a26a;if(_0x459e3c[_0xc47c('0x44')][_0xc47c('0x58')]){_0x1425e4[_0xc47c('0x53')]=[{'model':db[_0xc47c('0x74')],'as':_0xc47c('0xbd'),'required':![]},{'model':db[_0xc47c('0xac')],'as':_0xc47c('0xbe'),'attributes':[_0xc47c('0x3b'),_0xc47c('0xbf'),'internal'],'required':![]},{'model':db[_0xc47c('0xc0')],'as':_0xc47c('0xc1'),'attributes':['id',_0xc47c('0x3b'),_0xc47c('0xc2')],'where':_0x459e3c[_0xc47c('0x44')]['tag']?{'id':_0x459e3c[_0xc47c('0x44')][_0xc47c('0xc3')]}:undefined,'required':_0x459e3c['query']['tag']?!![]:![]}];}return db[_0xc47c('0xa1')][_0xc47c('0x67')](_0x1425e4);})['then'](function(_0x514944){_0x23d232[_0xc47c('0x54')]=_0x514944;return _0x23d232;});}})['then'](respondWithFilteredResult(_0x53b28b,_0x1425e4))[_0xc47c('0x2b')](handleError(_0x53b28b,null));};exports[_0xc47c('0x3c')]=function(_0x53151e,_0x62ecea,_0x41dd4a){var _0x192f5d,_0x1551b9,_0x385c23;if(_['isNil'](_0x53151e[_0xc47c('0x5b')][_0xc47c('0x5b')])||_0x53151e[_0xc47c('0x5b')][_0xc47c('0x5b')]===''){throw new db['Sequelize'][(_0xc47c('0x76'))](_0xc47c('0x97'));}if(_[_0xc47c('0x95')](_0x53151e[_0xc47c('0x5b')]['to'])){throw new db[(_0xc47c('0x75'))][(_0xc47c('0x76'))](_0xc47c('0xc4'));}_0x192f5d=_0x53151e[_0xc47c('0x5b')]['to'];return db['SmsAccount'][_0xc47c('0x59')]({'where':{'id':_0x53151e['params']['id']},'include':[{'model':db[_0xc47c('0x9b')],'as':_0xc47c('0xc5'),'include':[{'model':db[_0xc47c('0x74')],'as':_0xc47c('0x9c'),'where':{'mobile':_0x192f5d},'limit':0x1,'order':[[_0xc47c('0x7a'),_0xc47c('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x62ecea,null))[_0xc47c('0x21')](function(_0x42d569){if(_0x42d569&&_0x42d569['List']){_0x1551b9=_0x42d569[_0xc47c('0x37')]({'plain':!![]});if(_0x1551b9[_0xc47c('0xc5')]&&_0x1551b9['List'][_0xc47c('0x9c')][_0xc47c('0x4a')]){return _0x1551b9[_0xc47c('0xc5')][_0xc47c('0x9c')][0x0];}return db[_0xc47c('0x74')][_0xc47c('0x5a')](_[_0xc47c('0x9f')](_0x53151e['body'],{'firstName':_0x192f5d,'mobile':_0x192f5d,'phone':_0x192f5d,'ListId':_0x1551b9[_0xc47c('0x7c')]}));}})[_0xc47c('0x21')](handleEntityNotFound(_0x62ecea,null))[_0xc47c('0x21')](function(_0xf51024){if(_0xf51024){_0x385c23=_0xf51024;return db[_0xc47c('0xa1')]['find']({'where':{'ContactId':_0x385c23['id'],'closed':![],'SmsAccountId':_0x1551b9['id']}})[_0xc47c('0x21')](function(_0x5aae6d){if(_0x5aae6d){return[_0x5aae6d,![]];}return db['SmsInteraction'][_0xc47c('0x5a')]({'UserId':_0x53151e[_0xc47c('0xc6')]['id'],'ContactId':_0x385c23['id'],'SmsAccountId':_0x1551b9['id'],'phone':_0x192f5d,'firstMsgDirection':_0xc47c('0xc7'),'Messages':[_[_0xc47c('0x51')](_0x53151e[_0xc47c('0x5b')],{'read':![],'body':_0x53151e['body'][_0xc47c('0x5b')],'phone':_0x192f5d,'SmsAccountId':_0x1551b9['id'],'UserId':_0x53151e['user']['id'],'ContactId':_0x385c23['id']})]},{'include':[{'model':db[_0xc47c('0xa9')],'as':_0xc47c('0xc8')}]})[_0xc47c('0x21')](function(_0x28fd19){return[_0x28fd19,!![]];});});}})[_0xc47c('0xa2')](function(_0x1ecc4f,_0x4cc5d6){if(_0x4cc5d6){return _0x1ecc4f;}return db[_0xc47c('0xa9')][_0xc47c('0x5a')](_[_0xc47c('0x51')](_0x53151e['body'],{'read':![],'body':_0x53151e['body'][_0xc47c('0x5b')],'phone':_0x192f5d,'SmsAccountId':_0x1551b9['id'],'SmsInteractionId':_0x1ecc4f['id'],'UserId':_0x53151e[_0xc47c('0xc6')]['id'],'ContactId':_0x385c23['id']}))[_0xc47c('0x21')](function(_0x5e444c){_0x1ecc4f[_0xc47c('0xc9')]['Messages']=[];_0x1ecc4f['dataValues'][_0xc47c('0xc8')]['push'](_0x5e444c['dataValues']);return _0x1ecc4f;});})['then'](respondWithResult(_0x62ecea,null))['catch'](handleError(_0x62ecea,null));};exports['status']=function(_0xb3062a,_0x5ebc6d,_0x207b02){if(_0xb3062a['body']['id']){delete _0xb3062a[_0xc47c('0x5b')]['id'];}var _0x53982f,_0x332414,_0x3c0e22;return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0xb3062a[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x5ebc6d,null))[_0xc47c('0x21')](function(_0x304756){if(_0x304756){_0x3c0e22=_0x304756;logger[_0xc47c('0x23')](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0xca'),_0x304756[_0xc47c('0x41')],util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x304756['type']){case'skebby':if(_0xb3062a['body'][_0xc47c('0xcc')]&&_0xb3062a['body']['status']){_0x332414=_0xb3062a[_0xc47c('0x5b')][_0xc47c('0x2d')];return db['SmsMessage'][_0xc47c('0x59')]({'where':{'messageId':_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xcc')]}});}break;case _0xc47c('0xcd'):if(_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xce')]&&_0xb3062a[_0xc47c('0x5b')]['statusInt']){_0x332414=_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xcf')];return db[_0xc47c('0xa9')][_0xc47c('0x59')]({'where':{'messageId':_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xce')]}});}break;case _0xc47c('0x86'):if(_0xb3062a['body'][_0xc47c('0xd0')]&&_0xb3062a['body'][_0xc47c('0xd1')]){_0x332414=_0xb3062a[_0xc47c('0x5b')]['status_code'];return db['SmsMessage'][_0xc47c('0x59')]({'where':{'messageId':_0xb3062a['body'][_0xc47c('0xd0')]}});}break;case _0xc47c('0x8b'):var _0x25fb12=_0xb3062a[_0xc47c('0x5b')][_0xc47c('0x8c')][0x0];if(_0x25fb12[_0xc47c('0x87')]&&_0x25fb12['status'][_0xc47c('0xd2')]===_0xc47c('0xd3')){_0x332414=_0x25fb12[_0xc47c('0x2d')]['groupName'];return db[_0xc47c('0xa9')][_0xc47c('0x59')]({'where':{'messageId':_0x25fb12[_0xc47c('0x87')]}});}break;case _0xc47c('0x90'):if(_0xb3062a[_0xc47c('0x5b')][_0xc47c('0x87')]&&_0xb3062a[_0xc47c('0x5b')][_0xc47c('0x2d')]){_0x332414=_0xb3062a['body'][_0xc47c('0x2d')];return db[_0xc47c('0xa9')]['find']({'where':{'messageId':_0xb3062a[_0xc47c('0x5b')]['messageId']}});}break;case _0xc47c('0x92'):if(_0xb3062a['body'][0x0][_0xc47c('0x29')]['id']){_0x332414=_0xb3062a['body'][0x0][_0xc47c('0x41')];return db[_0xc47c('0xa9')][_0xc47c('0x59')]({'where':{'messageId':_0xb3062a[_0xc47c('0x5b')][0x0][_0xc47c('0x29')]['id']}});}break;case _0xc47c('0x93'):if(_0xb3062a['body']['redif']&&_0xb3062a[_0xc47c('0x5b')][_0xc47c('0x2d')]){_0x332414=_0xb3062a['body'][_0xc47c('0x2d')];return db['SmsMessage'][_0xc47c('0x59')]({'where':{'messageId':_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xd4')]}});}break;}}})[_0xc47c('0x21')](handleEntityNotFound(_0x5ebc6d,null))[_0xc47c('0x21')](function(_0x44d7ed){if(_0x44d7ed){_0x53982f=_0x44d7ed;switch(_0x3c0e22[_0xc47c('0x41')]){case _0xc47c('0x83'):if(_0x332414==='DELIVERED'){return _0x53982f[_0xc47c('0xd5')]({'read':!![]});}else{logger[_0xc47c('0x27')](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0x83'),util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc47c('0xcd'):if(_0x332414==='1'){return _0x53982f['update']({'read':!![]});}else{logger['error'](_0xc47c('0x24'),'status',_0xc47c('0x83'),util[_0xc47c('0xcb')](_0xb3062a['body'],{'showHidden':![],'depth':null}));}break;case _0xc47c('0x86'):if(!_0xb3062a[_0xc47c('0x5b')][_0xc47c('0xd6')]&&_0x332414>=0xc8&&_0x332414<=0xce){return _0x53982f[_0xc47c('0xd5')]({'read':!![]});}else{logger['error'](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0x86'),util[_0xc47c('0xcb')](_0xb3062a['body'],{'showHidden':![],'depth':null}));}break;case _0xc47c('0x8b'):var _0x1a41fe=_0xb3062a[_0xc47c('0x5b')]['results'][0x0];if(_0x1a41fe[_0xc47c('0x2d')]['groupName']===_0xc47c('0xd3')){return _0x53982f[_0xc47c('0xd5')]({'read':!![]});}else{logger[_0xc47c('0x27')](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0x8b'),util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x332414==_0xc47c('0xd7')||_0x332414==_0xc47c('0xd8')){return _0x53982f['update']({'read':!![]});}else{logger[_0xc47c('0x27')](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0x90'),util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc47c('0x92'):if(_0x332414==_0xc47c('0xd9')){return _0x53982f['update']({'read':!![]});}else{logger[_0xc47c('0x27')](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0x92'),util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xc47c('0x93'):if(_0x332414===_0xc47c('0xda')||_0x332414==='ACCEPTD'){return _0x53982f[_0xc47c('0xd5')]({'read':!![]});}else{logger[_0xc47c('0x27')](_0xc47c('0x24'),'status',_0xc47c('0x93'),util[_0xc47c('0xcb')](_0xb3062a[_0xc47c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x53982f;}})['then'](respondWithResult(_0x5ebc6d,null))[_0xc47c('0x2b')](handleError(_0x5ebc6d,null));};exports[_0xc47c('0xdb')]=function(_0x44f4c8,_0x4e6205,_0x2461c0){var _0x174fa3,_0x2586ee,_0xc5f462;return db['SmsAccount']['find']({'where':{'id':_0x44f4c8[_0xc47c('0x56')]['id']}})['then'](handleEntityNotFound(_0x4e6205,null))[_0xc47c('0x21')](function(_0xeff201){if(_0xeff201){_0xc5f462=_0xeff201;logger['debug'](_0xc47c('0x24'),_0xc47c('0x2d'),_0xc47c('0xca'),_0xeff201[_0xc47c('0x41')],util[_0xc47c('0xcb')](_0x44f4c8['query'],{'showHidden':![],'depth':null}));switch(_0xeff201['type']){case'csc':if(_0x44f4c8[_0xc47c('0x44')][_0xc47c('0xdc')]&&_0x44f4c8[_0xc47c('0x44')]['state']){_0x2586ee=_0x44f4c8[_0xc47c('0x44')][_0xc47c('0xdd')];return db[_0xc47c('0xa9')]['find']({'where':{'messageId':_0x44f4c8[_0xc47c('0x44')]['message-id']}});}break;}}})[_0xc47c('0x21')](handleEntityNotFound(_0x4e6205,null))[_0xc47c('0x21')](function(_0x45a2da){if(_0x45a2da){_0x174fa3=_0x45a2da;switch(_0xc5f462[_0xc47c('0x41')]){case'csc':if(_0x2586ee==='2'||_0x2586ee==='6'){return _0x174fa3[_0xc47c('0xd5')]({'read':!![]});}else{logger['error'](_0xc47c('0x24'),'status','csc',util[_0xc47c('0xcb')](_0x44f4c8[_0xc47c('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x174fa3;}})[_0xc47c('0x21')](respondWithResult(_0x4e6205,null))[_0xc47c('0x2b')](handleError(_0x4e6205,null));};exports[_0xc47c('0xde')]=function(_0x43678d,_0x4333c1,_0x106177){return db[_0xc47c('0x3f')][_0xc47c('0x59')]({'where':{'id':_0x43678d[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x4333c1,null))['then'](function(_0x2ee4ba){if(_0x2ee4ba){return _0x2ee4ba[_0xc47c('0xde')](_0x43678d[_0xc47c('0x5b')][_0xc47c('0x6c')],_['omit'](_0x43678d[_0xc47c('0x5b')],[_0xc47c('0x6c'),'id'])||{})[_0xc47c('0xa2')](function(_0x537175){for(var _0x384f1c=0x0;_0x384f1c<_0x43678d['body']['ids']['length'];_0x384f1c+=0x1){socket['emit'](_0xc47c('0xdf'),{'UserId':Number(_0x43678d['body']['ids'][_0x384f1c]),'SmsAccountId':Number(_0x43678d[_0xc47c('0x56')]['id'])});}return _0x537175;});}})[_0xc47c('0x21')](respondWithResult(_0x4333c1,null))['catch'](handleError(_0x4333c1,null));};exports['removeAgents']=function(_0x4f65fb,_0x5aeb6d,_0x7527d7){return db[_0xc47c('0x3f')]['find']({'where':{'id':_0x4f65fb[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x5aeb6d,null))['then'](function(_0x21d11a){if(_0x21d11a){return _0x21d11a[_0xc47c('0xe0')](_0x4f65fb[_0xc47c('0x44')]['ids'])[_0xc47c('0x21')](function(){if(_[_0xc47c('0xe1')](_0x4f65fb[_0xc47c('0x44')][_0xc47c('0x6c')])){for(var _0x1f5ebb=0x0;_0x1f5ebb<_0x4f65fb[_0xc47c('0x44')][_0xc47c('0x6c')][_0xc47c('0x4a')];_0x1f5ebb+=0x1){socket[_0xc47c('0xe2')](_0xc47c('0xe3'),{'UserId':Number(_0x4f65fb['query'][_0xc47c('0x6c')][_0x1f5ebb]),'SmsAccountId':Number(_0x4f65fb[_0xc47c('0x56')]['id'])});}}else{socket['emit'](_0xc47c('0xe3'),{'UserId':Number(_0x4f65fb[_0xc47c('0x44')][_0xc47c('0x6c')]),'SmsAccountId':Number(_0x4f65fb[_0xc47c('0x56')]['id'])});}});}})[_0xc47c('0x21')](respondWithStatusCode(_0x5aeb6d,null))[_0xc47c('0x2b')](handleError(_0x5aeb6d,null));};exports['getAgents']=function(_0x253ed4,_0x1ff908,_0xbcc15e){var _0x37f55e={};var _0x4259ed={};var _0x938446;var _0x2099b3;return db[_0xc47c('0x3f')][_0xc47c('0x65')]({'where':{'id':_0x253ed4[_0xc47c('0x56')]['id']}})[_0xc47c('0x21')](handleEntityNotFound(_0x1ff908,null))[_0xc47c('0x21')](function(_0x2f22d0){if(_0x2f22d0){_0x938446=_0x2f22d0;_0x4259ed[_0xc47c('0x43')]=_[_0xc47c('0x45')](db['User'][_0xc47c('0x40')]);_0x4259ed[_0xc47c('0x44')]=_['keys'](_0x253ed4[_0xc47c('0x44')]);_0x4259ed[_0xc47c('0x46')]=_['intersection'](_0x4259ed[_0xc47c('0x43')],_0x4259ed['query']);_0x37f55e[_0xc47c('0x49')]=_['intersection'](_0x4259ed[_0xc47c('0x43')],qs[_0xc47c('0x48')](_0x253ed4[_0xc47c('0x44')]['fields']));_0x37f55e['attributes']=_0x37f55e['attributes'][_0xc47c('0x4a')]?_0x37f55e['attributes']:_0x4259ed[_0xc47c('0x43')];_0x37f55e['order']=qs['sort'](_0x253ed4[_0xc47c('0x44')][_0xc47c('0x4d')]);_0x37f55e[_0xc47c('0x4e')]=qs['filters'](_['pick'](_0x253ed4['query'],_0x4259ed[_0xc47c('0x46')]));if(_0x253ed4['query'][_0xc47c('0x50')]){_0x37f55e[_0xc47c('0x4e')]=_[_0xc47c('0x51')](_0x37f55e[_0xc47c('0x4e')],{'$or':_[_0xc47c('0x3e')](_0x37f55e['attributes'],function(_0x5a63e6){var _0x429e8e={};_0x429e8e[_0x5a63e6]={'$like':'%'+_0x253ed4['query']['filter']+'%'};return _0x429e8e;})});}_0x37f55e=_[_0xc47c('0x51')]({},_0x37f55e,_0x253ed4[_0xc47c('0x52')]);return _0x938446[_0xc47c('0xe4')](_0x37f55e);}})[_0xc47c('0x21')](function(_0x389640){if(_0x389640){_0x2099b3=_0x389640['length'];if(!_0x253ed4[_0xc47c('0x44')][_0xc47c('0x4b')](_0xc47c('0x4c'))){_0x37f55e[_0xc47c('0x31')]=qs['limit'](_0x253ed4[_0xc47c('0x44')]['limit']);_0x37f55e['offset']=qs['offset'](_0x253ed4[_0xc47c('0x44')][_0xc47c('0x2f')]);}return _0x938446[_0xc47c('0xe4')](_0x37f55e);}})[_0xc47c('0x21')](function(_0x5e5d82){if(_0x5e5d82){return _0x5e5d82?{'count':_0x2099b3,'rows':_0x5e5d82}:null;}})['then'](respondWithResult(_0x1ff908,null))['catch'](handleError(_0x1ff908,null));}; \ No newline at end of file +var _0xe0bb=['unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','set','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','List','Messages','spread','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','redif','update','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','status','end','offset','undefined','limit','count','Content-Range','json','save','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','SmsAccountId','rows','removeDispositions','addAnswer','CannedAnswer','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','Body','messageId','skebby','from','sender','text','connectel','clicksend','message_id','From','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','defaults','contact','SmsInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User'];(function(_0x8f8a5d,_0x5e5eba){var _0x5f5609=function(_0x3503dc){while(--_0x3503dc){_0x8f8a5d['push'](_0x8f8a5d['shift']());}};_0x5f5609(++_0x5e5eba);}(_0xe0bb,0x120));var _0xbe0b=function(_0x384d39,_0xf060fc){_0x384d39=_0x384d39-0x0;var _0x13bf22=_0xe0bb[_0x384d39];return _0x13bf22;};'use strict';var emlformat=require(_0xbe0b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbe0b('0x1'));var rp=require(_0xbe0b('0x2'));var moment=require(_0xbe0b('0x3'));var BPromise=require(_0xbe0b('0x4'));var Mustache=require(_0xbe0b('0x5'));var util=require('util');var path=require(_0xbe0b('0x6'));var sox=require(_0xbe0b('0x7'));var csv=require(_0xbe0b('0x8'));var ejs=require(_0xbe0b('0x9'));var fs=require('fs');var fs_extra=require(_0xbe0b('0xa'));var _=require('lodash');var squel=require(_0xbe0b('0xb'));var crypto=require(_0xbe0b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbe0b('0xd'));var toCsv=require(_0xbe0b('0x8'));var querystring=require(_0xbe0b('0xe'));var Papa=require('papaparse');var Redis=require(_0xbe0b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe0b('0x10'));var as=require(_0xbe0b('0x11'));var hardwareService=require(_0xbe0b('0x12'));var logger=require(_0xbe0b('0x13'))('api');var utils=require(_0xbe0b('0x14'));var config=require(_0xbe0b('0x15'));var licenseUtil=require(_0xbe0b('0x16'));var db=require(_0xbe0b('0x17'))['db'];config['redis']=_['defaults'](config[_0xbe0b('0x18')],{'host':_0xbe0b('0x19'),'port':0x18eb});var socket=require(_0xbe0b('0x1a'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xbe0b('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xbe0b('0x1c')][_0xbe0b('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x521b9e,_0x578720,_0x589dac,_0x5eaca9){return new BPromise(function(_0x31c286,_0x7c3f08){var _0x31498b=_0x5eaca9||client;return _0x31498b[_0xbe0b('0x1e')](_0x521b9e,_0x589dac)[_0xbe0b('0x1f')](function(_0x318f25){logger[_0xbe0b('0x20')](_0xbe0b('0x21'),_0x578720,'request\x20sent');logger[_0xbe0b('0x22')](_0xbe0b('0x23'),_0x578720,_0xbe0b('0x24'),JSON[_0xbe0b('0x25')](_0x318f25));if(_0x318f25[_0xbe0b('0x26')]){if(_0x318f25[_0xbe0b('0x26')]['code']===0x1f4){logger[_0xbe0b('0x26')](_0xbe0b('0x21'),_0x578720,_0x318f25[_0xbe0b('0x26')][_0xbe0b('0x27')]);return _0x7c3f08(_0x318f25[_0xbe0b('0x26')][_0xbe0b('0x27')]);}logger[_0xbe0b('0x26')]('SmsAccount,\x20%s,\x20%s',_0x578720,_0x318f25[_0xbe0b('0x26')]['message']);return _0x31c286(_0x318f25[_0xbe0b('0x26')]['message']);}else{logger[_0xbe0b('0x20')](_0xbe0b('0x21'),_0x578720,'request\x20sent');_0x31c286(_0x318f25[_0xbe0b('0x28')]['message']);}})['catch'](function(_0x1f2f9f){logger[_0xbe0b('0x26')](_0xbe0b('0x21'),_0x578720,_0x1f2f9f);_0x7c3f08(_0x1f2f9f);});});}function respondWithStatusCode(_0x355f9f,_0x43eead){_0x43eead=_0x43eead||0xcc;return function(_0x5be162){if(_0x5be162){return _0x355f9f['sendStatus'](_0x43eead);}return _0x355f9f[_0xbe0b('0x29')](_0x43eead)[_0xbe0b('0x2a')]();};}function respondWithResult(_0x1248fa,_0x3678fb){_0x3678fb=_0x3678fb||0xc8;return function(_0x1e6306){if(_0x1e6306){return _0x1248fa[_0xbe0b('0x29')](_0x3678fb)['json'](_0x1e6306);}};}function respondWithFilteredResult(_0x37264c,_0x2b091f){return function(_0x518ab8){if(_0x518ab8){var _0x531238=typeof _0x2b091f[_0xbe0b('0x2b')]===_0xbe0b('0x2c')&&typeof _0x2b091f[_0xbe0b('0x2d')]===_0xbe0b('0x2c');var _0x45ba7e=_0x518ab8['count'];var _0x222aef=_0x531238?0x0:_0x2b091f['offset'];var _0x33105d=_0x531238?_0x518ab8[_0xbe0b('0x2e')]:_0x2b091f['offset']+_0x2b091f[_0xbe0b('0x2d')];var _0xb32f00;if(_0x33105d>=_0x45ba7e){_0x33105d=_0x45ba7e;_0xb32f00=0xc8;}else{_0xb32f00=0xce;}_0x37264c[_0xbe0b('0x29')](_0xb32f00);return _0x37264c['set'](_0xbe0b('0x2f'),_0x222aef+'-'+_0x33105d+'/'+_0x45ba7e)[_0xbe0b('0x30')](_0x518ab8);}return null;};}function patchUpdates(_0xf67313){return function(_0x451266){try{jsonpatch['apply'](_0x451266,_0xf67313,!![]);}catch(_0x272e50){return BPromise['reject'](_0x272e50);}return _0x451266[_0xbe0b('0x31')]();};}function saveUpdates(_0x2a5d8b,_0x23981d){return function(_0x5e071b){if(_0x5e071b){return _0x5e071b['update'](_0x2a5d8b)['then'](function(_0x4fd9fc){return _0x4fd9fc;});}return null;};}function removeEntity(_0x463f75,_0x21dde2){return function(_0x1ba0de){if(_0x1ba0de){return _0x1ba0de[_0xbe0b('0x32')]()[_0xbe0b('0x1f')](function(){var _0xd2a89c=_0x1ba0de[_0xbe0b('0x33')]({'plain':!![]});var _0x4d10e3=_0xbe0b('0x34');return db[_0xbe0b('0x35')]['destroy']({'where':{'type':_0x4d10e3,'resourceId':_0xd2a89c['id']}})['then'](function(){return _0x1ba0de;});})[_0xbe0b('0x1f')](function(){_0x463f75[_0xbe0b('0x29')](0xcc)[_0xbe0b('0x2a')]();});}};}function handleEntityNotFound(_0x63d92c,_0x8cf366){return function(_0x149645){if(!_0x149645){_0x63d92c[_0xbe0b('0x36')](0x194);}return _0x149645;};}function handleError(_0x404f7f,_0x15ed0e){_0x15ed0e=_0x15ed0e||0x1f4;return function(_0x3059a0){logger['error'](_0x3059a0[_0xbe0b('0x37')]);if(_0x3059a0['name']){delete _0x3059a0[_0xbe0b('0x38')];}_0x404f7f[_0xbe0b('0x29')](_0x15ed0e)[_0xbe0b('0x39')](_0x3059a0);};}exports[_0xbe0b('0x3a')]=function(_0x346073,_0x42a9af){var _0x18841e={'include':[{'model':db[_0xbe0b('0x3b')],'as':_0xbe0b('0x3c')}]},_0x4b05e5={},_0x1d4841={'count':0x0,'rows':[]};var _0x4d5755=_['map'](db[_0xbe0b('0x3d')][_0xbe0b('0x3e')],function(_0x1fc652){return{'name':_0x1fc652[_0xbe0b('0x3f')],'type':_0x1fc652[_0xbe0b('0x40')][_0xbe0b('0x41')]};});_0x4b05e5['model']=_[_0xbe0b('0x42')](_0x4d5755,'name');_0x4b05e5[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x346073[_0xbe0b('0x43')]);_0x4b05e5[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x4b05e5[_0xbe0b('0x47')],_0x4b05e5['query']);_0x18841e['attributes']=_[_0xbe0b('0x46')](_0x4b05e5[_0xbe0b('0x47')],qs[_0xbe0b('0x48')](_0x346073[_0xbe0b('0x43')][_0xbe0b('0x48')]));_0x18841e[_0xbe0b('0x49')]=_0x18841e[_0xbe0b('0x49')][_0xbe0b('0x4a')]?_0x18841e[_0xbe0b('0x49')]:_0x4b05e5[_0xbe0b('0x47')];if(!_0x346073[_0xbe0b('0x43')][_0xbe0b('0x4b')](_0xbe0b('0x4c'))){_0x18841e['limit']=qs[_0xbe0b('0x2d')](_0x346073[_0xbe0b('0x43')][_0xbe0b('0x2d')]);_0x18841e[_0xbe0b('0x2b')]=qs[_0xbe0b('0x2b')](_0x346073['query']['offset']);}_0x18841e[_0xbe0b('0x4d')]=qs['sort'](_0x346073[_0xbe0b('0x43')][_0xbe0b('0x4e')]);_0x18841e[_0xbe0b('0x4f')]=qs[_0xbe0b('0x45')](_[_0xbe0b('0x50')](_0x346073['query'],_0x4b05e5[_0xbe0b('0x45')]),_0x4d5755);if(_0x346073[_0xbe0b('0x43')][_0xbe0b('0x51')]){_0x18841e['where']=_[_0xbe0b('0x52')](_0x18841e[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0x4d5755,function(_0x5c5232){if(_0x5c5232['type']!==_0xbe0b('0x53')){var _0x3dbba9={};_0x3dbba9[_0x5c5232[_0xbe0b('0x38')]]={'$like':'%'+_0x346073[_0xbe0b('0x43')]['filter']+'%'};return _0x3dbba9;}})});}_0x18841e=_[_0xbe0b('0x52')]({},_0x18841e,_0x346073[_0xbe0b('0x54')]);var _0x28335b={'where':_0x18841e[_0xbe0b('0x4f')]};return db[_0xbe0b('0x3d')][_0xbe0b('0x2e')](_0x28335b)[_0xbe0b('0x1f')](function(_0x3b3b85){_0x1d4841[_0xbe0b('0x2e')]=_0x3b3b85;if(_0x346073[_0xbe0b('0x43')][_0xbe0b('0x55')]){_0x18841e[_0xbe0b('0x56')]=[{'all':!![]}];}return db[_0xbe0b('0x3d')][_0xbe0b('0x57')](_0x18841e);})[_0xbe0b('0x1f')](function(_0x3130a0){_0x1d4841['rows']=_0x3130a0;return _0x1d4841;})[_0xbe0b('0x1f')](respondWithFilteredResult(_0x42a9af,_0x18841e))['catch'](handleError(_0x42a9af,null));};exports[_0xbe0b('0x58')]=function(_0x1eb27d,_0x2b5e6b){var _0xabb5be={'raw':![],'where':{'id':_0x1eb27d[_0xbe0b('0x59')]['id']},'include':[{'model':db[_0xbe0b('0x3b')],'as':_0xbe0b('0x3c')}]},_0x47a834={};_0x47a834[_0xbe0b('0x47')]=_[_0xbe0b('0x44')](db['SmsAccount'][_0xbe0b('0x3e')]);_0x47a834[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x1eb27d[_0xbe0b('0x43')]);_0x47a834[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x47a834[_0xbe0b('0x47')],_0x47a834[_0xbe0b('0x43')]);_0xabb5be[_0xbe0b('0x49')]=_[_0xbe0b('0x46')](_0x47a834[_0xbe0b('0x47')],qs[_0xbe0b('0x48')](_0x1eb27d['query'][_0xbe0b('0x48')]));_0xabb5be[_0xbe0b('0x49')]=_0xabb5be[_0xbe0b('0x49')][_0xbe0b('0x4a')]?_0xabb5be[_0xbe0b('0x49')]:_0x47a834[_0xbe0b('0x47')];if(_0x1eb27d[_0xbe0b('0x43')][_0xbe0b('0x55')]){_0xabb5be[_0xbe0b('0x56')]=[{'all':!![]}];}_0xabb5be=_[_0xbe0b('0x52')]({},_0xabb5be,_0x1eb27d[_0xbe0b('0x54')]);return db[_0xbe0b('0x3d')][_0xbe0b('0x5a')](_0xabb5be)[_0xbe0b('0x1f')](handleEntityNotFound(_0x2b5e6b,null))[_0xbe0b('0x1f')](respondWithResult(_0x2b5e6b,null))[_0xbe0b('0x5b')](handleError(_0x2b5e6b,null));};exports[_0xbe0b('0x5c')]=function(_0x3dbb75,_0x4c0260){return db['SmsAccount'][_0xbe0b('0x5c')](_0x3dbb75[_0xbe0b('0x5d')],{})['then'](function(_0x4f508d){var _0xbef4c0=_0x3dbb75[_0xbe0b('0x5e')][_0xbe0b('0x33')]({'plain':!![]});if(!_0xbef4c0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xbef4c0[_0xbe0b('0x5f')]===_0xbe0b('0x5e')){var _0x15e562=_0x4f508d[_0xbe0b('0x33')]({'plain':!![]});var _0x227b1c=_0xbe0b('0x34');return db[_0xbe0b('0x60')][_0xbe0b('0x5a')]({'where':{'name':_0x227b1c,'userProfileId':_0xbef4c0[_0xbe0b('0x61')]},'raw':!![]})[_0xbe0b('0x1f')](function(_0x4f7ae0){if(_0x4f7ae0&&_0x4f7ae0[_0xbe0b('0x62')]===0x0){return db[_0xbe0b('0x35')][_0xbe0b('0x5c')]({'name':_0x15e562[_0xbe0b('0x38')],'resourceId':_0x15e562['id'],'type':_0x4f7ae0[_0xbe0b('0x38')],'sectionId':_0x4f7ae0['id']},{})['then'](function(){return _0x4f508d;});}else{return _0x4f508d;}})[_0xbe0b('0x5b')](function(_0x5cb402){logger['error'](_0xbe0b('0x63'),_0x5cb402);throw _0x5cb402;});}return _0x4f508d;})['then'](respondWithResult(_0x4c0260,0xc9))[_0xbe0b('0x5b')](handleError(_0x4c0260,null));};exports['update']=function(_0x5e2b31,_0x540ad8){if(_0x5e2b31[_0xbe0b('0x5d')]['id']){delete _0x5e2b31[_0xbe0b('0x5d')]['id'];}return db[_0xbe0b('0x3d')]['find']({'where':{'id':_0x5e2b31['params']['id']},'include':[{'model':db[_0xbe0b('0x3b')],'as':_0xbe0b('0x3c')}]})['then'](handleEntityNotFound(_0x540ad8,null))[_0xbe0b('0x1f')](saveUpdates(_0x5e2b31[_0xbe0b('0x5d')],null))[_0xbe0b('0x1f')](respondWithResult(_0x540ad8,null))[_0xbe0b('0x5b')](handleError(_0x540ad8,null));};exports[_0xbe0b('0x32')]=function(_0x4fd751,_0x58e0c8){return db[_0xbe0b('0x3d')]['find']({'where':{'id':_0x4fd751['params']['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x58e0c8,null))[_0xbe0b('0x1f')](removeEntity(_0x58e0c8,null))[_0xbe0b('0x5b')](handleError(_0x58e0c8,null));};exports[_0xbe0b('0x64')]=function(_0x9f30a3,_0x5f4c6c){return db[_0xbe0b('0x3d')][_0xbe0b('0x64')]()[_0xbe0b('0x1f')](respondWithResult(_0x5f4c6c,null))['catch'](handleError(_0x5f4c6c,null));};exports[_0xbe0b('0x65')]=function(_0x53ab8c,_0xee6fb4,_0x8f01a4){if(_0x53ab8c[_0xbe0b('0x5d')]['id']){delete _0x53ab8c['body']['id'];}return db[_0xbe0b('0x3d')]['find']({'where':{'id':_0x53ab8c[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0xee6fb4,null))['then'](function(_0x1fb8b7){if(_0x1fb8b7){_0x53ab8c[_0xbe0b('0x5d')]['SmsAccountId']=_0x1fb8b7['id'];return db[_0xbe0b('0x66')]['create'](_0x53ab8c['body']);}})['then'](respondWithResult(_0xee6fb4,null))[_0xbe0b('0x5b')](handleError(_0xee6fb4,null));};exports[_0xbe0b('0x67')]=function(_0x160401,_0x92fde7,_0x174dd6){var _0x427d9e={'raw':![],'where':{}};var _0x17bcee={};var _0x484e1d={'count':0x0,'rows':[]};return db[_0xbe0b('0x3d')][_0xbe0b('0x68')]({'where':{'id':_0x160401[_0xbe0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x92fde7,null))[_0xbe0b('0x1f')](function(_0x4576ce){if(_0x4576ce){_0x17bcee[_0xbe0b('0x47')]=_[_0xbe0b('0x44')](db['Disposition'][_0xbe0b('0x3e')]);_0x17bcee[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x160401['query']);_0x17bcee[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x17bcee['model'],_0x17bcee[_0xbe0b('0x43')]);_0x427d9e[_0xbe0b('0x49')]=_[_0xbe0b('0x46')](_0x17bcee[_0xbe0b('0x47')],qs['fields'](_0x160401[_0xbe0b('0x43')][_0xbe0b('0x48')]));_0x427d9e[_0xbe0b('0x49')]=_0x427d9e[_0xbe0b('0x49')]['length']?_0x427d9e[_0xbe0b('0x49')]:_0x17bcee['model'];if(!_0x160401[_0xbe0b('0x43')][_0xbe0b('0x4b')](_0xbe0b('0x4c'))){_0x427d9e[_0xbe0b('0x2d')]=qs[_0xbe0b('0x2d')](_0x160401[_0xbe0b('0x43')]['limit']);_0x427d9e[_0xbe0b('0x2b')]=qs[_0xbe0b('0x2b')](_0x160401[_0xbe0b('0x43')][_0xbe0b('0x2b')]);}_0x427d9e['order']=qs['sort'](_0x160401['query'][_0xbe0b('0x4e')]);_0x427d9e[_0xbe0b('0x4f')]=qs['filters'](_[_0xbe0b('0x50')](_0x160401[_0xbe0b('0x43')],_0x17bcee['filters']));_0x427d9e[_0xbe0b('0x4f')][_0xbe0b('0x69')]=_0x4576ce['id'];if(_0x160401[_0xbe0b('0x43')][_0xbe0b('0x51')]){_0x427d9e[_0xbe0b('0x4f')]=_[_0xbe0b('0x52')](_0x427d9e[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0x427d9e['attributes'],function(_0x48e3fb){var _0x6bb300={};_0x6bb300[_0x48e3fb]={'$like':'%'+_0x160401[_0xbe0b('0x43')][_0xbe0b('0x51')]+'%'};return _0x6bb300;})});}_0x427d9e=_['merge']({},_0x427d9e,_0x160401['options']);return db[_0xbe0b('0x66')][_0xbe0b('0x2e')]({'where':_0x427d9e[_0xbe0b('0x4f')]})['then'](function(_0x1c28f4){_0x484e1d[_0xbe0b('0x2e')]=_0x1c28f4;if(_0x160401[_0xbe0b('0x43')]['includeAll']){_0x427d9e[_0xbe0b('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xbe0b('0x57')](_0x427d9e);})['then'](function(_0x3371ff){_0x484e1d[_0xbe0b('0x6a')]=_0x3371ff;return _0x484e1d;});}})[_0xbe0b('0x1f')](respondWithFilteredResult(_0x92fde7,_0x427d9e))[_0xbe0b('0x5b')](handleError(_0x92fde7,null));};exports['removeDispositions']=function(_0x41206d,_0x5a9a5a,_0x305d3b){return db[_0xbe0b('0x3d')][_0xbe0b('0x5a')]({'where':{'id':_0x41206d['params']['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x5a9a5a,null))[_0xbe0b('0x1f')](function(_0x4afd20){if(_0x4afd20){return _0x4afd20[_0xbe0b('0x6b')](_0x41206d['query']['ids']);}})[_0xbe0b('0x1f')](respondWithStatusCode(_0x5a9a5a,null))[_0xbe0b('0x5b')](handleError(_0x5a9a5a,null));};exports[_0xbe0b('0x6c')]=function(_0x35ec71,_0x4994f5,_0x1b8250){if(_0x35ec71[_0xbe0b('0x5d')]['id']){delete _0x35ec71[_0xbe0b('0x5d')]['id'];}return db['SmsAccount'][_0xbe0b('0x5a')]({'where':{'id':_0x35ec71[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x4994f5,null))[_0xbe0b('0x1f')](function(_0x19976e){if(_0x19976e){_0x35ec71['body'][_0xbe0b('0x69')]=_0x19976e['id'];return db[_0xbe0b('0x6d')][_0xbe0b('0x5c')](_0x35ec71[_0xbe0b('0x5d')]);}})['then'](respondWithResult(_0x4994f5,null))[_0xbe0b('0x5b')](handleError(_0x4994f5,null));};exports['getAnswers']=function(_0x9a69ee,_0x2e0fff,_0x3616df){var _0x50602f={'raw':![],'where':{}};var _0x54cb20={};var _0x4fa350={'count':0x0,'rows':[]};return db[_0xbe0b('0x3d')][_0xbe0b('0x68')]({'where':{'id':_0x9a69ee[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x2e0fff,null))['then'](function(_0x53aa63){if(_0x53aa63){_0x54cb20['model']=_[_0xbe0b('0x44')](db[_0xbe0b('0x6d')][_0xbe0b('0x3e')]);_0x54cb20[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x9a69ee[_0xbe0b('0x43')]);_0x54cb20[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x54cb20['model'],_0x54cb20[_0xbe0b('0x43')]);_0x50602f[_0xbe0b('0x49')]=_[_0xbe0b('0x46')](_0x54cb20[_0xbe0b('0x47')],qs[_0xbe0b('0x48')](_0x9a69ee['query']['fields']));_0x50602f[_0xbe0b('0x49')]=_0x50602f[_0xbe0b('0x49')][_0xbe0b('0x4a')]?_0x50602f['attributes']:_0x54cb20['model'];if(!_0x9a69ee[_0xbe0b('0x43')]['hasOwnProperty']('nolimit')){_0x50602f['limit']=qs[_0xbe0b('0x2d')](_0x9a69ee[_0xbe0b('0x43')]['limit']);_0x50602f[_0xbe0b('0x2b')]=qs['offset'](_0x9a69ee[_0xbe0b('0x43')]['offset']);}_0x50602f[_0xbe0b('0x4d')]=qs[_0xbe0b('0x4e')](_0x9a69ee['query'][_0xbe0b('0x4e')]);_0x50602f[_0xbe0b('0x4f')]=qs['filters'](_[_0xbe0b('0x50')](_0x9a69ee[_0xbe0b('0x43')],_0x54cb20[_0xbe0b('0x45')]));_0x50602f[_0xbe0b('0x4f')]['SmsAccountId']=_0x53aa63['id'];if(_0x9a69ee[_0xbe0b('0x43')][_0xbe0b('0x51')]){_0x50602f[_0xbe0b('0x4f')]=_['merge'](_0x50602f[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0x50602f[_0xbe0b('0x49')],function(_0xfd6eca){var _0x4cbafe={};_0x4cbafe[_0xfd6eca]={'$like':'%'+_0x9a69ee[_0xbe0b('0x43')]['filter']+'%'};return _0x4cbafe;})});}_0x50602f=_[_0xbe0b('0x52')]({},_0x50602f,_0x9a69ee[_0xbe0b('0x54')]);return db[_0xbe0b('0x6d')][_0xbe0b('0x2e')]({'where':_0x50602f[_0xbe0b('0x4f')]})[_0xbe0b('0x1f')](function(_0x2b3ecc){_0x4fa350[_0xbe0b('0x2e')]=_0x2b3ecc;if(_0x9a69ee['query'][_0xbe0b('0x55')]){_0x50602f['include']=[{'all':!![]}];}return db[_0xbe0b('0x6d')][_0xbe0b('0x57')](_0x50602f);})['then'](function(_0x3f4ec0){_0x4fa350[_0xbe0b('0x6a')]=_0x3f4ec0;return _0x4fa350;});}})[_0xbe0b('0x1f')](respondWithFilteredResult(_0x2e0fff,_0x50602f))[_0xbe0b('0x5b')](handleError(_0x2e0fff,null));};exports[_0xbe0b('0x6e')]=function(_0x2fb655,_0x5c00d4,_0x4980ad){return db['SmsAccount'][_0xbe0b('0x5a')]({'where':{'id':_0x2fb655[_0xbe0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c00d4,null))['then'](function(_0xd5a47){if(_0xd5a47){return _0xd5a47[_0xbe0b('0x6e')](_0x2fb655['query']['ids']);}})['then'](respondWithStatusCode(_0x5c00d4,null))[_0xbe0b('0x5b')](handleError(_0x5c00d4,null));};exports[_0xbe0b('0x6f')]=function(_0x33c9de,_0x5a73e5,_0x376cc1){var _0x32bde7={'channel':_0xbe0b('0x70')};var _0x2ee361=[];var _0xf85593=[];var _0x3a0254={};return db[_0xbe0b('0x3d')][_0xbe0b('0x5a')]({'where':{'id':_0x33c9de[_0xbe0b('0x59')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xbe0b('0x71')}]})[_0xbe0b('0x1f')](handleEntityNotFound(_0x5a73e5,null))[_0xbe0b('0x1f')](function(_0x122db1){_0x32bde7[_0xbe0b('0x72')]=_0x122db1;_0x32bde7[_0xbe0b('0x73')]=_[_0xbe0b('0x74')](_0x122db1[_0xbe0b('0x71')],[_0xbe0b('0x75')],[_0xbe0b('0x76')]);if(_0x32bde7[_0xbe0b('0x72')][_0xbe0b('0x71')]){delete _0x32bde7['account'][_0xbe0b('0x71')];}return db[_0xbe0b('0x77')][_0xbe0b('0x64')]();})[_0xbe0b('0x1f')](function(_0x31a165){if(!_0x31a165){throw new db[(_0xbe0b('0x78'))][(_0xbe0b('0x79'))](_0xbe0b('0x7a'));}_0x2ee361=_[_0xbe0b('0x7b')](_['keys'](_0x31a165),['createdAt',_0xbe0b('0x7c')]);_0xf85593=_['difference'](_[_0xbe0b('0x44')](_0x31a165),[_0xbe0b('0x7d'),_0xbe0b('0x7c'),_0xbe0b('0x7e'),_0xbe0b('0x7f')]);_0x32bde7[_0xbe0b('0x5d')]={'mapKey':'mobile'};if(_0x32bde7['account'][_0xbe0b('0x40')]){switch(_0x32bde7[_0xbe0b('0x72')][_0xbe0b('0x40')]){case _0xbe0b('0x80'):_0x32bde7[_0xbe0b('0x5d')]['from']=_0x33c9de[_0xbe0b('0x5d')]['From'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x81')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')]=_0x33c9de[_0xbe0b('0x5d')]['MessageSid'];break;case _0xbe0b('0x83'):_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')]='+'+_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x85')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body'][_0xbe0b('0x86')];break;case _0xbe0b('0x87'):_0x32bde7['body'][_0xbe0b('0x84')]=_0x33c9de['body']['from'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body']['message'];break;case _0xbe0b('0x88'):_0x32bde7[_0xbe0b('0x5d')]['from']=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x84')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body']['body'];_0x32bde7['body'][_0xbe0b('0x82')]=_0x33c9de['body'][_0xbe0b('0x89')];break;case'plivo':_0x32bde7[_0xbe0b('0x5d')]['from']=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x8a')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body'][_0xbe0b('0x8b')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')]=_0x33c9de[_0xbe0b('0x5d')]['MessageUUID'];break;case _0xbe0b('0x8c'):_0x32bde7[_0xbe0b('0x5d')]['from']='+'+_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x8d')][0x0]['from'];_0x32bde7['body'][_0xbe0b('0x5d')]=_0x33c9de['body']['results'][0x0][_0xbe0b('0x86')];_0x32bde7['body']['messageId']=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x8d')][0x0]['messageId'];break;case _0xbe0b('0x8e'):_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')]=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x8f')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body'][_0xbe0b('0x90')][_0xbe0b('0x27')];break;case _0xbe0b('0x91'):_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')]=_0x33c9de['body'][_0xbe0b('0x92')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body']['text'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')]=_0x33c9de['body'][_0xbe0b('0x93')];break;case'bandwidth':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')]=_0x33c9de[_0xbe0b('0x5d')][0x0][_0xbe0b('0x27')]['id'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')]=_0x33c9de[_0xbe0b('0x5d')][0x0][_0xbe0b('0x27')]['from'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de[_0xbe0b('0x5d')][0x0][_0xbe0b('0x27')][_0xbe0b('0x86')];break;case _0xbe0b('0x94'):_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')]=_0x33c9de[_0xbe0b('0x5d')][_0xbe0b('0x84')];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x5d')]=_0x33c9de['body']['message'];_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')]=_0x33c9de['body']['refid'];break;}}if(_0x32bde7[_0xbe0b('0x5d')]['id']){delete _0x32bde7[_0xbe0b('0x5d')]['id'];}if(_[_0xbe0b('0x95')](_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')])){throw new db[(_0xbe0b('0x78'))][(_0xbe0b('0x79'))]('from\x20is\x20mandatory');}if(_[_0xbe0b('0x95')](_0x32bde7[_0xbe0b('0x5d')]['body'])||_0x32bde7[_0xbe0b('0x5d')]['body']===''){throw new db['Sequelize'][(_0xbe0b('0x79'))](_0xbe0b('0x96'));}if(_['isNil'](_0x32bde7['body'][_0xbe0b('0x97')])){throw new db['Sequelize'][(_0xbe0b('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xf85593);}if(!_[_0xbe0b('0x98')](_0xf85593,_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x97')])){throw new db[(_0xbe0b('0x78'))][(_0xbe0b('0x79'))](_0xbe0b('0x99')+_0xf85593);}_0x3a0254[_0x32bde7['body'][_0xbe0b('0x97')]]=_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')];return db[_0xbe0b('0x9a')][_0xbe0b('0x5a')]({'where':{'id':_0x32bde7[_0xbe0b('0x72')][_0xbe0b('0x7f')]},'include':[{'model':db[_0xbe0b('0x77')],'as':_0xbe0b('0x9b'),'where':_0x3a0254,'limit':0x1,'order':[[_0xbe0b('0x7c'),_0xbe0b('0x9c')]]}]});})['then'](handleEntityNotFound(_0x5a73e5,null))[_0xbe0b('0x1f')](function(_0x4b518b){if(_0x4b518b){_0x32bde7['list']=_[_0xbe0b('0x9d')](_0x4b518b,[_0xbe0b('0x9b')]);if(_0x4b518b[_0xbe0b('0x9b')][_0xbe0b('0x4a')]){return _0x4b518b[_0xbe0b('0x9b')][0x0];}var _0x4791b5=_[_0xbe0b('0x9e')](_0x32bde7[_0xbe0b('0x5d')],{'firstName':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')],'ListId':_0x4b518b['id']});_0x4791b5[_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x97')]]=_0x32bde7[_0xbe0b('0x5d')]['from'];return db['CmContact'][_0xbe0b('0x5c')](_0x4791b5,{'fields':_0x2ee361,'raw':!![]});}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x5a73e5,null))['then'](function(_0x311a1d){if(_0x311a1d){_0x32bde7[_0xbe0b('0x9f')]=_0x311a1d;var _0x1c1222={'ContactId':_0x311a1d['id'],'phone':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')],'SmsAccountId':_0x33c9de[_0xbe0b('0x59')]['id']};var _0x2f7da8={'ContactId':_0x311a1d['id'],'SmsAccountId':_0x33c9de[_0xbe0b('0x59')]['id'],'closed':![]};return db['SmsInteraction'][_0xbe0b('0x5a')]({'where':_0x2f7da8})['then'](function(_0x3777f8){if(_0x3777f8){return[_0x3777f8,![]];}return db[_0xbe0b('0xa0')][_0xbe0b('0x5c')](_0x1c1222)[_0xbe0b('0x1f')](function(_0x7e9253){return[_0x7e9253,!![]];});});}})['spread'](function(_0x37de9c,_0x5ac0b7){_0x32bde7['interaction']=_0x37de9c[_0xbe0b('0x33')]({'plain':!![]});_0x32bde7[_0xbe0b('0xa1')][_0xbe0b('0xa2')]=![];if(_0x5ac0b7){if(_0x32bde7['account'][_0xbe0b('0xa3')]){_0x32bde7[_0xbe0b('0x73')]['push']({'id':0x0,'priority':_0x32bde7[_0xbe0b('0x73')][_0xbe0b('0x4a')]+0x1,'app':_0xbe0b('0xa4'),'appdata':_0xbe0b('0xa5'),'interval':_0xbe0b('0xa6')});}_0x32bde7[_0xbe0b('0xa1')][_0xbe0b('0xa2')]=!![];}return db[_0xbe0b('0xa7')][_0xbe0b('0x5c')]({'phone':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x84')],'messageId':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0x82')],'body':_0x32bde7['body'][_0xbe0b('0x5d')],'SmsAccountId':_0x33c9de[_0xbe0b('0x59')]['id'],'SmsInteractionId':_0x37de9c['id'],'direction':'in','ContactId':_0x37de9c[_0xbe0b('0xa8')],'AttachmentId':_0x32bde7[_0xbe0b('0x5d')][_0xbe0b('0xa9')]});})[_0xbe0b('0x1f')](function(_0x3e8673){_0x32bde7[_0xbe0b('0x27')]=_0x3e8673;if(_0x32bde7[_0xbe0b('0xa1')][_0xbe0b('0xaa')]){return db[_0xbe0b('0xab')][_0xbe0b('0x5a')]({'attributes':['id',_0xbe0b('0x38')],'where':{'id':_0x32bde7['interaction'][_0xbe0b('0xaa')]}})['then'](function(_0x359ff2){if(_0x359ff2){_0x32bde7[_0xbe0b('0x73')][_0xbe0b('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x359ff2[_0xbe0b('0x38')]+','+(_0x32bde7[_0xbe0b('0x72')][_0xbe0b('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xbe0b('0xae'),_0xbe0b('0xaf'),_0x32bde7);});}return respondWithRpcPromise(_0xbe0b('0xae'),_0xbe0b('0xaf'),_0x32bde7);})[_0xbe0b('0x1f')](function(_0x27ef52){if(_0x27ef52){var _0xde2d=0xc8;var _0x370a2b=_0xbe0b('0xb0');logger[_0xbe0b('0x20')](_0xbe0b('0x23'),_0x370a2b,_0xde2d,_0xbe0b('0xb1'));logger[_0xbe0b('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x370a2b,_0xde2d,_0xbe0b('0xb1'),JSON[_0xbe0b('0x25')](_0x27ef52));if(_0x32bde7[_0xbe0b('0x72')][_0xbe0b('0x40')]===_0xbe0b('0x80')){return _0x5a73e5['status'](_0xde2d)[_0xbe0b('0xb2')](_0xbe0b('0xb3'),_0xbe0b('0xb4'))[_0xbe0b('0x39')](_0xbe0b('0xb5'));}else{return _0x5a73e5[_0xbe0b('0x29')](_0xde2d)[_0xbe0b('0x30')](_0x27ef52);}}})[_0xbe0b('0x5b')](handleError(_0x5a73e5,null));};exports[_0xbe0b('0xb6')]=function(_0x895b1e,_0x49ec48){var _0x23d074=_0x895b1e[_0xbe0b('0x59')]['id'];var _0x57b666=_0x895b1e[_0xbe0b('0x5d')];var _0x52a9d3=0xc8;var _0xf513a6=null;return db['sequelize'][_0xbe0b('0xb7')]({'isolationLevel':db[_0xbe0b('0xb8')]['Transaction'][_0xbe0b('0xb9')][_0xbe0b('0xba')]},function(_0x34ad44){return db[_0xbe0b('0x3d')][_0xbe0b('0x68')]({'where':{'id':_0x23d074},'transaction':_0x34ad44})[_0xbe0b('0x1f')](function(_0x5094c6){if(_0x5094c6){return db['SmsApplication'][_0xbe0b('0x32')]({'where':{'SmsAccountId':_0x23d074},'transaction':_0x34ad44})[_0xbe0b('0x1f')](function(){var _0x1fcd6f=_[_0xbe0b('0x42')](_0x57b666,function(_0x4fae2c){_0x4fae2c['SmsAccountId']=_0x23d074;return _0x4fae2c;});return db[_0xbe0b('0xbb')][_0xbe0b('0xbc')](_0x1fcd6f,{'transaction':_0x34ad44});});}else{_0x52a9d3=0x194;_0xf513a6=[];}});})[_0xbe0b('0x1f')](function(){if(_0x52a9d3!==0x194){return db['SmsApplication'][_0xbe0b('0xbd')]({'where':{'SmsAccountId':_0x23d074},'order':'priority'})['then'](function(_0x5dd402){_0xf513a6=_0x5dd402;});}})[_0xbe0b('0x5b')](function(_0x4c9ed7){_0x52a9d3=0x1f4;logger[_0xbe0b('0x26')](_0x4c9ed7[_0xbe0b('0x37')]);if(_0x4c9ed7['name']){delete _0x4c9ed7[_0xbe0b('0x38')];}_0xf513a6=_0x4c9ed7;})['finally'](function(){if(_0xf513a6===null){_0x49ec48[_0xbe0b('0x36')](_0x52a9d3);}else{if(_0x52a9d3===0x1f4){_0x49ec48[_0xbe0b('0x29')](_0x52a9d3)[_0xbe0b('0x39')](_0xf513a6);}else{_0x49ec48[_0xbe0b('0x29')](_0x52a9d3)[_0xbe0b('0x30')](_0xf513a6);}}});};exports['getApplications']=function(_0x2191f3,_0x5818c4,_0xe56cbc){var _0x5ef2f5={};var _0x553e1a={};var _0x2d7b6d;var _0x226747;return db['SmsAccount'][_0xbe0b('0x68')]({'where':{'id':_0x2191f3[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x5818c4,null))[_0xbe0b('0x1f')](function(_0x1566cf){if(_0x1566cf){_0x2d7b6d=_0x1566cf;_0x553e1a[_0xbe0b('0x47')]=_[_0xbe0b('0x44')](db['SmsApplication'][_0xbe0b('0x3e')]);_0x553e1a[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x2191f3[_0xbe0b('0x43')]);_0x553e1a[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x553e1a[_0xbe0b('0x47')],_0x553e1a['query']);_0x5ef2f5[_0xbe0b('0x49')]=_['intersection'](_0x553e1a['model'],qs[_0xbe0b('0x48')](_0x2191f3[_0xbe0b('0x43')][_0xbe0b('0x48')]));_0x5ef2f5['attributes']=_0x5ef2f5[_0xbe0b('0x49')][_0xbe0b('0x4a')]?_0x5ef2f5['attributes']:_0x553e1a[_0xbe0b('0x47')];_0x5ef2f5['order']=qs[_0xbe0b('0x4e')](_0x2191f3[_0xbe0b('0x43')]['sort']);_0x5ef2f5[_0xbe0b('0x4f')]=qs['filters'](_[_0xbe0b('0x50')](_0x2191f3['query'],_0x553e1a[_0xbe0b('0x45')]));if(_0x2191f3['query'][_0xbe0b('0x51')]){_0x5ef2f5[_0xbe0b('0x4f')]=_['merge'](_0x5ef2f5[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0x5ef2f5[_0xbe0b('0x49')],function(_0x25d7cf){var _0x3f4815={};_0x3f4815[_0x25d7cf]={'$like':'%'+_0x2191f3[_0xbe0b('0x43')][_0xbe0b('0x51')]+'%'};return _0x3f4815;})});}_0x5ef2f5=_[_0xbe0b('0x52')]({},_0x5ef2f5,_0x2191f3['options']);return _0x2d7b6d[_0xbe0b('0xbe')](_0x5ef2f5);}})['then'](function(_0x264a51){if(_0x264a51){_0x226747=_0x264a51['length'];if(!_0x2191f3['query'][_0xbe0b('0x4b')](_0xbe0b('0x4c'))){_0x5ef2f5[_0xbe0b('0x2d')]=qs[_0xbe0b('0x2d')](_0x2191f3['query'][_0xbe0b('0x2d')]);_0x5ef2f5[_0xbe0b('0x2b')]=qs[_0xbe0b('0x2b')](_0x2191f3[_0xbe0b('0x43')][_0xbe0b('0x2b')]);}return _0x2d7b6d[_0xbe0b('0xbe')](_0x5ef2f5);}})['then'](function(_0x5358a3){if(_0x5358a3){return _0x5358a3?{'count':_0x226747,'rows':_0x5358a3}:null;}})['then'](respondWithResult(_0x5818c4,null))[_0xbe0b('0x5b')](handleError(_0x5818c4,null));};exports['getInteractions']=function(_0x1d41b1,_0x32d82b,_0x434654){var _0x492866={'raw':![],'where':{}};var _0x43d79c={};var _0x3797a1={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x1d41b1[_0xbe0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x32d82b,null))[_0xbe0b('0x1f')](function(_0xc180bd){if(_0xc180bd){_0x43d79c[_0xbe0b('0x47')]=_[_0xbe0b('0x44')](db[_0xbe0b('0xa0')]['rawAttributes']);_0x43d79c['query']=_[_0xbe0b('0x44')](_0x1d41b1['query']);_0x43d79c[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x43d79c[_0xbe0b('0x47')],_0x43d79c['query']);_0x492866[_0xbe0b('0x49')]=_[_0xbe0b('0x46')](_0x43d79c[_0xbe0b('0x47')],qs[_0xbe0b('0x48')](_0x1d41b1['query'][_0xbe0b('0x48')]));_0x492866[_0xbe0b('0x49')]=_0x492866[_0xbe0b('0x49')]['length']?_0x492866[_0xbe0b('0x49')]:_0x43d79c[_0xbe0b('0x47')];if(!_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x4b')](_0xbe0b('0x4c'))){_0x492866['limit']=qs[_0xbe0b('0x2d')](_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x2d')]);_0x492866['offset']=qs['offset'](_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x2b')]);}_0x492866[_0xbe0b('0x4d')]=qs['sort'](_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x4e')]);_0x492866['where']=qs[_0xbe0b('0x45')](_[_0xbe0b('0x50')](_0x1d41b1['query'],_0x43d79c[_0xbe0b('0x45')]));_0x492866[_0xbe0b('0x4f')][_0xbe0b('0x69')]=_0xc180bd['id'];if(_0x1d41b1['query'][_0xbe0b('0x51')]){_0x492866[_0xbe0b('0x4f')]=_['merge'](_0x492866[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0x492866[_0xbe0b('0x49')],function(_0x25cb61){var _0x3313a9={};_0x3313a9[_0x25cb61]={'$like':'%'+_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x51')]+'%'};return _0x3313a9;})});}_0x492866=_[_0xbe0b('0x52')]({},_0x492866,_0x1d41b1[_0xbe0b('0x54')]);return db[_0xbe0b('0xa0')][_0xbe0b('0x2e')]({'where':_0x492866[_0xbe0b('0x4f')]})['then'](function(_0x5c1d9d){_0x3797a1['count']=_0x5c1d9d;if(_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0x55')]){_0x492866[_0xbe0b('0x56')]=[{'model':db['CmContact'],'as':_0xbe0b('0xbf'),'required':![]},{'model':db[_0xbe0b('0xab')],'as':_0xbe0b('0xc0'),'attributes':[_0xbe0b('0x38'),_0xbe0b('0xc1'),_0xbe0b('0xc2')],'required':![]},{'model':db[_0xbe0b('0xc3')],'as':_0xbe0b('0xc4'),'attributes':['id',_0xbe0b('0x38'),_0xbe0b('0xc5')],'where':_0x1d41b1['query'][_0xbe0b('0xc6')]?{'id':_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0xc6')]}:undefined,'required':_0x1d41b1[_0xbe0b('0x43')][_0xbe0b('0xc6')]?!![]:![]}];}return db[_0xbe0b('0xa0')]['findAll'](_0x492866);})[_0xbe0b('0x1f')](function(_0x34305f){_0x3797a1[_0xbe0b('0x6a')]=_0x34305f;return _0x3797a1;});}})[_0xbe0b('0x1f')](respondWithFilteredResult(_0x32d82b,_0x492866))[_0xbe0b('0x5b')](handleError(_0x32d82b,null));};exports['send']=function(_0x3b9391,_0x39d79d,_0x161bd8){var _0x347108,_0x406e2e,_0x5d37b8;if(_['isNil'](_0x3b9391['body'][_0xbe0b('0x5d')])||_0x3b9391[_0xbe0b('0x5d')][_0xbe0b('0x5d')]===''){throw new db['Sequelize'][(_0xbe0b('0x79'))](_0xbe0b('0x96'));}if(_[_0xbe0b('0x95')](_0x3b9391[_0xbe0b('0x5d')]['to'])){throw new db[(_0xbe0b('0x78'))][(_0xbe0b('0x79'))]('to\x20is\x20mandatory');}_0x347108=_0x3b9391['body']['to'];return db[_0xbe0b('0x3d')][_0xbe0b('0x5a')]({'where':{'id':_0x3b9391[_0xbe0b('0x59')]['id']},'include':[{'model':db[_0xbe0b('0x9a')],'as':_0xbe0b('0xc7'),'include':[{'model':db['CmContact'],'as':_0xbe0b('0x9b'),'where':{'mobile':_0x347108},'limit':0x1,'order':[[_0xbe0b('0x7c'),_0xbe0b('0x9c')]]}]}]})[_0xbe0b('0x1f')](handleEntityNotFound(_0x39d79d,null))['then'](function(_0x94edeb){if(_0x94edeb&&_0x94edeb[_0xbe0b('0xc7')]){_0x406e2e=_0x94edeb[_0xbe0b('0x33')]({'plain':!![]});if(_0x406e2e[_0xbe0b('0xc7')]&&_0x406e2e[_0xbe0b('0xc7')]['Contacts'][_0xbe0b('0x4a')]){return _0x406e2e[_0xbe0b('0xc7')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0xbe0b('0x9e')](_0x3b9391[_0xbe0b('0x5d')],{'firstName':_0x347108,'mobile':_0x347108,'phone':_0x347108,'ListId':_0x406e2e[_0xbe0b('0x7f')]}));}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x39d79d,null))['then'](function(_0x3901ec){if(_0x3901ec){_0x5d37b8=_0x3901ec;return db['SmsInteraction'][_0xbe0b('0x5a')]({'where':{'ContactId':_0x5d37b8['id'],'closed':![],'SmsAccountId':_0x406e2e['id']}})['then'](function(_0x48c186){if(_0x48c186){return[_0x48c186,![]];}return db[_0xbe0b('0xa0')][_0xbe0b('0x5c')]({'UserId':_0x3b9391[_0xbe0b('0x5e')]['id'],'ContactId':_0x5d37b8['id'],'SmsAccountId':_0x406e2e['id'],'phone':_0x347108,'firstMsgDirection':'out','Messages':[_['merge'](_0x3b9391['body'],{'read':![],'body':_0x3b9391[_0xbe0b('0x5d')]['body'],'phone':_0x347108,'SmsAccountId':_0x406e2e['id'],'UserId':_0x3b9391[_0xbe0b('0x5e')]['id'],'ContactId':_0x5d37b8['id']})]},{'include':[{'model':db[_0xbe0b('0xa7')],'as':_0xbe0b('0xc8')}]})[_0xbe0b('0x1f')](function(_0x2cf1e7){return[_0x2cf1e7,!![]];});});}})[_0xbe0b('0xc9')](function(_0x381967,_0x5c47f9){if(_0x5c47f9){return _0x381967;}return db[_0xbe0b('0xa7')][_0xbe0b('0x5c')](_[_0xbe0b('0x52')](_0x3b9391[_0xbe0b('0x5d')],{'read':![],'body':_0x3b9391[_0xbe0b('0x5d')][_0xbe0b('0x5d')],'phone':_0x347108,'SmsAccountId':_0x406e2e['id'],'SmsInteractionId':_0x381967['id'],'UserId':_0x3b9391['user']['id'],'ContactId':_0x5d37b8['id']}))[_0xbe0b('0x1f')](function(_0x553a82){_0x381967['dataValues'][_0xbe0b('0xc8')]=[];_0x381967[_0xbe0b('0xca')][_0xbe0b('0xc8')][_0xbe0b('0xcb')](_0x553a82['dataValues']);return _0x381967;});})[_0xbe0b('0x1f')](respondWithResult(_0x39d79d,null))['catch'](handleError(_0x39d79d,null));};exports[_0xbe0b('0x29')]=function(_0x11f75b,_0x21ff41,_0xf0d9){if(_0x11f75b[_0xbe0b('0x5d')]['id']){delete _0x11f75b[_0xbe0b('0x5d')]['id'];}var _0x12dadb,_0x49707b,_0x491737;return db['SmsAccount'][_0xbe0b('0x5a')]({'where':{'id':_0x11f75b[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x21ff41,null))[_0xbe0b('0x1f')](function(_0x5318e4){if(_0x5318e4){_0x491737=_0x5318e4;logger['debug'](_0xbe0b('0x23'),_0xbe0b('0x29'),_0xbe0b('0xcc'),_0x5318e4[_0xbe0b('0x40')],util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5318e4[_0xbe0b('0x40')]){case _0xbe0b('0x83'):if(_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0xce')]&&_0x11f75b[_0xbe0b('0x5d')]['status']){_0x49707b=_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x29')];return db['SmsMessage'][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b[_0xbe0b('0x5d')]['skebby_dispatch_id']}});}break;case _0xbe0b('0x87'):if(_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0xcf')]&&_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0xd0')]){_0x49707b=_0x11f75b['body'][_0xbe0b('0xd0')];return db[_0xbe0b('0xa7')][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b['body'][_0xbe0b('0xcf')]}});}break;case _0xbe0b('0x88'):if(_0x11f75b['body'][_0xbe0b('0x89')]&&_0x11f75b['body'][_0xbe0b('0xd1')]){_0x49707b=_0x11f75b['body'][_0xbe0b('0xd1')];return db[_0xbe0b('0xa7')][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b['body'][_0xbe0b('0x89')]}});}break;case _0xbe0b('0x8c'):var _0x5a765d=_0x11f75b[_0xbe0b('0x5d')]['results'][0x0];if(_0x5a765d[_0xbe0b('0x82')]&&_0x5a765d[_0xbe0b('0x29')][_0xbe0b('0xd2')]===_0xbe0b('0xd3')){_0x49707b=_0x5a765d['status'][_0xbe0b('0xd2')];return db[_0xbe0b('0xa7')][_0xbe0b('0x5a')]({'where':{'messageId':_0x5a765d[_0xbe0b('0x82')]}});}break;case _0xbe0b('0x91'):if(_0x11f75b[_0xbe0b('0x5d')]['messageId']&&_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x29')]){_0x49707b=_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x29')];return db['SmsMessage'][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x82')]}});}break;case'bandwidth':if(_0x11f75b[_0xbe0b('0x5d')][0x0]['message']['id']){_0x49707b=_0x11f75b[_0xbe0b('0x5d')][0x0][_0xbe0b('0x40')];return db[_0xbe0b('0xa7')][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b[_0xbe0b('0x5d')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x11f75b[_0xbe0b('0x5d')]['redif']&&_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x29')]){_0x49707b=_0x11f75b[_0xbe0b('0x5d')][_0xbe0b('0x29')];return db['SmsMessage'][_0xbe0b('0x5a')]({'where':{'messageId':_0x11f75b['body'][_0xbe0b('0xd4')]}});}break;}}})['then'](handleEntityNotFound(_0x21ff41,null))[_0xbe0b('0x1f')](function(_0x2888e9){if(_0x2888e9){_0x12dadb=_0x2888e9;switch(_0x491737[_0xbe0b('0x40')]){case _0xbe0b('0x83'):if(_0x49707b===_0xbe0b('0xd3')){return _0x12dadb[_0xbe0b('0xd5')]({'read':!![]});}else{logger[_0xbe0b('0x26')](_0xbe0b('0x23'),_0xbe0b('0x29'),_0xbe0b('0x83'),util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xbe0b('0x87'):if(_0x49707b==='1'){return _0x12dadb['update']({'read':!![]});}else{logger['error'](_0xbe0b('0x23'),_0xbe0b('0x29'),_0xbe0b('0x83'),util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x11f75b['body'][_0xbe0b('0xd6')]&&_0x49707b>=0xc8&&_0x49707b<=0xce){return _0x12dadb[_0xbe0b('0xd5')]({'read':!![]});}else{logger[_0xbe0b('0x26')](_0xbe0b('0x23'),'status',_0xbe0b('0x88'),util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x65e6f6=_0x11f75b[_0xbe0b('0x5d')]['results'][0x0];if(_0x65e6f6['status'][_0xbe0b('0xd2')]==='DELIVERED'){return _0x12dadb['update']({'read':!![]});}else{logger[_0xbe0b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbe0b('0x29'),_0xbe0b('0x8c'),util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xbe0b('0x91'):if(_0x49707b==_0xbe0b('0xd7')||_0x49707b==_0xbe0b('0xd8')){return _0x12dadb[_0xbe0b('0xd5')]({'read':!![]});}else{logger[_0xbe0b('0x26')](_0xbe0b('0x23'),_0xbe0b('0x29'),'clickatell',util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x49707b=='message-delivered'){return _0x12dadb[_0xbe0b('0xd5')]({'read':!![]});}else{logger['error'](_0xbe0b('0x23'),_0xbe0b('0x29'),'bandwidth',util['inspect'](_0x11f75b['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x49707b===_0xbe0b('0xd9')||_0x49707b===_0xbe0b('0xda')){return _0x12dadb[_0xbe0b('0xd5')]({'read':!![]});}else{logger[_0xbe0b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbe0b('0x29'),_0xbe0b('0x94'),util[_0xbe0b('0xcd')](_0x11f75b[_0xbe0b('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x12dadb;}})[_0xbe0b('0x1f')](respondWithResult(_0x21ff41,null))[_0xbe0b('0x5b')](handleError(_0x21ff41,null));};exports[_0xbe0b('0xdb')]=function(_0x3891b0,_0x43dd24,_0x3f73c6){var _0x21a6dc,_0x121ca9,_0x242958;return db['SmsAccount']['find']({'where':{'id':_0x3891b0[_0xbe0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x43dd24,null))[_0xbe0b('0x1f')](function(_0x1b842c){if(_0x1b842c){_0x242958=_0x1b842c;logger[_0xbe0b('0x22')](_0xbe0b('0x23'),_0xbe0b('0x29'),_0xbe0b('0xcc'),_0x1b842c['type'],util[_0xbe0b('0xcd')](_0x3891b0['query'],{'showHidden':![],'depth':null}));switch(_0x1b842c[_0xbe0b('0x40')]){case'csc':if(_0x3891b0[_0xbe0b('0x43')][_0xbe0b('0xdc')]&&_0x3891b0[_0xbe0b('0x43')][_0xbe0b('0xdd')]){_0x121ca9=_0x3891b0[_0xbe0b('0x43')][_0xbe0b('0xdd')];return db[_0xbe0b('0xa7')][_0xbe0b('0x5a')]({'where':{'messageId':_0x3891b0['query'][_0xbe0b('0xdc')]}});}break;}}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x43dd24,null))[_0xbe0b('0x1f')](function(_0x4a53c0){if(_0x4a53c0){_0x21a6dc=_0x4a53c0;switch(_0x242958[_0xbe0b('0x40')]){case _0xbe0b('0x8e'):if(_0x121ca9==='2'||_0x121ca9==='6'){return _0x21a6dc[_0xbe0b('0xd5')]({'read':!![]});}else{logger[_0xbe0b('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xbe0b('0x29'),_0xbe0b('0x8e'),util[_0xbe0b('0xcd')](_0x3891b0[_0xbe0b('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x21a6dc;}})[_0xbe0b('0x1f')](respondWithResult(_0x43dd24,null))[_0xbe0b('0x5b')](handleError(_0x43dd24,null));};exports[_0xbe0b('0xde')]=function(_0xfc1d9,_0x5068f9,_0x43031c){return db['SmsAccount'][_0xbe0b('0x5a')]({'where':{'id':_0xfc1d9[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x5068f9,null))[_0xbe0b('0x1f')](function(_0x27ff64){if(_0x27ff64){return _0x27ff64['addAgents'](_0xfc1d9['body'][_0xbe0b('0xdf')],_['omit'](_0xfc1d9[_0xbe0b('0x5d')],[_0xbe0b('0xdf'),'id'])||{})[_0xbe0b('0xc9')](function(_0x8da851){for(var _0x52926e=0x0;_0x52926e<_0xfc1d9[_0xbe0b('0x5d')][_0xbe0b('0xdf')][_0xbe0b('0x4a')];_0x52926e+=0x1){socket[_0xbe0b('0xe0')](_0xbe0b('0xe1'),{'UserId':Number(_0xfc1d9[_0xbe0b('0x5d')][_0xbe0b('0xdf')][_0x52926e]),'SmsAccountId':Number(_0xfc1d9[_0xbe0b('0x59')]['id'])});}return _0x8da851;});}})[_0xbe0b('0x1f')](respondWithResult(_0x5068f9,null))['catch'](handleError(_0x5068f9,null));};exports[_0xbe0b('0xe2')]=function(_0x8ca8f2,_0x3cf46c,_0x381467){return db[_0xbe0b('0x3d')][_0xbe0b('0x5a')]({'where':{'id':_0x8ca8f2[_0xbe0b('0x59')]['id']}})[_0xbe0b('0x1f')](handleEntityNotFound(_0x3cf46c,null))[_0xbe0b('0x1f')](function(_0x4f01b9){if(_0x4f01b9){return _0x4f01b9['removeAgents'](_0x8ca8f2[_0xbe0b('0x43')]['ids'])[_0xbe0b('0x1f')](function(){if(_[_0xbe0b('0xe3')](_0x8ca8f2[_0xbe0b('0x43')][_0xbe0b('0xdf')])){for(var _0x2aa6d7=0x0;_0x2aa6d7<_0x8ca8f2[_0xbe0b('0x43')][_0xbe0b('0xdf')][_0xbe0b('0x4a')];_0x2aa6d7+=0x1){socket[_0xbe0b('0xe0')](_0xbe0b('0xe4'),{'UserId':Number(_0x8ca8f2[_0xbe0b('0x43')]['ids'][_0x2aa6d7]),'SmsAccountId':Number(_0x8ca8f2['params']['id'])});}}else{socket['emit'](_0xbe0b('0xe4'),{'UserId':Number(_0x8ca8f2[_0xbe0b('0x43')][_0xbe0b('0xdf')]),'SmsAccountId':Number(_0x8ca8f2[_0xbe0b('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x3cf46c,null))['catch'](handleError(_0x3cf46c,null));};exports[_0xbe0b('0xe5')]=function(_0x4c1cbf,_0x3aa50c,_0x5dbc7c){var _0xe0e0af={};var _0x2d4285={};var _0x52fc3b;var _0x1f31f0;return db['SmsAccount']['findOne']({'where':{'id':_0x4c1cbf[_0xbe0b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3aa50c,null))[_0xbe0b('0x1f')](function(_0x516dce){if(_0x516dce){_0x52fc3b=_0x516dce;_0x2d4285[_0xbe0b('0x47')]=_[_0xbe0b('0x44')](db[_0xbe0b('0xab')][_0xbe0b('0x3e')]);_0x2d4285[_0xbe0b('0x43')]=_[_0xbe0b('0x44')](_0x4c1cbf[_0xbe0b('0x43')]);_0x2d4285[_0xbe0b('0x45')]=_[_0xbe0b('0x46')](_0x2d4285['model'],_0x2d4285[_0xbe0b('0x43')]);_0xe0e0af[_0xbe0b('0x49')]=_[_0xbe0b('0x46')](_0x2d4285[_0xbe0b('0x47')],qs['fields'](_0x4c1cbf['query'][_0xbe0b('0x48')]));_0xe0e0af['attributes']=_0xe0e0af['attributes'][_0xbe0b('0x4a')]?_0xe0e0af[_0xbe0b('0x49')]:_0x2d4285[_0xbe0b('0x47')];_0xe0e0af[_0xbe0b('0x4d')]=qs[_0xbe0b('0x4e')](_0x4c1cbf[_0xbe0b('0x43')][_0xbe0b('0x4e')]);_0xe0e0af['where']=qs[_0xbe0b('0x45')](_[_0xbe0b('0x50')](_0x4c1cbf['query'],_0x2d4285['filters']));if(_0x4c1cbf['query']['filter']){_0xe0e0af[_0xbe0b('0x4f')]=_[_0xbe0b('0x52')](_0xe0e0af[_0xbe0b('0x4f')],{'$or':_[_0xbe0b('0x42')](_0xe0e0af[_0xbe0b('0x49')],function(_0x5259a7){var _0x334194={};_0x334194[_0x5259a7]={'$like':'%'+_0x4c1cbf[_0xbe0b('0x43')]['filter']+'%'};return _0x334194;})});}_0xe0e0af=_[_0xbe0b('0x52')]({},_0xe0e0af,_0x4c1cbf[_0xbe0b('0x54')]);return _0x52fc3b[_0xbe0b('0xe5')](_0xe0e0af);}})[_0xbe0b('0x1f')](function(_0x1be59e){if(_0x1be59e){_0x1f31f0=_0x1be59e[_0xbe0b('0x4a')];if(!_0x4c1cbf['query'][_0xbe0b('0x4b')](_0xbe0b('0x4c'))){_0xe0e0af[_0xbe0b('0x2d')]=qs[_0xbe0b('0x2d')](_0x4c1cbf[_0xbe0b('0x43')][_0xbe0b('0x2d')]);_0xe0e0af[_0xbe0b('0x2b')]=qs[_0xbe0b('0x2b')](_0x4c1cbf[_0xbe0b('0x43')][_0xbe0b('0x2b')]);}return _0x52fc3b[_0xbe0b('0xe5')](_0xe0e0af);}})[_0xbe0b('0x1f')](function(_0x99f34c){if(_0x99f34c){return _0x99f34c?{'count':_0x1f31f0,'rows':_0x99f34c}:null;}})[_0xbe0b('0x1f')](respondWithResult(_0x3aa50c,null))['catch'](handleError(_0x3aa50c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index b1490e3..0b43edf 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 _0xb0ca=['SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5edb2e,_0x5bc71e){var _0x2786ee=function(_0x34ce94){while(--_0x34ce94){_0x5edb2e['push'](_0x5edb2e['shift']());}};_0x2786ee(++_0x5bc71e);}(_0xb0ca,0x8a));var _0xab0c=function(_0x5d0d2e,_0x5c859d){_0x5d0d2e=_0x5d0d2e-0x0;var _0x5ad0f2=_0xb0ca[_0x5d0d2e];return _0x5ad0f2;};'use strict';var EventEmitter=require(_0xab0c('0x0'));var SmsAccount=require(_0xab0c('0x1'))['db'][_0xab0c('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xab0c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xab0c('0x4'),'afterDestroy':_0xab0c('0x5')};function emitEvent(_0x367719){return function(_0x297274,_0x4aaf46,_0x4149a8){SmsAccountEvents[_0xab0c('0x6')](_0x367719+':'+_0x297274['id'],_0x297274);SmsAccountEvents[_0xab0c('0x6')](_0x367719,_0x297274);_0x4149a8(null);};}for(var e in events){if(events[_0xab0c('0x7')](e)){var event=events[e];SmsAccount[_0xab0c('0x8')](e,emitEvent(event));}}module[_0xab0c('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x85fe=['exports','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x57c8cd,_0x1cd503){var _0x428b85=function(_0x4ecbb7){while(--_0x4ecbb7){_0x57c8cd['push'](_0x57c8cd['shift']());}};_0x428b85(++_0x1cd503);}(_0x85fe,0xeb));var _0xe85f=function(_0x57968b,_0x5b29ec){_0x57968b=_0x57968b-0x0;var _0x8d1846=_0x85fe[_0x57968b];return _0x8d1846;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe85f('0x0'))['db'][_0xe85f('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe85f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe85f('0x3'),'afterDestroy':_0xe85f('0x4')};function emitEvent(_0x579c48){return function(_0x427b3e,_0x54e57b,_0x31175b){SmsAccountEvents[_0xe85f('0x5')](_0x579c48+':'+_0x427b3e['id'],_0x427b3e);SmsAccountEvents['emit'](_0x579c48,_0x427b3e);_0x31175b(null);};}for(var e in events){if(events[_0xe85f('0x6')](e)){var event=events[e];SmsAccount[_0xe85f('0x7')](e,emitEvent(event));}}module[_0xe85f('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 e36fb2a..cdad912 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 _0xb82d=['request-promise','path','rimraf','define','SmsAccount','sms_accounts','lodash','util','api','bluebird'];(function(_0x301669,_0x3ba215){var _0x125292=function(_0x44cc33){while(--_0x44cc33){_0x301669['push'](_0x301669['shift']());}};_0x125292(++_0x3ba215);}(_0xb82d,0x1f0));var _0xdb82=function(_0x256b00,_0x137419){_0x256b00=_0x256b00-0x0;var _0x590f4f=_0xb82d[_0x256b00];return _0x590f4f;};'use strict';var _=require(_0xdb82('0x0'));var util=require(_0xdb82('0x1'));var logger=require('../../config/logger')(_0xdb82('0x2'));var moment=require('moment');var BPromise=require(_0xdb82('0x3'));var rp=require(_0xdb82('0x4'));var fs=require('fs');var path=require(_0xdb82('0x5'));var rimraf=require(_0xdb82('0x6'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x24500e,_0x102891){return _0x24500e[_0xdb82('0x7')](_0xdb82('0x8'),attributes,{'tableName':_0xdb82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9240=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','lodash'];(function(_0x25f2a1,_0x134bd7){var _0x2f96a2=function(_0x20533c){while(--_0x20533c){_0x25f2a1['push'](_0x25f2a1['shift']());}};_0x2f96a2(++_0x134bd7);}(_0x9240,0x8b));var _0x0924=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x9240[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0x0924('0x0'));var util=require('util');var logger=require(_0x0924('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0924('0x2'));var rp=require(_0x0924('0x3'));var fs=require('fs');var path=require(_0x0924('0x4'));var rimraf=require(_0x0924('0x5'));var config=require(_0x0924('0x6'));var attributes=require(_0x0924('0x7'));module[_0x0924('0x8')]=function(_0x4fabb3,_0x55fd4d){return _0x4fabb3['define'](_0x0924('0x9'),attributes,{'tableName':'sms_accounts','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 73d5f21..87d341d 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 _0x432d=['map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','register','request','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','request\x20sent','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','model'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x432d,0xb5));var _0xd432=function(_0x4c1078,_0x279c61){_0x4c1078=_0x4c1078-0x0;var _0x164ffe=_0x432d[_0x4c1078];return _0x164ffe;};'use strict';var _=require(_0xd432('0x0'));var util=require(_0xd432('0x1'));var moment=require(_0xd432('0x2'));var BPromise=require(_0xd432('0x3'));var rs=require(_0xd432('0x4'));var fs=require('fs');var Redis=require(_0xd432('0x5'));var db=require(_0xd432('0x6'))['db'];var utils=require(_0xd432('0x7'));var logger=require(_0xd432('0x8'))('rpc');var config=require(_0xd432('0x9'));var jayson=require(_0xd432('0xa'));var client=jayson[_0xd432('0xb')][_0xd432('0xc')]({'port':0x232a});config[_0xd432('0xd')]=_['defaults'](config[_0xd432('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd432('0xd')]));require('./smsAccount.socket')[_0xd432('0xe')](socket);function respondWithRpcPromise(_0x2d4282,_0x214f89,_0x1e28e6){return new BPromise(function(_0x2496e0,_0x2cf62b){return client[_0xd432('0xf')](_0x2d4282,_0x1e28e6)['then'](function(_0x53db0f){logger[_0xd432('0x10')]('SmsAccount,\x20%s,\x20%s',_0x214f89,'request\x20sent');logger[_0xd432('0x11')](_0xd432('0x12'),_0x214f89,'request\x20sent',JSON[_0xd432('0x13')](_0x53db0f));if(_0x53db0f[_0xd432('0x14')]){if(_0x53db0f[_0xd432('0x14')][_0xd432('0x15')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x214f89,_0x53db0f[_0xd432('0x14')]['message']);return _0x2cf62b(_0x53db0f[_0xd432('0x14')][_0xd432('0x16')]);}logger[_0xd432('0x14')](_0xd432('0x17'),_0x214f89,_0x53db0f[_0xd432('0x14')][_0xd432('0x16')]);return _0x2496e0(_0x53db0f[_0xd432('0x14')][_0xd432('0x16')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x214f89,_0xd432('0x18'));_0x2496e0(_0x53db0f[_0xd432('0x19')][_0xd432('0x16')]);}})[_0xd432('0x1a')](function(_0x31fedd){logger['error'](_0xd432('0x17'),_0x214f89,_0x31fedd);_0x2cf62b(_0x31fedd);});});}exports[_0xd432('0x1b')]=function(_0x426eeb){var _0x2d520e=this;return new Promise(function(_0x1f8ac0,_0x18ffeb){return db[_0xd432('0x1c')][_0xd432('0x1d')]({'raw':_0x426eeb[_0xd432('0x1e')]?_0x426eeb['options']['raw']===undefined?!![]:![]:!![],'where':_0x426eeb[_0xd432('0x1e')]?_0x426eeb[_0xd432('0x1e')][_0xd432('0x1f')]||null:null,'attributes':_0x426eeb[_0xd432('0x1e')]?_0x426eeb['options'][_0xd432('0x20')]||null:null,'include':_0x426eeb[_0xd432('0x1e')]?_0x426eeb[_0xd432('0x1e')][_0xd432('0x21')]?_['map'](_0x426eeb['options'][_0xd432('0x21')],function(_0x355751){return{'model':db[_0x355751[_0xd432('0x22')]],'as':_0x355751['as'],'attributes':_0x355751[_0xd432('0x20')],'include':_0x355751[_0xd432('0x21')]?_[_0xd432('0x23')](_0x355751[_0xd432('0x21')],function(_0x1133f3){return{'model':db[_0x1133f3[_0xd432('0x22')]],'as':_0x1133f3['as'],'attributes':_0x1133f3['attributes'],'include':_0x1133f3['include']?_[_0xd432('0x23')](_0x1133f3['include'],function(_0x387312){return{'model':db[_0x387312[_0xd432('0x22')]],'as':_0x387312['as'],'attributes':_0x387312[_0xd432('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c30cd){logger[_0xd432('0x10')]('ShowSmsAccount',_0x426eeb);logger[_0xd432('0x11')]('ShowSmsAccount',_0x426eeb,JSON[_0xd432('0x13')](_0x4c30cd));_0x1f8ac0(_0x4c30cd);})[_0xd432('0x1a')](function(_0x1bf9a2){logger[_0xd432('0x14')](_0xd432('0x1b'),_0x1bf9a2['message'],_0x426eeb);_0x18ffeb(_0x2d520e[_0xd432('0x14')](0x1f4,_0x1bf9a2['message']));});});}; \ No newline at end of file +var _0xe372=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','attributes','model','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x11f338,_0x6ae329){var _0xc3212e=function(_0x22f9d8){while(--_0x22f9d8){_0x11f338['push'](_0x11f338['shift']());}};_0xc3212e(++_0x6ae329);}(_0xe372,0xfd));var _0x2e37=function(_0xf31767,_0x381746){_0xf31767=_0xf31767-0x0;var _0x24bd0c=_0xe372[_0xf31767];return _0x24bd0c;};'use strict';var _=require(_0x2e37('0x0'));var util=require(_0x2e37('0x1'));var moment=require(_0x2e37('0x2'));var BPromise=require('bluebird');var rs=require(_0x2e37('0x3'));var fs=require('fs');var Redis=require(_0x2e37('0x4'));var db=require(_0x2e37('0x5'))['db'];var utils=require(_0x2e37('0x6'));var logger=require(_0x2e37('0x7'))(_0x2e37('0x8'));var config=require(_0x2e37('0x9'));var jayson=require(_0x2e37('0xa'));var client=jayson[_0x2e37('0xb')]['http']({'port':0x232a});config[_0x2e37('0xc')]=_['defaults'](config['redis'],{'host':_0x2e37('0xd'),'port':0x18eb});var socket=require(_0x2e37('0xe'))(new Redis(config[_0x2e37('0xc')]));require(_0x2e37('0xf'))['register'](socket);function respondWithRpcPromise(_0x8d6904,_0x28a904,_0x35505b){return new BPromise(function(_0x2369af,_0x2d71ec){return client[_0x2e37('0x10')](_0x8d6904,_0x35505b)[_0x2e37('0x11')](function(_0x430638){logger[_0x2e37('0x12')](_0x2e37('0x13'),_0x28a904,_0x2e37('0x14'));logger[_0x2e37('0x15')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x28a904,_0x2e37('0x14'),JSON[_0x2e37('0x16')](_0x430638));if(_0x430638[_0x2e37('0x17')]){if(_0x430638[_0x2e37('0x17')][_0x2e37('0x18')]===0x1f4){logger[_0x2e37('0x17')]('SmsAccount,\x20%s,\x20%s',_0x28a904,_0x430638[_0x2e37('0x17')][_0x2e37('0x19')]);return _0x2d71ec(_0x430638[_0x2e37('0x17')]['message']);}logger[_0x2e37('0x17')](_0x2e37('0x13'),_0x28a904,_0x430638[_0x2e37('0x17')][_0x2e37('0x19')]);return _0x2369af(_0x430638['error'][_0x2e37('0x19')]);}else{logger['info'](_0x2e37('0x13'),_0x28a904,_0x2e37('0x14'));_0x2369af(_0x430638[_0x2e37('0x1a')][_0x2e37('0x19')]);}})['catch'](function(_0x5593b9){logger[_0x2e37('0x17')](_0x2e37('0x13'),_0x28a904,_0x5593b9);_0x2d71ec(_0x5593b9);});});}exports[_0x2e37('0x1b')]=function(_0x114fe){var _0x5cb950=this;return new Promise(function(_0x588b0d,_0x16226e){return db[_0x2e37('0x1c')][_0x2e37('0x1d')]({'raw':_0x114fe['options']?_0x114fe[_0x2e37('0x1e')][_0x2e37('0x1f')]===undefined?!![]:![]:!![],'where':_0x114fe[_0x2e37('0x1e')]?_0x114fe[_0x2e37('0x1e')][_0x2e37('0x20')]||null:null,'attributes':_0x114fe[_0x2e37('0x1e')]?_0x114fe[_0x2e37('0x1e')]['attributes']||null:null,'include':_0x114fe[_0x2e37('0x1e')]?_0x114fe['options'][_0x2e37('0x21')]?_[_0x2e37('0x22')](_0x114fe[_0x2e37('0x1e')]['include'],function(_0x4ab0f9){return{'model':db[_0x4ab0f9['model']],'as':_0x4ab0f9['as'],'attributes':_0x4ab0f9['attributes'],'include':_0x4ab0f9['include']?_['map'](_0x4ab0f9[_0x2e37('0x21')],function(_0x5778ca){return{'model':db[_0x5778ca['model']],'as':_0x5778ca['as'],'attributes':_0x5778ca[_0x2e37('0x23')],'include':_0x5778ca[_0x2e37('0x21')]?_[_0x2e37('0x22')](_0x5778ca[_0x2e37('0x21')],function(_0x47a43a){return{'model':db[_0x47a43a[_0x2e37('0x24')]],'as':_0x47a43a['as'],'attributes':_0x47a43a[_0x2e37('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2e37('0x11')](function(_0x48832){logger[_0x2e37('0x12')](_0x2e37('0x1b'),_0x114fe);logger[_0x2e37('0x15')](_0x2e37('0x1b'),_0x114fe,JSON['stringify'](_0x48832));_0x588b0d(_0x48832);})['catch'](function(_0x423733){logger[_0x2e37('0x17')](_0x2e37('0x1b'),_0x423733[_0x2e37('0x19')],_0x114fe);_0x16226e(_0x5cb950[_0x2e37('0x17')](0x1f4,_0x423733[_0x2e37('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 866abf1..9ba4e47 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'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 cc57cfa..13a8afa 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2942c2,_0x2539ef){var _0xf8438e=function(_0x266192){while(--_0x266192){_0x2942c2['push'](_0x2942c2['shift']());}};_0xf8438e(++_0x2539ef);}(_0x34e8,0x12c));var _0x834e=function(_0x4786ef,_0x2813d2){_0x4786ef=_0x4786ef-0x0;var _0x255a3a=_0x34e8[_0x4786ef];return _0x255a3a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _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(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 3630f5e..bbe20cd 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 _0xc87b=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0x540c14,_0x101124){var _0x3428e8=function(_0x636cc1){while(--_0x636cc1){_0x540c14['push'](_0x540c14['shift']());}};_0x3428e8(++_0x101124);}(_0xc87b,0xb2));var _0xbc87=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xc87b[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xbc87('0x0'));module[_0xbc87('0x1')]={'priority':{'type':Sequelize[_0xbc87('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xbc87('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xbc87('0x4')]()},'description':{'type':Sequelize[_0xbc87('0x3')]},'interval':{'type':Sequelize[_0xbc87('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xcdde=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x2a16ef,_0x535d6e){var _0x153854=function(_0x456a96){while(--_0x456a96){_0x2a16ef['push'](_0x2a16ef['shift']());}};_0x153854(++_0x535d6e);}(_0xcdde,0x12b));var _0xecdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcdde[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xecdd('0x0'));module[_0xecdd('0x1')]={'priority':{'type':Sequelize[_0xecdd('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xecdd('0x3')],'allowNull':![],'defaultValue':_0xecdd('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xecdd('0x3')]},'interval':{'type':Sequelize[_0xecdd('0x3')],'defaultValue':_0xecdd('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 51b3a96..4b8c6da 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 _0xf95a=['eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','SmsApplication','findAll','rows','catch','rawAttributes','create','body','find','params'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xf95a,0x1bc));var _0xaf95=function(_0x3eaa85,_0x42de60){_0x3eaa85=_0x3eaa85-0x0;var _0x4a7257=_0xf95a[_0x3eaa85];return _0x4a7257;};'use strict';var emlformat=require(_0xaf95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf95('0x1'));var jsonpatch=require(_0xaf95('0x2'));var rp=require(_0xaf95('0x3'));var moment=require(_0xaf95('0x4'));var BPromise=require(_0xaf95('0x5'));var Mustache=require(_0xaf95('0x6'));var util=require('util');var path=require(_0xaf95('0x7'));var sox=require(_0xaf95('0x8'));var csv=require(_0xaf95('0x9'));var ejs=require(_0xaf95('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaf95('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaf95('0x9'));var querystring=require(_0xaf95('0xc'));var Papa=require(_0xaf95('0xd'));var Redis=require(_0xaf95('0xe'));var authService=require(_0xaf95('0xf'));var qs=require(_0xaf95('0x10'));var as=require(_0xaf95('0x11'));var hardwareService=require(_0xaf95('0x12'));var logger=require(_0xaf95('0x13'))(_0xaf95('0x14'));var utils=require('../../config/utils');var config=require(_0xaf95('0x15'));var licenseUtil=require(_0xaf95('0x16'));var db=require(_0xaf95('0x17'))['db'];function respondWithStatusCode(_0x5dd909,_0x3d083c){_0x3d083c=_0x3d083c||0xcc;return function(_0x40b369){if(_0x40b369){return _0x5dd909[_0xaf95('0x18')](_0x3d083c);}return _0x5dd909[_0xaf95('0x19')](_0x3d083c)[_0xaf95('0x1a')]();};}function respondWithResult(_0x3cc842,_0x513492){_0x513492=_0x513492||0xc8;return function(_0x4d8065){if(_0x4d8065){return _0x3cc842['status'](_0x513492)[_0xaf95('0x1b')](_0x4d8065);}};}function respondWithFilteredResult(_0x403670,_0xba8ecb){return function(_0x406dd4){if(_0x406dd4){var _0x2d7864=typeof _0xba8ecb[_0xaf95('0x1c')]===_0xaf95('0x1d')&&typeof _0xba8ecb[_0xaf95('0x1e')]==='undefined';var _0x6ca5a6=_0x406dd4['count'];var _0x4d1789=_0x2d7864?0x0:_0xba8ecb['offset'];var _0x32a3af=_0x2d7864?_0x406dd4['count']:_0xba8ecb[_0xaf95('0x1c')]+_0xba8ecb[_0xaf95('0x1e')];var _0x2c4db6;if(_0x32a3af>=_0x6ca5a6){_0x32a3af=_0x6ca5a6;_0x2c4db6=0xc8;}else{_0x2c4db6=0xce;}_0x403670[_0xaf95('0x19')](_0x2c4db6);return _0x403670[_0xaf95('0x1f')]('Content-Range',_0x4d1789+'-'+_0x32a3af+'/'+_0x6ca5a6)[_0xaf95('0x1b')](_0x406dd4);}return null;};}function patchUpdates(_0x5325d2){return function(_0x1db66e){try{jsonpatch[_0xaf95('0x20')](_0x1db66e,_0x5325d2,!![]);}catch(_0x7509cd){return BPromise['reject'](_0x7509cd);}return _0x1db66e[_0xaf95('0x21')]();};}function saveUpdates(_0x53327c,_0x1b38cb){return function(_0x153a23){if(_0x153a23){return _0x153a23[_0xaf95('0x22')](_0x53327c)[_0xaf95('0x23')](function(_0x2392a7){return _0x2392a7;});}return null;};}function removeEntity(_0x5180ad,_0x37b054){return function(_0x923024){if(_0x923024){return _0x923024[_0xaf95('0x24')]()['then'](function(){_0x5180ad[_0xaf95('0x19')](0xcc)[_0xaf95('0x1a')]();});}};}function handleEntityNotFound(_0x38c46b,_0xeb46f6){return function(_0x4d14ae){if(!_0x4d14ae){_0x38c46b['sendStatus'](0x194);}return _0x4d14ae;};}function handleError(_0x44f3dc,_0x1b8bad){_0x1b8bad=_0x1b8bad||0x1f4;return function(_0x5ab72c){logger[_0xaf95('0x25')](_0x5ab72c[_0xaf95('0x26')]);if(_0x5ab72c[_0xaf95('0x27')]){delete _0x5ab72c[_0xaf95('0x27')];}_0x44f3dc[_0xaf95('0x19')](_0x1b8bad)[_0xaf95('0x28')](_0x5ab72c);};}exports[_0xaf95('0x29')]=function(_0x10f2f9,_0x15f1d0){var _0x3da469={},_0x3d57f6={},_0x5f4efb={'count':0x0,'rows':[]};var _0x32db65=_[_0xaf95('0x2a')](db['SmsApplication']['rawAttributes'],function(_0x11fba6){return{'name':_0x11fba6[_0xaf95('0x2b')],'type':_0x11fba6['type']['key']};});_0x3d57f6[_0xaf95('0x2c')]=_[_0xaf95('0x2a')](_0x32db65,_0xaf95('0x27'));_0x3d57f6[_0xaf95('0x2d')]=_[_0xaf95('0x2e')](_0x10f2f9['query']);_0x3d57f6[_0xaf95('0x2f')]=_[_0xaf95('0x30')](_0x3d57f6['model'],_0x3d57f6[_0xaf95('0x2d')]);_0x3da469[_0xaf95('0x31')]=_[_0xaf95('0x30')](_0x3d57f6[_0xaf95('0x2c')],qs[_0xaf95('0x32')](_0x10f2f9[_0xaf95('0x2d')][_0xaf95('0x32')]));_0x3da469[_0xaf95('0x31')]=_0x3da469[_0xaf95('0x31')][_0xaf95('0x33')]?_0x3da469[_0xaf95('0x31')]:_0x3d57f6[_0xaf95('0x2c')];if(!_0x10f2f9[_0xaf95('0x2d')][_0xaf95('0x34')](_0xaf95('0x35'))){_0x3da469[_0xaf95('0x1e')]=qs[_0xaf95('0x1e')](_0x10f2f9[_0xaf95('0x2d')][_0xaf95('0x1e')]);_0x3da469['offset']=qs[_0xaf95('0x1c')](_0x10f2f9[_0xaf95('0x2d')][_0xaf95('0x1c')]);}_0x3da469[_0xaf95('0x36')]=qs[_0xaf95('0x37')](_0x10f2f9[_0xaf95('0x2d')]['sort']);_0x3da469[_0xaf95('0x38')]=qs['filters'](_[_0xaf95('0x39')](_0x10f2f9['query'],_0x3d57f6['filters']),_0x32db65);if(_0x10f2f9[_0xaf95('0x2d')][_0xaf95('0x3a')]){_0x3da469[_0xaf95('0x38')]=_[_0xaf95('0x3b')](_0x3da469[_0xaf95('0x38')],{'$or':_[_0xaf95('0x2a')](_0x32db65,function(_0x4c3fb2){if(_0x4c3fb2[_0xaf95('0x3c')]!=='VIRTUAL'){var _0x54f358={};_0x54f358[_0x4c3fb2[_0xaf95('0x27')]]={'$like':'%'+_0x10f2f9[_0xaf95('0x2d')]['filter']+'%'};return _0x54f358;}})});}_0x3da469=_['merge']({},_0x3da469,_0x10f2f9[_0xaf95('0x3d')]);var _0x3f7639={'where':_0x3da469['where']};return db['SmsApplication'][_0xaf95('0x3e')](_0x3f7639)[_0xaf95('0x23')](function(_0x549639){_0x5f4efb[_0xaf95('0x3e')]=_0x549639;if(_0x10f2f9['query'][_0xaf95('0x3f')]){_0x3da469[_0xaf95('0x40')]=[{'all':!![]}];}return db[_0xaf95('0x41')][_0xaf95('0x42')](_0x3da469);})[_0xaf95('0x23')](function(_0x5b3111){_0x5f4efb[_0xaf95('0x43')]=_0x5b3111;return _0x5f4efb;})[_0xaf95('0x23')](respondWithFilteredResult(_0x15f1d0,_0x3da469))[_0xaf95('0x44')](handleError(_0x15f1d0,null));};exports['show']=function(_0x34943e,_0x15814f){var _0x10061d={'raw':!![],'where':{'id':_0x34943e['params']['id']}},_0x5b4366={};_0x5b4366[_0xaf95('0x2c')]=_[_0xaf95('0x2e')](db[_0xaf95('0x41')][_0xaf95('0x45')]);_0x5b4366['query']=_[_0xaf95('0x2e')](_0x34943e[_0xaf95('0x2d')]);_0x5b4366['filters']=_['intersection'](_0x5b4366['model'],_0x5b4366[_0xaf95('0x2d')]);_0x10061d[_0xaf95('0x31')]=_[_0xaf95('0x30')](_0x5b4366[_0xaf95('0x2c')],qs[_0xaf95('0x32')](_0x34943e[_0xaf95('0x2d')][_0xaf95('0x32')]));_0x10061d[_0xaf95('0x31')]=_0x10061d[_0xaf95('0x31')][_0xaf95('0x33')]?_0x10061d['attributes']:_0x5b4366[_0xaf95('0x2c')];if(_0x34943e[_0xaf95('0x2d')][_0xaf95('0x3f')]){_0x10061d['include']=[{'all':!![]}];}_0x10061d=_[_0xaf95('0x3b')]({},_0x10061d,_0x34943e['options']);return db['SmsApplication']['find'](_0x10061d)[_0xaf95('0x23')](handleEntityNotFound(_0x15814f,null))['then'](respondWithResult(_0x15814f,null))['catch'](handleError(_0x15814f,null));};exports[_0xaf95('0x46')]=function(_0x1ac91a,_0xd50073){return db['SmsApplication'][_0xaf95('0x46')](_0x1ac91a[_0xaf95('0x47')],{})[_0xaf95('0x23')](respondWithResult(_0xd50073,0xc9))['catch'](handleError(_0xd50073,null));};exports[_0xaf95('0x22')]=function(_0xc38d06,_0x1c4115){if(_0xc38d06[_0xaf95('0x47')]['id']){delete _0xc38d06[_0xaf95('0x47')]['id'];}return db['SmsApplication'][_0xaf95('0x48')]({'where':{'id':_0xc38d06[_0xaf95('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c4115,null))['then'](saveUpdates(_0xc38d06[_0xaf95('0x47')],null))[_0xaf95('0x23')](respondWithResult(_0x1c4115,null))[_0xaf95('0x44')](handleError(_0x1c4115,null));};exports[_0xaf95('0x24')]=function(_0x486686,_0x42d717){return db[_0xaf95('0x41')][_0xaf95('0x48')]({'where':{'id':_0x486686['params']['id']}})[_0xaf95('0x23')](handleEntityNotFound(_0x42d717,null))['then'](removeEntity(_0x42d717,null))[_0xaf95('0x44')](handleError(_0x42d717,null));}; \ No newline at end of file +var _0x7e0f=['includeAll','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','SmsApplication','include','findAll','rows','show','params','fields'];(function(_0x583e98,_0x5534f5){var _0x84cc30=function(_0x4201ed){while(--_0x4201ed){_0x583e98['push'](_0x583e98['shift']());}};_0x84cc30(++_0x5534f5);}(_0x7e0f,0x182));var _0xf7e0=function(_0x561e33,_0x3d28e6){_0x561e33=_0x561e33-0x0;var _0x15c9af=_0x7e0f[_0x561e33];return _0x15c9af;};'use strict';var emlformat=require(_0xf7e0('0x0'));var rimraf=require(_0xf7e0('0x1'));var zipdir=require(_0xf7e0('0x2'));var jsonpatch=require(_0xf7e0('0x3'));var rp=require(_0xf7e0('0x4'));var moment=require(_0xf7e0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf7e0('0x6'));var path=require(_0xf7e0('0x7'));var sox=require(_0xf7e0('0x8'));var csv=require('to-csv');var ejs=require(_0xf7e0('0x9'));var fs=require('fs');var fs_extra=require(_0xf7e0('0xa'));var _=require(_0xf7e0('0xb'));var squel=require('squel');var crypto=require(_0xf7e0('0xc'));var jsforce=require(_0xf7e0('0xd'));var deskjs=require(_0xf7e0('0xe'));var toCsv=require(_0xf7e0('0xf'));var querystring=require(_0xf7e0('0x10'));var Papa=require(_0xf7e0('0x11'));var Redis=require(_0xf7e0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf7e0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7e0('0x14'));var logger=require(_0xf7e0('0x15'))(_0xf7e0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa1237b,_0xadb4f3){_0xadb4f3=_0xadb4f3||0xcc;return function(_0x5e7a40){if(_0x5e7a40){return _0xa1237b[_0xf7e0('0x17')](_0xadb4f3);}return _0xa1237b['status'](_0xadb4f3)[_0xf7e0('0x18')]();};}function respondWithResult(_0x2f016c,_0x3f8517){_0x3f8517=_0x3f8517||0xc8;return function(_0x223d5c){if(_0x223d5c){return _0x2f016c[_0xf7e0('0x19')](_0x3f8517)[_0xf7e0('0x1a')](_0x223d5c);}};}function respondWithFilteredResult(_0x59bdb8,_0x1e90bc){return function(_0x55b4ab){if(_0x55b4ab){var _0xc4aacc=typeof _0x1e90bc['offset']===_0xf7e0('0x1b')&&typeof _0x1e90bc[_0xf7e0('0x1c')]===_0xf7e0('0x1b');var _0x12858c=_0x55b4ab[_0xf7e0('0x1d')];var _0x247f3f=_0xc4aacc?0x0:_0x1e90bc[_0xf7e0('0x1e')];var _0x349924=_0xc4aacc?_0x55b4ab['count']:_0x1e90bc['offset']+_0x1e90bc[_0xf7e0('0x1c')];var _0x43b21d;if(_0x349924>=_0x12858c){_0x349924=_0x12858c;_0x43b21d=0xc8;}else{_0x43b21d=0xce;}_0x59bdb8[_0xf7e0('0x19')](_0x43b21d);return _0x59bdb8[_0xf7e0('0x1f')](_0xf7e0('0x20'),_0x247f3f+'-'+_0x349924+'/'+_0x12858c)['json'](_0x55b4ab);}return null;};}function patchUpdates(_0x1de354){return function(_0x2699f4){try{jsonpatch[_0xf7e0('0x21')](_0x2699f4,_0x1de354,!![]);}catch(_0x48a912){return BPromise[_0xf7e0('0x22')](_0x48a912);}return _0x2699f4[_0xf7e0('0x23')]();};}function saveUpdates(_0x465ae3,_0x527ded){return function(_0x5bd2f5){if(_0x5bd2f5){return _0x5bd2f5[_0xf7e0('0x24')](_0x465ae3)['then'](function(_0x198dfa){return _0x198dfa;});}return null;};}function removeEntity(_0x533ab2,_0x2da709){return function(_0x2a2eae){if(_0x2a2eae){return _0x2a2eae['destroy']()[_0xf7e0('0x25')](function(){_0x533ab2[_0xf7e0('0x19')](0xcc)[_0xf7e0('0x18')]();});}};}function handleEntityNotFound(_0x26c71b,_0x49d18a){return function(_0x5313a7){if(!_0x5313a7){_0x26c71b[_0xf7e0('0x17')](0x194);}return _0x5313a7;};}function handleError(_0xdd04a3,_0x312b3){_0x312b3=_0x312b3||0x1f4;return function(_0x5bde8e){logger['error'](_0x5bde8e[_0xf7e0('0x26')]);if(_0x5bde8e[_0xf7e0('0x27')]){delete _0x5bde8e['name'];}_0xdd04a3[_0xf7e0('0x19')](_0x312b3)[_0xf7e0('0x28')](_0x5bde8e);};}exports[_0xf7e0('0x29')]=function(_0x1bec6a,_0x36ccb9){var _0x44613c={},_0x37a41a={},_0x4289e6={'count':0x0,'rows':[]};var _0x5203dd=_[_0xf7e0('0x2a')](db['SmsApplication'][_0xf7e0('0x2b')],function(_0x52efcb){return{'name':_0x52efcb[_0xf7e0('0x2c')],'type':_0x52efcb['type'][_0xf7e0('0x2d')]};});_0x37a41a[_0xf7e0('0x2e')]=_[_0xf7e0('0x2a')](_0x5203dd,_0xf7e0('0x27'));_0x37a41a['query']=_[_0xf7e0('0x2f')](_0x1bec6a[_0xf7e0('0x30')]);_0x37a41a[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x37a41a['model'],_0x37a41a[_0xf7e0('0x30')]);_0x44613c[_0xf7e0('0x33')]=_[_0xf7e0('0x32')](_0x37a41a['model'],qs['fields'](_0x1bec6a[_0xf7e0('0x30')]['fields']));_0x44613c[_0xf7e0('0x33')]=_0x44613c['attributes'][_0xf7e0('0x34')]?_0x44613c[_0xf7e0('0x33')]:_0x37a41a[_0xf7e0('0x2e')];if(!_0x1bec6a[_0xf7e0('0x30')][_0xf7e0('0x35')]('nolimit')){_0x44613c[_0xf7e0('0x1c')]=qs[_0xf7e0('0x1c')](_0x1bec6a[_0xf7e0('0x30')][_0xf7e0('0x1c')]);_0x44613c['offset']=qs[_0xf7e0('0x1e')](_0x1bec6a['query'][_0xf7e0('0x1e')]);}_0x44613c[_0xf7e0('0x36')]=qs[_0xf7e0('0x37')](_0x1bec6a[_0xf7e0('0x30')][_0xf7e0('0x37')]);_0x44613c['where']=qs[_0xf7e0('0x31')](_[_0xf7e0('0x38')](_0x1bec6a[_0xf7e0('0x30')],_0x37a41a[_0xf7e0('0x31')]),_0x5203dd);if(_0x1bec6a[_0xf7e0('0x30')][_0xf7e0('0x39')]){_0x44613c[_0xf7e0('0x3a')]=_[_0xf7e0('0x3b')](_0x44613c[_0xf7e0('0x3a')],{'$or':_[_0xf7e0('0x2a')](_0x5203dd,function(_0x41cae9){if(_0x41cae9[_0xf7e0('0x3c')]!==_0xf7e0('0x3d')){var _0x478a0f={};_0x478a0f[_0x41cae9[_0xf7e0('0x27')]]={'$like':'%'+_0x1bec6a[_0xf7e0('0x30')][_0xf7e0('0x39')]+'%'};return _0x478a0f;}})});}_0x44613c=_[_0xf7e0('0x3b')]({},_0x44613c,_0x1bec6a[_0xf7e0('0x3e')]);var _0x1f36b1={'where':_0x44613c[_0xf7e0('0x3a')]};return db[_0xf7e0('0x3f')][_0xf7e0('0x1d')](_0x1f36b1)['then'](function(_0x1dbf4d){_0x4289e6[_0xf7e0('0x1d')]=_0x1dbf4d;if(_0x1bec6a[_0xf7e0('0x30')]['includeAll']){_0x44613c[_0xf7e0('0x40')]=[{'all':!![]}];}return db[_0xf7e0('0x3f')][_0xf7e0('0x41')](_0x44613c);})[_0xf7e0('0x25')](function(_0x4308e5){_0x4289e6[_0xf7e0('0x42')]=_0x4308e5;return _0x4289e6;})[_0xf7e0('0x25')](respondWithFilteredResult(_0x36ccb9,_0x44613c))['catch'](handleError(_0x36ccb9,null));};exports[_0xf7e0('0x43')]=function(_0x573126,_0x325492){var _0x1a9ae5={'raw':!![],'where':{'id':_0x573126[_0xf7e0('0x44')]['id']}},_0x27b6f1={};_0x27b6f1[_0xf7e0('0x2e')]=_[_0xf7e0('0x2f')](db[_0xf7e0('0x3f')]['rawAttributes']);_0x27b6f1[_0xf7e0('0x30')]=_[_0xf7e0('0x2f')](_0x573126[_0xf7e0('0x30')]);_0x27b6f1[_0xf7e0('0x31')]=_[_0xf7e0('0x32')](_0x27b6f1[_0xf7e0('0x2e')],_0x27b6f1[_0xf7e0('0x30')]);_0x1a9ae5[_0xf7e0('0x33')]=_[_0xf7e0('0x32')](_0x27b6f1[_0xf7e0('0x2e')],qs[_0xf7e0('0x45')](_0x573126['query'][_0xf7e0('0x45')]));_0x1a9ae5['attributes']=_0x1a9ae5[_0xf7e0('0x33')][_0xf7e0('0x34')]?_0x1a9ae5[_0xf7e0('0x33')]:_0x27b6f1[_0xf7e0('0x2e')];if(_0x573126[_0xf7e0('0x30')][_0xf7e0('0x46')]){_0x1a9ae5[_0xf7e0('0x40')]=[{'all':!![]}];}_0x1a9ae5=_[_0xf7e0('0x3b')]({},_0x1a9ae5,_0x573126[_0xf7e0('0x3e')]);return db[_0xf7e0('0x3f')][_0xf7e0('0x47')](_0x1a9ae5)['then'](handleEntityNotFound(_0x325492,null))[_0xf7e0('0x25')](respondWithResult(_0x325492,null))[_0xf7e0('0x48')](handleError(_0x325492,null));};exports[_0xf7e0('0x49')]=function(_0x59261c,_0x1aa5ac){return db['SmsApplication']['create'](_0x59261c[_0xf7e0('0x4a')],{})[_0xf7e0('0x25')](respondWithResult(_0x1aa5ac,0xc9))[_0xf7e0('0x48')](handleError(_0x1aa5ac,null));};exports[_0xf7e0('0x24')]=function(_0x139148,_0x2a966f){if(_0x139148[_0xf7e0('0x4a')]['id']){delete _0x139148['body']['id'];}return db[_0xf7e0('0x3f')][_0xf7e0('0x47')]({'where':{'id':_0x139148[_0xf7e0('0x44')]['id']}})[_0xf7e0('0x25')](handleEntityNotFound(_0x2a966f,null))['then'](saveUpdates(_0x139148[_0xf7e0('0x4a')],null))[_0xf7e0('0x25')](respondWithResult(_0x2a966f,null))[_0xf7e0('0x48')](handleError(_0x2a966f,null));};exports[_0xf7e0('0x4b')]=function(_0x4835e1,_0x49a557){return db[_0xf7e0('0x3f')]['find']({'where':{'id':_0x4835e1[_0xf7e0('0x44')]['id']}})['then'](handleEntityNotFound(_0x49a557,null))[_0xf7e0('0x25')](removeEntity(_0x49a557,null))['catch'](handleError(_0x49a557,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1527ea1..9a05f8f 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 _0x75e2=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4_unicode_ci'];(function(_0x43fae7,_0x5aae76){var _0xedfd71=function(_0x5ee1ed){while(--_0x5ee1ed){_0x43fae7['push'](_0x43fae7['shift']());}};_0xedfd71(++_0x5aae76);}(_0x75e2,0x16c));var _0x275e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x75e2[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x275e('0x0'));var util=require('util');var logger=require(_0x275e('0x1'))(_0x275e('0x2'));var moment=require(_0x275e('0x3'));var BPromise=require(_0x275e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x275e('0x5'));var rimraf=require(_0x275e('0x6'));var config=require(_0x275e('0x7'));var attributes=require(_0x275e('0x8'));module[_0x275e('0x9')]=function(_0x154062,_0x4e4625){return _0x154062['define'](_0x275e('0xa'),attributes,{'tableName':_0x275e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x275e('0xc')});}; \ No newline at end of file +var _0x37c0=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','util','../../config/logger','api','moment'];(function(_0x5aa15a,_0xcc6f18){var _0x59d2ed=function(_0x24e27a){while(--_0x24e27a){_0x5aa15a['push'](_0x5aa15a['shift']());}};_0x59d2ed(++_0xcc6f18);}(_0x37c0,0x71));var _0x037c=function(_0x3a4f88,_0x39847b){_0x3a4f88=_0x3a4f88-0x0;var _0x18d391=_0x37c0[_0x3a4f88];return _0x18d391;};'use strict';var _=require('lodash');var util=require(_0x037c('0x0'));var logger=require(_0x037c('0x1'))(_0x037c('0x2'));var moment=require(_0x037c('0x3'));var BPromise=require(_0x037c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x037c('0x5'));var rimraf=require(_0x037c('0x6'));var config=require(_0x037c('0x7'));var attributes=require(_0x037c('0x8'));module['exports']=function(_0x53e886,_0x3439d9){return _0x53e886[_0x037c('0x9')](_0x037c('0xa'),attributes,{'tableName':_0x037c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x037c('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6ac1e37..eeaa375 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 _0x8a9a=['rpc','../../config/environment','jayson/promise','client','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x32c060,_0x562863){var _0xeb6c20=function(_0x4b3e5e){while(--_0x4b3e5e){_0x32c060['push'](_0x32c060['shift']());}};_0xeb6c20(++_0x562863);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8a9a[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0xa8a9('0x0'));var moment=require(_0xa8a9('0x1'));var BPromise=require(_0xa8a9('0x2'));var rs=require(_0xa8a9('0x3'));var fs=require('fs');var Redis=require(_0xa8a9('0x4'));var db=require(_0xa8a9('0x5'))['db'];var utils=require(_0xa8a9('0x6'));var logger=require(_0xa8a9('0x7'))(_0xa8a9('0x8'));var config=require(_0xa8a9('0x9'));var jayson=require(_0xa8a9('0xa'));var client=jayson[_0xa8a9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a2bc,_0x4a091d,_0x1b4873){return new BPromise(function(_0x129e9f,_0x1477b0){return client[_0xa8a9('0xc')](_0x24a2bc,_0x1b4873)[_0xa8a9('0xd')](function(_0x4ebe24){logger[_0xa8a9('0xe')](_0xa8a9('0xf'),_0x4a091d,'request\x20sent');logger[_0xa8a9('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'),JSON[_0xa8a9('0x12')](_0x4ebe24));if(_0x4ebe24['error']){if(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x14')]===0x1f4){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);return _0x1477b0(_0x4ebe24['error'][_0xa8a9('0x15')]);}logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x4ebe24['error']['message']);return _0x129e9f(_0x4ebe24[_0xa8a9('0x13')][_0xa8a9('0x15')]);}else{logger[_0xa8a9('0xe')]('SmsApplication,\x20%s,\x20%s',_0x4a091d,_0xa8a9('0x11'));_0x129e9f(_0x4ebe24[_0xa8a9('0x16')]['message']);}})['catch'](function(_0x1039c9){logger[_0xa8a9('0x13')](_0xa8a9('0xf'),_0x4a091d,_0x1039c9);_0x1477b0(_0x1039c9);});});} \ No newline at end of file +var _0x761c=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x761c,0x18a));var _0xc761=function(_0x522c17,_0x4a4323){_0x522c17=_0x522c17-0x0;var _0x39b53d=_0x761c[_0x522c17];return _0x39b53d;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var moment=require(_0xc761('0x1'));var BPromise=require(_0xc761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc761('0x3'));var db=require(_0xc761('0x4'))['db'];var utils=require(_0xc761('0x5'));var logger=require('../../config/logger')(_0xc761('0x6'));var config=require('../../config/environment');var jayson=require(_0xc761('0x7'));var client=jayson[_0xc761('0x8')][_0xc761('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xafa0bd,_0x2f4f2e,_0x444747){return new BPromise(function(_0x46e882,_0x507772){return client[_0xc761('0xa')](_0xafa0bd,_0x444747)[_0xc761('0xb')](function(_0x175c1c){logger[_0xc761('0xc')](_0xc761('0xd'),_0x2f4f2e,_0xc761('0xe'));logger[_0xc761('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x2f4f2e,'request\x20sent',JSON[_0xc761('0x10')](_0x175c1c));if(_0x175c1c[_0xc761('0x11')]){if(_0x175c1c['error']['code']===0x1f4){logger[_0xc761('0x11')]('SmsApplication,\x20%s,\x20%s',_0x2f4f2e,_0x175c1c[_0xc761('0x11')]['message']);return _0x507772(_0x175c1c[_0xc761('0x11')]['message']);}logger[_0xc761('0x11')](_0xc761('0xd'),_0x2f4f2e,_0x175c1c[_0xc761('0x11')][_0xc761('0x12')]);return _0x46e882(_0x175c1c[_0xc761('0x11')][_0xc761('0x12')]);}else{logger[_0xc761('0xc')]('SmsApplication,\x20%s,\x20%s',_0x2f4f2e,'request\x20sent');_0x46e882(_0x175c1c[_0xc761('0x13')][_0xc761('0x12')]);}})[_0xc761('0x14')](function(_0x597085){logger[_0xc761('0x11')](_0xc761('0xd'),_0x2f4f2e,_0x597085);_0x507772(_0x597085);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 738aea8..b652720 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 _0x955f=['fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x3bec46,_0x3a7b01){var _0x263e6e=function(_0x53dd2f){while(--_0x53dd2f){_0x3bec46['push'](_0x3bec46['shift']());}};_0x263e6e(++_0x3a7b01);}(_0x955f,0x1eb));var _0xf955=function(_0x3c1572,_0x5e885d){_0x3c1572=_0x3c1572-0x0;var _0x10f8d6=_0x955f[_0x3c1572];return _0x10f8d6;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./smsInteraction.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getMessages']);router[_0xf955('0x7')]('/:id/download',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/',auth['isAuthenticated'](),controller[_0xf955('0x10')]);router['post'](_0xf955('0xd'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);router[_0xf955('0xf')](_0xf955('0x12'),auth[_0xf955('0x8')](),interaction[_0xf955('0x13')](_0xf955('0x14'),_0xf955('0x15')),controller[_0xf955('0x16')]);router[_0xf955('0x17')](_0xf955('0xb'),auth['isAuthenticated'](),interaction[_0xf955('0x13')]('sms',_0xf955('0x18')),controller[_0xf955('0x19')]);router[_0xf955('0x1a')](_0xf955('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf955('0x14'),_0xf955('0x1b')),controller[_0xf955('0x1c')]);router['delete'](_0xf955('0x12'),auth[_0xf955('0x8')](),controller[_0xf955('0x1d')]);module[_0xf955('0x1e')]=router; \ No newline at end of file +var _0x0972=['tracked','sms','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags'];(function(_0x4a6b69,_0xc87944){var _0x467a42=function(_0x218620){while(--_0x218620){_0x4a6b69['push'](_0x4a6b69['shift']());}};_0x467a42(++_0xc87944);}(_0x0972,0x64));var _0x2097=function(_0x4bd178,_0x5d7712){_0x4bd178=_0x4bd178-0x0;var _0x4c40fc=_0x0972[_0x4bd178];return _0x4c40fc;};'use strict';var multer=require('multer');var util=require(_0x2097('0x0'));var path=require('path');var timeout=require(_0x2097('0x1'));var express=require('express');var router=express[_0x2097('0x2')]();var fs_extra=require(_0x2097('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2097('0x4'));var config=require(_0x2097('0x5'));var controller=require(_0x2097('0x6'));router[_0x2097('0x7')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x9')]);router[_0x2097('0x7')]('/describe',auth[_0x2097('0x8')](),controller[_0x2097('0xa')]);router[_0x2097('0x7')](_0x2097('0xb'),auth[_0x2097('0x8')](),controller['show']);router[_0x2097('0x7')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0xd')]);router[_0x2097('0x7')](_0x2097('0xe'),auth[_0x2097('0x8')](),controller[_0x2097('0xf')]);router[_0x2097('0x10')]('/',auth[_0x2097('0x8')](),controller[_0x2097('0x11')]);router[_0x2097('0x10')](_0x2097('0xc'),auth[_0x2097('0x8')](),controller[_0x2097('0x12')]);router[_0x2097('0x10')](_0x2097('0x13'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')](_0x2097('0x15'),'smsinteraction:addtags'),controller[_0x2097('0x16')]);router[_0x2097('0x17')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x2097('0x15'),'smsinteraction:update'),controller[_0x2097('0x18')]);router[_0x2097('0x19')](_0x2097('0xb'),auth[_0x2097('0x8')](),interaction[_0x2097('0x14')]('sms',_0x2097('0x1a')),controller[_0x2097('0x1b')]);router[_0x2097('0x19')](_0x2097('0x13'),auth[_0x2097('0x8')](),controller[_0x2097('0x1c')]);module[_0x2097('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 0bbb7b8..a0a9319 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 _0x24ca=['ENUM','out','sequelize','BOOLEAN','STRING','DATE'];(function(_0xc1de58,_0x22c21e){var _0x1cab1c=function(_0x147a1b){while(--_0x147a1b){_0xc1de58['push'](_0xc1de58['shift']());}};_0x1cab1c(++_0x22c21e);}(_0x24ca,0x8c));var _0xa24c=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x24ca[_0x5cb97e];return _0x1714b4;};'use strict';var Sequelize=require(_0xa24c('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xa24c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa24c('0x2')]},'secondDisposition':{'type':Sequelize[_0xa24c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa24c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa24c('0x2')]},'read1stAt':{'type':Sequelize[_0xa24c('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa24c('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa24c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa24c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x7c1f=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0x7c1f,0x194));var _0xf7c1=function(_0x44951b,_0x584962){_0x44951b=_0x44951b-0x0;var _0x5d3f80=_0x7c1f[_0x44951b];return _0x5d3f80;};'use strict';var Sequelize=require(_0xf7c1('0x0'));var moment=require(_0xf7c1('0x1'));module[_0xf7c1('0x2')]={'closed':{'type':Sequelize[_0xf7c1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf7c1('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf7c1('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf7c1('0x5')]},'note':{'type':Sequelize[_0xf7c1('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xf7c1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xf7c1('0x6')]('in',_0xf7c1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf7c1('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf7c1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf7c1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 52ea43a..033f582 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 _0x06bc=['sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','register','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','answered','unmanaged','total','closed','UserId','waiting','talking','index','SmsInteraction','rawAttributes','fieldName','type','keys','filters','intersection','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','select','field','color','tools_tags','u.id','u.fullname','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','start','some','compact','isEmpty','SmsAccountId','where','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','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','a.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','c.firstName','Contact.firstName','c.email','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','merge','options','create','describe','SmsMessage','addMessage','omit','ids','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','root','server','files','transcript-%d-%s.zip','CmContact','firstName','lastName','direction','secret','Owner','get','mkdirSync','Sms','Account','N.A.','closedAt','disposition','Messages','out','System','renderFile','downloadInteraction.ejs','log','err','unlinkSync','eml-format','rimraf','zip-dir','bluebird','mustache','util','path'];(function(_0x2e4b95,_0x3903f1){var _0x1dcb97=function(_0x32efc7){while(--_0x32efc7){_0x2e4b95['push'](_0x2e4b95['shift']());}};_0x1dcb97(++_0x3903f1);}(_0x06bc,0x1c5));var _0xc06b=function(_0x350511,_0x42c550){_0x350511=_0x350511-0x0;var _0x26a4b9=_0x06bc[_0x350511];return _0x26a4b9;};'use strict';var emlformat=require(_0xc06b('0x0'));var rimraf=require(_0xc06b('0x1'));var zipdir=require(_0xc06b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc06b('0x3'));var Mustache=require(_0xc06b('0x4'));var util=require(_0xc06b('0x5'));var path=require(_0xc06b('0x6'));var sox=require(_0xc06b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc06b('0x8'));var _=require(_0xc06b('0x9'));var squel=require(_0xc06b('0xa'));var crypto=require(_0xc06b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc06b('0xc'));var toCsv=require(_0xc06b('0xd'));var querystring=require('querystring');var Papa=require(_0xc06b('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc06b('0xf'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xc06b('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc06b('0x11'))('api');var utils=require(_0xc06b('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc06b('0x13'))['db'];config[_0xc06b('0x14')]=_[_0xc06b('0x15')](config[_0xc06b('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc06b('0x14')]));require('./smsInteraction.socket')[_0xc06b('0x16')](socket);function respondWithStatusCode(_0x4e0f67,_0x1e062e){_0x1e062e=_0x1e062e||0xcc;return function(_0xf5a076){if(_0xf5a076){return _0x4e0f67[_0xc06b('0x17')](_0x1e062e);}return _0x4e0f67[_0xc06b('0x18')](_0x1e062e)[_0xc06b('0x19')]();};}function respondWithResult(_0x42ae21,_0x520258){_0x520258=_0x520258||0xc8;return function(_0x14a9b3){if(_0x14a9b3){return _0x42ae21[_0xc06b('0x18')](_0x520258)['json'](_0x14a9b3);}};}function respondWithFilteredResult(_0x124304,_0x36506b){return function(_0x29ee82){if(_0x29ee82){var _0x4546aa=typeof _0x36506b[_0xc06b('0x1a')]==='undefined'&&typeof _0x36506b[_0xc06b('0x1b')]==='undefined';var _0x8c6eb1=_0x29ee82[_0xc06b('0x1c')];var _0x369263=_0x4546aa?0x0:_0x36506b[_0xc06b('0x1a')];var _0x379fbd=_0x4546aa?_0x29ee82['count']:_0x36506b[_0xc06b('0x1a')]+_0x36506b[_0xc06b('0x1b')];var _0xdfa69c;if(_0x379fbd>=_0x8c6eb1){_0x379fbd=_0x8c6eb1;_0xdfa69c=0xc8;}else{_0xdfa69c=0xce;}_0x124304['status'](_0xdfa69c);return _0x124304[_0xc06b('0x1d')](_0xc06b('0x1e'),_0x369263+'-'+_0x379fbd+'/'+_0x8c6eb1)[_0xc06b('0x1f')](_0x29ee82);}return null;};}function patchUpdates(_0x55fa90){return function(_0x3868d5){try{jsonpatch['apply'](_0x3868d5,_0x55fa90,!![]);}catch(_0x1ec86e){return BPromise[_0xc06b('0x20')](_0x1ec86e);}return _0x3868d5[_0xc06b('0x21')]();};}function saveUpdates(_0x212642,_0x33bfe9){return function(_0x2f5a72){if(_0x2f5a72){return _0x2f5a72['update'](_0x212642)[_0xc06b('0x22')](function(_0x1eeed5){return _0x1eeed5;});}return null;};}function removeEntity(_0x576cf1,_0x15809e){return function(_0x27d257){if(_0x27d257){return _0x27d257[_0xc06b('0x23')]()[_0xc06b('0x22')](function(){_0x576cf1[_0xc06b('0x18')](0xcc)[_0xc06b('0x19')]();});}};}function handleEntityNotFound(_0x29bfa1,_0x147b89){return function(_0x45c6b2){if(!_0x45c6b2){_0x29bfa1[_0xc06b('0x17')](0x194);}return _0x45c6b2;};}function handleError(_0xc82e34,_0x354028){_0x354028=_0x354028||0x1f4;return function(_0x7653a4){logger[_0xc06b('0x24')](_0x7653a4[_0xc06b('0x25')]);if(_0x7653a4[_0xc06b('0x26')]){delete _0x7653a4[_0xc06b('0x26')];}_0xc82e34['status'](_0x354028)[_0xc06b('0x27')](_0x7653a4);};}function getInteractionUsers(_0xfb4355,_0x4ef925){return new BPromise(function(_0x2955ba,_0x3f5324){try{if(_0x4ef925[_0xfb4355['id']]){_0xfb4355[_0xc06b('0x28')]=_[_0xc06b('0x29')](_0x4ef925[_0xfb4355['id']],function(_0x50bfed){return{'id':_0x50bfed['id'],'fullname':_0x50bfed[_0xc06b('0x2a')]};});}}catch(_0x15c731){_0x3f5324(_0x15c731);}_0x2955ba(_0xfb4355);});}function getInteractionTags(_0x4c7ec6,_0x507826){return new BPromise(function(_0x3bba88,_0x4bd938){try{if(_0x4c7ec6[_0xc06b('0x2b')]){_0x4c7ec6[_0xc06b('0x2c')]=[];_0x4c7ec6[_0xc06b('0x2b')][_0xc06b('0x2d')](',')[_0xc06b('0x2e')](function(_0x31b54f){_0x4c7ec6[_0xc06b('0x2c')][_0xc06b('0x2f')](_0x507826[_0x31b54f]);});}delete _0x4c7ec6[_0xc06b('0x2b')];}catch(_0x5cafe2){_0x4bd938(_0x5cafe2);}_0x3bba88(_0x4c7ec6);});}function updateSmsInteraction(_0x1b6bb5,_0x5a6e29,_0x3f04db){return new BPromise(function(_0x444d60,_0x26c123){return getInteractionUsers(_0x1b6bb5,_0x3f04db)[_0xc06b('0x22')](function(_0x2392dd){return getInteractionTags(_0x2392dd,_0x5a6e29);})[_0xc06b('0x22')](function(_0x454c8f){return getStateInteraction(_0x454c8f);})[_0xc06b('0x22')](function(_0xffbed){_0x444d60(_0xffbed);})[_0xc06b('0x30')](function(_0x32f119){_0x26c123(_0x32f119);});});}function getStateInteraction(_0x55b939){return new BPromise(function(_0x2a731e){_0x55b939['waiting']=0x0;_0x55b939['talking']=0x0;_0x55b939[_0xc06b('0x31')]=0x0;_0x55b939[_0xc06b('0x32')]=0x0;_0x55b939[_0xc06b('0x33')]=0x0;if(!_0x55b939[_0xc06b('0x34')]&&!_0x55b939[_0xc06b('0x35')]){_0x55b939[_0xc06b('0x36')]+=0x1;}if(!_0x55b939[_0xc06b('0x34')]&&_0x55b939[_0xc06b('0x35')]){_0x55b939[_0xc06b('0x37')]+=0x1;if(_0x55b939[_0xc06b('0x36')]){_0x55b939[_0xc06b('0x36')]-=0x1;}}if(_0x55b939['closed']&&_0x55b939[_0xc06b('0x35')]){_0x55b939[_0xc06b('0x31')]+=0x1;if(_0x55b939[_0xc06b('0x37')]){_0x55b939[_0xc06b('0x37')]-=0x1;}}if(_0x55b939[_0xc06b('0x34')]&&!_0x55b939[_0xc06b('0x35')]){_0x55b939[_0xc06b('0x32')]+=0x1;if(_0x55b939[_0xc06b('0x36')]){_0x55b939[_0xc06b('0x36')]-=0x1;}}_0x55b939['total']+=0x1;_0x2a731e(_0x55b939);});}exports[_0xc06b('0x38')]=function(_0xc67ce3,_0x2f4835){var _0xa2ef84={},_0x2dd1bb={},_0x151d3c={'count':0x0,'rows':[]};var _0x1c187f=_[_0xc06b('0x29')](db[_0xc06b('0x39')][_0xc06b('0x3a')],function(_0xf61f80){return{'name':_0xf61f80[_0xc06b('0x3b')],'type':_0xf61f80[_0xc06b('0x3c')]['key']};});_0x2dd1bb['model']=_[_0xc06b('0x29')](_0x1c187f,'name');_0x2dd1bb['query']=_[_0xc06b('0x3d')](_0xc67ce3['query']);_0x2dd1bb[_0xc06b('0x3e')]=_[_0xc06b('0x3f')](_0x2dd1bb[_0xc06b('0x40')],_0x2dd1bb[_0xc06b('0x41')]);_0xa2ef84[_0xc06b('0x42')]=_[_0xc06b('0x3f')](_0x2dd1bb[_0xc06b('0x40')],qs[_0xc06b('0x43')](_0xc67ce3['query'][_0xc06b('0x43')]));_0xa2ef84['attributes']=_0xa2ef84[_0xc06b('0x42')]['length']?_0xa2ef84[_0xc06b('0x42')]:_0x2dd1bb[_0xc06b('0x40')];if(!_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x44')](_0xc06b('0x45'))){_0xa2ef84['limit']=qs[_0xc06b('0x1b')](_0xc67ce3['query'][_0xc06b('0x1b')]);_0xa2ef84[_0xc06b('0x1a')]=qs[_0xc06b('0x1a')](_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x1a')]);}_0xa2ef84[_0xc06b('0x46')]=qs[_0xc06b('0x47')](_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x47')]);_0xa2ef84['where']=qs[_0xc06b('0x3e')](_['pick'](_0xc67ce3[_0xc06b('0x41')],_0x2dd1bb[_0xc06b('0x3e')]),_0x1c187f);var _0x27cd35=[];var _0x28c737=squel[_0xc06b('0x48')]()[_0xc06b('0x49')]('id')['field']('name')[_0xc06b('0x49')](_0xc06b('0x4a'))['from'](_0xc06b('0x4b'));var _0x20a744=squel[_0xc06b('0x48')]()[_0xc06b('0x49')](_0xc06b('0x4c'))[_0xc06b('0x49')](_0xc06b('0x4d'))[_0xc06b('0x49')]('ui.SmsInteractionId')[_0xc06b('0x4e')](_0xc06b('0x4f'),'ui')[_0xc06b('0x50')](_0xc06b('0x51'),'u',_0xc06b('0x52'));var _0x216db6=squel[_0xc06b('0x48')]()['from'](_0xc06b('0x53'),'i')[_0xc06b('0x50')](_0xc06b('0x54'),'c',_0xc06b('0x55'))[_0xc06b('0x50')]('users','o','o.id\x20=\x20i.UserId')[_0xc06b('0x50')](_0xc06b('0x56'),'a',_0xc06b('0x57'))[_0xc06b('0x50')](_0xc06b('0x58'),'me',_0xc06b('0x59'))[_0xc06b('0x50')](_0xc06b('0x5a'),'it',_0xc06b('0x5b'))[_0xc06b('0x50')](_0xc06b('0x4b'),'t',_0xc06b('0x5c'));var _0x2324cd=squel[_0xc06b('0x5d')]();var _0x40adfb=[];var _0x2decda=squel[_0xc06b('0x5d')]();var _0x203f1a;if(_0xc67ce3['query'][_0xc06b('0x5e')]){_0x203f1a=as[_0xc06b('0x5f')](_0xc67ce3['query'][_0xc06b('0x5e')]);var _0x5871f5=_0x203f1a[_0xc06b('0x60')];for(var _0x59bf36=0x0;_0x59bf36<_0x203f1a['conditions'][_0xc06b('0x61')];_0x59bf36++){var _0xa3ab04=_0x203f1a['conditions'][_0x59bf36];var _0x3b3cac='i';var _0x2b3c70=_[_0xc06b('0x62')](_0x1c187f,[_0xc06b('0x26'),_0xa3ab04[_0xc06b('0x49')]]);if(!_0x2b3c70){switch(_0xa3ab04['field']){case _0xc06b('0x63'):if(_0xa3ab04['value']==0x1){_0x216db6[_0xc06b('0x64')]('`'+_0xa3ab04[_0xc06b('0x49')]+_0xc06b('0x65'));}else{_0x216db6[_0xc06b('0x64')]('`'+_0xa3ab04[_0xc06b('0x49')]+_0xc06b('0x66'));}break;case _0xc06b('0x67'):if(_0xa3ab04[_0xc06b('0x68')]===_0xc06b('0x69')){if(_0xa3ab04[_0xc06b('0x6a')]['split']('\x20')['length']>0x1){_0x2324cd[_0x5871f5](_0xc06b('0x6b'),qs[_0xc06b('0x6c')](_0xa3ab04['value']),null);}else{var _0x26f4cf='%'+_0xa3ab04[_0xc06b('0x6a')]+'%';_0x2324cd[_0x5871f5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26f4cf,_0x26f4cf,_0x26f4cf);}}else{_0x2b3c70=_[_0xc06b('0x62')](_0x1c187f,[_0xc06b('0x26'),_0xc06b('0x6d')]);_0xa3ab04[_0xc06b('0x49')]='ContactId';_0x35d122=as[_0xc06b('0x6e')](_0x3b3cac,_0x2b3c70[_0xc06b('0x3c')],_0xa3ab04);_0x2324cd[_0x5871f5](_0x35d122[_0xc06b('0x6f')],_0x35d122[_0xc06b('0x6a')]['start'],_0x35d122[_0xc06b('0x6a')][_0xc06b('0x19')]);}break;case _0xc06b('0x70'):var _0x4cd042=_0xa3ab04[_0xc06b('0x6a')][_0xc06b('0x2d')](',')[_0xc06b('0x29')](function(_0x2d341b){return Number(_0x2d341b);});_0x4cd042[_0xc06b('0x2e')](function(_0x2378bc){_0x2decda['or'](_0xc06b('0x71'),'%,'+_0x2378bc+',%');});_0x40adfb=_[_0xc06b('0x72')](_0x40adfb,_0x4cd042);break;case _0xc06b('0x73'):if(_0xa3ab04['operator']===_0xc06b('0x69')){_0x2324cd[_0x5871f5]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0xa3ab04[_0xc06b('0x6a')]+'%',null);}else{_0x2b3c70=_['find'](_0x1c187f,[_0xc06b('0x26'),_0xc06b('0x35')]);_0xa3ab04['field']='UserId';_0x35d122=as[_0xc06b('0x6e')](_0x3b3cac,_0x2b3c70['type'],_0xa3ab04);_0x2324cd[_0x5871f5](_0x35d122['text'],_0x35d122[_0xc06b('0x6a')]['start'],_0x35d122[_0xc06b('0x6a')]['end']);}break;case _0xc06b('0x74'):_0x35d122=as[_0xc06b('0x6e')]('me',null,_0xa3ab04);_0x2324cd[_0x5871f5](_0x35d122[_0xc06b('0x6f')],_0x35d122[_0xc06b('0x6a')][_0xc06b('0x75')],_0x35d122[_0xc06b('0x6a')][_0xc06b('0x19')]);break;}}else{var _0x35d122=as[_0xc06b('0x6e')](_0x3b3cac,_0x2b3c70['type'],_0xa3ab04);_0x2324cd[_0x5871f5](_0x35d122['text'],_0x35d122[_0xc06b('0x6a')][_0xc06b('0x75')],_0x35d122[_0xc06b('0x6a')][_0xc06b('0x19')]);}}}else{var _0x2d08bb=_(_0xc67ce3[_0xc06b('0x41')])[_0xc06b('0x3d')]()[_0xc06b('0x29')](function(_0x245783){return _[_0xc06b('0x76')](_0x1c187f,['name',_0x245783])?_0x245783:undefined;})[_0xc06b('0x77')]()[_0xc06b('0x6a')]();if(!_[_0xc06b('0x78')](_0x2d08bb)){_0x2d08bb[_0xc06b('0x2e')](function(_0x5f093b){if(_0x5f093b===_0xc06b('0x79')){_0x216db6[_0xc06b('0x7a')](_0xc06b('0x7b'),[][_0xc06b('0x7c')](_0xc67ce3['query'][_0x5f093b]));}else if(_0x5f093b===_0xc06b('0x7d')){var _0x153660=JSON[_0xc06b('0x7e')](_0xc67ce3['query'][_0x5f093b])[_0xc06b('0x7f')];var _0x22c80b=JSON[_0xc06b('0x7e')](_0xc67ce3['query'][_0x5f093b])[_0xc06b('0x80')];_0x216db6[_0xc06b('0x7a')](_0xc06b('0x81'),_0x153660,_0x22c80b);}else{if(_0xc67ce3[_0xc06b('0x41')][_0x5f093b]===_0xc06b('0x82')){_0x216db6[_0xc06b('0x7a')]('i.'+_0x5f093b+'\x20IS\x20NULL');}else{_0x216db6[_0xc06b('0x7a')]('i.'+_0x5f093b+_0xc06b('0x83'),_0xc67ce3[_0xc06b('0x41')][_0x5f093b]);}}});}if(_0xc67ce3['query'][_0xc06b('0x84')]){if(_0xc67ce3[_0xc06b('0x41')]['read']==0x1){_0x216db6['having'](_0xc06b('0x85'));}else{_0x216db6[_0xc06b('0x64')](_0xc06b('0x86'));}}if(_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x87')]){_0x40adfb=_[_0xc06b('0x88')](_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x87')])?_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x87')]:new Array(_0xc67ce3['query'][_0xc06b('0x87')]);_0x40adfb[_0xc06b('0x2e')](function(_0x5df6cd){_0x2decda['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5df6cd+',%');});}if(_0xc67ce3[_0xc06b('0x41')][_0xc06b('0x89')]){var _0x4c382a=_0xc67ce3[_0xc06b('0x41')]['filter'][_0xc06b('0x8a')]('\x5c','\x5c\x5c')[_0xc06b('0x8a')](/'/g,'\x27\x27');if(qs[_0xc06b('0x8b')](_0x4c382a)){_0x2324cd['or']('i.id\x20LIKE\x20?',_0x4c382a+'%')['or']('i.phone\x20LIKE\x20?',_0x4c382a+'%');}else{_0x2324cd['or'](_0xc06b('0x8c'),qs[_0xc06b('0x6c')](_0x4c382a))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4c382a+'%');}}}_0x216db6['where'](_0x2324cd);_0x216db6['group'](_0xc06b('0x8d'));var _0x35c800={'type':db[_0xc06b('0x8e')][_0xc06b('0x8f')]['SELECT'],'raw':!![]};var _0x11cbee=_0x216db6[_0xc06b('0x90')]();_0x11cbee[_0xc06b('0x49')](_0xc06b('0x8d'));_0x11cbee[_0xc06b('0x49')](_0xc06b('0x91'),_0xc06b('0x63'));if(_0xa2ef84[_0xc06b('0x46')]){_0xa2ef84[_0xc06b('0x46')][_0xc06b('0x2e')](function(_0x66dfe7){var _0x119714=_0x66dfe7[0x0]===_0xc06b('0x92')?_0x66dfe7[0x0]:'i.'+_0x66dfe7[0x0];_0x216db6[_0xc06b('0x46')](_0x119714,_0x66dfe7[0x1]===_0xc06b('0x93')?![]:!![]);});}if(!_['isEmpty'](_0x40adfb)){_0x216db6[_0xc06b('0x64')](_0x2decda);_0x11cbee['where']('t.id\x20IN\x20?',_0x40adfb);}BPromise[_0xc06b('0x94')]()['then'](function(){if(!_0x203f1a){if(_0xc67ce3['query'][_0xc06b('0x79')])return;_0x11cbee[_0xc06b('0x7a')](_0xc06b('0x95'));_0x216db6['where'](_0xc06b('0x95'));return;}if(_0xc67ce3[_0xc06b('0x96')][_0xc06b('0x97')]!==_0xc06b('0x98'))return;return _0xc67ce3[_0xc06b('0x96')][_0xc06b('0x99')]({'attributes':['id'],'raw':!![]})[_0xc06b('0x22')](function(_0x258edb){if(_[_0xc06b('0x78')](_0x258edb)){_0x11cbee[_0xc06b('0x7a')](_0xc06b('0x9a'));_0x216db6[_0xc06b('0x7a')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x11cbee[_0xc06b('0x7a')](_0xc06b('0x7b'),_['map'](_0x258edb,'id'));_0x216db6[_0xc06b('0x7a')]('i.SmsAccountId\x20IN\x20?',_[_0xc06b('0x29')](_0x258edb,'id'));}});})[_0xc06b('0x22')](function(){if(_0xc67ce3['user'][_0xc06b('0x97')]===_0xc06b('0x98')&&!_0x203f1a&&!_0xc67ce3['query'][_0xc06b('0x79')])return[];return db[_0xc06b('0x9b')][_0xc06b('0x41')](_0x11cbee['toString'](),_0x35c800);})[_0xc06b('0x22')](function(_0x531962){_0x151d3c[_0xc06b('0x1c')]=_0x531962[_0xc06b('0x61')];if(_0x151d3c[_0xc06b('0x1c')]===0x0)return[];return db[_0xc06b('0x9b')]['query'](_0x28c737[_0xc06b('0x9c')](),_0x35c800)[_0xc06b('0x22')](function(_0x2b3529){_0x27cd35=_['keyBy'](_0x2b3529,'id');_0x35c800=_['merge'](_0x35c800,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xc67ce3[_0xc06b('0x41')]['fields']){_0xa2ef84['attributes']['forEach'](function(_0x3d114e){_0x216db6['field']('i.'+_0x3d114e);});}else{_0x216db6[_0xc06b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xc06b('0x63'));_0x216db6[_0xc06b('0x49')](_0xc06b('0x9d'),'Account.key');_0x216db6[_0xc06b('0x49')](_0xc06b('0x9e'),_0xc06b('0x9f'));_0x216db6[_0xc06b('0x49')](_0xc06b('0xa0'),_0xc06b('0x92'));_0x216db6['field']('i.*');_0x216db6['field'](_0xc06b('0xa1'),_0xc06b('0xa2'));_0x216db6[_0xc06b('0x49')]('c.lastName','Contact.lastName');_0x216db6[_0xc06b('0x49')](_0xc06b('0xa3'),_0xc06b('0xa4'));_0x216db6[_0xc06b('0x49')]('c.phone',_0xc06b('0xa5'));_0x216db6[_0xc06b('0x49')]('c.mobile',_0xc06b('0xa6'));_0x216db6[_0xc06b('0x49')](_0xc06b('0xa7'),_0xc06b('0xa8'));_0x216db6['field'](_0xc06b('0xa9'),_0xc06b('0xaa'));_0x216db6[_0xc06b('0x49')](_0xc06b('0xab'),_0xc06b('0xac'));_0x216db6[_0xc06b('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc06b('0x2b'));}if(_0xa2ef84[_0xc06b('0x1b')])_0x216db6[_0xc06b('0x1b')](_0xa2ef84[_0xc06b('0x1b')]);if(_0xa2ef84[_0xc06b('0x1a')])_0x216db6[_0xc06b('0x1a')](_0xa2ef84['offset']);return db[_0xc06b('0x9b')][_0xc06b('0x41')](_0x216db6['toString'](),_0x35c800);})[_0xc06b('0x22')](function(_0x346226){if(_0x346226[_0xc06b('0x61')]>0x0)_0x20a744[_0xc06b('0x7a')](_0xc06b('0xad'),_['map'](_0x346226,'id'));return db[_0xc06b('0x9b')][_0xc06b('0x41')](_0x20a744[_0xc06b('0x9c')](),_0x35c800)[_0xc06b('0x22')](function(_0x4624eb){var _0x43e19b=_[_0xc06b('0xae')](_0x4624eb,_0xc06b('0xaf'));var _0x31ac62=[];_0x346226[_0xc06b('0x2e')](function(_0x24fa73){_0x31ac62[_0xc06b('0x2f')](updateSmsInteraction(_0x24fa73,_0x27cd35,_0x43e19b));});return BPromise[_0xc06b('0xb0')](_0x31ac62);});});})['then'](function(_0x458625){_0x151d3c[_0xc06b('0xb1')]=_0x458625;return _0x151d3c;})[_0xc06b('0x22')](respondWithFilteredResult(_0x2f4835,_0xa2ef84))['catch'](handleError(_0x2f4835,null));};exports[_0xc06b('0xb2')]=function(_0x2ab290,_0x651d9f){var _0x52bcc0={'raw':![],'where':{'id':_0x2ab290[_0xc06b('0xb3')]['id']}},_0x28d3f4={};_0x28d3f4[_0xc06b('0x40')]=_['keys'](db[_0xc06b('0x39')]['rawAttributes']);_0x28d3f4[_0xc06b('0x41')]=_[_0xc06b('0x3d')](_0x2ab290[_0xc06b('0x41')]);_0x28d3f4[_0xc06b('0x3e')]=_[_0xc06b('0x3f')](_0x28d3f4[_0xc06b('0x40')],_0x28d3f4[_0xc06b('0x41')]);_0x52bcc0['attributes']=_[_0xc06b('0x3f')](_0x28d3f4[_0xc06b('0x40')],qs[_0xc06b('0x43')](_0x2ab290['query']['fields']));_0x52bcc0[_0xc06b('0x42')]=_0x52bcc0['attributes'][_0xc06b('0x61')]?_0x52bcc0[_0xc06b('0x42')]:_0x28d3f4[_0xc06b('0x40')];if(_0x2ab290['query'][_0xc06b('0xb4')]){_0x52bcc0[_0xc06b('0xb5')]=[{'all':!![]}];}_0x52bcc0=_[_0xc06b('0xb6')]({},_0x52bcc0,_0x2ab290[_0xc06b('0xb7')]);return db[_0xc06b('0x39')][_0xc06b('0x62')](_0x52bcc0)[_0xc06b('0x22')](handleEntityNotFound(_0x651d9f,null))[_0xc06b('0x22')](respondWithResult(_0x651d9f,null))[_0xc06b('0x30')](handleError(_0x651d9f,null));};exports['create']=function(_0x29b764,_0x94101d){return db[_0xc06b('0x39')][_0xc06b('0xb8')](_0x29b764[_0xc06b('0x74')],{})[_0xc06b('0x22')](respondWithResult(_0x94101d,0xc9))[_0xc06b('0x30')](handleError(_0x94101d,null));};exports['update']=function(_0x5a1918,_0x5add38){if(_0x5a1918['body']['id']){delete _0x5a1918['body']['id'];}return db[_0xc06b('0x39')][_0xc06b('0x62')]({'where':{'id':_0x5a1918['params']['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0x5add38,null))[_0xc06b('0x22')](saveUpdates(_0x5a1918[_0xc06b('0x74')],null))[_0xc06b('0x22')](respondWithResult(_0x5add38,null))[_0xc06b('0x30')](handleError(_0x5add38,null));};exports[_0xc06b('0x23')]=function(_0x2df162,_0x143b0e){return db[_0xc06b('0x39')][_0xc06b('0x62')]({'where':{'id':_0x2df162[_0xc06b('0xb3')]['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0x143b0e,null))[_0xc06b('0x22')](removeEntity(_0x143b0e,null))[_0xc06b('0x30')](handleError(_0x143b0e,null));};exports[_0xc06b('0xb9')]=function(_0x1358b1,_0x27b6bd){return db[_0xc06b('0x39')]['describe']()[_0xc06b('0x22')](respondWithResult(_0x27b6bd,null))[_0xc06b('0x30')](handleError(_0x27b6bd,null));};exports['addMessage']=function(_0x55b816,_0x5535e5,_0x548a11){return db[_0xc06b('0xba')][_0xc06b('0x62')]({'where':{'id':_0x55b816['params']['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0x5535e5,null))[_0xc06b('0x22')](function(_0x4eea5b){if(_0x4eea5b){return _0x4eea5b[_0xc06b('0xbb')](_0x55b816[_0xc06b('0x74')]['ids'],_[_0xc06b('0xbc')](_0x55b816[_0xc06b('0x74')],[_0xc06b('0xbd'),'id'])||{});}})[_0xc06b('0x22')](respondWithResult(_0x5535e5,null))[_0xc06b('0x30')](handleError(_0x5535e5,null));};exports[_0xc06b('0xbe')]=function(_0x42616f,_0x208cd6,_0x556066){var _0x436ed9={'raw':![],'where':{}};var _0x6830d3={};var _0x46bcc8={'count':0x0,'rows':[]};return db[_0xc06b('0x39')][_0xc06b('0xbf')]({'where':{'id':_0x42616f[_0xc06b('0xb3')]['id']}})[_0xc06b('0x22')](handleEntityNotFound(_0x208cd6,null))[_0xc06b('0x22')](function(_0x55c5ff){if(_0x55c5ff){_0x6830d3[_0xc06b('0x40')]=_[_0xc06b('0x3d')](db['SmsMessage'][_0xc06b('0x3a')]);_0x6830d3[_0xc06b('0x41')]=_['keys'](_0x42616f[_0xc06b('0x41')]);_0x6830d3['filters']=_[_0xc06b('0x3f')](_0x6830d3['model'],_0x6830d3[_0xc06b('0x41')]);_0x436ed9[_0xc06b('0x42')]=_[_0xc06b('0x3f')](_0x6830d3['model'],qs[_0xc06b('0x43')](_0x42616f['query']['fields']));_0x436ed9[_0xc06b('0x42')]=_0x436ed9[_0xc06b('0x42')]['length']?_0x436ed9[_0xc06b('0x42')]:_0x6830d3[_0xc06b('0x40')];if(!_0x42616f['query'][_0xc06b('0x44')](_0xc06b('0x45'))){_0x436ed9[_0xc06b('0x1b')]=qs[_0xc06b('0x1b')](_0x42616f[_0xc06b('0x41')][_0xc06b('0x1b')]);_0x436ed9[_0xc06b('0x1a')]=qs[_0xc06b('0x1a')](_0x42616f['query'][_0xc06b('0x1a')]);}_0x436ed9['order']=qs['sort'](_0x42616f[_0xc06b('0x41')][_0xc06b('0x47')]);_0x436ed9[_0xc06b('0x7a')]=qs[_0xc06b('0x3e')](_[_0xc06b('0xc0')](_0x42616f[_0xc06b('0x41')],_0x6830d3[_0xc06b('0x3e')]));_0x436ed9['where'][_0xc06b('0xaf')]=_0x55c5ff['id'];if(_0x42616f[_0xc06b('0x41')][_0xc06b('0x89')]){_0x436ed9['where']=_[_0xc06b('0xb6')](_0x436ed9[_0xc06b('0x7a')],{'$or':_[_0xc06b('0x29')](_0x436ed9['attributes'],function(_0x229c4e){var _0x365aa4={};_0x365aa4[_0x229c4e]={'$like':'%'+_0x42616f[_0xc06b('0x41')][_0xc06b('0x89')]+'%'};return _0x365aa4;})});}if(_0x42616f[_0xc06b('0x41')][_0xc06b('0x7f')]){var _0x114613=_0x42616f[_0xc06b('0x41')][_0xc06b('0x7f')]['split'](',');var _0x3ae068={};_0x3ae068[_0x114613[0x0]]={'$gte':moment(_0x114613[0x1])[_0xc06b('0xc1')](_0xc06b('0xc2'))};_0x436ed9[_0xc06b('0x7a')]=_['merge'](_0x436ed9[_0xc06b('0x7a')],_0x3ae068);}_0x436ed9=_[_0xc06b('0xb6')]({},_0x436ed9,_0x42616f[_0xc06b('0xb7')]);return db[_0xc06b('0xba')]['count']({'where':_0x436ed9[_0xc06b('0x7a')]})['then'](function(_0x1e767f){_0x46bcc8['count']=_0x1e767f;if(_0x42616f[_0xc06b('0x41')]['includeAll']){_0x436ed9[_0xc06b('0xb5')]=[{'all':!![]}];}return db[_0xc06b('0xba')][_0xc06b('0xc3')](_0x436ed9);})[_0xc06b('0x22')](function(_0x2664f6){_0x46bcc8[_0xc06b('0xb1')]=_0x2664f6;return _0x46bcc8;});}})[_0xc06b('0x22')](respondWithFilteredResult(_0x208cd6,_0x436ed9))[_0xc06b('0x30')](handleError(_0x208cd6,null));};exports[_0xc06b('0xc4')]=function(_0x26731a,_0x3fec5f,_0x456549){return db[_0xc06b('0x39')][_0xc06b('0x62')]({'where':{'id':_0x26731a[_0xc06b('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3fec5f,null))['then'](function(_0x77e059){if(_0x77e059){return _0x77e059[_0xc06b('0xc5')](_0x26731a['body'][_0xc06b('0xbd')],_['omit'](_0x26731a['body'],[_0xc06b('0xbd'),'id'])||{})[_0xc06b('0xc6')](function(){return db[_0xc06b('0x70')][_0xc06b('0xc3')]({'attributes':['id','name',_0xc06b('0x4a')],'where':{'id':_0x26731a['body']['ids']}});})[_0xc06b('0x22')](function(_0x1fde11){socket[_0xc06b('0xc7')](_0xc06b('0xc8'),{'id':Number(_0x26731a[_0xc06b('0xb3')]['id']),'tags':_0x1fde11||[]});return{'id':Number(_0x26731a[_0xc06b('0xb3')]['id']),'tags':_0x1fde11||[]};});}})[_0xc06b('0x22')](respondWithResult(_0x3fec5f,null))[_0xc06b('0x30')](handleError(_0x3fec5f,null));};exports[_0xc06b('0xc9')]=function(_0x3463ab,_0x1572c0,_0x3e419a){return db[_0xc06b('0x39')][_0xc06b('0x62')]({'where':{'id':_0x3463ab['params']['id']}})['then'](handleEntityNotFound(_0x1572c0,null))['then'](function(_0x5a0564){if(_0x5a0564){return _0x5a0564[_0xc06b('0xc9')](_0x3463ab[_0xc06b('0x41')]['ids']);}})[_0xc06b('0x22')](respondWithStatusCode(_0x1572c0,null))[_0xc06b('0x30')](handleError(_0x1572c0,null));};exports[_0xc06b('0xca')]=function(_0x28eaf6,_0x5f0e85){var _0x2d7e71=moment()[_0xc06b('0xcb')]()[_0xc06b('0x9c')]();var _0x41c1b0=path[_0xc06b('0xcc')](config[_0xc06b('0xcd')],_0xc06b('0xce'),_0xc06b('0xcf'),'tmp');var _0x5103db=path['join'](config[_0xc06b('0xcd')],_0xc06b('0xce'),_0xc06b('0xcf'),'attachments');var _0x3a961f=path[_0xc06b('0xcc')](_0x41c1b0,_0x2d7e71);var _0x206781=util[_0xc06b('0xc1')](_0xc06b('0xd0'),_0x28eaf6[_0xc06b('0xb3')]['id'],_0x2d7e71);var _0x638305=path['join'](_0x41c1b0,_0x206781);var _0x48c738=[];_0x48c738[_0xc06b('0x2f')]({'model':db[_0xc06b('0x73')],'as':_0xc06b('0x73'),'attributes':['id','fullname'],'raw':!![]});_0x48c738[_0xc06b('0x2f')]({'model':db[_0xc06b('0xd1')],'as':_0xc06b('0x67'),'attributes':['id',_0xc06b('0xd2'),_0xc06b('0xd3')],'raw':!![]});var _0x308c0a=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body',_0xc06b('0x7d'),_0xc06b('0xd4'),_0xc06b('0xd5'),_0xc06b('0x84')],'include':_0x48c738}];_0x308c0a['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x308c0a[_0xc06b('0x2f')]({'model':db[_0xc06b('0x73')],'as':_0xc06b('0xd6'),'attributes':['id',_0xc06b('0x2a')]});return db[_0xc06b('0x39')][_0xc06b('0x62')]({'where':{'id':_0x28eaf6[_0xc06b('0xb3')]['id']},'include':_0x308c0a})['then'](handleEntityNotFound(_0x5f0e85,null))['then'](function(_0x1d611b){if(_0x1d611b){var _0x37f0c9=_0x1d611b[_0xc06b('0xd7')]({'plain':!![]});fs[_0xc06b('0xd8')](_0x3a961f);var _0x5a6b36={'channel':_0xc06b('0xd9'),'account':_0x37f0c9[_0xc06b('0xda')]['name'],'agent':_0x37f0c9[_0xc06b('0xd6')]?_0x37f0c9[_0xc06b('0xd6')][_0xc06b('0x2a')]:_0xc06b('0xdb'),'createdAt':moment(_0x37f0c9[_0xc06b('0x7d')])['format'](_0xc06b('0xc2'))[_0xc06b('0x9c')](),'closedAt':_0x37f0c9['closed']?moment(_0x37f0c9[_0xc06b('0xdc')])[_0xc06b('0xc1')](_0xc06b('0xc2'))[_0xc06b('0x9c')]():'','disposition':_0x37f0c9[_0xc06b('0xdd')],'messages':_(_0x37f0c9[_0xc06b('0xde')])[_0xc06b('0x89')]({'secret':![]})[_0xc06b('0x29')](function(_0x364e7d){return{'date':moment(_0x364e7d[_0xc06b('0x7d')])[_0xc06b('0xc1')](_0xc06b('0xc2'))[_0xc06b('0x9c')](),'sender':_0x364e7d[_0xc06b('0xd4')]===_0xc06b('0xdf')?_0x364e7d[_0xc06b('0x73')]?_0x364e7d[_0xc06b('0x73')][_0xc06b('0x2a')]:_0xc06b('0xe0'):_0x364e7d[_0xc06b('0x67')][_0xc06b('0xd2')]+(_0x364e7d[_0xc06b('0x67')][_0xc06b('0xd3')]?'\x20'+_0x364e7d['Contact'][_0xc06b('0xd3')]:''),'body':_0x364e7d[_0xc06b('0x74')],'direction':_0x364e7d['direction']==='out'?'A':'C','secret':_0x364e7d[_0xc06b('0xd5')],'read':_0x364e7d[_0xc06b('0x84')]};})[_0xc06b('0x6a')]()};return ejs[_0xc06b('0xe1')](path[_0xc06b('0xcc')](config[_0xc06b('0xcd')],_0xc06b('0xce'),'views',_0xc06b('0xe2')),{'interaction':_0x5a6b36})[_0xc06b('0x22')](function(_0x55b625){var _0x56daf1=path[_0xc06b('0xcc')](_0x3a961f,'transcript-'+_0x37f0c9['id']+'-'+_0x2d7e71+'.pdf');var _0x16d253={'path':_0x56daf1,'channel':_0xc06b('0xd9'),'interactionId':_0x37f0c9['id']};return pdf['createPdfFromHTML'](_0x55b625,_0x16d253);})[_0xc06b('0x22')](function(){return new BPromise(function(_0x28c90a,_0x51f12a){zipdir(_0x3a961f,{'saveTo':_0x638305},function(_0x13974a,_0x45de34){if(_0x13974a)return _0x51f12a(_0x13974a);return _0x28c90a(_0x45de34);});})[_0xc06b('0x22')](function(){return new BPromise(function(_0x2f514e,_0x551519){rimraf(_0x3a961f,function(_0x1f91d0){if(_0x1f91d0)_0x551519(_0x1f91d0);return _0x2f514e();});});})[_0xc06b('0x22')](function(){return _0x5f0e85[_0xc06b('0xca')](_0x638305,_0x206781,function(_0x5cc5a0){if(_0x5cc5a0){console[_0xc06b('0xe3')](_0xc06b('0xe4'),_0x5cc5a0);}else{fs[_0xc06b('0xe5')](_0x638305);}});});});}else{return _0x5f0e85[_0xc06b('0x17')](0xc8);}})[_0xc06b('0x30')](handleError(_0x5f0e85,null));}; \ No newline at end of file +var _0x48f8=['includeAll','include','options','create','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','SmsInteractionId','$gte','format','rows','addTags','setTags','spread','findAll','smsInteractionTags:save','download','unix','join','root','server','tmp','files','CmContact','firstName','Messages','direction','secret','SmsAccount','Account','get','mkdirSync','Sms','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','out','System','Contact','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','waiting','talking','answered','unmanaged','total','UserId','closed','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','find','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','$lte','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','Account.mandatoryDisposition','contactName','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','catch','show'];(function(_0x214a70,_0x35a1cd){var _0x36bc02=function(_0x27cf5e){while(--_0x27cf5e){_0x214a70['push'](_0x214a70['shift']());}};_0x36bc02(++_0x35a1cd);}(_0x48f8,0x11f));var _0x848f=function(_0xbd15e3,_0x31dd1b){_0xbd15e3=_0xbd15e3-0x0;var _0x309e04=_0x48f8[_0xbd15e3];return _0x309e04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x848f('0x0'));var zipdir=require(_0x848f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x848f('0x2'));var moment=require(_0x848f('0x3'));var BPromise=require(_0x848f('0x4'));var Mustache=require(_0x848f('0x5'));var util=require(_0x848f('0x6'));var path=require(_0x848f('0x7'));var sox=require('sox');var csv=require(_0x848f('0x8'));var ejs=require(_0x848f('0x9'));var fs=require('fs');var fs_extra=require(_0x848f('0xa'));var _=require(_0x848f('0xb'));var squel=require(_0x848f('0xc'));var crypto=require(_0x848f('0xd'));var jsforce=require(_0x848f('0xe'));var deskjs=require(_0x848f('0xf'));var toCsv=require(_0x848f('0x8'));var querystring=require(_0x848f('0x10'));var Papa=require('papaparse');var Redis=require(_0x848f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x848f('0x12'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x848f('0x13'));var logger=require(_0x848f('0x14'))(_0x848f('0x15'));var utils=require(_0x848f('0x16'));var config=require(_0x848f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x848f('0x18'))['db'];config[_0x848f('0x19')]=_['defaults'](config[_0x848f('0x19')],{'host':_0x848f('0x1a'),'port':0x18eb});var socket=require(_0x848f('0x1b'))(new Redis(config[_0x848f('0x19')]));require(_0x848f('0x1c'))[_0x848f('0x1d')](socket);function respondWithStatusCode(_0x4d66a7,_0x3f8e84){_0x3f8e84=_0x3f8e84||0xcc;return function(_0x200549){if(_0x200549){return _0x4d66a7['sendStatus'](_0x3f8e84);}return _0x4d66a7['status'](_0x3f8e84)['end']();};}function respondWithResult(_0x27c441,_0x3b2055){_0x3b2055=_0x3b2055||0xc8;return function(_0x15422c){if(_0x15422c){return _0x27c441[_0x848f('0x1e')](_0x3b2055)[_0x848f('0x1f')](_0x15422c);}};}function respondWithFilteredResult(_0x1689e7,_0x101912){return function(_0x3b3075){if(_0x3b3075){var _0x17a3fd=typeof _0x101912[_0x848f('0x20')]===_0x848f('0x21')&&typeof _0x101912[_0x848f('0x22')]===_0x848f('0x21');var _0x207334=_0x3b3075[_0x848f('0x23')];var _0x539114=_0x17a3fd?0x0:_0x101912[_0x848f('0x20')];var _0x53d216=_0x17a3fd?_0x3b3075[_0x848f('0x23')]:_0x101912['offset']+_0x101912[_0x848f('0x22')];var _0x3f955d;if(_0x53d216>=_0x207334){_0x53d216=_0x207334;_0x3f955d=0xc8;}else{_0x3f955d=0xce;}_0x1689e7['status'](_0x3f955d);return _0x1689e7[_0x848f('0x24')](_0x848f('0x25'),_0x539114+'-'+_0x53d216+'/'+_0x207334)[_0x848f('0x1f')](_0x3b3075);}return null;};}function patchUpdates(_0x41165a){return function(_0x5273fa){try{jsonpatch[_0x848f('0x26')](_0x5273fa,_0x41165a,!![]);}catch(_0x58ec58){return BPromise[_0x848f('0x27')](_0x58ec58);}return _0x5273fa['save']();};}function saveUpdates(_0x493f3c,_0x2eafc2){return function(_0x2170e7){if(_0x2170e7){return _0x2170e7[_0x848f('0x28')](_0x493f3c)[_0x848f('0x29')](function(_0x1ccea5){return _0x1ccea5;});}return null;};}function removeEntity(_0x583596,_0x97275a){return function(_0x47b13a){if(_0x47b13a){return _0x47b13a[_0x848f('0x2a')]()[_0x848f('0x29')](function(){_0x583596[_0x848f('0x1e')](0xcc)[_0x848f('0x2b')]();});}};}function handleEntityNotFound(_0xb9ef51,_0x2b9dd1){return function(_0x11017b){if(!_0x11017b){_0xb9ef51[_0x848f('0x2c')](0x194);}return _0x11017b;};}function handleError(_0x43a3ef,_0x449eb0){_0x449eb0=_0x449eb0||0x1f4;return function(_0x50f3d8){logger[_0x848f('0x2d')](_0x50f3d8[_0x848f('0x2e')]);if(_0x50f3d8[_0x848f('0x2f')]){delete _0x50f3d8[_0x848f('0x2f')];}_0x43a3ef[_0x848f('0x1e')](_0x449eb0)[_0x848f('0x30')](_0x50f3d8);};}function getInteractionUsers(_0x50eb7c,_0x2e5c44){return new BPromise(function(_0x497f34,_0x550f61){try{if(_0x2e5c44[_0x50eb7c['id']]){_0x50eb7c['Users']=_['map'](_0x2e5c44[_0x50eb7c['id']],function(_0x200c87){return{'id':_0x200c87['id'],'fullname':_0x200c87[_0x848f('0x31')]};});}}catch(_0x22c153){_0x550f61(_0x22c153);}_0x497f34(_0x50eb7c);});}function getInteractionTags(_0x1701fb,_0x226c51){return new BPromise(function(_0x144686,_0x1fc0cd){try{if(_0x1701fb[_0x848f('0x32')]){_0x1701fb[_0x848f('0x33')]=[];_0x1701fb['TagIds'][_0x848f('0x34')](',')[_0x848f('0x35')](function(_0x38fd1a){_0x1701fb['Tags'][_0x848f('0x36')](_0x226c51[_0x38fd1a]);});}delete _0x1701fb['TagIds'];}catch(_0x5ecb07){_0x1fc0cd(_0x5ecb07);}_0x144686(_0x1701fb);});}function updateSmsInteraction(_0x35b674,_0x145996,_0x616ffb){return new BPromise(function(_0x44e331,_0x594454){return getInteractionUsers(_0x35b674,_0x616ffb)[_0x848f('0x29')](function(_0x5d52e3){return getInteractionTags(_0x5d52e3,_0x145996);})['then'](function(_0x1d4306){return getStateInteraction(_0x1d4306);})[_0x848f('0x29')](function(_0x4bb223){_0x44e331(_0x4bb223);})['catch'](function(_0x5be73d){_0x594454(_0x5be73d);});});}function getStateInteraction(_0x4af798){return new BPromise(function(_0x1c3792){_0x4af798[_0x848f('0x37')]=0x0;_0x4af798[_0x848f('0x38')]=0x0;_0x4af798[_0x848f('0x39')]=0x0;_0x4af798[_0x848f('0x3a')]=0x0;_0x4af798[_0x848f('0x3b')]=0x0;if(!_0x4af798['closed']&&!_0x4af798[_0x848f('0x3c')]){_0x4af798[_0x848f('0x37')]+=0x1;}if(!_0x4af798[_0x848f('0x3d')]&&_0x4af798[_0x848f('0x3c')]){_0x4af798[_0x848f('0x38')]+=0x1;if(_0x4af798[_0x848f('0x37')]){_0x4af798[_0x848f('0x37')]-=0x1;}}if(_0x4af798[_0x848f('0x3d')]&&_0x4af798[_0x848f('0x3c')]){_0x4af798['answered']+=0x1;if(_0x4af798[_0x848f('0x38')]){_0x4af798['talking']-=0x1;}}if(_0x4af798[_0x848f('0x3d')]&&!_0x4af798['UserId']){_0x4af798[_0x848f('0x3a')]+=0x1;if(_0x4af798[_0x848f('0x37')]){_0x4af798[_0x848f('0x37')]-=0x1;}}_0x4af798[_0x848f('0x3b')]+=0x1;_0x1c3792(_0x4af798);});}exports[_0x848f('0x3e')]=function(_0x2a377c,_0x53f6cf){var _0x5353a3={},_0x207679={},_0x123afa={'count':0x0,'rows':[]};var _0x50ec2d=_[_0x848f('0x3f')](db['SmsInteraction'][_0x848f('0x40')],function(_0x5b0a93){return{'name':_0x5b0a93[_0x848f('0x41')],'type':_0x5b0a93[_0x848f('0x42')][_0x848f('0x43')]};});_0x207679[_0x848f('0x44')]=_[_0x848f('0x3f')](_0x50ec2d,_0x848f('0x2f'));_0x207679[_0x848f('0x45')]=_[_0x848f('0x46')](_0x2a377c[_0x848f('0x45')]);_0x207679['filters']=_[_0x848f('0x47')](_0x207679[_0x848f('0x44')],_0x207679[_0x848f('0x45')]);_0x5353a3[_0x848f('0x48')]=_[_0x848f('0x47')](_0x207679[_0x848f('0x44')],qs[_0x848f('0x49')](_0x2a377c[_0x848f('0x45')][_0x848f('0x49')]));_0x5353a3[_0x848f('0x48')]=_0x5353a3[_0x848f('0x48')][_0x848f('0x4a')]?_0x5353a3[_0x848f('0x48')]:_0x207679[_0x848f('0x44')];if(!_0x2a377c[_0x848f('0x45')][_0x848f('0x4b')](_0x848f('0x4c'))){_0x5353a3[_0x848f('0x22')]=qs['limit'](_0x2a377c[_0x848f('0x45')][_0x848f('0x22')]);_0x5353a3[_0x848f('0x20')]=qs[_0x848f('0x20')](_0x2a377c['query'][_0x848f('0x20')]);}_0x5353a3[_0x848f('0x4d')]=qs[_0x848f('0x4e')](_0x2a377c['query'][_0x848f('0x4e')]);_0x5353a3[_0x848f('0x4f')]=qs['filters'](_[_0x848f('0x50')](_0x2a377c[_0x848f('0x45')],_0x207679[_0x848f('0x51')]),_0x50ec2d);var _0x161148=[];var _0x3bdd9b=squel[_0x848f('0x52')]()[_0x848f('0x53')]('id')[_0x848f('0x53')](_0x848f('0x2f'))[_0x848f('0x53')](_0x848f('0x54'))[_0x848f('0x55')](_0x848f('0x56'));var _0x52d3ea=squel['select']()[_0x848f('0x53')]('u.id')[_0x848f('0x53')](_0x848f('0x57'))[_0x848f('0x53')](_0x848f('0x58'))[_0x848f('0x55')](_0x848f('0x59'),'ui')[_0x848f('0x5a')]('users','u',_0x848f('0x5b'));var _0x119d97=squel['select']()[_0x848f('0x55')]('sms_interactions','i')[_0x848f('0x5a')](_0x848f('0x5c'),'c',_0x848f('0x5d'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x848f('0x5a')](_0x848f('0x5e'),'a',_0x848f('0x5f'))[_0x848f('0x5a')](_0x848f('0x60'),'me',_0x848f('0x61'))[_0x848f('0x5a')]('sms_interaction_has_tags','it',_0x848f('0x62'))[_0x848f('0x5a')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x57d275=squel['expr']();var _0x56b359=[];var _0x4ad941=squel[_0x848f('0x63')]();var _0x47bf36;if(_0x2a377c[_0x848f('0x45')]['search']){_0x47bf36=as['parseSearch'](_0x2a377c['query']['search']);var _0x3f6ab7=_0x47bf36[_0x848f('0x64')];for(var _0x3afce5=0x0;_0x3afce5<_0x47bf36['conditions']['length'];_0x3afce5++){var _0x11efc7=_0x47bf36[_0x848f('0x65')][_0x3afce5];var _0x59fa68='i';var _0x12a047=_[_0x848f('0x66')](_0x50ec2d,['name',_0x11efc7[_0x848f('0x53')]]);if(!_0x12a047){switch(_0x11efc7['field']){case'unreadMessages':if(_0x11efc7[_0x848f('0x67')]==0x1){_0x119d97[_0x848f('0x68')]('`'+_0x11efc7[_0x848f('0x53')]+_0x848f('0x69'));}else{_0x119d97['having']('`'+_0x11efc7['field']+'`\x20>\x200');}break;case'Contact':if(_0x11efc7[_0x848f('0x6a')]===_0x848f('0x6b')){if(_0x11efc7[_0x848f('0x67')][_0x848f('0x34')]('\x20')['length']>0x1){_0x57d275[_0x3f6ab7](_0x848f('0x6c'),qs[_0x848f('0x6d')](_0x11efc7[_0x848f('0x67')]),null);}else{var _0x4eb9fe='%'+_0x11efc7[_0x848f('0x67')]+'%';_0x57d275[_0x3f6ab7](_0x848f('0x6e'),_0x4eb9fe,_0x4eb9fe,_0x4eb9fe);}}else{_0x12a047=_[_0x848f('0x66')](_0x50ec2d,[_0x848f('0x2f'),_0x848f('0x6f')]);_0x11efc7[_0x848f('0x53')]=_0x848f('0x6f');_0x547775=as[_0x848f('0x70')](_0x59fa68,_0x12a047[_0x848f('0x42')],_0x11efc7);_0x57d275[_0x3f6ab7](_0x547775[_0x848f('0x71')],_0x547775[_0x848f('0x67')]['start'],_0x547775[_0x848f('0x67')]['end']);}break;case'Tag':var _0x281826=_0x11efc7['value'][_0x848f('0x34')](',')[_0x848f('0x3f')](function(_0x319106){return Number(_0x319106);});_0x281826[_0x848f('0x35')](function(_0x2d6a1d){_0x4ad941['or'](_0x848f('0x72'),'%,'+_0x2d6a1d+',%');});_0x56b359=_[_0x848f('0x73')](_0x56b359,_0x281826);break;case _0x848f('0x74'):if(_0x11efc7['operator']===_0x848f('0x6b')){_0x57d275[_0x3f6ab7](_0x848f('0x75'),'%'+_0x11efc7['value']+'%',null);}else{_0x12a047=_[_0x848f('0x66')](_0x50ec2d,[_0x848f('0x2f'),_0x848f('0x3c')]);_0x11efc7[_0x848f('0x53')]=_0x848f('0x3c');_0x547775=as[_0x848f('0x70')](_0x59fa68,_0x12a047[_0x848f('0x42')],_0x11efc7);_0x57d275[_0x3f6ab7](_0x547775['text'],_0x547775[_0x848f('0x67')][_0x848f('0x76')],_0x547775[_0x848f('0x67')][_0x848f('0x2b')]);}break;case _0x848f('0x77'):_0x547775=as[_0x848f('0x70')]('me',null,_0x11efc7);_0x57d275[_0x3f6ab7](_0x547775[_0x848f('0x71')],_0x547775['value'][_0x848f('0x76')],_0x547775[_0x848f('0x67')][_0x848f('0x2b')]);break;}}else{var _0x547775=as[_0x848f('0x70')](_0x59fa68,_0x12a047['type'],_0x11efc7);_0x57d275[_0x3f6ab7](_0x547775[_0x848f('0x71')],_0x547775['value']['start'],_0x547775[_0x848f('0x67')][_0x848f('0x2b')]);}}}else{var _0x3ac5e7=_(_0x2a377c[_0x848f('0x45')])[_0x848f('0x46')]()['map'](function(_0x535c23){return _[_0x848f('0x78')](_0x50ec2d,[_0x848f('0x2f'),_0x535c23])?_0x535c23:undefined;})['compact']()[_0x848f('0x67')]();if(!_[_0x848f('0x79')](_0x3ac5e7)){_0x3ac5e7[_0x848f('0x35')](function(_0x451ffe){if(_0x451ffe===_0x848f('0x7a')){_0x119d97[_0x848f('0x4f')](_0x848f('0x7b'),[][_0x848f('0x7c')](_0x2a377c[_0x848f('0x45')][_0x451ffe]));}else if(_0x451ffe===_0x848f('0x7d')){var _0xfde44e=JSON['parse'](_0x2a377c[_0x848f('0x45')][_0x451ffe])['$gte'];var _0x90d9db=JSON['parse'](_0x2a377c['query'][_0x451ffe])[_0x848f('0x7e')];_0x119d97[_0x848f('0x4f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xfde44e,_0x90d9db);}else{if(_0x2a377c[_0x848f('0x45')][_0x451ffe]===_0x848f('0x7f')){_0x119d97[_0x848f('0x4f')]('i.'+_0x451ffe+'\x20IS\x20NULL');}else{_0x119d97[_0x848f('0x4f')]('i.'+_0x451ffe+_0x848f('0x80'),_0x2a377c[_0x848f('0x45')][_0x451ffe]);}}});}if(_0x2a377c[_0x848f('0x45')][_0x848f('0x81')]){if(_0x2a377c[_0x848f('0x45')][_0x848f('0x81')]==0x1){_0x119d97['having'](_0x848f('0x82'));}else{_0x119d97[_0x848f('0x68')](_0x848f('0x83'));}}if(_0x2a377c[_0x848f('0x45')]['tag']){_0x56b359=_[_0x848f('0x84')](_0x2a377c[_0x848f('0x45')][_0x848f('0x85')])?_0x2a377c['query'][_0x848f('0x85')]:new Array(_0x2a377c['query'][_0x848f('0x85')]);_0x56b359[_0x848f('0x35')](function(_0x8538f7){_0x4ad941['or'](_0x848f('0x72'),'%,'+_0x8538f7+',%');});}if(_0x2a377c['query'][_0x848f('0x86')]){var _0x150063=_0x2a377c[_0x848f('0x45')][_0x848f('0x86')][_0x848f('0x87')]('\x5c','\x5c\x5c')[_0x848f('0x87')](/'/g,'\x27\x27');if(qs[_0x848f('0x88')](_0x150063)){_0x57d275['or']('i.id\x20LIKE\x20?',_0x150063+'%')['or'](_0x848f('0x89'),_0x150063+'%');}else{_0x57d275['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x848f('0x6d')](_0x150063))['or'](_0x848f('0x8a'),_0x150063+'%');}}}_0x119d97[_0x848f('0x4f')](_0x57d275);_0x119d97['group']('i.id');var _0x46bc22={'type':db[_0x848f('0x8b')][_0x848f('0x8c')]['SELECT'],'raw':!![]};var _0x19410a=_0x119d97[_0x848f('0x8d')]();_0x19410a[_0x848f('0x53')]('i.id');_0x19410a[_0x848f('0x53')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x5353a3[_0x848f('0x4d')]){_0x5353a3[_0x848f('0x4d')]['forEach'](function(_0x35e924){var _0x9a65bb=_0x35e924[0x0]==='contactName'?_0x35e924[0x0]:'i.'+_0x35e924[0x0];_0x119d97[_0x848f('0x4d')](_0x9a65bb,_0x35e924[0x1]===_0x848f('0x8e')?![]:!![]);});}if(!_[_0x848f('0x79')](_0x56b359)){_0x119d97[_0x848f('0x68')](_0x4ad941);_0x19410a[_0x848f('0x4f')]('t.id\x20IN\x20?',_0x56b359);}BPromise[_0x848f('0x8f')]()['then'](function(){if(!_0x47bf36){if(_0x2a377c['query']['SmsAccountId'])return;_0x19410a['where'](_0x848f('0x90'));_0x119d97[_0x848f('0x4f')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2a377c[_0x848f('0x91')]['role']!==_0x848f('0x92'))return;return _0x2a377c[_0x848f('0x91')][_0x848f('0x93')]({'attributes':['id'],'raw':!![]})[_0x848f('0x29')](function(_0x50fd16){if(_[_0x848f('0x79')](_0x50fd16)){_0x19410a[_0x848f('0x4f')](_0x848f('0x94'));_0x119d97[_0x848f('0x4f')](_0x848f('0x94'));}else{_0x19410a[_0x848f('0x4f')](_0x848f('0x7b'),_[_0x848f('0x3f')](_0x50fd16,'id'));_0x119d97['where']('i.SmsAccountId\x20IN\x20?',_[_0x848f('0x3f')](_0x50fd16,'id'));}});})['then'](function(){if(_0x2a377c[_0x848f('0x91')][_0x848f('0x95')]===_0x848f('0x92')&&!_0x47bf36&&!_0x2a377c[_0x848f('0x45')][_0x848f('0x7a')])return[];return db[_0x848f('0x96')][_0x848f('0x45')](_0x19410a['toString'](),_0x46bc22);})[_0x848f('0x29')](function(_0x141c3b){_0x123afa['count']=_0x141c3b[_0x848f('0x4a')];if(_0x123afa[_0x848f('0x23')]===0x0)return[];return db[_0x848f('0x96')]['query'](_0x3bdd9b[_0x848f('0x97')](),_0x46bc22)['then'](function(_0x32e1cc){_0x161148=_[_0x848f('0x98')](_0x32e1cc,'id');_0x46bc22=_[_0x848f('0x99')](_0x46bc22,{'model':db[_0x848f('0x9a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2a377c[_0x848f('0x45')][_0x848f('0x49')]){_0x5353a3[_0x848f('0x48')][_0x848f('0x35')](function(_0x4500f4){_0x119d97[_0x848f('0x53')]('i.'+_0x4500f4);});}else{_0x119d97['field'](_0x848f('0x9b'),_0x848f('0x9c'));_0x119d97['field'](_0x848f('0x9d'),_0x848f('0x9e'));_0x119d97['field']('a.mandatoryDisposition',_0x848f('0x9f'));_0x119d97['field']('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',_0x848f('0xa0'));_0x119d97[_0x848f('0x53')](_0x848f('0xa1'));_0x119d97[_0x848f('0x53')](_0x848f('0xa2'),_0x848f('0xa3'));_0x119d97[_0x848f('0x53')](_0x848f('0xa4'),_0x848f('0xa5'));_0x119d97[_0x848f('0x53')](_0x848f('0xa6'),_0x848f('0xa7'));_0x119d97[_0x848f('0x53')](_0x848f('0xa8'),_0x848f('0xa9'));_0x119d97[_0x848f('0x53')]('c.mobile',_0x848f('0xaa'));_0x119d97[_0x848f('0x53')](_0x848f('0xab'),_0x848f('0xac'));_0x119d97[_0x848f('0x53')](_0x848f('0xad'),_0x848f('0xae'));_0x119d97['field'](_0x848f('0xaf'),'Owner.internal');_0x119d97['field'](_0x848f('0xb0'),_0x848f('0x32'));}if(_0x5353a3[_0x848f('0x22')])_0x119d97[_0x848f('0x22')](_0x5353a3[_0x848f('0x22')]);if(_0x5353a3[_0x848f('0x20')])_0x119d97[_0x848f('0x20')](_0x5353a3[_0x848f('0x20')]);return db[_0x848f('0x96')]['query'](_0x119d97['toString'](),_0x46bc22);})[_0x848f('0x29')](function(_0x4fe2fb){if(_0x4fe2fb['length']>0x0)_0x52d3ea[_0x848f('0x4f')]('ui.SmsInteractionId\x20IN\x20?',_[_0x848f('0x3f')](_0x4fe2fb,'id'));return db[_0x848f('0x96')][_0x848f('0x45')](_0x52d3ea['toString'](),_0x46bc22)[_0x848f('0x29')](function(_0x2ce905){var _0x3c39d=_['groupBy'](_0x2ce905,'SmsInteractionId');var _0x3680f7=[];_0x4fe2fb[_0x848f('0x35')](function(_0x4d3a76){_0x3680f7['push'](updateSmsInteraction(_0x4d3a76,_0x161148,_0x3c39d));});return BPromise['all'](_0x3680f7);});});})[_0x848f('0x29')](function(_0x58b107){_0x123afa['rows']=_0x58b107;return _0x123afa;})[_0x848f('0x29')](respondWithFilteredResult(_0x53f6cf,_0x5353a3))[_0x848f('0xb1')](handleError(_0x53f6cf,null));};exports[_0x848f('0xb2')]=function(_0xcd11de,_0x300760){var _0x5bc2c5={'raw':![],'where':{'id':_0xcd11de['params']['id']}},_0x23bf69={};_0x23bf69[_0x848f('0x44')]=_[_0x848f('0x46')](db[_0x848f('0x9a')][_0x848f('0x40')]);_0x23bf69[_0x848f('0x45')]=_[_0x848f('0x46')](_0xcd11de[_0x848f('0x45')]);_0x23bf69['filters']=_[_0x848f('0x47')](_0x23bf69[_0x848f('0x44')],_0x23bf69[_0x848f('0x45')]);_0x5bc2c5['attributes']=_[_0x848f('0x47')](_0x23bf69[_0x848f('0x44')],qs['fields'](_0xcd11de['query'][_0x848f('0x49')]));_0x5bc2c5[_0x848f('0x48')]=_0x5bc2c5[_0x848f('0x48')][_0x848f('0x4a')]?_0x5bc2c5[_0x848f('0x48')]:_0x23bf69[_0x848f('0x44')];if(_0xcd11de['query'][_0x848f('0xb3')]){_0x5bc2c5[_0x848f('0xb4')]=[{'all':!![]}];}_0x5bc2c5=_[_0x848f('0x99')]({},_0x5bc2c5,_0xcd11de[_0x848f('0xb5')]);return db[_0x848f('0x9a')][_0x848f('0x66')](_0x5bc2c5)[_0x848f('0x29')](handleEntityNotFound(_0x300760,null))[_0x848f('0x29')](respondWithResult(_0x300760,null))['catch'](handleError(_0x300760,null));};exports[_0x848f('0xb6')]=function(_0x2769d7,_0x284911){return db[_0x848f('0x9a')][_0x848f('0xb6')](_0x2769d7[_0x848f('0x77')],{})[_0x848f('0x29')](respondWithResult(_0x284911,0xc9))['catch'](handleError(_0x284911,null));};exports['update']=function(_0x3a6096,_0x558500){if(_0x3a6096[_0x848f('0x77')]['id']){delete _0x3a6096[_0x848f('0x77')]['id'];}return db['SmsInteraction'][_0x848f('0x66')]({'where':{'id':_0x3a6096[_0x848f('0xb7')]['id']}})[_0x848f('0x29')](handleEntityNotFound(_0x558500,null))['then'](saveUpdates(_0x3a6096[_0x848f('0x77')],null))[_0x848f('0x29')](respondWithResult(_0x558500,null))[_0x848f('0xb1')](handleError(_0x558500,null));};exports[_0x848f('0x2a')]=function(_0xf3c491,_0x59754f){return db[_0x848f('0x9a')][_0x848f('0x66')]({'where':{'id':_0xf3c491[_0x848f('0xb7')]['id']}})[_0x848f('0x29')](handleEntityNotFound(_0x59754f,null))[_0x848f('0x29')](removeEntity(_0x59754f,null))[_0x848f('0xb1')](handleError(_0x59754f,null));};exports['describe']=function(_0x4f162d,_0x2c49fd){return db[_0x848f('0x9a')][_0x848f('0xb8')]()[_0x848f('0x29')](respondWithResult(_0x2c49fd,null))['catch'](handleError(_0x2c49fd,null));};exports[_0x848f('0xb9')]=function(_0x1fa5f8,_0x3038cf,_0x2ec047){return db['SmsMessage'][_0x848f('0x66')]({'where':{'id':_0x1fa5f8['params']['id']}})['then'](handleEntityNotFound(_0x3038cf,null))[_0x848f('0x29')](function(_0x36cc14){if(_0x36cc14){return _0x36cc14[_0x848f('0xb9')](_0x1fa5f8[_0x848f('0x77')][_0x848f('0xba')],_[_0x848f('0xbb')](_0x1fa5f8['body'],[_0x848f('0xba'),'id'])||{});}})['then'](respondWithResult(_0x3038cf,null))[_0x848f('0xb1')](handleError(_0x3038cf,null));};exports[_0x848f('0xbc')]=function(_0xca250e,_0x3ff1fc,_0x2b8097){var _0x328dc9={'raw':![],'where':{}};var _0x4e76eb={};var _0x1c5bdc={'count':0x0,'rows':[]};return db[_0x848f('0x9a')][_0x848f('0xbd')]({'where':{'id':_0xca250e['params']['id']}})[_0x848f('0x29')](handleEntityNotFound(_0x3ff1fc,null))[_0x848f('0x29')](function(_0x549909){if(_0x549909){_0x4e76eb[_0x848f('0x44')]=_['keys'](db[_0x848f('0xbe')][_0x848f('0x40')]);_0x4e76eb[_0x848f('0x45')]=_[_0x848f('0x46')](_0xca250e[_0x848f('0x45')]);_0x4e76eb['filters']=_[_0x848f('0x47')](_0x4e76eb['model'],_0x4e76eb['query']);_0x328dc9[_0x848f('0x48')]=_[_0x848f('0x47')](_0x4e76eb[_0x848f('0x44')],qs[_0x848f('0x49')](_0xca250e[_0x848f('0x45')][_0x848f('0x49')]));_0x328dc9['attributes']=_0x328dc9[_0x848f('0x48')][_0x848f('0x4a')]?_0x328dc9[_0x848f('0x48')]:_0x4e76eb[_0x848f('0x44')];if(!_0xca250e[_0x848f('0x45')][_0x848f('0x4b')](_0x848f('0x4c'))){_0x328dc9[_0x848f('0x22')]=qs[_0x848f('0x22')](_0xca250e[_0x848f('0x45')][_0x848f('0x22')]);_0x328dc9[_0x848f('0x20')]=qs[_0x848f('0x20')](_0xca250e[_0x848f('0x45')][_0x848f('0x20')]);}_0x328dc9[_0x848f('0x4d')]=qs[_0x848f('0x4e')](_0xca250e[_0x848f('0x45')]['sort']);_0x328dc9[_0x848f('0x4f')]=qs['filters'](_['pick'](_0xca250e[_0x848f('0x45')],_0x4e76eb['filters']));_0x328dc9['where'][_0x848f('0xbf')]=_0x549909['id'];if(_0xca250e[_0x848f('0x45')][_0x848f('0x86')]){_0x328dc9['where']=_[_0x848f('0x99')](_0x328dc9[_0x848f('0x4f')],{'$or':_['map'](_0x328dc9[_0x848f('0x48')],function(_0x1e5138){var _0x2cdaa3={};_0x2cdaa3[_0x1e5138]={'$like':'%'+_0xca250e['query'][_0x848f('0x86')]+'%'};return _0x2cdaa3;})});}if(_0xca250e['query'][_0x848f('0xc0')]){var _0x3edd07=_0xca250e[_0x848f('0x45')][_0x848f('0xc0')][_0x848f('0x34')](',');var _0xe54a97={};_0xe54a97[_0x3edd07[0x0]]={'$gte':moment(_0x3edd07[0x1])[_0x848f('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x328dc9[_0x848f('0x4f')]=_[_0x848f('0x99')](_0x328dc9[_0x848f('0x4f')],_0xe54a97);}_0x328dc9=_['merge']({},_0x328dc9,_0xca250e[_0x848f('0xb5')]);return db[_0x848f('0xbe')][_0x848f('0x23')]({'where':_0x328dc9[_0x848f('0x4f')]})[_0x848f('0x29')](function(_0x12bf39){_0x1c5bdc[_0x848f('0x23')]=_0x12bf39;if(_0xca250e['query'][_0x848f('0xb3')]){_0x328dc9[_0x848f('0xb4')]=[{'all':!![]}];}return db[_0x848f('0xbe')]['findAll'](_0x328dc9);})[_0x848f('0x29')](function(_0x2d50d5){_0x1c5bdc[_0x848f('0xc2')]=_0x2d50d5;return _0x1c5bdc;});}})[_0x848f('0x29')](respondWithFilteredResult(_0x3ff1fc,_0x328dc9))['catch'](handleError(_0x3ff1fc,null));};exports[_0x848f('0xc3')]=function(_0x4705dd,_0x171391,_0x3de816){return db[_0x848f('0x9a')][_0x848f('0x66')]({'where':{'id':_0x4705dd[_0x848f('0xb7')]['id']}})[_0x848f('0x29')](handleEntityNotFound(_0x171391,null))[_0x848f('0x29')](function(_0x30dae5){if(_0x30dae5){return _0x30dae5[_0x848f('0xc4')](_0x4705dd[_0x848f('0x77')]['ids'],_[_0x848f('0xbb')](_0x4705dd['body'],['ids','id'])||{})[_0x848f('0xc5')](function(){return db['Tag'][_0x848f('0xc6')]({'attributes':['id','name','color'],'where':{'id':_0x4705dd['body']['ids']}});})['then'](function(_0x1a67ac){socket['emit'](_0x848f('0xc7'),{'id':Number(_0x4705dd[_0x848f('0xb7')]['id']),'tags':_0x1a67ac||[]});return{'id':Number(_0x4705dd[_0x848f('0xb7')]['id']),'tags':_0x1a67ac||[]};});}})[_0x848f('0x29')](respondWithResult(_0x171391,null))['catch'](handleError(_0x171391,null));};exports['removeTags']=function(_0x3de106,_0x27d0f6,_0x18173f){return db[_0x848f('0x9a')][_0x848f('0x66')]({'where':{'id':_0x3de106['params']['id']}})[_0x848f('0x29')](handleEntityNotFound(_0x27d0f6,null))[_0x848f('0x29')](function(_0x56618d){if(_0x56618d){return _0x56618d['removeTags'](_0x3de106['query']['ids']);}})[_0x848f('0x29')](respondWithStatusCode(_0x27d0f6,null))['catch'](handleError(_0x27d0f6,null));};exports[_0x848f('0xc8')]=function(_0x4b91b5,_0x140725){var _0x1df58f=moment()[_0x848f('0xc9')]()[_0x848f('0x97')]();var _0x51d4b1=path[_0x848f('0xca')](config[_0x848f('0xcb')],_0x848f('0xcc'),'files',_0x848f('0xcd'));var _0x295e81=path[_0x848f('0xca')](config['root'],_0x848f('0xcc'),_0x848f('0xce'),'attachments');var _0x35a93f=path['join'](_0x51d4b1,_0x1df58f);var _0x134e41=util[_0x848f('0xc1')]('transcript-%d-%s.zip',_0x4b91b5[_0x848f('0xb7')]['id'],_0x1df58f);var _0x4543b6=path[_0x848f('0xca')](_0x51d4b1,_0x134e41);var _0x307f38=[];_0x307f38[_0x848f('0x36')]({'model':db['User'],'as':_0x848f('0x74'),'attributes':['id',_0x848f('0x31')],'raw':!![]});_0x307f38[_0x848f('0x36')]({'model':db[_0x848f('0xcf')],'as':'Contact','attributes':['id',_0x848f('0xd0'),'lastName'],'raw':!![]});var _0x304186=[{'model':db[_0x848f('0xbe')],'as':_0x848f('0xd1'),'attributes':['id',_0x848f('0x77'),_0x848f('0x7d'),_0x848f('0xd2'),_0x848f('0xd3'),_0x848f('0x81')],'include':_0x307f38}];_0x304186['push']({'model':db[_0x848f('0xd4')],'as':_0x848f('0xd5'),'attributes':['id',_0x848f('0x2f')]});_0x304186[_0x848f('0x36')]({'model':db[_0x848f('0x74')],'as':'Owner','attributes':['id',_0x848f('0x31')]});return db['SmsInteraction'][_0x848f('0x66')]({'where':{'id':_0x4b91b5['params']['id']},'include':_0x304186})[_0x848f('0x29')](handleEntityNotFound(_0x140725,null))[_0x848f('0x29')](function(_0x2e855f){if(_0x2e855f){var _0x326cef=_0x2e855f[_0x848f('0xd6')]({'plain':!![]});fs[_0x848f('0xd7')](_0x35a93f);var _0x8917e9={'channel':_0x848f('0xd8'),'account':_0x326cef[_0x848f('0xd5')][_0x848f('0x2f')],'agent':_0x326cef[_0x848f('0xd9')]?_0x326cef[_0x848f('0xd9')][_0x848f('0x31')]:'N.A.','createdAt':moment(_0x326cef['createdAt'])[_0x848f('0xc1')](_0x848f('0xda'))['toString'](),'closedAt':_0x326cef[_0x848f('0x3d')]?moment(_0x326cef[_0x848f('0xdb')])[_0x848f('0xc1')](_0x848f('0xda'))[_0x848f('0x97')]():'','disposition':_0x326cef[_0x848f('0xdc')],'messages':_(_0x326cef[_0x848f('0xd1')])[_0x848f('0x86')]({'secret':![]})[_0x848f('0x3f')](function(_0x1a5e59){return{'date':moment(_0x1a5e59[_0x848f('0x7d')])['format'](_0x848f('0xda'))[_0x848f('0x97')](),'sender':_0x1a5e59[_0x848f('0xd2')]===_0x848f('0xdd')?_0x1a5e59[_0x848f('0x74')]?_0x1a5e59[_0x848f('0x74')][_0x848f('0x31')]:_0x848f('0xde'):_0x1a5e59[_0x848f('0xdf')][_0x848f('0xd0')]+(_0x1a5e59[_0x848f('0xdf')][_0x848f('0xe0')]?'\x20'+_0x1a5e59['Contact'][_0x848f('0xe0')]:''),'body':_0x1a5e59[_0x848f('0x77')],'direction':_0x1a5e59[_0x848f('0xd2')]===_0x848f('0xdd')?'A':'C','secret':_0x1a5e59[_0x848f('0xd3')],'read':_0x1a5e59[_0x848f('0x81')]};})[_0x848f('0x67')]()};return ejs[_0x848f('0xe1')](path[_0x848f('0xca')](config['root'],_0x848f('0xcc'),_0x848f('0xe2'),_0x848f('0xe3')),{'interaction':_0x8917e9})[_0x848f('0x29')](function(_0x9edf2){var _0xb52d2f=path[_0x848f('0xca')](_0x35a93f,_0x848f('0xe4')+_0x326cef['id']+'-'+_0x1df58f+_0x848f('0xe5'));var _0x12ffd8={'path':_0xb52d2f,'channel':_0x848f('0xd8'),'interactionId':_0x326cef['id']};return pdf[_0x848f('0xe6')](_0x9edf2,_0x12ffd8);})[_0x848f('0x29')](function(){return new BPromise(function(_0x343026,_0x4ac272){zipdir(_0x35a93f,{'saveTo':_0x4543b6},function(_0x838aa,_0x2eac9f){if(_0x838aa)return _0x4ac272(_0x838aa);return _0x343026(_0x2eac9f);});})[_0x848f('0x29')](function(){return new BPromise(function(_0x3f15d7,_0x48b861){rimraf(_0x35a93f,function(_0x41d929){if(_0x41d929)_0x48b861(_0x41d929);return _0x3f15d7();});});})[_0x848f('0x29')](function(){return _0x140725[_0x848f('0xc8')](_0x4543b6,_0x134e41,function(_0x1bdabb){if(_0x1bdabb){console[_0x848f('0xe7')](_0x848f('0xe8'),_0x1bdabb);}else{fs['unlinkSync'](_0x4543b6);}});});});}else{return _0x140725['sendStatus'](0xc8);}})['catch'](handleError(_0x140725,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index c345e5c..710cc64 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 _0x5fdc=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','map'];(function(_0x3348e3,_0x417874){var _0x2a6cc8=function(_0xda9c45){while(--_0xda9c45){_0x3348e3['push'](_0x3348e3['shift']());}};_0x2a6cc8(++_0x417874);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3990df,_0x4042ab){_0x3990df=_0x3990df-0x0;var _0x1b7009=_0x5fdc[_0x3990df];return _0x1b7009;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var SmsInteraction=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var SmsMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc5fd('0x4')](0x0);var events={'afterCreate':_0xc5fd('0x5'),'afterUpdate':_0xc5fd('0x6'),'afterDestroy':_0xc5fd('0x7')};function emitEvent(_0x1b6205){return function(_0xca27a0,_0xea5748,_0x44722b){_0xca27a0[_0xc5fd('0x8')]({'attributes':['id'],'raw':!![]})[_0xc5fd('0x9')](function(_0x5a2eb4){_0xca27a0['setDataValue']('Users',_0x5a2eb4[_0xc5fd('0xa')](function(_0x46bce3){return{'id':_0x46bce3['id']};}));return SmsMessage[_0xc5fd('0xb')]({'where':{'SmsInteractionId':_0xca27a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5fd('0x9')](function(_0x4e6d35){_0xca27a0['setDataValue'](_0xc5fd('0xc'),_0x4e6d35[_0xc5fd('0xd')]);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205+':'+_0xca27a0['id'],_0xca27a0);SmsInteractionEvents[_0xc5fd('0xe')](_0x1b6205,_0xca27a0);_0x44722b(null);})[_0xc5fd('0xf')](_0x44722b(null));};}for(var e in events){if(events[_0xc5fd('0x10')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xc5fd('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x6a55=['setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','SmsMessage','update','getUsers','then'];(function(_0x3586ca,_0x5c96d7){var _0x25cf10=function(_0x2d34bf){while(--_0x2d34bf){_0x3586ca['push'](_0x3586ca['shift']());}};_0x25cf10(++_0x5c96d7);}(_0x6a55,0xdb));var _0x56a5=function(_0x514bd1,_0x25ea3e){_0x514bd1=_0x514bd1-0x0;var _0x58a281=_0x6a55[_0x514bd1];return _0x58a281;};'use strict';var EventEmitter=require(_0x56a5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0x56a5('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x56a5('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3ff76a){return function(_0x5171fa,_0x28bb2b,_0x380b1b){_0x5171fa[_0x56a5('0x3')]({'attributes':['id'],'raw':!![]})[_0x56a5('0x4')](function(_0x444c65){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x6'),_0x444c65[_0x56a5('0x7')](function(_0x586f7a){return{'id':_0x586f7a['id']};}));return SmsMessage[_0x56a5('0x8')]({'where':{'SmsInteractionId':_0x5171fa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56a5('0x4')](function(_0x3c8283){_0x5171fa[_0x56a5('0x5')](_0x56a5('0x9'),_0x3c8283[_0x56a5('0xa')]);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a+':'+_0x5171fa['id'],_0x5171fa);SmsInteractionEvents[_0x56a5('0xb')](_0x3ff76a,_0x5171fa);_0x380b1b(null);})[_0x56a5('0xc')](_0x380b1b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x56a5('0xd')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b5dfe17..672839d 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 _0x176f=['bluebird','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','closedAt','format','lodash','util','../../config/logger','api','moment'];(function(_0x193d73,_0x33bd5f){var _0x419492=function(_0x241d6c){while(--_0x241d6c){_0x193d73['push'](_0x193d73['shift']());}};_0x419492(++_0x33bd5f);}(_0x176f,0x19f));var _0xf176=function(_0x16e03e,_0x4abf6a){_0x16e03e=_0x16e03e-0x0;var _0x5eaabc=_0x176f[_0x16e03e];return _0x5eaabc;};'use strict';var _=require(_0xf176('0x0'));var util=require(_0xf176('0x1'));var logger=require(_0xf176('0x2'))(_0xf176('0x3'));var moment=require(_0xf176('0x4'));var BPromise=require(_0xf176('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf176('0x6'));var config=require(_0xf176('0x7'));var attributes=require(_0xf176('0x8'));module[_0xf176('0x9')]=function(_0x4021ac,_0x276f39){return _0x4021ac['define'](_0xf176('0xa'),attributes,{'tableName':_0xf176('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3a6e52,_0x335483,_0x4e729c){if(_0x3a6e52[_0xf176('0xc')]('closed')){_0x3a6e52[_0xf176('0xd')]=moment()[_0xf176('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4e729c(null,_0x3a6e52);}}});}; \ No newline at end of file +var _0x307f=['rimraf','../../config/environment','./smsInteraction.attributes','exports','closed','closedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x24ba26,_0x47a285){var _0x1dfe90=function(_0xff0998){while(--_0xff0998){_0x24ba26['push'](_0x24ba26['shift']());}};_0x1dfe90(++_0x47a285);}(_0x307f,0x13b));var _0xf307=function(_0x10cdde,_0x2279f5){_0x10cdde=_0x10cdde-0x0;var _0x4ccd60=_0x307f[_0x10cdde];return _0x4ccd60;};'use strict';var _=require(_0xf307('0x0'));var util=require(_0xf307('0x1'));var logger=require(_0xf307('0x2'))(_0xf307('0x3'));var moment=require(_0xf307('0x4'));var BPromise=require(_0xf307('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf307('0x6'));var rimraf=require(_0xf307('0x7'));var config=require(_0xf307('0x8'));var attributes=require(_0xf307('0x9'));module[_0xf307('0xa')]=function(_0x8e5100,_0x5dc8eb){return _0x8e5100['define']('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1556ec,_0x322456,_0xdd8e47){if(_0x1556ec['changed'](_0xf307('0xb'))){_0x1556ec[_0xf307('0xc')]=moment()[_0xf307('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0xdd8e47(null,_0x1556ec);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 069b85c..6bbf29c 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 _0x2a74=['../../config/environment','jayson/promise','client','redis','localhost','register','request','then','debug','request\x20sent','error','SmsInteraction,\x20%s,\x20%s','message','info','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','stringify','SmsInteraction','find','body','omit','ids','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x2f0313,_0x5c5f7c){var _0x26335d=function(_0x2e6de6){while(--_0x2e6de6){_0x2f0313['push'](_0x2f0313['shift']());}};_0x26335d(++_0x5c5f7c);}(_0x2a74,0x1aa));var _0x42a7=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x2a74[_0x87239];return _0x53af1e;};'use strict';var _=require(_0x42a7('0x0'));var util=require(_0x42a7('0x1'));var moment=require(_0x42a7('0x2'));var BPromise=require('bluebird');var rs=require(_0x42a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42a7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x42a7('0x5'))('rpc');var config=require(_0x42a7('0x6'));var jayson=require(_0x42a7('0x7'));var client=jayson[_0x42a7('0x8')]['http']({'port':0x232a});config[_0x42a7('0x9')]=_['defaults'](config[_0x42a7('0x9')],{'host':_0x42a7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42a7('0x9')]));require('./smsInteraction.socket')[_0x42a7('0xb')](socket);function respondWithRpcPromise(_0xf7dbbc,_0x3efd2e,_0x89465){return new BPromise(function(_0x1f2c0b,_0x2d3aa0){return client[_0x42a7('0xc')](_0xf7dbbc,_0x89465)[_0x42a7('0xd')](function(_0x2dfb9e){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x3efd2e,'request\x20sent');logger[_0x42a7('0xe')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x3efd2e,_0x42a7('0xf'),JSON['stringify'](_0x2dfb9e));if(_0x2dfb9e[_0x42a7('0x10')]){if(_0x2dfb9e[_0x42a7('0x10')]['code']===0x1f4){logger[_0x42a7('0x10')](_0x42a7('0x11'),_0x3efd2e,_0x2dfb9e[_0x42a7('0x10')][_0x42a7('0x12')]);return _0x2d3aa0(_0x2dfb9e[_0x42a7('0x10')]['message']);}logger['error'](_0x42a7('0x11'),_0x3efd2e,_0x2dfb9e[_0x42a7('0x10')]['message']);return _0x1f2c0b(_0x2dfb9e[_0x42a7('0x10')][_0x42a7('0x12')]);}else{logger[_0x42a7('0x13')](_0x42a7('0x11'),_0x3efd2e,_0x42a7('0xf'));_0x1f2c0b(_0x2dfb9e['result'][_0x42a7('0x12')]);}})[_0x42a7('0x14')](function(_0x5d3055){logger[_0x42a7('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x3efd2e,_0x5d3055);_0x2d3aa0(_0x5d3055);});});}exports[_0x42a7('0x15')]=function(_0x223002){var _0x4c6e13=this;return new Promise(function(_0x21ecf9,_0x47f8ba){return db['SmsInteraction'][_0x42a7('0x16')](_0x223002['body'],{'raw':_0x223002[_0x42a7('0x17')]?_0x223002['options'][_0x42a7('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x223002[_0x42a7('0x17')]?_0x223002[_0x42a7('0x17')][_0x42a7('0x19')]||null:null,'attributes':_0x223002[_0x42a7('0x17')]?_0x223002['options'][_0x42a7('0x1a')]||null:null,'limit':_0x223002[_0x42a7('0x17')]?_0x223002[_0x42a7('0x17')][_0x42a7('0x1b')]||null:null})[_0x42a7('0xd')](function(_0x4d3c0a){logger[_0x42a7('0x13')](_0x42a7('0x15'),_0x223002);logger[_0x42a7('0xe')]('UpdateSmsInteraction',_0x223002,JSON[_0x42a7('0x1c')](_0x4d3c0a));_0x21ecf9(_0x4d3c0a);})['catch'](function(_0x11f77f){logger[_0x42a7('0x10')](_0x42a7('0x15'),_0x11f77f[_0x42a7('0x12')],_0x223002);_0x47f8ba(_0x4c6e13['error'](0x1f4,_0x11f77f[_0x42a7('0x12')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3f59d3){return new Promise(function(_0x30450a,_0x14f8a0){return db[_0x42a7('0x1d')][_0x42a7('0x1e')]({'where':_0x3f59d3['options']?_0x3f59d3[_0x42a7('0x17')]['where']||null:null})[_0x42a7('0xd')](function(_0x4e538f){if(_0x4e538f){return _0x4e538f['addTags'](_0x3f59d3[_0x42a7('0x1f')]['ids'],_[_0x42a7('0x20')](_0x3f59d3['body'],[_0x42a7('0x21'),'id'])||{});}})[_0x42a7('0x22')](function(_0x393ae7){logger['info'](_0x42a7('0x23'),_0x3f59d3);logger[_0x42a7('0xe')](_0x42a7('0x23'),_0x3f59d3,JSON[_0x42a7('0x1c')](_0x393ae7));_0x30450a(_0x393ae7);})[_0x42a7('0x14')](function(_0x340ed7){logger['error'](_0x42a7('0x23'),_0x340ed7[_0x42a7('0x12')],_0x3f59d3);_0x14f8a0(_this[_0x42a7('0x10')](0x1f4,_0x340ed7[_0x42a7('0x12')]));});});}; \ No newline at end of file +var _0x5de7=['debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./smsInteraction.socket','register','request','then','info','request\x20sent'];(function(_0x400b6c,_0x4a6139){var _0x4c4e3e=function(_0x191233){while(--_0x191233){_0x400b6c['push'](_0x400b6c['shift']());}};_0x4c4e3e(++_0x4a6139);}(_0x5de7,0x13b));var _0x75de=function(_0x436723,_0x8de251){_0x436723=_0x436723-0x0;var _0x3f245d=_0x5de7[_0x436723];return _0x3f245d;};'use strict';var _=require(_0x75de('0x0'));var util=require(_0x75de('0x1'));var moment=require(_0x75de('0x2'));var BPromise=require(_0x75de('0x3'));var rs=require(_0x75de('0x4'));var fs=require('fs');var Redis=require(_0x75de('0x5'));var db=require(_0x75de('0x6'))['db'];var utils=require(_0x75de('0x7'));var logger=require(_0x75de('0x8'))(_0x75de('0x9'));var config=require(_0x75de('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x75de('0xb')][_0x75de('0xc')]({'port':0x232a});config[_0x75de('0xd')]=_[_0x75de('0xe')](config[_0x75de('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x75de('0xf'))[_0x75de('0x10')](socket);function respondWithRpcPromise(_0x2417ae,_0x44be8b,_0x13406d){return new BPromise(function(_0xa28032,_0x12b9da){return client[_0x75de('0x11')](_0x2417ae,_0x13406d)[_0x75de('0x12')](function(_0x2be2af){logger[_0x75de('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x44be8b,_0x75de('0x14'));logger[_0x75de('0x15')](_0x75de('0x16'),_0x44be8b,_0x75de('0x14'),JSON[_0x75de('0x17')](_0x2be2af));if(_0x2be2af[_0x75de('0x18')]){if(_0x2be2af[_0x75de('0x18')][_0x75de('0x19')]===0x1f4){logger[_0x75de('0x18')](_0x75de('0x1a'),_0x44be8b,_0x2be2af[_0x75de('0x18')]['message']);return _0x12b9da(_0x2be2af[_0x75de('0x18')][_0x75de('0x1b')]);}logger[_0x75de('0x18')](_0x75de('0x1a'),_0x44be8b,_0x2be2af[_0x75de('0x18')][_0x75de('0x1b')]);return _0xa28032(_0x2be2af[_0x75de('0x18')]['message']);}else{logger['info'](_0x75de('0x1a'),_0x44be8b,'request\x20sent');_0xa28032(_0x2be2af['result'][_0x75de('0x1b')]);}})[_0x75de('0x1c')](function(_0x4a9d7){logger[_0x75de('0x18')]('SmsInteraction,\x20%s,\x20%s',_0x44be8b,_0x4a9d7);_0x12b9da(_0x4a9d7);});});}exports[_0x75de('0x1d')]=function(_0x5e00fd){var _0x42b2ab=this;return new Promise(function(_0x268324,_0xea1ada){return db[_0x75de('0x1e')][_0x75de('0x1f')](_0x5e00fd[_0x75de('0x20')],{'raw':_0x5e00fd[_0x75de('0x21')]?_0x5e00fd[_0x75de('0x21')][_0x75de('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e00fd[_0x75de('0x21')]?_0x5e00fd['options'][_0x75de('0x23')]||null:null,'attributes':_0x5e00fd[_0x75de('0x21')]?_0x5e00fd[_0x75de('0x21')][_0x75de('0x24')]||null:null,'limit':_0x5e00fd[_0x75de('0x21')]?_0x5e00fd[_0x75de('0x21')][_0x75de('0x25')]||null:null})['then'](function(_0x23dbf6){logger['info']('UpdateSmsInteraction',_0x5e00fd);logger['debug'](_0x75de('0x1d'),_0x5e00fd,JSON[_0x75de('0x17')](_0x23dbf6));_0x268324(_0x23dbf6);})[_0x75de('0x1c')](function(_0x4089ae){logger[_0x75de('0x18')](_0x75de('0x1d'),_0x4089ae[_0x75de('0x1b')],_0x5e00fd);_0xea1ada(_0x42b2ab[_0x75de('0x18')](0x1f4,_0x4089ae[_0x75de('0x1b')]));});});};exports[_0x75de('0x26')]=function(_0x32cbe5){return new Promise(function(_0x5e47c2,_0x2a9b2f){return db[_0x75de('0x1e')][_0x75de('0x27')]({'where':_0x32cbe5[_0x75de('0x21')]?_0x32cbe5['options']['where']||null:null})[_0x75de('0x12')](function(_0x2bfc6d){if(_0x2bfc6d){return _0x2bfc6d['addTags'](_0x32cbe5['body'][_0x75de('0x28')],_['omit'](_0x32cbe5['body'],[_0x75de('0x28'),'id'])||{});}})['spread'](function(_0xd2f766){logger['info'](_0x75de('0x29'),_0x32cbe5);logger[_0x75de('0x15')](_0x75de('0x29'),_0x32cbe5,JSON[_0x75de('0x17')](_0xd2f766));_0x5e47c2(_0xd2f766);})['catch'](function(_0x2e7523){logger[_0x75de('0x18')](_0x75de('0x29'),_0x2e7523[_0x75de('0x1b')],_0x32cbe5);_0x2a9b2f(_this[_0x75de('0x18')](0x1f4,_0x2e7523[_0x75de('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 30d1686..2c9cea1 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 _0x4240=['removeListener','length','smsInteraction:','./smsInteraction.events','save','remove','update','emit'];(function(_0x192e32,_0xfba496){var _0x2c4e8e=function(_0x46372a){while(--_0x46372a){_0x192e32['push'](_0x192e32['shift']());}};_0x2c4e8e(++_0xfba496);}(_0x4240,0xa3));var _0x0424=function(_0xdb6228,_0x370bd2){_0xdb6228=_0xdb6228-0x0;var _0x7d09b1=_0x4240[_0xdb6228];return _0x7d09b1;};'use strict';var SmsInteractionEvents=require(_0x0424('0x0'));var events=[_0x0424('0x1'),_0x0424('0x2'),_0x0424('0x3')];function createListener(_0x209883,_0x4f7b56){return function(_0x378e96){_0x4f7b56[_0x0424('0x4')](_0x209883,_0x378e96);};}function removeListener(_0x39d284,_0x430cb8){return function(){SmsInteractionEvents[_0x0424('0x5')](_0x39d284,_0x430cb8);};}exports['register']=function(_0x92c06b){for(var _0x1733a8=0x0,_0x6100bb=events[_0x0424('0x6')];_0x1733a8<_0x6100bb;_0x1733a8++){var _0x2db400=events[_0x1733a8];var _0xae4dc5=createListener(_0x0424('0x7')+_0x2db400,_0x92c06b);SmsInteractionEvents['on'](_0x2db400,_0xae4dc5);}}; \ No newline at end of file +var _0xd1fe=['register','length','smsInteraction:','./smsInteraction.events','remove','update','emit','removeListener'];(function(_0x2f3930,_0x256162){var _0x1bad15=function(_0x491cd6){while(--_0x491cd6){_0x2f3930['push'](_0x2f3930['shift']());}};_0x1bad15(++_0x256162);}(_0xd1fe,0x1d3));var _0xed1f=function(_0x5a9f48,_0x21bbf5){_0x5a9f48=_0x5a9f48-0x0;var _0x5f5511=_0xd1fe[_0x5a9f48];return _0x5f5511;};'use strict';var SmsInteractionEvents=require(_0xed1f('0x0'));var events=['save',_0xed1f('0x1'),_0xed1f('0x2')];function createListener(_0x564c79,_0x5c63d4){return function(_0x1a3cb8){_0x5c63d4[_0xed1f('0x3')](_0x564c79,_0x1a3cb8);};}function removeListener(_0x51f069,_0x42e8a3){return function(){SmsInteractionEvents[_0xed1f('0x4')](_0x51f069,_0x42e8a3);};}exports[_0xed1f('0x5')]=function(_0x586b91){for(var _0x1fea79=0x0,_0x56f03c=events[_0xed1f('0x6')];_0x1fea79<_0x56f03c;_0x1fea79++){var _0x5b14a4=events[_0x1fea79];var _0x280e3a=createListener(_0xed1f('0x7')+_0x5b14a4,_0x586b91);SmsInteractionEvents['on'](_0x5b14a4,_0x280e3a);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c97554d..aa4ea27 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 _0xd138=['describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','fs-extra','../../config/environment','/describe','isAuthenticated'];(function(_0x1bd91c,_0x285e72){var _0x3bc43c=function(_0x5801c4){while(--_0x5801c4){_0x1bd91c['push'](_0x1bd91c['shift']());}};_0x3bc43c(++_0x285e72);}(_0xd138,0x1dc));var _0x8d13=function(_0x2ccd8d,_0x37b851){_0x2ccd8d=_0x2ccd8d-0x0;var _0x4af358=_0xd138[_0x2ccd8d];return _0x4af358;};'use strict';var multer=require(_0x8d13('0x0'));var util=require(_0x8d13('0x1'));var path=require(_0x8d13('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8d13('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d13('0x4'));var controller=require('./smsMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x8d13('0x5'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x7')]);router['get'](_0x8d13('0x8'),auth['isAuthenticated'](),controller[_0x8d13('0x9')]);router[_0x8d13('0xa')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x8d13('0xb'),_0x8d13('0xc')),controller[_0x8d13('0xd')]);router['post'](_0x8d13('0xe'),controller[_0x8d13('0xf')]);router[_0x8d13('0x10')]('/:id',auth[_0x8d13('0x6')](),controller[_0x8d13('0x11')]);router[_0x8d13('0x10')](_0x8d13('0x12'),auth[_0x8d13('0x6')](),controller[_0x8d13('0x13')]);router[_0x8d13('0x10')](_0x8d13('0x14'),auth[_0x8d13('0x6')](),controller['reject']);router[_0x8d13('0x15')]('/:id',auth[_0x8d13('0x6')](),controller[_0x8d13('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe4ce=['describe','/:id','show','post','sms','create','status','put','update','/:id/accept','exports','util','path','connect-timeout','express','../../components/auth/service','./smsMessage.controller','get','index','/describe','isAuthenticated'];(function(_0x40c043,_0x1d064e){var _0x5c2c8d=function(_0xab4403){while(--_0xab4403){_0x40c043['push'](_0x40c043['shift']());}};_0x5c2c8d(++_0x1d064e);}(_0xe4ce,0x131));var _0xee4c=function(_0x41316a,_0x4ba90c){_0x41316a=_0x41316a-0x0;var _0x4005d6=_0xe4ce[_0x41316a];return _0x4005d6;};'use strict';var multer=require('multer');var util=require(_0xee4c('0x0'));var path=require(_0xee4c('0x1'));var timeout=require(_0xee4c('0x2'));var express=require(_0xee4c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xee4c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xee4c('0x5'));router[_0xee4c('0x6')]('/',auth['isAuthenticated'](),controller[_0xee4c('0x7')]);router[_0xee4c('0x6')](_0xee4c('0x8'),auth[_0xee4c('0x9')](),controller[_0xee4c('0xa')]);router[_0xee4c('0x6')](_0xee4c('0xb'),auth[_0xee4c('0x9')](),controller[_0xee4c('0xc')]);router[_0xee4c('0xd')]('/',auth[_0xee4c('0x9')](),interaction['tracked'](_0xee4c('0xe'),'smsmessage:create'),controller[_0xee4c('0xf')]);router[_0xee4c('0xd')]('/:id/status',controller[_0xee4c('0x10')]);router[_0xee4c('0x11')](_0xee4c('0xb'),auth[_0xee4c('0x9')](),controller[_0xee4c('0x12')]);router['put'](_0xee4c('0x13'),auth[_0xee4c('0x9')](),controller['accept']);router[_0xee4c('0x11')]('/:id/reject',auth[_0xee4c('0x9')](),controller['reject']);router['delete'](_0xee4c('0xb'),auth[_0xee4c('0x9')](),controller['destroy']);module[_0xee4c('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5154255..48b03d2 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 _0x9e0c=['ENUM','out','STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x21e403,_0x40136e){var _0x329250=function(_0xcd456){while(--_0xcd456){_0x21e403['push'](_0x21e403['shift']());}};_0x329250(++_0x40136e);}(_0x9e0c,0xfc));var _0xc9e0=function(_0x2ebdea,_0x1f450a){_0x2ebdea=_0x2ebdea-0x0;var _0x31e1c0=_0x9e0c[_0x2ebdea];return _0x31e1c0;};'use strict';var Sequelize=require('sequelize');module[_0xc9e0('0x0')]={'body':{'type':Sequelize[_0xc9e0('0x1')](_0xc9e0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc9e0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc9e0('0x4')]('in',_0xc9e0('0x5')),'defaultValue':_0xc9e0('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc9e0('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xc9e0('0x7')]},'secret':{'type':Sequelize[_0xc9e0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc9e0('0x6')]},'providerResponse':{'type':Sequelize[_0xc9e0('0x1')]}}; \ No newline at end of file +var _0xf1d5=['TEXT','BOOLEAN','out','STRING','sequelize'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0xf1d5,0x1e9));var _0x5f1d=function(_0x4a970a,_0x1ab5b3){_0x4a970a=_0x4a970a-0x0;var _0xb14cc=_0xf1d5[_0x4a970a];return _0xb14cc;};'use strict';var Sequelize=require(_0x5f1d('0x0'));module['exports']={'body':{'type':Sequelize[_0x5f1d('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5f1d('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5f1d('0x3')),'defaultValue':_0x5f1d('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5f1d('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x5f1d('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5f1d('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e7a294c..9f6a614 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 _0xc0a4=['format','YYYY-MM-DD\x20HH:mm:ss','interaction','user','null','AcceptMessage','acceptMessage','sequelize','Sequelize','QueryTypes','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','SELECT','User','interface','rejectmessage','SmsAccountId','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','results','groupName','DELIVERED','infobip','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','merge','SmsMessage','includeAll','include','findAll','rows','show','params','options','create','body','find','destroy','describe','accept','sms','read','readAt','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xc0a4,0xc6));var _0x4c0a=function(_0x85e47c,_0x59498b){_0x85e47c=_0x85e47c-0x0;var _0x212012=_0xc0a4[_0x85e47c];return _0x212012;};'use strict';var emlformat=require(_0x4c0a('0x0'));var rimraf=require(_0x4c0a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4c0a('0x2'));var rp=require('request-promise');var moment=require(_0x4c0a('0x3'));var BPromise=require(_0x4c0a('0x4'));var Mustache=require(_0x4c0a('0x5'));var util=require(_0x4c0a('0x6'));var path=require(_0x4c0a('0x7'));var sox=require(_0x4c0a('0x8'));var csv=require(_0x4c0a('0x9'));var ejs=require(_0x4c0a('0xa'));var fs=require('fs');var fs_extra=require(_0x4c0a('0xb'));var _=require(_0x4c0a('0xc'));var squel=require('squel');var crypto=require(_0x4c0a('0xd'));var jsforce=require(_0x4c0a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c0a('0x9'));var querystring=require(_0x4c0a('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c0a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4c0a('0x11'));var as=require(_0x4c0a('0x12'));var hardwareService=require(_0x4c0a('0x13'));var logger=require(_0x4c0a('0x14'))(_0x4c0a('0x15'));var utils=require(_0x4c0a('0x16'));var config=require(_0x4c0a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4c0a('0x18'))['db'];config[_0x4c0a('0x19')]=_['defaults'](config[_0x4c0a('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c0a('0x1a'))[_0x4c0a('0x1b')](socket);var jayson=require(_0x4c0a('0x1c'));var client=jayson[_0x4c0a('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x4c0a('0x1d')][_0x4c0a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5117ee,_0x1cea0c,_0x546736,_0x42d755){return new BPromise(function(_0x60e374,_0x5d3ea0){var _0x31e8cf=_0x42d755||client;return _0x31e8cf[_0x4c0a('0x1f')](_0x5117ee,_0x546736)['then'](function(_0x171409){logger[_0x4c0a('0x20')](_0x4c0a('0x21'),_0x1cea0c,'request\x20sent');logger[_0x4c0a('0x22')](_0x4c0a('0x23'),_0x1cea0c,_0x4c0a('0x24'),JSON[_0x4c0a('0x25')](_0x171409));if(_0x171409[_0x4c0a('0x26')]){if(_0x171409['error'][_0x4c0a('0x27')]===0x1f4){logger[_0x4c0a('0x26')]('SmsMessage,\x20%s,\x20%s',_0x1cea0c,_0x171409[_0x4c0a('0x26')]['message']);return _0x5d3ea0(_0x171409[_0x4c0a('0x26')]['message']);}logger[_0x4c0a('0x26')](_0x4c0a('0x21'),_0x1cea0c,_0x171409[_0x4c0a('0x26')]['message']);return _0x60e374(_0x171409[_0x4c0a('0x26')][_0x4c0a('0x28')]);}else{logger[_0x4c0a('0x20')](_0x4c0a('0x21'),_0x1cea0c,_0x4c0a('0x24'));_0x60e374(_0x171409[_0x4c0a('0x29')][_0x4c0a('0x28')]);}})[_0x4c0a('0x2a')](function(_0x12e49e){logger[_0x4c0a('0x26')](_0x4c0a('0x21'),_0x1cea0c,_0x12e49e);_0x5d3ea0(_0x12e49e);});});}function respondWithStatusCode(_0x1b8d68,_0x45215b){_0x45215b=_0x45215b||0xcc;return function(_0x4bd0bc){if(_0x4bd0bc){return _0x1b8d68['sendStatus'](_0x45215b);}return _0x1b8d68[_0x4c0a('0x2b')](_0x45215b)[_0x4c0a('0x2c')]();};}function respondWithResult(_0x15135d,_0x1f6559){_0x1f6559=_0x1f6559||0xc8;return function(_0x1efcd3){if(_0x1efcd3){return _0x15135d[_0x4c0a('0x2b')](_0x1f6559)[_0x4c0a('0x2d')](_0x1efcd3);}};}function respondWithFilteredResult(_0x2a14f9,_0x5ce007){return function(_0x41d2de){if(_0x41d2de){var _0x3ef6cc=typeof _0x5ce007[_0x4c0a('0x2e')]==='undefined'&&typeof _0x5ce007['limit']==='undefined';var _0x179ca6=_0x41d2de['count'];var _0x3a8ce2=_0x3ef6cc?0x0:_0x5ce007[_0x4c0a('0x2e')];var _0x459cfd=_0x3ef6cc?_0x41d2de[_0x4c0a('0x2f')]:_0x5ce007[_0x4c0a('0x2e')]+_0x5ce007[_0x4c0a('0x30')];var _0x5e8f9c;if(_0x459cfd>=_0x179ca6){_0x459cfd=_0x179ca6;_0x5e8f9c=0xc8;}else{_0x5e8f9c=0xce;}_0x2a14f9[_0x4c0a('0x2b')](_0x5e8f9c);return _0x2a14f9[_0x4c0a('0x31')](_0x4c0a('0x32'),_0x3a8ce2+'-'+_0x459cfd+'/'+_0x179ca6)['json'](_0x41d2de);}return null;};}function patchUpdates(_0x350c57){return function(_0x4d0225){try{jsonpatch[_0x4c0a('0x33')](_0x4d0225,_0x350c57,!![]);}catch(_0x52280c){return BPromise[_0x4c0a('0x34')](_0x52280c);}return _0x4d0225[_0x4c0a('0x35')]();};}function saveUpdates(_0x3c28ab,_0x4faeea){return function(_0x21b545){if(_0x21b545){return _0x21b545[_0x4c0a('0x36')](_0x3c28ab)['then'](function(_0x305cc4){return _0x305cc4;});}return null;};}function removeEntity(_0x5a3f4a,_0x5606a7){return function(_0xf57cb8){if(_0xf57cb8){return _0xf57cb8['destroy']()[_0x4c0a('0x37')](function(){_0x5a3f4a[_0x4c0a('0x2b')](0xcc)[_0x4c0a('0x2c')]();});}};}function handleEntityNotFound(_0x9de1a1,_0x1a83ff){return function(_0x41e76c){if(!_0x41e76c){_0x9de1a1['sendStatus'](0x194);}return _0x41e76c;};}function handleError(_0x440838,_0x48103d){_0x48103d=_0x48103d||0x1f4;return function(_0xf86399){logger['error'](_0xf86399['stack']);if(_0xf86399[_0x4c0a('0x38')]){delete _0xf86399[_0x4c0a('0x38')];}_0x440838[_0x4c0a('0x2b')](_0x48103d)[_0x4c0a('0x39')](_0xf86399);};}exports[_0x4c0a('0x3a')]=function(_0xe4ada7,_0x1775df){var _0x6cb4f1={},_0x87a1ef={},_0xcd61a={'count':0x0,'rows':[]};var _0xfdcb84=_[_0x4c0a('0x3b')](db['SmsMessage'][_0x4c0a('0x3c')],function(_0x523fde){return{'name':_0x523fde[_0x4c0a('0x3d')],'type':_0x523fde['type'][_0x4c0a('0x3e')]};});_0x87a1ef[_0x4c0a('0x3f')]=_[_0x4c0a('0x3b')](_0xfdcb84,_0x4c0a('0x38'));_0x87a1ef['query']=_[_0x4c0a('0x40')](_0xe4ada7['query']);_0x87a1ef['filters']=_[_0x4c0a('0x41')](_0x87a1ef[_0x4c0a('0x3f')],_0x87a1ef['query']);_0x6cb4f1[_0x4c0a('0x42')]=_[_0x4c0a('0x41')](_0x87a1ef['model'],qs['fields'](_0xe4ada7['query'][_0x4c0a('0x43')]));_0x6cb4f1[_0x4c0a('0x42')]=_0x6cb4f1[_0x4c0a('0x42')][_0x4c0a('0x44')]?_0x6cb4f1[_0x4c0a('0x42')]:_0x87a1ef[_0x4c0a('0x3f')];if(!_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x46')](_0x4c0a('0x47'))){_0x6cb4f1[_0x4c0a('0x30')]=qs[_0x4c0a('0x30')](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x30')]);_0x6cb4f1[_0x4c0a('0x2e')]=qs['offset'](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x2e')]);}_0x6cb4f1[_0x4c0a('0x48')]=qs['sort'](_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x49')]);_0x6cb4f1[_0x4c0a('0x4a')]=qs[_0x4c0a('0x4b')](_[_0x4c0a('0x4c')](_0xe4ada7['query'],_0x87a1ef['filters']),_0xfdcb84);if(_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x4d')]){_0x6cb4f1['where']=_['merge'](_0x6cb4f1[_0x4c0a('0x4a')],{'$or':_[_0x4c0a('0x3b')](_0xfdcb84,function(_0x1f5faa){if(_0x1f5faa[_0x4c0a('0x4e')]!=='VIRTUAL'){var _0x46fc39={};_0x46fc39[_0x1f5faa[_0x4c0a('0x38')]]={'$like':'%'+_0xe4ada7[_0x4c0a('0x45')]['filter']+'%'};return _0x46fc39;}})});}_0x6cb4f1=_[_0x4c0a('0x4f')]({},_0x6cb4f1,_0xe4ada7['options']);var _0x556312={'where':_0x6cb4f1['where']};return db[_0x4c0a('0x50')][_0x4c0a('0x2f')](_0x556312)[_0x4c0a('0x37')](function(_0x5a2bb4){_0xcd61a[_0x4c0a('0x2f')]=_0x5a2bb4;if(_0xe4ada7[_0x4c0a('0x45')][_0x4c0a('0x51')]){_0x6cb4f1[_0x4c0a('0x52')]=[{'all':!![]}];}return db[_0x4c0a('0x50')][_0x4c0a('0x53')](_0x6cb4f1);})['then'](function(_0x38356b){_0xcd61a[_0x4c0a('0x54')]=_0x38356b;return _0xcd61a;})[_0x4c0a('0x37')](respondWithFilteredResult(_0x1775df,_0x6cb4f1))['catch'](handleError(_0x1775df,null));};exports[_0x4c0a('0x55')]=function(_0x2f7464,_0x4e4124){var _0x5cd73f={'raw':!![],'where':{'id':_0x2f7464[_0x4c0a('0x56')]['id']}},_0x262cac={};_0x262cac[_0x4c0a('0x3f')]=_['keys'](db[_0x4c0a('0x50')][_0x4c0a('0x3c')]);_0x262cac[_0x4c0a('0x45')]=_[_0x4c0a('0x40')](_0x2f7464[_0x4c0a('0x45')]);_0x262cac[_0x4c0a('0x4b')]=_[_0x4c0a('0x41')](_0x262cac[_0x4c0a('0x3f')],_0x262cac[_0x4c0a('0x45')]);_0x5cd73f[_0x4c0a('0x42')]=_['intersection'](_0x262cac[_0x4c0a('0x3f')],qs[_0x4c0a('0x43')](_0x2f7464[_0x4c0a('0x45')][_0x4c0a('0x43')]));_0x5cd73f[_0x4c0a('0x42')]=_0x5cd73f['attributes']['length']?_0x5cd73f[_0x4c0a('0x42')]:_0x262cac[_0x4c0a('0x3f')];if(_0x2f7464[_0x4c0a('0x45')][_0x4c0a('0x51')]){_0x5cd73f[_0x4c0a('0x52')]=[{'all':!![]}];}_0x5cd73f=_[_0x4c0a('0x4f')]({},_0x5cd73f,_0x2f7464[_0x4c0a('0x57')]);return db[_0x4c0a('0x50')]['find'](_0x5cd73f)[_0x4c0a('0x37')](handleEntityNotFound(_0x4e4124,null))[_0x4c0a('0x37')](respondWithResult(_0x4e4124,null))['catch'](handleError(_0x4e4124,null));};exports['create']=function(_0x8850c,_0x1ba535){return db[_0x4c0a('0x50')][_0x4c0a('0x58')](_0x8850c[_0x4c0a('0x59')],{})[_0x4c0a('0x37')](respondWithResult(_0x1ba535,0xc9))[_0x4c0a('0x2a')](handleError(_0x1ba535,null));};exports[_0x4c0a('0x36')]=function(_0x3d3d39,_0x477da2){if(_0x3d3d39[_0x4c0a('0x59')]['id']){delete _0x3d3d39[_0x4c0a('0x59')]['id'];}return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x3d3d39['params']['id']}})[_0x4c0a('0x37')](handleEntityNotFound(_0x477da2,null))['then'](saveUpdates(_0x3d3d39['body'],null))['then'](respondWithResult(_0x477da2,null))[_0x4c0a('0x2a')](handleError(_0x477da2,null));};exports[_0x4c0a('0x5b')]=function(_0x51369c,_0x5bb13d){return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x51369c[_0x4c0a('0x56')]['id']}})['then'](handleEntityNotFound(_0x5bb13d,null))[_0x4c0a('0x37')](removeEntity(_0x5bb13d,null))[_0x4c0a('0x2a')](handleError(_0x5bb13d,null));};exports[_0x4c0a('0x5c')]=function(_0x213b1e,_0x15e87e){return db[_0x4c0a('0x50')][_0x4c0a('0x5c')]()[_0x4c0a('0x37')](respondWithResult(_0x15e87e,null))[_0x4c0a('0x2a')](handleError(_0x15e87e,null));};var interaction_log=require(_0x4c0a('0x14'))('sms-interactions');exports[_0x4c0a('0x5d')]=function(_0x3d1fd0,_0x14576a,_0x3b98c5){var _0x32a919={'agent':{},'channel':_0x4c0a('0x5e')};if(_0x3d1fd0['body']['id']){delete _0x3d1fd0[_0x4c0a('0x59')]['id'];}_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x5f')]=!![];_0x3d1fd0['body'][_0x4c0a('0x60')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3d1fd0['body']['UserId']=_0x3d1fd0['body'][_0x4c0a('0x61')]||_0x3d1fd0['user']['id'];_0x32a919[_0x4c0a('0x62')]['id']=_0x3d1fd0['body'][_0x4c0a('0x61')];return db[_0x4c0a('0x50')]['find']({'where':{'id':_0x3d1fd0[_0x4c0a('0x56')]['id'],'UserId':null}})[_0x4c0a('0x37')](handleEntityNotFound(_0x14576a,null))[_0x4c0a('0x37')](saveUpdates(_0x3d1fd0[_0x4c0a('0x59')],null))[_0x4c0a('0x37')](function(_0x5ed7ed){if(_0x5ed7ed){_0x32a919[_0x4c0a('0x28')]=_0x5ed7ed[_0x4c0a('0x63')]({'plain':!![]});return db[_0x4c0a('0x64')][_0x4c0a('0x5a')]({'where':{'id':_0x5ed7ed[_0x4c0a('0x65')]}});}return null;})[_0x4c0a('0x37')](handleEntityNotFound(_0x14576a,null))['then'](function(_0x148765){if(_0x148765){return _0x148765[_0x4c0a('0x36')]({'UserId':_0x3d1fd0['body'][_0x4c0a('0x61')],'read1stAt':_[_0x4c0a('0x66')](_0x148765[_0x4c0a('0x67')])?moment()[_0x4c0a('0x68')](_0x4c0a('0x69')):undefined});}return null;})[_0x4c0a('0x37')](function(_0x51da16){if(_0x51da16){_0x32a919[_0x4c0a('0x6a')]=_0x51da16[_0x4c0a('0x63')]({'plain':!![]});interaction_log[_0x4c0a('0x20')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d1fd0[_0x4c0a('0x6b')]['id'],_0x3d1fd0[_0x4c0a('0x6b')][_0x4c0a('0x38')],_0x3d1fd0[_0x4c0a('0x6b')]['role'],_0x32a919['interaction']['id'],_0x3d1fd0[_0x4c0a('0x59')]?JSON[_0x4c0a('0x25')](_0x3d1fd0['body']):_0x4c0a('0x6c'));return respondWithRpcPromise(_0x4c0a('0x6d'),_0x4c0a('0x6e'),_0x32a919);}return null;})[_0x4c0a('0x37')](function(_0x44fdfa){var _0x5a66c7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x44fdfa[_0x4c0a('0x28')]['ContactId'];return db[_0x4c0a('0x6f')][_0x4c0a('0x45')](_0x5a66c7,{'type':db[_0x4c0a('0x70')][_0x4c0a('0x71')]['SELECT'],'raw':!![]})[_0x4c0a('0x37')](function(_0x2dce8f){return _0x2dce8f;});})[_0x4c0a('0x37')](function(_0x1b9b59){if(_0x1b9b59){_0x32a919[_0x4c0a('0x28')]['contact']=_0x1b9b59[0x0];if(!_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x61')])return;return db['User']['find']({'where':{'id':_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x61')],'role':_0x4c0a('0x62')},'attributes':['id',_0x4c0a('0x38'),_0x4c0a('0x72'),_0x4c0a('0x73'),_0x4c0a('0x74')],'raw':!![]});}return null;})['then'](function(_0x5efedb){if(!_0x5efedb)return null;_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x62')]=_0x5efedb;return _0x32a919;})[_0x4c0a('0x37')](function(_0x11e1c1){if(_0x11e1c1){if(_0x3d1fd0[_0x4c0a('0x59')][_0x4c0a('0x75')]){_0x32a919[_0x4c0a('0x28')]['interface']=util[_0x4c0a('0x68')](_0x4c0a('0x76'),_0x3d1fd0[_0x4c0a('0x6b')][_0x4c0a('0x38')]);_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x77')]=_0x32a919[_0x4c0a('0x77')];_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x78')]=_0x32a919[_0x4c0a('0x77')];_0x32a919[_0x4c0a('0x28')][_0x4c0a('0x79')]=_0x4c0a('0x5d');return respondWithRpcPromise('EventManager',_0x4c0a('0x7a'),{'event':_0x4c0a('0x7b'),'message':_0x32a919[_0x4c0a('0x28')]},client9002)[_0x4c0a('0x37')](function(){return _0x32a919;});}return _0x32a919;}return null;})[_0x4c0a('0x37')](respondWithResult(_0x14576a,null))[_0x4c0a('0x2a')](handleError(_0x14576a,null));};var interaction_log=require(_0x4c0a('0x14'))(_0x4c0a('0x7c'));exports[_0x4c0a('0x34')]=function(_0x326bf6,_0x33b870,_0x4e6846){var _0x2598e5={'agent':{},'channel':_0x4c0a('0x5e')};if(_0x326bf6[_0x4c0a('0x59')]['id']){delete _0x326bf6[_0x4c0a('0x59')]['id'];}_0x326bf6['body'][_0x4c0a('0x61')]=_0x326bf6['body'][_0x4c0a('0x61')]||_0x326bf6['user']['id'];_0x2598e5[_0x4c0a('0x62')]['id']=_0x326bf6[_0x4c0a('0x59')]['UserId'];return db[_0x4c0a('0x50')][_0x4c0a('0x5a')]({'where':{'id':_0x326bf6[_0x4c0a('0x56')]['id'],'UserId':null}})[_0x4c0a('0x37')](handleEntityNotFound(_0x33b870,null))['then'](function(_0x5ac87f){if(_0x5ac87f){_0x2598e5[_0x4c0a('0x28')]=_0x5ac87f[_0x4c0a('0x63')]({'plain':!![]});return db[_0x4c0a('0x64')]['find']({'where':{'id':_0x5ac87f[_0x4c0a('0x65')]}});}return null;})[_0x4c0a('0x37')](handleEntityNotFound(_0x33b870,null))[_0x4c0a('0x37')](function(_0x8eb321){if(_0x8eb321){_0x2598e5['interaction']=_0x8eb321[_0x4c0a('0x63')]({'plain':!![]});interaction_log['info'](_0x4c0a('0x7d'),_0x326bf6[_0x4c0a('0x6b')]['id'],_0x326bf6[_0x4c0a('0x6b')]['name'],_0x326bf6[_0x4c0a('0x6b')][_0x4c0a('0x7e')],_0x2598e5['interaction']['id'],_0x326bf6['body']?JSON[_0x4c0a('0x25')](_0x326bf6[_0x4c0a('0x59')]):_0x4c0a('0x6c'));return respondWithRpcPromise(_0x4c0a('0x7f'),_0x4c0a('0x80'),_0x2598e5);}return null;})[_0x4c0a('0x37')](function(_0x395e2f){var _0x1d7a3d=_0x4c0a('0x81')+_0x395e2f[_0x4c0a('0x28')][_0x4c0a('0x82')];return db[_0x4c0a('0x6f')][_0x4c0a('0x45')](_0x1d7a3d,{'type':db['Sequelize'][_0x4c0a('0x71')][_0x4c0a('0x83')],'raw':!![]})[_0x4c0a('0x37')](function(_0x1dccc7){return _0x1dccc7;});})[_0x4c0a('0x37')](function(_0x5c768e){if(_0x5c768e){_0x2598e5['message']['contact']=_0x5c768e[0x0];if(!_0x326bf6[_0x4c0a('0x59')][_0x4c0a('0x61')])return;return db[_0x4c0a('0x84')][_0x4c0a('0x5a')]({'where':{'id':_0x326bf6[_0x4c0a('0x59')][_0x4c0a('0x61')],'role':_0x4c0a('0x62')},'attributes':['id','name',_0x4c0a('0x72'),'email',_0x4c0a('0x74')],'raw':!![]});}return null;})['then'](function(_0x274af0){if(!_0x274af0)return null;_0x2598e5[_0x4c0a('0x28')][_0x4c0a('0x62')]=_0x274af0;return _0x2598e5;})[_0x4c0a('0x37')](function(_0x59247a){if(_0x59247a){_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x85')]=util[_0x4c0a('0x68')]('SIP/%s',_0x326bf6[_0x4c0a('0x6b')][_0x4c0a('0x38')]);_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x77')]=_0x2598e5[_0x4c0a('0x77')];_0x59247a['message'][_0x4c0a('0x78')]=_0x2598e5[_0x4c0a('0x77')];_0x59247a[_0x4c0a('0x28')][_0x4c0a('0x79')]='reject';respondWithRpcPromise(_0x4c0a('0x7a'),'EventManager',{'event':_0x4c0a('0x86'),'message':_0x59247a[_0x4c0a('0x28')]},client9002);return _0x2598e5;}return null;})[_0x4c0a('0x37')](respondWithResult(_0x33b870,null))[_0x4c0a('0x2a')](handleError(_0x33b870,null));};exports[_0x4c0a('0x2b')]=function(_0x3ad535,_0x22ddf0,_0xe88ba0){if(_0x3ad535[_0x4c0a('0x59')]['id']){delete _0x3ad535[_0x4c0a('0x59')]['id'];}var _0x163e0f;return db['SmsMessage']['find']({'where':{'id':_0x3ad535[_0x4c0a('0x56')]['id']}})['then'](handleEntityNotFound(_0x22ddf0,null))[_0x4c0a('0x37')](function(_0x2c2b2d){if(_0x2c2b2d){_0x163e0f=_0x2c2b2d;return db['SmsAccount']['find']({'where':{'id':_0x2c2b2d[_0x4c0a('0x87')]}});}})[_0x4c0a('0x37')](handleEntityNotFound(_0x22ddf0,null))['then'](function(_0x2e6b9c){if(_0x2e6b9c){logger['debug'](_0x4c0a('0x23'),_0x4c0a('0x2b'),'received\x20delivery\x20report\x20from',_0x2e6b9c[_0x4c0a('0x4e')],util[_0x4c0a('0x88')](_0x3ad535['body'],{'showHidden':![],'depth':null}));switch(_0x2e6b9c[_0x4c0a('0x4e')]){case _0x4c0a('0x89'):if(_0x3ad535['body'][_0x4c0a('0x8a')]&&_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8a')]===_0x163e0f['messageId']){return _0x163e0f[_0x4c0a('0x36')]({'read':!![]});}else{logger[_0x4c0a('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c0a('0x2b'),_0x4c0a('0x89'),util[_0x4c0a('0x88')](_0x3ad535[_0x4c0a('0x59')],{'showHidden':![],'depth':null}));}break;case _0x4c0a('0x8b'):if(_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8c')]&&_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x8c')]===_0x163e0f[_0x4c0a('0x8d')]&&_[_0x4c0a('0x8e')]([_0x4c0a('0x8f'),_0x4c0a('0x90')],_0x3ad535[_0x4c0a('0x59')]['Status'])>=0x0){return _0x163e0f['update']({'read':!![]});}else{logger[_0x4c0a('0x26')](_0x4c0a('0x91'),_0x4c0a('0x2b'),_0x4c0a('0x92'),util[_0x4c0a('0x88')](_0x3ad535[_0x4c0a('0x59')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5b60b0=_0x3ad535[_0x4c0a('0x59')][_0x4c0a('0x93')][0x0];if(_0x5b60b0[_0x4c0a('0x2b')][_0x4c0a('0x94')]===_0x4c0a('0x95')){return _0x163e0f[_0x4c0a('0x36')]({'read':!![]});}else{logger['error'](_0x4c0a('0x91'),_0x4c0a('0x2b'),_0x4c0a('0x96'),util[_0x4c0a('0x88')](_0x3ad535['body'],{'showHidden':![],'depth':null}));}break;}return _0x163e0f;}})[_0x4c0a('0x37')](respondWithResult(_0x22ddf0,null))[_0x4c0a('0x2a')](handleError(_0x22ddf0,null));}; \ No newline at end of file +var _0x627e=['readAt','format','UserId','user','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','interaction','get','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SELECT','User','fullname','email','agent','interface','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','ContactId','sequelize','Sequelize','contact','internal','SIP/%s','channel','reject','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','update','MessageUUID','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','length','filters','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','rows','show','params','intersection','fields','find','create','body','describe','sms-interactions','accept','sms'];(function(_0x463e29,_0xfc1e0c){var _0x4a09ad=function(_0x1a684c){while(--_0x1a684c){_0x463e29['push'](_0x463e29['shift']());}};_0x4a09ad(++_0xfc1e0c);}(_0x627e,0x14a));var _0xe627=function(_0x2d4832,_0x135b09){_0x2d4832=_0x2d4832-0x0;var _0x473186=_0x627e[_0x2d4832];return _0x473186;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];config[_0xe627('0x18')]=_[_0xe627('0x19')](config['redis'],{'host':_0xe627('0x1a'),'port':0x18eb});var socket=require(_0xe627('0x1b'))(new Redis(config[_0xe627('0x18')]));require('./smsMessage.socket')[_0xe627('0x1c')](socket);var jayson=require(_0xe627('0x1d'));var client=jayson[_0xe627('0x1e')][_0xe627('0x1f')]({'port':0x232c});var client9002=jayson[_0xe627('0x1e')][_0xe627('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x271325,_0x54720a,_0x241544,_0x29b41c){return new BPromise(function(_0x16c2d7,_0x76fac){var _0x403982=_0x29b41c||client;return _0x403982[_0xe627('0x20')](_0x271325,_0x241544)[_0xe627('0x21')](function(_0x2fe46a){logger['info'](_0xe627('0x22'),_0x54720a,'request\x20sent');logger[_0xe627('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x54720a,'request\x20sent',JSON[_0xe627('0x24')](_0x2fe46a));if(_0x2fe46a['error']){if(_0x2fe46a[_0xe627('0x25')][_0xe627('0x26')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x54720a,_0x2fe46a['error'][_0xe627('0x27')]);return _0x76fac(_0x2fe46a[_0xe627('0x25')]['message']);}logger[_0xe627('0x25')](_0xe627('0x22'),_0x54720a,_0x2fe46a['error'][_0xe627('0x27')]);return _0x16c2d7(_0x2fe46a[_0xe627('0x25')]['message']);}else{logger[_0xe627('0x28')](_0xe627('0x22'),_0x54720a,_0xe627('0x29'));_0x16c2d7(_0x2fe46a['result'][_0xe627('0x27')]);}})[_0xe627('0x2a')](function(_0x1a5081){logger[_0xe627('0x25')]('SmsMessage,\x20%s,\x20%s',_0x54720a,_0x1a5081);_0x76fac(_0x1a5081);});});}function respondWithStatusCode(_0x35cd34,_0x1fe192){_0x1fe192=_0x1fe192||0xcc;return function(_0x1635a0){if(_0x1635a0){return _0x35cd34[_0xe627('0x2b')](_0x1fe192);}return _0x35cd34[_0xe627('0x2c')](_0x1fe192)[_0xe627('0x2d')]();};}function respondWithResult(_0x45c694,_0x44c9f7){_0x44c9f7=_0x44c9f7||0xc8;return function(_0x3e9eda){if(_0x3e9eda){return _0x45c694['status'](_0x44c9f7)[_0xe627('0x2e')](_0x3e9eda);}};}function respondWithFilteredResult(_0x5aeba1,_0x5cd7c8){return function(_0x1e0bd7){if(_0x1e0bd7){var _0xdf63c8=typeof _0x5cd7c8['offset']===_0xe627('0x2f')&&typeof _0x5cd7c8['limit']===_0xe627('0x2f');var _0x498e1f=_0x1e0bd7[_0xe627('0x30')];var _0x26833a=_0xdf63c8?0x0:_0x5cd7c8['offset'];var _0x33e9dd=_0xdf63c8?_0x1e0bd7['count']:_0x5cd7c8[_0xe627('0x31')]+_0x5cd7c8[_0xe627('0x32')];var _0x251606;if(_0x33e9dd>=_0x498e1f){_0x33e9dd=_0x498e1f;_0x251606=0xc8;}else{_0x251606=0xce;}_0x5aeba1[_0xe627('0x2c')](_0x251606);return _0x5aeba1[_0xe627('0x33')](_0xe627('0x34'),_0x26833a+'-'+_0x33e9dd+'/'+_0x498e1f)[_0xe627('0x2e')](_0x1e0bd7);}return null;};}function patchUpdates(_0x3ece9e){return function(_0x11ccbd){try{jsonpatch[_0xe627('0x35')](_0x11ccbd,_0x3ece9e,!![]);}catch(_0x12ebc9){return BPromise['reject'](_0x12ebc9);}return _0x11ccbd['save']();};}function saveUpdates(_0x183fed,_0x52517b){return function(_0x1f1b53){if(_0x1f1b53){return _0x1f1b53['update'](_0x183fed)['then'](function(_0x422451){return _0x422451;});}return null;};}function removeEntity(_0x5cd337,_0x566161){return function(_0x103c0b){if(_0x103c0b){return _0x103c0b[_0xe627('0x36')]()[_0xe627('0x21')](function(){_0x5cd337['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x580c0b,_0x2ff49c){return function(_0x4c746b){if(!_0x4c746b){_0x580c0b[_0xe627('0x2b')](0x194);}return _0x4c746b;};}function handleError(_0x4089ad,_0x5e4512){_0x5e4512=_0x5e4512||0x1f4;return function(_0x3d26ca){logger[_0xe627('0x25')](_0x3d26ca['stack']);if(_0x3d26ca[_0xe627('0x37')]){delete _0x3d26ca[_0xe627('0x37')];}_0x4089ad[_0xe627('0x2c')](_0x5e4512)[_0xe627('0x38')](_0x3d26ca);};}exports[_0xe627('0x39')]=function(_0x28fd59,_0x54ffa0){var _0x16b547={},_0x5ba53f={},_0x26afc2={'count':0x0,'rows':[]};var _0x4eb44c=_[_0xe627('0x3a')](db[_0xe627('0x3b')][_0xe627('0x3c')],function(_0x21a533){return{'name':_0x21a533[_0xe627('0x3d')],'type':_0x21a533[_0xe627('0x3e')][_0xe627('0x3f')]};});_0x5ba53f[_0xe627('0x40')]=_[_0xe627('0x3a')](_0x4eb44c,_0xe627('0x37'));_0x5ba53f[_0xe627('0x41')]=_[_0xe627('0x42')](_0x28fd59[_0xe627('0x41')]);_0x5ba53f['filters']=_['intersection'](_0x5ba53f['model'],_0x5ba53f['query']);_0x16b547['attributes']=_['intersection'](_0x5ba53f[_0xe627('0x40')],qs['fields'](_0x28fd59[_0xe627('0x41')]['fields']));_0x16b547[_0xe627('0x43')]=_0x16b547[_0xe627('0x43')][_0xe627('0x44')]?_0x16b547['attributes']:_0x5ba53f['model'];if(!_0x28fd59[_0xe627('0x41')]['hasOwnProperty']('nolimit')){_0x16b547[_0xe627('0x32')]=qs['limit'](_0x28fd59[_0xe627('0x41')]['limit']);_0x16b547['offset']=qs[_0xe627('0x31')](_0x28fd59[_0xe627('0x41')][_0xe627('0x31')]);}_0x16b547['order']=qs['sort'](_0x28fd59[_0xe627('0x41')]['sort']);_0x16b547['where']=qs[_0xe627('0x45')](_[_0xe627('0x46')](_0x28fd59[_0xe627('0x41')],_0x5ba53f[_0xe627('0x45')]),_0x4eb44c);if(_0x28fd59[_0xe627('0x41')][_0xe627('0x47')]){_0x16b547['where']=_[_0xe627('0x48')](_0x16b547[_0xe627('0x49')],{'$or':_['map'](_0x4eb44c,function(_0x5d08e9){if(_0x5d08e9[_0xe627('0x3e')]!==_0xe627('0x4a')){var _0x1f6ee5={};_0x1f6ee5[_0x5d08e9[_0xe627('0x37')]]={'$like':'%'+_0x28fd59[_0xe627('0x41')][_0xe627('0x47')]+'%'};return _0x1f6ee5;}})});}_0x16b547=_[_0xe627('0x48')]({},_0x16b547,_0x28fd59['options']);var _0x97c5bf={'where':_0x16b547['where']};return db[_0xe627('0x3b')][_0xe627('0x30')](_0x97c5bf)[_0xe627('0x21')](function(_0x4c5185){_0x26afc2[_0xe627('0x30')]=_0x4c5185;if(_0x28fd59['query'][_0xe627('0x4b')]){_0x16b547[_0xe627('0x4c')]=[{'all':!![]}];}return db[_0xe627('0x3b')][_0xe627('0x4d')](_0x16b547);})[_0xe627('0x21')](function(_0x5b52a4){_0x26afc2[_0xe627('0x4e')]=_0x5b52a4;return _0x26afc2;})[_0xe627('0x21')](respondWithFilteredResult(_0x54ffa0,_0x16b547))[_0xe627('0x2a')](handleError(_0x54ffa0,null));};exports[_0xe627('0x4f')]=function(_0x2d6417,_0x148eec){var _0x831df6={'raw':!![],'where':{'id':_0x2d6417[_0xe627('0x50')]['id']}},_0x97171f={};_0x97171f[_0xe627('0x40')]=_['keys'](db[_0xe627('0x3b')][_0xe627('0x3c')]);_0x97171f['query']=_[_0xe627('0x42')](_0x2d6417[_0xe627('0x41')]);_0x97171f['filters']=_[_0xe627('0x51')](_0x97171f[_0xe627('0x40')],_0x97171f['query']);_0x831df6[_0xe627('0x43')]=_[_0xe627('0x51')](_0x97171f['model'],qs[_0xe627('0x52')](_0x2d6417['query']['fields']));_0x831df6['attributes']=_0x831df6['attributes']['length']?_0x831df6[_0xe627('0x43')]:_0x97171f[_0xe627('0x40')];if(_0x2d6417[_0xe627('0x41')][_0xe627('0x4b')]){_0x831df6[_0xe627('0x4c')]=[{'all':!![]}];}_0x831df6=_[_0xe627('0x48')]({},_0x831df6,_0x2d6417['options']);return db[_0xe627('0x3b')][_0xe627('0x53')](_0x831df6)['then'](handleEntityNotFound(_0x148eec,null))['then'](respondWithResult(_0x148eec,null))['catch'](handleError(_0x148eec,null));};exports[_0xe627('0x54')]=function(_0x324b0b,_0x2aead5){return db[_0xe627('0x3b')][_0xe627('0x54')](_0x324b0b[_0xe627('0x55')],{})[_0xe627('0x21')](respondWithResult(_0x2aead5,0xc9))[_0xe627('0x2a')](handleError(_0x2aead5,null));};exports['update']=function(_0x1b1c5a,_0x49649a){if(_0x1b1c5a[_0xe627('0x55')]['id']){delete _0x1b1c5a['body']['id'];}return db[_0xe627('0x3b')][_0xe627('0x53')]({'where':{'id':_0x1b1c5a[_0xe627('0x50')]['id']}})[_0xe627('0x21')](handleEntityNotFound(_0x49649a,null))[_0xe627('0x21')](saveUpdates(_0x1b1c5a[_0xe627('0x55')],null))[_0xe627('0x21')](respondWithResult(_0x49649a,null))[_0xe627('0x2a')](handleError(_0x49649a,null));};exports[_0xe627('0x36')]=function(_0x480ac3,_0xe4c06d){return db[_0xe627('0x3b')][_0xe627('0x53')]({'where':{'id':_0x480ac3[_0xe627('0x50')]['id']}})[_0xe627('0x21')](handleEntityNotFound(_0xe4c06d,null))['then'](removeEntity(_0xe4c06d,null))['catch'](handleError(_0xe4c06d,null));};exports[_0xe627('0x56')]=function(_0x2e787e,_0x5f3fb9){return db[_0xe627('0x3b')][_0xe627('0x56')]()[_0xe627('0x21')](respondWithResult(_0x5f3fb9,null))[_0xe627('0x2a')](handleError(_0x5f3fb9,null));};var interaction_log=require(_0xe627('0x12'))(_0xe627('0x57'));exports[_0xe627('0x58')]=function(_0x25dccf,_0x4bc086,_0x26e6a3){var _0x4f5595={'agent':{},'channel':_0xe627('0x59')};if(_0x25dccf[_0xe627('0x55')]['id']){delete _0x25dccf[_0xe627('0x55')]['id'];}_0x25dccf[_0xe627('0x55')]['read']=!![];_0x25dccf['body'][_0xe627('0x5a')]=moment()[_0xe627('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x25dccf[_0xe627('0x55')][_0xe627('0x5c')]=_0x25dccf['body'][_0xe627('0x5c')]||_0x25dccf[_0xe627('0x5d')]['id'];_0x4f5595['agent']['id']=_0x25dccf['body'][_0xe627('0x5c')];return db['SmsMessage'][_0xe627('0x53')]({'where':{'id':_0x25dccf[_0xe627('0x50')]['id'],'UserId':null}})[_0xe627('0x21')](handleEntityNotFound(_0x4bc086,null))['then'](saveUpdates(_0x25dccf[_0xe627('0x55')],null))[_0xe627('0x21')](function(_0x38384f){if(_0x38384f){_0x4f5595[_0xe627('0x27')]=_0x38384f['get']({'plain':!![]});return db['SmsInteraction'][_0xe627('0x53')]({'where':{'id':_0x38384f[_0xe627('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x4bc086,null))[_0xe627('0x21')](function(_0x48236e){if(_0x48236e){return _0x48236e['update']({'UserId':_0x25dccf[_0xe627('0x55')][_0xe627('0x5c')],'read1stAt':_['isNil'](_0x48236e['read1stAt'])?moment()[_0xe627('0x5b')](_0xe627('0x5f')):undefined});}return null;})[_0xe627('0x21')](function(_0x1bd300){if(_0x1bd300){_0x4f5595[_0xe627('0x60')]=_0x1bd300[_0xe627('0x61')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x25dccf['user']['id'],_0x25dccf[_0xe627('0x5d')][_0xe627('0x37')],_0x25dccf['user'][_0xe627('0x62')],_0x4f5595[_0xe627('0x60')]['id'],_0x25dccf[_0xe627('0x55')]?JSON[_0xe627('0x24')](_0x25dccf['body']):_0xe627('0x63'));return respondWithRpcPromise(_0xe627('0x64'),_0xe627('0x65'),_0x4f5595);}return null;})[_0xe627('0x21')](function(_0x574837){var _0x36b75a=_0xe627('0x66')+_0x574837[_0xe627('0x27')]['ContactId'];return db['sequelize']['query'](_0x36b75a,{'type':db['Sequelize']['QueryTypes'][_0xe627('0x67')],'raw':!![]})[_0xe627('0x21')](function(_0x31b03b){return _0x31b03b;});})[_0xe627('0x21')](function(_0x43949a){if(_0x43949a){_0x4f5595[_0xe627('0x27')]['contact']=_0x43949a[0x0];if(!_0x25dccf[_0xe627('0x55')][_0xe627('0x5c')])return;return db[_0xe627('0x68')][_0xe627('0x53')]({'where':{'id':_0x25dccf[_0xe627('0x55')]['UserId'],'role':'agent'},'attributes':['id','name',_0xe627('0x69'),_0xe627('0x6a'),'internal'],'raw':!![]});}return null;})[_0xe627('0x21')](function(_0x1ab1f8){if(!_0x1ab1f8)return null;_0x4f5595[_0xe627('0x27')][_0xe627('0x6b')]=_0x1ab1f8;return _0x4f5595;})['then'](function(_0x4a1bf0){if(_0x4a1bf0){if(_0x25dccf[_0xe627('0x55')]['manual']){_0x4f5595[_0xe627('0x27')][_0xe627('0x6c')]=util[_0xe627('0x5b')]('SIP/%s',_0x25dccf['user'][_0xe627('0x37')]);_0x4f5595['message']['channel']=_0x4f5595['channel'];_0x4f5595[_0xe627('0x27')][_0xe627('0x6d')]=_0x4f5595['channel'];_0x4f5595[_0xe627('0x27')][_0xe627('0x6e')]='accept';return respondWithRpcPromise(_0xe627('0x6f'),_0xe627('0x6f'),{'event':_0xe627('0x70'),'message':_0x4f5595[_0xe627('0x27')]},client9002)[_0xe627('0x21')](function(){return _0x4f5595;});}return _0x4f5595;}return null;})[_0xe627('0x21')](respondWithResult(_0x4bc086,null))['catch'](handleError(_0x4bc086,null));};var interaction_log=require(_0xe627('0x12'))(_0xe627('0x57'));exports['reject']=function(_0x14459f,_0x9d4335,_0x4e477e){var _0x2a5757={'agent':{},'channel':_0xe627('0x59')};if(_0x14459f[_0xe627('0x55')]['id']){delete _0x14459f['body']['id'];}_0x14459f['body'][_0xe627('0x5c')]=_0x14459f[_0xe627('0x55')][_0xe627('0x5c')]||_0x14459f[_0xe627('0x5d')]['id'];_0x2a5757[_0xe627('0x6b')]['id']=_0x14459f[_0xe627('0x55')][_0xe627('0x5c')];return db[_0xe627('0x3b')][_0xe627('0x53')]({'where':{'id':_0x14459f[_0xe627('0x50')]['id'],'UserId':null}})[_0xe627('0x21')](handleEntityNotFound(_0x9d4335,null))['then'](function(_0x451973){if(_0x451973){_0x2a5757[_0xe627('0x27')]=_0x451973[_0xe627('0x61')]({'plain':!![]});return db[_0xe627('0x71')][_0xe627('0x53')]({'where':{'id':_0x451973[_0xe627('0x5e')]}});}return null;})[_0xe627('0x21')](handleEntityNotFound(_0x9d4335,null))['then'](function(_0xced854){if(_0xced854){_0x2a5757[_0xe627('0x60')]=_0xced854[_0xe627('0x61')]({'plain':!![]});interaction_log['info'](_0xe627('0x72'),_0x14459f['user']['id'],_0x14459f['user'][_0xe627('0x37')],_0x14459f[_0xe627('0x5d')][_0xe627('0x62')],_0x2a5757['interaction']['id'],_0x14459f[_0xe627('0x55')]?JSON[_0xe627('0x24')](_0x14459f['body']):_0xe627('0x63'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x2a5757);}return null;})[_0xe627('0x21')](function(_0x1df7d7){var _0x3ae47b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1df7d7[_0xe627('0x27')][_0xe627('0x73')];return db[_0xe627('0x74')][_0xe627('0x41')](_0x3ae47b,{'type':db[_0xe627('0x75')]['QueryTypes'][_0xe627('0x67')],'raw':!![]})[_0xe627('0x21')](function(_0x385fff){return _0x385fff;});})[_0xe627('0x21')](function(_0x4658b4){if(_0x4658b4){_0x2a5757[_0xe627('0x27')][_0xe627('0x76')]=_0x4658b4[0x0];if(!_0x14459f[_0xe627('0x55')][_0xe627('0x5c')])return;return db[_0xe627('0x68')]['find']({'where':{'id':_0x14459f['body'][_0xe627('0x5c')],'role':_0xe627('0x6b')},'attributes':['id','name',_0xe627('0x69'),_0xe627('0x6a'),_0xe627('0x77')],'raw':!![]});}return null;})[_0xe627('0x21')](function(_0x2dbd02){if(!_0x2dbd02)return null;_0x2a5757[_0xe627('0x27')][_0xe627('0x6b')]=_0x2dbd02;return _0x2a5757;})[_0xe627('0x21')](function(_0x2b1e02){if(_0x2b1e02){_0x2b1e02[_0xe627('0x27')][_0xe627('0x6c')]=util[_0xe627('0x5b')](_0xe627('0x78'),_0x14459f['user'][_0xe627('0x37')]);_0x2b1e02[_0xe627('0x27')][_0xe627('0x79')]=_0x2a5757['channel'];_0x2b1e02['message'][_0xe627('0x6d')]=_0x2a5757['channel'];_0x2b1e02[_0xe627('0x27')][_0xe627('0x6e')]=_0xe627('0x7a');respondWithRpcPromise('EventManager',_0xe627('0x6f'),{'event':'rejectmessage','message':_0x2b1e02[_0xe627('0x27')]},client9002);return _0x2a5757;}return null;})[_0xe627('0x21')](respondWithResult(_0x9d4335,null))[_0xe627('0x2a')](handleError(_0x9d4335,null));};exports['status']=function(_0x60a9fc,_0x1fd404,_0x4f23fd){if(_0x60a9fc[_0xe627('0x55')]['id']){delete _0x60a9fc[_0xe627('0x55')]['id'];}var _0x857f51;return db['SmsMessage'][_0xe627('0x53')]({'where':{'id':_0x60a9fc['params']['id']}})['then'](handleEntityNotFound(_0x1fd404,null))[_0xe627('0x21')](function(_0x14ab96){if(_0x14ab96){_0x857f51=_0x14ab96;return db[_0xe627('0x7b')][_0xe627('0x53')]({'where':{'id':_0x14ab96[_0xe627('0x7c')]}});}})[_0xe627('0x21')](handleEntityNotFound(_0x1fd404,null))['then'](function(_0x1c76dc){if(_0x1c76dc){logger[_0xe627('0x23')](_0xe627('0x7d'),_0xe627('0x2c'),'received\x20delivery\x20report\x20from',_0x1c76dc[_0xe627('0x3e')],util[_0xe627('0x7e')](_0x60a9fc[_0xe627('0x55')],{'showHidden':![],'depth':null}));switch(_0x1c76dc[_0xe627('0x3e')]){case _0xe627('0x7f'):if(_0x60a9fc[_0xe627('0x55')][_0xe627('0x80')]&&_0x60a9fc['body']['MessageSid']===_0x857f51['messageId']){return _0x857f51[_0xe627('0x81')]({'read':!![]});}else{logger[_0xe627('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe627('0x2c'),_0xe627('0x7f'),util['inspect'](_0x60a9fc['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x60a9fc[_0xe627('0x55')][_0xe627('0x82')]&&_0x60a9fc['body'][_0xe627('0x82')]===_0x857f51['messageId']&&_[_0xe627('0x83')]([_0xe627('0x84'),_0xe627('0x85')],_0x60a9fc[_0xe627('0x55')]['Status'])>=0x0){return _0x857f51[_0xe627('0x81')]({'read':!![]});}else{logger[_0xe627('0x25')](_0xe627('0x86'),_0xe627('0x2c'),_0xe627('0x87'),util[_0xe627('0x7e')](_0x60a9fc['body'],{'showHidden':![],'depth':null}));}break;case _0xe627('0x88'):var _0x434cf9=_0x60a9fc['body'][_0xe627('0x89')][0x0];if(_0x434cf9[_0xe627('0x2c')][_0xe627('0x8a')]===_0xe627('0x8b')){return _0x857f51[_0xe627('0x81')]({'read':!![]});}else{logger['error'](_0xe627('0x86'),'status',_0xe627('0x88'),util[_0xe627('0x7e')](_0x60a9fc[_0xe627('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x857f51;}})[_0xe627('0x21')](respondWithResult(_0x1fd404,null))[_0xe627('0x2a')](handleError(_0x1fd404,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c9537a0..9c108d7 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 _0xc508=['hasOwnProperty','hook','events','../../mysqldb','update','remove','emit'];(function(_0x3d8112,_0x46165f){var _0x1fe131=function(_0x549f3a){while(--_0x549f3a){_0x3d8112['push'](_0x3d8112['shift']());}};_0x1fe131(++_0x46165f);}(_0xc508,0x14b));var _0x8c50=function(_0x3bc12a,_0x3ed59c){_0x3bc12a=_0x3bc12a-0x0;var _0x50d2b1=_0xc508[_0x3bc12a];return _0x50d2b1;};'use strict';var EventEmitter=require(_0x8c50('0x0'));var SmsMessage=require(_0x8c50('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c50('0x2'),'afterDestroy':_0x8c50('0x3')};function emitEvent(_0x5b5049){return function(_0x103554,_0x591d7f,_0x3846a0){SmsMessageEvents[_0x8c50('0x4')](_0x5b5049+':'+_0x103554['id'],_0x103554);SmsMessageEvents[_0x8c50('0x4')](_0x5b5049,_0x103554);_0x3846a0(null);};}for(var e in events){if(events[_0x8c50('0x5')](e)){var event=events[e];SmsMessage[_0x8c50('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x7f1d=['emit','hook','exports','../../mysqldb','SmsMessage','save','update'];(function(_0x1cad88,_0x41d38c){var _0x134d48=function(_0x314dee){while(--_0x314dee){_0x1cad88['push'](_0x1cad88['shift']());}};_0x134d48(++_0x41d38c);}(_0x7f1d,0x81));var _0xd7f1=function(_0x3ce591,_0x38dcca){_0x3ce591=_0x3ce591-0x0;var _0x453453=_0x7f1d[_0x3ce591];return _0x453453;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xd7f1('0x0'))['db'][_0xd7f1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7f1('0x2'),'afterUpdate':_0xd7f1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x25ac80){return function(_0x521fd9,_0xe9d406,_0x343b00){SmsMessageEvents['emit'](_0x25ac80+':'+_0x521fd9['id'],_0x521fd9);SmsMessageEvents[_0xd7f1('0x4')](_0x25ac80,_0x521fd9);_0x343b00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xd7f1('0x5')](e,emitEvent(event));}}module[_0xd7f1('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index ab49f82..6377711 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 _0xb44b=['SmsAccount','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/status?token=','token','sid','catch','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','then','split','sms','POST','total_sent','deliveryReport','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','error','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','/api/sms/messages/','authId','https://api.plivo.com/v1/Account/%s/Message/','base64','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','keys','length','createHash','md5','digest','signature=','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','Bearer\x20','code','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','models','toLowerCase','direction','out','secret','isNil','SmsInteractionId','SmsInteraction','update'];(function(_0xf697d1,_0x1b6ed0){var _0x4e8075=function(_0x53a111){while(--_0x53a111){_0xf697d1['push'](_0xf697d1['shift']());}};_0x4e8075(++_0x1b6ed0);}(_0xb44b,0xd3));var _0xbb44=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0xb44b[_0x1e91eb];return _0x2af75a;};'use strict';var _=require(_0xbb44('0x0'));var util=require('util');var logger=require(_0xbb44('0x1'))(_0xbb44('0x2'));var moment=require(_0xbb44('0x3'));var BPromise=require(_0xbb44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb44('0x5'));var rimraf=require(_0xbb44('0x6'));var config=require(_0xbb44('0x7'));var attributes=require(_0xbb44('0x8'));module[_0xbb44('0x9')]=function(_0x453717,_0x2dcd7b){return _0x453717[_0xbb44('0xa')]('SmsMessage',attributes,{'tableName':_0xbb44('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xbb44('0xc')]},{'name':_0xbb44('0xd'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x429942,_0x3ee3a9,_0x35470e){var _0x6e0101=_0x453717[_0xbb44('0xe')];var _0xc3d194=_0x429942['get']({'plain':!![]});if(_0xc3d194['direction'][_0xbb44('0xf')]()==='in'||_0xc3d194[_0xbb44('0x10')][_0xbb44('0xf')]()===_0xbb44('0x11')&&!_0xc3d194[_0xbb44('0x12')]&&!_[_0xbb44('0x13')](_0xc3d194['UserId'])&&!_[_0xbb44('0x13')](_0xc3d194[_0xbb44('0x14')])){_0x6e0101[_0xbb44('0x15')]['findOne']({'where':{'id':_0xc3d194[_0xbb44('0x14')]}})['then'](function(_0x53fbc5){if(_0x53fbc5){_0x53fbc5[_0xbb44('0x16')]({'lastMsgAt':_0xc3d194['createdAt'],'lastMsgDirection':_0xc3d194['direction'][_0xbb44('0xf')]()});}})['catch'](function(_0x405214){console['error'](_0x405214);});}if(_0xc3d194['direction']===_0xbb44('0x11')&&!_0xc3d194[_0xbb44('0x12')]){var _0x4af776;_0x6e0101[_0xbb44('0x17')]['find']({'where':{'id':_0xc3d194['SmsAccountId']},'raw':!![]})['then'](function(_0x45ec75){_0x4af776=_0x45ec75;if(_0x4af776&&_0x4af776[_0xbb44('0x18')]){switch(_0x4af776[_0xbb44('0x18')]){case _0xbb44('0x19'):var _0x18e889=require(_0xbb44('0x19'));if(_0x4af776[_0xbb44('0x1a')]&&_0x4af776[_0xbb44('0x1b')]&&_0x4af776[_0xbb44('0x1c')]){var _0x442951=new _0x18e889(_0x4af776[_0xbb44('0x1a')],_0x4af776[_0xbb44('0x1b')]);_0x442951[_0xbb44('0x1d')][_0xbb44('0x1e')]({'body':_0xc3d194[_0xbb44('0x1f')],'to':_0xc3d194['phone'],'from':_0x4af776[_0xbb44('0x1c')],'statusCallback':_0x4af776[_0xbb44('0x20')]+'/api/sms/messages/'+_0xc3d194['id']+_0xbb44('0x21')+_0x4af776[_0xbb44('0x22')]})['then'](function(_0x334478){if(_0x334478[_0xbb44('0x23')]){return _0x429942[_0xbb44('0x16')]({'messageId':_0x334478[_0xbb44('0x23')]});}})[_0xbb44('0x24')](function(_0x16362f){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbb44('0x25'),_0xbb44('0x19'),util[_0xbb44('0x26')](_0x16362f,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbb44('0x25'),_0xbb44('0x19'),_0xbb44('0x27'));}break;case'skebby':var _0x5321e7='https://api.skebby.it/API/v1.0/REST/';if(_0x4af776[_0xbb44('0x28')]&&_0x4af776[_0xbb44('0x29')]){var _0xb11da7={'recipient':[_0xc3d194[_0xbb44('0x1c')]],'message':_0xc3d194['body'],'message_type':_0x4af776[_0xbb44('0x2a')]};if(_0x4af776[_0xbb44('0x2a')]&&_0x4af776[_0xbb44('0x2a')]!=='SI'){_0xb11da7[_0xbb44('0x2b')]=_0x4af776['phone'];}var _0x3987ea={'url':_0x5321e7+'login?username='+_0x4af776[_0xbb44('0x28')]+'&password='+_0x4af776[_0xbb44('0x29')],'method':'GET'};rp(_0x3987ea)[_0xbb44('0x2c')](function(_0x2a3d42){var _0x3a1a77=_0x2a3d42[_0xbb44('0x2d')](';');var _0x482fee={'user_key':_0x3a1a77[0x0],'session_key':_0x3a1a77[0x1]};_0x3987ea={'url':_0x5321e7+_0xbb44('0x2e'),'method':_0xbb44('0x2f'),'headers':{'user_key':_0x482fee['user_key'],'Session_key':_0x482fee['session_key']},'json':!![],'body':_0xb11da7};return rp(_0x3987ea);})[_0xbb44('0x2c')](function(_0x587c05){if(_0x587c05[_0xbb44('0x30')]>=0x1){var _0x1347b5={'messageId':_0x587c05['internal_order_id']};if(_0x4af776[_0xbb44('0x2a')]!=='GP'||!_0x4af776[_0xbb44('0x31')]){_0x1347b5['read']=!![];}return _0x429942[_0xbb44('0x16')](_0x1347b5);}else{return logger['error'](_0xbb44('0x32'),'afterCreate',_0xbb44('0x33'),util[_0xbb44('0x26')](_0x587c05,{'showHidden':![],'depth':null}));}})[_0xbb44('0x24')](function(_0x12410f){return logger[_0xbb44('0x34')](_0xbb44('0x32'),'afterCreate',_0xbb44('0x33'),util[_0xbb44('0x26')](_0x12410f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbb44('0x32'),'afterCreate',_0xbb44('0x33'),_0xbb44('0x35'));}break;case'connectel':if(_0x4af776[_0xbb44('0x1b')]){var _0x30fe59={'recipient':_0xc3d194[_0xbb44('0x1c')],'message':_0xc3d194[_0xbb44('0x1f')],'sender':_0x4af776[_0xbb44('0x36')]||_0x4af776[_0xbb44('0x1c')],'authorization':_0x4af776[_0xbb44('0x1b')]};var _0x3ee3a9={'method':_0xbb44('0x2f'),'uri':_0xbb44('0x37'),'body':_0x30fe59,'json':!![]};rp(_0x3ee3a9)['then'](function(_0x4a38b1){var _0x56edd5={'messageId':_0x4a38b1[_0xbb44('0x38')]};if(!_0x4af776[_0xbb44('0x31')]){_0x56edd5[_0xbb44('0x39')]=!![];}return _0x429942[_0xbb44('0x16')](_0x56edd5);})[_0xbb44('0x24')](function(_0x4fead3){logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),'connectel',util[_0xbb44('0x26')](_0x4fead3,{'showHidden':![],'depth':null}));});}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),'afterCreate',_0xbb44('0x3a'),_0xbb44('0x3b'));}break;case _0xbb44('0x3c'):if(_0x4af776[_0xbb44('0x28')]&&_0x4af776[_0xbb44('0x29')]){var _0x30fe59={'messages':[{'source':_0xbb44('0x3d'),'to':_0xc3d194[_0xbb44('0x1c')],'body':_0xc3d194['body'],'from':_0x4af776[_0xbb44('0x36')]||_0x4af776['phone']}]};var _0x192a19=util[_0xbb44('0x3e')](_0xbb44('0x3f'),_0x4af776[_0xbb44('0x28')],_0x4af776[_0xbb44('0x29')]);var _0x3ee3a9={'method':_0xbb44('0x2f'),'uri':_0xbb44('0x40'),'body':_0x30fe59,'headers':{'Authorization':util[_0xbb44('0x3e')](_0xbb44('0x41'),new Buffer(_0x192a19)[_0xbb44('0x42')]('base64'))},'json':!![]};rp(_0x3ee3a9)['then'](function(_0x569c9d){if(_0x569c9d['http_code']>=0xc8&&_0x569c9d[_0xbb44('0x43')]<=0xce){if(_0x569c9d[_0xbb44('0x44')]&&_0x569c9d[_0xbb44('0x44')][_0xbb44('0x45')]>0x0){var _0x1631f5=_[_0xbb44('0x46')](_0x569c9d['data'][_0xbb44('0x1d')]);var _0x402238={'messageId':_0x1631f5[_0xbb44('0x47')]};if(!_0x4af776[_0xbb44('0x31')]){_0x402238[_0xbb44('0x39')]=!![];}return _0x429942[_0xbb44('0x16')](_0x402238);}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),'clickSend',util[_0xbb44('0x26')](_0x569c9d,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x48'),util['inspect'](_0x569c9d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x45ec53){logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x48'),util['inspect'](_0x45ec53,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x48'),_0xbb44('0x35'));}break;case _0xbb44('0x49'):if(_0x4af776['authId']&&_0x4af776['authToken']){var _0x30fe59={'dst':_0xc3d194[_0xbb44('0x1c')],'text':_0xc3d194[_0xbb44('0x1f')],'src':_0x4af776[_0xbb44('0x36')]||_0x4af776[_0xbb44('0x1c')],'url':_0x4af776[_0xbb44('0x20')]+_0xbb44('0x4a')+_0xc3d194['id']+_0xbb44('0x21')+_0x4af776['token']};var _0x192a19=util[_0xbb44('0x3e')](_0xbb44('0x3f'),_0x4af776[_0xbb44('0x4b')],_0x4af776[_0xbb44('0x1b')]);var _0x3ee3a9={'method':_0xbb44('0x2f'),'uri':util[_0xbb44('0x3e')](_0xbb44('0x4c'),_0x4af776[_0xbb44('0x4b')]),'body':_0x30fe59,'headers':{'Authorization':util[_0xbb44('0x3e')](_0xbb44('0x41'),new Buffer(_0x192a19)[_0xbb44('0x42')](_0xbb44('0x4d')))},'json':!![]};rp(_0x3ee3a9)[_0xbb44('0x2c')](function(_0x4a4e85){var _0x523567={'messageId':_0x4a4e85['message_uuid'][0x0]};return _0x429942['update'](_0x523567);})[_0xbb44('0x24')](function(_0x4f26ee){logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x49'),util[_0xbb44('0x26')](_0x4f26ee,{'showHidden':![],'depth':null}));});}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),'plivo',_0xbb44('0x4e'));}break;case _0xbb44('0x4f'):if(_0x4af776['username']&&_0x4af776[_0xbb44('0x29')]){if(_0x4af776[_0xbb44('0x50')]){var _0x1fee60={'method':_0xbb44('0x2f'),'uri':_0x4af776[_0xbb44('0x50')]+_0xbb44('0x51'),'body':{'username':_0x4af776['username'],'password':_0x4af776[_0xbb44('0x29')]},'json':!![]};return rp(_0x1fee60)['then'](function(_0x4d95c){var _0xf67178={'method':_0xbb44('0x2f'),'uri':_0x4af776[_0xbb44('0x50')]+_0xbb44('0x52'),'body':{'messages':[{'from':_0x4af776[_0xbb44('0x1c')],'destinations':[{'to':_0xc3d194[_0xbb44('0x1c')]}],'text':_0xc3d194[_0xbb44('0x1f')],'notifyUrl':_0x4af776[_0xbb44('0x20')]+_0xbb44('0x4a')+_0xc3d194['id']+'/status?token='+_0x4af776['token'],'notifyContentType':_0xbb44('0x53'),'callbackData':_0x4af776['phone']+';'+_0xc3d194[_0xbb44('0x1f')]}]},'headers':{'Authorization':_0xbb44('0x54')+_0x4d95c['token']},'json':!![]};return rp(_0xf67178)[_0xbb44('0x2c')](function(_0x3b22cd){if(_0x3b22cd[_0xbb44('0x1d')]){var _0x1295fc={'messageId':_0x3b22cd[_0xbb44('0x1d')][0x0][_0xbb44('0xc')]};if(!_0x4af776['deliveryReport']){_0x1295fc[_0xbb44('0x39')]=!![];}return _0x429942['update'](_0x1295fc);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbb44('0x25'),_0xbb44('0x4f'),util['inspect'](_0x3b22cd,{'showHidden':![],'depth':null}));}});})[_0xbb44('0x24')](function(_0x30b3a3){return logger['error'](_0xbb44('0x32'),'afterCreate',_0xbb44('0x4f'),util[_0xbb44('0x26')](_0x30b3a3,{'showHidden':![],'depth':null}));});}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x4f'),_0xbb44('0x55'));}}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x4f'),_0xbb44('0x35'));}break;case _0xbb44('0x56'):var _0x88ea23=require(_0xbb44('0x57'));if(_0x4af776[_0xbb44('0x58')]){var _0xe5e7e7={};_0xe5e7e7[_0xbb44('0x59')]=_0x4af776[_0xbb44('0x28')];_0xe5e7e7[_0xbb44('0x1c')]=_0xc3d194[_0xbb44('0x1c')];_0xe5e7e7[_0xbb44('0x2b')]=_0x4af776[_0xbb44('0x1c')];_0xe5e7e7[_0xbb44('0x5a')]=_0xc3d194[_0xbb44('0x1f')];_0xe5e7e7['timestamp']=+new Date();var _0x242e9e='';var _0x46a80f='';var _0xd580b5=Object[_0xbb44('0x5b')](_0xe5e7e7);_0xd580b5['sort']();for(var _0x11a262=0x0;_0x11a262<_0xd580b5[_0xbb44('0x5c')];_0x11a262++){if(_0x242e9e!=''){_0x242e9e+='&';}_0x242e9e+=_0xd580b5[_0x11a262]+'='+encodeURIComponent(_0xe5e7e7[_0xd580b5[_0x11a262]]);_0x46a80f+=_0xe5e7e7[_0xd580b5[_0x11a262]];}_0x46a80f+=_0x4af776['apiKey'];_0x46a80f=_0x88ea23[_0xbb44('0x5d')](_0xbb44('0x5e'))['update'](_0x46a80f)[_0xbb44('0x5f')]('hex');if(_0x242e9e!==''){_0x242e9e+='&';}_0x242e9e+=_0xbb44('0x60')+_0x46a80f;var _0x3987ea={'method':_0xbb44('0x61'),'uri':_0x4af776['baseUrl']+'/external/get/send.php?'+_0x242e9e,'json':!![]};return rp(_0x3987ea)[_0xbb44('0x2c')](function(_0xb4a18a){var _0x21b4ec=Object['keys'](_0xb4a18a);if(_0xb4a18a[_0x21b4ec[0x0]]['error']&&parseInt(_0xb4a18a[_0x21b4ec[0x0]][_0xbb44('0x34')])===0x0){var _0xea6a3b={'messageId':_0xb4a18a[_0x21b4ec[0x0]][_0xbb44('0x62')]};if(!_0x4af776[_0xbb44('0x31')]){_0xea6a3b['read']=!![];}return _0x429942[_0xbb44('0x16')](_0xea6a3b);}else{return logger['error'](_0xbb44('0x32'),_0xbb44('0x25'),'csc',util[_0xbb44('0x26')](_0xb4a18a[_0xbb44('0x34')],{'showHidden':![],'depth':null}));}})[_0xbb44('0x24')](function(_0x445926){return logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x56'),util[_0xbb44('0x26')](_0x445926,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x56'),_0xbb44('0x63'));}break;case _0xbb44('0x64'):if(_0x4af776[_0xbb44('0x58')]){var _0x42d546={'method':'POST','uri':_0xbb44('0x65'),'headers':{'Authorization':_0x4af776['apiKey']},'body':{'content':_0xc3d194['body'],'to':[_0xc3d194[_0xbb44('0x1c')]],'from':_0x4af776[_0xbb44('0x1c')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x42d546)[_0xbb44('0x2c')](function(_0x462769){if(!_0x462769[_0xbb44('0x34')]){var _0x4aabcb={'messageId':_0x462769[_0xbb44('0x1d')][0x0][_0xbb44('0x66')]};if(!_0x4af776[_0xbb44('0x31')]){_0x4aabcb[_0xbb44('0x39')]=!![];}return _0x429942[_0xbb44('0x16')](_0x4aabcb);}else{return logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x64'),util[_0xbb44('0x26')](_0x462769['error'],{'showHidden':![],'depth':null}));}})[_0xbb44('0x24')](function(_0x3e47c1){return logger[_0xbb44('0x34')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbb44('0x25'),'clickatell',util['inspect'](_0x3e47c1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbb44('0x32'),'afterCreate',_0xbb44('0x64'),_0xbb44('0x63'));}break;case'bandwidth':if(_0x4af776[_0xbb44('0x28')]&&_0x4af776[_0xbb44('0x29')]){var _0x192a19=util[_0xbb44('0x3e')](_0xbb44('0x3f'),_0x4af776[_0xbb44('0x28')],_0x4af776['password']);var _0x3ee3a9={'method':'POST','uri':_0xbb44('0x67')+_0x4af776[_0xbb44('0x68')]+_0xbb44('0x69'),'body':{'to':[_0xc3d194[_0xbb44('0x1c')]],'text':_0xc3d194[_0xbb44('0x1f')],'from':_0x4af776[_0xbb44('0x1c')],'applicationId':_0x4af776[_0xbb44('0x6a')]},'headers':{'Authorization':util[_0xbb44('0x3e')](_0xbb44('0x41'),new Buffer(_0x192a19)[_0xbb44('0x42')](_0xbb44('0x4d')))},'json':!![]};rp(_0x3ee3a9)[_0xbb44('0x2c')](function(_0x7db298){if(_0x7db298['id']){var _0x18d41f={'messageId':_0x7db298['id']};return _0x429942[_0xbb44('0x16')](_0x18d41f);}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),'afterCreate',_0xbb44('0x6b'),util[_0xbb44('0x26')](_0x7db298,{'showHidden':![],'depth':null}));}})[_0xbb44('0x24')](function(_0x23592c){logger[_0xbb44('0x34')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbb44('0x25'),_0xbb44('0x6b'),util[_0xbb44('0x26')](_0x23592c,{'showHidden':![],'depth':null}));});}else{logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),'bandwidth',_0xbb44('0x35'));}break;case _0xbb44('0x6c'):if(_0x4af776['apiKey']){var _0x43f42d={};var _0x3987ea={'method':_0xbb44('0x2f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xbb44('0x6d')+_0x4af776[_0xbb44('0x58')],'Content-Type':_0xbb44('0x53')},'body':{'from':_0x4af776[_0xbb44('0x1c')],'to':_0xc3d194[_0xbb44('0x1c')],'text':_0xc3d194[_0xbb44('0x1f')]},'json':!![]};return rp(_0x3987ea)[_0xbb44('0x2c')](function(_0x3d32bb){if(_0x3d32bb[_0xbb44('0x6e')]==0xca){_0x43f42d['message']=_0x3d32bb;var _0x2884d5={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xbb44('0x6d')+_0x4af776[_0xbb44('0x58')],'Content-Type':_0xbb44('0x53')},'body':{'refid':_0x43f42d[_0xbb44('0x6f')]['refid']},'json':!![]};return rp(_0x2884d5)[_0xbb44('0x2c')](function(_0x484c28){_0x43f42d['status']=_0x484c28;var _0x94cb72={'messageId':_0x43f42d[_0xbb44('0x6f')][_0xbb44('0x70')],'read':!![]};return _0x429942[_0xbb44('0x16')](_0x94cb72);});}else{return logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x6c'),util['inspect'](_0x3d32bb,{'showHidden':![],'depth':null}));}})['catch'](function(_0x480280){return logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x6c'),util[_0xbb44('0x26')](_0x480280,{'showHidden':![],'depth':null}));});}else{return logger[_0xbb44('0x34')](_0xbb44('0x32'),_0xbb44('0x25'),_0xbb44('0x6c'),_0xbb44('0x71'));}break;}}})[_0xbb44('0x72')](function(){_0x35470e();});}else{_0x35470e();}}},'charset':_0xbb44('0x73'),'collate':_0xbb44('0x74')});}; \ No newline at end of file +var _0x2495=['%s:%s','POST','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','head','clickSend','authId','Basic\x20%s','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','keys','sort','createHash','md5','digest','hex','signature=','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','base64','intelepeer','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','direction','isNil','SmsInteractionId','then','update','createdAt','catch','error','out','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','user_key','session_key','total_sent','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0x2495,0x117));var _0x5249=function(_0x2f17d1,_0x5d37be){_0x2f17d1=_0x2f17d1-0x0;var _0x31756f=_0x2495[_0x2f17d1];return _0x31756f;};'use strict';var _=require('lodash');var util=require(_0x5249('0x0'));var logger=require(_0x5249('0x1'))(_0x5249('0x2'));var moment=require(_0x5249('0x3'));var BPromise=require('bluebird');var rp=require(_0x5249('0x4'));var fs=require('fs');var path=require(_0x5249('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5249('0x6'));module[_0x5249('0x7')]=function(_0x3234be,_0x5a2ba4){return _0x3234be[_0x5249('0x8')](_0x5249('0x9'),attributes,{'tableName':_0x5249('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5249('0xb')]},{'name':'fti_sms_messages','fields':[_0x5249('0xc')],'type':_0x5249('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ef3bb,_0x44aa8f,_0x41be94){var _0x392606=_0x3234be[_0x5249('0xe')];var _0x3dcf9d=_0x3ef3bb['get']({'plain':!![]});if(_0x3dcf9d[_0x5249('0xf')]['toLowerCase']()==='in'||_0x3dcf9d[_0x5249('0xf')]['toLowerCase']()==='out'&&!_0x3dcf9d['secret']&&!_['isNil'](_0x3dcf9d['UserId'])&&!_[_0x5249('0x10')](_0x3dcf9d[_0x5249('0x11')])){_0x392606['SmsInteraction']['findOne']({'where':{'id':_0x3dcf9d[_0x5249('0x11')]}})[_0x5249('0x12')](function(_0x3efa4b){if(_0x3efa4b){_0x3efa4b[_0x5249('0x13')]({'lastMsgAt':_0x3dcf9d[_0x5249('0x14')],'lastMsgDirection':_0x3dcf9d['direction']['toLowerCase']()});}})[_0x5249('0x15')](function(_0x3cbc98){console[_0x5249('0x16')](_0x3cbc98);});}if(_0x3dcf9d[_0x5249('0xf')]===_0x5249('0x17')&&!_0x3dcf9d[_0x5249('0x18')]){var _0x39a156;_0x392606[_0x5249('0x19')][_0x5249('0x1a')]({'where':{'id':_0x3dcf9d[_0x5249('0x1b')]},'raw':!![]})[_0x5249('0x12')](function(_0x2b8e5a){_0x39a156=_0x2b8e5a;if(_0x39a156&&_0x39a156[_0x5249('0x1c')]){switch(_0x39a156['type']){case _0x5249('0x1d'):var _0x460f15=require(_0x5249('0x1d'));if(_0x39a156[_0x5249('0x1e')]&&_0x39a156[_0x5249('0x1f')]&&_0x39a156[_0x5249('0x20')]){var _0x4816c4=new _0x460f15(_0x39a156['accountSid'],_0x39a156['authToken']);_0x4816c4[_0x5249('0x21')][_0x5249('0x22')]({'body':_0x3dcf9d[_0x5249('0xc')],'to':_0x3dcf9d[_0x5249('0x20')],'from':_0x39a156['phone'],'statusCallback':_0x39a156[_0x5249('0x23')]+_0x5249('0x24')+_0x3dcf9d['id']+_0x5249('0x25')+_0x39a156[_0x5249('0x26')]})[_0x5249('0x12')](function(_0x8181db){if(_0x8181db[_0x5249('0x27')]){return _0x3ef3bb[_0x5249('0x13')]({'messageId':_0x8181db[_0x5249('0x27')]});}})[_0x5249('0x15')](function(_0x53474c){logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5249('0x1d'),util[_0x5249('0x28')](_0x53474c,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x1d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x5249('0x2b'):var _0x2afe15='https://api.skebby.it/API/v1.0/REST/';if(_0x39a156[_0x5249('0x2c')]&&_0x39a156['password']){var _0x33fc83={'recipient':[_0x3dcf9d[_0x5249('0x20')]],'message':_0x3dcf9d['body'],'message_type':_0x39a156[_0x5249('0x2d')]};if(_0x39a156[_0x5249('0x2d')]&&_0x39a156[_0x5249('0x2d')]!=='SI'){_0x33fc83[_0x5249('0x2e')]=_0x39a156[_0x5249('0x20')];}var _0x3d5159={'url':_0x2afe15+_0x5249('0x2f')+_0x39a156['username']+_0x5249('0x30')+_0x39a156[_0x5249('0x31')],'method':_0x5249('0x32')};rp(_0x3d5159)[_0x5249('0x12')](function(_0x506285){var _0x17ed91=_0x506285[_0x5249('0x33')](';');var _0x5160a1={'user_key':_0x17ed91[0x0],'session_key':_0x17ed91[0x1]};_0x3d5159={'url':_0x2afe15+_0x5249('0x34'),'method':'POST','headers':{'user_key':_0x5160a1[_0x5249('0x35')],'Session_key':_0x5160a1[_0x5249('0x36')]},'json':!![],'body':_0x33fc83};return rp(_0x3d5159);})['then'](function(_0x2f4e21){if(_0x2f4e21[_0x5249('0x37')]>=0x1){var _0x458220={'messageId':_0x2f4e21[_0x5249('0x38')]};if(_0x39a156[_0x5249('0x2d')]!=='GP'||!_0x39a156['deliveryReport']){_0x458220[_0x5249('0x39')]=!![];}return _0x3ef3bb[_0x5249('0x13')](_0x458220);}else{return logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x2b'),util[_0x5249('0x28')](_0x2f4e21,{'showHidden':![],'depth':null}));}})['catch'](function(_0x426dff){return logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x2b'),util[_0x5249('0x28')](_0x426dff,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),'skebby',_0x5249('0x3a'));}break;case _0x5249('0x3b'):if(_0x39a156[_0x5249('0x1f')]){var _0x465f7c={'recipient':_0x3dcf9d[_0x5249('0x20')],'message':_0x3dcf9d[_0x5249('0xc')],'sender':_0x39a156[_0x5249('0x3c')]||_0x39a156[_0x5249('0x20')],'authorization':_0x39a156[_0x5249('0x1f')]};var _0x44aa8f={'method':'POST','uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x465f7c,'json':!![]};rp(_0x44aa8f)[_0x5249('0x12')](function(_0x2ae04c){var _0x2fdd0f={'messageId':_0x2ae04c['requestid']};if(!_0x39a156[_0x5249('0x3d')]){_0x2fdd0f[_0x5249('0x39')]=!![];}return _0x3ef3bb['update'](_0x2fdd0f);})['catch'](function(_0x59bf05){logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x3b'),util['inspect'](_0x59bf05,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x3b'),_0x5249('0x3e'));}break;case _0x5249('0x3f'):if(_0x39a156[_0x5249('0x2c')]&&_0x39a156[_0x5249('0x31')]){var _0x465f7c={'messages':[{'source':_0x5249('0x40'),'to':_0x3dcf9d[_0x5249('0x20')],'body':_0x3dcf9d[_0x5249('0xc')],'from':_0x39a156[_0x5249('0x3c')]||_0x39a156[_0x5249('0x20')]}]};var _0x1ed358=util[_0x5249('0x41')](_0x5249('0x42'),_0x39a156['username'],_0x39a156[_0x5249('0x31')]);var _0x44aa8f={'method':_0x5249('0x43'),'uri':_0x5249('0x44'),'body':_0x465f7c,'headers':{'Authorization':util[_0x5249('0x41')]('Basic\x20%s',new Buffer(_0x1ed358)[_0x5249('0x45')]('base64'))},'json':!![]};rp(_0x44aa8f)[_0x5249('0x12')](function(_0x2918f2){if(_0x2918f2[_0x5249('0x46')]>=0xc8&&_0x2918f2[_0x5249('0x46')]<=0xce){if(_0x2918f2[_0x5249('0x47')]&&_0x2918f2[_0x5249('0x47')]['queued_count']>0x0){var _0x43d2bb=_[_0x5249('0x48')](_0x2918f2[_0x5249('0x47')][_0x5249('0x21')]);var _0x4e6bf5={'messageId':_0x43d2bb['message_id']};if(!_0x39a156[_0x5249('0x3d')]){_0x4e6bf5[_0x5249('0x39')]=!![];}return _0x3ef3bb['update'](_0x4e6bf5);}else{logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),'clickSend',util[_0x5249('0x28')](_0x2918f2,{'showHidden':![],'depth':null}));}}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x49'),util['inspect'](_0x2918f2,{'showHidden':![],'depth':null}));}})[_0x5249('0x15')](function(_0x4a28a1){logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x49'),util[_0x5249('0x28')](_0x4a28a1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x49'),_0x5249('0x3a'));}break;case'plivo':if(_0x39a156[_0x5249('0x4a')]&&_0x39a156[_0x5249('0x1f')]){var _0x465f7c={'dst':_0x3dcf9d[_0x5249('0x20')],'text':_0x3dcf9d[_0x5249('0xc')],'src':_0x39a156['senderString']||_0x39a156[_0x5249('0x20')],'url':_0x39a156[_0x5249('0x23')]+'/api/sms/messages/'+_0x3dcf9d['id']+'/status?token='+_0x39a156[_0x5249('0x26')]};var _0x1ed358=util[_0x5249('0x41')](_0x5249('0x42'),_0x39a156[_0x5249('0x4a')],_0x39a156[_0x5249('0x1f')]);var _0x44aa8f={'method':'POST','uri':util[_0x5249('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x39a156[_0x5249('0x4a')]),'body':_0x465f7c,'headers':{'Authorization':util[_0x5249('0x41')](_0x5249('0x4b'),new Buffer(_0x1ed358)['toString']('base64'))},'json':!![]};rp(_0x44aa8f)[_0x5249('0x12')](function(_0xb81f36){var _0x250336={'messageId':_0xb81f36['message_uuid'][0x0]};return _0x3ef3bb[_0x5249('0x13')](_0x250336);})[_0x5249('0x15')](function(_0x49ca19){logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x4c'),util[_0x5249('0x28')](_0x49ca19,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5249('0x4c'),_0x5249('0x4d'));}break;case _0x5249('0x4e'):if(_0x39a156[_0x5249('0x2c')]&&_0x39a156[_0x5249('0x31')]){if(_0x39a156['baseUrl']){var _0x9d4970={'method':_0x5249('0x43'),'uri':_0x39a156[_0x5249('0x4f')]+'/auth/1/session','body':{'username':_0x39a156[_0x5249('0x2c')],'password':_0x39a156['password']},'json':!![]};return rp(_0x9d4970)[_0x5249('0x12')](function(_0x29147d){var _0x4aa858={'method':'POST','uri':_0x39a156[_0x5249('0x4f')]+_0x5249('0x50'),'body':{'messages':[{'from':_0x39a156['phone'],'destinations':[{'to':_0x3dcf9d[_0x5249('0x20')]}],'text':_0x3dcf9d['body'],'notifyUrl':_0x39a156['remote']+_0x5249('0x24')+_0x3dcf9d['id']+_0x5249('0x25')+_0x39a156[_0x5249('0x26')],'notifyContentType':_0x5249('0x51'),'callbackData':_0x39a156[_0x5249('0x20')]+';'+_0x3dcf9d['body']}]},'headers':{'Authorization':_0x5249('0x52')+_0x29147d[_0x5249('0x26')]},'json':!![]};return rp(_0x4aa858)[_0x5249('0x12')](function(_0x41a148){if(_0x41a148[_0x5249('0x21')]){var _0x17d858={'messageId':_0x41a148[_0x5249('0x21')][0x0][_0x5249('0xb')]};if(!_0x39a156[_0x5249('0x3d')]){_0x17d858[_0x5249('0x39')]=!![];}return _0x3ef3bb[_0x5249('0x13')](_0x17d858);}else{return logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x4e'),util[_0x5249('0x28')](_0x41a148,{'showHidden':![],'depth':null}));}});})[_0x5249('0x15')](function(_0xaa60f6){return logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x4e'),util[_0x5249('0x28')](_0xaa60f6,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x4e'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x5249('0x53'):var _0x1077f0=require(_0x5249('0x54'));if(_0x39a156[_0x5249('0x55')]){var _0x554309={};_0x554309[_0x5249('0x56')]=_0x39a156[_0x5249('0x2c')];_0x554309[_0x5249('0x20')]=_0x3dcf9d[_0x5249('0x20')];_0x554309['sender']=_0x39a156[_0x5249('0x20')];_0x554309[_0x5249('0x57')]=_0x3dcf9d[_0x5249('0xc')];_0x554309['timestamp']=+new Date();var _0x772d38='';var _0x4a367b='';var _0x1c111d=Object[_0x5249('0x58')](_0x554309);_0x1c111d[_0x5249('0x59')]();for(var _0x4f5b71=0x0;_0x4f5b71<_0x1c111d['length'];_0x4f5b71++){if(_0x772d38!=''){_0x772d38+='&';}_0x772d38+=_0x1c111d[_0x4f5b71]+'='+encodeURIComponent(_0x554309[_0x1c111d[_0x4f5b71]]);_0x4a367b+=_0x554309[_0x1c111d[_0x4f5b71]];}_0x4a367b+=_0x39a156[_0x5249('0x55')];_0x4a367b=_0x1077f0[_0x5249('0x5a')](_0x5249('0x5b'))[_0x5249('0x13')](_0x4a367b)[_0x5249('0x5c')](_0x5249('0x5d'));if(_0x772d38!==''){_0x772d38+='&';}_0x772d38+=_0x5249('0x5e')+_0x4a367b;var _0x3d5159={'method':_0x5249('0x32'),'uri':_0x39a156[_0x5249('0x4f')]+_0x5249('0x5f')+_0x772d38,'json':!![]};return rp(_0x3d5159)['then'](function(_0x3b7253){var _0x23d01d=Object[_0x5249('0x58')](_0x3b7253);if(_0x3b7253[_0x23d01d[0x0]][_0x5249('0x16')]&&parseInt(_0x3b7253[_0x23d01d[0x0]]['error'])===0x0){var _0x552399={'messageId':_0x3b7253[_0x23d01d[0x0]]['id_sms']};if(!_0x39a156['deliveryReport']){_0x552399[_0x5249('0x39')]=!![];}return _0x3ef3bb['update'](_0x552399);}else{return logger['error'](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x53'),util[_0x5249('0x28')](_0x3b7253['error'],{'showHidden':![],'depth':null}));}})[_0x5249('0x15')](function(_0x460404){return logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x53'),util[_0x5249('0x28')](_0x460404,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x53'),'Missing\x20parameters:\x20apiKey');}break;case _0x5249('0x60'):if(_0x39a156['apiKey']){var _0x59ccb2={'method':_0x5249('0x43'),'uri':_0x5249('0x61'),'headers':{'Authorization':_0x39a156[_0x5249('0x55')]},'body':{'content':_0x3dcf9d[_0x5249('0xc')],'to':[_0x3dcf9d['phone']],'from':_0x39a156[_0x5249('0x20')],'binary':![],'clientMessageId':'uuid','charset':_0x5249('0x62')},'json':!![]};rp(_0x59ccb2)['then'](function(_0x1876ef){if(!_0x1876ef[_0x5249('0x16')]){var _0x3dfe79={'messageId':_0x1876ef[_0x5249('0x21')][0x0][_0x5249('0x63')]};if(!_0x39a156[_0x5249('0x3d')]){_0x3dfe79[_0x5249('0x39')]=!![];}return _0x3ef3bb[_0x5249('0x13')](_0x3dfe79);}else{return logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x60'),util[_0x5249('0x28')](_0x1876ef['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x23eff1){return logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),_0x5249('0x60'),util[_0x5249('0x28')](_0x23eff1,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x60'),'Missing\x20parameters:\x20apiKey');}break;case _0x5249('0x64'):if(_0x39a156[_0x5249('0x2c')]&&_0x39a156['password']){var _0x1ed358=util['format'](_0x5249('0x42'),_0x39a156['username'],_0x39a156[_0x5249('0x31')]);var _0x44aa8f={'method':_0x5249('0x43'),'uri':_0x5249('0x65')+_0x39a156[_0x5249('0x66')]+_0x5249('0x67'),'body':{'to':[_0x3dcf9d[_0x5249('0x20')]],'text':_0x3dcf9d[_0x5249('0xc')],'from':_0x39a156[_0x5249('0x20')],'applicationId':_0x39a156[_0x5249('0x68')]},'headers':{'Authorization':util[_0x5249('0x41')](_0x5249('0x4b'),new Buffer(_0x1ed358)[_0x5249('0x45')](_0x5249('0x69')))},'json':!![]};rp(_0x44aa8f)[_0x5249('0x12')](function(_0x471a0c){if(_0x471a0c['id']){var _0x3cbf0e={'messageId':_0x471a0c['id']};return _0x3ef3bb['update'](_0x3cbf0e);}else{logger[_0x5249('0x16')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x5249('0x64'),util['inspect'](_0x471a0c,{'showHidden':![],'depth':null}));}})[_0x5249('0x15')](function(_0x36b48c){logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x64'),util['inspect'](_0x36b48c,{'showHidden':![],'depth':null}));});}else{logger[_0x5249('0x16')](_0x5249('0x29'),'afterCreate',_0x5249('0x64'),_0x5249('0x3a'));}break;case _0x5249('0x6a'):if(_0x39a156[_0x5249('0x55')]){var _0x284a48={};var _0x3d5159={'method':_0x5249('0x43'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x39a156[_0x5249('0x55')],'Content-Type':_0x5249('0x51')},'body':{'from':_0x39a156[_0x5249('0x20')],'to':_0x3dcf9d[_0x5249('0x20')],'text':_0x3dcf9d[_0x5249('0xc')]},'json':!![]};return rp(_0x3d5159)[_0x5249('0x12')](function(_0x2c2fdd){if(_0x2c2fdd[_0x5249('0x6b')]==0xca){_0x284a48[_0x5249('0x6c')]=_0x2c2fdd;var _0x5cab7a={'method':_0x5249('0x43'),'uri':_0x5249('0x6d'),'headers':{'Authorization':_0x5249('0x6e')+_0x39a156[_0x5249('0x55')],'Content-Type':_0x5249('0x51')},'body':{'refid':_0x284a48[_0x5249('0x6c')][_0x5249('0x6f')]},'json':!![]};return rp(_0x5cab7a)['then'](function(_0x4c59eb){_0x284a48['status']=_0x4c59eb;var _0x2eecba={'messageId':_0x284a48[_0x5249('0x6c')][_0x5249('0x6f')],'read':!![]};return _0x3ef3bb[_0x5249('0x13')](_0x2eecba);});}else{return logger[_0x5249('0x16')](_0x5249('0x29'),'afterCreate','intelepeer',util[_0x5249('0x28')](_0x2c2fdd,{'showHidden':![],'depth':null}));}})['catch'](function(_0x16c0a0){return logger[_0x5249('0x16')](_0x5249('0x29'),_0x5249('0x2a'),_0x5249('0x6a'),util['inspect'](_0x16c0a0,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5249('0x2a'),'intelepeer',_0x5249('0x70'));}break;}}})[_0x5249('0x71')](function(){_0x41be94();});}else{_0x41be94();}}},'charset':'utf8mb4','collate':_0x5249('0x72')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index dd7001a..00e45b8 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 _0x5ba1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','SmsMessage','create','body','options','raw','CreateSmsMessage','lodash','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ba1,0xc9));var _0x15ba=function(_0x517637,_0x1da135){_0x517637=_0x517637-0x0;var _0x4c320d=_0x5ba1[_0x517637];return _0x4c320d;};'use strict';var _=require(_0x15ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x15ba('0x1'));var rs=require(_0x15ba('0x2'));var fs=require('fs');var Redis=require(_0x15ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x15ba('0x4'));var logger=require(_0x15ba('0x5'))(_0x15ba('0x6'));var config=require(_0x15ba('0x7'));var jayson=require(_0x15ba('0x8'));var client=jayson[_0x15ba('0x9')][_0x15ba('0xa')]({'port':0x232a});config['redis']=_[_0x15ba('0xb')](config[_0x15ba('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x15ba('0xd'))(new Redis(config[_0x15ba('0xc')]));require(_0x15ba('0xe'))[_0x15ba('0xf')](socket);function respondWithRpcPromise(_0x577121,_0x35c9c8,_0x503529){return new BPromise(function(_0x4866af,_0x5a8b16){return client[_0x15ba('0x10')](_0x577121,_0x503529)[_0x15ba('0x11')](function(_0xd2d4d6){logger[_0x15ba('0x12')]('SmsMessage,\x20%s,\x20%s',_0x35c9c8,_0x15ba('0x13'));logger[_0x15ba('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x35c9c8,_0x15ba('0x13'),JSON[_0x15ba('0x15')](_0xd2d4d6));if(_0xd2d4d6['error']){if(_0xd2d4d6[_0x15ba('0x16')][_0x15ba('0x17')]===0x1f4){logger[_0x15ba('0x16')](_0x15ba('0x18'),_0x35c9c8,_0xd2d4d6['error'][_0x15ba('0x19')]);return _0x5a8b16(_0xd2d4d6[_0x15ba('0x16')]['message']);}logger[_0x15ba('0x16')](_0x15ba('0x18'),_0x35c9c8,_0xd2d4d6['error']['message']);return _0x4866af(_0xd2d4d6[_0x15ba('0x16')][_0x15ba('0x19')]);}else{logger[_0x15ba('0x12')]('SmsMessage,\x20%s,\x20%s',_0x35c9c8,'request\x20sent');_0x4866af(_0xd2d4d6[_0x15ba('0x1a')][_0x15ba('0x19')]);}})[_0x15ba('0x1b')](function(_0x2a012b){logger[_0x15ba('0x16')](_0x15ba('0x18'),_0x35c9c8,_0x2a012b);_0x5a8b16(_0x2a012b);});});}exports['CreateSmsMessage']=function(_0x47c015){var _0x45f67a=this;return new Promise(function(_0x10ab08,_0x46cf4d){return db[_0x15ba('0x1c')][_0x15ba('0x1d')](_0x47c015[_0x15ba('0x1e')],{'raw':_0x47c015[_0x15ba('0x1f')]?_0x47c015[_0x15ba('0x1f')][_0x15ba('0x20')]===undefined?!![]:![]:!![]})[_0x15ba('0x11')](function(_0x579da7){logger[_0x15ba('0x12')]('CreateSmsMessage',_0x47c015);logger[_0x15ba('0x14')](_0x15ba('0x21'),_0x47c015,JSON[_0x15ba('0x15')](_0x579da7));_0x10ab08(_0x579da7);})[_0x15ba('0x1b')](function(_0xdc2b12){logger[_0x15ba('0x16')](_0x15ba('0x21'),_0xdc2b12['message'],_0x47c015);_0x46cf4d(_0x45f67a[_0x15ba('0x16')](0x1f4,_0xdc2b12[_0x15ba('0x19')]));});});}; \ No newline at end of file +var _0xb7ee=['redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSmsMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x979c28,_0x4c2fb9){var _0xb6a60f=function(_0x3f540e){while(--_0x3f540e){_0x979c28['push'](_0x979c28['shift']());}};_0xb6a60f(++_0x4c2fb9);}(_0xb7ee,0xfb));var _0xeb7e=function(_0x1640a2,_0x1feb1f){_0x1640a2=_0x1640a2-0x0;var _0x33703d=_0xb7ee[_0x1640a2];return _0x33703d;};'use strict';var _=require(_0xeb7e('0x0'));var util=require(_0xeb7e('0x1'));var moment=require(_0xeb7e('0x2'));var BPromise=require(_0xeb7e('0x3'));var rs=require(_0xeb7e('0x4'));var fs=require('fs');var Redis=require(_0xeb7e('0x5'));var db=require(_0xeb7e('0x6'))['db'];var utils=require(_0xeb7e('0x7'));var logger=require(_0xeb7e('0x8'))(_0xeb7e('0x9'));var config=require('../../config/environment');var jayson=require(_0xeb7e('0xa'));var client=jayson[_0xeb7e('0xb')][_0xeb7e('0xc')]({'port':0x232a});config[_0xeb7e('0xd')]=_['defaults'](config[_0xeb7e('0xd')],{'host':_0xeb7e('0xe'),'port':0x18eb});var socket=require(_0xeb7e('0xf'))(new Redis(config['redis']));require(_0xeb7e('0x10'))['register'](socket);function respondWithRpcPromise(_0x3b6bb6,_0x8b2441,_0x11c418){return new BPromise(function(_0x447919,_0x2b5250){return client[_0xeb7e('0x11')](_0x3b6bb6,_0x11c418)[_0xeb7e('0x12')](function(_0x21dd84){logger[_0xeb7e('0x13')](_0xeb7e('0x14'),_0x8b2441,_0xeb7e('0x15'));logger[_0xeb7e('0x16')](_0xeb7e('0x17'),_0x8b2441,'request\x20sent',JSON[_0xeb7e('0x18')](_0x21dd84));if(_0x21dd84[_0xeb7e('0x19')]){if(_0x21dd84[_0xeb7e('0x19')][_0xeb7e('0x1a')]===0x1f4){logger[_0xeb7e('0x19')](_0xeb7e('0x14'),_0x8b2441,_0x21dd84[_0xeb7e('0x19')][_0xeb7e('0x1b')]);return _0x2b5250(_0x21dd84[_0xeb7e('0x19')][_0xeb7e('0x1b')]);}logger[_0xeb7e('0x19')](_0xeb7e('0x14'),_0x8b2441,_0x21dd84[_0xeb7e('0x19')][_0xeb7e('0x1b')]);return _0x447919(_0x21dd84[_0xeb7e('0x19')][_0xeb7e('0x1b')]);}else{logger[_0xeb7e('0x13')](_0xeb7e('0x14'),_0x8b2441,'request\x20sent');_0x447919(_0x21dd84['result'][_0xeb7e('0x1b')]);}})['catch'](function(_0x24b0cf){logger[_0xeb7e('0x19')](_0xeb7e('0x14'),_0x8b2441,_0x24b0cf);_0x2b5250(_0x24b0cf);});});}exports[_0xeb7e('0x1c')]=function(_0x2d6508){var _0x76f49a=this;return new Promise(function(_0x390f47,_0x132f27){return db['SmsMessage'][_0xeb7e('0x1d')](_0x2d6508[_0xeb7e('0x1e')],{'raw':_0x2d6508[_0xeb7e('0x1f')]?_0x2d6508['options'][_0xeb7e('0x20')]===undefined?!![]:![]:!![]})[_0xeb7e('0x12')](function(_0x5a2f2f){logger[_0xeb7e('0x13')](_0xeb7e('0x1c'),_0x2d6508);logger['debug'](_0xeb7e('0x1c'),_0x2d6508,JSON[_0xeb7e('0x18')](_0x5a2f2f));_0x390f47(_0x5a2f2f);})['catch'](function(_0x5d30b3){logger[_0xeb7e('0x19')](_0xeb7e('0x1c'),_0x5d30b3[_0xeb7e('0x1b')],_0x2d6508);_0x132f27(_0x76f49a[_0xeb7e('0x19')](0x1f4,_0x5d30b3[_0xeb7e('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 35aa1fc..8172192 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 _0x0c5f=['emit','smsMessage:','save','remove'];(function(_0x595dc5,_0x17a2ce){var _0x371861=function(_0x469873){while(--_0x469873){_0x595dc5['push'](_0x595dc5['shift']());}};_0x371861(++_0x17a2ce);}(_0x0c5f,0x11a));var _0xf0c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0c5f[_0x20a584];return _0x4b41a8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xf0c5('0x0'),_0xf0c5('0x1'),'update'];function createListener(_0x58006e,_0x31c486){return function(_0x143630){_0x31c486[_0xf0c5('0x2')](_0x58006e,_0x143630);};}function removeListener(_0x4ddc54,_0x54f7dc){return function(){SmsMessageEvents['removeListener'](_0x4ddc54,_0x54f7dc);};}exports['register']=function(_0x178a61){for(var _0x594063=0x0,_0x5ab6c0=events['length'];_0x594063<_0x5ab6c0;_0x594063++){var _0x141c26=events[_0x594063];var _0x2d453a=createListener(_0xf0c5('0x3')+_0x141c26,_0x178a61);SmsMessageEvents['on'](_0x141c26,_0x2d453a);}}; \ No newline at end of file +var _0x66db=['register','length','smsMessage:','./smsMessage.events','save','remove','emit','removeListener'];(function(_0x3c5e9a,_0x57819f){var _0x23c405=function(_0x424312){while(--_0x424312){_0x3c5e9a['push'](_0x3c5e9a['shift']());}};_0x23c405(++_0x57819f);}(_0x66db,0x16b));var _0xb66d=function(_0x1d80e8,_0x2ac4fe){_0x1d80e8=_0x1d80e8-0x0;var _0x23f95d=_0x66db[_0x1d80e8];return _0x23f95d;};'use strict';var SmsMessageEvents=require(_0xb66d('0x0'));var events=[_0xb66d('0x1'),_0xb66d('0x2'),'update'];function createListener(_0x13e0a7,_0x2d285c){return function(_0x5aeb88){_0x2d285c[_0xb66d('0x3')](_0x13e0a7,_0x5aeb88);};}function removeListener(_0xd0d4b7,_0x58f1d3){return function(){SmsMessageEvents[_0xb66d('0x4')](_0xd0d4b7,_0x58f1d3);};}exports[_0xb66d('0x5')]=function(_0x56fb7f){for(var _0xd899d9=0x0,_0x323c5b=events[_0xb66d('0x6')];_0xd899d9<_0x323c5b;_0xd899d9++){var _0x16aa01=events[_0xd899d9];var _0x419e4d=createListener(_0xb66d('0x7')+_0x16aa01,_0x56fb7f);SmsMessageEvents['on'](_0x16aa01,_0x419e4d);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 06fdc33..07f4d1f 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 _0x930d=['update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','/:id/teams','/:id/users','getAgents','post','addAgents','put'];(function(_0x5dcb97,_0x336ea9){var _0x3186a3=function(_0x2ce4cc){while(--_0x2ce4cc){_0x5dcb97['push'](_0x5dcb97['shift']());}};_0x3186a3(++_0x336ea9);}(_0x930d,0xb4));var _0xd930=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x930d[_0xaa0309];return _0x5de7ce;};'use strict';var multer=require(_0xd930('0x0'));var util=require(_0xd930('0x1'));var path=require(_0xd930('0x2'));var timeout=require(_0xd930('0x3'));var express=require(_0xd930('0x4'));var router=express['Router']();var fs_extra=require(_0xd930('0x5'));var auth=require(_0xd930('0x6'));var interaction=require(_0xd930('0x7'));var config=require(_0xd930('0x8'));var controller=require(_0xd930('0x9'));router[_0xd930('0xa')]('/',auth[_0xd930('0xb')](),controller['index']);router[_0xd930('0xa')](_0xd930('0xc'),auth[_0xd930('0xb')](),controller['describe']);router[_0xd930('0xa')](_0xd930('0xd'),auth[_0xd930('0xb')](),controller['show']);router[_0xd930('0xa')]('/:id/members',auth[_0xd930('0xb')](),controller['getMembers']);router[_0xd930('0xa')](_0xd930('0xe'),auth[_0xd930('0xb')](),controller['getTeams']);router[_0xd930('0xa')](_0xd930('0xf'),auth[_0xd930('0xb')](),controller[_0xd930('0x10')]);router[_0xd930('0x11')]('/',auth[_0xd930('0xb')](),controller['create']);router[_0xd930('0x11')](_0xd930('0xe'),auth[_0xd930('0xb')](),controller['addTeams']);router[_0xd930('0x11')]('/:id/users',auth[_0xd930('0xb')](),controller[_0xd930('0x12')]);router[_0xd930('0x13')]('/:id',auth[_0xd930('0xb')](),controller[_0xd930('0x14')]);router[_0xd930('0x15')]('/:id',auth[_0xd930('0xb')](),controller[_0xd930('0x16')]);router[_0xd930('0x15')](_0xd930('0xe'),auth[_0xd930('0xb')](),controller['removeTeams']);router[_0xd930('0x15')](_0xd930('0xf'),auth[_0xd930('0xb')](),controller[_0xd930('0x17')]);module[_0xd930('0x18')]=router; \ No newline at end of file +var _0x0e74=['path','connect-timeout','express','fs-extra','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','/:id','delete','removeTeams','removeAgents','exports'];(function(_0x2e5bb6,_0x4a569b){var _0xdae9ed=function(_0x3fc1d7){while(--_0x3fc1d7){_0x2e5bb6['push'](_0x2e5bb6['shift']());}};_0xdae9ed(++_0x4a569b);}(_0x0e74,0x82));var _0x40e7=function(_0x8a729f,_0x493fc0){_0x8a729f=_0x8a729f-0x0;var _0x2d5864=_0x0e74[_0x8a729f];return _0x2d5864;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40e7('0x0'));var timeout=require(_0x40e7('0x1'));var express=require(_0x40e7('0x2'));var router=express['Router']();var fs_extra=require(_0x40e7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x40e7('0x4'));var config=require('../../config/environment');var controller=require(_0x40e7('0x5'));router[_0x40e7('0x6')]('/',auth[_0x40e7('0x7')](),controller[_0x40e7('0x8')]);router['get'](_0x40e7('0x9'),auth['isAuthenticated'](),controller[_0x40e7('0xa')]);router[_0x40e7('0x6')]('/:id',auth[_0x40e7('0x7')](),controller[_0x40e7('0xb')]);router['get'](_0x40e7('0xc'),auth[_0x40e7('0x7')](),controller[_0x40e7('0xd')]);router[_0x40e7('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x40e7('0xe')]);router['get'](_0x40e7('0xf'),auth['isAuthenticated'](),controller[_0x40e7('0x10')]);router[_0x40e7('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x40e7('0x11')](_0x40e7('0x12'),auth[_0x40e7('0x7')](),controller[_0x40e7('0x13')]);router[_0x40e7('0x11')](_0x40e7('0xf'),auth['isAuthenticated'](),controller[_0x40e7('0x14')]);router['put'](_0x40e7('0x15'),auth[_0x40e7('0x7')](),controller['update']);router[_0x40e7('0x16')](_0x40e7('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0x40e7('0x16')](_0x40e7('0x12'),auth[_0x40e7('0x7')](),controller[_0x40e7('0x17')]);router[_0x40e7('0x16')](_0x40e7('0xf'),auth[_0x40e7('0x7')](),controller[_0x40e7('0x18')]);module[_0x40e7('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 4680fb6..b49e5ed 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 _0xad75=['beepall','roundrobin','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x3927f7,_0x195141){var _0x1cbea3=function(_0x5d3644){while(--_0x5d3644){_0x3927f7['push'](_0x3927f7['shift']());}};_0x1cbea3(++_0x195141);}(_0xad75,0xba));var _0x5ad7=function(_0x3814dc,_0x2d7fdb){_0x3814dc=_0x3814dc-0x0;var _0x5f4198=_0xad75[_0x3814dc];return _0x5f4198;};'use strict';var Sequelize=require('sequelize');module[_0x5ad7('0x0')]={'name':{'type':Sequelize[_0x5ad7('0x1')],'unique':_0x5ad7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5ad7('0x1')]},'timeout':{'type':Sequelize[_0x5ad7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5ad7('0x4')](_0x5ad7('0x5'),_0x5ad7('0x6'),_0x5ad7('0x7'))}}; \ No newline at end of file +var _0x607d=['INTEGER','ENUM','rrmemory','beepall','roundrobin','exports','STRING'];(function(_0x3ada0a,_0x5e94e9){var _0x41ffc0=function(_0xd4dabc){while(--_0xd4dabc){_0x3ada0a['push'](_0x3ada0a['shift']());}};_0x41ffc0(++_0x5e94e9);}(_0x607d,0x186));var _0xd607=function(_0x1ca095,_0x3fd1bd){_0x1ca095=_0x1ca095-0x0;var _0x13b842=_0x607d[_0x1ca095];return _0x13b842;};'use strict';var Sequelize=require('sequelize');module[_0xd607('0x0')]={'name':{'type':Sequelize[_0xd607('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd607('0x1')]},'timeout':{'type':Sequelize[_0xd607('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd607('0x3')](_0xd607('0x4'),_0xd607('0x5'),_0xd607('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index b8943f1..69a708b 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 _0xafe6=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','get','UserProfileResource','destroy','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','length','SmsQueueId','User','findAndCountAll','UserId','agent','updatedAt','%s/%s','smsPause','createdAt','getTeams','findOne','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','team_has_sms_queues'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xafe6,0xa7));var _0x6afe=function(_0x414e89,_0x7f6091){_0x414e89=_0x414e89-0x0;var _0x27e26c=_0xafe6[_0x414e89];return _0x27e26c;};'use strict';var emlformat=require(_0x6afe('0x0'));var rimraf=require(_0x6afe('0x1'));var zipdir=require(_0x6afe('0x2'));var jsonpatch=require(_0x6afe('0x3'));var rp=require(_0x6afe('0x4'));var moment=require('moment');var BPromise=require(_0x6afe('0x5'));var Mustache=require(_0x6afe('0x6'));var util=require(_0x6afe('0x7'));var path=require('path');var sox=require(_0x6afe('0x8'));var csv=require(_0x6afe('0x9'));var ejs=require(_0x6afe('0xa'));var fs=require('fs');var fs_extra=require(_0x6afe('0xb'));var _=require(_0x6afe('0xc'));var squel=require(_0x6afe('0xd'));var crypto=require('crypto');var jsforce=require(_0x6afe('0xe'));var deskjs=require(_0x6afe('0xf'));var toCsv=require(_0x6afe('0x9'));var querystring=require(_0x6afe('0x10'));var Papa=require(_0x6afe('0x11'));var Redis=require('ioredis');var authService=require(_0x6afe('0x12'));var qs=require(_0x6afe('0x13'));var as=require(_0x6afe('0x14'));var hardwareService=require(_0x6afe('0x15'));var logger=require(_0x6afe('0x16'))(_0x6afe('0x17'));var utils=require(_0x6afe('0x18'));var config=require(_0x6afe('0x19'));var licenseUtil=require(_0x6afe('0x1a'));var db=require('../../mysqldb')['db'];config[_0x6afe('0x1b')]=_[_0x6afe('0x1c')](config[_0x6afe('0x1b')],{'host':_0x6afe('0x1d'),'port':0x18eb});var socket=require(_0x6afe('0x1e'))(new Redis(config[_0x6afe('0x1b')]));require('./smsQueue.socket')['register'](socket);function respondWithStatusCode(_0x39c21a,_0xee8db1){_0xee8db1=_0xee8db1||0xcc;return function(_0x9f9446){if(_0x9f9446){return _0x39c21a['sendStatus'](_0xee8db1);}return _0x39c21a['status'](_0xee8db1)[_0x6afe('0x1f')]();};}function respondWithResult(_0x1a2388,_0x1e4e65){_0x1e4e65=_0x1e4e65||0xc8;return function(_0x49ec0d){if(_0x49ec0d){return _0x1a2388[_0x6afe('0x20')](_0x1e4e65)['json'](_0x49ec0d);}};}function respondWithFilteredResult(_0x3088c6,_0x292c3e){return function(_0x52d032){if(_0x52d032){var _0x3cbd57=typeof _0x292c3e['offset']===_0x6afe('0x21')&&typeof _0x292c3e[_0x6afe('0x22')]==='undefined';var _0x1bb9a2=_0x52d032[_0x6afe('0x23')];var _0x103d65=_0x3cbd57?0x0:_0x292c3e[_0x6afe('0x24')];var _0x19974a=_0x3cbd57?_0x52d032['count']:_0x292c3e[_0x6afe('0x24')]+_0x292c3e[_0x6afe('0x22')];var _0x5aa5d7;if(_0x19974a>=_0x1bb9a2){_0x19974a=_0x1bb9a2;_0x5aa5d7=0xc8;}else{_0x5aa5d7=0xce;}_0x3088c6[_0x6afe('0x20')](_0x5aa5d7);return _0x3088c6[_0x6afe('0x25')](_0x6afe('0x26'),_0x103d65+'-'+_0x19974a+'/'+_0x1bb9a2)[_0x6afe('0x27')](_0x52d032);}return null;};}function patchUpdates(_0x4e2ff3){return function(_0xb05ba8){try{jsonpatch[_0x6afe('0x28')](_0xb05ba8,_0x4e2ff3,!![]);}catch(_0x283640){return BPromise['reject'](_0x283640);}return _0xb05ba8['save']();};}function saveUpdates(_0x5aa226,_0x2fb514){return function(_0x430cfb){if(_0x430cfb){return _0x430cfb[_0x6afe('0x29')](_0x5aa226)[_0x6afe('0x2a')](function(_0x52d485){return _0x52d485;});}return null;};}function removeEntity(_0x53138e,_0x13f98a){return function(_0xe7239){if(_0xe7239){return _0xe7239['destroy']()['then'](function(){var _0x3d597a=_0xe7239[_0x6afe('0x2b')]({'plain':!![]});var _0x36823f='SmsQueues';return db[_0x6afe('0x2c')][_0x6afe('0x2d')]({'where':{'type':_0x36823f,'resourceId':_0x3d597a['id']}})[_0x6afe('0x2a')](function(){return _0xe7239;});})[_0x6afe('0x2a')](function(){_0x53138e[_0x6afe('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x227cc8,_0x2efd9c){return function(_0x1bb248){if(!_0x1bb248){_0x227cc8['sendStatus'](0x194);}return _0x1bb248;};}function handleError(_0xec6425,_0x57f527){_0x57f527=_0x57f527||0x1f4;return function(_0x1482f2){logger['error'](_0x1482f2[_0x6afe('0x2e')]);if(_0x1482f2['name']){delete _0x1482f2[_0x6afe('0x2f')];}_0xec6425[_0x6afe('0x20')](_0x57f527)[_0x6afe('0x30')](_0x1482f2);};}exports[_0x6afe('0x31')]=function(_0x495625,_0x21d83){var _0x4f3ede={},_0x21851f={},_0x1d42e0={'count':0x0,'rows':[]};var _0x49a101=_['map'](db[_0x6afe('0x32')][_0x6afe('0x33')],function(_0x326e47){return{'name':_0x326e47[_0x6afe('0x34')],'type':_0x326e47[_0x6afe('0x35')]['key']};});_0x21851f[_0x6afe('0x36')]=_[_0x6afe('0x37')](_0x49a101,_0x6afe('0x2f'));_0x21851f[_0x6afe('0x38')]=_[_0x6afe('0x39')](_0x495625['query']);_0x21851f[_0x6afe('0x3a')]=_['intersection'](_0x21851f['model'],_0x21851f[_0x6afe('0x38')]);_0x4f3ede[_0x6afe('0x3b')]=_[_0x6afe('0x3c')](_0x21851f[_0x6afe('0x36')],qs['fields'](_0x495625[_0x6afe('0x38')]['fields']));_0x4f3ede[_0x6afe('0x3b')]=_0x4f3ede['attributes']['length']?_0x4f3ede[_0x6afe('0x3b')]:_0x21851f[_0x6afe('0x36')];if(!_0x495625['query'][_0x6afe('0x3d')](_0x6afe('0x3e'))){_0x4f3ede['limit']=qs[_0x6afe('0x22')](_0x495625[_0x6afe('0x38')][_0x6afe('0x22')]);_0x4f3ede[_0x6afe('0x24')]=qs[_0x6afe('0x24')](_0x495625[_0x6afe('0x38')]['offset']);}_0x4f3ede[_0x6afe('0x3f')]=qs[_0x6afe('0x40')](_0x495625[_0x6afe('0x38')][_0x6afe('0x40')]);_0x4f3ede[_0x6afe('0x41')]=qs[_0x6afe('0x3a')](_[_0x6afe('0x42')](_0x495625['query'],_0x21851f[_0x6afe('0x3a')]),_0x49a101);if(_0x495625[_0x6afe('0x38')][_0x6afe('0x43')]){_0x4f3ede['where']=_[_0x6afe('0x44')](_0x4f3ede['where'],{'$or':_[_0x6afe('0x37')](_0x49a101,function(_0x4e3747){if(_0x4e3747[_0x6afe('0x35')]!==_0x6afe('0x45')){var _0x209969={};_0x209969[_0x4e3747[_0x6afe('0x2f')]]={'$like':'%'+_0x495625[_0x6afe('0x38')][_0x6afe('0x43')]+'%'};return _0x209969;}})});}_0x4f3ede=_[_0x6afe('0x44')]({},_0x4f3ede,_0x495625[_0x6afe('0x46')]);var _0x276ba8={'where':_0x4f3ede[_0x6afe('0x41')]};return db[_0x6afe('0x32')][_0x6afe('0x23')](_0x276ba8)[_0x6afe('0x2a')](function(_0x1f859d){_0x1d42e0['count']=_0x1f859d;if(_0x495625[_0x6afe('0x38')][_0x6afe('0x47')]){_0x4f3ede[_0x6afe('0x48')]=[{'all':!![]}];}return db[_0x6afe('0x32')][_0x6afe('0x49')](_0x4f3ede);})[_0x6afe('0x2a')](function(_0x9ef993){_0x1d42e0[_0x6afe('0x4a')]=_0x9ef993;return _0x1d42e0;})[_0x6afe('0x2a')](respondWithFilteredResult(_0x21d83,_0x4f3ede))[_0x6afe('0x4b')](handleError(_0x21d83,null));};exports['show']=function(_0x73622,_0x491665){var _0x2bd8df={'raw':!![],'where':{'id':_0x73622[_0x6afe('0x4c')]['id']}},_0x489a93={};_0x489a93[_0x6afe('0x36')]=_['keys'](db['SmsQueue'][_0x6afe('0x33')]);_0x489a93[_0x6afe('0x38')]=_[_0x6afe('0x39')](_0x73622[_0x6afe('0x38')]);_0x489a93[_0x6afe('0x3a')]=_[_0x6afe('0x3c')](_0x489a93[_0x6afe('0x36')],_0x489a93[_0x6afe('0x38')]);_0x2bd8df[_0x6afe('0x3b')]=_[_0x6afe('0x3c')](_0x489a93['model'],qs[_0x6afe('0x4d')](_0x73622[_0x6afe('0x38')][_0x6afe('0x4d')]));_0x2bd8df[_0x6afe('0x3b')]=_0x2bd8df[_0x6afe('0x3b')]['length']?_0x2bd8df[_0x6afe('0x3b')]:_0x489a93[_0x6afe('0x36')];if(_0x73622[_0x6afe('0x38')][_0x6afe('0x47')]){_0x2bd8df[_0x6afe('0x48')]=[{'all':!![]}];}_0x2bd8df=_[_0x6afe('0x44')]({},_0x2bd8df,_0x73622[_0x6afe('0x46')]);return db[_0x6afe('0x32')]['find'](_0x2bd8df)['then'](handleEntityNotFound(_0x491665,null))['then'](respondWithResult(_0x491665,null))[_0x6afe('0x4b')](handleError(_0x491665,null));};exports[_0x6afe('0x4e')]=function(_0x300927,_0x591a8e){return db[_0x6afe('0x32')][_0x6afe('0x4e')](_0x300927['body'],{})['then'](function(_0x153c32){var _0x2db950=_0x300927['user'][_0x6afe('0x2b')]({'plain':!![]});if(!_0x2db950)throw new Error(_0x6afe('0x4f'));if(_0x2db950[_0x6afe('0x50')]===_0x6afe('0x51')){var _0x1d65e1=_0x153c32[_0x6afe('0x2b')]({'plain':!![]});var _0x2b1fa6=_0x6afe('0x52');return db['UserProfileSection'][_0x6afe('0x53')]({'where':{'name':_0x2b1fa6,'userProfileId':_0x2db950[_0x6afe('0x54')]},'raw':!![]})[_0x6afe('0x2a')](function(_0x3a3869){if(_0x3a3869&&_0x3a3869[_0x6afe('0x55')]===0x0){return db[_0x6afe('0x2c')][_0x6afe('0x4e')]({'name':_0x1d65e1[_0x6afe('0x2f')],'resourceId':_0x1d65e1['id'],'type':_0x3a3869[_0x6afe('0x2f')],'sectionId':_0x3a3869['id']},{})[_0x6afe('0x2a')](function(){return _0x153c32;});}else{return _0x153c32;}})[_0x6afe('0x4b')](function(_0x1565a8){logger[_0x6afe('0x56')](_0x6afe('0x57'),_0x1565a8);throw _0x1565a8;});}return _0x153c32;})[_0x6afe('0x2a')](respondWithResult(_0x591a8e,0xc9))[_0x6afe('0x4b')](handleError(_0x591a8e,null));};exports['update']=function(_0x52d731,_0x264359){if(_0x52d731[_0x6afe('0x58')]['id']){delete _0x52d731[_0x6afe('0x58')]['id'];}return db[_0x6afe('0x32')][_0x6afe('0x53')]({'where':{'id':_0x52d731['params']['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x264359,null))[_0x6afe('0x2a')](saveUpdates(_0x52d731[_0x6afe('0x58')],null))['then'](respondWithResult(_0x264359,null))['catch'](handleError(_0x264359,null));};exports[_0x6afe('0x2d')]=function(_0xb72452,_0x49f691){return db[_0x6afe('0x32')][_0x6afe('0x53')]({'where':{'id':_0xb72452[_0x6afe('0x4c')]['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x49f691,null))[_0x6afe('0x2a')](removeEntity(_0x49f691,null))[_0x6afe('0x4b')](handleError(_0x49f691,null));};exports[_0x6afe('0x59')]=function(_0x3c7bcb,_0x18887f){return db[_0x6afe('0x32')]['describe']()[_0x6afe('0x2a')](respondWithResult(_0x18887f,null))[_0x6afe('0x4b')](handleError(_0x18887f,null));};exports[_0x6afe('0x5a')]=function(_0x54f921,_0x4efe56,_0x246067){var _0x397153={'raw':!![],'where':{}},_0x5043bc={},_0x51cc1c;return db['SmsQueue']['findOne']({'where':{'id':_0x54f921[_0x6afe('0x4c')]['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x4efe56,null))['then'](function(_0x54c8d4){if(_0x54c8d4){_0x51cc1c=_0x54c8d4[_0x6afe('0x2b')]({'plain':!![]});_0x5043bc[_0x6afe('0x36')]=_[_0x6afe('0x39')](db[_0x6afe('0x5b')][_0x6afe('0x33')]);_0x5043bc['query']=_[_0x6afe('0x39')](_0x54f921[_0x6afe('0x38')]);_0x5043bc[_0x6afe('0x3a')]=_['intersection'](_0x5043bc[_0x6afe('0x36')],_0x5043bc[_0x6afe('0x38')]);_0x397153[_0x6afe('0x3b')]=_['intersection'](_0x5043bc['model'],qs['fields'](_0x54f921[_0x6afe('0x38')][_0x6afe('0x4d')]));_0x397153['attributes']=_0x397153[_0x6afe('0x3b')][_0x6afe('0x5c')]?_0x397153[_0x6afe('0x3b')]:_0x5043bc[_0x6afe('0x36')];if(!_0x54f921[_0x6afe('0x38')]['hasOwnProperty'](_0x6afe('0x3e'))){_0x397153[_0x6afe('0x22')]=qs[_0x6afe('0x22')](_0x54f921[_0x6afe('0x38')][_0x6afe('0x22')]);_0x397153[_0x6afe('0x24')]=qs[_0x6afe('0x24')](_0x54f921[_0x6afe('0x38')][_0x6afe('0x24')]);}_0x397153[_0x6afe('0x3f')]=qs[_0x6afe('0x40')](_0x54f921[_0x6afe('0x38')][_0x6afe('0x40')]);_0x397153[_0x6afe('0x41')]=qs['filters'](_['pick'](_0x54f921['query'],_0x5043bc['filters']));_0x397153['where'][_0x6afe('0x5d')]=_0x54c8d4['id'];if(_0x54f921[_0x6afe('0x38')][_0x6afe('0x43')]){_0x397153[_0x6afe('0x41')]=_['merge'](_0x397153['where'],{'$or':_[_0x6afe('0x37')](_0x397153[_0x6afe('0x3b')],function(_0x3d7f2f){var _0x3d8fd6={};_0x3d8fd6[_0x3d7f2f]={'$like':'%'+_0x54f921[_0x6afe('0x38')][_0x6afe('0x43')]+'%'};return _0x3d8fd6;})});}_0x397153=_[_0x6afe('0x44')]({},_0x397153,_0x54f921['options']);return db[_0x6afe('0x5b')][_0x6afe('0x49')](_0x397153);}})[_0x6afe('0x2a')](function(_0x36fb8b){if(_0x36fb8b){return db[_0x6afe('0x5e')][_0x6afe('0x5f')]({'where':{'id':_[_0x6afe('0x37')](_0x36fb8b,_0x6afe('0x60')),'role':_0x6afe('0x61')},'attributes':['id','name','smsPause',_0x6afe('0x62'),'createdAt']});}})['then'](function(_0xa661a3){if(_0xa661a3){return{'count':_0xa661a3[_0x6afe('0x23')],'rows':_[_0x6afe('0x37')](_0xa661a3[_0x6afe('0x4a')],function(_0xa67100){return{'membername':_0xa67100[_0x6afe('0x2f')],'UserId':_0xa67100['id'],'queue_name':_0x51cc1c[_0x6afe('0x2f')],'SmsQueueId':_0x51cc1c['id'],'interface':util['format'](_0x6afe('0x63'),'SIP',_0xa67100[_0x6afe('0x2f')]),'penalty':0x0,'paused':_0xa67100[_0x6afe('0x64')],'createdAt':_0xa67100[_0x6afe('0x65')],'updatedAt':_0xa67100['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4efe56,_0x397153))['catch'](handleError(_0x4efe56,null));};exports[_0x6afe('0x66')]=function(_0x50bcc4,_0x9e38bf,_0x2b9a57){var _0x539022={};var _0x1618da={};var _0x1f67b4;var _0x149a88;return db[_0x6afe('0x32')][_0x6afe('0x67')]({'where':{'id':_0x50bcc4['params']['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x9e38bf,null))[_0x6afe('0x2a')](function(_0x136c6e){if(_0x136c6e){_0x1f67b4=_0x136c6e;_0x1618da[_0x6afe('0x36')]=_[_0x6afe('0x39')](db['Team'][_0x6afe('0x33')]);_0x1618da[_0x6afe('0x38')]=_[_0x6afe('0x39')](_0x50bcc4[_0x6afe('0x38')]);_0x1618da['filters']=_[_0x6afe('0x3c')](_0x1618da[_0x6afe('0x36')],_0x1618da[_0x6afe('0x38')]);_0x539022[_0x6afe('0x3b')]=_[_0x6afe('0x3c')](_0x1618da[_0x6afe('0x36')],qs[_0x6afe('0x4d')](_0x50bcc4['query'][_0x6afe('0x4d')]));_0x539022['attributes']=_0x539022[_0x6afe('0x3b')][_0x6afe('0x5c')]?_0x539022[_0x6afe('0x3b')]:_0x1618da['model'];_0x539022[_0x6afe('0x3f')]=qs[_0x6afe('0x40')](_0x50bcc4[_0x6afe('0x38')][_0x6afe('0x40')]);_0x539022['where']=qs['filters'](_[_0x6afe('0x42')](_0x50bcc4[_0x6afe('0x38')],_0x1618da[_0x6afe('0x3a')]));if(_0x50bcc4[_0x6afe('0x38')]['filter']){_0x539022[_0x6afe('0x41')]=_['merge'](_0x539022[_0x6afe('0x41')],{'$or':_[_0x6afe('0x37')](_0x539022[_0x6afe('0x3b')],function(_0x2cf055){var _0x5bb29c={};_0x5bb29c[_0x2cf055]={'$like':'%'+_0x50bcc4[_0x6afe('0x38')][_0x6afe('0x43')]+'%'};return _0x5bb29c;})});}_0x539022=_[_0x6afe('0x44')]({},_0x539022,_0x50bcc4['options']);return _0x1f67b4['getTeams'](_0x539022);}})[_0x6afe('0x2a')](function(_0x1d93a9){if(_0x1d93a9){_0x149a88=_0x1d93a9[_0x6afe('0x5c')];if(!_0x50bcc4[_0x6afe('0x38')][_0x6afe('0x3d')](_0x6afe('0x3e'))){_0x539022[_0x6afe('0x22')]=qs['limit'](_0x50bcc4[_0x6afe('0x38')][_0x6afe('0x22')]);_0x539022[_0x6afe('0x24')]=qs[_0x6afe('0x24')](_0x50bcc4['query'][_0x6afe('0x24')]);}return _0x1f67b4[_0x6afe('0x66')](_0x539022);}})['then'](function(_0x1bea1c){if(_0x1bea1c){return _0x1bea1c?{'count':_0x149a88,'rows':_0x1bea1c}:null;}})['then'](respondWithResult(_0x9e38bf,null))[_0x6afe('0x4b')](handleError(_0x9e38bf,null));};exports[_0x6afe('0x68')]=function(_0xe25f2a,_0x3eb4da,_0x23bc0e){var _0x2d950c=_0xe25f2a['body'][_0x6afe('0x69')];return db['Team'][_0x6afe('0x49')]({'where':{'id':_0x2d950c},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name','online',_0x6afe('0x6a'),_0x6afe('0x6b')],'raw':!![]}]})[_0x6afe('0x2a')](function(_0x41b72b){if(_0x41b72b){var _0x5db867=_[_0x6afe('0x6c')](_0x41b72b,function(_0x2b0a04){var _0x3544a5=_0x2b0a04[_0x6afe('0x2b')]({'plain':!![]});return _0x3544a5[_0x6afe('0x6d')];});return db[_0x6afe('0x32')]['find']({'where':{'id':_0xe25f2a[_0x6afe('0x4c')]['id']}})[_0x6afe('0x2a')](function(_0x5cf62a){return db[_0x6afe('0x6e')][_0x6afe('0x6f')](function(_0x15ff49){return _0x5cf62a[_0x6afe('0x68')](_0x2d950c,{'transaction':_0x15ff49})[_0x6afe('0x2a')](function(){return BPromise['each'](_0x5db867,function(_0x4a978d){return db[_0x6afe('0x5b')][_0x6afe('0x70')]({'where':{'UserId':_0x4a978d['id'],'SmsQueueId':_0xe25f2a[_0x6afe('0x4c')]['id']},'transaction':_0x15ff49});});})['then'](function(){_0x5db867[_0x6afe('0x71')](function(_0x35da53){socket[_0x6afe('0x72')](_0x6afe('0x73'),{'UserId':_0x35da53['id'],'SmsQueueId':_0x5cf62a['id']});});});});});}})[_0x6afe('0x2a')](respondWithStatusCode(_0x3eb4da,null))['catch'](handleError(_0x3eb4da,null));};exports[_0x6afe('0x74')]=function(_0x388439,_0x1a2ae6,_0x3c5a12){return db[_0x6afe('0x75')][_0x6afe('0x49')]({'where':{'id':_0x388439['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6afe('0x2a')](handleEntityNotFound(_0x1a2ae6,null))[_0x6afe('0x2a')](function(_0x262f04){var _0xd1d9b8=_[_0x6afe('0x37')](_0x262f04,'id');var _0x487e14=[];var _0x251ffc=[];var _0x57585d=squel['select']();_0x57585d[_0x6afe('0x76')](_0x6afe('0x77'))['from'](_0x6afe('0x78'),'tq')['join'](_0x6afe('0x79'),'ut',_0x6afe('0x7a'))[_0x6afe('0x41')](_0x6afe('0x7b'),_0x388439[_0x6afe('0x4c')]['id']);for(var _0x53f80f=0x0;_0x53f80f<_0x262f04['length'];_0x53f80f+=0x1){let _0x26a1f7=_0x262f04[_0x53f80f];for(var _0x4a9611=0x0;_0x4a9611<_0x26a1f7[_0x6afe('0x6d')][_0x6afe('0x5c')];_0x4a9611+=0x1){let _0x16d9c1=_0x26a1f7[_0x6afe('0x6d')][_0x4a9611];var _0x591871=_0x57585d[_0x6afe('0x7c')]();_0x591871[_0x6afe('0x41')](_0x6afe('0x7d'),_0x16d9c1['id']);_0x251ffc[_0x6afe('0x7e')](db[_0x6afe('0x6e')][_0x6afe('0x38')](_0x591871[_0x6afe('0x7f')](),{'type':db['sequelize'][_0x6afe('0x80')][_0x6afe('0x81')]})['then'](function(_0x2c5e85){if(_0x2c5e85[_0x6afe('0x5c')]===0x1){return _0x16d9c1['id'];}else{var _0x3570ee=_[_0x6afe('0x82')](_[_0x6afe('0x37')](_0x2c5e85,_0x6afe('0x83')),function(_0x189a0f){return _[_0x6afe('0x84')](_0xd1d9b8,_0x189a0f);});if(_0x3570ee){return _0x16d9c1['id'];}}}));}}return BPromise[_0x6afe('0x85')](_0x251ffc)[_0x6afe('0x2a')](function(_0x738352){_0x487e14=_(_0x487e14)[_0x6afe('0x86')](_0x738352)['compact']()[_0x6afe('0x87')]();return db[_0x6afe('0x32')]['find']({'where':{'id':_0x388439[_0x6afe('0x4c')]['id']}})['then'](function(_0x59254b){return db[_0x6afe('0x6e')][_0x6afe('0x6f')](function(_0x5e815c){return _0x59254b[_0x6afe('0x74')](_0x388439[_0x6afe('0x38')][_0x6afe('0x69')],{'transaction':_0x5e815c})['then'](function(){if(!_[_0x6afe('0x88')](_0x487e14)){return _0x59254b[_0x6afe('0x89')](_0x487e14,{'transaction':_0x5e815c});}})[_0x6afe('0x2a')](function(){_0x487e14['forEach'](function(_0x22d903){socket[_0x6afe('0x72')](_0x6afe('0x8a'),{'UserId':_0x22d903,'SmsQueueId':_0x59254b['id']});});});});});});})[_0x6afe('0x2a')](respondWithStatusCode(_0x1a2ae6,null))[_0x6afe('0x4b')](handleError(_0x1a2ae6,null));};exports[_0x6afe('0x8b')]=function(_0x359410,_0x39bd2f,_0x44a4ca){return db[_0x6afe('0x32')][_0x6afe('0x53')]({'where':{'id':_0x359410[_0x6afe('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39bd2f,null))[_0x6afe('0x2a')](function(_0x40b272){if(_0x40b272){return _0x40b272[_0x6afe('0x8b')](_0x359410[_0x6afe('0x58')][_0x6afe('0x69')],_[_0x6afe('0x8c')](_0x359410[_0x6afe('0x58')],[_0x6afe('0x69'),'id'])||{})[_0x6afe('0x8d')](function(_0x17a6cf){for(var _0x1ec58d=0x0;_0x1ec58d<_0x359410[_0x6afe('0x58')][_0x6afe('0x69')][_0x6afe('0x5c')];_0x1ec58d+=0x1){socket['emit']('userSmsQueue:save',{'UserId':Number(_0x359410['body']['ids'][_0x1ec58d]),'SmsQueueId':Number(_0x359410[_0x6afe('0x4c')]['id'])});}return _0x17a6cf;});}})[_0x6afe('0x2a')](respondWithResult(_0x39bd2f,null))['catch'](handleError(_0x39bd2f,null));};exports['removeAgents']=function(_0x3e9ba2,_0x545486,_0x4d5779){return db[_0x6afe('0x32')][_0x6afe('0x53')]({'where':{'id':_0x3e9ba2['params']['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x545486,null))[_0x6afe('0x2a')](function(_0x579545){if(_0x579545){return _0x579545[_0x6afe('0x89')](_0x3e9ba2['query'][_0x6afe('0x69')])[_0x6afe('0x2a')](function(){if(_[_0x6afe('0x8e')](_0x3e9ba2[_0x6afe('0x38')][_0x6afe('0x69')])){for(var _0x11232f=0x0;_0x11232f<_0x3e9ba2['query'][_0x6afe('0x69')]['length'];_0x11232f+=0x1){socket['emit'](_0x6afe('0x8a'),{'UserId':Number(_0x3e9ba2[_0x6afe('0x38')][_0x6afe('0x69')][_0x11232f]),'SmsQueueId':Number(_0x3e9ba2[_0x6afe('0x4c')]['id'])});}}else{socket['emit'](_0x6afe('0x8a'),{'UserId':Number(_0x3e9ba2[_0x6afe('0x38')][_0x6afe('0x69')]),'SmsQueueId':Number(_0x3e9ba2['params']['id'])});}});}})[_0x6afe('0x2a')](respondWithStatusCode(_0x545486,null))['catch'](handleError(_0x545486,null));};exports['getAgents']=function(_0x150ba4,_0x55c9e3,_0x25a5ca){var _0xfaacd6={};var _0x189984={};var _0x211fc3;var _0x107069;return db[_0x6afe('0x32')][_0x6afe('0x67')]({'where':{'id':_0x150ba4[_0x6afe('0x4c')]['id']}})[_0x6afe('0x2a')](handleEntityNotFound(_0x55c9e3,null))['then'](function(_0xca5638){if(_0xca5638){_0x211fc3=_0xca5638;_0x189984[_0x6afe('0x36')]=_[_0x6afe('0x39')](db[_0x6afe('0x5e')][_0x6afe('0x33')]);_0x189984[_0x6afe('0x38')]=_[_0x6afe('0x39')](_0x150ba4[_0x6afe('0x38')]);_0x189984[_0x6afe('0x3a')]=_[_0x6afe('0x3c')](_0x189984['model'],_0x189984[_0x6afe('0x38')]);_0xfaacd6[_0x6afe('0x3b')]=_[_0x6afe('0x3c')](_0x189984[_0x6afe('0x36')],qs[_0x6afe('0x4d')](_0x150ba4[_0x6afe('0x38')]['fields']));_0xfaacd6[_0x6afe('0x3b')]=_0xfaacd6[_0x6afe('0x3b')][_0x6afe('0x5c')]?_0xfaacd6['attributes']:_0x189984[_0x6afe('0x36')];_0xfaacd6[_0x6afe('0x3f')]=qs[_0x6afe('0x40')](_0x150ba4[_0x6afe('0x38')][_0x6afe('0x40')]);_0xfaacd6[_0x6afe('0x41')]=qs['filters'](_['pick'](_0x150ba4['query'],_0x189984['filters']));if(_0x150ba4[_0x6afe('0x38')][_0x6afe('0x43')]){_0xfaacd6['where']=_['merge'](_0xfaacd6[_0x6afe('0x41')],{'$or':_[_0x6afe('0x37')](_0xfaacd6[_0x6afe('0x3b')],function(_0x523f40){var _0x24f37e={};_0x24f37e[_0x523f40]={'$like':'%'+_0x150ba4['query'][_0x6afe('0x43')]+'%'};return _0x24f37e;})});}_0xfaacd6=_[_0x6afe('0x44')]({},_0xfaacd6,_0x150ba4[_0x6afe('0x46')]);return _0x211fc3[_0x6afe('0x8f')](_0xfaacd6);}})['then'](function(_0x1cfd82){if(_0x1cfd82){_0x107069=_0x1cfd82[_0x6afe('0x5c')];if(!_0x150ba4[_0x6afe('0x38')]['hasOwnProperty'](_0x6afe('0x3e'))){_0xfaacd6[_0x6afe('0x22')]=qs[_0x6afe('0x22')](_0x150ba4[_0x6afe('0x38')]['limit']);_0xfaacd6['offset']=qs[_0x6afe('0x24')](_0x150ba4['query'][_0x6afe('0x24')]);}return _0x211fc3['getAgents'](_0xfaacd6);}})['then'](function(_0x938215){if(_0x938215){return _0x938215?{'count':_0x107069,'rows':_0x938215}:null;}})[_0x6afe('0x2a')](respondWithResult(_0x55c9e3,null))[_0x6afe('0x4b')](handleError(_0x55c9e3,null));}; \ No newline at end of file +var _0x419f=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','userProfileId','autoAssociation','body','getMembers','UserSmsQueue','rawAttributes','order','sort','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','nolimit','ids','Team','User','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','TeamId','includes','all','union','value','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','SmsQueue','fieldName','type'];(function(_0x53ba51,_0x2f2321){var _0x2e776e=function(_0x16b5cf){while(--_0x16b5cf){_0x53ba51['push'](_0x53ba51['shift']());}};_0x2e776e(++_0x2f2321);}(_0x419f,0x176));var _0xf419=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x419f[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xf419('0x0'));var rimraf=require(_0xf419('0x1'));var zipdir=require(_0xf419('0x2'));var jsonpatch=require(_0xf419('0x3'));var rp=require(_0xf419('0x4'));var moment=require(_0xf419('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf419('0x6'));var util=require('util');var path=require(_0xf419('0x7'));var sox=require(_0xf419('0x8'));var csv=require(_0xf419('0x9'));var ejs=require(_0xf419('0xa'));var fs=require('fs');var fs_extra=require(_0xf419('0xb'));var _=require(_0xf419('0xc'));var squel=require(_0xf419('0xd'));var crypto=require(_0xf419('0xe'));var jsforce=require(_0xf419('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf419('0x9'));var querystring=require(_0xf419('0x10'));var Papa=require('papaparse');var Redis=require(_0xf419('0x11'));var authService=require(_0xf419('0x12'));var qs=require(_0xf419('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf419('0x14'));var logger=require(_0xf419('0x15'))(_0xf419('0x16'));var utils=require(_0xf419('0x17'));var config=require(_0xf419('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf419('0x19')]=_[_0xf419('0x1a')](config[_0xf419('0x19')],{'host':_0xf419('0x1b'),'port':0x18eb});var socket=require(_0xf419('0x1c'))(new Redis(config['redis']));require(_0xf419('0x1d'))[_0xf419('0x1e')](socket);function respondWithStatusCode(_0x1db85d,_0x2fb4bb){_0x2fb4bb=_0x2fb4bb||0xcc;return function(_0x137005){if(_0x137005){return _0x1db85d[_0xf419('0x1f')](_0x2fb4bb);}return _0x1db85d['status'](_0x2fb4bb)[_0xf419('0x20')]();};}function respondWithResult(_0x44b6c4,_0x5c3cd1){_0x5c3cd1=_0x5c3cd1||0xc8;return function(_0x8f9eec){if(_0x8f9eec){return _0x44b6c4[_0xf419('0x21')](_0x5c3cd1)[_0xf419('0x22')](_0x8f9eec);}};}function respondWithFilteredResult(_0x4f77fb,_0x5a6db6){return function(_0x599492){if(_0x599492){var _0x44aad6=typeof _0x5a6db6['offset']===_0xf419('0x23')&&typeof _0x5a6db6[_0xf419('0x24')]===_0xf419('0x23');var _0x431142=_0x599492['count'];var _0x323bd4=_0x44aad6?0x0:_0x5a6db6['offset'];var _0x260bac=_0x44aad6?_0x599492[_0xf419('0x25')]:_0x5a6db6[_0xf419('0x26')]+_0x5a6db6['limit'];var _0x5de78f;if(_0x260bac>=_0x431142){_0x260bac=_0x431142;_0x5de78f=0xc8;}else{_0x5de78f=0xce;}_0x4f77fb[_0xf419('0x21')](_0x5de78f);return _0x4f77fb[_0xf419('0x27')](_0xf419('0x28'),_0x323bd4+'-'+_0x260bac+'/'+_0x431142)[_0xf419('0x22')](_0x599492);}return null;};}function patchUpdates(_0x47bac2){return function(_0x3146d2){try{jsonpatch[_0xf419('0x29')](_0x3146d2,_0x47bac2,!![]);}catch(_0x50d00b){return BPromise['reject'](_0x50d00b);}return _0x3146d2['save']();};}function saveUpdates(_0x2d2c19,_0xa70f96){return function(_0x1cf683){if(_0x1cf683){return _0x1cf683[_0xf419('0x2a')](_0x2d2c19)[_0xf419('0x2b')](function(_0x5aa688){return _0x5aa688;});}return null;};}function removeEntity(_0x39ebe5,_0x3fbaaa){return function(_0x50762a){if(_0x50762a){return _0x50762a[_0xf419('0x2c')]()['then'](function(){var _0x1bd979=_0x50762a[_0xf419('0x2d')]({'plain':!![]});var _0x330805='SmsQueues';return db[_0xf419('0x2e')][_0xf419('0x2c')]({'where':{'type':_0x330805,'resourceId':_0x1bd979['id']}})[_0xf419('0x2b')](function(){return _0x50762a;});})[_0xf419('0x2b')](function(){_0x39ebe5[_0xf419('0x21')](0xcc)[_0xf419('0x20')]();});}};}function handleEntityNotFound(_0x420461,_0x4f9ee5){return function(_0x925308){if(!_0x925308){_0x420461[_0xf419('0x1f')](0x194);}return _0x925308;};}function handleError(_0x3b12e9,_0x3b4fe3){_0x3b4fe3=_0x3b4fe3||0x1f4;return function(_0x5691ba){logger[_0xf419('0x2f')](_0x5691ba[_0xf419('0x30')]);if(_0x5691ba['name']){delete _0x5691ba[_0xf419('0x31')];}_0x3b12e9['status'](_0x3b4fe3)['send'](_0x5691ba);};}exports[_0xf419('0x32')]=function(_0x1e5961,_0x56aadb){var _0x18f23a={},_0x36ca1c={},_0x19e946={'count':0x0,'rows':[]};var _0x42ccad=_[_0xf419('0x33')](db[_0xf419('0x34')]['rawAttributes'],function(_0x29ecdc){return{'name':_0x29ecdc[_0xf419('0x35')],'type':_0x29ecdc[_0xf419('0x36')][_0xf419('0x37')]};});_0x36ca1c[_0xf419('0x38')]=_[_0xf419('0x33')](_0x42ccad,_0xf419('0x31'));_0x36ca1c[_0xf419('0x39')]=_[_0xf419('0x3a')](_0x1e5961['query']);_0x36ca1c[_0xf419('0x3b')]=_[_0xf419('0x3c')](_0x36ca1c[_0xf419('0x38')],_0x36ca1c['query']);_0x18f23a[_0xf419('0x3d')]=_[_0xf419('0x3c')](_0x36ca1c[_0xf419('0x38')],qs[_0xf419('0x3e')](_0x1e5961['query'][_0xf419('0x3e')]));_0x18f23a[_0xf419('0x3d')]=_0x18f23a[_0xf419('0x3d')][_0xf419('0x3f')]?_0x18f23a[_0xf419('0x3d')]:_0x36ca1c['model'];if(!_0x1e5961[_0xf419('0x39')][_0xf419('0x40')]('nolimit')){_0x18f23a[_0xf419('0x24')]=qs[_0xf419('0x24')](_0x1e5961[_0xf419('0x39')][_0xf419('0x24')]);_0x18f23a[_0xf419('0x26')]=qs[_0xf419('0x26')](_0x1e5961['query'][_0xf419('0x26')]);}_0x18f23a['order']=qs['sort'](_0x1e5961[_0xf419('0x39')]['sort']);_0x18f23a[_0xf419('0x41')]=qs['filters'](_[_0xf419('0x42')](_0x1e5961[_0xf419('0x39')],_0x36ca1c[_0xf419('0x3b')]),_0x42ccad);if(_0x1e5961[_0xf419('0x39')][_0xf419('0x43')]){_0x18f23a['where']=_[_0xf419('0x44')](_0x18f23a[_0xf419('0x41')],{'$or':_[_0xf419('0x33')](_0x42ccad,function(_0x276d77){if(_0x276d77[_0xf419('0x36')]!==_0xf419('0x45')){var _0x20edd0={};_0x20edd0[_0x276d77['name']]={'$like':'%'+_0x1e5961[_0xf419('0x39')][_0xf419('0x43')]+'%'};return _0x20edd0;}})});}_0x18f23a=_[_0xf419('0x44')]({},_0x18f23a,_0x1e5961[_0xf419('0x46')]);var _0x479d84={'where':_0x18f23a['where']};return db[_0xf419('0x34')][_0xf419('0x25')](_0x479d84)['then'](function(_0x47bba4){_0x19e946[_0xf419('0x25')]=_0x47bba4;if(_0x1e5961['query'][_0xf419('0x47')]){_0x18f23a['include']=[{'all':!![]}];}return db[_0xf419('0x34')][_0xf419('0x48')](_0x18f23a);})[_0xf419('0x2b')](function(_0x53784f){_0x19e946[_0xf419('0x49')]=_0x53784f;return _0x19e946;})[_0xf419('0x2b')](respondWithFilteredResult(_0x56aadb,_0x18f23a))[_0xf419('0x4a')](handleError(_0x56aadb,null));};exports[_0xf419('0x4b')]=function(_0x521d53,_0xf9cea7){var _0x256f37={'raw':!![],'where':{'id':_0x521d53[_0xf419('0x4c')]['id']}},_0x4f33f6={};_0x4f33f6['model']=_[_0xf419('0x3a')](db[_0xf419('0x34')]['rawAttributes']);_0x4f33f6['query']=_['keys'](_0x521d53[_0xf419('0x39')]);_0x4f33f6[_0xf419('0x3b')]=_[_0xf419('0x3c')](_0x4f33f6['model'],_0x4f33f6[_0xf419('0x39')]);_0x256f37[_0xf419('0x3d')]=_['intersection'](_0x4f33f6[_0xf419('0x38')],qs[_0xf419('0x3e')](_0x521d53[_0xf419('0x39')][_0xf419('0x3e')]));_0x256f37[_0xf419('0x3d')]=_0x256f37['attributes']['length']?_0x256f37[_0xf419('0x3d')]:_0x4f33f6[_0xf419('0x38')];if(_0x521d53['query']['includeAll']){_0x256f37['include']=[{'all':!![]}];}_0x256f37=_[_0xf419('0x44')]({},_0x256f37,_0x521d53['options']);return db[_0xf419('0x34')][_0xf419('0x4d')](_0x256f37)[_0xf419('0x2b')](handleEntityNotFound(_0xf9cea7,null))[_0xf419('0x2b')](respondWithResult(_0xf9cea7,null))[_0xf419('0x4a')](handleError(_0xf9cea7,null));};exports[_0xf419('0x4e')]=function(_0x296d31,_0x41597e){return db['SmsQueue'][_0xf419('0x4e')](_0x296d31['body'],{})['then'](function(_0x3a1793){var _0x1dfbc7=_0x296d31[_0xf419('0x4f')]['get']({'plain':!![]});if(!_0x1dfbc7)throw new Error(_0xf419('0x50'));if(_0x1dfbc7[_0xf419('0x51')]===_0xf419('0x4f')){var _0x7ac561=_0x3a1793[_0xf419('0x2d')]({'plain':!![]});var _0x4ad27a=_0xf419('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x4ad27a,'userProfileId':_0x1dfbc7[_0xf419('0x53')]},'raw':!![]})['then'](function(_0x4c6718){if(_0x4c6718&&_0x4c6718[_0xf419('0x54')]===0x0){return db[_0xf419('0x2e')][_0xf419('0x4e')]({'name':_0x7ac561[_0xf419('0x31')],'resourceId':_0x7ac561['id'],'type':_0x4c6718['name'],'sectionId':_0x4c6718['id']},{})[_0xf419('0x2b')](function(){return _0x3a1793;});}else{return _0x3a1793;}})[_0xf419('0x4a')](function(_0x3b4c17){logger[_0xf419('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b4c17);throw _0x3b4c17;});}return _0x3a1793;})[_0xf419('0x2b')](respondWithResult(_0x41597e,0xc9))[_0xf419('0x4a')](handleError(_0x41597e,null));};exports[_0xf419('0x2a')]=function(_0x34773d,_0x1d3756){if(_0x34773d['body']['id']){delete _0x34773d[_0xf419('0x55')]['id'];}return db[_0xf419('0x34')]['find']({'where':{'id':_0x34773d[_0xf419('0x4c')]['id']}})[_0xf419('0x2b')](handleEntityNotFound(_0x1d3756,null))[_0xf419('0x2b')](saveUpdates(_0x34773d[_0xf419('0x55')],null))[_0xf419('0x2b')](respondWithResult(_0x1d3756,null))['catch'](handleError(_0x1d3756,null));};exports[_0xf419('0x2c')]=function(_0x4ddc4d,_0x1ade5f){return db[_0xf419('0x34')]['find']({'where':{'id':_0x4ddc4d['params']['id']}})['then'](handleEntityNotFound(_0x1ade5f,null))['then'](removeEntity(_0x1ade5f,null))[_0xf419('0x4a')](handleError(_0x1ade5f,null));};exports['describe']=function(_0x2d08bf,_0x4ca9ae){return db[_0xf419('0x34')]['describe']()['then'](respondWithResult(_0x4ca9ae,null))[_0xf419('0x4a')](handleError(_0x4ca9ae,null));};exports[_0xf419('0x56')]=function(_0x64f1a,_0x39259e,_0x52723f){var _0x4bc200={'raw':!![],'where':{}},_0x78c99f={},_0x1fc18a;return db[_0xf419('0x34')]['findOne']({'where':{'id':_0x64f1a[_0xf419('0x4c')]['id']}})['then'](handleEntityNotFound(_0x39259e,null))[_0xf419('0x2b')](function(_0x104f1f){if(_0x104f1f){_0x1fc18a=_0x104f1f['get']({'plain':!![]});_0x78c99f['model']=_['keys'](db[_0xf419('0x57')][_0xf419('0x58')]);_0x78c99f[_0xf419('0x39')]=_[_0xf419('0x3a')](_0x64f1a['query']);_0x78c99f['filters']=_['intersection'](_0x78c99f['model'],_0x78c99f[_0xf419('0x39')]);_0x4bc200[_0xf419('0x3d')]=_[_0xf419('0x3c')](_0x78c99f['model'],qs[_0xf419('0x3e')](_0x64f1a[_0xf419('0x39')][_0xf419('0x3e')]));_0x4bc200['attributes']=_0x4bc200[_0xf419('0x3d')][_0xf419('0x3f')]?_0x4bc200[_0xf419('0x3d')]:_0x78c99f[_0xf419('0x38')];if(!_0x64f1a['query']['hasOwnProperty']('nolimit')){_0x4bc200[_0xf419('0x24')]=qs[_0xf419('0x24')](_0x64f1a[_0xf419('0x39')][_0xf419('0x24')]);_0x4bc200[_0xf419('0x26')]=qs['offset'](_0x64f1a[_0xf419('0x39')][_0xf419('0x26')]);}_0x4bc200[_0xf419('0x59')]=qs[_0xf419('0x5a')](_0x64f1a[_0xf419('0x39')][_0xf419('0x5a')]);_0x4bc200['where']=qs['filters'](_[_0xf419('0x42')](_0x64f1a['query'],_0x78c99f[_0xf419('0x3b')]));_0x4bc200[_0xf419('0x41')][_0xf419('0x5b')]=_0x104f1f['id'];if(_0x64f1a[_0xf419('0x39')][_0xf419('0x43')]){_0x4bc200['where']=_[_0xf419('0x44')](_0x4bc200[_0xf419('0x41')],{'$or':_[_0xf419('0x33')](_0x4bc200['attributes'],function(_0x41cf1f){var _0x23e815={};_0x23e815[_0x41cf1f]={'$like':'%'+_0x64f1a['query'][_0xf419('0x43')]+'%'};return _0x23e815;})});}_0x4bc200=_[_0xf419('0x44')]({},_0x4bc200,_0x64f1a[_0xf419('0x46')]);return db[_0xf419('0x57')][_0xf419('0x48')](_0x4bc200);}})[_0xf419('0x2b')](function(_0x3455db){if(_0x3455db){return db['User'][_0xf419('0x5c')]({'where':{'id':_[_0xf419('0x33')](_0x3455db,_0xf419('0x5d')),'role':_0xf419('0x5e')},'attributes':['id',_0xf419('0x31'),_0xf419('0x5f'),_0xf419('0x60'),'createdAt']});}})[_0xf419('0x2b')](function(_0x389662){if(_0x389662){return{'count':_0x389662[_0xf419('0x25')],'rows':_[_0xf419('0x33')](_0x389662[_0xf419('0x49')],function(_0x3ef8bd){return{'membername':_0x3ef8bd[_0xf419('0x31')],'UserId':_0x3ef8bd['id'],'queue_name':_0x1fc18a[_0xf419('0x31')],'SmsQueueId':_0x1fc18a['id'],'interface':util[_0xf419('0x61')](_0xf419('0x62'),_0xf419('0x63'),_0x3ef8bd[_0xf419('0x31')]),'penalty':0x0,'paused':_0x3ef8bd['smsPause'],'createdAt':_0x3ef8bd[_0xf419('0x64')],'updatedAt':_0x3ef8bd[_0xf419('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf419('0x2b')](respondWithFilteredResult(_0x39259e,_0x4bc200))[_0xf419('0x4a')](handleError(_0x39259e,null));};exports[_0xf419('0x65')]=function(_0x31d900,_0x377a24,_0x42b6da){var _0x1ba171={};var _0x33f561={};var _0x43b9ea;var _0x413ee6;return db[_0xf419('0x34')]['findOne']({'where':{'id':_0x31d900[_0xf419('0x4c')]['id']}})[_0xf419('0x2b')](handleEntityNotFound(_0x377a24,null))[_0xf419('0x2b')](function(_0xdd919f){if(_0xdd919f){_0x43b9ea=_0xdd919f;_0x33f561[_0xf419('0x38')]=_['keys'](db['Team'][_0xf419('0x58')]);_0x33f561['query']=_[_0xf419('0x3a')](_0x31d900[_0xf419('0x39')]);_0x33f561[_0xf419('0x3b')]=_[_0xf419('0x3c')](_0x33f561[_0xf419('0x38')],_0x33f561[_0xf419('0x39')]);_0x1ba171['attributes']=_[_0xf419('0x3c')](_0x33f561['model'],qs[_0xf419('0x3e')](_0x31d900['query'][_0xf419('0x3e')]));_0x1ba171[_0xf419('0x3d')]=_0x1ba171[_0xf419('0x3d')][_0xf419('0x3f')]?_0x1ba171['attributes']:_0x33f561['model'];_0x1ba171[_0xf419('0x59')]=qs[_0xf419('0x5a')](_0x31d900[_0xf419('0x39')][_0xf419('0x5a')]);_0x1ba171[_0xf419('0x41')]=qs[_0xf419('0x3b')](_[_0xf419('0x42')](_0x31d900[_0xf419('0x39')],_0x33f561['filters']));if(_0x31d900['query'][_0xf419('0x43')]){_0x1ba171[_0xf419('0x41')]=_['merge'](_0x1ba171[_0xf419('0x41')],{'$or':_[_0xf419('0x33')](_0x1ba171[_0xf419('0x3d')],function(_0x35c560){var _0x1e6afd={};_0x1e6afd[_0x35c560]={'$like':'%'+_0x31d900[_0xf419('0x39')]['filter']+'%'};return _0x1e6afd;})});}_0x1ba171=_[_0xf419('0x44')]({},_0x1ba171,_0x31d900[_0xf419('0x46')]);return _0x43b9ea['getTeams'](_0x1ba171);}})[_0xf419('0x2b')](function(_0x1a5eed){if(_0x1a5eed){_0x413ee6=_0x1a5eed[_0xf419('0x3f')];if(!_0x31d900[_0xf419('0x39')][_0xf419('0x40')](_0xf419('0x66'))){_0x1ba171[_0xf419('0x24')]=qs[_0xf419('0x24')](_0x31d900[_0xf419('0x39')][_0xf419('0x24')]);_0x1ba171[_0xf419('0x26')]=qs[_0xf419('0x26')](_0x31d900['query'][_0xf419('0x26')]);}return _0x43b9ea[_0xf419('0x65')](_0x1ba171);}})['then'](function(_0x488c51){if(_0x488c51){return _0x488c51?{'count':_0x413ee6,'rows':_0x488c51}:null;}})[_0xf419('0x2b')](respondWithResult(_0x377a24,null))['catch'](handleError(_0x377a24,null));};exports['addTeams']=function(_0x5a061b,_0xa77d7d,_0x3dd784){var _0x4724f4=_0x5a061b[_0xf419('0x55')][_0xf419('0x67')];return db[_0xf419('0x68')][_0xf419('0x48')]({'where':{'id':_0x4724f4},'attributes':['id'],'include':[{'model':db[_0xf419('0x69')],'as':_0xf419('0x6a'),'attributes':['id',_0xf419('0x31'),'online',_0xf419('0x6b'),_0xf419('0x6c')],'raw':!![]}]})[_0xf419('0x2b')](function(_0x16eb70){if(_0x16eb70){var _0x1eb2a3=_[_0xf419('0x6d')](_0x16eb70,function(_0x144260){var _0x40dfd9=_0x144260[_0xf419('0x2d')]({'plain':!![]});return _0x40dfd9['Agents'];});return db[_0xf419('0x34')][_0xf419('0x4d')]({'where':{'id':_0x5a061b[_0xf419('0x4c')]['id']}})['then'](function(_0x3d7054){return db[_0xf419('0x6e')][_0xf419('0x6f')](function(_0x124897){return _0x3d7054[_0xf419('0x70')](_0x4724f4,{'transaction':_0x124897})[_0xf419('0x2b')](function(){return BPromise[_0xf419('0x71')](_0x1eb2a3,function(_0x371a44){return db[_0xf419('0x57')][_0xf419('0x72')]({'where':{'UserId':_0x371a44['id'],'SmsQueueId':_0x5a061b[_0xf419('0x4c')]['id']},'transaction':_0x124897});});})[_0xf419('0x2b')](function(){_0x1eb2a3[_0xf419('0x73')](function(_0x4fdbef){socket[_0xf419('0x74')](_0xf419('0x75'),{'UserId':_0x4fdbef['id'],'SmsQueueId':_0x3d7054['id']});});});});});}})[_0xf419('0x2b')](respondWithStatusCode(_0xa77d7d,null))[_0xf419('0x4a')](handleError(_0xa77d7d,null));};exports[_0xf419('0x76')]=function(_0x5dede0,_0x32531c,_0x1a433c){return db['Team'][_0xf419('0x48')]({'where':{'id':_0x5dede0['query'][_0xf419('0x67')]},'attributes':['id'],'include':[{'model':db[_0xf419('0x69')],'as':_0xf419('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xf419('0x2b')](handleEntityNotFound(_0x32531c,null))['then'](function(_0x5e2ead){var _0x2d4d88=_[_0xf419('0x33')](_0x5e2ead,'id');var _0x23d30a=[];var _0x12a65c=[];var _0x5c2681=squel[_0xf419('0x77')]();_0x5c2681[_0xf419('0x78')](_0xf419('0x79'))['from'](_0xf419('0x7a'),'tq')[_0xf419('0x7b')](_0xf419('0x7c'),'ut',_0xf419('0x7d'))['where']('SmsQueueId\x20=\x20?',_0x5dede0[_0xf419('0x4c')]['id']);for(var _0x2a0fb1=0x0;_0x2a0fb1<_0x5e2ead[_0xf419('0x3f')];_0x2a0fb1+=0x1){let _0x41343e=_0x5e2ead[_0x2a0fb1];for(var _0x47d391=0x0;_0x47d391<_0x41343e[_0xf419('0x6a')]['length'];_0x47d391+=0x1){let _0x443d5f=_0x41343e['Agents'][_0x47d391];var _0x4f6678=_0x5c2681[_0xf419('0x7e')]();_0x4f6678[_0xf419('0x41')]('ut.UserId\x20=\x20?',_0x443d5f['id']);_0x12a65c[_0xf419('0x7f')](db[_0xf419('0x6e')][_0xf419('0x39')](_0x4f6678[_0xf419('0x80')](),{'type':db['sequelize']['QueryTypes'][_0xf419('0x81')]})[_0xf419('0x2b')](function(_0x5c1b8d){if(_0x5c1b8d['length']===0x1){return _0x443d5f['id'];}else{var _0xb1186d=_[_0xf419('0x82')](_['map'](_0x5c1b8d,_0xf419('0x83')),function(_0x295f36){return _[_0xf419('0x84')](_0x2d4d88,_0x295f36);});if(_0xb1186d){return _0x443d5f['id'];}}}));}}return BPromise[_0xf419('0x85')](_0x12a65c)[_0xf419('0x2b')](function(_0xe01f96){_0x23d30a=_(_0x23d30a)[_0xf419('0x86')](_0xe01f96)['compact']()[_0xf419('0x87')]();return db[_0xf419('0x34')][_0xf419('0x4d')]({'where':{'id':_0x5dede0[_0xf419('0x4c')]['id']}})[_0xf419('0x2b')](function(_0x3cceec){return db[_0xf419('0x6e')]['transaction'](function(_0x41b77f){return _0x3cceec[_0xf419('0x76')](_0x5dede0[_0xf419('0x39')][_0xf419('0x67')],{'transaction':_0x41b77f})[_0xf419('0x2b')](function(){if(!_['isEmpty'](_0x23d30a)){return _0x3cceec[_0xf419('0x88')](_0x23d30a,{'transaction':_0x41b77f});}})[_0xf419('0x2b')](function(){_0x23d30a[_0xf419('0x73')](function(_0x17f813){socket[_0xf419('0x74')](_0xf419('0x89'),{'UserId':_0x17f813,'SmsQueueId':_0x3cceec['id']});});});});});});})[_0xf419('0x2b')](respondWithStatusCode(_0x32531c,null))[_0xf419('0x4a')](handleError(_0x32531c,null));};exports[_0xf419('0x8a')]=function(_0x5c4455,_0x355ad0,_0x704a54){return db[_0xf419('0x34')][_0xf419('0x4d')]({'where':{'id':_0x5c4455[_0xf419('0x4c')]['id']}})[_0xf419('0x2b')](handleEntityNotFound(_0x355ad0,null))[_0xf419('0x2b')](function(_0x5318da){if(_0x5318da){return _0x5318da[_0xf419('0x8a')](_0x5c4455['body'][_0xf419('0x67')],_[_0xf419('0x8b')](_0x5c4455['body'],[_0xf419('0x67'),'id'])||{})['spread'](function(_0x24cdb7){for(var _0x14029e=0x0;_0x14029e<_0x5c4455[_0xf419('0x55')][_0xf419('0x67')][_0xf419('0x3f')];_0x14029e+=0x1){socket[_0xf419('0x74')]('userSmsQueue:save',{'UserId':Number(_0x5c4455[_0xf419('0x55')]['ids'][_0x14029e]),'SmsQueueId':Number(_0x5c4455['params']['id'])});}return _0x24cdb7;});}})[_0xf419('0x2b')](respondWithResult(_0x355ad0,null))[_0xf419('0x4a')](handleError(_0x355ad0,null));};exports['removeAgents']=function(_0x15584c,_0x1c28bb,_0x1fd1e0){return db[_0xf419('0x34')][_0xf419('0x4d')]({'where':{'id':_0x15584c['params']['id']}})[_0xf419('0x2b')](handleEntityNotFound(_0x1c28bb,null))[_0xf419('0x2b')](function(_0x42fa9d){if(_0x42fa9d){return _0x42fa9d[_0xf419('0x88')](_0x15584c['query']['ids'])[_0xf419('0x2b')](function(){if(_[_0xf419('0x8c')](_0x15584c['query']['ids'])){for(var _0x381ded=0x0;_0x381ded<_0x15584c[_0xf419('0x39')][_0xf419('0x67')][_0xf419('0x3f')];_0x381ded+=0x1){socket[_0xf419('0x74')](_0xf419('0x89'),{'UserId':Number(_0x15584c[_0xf419('0x39')][_0xf419('0x67')][_0x381ded]),'SmsQueueId':Number(_0x15584c[_0xf419('0x4c')]['id'])});}}else{socket[_0xf419('0x74')](_0xf419('0x89'),{'UserId':Number(_0x15584c[_0xf419('0x39')][_0xf419('0x67')]),'SmsQueueId':Number(_0x15584c['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1c28bb,null))[_0xf419('0x4a')](handleError(_0x1c28bb,null));};exports[_0xf419('0x8d')]=function(_0x2307fb,_0x3f9e98,_0x654580){var _0x59bbb9={};var _0x27364f={};var _0x33885f;var _0x47dbce;return db[_0xf419('0x34')][_0xf419('0x8e')]({'where':{'id':_0x2307fb[_0xf419('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f9e98,null))[_0xf419('0x2b')](function(_0x5ce532){if(_0x5ce532){_0x33885f=_0x5ce532;_0x27364f['model']=_['keys'](db[_0xf419('0x69')][_0xf419('0x58')]);_0x27364f['query']=_[_0xf419('0x3a')](_0x2307fb[_0xf419('0x39')]);_0x27364f[_0xf419('0x3b')]=_[_0xf419('0x3c')](_0x27364f[_0xf419('0x38')],_0x27364f[_0xf419('0x39')]);_0x59bbb9['attributes']=_[_0xf419('0x3c')](_0x27364f['model'],qs[_0xf419('0x3e')](_0x2307fb[_0xf419('0x39')][_0xf419('0x3e')]));_0x59bbb9[_0xf419('0x3d')]=_0x59bbb9[_0xf419('0x3d')][_0xf419('0x3f')]?_0x59bbb9['attributes']:_0x27364f[_0xf419('0x38')];_0x59bbb9[_0xf419('0x59')]=qs[_0xf419('0x5a')](_0x2307fb[_0xf419('0x39')][_0xf419('0x5a')]);_0x59bbb9[_0xf419('0x41')]=qs[_0xf419('0x3b')](_['pick'](_0x2307fb[_0xf419('0x39')],_0x27364f[_0xf419('0x3b')]));if(_0x2307fb[_0xf419('0x39')]['filter']){_0x59bbb9['where']=_[_0xf419('0x44')](_0x59bbb9[_0xf419('0x41')],{'$or':_[_0xf419('0x33')](_0x59bbb9['attributes'],function(_0x477da5){var _0x10e55f={};_0x10e55f[_0x477da5]={'$like':'%'+_0x2307fb['query']['filter']+'%'};return _0x10e55f;})});}_0x59bbb9=_[_0xf419('0x44')]({},_0x59bbb9,_0x2307fb[_0xf419('0x46')]);return _0x33885f[_0xf419('0x8d')](_0x59bbb9);}})[_0xf419('0x2b')](function(_0x37b19b){if(_0x37b19b){_0x47dbce=_0x37b19b[_0xf419('0x3f')];if(!_0x2307fb['query'][_0xf419('0x40')](_0xf419('0x66'))){_0x59bbb9[_0xf419('0x24')]=qs[_0xf419('0x24')](_0x2307fb[_0xf419('0x39')][_0xf419('0x24')]);_0x59bbb9[_0xf419('0x26')]=qs[_0xf419('0x26')](_0x2307fb[_0xf419('0x39')][_0xf419('0x26')]);}return _0x33885f['getAgents'](_0x59bbb9);}})[_0xf419('0x2b')](function(_0x10794d){if(_0x10794d){return _0x10794d?{'count':_0x47dbce,'rows':_0x10794d}:null;}})[_0xf419('0x2b')](respondWithResult(_0x3f9e98,null))[_0xf419('0x4a')](handleError(_0x3f9e98,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 151aa93..3e075e4 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 _0x778c=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x169c71,_0xeacea){var _0x3ec303=function(_0x5de4ad){while(--_0x5de4ad){_0x169c71['push'](_0x169c71['shift']());}};_0x3ec303(++_0xeacea);}(_0x778c,0x13d));var _0xc778=function(_0x481bdf,_0x231538){_0x481bdf=_0x481bdf-0x0;var _0x281a12=_0x778c[_0x481bdf];return _0x281a12;};'use strict';var EventEmitter=require(_0xc778('0x0'));var SmsQueue=require(_0xc778('0x1'))['db'][_0xc778('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc778('0x3')](0x0);var events={'afterCreate':_0xc778('0x4'),'afterUpdate':_0xc778('0x5'),'afterDestroy':_0xc778('0x6')};function emitEvent(_0x3170f6){return function(_0x7f6466,_0x4f625c,_0x4de392){SmsQueueEvents[_0xc778('0x7')](_0x3170f6+':'+_0x7f6466['id'],_0x7f6466);SmsQueueEvents[_0xc778('0x7')](_0x3170f6,_0x7f6466);_0x4de392(null);};}for(var e in events){if(events[_0xc778('0x8')](e)){var event=events[e];SmsQueue[_0xc778('0x9')](e,emitEvent(event));}}module[_0xc778('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xd5a4=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save','update','remove','emit'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0xd5a4,0x125));var _0x4d5a=function(_0x21f6b5,_0x4ae2cf){_0x21f6b5=_0x21f6b5-0x0;var _0x133b56=_0xd5a4[_0x21f6b5];return _0x133b56;};'use strict';var EventEmitter=require(_0x4d5a('0x0'));var SmsQueue=require(_0x4d5a('0x1'))['db'][_0x4d5a('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4d5a('0x3'),'afterUpdate':_0x4d5a('0x4'),'afterDestroy':_0x4d5a('0x5')};function emitEvent(_0x320cf2){return function(_0x5b0fbc,_0x19a757,_0x3e8a5a){SmsQueueEvents[_0x4d5a('0x6')](_0x320cf2+':'+_0x5b0fbc['id'],_0x5b0fbc);SmsQueueEvents[_0x4d5a('0x6')](_0x320cf2,_0x5b0fbc);_0x3e8a5a(null);};}for(var e in events){if(events[_0x4d5a('0x7')](e)){var event=events[e];SmsQueue[_0x4d5a('0x8')](e,emitEvent(event));}}module[_0x4d5a('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 f94bbae..c20ee56 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 _0xe9b8=['bluebird','request-promise','rimraf','../../config/environment','exports','define','sms_queues','lodash','api','moment'];(function(_0x291111,_0x485fd2){var _0x3a48e8=function(_0x35ba82){while(--_0x35ba82){_0x291111['push'](_0x291111['shift']());}};_0x3a48e8(++_0x485fd2);}(_0xe9b8,0x7f));var _0x8e9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe9b8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x8e9b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8e9b('0x1'));var moment=require(_0x8e9b('0x2'));var BPromise=require(_0x8e9b('0x3'));var rp=require(_0x8e9b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e9b('0x5'));var config=require(_0x8e9b('0x6'));var attributes=require('./smsQueue.attributes');module[_0x8e9b('0x7')]=function(_0x40af63,_0x5a7b6e){return _0x40af63[_0x8e9b('0x8')]('SmsQueue',attributes,{'tableName':_0x8e9b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x736b=['../../config/logger','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util'];(function(_0x3612d0,_0x21a39c){var _0x1be7cb=function(_0x3df49f){while(--_0x3df49f){_0x3612d0['push'](_0x3612d0['shift']());}};_0x1be7cb(++_0x21a39c);}(_0x736b,0x1d2));var _0xb736=function(_0x202c8e,_0x396285){_0x202c8e=_0x202c8e-0x0;var _0x29f6d3=_0x736b[_0x202c8e];return _0x29f6d3;};'use strict';var _=require(_0xb736('0x0'));var util=require(_0xb736('0x1'));var logger=require(_0xb736('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb736('0x3'));var rp=require(_0xb736('0x4'));var fs=require('fs');var path=require(_0xb736('0x5'));var rimraf=require('rimraf');var config=require(_0xb736('0x6'));var attributes=require(_0xb736('0x7'));module[_0xb736('0x8')]=function(_0x59f77e,_0x53585c){return _0x59f77e[_0xb736('0x9')](_0xb736('0xa'),attributes,{'tableName':_0xb736('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 36a24ea..1527cb5 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 _0xb251=['where','attributes','limit','include','map','model','catch','ShowSmsQueue','find','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSmsQueue','SmsQueue','options','raw'];(function(_0x50e88c,_0x439ebc){var _0x4f32e8=function(_0x596269){while(--_0x596269){_0x50e88c['push'](_0x50e88c['shift']());}};_0x4f32e8(++_0x439ebc);}(_0xb251,0x1c5));var _0x1b25=function(_0x20fb98,_0x304bfb){_0x20fb98=_0x20fb98-0x0;var _0x645f7e=_0xb251[_0x20fb98];return _0x645f7e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1b25('0x0'));var rs=require(_0x1b25('0x1'));var fs=require('fs');var Redis=require(_0x1b25('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b25('0x3'))(_0x1b25('0x4'));var config=require(_0x1b25('0x5'));var jayson=require(_0x1b25('0x6'));var client=jayson[_0x1b25('0x7')]['http']({'port':0x232a});config[_0x1b25('0x8')]=_[_0x1b25('0x9')](config[_0x1b25('0x8')],{'host':_0x1b25('0xa'),'port':0x18eb});var socket=require(_0x1b25('0xb'))(new Redis(config['redis']));require(_0x1b25('0xc'))[_0x1b25('0xd')](socket);function respondWithRpcPromise(_0x194a20,_0x18c8a2,_0x2ae5ff){return new BPromise(function(_0x5ef5d4,_0x362717){return client[_0x1b25('0xe')](_0x194a20,_0x2ae5ff)[_0x1b25('0xf')](function(_0x3a3f61){logger[_0x1b25('0x10')](_0x1b25('0x11'),_0x18c8a2,_0x1b25('0x12'));logger[_0x1b25('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x18c8a2,_0x1b25('0x12'),JSON[_0x1b25('0x14')](_0x3a3f61));if(_0x3a3f61['error']){if(_0x3a3f61[_0x1b25('0x15')][_0x1b25('0x16')]===0x1f4){logger[_0x1b25('0x15')]('SmsQueue,\x20%s,\x20%s',_0x18c8a2,_0x3a3f61[_0x1b25('0x15')]['message']);return _0x362717(_0x3a3f61[_0x1b25('0x15')][_0x1b25('0x17')]);}logger[_0x1b25('0x15')](_0x1b25('0x11'),_0x18c8a2,_0x3a3f61[_0x1b25('0x15')]['message']);return _0x5ef5d4(_0x3a3f61['error']['message']);}else{logger['info'](_0x1b25('0x11'),_0x18c8a2,'request\x20sent');_0x5ef5d4(_0x3a3f61['result']['message']);}})['catch'](function(_0x43473b){logger[_0x1b25('0x15')](_0x1b25('0x11'),_0x18c8a2,_0x43473b);_0x362717(_0x43473b);});});}exports[_0x1b25('0x18')]=function(_0x4ac61a){var _0x45423b=this;return new Promise(function(_0x591467,_0x26cc59){return db[_0x1b25('0x19')]['findAll']({'raw':_0x4ac61a[_0x1b25('0x1a')]?_0x4ac61a[_0x1b25('0x1a')][_0x1b25('0x1b')]===undefined?!![]:![]:!![],'where':_0x4ac61a[_0x1b25('0x1a')]?_0x4ac61a[_0x1b25('0x1a')][_0x1b25('0x1c')]||null:null,'attributes':_0x4ac61a['options']?_0x4ac61a[_0x1b25('0x1a')][_0x1b25('0x1d')]||null:null,'limit':_0x4ac61a[_0x1b25('0x1a')]?_0x4ac61a[_0x1b25('0x1a')][_0x1b25('0x1e')]||null:null,'include':_0x4ac61a['options']?_0x4ac61a[_0x1b25('0x1a')][_0x1b25('0x1f')]?_[_0x1b25('0x20')](_0x4ac61a['options'][_0x1b25('0x1f')],function(_0x3072a6){return{'model':db[_0x3072a6[_0x1b25('0x21')]],'as':_0x3072a6['as'],'attributes':_0x3072a6['attributes'],'include':_0x3072a6[_0x1b25('0x1f')]?_['map'](_0x3072a6[_0x1b25('0x1f')],function(_0xf918c7){return{'model':db[_0xf918c7['model']],'as':_0xf918c7['as'],'attributes':_0xf918c7[_0x1b25('0x1d')],'include':_0xf918c7[_0x1b25('0x1f')]?_[_0x1b25('0x20')](_0xf918c7[_0x1b25('0x1f')],function(_0x5e65d6){return{'model':db[_0x5e65d6['model']],'as':_0x5e65d6['as'],'attributes':_0x5e65d6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x110aac){logger['info'](_0x1b25('0x18'),_0x4ac61a);logger[_0x1b25('0x13')](_0x1b25('0x18'),_0x4ac61a,JSON[_0x1b25('0x14')](_0x110aac));_0x591467(_0x110aac);})[_0x1b25('0x22')](function(_0x4e6e05){logger[_0x1b25('0x15')](_0x1b25('0x18'),_0x4e6e05[_0x1b25('0x17')],_0x4ac61a);_0x26cc59(_0x45423b[_0x1b25('0x15')](0x1f4,_0x4e6e05['message']));});});};exports[_0x1b25('0x23')]=function(_0x973cb2){var _0xd0a947=this;return new Promise(function(_0x402d09,_0x4c0c8d){return db[_0x1b25('0x19')][_0x1b25('0x24')]({'raw':_0x973cb2[_0x1b25('0x1a')]?_0x973cb2[_0x1b25('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x973cb2['options']?_0x973cb2['options'][_0x1b25('0x1c')]||null:null,'attributes':_0x973cb2[_0x1b25('0x1a')]?_0x973cb2[_0x1b25('0x1a')]['attributes']||null:null,'include':_0x973cb2[_0x1b25('0x1a')]?_0x973cb2[_0x1b25('0x1a')][_0x1b25('0x1f')]?_[_0x1b25('0x20')](_0x973cb2[_0x1b25('0x1a')][_0x1b25('0x1f')],function(_0x52660a){return{'model':db[_0x52660a['model']],'as':_0x52660a['as'],'attributes':_0x52660a[_0x1b25('0x1d')],'include':_0x52660a[_0x1b25('0x1f')]?_[_0x1b25('0x20')](_0x52660a[_0x1b25('0x1f')],function(_0x562eec){return{'model':db[_0x562eec['model']],'as':_0x562eec['as'],'attributes':_0x562eec[_0x1b25('0x1d')],'include':_0x562eec[_0x1b25('0x1f')]?_['map'](_0x562eec[_0x1b25('0x1f')],function(_0x4f7347){return{'model':db[_0x4f7347['model']],'as':_0x4f7347['as'],'attributes':_0x4f7347[_0x1b25('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1b25('0xf')](function(_0x2c8589){logger['info'](_0x1b25('0x23'),_0x973cb2);logger[_0x1b25('0x13')](_0x1b25('0x23'),_0x973cb2,JSON['stringify'](_0x2c8589));_0x402d09(_0x2c8589);})[_0x1b25('0x22')](function(_0x5305d0){logger['error'](_0x1b25('0x23'),_0x5305d0[_0x1b25('0x17')],_0x973cb2);_0x4c0c8d(_0xd0a947[_0x1b25('0x15')](0x1f4,_0x5305d0[_0x1b25('0x17')]));});});}; \ No newline at end of file +var _0x36c8=['../../config/environment','jayson/promise','http','redis','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x161762,_0x2a4eae){var _0x304e71=function(_0x339dbe){while(--_0x339dbe){_0x161762['push'](_0x161762['shift']());}};_0x304e71(++_0x2a4eae);}(_0x36c8,0x180));var _0x836c=function(_0x37dac6,_0x34e463){_0x37dac6=_0x37dac6-0x0;var _0x2df364=_0x36c8[_0x37dac6];return _0x2df364;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x836c('0x0'));var BPromise=require(_0x836c('0x1'));var rs=require(_0x836c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x836c('0x3'))['db'];var utils=require(_0x836c('0x4'));var logger=require(_0x836c('0x5'))('rpc');var config=require(_0x836c('0x6'));var jayson=require(_0x836c('0x7'));var client=jayson['client'][_0x836c('0x8')]({'port':0x232a});config[_0x836c('0x9')]=_['defaults'](config[_0x836c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x836c('0xa'))(new Redis(config['redis']));require(_0x836c('0xb'))[_0x836c('0xc')](socket);function respondWithRpcPromise(_0x171a15,_0x50c7eb,_0x34e6ec){return new BPromise(function(_0x3b203a,_0xf0a7){return client[_0x836c('0xd')](_0x171a15,_0x34e6ec)[_0x836c('0xe')](function(_0x36ffe9){logger[_0x836c('0xf')](_0x836c('0x10'),_0x50c7eb,_0x836c('0x11'));logger[_0x836c('0x12')](_0x836c('0x13'),_0x50c7eb,_0x836c('0x11'),JSON[_0x836c('0x14')](_0x36ffe9));if(_0x36ffe9[_0x836c('0x15')]){if(_0x36ffe9[_0x836c('0x15')][_0x836c('0x16')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x50c7eb,_0x36ffe9[_0x836c('0x15')]['message']);return _0xf0a7(_0x36ffe9[_0x836c('0x15')][_0x836c('0x17')]);}logger[_0x836c('0x15')](_0x836c('0x10'),_0x50c7eb,_0x36ffe9[_0x836c('0x15')][_0x836c('0x17')]);return _0x3b203a(_0x36ffe9[_0x836c('0x15')][_0x836c('0x17')]);}else{logger[_0x836c('0xf')]('SmsQueue,\x20%s,\x20%s',_0x50c7eb,_0x836c('0x11'));_0x3b203a(_0x36ffe9[_0x836c('0x18')][_0x836c('0x17')]);}})[_0x836c('0x19')](function(_0x2a751d){logger['error'](_0x836c('0x10'),_0x50c7eb,_0x2a751d);_0xf0a7(_0x2a751d);});});}exports['GetSmsQueue']=function(_0x448b1d){var _0x32baa8=this;return new Promise(function(_0x1dc131,_0x228870){return db[_0x836c('0x1a')][_0x836c('0x1b')]({'raw':_0x448b1d[_0x836c('0x1c')]?_0x448b1d[_0x836c('0x1c')][_0x836c('0x1d')]===undefined?!![]:![]:!![],'where':_0x448b1d[_0x836c('0x1c')]?_0x448b1d[_0x836c('0x1c')][_0x836c('0x1e')]||null:null,'attributes':_0x448b1d[_0x836c('0x1c')]?_0x448b1d[_0x836c('0x1c')][_0x836c('0x1f')]||null:null,'limit':_0x448b1d[_0x836c('0x1c')]?_0x448b1d['options'][_0x836c('0x20')]||null:null,'include':_0x448b1d[_0x836c('0x1c')]?_0x448b1d['options'][_0x836c('0x21')]?_[_0x836c('0x22')](_0x448b1d['options'][_0x836c('0x21')],function(_0x2d9245){return{'model':db[_0x2d9245[_0x836c('0x23')]],'as':_0x2d9245['as'],'attributes':_0x2d9245[_0x836c('0x1f')],'include':_0x2d9245[_0x836c('0x21')]?_[_0x836c('0x22')](_0x2d9245['include'],function(_0x3192d5){return{'model':db[_0x3192d5[_0x836c('0x23')]],'as':_0x3192d5['as'],'attributes':_0x3192d5[_0x836c('0x1f')],'include':_0x3192d5[_0x836c('0x21')]?_[_0x836c('0x22')](_0x3192d5[_0x836c('0x21')],function(_0x257190){return{'model':db[_0x257190[_0x836c('0x23')]],'as':_0x257190['as'],'attributes':_0x257190[_0x836c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x836c('0xe')](function(_0x38fda5){logger['info'](_0x836c('0x24'),_0x448b1d);logger[_0x836c('0x12')](_0x836c('0x24'),_0x448b1d,JSON[_0x836c('0x14')](_0x38fda5));_0x1dc131(_0x38fda5);})['catch'](function(_0x62ed09){logger['error']('GetSmsQueue',_0x62ed09[_0x836c('0x17')],_0x448b1d);_0x228870(_0x32baa8[_0x836c('0x15')](0x1f4,_0x62ed09[_0x836c('0x17')]));});});};exports[_0x836c('0x25')]=function(_0x573576){var _0x48f20b=this;return new Promise(function(_0x280e6e,_0x47a6fc){return db[_0x836c('0x1a')][_0x836c('0x26')]({'raw':_0x573576['options']?_0x573576[_0x836c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x573576[_0x836c('0x1c')]?_0x573576[_0x836c('0x1c')][_0x836c('0x1e')]||null:null,'attributes':_0x573576['options']?_0x573576[_0x836c('0x1c')]['attributes']||null:null,'include':_0x573576['options']?_0x573576[_0x836c('0x1c')][_0x836c('0x21')]?_['map'](_0x573576[_0x836c('0x1c')][_0x836c('0x21')],function(_0x43889e){return{'model':db[_0x43889e[_0x836c('0x23')]],'as':_0x43889e['as'],'attributes':_0x43889e[_0x836c('0x1f')],'include':_0x43889e[_0x836c('0x21')]?_[_0x836c('0x22')](_0x43889e['include'],function(_0x3a371a){return{'model':db[_0x3a371a[_0x836c('0x23')]],'as':_0x3a371a['as'],'attributes':_0x3a371a['attributes'],'include':_0x3a371a[_0x836c('0x21')]?_['map'](_0x3a371a[_0x836c('0x21')],function(_0x19d271){return{'model':db[_0x19d271[_0x836c('0x23')]],'as':_0x19d271['as'],'attributes':_0x19d271[_0x836c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x836c('0xe')](function(_0x55f1e0){logger[_0x836c('0xf')]('ShowSmsQueue',_0x573576);logger[_0x836c('0x12')](_0x836c('0x25'),_0x573576,JSON[_0x836c('0x14')](_0x55f1e0));_0x280e6e(_0x55f1e0);})[_0x836c('0x19')](function(_0x302c9d){logger['error'](_0x836c('0x25'),_0x302c9d['message'],_0x573576);_0x47a6fc(_0x48f20b[_0x836c('0x15')](0x1f4,_0x302c9d[_0x836c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index e7ea15c..bbd1d3f 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 _0xdff1=['register','length','save','emit'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xdff1,0xba));var _0x1dff=function(_0x355a1a,_0x35e06a){_0x355a1a=_0x355a1a-0x0;var _0xcbf52c=_0xdff1[_0x355a1a];return _0xcbf52c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x1dff('0x0'),'remove','update'];function createListener(_0x5c3194,_0x540570){return function(_0x11139f){_0x540570[_0x1dff('0x1')](_0x5c3194,_0x11139f);};}function removeListener(_0x1d4c5c,_0x4ae34d){return function(){SmsQueueEvents['removeListener'](_0x1d4c5c,_0x4ae34d);};}exports[_0x1dff('0x2')]=function(_0x5e6e91){for(var _0xc25f89=0x0,_0x4da309=events[_0x1dff('0x3')];_0xc25f89<_0x4da309;_0xc25f89++){var _0xf5036a=events[_0xc25f89];var _0xe6561b=createListener('smsQueue:'+_0xf5036a,_0x5e6e91);SmsQueueEvents['on'](_0xf5036a,_0xe6561b);}}; \ No newline at end of file +var _0x308a=['register','length','smsQueue:','./smsQueue.events','save','emit'];(function(_0x151638,_0x259de2){var _0x1637f1=function(_0x191986){while(--_0x191986){_0x151638['push'](_0x151638['shift']());}};_0x1637f1(++_0x259de2);}(_0x308a,0x183));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0xa308('0x0'));var events=[_0xa308('0x1'),'remove','update'];function createListener(_0x379a38,_0x4707aa){return function(_0x27add6){_0x4707aa[_0xa308('0x2')](_0x379a38,_0x27add6);};}function removeListener(_0x48cfa8,_0x7bccd){return function(){SmsQueueEvents['removeListener'](_0x48cfa8,_0x7bccd);};}exports[_0xa308('0x3')]=function(_0x1332d1){for(var _0x126791=0x0,_0x3eea2b=events[_0xa308('0x4')];_0x126791<_0x3eea2b;_0x126791++){var _0x491eeb=events[_0x126791];var _0xdf5ee6=createListener(_0xa308('0x5')+_0x491eeb,_0x1332d1);SmsQueueEvents['on'](_0x491eeb,_0xdf5ee6);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index a8e52f4..90ad036 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 _0x33c1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','destroy','exports','util','connect-timeout','express'];(function(_0x3a45f2,_0x44bd8f){var _0x12dc24=function(_0x321d82){while(--_0x321d82){_0x3a45f2['push'](_0x3a45f2['shift']());}};_0x12dc24(++_0x44bd8f);}(_0x33c1,0x82));var _0x133c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x33c1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x133c('0x0'));var path=require('path');var timeout=require(_0x133c('0x1'));var express=require(_0x133c('0x2'));var router=express['Router']();var fs_extra=require(_0x133c('0x3'));var auth=require(_0x133c('0x4'));var interaction=require(_0x133c('0x5'));var config=require(_0x133c('0x6'));var controller=require(_0x133c('0x7'));router[_0x133c('0x8')]('/',auth[_0x133c('0x9')](),controller[_0x133c('0xa')]);router[_0x133c('0x8')](_0x133c('0xb'),auth[_0x133c('0x9')](),controller[_0x133c('0xc')]);router[_0x133c('0x8')](_0x133c('0xd'),auth[_0x133c('0x9')](),controller[_0x133c('0xe')]);router[_0x133c('0xf')]('/',auth['isAuthenticated'](),controller[_0x133c('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x133c('0x9')](),controller[_0x133c('0x11')]);module[_0x133c('0x12')]=router; \ No newline at end of file +var _0xe6cd=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','post','put','/:id','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6cd,0x159));var _0xde6c=function(_0x5d0f97,_0x25009f){_0x5d0f97=_0x5d0f97-0x0;var _0xc7236=_0xe6cd[_0x5d0f97];return _0xc7236;};'use strict';var multer=require(_0xde6c('0x0'));var util=require(_0xde6c('0x1'));var path=require(_0xde6c('0x2'));var timeout=require(_0xde6c('0x3'));var express=require('express');var router=express[_0xde6c('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xde6c('0x5'));var config=require(_0xde6c('0x6'));var controller=require(_0xde6c('0x7'));router[_0xde6c('0x8')]('/',auth[_0xde6c('0x9')](),controller[_0xde6c('0xa')]);router['get']('/describe',auth[_0xde6c('0x9')](),controller['describe']);router[_0xde6c('0x8')]('/:id',auth[_0xde6c('0x9')](),controller['show']);router[_0xde6c('0xb')]('/',auth[_0xde6c('0x9')](),controller['create']);router[_0xde6c('0xc')](_0xde6c('0xd'),auth['isAuthenticated'](),controller[_0xde6c('0xe')]);router[_0xde6c('0xf')](_0xde6c('0xd'),auth[_0xde6c('0x9')](),controller[_0xde6c('0x10')]);module[_0xde6c('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index df9694f..c752d7c 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 _0x510e=['exports','STRING','DATE','moment','sequelize'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0x510e,0x1ed));var _0xe510=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x510e[_0x255d5b];return _0x3e141a;};'use strict';var moment=require(_0xe510('0x0'));var Sequelize=require(_0xe510('0x1'));module[_0xe510('0x2')]={'uniqueid':{'type':Sequelize[_0xe510('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xe510('0x3')]},'joinAt':{'type':Sequelize[_0xe510('0x4')]},'leaveAt':{'type':Sequelize[_0xe510('0x4')]},'acceptAt':{'type':Sequelize[_0xe510('0x4')]},'exitAt':{'type':Sequelize[_0xe510('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5ad6=['DATE','moment','sequelize','exports','STRING'];(function(_0x3249b4,_0x34459f){var _0xb4e569=function(_0x815cd9){while(--_0x815cd9){_0x3249b4['push'](_0x3249b4['shift']());}};_0xb4e569(++_0x34459f);}(_0x5ad6,0xba));var _0x65ad=function(_0x465aa9,_0x1bf1c8){_0x465aa9=_0x465aa9-0x0;var _0x4104e4=_0x5ad6[_0x465aa9];return _0x4104e4;};'use strict';var moment=require(_0x65ad('0x0'));var Sequelize=require(_0x65ad('0x1'));module[_0x65ad('0x2')]={'uniqueid':{'type':Sequelize[_0x65ad('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x65ad('0x4')]},'leaveAt':{'type':Sequelize[_0x65ad('0x4')]},'acceptAt':{'type':Sequelize[_0x65ad('0x4')]},'exitAt':{'type':Sequelize[_0x65ad('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index a1f714c..780d460 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 _0xfae1=['name','index','map','SmsQueueReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy'];(function(_0x5648dd,_0x340a62){var _0x5f430d=function(_0x16f746){while(--_0x16f746){_0x5648dd['push'](_0x5648dd['shift']());}};_0x5f430d(++_0x340a62);}(_0xfae1,0x1e4));var _0x1fae=function(_0x5a79ee,_0x2d9c2a){_0x5a79ee=_0x5a79ee-0x0;var _0xce3a8b=_0xfae1[_0x5a79ee];return _0xce3a8b;};'use strict';var emlformat=require(_0x1fae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1fae('0x1'));var jsonpatch=require(_0x1fae('0x2'));var rp=require(_0x1fae('0x3'));var moment=require(_0x1fae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fae('0x5'));var util=require(_0x1fae('0x6'));var path=require(_0x1fae('0x7'));var sox=require(_0x1fae('0x8'));var csv=require(_0x1fae('0x9'));var ejs=require(_0x1fae('0xa'));var fs=require('fs');var fs_extra=require(_0x1fae('0xb'));var _=require(_0x1fae('0xc'));var squel=require('squel');var crypto=require(_0x1fae('0xd'));var jsforce=require(_0x1fae('0xe'));var deskjs=require(_0x1fae('0xf'));var toCsv=require(_0x1fae('0x9'));var querystring=require(_0x1fae('0x10'));var Papa=require(_0x1fae('0x11'));var Redis=require('ioredis');var authService=require(_0x1fae('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1fae('0x13'));var hardwareService=require(_0x1fae('0x14'));var logger=require(_0x1fae('0x15'))(_0x1fae('0x16'));var utils=require(_0x1fae('0x17'));var config=require(_0x1fae('0x18'));var licenseUtil=require(_0x1fae('0x19'));var db=require(_0x1fae('0x1a'))['db'];function respondWithStatusCode(_0x497ecb,_0x13a023){_0x13a023=_0x13a023||0xcc;return function(_0x2ebfbb){if(_0x2ebfbb){return _0x497ecb[_0x1fae('0x1b')](_0x13a023);}return _0x497ecb[_0x1fae('0x1c')](_0x13a023)[_0x1fae('0x1d')]();};}function respondWithResult(_0x4333b1,_0x3a5536){_0x3a5536=_0x3a5536||0xc8;return function(_0x396d61){if(_0x396d61){return _0x4333b1[_0x1fae('0x1c')](_0x3a5536)[_0x1fae('0x1e')](_0x396d61);}};}function respondWithFilteredResult(_0xb1a7dc,_0x26f803){return function(_0x1dc83c){if(_0x1dc83c){var _0x57e1da=typeof _0x26f803[_0x1fae('0x1f')]===_0x1fae('0x20')&&typeof _0x26f803[_0x1fae('0x21')]===_0x1fae('0x20');var _0x424a04=_0x1dc83c['count'];var _0x36485f=_0x57e1da?0x0:_0x26f803['offset'];var _0x2b22a0=_0x57e1da?_0x1dc83c[_0x1fae('0x22')]:_0x26f803['offset']+_0x26f803['limit'];var _0x355297;if(_0x2b22a0>=_0x424a04){_0x2b22a0=_0x424a04;_0x355297=0xc8;}else{_0x355297=0xce;}_0xb1a7dc[_0x1fae('0x1c')](_0x355297);return _0xb1a7dc[_0x1fae('0x23')]('Content-Range',_0x36485f+'-'+_0x2b22a0+'/'+_0x424a04)[_0x1fae('0x1e')](_0x1dc83c);}return null;};}function patchUpdates(_0x2eafb4){return function(_0xd09248){try{jsonpatch[_0x1fae('0x24')](_0xd09248,_0x2eafb4,!![]);}catch(_0x4bba17){return BPromise[_0x1fae('0x25')](_0x4bba17);}return _0xd09248[_0x1fae('0x26')]();};}function saveUpdates(_0x3d3a40,_0x11e09d){return function(_0x57511a){if(_0x57511a){return _0x57511a['update'](_0x3d3a40)[_0x1fae('0x27')](function(_0x4f3878){return _0x4f3878;});}return null;};}function removeEntity(_0x59522d,_0x43d366){return function(_0x3f9fe5){if(_0x3f9fe5){return _0x3f9fe5[_0x1fae('0x28')]()[_0x1fae('0x27')](function(){_0x59522d[_0x1fae('0x1c')](0xcc)[_0x1fae('0x1d')]();});}};}function handleEntityNotFound(_0x5d3a83,_0x534a5a){return function(_0x2b6111){if(!_0x2b6111){_0x5d3a83[_0x1fae('0x1b')](0x194);}return _0x2b6111;};}function handleError(_0xb808e6,_0x544232){_0x544232=_0x544232||0x1f4;return function(_0x14a0de){logger['error'](_0x14a0de['stack']);if(_0x14a0de['name']){delete _0x14a0de[_0x1fae('0x29')];}_0xb808e6[_0x1fae('0x1c')](_0x544232)['send'](_0x14a0de);};}exports[_0x1fae('0x2a')]=function(_0x4b26e1,_0x43139b){var _0x95e47d={},_0x4c8ae4={},_0x3ce2a5={'count':0x0,'rows':[]};var _0xbb6223=_[_0x1fae('0x2b')](db[_0x1fae('0x2c')]['rawAttributes'],function(_0x4b92d1){return{'name':_0x4b92d1['fieldName'],'type':_0x4b92d1[_0x1fae('0x2d')]['key']};});_0x4c8ae4[_0x1fae('0x2e')]=_['map'](_0xbb6223,_0x1fae('0x29'));_0x4c8ae4[_0x1fae('0x2f')]=_[_0x1fae('0x30')](_0x4b26e1[_0x1fae('0x2f')]);_0x4c8ae4[_0x1fae('0x31')]=_[_0x1fae('0x32')](_0x4c8ae4['model'],_0x4c8ae4[_0x1fae('0x2f')]);_0x95e47d[_0x1fae('0x33')]=_[_0x1fae('0x32')](_0x4c8ae4[_0x1fae('0x2e')],qs[_0x1fae('0x34')](_0x4b26e1[_0x1fae('0x2f')][_0x1fae('0x34')]));_0x95e47d['attributes']=_0x95e47d[_0x1fae('0x33')][_0x1fae('0x35')]?_0x95e47d[_0x1fae('0x33')]:_0x4c8ae4['model'];if(!_0x4b26e1['query'][_0x1fae('0x36')](_0x1fae('0x37'))){_0x95e47d[_0x1fae('0x21')]=qs[_0x1fae('0x21')](_0x4b26e1[_0x1fae('0x2f')][_0x1fae('0x21')]);_0x95e47d[_0x1fae('0x1f')]=qs['offset'](_0x4b26e1['query']['offset']);}_0x95e47d[_0x1fae('0x38')]=qs[_0x1fae('0x39')](_0x4b26e1[_0x1fae('0x2f')][_0x1fae('0x39')]);_0x95e47d[_0x1fae('0x3a')]=qs[_0x1fae('0x31')](_[_0x1fae('0x3b')](_0x4b26e1[_0x1fae('0x2f')],_0x4c8ae4[_0x1fae('0x31')]),_0xbb6223);if(_0x4b26e1[_0x1fae('0x2f')][_0x1fae('0x3c')]){_0x95e47d['where']=_[_0x1fae('0x3d')](_0x95e47d[_0x1fae('0x3a')],{'$or':_[_0x1fae('0x2b')](_0xbb6223,function(_0x292643){if(_0x292643[_0x1fae('0x2d')]!==_0x1fae('0x3e')){var _0xb4c50={};_0xb4c50[_0x292643[_0x1fae('0x29')]]={'$like':'%'+_0x4b26e1['query'][_0x1fae('0x3c')]+'%'};return _0xb4c50;}})});}_0x95e47d=_[_0x1fae('0x3d')]({},_0x95e47d,_0x4b26e1['options']);var _0xf6fadf={'where':_0x95e47d['where']};return db['SmsQueueReport']['count'](_0xf6fadf)[_0x1fae('0x27')](function(_0x1f5eb3){_0x3ce2a5[_0x1fae('0x22')]=_0x1f5eb3;if(_0x4b26e1[_0x1fae('0x2f')][_0x1fae('0x3f')]){_0x95e47d[_0x1fae('0x40')]=[{'all':!![]}];}return db[_0x1fae('0x2c')][_0x1fae('0x41')](_0x95e47d);})[_0x1fae('0x27')](function(_0x40f046){_0x3ce2a5[_0x1fae('0x42')]=_0x40f046;return _0x3ce2a5;})['then'](respondWithFilteredResult(_0x43139b,_0x95e47d))[_0x1fae('0x43')](handleError(_0x43139b,null));};exports['show']=function(_0x23fb75,_0x4af5a3){var _0x2b3b3a={'raw':!![],'where':{'id':_0x23fb75[_0x1fae('0x44')]['id']}},_0x4d37f9={};_0x4d37f9[_0x1fae('0x2e')]=_[_0x1fae('0x30')](db[_0x1fae('0x2c')][_0x1fae('0x45')]);_0x4d37f9[_0x1fae('0x2f')]=_[_0x1fae('0x30')](_0x23fb75['query']);_0x4d37f9['filters']=_[_0x1fae('0x32')](_0x4d37f9['model'],_0x4d37f9[_0x1fae('0x2f')]);_0x2b3b3a[_0x1fae('0x33')]=_[_0x1fae('0x32')](_0x4d37f9['model'],qs[_0x1fae('0x34')](_0x23fb75[_0x1fae('0x2f')][_0x1fae('0x34')]));_0x2b3b3a['attributes']=_0x2b3b3a[_0x1fae('0x33')][_0x1fae('0x35')]?_0x2b3b3a['attributes']:_0x4d37f9[_0x1fae('0x2e')];if(_0x23fb75[_0x1fae('0x2f')][_0x1fae('0x3f')]){_0x2b3b3a[_0x1fae('0x40')]=[{'all':!![]}];}_0x2b3b3a=_['merge']({},_0x2b3b3a,_0x23fb75[_0x1fae('0x46')]);return db['SmsQueueReport'][_0x1fae('0x47')](_0x2b3b3a)[_0x1fae('0x27')](handleEntityNotFound(_0x4af5a3,null))[_0x1fae('0x27')](respondWithResult(_0x4af5a3,null))['catch'](handleError(_0x4af5a3,null));};exports[_0x1fae('0x48')]=function(_0x1ebb96,_0x2d2828){return db['SmsQueueReport'][_0x1fae('0x48')](_0x1ebb96[_0x1fae('0x49')],{})[_0x1fae('0x27')](respondWithResult(_0x2d2828,0xc9))[_0x1fae('0x43')](handleError(_0x2d2828,null));};exports['update']=function(_0x591472,_0xef4080){if(_0x591472[_0x1fae('0x49')]['id']){delete _0x591472['body']['id'];}return db[_0x1fae('0x2c')][_0x1fae('0x47')]({'where':{'id':_0x591472['params']['id']}})['then'](handleEntityNotFound(_0xef4080,null))[_0x1fae('0x27')](saveUpdates(_0x591472[_0x1fae('0x49')],null))[_0x1fae('0x27')](respondWithResult(_0xef4080,null))[_0x1fae('0x43')](handleError(_0xef4080,null));};exports[_0x1fae('0x28')]=function(_0x2e6893,_0x4dfd09){return db[_0x1fae('0x2c')]['find']({'where':{'id':_0x2e6893[_0x1fae('0x44')]['id']}})[_0x1fae('0x27')](handleEntityNotFound(_0x4dfd09,null))[_0x1fae('0x27')](removeEntity(_0x4dfd09,null))[_0x1fae('0x43')](handleError(_0x4dfd09,null));};exports[_0x1fae('0x4a')]=function(_0x160379,_0x52d168){return db[_0x1fae('0x2c')][_0x1fae('0x4a')]()[_0x1fae('0x27')](respondWithResult(_0x52d168,null))[_0x1fae('0x43')](handleError(_0x52d168,null));}; \ No newline at end of file +var _0xa0da=['map','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','update','then','sendStatus','error','stack','name','index','SmsQueueReport','key','model'];(function(_0x3d921,_0x4695c8){var _0x450ae7=function(_0x131699){while(--_0x131699){_0x3d921['push'](_0x3d921['shift']());}};_0x450ae7(++_0x4695c8);}(_0xa0da,0xac));var _0xaa0d=function(_0x4de558,_0x2730ce){_0x4de558=_0x4de558-0x0;var _0x122ea8=_0xa0da[_0x4de558];return _0x122ea8;};'use strict';var emlformat=require(_0xaa0d('0x0'));var rimraf=require(_0xaa0d('0x1'));var zipdir=require(_0xaa0d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa0d('0x3'));var moment=require(_0xaa0d('0x4'));var BPromise=require(_0xaa0d('0x5'));var Mustache=require('mustache');var util=require(_0xaa0d('0x6'));var path=require(_0xaa0d('0x7'));var sox=require('sox');var csv=require(_0xaa0d('0x8'));var ejs=require(_0xaa0d('0x9'));var fs=require('fs');var fs_extra=require(_0xaa0d('0xa'));var _=require('lodash');var squel=require(_0xaa0d('0xb'));var crypto=require(_0xaa0d('0xc'));var jsforce=require(_0xaa0d('0xd'));var deskjs=require(_0xaa0d('0xe'));var toCsv=require(_0xaa0d('0x8'));var querystring=require(_0xaa0d('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa0d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaa0d('0x11'));var as=require(_0xaa0d('0x12'));var hardwareService=require(_0xaa0d('0x13'));var logger=require(_0xaa0d('0x14'))('api');var utils=require(_0xaa0d('0x15'));var config=require(_0xaa0d('0x16'));var licenseUtil=require(_0xaa0d('0x17'));var db=require(_0xaa0d('0x18'))['db'];function respondWithStatusCode(_0x43b2c4,_0x4d0cee){_0x4d0cee=_0x4d0cee||0xcc;return function(_0x2284b8){if(_0x2284b8){return _0x43b2c4['sendStatus'](_0x4d0cee);}return _0x43b2c4[_0xaa0d('0x19')](_0x4d0cee)[_0xaa0d('0x1a')]();};}function respondWithResult(_0x82b59a,_0x3b84cc){_0x3b84cc=_0x3b84cc||0xc8;return function(_0x896b04){if(_0x896b04){return _0x82b59a[_0xaa0d('0x19')](_0x3b84cc)['json'](_0x896b04);}};}function respondWithFilteredResult(_0xa940b5,_0x584c58){return function(_0x1ebf7d){if(_0x1ebf7d){var _0xe667f5=typeof _0x584c58[_0xaa0d('0x1b')]===_0xaa0d('0x1c')&&typeof _0x584c58[_0xaa0d('0x1d')]==='undefined';var _0x2e2691=_0x1ebf7d[_0xaa0d('0x1e')];var _0x6b0106=_0xe667f5?0x0:_0x584c58[_0xaa0d('0x1b')];var _0x39ec48=_0xe667f5?_0x1ebf7d[_0xaa0d('0x1e')]:_0x584c58[_0xaa0d('0x1b')]+_0x584c58['limit'];var _0x58a57b;if(_0x39ec48>=_0x2e2691){_0x39ec48=_0x2e2691;_0x58a57b=0xc8;}else{_0x58a57b=0xce;}_0xa940b5[_0xaa0d('0x19')](_0x58a57b);return _0xa940b5['set']('Content-Range',_0x6b0106+'-'+_0x39ec48+'/'+_0x2e2691)[_0xaa0d('0x1f')](_0x1ebf7d);}return null;};}function patchUpdates(_0x5a03c6){return function(_0x23078f){try{jsonpatch[_0xaa0d('0x20')](_0x23078f,_0x5a03c6,!![]);}catch(_0x196c54){return BPromise[_0xaa0d('0x21')](_0x196c54);}return _0x23078f['save']();};}function saveUpdates(_0x3e2ace,_0x2f6bfa){return function(_0x1a562f){if(_0x1a562f){return _0x1a562f[_0xaa0d('0x22')](_0x3e2ace)[_0xaa0d('0x23')](function(_0x217c5c){return _0x217c5c;});}return null;};}function removeEntity(_0x55d8b2,_0x447f01){return function(_0x566e6e){if(_0x566e6e){return _0x566e6e['destroy']()[_0xaa0d('0x23')](function(){_0x55d8b2[_0xaa0d('0x19')](0xcc)[_0xaa0d('0x1a')]();});}};}function handleEntityNotFound(_0x69aa0e,_0x12b6d9){return function(_0x4f1c24){if(!_0x4f1c24){_0x69aa0e[_0xaa0d('0x24')](0x194);}return _0x4f1c24;};}function handleError(_0x34a504,_0x472001){_0x472001=_0x472001||0x1f4;return function(_0x383209){logger[_0xaa0d('0x25')](_0x383209[_0xaa0d('0x26')]);if(_0x383209[_0xaa0d('0x27')]){delete _0x383209[_0xaa0d('0x27')];}_0x34a504[_0xaa0d('0x19')](_0x472001)['send'](_0x383209);};}exports[_0xaa0d('0x28')]=function(_0x592c61,_0x3131ab){var _0x871f4a={},_0x404631={},_0x267382={'count':0x0,'rows':[]};var _0x2e0639=_['map'](db[_0xaa0d('0x29')]['rawAttributes'],function(_0x2580aa){return{'name':_0x2580aa['fieldName'],'type':_0x2580aa['type'][_0xaa0d('0x2a')]};});_0x404631[_0xaa0d('0x2b')]=_[_0xaa0d('0x2c')](_0x2e0639,_0xaa0d('0x27'));_0x404631[_0xaa0d('0x2d')]=_[_0xaa0d('0x2e')](_0x592c61[_0xaa0d('0x2d')]);_0x404631[_0xaa0d('0x2f')]=_[_0xaa0d('0x30')](_0x404631[_0xaa0d('0x2b')],_0x404631['query']);_0x871f4a[_0xaa0d('0x31')]=_['intersection'](_0x404631[_0xaa0d('0x2b')],qs['fields'](_0x592c61[_0xaa0d('0x2d')][_0xaa0d('0x32')]));_0x871f4a[_0xaa0d('0x31')]=_0x871f4a[_0xaa0d('0x31')][_0xaa0d('0x33')]?_0x871f4a[_0xaa0d('0x31')]:_0x404631['model'];if(!_0x592c61[_0xaa0d('0x2d')]['hasOwnProperty']('nolimit')){_0x871f4a['limit']=qs[_0xaa0d('0x1d')](_0x592c61[_0xaa0d('0x2d')][_0xaa0d('0x1d')]);_0x871f4a[_0xaa0d('0x1b')]=qs[_0xaa0d('0x1b')](_0x592c61['query'][_0xaa0d('0x1b')]);}_0x871f4a[_0xaa0d('0x34')]=qs[_0xaa0d('0x35')](_0x592c61[_0xaa0d('0x2d')][_0xaa0d('0x35')]);_0x871f4a['where']=qs[_0xaa0d('0x2f')](_['pick'](_0x592c61[_0xaa0d('0x2d')],_0x404631[_0xaa0d('0x2f')]),_0x2e0639);if(_0x592c61[_0xaa0d('0x2d')][_0xaa0d('0x36')]){_0x871f4a[_0xaa0d('0x37')]=_[_0xaa0d('0x38')](_0x871f4a['where'],{'$or':_[_0xaa0d('0x2c')](_0x2e0639,function(_0x25e8e7){if(_0x25e8e7[_0xaa0d('0x39')]!==_0xaa0d('0x3a')){var _0x458ab8={};_0x458ab8[_0x25e8e7[_0xaa0d('0x27')]]={'$like':'%'+_0x592c61['query'][_0xaa0d('0x36')]+'%'};return _0x458ab8;}})});}_0x871f4a=_[_0xaa0d('0x38')]({},_0x871f4a,_0x592c61[_0xaa0d('0x3b')]);var _0x208640={'where':_0x871f4a[_0xaa0d('0x37')]};return db[_0xaa0d('0x29')]['count'](_0x208640)[_0xaa0d('0x23')](function(_0x241fe3){_0x267382[_0xaa0d('0x1e')]=_0x241fe3;if(_0x592c61[_0xaa0d('0x2d')]['includeAll']){_0x871f4a[_0xaa0d('0x3c')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x871f4a);})[_0xaa0d('0x23')](function(_0x51f8eb){_0x267382[_0xaa0d('0x3d')]=_0x51f8eb;return _0x267382;})['then'](respondWithFilteredResult(_0x3131ab,_0x871f4a))[_0xaa0d('0x3e')](handleError(_0x3131ab,null));};exports[_0xaa0d('0x3f')]=function(_0x427fad,_0x4b8914){var _0x13274f={'raw':!![],'where':{'id':_0x427fad[_0xaa0d('0x40')]['id']}},_0x436c1a={};_0x436c1a[_0xaa0d('0x2b')]=_[_0xaa0d('0x2e')](db[_0xaa0d('0x29')][_0xaa0d('0x41')]);_0x436c1a[_0xaa0d('0x2d')]=_['keys'](_0x427fad[_0xaa0d('0x2d')]);_0x436c1a['filters']=_[_0xaa0d('0x30')](_0x436c1a['model'],_0x436c1a[_0xaa0d('0x2d')]);_0x13274f[_0xaa0d('0x31')]=_['intersection'](_0x436c1a[_0xaa0d('0x2b')],qs['fields'](_0x427fad[_0xaa0d('0x2d')]['fields']));_0x13274f[_0xaa0d('0x31')]=_0x13274f[_0xaa0d('0x31')]['length']?_0x13274f[_0xaa0d('0x31')]:_0x436c1a[_0xaa0d('0x2b')];if(_0x427fad[_0xaa0d('0x2d')][_0xaa0d('0x42')]){_0x13274f[_0xaa0d('0x3c')]=[{'all':!![]}];}_0x13274f=_['merge']({},_0x13274f,_0x427fad[_0xaa0d('0x3b')]);return db[_0xaa0d('0x29')][_0xaa0d('0x43')](_0x13274f)[_0xaa0d('0x23')](handleEntityNotFound(_0x4b8914,null))['then'](respondWithResult(_0x4b8914,null))[_0xaa0d('0x3e')](handleError(_0x4b8914,null));};exports[_0xaa0d('0x44')]=function(_0x187bfb,_0x556b80){return db[_0xaa0d('0x29')][_0xaa0d('0x44')](_0x187bfb[_0xaa0d('0x45')],{})[_0xaa0d('0x23')](respondWithResult(_0x556b80,0xc9))[_0xaa0d('0x3e')](handleError(_0x556b80,null));};exports[_0xaa0d('0x22')]=function(_0x329d3,_0x59ea73){if(_0x329d3[_0xaa0d('0x45')]['id']){delete _0x329d3[_0xaa0d('0x45')]['id'];}return db['SmsQueueReport'][_0xaa0d('0x43')]({'where':{'id':_0x329d3[_0xaa0d('0x40')]['id']}})[_0xaa0d('0x23')](handleEntityNotFound(_0x59ea73,null))[_0xaa0d('0x23')](saveUpdates(_0x329d3[_0xaa0d('0x45')],null))['then'](respondWithResult(_0x59ea73,null))['catch'](handleError(_0x59ea73,null));};exports[_0xaa0d('0x46')]=function(_0x25ce0a,_0x1a3b45){return db[_0xaa0d('0x29')][_0xaa0d('0x43')]({'where':{'id':_0x25ce0a['params']['id']}})[_0xaa0d('0x23')](handleEntityNotFound(_0x1a3b45,null))[_0xaa0d('0x23')](removeEntity(_0x1a3b45,null))[_0xaa0d('0x3e')](handleError(_0x1a3b45,null));};exports[_0xaa0d('0x47')]=function(_0x59feb4,_0x164819){return db[_0xaa0d('0x29')][_0xaa0d('0x47')]()[_0xaa0d('0x23')](respondWithResult(_0x164819,null))[_0xaa0d('0x3e')](handleError(_0x164819,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index daf4d9c..7256d3c 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x5dc617,_0x26d208){var _0x527721=function(_0x55808f){while(--_0x55808f){_0x5dc617['push'](_0x5dc617['shift']());}};_0x527721(++_0x26d208);}(_0x70e0,0x17b));var _0x070e=function(_0x37ac1e,_0x225832){_0x37ac1e=_0x37ac1e-0x0;var _0x11acff=_0x70e0[_0x37ac1e];return _0x11acff;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index e4a48e1..00d26b3 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 _0x03b5=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','where','attributes','limit','then','UpdateSmsQueueReport','debug'];(function(_0xe869b2,_0x4c380c){var _0x108ccd=function(_0x3f1e60){while(--_0x3f1e60){_0xe869b2['push'](_0xe869b2['shift']());}};_0x108ccd(++_0x4c380c);}(_0x03b5,0x18c));var _0x503b=function(_0xad622d,_0x978f6f){_0xad622d=_0xad622d-0x0;var _0x57b274=_0x03b5[_0xad622d];return _0x57b274;};'use strict';var _=require(_0x503b('0x0'));var util=require(_0x503b('0x1'));var moment=require(_0x503b('0x2'));var BPromise=require(_0x503b('0x3'));var rs=require(_0x503b('0x4'));var fs=require('fs');var Redis=require(_0x503b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x503b('0x6'));var logger=require(_0x503b('0x7'))(_0x503b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x503b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49157f,_0xb5b09f,_0x1c3cd2){return new BPromise(function(_0x46f85b,_0x4589f5){return client[_0x503b('0xa')](_0x49157f,_0x1c3cd2)['then'](function(_0x41fede){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xb5b09f,_0x503b('0xb'));logger['debug'](_0x503b('0xc'),_0xb5b09f,_0x503b('0xb'),JSON[_0x503b('0xd')](_0x41fede));if(_0x41fede[_0x503b('0xe')]){if(_0x41fede['error'][_0x503b('0xf')]===0x1f4){logger['error'](_0x503b('0x10'),_0xb5b09f,_0x41fede['error'][_0x503b('0x11')]);return _0x4589f5(_0x41fede[_0x503b('0xe')]['message']);}logger[_0x503b('0xe')](_0x503b('0x10'),_0xb5b09f,_0x41fede[_0x503b('0xe')][_0x503b('0x11')]);return _0x46f85b(_0x41fede['error'][_0x503b('0x11')]);}else{logger[_0x503b('0x12')](_0x503b('0x10'),_0xb5b09f,'request\x20sent');_0x46f85b(_0x41fede[_0x503b('0x13')][_0x503b('0x11')]);}})[_0x503b('0x14')](function(_0x19b0fa){logger[_0x503b('0xe')](_0x503b('0x10'),_0xb5b09f,_0x19b0fa);_0x4589f5(_0x19b0fa);});});}exports[_0x503b('0x15')]=function(_0x3303ae){var _0x298a88=this;return new Promise(function(_0x385d3a,_0x414d7a){return db[_0x503b('0x16')][_0x503b('0x17')](_0x3303ae[_0x503b('0x18')],{'raw':_0x3303ae['options']?_0x3303ae['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x49e179){logger[_0x503b('0x12')]('CreateSmsQueueReport',_0x3303ae);logger['debug']('CreateSmsQueueReport',_0x3303ae,JSON['stringify'](_0x49e179));_0x385d3a(_0x49e179);})[_0x503b('0x14')](function(_0x3ed236){logger[_0x503b('0xe')]('CreateSmsQueueReport',_0x3ed236[_0x503b('0x11')],_0x3303ae);_0x414d7a(_0x298a88[_0x503b('0xe')](0x1f4,_0x3ed236['message']));});});};exports['UpdateSmsQueueReport']=function(_0xc0acaf){var _0x1d0064=this;return new Promise(function(_0x3735e5,_0x4c441d){return db[_0x503b('0x16')]['update'](_0xc0acaf[_0x503b('0x18')],{'raw':_0xc0acaf['options']?_0xc0acaf[_0x503b('0x19')][_0x503b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0acaf[_0x503b('0x19')]?_0xc0acaf['options'][_0x503b('0x1b')]||null:null,'attributes':_0xc0acaf[_0x503b('0x19')]?_0xc0acaf[_0x503b('0x19')][_0x503b('0x1c')]||null:null,'limit':_0xc0acaf[_0x503b('0x19')]?_0xc0acaf[_0x503b('0x19')][_0x503b('0x1d')]||null:null})[_0x503b('0x1e')](function(_0x4010d4){logger[_0x503b('0x12')](_0x503b('0x1f'),_0xc0acaf);logger[_0x503b('0x20')](_0x503b('0x1f'),_0xc0acaf,JSON[_0x503b('0xd')](_0x4010d4));_0x3735e5(_0x4010d4);})['catch'](function(_0x1069bf){logger['error'](_0x503b('0x1f'),_0x1069bf[_0x503b('0x11')],_0xc0acaf);_0x4c441d(_0x1d0064[_0x503b('0xe')](0x1f4,_0x1069bf['message']));});});}; \ No newline at end of file +var _0xf5ed=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','create','body','options','raw','then','CreateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SmsQueueReport,\x20%s,\x20%s'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0xf5ed,0x125));var _0xdf5e=function(_0x3f6af6,_0x21300a){_0x3f6af6=_0x3f6af6-0x0;var _0x562c78=_0xf5ed[_0x3f6af6];return _0x562c78;};'use strict';var _=require('lodash');var util=require(_0xdf5e('0x0'));var moment=require(_0xdf5e('0x1'));var BPromise=require('bluebird');var rs=require(_0xdf5e('0x2'));var fs=require('fs');var Redis=require(_0xdf5e('0x3'));var db=require(_0xdf5e('0x4'))['db'];var utils=require(_0xdf5e('0x5'));var logger=require(_0xdf5e('0x6'))(_0xdf5e('0x7'));var config=require(_0xdf5e('0x8'));var jayson=require(_0xdf5e('0x9'));var client=jayson[_0xdf5e('0xa')][_0xdf5e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18cf59,_0x5a2fd1,_0xe3f901){return new BPromise(function(_0x337315,_0xa4bcb9){return client['request'](_0x18cf59,_0xe3f901)['then'](function(_0x438301){logger['info'](_0xdf5e('0xc'),_0x5a2fd1,'request\x20sent');logger['debug'](_0xdf5e('0xd'),_0x5a2fd1,_0xdf5e('0xe'),JSON[_0xdf5e('0xf')](_0x438301));if(_0x438301[_0xdf5e('0x10')]){if(_0x438301['error'][_0xdf5e('0x11')]===0x1f4){logger[_0xdf5e('0x10')](_0xdf5e('0xc'),_0x5a2fd1,_0x438301[_0xdf5e('0x10')]['message']);return _0xa4bcb9(_0x438301[_0xdf5e('0x10')][_0xdf5e('0x12')]);}logger[_0xdf5e('0x10')](_0xdf5e('0xc'),_0x5a2fd1,_0x438301[_0xdf5e('0x10')][_0xdf5e('0x12')]);return _0x337315(_0x438301[_0xdf5e('0x10')][_0xdf5e('0x12')]);}else{logger[_0xdf5e('0x13')](_0xdf5e('0xc'),_0x5a2fd1,'request\x20sent');_0x337315(_0x438301[_0xdf5e('0x14')][_0xdf5e('0x12')]);}})[_0xdf5e('0x15')](function(_0x11d65b){logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5a2fd1,_0x11d65b);_0xa4bcb9(_0x11d65b);});});}exports['CreateSmsQueueReport']=function(_0xcaa427){var _0xad46bd=this;return new Promise(function(_0x414ed9,_0x1fe490){return db['SmsQueueReport'][_0xdf5e('0x16')](_0xcaa427[_0xdf5e('0x17')],{'raw':_0xcaa427[_0xdf5e('0x18')]?_0xcaa427[_0xdf5e('0x18')][_0xdf5e('0x19')]===undefined?!![]:![]:!![]})[_0xdf5e('0x1a')](function(_0x71d0c9){logger[_0xdf5e('0x13')](_0xdf5e('0x1b'),_0xcaa427);logger['debug'](_0xdf5e('0x1b'),_0xcaa427,JSON[_0xdf5e('0xf')](_0x71d0c9));_0x414ed9(_0x71d0c9);})[_0xdf5e('0x15')](function(_0xf6ff82){logger[_0xdf5e('0x10')](_0xdf5e('0x1b'),_0xf6ff82[_0xdf5e('0x12')],_0xcaa427);_0x1fe490(_0xad46bd[_0xdf5e('0x10')](0x1f4,_0xf6ff82[_0xdf5e('0x12')]));});});};exports['UpdateSmsQueueReport']=function(_0x2cd7de){var _0x5ef50f=this;return new Promise(function(_0x51f0b9,_0xc99f16){return db[_0xdf5e('0x1c')][_0xdf5e('0x1d')](_0x2cd7de[_0xdf5e('0x17')],{'raw':_0x2cd7de[_0xdf5e('0x18')]?_0x2cd7de['options'][_0xdf5e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2cd7de['options']?_0x2cd7de[_0xdf5e('0x18')][_0xdf5e('0x1e')]||null:null,'attributes':_0x2cd7de[_0xdf5e('0x18')]?_0x2cd7de['options'][_0xdf5e('0x1f')]||null:null,'limit':_0x2cd7de['options']?_0x2cd7de[_0xdf5e('0x18')][_0xdf5e('0x20')]||null:null})[_0xdf5e('0x1a')](function(_0x42a860){logger[_0xdf5e('0x13')]('UpdateSmsQueueReport',_0x2cd7de);logger['debug'](_0xdf5e('0x21'),_0x2cd7de,JSON[_0xdf5e('0xf')](_0x42a860));_0x51f0b9(_0x42a860);})['catch'](function(_0x21ab93){logger[_0xdf5e('0x10')]('UpdateSmsQueueReport',_0x21ab93[_0xdf5e('0x12')],_0x2cd7de);_0xc99f16(_0x5ef50f[_0xdf5e('0x10')](0x1f4,_0x21ab93['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 68a855b..979271a 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 _0x4c4e=['fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express'];(function(_0x37de3d,_0x5ad00e){var _0x57f5c4=function(_0xceb508){while(--_0xceb508){_0x37de3d['push'](_0x37de3d['shift']());}};_0x57f5c4(++_0x5ad00e);}(_0x4c4e,0x152));var _0xe4c4=function(_0x4a4952,_0x27bde0){_0x4a4952=_0x4a4952-0x0;var _0x4de264=_0x4c4e[_0x4a4952];return _0x4de264;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe4c4('0xe')]('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);router[_0xe4c4('0x10')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['update']);router[_0xe4c4('0x11')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe'];(function(_0x3d2f2b,_0x14ef29){var _0x15c147=function(_0x2f21e1){while(--_0x2f21e1){_0x3d2f2b['push'](_0x3d2f2b['shift']());}};_0x15c147(++_0x14ef29);}(_0xa630,0xbe));var _0x0a63=function(_0x194c23,_0x429394){_0x194c23=_0x194c23-0x0;var _0x373755=_0xa630[_0x194c23];return _0x373755;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 4ee3fa0..e7ab182 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x949c1a,_0x10828c){var _0x52435e=function(_0x1c4d6c){while(--_0x1c4d6c){_0x949c1a['push'](_0x949c1a['shift']());}};_0x52435e(++_0x10828c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xcb91[_0x1b1e76];return _0x3d743a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x212bf5,_0x165cbd){var _0xfcad21=function(_0x4a4e6e){while(--_0x4a4e6e){_0x212bf5['push'](_0x212bf5['shift']());}};_0xfcad21(++_0x165cbd);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1c1333,_0x2b9bed){_0x1c1333=_0x1c1333-0x0;var _0x218154=_0xb43b[_0x1c1333];return _0x218154;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index edfdd0e..d663b8e 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 _0xb246=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','send','map','SmsTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','includeAll','include','catch','keys','rawAttributes','find','create','body','params','describe'];(function(_0x2c8191,_0x3238ce){var _0xcc2329=function(_0x3326ba){while(--_0x3326ba){_0x2c8191['push'](_0x2c8191['shift']());}};_0xcc2329(++_0x3238ce);}(_0xb246,0x163));var _0x6b24=function(_0x251421,_0x34bf49){_0x251421=_0x251421-0x0;var _0xe9bbff=_0xb246[_0x251421];return _0xe9bbff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b24('0x0'));var zipdir=require(_0x6b24('0x1'));var jsonpatch=require(_0x6b24('0x2'));var rp=require(_0x6b24('0x3'));var moment=require('moment');var BPromise=require(_0x6b24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6b24('0x5'));var sox=require(_0x6b24('0x6'));var csv=require(_0x6b24('0x7'));var ejs=require(_0x6b24('0x8'));var fs=require('fs');var fs_extra=require(_0x6b24('0x9'));var _=require(_0x6b24('0xa'));var squel=require(_0x6b24('0xb'));var crypto=require(_0x6b24('0xc'));var jsforce=require(_0x6b24('0xd'));var deskjs=require(_0x6b24('0xe'));var toCsv=require(_0x6b24('0x7'));var querystring=require(_0x6b24('0xf'));var Papa=require(_0x6b24('0x10'));var Redis=require(_0x6b24('0x11'));var authService=require(_0x6b24('0x12'));var qs=require(_0x6b24('0x13'));var as=require(_0x6b24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b24('0x15'));var utils=require(_0x6b24('0x16'));var config=require(_0x6b24('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b24('0x18'))['db'];function respondWithStatusCode(_0x50d23a,_0x23da50){_0x23da50=_0x23da50||0xcc;return function(_0x489ed2){if(_0x489ed2){return _0x50d23a[_0x6b24('0x19')](_0x23da50);}return _0x50d23a['status'](_0x23da50)[_0x6b24('0x1a')]();};}function respondWithResult(_0x100c75,_0x5c382e){_0x5c382e=_0x5c382e||0xc8;return function(_0x37e661){if(_0x37e661){return _0x100c75[_0x6b24('0x1b')](_0x5c382e)[_0x6b24('0x1c')](_0x37e661);}};}function respondWithFilteredResult(_0xa94a0e,_0x1f9d74){return function(_0x3961e9){if(_0x3961e9){var _0x3f63c0=typeof _0x1f9d74[_0x6b24('0x1d')]===_0x6b24('0x1e')&&typeof _0x1f9d74[_0x6b24('0x1f')]===_0x6b24('0x1e');var _0x581997=_0x3961e9[_0x6b24('0x20')];var _0x330d24=_0x3f63c0?0x0:_0x1f9d74[_0x6b24('0x1d')];var _0xd23649=_0x3f63c0?_0x3961e9[_0x6b24('0x20')]:_0x1f9d74[_0x6b24('0x1d')]+_0x1f9d74['limit'];var _0x394693;if(_0xd23649>=_0x581997){_0xd23649=_0x581997;_0x394693=0xc8;}else{_0x394693=0xce;}_0xa94a0e[_0x6b24('0x1b')](_0x394693);return _0xa94a0e['set'](_0x6b24('0x21'),_0x330d24+'-'+_0xd23649+'/'+_0x581997)['json'](_0x3961e9);}return null;};}function patchUpdates(_0x2447be){return function(_0x32a130){try{jsonpatch['apply'](_0x32a130,_0x2447be,!![]);}catch(_0x2afd36){return BPromise[_0x6b24('0x22')](_0x2afd36);}return _0x32a130[_0x6b24('0x23')]();};}function saveUpdates(_0x3ab5c5,_0x2d5f6b){return function(_0x3fc647){if(_0x3fc647){return _0x3fc647[_0x6b24('0x24')](_0x3ab5c5)[_0x6b24('0x25')](function(_0x59a82d){return _0x59a82d;});}return null;};}function removeEntity(_0xced0ef,_0x35dc7f){return function(_0x5a4e07){if(_0x5a4e07){return _0x5a4e07[_0x6b24('0x26')]()[_0x6b24('0x25')](function(){_0xced0ef['status'](0xcc)[_0x6b24('0x1a')]();});}};}function handleEntityNotFound(_0xf604ed,_0x4ff196){return function(_0x48aeb0){if(!_0x48aeb0){_0xf604ed[_0x6b24('0x19')](0x194);}return _0x48aeb0;};}function handleError(_0x59ec19,_0x2d8a53){_0x2d8a53=_0x2d8a53||0x1f4;return function(_0x3a00ff){logger[_0x6b24('0x27')](_0x3a00ff['stack']);if(_0x3a00ff['name']){delete _0x3a00ff['name'];}_0x59ec19[_0x6b24('0x1b')](_0x2d8a53)[_0x6b24('0x28')](_0x3a00ff);};}exports['index']=function(_0x381bd8,_0x4cb889){var _0x9624d0={},_0x2cd386={},_0x1d790a={'count':0x0,'rows':[]};var _0x233d90=_[_0x6b24('0x29')](db[_0x6b24('0x2a')]['rawAttributes'],function(_0x1e2fc8){return{'name':_0x1e2fc8[_0x6b24('0x2b')],'type':_0x1e2fc8[_0x6b24('0x2c')][_0x6b24('0x2d')]};});_0x2cd386[_0x6b24('0x2e')]=_[_0x6b24('0x29')](_0x233d90,'name');_0x2cd386[_0x6b24('0x2f')]=_['keys'](_0x381bd8[_0x6b24('0x2f')]);_0x2cd386[_0x6b24('0x30')]=_[_0x6b24('0x31')](_0x2cd386[_0x6b24('0x2e')],_0x2cd386[_0x6b24('0x2f')]);_0x9624d0[_0x6b24('0x32')]=_[_0x6b24('0x31')](_0x2cd386[_0x6b24('0x2e')],qs[_0x6b24('0x33')](_0x381bd8[_0x6b24('0x2f')][_0x6b24('0x33')]));_0x9624d0[_0x6b24('0x32')]=_0x9624d0[_0x6b24('0x32')][_0x6b24('0x34')]?_0x9624d0[_0x6b24('0x32')]:_0x2cd386['model'];if(!_0x381bd8[_0x6b24('0x2f')][_0x6b24('0x35')]('nolimit')){_0x9624d0[_0x6b24('0x1f')]=qs[_0x6b24('0x1f')](_0x381bd8['query'][_0x6b24('0x1f')]);_0x9624d0['offset']=qs[_0x6b24('0x1d')](_0x381bd8[_0x6b24('0x2f')][_0x6b24('0x1d')]);}_0x9624d0[_0x6b24('0x36')]=qs[_0x6b24('0x37')](_0x381bd8['query'][_0x6b24('0x37')]);_0x9624d0['where']=qs[_0x6b24('0x30')](_[_0x6b24('0x38')](_0x381bd8['query'],_0x2cd386[_0x6b24('0x30')]),_0x233d90);if(_0x381bd8['query'][_0x6b24('0x39')]){_0x9624d0[_0x6b24('0x3a')]=_[_0x6b24('0x3b')](_0x9624d0[_0x6b24('0x3a')],{'$or':_['map'](_0x233d90,function(_0x29f727){if(_0x29f727[_0x6b24('0x2c')]!=='VIRTUAL'){var _0x203937={};_0x203937[_0x29f727['name']]={'$like':'%'+_0x381bd8['query']['filter']+'%'};return _0x203937;}})});}_0x9624d0=_[_0x6b24('0x3b')]({},_0x9624d0,_0x381bd8[_0x6b24('0x3c')]);var _0x27abe3={'where':_0x9624d0[_0x6b24('0x3a')]};return db[_0x6b24('0x2a')][_0x6b24('0x20')](_0x27abe3)[_0x6b24('0x25')](function(_0x40776a){_0x1d790a['count']=_0x40776a;if(_0x381bd8[_0x6b24('0x2f')][_0x6b24('0x3d')]){_0x9624d0[_0x6b24('0x3e')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x9624d0);})[_0x6b24('0x25')](function(_0x9b7063){_0x1d790a['rows']=_0x9b7063;return _0x1d790a;})[_0x6b24('0x25')](respondWithFilteredResult(_0x4cb889,_0x9624d0))[_0x6b24('0x3f')](handleError(_0x4cb889,null));};exports['show']=function(_0x552aee,_0x1ce35f){var _0x524685={'raw':!![],'where':{'id':_0x552aee['params']['id']}},_0x26fe56={};_0x26fe56[_0x6b24('0x2e')]=_[_0x6b24('0x40')](db[_0x6b24('0x2a')][_0x6b24('0x41')]);_0x26fe56[_0x6b24('0x2f')]=_[_0x6b24('0x40')](_0x552aee[_0x6b24('0x2f')]);_0x26fe56[_0x6b24('0x30')]=_[_0x6b24('0x31')](_0x26fe56[_0x6b24('0x2e')],_0x26fe56['query']);_0x524685[_0x6b24('0x32')]=_[_0x6b24('0x31')](_0x26fe56['model'],qs[_0x6b24('0x33')](_0x552aee['query']['fields']));_0x524685['attributes']=_0x524685['attributes']['length']?_0x524685['attributes']:_0x26fe56[_0x6b24('0x2e')];if(_0x552aee['query'][_0x6b24('0x3d')]){_0x524685[_0x6b24('0x3e')]=[{'all':!![]}];}_0x524685=_['merge']({},_0x524685,_0x552aee['options']);return db[_0x6b24('0x2a')][_0x6b24('0x42')](_0x524685)[_0x6b24('0x25')](handleEntityNotFound(_0x1ce35f,null))['then'](respondWithResult(_0x1ce35f,null))[_0x6b24('0x3f')](handleError(_0x1ce35f,null));};exports[_0x6b24('0x43')]=function(_0x2db380,_0x251065){return db[_0x6b24('0x2a')][_0x6b24('0x43')](_0x2db380['body'],{})[_0x6b24('0x25')](respondWithResult(_0x251065,0xc9))[_0x6b24('0x3f')](handleError(_0x251065,null));};exports[_0x6b24('0x24')]=function(_0x2a185c,_0x2e75c6){if(_0x2a185c['body']['id']){delete _0x2a185c[_0x6b24('0x44')]['id'];}return db[_0x6b24('0x2a')]['find']({'where':{'id':_0x2a185c[_0x6b24('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e75c6,null))[_0x6b24('0x25')](saveUpdates(_0x2a185c[_0x6b24('0x44')],null))[_0x6b24('0x25')](respondWithResult(_0x2e75c6,null))[_0x6b24('0x3f')](handleError(_0x2e75c6,null));};exports[_0x6b24('0x26')]=function(_0x4aaf8a,_0x4d2852){return db[_0x6b24('0x2a')]['find']({'where':{'id':_0x4aaf8a[_0x6b24('0x45')]['id']}})['then'](handleEntityNotFound(_0x4d2852,null))[_0x6b24('0x25')](removeEntity(_0x4d2852,null))['catch'](handleError(_0x4d2852,null));};exports[_0x6b24('0x46')]=function(_0x2ec07d,_0x5dcb02){return db['SmsTransferReport'][_0x6b24('0x46')]()['then'](respondWithResult(_0x5dcb02,null))[_0x6b24('0x3f')](handleError(_0x5dcb02,null));}; \ No newline at end of file +var _0xe5fe=['find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','fields','options'];(function(_0x49cc80,_0x3a33ab){var _0x4d6a78=function(_0x4a66dc){while(--_0x4a66dc){_0x49cc80['push'](_0x49cc80['shift']());}};_0x4d6a78(++_0x3a33ab);}(_0xe5fe,0x130));var _0xee5f=function(_0x1c44f5,_0x1de2bd){_0x1c44f5=_0x1c44f5-0x0;var _0x527ce0=_0xe5fe[_0x1c44f5];return _0x527ce0;};'use strict';var emlformat=require(_0xee5f('0x0'));var rimraf=require(_0xee5f('0x1'));var zipdir=require(_0xee5f('0x2'));var jsonpatch=require(_0xee5f('0x3'));var rp=require('request-promise');var moment=require(_0xee5f('0x4'));var BPromise=require(_0xee5f('0x5'));var Mustache=require(_0xee5f('0x6'));var util=require(_0xee5f('0x7'));var path=require(_0xee5f('0x8'));var sox=require(_0xee5f('0x9'));var csv=require(_0xee5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee5f('0xb'));var _=require(_0xee5f('0xc'));var squel=require(_0xee5f('0xd'));var crypto=require(_0xee5f('0xe'));var jsforce=require(_0xee5f('0xf'));var deskjs=require(_0xee5f('0x10'));var toCsv=require(_0xee5f('0xa'));var querystring=require(_0xee5f('0x11'));var Papa=require('papaparse');var Redis=require(_0xee5f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xee5f('0x13'));var hardwareService=require(_0xee5f('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xee5f('0x15'));var config=require(_0xee5f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xee5f('0x17'))['db'];function respondWithStatusCode(_0x3d6f86,_0x112458){_0x112458=_0x112458||0xcc;return function(_0x376709){if(_0x376709){return _0x3d6f86[_0xee5f('0x18')](_0x112458);}return _0x3d6f86[_0xee5f('0x19')](_0x112458)[_0xee5f('0x1a')]();};}function respondWithResult(_0x49e26d,_0x4030de){_0x4030de=_0x4030de||0xc8;return function(_0x5ed36f){if(_0x5ed36f){return _0x49e26d['status'](_0x4030de)[_0xee5f('0x1b')](_0x5ed36f);}};}function respondWithFilteredResult(_0x56643e,_0x3733d5){return function(_0x343ca4){if(_0x343ca4){var _0x4f032a=typeof _0x3733d5[_0xee5f('0x1c')]===_0xee5f('0x1d')&&typeof _0x3733d5[_0xee5f('0x1e')]===_0xee5f('0x1d');var _0x1613b6=_0x343ca4['count'];var _0x198f58=_0x4f032a?0x0:_0x3733d5['offset'];var _0x3053f3=_0x4f032a?_0x343ca4[_0xee5f('0x1f')]:_0x3733d5['offset']+_0x3733d5[_0xee5f('0x1e')];var _0x4e694e;if(_0x3053f3>=_0x1613b6){_0x3053f3=_0x1613b6;_0x4e694e=0xc8;}else{_0x4e694e=0xce;}_0x56643e[_0xee5f('0x19')](_0x4e694e);return _0x56643e[_0xee5f('0x20')](_0xee5f('0x21'),_0x198f58+'-'+_0x3053f3+'/'+_0x1613b6)['json'](_0x343ca4);}return null;};}function patchUpdates(_0x392ec6){return function(_0x3be08d){try{jsonpatch['apply'](_0x3be08d,_0x392ec6,!![]);}catch(_0xd1f6e4){return BPromise['reject'](_0xd1f6e4);}return _0x3be08d[_0xee5f('0x22')]();};}function saveUpdates(_0xcb6d4b,_0x2fccc6){return function(_0x69a41d){if(_0x69a41d){return _0x69a41d[_0xee5f('0x23')](_0xcb6d4b)['then'](function(_0xfcee52){return _0xfcee52;});}return null;};}function removeEntity(_0x1ce879,_0x565e2c){return function(_0x413610){if(_0x413610){return _0x413610[_0xee5f('0x24')]()[_0xee5f('0x25')](function(){_0x1ce879['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x587cbd,_0x289fda){return function(_0x5b8604){if(!_0x5b8604){_0x587cbd[_0xee5f('0x18')](0x194);}return _0x5b8604;};}function handleError(_0x5238d2,_0x2d74e6){_0x2d74e6=_0x2d74e6||0x1f4;return function(_0x1a36bb){logger[_0xee5f('0x26')](_0x1a36bb[_0xee5f('0x27')]);if(_0x1a36bb[_0xee5f('0x28')]){delete _0x1a36bb[_0xee5f('0x28')];}_0x5238d2[_0xee5f('0x19')](_0x2d74e6)[_0xee5f('0x29')](_0x1a36bb);};}exports['index']=function(_0x42571b,_0x2d5637){var _0x4c963a={},_0x41903a={},_0x27be6d={'count':0x0,'rows':[]};var _0x857be6=_[_0xee5f('0x2a')](db[_0xee5f('0x2b')][_0xee5f('0x2c')],function(_0x2ee55d){return{'name':_0x2ee55d[_0xee5f('0x2d')],'type':_0x2ee55d[_0xee5f('0x2e')][_0xee5f('0x2f')]};});_0x41903a['model']=_[_0xee5f('0x2a')](_0x857be6,_0xee5f('0x28'));_0x41903a[_0xee5f('0x30')]=_[_0xee5f('0x31')](_0x42571b[_0xee5f('0x30')]);_0x41903a[_0xee5f('0x32')]=_[_0xee5f('0x33')](_0x41903a[_0xee5f('0x34')],_0x41903a[_0xee5f('0x30')]);_0x4c963a['attributes']=_[_0xee5f('0x33')](_0x41903a[_0xee5f('0x34')],qs['fields'](_0x42571b[_0xee5f('0x30')]['fields']));_0x4c963a[_0xee5f('0x35')]=_0x4c963a[_0xee5f('0x35')][_0xee5f('0x36')]?_0x4c963a[_0xee5f('0x35')]:_0x41903a['model'];if(!_0x42571b[_0xee5f('0x30')][_0xee5f('0x37')](_0xee5f('0x38'))){_0x4c963a[_0xee5f('0x1e')]=qs[_0xee5f('0x1e')](_0x42571b[_0xee5f('0x30')][_0xee5f('0x1e')]);_0x4c963a[_0xee5f('0x1c')]=qs['offset'](_0x42571b['query'][_0xee5f('0x1c')]);}_0x4c963a[_0xee5f('0x39')]=qs['sort'](_0x42571b['query'][_0xee5f('0x3a')]);_0x4c963a[_0xee5f('0x3b')]=qs[_0xee5f('0x32')](_[_0xee5f('0x3c')](_0x42571b[_0xee5f('0x30')],_0x41903a[_0xee5f('0x32')]),_0x857be6);if(_0x42571b[_0xee5f('0x30')][_0xee5f('0x3d')]){_0x4c963a[_0xee5f('0x3b')]=_[_0xee5f('0x3e')](_0x4c963a['where'],{'$or':_[_0xee5f('0x2a')](_0x857be6,function(_0x5ea2c7){if(_0x5ea2c7[_0xee5f('0x2e')]!==_0xee5f('0x3f')){var _0x3bed71={};_0x3bed71[_0x5ea2c7[_0xee5f('0x28')]]={'$like':'%'+_0x42571b['query'][_0xee5f('0x3d')]+'%'};return _0x3bed71;}})});}_0x4c963a=_[_0xee5f('0x3e')]({},_0x4c963a,_0x42571b['options']);var _0xeaa397={'where':_0x4c963a[_0xee5f('0x3b')]};return db['SmsTransferReport'][_0xee5f('0x1f')](_0xeaa397)[_0xee5f('0x25')](function(_0x1c7775){_0x27be6d[_0xee5f('0x1f')]=_0x1c7775;if(_0x42571b[_0xee5f('0x30')]['includeAll']){_0x4c963a[_0xee5f('0x40')]=[{'all':!![]}];}return db[_0xee5f('0x2b')]['findAll'](_0x4c963a);})[_0xee5f('0x25')](function(_0xf73cef){_0x27be6d[_0xee5f('0x41')]=_0xf73cef;return _0x27be6d;})[_0xee5f('0x25')](respondWithFilteredResult(_0x2d5637,_0x4c963a))[_0xee5f('0x42')](handleError(_0x2d5637,null));};exports[_0xee5f('0x43')]=function(_0x37df74,_0x503028){var _0x5a6f8b={'raw':!![],'where':{'id':_0x37df74[_0xee5f('0x44')]['id']}},_0x27ca0f={};_0x27ca0f[_0xee5f('0x34')]=_[_0xee5f('0x31')](db[_0xee5f('0x2b')]['rawAttributes']);_0x27ca0f['query']=_[_0xee5f('0x31')](_0x37df74['query']);_0x27ca0f[_0xee5f('0x32')]=_[_0xee5f('0x33')](_0x27ca0f[_0xee5f('0x34')],_0x27ca0f['query']);_0x5a6f8b[_0xee5f('0x35')]=_[_0xee5f('0x33')](_0x27ca0f[_0xee5f('0x34')],qs[_0xee5f('0x45')](_0x37df74['query']['fields']));_0x5a6f8b['attributes']=_0x5a6f8b[_0xee5f('0x35')]['length']?_0x5a6f8b[_0xee5f('0x35')]:_0x27ca0f[_0xee5f('0x34')];if(_0x37df74[_0xee5f('0x30')]['includeAll']){_0x5a6f8b[_0xee5f('0x40')]=[{'all':!![]}];}_0x5a6f8b=_[_0xee5f('0x3e')]({},_0x5a6f8b,_0x37df74[_0xee5f('0x46')]);return db[_0xee5f('0x2b')][_0xee5f('0x47')](_0x5a6f8b)['then'](handleEntityNotFound(_0x503028,null))['then'](respondWithResult(_0x503028,null))[_0xee5f('0x42')](handleError(_0x503028,null));};exports[_0xee5f('0x48')]=function(_0x11630a,_0x1b6b2a){return db[_0xee5f('0x2b')]['create'](_0x11630a[_0xee5f('0x49')],{})[_0xee5f('0x25')](respondWithResult(_0x1b6b2a,0xc9))[_0xee5f('0x42')](handleError(_0x1b6b2a,null));};exports[_0xee5f('0x23')]=function(_0x436bf6,_0x142905){if(_0x436bf6[_0xee5f('0x49')]['id']){delete _0x436bf6['body']['id'];}return db[_0xee5f('0x2b')][_0xee5f('0x47')]({'where':{'id':_0x436bf6[_0xee5f('0x44')]['id']}})[_0xee5f('0x25')](handleEntityNotFound(_0x142905,null))[_0xee5f('0x25')](saveUpdates(_0x436bf6['body'],null))[_0xee5f('0x25')](respondWithResult(_0x142905,null))[_0xee5f('0x42')](handleError(_0x142905,null));};exports[_0xee5f('0x24')]=function(_0x327ada,_0x43bc46){return db[_0xee5f('0x2b')][_0xee5f('0x47')]({'where':{'id':_0x327ada['params']['id']}})[_0xee5f('0x25')](handleEntityNotFound(_0x43bc46,null))[_0xee5f('0x25')](removeEntity(_0x43bc46,null))[_0xee5f('0x42')](handleError(_0x43bc46,null));};exports['describe']=function(_0x4e7b96,_0x4bec69){return db[_0xee5f('0x2b')][_0xee5f('0x4a')]()[_0xee5f('0x25')](respondWithResult(_0x4bec69,null))[_0xee5f('0x42')](handleError(_0x4bec69,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 0463e77..195132b 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 _0x0c74=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x0c74,0x1cd));var _0x40c7=function(_0x358004,_0x26f5eb){_0x358004=_0x358004-0x0;var _0xea3c83=_0x0c74[_0x358004];return _0xea3c83;};'use strict';var _=require('lodash');var util=require(_0x40c7('0x0'));var logger=require(_0x40c7('0x1'))(_0x40c7('0x2'));var moment=require(_0x40c7('0x3'));var BPromise=require(_0x40c7('0x4'));var rp=require(_0x40c7('0x5'));var fs=require('fs');var path=require(_0x40c7('0x6'));var rimraf=require('rimraf');var config=require(_0x40c7('0x7'));var attributes=require(_0x40c7('0x8'));module[_0x40c7('0x9')]=function(_0x435ca0,_0x4d7ffb){return _0x435ca0[_0x40c7('0xa')](_0x40c7('0xb'),attributes,{'tableName':_0x40c7('0xc'),'paranoid':![],'indexes':[{'name':_0x40c7('0xd'),'fields':[_0x40c7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9417=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x9417,0xb4));var _0x7941=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x9417[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x7941('0x0'));var util=require(_0x7941('0x1'));var logger=require(_0x7941('0x2'))(_0x7941('0x3'));var moment=require('moment');var BPromise=require(_0x7941('0x4'));var rp=require(_0x7941('0x5'));var fs=require('fs');var path=require(_0x7941('0x6'));var rimraf=require(_0x7941('0x7'));var config=require(_0x7941('0x8'));var attributes=require(_0x7941('0x9'));module[_0x7941('0xa')]=function(_0x3e38d8,_0x1dee1a){return _0x3e38d8[_0x7941('0xb')]('SmsTransferReport',attributes,{'tableName':_0x7941('0xc'),'paranoid':![],'indexes':[{'name':_0x7941('0xd'),'fields':[_0x7941('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 4d7e6f1..af27033 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 _0x39c7=['stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x39c7,0x85));var _0x739c=function(_0x55ce38,_0x4faf5f){_0x55ce38=_0x55ce38-0x0;var _0x9c707f=_0x39c7[_0x55ce38];return _0x9c707f;};'use strict';var _=require('lodash');var util=require(_0x739c('0x0'));var moment=require(_0x739c('0x1'));var BPromise=require(_0x739c('0x2'));var rs=require(_0x739c('0x3'));var fs=require('fs');var Redis=require(_0x739c('0x4'));var db=require(_0x739c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x739c('0x6'))(_0x739c('0x7'));var config=require(_0x739c('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x739c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c0af1,_0x5df5d3,_0x480159){return new BPromise(function(_0x27c5a4,_0x3475f2){return client['request'](_0x3c0af1,_0x480159)[_0x739c('0xa')](function(_0x277f61){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x5df5d3,_0x739c('0xb'));logger[_0x739c('0xc')](_0x739c('0xd'),_0x5df5d3,_0x739c('0xb'),JSON[_0x739c('0xe')](_0x277f61));if(_0x277f61[_0x739c('0xf')]){if(_0x277f61[_0x739c('0xf')][_0x739c('0x10')]===0x1f4){logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x3475f2(_0x277f61['error'][_0x739c('0x12')]);}logger[_0x739c('0xf')](_0x739c('0x11'),_0x5df5d3,_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);return _0x27c5a4(_0x277f61[_0x739c('0xf')][_0x739c('0x12')]);}else{logger[_0x739c('0x13')](_0x739c('0x11'),_0x5df5d3,_0x739c('0xb'));_0x27c5a4(_0x277f61['result']['message']);}})[_0x739c('0x14')](function(_0x23888d){logger[_0x739c('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x5df5d3,_0x23888d);_0x3475f2(_0x23888d);});});} \ No newline at end of file +var _0x2cd0=['http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x52e563,_0x452980){var _0xfc3dd0=function(_0x173bbd){while(--_0x173bbd){_0x52e563['push'](_0x52e563['shift']());}};_0xfc3dd0(++_0x452980);}(_0x2cd0,0x8a));var _0x02cd=function(_0x4602e0,_0x1ce830){_0x4602e0=_0x4602e0-0x0;var _0x54130c=_0x2cd0[_0x4602e0];return _0x54130c;};'use strict';var _=require(_0x02cd('0x0'));var util=require(_0x02cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x02cd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x02cd('0x3'));var logger=require(_0x02cd('0x4'))(_0x02cd('0x5'));var config=require(_0x02cd('0x6'));var jayson=require(_0x02cd('0x7'));var client=jayson[_0x02cd('0x8')][_0x02cd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x178a25,_0x78732d,_0x21bbe0){return new BPromise(function(_0x5ccfd4,_0x291977){return client[_0x02cd('0xa')](_0x178a25,_0x21bbe0)[_0x02cd('0xb')](function(_0x95f051){logger[_0x02cd('0xc')](_0x02cd('0xd'),_0x78732d,_0x02cd('0xe'));logger[_0x02cd('0xf')](_0x02cd('0x10'),_0x78732d,_0x02cd('0xe'),JSON['stringify'](_0x95f051));if(_0x95f051['error']){if(_0x95f051[_0x02cd('0x11')][_0x02cd('0x12')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x78732d,_0x95f051[_0x02cd('0x11')]['message']);return _0x291977(_0x95f051[_0x02cd('0x11')][_0x02cd('0x13')]);}logger[_0x02cd('0x11')](_0x02cd('0xd'),_0x78732d,_0x95f051[_0x02cd('0x11')][_0x02cd('0x13')]);return _0x5ccfd4(_0x95f051['error']['message']);}else{logger[_0x02cd('0xc')](_0x02cd('0xd'),_0x78732d,_0x02cd('0xe'));_0x5ccfd4(_0x95f051[_0x02cd('0x14')][_0x02cd('0x13')]);}})['catch'](function(_0x94301f){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x78732d,_0x94301f);_0x291977(_0x94301f);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index bb1f424..dc058eb 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 _0xa0b8=['post','single','file','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename'];(function(_0xb5b373,_0xd2d06){var _0xa3d925=function(_0xd5ad50){while(--_0xd5ad50){_0xb5b373['push'](_0xb5b373['shift']());}};_0xa3d925(++_0xd2d06);}(_0xa0b8,0xdd));var _0x8a0b=function(_0x3b1d1e,_0x10d8d9){_0x3b1d1e=_0x3b1d1e-0x0;var _0x5670b7=_0xa0b8[_0x3b1d1e];return _0x5670b7;};'use strict';var multer=require('multer');var util=require(_0x8a0b('0x0'));var path=require('path');var timeout=require(_0x8a0b('0x1'));var express=require(_0x8a0b('0x2'));var router=express[_0x8a0b('0x3')]();var fs_extra=require(_0x8a0b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a0b('0x5'));var config=require(_0x8a0b('0x6'));var controller=require(_0x8a0b('0x7'));router[_0x8a0b('0x8')]('/',auth[_0x8a0b('0x9')](),controller[_0x8a0b('0xa')]);router['get'](_0x8a0b('0xb'),auth[_0x8a0b('0x9')](),controller[_0x8a0b('0xc')]);router[_0x8a0b('0x8')](_0x8a0b('0xd'),auth[_0x8a0b('0x9')](),controller['download']);var upload=multer({'storage':multer[_0x8a0b('0xe')]({'destination':function(_0x75f6bc,_0x102795,_0x1ca91c){_0x1ca91c(null,path['join'](config[_0x8a0b('0xf')],_0x8a0b('0x10')));},'filename':function(_0x10147b,_0x5c37a2,_0x29bfaa){_0x5c37a2[_0x8a0b('0x11')]=_0x5c37a2[_0x8a0b('0x11')][_0x8a0b('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x29bfaa(null,util[_0x8a0b('0x13')](_0x8a0b('0x14'),path[_0x8a0b('0x15')](_0x5c37a2[_0x8a0b('0x11')],path['extname'](_0x5c37a2[_0x8a0b('0x11')])),Date['now'](),path['extname'](_0x5c37a2[_0x8a0b('0x11')])));}})});router[_0x8a0b('0x16')]('/',upload[_0x8a0b('0x17')](_0x8a0b('0x18')),controller['create']);router['put'](_0x8a0b('0xb'),auth[_0x8a0b('0x9')](),controller[_0x8a0b('0x19')]);router['delete']('/:id',auth[_0x8a0b('0x9')](),controller['delete']);module[_0x8a0b('0x1a')]=router; \ No newline at end of file +var _0xb763=['join','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','diskStorage'];(function(_0x4c1572,_0x2140ba){var _0x511bce=function(_0x58377){while(--_0x58377){_0x4c1572['push'](_0x4c1572['shift']());}};_0x511bce(++_0x2140ba);}(_0xb763,0x117));var _0x3b76=function(_0x254445,_0xd7f646){_0x254445=_0x254445-0x0;var _0x1bbc00=_0xb763[_0x254445];return _0x1bbc00;};'use strict';var multer=require(_0x3b76('0x0'));var util=require(_0x3b76('0x1'));var path=require(_0x3b76('0x2'));var timeout=require(_0x3b76('0x3'));var express=require(_0x3b76('0x4'));var router=express[_0x3b76('0x5')]();var fs_extra=require(_0x3b76('0x6'));var auth=require(_0x3b76('0x7'));var interaction=require(_0x3b76('0x8'));var config=require(_0x3b76('0x9'));var controller=require(_0x3b76('0xa'));router['get']('/',auth[_0x3b76('0xb')](),controller[_0x3b76('0xc')]);router[_0x3b76('0xd')](_0x3b76('0xe'),auth[_0x3b76('0xb')](),controller[_0x3b76('0xf')]);router[_0x3b76('0xd')](_0x3b76('0x10'),auth[_0x3b76('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x3b76('0x11')]({'destination':function(_0xb7ac31,_0x3aad9c,_0x2aeab2){_0x2aeab2(null,path[_0x3b76('0x12')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x16ae7a,_0xaf92e5,_0x11cfe5){_0xaf92e5[_0x3b76('0x13')]=_0xaf92e5[_0x3b76('0x13')][_0x3b76('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x11cfe5(null,util[_0x3b76('0x15')](_0x3b76('0x16'),path[_0x3b76('0x17')](_0xaf92e5['originalname'],path[_0x3b76('0x18')](_0xaf92e5[_0x3b76('0x13')])),Date[_0x3b76('0x19')](),path[_0x3b76('0x18')](_0xaf92e5[_0x3b76('0x13')])));}})});router[_0x3b76('0x1a')]('/',upload[_0x3b76('0x1b')](_0x3b76('0x1c')),controller[_0x3b76('0x1d')]);router['put'](_0x3b76('0xe'),auth[_0x3b76('0xb')](),controller[_0x3b76('0x1e')]);router[_0x3b76('0x1f')]('/:id',auth[_0x3b76('0xb')](),controller[_0x3b76('0x1f')]);module[_0x3b76('0x20')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b9c961f..da4a003 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 _0x1275=['BIGINT','INTEGER','sequelize','name','STRING','FLOAT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1275,0x80));var _0x5127=function(_0x45a260,_0x7de2d9){_0x45a260=_0x45a260-0x0;var _0x710823=_0x1275[_0x45a260];return _0x710823;};'use strict';var Sequelize=require(_0x5127('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x5127('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5127('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x5127('0x2')]},'original_duration':{'type':Sequelize[_0x5127('0x3')]},'original_sampleCount':{'type':Sequelize[_0x5127('0x4')]},'original_channelCount':{'type':Sequelize[_0x5127('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x5127('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x5127('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x5127('0x4')]},'converted_channelCount':{'type':Sequelize[_0x5127('0x5')]},'converted_bitRate':{'type':Sequelize[_0x5127('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x5127('0x5')]}}; \ No newline at end of file +var _0x2930=['BIGINT','sequelize','STRING','name','INTEGER','FLOAT'];(function(_0x2cc9a9,_0x2d6e11){var _0x2023e8=function(_0x54066b){while(--_0x54066b){_0x2cc9a9['push'](_0x2cc9a9['shift']());}};_0x2023e8(++_0x2d6e11);}(_0x2930,0x1db));var _0x0293=function(_0x17740d,_0x2a1cbf){_0x17740d=_0x17740d-0x0;var _0xc71636=_0x2930[_0x17740d];return _0xc71636;};'use strict';var Sequelize=require(_0x0293('0x0'));module['exports']={'name':{'type':Sequelize[_0x0293('0x1')],'unique':_0x0293('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x0293('0x1')]},'original_format':{'type':Sequelize[_0x0293('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x0293('0x3')]},'converted_format':{'type':Sequelize[_0x0293('0x1')]},'converted_duration':{'type':Sequelize[_0x0293('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x0293('0x3')]},'converted_bitRate':{'type':Sequelize[_0x0293('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x0293('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d03441e..8f72683 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 _0xbc0d=['wav','server/files/sounds/original','basename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','delete','destroy','original_format','unlinkSync','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','Sounds','UserProfileResource','error','stack','name','send','index','map','Sound','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','download','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','originalname','extname','filename','substring'];(function(_0x3c7d07,_0x4c2b28){var _0x126f79=function(_0x545dcd){while(--_0x545dcd){_0x3c7d07['push'](_0x3c7d07['shift']());}};_0x126f79(++_0x4c2b28);}(_0xbc0d,0x11b));var _0xdbc0=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xbc0d[_0x448f8];return _0xa73126;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbc0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdbc0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdbc0('0x2'));var util=require(_0xdbc0('0x3'));var path=require(_0xdbc0('0x4'));var sox=require(_0xdbc0('0x5'));var csv=require('to-csv');var ejs=require(_0xdbc0('0x6'));var fs=require('fs');var fs_extra=require(_0xdbc0('0x7'));var _=require(_0xdbc0('0x8'));var squel=require(_0xdbc0('0x9'));var crypto=require(_0xdbc0('0xa'));var jsforce=require(_0xdbc0('0xb'));var deskjs=require(_0xdbc0('0xc'));var toCsv=require(_0xdbc0('0xd'));var querystring=require(_0xdbc0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbc0('0x10'));var logger=require(_0xdbc0('0x11'))(_0xdbc0('0x12'));var utils=require(_0xdbc0('0x13'));var config=require(_0xdbc0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdbc0('0x15'))['db'];function respondWithStatusCode(_0x26f6a7,_0x40ce56){_0x40ce56=_0x40ce56||0xcc;return function(_0xca9bc5){if(_0xca9bc5){return _0x26f6a7[_0xdbc0('0x16')](_0x40ce56);}return _0x26f6a7[_0xdbc0('0x17')](_0x40ce56)[_0xdbc0('0x18')]();};}function respondWithResult(_0x4c2294,_0x296e5c){_0x296e5c=_0x296e5c||0xc8;return function(_0x4bf80b){if(_0x4bf80b){return _0x4c2294[_0xdbc0('0x17')](_0x296e5c)[_0xdbc0('0x19')](_0x4bf80b);}};}function respondWithFilteredResult(_0x57b27a,_0x435160){return function(_0x2b241e){if(_0x2b241e){var _0xd7dd0=typeof _0x435160['offset']===_0xdbc0('0x1a')&&typeof _0x435160[_0xdbc0('0x1b')]===_0xdbc0('0x1a');var _0x34b0cd=_0x2b241e[_0xdbc0('0x1c')];var _0x574499=_0xd7dd0?0x0:_0x435160[_0xdbc0('0x1d')];var _0x25c021=_0xd7dd0?_0x2b241e[_0xdbc0('0x1c')]:_0x435160[_0xdbc0('0x1d')]+_0x435160[_0xdbc0('0x1b')];var _0x42b333;if(_0x25c021>=_0x34b0cd){_0x25c021=_0x34b0cd;_0x42b333=0xc8;}else{_0x42b333=0xce;}_0x57b27a[_0xdbc0('0x17')](_0x42b333);return _0x57b27a[_0xdbc0('0x1e')](_0xdbc0('0x1f'),_0x574499+'-'+_0x25c021+'/'+_0x34b0cd)[_0xdbc0('0x19')](_0x2b241e);}return null;};}function patchUpdates(_0x1e5c10){return function(_0x115036){try{jsonpatch[_0xdbc0('0x20')](_0x115036,_0x1e5c10,!![]);}catch(_0x3c55ae){return BPromise[_0xdbc0('0x21')](_0x3c55ae);}return _0x115036['save']();};}function saveUpdates(_0xf65327,_0x4a9adf){return function(_0x106765){if(_0x106765){return _0x106765[_0xdbc0('0x22')](_0xf65327)[_0xdbc0('0x23')](function(_0x1feabc){return _0x1feabc;});}return null;};}function removeEntity(_0xcc767f,_0x3a6d60){return function(_0x208207){if(_0x208207){return _0x208207['destroy']()[_0xdbc0('0x23')](function(){var _0x23767d=_0x208207['get']({'plain':!![]});var _0x3426e2=_0xdbc0('0x24');return db[_0xdbc0('0x25')]['destroy']({'where':{'type':_0x3426e2,'resourceId':_0x23767d['id']}})[_0xdbc0('0x23')](function(){return _0x208207;});})[_0xdbc0('0x23')](function(){_0xcc767f[_0xdbc0('0x17')](0xcc)[_0xdbc0('0x18')]();});}};}function handleEntityNotFound(_0x452987,_0x47ee4a){return function(_0x1a75d0){if(!_0x1a75d0){_0x452987[_0xdbc0('0x16')](0x194);}return _0x1a75d0;};}function handleError(_0x5b4ac2,_0x5eb5af){_0x5eb5af=_0x5eb5af||0x1f4;return function(_0x3be62f){logger[_0xdbc0('0x26')](_0x3be62f[_0xdbc0('0x27')]);if(_0x3be62f[_0xdbc0('0x28')]){delete _0x3be62f['name'];}_0x5b4ac2[_0xdbc0('0x17')](_0x5eb5af)[_0xdbc0('0x29')](_0x3be62f);};}exports[_0xdbc0('0x2a')]=function(_0x589404,_0x226a08){var _0x438cd0={},_0x1cd1b2={},_0x194310={'count':0x0,'rows':[]};var _0x2e5f1f=_[_0xdbc0('0x2b')](db[_0xdbc0('0x2c')]['rawAttributes'],function(_0x1e3d16){return{'name':_0x1e3d16[_0xdbc0('0x2d')],'type':_0x1e3d16['type'][_0xdbc0('0x2e')]};});_0x1cd1b2[_0xdbc0('0x2f')]=_[_0xdbc0('0x2b')](_0x2e5f1f,_0xdbc0('0x28'));_0x1cd1b2[_0xdbc0('0x30')]=_[_0xdbc0('0x31')](_0x589404[_0xdbc0('0x30')]);_0x1cd1b2[_0xdbc0('0x32')]=_[_0xdbc0('0x33')](_0x1cd1b2[_0xdbc0('0x2f')],_0x1cd1b2[_0xdbc0('0x30')]);_0x438cd0[_0xdbc0('0x34')]=_[_0xdbc0('0x33')](_0x1cd1b2[_0xdbc0('0x2f')],qs['fields'](_0x589404[_0xdbc0('0x30')][_0xdbc0('0x35')]));_0x438cd0[_0xdbc0('0x34')]=_0x438cd0[_0xdbc0('0x34')][_0xdbc0('0x36')]?_0x438cd0[_0xdbc0('0x34')]:_0x1cd1b2[_0xdbc0('0x2f')];if(!_0x589404[_0xdbc0('0x30')][_0xdbc0('0x37')](_0xdbc0('0x38'))){_0x438cd0[_0xdbc0('0x1b')]=qs[_0xdbc0('0x1b')](_0x589404[_0xdbc0('0x30')][_0xdbc0('0x1b')]);_0x438cd0['offset']=qs[_0xdbc0('0x1d')](_0x589404['query'][_0xdbc0('0x1d')]);}_0x438cd0[_0xdbc0('0x39')]=qs['sort'](_0x589404[_0xdbc0('0x30')][_0xdbc0('0x3a')]);_0x438cd0[_0xdbc0('0x3b')]=qs['filters'](_[_0xdbc0('0x3c')](_0x589404[_0xdbc0('0x30')],_0x1cd1b2[_0xdbc0('0x32')]),_0x2e5f1f);if(_0x589404[_0xdbc0('0x30')][_0xdbc0('0x3d')]){_0x438cd0[_0xdbc0('0x3b')]=_[_0xdbc0('0x3e')](_0x438cd0['where'],{'$or':_[_0xdbc0('0x2b')](_0x2e5f1f,function(_0x38845e){if(_0x38845e[_0xdbc0('0x3f')]!==_0xdbc0('0x40')){var _0x260999={};_0x260999[_0x38845e['name']]={'$like':'%'+_0x589404[_0xdbc0('0x30')]['filter']+'%'};return _0x260999;}})});}_0x438cd0=_['merge']({},_0x438cd0,_0x589404[_0xdbc0('0x41')]);var _0x3d1a88={'where':_0x438cd0[_0xdbc0('0x3b')]};return db[_0xdbc0('0x2c')][_0xdbc0('0x1c')](_0x3d1a88)[_0xdbc0('0x23')](function(_0x15732d){_0x194310[_0xdbc0('0x1c')]=_0x15732d;if(_0x589404[_0xdbc0('0x30')][_0xdbc0('0x42')]){_0x438cd0['include']=[{'all':!![]}];}return db[_0xdbc0('0x2c')][_0xdbc0('0x43')](_0x438cd0);})[_0xdbc0('0x23')](function(_0xadfa1c){_0x194310[_0xdbc0('0x44')]=_0xadfa1c;return _0x194310;})[_0xdbc0('0x23')](respondWithFilteredResult(_0x226a08,_0x438cd0))[_0xdbc0('0x45')](handleError(_0x226a08,null));};exports[_0xdbc0('0x46')]=function(_0x5ba975,_0x27e508){var _0x3549e8={'raw':!![],'where':{'id':_0x5ba975[_0xdbc0('0x47')]['id']}},_0x3c280e={};_0x3c280e['model']=_[_0xdbc0('0x31')](db['Sound'][_0xdbc0('0x48')]);_0x3c280e[_0xdbc0('0x30')]=_[_0xdbc0('0x31')](_0x5ba975[_0xdbc0('0x30')]);_0x3c280e[_0xdbc0('0x32')]=_[_0xdbc0('0x33')](_0x3c280e[_0xdbc0('0x2f')],_0x3c280e['query']);_0x3549e8[_0xdbc0('0x34')]=_[_0xdbc0('0x33')](_0x3c280e[_0xdbc0('0x2f')],qs[_0xdbc0('0x35')](_0x5ba975['query'][_0xdbc0('0x35')]));_0x3549e8[_0xdbc0('0x34')]=_0x3549e8[_0xdbc0('0x34')][_0xdbc0('0x36')]?_0x3549e8[_0xdbc0('0x34')]:_0x3c280e['model'];if(_0x5ba975[_0xdbc0('0x30')]['includeAll']){_0x3549e8[_0xdbc0('0x49')]=[{'all':!![]}];}_0x3549e8=_['merge']({},_0x3549e8,_0x5ba975[_0xdbc0('0x41')]);return db[_0xdbc0('0x2c')]['find'](_0x3549e8)['then'](handleEntityNotFound(_0x27e508,null))[_0xdbc0('0x23')](respondWithResult(_0x27e508,null))[_0xdbc0('0x45')](handleError(_0x27e508,null));};exports[_0xdbc0('0x4a')]=function(_0x79c1ee,_0x38c742,_0x4ddd25){return db[_0xdbc0('0x2c')][_0xdbc0('0x4b')]({'where':{'id':_0x79c1ee[_0xdbc0('0x47')]['id']},'attributes':[_0xdbc0('0x28'),_0xdbc0('0x4c'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x38c742,null))[_0xdbc0('0x23')](function(_0x32584c){if(_0x32584c){if(!fs[_0xdbc0('0x4d')](path[_0xdbc0('0x4e')](config[_0xdbc0('0x4f')],_0xdbc0('0x50'),_0x32584c[_0xdbc0('0x4c')]+'.'+_0x32584c[_0xdbc0('0x51')]))){throw new db['Sequelize'][(_0xdbc0('0x52'))](_0xdbc0('0x53'));}return _0x38c742[_0xdbc0('0x4a')](path['join'](config[_0xdbc0('0x4f')],_0xdbc0('0x50'),util[_0xdbc0('0x54')]('%s.%s',_0x32584c['save_name'],_0x32584c['converted_format'])),util['format'](_0xdbc0('0x55'),_0x32584c[_0xdbc0('0x28')],_0x32584c[_0xdbc0('0x51')]));}return null;})['catch'](handleError(_0x38c742,null));};exports[_0xdbc0('0x56')]=function(_0x2103b2,_0x40f5a0,_0xaae60b){var _0x29467b={'name':path['basename'](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x58')],path[_0xdbc0('0x59')](_0x2103b2['file'][_0xdbc0('0x58')])),'save_name':path['basename'](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x5a')],path[_0xdbc0('0x59')](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x5a')])),'original_format':path[_0xdbc0('0x59')](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x58')])[_0xdbc0('0x5b')](0x1),'converted_format':_0xdbc0('0x5c')};var _0x5c6c83=path[_0xdbc0('0x4e')](config[_0xdbc0('0x4f')],_0xdbc0('0x5d'),_0x2103b2['file'][_0xdbc0('0x5a')]);var _0xe36fc8=path['join'](config[_0xdbc0('0x4f')],_0xdbc0('0x50'),util[_0xdbc0('0x54')](_0xdbc0('0x55'),path[_0xdbc0('0x5e')](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x5a')],path[_0xdbc0('0x59')](_0x2103b2[_0xdbc0('0x57')][_0xdbc0('0x5a')])),_0x29467b[_0xdbc0('0x51')]));logger[_0xdbc0('0x5f')]('Sound\x20upload\x20filepath:\x20%s',_0x5c6c83);logger[_0xdbc0('0x5f')](_0xdbc0('0x60'),_0xe36fc8);try{fs[_0xdbc0('0x61')](_0x5c6c83,parseInt(_0xdbc0('0x62'),0x8));var _0x15b9f6=sox['transcode'](_0x5c6c83,_0xe36fc8,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x15b9f6['on'](_0xdbc0('0x26'),function(_0x8fdf85){fs['unlinkSync'](_0x5c6c83);_0x40f5a0['status'](0x1f4)[_0xdbc0('0x29')](_0x8fdf85);});_0x15b9f6['on'](_0xdbc0('0x63'),function(_0x2288c6){_0x29467b[_0xdbc0('0x64')]=isNaN(_0x2288c6['duration'])?null:_0x2288c6[_0xdbc0('0x65')]*0x3e8;_0x29467b[_0xdbc0('0x66')]=isNaN(_0x2288c6[_0xdbc0('0x67')])?null:_0x2288c6[_0xdbc0('0x67')];_0x29467b[_0xdbc0('0x68')]=isNaN(_0x2288c6[_0xdbc0('0x69')])?null:_0x2288c6['channelCount'];_0x29467b['original_bitRate']=isNaN(_0x2288c6[_0xdbc0('0x6a')])?null:_0x2288c6[_0xdbc0('0x6a')];_0x29467b[_0xdbc0('0x6b')]=isNaN(_0x2288c6[_0xdbc0('0x6c')])?null:_0x2288c6[_0xdbc0('0x6c')];});_0x15b9f6['on'](_0xdbc0('0x6d'),function(_0x39cf1c){_0x29467b[_0xdbc0('0x6e')]=isNaN(_0x39cf1c[_0xdbc0('0x65')])?null:_0x39cf1c[_0xdbc0('0x65')]*0x3e8;_0x29467b[_0xdbc0('0x6f')]=isNaN(_0x39cf1c['sampleCount'])?null:_0x39cf1c[_0xdbc0('0x67')];_0x29467b[_0xdbc0('0x70')]=isNaN(_0x39cf1c[_0xdbc0('0x69')])?null:_0x39cf1c['channelCount'];_0x29467b['converted_bitRate']=isNaN(_0x39cf1c[_0xdbc0('0x6a')])?null:_0x39cf1c[_0xdbc0('0x6a')];_0x29467b[_0xdbc0('0x71')]=isNaN(_0x39cf1c['sampleRate'])?null:_0x39cf1c[_0xdbc0('0x6c')];});_0x15b9f6['on'](_0xdbc0('0x18'),function(){fs[_0xdbc0('0x61')](_0xe36fc8,parseInt(_0xdbc0('0x62'),0x8));return db['Sound'][_0xdbc0('0x56')](_0x29467b)[_0xdbc0('0x23')](function(_0x47a23b){var _0x14fa1f={'role':_0x2103b2[_0xdbc0('0x72')]['role'],'userProfileId':_0x2103b2[_0xdbc0('0x72')][_0xdbc0('0x73')]};if(!_0x14fa1f)throw new Error(_0xdbc0('0x74'));if(_0x14fa1f[_0xdbc0('0x75')]===_0xdbc0('0x76')){var _0x5257c0=_0x47a23b['get']({'plain':!![]});return db[_0xdbc0('0x77')][_0xdbc0('0x4b')]({'where':{'name':_0xdbc0('0x24'),'userProfileId':_0x14fa1f[_0xdbc0('0x73')]},'raw':!![]})[_0xdbc0('0x23')](function(_0x1f482e){if(_0x1f482e&&_0x1f482e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x5257c0['name'],'resourceId':_0x5257c0['id'],'type':_0x1f482e[_0xdbc0('0x28')],'sectionId':_0x1f482e['id']},{})[_0xdbc0('0x23')](function(){return _0x47a23b;});}else{return _0x47a23b;}})[_0xdbc0('0x45')](function(_0x4309ba){logger['error'](_0xdbc0('0x78'),_0x4309ba);throw _0x4309ba;});}return _0x47a23b;})[_0xdbc0('0x23')](respondWithResult(_0x40f5a0,null))['catch'](handleError(_0x40f5a0,null));});_0x15b9f6['start']();}catch(_0x444e89){_0x40f5a0[_0xdbc0('0x17')](0x1f4)[_0xdbc0('0x29')](_0x444e89);}};exports[_0xdbc0('0x22')]=function(_0x29b3a6,_0x5c8467,_0x5d9410){return db[_0xdbc0('0x2c')][_0xdbc0('0x4b')]({'where':{'id':_0x29b3a6['params']['id']}})['then'](handleEntityNotFound(_0x5c8467,null))['then'](saveUpdates(_['pick'](_0x29b3a6[_0xdbc0('0x72')],[_0xdbc0('0x28'),'description']),null))['then'](respondWithResult(_0x5c8467,null))[_0xdbc0('0x45')](handleError(_0x5c8467,null));};exports[_0xdbc0('0x79')]=function(_0x1ba156,_0xca7298,_0x3f226d){return db[_0xdbc0('0x2c')]['find']({'where':{'id':_0x1ba156['params']['id']}})['then'](function(_0x154e3b){if(_0x154e3b){return _0x154e3b[_0xdbc0('0x7a')]();}})[_0xdbc0('0x23')](function(_0x273e78){var _0x47499=path[_0xdbc0('0x4e')](config['root'],_0xdbc0('0x5d'),util['format']('%s.%s',_0x273e78[_0xdbc0('0x4c')],_0x273e78[_0xdbc0('0x7b')]));var _0x1fe884=path[_0xdbc0('0x4e')](config['root'],_0xdbc0('0x50'),util[_0xdbc0('0x54')]('%s.%s',_0x273e78[_0xdbc0('0x4c')],_0x273e78[_0xdbc0('0x51')]));fs[_0xdbc0('0x7c')](_0x47499);fs[_0xdbc0('0x7c')](_0x1fe884);return _0x273e78;})[_0xdbc0('0x23')](function(_0x2a4e2f){if(_0x2a4e2f){return _0xca7298[_0xdbc0('0x17')](0xcc)[_0xdbc0('0x18')]();}})[_0xdbc0('0x23')](handleEntityNotFound(_0xca7298,null))[_0xdbc0('0x45')](handleError(_0xca7298,null));}; \ No newline at end of file +var _0x9b92=['params','fields','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','catch','create','basename','file','originalname','extname','filename','substring','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','wav','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','description','delete','save_name','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','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','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','Sounds','UserProfileResource','then','sendStatus','error','stack','name','send','map','Sound','rawAttributes','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show'];(function(_0x36e059,_0x19ee27){var _0x52ee13=function(_0x3dbfb1){while(--_0x3dbfb1){_0x36e059['push'](_0x36e059['shift']());}};_0x52ee13(++_0x19ee27);}(_0x9b92,0x136));var _0x29b9=function(_0x1753ce,_0x82d12c){_0x1753ce=_0x1753ce-0x0;var _0x5d93f0=_0x9b92[_0x1753ce];return _0x5d93f0;};'use strict';var emlformat=require(_0x29b9('0x0'));var rimraf=require(_0x29b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29b9('0x2'));var rp=require(_0x29b9('0x3'));var moment=require(_0x29b9('0x4'));var BPromise=require(_0x29b9('0x5'));var Mustache=require(_0x29b9('0x6'));var util=require('util');var path=require('path');var sox=require(_0x29b9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29b9('0x8'));var _=require('lodash');var squel=require(_0x29b9('0x9'));var crypto=require(_0x29b9('0xa'));var jsforce=require(_0x29b9('0xb'));var deskjs=require(_0x29b9('0xc'));var toCsv=require('to-csv');var querystring=require(_0x29b9('0xd'));var Papa=require(_0x29b9('0xe'));var Redis=require(_0x29b9('0xf'));var authService=require(_0x29b9('0x10'));var qs=require(_0x29b9('0x11'));var as=require(_0x29b9('0x12'));var hardwareService=require(_0x29b9('0x13'));var logger=require(_0x29b9('0x14'))('api');var utils=require(_0x29b9('0x15'));var config=require(_0x29b9('0x16'));var licenseUtil=require(_0x29b9('0x17'));var db=require(_0x29b9('0x18'))['db'];function respondWithStatusCode(_0x4de0c1,_0x24c4f6){_0x24c4f6=_0x24c4f6||0xcc;return function(_0x85f59a){if(_0x85f59a){return _0x4de0c1['sendStatus'](_0x24c4f6);}return _0x4de0c1[_0x29b9('0x19')](_0x24c4f6)[_0x29b9('0x1a')]();};}function respondWithResult(_0x14fe0,_0x4f2051){_0x4f2051=_0x4f2051||0xc8;return function(_0x2d32f6){if(_0x2d32f6){return _0x14fe0[_0x29b9('0x19')](_0x4f2051)[_0x29b9('0x1b')](_0x2d32f6);}};}function respondWithFilteredResult(_0x3089c9,_0x548bc6){return function(_0x556e79){if(_0x556e79){var _0x4ab727=typeof _0x548bc6['offset']===_0x29b9('0x1c')&&typeof _0x548bc6['limit']==='undefined';var _0x1306e7=_0x556e79[_0x29b9('0x1d')];var _0x29e8ea=_0x4ab727?0x0:_0x548bc6[_0x29b9('0x1e')];var _0x1f0afa=_0x4ab727?_0x556e79[_0x29b9('0x1d')]:_0x548bc6['offset']+_0x548bc6[_0x29b9('0x1f')];var _0x14c75b;if(_0x1f0afa>=_0x1306e7){_0x1f0afa=_0x1306e7;_0x14c75b=0xc8;}else{_0x14c75b=0xce;}_0x3089c9['status'](_0x14c75b);return _0x3089c9[_0x29b9('0x20')](_0x29b9('0x21'),_0x29e8ea+'-'+_0x1f0afa+'/'+_0x1306e7)[_0x29b9('0x1b')](_0x556e79);}return null;};}function patchUpdates(_0x27ac25){return function(_0x73ef9e){try{jsonpatch[_0x29b9('0x22')](_0x73ef9e,_0x27ac25,!![]);}catch(_0x59a9fc){return BPromise['reject'](_0x59a9fc);}return _0x73ef9e[_0x29b9('0x23')]();};}function saveUpdates(_0x3969f3,_0x5749eb){return function(_0x4cc5e4){if(_0x4cc5e4){return _0x4cc5e4[_0x29b9('0x24')](_0x3969f3)['then'](function(_0x28a618){return _0x28a618;});}return null;};}function removeEntity(_0xd945b5,_0x4eb605){return function(_0x4a25c1){if(_0x4a25c1){return _0x4a25c1[_0x29b9('0x25')]()['then'](function(){var _0x116323=_0x4a25c1[_0x29b9('0x26')]({'plain':!![]});var _0x336909=_0x29b9('0x27');return db[_0x29b9('0x28')][_0x29b9('0x25')]({'where':{'type':_0x336909,'resourceId':_0x116323['id']}})['then'](function(){return _0x4a25c1;});})[_0x29b9('0x29')](function(){_0xd945b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x112c4d,_0x448098){return function(_0x1a8401){if(!_0x1a8401){_0x112c4d[_0x29b9('0x2a')](0x194);}return _0x1a8401;};}function handleError(_0x2c8b46,_0x33ff69){_0x33ff69=_0x33ff69||0x1f4;return function(_0x3db071){logger[_0x29b9('0x2b')](_0x3db071[_0x29b9('0x2c')]);if(_0x3db071[_0x29b9('0x2d')]){delete _0x3db071[_0x29b9('0x2d')];}_0x2c8b46[_0x29b9('0x19')](_0x33ff69)[_0x29b9('0x2e')](_0x3db071);};}exports['index']=function(_0x2b8f1f,_0x328a7b){var _0x656533={},_0x2a3d94={},_0x4907f9={'count':0x0,'rows':[]};var _0x54e448=_[_0x29b9('0x2f')](db[_0x29b9('0x30')][_0x29b9('0x31')],function(_0x7117f3){return{'name':_0x7117f3['fieldName'],'type':_0x7117f3['type'][_0x29b9('0x32')]};});_0x2a3d94['model']=_[_0x29b9('0x2f')](_0x54e448,_0x29b9('0x2d'));_0x2a3d94[_0x29b9('0x33')]=_[_0x29b9('0x34')](_0x2b8f1f['query']);_0x2a3d94['filters']=_[_0x29b9('0x35')](_0x2a3d94['model'],_0x2a3d94[_0x29b9('0x33')]);_0x656533['attributes']=_[_0x29b9('0x35')](_0x2a3d94[_0x29b9('0x36')],qs['fields'](_0x2b8f1f[_0x29b9('0x33')]['fields']));_0x656533['attributes']=_0x656533[_0x29b9('0x37')][_0x29b9('0x38')]?_0x656533[_0x29b9('0x37')]:_0x2a3d94[_0x29b9('0x36')];if(!_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x39')](_0x29b9('0x3a'))){_0x656533[_0x29b9('0x1f')]=qs[_0x29b9('0x1f')](_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x1f')]);_0x656533[_0x29b9('0x1e')]=qs[_0x29b9('0x1e')](_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x1e')]);}_0x656533[_0x29b9('0x3b')]=qs[_0x29b9('0x3c')](_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x3c')]);_0x656533[_0x29b9('0x3d')]=qs[_0x29b9('0x3e')](_[_0x29b9('0x3f')](_0x2b8f1f[_0x29b9('0x33')],_0x2a3d94['filters']),_0x54e448);if(_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x40')]){_0x656533[_0x29b9('0x3d')]=_[_0x29b9('0x41')](_0x656533[_0x29b9('0x3d')],{'$or':_[_0x29b9('0x2f')](_0x54e448,function(_0x44c27b){if(_0x44c27b[_0x29b9('0x42')]!==_0x29b9('0x43')){var _0x4c8770={};_0x4c8770[_0x44c27b[_0x29b9('0x2d')]]={'$like':'%'+_0x2b8f1f[_0x29b9('0x33')][_0x29b9('0x40')]+'%'};return _0x4c8770;}})});}_0x656533=_[_0x29b9('0x41')]({},_0x656533,_0x2b8f1f[_0x29b9('0x44')]);var _0x3c283f={'where':_0x656533[_0x29b9('0x3d')]};return db[_0x29b9('0x30')][_0x29b9('0x1d')](_0x3c283f)[_0x29b9('0x29')](function(_0xf5717e){_0x4907f9[_0x29b9('0x1d')]=_0xf5717e;if(_0x2b8f1f['query'][_0x29b9('0x45')]){_0x656533[_0x29b9('0x46')]=[{'all':!![]}];}return db[_0x29b9('0x30')][_0x29b9('0x47')](_0x656533);})[_0x29b9('0x29')](function(_0x14d41a){_0x4907f9[_0x29b9('0x48')]=_0x14d41a;return _0x4907f9;})[_0x29b9('0x29')](respondWithFilteredResult(_0x328a7b,_0x656533))['catch'](handleError(_0x328a7b,null));};exports[_0x29b9('0x49')]=function(_0x593062,_0x5e3baa){var _0x3c1604={'raw':!![],'where':{'id':_0x593062[_0x29b9('0x4a')]['id']}},_0x46a357={};_0x46a357['model']=_[_0x29b9('0x34')](db['Sound']['rawAttributes']);_0x46a357[_0x29b9('0x33')]=_['keys'](_0x593062[_0x29b9('0x33')]);_0x46a357[_0x29b9('0x3e')]=_[_0x29b9('0x35')](_0x46a357['model'],_0x46a357['query']);_0x3c1604[_0x29b9('0x37')]=_['intersection'](_0x46a357[_0x29b9('0x36')],qs[_0x29b9('0x4b')](_0x593062[_0x29b9('0x33')]['fields']));_0x3c1604['attributes']=_0x3c1604['attributes'][_0x29b9('0x38')]?_0x3c1604[_0x29b9('0x37')]:_0x46a357[_0x29b9('0x36')];if(_0x593062[_0x29b9('0x33')][_0x29b9('0x45')]){_0x3c1604['include']=[{'all':!![]}];}_0x3c1604=_['merge']({},_0x3c1604,_0x593062[_0x29b9('0x44')]);return db[_0x29b9('0x30')][_0x29b9('0x4c')](_0x3c1604)[_0x29b9('0x29')](handleEntityNotFound(_0x5e3baa,null))[_0x29b9('0x29')](respondWithResult(_0x5e3baa,null))['catch'](handleError(_0x5e3baa,null));};exports[_0x29b9('0x4d')]=function(_0xb92126,_0x55161f,_0x53353f){return db['Sound']['find']({'where':{'id':_0xb92126[_0x29b9('0x4a')]['id']},'attributes':['name','save_name',_0x29b9('0x4e')],'raw':!![]})[_0x29b9('0x29')](handleEntityNotFound(_0x55161f,null))[_0x29b9('0x29')](function(_0x6f0c92){if(_0x6f0c92){if(!fs[_0x29b9('0x4f')](path[_0x29b9('0x50')](config[_0x29b9('0x51')],_0x29b9('0x52'),_0x6f0c92['save_name']+'.'+_0x6f0c92[_0x29b9('0x4e')]))){throw new db[(_0x29b9('0x53'))][(_0x29b9('0x54'))](_0x29b9('0x55'));}return _0x55161f[_0x29b9('0x4d')](path[_0x29b9('0x50')](config[_0x29b9('0x51')],_0x29b9('0x52'),util[_0x29b9('0x56')]('%s.%s',_0x6f0c92['save_name'],_0x6f0c92[_0x29b9('0x4e')])),util[_0x29b9('0x56')](_0x29b9('0x57'),_0x6f0c92[_0x29b9('0x2d')],_0x6f0c92[_0x29b9('0x4e')]));}return null;})[_0x29b9('0x58')](handleError(_0x55161f,null));};exports[_0x29b9('0x59')]=function(_0x4a6013,_0x3124a5,_0x1f6b76){var _0x33e88b={'name':path[_0x29b9('0x5a')](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5c')],path['extname'](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5c')])),'save_name':path[_0x29b9('0x5a')](_0x4a6013[_0x29b9('0x5b')]['filename'],path[_0x29b9('0x5d')](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5e')])),'original_format':path['extname'](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5c')])[_0x29b9('0x5f')](0x1),'converted_format':'wav'};var _0x5ac0d8=path[_0x29b9('0x50')](config[_0x29b9('0x51')],'server/files/sounds/original',_0x4a6013[_0x29b9('0x5b')]['filename']);var _0x5c220e=path[_0x29b9('0x50')](config['root'],_0x29b9('0x52'),util[_0x29b9('0x56')](_0x29b9('0x57'),path[_0x29b9('0x5a')](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5e')],path[_0x29b9('0x5d')](_0x4a6013[_0x29b9('0x5b')][_0x29b9('0x5e')])),_0x33e88b['converted_format']));logger[_0x29b9('0x60')](_0x29b9('0x61'),_0x5ac0d8);logger[_0x29b9('0x60')](_0x29b9('0x62'),_0x5c220e);try{fs['chmodSync'](_0x5ac0d8,parseInt(_0x29b9('0x63'),0x8));var _0x1dbb74=sox[_0x29b9('0x64')](_0x5ac0d8,_0x5c220e,{'sampleRate':0x1f40,'format':_0x29b9('0x65'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1dbb74['on']('error',function(_0x1a17ff){fs['unlinkSync'](_0x5ac0d8);_0x3124a5['status'](0x1f4)['send'](_0x1a17ff);});_0x1dbb74['on']('src',function(_0x4bf365){_0x33e88b[_0x29b9('0x66')]=isNaN(_0x4bf365[_0x29b9('0x67')])?null:_0x4bf365['duration']*0x3e8;_0x33e88b[_0x29b9('0x68')]=isNaN(_0x4bf365['sampleCount'])?null:_0x4bf365[_0x29b9('0x69')];_0x33e88b[_0x29b9('0x6a')]=isNaN(_0x4bf365[_0x29b9('0x6b')])?null:_0x4bf365['channelCount'];_0x33e88b['original_bitRate']=isNaN(_0x4bf365[_0x29b9('0x6c')])?null:_0x4bf365['bitRate'];_0x33e88b[_0x29b9('0x6d')]=isNaN(_0x4bf365[_0x29b9('0x6e')])?null:_0x4bf365[_0x29b9('0x6e')];});_0x1dbb74['on'](_0x29b9('0x6f'),function(_0x1d04a3){_0x33e88b[_0x29b9('0x70')]=isNaN(_0x1d04a3[_0x29b9('0x67')])?null:_0x1d04a3[_0x29b9('0x67')]*0x3e8;_0x33e88b[_0x29b9('0x71')]=isNaN(_0x1d04a3[_0x29b9('0x69')])?null:_0x1d04a3[_0x29b9('0x69')];_0x33e88b[_0x29b9('0x72')]=isNaN(_0x1d04a3[_0x29b9('0x6b')])?null:_0x1d04a3[_0x29b9('0x6b')];_0x33e88b[_0x29b9('0x73')]=isNaN(_0x1d04a3[_0x29b9('0x6c')])?null:_0x1d04a3['bitRate'];_0x33e88b[_0x29b9('0x74')]=isNaN(_0x1d04a3[_0x29b9('0x6e')])?null:_0x1d04a3[_0x29b9('0x6e')];});_0x1dbb74['on']('end',function(){fs['chmodSync'](_0x5c220e,parseInt('0777',0x8));return db['Sound'][_0x29b9('0x59')](_0x33e88b)[_0x29b9('0x29')](function(_0x1c66af){var _0x1c76fb={'role':_0x4a6013['body']['role'],'userProfileId':_0x4a6013['body'][_0x29b9('0x75')]};if(!_0x1c76fb)throw new Error(_0x29b9('0x76'));if(_0x1c76fb['role']===_0x29b9('0x77')){var _0xc1957f=_0x1c66af['get']({'plain':!![]});return db[_0x29b9('0x78')]['find']({'where':{'name':_0x29b9('0x27'),'userProfileId':_0x1c76fb[_0x29b9('0x75')]},'raw':!![]})[_0x29b9('0x29')](function(_0x1aa00b){if(_0x1aa00b&&_0x1aa00b[_0x29b9('0x79')]===0x0){return db['UserProfileResource']['create']({'name':_0xc1957f[_0x29b9('0x2d')],'resourceId':_0xc1957f['id'],'type':_0x1aa00b[_0x29b9('0x2d')],'sectionId':_0x1aa00b['id']},{})[_0x29b9('0x29')](function(){return _0x1c66af;});}else{return _0x1c66af;}})[_0x29b9('0x58')](function(_0x59fe14){logger[_0x29b9('0x2b')](_0x29b9('0x7a'),_0x59fe14);throw _0x59fe14;});}return _0x1c66af;})['then'](respondWithResult(_0x3124a5,null))['catch'](handleError(_0x3124a5,null));});_0x1dbb74['start']();}catch(_0x525c72){_0x3124a5[_0x29b9('0x19')](0x1f4)[_0x29b9('0x2e')](_0x525c72);}};exports[_0x29b9('0x24')]=function(_0x1b18c0,_0x4f51a7,_0x5377bc){return db[_0x29b9('0x30')][_0x29b9('0x4c')]({'where':{'id':_0x1b18c0['params']['id']}})[_0x29b9('0x29')](handleEntityNotFound(_0x4f51a7,null))['then'](saveUpdates(_[_0x29b9('0x3f')](_0x1b18c0[_0x29b9('0x7b')],[_0x29b9('0x2d'),_0x29b9('0x7c')]),null))['then'](respondWithResult(_0x4f51a7,null))[_0x29b9('0x58')](handleError(_0x4f51a7,null));};exports[_0x29b9('0x7d')]=function(_0x14b7c1,_0x2c1356,_0x284d54){return db[_0x29b9('0x30')][_0x29b9('0x4c')]({'where':{'id':_0x14b7c1[_0x29b9('0x4a')]['id']}})[_0x29b9('0x29')](function(_0x50742e){if(_0x50742e){return _0x50742e[_0x29b9('0x25')]();}})[_0x29b9('0x29')](function(_0x39778e){var _0x56c126=path[_0x29b9('0x50')](config[_0x29b9('0x51')],'server/files/sounds/original',util['format'](_0x29b9('0x57'),_0x39778e[_0x29b9('0x7e')],_0x39778e['original_format']));var _0x26e512=path['join'](config[_0x29b9('0x51')],_0x29b9('0x52'),util[_0x29b9('0x56')](_0x29b9('0x57'),_0x39778e[_0x29b9('0x7e')],_0x39778e[_0x29b9('0x4e')]));fs[_0x29b9('0x7f')](_0x56c126);fs[_0x29b9('0x7f')](_0x26e512);return _0x39778e;})[_0x29b9('0x29')](function(_0x337f10){if(_0x337f10){return _0x2c1356[_0x29b9('0x19')](0xcc)[_0x29b9('0x1a')]();}})[_0x29b9('0x29')](handleEntityNotFound(_0x2c1356,null))['catch'](handleError(_0x2c1356,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c187c96..68b964d 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 _0x143f=['exports','define','Sound','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./sound.attributes'];(function(_0x592d7c,_0x405966){var _0xaa8d19=function(_0x20a67a){while(--_0x20a67a){_0x592d7c['push'](_0x592d7c['shift']());}};_0xaa8d19(++_0x405966);}(_0x143f,0x1b1));var _0xf143=function(_0x544950,_0x65d36c){_0x544950=_0x544950-0x0;var _0xfd75ed=_0x143f[_0x544950];return _0xfd75ed;};'use strict';var _=require('lodash');var util=require(_0xf143('0x0'));var logger=require(_0xf143('0x1'))('api');var moment=require(_0xf143('0x2'));var BPromise=require('bluebird');var rp=require(_0xf143('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf143('0x4'));var config=require(_0xf143('0x5'));var attributes=require(_0xf143('0x6'));module[_0xf143('0x7')]=function(_0x155104,_0xd6d09c){return _0x155104[_0xf143('0x8')](_0xf143('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf6b=['Sound','tools_sounds','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x4d9810,_0x1b4625){var _0x398312=function(_0x33a512){while(--_0x33a512){_0x4d9810['push'](_0x4d9810['shift']());}};_0x398312(++_0x1b4625);}(_0xcf6b,0xc8));var _0xbcf6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xcf6b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xbcf6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbcf6('0x1'));var moment=require('moment');var BPromise=require(_0xbcf6('0x2'));var rp=require(_0xbcf6('0x3'));var fs=require('fs');var path=require(_0xbcf6('0x4'));var rimraf=require(_0xbcf6('0x5'));var config=require(_0xbcf6('0x6'));var attributes=require(_0xbcf6('0x7'));module[_0xbcf6('0x8')]=function(_0x19120d,_0x4e17f3){return _0x19120d['define'](_0xbcf6('0x9'),attributes,{'tableName':_0xbcf6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index bc80466..772b733 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 _0x5047=['include','model','then','debug','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','Sound','options','where','attributes','map'];(function(_0x471308,_0x22c4ab){var _0x399773=function(_0x20f802){while(--_0x20f802){_0x471308['push'](_0x471308['shift']());}};_0x399773(++_0x22c4ab);}(_0x5047,0x1b7));var _0x7504=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0x5047[_0x47f7ec];return _0x415101;};'use strict';var _=require(_0x7504('0x0'));var util=require(_0x7504('0x1'));var moment=require(_0x7504('0x2'));var BPromise=require(_0x7504('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7504('0x4'));var db=require(_0x7504('0x5'))['db'];var utils=require(_0x7504('0x6'));var logger=require(_0x7504('0x7'))(_0x7504('0x8'));var config=require(_0x7504('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7504('0xa')][_0x7504('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x459a93,_0x48b04d,_0x3e3f42){return new BPromise(function(_0x399cc2,_0x2ca081){return client[_0x7504('0xc')](_0x459a93,_0x3e3f42)['then'](function(_0x322f3a){logger['info'](_0x7504('0xd'),_0x48b04d,_0x7504('0xe'));logger['debug'](_0x7504('0xf'),_0x48b04d,'request\x20sent',JSON['stringify'](_0x322f3a));if(_0x322f3a[_0x7504('0x10')]){if(_0x322f3a[_0x7504('0x10')][_0x7504('0x11')]===0x1f4){logger[_0x7504('0x10')](_0x7504('0xd'),_0x48b04d,_0x322f3a[_0x7504('0x10')][_0x7504('0x12')]);return _0x2ca081(_0x322f3a[_0x7504('0x10')][_0x7504('0x12')]);}logger[_0x7504('0x10')]('Sound,\x20%s,\x20%s',_0x48b04d,_0x322f3a['error'][_0x7504('0x12')]);return _0x399cc2(_0x322f3a[_0x7504('0x10')]['message']);}else{logger['info'](_0x7504('0xd'),_0x48b04d,_0x7504('0xe'));_0x399cc2(_0x322f3a['result']['message']);}})[_0x7504('0x13')](function(_0x211afe){logger['error'](_0x7504('0xd'),_0x48b04d,_0x211afe);_0x2ca081(_0x211afe);});});}exports[_0x7504('0x14')]=function(_0x2a1e22){var _0x543abf=this;return new Promise(function(_0x3b48bf,_0x48a441){return db[_0x7504('0x15')]['find']({'raw':_0x2a1e22[_0x7504('0x16')]?_0x2a1e22[_0x7504('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1e22['options']?_0x2a1e22[_0x7504('0x16')][_0x7504('0x17')]||null:null,'attributes':_0x2a1e22[_0x7504('0x16')]?_0x2a1e22[_0x7504('0x16')][_0x7504('0x18')]||null:null,'include':_0x2a1e22[_0x7504('0x16')]?_0x2a1e22['options']['include']?_[_0x7504('0x19')](_0x2a1e22[_0x7504('0x16')][_0x7504('0x1a')],function(_0x5a6640){return{'model':db[_0x5a6640[_0x7504('0x1b')]],'as':_0x5a6640['as'],'attributes':_0x5a6640[_0x7504('0x18')],'include':_0x5a6640[_0x7504('0x1a')]?_[_0x7504('0x19')](_0x5a6640['include'],function(_0x5d03cb){return{'model':db[_0x5d03cb[_0x7504('0x1b')]],'as':_0x5d03cb['as'],'attributes':_0x5d03cb['attributes'],'include':_0x5d03cb[_0x7504('0x1a')]?_[_0x7504('0x19')](_0x5d03cb['include'],function(_0x13f2ee){return{'model':db[_0x13f2ee[_0x7504('0x1b')]],'as':_0x13f2ee['as'],'attributes':_0x13f2ee[_0x7504('0x18')]};}):[]};}):[]};}):[]:[]})[_0x7504('0x1c')](function(_0x70255f){logger['info'](_0x7504('0x14'),_0x2a1e22);logger[_0x7504('0x1d')]('ShowSound',_0x2a1e22,JSON[_0x7504('0x1e')](_0x70255f));_0x3b48bf(_0x70255f);})['catch'](function(_0x7bf335){logger[_0x7504('0x10')](_0x7504('0x14'),_0x7bf335['message'],_0x2a1e22);_0x48a441(_0x543abf['error'](0x1f4,_0x7bf335[_0x7504('0x12')]));});});}; \ No newline at end of file +var _0x114b=['map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','request\x20sent','catch','ShowSound','Sound','find','options','where','attributes','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x114b,0x1e2));var _0xb114=function(_0x43858b,_0x466964){_0x43858b=_0x43858b-0x0;var _0x4013f2=_0x114b[_0x43858b];return _0x4013f2;};'use strict';var _=require(_0xb114('0x0'));var util=require(_0xb114('0x1'));var moment=require(_0xb114('0x2'));var BPromise=require(_0xb114('0x3'));var rs=require(_0xb114('0x4'));var fs=require('fs');var Redis=require(_0xb114('0x5'));var db=require(_0xb114('0x6'))['db'];var utils=require(_0xb114('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xb114('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb114('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a9dd2,_0x4e2139,_0x2bf572){return new BPromise(function(_0x2384dc,_0x35f585){return client['request'](_0x3a9dd2,_0x2bf572)[_0xb114('0xa')](function(_0x494cd8){logger['info'](_0xb114('0xb'),_0x4e2139,'request\x20sent');logger[_0xb114('0xc')](_0xb114('0xd'),_0x4e2139,'request\x20sent',JSON[_0xb114('0xe')](_0x494cd8));if(_0x494cd8['error']){if(_0x494cd8['error'][_0xb114('0xf')]===0x1f4){logger[_0xb114('0x10')](_0xb114('0xb'),_0x4e2139,_0x494cd8[_0xb114('0x10')][_0xb114('0x11')]);return _0x35f585(_0x494cd8[_0xb114('0x10')][_0xb114('0x11')]);}logger[_0xb114('0x10')]('Sound,\x20%s,\x20%s',_0x4e2139,_0x494cd8[_0xb114('0x10')][_0xb114('0x11')]);return _0x2384dc(_0x494cd8[_0xb114('0x10')][_0xb114('0x11')]);}else{logger[_0xb114('0x12')]('Sound,\x20%s,\x20%s',_0x4e2139,_0xb114('0x13'));_0x2384dc(_0x494cd8['result'][_0xb114('0x11')]);}})[_0xb114('0x14')](function(_0x401023){logger[_0xb114('0x10')](_0xb114('0xb'),_0x4e2139,_0x401023);_0x35f585(_0x401023);});});}exports[_0xb114('0x15')]=function(_0x5d477f){var _0x5ab41b=this;return new Promise(function(_0xeee2c2,_0x45f286){return db[_0xb114('0x16')][_0xb114('0x17')]({'raw':_0x5d477f[_0xb114('0x18')]?_0x5d477f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d477f['options']?_0x5d477f[_0xb114('0x18')][_0xb114('0x19')]||null:null,'attributes':_0x5d477f[_0xb114('0x18')]?_0x5d477f[_0xb114('0x18')][_0xb114('0x1a')]||null:null,'include':_0x5d477f[_0xb114('0x18')]?_0x5d477f[_0xb114('0x18')][_0xb114('0x1b')]?_[_0xb114('0x1c')](_0x5d477f[_0xb114('0x18')]['include'],function(_0x34eb6b){return{'model':db[_0x34eb6b['model']],'as':_0x34eb6b['as'],'attributes':_0x34eb6b[_0xb114('0x1a')],'include':_0x34eb6b['include']?_['map'](_0x34eb6b[_0xb114('0x1b')],function(_0x58da3f){return{'model':db[_0x58da3f[_0xb114('0x1d')]],'as':_0x58da3f['as'],'attributes':_0x58da3f[_0xb114('0x1a')],'include':_0x58da3f[_0xb114('0x1b')]?_[_0xb114('0x1c')](_0x58da3f['include'],function(_0x524316){return{'model':db[_0x524316['model']],'as':_0x524316['as'],'attributes':_0x524316[_0xb114('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xb114('0xa')](function(_0x395b6d){logger[_0xb114('0x12')](_0xb114('0x15'),_0x5d477f);logger['debug'](_0xb114('0x15'),_0x5d477f,JSON[_0xb114('0xe')](_0x395b6d));_0xeee2c2(_0x395b6d);})['catch'](function(_0x2515fd){logger[_0xb114('0x10')]('ShowSound',_0x2515fd['message'],_0x5d477f);_0x45f286(_0x5ab41b[_0xb114('0x10')](0x1f4,_0x2515fd['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index b30559f..0c44cdc 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 _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(_0x42d474,_0x5a7a68){var _0x133886=function(_0x40c877){while(--_0x40c877){_0x42d474['push'](_0x42d474['shift']());}};_0x133886(++_0x5a7a68);}(_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 +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(_0x69ab24,_0x372e47){var _0x106e55=function(_0xbdda13){while(--_0xbdda13){_0x69ab24['push'](_0x69ab24['shift']());}};_0x106e55(++_0x372e47);}(_0x5eb8,0xb0));var _0x85eb=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0x5eb8[_0xe39824];return _0x4bc31e;};'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 diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e40c0e9..c8f9830 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 _0x3225=['medium','out','sequelize','exports','STRING','TEXT'];(function(_0x38a35e,_0xf7c52d){var _0x13bcad=function(_0x2ad76d){while(--_0x2ad76d){_0x38a35e['push'](_0x38a35e['shift']());}};_0x13bcad(++_0xf7c52d);}(_0x3225,0xd4));var _0x5322=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3225[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5322('0x0'));module[_0x5322('0x1')]={'uniqueid':{'type':Sequelize[_0x5322('0x2')]},'body':{'type':Sequelize[_0x5322('0x3')](_0x5322('0x4')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5322('0x5')),'defaultValue':_0x5322('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5322('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf211=['out','STRING','exports','TEXT','ENUM'];(function(_0x2013f1,_0x3a541e){var _0x31a804=function(_0x4906c4){while(--_0x4906c4){_0x2013f1['push'](_0x2013f1['shift']());}};_0x31a804(++_0x3a541e);}(_0xf211,0x138));var _0x1f21=function(_0x46a59e,_0x4bf9ff){_0x46a59e=_0x46a59e-0x0;var _0x35aae0=_0xf211[_0x46a59e];return _0x35aae0;};'use strict';var Sequelize=require('sequelize');module[_0x1f21('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x1f21('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x1f21('0x2')]('in',_0x1f21('0x3')),'defaultValue':_0x1f21('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1f21('0x4')]},'providerResponse':{'type':Sequelize[_0x1f21('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 1a93502..80a8f16 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 _0x349f=['VIRTUAL','options','include','findAll','rows','catch','show','params','keys','SquareMessage','rawAttributes','fields','find','create','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0x5f0a89,_0x1fe7b6){var _0x3148ce=function(_0x39759e){while(--_0x39759e){_0x5f0a89['push'](_0x5f0a89['shift']());}};_0x3148ce(++_0x1fe7b6);}(_0x349f,0xa8));var _0xf349=function(_0x129a80,_0x4427af){_0x129a80=_0x129a80-0x0;var _0x559111=_0x349f[_0x129a80];return _0x559111;};'use strict';var emlformat=require(_0xf349('0x0'));var rimraf=require(_0xf349('0x1'));var zipdir=require(_0xf349('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf349('0x3'));var moment=require(_0xf349('0x4'));var BPromise=require(_0xf349('0x5'));var Mustache=require(_0xf349('0x6'));var util=require(_0xf349('0x7'));var path=require(_0xf349('0x8'));var sox=require(_0xf349('0x9'));var csv=require(_0xf349('0xa'));var ejs=require(_0xf349('0xb'));var fs=require('fs');var fs_extra=require(_0xf349('0xc'));var _=require('lodash');var squel=require(_0xf349('0xd'));var crypto=require(_0xf349('0xe'));var jsforce=require(_0xf349('0xf'));var deskjs=require(_0xf349('0x10'));var toCsv=require(_0xf349('0xa'));var querystring=require(_0xf349('0x11'));var Papa=require(_0xf349('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf349('0x13'));var as=require(_0xf349('0x14'));var hardwareService=require(_0xf349('0x15'));var logger=require(_0xf349('0x16'))(_0xf349('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf349('0x18'))['db'];function respondWithStatusCode(_0x238c96,_0x21cca8){_0x21cca8=_0x21cca8||0xcc;return function(_0x29d527){if(_0x29d527){return _0x238c96[_0xf349('0x19')](_0x21cca8);}return _0x238c96['status'](_0x21cca8)[_0xf349('0x1a')]();};}function respondWithResult(_0x35d833,_0x4ffa5f){_0x4ffa5f=_0x4ffa5f||0xc8;return function(_0x43b1ff){if(_0x43b1ff){return _0x35d833[_0xf349('0x1b')](_0x4ffa5f)['json'](_0x43b1ff);}};}function respondWithFilteredResult(_0x358412,_0x55479f){return function(_0x401ada){if(_0x401ada){var _0x3bc4e4=typeof _0x55479f[_0xf349('0x1c')]===_0xf349('0x1d')&&typeof _0x55479f[_0xf349('0x1e')]===_0xf349('0x1d');var _0x2666be=_0x401ada['count'];var _0x44aa98=_0x3bc4e4?0x0:_0x55479f['offset'];var _0x3b56cc=_0x3bc4e4?_0x401ada[_0xf349('0x1f')]:_0x55479f[_0xf349('0x1c')]+_0x55479f[_0xf349('0x1e')];var _0x363da1;if(_0x3b56cc>=_0x2666be){_0x3b56cc=_0x2666be;_0x363da1=0xc8;}else{_0x363da1=0xce;}_0x358412[_0xf349('0x1b')](_0x363da1);return _0x358412[_0xf349('0x20')](_0xf349('0x21'),_0x44aa98+'-'+_0x3b56cc+'/'+_0x2666be)['json'](_0x401ada);}return null;};}function patchUpdates(_0x282cc8){return function(_0x5eefe2){try{jsonpatch[_0xf349('0x22')](_0x5eefe2,_0x282cc8,!![]);}catch(_0x2b00f4){return BPromise[_0xf349('0x23')](_0x2b00f4);}return _0x5eefe2['save']();};}function saveUpdates(_0x311fc2,_0x1d2a26){return function(_0x236970){if(_0x236970){return _0x236970['update'](_0x311fc2)[_0xf349('0x24')](function(_0x35c9dd){return _0x35c9dd;});}return null;};}function removeEntity(_0x4d574a,_0x5752b5){return function(_0x55ed7a){if(_0x55ed7a){return _0x55ed7a[_0xf349('0x25')]()[_0xf349('0x24')](function(){_0x4d574a[_0xf349('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de06b,_0x2103a6){return function(_0x11dc06){if(!_0x11dc06){_0x3de06b[_0xf349('0x19')](0x194);}return _0x11dc06;};}function handleError(_0x142d95,_0x222e95){_0x222e95=_0x222e95||0x1f4;return function(_0x3da7b7){logger[_0xf349('0x26')](_0x3da7b7[_0xf349('0x27')]);if(_0x3da7b7[_0xf349('0x28')]){delete _0x3da7b7[_0xf349('0x28')];}_0x142d95[_0xf349('0x1b')](_0x222e95)[_0xf349('0x29')](_0x3da7b7);};}exports[_0xf349('0x2a')]=function(_0x53aa55,_0x58e542){var _0x554bc4={},_0x4f2ae2={},_0x38d1e5={'count':0x0,'rows':[]};var _0x4938fa=_[_0xf349('0x2b')](db['SquareMessage']['rawAttributes'],function(_0x5291ab){return{'name':_0x5291ab['fieldName'],'type':_0x5291ab[_0xf349('0x2c')][_0xf349('0x2d')]};});_0x4f2ae2[_0xf349('0x2e')]=_[_0xf349('0x2b')](_0x4938fa,_0xf349('0x28'));_0x4f2ae2['query']=_['keys'](_0x53aa55[_0xf349('0x2f')]);_0x4f2ae2[_0xf349('0x30')]=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],_0x4f2ae2[_0xf349('0x2f')]);_0x554bc4['attributes']=_[_0xf349('0x31')](_0x4f2ae2[_0xf349('0x2e')],qs['fields'](_0x53aa55['query']['fields']));_0x554bc4[_0xf349('0x32')]=_0x554bc4[_0xf349('0x32')][_0xf349('0x33')]?_0x554bc4['attributes']:_0x4f2ae2[_0xf349('0x2e')];if(!_0x53aa55[_0xf349('0x2f')][_0xf349('0x34')](_0xf349('0x35'))){_0x554bc4[_0xf349('0x1e')]=qs['limit'](_0x53aa55[_0xf349('0x2f')]['limit']);_0x554bc4[_0xf349('0x1c')]=qs[_0xf349('0x1c')](_0x53aa55[_0xf349('0x2f')][_0xf349('0x1c')]);}_0x554bc4[_0xf349('0x36')]=qs[_0xf349('0x37')](_0x53aa55[_0xf349('0x2f')]['sort']);_0x554bc4['where']=qs['filters'](_[_0xf349('0x38')](_0x53aa55[_0xf349('0x2f')],_0x4f2ae2['filters']),_0x4938fa);if(_0x53aa55[_0xf349('0x2f')][_0xf349('0x39')]){_0x554bc4['where']=_[_0xf349('0x3a')](_0x554bc4[_0xf349('0x3b')],{'$or':_[_0xf349('0x2b')](_0x4938fa,function(_0x353b95){if(_0x353b95[_0xf349('0x2c')]!==_0xf349('0x3c')){var _0x5ec1c9={};_0x5ec1c9[_0x353b95[_0xf349('0x28')]]={'$like':'%'+_0x53aa55['query']['filter']+'%'};return _0x5ec1c9;}})});}_0x554bc4=_[_0xf349('0x3a')]({},_0x554bc4,_0x53aa55[_0xf349('0x3d')]);var _0x325279={'where':_0x554bc4[_0xf349('0x3b')]};return db['SquareMessage'][_0xf349('0x1f')](_0x325279)[_0xf349('0x24')](function(_0x562ac1){_0x38d1e5[_0xf349('0x1f')]=_0x562ac1;if(_0x53aa55['query']['includeAll']){_0x554bc4[_0xf349('0x3e')]=[{'all':!![]}];}return db['SquareMessage'][_0xf349('0x3f')](_0x554bc4);})['then'](function(_0x31c434){_0x38d1e5[_0xf349('0x40')]=_0x31c434;return _0x38d1e5;})['then'](respondWithFilteredResult(_0x58e542,_0x554bc4))[_0xf349('0x41')](handleError(_0x58e542,null));};exports[_0xf349('0x42')]=function(_0x1e6437,_0x491621){var _0x336dcb={'raw':!![],'where':{'id':_0x1e6437[_0xf349('0x43')]['id']}},_0x478069={};_0x478069['model']=_[_0xf349('0x44')](db[_0xf349('0x45')][_0xf349('0x46')]);_0x478069[_0xf349('0x2f')]=_[_0xf349('0x44')](_0x1e6437[_0xf349('0x2f')]);_0x478069['filters']=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],_0x478069['query']);_0x336dcb[_0xf349('0x32')]=_[_0xf349('0x31')](_0x478069[_0xf349('0x2e')],qs[_0xf349('0x47')](_0x1e6437[_0xf349('0x2f')]['fields']));_0x336dcb[_0xf349('0x32')]=_0x336dcb[_0xf349('0x32')][_0xf349('0x33')]?_0x336dcb[_0xf349('0x32')]:_0x478069[_0xf349('0x2e')];if(_0x1e6437[_0xf349('0x2f')]['includeAll']){_0x336dcb['include']=[{'all':!![]}];}_0x336dcb=_['merge']({},_0x336dcb,_0x1e6437[_0xf349('0x3d')]);return db[_0xf349('0x45')][_0xf349('0x48')](_0x336dcb)[_0xf349('0x24')](handleEntityNotFound(_0x491621,null))[_0xf349('0x24')](respondWithResult(_0x491621,null))[_0xf349('0x41')](handleError(_0x491621,null));};exports[_0xf349('0x49')]=function(_0x2f54ae,_0x29b1b2){return db[_0xf349('0x45')]['create'](_0x2f54ae['body'],{})[_0xf349('0x24')](respondWithResult(_0x29b1b2,0xc9))['catch'](handleError(_0x29b1b2,null));};exports[_0xf349('0x4a')]=function(_0x1ad99a,_0x435193){if(_0x1ad99a[_0xf349('0x4b')]['id']){delete _0x1ad99a['body']['id'];}return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1ad99a[_0xf349('0x43')]['id']}})[_0xf349('0x24')](handleEntityNotFound(_0x435193,null))[_0xf349('0x24')](saveUpdates(_0x1ad99a[_0xf349('0x4b')],null))[_0xf349('0x24')](respondWithResult(_0x435193,null))[_0xf349('0x41')](handleError(_0x435193,null));};exports['destroy']=function(_0x1933d1,_0xb3dbea){return db[_0xf349('0x45')][_0xf349('0x48')]({'where':{'id':_0x1933d1[_0xf349('0x43')]['id']}})['then'](handleEntityNotFound(_0xb3dbea,null))[_0xf349('0x24')](removeEntity(_0xb3dbea,null))[_0xf349('0x41')](handleError(_0xb3dbea,null));}; \ No newline at end of file +var _0x2c64=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','map','SquareMessage','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','include','rows','show','params','includeAll','merge','find','catch','create','body','eml-format'];(function(_0x89249b,_0x31d43b){var _0x2f25a3=function(_0xeab8ae){while(--_0xeab8ae){_0x89249b['push'](_0x89249b['shift']());}};_0x2f25a3(++_0x31d43b);}(_0x2c64,0x1bb));var _0x42c6=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x2c64[_0x4ab3fb];return _0x34fe1e;};'use strict';var emlformat=require(_0x42c6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42c6('0x1'));var rp=require(_0x42c6('0x2'));var moment=require('moment');var BPromise=require(_0x42c6('0x3'));var Mustache=require(_0x42c6('0x4'));var util=require(_0x42c6('0x5'));var path=require(_0x42c6('0x6'));var sox=require(_0x42c6('0x7'));var csv=require(_0x42c6('0x8'));var ejs=require(_0x42c6('0x9'));var fs=require('fs');var fs_extra=require(_0x42c6('0xa'));var _=require(_0x42c6('0xb'));var squel=require(_0x42c6('0xc'));var crypto=require(_0x42c6('0xd'));var jsforce=require(_0x42c6('0xe'));var deskjs=require(_0x42c6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x42c6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x42c6('0x11'));var qs=require(_0x42c6('0x12'));var as=require(_0x42c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x42c6('0x14'))(_0x42c6('0x15'));var utils=require(_0x42c6('0x16'));var config=require(_0x42c6('0x17'));var licenseUtil=require(_0x42c6('0x18'));var db=require(_0x42c6('0x19'))['db'];function respondWithStatusCode(_0x1a4c74,_0x16a9ac){_0x16a9ac=_0x16a9ac||0xcc;return function(_0x8867e5){if(_0x8867e5){return _0x1a4c74[_0x42c6('0x1a')](_0x16a9ac);}return _0x1a4c74[_0x42c6('0x1b')](_0x16a9ac)[_0x42c6('0x1c')]();};}function respondWithResult(_0x12666a,_0x20cbca){_0x20cbca=_0x20cbca||0xc8;return function(_0x1d6ddf){if(_0x1d6ddf){return _0x12666a[_0x42c6('0x1b')](_0x20cbca)[_0x42c6('0x1d')](_0x1d6ddf);}};}function respondWithFilteredResult(_0x1d458e,_0x354abc){return function(_0x16358b){if(_0x16358b){var _0x5bf801=typeof _0x354abc[_0x42c6('0x1e')]===_0x42c6('0x1f')&&typeof _0x354abc['limit']===_0x42c6('0x1f');var _0x1f63d1=_0x16358b[_0x42c6('0x20')];var _0x469576=_0x5bf801?0x0:_0x354abc['offset'];var _0x48a0c5=_0x5bf801?_0x16358b[_0x42c6('0x20')]:_0x354abc[_0x42c6('0x1e')]+_0x354abc[_0x42c6('0x21')];var _0x24d66d;if(_0x48a0c5>=_0x1f63d1){_0x48a0c5=_0x1f63d1;_0x24d66d=0xc8;}else{_0x24d66d=0xce;}_0x1d458e[_0x42c6('0x1b')](_0x24d66d);return _0x1d458e['set'](_0x42c6('0x22'),_0x469576+'-'+_0x48a0c5+'/'+_0x1f63d1)[_0x42c6('0x1d')](_0x16358b);}return null;};}function patchUpdates(_0x2a22be){return function(_0x2de44d){try{jsonpatch['apply'](_0x2de44d,_0x2a22be,!![]);}catch(_0x4d6195){return BPromise[_0x42c6('0x23')](_0x4d6195);}return _0x2de44d[_0x42c6('0x24')]();};}function saveUpdates(_0x3503bf,_0x3bae07){return function(_0x233676){if(_0x233676){return _0x233676[_0x42c6('0x25')](_0x3503bf)[_0x42c6('0x26')](function(_0x458db7){return _0x458db7;});}return null;};}function removeEntity(_0x456648,_0x93f01d){return function(_0x3ba420){if(_0x3ba420){return _0x3ba420[_0x42c6('0x27')]()['then'](function(){_0x456648[_0x42c6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x370260,_0xed9749){return function(_0xe943d7){if(!_0xe943d7){_0x370260[_0x42c6('0x1a')](0x194);}return _0xe943d7;};}function handleError(_0xc1e64b,_0x3f7bf2){_0x3f7bf2=_0x3f7bf2||0x1f4;return function(_0x2110f0){logger['error'](_0x2110f0[_0x42c6('0x28')]);if(_0x2110f0['name']){delete _0x2110f0[_0x42c6('0x29')];}_0xc1e64b[_0x42c6('0x1b')](_0x3f7bf2)[_0x42c6('0x2a')](_0x2110f0);};}exports['index']=function(_0x2bc4bb,_0x5124b6){var _0x140cf5={},_0x3677e1={},_0x35eee9={'count':0x0,'rows':[]};var _0x2c6bfd=_[_0x42c6('0x2b')](db[_0x42c6('0x2c')]['rawAttributes'],function(_0x4bb8b6){return{'name':_0x4bb8b6[_0x42c6('0x2d')],'type':_0x4bb8b6[_0x42c6('0x2e')][_0x42c6('0x2f')]};});_0x3677e1[_0x42c6('0x30')]=_[_0x42c6('0x2b')](_0x2c6bfd,'name');_0x3677e1[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x2bc4bb[_0x42c6('0x31')]);_0x3677e1[_0x42c6('0x33')]=_['intersection'](_0x3677e1[_0x42c6('0x30')],_0x3677e1['query']);_0x140cf5[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x3677e1[_0x42c6('0x30')],qs[_0x42c6('0x36')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x36')]));_0x140cf5[_0x42c6('0x34')]=_0x140cf5[_0x42c6('0x34')][_0x42c6('0x37')]?_0x140cf5[_0x42c6('0x34')]:_0x3677e1['model'];if(!_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x38')](_0x42c6('0x39'))){_0x140cf5['limit']=qs[_0x42c6('0x21')](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x21')]);_0x140cf5[_0x42c6('0x1e')]=qs['offset'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x1e')]);}_0x140cf5[_0x42c6('0x3a')]=qs['sort'](_0x2bc4bb[_0x42c6('0x31')][_0x42c6('0x3b')]);_0x140cf5[_0x42c6('0x3c')]=qs[_0x42c6('0x33')](_[_0x42c6('0x3d')](_0x2bc4bb[_0x42c6('0x31')],_0x3677e1['filters']),_0x2c6bfd);if(_0x2bc4bb[_0x42c6('0x31')]['filter']){_0x140cf5['where']=_['merge'](_0x140cf5[_0x42c6('0x3c')],{'$or':_['map'](_0x2c6bfd,function(_0x4485c2){if(_0x4485c2['type']!==_0x42c6('0x3e')){var _0x565a22={};_0x565a22[_0x4485c2['name']]={'$like':'%'+_0x2bc4bb['query'][_0x42c6('0x3f')]+'%'};return _0x565a22;}})});}_0x140cf5=_['merge']({},_0x140cf5,_0x2bc4bb['options']);var _0x54032d={'where':_0x140cf5['where']};return db[_0x42c6('0x2c')][_0x42c6('0x20')](_0x54032d)[_0x42c6('0x26')](function(_0x1a328b){_0x35eee9[_0x42c6('0x20')]=_0x1a328b;if(_0x2bc4bb[_0x42c6('0x31')]['includeAll']){_0x140cf5[_0x42c6('0x40')]=[{'all':!![]}];}return db[_0x42c6('0x2c')]['findAll'](_0x140cf5);})[_0x42c6('0x26')](function(_0x4dda02){_0x35eee9[_0x42c6('0x41')]=_0x4dda02;return _0x35eee9;})['then'](respondWithFilteredResult(_0x5124b6,_0x140cf5))['catch'](handleError(_0x5124b6,null));};exports[_0x42c6('0x42')]=function(_0x27a8b9,_0x4eefec){var _0xc9a6b6={'raw':!![],'where':{'id':_0x27a8b9[_0x42c6('0x43')]['id']}},_0x55c29b={};_0x55c29b[_0x42c6('0x30')]=_[_0x42c6('0x32')](db['SquareMessage']['rawAttributes']);_0x55c29b[_0x42c6('0x31')]=_[_0x42c6('0x32')](_0x27a8b9[_0x42c6('0x31')]);_0x55c29b[_0x42c6('0x33')]=_[_0x42c6('0x35')](_0x55c29b[_0x42c6('0x30')],_0x55c29b[_0x42c6('0x31')]);_0xc9a6b6[_0x42c6('0x34')]=_[_0x42c6('0x35')](_0x55c29b['model'],qs[_0x42c6('0x36')](_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x36')]));_0xc9a6b6[_0x42c6('0x34')]=_0xc9a6b6[_0x42c6('0x34')][_0x42c6('0x37')]?_0xc9a6b6[_0x42c6('0x34')]:_0x55c29b[_0x42c6('0x30')];if(_0x27a8b9[_0x42c6('0x31')][_0x42c6('0x44')]){_0xc9a6b6['include']=[{'all':!![]}];}_0xc9a6b6=_[_0x42c6('0x45')]({},_0xc9a6b6,_0x27a8b9['options']);return db[_0x42c6('0x2c')][_0x42c6('0x46')](_0xc9a6b6)[_0x42c6('0x26')](handleEntityNotFound(_0x4eefec,null))[_0x42c6('0x26')](respondWithResult(_0x4eefec,null))[_0x42c6('0x47')](handleError(_0x4eefec,null));};exports[_0x42c6('0x48')]=function(_0x544836,_0x4e5539){return db[_0x42c6('0x2c')][_0x42c6('0x48')](_0x544836[_0x42c6('0x49')],{})[_0x42c6('0x26')](respondWithResult(_0x4e5539,0xc9))['catch'](handleError(_0x4e5539,null));};exports[_0x42c6('0x25')]=function(_0x5c5e01,_0x43bf6d){if(_0x5c5e01[_0x42c6('0x49')]['id']){delete _0x5c5e01[_0x42c6('0x49')]['id'];}return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x5c5e01[_0x42c6('0x43')]['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x43bf6d,null))['then'](saveUpdates(_0x5c5e01[_0x42c6('0x49')],null))[_0x42c6('0x26')](respondWithResult(_0x43bf6d,null))['catch'](handleError(_0x43bf6d,null));};exports[_0x42c6('0x27')]=function(_0x226507,_0x47e533){return db[_0x42c6('0x2c')][_0x42c6('0x46')]({'where':{'id':_0x226507['params']['id']}})[_0x42c6('0x26')](handleEntityNotFound(_0x47e533,null))[_0x42c6('0x26')](removeEntity(_0x47e533,null))['catch'](handleError(_0x47e533,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b76843e..354220c 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 _0xa817=['../../config/logger','moment','bluebird','request-promise','path','./squareMessage.attributes','exports','square_messages','lodash','util'];(function(_0x4b1bb4,_0x1438dc){var _0x651b4d=function(_0x439c84){while(--_0x439c84){_0x4b1bb4['push'](_0x4b1bb4['shift']());}};_0x651b4d(++_0x1438dc);}(_0xa817,0x166));var _0x7a81=function(_0x2e710c,_0x6c1e75){_0x2e710c=_0x2e710c-0x0;var _0x3aa411=_0xa817[_0x2e710c];return _0x3aa411;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var logger=require(_0x7a81('0x2'))('api');var moment=require(_0x7a81('0x3'));var BPromise=require(_0x7a81('0x4'));var rp=require(_0x7a81('0x5'));var fs=require('fs');var path=require(_0x7a81('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a81('0x7'));module[_0x7a81('0x8')]=function(_0x221aa2,_0x20a372){return _0x221aa2['define']('SquareMessage',attributes,{'tableName':_0x7a81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb29=['bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','util','../../config/logger','api'];(function(_0x55332a,_0x53ee5e){var _0x3e37f6=function(_0x1f3736){while(--_0x1f3736){_0x55332a['push'](_0x55332a['shift']());}};_0x3e37f6(++_0x53ee5e);}(_0xdb29,0x1ea));var _0x9db2=function(_0x3b642d,_0x387a81){_0x3b642d=_0x3b642d-0x0;var _0x3e2252=_0xdb29[_0x3b642d];return _0x3e2252;};'use strict';var _=require(_0x9db2('0x0'));var util=require(_0x9db2('0x1'));var logger=require(_0x9db2('0x2'))(_0x9db2('0x3'));var moment=require('moment');var BPromise=require(_0x9db2('0x4'));var rp=require(_0x9db2('0x5'));var fs=require('fs');var path=require(_0x9db2('0x6'));var rimraf=require(_0x9db2('0x7'));var config=require(_0x9db2('0x8'));var attributes=require(_0x9db2('0x9'));module[_0x9db2('0xa')]=function(_0x294e74,_0x43aff1){return _0x294e74['define'](_0x9db2('0xb'),attributes,{'tableName':_0x9db2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index c170b45..b07235c 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 _0x14b0=['CreateSquareMessage','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage','create','body','options','raw'];(function(_0x3c16d8,_0x503c7c){var _0x3099c7=function(_0x330cb1){while(--_0x330cb1){_0x3c16d8['push'](_0x3c16d8['shift']());}};_0x3099c7(++_0x503c7c);}(_0x14b0,0x1ef));var _0x014b=function(_0x31f69d,_0xc0cf32){_0x31f69d=_0x31f69d-0x0;var _0x1e9a4e=_0x14b0[_0x31f69d];return _0x1e9a4e;};'use strict';var _=require(_0x014b('0x0'));var util=require(_0x014b('0x1'));var moment=require(_0x014b('0x2'));var BPromise=require(_0x014b('0x3'));var rs=require(_0x014b('0x4'));var fs=require('fs');var Redis=require(_0x014b('0x5'));var db=require(_0x014b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x014b('0x7'))('rpc');var config=require(_0x014b('0x8'));var jayson=require(_0x014b('0x9'));var client=jayson[_0x014b('0xa')][_0x014b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18347d,_0x35a0a7,_0x22a4ad){return new BPromise(function(_0x7ffa26,_0x479062){return client['request'](_0x18347d,_0x22a4ad)[_0x014b('0xc')](function(_0x4e9115){logger[_0x014b('0xd')](_0x014b('0xe'),_0x35a0a7,_0x014b('0xf'));logger[_0x014b('0x10')](_0x014b('0x11'),_0x35a0a7,_0x014b('0xf'),JSON[_0x014b('0x12')](_0x4e9115));if(_0x4e9115[_0x014b('0x13')]){if(_0x4e9115['error'][_0x014b('0x14')]===0x1f4){logger[_0x014b('0x13')](_0x014b('0xe'),_0x35a0a7,_0x4e9115[_0x014b('0x13')][_0x014b('0x15')]);return _0x479062(_0x4e9115['error']['message']);}logger['error'](_0x014b('0xe'),_0x35a0a7,_0x4e9115['error'][_0x014b('0x15')]);return _0x7ffa26(_0x4e9115['error'][_0x014b('0x15')]);}else{logger[_0x014b('0xd')](_0x014b('0xe'),_0x35a0a7,_0x014b('0xf'));_0x7ffa26(_0x4e9115['result']['message']);}})['catch'](function(_0x352d08){logger['error'](_0x014b('0xe'),_0x35a0a7,_0x352d08);_0x479062(_0x352d08);});});}exports['CreateSquareMessage']=function(_0x2cda5d){var _0x34422e=this;return new Promise(function(_0x222c97,_0x207d18){return db[_0x014b('0x16')][_0x014b('0x17')](_0x2cda5d[_0x014b('0x18')],{'raw':_0x2cda5d[_0x014b('0x19')]?_0x2cda5d[_0x014b('0x19')][_0x014b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5b6c3d){logger[_0x014b('0xd')](_0x014b('0x1b'),_0x2cda5d);logger['debug'](_0x014b('0x1b'),_0x2cda5d,JSON['stringify'](_0x5b6c3d));_0x222c97(_0x5b6c3d);})[_0x014b('0x1c')](function(_0x1418a5){logger['error']('CreateSquareMessage',_0x1418a5[_0x014b('0x15')],_0x2cda5d);_0x207d18(_0x34422e[_0x014b('0x13')](0x1f4,_0x1418a5[_0x014b('0x15')]));});});}; \ No newline at end of file +var _0x9809=['SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateSquareMessage','create','body','options','raw','debug','util','randomstring','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1b1173,_0x5d793f){var _0x366eed=function(_0x519a9d){while(--_0x519a9d){_0x1b1173['push'](_0x1b1173['shift']());}};_0x366eed(++_0x5d793f);}(_0x9809,0x171));var _0x9980=function(_0x2696b7,_0x571d0d){_0x2696b7=_0x2696b7-0x0;var _0x37ebee=_0x9809[_0x2696b7];return _0x37ebee;};'use strict';var _=require('lodash');var util=require(_0x9980('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9980('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9980('0x2'))(_0x9980('0x3'));var config=require(_0x9980('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9980('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3728ad,_0x4d91d3,_0x39d0f0){return new BPromise(function(_0x5e9ea5,_0x4fa6f9){return client[_0x9980('0x6')](_0x3728ad,_0x39d0f0)[_0x9980('0x7')](function(_0x196d2f){logger[_0x9980('0x8')](_0x9980('0x9'),_0x4d91d3,_0x9980('0xa'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4d91d3,'request\x20sent',JSON[_0x9980('0xb')](_0x196d2f));if(_0x196d2f[_0x9980('0xc')]){if(_0x196d2f['error']['code']===0x1f4){logger[_0x9980('0xc')](_0x9980('0x9'),_0x4d91d3,_0x196d2f[_0x9980('0xc')]['message']);return _0x4fa6f9(_0x196d2f[_0x9980('0xc')][_0x9980('0xd')]);}logger[_0x9980('0xc')]('SquareMessage,\x20%s,\x20%s',_0x4d91d3,_0x196d2f[_0x9980('0xc')][_0x9980('0xd')]);return _0x5e9ea5(_0x196d2f[_0x9980('0xc')][_0x9980('0xd')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x4d91d3,'request\x20sent');_0x5e9ea5(_0x196d2f['result'][_0x9980('0xd')]);}})[_0x9980('0xe')](function(_0xedd2f1){logger['error'](_0x9980('0x9'),_0x4d91d3,_0xedd2f1);_0x4fa6f9(_0xedd2f1);});});}exports[_0x9980('0xf')]=function(_0x4f63f4){var _0x31b39c=this;return new Promise(function(_0xee43e1,_0x23390b){return db['SquareMessage'][_0x9980('0x10')](_0x4f63f4[_0x9980('0x11')],{'raw':_0x4f63f4[_0x9980('0x12')]?_0x4f63f4['options'][_0x9980('0x13')]===undefined?!![]:![]:!![]})[_0x9980('0x7')](function(_0x55c021){logger['info']('CreateSquareMessage',_0x4f63f4);logger[_0x9980('0x14')](_0x9980('0xf'),_0x4f63f4,JSON[_0x9980('0xb')](_0x55c021));_0xee43e1(_0x55c021);})[_0x9980('0xe')](function(_0x5560ab){logger['error'](_0x9980('0xf'),_0x5560ab['message'],_0x4f63f4);_0x23390b(_0x31b39c['error'](0x1f4,_0x5560ab[_0x9980('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 595505b..ca38bda 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 _0x0a1b=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','post','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24f862,_0x4b645a){var _0x198aa4=function(_0x131195){while(--_0x131195){_0x24f862['push'](_0x24f862['shift']());}};_0x198aa4(++_0x4b645a);}(_0x0a1b,0x173));var _0xb0a1=function(_0x158542,_0x48158a){_0x158542=_0x158542-0x0;var _0x394a6f=_0x0a1b[_0x158542];return _0x394a6f;};'use strict';var multer=require(_0xb0a1('0x0'));var util=require(_0xb0a1('0x1'));var path=require(_0xb0a1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0a1('0x3')]();var fs_extra=require(_0xb0a1('0x4'));var auth=require(_0xb0a1('0x5'));var interaction=require(_0xb0a1('0x6'));var config=require(_0xb0a1('0x7'));var controller=require(_0xb0a1('0x8'));router[_0xb0a1('0x9')]('/',auth[_0xb0a1('0xa')](),controller[_0xb0a1('0xb')]);router[_0xb0a1('0x9')](_0xb0a1('0xc'),auth[_0xb0a1('0xa')](),controller['show']);router[_0xb0a1('0x9')](_0xb0a1('0xd'),auth[_0xb0a1('0xa')](),timeout(_0xb0a1('0xe')),controller['test']);router[_0xb0a1('0xf')]('/',auth[_0xb0a1('0xa')](),controller['create']);router[_0xb0a1('0x10')](_0xb0a1('0xc'),auth[_0xb0a1('0xa')](),controller[_0xb0a1('0x11')]);router[_0xb0a1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xb0a1('0x13')]);module[_0xb0a1('0x14')]=router; \ No newline at end of file +var _0x3352=['get','isAuthenticated','index','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x105559,_0xed36fe){var _0x1f2e16=function(_0x1bc6bf){while(--_0x1bc6bf){_0x105559['push'](_0x105559['shift']());}};_0x1f2e16(++_0xed36fe);}(_0x3352,0x15f));var _0x2335=function(_0x233e09,_0x3c965b){_0x233e09=_0x233e09-0x0;var _0x33baba=_0x3352[_0x233e09];return _0x33baba;};'use strict';var multer=require(_0x2335('0x0'));var util=require(_0x2335('0x1'));var path=require(_0x2335('0x2'));var timeout=require(_0x2335('0x3'));var express=require(_0x2335('0x4'));var router=express['Router']();var fs_extra=require(_0x2335('0x5'));var auth=require(_0x2335('0x6'));var interaction=require(_0x2335('0x7'));var config=require(_0x2335('0x8'));var controller=require('./squareOdbc.controller');router[_0x2335('0x9')]('/',auth[_0x2335('0xa')](),controller[_0x2335('0xb')]);router[_0x2335('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2335('0x9')]('/:id/test',auth[_0x2335('0xa')](),timeout('15s'),controller['test']);router['post']('/',auth[_0x2335('0xa')](),controller['create']);router[_0x2335('0xc')](_0x2335('0xd'),auth[_0x2335('0xa')](),controller[_0x2335('0xe')]);router[_0x2335('0xf')](_0x2335('0xd'),auth[_0x2335('0xa')](),controller[_0x2335('0x10')]);module[_0x2335('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index d5ec75a..f9f2adb 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 _0x629e=['exports','STRING','name'];(function(_0x152cb8,_0x4fdbab){var _0xdecd95=function(_0x320677){while(--_0x320677){_0x152cb8['push'](_0x152cb8['shift']());}};_0xdecd95(++_0x4fdbab);}(_0x629e,0x14a));var _0xe629=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x629e[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0xe629('0x0')]={'name':{'type':Sequelize[_0xe629('0x1')],'unique':_0xe629('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe629('0x1')]}}; \ No newline at end of file +var _0x6741=['sequelize','exports','STRING','name'];(function(_0x58b5b0,_0x599f81){var _0x1463ab=function(_0x2f29d7){while(--_0x2f29d7){_0x58b5b0['push'](_0x58b5b0['shift']());}};_0x1463ab(++_0x599f81);}(_0x6741,0x1e0));var _0x1674=function(_0xa09bf7,_0x1c89bd){_0xa09bf7=_0xa09bf7-0x0;var _0x239c58=_0x6741[_0xa09bf7];return _0x239c58;};'use strict';var Sequelize=require(_0x1674('0x0'));module[_0x1674('0x1')]={'name':{'type':Sequelize[_0x1674('0x2')],'unique':_0x1674('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1674('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index c5881da..8f781d4 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 _0xdb18=['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','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','get','ODBC','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','update','test','odbc','openSync','dsn','closeSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x8353ea,_0x3d6549){var _0x114db6=function(_0x2333f0){while(--_0x2333f0){_0x8353ea['push'](_0x8353ea['shift']());}};_0x114db6(++_0x3d6549);}(_0xdb18,0xfa));var _0x8db1=function(_0x9570e2,_0x89ed20){_0x9570e2=_0x9570e2-0x0;var _0x24d8bd=_0xdb18[_0x9570e2];return _0x24d8bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8db1('0x0'));var zipdir=require(_0x8db1('0x1'));var jsonpatch=require(_0x8db1('0x2'));var rp=require(_0x8db1('0x3'));var moment=require(_0x8db1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8db1('0x5'));var util=require(_0x8db1('0x6'));var path=require(_0x8db1('0x7'));var sox=require(_0x8db1('0x8'));var csv=require(_0x8db1('0x9'));var ejs=require(_0x8db1('0xa'));var fs=require('fs');var fs_extra=require(_0x8db1('0xb'));var _=require(_0x8db1('0xc'));var squel=require('squel');var crypto=require(_0x8db1('0xd'));var jsforce=require(_0x8db1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8db1('0x9'));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(_0x8db1('0x14'));var logger=require(_0x8db1('0x15'))(_0x8db1('0x16'));var utils=require('../../config/utils');var config=require(_0x8db1('0x17'));var licenseUtil=require(_0x8db1('0x18'));var db=require(_0x8db1('0x19'))['db'];function respondWithStatusCode(_0x2131f6,_0x1b6113){_0x1b6113=_0x1b6113||0xcc;return function(_0x3e25d4){if(_0x3e25d4){return _0x2131f6[_0x8db1('0x1a')](_0x1b6113);}return _0x2131f6['status'](_0x1b6113)[_0x8db1('0x1b')]();};}function respondWithResult(_0x4ddd2f,_0x3fb857){_0x3fb857=_0x3fb857||0xc8;return function(_0x3588b6){if(_0x3588b6){return _0x4ddd2f[_0x8db1('0x1c')](_0x3fb857)[_0x8db1('0x1d')](_0x3588b6);}};}function respondWithFilteredResult(_0x13e01c,_0x26ce94){return function(_0x22369b){if(_0x22369b){var _0x466ddd=typeof _0x26ce94[_0x8db1('0x1e')]===_0x8db1('0x1f')&&typeof _0x26ce94[_0x8db1('0x20')]==='undefined';var _0x4e7c57=_0x22369b['count'];var _0x26ab7b=_0x466ddd?0x0:_0x26ce94['offset'];var _0x540854=_0x466ddd?_0x22369b[_0x8db1('0x21')]:_0x26ce94[_0x8db1('0x1e')]+_0x26ce94[_0x8db1('0x20')];var _0x1289f1;if(_0x540854>=_0x4e7c57){_0x540854=_0x4e7c57;_0x1289f1=0xc8;}else{_0x1289f1=0xce;}_0x13e01c[_0x8db1('0x1c')](_0x1289f1);return _0x13e01c[_0x8db1('0x22')](_0x8db1('0x23'),_0x26ab7b+'-'+_0x540854+'/'+_0x4e7c57)['json'](_0x22369b);}return null;};}function patchUpdates(_0x4552b2){return function(_0x1e2849){try{jsonpatch[_0x8db1('0x24')](_0x1e2849,_0x4552b2,!![]);}catch(_0x42def9){return BPromise['reject'](_0x42def9);}return _0x1e2849['save']();};}function saveUpdates(_0x1bb2d1,_0x3739c0){return function(_0x5b674f){if(_0x5b674f){return _0x5b674f['update'](_0x1bb2d1)['then'](function(_0x42e46c){return _0x42e46c;});}return null;};}function removeEntity(_0x1fe832,_0x282fb5){return function(_0x5e75b0){if(_0x5e75b0){return _0x5e75b0[_0x8db1('0x25')]()[_0x8db1('0x26')](function(){var _0x426d7e=_0x5e75b0[_0x8db1('0x27')]({'plain':!![]});var _0x992f8d=_0x8db1('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x992f8d,'resourceId':_0x426d7e['id']}})[_0x8db1('0x26')](function(){return _0x5e75b0;});})[_0x8db1('0x26')](function(){_0x1fe832['status'](0xcc)[_0x8db1('0x1b')]();});}};}function handleEntityNotFound(_0x6fdd7a,_0x4fbd81){return function(_0x42ce59){if(!_0x42ce59){_0x6fdd7a[_0x8db1('0x1a')](0x194);}return _0x42ce59;};}function handleError(_0x1e5dd9,_0x3361e1){_0x3361e1=_0x3361e1||0x1f4;return function(_0x4a8009){logger[_0x8db1('0x29')](_0x4a8009['stack']);if(_0x4a8009[_0x8db1('0x2a')]){delete _0x4a8009[_0x8db1('0x2a')];}_0x1e5dd9[_0x8db1('0x1c')](_0x3361e1)[_0x8db1('0x2b')](_0x4a8009);};}exports[_0x8db1('0x2c')]=function(_0x547e37,_0x1810af){var _0xfca0ad={},_0x5af575={},_0x4657bb={'count':0x0,'rows':[]};var _0xd4a678=_[_0x8db1('0x2d')](db[_0x8db1('0x2e')][_0x8db1('0x2f')],function(_0x928cd7){return{'name':_0x928cd7['fieldName'],'type':_0x928cd7[_0x8db1('0x30')][_0x8db1('0x31')]};});_0x5af575[_0x8db1('0x32')]=_[_0x8db1('0x2d')](_0xd4a678,'name');_0x5af575[_0x8db1('0x33')]=_['keys'](_0x547e37[_0x8db1('0x33')]);_0x5af575[_0x8db1('0x34')]=_['intersection'](_0x5af575[_0x8db1('0x32')],_0x5af575[_0x8db1('0x33')]);_0xfca0ad[_0x8db1('0x35')]=_[_0x8db1('0x36')](_0x5af575['model'],qs[_0x8db1('0x37')](_0x547e37[_0x8db1('0x33')][_0x8db1('0x37')]));_0xfca0ad[_0x8db1('0x35')]=_0xfca0ad[_0x8db1('0x35')][_0x8db1('0x38')]?_0xfca0ad[_0x8db1('0x35')]:_0x5af575[_0x8db1('0x32')];if(!_0x547e37['query'][_0x8db1('0x39')](_0x8db1('0x3a'))){_0xfca0ad['limit']=qs[_0x8db1('0x20')](_0x547e37[_0x8db1('0x33')]['limit']);_0xfca0ad['offset']=qs[_0x8db1('0x1e')](_0x547e37[_0x8db1('0x33')]['offset']);}_0xfca0ad[_0x8db1('0x3b')]=qs[_0x8db1('0x3c')](_0x547e37[_0x8db1('0x33')]['sort']);_0xfca0ad[_0x8db1('0x3d')]=qs[_0x8db1('0x34')](_[_0x8db1('0x3e')](_0x547e37[_0x8db1('0x33')],_0x5af575[_0x8db1('0x34')]),_0xd4a678);if(_0x547e37[_0x8db1('0x33')]['filter']){_0xfca0ad[_0x8db1('0x3d')]=_['merge'](_0xfca0ad['where'],{'$or':_['map'](_0xd4a678,function(_0x540052){if(_0x540052['type']!=='VIRTUAL'){var _0x5381f9={};_0x5381f9[_0x540052['name']]={'$like':'%'+_0x547e37[_0x8db1('0x33')][_0x8db1('0x3f')]+'%'};return _0x5381f9;}})});}_0xfca0ad=_[_0x8db1('0x40')]({},_0xfca0ad,_0x547e37['options']);var _0x16da00={'where':_0xfca0ad['where']};return db[_0x8db1('0x2e')]['count'](_0x16da00)['then'](function(_0x1e89fb){_0x4657bb['count']=_0x1e89fb;if(_0x547e37[_0x8db1('0x33')][_0x8db1('0x41')]){_0xfca0ad[_0x8db1('0x42')]=[{'all':!![]}];}return db[_0x8db1('0x2e')][_0x8db1('0x43')](_0xfca0ad);})[_0x8db1('0x26')](function(_0x249e30){_0x4657bb['rows']=_0x249e30;return _0x4657bb;})['then'](respondWithFilteredResult(_0x1810af,_0xfca0ad))[_0x8db1('0x44')](handleError(_0x1810af,null));};exports[_0x8db1('0x45')]=function(_0x6d06f9,_0x5db11d){var _0x5ddee3={'raw':!![],'where':{'id':_0x6d06f9[_0x8db1('0x46')]['id']}},_0x950cea={};_0x950cea['model']=_[_0x8db1('0x47')](db['SquareOdbc'][_0x8db1('0x2f')]);_0x950cea[_0x8db1('0x33')]=_[_0x8db1('0x47')](_0x6d06f9[_0x8db1('0x33')]);_0x950cea['filters']=_[_0x8db1('0x36')](_0x950cea[_0x8db1('0x32')],_0x950cea[_0x8db1('0x33')]);_0x5ddee3['attributes']=_[_0x8db1('0x36')](_0x950cea[_0x8db1('0x32')],qs[_0x8db1('0x37')](_0x6d06f9[_0x8db1('0x33')][_0x8db1('0x37')]));_0x5ddee3[_0x8db1('0x35')]=_0x5ddee3[_0x8db1('0x35')][_0x8db1('0x38')]?_0x5ddee3[_0x8db1('0x35')]:_0x950cea['model'];if(_0x6d06f9[_0x8db1('0x33')]['includeAll']){_0x5ddee3[_0x8db1('0x42')]=[{'all':!![]}];}_0x5ddee3=_[_0x8db1('0x40')]({},_0x5ddee3,_0x6d06f9[_0x8db1('0x48')]);return db[_0x8db1('0x2e')][_0x8db1('0x49')](_0x5ddee3)[_0x8db1('0x26')](handleEntityNotFound(_0x5db11d,null))[_0x8db1('0x26')](respondWithResult(_0x5db11d,null))[_0x8db1('0x44')](handleError(_0x5db11d,null));};exports[_0x8db1('0x4a')]=function(_0x2f0c0c,_0x539735){return db[_0x8db1('0x2e')][_0x8db1('0x4a')](_0x2f0c0c[_0x8db1('0x4b')],{})[_0x8db1('0x26')](function(_0xff7035){var _0xc1cbad=_0x2f0c0c[_0x8db1('0x4c')]['get']({'plain':!![]});if(!_0xc1cbad)throw new Error(_0x8db1('0x4d'));if(_0xc1cbad[_0x8db1('0x4e')]==='user'){var _0x3f0ce9=_0xff7035[_0x8db1('0x27')]({'plain':!![]});var _0x30b478=_0x8db1('0x28');return db[_0x8db1('0x4f')][_0x8db1('0x49')]({'where':{'name':_0x30b478,'userProfileId':_0xc1cbad['userProfileId']},'raw':!![]})[_0x8db1('0x26')](function(_0x2028de){if(_0x2028de&&_0x2028de[_0x8db1('0x50')]===0x0){return db[_0x8db1('0x51')][_0x8db1('0x4a')]({'name':_0x3f0ce9['name'],'resourceId':_0x3f0ce9['id'],'type':_0x2028de[_0x8db1('0x2a')],'sectionId':_0x2028de['id']},{})['then'](function(){return _0xff7035;});}else{return _0xff7035;}})[_0x8db1('0x44')](function(_0x38f73c){logger[_0x8db1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38f73c);throw _0x38f73c;});}return _0xff7035;})[_0x8db1('0x26')](respondWithResult(_0x539735,0xc9))[_0x8db1('0x44')](handleError(_0x539735,null));};exports[_0x8db1('0x52')]=function(_0x48cee9,_0x50015d){if(_0x48cee9['body']['id']){delete _0x48cee9['body']['id'];}return db[_0x8db1('0x2e')][_0x8db1('0x49')]({'where':{'id':_0x48cee9[_0x8db1('0x46')]['id']}})['then'](handleEntityNotFound(_0x50015d,null))[_0x8db1('0x26')](saveUpdates(_0x48cee9['body'],null))[_0x8db1('0x26')](respondWithResult(_0x50015d,null))[_0x8db1('0x44')](handleError(_0x50015d,null));};exports['destroy']=function(_0x4793bb,_0x151986){return db[_0x8db1('0x2e')][_0x8db1('0x49')]({'where':{'id':_0x4793bb['params']['id']}})['then'](handleEntityNotFound(_0x151986,null))[_0x8db1('0x26')](removeEntity(_0x151986,null))[_0x8db1('0x44')](handleError(_0x151986,null));};exports[_0x8db1('0x53')]=function(_0x35c6dc,_0x55d495,_0x5a56d4){var _0x4b5b5d;return db[_0x8db1('0x2e')][_0x8db1('0x49')]({'where':{'id':_0x35c6dc[_0x8db1('0x46')]['id']},'attributes':['id','dsn']})[_0x8db1('0x26')](handleEntityNotFound(_0x55d495,null))['then'](function(_0x3484ed){if(_0x3484ed){var _0x1ce82c=require(_0x8db1('0x54'))();_0x1ce82c[_0x8db1('0x55')](_0x3484ed[_0x8db1('0x56')]);_0x1ce82c[_0x8db1('0x57')]();return _0x3484ed;}})[_0x8db1('0x26')](respondWithResult(_0x55d495,null))[_0x8db1('0x44')](handleError(_0x55d495,null));}; \ No newline at end of file +var _0x430c=['keys','length','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','status','Content-Range','reject','update','then','destroy','ODBC','UserProfileResource','error','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x430c,0x162));var _0xc430=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x430c[_0x39609a];return _0xecd92;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require(_0xc430('0x1'));var zipdir=require(_0xc430('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc430('0x3'));var BPromise=require(_0xc430('0x4'));var Mustache=require('mustache');var util=require(_0xc430('0x5'));var path=require(_0xc430('0x6'));var sox=require(_0xc430('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc430('0x8'));var squel=require('squel');var crypto=require(_0xc430('0x9'));var jsforce=require(_0xc430('0xa'));var deskjs=require(_0xc430('0xb'));var toCsv=require(_0xc430('0xc'));var querystring=require('querystring');var Papa=require(_0xc430('0xd'));var Redis=require(_0xc430('0xe'));var authService=require(_0xc430('0xf'));var qs=require(_0xc430('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc430('0x11'));var logger=require(_0xc430('0x12'))(_0xc430('0x13'));var utils=require('../../config/utils');var config=require(_0xc430('0x14'));var licenseUtil=require(_0xc430('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8480,_0x3d0f8e){_0x3d0f8e=_0x3d0f8e||0xcc;return function(_0x4ca62c){if(_0x4ca62c){return _0x3a8480[_0xc430('0x16')](_0x3d0f8e);}return _0x3a8480['status'](_0x3d0f8e)['end']();};}function respondWithResult(_0x1546ae,_0x190615){_0x190615=_0x190615||0xc8;return function(_0x5dee9c){if(_0x5dee9c){return _0x1546ae['status'](_0x190615)[_0xc430('0x17')](_0x5dee9c);}};}function respondWithFilteredResult(_0x5d741d,_0x5f38cf){return function(_0x5379d8){if(_0x5379d8){var _0x5c5a1c=typeof _0x5f38cf[_0xc430('0x18')]===_0xc430('0x19')&&typeof _0x5f38cf[_0xc430('0x1a')]==='undefined';var _0x303bdd=_0x5379d8['count'];var _0xb4fb9a=_0x5c5a1c?0x0:_0x5f38cf[_0xc430('0x18')];var _0x1ec6c9=_0x5c5a1c?_0x5379d8['count']:_0x5f38cf['offset']+_0x5f38cf[_0xc430('0x1a')];var _0x1b0ba5;if(_0x1ec6c9>=_0x303bdd){_0x1ec6c9=_0x303bdd;_0x1b0ba5=0xc8;}else{_0x1b0ba5=0xce;}_0x5d741d[_0xc430('0x1b')](_0x1b0ba5);return _0x5d741d['set'](_0xc430('0x1c'),_0xb4fb9a+'-'+_0x1ec6c9+'/'+_0x303bdd)['json'](_0x5379d8);}return null;};}function patchUpdates(_0x3f4bc2){return function(_0xb0b06f){try{jsonpatch['apply'](_0xb0b06f,_0x3f4bc2,!![]);}catch(_0x41255f){return BPromise[_0xc430('0x1d')](_0x41255f);}return _0xb0b06f['save']();};}function saveUpdates(_0x3324d9,_0x28aaba){return function(_0x57a0a9){if(_0x57a0a9){return _0x57a0a9[_0xc430('0x1e')](_0x3324d9)[_0xc430('0x1f')](function(_0x5645fd){return _0x5645fd;});}return null;};}function removeEntity(_0x577623,_0x3f96c9){return function(_0x130805){if(_0x130805){return _0x130805[_0xc430('0x20')]()['then'](function(){var _0x168668=_0x130805['get']({'plain':!![]});var _0x1a30dc=_0xc430('0x21');return db[_0xc430('0x22')][_0xc430('0x20')]({'where':{'type':_0x1a30dc,'resourceId':_0x168668['id']}})['then'](function(){return _0x130805;});})['then'](function(){_0x577623[_0xc430('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37efab,_0x194a55){return function(_0x35bfdd){if(!_0x35bfdd){_0x37efab[_0xc430('0x16')](0x194);}return _0x35bfdd;};}function handleError(_0x26a6f7,_0x1fce66){_0x1fce66=_0x1fce66||0x1f4;return function(_0x52475d){logger[_0xc430('0x23')](_0x52475d[_0xc430('0x24')]);if(_0x52475d['name']){delete _0x52475d[_0xc430('0x25')];}_0x26a6f7[_0xc430('0x1b')](_0x1fce66)[_0xc430('0x26')](_0x52475d);};}exports['index']=function(_0x3aece7,_0x4350c6){var _0x4f7aee={},_0x444c48={},_0x43ecef={'count':0x0,'rows':[]};var _0x5761f7=_[_0xc430('0x27')](db[_0xc430('0x28')][_0xc430('0x29')],function(_0x34df9f){return{'name':_0x34df9f[_0xc430('0x2a')],'type':_0x34df9f[_0xc430('0x2b')][_0xc430('0x2c')]};});_0x444c48['model']=_['map'](_0x5761f7,_0xc430('0x25'));_0x444c48[_0xc430('0x2d')]=_['keys'](_0x3aece7[_0xc430('0x2d')]);_0x444c48[_0xc430('0x2e')]=_[_0xc430('0x2f')](_0x444c48[_0xc430('0x30')],_0x444c48[_0xc430('0x2d')]);_0x4f7aee[_0xc430('0x31')]=_[_0xc430('0x2f')](_0x444c48[_0xc430('0x30')],qs['fields'](_0x3aece7['query'][_0xc430('0x32')]));_0x4f7aee[_0xc430('0x31')]=_0x4f7aee[_0xc430('0x31')]['length']?_0x4f7aee[_0xc430('0x31')]:_0x444c48[_0xc430('0x30')];if(!_0x3aece7[_0xc430('0x2d')][_0xc430('0x33')](_0xc430('0x34'))){_0x4f7aee['limit']=qs['limit'](_0x3aece7['query'][_0xc430('0x1a')]);_0x4f7aee[_0xc430('0x18')]=qs['offset'](_0x3aece7[_0xc430('0x2d')][_0xc430('0x18')]);}_0x4f7aee['order']=qs['sort'](_0x3aece7[_0xc430('0x2d')]['sort']);_0x4f7aee[_0xc430('0x35')]=qs[_0xc430('0x2e')](_[_0xc430('0x36')](_0x3aece7[_0xc430('0x2d')],_0x444c48[_0xc430('0x2e')]),_0x5761f7);if(_0x3aece7[_0xc430('0x2d')][_0xc430('0x37')]){_0x4f7aee[_0xc430('0x35')]=_[_0xc430('0x38')](_0x4f7aee['where'],{'$or':_[_0xc430('0x27')](_0x5761f7,function(_0xb44c41){if(_0xb44c41[_0xc430('0x2b')]!==_0xc430('0x39')){var _0x3c1dad={};_0x3c1dad[_0xb44c41[_0xc430('0x25')]]={'$like':'%'+_0x3aece7['query'][_0xc430('0x37')]+'%'};return _0x3c1dad;}})});}_0x4f7aee=_['merge']({},_0x4f7aee,_0x3aece7[_0xc430('0x3a')]);var _0x2c7879={'where':_0x4f7aee[_0xc430('0x35')]};return db[_0xc430('0x28')][_0xc430('0x3b')](_0x2c7879)['then'](function(_0x4b8cb7){_0x43ecef[_0xc430('0x3b')]=_0x4b8cb7;if(_0x3aece7['query'][_0xc430('0x3c')]){_0x4f7aee['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xc430('0x3d')](_0x4f7aee);})[_0xc430('0x1f')](function(_0x5a51ed){_0x43ecef[_0xc430('0x3e')]=_0x5a51ed;return _0x43ecef;})[_0xc430('0x1f')](respondWithFilteredResult(_0x4350c6,_0x4f7aee))[_0xc430('0x3f')](handleError(_0x4350c6,null));};exports[_0xc430('0x40')]=function(_0x49e770,_0x200c9e){var _0x2597c7={'raw':!![],'where':{'id':_0x49e770[_0xc430('0x41')]['id']}},_0x50490b={};_0x50490b[_0xc430('0x30')]=_[_0xc430('0x42')](db[_0xc430('0x28')][_0xc430('0x29')]);_0x50490b['query']=_[_0xc430('0x42')](_0x49e770[_0xc430('0x2d')]);_0x50490b[_0xc430('0x2e')]=_['intersection'](_0x50490b[_0xc430('0x30')],_0x50490b[_0xc430('0x2d')]);_0x2597c7[_0xc430('0x31')]=_['intersection'](_0x50490b[_0xc430('0x30')],qs[_0xc430('0x32')](_0x49e770[_0xc430('0x2d')][_0xc430('0x32')]));_0x2597c7['attributes']=_0x2597c7[_0xc430('0x31')][_0xc430('0x43')]?_0x2597c7[_0xc430('0x31')]:_0x50490b[_0xc430('0x30')];if(_0x49e770[_0xc430('0x2d')][_0xc430('0x3c')]){_0x2597c7[_0xc430('0x44')]=[{'all':!![]}];}_0x2597c7=_[_0xc430('0x38')]({},_0x2597c7,_0x49e770[_0xc430('0x3a')]);return db[_0xc430('0x28')][_0xc430('0x45')](_0x2597c7)[_0xc430('0x1f')](handleEntityNotFound(_0x200c9e,null))['then'](respondWithResult(_0x200c9e,null))[_0xc430('0x3f')](handleError(_0x200c9e,null));};exports[_0xc430('0x46')]=function(_0x5a1f7e,_0x38ada2){return db[_0xc430('0x28')][_0xc430('0x46')](_0x5a1f7e['body'],{})['then'](function(_0x4e475d){var _0x3c93ac=_0x5a1f7e['user'][_0xc430('0x47')]({'plain':!![]});if(!_0x3c93ac)throw new Error(_0xc430('0x48'));if(_0x3c93ac[_0xc430('0x49')]===_0xc430('0x4a')){var _0x2a127b=_0x4e475d['get']({'plain':!![]});var _0x479338='ODBC';return db[_0xc430('0x4b')][_0xc430('0x45')]({'where':{'name':_0x479338,'userProfileId':_0x3c93ac[_0xc430('0x4c')]},'raw':!![]})[_0xc430('0x1f')](function(_0x528800){if(_0x528800&&_0x528800[_0xc430('0x4d')]===0x0){return db[_0xc430('0x22')][_0xc430('0x46')]({'name':_0x2a127b['name'],'resourceId':_0x2a127b['id'],'type':_0x528800['name'],'sectionId':_0x528800['id']},{})[_0xc430('0x1f')](function(){return _0x4e475d;});}else{return _0x4e475d;}})[_0xc430('0x3f')](function(_0x3bd5e4){logger[_0xc430('0x23')](_0xc430('0x4e'),_0x3bd5e4);throw _0x3bd5e4;});}return _0x4e475d;})['then'](respondWithResult(_0x38ada2,0xc9))[_0xc430('0x3f')](handleError(_0x38ada2,null));};exports[_0xc430('0x1e')]=function(_0x40bc5b,_0x58ca30){if(_0x40bc5b['body']['id']){delete _0x40bc5b[_0xc430('0x4f')]['id'];}return db[_0xc430('0x28')]['find']({'where':{'id':_0x40bc5b[_0xc430('0x41')]['id']}})[_0xc430('0x1f')](handleEntityNotFound(_0x58ca30,null))[_0xc430('0x1f')](saveUpdates(_0x40bc5b[_0xc430('0x4f')],null))[_0xc430('0x1f')](respondWithResult(_0x58ca30,null))[_0xc430('0x3f')](handleError(_0x58ca30,null));};exports[_0xc430('0x20')]=function(_0x4eca72,_0x3e5a5f){return db[_0xc430('0x28')][_0xc430('0x45')]({'where':{'id':_0x4eca72['params']['id']}})[_0xc430('0x1f')](handleEntityNotFound(_0x3e5a5f,null))[_0xc430('0x1f')](removeEntity(_0x3e5a5f,null))[_0xc430('0x3f')](handleError(_0x3e5a5f,null));};exports[_0xc430('0x50')]=function(_0x255f8f,_0x2bc214,_0x1f78f3){var _0x363b5e;return db[_0xc430('0x28')][_0xc430('0x45')]({'where':{'id':_0x255f8f[_0xc430('0x41')]['id']},'attributes':['id',_0xc430('0x51')]})['then'](handleEntityNotFound(_0x2bc214,null))['then'](function(_0x27da1b){if(_0x27da1b){var _0x2f5a58=require(_0xc430('0x52'))();_0x2f5a58[_0xc430('0x53')](_0x27da1b[_0xc430('0x51')]);_0x2f5a58['closeSync']();return _0x27da1b;}})[_0xc430('0x1f')](respondWithResult(_0x2bc214,null))[_0xc430('0x3f')](handleError(_0x2bc214,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3645cbe..13017de 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 _0x02b6=['square_odbc','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc'];(function(_0x50b28f,_0x4aac2c){var _0x378b8a=function(_0x2c550a){while(--_0x2c550a){_0x50b28f['push'](_0x50b28f['shift']());}};_0x378b8a(++_0x4aac2c);}(_0x02b6,0xfe));var _0x602b=function(_0x3f9575,_0x3cc6e0){_0x3f9575=_0x3f9575-0x0;var _0x38e71e=_0x02b6[_0x3f9575];return _0x38e71e;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var logger=require(_0x602b('0x1'))(_0x602b('0x2'));var moment=require(_0x602b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x602b('0x4'));var rimraf=require(_0x602b('0x5'));var config=require(_0x602b('0x6'));var attributes=require(_0x602b('0x7'));module['exports']=function(_0x175178,_0x51b9b7){return _0x175178[_0x602b('0x8')](_0x602b('0x9'),attributes,{'tableName':_0x602b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f21=['request-promise','path','rimraf','../../config/environment','define','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3a2752,_0x2f0eda){var _0x5e8c25=function(_0x52f6e6){while(--_0x52f6e6){_0x3a2752['push'](_0x3a2752['shift']());}};_0x5e8c25(++_0x2f0eda);}(_0x4f21,0x127));var _0x14f2=function(_0x118d39,_0x43be87){_0x118d39=_0x118d39-0x0;var _0x47958b=_0x4f21[_0x118d39];return _0x47958b;};'use strict';var _=require(_0x14f2('0x0'));var util=require('util');var logger=require(_0x14f2('0x1'))(_0x14f2('0x2'));var moment=require(_0x14f2('0x3'));var BPromise=require(_0x14f2('0x4'));var rp=require(_0x14f2('0x5'));var fs=require('fs');var path=require(_0x14f2('0x6'));var rimraf=require(_0x14f2('0x7'));var config=require(_0x14f2('0x8'));var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x161cae,_0x373d04){return _0x161cae[_0x14f2('0x9')](_0x14f2('0xa'),attributes,{'tableName':_0x14f2('0xb'),'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 39987cd..d2ab70e 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 _0x75fa=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x332520,_0x4a396f){var _0x21b68e=function(_0xbf9390){while(--_0xbf9390){_0x332520['push'](_0x332520['shift']());}};_0x21b68e(++_0x4a396f);}(_0x75fa,0x85));var _0xa75f=function(_0xe3a147,_0x3473a8){_0xe3a147=_0xe3a147-0x0;var _0x15d404=_0x75fa[_0xe3a147];return _0x15d404;};'use strict';var _=require(_0xa75f('0x0'));var util=require(_0xa75f('0x1'));var moment=require(_0xa75f('0x2'));var BPromise=require(_0xa75f('0x3'));var rs=require(_0xa75f('0x4'));var fs=require('fs');var Redis=require(_0xa75f('0x5'));var db=require(_0xa75f('0x6'))['db'];var utils=require(_0xa75f('0x7'));var logger=require(_0xa75f('0x8'))(_0xa75f('0x9'));var config=require(_0xa75f('0xa'));var jayson=require(_0xa75f('0xb'));var client=jayson[_0xa75f('0xc')][_0xa75f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x151fc6,_0x4c6f66,_0x15c194){return new BPromise(function(_0x75854f,_0x53963d){return client[_0xa75f('0xe')](_0x151fc6,_0x15c194)['then'](function(_0x413420){logger[_0xa75f('0xf')](_0xa75f('0x10'),_0x4c6f66,'request\x20sent');logger[_0xa75f('0x11')](_0xa75f('0x12'),_0x4c6f66,_0xa75f('0x13'),JSON[_0xa75f('0x14')](_0x413420));if(_0x413420[_0xa75f('0x15')]){if(_0x413420[_0xa75f('0x15')]['code']===0x1f4){logger[_0xa75f('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x4c6f66,_0x413420[_0xa75f('0x15')]['message']);return _0x53963d(_0x413420['error'][_0xa75f('0x16')]);}logger[_0xa75f('0x15')](_0xa75f('0x10'),_0x4c6f66,_0x413420['error'][_0xa75f('0x16')]);return _0x75854f(_0x413420[_0xa75f('0x15')][_0xa75f('0x16')]);}else{logger[_0xa75f('0xf')](_0xa75f('0x10'),_0x4c6f66,_0xa75f('0x13'));_0x75854f(_0x413420[_0xa75f('0x17')][_0xa75f('0x16')]);}})[_0xa75f('0x18')](function(_0x17e857){logger[_0xa75f('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x4c6f66,_0x17e857);_0x53963d(_0x17e857);});});}exports[_0xa75f('0x19')]=function(_0xa65e85){var _0x2dca76=this;return new Promise(function(_0x3c9dda,_0x30e599){return db[_0xa75f('0x1a')][_0xa75f('0x1b')]({'raw':_0xa65e85[_0xa75f('0x1c')]?_0xa65e85[_0xa75f('0x1c')][_0xa75f('0x1d')]===undefined?!![]:![]:!![],'where':_0xa65e85['options']?_0xa65e85['options'][_0xa75f('0x1e')]||null:null,'attributes':_0xa65e85['options']?_0xa65e85['options']['attributes']||null:null,'include':_0xa65e85[_0xa75f('0x1c')]?_0xa65e85[_0xa75f('0x1c')][_0xa75f('0x1f')]?_[_0xa75f('0x20')](_0xa65e85[_0xa75f('0x1c')][_0xa75f('0x1f')],function(_0x2e10d0){return{'model':db[_0x2e10d0[_0xa75f('0x21')]],'as':_0x2e10d0['as'],'attributes':_0x2e10d0[_0xa75f('0x22')],'include':_0x2e10d0[_0xa75f('0x1f')]?_[_0xa75f('0x20')](_0x2e10d0['include'],function(_0x232df1){return{'model':db[_0x232df1['model']],'as':_0x232df1['as'],'attributes':_0x232df1['attributes'],'include':_0x232df1[_0xa75f('0x1f')]?_[_0xa75f('0x20')](_0x232df1[_0xa75f('0x1f')],function(_0x245986){return{'model':db[_0x245986[_0xa75f('0x21')]],'as':_0x245986['as'],'attributes':_0x245986[_0xa75f('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x287edc){logger['info']('ShowSquareOdbc',_0xa65e85);logger[_0xa75f('0x11')](_0xa75f('0x19'),_0xa65e85,JSON['stringify'](_0x287edc));_0x3c9dda(_0x287edc);})[_0xa75f('0x18')](function(_0x2d9eca){logger[_0xa75f('0x15')](_0xa75f('0x19'),_0x2d9eca[_0xa75f('0x16')],_0xa65e85);_0x30e599(_0x2dca76[_0xa75f('0x15')](0x1f4,_0x2d9eca['message']));});});}; \ No newline at end of file +var _0xa20a=['result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5088dd,_0x5c044f){var _0x21c001=function(_0x3dc873){while(--_0x3dc873){_0x5088dd['push'](_0x5088dd['shift']());}};_0x21c001(++_0x5c044f);}(_0xa20a,0xd2));var _0xaa20=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xa20a[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0xaa20('0x0'));var util=require(_0xaa20('0x1'));var moment=require('moment');var BPromise=require(_0xaa20('0x2'));var rs=require(_0xaa20('0x3'));var fs=require('fs');var Redis=require(_0xaa20('0x4'));var db=require(_0xaa20('0x5'))['db'];var utils=require(_0xaa20('0x6'));var logger=require(_0xaa20('0x7'))(_0xaa20('0x8'));var config=require(_0xaa20('0x9'));var jayson=require(_0xaa20('0xa'));var client=jayson[_0xaa20('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ebb4d,_0x3a27d3,_0x3a0736){return new BPromise(function(_0x37aa7f,_0x229cd3){return client[_0xaa20('0xc')](_0x1ebb4d,_0x3a0736)[_0xaa20('0xd')](function(_0x5dbe22){logger['info'](_0xaa20('0xe'),_0x3a27d3,_0xaa20('0xf'));logger[_0xaa20('0x10')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x3a27d3,_0xaa20('0xf'),JSON[_0xaa20('0x11')](_0x5dbe22));if(_0x5dbe22[_0xaa20('0x12')]){if(_0x5dbe22['error'][_0xaa20('0x13')]===0x1f4){logger[_0xaa20('0x12')](_0xaa20('0xe'),_0x3a27d3,_0x5dbe22['error']['message']);return _0x229cd3(_0x5dbe22['error'][_0xaa20('0x14')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3a27d3,_0x5dbe22[_0xaa20('0x12')][_0xaa20('0x14')]);return _0x37aa7f(_0x5dbe22[_0xaa20('0x12')]['message']);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3a27d3,_0xaa20('0xf'));_0x37aa7f(_0x5dbe22[_0xaa20('0x15')][_0xaa20('0x14')]);}})[_0xaa20('0x16')](function(_0xf8c32d){logger['error'](_0xaa20('0xe'),_0x3a27d3,_0xf8c32d);_0x229cd3(_0xf8c32d);});});}exports[_0xaa20('0x17')]=function(_0x44fa89){var _0x2d5084=this;return new Promise(function(_0xb1d92a,_0x4b641a){return db[_0xaa20('0x18')][_0xaa20('0x19')]({'raw':_0x44fa89[_0xaa20('0x1a')]?_0x44fa89[_0xaa20('0x1a')][_0xaa20('0x1b')]===undefined?!![]:![]:!![],'where':_0x44fa89['options']?_0x44fa89[_0xaa20('0x1a')]['where']||null:null,'attributes':_0x44fa89['options']?_0x44fa89[_0xaa20('0x1a')][_0xaa20('0x1c')]||null:null,'include':_0x44fa89['options']?_0x44fa89[_0xaa20('0x1a')][_0xaa20('0x1d')]?_[_0xaa20('0x1e')](_0x44fa89[_0xaa20('0x1a')][_0xaa20('0x1d')],function(_0x194abb){return{'model':db[_0x194abb[_0xaa20('0x1f')]],'as':_0x194abb['as'],'attributes':_0x194abb[_0xaa20('0x1c')],'include':_0x194abb[_0xaa20('0x1d')]?_[_0xaa20('0x1e')](_0x194abb[_0xaa20('0x1d')],function(_0x66002){return{'model':db[_0x66002[_0xaa20('0x1f')]],'as':_0x66002['as'],'attributes':_0x66002[_0xaa20('0x1c')],'include':_0x66002[_0xaa20('0x1d')]?_['map'](_0x66002['include'],function(_0x43ad5e){return{'model':db[_0x43ad5e[_0xaa20('0x1f')]],'as':_0x43ad5e['as'],'attributes':_0x43ad5e[_0xaa20('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xaa20('0xd')](function(_0x2b72d6){logger[_0xaa20('0x20')](_0xaa20('0x17'),_0x44fa89);logger['debug'](_0xaa20('0x17'),_0x44fa89,JSON[_0xaa20('0x11')](_0x2b72d6));_0xb1d92a(_0x2b72d6);})['catch'](function(_0x5b2142){logger[_0xaa20('0x12')](_0xaa20('0x17'),_0x5b2142[_0xaa20('0x14')],_0x44fa89);_0x4b641a(_0x2d5084[_0xaa20('0x12')](0x1f4,_0x5b2142['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 9e171f0..6c6fdd6 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 _0x7fee=['delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/users','post','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7fee,0x1a6));var _0xe7fe=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x7fee[_0x42bc91];return _0x3f5507;};'use strict';var multer=require(_0xe7fe('0x0'));var util=require(_0xe7fe('0x1'));var path=require(_0xe7fe('0x2'));var timeout=require(_0xe7fe('0x3'));var express=require(_0xe7fe('0x4'));var router=express[_0xe7fe('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe7fe('0x6'));var interaction=require(_0xe7fe('0x7'));var config=require(_0xe7fe('0x8'));var controller=require('./squareProject.controller');router[_0xe7fe('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7fe('0xa')]);router[_0xe7fe('0x9')](_0xe7fe('0xb'),auth[_0xe7fe('0xc')](),controller[_0xe7fe('0xd')]);router[_0xe7fe('0x9')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller['getUsers']);router['post']('/',auth[_0xe7fe('0xc')](),controller['create']);router[_0xe7fe('0xf')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller['addUsers']);router[_0xe7fe('0x10')](_0xe7fe('0xb'),auth['isAuthenticated'](),controller[_0xe7fe('0x11')]);router[_0xe7fe('0x12')](_0xe7fe('0xb'),auth['isAuthenticated'](),controller[_0xe7fe('0x13')]);router[_0xe7fe('0x12')](_0xe7fe('0xe'),auth['isAuthenticated'](),controller[_0xe7fe('0x14')]);module[_0xe7fe('0x15')]=router; \ No newline at end of file +var _0xd4d1=['exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','create','post','addUsers','update','delete','removeUsers'];(function(_0x4b467d,_0x2419b3){var _0xe3d158=function(_0x481735){while(--_0x481735){_0x4b467d['push'](_0x4b467d['shift']());}};_0xe3d158(++_0x2419b3);}(_0xd4d1,0x86));var _0x1d4d=function(_0x470285,_0x1029d4){_0x470285=_0x470285-0x0;var _0x41ded7=_0xd4d1[_0x470285];return _0x41ded7;};'use strict';var multer=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var path=require(_0x1d4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1d4d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1d4d('0x4'));var interaction=require(_0x1d4d('0x5'));var config=require('../../config/environment');var controller=require(_0x1d4d('0x6'));router[_0x1d4d('0x7')]('/',auth[_0x1d4d('0x8')](),controller['index']);router[_0x1d4d('0x7')](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller[_0x1d4d('0xa')]);router[_0x1d4d('0x7')](_0x1d4d('0xb'),auth[_0x1d4d('0x8')](),controller['getUsers']);router['post']('/',auth['isAuthenticated'](),controller[_0x1d4d('0xc')]);router[_0x1d4d('0xd')](_0x1d4d('0xb'),auth['isAuthenticated'](),controller[_0x1d4d('0xe')]);router['put'](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller[_0x1d4d('0xf')]);router[_0x1d4d('0x10')](_0x1d4d('0x9'),auth[_0x1d4d('0x8')](),controller['destroy']);router[_0x1d4d('0x10')]('/:id/users',auth[_0x1d4d('0x8')](),controller[_0x1d4d('0x11')]);module[_0x1d4d('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index c29561f..81b82df 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 _0xa364=['utf8','DATE','sequelize','exports','name','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','production'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa364,0x6a));var _0x4a36=function(_0x2ffb81,_0x1d56ed){_0x2ffb81=_0x2ffb81-0x0;var _0x5c2d80=_0xa364[_0x2ffb81];return _0x5c2d80;};'use strict';var Sequelize=require(_0x4a36('0x0'));module[_0x4a36('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x4a36('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4a36('0x3')]},'notes':{'type':Sequelize[_0x4a36('0x4')]},'preproduction':{'type':Sequelize[_0x4a36('0x5')](_0x4a36('0x6')),'get':function(){if(this['getDataValue']('preproduction')){return this[_0x4a36('0x7')](_0x4a36('0x8'))[_0x4a36('0x9')]('utf8');}}},'production':{'type':Sequelize[_0x4a36('0x5')](_0x4a36('0x6')),'get':function(){if(this[_0x4a36('0x7')](_0x4a36('0xa'))){return this[_0x4a36('0x7')](_0x4a36('0xa'))[_0x4a36('0x9')](_0x4a36('0xb'));}}},'savedAt':{'type':Sequelize[_0x4a36('0xc')]},'publishedAt':{'type':Sequelize[_0x4a36('0xc')]}}; \ No newline at end of file +var _0xf730=['getDataValue','preproduction','toString','long','production','utf8','DATE','sequelize','exports','STRING','TEXT','BLOB'];(function(_0x3575a8,_0x5cc4a4){var _0x3db9ba=function(_0x2b367a){while(--_0x2b367a){_0x3575a8['push'](_0x3575a8['shift']());}};_0x3db9ba(++_0x5cc4a4);}(_0xf730,0xbb));var _0x0f73=function(_0x34b0d3,_0x55b139){_0x34b0d3=_0x34b0d3-0x0;var _0x37c298=_0xf730[_0x34b0d3];return _0x37c298;};'use strict';var Sequelize=require(_0x0f73('0x0'));module[_0x0f73('0x1')]={'name':{'type':Sequelize[_0x0f73('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x0f73('0x3')]},'preproduction':{'type':Sequelize[_0x0f73('0x4')]('long'),'get':function(){if(this[_0x0f73('0x5')](_0x0f73('0x6'))){return this['getDataValue'](_0x0f73('0x6'))[_0x0f73('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x0f73('0x4')](_0x0f73('0x8')),'get':function(){if(this['getDataValue'](_0x0f73('0x9'))){return this[_0x0f73('0x5')]('production')[_0x0f73('0x7')](_0x0f73('0xa'));}}},'savedAt':{'type':Sequelize[_0x0f73('0xb')]},'publishedAt':{'type':Sequelize[_0x0f73('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7d47368..babcc68 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 _0xbdd1=['UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','ids','omit','length','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','SquareProjects'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbdd1,0x1ab));var _0x1bdd=function(_0x180fc6,_0x5f3c92){_0x180fc6=_0x180fc6-0x0;var _0x4dbf08=_0xbdd1[_0x180fc6];return _0x4dbf08;};'use strict';var emlformat=require(_0x1bdd('0x0'));var rimraf=require(_0x1bdd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1bdd('0x2'));var rp=require('request-promise');var moment=require(_0x1bdd('0x3'));var BPromise=require(_0x1bdd('0x4'));var Mustache=require(_0x1bdd('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1bdd('0x6'));var csv=require(_0x1bdd('0x7'));var ejs=require(_0x1bdd('0x8'));var fs=require('fs');var fs_extra=require(_0x1bdd('0x9'));var _=require(_0x1bdd('0xa'));var squel=require(_0x1bdd('0xb'));var crypto=require(_0x1bdd('0xc'));var jsforce=require(_0x1bdd('0xd'));var deskjs=require(_0x1bdd('0xe'));var toCsv=require(_0x1bdd('0x7'));var querystring=require(_0x1bdd('0xf'));var Papa=require(_0x1bdd('0x10'));var Redis=require(_0x1bdd('0x11'));var authService=require(_0x1bdd('0x12'));var qs=require(_0x1bdd('0x13'));var as=require(_0x1bdd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bdd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x1bdd('0x16'));var licenseUtil=require(_0x1bdd('0x17'));var db=require(_0x1bdd('0x18'))['db'];config['redis']=_[_0x1bdd('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1bdd('0x1a')]));require(_0x1bdd('0x1b'))[_0x1bdd('0x1c')](socket);function respondWithStatusCode(_0x41c3c0,_0xbbbf69){_0xbbbf69=_0xbbbf69||0xcc;return function(_0x393a7e){if(_0x393a7e){return _0x41c3c0[_0x1bdd('0x1d')](_0xbbbf69);}return _0x41c3c0[_0x1bdd('0x1e')](_0xbbbf69)[_0x1bdd('0x1f')]();};}function respondWithResult(_0x4e8caa,_0x19cb3e){_0x19cb3e=_0x19cb3e||0xc8;return function(_0x1cd61c){if(_0x1cd61c){return _0x4e8caa[_0x1bdd('0x1e')](_0x19cb3e)[_0x1bdd('0x20')](_0x1cd61c);}};}function respondWithFilteredResult(_0x2e2045,_0x13ecfd){return function(_0x543762){if(_0x543762){var _0x4fad71=typeof _0x13ecfd[_0x1bdd('0x21')]===_0x1bdd('0x22')&&typeof _0x13ecfd[_0x1bdd('0x23')]===_0x1bdd('0x22');var _0x56cbee=_0x543762[_0x1bdd('0x24')];var _0x52d7cc=_0x4fad71?0x0:_0x13ecfd[_0x1bdd('0x21')];var _0x4aee86=_0x4fad71?_0x543762[_0x1bdd('0x24')]:_0x13ecfd[_0x1bdd('0x21')]+_0x13ecfd['limit'];var _0x5acc0d;if(_0x4aee86>=_0x56cbee){_0x4aee86=_0x56cbee;_0x5acc0d=0xc8;}else{_0x5acc0d=0xce;}_0x2e2045[_0x1bdd('0x1e')](_0x5acc0d);return _0x2e2045[_0x1bdd('0x25')](_0x1bdd('0x26'),_0x52d7cc+'-'+_0x4aee86+'/'+_0x56cbee)['json'](_0x543762);}return null;};}function patchUpdates(_0x523325){return function(_0x2cf4fd){try{jsonpatch['apply'](_0x2cf4fd,_0x523325,!![]);}catch(_0x2e4ef7){return BPromise['reject'](_0x2e4ef7);}return _0x2cf4fd[_0x1bdd('0x27')]();};}function saveUpdates(_0x2ac1f6,_0x2e8f98){return function(_0xd25bc5){if(_0xd25bc5){return _0xd25bc5['update'](_0x2ac1f6)[_0x1bdd('0x28')](function(_0x53c219){return _0x53c219;});}return null;};}function removeEntity(_0x28154d,_0x300a68){return function(_0x445a40){if(_0x445a40){return _0x445a40[_0x1bdd('0x29')]()[_0x1bdd('0x28')](function(){var _0x5517b2=_0x445a40['get']({'plain':!![]});var _0x1f89ae=_0x1bdd('0x2a');return db[_0x1bdd('0x2b')][_0x1bdd('0x29')]({'where':{'type':_0x1f89ae,'resourceId':_0x5517b2['id']}})['then'](function(){return _0x445a40;});})[_0x1bdd('0x28')](function(){_0x28154d[_0x1bdd('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x191b7a,_0x264d97){return function(_0x3b1657){if(!_0x3b1657){_0x191b7a[_0x1bdd('0x1d')](0x194);}return _0x3b1657;};}function handleError(_0xad50e3,_0x3ad18c){_0x3ad18c=_0x3ad18c||0x1f4;return function(_0x5e2009){logger[_0x1bdd('0x2c')](_0x5e2009[_0x1bdd('0x2d')]);if(_0x5e2009[_0x1bdd('0x2e')]){delete _0x5e2009[_0x1bdd('0x2e')];}_0xad50e3[_0x1bdd('0x1e')](_0x3ad18c)['send'](_0x5e2009);};}exports[_0x1bdd('0x2f')]=function(_0x19612a,_0x5acde1){var _0x110c43={},_0x571313={},_0x58479d={'count':0x0,'rows':[]};var _0x466ef7=_[_0x1bdd('0x30')](db[_0x1bdd('0x31')][_0x1bdd('0x32')],function(_0x26dc34){return{'name':_0x26dc34['fieldName'],'type':_0x26dc34[_0x1bdd('0x33')][_0x1bdd('0x34')]};});_0x571313[_0x1bdd('0x35')]=_[_0x1bdd('0x30')](_0x466ef7,_0x1bdd('0x2e'));_0x571313['query']=_[_0x1bdd('0x36')](_0x19612a['query']);_0x571313[_0x1bdd('0x37')]=_[_0x1bdd('0x38')](_0x571313[_0x1bdd('0x35')],_0x571313[_0x1bdd('0x39')]);_0x110c43['attributes']=_[_0x1bdd('0x38')](_0x571313[_0x1bdd('0x35')],qs[_0x1bdd('0x3a')](_0x19612a['query'][_0x1bdd('0x3a')]));_0x110c43['attributes']=_0x110c43[_0x1bdd('0x3b')]['length']?_0x110c43['attributes']:_0x571313[_0x1bdd('0x35')];if(!_0x19612a['query']['hasOwnProperty'](_0x1bdd('0x3c'))){_0x110c43[_0x1bdd('0x23')]=qs['limit'](_0x19612a[_0x1bdd('0x39')]['limit']);_0x110c43[_0x1bdd('0x21')]=qs[_0x1bdd('0x21')](_0x19612a[_0x1bdd('0x39')]['offset']);}_0x110c43[_0x1bdd('0x3d')]=qs[_0x1bdd('0x3e')](_0x19612a[_0x1bdd('0x39')]['sort']);_0x110c43[_0x1bdd('0x3f')]=qs[_0x1bdd('0x37')](_[_0x1bdd('0x40')](_0x19612a[_0x1bdd('0x39')],_0x571313['filters']),_0x466ef7);if(_0x19612a[_0x1bdd('0x39')][_0x1bdd('0x41')]){_0x110c43[_0x1bdd('0x3f')]=_[_0x1bdd('0x42')](_0x110c43[_0x1bdd('0x3f')],{'$or':_[_0x1bdd('0x30')](_0x466ef7,function(_0x5a4d94){if(_0x5a4d94[_0x1bdd('0x33')]!==_0x1bdd('0x43')){var _0x371242={};_0x371242[_0x5a4d94[_0x1bdd('0x2e')]]={'$like':'%'+_0x19612a[_0x1bdd('0x39')][_0x1bdd('0x41')]+'%'};return _0x371242;}})});}_0x110c43=_[_0x1bdd('0x42')]({},_0x110c43,_0x19612a[_0x1bdd('0x44')]);var _0x21cf4b={'where':_0x110c43[_0x1bdd('0x3f')]};return db[_0x1bdd('0x31')]['count'](_0x21cf4b)[_0x1bdd('0x28')](function(_0x575cea){_0x58479d[_0x1bdd('0x24')]=_0x575cea;if(_0x19612a[_0x1bdd('0x39')]['includeAll']){_0x110c43[_0x1bdd('0x45')]=[{'all':!![]}];}return db[_0x1bdd('0x31')]['findAll'](_0x110c43);})['then'](function(_0x443b98){_0x58479d['rows']=_0x443b98;return _0x58479d;})[_0x1bdd('0x28')](respondWithFilteredResult(_0x5acde1,_0x110c43))[_0x1bdd('0x46')](handleError(_0x5acde1,null));};exports[_0x1bdd('0x47')]=function(_0x33bc79,_0x45ddb0){var _0x2b4189={'raw':![],'where':{'id':_0x33bc79[_0x1bdd('0x48')]['id']}},_0xfda6a6={};_0xfda6a6[_0x1bdd('0x35')]=_['keys'](db[_0x1bdd('0x31')][_0x1bdd('0x32')]);_0xfda6a6[_0x1bdd('0x39')]=_[_0x1bdd('0x36')](_0x33bc79['query']);_0xfda6a6[_0x1bdd('0x37')]=_[_0x1bdd('0x38')](_0xfda6a6[_0x1bdd('0x35')],_0xfda6a6[_0x1bdd('0x39')]);_0x2b4189[_0x1bdd('0x3b')]=_[_0x1bdd('0x38')](_0xfda6a6[_0x1bdd('0x35')],qs[_0x1bdd('0x3a')](_0x33bc79[_0x1bdd('0x39')][_0x1bdd('0x3a')]));_0x2b4189[_0x1bdd('0x3b')]=_0x2b4189[_0x1bdd('0x3b')]['length']?_0x2b4189[_0x1bdd('0x3b')]:_0xfda6a6[_0x1bdd('0x35')];if(_0x33bc79['query'][_0x1bdd('0x49')]){_0x2b4189[_0x1bdd('0x45')]=[{'all':!![]}];}_0x2b4189=_['merge']({},_0x2b4189,_0x33bc79[_0x1bdd('0x44')]);return db[_0x1bdd('0x31')]['find'](_0x2b4189)['then'](handleEntityNotFound(_0x45ddb0,null))[_0x1bdd('0x28')](respondWithResult(_0x45ddb0,null))[_0x1bdd('0x46')](handleError(_0x45ddb0,null));};exports[_0x1bdd('0x4a')]=function(_0x114950,_0x22e405){return db['SquareProject']['create'](_0x114950[_0x1bdd('0x4b')],{})['then'](function(_0x383e78){var _0x500683=_0x114950['user'][_0x1bdd('0x4c')]({'plain':!![]});if(!_0x500683)throw new Error(_0x1bdd('0x4d'));if(_0x500683[_0x1bdd('0x4e')]===_0x1bdd('0x4f')){var _0x54cdbe=_0x383e78[_0x1bdd('0x4c')]({'plain':!![]});var _0x4e6123=_0x1bdd('0x2a');return db[_0x1bdd('0x50')]['find']({'where':{'name':_0x4e6123,'userProfileId':_0x500683[_0x1bdd('0x51')]},'raw':!![]})[_0x1bdd('0x28')](function(_0x4eb143){if(_0x4eb143&&_0x4eb143[_0x1bdd('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x54cdbe[_0x1bdd('0x2e')],'resourceId':_0x54cdbe['id'],'type':_0x4eb143[_0x1bdd('0x2e')],'sectionId':_0x4eb143['id']},{})[_0x1bdd('0x28')](function(){return _0x383e78;});}else{return _0x383e78;}})[_0x1bdd('0x46')](function(_0x51896c){logger['error'](_0x1bdd('0x53'),_0x51896c);throw _0x51896c;});}return _0x383e78;})[_0x1bdd('0x28')](respondWithResult(_0x22e405,0xc9))[_0x1bdd('0x46')](handleError(_0x22e405,null));};exports[_0x1bdd('0x54')]=function(_0x4f7662,_0x52145a){if(_0x4f7662[_0x1bdd('0x4b')]['id']){delete _0x4f7662['body']['id'];}return db['SquareProject']['find']({'where':{'id':_0x4f7662[_0x1bdd('0x48')]['id']}})[_0x1bdd('0x28')](handleEntityNotFound(_0x52145a,null))['then'](saveUpdates(_0x4f7662[_0x1bdd('0x4b')],null))[_0x1bdd('0x28')](respondWithResult(_0x52145a,null))['catch'](handleError(_0x52145a,null));};exports[_0x1bdd('0x29')]=function(_0x1dc47b,_0x8f99e7){return db[_0x1bdd('0x31')][_0x1bdd('0x55')]({'where':{'id':_0x1dc47b[_0x1bdd('0x48')]['id']}})[_0x1bdd('0x28')](handleEntityNotFound(_0x8f99e7,null))['then'](removeEntity(_0x8f99e7,null))['catch'](handleError(_0x8f99e7,null));};exports['addUsers']=function(_0xe7cd6c,_0x62babe,_0x2584c4){return db[_0x1bdd('0x31')][_0x1bdd('0x55')]({'where':{'id':_0xe7cd6c[_0x1bdd('0x48')]['id']}})['then'](handleEntityNotFound(_0x62babe,null))[_0x1bdd('0x28')](function(_0x2c96bc){if(_0x2c96bc){return _0x2c96bc['addUsers'](_0xe7cd6c[_0x1bdd('0x4b')][_0x1bdd('0x56')],_[_0x1bdd('0x57')](_0xe7cd6c[_0x1bdd('0x4b')],[_0x1bdd('0x56'),'id'])||{});}})[_0x1bdd('0x28')](respondWithResult(_0x62babe,null))[_0x1bdd('0x46')](handleError(_0x62babe,null));};exports['removeUsers']=function(_0x26f28e,_0x5e9bae,_0x3978ae){return db[_0x1bdd('0x31')][_0x1bdd('0x55')]({'where':{'id':_0x26f28e[_0x1bdd('0x48')]['id']}})[_0x1bdd('0x28')](handleEntityNotFound(_0x5e9bae,null))['then'](function(_0x113fd3){if(_0x113fd3){return _0x113fd3['removeUsers'](_0x26f28e[_0x1bdd('0x39')][_0x1bdd('0x56')])[_0x1bdd('0x28')](function(){if(_['isArray'](_0x26f28e[_0x1bdd('0x39')][_0x1bdd('0x56')])){for(var _0x56f693=0x0;_0x56f693<_0x26f28e[_0x1bdd('0x39')][_0x1bdd('0x56')][_0x1bdd('0x58')];_0x56f693+=0x1){socket[_0x1bdd('0x59')]('userSquareProject:remove',{'UserId':Number(_0x26f28e[_0x1bdd('0x39')][_0x1bdd('0x56')][_0x56f693]),'SquareProjectId':Number(_0x26f28e[_0x1bdd('0x48')]['id'])});}}else{socket['emit'](_0x1bdd('0x5a'),{'UserId':Number(_0x26f28e[_0x1bdd('0x39')][_0x1bdd('0x56')]),'SquareProjectId':Number(_0x26f28e[_0x1bdd('0x48')]['id'])});}});}})[_0x1bdd('0x28')](respondWithStatusCode(_0x5e9bae,null))['catch'](handleError(_0x5e9bae,null));};exports[_0x1bdd('0x5b')]=function(_0x2f16e5,_0xaf56de,_0x7762e5){var _0x22689f={};var _0x584cd1={};var _0xae1934;var _0x4601a1;return db[_0x1bdd('0x31')][_0x1bdd('0x5c')]({'where':{'id':_0x2f16e5['params']['id']}})[_0x1bdd('0x28')](handleEntityNotFound(_0xaf56de,null))['then'](function(_0x5aefd8){if(_0x5aefd8){_0xae1934=_0x5aefd8;_0x584cd1[_0x1bdd('0x35')]=_['keys'](db[_0x1bdd('0x5d')]['rawAttributes']);_0x584cd1[_0x1bdd('0x39')]=_[_0x1bdd('0x36')](_0x2f16e5[_0x1bdd('0x39')]);_0x584cd1[_0x1bdd('0x37')]=_[_0x1bdd('0x38')](_0x584cd1[_0x1bdd('0x35')],_0x584cd1['query']);_0x22689f[_0x1bdd('0x3b')]=_['intersection'](_0x584cd1[_0x1bdd('0x35')],qs[_0x1bdd('0x3a')](_0x2f16e5['query']['fields']));_0x22689f[_0x1bdd('0x3b')]=_0x22689f[_0x1bdd('0x3b')]['length']?_0x22689f[_0x1bdd('0x3b')]:_0x584cd1[_0x1bdd('0x35')];_0x22689f[_0x1bdd('0x3d')]=qs['sort'](_0x2f16e5[_0x1bdd('0x39')][_0x1bdd('0x3e')]);_0x22689f[_0x1bdd('0x3f')]=qs[_0x1bdd('0x37')](_['pick'](_0x2f16e5[_0x1bdd('0x39')],_0x584cd1[_0x1bdd('0x37')]));if(_0x2f16e5[_0x1bdd('0x39')]['filter']){_0x22689f[_0x1bdd('0x3f')]=_[_0x1bdd('0x42')](_0x22689f[_0x1bdd('0x3f')],{'$or':_['map'](_0x22689f[_0x1bdd('0x3b')],function(_0x233c68){var _0x1f6ba0={};_0x1f6ba0[_0x233c68]={'$like':'%'+_0x2f16e5[_0x1bdd('0x39')]['filter']+'%'};return _0x1f6ba0;})});}_0x22689f=_[_0x1bdd('0x42')]({},_0x22689f,_0x2f16e5[_0x1bdd('0x44')]);return _0xae1934[_0x1bdd('0x5b')](_0x22689f);}})['then'](function(_0x3771c6){if(_0x3771c6){_0x4601a1=_0x3771c6[_0x1bdd('0x58')];if(!_0x2f16e5[_0x1bdd('0x39')]['hasOwnProperty'](_0x1bdd('0x3c'))){_0x22689f[_0x1bdd('0x23')]=qs['limit'](_0x2f16e5[_0x1bdd('0x39')][_0x1bdd('0x23')]);_0x22689f[_0x1bdd('0x21')]=qs['offset'](_0x2f16e5[_0x1bdd('0x39')][_0x1bdd('0x21')]);}return _0xae1934['getUsers'](_0x22689f);}})['then'](function(_0xa256c8){if(_0xa256c8){return _0xa256c8?{'count':_0x4601a1,'rows':_0xa256c8}:null;}})['then'](respondWithResult(_0xaf56de,null))[_0x1bdd('0x46')](handleError(_0xaf56de,null));}; \ No newline at end of file +var _0xaa71=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','localhost','./squareProject.socket','register','status','end','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','SquareProjects','sendStatus','error','name','send','index','SquareProject','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','user','role'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xaa71,0x70));var _0x1aa7=function(_0x23c808,_0x40c965){_0x23c808=_0x23c808-0x0;var _0x2e578a=_0xaa71[_0x23c808];return _0x2e578a;};'use strict';var emlformat=require(_0x1aa7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1aa7('0x1'));var jsonpatch=require(_0x1aa7('0x2'));var rp=require(_0x1aa7('0x3'));var moment=require(_0x1aa7('0x4'));var BPromise=require(_0x1aa7('0x5'));var Mustache=require(_0x1aa7('0x6'));var util=require(_0x1aa7('0x7'));var path=require(_0x1aa7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1aa7('0x9'));var fs=require('fs');var fs_extra=require(_0x1aa7('0xa'));var _=require(_0x1aa7('0xb'));var squel=require('squel');var crypto=require(_0x1aa7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1aa7('0xd'));var toCsv=require(_0x1aa7('0xe'));var querystring=require(_0x1aa7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1aa7('0x10'));var qs=require(_0x1aa7('0x11'));var as=require(_0x1aa7('0x12'));var hardwareService=require(_0x1aa7('0x13'));var logger=require(_0x1aa7('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1aa7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1aa7('0x16')],{'host':_0x1aa7('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1aa7('0x16')]));require(_0x1aa7('0x18'))[_0x1aa7('0x19')](socket);function respondWithStatusCode(_0x3b1e35,_0x405201){_0x405201=_0x405201||0xcc;return function(_0x34b255){if(_0x34b255){return _0x3b1e35['sendStatus'](_0x405201);}return _0x3b1e35[_0x1aa7('0x1a')](_0x405201)[_0x1aa7('0x1b')]();};}function respondWithResult(_0x4eb823,_0x27ff27){_0x27ff27=_0x27ff27||0xc8;return function(_0x5624d1){if(_0x5624d1){return _0x4eb823[_0x1aa7('0x1a')](_0x27ff27)['json'](_0x5624d1);}};}function respondWithFilteredResult(_0x45ac2c,_0x272a9a){return function(_0x527b93){if(_0x527b93){var _0x3d4604=typeof _0x272a9a[_0x1aa7('0x1c')]==='undefined'&&typeof _0x272a9a['limit']===_0x1aa7('0x1d');var _0x242d86=_0x527b93[_0x1aa7('0x1e')];var _0x55fa28=_0x3d4604?0x0:_0x272a9a['offset'];var _0x104300=_0x3d4604?_0x527b93[_0x1aa7('0x1e')]:_0x272a9a[_0x1aa7('0x1c')]+_0x272a9a['limit'];var _0x194bf9;if(_0x104300>=_0x242d86){_0x104300=_0x242d86;_0x194bf9=0xc8;}else{_0x194bf9=0xce;}_0x45ac2c[_0x1aa7('0x1a')](_0x194bf9);return _0x45ac2c['set'](_0x1aa7('0x1f'),_0x55fa28+'-'+_0x104300+'/'+_0x242d86)['json'](_0x527b93);}return null;};}function patchUpdates(_0x2836e2){return function(_0x17f7b6){try{jsonpatch[_0x1aa7('0x20')](_0x17f7b6,_0x2836e2,!![]);}catch(_0x5928c0){return BPromise[_0x1aa7('0x21')](_0x5928c0);}return _0x17f7b6[_0x1aa7('0x22')]();};}function saveUpdates(_0x3b822d,_0x503208){return function(_0x50e082){if(_0x50e082){return _0x50e082[_0x1aa7('0x23')](_0x3b822d)['then'](function(_0x5cb44b){return _0x5cb44b;});}return null;};}function removeEntity(_0x38afbb,_0x3a9340){return function(_0x1fa4e6){if(_0x1fa4e6){return _0x1fa4e6[_0x1aa7('0x24')]()[_0x1aa7('0x25')](function(){var _0xffeab6=_0x1fa4e6[_0x1aa7('0x26')]({'plain':!![]});var _0x459376=_0x1aa7('0x27');return db['UserProfileResource'][_0x1aa7('0x24')]({'where':{'type':_0x459376,'resourceId':_0xffeab6['id']}})[_0x1aa7('0x25')](function(){return _0x1fa4e6;});})[_0x1aa7('0x25')](function(){_0x38afbb['status'](0xcc)[_0x1aa7('0x1b')]();});}};}function handleEntityNotFound(_0x4fe51d,_0x23b31a){return function(_0x397d2f){if(!_0x397d2f){_0x4fe51d[_0x1aa7('0x28')](0x194);}return _0x397d2f;};}function handleError(_0x4e6132,_0x8bee91){_0x8bee91=_0x8bee91||0x1f4;return function(_0x49e664){logger[_0x1aa7('0x29')](_0x49e664['stack']);if(_0x49e664[_0x1aa7('0x2a')]){delete _0x49e664[_0x1aa7('0x2a')];}_0x4e6132['status'](_0x8bee91)[_0x1aa7('0x2b')](_0x49e664);};}exports[_0x1aa7('0x2c')]=function(_0x577359,_0x545d7d){var _0x3026c4={},_0x416c23={},_0xb6cf43={'count':0x0,'rows':[]};var _0x56c81c=_['map'](db[_0x1aa7('0x2d')]['rawAttributes'],function(_0x27264b){return{'name':_0x27264b[_0x1aa7('0x2e')],'type':_0x27264b[_0x1aa7('0x2f')][_0x1aa7('0x30')]};});_0x416c23['model']=_[_0x1aa7('0x31')](_0x56c81c,_0x1aa7('0x2a'));_0x416c23[_0x1aa7('0x32')]=_[_0x1aa7('0x33')](_0x577359['query']);_0x416c23['filters']=_[_0x1aa7('0x34')](_0x416c23[_0x1aa7('0x35')],_0x416c23[_0x1aa7('0x32')]);_0x3026c4[_0x1aa7('0x36')]=_[_0x1aa7('0x34')](_0x416c23[_0x1aa7('0x35')],qs[_0x1aa7('0x37')](_0x577359['query'][_0x1aa7('0x37')]));_0x3026c4[_0x1aa7('0x36')]=_0x3026c4[_0x1aa7('0x36')]['length']?_0x3026c4[_0x1aa7('0x36')]:_0x416c23[_0x1aa7('0x35')];if(!_0x577359[_0x1aa7('0x32')]['hasOwnProperty'](_0x1aa7('0x38'))){_0x3026c4['limit']=qs[_0x1aa7('0x39')](_0x577359[_0x1aa7('0x32')]['limit']);_0x3026c4[_0x1aa7('0x1c')]=qs[_0x1aa7('0x1c')](_0x577359[_0x1aa7('0x32')][_0x1aa7('0x1c')]);}_0x3026c4[_0x1aa7('0x3a')]=qs[_0x1aa7('0x3b')](_0x577359[_0x1aa7('0x32')][_0x1aa7('0x3b')]);_0x3026c4[_0x1aa7('0x3c')]=qs[_0x1aa7('0x3d')](_[_0x1aa7('0x3e')](_0x577359[_0x1aa7('0x32')],_0x416c23[_0x1aa7('0x3d')]),_0x56c81c);if(_0x577359[_0x1aa7('0x32')]['filter']){_0x3026c4[_0x1aa7('0x3c')]=_[_0x1aa7('0x3f')](_0x3026c4[_0x1aa7('0x3c')],{'$or':_['map'](_0x56c81c,function(_0x4a39c2){if(_0x4a39c2[_0x1aa7('0x2f')]!==_0x1aa7('0x40')){var _0x39b05f={};_0x39b05f[_0x4a39c2[_0x1aa7('0x2a')]]={'$like':'%'+_0x577359[_0x1aa7('0x32')][_0x1aa7('0x41')]+'%'};return _0x39b05f;}})});}_0x3026c4=_[_0x1aa7('0x3f')]({},_0x3026c4,_0x577359[_0x1aa7('0x42')]);var _0x2cf053={'where':_0x3026c4[_0x1aa7('0x3c')]};return db[_0x1aa7('0x2d')][_0x1aa7('0x1e')](_0x2cf053)['then'](function(_0x117603){_0xb6cf43[_0x1aa7('0x1e')]=_0x117603;if(_0x577359[_0x1aa7('0x32')][_0x1aa7('0x43')]){_0x3026c4[_0x1aa7('0x44')]=[{'all':!![]}];}return db[_0x1aa7('0x2d')][_0x1aa7('0x45')](_0x3026c4);})[_0x1aa7('0x25')](function(_0x39d606){_0xb6cf43[_0x1aa7('0x46')]=_0x39d606;return _0xb6cf43;})[_0x1aa7('0x25')](respondWithFilteredResult(_0x545d7d,_0x3026c4))[_0x1aa7('0x47')](handleError(_0x545d7d,null));};exports[_0x1aa7('0x48')]=function(_0x5187b3,_0x3b320d){var _0x499646={'raw':![],'where':{'id':_0x5187b3[_0x1aa7('0x49')]['id']}},_0x40ba2f={};_0x40ba2f['model']=_[_0x1aa7('0x33')](db[_0x1aa7('0x2d')][_0x1aa7('0x4a')]);_0x40ba2f[_0x1aa7('0x32')]=_[_0x1aa7('0x33')](_0x5187b3[_0x1aa7('0x32')]);_0x40ba2f[_0x1aa7('0x3d')]=_[_0x1aa7('0x34')](_0x40ba2f[_0x1aa7('0x35')],_0x40ba2f['query']);_0x499646[_0x1aa7('0x36')]=_[_0x1aa7('0x34')](_0x40ba2f[_0x1aa7('0x35')],qs['fields'](_0x5187b3[_0x1aa7('0x32')][_0x1aa7('0x37')]));_0x499646[_0x1aa7('0x36')]=_0x499646[_0x1aa7('0x36')][_0x1aa7('0x4b')]?_0x499646['attributes']:_0x40ba2f[_0x1aa7('0x35')];if(_0x5187b3[_0x1aa7('0x32')][_0x1aa7('0x43')]){_0x499646[_0x1aa7('0x44')]=[{'all':!![]}];}_0x499646=_[_0x1aa7('0x3f')]({},_0x499646,_0x5187b3[_0x1aa7('0x42')]);return db[_0x1aa7('0x2d')][_0x1aa7('0x4c')](_0x499646)['then'](handleEntityNotFound(_0x3b320d,null))[_0x1aa7('0x25')](respondWithResult(_0x3b320d,null))[_0x1aa7('0x47')](handleError(_0x3b320d,null));};exports[_0x1aa7('0x4d')]=function(_0x5a0032,_0x42352b){return db[_0x1aa7('0x2d')]['create'](_0x5a0032['body'],{})['then'](function(_0x729cd0){var _0x4cd1e8=_0x5a0032[_0x1aa7('0x4e')]['get']({'plain':!![]});if(!_0x4cd1e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cd1e8[_0x1aa7('0x4f')]===_0x1aa7('0x4e')){var _0x5ea5c1=_0x729cd0[_0x1aa7('0x26')]({'plain':!![]});var _0x3f7634=_0x1aa7('0x27');return db[_0x1aa7('0x50')][_0x1aa7('0x4c')]({'where':{'name':_0x3f7634,'userProfileId':_0x4cd1e8[_0x1aa7('0x51')]},'raw':!![]})['then'](function(_0x18a423){if(_0x18a423&&_0x18a423[_0x1aa7('0x52')]===0x0){return db['UserProfileResource'][_0x1aa7('0x4d')]({'name':_0x5ea5c1[_0x1aa7('0x2a')],'resourceId':_0x5ea5c1['id'],'type':_0x18a423[_0x1aa7('0x2a')],'sectionId':_0x18a423['id']},{})[_0x1aa7('0x25')](function(){return _0x729cd0;});}else{return _0x729cd0;}})['catch'](function(_0x28c000){logger[_0x1aa7('0x29')](_0x1aa7('0x53'),_0x28c000);throw _0x28c000;});}return _0x729cd0;})[_0x1aa7('0x25')](respondWithResult(_0x42352b,0xc9))[_0x1aa7('0x47')](handleError(_0x42352b,null));};exports[_0x1aa7('0x23')]=function(_0x47908d,_0x522202){if(_0x47908d[_0x1aa7('0x54')]['id']){delete _0x47908d[_0x1aa7('0x54')]['id'];}return db[_0x1aa7('0x2d')][_0x1aa7('0x4c')]({'where':{'id':_0x47908d[_0x1aa7('0x49')]['id']}})[_0x1aa7('0x25')](handleEntityNotFound(_0x522202,null))['then'](saveUpdates(_0x47908d[_0x1aa7('0x54')],null))[_0x1aa7('0x25')](respondWithResult(_0x522202,null))[_0x1aa7('0x47')](handleError(_0x522202,null));};exports[_0x1aa7('0x24')]=function(_0x5e8669,_0x234ce9){return db[_0x1aa7('0x2d')][_0x1aa7('0x4c')]({'where':{'id':_0x5e8669[_0x1aa7('0x49')]['id']}})['then'](handleEntityNotFound(_0x234ce9,null))[_0x1aa7('0x25')](removeEntity(_0x234ce9,null))[_0x1aa7('0x47')](handleError(_0x234ce9,null));};exports['addUsers']=function(_0xd1dbbb,_0x31285a,_0x452ce5){return db[_0x1aa7('0x2d')][_0x1aa7('0x4c')]({'where':{'id':_0xd1dbbb[_0x1aa7('0x49')]['id']}})[_0x1aa7('0x25')](handleEntityNotFound(_0x31285a,null))['then'](function(_0xf01d8e){if(_0xf01d8e){return _0xf01d8e[_0x1aa7('0x55')](_0xd1dbbb[_0x1aa7('0x54')][_0x1aa7('0x56')],_[_0x1aa7('0x57')](_0xd1dbbb[_0x1aa7('0x54')],[_0x1aa7('0x56'),'id'])||{});}})[_0x1aa7('0x25')](respondWithResult(_0x31285a,null))[_0x1aa7('0x47')](handleError(_0x31285a,null));};exports['removeUsers']=function(_0x4d86da,_0x21a210,_0x30a498){return db[_0x1aa7('0x2d')][_0x1aa7('0x4c')]({'where':{'id':_0x4d86da[_0x1aa7('0x49')]['id']}})[_0x1aa7('0x25')](handleEntityNotFound(_0x21a210,null))[_0x1aa7('0x25')](function(_0x36fd58){if(_0x36fd58){return _0x36fd58[_0x1aa7('0x58')](_0x4d86da[_0x1aa7('0x32')][_0x1aa7('0x56')])['then'](function(){if(_[_0x1aa7('0x59')](_0x4d86da[_0x1aa7('0x32')][_0x1aa7('0x56')])){for(var _0x4abad0=0x0;_0x4abad0<_0x4d86da[_0x1aa7('0x32')]['ids'][_0x1aa7('0x4b')];_0x4abad0+=0x1){socket[_0x1aa7('0x5a')](_0x1aa7('0x5b'),{'UserId':Number(_0x4d86da[_0x1aa7('0x32')]['ids'][_0x4abad0]),'SquareProjectId':Number(_0x4d86da[_0x1aa7('0x49')]['id'])});}}else{socket[_0x1aa7('0x5a')](_0x1aa7('0x5b'),{'UserId':Number(_0x4d86da[_0x1aa7('0x32')][_0x1aa7('0x56')]),'SquareProjectId':Number(_0x4d86da[_0x1aa7('0x49')]['id'])});}});}})[_0x1aa7('0x25')](respondWithStatusCode(_0x21a210,null))[_0x1aa7('0x47')](handleError(_0x21a210,null));};exports['getUsers']=function(_0xe10695,_0x1b58cd,_0x3a480a){var _0x2ef678={};var _0x83b50e={};var _0x22bfc7;var _0x3d2556;return db[_0x1aa7('0x2d')][_0x1aa7('0x5c')]({'where':{'id':_0xe10695[_0x1aa7('0x49')]['id']}})[_0x1aa7('0x25')](handleEntityNotFound(_0x1b58cd,null))[_0x1aa7('0x25')](function(_0x5e701f){if(_0x5e701f){_0x22bfc7=_0x5e701f;_0x83b50e['model']=_[_0x1aa7('0x33')](db[_0x1aa7('0x5d')][_0x1aa7('0x4a')]);_0x83b50e['query']=_[_0x1aa7('0x33')](_0xe10695[_0x1aa7('0x32')]);_0x83b50e[_0x1aa7('0x3d')]=_[_0x1aa7('0x34')](_0x83b50e[_0x1aa7('0x35')],_0x83b50e[_0x1aa7('0x32')]);_0x2ef678['attributes']=_[_0x1aa7('0x34')](_0x83b50e['model'],qs[_0x1aa7('0x37')](_0xe10695['query'][_0x1aa7('0x37')]));_0x2ef678['attributes']=_0x2ef678[_0x1aa7('0x36')][_0x1aa7('0x4b')]?_0x2ef678[_0x1aa7('0x36')]:_0x83b50e['model'];_0x2ef678['order']=qs[_0x1aa7('0x3b')](_0xe10695['query'][_0x1aa7('0x3b')]);_0x2ef678[_0x1aa7('0x3c')]=qs[_0x1aa7('0x3d')](_[_0x1aa7('0x3e')](_0xe10695[_0x1aa7('0x32')],_0x83b50e[_0x1aa7('0x3d')]));if(_0xe10695['query'][_0x1aa7('0x41')]){_0x2ef678[_0x1aa7('0x3c')]=_[_0x1aa7('0x3f')](_0x2ef678[_0x1aa7('0x3c')],{'$or':_[_0x1aa7('0x31')](_0x2ef678[_0x1aa7('0x36')],function(_0xbefc74){var _0xc42ed1={};_0xc42ed1[_0xbefc74]={'$like':'%'+_0xe10695[_0x1aa7('0x32')][_0x1aa7('0x41')]+'%'};return _0xc42ed1;})});}_0x2ef678=_[_0x1aa7('0x3f')]({},_0x2ef678,_0xe10695[_0x1aa7('0x42')]);return _0x22bfc7[_0x1aa7('0x5e')](_0x2ef678);}})[_0x1aa7('0x25')](function(_0x45f2da){if(_0x45f2da){_0x3d2556=_0x45f2da[_0x1aa7('0x4b')];if(!_0xe10695[_0x1aa7('0x32')][_0x1aa7('0x5f')](_0x1aa7('0x38'))){_0x2ef678[_0x1aa7('0x39')]=qs[_0x1aa7('0x39')](_0xe10695[_0x1aa7('0x32')][_0x1aa7('0x39')]);_0x2ef678[_0x1aa7('0x1c')]=qs['offset'](_0xe10695[_0x1aa7('0x32')][_0x1aa7('0x1c')]);}return _0x22bfc7['getUsers'](_0x2ef678);}})[_0x1aa7('0x25')](function(_0x959953){if(_0x959953){return _0x959953?{'count':_0x3d2556,'rows':_0x959953}:null;}})[_0x1aa7('0x25')](respondWithResult(_0x1b58cd,null))['catch'](handleError(_0x1b58cd,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index dec5ec7..6f5725c 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 _0x8aab=['save','update','remove','emit','hasOwnProperty','exports','events','SquareProject','setMaxListeners'];(function(_0x3ad6bd,_0x4aef2c){var _0x27f188=function(_0x18a2fa){while(--_0x18a2fa){_0x3ad6bd['push'](_0x3ad6bd['shift']());}};_0x27f188(++_0x4aef2c);}(_0x8aab,0xde));var _0xb8aa=function(_0x153dea,_0xc62a44){_0x153dea=_0x153dea-0x0;var _0x356f1c=_0x8aab[_0x153dea];return _0x356f1c;};'use strict';var EventEmitter=require(_0xb8aa('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xb8aa('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb8aa('0x2')](0x0);var events={'afterCreate':_0xb8aa('0x3'),'afterUpdate':_0xb8aa('0x4'),'afterDestroy':_0xb8aa('0x5')};function emitEvent(_0x4feb67){return function(_0xbc5d91,_0x2ce2f7,_0x412760){SquareProjectEvents[_0xb8aa('0x6')](_0x4feb67+':'+_0xbc5d91['id'],_0xbc5d91);SquareProjectEvents['emit'](_0x4feb67,_0xbc5d91);_0x412760(null);};}for(var e in events){if(events[_0xb8aa('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xb8aa('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x64fe=['SquareProject','setMaxListeners','save','update','emit','exports','../../mysqldb'];(function(_0xe0d282,_0x33a75b){var _0x3c1c07=function(_0x3507a3){while(--_0x3507a3){_0xe0d282['push'](_0xe0d282['shift']());}};_0x3c1c07(++_0x33a75b);}(_0x64fe,0xf4));var _0xe64f=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0x64fe[_0x20c9b2];return _0x2c6030;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xe64f('0x0'))['db'][_0xe64f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xe64f('0x2')](0x0);var events={'afterCreate':_0xe64f('0x3'),'afterUpdate':_0xe64f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x14c5a6){return function(_0x4512e4,_0x377973,_0x328ad3){SquareProjectEvents[_0xe64f('0x5')](_0x14c5a6+':'+_0x4512e4['id'],_0x4512e4);SquareProjectEvents['emit'](_0x14c5a6,_0x4512e4);_0x328ad3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xe64f('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 909f728..bcafb12 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 _0xc079=['savedAt','format','production','lodash','util','../../config/logger','moment','bluebird','rimraf','./squareProject.attributes','exports','define','SquareProject','changed','preproduction'];(function(_0x321114,_0x2d0d1a){var _0xa3d580=function(_0x4815c7){while(--_0x4815c7){_0x321114['push'](_0x321114['shift']());}};_0xa3d580(++_0x2d0d1a);}(_0xc079,0xc6));var _0x9c07=function(_0xdbbdc2,_0x16a3be){_0xdbbdc2=_0xdbbdc2-0x0;var _0x20f387=_0xc079[_0xdbbdc2];return _0x20f387;};'use strict';var _=require(_0x9c07('0x0'));var util=require(_0x9c07('0x1'));var logger=require(_0x9c07('0x2'))('api');var moment=require(_0x9c07('0x3'));var BPromise=require(_0x9c07('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c07('0x5'));var config=require('../../config/environment');var attributes=require(_0x9c07('0x6'));module[_0x9c07('0x7')]=function(_0x37f1aa,_0x412439){return _0x37f1aa[_0x9c07('0x8')](_0x9c07('0x9'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x394d65,_0x4806c7,_0x1ed4ef){if(_0x394d65[_0x9c07('0xa')](_0x9c07('0xb'))){_0x394d65[_0x9c07('0xc')]=moment()[_0x9c07('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x394d65['changed'](_0x9c07('0xe'))){_0x394d65['publishedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x1ed4ef(null,_0x394d65);}}});}; \ No newline at end of file +var _0xf94f=['preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0xf94f,0x15b));var _0xff94=function(_0x4db27f,_0x2fa457){_0x4db27f=_0x4db27f-0x0;var _0x39293b=_0xf94f[_0x4db27f];return _0x39293b;};'use strict';var _=require('lodash');var util=require(_0xff94('0x0'));var logger=require(_0xff94('0x1'))(_0xff94('0x2'));var moment=require(_0xff94('0x3'));var BPromise=require('bluebird');var rp=require(_0xff94('0x4'));var fs=require('fs');var path=require(_0xff94('0x5'));var rimraf=require('rimraf');var config=require(_0xff94('0x6'));var attributes=require(_0xff94('0x7'));module[_0xff94('0x8')]=function(_0x7bbd10,_0x3ebec6){return _0x7bbd10[_0xff94('0x9')](_0xff94('0xa'),attributes,{'tableName':_0xff94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1ff56a,_0x3d2d3a,_0x499220){if(_0x1ff56a[_0xff94('0xc')](_0xff94('0xd'))){_0x1ff56a['savedAt']=moment()[_0xff94('0xe')](_0xff94('0xf'));}if(_0x1ff56a[_0xff94('0xc')](_0xff94('0x10'))){_0x1ff56a[_0xff94('0x11')]=moment()[_0xff94('0xe')](_0xff94('0xf'));}_0x499220(null,_0x1ff56a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 2fbd4e6..f19c3bf 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 _0x89e3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','SquareProject,\x20%s,\x20%s','message','result','find','options','raw','attributes','include','map','model','ShowSquareProject','debug','catch','util','moment'];(function(_0x1e14a5,_0x3ec39b){var _0x462919=function(_0x26cb89){while(--_0x26cb89){_0x1e14a5['push'](_0x1e14a5['shift']());}};_0x462919(++_0x3ec39b);}(_0x89e3,0x19e));var _0x389e=function(_0x3a077f,_0x1248aa){_0x3a077f=_0x3a077f-0x0;var _0x3a136d=_0x89e3[_0x3a077f];return _0x3a136d;};'use strict';var _=require('lodash');var util=require(_0x389e('0x0'));var moment=require(_0x389e('0x1'));var BPromise=require(_0x389e('0x2'));var rs=require(_0x389e('0x3'));var fs=require('fs');var Redis=require(_0x389e('0x4'));var db=require(_0x389e('0x5'))['db'];var utils=require(_0x389e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x389e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x389e('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x389e('0x9')],{'host':_0x389e('0xa'),'port':0x18eb});var socket=require(_0x389e('0xb'))(new Redis(config['redis']));require('./squareProject.socket')[_0x389e('0xc')](socket);function respondWithRpcPromise(_0x5e8355,_0x4ab69d,_0x46f8dc){return new BPromise(function(_0x346e41,_0x1e096c){return client['request'](_0x5e8355,_0x46f8dc)[_0x389e('0xd')](function(_0xc1d8fa){logger[_0x389e('0xe')]('SquareProject,\x20%s,\x20%s',_0x4ab69d,_0x389e('0xf'));logger['debug'](_0x389e('0x10'),_0x4ab69d,_0x389e('0xf'),JSON['stringify'](_0xc1d8fa));if(_0xc1d8fa['error']){if(_0xc1d8fa[_0x389e('0x11')][_0x389e('0x12')]===0x1f4){logger['error'](_0x389e('0x13'),_0x4ab69d,_0xc1d8fa[_0x389e('0x11')][_0x389e('0x14')]);return _0x1e096c(_0xc1d8fa[_0x389e('0x11')][_0x389e('0x14')]);}logger[_0x389e('0x11')](_0x389e('0x13'),_0x4ab69d,_0xc1d8fa['error'][_0x389e('0x14')]);return _0x346e41(_0xc1d8fa[_0x389e('0x11')]['message']);}else{logger[_0x389e('0xe')](_0x389e('0x13'),_0x4ab69d,_0x389e('0xf'));_0x346e41(_0xc1d8fa[_0x389e('0x15')]['message']);}})['catch'](function(_0x52c664){logger[_0x389e('0x11')](_0x389e('0x13'),_0x4ab69d,_0x52c664);_0x1e096c(_0x52c664);});});}exports['ShowSquareProject']=function(_0x8019c7){var _0x5d75dd=this;return new Promise(function(_0x40066a,_0x1cfb9f){return db['SquareProject'][_0x389e('0x16')]({'raw':_0x8019c7[_0x389e('0x17')]?_0x8019c7[_0x389e('0x17')][_0x389e('0x18')]===undefined?!![]:![]:!![],'where':_0x8019c7[_0x389e('0x17')]?_0x8019c7['options']['where']||null:null,'attributes':_0x8019c7[_0x389e('0x17')]?_0x8019c7['options'][_0x389e('0x19')]||null:null,'include':_0x8019c7[_0x389e('0x17')]?_0x8019c7['options'][_0x389e('0x1a')]?_[_0x389e('0x1b')](_0x8019c7[_0x389e('0x17')][_0x389e('0x1a')],function(_0x382386){return{'model':db[_0x382386[_0x389e('0x1c')]],'as':_0x382386['as'],'attributes':_0x382386[_0x389e('0x19')],'include':_0x382386[_0x389e('0x1a')]?_[_0x389e('0x1b')](_0x382386[_0x389e('0x1a')],function(_0x1a08e7){return{'model':db[_0x1a08e7['model']],'as':_0x1a08e7['as'],'attributes':_0x1a08e7[_0x389e('0x19')],'include':_0x1a08e7[_0x389e('0x1a')]?_['map'](_0x1a08e7[_0x389e('0x1a')],function(_0x176970){return{'model':db[_0x176970['model']],'as':_0x176970['as'],'attributes':_0x176970[_0x389e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x389e('0xd')](function(_0xa03565){logger[_0x389e('0xe')](_0x389e('0x1d'),_0x8019c7);logger[_0x389e('0x1e')]('ShowSquareProject',_0x8019c7,JSON['stringify'](_0xa03565));_0x40066a(_0xa03565);})[_0x389e('0x1f')](function(_0x3933e8){logger['error'](_0x389e('0x1d'),_0x3933e8[_0x389e('0x14')],_0x8019c7);_0x1cfb9f(_0x5d75dd[_0x389e('0x11')](0x1f4,_0x3933e8[_0x389e('0x14')]));});});}; \ No newline at end of file +var _0x7cd9=['client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info','SquareProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xdc8e3d,_0x70accf){var _0x131657=function(_0xad2009){while(--_0xad2009){_0xdc8e3d['push'](_0xdc8e3d['shift']());}};_0x131657(++_0x70accf);}(_0x7cd9,0x10d));var _0x97cd=function(_0x4a4df2,_0x58016f){_0x4a4df2=_0x4a4df2-0x0;var _0x33d0db=_0x7cd9[_0x4a4df2];return _0x33d0db;};'use strict';var _=require('lodash');var util=require(_0x97cd('0x0'));var moment=require(_0x97cd('0x1'));var BPromise=require(_0x97cd('0x2'));var rs=require(_0x97cd('0x3'));var fs=require('fs');var Redis=require(_0x97cd('0x4'));var db=require(_0x97cd('0x5'))['db'];var utils=require(_0x97cd('0x6'));var logger=require(_0x97cd('0x7'))(_0x97cd('0x8'));var config=require(_0x97cd('0x9'));var jayson=require(_0x97cd('0xa'));var client=jayson[_0x97cd('0xb')][_0x97cd('0xc')]({'port':0x232a});config[_0x97cd('0xd')]=_[_0x97cd('0xe')](config[_0x97cd('0xd')],{'host':_0x97cd('0xf'),'port':0x18eb});var socket=require(_0x97cd('0x10'))(new Redis(config[_0x97cd('0xd')]));require(_0x97cd('0x11'))['register'](socket);function respondWithRpcPromise(_0x15335a,_0x3edf70,_0x449c64){return new BPromise(function(_0x5e440c,_0x1fd2b4){return client[_0x97cd('0x12')](_0x15335a,_0x449c64)[_0x97cd('0x13')](function(_0x80ca8e){logger[_0x97cd('0x14')](_0x97cd('0x15'),_0x3edf70,'request\x20sent');logger[_0x97cd('0x16')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3edf70,_0x97cd('0x17'),JSON[_0x97cd('0x18')](_0x80ca8e));if(_0x80ca8e[_0x97cd('0x19')]){if(_0x80ca8e[_0x97cd('0x19')][_0x97cd('0x1a')]===0x1f4){logger[_0x97cd('0x19')](_0x97cd('0x15'),_0x3edf70,_0x80ca8e['error']['message']);return _0x1fd2b4(_0x80ca8e[_0x97cd('0x19')]['message']);}logger[_0x97cd('0x19')]('SquareProject,\x20%s,\x20%s',_0x3edf70,_0x80ca8e['error'][_0x97cd('0x1b')]);return _0x5e440c(_0x80ca8e[_0x97cd('0x19')][_0x97cd('0x1b')]);}else{logger[_0x97cd('0x14')](_0x97cd('0x15'),_0x3edf70,'request\x20sent');_0x5e440c(_0x80ca8e[_0x97cd('0x1c')][_0x97cd('0x1b')]);}})['catch'](function(_0x4a8261){logger[_0x97cd('0x19')](_0x97cd('0x15'),_0x3edf70,_0x4a8261);_0x1fd2b4(_0x4a8261);});});}exports[_0x97cd('0x1d')]=function(_0x10d3f3){var _0x473874=this;return new Promise(function(_0x1bdf3f,_0x3323cd){return db[_0x97cd('0x1e')][_0x97cd('0x1f')]({'raw':_0x10d3f3[_0x97cd('0x20')]?_0x10d3f3[_0x97cd('0x20')][_0x97cd('0x21')]===undefined?!![]:![]:!![],'where':_0x10d3f3[_0x97cd('0x20')]?_0x10d3f3[_0x97cd('0x20')][_0x97cd('0x22')]||null:null,'attributes':_0x10d3f3[_0x97cd('0x20')]?_0x10d3f3[_0x97cd('0x20')][_0x97cd('0x23')]||null:null,'include':_0x10d3f3[_0x97cd('0x20')]?_0x10d3f3[_0x97cd('0x20')][_0x97cd('0x24')]?_[_0x97cd('0x25')](_0x10d3f3[_0x97cd('0x20')][_0x97cd('0x24')],function(_0x2fc6e4){return{'model':db[_0x2fc6e4[_0x97cd('0x26')]],'as':_0x2fc6e4['as'],'attributes':_0x2fc6e4[_0x97cd('0x23')],'include':_0x2fc6e4['include']?_[_0x97cd('0x25')](_0x2fc6e4[_0x97cd('0x24')],function(_0x4f3e61){return{'model':db[_0x4f3e61[_0x97cd('0x26')]],'as':_0x4f3e61['as'],'attributes':_0x4f3e61['attributes'],'include':_0x4f3e61['include']?_[_0x97cd('0x25')](_0x4f3e61[_0x97cd('0x24')],function(_0x2e1c69){return{'model':db[_0x2e1c69['model']],'as':_0x2e1c69['as'],'attributes':_0x2e1c69[_0x97cd('0x23')]};}):[]};}):[]};}):[]:[]})[_0x97cd('0x13')](function(_0x1cdcfa){logger['info'](_0x97cd('0x1d'),_0x10d3f3);logger['debug'](_0x97cd('0x1d'),_0x10d3f3,JSON[_0x97cd('0x18')](_0x1cdcfa));_0x1bdf3f(_0x1cdcfa);})[_0x97cd('0x27')](function(_0x4f90ee){logger[_0x97cd('0x19')](_0x97cd('0x1d'),_0x4f90ee['message'],_0x10d3f3);_0x3323cd(_0x473874[_0x97cd('0x19')](0x1f4,_0x4f90ee[_0x97cd('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 1e6aa84..9e72a68 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 _0x73ac=['update','emit','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x73ac,0x155));var _0xc73a=function(_0x5c535e,_0x3d2e11){_0x5c535e=_0x5c535e-0x0;var _0x5461f5=_0x73ac[_0x5c535e];return _0x5461f5;};'use strict';var SquareProjectEvents=require(_0xc73a('0x0'));var events=[_0xc73a('0x1'),_0xc73a('0x2'),_0xc73a('0x3')];function createListener(_0x42e19a,_0x1a0e14){return function(_0x3b63e5){_0x1a0e14[_0xc73a('0x4')](_0x42e19a,_0x3b63e5);};}function removeListener(_0x53c258,_0x1418e5){return function(){SquareProjectEvents['removeListener'](_0x53c258,_0x1418e5);};}exports[_0xc73a('0x5')]=function(_0x563b14){for(var _0xf53a18=0x0,_0x5dd269=events[_0xc73a('0x6')];_0xf53a18<_0x5dd269;_0xf53a18++){var _0x3d5031=events[_0xf53a18];var _0x293c32=createListener(_0xc73a('0x7')+_0x3d5031,_0x563b14);SquareProjectEvents['on'](_0x3d5031,_0x293c32);}}; \ No newline at end of file +var _0x09d0=['./squareProject.events','save','remove','removeListener','register','length','squareProject:'];(function(_0x20911b,_0x5ecca1){var _0x8b8378=function(_0x6077b4){while(--_0x6077b4){_0x20911b['push'](_0x20911b['shift']());}};_0x8b8378(++_0x5ecca1);}(_0x09d0,0x150));var _0x009d=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x09d0[_0xccf869];return _0x21a9db;};'use strict';var SquareProjectEvents=require(_0x009d('0x0'));var events=[_0x009d('0x1'),_0x009d('0x2'),'update'];function createListener(_0x4085a1,_0x3f9373){return function(_0x3f1ae0){_0x3f9373['emit'](_0x4085a1,_0x3f1ae0);};}function removeListener(_0x7ac08d,_0x5ad179){return function(){SquareProjectEvents[_0x009d('0x3')](_0x7ac08d,_0x5ad179);};}exports[_0x009d('0x4')]=function(_0x35440d){for(var _0x11846e=0x0,_0xb7ed00=events[_0x009d('0x5')];_0x11846e<_0xb7ed00;_0x11846e++){var _0x4c6374=events[_0x11846e];var _0x1ad025=createListener(_0x009d('0x6')+_0x4c6374,_0x35440d);SquareProjectEvents['on'](_0x4c6374,_0x1ad025);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 680bcc7..ccd2833 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 _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x16bb51,_0x4c9982){var _0x2fd560=function(_0x5a5b9c){while(--_0x5a5b9c){_0x16bb51['push'](_0x16bb51['shift']());}};_0x2fd560(++_0x4c9982);}(_0x814b,0x1a2));var _0xb814=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x814b[_0x1943d9];return _0x4b4f3f;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x3c3ff8,_0x1e6adf){var _0x40ca2b=function(_0x3438f7){while(--_0x3438f7){_0x3c3ff8['push'](_0x3c3ff8['shift']());}};_0x40ca2b(++_0x1e6adf);}(_0xe14b,0x93));var _0xbe14=function(_0x5f2354,_0x482b59){_0x5f2354=_0x5f2354-0x0;var _0x4eb307=_0xe14b[_0x5f2354];return _0x4eb307;};'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['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5b2286a..9a73c23 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 _0x8d0e=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0xea6ac7,_0x3ada4d){var _0x4285fb=function(_0x4faac8){while(--_0x4faac8){_0xea6ac7['push'](_0xea6ac7['shift']());}};_0x4285fb(++_0x3ada4d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x175e54,_0x369fec){_0x175e54=_0x175e54-0x0;var _0x5ce690=_0x8d0e[_0x175e54];return _0x5ce690;};'use strict';var Sequelize=require(_0xe8d0('0x0'));module[_0xe8d0('0x1')]={'uniqueid':{'type':Sequelize[_0xe8d0('0x2')]},'callerid':{'type':Sequelize[_0xe8d0('0x2')]},'calleridname':{'type':Sequelize[_0xe8d0('0x2')]},'context':{'type':Sequelize[_0xe8d0('0x2')]},'extension':{'type':Sequelize[_0xe8d0('0x2')]},'priority':{'type':Sequelize[_0xe8d0('0x2')]},'accountcode':{'type':Sequelize[_0xe8d0('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xe8d0('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xe8d0('0x2')]},'format':{'type':Sequelize[_0xe8d0('0x3')],'get':function(){var _0x469d37='';var _0xcc03d0=this[_0xe8d0('0x4')](_0xe8d0('0x5'));if(_0xcc03d0){_0x469d37=_0xcc03d0[_0xe8d0('0x6')](_0xcc03d0[_0xe8d0('0x7')]('.'));}return _0x469d37;}}}; \ No newline at end of file +var _0xbd51=['VIRTUAL','getDataValue','savePath','lastIndexOf','sequelize','STRING'];(function(_0x4a2fc8,_0x1dd265){var _0x486bb1=function(_0x31de80){while(--_0x31de80){_0x4a2fc8['push'](_0x4a2fc8['shift']());}};_0x486bb1(++_0x1dd265);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x3f638f,_0x4eb67b){_0x3f638f=_0x3f638f-0x0;var _0x77ef38=_0xbd51[_0x3f638f];return _0x77ef38;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x1bd5('0x1')]},'callerid':{'type':Sequelize[_0x1bd5('0x1')]},'calleridname':{'type':Sequelize[_0x1bd5('0x1')]},'context':{'type':Sequelize[_0x1bd5('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x1bd5('0x1')]},'saveName':{'type':Sequelize[_0x1bd5('0x1')]},'filename':{'type':Sequelize[_0x1bd5('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1bd5('0x2')],'get':function(){var _0x30a385='';var _0x19077c=this[_0x1bd5('0x3')](_0x1bd5('0x4'));if(_0x19077c){_0x30a385=_0x19077c['substring'](_0x19077c[_0x1bd5('0x5')]('.'));}return _0x30a385;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 041898a..51742af 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 _0x6599=['to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','update','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','secrets','recording','SquareRecording\x20not\x20found','filename','download','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path'];(function(_0x33501f,_0x2cae5){var _0x3e3713=function(_0x3278e3){while(--_0x3278e3){_0x33501f['push'](_0x33501f['shift']());}};_0x3e3713(++_0x2cae5);}(_0x6599,0xb7));var _0x9659=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x6599[_0x42bdad];return _0x122626;};'use strict';var emlformat=require(_0x9659('0x0'));var rimraf=require(_0x9659('0x1'));var zipdir=require(_0x9659('0x2'));var jsonpatch=require(_0x9659('0x3'));var rp=require('request-promise');var moment=require(_0x9659('0x4'));var BPromise=require(_0x9659('0x5'));var Mustache=require(_0x9659('0x6'));var util=require(_0x9659('0x7'));var path=require(_0x9659('0x8'));var sox=require('sox');var csv=require(_0x9659('0x9'));var ejs=require(_0x9659('0xa'));var fs=require('fs');var fs_extra=require(_0x9659('0xb'));var _=require(_0x9659('0xc'));var squel=require('squel');var crypto=require(_0x9659('0xd'));var jsforce=require(_0x9659('0xe'));var deskjs=require(_0x9659('0xf'));var toCsv=require(_0x9659('0x9'));var querystring=require(_0x9659('0x10'));var Papa=require('papaparse');var Redis=require(_0x9659('0x11'));var authService=require(_0x9659('0x12'));var qs=require(_0x9659('0x13'));var as=require(_0x9659('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9659('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9659('0x16'));var db=require(_0x9659('0x17'))['db'];function respondWithStatusCode(_0x1ad7d4,_0xcfc885){_0xcfc885=_0xcfc885||0xcc;return function(_0x3ad55b){if(_0x3ad55b){return _0x1ad7d4[_0x9659('0x18')](_0xcfc885);}return _0x1ad7d4[_0x9659('0x19')](_0xcfc885)[_0x9659('0x1a')]();};}function respondWithResult(_0x459493,_0x7e2ef){_0x7e2ef=_0x7e2ef||0xc8;return function(_0xab8fde){if(_0xab8fde){return _0x459493[_0x9659('0x19')](_0x7e2ef)[_0x9659('0x1b')](_0xab8fde);}};}function respondWithFilteredResult(_0x34c93d,_0x3c4425){return function(_0xbac7e0){if(_0xbac7e0){var _0x581066=typeof _0x3c4425[_0x9659('0x1c')]==='undefined'&&typeof _0x3c4425[_0x9659('0x1d')]===_0x9659('0x1e');var _0x194913=_0xbac7e0[_0x9659('0x1f')];var _0x251716=_0x581066?0x0:_0x3c4425[_0x9659('0x1c')];var _0x101edb=_0x581066?_0xbac7e0[_0x9659('0x1f')]:_0x3c4425[_0x9659('0x1c')]+_0x3c4425['limit'];var _0x37ff8a;if(_0x101edb>=_0x194913){_0x101edb=_0x194913;_0x37ff8a=0xc8;}else{_0x37ff8a=0xce;}_0x34c93d['status'](_0x37ff8a);return _0x34c93d['set'](_0x9659('0x20'),_0x251716+'-'+_0x101edb+'/'+_0x194913)[_0x9659('0x1b')](_0xbac7e0);}return null;};}function patchUpdates(_0x58b4f6){return function(_0x53f583){try{jsonpatch[_0x9659('0x21')](_0x53f583,_0x58b4f6,!![]);}catch(_0x55c865){return BPromise[_0x9659('0x22')](_0x55c865);}return _0x53f583[_0x9659('0x23')]();};}function saveUpdates(_0x5b8e2a,_0xe8dac6){return function(_0xf64fcf){if(_0xf64fcf){return _0xf64fcf['update'](_0x5b8e2a)[_0x9659('0x24')](function(_0xdfa383){return _0xdfa383;});}return null;};}function removeEntity(_0x1fb938,_0x279d9f){return function(_0xc498b5){if(_0xc498b5){return _0xc498b5[_0x9659('0x25')]()[_0x9659('0x24')](function(){_0x1fb938[_0x9659('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32a7f5,_0x7facba){return function(_0x414f4e){if(!_0x414f4e){_0x32a7f5['sendStatus'](0x194);}return _0x414f4e;};}function handleError(_0x7d865d,_0x870fa3){_0x870fa3=_0x870fa3||0x1f4;return function(_0x5685ec){logger[_0x9659('0x26')](_0x5685ec[_0x9659('0x27')]);if(_0x5685ec[_0x9659('0x28')]){delete _0x5685ec[_0x9659('0x28')];}_0x7d865d['status'](_0x870fa3)[_0x9659('0x29')](_0x5685ec);};}exports[_0x9659('0x2a')]=function(_0x498f57,_0x20126e){var _0x9a473b={},_0xbfe8a8={},_0x5cbdf8={'count':0x0,'rows':[]};var _0x233251=_[_0x9659('0x2b')](db[_0x9659('0x2c')][_0x9659('0x2d')],function(_0x17f95c){return{'name':_0x17f95c['fieldName'],'type':_0x17f95c[_0x9659('0x2e')][_0x9659('0x2f')]};});_0xbfe8a8[_0x9659('0x30')]=_[_0x9659('0x2b')](_0x233251,_0x9659('0x28'));_0xbfe8a8[_0x9659('0x31')]=_[_0x9659('0x32')](_0x498f57[_0x9659('0x31')]);_0xbfe8a8[_0x9659('0x33')]=_['intersection'](_0xbfe8a8[_0x9659('0x30')],_0xbfe8a8['query']);_0x9a473b[_0x9659('0x34')]=_[_0x9659('0x35')](_0xbfe8a8[_0x9659('0x30')],qs['fields'](_0x498f57[_0x9659('0x31')][_0x9659('0x36')]));_0x9a473b[_0x9659('0x34')]=_0x9a473b[_0x9659('0x34')][_0x9659('0x37')]?_0x9a473b[_0x9659('0x34')]:_0xbfe8a8[_0x9659('0x30')];if(!_0x498f57[_0x9659('0x31')][_0x9659('0x38')](_0x9659('0x39'))){_0x9a473b['limit']=qs[_0x9659('0x1d')](_0x498f57[_0x9659('0x31')][_0x9659('0x1d')]);_0x9a473b[_0x9659('0x1c')]=qs['offset'](_0x498f57[_0x9659('0x31')][_0x9659('0x1c')]);}_0x9a473b[_0x9659('0x3a')]=qs['sort'](_0x498f57[_0x9659('0x31')][_0x9659('0x3b')]);_0x9a473b['where']=qs[_0x9659('0x33')](_[_0x9659('0x3c')](_0x498f57[_0x9659('0x31')],_0xbfe8a8[_0x9659('0x33')]),_0x233251);if(_0x498f57['query'][_0x9659('0x3d')]){_0x9a473b[_0x9659('0x3e')]=_[_0x9659('0x3f')](_0x9a473b[_0x9659('0x3e')],{'$or':_[_0x9659('0x2b')](_0x233251,function(_0x1cfba0){if(_0x1cfba0[_0x9659('0x2e')]!==_0x9659('0x40')){var _0x33afdc={};_0x33afdc[_0x1cfba0[_0x9659('0x28')]]={'$like':'%'+_0x498f57[_0x9659('0x31')]['filter']+'%'};return _0x33afdc;}})});}_0x9a473b=_['merge']({},_0x9a473b,_0x498f57['options']);var _0x5b8d1e={'where':_0x9a473b['where']};return db[_0x9659('0x2c')][_0x9659('0x1f')](_0x5b8d1e)[_0x9659('0x24')](function(_0x3142f1){_0x5cbdf8[_0x9659('0x1f')]=_0x3142f1;if(_0x498f57[_0x9659('0x31')][_0x9659('0x41')]){_0x9a473b['include']=[{'all':!![]}];}return db[_0x9659('0x2c')]['findAll'](_0x9a473b);})[_0x9659('0x24')](function(_0x466f1e){_0x5cbdf8[_0x9659('0x42')]=_0x466f1e;return _0x5cbdf8;})[_0x9659('0x24')](respondWithFilteredResult(_0x20126e,_0x9a473b))[_0x9659('0x43')](handleError(_0x20126e,null));};exports[_0x9659('0x44')]=function(_0x3459d3,_0xe0e68){var _0x40a3c3={'raw':!![],'where':{'id':_0x3459d3[_0x9659('0x45')]['id']}},_0x2867d4={};_0x2867d4['model']=_[_0x9659('0x32')](db['SquareRecording'][_0x9659('0x2d')]);_0x2867d4[_0x9659('0x31')]=_[_0x9659('0x32')](_0x3459d3[_0x9659('0x31')]);_0x2867d4[_0x9659('0x33')]=_['intersection'](_0x2867d4[_0x9659('0x30')],_0x2867d4[_0x9659('0x31')]);_0x40a3c3[_0x9659('0x34')]=_[_0x9659('0x35')](_0x2867d4[_0x9659('0x30')],qs[_0x9659('0x36')](_0x3459d3[_0x9659('0x31')][_0x9659('0x36')]));_0x40a3c3[_0x9659('0x34')]=_0x40a3c3[_0x9659('0x34')][_0x9659('0x37')]?_0x40a3c3[_0x9659('0x34')]:_0x2867d4['model'];if(_0x3459d3[_0x9659('0x31')]['includeAll']){_0x40a3c3[_0x9659('0x46')]=[{'all':!![]}];}_0x40a3c3=_['merge']({},_0x40a3c3,_0x3459d3[_0x9659('0x47')]);return db[_0x9659('0x2c')][_0x9659('0x48')](_0x40a3c3)[_0x9659('0x24')](handleEntityNotFound(_0xe0e68,null))['then'](respondWithResult(_0xe0e68,null))[_0x9659('0x43')](handleError(_0xe0e68,null));};exports['create']=function(_0xd7ee22,_0x21f3bf){return db[_0x9659('0x2c')][_0x9659('0x49')](_0xd7ee22[_0x9659('0x4a')],{})[_0x9659('0x24')](respondWithResult(_0x21f3bf,0xc9))[_0x9659('0x43')](handleError(_0x21f3bf,null));};exports[_0x9659('0x4b')]=function(_0x13f481,_0x16fe77){if(_0x13f481[_0x9659('0x4a')]['id']){delete _0x13f481[_0x9659('0x4a')]['id'];}return db[_0x9659('0x2c')][_0x9659('0x48')]({'where':{'id':_0x13f481[_0x9659('0x45')]['id']}})[_0x9659('0x24')](handleEntityNotFound(_0x16fe77,null))[_0x9659('0x24')](saveUpdates(_0x13f481[_0x9659('0x4a')],null))[_0x9659('0x24')](respondWithResult(_0x16fe77,null))[_0x9659('0x43')](handleError(_0x16fe77,null));};exports['download']=function(_0x2b1547,_0xec6c26,_0x415abf){var _0x4c70e1=require(_0x9659('0x4c'));var _0x572cf4=![];var _0x42f22f={};if(_0x2b1547[_0x9659('0x31')][_0x9659('0x2e')]&&_0x2b1547[_0x9659('0x31')]['type']===_0x9659('0x4d')){_0x42f22f[_0x9659('0x4d')]=_0x2b1547[_0x9659('0x45')]['id'];}else{_0x42f22f['id']=_0x2b1547['params']['id'];}return db[_0x9659('0x2c')][_0x9659('0x48')]({'where':_0x42f22f,'attributes':['id','savePath','filename'],'raw':!![]})[_0x9659('0x24')](handleEntityNotFound(_0xec6c26,null))[_0x9659('0x24')](function(_0x55bc3c){if(_0x55bc3c){var _0x1e85f1=_0x55bc3c[_0x9659('0x4e')];var _0x3f7688=util[_0x9659('0x4f')](_0x9659('0x50'),_0x1e85f1);if(fs[_0x9659('0x51')](_0x3f7688)){_0x572cf4=!![];return _0x4c70e1['decryptFile'](_0x3f7688,_0x1e85f1,config[_0x9659('0x52')][_0x9659('0x53')])[_0x9659('0x24')](function(){return _0x55bc3c;});}return _0x55bc3c;}})[_0x9659('0x24')](function(_0x4894a8){if(_0x4894a8){var _0x40bfb3=_0x4894a8[_0x9659('0x4e')];if(!fs[_0x9659('0x51')](_0x40bfb3)){throw new db['Sequelize']['ValidationError'](_0x9659('0x54'));}if(_0x4894a8[_0x9659('0x55')]){return _0xec6c26[_0x9659('0x56')](_0x40bfb3,_0x4894a8[_0x9659('0x55')]+path['extname'](_0x40bfb3),function(){if(_0x572cf4){fs[_0x9659('0x57')](_0x40bfb3);}});}else{return _0xec6c26[_0x9659('0x56')](_0x40bfb3,function(_0x25ab7a){if(_0x572cf4){fs['unlink'](_0x40bfb3);}});}}})['catch'](function(_0x10b6be){if(_0x10b6be[_0x9659('0x58')]===_0x9659('0x54')){_0xec6c26[_0x9659('0x19')](0x194)['send'](_0x9659('0x59'));}else{return handleError(_0xec6c26,null);}});};exports[_0x9659('0x25')]=function(_0x3d25c4,_0x1579d8){return db[_0x9659('0x2c')][_0x9659('0x48')]({'where':{'id':_0x3d25c4[_0x9659('0x45')]['id']}})[_0x9659('0x24')](function(_0x2bd503){if(_[_0x9659('0x5a')](_0x2bd503)){throw new ReferenceError(_0x9659('0x5b'));}return _0x2bd503;})[_0x9659('0x24')](function(_0x58cfc9){var _0xa693b2=_0x58cfc9[_0x9659('0x4e')];logger[_0x9659('0x5c')]('cancellazione\x20fisica\x20documento\x20%s',_0xa693b2);if(!_[_0x9659('0x5a')](_0x58cfc9[_0x9659('0x4e')])&&fs[_0x9659('0x51')](_0xa693b2)){logger[_0x9659('0x5c')](_0x9659('0x5d')+_0xa693b2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xa693b2);}_0xa693b2=_0xa693b2+_0x9659('0x5e');if(!_[_0x9659('0x5a')](_0x58cfc9[_0x9659('0x4e')])&&fs[_0x9659('0x51')](_0xa693b2)){logger[_0x9659('0x5c')](_0x9659('0x5d')+_0xa693b2+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9659('0x5f')](_0xa693b2);}return _0x58cfc9;})[_0x9659('0x24')](function(_0x190dc0){if(!_0x190dc0)throw new InternalError();return _0x190dc0['destroy']();})[_0x9659('0x24')](function(){_0x1579d8[_0x9659('0x19')](0xcc)[_0x9659('0x1a')]();})[_0x9659('0x43')](handleError(_0x1579d8,null));}; \ No newline at end of file +var _0x2b1a=['SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','SquareRecording','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','options','find','create','update','body','params','download','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b1a,0x71));var _0xa2b1=function(_0x4a5465,_0x4940c9){_0x4a5465=_0x4a5465-0x0;var _0x2bf68f=_0x2b1a[_0x4a5465];return _0x2bf68f;};'use strict';var emlformat=require(_0xa2b1('0x0'));var rimraf=require(_0xa2b1('0x1'));var zipdir=require(_0xa2b1('0x2'));var jsonpatch=require(_0xa2b1('0x3'));var rp=require(_0xa2b1('0x4'));var moment=require(_0xa2b1('0x5'));var BPromise=require(_0xa2b1('0x6'));var Mustache=require(_0xa2b1('0x7'));var util=require(_0xa2b1('0x8'));var path=require('path');var sox=require(_0xa2b1('0x9'));var csv=require(_0xa2b1('0xa'));var ejs=require(_0xa2b1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2b1('0xc'));var squel=require(_0xa2b1('0xd'));var crypto=require(_0xa2b1('0xe'));var jsforce=require(_0xa2b1('0xf'));var deskjs=require(_0xa2b1('0x10'));var toCsv=require(_0xa2b1('0xa'));var querystring=require('querystring');var Papa=require(_0xa2b1('0x11'));var Redis=require(_0xa2b1('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2b1('0x13'));var hardwareService=require(_0xa2b1('0x14'));var logger=require(_0xa2b1('0x15'))(_0xa2b1('0x16'));var utils=require(_0xa2b1('0x17'));var config=require(_0xa2b1('0x18'));var licenseUtil=require(_0xa2b1('0x19'));var db=require(_0xa2b1('0x1a'))['db'];function respondWithStatusCode(_0x6d21f9,_0x239b60){_0x239b60=_0x239b60||0xcc;return function(_0x36d72d){if(_0x36d72d){return _0x6d21f9['sendStatus'](_0x239b60);}return _0x6d21f9[_0xa2b1('0x1b')](_0x239b60)[_0xa2b1('0x1c')]();};}function respondWithResult(_0x40f866,_0x54638c){_0x54638c=_0x54638c||0xc8;return function(_0x2e04d9){if(_0x2e04d9){return _0x40f866[_0xa2b1('0x1b')](_0x54638c)[_0xa2b1('0x1d')](_0x2e04d9);}};}function respondWithFilteredResult(_0x146d78,_0x537073){return function(_0x535e4f){if(_0x535e4f){var _0xe0b6ae=typeof _0x537073[_0xa2b1('0x1e')]===_0xa2b1('0x1f')&&typeof _0x537073[_0xa2b1('0x20')]===_0xa2b1('0x1f');var _0x235344=_0x535e4f[_0xa2b1('0x21')];var _0x551be4=_0xe0b6ae?0x0:_0x537073[_0xa2b1('0x1e')];var _0x350ec0=_0xe0b6ae?_0x535e4f[_0xa2b1('0x21')]:_0x537073[_0xa2b1('0x1e')]+_0x537073[_0xa2b1('0x20')];var _0x41d522;if(_0x350ec0>=_0x235344){_0x350ec0=_0x235344;_0x41d522=0xc8;}else{_0x41d522=0xce;}_0x146d78[_0xa2b1('0x1b')](_0x41d522);return _0x146d78[_0xa2b1('0x22')](_0xa2b1('0x23'),_0x551be4+'-'+_0x350ec0+'/'+_0x235344)[_0xa2b1('0x1d')](_0x535e4f);}return null;};}function patchUpdates(_0x171915){return function(_0x1372bd){try{jsonpatch[_0xa2b1('0x24')](_0x1372bd,_0x171915,!![]);}catch(_0x40984c){return BPromise['reject'](_0x40984c);}return _0x1372bd[_0xa2b1('0x25')]();};}function saveUpdates(_0x1ac357,_0x1d8514){return function(_0x5c9c5c){if(_0x5c9c5c){return _0x5c9c5c['update'](_0x1ac357)[_0xa2b1('0x26')](function(_0xb8a95b){return _0xb8a95b;});}return null;};}function removeEntity(_0x2ef529,_0x9c331a){return function(_0xe1a79a){if(_0xe1a79a){return _0xe1a79a[_0xa2b1('0x27')]()['then'](function(){_0x2ef529[_0xa2b1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b64dc,_0x539d5f){return function(_0x2c3f46){if(!_0x2c3f46){_0x3b64dc['sendStatus'](0x194);}return _0x2c3f46;};}function handleError(_0x16b988,_0x5f1ff4){_0x5f1ff4=_0x5f1ff4||0x1f4;return function(_0x300138){logger[_0xa2b1('0x28')](_0x300138['stack']);if(_0x300138[_0xa2b1('0x29')]){delete _0x300138[_0xa2b1('0x29')];}_0x16b988[_0xa2b1('0x1b')](_0x5f1ff4)[_0xa2b1('0x2a')](_0x300138);};}exports[_0xa2b1('0x2b')]=function(_0x56b10a,_0x48c977){var _0x31cb4e={},_0xc16ae4={},_0xb74f56={'count':0x0,'rows':[]};var _0x2b8ccd=_[_0xa2b1('0x2c')](db[_0xa2b1('0x2d')]['rawAttributes'],function(_0x41e702){return{'name':_0x41e702['fieldName'],'type':_0x41e702[_0xa2b1('0x2e')]['key']};});_0xc16ae4[_0xa2b1('0x2f')]=_[_0xa2b1('0x2c')](_0x2b8ccd,'name');_0xc16ae4[_0xa2b1('0x30')]=_['keys'](_0x56b10a[_0xa2b1('0x30')]);_0xc16ae4[_0xa2b1('0x31')]=_[_0xa2b1('0x32')](_0xc16ae4[_0xa2b1('0x2f')],_0xc16ae4['query']);_0x31cb4e['attributes']=_['intersection'](_0xc16ae4['model'],qs['fields'](_0x56b10a[_0xa2b1('0x30')][_0xa2b1('0x33')]));_0x31cb4e[_0xa2b1('0x34')]=_0x31cb4e['attributes'][_0xa2b1('0x35')]?_0x31cb4e[_0xa2b1('0x34')]:_0xc16ae4[_0xa2b1('0x2f')];if(!_0x56b10a[_0xa2b1('0x30')][_0xa2b1('0x36')](_0xa2b1('0x37'))){_0x31cb4e[_0xa2b1('0x20')]=qs[_0xa2b1('0x20')](_0x56b10a[_0xa2b1('0x30')]['limit']);_0x31cb4e['offset']=qs['offset'](_0x56b10a[_0xa2b1('0x30')][_0xa2b1('0x1e')]);}_0x31cb4e[_0xa2b1('0x38')]=qs['sort'](_0x56b10a[_0xa2b1('0x30')]['sort']);_0x31cb4e[_0xa2b1('0x39')]=qs[_0xa2b1('0x31')](_['pick'](_0x56b10a[_0xa2b1('0x30')],_0xc16ae4[_0xa2b1('0x31')]),_0x2b8ccd);if(_0x56b10a[_0xa2b1('0x30')][_0xa2b1('0x3a')]){_0x31cb4e[_0xa2b1('0x39')]=_[_0xa2b1('0x3b')](_0x31cb4e[_0xa2b1('0x39')],{'$or':_['map'](_0x2b8ccd,function(_0x4415bf){if(_0x4415bf[_0xa2b1('0x2e')]!==_0xa2b1('0x3c')){var _0x233cda={};_0x233cda[_0x4415bf[_0xa2b1('0x29')]]={'$like':'%'+_0x56b10a[_0xa2b1('0x30')][_0xa2b1('0x3a')]+'%'};return _0x233cda;}})});}_0x31cb4e=_[_0xa2b1('0x3b')]({},_0x31cb4e,_0x56b10a['options']);var _0x4f2967={'where':_0x31cb4e[_0xa2b1('0x39')]};return db[_0xa2b1('0x2d')][_0xa2b1('0x21')](_0x4f2967)[_0xa2b1('0x26')](function(_0x3d75ec){_0xb74f56['count']=_0x3d75ec;if(_0x56b10a['query'][_0xa2b1('0x3d')]){_0x31cb4e[_0xa2b1('0x3e')]=[{'all':!![]}];}return db['SquareRecording'][_0xa2b1('0x3f')](_0x31cb4e);})[_0xa2b1('0x26')](function(_0x5a82f6){_0xb74f56[_0xa2b1('0x40')]=_0x5a82f6;return _0xb74f56;})[_0xa2b1('0x26')](respondWithFilteredResult(_0x48c977,_0x31cb4e))[_0xa2b1('0x41')](handleError(_0x48c977,null));};exports[_0xa2b1('0x42')]=function(_0x147f4b,_0x83c9ff){var _0x3caa4a={'raw':!![],'where':{'id':_0x147f4b['params']['id']}},_0x5504b={};_0x5504b[_0xa2b1('0x2f')]=_[_0xa2b1('0x43')](db[_0xa2b1('0x2d')][_0xa2b1('0x44')]);_0x5504b[_0xa2b1('0x30')]=_[_0xa2b1('0x43')](_0x147f4b[_0xa2b1('0x30')]);_0x5504b[_0xa2b1('0x31')]=_[_0xa2b1('0x32')](_0x5504b[_0xa2b1('0x2f')],_0x5504b[_0xa2b1('0x30')]);_0x3caa4a[_0xa2b1('0x34')]=_[_0xa2b1('0x32')](_0x5504b[_0xa2b1('0x2f')],qs['fields'](_0x147f4b[_0xa2b1('0x30')][_0xa2b1('0x33')]));_0x3caa4a[_0xa2b1('0x34')]=_0x3caa4a['attributes'][_0xa2b1('0x35')]?_0x3caa4a[_0xa2b1('0x34')]:_0x5504b[_0xa2b1('0x2f')];if(_0x147f4b['query'][_0xa2b1('0x3d')]){_0x3caa4a[_0xa2b1('0x3e')]=[{'all':!![]}];}_0x3caa4a=_[_0xa2b1('0x3b')]({},_0x3caa4a,_0x147f4b[_0xa2b1('0x45')]);return db[_0xa2b1('0x2d')][_0xa2b1('0x46')](_0x3caa4a)[_0xa2b1('0x26')](handleEntityNotFound(_0x83c9ff,null))[_0xa2b1('0x26')](respondWithResult(_0x83c9ff,null))[_0xa2b1('0x41')](handleError(_0x83c9ff,null));};exports['create']=function(_0x844c76,_0x363efc){return db[_0xa2b1('0x2d')][_0xa2b1('0x47')](_0x844c76['body'],{})[_0xa2b1('0x26')](respondWithResult(_0x363efc,0xc9))[_0xa2b1('0x41')](handleError(_0x363efc,null));};exports[_0xa2b1('0x48')]=function(_0x71fcd5,_0x2e8b4d){if(_0x71fcd5[_0xa2b1('0x49')]['id']){delete _0x71fcd5[_0xa2b1('0x49')]['id'];}return db[_0xa2b1('0x2d')][_0xa2b1('0x46')]({'where':{'id':_0x71fcd5[_0xa2b1('0x4a')]['id']}})[_0xa2b1('0x26')](handleEntityNotFound(_0x2e8b4d,null))[_0xa2b1('0x26')](saveUpdates(_0x71fcd5[_0xa2b1('0x49')],null))['then'](respondWithResult(_0x2e8b4d,null))[_0xa2b1('0x41')](handleError(_0x2e8b4d,null));};exports[_0xa2b1('0x4b')]=function(_0x34c172,_0x5f57dd,_0x506962){var _0x4dab0c=require('../../components/encryptor');var _0x1d7425=![];var _0xcf5d4b={};if(_0x34c172[_0xa2b1('0x30')][_0xa2b1('0x2e')]&&_0x34c172[_0xa2b1('0x30')][_0xa2b1('0x2e')]===_0xa2b1('0x4c')){_0xcf5d4b[_0xa2b1('0x4c')]=_0x34c172['params']['id'];}else{_0xcf5d4b['id']=_0x34c172[_0xa2b1('0x4a')]['id'];}return db[_0xa2b1('0x2d')][_0xa2b1('0x46')]({'where':_0xcf5d4b,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x5f57dd,null))[_0xa2b1('0x26')](function(_0x47af55){if(_0x47af55){var _0x2042c7=_0x47af55[_0xa2b1('0x4d')];var _0x10418b=util[_0xa2b1('0x4e')](_0xa2b1('0x4f'),_0x2042c7);if(fs[_0xa2b1('0x50')](_0x10418b)){_0x1d7425=!![];return _0x4dab0c[_0xa2b1('0x51')](_0x10418b,_0x2042c7,config['secrets'][_0xa2b1('0x52')])[_0xa2b1('0x26')](function(){return _0x47af55;});}return _0x47af55;}})['then'](function(_0x32e5f4){if(_0x32e5f4){var _0x45af6f=_0x32e5f4[_0xa2b1('0x4d')];if(!fs[_0xa2b1('0x50')](_0x45af6f)){throw new db[(_0xa2b1('0x53'))][(_0xa2b1('0x54'))](_0xa2b1('0x55'));}if(_0x32e5f4[_0xa2b1('0x56')]){return _0x5f57dd[_0xa2b1('0x4b')](_0x45af6f,_0x32e5f4[_0xa2b1('0x56')]+path[_0xa2b1('0x57')](_0x45af6f),function(){if(_0x1d7425){fs[_0xa2b1('0x58')](_0x45af6f);}});}else{return _0x5f57dd['download'](_0x45af6f,function(_0x56bd74){if(_0x1d7425){fs[_0xa2b1('0x58')](_0x45af6f);}});}}})[_0xa2b1('0x41')](function(_0x317f03){if(_0x317f03[_0xa2b1('0x59')]===_0xa2b1('0x55')){_0x5f57dd['status'](0x194)['send'](_0xa2b1('0x5a'));}else{return handleError(_0x5f57dd,null);}});};exports['destroy']=function(_0x58d06d,_0x48a6a3){return db[_0xa2b1('0x2d')][_0xa2b1('0x46')]({'where':{'id':_0x58d06d[_0xa2b1('0x4a')]['id']}})[_0xa2b1('0x26')](function(_0x5381e5){if(_[_0xa2b1('0x5b')](_0x5381e5)){throw new ReferenceError(_0xa2b1('0x5c'));}return _0x5381e5;})[_0xa2b1('0x26')](function(_0x2c595e){var _0x3b66db=_0x2c595e[_0xa2b1('0x4d')];logger[_0xa2b1('0x5d')](_0xa2b1('0x5e'),_0x3b66db);if(!_['isNil'](_0x2c595e['savePath'])&&fs['existsSync'](_0x3b66db)){logger['info'](_0xa2b1('0x5f')+_0x3b66db+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa2b1('0x60')](_0x3b66db);}_0x3b66db=_0x3b66db+_0xa2b1('0x61');if(!_[_0xa2b1('0x5b')](_0x2c595e[_0xa2b1('0x4d')])&&fs['existsSync'](_0x3b66db)){logger[_0xa2b1('0x5d')](_0xa2b1('0x5f')+_0x3b66db+_0xa2b1('0x62'));fs[_0xa2b1('0x60')](_0x3b66db);}return _0x2c595e;})[_0xa2b1('0x26')](function(_0x226158){if(!_0x226158)throw new InternalError();return _0x226158[_0xa2b1('0x27')]();})['then'](function(){_0x48a6a3[_0xa2b1('0x1b')](0xcc)[_0xa2b1('0x1c')]();})['catch'](handleError(_0x48a6a3,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index fcf4ea4..8431243 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 _0x1e82=['moment','bluebird','path','rimraf','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api'];(function(_0x5387a2,_0xafaf34){var _0x4c9033=function(_0x1ab51c){while(--_0x1ab51c){_0x5387a2['push'](_0x5387a2['shift']());}};_0x4c9033(++_0xafaf34);}(_0x1e82,0x8b));var _0x21e8=function(_0x488722,_0x3c49ac){_0x488722=_0x488722-0x0;var _0x5a6537=_0x1e82[_0x488722];return _0x5a6537;};'use strict';var _=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var logger=require(_0x21e8('0x2'))(_0x21e8('0x3'));var moment=require(_0x21e8('0x4'));var BPromise=require(_0x21e8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x21e8('0x6'));var rimraf=require(_0x21e8('0x7'));var config=require('../../config/environment');var attributes=require(_0x21e8('0x8'));module['exports']=function(_0x35a33a,_0x11e388){return _0x35a33a[_0x21e8('0x9')](_0x21e8('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c1a=['rimraf','./squareRecording.attributes','define','SquareRecording','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x7c1a,0x159));var _0xa7c1=function(_0x287a20,_0x48a46a){_0x287a20=_0x287a20-0x0;var _0x3070e8=_0x7c1a[_0x287a20];return _0x3070e8;};'use strict';var _=require(_0xa7c1('0x0'));var util=require(_0xa7c1('0x1'));var logger=require(_0xa7c1('0x2'))(_0xa7c1('0x3'));var moment=require(_0xa7c1('0x4'));var BPromise=require(_0xa7c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7c1('0x6'));var rimraf=require(_0xa7c1('0x7'));var config=require('../../config/environment');var attributes=require(_0xa7c1('0x8'));module['exports']=function(_0x3c8e8d,_0xa10122){return _0x3c8e8d[_0xa7c1('0x9')](_0xa7c1('0xa'),attributes,{'tableName':'square_recordings','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 db18b5a..2d68d85 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 _0x4cbc=['rpc','../../config/environment','jayson/promise','client','http','then','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareRecording,\x20%s,\x20%s','message','result','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x4cbc,0x19c));var _0xc4cb=function(_0x250858,_0x4381dc){_0x250858=_0x250858-0x0;var _0x4ba9f8=_0x4cbc[_0x250858];return _0x4ba9f8;};'use strict';var _=require('lodash');var util=require(_0xc4cb('0x0'));var moment=require(_0xc4cb('0x1'));var BPromise=require(_0xc4cb('0x2'));var rs=require(_0xc4cb('0x3'));var fs=require('fs');var Redis=require(_0xc4cb('0x4'));var db=require(_0xc4cb('0x5'))['db'];var utils=require(_0xc4cb('0x6'));var logger=require(_0xc4cb('0x7'))(_0xc4cb('0x8'));var config=require(_0xc4cb('0x9'));var jayson=require(_0xc4cb('0xa'));var client=jayson[_0xc4cb('0xb')][_0xc4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1f53fe,_0x3e3d1c,_0x2cf2dc){return new BPromise(function(_0xd2b3ab,_0x517fc6){return client['request'](_0x1f53fe,_0x2cf2dc)[_0xc4cb('0xd')](function(_0x5e5ddd){logger[_0xc4cb('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3e3d1c,'request\x20sent');logger[_0xc4cb('0xf')](_0xc4cb('0x10'),_0x3e3d1c,_0xc4cb('0x11'),JSON[_0xc4cb('0x12')](_0x5e5ddd));if(_0x5e5ddd[_0xc4cb('0x13')]){if(_0x5e5ddd[_0xc4cb('0x13')]['code']===0x1f4){logger[_0xc4cb('0x13')](_0xc4cb('0x14'),_0x3e3d1c,_0x5e5ddd[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0x517fc6(_0x5e5ddd[_0xc4cb('0x13')][_0xc4cb('0x15')]);}logger[_0xc4cb('0x13')](_0xc4cb('0x14'),_0x3e3d1c,_0x5e5ddd[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0xd2b3ab(_0x5e5ddd['error'][_0xc4cb('0x15')]);}else{logger[_0xc4cb('0xe')]('SquareRecording,\x20%s,\x20%s',_0x3e3d1c,_0xc4cb('0x11'));_0xd2b3ab(_0x5e5ddd[_0xc4cb('0x16')][_0xc4cb('0x15')]);}})[_0xc4cb('0x17')](function(_0x28a543){logger[_0xc4cb('0x13')](_0xc4cb('0x14'),_0x3e3d1c,_0x28a543);_0x517fc6(_0x28a543);});});}exports[_0xc4cb('0x18')]=function(_0x382513){var _0x2b8dc1=this;return new Promise(function(_0x473efa,_0x410a8a){return db[_0xc4cb('0x19')][_0xc4cb('0x1a')](_0x382513[_0xc4cb('0x1b')],{'raw':_0x382513[_0xc4cb('0x1c')]?_0x382513[_0xc4cb('0x1c')][_0xc4cb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x435515){logger[_0xc4cb('0xe')](_0xc4cb('0x18'),_0x382513);logger[_0xc4cb('0xf')](_0xc4cb('0x18'),_0x382513,JSON['stringify'](_0x435515));_0x473efa(_0x435515);})[_0xc4cb('0x17')](function(_0x9bf54b){logger[_0xc4cb('0x13')](_0xc4cb('0x18'),_0x9bf54b['message'],_0x382513);_0x410a8a(_0x2b8dc1[_0xc4cb('0x13')](0x1f4,_0x9bf54b[_0xc4cb('0x15')]));});});}; \ No newline at end of file +var _0xc1d7=['result','SquareRecording','create','body','options','raw','CreateSquareRecording','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x135b78,_0x157be9){var _0x182042=function(_0xdba665){while(--_0xdba665){_0x135b78['push'](_0x135b78['shift']());}};_0x182042(++_0x157be9);}(_0xc1d7,0x10c));var _0x7c1d=function(_0x134de4,_0x49c839){_0x134de4=_0x134de4-0x0;var _0xe97f36=_0xc1d7[_0x134de4];return _0xe97f36;};'use strict';var _=require(_0x7c1d('0x0'));var util=require(_0x7c1d('0x1'));var moment=require(_0x7c1d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c1d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c1d('0x4'))(_0x7c1d('0x5'));var config=require(_0x7c1d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7c1d('0x7')][_0x7c1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ce8e9,_0x2b79e9,_0x9eaeda){return new BPromise(function(_0x1f2cf4,_0x5259ba){return client['request'](_0x5ce8e9,_0x9eaeda)[_0x7c1d('0x9')](function(_0x329132){logger[_0x7c1d('0xa')](_0x7c1d('0xb'),_0x2b79e9,_0x7c1d('0xc'));logger[_0x7c1d('0xd')](_0x7c1d('0xe'),_0x2b79e9,'request\x20sent',JSON[_0x7c1d('0xf')](_0x329132));if(_0x329132[_0x7c1d('0x10')]){if(_0x329132[_0x7c1d('0x10')]['code']===0x1f4){logger['error'](_0x7c1d('0xb'),_0x2b79e9,_0x329132[_0x7c1d('0x10')]['message']);return _0x5259ba(_0x329132[_0x7c1d('0x10')]['message']);}logger[_0x7c1d('0x10')](_0x7c1d('0xb'),_0x2b79e9,_0x329132[_0x7c1d('0x10')][_0x7c1d('0x11')]);return _0x1f2cf4(_0x329132[_0x7c1d('0x10')][_0x7c1d('0x11')]);}else{logger['info'](_0x7c1d('0xb'),_0x2b79e9,_0x7c1d('0xc'));_0x1f2cf4(_0x329132[_0x7c1d('0x12')][_0x7c1d('0x11')]);}})['catch'](function(_0x33dd23){logger['error']('SquareRecording,\x20%s,\x20%s',_0x2b79e9,_0x33dd23);_0x5259ba(_0x33dd23);});});}exports['CreateSquareRecording']=function(_0x5798bc){var _0x25c9d5=this;return new Promise(function(_0x14f134,_0x38a092){return db[_0x7c1d('0x13')][_0x7c1d('0x14')](_0x5798bc[_0x7c1d('0x15')],{'raw':_0x5798bc[_0x7c1d('0x16')]?_0x5798bc['options'][_0x7c1d('0x17')]===undefined?!![]:![]:!![]})[_0x7c1d('0x9')](function(_0x377c57){logger['info'](_0x7c1d('0x18'),_0x5798bc);logger[_0x7c1d('0xd')](_0x7c1d('0x18'),_0x5798bc,JSON['stringify'](_0x377c57));_0x14f134(_0x377c57);})[_0x7c1d('0x19')](function(_0xe9404b){logger[_0x7c1d('0x10')](_0x7c1d('0x18'),_0xe9404b['message'],_0x5798bc);_0x38a092(_0x25c9d5['error'](0x1f4,_0xe9404b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 21f9bde..08ae118 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x38a63b,_0x67227b){var _0xb8c0a0=function(_0x4676db){while(--_0x4676db){_0x38a63b['push'](_0x38a63b['shift']());}};_0xb8c0a0(++_0x67227b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x34ccc9,_0x2c3b78){var _0x578733=function(_0x47a7b8){while(--_0x47a7b8){_0x34ccc9['push'](_0x34ccc9['shift']());}};_0x578733(++_0x2c3b78);}(_0xe706,0xa3));var _0x6e70=function(_0x87eee5,_0x581852){_0x87eee5=_0x87eee5-0x0;var _0x17e2dc=_0xe706[_0x87eee5];return _0x17e2dc;};'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 17186eb..f341bbf 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 _0xe48b=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x49f096,_0xfc45e){var _0x515854=function(_0x3ad888){while(--_0x3ad888){_0x49f096['push'](_0x49f096['shift']());}};_0x515854(++_0xfc45e);}(_0xe48b,0x129));var _0xbe48=function(_0x16a141,_0x36b454){_0x16a141=_0x16a141-0x0;var _0x3afc0a=_0xe48b[_0x16a141];return _0x3afc0a;};'use strict';var Sequelize=require(_0xbe48('0x0'));module[_0xbe48('0x1')]={'network':{'type':Sequelize[_0xbe48('0x2')]},'network_script':{'type':Sequelize[_0xbe48('0x2')]},'request':{'type':Sequelize[_0xbe48('0x2')]},'channel':{'type':Sequelize[_0xbe48('0x2')]},'language':{'type':Sequelize[_0xbe48('0x2')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xbe48('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xbe48('0x2')]},'calleridname':{'type':Sequelize[_0xbe48('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xbe48('0x2')]},'callingtns':{'type':Sequelize[_0xbe48('0x2')]},'dnid':{'type':Sequelize[_0xbe48('0x2')]},'rdnis':{'type':Sequelize[_0xbe48('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbe48('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xbe48('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xbe48('0x2')]},'project_name':{'type':Sequelize[_0xbe48('0x2')]},'joinAt':{'type':Sequelize[_0xbe48('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xbe48('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x2b79=['DATE','sequelize','exports','STRING'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x2b79,0x7d));var _0x92b7=function(_0x141e03,_0x18340e){_0x141e03=_0x141e03-0x0;var _0x2074e3=_0x2b79[_0x141e03];return _0x2074e3;};'use strict';var Sequelize=require(_0x92b7('0x0'));module[_0x92b7('0x1')]={'network':{'type':Sequelize[_0x92b7('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x92b7('0x2')]},'channel':{'type':Sequelize[_0x92b7('0x2')]},'language':{'type':Sequelize[_0x92b7('0x2')]},'type':{'type':Sequelize[_0x92b7('0x2')]},'uniqueid':{'type':Sequelize[_0x92b7('0x2')]},'version':{'type':Sequelize[_0x92b7('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x92b7('0x2')]},'callingani2':{'type':Sequelize[_0x92b7('0x2')]},'callington':{'type':Sequelize[_0x92b7('0x2')]},'callingtns':{'type':Sequelize[_0x92b7('0x2')]},'dnid':{'type':Sequelize[_0x92b7('0x2')]},'rdnis':{'type':Sequelize[_0x92b7('0x2')]},'context':{'type':Sequelize[_0x92b7('0x2')]},'extension':{'type':Sequelize[_0x92b7('0x2')]},'priority':{'type':Sequelize[_0x92b7('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x92b7('0x2')]},'threadid':{'type':Sequelize[_0x92b7('0x2')]},'project_name':{'type':Sequelize[_0x92b7('0x2')]},'joinAt':{'type':Sequelize[_0x92b7('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'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 0fb034c..175382e 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 _0x399d=['attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','SquareReport','includeAll','rows','catch','show','include','find','create','update','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x1eba37,_0x4e5cfa){var _0xdea13=function(_0x4f49a6){while(--_0x4f49a6){_0x1eba37['push'](_0x1eba37['shift']());}};_0xdea13(++_0x4e5cfa);}(_0x399d,0x145));var _0xd399=function(_0x3d34e5,_0x4e1d74){_0x3d34e5=_0x3d34e5-0x0;var _0x378aa5=_0x399d[_0x3d34e5];return _0x378aa5;};'use strict';var emlformat=require(_0xd399('0x0'));var rimraf=require(_0xd399('0x1'));var zipdir=require(_0xd399('0x2'));var jsonpatch=require(_0xd399('0x3'));var rp=require(_0xd399('0x4'));var moment=require(_0xd399('0x5'));var BPromise=require(_0xd399('0x6'));var Mustache=require(_0xd399('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd399('0x8'));var ejs=require(_0xd399('0x9'));var fs=require('fs');var fs_extra=require(_0xd399('0xa'));var _=require(_0xd399('0xb'));var squel=require(_0xd399('0xc'));var crypto=require(_0xd399('0xd'));var jsforce=require(_0xd399('0xe'));var deskjs=require(_0xd399('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd399('0x10'));var Papa=require('papaparse');var Redis=require(_0xd399('0x11'));var authService=require(_0xd399('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd399('0x13'));var hardwareService=require(_0xd399('0x14'));var logger=require(_0xd399('0x15'))(_0xd399('0x16'));var utils=require('../../config/utils');var config=require(_0xd399('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd399('0x18'))['db'];function respondWithStatusCode(_0x3ab75a,_0x3d3226){_0x3d3226=_0x3d3226||0xcc;return function(_0x21b9b3){if(_0x21b9b3){return _0x3ab75a[_0xd399('0x19')](_0x3d3226);}return _0x3ab75a[_0xd399('0x1a')](_0x3d3226)[_0xd399('0x1b')]();};}function respondWithResult(_0x340cfe,_0x5bff06){_0x5bff06=_0x5bff06||0xc8;return function(_0x33ab16){if(_0x33ab16){return _0x340cfe[_0xd399('0x1a')](_0x5bff06)[_0xd399('0x1c')](_0x33ab16);}};}function respondWithFilteredResult(_0x33abd4,_0x37cd22){return function(_0xb0b90d){if(_0xb0b90d){var _0x39305e=typeof _0x37cd22[_0xd399('0x1d')]===_0xd399('0x1e')&&typeof _0x37cd22[_0xd399('0x1f')]===_0xd399('0x1e');var _0x1688b0=_0xb0b90d[_0xd399('0x20')];var _0x40357e=_0x39305e?0x0:_0x37cd22[_0xd399('0x1d')];var _0x474770=_0x39305e?_0xb0b90d[_0xd399('0x20')]:_0x37cd22['offset']+_0x37cd22[_0xd399('0x1f')];var _0x19c7fc;if(_0x474770>=_0x1688b0){_0x474770=_0x1688b0;_0x19c7fc=0xc8;}else{_0x19c7fc=0xce;}_0x33abd4[_0xd399('0x1a')](_0x19c7fc);return _0x33abd4['set']('Content-Range',_0x40357e+'-'+_0x474770+'/'+_0x1688b0)['json'](_0xb0b90d);}return null;};}function patchUpdates(_0x551fd4){return function(_0x236639){try{jsonpatch[_0xd399('0x21')](_0x236639,_0x551fd4,!![]);}catch(_0x452e7f){return BPromise[_0xd399('0x22')](_0x452e7f);}return _0x236639['save']();};}function saveUpdates(_0x6cc59f,_0x48651c){return function(_0x4c9e0a){if(_0x4c9e0a){return _0x4c9e0a['update'](_0x6cc59f)[_0xd399('0x23')](function(_0x5cfca8){return _0x5cfca8;});}return null;};}function removeEntity(_0x2b8100,_0x2db8f7){return function(_0x206f16){if(_0x206f16){return _0x206f16['destroy']()[_0xd399('0x23')](function(){_0x2b8100[_0xd399('0x1a')](0xcc)[_0xd399('0x1b')]();});}};}function handleEntityNotFound(_0x52e9c0,_0x249371){return function(_0x1ea9f6){if(!_0x1ea9f6){_0x52e9c0[_0xd399('0x19')](0x194);}return _0x1ea9f6;};}function handleError(_0xb35049,_0x3fd754){_0x3fd754=_0x3fd754||0x1f4;return function(_0x2d5187){logger[_0xd399('0x24')](_0x2d5187[_0xd399('0x25')]);if(_0x2d5187[_0xd399('0x26')]){delete _0x2d5187[_0xd399('0x26')];}_0xb35049[_0xd399('0x1a')](_0x3fd754)[_0xd399('0x27')](_0x2d5187);};}exports[_0xd399('0x28')]=function(_0x37e825,_0x212ea1){var _0x3fd690={},_0x42fcc7={},_0x502f02={'count':0x0,'rows':[]};var _0x171ad5=_['map'](db['SquareReport'][_0xd399('0x29')],function(_0x11f157){return{'name':_0x11f157[_0xd399('0x2a')],'type':_0x11f157[_0xd399('0x2b')][_0xd399('0x2c')]};});_0x42fcc7[_0xd399('0x2d')]=_[_0xd399('0x2e')](_0x171ad5,_0xd399('0x26'));_0x42fcc7[_0xd399('0x2f')]=_[_0xd399('0x30')](_0x37e825[_0xd399('0x2f')]);_0x42fcc7[_0xd399('0x31')]=_['intersection'](_0x42fcc7[_0xd399('0x2d')],_0x42fcc7['query']);_0x3fd690[_0xd399('0x32')]=_[_0xd399('0x33')](_0x42fcc7['model'],qs[_0xd399('0x34')](_0x37e825[_0xd399('0x2f')][_0xd399('0x34')]));_0x3fd690[_0xd399('0x32')]=_0x3fd690['attributes']['length']?_0x3fd690[_0xd399('0x32')]:_0x42fcc7[_0xd399('0x2d')];if(!_0x37e825['query'][_0xd399('0x35')](_0xd399('0x36'))){_0x3fd690['limit']=qs[_0xd399('0x1f')](_0x37e825['query'][_0xd399('0x1f')]);_0x3fd690[_0xd399('0x1d')]=qs[_0xd399('0x1d')](_0x37e825[_0xd399('0x2f')]['offset']);}_0x3fd690['order']=qs[_0xd399('0x37')](_0x37e825[_0xd399('0x2f')][_0xd399('0x37')]);_0x3fd690[_0xd399('0x38')]=qs[_0xd399('0x31')](_[_0xd399('0x39')](_0x37e825[_0xd399('0x2f')],_0x42fcc7['filters']),_0x171ad5);if(_0x37e825[_0xd399('0x2f')][_0xd399('0x3a')]){_0x3fd690[_0xd399('0x38')]=_[_0xd399('0x3b')](_0x3fd690[_0xd399('0x38')],{'$or':_[_0xd399('0x2e')](_0x171ad5,function(_0x58f84e){if(_0x58f84e[_0xd399('0x2b')]!==_0xd399('0x3c')){var _0x42bfe8={};_0x42bfe8[_0x58f84e[_0xd399('0x26')]]={'$like':'%'+_0x37e825['query']['filter']+'%'};return _0x42bfe8;}})});}_0x3fd690=_[_0xd399('0x3b')]({},_0x3fd690,_0x37e825[_0xd399('0x3d')]);var _0x52b620={'where':_0x3fd690['where']};return db[_0xd399('0x3e')]['count'](_0x52b620)['then'](function(_0x1587a3){_0x502f02[_0xd399('0x20')]=_0x1587a3;if(_0x37e825[_0xd399('0x2f')][_0xd399('0x3f')]){_0x3fd690['include']=[{'all':!![]}];}return db[_0xd399('0x3e')]['findAll'](_0x3fd690);})[_0xd399('0x23')](function(_0x4bad56){_0x502f02[_0xd399('0x40')]=_0x4bad56;return _0x502f02;})[_0xd399('0x23')](respondWithFilteredResult(_0x212ea1,_0x3fd690))[_0xd399('0x41')](handleError(_0x212ea1,null));};exports[_0xd399('0x42')]=function(_0x241315,_0x484779){var _0x498639={'raw':!![],'where':{'id':_0x241315['params']['id']}},_0x3785ca={};_0x3785ca[_0xd399('0x2d')]=_['keys'](db[_0xd399('0x3e')][_0xd399('0x29')]);_0x3785ca['query']=_[_0xd399('0x30')](_0x241315['query']);_0x3785ca['filters']=_[_0xd399('0x33')](_0x3785ca[_0xd399('0x2d')],_0x3785ca[_0xd399('0x2f')]);_0x498639[_0xd399('0x32')]=_[_0xd399('0x33')](_0x3785ca[_0xd399('0x2d')],qs['fields'](_0x241315['query'][_0xd399('0x34')]));_0x498639[_0xd399('0x32')]=_0x498639[_0xd399('0x32')]['length']?_0x498639['attributes']:_0x3785ca['model'];if(_0x241315[_0xd399('0x2f')]['includeAll']){_0x498639[_0xd399('0x43')]=[{'all':!![]}];}_0x498639=_[_0xd399('0x3b')]({},_0x498639,_0x241315[_0xd399('0x3d')]);return db['SquareReport'][_0xd399('0x44')](_0x498639)[_0xd399('0x23')](handleEntityNotFound(_0x484779,null))[_0xd399('0x23')](respondWithResult(_0x484779,null))[_0xd399('0x41')](handleError(_0x484779,null));};exports[_0xd399('0x45')]=function(_0x40bb45,_0x3b58e6){return db[_0xd399('0x3e')][_0xd399('0x45')](_0x40bb45['body'],{})[_0xd399('0x23')](respondWithResult(_0x3b58e6,0xc9))[_0xd399('0x41')](handleError(_0x3b58e6,null));};exports[_0xd399('0x46')]=function(_0x11713d,_0x5a177e){if(_0x11713d[_0xd399('0x47')]['id']){delete _0x11713d[_0xd399('0x47')]['id'];}return db[_0xd399('0x3e')][_0xd399('0x44')]({'where':{'id':_0x11713d[_0xd399('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a177e,null))[_0xd399('0x23')](saveUpdates(_0x11713d[_0xd399('0x47')],null))[_0xd399('0x23')](respondWithResult(_0x5a177e,null))[_0xd399('0x41')](handleError(_0x5a177e,null));};exports[_0xd399('0x49')]=function(_0x54f506,_0x389de5){return db[_0xd399('0x3e')][_0xd399('0x44')]({'where':{'id':_0x54f506[_0xd399('0x48')]['id']}})['then'](handleEntityNotFound(_0x389de5,null))['then'](removeEntity(_0x389de5,null))['catch'](handleError(_0x389de5,null));};exports[_0xd399('0x4a')]=function(_0x4be4d4,_0x10f19a){return db['SquareReport'][_0xd399('0x4a')]()[_0xd399('0x23')](respondWithResult(_0x10f19a,null))[_0xd399('0x41')](handleError(_0x10f19a,null));}; \ No newline at end of file +var _0x2d97=['count','limit','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SquareReport','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','params','length','include','find','create','body','catch','destroy','describe','eml-format','rimraf','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/license/util','../../mysqldb','sendStatus','end','offset','undefined'];(function(_0x19311a,_0x2d2679){var _0x42617c=function(_0x43227d){while(--_0x43227d){_0x19311a['push'](_0x19311a['shift']());}};_0x42617c(++_0x2d2679);}(_0x2d97,0x119));var _0x72d9=function(_0x5a8340,_0x1dc148){_0x5a8340=_0x5a8340-0x0;var _0x36e025=_0x2d97[_0x5a8340];return _0x36e025;};'use strict';var emlformat=require(_0x72d9('0x0'));var rimraf=require(_0x72d9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x72d9('0x2'));var moment=require(_0x72d9('0x3'));var BPromise=require(_0x72d9('0x4'));var Mustache=require(_0x72d9('0x5'));var util=require(_0x72d9('0x6'));var path=require(_0x72d9('0x7'));var sox=require(_0x72d9('0x8'));var csv=require(_0x72d9('0x9'));var ejs=require(_0x72d9('0xa'));var fs=require('fs');var fs_extra=require(_0x72d9('0xb'));var _=require(_0x72d9('0xc'));var squel=require(_0x72d9('0xd'));var crypto=require(_0x72d9('0xe'));var jsforce=require(_0x72d9('0xf'));var deskjs=require(_0x72d9('0x10'));var toCsv=require('to-csv');var querystring=require(_0x72d9('0x11'));var Papa=require(_0x72d9('0x12'));var Redis=require('ioredis');var authService=require(_0x72d9('0x13'));var qs=require(_0x72d9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72d9('0x15'));var logger=require(_0x72d9('0x16'))(_0x72d9('0x17'));var utils=require(_0x72d9('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x72d9('0x19'));var db=require(_0x72d9('0x1a'))['db'];function respondWithStatusCode(_0x5e7f5d,_0x56db11){_0x56db11=_0x56db11||0xcc;return function(_0x431dc8){if(_0x431dc8){return _0x5e7f5d[_0x72d9('0x1b')](_0x56db11);}return _0x5e7f5d['status'](_0x56db11)[_0x72d9('0x1c')]();};}function respondWithResult(_0x265f96,_0x1b7f50){_0x1b7f50=_0x1b7f50||0xc8;return function(_0x4e0fa3){if(_0x4e0fa3){return _0x265f96['status'](_0x1b7f50)['json'](_0x4e0fa3);}};}function respondWithFilteredResult(_0x1ba77e,_0x8b825){return function(_0x3a3941){if(_0x3a3941){var _0x15e0c2=typeof _0x8b825[_0x72d9('0x1d')]===_0x72d9('0x1e')&&typeof _0x8b825['limit']===_0x72d9('0x1e');var _0x4301af=_0x3a3941[_0x72d9('0x1f')];var _0x4db5ce=_0x15e0c2?0x0:_0x8b825[_0x72d9('0x1d')];var _0xe437e8=_0x15e0c2?_0x3a3941[_0x72d9('0x1f')]:_0x8b825[_0x72d9('0x1d')]+_0x8b825[_0x72d9('0x20')];var _0x454c11;if(_0xe437e8>=_0x4301af){_0xe437e8=_0x4301af;_0x454c11=0xc8;}else{_0x454c11=0xce;}_0x1ba77e[_0x72d9('0x21')](_0x454c11);return _0x1ba77e[_0x72d9('0x22')](_0x72d9('0x23'),_0x4db5ce+'-'+_0xe437e8+'/'+_0x4301af)['json'](_0x3a3941);}return null;};}function patchUpdates(_0x5900d6){return function(_0xd6847){try{jsonpatch[_0x72d9('0x24')](_0xd6847,_0x5900d6,!![]);}catch(_0x30adad){return BPromise[_0x72d9('0x25')](_0x30adad);}return _0xd6847[_0x72d9('0x26')]();};}function saveUpdates(_0x4dc322,_0x5dd12e){return function(_0x4351b6){if(_0x4351b6){return _0x4351b6[_0x72d9('0x27')](_0x4dc322)[_0x72d9('0x28')](function(_0x5385eb){return _0x5385eb;});}return null;};}function removeEntity(_0x44fda2,_0x385dfc){return function(_0x2058e7){if(_0x2058e7){return _0x2058e7['destroy']()[_0x72d9('0x28')](function(){_0x44fda2[_0x72d9('0x21')](0xcc)[_0x72d9('0x1c')]();});}};}function handleEntityNotFound(_0x4a88af,_0x4d4580){return function(_0x2c4218){if(!_0x2c4218){_0x4a88af['sendStatus'](0x194);}return _0x2c4218;};}function handleError(_0x24fe9a,_0x333b17){_0x333b17=_0x333b17||0x1f4;return function(_0x45bea7){logger[_0x72d9('0x29')](_0x45bea7[_0x72d9('0x2a')]);if(_0x45bea7[_0x72d9('0x2b')]){delete _0x45bea7[_0x72d9('0x2b')];}_0x24fe9a[_0x72d9('0x21')](_0x333b17)[_0x72d9('0x2c')](_0x45bea7);};}exports[_0x72d9('0x2d')]=function(_0x482b33,_0x963a34){var _0x22809a={},_0x53ef76={},_0xee8ee6={'count':0x0,'rows':[]};var _0x38f994=_['map'](db[_0x72d9('0x2e')][_0x72d9('0x2f')],function(_0x348d1b){return{'name':_0x348d1b[_0x72d9('0x30')],'type':_0x348d1b['type']['key']};});_0x53ef76['model']=_[_0x72d9('0x31')](_0x38f994,_0x72d9('0x2b'));_0x53ef76[_0x72d9('0x32')]=_[_0x72d9('0x33')](_0x482b33['query']);_0x53ef76[_0x72d9('0x34')]=_[_0x72d9('0x35')](_0x53ef76[_0x72d9('0x36')],_0x53ef76[_0x72d9('0x32')]);_0x22809a[_0x72d9('0x37')]=_[_0x72d9('0x35')](_0x53ef76['model'],qs[_0x72d9('0x38')](_0x482b33[_0x72d9('0x32')][_0x72d9('0x38')]));_0x22809a[_0x72d9('0x37')]=_0x22809a[_0x72d9('0x37')]['length']?_0x22809a['attributes']:_0x53ef76[_0x72d9('0x36')];if(!_0x482b33[_0x72d9('0x32')][_0x72d9('0x39')]('nolimit')){_0x22809a[_0x72d9('0x20')]=qs['limit'](_0x482b33[_0x72d9('0x32')][_0x72d9('0x20')]);_0x22809a[_0x72d9('0x1d')]=qs[_0x72d9('0x1d')](_0x482b33[_0x72d9('0x32')][_0x72d9('0x1d')]);}_0x22809a['order']=qs[_0x72d9('0x3a')](_0x482b33[_0x72d9('0x32')][_0x72d9('0x3a')]);_0x22809a['where']=qs[_0x72d9('0x34')](_[_0x72d9('0x3b')](_0x482b33[_0x72d9('0x32')],_0x53ef76[_0x72d9('0x34')]),_0x38f994);if(_0x482b33[_0x72d9('0x32')][_0x72d9('0x3c')]){_0x22809a[_0x72d9('0x3d')]=_['merge'](_0x22809a[_0x72d9('0x3d')],{'$or':_[_0x72d9('0x31')](_0x38f994,function(_0x2880ab){if(_0x2880ab[_0x72d9('0x3e')]!==_0x72d9('0x3f')){var _0x21aaea={};_0x21aaea[_0x2880ab[_0x72d9('0x2b')]]={'$like':'%'+_0x482b33[_0x72d9('0x32')]['filter']+'%'};return _0x21aaea;}})});}_0x22809a=_[_0x72d9('0x40')]({},_0x22809a,_0x482b33[_0x72d9('0x41')]);var _0x31b61b={'where':_0x22809a[_0x72d9('0x3d')]};return db['SquareReport'][_0x72d9('0x1f')](_0x31b61b)[_0x72d9('0x28')](function(_0x1955e0){_0xee8ee6[_0x72d9('0x1f')]=_0x1955e0;if(_0x482b33['query'][_0x72d9('0x42')]){_0x22809a['include']=[{'all':!![]}];}return db[_0x72d9('0x2e')][_0x72d9('0x43')](_0x22809a);})['then'](function(_0x1d586c){_0xee8ee6[_0x72d9('0x44')]=_0x1d586c;return _0xee8ee6;})[_0x72d9('0x28')](respondWithFilteredResult(_0x963a34,_0x22809a))['catch'](handleError(_0x963a34,null));};exports['show']=function(_0x4420f1,_0x2380c7){var _0x506d26={'raw':!![],'where':{'id':_0x4420f1[_0x72d9('0x45')]['id']}},_0x30110={};_0x30110[_0x72d9('0x36')]=_[_0x72d9('0x33')](db[_0x72d9('0x2e')][_0x72d9('0x2f')]);_0x30110['query']=_['keys'](_0x4420f1[_0x72d9('0x32')]);_0x30110['filters']=_[_0x72d9('0x35')](_0x30110['model'],_0x30110[_0x72d9('0x32')]);_0x506d26[_0x72d9('0x37')]=_[_0x72d9('0x35')](_0x30110[_0x72d9('0x36')],qs[_0x72d9('0x38')](_0x4420f1['query'][_0x72d9('0x38')]));_0x506d26[_0x72d9('0x37')]=_0x506d26[_0x72d9('0x37')][_0x72d9('0x46')]?_0x506d26[_0x72d9('0x37')]:_0x30110[_0x72d9('0x36')];if(_0x4420f1[_0x72d9('0x32')][_0x72d9('0x42')]){_0x506d26[_0x72d9('0x47')]=[{'all':!![]}];}_0x506d26=_[_0x72d9('0x40')]({},_0x506d26,_0x4420f1[_0x72d9('0x41')]);return db['SquareReport'][_0x72d9('0x48')](_0x506d26)[_0x72d9('0x28')](handleEntityNotFound(_0x2380c7,null))[_0x72d9('0x28')](respondWithResult(_0x2380c7,null))['catch'](handleError(_0x2380c7,null));};exports[_0x72d9('0x49')]=function(_0x46466e,_0x331215){return db['SquareReport'][_0x72d9('0x49')](_0x46466e['body'],{})[_0x72d9('0x28')](respondWithResult(_0x331215,0xc9))['catch'](handleError(_0x331215,null));};exports['update']=function(_0x56b23f,_0x49639b){if(_0x56b23f[_0x72d9('0x4a')]['id']){delete _0x56b23f['body']['id'];}return db[_0x72d9('0x2e')][_0x72d9('0x48')]({'where':{'id':_0x56b23f['params']['id']}})[_0x72d9('0x28')](handleEntityNotFound(_0x49639b,null))[_0x72d9('0x28')](saveUpdates(_0x56b23f['body'],null))['then'](respondWithResult(_0x49639b,null))[_0x72d9('0x4b')](handleError(_0x49639b,null));};exports[_0x72d9('0x4c')]=function(_0xab8307,_0x4105b8){return db['SquareReport'][_0x72d9('0x48')]({'where':{'id':_0xab8307[_0x72d9('0x45')]['id']}})['then'](handleEntityNotFound(_0x4105b8,null))['then'](removeEntity(_0x4105b8,null))['catch'](handleError(_0x4105b8,null));};exports[_0x72d9('0x4d')]=function(_0x587888,_0x1d0d5d){return db[_0x72d9('0x2e')][_0x72d9('0x4d')]()[_0x72d9('0x28')](respondWithResult(_0x1d0d5d,null))['catch'](handleError(_0x1d0d5d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 6ae5561..e362bb1 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 _0x76e8=['api','moment','bluebird','path','rimraf','define','SquareReport','report_square','project_name','leaveAt','lodash','util'];(function(_0x45b5ab,_0x5f2cfc){var _0x3392ea=function(_0x588f83){while(--_0x588f83){_0x45b5ab['push'](_0x45b5ab['shift']());}};_0x3392ea(++_0x5f2cfc);}(_0x76e8,0x17e));var _0x876e=function(_0x151df8,_0x5f2a77){_0x151df8=_0x151df8-0x0;var _0x1c1152=_0x76e8[_0x151df8];return _0x1c1152;};'use strict';var _=require(_0x876e('0x0'));var util=require(_0x876e('0x1'));var logger=require('../../config/logger')(_0x876e('0x2'));var moment=require(_0x876e('0x3'));var BPromise=require(_0x876e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x876e('0x5'));var rimraf=require(_0x876e('0x6'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module['exports']=function(_0x25fb91,_0x569f38){return _0x25fb91[_0x876e('0x7')](_0x876e('0x8'),attributes,{'tableName':_0x876e('0x9'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':['uniqueid',_0x876e('0xa')]},{'name':_0x876e('0xb'),'fields':[_0x876e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x51bb=['path','rimraf','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x51bb,0xfa));var _0xb51b=function(_0x127a9a,_0x37bde4){_0x127a9a=_0x127a9a-0x0;var _0x296b17=_0x51bb[_0x127a9a];return _0x296b17;};'use strict';var _=require(_0xb51b('0x0'));var util=require('util');var logger=require(_0xb51b('0x1'))('api');var moment=require(_0xb51b('0x2'));var BPromise=require(_0xb51b('0x3'));var rp=require(_0xb51b('0x4'));var fs=require('fs');var path=require(_0xb51b('0x5'));var rimraf=require(_0xb51b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb51b('0x7'));module[_0xb51b('0x8')]=function(_0x1ed9dc,_0x156cc0){return _0x1ed9dc[_0xb51b('0x9')]('SquareReport',attributes,{'tableName':_0xb51b('0xa'),'paranoid':![],'indexes':[{'name':_0xb51b('0xb'),'fields':[_0xb51b('0xc'),_0xb51b('0xd')]},{'name':_0xb51b('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 00a3110..c8db85c 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 _0x1f4f=['message','info','result','catch','CreateSquareReport','SquareReport','create','body','options','UpdateSquareReport','update','raw','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x486b6d,_0x9d56d2){var _0x47fa88=function(_0x3ea7cd){while(--_0x3ea7cd){_0x486b6d['push'](_0x486b6d['shift']());}};_0x47fa88(++_0x9d56d2);}(_0x1f4f,0xb8));var _0xf1f4=function(_0x2ef96b,_0x79b611){_0x2ef96b=_0x2ef96b-0x0;var _0x191957=_0x1f4f[_0x2ef96b];return _0x191957;};'use strict';var _=require(_0xf1f4('0x0'));var util=require(_0xf1f4('0x1'));var moment=require('moment');var BPromise=require(_0xf1f4('0x2'));var rs=require(_0xf1f4('0x3'));var fs=require('fs');var Redis=require(_0xf1f4('0x4'));var db=require(_0xf1f4('0x5'))['db'];var utils=require(_0xf1f4('0x6'));var logger=require(_0xf1f4('0x7'))(_0xf1f4('0x8'));var config=require(_0xf1f4('0x9'));var jayson=require(_0xf1f4('0xa'));var client=jayson['client'][_0xf1f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c25a,_0x366372,_0x547668){return new BPromise(function(_0x3235b9,_0x5c4ab7){return client['request'](_0x59c25a,_0x547668)[_0xf1f4('0xc')](function(_0xb56004){logger['info'](_0xf1f4('0xd'),_0x366372,'request\x20sent');logger[_0xf1f4('0xe')](_0xf1f4('0xf'),_0x366372,_0xf1f4('0x10'),JSON[_0xf1f4('0x11')](_0xb56004));if(_0xb56004[_0xf1f4('0x12')]){if(_0xb56004[_0xf1f4('0x12')][_0xf1f4('0x13')]===0x1f4){logger[_0xf1f4('0x12')](_0xf1f4('0xd'),_0x366372,_0xb56004[_0xf1f4('0x12')]['message']);return _0x5c4ab7(_0xb56004[_0xf1f4('0x12')]['message']);}logger[_0xf1f4('0x12')]('SquareReport,\x20%s,\x20%s',_0x366372,_0xb56004['error']['message']);return _0x3235b9(_0xb56004[_0xf1f4('0x12')][_0xf1f4('0x14')]);}else{logger[_0xf1f4('0x15')](_0xf1f4('0xd'),_0x366372,'request\x20sent');_0x3235b9(_0xb56004[_0xf1f4('0x16')][_0xf1f4('0x14')]);}})[_0xf1f4('0x17')](function(_0x5b25be){logger['error'](_0xf1f4('0xd'),_0x366372,_0x5b25be);_0x5c4ab7(_0x5b25be);});});}exports[_0xf1f4('0x18')]=function(_0x14d6ba){var _0x4c90f4=this;return new Promise(function(_0x594766,_0x5961b0){return db[_0xf1f4('0x19')][_0xf1f4('0x1a')](_0x14d6ba[_0xf1f4('0x1b')],{'raw':_0x14d6ba[_0xf1f4('0x1c')]?_0x14d6ba[_0xf1f4('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xf1f4('0xc')](function(_0x3fa5c9){logger['info'](_0xf1f4('0x18'),_0x14d6ba);logger['debug'](_0xf1f4('0x18'),_0x14d6ba,JSON[_0xf1f4('0x11')](_0x3fa5c9));_0x594766(_0x3fa5c9);})['catch'](function(_0x5e828e){logger['error'](_0xf1f4('0x18'),_0x5e828e[_0xf1f4('0x14')],_0x14d6ba);_0x5961b0(_0x4c90f4[_0xf1f4('0x12')](0x1f4,_0x5e828e[_0xf1f4('0x14')]));});});};exports[_0xf1f4('0x1d')]=function(_0x41cd3b){var _0x53e7cc=this;return new Promise(function(_0x4006c5,_0x5969d0){return db[_0xf1f4('0x19')][_0xf1f4('0x1e')](_0x41cd3b[_0xf1f4('0x1b')],{'raw':_0x41cd3b['options']?_0x41cd3b[_0xf1f4('0x1c')][_0xf1f4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41cd3b[_0xf1f4('0x1c')]?_0x41cd3b[_0xf1f4('0x1c')][_0xf1f4('0x20')]||null:null,'attributes':_0x41cd3b[_0xf1f4('0x1c')]?_0x41cd3b[_0xf1f4('0x1c')][_0xf1f4('0x21')]||null:null,'limit':_0x41cd3b['options']?_0x41cd3b['options']['limit']||null:null})['then'](function(_0x245fd9){logger[_0xf1f4('0x15')]('UpdateSquareReport',_0x41cd3b);logger[_0xf1f4('0xe')](_0xf1f4('0x1d'),_0x41cd3b,JSON[_0xf1f4('0x11')](_0x245fd9));_0x4006c5(_0x245fd9);})[_0xf1f4('0x17')](function(_0x3f41d4){logger[_0xf1f4('0x12')]('UpdateSquareReport',_0x3f41d4[_0xf1f4('0x14')],_0x41cd3b);_0x5969d0(_0x53e7cc[_0xf1f4('0x12')](0x1f4,_0x3f41d4[_0xf1f4('0x14')]));});});}; \ No newline at end of file +var _0x887f=['body','options','raw','update','where','limit','UpdateSquareReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport'];(function(_0x36ffb6,_0x3994d7){var _0x3e4377=function(_0x2ace52){while(--_0x2ace52){_0x36ffb6['push'](_0x36ffb6['shift']());}};_0x3e4377(++_0x3994d7);}(_0x887f,0x70));var _0xf887=function(_0x2fb212,_0x41d6a7){_0x2fb212=_0x2fb212-0x0;var _0x590c09=_0x887f[_0x2fb212];return _0x590c09;};'use strict';var _=require(_0xf887('0x0'));var util=require(_0xf887('0x1'));var moment=require(_0xf887('0x2'));var BPromise=require(_0xf887('0x3'));var rs=require(_0xf887('0x4'));var fs=require('fs');var Redis=require(_0xf887('0x5'));var db=require(_0xf887('0x6'))['db'];var utils=require(_0xf887('0x7'));var logger=require('../../config/logger')(_0xf887('0x8'));var config=require(_0xf887('0x9'));var jayson=require(_0xf887('0xa'));var client=jayson[_0xf887('0xb')][_0xf887('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd50f7c,_0x4d2ef5,_0x484515){return new BPromise(function(_0x34463c,_0x5b6406){return client[_0xf887('0xd')](_0xd50f7c,_0x484515)[_0xf887('0xe')](function(_0x14f071){logger[_0xf887('0xf')](_0xf887('0x10'),_0x4d2ef5,_0xf887('0x11'));logger[_0xf887('0x12')](_0xf887('0x13'),_0x4d2ef5,_0xf887('0x11'),JSON[_0xf887('0x14')](_0x14f071));if(_0x14f071[_0xf887('0x15')]){if(_0x14f071['error'][_0xf887('0x16')]===0x1f4){logger[_0xf887('0x15')](_0xf887('0x10'),_0x4d2ef5,_0x14f071['error'][_0xf887('0x17')]);return _0x5b6406(_0x14f071[_0xf887('0x15')][_0xf887('0x17')]);}logger[_0xf887('0x15')]('SquareReport,\x20%s,\x20%s',_0x4d2ef5,_0x14f071['error'][_0xf887('0x17')]);return _0x34463c(_0x14f071[_0xf887('0x15')][_0xf887('0x17')]);}else{logger['info'](_0xf887('0x10'),_0x4d2ef5,'request\x20sent');_0x34463c(_0x14f071[_0xf887('0x18')]['message']);}})[_0xf887('0x19')](function(_0x534cb1){logger[_0xf887('0x15')](_0xf887('0x10'),_0x4d2ef5,_0x534cb1);_0x5b6406(_0x534cb1);});});}exports[_0xf887('0x1a')]=function(_0x3b7e95){var _0x17e803=this;return new Promise(function(_0x5a9e6d,_0x4e5d0a){return db[_0xf887('0x1b')]['create'](_0x3b7e95[_0xf887('0x1c')],{'raw':_0x3b7e95[_0xf887('0x1d')]?_0x3b7e95[_0xf887('0x1d')][_0xf887('0x1e')]===undefined?!![]:![]:!![]})[_0xf887('0xe')](function(_0x415a37){logger[_0xf887('0xf')](_0xf887('0x1a'),_0x3b7e95);logger['debug'](_0xf887('0x1a'),_0x3b7e95,JSON[_0xf887('0x14')](_0x415a37));_0x5a9e6d(_0x415a37);})['catch'](function(_0x384fb9){logger[_0xf887('0x15')](_0xf887('0x1a'),_0x384fb9['message'],_0x3b7e95);_0x4e5d0a(_0x17e803[_0xf887('0x15')](0x1f4,_0x384fb9['message']));});});};exports['UpdateSquareReport']=function(_0x46a624){var _0x5e5785=this;return new Promise(function(_0x4bafd0,_0x32fa64){return db[_0xf887('0x1b')][_0xf887('0x1f')](_0x46a624[_0xf887('0x1c')],{'raw':_0x46a624[_0xf887('0x1d')]?_0x46a624[_0xf887('0x1d')][_0xf887('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a624[_0xf887('0x1d')]?_0x46a624[_0xf887('0x1d')][_0xf887('0x20')]||null:null,'attributes':_0x46a624[_0xf887('0x1d')]?_0x46a624[_0xf887('0x1d')]['attributes']||null:null,'limit':_0x46a624[_0xf887('0x1d')]?_0x46a624[_0xf887('0x1d')][_0xf887('0x21')]||null:null})['then'](function(_0x5924ec){logger[_0xf887('0xf')]('UpdateSquareReport',_0x46a624);logger['debug'](_0xf887('0x22'),_0x46a624,JSON[_0xf887('0x14')](_0x5924ec));_0x4bafd0(_0x5924ec);})[_0xf887('0x19')](function(_0x26002f){logger[_0xf887('0x15')](_0xf887('0x22'),_0x26002f[_0xf887('0x17')],_0x46a624);_0x32fa64(_0x5e5785[_0xf887('0x15')](0x1f4,_0x26002f[_0xf887('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 3b2d973..94bbec2 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 _0xef54=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update'];(function(_0xa28e29,_0x49f0ae){var _0x4f6cf7=function(_0x4659c6){while(--_0x4659c6){_0xa28e29['push'](_0xa28e29['shift']());}};_0x4f6cf7(++_0x49f0ae);}(_0xef54,0xdf));var _0x4ef5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xef54[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4ef5('0x0'));var util=require(_0x4ef5('0x1'));var path=require('path');var timeout=require(_0x4ef5('0x2'));var express=require(_0x4ef5('0x3'));var router=express[_0x4ef5('0x4')]();var fs_extra=require(_0x4ef5('0x5'));var auth=require(_0x4ef5('0x6'));var interaction=require(_0x4ef5('0x7'));var config=require('../../config/environment');var controller=require(_0x4ef5('0x8'));router[_0x4ef5('0x9')]('/',auth[_0x4ef5('0xa')](),controller[_0x4ef5('0xb')]);router[_0x4ef5('0x9')](_0x4ef5('0xc'),auth[_0x4ef5('0xa')](),controller[_0x4ef5('0xd')]);router[_0x4ef5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4ef5('0xe')]);router['post']('/',auth[_0x4ef5('0xa')](),controller[_0x4ef5('0xf')]);router[_0x4ef5('0x10')](_0x4ef5('0x11'),auth['isAuthenticated'](),controller[_0x4ef5('0x12')]);router[_0x4ef5('0x13')](_0x4ef5('0x11'),auth[_0x4ef5('0xa')](),controller[_0x4ef5('0x14')]);module[_0x4ef5('0x15')]=router; \ No newline at end of file +var _0xb854=['../../config/environment','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x8d4688,_0x5c101b){var _0x2f8a2b=function(_0xcc26f8){while(--_0xcc26f8){_0x8d4688['push'](_0x8d4688['shift']());}};_0x2f8a2b(++_0x5c101b);}(_0xb854,0x1bc));var _0x4b85=function(_0x1a7c1c,_0x492841){_0x1a7c1c=_0x1a7c1c-0x0;var _0xac2979=_0xb854[_0x1a7c1c];return _0xac2979;};'use strict';var multer=require(_0x4b85('0x0'));var util=require(_0x4b85('0x1'));var path=require(_0x4b85('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b85('0x3'));var auth=require(_0x4b85('0x4'));var interaction=require(_0x4b85('0x5'));var config=require(_0x4b85('0x6'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x4b85('0x7')](),controller[_0x4b85('0x8')]);router['get'](_0x4b85('0x9'),auth['isAuthenticated'](),controller[_0x4b85('0xa')]);router[_0x4b85('0xb')](_0x4b85('0xc'),auth[_0x4b85('0x7')](),controller[_0x4b85('0xd')]);router[_0x4b85('0xe')]('/',auth[_0x4b85('0x7')](),controller[_0x4b85('0xf')]);router['put'](_0x4b85('0xc'),auth['isAuthenticated'](),controller[_0x4b85('0x10')]);router['delete'](_0x4b85('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4b85('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index afb78e9..2bfb5e7 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 _0x26fc=['TEXT','sequelize','exports','STRING'];(function(_0x3f0970,_0x44eb03){var _0x11ad1c=function(_0x471b86){while(--_0x471b86){_0x3f0970['push'](_0x3f0970['shift']());}};_0x11ad1c(++_0x44eb03);}(_0x26fc,0x101));var _0xc26f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x26fc[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0xc26f('0x0'));module[_0xc26f('0x1')]={'uniqueid':{'type':Sequelize[_0xc26f('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xc26f('0x2')]},'data':{'type':Sequelize[_0xc26f('0x3')]},'project_name':{'type':Sequelize[_0xc26f('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6016=['TEXT','sequelize','exports','STRING'];(function(_0x4e236f,_0x45bfae){var _0x5303a5=function(_0x250c78){while(--_0x250c78){_0x4e236f['push'](_0x4e236f['shift']());}};_0x5303a5(++_0x45bfae);}(_0x6016,0x149));var _0x6601=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x6016[_0x21549c];return _0x426cbd;};'use strict';var Sequelize=require(_0x6601('0x0'));module[_0x6601('0x1')]={'uniqueid':{'type':Sequelize[_0x6601('0x2')]},'node':{'type':Sequelize[_0x6601('0x2')]},'application':{'type':Sequelize[_0x6601('0x2')]},'data':{'type':Sequelize[_0x6601('0x3')]},'project_name':{'type':Sequelize[_0x6601('0x2')]},'callerid':{'type':Sequelize[_0x6601('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 92a6607..2113584 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 _0x8917=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','reject','update','then','end','error','stack','name','send','SquareDetailsReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','options','includeAll','include','rows','show','find','create','body','catch','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x3b0662,_0x52aaaa){var _0x34c1d1=function(_0x186211){while(--_0x186211){_0x3b0662['push'](_0x3b0662['shift']());}};_0x34c1d1(++_0x52aaaa);}(_0x8917,0x116));var _0x7891=function(_0x45275d,_0x91c4c7){_0x45275d=_0x45275d-0x0;var _0x393526=_0x8917[_0x45275d];return _0x393526;};'use strict';var emlformat=require(_0x7891('0x0'));var rimraf=require(_0x7891('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7891('0x2'));var rp=require(_0x7891('0x3'));var moment=require(_0x7891('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7891('0x5'));var util=require(_0x7891('0x6'));var path=require(_0x7891('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7891('0x8'));var fs=require('fs');var fs_extra=require(_0x7891('0x9'));var _=require(_0x7891('0xa'));var squel=require(_0x7891('0xb'));var crypto=require(_0x7891('0xc'));var jsforce=require(_0x7891('0xd'));var deskjs=require(_0x7891('0xe'));var toCsv=require(_0x7891('0xf'));var querystring=require(_0x7891('0x10'));var Papa=require(_0x7891('0x11'));var Redis=require(_0x7891('0x12'));var authService=require(_0x7891('0x13'));var qs=require(_0x7891('0x14'));var as=require(_0x7891('0x15'));var hardwareService=require(_0x7891('0x16'));var logger=require(_0x7891('0x17'))(_0x7891('0x18'));var utils=require(_0x7891('0x19'));var config=require(_0x7891('0x1a'));var licenseUtil=require(_0x7891('0x1b'));var db=require(_0x7891('0x1c'))['db'];function respondWithStatusCode(_0x547068,_0x355406){_0x355406=_0x355406||0xcc;return function(_0x3b478e){if(_0x3b478e){return _0x547068[_0x7891('0x1d')](_0x355406);}return _0x547068[_0x7891('0x1e')](_0x355406)['end']();};}function respondWithResult(_0x1c9aad,_0xb2c64d){_0xb2c64d=_0xb2c64d||0xc8;return function(_0xe2dea4){if(_0xe2dea4){return _0x1c9aad['status'](_0xb2c64d)[_0x7891('0x1f')](_0xe2dea4);}};}function respondWithFilteredResult(_0x594581,_0x4592e1){return function(_0x4f40ef){if(_0x4f40ef){var _0x333743=typeof _0x4592e1[_0x7891('0x20')]==='undefined'&&typeof _0x4592e1['limit']===_0x7891('0x21');var _0x8c6b2d=_0x4f40ef['count'];var _0x4f7bc1=_0x333743?0x0:_0x4592e1[_0x7891('0x20')];var _0x4519df=_0x333743?_0x4f40ef[_0x7891('0x22')]:_0x4592e1[_0x7891('0x20')]+_0x4592e1['limit'];var _0x286743;if(_0x4519df>=_0x8c6b2d){_0x4519df=_0x8c6b2d;_0x286743=0xc8;}else{_0x286743=0xce;}_0x594581[_0x7891('0x1e')](_0x286743);return _0x594581[_0x7891('0x23')]('Content-Range',_0x4f7bc1+'-'+_0x4519df+'/'+_0x8c6b2d)[_0x7891('0x1f')](_0x4f40ef);}return null;};}function patchUpdates(_0x4399de){return function(_0x3b9f0a){try{jsonpatch['apply'](_0x3b9f0a,_0x4399de,!![]);}catch(_0x52623b){return BPromise[_0x7891('0x24')](_0x52623b);}return _0x3b9f0a['save']();};}function saveUpdates(_0x1261c4,_0x5dda94){return function(_0x5de68a){if(_0x5de68a){return _0x5de68a[_0x7891('0x25')](_0x1261c4)[_0x7891('0x26')](function(_0x21d4f4){return _0x21d4f4;});}return null;};}function removeEntity(_0x1d7463,_0x604ac5){return function(_0x561ad2){if(_0x561ad2){return _0x561ad2['destroy']()[_0x7891('0x26')](function(){_0x1d7463[_0x7891('0x1e')](0xcc)[_0x7891('0x27')]();});}};}function handleEntityNotFound(_0x2908ef,_0x47856c){return function(_0x158bf3){if(!_0x158bf3){_0x2908ef['sendStatus'](0x194);}return _0x158bf3;};}function handleError(_0x5c4fca,_0x41beaf){_0x41beaf=_0x41beaf||0x1f4;return function(_0x3fd38a){logger[_0x7891('0x28')](_0x3fd38a[_0x7891('0x29')]);if(_0x3fd38a[_0x7891('0x2a')]){delete _0x3fd38a[_0x7891('0x2a')];}_0x5c4fca[_0x7891('0x1e')](_0x41beaf)[_0x7891('0x2b')](_0x3fd38a);};}exports['index']=function(_0x3c56c2,_0x515c3a){var _0x2b5bae={},_0xc6de4d={},_0x531b56={'count':0x0,'rows':[]};var _0x1a98c6=_['map'](db[_0x7891('0x2c')]['rawAttributes'],function(_0x364d5f){return{'name':_0x364d5f['fieldName'],'type':_0x364d5f[_0x7891('0x2d')][_0x7891('0x2e')]};});_0xc6de4d[_0x7891('0x2f')]=_[_0x7891('0x30')](_0x1a98c6,_0x7891('0x2a'));_0xc6de4d[_0x7891('0x31')]=_[_0x7891('0x32')](_0x3c56c2['query']);_0xc6de4d[_0x7891('0x33')]=_[_0x7891('0x34')](_0xc6de4d[_0x7891('0x2f')],_0xc6de4d[_0x7891('0x31')]);_0x2b5bae[_0x7891('0x35')]=_[_0x7891('0x34')](_0xc6de4d[_0x7891('0x2f')],qs['fields'](_0x3c56c2[_0x7891('0x31')][_0x7891('0x36')]));_0x2b5bae[_0x7891('0x35')]=_0x2b5bae[_0x7891('0x35')][_0x7891('0x37')]?_0x2b5bae['attributes']:_0xc6de4d[_0x7891('0x2f')];if(!_0x3c56c2[_0x7891('0x31')][_0x7891('0x38')](_0x7891('0x39'))){_0x2b5bae[_0x7891('0x3a')]=qs['limit'](_0x3c56c2[_0x7891('0x31')][_0x7891('0x3a')]);_0x2b5bae[_0x7891('0x20')]=qs[_0x7891('0x20')](_0x3c56c2['query'][_0x7891('0x20')]);}_0x2b5bae['order']=qs[_0x7891('0x3b')](_0x3c56c2[_0x7891('0x31')]['sort']);_0x2b5bae[_0x7891('0x3c')]=qs['filters'](_['pick'](_0x3c56c2[_0x7891('0x31')],_0xc6de4d[_0x7891('0x33')]),_0x1a98c6);if(_0x3c56c2[_0x7891('0x31')][_0x7891('0x3d')]){_0x2b5bae[_0x7891('0x3c')]=_[_0x7891('0x3e')](_0x2b5bae[_0x7891('0x3c')],{'$or':_['map'](_0x1a98c6,function(_0x4fc63e){if(_0x4fc63e[_0x7891('0x2d')]!=='VIRTUAL'){var _0x2754f3={};_0x2754f3[_0x4fc63e[_0x7891('0x2a')]]={'$like':'%'+_0x3c56c2[_0x7891('0x31')][_0x7891('0x3d')]+'%'};return _0x2754f3;}})});}_0x2b5bae=_[_0x7891('0x3e')]({},_0x2b5bae,_0x3c56c2[_0x7891('0x3f')]);var _0x1b067f={'where':_0x2b5bae['where']};return db[_0x7891('0x2c')][_0x7891('0x22')](_0x1b067f)[_0x7891('0x26')](function(_0x4bd4fb){_0x531b56[_0x7891('0x22')]=_0x4bd4fb;if(_0x3c56c2[_0x7891('0x31')][_0x7891('0x40')]){_0x2b5bae[_0x7891('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x2b5bae);})[_0x7891('0x26')](function(_0x1fb44d){_0x531b56[_0x7891('0x42')]=_0x1fb44d;return _0x531b56;})['then'](respondWithFilteredResult(_0x515c3a,_0x2b5bae))['catch'](handleError(_0x515c3a,null));};exports[_0x7891('0x43')]=function(_0x3e8457,_0x44ef6c){var _0x1c0695={'raw':!![],'where':{'id':_0x3e8457['params']['id']}},_0x1037ed={};_0x1037ed[_0x7891('0x2f')]=_[_0x7891('0x32')](db[_0x7891('0x2c')]['rawAttributes']);_0x1037ed[_0x7891('0x31')]=_[_0x7891('0x32')](_0x3e8457['query']);_0x1037ed['filters']=_[_0x7891('0x34')](_0x1037ed[_0x7891('0x2f')],_0x1037ed[_0x7891('0x31')]);_0x1c0695['attributes']=_[_0x7891('0x34')](_0x1037ed['model'],qs['fields'](_0x3e8457['query'][_0x7891('0x36')]));_0x1c0695[_0x7891('0x35')]=_0x1c0695[_0x7891('0x35')][_0x7891('0x37')]?_0x1c0695[_0x7891('0x35')]:_0x1037ed[_0x7891('0x2f')];if(_0x3e8457['query'][_0x7891('0x40')]){_0x1c0695[_0x7891('0x41')]=[{'all':!![]}];}_0x1c0695=_[_0x7891('0x3e')]({},_0x1c0695,_0x3e8457[_0x7891('0x3f')]);return db['SquareDetailsReport'][_0x7891('0x44')](_0x1c0695)[_0x7891('0x26')](handleEntityNotFound(_0x44ef6c,null))[_0x7891('0x26')](respondWithResult(_0x44ef6c,null))['catch'](handleError(_0x44ef6c,null));};exports['create']=function(_0x2af09a,_0x2837e3){return db[_0x7891('0x2c')][_0x7891('0x45')](_0x2af09a[_0x7891('0x46')],{})[_0x7891('0x26')](respondWithResult(_0x2837e3,0xc9))[_0x7891('0x47')](handleError(_0x2837e3,null));};exports[_0x7891('0x25')]=function(_0x235828,_0x41c3c6){if(_0x235828['body']['id']){delete _0x235828[_0x7891('0x46')]['id'];}return db[_0x7891('0x2c')][_0x7891('0x44')]({'where':{'id':_0x235828[_0x7891('0x48')]['id']}})[_0x7891('0x26')](handleEntityNotFound(_0x41c3c6,null))['then'](saveUpdates(_0x235828[_0x7891('0x46')],null))[_0x7891('0x26')](respondWithResult(_0x41c3c6,null))[_0x7891('0x47')](handleError(_0x41c3c6,null));};exports['destroy']=function(_0x11ccbe,_0x5e3465){return db['SquareDetailsReport'][_0x7891('0x44')]({'where':{'id':_0x11ccbe[_0x7891('0x48')]['id']}})[_0x7891('0x26')](handleEntityNotFound(_0x5e3465,null))[_0x7891('0x26')](removeEntity(_0x5e3465,null))['catch'](handleError(_0x5e3465,null));};exports[_0x7891('0x49')]=function(_0x8717e6,_0x2ea06f){return db[_0x7891('0x2c')][_0x7891('0x49')]()[_0x7891('0x26')](respondWithResult(_0x2ea06f,null))['catch'](handleError(_0x2ea06f,null));}; \ No newline at end of file +var _0x77dd=['save','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','count','findAll','rows','catch','show','params','keys','include','options','find','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x77dd,0x1e9));var _0xd77d=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0x77dd[_0x567bcb];return _0x4eebc2;};'use strict';var emlformat=require(_0xd77d('0x0'));var rimraf=require(_0xd77d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd77d('0x2'));var rp=require(_0xd77d('0x3'));var moment=require(_0xd77d('0x4'));var BPromise=require(_0xd77d('0x5'));var Mustache=require(_0xd77d('0x6'));var util=require('util');var path=require(_0xd77d('0x7'));var sox=require('sox');var csv=require(_0xd77d('0x8'));var ejs=require(_0xd77d('0x9'));var fs=require('fs');var fs_extra=require(_0xd77d('0xa'));var _=require(_0xd77d('0xb'));var squel=require(_0xd77d('0xc'));var crypto=require(_0xd77d('0xd'));var jsforce=require(_0xd77d('0xe'));var deskjs=require(_0xd77d('0xf'));var toCsv=require(_0xd77d('0x8'));var querystring=require(_0xd77d('0x10'));var Papa=require(_0xd77d('0x11'));var Redis=require(_0xd77d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd77d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd77d('0x14'))(_0xd77d('0x15'));var utils=require(_0xd77d('0x16'));var config=require(_0xd77d('0x17'));var licenseUtil=require(_0xd77d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x349c7d,_0x5d1499){_0x5d1499=_0x5d1499||0xcc;return function(_0x290cd0){if(_0x290cd0){return _0x349c7d[_0xd77d('0x19')](_0x5d1499);}return _0x349c7d[_0xd77d('0x1a')](_0x5d1499)[_0xd77d('0x1b')]();};}function respondWithResult(_0x2c157e,_0x3c797a){_0x3c797a=_0x3c797a||0xc8;return function(_0xd72883){if(_0xd72883){return _0x2c157e[_0xd77d('0x1a')](_0x3c797a)['json'](_0xd72883);}};}function respondWithFilteredResult(_0x4d0e1c,_0x108d39){return function(_0x4be20b){if(_0x4be20b){var _0xf164bc=typeof _0x108d39['offset']===_0xd77d('0x1c')&&typeof _0x108d39[_0xd77d('0x1d')]==='undefined';var _0xea613b=_0x4be20b['count'];var _0x471483=_0xf164bc?0x0:_0x108d39[_0xd77d('0x1e')];var _0x309b3c=_0xf164bc?_0x4be20b['count']:_0x108d39[_0xd77d('0x1e')]+_0x108d39[_0xd77d('0x1d')];var _0x13d594;if(_0x309b3c>=_0xea613b){_0x309b3c=_0xea613b;_0x13d594=0xc8;}else{_0x13d594=0xce;}_0x4d0e1c[_0xd77d('0x1a')](_0x13d594);return _0x4d0e1c[_0xd77d('0x1f')](_0xd77d('0x20'),_0x471483+'-'+_0x309b3c+'/'+_0xea613b)[_0xd77d('0x21')](_0x4be20b);}return null;};}function patchUpdates(_0x174a90){return function(_0x19dadb){try{jsonpatch[_0xd77d('0x22')](_0x19dadb,_0x174a90,!![]);}catch(_0x31e3b3){return BPromise[_0xd77d('0x23')](_0x31e3b3);}return _0x19dadb[_0xd77d('0x24')]();};}function saveUpdates(_0x430bde,_0x3f2eb6){return function(_0x4702c){if(_0x4702c){return _0x4702c['update'](_0x430bde)[_0xd77d('0x25')](function(_0x2652ea){return _0x2652ea;});}return null;};}function removeEntity(_0x54aa4a,_0x27c7d0){return function(_0x2dbc44){if(_0x2dbc44){return _0x2dbc44['destroy']()[_0xd77d('0x25')](function(){_0x54aa4a[_0xd77d('0x1a')](0xcc)[_0xd77d('0x1b')]();});}};}function handleEntityNotFound(_0x2456b2,_0x4c8b2a){return function(_0xb4654b){if(!_0xb4654b){_0x2456b2[_0xd77d('0x19')](0x194);}return _0xb4654b;};}function handleError(_0x4a2c13,_0x18d486){_0x18d486=_0x18d486||0x1f4;return function(_0x1de32f){logger[_0xd77d('0x26')](_0x1de32f['stack']);if(_0x1de32f[_0xd77d('0x27')]){delete _0x1de32f[_0xd77d('0x27')];}_0x4a2c13['status'](_0x18d486)[_0xd77d('0x28')](_0x1de32f);};}exports[_0xd77d('0x29')]=function(_0x2b0995,_0xdec6d){var _0x1cc373={},_0x54d20f={},_0x391ee3={'count':0x0,'rows':[]};var _0x43568d=_['map'](db[_0xd77d('0x2a')][_0xd77d('0x2b')],function(_0x32c146){return{'name':_0x32c146[_0xd77d('0x2c')],'type':_0x32c146[_0xd77d('0x2d')]['key']};});_0x54d20f['model']=_[_0xd77d('0x2e')](_0x43568d,_0xd77d('0x27'));_0x54d20f[_0xd77d('0x2f')]=_['keys'](_0x2b0995[_0xd77d('0x2f')]);_0x54d20f[_0xd77d('0x30')]=_[_0xd77d('0x31')](_0x54d20f[_0xd77d('0x32')],_0x54d20f['query']);_0x1cc373[_0xd77d('0x33')]=_[_0xd77d('0x31')](_0x54d20f['model'],qs[_0xd77d('0x34')](_0x2b0995[_0xd77d('0x2f')]['fields']));_0x1cc373[_0xd77d('0x33')]=_0x1cc373[_0xd77d('0x33')][_0xd77d('0x35')]?_0x1cc373[_0xd77d('0x33')]:_0x54d20f[_0xd77d('0x32')];if(!_0x2b0995[_0xd77d('0x2f')][_0xd77d('0x36')](_0xd77d('0x37'))){_0x1cc373[_0xd77d('0x1d')]=qs[_0xd77d('0x1d')](_0x2b0995[_0xd77d('0x2f')][_0xd77d('0x1d')]);_0x1cc373[_0xd77d('0x1e')]=qs[_0xd77d('0x1e')](_0x2b0995[_0xd77d('0x2f')][_0xd77d('0x1e')]);}_0x1cc373[_0xd77d('0x38')]=qs[_0xd77d('0x39')](_0x2b0995[_0xd77d('0x2f')][_0xd77d('0x39')]);_0x1cc373[_0xd77d('0x3a')]=qs[_0xd77d('0x30')](_['pick'](_0x2b0995[_0xd77d('0x2f')],_0x54d20f[_0xd77d('0x30')]),_0x43568d);if(_0x2b0995['query'][_0xd77d('0x3b')]){_0x1cc373[_0xd77d('0x3a')]=_['merge'](_0x1cc373['where'],{'$or':_[_0xd77d('0x2e')](_0x43568d,function(_0x24c9f6){if(_0x24c9f6[_0xd77d('0x2d')]!==_0xd77d('0x3c')){var _0x4adeb4={};_0x4adeb4[_0x24c9f6[_0xd77d('0x27')]]={'$like':'%'+_0x2b0995[_0xd77d('0x2f')]['filter']+'%'};return _0x4adeb4;}})});}_0x1cc373=_[_0xd77d('0x3d')]({},_0x1cc373,_0x2b0995['options']);var _0x53f96e={'where':_0x1cc373[_0xd77d('0x3a')]};return db['SquareDetailsReport'][_0xd77d('0x3e')](_0x53f96e)[_0xd77d('0x25')](function(_0x182a0a){_0x391ee3[_0xd77d('0x3e')]=_0x182a0a;if(_0x2b0995[_0xd77d('0x2f')]['includeAll']){_0x1cc373['include']=[{'all':!![]}];}return db[_0xd77d('0x2a')][_0xd77d('0x3f')](_0x1cc373);})['then'](function(_0xaccdcf){_0x391ee3[_0xd77d('0x40')]=_0xaccdcf;return _0x391ee3;})[_0xd77d('0x25')](respondWithFilteredResult(_0xdec6d,_0x1cc373))[_0xd77d('0x41')](handleError(_0xdec6d,null));};exports[_0xd77d('0x42')]=function(_0x2c4ca6,_0x179e28){var _0x263351={'raw':!![],'where':{'id':_0x2c4ca6[_0xd77d('0x43')]['id']}},_0x1db899={};_0x1db899[_0xd77d('0x32')]=_['keys'](db[_0xd77d('0x2a')]['rawAttributes']);_0x1db899['query']=_[_0xd77d('0x44')](_0x2c4ca6[_0xd77d('0x2f')]);_0x1db899[_0xd77d('0x30')]=_['intersection'](_0x1db899[_0xd77d('0x32')],_0x1db899[_0xd77d('0x2f')]);_0x263351[_0xd77d('0x33')]=_[_0xd77d('0x31')](_0x1db899[_0xd77d('0x32')],qs[_0xd77d('0x34')](_0x2c4ca6[_0xd77d('0x2f')][_0xd77d('0x34')]));_0x263351[_0xd77d('0x33')]=_0x263351[_0xd77d('0x33')][_0xd77d('0x35')]?_0x263351['attributes']:_0x1db899[_0xd77d('0x32')];if(_0x2c4ca6[_0xd77d('0x2f')]['includeAll']){_0x263351[_0xd77d('0x45')]=[{'all':!![]}];}_0x263351=_[_0xd77d('0x3d')]({},_0x263351,_0x2c4ca6[_0xd77d('0x46')]);return db[_0xd77d('0x2a')][_0xd77d('0x47')](_0x263351)['then'](handleEntityNotFound(_0x179e28,null))['then'](respondWithResult(_0x179e28,null))[_0xd77d('0x41')](handleError(_0x179e28,null));};exports[_0xd77d('0x48')]=function(_0xa92c64,_0x67a59d){return db[_0xd77d('0x2a')][_0xd77d('0x48')](_0xa92c64[_0xd77d('0x49')],{})[_0xd77d('0x25')](respondWithResult(_0x67a59d,0xc9))['catch'](handleError(_0x67a59d,null));};exports[_0xd77d('0x4a')]=function(_0x2de0be,_0x1eb590){if(_0x2de0be[_0xd77d('0x49')]['id']){delete _0x2de0be[_0xd77d('0x49')]['id'];}return db[_0xd77d('0x2a')][_0xd77d('0x47')]({'where':{'id':_0x2de0be[_0xd77d('0x43')]['id']}})[_0xd77d('0x25')](handleEntityNotFound(_0x1eb590,null))[_0xd77d('0x25')](saveUpdates(_0x2de0be[_0xd77d('0x49')],null))[_0xd77d('0x25')](respondWithResult(_0x1eb590,null))[_0xd77d('0x41')](handleError(_0x1eb590,null));};exports['destroy']=function(_0x195bbd,_0x2bae3f){return db[_0xd77d('0x2a')][_0xd77d('0x47')]({'where':{'id':_0x195bbd[_0xd77d('0x43')]['id']}})[_0xd77d('0x25')](handleEntityNotFound(_0x2bae3f,null))[_0xd77d('0x25')](removeEntity(_0x2bae3f,null))[_0xd77d('0x41')](handleError(_0x2bae3f,null));};exports['describe']=function(_0x988b45,_0x2e308c){return db['SquareDetailsReport']['describe']()['then'](respondWithResult(_0x2e308c,null))[_0xd77d('0x41')](handleError(_0x2e308c,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 403f998..c0c30af 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 _0x2580=['SquareDetailsReport','report_square_details','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x48100f,_0x227fe9){var _0x1a6031=function(_0x28da37){while(--_0x28da37){_0x48100f['push'](_0x48100f['shift']());}};_0x1a6031(++_0x227fe9);}(_0x2580,0x1aa));var _0x0258=function(_0x158b1d,_0xe2dd83){_0x158b1d=_0x158b1d-0x0;var _0x336f90=_0x2580[_0x158b1d];return _0x336f90;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0258('0x0'));var rp=require(_0x0258('0x1'));var fs=require('fs');var path=require(_0x0258('0x2'));var rimraf=require(_0x0258('0x3'));var config=require(_0x0258('0x4'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x4b2e0b,_0x146573){return _0x4b2e0b[_0x0258('0x5')](_0x0258('0x6'),attributes,{'tableName':_0x0258('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f4d=['report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','SquareDetailsReport'];(function(_0x14e2b3,_0x238748){var _0x42ba26=function(_0x341f13){while(--_0x341f13){_0x14e2b3['push'](_0x14e2b3['shift']());}};_0x42ba26(++_0x238748);}(_0x8f4d,0x1d5));var _0xd8f4=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x8f4d[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0xd8f4('0x0'));var util=require(_0xd8f4('0x1'));var logger=require(_0xd8f4('0x2'))(_0xd8f4('0x3'));var moment=require('moment');var BPromise=require(_0xd8f4('0x4'));var rp=require(_0xd8f4('0x5'));var fs=require('fs');var path=require(_0xd8f4('0x6'));var rimraf=require(_0xd8f4('0x7'));var config=require(_0xd8f4('0x8'));var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x6011a2,_0x30914b){return _0x6011a2[_0xd8f4('0x9')](_0xd8f4('0xa'),attributes,{'tableName':_0xd8f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index d7c66d6..95ef78b 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 _0xe1e3=['jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x28238f,_0x2dcee9){var _0x81f2=function(_0x123f73){while(--_0x123f73){_0x28238f['push'](_0x28238f['shift']());}};_0x81f2(++_0x2dcee9);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3a30ce,_0x1d398b){_0x3a30ce=_0x3a30ce-0x0;var _0x12b346=_0xe1e3[_0x3a30ce];return _0x12b346;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['SquareDetailsReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateSquareDetailsReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});}; \ No newline at end of file +var _0xefda=['SquareDetailsReport,\x20%s,\x20%s','message','info','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x18bb8f,_0x14b28d){var _0x1b8a97=function(_0x6396ea){while(--_0x6396ea){_0x18bb8f['push'](_0x18bb8f['shift']());}};_0x1b8a97(++_0x14b28d);}(_0xefda,0x96));var _0xaefd=function(_0x35db8c,_0x46f5aa){_0x35db8c=_0x35db8c-0x0;var _0x2c3170=_0xefda[_0x35db8c];return _0x2c3170;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaefd('0x1'));var rs=require(_0xaefd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefd('0x3'))['db'];var utils=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));var config=require(_0xaefd('0x7'));var jayson=require(_0xaefd('0x8'));var client=jayson['client'][_0xaefd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9736,_0x24d10c,_0x1d76f3){return new BPromise(function(_0x4ce248,_0x15193c){return client[_0xaefd('0xa')](_0x3b9736,_0x1d76f3)[_0xaefd('0xb')](function(_0x4d44ed){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x24d10c,_0xaefd('0xc'));logger[_0xaefd('0xd')](_0xaefd('0xe'),_0x24d10c,_0xaefd('0xc'),JSON[_0xaefd('0xf')](_0x4d44ed));if(_0x4d44ed[_0xaefd('0x10')]){if(_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x11')]===0x1f4){logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')]['message']);return _0x15193c(_0x4d44ed[_0xaefd('0x10')]['message']);}logger[_0xaefd('0x10')](_0xaefd('0x12'),_0x24d10c,_0x4d44ed[_0xaefd('0x10')][_0xaefd('0x13')]);return _0x4ce248(_0x4d44ed['error'][_0xaefd('0x13')]);}else{logger[_0xaefd('0x14')](_0xaefd('0x12'),_0x24d10c,_0xaefd('0xc'));_0x4ce248(_0x4d44ed[_0xaefd('0x15')][_0xaefd('0x13')]);}})[_0xaefd('0x16')](function(_0x23d736){logger['error'](_0xaefd('0x12'),_0x24d10c,_0x23d736);_0x15193c(_0x23d736);});});}exports[_0xaefd('0x17')]=function(_0x9748f4){var _0x1737a1=this;return new Promise(function(_0x2db61b,_0x244956){return db['SquareDetailsReport'][_0xaefd('0x18')](_0x9748f4[_0xaefd('0x19')],{'raw':_0x9748f4[_0xaefd('0x1a')]?_0x9748f4[_0xaefd('0x1a')][_0xaefd('0x1b')]===undefined?!![]:![]:!![]})[_0xaefd('0xb')](function(_0x5282ed){logger[_0xaefd('0x14')](_0xaefd('0x17'),_0x9748f4);logger[_0xaefd('0xd')](_0xaefd('0x17'),_0x9748f4,JSON[_0xaefd('0xf')](_0x5282ed));_0x2db61b(_0x5282ed);})['catch'](function(_0x479486){logger['error'](_0xaefd('0x17'),_0x479486[_0xaefd('0x13')],_0x9748f4);_0x244956(_0x1737a1[_0xaefd('0x10')](0x1f4,_0x479486['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1569068..ae72863 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 _0x0031=['/process/:pid/kill','express','../../components/auth/service','./system.controller','isAuthenticated','get'];(function(_0x5f6e52,_0x465ccf){var _0x46a05d=function(_0xaecff0){while(--_0xaecff0){_0x5f6e52['push'](_0x5f6e52['shift']());}};_0x46a05d(++_0x465ccf);}(_0x0031,0x16f));var _0x1003=function(_0x50f460,_0xb8ccc7){_0x50f460=_0x50f460-0x0;var _0x33e2a8=_0x0031[_0x50f460];return _0x33e2a8;};'use strict';var express=require(_0x1003('0x0'));var router=express['Router']();var auth=require(_0x1003('0x1'));var controller=require(_0x1003('0x2'));router['get']('/',auth[_0x1003('0x3')](),controller['index']);router[_0x1003('0x4')](_0x1003('0x5'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xe357=['get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller'];(function(_0x280e10,_0x29b959){var _0x55b82b=function(_0x2fee29){while(--_0x2fee29){_0x280e10['push'](_0x280e10['shift']());}};_0x55b82b(++_0x29b959);}(_0xe357,0x10b));var _0x7e35=function(_0x212283,_0x517230){_0x212283=_0x212283-0x0;var _0x391557=_0xe357[_0x212283];return _0x391557;};'use strict';var express=require(_0x7e35('0x0'));var router=express['Router']();var auth=require(_0x7e35('0x1'));var controller=require(_0x7e35('0x2'));router[_0x7e35('0x3')]('/',auth[_0x7e35('0x4')](),controller[_0x7e35('0x5')]);router[_0x7e35('0x3')](_0x7e35('0x6'),auth[_0x7e35('0x4')](),controller[_0x7e35('0x7')]);module[_0x7e35('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0cd4c69..7183ae3 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 _0x1390=['lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','util'];(function(_0x50ab8d,_0xe86f04){var _0x1c96f2=function(_0xec2c74){while(--_0xec2c74){_0x50ab8d['push'](_0x50ab8d['shift']());}};_0x1c96f2(++_0xe86f04);}(_0x1390,0x7e));var _0x0139=function(_0x1c208a,_0x36a1da){_0x1c208a=_0x1c208a-0x0;var _0x2f3129=_0x1390[_0x1c208a];return _0x2f3129;};'use strict';var info=require('systeminformation');var exec=require(_0x0139('0x0'))[_0x0139('0x1')];var logger=require(_0x0139('0x2'))('api');var util=require(_0x0139('0x3'));var BPromise=require('bluebird');var _=require(_0x0139('0x4'));function handleError(_0x27b72e,_0x2b083b,_0x109446){_0x2b083b=_0x2b083b||0x1f4;return function(_0x4b78ff){logger[_0x0139('0x5')](_0x0139('0x6'),_0x109446,_0x2b083b,util[_0x0139('0x7')](_0x4b78ff,{'showHidden':![],'depth':null}));delete _0x4b78ff[_0x0139('0x8')];_0x27b72e[_0x0139('0x9')](_0x2b083b)[_0x0139('0xa')](_0x4b78ff);};}exports['index']=function(_0x122501,_0x52862e){return info[_0x0139('0xb')]()[_0x0139('0xc')](function(_0x542215){return _0x52862e['status'](0xc8)[_0x0139('0xd')](_0x542215);})[_0x0139('0xe')](function(_0x35c5c2){return _0x52862e['status'](0x1f4)[_0x0139('0xd')](_0x35c5c2);});};exports['killProcess']=function(_0x4eb2d6,_0x171530){var _0x2e4637=['components/import/cm'];return new BPromise(function(_0x405aff,_0x181b39){return exec(util[_0x0139('0xf')](_0x0139('0x10'),_0x4eb2d6[_0x0139('0x11')][_0x0139('0x12')]),function(_0x2fb123,_0x2c0e18,_0x35c9f6){if(_0x2fb123){return _0x181b39(_0x2fb123);}return _0x405aff(_0x2c0e18);});})[_0x0139('0xc')](function(_0x29d51a){var _0x465c79=![];var _0x5e1819=_0x29d51a[_0x0139('0x13')](/\n/);for(var _0x5d6678=0x0,_0x18d6f2=_0x2e4637[_0x0139('0x14')];_0x5d6678<_0x18d6f2,_0x465c79===![];_0x5d6678+=0x1){if(_0x29d51a[_0x0139('0x15')](_0x2e4637[_0x5d6678])>=0x0){_0x465c79=!![];}}if(!_0x465c79){throw new Error(util[_0x0139('0xf')](_0x0139('0x16'),_0x4eb2d6[_0x0139('0x11')][_0x0139('0x12')]));}process[_0x0139('0x17')](_0x4eb2d6['params'][_0x0139('0x12')],_0x0139('0x18'));return _0x171530[_0x0139('0x9')](0xc8)[_0x0139('0xd')]({'message':util[_0x0139('0xf')](_0x0139('0x19'),_0x4eb2d6[_0x0139('0x11')][_0x0139('0x12')])});})[_0x0139('0xe')](handleError(_0x171530,null,'killProcess'));}; \ No newline at end of file +var _0xb760=['json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','status','send','index','getAllData','then','catch'];(function(_0x420f2b,_0x458b7a){var _0x5927d7=function(_0x35f02a){while(--_0x35f02a){_0x420f2b['push'](_0x420f2b['shift']());}};_0x5927d7(++_0x458b7a);}(_0xb760,0x77));var _0x0b76=function(_0x2f4e58,_0x2683c2){_0x2f4e58=_0x2f4e58-0x0;var _0x2a8d20=_0xb760[_0x2f4e58];return _0x2a8d20;};'use strict';var info=require(_0x0b76('0x0'));var exec=require(_0x0b76('0x1'))[_0x0b76('0x2')];var logger=require(_0x0b76('0x3'))('api');var util=require(_0x0b76('0x4'));var BPromise=require(_0x0b76('0x5'));var _=require(_0x0b76('0x6'));function handleError(_0x1d0657,_0x44aab7,_0x426104){_0x44aab7=_0x44aab7||0x1f4;return function(_0x2cc5fe){logger[_0x0b76('0x7')](_0x0b76('0x8'),_0x426104,_0x44aab7,util['inspect'](_0x2cc5fe,{'showHidden':![],'depth':null}));delete _0x2cc5fe[_0x0b76('0x9')];_0x1d0657[_0x0b76('0xa')](_0x44aab7)[_0x0b76('0xb')](_0x2cc5fe);};}exports[_0x0b76('0xc')]=function(_0x392dc3,_0xbcdeb3){return info[_0x0b76('0xd')]()[_0x0b76('0xe')](function(_0x3b8232){return _0xbcdeb3['status'](0xc8)['json'](_0x3b8232);})[_0x0b76('0xf')](function(_0x1aa626){return _0xbcdeb3[_0x0b76('0xa')](0x1f4)[_0x0b76('0x10')](_0x1aa626);});};exports['killProcess']=function(_0x4b3c59,_0x493da0){var _0x4a66e2=[_0x0b76('0x11')];return new BPromise(function(_0x2a506f,_0x36c301){return exec(util[_0x0b76('0x12')](_0x0b76('0x13'),_0x4b3c59[_0x0b76('0x14')][_0x0b76('0x15')]),function(_0x274910,_0x14abe2,_0x1e4a4e){if(_0x274910){return _0x36c301(_0x274910);}return _0x2a506f(_0x14abe2);});})[_0x0b76('0xe')](function(_0x2b36dc){var _0x1d3db4=![];var _0x13672b=_0x2b36dc[_0x0b76('0x16')](/\n/);for(var _0x1984c9=0x0,_0x4f49b4=_0x4a66e2[_0x0b76('0x17')];_0x1984c9<_0x4f49b4,_0x1d3db4===![];_0x1984c9+=0x1){if(_0x2b36dc['indexOf'](_0x4a66e2[_0x1984c9])>=0x0){_0x1d3db4=!![];}}if(!_0x1d3db4){throw new Error(util[_0x0b76('0x12')](_0x0b76('0x18'),_0x4b3c59[_0x0b76('0x14')]['pid']));}process['kill'](_0x4b3c59[_0x0b76('0x14')][_0x0b76('0x15')],_0x0b76('0x19'));return _0x493da0['status'](0xc8)[_0x0b76('0x10')]({'message':util[_0x0b76('0x12')](_0x0b76('0x1a'),_0x4b3c59[_0x0b76('0x14')]['pid'])});})[_0x0b76('0xf')](handleError(_0x493da0,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index cf90576..2c342dc 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 _0xe46d=['put','isAuthenticated','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','get','index','/:id','show','post','create'];(function(_0x1809aa,_0x208ce6){var _0xa82d62=function(_0x3139a0){while(--_0x3139a0){_0x1809aa['push'](_0x1809aa['shift']());}};_0xa82d62(++_0x208ce6);}(_0xe46d,0x91));var _0xde46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe46d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xde46('0x0'));var util=require(_0xde46('0x1'));var path=require(_0xde46('0x2'));var timeout=require(_0xde46('0x3'));var express=require('express');var router=express[_0xde46('0x4')]();var fs_extra=require(_0xde46('0x5'));var auth=require(_0xde46('0x6'));var interaction=require(_0xde46('0x7'));var config=require('../../config/environment');var controller=require(_0xde46('0x8'));router[_0xde46('0x9')]('/',auth['isAuthenticated'](),controller[_0xde46('0xa')]);router[_0xde46('0x9')](_0xde46('0xb'),auth['isAuthenticated'](),controller[_0xde46('0xc')]);router[_0xde46('0xd')]('/',auth['isAuthenticated'](),controller[_0xde46('0xe')]);router[_0xde46('0xf')](_0xde46('0xb'),auth[_0xde46('0x10')](),controller[_0xde46('0x11')]);router[_0xde46('0x12')](_0xde46('0xb'),auth[_0xde46('0x10')](),controller[_0xde46('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6a95=['multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports'];(function(_0x355f2d,_0x130bb0){var _0x5328ae=function(_0x470144){while(--_0x470144){_0x355f2d['push'](_0x355f2d['shift']());}};_0x5328ae(++_0x130bb0);}(_0x6a95,0x1db));var _0x56a9=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x6a95[_0x15bc81];return _0x59440e;};'use strict';var multer=require(_0x56a9('0x0'));var util=require(_0x56a9('0x1'));var path=require(_0x56a9('0x2'));var timeout=require(_0x56a9('0x3'));var express=require(_0x56a9('0x4'));var router=express[_0x56a9('0x5')]();var fs_extra=require(_0x56a9('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x56a9('0x7'));var controller=require(_0x56a9('0x8'));router[_0x56a9('0x9')]('/',auth[_0x56a9('0xa')](),controller[_0x56a9('0xb')]);router[_0x56a9('0x9')](_0x56a9('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x56a9('0xd')]('/',auth[_0x56a9('0xa')](),controller['create']);router[_0x56a9('0xe')](_0x56a9('0xc'),auth[_0x56a9('0xa')](),controller[_0x56a9('0xf')]);router[_0x56a9('0x10')](_0x56a9('0xc'),auth[_0x56a9('0xa')](),controller[_0x56a9('0x11')]);module[_0x56a9('0x12')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 13f1259..b20c176 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 _0xd87e=['STRING','#0091EA','sequelize','exports','name'];(function(_0x1cee5a,_0x13fc79){var _0x3b1f42=function(_0x2733ea){while(--_0x2733ea){_0x1cee5a['push'](_0x1cee5a['shift']());}};_0x3b1f42(++_0x13fc79);}(_0xd87e,0x1bf));var _0xed87=function(_0x483dba,_0x1a3942){_0x483dba=_0x483dba-0x0;var _0x15b8c7=_0xd87e[_0x483dba];return _0x15b8c7;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xed87('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xed87('0x3')],'defaultValue':_0xed87('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cc3=['name','#0091EA','STRING','sequelize','exports'];(function(_0xd3a05c,_0x13ce7b){var _0x2e4af7=function(_0x163c3b){while(--_0x163c3b){_0xd3a05c['push'](_0xd3a05c['shift']());}};_0x2e4af7(++_0x13ce7b);}(_0x1cc3,0x11b));var _0x31cc=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1cc3[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x31cc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x31cc('0x3')},'description':{'type':Sequelize[_0x31cc('0x4')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 69e4c7d..8095ee0 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 _0xd2ea=['params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','apply','reject','save','update','then','get','Tags','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show'];(function(_0x269b18,_0x749ba){var _0x326af0=function(_0xc20abd){while(--_0xc20abd){_0x269b18['push'](_0x269b18['shift']());}};_0x326af0(++_0x749ba);}(_0xd2ea,0x15f));var _0xad2e=function(_0x268728,_0x316451){_0x268728=_0x268728-0x0;var _0x29b729=_0xd2ea[_0x268728];return _0x29b729;};'use strict';var emlformat=require(_0xad2e('0x0'));var rimraf=require(_0xad2e('0x1'));var zipdir=require(_0xad2e('0x2'));var jsonpatch=require(_0xad2e('0x3'));var rp=require(_0xad2e('0x4'));var moment=require('moment');var BPromise=require(_0xad2e('0x5'));var Mustache=require(_0xad2e('0x6'));var util=require(_0xad2e('0x7'));var path=require(_0xad2e('0x8'));var sox=require(_0xad2e('0x9'));var csv=require(_0xad2e('0xa'));var ejs=require(_0xad2e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad2e('0xc'));var squel=require(_0xad2e('0xd'));var crypto=require(_0xad2e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xad2e('0xf'));var toCsv=require(_0xad2e('0xa'));var querystring=require('querystring');var Papa=require(_0xad2e('0x10'));var Redis=require('ioredis');var authService=require(_0xad2e('0x11'));var qs=require(_0xad2e('0x12'));var as=require(_0xad2e('0x13'));var hardwareService=require(_0xad2e('0x14'));var logger=require('../../config/logger')(_0xad2e('0x15'));var utils=require('../../config/utils');var config=require(_0xad2e('0x16'));var licenseUtil=require(_0xad2e('0x17'));var db=require(_0xad2e('0x18'))['db'];function respondWithStatusCode(_0x42e2f2,_0x59a342){_0x59a342=_0x59a342||0xcc;return function(_0x27fb5a){if(_0x27fb5a){return _0x42e2f2['sendStatus'](_0x59a342);}return _0x42e2f2[_0xad2e('0x19')](_0x59a342)['end']();};}function respondWithResult(_0x4fbabc,_0x4a812b){_0x4a812b=_0x4a812b||0xc8;return function(_0x5c96a7){if(_0x5c96a7){return _0x4fbabc[_0xad2e('0x19')](_0x4a812b)[_0xad2e('0x1a')](_0x5c96a7);}};}function respondWithFilteredResult(_0x1646d5,_0x2b6945){return function(_0x17e6ac){if(_0x17e6ac){var _0x4180aa=typeof _0x2b6945[_0xad2e('0x1b')]===_0xad2e('0x1c')&&typeof _0x2b6945[_0xad2e('0x1d')]===_0xad2e('0x1c');var _0x2af208=_0x17e6ac[_0xad2e('0x1e')];var _0x34f946=_0x4180aa?0x0:_0x2b6945[_0xad2e('0x1b')];var _0x163e83=_0x4180aa?_0x17e6ac['count']:_0x2b6945[_0xad2e('0x1b')]+_0x2b6945[_0xad2e('0x1d')];var _0x489585;if(_0x163e83>=_0x2af208){_0x163e83=_0x2af208;_0x489585=0xc8;}else{_0x489585=0xce;}_0x1646d5['status'](_0x489585);return _0x1646d5['set']('Content-Range',_0x34f946+'-'+_0x163e83+'/'+_0x2af208)[_0xad2e('0x1a')](_0x17e6ac);}return null;};}function patchUpdates(_0x293adc){return function(_0x5549db){try{jsonpatch[_0xad2e('0x1f')](_0x5549db,_0x293adc,!![]);}catch(_0x1796f7){return BPromise[_0xad2e('0x20')](_0x1796f7);}return _0x5549db[_0xad2e('0x21')]();};}function saveUpdates(_0x23c0b6,_0x102169){return function(_0x154d54){if(_0x154d54){return _0x154d54[_0xad2e('0x22')](_0x23c0b6)[_0xad2e('0x23')](function(_0xd907a9){return _0xd907a9;});}return null;};}function removeEntity(_0x20e664,_0x207517){return function(_0x2e1c95){if(_0x2e1c95){return _0x2e1c95['destroy']()[_0xad2e('0x23')](function(){var _0x2e8887=_0x2e1c95[_0xad2e('0x24')]({'plain':!![]});var _0x350c66=_0xad2e('0x25');return db[_0xad2e('0x26')][_0xad2e('0x27')]({'where':{'type':_0x350c66,'resourceId':_0x2e8887['id']}})[_0xad2e('0x23')](function(){return _0x2e1c95;});})[_0xad2e('0x23')](function(){_0x20e664['status'](0xcc)[_0xad2e('0x28')]();});}};}function handleEntityNotFound(_0x5d675f,_0x2b2bc2){return function(_0x28ef72){if(!_0x28ef72){_0x5d675f[_0xad2e('0x29')](0x194);}return _0x28ef72;};}function handleError(_0x11bfa9,_0x5aec9d){_0x5aec9d=_0x5aec9d||0x1f4;return function(_0x1676e5){logger[_0xad2e('0x2a')](_0x1676e5[_0xad2e('0x2b')]);if(_0x1676e5[_0xad2e('0x2c')]){delete _0x1676e5[_0xad2e('0x2c')];}_0x11bfa9['status'](_0x5aec9d)[_0xad2e('0x2d')](_0x1676e5);};}exports[_0xad2e('0x2e')]=function(_0x2a0dc7,_0x4379f4){var _0x42fe6c={},_0x9b4a23={},_0x409f58={'count':0x0,'rows':[]};var _0x3e3d86=_[_0xad2e('0x2f')](db[_0xad2e('0x30')][_0xad2e('0x31')],function(_0x56330e){return{'name':_0x56330e[_0xad2e('0x32')],'type':_0x56330e['type'][_0xad2e('0x33')]};});_0x9b4a23[_0xad2e('0x34')]=_[_0xad2e('0x2f')](_0x3e3d86,_0xad2e('0x2c'));_0x9b4a23[_0xad2e('0x35')]=_['keys'](_0x2a0dc7[_0xad2e('0x35')]);_0x9b4a23[_0xad2e('0x36')]=_['intersection'](_0x9b4a23[_0xad2e('0x34')],_0x9b4a23[_0xad2e('0x35')]);_0x42fe6c['attributes']=_[_0xad2e('0x37')](_0x9b4a23[_0xad2e('0x34')],qs[_0xad2e('0x38')](_0x2a0dc7[_0xad2e('0x35')][_0xad2e('0x38')]));_0x42fe6c[_0xad2e('0x39')]=_0x42fe6c[_0xad2e('0x39')]['length']?_0x42fe6c[_0xad2e('0x39')]:_0x9b4a23[_0xad2e('0x34')];if(!_0x2a0dc7['query'][_0xad2e('0x3a')](_0xad2e('0x3b'))){_0x42fe6c[_0xad2e('0x1d')]=qs[_0xad2e('0x1d')](_0x2a0dc7[_0xad2e('0x35')][_0xad2e('0x1d')]);_0x42fe6c['offset']=qs['offset'](_0x2a0dc7[_0xad2e('0x35')]['offset']);}_0x42fe6c[_0xad2e('0x3c')]=qs[_0xad2e('0x3d')](_0x2a0dc7[_0xad2e('0x35')][_0xad2e('0x3d')]);_0x42fe6c[_0xad2e('0x3e')]=qs['filters'](_[_0xad2e('0x3f')](_0x2a0dc7[_0xad2e('0x35')],_0x9b4a23['filters']),_0x3e3d86);if(_0x2a0dc7['query']['filter']){_0x42fe6c[_0xad2e('0x3e')]=_['merge'](_0x42fe6c['where'],{'$or':_[_0xad2e('0x2f')](_0x3e3d86,function(_0x18f926){if(_0x18f926[_0xad2e('0x40')]!==_0xad2e('0x41')){var _0x6f4fbc={};_0x6f4fbc[_0x18f926[_0xad2e('0x2c')]]={'$like':'%'+_0x2a0dc7[_0xad2e('0x35')]['filter']+'%'};return _0x6f4fbc;}})});}_0x42fe6c=_[_0xad2e('0x42')]({},_0x42fe6c,_0x2a0dc7[_0xad2e('0x43')]);var _0x46684d={'where':_0x42fe6c[_0xad2e('0x3e')]};return db[_0xad2e('0x30')]['count'](_0x46684d)[_0xad2e('0x23')](function(_0x554ed8){_0x409f58[_0xad2e('0x1e')]=_0x554ed8;if(_0x2a0dc7[_0xad2e('0x35')][_0xad2e('0x44')]){_0x42fe6c[_0xad2e('0x45')]=[{'all':!![]}];}return db[_0xad2e('0x30')][_0xad2e('0x46')](_0x42fe6c);})[_0xad2e('0x23')](function(_0x27a0d3){_0x409f58[_0xad2e('0x47')]=_0x27a0d3;return _0x409f58;})[_0xad2e('0x23')](respondWithFilteredResult(_0x4379f4,_0x42fe6c))[_0xad2e('0x48')](handleError(_0x4379f4,null));};exports[_0xad2e('0x49')]=function(_0x1d18d0,_0x1b78f9){var _0xf7b911={'raw':!![],'where':{'id':_0x1d18d0[_0xad2e('0x4a')]['id']}},_0x2ad9a0={};_0x2ad9a0[_0xad2e('0x34')]=_[_0xad2e('0x4b')](db[_0xad2e('0x30')]['rawAttributes']);_0x2ad9a0[_0xad2e('0x35')]=_[_0xad2e('0x4b')](_0x1d18d0[_0xad2e('0x35')]);_0x2ad9a0[_0xad2e('0x36')]=_[_0xad2e('0x37')](_0x2ad9a0[_0xad2e('0x34')],_0x2ad9a0[_0xad2e('0x35')]);_0xf7b911['attributes']=_[_0xad2e('0x37')](_0x2ad9a0['model'],qs[_0xad2e('0x38')](_0x1d18d0[_0xad2e('0x35')][_0xad2e('0x38')]));_0xf7b911[_0xad2e('0x39')]=_0xf7b911[_0xad2e('0x39')]['length']?_0xf7b911[_0xad2e('0x39')]:_0x2ad9a0[_0xad2e('0x34')];if(_0x1d18d0[_0xad2e('0x35')][_0xad2e('0x44')]){_0xf7b911[_0xad2e('0x45')]=[{'all':!![]}];}_0xf7b911=_['merge']({},_0xf7b911,_0x1d18d0[_0xad2e('0x43')]);return db[_0xad2e('0x30')][_0xad2e('0x4c')](_0xf7b911)[_0xad2e('0x23')](handleEntityNotFound(_0x1b78f9,null))['then'](respondWithResult(_0x1b78f9,null))['catch'](handleError(_0x1b78f9,null));};exports[_0xad2e('0x4d')]=function(_0x343e4f,_0x4d2c66){return db['Tag'][_0xad2e('0x4d')](_0x343e4f['body'],{})[_0xad2e('0x23')](function(_0x2fb7d9){var _0x5196bf=_0x343e4f[_0xad2e('0x4e')][_0xad2e('0x24')]({'plain':!![]});if(!_0x5196bf)throw new Error(_0xad2e('0x4f'));if(_0x5196bf[_0xad2e('0x50')]==='user'){var _0x527c93=_0x2fb7d9[_0xad2e('0x24')]({'plain':!![]});var _0x2d2af3=_0xad2e('0x25');return db[_0xad2e('0x51')][_0xad2e('0x4c')]({'where':{'name':_0x2d2af3,'userProfileId':_0x5196bf[_0xad2e('0x52')]},'raw':!![]})[_0xad2e('0x23')](function(_0x3e90d0){if(_0x3e90d0&&_0x3e90d0['autoAssociation']===0x0){return db[_0xad2e('0x26')]['create']({'name':_0x527c93[_0xad2e('0x2c')],'resourceId':_0x527c93['id'],'type':_0x3e90d0[_0xad2e('0x2c')],'sectionId':_0x3e90d0['id']},{})[_0xad2e('0x23')](function(){return _0x2fb7d9;});}else{return _0x2fb7d9;}})[_0xad2e('0x48')](function(_0x450448){logger[_0xad2e('0x2a')](_0xad2e('0x53'),_0x450448);throw _0x450448;});}return _0x2fb7d9;})['then'](respondWithResult(_0x4d2c66,0xc9))[_0xad2e('0x48')](handleError(_0x4d2c66,null));};exports['update']=function(_0x2d2dc2,_0x4222a7){if(_0x2d2dc2[_0xad2e('0x54')]['id']){delete _0x2d2dc2[_0xad2e('0x54')]['id'];}return db['Tag'][_0xad2e('0x4c')]({'where':{'id':_0x2d2dc2[_0xad2e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4222a7,null))[_0xad2e('0x23')](saveUpdates(_0x2d2dc2['body'],null))[_0xad2e('0x23')](respondWithResult(_0x4222a7,null))[_0xad2e('0x48')](handleError(_0x4222a7,null));};exports[_0xad2e('0x27')]=function(_0xee4026,_0x243d14){return db[_0xad2e('0x30')][_0xad2e('0x4c')]({'where':{'id':_0xee4026[_0xad2e('0x4a')]['id']}})[_0xad2e('0x23')](handleEntityNotFound(_0x243d14,null))['then'](removeEntity(_0x243d14,null))[_0xad2e('0x48')](handleError(_0x243d14,null));}; \ No newline at end of file +var _0xfc03=['Tag','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','findAll','catch','show','params','includeAll','include','create','role','user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','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','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','index','map'];(function(_0xd5169f,_0x2dd39f){var _0x49409b=function(_0x63cf9b){while(--_0x63cf9b){_0xd5169f['push'](_0xd5169f['shift']());}};_0x49409b(++_0x2dd39f);}(_0xfc03,0x16f));var _0x3fc0=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xfc03[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x3fc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fc0('0x1'));var jsonpatch=require(_0x3fc0('0x2'));var rp=require('request-promise');var moment=require(_0x3fc0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fc0('0x4'));var util=require(_0x3fc0('0x5'));var path=require(_0x3fc0('0x6'));var sox=require(_0x3fc0('0x7'));var csv=require(_0x3fc0('0x8'));var ejs=require(_0x3fc0('0x9'));var fs=require('fs');var fs_extra=require(_0x3fc0('0xa'));var _=require(_0x3fc0('0xb'));var squel=require('squel');var crypto=require(_0x3fc0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3fc0('0xd'));var toCsv=require(_0x3fc0('0x8'));var querystring=require(_0x3fc0('0xe'));var Papa=require(_0x3fc0('0xf'));var Redis=require('ioredis');var authService=require(_0x3fc0('0x10'));var qs=require(_0x3fc0('0x11'));var as=require(_0x3fc0('0x12'));var hardwareService=require(_0x3fc0('0x13'));var logger=require(_0x3fc0('0x14'))('api');var utils=require(_0x3fc0('0x15'));var config=require(_0x3fc0('0x16'));var licenseUtil=require(_0x3fc0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1011b7,_0x582e22){_0x582e22=_0x582e22||0xcc;return function(_0x3a4cc0){if(_0x3a4cc0){return _0x1011b7[_0x3fc0('0x18')](_0x582e22);}return _0x1011b7['status'](_0x582e22)[_0x3fc0('0x19')]();};}function respondWithResult(_0x422926,_0x392c46){_0x392c46=_0x392c46||0xc8;return function(_0x4eb69a){if(_0x4eb69a){return _0x422926[_0x3fc0('0x1a')](_0x392c46)[_0x3fc0('0x1b')](_0x4eb69a);}};}function respondWithFilteredResult(_0x367ce1,_0x27619a){return function(_0x562ecc){if(_0x562ecc){var _0x277dbf=typeof _0x27619a[_0x3fc0('0x1c')]===_0x3fc0('0x1d')&&typeof _0x27619a['limit']===_0x3fc0('0x1d');var _0x491446=_0x562ecc[_0x3fc0('0x1e')];var _0x3c5026=_0x277dbf?0x0:_0x27619a['offset'];var _0x3bb388=_0x277dbf?_0x562ecc[_0x3fc0('0x1e')]:_0x27619a[_0x3fc0('0x1c')]+_0x27619a[_0x3fc0('0x1f')];var _0x1bd575;if(_0x3bb388>=_0x491446){_0x3bb388=_0x491446;_0x1bd575=0xc8;}else{_0x1bd575=0xce;}_0x367ce1[_0x3fc0('0x1a')](_0x1bd575);return _0x367ce1[_0x3fc0('0x20')](_0x3fc0('0x21'),_0x3c5026+'-'+_0x3bb388+'/'+_0x491446)[_0x3fc0('0x1b')](_0x562ecc);}return null;};}function patchUpdates(_0x5c859e){return function(_0xf13744){try{jsonpatch[_0x3fc0('0x22')](_0xf13744,_0x5c859e,!![]);}catch(_0x34ffa7){return BPromise[_0x3fc0('0x23')](_0x34ffa7);}return _0xf13744[_0x3fc0('0x24')]();};}function saveUpdates(_0x448293,_0x47c770){return function(_0x477674){if(_0x477674){return _0x477674[_0x3fc0('0x25')](_0x448293)[_0x3fc0('0x26')](function(_0x28fc65){return _0x28fc65;});}return null;};}function removeEntity(_0x46c213,_0x303dd2){return function(_0x2f423e){if(_0x2f423e){return _0x2f423e[_0x3fc0('0x27')]()[_0x3fc0('0x26')](function(){var _0x35a3e2=_0x2f423e[_0x3fc0('0x28')]({'plain':!![]});var _0x1abe10=_0x3fc0('0x29');return db[_0x3fc0('0x2a')][_0x3fc0('0x27')]({'where':{'type':_0x1abe10,'resourceId':_0x35a3e2['id']}})[_0x3fc0('0x26')](function(){return _0x2f423e;});})['then'](function(){_0x46c213[_0x3fc0('0x1a')](0xcc)[_0x3fc0('0x19')]();});}};}function handleEntityNotFound(_0x1d9932,_0x35c34c){return function(_0x5a9179){if(!_0x5a9179){_0x1d9932[_0x3fc0('0x18')](0x194);}return _0x5a9179;};}function handleError(_0x197dfa,_0x126515){_0x126515=_0x126515||0x1f4;return function(_0x2645b4){logger['error'](_0x2645b4[_0x3fc0('0x2b')]);if(_0x2645b4[_0x3fc0('0x2c')]){delete _0x2645b4[_0x3fc0('0x2c')];}_0x197dfa[_0x3fc0('0x1a')](_0x126515)[_0x3fc0('0x2d')](_0x2645b4);};}exports[_0x3fc0('0x2e')]=function(_0x485f0c,_0xd9ecae){var _0x2351c8={},_0x181948={},_0x21a074={'count':0x0,'rows':[]};var _0x3f1a75=_[_0x3fc0('0x2f')](db[_0x3fc0('0x30')][_0x3fc0('0x31')],function(_0x4d6551){return{'name':_0x4d6551['fieldName'],'type':_0x4d6551[_0x3fc0('0x32')]['key']};});_0x181948[_0x3fc0('0x33')]=_[_0x3fc0('0x2f')](_0x3f1a75,_0x3fc0('0x2c'));_0x181948[_0x3fc0('0x34')]=_[_0x3fc0('0x35')](_0x485f0c['query']);_0x181948['filters']=_[_0x3fc0('0x36')](_0x181948[_0x3fc0('0x33')],_0x181948[_0x3fc0('0x34')]);_0x2351c8[_0x3fc0('0x37')]=_[_0x3fc0('0x36')](_0x181948['model'],qs[_0x3fc0('0x38')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x38')]));_0x2351c8['attributes']=_0x2351c8[_0x3fc0('0x37')][_0x3fc0('0x39')]?_0x2351c8[_0x3fc0('0x37')]:_0x181948[_0x3fc0('0x33')];if(!_0x485f0c['query'][_0x3fc0('0x3a')](_0x3fc0('0x3b'))){_0x2351c8['limit']=qs[_0x3fc0('0x1f')](_0x485f0c['query'][_0x3fc0('0x1f')]);_0x2351c8[_0x3fc0('0x1c')]=qs[_0x3fc0('0x1c')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x1c')]);}_0x2351c8[_0x3fc0('0x3c')]=qs[_0x3fc0('0x3d')](_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x3d')]);_0x2351c8[_0x3fc0('0x3e')]=qs[_0x3fc0('0x3f')](_['pick'](_0x485f0c[_0x3fc0('0x34')],_0x181948[_0x3fc0('0x3f')]),_0x3f1a75);if(_0x485f0c[_0x3fc0('0x34')][_0x3fc0('0x40')]){_0x2351c8[_0x3fc0('0x3e')]=_[_0x3fc0('0x41')](_0x2351c8['where'],{'$or':_['map'](_0x3f1a75,function(_0x3af7ed){if(_0x3af7ed[_0x3fc0('0x32')]!==_0x3fc0('0x42')){var _0x3e285f={};_0x3e285f[_0x3af7ed[_0x3fc0('0x2c')]]={'$like':'%'+_0x485f0c['query']['filter']+'%'};return _0x3e285f;}})});}_0x2351c8=_['merge']({},_0x2351c8,_0x485f0c[_0x3fc0('0x43')]);var _0x39d65c={'where':_0x2351c8[_0x3fc0('0x3e')]};return db['Tag']['count'](_0x39d65c)[_0x3fc0('0x26')](function(_0x239dc5){_0x21a074[_0x3fc0('0x1e')]=_0x239dc5;if(_0x485f0c[_0x3fc0('0x34')]['includeAll']){_0x2351c8['include']=[{'all':!![]}];}return db[_0x3fc0('0x30')][_0x3fc0('0x44')](_0x2351c8);})['then'](function(_0x32768f){_0x21a074['rows']=_0x32768f;return _0x21a074;})[_0x3fc0('0x26')](respondWithFilteredResult(_0xd9ecae,_0x2351c8))[_0x3fc0('0x45')](handleError(_0xd9ecae,null));};exports[_0x3fc0('0x46')]=function(_0x90120f,_0x2d01e9){var _0x38e449={'raw':!![],'where':{'id':_0x90120f[_0x3fc0('0x47')]['id']}},_0x80dfee={};_0x80dfee['model']=_[_0x3fc0('0x35')](db['Tag'][_0x3fc0('0x31')]);_0x80dfee[_0x3fc0('0x34')]=_[_0x3fc0('0x35')](_0x90120f[_0x3fc0('0x34')]);_0x80dfee[_0x3fc0('0x3f')]=_['intersection'](_0x80dfee[_0x3fc0('0x33')],_0x80dfee[_0x3fc0('0x34')]);_0x38e449[_0x3fc0('0x37')]=_[_0x3fc0('0x36')](_0x80dfee['model'],qs[_0x3fc0('0x38')](_0x90120f['query'][_0x3fc0('0x38')]));_0x38e449[_0x3fc0('0x37')]=_0x38e449[_0x3fc0('0x37')][_0x3fc0('0x39')]?_0x38e449[_0x3fc0('0x37')]:_0x80dfee['model'];if(_0x90120f[_0x3fc0('0x34')][_0x3fc0('0x48')]){_0x38e449[_0x3fc0('0x49')]=[{'all':!![]}];}_0x38e449=_['merge']({},_0x38e449,_0x90120f[_0x3fc0('0x43')]);return db[_0x3fc0('0x30')]['find'](_0x38e449)[_0x3fc0('0x26')](handleEntityNotFound(_0x2d01e9,null))[_0x3fc0('0x26')](respondWithResult(_0x2d01e9,null))[_0x3fc0('0x45')](handleError(_0x2d01e9,null));};exports['create']=function(_0x5e5c73,_0x3a35ac){return db[_0x3fc0('0x30')][_0x3fc0('0x4a')](_0x5e5c73['body'],{})[_0x3fc0('0x26')](function(_0x527569){var _0x40dbf3=_0x5e5c73['user']['get']({'plain':!![]});if(!_0x40dbf3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40dbf3[_0x3fc0('0x4b')]===_0x3fc0('0x4c')){var _0x141b4c=_0x527569[_0x3fc0('0x28')]({'plain':!![]});var _0x1e0c43=_0x3fc0('0x29');return db['UserProfileSection'][_0x3fc0('0x4d')]({'where':{'name':_0x1e0c43,'userProfileId':_0x40dbf3[_0x3fc0('0x4e')]},'raw':!![]})['then'](function(_0x550463){if(_0x550463&&_0x550463[_0x3fc0('0x4f')]===0x0){return db[_0x3fc0('0x2a')][_0x3fc0('0x4a')]({'name':_0x141b4c[_0x3fc0('0x2c')],'resourceId':_0x141b4c['id'],'type':_0x550463[_0x3fc0('0x2c')],'sectionId':_0x550463['id']},{})[_0x3fc0('0x26')](function(){return _0x527569;});}else{return _0x527569;}})[_0x3fc0('0x45')](function(_0x2da185){logger[_0x3fc0('0x50')](_0x3fc0('0x51'),_0x2da185);throw _0x2da185;});}return _0x527569;})[_0x3fc0('0x26')](respondWithResult(_0x3a35ac,0xc9))[_0x3fc0('0x45')](handleError(_0x3a35ac,null));};exports['update']=function(_0x24be72,_0xda5d3e){if(_0x24be72[_0x3fc0('0x52')]['id']){delete _0x24be72[_0x3fc0('0x52')]['id'];}return db[_0x3fc0('0x30')]['find']({'where':{'id':_0x24be72[_0x3fc0('0x47')]['id']}})['then'](handleEntityNotFound(_0xda5d3e,null))[_0x3fc0('0x26')](saveUpdates(_0x24be72[_0x3fc0('0x52')],null))[_0x3fc0('0x26')](respondWithResult(_0xda5d3e,null))[_0x3fc0('0x45')](handleError(_0xda5d3e,null));};exports['destroy']=function(_0x1656c7,_0xd903e3){return db[_0x3fc0('0x30')][_0x3fc0('0x4d')]({'where':{'id':_0x1656c7[_0x3fc0('0x47')]['id']}})[_0x3fc0('0x26')](handleEntityNotFound(_0xd903e3,null))['then'](removeEntity(_0xd903e3,null))[_0x3fc0('0x45')](handleError(_0xd903e3,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 79595ce..44751c3 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 _0xbebf=['bluebird','path','./tag.attributes','define','Tag','lodash','util','../../config/logger','api','moment'];(function(_0x3e8621,_0x55a594){var _0x268322=function(_0x23e72c){while(--_0x23e72c){_0x3e8621['push'](_0x3e8621['shift']());}};_0x268322(++_0x55a594);}(_0xbebf,0xcd));var _0xfbeb=function(_0x67a333,_0x5ce6b7){_0x67a333=_0x67a333-0x0;var _0xade438=_0xbebf[_0x67a333];return _0xade438;};'use strict';var _=require(_0xfbeb('0x0'));var util=require(_0xfbeb('0x1'));var logger=require(_0xfbeb('0x2'))(_0xfbeb('0x3'));var moment=require(_0xfbeb('0x4'));var BPromise=require(_0xfbeb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbeb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfbeb('0x7'));module['exports']=function(_0x1a0bce,_0x297013){return _0x1a0bce[_0xfbeb('0x8')](_0xfbeb('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd5a=['path','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','api'];(function(_0x230235,_0x53d510){var _0xafcb6b=function(_0x52099f){while(--_0x52099f){_0x230235['push'](_0x230235['shift']());}};_0xafcb6b(++_0x53d510);}(_0xbd5a,0xde));var _0xabd5=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbd5a[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xabd5('0x0'));var util=require(_0xabd5('0x1'));var logger=require('../../config/logger')(_0xabd5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xabd5('0x3'));var rimraf=require('rimraf');var config=require(_0xabd5('0x4'));var attributes=require(_0xabd5('0x5'));module[_0xabd5('0x6')]=function(_0x3486b4,_0x51e3bf){return _0x3486b4['define'](_0xabd5('0x7'),attributes,{'tableName':_0xabd5('0x8'),'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 0c703bb..9c8b0df 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 _0x3685=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x44aa7b,_0x4bfc07){var _0x202405=function(_0x22fd44){while(--_0x22fd44){_0x44aa7b['push'](_0x44aa7b['shift']());}};_0x202405(++_0x4bfc07);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var moment=require(_0x5368('0x1'));var BPromise=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var fs=require('fs');var Redis=require(_0x5368('0x4'));var db=require(_0x5368('0x5'))['db'];var utils=require(_0x5368('0x6'));var logger=require(_0x5368('0x7'))(_0x5368('0x8'));var config=require(_0x5368('0x9'));var jayson=require(_0x5368('0xa'));var client=jayson['client'][_0x5368('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2529a2,_0x39223d,_0xaf4549){return new BPromise(function(_0x55fb7d,_0x14e621){return client[_0x5368('0xc')](_0x2529a2,_0xaf4549)[_0x5368('0xd')](function(_0x2a6ce8){logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,_0x5368('0x10'));logger[_0x5368('0x11')]('Tag,\x20%s,\x20%s,\x20%s',_0x39223d,_0x5368('0x10'),JSON[_0x5368('0x12')](_0x2a6ce8));if(_0x2a6ce8[_0x5368('0x13')]){if(_0x2a6ce8['error'][_0x5368('0x14')]===0x1f4){logger[_0x5368('0x13')]('Tag,\x20%s,\x20%s',_0x39223d,_0x2a6ce8['error']['message']);return _0x14e621(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);return _0x55fb7d(_0x2a6ce8[_0x5368('0x13')][_0x5368('0x15')]);}else{logger[_0x5368('0xe')](_0x5368('0xf'),_0x39223d,'request\x20sent');_0x55fb7d(_0x2a6ce8[_0x5368('0x16')][_0x5368('0x15')]);}})['catch'](function(_0x19790d){logger[_0x5368('0x13')](_0x5368('0xf'),_0x39223d,_0x19790d);_0x14e621(_0x19790d);});});} \ No newline at end of file +var _0xe0c3=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x51f94e,_0x4ffbe7){var _0xa92d67=function(_0x49ba47){while(--_0x49ba47){_0x51f94e['push'](_0x51f94e['shift']());}};_0xa92d67(++_0x4ffbe7);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var moment=require(_0x3e0c('0x1'));var BPromise=require(_0x3e0c('0x2'));var rs=require(_0x3e0c('0x3'));var fs=require('fs');var Redis=require(_0x3e0c('0x4'));var db=require(_0x3e0c('0x5'))['db'];var utils=require(_0x3e0c('0x6'));var logger=require(_0x3e0c('0x7'))(_0x3e0c('0x8'));var config=require(_0x3e0c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e339a,_0x3f6607,_0x243b5b){return new BPromise(function(_0x29673d,_0x2d2c39){return client[_0x3e0c('0xb')](_0x1e339a,_0x243b5b)[_0x3e0c('0xc')](function(_0x13ac88){logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,'request\x20sent');logger['debug'](_0x3e0c('0xf'),_0x3f6607,_0x3e0c('0x10'),JSON[_0x3e0c('0x11')](_0x13ac88));if(_0x13ac88[_0x3e0c('0x12')]){if(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x13')]===0x1f4){logger[_0x3e0c('0x12')]('Tag,\x20%s,\x20%s',_0x3f6607,_0x13ac88[_0x3e0c('0x12')]['message']);return _0x2d2c39(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}logger['error'](_0x3e0c('0xe'),_0x3f6607,_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);return _0x29673d(_0x13ac88[_0x3e0c('0x12')][_0x3e0c('0x14')]);}else{logger[_0x3e0c('0xd')](_0x3e0c('0xe'),_0x3f6607,_0x3e0c('0x10'));_0x29673d(_0x13ac88[_0x3e0c('0x15')][_0x3e0c('0x14')]);}})[_0x3e0c('0x16')](function(_0x1f8e71){logger['error']('Tag,\x20%s,\x20%s',_0x3f6607,_0x1f8e71);_0x2d2c39(_0x1f8e71);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 71d832f..281827d 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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 af0e3e7..be44293 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x5623af,_0x3dd4e2){var _0x13bb74=function(_0x24cfe7){while(--_0x24cfe7){_0x5623af['push'](_0x5623af['shift']());}};_0x13bb74(++_0x3dd4e2);}(_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 +var _0xd8b0=['exports','sequelize'];(function(_0xba8f41,_0x64cf64){var _0xe862d1=function(_0x1ddfb5){while(--_0x1ddfb5){_0xba8f41['push'](_0xba8f41['shift']());}};_0xe862d1(++_0x64cf64);}(_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/team/team.controller.js b/server/api/team/team.controller.js index f00f59f..abcb7d5 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 _0xf137=['channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','add','ids','removeQueues','addAgents','isArray','Voice','Chat','Fax','Openchannel','Whatsapp','through','QueueId','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','filter','nolimit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','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','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','options','Team','includeAll','rows','catch','show','params','keys','include','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','isValidChannel'];(function(_0x4f6f04,_0x59c6ba){var _0x606b2c=function(_0x35da06){while(--_0x35da06){_0x4f6f04['push'](_0x4f6f04['shift']());}};_0x606b2c(++_0x59c6ba);}(_0xf137,0xc4));var _0x7f13=function(_0x42d344,_0x4b01ba){_0x42d344=_0x42d344-0x0;var _0x7d5af7=_0xf137[_0x42d344];return _0x7d5af7;};'use strict';var emlformat=require(_0x7f13('0x0'));var rimraf=require(_0x7f13('0x1'));var zipdir=require(_0x7f13('0x2'));var jsonpatch=require(_0x7f13('0x3'));var rp=require(_0x7f13('0x4'));var moment=require('moment');var BPromise=require(_0x7f13('0x5'));var Mustache=require(_0x7f13('0x6'));var util=require('util');var path=require(_0x7f13('0x7'));var sox=require(_0x7f13('0x8'));var csv=require(_0x7f13('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f13('0xa'));var _=require(_0x7f13('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7f13('0xc'));var toCsv=require(_0x7f13('0x9'));var querystring=require(_0x7f13('0xd'));var Papa=require(_0x7f13('0xe'));var Redis=require('ioredis');var authService=require(_0x7f13('0xf'));var qs=require(_0x7f13('0x10'));var as=require(_0x7f13('0x11'));var hardwareService=require(_0x7f13('0x12'));var logger=require(_0x7f13('0x13'))('api');var utils=require(_0x7f13('0x14'));var config=require(_0x7f13('0x15'));var licenseUtil=require(_0x7f13('0x16'));var db=require(_0x7f13('0x17'))['db'];config[_0x7f13('0x18')]=_[_0x7f13('0x19')](config[_0x7f13('0x18')],{'host':_0x7f13('0x1a'),'port':0x18eb});var socket=require(_0x7f13('0x1b'))(new Redis(config[_0x7f13('0x18')]));require(_0x7f13('0x1c'))['register'](socket);function respondWithStatusCode(_0x1f667b,_0x546cd8){_0x546cd8=_0x546cd8||0xcc;return function(_0x27181f){if(_0x27181f){return _0x1f667b[_0x7f13('0x1d')](_0x546cd8);}return _0x1f667b[_0x7f13('0x1e')](_0x546cd8)[_0x7f13('0x1f')]();};}function respondWithResult(_0x485253,_0x1cb19f){_0x1cb19f=_0x1cb19f||0xc8;return function(_0x2820a1){if(_0x2820a1){return _0x485253[_0x7f13('0x1e')](_0x1cb19f)[_0x7f13('0x20')](_0x2820a1);}};}function respondWithFilteredResult(_0x2b6080,_0x18ff61){return function(_0x543909){if(_0x543909){var _0x22728b=typeof _0x18ff61[_0x7f13('0x21')]===_0x7f13('0x22')&&typeof _0x18ff61['limit']===_0x7f13('0x22');var _0x50d2c0=_0x543909[_0x7f13('0x23')];var _0x56371f=_0x22728b?0x0:_0x18ff61[_0x7f13('0x21')];var _0x1b3978=_0x22728b?_0x543909[_0x7f13('0x23')]:_0x18ff61[_0x7f13('0x21')]+_0x18ff61[_0x7f13('0x24')];var _0x27e9d0;if(_0x1b3978>=_0x50d2c0){_0x1b3978=_0x50d2c0;_0x27e9d0=0xc8;}else{_0x27e9d0=0xce;}_0x2b6080['status'](_0x27e9d0);return _0x2b6080[_0x7f13('0x25')](_0x7f13('0x26'),_0x56371f+'-'+_0x1b3978+'/'+_0x50d2c0)[_0x7f13('0x20')](_0x543909);}return null;};}function patchUpdates(_0x5ae313){return function(_0x34500a){try{jsonpatch['apply'](_0x34500a,_0x5ae313,!![]);}catch(_0x35c970){return BPromise[_0x7f13('0x27')](_0x35c970);}return _0x34500a[_0x7f13('0x28')]();};}function saveUpdates(_0x743e89,_0x4f236d){return function(_0x1e2ecb){if(_0x1e2ecb){return _0x1e2ecb['update'](_0x743e89)[_0x7f13('0x29')](function(_0x35733a){return _0x35733a;});}return null;};}function handleEntityNotFound(_0x10d4f8,_0x1b09e5){return function(_0x3920fb){if(!_0x3920fb){_0x10d4f8['sendStatus'](0x194);}return _0x3920fb;};}function handleError(_0x5b4014,_0x38cc08){_0x38cc08=_0x38cc08||0x1f4;return function(_0x4f1a80){logger[_0x7f13('0x2a')](_0x4f1a80['stack']);if(_0x4f1a80[_0x7f13('0x2b')]){delete _0x4f1a80[_0x7f13('0x2b')];}_0x5b4014[_0x7f13('0x1e')](_0x38cc08)[_0x7f13('0x2c')](_0x4f1a80);};}exports[_0x7f13('0x2d')]=function(_0x2fccd5,_0x4959cf){var _0x1280ba={},_0x4cb136={},_0x16eb0e={'count':0x0,'rows':[]};var _0x5b22b3=_[_0x7f13('0x2e')](db['Team'][_0x7f13('0x2f')],function(_0x1478d7){return{'name':_0x1478d7[_0x7f13('0x30')],'type':_0x1478d7[_0x7f13('0x31')]['key']};});_0x4cb136[_0x7f13('0x32')]=_[_0x7f13('0x2e')](_0x5b22b3,'name');_0x4cb136[_0x7f13('0x33')]=_['keys'](_0x2fccd5[_0x7f13('0x33')]);_0x4cb136[_0x7f13('0x34')]=_['intersection'](_0x4cb136[_0x7f13('0x32')],_0x4cb136[_0x7f13('0x33')]);_0x1280ba[_0x7f13('0x35')]=_[_0x7f13('0x36')](_0x4cb136[_0x7f13('0x32')],qs[_0x7f13('0x37')](_0x2fccd5[_0x7f13('0x33')][_0x7f13('0x37')]));_0x1280ba[_0x7f13('0x35')]=_0x1280ba[_0x7f13('0x35')][_0x7f13('0x38')]?_0x1280ba[_0x7f13('0x35')]:_0x4cb136['model'];if(!_0x2fccd5[_0x7f13('0x33')]['hasOwnProperty']('nolimit')){_0x1280ba[_0x7f13('0x24')]=qs[_0x7f13('0x24')](_0x2fccd5['query'][_0x7f13('0x24')]);_0x1280ba['offset']=qs['offset'](_0x2fccd5[_0x7f13('0x33')][_0x7f13('0x21')]);}_0x1280ba[_0x7f13('0x39')]=qs[_0x7f13('0x3a')](_0x2fccd5[_0x7f13('0x33')]['sort']);_0x1280ba[_0x7f13('0x3b')]=qs['filters'](_[_0x7f13('0x3c')](_0x2fccd5[_0x7f13('0x33')],_0x4cb136['filters']),_0x5b22b3);if(_0x2fccd5[_0x7f13('0x33')]['filter']){_0x1280ba[_0x7f13('0x3b')]=_[_0x7f13('0x3d')](_0x1280ba[_0x7f13('0x3b')],{'$or':_[_0x7f13('0x2e')](_0x5b22b3,function(_0x1b9949){if(_0x1b9949[_0x7f13('0x31')]!==_0x7f13('0x3e')){var _0x447cd5={};_0x447cd5[_0x1b9949[_0x7f13('0x2b')]]={'$like':'%'+_0x2fccd5[_0x7f13('0x33')]['filter']+'%'};return _0x447cd5;}})});}_0x1280ba=_['merge']({},_0x1280ba,_0x2fccd5[_0x7f13('0x3f')]);var _0x3ea249={'where':_0x1280ba['where']};return db[_0x7f13('0x40')][_0x7f13('0x23')](_0x3ea249)[_0x7f13('0x29')](function(_0x1bd53c){_0x16eb0e['count']=_0x1bd53c;if(_0x2fccd5['query'][_0x7f13('0x41')]){_0x1280ba['include']=[{'all':!![]}];}return db['Team']['findAll'](_0x1280ba);})[_0x7f13('0x29')](function(_0x26a8f2){_0x16eb0e[_0x7f13('0x42')]=_0x26a8f2;return _0x16eb0e;})['then'](respondWithFilteredResult(_0x4959cf,_0x1280ba))[_0x7f13('0x43')](handleError(_0x4959cf,null));};exports[_0x7f13('0x44')]=function(_0x52d5b6,_0xff673c){var _0x237fec={'raw':![],'where':{'id':_0x52d5b6[_0x7f13('0x45')]['id']}},_0x5ae27c={};_0x5ae27c[_0x7f13('0x32')]=_[_0x7f13('0x46')](db[_0x7f13('0x40')]['rawAttributes']);_0x5ae27c[_0x7f13('0x33')]=_['keys'](_0x52d5b6['query']);_0x5ae27c[_0x7f13('0x34')]=_[_0x7f13('0x36')](_0x5ae27c[_0x7f13('0x32')],_0x5ae27c[_0x7f13('0x33')]);_0x237fec[_0x7f13('0x35')]=_[_0x7f13('0x36')](_0x5ae27c[_0x7f13('0x32')],qs[_0x7f13('0x37')](_0x52d5b6['query']['fields']));_0x237fec[_0x7f13('0x35')]=_0x237fec[_0x7f13('0x35')][_0x7f13('0x38')]?_0x237fec[_0x7f13('0x35')]:_0x5ae27c[_0x7f13('0x32')];if(_0x52d5b6[_0x7f13('0x33')]['includeAll']){_0x237fec[_0x7f13('0x47')]=[{'all':!![]}];}_0x237fec=_[_0x7f13('0x3d')]({},_0x237fec,_0x52d5b6[_0x7f13('0x3f')]);return db[_0x7f13('0x40')]['find'](_0x237fec)[_0x7f13('0x29')](handleEntityNotFound(_0xff673c,null))['then'](respondWithResult(_0xff673c,null))[_0x7f13('0x43')](handleError(_0xff673c,null));};exports[_0x7f13('0x48')]=function(_0x522759,_0xa24227){return db[_0x7f13('0x40')][_0x7f13('0x48')](_0x522759[_0x7f13('0x49')],{})[_0x7f13('0x29')](function(_0x25b11f){var _0x5dc2e2=_0x522759['user'][_0x7f13('0x4a')]({'plain':!![]});if(!_0x5dc2e2)throw new Error(_0x7f13('0x4b'));if(_0x5dc2e2[_0x7f13('0x4c')]===_0x7f13('0x4d')){var _0x44ab3f=_0x25b11f[_0x7f13('0x4a')]({'plain':!![]});var _0x53ba14=_0x7f13('0x4e');return db['UserProfileSection'][_0x7f13('0x4f')]({'where':{'name':_0x53ba14,'userProfileId':_0x5dc2e2['userProfileId']},'raw':!![]})[_0x7f13('0x29')](function(_0x2707c3){if(_0x2707c3&&_0x2707c3[_0x7f13('0x50')]===0x0){return db[_0x7f13('0x51')][_0x7f13('0x48')]({'name':_0x44ab3f[_0x7f13('0x2b')],'resourceId':_0x44ab3f['id'],'type':_0x2707c3[_0x7f13('0x2b')],'sectionId':_0x2707c3['id']},{})[_0x7f13('0x29')](function(){return _0x25b11f;});}else{return _0x25b11f;}})[_0x7f13('0x43')](function(_0x4132af){logger['error'](_0x7f13('0x52'),_0x4132af);throw _0x4132af;});}return _0x25b11f;})['then'](respondWithResult(_0xa24227,0xc9))[_0x7f13('0x43')](handleError(_0xa24227,null));};exports[_0x7f13('0x53')]=function(_0x3557e1,_0x24571a){if(_0x3557e1[_0x7f13('0x49')]['id']){delete _0x3557e1[_0x7f13('0x49')]['id'];}return db['Team'][_0x7f13('0x4f')]({'where':{'id':_0x3557e1['params']['id']}})[_0x7f13('0x29')](handleEntityNotFound(_0x24571a,null))[_0x7f13('0x29')](saveUpdates(_0x3557e1['body'],null))['then'](respondWithResult(_0x24571a,null))[_0x7f13('0x43')](handleError(_0x24571a,null));};exports['destroy']=function(_0x5f25d5,_0x29a701){var _0x123899=_0x5f25d5['params']['id'];var _0x1c4058=[];return db[_0x7f13('0x54')][_0x7f13('0x55')](function(_0x4b1525){var _0x14b233=_0x7f13('0x56')+_0x123899;return db[_0x7f13('0x54')]['query'](_0x14b233,{'type':db[_0x7f13('0x57')]['QueryTypes'][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525})['then'](function(_0x41e392){_0x1c4058=_[_0x7f13('0x2e')](_0x41e392,function(_0x34ea4c){return Number(_0x34ea4c['UserId']);});})[_0x7f13('0x29')](function(){var _0x545a13=_0x7f13('0x59')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x545a13,{'type':db[_0x7f13('0x57')][_0x7f13('0x5a')][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x2218cf){var _0xe253d6=_['map'](_0x2218cf,function(_0x11b7af){return Number(_0x11b7af[_0x7f13('0x5b')]);});return db[_0x7f13('0x5c')][_0x7f13('0x5d')]({'where':{'UserId':{'$in':_0x1c4058},'VoiceQueueId':{'$in':_0xe253d6}},'transaction':_0x4b1525});})['then'](function(){var _0x41ecf2=_0x7f13('0x5e')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x41ecf2,{'type':db['Sequelize']['QueryTypes'][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})['then'](function(_0xe35486){var _0x4f2cff=_[_0x7f13('0x2e')](_0xe35486,function(_0x4210de){return Number(_0x4210de[_0x7f13('0x5f')]);});return db[_0x7f13('0x60')][_0x7f13('0x5d')]({'where':{'UserId':{'$in':_0x1c4058},'MailQueueId':{'$in':_0x4f2cff}},'transaction':_0x4b1525});})['then'](function(){var _0x5d6d69=_0x7f13('0x61')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x5d6d69,{'type':db[_0x7f13('0x57')]['QueryTypes'][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x1b688f){var _0x2228fb=_['map'](_0x1b688f,function(_0x442fcd){return Number(_0x442fcd[_0x7f13('0x62')]);});return db[_0x7f13('0x63')]['destroy']({'where':{'UserId':{'$in':_0x1c4058},'SmsQueueId':{'$in':_0x2228fb}},'transaction':_0x4b1525});})[_0x7f13('0x29')](function(){var _0x30bb20=_0x7f13('0x64')+_0x123899;return db['sequelize'][_0x7f13('0x33')](_0x30bb20,{'type':db[_0x7f13('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x4f2352){var _0x23b125=_[_0x7f13('0x2e')](_0x4f2352,function(_0x5d0b81){return Number(_0x5d0b81[_0x7f13('0x65')]);});return db[_0x7f13('0x66')]['destroy']({'where':{'UserId':{'$in':_0x1c4058},'ChatQueueId':{'$in':_0x23b125}},'transaction':_0x4b1525});})[_0x7f13('0x29')](function(){var _0x3a4e3f=_0x7f13('0x67')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x3a4e3f,{'type':db[_0x7f13('0x57')]['QueryTypes'][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x59ca78){var _0xd2671e=_[_0x7f13('0x2e')](_0x59ca78,function(_0x5a3181){return Number(_0x5a3181[_0x7f13('0x68')]);});return db['UserFaxQueue'][_0x7f13('0x5d')]({'where':{'UserId':{'$in':_0x1c4058},'FaxQueueId':{'$in':_0xd2671e}},'transaction':_0x4b1525});})[_0x7f13('0x29')](function(){var _0x2431a1=_0x7f13('0x69')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x2431a1,{'type':db['Sequelize']['QueryTypes'][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x536d24){var _0x45ab7c=_[_0x7f13('0x2e')](_0x536d24,function(_0x35ceba){return Number(_0x35ceba['OpenchannelQueueId']);});return db[_0x7f13('0x6a')][_0x7f13('0x5d')]({'where':{'UserId':{'$in':_0x1c4058},'OpenchannelQueueId':{'$in':_0x45ab7c}},'transaction':_0x4b1525});})['then'](function(){var _0x76ff58=_0x7f13('0x6b')+_0x123899;return db[_0x7f13('0x54')][_0x7f13('0x33')](_0x76ff58,{'type':db[_0x7f13('0x57')][_0x7f13('0x5a')][_0x7f13('0x58')],'raw':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x1046b9){var _0x4d112b=_[_0x7f13('0x2e')](_0x1046b9,function(_0x5435c7){return Number(_0x5435c7['WhatsappQueueId']);});return db[_0x7f13('0x6c')][_0x7f13('0x5d')]({'where':{'UserId':{'$in':_0x1c4058},'WhatsappQueueId':{'$in':_0x4d112b}},'transaction':_0x4b1525});})[_0x7f13('0x29')](function(){return db['TeamVoicePrefix'][_0x7f13('0x4f')]({'where':{'TeamId':_0x123899}});})[_0x7f13('0x29')](function(_0x1172f3){if(_0x1172f3===null){return;}return db[_0x7f13('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x1c4058},'VoicePrefixId':_0x1172f3[_0x7f13('0x6e')]},'transaction':_0x4b1525});})['then'](function(){return db[_0x7f13('0x40')][_0x7f13('0x5d')]({'where':{'id':_0x123899},'cascade':!![],'transaction':_0x4b1525});})[_0x7f13('0x29')](function(_0x40585a){if(_0x40585a===0x0){_0x29a701[_0x7f13('0x1d')](0x194);}else{return db[_0x7f13('0x51')][_0x7f13('0x5d')]({'where':{'type':'Teams','resourceId':_0x123899},'cascade':!![],'transaction':_0x4b1525})['then'](function(){_0x29a701['status'](0xcc)['end']();});}})[_0x7f13('0x43')](function(_0x47fa4b){_0x29a701[_0x7f13('0x1e')](0x1f4)[_0x7f13('0x2c')](_0x47fa4b);});});};exports[_0x7f13('0x6f')]=function(_0xd911c,_0x851431,_0x32e405){return db[_0x7f13('0x40')][_0x7f13('0x70')]({'where':{'id':_0xd911c[_0x7f13('0x45')]['id']}})[_0x7f13('0x29')](handleEntityNotFound(_0x851431,null))[_0x7f13('0x29')](function(_0x3b1033){if(!_0xd911c[_0x7f13('0x33')]['channel']||!utils[_0x7f13('0x71')](_0xd911c['query'][_0x7f13('0x72')])){throw new db[(_0x7f13('0x57'))][(_0x7f13('0x73'))](_0x7f13('0x74'));}var _0xd8ab22={};var _0x326db0={};_0x326db0[_0x7f13('0x32')]=_[_0x7f13('0x46')](db[_[_0x7f13('0x75')](_0xd911c[_0x7f13('0x33')]['channel'][_0x7f13('0x76')]())+'Queue'][_0x7f13('0x2f')]);_0x326db0[_0x7f13('0x33')]=_[_0x7f13('0x46')](_0xd911c[_0x7f13('0x33')]);_0x326db0[_0x7f13('0x34')]=_['intersection'](_0x326db0[_0x7f13('0x32')],_0x326db0[_0x7f13('0x33')]);_0xd8ab22[_0x7f13('0x35')]=_[_0x7f13('0x36')](_0x326db0[_0x7f13('0x32')],qs['fields'](_0xd911c['query']['fields']));_0xd8ab22['attributes']=_0xd8ab22['attributes'][_0x7f13('0x38')]?_0xd8ab22['attributes']:_0x326db0[_0x7f13('0x32')];_0xd8ab22[_0x7f13('0x24')]=qs['limit'](_0xd911c[_0x7f13('0x33')][_0x7f13('0x24')]);_0xd8ab22[_0x7f13('0x21')]=qs[_0x7f13('0x21')](_0xd911c['query']['offset']);_0xd8ab22['order']=qs['sort'](_0xd911c[_0x7f13('0x33')][_0x7f13('0x3a')]);_0xd8ab22[_0x7f13('0x3b')]=qs[_0x7f13('0x34')](_[_0x7f13('0x3c')](_0xd911c[_0x7f13('0x33')],_0x326db0[_0x7f13('0x34')]));_0xd8ab22=_['merge']({},_0xd8ab22,_0xd911c[_0x7f13('0x3f')]);return _0x3b1033['get'+_[_0x7f13('0x75')](_0xd911c[_0x7f13('0x33')]['channel'][_0x7f13('0x76')]())+_0x7f13('0x77')](_0xd8ab22);})[_0x7f13('0x29')](respondWithResult(_0x851431,null))[_0x7f13('0x43')](handleError(_0x851431,null));};exports[_0x7f13('0x78')]=function(_0x12e14e,_0x3ae4f8,_0x511424){return db[_0x7f13('0x40')][_0x7f13('0x70')]({'where':{'id':_0x12e14e[_0x7f13('0x45')]['id']}})[_0x7f13('0x29')](function(_0x4393ad){if(_0x4393ad){if(!_0x12e14e[_0x7f13('0x49')][_0x7f13('0x72')]||!utils[_0x7f13('0x71')](_0x12e14e[_0x7f13('0x49')]['channel'])){throw new db[(_0x7f13('0x57'))]['ValidationError'](_0x7f13('0x74'));}return _0x4393ad[_0x7f13('0x79')+_['capitalize'](_0x12e14e[_0x7f13('0x49')]['channel'][_0x7f13('0x76')]())+_0x7f13('0x77')](_0x12e14e[_0x7f13('0x49')][_0x7f13('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x3ae4f8,null))[_0x7f13('0x29')](respondWithStatusCode(_0x3ae4f8,null))[_0x7f13('0x43')](handleError(_0x3ae4f8,null));};exports[_0x7f13('0x7b')]=function(_0x4e5d16,_0x33a0e8,_0x109d4f){return db['Team'][_0x7f13('0x70')]({'where':{'id':_0x4e5d16[_0x7f13('0x45')]['id']}})[_0x7f13('0x29')](function(_0x5020c2){if(_0x5020c2){if(!_0x4e5d16[_0x7f13('0x33')][_0x7f13('0x72')]||!utils[_0x7f13('0x71')](_0x4e5d16[_0x7f13('0x33')][_0x7f13('0x72')])){throw new db['Sequelize'][(_0x7f13('0x73'))](_0x7f13('0x74'));}return _0x5020c2['remove'+_[_0x7f13('0x75')](_0x4e5d16[_0x7f13('0x33')][_0x7f13('0x72')][_0x7f13('0x76')]())+_0x7f13('0x77')](_0x4e5d16[_0x7f13('0x33')][_0x7f13('0x7a')]);}return null;})['then'](handleEntityNotFound(_0x33a0e8,null))[_0x7f13('0x29')](respondWithStatusCode(_0x33a0e8,null))[_0x7f13('0x43')](handleError(_0x33a0e8,null));};exports[_0x7f13('0x7c')]=function(_0xcb57b2,_0x145285){var _0x47f290=_[_0x7f13('0x7d')](_0xcb57b2[_0x7f13('0x49')][_0x7f13('0x7a')])?_0xcb57b2['body'][_0x7f13('0x7a')]:[_0xcb57b2[_0x7f13('0x49')][_0x7f13('0x7a')]];var _0x4e5033=_0xcb57b2[_0x7f13('0x45')]['id'];return db['Team']['find']({'where':{'id':_0x4e5033}})['then'](handleEntityNotFound(_0x145285,null))['then'](function(_0x37a5de){if(_0x37a5de){var _0x250f3e=[_0x7f13('0x7e'),_0x7f13('0x7f'),'Mail','Sms',_0x7f13('0x80'),_0x7f13('0x81'),_0x7f13('0x82')];return db[_0x7f13('0x54')][_0x7f13('0x55')](function(_0x3c5168){var _0x1b960d=_['map'](_0x250f3e,function(_0x17f9eb){var _0x2e7f3a={'attributes':['id',_0x7f13('0x2b')]};if(_0x17f9eb===_0x7f13('0x7e')){_0x2e7f3a[_0x7f13('0x83')]={'attributes':['penalty']};}return _0x37a5de[_0x7f13('0x4a')+_0x17f9eb+_0x7f13('0x77')](_0x2e7f3a)[_0x7f13('0x29')](function(_0xd0a85){var _0x4d2966=_[_0x7f13('0x2e')](_0xd0a85,function(_0xde60e7){var _0xfa8f5=_[_0x7f13('0x2e')](_0x47f290,function(_0x58b5c0){var _0x104d6d={'where':{'UserId':_0x58b5c0,[_0x17f9eb+_0x7f13('0x84')]:_0xde60e7['id']},'transaction':_0x3c5168};if(_0x17f9eb===_0x7f13('0x7e')){_0x104d6d[_0x7f13('0x19')]={'penalty':_0xde60e7[_0x7f13('0x85')][_0x7f13('0x86')]};}return db[_0x7f13('0x87')+_0x17f9eb+_0x7f13('0x88')][_0x7f13('0x89')](_0x104d6d)['then'](function(){socket[_0x7f13('0x8a')](_0x7f13('0x4d')+_0x17f9eb+'Queue:save',{'UserId':_0x58b5c0,[_0x17f9eb+'QueueId']:_0xde60e7['id']});if(_0x17f9eb!==_0x7f13('0x7e')){return;}return db[_0x7f13('0x87')][_0x7f13('0x8b')]({'where':{'id':_0x47f290,'online':0x1},'attributes':['id',_0x7f13('0x2b'),_0x7f13('0x8c'),_0x7f13('0x8d'),_0x7f13('0x8e')],'raw':!![]})['then'](function(_0x5abb75){var _0x19859b=_[_0x7f13('0x2e')](_0x5abb75,function(_0x441da2){return db[_0x7f13('0x8f')][_0x7f13('0x90')]({'membername':_0x441da2[_0x7f13('0x2b')],'UserId':_0x441da2['id'],'queue_name':_0xde60e7[_0x7f13('0x2b')],'VoiceQueueId':_0xde60e7['id'],'interface':_[_0x7f13('0x91')](_0x441da2[_0x7f13('0x8e')])?util[_0x7f13('0x92')](_0x7f13('0x93'),_0x441da2[_0x7f13('0x2b')]):_0x441da2[_0x7f13('0x8e')],'paused':_0x441da2[_0x7f13('0x8d')]||![],'penalty':_0xde60e7[_0x7f13('0x85')][_0x7f13('0x86')]},{'transaction':_0x3c5168});});return Promise['all'](_0x19859b);});});});return Promise['all'](_0xfa8f5);});return Promise[_0x7f13('0x94')](_0x4d2966);})[_0x7f13('0x29')](function(){return db[_0x7f13('0x95')][_0x7f13('0x70')]({'where':{'teamId':_0x4e5033}})[_0x7f13('0x29')](function(_0x1e0a4d){if(_0x1e0a4d){var _0x4e846b=_[_0x7f13('0x2e')](_0x47f290,function(_0x1a2f44){db[_0x7f13('0x6d')]['upsert']({'UserId':_0x1a2f44,'VoicePrefixId':_0x1e0a4d[_0x7f13('0x6e')]});});return Promise[_0x7f13('0x94')](_0x4e846b);}});});});return Promise[_0x7f13('0x94')](_0x1b960d)['then'](function(){return _0x37a5de[_0x7f13('0x7c')](_0x47f290,{'transaction':_0x3c5168})[_0x7f13('0x96')](function(_0x5c6bc0){return _0x5c6bc0;});});});}})[_0x7f13('0x29')](respondWithResult(_0x145285,null))[_0x7f13('0x43')](handleError(_0x145285,null));};exports[_0x7f13('0x97')]=function(_0xbe1f33,_0x3156aa){var _0x4a3327=_[_0x7f13('0x7d')](_0xbe1f33[_0x7f13('0x33')]['ids'])?_0xbe1f33['query'][_0x7f13('0x7a')]:[_0xbe1f33[_0x7f13('0x33')][_0x7f13('0x7a')]];var _0x5525e2=_0xbe1f33[_0x7f13('0x45')]['id'];return db[_0x7f13('0x40')][_0x7f13('0x4f')]({'where':{'id':_0x5525e2}})[_0x7f13('0x29')](handleEntityNotFound(_0x3156aa,null))[_0x7f13('0x29')](function(_0xf4f085){if(_0xf4f085){var _0x5180b2=[_0x7f13('0x7e'),_0x7f13('0x7f'),'Mail','Sms','Fax',_0x7f13('0x81'),_0x7f13('0x82')];return db[_0x7f13('0x54')][_0x7f13('0x55')](function(_0x37ccfd){var _0x5d4838=_[_0x7f13('0x2e')](_0x5180b2,function(_0x5bded0){var _0x1d7e57={'attributes':['id',_0x7f13('0x2b')]};return _0xf4f085['get'+_0x5bded0+'Queues'](_0x1d7e57)[_0x7f13('0x29')](function(_0x1c19de){var _0x33625d=_[_0x7f13('0x2e')](_0x1c19de,function(_0x54bbdf){return _0x54bbdf[_0x7f13('0x97')](_0x4a3327,{'transaction':_0x37ccfd})['then'](function(){var _0x3345eb=_['map'](_0x4a3327,function(_0x4c0019){socket[_0x7f13('0x8a')](_0x7f13('0x4d')+_0x5bded0+'Queue:remove',{'UserId':Number(_0x4c0019),[_0x5bded0+'QueueId']:_0x54bbdf['id']});if(_0x5bded0!==_0x7f13('0x7e')){return;}return db['UserVoiceQueueRt'][_0x7f13('0x5d')]({'where':{'VoiceQueueId':_0x54bbdf['id'],'UserId':_0x4c0019},'transaction':_0x37ccfd});});return Promise[_0x7f13('0x94')](_0x3345eb);});});return Promise[_0x7f13('0x94')](_0x33625d);});});return Promise[_0x7f13('0x94')](_0x5d4838)[_0x7f13('0x29')](function(){return _0xf4f085[_0x7f13('0x97')](_0x4a3327,{'transaction':_0x37ccfd});})[_0x7f13('0x29')](function(){return db[_0x7f13('0x95')][_0x7f13('0x70')]({'where':{'teamId':_0x5525e2}})['then'](function(_0x393045){if(_0x393045){var _0x428360=_['map'](_0x4a3327,function(_0xc5367a){db[_0x7f13('0x6d')][_0x7f13('0x5d')]({'where':{'UserId':_0xc5367a,'VoicePrefixId':_0x393045[_0x7f13('0x6e')]}});});return Promise['all'](_0x428360);}});});});}})['then'](respondWithStatusCode(_0x3156aa,null))[_0x7f13('0x43')](handleError(_0x3156aa,null));};exports['getAgents']=function(_0x2a0b8a,_0x137926,_0x2f7903){var _0xf5c826={};var _0x219a96={};var _0x5ca75b;var _0x263168;return db[_0x7f13('0x40')]['findOne']({'where':{'id':_0x2a0b8a[_0x7f13('0x45')]['id']}})[_0x7f13('0x29')](handleEntityNotFound(_0x137926,null))[_0x7f13('0x29')](function(_0x50a1a1){if(_0x50a1a1){_0x5ca75b=_0x50a1a1;_0x219a96[_0x7f13('0x32')]=_[_0x7f13('0x46')](db[_0x7f13('0x87')]['rawAttributes']);_0x219a96[_0x7f13('0x33')]=_[_0x7f13('0x46')](_0x2a0b8a[_0x7f13('0x33')]);_0x219a96[_0x7f13('0x34')]=_[_0x7f13('0x36')](_0x219a96['model'],_0x219a96['query']);_0xf5c826['attributes']=_['intersection'](_0x219a96[_0x7f13('0x32')],qs[_0x7f13('0x37')](_0x2a0b8a[_0x7f13('0x33')][_0x7f13('0x37')]));_0xf5c826[_0x7f13('0x35')]=_0xf5c826[_0x7f13('0x35')][_0x7f13('0x38')]?_0xf5c826['attributes']:_0x219a96[_0x7f13('0x32')];_0xf5c826['order']=qs['sort'](_0x2a0b8a[_0x7f13('0x33')][_0x7f13('0x3a')]);_0xf5c826[_0x7f13('0x3b')]=qs[_0x7f13('0x34')](_['pick'](_0x2a0b8a['query'],_0x219a96[_0x7f13('0x34')]));if(_0x2a0b8a[_0x7f13('0x33')][_0x7f13('0x98')]){_0xf5c826['where']=_[_0x7f13('0x3d')](_0xf5c826[_0x7f13('0x3b')],{'$or':_[_0x7f13('0x2e')](_0xf5c826[_0x7f13('0x35')],function(_0x43bd28){var _0x351316={};_0x351316[_0x43bd28]={'$like':'%'+_0x2a0b8a['query']['filter']+'%'};return _0x351316;})});}_0xf5c826=_[_0x7f13('0x3d')]({},_0xf5c826,_0x2a0b8a[_0x7f13('0x3f')]);return _0x5ca75b['getAgents'](_0xf5c826);}})['then'](function(_0x275542){if(_0x275542){_0x263168=_0x275542['length'];if(!_0x2a0b8a[_0x7f13('0x33')]['hasOwnProperty'](_0x7f13('0x99'))){_0xf5c826['limit']=qs[_0x7f13('0x24')](_0x2a0b8a[_0x7f13('0x33')][_0x7f13('0x24')]);_0xf5c826[_0x7f13('0x21')]=qs[_0x7f13('0x21')](_0x2a0b8a['query'][_0x7f13('0x21')]);}return _0x5ca75b[_0x7f13('0x9a')](_0xf5c826);}})['then'](function(_0x55fd5f){if(_0x55fd5f){return _0x55fd5f?{'count':_0x263168,'rows':_0x55fd5f}:null;}})[_0x7f13('0x29')](respondWithResult(_0x137926,null))[_0x7f13('0x43')](handleError(_0x137926,null));}; \ No newline at end of file +var _0x4b57=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','end','offset','undefined','limit','count','set','Content-Range','apply','update','then','stack','name','status','index','map','Team','rawAttributes','fieldName','key','query','keys','attributes','intersection','fields','length','model','hasOwnProperty','order','sort','where','filters','pick','filter','type','merge','include','findAll','rows','params','includeAll','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','sequelize','Sequelize','UserId','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','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','sendStatus','send','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','isValidChannel','add','removeQueues','remove','ids','addAgents','Voice','Sms','Fax','Openchannel','Whatsapp','transaction','through','QueueId','TeamVoiceQueue','penalty','emit','Queue:save','User','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','TeamVoicePrefix','spread','removeAgents','Chat','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x19508c,_0x4b8716){var _0x3ffbdd=function(_0x29f7d6){while(--_0x29f7d6){_0x19508c['push'](_0x19508c['shift']());}};_0x3ffbdd(++_0x4b8716);}(_0x4b57,0x8a));var _0x74b5=function(_0x47de9a,_0x40cf23){_0x47de9a=_0x47de9a-0x0;var _0x4b9d6c=_0x4b57[_0x47de9a];return _0x4b9d6c;};'use strict';var emlformat=require(_0x74b5('0x0'));var rimraf=require(_0x74b5('0x1'));var zipdir=require(_0x74b5('0x2'));var jsonpatch=require(_0x74b5('0x3'));var rp=require(_0x74b5('0x4'));var moment=require(_0x74b5('0x5'));var BPromise=require(_0x74b5('0x6'));var Mustache=require(_0x74b5('0x7'));var util=require('util');var path=require(_0x74b5('0x8'));var sox=require(_0x74b5('0x9'));var csv=require(_0x74b5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74b5('0xb'));var squel=require(_0x74b5('0xc'));var crypto=require(_0x74b5('0xd'));var jsforce=require(_0x74b5('0xe'));var deskjs=require(_0x74b5('0xf'));var toCsv=require(_0x74b5('0xa'));var querystring=require('querystring');var Papa=require(_0x74b5('0x10'));var Redis=require('ioredis');var authService=require(_0x74b5('0x11'));var qs=require(_0x74b5('0x12'));var as=require(_0x74b5('0x13'));var hardwareService=require(_0x74b5('0x14'));var logger=require(_0x74b5('0x15'))('api');var utils=require(_0x74b5('0x16'));var config=require(_0x74b5('0x17'));var licenseUtil=require(_0x74b5('0x18'));var db=require(_0x74b5('0x19'))['db'];config[_0x74b5('0x1a')]=_['defaults'](config[_0x74b5('0x1a')],{'host':_0x74b5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x74b5('0x1a')]));require(_0x74b5('0x1c'))[_0x74b5('0x1d')](socket);function respondWithStatusCode(_0xded25d,_0x1795e7){_0x1795e7=_0x1795e7||0xcc;return function(_0x2c809e){if(_0x2c809e){return _0xded25d['sendStatus'](_0x1795e7);}return _0xded25d['status'](_0x1795e7)[_0x74b5('0x1e')]();};}function respondWithResult(_0x467276,_0x13acaa){_0x13acaa=_0x13acaa||0xc8;return function(_0x445dcc){if(_0x445dcc){return _0x467276['status'](_0x13acaa)['json'](_0x445dcc);}};}function respondWithFilteredResult(_0x25056c,_0x254536){return function(_0x4309bd){if(_0x4309bd){var _0x251dc9=typeof _0x254536[_0x74b5('0x1f')]===_0x74b5('0x20')&&typeof _0x254536[_0x74b5('0x21')]==='undefined';var _0xe15bc0=_0x4309bd[_0x74b5('0x22')];var _0x1027e4=_0x251dc9?0x0:_0x254536[_0x74b5('0x1f')];var _0x39292b=_0x251dc9?_0x4309bd[_0x74b5('0x22')]:_0x254536[_0x74b5('0x1f')]+_0x254536[_0x74b5('0x21')];var _0x5bab58;if(_0x39292b>=_0xe15bc0){_0x39292b=_0xe15bc0;_0x5bab58=0xc8;}else{_0x5bab58=0xce;}_0x25056c['status'](_0x5bab58);return _0x25056c[_0x74b5('0x23')](_0x74b5('0x24'),_0x1027e4+'-'+_0x39292b+'/'+_0xe15bc0)['json'](_0x4309bd);}return null;};}function patchUpdates(_0x346656){return function(_0x5c10d4){try{jsonpatch[_0x74b5('0x25')](_0x5c10d4,_0x346656,!![]);}catch(_0x5bc51a){return BPromise['reject'](_0x5bc51a);}return _0x5c10d4['save']();};}function saveUpdates(_0x443662,_0x3f17d4){return function(_0xe5c83f){if(_0xe5c83f){return _0xe5c83f[_0x74b5('0x26')](_0x443662)[_0x74b5('0x27')](function(_0x49b1c8){return _0x49b1c8;});}return null;};}function handleEntityNotFound(_0x2800b7,_0x5267f3){return function(_0x253f4c){if(!_0x253f4c){_0x2800b7['sendStatus'](0x194);}return _0x253f4c;};}function handleError(_0x2e08cb,_0x50d87b){_0x50d87b=_0x50d87b||0x1f4;return function(_0x35ee4f){logger['error'](_0x35ee4f[_0x74b5('0x28')]);if(_0x35ee4f['name']){delete _0x35ee4f[_0x74b5('0x29')];}_0x2e08cb[_0x74b5('0x2a')](_0x50d87b)['send'](_0x35ee4f);};}exports[_0x74b5('0x2b')]=function(_0x5405aa,_0x5af72b){var _0x47e87c={},_0x3bca35={},_0x536d2c={'count':0x0,'rows':[]};var _0x49225c=_[_0x74b5('0x2c')](db[_0x74b5('0x2d')][_0x74b5('0x2e')],function(_0xbcb773){return{'name':_0xbcb773[_0x74b5('0x2f')],'type':_0xbcb773['type'][_0x74b5('0x30')]};});_0x3bca35['model']=_[_0x74b5('0x2c')](_0x49225c,_0x74b5('0x29'));_0x3bca35[_0x74b5('0x31')]=_[_0x74b5('0x32')](_0x5405aa[_0x74b5('0x31')]);_0x3bca35['filters']=_['intersection'](_0x3bca35['model'],_0x3bca35[_0x74b5('0x31')]);_0x47e87c[_0x74b5('0x33')]=_[_0x74b5('0x34')](_0x3bca35['model'],qs[_0x74b5('0x35')](_0x5405aa[_0x74b5('0x31')][_0x74b5('0x35')]));_0x47e87c[_0x74b5('0x33')]=_0x47e87c[_0x74b5('0x33')][_0x74b5('0x36')]?_0x47e87c[_0x74b5('0x33')]:_0x3bca35[_0x74b5('0x37')];if(!_0x5405aa[_0x74b5('0x31')][_0x74b5('0x38')]('nolimit')){_0x47e87c[_0x74b5('0x21')]=qs['limit'](_0x5405aa[_0x74b5('0x31')][_0x74b5('0x21')]);_0x47e87c['offset']=qs[_0x74b5('0x1f')](_0x5405aa['query'][_0x74b5('0x1f')]);}_0x47e87c[_0x74b5('0x39')]=qs['sort'](_0x5405aa[_0x74b5('0x31')][_0x74b5('0x3a')]);_0x47e87c[_0x74b5('0x3b')]=qs[_0x74b5('0x3c')](_[_0x74b5('0x3d')](_0x5405aa['query'],_0x3bca35[_0x74b5('0x3c')]),_0x49225c);if(_0x5405aa['query'][_0x74b5('0x3e')]){_0x47e87c[_0x74b5('0x3b')]=_['merge'](_0x47e87c[_0x74b5('0x3b')],{'$or':_['map'](_0x49225c,function(_0xa9166d){if(_0xa9166d[_0x74b5('0x3f')]!=='VIRTUAL'){var _0x5baaf6={};_0x5baaf6[_0xa9166d[_0x74b5('0x29')]]={'$like':'%'+_0x5405aa[_0x74b5('0x31')][_0x74b5('0x3e')]+'%'};return _0x5baaf6;}})});}_0x47e87c=_[_0x74b5('0x40')]({},_0x47e87c,_0x5405aa['options']);var _0x5997fa={'where':_0x47e87c['where']};return db[_0x74b5('0x2d')][_0x74b5('0x22')](_0x5997fa)['then'](function(_0x35a2c7){_0x536d2c['count']=_0x35a2c7;if(_0x5405aa[_0x74b5('0x31')]['includeAll']){_0x47e87c[_0x74b5('0x41')]=[{'all':!![]}];}return db[_0x74b5('0x2d')][_0x74b5('0x42')](_0x47e87c);})['then'](function(_0xc5806c){_0x536d2c[_0x74b5('0x43')]=_0xc5806c;return _0x536d2c;})[_0x74b5('0x27')](respondWithFilteredResult(_0x5af72b,_0x47e87c))['catch'](handleError(_0x5af72b,null));};exports['show']=function(_0x59148c,_0x2efcbb){var _0x1bd68e={'raw':![],'where':{'id':_0x59148c[_0x74b5('0x44')]['id']}},_0x14d606={};_0x14d606['model']=_[_0x74b5('0x32')](db['Team']['rawAttributes']);_0x14d606[_0x74b5('0x31')]=_[_0x74b5('0x32')](_0x59148c['query']);_0x14d606[_0x74b5('0x3c')]=_[_0x74b5('0x34')](_0x14d606[_0x74b5('0x37')],_0x14d606['query']);_0x1bd68e[_0x74b5('0x33')]=_['intersection'](_0x14d606[_0x74b5('0x37')],qs[_0x74b5('0x35')](_0x59148c['query'][_0x74b5('0x35')]));_0x1bd68e[_0x74b5('0x33')]=_0x1bd68e[_0x74b5('0x33')][_0x74b5('0x36')]?_0x1bd68e[_0x74b5('0x33')]:_0x14d606[_0x74b5('0x37')];if(_0x59148c[_0x74b5('0x31')][_0x74b5('0x45')]){_0x1bd68e['include']=[{'all':!![]}];}_0x1bd68e=_[_0x74b5('0x40')]({},_0x1bd68e,_0x59148c[_0x74b5('0x46')]);return db[_0x74b5('0x2d')][_0x74b5('0x47')](_0x1bd68e)['then'](handleEntityNotFound(_0x2efcbb,null))[_0x74b5('0x27')](respondWithResult(_0x2efcbb,null))[_0x74b5('0x48')](handleError(_0x2efcbb,null));};exports['create']=function(_0x40840b,_0x1ad29c){return db[_0x74b5('0x2d')][_0x74b5('0x49')](_0x40840b['body'],{})['then'](function(_0x2482eb){var _0x4f8f41=_0x40840b[_0x74b5('0x4a')][_0x74b5('0x4b')]({'plain':!![]});if(!_0x4f8f41)throw new Error(_0x74b5('0x4c'));if(_0x4f8f41['role']===_0x74b5('0x4a')){var _0x40e986=_0x2482eb[_0x74b5('0x4b')]({'plain':!![]});var _0x175ade=_0x74b5('0x4d');return db['UserProfileSection'][_0x74b5('0x47')]({'where':{'name':_0x175ade,'userProfileId':_0x4f8f41['userProfileId']},'raw':!![]})[_0x74b5('0x27')](function(_0x20c9e8){if(_0x20c9e8&&_0x20c9e8['autoAssociation']===0x0){return db[_0x74b5('0x4e')]['create']({'name':_0x40e986[_0x74b5('0x29')],'resourceId':_0x40e986['id'],'type':_0x20c9e8[_0x74b5('0x29')],'sectionId':_0x20c9e8['id']},{})[_0x74b5('0x27')](function(){return _0x2482eb;});}else{return _0x2482eb;}})['catch'](function(_0x5ae939){logger['error'](_0x74b5('0x4f'),_0x5ae939);throw _0x5ae939;});}return _0x2482eb;})['then'](respondWithResult(_0x1ad29c,0xc9))[_0x74b5('0x48')](handleError(_0x1ad29c,null));};exports[_0x74b5('0x26')]=function(_0x2203e4,_0x5b2ddf){if(_0x2203e4['body']['id']){delete _0x2203e4[_0x74b5('0x50')]['id'];}return db[_0x74b5('0x2d')][_0x74b5('0x47')]({'where':{'id':_0x2203e4[_0x74b5('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b2ddf,null))[_0x74b5('0x27')](saveUpdates(_0x2203e4[_0x74b5('0x50')],null))[_0x74b5('0x27')](respondWithResult(_0x5b2ddf,null))[_0x74b5('0x48')](handleError(_0x5b2ddf,null));};exports[_0x74b5('0x51')]=function(_0x128439,_0x5108c1){var _0x20bef3=_0x128439[_0x74b5('0x44')]['id'];var _0x113964=[];return db[_0x74b5('0x52')]['transaction'](function(_0xf92ea8){var _0xec6fca='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x20bef3;return db[_0x74b5('0x52')][_0x74b5('0x31')](_0xec6fca,{'type':db[_0x74b5('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xf92ea8})[_0x74b5('0x27')](function(_0x3b2f4e){_0x113964=_[_0x74b5('0x2c')](_0x3b2f4e,function(_0x351ae4){return Number(_0x351ae4[_0x74b5('0x54')]);});})[_0x74b5('0x27')](function(){var _0x2655ef=_0x74b5('0x55')+_0x20bef3;return db['sequelize']['query'](_0x2655ef,{'type':db[_0x74b5('0x53')][_0x74b5('0x56')][_0x74b5('0x57')],'raw':!![],'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(_0x32e12f){var _0x4a4eef=_['map'](_0x32e12f,function(_0x38004a){return Number(_0x38004a[_0x74b5('0x58')]);});return db[_0x74b5('0x59')]['destroy']({'where':{'UserId':{'$in':_0x113964},'VoiceQueueId':{'$in':_0x4a4eef}},'transaction':_0xf92ea8});})['then'](function(){var _0x7da27f=_0x74b5('0x5a')+_0x20bef3;return db[_0x74b5('0x52')][_0x74b5('0x31')](_0x7da27f,{'type':db[_0x74b5('0x53')][_0x74b5('0x56')][_0x74b5('0x57')],'raw':!![],'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(_0x3a426f){var _0x3134d1=_[_0x74b5('0x2c')](_0x3a426f,function(_0x1a8c82){return Number(_0x1a8c82['MailQueueId']);});return db[_0x74b5('0x5b')]['destroy']({'where':{'UserId':{'$in':_0x113964},'MailQueueId':{'$in':_0x3134d1}},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){var _0x2608c0=_0x74b5('0x5c')+_0x20bef3;return db['sequelize']['query'](_0x2608c0,{'type':db['Sequelize'][_0x74b5('0x56')][_0x74b5('0x57')],'raw':!![],'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(_0x44efc5){var _0xe1435d=_[_0x74b5('0x2c')](_0x44efc5,function(_0x4b9e1e){return Number(_0x4b9e1e[_0x74b5('0x5d')]);});return db[_0x74b5('0x5e')]['destroy']({'where':{'UserId':{'$in':_0x113964},'SmsQueueId':{'$in':_0xe1435d}},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){var _0x1d0bd2=_0x74b5('0x5f')+_0x20bef3;return db[_0x74b5('0x52')]['query'](_0x1d0bd2,{'type':db['Sequelize'][_0x74b5('0x56')][_0x74b5('0x57')],'raw':!![],'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(_0x3a2c24){var _0x3a2a6b=_[_0x74b5('0x2c')](_0x3a2c24,function(_0xf9a93){return Number(_0xf9a93[_0x74b5('0x60')]);});return db[_0x74b5('0x61')][_0x74b5('0x51')]({'where':{'UserId':{'$in':_0x113964},'ChatQueueId':{'$in':_0x3a2a6b}},'transaction':_0xf92ea8});})['then'](function(){var _0x258729=_0x74b5('0x62')+_0x20bef3;return db['sequelize'][_0x74b5('0x31')](_0x258729,{'type':db[_0x74b5('0x53')][_0x74b5('0x56')]['SELECT'],'raw':!![],'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(_0x15d15d){var _0x3574a7=_[_0x74b5('0x2c')](_0x15d15d,function(_0xcdd54d){return Number(_0xcdd54d[_0x74b5('0x63')]);});return db['UserFaxQueue'][_0x74b5('0x51')]({'where':{'UserId':{'$in':_0x113964},'FaxQueueId':{'$in':_0x3574a7}},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){var _0x7f6387=_0x74b5('0x64')+_0x20bef3;return db['sequelize']['query'](_0x7f6387,{'type':db[_0x74b5('0x53')][_0x74b5('0x56')]['SELECT'],'raw':!![],'transaction':_0xf92ea8});})['then'](function(_0xc014d8){var _0x4ebc1b=_['map'](_0xc014d8,function(_0x4783a1){return Number(_0x4783a1[_0x74b5('0x65')]);});return db[_0x74b5('0x66')][_0x74b5('0x51')]({'where':{'UserId':{'$in':_0x113964},'OpenchannelQueueId':{'$in':_0x4ebc1b}},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){var _0x5da110='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x20bef3;return db[_0x74b5('0x52')][_0x74b5('0x31')](_0x5da110,{'type':db[_0x74b5('0x53')]['QueryTypes'][_0x74b5('0x57')],'raw':!![],'transaction':_0xf92ea8});})['then'](function(_0x2db310){var _0x582368=_['map'](_0x2db310,function(_0x4c4806){return Number(_0x4c4806[_0x74b5('0x67')]);});return db[_0x74b5('0x68')][_0x74b5('0x51')]({'where':{'UserId':{'$in':_0x113964},'WhatsappQueueId':{'$in':_0x582368}},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){return db['TeamVoicePrefix'][_0x74b5('0x47')]({'where':{'TeamId':_0x20bef3}});})[_0x74b5('0x27')](function(_0xec39fb){if(_0xec39fb===null){return;}return db[_0x74b5('0x69')][_0x74b5('0x51')]({'where':{'UserId':{'$in':_0x113964},'VoicePrefixId':_0xec39fb[_0x74b5('0x6a')]},'transaction':_0xf92ea8});})[_0x74b5('0x27')](function(){return db['Team'][_0x74b5('0x51')]({'where':{'id':_0x20bef3},'cascade':!![],'transaction':_0xf92ea8});})['then'](function(_0xe20327){if(_0xe20327===0x0){_0x5108c1[_0x74b5('0x6b')](0x194);}else{return db['UserProfileResource']['destroy']({'where':{'type':_0x74b5('0x4d'),'resourceId':_0x20bef3},'cascade':!![],'transaction':_0xf92ea8})['then'](function(){_0x5108c1[_0x74b5('0x2a')](0xcc)['end']();});}})[_0x74b5('0x48')](function(_0x509b77){_0x5108c1['status'](0x1f4)[_0x74b5('0x6c')](_0x509b77);});});};exports[_0x74b5('0x6d')]=function(_0x551364,_0x2bfea7,_0x23e5c3){return db[_0x74b5('0x2d')][_0x74b5('0x6e')]({'where':{'id':_0x551364[_0x74b5('0x44')]['id']}})[_0x74b5('0x27')](handleEntityNotFound(_0x2bfea7,null))[_0x74b5('0x27')](function(_0x29ad69){if(!_0x551364[_0x74b5('0x31')]['channel']||!utils['isValidChannel'](_0x551364[_0x74b5('0x31')][_0x74b5('0x6f')])){throw new db[(_0x74b5('0x53'))][(_0x74b5('0x70'))](_0x74b5('0x71'));}var _0x973278={};var _0x3fd9f5={};_0x3fd9f5['model']=_[_0x74b5('0x32')](db[_[_0x74b5('0x72')](_0x551364['query']['channel'][_0x74b5('0x73')]())+_0x74b5('0x74')][_0x74b5('0x2e')]);_0x3fd9f5[_0x74b5('0x31')]=_[_0x74b5('0x32')](_0x551364['query']);_0x3fd9f5[_0x74b5('0x3c')]=_[_0x74b5('0x34')](_0x3fd9f5['model'],_0x3fd9f5[_0x74b5('0x31')]);_0x973278[_0x74b5('0x33')]=_[_0x74b5('0x34')](_0x3fd9f5[_0x74b5('0x37')],qs[_0x74b5('0x35')](_0x551364['query'][_0x74b5('0x35')]));_0x973278['attributes']=_0x973278[_0x74b5('0x33')][_0x74b5('0x36')]?_0x973278['attributes']:_0x3fd9f5[_0x74b5('0x37')];_0x973278[_0x74b5('0x21')]=qs[_0x74b5('0x21')](_0x551364[_0x74b5('0x31')][_0x74b5('0x21')]);_0x973278[_0x74b5('0x1f')]=qs[_0x74b5('0x1f')](_0x551364[_0x74b5('0x31')][_0x74b5('0x1f')]);_0x973278[_0x74b5('0x39')]=qs[_0x74b5('0x3a')](_0x551364[_0x74b5('0x31')][_0x74b5('0x3a')]);_0x973278[_0x74b5('0x3b')]=qs[_0x74b5('0x3c')](_['pick'](_0x551364[_0x74b5('0x31')],_0x3fd9f5[_0x74b5('0x3c')]));_0x973278=_[_0x74b5('0x40')]({},_0x973278,_0x551364[_0x74b5('0x46')]);return _0x29ad69[_0x74b5('0x4b')+_['capitalize'](_0x551364[_0x74b5('0x31')][_0x74b5('0x6f')][_0x74b5('0x73')]())+_0x74b5('0x75')](_0x973278);})['then'](respondWithResult(_0x2bfea7,null))['catch'](handleError(_0x2bfea7,null));};exports['addQueues']=function(_0x2a88a8,_0x338acf,_0x4478bc){return db[_0x74b5('0x2d')][_0x74b5('0x6e')]({'where':{'id':_0x2a88a8[_0x74b5('0x44')]['id']}})[_0x74b5('0x27')](function(_0xd35cfd){if(_0xd35cfd){if(!_0x2a88a8['body']['channel']||!utils[_0x74b5('0x76')](_0x2a88a8[_0x74b5('0x50')]['channel'])){throw new db['Sequelize'][(_0x74b5('0x70'))](_0x74b5('0x71'));}return _0xd35cfd[_0x74b5('0x77')+_[_0x74b5('0x72')](_0x2a88a8[_0x74b5('0x50')][_0x74b5('0x6f')][_0x74b5('0x73')]())+_0x74b5('0x75')](_0x2a88a8['body']['ids']);}return null;})[_0x74b5('0x27')](handleEntityNotFound(_0x338acf,null))[_0x74b5('0x27')](respondWithStatusCode(_0x338acf,null))['catch'](handleError(_0x338acf,null));};exports[_0x74b5('0x78')]=function(_0x2002fc,_0x4e0708,_0x5373b6){return db[_0x74b5('0x2d')][_0x74b5('0x6e')]({'where':{'id':_0x2002fc['params']['id']}})['then'](function(_0x456a97){if(_0x456a97){if(!_0x2002fc[_0x74b5('0x31')][_0x74b5('0x6f')]||!utils['isValidChannel'](_0x2002fc[_0x74b5('0x31')][_0x74b5('0x6f')])){throw new db[(_0x74b5('0x53'))][(_0x74b5('0x70'))](_0x74b5('0x71'));}return _0x456a97[_0x74b5('0x79')+_[_0x74b5('0x72')](_0x2002fc[_0x74b5('0x31')][_0x74b5('0x6f')][_0x74b5('0x73')]())+_0x74b5('0x75')](_0x2002fc[_0x74b5('0x31')][_0x74b5('0x7a')]);}return null;})[_0x74b5('0x27')](handleEntityNotFound(_0x4e0708,null))[_0x74b5('0x27')](respondWithStatusCode(_0x4e0708,null))[_0x74b5('0x48')](handleError(_0x4e0708,null));};exports[_0x74b5('0x7b')]=function(_0x57b3f9,_0x20a22b){var _0x14d31e=_['isArray'](_0x57b3f9['body']['ids'])?_0x57b3f9[_0x74b5('0x50')]['ids']:[_0x57b3f9[_0x74b5('0x50')][_0x74b5('0x7a')]];var _0x4bccdd=_0x57b3f9[_0x74b5('0x44')]['id'];return db[_0x74b5('0x2d')][_0x74b5('0x47')]({'where':{'id':_0x4bccdd}})[_0x74b5('0x27')](handleEntityNotFound(_0x20a22b,null))['then'](function(_0x3c0c71){if(_0x3c0c71){var _0x249764=[_0x74b5('0x7c'),'Chat','Mail',_0x74b5('0x7d'),_0x74b5('0x7e'),_0x74b5('0x7f'),_0x74b5('0x80')];return db[_0x74b5('0x52')][_0x74b5('0x81')](function(_0x554508){var _0x150b31=_[_0x74b5('0x2c')](_0x249764,function(_0x51c48e){var _0x5f5728={'attributes':['id','name']};if(_0x51c48e==='Voice'){_0x5f5728[_0x74b5('0x82')]={'attributes':['penalty']};}return _0x3c0c71[_0x74b5('0x4b')+_0x51c48e+_0x74b5('0x75')](_0x5f5728)[_0x74b5('0x27')](function(_0x2311f8){var _0x2df0e2=_[_0x74b5('0x2c')](_0x2311f8,function(_0x4e54f8){var _0x4c5fe2=_[_0x74b5('0x2c')](_0x14d31e,function(_0x1652d5){var _0x36a66c={'where':{'UserId':_0x1652d5,[_0x51c48e+_0x74b5('0x83')]:_0x4e54f8['id']},'transaction':_0x554508};if(_0x51c48e===_0x74b5('0x7c')){_0x36a66c['defaults']={'penalty':_0x4e54f8[_0x74b5('0x84')][_0x74b5('0x85')]};}return db['User'+_0x51c48e+_0x74b5('0x74')]['findOrCreate'](_0x36a66c)['then'](function(){socket[_0x74b5('0x86')](_0x74b5('0x4a')+_0x51c48e+_0x74b5('0x87'),{'UserId':_0x1652d5,[_0x51c48e+'QueueId']:_0x4e54f8['id']});if(_0x51c48e!=='Voice'){return;}return db[_0x74b5('0x88')][_0x74b5('0x42')]({'where':{'id':_0x14d31e,'online':0x1},'attributes':['id',_0x74b5('0x29'),_0x74b5('0x89'),_0x74b5('0x8a'),_0x74b5('0x8b')],'raw':!![]})[_0x74b5('0x27')](function(_0xad50b8){var _0x4e6381=_[_0x74b5('0x2c')](_0xad50b8,function(_0x106df1){return db[_0x74b5('0x8c')][_0x74b5('0x8d')]({'membername':_0x106df1['name'],'UserId':_0x106df1['id'],'queue_name':_0x4e54f8[_0x74b5('0x29')],'VoiceQueueId':_0x4e54f8['id'],'interface':_[_0x74b5('0x8e')](_0x106df1[_0x74b5('0x8b')])?util[_0x74b5('0x8f')](_0x74b5('0x90'),_0x106df1[_0x74b5('0x29')]):_0x106df1[_0x74b5('0x8b')],'paused':_0x106df1[_0x74b5('0x8a')]||![],'penalty':_0x4e54f8[_0x74b5('0x84')][_0x74b5('0x85')]},{'transaction':_0x554508});});return Promise[_0x74b5('0x91')](_0x4e6381);});});});return Promise[_0x74b5('0x91')](_0x4c5fe2);});return Promise[_0x74b5('0x91')](_0x2df0e2);})[_0x74b5('0x27')](function(){return db[_0x74b5('0x92')][_0x74b5('0x6e')]({'where':{'teamId':_0x4bccdd}})['then'](function(_0x14cc1c){if(_0x14cc1c){var _0x23fdbd=_['map'](_0x14d31e,function(_0x1987c6){db['UserVoicePrefix'][_0x74b5('0x8d')]({'UserId':_0x1987c6,'VoicePrefixId':_0x14cc1c['VoicePrefixId']});});return Promise['all'](_0x23fdbd);}});});});return Promise[_0x74b5('0x91')](_0x150b31)['then'](function(){return _0x3c0c71['addAgents'](_0x14d31e,{'transaction':_0x554508})[_0x74b5('0x93')](function(_0x1ba0ea){return _0x1ba0ea;});});});}})['then'](respondWithResult(_0x20a22b,null))['catch'](handleError(_0x20a22b,null));};exports[_0x74b5('0x94')]=function(_0x5073b2,_0x57aff7){var _0x4fd67c=_['isArray'](_0x5073b2[_0x74b5('0x31')]['ids'])?_0x5073b2['query']['ids']:[_0x5073b2['query'][_0x74b5('0x7a')]];var _0x580fc3=_0x5073b2['params']['id'];return db[_0x74b5('0x2d')][_0x74b5('0x47')]({'where':{'id':_0x580fc3}})[_0x74b5('0x27')](handleEntityNotFound(_0x57aff7,null))[_0x74b5('0x27')](function(_0x4c1769){if(_0x4c1769){var _0x4ebd0c=[_0x74b5('0x7c'),_0x74b5('0x95'),'Mail',_0x74b5('0x7d'),'Fax','Openchannel',_0x74b5('0x80')];return db[_0x74b5('0x52')][_0x74b5('0x81')](function(_0xf00f2c){var _0x4d0484=_[_0x74b5('0x2c')](_0x4ebd0c,function(_0x32feaf){var _0x24e4dd={'attributes':['id',_0x74b5('0x29')]};return _0x4c1769[_0x74b5('0x4b')+_0x32feaf+_0x74b5('0x75')](_0x24e4dd)[_0x74b5('0x27')](function(_0x4028d4){var _0x33e461=_[_0x74b5('0x2c')](_0x4028d4,function(_0x384dda){return _0x384dda[_0x74b5('0x94')](_0x4fd67c,{'transaction':_0xf00f2c})['then'](function(){var _0x1e53a2=_['map'](_0x4fd67c,function(_0x1c5f47){socket['emit'](_0x74b5('0x4a')+_0x32feaf+_0x74b5('0x96'),{'UserId':Number(_0x1c5f47),[_0x32feaf+_0x74b5('0x83')]:_0x384dda['id']});if(_0x32feaf!=='Voice'){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x384dda['id'],'UserId':_0x1c5f47},'transaction':_0xf00f2c});});return Promise[_0x74b5('0x91')](_0x1e53a2);});});return Promise[_0x74b5('0x91')](_0x33e461);});});return Promise[_0x74b5('0x91')](_0x4d0484)[_0x74b5('0x27')](function(){return _0x4c1769['removeAgents'](_0x4fd67c,{'transaction':_0xf00f2c});})[_0x74b5('0x27')](function(){return db[_0x74b5('0x92')][_0x74b5('0x6e')]({'where':{'teamId':_0x580fc3}})[_0x74b5('0x27')](function(_0x54e5dd){if(_0x54e5dd){var _0x1ac237=_[_0x74b5('0x2c')](_0x4fd67c,function(_0x53ec85){db[_0x74b5('0x69')][_0x74b5('0x51')]({'where':{'UserId':_0x53ec85,'VoicePrefixId':_0x54e5dd[_0x74b5('0x6a')]}});});return Promise[_0x74b5('0x91')](_0x1ac237);}});});});}})[_0x74b5('0x27')](respondWithStatusCode(_0x57aff7,null))['catch'](handleError(_0x57aff7,null));};exports['getAgents']=function(_0x5ee9a8,_0x2b65af,_0x1c286d){var _0x2c11bf={};var _0x2d01a4={};var _0x535389;var _0x21f5e3;return db[_0x74b5('0x2d')][_0x74b5('0x6e')]({'where':{'id':_0x5ee9a8[_0x74b5('0x44')]['id']}})[_0x74b5('0x27')](handleEntityNotFound(_0x2b65af,null))[_0x74b5('0x27')](function(_0x11044a){if(_0x11044a){_0x535389=_0x11044a;_0x2d01a4[_0x74b5('0x37')]=_[_0x74b5('0x32')](db['User'][_0x74b5('0x2e')]);_0x2d01a4[_0x74b5('0x31')]=_[_0x74b5('0x32')](_0x5ee9a8[_0x74b5('0x31')]);_0x2d01a4['filters']=_[_0x74b5('0x34')](_0x2d01a4['model'],_0x2d01a4[_0x74b5('0x31')]);_0x2c11bf[_0x74b5('0x33')]=_[_0x74b5('0x34')](_0x2d01a4[_0x74b5('0x37')],qs['fields'](_0x5ee9a8[_0x74b5('0x31')][_0x74b5('0x35')]));_0x2c11bf[_0x74b5('0x33')]=_0x2c11bf['attributes']['length']?_0x2c11bf[_0x74b5('0x33')]:_0x2d01a4[_0x74b5('0x37')];_0x2c11bf[_0x74b5('0x39')]=qs[_0x74b5('0x3a')](_0x5ee9a8[_0x74b5('0x31')][_0x74b5('0x3a')]);_0x2c11bf['where']=qs[_0x74b5('0x3c')](_[_0x74b5('0x3d')](_0x5ee9a8['query'],_0x2d01a4[_0x74b5('0x3c')]));if(_0x5ee9a8['query'][_0x74b5('0x3e')]){_0x2c11bf[_0x74b5('0x3b')]=_[_0x74b5('0x40')](_0x2c11bf[_0x74b5('0x3b')],{'$or':_[_0x74b5('0x2c')](_0x2c11bf[_0x74b5('0x33')],function(_0xf9d3){var _0x6a8ef9={};_0x6a8ef9[_0xf9d3]={'$like':'%'+_0x5ee9a8[_0x74b5('0x31')][_0x74b5('0x3e')]+'%'};return _0x6a8ef9;})});}_0x2c11bf=_[_0x74b5('0x40')]({},_0x2c11bf,_0x5ee9a8[_0x74b5('0x46')]);return _0x535389[_0x74b5('0x97')](_0x2c11bf);}})['then'](function(_0x2df565){if(_0x2df565){_0x21f5e3=_0x2df565['length'];if(!_0x5ee9a8['query']['hasOwnProperty'](_0x74b5('0x98'))){_0x2c11bf['limit']=qs[_0x74b5('0x21')](_0x5ee9a8[_0x74b5('0x31')][_0x74b5('0x21')]);_0x2c11bf[_0x74b5('0x1f')]=qs['offset'](_0x5ee9a8[_0x74b5('0x31')][_0x74b5('0x1f')]);}return _0x535389['getAgents'](_0x2c11bf);}})['then'](function(_0x48587d){if(_0x48587d){return _0x48587d?{'count':_0x21f5e3,'rows':_0x48587d}:null;}})[_0x74b5('0x27')](respondWithResult(_0x2b65af,null))[_0x74b5('0x48')](handleError(_0x2b65af,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d468114..756921c 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 _0x6345=['events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5e304b,_0x332c51){var _0x1eed28=function(_0x5ac052){while(--_0x5ac052){_0x5e304b['push'](_0x5e304b['shift']());}};_0x1eed28(++_0x332c51);}(_0x6345,0x90));var _0x5634=function(_0x277d38,_0x1f69a4){_0x277d38=_0x277d38-0x0;var _0x52fb59=_0x6345[_0x277d38];return _0x52fb59;};'use strict';var EventEmitter=require(_0x5634('0x0'));var Team=require(_0x5634('0x1'))['db'][_0x5634('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x5634('0x3')](0x0);var events={'afterCreate':_0x5634('0x4'),'afterUpdate':_0x5634('0x5'),'afterDestroy':_0x5634('0x6')};function emitEvent(_0x3c5e56){return function(_0x28b390,_0x3648b9,_0x507c90){TeamEvents[_0x5634('0x7')](_0x3c5e56+':'+_0x28b390['id'],_0x28b390);TeamEvents[_0x5634('0x7')](_0x3c5e56,_0x28b390);_0x507c90(null);};}for(var e in events){if(events[_0x5634('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x05c9=['exports','events','../../mysqldb','Team','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x32825e,_0x5981c1){var _0x119578=function(_0x40ce3d){while(--_0x40ce3d){_0x32825e['push'](_0x32825e['shift']());}};_0x119578(++_0x5981c1);}(_0x05c9,0x16c));var _0x905c=function(_0x405029,_0x30c24f){_0x405029=_0x405029-0x0;var _0x180b0d=_0x05c9[_0x405029];return _0x180b0d;};'use strict';var EventEmitter=require(_0x905c('0x0'));var Team=require(_0x905c('0x1'))['db'][_0x905c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x905c('0x3')](0x0);var events={'afterCreate':_0x905c('0x4'),'afterUpdate':_0x905c('0x5'),'afterDestroy':_0x905c('0x6')};function emitEvent(_0x687405){return function(_0x1972a6,_0x351eca,_0xc0388b){TeamEvents[_0x905c('0x7')](_0x687405+':'+_0x1972a6['id'],_0x1972a6);TeamEvents[_0x905c('0x7')](_0x687405,_0x1972a6);_0xc0388b(null);};}for(var e in events){if(events[_0x905c('0x8')](e)){var event=events[e];Team[_0x905c('0x9')](e,emitEvent(event));}}module[_0x905c('0xa')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index d865f31..56b0a05 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 _0x148f=['teams','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./team.attributes','exports'];(function(_0x41833c,_0x18bb82){var _0x40857f=function(_0x42a9a9){while(--_0x42a9a9){_0x41833c['push'](_0x41833c['shift']());}};_0x40857f(++_0x18bb82);}(_0x148f,0xdd));var _0xf148=function(_0x3a7ab8,_0x5dbae0){_0x3a7ab8=_0x3a7ab8-0x0;var _0x43eb86=_0x148f[_0x3a7ab8];return _0x43eb86;};'use strict';var _=require(_0xf148('0x0'));var util=require('util');var logger=require(_0xf148('0x1'))(_0xf148('0x2'));var moment=require(_0xf148('0x3'));var BPromise=require(_0xf148('0x4'));var rp=require(_0xf148('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf148('0x6'));var config=require(_0xf148('0x7'));var attributes=require(_0xf148('0x8'));module[_0xf148('0x9')]=function(_0x54fa3c,_0x23bc3a){return _0x54fa3c['define']('Team',attributes,{'tableName':_0xf148('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8867=['../../config/logger','api','bluebird','request-promise','rimraf','exports','Team','teams','lodash','util'];(function(_0x21eb45,_0x1809cd){var _0x5b45b5=function(_0x5b1f52){while(--_0x5b1f52){_0x21eb45['push'](_0x21eb45['shift']());}};_0x5b45b5(++_0x1809cd);}(_0x8867,0x12a));var _0x7886=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x8867[_0x57fda8];return _0x11c895;};'use strict';var _=require(_0x7886('0x0'));var util=require(_0x7886('0x1'));var logger=require(_0x7886('0x2'))(_0x7886('0x3'));var moment=require('moment');var BPromise=require(_0x7886('0x4'));var rp=require(_0x7886('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7886('0x6'));var config=require('../../config/environment');var attributes=require('./team.attributes');module[_0x7886('0x7')]=function(_0x55d2e8,_0x1ce403){return _0x55d2e8['define'](_0x7886('0x8'),attributes,{'tableName':_0x7886('0x9'),'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 ac177f4..b0eb7b9 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 _0xe9f3=['info','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x39b1f,_0x55ada0){var _0x4b4ead=function(_0xfaf2d5){while(--_0xfaf2d5){_0x39b1f['push'](_0x39b1f['shift']());}};_0x4b4ead(++_0x55ada0);}(_0xe9f3,0xe7));var _0x3e9f=function(_0x58f8a4,_0x58676d){_0x58f8a4=_0x58f8a4-0x0;var _0x555ca5=_0xe9f3[_0x58f8a4];return _0x555ca5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3e9f('0x0'));var BPromise=require(_0x3e9f('0x1'));var rs=require(_0x3e9f('0x2'));var fs=require('fs');var Redis=require(_0x3e9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e9f('0x4'));var logger=require(_0x3e9f('0x5'))(_0x3e9f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3e9f('0x7')]['http']({'port':0x232a});config[_0x3e9f('0x8')]=_[_0x3e9f('0x9')](config[_0x3e9f('0x8')],{'host':_0x3e9f('0xa'),'port':0x18eb});var socket=require(_0x3e9f('0xb'))(new Redis(config[_0x3e9f('0x8')]));require(_0x3e9f('0xc'))[_0x3e9f('0xd')](socket);function respondWithRpcPromise(_0x20cccd,_0x263aff,_0x11a3ad){return new BPromise(function(_0x2e6c0a,_0x2c726a){return client[_0x3e9f('0xe')](_0x20cccd,_0x11a3ad)[_0x3e9f('0xf')](function(_0x4a97f8){logger['info'](_0x3e9f('0x10'),_0x263aff,_0x3e9f('0x11'));logger[_0x3e9f('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x263aff,_0x3e9f('0x11'),JSON[_0x3e9f('0x13')](_0x4a97f8));if(_0x4a97f8['error']){if(_0x4a97f8[_0x3e9f('0x14')]['code']===0x1f4){logger[_0x3e9f('0x14')](_0x3e9f('0x10'),_0x263aff,_0x4a97f8[_0x3e9f('0x14')]['message']);return _0x2c726a(_0x4a97f8['error'][_0x3e9f('0x15')]);}logger['error'](_0x3e9f('0x10'),_0x263aff,_0x4a97f8['error'][_0x3e9f('0x15')]);return _0x2e6c0a(_0x4a97f8[_0x3e9f('0x14')][_0x3e9f('0x15')]);}else{logger[_0x3e9f('0x16')](_0x3e9f('0x10'),_0x263aff,_0x3e9f('0x11'));_0x2e6c0a(_0x4a97f8['result'][_0x3e9f('0x15')]);}})['catch'](function(_0x41d572){logger[_0x3e9f('0x14')](_0x3e9f('0x10'),_0x263aff,_0x41d572);_0x2c726a(_0x41d572);});});} \ No newline at end of file +var _0x94dc=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x94dc,0x70));var _0xc94d=function(_0x10ab6a,_0x4bf95d){_0x10ab6a=_0x10ab6a-0x0;var _0x5901b9=_0x94dc[_0x10ab6a];return _0x5901b9;};'use strict';var _=require(_0xc94d('0x0'));var util=require(_0xc94d('0x1'));var moment=require(_0xc94d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc94d('0x3'));var fs=require('fs');var Redis=require(_0xc94d('0x4'));var db=require(_0xc94d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc94d('0x6'))(_0xc94d('0x7'));var config=require(_0xc94d('0x8'));var jayson=require(_0xc94d('0x9'));var client=jayson[_0xc94d('0xa')][_0xc94d('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc94d('0xc')],{'host':_0xc94d('0xd'),'port':0x18eb});var socket=require(_0xc94d('0xe'))(new Redis(config[_0xc94d('0xc')]));require(_0xc94d('0xf'))[_0xc94d('0x10')](socket);function respondWithRpcPromise(_0x7a6de5,_0x3f5518,_0x21d55d){return new BPromise(function(_0x52dacc,_0x6f6cf4){return client[_0xc94d('0x11')](_0x7a6de5,_0x21d55d)[_0xc94d('0x12')](function(_0x3e76e8){logger[_0xc94d('0x13')](_0xc94d('0x14'),_0x3f5518,_0xc94d('0x15'));logger[_0xc94d('0x16')]('Team,\x20%s,\x20%s,\x20%s',_0x3f5518,'request\x20sent',JSON[_0xc94d('0x17')](_0x3e76e8));if(_0x3e76e8[_0xc94d('0x18')]){if(_0x3e76e8['error'][_0xc94d('0x19')]===0x1f4){logger[_0xc94d('0x18')](_0xc94d('0x14'),_0x3f5518,_0x3e76e8['error'][_0xc94d('0x1a')]);return _0x6f6cf4(_0x3e76e8['error'][_0xc94d('0x1a')]);}logger[_0xc94d('0x18')]('Team,\x20%s,\x20%s',_0x3f5518,_0x3e76e8[_0xc94d('0x18')][_0xc94d('0x1a')]);return _0x52dacc(_0x3e76e8[_0xc94d('0x18')]['message']);}else{logger[_0xc94d('0x13')](_0xc94d('0x14'),_0x3f5518,'request\x20sent');_0x52dacc(_0x3e76e8[_0xc94d('0x1b')]['message']);}})[_0xc94d('0x1c')](function(_0x59f76d){logger[_0xc94d('0x18')](_0xc94d('0x14'),_0x3f5518,_0x59f76d);_0x6f6cf4(_0x59f76d);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 8c7926c..eb97ace 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 _0x1060=['save','remove','update','emit','removeListener','length','team:','./team.events'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x1060,0x147));var _0x0106=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x1060[_0x4fde08];return _0x12e725;};'use strict';var TeamEvents=require(_0x0106('0x0'));var events=[_0x0106('0x1'),_0x0106('0x2'),_0x0106('0x3')];function createListener(_0x5658c5,_0x100dad){return function(_0x520f0c){_0x100dad[_0x0106('0x4')](_0x5658c5,_0x520f0c);};}function removeListener(_0x3a4d13,_0x6e2bab){return function(){TeamEvents[_0x0106('0x5')](_0x3a4d13,_0x6e2bab);};}exports['register']=function(_0x260c50){for(var _0xa8504f=0x0,_0x848c04=events[_0x0106('0x6')];_0xa8504f<_0x848c04;_0xa8504f++){var _0x1951a1=events[_0xa8504f];var _0x2bf569=createListener(_0x0106('0x7')+_0x1951a1,_0x260c50);TeamEvents['on'](_0x1951a1,_0x2bf569);}}; \ No newline at end of file +var _0xeaef=['save','remove','update','emit','register','length','./team.events'];(function(_0x4ceebe,_0x489560){var _0x3d69ff=function(_0x589449){while(--_0x589449){_0x4ceebe['push'](_0x4ceebe['shift']());}};_0x3d69ff(++_0x489560);}(_0xeaef,0xfb));var _0xfeae=function(_0x109e6e,_0x433c56){_0x109e6e=_0x109e6e-0x0;var _0x5514ca=_0xeaef[_0x109e6e];return _0x5514ca;};'use strict';var TeamEvents=require(_0xfeae('0x0'));var events=[_0xfeae('0x1'),_0xfeae('0x2'),_0xfeae('0x3')];function createListener(_0xb584c2,_0x4017a9){return function(_0x5c2e18){_0x4017a9[_0xfeae('0x4')](_0xb584c2,_0x5c2e18);};}function removeListener(_0x1fe568,_0x3eb9ee){return function(){TeamEvents['removeListener'](_0x1fe568,_0x3eb9ee);};}exports[_0xfeae('0x5')]=function(_0x769966){for(var _0x2ac280=0x0,_0x4571f8=events[_0xfeae('0x6')];_0x2ac280<_0x4571f8;_0x2ac280++){var _0x587a6d=events[_0x2ac280];var _0x5dcb74=createListener('team:'+_0x587a6d,_0x769966);TeamEvents['on'](_0x587a6d,_0x5dcb74);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index ba0e4ed..94ebfa3 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 _0x8369=['sequelize','exports','INTEGER'];(function(_0x37261b,_0x3e199b){var _0x3ade2d=function(_0x5768ad){while(--_0x5768ad){_0x37261b['push'](_0x37261b['shift']());}};_0x3ade2d(++_0x3e199b);}(_0x8369,0x10b));var _0x9836=function(_0x389b80,_0x2b7d6b){_0x389b80=_0x389b80-0x0;var _0x5cb1e4=_0x8369[_0x389b80];return _0x5cb1e4;};'use strict';var Sequelize=require(_0x9836('0x0'));module[_0x9836('0x1')]={'TeamId':{'type':Sequelize[_0x9836('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x9836('0x2')]}}; \ No newline at end of file +var _0x6ddd=['INTEGER'];(function(_0x134b0a,_0x30deb8){var _0xc59b70=function(_0x4e1acb){while(--_0x4e1acb){_0x134b0a['push'](_0x134b0a['shift']());}};_0xc59b70(++_0x30deb8);}(_0x6ddd,0xae));var _0xd6dd=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x6ddd[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require('sequelize');module['exports']={'TeamId':{'type':Sequelize[_0xd6dd('0x0')]},'VoicePrefixId':{'type':Sequelize[_0xd6dd('0x0')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index c780568..83702d7 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 _0x2182=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes'];(function(_0x3dca99,_0x2374bc){var _0x2750cc=function(_0x210068){while(--_0x210068){_0x3dca99['push'](_0x3dca99['shift']());}};_0x2750cc(++_0x2374bc);}(_0x2182,0xea));var _0x2218=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x2182[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x2218('0x0'));var util=require(_0x2218('0x1'));var logger=require(_0x2218('0x2'))(_0x2218('0x3'));var moment=require('moment');var BPromise=require(_0x2218('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2218('0x5'));var rimraf=require(_0x2218('0x6'));var config=require(_0x2218('0x7'));var attributes=require(_0x2218('0x8'));module[_0x2218('0x9')]=function(_0x1e2df1,_0x199cb3){return _0x1e2df1[_0x2218('0xa')](_0x2218('0xb'),attributes,{'tableName':_0x2218('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21f8=['./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0x21f8,0x71));var _0x821f=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x21f8[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x821f('0x0'));var util=require(_0x821f('0x1'));var logger=require(_0x821f('0x2'))(_0x821f('0x3'));var moment=require(_0x821f('0x4'));var BPromise=require(_0x821f('0x5'));var rp=require(_0x821f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x821f('0x7'));module[_0x821f('0x8')]=function(_0x3052d6,_0x2a1421){return _0x3052d6[_0x821f('0x9')](_0x821f('0xa'),attributes,{'tableName':_0x821f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6b919c0..3bc394a 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x13f99c,_0x5c0942){var _0x27b532=function(_0x2990f8){while(--_0x2990f8){_0x13f99c['push'](_0x13f99c['shift']());}};_0x27b532(++_0x5c0942);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4fd3d9,_0xc97b8d){var _0x255d5c=function(_0x1ab6df){while(--_0x1ab6df){_0x4fd3d9['push'](_0x4fd3d9['shift']());}};_0x255d5c(++_0xc97b8d);}(_0xe706,0xa3));var _0x6e70=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0xe706[_0x195577];return _0x13c367;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 8bdad5e..3220431 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 _0xa3e2=['INTEGER','exports'];(function(_0x4d7040,_0xd0677f){var _0x2c36e5=function(_0x489193){while(--_0x489193){_0x4d7040['push'](_0x4d7040['shift']());}};_0x2c36e5(++_0xd0677f);}(_0xa3e2,0x75));var _0x2a3e=function(_0x1f1511,_0x4ea911){_0x1f1511=_0x1f1511-0x0;var _0x1d9ab8=_0xa3e2[_0x1f1511];return _0x1d9ab8;};'use strict';var Sequelize=require('sequelize');module[_0x2a3e('0x0')]={'penalty':{'type':Sequelize[_0x2a3e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8cc8=['INTEGER','sequelize','exports'];(function(_0x1476ba,_0x446421){var _0x5e7bc1=function(_0x4aa99c){while(--_0x4aa99c){_0x1476ba['push'](_0x1476ba['shift']());}};_0x5e7bc1(++_0x446421);}(_0x8cc8,0xd3));var _0x88cc=function(_0x3be1e3,_0x248d3c){_0x3be1e3=_0x3be1e3-0x0;var _0x8289bd=_0x8cc8[_0x3be1e3];return _0x8289bd;};'use strict';var Sequelize=require(_0x88cc('0x0'));module[_0x88cc('0x1')]={'penalty':{'type':Sequelize[_0x88cc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a6b90c0..7b1a396 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 _0xe700=['define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x9a556d,_0x14b65d){var _0x442c6e=function(_0x584ba0){while(--_0x584ba0){_0x9a556d['push'](_0x9a556d['shift']());}};_0x442c6e(++_0x14b65d);}(_0xe700,0x16a));var _0x0e70=function(_0x2acf30,_0x29802d){_0x2acf30=_0x2acf30-0x0;var _0x5952d5=_0xe700[_0x2acf30];return _0x5952d5;};'use strict';var _=require(_0x0e70('0x0'));var util=require(_0x0e70('0x1'));var logger=require(_0x0e70('0x2'))(_0x0e70('0x3'));var moment=require(_0x0e70('0x4'));var BPromise=require('bluebird');var rp=require(_0x0e70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e70('0x6'));var config=require(_0x0e70('0x7'));var attributes=require('./teamVoiceQueue.attributes');module['exports']=function(_0xf3ba11,_0xc96045){return _0xf3ba11[_0x0e70('0x8')](_0x0e70('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87f8=['request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','api','moment'];(function(_0x51fe02,_0x3604c9){var _0x292605=function(_0x16c5ac){while(--_0x16c5ac){_0x51fe02['push'](_0x51fe02['shift']());}};_0x292605(++_0x3604c9);}(_0x87f8,0x152));var _0x887f=function(_0x12c5a4,_0x4709aa){_0x12c5a4=_0x12c5a4-0x0;var _0x32d813=_0x87f8[_0x12c5a4];return _0x32d813;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x887f('0x0'));var moment=require(_0x887f('0x1'));var BPromise=require('bluebird');var rp=require(_0x887f('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x887f('0x3'));var config=require(_0x887f('0x4'));var attributes=require(_0x887f('0x5'));module[_0x887f('0x6')]=function(_0x4f735d,_0x3847b1){return _0x4f735d[_0x887f('0x7')](_0x887f('0x8'),attributes,{'tableName':_0x887f('0x9'),'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 b2ebd72..b18df76 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 _0xebc5=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b432e,_0xac3c18){var _0x5b4973=function(_0x2b64c7){while(--_0x2b64c7){_0x1b432e['push'](_0x1b432e['shift']());}};_0x5b4973(++_0xac3c18);}(_0xebc5,0x11a));var _0x5ebc=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xebc5[_0x24061a];return _0x82054e;};'use strict';var _=require(_0x5ebc('0x0'));var util=require('util');var moment=require(_0x5ebc('0x1'));var BPromise=require(_0x5ebc('0x2'));var rs=require(_0x5ebc('0x3'));var fs=require('fs');var Redis=require(_0x5ebc('0x4'));var db=require(_0x5ebc('0x5'))['db'];var utils=require(_0x5ebc('0x6'));var logger=require('../../config/logger')(_0x5ebc('0x7'));var config=require(_0x5ebc('0x8'));var jayson=require(_0x5ebc('0x9'));var client=jayson[_0x5ebc('0xa')][_0x5ebc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e9562,_0x190e2d,_0x23ec9a){return new BPromise(function(_0x1a1c47,_0x487294){return client[_0x5ebc('0xc')](_0x5e9562,_0x23ec9a)[_0x5ebc('0xd')](function(_0x20b731){logger['info'](_0x5ebc('0xe'),_0x190e2d,_0x5ebc('0xf'));logger[_0x5ebc('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x190e2d,_0x5ebc('0xf'),JSON[_0x5ebc('0x11')](_0x20b731));if(_0x20b731[_0x5ebc('0x12')]){if(_0x20b731['error'][_0x5ebc('0x13')]===0x1f4){logger[_0x5ebc('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x190e2d,_0x20b731['error']['message']);return _0x487294(_0x20b731['error'][_0x5ebc('0x14')]);}logger[_0x5ebc('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x190e2d,_0x20b731['error'][_0x5ebc('0x14')]);return _0x1a1c47(_0x20b731['error'][_0x5ebc('0x14')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x190e2d,'request\x20sent');_0x1a1c47(_0x20b731[_0x5ebc('0x15')][_0x5ebc('0x14')]);}})[_0x5ebc('0x16')](function(_0x9f938e){logger['error'](_0x5ebc('0xe'),_0x190e2d,_0x9f938e);_0x487294(_0x9f938e);});});} \ No newline at end of file +var _0x463e=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x463e,0x1d6));var _0xe463=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x463e[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xe463('0x0'));var util=require(_0xe463('0x1'));var moment=require(_0xe463('0x2'));var BPromise=require(_0xe463('0x3'));var rs=require(_0xe463('0x4'));var fs=require('fs');var Redis=require(_0xe463('0x5'));var db=require(_0xe463('0x6'))['db'];var utils=require(_0xe463('0x7'));var logger=require(_0xe463('0x8'))(_0xe463('0x9'));var config=require(_0xe463('0xa'));var jayson=require(_0xe463('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e520c,_0x3fc85c,_0x39efc1){return new BPromise(function(_0x47135f,_0x2089cc){return client[_0xe463('0xc')](_0x4e520c,_0x39efc1)[_0xe463('0xd')](function(_0x4d19bc){logger[_0xe463('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3fc85c,_0xe463('0xf'));logger[_0xe463('0x10')](_0xe463('0x11'),_0x3fc85c,_0xe463('0xf'),JSON[_0xe463('0x12')](_0x4d19bc));if(_0x4d19bc[_0xe463('0x13')]){if(_0x4d19bc[_0xe463('0x13')][_0xe463('0x14')]===0x1f4){logger[_0xe463('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3fc85c,_0x4d19bc[_0xe463('0x13')][_0xe463('0x15')]);return _0x2089cc(_0x4d19bc[_0xe463('0x13')]['message']);}logger[_0xe463('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3fc85c,_0x4d19bc[_0xe463('0x13')][_0xe463('0x15')]);return _0x47135f(_0x4d19bc[_0xe463('0x13')][_0xe463('0x15')]);}else{logger['info'](_0xe463('0x16'),_0x3fc85c,_0xe463('0xf'));_0x47135f(_0x4d19bc[_0xe463('0x17')][_0xe463('0x15')]);}})[_0xe463('0x18')](function(_0x18fe06){logger[_0xe463('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3fc85c,_0x18fe06);_0x2089cc(_0x18fe06);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index df0f7d5..fc33b26 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 _0x0424=['isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','./template.controller','get'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0424,0x159));var _0x4042=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x0424[_0x4c05da];return _0x1614db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4042('0x0'));var timeout=require(_0x4042('0x1'));var express=require(_0x4042('0x2'));var router=express[_0x4042('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4042('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4042('0x5'));router[_0x4042('0x6')]('/',auth[_0x4042('0x7')](),controller[_0x4042('0x8')]);router[_0x4042('0x6')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller['show']);router['post']('/',auth[_0x4042('0x7')](),controller[_0x4042('0xa')]);router[_0x4042('0xb')]('/:id',auth[_0x4042('0x7')](),controller[_0x4042('0xc')]);router[_0x4042('0xd')](_0x4042('0x9'),auth[_0x4042('0x7')](),controller[_0x4042('0xe')]);module[_0x4042('0xf')]=router; \ No newline at end of file +var _0xe635=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x473980,_0x3eb32a){var _0x48d151=function(_0x1a7c9d){while(--_0x1a7c9d){_0x473980['push'](_0x473980['shift']());}};_0x48d151(++_0x3eb32a);}(_0xe635,0x1be));var _0x5e63=function(_0x4a4d8e,_0x22a7a9){_0x4a4d8e=_0x4a4d8e-0x0;var _0x1a5cb4=_0xe635[_0x4a4d8e];return _0x1a5cb4;};'use strict';var multer=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var path=require(_0x5e63('0x2'));var timeout=require(_0x5e63('0x3'));var express=require(_0x5e63('0x4'));var router=express[_0x5e63('0x5')]();var fs_extra=require(_0x5e63('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5e63('0x7'));var controller=require(_0x5e63('0x8'));router[_0x5e63('0x9')]('/',auth[_0x5e63('0xa')](),controller[_0x5e63('0xb')]);router[_0x5e63('0x9')](_0x5e63('0xc'),auth[_0x5e63('0xa')](),controller[_0x5e63('0xd')]);router[_0x5e63('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e63('0xf')]);router[_0x5e63('0x10')](_0x5e63('0xc'),auth[_0x5e63('0xa')](),controller['update']);router[_0x5e63('0x11')](_0x5e63('0xc'),auth['isAuthenticated'](),controller[_0x5e63('0x12')]);module[_0x5e63('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index cc226ef..772f49c 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 _0xe987=['sequelize','STRING','TEXT'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe987,0x7e));var _0x7e98=function(_0x5560f6,_0x225f9c){_0x5560f6=_0x5560f6-0x0;var _0x25d4ef=_0xe987[_0x5560f6];return _0x25d4ef;};'use strict';var Sequelize=require(_0x7e98('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e98('0x1')]},'description':{'type':Sequelize[_0x7e98('0x1')]},'html':{'type':Sequelize[_0x7e98('0x2')]}}; \ No newline at end of file +var _0x1d58=['exports','STRING','TEXT','sequelize'];(function(_0x555a9e,_0x1ed7b5){var _0x1c1827=function(_0x1875e8){while(--_0x1875e8){_0x555a9e['push'](_0x555a9e['shift']());}};_0x1c1827(++_0x1ed7b5);}(_0x1d58,0x103));var _0x81d5=function(_0x3b0b8b,_0x18d55b){_0x3b0b8b=_0x3b0b8b-0x0;var _0x39fa2a=_0x1d58[_0x3b0b8b];return _0x39fa2a;};'use strict';var Sequelize=require(_0x81d5('0x0'));module[_0x81d5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x81d5('0x2')]},'html':{'type':Sequelize[_0x81d5('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index fba2d56..cbac41d 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 _0xbb40=['length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','find','create','body','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','Content-Range','save','then','destroy','get','Templates','UserProfileResource','error','name','map','Template','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x3bd2bf,_0xa7ef92){var _0x5b2dfd=function(_0x5c1526){while(--_0x5c1526){_0x3bd2bf['push'](_0x3bd2bf['shift']());}};_0x5b2dfd(++_0xa7ef92);}(_0xbb40,0x193));var _0x0bb4=function(_0x5d4720,_0xcfb6c3){_0x5d4720=_0x5d4720-0x0;var _0x36895a=_0xbb40[_0x5d4720];return _0x36895a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bb4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0bb4('0x1'));var rp=require('request-promise');var moment=require(_0x0bb4('0x2'));var BPromise=require(_0x0bb4('0x3'));var Mustache=require('mustache');var util=require(_0x0bb4('0x4'));var path=require(_0x0bb4('0x5'));var sox=require(_0x0bb4('0x6'));var csv=require(_0x0bb4('0x7'));var ejs=require(_0x0bb4('0x8'));var fs=require('fs');var fs_extra=require(_0x0bb4('0x9'));var _=require(_0x0bb4('0xa'));var squel=require(_0x0bb4('0xb'));var crypto=require(_0x0bb4('0xc'));var jsforce=require(_0x0bb4('0xd'));var deskjs=require(_0x0bb4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0bb4('0xf'));var Papa=require(_0x0bb4('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0bb4('0x11'));var hardwareService=require(_0x0bb4('0x12'));var logger=require(_0x0bb4('0x13'))(_0x0bb4('0x14'));var utils=require(_0x0bb4('0x15'));var config=require(_0x0bb4('0x16'));var licenseUtil=require(_0x0bb4('0x17'));var db=require(_0x0bb4('0x18'))['db'];function respondWithStatusCode(_0x250e55,_0x46aaa3){_0x46aaa3=_0x46aaa3||0xcc;return function(_0x2d4cec){if(_0x2d4cec){return _0x250e55[_0x0bb4('0x19')](_0x46aaa3);}return _0x250e55['status'](_0x46aaa3)[_0x0bb4('0x1a')]();};}function respondWithResult(_0x5d9a4c,_0x5e9269){_0x5e9269=_0x5e9269||0xc8;return function(_0x4abefb){if(_0x4abefb){return _0x5d9a4c[_0x0bb4('0x1b')](_0x5e9269)['json'](_0x4abefb);}};}function respondWithFilteredResult(_0x46c3c9,_0x537451){return function(_0x1fcd0b){if(_0x1fcd0b){var _0xc23464=typeof _0x537451['offset']===_0x0bb4('0x1c')&&typeof _0x537451[_0x0bb4('0x1d')]===_0x0bb4('0x1c');var _0x1fbd44=_0x1fcd0b[_0x0bb4('0x1e')];var _0x38994a=_0xc23464?0x0:_0x537451['offset'];var _0x47072c=_0xc23464?_0x1fcd0b[_0x0bb4('0x1e')]:_0x537451[_0x0bb4('0x1f')]+_0x537451[_0x0bb4('0x1d')];var _0x40feee;if(_0x47072c>=_0x1fbd44){_0x47072c=_0x1fbd44;_0x40feee=0xc8;}else{_0x40feee=0xce;}_0x46c3c9['status'](_0x40feee);return _0x46c3c9['set'](_0x0bb4('0x20'),_0x38994a+'-'+_0x47072c+'/'+_0x1fbd44)['json'](_0x1fcd0b);}return null;};}function patchUpdates(_0x3d6cd6){return function(_0x1c9327){try{jsonpatch['apply'](_0x1c9327,_0x3d6cd6,!![]);}catch(_0x2b3fe2){return BPromise['reject'](_0x2b3fe2);}return _0x1c9327[_0x0bb4('0x21')]();};}function saveUpdates(_0x1dbe75,_0x4ca191){return function(_0x3814d9){if(_0x3814d9){return _0x3814d9['update'](_0x1dbe75)[_0x0bb4('0x22')](function(_0x33f4ea){return _0x33f4ea;});}return null;};}function removeEntity(_0x2ef340,_0x49d4d2){return function(_0x546263){if(_0x546263){return _0x546263[_0x0bb4('0x23')]()['then'](function(){var _0x2438e0=_0x546263[_0x0bb4('0x24')]({'plain':!![]});var _0x2f1601=_0x0bb4('0x25');return db[_0x0bb4('0x26')][_0x0bb4('0x23')]({'where':{'type':_0x2f1601,'resourceId':_0x2438e0['id']}})[_0x0bb4('0x22')](function(){return _0x546263;});})[_0x0bb4('0x22')](function(){_0x2ef340[_0x0bb4('0x1b')](0xcc)[_0x0bb4('0x1a')]();});}};}function handleEntityNotFound(_0x18cff8,_0x3ef558){return function(_0x2fd87e){if(!_0x2fd87e){_0x18cff8['sendStatus'](0x194);}return _0x2fd87e;};}function handleError(_0x350e04,_0x1b8bea){_0x1b8bea=_0x1b8bea||0x1f4;return function(_0x2649f5){logger[_0x0bb4('0x27')](_0x2649f5['stack']);if(_0x2649f5[_0x0bb4('0x28')]){delete _0x2649f5['name'];}_0x350e04['status'](_0x1b8bea)['send'](_0x2649f5);};}exports['index']=function(_0x34631c,_0x15d4ac){var _0x24c1c4={},_0x151685={},_0x4f715f={'count':0x0,'rows':[]};var _0x28d464=_[_0x0bb4('0x29')](db[_0x0bb4('0x2a')][_0x0bb4('0x2b')],function(_0x105ba2){return{'name':_0x105ba2['fieldName'],'type':_0x105ba2[_0x0bb4('0x2c')][_0x0bb4('0x2d')]};});_0x151685['model']=_[_0x0bb4('0x29')](_0x28d464,'name');_0x151685[_0x0bb4('0x2e')]=_[_0x0bb4('0x2f')](_0x34631c[_0x0bb4('0x2e')]);_0x151685[_0x0bb4('0x30')]=_[_0x0bb4('0x31')](_0x151685[_0x0bb4('0x32')],_0x151685[_0x0bb4('0x2e')]);_0x24c1c4[_0x0bb4('0x33')]=_[_0x0bb4('0x31')](_0x151685[_0x0bb4('0x32')],qs[_0x0bb4('0x34')](_0x34631c[_0x0bb4('0x2e')]['fields']));_0x24c1c4[_0x0bb4('0x33')]=_0x24c1c4[_0x0bb4('0x33')][_0x0bb4('0x35')]?_0x24c1c4['attributes']:_0x151685[_0x0bb4('0x32')];if(!_0x34631c['query'][_0x0bb4('0x36')](_0x0bb4('0x37'))){_0x24c1c4[_0x0bb4('0x1d')]=qs[_0x0bb4('0x1d')](_0x34631c[_0x0bb4('0x2e')][_0x0bb4('0x1d')]);_0x24c1c4[_0x0bb4('0x1f')]=qs[_0x0bb4('0x1f')](_0x34631c[_0x0bb4('0x2e')][_0x0bb4('0x1f')]);}_0x24c1c4['order']=qs['sort'](_0x34631c[_0x0bb4('0x2e')][_0x0bb4('0x38')]);_0x24c1c4['where']=qs['filters'](_[_0x0bb4('0x39')](_0x34631c[_0x0bb4('0x2e')],_0x151685[_0x0bb4('0x30')]),_0x28d464);if(_0x34631c[_0x0bb4('0x2e')][_0x0bb4('0x3a')]){_0x24c1c4['where']=_[_0x0bb4('0x3b')](_0x24c1c4[_0x0bb4('0x3c')],{'$or':_[_0x0bb4('0x29')](_0x28d464,function(_0x43214a){if(_0x43214a[_0x0bb4('0x2c')]!=='VIRTUAL'){var _0x5d9472={};_0x5d9472[_0x43214a[_0x0bb4('0x28')]]={'$like':'%'+_0x34631c['query'][_0x0bb4('0x3a')]+'%'};return _0x5d9472;}})});}_0x24c1c4=_[_0x0bb4('0x3b')]({},_0x24c1c4,_0x34631c[_0x0bb4('0x3d')]);var _0x23d347={'where':_0x24c1c4['where']};return db[_0x0bb4('0x2a')][_0x0bb4('0x1e')](_0x23d347)[_0x0bb4('0x22')](function(_0x227836){_0x4f715f[_0x0bb4('0x1e')]=_0x227836;if(_0x34631c[_0x0bb4('0x2e')][_0x0bb4('0x3e')]){_0x24c1c4[_0x0bb4('0x3f')]=[{'all':!![]}];}return db[_0x0bb4('0x2a')][_0x0bb4('0x40')](_0x24c1c4);})['then'](function(_0x5dc8ff){_0x4f715f[_0x0bb4('0x41')]=_0x5dc8ff;return _0x4f715f;})[_0x0bb4('0x22')](respondWithFilteredResult(_0x15d4ac,_0x24c1c4))[_0x0bb4('0x42')](handleError(_0x15d4ac,null));};exports['show']=function(_0x57faf7,_0x2e47c1){var _0x44d764={'raw':!![],'where':{'id':_0x57faf7[_0x0bb4('0x43')]['id']}},_0x5896bc={};_0x5896bc[_0x0bb4('0x32')]=_[_0x0bb4('0x2f')](db[_0x0bb4('0x2a')]['rawAttributes']);_0x5896bc['query']=_[_0x0bb4('0x2f')](_0x57faf7[_0x0bb4('0x2e')]);_0x5896bc['filters']=_[_0x0bb4('0x31')](_0x5896bc[_0x0bb4('0x32')],_0x5896bc[_0x0bb4('0x2e')]);_0x44d764[_0x0bb4('0x33')]=_[_0x0bb4('0x31')](_0x5896bc[_0x0bb4('0x32')],qs[_0x0bb4('0x34')](_0x57faf7['query'][_0x0bb4('0x34')]));_0x44d764['attributes']=_0x44d764[_0x0bb4('0x33')][_0x0bb4('0x35')]?_0x44d764[_0x0bb4('0x33')]:_0x5896bc[_0x0bb4('0x32')];if(_0x57faf7['query'][_0x0bb4('0x3e')]){_0x44d764[_0x0bb4('0x3f')]=[{'all':!![]}];}_0x44d764=_[_0x0bb4('0x3b')]({},_0x44d764,_0x57faf7[_0x0bb4('0x3d')]);return db[_0x0bb4('0x2a')][_0x0bb4('0x44')](_0x44d764)[_0x0bb4('0x22')](handleEntityNotFound(_0x2e47c1,null))['then'](respondWithResult(_0x2e47c1,null))['catch'](handleError(_0x2e47c1,null));};exports['create']=function(_0x1dbb8f,_0x27e396){return db[_0x0bb4('0x2a')][_0x0bb4('0x45')](_0x1dbb8f[_0x0bb4('0x46')],{})[_0x0bb4('0x22')](function(_0x33143d){var _0x55f7df=_0x1dbb8f['user'][_0x0bb4('0x24')]({'plain':!![]});if(!_0x55f7df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x55f7df[_0x0bb4('0x47')]==='user'){var _0x12b5b4=_0x33143d[_0x0bb4('0x24')]({'plain':!![]});var _0x3bb482=_0x0bb4('0x25');return db['UserProfileSection'][_0x0bb4('0x44')]({'where':{'name':_0x3bb482,'userProfileId':_0x55f7df[_0x0bb4('0x48')]},'raw':!![]})[_0x0bb4('0x22')](function(_0x1aff6a){if(_0x1aff6a&&_0x1aff6a[_0x0bb4('0x49')]===0x0){return db[_0x0bb4('0x26')][_0x0bb4('0x45')]({'name':_0x12b5b4[_0x0bb4('0x28')],'resourceId':_0x12b5b4['id'],'type':_0x1aff6a['name'],'sectionId':_0x1aff6a['id']},{})['then'](function(){return _0x33143d;});}else{return _0x33143d;}})[_0x0bb4('0x42')](function(_0x13bde8){logger[_0x0bb4('0x27')](_0x0bb4('0x4a'),_0x13bde8);throw _0x13bde8;});}return _0x33143d;})[_0x0bb4('0x22')](respondWithResult(_0x27e396,0xc9))[_0x0bb4('0x42')](handleError(_0x27e396,null));};exports[_0x0bb4('0x4b')]=function(_0x326d18,_0x4cc8e5){if(_0x326d18[_0x0bb4('0x46')]['id']){delete _0x326d18[_0x0bb4('0x46')]['id'];}return db['Template']['find']({'where':{'id':_0x326d18[_0x0bb4('0x43')]['id']}})[_0x0bb4('0x22')](handleEntityNotFound(_0x4cc8e5,null))[_0x0bb4('0x22')](saveUpdates(_0x326d18[_0x0bb4('0x46')],null))[_0x0bb4('0x22')](respondWithResult(_0x4cc8e5,null))[_0x0bb4('0x42')](handleError(_0x4cc8e5,null));};exports[_0x0bb4('0x23')]=function(_0x272177,_0x1343b0){return db[_0x0bb4('0x2a')][_0x0bb4('0x44')]({'where':{'id':_0x272177[_0x0bb4('0x43')]['id']}})[_0x0bb4('0x22')](handleEntityNotFound(_0x1343b0,null))['then'](removeEntity(_0x1343b0,null))['catch'](handleError(_0x1343b0,null));}; \ No newline at end of file +var _0xc840=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','get','Templates','UserProfileResource','error','name','send','index','map','Template','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc840,0x8c));var _0x0c84=function(_0x1f703f,_0x2eca87){_0x1f703f=_0x1f703f-0x0;var _0x17b7f1=_0xc840[_0x1f703f];return _0x17b7f1;};'use strict';var emlformat=require(_0x0c84('0x0'));var rimraf=require(_0x0c84('0x1'));var zipdir=require(_0x0c84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c84('0x3'));var moment=require(_0x0c84('0x4'));var BPromise=require(_0x0c84('0x5'));var Mustache=require('mustache');var util=require(_0x0c84('0x6'));var path=require(_0x0c84('0x7'));var sox=require(_0x0c84('0x8'));var csv=require(_0x0c84('0x9'));var ejs=require(_0x0c84('0xa'));var fs=require('fs');var fs_extra=require(_0x0c84('0xb'));var _=require(_0x0c84('0xc'));var squel=require('squel');var crypto=require(_0x0c84('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0c84('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c84('0xf'));var Papa=require(_0x0c84('0x10'));var Redis=require(_0x0c84('0x11'));var authService=require(_0x0c84('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c84('0x13'))('api');var utils=require(_0x0c84('0x14'));var config=require(_0x0c84('0x15'));var licenseUtil=require(_0x0c84('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51a15f,_0x3a0b8c){_0x3a0b8c=_0x3a0b8c||0xcc;return function(_0x325626){if(_0x325626){return _0x51a15f[_0x0c84('0x17')](_0x3a0b8c);}return _0x51a15f[_0x0c84('0x18')](_0x3a0b8c)[_0x0c84('0x19')]();};}function respondWithResult(_0x33695b,_0x1ce864){_0x1ce864=_0x1ce864||0xc8;return function(_0x477f04){if(_0x477f04){return _0x33695b[_0x0c84('0x18')](_0x1ce864)[_0x0c84('0x1a')](_0x477f04);}};}function respondWithFilteredResult(_0x4f288c,_0x22b6f3){return function(_0x3d8a39){if(_0x3d8a39){var _0x4c16ea=typeof _0x22b6f3[_0x0c84('0x1b')]===_0x0c84('0x1c')&&typeof _0x22b6f3[_0x0c84('0x1d')]===_0x0c84('0x1c');var _0x4ee16f=_0x3d8a39[_0x0c84('0x1e')];var _0x5b849b=_0x4c16ea?0x0:_0x22b6f3[_0x0c84('0x1b')];var _0x5032f6=_0x4c16ea?_0x3d8a39[_0x0c84('0x1e')]:_0x22b6f3[_0x0c84('0x1b')]+_0x22b6f3[_0x0c84('0x1d')];var _0x4a41ab;if(_0x5032f6>=_0x4ee16f){_0x5032f6=_0x4ee16f;_0x4a41ab=0xc8;}else{_0x4a41ab=0xce;}_0x4f288c[_0x0c84('0x18')](_0x4a41ab);return _0x4f288c[_0x0c84('0x1f')](_0x0c84('0x20'),_0x5b849b+'-'+_0x5032f6+'/'+_0x4ee16f)[_0x0c84('0x1a')](_0x3d8a39);}return null;};}function patchUpdates(_0x53e308){return function(_0x3b98b1){try{jsonpatch[_0x0c84('0x21')](_0x3b98b1,_0x53e308,!![]);}catch(_0x577476){return BPromise['reject'](_0x577476);}return _0x3b98b1['save']();};}function saveUpdates(_0x5f4863,_0x5f3fe8){return function(_0x506e3d){if(_0x506e3d){return _0x506e3d['update'](_0x5f4863)[_0x0c84('0x22')](function(_0x73543d){return _0x73543d;});}return null;};}function removeEntity(_0x1e2a11,_0x3905cb){return function(_0x3d5e4a){if(_0x3d5e4a){return _0x3d5e4a[_0x0c84('0x23')]()['then'](function(){var _0x6e6b71=_0x3d5e4a[_0x0c84('0x24')]({'plain':!![]});var _0x2c418d=_0x0c84('0x25');return db[_0x0c84('0x26')]['destroy']({'where':{'type':_0x2c418d,'resourceId':_0x6e6b71['id']}})[_0x0c84('0x22')](function(){return _0x3d5e4a;});})[_0x0c84('0x22')](function(){_0x1e2a11[_0x0c84('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240cc8,_0x4c54a8){return function(_0x437520){if(!_0x437520){_0x240cc8[_0x0c84('0x17')](0x194);}return _0x437520;};}function handleError(_0x2e23f0,_0x533e43){_0x533e43=_0x533e43||0x1f4;return function(_0x9dbff1){logger[_0x0c84('0x27')](_0x9dbff1['stack']);if(_0x9dbff1[_0x0c84('0x28')]){delete _0x9dbff1[_0x0c84('0x28')];}_0x2e23f0['status'](_0x533e43)[_0x0c84('0x29')](_0x9dbff1);};}exports[_0x0c84('0x2a')]=function(_0x471db7,_0x108c43){var _0x202980={},_0x2a859c={},_0x6272c0={'count':0x0,'rows':[]};var _0x3a0444=_[_0x0c84('0x2b')](db[_0x0c84('0x2c')][_0x0c84('0x2d')],function(_0x2a9161){return{'name':_0x2a9161[_0x0c84('0x2e')],'type':_0x2a9161['type']['key']};});_0x2a859c[_0x0c84('0x2f')]=_['map'](_0x3a0444,_0x0c84('0x28'));_0x2a859c[_0x0c84('0x30')]=_['keys'](_0x471db7[_0x0c84('0x30')]);_0x2a859c[_0x0c84('0x31')]=_[_0x0c84('0x32')](_0x2a859c[_0x0c84('0x2f')],_0x2a859c['query']);_0x202980[_0x0c84('0x33')]=_[_0x0c84('0x32')](_0x2a859c[_0x0c84('0x2f')],qs[_0x0c84('0x34')](_0x471db7[_0x0c84('0x30')]['fields']));_0x202980['attributes']=_0x202980[_0x0c84('0x33')]['length']?_0x202980['attributes']:_0x2a859c[_0x0c84('0x2f')];if(!_0x471db7[_0x0c84('0x30')][_0x0c84('0x35')](_0x0c84('0x36'))){_0x202980['limit']=qs[_0x0c84('0x1d')](_0x471db7[_0x0c84('0x30')][_0x0c84('0x1d')]);_0x202980[_0x0c84('0x1b')]=qs['offset'](_0x471db7['query'][_0x0c84('0x1b')]);}_0x202980[_0x0c84('0x37')]=qs[_0x0c84('0x38')](_0x471db7[_0x0c84('0x30')][_0x0c84('0x38')]);_0x202980[_0x0c84('0x39')]=qs[_0x0c84('0x31')](_[_0x0c84('0x3a')](_0x471db7[_0x0c84('0x30')],_0x2a859c[_0x0c84('0x31')]),_0x3a0444);if(_0x471db7[_0x0c84('0x30')]['filter']){_0x202980[_0x0c84('0x39')]=_['merge'](_0x202980[_0x0c84('0x39')],{'$or':_[_0x0c84('0x2b')](_0x3a0444,function(_0x163857){if(_0x163857['type']!==_0x0c84('0x3b')){var _0x8ed009={};_0x8ed009[_0x163857['name']]={'$like':'%'+_0x471db7[_0x0c84('0x30')]['filter']+'%'};return _0x8ed009;}})});}_0x202980=_['merge']({},_0x202980,_0x471db7[_0x0c84('0x3c')]);var _0xc3178f={'where':_0x202980[_0x0c84('0x39')]};return db[_0x0c84('0x2c')][_0x0c84('0x1e')](_0xc3178f)[_0x0c84('0x22')](function(_0x25b91f){_0x6272c0['count']=_0x25b91f;if(_0x471db7['query'][_0x0c84('0x3d')]){_0x202980['include']=[{'all':!![]}];}return db[_0x0c84('0x2c')][_0x0c84('0x3e')](_0x202980);})[_0x0c84('0x22')](function(_0x640080){_0x6272c0[_0x0c84('0x3f')]=_0x640080;return _0x6272c0;})[_0x0c84('0x22')](respondWithFilteredResult(_0x108c43,_0x202980))[_0x0c84('0x40')](handleError(_0x108c43,null));};exports['show']=function(_0x119915,_0x5fa29){var _0x30077b={'raw':!![],'where':{'id':_0x119915[_0x0c84('0x41')]['id']}},_0x5e5448={};_0x5e5448[_0x0c84('0x2f')]=_[_0x0c84('0x42')](db[_0x0c84('0x2c')]['rawAttributes']);_0x5e5448[_0x0c84('0x30')]=_[_0x0c84('0x42')](_0x119915[_0x0c84('0x30')]);_0x5e5448[_0x0c84('0x31')]=_[_0x0c84('0x32')](_0x5e5448['model'],_0x5e5448[_0x0c84('0x30')]);_0x30077b[_0x0c84('0x33')]=_[_0x0c84('0x32')](_0x5e5448[_0x0c84('0x2f')],qs['fields'](_0x119915[_0x0c84('0x30')]['fields']));_0x30077b['attributes']=_0x30077b[_0x0c84('0x33')]['length']?_0x30077b[_0x0c84('0x33')]:_0x5e5448[_0x0c84('0x2f')];if(_0x119915['query'][_0x0c84('0x3d')]){_0x30077b[_0x0c84('0x43')]=[{'all':!![]}];}_0x30077b=_[_0x0c84('0x44')]({},_0x30077b,_0x119915['options']);return db['Template']['find'](_0x30077b)[_0x0c84('0x22')](handleEntityNotFound(_0x5fa29,null))[_0x0c84('0x22')](respondWithResult(_0x5fa29,null))[_0x0c84('0x40')](handleError(_0x5fa29,null));};exports[_0x0c84('0x45')]=function(_0x589caa,_0x8f4276){return db[_0x0c84('0x2c')][_0x0c84('0x45')](_0x589caa[_0x0c84('0x46')],{})['then'](function(_0x3f6dbd){var _0x514b32=_0x589caa['user']['get']({'plain':!![]});if(!_0x514b32)throw new Error(_0x0c84('0x47'));if(_0x514b32[_0x0c84('0x48')]===_0x0c84('0x49')){var _0x2c44f7=_0x3f6dbd[_0x0c84('0x24')]({'plain':!![]});var _0x63991b=_0x0c84('0x25');return db['UserProfileSection'][_0x0c84('0x4a')]({'where':{'name':_0x63991b,'userProfileId':_0x514b32[_0x0c84('0x4b')]},'raw':!![]})['then'](function(_0x58b58f){if(_0x58b58f&&_0x58b58f['autoAssociation']===0x0){return db[_0x0c84('0x26')][_0x0c84('0x45')]({'name':_0x2c44f7[_0x0c84('0x28')],'resourceId':_0x2c44f7['id'],'type':_0x58b58f[_0x0c84('0x28')],'sectionId':_0x58b58f['id']},{})[_0x0c84('0x22')](function(){return _0x3f6dbd;});}else{return _0x3f6dbd;}})['catch'](function(_0x29d1f3){logger[_0x0c84('0x27')](_0x0c84('0x4c'),_0x29d1f3);throw _0x29d1f3;});}return _0x3f6dbd;})[_0x0c84('0x22')](respondWithResult(_0x8f4276,0xc9))[_0x0c84('0x40')](handleError(_0x8f4276,null));};exports['update']=function(_0x10b7d8,_0x1323c9){if(_0x10b7d8['body']['id']){delete _0x10b7d8['body']['id'];}return db['Template']['find']({'where':{'id':_0x10b7d8[_0x0c84('0x41')]['id']}})[_0x0c84('0x22')](handleEntityNotFound(_0x1323c9,null))['then'](saveUpdates(_0x10b7d8['body'],null))[_0x0c84('0x22')](respondWithResult(_0x1323c9,null))['catch'](handleError(_0x1323c9,null));};exports[_0x0c84('0x23')]=function(_0x52bcc9,_0x24b3f1){return db[_0x0c84('0x2c')][_0x0c84('0x4a')]({'where':{'id':_0x52bcc9[_0x0c84('0x41')]['id']}})['then'](handleEntityNotFound(_0x24b3f1,null))[_0x0c84('0x22')](removeEntity(_0x24b3f1,null))['catch'](handleError(_0x24b3f1,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 0bf1aee..d39c66e 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 _0x20e7=['tools_templates','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x15723c,_0x4f0c36){var _0x238e68=function(_0xb9d4ee){while(--_0xb9d4ee){_0x15723c['push'](_0x15723c['shift']());}};_0x238e68(++_0x4f0c36);}(_0x20e7,0x133));var _0x720e=function(_0x473d66,_0x4cd3b9){_0x473d66=_0x473d66-0x0;var _0x47b156=_0x20e7[_0x473d66];return _0x47b156;};'use strict';var _=require('lodash');var util=require(_0x720e('0x0'));var logger=require(_0x720e('0x1'))('api');var moment=require(_0x720e('0x2'));var BPromise=require('bluebird');var rp=require(_0x720e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x720e('0x4'));var config=require(_0x720e('0x5'));var attributes=require('./template.attributes');module[_0x720e('0x6')]=function(_0xeaa255,_0x33af74){return _0xeaa255[_0x720e('0x7')]('Template',attributes,{'tableName':_0x720e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a8d=['Template','tools_templates','lodash','api','path','./template.attributes','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2a8d,0x1b4));var _0xd2a8=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0x2a8d[_0x5abb00];return _0xf9b854;};'use strict';var _=require(_0xd2a8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd2a8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2a8('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2a8('0x3'));module[_0xd2a8('0x4')]=function(_0xc37dcb,_0x23bc6a){return _0xc37dcb['define'](_0xd2a8('0x5'),attributes,{'tableName':_0xd2a8('0x6'),'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 5e0b999..e9da050 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 _0xaa4f=['catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTemplate','Template','options','where','attributes','limit','include','map','model'];(function(_0x47b32c,_0x33f2fa){var _0x7560ae=function(_0x30af84){while(--_0x30af84){_0x47b32c['push'](_0x47b32c['shift']());}};_0x7560ae(++_0x33f2fa);}(_0xaa4f,0x75));var _0xfaa4=function(_0xd8f17d,_0x135717){_0xd8f17d=_0xd8f17d-0x0;var _0x142318=_0xaa4f[_0xd8f17d];return _0x142318;};'use strict';var _=require('lodash');var util=require(_0xfaa4('0x0'));var moment=require(_0xfaa4('0x1'));var BPromise=require('bluebird');var rs=require(_0xfaa4('0x2'));var fs=require('fs');var Redis=require(_0xfaa4('0x3'));var db=require(_0xfaa4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfaa4('0x5'))(_0xfaa4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfaa4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388254,_0x14898c,_0x38eda4){return new BPromise(function(_0x270256,_0x46ec82){return client[_0xfaa4('0x8')](_0x388254,_0x38eda4)[_0xfaa4('0x9')](function(_0x18c36a){logger[_0xfaa4('0xa')](_0xfaa4('0xb'),_0x14898c,_0xfaa4('0xc'));logger[_0xfaa4('0xd')](_0xfaa4('0xe'),_0x14898c,_0xfaa4('0xc'),JSON[_0xfaa4('0xf')](_0x18c36a));if(_0x18c36a['error']){if(_0x18c36a[_0xfaa4('0x10')]['code']===0x1f4){logger[_0xfaa4('0x10')](_0xfaa4('0xb'),_0x14898c,_0x18c36a[_0xfaa4('0x10')][_0xfaa4('0x11')]);return _0x46ec82(_0x18c36a[_0xfaa4('0x10')]['message']);}logger[_0xfaa4('0x10')](_0xfaa4('0xb'),_0x14898c,_0x18c36a[_0xfaa4('0x10')]['message']);return _0x270256(_0x18c36a[_0xfaa4('0x10')][_0xfaa4('0x11')]);}else{logger[_0xfaa4('0xa')](_0xfaa4('0xb'),_0x14898c,_0xfaa4('0xc'));_0x270256(_0x18c36a[_0xfaa4('0x12')]['message']);}})['catch'](function(_0x3267b6){logger['error'](_0xfaa4('0xb'),_0x14898c,_0x3267b6);_0x46ec82(_0x3267b6);});});}exports[_0xfaa4('0x13')]=function(_0x1a2990){var _0x41ffbc=this;return new Promise(function(_0x3cbade,_0x3c4346){return db[_0xfaa4('0x14')]['findAll']({'raw':_0x1a2990['options']?_0x1a2990[_0xfaa4('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1a2990[_0xfaa4('0x15')]?_0x1a2990[_0xfaa4('0x15')][_0xfaa4('0x16')]||null:null,'attributes':_0x1a2990[_0xfaa4('0x15')]?_0x1a2990[_0xfaa4('0x15')][_0xfaa4('0x17')]||null:null,'limit':_0x1a2990[_0xfaa4('0x15')]?_0x1a2990[_0xfaa4('0x15')][_0xfaa4('0x18')]||null:null,'include':_0x1a2990[_0xfaa4('0x15')]?_0x1a2990[_0xfaa4('0x15')][_0xfaa4('0x19')]?_[_0xfaa4('0x1a')](_0x1a2990[_0xfaa4('0x15')][_0xfaa4('0x19')],function(_0x589eb0){return{'model':db[_0x589eb0[_0xfaa4('0x1b')]],'as':_0x589eb0['as'],'attributes':_0x589eb0[_0xfaa4('0x17')],'include':_0x589eb0['include']?_['map'](_0x589eb0[_0xfaa4('0x19')],function(_0x14ffe8){return{'model':db[_0x14ffe8[_0xfaa4('0x1b')]],'as':_0x14ffe8['as'],'attributes':_0x14ffe8[_0xfaa4('0x17')],'include':_0x14ffe8[_0xfaa4('0x19')]?_[_0xfaa4('0x1a')](_0x14ffe8[_0xfaa4('0x19')],function(_0x1f5a91){return{'model':db[_0x1f5a91['model']],'as':_0x1f5a91['as'],'attributes':_0x1f5a91[_0xfaa4('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfaa4('0x9')](function(_0x4dafaf){logger[_0xfaa4('0xa')](_0xfaa4('0x13'),_0x1a2990);logger[_0xfaa4('0xd')](_0xfaa4('0x13'),_0x1a2990,JSON['stringify'](_0x4dafaf));_0x3cbade(_0x4dafaf);})[_0xfaa4('0x1c')](function(_0x383885){logger[_0xfaa4('0x10')](_0xfaa4('0x13'),_0x383885[_0xfaa4('0x11')],_0x1a2990);_0x3c4346(_0x41ffbc[_0xfaa4('0x10')](0x1f4,_0x383885[_0xfaa4('0x11')]));});});}; \ No newline at end of file +var _0xe255=['map','model','stringify','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','error','code','Template,\x20%s,\x20%s','message','request\x20sent','result','GetTemplate','Template','options','where','attributes','include'];(function(_0x4628a1,_0x55ff29){var _0x492347=function(_0x4846a9){while(--_0x4846a9){_0x4628a1['push'](_0x4628a1['shift']());}};_0x492347(++_0x55ff29);}(_0xe255,0xcf));var _0x5e25=function(_0x329e59,_0xc23b07){_0x329e59=_0x329e59-0x0;var _0xb02fd0=_0xe255[_0x329e59];return _0xb02fd0;};'use strict';var _=require('lodash');var util=require(_0x5e25('0x0'));var moment=require('moment');var BPromise=require(_0x5e25('0x1'));var rs=require(_0x5e25('0x2'));var fs=require('fs');var Redis=require(_0x5e25('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e25('0x4'))(_0x5e25('0x5'));var config=require(_0x5e25('0x6'));var jayson=require(_0x5e25('0x7'));var client=jayson[_0x5e25('0x8')][_0x5e25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3552ef,_0x5deba7,_0x2d6642){return new BPromise(function(_0x550250,_0x35a92d){return client[_0x5e25('0xa')](_0x3552ef,_0x2d6642)[_0x5e25('0xb')](function(_0x5c47b1){logger['info']('Template,\x20%s,\x20%s',_0x5deba7,'request\x20sent');logger[_0x5e25('0xc')]('Template,\x20%s,\x20%s,\x20%s',_0x5deba7,'request\x20sent',JSON['stringify'](_0x5c47b1));if(_0x5c47b1['error']){if(_0x5c47b1[_0x5e25('0xd')][_0x5e25('0xe')]===0x1f4){logger[_0x5e25('0xd')](_0x5e25('0xf'),_0x5deba7,_0x5c47b1[_0x5e25('0xd')][_0x5e25('0x10')]);return _0x35a92d(_0x5c47b1['error']['message']);}logger['error'](_0x5e25('0xf'),_0x5deba7,_0x5c47b1['error'][_0x5e25('0x10')]);return _0x550250(_0x5c47b1[_0x5e25('0xd')][_0x5e25('0x10')]);}else{logger['info'](_0x5e25('0xf'),_0x5deba7,_0x5e25('0x11'));_0x550250(_0x5c47b1[_0x5e25('0x12')]['message']);}})['catch'](function(_0x214717){logger[_0x5e25('0xd')](_0x5e25('0xf'),_0x5deba7,_0x214717);_0x35a92d(_0x214717);});});}exports[_0x5e25('0x13')]=function(_0x32edcd){var _0x171529=this;return new Promise(function(_0x4b4b60,_0x4abbfb){return db[_0x5e25('0x14')]['findAll']({'raw':_0x32edcd[_0x5e25('0x15')]?_0x32edcd[_0x5e25('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x32edcd[_0x5e25('0x15')]?_0x32edcd[_0x5e25('0x15')][_0x5e25('0x16')]||null:null,'attributes':_0x32edcd[_0x5e25('0x15')]?_0x32edcd['options'][_0x5e25('0x17')]||null:null,'limit':_0x32edcd[_0x5e25('0x15')]?_0x32edcd[_0x5e25('0x15')]['limit']||null:null,'include':_0x32edcd[_0x5e25('0x15')]?_0x32edcd[_0x5e25('0x15')][_0x5e25('0x18')]?_[_0x5e25('0x19')](_0x32edcd['options']['include'],function(_0x274e50){return{'model':db[_0x274e50['model']],'as':_0x274e50['as'],'attributes':_0x274e50[_0x5e25('0x17')],'include':_0x274e50[_0x5e25('0x18')]?_[_0x5e25('0x19')](_0x274e50[_0x5e25('0x18')],function(_0x91e9b2){return{'model':db[_0x91e9b2[_0x5e25('0x1a')]],'as':_0x91e9b2['as'],'attributes':_0x91e9b2[_0x5e25('0x17')],'include':_0x91e9b2[_0x5e25('0x18')]?_[_0x5e25('0x19')](_0x91e9b2[_0x5e25('0x18')],function(_0x240eb9){return{'model':db[_0x240eb9[_0x5e25('0x1a')]],'as':_0x240eb9['as'],'attributes':_0x240eb9[_0x5e25('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x138d56){logger['info'](_0x5e25('0x13'),_0x32edcd);logger[_0x5e25('0xc')](_0x5e25('0x13'),_0x32edcd,JSON[_0x5e25('0x1b')](_0x138d56));_0x4b4b60(_0x138d56);})[_0x5e25('0x1c')](function(_0x2aa1f2){logger[_0x5e25('0xd')](_0x5e25('0x13'),_0x2aa1f2['message'],_0x32edcd);_0x4abbfb(_0x171529['error'](0x1f4,_0x2aa1f2[_0x5e25('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 915d3d7..658f762 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 _0x30b2=['/:id/any_conditions','getAnyConditions','/:id/actions','create','post','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30b2,0xbb));var _0x230b=function(_0x42dfa5,_0x1a670c){_0x42dfa5=_0x42dfa5-0x0;var _0x2afae6=_0x30b2[_0x42dfa5];return _0x2afae6;};'use strict';var multer=require(_0x230b('0x0'));var util=require('util');var path=require(_0x230b('0x1'));var timeout=require(_0x230b('0x2'));var express=require(_0x230b('0x3'));var router=express[_0x230b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x230b('0x5'));var interaction=require(_0x230b('0x6'));var config=require(_0x230b('0x7'));var controller=require(_0x230b('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x230b('0x9')]);router[_0x230b('0xa')](_0x230b('0xb'),auth[_0x230b('0xc')](),controller[_0x230b('0xd')]);router[_0x230b('0xa')](_0x230b('0xe'),auth[_0x230b('0xc')](),controller[_0x230b('0xf')]);router[_0x230b('0xa')](_0x230b('0x10'),auth[_0x230b('0xc')](),controller[_0x230b('0x11')]);router[_0x230b('0xa')](_0x230b('0x12'),auth[_0x230b('0xc')](),controller['getActions']);router['post']('/',auth[_0x230b('0xc')](),controller[_0x230b('0x13')]);router[_0x230b('0x14')](_0x230b('0xe'),auth['isAuthenticated'](),controller[_0x230b('0x15')]);router[_0x230b('0x14')](_0x230b('0x10'),auth[_0x230b('0xc')](),controller[_0x230b('0x16')]);router[_0x230b('0x14')](_0x230b('0x12'),auth[_0x230b('0xc')](),controller[_0x230b('0x17')]);router[_0x230b('0x18')]('/:id',auth[_0x230b('0xc')](),controller[_0x230b('0x19')]);router[_0x230b('0x1a')](_0x230b('0xb'),auth[_0x230b('0xc')](),controller[_0x230b('0x1b')]);module[_0x230b('0x1c')]=router; \ No newline at end of file +var _0xf1b0=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','index','get','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','create','addAnyCondition','put','delete','destroy'];(function(_0x1be9d5,_0x28806f){var _0x5cabfa=function(_0x27c8f4){while(--_0x27c8f4){_0x1be9d5['push'](_0x1be9d5['shift']());}};_0x5cabfa(++_0x28806f);}(_0xf1b0,0x151));var _0x0f1b=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xf1b0[_0x3da612];return _0x1a9d1d;};'use strict';var multer=require(_0x0f1b('0x0'));var util=require(_0x0f1b('0x1'));var path=require(_0x0f1b('0x2'));var timeout=require(_0x0f1b('0x3'));var express=require(_0x0f1b('0x4'));var router=express[_0x0f1b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f1b('0x6'));var config=require(_0x0f1b('0x7'));var controller=require(_0x0f1b('0x8'));router['get']('/',auth[_0x0f1b('0x9')](),controller[_0x0f1b('0xa')]);router[_0x0f1b('0xb')]('/:id',auth[_0x0f1b('0x9')](),controller[_0x0f1b('0xc')]);router[_0x0f1b('0xb')](_0x0f1b('0xd'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0xe')]);router[_0x0f1b('0xb')](_0x0f1b('0xf'),auth[_0x0f1b('0x9')](),controller['getAnyConditions']);router['get']('/:id/actions',auth['isAuthenticated'](),controller[_0x0f1b('0x10')]);router[_0x0f1b('0x11')]('/',auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x12')]);router[_0x0f1b('0x11')](_0x0f1b('0xd'),auth[_0x0f1b('0x9')](),controller['addAllCondition']);router['post'](_0x0f1b('0xf'),auth[_0x0f1b('0x9')](),controller[_0x0f1b('0x13')]);router['post']('/:id/actions',auth['isAuthenticated'](),controller['addAction']);router[_0x0f1b('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0f1b('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x0f1b('0x16')]);module[_0x0f1b('0x17')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 6cc7f6d..52123d6 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 _0x42ba=['STRING','BOOLEAN','sequelize','exports'];(function(_0x11ebec,_0x4904b6){var _0x16a24b=function(_0x3ed4eb){while(--_0x3ed4eb){_0x11ebec['push'](_0x11ebec['shift']());}};_0x16a24b(++_0x4904b6);}(_0x42ba,0x1da));var _0xa42b=function(_0x49f75f,_0x4ba004){_0x49f75f=_0x49f75f-0x0;var _0x4d8c24=_0x42ba[_0x49f75f];return _0x4d8c24;};'use strict';var Sequelize=require(_0xa42b('0x0'));module[_0xa42b('0x1')]={'name':{'type':Sequelize[_0xa42b('0x2')]},'channel':{'type':Sequelize[_0xa42b('0x2')]},'description':{'type':Sequelize[_0xa42b('0x2')]},'status':{'type':Sequelize[_0xa42b('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a37=['STRING','BOOLEAN','sequelize'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x5a37,0x197));var _0x75a3=function(_0x549ed3,_0x2f93b6){_0x549ed3=_0x549ed3-0x0;var _0x430546=_0x5a37[_0x549ed3];return _0x430546;};'use strict';var Sequelize=require(_0x75a3('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x75a3('0x1')]},'description':{'type':Sequelize[_0x75a3('0x1')]},'status':{'type':Sequelize[_0x75a3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index b5ccc5b..5fbe1f7 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 _0xe4ea=['Triggers','UserProfileResource','end','name','send','index','Trigger','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','type','merge','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','filter','nolimit','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','update','destroy','then','get'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xe4ea,0x144));var _0xae4e=function(_0x5cbfef,_0x4dabec){_0x5cbfef=_0x5cbfef-0x0;var _0x20f0f6=_0xe4ea[_0x5cbfef];return _0x20f0f6;};'use strict';var emlformat=require(_0xae4e('0x0'));var rimraf=require(_0xae4e('0x1'));var zipdir=require(_0xae4e('0x2'));var jsonpatch=require(_0xae4e('0x3'));var rp=require(_0xae4e('0x4'));var moment=require(_0xae4e('0x5'));var BPromise=require(_0xae4e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xae4e('0x7'));var sox=require(_0xae4e('0x8'));var csv=require('to-csv');var ejs=require(_0xae4e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xae4e('0xa'));var crypto=require('crypto');var jsforce=require(_0xae4e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xae4e('0xc'));var querystring=require(_0xae4e('0xd'));var Papa=require(_0xae4e('0xe'));var Redis=require(_0xae4e('0xf'));var authService=require(_0xae4e('0x10'));var qs=require(_0xae4e('0x11'));var as=require(_0xae4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xae4e('0x13'))(_0xae4e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xae4e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6d25,_0x2846f9){_0x2846f9=_0x2846f9||0xcc;return function(_0x593320){if(_0x593320){return _0x1d6d25[_0xae4e('0x16')](_0x2846f9);}return _0x1d6d25['status'](_0x2846f9)['end']();};}function respondWithResult(_0x4e24fa,_0x273fca){_0x273fca=_0x273fca||0xc8;return function(_0x21fa19){if(_0x21fa19){return _0x4e24fa[_0xae4e('0x17')](_0x273fca)[_0xae4e('0x18')](_0x21fa19);}};}function respondWithFilteredResult(_0x467e24,_0x231e6d){return function(_0x13a7f6){if(_0x13a7f6){var _0x3a1dc6=typeof _0x231e6d['offset']===_0xae4e('0x19')&&typeof _0x231e6d[_0xae4e('0x1a')]===_0xae4e('0x19');var _0x2ec57b=_0x13a7f6[_0xae4e('0x1b')];var _0x34b20c=_0x3a1dc6?0x0:_0x231e6d[_0xae4e('0x1c')];var _0x314567=_0x3a1dc6?_0x13a7f6[_0xae4e('0x1b')]:_0x231e6d[_0xae4e('0x1c')]+_0x231e6d[_0xae4e('0x1a')];var _0x4fadd2;if(_0x314567>=_0x2ec57b){_0x314567=_0x2ec57b;_0x4fadd2=0xc8;}else{_0x4fadd2=0xce;}_0x467e24[_0xae4e('0x17')](_0x4fadd2);return _0x467e24['set'](_0xae4e('0x1d'),_0x34b20c+'-'+_0x314567+'/'+_0x2ec57b)['json'](_0x13a7f6);}return null;};}function patchUpdates(_0x43a9fd){return function(_0x44704a){try{jsonpatch[_0xae4e('0x1e')](_0x44704a,_0x43a9fd,!![]);}catch(_0x214787){return BPromise['reject'](_0x214787);}return _0x44704a[_0xae4e('0x1f')]();};}function saveUpdates(_0x39e95e,_0x4563fc){return function(_0x1b5fea){if(_0x1b5fea){return _0x1b5fea[_0xae4e('0x20')](_0x39e95e)['then'](function(_0x3f9e30){return _0x3f9e30;});}return null;};}function removeEntity(_0x2d1efd,_0x143859){return function(_0x1e8e87){if(_0x1e8e87){return _0x1e8e87[_0xae4e('0x21')]()[_0xae4e('0x22')](function(){var _0x5f1f35=_0x1e8e87[_0xae4e('0x23')]({'plain':!![]});var _0x7d734c=_0xae4e('0x24');return db[_0xae4e('0x25')][_0xae4e('0x21')]({'where':{'type':_0x7d734c,'resourceId':_0x5f1f35['id']}})['then'](function(){return _0x1e8e87;});})[_0xae4e('0x22')](function(){_0x2d1efd[_0xae4e('0x17')](0xcc)[_0xae4e('0x26')]();});}};}function handleEntityNotFound(_0x185183,_0x50c984){return function(_0x40617b){if(!_0x40617b){_0x185183[_0xae4e('0x16')](0x194);}return _0x40617b;};}function handleError(_0x266f33,_0x5455a2){_0x5455a2=_0x5455a2||0x1f4;return function(_0x1d81b4){logger['error'](_0x1d81b4['stack']);if(_0x1d81b4[_0xae4e('0x27')]){delete _0x1d81b4[_0xae4e('0x27')];}_0x266f33[_0xae4e('0x17')](_0x5455a2)[_0xae4e('0x28')](_0x1d81b4);};}exports[_0xae4e('0x29')]=function(_0x160e57,_0x3b70aa){var _0x32a528={},_0x5c0773={},_0x487cfe={'count':0x0,'rows':[]};var _0x48d309=_['map'](db[_0xae4e('0x2a')][_0xae4e('0x2b')],function(_0x5c72bc){return{'name':_0x5c72bc[_0xae4e('0x2c')],'type':_0x5c72bc['type'][_0xae4e('0x2d')]};});_0x5c0773[_0xae4e('0x2e')]=_[_0xae4e('0x2f')](_0x48d309,_0xae4e('0x27'));_0x5c0773[_0xae4e('0x30')]=_[_0xae4e('0x31')](_0x160e57[_0xae4e('0x30')]);_0x5c0773[_0xae4e('0x32')]=_[_0xae4e('0x33')](_0x5c0773[_0xae4e('0x2e')],_0x5c0773[_0xae4e('0x30')]);_0x32a528[_0xae4e('0x34')]=_['intersection'](_0x5c0773[_0xae4e('0x2e')],qs[_0xae4e('0x35')](_0x160e57['query'][_0xae4e('0x35')]));_0x32a528['attributes']=_0x32a528[_0xae4e('0x34')]['length']?_0x32a528[_0xae4e('0x34')]:_0x5c0773[_0xae4e('0x2e')];if(!_0x160e57['query'][_0xae4e('0x36')]('nolimit')){_0x32a528[_0xae4e('0x1a')]=qs[_0xae4e('0x1a')](_0x160e57[_0xae4e('0x30')]['limit']);_0x32a528[_0xae4e('0x1c')]=qs[_0xae4e('0x1c')](_0x160e57[_0xae4e('0x30')][_0xae4e('0x1c')]);}_0x32a528[_0xae4e('0x37')]=qs[_0xae4e('0x38')](_0x160e57[_0xae4e('0x30')][_0xae4e('0x38')]);_0x32a528[_0xae4e('0x39')]=qs['filters'](_[_0xae4e('0x3a')](_0x160e57['query'],_0x5c0773[_0xae4e('0x32')]),_0x48d309);if(_0x160e57[_0xae4e('0x30')]['filter']){_0x32a528[_0xae4e('0x39')]=_['merge'](_0x32a528[_0xae4e('0x39')],{'$or':_[_0xae4e('0x2f')](_0x48d309,function(_0x3273a7){if(_0x3273a7[_0xae4e('0x3b')]!=='VIRTUAL'){var _0x3903fb={};_0x3903fb[_0x3273a7[_0xae4e('0x27')]]={'$like':'%'+_0x160e57[_0xae4e('0x30')]['filter']+'%'};return _0x3903fb;}})});}_0x32a528=_[_0xae4e('0x3c')]({},_0x32a528,_0x160e57[_0xae4e('0x3d')]);var _0xe3848={'where':_0x32a528['where']};return db[_0xae4e('0x2a')][_0xae4e('0x1b')](_0xe3848)[_0xae4e('0x22')](function(_0x585e9b){_0x487cfe['count']=_0x585e9b;if(_0x160e57[_0xae4e('0x30')]['includeAll']){_0x32a528[_0xae4e('0x3e')]=[{'all':!![]}];}return db['Trigger'][_0xae4e('0x3f')](_0x32a528);})[_0xae4e('0x22')](function(_0x522aa9){_0x487cfe[_0xae4e('0x40')]=_0x522aa9;return _0x487cfe;})[_0xae4e('0x22')](respondWithFilteredResult(_0x3b70aa,_0x32a528))['catch'](handleError(_0x3b70aa,null));};exports[_0xae4e('0x41')]=function(_0xd90c6f,_0x1e5ddf){var _0x22fcf5={'raw':![],'where':{'id':_0xd90c6f[_0xae4e('0x42')]['id']}},_0x2ab674={};_0x2ab674[_0xae4e('0x2e')]=_['keys'](db[_0xae4e('0x2a')]['rawAttributes']);_0x2ab674[_0xae4e('0x30')]=_[_0xae4e('0x31')](_0xd90c6f['query']);_0x2ab674[_0xae4e('0x32')]=_[_0xae4e('0x33')](_0x2ab674['model'],_0x2ab674['query']);_0x22fcf5[_0xae4e('0x34')]=_[_0xae4e('0x33')](_0x2ab674[_0xae4e('0x2e')],qs[_0xae4e('0x35')](_0xd90c6f[_0xae4e('0x30')][_0xae4e('0x35')]));_0x22fcf5[_0xae4e('0x34')]=_0x22fcf5[_0xae4e('0x34')][_0xae4e('0x43')]?_0x22fcf5[_0xae4e('0x34')]:_0x2ab674[_0xae4e('0x2e')];if(_0xd90c6f[_0xae4e('0x30')][_0xae4e('0x44')]){_0x22fcf5[_0xae4e('0x3e')]=[{'all':!![]}];}_0x22fcf5=_[_0xae4e('0x3c')]({},_0x22fcf5,_0xd90c6f[_0xae4e('0x3d')]);return db['Trigger'][_0xae4e('0x45')](_0x22fcf5)[_0xae4e('0x22')](handleEntityNotFound(_0x1e5ddf,null))['then'](respondWithResult(_0x1e5ddf,null))[_0xae4e('0x46')](handleError(_0x1e5ddf,null));};exports[_0xae4e('0x47')]=function(_0x24383d,_0x303df1){return db['Trigger']['create'](_0x24383d[_0xae4e('0x48')],{})['then'](function(_0x1fb53e){var _0x2ac472=_0x24383d[_0xae4e('0x49')]['get']({'plain':!![]});if(!_0x2ac472)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ac472['role']===_0xae4e('0x49')){var _0x2a5e94=_0x1fb53e[_0xae4e('0x23')]({'plain':!![]});var _0x3fb5c9=_0xae4e('0x24');return db[_0xae4e('0x4a')][_0xae4e('0x45')]({'where':{'name':_0x3fb5c9,'userProfileId':_0x2ac472[_0xae4e('0x4b')]},'raw':!![]})[_0xae4e('0x22')](function(_0x17a3de){if(_0x17a3de&&_0x17a3de[_0xae4e('0x4c')]===0x0){return db[_0xae4e('0x25')][_0xae4e('0x47')]({'name':_0x2a5e94[_0xae4e('0x27')],'resourceId':_0x2a5e94['id'],'type':_0x17a3de[_0xae4e('0x27')],'sectionId':_0x17a3de['id']},{})[_0xae4e('0x22')](function(){return _0x1fb53e;});}else{return _0x1fb53e;}})[_0xae4e('0x46')](function(_0x88a5f2){logger['error'](_0xae4e('0x4d'),_0x88a5f2);throw _0x88a5f2;});}return _0x1fb53e;})[_0xae4e('0x22')](respondWithResult(_0x303df1,0xc9))['catch'](handleError(_0x303df1,null));};exports[_0xae4e('0x20')]=function(_0xd1c295,_0x2685ee){if(_0xd1c295[_0xae4e('0x48')]['id']){delete _0xd1c295[_0xae4e('0x48')]['id'];}return db[_0xae4e('0x2a')][_0xae4e('0x45')]({'where':{'id':_0xd1c295[_0xae4e('0x42')]['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x2685ee,null))['then'](saveUpdates(_0xd1c295[_0xae4e('0x48')],null))[_0xae4e('0x22')](respondWithResult(_0x2685ee,null))['catch'](handleError(_0x2685ee,null));};exports[_0xae4e('0x21')]=function(_0x5068e9,_0x455535){return db[_0xae4e('0x2a')][_0xae4e('0x45')]({'where':{'id':_0x5068e9[_0xae4e('0x42')]['id']}})['then'](handleEntityNotFound(_0x455535,null))[_0xae4e('0x22')](removeEntity(_0x455535,null))[_0xae4e('0x46')](handleError(_0x455535,null));};exports[_0xae4e('0x4e')]=function(_0x2631ee,_0x2d7388,_0x51a78a){if(_0x2631ee['body']['id']){delete _0x2631ee['body']['id'];}return db[_0xae4e('0x2a')][_0xae4e('0x45')]({'where':{'id':_0x2631ee['params']['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x2d7388,null))[_0xae4e('0x22')](function(_0x3137e9){if(_0x3137e9){_0x2631ee[_0xae4e('0x48')][_0xae4e('0x4f')]=_0x3137e9['id'];return db[_0xae4e('0x50')]['create'](_0x2631ee[_0xae4e('0x48')]);}})[_0xae4e('0x22')](respondWithResult(_0x2d7388,null))[_0xae4e('0x46')](handleError(_0x2d7388,null));};exports[_0xae4e('0x51')]=function(_0x2b0b62,_0x5121a3,_0x4fd0b0){if(_0x2b0b62[_0xae4e('0x48')]['id']){delete _0x2b0b62['body']['id'];}return db[_0xae4e('0x2a')][_0xae4e('0x45')]({'where':{'id':_0x2b0b62['params']['id']}})['then'](handleEntityNotFound(_0x5121a3,null))[_0xae4e('0x22')](function(_0x5217b0){if(_0x5217b0){_0x2b0b62[_0xae4e('0x48')]['TriggerAnyId']=_0x5217b0['id'];return db['Condition'][_0xae4e('0x47')](_0x2b0b62[_0xae4e('0x48')]);}})[_0xae4e('0x22')](respondWithResult(_0x5121a3,null))[_0xae4e('0x46')](handleError(_0x5121a3,null));};exports['getAllConditions']=function(_0x595121,_0x58b766,_0x4950fa){var _0x530de5={};var _0x1a4ca6={};var _0x273b8e;var _0x2daaaf;return db[_0xae4e('0x2a')]['findOne']({'where':{'id':_0x595121['params']['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x58b766,null))[_0xae4e('0x22')](function(_0x530822){if(_0x530822){_0x273b8e=_0x530822;_0x1a4ca6[_0xae4e('0x2e')]=_[_0xae4e('0x31')](db[_0xae4e('0x50')][_0xae4e('0x2b')]);_0x1a4ca6[_0xae4e('0x30')]=_[_0xae4e('0x31')](_0x595121[_0xae4e('0x30')]);_0x1a4ca6['filters']=_['intersection'](_0x1a4ca6[_0xae4e('0x2e')],_0x1a4ca6['query']);_0x530de5['attributes']=_['intersection'](_0x1a4ca6[_0xae4e('0x2e')],qs['fields'](_0x595121[_0xae4e('0x30')]['fields']));_0x530de5[_0xae4e('0x34')]=_0x530de5[_0xae4e('0x34')]['length']?_0x530de5[_0xae4e('0x34')]:_0x1a4ca6['model'];_0x530de5[_0xae4e('0x37')]=qs[_0xae4e('0x38')](_0x595121[_0xae4e('0x30')]['sort']);_0x530de5[_0xae4e('0x39')]=qs[_0xae4e('0x32')](_['pick'](_0x595121[_0xae4e('0x30')],_0x1a4ca6[_0xae4e('0x32')]));if(_0x595121[_0xae4e('0x30')][_0xae4e('0x52')]){_0x530de5[_0xae4e('0x39')]=_['merge'](_0x530de5[_0xae4e('0x39')],{'$or':_[_0xae4e('0x2f')](_0x530de5[_0xae4e('0x34')],function(_0x415f8a){var _0x2da740={};_0x2da740[_0x415f8a]={'$like':'%'+_0x595121[_0xae4e('0x30')][_0xae4e('0x52')]+'%'};return _0x2da740;})});}_0x530de5=_[_0xae4e('0x3c')]({},_0x530de5,_0x595121[_0xae4e('0x3d')]);return _0x273b8e['getAllConditions'](_0x530de5);}})[_0xae4e('0x22')](function(_0x1a4bc7){if(_0x1a4bc7){_0x2daaaf=_0x1a4bc7[_0xae4e('0x43')];if(!_0x595121[_0xae4e('0x30')][_0xae4e('0x36')](_0xae4e('0x53'))){_0x530de5[_0xae4e('0x1a')]=qs[_0xae4e('0x1a')](_0x595121['query'][_0xae4e('0x1a')]);_0x530de5[_0xae4e('0x1c')]=qs['offset'](_0x595121[_0xae4e('0x30')]['offset']);}return _0x273b8e['getAllConditions'](_0x530de5);}})[_0xae4e('0x22')](function(_0x4b075b){if(_0x4b075b){return _0x4b075b?{'count':_0x2daaaf,'rows':_0x4b075b}:null;}})['then'](respondWithResult(_0x58b766,null))['catch'](handleError(_0x58b766,null));};exports[_0xae4e('0x54')]=function(_0x7119b4,_0x39c89c,_0x49aa46){var _0x25b862={};var _0x16e1c8={};var _0x3a91c5;var _0x43b36f;return db[_0xae4e('0x2a')][_0xae4e('0x55')]({'where':{'id':_0x7119b4[_0xae4e('0x42')]['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x39c89c,null))[_0xae4e('0x22')](function(_0x385cba){if(_0x385cba){_0x3a91c5=_0x385cba;_0x16e1c8[_0xae4e('0x2e')]=_['keys'](db[_0xae4e('0x50')][_0xae4e('0x2b')]);_0x16e1c8['query']=_[_0xae4e('0x31')](_0x7119b4[_0xae4e('0x30')]);_0x16e1c8['filters']=_['intersection'](_0x16e1c8[_0xae4e('0x2e')],_0x16e1c8[_0xae4e('0x30')]);_0x25b862[_0xae4e('0x34')]=_['intersection'](_0x16e1c8[_0xae4e('0x2e')],qs[_0xae4e('0x35')](_0x7119b4['query']['fields']));_0x25b862[_0xae4e('0x34')]=_0x25b862[_0xae4e('0x34')][_0xae4e('0x43')]?_0x25b862[_0xae4e('0x34')]:_0x16e1c8['model'];_0x25b862[_0xae4e('0x37')]=qs[_0xae4e('0x38')](_0x7119b4['query'][_0xae4e('0x38')]);_0x25b862[_0xae4e('0x39')]=qs[_0xae4e('0x32')](_['pick'](_0x7119b4['query'],_0x16e1c8['filters']));if(_0x7119b4['query'][_0xae4e('0x52')]){_0x25b862[_0xae4e('0x39')]=_[_0xae4e('0x3c')](_0x25b862[_0xae4e('0x39')],{'$or':_[_0xae4e('0x2f')](_0x25b862[_0xae4e('0x34')],function(_0x21a29a){var _0x253c57={};_0x253c57[_0x21a29a]={'$like':'%'+_0x7119b4[_0xae4e('0x30')]['filter']+'%'};return _0x253c57;})});}_0x25b862=_['merge']({},_0x25b862,_0x7119b4['options']);return _0x3a91c5[_0xae4e('0x54')](_0x25b862);}})[_0xae4e('0x22')](function(_0x558340){if(_0x558340){_0x43b36f=_0x558340['length'];if(!_0x7119b4[_0xae4e('0x30')][_0xae4e('0x36')](_0xae4e('0x53'))){_0x25b862[_0xae4e('0x1a')]=qs[_0xae4e('0x1a')](_0x7119b4[_0xae4e('0x30')]['limit']);_0x25b862[_0xae4e('0x1c')]=qs[_0xae4e('0x1c')](_0x7119b4[_0xae4e('0x30')]['offset']);}return _0x3a91c5[_0xae4e('0x54')](_0x25b862);}})[_0xae4e('0x22')](function(_0x39efc6){if(_0x39efc6){return _0x39efc6?{'count':_0x43b36f,'rows':_0x39efc6}:null;}})[_0xae4e('0x22')](respondWithResult(_0x39c89c,null))[_0xae4e('0x46')](handleError(_0x39c89c,null));};exports[_0xae4e('0x56')]=function(_0x2d5240,_0x156d34,_0x263bd3){if(_0x2d5240[_0xae4e('0x48')]['id']){delete _0x2d5240[_0xae4e('0x48')]['id'];}return db[_0xae4e('0x2a')][_0xae4e('0x45')]({'where':{'id':_0x2d5240[_0xae4e('0x42')]['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x156d34,null))[_0xae4e('0x22')](function(_0x33d029){if(_0x33d029){_0x2d5240[_0xae4e('0x48')][_0xae4e('0x57')]=_0x33d029['id'];return db[_0xae4e('0x58')][_0xae4e('0x47')](_0x2d5240[_0xae4e('0x48')]);}})[_0xae4e('0x22')](respondWithResult(_0x156d34,null))['catch'](handleError(_0x156d34,null));};exports[_0xae4e('0x59')]=function(_0x2069c3,_0x5d647c,_0x192c8b){var _0x1f4380={};var _0x275b00={};var _0x3fbb9e;var _0x18d1d9;return db[_0xae4e('0x2a')][_0xae4e('0x55')]({'where':{'id':_0x2069c3[_0xae4e('0x42')]['id']}})[_0xae4e('0x22')](handleEntityNotFound(_0x5d647c,null))[_0xae4e('0x22')](function(_0x407932){if(_0x407932){_0x3fbb9e=_0x407932;_0x275b00[_0xae4e('0x2e')]=_[_0xae4e('0x31')](db['Action'][_0xae4e('0x2b')]);_0x275b00[_0xae4e('0x30')]=_[_0xae4e('0x31')](_0x2069c3[_0xae4e('0x30')]);_0x275b00['filters']=_[_0xae4e('0x33')](_0x275b00['model'],_0x275b00['query']);_0x1f4380[_0xae4e('0x34')]=_[_0xae4e('0x33')](_0x275b00[_0xae4e('0x2e')],qs[_0xae4e('0x35')](_0x2069c3[_0xae4e('0x30')][_0xae4e('0x35')]));_0x1f4380[_0xae4e('0x34')]=_0x1f4380['attributes'][_0xae4e('0x43')]?_0x1f4380[_0xae4e('0x34')]:_0x275b00['model'];_0x1f4380[_0xae4e('0x37')]=qs[_0xae4e('0x38')](_0x2069c3[_0xae4e('0x30')][_0xae4e('0x38')]);_0x1f4380[_0xae4e('0x39')]=qs[_0xae4e('0x32')](_[_0xae4e('0x3a')](_0x2069c3[_0xae4e('0x30')],_0x275b00[_0xae4e('0x32')]));if(_0x2069c3['query']['filter']){_0x1f4380['where']=_['merge'](_0x1f4380[_0xae4e('0x39')],{'$or':_[_0xae4e('0x2f')](_0x1f4380['attributes'],function(_0x1a36dc){var _0x3f3f31={};_0x3f3f31[_0x1a36dc]={'$like':'%'+_0x2069c3['query'][_0xae4e('0x52')]+'%'};return _0x3f3f31;})});}_0x1f4380=_[_0xae4e('0x3c')]({},_0x1f4380,_0x2069c3[_0xae4e('0x3d')]);return _0x3fbb9e[_0xae4e('0x59')](_0x1f4380);}})['then'](function(_0x50623b){if(_0x50623b){_0x18d1d9=_0x50623b[_0xae4e('0x43')];if(!_0x2069c3['query'][_0xae4e('0x36')](_0xae4e('0x53'))){_0x1f4380[_0xae4e('0x1a')]=qs[_0xae4e('0x1a')](_0x2069c3[_0xae4e('0x30')][_0xae4e('0x1a')]);_0x1f4380[_0xae4e('0x1c')]=qs[_0xae4e('0x1c')](_0x2069c3[_0xae4e('0x30')][_0xae4e('0x1c')]);}return _0x3fbb9e[_0xae4e('0x59')](_0x1f4380);}})['then'](function(_0x395605){if(_0x395605){return _0x395605?{'count':_0x18d1d9,'rows':_0x395605}:null;}})[_0xae4e('0x22')](respondWithResult(_0x5d647c,null))[_0xae4e('0x46')](handleError(_0x5d647c,null));}; \ No newline at end of file +var _0x3a1f=['model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','Trigger','includeAll','include','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','getAnyConditions','findOne','rawAttributes','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Triggers','sendStatus','error','stack','send','index','map','fieldName'];(function(_0x5cbfb8,_0xa6a896){var _0x542769=function(_0x2c6163){while(--_0x2c6163){_0x5cbfb8['push'](_0x5cbfb8['shift']());}};_0x542769(++_0xa6a896);}(_0x3a1f,0x8e));var _0xf3a1=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x3a1f[_0x56482c];return _0x5aae7a;};'use strict';var emlformat=require(_0xf3a1('0x0'));var rimraf=require(_0xf3a1('0x1'));var zipdir=require(_0xf3a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3a1('0x3'));var moment=require(_0xf3a1('0x4'));var BPromise=require(_0xf3a1('0x5'));var Mustache=require(_0xf3a1('0x6'));var util=require(_0xf3a1('0x7'));var path=require(_0xf3a1('0x8'));var sox=require(_0xf3a1('0x9'));var csv=require(_0xf3a1('0xa'));var ejs=require(_0xf3a1('0xb'));var fs=require('fs');var fs_extra=require(_0xf3a1('0xc'));var _=require(_0xf3a1('0xd'));var squel=require(_0xf3a1('0xe'));var crypto=require(_0xf3a1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xf3a1('0x10'));var toCsv=require(_0xf3a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf3a1('0x11'));var authService=require(_0xf3a1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3a1('0x13'));var logger=require(_0xf3a1('0x14'))(_0xf3a1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf3a1('0x16'));var db=require(_0xf3a1('0x17'))['db'];function respondWithStatusCode(_0x5a317d,_0x4d8725){_0x4d8725=_0x4d8725||0xcc;return function(_0x5d3795){if(_0x5d3795){return _0x5a317d['sendStatus'](_0x4d8725);}return _0x5a317d[_0xf3a1('0x18')](_0x4d8725)[_0xf3a1('0x19')]();};}function respondWithResult(_0x544447,_0x3c3b7b){_0x3c3b7b=_0x3c3b7b||0xc8;return function(_0x5ef7d5){if(_0x5ef7d5){return _0x544447[_0xf3a1('0x18')](_0x3c3b7b)[_0xf3a1('0x1a')](_0x5ef7d5);}};}function respondWithFilteredResult(_0x2a9d6e,_0xf0348d){return function(_0x2de225){if(_0x2de225){var _0x27add6=typeof _0xf0348d[_0xf3a1('0x1b')]===_0xf3a1('0x1c')&&typeof _0xf0348d[_0xf3a1('0x1d')]==='undefined';var _0x5d0564=_0x2de225[_0xf3a1('0x1e')];var _0x832251=_0x27add6?0x0:_0xf0348d[_0xf3a1('0x1b')];var _0x54e68d=_0x27add6?_0x2de225['count']:_0xf0348d[_0xf3a1('0x1b')]+_0xf0348d[_0xf3a1('0x1d')];var _0x3a6936;if(_0x54e68d>=_0x5d0564){_0x54e68d=_0x5d0564;_0x3a6936=0xc8;}else{_0x3a6936=0xce;}_0x2a9d6e[_0xf3a1('0x18')](_0x3a6936);return _0x2a9d6e[_0xf3a1('0x1f')](_0xf3a1('0x20'),_0x832251+'-'+_0x54e68d+'/'+_0x5d0564)[_0xf3a1('0x1a')](_0x2de225);}return null;};}function patchUpdates(_0x1532ea){return function(_0x3c5d62){try{jsonpatch[_0xf3a1('0x21')](_0x3c5d62,_0x1532ea,!![]);}catch(_0x5d8014){return BPromise[_0xf3a1('0x22')](_0x5d8014);}return _0x3c5d62[_0xf3a1('0x23')]();};}function saveUpdates(_0x3ee9bd,_0x3dad16){return function(_0x1a2cd7){if(_0x1a2cd7){return _0x1a2cd7[_0xf3a1('0x24')](_0x3ee9bd)['then'](function(_0xf5a275){return _0xf5a275;});}return null;};}function removeEntity(_0x2de760,_0x75b103){return function(_0x3b5624){if(_0x3b5624){return _0x3b5624[_0xf3a1('0x25')]()[_0xf3a1('0x26')](function(){var _0x2564fd=_0x3b5624[_0xf3a1('0x27')]({'plain':!![]});var _0x109c51=_0xf3a1('0x28');return db['UserProfileResource'][_0xf3a1('0x25')]({'where':{'type':_0x109c51,'resourceId':_0x2564fd['id']}})[_0xf3a1('0x26')](function(){return _0x3b5624;});})[_0xf3a1('0x26')](function(){_0x2de760['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x308848,_0x50301c){return function(_0x36d4f9){if(!_0x36d4f9){_0x308848[_0xf3a1('0x29')](0x194);}return _0x36d4f9;};}function handleError(_0x5cc19f,_0x3b3320){_0x3b3320=_0x3b3320||0x1f4;return function(_0x312f01){logger[_0xf3a1('0x2a')](_0x312f01[_0xf3a1('0x2b')]);if(_0x312f01['name']){delete _0x312f01['name'];}_0x5cc19f['status'](_0x3b3320)[_0xf3a1('0x2c')](_0x312f01);};}exports[_0xf3a1('0x2d')]=function(_0x1d67c2,_0x439d72){var _0x19a9db={},_0x1edc03={},_0x3f9d08={'count':0x0,'rows':[]};var _0x27a107=_[_0xf3a1('0x2e')](db['Trigger']['rawAttributes'],function(_0x19d52e){return{'name':_0x19d52e[_0xf3a1('0x2f')],'type':_0x19d52e['type']['key']};});_0x1edc03[_0xf3a1('0x30')]=_[_0xf3a1('0x2e')](_0x27a107,_0xf3a1('0x31'));_0x1edc03['query']=_[_0xf3a1('0x32')](_0x1d67c2[_0xf3a1('0x33')]);_0x1edc03['filters']=_[_0xf3a1('0x34')](_0x1edc03[_0xf3a1('0x30')],_0x1edc03[_0xf3a1('0x33')]);_0x19a9db[_0xf3a1('0x35')]=_[_0xf3a1('0x34')](_0x1edc03['model'],qs['fields'](_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x36')]));_0x19a9db[_0xf3a1('0x35')]=_0x19a9db[_0xf3a1('0x35')][_0xf3a1('0x37')]?_0x19a9db[_0xf3a1('0x35')]:_0x1edc03[_0xf3a1('0x30')];if(!_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x38')](_0xf3a1('0x39'))){_0x19a9db[_0xf3a1('0x1d')]=qs['limit'](_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x1d')]);_0x19a9db['offset']=qs[_0xf3a1('0x1b')](_0x1d67c2['query'][_0xf3a1('0x1b')]);}_0x19a9db[_0xf3a1('0x3a')]=qs[_0xf3a1('0x3b')](_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x3b')]);_0x19a9db[_0xf3a1('0x3c')]=qs[_0xf3a1('0x3d')](_[_0xf3a1('0x3e')](_0x1d67c2[_0xf3a1('0x33')],_0x1edc03[_0xf3a1('0x3d')]),_0x27a107);if(_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x3f')]){_0x19a9db[_0xf3a1('0x3c')]=_['merge'](_0x19a9db[_0xf3a1('0x3c')],{'$or':_['map'](_0x27a107,function(_0x454e6c){if(_0x454e6c[_0xf3a1('0x40')]!==_0xf3a1('0x41')){var _0x400d7b={};_0x400d7b[_0x454e6c['name']]={'$like':'%'+_0x1d67c2[_0xf3a1('0x33')][_0xf3a1('0x3f')]+'%'};return _0x400d7b;}})});}_0x19a9db=_[_0xf3a1('0x42')]({},_0x19a9db,_0x1d67c2[_0xf3a1('0x43')]);var _0x4661e3={'where':_0x19a9db[_0xf3a1('0x3c')]};return db[_0xf3a1('0x44')][_0xf3a1('0x1e')](_0x4661e3)[_0xf3a1('0x26')](function(_0x1ff56f){_0x3f9d08[_0xf3a1('0x1e')]=_0x1ff56f;if(_0x1d67c2['query'][_0xf3a1('0x45')]){_0x19a9db[_0xf3a1('0x46')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0x19a9db);})[_0xf3a1('0x26')](function(_0x439200){_0x3f9d08[_0xf3a1('0x47')]=_0x439200;return _0x3f9d08;})[_0xf3a1('0x26')](respondWithFilteredResult(_0x439d72,_0x19a9db))[_0xf3a1('0x48')](handleError(_0x439d72,null));};exports[_0xf3a1('0x49')]=function(_0x355e95,_0x57e5bd){var _0x189420={'raw':![],'where':{'id':_0x355e95[_0xf3a1('0x4a')]['id']}},_0x367f70={};_0x367f70[_0xf3a1('0x30')]=_[_0xf3a1('0x32')](db[_0xf3a1('0x44')]['rawAttributes']);_0x367f70[_0xf3a1('0x33')]=_[_0xf3a1('0x32')](_0x355e95[_0xf3a1('0x33')]);_0x367f70[_0xf3a1('0x3d')]=_[_0xf3a1('0x34')](_0x367f70[_0xf3a1('0x30')],_0x367f70[_0xf3a1('0x33')]);_0x189420[_0xf3a1('0x35')]=_[_0xf3a1('0x34')](_0x367f70[_0xf3a1('0x30')],qs[_0xf3a1('0x36')](_0x355e95[_0xf3a1('0x33')][_0xf3a1('0x36')]));_0x189420[_0xf3a1('0x35')]=_0x189420[_0xf3a1('0x35')][_0xf3a1('0x37')]?_0x189420[_0xf3a1('0x35')]:_0x367f70['model'];if(_0x355e95[_0xf3a1('0x33')][_0xf3a1('0x45')]){_0x189420['include']=[{'all':!![]}];}_0x189420=_[_0xf3a1('0x42')]({},_0x189420,_0x355e95['options']);return db[_0xf3a1('0x44')][_0xf3a1('0x4b')](_0x189420)[_0xf3a1('0x26')](handleEntityNotFound(_0x57e5bd,null))[_0xf3a1('0x26')](respondWithResult(_0x57e5bd,null))['catch'](handleError(_0x57e5bd,null));};exports[_0xf3a1('0x4c')]=function(_0x143612,_0x2ae34f){return db[_0xf3a1('0x44')][_0xf3a1('0x4c')](_0x143612['body'],{})[_0xf3a1('0x26')](function(_0x560e2c){var _0x181e5a=_0x143612[_0xf3a1('0x4d')][_0xf3a1('0x27')]({'plain':!![]});if(!_0x181e5a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x181e5a[_0xf3a1('0x4e')]==='user'){var _0x19222e=_0x560e2c[_0xf3a1('0x27')]({'plain':!![]});var _0x2f4c66='Triggers';return db[_0xf3a1('0x4f')][_0xf3a1('0x4b')]({'where':{'name':_0x2f4c66,'userProfileId':_0x181e5a[_0xf3a1('0x50')]},'raw':!![]})[_0xf3a1('0x26')](function(_0x1b8b5f){if(_0x1b8b5f&&_0x1b8b5f[_0xf3a1('0x51')]===0x0){return db[_0xf3a1('0x52')][_0xf3a1('0x4c')]({'name':_0x19222e['name'],'resourceId':_0x19222e['id'],'type':_0x1b8b5f[_0xf3a1('0x31')],'sectionId':_0x1b8b5f['id']},{})[_0xf3a1('0x26')](function(){return _0x560e2c;});}else{return _0x560e2c;}})['catch'](function(_0x30e6b2){logger[_0xf3a1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30e6b2);throw _0x30e6b2;});}return _0x560e2c;})[_0xf3a1('0x26')](respondWithResult(_0x2ae34f,0xc9))[_0xf3a1('0x48')](handleError(_0x2ae34f,null));};exports['update']=function(_0x56ef92,_0x8283a8){if(_0x56ef92['body']['id']){delete _0x56ef92[_0xf3a1('0x53')]['id'];}return db[_0xf3a1('0x44')][_0xf3a1('0x4b')]({'where':{'id':_0x56ef92[_0xf3a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x8283a8,null))[_0xf3a1('0x26')](saveUpdates(_0x56ef92[_0xf3a1('0x53')],null))[_0xf3a1('0x26')](respondWithResult(_0x8283a8,null))[_0xf3a1('0x48')](handleError(_0x8283a8,null));};exports[_0xf3a1('0x25')]=function(_0x58acfb,_0x24534f){return db[_0xf3a1('0x44')][_0xf3a1('0x4b')]({'where':{'id':_0x58acfb[_0xf3a1('0x4a')]['id']}})[_0xf3a1('0x26')](handleEntityNotFound(_0x24534f,null))['then'](removeEntity(_0x24534f,null))['catch'](handleError(_0x24534f,null));};exports[_0xf3a1('0x54')]=function(_0x16461e,_0x4cbb1c,_0x158265){if(_0x16461e['body']['id']){delete _0x16461e['body']['id'];}return db[_0xf3a1('0x44')]['find']({'where':{'id':_0x16461e[_0xf3a1('0x4a')]['id']}})[_0xf3a1('0x26')](handleEntityNotFound(_0x4cbb1c,null))[_0xf3a1('0x26')](function(_0x46ca43){if(_0x46ca43){_0x16461e['body'][_0xf3a1('0x55')]=_0x46ca43['id'];return db[_0xf3a1('0x56')][_0xf3a1('0x4c')](_0x16461e['body']);}})[_0xf3a1('0x26')](respondWithResult(_0x4cbb1c,null))[_0xf3a1('0x48')](handleError(_0x4cbb1c,null));};exports['addAnyCondition']=function(_0x221e4c,_0x53bc6d,_0x4d664c){if(_0x221e4c[_0xf3a1('0x53')]['id']){delete _0x221e4c[_0xf3a1('0x53')]['id'];}return db['Trigger'][_0xf3a1('0x4b')]({'where':{'id':_0x221e4c[_0xf3a1('0x4a')]['id']}})[_0xf3a1('0x26')](handleEntityNotFound(_0x53bc6d,null))[_0xf3a1('0x26')](function(_0xc8e655){if(_0xc8e655){_0x221e4c['body'][_0xf3a1('0x57')]=_0xc8e655['id'];return db[_0xf3a1('0x56')][_0xf3a1('0x4c')](_0x221e4c[_0xf3a1('0x53')]);}})[_0xf3a1('0x26')](respondWithResult(_0x53bc6d,null))[_0xf3a1('0x48')](handleError(_0x53bc6d,null));};exports[_0xf3a1('0x58')]=function(_0xa90810,_0x19f07b,_0x4c3d18){var _0x47a330={};var _0x5ef6e5={};var _0x1292c3;var _0x1f8518;return db['Trigger']['findOne']({'where':{'id':_0xa90810[_0xf3a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x19f07b,null))['then'](function(_0x5a1223){if(_0x5a1223){_0x1292c3=_0x5a1223;_0x5ef6e5[_0xf3a1('0x30')]=_[_0xf3a1('0x32')](db[_0xf3a1('0x56')]['rawAttributes']);_0x5ef6e5[_0xf3a1('0x33')]=_[_0xf3a1('0x32')](_0xa90810[_0xf3a1('0x33')]);_0x5ef6e5['filters']=_['intersection'](_0x5ef6e5['model'],_0x5ef6e5[_0xf3a1('0x33')]);_0x47a330[_0xf3a1('0x35')]=_['intersection'](_0x5ef6e5[_0xf3a1('0x30')],qs[_0xf3a1('0x36')](_0xa90810['query'][_0xf3a1('0x36')]));_0x47a330['attributes']=_0x47a330[_0xf3a1('0x35')]['length']?_0x47a330[_0xf3a1('0x35')]:_0x5ef6e5['model'];_0x47a330[_0xf3a1('0x3a')]=qs[_0xf3a1('0x3b')](_0xa90810[_0xf3a1('0x33')][_0xf3a1('0x3b')]);_0x47a330[_0xf3a1('0x3c')]=qs[_0xf3a1('0x3d')](_[_0xf3a1('0x3e')](_0xa90810[_0xf3a1('0x33')],_0x5ef6e5[_0xf3a1('0x3d')]));if(_0xa90810['query'][_0xf3a1('0x3f')]){_0x47a330['where']=_[_0xf3a1('0x42')](_0x47a330['where'],{'$or':_[_0xf3a1('0x2e')](_0x47a330[_0xf3a1('0x35')],function(_0x149d3d){var _0x2abe55={};_0x2abe55[_0x149d3d]={'$like':'%'+_0xa90810[_0xf3a1('0x33')][_0xf3a1('0x3f')]+'%'};return _0x2abe55;})});}_0x47a330=_[_0xf3a1('0x42')]({},_0x47a330,_0xa90810[_0xf3a1('0x43')]);return _0x1292c3['getAllConditions'](_0x47a330);}})[_0xf3a1('0x26')](function(_0xdf24a8){if(_0xdf24a8){_0x1f8518=_0xdf24a8[_0xf3a1('0x37')];if(!_0xa90810[_0xf3a1('0x33')][_0xf3a1('0x38')](_0xf3a1('0x39'))){_0x47a330[_0xf3a1('0x1d')]=qs['limit'](_0xa90810['query'][_0xf3a1('0x1d')]);_0x47a330['offset']=qs[_0xf3a1('0x1b')](_0xa90810[_0xf3a1('0x33')]['offset']);}return _0x1292c3[_0xf3a1('0x58')](_0x47a330);}})[_0xf3a1('0x26')](function(_0x28e612){if(_0x28e612){return _0x28e612?{'count':_0x1f8518,'rows':_0x28e612}:null;}})[_0xf3a1('0x26')](respondWithResult(_0x19f07b,null))[_0xf3a1('0x48')](handleError(_0x19f07b,null));};exports[_0xf3a1('0x59')]=function(_0x1d617e,_0x2d416b,_0x56fc70){var _0x27d91a={};var _0x35b4c1={};var _0x1d9b3e;var _0x2a9d37;return db[_0xf3a1('0x44')][_0xf3a1('0x5a')]({'where':{'id':_0x1d617e['params']['id']}})['then'](handleEntityNotFound(_0x2d416b,null))[_0xf3a1('0x26')](function(_0x53c62b){if(_0x53c62b){_0x1d9b3e=_0x53c62b;_0x35b4c1[_0xf3a1('0x30')]=_[_0xf3a1('0x32')](db[_0xf3a1('0x56')][_0xf3a1('0x5b')]);_0x35b4c1[_0xf3a1('0x33')]=_[_0xf3a1('0x32')](_0x1d617e['query']);_0x35b4c1[_0xf3a1('0x3d')]=_[_0xf3a1('0x34')](_0x35b4c1['model'],_0x35b4c1[_0xf3a1('0x33')]);_0x27d91a['attributes']=_[_0xf3a1('0x34')](_0x35b4c1[_0xf3a1('0x30')],qs[_0xf3a1('0x36')](_0x1d617e[_0xf3a1('0x33')][_0xf3a1('0x36')]));_0x27d91a[_0xf3a1('0x35')]=_0x27d91a[_0xf3a1('0x35')][_0xf3a1('0x37')]?_0x27d91a[_0xf3a1('0x35')]:_0x35b4c1[_0xf3a1('0x30')];_0x27d91a[_0xf3a1('0x3a')]=qs['sort'](_0x1d617e['query'][_0xf3a1('0x3b')]);_0x27d91a['where']=qs[_0xf3a1('0x3d')](_['pick'](_0x1d617e['query'],_0x35b4c1[_0xf3a1('0x3d')]));if(_0x1d617e[_0xf3a1('0x33')][_0xf3a1('0x3f')]){_0x27d91a[_0xf3a1('0x3c')]=_[_0xf3a1('0x42')](_0x27d91a[_0xf3a1('0x3c')],{'$or':_[_0xf3a1('0x2e')](_0x27d91a[_0xf3a1('0x35')],function(_0x352b96){var _0x127221={};_0x127221[_0x352b96]={'$like':'%'+_0x1d617e[_0xf3a1('0x33')][_0xf3a1('0x3f')]+'%'};return _0x127221;})});}_0x27d91a=_[_0xf3a1('0x42')]({},_0x27d91a,_0x1d617e['options']);return _0x1d9b3e[_0xf3a1('0x59')](_0x27d91a);}})[_0xf3a1('0x26')](function(_0x5aaa50){if(_0x5aaa50){_0x2a9d37=_0x5aaa50['length'];if(!_0x1d617e[_0xf3a1('0x33')]['hasOwnProperty'](_0xf3a1('0x39'))){_0x27d91a[_0xf3a1('0x1d')]=qs[_0xf3a1('0x1d')](_0x1d617e[_0xf3a1('0x33')][_0xf3a1('0x1d')]);_0x27d91a[_0xf3a1('0x1b')]=qs[_0xf3a1('0x1b')](_0x1d617e[_0xf3a1('0x33')][_0xf3a1('0x1b')]);}return _0x1d9b3e[_0xf3a1('0x59')](_0x27d91a);}})['then'](function(_0x54eef8){if(_0x54eef8){return _0x54eef8?{'count':_0x2a9d37,'rows':_0x54eef8}:null;}})['then'](respondWithResult(_0x2d416b,null))[_0xf3a1('0x48')](handleError(_0x2d416b,null));};exports['addAction']=function(_0x46a5e7,_0x207e2a,_0x4511bf){if(_0x46a5e7[_0xf3a1('0x53')]['id']){delete _0x46a5e7[_0xf3a1('0x53')]['id'];}return db[_0xf3a1('0x44')][_0xf3a1('0x4b')]({'where':{'id':_0x46a5e7[_0xf3a1('0x4a')]['id']}})[_0xf3a1('0x26')](handleEntityNotFound(_0x207e2a,null))[_0xf3a1('0x26')](function(_0xd12a35){if(_0xd12a35){_0x46a5e7[_0xf3a1('0x53')][_0xf3a1('0x5c')]=_0xd12a35['id'];return db[_0xf3a1('0x5d')][_0xf3a1('0x4c')](_0x46a5e7['body']);}})['then'](respondWithResult(_0x207e2a,null))[_0xf3a1('0x48')](handleError(_0x207e2a,null));};exports['getActions']=function(_0x226deb,_0x2cc9bc,_0x89d0fc){var _0x782517={};var _0x2d905f={};var _0x1731f0;var _0x172cb3;return db[_0xf3a1('0x44')][_0xf3a1('0x5a')]({'where':{'id':_0x226deb[_0xf3a1('0x4a')]['id']}})[_0xf3a1('0x26')](handleEntityNotFound(_0x2cc9bc,null))['then'](function(_0x56a2f8){if(_0x56a2f8){_0x1731f0=_0x56a2f8;_0x2d905f['model']=_[_0xf3a1('0x32')](db['Action'][_0xf3a1('0x5b')]);_0x2d905f[_0xf3a1('0x33')]=_[_0xf3a1('0x32')](_0x226deb[_0xf3a1('0x33')]);_0x2d905f[_0xf3a1('0x3d')]=_[_0xf3a1('0x34')](_0x2d905f['model'],_0x2d905f['query']);_0x782517[_0xf3a1('0x35')]=_[_0xf3a1('0x34')](_0x2d905f[_0xf3a1('0x30')],qs[_0xf3a1('0x36')](_0x226deb['query'][_0xf3a1('0x36')]));_0x782517[_0xf3a1('0x35')]=_0x782517[_0xf3a1('0x35')][_0xf3a1('0x37')]?_0x782517[_0xf3a1('0x35')]:_0x2d905f[_0xf3a1('0x30')];_0x782517['order']=qs['sort'](_0x226deb[_0xf3a1('0x33')][_0xf3a1('0x3b')]);_0x782517[_0xf3a1('0x3c')]=qs[_0xf3a1('0x3d')](_[_0xf3a1('0x3e')](_0x226deb['query'],_0x2d905f[_0xf3a1('0x3d')]));if(_0x226deb['query'][_0xf3a1('0x3f')]){_0x782517['where']=_['merge'](_0x782517[_0xf3a1('0x3c')],{'$or':_['map'](_0x782517[_0xf3a1('0x35')],function(_0x54119d){var _0x38e51e={};_0x38e51e[_0x54119d]={'$like':'%'+_0x226deb[_0xf3a1('0x33')][_0xf3a1('0x3f')]+'%'};return _0x38e51e;})});}_0x782517=_[_0xf3a1('0x42')]({},_0x782517,_0x226deb[_0xf3a1('0x43')]);return _0x1731f0['getActions'](_0x782517);}})['then'](function(_0x289df1){if(_0x289df1){_0x172cb3=_0x289df1[_0xf3a1('0x37')];if(!_0x226deb[_0xf3a1('0x33')][_0xf3a1('0x38')](_0xf3a1('0x39'))){_0x782517[_0xf3a1('0x1d')]=qs[_0xf3a1('0x1d')](_0x226deb[_0xf3a1('0x33')][_0xf3a1('0x1d')]);_0x782517[_0xf3a1('0x1b')]=qs['offset'](_0x226deb['query'][_0xf3a1('0x1b')]);}return _0x1731f0[_0xf3a1('0x5e')](_0x782517);}})[_0xf3a1('0x26')](function(_0x345572){if(_0x345572){return _0x345572?{'count':_0x172cb3,'rows':_0x345572}:null;}})[_0xf3a1('0x26')](respondWithResult(_0x2cc9bc,null))[_0xf3a1('0x48')](handleError(_0x2cc9bc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 497cec9..527d80b 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 _0x9658=['tools_triggers','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','define','Trigger'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x9658,0x6f));var _0x8965=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x9658[_0x8a7e38];return _0x228609;};'use strict';var _=require(_0x8965('0x0'));var util=require('util');var logger=require(_0x8965('0x1'))(_0x8965('0x2'));var moment=require('moment');var BPromise=require(_0x8965('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8965('0x4'));var rimraf=require(_0x8965('0x5'));var config=require(_0x8965('0x6'));var attributes=require('./trigger.attributes');module[_0x8965('0x7')]=function(_0x20493e,_0x1d0745){return _0x20493e[_0x8965('0x8')](_0x8965('0x9'),attributes,{'tableName':_0x8965('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf675=['Trigger','tools_triggers','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./trigger.attributes','exports'];(function(_0x25f721,_0x438d26){var _0x5c612e=function(_0x25ff68){while(--_0x25ff68){_0x25f721['push'](_0x25f721['shift']());}};_0x5c612e(++_0x438d26);}(_0xf675,0x199));var _0x5f67=function(_0x6622a2,_0x401a17){_0x6622a2=_0x6622a2-0x0;var _0x52252e=_0xf675[_0x6622a2];return _0x52252e;};'use strict';var _=require(_0x5f67('0x0'));var util=require(_0x5f67('0x1'));var logger=require(_0x5f67('0x2'))('api');var moment=require(_0x5f67('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f67('0x4'));var fs=require('fs');var path=require(_0x5f67('0x5'));var rimraf=require(_0x5f67('0x6'));var config=require('../../config/environment');var attributes=require(_0x5f67('0x7'));module[_0x5f67('0x8')]=function(_0x2919cc,_0xd4b727){return _0x2919cc['define'](_0x5f67('0x9'),attributes,{'tableName':_0x5f67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 34a6836..7956528 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 _0x16e7=['info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2faeb9,_0x5aaa9b){var _0x41e536=function(_0x3f9caf){while(--_0x3f9caf){_0x2faeb9['push'](_0x2faeb9['shift']());}};_0x41e536(++_0x5aaa9b);}(_0x16e7,0x82));var _0x716e=function(_0xd1f817,_0x5a5bb4){_0xd1f817=_0xd1f817-0x0;var _0xecbb25=_0x16e7[_0xd1f817];return _0xecbb25;};'use strict';var _=require('lodash');var util=require(_0x716e('0x0'));var moment=require(_0x716e('0x1'));var BPromise=require(_0x716e('0x2'));var rs=require(_0x716e('0x3'));var fs=require('fs');var Redis=require(_0x716e('0x4'));var db=require(_0x716e('0x5'))['db'];var utils=require(_0x716e('0x6'));var logger=require(_0x716e('0x7'))(_0x716e('0x8'));var config=require(_0x716e('0x9'));var jayson=require(_0x716e('0xa'));var client=jayson['client'][_0x716e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ebccd,_0x2a7bbb,_0x49ed40){return new BPromise(function(_0x231cbc,_0x2984a1){return client[_0x716e('0xc')](_0x4ebccd,_0x49ed40)[_0x716e('0xd')](function(_0x46edc4){logger[_0x716e('0xe')](_0x716e('0xf'),_0x2a7bbb,_0x716e('0x10'));logger[_0x716e('0x11')](_0x716e('0x12'),_0x2a7bbb,'request\x20sent',JSON[_0x716e('0x13')](_0x46edc4));if(_0x46edc4[_0x716e('0x14')]){if(_0x46edc4['error'][_0x716e('0x15')]===0x1f4){logger['error'](_0x716e('0xf'),_0x2a7bbb,_0x46edc4['error'][_0x716e('0x16')]);return _0x2984a1(_0x46edc4[_0x716e('0x14')][_0x716e('0x16')]);}logger[_0x716e('0x14')]('Trigger,\x20%s,\x20%s',_0x2a7bbb,_0x46edc4['error'][_0x716e('0x16')]);return _0x231cbc(_0x46edc4['error'][_0x716e('0x16')]);}else{logger[_0x716e('0xe')](_0x716e('0xf'),_0x2a7bbb,'request\x20sent');_0x231cbc(_0x46edc4['result'][_0x716e('0x16')]);}})[_0x716e('0x17')](function(_0x5b9fdd){logger[_0x716e('0x14')](_0x716e('0xf'),_0x2a7bbb,_0x5b9fdd);_0x2984a1(_0x5b9fdd);});});}exports[_0x716e('0x18')]=function(_0x246c84){var _0x49c16f=this;return new Promise(function(_0x13880a,_0xfa7e28){return db[_0x716e('0x19')][_0x716e('0x1a')]({'raw':_0x246c84[_0x716e('0x1b')]?_0x246c84[_0x716e('0x1b')][_0x716e('0x1c')]===undefined?!![]:![]:!![],'where':_0x246c84[_0x716e('0x1b')]?_0x246c84[_0x716e('0x1b')][_0x716e('0x1d')]||null:null,'attributes':_0x246c84[_0x716e('0x1b')]?_0x246c84[_0x716e('0x1b')][_0x716e('0x1e')]||null:null,'limit':_0x246c84[_0x716e('0x1b')]?_0x246c84[_0x716e('0x1b')][_0x716e('0x1f')]||null:null,'include':_0x246c84[_0x716e('0x1b')]?_0x246c84['options'][_0x716e('0x20')]?_[_0x716e('0x21')](_0x246c84['options'][_0x716e('0x20')],function(_0x464cb9){return{'model':db[_0x464cb9['model']],'as':_0x464cb9['as'],'attributes':_0x464cb9['attributes'],'include':_0x464cb9[_0x716e('0x20')]?_[_0x716e('0x21')](_0x464cb9[_0x716e('0x20')],function(_0x82b5ef){return{'model':db[_0x82b5ef[_0x716e('0x22')]],'as':_0x82b5ef['as'],'attributes':_0x82b5ef[_0x716e('0x1e')],'include':_0x82b5ef[_0x716e('0x20')]?_[_0x716e('0x21')](_0x82b5ef[_0x716e('0x20')],function(_0x2fc242){return{'model':db[_0x2fc242[_0x716e('0x22')]],'as':_0x2fc242['as'],'attributes':_0x2fc242[_0x716e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x716e('0xd')](function(_0x3da554){logger[_0x716e('0xe')](_0x716e('0x18'),_0x246c84);logger[_0x716e('0x11')]('GetTrigger',_0x246c84,JSON['stringify'](_0x3da554));_0x13880a(_0x3da554);})['catch'](function(_0x11a1ed){logger['error'](_0x716e('0x18'),_0x11a1ed[_0x716e('0x16')],_0x246c84);_0xfa7e28(_0x49c16f[_0x716e('0x14')](0x1f4,_0x11a1ed[_0x716e('0x16')]));});});};exports[_0x716e('0x23')]=function(_0x5141b5){var _0x5ccaad=this;return new Promise(function(_0x32b8af,_0x5f3893){return db[_0x716e('0x19')]['find']({'raw':_0x5141b5['options']?_0x5141b5[_0x716e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5141b5['options']?_0x5141b5[_0x716e('0x1b')][_0x716e('0x1d')]||null:null,'attributes':_0x5141b5['options']?_0x5141b5[_0x716e('0x1b')][_0x716e('0x1e')]||null:null,'include':_0x5141b5[_0x716e('0x1b')]?_0x5141b5[_0x716e('0x1b')][_0x716e('0x20')]?_[_0x716e('0x21')](_0x5141b5['options'][_0x716e('0x20')],function(_0x4be3d6){return{'model':db[_0x4be3d6[_0x716e('0x22')]],'as':_0x4be3d6['as'],'attributes':_0x4be3d6['attributes'],'include':_0x4be3d6['include']?_[_0x716e('0x21')](_0x4be3d6['include'],function(_0x257601){return{'model':db[_0x257601[_0x716e('0x22')]],'as':_0x257601['as'],'attributes':_0x257601[_0x716e('0x1e')],'include':_0x257601[_0x716e('0x20')]?_['map'](_0x257601[_0x716e('0x20')],function(_0x5b2f15){return{'model':db[_0x5b2f15[_0x716e('0x22')]],'as':_0x5b2f15['as'],'attributes':_0x5b2f15['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf10de1){logger['info'](_0x716e('0x23'),_0x5141b5);logger['debug'](_0x716e('0x23'),_0x5141b5,JSON['stringify'](_0xf10de1));_0x32b8af(_0xf10de1);})[_0x716e('0x17')](function(_0x46911e){logger['error'](_0x716e('0x23'),_0x46911e[_0x716e('0x16')],_0x5141b5);_0x5f3893(_0x5ccaad['error'](0x1f4,_0x46911e[_0x716e('0x16')]));});});}; \ No newline at end of file +var _0xa640=['request','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Trigger','findAll','options','attributes','limit','include','map','model','then','GetTrigger','debug','ShowTrigger','find','raw','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x188703,_0x596b26){var _0x1a0c81=function(_0x1cd22d){while(--_0x1cd22d){_0x188703['push'](_0x188703['shift']());}};_0x1a0c81(++_0x596b26);}(_0xa640,0x89));var _0x0a64=function(_0x221501,_0x7b86f4){_0x221501=_0x221501-0x0;var _0x3a66cc=_0xa640[_0x221501];return _0x3a66cc;};'use strict';var _=require(_0x0a64('0x0'));var util=require(_0x0a64('0x1'));var moment=require(_0x0a64('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a64('0x3'));var db=require(_0x0a64('0x4'))['db'];var utils=require(_0x0a64('0x5'));var logger=require(_0x0a64('0x6'))(_0x0a64('0x7'));var config=require(_0x0a64('0x8'));var jayson=require(_0x0a64('0x9'));var client=jayson[_0x0a64('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x201729,_0x58ab5e,_0x5c5b43){return new BPromise(function(_0x3974b0,_0x199352){return client[_0x0a64('0xb')](_0x201729,_0x5c5b43)['then'](function(_0x110eeb){logger[_0x0a64('0xc')](_0x0a64('0xd'),_0x58ab5e,'request\x20sent');logger['debug'](_0x0a64('0xe'),_0x58ab5e,_0x0a64('0xf'),JSON[_0x0a64('0x10')](_0x110eeb));if(_0x110eeb['error']){if(_0x110eeb[_0x0a64('0x11')][_0x0a64('0x12')]===0x1f4){logger[_0x0a64('0x11')](_0x0a64('0xd'),_0x58ab5e,_0x110eeb[_0x0a64('0x11')][_0x0a64('0x13')]);return _0x199352(_0x110eeb[_0x0a64('0x11')][_0x0a64('0x13')]);}logger['error'](_0x0a64('0xd'),_0x58ab5e,_0x110eeb[_0x0a64('0x11')]['message']);return _0x3974b0(_0x110eeb['error'][_0x0a64('0x13')]);}else{logger['info'](_0x0a64('0xd'),_0x58ab5e,_0x0a64('0xf'));_0x3974b0(_0x110eeb[_0x0a64('0x14')][_0x0a64('0x13')]);}})[_0x0a64('0x15')](function(_0xa4296){logger['error'](_0x0a64('0xd'),_0x58ab5e,_0xa4296);_0x199352(_0xa4296);});});}exports['GetTrigger']=function(_0x4dcb2c){var _0xb503d2=this;return new Promise(function(_0x2b5ebe,_0x4654ae){return db[_0x0a64('0x16')][_0x0a64('0x17')]({'raw':_0x4dcb2c['options']?_0x4dcb2c[_0x0a64('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4dcb2c[_0x0a64('0x18')]?_0x4dcb2c[_0x0a64('0x18')]['where']||null:null,'attributes':_0x4dcb2c[_0x0a64('0x18')]?_0x4dcb2c[_0x0a64('0x18')][_0x0a64('0x19')]||null:null,'limit':_0x4dcb2c['options']?_0x4dcb2c['options'][_0x0a64('0x1a')]||null:null,'include':_0x4dcb2c[_0x0a64('0x18')]?_0x4dcb2c[_0x0a64('0x18')][_0x0a64('0x1b')]?_[_0x0a64('0x1c')](_0x4dcb2c[_0x0a64('0x18')][_0x0a64('0x1b')],function(_0x2daf68){return{'model':db[_0x2daf68[_0x0a64('0x1d')]],'as':_0x2daf68['as'],'attributes':_0x2daf68['attributes'],'include':_0x2daf68[_0x0a64('0x1b')]?_[_0x0a64('0x1c')](_0x2daf68[_0x0a64('0x1b')],function(_0x574590){return{'model':db[_0x574590[_0x0a64('0x1d')]],'as':_0x574590['as'],'attributes':_0x574590[_0x0a64('0x19')],'include':_0x574590[_0x0a64('0x1b')]?_[_0x0a64('0x1c')](_0x574590[_0x0a64('0x1b')],function(_0x77c33b){return{'model':db[_0x77c33b['model']],'as':_0x77c33b['as'],'attributes':_0x77c33b[_0x0a64('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0a64('0x1e')](function(_0x25f1e7){logger['info'](_0x0a64('0x1f'),_0x4dcb2c);logger[_0x0a64('0x20')](_0x0a64('0x1f'),_0x4dcb2c,JSON['stringify'](_0x25f1e7));_0x2b5ebe(_0x25f1e7);})[_0x0a64('0x15')](function(_0x268b45){logger[_0x0a64('0x11')](_0x0a64('0x1f'),_0x268b45[_0x0a64('0x13')],_0x4dcb2c);_0x4654ae(_0xb503d2[_0x0a64('0x11')](0x1f4,_0x268b45['message']));});});};exports[_0x0a64('0x21')]=function(_0xf606ff){var _0x27f0b8=this;return new Promise(function(_0x22b05f,_0x2d5318){return db['Trigger'][_0x0a64('0x22')]({'raw':_0xf606ff[_0x0a64('0x18')]?_0xf606ff[_0x0a64('0x18')][_0x0a64('0x23')]===undefined?!![]:![]:!![],'where':_0xf606ff['options']?_0xf606ff[_0x0a64('0x18')][_0x0a64('0x24')]||null:null,'attributes':_0xf606ff[_0x0a64('0x18')]?_0xf606ff[_0x0a64('0x18')][_0x0a64('0x19')]||null:null,'include':_0xf606ff['options']?_0xf606ff['options'][_0x0a64('0x1b')]?_['map'](_0xf606ff[_0x0a64('0x18')][_0x0a64('0x1b')],function(_0xb1f28f){return{'model':db[_0xb1f28f[_0x0a64('0x1d')]],'as':_0xb1f28f['as'],'attributes':_0xb1f28f[_0x0a64('0x19')],'include':_0xb1f28f[_0x0a64('0x1b')]?_[_0x0a64('0x1c')](_0xb1f28f['include'],function(_0x7fbd1d){return{'model':db[_0x7fbd1d[_0x0a64('0x1d')]],'as':_0x7fbd1d['as'],'attributes':_0x7fbd1d['attributes'],'include':_0x7fbd1d['include']?_[_0x0a64('0x1c')](_0x7fbd1d[_0x0a64('0x1b')],function(_0x579e44){return{'model':db[_0x579e44[_0x0a64('0x1d')]],'as':_0x579e44['as'],'attributes':_0x579e44['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a64('0x1e')](function(_0x2f69ba){logger[_0x0a64('0xc')](_0x0a64('0x21'),_0xf606ff);logger['debug'](_0x0a64('0x21'),_0xf606ff,JSON[_0x0a64('0x10')](_0x2f69ba));_0x22b05f(_0x2f69ba);})['catch'](function(_0x3d1fe0){logger[_0x0a64('0x11')](_0x0a64('0x21'),_0x3d1fe0[_0x0a64('0x13')],_0xf606ff);_0x2d5318(_0x27f0b8[_0x0a64('0x11')](0x1f4,_0x3d1fe0['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index dbcdb41..52647ba 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 _0x82b4=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone'];(function(_0x11a372,_0x40c65e){var _0x44c18b=function(_0x5a5a5f){while(--_0x5a5a5f){_0x11a372['push'](_0x11a372['shift']());}};_0x44c18b(++_0x40c65e);}(_0x82b4,0x1bd));var _0x482b=function(_0x7e38e1,_0x35e8b9){_0x7e38e1=_0x7e38e1-0x0;var _0x2eecfe=_0x82b4[_0x7e38e1];return _0x2eecfe;};'use strict';var multer=require('multer');var util=require(_0x482b('0x0'));var path=require(_0x482b('0x1'));var timeout=require(_0x482b('0x2'));var express=require(_0x482b('0x3'));var router=express[_0x482b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x482b('0x5'));var interaction=require(_0x482b('0x6'));var config=require(_0x482b('0x7'));var controller=require(_0x482b('0x8'));router[_0x482b('0x9')]('/',auth[_0x482b('0xa')](),controller[_0x482b('0xb')]);router[_0x482b('0x9')](_0x482b('0xc'),auth[_0x482b('0xa')](),controller[_0x482b('0xd')]);router[_0x482b('0xe')](_0x482b('0xf'),auth['isAuthenticated'](),controller[_0x482b('0x10')]);router[_0x482b('0xe')]('/',auth['isAuthenticated'](),controller[_0x482b('0x11')]);router[_0x482b('0x12')]('/:id',auth[_0x482b('0xa')](),controller[_0x482b('0x13')]);router['delete']('/:id',auth[_0x482b('0xa')](),controller[_0x482b('0x14')]);module[_0x482b('0x15')]=router; \ No newline at end of file +var _0xca7e=['clone','create','update','delete','destroy','exports','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca7e,0x1e1));var _0xeca7=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xca7e[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xeca7('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeca7('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xeca7('0x2'));var interaction=require(_0xeca7('0x3'));var config=require(_0xeca7('0x4'));var controller=require(_0xeca7('0x5'));router[_0xeca7('0x6')]('/',auth[_0xeca7('0x7')](),controller[_0xeca7('0x8')]);router[_0xeca7('0x6')](_0xeca7('0x9'),auth[_0xeca7('0x7')](),controller[_0xeca7('0xa')]);router[_0xeca7('0xb')](_0xeca7('0xc'),auth[_0xeca7('0x7')](),controller[_0xeca7('0xd')]);router[_0xeca7('0xb')]('/',auth['isAuthenticated'](),controller[_0xeca7('0xe')]);router['put']('/:id',auth[_0xeca7('0x7')](),controller[_0xeca7('0xf')]);router[_0xeca7('0x10')](_0xeca7('0x9'),auth[_0xeca7('0x7')](),controller[_0xeca7('0x11')]);module[_0xeca7('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6433762..e73056a 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 _0x7329=['ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','insecure','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','peer','friend','from-voip-provider'];(function(_0x3ba5a4,_0x1ab3a2){var _0x361851=function(_0x2711bb){while(--_0x2711bb){_0x3ba5a4['push'](_0x3ba5a4['shift']());}};_0x361851(++_0x1ab3a2);}(_0x7329,0xc4));var _0x9732=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x7329[_0x1314d4];return _0x584ba5;};'use strict';var Sequelize=require(_0x9732('0x0'));module[_0x9732('0x1')]={'name':{'type':Sequelize[_0x9732('0x2')],'allowNull':![],'unique':_0x9732('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9732('0x4')]('friend','user',_0x9732('0x5')),'allowNull':![],'defaultValue':_0x9732('0x6')},'context':{'type':Sequelize[_0x9732('0x2')],'allowNull':![],'defaultValue':_0x9732('0x7')},'callingpres':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x8'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x9732('0x9'),_0x9732('0xa'),_0x9732('0xb'),'PROHIB_FAILED_SCREEN',_0x9732('0xc'))},'deny':{'type':Sequelize[_0x9732('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x9732('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x9732('0x2')]},'transport':{'type':Sequelize[_0x9732('0x2')],'defaultValue':_0x9732('0xd'),'set':function(_0x426d3f){this[_0x9732('0xe')](_0x9732('0xf'),_0x426d3f?_0x426d3f[_0x9732('0x10')](','):null);},'get':function(){return this[_0x9732('0x11')](_0x9732('0xf'))?this[_0x9732('0x11')](_0x9732('0xf'))['split'](','):null;},'comment':_0x9732('0x12')},'dtmfmode':{'type':Sequelize[_0x9732('0x4')]('rfc2833',_0x9732('0x13'),'shortinfo',_0x9732('0x14'),_0x9732('0x15')),'defaultValue':_0x9732('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0x9732('0x17'),'no',_0x9732('0x18'),_0x9732('0x19'),_0x9732('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9732('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9732('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x9732('0x2')],'defaultValue':_0x9732('0x1b'),'set':function(_0x4311b3){this[_0x9732('0xe')](_0x9732('0x1c'),_0x4311b3?_0x4311b3[_0x9732('0x10')](','):null);},'get':function(){return this[_0x9732('0x11')](_0x9732('0x1c'))?this[_0x9732('0x11')](_0x9732('0x1c'))[_0x9732('0x1d')](','):null;},'comment':_0x9732('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x9732('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x9732('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x9732('0x2')],'defaultValue':_0x9732('0x1f')},'allow':{'type':Sequelize[_0x9732('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x9e69cb){this[_0x9732('0xe')](_0x9732('0x20'),_0x9e69cb?_0x9e69cb[_0x9732('0x10')](';'):_0x9732('0x21'));},'get':function(){return this['getDataValue']('allow')?this[_0x9732('0x11')]('allow')[_0x9732('0x1d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'insecure':{'type':Sequelize[_0x9732('0x2')],'defaultValue':_0x9732('0x22'),'set':function(_0xb58170){this[_0x9732('0xe')](_0x9732('0x23'),_0xb58170?_0xb58170['join'](','):null);},'get':function(){return this[_0x9732('0x11')](_0x9732('0x23'))?this['getDataValue'](_0x9732('0x23'))[_0x9732('0x1d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x9732('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no','never')},'promiscredir':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'useclientcode':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9732('0x2')],'defaultValue':_0x9732('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no'),'defaultValue':_0x9732('0x17')},'busylevel':{'type':Sequelize[_0x9732('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x9732('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x9732('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x9732('0x2')]},'template':{'type':Sequelize[_0x9732('0x2')]},'videosupport':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no',_0x9732('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'mailbox':{'type':Sequelize[_0x9732('0x2')]},'session_timers':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x27'),_0x9732('0x28'),_0x9732('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x9732('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x9732('0x2a')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x9732('0x2')]},'regexten':{'type':Sequelize[_0x9732('0x2')]},'fromdomain':{'type':Sequelize[_0x9732('0x2')]},'fromuser':{'type':Sequelize[_0x9732('0x2')]},'port':{'type':Sequelize[_0x9732('0x25')](0x5)},'qualify':{'type':Sequelize[_0x9732('0x4')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x9732('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x9732('0x2')]},'defaultuser':{'type':Sequelize[_0x9732('0x2')]},'rtptimeout':{'type':Sequelize[_0x9732('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x9732('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x9732('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no',_0x9732('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9732('0x2')]},'callbackextension':{'type':Sequelize[_0x9732('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x9732('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x9732('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x9732('0x2')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x9732('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x9732('0x2')]},'maxforwards':{'type':Sequelize[_0x9732('0x25')](0xb)},'encryption':{'type':Sequelize[_0x9732('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x9732('0x17'),'no')},'force_avp':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'icesupport':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x9732('0x4')]('yes','no','fingerprint',_0x9732('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x9732('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x9732('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x9732('0x2')]},'dtlscipher':{'type':Sequelize[_0x9732('0x2')]},'dtlscafile':{'type':Sequelize[_0x9732('0x2')]},'dtlscapath':{'type':Sequelize[_0x9732('0x2')]},'dtlssetup':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x2d'),_0x9732('0x2e'),_0x9732('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x9732('0x2')]},'usereqphone':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9732('0x2')]},'recordofffeature':{'type':Sequelize[_0x9732('0x2')]},'call_limit':{'type':Sequelize[_0x9732('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x9732('0x2')]},'parkinglot':{'type':Sequelize[_0x9732('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x9732('0x30')},'canreinvite':{'type':Sequelize[_0x9732('0x4')](_0x9732('0x17'),'no',_0x9732('0x18'),_0x9732('0x19'),_0x9732('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x9732('0x2')]},'otherFields':{'type':Sequelize[_0x9732('0x2')]},'active':{'type':Sequelize[_0x9732('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x9732('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x1705=['ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','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','always','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update','update,nonat','BOOLEAN','exports','STRING','name'];(function(_0x45b2ce,_0x449f86){var _0x5ea47b=function(_0x2a5580){while(--_0x2a5580){_0x45b2ce['push'](_0x45b2ce['shift']());}};_0x5ea47b(++_0x449f86);}(_0x1705,0x177));var _0x5170=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x1705[_0x1663ae];return _0x30ffb8;};'use strict';var Sequelize=require('sequelize');module[_0x5170('0x0')]={'name':{'type':Sequelize[_0x5170('0x1')],'allowNull':![],'unique':_0x5170('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x4'),_0x5170('0x5'),_0x5170('0x6')),'allowNull':![],'defaultValue':_0x5170('0x4')},'context':{'type':Sequelize[_0x5170('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x7'),_0x5170('0x8'),_0x5170('0x9'),_0x5170('0xa'),_0x5170('0xb'),_0x5170('0xc'),_0x5170('0xd'),_0x5170('0xe'))},'deny':{'type':Sequelize[_0x5170('0x1')]},'permit':{'type':Sequelize[_0x5170('0x1')]},'secret':{'type':Sequelize[_0x5170('0x1')]},'md5secret':{'type':Sequelize[_0x5170('0x1')]},'remotesecret':{'type':Sequelize[_0x5170('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x5170('0xf'),'set':function(_0x247a42){this[_0x5170('0x10')](_0x5170('0x11'),_0x247a42?_0x247a42[_0x5170('0x12')](','):null);},'get':function(){return this[_0x5170('0x13')]('transport')?this[_0x5170('0x13')](_0x5170('0x11'))[_0x5170('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x15'),_0x5170('0x16'),_0x5170('0x17'),_0x5170('0x18'),_0x5170('0x19')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no',_0x5170('0x1b'),'update',_0x5170('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5170('0x1')]},'directmediadeny':{'type':Sequelize[_0x5170('0x1')]},'nat':{'type':Sequelize[_0x5170('0x1')],'defaultValue':_0x5170('0x1d'),'set':function(_0x24d929){this[_0x5170('0x10')](_0x5170('0x1e'),_0x24d929?_0x24d929[_0x5170('0x12')](','):null);},'get':function(){return this['getDataValue'](_0x5170('0x1e'))?this[_0x5170('0x13')](_0x5170('0x1e'))[_0x5170('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x5170('0x1')]},'namedcallgroup':{'type':Sequelize[_0x5170('0x1')]},'pickupgroup':{'type':Sequelize[_0x5170('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x5170('0x1')]},'language':{'type':Sequelize[_0x5170('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5170('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x5170('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5170('0x1f'),'set':function(_0x3882f9){this['setDataValue'](_0x5170('0x20'),_0x3882f9?_0x3882f9[_0x5170('0x12')](';'):_0x5170('0x1f'));},'get':function(){return this[_0x5170('0x13')](_0x5170('0x20'))?this[_0x5170('0x13')](_0x5170('0x20'))[_0x5170('0x14')](';'):null;},'comment':_0x5170('0x21')},'autoframing':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'insecure':{'type':Sequelize[_0x5170('0x1')],'defaultValue':_0x5170('0x22'),'set':function(_0x439212){this[_0x5170('0x10')](_0x5170('0x23'),_0x439212?_0x439212['join'](','):null);},'get':function(){return this[_0x5170('0x13')](_0x5170('0x23'))?this[_0x5170('0x13')](_0x5170('0x23'))[_0x5170('0x14')](','):null;},'comment':_0x5170('0x24')},'trustrpid':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no',_0x5170('0x25'))},'promiscredir':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x5170('0x26')](0xb)},'setvar':{'type':Sequelize[_0x5170('0x1')]},'callerid':{'type':Sequelize[_0x5170('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x5170('0x1')]},'callcounter':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no'),'defaultValue':_0x5170('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x5170('0x3')]('yes','no')},'allowsubscribe':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x5170('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no',_0x5170('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x5170('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x5170('0x1')]},'session_timers':{'type':Sequelize[_0x5170('0x3')]('accept',_0x5170('0x28'),_0x5170('0x29'))},'session_expires':{'type':Sequelize[_0x5170('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x5170('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x2a'),'uas'),'defaultValue':_0x5170('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x5170('0x1')]},'regexten':{'type':Sequelize[_0x5170('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x5170('0x1')]},'port':{'type':Sequelize[_0x5170('0x26')](0x5)},'qualify':{'type':Sequelize[_0x5170('0x3')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x5170('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x5170('0x1')]},'defaultuser':{'type':Sequelize[_0x5170('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x5170('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x5170('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no',_0x5170('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x5170('0x1')]},'timert1':{'type':Sequelize[_0x5170('0x26')](0xb)},'timerb':{'type':Sequelize[_0x5170('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x5170('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x5170('0x1')]},'contactdeny':{'type':Sequelize[_0x5170('0x1')]},'contactacl':{'type':Sequelize[_0x5170('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x5170('0x1')]},'use_q850_reason':{'type':Sequelize[_0x5170('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x5170('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x5170('0x3')]('yes','no')},'icesupport':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no',_0x5170('0x2d'),_0x5170('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x5170('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x5170('0x1')]},'dtlscipher':{'type':Sequelize[_0x5170('0x1')]},'dtlscafile':{'type':Sequelize[_0x5170('0x1')]},'dtlscapath':{'type':Sequelize[_0x5170('0x1')]},'dtlssetup':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x2f'),_0x5170('0x30'),_0x5170('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x5170('0x1')]},'recordofffeature':{'type':Sequelize[_0x5170('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x5170('0x3')](_0x5170('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x5170('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x5170('0x1')]},'mohinterpret':{'type':Sequelize[_0x5170('0x1')]},'mohsuggest':{'type':Sequelize[_0x5170('0x1')]},'parkinglot':{'type':Sequelize[_0x5170('0x1')]},'description':{'type':Sequelize[_0x5170('0x1')]},'host':{'type':Sequelize[_0x5170('0x1')],'defaultValue':_0x5170('0x32')},'canreinvite':{'type':Sequelize[_0x5170('0x3')]('yes','no',_0x5170('0x1b'),_0x5170('0x33'),_0x5170('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x5170('0x1')]},'active':{'type':Sequelize[_0x5170('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x5170('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index eec9bcc..086701b 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 _0x9bde=['fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','VIRTUAL','merge','Trunk','includeAll','findAll','rows','show','params','fields','include','options','clone','find','omit','createdAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/registry.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','root','server/files/templates/trunk.ejs','writeFileSync','rimraf'];(function(_0x9ff1c0,_0x207afc){var _0x3e6c23=function(_0x11ad15){while(--_0x11ad15){_0x9ff1c0['push'](_0x9ff1c0['shift']());}};_0x3e6c23(++_0x207afc);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3e1443,_0x11a659){_0x3e1443=_0x3e1443-0x0;var _0x3a7e94=_0x9bde[_0x3e1443];return _0x3a7e94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xe9bd('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x220d07,_0x429e88,_0x3435b4,_0x51109f){return new BPromise(function(_0x47ba5e,_0x46a95e){var _0x248818=_0x51109f||client;return _0x248818[_0xe9bd('0x1a')](_0x220d07,_0x3435b4)[_0xe9bd('0x1b')](function(_0x3360bd){logger[_0xe9bd('0x1c')](_0xe9bd('0x1d'),_0x429e88,'request\x20sent');logger[_0xe9bd('0x1e')](_0xe9bd('0x1f'),_0x429e88,_0xe9bd('0x20'),JSON['stringify'](_0x3360bd));if(_0x3360bd[_0xe9bd('0x21')]){if(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x22')]===0x1f4){logger[_0xe9bd('0x21')]('Trunk,\x20%s,\x20%s',_0x429e88,_0x3360bd[_0xe9bd('0x21')]['message']);return _0x46a95e(_0x3360bd[_0xe9bd('0x21')]['message']);}logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);return _0x47ba5e(_0x3360bd[_0xe9bd('0x21')][_0xe9bd('0x23')]);}else{logger[_0xe9bd('0x1c')]('Trunk,\x20%s,\x20%s',_0x429e88,_0xe9bd('0x20'));_0x47ba5e(_0x3360bd[_0xe9bd('0x24')]['message']);}})[_0xe9bd('0x25')](function(_0x505c23){logger[_0xe9bd('0x21')](_0xe9bd('0x1d'),_0x429e88,_0x505c23);_0x46a95e(_0x505c23);});});}function respondWithStatusCode(_0x36f8c0,_0xf02209){_0xf02209=_0xf02209||0xcc;return function(_0x5bc4bf){if(_0x5bc4bf){return _0x36f8c0[_0xe9bd('0x26')](_0xf02209);}return _0x36f8c0[_0xe9bd('0x27')](_0xf02209)[_0xe9bd('0x28')]();};}function respondWithResult(_0x39b206,_0x2641be){_0x2641be=_0x2641be||0xc8;return function(_0xb52d45){if(_0xb52d45){return _0x39b206[_0xe9bd('0x27')](_0x2641be)[_0xe9bd('0x29')](_0xb52d45);}};}function respondWithFilteredResult(_0x1ae889,_0x5987af){return function(_0x3c211a){if(_0x3c211a){var _0x38fdfa=typeof _0x5987af['offset']===_0xe9bd('0x2a')&&typeof _0x5987af[_0xe9bd('0x2b')]===_0xe9bd('0x2a');var _0x429055=_0x3c211a[_0xe9bd('0x2c')];var _0x183601=_0x38fdfa?0x0:_0x5987af['offset'];var _0x5b7f1d=_0x38fdfa?_0x3c211a[_0xe9bd('0x2c')]:_0x5987af['offset']+_0x5987af[_0xe9bd('0x2b')];var _0x1f2c0e;if(_0x5b7f1d>=_0x429055){_0x5b7f1d=_0x429055;_0x1f2c0e=0xc8;}else{_0x1f2c0e=0xce;}_0x1ae889[_0xe9bd('0x27')](_0x1f2c0e);return _0x1ae889[_0xe9bd('0x2d')](_0xe9bd('0x2e'),_0x183601+'-'+_0x5b7f1d+'/'+_0x429055)['json'](_0x3c211a);}return null;};}function patchUpdates(_0x4b7bc2){return function(_0x7f2c5){try{jsonpatch[_0xe9bd('0x2f')](_0x7f2c5,_0x4b7bc2,!![]);}catch(_0x3f96a0){return BPromise[_0xe9bd('0x30')](_0x3f96a0);}return _0x7f2c5[_0xe9bd('0x31')]();};}function saveUpdates(_0x1f0f9e,_0x3c31ee){return function(_0x66213a){if(_0x66213a){return _0x66213a[_0xe9bd('0x32')](_0x1f0f9e)['then'](function(_0x426004){return _0x426004;});}return null;};}function removeEntity(_0x81a31f,_0x390a43){return function(_0x5117bc){if(_0x5117bc){return _0x5117bc['destroy']()[_0xe9bd('0x1b')](function(){var _0x2e9593=_0x5117bc[_0xe9bd('0x33')]({'plain':!![]});var _0x3ed60a=_0xe9bd('0x34');return db[_0xe9bd('0x35')][_0xe9bd('0x36')]({'where':{'type':_0x3ed60a,'resourceId':_0x2e9593['id']}})[_0xe9bd('0x1b')](function(){return _0x5117bc;});})[_0xe9bd('0x1b')](function(){_0x81a31f[_0xe9bd('0x27')](0xcc)[_0xe9bd('0x28')]();});}};}function handleEntityNotFound(_0x549dd1,_0x2ad46e){return function(_0x199477){if(!_0x199477){_0x549dd1[_0xe9bd('0x26')](0x194);}return _0x199477;};}function handleError(_0x8ff624,_0x264ba0){_0x264ba0=_0x264ba0||0x1f4;return function(_0x147da5){logger['error'](_0x147da5[_0xe9bd('0x37')]);if(_0x147da5[_0xe9bd('0x38')]){delete _0x147da5['name'];}_0x8ff624[_0xe9bd('0x27')](_0x264ba0)[_0xe9bd('0x39')](_0x147da5);};}exports['index']=function(_0x4b1da0,_0x2785e6){var _0xdf43b9={},_0x4d2f3d={},_0x2d1289={'count':0x0,'rows':[]};var _0x3ea705=_[_0xe9bd('0x3a')](db['Trunk'][_0xe9bd('0x3b')],function(_0x4d1945){return{'name':_0x4d1945[_0xe9bd('0x3c')],'type':_0x4d1945[_0xe9bd('0x3d')][_0xe9bd('0x3e')]};});_0x4d2f3d[_0xe9bd('0x3f')]=_['map'](_0x3ea705,_0xe9bd('0x38'));_0x4d2f3d[_0xe9bd('0x40')]=_[_0xe9bd('0x41')](_0x4b1da0[_0xe9bd('0x40')]);_0x4d2f3d[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4d2f3d[_0xe9bd('0x3f')],_0x4d2f3d[_0xe9bd('0x40')]);_0xdf43b9[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x4d2f3d['model'],qs['fields'](_0x4b1da0[_0xe9bd('0x40')]['fields']));_0xdf43b9[_0xe9bd('0x44')]=_0xdf43b9[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xdf43b9['attributes']:_0x4d2f3d[_0xe9bd('0x3f')];if(!_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x46')]('nolimit')){_0xdf43b9[_0xe9bd('0x2b')]=qs[_0xe9bd('0x2b')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x2b')]);_0xdf43b9[_0xe9bd('0x47')]=qs[_0xe9bd('0x47')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x47')]);}_0xdf43b9[_0xe9bd('0x48')]=qs[_0xe9bd('0x49')](_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x49')]);_0xdf43b9[_0xe9bd('0x4a')]=qs[_0xe9bd('0x42')](_[_0xe9bd('0x4b')](_0x4b1da0['query'],_0x4d2f3d['filters']),_0x3ea705);if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x4c')]){_0xdf43b9[_0xe9bd('0x4a')]=_['merge'](_0xdf43b9['where'],{'$or':_[_0xe9bd('0x3a')](_0x3ea705,function(_0x3f6f22){if(_0x3f6f22[_0xe9bd('0x3d')]!==_0xe9bd('0x4d')){var _0x39fb61={};_0x39fb61[_0x3f6f22[_0xe9bd('0x38')]]={'$like':'%'+_0x4b1da0[_0xe9bd('0x40')]['filter']+'%'};return _0x39fb61;}})});}_0xdf43b9=_[_0xe9bd('0x4e')]({},_0xdf43b9,_0x4b1da0['options']);var _0x36726e={'where':_0xdf43b9[_0xe9bd('0x4a')]};return db[_0xe9bd('0x4f')][_0xe9bd('0x2c')](_0x36726e)[_0xe9bd('0x1b')](function(_0x4b7b67){_0x2d1289[_0xe9bd('0x2c')]=_0x4b7b67;if(_0x4b1da0[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xdf43b9['include']=[{'all':!![]}];}return db[_0xe9bd('0x4f')][_0xe9bd('0x51')](_0xdf43b9);})[_0xe9bd('0x1b')](function(_0x5a466b){_0x2d1289[_0xe9bd('0x52')]=_0x5a466b;return _0x2d1289;})[_0xe9bd('0x1b')](respondWithFilteredResult(_0x2785e6,_0xdf43b9))[_0xe9bd('0x25')](handleError(_0x2785e6,null));};exports[_0xe9bd('0x53')]=function(_0x1ee09c,_0x579d26){var _0x3f4833={'raw':![],'where':{'id':_0x1ee09c[_0xe9bd('0x54')]['id']}},_0x4b8ff9={};_0x4b8ff9[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0x4b8ff9['query']=_[_0xe9bd('0x41')](_0x1ee09c['query']);_0x4b8ff9[_0xe9bd('0x42')]=_[_0xe9bd('0x43')](_0x4b8ff9['model'],_0x4b8ff9['query']);_0x3f4833[_0xe9bd('0x44')]=_['intersection'](_0x4b8ff9[_0xe9bd('0x3f')],qs['fields'](_0x1ee09c[_0xe9bd('0x40')][_0xe9bd('0x55')]));_0x3f4833['attributes']=_0x3f4833[_0xe9bd('0x44')]['length']?_0x3f4833[_0xe9bd('0x44')]:_0x4b8ff9[_0xe9bd('0x3f')];if(_0x1ee09c[_0xe9bd('0x40')]['includeAll']){_0x3f4833[_0xe9bd('0x56')]=[{'all':!![]}];}_0x3f4833=_[_0xe9bd('0x4e')]({},_0x3f4833,_0x1ee09c[_0xe9bd('0x57')]);return db[_0xe9bd('0x4f')]['find'](_0x3f4833)['then'](handleEntityNotFound(_0x579d26,null))[_0xe9bd('0x1b')](respondWithResult(_0x579d26,null))['catch'](handleError(_0x579d26,null));};exports[_0xe9bd('0x58')]=function(_0x3c33b8,_0xc7dd2f){var _0xc818b4={'where':{'id':_0x3c33b8[_0xe9bd('0x54')]['id']}},_0x159f68={};_0x159f68[_0xe9bd('0x3f')]=_[_0xe9bd('0x41')](db[_0xe9bd('0x4f')][_0xe9bd('0x3b')]);_0xc818b4[_0xe9bd('0x44')]=_[_0xe9bd('0x43')](_0x159f68['model'],qs['fields'](_0x3c33b8['query'][_0xe9bd('0x55')]));_0xc818b4['attributes']=_0xc818b4[_0xe9bd('0x44')][_0xe9bd('0x45')]?_0xc818b4[_0xe9bd('0x44')]:_0x159f68[_0xe9bd('0x3f')];if(_0x3c33b8[_0xe9bd('0x40')][_0xe9bd('0x50')]){_0xc818b4[_0xe9bd('0x56')]=[{'all':!![]}];}_0xc818b4=_[_0xe9bd('0x4e')]({},_0xc818b4,_0x3c33b8[_0xe9bd('0x57')]);return db['Trunk'][_0xe9bd('0x59')](_0xc818b4)[_0xe9bd('0x1b')](handleEntityNotFound(_0xc7dd2f,null))[_0xe9bd('0x1b')](function(_0x3f848d){if(_0x3f848d){var _0x4d58c1=_0x3f848d[_0xe9bd('0x33')]({'plain':!![]});_0x4d58c1=qs[_0xe9bd('0x5a')](_0x4d58c1,['id',_0xe9bd('0x5b'),'updatedAt']);_0x3c33b8[_0xe9bd('0x5c')]=_[_0xe9bd('0x5a')](_0x3c33b8[_0xe9bd('0x5c')],['id',_0xe9bd('0x5b'),'updatedAt']);return db['Trunk'][_0xe9bd('0x5d')](_[_0xe9bd('0x4e')](_0x4d58c1,_0x3c33b8[_0xe9bd('0x5c')]),{'include':_0x3c33b8[_0xe9bd('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x305efa){var _0x20855b=_0x3c33b8[_0xe9bd('0x5e')][_0xe9bd('0x33')]({'plain':!![]});if(!_0x20855b)throw new Error(_0xe9bd('0x5f'));if(_0x20855b[_0xe9bd('0x60')]==='user'){var _0x179c8d=_0x305efa['get']({'plain':!![]});var _0x27e07c=_0xe9bd('0x34');return db[_0xe9bd('0x61')][_0xe9bd('0x59')]({'where':{'name':_0x27e07c,'userProfileId':_0x20855b['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x263ad9){if(_0x263ad9&&_0x263ad9[_0xe9bd('0x62')]===0x0){return db['UserProfileResource'][_0xe9bd('0x5d')]({'name':_0x179c8d[_0xe9bd('0x38')],'resourceId':_0x179c8d['id'],'type':_0x263ad9[_0xe9bd('0x38')],'sectionId':_0x263ad9['id']},{})[_0xe9bd('0x1b')](function(){return _0x305efa;});}else{return _0x305efa;}})[_0xe9bd('0x25')](function(_0x16b66c){logger[_0xe9bd('0x21')](_0xe9bd('0x63'),_0x16b66c);throw _0x16b66c;});}return _0x305efa;});}})[_0xe9bd('0x1b')](respondWithResult(_0xc7dd2f,0xc9))[_0xe9bd('0x25')](handleError(_0xc7dd2f,null));};exports[_0xe9bd('0x5d')]=function(_0x37d07a,_0x5d1e4b,_0x3a12e9){var _0x9d0603;return db['Trunk'][_0xe9bd('0x5d')](_0x37d07a[_0xe9bd('0x5c')],{'raw':!![]})['then'](function(_0x561165){_0x9d0603=_0x561165;return db[_0xe9bd('0x4f')][_0xe9bd('0x51')]({'raw':!![]});})['then'](function(_0x4ec8be){var _0x4a6422=fs[_0xe9bd('0x64')](path['join'](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x1fc88d=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x337284=ejs[_0xe9bd('0x68')](_0x4a6422,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x69'),_0x337284);if(_0x9d0603[_0xe9bd('0x6a')]){var _0x11ebcb=ejs['render'](_0x1fc88d,{'trunks':_0x4ec8be||[]});fs['writeFileSync'](_0xe9bd('0x6b'),_0x11ebcb);}})[_0xe9bd('0x1b')](function(){return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x5d'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x1b')](function(){var _0x3fda4c=_0x37d07a[_0xe9bd('0x5e')]['get']({'plain':!![]});if(!_0x3fda4c)throw new Error(_0xe9bd('0x5f'));if(_0x3fda4c[_0xe9bd('0x60')]===_0xe9bd('0x5e')){var _0x3db47a=_0x9d0603[_0xe9bd('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xe9bd('0x59')]({'where':{'name':'Trunks','userProfileId':_0x3fda4c['userProfileId']},'raw':!![]})[_0xe9bd('0x1b')](function(_0x4496e3){if(_0x4496e3&&_0x4496e3['autoAssociation']===0x0){return db[_0xe9bd('0x35')][_0xe9bd('0x5d')]({'name':_0x3db47a[_0xe9bd('0x38')],'resourceId':_0x3db47a['id'],'type':_0x4496e3[_0xe9bd('0x38')],'sectionId':_0x4496e3['id']},{})['then'](function(){return _0x9d0603;});}else{return _0x9d0603;}})[_0xe9bd('0x25')](function(_0x41fb41){logger['error'](_0xe9bd('0x63'),_0x41fb41);throw _0x41fb41;});}return _0x9d0603;})[_0xe9bd('0x1b')](respondWithResult(_0x5d1e4b,0xc9))[_0xe9bd('0x25')](handleError(_0x5d1e4b,null));};exports[_0xe9bd('0x32')]=function(_0x2e63c7,_0x1a36aa,_0x466a89){var _0x5e127b;return db[_0xe9bd('0x4f')][_0xe9bd('0x59')]({'where':{'id':_0x2e63c7[_0xe9bd('0x54')]['id']}})[_0xe9bd('0x1b')](handleEntityNotFound(_0x1a36aa,null))[_0xe9bd('0x1b')](saveUpdates(_0x2e63c7[_0xe9bd('0x5c')],null))[_0xe9bd('0x1b')](function(_0x2adc49){if(_0x2adc49){_0x5e127b=_0x2adc49;return db[_0xe9bd('0x4f')]['findAll']({'raw':!![]});}})[_0xe9bd('0x1b')](function(_0x466952){if(_0x466952){var _0x256890=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),'utf8');var _0x18519d=fs[_0xe9bd('0x64')](path['join'](config[_0xe9bd('0x6e')],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x2083c4=ejs[_0xe9bd('0x68')](_0x256890,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x69'),_0x2083c4);var _0x4f3dc6=ejs['render'](_0x18519d,{'trunks':_0x466952||[]});fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x4f3dc6);return respondWithRpcPromise(_0xe9bd('0x6c'),_0xe9bd('0x32'),{'module':_0xe9bd('0x6d')});}return null;})[_0xe9bd('0x1b')](function(_0x1b46f4){if(_0x1b46f4){return _0x5e127b;}})['then'](respondWithResult(_0x1a36aa,null))[_0xe9bd('0x25')](handleError(_0x1a36aa,null));};exports[_0xe9bd('0x36')]=function(_0x29833b,_0x256862,_0x14cdd5){var _0x74063;return db[_0xe9bd('0x4f')]['find']({'where':{'id':_0x29833b['params']['id']}})['then'](handleEntityNotFound(_0x256862,null))[_0xe9bd('0x1b')](removeEntity(_0x256862,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0xe9bd('0x1b')](function(_0x402ab2){var _0xf170d4=fs[_0xe9bd('0x64')](path[_0xe9bd('0x65')](config[_0xe9bd('0x6e')],_0xe9bd('0x6f')),_0xe9bd('0x67'));var _0x14ec42=fs['readFileSync'](path[_0xe9bd('0x65')](config['root'],_0xe9bd('0x66')),_0xe9bd('0x67'));var _0x22c67f=ejs[_0xe9bd('0x68')](_0xf170d4,{'trunks':_0x402ab2});var _0x416938=ejs['render'](_0x14ec42,{'trunks':_0x402ab2});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x22c67f);fs[_0xe9bd('0x70')](_0xe9bd('0x6b'),_0x416938);return respondWithRpcPromise('Reload',_0xe9bd('0x36'),{'module':_0xe9bd('0x6d')});})[_0xe9bd('0x25')](handleError(_0x256862,null));}; \ No newline at end of file +var _0x008c=['update','destroy','get','Trunks','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','Trunk','findAll','show','params','includeAll','include','options','clone','find','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','root','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/trunk.ejs','join','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x5c110f,_0x3c4bd8){var _0x5ebfc5=function(_0x2549df){while(--_0x2549df){_0x5c110f['push'](_0x5c110f['shift']());}};_0x5ebfc5(++_0x3c4bd8);}(_0x008c,0x188));var _0xc008=function(_0x3ebb69,_0x3e612e){_0x3ebb69=_0x3ebb69-0x0;var _0x421e59=_0x008c[_0x3ebb69];return _0x421e59;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];var jayson=require(_0xc008('0x18'));var client=jayson[_0xc008('0x19')][_0xc008('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x593f7a,_0x560e28,_0x33f44c,_0x50c1ab){return new BPromise(function(_0x25e13f,_0x4584e1){var _0x2073ef=_0x50c1ab||client;return _0x2073ef[_0xc008('0x1b')](_0x593f7a,_0x33f44c)[_0xc008('0x1c')](function(_0x5ee00b){logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));logger[_0xc008('0x1e')](_0xc008('0x1f'),_0x560e28,_0xc008('0x1d'),JSON['stringify'](_0x5ee00b));if(_0x5ee00b['error']){if(_0x5ee00b['error']['code']===0x1f4){logger[_0xc008('0x20')](_0xc008('0x21'),_0x560e28,_0x5ee00b['error'][_0xc008('0x22')]);return _0x4584e1(_0x5ee00b['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x560e28,_0x5ee00b[_0xc008('0x20')]['message']);return _0x25e13f(_0x5ee00b['error']['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x560e28,_0xc008('0x1d'));_0x25e13f(_0x5ee00b[_0xc008('0x23')][_0xc008('0x22')]);}})[_0xc008('0x24')](function(_0x11cc75){logger[_0xc008('0x20')]('Trunk,\x20%s,\x20%s',_0x560e28,_0x11cc75);_0x4584e1(_0x11cc75);});});}function respondWithStatusCode(_0x459fd9,_0x5c85f2){_0x5c85f2=_0x5c85f2||0xcc;return function(_0x58a6ea){if(_0x58a6ea){return _0x459fd9[_0xc008('0x25')](_0x5c85f2);}return _0x459fd9[_0xc008('0x26')](_0x5c85f2)[_0xc008('0x27')]();};}function respondWithResult(_0x3cb28c,_0x5410f5){_0x5410f5=_0x5410f5||0xc8;return function(_0x48582b){if(_0x48582b){return _0x3cb28c['status'](_0x5410f5)[_0xc008('0x28')](_0x48582b);}};}function respondWithFilteredResult(_0x15dade,_0x92c582){return function(_0x2e31c2){if(_0x2e31c2){var _0x5bebd9=typeof _0x92c582['offset']==='undefined'&&typeof _0x92c582['limit']==='undefined';var _0x3865c0=_0x2e31c2[_0xc008('0x29')];var _0x25eae4=_0x5bebd9?0x0:_0x92c582['offset'];var _0x24c14c=_0x5bebd9?_0x2e31c2[_0xc008('0x29')]:_0x92c582[_0xc008('0x2a')]+_0x92c582[_0xc008('0x2b')];var _0x4c5dec;if(_0x24c14c>=_0x3865c0){_0x24c14c=_0x3865c0;_0x4c5dec=0xc8;}else{_0x4c5dec=0xce;}_0x15dade[_0xc008('0x26')](_0x4c5dec);return _0x15dade[_0xc008('0x2c')]('Content-Range',_0x25eae4+'-'+_0x24c14c+'/'+_0x3865c0)['json'](_0x2e31c2);}return null;};}function patchUpdates(_0x539766){return function(_0x1032b2){try{jsonpatch[_0xc008('0x2d')](_0x1032b2,_0x539766,!![]);}catch(_0xf831f2){return BPromise[_0xc008('0x2e')](_0xf831f2);}return _0x1032b2[_0xc008('0x2f')]();};}function saveUpdates(_0xceebc3,_0x294f97){return function(_0x22d8e8){if(_0x22d8e8){return _0x22d8e8[_0xc008('0x30')](_0xceebc3)[_0xc008('0x1c')](function(_0x2f4b6b){return _0x2f4b6b;});}return null;};}function removeEntity(_0x1ac7c8,_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x31')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x32')]({'plain':!![]});var _0x383be7=_0xc008('0x33');return db[_0xc008('0x34')][_0xc008('0x31')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x1c')](function(){return _0x334a09;});})[_0xc008('0x1c')](function(){_0x1ac7c8[_0xc008('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87,_0x389a40){return function(_0x459df4){if(!_0x459df4){_0x415b87[_0xc008('0x25')](0x194);}return _0x459df4;};}function handleError(_0x40002f,_0x315562){_0x315562=_0x315562||0x1f4;return function(_0x1667a0){logger['error'](_0x1667a0[_0xc008('0x35')]);if(_0x1667a0[_0xc008('0x36')]){delete _0x1667a0['name'];}_0x40002f[_0xc008('0x26')](_0x315562)[_0xc008('0x37')](_0x1667a0);};}exports['index']=function(_0x263473,_0x2e4ae1){var _0x280e9b={},_0x55ff48={},_0x53b353={'count':0x0,'rows':[]};var _0x478810=_[_0xc008('0x38')](db['Trunk'][_0xc008('0x39')],function(_0x3884dd){return{'name':_0x3884dd[_0xc008('0x3a')],'type':_0x3884dd[_0xc008('0x3b')][_0xc008('0x3c')]};});_0x55ff48[_0xc008('0x3d')]=_[_0xc008('0x38')](_0x478810,_0xc008('0x36'));_0x55ff48[_0xc008('0x3e')]=_[_0xc008('0x3f')](_0x263473[_0xc008('0x3e')]);_0x55ff48[_0xc008('0x40')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],_0x55ff48['query']);_0x280e9b[_0xc008('0x42')]=_[_0xc008('0x41')](_0x55ff48[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x263473['query'][_0xc008('0x43')]));_0x280e9b[_0xc008('0x42')]=_0x280e9b[_0xc008('0x42')][_0xc008('0x44')]?_0x280e9b[_0xc008('0x42')]:_0x55ff48['model'];if(!_0x263473[_0xc008('0x3e')][_0xc008('0x45')](_0xc008('0x46'))){_0x280e9b[_0xc008('0x2b')]=qs[_0xc008('0x2b')](_0x263473['query'][_0xc008('0x2b')]);_0x280e9b[_0xc008('0x2a')]=qs[_0xc008('0x2a')](_0x263473[_0xc008('0x3e')]['offset']);}_0x280e9b[_0xc008('0x47')]=qs[_0xc008('0x48')](_0x263473[_0xc008('0x3e')]['sort']);_0x280e9b[_0xc008('0x49')]=qs['filters'](_[_0xc008('0x4a')](_0x263473['query'],_0x55ff48[_0xc008('0x40')]),_0x478810);if(_0x263473[_0xc008('0x3e')]['filter']){_0x280e9b[_0xc008('0x49')]=_[_0xc008('0x4b')](_0x280e9b[_0xc008('0x49')],{'$or':_['map'](_0x478810,function(_0x1cec64){if(_0x1cec64[_0xc008('0x3b')]!==_0xc008('0x4c')){var _0x44fc5d={};_0x44fc5d[_0x1cec64[_0xc008('0x36')]]={'$like':'%'+_0x263473[_0xc008('0x3e')]['filter']+'%'};return _0x44fc5d;}})});}_0x280e9b=_['merge']({},_0x280e9b,_0x263473['options']);var _0x4552ed={'where':_0x280e9b[_0xc008('0x49')]};return db[_0xc008('0x4d')][_0xc008('0x29')](_0x4552ed)[_0xc008('0x1c')](function(_0x24f6a4){_0x53b353[_0xc008('0x29')]=_0x24f6a4;if(_0x263473[_0xc008('0x3e')]['includeAll']){_0x280e9b['include']=[{'all':!![]}];}return db['Trunk'][_0xc008('0x4e')](_0x280e9b);})[_0xc008('0x1c')](function(_0x158eae){_0x53b353['rows']=_0x158eae;return _0x53b353;})[_0xc008('0x1c')](respondWithFilteredResult(_0x2e4ae1,_0x280e9b))[_0xc008('0x24')](handleError(_0x2e4ae1,null));};exports[_0xc008('0x4f')]=function(_0x1c2c50,_0x4981b4){var _0x56e4ac={'raw':![],'where':{'id':_0x1c2c50[_0xc008('0x50')]['id']}},_0x17ec90={};_0x17ec90[_0xc008('0x3d')]=_[_0xc008('0x3f')](db['Trunk']['rawAttributes']);_0x17ec90[_0xc008('0x3e')]=_['keys'](_0x1c2c50[_0xc008('0x3e')]);_0x17ec90[_0xc008('0x40')]=_[_0xc008('0x41')](_0x17ec90['model'],_0x17ec90[_0xc008('0x3e')]);_0x56e4ac[_0xc008('0x42')]=_[_0xc008('0x41')](_0x17ec90[_0xc008('0x3d')],qs[_0xc008('0x43')](_0x1c2c50['query'][_0xc008('0x43')]));_0x56e4ac[_0xc008('0x42')]=_0x56e4ac['attributes'][_0xc008('0x44')]?_0x56e4ac[_0xc008('0x42')]:_0x17ec90['model'];if(_0x1c2c50['query'][_0xc008('0x51')]){_0x56e4ac[_0xc008('0x52')]=[{'all':!![]}];}_0x56e4ac=_[_0xc008('0x4b')]({},_0x56e4ac,_0x1c2c50[_0xc008('0x53')]);return db[_0xc008('0x4d')]['find'](_0x56e4ac)['then'](handleEntityNotFound(_0x4981b4,null))[_0xc008('0x1c')](respondWithResult(_0x4981b4,null))['catch'](handleError(_0x4981b4,null));};exports[_0xc008('0x54')]=function(_0x25d351,_0xf94fcb){var _0x2f1105={'where':{'id':_0x25d351[_0xc008('0x50')]['id']}},_0x44f42d={};_0x44f42d['model']=_[_0xc008('0x3f')](db[_0xc008('0x4d')][_0xc008('0x39')]);_0x2f1105[_0xc008('0x42')]=_[_0xc008('0x41')](_0x44f42d['model'],qs[_0xc008('0x43')](_0x25d351['query']['fields']));_0x2f1105['attributes']=_0x2f1105[_0xc008('0x42')][_0xc008('0x44')]?_0x2f1105[_0xc008('0x42')]:_0x44f42d['model'];if(_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]){_0x2f1105[_0xc008('0x52')]=[{'all':!![]}];}_0x2f1105=_['merge']({},_0x2f1105,_0x25d351[_0xc008('0x53')]);return db[_0xc008('0x4d')][_0xc008('0x55')](_0x2f1105)[_0xc008('0x1c')](handleEntityNotFound(_0xf94fcb,null))['then'](function(_0x4022dd){if(_0x4022dd){var _0x4eaa6d=_0x4022dd[_0xc008('0x32')]({'plain':!![]});_0x4eaa6d=qs[_0xc008('0x56')](_0x4eaa6d,['id',_0xc008('0x57'),_0xc008('0x58')]);_0x25d351[_0xc008('0x59')]=_[_0xc008('0x56')](_0x25d351['body'],['id',_0xc008('0x57'),'updatedAt']);return db['Trunk'][_0xc008('0x5a')](_[_0xc008('0x4b')](_0x4eaa6d,_0x25d351['body']),{'include':_0x25d351[_0xc008('0x3e')][_0xc008('0x51')]?[{'all':!![]}]:undefined})[_0xc008('0x1c')](function(_0x4517c0){var _0x21ee6d=_0x25d351[_0xc008('0x5b')][_0xc008('0x32')]({'plain':!![]});if(!_0x21ee6d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21ee6d[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x3bfb15=_0x4517c0[_0xc008('0x32')]({'plain':!![]});var _0xb3ca0f=_0xc008('0x33');return db[_0xc008('0x5d')][_0xc008('0x55')]({'where':{'name':_0xb3ca0f,'userProfileId':_0x21ee6d[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x1bef66){if(_0x1bef66&&_0x1bef66[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x3bfb15['name'],'resourceId':_0x3bfb15['id'],'type':_0x1bef66[_0xc008('0x36')],'sectionId':_0x1bef66['id']},{})[_0xc008('0x1c')](function(){return _0x4517c0;});}else{return _0x4517c0;}})[_0xc008('0x24')](function(_0x566dea){logger[_0xc008('0x20')](_0xc008('0x60'),_0x566dea);throw _0x566dea;});}return _0x4517c0;});}})['then'](respondWithResult(_0xf94fcb,0xc9))['catch'](handleError(_0xf94fcb,null));};exports[_0xc008('0x5a')]=function(_0x2a4c2b,_0x7bad14,_0x39083c){var _0x1a2ce7;return db[_0xc008('0x4d')][_0xc008('0x5a')](_0x2a4c2b[_0xc008('0x59')],{'raw':!![]})[_0xc008('0x1c')](function(_0x1b059b){_0x1a2ce7=_0x1b059b;return db[_0xc008('0x4d')]['findAll']({'raw':!![]});})[_0xc008('0x1c')](function(_0x25a52b){var _0xfdb5e3=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],'server/files/templates/trunk.ejs'),_0xc008('0x63'));var _0x46fa7b=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x64')),_0xc008('0x63'));var _0x553f5c=ejs[_0xc008('0x65')](_0xfdb5e3,{'trunks':_0x25a52b||[]});fs['writeFileSync'](_0xc008('0x66'),_0x553f5c);if(_0x1a2ce7[_0xc008('0x67')]){var _0x23012c=ejs[_0xc008('0x65')](_0x46fa7b,{'trunks':_0x25a52b||[]});fs[_0xc008('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x23012c);}})[_0xc008('0x1c')](function(){return respondWithRpcPromise(_0xc008('0x69'),'create',{'module':_0xc008('0x6a')});})['then'](function(){var _0x278cbe=_0x2a4c2b['user'][_0xc008('0x32')]({'plain':!![]});if(!_0x278cbe)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x278cbe[_0xc008('0x5c')]===_0xc008('0x5b')){var _0x33d8e4=_0x1a2ce7[_0xc008('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xc008('0x55')]({'where':{'name':_0xc008('0x33'),'userProfileId':_0x278cbe[_0xc008('0x5e')]},'raw':!![]})[_0xc008('0x1c')](function(_0x321500){if(_0x321500&&_0x321500[_0xc008('0x5f')]===0x0){return db[_0xc008('0x34')][_0xc008('0x5a')]({'name':_0x33d8e4['name'],'resourceId':_0x33d8e4['id'],'type':_0x321500[_0xc008('0x36')],'sectionId':_0x321500['id']},{})['then'](function(){return _0x1a2ce7;});}else{return _0x1a2ce7;}})['catch'](function(_0x4c84da){logger[_0xc008('0x20')](_0xc008('0x60'),_0x4c84da);throw _0x4c84da;});}return _0x1a2ce7;})[_0xc008('0x1c')](respondWithResult(_0x7bad14,0xc9))[_0xc008('0x24')](handleError(_0x7bad14,null));};exports[_0xc008('0x30')]=function(_0x2e9646,_0x23ef42,_0x519328){var _0x127bdf;return db['Trunk'][_0xc008('0x55')]({'where':{'id':_0x2e9646[_0xc008('0x50')]['id']}})[_0xc008('0x1c')](handleEntityNotFound(_0x23ef42,null))[_0xc008('0x1c')](saveUpdates(_0x2e9646[_0xc008('0x59')],null))[_0xc008('0x1c')](function(_0x23d4ff){if(_0x23d4ff){_0x127bdf=_0x23d4ff;return db[_0xc008('0x4d')][_0xc008('0x4e')]({'raw':!![]});}})[_0xc008('0x1c')](function(_0x334ed8){if(_0x334ed8){var _0x1dd9fe=fs['readFileSync'](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x572d93=fs[_0xc008('0x61')](path[_0xc008('0x6c')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x3fc44f=ejs[_0xc008('0x65')](_0x1dd9fe,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x66'),_0x3fc44f);var _0x1101b8=ejs[_0xc008('0x65')](_0x572d93,{'trunks':_0x334ed8||[]});fs[_0xc008('0x68')](_0xc008('0x6d'),_0x1101b8);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x30'),{'module':'chan_sip.so'});}return null;})['then'](function(_0xc644fe){if(_0xc644fe){return _0x127bdf;}})[_0xc008('0x1c')](respondWithResult(_0x23ef42,null))[_0xc008('0x24')](handleError(_0x23ef42,null));};exports[_0xc008('0x31')]=function(_0x2b94b2,_0x37fc2c,_0x4b434f){var _0x5794fe;return db[_0xc008('0x4d')][_0xc008('0x55')]({'where':{'id':_0x2b94b2[_0xc008('0x50')]['id']}})['then'](handleEntityNotFound(_0x37fc2c,null))['then'](removeEntity(_0x37fc2c,null))['then'](function(){return db['Trunk']['findAll']({'raw':!![]});})['then'](function(_0x276de2){var _0x52bf60=fs[_0xc008('0x61')](path['join'](config[_0xc008('0x62')],_0xc008('0x6b')),_0xc008('0x63'));var _0x5bc8b0=fs['readFileSync'](path[_0xc008('0x6c')](config['root'],_0xc008('0x64')),_0xc008('0x63'));var _0x544519=ejs[_0xc008('0x65')](_0x52bf60,{'trunks':_0x276de2});var _0x4db90b=ejs['render'](_0x5bc8b0,{'trunks':_0x276de2});fs[_0xc008('0x68')](_0xc008('0x66'),_0x544519);fs['writeFileSync'](_0xc008('0x6d'),_0x4db90b);return respondWithRpcPromise(_0xc008('0x69'),_0xc008('0x31'),{'module':'chan_sip.so'});})[_0xc008('0x24')](handleError(_0x37fc2c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 74f27f6..6b06d1e 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 _0xcfd5=['tools_trunks','lodash','api','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0xcfd5,0x79));var _0x5cfd=function(_0x28c0c7,_0x140b21){_0x28c0c7=_0x28c0c7-0x0;var _0x5d6333=_0xcfd5[_0x28c0c7];return _0x5d6333;};'use strict';var _=require(_0x5cfd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5cfd('0x1'));var moment=require('moment');var BPromise=require(_0x5cfd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5cfd('0x3'));var rimraf=require(_0x5cfd('0x4'));var config=require(_0x5cfd('0x5'));var attributes=require(_0x5cfd('0x6'));module[_0x5cfd('0x7')]=function(_0x275a61,_0x5583aa){return _0x275a61[_0x5cfd('0x8')]('Trunk',attributes,{'tableName':_0x5cfd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x75da=['tools_trunks','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','exports','Trunk'];(function(_0x2ed57c,_0x2935b8){var _0x3c8041=function(_0xe4365){while(--_0xe4365){_0x2ed57c['push'](_0x2ed57c['shift']());}};_0x3c8041(++_0x2935b8);}(_0x75da,0xdd));var _0xa75d=function(_0x557d81,_0x2a6677){_0x557d81=_0x557d81-0x0;var _0x13fb9c=_0x75da[_0x557d81];return _0x13fb9c;};'use strict';var _=require(_0xa75d('0x0'));var util=require(_0xa75d('0x1'));var logger=require(_0xa75d('0x2'))(_0xa75d('0x3'));var moment=require(_0xa75d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa75d('0x5'));var config=require(_0xa75d('0x6'));var attributes=require('./trunk.attributes');module[_0xa75d('0x7')]=function(_0x2ae380,_0x5189af){return _0x2ae380['define'](_0xa75d('0x8'),attributes,{'tableName':_0xa75d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 4f633fa..4a342c9 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 _0x0b76=['model','map','GetTrunk','debug','catch','ShowTrunk','where','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','result','Trunk','findAll','options','raw','attributes','include'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0b76,0x118));var _0x60b7=function(_0x32780a,_0x164643){_0x32780a=_0x32780a-0x0;var _0xbb1c58=_0x0b76[_0x32780a];return _0xbb1c58;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var moment=require('moment');var BPromise=require(_0x60b7('0x2'));var rs=require(_0x60b7('0x3'));var fs=require('fs');var Redis=require(_0x60b7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x60b7('0x5'));var logger=require(_0x60b7('0x6'))(_0x60b7('0x7'));var config=require(_0x60b7('0x8'));var jayson=require(_0x60b7('0x9'));var client=jayson[_0x60b7('0xa')][_0x60b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ea64e,_0x43c322,_0x5c9714){return new BPromise(function(_0x2f6d64,_0xf5f687){return client[_0x60b7('0xc')](_0x3ea64e,_0x5c9714)['then'](function(_0x46f88b){logger[_0x60b7('0xd')]('Trunk,\x20%s,\x20%s',_0x43c322,_0x60b7('0xe'));logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x43c322,_0x60b7('0xe'),JSON[_0x60b7('0xf')](_0x46f88b));if(_0x46f88b[_0x60b7('0x10')]){if(_0x46f88b['error']['code']===0x1f4){logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x43c322,_0x46f88b['error'][_0x60b7('0x12')]);return _0xf5f687(_0x46f88b[_0x60b7('0x10')]['message']);}logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x43c322,_0x46f88b['error'][_0x60b7('0x12')]);return _0x2f6d64(_0x46f88b[_0x60b7('0x10')][_0x60b7('0x12')]);}else{logger[_0x60b7('0xd')]('Trunk,\x20%s,\x20%s',_0x43c322,_0x60b7('0xe'));_0x2f6d64(_0x46f88b[_0x60b7('0x13')][_0x60b7('0x12')]);}})['catch'](function(_0x212af4){logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x43c322,_0x212af4);_0xf5f687(_0x212af4);});});}exports['GetTrunk']=function(_0x17f71d){var _0x1976a4=this;return new Promise(function(_0x440a0c,_0x5ac991){return db[_0x60b7('0x14')][_0x60b7('0x15')]({'raw':_0x17f71d[_0x60b7('0x16')]?_0x17f71d[_0x60b7('0x16')][_0x60b7('0x17')]===undefined?!![]:![]:!![],'where':_0x17f71d[_0x60b7('0x16')]?_0x17f71d[_0x60b7('0x16')]['where']||null:null,'attributes':_0x17f71d[_0x60b7('0x16')]?_0x17f71d[_0x60b7('0x16')][_0x60b7('0x18')]||null:null,'limit':_0x17f71d['options']?_0x17f71d['options']['limit']||null:null,'include':_0x17f71d[_0x60b7('0x16')]?_0x17f71d[_0x60b7('0x16')]['include']?_['map'](_0x17f71d[_0x60b7('0x16')][_0x60b7('0x19')],function(_0x5d52c7){return{'model':db[_0x5d52c7['model']],'as':_0x5d52c7['as'],'attributes':_0x5d52c7[_0x60b7('0x18')],'include':_0x5d52c7[_0x60b7('0x19')]?_['map'](_0x5d52c7[_0x60b7('0x19')],function(_0x3656de){return{'model':db[_0x3656de[_0x60b7('0x1a')]],'as':_0x3656de['as'],'attributes':_0x3656de[_0x60b7('0x18')],'include':_0x3656de[_0x60b7('0x19')]?_[_0x60b7('0x1b')](_0x3656de[_0x60b7('0x19')],function(_0x1b4f0d){return{'model':db[_0x1b4f0d[_0x60b7('0x1a')]],'as':_0x1b4f0d['as'],'attributes':_0x1b4f0d[_0x60b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x458646){logger['info'](_0x60b7('0x1c'),_0x17f71d);logger[_0x60b7('0x1d')](_0x60b7('0x1c'),_0x17f71d,JSON[_0x60b7('0xf')](_0x458646));_0x440a0c(_0x458646);})[_0x60b7('0x1e')](function(_0x58ecc7){logger[_0x60b7('0x10')](_0x60b7('0x1c'),_0x58ecc7[_0x60b7('0x12')],_0x17f71d);_0x5ac991(_0x1976a4[_0x60b7('0x10')](0x1f4,_0x58ecc7['message']));});});};exports[_0x60b7('0x1f')]=function(_0x1dc301){var _0x57afd6=this;return new Promise(function(_0x5d0581,_0x64cb3b){return db[_0x60b7('0x14')]['find']({'raw':_0x1dc301[_0x60b7('0x16')]?_0x1dc301[_0x60b7('0x16')][_0x60b7('0x17')]===undefined?!![]:![]:!![],'where':_0x1dc301[_0x60b7('0x16')]?_0x1dc301[_0x60b7('0x16')][_0x60b7('0x20')]||null:null,'attributes':_0x1dc301['options']?_0x1dc301[_0x60b7('0x16')]['attributes']||null:null,'include':_0x1dc301[_0x60b7('0x16')]?_0x1dc301[_0x60b7('0x16')][_0x60b7('0x19')]?_[_0x60b7('0x1b')](_0x1dc301['options']['include'],function(_0x180e85){return{'model':db[_0x180e85['model']],'as':_0x180e85['as'],'attributes':_0x180e85['attributes'],'include':_0x180e85[_0x60b7('0x19')]?_[_0x60b7('0x1b')](_0x180e85[_0x60b7('0x19')],function(_0xc90c76){return{'model':db[_0xc90c76[_0x60b7('0x1a')]],'as':_0xc90c76['as'],'attributes':_0xc90c76[_0x60b7('0x18')],'include':_0xc90c76['include']?_['map'](_0xc90c76['include'],function(_0x2a39ab){return{'model':db[_0x2a39ab[_0x60b7('0x1a')]],'as':_0x2a39ab['as'],'attributes':_0x2a39ab['attributes']};}):[]};}):[]};}):[]:[]})[_0x60b7('0x21')](function(_0x47c7a0){logger[_0x60b7('0xd')](_0x60b7('0x1f'),_0x1dc301);logger[_0x60b7('0x1d')](_0x60b7('0x1f'),_0x1dc301,JSON['stringify'](_0x47c7a0));_0x5d0581(_0x47c7a0);})['catch'](function(_0x758a41){logger[_0x60b7('0x10')]('ShowTrunk',_0x758a41['message'],_0x1dc301);_0x64cb3b(_0x57afd6['error'](0x1f4,_0x758a41[_0x60b7('0x12')]));});});}; \ No newline at end of file +var _0x3f16=['model','attributes','debug','catch','ShowTrunk','find','raw','util','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetTrunk','Trunk','findAll','options','where','limit','map','include'];(function(_0x3d8b77,_0x138570){var _0x212a0c=function(_0x47e203){while(--_0x47e203){_0x3d8b77['push'](_0x3d8b77['shift']());}};_0x212a0c(++_0x138570);}(_0x3f16,0x87));var _0x63f1=function(_0x3336c0,_0x4e6f38){_0x3336c0=_0x3336c0-0x0;var _0x8d60e=_0x3f16[_0x3336c0];return _0x8d60e;};'use strict';var _=require('lodash');var util=require(_0x63f1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63f1('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x63f1('0x2'));var config=require(_0x63f1('0x3'));var jayson=require(_0x63f1('0x4'));var client=jayson[_0x63f1('0x5')][_0x63f1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2ad78d,_0x2487a0,_0x5756c7){return new BPromise(function(_0x2c5616,_0x199cf6){return client[_0x63f1('0x7')](_0x2ad78d,_0x5756c7)['then'](function(_0x2638bf){logger[_0x63f1('0x8')](_0x63f1('0x9'),_0x2487a0,_0x63f1('0xa'));logger['debug'](_0x63f1('0xb'),_0x2487a0,_0x63f1('0xa'),JSON[_0x63f1('0xc')](_0x2638bf));if(_0x2638bf[_0x63f1('0xd')]){if(_0x2638bf[_0x63f1('0xd')][_0x63f1('0xe')]===0x1f4){logger[_0x63f1('0xd')](_0x63f1('0x9'),_0x2487a0,_0x2638bf[_0x63f1('0xd')]['message']);return _0x199cf6(_0x2638bf[_0x63f1('0xd')][_0x63f1('0xf')]);}logger[_0x63f1('0xd')](_0x63f1('0x9'),_0x2487a0,_0x2638bf[_0x63f1('0xd')][_0x63f1('0xf')]);return _0x2c5616(_0x2638bf[_0x63f1('0xd')][_0x63f1('0xf')]);}else{logger[_0x63f1('0x8')](_0x63f1('0x9'),_0x2487a0,_0x63f1('0xa'));_0x2c5616(_0x2638bf[_0x63f1('0x10')][_0x63f1('0xf')]);}})['catch'](function(_0x44481b){logger[_0x63f1('0xd')](_0x63f1('0x9'),_0x2487a0,_0x44481b);_0x199cf6(_0x44481b);});});}exports[_0x63f1('0x11')]=function(_0x226304){var _0x2af919=this;return new Promise(function(_0x7f330,_0x4df6b1){return db[_0x63f1('0x12')][_0x63f1('0x13')]({'raw':_0x226304[_0x63f1('0x14')]?_0x226304[_0x63f1('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x226304[_0x63f1('0x14')]?_0x226304[_0x63f1('0x14')][_0x63f1('0x15')]||null:null,'attributes':_0x226304[_0x63f1('0x14')]?_0x226304[_0x63f1('0x14')]['attributes']||null:null,'limit':_0x226304[_0x63f1('0x14')]?_0x226304[_0x63f1('0x14')][_0x63f1('0x16')]||null:null,'include':_0x226304[_0x63f1('0x14')]?_0x226304[_0x63f1('0x14')]['include']?_[_0x63f1('0x17')](_0x226304[_0x63f1('0x14')][_0x63f1('0x18')],function(_0x57412b){return{'model':db[_0x57412b[_0x63f1('0x19')]],'as':_0x57412b['as'],'attributes':_0x57412b[_0x63f1('0x1a')],'include':_0x57412b[_0x63f1('0x18')]?_['map'](_0x57412b[_0x63f1('0x18')],function(_0x4f47a8){return{'model':db[_0x4f47a8[_0x63f1('0x19')]],'as':_0x4f47a8['as'],'attributes':_0x4f47a8[_0x63f1('0x1a')],'include':_0x4f47a8[_0x63f1('0x18')]?_[_0x63f1('0x17')](_0x4f47a8[_0x63f1('0x18')],function(_0x3998e9){return{'model':db[_0x3998e9['model']],'as':_0x3998e9['as'],'attributes':_0x3998e9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3150a5){logger[_0x63f1('0x8')]('GetTrunk',_0x226304);logger[_0x63f1('0x1b')]('GetTrunk',_0x226304,JSON[_0x63f1('0xc')](_0x3150a5));_0x7f330(_0x3150a5);})[_0x63f1('0x1c')](function(_0x541390){logger[_0x63f1('0xd')](_0x63f1('0x11'),_0x541390[_0x63f1('0xf')],_0x226304);_0x4df6b1(_0x2af919[_0x63f1('0xd')](0x1f4,_0x541390[_0x63f1('0xf')]));});});};exports[_0x63f1('0x1d')]=function(_0x47e83c){var _0x54f665=this;return new Promise(function(_0x279075,_0x155bdd){return db[_0x63f1('0x12')][_0x63f1('0x1e')]({'raw':_0x47e83c[_0x63f1('0x14')]?_0x47e83c[_0x63f1('0x14')][_0x63f1('0x1f')]===undefined?!![]:![]:!![],'where':_0x47e83c[_0x63f1('0x14')]?_0x47e83c['options'][_0x63f1('0x15')]||null:null,'attributes':_0x47e83c[_0x63f1('0x14')]?_0x47e83c[_0x63f1('0x14')][_0x63f1('0x1a')]||null:null,'include':_0x47e83c['options']?_0x47e83c[_0x63f1('0x14')][_0x63f1('0x18')]?_[_0x63f1('0x17')](_0x47e83c['options'][_0x63f1('0x18')],function(_0x1a853b){return{'model':db[_0x1a853b[_0x63f1('0x19')]],'as':_0x1a853b['as'],'attributes':_0x1a853b[_0x63f1('0x1a')],'include':_0x1a853b['include']?_[_0x63f1('0x17')](_0x1a853b[_0x63f1('0x18')],function(_0x2fa10e){return{'model':db[_0x2fa10e['model']],'as':_0x2fa10e['as'],'attributes':_0x2fa10e[_0x63f1('0x1a')],'include':_0x2fa10e[_0x63f1('0x18')]?_[_0x63f1('0x17')](_0x2fa10e[_0x63f1('0x18')],function(_0x24cffa){return{'model':db[_0x24cffa[_0x63f1('0x19')]],'as':_0x24cffa['as'],'attributes':_0x24cffa[_0x63f1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ac5a4){logger[_0x63f1('0x8')](_0x63f1('0x1d'),_0x47e83c);logger[_0x63f1('0x1b')](_0x63f1('0x1d'),_0x47e83c,JSON[_0x63f1('0xc')](_0x2ac5a4));_0x279075(_0x2ac5a4);})[_0x63f1('0x1c')](function(_0x3f7ac8){logger['error'](_0x63f1('0x1d'),_0x3f7ac8['message'],_0x47e83c);_0x155bdd(_0x54f665[_0x63f1('0xd')](0x1f4,_0x3f7ac8[_0x63f1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 610e9e1..1101269 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 _0x97dc=['get','isAuthenticated','describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','/create_many','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','/:id/unpause','/:id/chat_interactions','addChatInteractions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','/:id/api_key','put','/:id','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','../../components/auth/service','./user.controller'];(function(_0x384b64,_0x4f0784){var _0x3a8f2c=function(_0xc28196){while(--_0xc28196){_0x384b64['push'](_0x384b64['shift']());}};_0x3a8f2c(++_0x4f0784);}(_0x97dc,0x1ad));var _0xc97d=function(_0x414c72,_0x2baadd){_0x414c72=_0x414c72-0x0;var _0x768c59=_0x97dc[_0x414c72];return _0x768c59;};'use strict';var multer=require(_0xc97d('0x0'));var util=require(_0xc97d('0x1'));var path=require(_0xc97d('0x2'));var timeout=require(_0xc97d('0x3'));var express=require(_0xc97d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc97d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc97d('0x6'));router[_0xc97d('0x7')]('/',auth[_0xc97d('0x8')](),controller['index']);router['get']('/describe',auth[_0xc97d('0x8')](),controller[_0xc97d('0x9')]);router[_0xc97d('0x7')](_0xc97d('0xa'),auth['isAuthenticated'](),controller['whoami']);router[_0xc97d('0x7')](_0xc97d('0xb'),auth['isAuthenticated'](),controller[_0xc97d('0xc')]);router[_0xc97d('0x7')]('/:id',auth[_0xc97d('0x8')](),controller[_0xc97d('0xd')]);router[_0xc97d('0x7')](_0xc97d('0xe'),controller[_0xc97d('0xf')]);router['get']('/:id/open_tabs',auth[_0xc97d('0x8')](),controller[_0xc97d('0x10')]);router[_0xc97d('0x7')](_0xc97d('0x11'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x12')]);router[_0xc97d('0x7')](_0xc97d('0x13'),auth['isAuthenticated'](),controller[_0xc97d('0x14')]);router[_0xc97d('0x7')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0xc97d('0x15')]);router[_0xc97d('0x7')]('/:id/groups',auth[_0xc97d('0x8')](),controller[_0xc97d('0x16')]);router[_0xc97d('0x7')](_0xc97d('0x17'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x18')]);router['get'](_0xc97d('0x19'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x1a')]);router['get'](_0xc97d('0x1b'),auth[_0xc97d('0x8')](),controller['getChatInteractions']);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xc97d('0x1c')]);router[_0xc97d('0x7')](_0xc97d('0x1d'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x1e')]);router['get'](_0xc97d('0x1f'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x20')]);router[_0xc97d('0x7')](_0xc97d('0x21'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x22')]);router[_0xc97d('0x7')](_0xc97d('0x23'),auth[_0xc97d('0x8')](),controller['getWhatsappInteractions']);router[_0xc97d('0x7')](_0xc97d('0x24'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x25')]);router['get'](_0xc97d('0x26'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x27')]);router[_0xc97d('0x7')](_0xc97d('0x28'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x29')]);router[_0xc97d('0x7')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xc97d('0x2a')]);router[_0xc97d('0x7')](_0xc97d('0x2b'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x2c')]);router['get']('/:id/mail_accounts',auth[_0xc97d('0x8')](),controller[_0xc97d('0x2d')]);router['get'](_0xc97d('0x2e'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x2f')]);router[_0xc97d('0x7')](_0xc97d('0x30'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xc97d('0x7')]('/:id/chat_websites',auth[_0xc97d('0x8')](),controller[_0xc97d('0x31')]);router[_0xc97d('0x7')]('/:id/whatsapp_accounts',auth[_0xc97d('0x8')](),controller[_0xc97d('0x32')]);router[_0xc97d('0x7')](_0xc97d('0x33'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x34')]);router[_0xc97d('0x7')](_0xc97d('0x35'),auth['isAuthenticated'](),controller[_0xc97d('0x36')]);router[_0xc97d('0x7')]('/:id/api_key',auth[_0xc97d('0x8')](),controller['getApiKey']);router[_0xc97d('0x37')]('/:id/contacts',auth[_0xc97d('0x8')](),controller[_0xc97d('0x38')]);router[_0xc97d('0x37')]('/',auth[_0xc97d('0x8')](),controller[_0xc97d('0x39')]);router[_0xc97d('0x37')](_0xc97d('0x3a'),auth[_0xc97d('0x8')](),controller['bulkCreate']);router[_0xc97d('0x37')]('/:id/queues',auth[_0xc97d('0x8')](),controller[_0xc97d('0x3b')]);var upload=multer({'storage':multer[_0xc97d('0x3c')]({'destination':function(_0x259dbf,_0x4f2111,_0x17e17b){_0x17e17b(null,path[_0xc97d('0x3d')](config[_0xc97d('0x3e')],_0xc97d('0x3f')));},'filename':function(_0x47387d,_0x24e7d5,_0x3e9a48){_0x3e9a48(null,util[_0xc97d('0x40')]('%s-%s',Date[_0xc97d('0x41')](),_0x24e7d5[_0xc97d('0x42')]));}})});router[_0xc97d('0x37')](_0xc97d('0xe'),upload['single'](_0xc97d('0x43')),controller[_0xc97d('0x44')]);router[_0xc97d('0x37')]('/:id/login',auth[_0xc97d('0x8')](),controller[_0xc97d('0x45')]);router['post'](_0xc97d('0x46'),auth['isAuthenticated'](),controller[_0xc97d('0x47')]);router[_0xc97d('0x37')](_0xc97d('0x48'),auth[_0xc97d('0x8')](),controller['pause']);router['post'](_0xc97d('0x49'),auth[_0xc97d('0x8')](),controller['unpause']);router['post'](_0xc97d('0x24'),auth[_0xc97d('0x8')](),controller['addTeams']);router[_0xc97d('0x37')](_0xc97d('0x4a'),auth['isAuthenticated'](),controller[_0xc97d('0x4b')]);router[_0xc97d('0x37')]('/:id/mail_interactions',auth[_0xc97d('0x8')](),controller['addMailInteractions']);router[_0xc97d('0x37')]('/:id/fax_interactions',auth[_0xc97d('0x8')](),controller[_0xc97d('0x4c')]);router[_0xc97d('0x37')](_0xc97d('0x4d'),auth[_0xc97d('0x8')](),controller['addSmsInteractions']);router['post'](_0xc97d('0x4e'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x4f')]);router[_0xc97d('0x37')]('/:id/whatsapp_interactions',auth[_0xc97d('0x8')](),controller[_0xc97d('0x50')]);router[_0xc97d('0x37')]('/:id/fax_accounts',auth[_0xc97d('0x8')](),controller[_0xc97d('0x51')]);router[_0xc97d('0x37')](_0xc97d('0x52'),auth['isAuthenticated'](),controller[_0xc97d('0x53')]);router[_0xc97d('0x37')](_0xc97d('0x2e'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x54')]);router[_0xc97d('0x37')](_0xc97d('0x30'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xc97d('0x37')](_0xc97d('0x55'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x56')]);router['post'](_0xc97d('0x57'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x58')]);router[_0xc97d('0x37')](_0xc97d('0x33'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x59')]);router[_0xc97d('0x37')](_0xc97d('0x5a'),auth[_0xc97d('0x8')](),controller['createApiKey']);router[_0xc97d('0x5b')](_0xc97d('0x5c'),auth[_0xc97d('0x8')](),controller['update']);router['put']('/:id/password',auth['isAuthenticated'](),controller['changePassword']);router[_0xc97d('0x5d')]('/:id/queues',auth[_0xc97d('0x8')](),controller[_0xc97d('0x5e')]);router[_0xc97d('0x5d')]('/:id/teams',auth[_0xc97d('0x8')](),controller[_0xc97d('0x5f')]);router[_0xc97d('0x5d')](_0xc97d('0x5c'),auth['isAuthenticated'](),controller[_0xc97d('0x60')]);router[_0xc97d('0x5d')](_0xc97d('0x4a'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x61')]);router[_0xc97d('0x5d')]('/:id/mail_interactions',auth[_0xc97d('0x8')](),controller[_0xc97d('0x62')]);router['delete'](_0xc97d('0x63'),auth[_0xc97d('0x8')](),controller['removeFaxInteractions']);router[_0xc97d('0x5d')](_0xc97d('0x4d'),auth[_0xc97d('0x8')](),controller['removeSmsInteractions']);router[_0xc97d('0x5d')](_0xc97d('0x4e'),auth[_0xc97d('0x8')](),controller['removeOpenchannelInteractions']);router['delete'](_0xc97d('0x64'),auth[_0xc97d('0x8')](),controller['removeWhatsappInteractions']);router[_0xc97d('0x5d')](_0xc97d('0x2b'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x65')]);router['delete']('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xc97d('0x66')]);router['delete']('/:id/openchannel_accounts',auth[_0xc97d('0x8')](),controller[_0xc97d('0x67')]);router[_0xc97d('0x5d')](_0xc97d('0x30'),auth[_0xc97d('0x8')](),controller['removeSmsAccounts']);router[_0xc97d('0x5d')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xc97d('0x68')]);router[_0xc97d('0x5d')](_0xc97d('0x57'),auth['isAuthenticated'](),controller[_0xc97d('0x69')]);router[_0xc97d('0x5d')](_0xc97d('0x33'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x6a')]);router[_0xc97d('0x5d')](_0xc97d('0x5a'),auth[_0xc97d('0x8')](),controller[_0xc97d('0x6b')]);module[_0xc97d('0x6c')]=router; \ No newline at end of file +var _0xce96=['/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','/:id/openchannel_accounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','single','file','login','/:id/logout','logout','pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xce96,0x10b));var _0x6ce9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xce96[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x6ce9('0x0'));var util=require('util');var path=require(_0x6ce9('0x1'));var timeout=require('connect-timeout');var express=require(_0x6ce9('0x2'));var router=express[_0x6ce9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6ce9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6ce9('0x5'));var controller=require(_0x6ce9('0x6'));router[_0x6ce9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6ce9('0x7')](_0x6ce9('0x8'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0xa')]);router[_0x6ce9('0x7')]('/whoami',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0xb')]);router[_0x6ce9('0x7')](_0x6ce9('0xc'),auth['isAuthenticated'](),controller[_0x6ce9('0xd')]);router['get'](_0x6ce9('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6ce9('0x7')]('/:id/avatar',controller[_0x6ce9('0xf')]);router[_0x6ce9('0x7')](_0x6ce9('0x10'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x11')]);router[_0x6ce9('0x7')](_0x6ce9('0x12'),auth['isAuthenticated'](),controller['getContacts']);router['get'](_0x6ce9('0x13'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x14')]);router[_0x6ce9('0x7')](_0x6ce9('0x15'),auth['isAuthenticated'](),controller[_0x6ce9('0x16')]);router[_0x6ce9('0x7')](_0x6ce9('0x17'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x18')]);router[_0x6ce9('0x7')]('/:id/recordings',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x19')]);router['get']('/:id/screen_recordings',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x1a')]);router[_0x6ce9('0x7')](_0x6ce9('0x1b'),auth['isAuthenticated'](),controller[_0x6ce9('0x1c')]);router[_0x6ce9('0x7')]('/:id/openchannel/interactions',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x1d')]);router[_0x6ce9('0x7')](_0x6ce9('0x1e'),auth[_0x6ce9('0x9')](),controller['getMailInteractions']);router[_0x6ce9('0x7')](_0x6ce9('0x1f'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x20')]);router['get'](_0x6ce9('0x21'),auth['isAuthenticated'](),controller[_0x6ce9('0x22')]);router[_0x6ce9('0x7')](_0x6ce9('0x23'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x24')]);router[_0x6ce9('0x7')]('/:id/teams',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x25')]);router['get'](_0x6ce9('0x26'),auth['isAuthenticated'](),controller[_0x6ce9('0x27')]);router['get'](_0x6ce9('0x28'),auth['isAuthenticated'](),controller[_0x6ce9('0x29')]);router['get'](_0x6ce9('0x2a'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x2b')]);router[_0x6ce9('0x7')](_0x6ce9('0x2c'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x2d')]);router[_0x6ce9('0x7')](_0x6ce9('0x2e'),auth['isAuthenticated'](),controller[_0x6ce9('0x2f')]);router['get']('/:id/openchannel_accounts',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x30')]);router[_0x6ce9('0x7')](_0x6ce9('0x31'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x32')]);router['get']('/:id/chat_websites',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x33')]);router[_0x6ce9('0x7')](_0x6ce9('0x34'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x35')]);router[_0x6ce9('0x7')]('/:id/square_projects',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x36')]);router[_0x6ce9('0x7')](_0x6ce9('0x37'),auth[_0x6ce9('0x9')](),controller['getScheduledCalls']);router['get'](_0x6ce9('0x38'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x39')]);router['post'](_0x6ce9('0x12'),auth[_0x6ce9('0x9')](),controller['addContacts']);router[_0x6ce9('0x3a')]('/',auth[_0x6ce9('0x9')](),controller['create']);router[_0x6ce9('0x3a')](_0x6ce9('0x3b'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x3c')]);router[_0x6ce9('0x3a')](_0x6ce9('0x13'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x3d')]);var upload=multer({'storage':multer[_0x6ce9('0x3e')]({'destination':function(_0x55784e,_0x1cf38d,_0x4100fb){_0x4100fb(null,path[_0x6ce9('0x3f')](config[_0x6ce9('0x40')],_0x6ce9('0x41')));},'filename':function(_0xe957aa,_0x28c840,_0xd37d76){_0xd37d76(null,util['format'](_0x6ce9('0x42'),Date[_0x6ce9('0x43')](),_0x28c840[_0x6ce9('0x44')]));}})});router[_0x6ce9('0x3a')]('/:id/avatar',upload[_0x6ce9('0x45')](_0x6ce9('0x46')),controller['addAvatar']);router[_0x6ce9('0x3a')]('/:id/login',auth['isAuthenticated'](),controller[_0x6ce9('0x47')]);router[_0x6ce9('0x3a')](_0x6ce9('0x48'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x49')]);router[_0x6ce9('0x3a')]('/:id/pause',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x4a')]);router['post']('/:id/unpause',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x4b')]);router[_0x6ce9('0x3a')](_0x6ce9('0x4c'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x4d')]);router[_0x6ce9('0x3a')](_0x6ce9('0x4e'),auth['isAuthenticated'](),controller[_0x6ce9('0x4f')]);router['post'](_0x6ce9('0x50'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x51')]);router[_0x6ce9('0x3a')](_0x6ce9('0x52'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x53')]);router[_0x6ce9('0x3a')](_0x6ce9('0x54'),auth['isAuthenticated'](),controller[_0x6ce9('0x55')]);router['post'](_0x6ce9('0x56'),auth['isAuthenticated'](),controller['addOpenchannelInteractions']);router[_0x6ce9('0x3a')]('/:id/whatsapp_interactions',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x57')]);router[_0x6ce9('0x3a')](_0x6ce9('0x2c'),auth['isAuthenticated'](),controller[_0x6ce9('0x58')]);router[_0x6ce9('0x3a')](_0x6ce9('0x2e'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x59')]);router[_0x6ce9('0x3a')]('/:id/openchannel_accounts',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x5a')]);router[_0x6ce9('0x3a')](_0x6ce9('0x31'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x5b')]);router[_0x6ce9('0x3a')](_0x6ce9('0x5c'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x5d')]);router[_0x6ce9('0x3a')]('/:id/whatsapp_accounts',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x5e')]);router['post'](_0x6ce9('0x5f'),auth['isAuthenticated'](),controller[_0x6ce9('0x60')]);router['post'](_0x6ce9('0x38'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x61')]);router[_0x6ce9('0x62')](_0x6ce9('0xe'),auth['isAuthenticated'](),controller[_0x6ce9('0x63')]);router[_0x6ce9('0x62')](_0x6ce9('0x64'),auth[_0x6ce9('0x9')](),controller['changePassword']);router[_0x6ce9('0x65')](_0x6ce9('0x13'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x66')]);router[_0x6ce9('0x65')]('/:id/teams',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x67')]);router[_0x6ce9('0x65')](_0x6ce9('0xe'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x68')]);router[_0x6ce9('0x65')](_0x6ce9('0x4e'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x69')]);router[_0x6ce9('0x65')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x6ce9('0x65')](_0x6ce9('0x52'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x6a')]);router[_0x6ce9('0x65')](_0x6ce9('0x54'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x6ce9('0x65')](_0x6ce9('0x56'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x6ce9('0x65')]('/:id/whatsapp_interactions',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x6b')]);router['delete']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6ce9('0x6c')]);router[_0x6ce9('0x65')]('/:id/mail_accounts',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x6d')]);router[_0x6ce9('0x65')](_0x6ce9('0x6e'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x6f')]);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6ce9('0x70')]);router[_0x6ce9('0x65')](_0x6ce9('0x5c'),auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x71')]);router[_0x6ce9('0x65')](_0x6ce9('0x34'),auth[_0x6ce9('0x9')](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x72')]);router['delete']('/:id/api_key',auth[_0x6ce9('0x9')](),controller[_0x6ce9('0x73')]);module[_0x6ce9('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3378d74..89f6aee 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 _0xae84=['DATE','DEFAULT\x20PAUSE','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','rfc2833','info','shortinfo','auto','yes','update','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','nonat','update,nonat','TEXT','showWebBar','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','force_avp','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','email','toLowerCase','ENUM','admin','user','agent','INTEGER','internal','getDataValue','BOOLEAN'];(function(_0x5e6157,_0xd95d3e){var _0x232214=function(_0x549bbb){while(--_0x549bbb){_0x5e6157['push'](_0x5e6157['shift']());}};_0x232214(++_0xd95d3e);}(_0xae84,0x1be));var _0x4ae8=function(_0xf21895,_0x3e2305){_0xf21895=_0xf21895-0x0;var _0x6d6a29=_0xae84[_0xf21895];return _0x6d6a29;};'use strict';var Sequelize=require(_0x4ae8('0x0'));var moment=require(_0x4ae8('0x1'));var util=require(_0x4ae8('0x2'));var _=require(_0x4ae8('0x3'));module[_0x4ae8('0x4')]={'name':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':![],'unique':_0x4ae8('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x405aa3){this[_0x4ae8('0x7')]('name',_0x405aa3);this[_0x4ae8('0x7')](_0x4ae8('0x8'),_0x405aa3);},'comment':_0x4ae8('0x9')},'fullname':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':![],'set':function(_0x3831e7){this[_0x4ae8('0x7')](_0x4ae8('0xa'),_0x3831e7);this[_0x4ae8('0x7')](_0x4ae8('0xb'),util[_0x4ae8('0xc')](_0x4ae8('0xd'),_0x3831e7,this['getDataValue']('internal')));}},'alias':{'type':Sequelize[_0x4ae8('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4ae8('0xe'),'validate':{'isEmail':!![]},'set':function(_0x3c0be6){if(_0x3c0be6){this[_0x4ae8('0x7')](_0x4ae8('0xe'),_0x3c0be6[_0x4ae8('0xf')]());}}},'role':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x11'),_0x4ae8('0x12'),_0x4ae8('0x13'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':![],'unique':_0x4ae8('0x15'),'set':function(_0xb2fcda){this[_0x4ae8('0x7')](_0x4ae8('0x15'),_0xb2fcda);this[_0x4ae8('0x7')]('accountcode',_0xb2fcda);this[_0x4ae8('0x7')](_0x4ae8('0xb'),util[_0x4ae8('0xc')](_0x4ae8('0xd'),this[_0x4ae8('0x16')]('fullname'),_0xb2fcda));}},'salt':{'type':Sequelize[_0x4ae8('0x5')]},'phone':{'type':Sequelize[_0x4ae8('0x5')]},'mobile':{'type':Sequelize[_0x4ae8('0x5')]},'address':{'type':Sequelize[_0x4ae8('0x5')]},'zipcode':{'type':Sequelize[_0x4ae8('0x5')]},'userpic':{'type':Sequelize[_0x4ae8('0x5')]},'city':{'type':Sequelize[_0x4ae8('0x5')]},'country':{'type':Sequelize[_0x4ae8('0x5')]},'online':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4ae8('0x18')]},'voicePause':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4ae8('0x5')],'defaultValue':_0x4ae8('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4ae8('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x4ae8('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x4ae8('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x1a'),_0x4ae8('0x12'),_0x4ae8('0x1b')),'allowNull':!![],'defaultValue':_0x4ae8('0x1a')},'context':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'defaultValue':_0x4ae8('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x4ae8('0x1d'),_0x4ae8('0x1e'),_0x4ae8('0x1f'),'ALLOWED',_0x4ae8('0x20'),_0x4ae8('0x21'),_0x4ae8('0x22'),_0x4ae8('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'defaultValue':_0x4ae8('0x24'),'set':function(_0x43284e){this[_0x4ae8('0x7')](_0x4ae8('0x25'),_0x43284e?_0x43284e[_0x4ae8('0x26')](','):null);},'get':function(){return this[_0x4ae8('0x16')](_0x4ae8('0x25'))?this['getDataValue'](_0x4ae8('0x25'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x27'),_0x4ae8('0x28'),_0x4ae8('0x29'),'inband',_0x4ae8('0x2a')),'allowNull':!![],'defaultValue':_0x4ae8('0x27')},'directmedia':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no','nonat',_0x4ae8('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4ae8('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'defaultValue':_0x4ae8('0x2d'),'set':function(_0x444ff1){this[_0x4ae8('0x7')](_0x4ae8('0x2e'),_0x444ff1?_0x444ff1['join'](','):null);},'get':function(){return this[_0x4ae8('0x16')](_0x4ae8('0x2e'))?this[_0x4ae8('0x16')]('nat')[_0x4ae8('0x2f')](','):null;},'comment':_0x4ae8('0x30')},'callgroup':{'type':Sequelize[_0x4ae8('0x5')]},'namedcallgroup':{'type':Sequelize[_0x4ae8('0x5')]},'pickupgroup':{'type':Sequelize[_0x4ae8('0x5')]},'namedpickupgroup':{'type':Sequelize[_0x4ae8('0x5')]},'language':{'type':Sequelize[_0x4ae8('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4ae8('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4ae8('0x31')},'allow':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':![],'defaultValue':_0x4ae8('0x32'),'set':function(_0xffe96c){this[_0x4ae8('0x7')]('allow',_0xffe96c?_0xffe96c[_0x4ae8('0x26')](';'):_0x4ae8('0x32'));},'get':function(){return this[_0x4ae8('0x16')](_0x4ae8('0x33'))?this[_0x4ae8('0x16')](_0x4ae8('0x33'))[_0x4ae8('0x2f')](';'):null;},'comment':_0x4ae8('0x34')},'autoframing':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'set':function(_0x3b6112){this[_0x4ae8('0x7')](_0x4ae8('0x35'),_0x3b6112?_0x3b6112[_0x4ae8('0x26')](','):null);},'get':function(){return this[_0x4ae8('0x16')](_0x4ae8('0x35'))?this[_0x4ae8('0x16')](_0x4ae8('0x35'))[_0x4ae8('0x2f')](','):null;},'comment':_0x4ae8('0x36')},'trustrpid':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no',_0x4ae8('0x37')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![],'defaultValue':_0x4ae8('0x38')},'amaflags':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x4ae8('0x2b')},'busylevel':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x4ae8('0x10')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4ae8('0x10')]('yes','no',_0x4ae8('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4ae8('0x10')]('accept',_0x4ae8('0x3a'),_0x4ae8('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x3c'),_0x4ae8('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x4ae8('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x4ae8('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4ae8('0x10')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no',_0x4ae8('0x3e'),_0x4ae8('0x3f')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x40'),_0x4ae8('0x41'),_0x4ae8('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4ae8('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x4ae8('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4ae8('0x10')](_0x4ae8('0x2b'),'no',_0x4ae8('0x43'),_0x4ae8('0x2c'),_0x4ae8('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4ae8('0x5')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x4ae8('0x45')]},'showWebBar':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0,'set':function(_0x5b7138){this['setDataValue'](_0x4ae8('0x46'),_0x5b7138);var _0x4585eb=this['get']({'plain':!![]});switch(_0x5b7138){case 0x0:case 0x1:var _0x4e1409=_0x4585eb[_0x4ae8('0x25')]?_['isArray'](_0x4585eb['transport'])?_0x4585eb['transport'][_0x4ae8('0x26')]():_0x4585eb[_0x4ae8('0x25')]:_0x4ae8('0x24');if(_0x4e1409===_0x4ae8('0x47')){_0x4e1409=_0x4ae8('0x24');}this[_0x4ae8('0x7')]('transport',_0x4e1409);this[_0x4ae8('0x7')](_0x4ae8('0x48'),'no');this[_0x4ae8('0x7')](_0x4ae8('0x49'),null);this[_0x4ae8('0x7')]('force_avp',null);this['setDataValue'](_0x4ae8('0x4a'),null);this[_0x4ae8('0x7')](_0x4ae8('0x4b'),null);this[_0x4ae8('0x7')](_0x4ae8('0x4c'),null);this[_0x4ae8('0x7')](_0x4ae8('0x4d'),null);this[_0x4ae8('0x7')](_0x4ae8('0x4e'),null);this[_0x4ae8('0x7')](_0x4ae8('0x4f'),null);this[_0x4ae8('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x4ae8('0x7')](_0x4ae8('0x25'),_0x4ae8('0x47'));this[_0x4ae8('0x7')](_0x4ae8('0x48'),_0x4ae8('0x2b'));this['setDataValue'](_0x4ae8('0x49'),_0x4ae8('0x2b'));this[_0x4ae8('0x7')](_0x4ae8('0x50'),_0x4ae8('0x2b'));this[_0x4ae8('0x7')](_0x4ae8('0x4a'),'yes');this[_0x4ae8('0x7')]('dtlsenable',_0x4ae8('0x2b'));this['setDataValue'](_0x4ae8('0x4c'),'no');this['setDataValue']('dtlssetup',_0x4ae8('0x42'));this[_0x4ae8('0x7')]('dtlscertfile',_0x4585eb[_0x4ae8('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0x4ae8('0x7')](_0x4ae8('0x4f'),_0x4585eb[_0x4ae8('0x4f')]||_0x4ae8('0x51'));this['setDataValue'](_0x4ae8('0x52'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0x4ae8('0x45')],'set':function(_0x349549){this[_0x4ae8('0x7')](_0x4ae8('0x53'),_0x349549?_0x349549[_0x4ae8('0x26')](','):[]);},'get':function(){return this[_0x4ae8('0x16')]('permissions')?_[_0x4ae8('0x54')](this[_0x4ae8('0x16')]('permissions')[_0x4ae8('0x2f')](','),function(_0x1a35b9){return parseInt(_0x1a35b9,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4ae8('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4ae8('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x4ae8('0x5')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x4ae8('0x10')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4ae8('0x55')],'get':function(){return this[_0x4ae8('0x16')]('phoneBarEnableScreenRecordingByAgent')?this[_0x4ae8('0x16')](_0x4ae8('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x4ae8('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x4ae8('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![],'set':function(_0x2dab7e){if(typeof _0x2dab7e==='string'){var _0x1e3fc3=_0x2dab7e==='1'?!![]:_0x2dab7e==='0'?![]:_0x2dab7e===_0x4ae8('0x57')?!![]:_0x2dab7e===_0x4ae8('0x58')?![]:![];this['setDataValue']('screenrecording',_0x1e3fc3);}else{this[_0x4ae8('0x7')](_0x4ae8('0x59'),_0x2dab7e);}}},'blocked':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![],'set':function(_0x2c1880){this[_0x4ae8('0x7')](_0x4ae8('0x5a'),_0x2c1880);if(_0x2c1880===!![]){this['setDataValue'](_0x4ae8('0x5b'),moment());this[_0x4ae8('0x7')](_0x4ae8('0x5c'),0x0);}else{this[_0x4ae8('0x7')](_0x4ae8('0x5b'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x4ae8('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x4ae8('0x14')](0x5)[_0x4ae8('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x4ae8('0x17')],'defaultValue':![]}}; \ No newline at end of file +var _0xa557=['fullname','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','format','BOOLEAN','DATE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','all','allow','ulaw;alaw;gsm','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<>','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user'];(function(_0x473cf8,_0x54e45b){var _0x5e063e=function(_0x3cb156){while(--_0x3cb156){_0x473cf8['push'](_0x473cf8['shift']());}};_0x5e063e(++_0x54e45b);}(_0xa557,0x16f));var _0x7a55=function(_0x1a0fae,_0x536d9a){_0x1a0fae=_0x1a0fae-0x0;var _0x5263d4=_0xa557[_0x1a0fae];return _0x5263d4;};'use strict';var Sequelize=require(_0x7a55('0x0'));var moment=require('moment');var util=require(_0x7a55('0x1'));var _=require(_0x7a55('0x2'));module[_0x7a55('0x3')]={'name':{'type':Sequelize[_0x7a55('0x4')],'allowNull':![],'unique':_0x7a55('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4484bd){this[_0x7a55('0x6')](_0x7a55('0x5'),_0x4484bd);this[_0x7a55('0x6')](_0x7a55('0x7'),_0x4484bd);},'comment':_0x7a55('0x8')},'fullname':{'type':Sequelize[_0x7a55('0x4')],'allowNull':![],'set':function(_0x189f3f){this[_0x7a55('0x6')](_0x7a55('0x9'),_0x189f3f);this[_0x7a55('0x6')](_0x7a55('0xa'),util['format'](_0x7a55('0xb'),_0x189f3f,this[_0x7a55('0xc')](_0x7a55('0xd'))));}},'alias':{'type':Sequelize[_0x7a55('0x4')]},'email':{'type':Sequelize[_0x7a55('0x4')],'allowNull':![],'unique':_0x7a55('0xe'),'validate':{'isEmail':!![]},'set':function(_0x324649){if(_0x324649){this[_0x7a55('0x6')](_0x7a55('0xe'),_0x324649[_0x7a55('0xf')]());}}},'role':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x11'),_0x7a55('0x12'),_0x7a55('0x13'),_0x7a55('0x14')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x7a55('0x15')},'internal':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':![],'unique':_0x7a55('0xd'),'set':function(_0x12617f){this['setDataValue'](_0x7a55('0xd'),_0x12617f);this[_0x7a55('0x6')](_0x7a55('0x17'),_0x12617f);this['setDataValue'](_0x7a55('0xa'),util[_0x7a55('0x18')](_0x7a55('0xb'),this[_0x7a55('0xc')](_0x7a55('0x9')),_0x12617f));}},'salt':{'type':Sequelize[_0x7a55('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7a55('0x4')]},'address':{'type':Sequelize[_0x7a55('0x4')]},'zipcode':{'type':Sequelize[_0x7a55('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7a55('0x4')]},'country':{'type':Sequelize[_0x7a55('0x4')]},'online':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x7a55('0x1a')]},'voicePause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x7a55('0x1a')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x7a55('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x7a55('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![],'defaultValue':_0x7a55('0x1b')},'ipaddr':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x7a55('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x1c'),'user',_0x7a55('0x1d')),'allowNull':!![],'defaultValue':_0x7a55('0x1c')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x7a55('0x1e')},'callingpres':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x1f'),_0x7a55('0x20'),_0x7a55('0x21'),_0x7a55('0x22'),'PROHIB_NOT_SCREENED',_0x7a55('0x23'),'PROHIB_FAILED_SCREEN',_0x7a55('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![],'defaultValue':_0x7a55('0x25'),'set':function(_0x21789d){this['setDataValue'](_0x7a55('0x26'),_0x21789d?_0x21789d[_0x7a55('0x27')](','):null);},'get':function(){return this[_0x7a55('0xc')](_0x7a55('0x26'))?this['getDataValue'](_0x7a55('0x26'))['split'](','):null;},'comment':_0x7a55('0x28')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7a55('0x29'),_0x7a55('0x2a'),_0x7a55('0x2b'),_0x7a55('0x2c'),_0x7a55('0x2d')),'allowNull':!![],'defaultValue':_0x7a55('0x29')},'directmedia':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no',_0x7a55('0x2f'),_0x7a55('0x30'),_0x7a55('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![],'defaultValue':_0x7a55('0x32'),'set':function(_0x5652bf){this['setDataValue']('nat',_0x5652bf?_0x5652bf[_0x7a55('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x7a55('0x33'))?this[_0x7a55('0xc')](_0x7a55('0x33'))[_0x7a55('0x34')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x7a55('0x4')]},'namedcallgroup':{'type':Sequelize[_0x7a55('0x4')]},'pickupgroup':{'type':Sequelize[_0x7a55('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7a55('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x7a55('0x4')],'allowNull':![],'defaultValue':_0x7a55('0x35')},'allow':{'type':Sequelize[_0x7a55('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x104538){this[_0x7a55('0x6')](_0x7a55('0x36'),_0x104538?_0x104538[_0x7a55('0x27')](';'):_0x7a55('0x37'));},'get':function(){return this['getDataValue']('allow')?this[_0x7a55('0xc')](_0x7a55('0x36'))['split'](';'):null;},'comment':_0x7a55('0x38')},'autoframing':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![],'set':function(_0x4d877e){this[_0x7a55('0x6')](_0x7a55('0x39'),_0x4d877e?_0x4d877e[_0x7a55('0x27')](','):null);},'get':function(){return this[_0x7a55('0xc')]('insecure')?this[_0x7a55('0xc')](_0x7a55('0x39'))[_0x7a55('0x34')](','):null;},'comment':_0x7a55('0x3a')},'trustrpid':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no',_0x7a55('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x7a55('0x10')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![],'defaultValue':_0x7a55('0x3c')},'amaflags':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x7a55('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x7a55('0x10')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x3d'),_0x7a55('0x3e'),_0x7a55('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x7a55('0x10')]('uac',_0x7a55('0x40')),'allowNull':!![],'defaultValue':_0x7a55('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x7a55('0x2e')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x7a55('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x7a55('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x7a55('0x10')]('yes','no',_0x7a55('0x41'),_0x7a55('0x42')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7a55('0x43'),_0x7a55('0x44'),_0x7a55('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x7a55('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x7a55('0x10')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x7a55('0x10')](_0x7a55('0x2e'),'no',_0x7a55('0x2f'),_0x7a55('0x30'),_0x7a55('0x46')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x7a55('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x7a55('0x1a')]},'passwordResetAt':{'type':Sequelize[_0x7a55('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x7a55('0x47')]},'showWebBar':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0,'set':function(_0x188067){this[_0x7a55('0x6')](_0x7a55('0x48'),_0x188067);var _0x5475cd=this[_0x7a55('0x49')]({'plain':!![]});switch(_0x188067){case 0x0:case 0x1:var _0x17939b=_0x5475cd[_0x7a55('0x26')]?_['isArray'](_0x5475cd[_0x7a55('0x26')])?_0x5475cd[_0x7a55('0x26')][_0x7a55('0x27')]():_0x5475cd[_0x7a55('0x26')]:_0x7a55('0x25');if(_0x17939b==='wss'){_0x17939b='udp';}this['setDataValue'](_0x7a55('0x26'),_0x17939b);this['setDataValue'](_0x7a55('0x4a'),'no');this[_0x7a55('0x6')]('avpf',null);this[_0x7a55('0x6')](_0x7a55('0x4b'),null);this[_0x7a55('0x6')](_0x7a55('0x4c'),null);this['setDataValue'](_0x7a55('0x4d'),null);this[_0x7a55('0x6')](_0x7a55('0x4e'),null);this[_0x7a55('0x6')](_0x7a55('0x4f'),null);this['setDataValue'](_0x7a55('0x50'),null);this[_0x7a55('0x6')](_0x7a55('0x51'),null);this[_0x7a55('0x6')](_0x7a55('0x52'),'no');break;case 0x2:this[_0x7a55('0x6')]('transport','wss');this[_0x7a55('0x6')]('encryption',_0x7a55('0x2e'));this['setDataValue'](_0x7a55('0x53'),_0x7a55('0x2e'));this[_0x7a55('0x6')]('force_avp',_0x7a55('0x2e'));this[_0x7a55('0x6')]('icesupport',_0x7a55('0x2e'));this[_0x7a55('0x6')]('dtlsenable',_0x7a55('0x2e'));this[_0x7a55('0x6')](_0x7a55('0x4e'),'no');this['setDataValue'](_0x7a55('0x4f'),_0x7a55('0x45'));this['setDataValue'](_0x7a55('0x50'),_0x5475cd[_0x7a55('0x50')]||'/etc/pki/tls/certs/motion.crt');this[_0x7a55('0x6')]('dtlsprivatekey',_0x5475cd['dtlsprivatekey']||_0x7a55('0x54'));this[_0x7a55('0x6')](_0x7a55('0x52'),_0x7a55('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x7a55('0x47')],'set':function(_0x1fcab1){this[_0x7a55('0x6')]('permissions',_0x1fcab1?_0x1fcab1[_0x7a55('0x27')](','):[]);},'get':function(){return this[_0x7a55('0xc')](_0x7a55('0x55'))?_[_0x7a55('0x56')](this[_0x7a55('0xc')](_0x7a55('0x55'))[_0x7a55('0x34')](','),function(_0x1fe196){return parseInt(_0x1fe196,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x7a55('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x7a55('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x7a55('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x7a55('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x7a55('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x7a55('0x57')],'get':function(){return this[_0x7a55('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0x7a55('0xc')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0x7a55('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x7a55('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![],'set':function(_0x4cc405){if(typeof _0x4cc405===_0x7a55('0x58')){var _0x593559=_0x4cc405==='1'?!![]:_0x4cc405==='0'?![]:_0x4cc405==='true'?!![]:_0x4cc405===_0x7a55('0x59')?![]:![];this['setDataValue'](_0x7a55('0x5a'),_0x593559);}else{this[_0x7a55('0x6')](_0x7a55('0x5a'),_0x4cc405);}}},'blocked':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![],'set':function(_0x1d8a15){this['setDataValue'](_0x7a55('0x5b'),_0x1d8a15);if(_0x1d8a15===!![]){this['setDataValue']('blockedAt',moment());this[_0x7a55('0x6')]('loginAttempts',0x0);}else{this['setDataValue'](_0x7a55('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0x7a55('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x7a55('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x7a55('0x16')](0x5)[_0x7a55('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x7a55('0x19')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'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 a73bdb2..82bd113 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 _0xc4aa=['dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','resolve','queues','isEmpty','teams','col','toString','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','offline','pause','unknown','unavailable','ringing','voiceStatus','busy','slice','charAt','field','ui.','InteractionId','OpenTabs','moment','bluebird','util','path','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','redis','defaults','localhost','client','http','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','get','role','admin','user','agent','telephone','filter','ignore','map','value','includes','find','name','destroy','then','sendStatus','stack','send','index','User','rawAttributes','fieldName','password','salt','getOptions','where','include','attributes','push','findAll','rows','openTabs','true','chat','dataValues','sms','fax','mail','show','params','differenceBy','keys','query','filters','intersection','model','fields','length','includeAll','merge','openchannel','whatsapp','all','update','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','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','from','mailbox','VoiceMail','fullname','permissions','102','110','105','108','109','100','115','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','settingsEnabled','userProfileId','create','UserProfileSection','Telephones','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','checkUserLimits','Agents','autoAssociation','compact','UserProfileResource','changePassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','oldPassword','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','VoiceQueue','format','each','upsert','remove','isArray','QueueId','Queue:remove','voice','UserVoiceQueueRt','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','CmContact','order','sort','pick','options','hasOwnProperty','List','Tag','Tags','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','SIP/%s','intrf','user:%s','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','logout','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','manual','%s%s','Pause','Team','getTeams','addTeams','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','Whatsapp','getOpenchannelQueues','flatten','addAgent','getDataValue','Queue:save','TeamVoicePrefix','UserVoicePrefix','getWhatsappQueues','getFaxQueues','Fax','Openchannel','transaction','VoicePrefixId','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','CmHopper','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$overlap','$any','lastName'];(function(_0x166756,_0xd2d0a5){var _0x250d69=function(_0x1f459c){while(--_0x1f459c){_0x166756['push'](_0x166756['shift']());}};_0x250d69(++_0xd2d0a5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var moment=require(_0xac4a('0x0'));var BPromise=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var path=require(_0xac4a('0x3'));var fs=require('fs');var _=require(_0xac4a('0x4'));var squel=require(_0xac4a('0x5'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xac4a('0x6'));var logger=require(_0xac4a('0x7'))(_0xac4a('0x8'));var utils=require(_0xac4a('0x9'));var config=require(_0xac4a('0xa'));var licenseUtil=require(_0xac4a('0xb'));var db=require(_0xac4a('0xc'))['db'];var socket=require(_0xac4a('0xd'))(new Redis(config['redis']));require('./user.socket')[_0xac4a('0xe')](socket);config[_0xac4a('0xf')]=_[_0xac4a('0x10')](config['redis'],{'host':_0xac4a('0x11'),'port':0x18eb});var client=jayson[_0xac4a('0x12')][_0xac4a('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x4d4acc,_0x30135d,_0x488e3c,_0x2f062c){return new BPromise(function(_0x4855b6,_0x333ca5){var _0x2a0776=_0x2f062c||client;return _0x2a0776[_0xac4a('0x14')](_0x4d4acc,_0x488e3c)['then'](function(_0x21a79){logger[_0xac4a('0x15')](_0xac4a('0x16'),_0x30135d,_0xac4a('0x17'));logger[_0xac4a('0x18')](_0xac4a('0x19'),_0x30135d,_0xac4a('0x17'),JSON[_0xac4a('0x1a')](_0x21a79));if(_0x21a79[_0xac4a('0x1b')]){if(_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1c')]===0x1f4){logger[_0xac4a('0x1b')]('User,\x20%s,\x20%s',_0x30135d,_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);return _0x333ca5(_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);}logger[_0xac4a('0x1b')](_0xac4a('0x16'),_0x30135d,_0x21a79[_0xac4a('0x1b')][_0xac4a('0x1d')]);return _0x4855b6(_0x21a79['error']['message']);}else{logger[_0xac4a('0x15')](_0xac4a('0x16'),_0x30135d,_0xac4a('0x17'));_0x4855b6(_0x21a79['result'][_0xac4a('0x1d')]);}})[_0xac4a('0x1e')](function(_0x3752e4){logger[_0xac4a('0x1b')](_0xac4a('0x16'),_0x30135d,_0x3752e4);_0x333ca5(_0x3752e4);});});}function respondWithStatusCode(_0x3e829c,_0xe38996){_0xe38996=_0xe38996||0xcc;return function(_0x3ca790){if(_0x3ca790){return _0x3e829c['sendStatus'](_0xe38996);}return _0x3e829c[_0xac4a('0x1f')](_0xe38996)[_0xac4a('0x20')]();};}function respondWithResult(_0x599787,_0x3d7ce0){_0x3d7ce0=_0x3d7ce0||0xc8;return function(_0x4169c0){if(_0x4169c0){return _0x599787[_0xac4a('0x1f')](_0x3d7ce0)[_0xac4a('0x21')](_0x4169c0);}};}function respondWithFilteredResult(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){var _0x15435c=typeof _0x1b7998[_0xac4a('0x22')]===_0xac4a('0x23')&&typeof _0x1b7998[_0xac4a('0x24')]===_0xac4a('0x23');var _0x36054a=_0x2503d8[_0xac4a('0x25')];var _0x3bc318=_0x15435c?0x0:_0x1b7998[_0xac4a('0x22')];var _0x215a31=_0x15435c?_0x2503d8[_0xac4a('0x25')]:_0x1b7998[_0xac4a('0x22')]+_0x1b7998[_0xac4a('0x24')];var _0x20202c;if(_0x215a31>=_0x36054a){_0x215a31=_0x36054a;_0x20202c=0xc8;}else{_0x20202c=0xce;}_0x4d2d6c['status'](_0x20202c);return _0x4d2d6c[_0xac4a('0x26')](_0xac4a('0x27'),_0x3bc318+'-'+_0x215a31+'/'+_0x36054a)[_0xac4a('0x21')](_0x2503d8);}return null;};}function saveUpdates(_0x2772fe){return function(_0x116700){if(_0x116700){return _0x116700['update'](_0x2772fe)['then'](function(_0xdb7e){return _0xdb7e;});}return null;};}function removeEntity(_0x7a948b){return function(_0x1f12d5){if(_0x1f12d5){return _0x1f12d5['destroy']()['then'](function(){var _0x355755=_0x1f12d5[_0xac4a('0x28')]({'plain':!![]});if(_0x355755[_0xac4a('0x29')]===_0xac4a('0x2a'))return;var _0x17118e=[{'name':'Users','value':_0xac4a('0x2b'),'ignore':!![]},{'name':'Agents','value':_0xac4a('0x2c'),'ignore':![]},{'name':'Telephones','value':_0xac4a('0x2d'),'ignore':![]}];var _0xfbe355=_(_0x17118e)[_0xac4a('0x2e')](_0xac4a('0x2f'))[_0xac4a('0x30')](_0xac4a('0x31'))[_0xac4a('0x31')]();if(_[_0xac4a('0x32')](_0xfbe355,_0x355755[_0xac4a('0x29')])){return;}var _0xfd7c16=_[_0xac4a('0x33')](_0x17118e,[_0xac4a('0x31'),_0x355755[_0xac4a('0x29')]])[_0xac4a('0x34')];return db['UserProfileResource'][_0xac4a('0x35')]({'where':{'type':_0xfd7c16,'resourceId':_0x355755['id']}})[_0xac4a('0x36')](function(){return _0x1f12d5;});})['then'](function(){_0x7a948b[_0xac4a('0x1f')](0xcc)[_0xac4a('0x20')]();});}};}function handleEntityNotFound(_0x565164){return function(_0x58804b){if(!_0x58804b){_0x565164[_0xac4a('0x37')](0x194);}return _0x58804b;};}function handleError(_0x1ba096,_0x1b42b6){_0x1b42b6=_0x1b42b6||0x1f4;return function(_0x3de9e2){logger['error'](_0x3de9e2[_0xac4a('0x38')]);if(_0x3de9e2[_0xac4a('0x34')]){delete _0x3de9e2['name'];}_0x1ba096[_0xac4a('0x1f')](_0x1b42b6)[_0xac4a('0x39')](_0x3de9e2);};}exports[_0xac4a('0x3a')]=function(_0x5f0eb8,_0x121328){var _0x357f06={},_0x1b5427={'count':0x0,'rows':[]};var _0x4e0445=_(db[_0xac4a('0x3b')][_0xac4a('0x3c')])['map'](function(_0x59bebf){return{'name':_0x59bebf[_0xac4a('0x3d')],'type':_0x59bebf['type']['key']};})['filter'](function(_0x4fee3a){return!_[_0xac4a('0x32')]([_0xac4a('0x3e'),_0xac4a('0x3f')],_0x4fee3a[_0xac4a('0x34')]);})[_0xac4a('0x31')]();_0x357f06=qs[_0xac4a('0x40')](_0x4e0445,_0x5f0eb8);var _0x4220e2={'where':_0x357f06[_0xac4a('0x41')]};return db[_0xac4a('0x3b')][_0xac4a('0x25')](_0x4220e2)[_0xac4a('0x36')](function(_0x1c2a87){_0x1b5427['count']=_0x1c2a87;if(_0x5f0eb8['query']['includeAll']){_0x357f06[_0xac4a('0x42')]=[{'all':!![]}];}if(!_[_0xac4a('0x32')](_0x357f06[_0xac4a('0x43')],'id')){_0x357f06[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db[_0xac4a('0x3b')][_0xac4a('0x45')](_0x357f06);})[_0xac4a('0x36')](function(_0x3e9973){_0x1b5427[_0xac4a('0x46')]=_0x3e9973;if(_0x5f0eb8['query'][_0xac4a('0x47')]===_0xac4a('0x48')){var _0x3d9595=[];for(var _0x3f24a1=0x0;_0x3f24a1<_0x1b5427[_0xac4a('0x46')]['length'];_0x3f24a1++){_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x49'),_0x1b5427['rows'][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595['push'](get_open_tabs(_0xac4a('0x4b'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('openchannel',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));_0x3d9595[_0xac4a('0x44')](get_open_tabs('whatsapp',_0x1b5427[_0xac4a('0x46')][_0x3f24a1][_0xac4a('0x4a')]));}return BPromise['all'](_0x3d9595)[_0xac4a('0x36')](function(_0x5a7f6e){return _0x1b5427;});}else{return _0x1b5427;}})[_0xac4a('0x36')](respondWithFilteredResult(_0x121328,_0x357f06))[_0xac4a('0x1e')](handleError(_0x121328,null));};exports[_0xac4a('0x4e')]=function(_0x5e3581,_0x588374){var _0x42fd9d={'raw':![],'where':{'id':_0x5e3581[_0xac4a('0x4f')]['id']}},_0x4aaeff={};_0x4aaeff['model']=_[_0xac4a('0x50')](_['keys'](db[_0xac4a('0x3b')][_0xac4a('0x3c')]),[_0xac4a('0x3e'),_0xac4a('0x3f')]);_0x4aaeff['query']=_[_0xac4a('0x51')](_0x5e3581[_0xac4a('0x52')]);_0x4aaeff[_0xac4a('0x53')]=_[_0xac4a('0x54')](_0x4aaeff[_0xac4a('0x55')],_0x4aaeff[_0xac4a('0x52')]);_0x42fd9d[_0xac4a('0x43')]=_['intersection'](_0x4aaeff[_0xac4a('0x55')],qs[_0xac4a('0x56')](_0x5e3581['query'][_0xac4a('0x56')]));_0x42fd9d[_0xac4a('0x43')]=_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x57')]?_0x42fd9d['attributes']:_0x4aaeff[_0xac4a('0x55')];if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x58')]){_0x42fd9d[_0xac4a('0x42')]=[{'all':!![]}];}_0x42fd9d=_[_0xac4a('0x59')]({},_0x42fd9d,_0x5e3581['options']);if(!_[_0xac4a('0x32')](_0x42fd9d['attributes'],'id')){_0x42fd9d[_0xac4a('0x43')][_0xac4a('0x44')]('id');}return db['User']['find'](_0x42fd9d)[_0xac4a('0x36')](handleEntityNotFound(_0x588374,null))[_0xac4a('0x36')](function(_0x4d448f){var _0x18d29c=[];values=_0x4d448f;if(_0x5e3581[_0xac4a('0x52')][_0xac4a('0x47')]===_0xac4a('0x48')){_0x18d29c['push'](get_open_tabs(_0xac4a('0x49'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x4d448f['dataValues']));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5b'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4c'),_0x4d448f[_0xac4a('0x4a')]));_0x18d29c[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4d'),_0x4d448f[_0xac4a('0x4a')]));return BPromise[_0xac4a('0x5c')](_0x18d29c);}else{return values;}})[_0xac4a('0x36')](function(_0x38dd4f){return values;})[_0xac4a('0x36')](respondWithResult(_0x588374,null))[_0xac4a('0x1e')](handleError(_0x588374,null));};exports[_0xac4a('0x5d')]=function(_0x11c753,_0x492aae){if(_0x11c753[_0xac4a('0x5e')]['id']){delete _0x11c753['body']['id'];}delete _0x11c753[_0xac4a('0x5e')]['role'];return db[_0xac4a('0x3b')]['find']({'where':{'id':_0x11c753[_0xac4a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x492aae,null))['then'](saveUpdates(_0x11c753[_0xac4a('0x5e')],null))[_0xac4a('0x36')](respondWithResult(_0x492aae,null))[_0xac4a('0x1e')](handleError(_0x492aae,null));};exports[_0xac4a('0x5f')]=function(_0x2f9940,_0xb7b884){return db['User'][_0xac4a('0x5f')]()['then'](respondWithResult(_0xb7b884,null))[_0xac4a('0x1e')](handleError(_0xb7b884,null));};exports['addContacts']=function(_0x347880,_0x19ce2c){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x347880[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x19ce2c,null))[_0xac4a('0x36')](function(_0xe3e375){if(_0xe3e375){return _0xe3e375[_0xac4a('0x60')](_0x347880[_0xac4a('0x5e')][_0xac4a('0x61')],_[_0xac4a('0x62')](_0x347880[_0xac4a('0x5e')],[_0xac4a('0x61'),'id'])||{});}})[_0xac4a('0x36')](respondWithResult(_0x19ce2c,null))[_0xac4a('0x1e')](handleError(_0x19ce2c,null));};function validateUser(_0x38cb4f){return new BPromise(function(_0x4a0156,_0xa90d71){if(_0x38cb4f[_0xac4a('0x63')])return _0x4a0156(_0x38cb4f);return db['Setting'][_0xac4a('0x64')](0x1)[_0xac4a('0x36')](function(_0x2d24c7){if(_0x2d24c7[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x38cb4f['password']);db['User'][_0xac4a('0x67')](_0xac4a('0x63'))[_0xac4a('0x36')](function(_0x148288){if(_[_0xac4a('0x68')](_0x148288)){_0x38cb4f[_0xac4a('0x63')]=_0x2d24c7[_0xac4a('0x69')]||0x1;return;}if(_[_0xac4a('0x68')](_0x2d24c7[_0xac4a('0x69')])||_0x2d24c7[_0xac4a('0x69')]===_0x148288){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;return;}if(_0x2d24c7['min_internal']>_0x148288){_0x38cb4f['internal']=_0x2d24c7[_0xac4a('0x69')];return;}return db[_0xac4a('0x6a')][_0xac4a('0x52')](_0xac4a('0x6b'),{'type':db[_0xac4a('0x6a')][_0xac4a('0x6c')][_0xac4a('0x6d')]})[_0xac4a('0x36')](function(_0x453d62){if(_0x453d62&&_0x453d62[_0xac4a('0x57')]){for(var _0xb09b89=0x0,_0xb12cc5=_0x453d62['length'];_0xb09b89<_0xb12cc5&&_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')]);_0xb09b89++){if(_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89][_0xac4a('0x6e')]){_0x38cb4f['internal']=_0x453d62[_0xb09b89][_0xac4a('0x6e')];}else if(_0x2d24c7['min_internal']>_0x453d62[_0xb09b89][_0xac4a('0x6e')]&&_0x2d24c7[_0xac4a('0x69')]<=_0x453d62[_0xb09b89]['to']){_0x38cb4f['internal']=_0x2d24c7['min_internal'];}}}if(_[_0xac4a('0x68')](_0x38cb4f[_0xac4a('0x63')])){_0x38cb4f[_0xac4a('0x63')]=_0x148288+0x1;}return _0x4a0156(_0x38cb4f);});});})['catch'](function(_0x3a0cf8){_0xa90d71(_0x3a0cf8);});});}function updateUser(_0x4d067d){return new BPromise(function(_0x114b11,_0x4a88c7){try{if(_0x4d067d['voicemail']){_0x4d067d[_0xac4a('0x6f')]=_0x4d067d['internal'];_0x4d067d[_0xac4a('0x70')]={'mailbox':_0x4d067d['internal'],'password':_0x4d067d[_0xac4a('0x3e')],'fullname':_0x4d067d[_0xac4a('0x71')],'email':_0x4d067d['email']};}if(_0x4d067d[_0xac4a('0x29')]==='agent'){if(!_0x4d067d[_0xac4a('0x72')])_0x4d067d[_0xac4a('0x72')]=['101',_0xac4a('0x73'),'103','113',_0xac4a('0x74'),'104',_0xac4a('0x75'),'106','107',_0xac4a('0x76'),_0xac4a('0x77'),_0xac4a('0x78'),'111','114',_0xac4a('0x79')];}_0x114b11(_0x4d067d);}catch(_0x9c0fa1){_0x4a88c7(_0x9c0fa1);}});}exports['create']=function(_0x4e93f5,_0x3824a2){if(_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2c'))throw new Error(_0xac4a('0x7a'));if(_0x4e93f5[_0xac4a('0x5e')][_0xac4a('0x29')]===_0xac4a('0x2b')&&_0x4e93f5[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_0x4e93f5[_0xac4a('0x5e')]['role']===_0xac4a('0x2a')&&_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7c'));}return licenseUtil['checkUserLimits']([_0x4e93f5[_0xac4a('0x5e')]])[_0xac4a('0x36')](function(){return validateUser(_0x4e93f5[_0xac4a('0x5e')]);})[_0xac4a('0x36')](function(_0x72c90c){return updateUser(_0x72c90c)[_0xac4a('0x36')](function(_0xd7bdd6){if(_0xd7bdd6['role']===_0xac4a('0x2a')){_0xd7bdd6[_0xac4a('0x7d')]=_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7d')];delete _0xd7bdd6[_0xac4a('0x7e')];}return _0xd7bdd6;});})[_0xac4a('0x36')](function(_0x547eec){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x547eec,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]});})['then'](function(_0x21a384){if(_0x4e93f5['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x21a384;if(_0x4e93f5['user']['role']!==_0xac4a('0x2b'))return _0x21a384;return db[_0xac4a('0x80')][_0xac4a('0x33')]({'where':{'name':_0x21a384['role']===_0xac4a('0x2c')?'Agents':_0xac4a('0x81'),'userProfileId':_0x4e93f5[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x2e2c92){if(!_0x2e2c92||_0x2e2c92['autoAssociation']!=0x0)return _0x21a384;return db['UserProfileResource'][_0xac4a('0x7f')]({'name':_0x21a384[_0xac4a('0x34')],'resourceId':_0x21a384['id'],'type':_0x2e2c92[_0xac4a('0x34')],'sectionId':_0x2e2c92['id']},{})[_0xac4a('0x36')](function(){return _0x21a384;});})[_0xac4a('0x1e')](function(_0x3c5bbc){logger[_0xac4a('0x1b')](_0xac4a('0x82'),_0x3c5bbc);throw _0x3c5bbc;});})['then'](respondWithResult(_0x3824a2,0xc9))['catch'](handleError(_0x3824a2,null));};exports[_0xac4a('0x83')]=function(_0x31cc9a,_0x247eee){var _0x950e60=_0x31cc9a[_0xac4a('0x5e')];var _0x2ea4a4=[];if(_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]==='agent')throw new Error('Unauthorized');if(_[_0xac4a('0x84')](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2b')])&&_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x29')]!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x7b'));}if(_['some'](_0x950e60,[_0xac4a('0x29'),_0xac4a('0x2a')])&&_0x31cc9a[_0xac4a('0x2b')]['role']!==_0xac4a('0x2a')){throw new Error(_0xac4a('0x85'));}return licenseUtil[_0xac4a('0x86')](_0x950e60)[_0xac4a('0x36')](function(){return validateUser(_0x950e60[0x0]);})[_0xac4a('0x36')](function(){for(var _0x27d023=0x1;_0x27d023<_0x950e60[_0xac4a('0x57')];_0x27d023++){var _0x2ef42a=_0x950e60[_0x27d023-0x1][_0xac4a('0x63')];if(!_0x950e60[_0x27d023]['internal'])_0x950e60[_0x27d023][_0xac4a('0x63')]=_0x2ef42a+0x1;_0x2ea4a4['push'](validateUser(_0x950e60[_0x27d023]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){_0x2ea4a4=[];for(var _0x3184b3=0x0;_0x3184b3<_0x950e60[_0xac4a('0x57')];_0x3184b3++){_0x2ea4a4[_0xac4a('0x44')](updateUser(_0x950e60[_0x3184b3]));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);})[_0xac4a('0x36')](function(){return BPromise['each'](_0x950e60,function(_0x2b883a){return db[_0xac4a('0x3b')][_0xac4a('0x7f')](_0x2b883a,{'include':[{'model':db[_0xac4a('0x70')],'as':_0xac4a('0x70')}]})['then'](function(_0x1b37d9){_0x2b883a['id']=_0x1b37d9['id'];return _0x2b883a;});});})[_0xac4a('0x36')](function(_0x4f2b19){if(_0x31cc9a['body'][_0xac4a('0x29')]===_0xac4a('0x2b'))return _0x4f2b19;if(_0x31cc9a['user'][_0xac4a('0x29')]!==_0xac4a('0x2b'))return _0x4f2b19;var _0x6afaba=_[_0xac4a('0x84')](_0x4f2b19,function(_0x31df2d){return _0x31df2d[_0xac4a('0x29')]==='agent'||_0x31df2d[_0xac4a('0x29')]===_0xac4a('0x2d');});if(!_0x6afaba)return _0x4f2b19;return db[_0xac4a('0x80')]['findAll']({'where':{'name':{'$or':[_0xac4a('0x87'),_0xac4a('0x81')]},'userProfileId':_0x31cc9a[_0xac4a('0x2b')][_0xac4a('0x7e')]},'raw':!![]})[_0xac4a('0x36')](function(_0x23d635){if(_['isEmpty'](_0x23d635)||!_[_0xac4a('0x84')](_0x23d635,[_0xac4a('0x88'),0x0]))return _0x4f2b19;_0x2ea4a4=[];var _0x5ab83b=_(_0x23d635)[_0xac4a('0x30')](function(_0x55054a){if(_0x55054a[_0xac4a('0x88')]===0x1)return;return _0x55054a[_0xac4a('0x34')]==='Agents'?_0xac4a('0x2c'):'telephone';})[_0xac4a('0x89')]()['value']();for(var _0x3c601e=0x0;_0x3c601e<_0x4f2b19[_0xac4a('0x57')];_0x3c601e++){if(!_[_0xac4a('0x32')](_0x5ab83b,_0x4f2b19[_0x3c601e][_0xac4a('0x29')]))return;var _0xc38492=_0x4f2b19[_0x3c601e][_0xac4a('0x29')]===_0xac4a('0x2c')?_0xac4a('0x87'):_0xac4a('0x81');_0x2ea4a4[_0xac4a('0x44')](db[_0xac4a('0x8a')][_0xac4a('0x7f')]({'name':_0x4f2b19[_0x3c601e][_0xac4a('0x34')],'resourceId':_0x4f2b19[_0x3c601e]['id'],'type':_0xc38492,'sectionId':_[_0xac4a('0x33')](_0x23d635,['name',_0xc38492])['id']},{}));}return BPromise[_0xac4a('0x5c')](_0x2ea4a4);});})[_0xac4a('0x36')](respondWithResult(_0x247eee,0xc9))['catch'](handleError(_0x247eee,null));};exports[_0xac4a('0x8b')]=function(_0x31d190,_0x1b10ad){if(_0x31d190[_0xac4a('0x5e')]['id']){delete _0x31d190[_0xac4a('0x5e')]['id'];}return db['User'][_0xac4a('0x33')]({'where':{'id':_0x31d190['params']['id']}})[_0xac4a('0x36')](function(_0x28ae76){if(!_0x28ae76)return null;if(_0x28ae76['id']===_0x31d190[_0xac4a('0x2b')]['id']){if(!_0x31d190[_0xac4a('0x5e')]['oldPassword']||!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x8e'));}if(!_0x28ae76['authenticate'](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')])){throw new db[(_0xac4a('0x8c'))]['ValidationError'](_0xac4a('0x90'));}if(_0x31d190[_0xac4a('0x5e')][_0xac4a('0x8f')]===_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')]){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x92'));}}else if(_0x31d190['user'][_0xac4a('0x29')]==='admin'){if(!_0x31d190['body']['newPassword']){throw new db['Sequelize']['ValidationError'](_0xac4a('0x93'));}}else if(_0x31d190[_0xac4a('0x2b')][_0xac4a('0x29')]===_0xac4a('0x2b')){if(!_0x31d190[_0xac4a('0x5e')]['newPassword']){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x93'));}if(_0x28ae76[_0xac4a('0x29')]!==_0xac4a('0x2c')){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}}else{throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0x7a'));}return _0x28ae76;})[_0xac4a('0x36')](handleEntityNotFound(_0x1b10ad,null))[_0xac4a('0x36')](function(_0x303d5d){return db[_0xac4a('0x94')][_0xac4a('0x95')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xac4a('0x96')]})[_0xac4a('0x36')](function(_0x51993a){if(_0x51993a[_0xac4a('0x65')])authService[_0xac4a('0x66')](_0x31d190['body']['newPassword']);if(!_0x51993a[_0xac4a('0x97')]||!_0x303d5d[_0xac4a('0x98')])return _0x303d5d;authService[_0xac4a('0x99')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d['previousPasswords'],_0x51993a[_0xac4a('0x96')]);return _0x303d5d;})['then'](saveUpdates({'password':_0x31d190['body']['newPassword'],'passwordResetAt':_0x31d190[_0xac4a('0x2b')]['id']==_0x31d190[_0xac4a('0x4f')]['id']?moment():null,'previousPasswords':authService[_0xac4a('0x9a')](_0x31d190[_0xac4a('0x5e')][_0xac4a('0x91')],_0x303d5d[_0xac4a('0x98')])},null));})[_0xac4a('0x36')](respondWithResult(_0x1b10ad,null))[_0xac4a('0x1e')](handleError(_0x1b10ad,null));};exports['addQueues']=function(_0x5e1662,_0x53bcbc){var _0x3305a5=_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x9b')];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5e1662[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29'),_0xac4a('0x9c'),_0xac4a('0x9d'),_0xac4a('0x9e'),_0xac4a('0x9f')]})[_0xac4a('0x36')](handleEntityNotFound(_0x53bcbc,null))[_0xac4a('0x36')](function(_0x356a6b){if(_0x356a6b){if(!utils[_0xac4a('0xa0')](_0x3305a5)){throw new db[(_0xac4a('0x8c'))][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x356a6b[_0xac4a('0xa2')+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+_0xac4a('0xa5')](_0x5e1662['body'][_0xac4a('0x61')],{'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0})[_0xac4a('0xa7')](function(_0x237312){for(var _0x31afd2=0x0;_0x31afd2<_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]['length'];_0x31afd2+=0x1){var _0x5127ea={'UserId':Number(_0x5e1662[_0xac4a('0x4f')]['id'])};_0x5127ea[_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'QueueId']=Number(_0x5e1662['body']['ids'][_0x31afd2]);socket[_0xac4a('0xa8')]('user'+_[_0xac4a('0xa3')](_0x3305a5[_0xac4a('0xa4')]())+'Queue:save',_0x5127ea);}return _0x237312;})[_0xac4a('0x36')](function(){if(_0x3305a5==='voice'){return db[_0xac4a('0xa9')][_0xac4a('0x45')]({'where':{'id':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0x61')]||[]},'raw':!![],'attributes':['id',_0xac4a('0x34')]});}})[_0xac4a('0x36')](function(_0x5e0602){var _0x25bf23=_0x356a6b[_0xac4a('0x28')]({'plain':!![]});var _0x2c03a1=[];if(_0x3305a5==='voice'&&_0x25bf23[_0xac4a('0x29')]===_0xac4a('0x2c')&&_0x25bf23[_0xac4a('0x9c')]){for(var _0x247856=0x0;_0x247856<_0x5e0602['length'];_0x247856+=0x1){_0x2c03a1[_0xac4a('0x44')]({'membername':_0x25bf23[_0xac4a('0x34')],'UserId':_0x25bf23['id'],'queue_name':_0x5e0602[_0x247856][_0xac4a('0x34')],'VoiceQueueId':_0x5e0602[_0x247856]['id'],'interface':_[_0xac4a('0x68')](_0x25bf23[_0xac4a('0x9f')])?util[_0xac4a('0xaa')]('SIP/%s',_0x25bf23['name']):_0x25bf23[_0xac4a('0x9f')],'paused':_0x25bf23[_0xac4a('0x9e')]||![],'penalty':_0x5e1662[_0xac4a('0x5e')][_0xac4a('0xa6')]||0x0});}return BPromise[_0xac4a('0xab')](_0x2c03a1,function(_0x1a12a2){return db['UserVoiceQueueRt'][_0xac4a('0xac')](_0x1a12a2);});}return _0x356a6b;});}})['then'](respondWithStatusCode(_0x53bcbc,null))[_0xac4a('0x1e')](handleError(_0x53bcbc,null));};exports['removeQueues']=function(_0xa1df14,_0x13b938){var _0x15f35a;return db[_0xac4a('0x3b')]['find']({'where':{'id':_0xa1df14[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0x34'),_0xac4a('0x29')]})[_0xac4a('0x36')](handleEntityNotFound(_0x13b938,null))[_0xac4a('0x36')](function(_0x520001){if(_0x520001){_0x15f35a=_0x520001;if(!_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')]||!utils[_0xac4a('0xa0')](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')])){throw new db['Sequelize'][(_0xac4a('0x8d'))](_0xac4a('0xa1'));}return _0x520001[_0xac4a('0xad')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+'Queues'](_0xa1df14['query'][_0xac4a('0x61')]);}})[_0xac4a('0x36')](function(_0x17f815){if(_[_0xac4a('0xae')](_0xa1df14[_0xac4a('0x52')]['ids'])){for(var _0x293d49=0x0;_0x293d49<_0xa1df14[_0xac4a('0x52')]['ids'][_0xac4a('0x57')];_0x293d49+=0x1){var _0x11faad={'UserId':Number(_0xa1df14[_0xac4a('0x4f')]['id'])};_0x11faad[_['capitalize'](_0xa1df14[_0xac4a('0x52')][_0xac4a('0x9b')][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')][_0x293d49]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14['query'][_0xac4a('0x9b')][_0xac4a('0xa4')]())+'Queue:remove',_0x11faad);}}else{var _0x11faad={'UserId':Number(_0xa1df14['params']['id'])};_0x11faad[_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel'][_0xac4a('0xa4')]())+_0xac4a('0xaf')]=Number(_0xa1df14[_0xac4a('0x52')][_0xac4a('0x61')]);socket[_0xac4a('0xa8')](_0xac4a('0x2b')+_[_0xac4a('0xa3')](_0xa1df14[_0xac4a('0x52')]['channel']['toLowerCase']())+_0xac4a('0xb0'),_0x11faad);}return _0x17f815;})['then'](function(){if(_0xa1df14['query'][_0xac4a('0x9b')]===_0xac4a('0xb1')){return db[_0xac4a('0xb2')]['destroy']({'where':{'UserId':_0xa1df14[_0xac4a('0x4f')]['id'],'VoiceQueueId':_0xa1df14[_0xac4a('0x52')]['ids']},'individualHooks':!![]})['then'](function(){return _0x15f35a;});}return _0x15f35a;})[_0xac4a('0x36')](respondWithStatusCode(_0x13b938,null))[_0xac4a('0x1e')](handleError(_0x13b938,null));};exports[_0xac4a('0xb3')]=function(_0x368546,_0x4fadd1){_0x368546[_0xac4a('0x5e')][_0xac4a('0xb4')]=_0x368546[_0xac4a('0xb5')]['filename'];return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x368546[_0xac4a('0x4f')]['id']}})[_0xac4a('0x36')](handleEntityNotFound(_0x4fadd1,null))[_0xac4a('0x36')](saveUpdates(_0x368546['body'],null))['then'](respondWithResult(_0x4fadd1,null))[_0xac4a('0x1e')](handleError(_0x4fadd1,null));};exports[_0xac4a('0xb6')]=function(_0x1774e5,_0x110e16){var _0x14ca03=path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xb9'));return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x1774e5[_0xac4a('0x4f')]['id']},'attributes':['id',_0xac4a('0xb4')],'raw':!![]})[_0xac4a('0x36')](handleEntityNotFound(_0x110e16,null))['then'](function(_0x3ef9b2){if(_0x3ef9b2){if(_['isNil'](_0x3ef9b2['userpic'])){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}else{if(!fs[_0xac4a('0xbb')](path[_0xac4a('0xb7')](config[_0xac4a('0xb8')],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]))){return _0x110e16[_0xac4a('0xba')](_0x14ca03);}return _0x110e16[_0xac4a('0xba')](path[_0xac4a('0xb7')](config['root'],_0xac4a('0xbc'),_0x3ef9b2[_0xac4a('0xb4')]));}}})[_0xac4a('0x1e')](handleError(_0x110e16,null));};exports[_0xac4a('0xbd')]=function(_0x5c0bb8,_0x5b1934){return db[_0xac4a('0x3b')][_0xac4a('0x33')]({'where':{'id':_0x5c0bb8[_0xac4a('0x4f')]['id']},'attributes':['id']})[_0xac4a('0x36')](handleEntityNotFound(_0x5b1934,null))[_0xac4a('0x36')](function(_0x254de8){var _0x1c7ea7=[];values=_0x254de8[_0xac4a('0x4a')];_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('chat',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x4b'),_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs(_0xac4a('0x5a'),_0x254de8['dataValues']));_0x1c7ea7['push'](get_open_tabs('whatsapp',_0x254de8[_0xac4a('0x4a')]));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('fax',_0x254de8['dataValues']));_0x1c7ea7[_0xac4a('0x44')](get_open_tabs('mail',_0x254de8[_0xac4a('0x4a')]));return BPromise['all'](_0x1c7ea7);})[_0xac4a('0x36')](function(_0x2abd82){var _0x1888c3=[];if(_0x2abd82){for(var _0x27e640=0x0;_0x27e640=_0x393005){_0x5f0a53=_0x393005;_0x79d653=0xc8;}else{_0x79d653=0xce;}_0x5882ba['status'](_0x79d653);return _0x5882ba[_0xf33a('0x24')](_0xf33a('0x25'),_0x4af24a+'-'+_0x5f0a53+'/'+_0x393005)[_0xf33a('0x21')](_0x3f9ef7);}return null;};}function saveUpdates(_0x729fca){return function(_0x4552c9){if(_0x4552c9){return _0x4552c9[_0xf33a('0x26')](_0x729fca)[_0xf33a('0x13')](function(_0x1246ff){return _0x1246ff;});}return null;};}function removeEntity(_0x26e81){return function(_0xf6f9be){if(_0xf6f9be){return _0xf6f9be[_0xf33a('0x27')]()[_0xf33a('0x13')](function(){var _0x22c9f2=_0xf6f9be[_0xf33a('0x28')]({'plain':!![]});if(_0x22c9f2[_0xf33a('0x29')]==='admin')return;var _0x627fd2=[{'name':_0xf33a('0x2a'),'value':_0xf33a('0x2b'),'ignore':!![]},{'name':_0xf33a('0x2c'),'value':'agent','ignore':![]},{'name':_0xf33a('0x2d'),'value':_0xf33a('0x2e'),'ignore':![]}];var _0x2d9a9d=_(_0x627fd2)[_0xf33a('0x2f')](_0xf33a('0x30'))[_0xf33a('0x31')]('value')[_0xf33a('0x32')]();if(_[_0xf33a('0x33')](_0x2d9a9d,_0x22c9f2[_0xf33a('0x29')])){return;}var _0x300007=_[_0xf33a('0x34')](_0x627fd2,['value',_0x22c9f2['role']])[_0xf33a('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x300007,'resourceId':_0x22c9f2['id']}})['then'](function(){return _0xf6f9be;});})[_0xf33a('0x13')](function(){_0x26e81[_0xf33a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21f250){return function(_0x55f457){if(!_0x55f457){_0x21f250[_0xf33a('0x36')](0x194);}return _0x55f457;};}function handleError(_0x1f11b3,_0x395ad3){_0x395ad3=_0x395ad3||0x1f4;return function(_0x2a8e9e){logger[_0xf33a('0x18')](_0x2a8e9e[_0xf33a('0x37')]);if(_0x2a8e9e['name']){delete _0x2a8e9e[_0xf33a('0x35')];}_0x1f11b3[_0xf33a('0x1f')](_0x395ad3)['send'](_0x2a8e9e);};}exports[_0xf33a('0x38')]=function(_0x3793b4,_0x3e0a98){var _0x516336={},_0x7a06e1={'count':0x0,'rows':[]};var _0x1650c=_(db[_0xf33a('0x39')][_0xf33a('0x3a')])[_0xf33a('0x31')](function(_0x7a6aa4){return{'name':_0x7a6aa4[_0xf33a('0x3b')],'type':_0x7a6aa4[_0xf33a('0x3c')][_0xf33a('0x3d')]};})['filter'](function(_0x31028b){return!_[_0xf33a('0x33')](['password',_0xf33a('0x3e')],_0x31028b['name']);})['value']();_0x516336=qs[_0xf33a('0x3f')](_0x1650c,_0x3793b4);var _0x893cef={'where':_0x516336['where']};return db[_0xf33a('0x39')][_0xf33a('0x40')](_0x893cef)[_0xf33a('0x13')](function(_0x5776b1){_0x7a06e1[_0xf33a('0x40')]=_0x5776b1;if(_0x3793b4[_0xf33a('0x41')]['includeAll']){_0x516336[_0xf33a('0x42')]=[{'all':!![]}];}if(!_[_0xf33a('0x33')](_0x516336[_0xf33a('0x43')],'id')){_0x516336[_0xf33a('0x43')][_0xf33a('0x44')]('id');}return db['User'][_0xf33a('0x45')](_0x516336);})[_0xf33a('0x13')](function(_0x2325eb){_0x7a06e1[_0xf33a('0x46')]=_0x2325eb;if(_0x3793b4[_0xf33a('0x41')]['openTabs']===_0xf33a('0x47')){var _0x4700df=[];for(var _0x6ae3ef=0x0;_0x6ae3ef<_0x7a06e1['rows'][_0xf33a('0x48')];_0x6ae3ef++){_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));_0x4700df[_0xf33a('0x44')](get_open_tabs('sms',_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4b'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4c'),_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4d'),_0x7a06e1['rows'][_0x6ae3ef]['dataValues']));_0x4700df[_0xf33a('0x44')](get_open_tabs('whatsapp',_0x7a06e1[_0xf33a('0x46')][_0x6ae3ef][_0xf33a('0x4a')]));}return BPromise[_0xf33a('0x4e')](_0x4700df)[_0xf33a('0x13')](function(_0xecc82f){return _0x7a06e1;});}else{return _0x7a06e1;}})[_0xf33a('0x13')](respondWithFilteredResult(_0x3e0a98,_0x516336))[_0xf33a('0x1e')](handleError(_0x3e0a98,null));};exports[_0xf33a('0x4f')]=function(_0x205409,_0xbe98a9){var _0x704817={'raw':![],'where':{'id':_0x205409[_0xf33a('0x50')]['id']}},_0x4107b1={};_0x4107b1[_0xf33a('0x51')]=_[_0xf33a('0x52')](_[_0xf33a('0x53')](db[_0xf33a('0x39')][_0xf33a('0x3a')]),[_0xf33a('0x54'),_0xf33a('0x3e')]);_0x4107b1[_0xf33a('0x41')]=_[_0xf33a('0x53')](_0x205409[_0xf33a('0x41')]);_0x4107b1[_0xf33a('0x55')]=_[_0xf33a('0x56')](_0x4107b1[_0xf33a('0x51')],_0x4107b1[_0xf33a('0x41')]);_0x704817[_0xf33a('0x43')]=_[_0xf33a('0x56')](_0x4107b1['model'],qs[_0xf33a('0x57')](_0x205409[_0xf33a('0x41')]['fields']));_0x704817[_0xf33a('0x43')]=_0x704817[_0xf33a('0x43')][_0xf33a('0x48')]?_0x704817['attributes']:_0x4107b1[_0xf33a('0x51')];if(_0x205409[_0xf33a('0x41')][_0xf33a('0x58')]){_0x704817['include']=[{'all':!![]}];}_0x704817=_[_0xf33a('0x59')]({},_0x704817,_0x205409['options']);if(!_[_0xf33a('0x33')](_0x704817[_0xf33a('0x43')],'id')){_0x704817['attributes']['push']('id');}return db[_0xf33a('0x39')][_0xf33a('0x34')](_0x704817)[_0xf33a('0x13')](handleEntityNotFound(_0xbe98a9,null))['then'](function(_0x469d75){var _0x38c5df=[];values=_0x469d75;if(_0x205409[_0xf33a('0x41')][_0xf33a('0x5a')]===_0xf33a('0x47')){_0x38c5df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x469d75['dataValues']));_0x38c5df[_0xf33a('0x44')](get_open_tabs('sms',_0x469d75['dataValues']));_0x38c5df['push'](get_open_tabs(_0xf33a('0x4d'),_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs('whatsapp',_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4b'),_0x469d75[_0xf33a('0x4a')]));_0x38c5df[_0xf33a('0x44')](get_open_tabs('mail',_0x469d75['dataValues']));return BPromise['all'](_0x38c5df);}else{return values;}})[_0xf33a('0x13')](function(_0x528ac4){return values;})[_0xf33a('0x13')](respondWithResult(_0xbe98a9,null))[_0xf33a('0x1e')](handleError(_0xbe98a9,null));};exports[_0xf33a('0x26')]=function(_0x430d7b,_0xe5f799){if(_0x430d7b[_0xf33a('0x5b')]['id']){delete _0x430d7b['body']['id'];}delete _0x430d7b[_0xf33a('0x5b')][_0xf33a('0x29')];return db[_0xf33a('0x39')]['find']({'where':{'id':_0x430d7b[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0xe5f799,null))[_0xf33a('0x13')](saveUpdates(_0x430d7b[_0xf33a('0x5b')],null))[_0xf33a('0x13')](respondWithResult(_0xe5f799,null))[_0xf33a('0x1e')](handleError(_0xe5f799,null));};exports[_0xf33a('0x5c')]=function(_0x244993,_0x13743f){return db[_0xf33a('0x39')][_0xf33a('0x5c')]()[_0xf33a('0x13')](respondWithResult(_0x13743f,null))[_0xf33a('0x1e')](handleError(_0x13743f,null));};exports[_0xf33a('0x5d')]=function(_0x572bb4,_0x489cb2){return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x572bb4[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0x489cb2,null))[_0xf33a('0x13')](function(_0x9e6063){if(_0x9e6063){return _0x9e6063[_0xf33a('0x5d')](_0x572bb4[_0xf33a('0x5b')][_0xf33a('0x5e')],_[_0xf33a('0x5f')](_0x572bb4[_0xf33a('0x5b')],['ids','id'])||{});}})[_0xf33a('0x13')](respondWithResult(_0x489cb2,null))[_0xf33a('0x1e')](handleError(_0x489cb2,null));};function validateUser(_0x3720e1){return new BPromise(function(_0x375889,_0x3ffcca){if(_0x3720e1[_0xf33a('0x60')])return _0x375889(_0x3720e1);return db[_0xf33a('0x61')][_0xf33a('0x62')](0x1)[_0xf33a('0x13')](function(_0x495e87){if(_0x495e87[_0xf33a('0x63')])authService[_0xf33a('0x64')](_0x3720e1['password']);db[_0xf33a('0x39')][_0xf33a('0x65')](_0xf33a('0x60'))[_0xf33a('0x13')](function(_0x7b8d61){if(_[_0xf33a('0x66')](_0x7b8d61)){_0x3720e1['internal']=_0x495e87[_0xf33a('0x67')]||0x1;return;}if(_[_0xf33a('0x66')](_0x495e87[_0xf33a('0x67')])||_0x495e87[_0xf33a('0x67')]===_0x7b8d61){_0x3720e1[_0xf33a('0x60')]=_0x7b8d61+0x1;return;}if(_0x495e87[_0xf33a('0x67')]>_0x7b8d61){_0x3720e1[_0xf33a('0x60')]=_0x495e87['min_internal'];return;}return db[_0xf33a('0x68')][_0xf33a('0x41')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0xf33a('0x69')]})[_0xf33a('0x13')](function(_0xe23c77){if(_0xe23c77&&_0xe23c77[_0xf33a('0x48')]){for(var _0x2a9995=0x0,_0xb3a823=_0xe23c77[_0xf33a('0x48')];_0x2a9995<_0xb3a823&&_[_0xf33a('0x66')](_0x3720e1[_0xf33a('0x60')]);_0x2a9995++){if(_0x495e87[_0xf33a('0x67')]<=_0xe23c77[_0x2a9995][_0xf33a('0x6a')]){_0x3720e1[_0xf33a('0x60')]=_0xe23c77[_0x2a9995]['from'];}else if(_0x495e87[_0xf33a('0x67')]>_0xe23c77[_0x2a9995]['from']&&_0x495e87['min_internal']<=_0xe23c77[_0x2a9995]['to']){_0x3720e1[_0xf33a('0x60')]=_0x495e87[_0xf33a('0x67')];}}}if(_[_0xf33a('0x66')](_0x3720e1['internal'])){_0x3720e1['internal']=_0x7b8d61+0x1;}return _0x375889(_0x3720e1);});});})[_0xf33a('0x1e')](function(_0x4c414c){_0x3ffcca(_0x4c414c);});});}function updateUser(_0x2552f3){return new BPromise(function(_0x15b91b,_0x266d3e){try{if(_0x2552f3[_0xf33a('0x6b')]){_0x2552f3[_0xf33a('0x6c')]=_0x2552f3['internal'];_0x2552f3['VoiceMail']={'mailbox':_0x2552f3[_0xf33a('0x60')],'password':_0x2552f3[_0xf33a('0x54')],'fullname':_0x2552f3[_0xf33a('0x6d')],'email':_0x2552f3[_0xf33a('0x6e')]};}if(_0x2552f3['role']===_0xf33a('0x6f')){if(!_0x2552f3[_0xf33a('0x70')])_0x2552f3['permissions']=[_0xf33a('0x71'),_0xf33a('0x72'),_0xf33a('0x73'),'113',_0xf33a('0x74'),_0xf33a('0x75'),_0xf33a('0x76'),_0xf33a('0x77'),'107',_0xf33a('0x78'),_0xf33a('0x79'),_0xf33a('0x7a'),'111',_0xf33a('0x7b'),_0xf33a('0x7c')];}_0x15b91b(_0x2552f3);}catch(_0x26b3c6){_0x266d3e(_0x26b3c6);}});}exports[_0xf33a('0x7d')]=function(_0x42f669,_0x3c959a){if(_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]===_0xf33a('0x6f'))throw new Error(_0xf33a('0x7e'));if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x2b')&&_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]!=='admin'){throw new Error(_0xf33a('0x7f'));}if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x80')&&_0x42f669[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x80')){throw new Error(_0xf33a('0x81'));}return licenseUtil[_0xf33a('0x82')]([_0x42f669[_0xf33a('0x5b')]])[_0xf33a('0x13')](function(){return validateUser(_0x42f669[_0xf33a('0x5b')]);})[_0xf33a('0x13')](function(_0x439c40){return updateUser(_0x439c40)['then'](function(_0x34417a){if(_0x34417a[_0xf33a('0x29')]===_0xf33a('0x80')){_0x34417a[_0xf33a('0x83')]=_0x42f669['user'][_0xf33a('0x83')];delete _0x34417a[_0xf33a('0x84')];}return _0x34417a;});})[_0xf33a('0x13')](function(_0xfd113f){return db[_0xf33a('0x39')][_0xf33a('0x7d')](_0xfd113f,{'include':[{'model':db[_0xf33a('0x85')],'as':_0xf33a('0x85')}]});})['then'](function(_0x2404dc){if(_0x42f669[_0xf33a('0x5b')][_0xf33a('0x29')]===_0xf33a('0x2b'))return _0x2404dc;if(_0x42f669['user']['role']!==_0xf33a('0x2b'))return _0x2404dc;return db['UserProfileSection'][_0xf33a('0x34')]({'where':{'name':_0x2404dc[_0xf33a('0x29')]===_0xf33a('0x6f')?_0xf33a('0x2c'):'Telephones','userProfileId':_0x42f669['user'][_0xf33a('0x84')]},'raw':!![]})['then'](function(_0x343003){if(!_0x343003||_0x343003[_0xf33a('0x86')]!=0x0)return _0x2404dc;return db[_0xf33a('0x87')][_0xf33a('0x7d')]({'name':_0x2404dc[_0xf33a('0x35')],'resourceId':_0x2404dc['id'],'type':_0x343003[_0xf33a('0x35')],'sectionId':_0x343003['id']},{})[_0xf33a('0x13')](function(){return _0x2404dc;});})[_0xf33a('0x1e')](function(_0x339eaf){logger[_0xf33a('0x18')](_0xf33a('0x88'),_0x339eaf);throw _0x339eaf;});})[_0xf33a('0x13')](respondWithResult(_0x3c959a,0xc9))[_0xf33a('0x1e')](handleError(_0x3c959a,null));};exports[_0xf33a('0x89')]=function(_0xc2e6ae,_0x254c5c){var _0x5b654b=_0xc2e6ae[_0xf33a('0x5b')];var _0x59c9e9=[];if(_0xc2e6ae[_0xf33a('0x2b')]['role']==='agent')throw new Error('Unauthorized');if(_[_0xf33a('0x8a')](_0x5b654b,[_0xf33a('0x29'),'user'])&&_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x80')){throw new Error(_0xf33a('0x7f'));}if(_[_0xf33a('0x8a')](_0x5b654b,[_0xf33a('0x29'),'admin'])&&_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!=='admin'){throw new Error(_0xf33a('0x8b'));}return licenseUtil[_0xf33a('0x82')](_0x5b654b)[_0xf33a('0x13')](function(){return validateUser(_0x5b654b[0x0]);})['then'](function(){for(var _0x3a550f=0x1;_0x3a550f<_0x5b654b[_0xf33a('0x48')];_0x3a550f++){var _0xb2aa64=_0x5b654b[_0x3a550f-0x1][_0xf33a('0x60')];if(!_0x5b654b[_0x3a550f][_0xf33a('0x60')])_0x5b654b[_0x3a550f]['internal']=_0xb2aa64+0x1;_0x59c9e9[_0xf33a('0x44')](validateUser(_0x5b654b[_0x3a550f]));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);})[_0xf33a('0x13')](function(){_0x59c9e9=[];for(var _0x399b5b=0x0;_0x399b5b<_0x5b654b[_0xf33a('0x48')];_0x399b5b++){_0x59c9e9['push'](updateUser(_0x5b654b[_0x399b5b]));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);})[_0xf33a('0x13')](function(){return BPromise[_0xf33a('0x8c')](_0x5b654b,function(_0x2719c1){return db[_0xf33a('0x39')]['create'](_0x2719c1,{'include':[{'model':db[_0xf33a('0x85')],'as':'VoiceMail'}]})['then'](function(_0x14ff0d){_0x2719c1['id']=_0x14ff0d['id'];return _0x2719c1;});});})['then'](function(_0x1cdfc4){if(_0xc2e6ae[_0xf33a('0x5b')]['role']===_0xf33a('0x2b'))return _0x1cdfc4;if(_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x29')]!==_0xf33a('0x2b'))return _0x1cdfc4;var _0x17c6d3=_[_0xf33a('0x8a')](_0x1cdfc4,function(_0x1d5d3f){return _0x1d5d3f['role']===_0xf33a('0x6f')||_0x1d5d3f[_0xf33a('0x29')]===_0xf33a('0x2e');});if(!_0x17c6d3)return _0x1cdfc4;return db[_0xf33a('0x8d')]['findAll']({'where':{'name':{'$or':[_0xf33a('0x2c'),'Telephones']},'userProfileId':_0xc2e6ae[_0xf33a('0x2b')][_0xf33a('0x84')]},'raw':!![]})[_0xf33a('0x13')](function(_0x3facd6){if(_[_0xf33a('0x8e')](_0x3facd6)||!_['some'](_0x3facd6,[_0xf33a('0x86'),0x0]))return _0x1cdfc4;_0x59c9e9=[];var _0x28fbfa=_(_0x3facd6)[_0xf33a('0x31')](function(_0x3c5f46){if(_0x3c5f46[_0xf33a('0x86')]===0x1)return;return _0x3c5f46[_0xf33a('0x35')]==='Agents'?_0xf33a('0x6f'):_0xf33a('0x2e');})['compact']()[_0xf33a('0x32')]();for(var _0x8128a6=0x0;_0x8128a6<_0x1cdfc4[_0xf33a('0x48')];_0x8128a6++){if(!_[_0xf33a('0x33')](_0x28fbfa,_0x1cdfc4[_0x8128a6]['role']))return;var _0x4e5bc8=_0x1cdfc4[_0x8128a6]['role']===_0xf33a('0x6f')?_0xf33a('0x2c'):_0xf33a('0x2d');_0x59c9e9[_0xf33a('0x44')](db[_0xf33a('0x87')][_0xf33a('0x7d')]({'name':_0x1cdfc4[_0x8128a6][_0xf33a('0x35')],'resourceId':_0x1cdfc4[_0x8128a6]['id'],'type':_0x4e5bc8,'sectionId':_['find'](_0x3facd6,[_0xf33a('0x35'),_0x4e5bc8])['id']},{}));}return BPromise[_0xf33a('0x4e')](_0x59c9e9);});})[_0xf33a('0x13')](respondWithResult(_0x254c5c,0xc9))[_0xf33a('0x1e')](handleError(_0x254c5c,null));};exports[_0xf33a('0x8f')]=function(_0x26afb8,_0xbdb564){if(_0x26afb8[_0xf33a('0x5b')]['id']){delete _0x26afb8[_0xf33a('0x5b')]['id'];}return db['User'][_0xf33a('0x34')]({'where':{'id':_0x26afb8[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](function(_0x63d5ec){if(!_0x63d5ec)return null;if(_0x63d5ec['id']===_0x26afb8['user']['id']){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x90')]||!_0x26afb8['body'][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x63d5ec['authenticate'](_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x90')])){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0x94'));}if(_0x26afb8['body'][_0xf33a('0x90')]===_0x26afb8['body'][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x26afb8['user']['role']==='admin'){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x26afb8['user'][_0xf33a('0x29')]===_0xf33a('0x2b')){if(!_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')]){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x63d5ec[_0xf33a('0x29')]!==_0xf33a('0x6f')){throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Unauthorized');}}else{throw new db[(_0xf33a('0x92'))][(_0xf33a('0x93'))]('Unauthorized');}return _0x63d5ec;})['then'](handleEntityNotFound(_0xbdb564,null))['then'](function(_0x1e63d5){return db[_0xf33a('0x61')][_0xf33a('0x95')]({'attributes':['id',_0xf33a('0x63'),_0xf33a('0x96'),_0xf33a('0x97')]})['then'](function(_0x528266){if(_0x528266[_0xf33a('0x63')])authService[_0xf33a('0x64')](_0x26afb8[_0xf33a('0x5b')]['newPassword']);if(!_0x528266[_0xf33a('0x96')]||!_0x1e63d5[_0xf33a('0x98')])return _0x1e63d5;authService[_0xf33a('0x99')](_0x26afb8[_0xf33a('0x5b')][_0xf33a('0x91')],_0x1e63d5[_0xf33a('0x98')],_0x528266[_0xf33a('0x97')]);return _0x1e63d5;})[_0xf33a('0x13')](saveUpdates({'password':_0x26afb8[_0xf33a('0x5b')]['newPassword'],'passwordResetAt':_0x26afb8['user']['id']==_0x26afb8[_0xf33a('0x50')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x26afb8['body']['newPassword'],_0x1e63d5['previousPasswords'])},null));})[_0xf33a('0x13')](respondWithResult(_0xbdb564,null))[_0xf33a('0x1e')](handleError(_0xbdb564,null));};exports[_0xf33a('0x9a')]=function(_0x105cb5,_0x56e5bc){var _0x299219=_0x105cb5['body'][_0xf33a('0x9b')];return db['User'][_0xf33a('0x34')]({'where':{'id':_0x105cb5[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0x35'),_0xf33a('0x29'),_0xf33a('0x9c'),_0xf33a('0x9d'),_0xf33a('0x9e'),_0xf33a('0x9f')]})[_0xf33a('0x13')](handleEntityNotFound(_0x56e5bc,null))[_0xf33a('0x13')](function(_0x5ea425){if(_0x5ea425){if(!utils['isValidChannel'](_0x299219)){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0xa0'));}return _0x5ea425[_0xf33a('0xa1')+_[_0xf33a('0xa2')](_0x299219[_0xf33a('0xa3')]())+_0xf33a('0xa4')](_0x105cb5[_0xf33a('0x5b')][_0xf33a('0x5e')],{'penalty':_0x105cb5['body'][_0xf33a('0xa5')]||0x0})[_0xf33a('0xa6')](function(_0x55939d){for(var _0x40b5dc=0x0;_0x40b5dc<_0x105cb5[_0xf33a('0x5b')][_0xf33a('0x5e')][_0xf33a('0x48')];_0x40b5dc+=0x1){var _0xcc08ba={'UserId':Number(_0x105cb5[_0xf33a('0x50')]['id'])};_0xcc08ba[_[_0xf33a('0xa2')](_0x299219[_0xf33a('0xa3')]())+'QueueId']=Number(_0x105cb5[_0xf33a('0x5b')]['ids'][_0x40b5dc]);socket[_0xf33a('0xa7')](_0xf33a('0x2b')+_['capitalize'](_0x299219[_0xf33a('0xa3')]())+_0xf33a('0xa8'),_0xcc08ba);}return _0x55939d;})['then'](function(){if(_0x299219==='voice'){return db['VoiceQueue'][_0xf33a('0x45')]({'where':{'id':_0x105cb5[_0xf33a('0x5b')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x90165){var _0x519a3d=_0x5ea425[_0xf33a('0x28')]({'plain':!![]});var _0x4f5192=[];if(_0x299219===_0xf33a('0xa9')&&_0x519a3d[_0xf33a('0x29')]==='agent'&&_0x519a3d[_0xf33a('0x9c')]){for(var _0x3c522d=0x0;_0x3c522d<_0x90165[_0xf33a('0x48')];_0x3c522d+=0x1){_0x4f5192[_0xf33a('0x44')]({'membername':_0x519a3d[_0xf33a('0x35')],'UserId':_0x519a3d['id'],'queue_name':_0x90165[_0x3c522d][_0xf33a('0x35')],'VoiceQueueId':_0x90165[_0x3c522d]['id'],'interface':_[_0xf33a('0x66')](_0x519a3d[_0xf33a('0x9f')])?util[_0xf33a('0xaa')](_0xf33a('0xab'),_0x519a3d['name']):_0x519a3d[_0xf33a('0x9f')],'paused':_0x519a3d['voicePause']||![],'penalty':_0x105cb5[_0xf33a('0x5b')]['penalty']||0x0});}return BPromise[_0xf33a('0x8c')](_0x4f5192,function(_0x2dc74a){return db[_0xf33a('0xac')][_0xf33a('0xad')](_0x2dc74a);});}return _0x5ea425;});}})[_0xf33a('0x13')](respondWithStatusCode(_0x56e5bc,null))['catch'](handleError(_0x56e5bc,null));};exports[_0xf33a('0xae')]=function(_0x102520,_0x402e38){var _0x2ddd8e;return db[_0xf33a('0x39')]['find']({'where':{'id':_0x102520[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0x35'),_0xf33a('0x29')]})[_0xf33a('0x13')](handleEntityNotFound(_0x402e38,null))['then'](function(_0x2f02bb){if(_0x2f02bb){_0x2ddd8e=_0x2f02bb;if(!_0x102520['query'][_0xf33a('0x9b')]||!utils[_0xf33a('0xaf')](_0x102520[_0xf33a('0x41')]['channel'])){throw new db['Sequelize'][(_0xf33a('0x93'))](_0xf33a('0xa0'));}return _0x2f02bb[_0xf33a('0xb0')+_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xa4')](_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')]);}})[_0xf33a('0x13')](function(_0x59a02b){if(_['isArray'](_0x102520[_0xf33a('0x41')]['ids'])){for(var _0x432d08=0x0;_0x432d08<_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')][_0xf33a('0x48')];_0x432d08+=0x1){var _0x34781e={'UserId':Number(_0x102520[_0xf33a('0x50')]['id'])};_0x34781e[_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xb1')]=Number(_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')][_0x432d08]);socket['emit'](_0xf33a('0x2b')+_[_0xf33a('0xa2')](_0x102520['query'][_0xf33a('0x9b')][_0xf33a('0xa3')]())+_0xf33a('0xb2'),_0x34781e);}}else{var _0x34781e={'UserId':Number(_0x102520[_0xf33a('0x50')]['id'])};_0x34781e[_['capitalize'](_0x102520[_0xf33a('0x41')][_0xf33a('0x9b')]['toLowerCase']())+_0xf33a('0xb1')]=Number(_0x102520[_0xf33a('0x41')][_0xf33a('0x5e')]);socket[_0xf33a('0xa7')](_0xf33a('0x2b')+_['capitalize'](_0x102520[_0xf33a('0x41')]['channel'][_0xf33a('0xa3')]())+'Queue:remove',_0x34781e);}return _0x59a02b;})['then'](function(){if(_0x102520[_0xf33a('0x41')]['channel']===_0xf33a('0xa9')){return db[_0xf33a('0xac')][_0xf33a('0x27')]({'where':{'UserId':_0x102520[_0xf33a('0x50')]['id'],'VoiceQueueId':_0x102520[_0xf33a('0x41')]['ids']},'individualHooks':!![]})[_0xf33a('0x13')](function(){return _0x2ddd8e;});}return _0x2ddd8e;})['then'](respondWithStatusCode(_0x402e38,null))[_0xf33a('0x1e')](handleError(_0x402e38,null));};exports[_0xf33a('0xb3')]=function(_0x43883e,_0xb6b478){_0x43883e[_0xf33a('0x5b')][_0xf33a('0xb4')]=_0x43883e[_0xf33a('0xb5')][_0xf33a('0xb6')];return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x43883e[_0xf33a('0x50')]['id']}})[_0xf33a('0x13')](handleEntityNotFound(_0xb6b478,null))[_0xf33a('0x13')](saveUpdates(_0x43883e[_0xf33a('0x5b')],null))[_0xf33a('0x13')](respondWithResult(_0xb6b478,null))[_0xf33a('0x1e')](handleError(_0xb6b478,null));};exports[_0xf33a('0xb7')]=function(_0x2df5a9,_0x5664b1){var _0x1f4aec=path[_0xf33a('0xb8')](config[_0xf33a('0xb9')],'server/files/images/logos/default_profile.png');return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x2df5a9[_0xf33a('0x50')]['id']},'attributes':['id',_0xf33a('0xb4')],'raw':!![]})[_0xf33a('0x13')](handleEntityNotFound(_0x5664b1,null))[_0xf33a('0x13')](function(_0x2d2293){if(_0x2d2293){if(_[_0xf33a('0x66')](_0x2d2293[_0xf33a('0xb4')])){return _0x5664b1[_0xf33a('0xba')](_0x1f4aec);}else{if(!fs[_0xf33a('0xbb')](path[_0xf33a('0xb8')](config['root'],'server/files/images/',_0x2d2293[_0xf33a('0xb4')]))){return _0x5664b1[_0xf33a('0xba')](_0x1f4aec);}return _0x5664b1[_0xf33a('0xba')](path[_0xf33a('0xb8')](config[_0xf33a('0xb9')],_0xf33a('0xbc'),_0x2d2293['userpic']));}}})['catch'](handleError(_0x5664b1,null));};exports[_0xf33a('0xbd')]=function(_0x56de47,_0x5728a6){return db[_0xf33a('0x39')][_0xf33a('0x34')]({'where':{'id':_0x56de47[_0xf33a('0x50')]['id']},'attributes':['id']})[_0xf33a('0x13')](handleEntityNotFound(_0x5728a6,null))[_0xf33a('0x13')](function(_0x142960){var _0x1c6f2d=[];values=_0x142960[_0xf33a('0x4a')];_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x49'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0xbe'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0x4d'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d[_0xf33a('0x44')](get_open_tabs(_0xf33a('0xbf'),_0x142960['dataValues']));_0x1c6f2d['push'](get_open_tabs(_0xf33a('0x4b'),_0x142960[_0xf33a('0x4a')]));_0x1c6f2d['push'](get_open_tabs(_0xf33a('0x4c'),_0x142960['dataValues']));return BPromise[_0xf33a('0x4e')](_0x1c6f2d);})[_0xf33a('0x13')](function(_0x5b7fce){var _0x3e0df3=[];if(_0x5b7fce){for(var _0x25f561=0x0;_0x25f561=_0x26d935[_0x2cb6('0x50')]){throw new Error(_0x2cb6('0x51'));}})[_0x2cb6('0x11')](function(){if(_0x530f3f){return db[_0x2cb6('0x2c')][_0x2cb6('0x52')]({'where':{'membername':_0x530f3f[_0x2cb6('0x33')]},'individualHooks':!![]});}})[_0x2cb6('0x11')](function(){if(_0x530f3f){return _0x530f3f[_0x2cb6('0x53')]({'raw':!![]});}})['then'](function(_0x1bff49){if(_0x530f3f){if(_0x1bff49){var _0x39d475=[];_0x2d5286=_0x1bff49;if(_0x2d5286[_0x2cb6('0x2e')]){for(var _0x1a35f3=0x0;_0x1a35f3<_0x2d5286[_0x2cb6('0x2e')];_0x1a35f3++){_0x39d475[_0x2cb6('0x32')](db[_0x2cb6('0x2c')][_0x2cb6('0x54')]({'membername':_0x530f3f[_0x2cb6('0x33')],'UserId':_0x530f3f['id'],'queue_name':_0x2d5286[_0x1a35f3][_0x2cb6('0x33')],'VoiceQueueId':_0x2d5286[_0x1a35f3]['id'],'interface':_0x1c5fbc,'paused':_0x530f3f['loginInPause']||![],'penalty':_0x2d5286[_0x1a35f3][_0x2cb6('0x55')]||0x0}));}return BPromise[_0x2cb6('0x49')](_0x39d475);}}}})['then'](function(){if(_0x530f3f){return db[_0x2cb6('0x2d')]['findAll']({'where':{'membername':_0x530f3f[_0x2cb6('0x33')],'exitAt':null}});}})[_0x2cb6('0x11')](function(_0x5d2e70){if(_0x530f3f){if(_0x5d2e70&&_0x5d2e70[_0x2cb6('0x2e')]){var _0x41a84e=[];_0x5d2e70[_0x2cb6('0x48')](function(_0x2f6124){_0x41a84e[_0x2cb6('0x32')](_0x2f6124[_0x2cb6('0x40')]({'exitAt':moment()[_0x2cb6('0x2f')](_0x2cb6('0x30'))}));});return BPromise[_0x2cb6('0x49')](_0x41a84e);}}})[_0x2cb6('0x11')](function(_0x3fcfd9){if(_0x530f3f){var _0x424461=[];var _0x39c9bd=[];var _0x15bbd1=utils['getChannels']();var _0xc6df76={'membername':_0x530f3f['name'],'interface':_0x1c5fbc,'enterAt':moment()[_0x2cb6('0x2f')](_0x2cb6('0x30')),'role':_0x530f3f['role'],'internal':_0x530f3f[_0x2cb6('0x2a')]};_0x15bbd1[_0x2cb6('0x48')](function(_0x5bf00b){_0x424461[_0x2cb6('0x32')](_['merge']({'channel':_0x5bf00b,'type':_0x2cb6('0x56'),'data1':_0x2cb6('0x57'),'data2':_0x1c5fbc},_0xc6df76));if(_0x530f3f[_0x2cb6('0x4c')]){_0x39c9bd[_0x2cb6('0x32')](_[_0x2cb6('0x58')]({'channel':_0x5bf00b,'type':_0x2cb6('0x36'),'data1':'LOGININPAUSE'},_0xc6df76));}});return db[_0x2cb6('0x2d')][_0x2cb6('0x59')](_0x424461[_0x2cb6('0x5a')](_0x39c9bd),{'individualHooks':!![]});}})[_0x2cb6('0x11')](function(){if(_0x530f3f){return _0x530f3f['update']({'online':!![],'lastLoginAt':moment()[_0x2cb6('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x530f3f[_0x2cb6('0x4c')]||![],'mailPause':_0x530f3f[_0x2cb6('0x4c')]||![],'chatPause':_0x530f3f['loginInPause']||![],'faxPause':_0x530f3f['loginInPause']||![],'smsPause':_0x530f3f[_0x2cb6('0x4c')]||![],'openchannelPause':_0x530f3f['loginInPause']||![],'pauseType':_0x530f3f[_0x2cb6('0x4c')]?_0x2cb6('0x5b'):null,'lastPauseAt':moment()['format'](_0x2cb6('0x30')),'interface':_0x1c5fbc});}})[_0x2cb6('0x11')](function(_0x5725e9){_0x61d03b(_0x5725e9);})[_0x2cb6('0x1a')](function(_0x2176e1){_0x5f3f00(_0x4e303b[_0x2cb6('0x17')](0x1f4,_0x2176e1[_0x2cb6('0x19')]));});});}; \ No newline at end of file +var _0x4269=['concat','LOGININPAUSE','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetUser','User','options','raw','attributes','limit','include','map','model','ShowUser','find','where','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','isNil','type','body','uniqueid','bulkCreate','UnpauseUser','findOne','isValidChannel','Unknown\x20channel','channel','voice','system','fax','sms','openchannel','whatsapp','set','%s%s','Pause','findAll','forEach','push','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','SIP/%s','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','merge','callysquare'];(function(_0x3394b4,_0x4d8898){var _0x2acad2=function(_0x290be2){while(--_0x290be2){_0x3394b4['push'](_0x3394b4['shift']());}};_0x2acad2(++_0x4d8898);}(_0x4269,0xb6));var _0x9426=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x4269[_0x5aece9];return _0x1c46d6;};'use strict';var _=require(_0x9426('0x0'));var util=require('util');var moment=require(_0x9426('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9426('0x2'));var db=require(_0x9426('0x3'))['db'];var utils=require(_0x9426('0x4'));var logger=require('../../config/logger')(_0x9426('0x5'));var config=require(_0x9426('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9426('0x7')][_0x9426('0x8')]({'port':0x232a});config[_0x9426('0x9')]=_[_0x9426('0xa')](config[_0x9426('0x9')],{'host':_0x9426('0xb'),'port':0x18eb});var socket=require(_0x9426('0xc'))(new Redis(config[_0x9426('0x9')]));require(_0x9426('0xd'))['register'](socket);function respondWithRpcPromise(_0x41845d,_0x142c1d,_0x2a66b9){return new BPromise(function(_0x1006b4,_0x3617aa){return client[_0x9426('0xe')](_0x41845d,_0x2a66b9)[_0x9426('0xf')](function(_0x56b12c){logger[_0x9426('0x10')](_0x9426('0x11'),_0x142c1d,_0x9426('0x12'));logger[_0x9426('0x13')]('User,\x20%s,\x20%s,\x20%s',_0x142c1d,_0x9426('0x12'),JSON[_0x9426('0x14')](_0x56b12c));if(_0x56b12c[_0x9426('0x15')]){if(_0x56b12c[_0x9426('0x15')][_0x9426('0x16')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x142c1d,_0x56b12c[_0x9426('0x15')][_0x9426('0x17')]);return _0x3617aa(_0x56b12c[_0x9426('0x15')]['message']);}logger[_0x9426('0x15')](_0x9426('0x11'),_0x142c1d,_0x56b12c['error'][_0x9426('0x17')]);return _0x1006b4(_0x56b12c[_0x9426('0x15')]['message']);}else{logger['info']('User,\x20%s,\x20%s',_0x142c1d,_0x9426('0x12'));_0x1006b4(_0x56b12c[_0x9426('0x18')]['message']);}})[_0x9426('0x19')](function(_0x2b071b){logger[_0x9426('0x15')](_0x9426('0x11'),_0x142c1d,_0x2b071b);_0x3617aa(_0x2b071b);});});}exports[_0x9426('0x1a')]=function(_0xb9e0aa){var _0x2e8293=this;return new Promise(function(_0x507988,_0x5d0d73){return db[_0x9426('0x1b')]['findAll']({'raw':_0xb9e0aa[_0x9426('0x1c')]?_0xb9e0aa[_0x9426('0x1c')][_0x9426('0x1d')]===undefined?!![]:![]:!![],'where':_0xb9e0aa['options']?_0xb9e0aa[_0x9426('0x1c')]['where']||null:null,'attributes':_0xb9e0aa['options']?_0xb9e0aa[_0x9426('0x1c')][_0x9426('0x1e')]||null:null,'limit':_0xb9e0aa['options']?_0xb9e0aa[_0x9426('0x1c')][_0x9426('0x1f')]||null:null,'include':_0xb9e0aa[_0x9426('0x1c')]?_0xb9e0aa[_0x9426('0x1c')][_0x9426('0x20')]?_[_0x9426('0x21')](_0xb9e0aa['options'][_0x9426('0x20')],function(_0x406a31){return{'model':db[_0x406a31[_0x9426('0x22')]],'as':_0x406a31['as'],'attributes':_0x406a31['attributes'],'include':_0x406a31['include']?_[_0x9426('0x21')](_0x406a31[_0x9426('0x20')],function(_0x3767d9){return{'model':db[_0x3767d9[_0x9426('0x22')]],'as':_0x3767d9['as'],'attributes':_0x3767d9[_0x9426('0x1e')],'include':_0x3767d9['include']?_[_0x9426('0x21')](_0x3767d9[_0x9426('0x20')],function(_0x311811){return{'model':db[_0x311811[_0x9426('0x22')]],'as':_0x311811['as'],'attributes':_0x311811['attributes']};}):[]};}):[]};}):[]:[]})[_0x9426('0xf')](function(_0x1af90e){logger[_0x9426('0x10')](_0x9426('0x1a'),_0xb9e0aa);logger[_0x9426('0x13')]('GetUser',_0xb9e0aa,JSON['stringify'](_0x1af90e));_0x507988(_0x1af90e);})[_0x9426('0x19')](function(_0x5647da){logger['error'](_0x9426('0x1a'),_0x5647da[_0x9426('0x17')],_0xb9e0aa);_0x5d0d73(_0x2e8293[_0x9426('0x15')](0x1f4,_0x5647da['message']));});});};exports[_0x9426('0x23')]=function(_0x309377){var _0x3ecef7=this;return new Promise(function(_0x2f1326,_0x4ab2b1){return db[_0x9426('0x1b')][_0x9426('0x24')]({'raw':_0x309377['options']?_0x309377[_0x9426('0x1c')][_0x9426('0x1d')]===undefined?!![]:![]:!![],'where':_0x309377[_0x9426('0x1c')]?_0x309377[_0x9426('0x1c')][_0x9426('0x25')]||null:null,'attributes':_0x309377[_0x9426('0x1c')]?_0x309377[_0x9426('0x1c')]['attributes']||null:null,'include':_0x309377[_0x9426('0x1c')]?_0x309377[_0x9426('0x1c')][_0x9426('0x20')]?_[_0x9426('0x21')](_0x309377[_0x9426('0x1c')]['include'],function(_0x1aadc4){return{'model':db[_0x1aadc4[_0x9426('0x22')]],'as':_0x1aadc4['as'],'attributes':_0x1aadc4['attributes'],'include':_0x1aadc4[_0x9426('0x20')]?_[_0x9426('0x21')](_0x1aadc4['include'],function(_0x260e9c){return{'model':db[_0x260e9c[_0x9426('0x22')]],'as':_0x260e9c['as'],'attributes':_0x260e9c[_0x9426('0x1e')],'include':_0x260e9c['include']?_[_0x9426('0x21')](_0x260e9c[_0x9426('0x20')],function(_0x562fa8){return{'model':db[_0x562fa8[_0x9426('0x22')]],'as':_0x562fa8['as'],'attributes':_0x562fa8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d03ca){logger[_0x9426('0x10')](_0x9426('0x23'),_0x309377);logger['debug'](_0x9426('0x23'),_0x309377,JSON[_0x9426('0x14')](_0x5d03ca));_0x2f1326(_0x5d03ca);})[_0x9426('0x19')](function(_0x23cfe9){logger[_0x9426('0x15')](_0x9426('0x23'),_0x23cfe9[_0x9426('0x17')],_0x309377);_0x4ab2b1(_0x3ecef7[_0x9426('0x15')](0x1f4,_0x23cfe9[_0x9426('0x17')]));});});};exports[_0x9426('0x26')]=function(_0x37292f){var _0x3fd0ac=this;return new Promise(function(_0x2e03bf,_0x6bc9b9){var _0x5a82f9;return db['User'][_0x9426('0x24')]({'where':_0x37292f[_0x9426('0x1c')][_0x9426('0x25')]||{},'attributes':['id',_0x9426('0x27'),_0x9426('0x28'),_0x9426('0x29'),_0x9426('0x2a')]})[_0x9426('0xf')](function(_0x527410){if(_0x527410){_0x5a82f9=_0x527410;return db[_0x9426('0x2b')][_0x9426('0x2c')]({'paused':0x1},{'where':{'UserId':_0x5a82f9['id']},'individualHooks':!![]});}})[_0x9426('0xf')](function(){if(_0x5a82f9){return db[_0x9426('0x2d')]['findAll']({'where':{'membername':_0x5a82f9[_0x9426('0x27')],'type':_0x9426('0x2e'),'exitAt':null}});}})[_0x9426('0xf')](function(_0x3381ee){if(_0x5a82f9){if(_0x3381ee&&_0x3381ee[_0x9426('0x2f')]){var _0x238893=moment()[_0x9426('0x30')](_0x9426('0x31'));for(var _0x430972=0x0,_0xd2dafd=_0x3381ee[_0x9426('0x2f')];_0x430972<_0xd2dafd;_0x430972++){_0x3381ee[_0x430972][_0x9426('0x32')]({'exitAt':_0x238893});}}}})[_0x9426('0xf')](function(){if(_0x5a82f9){var _0xf9aa75=[];var _0x7a5972=utils[_0x9426('0x33')]();_0x7a5972['forEach'](function(_0x1717c5){_0xf9aa75['push']({'channel':_0x1717c5,'membername':_0x5a82f9[_0x9426('0x27')],'interface':_[_0x9426('0x34')](_0x5a82f9[_0x9426('0x2a')])?util['format']('SIP/%s',_0x5a82f9[_0x9426('0x27')]):_0x5a82f9[_0x9426('0x2a')],'type':_0x9426('0x2e'),'enterAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'data1':_0x37292f['body'][_0x9426('0x35')]||'DEFAULT\x20PAUSE','role':_0x5a82f9[_0x9426('0x28')],'internal':_0x5a82f9[_0x9426('0x29')],'uniqueid':_0x37292f[_0x9426('0x36')][_0x9426('0x37')]||null});});return db[_0x9426('0x2d')][_0x9426('0x38')](_0xf9aa75,{'individualHooks':!![]});}})[_0x9426('0xf')](function(){if(_0x5a82f9){return _0x5a82f9['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x37292f[_0x9426('0x36')][_0x9426('0x35')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x9426('0x31'))});}})[_0x9426('0xf')](function(_0x10df33){_0x2e03bf(_0x10df33);})[_0x9426('0x19')](function(_0x10bd26){_0x6bc9b9(_0x3fd0ac[_0x9426('0x15')](0x1f4,_0x10bd26[_0x9426('0x17')]));});});};exports[_0x9426('0x39')]=function(_0x5bcfb6){var _0x1bd246=this;return new Promise(function(_0x124284,_0x36d195){var _0x39b209;return db['User'][_0x9426('0x3a')]({'where':_0x5bcfb6[_0x9426('0x1c')]['where']||{},'attributes':['id',_0x9426('0x27')]})[_0x9426('0xf')](function(_0x5a2766){if(_0x5a2766){_0x39b209=_0x5a2766;if(_0x5bcfb6[_0x9426('0x36')]['channel']&&!utils[_0x9426('0x3b')](_0x5bcfb6[_0x9426('0x36')]['channel'])){throw new Error(_0x9426('0x3c'));}switch(_0x5bcfb6[_0x9426('0x36')][_0x9426('0x3d')]){case _0x9426('0x3e'):return db[_0x9426('0x2b')][_0x9426('0x2c')]({'paused':0x0},{'where':{'UserId':_0x39b209['id']}})[_0x9426('0xf')](function(){return db['MemberReport'][_0x9426('0x24')]({'where':{'channel':_0x5bcfb6[_0x9426('0x36')]['channel'],'membername':_0x39b209['name'],'type':_0x9426('0x2e'),'exitAt':null}});})[_0x9426('0xf')](function(_0x488b9b){if(_0x488b9b){return _0x488b9b[_0x9426('0x2c')]({'exitAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'data2':_0x9426('0x3f')},{'individualHooks':!![]});}return null;})[_0x9426('0xf')](function(){return _0x39b209[_0x9426('0x2c')]({'voicePause':![]});});case'mail':case'chat':case _0x9426('0x40'):case _0x9426('0x41'):case _0x9426('0x42'):case _0x9426('0x43'):return db[_0x9426('0x2d')][_0x9426('0x24')]({'where':{'channel':_0x5bcfb6[_0x9426('0x36')][_0x9426('0x3d')],'membername':_0x39b209[_0x9426('0x27')],'type':'PAUSE','exitAt':null}})[_0x9426('0xf')](function(_0x151dab){return _0x151dab[_0x9426('0x2c')]({'exitAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x2f6a49={};_[_0x9426('0x44')](_0x2f6a49,util[_0x9426('0x30')](_0x9426('0x45'),_0x5bcfb6['body'][_0x9426('0x3d')],_0x9426('0x46')),![]);return _0x39b209[_0x9426('0x2c')](_0x2f6a49);});default:return db[_0x9426('0x2b')][_0x9426('0x2c')]({'paused':0x0},{'where':{'UserId':_0x39b209['id']}})['then'](function(){return db[_0x9426('0x2d')][_0x9426('0x47')]({'where':{'membername':_0x39b209[_0x9426('0x27')],'type':'PAUSE','exitAt':null}});})['then'](function(_0xc86c06){var _0x250f08=[];_0xc86c06[_0x9426('0x48')](function(_0xcd300d){_0x250f08[_0x9426('0x49')](_0xcd300d['update']({'exitAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'data2':_0x9426('0x3f')}));});return BPromise[_0x9426('0x4a')](_0x250f08);})[_0x9426('0xf')](function(){return _0x39b209[_0x9426('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x9426('0xf')](function(_0x2d9bc7){_0x124284(_0x2d9bc7);})[_0x9426('0x19')](function(_0xd87cf4){_0x36d195(_0x1bd246[_0x9426('0x15')](0x1f4,_0xd87cf4['message']));});});};exports[_0x9426('0x4b')]=function(_0x81d973){var _0x5a2c15=this;return new Promise(function(_0x279818,_0x31669d){var _0x186a91;return db['User'][_0x9426('0x3a')]({'where':_0x81d973['options'][_0x9426('0x25')]||{},'attributes':['id',_0x9426('0x27')]})[_0x9426('0xf')](function(_0x103014){if(_0x103014){_0x186a91=_0x103014;return db[_0x9426('0x2b')][_0x9426('0x4c')]({'where':{'membername':_0x186a91[_0x9426('0x27')]},'individualHooks':!![]});}})[_0x9426('0xf')](function(){if(_0x186a91){return db[_0x9426('0x2d')][_0x9426('0x47')]({'where':{'membername':_0x186a91['name'],'exitAt':null}});}})[_0x9426('0xf')](function(_0x10b307){if(_0x186a91){if(_0x10b307&&_0x10b307['length']){var _0x6256f9=[];_0x10b307['forEach'](function(_0x226c1d){_0x6256f9[_0x9426('0x49')](_0x226c1d[_0x9426('0x2c')]({'exitAt':moment()[_0x9426('0x30')](_0x9426('0x31'))}));});return BPromise[_0x9426('0x4a')](_0x6256f9);}}})[_0x9426('0xf')](function(){if(_0x186a91){return _0x186a91[_0x9426('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x54c9e6){_0x279818(_0x54c9e6);})[_0x9426('0x19')](function(_0x2a426d){_0x31669d(_0x5a2c15['error'](0x1f4,_0x2a426d[_0x9426('0x17')]));});});};exports[_0x9426('0x4d')]=function(_0x26fbc6){var _0x5c2dd8=this;return new Promise(function(_0x322e8e,_0x323403){var _0x1bf267;var _0x621675;var _0x35c1e6;var _0x51d129;return db[_0x9426('0x1b')][_0x9426('0x3a')]({'where':_0x26fbc6['options'][_0x9426('0x25')]||{},'attributes':['id',_0x9426('0x27'),_0x9426('0x28'),_0x9426('0x4e'),'phone',_0x9426('0x29'),_0x9426('0x4f'),_0x9426('0x2a')]})[_0x9426('0xf')](function(_0x49c42b){if(_0x49c42b){_0x1bf267=_0x49c42b;_0x51d129=_0x26fbc6[_0x9426('0x36')][_0x9426('0x2a')]?_0x26fbc6[_0x9426('0x36')][_0x9426('0x2a')]:util[_0x9426('0x30')](_0x9426('0x50'),_0x1bf267['name']);return db[_0x9426('0x1b')][_0x9426('0x51')]({'where':{'role':_0x9426('0x52'),'online':!![],'id':{'$ne':_0x1bf267['id']}}});}})[_0x9426('0xf')](function(_0x3b5eae){if(_0x3b5eae){_0x35c1e6=_0x3b5eae;return require(_0x9426('0x53'))['getLicense']();}})[_0x9426('0xf')](function(_0x5734d8){if(_0x5734d8&&_0x5734d8[_0x9426('0x54')]&&_0x35c1e6>=_0x5734d8[_0x9426('0x54')]){throw new Error(_0x9426('0x55'));}})[_0x9426('0xf')](function(){if(_0x1bf267){return db['UserVoiceQueueRt'][_0x9426('0x4c')]({'where':{'membername':_0x1bf267[_0x9426('0x27')]},'individualHooks':!![]});}})[_0x9426('0xf')](function(){if(_0x1bf267){return _0x1bf267['getVoiceQueues']({'raw':!![]});}})[_0x9426('0xf')](function(_0x6e63cd){if(_0x1bf267){if(_0x6e63cd){var _0x71b93c=[];_0x621675=_0x6e63cd;if(_0x621675[_0x9426('0x2f')]){for(var _0x5ae28e=0x0;_0x5ae28e<_0x621675[_0x9426('0x2f')];_0x5ae28e++){_0x71b93c[_0x9426('0x49')](db[_0x9426('0x2b')]['upsert']({'membername':_0x1bf267[_0x9426('0x27')],'UserId':_0x1bf267['id'],'queue_name':_0x621675[_0x5ae28e][_0x9426('0x27')],'VoiceQueueId':_0x621675[_0x5ae28e]['id'],'interface':_0x51d129,'paused':_0x1bf267[_0x9426('0x4f')]||![],'penalty':_0x621675[_0x5ae28e]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x71b93c);}}}})[_0x9426('0xf')](function(){if(_0x1bf267){return db[_0x9426('0x2d')][_0x9426('0x47')]({'where':{'membername':_0x1bf267['name'],'exitAt':null}});}})['then'](function(_0x1b7f8a){if(_0x1bf267){if(_0x1b7f8a&&_0x1b7f8a['length']){var _0x24f43a=[];_0x1b7f8a['forEach'](function(_0x5e883e){_0x24f43a[_0x9426('0x49')](_0x5e883e['update']({'exitAt':moment()[_0x9426('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x24f43a);}}})[_0x9426('0xf')](function(_0x19f1da){if(_0x1bf267){var _0x466a52=[];var _0x2f8aee=[];var _0x2f280c=utils[_0x9426('0x33')]();var _0x233086={'membername':_0x1bf267[_0x9426('0x27')],'interface':_0x51d129,'enterAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'role':_0x1bf267[_0x9426('0x28')],'internal':_0x1bf267[_0x9426('0x29')]};_0x2f280c['forEach'](function(_0x328458){_0x466a52[_0x9426('0x49')](_[_0x9426('0x56')]({'channel':_0x328458,'type':'LOGIN','data1':_0x9426('0x57'),'data2':_0x51d129},_0x233086));if(_0x1bf267[_0x9426('0x4f')]){_0x2f8aee[_0x9426('0x49')](_[_0x9426('0x56')]({'channel':_0x328458,'type':_0x9426('0x2e'),'data1':'LOGININPAUSE'},_0x233086));}});return db[_0x9426('0x2d')][_0x9426('0x38')](_0x466a52[_0x9426('0x58')](_0x2f8aee),{'individualHooks':!![]});}})['then'](function(){if(_0x1bf267){return _0x1bf267['update']({'online':!![],'lastLoginAt':moment()[_0x9426('0x30')](_0x9426('0x31')),'voicePause':_0x1bf267['loginInPause']||![],'mailPause':_0x1bf267[_0x9426('0x4f')]||![],'chatPause':_0x1bf267['loginInPause']||![],'faxPause':_0x1bf267['loginInPause']||![],'smsPause':_0x1bf267['loginInPause']||![],'openchannelPause':_0x1bf267[_0x9426('0x4f')]||![],'pauseType':_0x1bf267[_0x9426('0x4f')]?_0x9426('0x59'):null,'lastPauseAt':moment()[_0x9426('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x51d129});}})['then'](function(_0x3cd646){_0x322e8e(_0x3cd646);})[_0x9426('0x19')](function(_0x37ea17){_0x323403(_0x5c2dd8[_0x9426('0x15')](0x1f4,_0x37ea17[_0x9426('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index b2597c1..e21d08d 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 _0x9c88=['user:','save','remove','length'];(function(_0x3ca41c,_0x340ea8){var _0x5445e9=function(_0x239c3a){while(--_0x239c3a){_0x3ca41c['push'](_0x3ca41c['shift']());}};_0x5445e9(++_0x340ea8);}(_0x9c88,0x111));var _0x89c8=function(_0x56d049,_0x31caff){_0x56d049=_0x56d049-0x0;var _0x39a317=_0x9c88[_0x56d049];return _0x39a317;};'use strict';var UserEvents=require('./user.events');var events=[_0x89c8('0x0'),_0x89c8('0x1'),'update'];function createListener(_0x5785c4,_0x49511f){return function(_0x230d5a){_0x49511f['emit'](_0x5785c4,_0x230d5a);};}function removeListener(_0x2e7532,_0x3b6fea){return function(){UserEvents['removeListener'](_0x2e7532,_0x3b6fea);};}exports['register']=function(_0x2087ed){for(var _0x5b83e=0x0,_0x4c3df7=events[_0x89c8('0x2')];_0x5b83e<_0x4c3df7;_0x5b83e++){var _0x2e4698=events[_0x5b83e];var _0x2039e9=createListener(_0x89c8('0x3')+_0x2e4698,_0x2087ed);UserEvents['on'](_0x2e4698,_0x2039e9);}}; \ No newline at end of file +var _0xdc90=['remove','emit','register','length','user:','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xdc90,0x1a9));var _0x0dc9=function(_0x50a2e3,_0x1af824){_0x50a2e3=_0x50a2e3-0x0;var _0x8ec356=_0xdc90[_0x50a2e3];return _0x8ec356;};'use strict';var UserEvents=require('./user.events');var events=[_0x0dc9('0x0'),_0x0dc9('0x1'),'update'];function createListener(_0x4d720a,_0x5abf64){return function(_0x736e65){_0x5abf64[_0x0dc9('0x2')](_0x4d720a,_0x736e65);};}function removeListener(_0x23424f,_0x22a2c9){return function(){UserEvents['removeListener'](_0x23424f,_0x22a2c9);};}exports[_0x0dc9('0x3')]=function(_0x475cff){for(var _0x22f00d=0x0,_0x14f4f0=events[_0x0dc9('0x4')];_0x22f00d<_0x14f4f0;_0x22f00d++){var _0x2a72fd=events[_0x22f00d];var _0x4161d4=createListener(_0x0dc9('0x5')+_0x2a72fd,_0x475cff);UserEvents['on'](_0x2a72fd,_0x4161d4);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 12571ca..df45792 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2a6494,_0x3acacb){var _0x43e8af=function(_0x41008a){while(--_0x41008a){_0x2a6494['push'](_0x2a6494['shift']());}};_0x43e8af(++_0x3acacb);}(_0x70e0,0x17b));var _0x070e=function(_0x510efa,_0x512377){_0x510efa=_0x510efa-0x0;var _0x2342cd=_0x70e0[_0x510efa];return _0x2342cd;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2c7ce1,_0x4cd2fb){var _0x4f023d=function(_0x45d46c){while(--_0x45d46c){_0x2c7ce1['push'](_0x2c7ce1['shift']());}};_0x4f023d(++_0x4cd2fb);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9f3a9f4..fe1d307 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 _0x452f=['sequelize','exports'];(function(_0x2a4af0,_0xdc5343){var _0x21fa03=function(_0x2b755c){while(--_0x2b755c){_0x2a4af0['push'](_0x2a4af0['shift']());}};_0x21fa03(++_0xdc5343);}(_0x452f,0x74));var _0xf452=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x452f[_0x454e6d];return _0x4bc294;};'use strict';var Sequelize=require(_0xf452('0x0'));module[_0xf452('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x60d7=['INTEGER','sequelize'];(function(_0x2642ef,_0x42e732){var _0x4b96d1=function(_0x29185d){while(--_0x29185d){_0x2642ef['push'](_0x2642ef['shift']());}};_0x4b96d1(++_0x42e732);}(_0x60d7,0x183));var _0x760d=function(_0x4fe63b,_0x55889c){_0x4fe63b=_0x4fe63b-0x0;var _0x4465ce=_0x60d7[_0x4fe63b];return _0x4465ce;};'use strict';var Sequelize=require(_0x760d('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x760d('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 026126d..7e2d003 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 _0xe800=['../../config/environment','./userChatQueue.attributes','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe800,0xaa));var _0x0e80=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xe800[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x0e80('0x0'));var util=require('util');var logger=require(_0x0e80('0x1'))(_0x0e80('0x2'));var moment=require(_0x0e80('0x3'));var BPromise=require(_0x0e80('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0e80('0x5'));var rimraf=require('rimraf');var config=require(_0x0e80('0x6'));var attributes=require(_0x0e80('0x7'));module['exports']=function(_0x1afa91,_0xfd1bf6){return _0x1afa91['define']('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24b6=['bluebird','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger','moment'];(function(_0x2da673,_0x1106ab){var _0x2314ff=function(_0x3e5890){while(--_0x3e5890){_0x2da673['push'](_0x2da673['shift']());}};_0x2314ff(++_0x1106ab);}(_0x24b6,0x194));var _0x624b=function(_0x285648,_0x305e55){_0x285648=_0x285648-0x0;var _0x709590=_0x24b6[_0x285648];return _0x709590;};'use strict';var _=require(_0x624b('0x0'));var util=require('util');var logger=require(_0x624b('0x1'))('api');var moment=require(_0x624b('0x2'));var BPromise=require(_0x624b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x624b('0x4'));var config=require(_0x624b('0x5'));var attributes=require(_0x624b('0x6'));module[_0x624b('0x7')]=function(_0x15073f,_0x5186dc){return _0x15073f[_0x624b('0x8')](_0x624b('0x9'),attributes,{'tableName':_0x624b('0xa'),'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 be2a025..3b6948b 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 _0xd1b1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x14d192,_0x1e7377){var _0x3ced3f=function(_0x3775c1){while(--_0x3775c1){_0x14d192['push'](_0x14d192['shift']());}};_0x3ced3f(++_0x1e7377);}(_0xd1b1,0xa1));var _0x1d1b=function(_0x3031b9,_0x12ea41){_0x3031b9=_0x3031b9-0x0;var _0x5901a5=_0xd1b1[_0x3031b9];return _0x5901a5;};'use strict';var _=require(_0x1d1b('0x0'));var util=require(_0x1d1b('0x1'));var moment=require(_0x1d1b('0x2'));var BPromise=require(_0x1d1b('0x3'));var rs=require(_0x1d1b('0x4'));var fs=require('fs');var Redis=require(_0x1d1b('0x5'));var db=require(_0x1d1b('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1d1b('0x7'));var config=require(_0x1d1b('0x8'));var jayson=require(_0x1d1b('0x9'));var client=jayson[_0x1d1b('0xa')][_0x1d1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ae6a4,_0x2971a6,_0x128a66){return new BPromise(function(_0xdbe938,_0x2bdcb9){return client[_0x1d1b('0xc')](_0x5ae6a4,_0x128a66)[_0x1d1b('0xd')](function(_0x4bcdbf){logger[_0x1d1b('0xe')](_0x1d1b('0xf'),_0x2971a6,_0x1d1b('0x10'));logger[_0x1d1b('0x11')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2971a6,_0x1d1b('0x10'),JSON['stringify'](_0x4bcdbf));if(_0x4bcdbf[_0x1d1b('0x12')]){if(_0x4bcdbf[_0x1d1b('0x12')]['code']===0x1f4){logger[_0x1d1b('0x12')](_0x1d1b('0xf'),_0x2971a6,_0x4bcdbf[_0x1d1b('0x12')][_0x1d1b('0x13')]);return _0x2bdcb9(_0x4bcdbf[_0x1d1b('0x12')]['message']);}logger[_0x1d1b('0x12')](_0x1d1b('0xf'),_0x2971a6,_0x4bcdbf[_0x1d1b('0x12')][_0x1d1b('0x13')]);return _0xdbe938(_0x4bcdbf[_0x1d1b('0x12')][_0x1d1b('0x13')]);}else{logger[_0x1d1b('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x2971a6,_0x1d1b('0x10'));_0xdbe938(_0x4bcdbf[_0x1d1b('0x14')][_0x1d1b('0x13')]);}})['catch'](function(_0x66ee5f){logger[_0x1d1b('0x12')](_0x1d1b('0xf'),_0x2971a6,_0x66ee5f);_0x2bdcb9(_0x66ee5f);});});} \ No newline at end of file +var _0xa713=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserChatQueue,\x20%s,\x20%s','message','catch'];(function(_0x3a8d2b,_0x489d66){var _0x16105a=function(_0x410e39){while(--_0x410e39){_0x3a8d2b['push'](_0x3a8d2b['shift']());}};_0x16105a(++_0x489d66);}(_0xa713,0x120));var _0x3a71=function(_0x4340da,_0x5ef1c6){_0x4340da=_0x4340da-0x0;var _0x238d62=_0xa713[_0x4340da];return _0x238d62;};'use strict';var _=require(_0x3a71('0x0'));var util=require(_0x3a71('0x1'));var moment=require(_0x3a71('0x2'));var BPromise=require(_0x3a71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3a71('0x4'));var logger=require(_0x3a71('0x5'))(_0x3a71('0x6'));var config=require('../../config/environment');var jayson=require(_0x3a71('0x7'));var client=jayson['client'][_0x3a71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x27146f,_0x3637df,_0x48eb1c){return new BPromise(function(_0x241acf,_0x4e48bc){return client[_0x3a71('0x9')](_0x27146f,_0x48eb1c)['then'](function(_0x3d9414){logger[_0x3a71('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x3637df,_0x3a71('0xb'));logger['debug'](_0x3a71('0xc'),_0x3637df,_0x3a71('0xb'),JSON[_0x3a71('0xd')](_0x3d9414));if(_0x3d9414['error']){if(_0x3d9414['error']['code']===0x1f4){logger[_0x3a71('0xe')](_0x3a71('0xf'),_0x3637df,_0x3d9414['error'][_0x3a71('0x10')]);return _0x4e48bc(_0x3d9414['error']['message']);}logger[_0x3a71('0xe')](_0x3a71('0xf'),_0x3637df,_0x3d9414['error'][_0x3a71('0x10')]);return _0x241acf(_0x3d9414[_0x3a71('0xe')]['message']);}else{logger[_0x3a71('0xa')](_0x3a71('0xf'),_0x3637df,_0x3a71('0xb'));_0x241acf(_0x3d9414['result']['message']);}})[_0x3a71('0x11')](function(_0x103283){logger[_0x3a71('0xe')](_0x3a71('0xf'),_0x3637df,_0x103283);_0x4e48bc(_0x103283);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index dab56c1..0e1869b 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3b534d,_0x1c64b1){var _0x5d25a1=function(_0x5831d4){while(--_0x5831d4){_0x3b534d['push'](_0x3b534d['shift']());}};_0x5d25a1(++_0x1c64b1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xcb91[_0x599e60];return _0x468e19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x28fa6f,_0x1b22ac){var _0x1ae01b=function(_0x12aed8){while(--_0x12aed8){_0x28fa6f['push'](_0x28fa6f['shift']());}};_0x1ae01b(++_0x1b22ac);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a4fc1a2..ec0bc1e 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 _0xf147=['INTEGER','STRING','sequelize'];(function(_0x3dcb4d,_0x6f63f9){var _0x5d70ac=function(_0x4d6973){while(--_0x4d6973){_0x3dcb4d['push'](_0x3dcb4d['shift']());}};_0x5d70ac(++_0x6f63f9);}(_0xf147,0x1f4));var _0x7f14=function(_0x1cd4e7,_0x5f17dd){_0x1cd4e7=_0x1cd4e7-0x0;var _0x5243eb=_0xf147[_0x1cd4e7];return _0x5243eb;};'use strict';var Sequelize=require(_0x7f14('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7f14('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7f14('0x2')]}}; \ No newline at end of file +var _0x31e6=['INTEGER','sequelize','exports'];(function(_0x314f95,_0x33f646){var _0x397feb=function(_0x34ed40){while(--_0x34ed40){_0x314f95['push'](_0x314f95['shift']());}};_0x397feb(++_0x33f646);}(_0x31e6,0xd3));var _0x631e=function(_0x5dcb63,_0x48c9b2){_0x5dcb63=_0x5dcb63-0x0;var _0x143969=_0x31e6[_0x5dcb63];return _0x143969;};'use strict';var Sequelize=require(_0x631e('0x0'));module[_0x631e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x631e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 37df663..c156952 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 _0x1d35=['../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x1fa10d,_0x3ac4b1){var _0x1d176c=function(_0x517e25){while(--_0x517e25){_0x1fa10d['push'](_0x1fa10d['shift']());}};_0x1d176c(++_0x3ac4b1);}(_0x1d35,0x1b1));var _0x51d3=function(_0x146a23,_0x3b96f2){_0x146a23=_0x146a23-0x0;var _0x2f20b0=_0x1d35[_0x146a23];return _0x2f20b0;};'use strict';var _=require(_0x51d3('0x0'));var util=require(_0x51d3('0x1'));var logger=require(_0x51d3('0x2'))(_0x51d3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x51d3('0x4'));var fs=require('fs');var path=require(_0x51d3('0x5'));var rimraf=require(_0x51d3('0x6'));var config=require(_0x51d3('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x51d3('0x8')]=function(_0x4e5970,_0x1325d1){return _0x4e5970['define'](_0x51d3('0x9'),attributes,{'tableName':_0x51d3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c18=['UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4c18,0x116));var _0x84c1=function(_0x1b0136,_0x3a6832){_0x1b0136=_0x1b0136-0x0;var _0x3cf650=_0x4c18[_0x1b0136];return _0x3cf650;};'use strict';var _=require(_0x84c1('0x0'));var util=require(_0x84c1('0x1'));var logger=require(_0x84c1('0x2'))(_0x84c1('0x3'));var moment=require(_0x84c1('0x4'));var BPromise=require(_0x84c1('0x5'));var rp=require(_0x84c1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x84c1('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x84c1('0x8')]=function(_0x3a0273,_0x4d8d6a){return _0x3a0273[_0x84c1('0x9')](_0x84c1('0xa'),attributes,{'tableName':_0x84c1('0xb'),'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 8745c14..c42def5 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 _0xfd92=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x4a4710,_0x5d8f4c){var _0x1441ba=function(_0x284133){while(--_0x284133){_0x4a4710['push'](_0x4a4710['shift']());}};_0x1441ba(++_0x5d8f4c);}(_0xfd92,0x1a9));var _0x2fd9=function(_0x30df37,_0x48ad64){_0x30df37=_0x30df37-0x0;var _0x41ab55=_0xfd92[_0x30df37];return _0x41ab55;};'use strict';var _=require('lodash');var util=require(_0x2fd9('0x0'));var moment=require(_0x2fd9('0x1'));var BPromise=require(_0x2fd9('0x2'));var rs=require(_0x2fd9('0x3'));var fs=require('fs');var Redis=require(_0x2fd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2fd9('0x5'));var logger=require(_0x2fd9('0x6'))(_0x2fd9('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2fd9('0x8')][_0x2fd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35bd09,_0x38beca,_0x1e13fa){return new BPromise(function(_0x3e2b62,_0x524a01){return client[_0x2fd9('0xa')](_0x35bd09,_0x1e13fa)[_0x2fd9('0xb')](function(_0xb49227){logger[_0x2fd9('0xc')](_0x2fd9('0xd'),_0x38beca,_0x2fd9('0xe'));logger['debug'](_0x2fd9('0xf'),_0x38beca,_0x2fd9('0xe'),JSON[_0x2fd9('0x10')](_0xb49227));if(_0xb49227[_0x2fd9('0x11')]){if(_0xb49227[_0x2fd9('0x11')][_0x2fd9('0x12')]===0x1f4){logger[_0x2fd9('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x38beca,_0xb49227[_0x2fd9('0x11')][_0x2fd9('0x13')]);return _0x524a01(_0xb49227[_0x2fd9('0x11')]['message']);}logger[_0x2fd9('0x11')](_0x2fd9('0xd'),_0x38beca,_0xb49227[_0x2fd9('0x11')]['message']);return _0x3e2b62(_0xb49227['error'][_0x2fd9('0x13')]);}else{logger[_0x2fd9('0xc')](_0x2fd9('0xd'),_0x38beca,_0x2fd9('0xe'));_0x3e2b62(_0xb49227['result']['message']);}})[_0x2fd9('0x14')](function(_0x4e3dfb){logger[_0x2fd9('0x11')](_0x2fd9('0xd'),_0x38beca,_0x4e3dfb);_0x524a01(_0x4e3dfb);});});} \ No newline at end of file +var _0x72f9=['../../config/logger','rpc','jayson/promise','client','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x34f3c7,_0x393441){var _0x258767=function(_0x1528d1){while(--_0x1528d1){_0x34f3c7['push'](_0x34f3c7['shift']());}};_0x258767(++_0x393441);}(_0x72f9,0x174));var _0x972f=function(_0x1fc7b5,_0x5d4779){_0x1fc7b5=_0x1fc7b5-0x0;var _0x3ef5db=_0x72f9[_0x1fc7b5];return _0x3ef5db;};'use strict';var _=require(_0x972f('0x0'));var util=require(_0x972f('0x1'));var moment=require('moment');var BPromise=require(_0x972f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x972f('0x3'));var db=require(_0x972f('0x4'))['db'];var utils=require(_0x972f('0x5'));var logger=require(_0x972f('0x6'))(_0x972f('0x7'));var config=require('../../config/environment');var jayson=require(_0x972f('0x8'));var client=jayson[_0x972f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x410552,_0x14ccef,_0x10374b){return new BPromise(function(_0x4c1cf5,_0x85e2c){return client[_0x972f('0xa')](_0x410552,_0x10374b)[_0x972f('0xb')](function(_0x1272c1){logger['info'](_0x972f('0xc'),_0x14ccef,_0x972f('0xd'));logger[_0x972f('0xe')](_0x972f('0xf'),_0x14ccef,_0x972f('0xd'),JSON[_0x972f('0x10')](_0x1272c1));if(_0x1272c1[_0x972f('0x11')]){if(_0x1272c1[_0x972f('0x11')][_0x972f('0x12')]===0x1f4){logger[_0x972f('0x11')](_0x972f('0xc'),_0x14ccef,_0x1272c1['error'][_0x972f('0x13')]);return _0x85e2c(_0x1272c1[_0x972f('0x11')][_0x972f('0x13')]);}logger[_0x972f('0x11')](_0x972f('0xc'),_0x14ccef,_0x1272c1[_0x972f('0x11')][_0x972f('0x13')]);return _0x4c1cf5(_0x1272c1[_0x972f('0x11')][_0x972f('0x13')]);}else{logger['info'](_0x972f('0xc'),_0x14ccef,_0x972f('0xd'));_0x4c1cf5(_0x1272c1[_0x972f('0x14')]['message']);}})['catch'](function(_0x11bbf5){logger[_0x972f('0x11')](_0x972f('0xc'),_0x14ccef,_0x11bbf5);_0x85e2c(_0x11bbf5);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cf339a6..61b61be 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x47c704,_0x40acc4){var _0x286ccd=function(_0x55ef77){while(--_0x55ef77){_0x47c704['push'](_0x47c704['shift']());}};_0x286ccd(++_0x40acc4);}(_0x70e0,0x17b));var _0x070e=function(_0x1f67b6,_0xd9ddc8){_0x1f67b6=_0x1f67b6-0x0;var _0x5774f6=_0x70e0[_0x1f67b6];return _0x5774f6;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x438550,_0x14e77b){var _0x270ad8=function(_0x20ff69){while(--_0x20ff69){_0x438550['push'](_0x438550['shift']());}};_0x270ad8(++_0x14e77b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5d8c203..18f7e6e 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 _0x03df=['exports'];(function(_0x1211d2,_0xbf5130){var _0x29d7c1=function(_0x48f48a){while(--_0x48f48a){_0x1211d2['push'](_0x1211d2['shift']());}};_0x29d7c1(++_0xbf5130);}(_0x03df,0x100));var _0xf03d=function(_0x3f882d,_0x31d4c8){_0x3f882d=_0x3f882d-0x0;var _0x3ce31f=_0x03df[_0x3f882d];return _0x3ce31f;};'use strict';var Sequelize=require('sequelize');module[_0xf03d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xc635=['sequelize','exports','INTEGER'];(function(_0x1d20ba,_0x5425bf){var _0x347f2a=function(_0x488c9b){while(--_0x488c9b){_0x1d20ba['push'](_0x1d20ba['shift']());}};_0x347f2a(++_0x5425bf);}(_0xc635,0x1b3));var _0x5c63=function(_0x177c9c,_0x1fdc9b){_0x177c9c=_0x177c9c-0x0;var _0x47eda0=_0xc635[_0x177c9c];return _0x47eda0;};'use strict';var Sequelize=require(_0x5c63('0x0'));module[_0x5c63('0x1')]={'penalty':{'type':Sequelize[_0x5c63('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 7a3c7f8..8d311dc 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 _0x0c57=['rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util','api','moment','bluebird','request-promise','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c57,0xf6));var _0x70c5=function(_0x3979c6,_0x3a474a){_0x3979c6=_0x3979c6-0x0;var _0x1807fb=_0x0c57[_0x3979c6];return _0x1807fb;};'use strict';var _=require('lodash');var util=require(_0x70c5('0x0'));var logger=require('../../config/logger')(_0x70c5('0x1'));var moment=require(_0x70c5('0x2'));var BPromise=require(_0x70c5('0x3'));var rp=require(_0x70c5('0x4'));var fs=require('fs');var path=require(_0x70c5('0x5'));var rimraf=require(_0x70c5('0x6'));var config=require('../../config/environment');var attributes=require(_0x70c5('0x7'));module[_0x70c5('0x8')]=function(_0x34260c,_0x7a9f0b){return _0x34260c[_0x70c5('0x9')](_0x70c5('0xa'),attributes,{'tableName':_0x70c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x619c=['bluebird','path','rimraf','./userMailQueue.attributes','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x46029e,_0x3c5a0d){var _0xf255c4=function(_0x5ebce1){while(--_0x5ebce1){_0x46029e['push'](_0x46029e['shift']());}};_0xf255c4(++_0x3c5a0d);}(_0x619c,0xd8));var _0xc619=function(_0x543d80,_0x248f2e){_0x543d80=_0x543d80-0x0;var _0x182dac=_0x619c[_0x543d80];return _0x182dac;};'use strict';var _=require(_0xc619('0x0'));var util=require(_0xc619('0x1'));var logger=require(_0xc619('0x2'))(_0xc619('0x3'));var moment=require('moment');var BPromise=require(_0xc619('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc619('0x5'));var rimraf=require(_0xc619('0x6'));var config=require('../../config/environment');var attributes=require(_0xc619('0x7'));module['exports']=function(_0x4e67e4,_0x3183f8){return _0x4e67e4[_0xc619('0x8')](_0xc619('0x9'),attributes,{'tableName':_0xc619('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index fb5afc5..6eb4683 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x57171a,_0x10ad86){var _0x3fbe22=function(_0x191960){while(--_0x191960){_0x57171a['push'](_0x57171a['shift']());}};_0x3fbe22(++_0x10ad86);}(_0x6aa7,0x178));var _0x76aa=function(_0x59a0fc,_0xb077dd){_0x59a0fc=_0x59a0fc-0x0;var _0x37404f=_0x6aa7[_0x59a0fc];return _0x37404f;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x3364b4,_0x2f780f){var _0x23de26=function(_0x46f734){while(--_0x46f734){_0x3364b4['push'](_0x3364b4['shift']());}};_0x23de26(++_0x2f780f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x4b84[_0x5da0d9];return _0x4b6d2f;};'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')]('UserMailQueue,\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')]('UserMailQueue,\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 diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index fa406ae..3ad3742 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 _0x222f=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1810ac,_0x4a66bf){var _0x273e0e=function(_0xcfd530){while(--_0xcfd530){_0x1810ac['push'](_0x1810ac['shift']());}};_0x273e0e(++_0x4a66bf);}(_0x222f,0x132));var _0xf222=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x222f[_0x4c7935];return _0x30651d;};'use strict';var multer=require('multer');var util=require(_0xf222('0x0'));var path=require(_0xf222('0x1'));var timeout=require(_0xf222('0x2'));var express=require(_0xf222('0x3'));var router=express[_0xf222('0x4')]();var fs_extra=require(_0xf222('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require(_0xf222('0x8'));router[_0xf222('0x9')]('/',auth[_0xf222('0xa')](),controller['sendUserNotification']);module[_0xf222('0xb')]=router; \ No newline at end of file +var _0xe10f=['../../config/environment','./userNotification.controller','post','sendUserNotification','exports','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2ba72f,_0x2109bf){var _0x30910e=function(_0x4d7ba2){while(--_0x4d7ba2){_0x2ba72f['push'](_0x2ba72f['shift']());}};_0x30910e(++_0x2109bf);}(_0xe10f,0xa5));var _0xfe10=function(_0x109210,_0x343060){_0x109210=_0x109210-0x0;var _0x68fae3=_0xe10f[_0x109210];return _0x68fae3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe10('0x0'));var timeout=require(_0xfe10('0x1'));var express=require(_0xfe10('0x2'));var router=express[_0xfe10('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe10('0x4'));var config=require(_0xfe10('0x5'));var controller=require(_0xfe10('0x6'));router[_0xfe10('0x7')]('/',auth['isAuthenticated'](),controller[_0xfe10('0x8')]);module[_0xfe10('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 58ae0fa..531374c 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 _0x0172=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x20706c,_0x9f6842){var _0x28271a=function(_0x48bc3d){while(--_0x48bc3d){_0x20706c['push'](_0x20706c['shift']());}};_0x28271a(++_0x9f6842);}(_0x0172,0x187));var _0x2017=function(_0x48e2d2,_0x2398d8){_0x48e2d2=_0x48e2d2-0x0;var _0x44ee87=_0x0172[_0x48e2d2];return _0x44ee87;};'use strict';var Sequelize=require(_0x2017('0x0'));module[_0x2017('0x1')]={'body':{'type':Sequelize[_0x2017('0x2')]},'senderName':{'type':Sequelize[_0x2017('0x3')]},'recipientsId':{'type':Sequelize[_0x2017('0x2')]},'recipientsDescription':{'type':Sequelize[_0x2017('0x3')]},'beep':{'type':Sequelize[_0x2017('0x4')]}}; \ No newline at end of file +var _0x5a49=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x5a49,0xe1));var _0x95a4=function(_0x928dd3,_0x2d66aa){_0x928dd3=_0x928dd3-0x0;var _0x115b05=_0x5a49[_0x928dd3];return _0x115b05;};'use strict';var Sequelize=require(_0x95a4('0x0'));module[_0x95a4('0x1')]={'body':{'type':Sequelize[_0x95a4('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x95a4('0x2')]},'recipientsDescription':{'type':Sequelize[_0x95a4('0x3')]},'beep':{'type':Sequelize[_0x95a4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a67787a..1a77b5f 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 _0x3999=['hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','ValidationError','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','ids','includes','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','request-promise','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','status','offset','undefined','limit','count','set','Content-Range','save','update','then','sendStatus','stack','name','send','sendUserNotification','body','text'];(function(_0x1e98b4,_0x1f9aad){var _0x48916f=function(_0x29266e){while(--_0x29266e){_0x1e98b4['push'](_0x1e98b4['shift']());}};_0x48916f(++_0x1f9aad);}(_0x3999,0x1c7));var _0x9399=function(_0x421042,_0x31689c){_0x421042=_0x421042-0x0;var _0x4e654d=_0x3999[_0x421042];return _0x4e654d;};'use strict';var emlformat=require(_0x9399('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9399('0x1'));var moment=require('moment');var BPromise=require(_0x9399('0x2'));var Mustache=require('mustache');var util=require(_0x9399('0x3'));var path=require(_0x9399('0x4'));var sox=require(_0x9399('0x5'));var csv=require('to-csv');var ejs=require(_0x9399('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9399('0x7'));var squel=require('squel');var crypto=require(_0x9399('0x8'));var jsforce=require(_0x9399('0x9'));var deskjs=require(_0x9399('0xa'));var toCsv=require(_0x9399('0xb'));var querystring=require(_0x9399('0xc'));var Papa=require(_0x9399('0xd'));var Redis=require(_0x9399('0xe'));var authService=require(_0x9399('0xf'));var qs=require(_0x9399('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9399('0x11'));var logger=require(_0x9399('0x12'))(_0x9399('0x13'));var utils=require(_0x9399('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9399('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9399('0x16')](config[_0x9399('0x17')],{'host':_0x9399('0x18'),'port':0x18eb});var socket=require(_0x9399('0x19'))(new Redis(config[_0x9399('0x17')]));require(_0x9399('0x1a'))[_0x9399('0x1b')](socket);function respondWithStatusCode(_0x34ae7f,_0xfb0f6f){_0xfb0f6f=_0xfb0f6f||0xcc;return function(_0x1fa207){if(_0x1fa207){return _0x34ae7f['sendStatus'](_0xfb0f6f);}return _0x34ae7f[_0x9399('0x1c')](_0xfb0f6f)['end']();};}function respondWithResult(_0x2943b4,_0x3368f7){_0x3368f7=_0x3368f7||0xc8;return function(_0x416368){if(_0x416368){return _0x2943b4[_0x9399('0x1c')](_0x3368f7)['json'](_0x416368);}};}function respondWithFilteredResult(_0x100a16,_0x298b8d){return function(_0x4569c8){if(_0x4569c8){var _0x1eda7b=typeof _0x298b8d[_0x9399('0x1d')]===_0x9399('0x1e')&&typeof _0x298b8d[_0x9399('0x1f')]===_0x9399('0x1e');var _0x1e122d=_0x4569c8[_0x9399('0x20')];var _0x4ac095=_0x1eda7b?0x0:_0x298b8d[_0x9399('0x1d')];var _0xbe812c=_0x1eda7b?_0x4569c8[_0x9399('0x20')]:_0x298b8d[_0x9399('0x1d')]+_0x298b8d['limit'];var _0x44f222;if(_0xbe812c>=_0x1e122d){_0xbe812c=_0x1e122d;_0x44f222=0xc8;}else{_0x44f222=0xce;}_0x100a16[_0x9399('0x1c')](_0x44f222);return _0x100a16[_0x9399('0x21')](_0x9399('0x22'),_0x4ac095+'-'+_0xbe812c+'/'+_0x1e122d)['json'](_0x4569c8);}return null;};}function patchUpdates(_0x794d79){return function(_0x3e022f){try{jsonpatch['apply'](_0x3e022f,_0x794d79,!![]);}catch(_0x83f189){return BPromise['reject'](_0x83f189);}return _0x3e022f[_0x9399('0x23')]();};}function saveUpdates(_0x557a96,_0x3b1246){return function(_0xbf818b){if(_0xbf818b){return _0xbf818b[_0x9399('0x24')](_0x557a96)[_0x9399('0x25')](function(_0x4b1345){return _0x4b1345;});}return null;};}function removeEntity(_0x99c702,_0x1ffc16){return function(_0x168d19){if(_0x168d19){return _0x168d19['destroy']()[_0x9399('0x25')](function(){_0x99c702[_0x9399('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2da2,_0x5dce62){return function(_0x3bc092){if(!_0x3bc092){_0x3f2da2[_0x9399('0x26')](0x194);}return _0x3bc092;};}function handleError(_0x10a6fe,_0x41947a){_0x41947a=_0x41947a||0x1f4;return function(_0x165243){logger['error'](_0x165243[_0x9399('0x27')]);if(_0x165243[_0x9399('0x28')]){delete _0x165243[_0x9399('0x28')];}_0x10a6fe[_0x9399('0x1c')](_0x41947a)[_0x9399('0x29')](_0x165243);};}exports[_0x9399('0x2a')]=function(_0x1c26b8,_0x10c573,_0x3578f3){if(!_0x1c26b8[_0x9399('0x2b')]['hasOwnProperty'](_0x9399('0x2c'))&&!_0x1c26b8[_0x9399('0x2b')][_0x9399('0x2d')](_0x9399('0x2e'))){throw new db[(_0x9399('0x2f'))]['ValidationError'](_0x9399('0x30'));}else{if(_0x1c26b8[_0x9399('0x2b')][_0x9399('0x2d')](_0x9399('0x2e'))&&!_0x1c26b8[_0x9399('0x2b')][_0x9399('0x2d')](_0x9399('0x31'))){throw new db[(_0x9399('0x2f'))]['ValidationError'](_0x9399('0x32'));}if(!_0x1c26b8[_0x9399('0x2b')][_0x9399('0x2d')](_0x9399('0x33'))){throw new db[(_0x9399('0x2f'))]['ValidationError'](_0x9399('0x34'));}else{try{var _0x3bbcd2=JSON[_0x9399('0x35')](_0x1c26b8['body'][_0x9399('0x33')]);}catch(_0x4f2330){logger[_0x9399('0x36')](_0x4f2330);throw new db[(_0x9399('0x2f'))][(_0x9399('0x37'))](_0x9399('0x38'));}var _0x44d182=['chatqueue',_0x9399('0x39'),_0x9399('0x3a'),_0x9399('0x3b'),_0x9399('0x3c'),_0x9399('0x3d'),_0x9399('0x3e'),'team',_0x9399('0x3f')];if(_[_0x9399('0x40')](_0x3bbcd2,function(_0x89c7ec){return!_['includes'](_0x44d182,_0x89c7ec['model'][_0x9399('0x41')]());})){throw new db['Sequelize']['ValidationError'](_0x9399('0x42'));}}}var _0x353999={};_0x353999[_0x9399('0x43')]=_0x1c26b8['body']['hasOwnProperty'](_0x9399('0x43'))?_0x1c26b8[_0x9399('0x2b')]['senderName']:_0x1c26b8[_0x9399('0x3f')][_0x9399('0x44')];_0x353999['recipientsDescription']=_[_0x9399('0x45')](_0x1c26b8[_0x9399('0x2b')][_0x9399('0x46')])?null:_0x1c26b8[_0x9399('0x2b')][_0x9399('0x46')];_0x353999[_0x9399('0x47')]=_0x1c26b8[_0x9399('0x2b')][_0x9399('0x47')]||![];_0x353999['SenderId']=_0x1c26b8[_0x9399('0x3f')]['id'];return getContent(_0x1c26b8[_0x9399('0x2b')])[_0x9399('0x25')](function(_0x2c97e6){_0x353999[_0x9399('0x2b')]=_0x2c97e6;return getRecipients(_0x3bbcd2);})[_0x9399('0x25')](function(_0x4af9ab){_0x353999[_0x9399('0x48')]=_[_0x9399('0x49')](_0x4af9ab)[_0x9399('0x4a')](',');return db[_0x9399('0x4b')][_0x9399('0x4c')](function(_0x3797a8){return db[_0x9399('0x4d')][_0x9399('0x4e')](_0x353999,{'raw':!![],'transaction':_0x3797a8})[_0x9399('0x25')](function(_0x2c1139){var _0x496deb={'sender':_0x353999[_0x9399('0x43')],'description':_0x353999[_0x9399('0x46')],'content':_0x353999[_0x9399('0x2b')],'beep':_0x353999['beep']};_0x4af9ab[_0x9399('0x4f')](function(_0x30e9ce){_0x496deb[_0x9399('0x50')]=_0x30e9ce;socket['emit'](_0x9399('0x51'),_0x496deb);});return _0x2c1139;});});})[_0x9399('0x25')](respondWithResult(_0x10c573,0xc9))[_0x9399('0x52')](handleError(_0x10c573,null));};function getContent(_0x83693){return new BPromise(function(_0x5142de,_0x3a6c5a){if(_0x83693['text']){_0x5142de(_0x83693[_0x9399('0x2c')]);return;}return db[_0x9399('0x53')][_0x9399('0x54')]({'attributes':[_0x9399('0x55')],'where':{'id':_0x83693[_0x9399('0x2e')]},'raw':!![]})[_0x9399('0x25')](function(_0x3ae028){if(!_0x3ae028)throw new db['Sequelize'][(_0x9399('0x37'))](_0x9399('0x56'));var _0x54e440=Mustache['render'](_0x3ae028[_0x9399('0x55')],_0x83693['view']);_0x5142de(_0x54e440);})[_0x9399('0x52')](function(_0x14576d){_0x3a6c5a(_0x14576d);});});}function getRecipients(_0xf331bc){return new BPromise(function(_0x2b56a4,_0xcfe053){var _0x2d70d8=[];var _0x2a2e08=[];_0xf331bc[_0x9399('0x4f')](function(_0x25ac0b){var _0xd54425=_[_0x9399('0x57')](_0x25ac0b['model'][_0x9399('0x41')]());if(_0xd54425===_0x9399('0x58')){_0x2d70d8=_[_0x9399('0x59')](_0x2d70d8,_0x25ac0b[_0x9399('0x5a')]);}else{if(_[_0x9399('0x5b')](_0xd54425,_0x9399('0x5c')))_0xd54425=_0xd54425[_0x9399('0x5d')](_0x9399('0x5c'),_0x9399('0x5e'));_0x25ac0b[_0x9399('0x5a')]['forEach'](function(_0xb3a01f){_0x2a2e08[_0x9399('0x5f')](getAgents(_0xd54425,_0xb3a01f));});}});return BPromise[_0x9399('0x60')](_0x2a2e08)[_0x9399('0x25')](function(_0x5cb975){_0x2d70d8=_['union'](_0x2d70d8,_[_0x9399('0x61')](_0x5cb975));_0x2b56a4(_0x2d70d8);})[_0x9399('0x52')](function(_0x4fb50c){_0xcfe053(_0x4fb50c);});});}function getAgents(_0x1b43cc,_0x306891){return new BPromise(function(_0x2f94c3,_0x28487b){return db[_0x1b43cc]['findOne']({'where':{'id':_0x306891}})[_0x9399('0x25')](function(_0x2ac9b6){return _0x2ac9b6[_0x9399('0x62')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1e6ab7){var _0x2991ee=_[_0x9399('0x63')](_0x1e6ab7,'id');_0x2f94c3(_0x2991ee);});})['catch'](function(_0x5362ed){_0x28487b(_0x5362ed);});});} \ No newline at end of file +var _0xa755=['bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','TemplateId','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','forEach','recipient','emit','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','replace','queue','Queue','push','all','flatten','getAgents','map','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x21b36a,_0x519907){var _0x553cfc=function(_0x427ca7){while(--_0x427ca7){_0x21b36a['push'](_0x21b36a['shift']());}};_0x553cfc(++_0x519907);}(_0xa755,0xcc));var _0x5a75=function(_0x547887,_0x5e3004){_0x547887=_0x547887-0x0;var _0x37b562=_0xa755[_0x547887];return _0x37b562;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5a75('0x0'));var jsonpatch=require(_0x5a75('0x1'));var rp=require(_0x5a75('0x2'));var moment=require(_0x5a75('0x3'));var BPromise=require(_0x5a75('0x4'));var Mustache=require(_0x5a75('0x5'));var util=require(_0x5a75('0x6'));var path=require(_0x5a75('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5a75('0x8'));var fs=require('fs');var fs_extra=require(_0x5a75('0x9'));var _=require(_0x5a75('0xa'));var squel=require(_0x5a75('0xb'));var crypto=require('crypto');var jsforce=require(_0x5a75('0xc'));var deskjs=require(_0x5a75('0xd'));var toCsv=require(_0x5a75('0xe'));var querystring=require(_0x5a75('0xf'));var Papa=require(_0x5a75('0x10'));var Redis=require(_0x5a75('0x11'));var authService=require(_0x5a75('0x12'));var qs=require(_0x5a75('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a75('0x14'));var logger=require(_0x5a75('0x15'))(_0x5a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5a75('0x17'));var db=require(_0x5a75('0x18'))['db'];config[_0x5a75('0x19')]=_[_0x5a75('0x1a')](config[_0x5a75('0x19')],{'host':_0x5a75('0x1b'),'port':0x18eb});var socket=require(_0x5a75('0x1c'))(new Redis(config['redis']));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x44b0ed,_0x3341b4){_0x3341b4=_0x3341b4||0xcc;return function(_0x35a0d6){if(_0x35a0d6){return _0x44b0ed[_0x5a75('0x1d')](_0x3341b4);}return _0x44b0ed['status'](_0x3341b4)[_0x5a75('0x1e')]();};}function respondWithResult(_0x52f421,_0x3c6838){_0x3c6838=_0x3c6838||0xc8;return function(_0x5c47ef){if(_0x5c47ef){return _0x52f421[_0x5a75('0x1f')](_0x3c6838)[_0x5a75('0x20')](_0x5c47ef);}};}function respondWithFilteredResult(_0x21fbed,_0x15db6c){return function(_0x139796){if(_0x139796){var _0x360e42=typeof _0x15db6c[_0x5a75('0x21')]===_0x5a75('0x22')&&typeof _0x15db6c[_0x5a75('0x23')]==='undefined';var _0x40287d=_0x139796[_0x5a75('0x24')];var _0x32c163=_0x360e42?0x0:_0x15db6c[_0x5a75('0x21')];var _0x10bd83=_0x360e42?_0x139796[_0x5a75('0x24')]:_0x15db6c[_0x5a75('0x21')]+_0x15db6c[_0x5a75('0x23')];var _0x3c2eec;if(_0x10bd83>=_0x40287d){_0x10bd83=_0x40287d;_0x3c2eec=0xc8;}else{_0x3c2eec=0xce;}_0x21fbed[_0x5a75('0x1f')](_0x3c2eec);return _0x21fbed[_0x5a75('0x25')](_0x5a75('0x26'),_0x32c163+'-'+_0x10bd83+'/'+_0x40287d)[_0x5a75('0x20')](_0x139796);}return null;};}function patchUpdates(_0x3d58bc){return function(_0x366972){try{jsonpatch[_0x5a75('0x27')](_0x366972,_0x3d58bc,!![]);}catch(_0xa32fc2){return BPromise[_0x5a75('0x28')](_0xa32fc2);}return _0x366972['save']();};}function saveUpdates(_0x4657b,_0x19c0ba){return function(_0x1d5b0d){if(_0x1d5b0d){return _0x1d5b0d[_0x5a75('0x29')](_0x4657b)[_0x5a75('0x2a')](function(_0x2e9855){return _0x2e9855;});}return null;};}function removeEntity(_0x1eee0b,_0x4cd6f2){return function(_0x6ae7a9){if(_0x6ae7a9){return _0x6ae7a9[_0x5a75('0x2b')]()['then'](function(){_0x1eee0b[_0x5a75('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9637,_0x35efb9){return function(_0x2e5a99){if(!_0x2e5a99){_0x4c9637[_0x5a75('0x1d')](0x194);}return _0x2e5a99;};}function handleError(_0x75be08,_0x5e6ba9){_0x5e6ba9=_0x5e6ba9||0x1f4;return function(_0x3fa6c8){logger[_0x5a75('0x2c')](_0x3fa6c8[_0x5a75('0x2d')]);if(_0x3fa6c8[_0x5a75('0x2e')]){delete _0x3fa6c8['name'];}_0x75be08[_0x5a75('0x1f')](_0x5e6ba9)[_0x5a75('0x2f')](_0x3fa6c8);};}exports[_0x5a75('0x30')]=function(_0xcc061d,_0x560235,_0x3d4ba8){if(!_0xcc061d['body']['hasOwnProperty'](_0x5a75('0x31'))&&!_0xcc061d[_0x5a75('0x32')][_0x5a75('0x33')]('TemplateId')){throw new db['Sequelize']['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0xcc061d[_0x5a75('0x32')]['hasOwnProperty'](_0x5a75('0x34'))&&!_0xcc061d[_0x5a75('0x32')][_0x5a75('0x33')](_0x5a75('0x35'))){throw new db[(_0x5a75('0x36'))]['ValidationError'](_0x5a75('0x37'));}if(!_0xcc061d[_0x5a75('0x32')]['hasOwnProperty'](_0x5a75('0x38'))){throw new db['Sequelize'][(_0x5a75('0x39'))](_0x5a75('0x3a'));}else{try{var _0x5d3cd0=JSON['parse'](_0xcc061d['body']['recipients']);}catch(_0x4f0c5b){logger[_0x5a75('0x2c')](_0x4f0c5b);throw new db[(_0x5a75('0x36'))][(_0x5a75('0x39'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x59c3f6=[_0x5a75('0x3b'),_0x5a75('0x3c'),'mailqueue',_0x5a75('0x3d'),_0x5a75('0x3e'),_0x5a75('0x3f'),_0x5a75('0x40'),_0x5a75('0x41'),_0x5a75('0x42')];if(_[_0x5a75('0x43')](_0x5d3cd0,function(_0xd00a1){return!_[_0x5a75('0x44')](_0x59c3f6,_0xd00a1[_0x5a75('0x45')][_0x5a75('0x46')]());})){throw new db[(_0x5a75('0x36'))][(_0x5a75('0x39'))](_0x5a75('0x47'));}}}var _0x1eef15={};_0x1eef15[_0x5a75('0x48')]=_0xcc061d[_0x5a75('0x32')][_0x5a75('0x33')](_0x5a75('0x48'))?_0xcc061d[_0x5a75('0x32')][_0x5a75('0x48')]:_0xcc061d[_0x5a75('0x42')]['fullname'];_0x1eef15['recipientsDescription']=_['isEmpty'](_0xcc061d[_0x5a75('0x32')][_0x5a75('0x49')])?null:_0xcc061d[_0x5a75('0x32')]['recipientsDescription'];_0x1eef15[_0x5a75('0x4a')]=_0xcc061d[_0x5a75('0x32')][_0x5a75('0x4a')]||![];_0x1eef15[_0x5a75('0x4b')]=_0xcc061d[_0x5a75('0x42')]['id'];return getContent(_0xcc061d[_0x5a75('0x32')])[_0x5a75('0x2a')](function(_0x46ef5c){_0x1eef15[_0x5a75('0x32')]=_0x46ef5c;return getRecipients(_0x5d3cd0);})[_0x5a75('0x2a')](function(_0x236d76){_0x1eef15[_0x5a75('0x4c')]=_[_0x5a75('0x4d')](_0x236d76)[_0x5a75('0x4e')](',');return db[_0x5a75('0x4f')][_0x5a75('0x50')](function(_0x4df165){return db[_0x5a75('0x51')]['create'](_0x1eef15,{'raw':!![],'transaction':_0x4df165})[_0x5a75('0x2a')](function(_0xf7ca74){var _0x257fff={'sender':_0x1eef15[_0x5a75('0x48')],'description':_0x1eef15[_0x5a75('0x49')],'content':_0x1eef15['body'],'beep':_0x1eef15[_0x5a75('0x4a')]};_0x236d76[_0x5a75('0x52')](function(_0x32aa12){_0x257fff[_0x5a75('0x53')]=_0x32aa12;socket[_0x5a75('0x54')](_0x5a75('0x55'),_0x257fff);});return _0xf7ca74;});});})[_0x5a75('0x2a')](respondWithResult(_0x560235,0xc9))[_0x5a75('0x56')](handleError(_0x560235,null));};function getContent(_0x4aa35a){return new BPromise(function(_0x3a6f25,_0x18e81f){if(_0x4aa35a[_0x5a75('0x31')]){_0x3a6f25(_0x4aa35a[_0x5a75('0x31')]);return;}return db[_0x5a75('0x57')][_0x5a75('0x58')]({'attributes':[_0x5a75('0x59')],'where':{'id':_0x4aa35a[_0x5a75('0x34')]},'raw':!![]})[_0x5a75('0x2a')](function(_0x20cf75){if(!_0x20cf75)throw new db[(_0x5a75('0x36'))][(_0x5a75('0x39'))](_0x5a75('0x5a'));var _0x6e86a0=Mustache[_0x5a75('0x5b')](_0x20cf75[_0x5a75('0x59')],_0x4aa35a['view']);_0x3a6f25(_0x6e86a0);})[_0x5a75('0x56')](function(_0x30d726){_0x18e81f(_0x30d726);});});}function getRecipients(_0x42700b){return new BPromise(function(_0x58ece3,_0x480ea1){var _0x3a5374=[];var _0x15e093=[];_0x42700b[_0x5a75('0x52')](function(_0x47138c){var _0x53c96d=_[_0x5a75('0x5c')](_0x47138c[_0x5a75('0x45')]['toLowerCase']());if(_0x53c96d===_0x5a75('0x5d')){_0x3a5374=_[_0x5a75('0x5e')](_0x3a5374,_0x47138c[_0x5a75('0x5f')]);}else{if(_[_0x5a75('0x44')](_0x53c96d,'queue'))_0x53c96d=_0x53c96d[_0x5a75('0x60')](_0x5a75('0x61'),_0x5a75('0x62'));_0x47138c[_0x5a75('0x5f')][_0x5a75('0x52')](function(_0xf42e2e){_0x15e093[_0x5a75('0x63')](getAgents(_0x53c96d,_0xf42e2e));});}});return BPromise[_0x5a75('0x64')](_0x15e093)[_0x5a75('0x2a')](function(_0x4e8d67){_0x3a5374=_[_0x5a75('0x5e')](_0x3a5374,_[_0x5a75('0x65')](_0x4e8d67));_0x58ece3(_0x3a5374);})[_0x5a75('0x56')](function(_0x70c1fe){_0x480ea1(_0x70c1fe);});});}function getAgents(_0x16147f,_0x544524){return new BPromise(function(_0x5664c7,_0x4a275b){return db[_0x16147f][_0x5a75('0x58')]({'where':{'id':_0x544524}})[_0x5a75('0x2a')](function(_0x37bdc6){return _0x37bdc6[_0x5a75('0x66')]({'attributes':['id'],'raw':!![]})[_0x5a75('0x2a')](function(_0x30f950){var _0xb34f6d=_[_0x5a75('0x67')](_0x30f950,'id');_0x5664c7(_0xb34f6d);});})[_0x5a75('0x56')](function(_0x3b47ac){_0x4a275b(_0x3b47ac);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 1e233a7..ae5b2ed 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 _0x4e5f=['save','update','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4e5f,0x164));var _0xf4e5=function(_0x444f9b,_0x308c48){_0x444f9b=_0x444f9b-0x0;var _0x4ff158=_0x4e5f[_0x444f9b];return _0x4ff158;};'use strict';var EventEmitter=require(_0xf4e5('0x0'));var UserNotification=require(_0xf4e5('0x1'))['db'][_0xf4e5('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf4e5('0x3')](0x0);var events={'afterCreate':_0xf4e5('0x4'),'afterUpdate':_0xf4e5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x57622d){return function(_0x1e7efc,_0x28eba3,_0xeda9a){UserNotificationEvents[_0xf4e5('0x6')](_0x57622d+':'+_0x1e7efc['id'],_0x1e7efc);UserNotificationEvents['emit'](_0x57622d,_0x1e7efc);_0xeda9a(null);};}for(var e in events){if(events[_0xf4e5('0x7')](e)){var event=events[e];UserNotification[_0xf4e5('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x5739=['events','../../mysqldb','UserNotification','setMaxListeners','remove','hasOwnProperty','hook','exports'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5739,0x98));var _0x9573=function(_0x457a47,_0x3e692a){_0x457a47=_0x457a47-0x0;var _0x12a1ea=_0x5739[_0x457a47];return _0x12a1ea;};'use strict';var EventEmitter=require(_0x9573('0x0'));var UserNotification=require(_0x9573('0x1'))['db'][_0x9573('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9573('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9573('0x4')};function emitEvent(_0x4db817){return function(_0x38fdc2,_0x4bf993,_0x3cd31b){UserNotificationEvents['emit'](_0x4db817+':'+_0x38fdc2['id'],_0x38fdc2);UserNotificationEvents['emit'](_0x4db817,_0x38fdc2);_0x3cd31b(null);};}for(var e in events){if(events[_0x9573('0x5')](e)){var event=events[e];UserNotification[_0x9573('0x6')](e,emitEvent(event));}}module[_0x9573('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index fa8676a..28cb11a 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 _0x38c8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x182a4d,_0x2ff158){var _0x3aba4a=function(_0x5a9ec7){while(--_0x5a9ec7){_0x182a4d['push'](_0x182a4d['shift']());}};_0x3aba4a(++_0x2ff158);}(_0x38c8,0x1af));var _0x838c=function(_0x397dd0,_0x58a7a8){_0x397dd0=_0x397dd0-0x0;var _0x4188b2=_0x38c8[_0x397dd0];return _0x4188b2;};'use strict';var _=require(_0x838c('0x0'));var util=require('util');var logger=require(_0x838c('0x1'))(_0x838c('0x2'));var moment=require(_0x838c('0x3'));var BPromise=require(_0x838c('0x4'));var rp=require(_0x838c('0x5'));var fs=require('fs');var path=require(_0x838c('0x6'));var rimraf=require(_0x838c('0x7'));var config=require(_0x838c('0x8'));var attributes=require(_0x838c('0x9'));module[_0x838c('0xa')]=function(_0x39c5e6,_0xdce659){return _0x39c5e6['define'](_0x838c('0xb'),attributes,{'tableName':_0x838c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x838c('0xd')});}; \ No newline at end of file +var _0x69af=['UserNotification','userNotifications','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','define'];(function(_0x1c0c6a,_0x900991){var _0x14ddbf=function(_0x2da11e){while(--_0x2da11e){_0x1c0c6a['push'](_0x1c0c6a['shift']());}};_0x14ddbf(++_0x900991);}(_0x69af,0x17b));var _0xf69a=function(_0x1e8d57,_0x4ae82f){_0x1e8d57=_0x1e8d57-0x0;var _0x5a658a=_0x69af[_0x1e8d57];return _0x5a658a;};'use strict';var _=require('lodash');var util=require(_0xf69a('0x0'));var logger=require(_0xf69a('0x1'))(_0xf69a('0x2'));var moment=require(_0xf69a('0x3'));var BPromise=require(_0xf69a('0x4'));var rp=require(_0xf69a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf69a('0x6'));var config=require(_0xf69a('0x7'));var attributes=require(_0xf69a('0x8'));module[_0xf69a('0x9')]=function(_0x723700,_0x5953c9){return _0x723700[_0xf69a('0xa')](_0xf69a('0xb'),attributes,{'tableName':_0xf69a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e05196a..b9e1151 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 _0x31c3=['randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x597b3b,_0x3febc1){var _0x2bf1db=function(_0x99d339){while(--_0x99d339){_0x597b3b['push'](_0x597b3b['shift']());}};_0x2bf1db(++_0x3febc1);}(_0x31c3,0xe4));var _0x331c=function(_0x1f702e,_0x324b45){_0x1f702e=_0x1f702e-0x0;var _0x31dbe8=_0x31c3[_0x1f702e];return _0x31dbe8;};'use strict';var _=require(_0x331c('0x0'));var util=require(_0x331c('0x1'));var moment=require(_0x331c('0x2'));var BPromise=require(_0x331c('0x3'));var rs=require(_0x331c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x331c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x331c('0x6'))(_0x331c('0x7'));var config=require(_0x331c('0x8'));var jayson=require(_0x331c('0x9'));var client=jayson[_0x331c('0xa')][_0x331c('0xb')]({'port':0x232a});config[_0x331c('0xc')]=_[_0x331c('0xd')](config[_0x331c('0xc')],{'host':_0x331c('0xe'),'port':0x18eb});var socket=require(_0x331c('0xf'))(new Redis(config[_0x331c('0xc')]));require(_0x331c('0x10'))[_0x331c('0x11')](socket);function respondWithRpcPromise(_0x143f2d,_0x1bdca8,_0x4c625c){return new BPromise(function(_0x43482e,_0x10d4c0){return client[_0x331c('0x12')](_0x143f2d,_0x4c625c)[_0x331c('0x13')](function(_0x380314){logger[_0x331c('0x14')]('UserNotification,\x20%s,\x20%s',_0x1bdca8,_0x331c('0x15'));logger[_0x331c('0x16')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x1bdca8,_0x331c('0x15'),JSON['stringify'](_0x380314));if(_0x380314[_0x331c('0x17')]){if(_0x380314['error'][_0x331c('0x18')]===0x1f4){logger[_0x331c('0x17')](_0x331c('0x19'),_0x1bdca8,_0x380314['error'][_0x331c('0x1a')]);return _0x10d4c0(_0x380314[_0x331c('0x17')]['message']);}logger['error'](_0x331c('0x19'),_0x1bdca8,_0x380314['error'][_0x331c('0x1a')]);return _0x43482e(_0x380314['error'][_0x331c('0x1a')]);}else{logger[_0x331c('0x14')](_0x331c('0x19'),_0x1bdca8,_0x331c('0x15'));_0x43482e(_0x380314[_0x331c('0x1b')][_0x331c('0x1a')]);}})[_0x331c('0x1c')](function(_0x514f7d){logger['error'](_0x331c('0x19'),_0x1bdca8,_0x514f7d);_0x10d4c0(_0x514f7d);});});} \ No newline at end of file +var _0xe71b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','./userNotification.socket','register','request','then','request\x20sent','debug','error','code','UserNotification,\x20%s,\x20%s','message','info','result','lodash','util','moment'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xe71b,0x1a6));var _0xbe71=function(_0x2ac5f8,_0x4c3a9f){_0x2ac5f8=_0x2ac5f8-0x0;var _0x3b8229=_0xe71b[_0x2ac5f8];return _0x3b8229;};'use strict';var _=require(_0xbe71('0x0'));var util=require(_0xbe71('0x1'));var moment=require(_0xbe71('0x2'));var BPromise=require(_0xbe71('0x3'));var rs=require(_0xbe71('0x4'));var fs=require('fs');var Redis=require(_0xbe71('0x5'));var db=require(_0xbe71('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe71('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbe71('0x8'));var client=jayson[_0xbe71('0x9')][_0xbe71('0xa')]({'port':0x232a});config[_0xbe71('0xb')]=_[_0xbe71('0xc')](config[_0xbe71('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbe71('0xb')]));require(_0xbe71('0xd'))[_0xbe71('0xe')](socket);function respondWithRpcPromise(_0x4043ac,_0xbf1515,_0x29e910){return new BPromise(function(_0x508a52,_0x38f44e){return client[_0xbe71('0xf')](_0x4043ac,_0x29e910)[_0xbe71('0x10')](function(_0x4c32a3){logger['info']('UserNotification,\x20%s,\x20%s',_0xbf1515,_0xbe71('0x11'));logger[_0xbe71('0x12')]('UserNotification,\x20%s,\x20%s,\x20%s',_0xbf1515,'request\x20sent',JSON['stringify'](_0x4c32a3));if(_0x4c32a3[_0xbe71('0x13')]){if(_0x4c32a3[_0xbe71('0x13')][_0xbe71('0x14')]===0x1f4){logger[_0xbe71('0x13')](_0xbe71('0x15'),_0xbf1515,_0x4c32a3[_0xbe71('0x13')][_0xbe71('0x16')]);return _0x38f44e(_0x4c32a3[_0xbe71('0x13')][_0xbe71('0x16')]);}logger[_0xbe71('0x13')](_0xbe71('0x15'),_0xbf1515,_0x4c32a3[_0xbe71('0x13')][_0xbe71('0x16')]);return _0x508a52(_0x4c32a3[_0xbe71('0x13')]['message']);}else{logger[_0xbe71('0x17')]('UserNotification,\x20%s,\x20%s',_0xbf1515,_0xbe71('0x11'));_0x508a52(_0x4c32a3[_0xbe71('0x18')][_0xbe71('0x16')]);}})['catch'](function(_0x5b63e5){logger['error'](_0xbe71('0x15'),_0xbf1515,_0x5b63e5);_0x38f44e(_0x5b63e5);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 03e179a..76c7514 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 _0xffbf=['remove','update','emit','register','length','userNotification:','./userNotification.events'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xffbf,0xca));var _0xfffb=function(_0x573349,_0x2a13cc){_0x573349=_0x573349-0x0;var _0x1c7745=_0xffbf[_0x573349];return _0x1c7745;};'use strict';var UserNotificationEvents=require(_0xfffb('0x0'));var events=['save',_0xfffb('0x1'),_0xfffb('0x2')];function createListener(_0x13d329,_0x3a0af1){return function(_0x12eb81){_0x3a0af1[_0xfffb('0x3')](_0x13d329,_0x12eb81);};}function removeListener(_0x21f27e,_0x17ec61){return function(){UserNotificationEvents['removeListener'](_0x21f27e,_0x17ec61);};}exports[_0xfffb('0x4')]=function(_0x49ae1e){for(var _0x3f3fc9=0x0,_0x50a9d6=events[_0xfffb('0x5')];_0x3f3fc9<_0x50a9d6;_0x3f3fc9++){var _0x3de5e7=events[_0x3f3fc9];var _0x1883e0=createListener(_0xfffb('0x6')+_0x3de5e7,_0x49ae1e);UserNotificationEvents['on'](_0x3de5e7,_0x1883e0);}}; \ No newline at end of file +var _0xc935=['update','emit','removeListener','register','userNotification:','./userNotification.events','save','remove'];(function(_0x5d115f,_0x339050){var _0x44910f=function(_0x5d1c81){while(--_0x5d1c81){_0x5d115f['push'](_0x5d115f['shift']());}};_0x44910f(++_0x339050);}(_0xc935,0xe5));var _0x5c93=function(_0x5941a8,_0x453a74){_0x5941a8=_0x5941a8-0x0;var _0x134924=_0xc935[_0x5941a8];return _0x134924;};'use strict';var UserNotificationEvents=require(_0x5c93('0x0'));var events=[_0x5c93('0x1'),_0x5c93('0x2'),_0x5c93('0x3')];function createListener(_0x2a5702,_0x57bbbf){return function(_0x192b3f){_0x57bbbf[_0x5c93('0x4')](_0x2a5702,_0x192b3f);};}function removeListener(_0x2edfd7,_0x407550){return function(){UserNotificationEvents[_0x5c93('0x5')](_0x2edfd7,_0x407550);};}exports[_0x5c93('0x6')]=function(_0x43d477){for(var _0x8624e3=0x0,_0x28608d=events['length'];_0x8624e3<_0x28608d;_0x8624e3++){var _0x4113b7=events[_0x8624e3];var _0x35f56d=createListener(_0x5c93('0x7')+_0x4113b7,_0x43d477);UserNotificationEvents['on'](_0x4113b7,_0x35f56d);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 26a6223..37d8b34 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1a2758,_0x51b4e7){var _0x4fd564=function(_0x56c8aa){while(--_0x56c8aa){_0x1a2758['push'](_0x1a2758['shift']());}};_0x4fd564(++_0x51b4e7);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x105ace,_0x3bb3c1){var _0x3131b7=function(_0x472e2d){while(--_0x472e2d){_0x105ace['push'](_0x105ace['shift']());}};_0x3131b7(++_0x3bb3c1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 651cd2e..9006424 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 _0xa55a=['INTEGER','sequelize','exports'];(function(_0x2b16dc,_0x4ee390){var _0x375496=function(_0x58c61d){while(--_0x58c61d){_0x2b16dc['push'](_0x2b16dc['shift']());}};_0x375496(++_0x4ee390);}(_0xa55a,0x1b4));var _0xaa55=function(_0x30418b,_0x1b1596){_0x30418b=_0x30418b-0x0;var _0x48c159=_0xa55a[_0x30418b];return _0x48c159;};'use strict';var Sequelize=require(_0xaa55('0x0'));module[_0xaa55('0x1')]={'penalty':{'type':Sequelize[_0xaa55('0x2')],'defaultValue':0x0}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 5de33c7..885a2cd 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 _0x5f6e=['lodash','util','../../config/logger','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x537481,_0x37e7dc){var _0x36a189=function(_0x21c84f){while(--_0x21c84f){_0x537481['push'](_0x537481['shift']());}};_0x36a189(++_0x37e7dc);}(_0x5f6e,0x140));var _0xe5f6=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x5f6e[_0x365be9];return _0x185c12;};'use strict';var _=require(_0xe5f6('0x0'));var util=require(_0xe5f6('0x1'));var logger=require(_0xe5f6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe5f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe5f6('0x4'));var config=require(_0xe5f6('0x5'));var attributes=require(_0xe5f6('0x6'));module[_0xe5f6('0x7')]=function(_0x53a990,_0x128ec1){return _0x53a990[_0xe5f6('0x8')](_0xe5f6('0x9'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8627=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','util'];(function(_0x2ec7c8,_0x4b7f29){var _0x26469c=function(_0x9d861c){while(--_0x9d861c){_0x2ec7c8['push'](_0x2ec7c8['shift']());}};_0x26469c(++_0x4b7f29);}(_0x8627,0x1ed));var _0x7862=function(_0x264a70,_0x213f28){_0x264a70=_0x264a70-0x0;var _0x4c5d5f=_0x8627[_0x264a70];return _0x4c5d5f;};'use strict';var _=require('lodash');var util=require(_0x7862('0x0'));var logger=require(_0x7862('0x1'))(_0x7862('0x2'));var moment=require('moment');var BPromise=require(_0x7862('0x3'));var rp=require(_0x7862('0x4'));var fs=require('fs');var path=require(_0x7862('0x5'));var rimraf=require(_0x7862('0x6'));var config=require(_0x7862('0x7'));var attributes=require(_0x7862('0x8'));module[_0x7862('0x9')]=function(_0x287f2a,_0x4f78){return _0x287f2a[_0x7862('0xa')](_0x7862('0xb'),attributes,{'tableName':_0x7862('0xc'),'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 0d5837c..d620d2d 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 _0x7d39=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x50f20a,_0x2e15db){var _0x7e38aa=function(_0x34ef86){while(--_0x34ef86){_0x50f20a['push'](_0x50f20a['shift']());}};_0x7e38aa(++_0x2e15db);}(_0x7d39,0x19a));var _0x97d3=function(_0x8d63c3,_0xb7f3f9){_0x8d63c3=_0x8d63c3-0x0;var _0x1f4fbc=_0x7d39[_0x8d63c3];return _0x1f4fbc;};'use strict';var _=require(_0x97d3('0x0'));var util=require(_0x97d3('0x1'));var moment=require(_0x97d3('0x2'));var BPromise=require(_0x97d3('0x3'));var rs=require(_0x97d3('0x4'));var fs=require('fs');var Redis=require(_0x97d3('0x5'));var db=require(_0x97d3('0x6'))['db'];var utils=require(_0x97d3('0x7'));var logger=require(_0x97d3('0x8'))(_0x97d3('0x9'));var config=require(_0x97d3('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x97d3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25ccf0,_0x38ecff,_0x4e3d9c){return new BPromise(function(_0x24592b,_0xaf7d6a){return client[_0x97d3('0xc')](_0x25ccf0,_0x4e3d9c)['then'](function(_0x9e8212){logger[_0x97d3('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38ecff,_0x97d3('0xe'));logger[_0x97d3('0xf')](_0x97d3('0x10'),_0x38ecff,_0x97d3('0xe'),JSON['stringify'](_0x9e8212));if(_0x9e8212[_0x97d3('0x11')]){if(_0x9e8212[_0x97d3('0x11')][_0x97d3('0x12')]===0x1f4){logger[_0x97d3('0x11')](_0x97d3('0x13'),_0x38ecff,_0x9e8212[_0x97d3('0x11')][_0x97d3('0x14')]);return _0xaf7d6a(_0x9e8212[_0x97d3('0x11')][_0x97d3('0x14')]);}logger[_0x97d3('0x11')](_0x97d3('0x13'),_0x38ecff,_0x9e8212[_0x97d3('0x11')]['message']);return _0x24592b(_0x9e8212['error'][_0x97d3('0x14')]);}else{logger[_0x97d3('0xd')](_0x97d3('0x13'),_0x38ecff,_0x97d3('0xe'));_0x24592b(_0x9e8212[_0x97d3('0x15')][_0x97d3('0x14')]);}})[_0x97d3('0x16')](function(_0x576886){logger[_0x97d3('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x38ecff,_0x576886);_0xaf7d6a(_0x576886);});});} \ No newline at end of file +var _0x8876=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x8876,0x148));var _0x6887=function(_0x5e6bb2,_0x5478c6){_0x5e6bb2=_0x5e6bb2-0x0;var _0x43721e=_0x8876[_0x5e6bb2];return _0x43721e;};'use strict';var _=require(_0x6887('0x0'));var util=require(_0x6887('0x1'));var moment=require(_0x6887('0x2'));var BPromise=require(_0x6887('0x3'));var rs=require(_0x6887('0x4'));var fs=require('fs');var Redis=require(_0x6887('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6887('0x6'));var logger=require(_0x6887('0x7'))(_0x6887('0x8'));var config=require(_0x6887('0x9'));var jayson=require(_0x6887('0xa'));var client=jayson[_0x6887('0xb')][_0x6887('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x491656,_0x1b81c0,_0x57ad69){return new BPromise(function(_0x1c2a33,_0x23a43d){return client[_0x6887('0xd')](_0x491656,_0x57ad69)[_0x6887('0xe')](function(_0x26e59f){logger['info'](_0x6887('0xf'),_0x1b81c0,_0x6887('0x10'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1b81c0,_0x6887('0x10'),JSON['stringify'](_0x26e59f));if(_0x26e59f[_0x6887('0x11')]){if(_0x26e59f['error']['code']===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x1b81c0,_0x26e59f[_0x6887('0x11')][_0x6887('0x12')]);return _0x23a43d(_0x26e59f[_0x6887('0x11')][_0x6887('0x12')]);}logger[_0x6887('0x11')](_0x6887('0xf'),_0x1b81c0,_0x26e59f['error']['message']);return _0x1c2a33(_0x26e59f[_0x6887('0x11')][_0x6887('0x12')]);}else{logger['info'](_0x6887('0xf'),_0x1b81c0,_0x6887('0x10'));_0x1c2a33(_0x26e59f[_0x6887('0x13')]['message']);}})[_0x6887('0x14')](function(_0x3cdbbc){logger[_0x6887('0x11')](_0x6887('0xf'),_0x1b81c0,_0x3cdbbc);_0x23a43d(_0x3cdbbc);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index ea96f83..1a958e4 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 _0x99b9=['removeSections','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','show','getSections','get','/:id/resources','post','create','/:id/clone','clone','addSections','put','/:id','update','delete','destroy','/:id/sections'];(function(_0x19d0fa,_0x8e2616){var _0x22925e=function(_0x2681e6){while(--_0x2681e6){_0x19d0fa['push'](_0x19d0fa['shift']());}};_0x22925e(++_0x8e2616);}(_0x99b9,0x12a));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x999b('0x0'));var util=require(_0x999b('0x1'));var path=require(_0x999b('0x2'));var timeout=require('connect-timeout');var express=require(_0x999b('0x3'));var router=express[_0x999b('0x4')]();var fs_extra=require(_0x999b('0x5'));var auth=require(_0x999b('0x6'));var interaction=require(_0x999b('0x7'));var config=require('../../config/environment');var controller=require(_0x999b('0x8'));router['get']('/',auth[_0x999b('0x9')](),controller[_0x999b('0xa')]);router['get']('/describe',auth[_0x999b('0x9')](),controller['describe']);router['get']('/:id',auth[_0x999b('0x9')](),controller[_0x999b('0xb')]);router['get']('/:id/sections',auth[_0x999b('0x9')](),controller[_0x999b('0xc')]);router[_0x999b('0xd')](_0x999b('0xe'),auth['isAuthenticated'](),controller['getResources']);router[_0x999b('0xf')]('/',auth[_0x999b('0x9')](),controller[_0x999b('0x10')]);router[_0x999b('0xf')](_0x999b('0x11'),auth[_0x999b('0x9')](),controller[_0x999b('0x12')]);router[_0x999b('0xf')]('/:id/sections',auth[_0x999b('0x9')](),controller[_0x999b('0x13')]);router[_0x999b('0xf')]('/:id/resources',auth[_0x999b('0x9')](),controller['addResources']);router[_0x999b('0x14')](_0x999b('0x15'),auth[_0x999b('0x9')](),controller[_0x999b('0x16')]);router[_0x999b('0x17')]('/:id',auth[_0x999b('0x9')](),controller[_0x999b('0x18')]);router['delete'](_0x999b('0x19'),auth[_0x999b('0x9')](),controller[_0x999b('0x1a')]);router[_0x999b('0x17')](_0x999b('0xe'),auth[_0x999b('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0x2d80=['getResources','post','create','clone','put','update','delete','destroy','removeSections','removeResources','multer','util','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2d80,0x11d));var _0x02d8=function(_0x17b8a9,_0x3bbf58){_0x17b8a9=_0x17b8a9-0x0;var _0x4add80=_0x2d80[_0x17b8a9];return _0x4add80;};'use strict';var multer=require(_0x02d8('0x0'));var util=require(_0x02d8('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x02d8('0x2'));var router=express['Router']();var fs_extra=require(_0x02d8('0x3'));var auth=require(_0x02d8('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0x02d8('0x5')]('/',auth[_0x02d8('0x6')](),controller[_0x02d8('0x7')]);router[_0x02d8('0x5')](_0x02d8('0x8'),auth[_0x02d8('0x6')](),controller[_0x02d8('0x9')]);router[_0x02d8('0x5')](_0x02d8('0xa'),auth['isAuthenticated'](),controller[_0x02d8('0xb')]);router['get'](_0x02d8('0xc'),auth[_0x02d8('0x6')](),controller[_0x02d8('0xd')]);router[_0x02d8('0x5')](_0x02d8('0xe'),auth[_0x02d8('0x6')](),controller[_0x02d8('0xf')]);router[_0x02d8('0x10')]('/',auth[_0x02d8('0x6')](),controller[_0x02d8('0x11')]);router[_0x02d8('0x10')]('/:id/clone',auth[_0x02d8('0x6')](),controller[_0x02d8('0x12')]);router[_0x02d8('0x10')](_0x02d8('0xc'),auth[_0x02d8('0x6')](),controller['addSections']);router[_0x02d8('0x10')](_0x02d8('0xe'),auth['isAuthenticated'](),controller['addResources']);router[_0x02d8('0x13')]('/:id',auth[_0x02d8('0x6')](),controller[_0x02d8('0x14')]);router[_0x02d8('0x15')](_0x02d8('0xa'),auth[_0x02d8('0x6')](),controller[_0x02d8('0x16')]);router[_0x02d8('0x15')]('/:id/sections',auth[_0x02d8('0x6')](),controller[_0x02d8('0x17')]);router[_0x02d8('0x15')](_0x02d8('0xe'),auth[_0x02d8('0x6')](),controller[_0x02d8('0x18')]);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 7726f89..e797ef2 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 _0xc97c=['getDataValue','split','BOOLEAN','STRING','name','crudPermissions','join'];(function(_0x5a5a8d,_0xf93bfb){var _0x3d0951=function(_0x3ca9de){while(--_0x3ca9de){_0x5a5a8d['push'](_0x5a5a8d['shift']());}};_0x3d0951(++_0xf93bfb);}(_0xc97c,0x13e));var _0xcc97=function(_0x5efa26,_0x372633){_0x5efa26=_0x5efa26-0x0;var _0xcd29a=_0xc97c[_0x5efa26];return _0xcd29a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcc97('0x0')],'allowNull':![],'unique':_0xcc97('0x1')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x47484e){this['setDataValue'](_0xcc97('0x2'),_0x47484e?_0x47484e[_0xcc97('0x3')](''):[]);},'get':function(){return this[_0xcc97('0x4')]('crudPermissions')?this['getDataValue'](_0xcc97('0x2'))[_0xcc97('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xcc97('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcc97('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0de0=['STRING','name','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0x0de0,0xc3));var _0x00de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x00de('0x0'));module['exports']={'name':{'type':Sequelize[_0x00de('0x1')],'allowNull':![],'unique':_0x00de('0x2')},'crudPermissions':{'type':Sequelize[_0x00de('0x1')],'set':function(_0x35a4b0){this['setDataValue'](_0x00de('0x3'),_0x35a4b0?_0x35a4b0[_0x00de('0x4')](''):[]);},'get':function(){return this[_0x00de('0x5')](_0x00de('0x3'))?this[_0x00de('0x5')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x00de('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x00de('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x00de('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x00de('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x00de('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x00de('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b80240a..cfe0095 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 _0x6f3e=['sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','clone','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','ids','enabled','includes','subsections','push','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x1742aa,_0x4f0f28){var _0xc3f673=function(_0x1b8e49){while(--_0x1b8e49){_0x1742aa['push'](_0x1742aa['shift']());}};_0xc3f673(++_0x4f0f28);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f3e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe6f3('0x0'));var rimraf=require(_0xe6f3('0x1'));var zipdir=require(_0xe6f3('0x2'));var jsonpatch=require(_0xe6f3('0x3'));var rp=require(_0xe6f3('0x4'));var moment=require(_0xe6f3('0x5'));var BPromise=require(_0xe6f3('0x6'));var Mustache=require('mustache');var util=require(_0xe6f3('0x7'));var path=require(_0xe6f3('0x8'));var sox=require('sox');var csv=require(_0xe6f3('0x9'));var ejs=require(_0xe6f3('0xa'));var fs=require('fs');var fs_extra=require(_0xe6f3('0xb'));var _=require('lodash');var squel=require(_0xe6f3('0xc'));var crypto=require(_0xe6f3('0xd'));var jsforce=require(_0xe6f3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe6f3('0x9'));var querystring=require('querystring');var Papa=require(_0xe6f3('0xf'));var Redis=require(_0xe6f3('0x10'));var authService=require(_0xe6f3('0x11'));var qs=require(_0xe6f3('0x12'));var as=require(_0xe6f3('0x13'));var hardwareService=require(_0xe6f3('0x14'));var logger=require('../../config/logger')(_0xe6f3('0x15'));var utils=require('../../config/utils');var config=require(_0xe6f3('0x16'));var licenseUtil=require(_0xe6f3('0x17'));var db=require(_0xe6f3('0x18'))['db'];config[_0xe6f3('0x19')]=_['defaults'](config[_0xe6f3('0x19')],{'host':_0xe6f3('0x1a'),'port':0x18eb});var socket=require(_0xe6f3('0x1b'))(new Redis(config[_0xe6f3('0x19')]));require(_0xe6f3('0x1c'))[_0xe6f3('0x1d')](socket);function respondWithStatusCode(_0x26f4a7,_0x4ab9db){_0x4ab9db=_0x4ab9db||0xcc;return function(_0x44fd99){if(_0x44fd99){return _0x26f4a7[_0xe6f3('0x1e')](_0x4ab9db);}return _0x26f4a7[_0xe6f3('0x1f')](_0x4ab9db)[_0xe6f3('0x20')]();};}function respondWithResult(_0x1706a9,_0x54c573){_0x54c573=_0x54c573||0xc8;return function(_0x547df9){if(_0x547df9){return _0x1706a9[_0xe6f3('0x1f')](_0x54c573)[_0xe6f3('0x21')](_0x547df9);}};}function respondWithFilteredResult(_0x22dcf7,_0x48eb12){return function(_0x39d6be){if(_0x39d6be){var _0x31902a=typeof _0x48eb12[_0xe6f3('0x22')]===_0xe6f3('0x23')&&typeof _0x48eb12[_0xe6f3('0x24')]==='undefined';var _0x537568=_0x39d6be['count'];var _0x42c414=_0x31902a?0x0:_0x48eb12[_0xe6f3('0x22')];var _0xdb1a1f=_0x31902a?_0x39d6be[_0xe6f3('0x25')]:_0x48eb12[_0xe6f3('0x22')]+_0x48eb12[_0xe6f3('0x24')];var _0x47f69b;if(_0xdb1a1f>=_0x537568){_0xdb1a1f=_0x537568;_0x47f69b=0xc8;}else{_0x47f69b=0xce;}_0x22dcf7[_0xe6f3('0x1f')](_0x47f69b);return _0x22dcf7[_0xe6f3('0x26')](_0xe6f3('0x27'),_0x42c414+'-'+_0xdb1a1f+'/'+_0x537568)[_0xe6f3('0x21')](_0x39d6be);}return null;};}function patchUpdates(_0x43c0d5){return function(_0x245d3e){try{jsonpatch[_0xe6f3('0x28')](_0x245d3e,_0x43c0d5,!![]);}catch(_0x4d75d3){return BPromise['reject'](_0x4d75d3);}return _0x245d3e[_0xe6f3('0x29')]();};}function saveUpdates(_0x3989c5,_0x2685e9){return function(_0x2d7d6b){if(_0x2d7d6b){return _0x2d7d6b[_0xe6f3('0x2a')](_0x3989c5)[_0xe6f3('0x2b')](function(_0x5b1a12){return _0x5b1a12;});}return null;};}function removeEntity(_0x4646fa,_0x18dde2){return function(_0x426266){if(_0x426266){return _0x426266[_0xe6f3('0x2c')]()['then'](function(){_0x4646fa['status'](0xcc)[_0xe6f3('0x20')]();});}};}function handleEntityNotFound(_0x3eef65,_0x482cef){return function(_0x5e5f44){if(!_0x5e5f44){_0x3eef65[_0xe6f3('0x1e')](0x194);}return _0x5e5f44;};}function handleError(_0x19691c,_0x37a5a5){_0x37a5a5=_0x37a5a5||0x1f4;return function(_0x4627de){logger[_0xe6f3('0x2d')](_0x4627de[_0xe6f3('0x2e')]);if(_0x4627de[_0xe6f3('0x2f')]){delete _0x4627de['name'];}_0x19691c[_0xe6f3('0x1f')](_0x37a5a5)['send'](_0x4627de);};}exports[_0xe6f3('0x30')]=function(_0x104677,_0x473064){var _0x5c8494={},_0x34ad3c={},_0x5163e0={'count':0x0,'rows':[]};var _0x359c2d=_[_0xe6f3('0x31')](db[_0xe6f3('0x32')][_0xe6f3('0x33')],function(_0x498a16){return{'name':_0x498a16[_0xe6f3('0x34')],'type':_0x498a16[_0xe6f3('0x35')]['key']};});_0x34ad3c[_0xe6f3('0x36')]=_[_0xe6f3('0x31')](_0x359c2d,_0xe6f3('0x2f'));_0x34ad3c[_0xe6f3('0x37')]=_[_0xe6f3('0x38')](_0x104677[_0xe6f3('0x37')]);_0x34ad3c[_0xe6f3('0x39')]=_['intersection'](_0x34ad3c[_0xe6f3('0x36')],_0x34ad3c[_0xe6f3('0x37')]);_0x5c8494[_0xe6f3('0x3a')]=_[_0xe6f3('0x3b')](_0x34ad3c['model'],qs[_0xe6f3('0x3c')](_0x104677[_0xe6f3('0x37')]['fields']));_0x5c8494['attributes']=_0x5c8494[_0xe6f3('0x3a')][_0xe6f3('0x3d')]?_0x5c8494[_0xe6f3('0x3a')]:_0x34ad3c[_0xe6f3('0x36')];if(!_0x104677['query'][_0xe6f3('0x3e')](_0xe6f3('0x3f'))){_0x5c8494['limit']=qs['limit'](_0x104677[_0xe6f3('0x37')][_0xe6f3('0x24')]);_0x5c8494[_0xe6f3('0x22')]=qs[_0xe6f3('0x22')](_0x104677[_0xe6f3('0x37')]['offset']);}_0x5c8494[_0xe6f3('0x40')]=qs[_0xe6f3('0x41')](_0x104677[_0xe6f3('0x37')][_0xe6f3('0x41')]);_0x5c8494['where']=qs[_0xe6f3('0x39')](_['pick'](_0x104677[_0xe6f3('0x37')],_0x34ad3c[_0xe6f3('0x39')]),_0x359c2d);if(_0x104677[_0xe6f3('0x37')][_0xe6f3('0x42')]){_0x5c8494['where']=_['merge'](_0x5c8494[_0xe6f3('0x43')],{'$or':_[_0xe6f3('0x31')](_0x359c2d,function(_0x30a160){if(_0x30a160[_0xe6f3('0x35')]!==_0xe6f3('0x44')){var _0x51bd3f={};_0x51bd3f[_0x30a160[_0xe6f3('0x2f')]]={'$like':'%'+_0x104677[_0xe6f3('0x37')][_0xe6f3('0x42')]+'%'};return _0x51bd3f;}})});}_0x5c8494=_[_0xe6f3('0x45')]({},_0x5c8494,_0x104677[_0xe6f3('0x46')]);var _0x1badac={'where':_0x5c8494['where']};return db[_0xe6f3('0x32')][_0xe6f3('0x25')](_0x1badac)['then'](function(_0x2e5108){_0x5163e0[_0xe6f3('0x25')]=_0x2e5108;if(_0x104677[_0xe6f3('0x37')][_0xe6f3('0x47')]){_0x5c8494[_0xe6f3('0x48')]=[{'all':!![]}];}return db[_0xe6f3('0x32')][_0xe6f3('0x49')](_0x5c8494);})[_0xe6f3('0x2b')](function(_0x25f946){_0x5163e0[_0xe6f3('0x4a')]=_0x25f946;return _0x5163e0;})[_0xe6f3('0x2b')](respondWithFilteredResult(_0x473064,_0x5c8494))[_0xe6f3('0x4b')](handleError(_0x473064,null));};exports[_0xe6f3('0x4c')]=function(_0x21f142,_0x24ce66){var _0x127583={'raw':![],'where':{'id':_0x21f142[_0xe6f3('0x4d')]['id']}},_0x2fde49={};_0x2fde49[_0xe6f3('0x36')]=_[_0xe6f3('0x38')](db[_0xe6f3('0x32')][_0xe6f3('0x33')]);_0x2fde49['query']=_[_0xe6f3('0x38')](_0x21f142[_0xe6f3('0x37')]);_0x2fde49[_0xe6f3('0x39')]=_['intersection'](_0x2fde49[_0xe6f3('0x36')],_0x2fde49[_0xe6f3('0x37')]);_0x127583[_0xe6f3('0x3a')]=_[_0xe6f3('0x3b')](_0x2fde49[_0xe6f3('0x36')],qs[_0xe6f3('0x3c')](_0x21f142['query'][_0xe6f3('0x3c')]));_0x127583[_0xe6f3('0x3a')]=_0x127583[_0xe6f3('0x3a')][_0xe6f3('0x3d')]?_0x127583[_0xe6f3('0x3a')]:_0x2fde49['model'];if(_0x21f142['query']['includeAll']){_0x127583['include']=[{'all':!![]}];}_0x127583=_[_0xe6f3('0x45')]({},_0x127583,_0x21f142[_0xe6f3('0x46')]);return db[_0xe6f3('0x32')][_0xe6f3('0x4e')](_0x127583)[_0xe6f3('0x2b')](handleEntityNotFound(_0x24ce66,null))['then'](respondWithResult(_0x24ce66,null))[_0xe6f3('0x4b')](handleError(_0x24ce66,null));};exports[_0xe6f3('0x4f')]=function(_0x33e3a9,_0x19e0c7){return db['UserProfile'][_0xe6f3('0x4f')](_0x33e3a9[_0xe6f3('0x50')],{})[_0xe6f3('0x2b')](respondWithResult(_0x19e0c7,0xc9))[_0xe6f3('0x4b')](handleError(_0x19e0c7,null));};exports[_0xe6f3('0x51')]=function(_0x548e77,_0x508008){var _0x5338a7={'where':{'id':_0x548e77['params']['id']}},_0x6089fd={};_0x6089fd[_0xe6f3('0x36')]=_[_0xe6f3('0x38')](db[_0xe6f3('0x32')][_0xe6f3('0x33')]);_0x5338a7[_0xe6f3('0x3a')]=_[_0xe6f3('0x3b')](_0x6089fd[_0xe6f3('0x36')],qs[_0xe6f3('0x3c')](_0x548e77[_0xe6f3('0x37')][_0xe6f3('0x3c')]));_0x5338a7['attributes']=_0x5338a7['attributes'][_0xe6f3('0x3d')]?_0x5338a7[_0xe6f3('0x3a')]:_0x6089fd[_0xe6f3('0x36')];if(_0x548e77[_0xe6f3('0x37')]['includeAll']){_0x5338a7[_0xe6f3('0x48')]=[{'all':!![]}];}_0x5338a7=_[_0xe6f3('0x45')]({},_0x5338a7,_0x548e77['options']);return db[_0xe6f3('0x32')][_0xe6f3('0x4e')](_0x5338a7)[_0xe6f3('0x2b')](handleEntityNotFound(_0x508008,null))[_0xe6f3('0x2b')](function(_0x47fe00){if(_0x47fe00){var _0xe23956=_0x47fe00['get']({'plain':!![]});_0xe23956=qs[_0xe6f3('0x52')](_0xe23956,['id','createdAt',_0xe6f3('0x53'),_0xe6f3('0x54')]);_0x548e77[_0xe6f3('0x50')]=_[_0xe6f3('0x52')](_0x548e77[_0xe6f3('0x50')],['id',_0xe6f3('0x55'),_0xe6f3('0x53')]);return db[_0xe6f3('0x56')][_0xe6f3('0x57')](function(_0x2d31fb){return db[_0xe6f3('0x32')][_0xe6f3('0x4f')](_[_0xe6f3('0x45')](_0xe23956,_0x548e77[_0xe6f3('0x50')]),{'include':_0x548e77['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2d31fb})[_0xe6f3('0x2b')](function(_0x29161e){var _0x4a7a98=_0x29161e[_0xe6f3('0x58')]({'plain':!![]});return db[_0xe6f3('0x59')]['findAll']({'where':{'userProfileId':_0x548e77['params']['id']},'raw':!![]})['then'](function(_0x45310b){if(_0x45310b){return BPromise[_0xe6f3('0x5a')](_0x45310b,function(_0x34a94b){return new BPromise(function(_0x2d2a44,_0xb2044d){if(_0x34a94b['autoAssociation']===null||_0x34a94b[_0xe6f3('0x5b')]===0x1)_0x2d2a44(null);return db[_0xe6f3('0x5c')][_0xe6f3('0x49')]({'where':{'sectionId':_0x34a94b['id']},'raw':!![]})[_0xe6f3('0x2b')](function(_0x3471dd){var _0x283417=_[_0xe6f3('0x31')](_0x3471dd,function(_0x358672){return qs[_0xe6f3('0x52')](_0x358672,['id',_0xe6f3('0x55'),_0xe6f3('0x53'),_0xe6f3('0x5d')]);});_0x2d2a44(_0x283417);})[_0xe6f3('0x4b')](function(_0x32105e){_0xb2044d(_0x32105e);});})['then'](function(_0xdf5f9d){var _0x1b3d62=qs[_0xe6f3('0x52')](_0x34a94b,['id',_0xe6f3('0x55'),_0xe6f3('0x53')]);_0x1b3d62[_0xe6f3('0x5e')]=_0x4a7a98['id'];if(_0xdf5f9d)_0x1b3d62[_0xe6f3('0x5f')]=_0xdf5f9d;return _0x1b3d62;})['then'](function(_0x3e91c2){return db[_0xe6f3('0x59')][_0xe6f3('0x4f')](_0x3e91c2,{'include':[{'model':db[_0xe6f3('0x5c')],'as':_0xe6f3('0x5f')}],'raw':!![],'transaction':_0x2d31fb});});})[_0xe6f3('0x2b')](function(){return _0x4a7a98;});}});});});}})['then'](respondWithResult(_0x508008,0xc9))[_0xe6f3('0x4b')](handleError(_0x508008,null));};exports[_0xe6f3('0x2a')]=function(_0x455113,_0x1cf8ae){if(_0x455113[_0xe6f3('0x50')]['id']){delete _0x455113[_0xe6f3('0x50')]['id'];}return db['UserProfile'][_0xe6f3('0x4e')]({'where':{'id':_0x455113[_0xe6f3('0x4d')]['id']}})[_0xe6f3('0x2b')](handleEntityNotFound(_0x1cf8ae,null))[_0xe6f3('0x2b')](saveUpdates(_0x455113[_0xe6f3('0x50')],null))['then'](respondWithResult(_0x1cf8ae,null))['catch'](handleError(_0x1cf8ae,null));};exports['destroy']=function(_0x68bccc,_0x5291cb){return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x68bccc[_0xe6f3('0x4d')]['id']}})[_0xe6f3('0x2b')](handleEntityNotFound(_0x5291cb,null))[_0xe6f3('0x2b')](removeEntity(_0x5291cb,null))[_0xe6f3('0x4b')](handleError(_0x5291cb,null));};exports['describe']=function(_0x2ab40c,_0x55315d){return db['UserProfile'][_0xe6f3('0x60')]()[_0xe6f3('0x2b')](respondWithResult(_0x55315d,null))[_0xe6f3('0x4b')](handleError(_0x55315d,null));};exports[_0xe6f3('0x61')]=function(_0x24bd75,_0x2807bf){var _0x24dbd2=_0x24bd75[_0xe6f3('0x50')];return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x24bd75[_0xe6f3('0x4d')]['id']}})[_0xe6f3('0x2b')](handleEntityNotFound(_0x2807bf,null))[_0xe6f3('0x2b')](function(_0x59e1ea){if(_0x59e1ea){return db[_0xe6f3('0x56')]['transaction'](function(_0x26b982){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x24bd75[_0xe6f3('0x4d')]['id'],'sectionId':_[_0xe6f3('0x31')](_0x24dbd2,function(_0x5ef819){return _0x5ef819['sectionId'];})},'transaction':_0x26b982})[_0xe6f3('0x2b')](function(){var _0x30711c=_[_0xe6f3('0x31')](_0x24dbd2,function(_0x572cff){_0x572cff[_0xe6f3('0x5e')]=_0x24bd75[_0xe6f3('0x4d')]['id'];return _0x572cff;});var _0x5ae774=[];return BPromise['each'](_0x30711c,function(_0x24ed74){return db[_0xe6f3('0x59')][_0xe6f3('0x4f')](_0x24ed74,{'include':[{'model':db[_0xe6f3('0x5c')],'as':_0xe6f3('0x5f')}],'raw':!![],'transaction':_0x26b982})['then'](function(_0x41ef0a){_0x5ae774['push'](_0x41ef0a[_0xe6f3('0x58')]({'plain':!![]}));});})[_0xe6f3('0x2b')](function(){return _0x5ae774;});});});}})[_0xe6f3('0x2b')](function(_0x3f4102){return _0x3f4102;})[_0xe6f3('0x2b')](respondWithResult(_0x2807bf,null))[_0xe6f3('0x4b')](handleError(_0x2807bf,null));};exports['removeSections']=function(_0x2acb9f,_0x290eee){var _0x568f86;return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x2acb9f[_0xe6f3('0x4d')]['id']},'attributes':['id',_0xe6f3('0x2f')]})[_0xe6f3('0x2b')](handleEntityNotFound(_0x290eee,null))[_0xe6f3('0x2b')](function(_0x452bb9){if(_0x452bb9){_0x568f86=_0x452bb9;return db[_0xe6f3('0x59')][_0xe6f3('0x2c')]({'where':{'userProfileId':_0x2acb9f[_0xe6f3('0x4d')]['id'],'sectionId':_0x2acb9f[_0xe6f3('0x37')][_0xe6f3('0x62')]}});}})['then'](function(){return _0x568f86;})[_0xe6f3('0x2b')](respondWithStatusCode(_0x290eee,null))[_0xe6f3('0x4b')](handleError(_0x290eee,null));};exports['getSections']=function(_0x5226bb,_0x30a629){var _0x30d5f7=[];var _0x799399=[];return db[_0xe6f3('0x59')][_0xe6f3('0x49')]({'where':{'userProfileId':_0x5226bb[_0xe6f3('0x4d')]['id']},'raw':!![]})['then'](function(_0x28976d){_0x30d5f7=_[_0xe6f3('0x42')](_0x28976d,function(_0xa55b9e){return _0xa55b9e[_0xe6f3('0x63')]===0x1||_[_0xe6f3('0x64')]([0x3eb,0x709],_0xa55b9e[_0xe6f3('0x5d')]);});if(!_['isEmpty'](_0x30d5f7)){return _[_0xe6f3('0x31')](_0x30d5f7,function(_0x3fd8d9){return _0x3fd8d9['sectionId'];});}else{return;}})[_0xe6f3('0x2b')](function(_0x51c503){if(_0x51c503)_0x799399=_0x51c503;if(_[_0xe6f3('0x64')](_0x799399,0x64)){var _0x540a8e=_[_0xe6f3('0x4e')](_0x30d5f7,{'sectionId':0x64});return hasDefaultDashboard(_0x540a8e)[_0xe6f3('0x2b')](function(_0x2eb267){return _[_0xe6f3('0x31')](_0x30d5f7,function(_0x11d640){if(_0x11d640[_0xe6f3('0x5d')]===0x64){_0x11d640['subsections']=_0x2eb267;}return _0x11d640;});});}else{return;}})[_0xe6f3('0x2b')](function(_0x4e533a){if(_0x4e533a)_0x30d5f7=_0x4e533a;if(_[_0xe6f3('0x64')](_0x799399,0x3eb)){var _0x3af37c=_[_0xe6f3('0x4e')](_0x30d5f7,{'sectionId':0x3eb});return getCustomDashboards(_0x3af37c)[_0xe6f3('0x2b')](function(_0x49b5ec){return _[_0xe6f3('0x31')](_0x30d5f7,function(_0x216d39){if(_0x3af37c['enabled']){if(_0x216d39[_0xe6f3('0x5d')]===0x3eb){_0x216d39[_0xe6f3('0x65')]=_0x49b5ec;}}else{if(_0x216d39[_0xe6f3('0x5d')]===0x64){_0x216d39['subsections']=_0x49b5ec;}}return _0x216d39;});});}else{return;}})['then'](function(_0x16cac9){if(_0x16cac9)_0x30d5f7=_0x16cac9;if(_[_0xe6f3('0x64')](_0x799399,0x709)){var _0x1c73ed=_['find'](_0x30d5f7,{'sectionId':0x709});return getPlugins(_0x1c73ed)[_0xe6f3('0x2b')](function(_0xbafd24){if(_0x1c73ed[_0xe6f3('0x63')]){return _[_0xe6f3('0x31')](_0x30d5f7,function(_0x11e9e3){if(_0x11e9e3['sectionId']===0x709){_0x11e9e3[_0xe6f3('0x65')]=_0xbafd24;}return _0x11e9e3;});}else{var _0x2d99a5={'sectionId':0x76c,'enabled':0x1,'subsections':_0xbafd24};var _0x13de73=_['map'](_0x30d5f7);_0x13de73[_0xe6f3('0x66')](_0x2d99a5);return _0x13de73;}});}else{return;}})[_0xe6f3('0x2b')](function(_0x5ede20){if(_0x5ede20)_0x30d5f7=_0x5ede20;return _['filter'](_0x30d5f7,[_0xe6f3('0x63'),0x1]);})['then'](respondWithResult(_0x30a629,null))[_0xe6f3('0x4b')](handleError(_0x30a629,null));};function hasDefaultDashboard(_0x5105ee){var _0x54d51d=[0x65];return new BPromise(function(_0x502316,_0x542642){try{if(_0x5105ee[_0xe6f3('0x5b')]){_0x502316(_0x54d51d);}else{return db[_0xe6f3('0x5c')]['findOne']({'where':{'sectionId':_0x5105ee['id']},'raw':!![]})[_0xe6f3('0x2b')](function(_0x592414){_0x592414?_0x502316(_0x54d51d):_0x502316();});}}catch(_0x32f97c){_0x542642(_0x32f97c);}});}function getCustomDashboards(_0x3471dc){var _0x12b63e=[];return new BPromise(function(_0xcbfd89,_0x2107dd){try{if(_0x3471dc[_0xe6f3('0x5b')]){return db['Dashboard'][_0xe6f3('0x49')]({'raw':!![]})[_0xe6f3('0x2b')](function(_0x299339){_0x299339[_0xe6f3('0x67')](function(_0x61b5cf){_0x12b63e[_0xe6f3('0x66')](_0x61b5cf['id']+0x1869f);});_0xcbfd89(_0x12b63e);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3471dc['id']},'raw':!![]})[_0xe6f3('0x2b')](function(_0x38e66a){_0x38e66a[_0xe6f3('0x67')](function(_0x5377ed){_0x12b63e['push'](_0x5377ed['resourceId']+0x1869f);});_0xcbfd89(_0x12b63e);});}}catch(_0x27ebcd){_0x2107dd(_0x27ebcd);}});}function getPlugins(_0x2aa868){var _0x2faf81=[];return new BPromise(function(_0x845b5c,_0x1178d4){try{if(_0x2aa868[_0xe6f3('0x5b')]){return db[_0xe6f3('0x68')]['findAll']({'raw':!![]})[_0xe6f3('0x2b')](function(_0x256a83){_0x256a83['forEach'](function(_0x5ab162){_0x2faf81[_0xe6f3('0x66')](_0x5ab162['id']+0x15b38);});_0x845b5c(_0x2faf81);});}else{return db[_0xe6f3('0x5c')][_0xe6f3('0x49')]({'where':{'sectionId':_0x2aa868['id']},'raw':!![]})[_0xe6f3('0x2b')](function(_0x103b1e){_0x103b1e['forEach'](function(_0x34bdad){_0x2faf81[_0xe6f3('0x66')](_0x34bdad[_0xe6f3('0x69')]+0x15b38);});_0x845b5c(_0x2faf81);});}}catch(_0x58202c){_0x1178d4(_0x58202c);}});}exports[_0xe6f3('0x6a')]=function(_0x3f9827,_0x314109){return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x3f9827['params']['id']}})[_0xe6f3('0x2b')](handleEntityNotFound(_0x314109,null))[_0xe6f3('0x2b')](function(_0x35bc23){if(_0x35bc23){return db[_0xe6f3('0x56')]['transaction'](function(_0xfa9d9b){return db[_0xe6f3('0x59')]['findAll']({'where':{'userProfileId':_0x3f9827[_0xe6f3('0x4d')]['id']},'attributes':['id'],'raw':!![]})[_0xe6f3('0x2b')](function(_0x38adc3){if(_0x38adc3){return db[_0xe6f3('0x59')][_0xe6f3('0x2c')]({'where':{'userProfileId':_0x3f9827[_0xe6f3('0x4d')]['id'],'id':_[_0xe6f3('0x31')](_0x38adc3,function(_0x3b0138){return _0x3b0138['id'];})},'transaction':_0xfa9d9b});}})[_0xe6f3('0x2b')](function(_0x553d51){var _0x2add58=_[_0xe6f3('0x31')](_0x3f9827[_0xe6f3('0x50')],function(_0x4bc17d){_0x4bc17d[_0xe6f3('0x5e')]=_0x3f9827[_0xe6f3('0x4d')]['id'];return _0x4bc17d;});return db[_0xe6f3('0x59')]['bulkCreate'](_0x2add58,{'raw':!![],'transaction':_0xfa9d9b});})['then'](function(_0xb1ec68){var _0x17697a=_[_0xe6f3('0x42')](_[_0xe6f3('0x31')](_0xb1ec68,function(_0x49716a){return _0x49716a[_0xe6f3('0x58')]({'plain':!![]});}),{'includeAll':![]});if(_0x17697a){return db[_0xe6f3('0x59')]['findAll']({'where':{'userProfileId':_0x3f9827[_0xe6f3('0x4d')]['id'],'sectionId':_[_0xe6f3('0x31')](_0x17697a,function(_0x115b49){return _0x115b49[_0xe6f3('0x5d')];})},'attributes':['id',_0xe6f3('0x5d')],'raw':!![]})[_0xe6f3('0x2b')](function(_0x3dc56c){var _0x52b623=_[_0xe6f3('0x31')](_0x3f9827[_0xe6f3('0x50')],function(_0x2237c5){_0x2237c5[_0xe6f3('0x5e')]=_0x3f9827[_0xe6f3('0x4d')]['id'];return _0x2237c5;});return db['UserProfileResource'][_0xe6f3('0x6b')](_0x52b623,{'raw':!![],'transaction':_0xfa9d9b});});}})['catch'](handleError(_0x314109,null));});}})[_0xe6f3('0x2b')](function(_0x36be9d){var _0x227bb0=_[_0xe6f3('0x31')](_0x36be9d,function(_0x2d7335){return _0x2d7335[_0xe6f3('0x58')]({'plain':!![]});});})[_0xe6f3('0x2b')](respondWithResult(_0x314109,null))['catch'](handleError(_0x314109,null));};exports['removeResources']=function(_0x36c794,_0x3264af,_0x3dc192){return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x36c794['params']['id']}})[_0xe6f3('0x2b')](handleEntityNotFound(_0x3264af,null))[_0xe6f3('0x2b')](function(_0xceee00){if(_0xceee00){return _0xceee00[_0xe6f3('0x6c')](_0x36c794['query']['ids']);}})['then'](respondWithStatusCode(_0x3264af,null))['catch'](handleError(_0x3264af,null));};exports['getResources']=function(_0x423088,_0x46ae4a){var _0xf8052c={};if(!_0x423088['query'][_0xe6f3('0x6d')])throw new Error('Missing\x20section\x20parameter');if(!_0x423088[_0xe6f3('0x37')]['hasOwnProperty'](_0xe6f3('0x3f'))){_0xf8052c[_0xe6f3('0x24')]=qs[_0xe6f3('0x24')](_0x423088[_0xe6f3('0x37')]['limit']);_0xf8052c[_0xe6f3('0x22')]=qs[_0xe6f3('0x22')](_0x423088[_0xe6f3('0x37')][_0xe6f3('0x22')]);}return db[_0xe6f3('0x32')][_0xe6f3('0x4e')]({'where':{'id':_0x423088[_0xe6f3('0x4d')]['id']}})[_0xe6f3('0x2b')](function(_0x3d8e57){if(!_0x3d8e57)throw new Error(_0xe6f3('0x6e')+_0x423088[_0xe6f3('0x4d')]['id']);return db[_0xe6f3('0x32')][_0xe6f3('0x6f')](_0x423088);})[_0xe6f3('0x2b')](respondWithFilteredResult(_0x46ae4a,_0xf8052c))['catch'](handleError(_0x46ae4a,null));}; \ No newline at end of file +var _0x4123=['sectionId','userProfileId','Resources','describe','addSections','push','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','filter','merge','options','UserProfile','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','clone','rawAttributes','length','get','createdAt','updatedAt','crudPermissions','omit','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource'];(function(_0x5a7e88,_0x5e8dc0){var _0x5e11f6=function(_0x48bfd8){while(--_0x48bfd8){_0x5a7e88['push'](_0x5a7e88['shift']());}};_0x5e11f6(++_0x5e8dc0);}(_0x4123,0x87));var _0x3412=function(_0x4cea31,_0x54ef05){_0x4cea31=_0x4cea31-0x0;var _0x30bf16=_0x4123[_0x4cea31];return _0x30bf16;};'use strict';var emlformat=require(_0x3412('0x0'));var rimraf=require(_0x3412('0x1'));var zipdir=require(_0x3412('0x2'));var jsonpatch=require(_0x3412('0x3'));var rp=require(_0x3412('0x4'));var moment=require(_0x3412('0x5'));var BPromise=require(_0x3412('0x6'));var Mustache=require(_0x3412('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3412('0x8'));var csv=require(_0x3412('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3412('0xa'));var _=require(_0x3412('0xb'));var squel=require(_0x3412('0xc'));var crypto=require(_0x3412('0xd'));var jsforce=require(_0x3412('0xe'));var deskjs=require(_0x3412('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3412('0x10'));var Papa=require(_0x3412('0x11'));var Redis=require(_0x3412('0x12'));var authService=require(_0x3412('0x13'));var qs=require(_0x3412('0x14'));var as=require(_0x3412('0x15'));var hardwareService=require(_0x3412('0x16'));var logger=require(_0x3412('0x17'))(_0x3412('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3412('0x19'));var db=require(_0x3412('0x1a'))['db'];config[_0x3412('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3412('0x1c'))(new Redis(config[_0x3412('0x1b')]));require(_0x3412('0x1d'))[_0x3412('0x1e')](socket);function respondWithStatusCode(_0x3f31b7,_0x226006){_0x226006=_0x226006||0xcc;return function(_0x746f22){if(_0x746f22){return _0x3f31b7[_0x3412('0x1f')](_0x226006);}return _0x3f31b7[_0x3412('0x20')](_0x226006)[_0x3412('0x21')]();};}function respondWithResult(_0x37c3a4,_0x382f11){_0x382f11=_0x382f11||0xc8;return function(_0x454cd0){if(_0x454cd0){return _0x37c3a4[_0x3412('0x20')](_0x382f11)['json'](_0x454cd0);}};}function respondWithFilteredResult(_0x219a0a,_0x2528b1){return function(_0x4b6526){if(_0x4b6526){var _0x584664=typeof _0x2528b1['offset']===_0x3412('0x22')&&typeof _0x2528b1[_0x3412('0x23')]===_0x3412('0x22');var _0x4480a9=_0x4b6526[_0x3412('0x24')];var _0x1bf726=_0x584664?0x0:_0x2528b1['offset'];var _0x48845a=_0x584664?_0x4b6526[_0x3412('0x24')]:_0x2528b1[_0x3412('0x25')]+_0x2528b1[_0x3412('0x23')];var _0x1d2349;if(_0x48845a>=_0x4480a9){_0x48845a=_0x4480a9;_0x1d2349=0xc8;}else{_0x1d2349=0xce;}_0x219a0a['status'](_0x1d2349);return _0x219a0a[_0x3412('0x26')](_0x3412('0x27'),_0x1bf726+'-'+_0x48845a+'/'+_0x4480a9)[_0x3412('0x28')](_0x4b6526);}return null;};}function patchUpdates(_0x2bcf3c){return function(_0x1a8782){try{jsonpatch[_0x3412('0x29')](_0x1a8782,_0x2bcf3c,!![]);}catch(_0x46cd4b){return BPromise[_0x3412('0x2a')](_0x46cd4b);}return _0x1a8782['save']();};}function saveUpdates(_0x8d721d,_0x3fae63){return function(_0x27654a){if(_0x27654a){return _0x27654a[_0x3412('0x2b')](_0x8d721d)[_0x3412('0x2c')](function(_0x3b67a7){return _0x3b67a7;});}return null;};}function removeEntity(_0x342136,_0x228bed){return function(_0x4c3d50){if(_0x4c3d50){return _0x4c3d50[_0x3412('0x2d')]()[_0x3412('0x2c')](function(){_0x342136[_0x3412('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253e50,_0x2768fa){return function(_0x2af6e9){if(!_0x2af6e9){_0x253e50['sendStatus'](0x194);}return _0x2af6e9;};}function handleError(_0x4220c6,_0x18bead){_0x18bead=_0x18bead||0x1f4;return function(_0x3d70f9){logger[_0x3412('0x2e')](_0x3d70f9[_0x3412('0x2f')]);if(_0x3d70f9[_0x3412('0x30')]){delete _0x3d70f9[_0x3412('0x30')];}_0x4220c6['status'](_0x18bead)[_0x3412('0x31')](_0x3d70f9);};}exports[_0x3412('0x32')]=function(_0x2cad8,_0x1aaea5){var _0x1ae451={},_0x1037d3={},_0x2c7226={'count':0x0,'rows':[]};var _0x4b93cb=_[_0x3412('0x33')](db['UserProfile']['rawAttributes'],function(_0x985c9c){return{'name':_0x985c9c[_0x3412('0x34')],'type':_0x985c9c[_0x3412('0x35')][_0x3412('0x36')]};});_0x1037d3['model']=_[_0x3412('0x33')](_0x4b93cb,_0x3412('0x30'));_0x1037d3[_0x3412('0x37')]=_['keys'](_0x2cad8['query']);_0x1037d3[_0x3412('0x38')]=_[_0x3412('0x39')](_0x1037d3['model'],_0x1037d3[_0x3412('0x37')]);_0x1ae451[_0x3412('0x3a')]=_[_0x3412('0x39')](_0x1037d3[_0x3412('0x3b')],qs['fields'](_0x2cad8[_0x3412('0x37')][_0x3412('0x3c')]));_0x1ae451[_0x3412('0x3a')]=_0x1ae451[_0x3412('0x3a')]['length']?_0x1ae451[_0x3412('0x3a')]:_0x1037d3[_0x3412('0x3b')];if(!_0x2cad8['query'][_0x3412('0x3d')](_0x3412('0x3e'))){_0x1ae451[_0x3412('0x23')]=qs['limit'](_0x2cad8[_0x3412('0x37')]['limit']);_0x1ae451['offset']=qs[_0x3412('0x25')](_0x2cad8[_0x3412('0x37')]['offset']);}_0x1ae451['order']=qs[_0x3412('0x3f')](_0x2cad8['query'][_0x3412('0x3f')]);_0x1ae451[_0x3412('0x40')]=qs[_0x3412('0x38')](_['pick'](_0x2cad8[_0x3412('0x37')],_0x1037d3[_0x3412('0x38')]),_0x4b93cb);if(_0x2cad8['query'][_0x3412('0x41')]){_0x1ae451[_0x3412('0x40')]=_[_0x3412('0x42')](_0x1ae451[_0x3412('0x40')],{'$or':_['map'](_0x4b93cb,function(_0x19477b){if(_0x19477b['type']!=='VIRTUAL'){var _0x45024d={};_0x45024d[_0x19477b['name']]={'$like':'%'+_0x2cad8[_0x3412('0x37')]['filter']+'%'};return _0x45024d;}})});}_0x1ae451=_[_0x3412('0x42')]({},_0x1ae451,_0x2cad8[_0x3412('0x43')]);var _0x39f448={'where':_0x1ae451[_0x3412('0x40')]};return db[_0x3412('0x44')][_0x3412('0x24')](_0x39f448)[_0x3412('0x2c')](function(_0x1cef26){_0x2c7226[_0x3412('0x24')]=_0x1cef26;if(_0x2cad8[_0x3412('0x37')][_0x3412('0x45')]){_0x1ae451[_0x3412('0x46')]=[{'all':!![]}];}return db[_0x3412('0x44')][_0x3412('0x47')](_0x1ae451);})[_0x3412('0x2c')](function(_0x49bcd6){_0x2c7226[_0x3412('0x48')]=_0x49bcd6;return _0x2c7226;})[_0x3412('0x2c')](respondWithFilteredResult(_0x1aaea5,_0x1ae451))[_0x3412('0x49')](handleError(_0x1aaea5,null));};exports[_0x3412('0x4a')]=function(_0x4dcc2e,_0x2ecbbc){var _0x4a4351={'raw':![],'where':{'id':_0x4dcc2e[_0x3412('0x4b')]['id']}},_0x475810={};_0x475810[_0x3412('0x3b')]=_[_0x3412('0x4c')](db[_0x3412('0x44')]['rawAttributes']);_0x475810['query']=_[_0x3412('0x4c')](_0x4dcc2e['query']);_0x475810['filters']=_[_0x3412('0x39')](_0x475810[_0x3412('0x3b')],_0x475810[_0x3412('0x37')]);_0x4a4351[_0x3412('0x3a')]=_['intersection'](_0x475810['model'],qs['fields'](_0x4dcc2e[_0x3412('0x37')][_0x3412('0x3c')]));_0x4a4351[_0x3412('0x3a')]=_0x4a4351[_0x3412('0x3a')]['length']?_0x4a4351['attributes']:_0x475810[_0x3412('0x3b')];if(_0x4dcc2e[_0x3412('0x37')][_0x3412('0x45')]){_0x4a4351[_0x3412('0x46')]=[{'all':!![]}];}_0x4a4351=_[_0x3412('0x42')]({},_0x4a4351,_0x4dcc2e['options']);return db[_0x3412('0x44')][_0x3412('0x4d')](_0x4a4351)['then'](handleEntityNotFound(_0x2ecbbc,null))[_0x3412('0x2c')](respondWithResult(_0x2ecbbc,null))[_0x3412('0x49')](handleError(_0x2ecbbc,null));};exports[_0x3412('0x4e')]=function(_0x3fe1a3,_0x28cf60){return db[_0x3412('0x44')][_0x3412('0x4e')](_0x3fe1a3[_0x3412('0x4f')],{})[_0x3412('0x2c')](respondWithResult(_0x28cf60,0xc9))[_0x3412('0x49')](handleError(_0x28cf60,null));};exports[_0x3412('0x50')]=function(_0x3e379d,_0x532092){var _0x55898c={'where':{'id':_0x3e379d['params']['id']}},_0x3db659={};_0x3db659[_0x3412('0x3b')]=_[_0x3412('0x4c')](db[_0x3412('0x44')][_0x3412('0x51')]);_0x55898c[_0x3412('0x3a')]=_[_0x3412('0x39')](_0x3db659['model'],qs['fields'](_0x3e379d[_0x3412('0x37')]['fields']));_0x55898c['attributes']=_0x55898c['attributes'][_0x3412('0x52')]?_0x55898c['attributes']:_0x3db659[_0x3412('0x3b')];if(_0x3e379d['query']['includeAll']){_0x55898c[_0x3412('0x46')]=[{'all':!![]}];}_0x55898c=_[_0x3412('0x42')]({},_0x55898c,_0x3e379d[_0x3412('0x43')]);return db['UserProfile'][_0x3412('0x4d')](_0x55898c)['then'](handleEntityNotFound(_0x532092,null))['then'](function(_0x445716){if(_0x445716){var _0x432c32=_0x445716[_0x3412('0x53')]({'plain':!![]});_0x432c32=qs['omit'](_0x432c32,['id',_0x3412('0x54'),_0x3412('0x55'),_0x3412('0x56')]);_0x3e379d[_0x3412('0x4f')]=_[_0x3412('0x57')](_0x3e379d[_0x3412('0x4f')],['id','createdAt',_0x3412('0x55')]);return db[_0x3412('0x58')]['transaction'](function(_0x1eb6fd){return db[_0x3412('0x44')][_0x3412('0x4e')](_[_0x3412('0x42')](_0x432c32,_0x3e379d['body']),{'include':_0x3e379d[_0x3412('0x37')][_0x3412('0x45')]?[{'all':!![]}]:undefined,'transaction':_0x1eb6fd})[_0x3412('0x2c')](function(_0x2067d9){var _0x35a2b8=_0x2067d9[_0x3412('0x53')]({'plain':!![]});return db[_0x3412('0x59')][_0x3412('0x47')]({'where':{'userProfileId':_0x3e379d[_0x3412('0x4b')]['id']},'raw':!![]})['then'](function(_0x20e45c){if(_0x20e45c){return BPromise[_0x3412('0x5a')](_0x20e45c,function(_0x4dc931){return new BPromise(function(_0x196992,_0x2552f5){if(_0x4dc931[_0x3412('0x5b')]===null||_0x4dc931[_0x3412('0x5b')]===0x1)_0x196992(null);return db[_0x3412('0x5c')][_0x3412('0x47')]({'where':{'sectionId':_0x4dc931['id']},'raw':!![]})[_0x3412('0x2c')](function(_0x174403){var _0x39ec11=_[_0x3412('0x33')](_0x174403,function(_0x2d78f2){return qs[_0x3412('0x57')](_0x2d78f2,['id',_0x3412('0x54'),_0x3412('0x55'),_0x3412('0x5d')]);});_0x196992(_0x39ec11);})[_0x3412('0x49')](function(_0x12c300){_0x2552f5(_0x12c300);});})['then'](function(_0x172656){var _0x3e47f1=qs[_0x3412('0x57')](_0x4dc931,['id',_0x3412('0x54'),'updatedAt']);_0x3e47f1[_0x3412('0x5e')]=_0x35a2b8['id'];if(_0x172656)_0x3e47f1['Resources']=_0x172656;return _0x3e47f1;})[_0x3412('0x2c')](function(_0x3ceb64){return db[_0x3412('0x59')][_0x3412('0x4e')](_0x3ceb64,{'include':[{'model':db[_0x3412('0x5c')],'as':_0x3412('0x5f')}],'raw':!![],'transaction':_0x1eb6fd});});})[_0x3412('0x2c')](function(){return _0x35a2b8;});}});});});}})[_0x3412('0x2c')](respondWithResult(_0x532092,0xc9))['catch'](handleError(_0x532092,null));};exports[_0x3412('0x2b')]=function(_0x18dbf8,_0x4c5e14){if(_0x18dbf8[_0x3412('0x4f')]['id']){delete _0x18dbf8[_0x3412('0x4f')]['id'];}return db[_0x3412('0x44')][_0x3412('0x4d')]({'where':{'id':_0x18dbf8['params']['id']}})[_0x3412('0x2c')](handleEntityNotFound(_0x4c5e14,null))[_0x3412('0x2c')](saveUpdates(_0x18dbf8['body'],null))[_0x3412('0x2c')](respondWithResult(_0x4c5e14,null))[_0x3412('0x49')](handleError(_0x4c5e14,null));};exports[_0x3412('0x2d')]=function(_0x4c7e04,_0x8ae87e){return db['UserProfile'][_0x3412('0x4d')]({'where':{'id':_0x4c7e04['params']['id']}})[_0x3412('0x2c')](handleEntityNotFound(_0x8ae87e,null))[_0x3412('0x2c')](removeEntity(_0x8ae87e,null))[_0x3412('0x49')](handleError(_0x8ae87e,null));};exports[_0x3412('0x60')]=function(_0x34671e,_0x322be2){return db[_0x3412('0x44')][_0x3412('0x60')]()[_0x3412('0x2c')](respondWithResult(_0x322be2,null))['catch'](handleError(_0x322be2,null));};exports[_0x3412('0x61')]=function(_0xa15903,_0x5e54ed){var _0x52a196=_0xa15903[_0x3412('0x4f')];return db[_0x3412('0x44')][_0x3412('0x4d')]({'where':{'id':_0xa15903[_0x3412('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e54ed,null))[_0x3412('0x2c')](function(_0x309e85){if(_0x309e85){return db['sequelize']['transaction'](function(_0x4bff65){return db[_0x3412('0x59')][_0x3412('0x2d')]({'where':{'userProfileId':_0xa15903['params']['id'],'sectionId':_[_0x3412('0x33')](_0x52a196,function(_0x2c1ce9){return _0x2c1ce9[_0x3412('0x5d')];})},'transaction':_0x4bff65})[_0x3412('0x2c')](function(){var _0x215225=_[_0x3412('0x33')](_0x52a196,function(_0x3c3d0c){_0x3c3d0c['userProfileId']=_0xa15903[_0x3412('0x4b')]['id'];return _0x3c3d0c;});var _0x45b890=[];return BPromise[_0x3412('0x5a')](_0x215225,function(_0x2f6bab){return db[_0x3412('0x59')]['create'](_0x2f6bab,{'include':[{'model':db[_0x3412('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x4bff65})[_0x3412('0x2c')](function(_0x477ac8){_0x45b890[_0x3412('0x62')](_0x477ac8['get']({'plain':!![]}));});})['then'](function(){return _0x45b890;});});});}})['then'](function(_0x1f6f28){return _0x1f6f28;})['then'](respondWithResult(_0x5e54ed,null))['catch'](handleError(_0x5e54ed,null));};exports['removeSections']=function(_0x495527,_0x1dfa1d){var _0x5790c5;return db[_0x3412('0x44')][_0x3412('0x4d')]({'where':{'id':_0x495527['params']['id']},'attributes':['id','name']})[_0x3412('0x2c')](handleEntityNotFound(_0x1dfa1d,null))['then'](function(_0xe0d787){if(_0xe0d787){_0x5790c5=_0xe0d787;return db[_0x3412('0x59')][_0x3412('0x2d')]({'where':{'userProfileId':_0x495527[_0x3412('0x4b')]['id'],'sectionId':_0x495527[_0x3412('0x37')][_0x3412('0x63')]}});}})[_0x3412('0x2c')](function(){return _0x5790c5;})[_0x3412('0x2c')](respondWithStatusCode(_0x1dfa1d,null))['catch'](handleError(_0x1dfa1d,null));};exports[_0x3412('0x64')]=function(_0x5c3ca7,_0x36a174){var _0xe0d831=[];var _0x18dac8=[];return db[_0x3412('0x59')][_0x3412('0x47')]({'where':{'userProfileId':_0x5c3ca7[_0x3412('0x4b')]['id']},'raw':!![]})['then'](function(_0x15defd){_0xe0d831=_[_0x3412('0x41')](_0x15defd,function(_0x83240){return _0x83240[_0x3412('0x65')]===0x1||_[_0x3412('0x66')]([0x3eb,0x709],_0x83240[_0x3412('0x5d')]);});if(!_[_0x3412('0x67')](_0xe0d831)){return _[_0x3412('0x33')](_0xe0d831,function(_0x1e8009){return _0x1e8009[_0x3412('0x5d')];});}else{return;}})[_0x3412('0x2c')](function(_0x2227fd){if(_0x2227fd)_0x18dac8=_0x2227fd;if(_['includes'](_0x18dac8,0x64)){var _0x330755=_[_0x3412('0x4d')](_0xe0d831,{'sectionId':0x64});return hasDefaultDashboard(_0x330755)[_0x3412('0x2c')](function(_0x1a668a){return _[_0x3412('0x33')](_0xe0d831,function(_0xbe84b0){if(_0xbe84b0[_0x3412('0x5d')]===0x64){_0xbe84b0['subsections']=_0x1a668a;}return _0xbe84b0;});});}else{return;}})[_0x3412('0x2c')](function(_0x1afdf6){if(_0x1afdf6)_0xe0d831=_0x1afdf6;if(_['includes'](_0x18dac8,0x3eb)){var _0x22cde2=_[_0x3412('0x4d')](_0xe0d831,{'sectionId':0x3eb});return getCustomDashboards(_0x22cde2)['then'](function(_0x167a6e){return _[_0x3412('0x33')](_0xe0d831,function(_0x34d03f){if(_0x22cde2[_0x3412('0x65')]){if(_0x34d03f[_0x3412('0x5d')]===0x3eb){_0x34d03f[_0x3412('0x68')]=_0x167a6e;}}else{if(_0x34d03f[_0x3412('0x5d')]===0x64){_0x34d03f[_0x3412('0x68')]=_0x167a6e;}}return _0x34d03f;});});}else{return;}})[_0x3412('0x2c')](function(_0x4f49c0){if(_0x4f49c0)_0xe0d831=_0x4f49c0;if(_[_0x3412('0x66')](_0x18dac8,0x709)){var _0x4913ac=_['find'](_0xe0d831,{'sectionId':0x709});return getPlugins(_0x4913ac)['then'](function(_0x3db981){if(_0x4913ac[_0x3412('0x65')]){return _[_0x3412('0x33')](_0xe0d831,function(_0x11fb91){if(_0x11fb91[_0x3412('0x5d')]===0x709){_0x11fb91[_0x3412('0x68')]=_0x3db981;}return _0x11fb91;});}else{var _0x10150f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3db981};var _0x4a6c09=_['map'](_0xe0d831);_0x4a6c09[_0x3412('0x62')](_0x10150f);return _0x4a6c09;}});}else{return;}})['then'](function(_0x8f25c7){if(_0x8f25c7)_0xe0d831=_0x8f25c7;return _[_0x3412('0x41')](_0xe0d831,[_0x3412('0x65'),0x1]);})[_0x3412('0x2c')](respondWithResult(_0x36a174,null))[_0x3412('0x49')](handleError(_0x36a174,null));};function hasDefaultDashboard(_0x23e379){var _0x368d67=[0x65];return new BPromise(function(_0x29940a,_0x38e1cc){try{if(_0x23e379[_0x3412('0x5b')]){_0x29940a(_0x368d67);}else{return db[_0x3412('0x5c')][_0x3412('0x69')]({'where':{'sectionId':_0x23e379['id']},'raw':!![]})[_0x3412('0x2c')](function(_0x1c03d7){_0x1c03d7?_0x29940a(_0x368d67):_0x29940a();});}}catch(_0xf4bb0f){_0x38e1cc(_0xf4bb0f);}});}function getCustomDashboards(_0x39e24d){var _0x1c3a85=[];return new BPromise(function(_0x5c2494,_0x5a2cda){try{if(_0x39e24d['autoAssociation']){return db['Dashboard'][_0x3412('0x47')]({'raw':!![]})[_0x3412('0x2c')](function(_0x20bf28){_0x20bf28['forEach'](function(_0x47dfe7){_0x1c3a85[_0x3412('0x62')](_0x47dfe7['id']+0x1869f);});_0x5c2494(_0x1c3a85);});}else{return db[_0x3412('0x5c')][_0x3412('0x47')]({'where':{'sectionId':_0x39e24d['id']},'raw':!![]})[_0x3412('0x2c')](function(_0x16cb1f){_0x16cb1f[_0x3412('0x6a')](function(_0x5de684){_0x1c3a85[_0x3412('0x62')](_0x5de684['resourceId']+0x1869f);});_0x5c2494(_0x1c3a85);});}}catch(_0x1e61a8){_0x5a2cda(_0x1e61a8);}});}function getPlugins(_0x29fa24){var _0x4fda83=[];return new BPromise(function(_0x28774e,_0x5b21e7){try{if(_0x29fa24[_0x3412('0x5b')]){return db[_0x3412('0x6b')][_0x3412('0x47')]({'raw':!![]})[_0x3412('0x2c')](function(_0x4d547c){_0x4d547c[_0x3412('0x6a')](function(_0x2ea734){_0x4fda83[_0x3412('0x62')](_0x2ea734['id']+0x15b38);});_0x28774e(_0x4fda83);});}else{return db['UserProfileResource'][_0x3412('0x47')]({'where':{'sectionId':_0x29fa24['id']},'raw':!![]})['then'](function(_0x1da0e){_0x1da0e['forEach'](function(_0x5ad414){_0x4fda83[_0x3412('0x62')](_0x5ad414['resourceId']+0x15b38);});_0x28774e(_0x4fda83);});}}catch(_0x4cb972){_0x5b21e7(_0x4cb972);}});}exports[_0x3412('0x6c')]=function(_0x1e84f3,_0x4e5947){return db[_0x3412('0x44')][_0x3412('0x4d')]({'where':{'id':_0x1e84f3['params']['id']}})[_0x3412('0x2c')](handleEntityNotFound(_0x4e5947,null))[_0x3412('0x2c')](function(_0x2936af){if(_0x2936af){return db[_0x3412('0x58')]['transaction'](function(_0x1182a0){return db[_0x3412('0x59')][_0x3412('0x47')]({'where':{'userProfileId':_0x1e84f3[_0x3412('0x4b')]['id']},'attributes':['id'],'raw':!![]})[_0x3412('0x2c')](function(_0x44ec5a){if(_0x44ec5a){return db[_0x3412('0x59')][_0x3412('0x2d')]({'where':{'userProfileId':_0x1e84f3['params']['id'],'id':_[_0x3412('0x33')](_0x44ec5a,function(_0x36910d){return _0x36910d['id'];})},'transaction':_0x1182a0});}})[_0x3412('0x2c')](function(_0x3f288a){var _0x37b8ac=_[_0x3412('0x33')](_0x1e84f3[_0x3412('0x4f')],function(_0x326699){_0x326699['userProfileId']=_0x1e84f3['params']['id'];return _0x326699;});return db[_0x3412('0x59')][_0x3412('0x6d')](_0x37b8ac,{'raw':!![],'transaction':_0x1182a0});})[_0x3412('0x2c')](function(_0x2a4620){var _0x41e860=_[_0x3412('0x41')](_[_0x3412('0x33')](_0x2a4620,function(_0x5f1477){return _0x5f1477[_0x3412('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x41e860){return db['UserProfileSection'][_0x3412('0x47')]({'where':{'userProfileId':_0x1e84f3[_0x3412('0x4b')]['id'],'sectionId':_[_0x3412('0x33')](_0x41e860,function(_0x5b331d){return _0x5b331d[_0x3412('0x5d')];})},'attributes':['id',_0x3412('0x5d')],'raw':!![]})[_0x3412('0x2c')](function(_0x25da86){var _0x24b5d2=_['map'](_0x1e84f3[_0x3412('0x4f')],function(_0x10af02){_0x10af02['userProfileId']=_0x1e84f3[_0x3412('0x4b')]['id'];return _0x10af02;});return db[_0x3412('0x5c')][_0x3412('0x6d')](_0x24b5d2,{'raw':!![],'transaction':_0x1182a0});});}})[_0x3412('0x49')](handleError(_0x4e5947,null));});}})[_0x3412('0x2c')](function(_0x5e88d9){var _0x192c87=_[_0x3412('0x33')](_0x5e88d9,function(_0x5c8da7){return _0x5c8da7[_0x3412('0x53')]({'plain':!![]});});})[_0x3412('0x2c')](respondWithResult(_0x4e5947,null))[_0x3412('0x49')](handleError(_0x4e5947,null));};exports[_0x3412('0x6e')]=function(_0x41679d,_0x3cbbaf,_0x1187c0){return db['UserProfile'][_0x3412('0x4d')]({'where':{'id':_0x41679d['params']['id']}})[_0x3412('0x2c')](handleEntityNotFound(_0x3cbbaf,null))[_0x3412('0x2c')](function(_0x2dc926){if(_0x2dc926){return _0x2dc926['removeResources'](_0x41679d[_0x3412('0x37')][_0x3412('0x63')]);}})[_0x3412('0x2c')](respondWithStatusCode(_0x3cbbaf,null))[_0x3412('0x49')](handleError(_0x3cbbaf,null));};exports[_0x3412('0x6f')]=function(_0x3de42b,_0x1aca66){var _0x189b96={};if(!_0x3de42b[_0x3412('0x37')][_0x3412('0x70')])throw new Error(_0x3412('0x71'));if(!_0x3de42b[_0x3412('0x37')][_0x3412('0x3d')](_0x3412('0x3e'))){_0x189b96[_0x3412('0x23')]=qs[_0x3412('0x23')](_0x3de42b[_0x3412('0x37')]['limit']);_0x189b96[_0x3412('0x25')]=qs[_0x3412('0x25')](_0x3de42b['query'][_0x3412('0x25')]);}return db[_0x3412('0x44')][_0x3412('0x4d')]({'where':{'id':_0x3de42b[_0x3412('0x4b')]['id']}})[_0x3412('0x2c')](function(_0x10cefa){if(!_0x10cefa)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3de42b[_0x3412('0x4b')]['id']);return db[_0x3412('0x44')][_0x3412('0x6f')](_0x3de42b);})['then'](respondWithFilteredResult(_0x1aca66,_0x189b96))[_0x3412('0x49')](handleError(_0x1aca66,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 70cce52..8b379af 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 _0x6db4=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x6db4,0x111));var _0x46db=function(_0x10c488,_0x12cff7){_0x10c488=_0x10c488-0x0;var _0x35ec61=_0x6db4[_0x10c488];return _0x35ec61;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x46db('0x0'))['db'][_0x46db('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x46db('0x2')](0x0);var events={'afterCreate':_0x46db('0x3'),'afterUpdate':_0x46db('0x4'),'afterDestroy':_0x46db('0x5')};function emitEvent(_0x5a9b9c){return function(_0x476ef3,_0x8e4cd8,_0x2a762b){UserProfileEvents[_0x46db('0x6')](_0x5a9b9c+':'+_0x476ef3['id'],_0x476ef3);UserProfileEvents[_0x46db('0x6')](_0x5a9b9c,_0x476ef3);_0x2a762b(null);};}for(var e in events){if(events[_0x46db('0x7')](e)){var event=events[e];UserProfile[_0x46db('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x06ae=['save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','UserProfile','setMaxListeners'];(function(_0xaf0c1f,_0x17908d){var _0x3584be=function(_0x336c44){while(--_0x336c44){_0xaf0c1f['push'](_0xaf0c1f['shift']());}};_0x3584be(++_0x17908d);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xe06a('0x0'))['db'][_0xe06a('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe06a('0x2')](0x0);var events={'afterCreate':_0xe06a('0x3'),'afterUpdate':_0xe06a('0x4'),'afterDestroy':_0xe06a('0x5')};function emitEvent(_0x2dfe68){return function(_0x1d695f,_0x1e7706,_0x4de363){UserProfileEvents['emit'](_0x2dfe68+':'+_0x1d695f['id'],_0x1d695f);UserProfileEvents['emit'](_0x2dfe68,_0x1d695f);_0x4de363(null);};}for(var e in events){if(events[_0xe06a('0x6')](e)){var event=events[e];UserProfile[_0xe06a('0x7')](e,emitEvent(event));}}module[_0xe06a('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 4c063c6..654a368 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 _0x1b24=['inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','queue','VoiceQueue','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','pauses','scheduler','Schedule','sounds','tags','Tag','templates','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','select','ui.','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','union','ignore','push','autoAssociation','model','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','rows','count','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','map','catch','value','findAll','then','associatedResources','name','resolve','AnalyticExtractedReport','resourceId','type','toLowerCase','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','parentSections','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts'];(function(_0x51c88b,_0x221a91){var _0x2bc9e4=function(_0x4d546d){while(--_0x4d546d){_0x51c88b['push'](_0x51c88b['shift']());}};_0x2bc9e4(++_0x221a91);}(_0x1b24,0x9a));var _0x41b2=function(_0x23c319,_0x1614ab){_0x23c319=_0x23c319-0x0;var _0x383310=_0x1b24[_0x23c319];return _0x383310;};'use strict';var _=require(_0x41b2('0x0'));var attributes=require(_0x41b2('0x1'));var qs=require('../../components/parsers/qs');var squel=require(_0x41b2('0x2'));module[_0x41b2('0x3')]=function(_0x35055d){var _0x10148c=_0x35055d[_0x41b2('0x4')];function _0x35d92f(_0x354254,_0x3160e5){return new Promise(function(_0x475a21,_0x1c2a0e){if(!_0x3160e5)return _0x475a21(null);var _0x2ae5e7=_0x3160e5[_0x41b2('0x5')]?{[_0x3160e5[_0x41b2('0x5')][_0x41b2('0x6')]]:_0x3160e5[_0x41b2('0x5')]['value']}:undefined;return _0x10148c[_0x354254]['findAll']({'where':_0x2ae5e7,'raw':!![]})['then'](function(_0x3ff8e3){_0x3160e5['associatedResources']=_[_0x41b2('0x7')](_0x3ff8e3,'id');_0x475a21(_0x3160e5);})[_0x41b2('0x8')](function(_0x2fb89b){_0x1c2a0e(_0x2fb89b);});});}function _0x2b1627(_0x1d46e7,_0x1253d9){return new Promise(function(_0xf66bd5,_0x3bfbcc){var _0x47823f=_0x1d46e7[_0x41b2('0x5')]?{[_0x1d46e7[_0x41b2('0x5')]['field']]:_0x1d46e7['filter'][_0x41b2('0x9')]}:undefined;return _0x10148c[_0x1d46e7['model']][_0x41b2('0xa')]({'where':_0x47823f,'raw':!![]})[_0x41b2('0xb')](function(_0x43065c){_0x1253d9[_0x41b2('0xc')]=_['map'](_0x43065c,function(_0x563aa5){return _0x563aa5[_0x41b2('0xd')];});_0xf66bd5(_0x1253d9);})['catch'](function(_0x156528){_0x3bfbcc(_0x156528);});});}function _0x5dc4ab(_0x5cb741,_0x1fb72a,_0x16f1d3){if(!_0x1fb72a)return Promise[_0x41b2('0xe')](null);return new Promise(function(_0xfb5794,_0x33b2c8){return _0x10148c['UserProfileResource'][_0x41b2('0xa')]({'where':{'sectionId':_0x1fb72a['id']},'raw':!![]})[_0x41b2('0xb')](function(_0xb71a73){if(_0x5cb741[_0x41b2('0x6')]&&_0x5cb741[_0x41b2('0x6')]!=='id'){_0x1fb72a['associatedResources']=_[_0x41b2('0x7')](_0xb71a73,function(_0x1385a4){return _0x1385a4[_0x5cb741[_0x41b2('0x6')]];});}else{if(_0x16f1d3===_0x41b2('0xf')){_0x1fb72a[_0x41b2('0xc')]=_[_0x41b2('0x7')](_0xb71a73,function(_0x4ae024){return{'id':_0x4ae024[_0x41b2('0x10')],'type':_0x4ae024[_0x41b2('0x11')]};});}else{_0x1fb72a['associatedResources']=_[_0x41b2('0x7')](_0xb71a73,function(_0x316a74){return _0x316a74[_0x41b2('0x10')];});}}_0xfb5794(_0x1fb72a);})[_0x41b2('0x8')](function(_0x324a7d){_0x33b2c8(_0x324a7d);});});}function _0x439dd8(_0x569a61,_0xfa42c7){var _0x25714a={'parentSections':[]};switch(_0x569a61[_0x41b2('0x12')]()){case'squareprojects':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x14');break;case _0x41b2('0x15'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x16');break;case _0x41b2('0x17'):_0x25714a['childModel']=_0x41b2('0x18');_0x25714a['parentSections']=[{'name':_0x41b2('0x19'),'field':'name','foreignKey':_0x41b2('0x1a')}];break;case _0x41b2('0x1b'):_0x25714a[_0x41b2('0x13')]='JscriptyProject';break;case _0x41b2('0x1c'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x1d');_0x25714a[_0x41b2('0x1e')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x1f');break;case _0x41b2('0x20'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x21');break;case _0x41b2('0x22'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x23');break;case _0x41b2('0x24'):_0x25714a[_0x41b2('0x13')]='ChatQueue';break;case _0x41b2('0x25'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x26');break;case _0x41b2('0x27'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x28');break;case _0x41b2('0x29'):_0x25714a[_0x41b2('0x13')]='FaxAccount';break;case _0x41b2('0x2a'):case _0x41b2('0x2b'):case'outboundroutes':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x2c');break;case _0x41b2('0x2d'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x2e');break;case'voicemails':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x2f');break;case _0x41b2('0x30'):_0x25714a['childModel']=_0x41b2('0x31');_0x25714a[_0x41b2('0x1e')]=[{'name':_0x41b2('0x32'),'field':_0x41b2('0xd'),'foreignKey':_0x41b2('0x33'),'model':_0x41b2('0x34'),'filter':{'field':'role','value':[_0x41b2('0x35')]}},{'name':_0x41b2('0x36'),'field':'name','foreignKey':_0x41b2('0x33'),'model':_0x41b2('0x34'),'filter':{'field':_0x41b2('0x37'),'value':[_0x41b2('0x38')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x41b2('0x39'),'model':_0x41b2('0x3a'),'filter':{'field':_0x41b2('0x11'),'value':['inbound']}},{'name':_0x41b2('0x3b'),'field':_0x41b2('0xd'),'foreignKey':_0x41b2('0x39'),'model':_0x41b2('0x3a'),'filter':{'field':_0x41b2('0x11'),'value':['outbound']}}];break;case _0x41b2('0x3c'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x3d');break;case _0x41b2('0x3e'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x3f');break;case'voiceprefixes':_0x25714a[_0x41b2('0x13')]='VoicePrefix';break;case _0x41b2('0x40'):_0x25714a['childModel']=_0x41b2('0x41');break;case _0x41b2('0x42'):_0x25714a['childModel']=_0x41b2('0x43');break;case _0x41b2('0x44'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x45');break;case _0x41b2('0x46'):_0x25714a['childModel']='MailSubstatus';break;case _0x41b2('0x47'):_0x25714a['childModel']='OpenchannelQueue';break;case _0x41b2('0x48'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x49');break;case _0x41b2('0x4a'):_0x25714a['childModel']=_0x41b2('0x4b');break;case _0x41b2('0x4c'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x4d');break;case'whatsappqueues':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x4e');break;case _0x41b2('0x4f'):_0x25714a['childModel']=_0x41b2('0x50');break;case _0x41b2('0x51'):_0x25714a['childModel']=_0x41b2('0x52');break;case _0x41b2('0x53'):case _0x41b2('0x54'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x3a');if(_0xfa42c7){_0x25714a['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0x41b2('0x55'):case _0x41b2('0x56'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x34');if(_0xfa42c7){_0x25714a[_0x41b2('0x1e')]=[{'name':_0x41b2('0x57'),'filter':{'field':_0x41b2('0x37'),'value':[_0x41b2('0x58'),_0x41b2('0x59')]},'ignore':!![]},{'name':_0x41b2('0x32')},{'name':_0x41b2('0x36')}];}break;case _0x41b2('0x5a'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x5b');break;case _0x41b2('0x5c'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x5d');break;case'freshdeskaccounts':_0x25714a[_0x41b2('0x13')]=_0x41b2('0x5e');break;case _0x41b2('0x5f'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x60');break;case _0x41b2('0x61'):_0x25714a[_0x41b2('0x13')]='DeskAccount';break;case _0x41b2('0x62'):_0x25714a['childModel']=_0x41b2('0x63');break;case _0x41b2('0x64'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x34');break;case _0x41b2('0x65'):_0x25714a[_0x41b2('0x13')]='CannedAnswer';break;case _0x41b2('0x66'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x67');break;case _0x41b2('0x68'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x69');break;case'intervals':_0x25714a['childModel']='Interval';break;case _0x41b2('0x6a'):_0x25714a[_0x41b2('0x13')]='Pause';break;case _0x41b2('0x6b'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x6c');break;case _0x41b2('0x6d'):_0x25714a[_0x41b2('0x13')]='Sound';break;case _0x41b2('0x6e'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x6f');break;case _0x41b2('0x70'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x71');break;case _0x41b2('0x72'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x73');break;case _0x41b2('0x74'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x75');break;case _0x41b2('0x76'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x77');break;case _0x41b2('0x78'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x79');break;case _0x41b2('0x7a'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0xf');_0x25714a[_0x41b2('0x1e')]=[{'name':_0x41b2('0x7b'),'field':'id','foreignKey':_0x41b2('0x7c')}];break;case _0x41b2('0x7d'):_0x25714a[_0x41b2('0x13')]=_0x41b2('0x7e');break;}return _0x25714a;}function _0x2bc089(_0x2cb9d4,_0x16c614){var _0x37f8c5=_0x2cb9d4[_0x41b2('0x7f')](0x0)['toUpperCase']()+_0x2cb9d4[_0x41b2('0x80')](0x1);var _0x5eedbe={'type':_0x10148c[_0x41b2('0x81')][_0x41b2('0x82')][_0x41b2('0x83')],'raw':!![]};return new Promise(function(_0x53f2bc,_0xe4d666){var _0x202714=squel[_0x41b2('0x84')]()['field'](_0x41b2('0x85')+_0x37f8c5+'InteractionId','id')[_0x41b2('0x6')]('ui.createdAt')[_0x41b2('0x86')](_0x41b2('0x87')+_0x2cb9d4+_0x41b2('0x88'),'ui')[_0x41b2('0x89')](_0x41b2('0x8a'),_0x16c614['id']);return _0x10148c['sequelize']['query'](_0x202714[_0x41b2('0x8b')](),_0x5eedbe)['then'](function(_0x4155a7){_0x16c614[_0x37f8c5+_0x41b2('0x8c')]=_0x4155a7;_0x53f2bc(_0x4155a7);})[_0x41b2('0x8')](function(_0x392ba2){_0xe4d666(_0x392ba2);});});}return _0x35055d[_0x41b2('0x8d')]('UserProfile',attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2ad2f4){var _0x3ba618={'raw':_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0x8f')],'where':{}};var _0x39face={};var _0x9fddc7={'count':0x0,'rows':[]};var _0x2dc52b=_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0x90')];var _0x3cad70=_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0x91')]||![];var _0x45d6c6=_0x439dd8(_0x2dc52b,_0x3cad70);if(!_0x45d6c6[_0x41b2('0x13')])throw new Error(_0x41b2('0x92')+_0x2dc52b+'\x27');var _0x57697a=[{'name':_0x2dc52b}];if(!_[_0x41b2('0x93')](_0x45d6c6['parentSections']))_0x57697a=_0x45d6c6[_0x41b2('0x1e')];var _0x4e05dd=[];for(var _0x53c10f=0x0;_0x53c10f<_0x57697a[_0x41b2('0x94')];_0x53c10f++){_0x4e05dd['push'](_0x10148c[_0x41b2('0x95')][_0x41b2('0x96')]({'where':{'userProfileId':_0x2ad2f4['params']['id'],'name':_0x57697a[_0x53c10f]['name']},'raw':!![]}));}return Promise['all'](_0x4e05dd)[_0x41b2('0xb')](function(_0x5adbab){var _0x3f4b93=_['filter'](_0x5adbab,function(_0x432c80){return _0x432c80?_0x432c80:undefined;});var _0x12aabb=_[_0x41b2('0x5')](_0x57697a,['ignore',!![]]);var _0x4c3a81=_[_0x41b2('0x93')](_0x3f4b93)&&_[_0x41b2('0x93')](_0x12aabb)?null:_[_0x41b2('0x97')](_0x12aabb,_0x3f4b93);if(!_0x4c3a81)return null;var _0x3f064c=[];for(var _0x3d0760=0x0;_0x3d0760<_0x4c3a81[_0x41b2('0x94')];_0x3d0760++){var _0x3e597a=_[_0x41b2('0x96')](_0x57697a,function(_0x1f5de1){return _0x4c3a81[_0x3d0760]?_0x1f5de1[_0x41b2('0xd')]===_0x4c3a81[_0x3d0760][_0x41b2('0xd')]:null;});if(_0x3e597a){if(_0x4c3a81[_0x3d0760][_0x41b2('0x98')]){_0x3f064c[_0x41b2('0x99')](_0x35d92f(_0x45d6c6[_0x41b2('0x13')],_0x4c3a81[_0x3d0760]));}else{if(!_0x4c3a81[_0x3d0760][_0x41b2('0x9a')]){_0x3f064c[_0x41b2('0x99')](_0x5dc4ab(_0x3e597a,_0x4c3a81[_0x3d0760],_0x45d6c6['childModel']));}else{if(_0x3e597a[_0x41b2('0x9b')]){_0x3f064c[_0x41b2('0x99')](_0x2b1627(_0x3e597a,_0x4c3a81[_0x3d0760]));}}}}}return Promise[_0x41b2('0x9c')](_0x3f064c);})[_0x41b2('0xb')](function(_0x5dbcf7){var _0xfd3553=_0x5dbcf7;var _0x1a9f2d=null;if(_0xfd3553){_0x1a9f2d=_0xfd3553[_0x41b2('0x94')]===0x1?_0xfd3553[0x0]:null;}if(!_0x1a9f2d&&!_0xfd3553)return _0x9fddc7;var _0x38bce9=_0x10148c[_0x45d6c6[_0x41b2('0x13')]][_0x41b2('0x9d')];_0x39face[_0x41b2('0x9b')]=_['keys'](_0x38bce9);_0x39face[_0x41b2('0x8e')]=_[_0x41b2('0x9e')](_0x2ad2f4[_0x41b2('0x8e')]);_0x39face[_0x41b2('0x9f')]=_[_0x41b2('0xa0')](_0x39face[_0x41b2('0x9b')],_0x39face[_0x41b2('0x8e')]);_0x3ba618[_0x41b2('0xa1')]=_[_0x41b2('0xa0')](_0x39face['model'],qs[_0x41b2('0xa2')](_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xa2')]));_0x3ba618[_0x41b2('0xa1')]=_0x3ba618[_0x41b2('0xa1')][_0x41b2('0x94')]?_0x3ba618[_0x41b2('0xa1')]:_0x39face[_0x41b2('0x9b')];if(!_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xa3')](_0x41b2('0xa4'))){_0x3ba618[_0x41b2('0xa5')]=qs[_0x41b2('0xa5')](_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xa5')]);_0x3ba618['offset']=qs['offset'](_0x2ad2f4['query'][_0x41b2('0xa6')]);}_0x3ba618[_0x41b2('0xa7')]=qs[_0x41b2('0xa8')](_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xa8')]);_0x3ba618[_0x41b2('0x89')]=qs[_0x41b2('0x9f')](_['pick'](_0x2ad2f4[_0x41b2('0x8e')],_0x39face[_0x41b2('0x9f')]));if(_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0x5')]){_0x3ba618[_0x41b2('0x89')]=_[_0x41b2('0xa9')](_0x3ba618[_0x41b2('0x89')],{'$or':_[_0x41b2('0x7')](_0x38bce9,function(_0x4219df){if(_0x4219df[_0x41b2('0x11')]['key']!==_0x41b2('0xaa')){var _0xebaea9={};_0xebaea9[_0x4219df['field']]={'$like':'%'+_0x2ad2f4['query'][_0x41b2('0x5')]+'%'};return _0xebaea9;}})});}var _0x40238c=[];var _0x25b190=null;var _0x5c6988={};if(_0x1a9f2d){_0x25b190=_[_0x41b2('0x96')](_0x57697a,[_0x41b2('0xd'),_0x1a9f2d['name']]);if(_0x25b190['field']){_0x5c6988={};if(_0x45d6c6[_0x41b2('0x13')]===_0x41b2('0xf')){_0x5c6988[_0x25b190[_0x41b2('0xab')]]=_['map'](_0x1a9f2d[_0x41b2('0xc')],'id');}else{_0x5c6988[_0x25b190[_0x41b2('0xab')]]=_0x1a9f2d[_0x41b2('0xc')];}_0x40238c[_0x41b2('0x99')](_0x5c6988);}else{_0x3ba618[_0x41b2('0x89')]['id']=_0x1a9f2d[_0x41b2('0xc')];}}else{for(var _0x2c7844=0x0;_0x2c7844<_0xfd3553[_0x41b2('0x94')];_0x2c7844++){_0x25b190=_[_0x41b2('0x96')](_0x57697a,[_0x41b2('0xd'),_0xfd3553[_0x2c7844][_0x41b2('0xd')]]);if(_0x25b190[_0x41b2('0x6')]){_0x5c6988={};_0x5c6988[_0x25b190[_0x41b2('0xab')]]=_0xfd3553[_0x2c7844][_0x41b2('0xc')];_0x40238c['push'](_0x5c6988);}else{if(!_0x3ba618[_0x41b2('0x89')]['id'])_0x3ba618[_0x41b2('0x89')]['id']=[];_0xfd3553[_0x2c7844]['associatedResources'][_0x41b2('0xac')](function(_0x5602cc){_0x3ba618[_0x41b2('0x89')]['id'][_0x41b2('0x99')](_0x5602cc);});}}}if(!_['isEmpty'](_0x40238c)){_0x3ba618['where']=_['merge'](_0x3ba618['where'],{'$and':{'$or':_0x40238c}});}_0x3ba618=_[_0x41b2('0xa9')]({},_0x3ba618,_0x2ad2f4[_0x41b2('0xad')]);if(_0x1a9f2d&&!_0x1a9f2d['autoAssociation']&&_0x45d6c6[_0x41b2('0x13')]===_0x41b2('0xf')){if(_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xae')]){_0x3ba618[_0x41b2('0xaf')]=[{'all':!![]}];}return _0x10148c[_0x45d6c6[_0x41b2('0x13')]][_0x41b2('0xa')](_0x3ba618)[_0x41b2('0xb')](function(_0x458434){var _0x34743b=[];_0x458434[_0x41b2('0xac')](function(_0x3c224e){var _0x4cf07c;switch(_0x3c224e[_0x41b2('0xb0')]){case _0x41b2('0xb1'):_0x4cf07c=_[_0x41b2('0x96')](_0x1a9f2d['associatedResources'],function(_0x1374f8){return _0x1374f8['id']===_0x3c224e[_0x41b2('0x7c')]&&_0x1374f8['type']===_0x41b2('0xb2');});break;case _0x41b2('0xb3'):_0x4cf07c=_[_0x41b2('0x96')](_0x1a9f2d[_0x41b2('0xc')],function(_0xe4bfb7){return _0xe4bfb7['id']===_0x3c224e[_0x41b2('0x7c')]&&_0xe4bfb7['type']===_0x41b2('0xb4');});break;}if(_0x4cf07c)_0x34743b['push'](_0x3c224e);});_0x9fddc7['count']=_0x34743b[_0x41b2('0x94')];_0x9fddc7[_0x41b2('0xb5')]=_0x34743b;return _0x9fddc7;});}else{return _0x10148c[_0x45d6c6[_0x41b2('0x13')]][_0x41b2('0xb6')]({'where':_0x3ba618['where']})[_0x41b2('0xb')](function(_0x33d360){_0x9fddc7[_0x41b2('0xb6')]=_0x33d360;if(_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xae')]){if(_0x45d6c6[_0x41b2('0x13')]===_0x41b2('0x1d')){_0x3ba618[_0x41b2('0xaf')]=[{'model':_0x10148c[_0x41b2('0x6f')],'as':_0x41b2('0xb7'),'attributes':['id',_0x41b2('0xd'),_0x41b2('0xb8')],'required':_0x2ad2f4['query'][_0x41b2('0xb9')]?!![]:![]},{'model':_0x10148c[_0x41b2('0x6f')],'as':_0x41b2('0xba'),'attributes':['id','name',_0x41b2('0xb8')],'through':_0x2ad2f4[_0x41b2('0x8e')]['tag']?{'attributes':[],'where':{'TagId':_0x2ad2f4['query']['tag']||undefined}}:{},'required':_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xb9')]?!![]:![]}];}else{_0x3ba618['include']=[{'all':!![]}];}}return _0x10148c[_0x45d6c6['childModel']][_0x41b2('0xa')](_0x3ba618);})[_0x41b2('0xb')](function(_0x27cf08){_0x9fddc7['rows']=_0x27cf08;if(_0x2dc52b===_0x41b2('0x32')&&_0x2ad2f4[_0x41b2('0x8e')][_0x41b2('0xbb')]===_0x41b2('0xbc')){var _0x1ddcf7=[];for(var _0x32f679=0x0;_0x32f679<_0x9fddc7['rows'][_0x41b2('0x94')];_0x32f679++){_0x1ddcf7[_0x41b2('0x99')](_0x2bc089(_0x41b2('0xbd'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679][_0x41b2('0xbe')]));_0x1ddcf7['push'](_0x2bc089(_0x41b2('0xbf'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679][_0x41b2('0xbe')]));_0x1ddcf7[_0x41b2('0x99')](_0x2bc089(_0x41b2('0xc0'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679]['dataValues']));_0x1ddcf7[_0x41b2('0x99')](_0x2bc089(_0x41b2('0xc1'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679][_0x41b2('0xbe')]));_0x1ddcf7['push'](_0x2bc089(_0x41b2('0xc2'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679]['dataValues']));_0x1ddcf7['push'](_0x2bc089(_0x41b2('0xc3'),_0x9fddc7[_0x41b2('0xb5')][_0x32f679]['dataValues']));}return Promise['all'](_0x1ddcf7)[_0x41b2('0xb')](function(){return _0x9fddc7;});}return _0x9fddc7;});}});}}});}; \ No newline at end of file +var _0x3cb4=['ThroughTags','color','openTabs','true','chat','dataValues','fax','openchannel','lodash','squel','exports','filter','field','value','then','map','catch','model','findAll','associatedResources','name','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','Agents','User','role','membername','queue','VoiceQueue','type','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','QueueCampaigns','users','agents','telephones','Users','user','Telephones','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','Dashboard','Interval','Pause','scheduler','Schedule','tags','templates','triggers','Trigger','trunks','Variable','Plugin','extractedreports','Reports','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','limit','offset','order','sort','pick','where','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','reportId','DefaultReports','count','rows','Tags','tag','Tag'];(function(_0x451497,_0x263564){var _0x18a78a=function(_0x26f167){while(--_0x26f167){_0x451497['push'](_0x451497['shift']());}};_0x18a78a(++_0x263564);}(_0x3cb4,0x178));var _0x43cb=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x3cb4[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x43cb('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');var squel=require(_0x43cb('0x1'));module[_0x43cb('0x2')]=function(_0x53dfea){var _0x3885af=_0x53dfea['models'];function _0x22383e(_0x440ccd,_0x2cf012){return new Promise(function(_0xa950be,_0x30eedd){if(!_0x2cf012)return _0xa950be(null);var _0x5b450b=_0x2cf012[_0x43cb('0x3')]?{[_0x2cf012[_0x43cb('0x3')][_0x43cb('0x4')]]:_0x2cf012[_0x43cb('0x3')][_0x43cb('0x5')]}:undefined;return _0x3885af[_0x440ccd]['findAll']({'where':_0x5b450b,'raw':!![]})[_0x43cb('0x6')](function(_0x49220d){_0x2cf012['associatedResources']=_[_0x43cb('0x7')](_0x49220d,'id');_0xa950be(_0x2cf012);})[_0x43cb('0x8')](function(_0x2a2310){_0x30eedd(_0x2a2310);});});}function _0x3dee90(_0x5e05c3,_0x5e25eb){return new Promise(function(_0x5f1df4,_0x32f713){var _0x40dfa7=_0x5e05c3[_0x43cb('0x3')]?{[_0x5e05c3[_0x43cb('0x3')]['field']]:_0x5e05c3[_0x43cb('0x3')][_0x43cb('0x5')]}:undefined;return _0x3885af[_0x5e05c3[_0x43cb('0x9')]][_0x43cb('0xa')]({'where':_0x40dfa7,'raw':!![]})['then'](function(_0x1c9b27){_0x5e25eb[_0x43cb('0xb')]=_[_0x43cb('0x7')](_0x1c9b27,function(_0x19d360){return _0x19d360[_0x43cb('0xc')];});_0x5f1df4(_0x5e25eb);})[_0x43cb('0x8')](function(_0x2c4c10){_0x32f713(_0x2c4c10);});});}function _0x204f25(_0x5262b2,_0x560182,_0x1e5431){if(!_0x560182)return Promise['resolve'](null);return new Promise(function(_0x666979,_0x1bd255){return _0x3885af[_0x43cb('0xd')][_0x43cb('0xa')]({'where':{'sectionId':_0x560182['id']},'raw':!![]})[_0x43cb('0x6')](function(_0x4a7f03){if(_0x5262b2[_0x43cb('0x4')]&&_0x5262b2[_0x43cb('0x4')]!=='id'){_0x560182[_0x43cb('0xb')]=_[_0x43cb('0x7')](_0x4a7f03,function(_0x235c70){return _0x235c70[_0x5262b2[_0x43cb('0x4')]];});}else{if(_0x1e5431===_0x43cb('0xe')){_0x560182['associatedResources']=_[_0x43cb('0x7')](_0x4a7f03,function(_0x4e701f){return{'id':_0x4e701f[_0x43cb('0xf')],'type':_0x4e701f['type']};});}else{_0x560182[_0x43cb('0xb')]=_[_0x43cb('0x7')](_0x4a7f03,function(_0x2b4107){return _0x2b4107[_0x43cb('0xf')];});}}_0x666979(_0x560182);})[_0x43cb('0x8')](function(_0x3682da){_0x1bd255(_0x3682da);});});}function _0x41dcca(_0x389b90,_0x28ae0b){var _0x100dbd={'parentSections':[]};switch(_0x389b90[_0x43cb('0x10')]()){case'squareprojects':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x12');break;case _0x43cb('0x13'):_0x100dbd[_0x43cb('0x11')]='SquareOdbc';break;case _0x43cb('0x14'):_0x100dbd['childModel']=_0x43cb('0x15');_0x100dbd[_0x43cb('0x16')]=[{'name':_0x43cb('0x17'),'field':_0x43cb('0xc'),'foreignKey':_0x43cb('0x18')}];break;case _0x43cb('0x19'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x1a');break;case'contacts':_0x100dbd['childModel']=_0x43cb('0x1b');_0x100dbd['parentSections']=[{'name':_0x43cb('0x1c'),'field':'id','foreignKey':_0x43cb('0x1d')}];break;case _0x43cb('0x1e'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x1f');break;case _0x43cb('0x20'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x21');break;case _0x43cb('0x22'):_0x100dbd['childModel']=_0x43cb('0x23');break;case'chatqueues':_0x100dbd['childModel']=_0x43cb('0x24');break;case _0x43cb('0x25'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x26');break;case'faxqueues':_0x100dbd[_0x43cb('0x11')]='FaxQueue';break;case _0x43cb('0x27'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x28');break;case _0x43cb('0x29'):case _0x43cb('0x2a'):case _0x43cb('0x2b'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x2c');break;case _0x43cb('0x2d'):_0x100dbd['childModel']=_0x43cb('0x2e');break;case _0x43cb('0x2f'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x30');break;case _0x43cb('0x31'):_0x100dbd[_0x43cb('0x11')]='VoiceRecording';_0x100dbd['parentSections']=[{'name':_0x43cb('0x32'),'field':_0x43cb('0xc'),'foreignKey':'membername','model':_0x43cb('0x33'),'filter':{'field':_0x43cb('0x34'),'value':['agent']}},{'name':'Telephones','field':'name','foreignKey':_0x43cb('0x35'),'model':_0x43cb('0x33'),'filter':{'field':_0x43cb('0x34'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x43cb('0xc'),'foreignKey':_0x43cb('0x36'),'model':_0x43cb('0x37'),'filter':{'field':_0x43cb('0x38'),'value':[_0x43cb('0x39')]}},{'name':'QueueCampaigns','field':_0x43cb('0xc'),'foreignKey':'queue','model':_0x43cb('0x37'),'filter':{'field':_0x43cb('0x38'),'value':[_0x43cb('0x3a')]}}];break;case _0x43cb('0x3b'):_0x100dbd['childModel']=_0x43cb('0x3c');break;case _0x43cb('0x3d'):_0x100dbd['childModel']=_0x43cb('0x3e');break;case _0x43cb('0x3f'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x40');break;case _0x43cb('0x41'):_0x100dbd[_0x43cb('0x11')]='Campaign';break;case _0x43cb('0x42'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x43');break;case _0x43cb('0x44'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x45');break;case _0x43cb('0x46'):_0x100dbd['childModel']=_0x43cb('0x47');break;case _0x43cb('0x48'):_0x100dbd['childModel']='OpenchannelQueue';break;case _0x43cb('0x49'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x4a');break;case _0x43cb('0x4b'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x4c');break;case _0x43cb('0x4d'):_0x100dbd['childModel']=_0x43cb('0x4e');break;case _0x43cb('0x4f'):_0x100dbd[_0x43cb('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x50');break;case _0x43cb('0x51'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x52');break;case'voicequeues':case _0x43cb('0x53'):_0x100dbd['childModel']=_0x43cb('0x37');if(_0x28ae0b){_0x100dbd[_0x43cb('0x16')]=[{'name':_0x43cb('0x54')},{'name':_0x43cb('0x55')}];}break;case _0x43cb('0x56'):case _0x43cb('0x57'):case _0x43cb('0x58'):_0x100dbd['childModel']=_0x43cb('0x33');if(_0x28ae0b){_0x100dbd['parentSections']=[{'name':_0x43cb('0x59'),'filter':{'field':_0x43cb('0x34'),'value':['admin',_0x43cb('0x5a')]},'ignore':!![]},{'name':_0x43cb('0x32')},{'name':_0x43cb('0x5b')}];}break;case _0x43cb('0x5c'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x5d');break;case'salesforceaccounts':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x5e');break;case _0x43cb('0x5f'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x60');break;case _0x43cb('0x61'):_0x100dbd[_0x43cb('0x11')]='SugarcrmAccount';break;case _0x43cb('0x62'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x63');break;case'zohoaccounts':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x64');break;case _0x43cb('0x65'):_0x100dbd['childModel']=_0x43cb('0x33');break;case _0x43cb('0x66'):_0x100dbd[_0x43cb('0x11')]='CannedAnswer';break;case'dispositions':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x67');break;case'customdashboards':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x68');break;case'intervals':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x69');break;case'pauses':_0x100dbd['childModel']=_0x43cb('0x6a');break;case _0x43cb('0x6b'):_0x100dbd['childModel']=_0x43cb('0x6c');break;case'sounds':_0x100dbd[_0x43cb('0x11')]='Sound';break;case _0x43cb('0x6d'):_0x100dbd[_0x43cb('0x11')]='Tag';break;case _0x43cb('0x6e'):_0x100dbd[_0x43cb('0x11')]='Template';break;case _0x43cb('0x6f'):_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x70');break;case _0x43cb('0x71'):_0x100dbd[_0x43cb('0x11')]='Trunk';break;case'variables':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x72');break;case'plugins':_0x100dbd[_0x43cb('0x11')]=_0x43cb('0x73');break;case _0x43cb('0x74'):_0x100dbd['childModel']=_0x43cb('0xe');_0x100dbd['parentSections']=[{'name':_0x43cb('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x100dbd['childModel']=_0x43cb('0x76');break;}return _0x100dbd;}function _0x56d5bb(_0x1880f4,_0x93ca7){var _0x5f22f2=_0x1880f4[_0x43cb('0x77')](0x0)[_0x43cb('0x78')]()+_0x1880f4[_0x43cb('0x79')](0x1);var _0x49ab5e={'type':_0x3885af[_0x43cb('0x7a')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x4ae0a6,_0x3f9121){var _0x52fe3c=squel['select']()['field'](_0x43cb('0x7b')+_0x5f22f2+_0x43cb('0x7c'),'id')[_0x43cb('0x4')](_0x43cb('0x7d'))[_0x43cb('0x7e')](_0x43cb('0x7f')+_0x1880f4+_0x43cb('0x80'),'ui')['where'](_0x43cb('0x81'),_0x93ca7['id']);return _0x3885af[_0x43cb('0x82')]['query'](_0x52fe3c[_0x43cb('0x83')](),_0x49ab5e)[_0x43cb('0x6')](function(_0x1e0d80){_0x93ca7[_0x5f22f2+'OpenTabs']=_0x1e0d80;_0x4ae0a6(_0x1e0d80);})['catch'](function(_0x12cee8){_0x3f9121(_0x12cee8);});});}return _0x53dfea['define'](_0x43cb('0x84'),attributes,{'tableName':_0x43cb('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x36660f){var _0x2f9542={'raw':_0x36660f[_0x43cb('0x86')]['raw'],'where':{}};var _0x1a5121={};var _0x20fc3a={'count':0x0,'rows':[]};var _0x63404e=_0x36660f['query'][_0x43cb('0x87')];var _0x1f0158=_0x36660f[_0x43cb('0x86')][_0x43cb('0x88')]||![];var _0x5ae25c=_0x41dcca(_0x63404e,_0x1f0158);if(!_0x5ae25c[_0x43cb('0x11')])throw new Error(_0x43cb('0x89')+_0x63404e+'\x27');var _0x3ed572=[{'name':_0x63404e}];if(!_[_0x43cb('0x8a')](_0x5ae25c[_0x43cb('0x16')]))_0x3ed572=_0x5ae25c['parentSections'];var _0x4966b0=[];for(var _0x1d20fe=0x0;_0x1d20fe<_0x3ed572[_0x43cb('0x8b')];_0x1d20fe++){_0x4966b0['push'](_0x3885af[_0x43cb('0x8c')][_0x43cb('0x8d')]({'where':{'userProfileId':_0x36660f[_0x43cb('0x8e')]['id'],'name':_0x3ed572[_0x1d20fe]['name']},'raw':!![]}));}return Promise[_0x43cb('0x8f')](_0x4966b0)['then'](function(_0x203eb5){var _0x410c67=_[_0x43cb('0x3')](_0x203eb5,function(_0x5caaed){return _0x5caaed?_0x5caaed:undefined;});var _0x5d2bb=_[_0x43cb('0x3')](_0x3ed572,[_0x43cb('0x90'),!![]]);var _0x238537=_[_0x43cb('0x8a')](_0x410c67)&&_[_0x43cb('0x8a')](_0x5d2bb)?null:_[_0x43cb('0x91')](_0x5d2bb,_0x410c67);if(!_0x238537)return null;var _0xcb18a7=[];for(var _0x5a4863=0x0;_0x5a4863<_0x238537['length'];_0x5a4863++){var _0x4360ee=_[_0x43cb('0x8d')](_0x3ed572,function(_0x4a764e){return _0x238537[_0x5a4863]?_0x4a764e[_0x43cb('0xc')]===_0x238537[_0x5a4863][_0x43cb('0xc')]:null;});if(_0x4360ee){if(_0x238537[_0x5a4863][_0x43cb('0x90')]){_0xcb18a7[_0x43cb('0x92')](_0x22383e(_0x5ae25c[_0x43cb('0x11')],_0x238537[_0x5a4863]));}else{if(!_0x238537[_0x5a4863][_0x43cb('0x93')]){_0xcb18a7[_0x43cb('0x92')](_0x204f25(_0x4360ee,_0x238537[_0x5a4863],_0x5ae25c[_0x43cb('0x11')]));}else{if(_0x4360ee['model']){_0xcb18a7['push'](_0x3dee90(_0x4360ee,_0x238537[_0x5a4863]));}}}}}return Promise[_0x43cb('0x8f')](_0xcb18a7);})[_0x43cb('0x6')](function(_0x3344f5){var _0x1b984a=_0x3344f5;var _0x42abe8=null;if(_0x1b984a){_0x42abe8=_0x1b984a[_0x43cb('0x8b')]===0x1?_0x1b984a[0x0]:null;}if(!_0x42abe8&&!_0x1b984a)return _0x20fc3a;var _0x4abf64=_0x3885af[_0x5ae25c['childModel']][_0x43cb('0x94')];_0x1a5121['model']=_[_0x43cb('0x95')](_0x4abf64);_0x1a5121[_0x43cb('0x86')]=_[_0x43cb('0x95')](_0x36660f[_0x43cb('0x86')]);_0x1a5121[_0x43cb('0x96')]=_[_0x43cb('0x97')](_0x1a5121[_0x43cb('0x9')],_0x1a5121['query']);_0x2f9542['attributes']=_[_0x43cb('0x97')](_0x1a5121[_0x43cb('0x9')],qs['fields'](_0x36660f[_0x43cb('0x86')][_0x43cb('0x98')]));_0x2f9542[_0x43cb('0x99')]=_0x2f9542[_0x43cb('0x99')][_0x43cb('0x8b')]?_0x2f9542['attributes']:_0x1a5121[_0x43cb('0x9')];if(!_0x36660f['query']['hasOwnProperty']('nolimit')){_0x2f9542[_0x43cb('0x9a')]=qs[_0x43cb('0x9a')](_0x36660f[_0x43cb('0x86')][_0x43cb('0x9a')]);_0x2f9542[_0x43cb('0x9b')]=qs[_0x43cb('0x9b')](_0x36660f['query'][_0x43cb('0x9b')]);}_0x2f9542[_0x43cb('0x9c')]=qs[_0x43cb('0x9d')](_0x36660f[_0x43cb('0x86')][_0x43cb('0x9d')]);_0x2f9542['where']=qs[_0x43cb('0x96')](_[_0x43cb('0x9e')](_0x36660f['query'],_0x1a5121['filters']));if(_0x36660f[_0x43cb('0x86')][_0x43cb('0x3')]){_0x2f9542[_0x43cb('0x9f')]=_[_0x43cb('0xa0')](_0x2f9542['where'],{'$or':_[_0x43cb('0x7')](_0x4abf64,function(_0x1056cb){if(_0x1056cb['type'][_0x43cb('0xa1')]!==_0x43cb('0xa2')){var _0x55ad57={};_0x55ad57[_0x1056cb[_0x43cb('0x4')]]={'$like':'%'+_0x36660f[_0x43cb('0x86')][_0x43cb('0x3')]+'%'};return _0x55ad57;}})});}var _0x5d2d66=[];var _0x46fa3a=null;var _0x8c2147={};if(_0x42abe8){_0x46fa3a=_[_0x43cb('0x8d')](_0x3ed572,[_0x43cb('0xc'),_0x42abe8[_0x43cb('0xc')]]);if(_0x46fa3a[_0x43cb('0x4')]){_0x8c2147={};if(_0x5ae25c[_0x43cb('0x11')]===_0x43cb('0xe')){_0x8c2147[_0x46fa3a[_0x43cb('0xa3')]]=_[_0x43cb('0x7')](_0x42abe8[_0x43cb('0xb')],'id');}else{_0x8c2147[_0x46fa3a[_0x43cb('0xa3')]]=_0x42abe8['associatedResources'];}_0x5d2d66[_0x43cb('0x92')](_0x8c2147);}else{_0x2f9542[_0x43cb('0x9f')]['id']=_0x42abe8[_0x43cb('0xb')];}}else{for(var _0x194868=0x0;_0x194868<_0x1b984a[_0x43cb('0x8b')];_0x194868++){_0x46fa3a=_[_0x43cb('0x8d')](_0x3ed572,[_0x43cb('0xc'),_0x1b984a[_0x194868][_0x43cb('0xc')]]);if(_0x46fa3a[_0x43cb('0x4')]){_0x8c2147={};_0x8c2147[_0x46fa3a[_0x43cb('0xa3')]]=_0x1b984a[_0x194868]['associatedResources'];_0x5d2d66['push'](_0x8c2147);}else{if(!_0x2f9542[_0x43cb('0x9f')]['id'])_0x2f9542['where']['id']=[];_0x1b984a[_0x194868]['associatedResources'][_0x43cb('0xa4')](function(_0xb0dc4e){_0x2f9542[_0x43cb('0x9f')]['id'][_0x43cb('0x92')](_0xb0dc4e);});}}}if(!_[_0x43cb('0x8a')](_0x5d2d66)){_0x2f9542[_0x43cb('0x9f')]=_[_0x43cb('0xa0')](_0x2f9542['where'],{'$and':{'$or':_0x5d2d66}});}_0x2f9542=_['merge']({},_0x2f9542,_0x36660f[_0x43cb('0xa5')]);if(_0x42abe8&&!_0x42abe8['autoAssociation']&&_0x5ae25c[_0x43cb('0x11')]===_0x43cb('0xe')){if(_0x36660f[_0x43cb('0x86')][_0x43cb('0xa6')]){_0x2f9542[_0x43cb('0xa7')]=[{'all':!![]}];}return _0x3885af[_0x5ae25c[_0x43cb('0x11')]]['findAll'](_0x2f9542)[_0x43cb('0x6')](function(_0xb7da94){var _0x25db0c=[];_0xb7da94[_0x43cb('0xa4')](function(_0x2e6568){var _0x2c6368;switch(_0x2e6568[_0x43cb('0xa8')]){case'default':_0x2c6368=_[_0x43cb('0x8d')](_0x42abe8['associatedResources'],function(_0x2abefb){return _0x2abefb['id']===_0x2e6568[_0x43cb('0xa9')]&&_0x2abefb[_0x43cb('0x38')]===_0x43cb('0xaa');});break;case'custom':_0x2c6368=_[_0x43cb('0x8d')](_0x42abe8[_0x43cb('0xb')],function(_0x18580f){return _0x18580f['id']===_0x2e6568[_0x43cb('0xa9')]&&_0x18580f['type']==='CustomReports';});break;}if(_0x2c6368)_0x25db0c[_0x43cb('0x92')](_0x2e6568);});_0x20fc3a[_0x43cb('0xab')]=_0x25db0c[_0x43cb('0x8b')];_0x20fc3a[_0x43cb('0xac')]=_0x25db0c;return _0x20fc3a;});}else{return _0x3885af[_0x5ae25c[_0x43cb('0x11')]][_0x43cb('0xab')]({'where':_0x2f9542[_0x43cb('0x9f')]})[_0x43cb('0x6')](function(_0x254a7d){_0x20fc3a['count']=_0x254a7d;if(_0x36660f[_0x43cb('0x86')]['includeAll']){if(_0x5ae25c[_0x43cb('0x11')]==='CmContact'){_0x2f9542[_0x43cb('0xa7')]=[{'model':_0x3885af['Tag'],'as':_0x43cb('0xad'),'attributes':['id',_0x43cb('0xc'),'color'],'required':_0x36660f['query'][_0x43cb('0xae')]?!![]:![]},{'model':_0x3885af[_0x43cb('0xaf')],'as':_0x43cb('0xb0'),'attributes':['id',_0x43cb('0xc'),_0x43cb('0xb1')],'through':_0x36660f['query'][_0x43cb('0xae')]?{'attributes':[],'where':{'TagId':_0x36660f[_0x43cb('0x86')]['tag']||undefined}}:{},'required':_0x36660f['query'][_0x43cb('0xae')]?!![]:![]}];}else{_0x2f9542[_0x43cb('0xa7')]=[{'all':!![]}];}}return _0x3885af[_0x5ae25c[_0x43cb('0x11')]][_0x43cb('0xa')](_0x2f9542);})[_0x43cb('0x6')](function(_0x31b88b){_0x20fc3a['rows']=_0x31b88b;if(_0x63404e===_0x43cb('0x32')&&_0x36660f['query'][_0x43cb('0xb2')]===_0x43cb('0xb3')){var _0x43f1b8=[];for(var _0x409140=0x0;_0x409140<_0x20fc3a[_0x43cb('0xac')][_0x43cb('0x8b')];_0x409140++){_0x43f1b8[_0x43cb('0x92')](_0x56d5bb(_0x43cb('0xb4'),_0x20fc3a['rows'][_0x409140][_0x43cb('0xb5')]));_0x43f1b8[_0x43cb('0x92')](_0x56d5bb('sms',_0x20fc3a['rows'][_0x409140][_0x43cb('0xb5')]));_0x43f1b8[_0x43cb('0x92')](_0x56d5bb(_0x43cb('0xb6'),_0x20fc3a[_0x43cb('0xac')][_0x409140][_0x43cb('0xb5')]));_0x43f1b8[_0x43cb('0x92')](_0x56d5bb('mail',_0x20fc3a['rows'][_0x409140][_0x43cb('0xb5')]));_0x43f1b8[_0x43cb('0x92')](_0x56d5bb(_0x43cb('0xb7'),_0x20fc3a[_0x43cb('0xac')][_0x409140]['dataValues']));_0x43f1b8[_0x43cb('0x92')](_0x56d5bb('whatsapp',_0x20fc3a[_0x43cb('0xac')][_0x409140][_0x43cb('0xb5')]));}return Promise['all'](_0x43f1b8)['then'](function(){return _0x20fc3a;});}return _0x20fc3a;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 010fd9b..ceeae48 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 _0xcf98=['debug','error','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s'];(function(_0x43a3cb,_0x3ee2de){var _0x1fdc86=function(_0x887d2b){while(--_0x887d2b){_0x43a3cb['push'](_0x43a3cb['shift']());}};_0x1fdc86(++_0x3ee2de);}(_0xcf98,0x8d));var _0x8cf9=function(_0x349edb,_0x3dbda2){_0x349edb=_0x349edb-0x0;var _0x29b9c3=_0xcf98[_0x349edb];return _0x29b9c3;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var moment=require(_0x8cf9('0x1'));var BPromise=require(_0x8cf9('0x2'));var rs=require(_0x8cf9('0x3'));var fs=require('fs');var Redis=require(_0x8cf9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8cf9('0x5'))(_0x8cf9('0x6'));var config=require(_0x8cf9('0x7'));var jayson=require(_0x8cf9('0x8'));var client=jayson[_0x8cf9('0x9')][_0x8cf9('0xa')]({'port':0x232a});config[_0x8cf9('0xb')]=_[_0x8cf9('0xc')](config[_0x8cf9('0xb')],{'host':_0x8cf9('0xd'),'port':0x18eb});var socket=require(_0x8cf9('0xe'))(new Redis(config['redis']));require(_0x8cf9('0xf'))[_0x8cf9('0x10')](socket);function respondWithRpcPromise(_0x4f4ab3,_0xfe2da1,_0x5b9daa){return new BPromise(function(_0x23eb35,_0x432742){return client[_0x8cf9('0x11')](_0x4f4ab3,_0x5b9daa)[_0x8cf9('0x12')](function(_0x236fbd){logger[_0x8cf9('0x13')](_0x8cf9('0x14'),_0xfe2da1,'request\x20sent');logger[_0x8cf9('0x15')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xfe2da1,'request\x20sent',JSON['stringify'](_0x236fbd));if(_0x236fbd[_0x8cf9('0x16')]){if(_0x236fbd['error']['code']===0x1f4){logger[_0x8cf9('0x16')](_0x8cf9('0x14'),_0xfe2da1,_0x236fbd[_0x8cf9('0x16')]['message']);return _0x432742(_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);}logger['error'](_0x8cf9('0x14'),_0xfe2da1,_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);return _0x23eb35(_0x236fbd[_0x8cf9('0x16')][_0x8cf9('0x17')]);}else{logger[_0x8cf9('0x13')](_0x8cf9('0x14'),_0xfe2da1,_0x8cf9('0x18'));_0x23eb35(_0x236fbd[_0x8cf9('0x19')][_0x8cf9('0x17')]);}})[_0x8cf9('0x1a')](function(_0x2929ee){logger[_0x8cf9('0x16')](_0x8cf9('0x14'),_0xfe2da1,_0x2929ee);_0x432742(_0x2929ee);});});} \ No newline at end of file +var _0xfdbd=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x3257d4,_0x347ac3){var _0x55829f=function(_0x56583b){while(--_0x56583b){_0x3257d4['push'](_0x3257d4['shift']());}};_0x55829f(++_0x347ac3);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3776b4,_0x19a1e3){_0x3776b4=_0x3776b4-0x0;var _0x1636d9=_0xfdbd[_0x3776b4];return _0x1636d9;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var moment=require(_0xdfdb('0x2'));var BPromise=require(_0xdfdb('0x3'));var rs=require(_0xdfdb('0x4'));var fs=require('fs');var Redis=require(_0xdfdb('0x5'));var db=require(_0xdfdb('0x6'))['db'];var utils=require(_0xdfdb('0x7'));var logger=require(_0xdfdb('0x8'))('rpc');var config=require(_0xdfdb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdb('0xa')][_0xdfdb('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfdb('0xc'),'port':0x18eb});var socket=require(_0xdfdb('0xd'))(new Redis(config['redis']));require(_0xdfdb('0xe'))[_0xdfdb('0xf')](socket);function respondWithRpcPromise(_0x24eb73,_0x27ddcd,_0x3a44a9){return new BPromise(function(_0x1ace28,_0x2bb8d4){return client['request'](_0x24eb73,_0x3a44a9)[_0xdfdb('0x10')](function(_0x1972db){logger['info'](_0xdfdb('0x11'),_0x27ddcd,_0xdfdb('0x12'));logger[_0xdfdb('0x13')](_0xdfdb('0x14'),_0x27ddcd,_0xdfdb('0x12'),JSON[_0xdfdb('0x15')](_0x1972db));if(_0x1972db[_0xdfdb('0x16')]){if(_0x1972db[_0xdfdb('0x16')]['code']===0x1f4){logger['error'](_0xdfdb('0x11'),_0x27ddcd,_0x1972db['error'][_0xdfdb('0x17')]);return _0x2bb8d4(_0x1972db[_0xdfdb('0x16')][_0xdfdb('0x17')]);}logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0x1972db[_0xdfdb('0x16')]['message']);return _0x1ace28(_0x1972db['error'][_0xdfdb('0x17')]);}else{logger[_0xdfdb('0x18')](_0xdfdb('0x11'),_0x27ddcd,'request\x20sent');_0x1ace28(_0x1972db[_0xdfdb('0x19')][_0xdfdb('0x17')]);}})[_0xdfdb('0x1a')](function(_0xd60a30){logger[_0xdfdb('0x16')](_0xdfdb('0x11'),_0x27ddcd,_0xd60a30);_0x2bb8d4(_0xd60a30);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 7f5d7ca..f907e56 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 _0x3f8c=['register','length','userProfile:','./userProfile.events','remove','update','removeListener'];(function(_0x1f4c3d,_0xc19968){var _0x5ece80=function(_0x398745){while(--_0x398745){_0x1f4c3d['push'](_0x1f4c3d['shift']());}};_0x5ece80(++_0xc19968);}(_0x3f8c,0x137));var _0xc3f8=function(_0x1fe778,_0x1e3ac1){_0x1fe778=_0x1fe778-0x0;var _0x580801=_0x3f8c[_0x1fe778];return _0x580801;};'use strict';var UserProfileEvents=require(_0xc3f8('0x0'));var events=['save',_0xc3f8('0x1'),_0xc3f8('0x2')];function createListener(_0x1690a7,_0x37eded){return function(_0x40d593){_0x37eded['emit'](_0x1690a7,_0x40d593);};}function removeListener(_0x715a64,_0x1bbf5b){return function(){UserProfileEvents[_0xc3f8('0x3')](_0x715a64,_0x1bbf5b);};}exports[_0xc3f8('0x4')]=function(_0x5af43e){for(var _0x14db30=0x0,_0x547c40=events[_0xc3f8('0x5')];_0x14db30<_0x547c40;_0x14db30++){var _0x4c4184=events[_0x14db30];var _0x1303a2=createListener(_0xc3f8('0x6')+_0x4c4184,_0x5af43e);UserProfileEvents['on'](_0x4c4184,_0x1303a2);}}; \ No newline at end of file +var _0x47f2=['./userProfile.events','remove','update','removeListener','length','userProfile:'];(function(_0x12a39e,_0x3c6eb2){var _0x31b187=function(_0x6fb66c){while(--_0x6fb66c){_0x12a39e['push'](_0x12a39e['shift']());}};_0x31b187(++_0x3c6eb2);}(_0x47f2,0x66));var _0x247f=function(_0x1f5aad,_0x55b087){_0x1f5aad=_0x1f5aad-0x0;var _0x18d683=_0x47f2[_0x1f5aad];return _0x18d683;};'use strict';var UserProfileEvents=require(_0x247f('0x0'));var events=['save',_0x247f('0x1'),_0x247f('0x2')];function createListener(_0x4cfd2d,_0x3aec6c){return function(_0x5897ff){_0x3aec6c['emit'](_0x4cfd2d,_0x5897ff);};}function removeListener(_0x52a323,_0x5af4dd){return function(){UserProfileEvents[_0x247f('0x3')](_0x52a323,_0x5af4dd);};}exports['register']=function(_0x2573bc){for(var _0xa4e659=0x0,_0x510f14=events[_0x247f('0x4')];_0xa4e659<_0x510f14;_0xa4e659++){var _0xd3a043=events[_0xa4e659];var _0x59e76c=createListener(_0x247f('0x5')+_0xd3a043,_0x2573bc);UserProfileEvents['on'](_0xd3a043,_0x59e76c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 475db57..cb6fb20 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 _0x0a70=['index','/describe','/:id','show','post','create','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated'];(function(_0x54332e,_0x286092){var _0x44d685=function(_0x17a296){while(--_0x17a296){_0x54332e['push'](_0x54332e['shift']());}};_0x44d685(++_0x286092);}(_0x0a70,0x13a));var _0x00a7=function(_0x4cd62c,_0x2f8b2d){_0x4cd62c=_0x4cd62c-0x0;var _0x435475=_0x0a70[_0x4cd62c];return _0x435475;};'use strict';var multer=require('multer');var util=require(_0x00a7('0x0'));var path=require(_0x00a7('0x1'));var timeout=require(_0x00a7('0x2'));var express=require('express');var router=express[_0x00a7('0x3')]();var fs_extra=require(_0x00a7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x00a7('0x5'));var config=require(_0x00a7('0x6'));var controller=require(_0x00a7('0x7'));router[_0x00a7('0x8')]('/',auth[_0x00a7('0x9')](),controller[_0x00a7('0xa')]);router[_0x00a7('0x8')](_0x00a7('0xb'),auth[_0x00a7('0x9')](),controller['describe']);router[_0x00a7('0x8')](_0x00a7('0xc'),auth[_0x00a7('0x9')](),controller[_0x00a7('0xd')]);router[_0x00a7('0xe')]('/',auth['isAuthenticated'](),controller[_0x00a7('0xf')]);router['put'](_0x00a7('0xc'),auth[_0x00a7('0x9')](),controller[_0x00a7('0x10')]);router[_0x00a7('0x11')](_0x00a7('0xc'),auth[_0x00a7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x851e=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer'];(function(_0x19bf84,_0x577081){var _0x39a51a=function(_0x4116ff){while(--_0x4116ff){_0x19bf84['push'](_0x19bf84['shift']());}};_0x39a51a(++_0x577081);}(_0x851e,0xfb));var _0xe851=function(_0x32ee61,_0x3f1b2d){_0x32ee61=_0x32ee61-0x0;var _0x226c2f=_0x851e[_0x32ee61];return _0x226c2f;};'use strict';var multer=require(_0xe851('0x0'));var util=require(_0xe851('0x1'));var path=require('path');var timeout=require(_0xe851('0x2'));var express=require(_0xe851('0x3'));var router=express[_0xe851('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe851('0x5'));var interaction=require(_0xe851('0x6'));var config=require('../../config/environment');var controller=require(_0xe851('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe851('0x8')](_0xe851('0x9'),auth[_0xe851('0xa')](),controller[_0xe851('0xb')]);router[_0xe851('0x8')](_0xe851('0xc'),auth[_0xe851('0xa')](),controller[_0xe851('0xd')]);router[_0xe851('0xe')]('/',auth[_0xe851('0xa')](),controller['create']);router['put'](_0xe851('0xc'),auth['isAuthenticated'](),controller[_0xe851('0xf')]);router['delete']('/:id',auth[_0xe851('0xa')](),controller[_0xe851('0x10')]);module[_0xe851('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4055560..b7825a6 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 _0x27e6=['sequelize','STRING','INTEGER'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x27e6,0x10b));var _0x627e=function(_0x1efd14,_0x47cecd){_0x1efd14=_0x1efd14-0x0;var _0x4ec46a=_0x27e6[_0x1efd14];return _0x4ec46a;};'use strict';var Sequelize=require(_0x627e('0x0'));module['exports']={'name':{'type':Sequelize[_0x627e('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x627e('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x6f2d=['INTEGER','sequelize','exports','STRING'];(function(_0x4068da,_0x39cfca){var _0x4231bf=function(_0x17c07d){while(--_0x17c07d){_0x4068da['push'](_0x4068da['shift']());}};_0x4231bf(++_0x39cfca);}(_0x6f2d,0xa1));var _0xd6f2=function(_0x5a13b7,_0x58b8cd){_0x5a13b7=_0x5a13b7-0x0;var _0x3a928d=_0x6f2d[_0x5a13b7];return _0x3a928d;};'use strict';var Sequelize=require(_0xd6f2('0x0'));module[_0xd6f2('0x1')]={'name':{'type':Sequelize[_0xd6f2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xd6f2('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xd6f2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index e808d01..18755d0 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 _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x19641c,_0x476fb3){var _0x4e634a=function(_0x555063){while(--_0x555063){_0x19641c['push'](_0x19641c['shift']());}};_0x4e634a(++_0x476fb3);}(_0x7096,0x10c));var _0x6709=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x7096[_0x543084];return _0x306a57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file +var _0xdb28=['index','UserProfileResource','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','body','describe','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'];(function(_0x332d04,_0x969e42){var _0x1661f6=function(_0x5431b0){while(--_0x5431b0){_0x332d04['push'](_0x332d04['shift']());}};_0x1661f6(++_0x969e42);}(_0xdb28,0x106));var _0x8db2=function(_0x4e2260,_0x13e869){_0x4e2260=_0x4e2260-0x0;var _0x3fd5ea=_0xdb28[_0x4e2260];return _0x3fd5ea;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'all':!![]}];}return db[_0x8db2('0x2b')][_0x8db2('0x40')](_0x21bae5);})['then'](function(_0x49a7ae){_0x3124d5[_0x8db2('0x41')]=_0x49a7ae;return _0x3124d5;})['then'](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x42')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x43')]=function(_0x313130,_0x307783){var _0xb4fe2c={'raw':![],'where':{'id':_0x313130[_0x8db2('0x44')]['id']}},_0x30d606={};_0x30d606['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x45')]);_0x30d606[_0x8db2('0x30')]=_['keys'](_0x313130[_0x8db2('0x30')]);_0x30d606[_0x8db2('0x39')]=_[_0x8db2('0x46')](_0x30d606[_0x8db2('0x32')],_0x30d606['query']);_0xb4fe2c[_0x8db2('0x34')]=_['intersection'](_0x30d606[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x313130[_0x8db2('0x30')]['fields']));_0xb4fe2c['attributes']=_0xb4fe2c[_0x8db2('0x34')]['length']?_0xb4fe2c[_0x8db2('0x34')]:_0x30d606[_0x8db2('0x32')];if(_0x313130[_0x8db2('0x30')][_0x8db2('0x3f')]){_0xb4fe2c[_0x8db2('0x47')]=[{'all':!![]}];}_0xb4fe2c=_[_0x8db2('0x3d')]({},_0xb4fe2c,_0x313130[_0x8db2('0x3e')]);return db[_0x8db2('0x2b')][_0x8db2('0x48')](_0xb4fe2c)[_0x8db2('0x24')](handleEntityNotFound(_0x307783,null))[_0x8db2('0x24')](respondWithResult(_0x307783,null))[_0x8db2('0x42')](handleError(_0x307783,null));};exports['create']=function(_0x449109,_0x2ada52){return db[_0x8db2('0x2b')][_0x8db2('0x49')](_0x449109['body'],{})['then'](respondWithResult(_0x2ada52,0xc9))[_0x8db2('0x42')](handleError(_0x2ada52,null));};exports[_0x8db2('0x23')]=function(_0x164020,_0x4c66e5){if(_0x164020['body']['id']){delete _0x164020['body']['id'];}return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x164020[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x4c66e5,null))[_0x8db2('0x24')](saveUpdates(_0x164020[_0x8db2('0x4a')],null))[_0x8db2('0x24')](respondWithResult(_0x4c66e5,null))['catch'](handleError(_0x4c66e5,null));};exports['destroy']=function(_0x3d29bc,_0x18c6ef){return db[_0x8db2('0x2b')][_0x8db2('0x48')]({'where':{'id':_0x3d29bc[_0x8db2('0x44')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x18c6ef,null))[_0x8db2('0x24')](removeEntity(_0x18c6ef,null))[_0x8db2('0x42')](handleError(_0x18c6ef,null));};exports[_0x8db2('0x4b')]=function(_0x426ae0,_0x3bc632){return db[_0x8db2('0x2b')][_0x8db2('0x4b')]()[_0x8db2('0x24')](respondWithResult(_0x3bc632,null))[_0x8db2('0x42')](handleError(_0x3bc632,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a6b9a53..f006bd1 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 _0x9c67=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c67,0x19a));var _0x79c6=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0x9c67[_0x52e0ee];return _0x32534c;};'use strict';var _=require('lodash');var util=require(_0x79c6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x79c6('0x1'));var BPromise=require('bluebird');var rp=require(_0x79c6('0x2'));var fs=require('fs');var path=require(_0x79c6('0x3'));var rimraf=require(_0x79c6('0x4'));var config=require(_0x79c6('0x5'));var attributes=require(_0x79c6('0x6'));module[_0x79c6('0x7')]=function(_0x11c58f,_0x381ee1){return _0x11c58f[_0x79c6('0x8')](_0x79c6('0x9'),attributes,{'tableName':_0x79c6('0xa'),'paranoid':![],'indexes':[{'name':_0x79c6('0xb'),'fields':[_0x79c6('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d7b=['resourceId','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex'];(function(_0x476e56,_0x2540ea){var _0x345fff=function(_0x527c8c){while(--_0x527c8c){_0x476e56['push'](_0x476e56['shift']());}};_0x345fff(++_0x2540ea);}(_0x4d7b,0x9d));var _0xb4d7=function(_0x345015,_0x58e33b){_0x345015=_0x345015-0x0;var _0x5bf363=_0x4d7b[_0x345015];return _0x5bf363;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb4d7('0x0'))(_0xb4d7('0x1'));var moment=require(_0xb4d7('0x2'));var BPromise=require(_0xb4d7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4d7('0x4'));var rimraf=require(_0xb4d7('0x5'));var config=require(_0xb4d7('0x6'));var attributes=require(_0xb4d7('0x7'));module['exports']=function(_0x5a7230,_0x392f31){return _0x5a7230['define'](_0xb4d7('0x8'),attributes,{'tableName':_0xb4d7('0x9'),'paranoid':![],'indexes':[{'name':_0xb4d7('0xa'),'fields':[_0xb4d7('0xb'),'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 e5e5a2d..6e422cd 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 _0x0958=['request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x1a7a81,_0x451dd9){var _0x4a5e69=function(_0x1aeefe){while(--_0x1aeefe){_0x1a7a81['push'](_0x1a7a81['shift']());}};_0x4a5e69(++_0x451dd9);}(_0x0958,0x95));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var moment=require(_0x8095('0x2'));var BPromise=require(_0x8095('0x3'));var rs=require(_0x8095('0x4'));var fs=require('fs');var Redis=require(_0x8095('0x5'));var db=require(_0x8095('0x6'))['db'];var utils=require(_0x8095('0x7'));var logger=require(_0x8095('0x8'))('rpc');var config=require(_0x8095('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8095('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225929,_0x306633,_0x1a8286){return new BPromise(function(_0x241b31,_0x267f5e){return client[_0x8095('0xb')](_0x225929,_0x1a8286)['then'](function(_0x284a64){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x306633,_0x8095('0xc'));logger[_0x8095('0xd')](_0x8095('0xe'),_0x306633,_0x8095('0xc'),JSON[_0x8095('0xf')](_0x284a64));if(_0x284a64[_0x8095('0x10')]){if(_0x284a64[_0x8095('0x10')][_0x8095('0x11')]===0x1f4){logger[_0x8095('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x306633,_0x284a64['error'][_0x8095('0x12')]);return _0x267f5e(_0x284a64[_0x8095('0x10')]['message']);}logger['error'](_0x8095('0x13'),_0x306633,_0x284a64[_0x8095('0x10')][_0x8095('0x12')]);return _0x241b31(_0x284a64[_0x8095('0x10')]['message']);}else{logger[_0x8095('0x14')](_0x8095('0x13'),_0x306633,'request\x20sent');_0x241b31(_0x284a64[_0x8095('0x15')][_0x8095('0x12')]);}})[_0x8095('0x16')](function(_0xdc6e12){logger[_0x8095('0x10')](_0x8095('0x13'),_0x306633,_0xdc6e12);_0x267f5e(_0xdc6e12);});});} \ No newline at end of file +var _0x9f84=['../../config/utils','../../config/logger','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f84,0x112));var _0x49f8=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0x9f84[_0x256cc1];return _0x330d0a;};'use strict';var _=require(_0x49f8('0x0'));var util=require(_0x49f8('0x1'));var moment=require(_0x49f8('0x2'));var BPromise=require('bluebird');var rs=require(_0x49f8('0x3'));var fs=require('fs');var Redis=require(_0x49f8('0x4'));var db=require(_0x49f8('0x5'))['db'];var utils=require(_0x49f8('0x6'));var logger=require(_0x49f8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x49f8('0x8'));var client=jayson['client'][_0x49f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x582049,_0x11a906,_0x44e76f){return new BPromise(function(_0x1f3950,_0x21a0a8){return client[_0x49f8('0xa')](_0x582049,_0x44e76f)['then'](function(_0xf7063c){logger[_0x49f8('0xb')](_0x49f8('0xc'),_0x11a906,_0x49f8('0xd'));logger['debug'](_0x49f8('0xe'),_0x11a906,_0x49f8('0xd'),JSON[_0x49f8('0xf')](_0xf7063c));if(_0xf7063c[_0x49f8('0x10')]){if(_0xf7063c[_0x49f8('0x10')]['code']===0x1f4){logger[_0x49f8('0x10')](_0x49f8('0xc'),_0x11a906,_0xf7063c[_0x49f8('0x10')][_0x49f8('0x11')]);return _0x21a0a8(_0xf7063c['error'][_0x49f8('0x11')]);}logger[_0x49f8('0x10')](_0x49f8('0xc'),_0x11a906,_0xf7063c[_0x49f8('0x10')][_0x49f8('0x11')]);return _0x1f3950(_0xf7063c['error']['message']);}else{logger[_0x49f8('0xb')](_0x49f8('0xc'),_0x11a906,_0x49f8('0xd'));_0x1f3950(_0xf7063c[_0x49f8('0x12')][_0x49f8('0x11')]);}})[_0x49f8('0x13')](function(_0x1c2b95){logger[_0x49f8('0x10')](_0x49f8('0xc'),_0x11a906,_0x1c2b95);_0x21a0a8(_0x1c2b95);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 9e9bee2..d29b2ae 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 _0x05ad=['destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete'];(function(_0x594310,_0x4dc24b){var _0x269477=function(_0x5e628b){while(--_0x5e628b){_0x594310['push'](_0x594310['shift']());}};_0x269477(++_0x4dc24b);}(_0x05ad,0x17e));var _0xd05a=function(_0x5ecddb,_0x38dadf){_0x5ecddb=_0x5ecddb-0x0;var _0x2a9cde=_0x05ad[_0x5ecddb];return _0x2a9cde;};'use strict';var multer=require(_0xd05a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd05a('0x1'));var router=express['Router']();var fs_extra=require(_0xd05a('0x2'));var auth=require(_0xd05a('0x3'));var interaction=require(_0xd05a('0x4'));var config=require(_0xd05a('0x5'));var controller=require(_0xd05a('0x6'));router[_0xd05a('0x7')]('/',auth[_0xd05a('0x8')](),controller[_0xd05a('0x9')]);router[_0xd05a('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd05a('0xa')]);router[_0xd05a('0x7')](_0xd05a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd05a('0xc')]('/',auth['isAuthenticated'](),controller[_0xd05a('0xd')]);router[_0xd05a('0xe')](_0xd05a('0xb'),auth['isAuthenticated'](),controller[_0xd05a('0xf')]);router[_0xd05a('0x10')](_0xd05a('0xb'),auth[_0xd05a('0x8')](),controller[_0xd05a('0x11')]);module[_0xd05a('0x12')]=router; \ No newline at end of file +var _0xe565=['./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0xe565,0x1bc));var _0x5e56=function(_0x356b49,_0x16c9a8){_0x356b49=_0x356b49-0x0;var _0x298116=_0xe565[_0x356b49];return _0x298116;};'use strict';var multer=require(_0x5e56('0x0'));var util=require(_0x5e56('0x1'));var path=require('path');var timeout=require(_0x5e56('0x2'));var express=require(_0x5e56('0x3'));var router=express[_0x5e56('0x4')]();var fs_extra=require(_0x5e56('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5e56('0x6'));router[_0x5e56('0x7')]('/',auth[_0x5e56('0x8')](),controller['index']);router[_0x5e56('0x7')](_0x5e56('0x9'),auth[_0x5e56('0x8')](),controller[_0x5e56('0xa')]);router[_0x5e56('0x7')](_0x5e56('0xb'),auth[_0x5e56('0x8')](),controller['show']);router[_0x5e56('0xc')]('/',auth[_0x5e56('0x8')](),controller[_0x5e56('0xd')]);router[_0x5e56('0xe')]('/:id',auth[_0x5e56('0x8')](),controller[_0x5e56('0xf')]);router['delete'](_0x5e56('0xb'),auth['isAuthenticated'](),controller[_0x5e56('0x10')]);module[_0x5e56('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 50fdfb6..0467d1e 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 _0x34b7=['BOOLEAN','crudPermissions','join','getDataValue','STRING','INTEGER'];(function(_0x37e307,_0x378e6c){var _0x44a38c=function(_0x278dce){while(--_0x278dce){_0x37e307['push'](_0x37e307['shift']());}};_0x44a38c(++_0x378e6c);}(_0x34b7,0x196));var _0x734b=function(_0x4b5bab,_0x1d73d4){_0x4b5bab=_0x4b5bab-0x0;var _0x5abd6b=_0x34b7[_0x4b5bab];return _0x5abd6b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x734b('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x734b('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x734b('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x734b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x734b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x734b('0x0')],'set':function(_0x5de1ae){this['setDataValue'](_0x734b('0x3'),_0x5de1ae?_0x5de1ae[_0x734b('0x4')](''):[]);},'get':function(){return this[_0x734b('0x5')](_0x734b('0x3'))?this[_0x734b('0x5')](_0x734b('0x3'))['split'](''):[];}}}; \ No newline at end of file +var _0xac4a=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4a639f,_0x561ac2){var _0x461cdf=function(_0x1a7bfb){while(--_0x1a7bfb){_0x4a639f['push'](_0x4a639f['shift']());}};_0x461cdf(++_0x561ac2);}(_0xac4a,0x13f));var _0xaac4=function(_0x4e26ed,_0x2f02bc){_0x4e26ed=_0x4e26ed-0x0;var _0x14f00b=_0xac4a[_0x4e26ed];return _0x14f00b;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'name':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xaac4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xaac4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xaac4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2af0f6){this[_0xaac4('0x5')](_0xaac4('0x6'),_0x2af0f6?_0x2af0f6['join'](''):[]);},'get':function(){return this[_0xaac4('0x7')]('crudPermissions')?this[_0xaac4('0x7')]('crudPermissions')[_0xaac4('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index e15cafe..671cd05 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 _0x2a7d=['where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','describe','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x52a5e1,_0x1618eb){var _0x37ca56=function(_0x1613fb){while(--_0x1613fb){_0x52a5e1['push'](_0x52a5e1['shift']());}};_0x37ca56(++_0x1618eb);}(_0x2a7d,0x179));var _0xd2a7=function(_0x4ca392,_0x27f0e3){_0x4ca392=_0x4ca392-0x0;var _0x20486a=_0x2a7d[_0x4ca392];return _0x20486a;};'use strict';var emlformat=require(_0xd2a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd2a7('0x1'));var BPromise=require(_0xd2a7('0x2'));var Mustache=require(_0xd2a7('0x3'));var util=require(_0xd2a7('0x4'));var path=require(_0xd2a7('0x5'));var sox=require(_0xd2a7('0x6'));var csv=require(_0xd2a7('0x7'));var ejs=require(_0xd2a7('0x8'));var fs=require('fs');var fs_extra=require(_0xd2a7('0x9'));var _=require(_0xd2a7('0xa'));var squel=require(_0xd2a7('0xb'));var crypto=require(_0xd2a7('0xc'));var jsforce=require(_0xd2a7('0xd'));var deskjs=require(_0xd2a7('0xe'));var toCsv=require(_0xd2a7('0x7'));var querystring=require(_0xd2a7('0xf'));var Papa=require(_0xd2a7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd2a7('0x11'));var hardwareService=require(_0xd2a7('0x12'));var logger=require(_0xd2a7('0x13'))(_0xd2a7('0x14'));var utils=require(_0xd2a7('0x15'));var config=require(_0xd2a7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a63cd,_0x104753){_0x104753=_0x104753||0xcc;return function(_0x488f56){if(_0x488f56){return _0x1a63cd['sendStatus'](_0x104753);}return _0x1a63cd[_0xd2a7('0x17')](_0x104753)[_0xd2a7('0x18')]();};}function respondWithResult(_0x27ef7f,_0xb34d6a){_0xb34d6a=_0xb34d6a||0xc8;return function(_0x20fe64){if(_0x20fe64){return _0x27ef7f['status'](_0xb34d6a)[_0xd2a7('0x19')](_0x20fe64);}};}function respondWithFilteredResult(_0x5d306d,_0x2162dd){return function(_0x2d446c){if(_0x2d446c){var _0x4e428c=typeof _0x2162dd[_0xd2a7('0x1a')]===_0xd2a7('0x1b')&&typeof _0x2162dd[_0xd2a7('0x1c')]===_0xd2a7('0x1b');var _0x2710d5=_0x2d446c[_0xd2a7('0x1d')];var _0x111084=_0x4e428c?0x0:_0x2162dd[_0xd2a7('0x1a')];var _0x28864d=_0x4e428c?_0x2d446c['count']:_0x2162dd[_0xd2a7('0x1a')]+_0x2162dd['limit'];var _0xddacd0;if(_0x28864d>=_0x2710d5){_0x28864d=_0x2710d5;_0xddacd0=0xc8;}else{_0xddacd0=0xce;}_0x5d306d[_0xd2a7('0x17')](_0xddacd0);return _0x5d306d[_0xd2a7('0x1e')](_0xd2a7('0x1f'),_0x111084+'-'+_0x28864d+'/'+_0x2710d5)[_0xd2a7('0x19')](_0x2d446c);}return null;};}function patchUpdates(_0x1e7dc0){return function(_0x3c266d){try{jsonpatch[_0xd2a7('0x20')](_0x3c266d,_0x1e7dc0,!![]);}catch(_0xf8c0e1){return BPromise['reject'](_0xf8c0e1);}return _0x3c266d['save']();};}function saveUpdates(_0x15a67e,_0x515314){return function(_0x554937){if(_0x554937){return _0x554937[_0xd2a7('0x21')](_0x15a67e)[_0xd2a7('0x22')](function(_0x514b36){return _0x514b36;});}return null;};}function removeEntity(_0x4063a8,_0x5c5a4a){return function(_0x4c9acf){if(_0x4c9acf){return _0x4c9acf[_0xd2a7('0x23')]()[_0xd2a7('0x22')](function(){_0x4063a8[_0xd2a7('0x17')](0xcc)[_0xd2a7('0x18')]();});}};}function handleEntityNotFound(_0x53dd9a,_0x2ec365){return function(_0x473ac3){if(!_0x473ac3){_0x53dd9a[_0xd2a7('0x24')](0x194);}return _0x473ac3;};}function handleError(_0x85d042,_0xc3396c){_0xc3396c=_0xc3396c||0x1f4;return function(_0x5bb8c3){logger[_0xd2a7('0x25')](_0x5bb8c3['stack']);if(_0x5bb8c3[_0xd2a7('0x26')]){delete _0x5bb8c3['name'];}_0x85d042[_0xd2a7('0x17')](_0xc3396c)[_0xd2a7('0x27')](_0x5bb8c3);};}exports['index']=function(_0x3679f,_0x939cc){var _0x1d04bc={},_0x4b7560={},_0x15da30={'count':0x0,'rows':[]};var _0x22503f=_[_0xd2a7('0x28')](db[_0xd2a7('0x29')][_0xd2a7('0x2a')],function(_0xf724b0){return{'name':_0xf724b0[_0xd2a7('0x2b')],'type':_0xf724b0[_0xd2a7('0x2c')][_0xd2a7('0x2d')]};});_0x4b7560[_0xd2a7('0x2e')]=_[_0xd2a7('0x28')](_0x22503f,_0xd2a7('0x26'));_0x4b7560[_0xd2a7('0x2f')]=_['keys'](_0x3679f[_0xd2a7('0x2f')]);_0x4b7560[_0xd2a7('0x30')]=_[_0xd2a7('0x31')](_0x4b7560[_0xd2a7('0x2e')],_0x4b7560['query']);_0x1d04bc[_0xd2a7('0x32')]=_[_0xd2a7('0x31')](_0x4b7560[_0xd2a7('0x2e')],qs[_0xd2a7('0x33')](_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x33')]));_0x1d04bc[_0xd2a7('0x32')]=_0x1d04bc[_0xd2a7('0x32')]['length']?_0x1d04bc[_0xd2a7('0x32')]:_0x4b7560[_0xd2a7('0x2e')];if(!_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x34')]('nolimit')){_0x1d04bc['limit']=qs[_0xd2a7('0x1c')](_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x1c')]);_0x1d04bc[_0xd2a7('0x1a')]=qs['offset'](_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x1a')]);}_0x1d04bc[_0xd2a7('0x35')]=qs['sort'](_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x36')]);_0x1d04bc[_0xd2a7('0x37')]=qs['filters'](_[_0xd2a7('0x38')](_0x3679f[_0xd2a7('0x2f')],_0x4b7560[_0xd2a7('0x30')]),_0x22503f);if(_0x3679f[_0xd2a7('0x2f')][_0xd2a7('0x39')]){_0x1d04bc['where']=_[_0xd2a7('0x3a')](_0x1d04bc[_0xd2a7('0x37')],{'$or':_[_0xd2a7('0x28')](_0x22503f,function(_0x342016){if(_0x342016[_0xd2a7('0x2c')]!=='VIRTUAL'){var _0xef05dd={};_0xef05dd[_0x342016['name']]={'$like':'%'+_0x3679f['query'][_0xd2a7('0x39')]+'%'};return _0xef05dd;}})});}_0x1d04bc=_[_0xd2a7('0x3a')]({},_0x1d04bc,_0x3679f[_0xd2a7('0x3b')]);var _0x13beab={'where':_0x1d04bc[_0xd2a7('0x37')]};return db[_0xd2a7('0x29')]['count'](_0x13beab)[_0xd2a7('0x22')](function(_0xa09c9c){_0x15da30['count']=_0xa09c9c;if(_0x3679f['query'][_0xd2a7('0x3c')]){_0x1d04bc[_0xd2a7('0x3d')]=[{'all':!![]}];}return db[_0xd2a7('0x29')][_0xd2a7('0x3e')](_0x1d04bc);})[_0xd2a7('0x22')](function(_0xbd0156){_0x15da30['rows']=_0xbd0156;return _0x15da30;})[_0xd2a7('0x22')](respondWithFilteredResult(_0x939cc,_0x1d04bc))[_0xd2a7('0x3f')](handleError(_0x939cc,null));};exports[_0xd2a7('0x40')]=function(_0x243705,_0x3e1436){var _0x760655={'raw':![],'where':{'id':_0x243705[_0xd2a7('0x41')]['id']}},_0x1e50dc={};_0x1e50dc['model']=_[_0xd2a7('0x42')](db['UserProfileSection'][_0xd2a7('0x2a')]);_0x1e50dc[_0xd2a7('0x2f')]=_['keys'](_0x243705[_0xd2a7('0x2f')]);_0x1e50dc['filters']=_[_0xd2a7('0x31')](_0x1e50dc[_0xd2a7('0x2e')],_0x1e50dc[_0xd2a7('0x2f')]);_0x760655[_0xd2a7('0x32')]=_['intersection'](_0x1e50dc['model'],qs[_0xd2a7('0x33')](_0x243705['query'][_0xd2a7('0x33')]));_0x760655['attributes']=_0x760655['attributes'][_0xd2a7('0x43')]?_0x760655[_0xd2a7('0x32')]:_0x1e50dc['model'];if(_0x243705[_0xd2a7('0x2f')][_0xd2a7('0x3c')]){_0x760655['include']=[{'all':!![]}];}_0x760655=_[_0xd2a7('0x3a')]({},_0x760655,_0x243705[_0xd2a7('0x3b')]);return db[_0xd2a7('0x29')][_0xd2a7('0x44')](_0x760655)[_0xd2a7('0x22')](handleEntityNotFound(_0x3e1436,null))['then'](respondWithResult(_0x3e1436,null))[_0xd2a7('0x3f')](handleError(_0x3e1436,null));};exports[_0xd2a7('0x45')]=function(_0xc64463,_0x114e5d){return db[_0xd2a7('0x29')]['create'](_0xc64463['body'],{})['then'](respondWithResult(_0x114e5d,0xc9))[_0xd2a7('0x3f')](handleError(_0x114e5d,null));};exports[_0xd2a7('0x21')]=function(_0x4ea1de,_0x36b0d9){if(_0x4ea1de['body']['id']){delete _0x4ea1de[_0xd2a7('0x46')]['id'];}return db[_0xd2a7('0x29')][_0xd2a7('0x44')]({'where':{'id':_0x4ea1de[_0xd2a7('0x41')]['id']}})[_0xd2a7('0x22')](handleEntityNotFound(_0x36b0d9,null))['then'](saveUpdates(_0x4ea1de[_0xd2a7('0x46')],null))[_0xd2a7('0x22')](respondWithResult(_0x36b0d9,null))['catch'](handleError(_0x36b0d9,null));};exports['destroy']=function(_0x5df3e6,_0x4c060c){return db[_0xd2a7('0x29')][_0xd2a7('0x44')]({'where':{'id':_0x5df3e6[_0xd2a7('0x41')]['id']}})[_0xd2a7('0x22')](handleEntityNotFound(_0x4c060c,null))[_0xd2a7('0x22')](removeEntity(_0x4c060c,null))[_0xd2a7('0x3f')](handleError(_0x4c060c,null));};exports[_0xd2a7('0x47')]=function(_0x193d6d,_0x1bfa50){return db[_0xd2a7('0x29')]['describe']()['then'](respondWithResult(_0x1bfa50,null))[_0xd2a7('0x3f')](handleError(_0x1bfa50,null));}; \ No newline at end of file +var _0xb677=['describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','UserProfileSection','includeAll','include','rows','catch','params','keys','fields','merge','find','create','body'];(function(_0x1b9adf,_0x181cc1){var _0x40d181=function(_0x1b5a96){while(--_0x1b5a96){_0x1b9adf['push'](_0x1b9adf['shift']());}};_0x40d181(++_0x181cc1);}(_0xb677,0xdc));var _0x7b67=function(_0x36fb6e,_0x2d6b6f){_0x36fb6e=_0x36fb6e-0x0;var _0x399edd=_0xb677[_0x36fb6e];return _0x399edd;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require(_0x7b67('0x1'));var zipdir=require(_0x7b67('0x2'));var jsonpatch=require(_0x7b67('0x3'));var rp=require('request-promise');var moment=require(_0x7b67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7b67('0x5'));var util=require(_0x7b67('0x6'));var path=require(_0x7b67('0x7'));var sox=require(_0x7b67('0x8'));var csv=require(_0x7b67('0x9'));var ejs=require(_0x7b67('0xa'));var fs=require('fs');var fs_extra=require(_0x7b67('0xb'));var _=require('lodash');var squel=require(_0x7b67('0xc'));var crypto=require(_0x7b67('0xd'));var jsforce=require(_0x7b67('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7b67('0xf'));var authService=require(_0x7b67('0x10'));var qs=require(_0x7b67('0x11'));var as=require(_0x7b67('0x12'));var hardwareService=require(_0x7b67('0x13'));var logger=require('../../config/logger')(_0x7b67('0x14'));var utils=require(_0x7b67('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b67('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38cc9f,_0x2dce1d){_0x2dce1d=_0x2dce1d||0xcc;return function(_0x3de431){if(_0x3de431){return _0x38cc9f[_0x7b67('0x17')](_0x2dce1d);}return _0x38cc9f[_0x7b67('0x18')](_0x2dce1d)[_0x7b67('0x19')]();};}function respondWithResult(_0x5a7221,_0x584395){_0x584395=_0x584395||0xc8;return function(_0x52c0f2){if(_0x52c0f2){return _0x5a7221['status'](_0x584395)[_0x7b67('0x1a')](_0x52c0f2);}};}function respondWithFilteredResult(_0x45b765,_0x74a73e){return function(_0x2fb3f3){if(_0x2fb3f3){var _0x564ee4=typeof _0x74a73e['offset']===_0x7b67('0x1b')&&typeof _0x74a73e['limit']===_0x7b67('0x1b');var _0x5aa9cf=_0x2fb3f3[_0x7b67('0x1c')];var _0x2f8daa=_0x564ee4?0x0:_0x74a73e[_0x7b67('0x1d')];var _0x5cd897=_0x564ee4?_0x2fb3f3[_0x7b67('0x1c')]:_0x74a73e[_0x7b67('0x1d')]+_0x74a73e[_0x7b67('0x1e')];var _0x5d35bd;if(_0x5cd897>=_0x5aa9cf){_0x5cd897=_0x5aa9cf;_0x5d35bd=0xc8;}else{_0x5d35bd=0xce;}_0x45b765['status'](_0x5d35bd);return _0x45b765[_0x7b67('0x1f')]('Content-Range',_0x2f8daa+'-'+_0x5cd897+'/'+_0x5aa9cf)[_0x7b67('0x1a')](_0x2fb3f3);}return null;};}function patchUpdates(_0x3ccb68){return function(_0x41aef5){try{jsonpatch[_0x7b67('0x20')](_0x41aef5,_0x3ccb68,!![]);}catch(_0x116507){return BPromise['reject'](_0x116507);}return _0x41aef5[_0x7b67('0x21')]();};}function saveUpdates(_0x368e67,_0x5abf1d){return function(_0xdae630){if(_0xdae630){return _0xdae630[_0x7b67('0x22')](_0x368e67)[_0x7b67('0x23')](function(_0x3c0418){return _0x3c0418;});}return null;};}function removeEntity(_0x1b1e32,_0x54cfb9){return function(_0x5111e1){if(_0x5111e1){return _0x5111e1[_0x7b67('0x24')]()[_0x7b67('0x23')](function(){_0x1b1e32[_0x7b67('0x18')](0xcc)[_0x7b67('0x19')]();});}};}function handleEntityNotFound(_0x32e3a9,_0x9e2b9a){return function(_0x1e23c2){if(!_0x1e23c2){_0x32e3a9['sendStatus'](0x194);}return _0x1e23c2;};}function handleError(_0x47d917,_0x68e677){_0x68e677=_0x68e677||0x1f4;return function(_0x47838e){logger[_0x7b67('0x25')](_0x47838e[_0x7b67('0x26')]);if(_0x47838e[_0x7b67('0x27')]){delete _0x47838e['name'];}_0x47d917['status'](_0x68e677)['send'](_0x47838e);};}exports[_0x7b67('0x28')]=function(_0xac7e3a,_0x3f326b){var _0x1a1a92={},_0x2763be={},_0x40c165={'count':0x0,'rows':[]};var _0x15d244=_[_0x7b67('0x29')](db['UserProfileSection'][_0x7b67('0x2a')],function(_0x820dc7){return{'name':_0x820dc7[_0x7b67('0x2b')],'type':_0x820dc7[_0x7b67('0x2c')]['key']};});_0x2763be[_0x7b67('0x2d')]=_[_0x7b67('0x29')](_0x15d244,'name');_0x2763be[_0x7b67('0x2e')]=_['keys'](_0xac7e3a['query']);_0x2763be[_0x7b67('0x2f')]=_[_0x7b67('0x30')](_0x2763be[_0x7b67('0x2d')],_0x2763be['query']);_0x1a1a92[_0x7b67('0x31')]=_[_0x7b67('0x30')](_0x2763be[_0x7b67('0x2d')],qs['fields'](_0xac7e3a[_0x7b67('0x2e')]['fields']));_0x1a1a92[_0x7b67('0x31')]=_0x1a1a92[_0x7b67('0x31')][_0x7b67('0x32')]?_0x1a1a92[_0x7b67('0x31')]:_0x2763be[_0x7b67('0x2d')];if(!_0xac7e3a['query'][_0x7b67('0x33')](_0x7b67('0x34'))){_0x1a1a92[_0x7b67('0x1e')]=qs[_0x7b67('0x1e')](_0xac7e3a[_0x7b67('0x2e')][_0x7b67('0x1e')]);_0x1a1a92['offset']=qs[_0x7b67('0x1d')](_0xac7e3a['query']['offset']);}_0x1a1a92[_0x7b67('0x35')]=qs[_0x7b67('0x36')](_0xac7e3a['query'][_0x7b67('0x36')]);_0x1a1a92[_0x7b67('0x37')]=qs[_0x7b67('0x2f')](_[_0x7b67('0x38')](_0xac7e3a['query'],_0x2763be[_0x7b67('0x2f')]),_0x15d244);if(_0xac7e3a[_0x7b67('0x2e')]['filter']){_0x1a1a92[_0x7b67('0x37')]=_['merge'](_0x1a1a92['where'],{'$or':_[_0x7b67('0x29')](_0x15d244,function(_0x1df480){if(_0x1df480[_0x7b67('0x2c')]!==_0x7b67('0x39')){var _0x8bb200={};_0x8bb200[_0x1df480[_0x7b67('0x27')]]={'$like':'%'+_0xac7e3a[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x8bb200;}})});}_0x1a1a92=_['merge']({},_0x1a1a92,_0xac7e3a[_0x7b67('0x3b')]);var _0x505685={'where':_0x1a1a92[_0x7b67('0x37')]};return db[_0x7b67('0x3c')][_0x7b67('0x1c')](_0x505685)[_0x7b67('0x23')](function(_0x3fc729){_0x40c165['count']=_0x3fc729;if(_0xac7e3a[_0x7b67('0x2e')][_0x7b67('0x3d')]){_0x1a1a92[_0x7b67('0x3e')]=[{'all':!![]}];}return db[_0x7b67('0x3c')]['findAll'](_0x1a1a92);})[_0x7b67('0x23')](function(_0x520e76){_0x40c165[_0x7b67('0x3f')]=_0x520e76;return _0x40c165;})[_0x7b67('0x23')](respondWithFilteredResult(_0x3f326b,_0x1a1a92))[_0x7b67('0x40')](handleError(_0x3f326b,null));};exports['show']=function(_0xee3d0e,_0x2ceafb){var _0x5ebbe0={'raw':![],'where':{'id':_0xee3d0e[_0x7b67('0x41')]['id']}},_0x10168b={};_0x10168b[_0x7b67('0x2d')]=_[_0x7b67('0x42')](db[_0x7b67('0x3c')][_0x7b67('0x2a')]);_0x10168b['query']=_[_0x7b67('0x42')](_0xee3d0e['query']);_0x10168b[_0x7b67('0x2f')]=_['intersection'](_0x10168b[_0x7b67('0x2d')],_0x10168b[_0x7b67('0x2e')]);_0x5ebbe0[_0x7b67('0x31')]=_[_0x7b67('0x30')](_0x10168b[_0x7b67('0x2d')],qs[_0x7b67('0x43')](_0xee3d0e[_0x7b67('0x2e')][_0x7b67('0x43')]));_0x5ebbe0[_0x7b67('0x31')]=_0x5ebbe0[_0x7b67('0x31')]['length']?_0x5ebbe0[_0x7b67('0x31')]:_0x10168b[_0x7b67('0x2d')];if(_0xee3d0e[_0x7b67('0x2e')][_0x7b67('0x3d')]){_0x5ebbe0['include']=[{'all':!![]}];}_0x5ebbe0=_[_0x7b67('0x44')]({},_0x5ebbe0,_0xee3d0e[_0x7b67('0x3b')]);return db[_0x7b67('0x3c')][_0x7b67('0x45')](_0x5ebbe0)[_0x7b67('0x23')](handleEntityNotFound(_0x2ceafb,null))[_0x7b67('0x23')](respondWithResult(_0x2ceafb,null))['catch'](handleError(_0x2ceafb,null));};exports['create']=function(_0x2fd623,_0x2f90d0){return db[_0x7b67('0x3c')][_0x7b67('0x46')](_0x2fd623[_0x7b67('0x47')],{})[_0x7b67('0x23')](respondWithResult(_0x2f90d0,0xc9))[_0x7b67('0x40')](handleError(_0x2f90d0,null));};exports[_0x7b67('0x22')]=function(_0x460a25,_0x4beaa8){if(_0x460a25['body']['id']){delete _0x460a25[_0x7b67('0x47')]['id'];}return db[_0x7b67('0x3c')]['find']({'where':{'id':_0x460a25[_0x7b67('0x41')]['id']}})[_0x7b67('0x23')](handleEntityNotFound(_0x4beaa8,null))[_0x7b67('0x23')](saveUpdates(_0x460a25[_0x7b67('0x47')],null))[_0x7b67('0x23')](respondWithResult(_0x4beaa8,null))[_0x7b67('0x40')](handleError(_0x4beaa8,null));};exports[_0x7b67('0x24')]=function(_0x3b9b2d,_0xfcb306){return db[_0x7b67('0x3c')]['find']({'where':{'id':_0x3b9b2d[_0x7b67('0x41')]['id']}})[_0x7b67('0x23')](handleEntityNotFound(_0xfcb306,null))[_0x7b67('0x23')](removeEntity(_0xfcb306,null))['catch'](handleError(_0xfcb306,null));};exports[_0x7b67('0x48')]=function(_0xa6b8dc,_0x43474d){return db[_0x7b67('0x3c')][_0x7b67('0x48')]()[_0x7b67('0x23')](respondWithResult(_0x43474d,null))[_0x7b67('0x40')](handleError(_0x43474d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 339037b..311e7b2 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 _0xb076=['../../config/logger','api','request-promise','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xb076,0x1c6));var _0x6b07=function(_0x17afd2,_0x4deb5e){_0x17afd2=_0x17afd2-0x0;var _0x3c7fec=_0xb076[_0x17afd2];return _0x3c7fec;};'use strict';var _=require(_0x6b07('0x0'));var util=require('util');var logger=require(_0x6b07('0x1'))(_0x6b07('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6b07('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6b07('0x4'));var config=require('../../config/environment');var attributes=require(_0x6b07('0x5'));module[_0x6b07('0x6')]=function(_0xef4bcb,_0x1de32f){return _0xef4bcb[_0x6b07('0x7')](_0x6b07('0x8'),attributes,{'tableName':_0x6b07('0x9'),'paranoid':![],'indexes':[{'name':_0x6b07('0xa'),'fields':[_0x6b07('0xb'),_0x6b07('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x97a2=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection'];(function(_0xa93078,_0x12be5b){var _0x24fa40=function(_0x1bfb1e){while(--_0x1bfb1e){_0xa93078['push'](_0xa93078['shift']());}};_0x24fa40(++_0x12be5b);}(_0x97a2,0x114));var _0x297a=function(_0x55a8d7,_0x5c665b){_0x55a8d7=_0x55a8d7-0x0;var _0xfefe96=_0x97a2[_0x55a8d7];return _0xfefe96;};'use strict';var _=require(_0x297a('0x0'));var util=require(_0x297a('0x1'));var logger=require(_0x297a('0x2'))(_0x297a('0x3'));var moment=require(_0x297a('0x4'));var BPromise=require(_0x297a('0x5'));var rp=require(_0x297a('0x6'));var fs=require('fs');var path=require(_0x297a('0x7'));var rimraf=require(_0x297a('0x8'));var config=require(_0x297a('0x9'));var attributes=require(_0x297a('0xa'));module[_0x297a('0xb')]=function(_0x4fb5c9,_0x21c8e3){return _0x4fb5c9['define'](_0x297a('0xc'),attributes,{'tableName':_0x297a('0xd'),'paranoid':![],'indexes':[{'name':_0x297a('0xe'),'fields':[_0x297a('0xf'),_0x297a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 30a5634..eac7c83 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 _0x7e89=['UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x2d74d5,_0x2f0c4b){var _0x17f90a=function(_0xfb980f){while(--_0xfb980f){_0x2d74d5['push'](_0x2d74d5['shift']());}};_0x17f90a(++_0x2f0c4b);}(_0x7e89,0x181));var _0x97e8=function(_0x2d460c,_0x4f08c0){_0x2d460c=_0x2d460c-0x0;var _0xf6fc4c=_0x7e89[_0x2d460c];return _0xf6fc4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x97e8('0x0'));var BPromise=require(_0x97e8('0x1'));var rs=require(_0x97e8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x97e8('0x3'));var logger=require(_0x97e8('0x4'))(_0x97e8('0x5'));var config=require(_0x97e8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x97e8('0x7')][_0x97e8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x543a6e,_0x543a45,_0x1f4cca){return new BPromise(function(_0x23f864,_0x2a9326){return client[_0x97e8('0x9')](_0x543a6e,_0x1f4cca)[_0x97e8('0xa')](function(_0x1f972f){logger[_0x97e8('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x543a45,_0x97e8('0xc'));logger[_0x97e8('0xd')](_0x97e8('0xe'),_0x543a45,'request\x20sent',JSON[_0x97e8('0xf')](_0x1f972f));if(_0x1f972f[_0x97e8('0x10')]){if(_0x1f972f[_0x97e8('0x10')][_0x97e8('0x11')]===0x1f4){logger[_0x97e8('0x10')](_0x97e8('0x12'),_0x543a45,_0x1f972f[_0x97e8('0x10')][_0x97e8('0x13')]);return _0x2a9326(_0x1f972f['error'][_0x97e8('0x13')]);}logger[_0x97e8('0x10')](_0x97e8('0x12'),_0x543a45,_0x1f972f[_0x97e8('0x10')][_0x97e8('0x13')]);return _0x23f864(_0x1f972f[_0x97e8('0x10')]['message']);}else{logger[_0x97e8('0xb')](_0x97e8('0x12'),_0x543a45,_0x97e8('0xc'));_0x23f864(_0x1f972f['result'][_0x97e8('0x13')]);}})[_0x97e8('0x14')](function(_0x4df83f){logger['error'](_0x97e8('0x12'),_0x543a45,_0x4df83f);_0x2a9326(_0x4df83f);});});} \ No newline at end of file +var _0x64b2=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x46fb49,_0x36aebc){var _0x6eb06f=function(_0x51f8b9){while(--_0x51f8b9){_0x46fb49['push'](_0x46fb49['shift']());}};_0x6eb06f(++_0x36aebc);}(_0x64b2,0x143));var _0x264b=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x64b2[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x264b('0x0'));var util=require(_0x264b('0x1'));var moment=require(_0x264b('0x2'));var BPromise=require(_0x264b('0x3'));var rs=require(_0x264b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x264b('0x5'))['db'];var utils=require(_0x264b('0x6'));var logger=require(_0x264b('0x7'))('rpc');var config=require(_0x264b('0x8'));var jayson=require(_0x264b('0x9'));var client=jayson[_0x264b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c220d,_0x1f57b0,_0x3606d7){return new BPromise(function(_0x5d3363,_0x34e951){return client[_0x264b('0xb')](_0x1c220d,_0x3606d7)[_0x264b('0xc')](function(_0x141ff0){logger[_0x264b('0xd')](_0x264b('0xe'),_0x1f57b0,_0x264b('0xf'));logger[_0x264b('0x10')](_0x264b('0x11'),_0x1f57b0,_0x264b('0xf'),JSON['stringify'](_0x141ff0));if(_0x141ff0['error']){if(_0x141ff0['error'][_0x264b('0x12')]===0x1f4){logger['error'](_0x264b('0xe'),_0x1f57b0,_0x141ff0[_0x264b('0x13')][_0x264b('0x14')]);return _0x34e951(_0x141ff0[_0x264b('0x13')][_0x264b('0x14')]);}logger[_0x264b('0x13')](_0x264b('0xe'),_0x1f57b0,_0x141ff0[_0x264b('0x13')]['message']);return _0x5d3363(_0x141ff0['error'][_0x264b('0x14')]);}else{logger['info']('UserProfileSection,\x20%s,\x20%s',_0x1f57b0,'request\x20sent');_0x5d3363(_0x141ff0[_0x264b('0x15')][_0x264b('0x14')]);}})['catch'](function(_0x312eac){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x1f57b0,_0x312eac);_0x34e951(_0x312eac);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 7093630..4350d97 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(_0x2587b6,_0x77b30d){var _0x465a2b=function(_0x288f70){while(--_0x288f70){_0x2587b6['push'](_0x2587b6['shift']());}};_0x465a2b(++_0x77b30d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x57b4cc,_0x2ae50e){var _0x45ba9d=function(_0x4ab1b1){while(--_0x4ab1b1){_0x57b4cc['push'](_0x57b4cc['shift']());}};_0x45ba9d(++_0x2ae50e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 52398fc..577393a 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 _0x6426=['exports'];(function(_0x18246d,_0x37e302){var _0xd00a8=function(_0x5dc1f5){while(--_0x5dc1f5){_0x18246d['push'](_0x18246d['shift']());}};_0xd00a8(++_0x37e302);}(_0x6426,0x1eb));var _0x6642=function(_0x4b315b,_0x449cb0){_0x4b315b=_0x4b315b-0x0;var _0xe5353b=_0x6426[_0x4b315b];return _0xe5353b;};'use strict';var Sequelize=require('sequelize');module[_0x6642('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e61=['sequelize'];(function(_0x1fa841,_0x37a70c){var _0x384b67=function(_0x248c40){while(--_0x248c40){_0x1fa841['push'](_0x1fa841['shift']());}};_0x384b67(++_0x37a70c);}(_0x3e61,0x1ef));var _0x13e6=function(_0x3fea52,_0x5ab72a){_0x3fea52=_0x3fea52-0x0;var _0x22a27=_0x3e61[_0x3fea52];return _0x22a27;};'use strict';var Sequelize=require(_0x13e6('0x0'));module['exports']={'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 6cf52b0..6b10bdb 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 _0xcf98=['moment','bluebird','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api'];(function(_0x2c602e,_0x1d26f5){var _0x1a2650=function(_0x2370d1){while(--_0x2370d1){_0x2c602e['push'](_0x2c602e['shift']());}};_0x1a2650(++_0x1d26f5);}(_0xcf98,0x8d));var _0x8cf9=function(_0x1cfae9,_0x4d430b){_0x1cfae9=_0x1cfae9-0x0;var _0x5001eb=_0xcf98[_0x1cfae9];return _0x5001eb;};'use strict';var _=require('lodash');var util=require(_0x8cf9('0x0'));var logger=require(_0x8cf9('0x1'))(_0x8cf9('0x2'));var moment=require(_0x8cf9('0x3'));var BPromise=require(_0x8cf9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var attributes=require(_0x8cf9('0x7'));module[_0x8cf9('0x8')]=function(_0x784c17,_0x3a5463){return _0x784c17[_0x8cf9('0x9')](_0x8cf9('0xa'),attributes,{'tableName':_0x8cf9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x4e98ef,_0x8b3023){var _0x238d07=function(_0xa63a6a){while(--_0xa63a6a){_0x4e98ef['push'](_0x4e98ef['shift']());}};_0x238d07(++_0x8b3023);}(_0x7278,0x161));var _0x8727=function(_0x2830ea,_0x440536){_0x2830ea=_0x2830ea-0x0;var _0x10b7f7=_0x7278[_0x2830ea];return _0x10b7f7;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'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 e2aa911..6911ea3 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 _0xbe48=['rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xbe48,0x1ad));var _0x8be4=function(_0x5294f5,_0x16525b){_0x5294f5=_0x5294f5-0x0;var _0x4781b2=_0xbe48[_0x5294f5];return _0x4781b2;};'use strict';var _=require(_0x8be4('0x0'));var util=require(_0x8be4('0x1'));var moment=require(_0x8be4('0x2'));var BPromise=require('bluebird');var rs=require(_0x8be4('0x3'));var fs=require('fs');var Redis=require(_0x8be4('0x4'));var db=require(_0x8be4('0x5'))['db'];var utils=require(_0x8be4('0x6'));var logger=require(_0x8be4('0x7'))(_0x8be4('0x8'));var config=require(_0x8be4('0x9'));var jayson=require(_0x8be4('0xa'));var client=jayson[_0x8be4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x109f24,_0x59e2ab,_0x5b54fe){return new BPromise(function(_0x12c157,_0x28e481){return client['request'](_0x109f24,_0x5b54fe)[_0x8be4('0xc')](function(_0x477f8d){logger[_0x8be4('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x59e2ab,_0x8be4('0xe'));logger['debug'](_0x8be4('0xf'),_0x59e2ab,'request\x20sent',JSON[_0x8be4('0x10')](_0x477f8d));if(_0x477f8d[_0x8be4('0x11')]){if(_0x477f8d['error'][_0x8be4('0x12')]===0x1f4){logger[_0x8be4('0x11')](_0x8be4('0x13'),_0x59e2ab,_0x477f8d['error']['message']);return _0x28e481(_0x477f8d[_0x8be4('0x11')][_0x8be4('0x14')]);}logger['error'](_0x8be4('0x13'),_0x59e2ab,_0x477f8d[_0x8be4('0x11')]['message']);return _0x12c157(_0x477f8d[_0x8be4('0x11')][_0x8be4('0x14')]);}else{logger[_0x8be4('0xd')](_0x8be4('0x13'),_0x59e2ab,_0x8be4('0xe'));_0x12c157(_0x477f8d[_0x8be4('0x15')][_0x8be4('0x14')]);}})[_0x8be4('0x16')](function(_0x320722){logger[_0x8be4('0x11')](_0x8be4('0x13'),_0x59e2ab,_0x320722);_0x28e481(_0x320722);});});} \ No newline at end of file +var _0x0e57=['debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','request\x20sent'];(function(_0x2f226e,_0xf6d75d){var _0x2d0a67=function(_0x2f658e){while(--_0x2f658e){_0x2f226e['push'](_0x2f226e['shift']());}};_0x2d0a67(++_0xf6d75d);}(_0x0e57,0x13e));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70e5('0x0'));var util=require(_0x70e5('0x1'));var moment=require('moment');var BPromise=require(_0x70e5('0x2'));var rs=require(_0x70e5('0x3'));var fs=require('fs');var Redis=require(_0x70e5('0x4'));var db=require(_0x70e5('0x5'))['db'];var utils=require(_0x70e5('0x6'));var logger=require('../../config/logger')(_0x70e5('0x7'));var config=require(_0x70e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70e5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5375f9,_0x434e2e,_0x36f137){return new BPromise(function(_0x22a7e2,_0x4785ee){return client['request'](_0x5375f9,_0x36f137)[_0x70e5('0xa')](function(_0x58fd3e){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x434e2e,_0x70e5('0xb'));logger[_0x70e5('0xc')](_0x70e5('0xd'),_0x434e2e,'request\x20sent',JSON[_0x70e5('0xe')](_0x58fd3e));if(_0x58fd3e[_0x70e5('0xf')]){if(_0x58fd3e['error'][_0x70e5('0x10')]===0x1f4){logger[_0x70e5('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x434e2e,_0x58fd3e[_0x70e5('0xf')][_0x70e5('0x11')]);return _0x4785ee(_0x58fd3e[_0x70e5('0xf')][_0x70e5('0x11')]);}logger[_0x70e5('0xf')](_0x70e5('0x12'),_0x434e2e,_0x58fd3e['error']['message']);return _0x22a7e2(_0x58fd3e[_0x70e5('0xf')][_0x70e5('0x11')]);}else{logger[_0x70e5('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x434e2e,_0x70e5('0xb'));_0x22a7e2(_0x58fd3e[_0x70e5('0x14')][_0x70e5('0x11')]);}})[_0x70e5('0x15')](function(_0x428c41){logger['error'](_0x70e5('0x12'),_0x434e2e,_0x428c41);_0x4785ee(_0x428c41);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2ebc7c7..3e54036 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 _0x348b=['INTEGER','sequelize','exports'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x348b,0x13c));var _0xb348=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x348b[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require(_0xb348('0x0'));module[_0xb348('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb348('0x2')]}}; \ No newline at end of file +var _0x1966=['INTEGER','sequelize','exports'];(function(_0x8501a2,_0x33b9fb){var _0x419c29=function(_0xbc2e9c){while(--_0xbc2e9c){_0x8501a2['push'](_0x8501a2['shift']());}};_0x419c29(++_0x33b9fb);}(_0x1966,0x115));var _0x6196=function(_0x20050a,_0x570f13){_0x20050a=_0x20050a-0x0;var _0x29c3d9=_0x1966[_0x20050a];return _0x29c3d9;};'use strict';var Sequelize=require(_0x6196('0x0'));module[_0x6196('0x1')]={'UserId':{'type':Sequelize[_0x6196('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 749a113..10a4358 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(_0x12e565,_0x826bb0){var _0x42adb1=function(_0x5191a0){while(--_0x5191a0){_0x12e565['push'](_0x12e565['shift']());}};_0x42adb1(++_0x826bb0);}(_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':'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(_0x65e066,_0x373ee1){var _0x26ff2f=function(_0x4c4bfb){while(--_0x4c4bfb){_0x65e066['push'](_0x65e066['shift']());}};_0x26ff2f(++_0x373ee1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 c1b6404..2b2e868 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x37a0ce,_0x28dc04){var _0x569f4e=function(_0x1671c0){while(--_0x1671c0){_0x37a0ce['push'](_0x37a0ce['shift']());}};_0x569f4e(++_0x28dc04);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x54eef8,_0x3c982f){var _0x3a212d=function(_0x40a889){while(--_0x40a889){_0x54eef8['push'](_0x54eef8['shift']());}};_0x3a212d(++_0x3c982f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xcb91[_0x39f34f];return _0x59fee1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 30509b1..5c1b683 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 _0x6f04=['INTEGER','sequelize','exports'];(function(_0x3efcd5,_0x9bbba3){var _0x54e50a=function(_0x34d7f4){while(--_0x34d7f4){_0x3efcd5['push'](_0x3efcd5['shift']());}};_0x54e50a(++_0x9bbba3);}(_0x6f04,0x13f));var _0x46f0=function(_0x568cce,_0x19619a){_0x568cce=_0x568cce-0x0;var _0x344606=_0x6f04[_0x568cce];return _0x344606;};'use strict';var Sequelize=require(_0x46f0('0x0'));module[_0x46f0('0x1')]={'penalty':{'type':Sequelize[_0x46f0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6087=['sequelize','exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6087,0x1e3));var _0x7608=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6087[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7608('0x0'));module[_0x7608('0x1')]={'penalty':{'type':Sequelize[_0x7608('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 a8bf182..dfde77e 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 _0xded1=['moment','bluebird','path','rimraf','../../config/environment','exports','UserVoiceQueue','lodash','util','../../config/logger','api'];(function(_0x3e35ed,_0x4d9f16){var _0x5edfbf=function(_0xc9854d){while(--_0xc9854d){_0x3e35ed['push'](_0x3e35ed['shift']());}};_0x5edfbf(++_0x4d9f16);}(_0xded1,0x130));var _0x1ded=function(_0x559948,_0x5d7a75){_0x559948=_0x559948-0x0;var _0x4fc8d5=_0xded1[_0x559948];return _0x4fc8d5;};'use strict';var _=require(_0x1ded('0x0'));var util=require(_0x1ded('0x1'));var logger=require(_0x1ded('0x2'))(_0x1ded('0x3'));var moment=require(_0x1ded('0x4'));var BPromise=require(_0x1ded('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ded('0x6'));var rimraf=require(_0x1ded('0x7'));var config=require(_0x1ded('0x8'));var attributes=require('./userVoiceQueue.attributes');module[_0x1ded('0x9')]=function(_0x16be86,_0xec5681){return _0x16be86['define'](_0x1ded('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2eef=['./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x3a8db5,_0x31cff7){var _0x2c03cd=function(_0x47dba0){while(--_0x47dba0){_0x3a8db5['push'](_0x3a8db5['shift']());}};_0x2c03cd(++_0x31cff7);}(_0x2eef,0x1bc));var _0xf2ee=function(_0x540ec5,_0x700ddd){_0x540ec5=_0x540ec5-0x0;var _0x4bf834=_0x2eef[_0x540ec5];return _0x4bf834;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf2ee('0x0'));var moment=require(_0xf2ee('0x1'));var BPromise=require(_0xf2ee('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2ee('0x3'));var rimraf=require(_0xf2ee('0x4'));var config=require(_0xf2ee('0x5'));var attributes=require(_0xf2ee('0x6'));module[_0xf2ee('0x7')]=function(_0xe5788b,_0x4ce291){return _0xe5788b['define'](_0xf2ee('0x8'),attributes,{'tableName':_0xf2ee('0x9'),'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 7ebb732..273019f 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 _0xc314=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\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','request','then'];(function(_0x2478e5,_0x30ca4c){var _0x10129a=function(_0x574b77){while(--_0x574b77){_0x2478e5['push'](_0x2478e5['shift']());}};_0x10129a(++_0x30ca4c);}(_0xc314,0xe2));var _0x4c31=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc314[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x4c31('0x0'));var util=require(_0x4c31('0x1'));var moment=require(_0x4c31('0x2'));var BPromise=require(_0x4c31('0x3'));var rs=require(_0x4c31('0x4'));var fs=require('fs');var Redis=require(_0x4c31('0x5'));var db=require(_0x4c31('0x6'))['db'];var utils=require(_0x4c31('0x7'));var logger=require(_0x4c31('0x8'))(_0x4c31('0x9'));var config=require('../../config/environment');var jayson=require(_0x4c31('0xa'));var client=jayson[_0x4c31('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54968d,_0x4684e4,_0x189354){return new BPromise(function(_0x8f21da,_0xc5498e){return client[_0x4c31('0xc')](_0x54968d,_0x189354)[_0x4c31('0xd')](function(_0x471296){logger['info'](_0x4c31('0xe'),_0x4684e4,_0x4c31('0xf'));logger[_0x4c31('0x10')](_0x4c31('0x11'),_0x4684e4,_0x4c31('0xf'),JSON[_0x4c31('0x12')](_0x471296));if(_0x471296[_0x4c31('0x13')]){if(_0x471296['error'][_0x4c31('0x14')]===0x1f4){logger[_0x4c31('0x13')](_0x4c31('0xe'),_0x4684e4,_0x471296['error']['message']);return _0xc5498e(_0x471296[_0x4c31('0x13')][_0x4c31('0x15')]);}logger[_0x4c31('0x13')](_0x4c31('0xe'),_0x4684e4,_0x471296['error'][_0x4c31('0x15')]);return _0x8f21da(_0x471296[_0x4c31('0x13')][_0x4c31('0x15')]);}else{logger['info'](_0x4c31('0xe'),_0x4684e4,'request\x20sent');_0x8f21da(_0x471296[_0x4c31('0x16')][_0x4c31('0x15')]);}})[_0x4c31('0x17')](function(_0x3a616c){logger['error'](_0x4c31('0xe'),_0x4684e4,_0x3a616c);_0xc5498e(_0x3a616c);});});} \ No newline at end of file +var _0x3640=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x36cb47,_0xb4dbe){var _0x3ea2b7=function(_0x20a626){while(--_0x20a626){_0x36cb47['push'](_0x36cb47['shift']());}};_0x3ea2b7(++_0xb4dbe);}(_0x3640,0xf4));var _0x0364=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x3640[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x0364('0x0'));var util=require(_0x0364('0x1'));var moment=require(_0x0364('0x2'));var BPromise=require(_0x0364('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0364('0x4'));var db=require(_0x0364('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0364('0x6'))(_0x0364('0x7'));var config=require('../../config/environment');var jayson=require(_0x0364('0x8'));var client=jayson[_0x0364('0x9')][_0x0364('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14cd84,_0x5c1d64,_0x5c2cd6){return new BPromise(function(_0x5a6130,_0x104223){return client[_0x0364('0xb')](_0x14cd84,_0x5c2cd6)[_0x0364('0xc')](function(_0x2d1808){logger[_0x0364('0xd')](_0x0364('0xe'),_0x5c1d64,_0x0364('0xf'));logger[_0x0364('0x10')](_0x0364('0x11'),_0x5c1d64,_0x0364('0xf'),JSON[_0x0364('0x12')](_0x2d1808));if(_0x2d1808[_0x0364('0x13')]){if(_0x2d1808[_0x0364('0x13')][_0x0364('0x14')]===0x1f4){logger[_0x0364('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x5c1d64,_0x2d1808[_0x0364('0x13')][_0x0364('0x15')]);return _0x104223(_0x2d1808[_0x0364('0x13')][_0x0364('0x15')]);}logger[_0x0364('0x13')](_0x0364('0xe'),_0x5c1d64,_0x2d1808['error']['message']);return _0x5a6130(_0x2d1808['error'][_0x0364('0x15')]);}else{logger[_0x0364('0xd')](_0x0364('0xe'),_0x5c1d64,'request\x20sent');_0x5a6130(_0x2d1808[_0x0364('0x16')][_0x0364('0x15')]);}})['catch'](function(_0x47f7dc){logger[_0x0364('0x13')](_0x0364('0xe'),_0x5c1d64,_0x47f7dc);_0x104223(_0x47f7dc);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 8a6e193..dbf7f45 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x128d00,_0x57f97f){var _0x5ebe74=function(_0x413a91){while(--_0x413a91){_0x128d00['push'](_0x128d00['shift']());}};_0x5ebe74(++_0x57f97f);}(_0xe706,0xa3));var _0x6e70=function(_0x11e239,_0x3cfa93){_0x11e239=_0x11e239-0x0;var _0x4b1ee8=_0xe706[_0x11e239];return _0x4b1ee8;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1c5a9d,_0x18a6c6){var _0x5cbdd5=function(_0x195793){while(--_0x195793){_0x1c5a9d['push'](_0x1c5a9d['shift']());}};_0x5cbdd5(++_0x18a6c6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x111e94,_0x31c837){_0x111e94=_0x111e94-0x0;var _0x3de107=_0xcb91[_0x111e94];return _0x3de107;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 80fdd4a..f9e4575 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 _0x5b20=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5b20,0x86));var _0x05b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b20[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05b2('0x0'));module[_0x05b2('0x1')]={'uniqueid':{'type':Sequelize[_0x05b2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x05b2('0x3')},'membername':{'type':Sequelize[_0x05b2('0x4')],'allowNull':![],'comment':_0x05b2('0x3')},'UserId':{'type':Sequelize[_0x05b2('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x05b2('0x4')],'allowNull':![],'unique':_0x05b2('0x5'),'comment':_0x05b2('0x3')},'VoiceQueueId':{'type':Sequelize[_0x05b2('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x05b2('0x5'),'comment':_0x05b2('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x05b2('0x3')},'paused':{'type':Sequelize[_0x05b2('0x2')](0xb),'defaultValue':0x0,'comment':_0x05b2('0x3')}}; \ No newline at end of file +var _0x962e=['STRING','queue_interface','Required\x20by\x20Asterisk','INTEGER'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x962e,0x187));var _0xe962=function(_0xc9bc0f,_0x12e2ac){_0xc9bc0f=_0xc9bc0f-0x0;var _0x4aacbc=_0x962e[_0xc9bc0f];return _0x4aacbc;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe962('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xe962('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xe962('0x0')],'allowNull':![]},'interface':{'type':Sequelize[_0xe962('0x1')],'allowNull':![],'unique':_0xe962('0x2'),'comment':_0xe962('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe962('0x3')},'paused':{'type':Sequelize[_0xe962('0x0')](0xb),'defaultValue':0x0,'comment':_0xe962('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index c4dfb29..28493db 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 _0x1b6f=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x1b6f,0x121));var _0xf1b6=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0x1b6f[_0x466e57];return _0x34df42;};'use strict';var EventEmitter=require(_0xf1b6('0x0'));var UserVoiceQueueRt=require(_0xf1b6('0x1'))['db'][_0xf1b6('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf1b6('0x3'),'afterUpdate':_0xf1b6('0x4'),'afterDestroy':_0xf1b6('0x5')};function emitEvent(_0x3cabc5){return function(_0x41f353,_0xe2836b,_0x51065e){UserVoiceQueueRtEvents[_0xf1b6('0x6')](_0x3cabc5+':'+_0x41f353['id'],_0x41f353);UserVoiceQueueRtEvents['emit'](_0x3cabc5,_0x41f353);_0x51065e(null);};}for(var e in events){if(events[_0xf1b6('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xf1b6('0x8')](e,emitEvent(event));}}module[_0xf1b6('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb635=['emit','exports','events','UserVoiceQueueRt','save','update'];(function(_0x4bc95c,_0x4d8358){var _0x4884d2=function(_0x54081d){while(--_0x54081d){_0x4bc95c['push'](_0x4bc95c['shift']());}};_0x4884d2(++_0x4d8358);}(_0xb635,0xf2));var _0x5b63=function(_0x3d8093,_0xda66bf){_0x3d8093=_0x3d8093-0x0;var _0x3251a9=_0xb635[_0x3d8093];return _0x3251a9;};'use strict';var EventEmitter=require(_0x5b63('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x5b63('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b63('0x2'),'afterUpdate':_0x5b63('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5329db){return function(_0x3de4da,_0x57be4e,_0x262bfb){UserVoiceQueueRtEvents[_0x5b63('0x4')](_0x5329db+':'+_0x3de4da['id'],_0x3de4da);UserVoiceQueueRtEvents[_0x5b63('0x4')](_0x5329db,_0x3de4da);_0x262bfb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x5b63('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8be65b7..763150f 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 _0xa503=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x2d08c5,_0x2b19f1){var _0x5c71b1=function(_0x1c2af2){while(--_0x1c2af2){_0x2d08c5['push'](_0x2d08c5['shift']());}};_0x5c71b1(++_0x2b19f1);}(_0xa503,0x19d));var _0x3a50=function(_0x3c7195,_0x589382){_0x3c7195=_0x3c7195-0x0;var _0x38d8cd=_0xa503[_0x3c7195];return _0x38d8cd;};'use strict';var _=require(_0x3a50('0x0'));var util=require(_0x3a50('0x1'));var logger=require(_0x3a50('0x2'))(_0x3a50('0x3'));var moment=require(_0x3a50('0x4'));var BPromise=require('bluebird');var rp=require(_0x3a50('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3a50('0x6'));var attributes=require(_0x3a50('0x7'));module[_0x3a50('0x8')]=function(_0x14c86c,_0x2db083){return _0x14c86c[_0x3a50('0x9')](_0x3a50('0xa'),attributes,{'tableName':_0x3a50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x287d=['user_has_voice_queues_rt','lodash','api','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x287d,0x173));var _0xd287=function(_0x42946c,_0x577d97){_0x42946c=_0x42946c-0x0;var _0x5d7687=_0x287d[_0x42946c];return _0x5d7687;};'use strict';var _=require(_0xd287('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd287('0x1'));var moment=require('moment');var BPromise=require(_0xd287('0x2'));var rp=require(_0xd287('0x3'));var fs=require('fs');var path=require(_0xd287('0x4'));var rimraf=require(_0xd287('0x5'));var config=require('../../config/environment');var attributes=require(_0xd287('0x6'));module[_0xd287('0x7')]=function(_0xf3e833,_0x2e8735){return _0xf3e833['define'](_0xd287('0x8'),attributes,{'tableName':_0xd287('0x9'),'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 808f5ea..fc01381 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 _0xfe74=['defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x2c79bb,_0x51860f){var _0x224a90=function(_0x512ac9){while(--_0x512ac9){_0x2c79bb['push'](_0x2c79bb['shift']());}};_0x224a90(++_0x51860f);}(_0xfe74,0xb7));var _0x4fe7=function(_0x3ae42b,_0x220e91){_0x3ae42b=_0x3ae42b-0x0;var _0x2d1725=_0xfe74[_0x3ae42b];return _0x2d1725;};'use strict';var _=require('lodash');var util=require(_0x4fe7('0x0'));var moment=require(_0x4fe7('0x1'));var BPromise=require(_0x4fe7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4fe7('0x3'));var db=require(_0x4fe7('0x4'))['db'];var utils=require(_0x4fe7('0x5'));var logger=require(_0x4fe7('0x6'))(_0x4fe7('0x7'));var config=require('../../config/environment');var jayson=require(_0x4fe7('0x8'));var client=jayson[_0x4fe7('0x9')][_0x4fe7('0xa')]({'port':0x232a});config[_0x4fe7('0xb')]=_[_0x4fe7('0xc')](config[_0x4fe7('0xb')],{'host':_0x4fe7('0xd'),'port':0x18eb});var socket=require(_0x4fe7('0xe'))(new Redis(config[_0x4fe7('0xb')]));require(_0x4fe7('0xf'))[_0x4fe7('0x10')](socket);function respondWithRpcPromise(_0x22d871,_0x4bbbfe,_0x39f187){return new BPromise(function(_0x4a3a67,_0xcd380c){return client[_0x4fe7('0x11')](_0x22d871,_0x39f187)[_0x4fe7('0x12')](function(_0x293b81){logger[_0x4fe7('0x13')](_0x4fe7('0x14'),_0x4bbbfe,_0x4fe7('0x15'));logger[_0x4fe7('0x16')](_0x4fe7('0x17'),_0x4bbbfe,_0x4fe7('0x15'),JSON[_0x4fe7('0x18')](_0x293b81));if(_0x293b81['error']){if(_0x293b81[_0x4fe7('0x19')]['code']===0x1f4){logger[_0x4fe7('0x19')](_0x4fe7('0x14'),_0x4bbbfe,_0x293b81[_0x4fe7('0x19')][_0x4fe7('0x1a')]);return _0xcd380c(_0x293b81[_0x4fe7('0x19')]['message']);}logger[_0x4fe7('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4bbbfe,_0x293b81[_0x4fe7('0x19')][_0x4fe7('0x1a')]);return _0x4a3a67(_0x293b81[_0x4fe7('0x19')][_0x4fe7('0x1a')]);}else{logger['info'](_0x4fe7('0x14'),_0x4bbbfe,'request\x20sent');_0x4a3a67(_0x293b81['result'][_0x4fe7('0x1a')]);}})[_0x4fe7('0x1b')](function(_0x49bf49){logger[_0x4fe7('0x19')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4bbbfe,_0x49bf49);_0xcd380c(_0x49bf49);});});}exports[_0x4fe7('0x1c')]=function(_0x52237a){var _0x284a6b=this;return new Promise(function(_0x3253fc,_0x5f252d){return db[_0x4fe7('0x1d')][_0x4fe7('0x1e')]({'raw':_0x52237a[_0x4fe7('0x1f')]?_0x52237a[_0x4fe7('0x1f')][_0x4fe7('0x20')]===undefined?!![]:![]:!![],'where':_0x52237a[_0x4fe7('0x1f')]?_0x52237a['options'][_0x4fe7('0x21')]||null:null,'attributes':[[db['sequelize']['fn'](_0x4fe7('0x22'),db[_0x4fe7('0x23')]['fn']('IF',db[_0x4fe7('0x23')][_0x4fe7('0x24')](_0x4fe7('0x25')))),_0x4fe7('0x26')]]})[_0x4fe7('0x12')](function(_0x2911ca){logger['info'](_0x4fe7('0x1c'),_0x52237a);logger[_0x4fe7('0x16')](_0x4fe7('0x1c'),_0x52237a,JSON[_0x4fe7('0x18')](_0x2911ca));_0x3253fc(_0x2911ca);})[_0x4fe7('0x1b')](function(_0x8ff4e4){logger['error']('GetVoiceQueueRtPauses',_0x8ff4e4[_0x4fe7('0x1a')],_0x52237a);_0x5f252d(_0x284a6b[_0x4fe7('0x19')](0x1f4,_0x8ff4e4['message']));});});}; \ No newline at end of file +var _0xfa55=['../../config/environment','client','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0xfa55,0xdd));var _0x5fa5=function(_0x1a18b4,_0x5a7740){_0x1a18b4=_0x1a18b4-0x0;var _0x4784b1=_0xfa55[_0x1a18b4];return _0x4784b1;};'use strict';var _=require(_0x5fa5('0x0'));var util=require('util');var moment=require(_0x5fa5('0x1'));var BPromise=require('bluebird');var rs=require(_0x5fa5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fa5('0x3'))['db'];var utils=require(_0x5fa5('0x4'));var logger=require(_0x5fa5('0x5'))(_0x5fa5('0x6'));var config=require(_0x5fa5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5fa5('0x8')]['http']({'port':0x232a});config['redis']=_[_0x5fa5('0x9')](config[_0x5fa5('0xa')],{'host':_0x5fa5('0xb'),'port':0x18eb});var socket=require(_0x5fa5('0xc'))(new Redis(config[_0x5fa5('0xa')]));require(_0x5fa5('0xd'))[_0x5fa5('0xe')](socket);function respondWithRpcPromise(_0x43b746,_0x426e28,_0x10faba){return new BPromise(function(_0x4fd45f,_0x357149){return client[_0x5fa5('0xf')](_0x43b746,_0x10faba)[_0x5fa5('0x10')](function(_0x5c01c3){logger[_0x5fa5('0x11')](_0x5fa5('0x12'),_0x426e28,_0x5fa5('0x13'));logger[_0x5fa5('0x14')](_0x5fa5('0x15'),_0x426e28,_0x5fa5('0x13'),JSON['stringify'](_0x5c01c3));if(_0x5c01c3[_0x5fa5('0x16')]){if(_0x5c01c3['error'][_0x5fa5('0x17')]===0x1f4){logger[_0x5fa5('0x16')](_0x5fa5('0x12'),_0x426e28,_0x5c01c3['error'][_0x5fa5('0x18')]);return _0x357149(_0x5c01c3[_0x5fa5('0x16')][_0x5fa5('0x18')]);}logger[_0x5fa5('0x16')](_0x5fa5('0x12'),_0x426e28,_0x5c01c3[_0x5fa5('0x16')][_0x5fa5('0x18')]);return _0x4fd45f(_0x5c01c3['error'][_0x5fa5('0x18')]);}else{logger[_0x5fa5('0x11')](_0x5fa5('0x12'),_0x426e28,_0x5fa5('0x13'));_0x4fd45f(_0x5c01c3['result']['message']);}})[_0x5fa5('0x19')](function(_0x443f2e){logger[_0x5fa5('0x16')](_0x5fa5('0x12'),_0x426e28,_0x443f2e);_0x357149(_0x443f2e);});});}exports[_0x5fa5('0x1a')]=function(_0x58ca4f){var _0x28e219=this;return new Promise(function(_0x1a60ae,_0x51330e){return db[_0x5fa5('0x1b')][_0x5fa5('0x1c')]({'raw':_0x58ca4f[_0x5fa5('0x1d')]?_0x58ca4f[_0x5fa5('0x1d')][_0x5fa5('0x1e')]===undefined?!![]:![]:!![],'where':_0x58ca4f[_0x5fa5('0x1d')]?_0x58ca4f[_0x5fa5('0x1d')][_0x5fa5('0x1f')]||null:null,'attributes':[[db[_0x5fa5('0x20')]['fn'](_0x5fa5('0x21'),db[_0x5fa5('0x20')]['fn']('IF',db['sequelize'][_0x5fa5('0x22')](_0x5fa5('0x23')))),_0x5fa5('0x24')]]})[_0x5fa5('0x10')](function(_0x2983a9){logger['info'](_0x5fa5('0x1a'),_0x58ca4f);logger[_0x5fa5('0x14')]('GetVoiceQueueRtPauses',_0x58ca4f,JSON[_0x5fa5('0x25')](_0x2983a9));_0x1a60ae(_0x2983a9);})['catch'](function(_0x50fc71){logger[_0x5fa5('0x16')](_0x5fa5('0x1a'),_0x50fc71['message'],_0x58ca4f);_0x51330e(_0x28e219[_0x5fa5('0x16')](0x1f4,_0x50fc71[_0x5fa5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index d6c4fd6..c5b4588 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 _0x7eff=['emit','register','length','userVoiceQueueRt:','save','remove','update'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xf7ef('0x0'),_0xf7ef('0x1'),_0xf7ef('0x2')];function createListener(_0x557e34,_0x270a48){return function(_0x1d3300){_0x270a48[_0xf7ef('0x3')](_0x557e34,_0x1d3300);};}function removeListener(_0x4db614,_0x58a651){return function(){UserVoiceQueueRtEvents['removeListener'](_0x4db614,_0x58a651);};}exports[_0xf7ef('0x4')]=function(_0x130e65){for(var _0x41864d=0x0,_0x21eb16=events[_0xf7ef('0x5')];_0x41864d<_0x21eb16;_0x41864d++){var _0xcf20c7=events[_0x41864d];var _0x1022af=createListener(_0xf7ef('0x6')+_0xcf20c7,_0x130e65);UserVoiceQueueRtEvents['on'](_0xcf20c7,_0x1022af);}}; \ No newline at end of file +var _0x1939=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit'];(function(_0x4f5ac1,_0x3adeec){var _0x269785=function(_0x2371ff){while(--_0x2371ff){_0x4f5ac1['push'](_0x4f5ac1['shift']());}};_0x269785(++_0x3adeec);}(_0x1939,0x1d1));var _0x9193=function(_0x24853d,_0x16931f){_0x24853d=_0x24853d-0x0;var _0x4c5cff=_0x1939[_0x24853d];return _0x4c5cff;};'use strict';var UserVoiceQueueRtEvents=require(_0x9193('0x0'));var events=['save',_0x9193('0x1'),_0x9193('0x2')];function createListener(_0x3628d4,_0x538b4c){return function(_0x12643a){_0x538b4c[_0x9193('0x3')](_0x3628d4,_0x12643a);};}function removeListener(_0x31aa3c,_0x35b1c4){return function(){UserVoiceQueueRtEvents['removeListener'](_0x31aa3c,_0x35b1c4);};}exports[_0x9193('0x4')]=function(_0x20ab2b){for(var _0x5186dc=0x0,_0x5f7087=events[_0x9193('0x5')];_0x5186dc<_0x5f7087;_0x5186dc++){var _0x488d01=events[_0x5186dc];var _0x327de5=createListener(_0x9193('0x6')+_0x488d01,_0x20ab2b);UserVoiceQueueRtEvents['on'](_0x488d01,_0x327de5);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index b07304f..c3168ef 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(_0x45b36c,_0x4efbfe){var _0x1dad2f=function(_0x1532af){while(--_0x1532af){_0x45b36c['push'](_0x45b36c['shift']());}};_0x1dad2f(++_0x4efbfe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4fd96d,_0x3a5551){var _0xf7e94b=function(_0x30eeb5){while(--_0x30eeb5){_0x4fd96d['push'](_0x4fd96d['shift']());}};_0xf7e94b(++_0x3a5551);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 0e8abb3..52e8909 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 _0x167b=['INTEGER','sequelize','exports'];(function(_0x2a05af,_0x48b4b7){var _0x5a8d5b=function(_0x34e422){while(--_0x34e422){_0x2a05af['push'](_0x2a05af['shift']());}};_0x5a8d5b(++_0x48b4b7);}(_0x167b,0x163));var _0xb167=function(_0x293c7d,_0xd61b3a){_0x293c7d=_0x293c7d-0x0;var _0x51036b=_0x167b[_0x293c7d];return _0x51036b;};'use strict';var Sequelize=require(_0xb167('0x0'));module[_0xb167('0x1')]={'penalty':{'type':Sequelize[_0xb167('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9780=['sequelize','INTEGER'];(function(_0x3ada86,_0x3bf83c){var _0x2a247a=function(_0x10be7d){while(--_0x10be7d){_0x3ada86['push'](_0x3ada86['shift']());}};_0x2a247a(++_0x3bf83c);}(_0x9780,0x196));var _0x0978=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0x9780[_0x55754e];return _0x2e9948;};'use strict';var Sequelize=require(_0x0978('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x0978('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 dc53e13..0a1707c 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 _0xf004=['path','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xb2da92,_0x24406e){var _0x35bb21=function(_0x3d104f){while(--_0x3d104f){_0xb2da92['push'](_0xb2da92['shift']());}};_0x35bb21(++_0x24406e);}(_0xf004,0x1db));var _0x4f00=function(_0x5e3348,_0x246b43){_0x5e3348=_0x5e3348-0x0;var _0x22ebe1=_0xf004[_0x5e3348];return _0x22ebe1;};'use strict';var _=require(_0x4f00('0x0'));var util=require(_0x4f00('0x1'));var logger=require(_0x4f00('0x2'))(_0x4f00('0x3'));var moment=require(_0x4f00('0x4'));var BPromise=require(_0x4f00('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f00('0x6'));var rimraf=require('rimraf');var config=require(_0x4f00('0x7'));var attributes=require(_0x4f00('0x8'));module[_0x4f00('0x9')]=function(_0x589025,_0x599b16){return _0x589025[_0x4f00('0xa')](_0x4f00('0xb'),attributes,{'tableName':_0x4f00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cca=['bluebird','rimraf','../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment'];(function(_0xe0c345,_0x37441d){var _0x2e9bf6=function(_0xcbd305){while(--_0xcbd305){_0xe0c345['push'](_0xe0c345['shift']());}};_0x2e9bf6(++_0x37441d);}(_0x5cca,0x8b));var _0xa5cc=function(_0x194b25,_0x4bedc4){_0x194b25=_0x194b25-0x0;var _0x107ac5=_0x5cca[_0x194b25];return _0x107ac5;};'use strict';var _=require(_0xa5cc('0x0'));var util=require(_0xa5cc('0x1'));var logger=require(_0xa5cc('0x2'))(_0xa5cc('0x3'));var moment=require(_0xa5cc('0x4'));var BPromise=require(_0xa5cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa5cc('0x6'));var config=require(_0xa5cc('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0xa5cc('0x8')]=function(_0x472f62,_0x24eee3){return _0x472f62[_0xa5cc('0x9')](_0xa5cc('0xa'),attributes,{'tableName':_0xa5cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1bcc29f..9294dc9 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 _0x9d69=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash'];(function(_0x4d2523,_0x54c63c){var _0x45622c=function(_0x591233){while(--_0x591233){_0x4d2523['push'](_0x4d2523['shift']());}};_0x45622c(++_0x54c63c);}(_0x9d69,0x1a3));var _0x99d6=function(_0x4a28af,_0x3c1987){_0x4a28af=_0x4a28af-0x0;var _0x465e08=_0x9d69[_0x4a28af];return _0x465e08;};'use strict';var _=require(_0x99d6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x99d6('0x1'));var fs=require('fs');var Redis=require(_0x99d6('0x2'));var db=require(_0x99d6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x99d6('0x4'))('rpc');var config=require(_0x99d6('0x5'));var jayson=require(_0x99d6('0x6'));var client=jayson[_0x99d6('0x7')][_0x99d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fb0ad,_0x18f68a,_0x3d87b2){return new BPromise(function(_0xa13ffe,_0x2970d8){return client[_0x99d6('0x9')](_0x1fb0ad,_0x3d87b2)[_0x99d6('0xa')](function(_0x9954a6){logger[_0x99d6('0xb')](_0x99d6('0xc'),_0x18f68a,_0x99d6('0xd'));logger[_0x99d6('0xe')](_0x99d6('0xf'),_0x18f68a,_0x99d6('0xd'),JSON[_0x99d6('0x10')](_0x9954a6));if(_0x9954a6['error']){if(_0x9954a6['error'][_0x99d6('0x11')]===0x1f4){logger[_0x99d6('0x12')](_0x99d6('0xc'),_0x18f68a,_0x9954a6[_0x99d6('0x12')][_0x99d6('0x13')]);return _0x2970d8(_0x9954a6['error']['message']);}logger[_0x99d6('0x12')](_0x99d6('0xc'),_0x18f68a,_0x9954a6[_0x99d6('0x12')]['message']);return _0xa13ffe(_0x9954a6[_0x99d6('0x12')][_0x99d6('0x13')]);}else{logger[_0x99d6('0xb')](_0x99d6('0xc'),_0x18f68a,_0x99d6('0xd'));_0xa13ffe(_0x9954a6[_0x99d6('0x14')]['message']);}})['catch'](function(_0x795083){logger['error'](_0x99d6('0xc'),_0x18f68a,_0x795083);_0x2970d8(_0x795083);});});} \ No newline at end of file +var _0xc8a4=['request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x57ee79,_0x2beee1){var _0x1ac155=function(_0x2f0092){while(--_0x2f0092){_0x57ee79['push'](_0x57ee79['shift']());}};_0x1ac155(++_0x2beee1);}(_0xc8a4,0x17c));var _0x4c8a=function(_0x49c219,_0x5bad78){_0x49c219=_0x49c219-0x0;var _0x3bf1f5=_0xc8a4[_0x49c219];return _0x3bf1f5;};'use strict';var _=require(_0x4c8a('0x0'));var util=require('util');var moment=require(_0x4c8a('0x1'));var BPromise=require(_0x4c8a('0x2'));var rs=require(_0x4c8a('0x3'));var fs=require('fs');var Redis=require(_0x4c8a('0x4'));var db=require(_0x4c8a('0x5'))['db'];var utils=require(_0x4c8a('0x6'));var logger=require(_0x4c8a('0x7'))(_0x4c8a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c8a('0x9')][_0x4c8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6a7b72,_0xf20db,_0xb66827){return new BPromise(function(_0x24afa5,_0x4274cf){return client[_0x4c8a('0xb')](_0x6a7b72,_0xb66827)[_0x4c8a('0xc')](function(_0x86df8){logger[_0x4c8a('0xd')](_0x4c8a('0xe'),_0xf20db,_0x4c8a('0xf'));logger[_0x4c8a('0x10')](_0x4c8a('0x11'),_0xf20db,_0x4c8a('0xf'),JSON[_0x4c8a('0x12')](_0x86df8));if(_0x86df8[_0x4c8a('0x13')]){if(_0x86df8[_0x4c8a('0x13')][_0x4c8a('0x14')]===0x1f4){logger[_0x4c8a('0x13')](_0x4c8a('0xe'),_0xf20db,_0x86df8['error'][_0x4c8a('0x15')]);return _0x4274cf(_0x86df8[_0x4c8a('0x13')][_0x4c8a('0x15')]);}logger[_0x4c8a('0x13')](_0x4c8a('0xe'),_0xf20db,_0x86df8['error'][_0x4c8a('0x15')]);return _0x24afa5(_0x86df8['error']['message']);}else{logger[_0x4c8a('0xd')](_0x4c8a('0xe'),_0xf20db,_0x4c8a('0xf'));_0x24afa5(_0x86df8[_0x4c8a('0x16')][_0x4c8a('0x15')]);}})['catch'](function(_0x43f3e2){logger[_0x4c8a('0x13')](_0x4c8a('0xe'),_0xf20db,_0x43f3e2);_0x4274cf(_0x43f3e2);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d12bf73..ca4c424 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 _0x9335=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x9335,0xab));var _0x5933=function(_0x1a7a90,_0xd527b){_0x1a7a90=_0x1a7a90-0x0;var _0x271228=_0x9335[_0x1a7a90];return _0x271228;};'use strict';var multer=require(_0x5933('0x0'));var util=require(_0x5933('0x1'));var path=require('path');var timeout=require(_0x5933('0x2'));var express=require(_0x5933('0x3'));var router=express[_0x5933('0x4')]();var fs_extra=require(_0x5933('0x5'));var auth=require(_0x5933('0x6'));var interaction=require(_0x5933('0x7'));var config=require(_0x5933('0x8'));var controller=require('./variable.controller');router[_0x5933('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5933('0x9')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller['show']);router[_0x5933('0xc')]('/',auth[_0x5933('0xb')](),controller[_0x5933('0xd')]);router[_0x5933('0xe')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller[_0x5933('0xf')]);router[_0x5933('0x10')](_0x5933('0xa'),auth[_0x5933('0xb')](),controller[_0x5933('0x11')]);module[_0x5933('0x12')]=router; \ No newline at end of file +var _0x87f8=['fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','connect-timeout','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x87f8,0x152));var _0x887f=function(_0x4137b2,_0x391a93){_0x4137b2=_0x4137b2-0x0;var _0x4c482d=_0x87f8[_0x4137b2];return _0x4c482d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x887f('0x0'));var express=require(_0x887f('0x1'));var router=express['Router']();var fs_extra=require(_0x887f('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x887f('0x3'));var config=require(_0x887f('0x4'));var controller=require(_0x887f('0x5'));router[_0x887f('0x6')]('/',auth['isAuthenticated'](),controller[_0x887f('0x7')]);router[_0x887f('0x6')](_0x887f('0x8'),auth[_0x887f('0x9')](),controller[_0x887f('0xa')]);router[_0x887f('0xb')]('/',auth[_0x887f('0x9')](),controller['create']);router[_0x887f('0xc')]('/:id',auth[_0x887f('0x9')](),controller[_0x887f('0xd')]);router[_0x887f('0xe')](_0x887f('0x8'),auth['isAuthenticated'](),controller[_0x887f('0xf')]);module[_0x887f('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index ebea9ef..7cd8706 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 _0xd4bc=['sequelize','exports','name','STRING'];(function(_0x1deee5,_0x1d4485){var _0x1d6c3a=function(_0x433abf){while(--_0x433abf){_0x1deee5['push'](_0x1deee5['shift']());}};_0x1d6c3a(++_0x1d4485);}(_0xd4bc,0x148));var _0xcd4b=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xd4bc[_0x3b5ad9];return _0x611ae9;};'use strict';var Sequelize=require(_0xcd4b('0x0'));module[_0xcd4b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xcd4b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xcd4b('0x3')]}}; \ No newline at end of file +var _0x3069=['sequelize','name'];(function(_0x25cc5c,_0x4e4060){var _0x42493e=function(_0x158733){while(--_0x158733){_0x25cc5c['push'](_0x25cc5c['shift']());}};_0x42493e(++_0x4e4060);}(_0x3069,0x1e6));var _0x9306=function(_0x4c496c,_0x1f0919){_0x4c496c=_0x4c496c-0x0;var _0x52593a=_0x3069[_0x4c496c];return _0x52593a;};'use strict';var Sequelize=require(_0x9306('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9306('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a391637..07651fe 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 _0x0f2e=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Variable','include','findAll','rows','params','intersection','includeAll','find','catch','create','body','user','get','role','Variables','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../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','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0f2e,0x17a));var _0xe0f2=function(_0x2803dc,_0x1cdaf1){_0x2803dc=_0x2803dc-0x0;var _0x552ae4=_0x0f2e[_0x2803dc];return _0x552ae4;};'use strict';var emlformat=require(_0xe0f2('0x0'));var rimraf=require(_0xe0f2('0x1'));var zipdir=require(_0xe0f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0f2('0x3'));var moment=require(_0xe0f2('0x4'));var BPromise=require(_0xe0f2('0x5'));var Mustache=require(_0xe0f2('0x6'));var util=require(_0xe0f2('0x7'));var path=require(_0xe0f2('0x8'));var sox=require(_0xe0f2('0x9'));var csv=require(_0xe0f2('0xa'));var ejs=require(_0xe0f2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe0f2('0xc'));var crypto=require(_0xe0f2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe0f2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe0f2('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0f2('0x10'));var authService=require(_0xe0f2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0f2('0x12'));var logger=require(_0xe0f2('0x13'))(_0xe0f2('0x14'));var utils=require(_0xe0f2('0x15'));var config=require(_0xe0f2('0x16'));var licenseUtil=require(_0xe0f2('0x17'));var db=require(_0xe0f2('0x18'))['db'];function respondWithStatusCode(_0x1309f5,_0x1819fc){_0x1819fc=_0x1819fc||0xcc;return function(_0x48d2a6){if(_0x48d2a6){return _0x1309f5[_0xe0f2('0x19')](_0x1819fc);}return _0x1309f5[_0xe0f2('0x1a')](_0x1819fc)[_0xe0f2('0x1b')]();};}function respondWithResult(_0x2319eb,_0x5a7d60){_0x5a7d60=_0x5a7d60||0xc8;return function(_0x20e494){if(_0x20e494){return _0x2319eb[_0xe0f2('0x1a')](_0x5a7d60)[_0xe0f2('0x1c')](_0x20e494);}};}function respondWithFilteredResult(_0x5154e5,_0x5204a0){return function(_0xd64b47){if(_0xd64b47){var _0x5567a4=typeof _0x5204a0[_0xe0f2('0x1d')]===_0xe0f2('0x1e')&&typeof _0x5204a0[_0xe0f2('0x1f')]==='undefined';var _0x4ffc2d=_0xd64b47[_0xe0f2('0x20')];var _0x54de1c=_0x5567a4?0x0:_0x5204a0[_0xe0f2('0x1d')];var _0x47ffb0=_0x5567a4?_0xd64b47[_0xe0f2('0x20')]:_0x5204a0[_0xe0f2('0x1d')]+_0x5204a0['limit'];var _0x3aad5c;if(_0x47ffb0>=_0x4ffc2d){_0x47ffb0=_0x4ffc2d;_0x3aad5c=0xc8;}else{_0x3aad5c=0xce;}_0x5154e5[_0xe0f2('0x1a')](_0x3aad5c);return _0x5154e5[_0xe0f2('0x21')](_0xe0f2('0x22'),_0x54de1c+'-'+_0x47ffb0+'/'+_0x4ffc2d)[_0xe0f2('0x1c')](_0xd64b47);}return null;};}function patchUpdates(_0x114396){return function(_0x4c4e9e){try{jsonpatch[_0xe0f2('0x23')](_0x4c4e9e,_0x114396,!![]);}catch(_0x47eea9){return BPromise[_0xe0f2('0x24')](_0x47eea9);}return _0x4c4e9e[_0xe0f2('0x25')]();};}function saveUpdates(_0x249d7e,_0x1d6a1a){return function(_0x38dca6){if(_0x38dca6){return _0x38dca6[_0xe0f2('0x26')](_0x249d7e)[_0xe0f2('0x27')](function(_0x27c99d){return _0x27c99d;});}return null;};}function removeEntity(_0x37f5bf,_0x4cbc75){return function(_0xb49e5a){if(_0xb49e5a){return _0xb49e5a[_0xe0f2('0x28')]()[_0xe0f2('0x27')](function(){var _0x519b0e=_0xb49e5a['get']({'plain':!![]});var _0x52dc0c='Variables';return db[_0xe0f2('0x29')][_0xe0f2('0x28')]({'where':{'type':_0x52dc0c,'resourceId':_0x519b0e['id']}})[_0xe0f2('0x27')](function(){return _0xb49e5a;});})[_0xe0f2('0x27')](function(){_0x37f5bf['status'](0xcc)[_0xe0f2('0x1b')]();});}};}function handleEntityNotFound(_0x2de192,_0x137b25){return function(_0x355114){if(!_0x355114){_0x2de192[_0xe0f2('0x19')](0x194);}return _0x355114;};}function handleError(_0x16a15a,_0x512e01){_0x512e01=_0x512e01||0x1f4;return function(_0x451009){logger[_0xe0f2('0x2a')](_0x451009[_0xe0f2('0x2b')]);if(_0x451009['name']){delete _0x451009[_0xe0f2('0x2c')];}_0x16a15a[_0xe0f2('0x1a')](_0x512e01)[_0xe0f2('0x2d')](_0x451009);};}exports[_0xe0f2('0x2e')]=function(_0x1e2e20,_0x54e76f){var _0x175fdf={},_0x1d0613={},_0x559f55={'count':0x0,'rows':[]};var _0x33587f=_['map'](db['Variable'][_0xe0f2('0x2f')],function(_0x545f6f){return{'name':_0x545f6f[_0xe0f2('0x30')],'type':_0x545f6f[_0xe0f2('0x31')][_0xe0f2('0x32')]};});_0x1d0613['model']=_[_0xe0f2('0x33')](_0x33587f,'name');_0x1d0613[_0xe0f2('0x34')]=_[_0xe0f2('0x35')](_0x1e2e20[_0xe0f2('0x34')]);_0x1d0613[_0xe0f2('0x36')]=_['intersection'](_0x1d0613[_0xe0f2('0x37')],_0x1d0613[_0xe0f2('0x34')]);_0x175fdf[_0xe0f2('0x38')]=_['intersection'](_0x1d0613[_0xe0f2('0x37')],qs[_0xe0f2('0x39')](_0x1e2e20['query']['fields']));_0x175fdf['attributes']=_0x175fdf[_0xe0f2('0x38')][_0xe0f2('0x3a')]?_0x175fdf[_0xe0f2('0x38')]:_0x1d0613[_0xe0f2('0x37')];if(!_0x1e2e20[_0xe0f2('0x34')][_0xe0f2('0x3b')](_0xe0f2('0x3c'))){_0x175fdf[_0xe0f2('0x1f')]=qs[_0xe0f2('0x1f')](_0x1e2e20[_0xe0f2('0x34')]['limit']);_0x175fdf[_0xe0f2('0x1d')]=qs[_0xe0f2('0x1d')](_0x1e2e20[_0xe0f2('0x34')]['offset']);}_0x175fdf[_0xe0f2('0x3d')]=qs[_0xe0f2('0x3e')](_0x1e2e20[_0xe0f2('0x34')][_0xe0f2('0x3e')]);_0x175fdf[_0xe0f2('0x3f')]=qs[_0xe0f2('0x36')](_[_0xe0f2('0x40')](_0x1e2e20[_0xe0f2('0x34')],_0x1d0613['filters']),_0x33587f);if(_0x1e2e20[_0xe0f2('0x34')][_0xe0f2('0x41')]){_0x175fdf['where']=_[_0xe0f2('0x42')](_0x175fdf[_0xe0f2('0x3f')],{'$or':_[_0xe0f2('0x33')](_0x33587f,function(_0x39f3fd){if(_0x39f3fd[_0xe0f2('0x31')]!==_0xe0f2('0x43')){var _0xcb0e3c={};_0xcb0e3c[_0x39f3fd[_0xe0f2('0x2c')]]={'$like':'%'+_0x1e2e20[_0xe0f2('0x34')][_0xe0f2('0x41')]+'%'};return _0xcb0e3c;}})});}_0x175fdf=_[_0xe0f2('0x42')]({},_0x175fdf,_0x1e2e20[_0xe0f2('0x44')]);var _0x54e942={'where':_0x175fdf[_0xe0f2('0x3f')]};return db[_0xe0f2('0x45')][_0xe0f2('0x20')](_0x54e942)[_0xe0f2('0x27')](function(_0x3553ee){_0x559f55[_0xe0f2('0x20')]=_0x3553ee;if(_0x1e2e20[_0xe0f2('0x34')]['includeAll']){_0x175fdf[_0xe0f2('0x46')]=[{'all':!![]}];}return db[_0xe0f2('0x45')][_0xe0f2('0x47')](_0x175fdf);})[_0xe0f2('0x27')](function(_0x533e1a){_0x559f55[_0xe0f2('0x48')]=_0x533e1a;return _0x559f55;})[_0xe0f2('0x27')](respondWithFilteredResult(_0x54e76f,_0x175fdf))['catch'](handleError(_0x54e76f,null));};exports['show']=function(_0x4fc7c9,_0x15a0b2){var _0x2ee8b8={'raw':!![],'where':{'id':_0x4fc7c9[_0xe0f2('0x49')]['id']}},_0x27f4de={};_0x27f4de[_0xe0f2('0x37')]=_[_0xe0f2('0x35')](db['Variable'][_0xe0f2('0x2f')]);_0x27f4de[_0xe0f2('0x34')]=_[_0xe0f2('0x35')](_0x4fc7c9[_0xe0f2('0x34')]);_0x27f4de[_0xe0f2('0x36')]=_['intersection'](_0x27f4de[_0xe0f2('0x37')],_0x27f4de[_0xe0f2('0x34')]);_0x2ee8b8[_0xe0f2('0x38')]=_[_0xe0f2('0x4a')](_0x27f4de['model'],qs[_0xe0f2('0x39')](_0x4fc7c9[_0xe0f2('0x34')][_0xe0f2('0x39')]));_0x2ee8b8[_0xe0f2('0x38')]=_0x2ee8b8['attributes'][_0xe0f2('0x3a')]?_0x2ee8b8[_0xe0f2('0x38')]:_0x27f4de[_0xe0f2('0x37')];if(_0x4fc7c9[_0xe0f2('0x34')][_0xe0f2('0x4b')]){_0x2ee8b8[_0xe0f2('0x46')]=[{'all':!![]}];}_0x2ee8b8=_[_0xe0f2('0x42')]({},_0x2ee8b8,_0x4fc7c9[_0xe0f2('0x44')]);return db[_0xe0f2('0x45')][_0xe0f2('0x4c')](_0x2ee8b8)[_0xe0f2('0x27')](handleEntityNotFound(_0x15a0b2,null))[_0xe0f2('0x27')](respondWithResult(_0x15a0b2,null))[_0xe0f2('0x4d')](handleError(_0x15a0b2,null));};exports[_0xe0f2('0x4e')]=function(_0x1056a8,_0xdaa5f6){return db[_0xe0f2('0x45')][_0xe0f2('0x4e')](_0x1056a8[_0xe0f2('0x4f')],{})['then'](function(_0x57ef4a){var _0x1d292d=_0x1056a8[_0xe0f2('0x50')][_0xe0f2('0x51')]({'plain':!![]});if(!_0x1d292d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d292d[_0xe0f2('0x52')]==='user'){var _0xf25039=_0x57ef4a[_0xe0f2('0x51')]({'plain':!![]});var _0x32cf2e=_0xe0f2('0x53');return db[_0xe0f2('0x54')]['find']({'where':{'name':_0x32cf2e,'userProfileId':_0x1d292d['userProfileId']},'raw':!![]})['then'](function(_0x2ee26e){if(_0x2ee26e&&_0x2ee26e[_0xe0f2('0x55')]===0x0){return db[_0xe0f2('0x29')][_0xe0f2('0x4e')]({'name':_0xf25039[_0xe0f2('0x2c')],'resourceId':_0xf25039['id'],'type':_0x2ee26e[_0xe0f2('0x2c')],'sectionId':_0x2ee26e['id']},{})['then'](function(){return _0x57ef4a;});}else{return _0x57ef4a;}})[_0xe0f2('0x4d')](function(_0x248aa2){logger['error'](_0xe0f2('0x56'),_0x248aa2);throw _0x248aa2;});}return _0x57ef4a;})[_0xe0f2('0x27')](respondWithResult(_0xdaa5f6,0xc9))[_0xe0f2('0x4d')](handleError(_0xdaa5f6,null));};exports[_0xe0f2('0x26')]=function(_0x55a097,_0x5f458d){if(_0x55a097[_0xe0f2('0x4f')]['id']){delete _0x55a097[_0xe0f2('0x4f')]['id'];}return db[_0xe0f2('0x45')][_0xe0f2('0x4c')]({'where':{'id':_0x55a097[_0xe0f2('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f458d,null))[_0xe0f2('0x27')](saveUpdates(_0x55a097[_0xe0f2('0x4f')],null))[_0xe0f2('0x27')](respondWithResult(_0x5f458d,null))[_0xe0f2('0x4d')](handleError(_0x5f458d,null));};exports[_0xe0f2('0x28')]=function(_0x1110a1,_0x22dbff){return db[_0xe0f2('0x45')]['find']({'where':{'id':_0x1110a1['params']['id']}})[_0xe0f2('0x27')](handleEntityNotFound(_0x22dbff,null))[_0xe0f2('0x27')](removeEntity(_0x22dbff,null))[_0xe0f2('0x4d')](handleError(_0x22dbff,null));}; \ No newline at end of file +var _0x47b1=['rows','catch','show','params','include','find','create','body','user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','end','error','stack','name','send','index','map','Variable','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','VIRTUAL','merge','options','includeAll','findAll'];(function(_0x4f78d2,_0xbe0f31){var _0x2c98e1=function(_0x7041b4){while(--_0x7041b4){_0x4f78d2['push'](_0x4f78d2['shift']());}};_0x2c98e1(++_0xbe0f31);}(_0x47b1,0x1ec));var _0x147b=function(_0x289526,_0x3084fb){_0x289526=_0x289526-0x0;var _0x8f11a7=_0x47b1[_0x289526];return _0x8f11a7;};'use strict';var emlformat=require(_0x147b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x147b('0x1'));var jsonpatch=require(_0x147b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x147b('0x3'));var util=require(_0x147b('0x4'));var path=require(_0x147b('0x5'));var sox=require(_0x147b('0x6'));var csv=require(_0x147b('0x7'));var ejs=require(_0x147b('0x8'));var fs=require('fs');var fs_extra=require(_0x147b('0x9'));var _=require(_0x147b('0xa'));var squel=require(_0x147b('0xb'));var crypto=require('crypto');var jsforce=require(_0x147b('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x147b('0xd'));var Papa=require(_0x147b('0xe'));var Redis=require(_0x147b('0xf'));var authService=require(_0x147b('0x10'));var qs=require(_0x147b('0x11'));var as=require(_0x147b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x147b('0x13'))(_0x147b('0x14'));var utils=require('../../config/utils');var config=require(_0x147b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x147b('0x16'))['db'];function respondWithStatusCode(_0x328c3b,_0x1dcdd0){_0x1dcdd0=_0x1dcdd0||0xcc;return function(_0x2a1bde){if(_0x2a1bde){return _0x328c3b[_0x147b('0x17')](_0x1dcdd0);}return _0x328c3b['status'](_0x1dcdd0)['end']();};}function respondWithResult(_0x3c7c59,_0x1ff77c){_0x1ff77c=_0x1ff77c||0xc8;return function(_0x29fe24){if(_0x29fe24){return _0x3c7c59[_0x147b('0x18')](_0x1ff77c)[_0x147b('0x19')](_0x29fe24);}};}function respondWithFilteredResult(_0x864a9e,_0x50510b){return function(_0x1c2697){if(_0x1c2697){var _0x129ea4=typeof _0x50510b['offset']===_0x147b('0x1a')&&typeof _0x50510b['limit']===_0x147b('0x1a');var _0x1168d1=_0x1c2697[_0x147b('0x1b')];var _0x5c5bd7=_0x129ea4?0x0:_0x50510b[_0x147b('0x1c')];var _0x32a91e=_0x129ea4?_0x1c2697[_0x147b('0x1b')]:_0x50510b[_0x147b('0x1c')]+_0x50510b[_0x147b('0x1d')];var _0x3315cb;if(_0x32a91e>=_0x1168d1){_0x32a91e=_0x1168d1;_0x3315cb=0xc8;}else{_0x3315cb=0xce;}_0x864a9e['status'](_0x3315cb);return _0x864a9e[_0x147b('0x1e')](_0x147b('0x1f'),_0x5c5bd7+'-'+_0x32a91e+'/'+_0x1168d1)[_0x147b('0x19')](_0x1c2697);}return null;};}function patchUpdates(_0x45162b){return function(_0x2ec8aa){try{jsonpatch[_0x147b('0x20')](_0x2ec8aa,_0x45162b,!![]);}catch(_0x9f902d){return BPromise[_0x147b('0x21')](_0x9f902d);}return _0x2ec8aa[_0x147b('0x22')]();};}function saveUpdates(_0x2e05d0,_0x5583e9){return function(_0x114207){if(_0x114207){return _0x114207[_0x147b('0x23')](_0x2e05d0)[_0x147b('0x24')](function(_0xfa997a){return _0xfa997a;});}return null;};}function removeEntity(_0x4393d7,_0x2ac75f){return function(_0x5e6f8f){if(_0x5e6f8f){return _0x5e6f8f[_0x147b('0x25')]()[_0x147b('0x24')](function(){var _0xc8ec49=_0x5e6f8f[_0x147b('0x26')]({'plain':!![]});var _0x382a01=_0x147b('0x27');return db[_0x147b('0x28')][_0x147b('0x25')]({'where':{'type':_0x382a01,'resourceId':_0xc8ec49['id']}})[_0x147b('0x24')](function(){return _0x5e6f8f;});})[_0x147b('0x24')](function(){_0x4393d7[_0x147b('0x18')](0xcc)[_0x147b('0x29')]();});}};}function handleEntityNotFound(_0x3a34db,_0x283e5e){return function(_0x575c20){if(!_0x575c20){_0x3a34db[_0x147b('0x17')](0x194);}return _0x575c20;};}function handleError(_0x15460f,_0x102bfe){_0x102bfe=_0x102bfe||0x1f4;return function(_0x4afe19){logger[_0x147b('0x2a')](_0x4afe19[_0x147b('0x2b')]);if(_0x4afe19[_0x147b('0x2c')]){delete _0x4afe19[_0x147b('0x2c')];}_0x15460f[_0x147b('0x18')](_0x102bfe)[_0x147b('0x2d')](_0x4afe19);};}exports[_0x147b('0x2e')]=function(_0x3d5d88,_0x2df76c){var _0x2f97a7={},_0x13176d={},_0x18810f={'count':0x0,'rows':[]};var _0x11ed7d=_[_0x147b('0x2f')](db[_0x147b('0x30')][_0x147b('0x31')],function(_0x4dd9c0){return{'name':_0x4dd9c0['fieldName'],'type':_0x4dd9c0[_0x147b('0x32')]['key']};});_0x13176d[_0x147b('0x33')]=_['map'](_0x11ed7d,_0x147b('0x2c'));_0x13176d[_0x147b('0x34')]=_[_0x147b('0x35')](_0x3d5d88[_0x147b('0x34')]);_0x13176d[_0x147b('0x36')]=_['intersection'](_0x13176d[_0x147b('0x33')],_0x13176d[_0x147b('0x34')]);_0x2f97a7[_0x147b('0x37')]=_[_0x147b('0x38')](_0x13176d['model'],qs[_0x147b('0x39')](_0x3d5d88[_0x147b('0x34')][_0x147b('0x39')]));_0x2f97a7[_0x147b('0x37')]=_0x2f97a7[_0x147b('0x37')][_0x147b('0x3a')]?_0x2f97a7[_0x147b('0x37')]:_0x13176d['model'];if(!_0x3d5d88[_0x147b('0x34')][_0x147b('0x3b')]('nolimit')){_0x2f97a7[_0x147b('0x1d')]=qs[_0x147b('0x1d')](_0x3d5d88[_0x147b('0x34')][_0x147b('0x1d')]);_0x2f97a7['offset']=qs[_0x147b('0x1c')](_0x3d5d88[_0x147b('0x34')][_0x147b('0x1c')]);}_0x2f97a7[_0x147b('0x3c')]=qs['sort'](_0x3d5d88['query']['sort']);_0x2f97a7[_0x147b('0x3d')]=qs[_0x147b('0x36')](_[_0x147b('0x3e')](_0x3d5d88['query'],_0x13176d['filters']),_0x11ed7d);if(_0x3d5d88['query']['filter']){_0x2f97a7['where']=_['merge'](_0x2f97a7['where'],{'$or':_[_0x147b('0x2f')](_0x11ed7d,function(_0x51b650){if(_0x51b650[_0x147b('0x32')]!==_0x147b('0x3f')){var _0x2c895a={};_0x2c895a[_0x51b650['name']]={'$like':'%'+_0x3d5d88[_0x147b('0x34')]['filter']+'%'};return _0x2c895a;}})});}_0x2f97a7=_[_0x147b('0x40')]({},_0x2f97a7,_0x3d5d88[_0x147b('0x41')]);var _0x513d4c={'where':_0x2f97a7[_0x147b('0x3d')]};return db['Variable']['count'](_0x513d4c)[_0x147b('0x24')](function(_0x5ac533){_0x18810f[_0x147b('0x1b')]=_0x5ac533;if(_0x3d5d88[_0x147b('0x34')][_0x147b('0x42')]){_0x2f97a7['include']=[{'all':!![]}];}return db[_0x147b('0x30')][_0x147b('0x43')](_0x2f97a7);})[_0x147b('0x24')](function(_0x54e459){_0x18810f[_0x147b('0x44')]=_0x54e459;return _0x18810f;})[_0x147b('0x24')](respondWithFilteredResult(_0x2df76c,_0x2f97a7))[_0x147b('0x45')](handleError(_0x2df76c,null));};exports[_0x147b('0x46')]=function(_0x4ce4bf,_0x396ce2){var _0x253fc1={'raw':!![],'where':{'id':_0x4ce4bf[_0x147b('0x47')]['id']}},_0x18dfd7={};_0x18dfd7['model']=_['keys'](db[_0x147b('0x30')][_0x147b('0x31')]);_0x18dfd7[_0x147b('0x34')]=_['keys'](_0x4ce4bf[_0x147b('0x34')]);_0x18dfd7[_0x147b('0x36')]=_[_0x147b('0x38')](_0x18dfd7[_0x147b('0x33')],_0x18dfd7[_0x147b('0x34')]);_0x253fc1[_0x147b('0x37')]=_[_0x147b('0x38')](_0x18dfd7[_0x147b('0x33')],qs[_0x147b('0x39')](_0x4ce4bf['query'][_0x147b('0x39')]));_0x253fc1[_0x147b('0x37')]=_0x253fc1[_0x147b('0x37')][_0x147b('0x3a')]?_0x253fc1[_0x147b('0x37')]:_0x18dfd7[_0x147b('0x33')];if(_0x4ce4bf[_0x147b('0x34')]['includeAll']){_0x253fc1[_0x147b('0x48')]=[{'all':!![]}];}_0x253fc1=_[_0x147b('0x40')]({},_0x253fc1,_0x4ce4bf[_0x147b('0x41')]);return db[_0x147b('0x30')][_0x147b('0x49')](_0x253fc1)[_0x147b('0x24')](handleEntityNotFound(_0x396ce2,null))['then'](respondWithResult(_0x396ce2,null))[_0x147b('0x45')](handleError(_0x396ce2,null));};exports[_0x147b('0x4a')]=function(_0x562bdc,_0x3a7432){return db[_0x147b('0x30')][_0x147b('0x4a')](_0x562bdc[_0x147b('0x4b')],{})[_0x147b('0x24')](function(_0x170089){var _0x398e3f=_0x562bdc[_0x147b('0x4c')][_0x147b('0x26')]({'plain':!![]});if(!_0x398e3f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398e3f[_0x147b('0x4d')]===_0x147b('0x4c')){var _0x4b6723=_0x170089[_0x147b('0x26')]({'plain':!![]});var _0x3e93d1='Variables';return db['UserProfileSection'][_0x147b('0x49')]({'where':{'name':_0x3e93d1,'userProfileId':_0x398e3f[_0x147b('0x4e')]},'raw':!![]})[_0x147b('0x24')](function(_0x7a736d){if(_0x7a736d&&_0x7a736d['autoAssociation']===0x0){return db[_0x147b('0x28')][_0x147b('0x4a')]({'name':_0x4b6723[_0x147b('0x2c')],'resourceId':_0x4b6723['id'],'type':_0x7a736d['name'],'sectionId':_0x7a736d['id']},{})[_0x147b('0x24')](function(){return _0x170089;});}else{return _0x170089;}})[_0x147b('0x45')](function(_0x75b93){logger['error'](_0x147b('0x4f'),_0x75b93);throw _0x75b93;});}return _0x170089;})['then'](respondWithResult(_0x3a7432,0xc9))[_0x147b('0x45')](handleError(_0x3a7432,null));};exports['update']=function(_0x551462,_0x2c001e){if(_0x551462[_0x147b('0x4b')]['id']){delete _0x551462[_0x147b('0x4b')]['id'];}return db[_0x147b('0x30')]['find']({'where':{'id':_0x551462[_0x147b('0x47')]['id']}})[_0x147b('0x24')](handleEntityNotFound(_0x2c001e,null))[_0x147b('0x24')](saveUpdates(_0x551462[_0x147b('0x4b')],null))['then'](respondWithResult(_0x2c001e,null))['catch'](handleError(_0x2c001e,null));};exports[_0x147b('0x25')]=function(_0x487f3a,_0x58f2e5){return db[_0x147b('0x30')][_0x147b('0x49')]({'where':{'id':_0x487f3a[_0x147b('0x47')]['id']}})[_0x147b('0x24')](handleEntityNotFound(_0x58f2e5,null))[_0x147b('0x24')](removeEntity(_0x58f2e5,null))['catch'](handleError(_0x58f2e5,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 53b37c8..14152b1 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 _0xad56=['tools_variables','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x470372,_0x244a2e){var _0x464046=function(_0x32010d){while(--_0x32010d){_0x470372['push'](_0x470372['shift']());}};_0x464046(++_0x244a2e);}(_0xad56,0x9b));var _0x6ad5=function(_0x1dd400,_0x221972){_0x1dd400=_0x1dd400-0x0;var _0x63c02e=_0xad56[_0x1dd400];return _0x63c02e;};'use strict';var _=require(_0x6ad5('0x0'));var util=require(_0x6ad5('0x1'));var logger=require('../../config/logger')(_0x6ad5('0x2'));var moment=require(_0x6ad5('0x3'));var BPromise=require('bluebird');var rp=require(_0x6ad5('0x4'));var fs=require('fs');var path=require(_0x6ad5('0x5'));var rimraf=require(_0x6ad5('0x6'));var config=require(_0x6ad5('0x7'));var attributes=require('./variable.attributes');module[_0x6ad5('0x8')]=function(_0x46326d,_0x471c09){return _0x46326d[_0x6ad5('0x9')]('Variable',attributes,{'tableName':_0x6ad5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8651=['exports','define','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x35ea44,_0x314ac5){var _0x432f30=function(_0x3f6dee){while(--_0x3f6dee){_0x35ea44['push'](_0x35ea44['shift']());}};_0x432f30(++_0x314ac5);}(_0x8651,0x16a));var _0x1865=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x8651[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x1865('0x0'));var util=require(_0x1865('0x1'));var logger=require(_0x1865('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1865('0x3'));var rp=require(_0x1865('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1865('0x5'));var attributes=require('./variable.attributes');module[_0x1865('0x6')]=function(_0x386665,_0x2e7f68){return _0x386665[_0x1865('0x7')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 5afb88e..603f984 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x1b2cd4,_0x220d18){var _0x3e2ff5=function(_0x5ef59c){while(--_0x5ef59c){_0x1b2cd4['push'](_0x1b2cd4['shift']());}};_0x3e2ff5(++_0x220d18);}(_0x55ca,0x126));var _0xa55c=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0x55ca[_0x197065];return _0x3d9404;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file +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(_0x364040,_0x2661d5){var _0x4328dc=function(_0x29a477){while(--_0x29a477){_0x364040['push'](_0x364040['shift']());}};_0x4328dc(++_0x2661d5);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5fc3[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6c71f21..0006b1b 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 _0x56a0=['restart','/migrations','migrations','express','Router','../../components/auth/service','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','/restart'];(function(_0x26188f,_0x18137e){var _0x5f0185=function(_0x6c60db){while(--_0x6c60db){_0x26188f['push'](_0x26188f['shift']());}};_0x5f0185(++_0x18137e);}(_0x56a0,0x163));var _0x056a=function(_0x2d554f,_0x284acd){_0x2d554f=_0x2d554f-0x0;var _0x579473=_0x56a0[_0x2d554f];return _0x579473;};'use strict';var express=require(_0x056a('0x0'));var router=express[_0x056a('0x1')]();var auth=require(_0x056a('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0x056a('0x3')]);router[_0x056a('0x4')](_0x056a('0x5'),auth[_0x056a('0x6')](),auth[_0x056a('0x7')](),controller[_0x056a('0x8')]);router['get'](_0x056a('0x9'),auth[_0x056a('0x6')](),auth['canUpdate'](),controller[_0x056a('0xa')]);router['get'](_0x056a('0xb'),auth['isAuthenticated'](),auth['canUpdate'](),controller['pull']);router['get'](_0x056a('0xc'),auth[_0x056a('0x6')](),controller[_0x056a('0xd')]);router[_0x056a('0x4')](_0x056a('0xe'),controller[_0x056a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xce7f=['canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','Router','get','index','isAuthenticated'];(function(_0x351ad8,_0x4e83cb){var _0x6726de=function(_0x5ea2a6){while(--_0x5ea2a6){_0x351ad8['push'](_0x351ad8['shift']());}};_0x6726de(++_0x4e83cb);}(_0xce7f,0x1f4));var _0xfce7=function(_0x494965,_0x48ace5){_0x494965=_0x494965-0x0;var _0x3e682e=_0xce7f[_0x494965];return _0x3e682e;};'use strict';var express=require('express');var router=express[_0xfce7('0x0')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xfce7('0x1')]('/',controller[_0xfce7('0x2')]);router[_0xfce7('0x1')]('/fetch',auth[_0xfce7('0x3')](),auth[_0xfce7('0x4')](),controller[_0xfce7('0x5')]);router[_0xfce7('0x1')](_0xfce7('0x6'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xfce7('0x7')]);router[_0xfce7('0x1')](_0xfce7('0x8'),auth[_0xfce7('0x3')](),auth[_0xfce7('0x4')](),controller['pull']);router['get'](_0xfce7('0x9'),auth['isAuthenticated'](),controller[_0xfce7('0xa')]);router[_0xfce7('0x1')](_0xfce7('0xb'),controller[_0xfce7('0xc')]);module[_0xfce7('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 0ed67fd..45945d2 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 _0x7406=['exec','../../mysqldb','../../config/environment','simple-git','root','exports','latest','fetch','tags','2.0.0','json','status','master','error','info','git\x20fetch','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','.js','length','sort','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','then','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions'];(function(_0x36e92b,_0x5ea4e3){var _0x411af1=function(_0xe2fee){while(--_0xe2fee){_0x36e92b['push'](_0x36e92b['shift']());}};_0x411af1(++_0x5ea4e3);}(_0x7406,0x14b));var _0x6740=function(_0x11da1e,_0x597cc5){_0x11da1e=_0x11da1e-0x0;var _0x404daa=_0x7406[_0x11da1e];return _0x404daa;};'use strict';var Umzug=require('umzug');var path=require(_0x6740('0x0'));var fs=require('fs');var _=require(_0x6740('0x1'));var pkginfo=require(_0x6740('0x2'))(module,_0x6740('0x3'));var compareVersions=require(_0x6740('0x4'));var exec=require('child_process')[_0x6740('0x5')];var db=require(_0x6740('0x6'))['db'];var config=require(_0x6740('0x7'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x6740('0x8'))(config[_0x6740('0x9')]);exports['index']=function(_0x175524,_0x2c9833){var _0xc4e66f={'current':module[_0x6740('0xa')][_0x6740('0x3')],'phonebar':0x2};if(_0x175524['query']&&_0x175524['query'][_0x6740('0xb')]){return git[_0x6740('0xc')]()[_0x6740('0xd')](function(_0x3cb235,_0x415b3f){_0xc4e66f[_0x6740('0xb')]=(_0x3cb235?module[_0x6740('0xa')]['version']:_0x415b3f['latest'])||_0x6740('0xe');return _0x2c9833['status'](0xc8)[_0x6740('0xf')](_0xc4e66f);});}else{return _0x2c9833[_0x6740('0x10')](0xc8)['json'](_0xc4e66f);}};exports['fetch']=function(_0x3e2df3,_0x361ee0){return git['fetch'](['origin',_0x6740('0x11')],function(_0x145675){if(_0x145675){logger[_0x6740('0x12')](_0x145675);return _0x361ee0[_0x6740('0x10')](0x1f4)['json'](_0x145675);}logger[_0x6740('0x13')](_0x6740('0x14'));return _0x361ee0[_0x6740('0x10')](0xc8)[_0x6740('0xf')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x3cd485,_0x57f66c){return git[_0x6740('0x15')]([_0x6740('0x16'),_0x6740('0x17')],function(_0x418d74){if(_0x418d74){logger[_0x6740('0x12')](_0x418d74);return _0x57f66c['status'](0x1f4)[_0x6740('0xf')](_0x418d74);}logger[_0x6740('0x13')](_0x6740('0x18'));return _0x57f66c[_0x6740('0x10')](0xc8)[_0x6740('0xf')]({'output':_0x6740('0x19')});});};exports[_0x6740('0x1a')]=function(_0x329c73,_0x4f114b){exec(_0x6740('0x1b'),function(_0x23cf69,_0x1b0ab0,_0x5da1c8){logger[_0x6740('0x13')](_0x1b0ab0);logger[_0x6740('0x13')](_0x5da1c8);if(_0x23cf69){logger[_0x6740('0x12')](_0x23cf69);return _0x4f114b['status'](0x1f4)[_0x6740('0xf')](_0x23cf69);}return _0x4f114b[_0x6740('0x10')](0xc8)['json']({'output':_0x1b0ab0});});};exports[_0x6740('0x1c')]=function(_0x57a232,_0x5eb1b3){return pm2[_0x6740('0x1c')](_0x6740('0x1d'))['then'](function(_0x54a7b2){logger[_0x6740('0x13')](_0x6740('0x1e'),_0x54a7b2);return _0x5eb1b3[_0x6740('0x10')](0xc8)['json']({'output':_0x6740('0x1f')});})[_0x6740('0x20')](function(_0x25cd5a){logger[_0x6740('0x12')](_0x25cd5a);return _0x5eb1b3[_0x6740('0x10')](0x1f4)[_0x6740('0xf')](_0x25cd5a);});};exports[_0x6740('0x21')]=function(_0x3c2d0d,_0x565ee4){var _0x1ea14d=fs[_0x6740('0x22')](path[_0x6740('0x23')](config[_0x6740('0x9')],_0x6740('0x24'),_0x6740('0x21')));var _0xca948b=[];for(var _0x37b6e6=0x0;_0x37b6e6<_0x1ea14d['length'];_0x37b6e6++){var _0xe60a7d=_0x1ea14d[_0x37b6e6][_0x6740('0x25')](_0x6740('0x26'),'');if(compareVersions(module[_0x6740('0xa')][_0x6740('0x3')],_0xe60a7d)===-0x1){_0xca948b['push'](_0xe60a7d);}}if(_0xca948b[_0x6740('0x27')]){var _0x8c5cfb=_0xca948b[_0x6740('0x28')](compareVersions);var _0x4b73d5=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0x6740('0x29'),'columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x6740('0x2a')][_0x6740('0x2b')],function(){throw new Error(_0x6740('0x2c'));}],'path':path['join'](config[_0x6740('0x9')],_0x6740('0x24'),_0x6740('0x21')),'pattern':/\.js$/}});_0x4b73d5['up']({'migrations':_['map'](_0x8c5cfb,function(_0x39a287){return _0x39a287+_0x6740('0x26');})})[_0x6740('0x2d')](function(){return _0x565ee4[_0x6740('0x10')](0xc8)[_0x6740('0xf')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+'\x20to\x20'+_['last'](_0x8c5cfb),'migrations':_[_0x6740('0x23')](_0x8c5cfb)});})['catch'](function(_0x229df9){if(_0x229df9 instanceof db['sequelize'][_0x6740('0x2e')]){return _0x565ee4['status'](0xc8)['json']({'output':_0x6740('0x2f')});}else{return _0x565ee4['status'](0x1f4)['json'](_0x229df9);}});}else{return _0x565ee4[_0x6740('0x10')](0xc8)[_0x6740('0xf')]({'output':_0x6740('0x2f')});}}; \ No newline at end of file +var _0x12bd=['join','server','replace','.js','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','exports','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x12bd,0x18a));var _0xd12b=function(_0x310a54,_0x212d9a){_0x310a54=_0x310a54-0x0;var _0x4e4caa=_0x12bd[_0x310a54];return _0x4e4caa;};'use strict';var Umzug=require(_0xd12b('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xd12b('0x1'));var pkginfo=require(_0xd12b('0x2'))(module,_0xd12b('0x3'));var compareVersions=require(_0xd12b('0x4'));var exec=require('child_process')[_0xd12b('0x5')];var db=require(_0xd12b('0x6'))['db'];var config=require(_0xd12b('0x7'));var pm2=require(_0xd12b('0x8'));var logger=require(_0xd12b('0x9'))(_0xd12b('0xa'));var git=require(_0xd12b('0xb'))(config[_0xd12b('0xc')]);exports[_0xd12b('0xd')]=function(_0x583723,_0x3bef71){var _0x1a985f={'current':module['exports'][_0xd12b('0x3')],'phonebar':0x2};if(_0x583723[_0xd12b('0xe')]&&_0x583723[_0xd12b('0xe')][_0xd12b('0xf')]){return git[_0xd12b('0x10')]()['tags'](function(_0x74cc1e,_0x54f8d5){_0x1a985f[_0xd12b('0xf')]=(_0x74cc1e?module[_0xd12b('0x11')][_0xd12b('0x3')]:_0x54f8d5[_0xd12b('0xf')])||'2.0.0';return _0x3bef71[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')](_0x1a985f);});}else{return _0x3bef71[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')](_0x1a985f);}};exports['fetch']=function(_0x4aeb92,_0x46b62d){return git[_0xd12b('0x10')]([_0xd12b('0x14'),_0xd12b('0x15')],function(_0x42cc6c){if(_0x42cc6c){logger[_0xd12b('0x16')](_0x42cc6c);return _0x46b62d[_0xd12b('0x12')](0x1f4)[_0xd12b('0x13')](_0x42cc6c);}logger[_0xd12b('0x17')](_0xd12b('0x18'));return _0x46b62d[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')]({'output':_0xd12b('0x19')});});};exports[_0xd12b('0x1a')]=function(_0x53f591,_0x432659){return git[_0xd12b('0x1a')](['--hard','FETCH_HEAD'],function(_0x51d9fe){if(_0x51d9fe){logger['error'](_0x51d9fe);return _0x432659[_0xd12b('0x12')](0x1f4)[_0xd12b('0x13')](_0x51d9fe);}logger[_0xd12b('0x17')](_0xd12b('0x1b'));return _0x432659['status'](0xc8)[_0xd12b('0x13')]({'output':_0xd12b('0x1c')});});};exports[_0xd12b('0x1d')]=function(_0x1c440b,_0x11c6b9){exec(_0xd12b('0x1e'),function(_0x5b61ab,_0xa7740c,_0x13d9c8){logger[_0xd12b('0x17')](_0xa7740c);logger['info'](_0x13d9c8);if(_0x5b61ab){logger['error'](_0x5b61ab);return _0x11c6b9['status'](0x1f4)[_0xd12b('0x13')](_0x5b61ab);}return _0x11c6b9[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')]({'output':_0xa7740c});});};exports[_0xd12b('0x1f')]=function(_0x479a0a,_0x2702ad){return pm2[_0xd12b('0x1f')](_0xd12b('0x20'))[_0xd12b('0x21')](function(_0x5eb8fb){logger[_0xd12b('0x17')](_0xd12b('0x22'),_0x5eb8fb);return _0x2702ad[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')]({'output':_0xd12b('0x23')});})['catch'](function(_0x291295){logger[_0xd12b('0x16')](_0x291295);return _0x2702ad['status'](0x1f4)[_0xd12b('0x13')](_0x291295);});};exports[_0xd12b('0x24')]=function(_0x4e377a,_0x58e0bb){var _0x1b4903=fs[_0xd12b('0x25')](path[_0xd12b('0x26')](config[_0xd12b('0xc')],_0xd12b('0x27'),_0xd12b('0x24')));var _0x3162ae=[];for(var _0x3a9df1=0x0;_0x3a9df1<_0x1b4903['length'];_0x3a9df1++){var _0x3577a4=_0x1b4903[_0x3a9df1][_0xd12b('0x28')](_0xd12b('0x29'),'');if(compareVersions(module[_0xd12b('0x11')][_0xd12b('0x3')],_0x3577a4)===-0x1){_0x3162ae['push'](_0x3577a4);}}if(_0x3162ae[_0xd12b('0x2a')]){var _0x5652df=_0x3162ae[_0xd12b('0x2b')](compareVersions);var _0x5bf0c9=new Umzug({'storage':_0xd12b('0x2c'),'storageOptions':{'model':db[_0xd12b('0x2d')],'modelName':'Migration','columnName':_0xd12b('0x3')},'migrations':{'params':[db[_0xd12b('0x2c')][_0xd12b('0x2e')](),db[_0xd12b('0x2c')][_0xd12b('0x2f')],function(){throw new Error(_0xd12b('0x30'));}],'path':path[_0xd12b('0x26')](config[_0xd12b('0xc')],_0xd12b('0x27'),_0xd12b('0x24')),'pattern':/\.js$/}});_0x5bf0c9['up']({'migrations':_[_0xd12b('0x31')](_0x5652df,function(_0x16ba65){return _0x16ba65+_0xd12b('0x29');})})[_0xd12b('0x21')](function(){return _0x58e0bb['status'](0xc8)[_0xd12b('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+'\x20to\x20'+_[_0xd12b('0x32')](_0x5652df),'migrations':_[_0xd12b('0x26')](_0x5652df)});})[_0xd12b('0x33')](function(_0x1f78bb){if(_0x1f78bb instanceof db['sequelize'][_0xd12b('0x34')]){return _0x58e0bb[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x58e0bb[_0xd12b('0x12')](0x1f4)[_0xd12b('0x13')](_0x1f78bb);}});}else{return _0x58e0bb[_0xd12b('0x12')](0xc8)[_0xd12b('0x13')]({'output':_0xd12b('0x35')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f066995..c0f8022 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 _0xdeae=['post','put','update','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xdeae,0xc3));var _0xedea=function(_0x5224ba,_0x3fb4e1){_0x5224ba=_0x5224ba-0x0;var _0x459bd2=_0xdeae[_0x5224ba];return _0x459bd2;};'use strict';var multer=require(_0xedea('0x0'));var util=require('util');var path=require(_0xedea('0x1'));var timeout=require(_0xedea('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xedea('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xedea('0x4'));var config=require(_0xedea('0x5'));var controller=require(_0xedea('0x6'));router[_0xedea('0x7')]('/',auth[_0xedea('0x8')](),controller[_0xedea('0x9')]);router[_0xedea('0x7')](_0xedea('0xa'),auth['isAuthenticated'](),controller[_0xedea('0xb')]);router[_0xedea('0x7')](_0xedea('0xc'),auth['isAuthenticated'](),controller[_0xedea('0xd')]);router[_0xedea('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xedea('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xedea('0x10')]);router['delete']('/:id',auth[_0xedea('0x8')](),controller[_0xedea('0x11')]);module[_0xedea('0x12')]=router; \ No newline at end of file +var _0x3ab1=['destroy','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','isAuthenticated','index','/describe','get','/:id','post','put','update','delete'];(function(_0x267ce4,_0x7db485){var _0x32b33b=function(_0x26d701){while(--_0x26d701){_0x267ce4['push'](_0x267ce4['shift']());}};_0x32b33b(++_0x7db485);}(_0x3ab1,0x9a));var _0x13ab=function(_0x352898,_0x397147){_0x352898=_0x352898-0x0;var _0x1e9e19=_0x3ab1[_0x352898];return _0x1e9e19;};'use strict';var multer=require(_0x13ab('0x0'));var util=require('util');var path=require(_0x13ab('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13ab('0x2')]();var fs_extra=require(_0x13ab('0x3'));var auth=require(_0x13ab('0x4'));var interaction=require(_0x13ab('0x5'));var config=require('../../config/environment');var controller=require(_0x13ab('0x6'));router['get']('/',auth[_0x13ab('0x7')](),controller[_0x13ab('0x8')]);router['get'](_0x13ab('0x9'),auth[_0x13ab('0x7')](),controller['describe']);router[_0x13ab('0xa')](_0x13ab('0xb'),auth[_0x13ab('0x7')](),controller['show']);router[_0x13ab('0xc')]('/',auth[_0x13ab('0x7')](),controller['create']);router[_0x13ab('0xd')]('/:id',auth[_0x13ab('0x7')](),controller[_0x13ab('0xe')]);router[_0x13ab('0xf')](_0x13ab('0xb'),auth[_0x13ab('0x7')](),controller[_0x13ab('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index dfa0131..4becb51 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 _0xe6e4=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x450b21,_0x5c0be6){_0x450b21=_0x450b21-0x0;var _0x292a5b=_0xe6e4[_0x450b21];return _0x292a5b;};'use strict';var Sequelize=require(_0x4e6e('0x0'));module[_0x4e6e('0x1')]={'type':{'type':Sequelize[_0x4e6e('0x2')]},'uniqueid':{'type':Sequelize[_0x4e6e('0x2')]},'calleridnum':{'type':Sequelize[_0x4e6e('0x2')]},'calleridname':{'type':Sequelize[_0x4e6e('0x2')]},'queue':{'type':Sequelize[_0x4e6e('0x2')]},'interface':{'type':Sequelize[_0x4e6e('0x2')]},'membername':{'type':Sequelize[_0x4e6e('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4e6e('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x4e6e('0x3')]},'holdtime':{'type':Sequelize[_0x4e6e('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4e6e('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4e6e('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4e6e('0x4')]},'agentacw':{'type':Sequelize[_0x4e6e('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4e6e('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x4e6e('0x2')]},'channel':{'type':Sequelize[_0x4e6e('0x2')]},'channelstate':{'type':Sequelize[_0x4e6e('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4e6e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4e6e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4e6e('0x2')]},'accountcode':{'type':Sequelize[_0x4e6e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4e6e('0x2')]},'priority':{'type':Sequelize[_0x4e6e('0x2')]},'destchannel':{'type':Sequelize[_0x4e6e('0x2')]},'destchannelstate':{'type':Sequelize[_0x4e6e('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4e6e('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4e6e('0x2')]},'destcalleridname':{'type':Sequelize[_0x4e6e('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4e6e('0x2')]},'destlanguage':{'type':Sequelize[_0x4e6e('0x2')]},'destaccountcode':{'type':Sequelize[_0x4e6e('0x2')]},'destcontext':{'type':Sequelize[_0x4e6e('0x2')]},'destexten':{'type':Sequelize[_0x4e6e('0x2')]},'destpriority':{'type':Sequelize[_0x4e6e('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x4e6e('0x2')]},'transfer':{'type':Sequelize[_0x4e6e('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x4e6e('0x6')},'transferexten':{'type':Sequelize[_0x4e6e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4e6e('0x2')]},'agententerreason':{'type':Sequelize[_0x4e6e('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1707=['STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0xeed69b,_0x6a14b8){var _0x2e6068=function(_0x25511d){while(--_0x25511d){_0xeed69b['push'](_0xeed69b['shift']());}};_0x2e6068(++_0x6a14b8);}(_0x1707,0x1df));var _0x7170=function(_0x5f2784,_0xc29d5c){_0x5f2784=_0x5f2784-0x0;var _0x3cbea7=_0x1707[_0x5f2784];return _0x3cbea7;};'use strict';var Sequelize=require(_0x7170('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7170('0x1')]},'calleridname':{'type':Sequelize[_0x7170('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7170('0x1')]},'membername':{'type':Sequelize[_0x7170('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7170('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7170('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x7170('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x7170('0x2')]},'agentdumpAt':{'type':Sequelize[_0x7170('0x2')]},'holdtime':{'type':Sequelize[_0x7170('0x3')]},'agentcomplete':{'type':Sequelize[_0x7170('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7170('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7170('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7170('0x3')]},'agentacw':{'type':Sequelize[_0x7170('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7170('0x3')]},'reason':{'type':Sequelize[_0x7170('0x1')]},'lastevent':{'type':Sequelize[_0x7170('0x1')]},'channel':{'type':Sequelize[_0x7170('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7170('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7170('0x1')]},'language':{'type':Sequelize[_0x7170('0x1')]},'accountcode':{'type':Sequelize[_0x7170('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7170('0x1')]},'destchannelstate':{'type':Sequelize[_0x7170('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7170('0x1')]},'destcalleridname':{'type':Sequelize[_0x7170('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7170('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7170('0x1')]},'destlanguage':{'type':Sequelize[_0x7170('0x1')]},'destaccountcode':{'type':Sequelize[_0x7170('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7170('0x1')]},'destuniqueid':{'type':Sequelize[_0x7170('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7170('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7170('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7170('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7170('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7170('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'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 873e20b..6d45b48 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(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 7444b30..3f5225d 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 _0x3edc=['request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3edc,0x1ae));var _0xc3ed=function(_0x459c7d,_0x1771b5){_0x459c7d=_0x459c7d-0x0;var _0x2e676f=_0x3edc[_0x459c7d];return _0x2e676f;};'use strict';var _=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var logger=require(_0xc3ed('0x2'))(_0xc3ed('0x3'));var moment=require(_0xc3ed('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3ed('0x6'));var config=require(_0xc3ed('0x7'));var attributes=require(_0xc3ed('0x8'));module[_0xc3ed('0x9')]=function(_0x3f8468,_0x50b95c){return _0x3f8468[_0xc3ed('0xa')](_0xc3ed('0xb'),attributes,{'tableName':_0xc3ed('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc3ed('0xd'),_0xc3ed('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfd20=['uniqueid','destuniqueid','util','moment','bluebird','path','../../config/environment','./voiceAgentReport.attributes','exports','report_agent'];(function(_0x49cb39,_0x19e246){var _0xcc82ac=function(_0x315d18){while(--_0x315d18){_0x49cb39['push'](_0x49cb39['shift']());}};_0xcc82ac(++_0x19e246);}(_0xfd20,0x66));var _0x0fd2=function(_0x279755,_0x45b5c2){_0x279755=_0x279755-0x0;var _0x1e2295=_0xfd20[_0x279755];return _0x1e2295;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0fd2('0x1'));var BPromise=require(_0x0fd2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd2('0x3'));var rimraf=require('rimraf');var config=require(_0x0fd2('0x4'));var attributes=require(_0x0fd2('0x5'));module[_0x0fd2('0x6')]=function(_0xf25991,_0x247d6e){return _0xf25991['define']('VoiceAgentReport',attributes,{'tableName':_0x0fd2('0x7'),'paranoid':![],'indexes':[{'fields':[_0x0fd2('0x8'),_0x0fd2('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index f73ca2f..0e05e30 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 _0x5394=['debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x169669,_0x1c7094){var _0x12e24d=function(_0x142462){while(--_0x142462){_0x169669['push'](_0x169669['shift']());}};_0x12e24d(++_0x1c7094);}(_0x5394,0xb5));var _0x4539=function(_0x11c361,_0x4f5b42){_0x11c361=_0x11c361-0x0;var _0x1f5355=_0x5394[_0x11c361];return _0x1f5355;};'use strict';var _=require(_0x4539('0x0'));var util=require(_0x4539('0x1'));var moment=require(_0x4539('0x2'));var BPromise=require(_0x4539('0x3'));var rs=require(_0x4539('0x4'));var fs=require('fs');var Redis=require(_0x4539('0x5'));var db=require(_0x4539('0x6'))['db'];var utils=require(_0x4539('0x7'));var logger=require(_0x4539('0x8'))(_0x4539('0x9'));var config=require('../../config/environment');var jayson=require(_0x4539('0xa'));var client=jayson[_0x4539('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcb257a,_0x5ef915,_0xf0bfc0){return new BPromise(function(_0xbf0f3,_0x2ce25){return client[_0x4539('0xc')](_0xcb257a,_0xf0bfc0)[_0x4539('0xd')](function(_0x4579c1){logger[_0x4539('0xe')](_0x4539('0xf'),_0x5ef915,_0x4539('0x10'));logger[_0x4539('0x11')](_0x4539('0x12'),_0x5ef915,_0x4539('0x10'),JSON[_0x4539('0x13')](_0x4579c1));if(_0x4579c1[_0x4539('0x14')]){if(_0x4579c1[_0x4539('0x14')][_0x4539('0x15')]===0x1f4){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x5ef915,_0x4579c1[_0x4539('0x14')][_0x4539('0x16')]);return _0x2ce25(_0x4579c1[_0x4539('0x14')][_0x4539('0x16')]);}logger[_0x4539('0x14')](_0x4539('0xf'),_0x5ef915,_0x4579c1[_0x4539('0x14')][_0x4539('0x16')]);return _0xbf0f3(_0x4579c1[_0x4539('0x14')][_0x4539('0x16')]);}else{logger[_0x4539('0xe')](_0x4539('0xf'),_0x5ef915,'request\x20sent');_0xbf0f3(_0x4579c1['result'][_0x4539('0x16')]);}})['catch'](function(_0x2a1366){logger[_0x4539('0x14')](_0x4539('0xf'),_0x5ef915,_0x2a1366);_0x2ce25(_0x2a1366);});});}exports[_0x4539('0x17')]=function(_0x2c2860){var _0x128352=this;return new Promise(function(_0x3f71e6,_0x592827){return db[_0x4539('0x18')][_0x4539('0x19')](_0x2c2860[_0x4539('0x1a')],{'raw':_0x2c2860[_0x4539('0x1b')]?_0x2c2860['options']['raw']===undefined?!![]:![]:!![]})[_0x4539('0xd')](function(_0x3939d9){logger['info']('CreateVoiceAgentReport',_0x2c2860);logger[_0x4539('0x11')](_0x4539('0x17'),_0x2c2860,JSON[_0x4539('0x13')](_0x3939d9));_0x3f71e6(_0x3939d9);})['catch'](function(_0x54e05e){logger[_0x4539('0x14')](_0x4539('0x17'),_0x54e05e[_0x4539('0x16')],_0x2c2860);_0x592827(_0x128352[_0x4539('0x14')](0x1f4,_0x54e05e['message']));});});};exports[_0x4539('0x1c')]=function(_0x362cb7){var _0x202132=this;return new Promise(function(_0x19673d,_0x75070b){return db[_0x4539('0x18')][_0x4539('0x1d')](_0x362cb7[_0x4539('0x1a')],{'raw':_0x362cb7[_0x4539('0x1b')]?_0x362cb7[_0x4539('0x1b')][_0x4539('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x362cb7[_0x4539('0x1b')]?_0x362cb7[_0x4539('0x1b')][_0x4539('0x1f')]||null:null,'attributes':_0x362cb7['options']?_0x362cb7[_0x4539('0x1b')]['attributes']||null:null,'limit':_0x362cb7[_0x4539('0x1b')]?_0x362cb7[_0x4539('0x1b')]['limit']||null:null})['then'](function(_0x1e0b35){logger[_0x4539('0xe')](_0x4539('0x1c'),_0x362cb7);logger[_0x4539('0x11')]('UpdateVoiceAgentReport',_0x362cb7,JSON[_0x4539('0x13')](_0x1e0b35));_0x19673d(_0x1e0b35);})[_0x4539('0x20')](function(_0x1f2082){logger[_0x4539('0x14')](_0x4539('0x1c'),_0x1f2082[_0x4539('0x16')],_0x362cb7);_0x75070b(_0x202132[_0x4539('0x14')](0x1f4,_0x1f2082[_0x4539('0x16')]));});});}; \ No newline at end of file +var _0xd279=['info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','stringify','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x59949c,_0x50cd){var _0x285d2b=function(_0x598c42){while(--_0x598c42){_0x59949c['push'](_0x59949c['shift']());}};_0x285d2b(++_0x50cd);}(_0xd279,0xbd));var _0x9d27=function(_0x5757b7,_0x44a893){_0x5757b7=_0x5757b7-0x0;var _0x57b718=_0xd279[_0x5757b7];return _0x57b718;};'use strict';var _=require(_0x9d27('0x0'));var util=require(_0x9d27('0x1'));var moment=require('moment');var BPromise=require(_0x9d27('0x2'));var rs=require(_0x9d27('0x3'));var fs=require('fs');var Redis=require(_0x9d27('0x4'));var db=require(_0x9d27('0x5'))['db'];var utils=require(_0x9d27('0x6'));var logger=require(_0x9d27('0x7'))(_0x9d27('0x8'));var config=require(_0x9d27('0x9'));var jayson=require(_0x9d27('0xa'));var client=jayson['client'][_0x9d27('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22c9fe,_0x40a2b7,_0x1d79b2){return new BPromise(function(_0x287b03,_0x317702){return client[_0x9d27('0xc')](_0x22c9fe,_0x1d79b2)[_0x9d27('0xd')](function(_0x20082a){logger['info'](_0x9d27('0xe'),_0x40a2b7,_0x9d27('0xf'));logger[_0x9d27('0x10')](_0x9d27('0x11'),_0x40a2b7,_0x9d27('0xf'),JSON['stringify'](_0x20082a));if(_0x20082a[_0x9d27('0x12')]){if(_0x20082a[_0x9d27('0x12')][_0x9d27('0x13')]===0x1f4){logger[_0x9d27('0x12')](_0x9d27('0xe'),_0x40a2b7,_0x20082a['error'][_0x9d27('0x14')]);return _0x317702(_0x20082a[_0x9d27('0x12')][_0x9d27('0x14')]);}logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x40a2b7,_0x20082a[_0x9d27('0x12')][_0x9d27('0x14')]);return _0x287b03(_0x20082a[_0x9d27('0x12')][_0x9d27('0x14')]);}else{logger[_0x9d27('0x15')](_0x9d27('0xe'),_0x40a2b7,_0x9d27('0xf'));_0x287b03(_0x20082a[_0x9d27('0x16')][_0x9d27('0x14')]);}})[_0x9d27('0x17')](function(_0x5de6bd){logger[_0x9d27('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x40a2b7,_0x5de6bd);_0x317702(_0x5de6bd);});});}exports[_0x9d27('0x18')]=function(_0x72070a){var _0x100785=this;return new Promise(function(_0x2c16f1,_0x4ba20b){return db[_0x9d27('0x19')]['create'](_0x72070a[_0x9d27('0x1a')],{'raw':_0x72070a['options']?_0x72070a[_0x9d27('0x1b')][_0x9d27('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2f6dbe){logger[_0x9d27('0x15')]('CreateVoiceAgentReport',_0x72070a);logger[_0x9d27('0x10')](_0x9d27('0x18'),_0x72070a,JSON[_0x9d27('0x1d')](_0x2f6dbe));_0x2c16f1(_0x2f6dbe);})[_0x9d27('0x17')](function(_0x102304){logger[_0x9d27('0x12')](_0x9d27('0x18'),_0x102304[_0x9d27('0x14')],_0x72070a);_0x4ba20b(_0x100785[_0x9d27('0x12')](0x1f4,_0x102304['message']));});});};exports[_0x9d27('0x1e')]=function(_0x2a0e0a){var _0x2fe9f=this;return new Promise(function(_0x3edccf,_0x50832a){return db[_0x9d27('0x19')][_0x9d27('0x1f')](_0x2a0e0a[_0x9d27('0x1a')],{'raw':_0x2a0e0a[_0x9d27('0x1b')]?_0x2a0e0a[_0x9d27('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0e0a[_0x9d27('0x1b')]?_0x2a0e0a['options'][_0x9d27('0x20')]||null:null,'attributes':_0x2a0e0a['options']?_0x2a0e0a[_0x9d27('0x1b')][_0x9d27('0x21')]||null:null,'limit':_0x2a0e0a[_0x9d27('0x1b')]?_0x2a0e0a[_0x9d27('0x1b')][_0x9d27('0x22')]||null:null})[_0x9d27('0xd')](function(_0xddd38b){logger['info'](_0x9d27('0x1e'),_0x2a0e0a);logger[_0x9d27('0x10')]('UpdateVoiceAgentReport',_0x2a0e0a,JSON[_0x9d27('0x1d')](_0xddd38b));_0x3edccf(_0xddd38b);})['catch'](function(_0x62b974){logger[_0x9d27('0x12')]('UpdateVoiceAgentReport',_0x62b974['message'],_0x2a0e0a);_0x50832a(_0x2fe9f[_0x9d27('0x12')](0x1f4,_0x62b974[_0x9d27('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 7703015..45a8f1f 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaba6=['destroy','exports','multer','util','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','post','create','put','update'];(function(_0x1df234,_0x3a5ca2){var _0x437754=function(_0x4508dc){while(--_0x4508dc){_0x1df234['push'](_0x1df234['shift']());}};_0x437754(++_0x3a5ca2);}(_0xaba6,0xe2));var _0x6aba=function(_0x3e78f4,_0x5d4c9a){_0x3e78f4=_0x3e78f4-0x0;var _0x5ca5eb=_0xaba6[_0x3e78f4];return _0x5ca5eb;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/describe',auth[_0x6aba('0x7')](),controller[_0x6aba('0x8')]);router['get'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller['show']);router[_0x6aba('0xa')]('/',auth[_0x6aba('0x7')](),controller[_0x6aba('0xb')]);router[_0x6aba('0xc')](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xd')]);router['delete'](_0x6aba('0x9'),auth[_0x6aba('0x7')](),controller[_0x6aba('0xe')]);module[_0x6aba('0xf')]=router; \ No newline at end of file +var _0x038b=['update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','create'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x038b,0x114));var _0xb038=function(_0x58d0a4,_0x4735be){_0x58d0a4=_0x58d0a4-0x0;var _0x1b8a46=_0x038b[_0x58d0a4];return _0x1b8a46;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['describe']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['show']);router['post']('/',auth[_0xb038('0x9')](),controller[_0xb038('0xb')]);router['put'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xc')]);router[_0xb038('0xd')](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xe')]);module[_0xb038('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index b24259e..eb0f027 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 _0x0c33=['exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x1597e2,_0x388d3e){var _0x4c8c0a=function(_0x3d4795){while(--_0x3d4795){_0x1597e2['push'](_0x1597e2['shift']());}};_0x4c8c0a(++_0x388d3e);}(_0x0c33,0x180));var _0x30c3=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0x0c33[_0x8ae98b];return _0xc30bd4;};'use strict';var Sequelize=require(_0x30c3('0x0'));module[_0x30c3('0x1')]={'uniqueid':{'type':Sequelize[_0x30c3('0x2')]},'type':{'type':Sequelize['ENUM'](_0x30c3('0x3'),_0x30c3('0x4'),_0x30c3('0x5'),_0x30c3('0x6'),_0x30c3('0x7'),_0x30c3('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x30c3('0x2')]},'source':{'type':Sequelize[_0x30c3('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x30c3('0x2')]},'callerid':{'type':Sequelize[_0x30c3('0x2')]},'channel':{'type':Sequelize[_0x30c3('0x2')]},'destinationchannel':{'type':Sequelize[_0x30c3('0x2')]},'lastapplication':{'type':Sequelize[_0x30c3('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x30c3('0x9')]},'answertime':{'type':Sequelize[_0x30c3('0x9')]},'endtime':{'type':Sequelize[_0x30c3('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x30c3('0xa')]},'mohtime':{'type':Sequelize[_0x30c3('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x30c3('0x2')]},'amaflags':{'type':Sequelize[_0x30c3('0x2')]},'userfield':{'type':Sequelize[_0x30c3('0x2')]},'userDisposition':{'type':Sequelize[_0x30c3('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x30c3('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x30c3('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x30c3('0x2')]},'routeid':{'type':Sequelize[_0x30c3('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe306=['TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','STRING'];(function(_0x3258ef,_0x2816be){var _0x2d0906=function(_0x47a80f){while(--_0x47a80f){_0x3258ef['push'](_0x3258ef['shift']());}};_0x2d0906(++_0x2816be);}(_0xe306,0xad));var _0x6e30=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xe306[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0x6e30('0x0'));module[_0x6e30('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6e30('0x2')](_0x6e30('0x3'),_0x6e30('0x4'),_0x6e30('0x5'),'inbound-fax','outbound-fax','dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0x6e30('0x6')]},'destination':{'type':Sequelize[_0x6e30('0x6')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6e30('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x6e30('0x6')]},'lastapplication':{'type':Sequelize[_0x6e30('0x6')]},'lastdata':{'type':Sequelize[_0x6e30('0x7')]},'starttime':{'type':Sequelize[_0x6e30('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6e30('0x8')]},'endtime':{'type':Sequelize[_0x6e30('0x8')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6e30('0x9')]},'mohtime':{'type':Sequelize[_0x6e30('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6e30('0x6')]},'userDisposition':{'type':Sequelize[_0x6e30('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x6e30('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x6e30('0x6')]},'note':{'type':Sequelize[_0x6e30('0x6')]},'prefix':{'type':Sequelize[_0x6e30('0x6')]},'routeid':{'type':Sequelize[_0x6e30('0x9')]},'sipcallid':{'type':Sequelize[_0x6e30('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 8f9d636..2e5181e 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(_0x373f3f,_0x6d44f0){var _0x873d92=function(_0x3aadc4){while(--_0x3aadc4){_0x373f3f['push'](_0x373f3f['shift']());}};_0x873d92(++_0x6d44f0);}(_0xdb28,0x106));var _0x8db2=function(_0x59fa6f,_0x77ab72){_0x59fa6f=_0x59fa6f-0x0;var _0x2923ef=_0xdb28[_0x59fa6f];return _0x2923ef;};'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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5f1498,_0xb3bde5){_0x5f1498=_0x5f1498-0x0;var _0x357481=_0x5f2f[_0x5f1498];return _0x357481;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 61f3693..d5d9679 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 _0x13a2=['util','../../config/logger','moment','bluebird','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x141e5e,_0x58fdef){var _0x524917=function(_0x256c74){while(--_0x256c74){_0x141e5e['push'](_0x141e5e['shift']());}};_0x524917(++_0x58fdef);}(_0x13a2,0x175));var _0x213a=function(_0x2dd594,_0x34c024){_0x2dd594=_0x2dd594-0x0;var _0x1e1e26=_0x13a2[_0x2dd594];return _0x1e1e26;};'use strict';var _=require(_0x213a('0x0'));var util=require(_0x213a('0x1'));var logger=require(_0x213a('0x2'))('api');var moment=require(_0x213a('0x3'));var BPromise=require(_0x213a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x213a('0x5'));var attributes=require(_0x213a('0x6'));module[_0x213a('0x7')]=function(_0x4dd41f,_0x2c558d){return _0x4dd41f[_0x213a('0x8')](_0x213a('0x9'),attributes,{'tableName':_0x213a('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe27b=['define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x56e301,_0x15c7a1){var _0x2a3b02=function(_0x2c30c6){while(--_0x2c30c6){_0x56e301['push'](_0x56e301['shift']());}};_0x2a3b02(++_0x15c7a1);}(_0xe27b,0x10c));var _0xbe27=function(_0x323558,_0x4f03e8){_0x323558=_0x323558-0x0;var _0x32549d=_0xe27b[_0x323558];return _0x32549d;};'use strict';var _=require('lodash');var util=require(_0xbe27('0x0'));var logger=require(_0xbe27('0x1'))(_0xbe27('0x2'));var moment=require('moment');var BPromise=require(_0xbe27('0x3'));var rp=require(_0xbe27('0x4'));var fs=require('fs');var path=require(_0xbe27('0x5'));var rimraf=require(_0xbe27('0x6'));var config=require(_0xbe27('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x23c8e4,_0x3870e5){return _0x23c8e4[_0xbe27('0x8')](_0xbe27('0x9'),attributes,{'tableName':_0xbe27('0xa'),'paranoid':![],'indexes':[{'fields':[_0xbe27('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index b89799d..317fb03 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 _0x6c39=['options','raw','limit','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','findAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6c39,0x1c6));var _0x96c3=function(_0x2442b9,_0x3d87e9){_0x2442b9=_0x2442b9-0x0;var _0x31b571=_0x6c39[_0x2442b9];return _0x31b571;};'use strict';var _=require(_0x96c3('0x0'));var util=require(_0x96c3('0x1'));var moment=require(_0x96c3('0x2'));var BPromise=require(_0x96c3('0x3'));var rs=require(_0x96c3('0x4'));var fs=require('fs');var Redis=require(_0x96c3('0x5'));var db=require(_0x96c3('0x6'))['db'];var utils=require(_0x96c3('0x7'));var logger=require(_0x96c3('0x8'))('rpc');var config=require(_0x96c3('0x9'));var jayson=require(_0x96c3('0xa'));var client=jayson[_0x96c3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55cd44,_0x5869ab,_0x4783c3){return new BPromise(function(_0x5187d9,_0x1fcd13){return client[_0x96c3('0xc')](_0x55cd44,_0x4783c3)[_0x96c3('0xd')](function(_0x158bd4){logger[_0x96c3('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x5869ab,_0x96c3('0xf'));logger[_0x96c3('0x10')](_0x96c3('0x11'),_0x5869ab,_0x96c3('0xf'),JSON[_0x96c3('0x12')](_0x158bd4));if(_0x158bd4[_0x96c3('0x13')]){if(_0x158bd4[_0x96c3('0x13')][_0x96c3('0x14')]===0x1f4){logger[_0x96c3('0x13')](_0x96c3('0x15'),_0x5869ab,_0x158bd4[_0x96c3('0x13')][_0x96c3('0x16')]);return _0x1fcd13(_0x158bd4[_0x96c3('0x13')][_0x96c3('0x16')]);}logger[_0x96c3('0x13')](_0x96c3('0x15'),_0x5869ab,_0x158bd4[_0x96c3('0x13')][_0x96c3('0x16')]);return _0x5187d9(_0x158bd4['error']['message']);}else{logger[_0x96c3('0xe')](_0x96c3('0x15'),_0x5869ab,_0x96c3('0xf'));_0x5187d9(_0x158bd4['result'][_0x96c3('0x16')]);}})[_0x96c3('0x17')](function(_0x53f133){logger[_0x96c3('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x5869ab,_0x53f133);_0x1fcd13(_0x53f133);});});}exports['GetVoiceCallReport']=function(_0x2e6c91){var _0x3eb328=this;return new Promise(function(_0x4ce909,_0x42d788){return db[_0x96c3('0x18')][_0x96c3('0x19')]({'raw':_0x2e6c91[_0x96c3('0x1a')]?_0x2e6c91['options'][_0x96c3('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e6c91[_0x96c3('0x1a')]?_0x2e6c91[_0x96c3('0x1a')]['where']||null:null,'attributes':_0x2e6c91[_0x96c3('0x1a')]?_0x2e6c91[_0x96c3('0x1a')]['attributes']||null:null,'limit':_0x2e6c91[_0x96c3('0x1a')]?_0x2e6c91['options'][_0x96c3('0x1c')]||null:null,'include':_0x2e6c91['options']?_0x2e6c91[_0x96c3('0x1a')][_0x96c3('0x1d')]?_[_0x96c3('0x1e')](_0x2e6c91[_0x96c3('0x1a')]['include'],function(_0xc7235a){return{'model':db[_0xc7235a[_0x96c3('0x1f')]],'as':_0xc7235a['as'],'attributes':_0xc7235a[_0x96c3('0x20')],'include':_0xc7235a[_0x96c3('0x1d')]?_[_0x96c3('0x1e')](_0xc7235a[_0x96c3('0x1d')],function(_0x39e301){return{'model':db[_0x39e301['model']],'as':_0x39e301['as'],'attributes':_0x39e301[_0x96c3('0x20')],'include':_0x39e301['include']?_[_0x96c3('0x1e')](_0x39e301[_0x96c3('0x1d')],function(_0x2f59b5){return{'model':db[_0x2f59b5['model']],'as':_0x2f59b5['as'],'attributes':_0x2f59b5[_0x96c3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x96c3('0xd')](function(_0x568160){logger[_0x96c3('0xe')]('GetVoiceCallReport',_0x2e6c91);logger[_0x96c3('0x10')]('GetVoiceCallReport',_0x2e6c91,JSON['stringify'](_0x568160));_0x4ce909(_0x568160);})[_0x96c3('0x17')](function(_0x203b37){logger[_0x96c3('0x13')](_0x96c3('0x21'),_0x203b37[_0x96c3('0x16')],_0x2e6c91);_0x42d788(_0x3eb328[_0x96c3('0x13')](0x1f4,_0x203b37[_0x96c3('0x16')]));});});};exports[_0x96c3('0x22')]=function(_0x580f2b){var _0x47d820=this;return new Promise(function(_0x3a6e8b,_0x41ac84){return db['VoiceCallReport'][_0x96c3('0x23')](_0x580f2b[_0x96c3('0x24')],{'raw':_0x580f2b[_0x96c3('0x1a')]?_0x580f2b[_0x96c3('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x96c3('0xd')](function(_0x41f29e){logger[_0x96c3('0xe')](_0x96c3('0x22'),_0x580f2b);logger[_0x96c3('0x10')](_0x96c3('0x22'),_0x580f2b,JSON['stringify'](_0x41f29e));_0x3a6e8b(_0x41f29e);})[_0x96c3('0x17')](function(_0x39ca57){logger[_0x96c3('0x13')](_0x96c3('0x22'),_0x39ca57[_0x96c3('0x16')],_0x580f2b);_0x41ac84(_0x47d820[_0x96c3('0x13')](0x1f4,_0x39ca57[_0x96c3('0x16')]));});});};exports[_0x96c3('0x25')]=function(_0x216089){var _0xeb1227=this;return new Promise(function(_0x2f69a2,_0x4ae853){return db[_0x96c3('0x18')][_0x96c3('0x26')](_0x216089[_0x96c3('0x24')],{'raw':_0x216089[_0x96c3('0x1a')]?_0x216089[_0x96c3('0x1a')][_0x96c3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x216089[_0x96c3('0x1a')]?_0x216089[_0x96c3('0x1a')][_0x96c3('0x27')]||null:null,'attributes':_0x216089['options']?_0x216089['options']['attributes']||null:null,'limit':_0x216089['options']?_0x216089[_0x96c3('0x1a')]['limit']||null:null})[_0x96c3('0xd')](function(_0x1cffa5){logger['info'](_0x96c3('0x25'),_0x216089);logger[_0x96c3('0x10')](_0x96c3('0x25'),_0x216089,JSON['stringify'](_0x1cffa5));_0x2f69a2(_0x1cffa5);})[_0x96c3('0x17')](function(_0x18ec58){logger[_0x96c3('0x13')](_0x96c3('0x25'),_0x18ec58['message'],_0x216089);_0x4ae853(_0xeb1227[_0x96c3('0x13')](0x1f4,_0x18ec58[_0x96c3('0x16')]));});});}; \ No newline at end of file +var _0xf149=['UpdateVoiceCallReport','update','raw','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetVoiceCallReport','findAll','options','where','attributes','include','map','model','stringify','CreateVoiceCallReport','VoiceCallReport','create','body'];(function(_0x22d587,_0x4bbb6f){var _0xe8c8e5=function(_0x171b1f){while(--_0x171b1f){_0x22d587['push'](_0x22d587['shift']());}};_0xe8c8e5(++_0x4bbb6f);}(_0xf149,0x12c));var _0x9f14=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0xf149[_0x5ca52d];return _0x89e54e;};'use strict';var _=require('lodash');var util=require(_0x9f14('0x0'));var moment=require(_0x9f14('0x1'));var BPromise=require(_0x9f14('0x2'));var rs=require(_0x9f14('0x3'));var fs=require('fs');var Redis=require(_0x9f14('0x4'));var db=require(_0x9f14('0x5'))['db'];var utils=require(_0x9f14('0x6'));var logger=require('../../config/logger')(_0x9f14('0x7'));var config=require(_0x9f14('0x8'));var jayson=require(_0x9f14('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13c107,_0x3b2269,_0x104a74){return new BPromise(function(_0x363a97,_0x4560ed){return client[_0x9f14('0xa')](_0x13c107,_0x104a74)[_0x9f14('0xb')](function(_0x3d6cec){logger[_0x9f14('0xc')](_0x9f14('0xd'),_0x3b2269,_0x9f14('0xe'));logger[_0x9f14('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3b2269,'request\x20sent',JSON['stringify'](_0x3d6cec));if(_0x3d6cec[_0x9f14('0x10')]){if(_0x3d6cec[_0x9f14('0x10')][_0x9f14('0x11')]===0x1f4){logger['error'](_0x9f14('0xd'),_0x3b2269,_0x3d6cec[_0x9f14('0x10')][_0x9f14('0x12')]);return _0x4560ed(_0x3d6cec['error'][_0x9f14('0x12')]);}logger[_0x9f14('0x10')](_0x9f14('0xd'),_0x3b2269,_0x3d6cec[_0x9f14('0x10')][_0x9f14('0x12')]);return _0x363a97(_0x3d6cec[_0x9f14('0x10')][_0x9f14('0x12')]);}else{logger[_0x9f14('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x3b2269,_0x9f14('0xe'));_0x363a97(_0x3d6cec['result'][_0x9f14('0x12')]);}})[_0x9f14('0x13')](function(_0x12b73d){logger[_0x9f14('0x10')](_0x9f14('0xd'),_0x3b2269,_0x12b73d);_0x4560ed(_0x12b73d);});});}exports[_0x9f14('0x14')]=function(_0x34fe25){var _0x4a99d2=this;return new Promise(function(_0x5010a0,_0x2d8305){return db['VoiceCallReport'][_0x9f14('0x15')]({'raw':_0x34fe25[_0x9f14('0x16')]?_0x34fe25[_0x9f14('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34fe25[_0x9f14('0x16')]?_0x34fe25['options'][_0x9f14('0x17')]||null:null,'attributes':_0x34fe25['options']?_0x34fe25[_0x9f14('0x16')][_0x9f14('0x18')]||null:null,'limit':_0x34fe25[_0x9f14('0x16')]?_0x34fe25[_0x9f14('0x16')]['limit']||null:null,'include':_0x34fe25[_0x9f14('0x16')]?_0x34fe25['options'][_0x9f14('0x19')]?_[_0x9f14('0x1a')](_0x34fe25[_0x9f14('0x16')]['include'],function(_0x1ebf36){return{'model':db[_0x1ebf36[_0x9f14('0x1b')]],'as':_0x1ebf36['as'],'attributes':_0x1ebf36[_0x9f14('0x18')],'include':_0x1ebf36[_0x9f14('0x19')]?_[_0x9f14('0x1a')](_0x1ebf36[_0x9f14('0x19')],function(_0x3cef6f){return{'model':db[_0x3cef6f[_0x9f14('0x1b')]],'as':_0x3cef6f['as'],'attributes':_0x3cef6f[_0x9f14('0x18')],'include':_0x3cef6f[_0x9f14('0x19')]?_['map'](_0x3cef6f['include'],function(_0x54c2ce){return{'model':db[_0x54c2ce['model']],'as':_0x54c2ce['as'],'attributes':_0x54c2ce[_0x9f14('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a6d5f){logger[_0x9f14('0xc')](_0x9f14('0x14'),_0x34fe25);logger[_0x9f14('0xf')](_0x9f14('0x14'),_0x34fe25,JSON[_0x9f14('0x1c')](_0x3a6d5f));_0x5010a0(_0x3a6d5f);})[_0x9f14('0x13')](function(_0x5b7e11){logger[_0x9f14('0x10')](_0x9f14('0x14'),_0x5b7e11[_0x9f14('0x12')],_0x34fe25);_0x2d8305(_0x4a99d2[_0x9f14('0x10')](0x1f4,_0x5b7e11['message']));});});};exports[_0x9f14('0x1d')]=function(_0x35a876){var _0x54bcde=this;return new Promise(function(_0x41fe53,_0x48d008){return db[_0x9f14('0x1e')][_0x9f14('0x1f')](_0x35a876[_0x9f14('0x20')],{'raw':_0x35a876[_0x9f14('0x16')]?_0x35a876[_0x9f14('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x9f14('0xb')](function(_0xe9ed79){logger[_0x9f14('0xc')](_0x9f14('0x1d'),_0x35a876);logger[_0x9f14('0xf')](_0x9f14('0x1d'),_0x35a876,JSON[_0x9f14('0x1c')](_0xe9ed79));_0x41fe53(_0xe9ed79);})[_0x9f14('0x13')](function(_0x3dfd78){logger[_0x9f14('0x10')](_0x9f14('0x1d'),_0x3dfd78[_0x9f14('0x12')],_0x35a876);_0x48d008(_0x54bcde[_0x9f14('0x10')](0x1f4,_0x3dfd78[_0x9f14('0x12')]));});});};exports[_0x9f14('0x21')]=function(_0x3faeaf){var _0x4eb0b2=this;return new Promise(function(_0x4700b9,_0x3802af){return db[_0x9f14('0x1e')][_0x9f14('0x22')](_0x3faeaf[_0x9f14('0x20')],{'raw':_0x3faeaf[_0x9f14('0x16')]?_0x3faeaf[_0x9f14('0x16')][_0x9f14('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3faeaf[_0x9f14('0x16')]?_0x3faeaf[_0x9f14('0x16')][_0x9f14('0x17')]||null:null,'attributes':_0x3faeaf[_0x9f14('0x16')]?_0x3faeaf[_0x9f14('0x16')][_0x9f14('0x18')]||null:null,'limit':_0x3faeaf['options']?_0x3faeaf['options'][_0x9f14('0x24')]||null:null})[_0x9f14('0xb')](function(_0x3f50ba){logger[_0x9f14('0xc')]('UpdateVoiceCallReport',_0x3faeaf);logger[_0x9f14('0xf')](_0x9f14('0x21'),_0x3faeaf,JSON['stringify'](_0x3f50ba));_0x4700b9(_0x3f50ba);})['catch'](function(_0xd34981){logger[_0x9f14('0x10')](_0x9f14('0x21'),_0xd34981[_0x9f14('0x12')],_0x3faeaf);_0x3802af(_0x4eb0b2[_0x9f14('0x10')](0x1f4,_0xd34981[_0x9f14('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index e6f8459..cbbf6e3 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 _0x2863=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x41568e,_0x5ab27b){var _0x40db40=function(_0x14969b){while(--_0x14969b){_0x41568e['push'](_0x41568e['shift']());}};_0x40db40(++_0x5ab27b);}(_0x2863,0x10e));var _0x3286=function(_0x349007,_0x32be89){_0x349007=_0x349007-0x0;var _0x273391=_0x2863[_0x349007];return _0x273391;};'use strict';var multer=require(_0x3286('0x0'));var util=require(_0x3286('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3286('0x2'));var router=express[_0x3286('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3286('0x4'));var interaction=require(_0x3286('0x5'));var config=require(_0x3286('0x6'));var controller=require('./voiceChanSpy.controller');router[_0x3286('0x7')]('/',auth[_0x3286('0x8')](),controller[_0x3286('0x9')]);router[_0x3286('0x7')](_0x3286('0xa'),auth[_0x3286('0x8')](),controller[_0x3286('0xb')]);router[_0x3286('0xc')]('/',auth[_0x3286('0x8')](),controller[_0x3286('0xd')]);router[_0x3286('0xe')](_0x3286('0xa'),auth[_0x3286('0x8')](),controller[_0x3286('0xf')]);router[_0x3286('0x10')](_0x3286('0xa'),auth[_0x3286('0x8')](),controller['destroy']);module[_0x3286('0x11')]=router; \ No newline at end of file +var _0xdc23=['path','connect-timeout','express','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x5c5cfb,_0x856fe6){var _0xb89878=function(_0x32e5d4){while(--_0x32e5d4){_0x5c5cfb['push'](_0x5c5cfb['shift']());}};_0xb89878(++_0x856fe6);}(_0xdc23,0x1c2));var _0x3dc2=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0xdc23[_0x46451c];return _0x12dce4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3dc2('0x0'));var timeout=require(_0x3dc2('0x1'));var express=require(_0x3dc2('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3dc2('0x3'));var config=require('../../config/environment');var controller=require(_0x3dc2('0x4'));router[_0x3dc2('0x5')]('/',auth[_0x3dc2('0x6')](),controller[_0x3dc2('0x7')]);router[_0x3dc2('0x5')](_0x3dc2('0x8'),auth[_0x3dc2('0x6')](),controller[_0x3dc2('0x9')]);router['post']('/',auth[_0x3dc2('0x6')](),controller[_0x3dc2('0xa')]);router[_0x3dc2('0xb')](_0x3dc2('0x8'),auth[_0x3dc2('0x6')](),controller[_0x3dc2('0xc')]);router[_0x3dc2('0xd')](_0x3dc2('0x8'),auth[_0x3dc2('0x6')](),controller[_0x3dc2('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1341577..30e8588 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 _0x123b=['split','BOOLEAN','sequelize','exports','STRING','name','options','getDataValue'];(function(_0x176b01,_0x1da50d){var _0xb1c5a1=function(_0xc9b2f1){while(--_0xc9b2f1){_0x176b01['push'](_0x176b01['shift']());}};_0xb1c5a1(++_0x1da50d);}(_0x123b,0x1c2));var _0xb123=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x123b[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0xb123('0x0'));module[_0xb123('0x1')]={'name':{'type':Sequelize[_0xb123('0x2')]},'prefix':{'type':Sequelize[_0xb123('0x2')],'unique':_0xb123('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xb123('0x2')],'set':function(_0x1124de){this['setDataValue'](_0xb123('0x4'),_0x1124de?_0x1124de['join'](''):[]);},'get':function(){return this[_0xb123('0x5')](_0xb123('0x4'))?this[_0xb123('0x5')]('options')[_0xb123('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb123('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb123('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb123('0x2')]},'description':{'type':Sequelize[_0xb123('0x2')]}}; \ No newline at end of file +var _0xbfd9=['options','BOOLEAN','sequelize','exports','STRING','name','setDataValue','getDataValue'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbfd9,0x152));var _0x9bfd=function(_0x4e4e2e,_0x383975){_0x4e4e2e=_0x4e4e2e-0x0;var _0x5eb19e=_0xbfd9[_0x4e4e2e];return _0x5eb19e;};'use strict';var Sequelize=require(_0x9bfd('0x0'));module[_0x9bfd('0x1')]={'name':{'type':Sequelize[_0x9bfd('0x2')]},'prefix':{'type':Sequelize[_0x9bfd('0x2')],'unique':_0x9bfd('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x9bfd('0x2')],'set':function(_0x1b80c6){this[_0x9bfd('0x4')]('options',_0x1b80c6?_0x1b80c6['join'](''):[]);},'get':function(){return this[_0x9bfd('0x5')](_0x9bfd('0x6'))?this[_0x9bfd('0x5')]('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x9bfd('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x9bfd('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e3156a9..3375d45 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 _0x8164=['save','update','then','destroy','get','ChanSpies','stack','name','send','index','VoiceChanSpy','rawAttributes','type','key','model','map','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','keys','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','error','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x59ea34,_0x398a4c){var _0x4540cf=function(_0x271572){while(--_0x271572){_0x59ea34['push'](_0x59ea34['shift']());}};_0x4540cf(++_0x398a4c);}(_0x8164,0x170));var _0x4816=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x8164[_0x3a5648];return _0x34126d;};'use strict';var emlformat=require(_0x4816('0x0'));var rimraf=require(_0x4816('0x1'));var zipdir=require(_0x4816('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4816('0x3'));var moment=require(_0x4816('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4816('0x5'));var util=require('util');var path=require(_0x4816('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4816('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4816('0x8'));var crypto=require(_0x4816('0x9'));var jsforce=require(_0x4816('0xa'));var deskjs=require(_0x4816('0xb'));var toCsv=require(_0x4816('0xc'));var querystring=require(_0x4816('0xd'));var Papa=require(_0x4816('0xe'));var Redis=require(_0x4816('0xf'));var authService=require(_0x4816('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4816('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4816('0x12'))(_0x4816('0x13'));var utils=require('../../config/utils');var config=require(_0x4816('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c173b,_0x51a5f8){_0x51a5f8=_0x51a5f8||0xcc;return function(_0x5c4d42){if(_0x5c4d42){return _0x3c173b[_0x4816('0x15')](_0x51a5f8);}return _0x3c173b['status'](_0x51a5f8)[_0x4816('0x16')]();};}function respondWithResult(_0x2554b4,_0x13a685){_0x13a685=_0x13a685||0xc8;return function(_0x316f36){if(_0x316f36){return _0x2554b4[_0x4816('0x17')](_0x13a685)[_0x4816('0x18')](_0x316f36);}};}function respondWithFilteredResult(_0x1eb683,_0x2a58b7){return function(_0x45c006){if(_0x45c006){var _0x21354c=typeof _0x2a58b7[_0x4816('0x19')]===_0x4816('0x1a')&&typeof _0x2a58b7[_0x4816('0x1b')]===_0x4816('0x1a');var _0x1961a5=_0x45c006[_0x4816('0x1c')];var _0x4803d0=_0x21354c?0x0:_0x2a58b7['offset'];var _0x8d4393=_0x21354c?_0x45c006[_0x4816('0x1c')]:_0x2a58b7[_0x4816('0x19')]+_0x2a58b7[_0x4816('0x1b')];var _0xc8ffd5;if(_0x8d4393>=_0x1961a5){_0x8d4393=_0x1961a5;_0xc8ffd5=0xc8;}else{_0xc8ffd5=0xce;}_0x1eb683[_0x4816('0x17')](_0xc8ffd5);return _0x1eb683[_0x4816('0x1d')](_0x4816('0x1e'),_0x4803d0+'-'+_0x8d4393+'/'+_0x1961a5)[_0x4816('0x18')](_0x45c006);}return null;};}function patchUpdates(_0x53189e){return function(_0x1ab50d){try{jsonpatch['apply'](_0x1ab50d,_0x53189e,!![]);}catch(_0x521472){return BPromise[_0x4816('0x1f')](_0x521472);}return _0x1ab50d[_0x4816('0x20')]();};}function saveUpdates(_0x5de184,_0x2bbaf4){return function(_0x576221){if(_0x576221){return _0x576221[_0x4816('0x21')](_0x5de184)[_0x4816('0x22')](function(_0x571c81){return _0x571c81;});}return null;};}function removeEntity(_0x504851,_0xe484b2){return function(_0x2c8dc4){if(_0x2c8dc4){return _0x2c8dc4[_0x4816('0x23')]()['then'](function(){var _0x9b1a4c=_0x2c8dc4[_0x4816('0x24')]({'plain':!![]});var _0x126c60=_0x4816('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x126c60,'resourceId':_0x9b1a4c['id']}})[_0x4816('0x22')](function(){return _0x2c8dc4;});})[_0x4816('0x22')](function(){_0x504851['status'](0xcc)[_0x4816('0x16')]();});}};}function handleEntityNotFound(_0x4f9386,_0x551d15){return function(_0x386a16){if(!_0x386a16){_0x4f9386[_0x4816('0x15')](0x194);}return _0x386a16;};}function handleError(_0x2d8514,_0x5a1e61){_0x5a1e61=_0x5a1e61||0x1f4;return function(_0xbeb8fb){logger['error'](_0xbeb8fb[_0x4816('0x26')]);if(_0xbeb8fb[_0x4816('0x27')]){delete _0xbeb8fb['name'];}_0x2d8514[_0x4816('0x17')](_0x5a1e61)[_0x4816('0x28')](_0xbeb8fb);};}exports[_0x4816('0x29')]=function(_0x17037a,_0x1ba256){var _0x332af7={},_0x2e9a77={},_0x327a07={'count':0x0,'rows':[]};var _0x11ba1a=_['map'](db[_0x4816('0x2a')][_0x4816('0x2b')],function(_0x56ed76){return{'name':_0x56ed76['fieldName'],'type':_0x56ed76[_0x4816('0x2c')][_0x4816('0x2d')]};});_0x2e9a77[_0x4816('0x2e')]=_[_0x4816('0x2f')](_0x11ba1a,_0x4816('0x27'));_0x2e9a77['query']=_['keys'](_0x17037a['query']);_0x2e9a77[_0x4816('0x30')]=_[_0x4816('0x31')](_0x2e9a77[_0x4816('0x2e')],_0x2e9a77[_0x4816('0x32')]);_0x332af7[_0x4816('0x33')]=_[_0x4816('0x31')](_0x2e9a77['model'],qs[_0x4816('0x34')](_0x17037a['query'][_0x4816('0x34')]));_0x332af7[_0x4816('0x33')]=_0x332af7[_0x4816('0x33')][_0x4816('0x35')]?_0x332af7[_0x4816('0x33')]:_0x2e9a77['model'];if(!_0x17037a[_0x4816('0x32')]['hasOwnProperty']('nolimit')){_0x332af7[_0x4816('0x1b')]=qs['limit'](_0x17037a['query']['limit']);_0x332af7['offset']=qs[_0x4816('0x19')](_0x17037a[_0x4816('0x32')]['offset']);}_0x332af7[_0x4816('0x36')]=qs[_0x4816('0x37')](_0x17037a['query'][_0x4816('0x37')]);_0x332af7[_0x4816('0x38')]=qs[_0x4816('0x30')](_[_0x4816('0x39')](_0x17037a['query'],_0x2e9a77[_0x4816('0x30')]),_0x11ba1a);if(_0x17037a[_0x4816('0x32')][_0x4816('0x3a')]){_0x332af7[_0x4816('0x38')]=_[_0x4816('0x3b')](_0x332af7[_0x4816('0x38')],{'$or':_[_0x4816('0x2f')](_0x11ba1a,function(_0x1ef378){if(_0x1ef378[_0x4816('0x2c')]!==_0x4816('0x3c')){var _0xcbded0={};_0xcbded0[_0x1ef378[_0x4816('0x27')]]={'$like':'%'+_0x17037a[_0x4816('0x32')]['filter']+'%'};return _0xcbded0;}})});}_0x332af7=_[_0x4816('0x3b')]({},_0x332af7,_0x17037a[_0x4816('0x3d')]);var _0x4cbb05={'where':_0x332af7[_0x4816('0x38')]};return db[_0x4816('0x2a')][_0x4816('0x1c')](_0x4cbb05)[_0x4816('0x22')](function(_0x5d441a){_0x327a07[_0x4816('0x1c')]=_0x5d441a;if(_0x17037a['query']['includeAll']){_0x332af7[_0x4816('0x3e')]=[{'all':!![]}];}return db[_0x4816('0x2a')]['findAll'](_0x332af7);})[_0x4816('0x22')](function(_0x432bce){_0x327a07[_0x4816('0x3f')]=_0x432bce;return _0x327a07;})['then'](respondWithFilteredResult(_0x1ba256,_0x332af7))[_0x4816('0x40')](handleError(_0x1ba256,null));};exports[_0x4816('0x41')]=function(_0x178e62,_0xdec91c){var _0x40115d={'raw':![],'where':{'id':_0x178e62['params']['id']}},_0x39c713={};_0x39c713[_0x4816('0x2e')]=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x39c713[_0x4816('0x32')]=_[_0x4816('0x42')](_0x178e62[_0x4816('0x32')]);_0x39c713[_0x4816('0x30')]=_[_0x4816('0x31')](_0x39c713[_0x4816('0x2e')],_0x39c713[_0x4816('0x32')]);_0x40115d[_0x4816('0x33')]=_[_0x4816('0x31')](_0x39c713[_0x4816('0x2e')],qs['fields'](_0x178e62['query'][_0x4816('0x34')]));_0x40115d[_0x4816('0x33')]=_0x40115d[_0x4816('0x33')][_0x4816('0x35')]?_0x40115d[_0x4816('0x33')]:_0x39c713[_0x4816('0x2e')];if(_0x178e62[_0x4816('0x32')][_0x4816('0x43')]){_0x40115d['include']=[{'all':!![]}];}_0x40115d=_[_0x4816('0x3b')]({},_0x40115d,_0x178e62[_0x4816('0x3d')]);return db[_0x4816('0x2a')]['find'](_0x40115d)['then'](handleEntityNotFound(_0xdec91c,null))[_0x4816('0x22')](respondWithResult(_0xdec91c,null))[_0x4816('0x40')](handleError(_0xdec91c,null));};exports[_0x4816('0x44')]=function(_0x5d8b92,_0x247adb){return db[_0x4816('0x2a')][_0x4816('0x44')](_0x5d8b92[_0x4816('0x45')],{})[_0x4816('0x22')](function(_0x4401c6){var _0xbc898a=_0x5d8b92['user'][_0x4816('0x24')]({'plain':!![]});if(!_0xbc898a)throw new Error(_0x4816('0x46'));if(_0xbc898a[_0x4816('0x47')]===_0x4816('0x48')){var _0x158127=_0x4401c6[_0x4816('0x24')]({'plain':!![]});var _0x309778=_0x4816('0x25');return db[_0x4816('0x49')][_0x4816('0x4a')]({'where':{'name':_0x309778,'userProfileId':_0xbc898a[_0x4816('0x4b')]},'raw':!![]})[_0x4816('0x22')](function(_0x2b2f24){if(_0x2b2f24&&_0x2b2f24[_0x4816('0x4c')]===0x0){return db[_0x4816('0x4d')][_0x4816('0x44')]({'name':_0x158127[_0x4816('0x27')],'resourceId':_0x158127['id'],'type':_0x2b2f24[_0x4816('0x27')],'sectionId':_0x2b2f24['id']},{})[_0x4816('0x22')](function(){return _0x4401c6;});}else{return _0x4401c6;}})[_0x4816('0x40')](function(_0x1702bf){logger[_0x4816('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1702bf);throw _0x1702bf;});}return _0x4401c6;})[_0x4816('0x22')](respondWithResult(_0x247adb,0xc9))[_0x4816('0x40')](handleError(_0x247adb,null));};exports['update']=function(_0x3604e6,_0xa2a654){if(_0x3604e6[_0x4816('0x45')]['id']){delete _0x3604e6[_0x4816('0x45')]['id'];}return db[_0x4816('0x2a')][_0x4816('0x4a')]({'where':{'id':_0x3604e6[_0x4816('0x4f')]['id']}})[_0x4816('0x22')](handleEntityNotFound(_0xa2a654,null))[_0x4816('0x22')](saveUpdates(_0x3604e6[_0x4816('0x45')],null))['then'](respondWithResult(_0xa2a654,null))[_0x4816('0x40')](handleError(_0xa2a654,null));};exports['destroy']=function(_0x440ba5,_0x199363){return db['VoiceChanSpy'][_0x4816('0x4a')]({'where':{'id':_0x440ba5[_0x4816('0x4f')]['id']}})[_0x4816('0x22')](handleEntityNotFound(_0x199363,null))[_0x4816('0x22')](removeEntity(_0x199363,null))[_0x4816('0x40')](handleError(_0x199363,null));}; \ No newline at end of file +var _0x5db8=['model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','merge','includeAll','findAll','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','error','stack','name','send','index','map','VoiceChanSpy','fieldName','type','key','query','keys','intersection'];(function(_0x3f81f1,_0x58fc80){var _0x5a7982=function(_0x37721f){while(--_0x37721f){_0x3f81f1['push'](_0x3f81f1['shift']());}};_0x5a7982(++_0x58fc80);}(_0x5db8,0xbb));var _0x85db=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0x5db8[_0x9c1f48];return _0x52ecd4;};'use strict';var emlformat=require(_0x85db('0x0'));var rimraf=require(_0x85db('0x1'));var zipdir=require(_0x85db('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x85db('0x3'));var moment=require(_0x85db('0x4'));var BPromise=require(_0x85db('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x85db('0x6'));var sox=require(_0x85db('0x7'));var csv=require(_0x85db('0x8'));var ejs=require(_0x85db('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x85db('0xa'));var crypto=require(_0x85db('0xb'));var jsforce=require(_0x85db('0xc'));var deskjs=require(_0x85db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x85db('0xe'));var Papa=require('papaparse');var Redis=require(_0x85db('0xf'));var authService=require(_0x85db('0x10'));var qs=require(_0x85db('0x11'));var as=require(_0x85db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x85db('0x13'));var config=require(_0x85db('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85db('0x15'))['db'];function respondWithStatusCode(_0x541f2f,_0x437f7a){_0x437f7a=_0x437f7a||0xcc;return function(_0x35f8c6){if(_0x35f8c6){return _0x541f2f[_0x85db('0x16')](_0x437f7a);}return _0x541f2f[_0x85db('0x17')](_0x437f7a)[_0x85db('0x18')]();};}function respondWithResult(_0xb7ea66,_0x2b7507){_0x2b7507=_0x2b7507||0xc8;return function(_0x25ec64){if(_0x25ec64){return _0xb7ea66[_0x85db('0x17')](_0x2b7507)[_0x85db('0x19')](_0x25ec64);}};}function respondWithFilteredResult(_0x1e9dec,_0x270fd7){return function(_0x2be61d){if(_0x2be61d){var _0x5ccfef=typeof _0x270fd7[_0x85db('0x1a')]===_0x85db('0x1b')&&typeof _0x270fd7[_0x85db('0x1c')]===_0x85db('0x1b');var _0x2ecd71=_0x2be61d[_0x85db('0x1d')];var _0x3209b3=_0x5ccfef?0x0:_0x270fd7['offset'];var _0x37ac04=_0x5ccfef?_0x2be61d[_0x85db('0x1d')]:_0x270fd7[_0x85db('0x1a')]+_0x270fd7[_0x85db('0x1c')];var _0x4d976d;if(_0x37ac04>=_0x2ecd71){_0x37ac04=_0x2ecd71;_0x4d976d=0xc8;}else{_0x4d976d=0xce;}_0x1e9dec[_0x85db('0x17')](_0x4d976d);return _0x1e9dec[_0x85db('0x1e')](_0x85db('0x1f'),_0x3209b3+'-'+_0x37ac04+'/'+_0x2ecd71)[_0x85db('0x19')](_0x2be61d);}return null;};}function patchUpdates(_0x107c10){return function(_0x5c37d7){try{jsonpatch[_0x85db('0x20')](_0x5c37d7,_0x107c10,!![]);}catch(_0x398aa2){return BPromise[_0x85db('0x21')](_0x398aa2);}return _0x5c37d7[_0x85db('0x22')]();};}function saveUpdates(_0x44c122,_0x3842d7){return function(_0x3a7148){if(_0x3a7148){return _0x3a7148[_0x85db('0x23')](_0x44c122)['then'](function(_0xfffea2){return _0xfffea2;});}return null;};}function removeEntity(_0x2534bc,_0x57fe5b){return function(_0x3381ec){if(_0x3381ec){return _0x3381ec[_0x85db('0x24')]()[_0x85db('0x25')](function(){var _0x51c948=_0x3381ec[_0x85db('0x26')]({'plain':!![]});var _0x46f428=_0x85db('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x46f428,'resourceId':_0x51c948['id']}})['then'](function(){return _0x3381ec;});})[_0x85db('0x25')](function(){_0x2534bc[_0x85db('0x17')](0xcc)[_0x85db('0x18')]();});}};}function handleEntityNotFound(_0x51b748,_0x71c6f4){return function(_0xc2abb8){if(!_0xc2abb8){_0x51b748[_0x85db('0x16')](0x194);}return _0xc2abb8;};}function handleError(_0x574bcc,_0x5c8ddd){_0x5c8ddd=_0x5c8ddd||0x1f4;return function(_0x299013){logger[_0x85db('0x28')](_0x299013[_0x85db('0x29')]);if(_0x299013[_0x85db('0x2a')]){delete _0x299013[_0x85db('0x2a')];}_0x574bcc[_0x85db('0x17')](_0x5c8ddd)[_0x85db('0x2b')](_0x299013);};}exports[_0x85db('0x2c')]=function(_0x6ee161,_0x1edc8d){var _0x580e90={},_0x4a15b9={},_0x13ad98={'count':0x0,'rows':[]};var _0x5e0e75=_[_0x85db('0x2d')](db[_0x85db('0x2e')]['rawAttributes'],function(_0x1d15b0){return{'name':_0x1d15b0[_0x85db('0x2f')],'type':_0x1d15b0[_0x85db('0x30')][_0x85db('0x31')]};});_0x4a15b9['model']=_[_0x85db('0x2d')](_0x5e0e75,_0x85db('0x2a'));_0x4a15b9[_0x85db('0x32')]=_[_0x85db('0x33')](_0x6ee161[_0x85db('0x32')]);_0x4a15b9['filters']=_[_0x85db('0x34')](_0x4a15b9[_0x85db('0x35')],_0x4a15b9[_0x85db('0x32')]);_0x580e90[_0x85db('0x36')]=_['intersection'](_0x4a15b9[_0x85db('0x35')],qs[_0x85db('0x37')](_0x6ee161[_0x85db('0x32')]['fields']));_0x580e90['attributes']=_0x580e90[_0x85db('0x36')][_0x85db('0x38')]?_0x580e90['attributes']:_0x4a15b9[_0x85db('0x35')];if(!_0x6ee161[_0x85db('0x32')][_0x85db('0x39')](_0x85db('0x3a'))){_0x580e90[_0x85db('0x1c')]=qs[_0x85db('0x1c')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1c')]);_0x580e90[_0x85db('0x1a')]=qs[_0x85db('0x1a')](_0x6ee161[_0x85db('0x32')][_0x85db('0x1a')]);}_0x580e90['order']=qs[_0x85db('0x3b')](_0x6ee161[_0x85db('0x32')][_0x85db('0x3b')]);_0x580e90[_0x85db('0x3c')]=qs['filters'](_[_0x85db('0x3d')](_0x6ee161[_0x85db('0x32')],_0x4a15b9[_0x85db('0x3e')]),_0x5e0e75);if(_0x6ee161[_0x85db('0x32')]['filter']){_0x580e90['where']=_['merge'](_0x580e90['where'],{'$or':_['map'](_0x5e0e75,function(_0x3b9d1b){if(_0x3b9d1b[_0x85db('0x30')]!==_0x85db('0x3f')){var _0x17f649={};_0x17f649[_0x3b9d1b[_0x85db('0x2a')]]={'$like':'%'+_0x6ee161['query']['filter']+'%'};return _0x17f649;}})});}_0x580e90=_[_0x85db('0x40')]({},_0x580e90,_0x6ee161['options']);var _0x9f2d7f={'where':_0x580e90[_0x85db('0x3c')]};return db['VoiceChanSpy']['count'](_0x9f2d7f)[_0x85db('0x25')](function(_0x928808){_0x13ad98[_0x85db('0x1d')]=_0x928808;if(_0x6ee161[_0x85db('0x32')][_0x85db('0x41')]){_0x580e90['include']=[{'all':!![]}];}return db[_0x85db('0x2e')][_0x85db('0x42')](_0x580e90);})[_0x85db('0x25')](function(_0x5be721){_0x13ad98['rows']=_0x5be721;return _0x13ad98;})['then'](respondWithFilteredResult(_0x1edc8d,_0x580e90))[_0x85db('0x43')](handleError(_0x1edc8d,null));};exports[_0x85db('0x44')]=function(_0x116cb3,_0x57677d){var _0x5ef59b={'raw':![],'where':{'id':_0x116cb3['params']['id']}},_0x3e4dbc={};_0x3e4dbc[_0x85db('0x35')]=_[_0x85db('0x33')](db[_0x85db('0x2e')]['rawAttributes']);_0x3e4dbc[_0x85db('0x32')]=_[_0x85db('0x33')](_0x116cb3[_0x85db('0x32')]);_0x3e4dbc[_0x85db('0x3e')]=_[_0x85db('0x34')](_0x3e4dbc[_0x85db('0x35')],_0x3e4dbc[_0x85db('0x32')]);_0x5ef59b[_0x85db('0x36')]=_[_0x85db('0x34')](_0x3e4dbc['model'],qs[_0x85db('0x37')](_0x116cb3[_0x85db('0x32')][_0x85db('0x37')]));_0x5ef59b[_0x85db('0x36')]=_0x5ef59b[_0x85db('0x36')][_0x85db('0x38')]?_0x5ef59b['attributes']:_0x3e4dbc[_0x85db('0x35')];if(_0x116cb3[_0x85db('0x32')][_0x85db('0x41')]){_0x5ef59b['include']=[{'all':!![]}];}_0x5ef59b=_['merge']({},_0x5ef59b,_0x116cb3[_0x85db('0x45')]);return db['VoiceChanSpy'][_0x85db('0x46')](_0x5ef59b)[_0x85db('0x25')](handleEntityNotFound(_0x57677d,null))[_0x85db('0x25')](respondWithResult(_0x57677d,null))[_0x85db('0x43')](handleError(_0x57677d,null));};exports[_0x85db('0x47')]=function(_0x5e1455,_0x5d44ef){return db[_0x85db('0x2e')][_0x85db('0x47')](_0x5e1455[_0x85db('0x48')],{})[_0x85db('0x25')](function(_0x1b6157){var _0x107882=_0x5e1455[_0x85db('0x49')][_0x85db('0x26')]({'plain':!![]});if(!_0x107882)throw new Error(_0x85db('0x4a'));if(_0x107882[_0x85db('0x4b')]==='user'){var _0x69c505=_0x1b6157[_0x85db('0x26')]({'plain':!![]});var _0x54abf5='ChanSpies';return db[_0x85db('0x4c')][_0x85db('0x46')]({'where':{'name':_0x54abf5,'userProfileId':_0x107882['userProfileId']},'raw':!![]})['then'](function(_0x74b926){if(_0x74b926&&_0x74b926[_0x85db('0x4d')]===0x0){return db['UserProfileResource'][_0x85db('0x47')]({'name':_0x69c505[_0x85db('0x2a')],'resourceId':_0x69c505['id'],'type':_0x74b926[_0x85db('0x2a')],'sectionId':_0x74b926['id']},{})[_0x85db('0x25')](function(){return _0x1b6157;});}else{return _0x1b6157;}})[_0x85db('0x43')](function(_0x2cddad){logger[_0x85db('0x28')](_0x85db('0x4e'),_0x2cddad);throw _0x2cddad;});}return _0x1b6157;})[_0x85db('0x25')](respondWithResult(_0x5d44ef,0xc9))[_0x85db('0x43')](handleError(_0x5d44ef,null));};exports['update']=function(_0x4ef4db,_0x283b13){if(_0x4ef4db[_0x85db('0x48')]['id']){delete _0x4ef4db[_0x85db('0x48')]['id'];}return db[_0x85db('0x2e')][_0x85db('0x46')]({'where':{'id':_0x4ef4db[_0x85db('0x4f')]['id']}})[_0x85db('0x25')](handleEntityNotFound(_0x283b13,null))[_0x85db('0x25')](saveUpdates(_0x4ef4db[_0x85db('0x48')],null))[_0x85db('0x25')](respondWithResult(_0x283b13,null))[_0x85db('0x43')](handleError(_0x283b13,null));};exports[_0x85db('0x24')]=function(_0x198dad,_0x425e61){return db['VoiceChanSpy'][_0x85db('0x46')]({'where':{'id':_0x198dad[_0x85db('0x4f')]['id']}})['then'](handleEntityNotFound(_0x425e61,null))[_0x85db('0x25')](removeEntity(_0x425e61,null))[_0x85db('0x43')](handleError(_0x425e61,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1c38e91..fe91d0b 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 _0x46de=['Authenticate','password','ChanSpy','SIP/%s,%s','name','options','length','concat','internal','User','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','lodash','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat'];(function(_0x28ac84,_0x5633f2){var _0x922e97=function(_0x3e8987){while(--_0x3e8987){_0x28ac84['push'](_0x28ac84['shift']());}};_0x922e97(++_0x5633f2);}(_0x46de,0x1d1));var _0xe46d=function(_0x234995,_0x48c007){_0x234995=_0x234995-0x0;var _0x5115f0=_0x46de[_0x234995];return _0x5115f0;};'use strict';var _=require(_0xe46d('0x0'));var util=require(_0xe46d('0x1'));var BPromise=require('bluebird');var attributes=require(_0xe46d('0x2'));var getUserApplications=function(_0x10ccf4,_0xfb3407,_0x47da9d){var _0x66277f=0x1;var _0x1541d1=[];var _0x5f56e2={'context':_0xfb3407[_0xe46d('0x3')]||_0xe46d('0x4'),'exten':util[_0xe46d('0x5')](_0xe46d('0x6'),_0x10ccf4['prefix'],_0x47da9d),'type':_0xe46d('0x7'),'isApp':![],'ChanSpyId':_0x10ccf4['id'],'UserId':_0xfb3407['id']};_0x1541d1[_0xe46d('0x8')](_[_0xe46d('0x9')]({'app':_0xe46d('0xa'),'appdata':util[_0xe46d('0x5')](_0xe46d('0xb'),_0xe46d('0xc')),'priority':_0x66277f++},_0x5f56e2));if(_0x10ccf4[_0xe46d('0xd')]){_0x1541d1[_0xe46d('0x8')](_[_0xe46d('0x9')]({'app':_0xe46d('0xe'),'appdata':util[_0xe46d('0x5')]('${UNIQUEID}.%s,a',_0x10ccf4[_0xe46d('0xf')]),'priority':_0x66277f++},_0x5f56e2));}if(_0x10ccf4['auth']){_0x1541d1['push'](_[_0xe46d('0x9')]({'app':_0xe46d('0x10'),'appdata':_0x10ccf4[_0xe46d('0x11')],'priority':_0x66277f++},_0x5f56e2));}_0x1541d1['push'](_[_0xe46d('0x9')]({'app':_0xe46d('0x12'),'appdata':util[_0xe46d('0x5')](_0xe46d('0x13'),_0xfb3407[_0xe46d('0x14')],_0x10ccf4[_0xe46d('0x15')]?_0x10ccf4['options']['join'](''):''),'priority':_0x66277f++},_0x5f56e2));if(_0x10ccf4[_0xe46d('0xd')]){_0x1541d1[_0xe46d('0x8')](_[_0xe46d('0x9')]({'app':'StopMixMonitor','priority':_0x66277f++},_0x5f56e2));}return _0x1541d1;};var getChanSpyApplications=function(_0x453242,_0x5030dd){var _0x7a7d76=[];for(var _0x3611ec=0x0,_0xc31a67=0x1;_0x3611ec<_0x5030dd[_0xe46d('0x16')];_0x3611ec++,_0xc31a67=0x1){_0x7a7d76=_0x7a7d76[_0xe46d('0x17')](getUserApplications(_0x453242,_0x5030dd[_0x3611ec],_0x5030dd[_0x3611ec][_0xe46d('0x18')]));if(_0x5030dd[_0x3611ec]['internal']!=_0x5030dd[_0x3611ec]['name']){_0x7a7d76=_0x7a7d76['concat'](getUserApplications(_0x453242,_0x5030dd[_0x3611ec],_0x5030dd[_0x3611ec][_0xe46d('0x14')]));}}return _0x7a7d76;};var getChanSpyPromise=function(_0x1472d6,_0x1397fb){return new BPromise(function(_0x59d998,_0x4159ea){return _0x1472d6[_0xe46d('0x19')][_0xe46d('0x1a')]({'attributes':['id',_0xe46d('0x14'),_0xe46d('0x18')],'where':{'role':_0xe46d('0x1b'),'chanspy':!![]},'raw':!![]})[_0xe46d('0x1c')](function(_0x20cb07){if(_0x20cb07){return _0x59d998(getChanSpyApplications(_0x1397fb,_0x20cb07));}return _0x59d998([]);})[_0xe46d('0x1d')](function(_0x3d6785){_0x4159ea(_0x3d6785);});});};module[_0xe46d('0x1e')]=function(_0x218853,_0x27ae10){var _0x586a92=_0x218853[_0xe46d('0x1f')];return _0x218853[_0xe46d('0x20')](_0xe46d('0x21'),attributes,{'tableName':_0xe46d('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5beba9,_0x23cfad,_0x3fe366){return getChanSpyPromise(_0x586a92,_0x5beba9)[_0xe46d('0x1c')](function(_0x24b8e6){if(_0x24b8e6&&_0x24b8e6[_0xe46d('0x16')]){return _0x586a92[_0xe46d('0x23')][_0xe46d('0x24')](_0x24b8e6);}})[_0xe46d('0x1c')](function(){_0x3fe366();})[_0xe46d('0x1d')](function(_0xa3c18d){_0x3fe366(_0xa3c18d);});},'afterUpdate':function(_0x6b25b0,_0x1ac469,_0x551e8f){return _0x586a92[_0xe46d('0x23')]['destroy']({'where':{'ChanSpyId':_0x6b25b0['id']}})[_0xe46d('0x1c')](function(){return getChanSpyPromise(_0x586a92,_0x6b25b0);})[_0xe46d('0x1c')](function(_0x33a6f6){if(_0x33a6f6&&_0x33a6f6[_0xe46d('0x16')]){return _0x586a92[_0xe46d('0x23')][_0xe46d('0x24')](_0x33a6f6);}})['then'](function(){_0x551e8f();})[_0xe46d('0x1d')](function(_0xed80b3){_0x551e8f(_0xed80b3);});},'afterDestroy':function(_0x5085ec,_0x50b2b4,_0x48e8a3){return _0x586a92[_0xe46d('0x23')]['destroy']({'where':{'ChanSpyId':_0x5085ec['id']}})[_0xe46d('0x1c')](function(){_0x48e8a3();})['catch'](function(_0x26ea9c){_0x48e8a3(_0x26ea9c);});}}});}; \ No newline at end of file +var _0x11e8=['format','%s%s','push','Set','CDR(type)=%s','chanspy','record','merge','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','findAll','agent','then','catch','exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x1c688b,_0x4df102){var _0x4d4577=function(_0x29a41b){while(--_0x29a41b){_0x1c688b['push'](_0x1c688b['shift']());}};_0x4d4577(++_0x4df102);}(_0x11e8,0x147));var _0x811e=function(_0x549391,_0x89df4d){_0x549391=_0x549391-0x0;var _0x36e298=_0x11e8[_0x549391];return _0x36e298;};'use strict';var _=require(_0x811e('0x0'));var util=require(_0x811e('0x1'));var BPromise=require(_0x811e('0x2'));var attributes=require(_0x811e('0x3'));var getUserApplications=function(_0x5c0c8b,_0x48c3f6,_0x17c45b){var _0x1e406a=0x1;var _0x3bda60=[];var _0x2bf614={'context':_0x48c3f6[_0x811e('0x4')]||_0x811e('0x5'),'exten':util[_0x811e('0x6')](_0x811e('0x7'),_0x5c0c8b['prefix'],_0x17c45b),'type':'system','isApp':![],'ChanSpyId':_0x5c0c8b['id'],'UserId':_0x48c3f6['id']};_0x3bda60[_0x811e('0x8')](_['merge']({'app':_0x811e('0x9'),'appdata':util['format'](_0x811e('0xa'),_0x811e('0xb')),'priority':_0x1e406a++},_0x2bf614));if(_0x5c0c8b[_0x811e('0xc')]){_0x3bda60['push'](_[_0x811e('0xd')]({'app':'MixMonitor','appdata':util['format']('${UNIQUEID}.%s,a',_0x5c0c8b[_0x811e('0xe')]),'priority':_0x1e406a++},_0x2bf614));}if(_0x5c0c8b[_0x811e('0xf')]){_0x3bda60[_0x811e('0x8')](_[_0x811e('0xd')]({'app':_0x811e('0x10'),'appdata':_0x5c0c8b[_0x811e('0x11')],'priority':_0x1e406a++},_0x2bf614));}_0x3bda60[_0x811e('0x8')](_[_0x811e('0xd')]({'app':_0x811e('0x12'),'appdata':util[_0x811e('0x6')](_0x811e('0x13'),_0x48c3f6[_0x811e('0x14')],_0x5c0c8b['options']?_0x5c0c8b[_0x811e('0x15')][_0x811e('0x16')](''):''),'priority':_0x1e406a++},_0x2bf614));if(_0x5c0c8b[_0x811e('0xc')]){_0x3bda60['push'](_['merge']({'app':'StopMixMonitor','priority':_0x1e406a++},_0x2bf614));}return _0x3bda60;};var getChanSpyApplications=function(_0x2b5f8f,_0x3e0f3d){var _0x1dc29f=[];for(var _0x23734e=0x0,_0x20f713=0x1;_0x23734e<_0x3e0f3d[_0x811e('0x17')];_0x23734e++,_0x20f713=0x1){_0x1dc29f=_0x1dc29f[_0x811e('0x18')](getUserApplications(_0x2b5f8f,_0x3e0f3d[_0x23734e],_0x3e0f3d[_0x23734e][_0x811e('0x19')]));if(_0x3e0f3d[_0x23734e][_0x811e('0x19')]!=_0x3e0f3d[_0x23734e][_0x811e('0x14')]){_0x1dc29f=_0x1dc29f[_0x811e('0x18')](getUserApplications(_0x2b5f8f,_0x3e0f3d[_0x23734e],_0x3e0f3d[_0x23734e][_0x811e('0x14')]));}}return _0x1dc29f;};var getChanSpyPromise=function(_0x28b497,_0x12873c){return new BPromise(function(_0x2e3d9f,_0x252b72){return _0x28b497['User'][_0x811e('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0x811e('0x1b'),'chanspy':!![]},'raw':!![]})[_0x811e('0x1c')](function(_0x7d6f26){if(_0x7d6f26){return _0x2e3d9f(getChanSpyApplications(_0x12873c,_0x7d6f26));}return _0x2e3d9f([]);})[_0x811e('0x1d')](function(_0x142265){_0x252b72(_0x142265);});});};module[_0x811e('0x1e')]=function(_0x2df31d,_0x11600b){var _0x271bf4=_0x2df31d[_0x811e('0x1f')];return _0x2df31d[_0x811e('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x811e('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1c7d75,_0x4c8eef,_0x202529){return getChanSpyPromise(_0x271bf4,_0x1c7d75)['then'](function(_0x102740){if(_0x102740&&_0x102740[_0x811e('0x17')]){return _0x271bf4[_0x811e('0x22')]['bulkCreate'](_0x102740);}})['then'](function(){_0x202529();})[_0x811e('0x1d')](function(_0x15317a){_0x202529(_0x15317a);});},'afterUpdate':function(_0x176056,_0x461c1a,_0x8efe84){return _0x271bf4['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x176056['id']}})[_0x811e('0x1c')](function(){return getChanSpyPromise(_0x271bf4,_0x176056);})['then'](function(_0x2f8d8b){if(_0x2f8d8b&&_0x2f8d8b[_0x811e('0x17')]){return _0x271bf4[_0x811e('0x22')][_0x811e('0x23')](_0x2f8d8b);}})[_0x811e('0x1c')](function(){_0x8efe84();})[_0x811e('0x1d')](function(_0x327a44){_0x8efe84(_0x327a44);});},'afterDestroy':function(_0x4b46fc,_0x4dd793,_0x51747f){return _0x271bf4[_0x811e('0x22')][_0x811e('0x24')]({'where':{'ChanSpyId':_0x4b46fc['id']}})[_0x811e('0x1c')](function(){_0x51747f();})[_0x811e('0x1d')](function(_0x219352){_0x51747f(_0x219352);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index bc61f1c..fcbdc6a 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 _0x4fdb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x39e2d7,_0x1b15f6){var _0x413d0d=function(_0x3af71d){while(--_0x3af71d){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x413d0d(++_0x1b15f6);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xfeecc4,_0x40831d){_0xfeecc4=_0xfeecc4-0x0;var _0x78f0e6=_0x4fdb[_0xfeecc4];return _0x78f0e6;};'use strict';var _=require(_0xb4fd('0x0'));var util=require(_0xb4fd('0x1'));var moment=require(_0xb4fd('0x2'));var BPromise=require(_0xb4fd('0x3'));var rs=require(_0xb4fd('0x4'));var fs=require('fs');var Redis=require(_0xb4fd('0x5'));var db=require(_0xb4fd('0x6'))['db'];var utils=require(_0xb4fd('0x7'));var logger=require(_0xb4fd('0x8'))('rpc');var config=require(_0xb4fd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4fd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53273f,_0x299bff,_0x3af8e3){return new BPromise(function(_0x1151b5,_0x52dca2){return client['request'](_0x53273f,_0x3af8e3)[_0xb4fd('0xb')](function(_0x4f9d18){logger[_0xb4fd('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x299bff,_0xb4fd('0xd'));logger[_0xb4fd('0xe')](_0xb4fd('0xf'),_0x299bff,_0xb4fd('0xd'),JSON[_0xb4fd('0x10')](_0x4f9d18));if(_0x4f9d18['error']){if(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x12')]===0x1f4){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x4f9d18['error'][_0xb4fd('0x14')]);return _0x52dca2(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}logger['error'](_0xb4fd('0x13'),_0x299bff,_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);return _0x1151b5(_0x4f9d18[_0xb4fd('0x11')][_0xb4fd('0x14')]);}else{logger[_0xb4fd('0xc')](_0xb4fd('0x13'),_0x299bff,'request\x20sent');_0x1151b5(_0x4f9d18[_0xb4fd('0x15')][_0xb4fd('0x14')]);}})[_0xb4fd('0x16')](function(_0x2d4701){logger[_0xb4fd('0x11')](_0xb4fd('0x13'),_0x299bff,_0x2d4701);_0x52dca2(_0x2d4701);});});} \ No newline at end of file +var _0x9567=['info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0x9567,0xdc));var _0x7956=function(_0x593170,_0x2aea31){_0x593170=_0x593170-0x0;var _0x39d215=_0x9567[_0x593170];return _0x39d215;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 5c6408b..4799931 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 _0x7e9c=['get','/:id','create','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x7e9c,0x136));var _0xc7e9=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x7e9c[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xc7e9('0x0'));var util=require(_0xc7e9('0x1'));var path=require(_0xc7e9('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7e9('0x3'));var router=express[_0xc7e9('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7e9('0x5'));var interaction=require(_0xc7e9('0x6'));var config=require(_0xc7e9('0x7'));var controller=require('./voiceContext.controller');router['get']('/',auth[_0xc7e9('0x8')](),controller[_0xc7e9('0x9')]);router[_0xc7e9('0xa')](_0xc7e9('0xb'),auth[_0xc7e9('0x8')](),controller['show']);router['post']('/',auth[_0xc7e9('0x8')](),controller[_0xc7e9('0xc')]);router[_0xc7e9('0xd')](_0xc7e9('0xb'),auth[_0xc7e9('0x8')](),controller['update']);router[_0xc7e9('0xe')](_0xc7e9('0xb'),auth[_0xc7e9('0x8')](),controller[_0xc7e9('0xf')]);module['exports']=router; \ No newline at end of file +var _0x703f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','exports','multer'];(function(_0x487ab8,_0x3da7a5){var _0x45fa7d=function(_0xe41a6){while(--_0xe41a6){_0x487ab8['push'](_0x487ab8['shift']());}};_0x45fa7d(++_0x3da7a5);}(_0x703f,0x11c));var _0xf703=function(_0x49864f,_0x4bda61){_0x49864f=_0x49864f-0x0;var _0x226870=_0x703f[_0x49864f];return _0x226870;};'use strict';var multer=require(_0xf703('0x0'));var util=require(_0xf703('0x1'));var path=require(_0xf703('0x2'));var timeout=require(_0xf703('0x3'));var express=require(_0xf703('0x4'));var router=express[_0xf703('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf703('0x6'));var interaction=require(_0xf703('0x7'));var config=require(_0xf703('0x8'));var controller=require(_0xf703('0x9'));router[_0xf703('0xa')]('/',auth[_0xf703('0xb')](),controller['index']);router['get'](_0xf703('0xc'),auth[_0xf703('0xb')](),controller[_0xf703('0xd')]);router[_0xf703('0xe')]('/',auth['isAuthenticated'](),controller[_0xf703('0xf')]);router[_0xf703('0x10')]('/:id',auth[_0xf703('0xb')](),controller[_0xf703('0x11')]);router['delete'](_0xf703('0xc'),auth[_0xf703('0xb')](),controller['destroy']);module[_0xf703('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 7d7daaf..691b94c 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 _0x5557=['sequelize','STRING','name','BOOLEAN'];(function(_0x51921f,_0x42bde0){var _0x41743a=function(_0x27105d){while(--_0x27105d){_0x51921f['push'](_0x51921f['shift']());}};_0x41743a(++_0x42bde0);}(_0x5557,0xec));var _0x7555=function(_0x2f57ef,_0x11e95a){_0x2f57ef=_0x2f57ef-0x0;var _0x12a596=_0x5557[_0x2f57ef];return _0x12a596;};'use strict';var Sequelize=require(_0x7555('0x0'));module['exports']={'name':{'type':Sequelize[_0x7555('0x1')],'unique':_0x7555('0x2')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7555('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x223c=['sequelize','exports','name','STRING','BOOLEAN'];(function(_0x3ecc99,_0x47435a){var _0x478ae0=function(_0x5b3710){while(--_0x5b3710){_0x3ecc99['push'](_0x3ecc99['shift']());}};_0x478ae0(++_0x47435a);}(_0x223c,0x64));var _0xc223=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x223c[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0xc223('0x0'));module[_0xc223('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc223('0x2')},'description':{'type':Sequelize[_0xc223('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc223('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f27fa84..bd8eae5 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 _0xf3c8=['lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','VoiceContext,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','sendStatus','status','json','limit','count','offset','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','end','stack','send','index','map','VoiceContext','fieldName','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','name','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','Reload','chan_sip.so','role','user','UserProfileSection','userProfileId','autoAssociation','render','/etc/asterisk/extensions_xcally_contexts.conf','writeFileSync','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0xf3c8,0x122));var _0x8f3c=function(_0x5d526a,_0x2ff1da){_0x5d526a=_0x5d526a-0x0;var _0x1cee63=_0xf3c8[_0x5d526a];return _0x1cee63;};'use strict';var emlformat=require(_0x8f3c('0x0'));var rimraf=require(_0x8f3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8f3c('0x2'));var moment=require(_0x8f3c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8f3c('0x4'));var util=require('util');var path=require(_0x8f3c('0x5'));var sox=require(_0x8f3c('0x6'));var csv=require(_0x8f3c('0x7'));var ejs=require(_0x8f3c('0x8'));var fs=require('fs');var fs_extra=require(_0x8f3c('0x9'));var _=require(_0x8f3c('0xa'));var squel=require(_0x8f3c('0xb'));var crypto=require('crypto');var jsforce=require(_0x8f3c('0xc'));var deskjs=require(_0x8f3c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8f3c('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8f3c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8f3c('0x10'));var hardwareService=require(_0x8f3c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x8f3c('0x12'));var config=require(_0x8f3c('0x13'));var licenseUtil=require(_0x8f3c('0x14'));var db=require(_0x8f3c('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x8f3c('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x7a1b99,_0x3b907a,_0x403d6e,_0x8eadf1){return new BPromise(function(_0xbdd06,_0x5b298e){var _0x3b9109=_0x8eadf1||client;return _0x3b9109[_0x8f3c('0x17')](_0x7a1b99,_0x403d6e)[_0x8f3c('0x18')](function(_0x563087){logger['info'](_0x8f3c('0x19'),_0x3b907a,'request\x20sent');logger[_0x8f3c('0x1a')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3b907a,'request\x20sent',JSON[_0x8f3c('0x1b')](_0x563087));if(_0x563087['error']){if(_0x563087[_0x8f3c('0x1c')][_0x8f3c('0x1d')]===0x1f4){logger[_0x8f3c('0x1c')](_0x8f3c('0x19'),_0x3b907a,_0x563087[_0x8f3c('0x1c')][_0x8f3c('0x1e')]);return _0x5b298e(_0x563087[_0x8f3c('0x1c')][_0x8f3c('0x1e')]);}logger[_0x8f3c('0x1c')](_0x8f3c('0x19'),_0x3b907a,_0x563087[_0x8f3c('0x1c')][_0x8f3c('0x1e')]);return _0xbdd06(_0x563087[_0x8f3c('0x1c')][_0x8f3c('0x1e')]);}else{logger[_0x8f3c('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x3b907a,'request\x20sent');_0xbdd06(_0x563087[_0x8f3c('0x20')][_0x8f3c('0x1e')]);}})[_0x8f3c('0x21')](function(_0x220b1a){logger[_0x8f3c('0x1c')](_0x8f3c('0x19'),_0x3b907a,_0x220b1a);_0x5b298e(_0x220b1a);});});}function respondWithStatusCode(_0x2bdd05,_0x17968b){_0x17968b=_0x17968b||0xcc;return function(_0x179af5){if(_0x179af5){return _0x2bdd05[_0x8f3c('0x22')](_0x17968b);}return _0x2bdd05['status'](_0x17968b)['end']();};}function respondWithResult(_0x53dcbf,_0x4d91cc){_0x4d91cc=_0x4d91cc||0xc8;return function(_0x31a86b){if(_0x31a86b){return _0x53dcbf[_0x8f3c('0x23')](_0x4d91cc)[_0x8f3c('0x24')](_0x31a86b);}};}function respondWithFilteredResult(_0x2176bc,_0x3a6b75){return function(_0x352b7f){if(_0x352b7f){var _0x5a69e7=typeof _0x3a6b75['offset']==='undefined'&&typeof _0x3a6b75[_0x8f3c('0x25')]==='undefined';var _0x54ae6f=_0x352b7f['count'];var _0x4179ac=_0x5a69e7?0x0:_0x3a6b75['offset'];var _0x260ba3=_0x5a69e7?_0x352b7f[_0x8f3c('0x26')]:_0x3a6b75[_0x8f3c('0x27')]+_0x3a6b75['limit'];var _0x42b200;if(_0x260ba3>=_0x54ae6f){_0x260ba3=_0x54ae6f;_0x42b200=0xc8;}else{_0x42b200=0xce;}_0x2176bc[_0x8f3c('0x23')](_0x42b200);return _0x2176bc['set'](_0x8f3c('0x28'),_0x4179ac+'-'+_0x260ba3+'/'+_0x54ae6f)[_0x8f3c('0x24')](_0x352b7f);}return null;};}function patchUpdates(_0x103ed4){return function(_0x37cbab){try{jsonpatch[_0x8f3c('0x29')](_0x37cbab,_0x103ed4,!![]);}catch(_0x3cf477){return BPromise[_0x8f3c('0x2a')](_0x3cf477);}return _0x37cbab[_0x8f3c('0x2b')]();};}function saveUpdates(_0x15f4f2,_0x283156){return function(_0x377dde){if(_0x377dde){return _0x377dde[_0x8f3c('0x2c')](_0x15f4f2)[_0x8f3c('0x18')](function(_0x52351b){return _0x52351b;});}return null;};}function removeEntity(_0x7e84d,_0x236971){return function(_0x3ea2ff){if(_0x3ea2ff){return _0x3ea2ff[_0x8f3c('0x2d')]()[_0x8f3c('0x18')](function(){var _0x35a807=_0x3ea2ff[_0x8f3c('0x2e')]({'plain':!![]});var _0x32255c=_0x8f3c('0x2f');return db[_0x8f3c('0x30')][_0x8f3c('0x2d')]({'where':{'type':_0x32255c,'resourceId':_0x35a807['id']}})[_0x8f3c('0x18')](function(){return _0x3ea2ff;});})[_0x8f3c('0x18')](function(){_0x7e84d[_0x8f3c('0x23')](0xcc)[_0x8f3c('0x31')]();});}};}function handleEntityNotFound(_0xf1207c,_0x16a64e){return function(_0x26610e){if(!_0x26610e){_0xf1207c[_0x8f3c('0x22')](0x194);}return _0x26610e;};}function handleError(_0x1b0ecf,_0x3cc8ca){_0x3cc8ca=_0x3cc8ca||0x1f4;return function(_0x2e5f77){logger['error'](_0x2e5f77[_0x8f3c('0x32')]);if(_0x2e5f77['name']){delete _0x2e5f77['name'];}_0x1b0ecf[_0x8f3c('0x23')](_0x3cc8ca)[_0x8f3c('0x33')](_0x2e5f77);};}exports[_0x8f3c('0x34')]=function(_0x8c1e2c,_0x19dd53){var _0x74e5db={},_0x4d9be6={},_0x3be1a0={'count':0x0,'rows':[]};var _0x39b39d=_[_0x8f3c('0x35')](db[_0x8f3c('0x36')]['rawAttributes'],function(_0x5b23a3){return{'name':_0x5b23a3[_0x8f3c('0x37')],'type':_0x5b23a3[_0x8f3c('0x38')][_0x8f3c('0x39')]};});_0x4d9be6[_0x8f3c('0x3a')]=_[_0x8f3c('0x35')](_0x39b39d,'name');_0x4d9be6[_0x8f3c('0x3b')]=_['keys'](_0x8c1e2c[_0x8f3c('0x3b')]);_0x4d9be6['filters']=_['intersection'](_0x4d9be6[_0x8f3c('0x3a')],_0x4d9be6[_0x8f3c('0x3b')]);_0x74e5db[_0x8f3c('0x3c')]=_[_0x8f3c('0x3d')](_0x4d9be6['model'],qs[_0x8f3c('0x3e')](_0x8c1e2c[_0x8f3c('0x3b')]['fields']));_0x74e5db[_0x8f3c('0x3c')]=_0x74e5db[_0x8f3c('0x3c')][_0x8f3c('0x3f')]?_0x74e5db[_0x8f3c('0x3c')]:_0x4d9be6[_0x8f3c('0x3a')];if(!_0x8c1e2c[_0x8f3c('0x3b')]['hasOwnProperty'](_0x8f3c('0x40'))){_0x74e5db[_0x8f3c('0x25')]=qs[_0x8f3c('0x25')](_0x8c1e2c[_0x8f3c('0x3b')]['limit']);_0x74e5db[_0x8f3c('0x27')]=qs[_0x8f3c('0x27')](_0x8c1e2c[_0x8f3c('0x3b')]['offset']);}_0x74e5db[_0x8f3c('0x41')]=qs[_0x8f3c('0x42')](_0x8c1e2c[_0x8f3c('0x3b')]['sort']);_0x74e5db[_0x8f3c('0x43')]=qs[_0x8f3c('0x44')](_[_0x8f3c('0x45')](_0x8c1e2c[_0x8f3c('0x3b')],_0x4d9be6[_0x8f3c('0x44')]),_0x39b39d);if(_0x8c1e2c[_0x8f3c('0x3b')][_0x8f3c('0x46')]){_0x74e5db[_0x8f3c('0x43')]=_['merge'](_0x74e5db[_0x8f3c('0x43')],{'$or':_[_0x8f3c('0x35')](_0x39b39d,function(_0x5cafb1){if(_0x5cafb1['type']!=='VIRTUAL'){var _0x150828={};_0x150828[_0x5cafb1[_0x8f3c('0x47')]]={'$like':'%'+_0x8c1e2c[_0x8f3c('0x3b')][_0x8f3c('0x46')]+'%'};return _0x150828;}})});}_0x74e5db=_[_0x8f3c('0x48')]({},_0x74e5db,_0x8c1e2c[_0x8f3c('0x49')]);var _0x4582ff={'where':_0x74e5db['where']};return db[_0x8f3c('0x36')][_0x8f3c('0x26')](_0x4582ff)[_0x8f3c('0x18')](function(_0x536e0f){_0x3be1a0[_0x8f3c('0x26')]=_0x536e0f;if(_0x8c1e2c[_0x8f3c('0x3b')][_0x8f3c('0x4a')]){_0x74e5db[_0x8f3c('0x4b')]=[{'all':!![]}];}return db[_0x8f3c('0x36')][_0x8f3c('0x4c')](_0x74e5db);})[_0x8f3c('0x18')](function(_0x5ab639){_0x3be1a0[_0x8f3c('0x4d')]=_0x5ab639;return _0x3be1a0;})['then'](respondWithFilteredResult(_0x19dd53,_0x74e5db))['catch'](handleError(_0x19dd53,null));};exports[_0x8f3c('0x4e')]=function(_0x3f4558,_0x43d426){var _0xd9d3ea={'raw':![],'where':{'id':_0x3f4558[_0x8f3c('0x4f')]['id']}},_0x1156b4={};_0x1156b4[_0x8f3c('0x3a')]=_[_0x8f3c('0x50')](db[_0x8f3c('0x36')][_0x8f3c('0x51')]);_0x1156b4[_0x8f3c('0x3b')]=_[_0x8f3c('0x50')](_0x3f4558['query']);_0x1156b4[_0x8f3c('0x44')]=_[_0x8f3c('0x3d')](_0x1156b4[_0x8f3c('0x3a')],_0x1156b4['query']);_0xd9d3ea[_0x8f3c('0x3c')]=_['intersection'](_0x1156b4[_0x8f3c('0x3a')],qs['fields'](_0x3f4558[_0x8f3c('0x3b')][_0x8f3c('0x3e')]));_0xd9d3ea[_0x8f3c('0x3c')]=_0xd9d3ea[_0x8f3c('0x3c')][_0x8f3c('0x3f')]?_0xd9d3ea['attributes']:_0x1156b4[_0x8f3c('0x3a')];if(_0x3f4558['query'][_0x8f3c('0x4a')]){_0xd9d3ea[_0x8f3c('0x4b')]=[{'all':!![]}];}_0xd9d3ea=_[_0x8f3c('0x48')]({},_0xd9d3ea,_0x3f4558['options']);return db['VoiceContext'][_0x8f3c('0x52')](_0xd9d3ea)[_0x8f3c('0x18')](handleEntityNotFound(_0x43d426,null))[_0x8f3c('0x18')](respondWithResult(_0x43d426,null))[_0x8f3c('0x21')](handleError(_0x43d426,null));};exports[_0x8f3c('0x53')]=function(_0x2549d9,_0x3b3f15,_0x1fcd50){var _0x28b087;return db[_0x8f3c('0x36')]['create'](_0x2549d9[_0x8f3c('0x54')],{'raw':!![]})[_0x8f3c('0x18')](function(_0x4eaefa){_0x28b087=_0x4eaefa;return db['VoiceContext'][_0x8f3c('0x4c')]({'raw':!![]});})[_0x8f3c('0x18')](function(_0x3e738b){var _0x2985d7=fs[_0x8f3c('0x55')](path[_0x8f3c('0x56')](config[_0x8f3c('0x57')],_0x8f3c('0x58')),_0x8f3c('0x59'));var _0x53af7c=ejs['render'](_0x2985d7,{'contexts':_0x3e738b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x53af7c);})[_0x8f3c('0x18')](function(){return respondWithRpcPromise(_0x8f3c('0x5a'),_0x8f3c('0x53'),{'module':_0x8f3c('0x5b')});})[_0x8f3c('0x18')](function(){var _0x564b94=_0x2549d9['user'][_0x8f3c('0x2e')]({'plain':!![]});if(!_0x564b94)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x564b94[_0x8f3c('0x5c')]===_0x8f3c('0x5d')){var _0x5cc5b3=_0x28b087[_0x8f3c('0x2e')]({'plain':!![]});return db[_0x8f3c('0x5e')][_0x8f3c('0x52')]({'where':{'name':'Contexts','userProfileId':_0x564b94[_0x8f3c('0x5f')]},'raw':!![]})['then'](function(_0x134f8c){if(_0x134f8c&&_0x134f8c[_0x8f3c('0x60')]===0x0){return db[_0x8f3c('0x30')][_0x8f3c('0x53')]({'name':_0x5cc5b3[_0x8f3c('0x47')],'resourceId':_0x5cc5b3['id'],'type':_0x134f8c['name'],'sectionId':_0x134f8c['id']},{})[_0x8f3c('0x18')](function(){return _0x28b087;});}else{return _0x28b087;}})['catch'](function(_0x517a97){logger[_0x8f3c('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x517a97);throw _0x517a97;});}return _0x28b087;})[_0x8f3c('0x18')](respondWithResult(_0x3b3f15,0xc9))[_0x8f3c('0x21')](handleError(_0x3b3f15,null));};exports['update']=function(_0x511200,_0x10a7f1,_0x9e4a83){var _0xd6642a;return db[_0x8f3c('0x36')][_0x8f3c('0x52')]({'where':{'id':_0x511200[_0x8f3c('0x4f')]['id']}})[_0x8f3c('0x18')](handleEntityNotFound(_0x10a7f1,null))[_0x8f3c('0x18')](saveUpdates(_0x511200[_0x8f3c('0x54')],null))[_0x8f3c('0x18')](function(_0x4c6a1b){if(_0x4c6a1b){_0xd6642a=_0x4c6a1b;return db[_0x8f3c('0x36')][_0x8f3c('0x4c')]({'raw':!![]});}})['then'](function(_0x44a909){var _0xfe50ee=fs['readFileSync'](path[_0x8f3c('0x56')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x4a7d13=ejs[_0x8f3c('0x61')](_0xfe50ee,{'contexts':_0x44a909||[]});fs['writeFileSync'](_0x8f3c('0x62'),_0x4a7d13);})[_0x8f3c('0x18')](function(){return respondWithRpcPromise(_0x8f3c('0x5a'),_0x8f3c('0x2c'),{'module':_0x8f3c('0x5b')});})[_0x8f3c('0x18')](function(){return _0xd6642a;})[_0x8f3c('0x18')](respondWithResult(_0x10a7f1,null))[_0x8f3c('0x21')](handleError(_0x10a7f1,null));};exports['destroy']=function(_0x3d3871,_0x43e525,_0x52589b){var _0x498879;return db['VoiceContext'][_0x8f3c('0x52')]({'where':{'id':_0x3d3871[_0x8f3c('0x4f')]['id']}})[_0x8f3c('0x18')](handleEntityNotFound(_0x43e525,null))[_0x8f3c('0x18')](removeEntity(_0x43e525,null))['then'](function(){return db[_0x8f3c('0x36')][_0x8f3c('0x4c')]({'raw':!![]});})[_0x8f3c('0x18')](function(_0x30f8ba){var _0x460ce1=fs['readFileSync'](path[_0x8f3c('0x56')](config[_0x8f3c('0x57')],_0x8f3c('0x58')),'utf8');var _0x25d576=ejs[_0x8f3c('0x61')](_0x460ce1,{'contexts':_0x30f8ba});fs[_0x8f3c('0x63')](_0x8f3c('0x62'),_0x25d576);return respondWithRpcPromise(_0x8f3c('0x5a'),_0x8f3c('0x2d'),{'module':_0x8f3c('0x5b')});})[_0x8f3c('0x21')](handleError(_0x43e525,null));}; \ No newline at end of file +var _0x5ca1=['key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','keys','find','create','body','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','render','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','end','offset','undefined','limit','count','json','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type'];(function(_0x2f9c17,_0x103d10){var _0x43d8a5=function(_0x4503d4){while(--_0x4503d4){_0x2f9c17['push'](_0x2f9c17['shift']());}};_0x43d8a5(++_0x103d10);}(_0x5ca1,0xf8));var _0x15ca=function(_0xc3536f,_0x37ab43){_0xc3536f=_0xc3536f-0x0;var _0x2159d7=_0x5ca1[_0xc3536f];return _0x2159d7;};'use strict';var emlformat=require(_0x15ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x15ca('0x1'));var jsonpatch=require(_0x15ca('0x2'));var rp=require(_0x15ca('0x3'));var moment=require(_0x15ca('0x4'));var BPromise=require(_0x15ca('0x5'));var Mustache=require(_0x15ca('0x6'));var util=require(_0x15ca('0x7'));var path=require(_0x15ca('0x8'));var sox=require(_0x15ca('0x9'));var csv=require(_0x15ca('0xa'));var ejs=require(_0x15ca('0xb'));var fs=require('fs');var fs_extra=require(_0x15ca('0xc'));var _=require('lodash');var squel=require(_0x15ca('0xd'));var crypto=require(_0x15ca('0xe'));var jsforce=require(_0x15ca('0xf'));var deskjs=require(_0x15ca('0x10'));var toCsv=require(_0x15ca('0xa'));var querystring=require(_0x15ca('0x11'));var Papa=require(_0x15ca('0x12'));var Redis=require(_0x15ca('0x13'));var authService=require(_0x15ca('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x15ca('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x15ca('0x16'));var utils=require('../../config/utils');var config=require(_0x15ca('0x17'));var licenseUtil=require(_0x15ca('0x18'));var db=require(_0x15ca('0x19'))['db'];var jayson=require(_0x15ca('0x1a'));var client=jayson[_0x15ca('0x1b')][_0x15ca('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x55d866,_0x43a8eb,_0x427495,_0x2688b4){return new BPromise(function(_0x625b88,_0x3d967f){var _0x52bcca=_0x2688b4||client;return _0x52bcca['request'](_0x55d866,_0x427495)[_0x15ca('0x1d')](function(_0x1c50c7){logger[_0x15ca('0x1e')](_0x15ca('0x1f'),_0x43a8eb,'request\x20sent');logger[_0x15ca('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x43a8eb,'request\x20sent',JSON[_0x15ca('0x21')](_0x1c50c7));if(_0x1c50c7['error']){if(_0x1c50c7[_0x15ca('0x22')][_0x15ca('0x23')]===0x1f4){logger[_0x15ca('0x22')](_0x15ca('0x1f'),_0x43a8eb,_0x1c50c7[_0x15ca('0x22')][_0x15ca('0x24')]);return _0x3d967f(_0x1c50c7[_0x15ca('0x22')][_0x15ca('0x24')]);}logger['error'](_0x15ca('0x1f'),_0x43a8eb,_0x1c50c7['error'][_0x15ca('0x24')]);return _0x625b88(_0x1c50c7['error'][_0x15ca('0x24')]);}else{logger[_0x15ca('0x1e')](_0x15ca('0x1f'),_0x43a8eb,_0x15ca('0x25'));_0x625b88(_0x1c50c7[_0x15ca('0x26')][_0x15ca('0x24')]);}})[_0x15ca('0x27')](function(_0xd996c){logger[_0x15ca('0x22')]('VoiceContext,\x20%s,\x20%s',_0x43a8eb,_0xd996c);_0x3d967f(_0xd996c);});});}function respondWithStatusCode(_0x2e025e,_0x1ecd6d){_0x1ecd6d=_0x1ecd6d||0xcc;return function(_0x4dcd02){if(_0x4dcd02){return _0x2e025e['sendStatus'](_0x1ecd6d);}return _0x2e025e[_0x15ca('0x28')](_0x1ecd6d)[_0x15ca('0x29')]();};}function respondWithResult(_0x7c2803,_0x2f5c14){_0x2f5c14=_0x2f5c14||0xc8;return function(_0x2dbabf){if(_0x2dbabf){return _0x7c2803[_0x15ca('0x28')](_0x2f5c14)['json'](_0x2dbabf);}};}function respondWithFilteredResult(_0x47186f,_0x3958ec){return function(_0x88f7e3){if(_0x88f7e3){var _0x51092f=typeof _0x3958ec[_0x15ca('0x2a')]===_0x15ca('0x2b')&&typeof _0x3958ec[_0x15ca('0x2c')]==='undefined';var _0x50f98b=_0x88f7e3[_0x15ca('0x2d')];var _0x3dad06=_0x51092f?0x0:_0x3958ec[_0x15ca('0x2a')];var _0xf0ffa8=_0x51092f?_0x88f7e3[_0x15ca('0x2d')]:_0x3958ec[_0x15ca('0x2a')]+_0x3958ec[_0x15ca('0x2c')];var _0x5b7a2c;if(_0xf0ffa8>=_0x50f98b){_0xf0ffa8=_0x50f98b;_0x5b7a2c=0xc8;}else{_0x5b7a2c=0xce;}_0x47186f[_0x15ca('0x28')](_0x5b7a2c);return _0x47186f['set']('Content-Range',_0x3dad06+'-'+_0xf0ffa8+'/'+_0x50f98b)[_0x15ca('0x2e')](_0x88f7e3);}return null;};}function patchUpdates(_0x4ca504){return function(_0x357d28){try{jsonpatch[_0x15ca('0x2f')](_0x357d28,_0x4ca504,!![]);}catch(_0x56acad){return BPromise[_0x15ca('0x30')](_0x56acad);}return _0x357d28[_0x15ca('0x31')]();};}function saveUpdates(_0x599629,_0x212de6){return function(_0x2a9ffa){if(_0x2a9ffa){return _0x2a9ffa[_0x15ca('0x32')](_0x599629)['then'](function(_0x3855ee){return _0x3855ee;});}return null;};}function removeEntity(_0x380635,_0x45700f){return function(_0x508df5){if(_0x508df5){return _0x508df5[_0x15ca('0x33')]()[_0x15ca('0x1d')](function(){var _0x27116d=_0x508df5[_0x15ca('0x34')]({'plain':!![]});var _0x1ee1e4=_0x15ca('0x35');return db[_0x15ca('0x36')]['destroy']({'where':{'type':_0x1ee1e4,'resourceId':_0x27116d['id']}})['then'](function(){return _0x508df5;});})[_0x15ca('0x1d')](function(){_0x380635['status'](0xcc)[_0x15ca('0x29')]();});}};}function handleEntityNotFound(_0x2ada20,_0xed358b){return function(_0x3b0235){if(!_0x3b0235){_0x2ada20['sendStatus'](0x194);}return _0x3b0235;};}function handleError(_0x195c25,_0x4c4518){_0x4c4518=_0x4c4518||0x1f4;return function(_0x5dc1f0){logger[_0x15ca('0x22')](_0x5dc1f0[_0x15ca('0x37')]);if(_0x5dc1f0[_0x15ca('0x38')]){delete _0x5dc1f0[_0x15ca('0x38')];}_0x195c25[_0x15ca('0x28')](_0x4c4518)[_0x15ca('0x39')](_0x5dc1f0);};}exports[_0x15ca('0x3a')]=function(_0x2f3902,_0x101c40){var _0x26c1c7={},_0x2a93b0={},_0x488b56={'count':0x0,'rows':[]};var _0x363581=_[_0x15ca('0x3b')](db[_0x15ca('0x3c')][_0x15ca('0x3d')],function(_0x4e1d15){return{'name':_0x4e1d15[_0x15ca('0x3e')],'type':_0x4e1d15[_0x15ca('0x3f')][_0x15ca('0x40')]};});_0x2a93b0[_0x15ca('0x41')]=_[_0x15ca('0x3b')](_0x363581,'name');_0x2a93b0['query']=_['keys'](_0x2f3902[_0x15ca('0x42')]);_0x2a93b0[_0x15ca('0x43')]=_[_0x15ca('0x44')](_0x2a93b0[_0x15ca('0x41')],_0x2a93b0[_0x15ca('0x42')]);_0x26c1c7[_0x15ca('0x45')]=_[_0x15ca('0x44')](_0x2a93b0['model'],qs[_0x15ca('0x46')](_0x2f3902[_0x15ca('0x42')][_0x15ca('0x46')]));_0x26c1c7[_0x15ca('0x45')]=_0x26c1c7['attributes'][_0x15ca('0x47')]?_0x26c1c7['attributes']:_0x2a93b0[_0x15ca('0x41')];if(!_0x2f3902[_0x15ca('0x42')]['hasOwnProperty'](_0x15ca('0x48'))){_0x26c1c7[_0x15ca('0x2c')]=qs[_0x15ca('0x2c')](_0x2f3902[_0x15ca('0x42')][_0x15ca('0x2c')]);_0x26c1c7[_0x15ca('0x2a')]=qs[_0x15ca('0x2a')](_0x2f3902[_0x15ca('0x42')][_0x15ca('0x2a')]);}_0x26c1c7[_0x15ca('0x49')]=qs[_0x15ca('0x4a')](_0x2f3902[_0x15ca('0x42')]['sort']);_0x26c1c7[_0x15ca('0x4b')]=qs['filters'](_[_0x15ca('0x4c')](_0x2f3902[_0x15ca('0x42')],_0x2a93b0[_0x15ca('0x43')]),_0x363581);if(_0x2f3902[_0x15ca('0x42')][_0x15ca('0x4d')]){_0x26c1c7['where']=_[_0x15ca('0x4e')](_0x26c1c7[_0x15ca('0x4b')],{'$or':_[_0x15ca('0x3b')](_0x363581,function(_0x36580f){if(_0x36580f[_0x15ca('0x3f')]!==_0x15ca('0x4f')){var _0x53424f={};_0x53424f[_0x36580f['name']]={'$like':'%'+_0x2f3902['query'][_0x15ca('0x4d')]+'%'};return _0x53424f;}})});}_0x26c1c7=_[_0x15ca('0x4e')]({},_0x26c1c7,_0x2f3902[_0x15ca('0x50')]);var _0x17ee73={'where':_0x26c1c7[_0x15ca('0x4b')]};return db[_0x15ca('0x3c')][_0x15ca('0x2d')](_0x17ee73)[_0x15ca('0x1d')](function(_0x3ed898){_0x488b56['count']=_0x3ed898;if(_0x2f3902[_0x15ca('0x42')][_0x15ca('0x51')]){_0x26c1c7[_0x15ca('0x52')]=[{'all':!![]}];}return db['VoiceContext'][_0x15ca('0x53')](_0x26c1c7);})[_0x15ca('0x1d')](function(_0x1008af){_0x488b56['rows']=_0x1008af;return _0x488b56;})[_0x15ca('0x1d')](respondWithFilteredResult(_0x101c40,_0x26c1c7))[_0x15ca('0x27')](handleError(_0x101c40,null));};exports[_0x15ca('0x54')]=function(_0xde3b03,_0x34ff1f){var _0x22a433={'raw':![],'where':{'id':_0xde3b03['params']['id']}},_0x213ba0={};_0x213ba0[_0x15ca('0x41')]=_[_0x15ca('0x55')](db['VoiceContext'][_0x15ca('0x3d')]);_0x213ba0[_0x15ca('0x42')]=_[_0x15ca('0x55')](_0xde3b03['query']);_0x213ba0[_0x15ca('0x43')]=_[_0x15ca('0x44')](_0x213ba0['model'],_0x213ba0[_0x15ca('0x42')]);_0x22a433['attributes']=_[_0x15ca('0x44')](_0x213ba0[_0x15ca('0x41')],qs[_0x15ca('0x46')](_0xde3b03[_0x15ca('0x42')]['fields']));_0x22a433[_0x15ca('0x45')]=_0x22a433[_0x15ca('0x45')][_0x15ca('0x47')]?_0x22a433[_0x15ca('0x45')]:_0x213ba0[_0x15ca('0x41')];if(_0xde3b03['query'][_0x15ca('0x51')]){_0x22a433[_0x15ca('0x52')]=[{'all':!![]}];}_0x22a433=_[_0x15ca('0x4e')]({},_0x22a433,_0xde3b03[_0x15ca('0x50')]);return db[_0x15ca('0x3c')][_0x15ca('0x56')](_0x22a433)[_0x15ca('0x1d')](handleEntityNotFound(_0x34ff1f,null))['then'](respondWithResult(_0x34ff1f,null))[_0x15ca('0x27')](handleError(_0x34ff1f,null));};exports[_0x15ca('0x57')]=function(_0x5cb17c,_0x35b783,_0x5c0e29){var _0x48e5aa;return db[_0x15ca('0x3c')][_0x15ca('0x57')](_0x5cb17c[_0x15ca('0x58')],{'raw':!![]})[_0x15ca('0x1d')](function(_0x5a4cb5){_0x48e5aa=_0x5a4cb5;return db[_0x15ca('0x3c')][_0x15ca('0x53')]({'raw':!![]});})[_0x15ca('0x1d')](function(_0x32ceb4){var _0xa00846=fs['readFileSync'](path['join'](config['root'],_0x15ca('0x59')),'utf8');var _0x5cee75=ejs['render'](_0xa00846,{'contexts':_0x32ceb4||[]});fs[_0x15ca('0x5a')](_0x15ca('0x5b'),_0x5cee75);})['then'](function(){return respondWithRpcPromise(_0x15ca('0x5c'),_0x15ca('0x57'),{'module':_0x15ca('0x5d')});})['then'](function(){var _0x4bcbf5=_0x5cb17c[_0x15ca('0x5e')][_0x15ca('0x34')]({'plain':!![]});if(!_0x4bcbf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bcbf5[_0x15ca('0x5f')]===_0x15ca('0x5e')){var _0x7bf88b=_0x48e5aa[_0x15ca('0x34')]({'plain':!![]});return db[_0x15ca('0x60')][_0x15ca('0x56')]({'where':{'name':_0x15ca('0x35'),'userProfileId':_0x4bcbf5[_0x15ca('0x61')]},'raw':!![]})[_0x15ca('0x1d')](function(_0x1fde24){if(_0x1fde24&&_0x1fde24[_0x15ca('0x62')]===0x0){return db[_0x15ca('0x36')][_0x15ca('0x57')]({'name':_0x7bf88b[_0x15ca('0x38')],'resourceId':_0x7bf88b['id'],'type':_0x1fde24[_0x15ca('0x38')],'sectionId':_0x1fde24['id']},{})[_0x15ca('0x1d')](function(){return _0x48e5aa;});}else{return _0x48e5aa;}})['catch'](function(_0x2f1d4d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f1d4d);throw _0x2f1d4d;});}return _0x48e5aa;})[_0x15ca('0x1d')](respondWithResult(_0x35b783,0xc9))[_0x15ca('0x27')](handleError(_0x35b783,null));};exports[_0x15ca('0x32')]=function(_0xdd3f2a,_0x2289be,_0x11c64f){var _0x166d4a;return db['VoiceContext']['find']({'where':{'id':_0xdd3f2a['params']['id']}})[_0x15ca('0x1d')](handleEntityNotFound(_0x2289be,null))[_0x15ca('0x1d')](saveUpdates(_0xdd3f2a['body'],null))[_0x15ca('0x1d')](function(_0x23ec20){if(_0x23ec20){_0x166d4a=_0x23ec20;return db[_0x15ca('0x3c')][_0x15ca('0x53')]({'raw':!![]});}})['then'](function(_0x2756e5){var _0x4e1141=fs[_0x15ca('0x63')](path[_0x15ca('0x64')](config[_0x15ca('0x65')],_0x15ca('0x59')),'utf8');var _0x35893d=ejs[_0x15ca('0x66')](_0x4e1141,{'contexts':_0x2756e5||[]});fs['writeFileSync'](_0x15ca('0x5b'),_0x35893d);})[_0x15ca('0x1d')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x15ca('0x5d')});})['then'](function(){return _0x166d4a;})[_0x15ca('0x1d')](respondWithResult(_0x2289be,null))['catch'](handleError(_0x2289be,null));};exports[_0x15ca('0x33')]=function(_0x112831,_0x3612f3,_0x51d697){var _0x5cc812;return db[_0x15ca('0x3c')][_0x15ca('0x56')]({'where':{'id':_0x112831[_0x15ca('0x67')]['id']}})['then'](handleEntityNotFound(_0x3612f3,null))[_0x15ca('0x1d')](removeEntity(_0x3612f3,null))['then'](function(){return db[_0x15ca('0x3c')]['findAll']({'raw':!![]});})[_0x15ca('0x1d')](function(_0x388996){var _0x5251f6=fs['readFileSync'](path['join'](config[_0x15ca('0x65')],_0x15ca('0x59')),'utf8');var _0x439be6=ejs[_0x15ca('0x66')](_0x5251f6,{'contexts':_0x388996});fs['writeFileSync'](_0x15ca('0x5b'),_0x439be6);return respondWithRpcPromise(_0x15ca('0x5c'),_0x15ca('0x33'),{'module':_0x15ca('0x5d')});})['catch'](handleError(_0x3612f3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 48a56d1..989087d 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 _0x4c79=['./voiceContext.attributes','exports','define','VoiceContext','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x33a7fc,_0x4bc04b){var _0x329dea=function(_0x5b70f9){while(--_0x5b70f9){_0x33a7fc['push'](_0x33a7fc['shift']());}};_0x329dea(++_0x4bc04b);}(_0x4c79,0xac));var _0x94c7=function(_0x5a9c01,_0x591ac9){_0x5a9c01=_0x5a9c01-0x0;var _0x507dfd=_0x4c79[_0x5a9c01];return _0x507dfd;};'use strict';var _=require('lodash');var util=require(_0x94c7('0x0'));var logger=require(_0x94c7('0x1'))(_0x94c7('0x2'));var moment=require(_0x94c7('0x3'));var BPromise=require(_0x94c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94c7('0x5'));var rimraf=require(_0x94c7('0x6'));var config=require(_0x94c7('0x7'));var attributes=require(_0x94c7('0x8'));module[_0x94c7('0x9')]=function(_0x31669f,_0x595b1d){return _0x31669f[_0x94c7('0xa')](_0x94c7('0xb'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x938f=['api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x255388,_0x31f5a5){var _0x1c5a1e=function(_0x562d6b){while(--_0x562d6b){_0x255388['push'](_0x255388['shift']());}};_0x1c5a1e(++_0x31f5a5);}(_0x938f,0xc1));var _0xf938=function(_0x5b013d,_0xc7691c){_0x5b013d=_0x5b013d-0x0;var _0x2b6eef=_0x938f[_0x5b013d];return _0x2b6eef;};'use strict';var _=require(_0xf938('0x0'));var util=require(_0xf938('0x1'));var logger=require(_0xf938('0x2'))(_0xf938('0x3'));var moment=require(_0xf938('0x4'));var BPromise=require(_0xf938('0x5'));var rp=require(_0xf938('0x6'));var fs=require('fs');var path=require(_0xf938('0x7'));var rimraf=require(_0xf938('0x8'));var config=require('../../config/environment');var attributes=require(_0xf938('0x9'));module[_0xf938('0xa')]=function(_0x753bca,_0x2774e0){return _0x753bca[_0xf938('0xb')](_0xf938('0xc'),attributes,{'tableName':_0xf938('0xd'),'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 6c42637..63d0819 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 _0xa478=['http','then','info','request\x20sent','debug','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xa478,0x136));var _0x8a47=function(_0x451735,_0x391a76){_0x451735=_0x451735-0x0;var _0x41d1e2=_0xa478[_0x451735];return _0x41d1e2;};'use strict';var _=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var moment=require(_0x8a47('0x2'));var BPromise=require(_0x8a47('0x3'));var rs=require(_0x8a47('0x4'));var fs=require('fs');var Redis=require(_0x8a47('0x5'));var db=require(_0x8a47('0x6'))['db'];var utils=require(_0x8a47('0x7'));var logger=require(_0x8a47('0x8'))(_0x8a47('0x9'));var config=require(_0x8a47('0xa'));var jayson=require(_0x8a47('0xb'));var client=jayson['client'][_0x8a47('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d62a6,_0x3de815,_0x3cb340){return new BPromise(function(_0x56884b,_0x384886){return client['request'](_0x2d62a6,_0x3cb340)[_0x8a47('0xd')](function(_0x369fc9){logger[_0x8a47('0xe')]('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'));logger[_0x8a47('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3de815,_0x8a47('0xf'),JSON['stringify'](_0x369fc9));if(_0x369fc9[_0x8a47('0x11')]){if(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x12')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x3de815,_0x369fc9['error'][_0x8a47('0x13')]);return _0x384886(_0x369fc9[_0x8a47('0x11')]['message']);}logger[_0x8a47('0x11')](_0x8a47('0x14'),_0x3de815,_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);return _0x56884b(_0x369fc9[_0x8a47('0x11')][_0x8a47('0x13')]);}else{logger[_0x8a47('0xe')](_0x8a47('0x14'),_0x3de815,_0x8a47('0xf'));_0x56884b(_0x369fc9[_0x8a47('0x15')][_0x8a47('0x13')]);}})[_0x8a47('0x16')](function(_0x2917d9){logger['error'](_0x8a47('0x14'),_0x3de815,_0x2917d9);_0x384886(_0x2917d9);});});} \ No newline at end of file +var _0xbc23=['error','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','VoiceContext,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x3e860a,_0x1816bd){var _0x53842a=function(_0x397e6b){while(--_0x397e6b){_0x3e860a['push'](_0x3e860a['shift']());}};_0x53842a(++_0x1816bd);}(_0xbc23,0x1bd));var _0x3bc2=function(_0x33bfe0,_0x43bf33){_0x33bfe0=_0x33bfe0-0x0;var _0xaeda7=_0xbc23[_0x33bfe0];return _0xaeda7;};'use strict';var _=require(_0x3bc2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3bc2('0x1'));var rs=require(_0x3bc2('0x2'));var fs=require('fs');var Redis=require(_0x3bc2('0x3'));var db=require(_0x3bc2('0x4'))['db'];var utils=require(_0x3bc2('0x5'));var logger=require(_0x3bc2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3bc2('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5addfc,_0x12e582,_0x3d80ae){return new BPromise(function(_0x96349e,_0x115135){return client[_0x3bc2('0x8')](_0x5addfc,_0x3d80ae)[_0x3bc2('0x9')](function(_0x319b5d){logger['info'](_0x3bc2('0xa'),_0x12e582,'request\x20sent');logger[_0x3bc2('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'),JSON[_0x3bc2('0xd')](_0x319b5d));if(_0x319b5d[_0x3bc2('0xe')]){if(_0x319b5d[_0x3bc2('0xe')]['code']===0x1f4){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);return _0x115135(_0x319b5d['error'][_0x3bc2('0xf')]);}logger['error'](_0x3bc2('0xa'),_0x12e582,_0x319b5d[_0x3bc2('0xe')]['message']);return _0x96349e(_0x319b5d[_0x3bc2('0xe')][_0x3bc2('0xf')]);}else{logger[_0x3bc2('0x10')]('VoiceContext,\x20%s,\x20%s',_0x12e582,_0x3bc2('0xc'));_0x96349e(_0x319b5d['result'][_0x3bc2('0xf')]);}})['catch'](function(_0x12b3c6){logger[_0x3bc2('0xe')](_0x3bc2('0xa'),_0x12e582,_0x12b3c6);_0x115135(_0x12b3c6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 4330bc9..9680583 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 _0x7c68=['../../components/interaction/service','./voiceDialReport.controller','get','index','isAuthenticated','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x5f4161,_0x3123da){var _0x24bfd1=function(_0x27ed60){while(--_0x27ed60){_0x5f4161['push'](_0x5f4161['shift']());}};_0x24bfd1(++_0x3123da);}(_0x7c68,0x1d5));var _0x87c6=function(_0x3b4652,_0x4579f4){_0x3b4652=_0x3b4652-0x0;var _0x7e740c=_0x7c68[_0x3b4652];return _0x7e740c;};'use strict';var multer=require(_0x87c6('0x0'));var util=require(_0x87c6('0x1'));var path=require(_0x87c6('0x2'));var timeout=require(_0x87c6('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87c6('0x4'));var auth=require(_0x87c6('0x5'));var interaction=require(_0x87c6('0x6'));var config=require('../../config/environment');var controller=require(_0x87c6('0x7'));router[_0x87c6('0x8')]('/',auth['isAuthenticated'](),controller[_0x87c6('0x9')]);router['get']('/describe',auth[_0x87c6('0xa')](),controller[_0x87c6('0xb')]);router[_0x87c6('0x8')]('/:id',auth[_0x87c6('0xa')](),controller[_0x87c6('0xc')]);router[_0x87c6('0xd')]('/',auth['isAuthenticated'](),controller[_0x87c6('0xe')]);router[_0x87c6('0xf')](_0x87c6('0x10'),auth[_0x87c6('0xa')](),controller['update']);router['delete']('/:id',auth[_0x87c6('0xa')](),controller[_0x87c6('0x11')]);module[_0x87c6('0x12')]=router; \ No newline at end of file +var _0x162a=['put','delete','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','create'];(function(_0xa6723b,_0x35bd9a){var _0x96e499=function(_0x3280f0){while(--_0x3280f0){_0xa6723b['push'](_0xa6723b['shift']());}};_0x96e499(++_0x35bd9a);}(_0x162a,0x180));var _0xa162=function(_0x596ada,_0x47a857){_0x596ada=_0x596ada-0x0;var _0x59766b=_0x162a[_0x596ada];return _0x59766b;};'use strict';var multer=require(_0xa162('0x0'));var util=require(_0xa162('0x1'));var path=require(_0xa162('0x2'));var timeout=require(_0xa162('0x3'));var express=require(_0xa162('0x4'));var router=express['Router']();var fs_extra=require(_0xa162('0x5'));var auth=require(_0xa162('0x6'));var interaction=require(_0xa162('0x7'));var config=require(_0xa162('0x8'));var controller=require(_0xa162('0x9'));router[_0xa162('0xa')]('/',auth[_0xa162('0xb')](),controller[_0xa162('0xc')]);router[_0xa162('0xa')](_0xa162('0xd'),auth[_0xa162('0xb')](),controller[_0xa162('0xe')]);router[_0xa162('0xa')]('/:id',auth[_0xa162('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xa162('0xf')]);router[_0xa162('0x10')]('/:id',auth[_0xa162('0xb')](),controller['update']);router[_0xa162('0x11')](_0xa162('0x12'),auth[_0xa162('0xb')](),controller['destroy']);module[_0xa162('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 32233d8..af65b5c 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 _0xd6d6=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x4f7e37,_0x291c9f){var _0x442ea8=function(_0x169420){while(--_0x169420){_0x4f7e37['push'](_0x4f7e37['shift']());}};_0x442ea8(++_0x291c9f);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x1487a3,_0x424297){_0x1487a3=_0x1487a3-0x0;var _0x354bf2=_0xd6d6[_0x1487a3];return _0x354bf2;};'use strict';var Sequelize=require(_0x6d6d('0x0'));module[_0x6d6d('0x1')]={'privilege':{'type':Sequelize[_0x6d6d('0x2')]},'channel':{'type':Sequelize[_0x6d6d('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'calleridnum':{'type':Sequelize[_0x6d6d('0x2')]},'calleridname':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'connectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'language':{'type':Sequelize[_0x6d6d('0x2')]},'accountcode':{'type':Sequelize[_0x6d6d('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6d6d('0x2')]},'priority':{'type':Sequelize[_0x6d6d('0x3')]},'uniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'linkedid':{'type':Sequelize[_0x6d6d('0x2')]},'destchannel':{'type':Sequelize[_0x6d6d('0x2')]},'destchannelstate':{'type':Sequelize[_0x6d6d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6d6d('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6d6d('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6d6d('0x2')]},'destlanguage':{'type':Sequelize[_0x6d6d('0x2')]},'destaccountcode':{'type':Sequelize[_0x6d6d('0x2')]},'destcontext':{'type':Sequelize[_0x6d6d('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6d6d('0x3')]},'destuniqueid':{'type':Sequelize[_0x6d6d('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x6d6d('0x2')]},'starttime':{'type':Sequelize[_0x6d6d('0x4')]},'answertime':{'type':Sequelize[_0x6d6d('0x4')]},'endtime':{'type':Sequelize[_0x6d6d('0x4')]},'lastevent':{'type':Sequelize[_0x6d6d('0x2')],'comment':_0x6d6d('0x5')},'routeId':{'type':Sequelize[_0x6d6d('0x3')]},'duration':{'type':Sequelize[_0x6d6d('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x6d6d('0x3')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5db313,_0x3c8f0c){var _0x36d503=function(_0x5d1ff6){while(--_0x5d1ff6){_0x5db313['push'](_0x5db313['shift']());}};_0x36d503(++_0x3c8f0c);}(_0x9f62,0x154));var _0x29f6=function(_0x45af28,_0xa855e8){_0x45af28=_0x45af28-0x0;var _0x1ea990=_0x9f62[_0x45af28];return _0x1ea990;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index dd5869b..4a01ec1 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 _0x6090=['include','find','create','update','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','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','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys'];(function(_0x260173,_0x5c45e0){var _0x562ed4=function(_0xcac56b){while(--_0xcac56b){_0x260173['push'](_0x260173['shift']());}};_0x562ed4(++_0x5c45e0);}(_0x6090,0xa2));var _0x0609=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x6090[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x0609('0x0'));var rimraf=require(_0x0609('0x1'));var zipdir=require(_0x0609('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0609('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0609('0x4'));var util=require(_0x0609('0x5'));var path=require(_0x0609('0x6'));var sox=require(_0x0609('0x7'));var csv=require(_0x0609('0x8'));var ejs=require(_0x0609('0x9'));var fs=require('fs');var fs_extra=require(_0x0609('0xa'));var _=require(_0x0609('0xb'));var squel=require('squel');var crypto=require(_0x0609('0xc'));var jsforce=require(_0x0609('0xd'));var deskjs=require(_0x0609('0xe'));var toCsv=require(_0x0609('0x8'));var querystring=require(_0x0609('0xf'));var Papa=require(_0x0609('0x10'));var Redis=require(_0x0609('0x11'));var authService=require(_0x0609('0x12'));var qs=require(_0x0609('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0609('0x14'));var logger=require('../../config/logger')(_0x0609('0x15'));var utils=require(_0x0609('0x16'));var config=require(_0x0609('0x17'));var licenseUtil=require(_0x0609('0x18'));var db=require(_0x0609('0x19'))['db'];function respondWithStatusCode(_0x159c06,_0x335cbf){_0x335cbf=_0x335cbf||0xcc;return function(_0x569c64){if(_0x569c64){return _0x159c06[_0x0609('0x1a')](_0x335cbf);}return _0x159c06[_0x0609('0x1b')](_0x335cbf)[_0x0609('0x1c')]();};}function respondWithResult(_0x3e9b0a,_0x2ecd64){_0x2ecd64=_0x2ecd64||0xc8;return function(_0xdeb47c){if(_0xdeb47c){return _0x3e9b0a[_0x0609('0x1b')](_0x2ecd64)[_0x0609('0x1d')](_0xdeb47c);}};}function respondWithFilteredResult(_0x378969,_0x3c7a61){return function(_0x915d10){if(_0x915d10){var _0x231dec=typeof _0x3c7a61[_0x0609('0x1e')]==='undefined'&&typeof _0x3c7a61['limit']===_0x0609('0x1f');var _0x39135a=_0x915d10[_0x0609('0x20')];var _0x228d90=_0x231dec?0x0:_0x3c7a61[_0x0609('0x1e')];var _0x10e561=_0x231dec?_0x915d10[_0x0609('0x20')]:_0x3c7a61[_0x0609('0x1e')]+_0x3c7a61[_0x0609('0x21')];var _0x28a559;if(_0x10e561>=_0x39135a){_0x10e561=_0x39135a;_0x28a559=0xc8;}else{_0x28a559=0xce;}_0x378969[_0x0609('0x1b')](_0x28a559);return _0x378969[_0x0609('0x22')](_0x0609('0x23'),_0x228d90+'-'+_0x10e561+'/'+_0x39135a)['json'](_0x915d10);}return null;};}function patchUpdates(_0x181782){return function(_0x40d384){try{jsonpatch[_0x0609('0x24')](_0x40d384,_0x181782,!![]);}catch(_0x438f28){return BPromise['reject'](_0x438f28);}return _0x40d384[_0x0609('0x25')]();};}function saveUpdates(_0x18a9b4,_0x1c04d1){return function(_0x1a8dd2){if(_0x1a8dd2){return _0x1a8dd2['update'](_0x18a9b4)[_0x0609('0x26')](function(_0x4767da){return _0x4767da;});}return null;};}function removeEntity(_0x1ebc98,_0x563bdf){return function(_0x3af1fa){if(_0x3af1fa){return _0x3af1fa[_0x0609('0x27')]()['then'](function(){_0x1ebc98[_0x0609('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11307c,_0x1ae4c3){return function(_0x5c4f69){if(!_0x5c4f69){_0x11307c['sendStatus'](0x194);}return _0x5c4f69;};}function handleError(_0x3d6b7c,_0x5dc6a5){_0x5dc6a5=_0x5dc6a5||0x1f4;return function(_0x4cfc9a){logger[_0x0609('0x28')](_0x4cfc9a[_0x0609('0x29')]);if(_0x4cfc9a['name']){delete _0x4cfc9a[_0x0609('0x2a')];}_0x3d6b7c[_0x0609('0x1b')](_0x5dc6a5)[_0x0609('0x2b')](_0x4cfc9a);};}exports[_0x0609('0x2c')]=function(_0x2f5e57,_0x2b899c){var _0x20c53d={},_0x50d439={},_0x2d8015={'count':0x0,'rows':[]};var _0x12fcc4=_[_0x0609('0x2d')](db[_0x0609('0x2e')][_0x0609('0x2f')],function(_0x5f2649){return{'name':_0x5f2649[_0x0609('0x30')],'type':_0x5f2649[_0x0609('0x31')][_0x0609('0x32')]};});_0x50d439[_0x0609('0x33')]=_[_0x0609('0x2d')](_0x12fcc4,_0x0609('0x2a'));_0x50d439[_0x0609('0x34')]=_['keys'](_0x2f5e57[_0x0609('0x34')]);_0x50d439['filters']=_[_0x0609('0x35')](_0x50d439[_0x0609('0x33')],_0x50d439[_0x0609('0x34')]);_0x20c53d[_0x0609('0x36')]=_[_0x0609('0x35')](_0x50d439[_0x0609('0x33')],qs['fields'](_0x2f5e57[_0x0609('0x34')][_0x0609('0x37')]));_0x20c53d[_0x0609('0x36')]=_0x20c53d[_0x0609('0x36')][_0x0609('0x38')]?_0x20c53d[_0x0609('0x36')]:_0x50d439[_0x0609('0x33')];if(!_0x2f5e57[_0x0609('0x34')][_0x0609('0x39')](_0x0609('0x3a'))){_0x20c53d[_0x0609('0x21')]=qs[_0x0609('0x21')](_0x2f5e57[_0x0609('0x34')]['limit']);_0x20c53d[_0x0609('0x1e')]=qs['offset'](_0x2f5e57[_0x0609('0x34')][_0x0609('0x1e')]);}_0x20c53d['order']=qs[_0x0609('0x3b')](_0x2f5e57['query'][_0x0609('0x3b')]);_0x20c53d[_0x0609('0x3c')]=qs[_0x0609('0x3d')](_['pick'](_0x2f5e57['query'],_0x50d439['filters']),_0x12fcc4);if(_0x2f5e57[_0x0609('0x34')][_0x0609('0x3e')]){_0x20c53d[_0x0609('0x3c')]=_[_0x0609('0x3f')](_0x20c53d[_0x0609('0x3c')],{'$or':_[_0x0609('0x2d')](_0x12fcc4,function(_0x46437a){if(_0x46437a[_0x0609('0x31')]!==_0x0609('0x40')){var _0x176b65={};_0x176b65[_0x46437a[_0x0609('0x2a')]]={'$like':'%'+_0x2f5e57[_0x0609('0x34')][_0x0609('0x3e')]+'%'};return _0x176b65;}})});}_0x20c53d=_[_0x0609('0x3f')]({},_0x20c53d,_0x2f5e57[_0x0609('0x41')]);var _0x4fa195={'where':_0x20c53d['where']};return db[_0x0609('0x2e')]['count'](_0x4fa195)['then'](function(_0x5cc396){_0x2d8015[_0x0609('0x20')]=_0x5cc396;if(_0x2f5e57[_0x0609('0x34')][_0x0609('0x42')]){_0x20c53d['include']=[{'all':!![]}];}return db[_0x0609('0x2e')][_0x0609('0x43')](_0x20c53d);})['then'](function(_0x352b6d){_0x2d8015['rows']=_0x352b6d;return _0x2d8015;})['then'](respondWithFilteredResult(_0x2b899c,_0x20c53d))[_0x0609('0x44')](handleError(_0x2b899c,null));};exports[_0x0609('0x45')]=function(_0x18f7c2,_0x3a3695){var _0x410443={'raw':!![],'where':{'id':_0x18f7c2[_0x0609('0x46')]['id']}},_0x42ba97={};_0x42ba97[_0x0609('0x33')]=_[_0x0609('0x47')](db['VoiceDialReport'][_0x0609('0x2f')]);_0x42ba97[_0x0609('0x34')]=_['keys'](_0x18f7c2[_0x0609('0x34')]);_0x42ba97['filters']=_[_0x0609('0x35')](_0x42ba97[_0x0609('0x33')],_0x42ba97[_0x0609('0x34')]);_0x410443[_0x0609('0x36')]=_[_0x0609('0x35')](_0x42ba97[_0x0609('0x33')],qs[_0x0609('0x37')](_0x18f7c2[_0x0609('0x34')][_0x0609('0x37')]));_0x410443[_0x0609('0x36')]=_0x410443[_0x0609('0x36')][_0x0609('0x38')]?_0x410443['attributes']:_0x42ba97[_0x0609('0x33')];if(_0x18f7c2[_0x0609('0x34')][_0x0609('0x42')]){_0x410443[_0x0609('0x48')]=[{'all':!![]}];}_0x410443=_[_0x0609('0x3f')]({},_0x410443,_0x18f7c2[_0x0609('0x41')]);return db[_0x0609('0x2e')][_0x0609('0x49')](_0x410443)[_0x0609('0x26')](handleEntityNotFound(_0x3a3695,null))[_0x0609('0x26')](respondWithResult(_0x3a3695,null))[_0x0609('0x44')](handleError(_0x3a3695,null));};exports[_0x0609('0x4a')]=function(_0x4f9074,_0x36f9f4){return db[_0x0609('0x2e')]['create'](_0x4f9074['body'],{})[_0x0609('0x26')](respondWithResult(_0x36f9f4,0xc9))[_0x0609('0x44')](handleError(_0x36f9f4,null));};exports[_0x0609('0x4b')]=function(_0x2b4fb8,_0x19544e){if(_0x2b4fb8[_0x0609('0x4c')]['id']){delete _0x2b4fb8[_0x0609('0x4c')]['id'];}return db['VoiceDialReport'][_0x0609('0x49')]({'where':{'id':_0x2b4fb8[_0x0609('0x46')]['id']}})[_0x0609('0x26')](handleEntityNotFound(_0x19544e,null))[_0x0609('0x26')](saveUpdates(_0x2b4fb8[_0x0609('0x4c')],null))[_0x0609('0x26')](respondWithResult(_0x19544e,null))[_0x0609('0x44')](handleError(_0x19544e,null));};exports[_0x0609('0x27')]=function(_0x1db3cc,_0x1c686e){return db['VoiceDialReport'][_0x0609('0x49')]({'where':{'id':_0x1db3cc[_0x0609('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c686e,null))[_0x0609('0x26')](removeEntity(_0x1c686e,null))['catch'](handleError(_0x1c686e,null));};exports[_0x0609('0x4d')]=function(_0x5e81c6,_0x3da42f){return db['VoiceDialReport'][_0x0609('0x4d')]()[_0x0609('0x26')](respondWithResult(_0x3da42f,null))[_0x0609('0x44')](handleError(_0x3da42f,null));}; \ No newline at end of file +var _0xe3a4=['Content-Range','save','update','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3a4,0x152));var _0x4e3a=function(_0x1bc3e4,_0x45ef65){_0x1bc3e4=_0x1bc3e4-0x0;var _0xd71db9=_0xe3a4[_0x1bc3e4];return _0xd71db9;};'use strict';var emlformat=require(_0x4e3a('0x0'));var rimraf=require(_0x4e3a('0x1'));var zipdir=require(_0x4e3a('0x2'));var jsonpatch=require(_0x4e3a('0x3'));var rp=require(_0x4e3a('0x4'));var moment=require(_0x4e3a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4e3a('0x6'));var util=require(_0x4e3a('0x7'));var path=require(_0x4e3a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e3a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4e3a('0xa'));var squel=require(_0x4e3a('0xb'));var crypto=require(_0x4e3a('0xc'));var jsforce=require(_0x4e3a('0xd'));var deskjs=require(_0x4e3a('0xe'));var toCsv=require(_0x4e3a('0xf'));var querystring=require(_0x4e3a('0x10'));var Papa=require(_0x4e3a('0x11'));var Redis=require(_0x4e3a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4e3a('0x13'));var as=require(_0x4e3a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4e3a('0x15'));var licenseUtil=require(_0x4e3a('0x16'));var db=require(_0x4e3a('0x17'))['db'];function respondWithStatusCode(_0x586388,_0x44b0f8){_0x44b0f8=_0x44b0f8||0xcc;return function(_0x484494){if(_0x484494){return _0x586388[_0x4e3a('0x18')](_0x44b0f8);}return _0x586388[_0x4e3a('0x19')](_0x44b0f8)[_0x4e3a('0x1a')]();};}function respondWithResult(_0x100d8f,_0x274bd9){_0x274bd9=_0x274bd9||0xc8;return function(_0x5c2749){if(_0x5c2749){return _0x100d8f['status'](_0x274bd9)[_0x4e3a('0x1b')](_0x5c2749);}};}function respondWithFilteredResult(_0x195d47,_0x56e63d){return function(_0x92231b){if(_0x92231b){var _0x23f2fc=typeof _0x56e63d['offset']==='undefined'&&typeof _0x56e63d['limit']===_0x4e3a('0x1c');var _0x9b01f2=_0x92231b[_0x4e3a('0x1d')];var _0x50308d=_0x23f2fc?0x0:_0x56e63d[_0x4e3a('0x1e')];var _0x32f95f=_0x23f2fc?_0x92231b['count']:_0x56e63d[_0x4e3a('0x1e')]+_0x56e63d[_0x4e3a('0x1f')];var _0x2b5aed;if(_0x32f95f>=_0x9b01f2){_0x32f95f=_0x9b01f2;_0x2b5aed=0xc8;}else{_0x2b5aed=0xce;}_0x195d47['status'](_0x2b5aed);return _0x195d47['set'](_0x4e3a('0x20'),_0x50308d+'-'+_0x32f95f+'/'+_0x9b01f2)[_0x4e3a('0x1b')](_0x92231b);}return null;};}function patchUpdates(_0x37e418){return function(_0x1ddd0f){try{jsonpatch['apply'](_0x1ddd0f,_0x37e418,!![]);}catch(_0x4abc4c){return BPromise['reject'](_0x4abc4c);}return _0x1ddd0f[_0x4e3a('0x21')]();};}function saveUpdates(_0x5a5e66,_0x995e67){return function(_0x5d9dae){if(_0x5d9dae){return _0x5d9dae[_0x4e3a('0x22')](_0x5a5e66)['then'](function(_0x4e924d){return _0x4e924d;});}return null;};}function removeEntity(_0x20ef17,_0x4d0c08){return function(_0x3dbc79){if(_0x3dbc79){return _0x3dbc79['destroy']()[_0x4e3a('0x23')](function(){_0x20ef17[_0x4e3a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc2148,_0x552187){return function(_0x140e4a){if(!_0x140e4a){_0xfc2148['sendStatus'](0x194);}return _0x140e4a;};}function handleError(_0x36c490,_0x1df0e9){_0x1df0e9=_0x1df0e9||0x1f4;return function(_0x3d65e9){logger[_0x4e3a('0x24')](_0x3d65e9[_0x4e3a('0x25')]);if(_0x3d65e9[_0x4e3a('0x26')]){delete _0x3d65e9[_0x4e3a('0x26')];}_0x36c490[_0x4e3a('0x19')](_0x1df0e9)['send'](_0x3d65e9);};}exports[_0x4e3a('0x27')]=function(_0x3e307c,_0x14ef03){var _0x5c3255={},_0x529f73={},_0x78221d={'count':0x0,'rows':[]};var _0x534f38=_[_0x4e3a('0x28')](db[_0x4e3a('0x29')][_0x4e3a('0x2a')],function(_0x5159cd){return{'name':_0x5159cd[_0x4e3a('0x2b')],'type':_0x5159cd[_0x4e3a('0x2c')]['key']};});_0x529f73[_0x4e3a('0x2d')]=_[_0x4e3a('0x28')](_0x534f38,'name');_0x529f73['query']=_['keys'](_0x3e307c[_0x4e3a('0x2e')]);_0x529f73['filters']=_['intersection'](_0x529f73[_0x4e3a('0x2d')],_0x529f73[_0x4e3a('0x2e')]);_0x5c3255[_0x4e3a('0x2f')]=_[_0x4e3a('0x30')](_0x529f73['model'],qs[_0x4e3a('0x31')](_0x3e307c['query']['fields']));_0x5c3255[_0x4e3a('0x2f')]=_0x5c3255['attributes'][_0x4e3a('0x32')]?_0x5c3255[_0x4e3a('0x2f')]:_0x529f73[_0x4e3a('0x2d')];if(!_0x3e307c['query'][_0x4e3a('0x33')](_0x4e3a('0x34'))){_0x5c3255[_0x4e3a('0x1f')]=qs[_0x4e3a('0x1f')](_0x3e307c[_0x4e3a('0x2e')][_0x4e3a('0x1f')]);_0x5c3255[_0x4e3a('0x1e')]=qs[_0x4e3a('0x1e')](_0x3e307c[_0x4e3a('0x2e')][_0x4e3a('0x1e')]);}_0x5c3255[_0x4e3a('0x35')]=qs['sort'](_0x3e307c[_0x4e3a('0x2e')][_0x4e3a('0x36')]);_0x5c3255['where']=qs[_0x4e3a('0x37')](_[_0x4e3a('0x38')](_0x3e307c[_0x4e3a('0x2e')],_0x529f73['filters']),_0x534f38);if(_0x3e307c['query'][_0x4e3a('0x39')]){_0x5c3255[_0x4e3a('0x3a')]=_[_0x4e3a('0x3b')](_0x5c3255['where'],{'$or':_[_0x4e3a('0x28')](_0x534f38,function(_0x5f1e0c){if(_0x5f1e0c['type']!==_0x4e3a('0x3c')){var _0x2fe984={};_0x2fe984[_0x5f1e0c[_0x4e3a('0x26')]]={'$like':'%'+_0x3e307c['query']['filter']+'%'};return _0x2fe984;}})});}_0x5c3255=_[_0x4e3a('0x3b')]({},_0x5c3255,_0x3e307c['options']);var _0x345822={'where':_0x5c3255[_0x4e3a('0x3a')]};return db['VoiceDialReport'][_0x4e3a('0x1d')](_0x345822)[_0x4e3a('0x23')](function(_0x50ae26){_0x78221d[_0x4e3a('0x1d')]=_0x50ae26;if(_0x3e307c['query'][_0x4e3a('0x3d')]){_0x5c3255[_0x4e3a('0x3e')]=[{'all':!![]}];}return db[_0x4e3a('0x29')][_0x4e3a('0x3f')](_0x5c3255);})['then'](function(_0x37b98c){_0x78221d[_0x4e3a('0x40')]=_0x37b98c;return _0x78221d;})['then'](respondWithFilteredResult(_0x14ef03,_0x5c3255))[_0x4e3a('0x41')](handleError(_0x14ef03,null));};exports[_0x4e3a('0x42')]=function(_0x11b1f2,_0x962102){var _0xee59a3={'raw':!![],'where':{'id':_0x11b1f2[_0x4e3a('0x43')]['id']}},_0x14c0e5={};_0x14c0e5['model']=_[_0x4e3a('0x44')](db[_0x4e3a('0x29')][_0x4e3a('0x2a')]);_0x14c0e5[_0x4e3a('0x2e')]=_[_0x4e3a('0x44')](_0x11b1f2[_0x4e3a('0x2e')]);_0x14c0e5[_0x4e3a('0x37')]=_['intersection'](_0x14c0e5[_0x4e3a('0x2d')],_0x14c0e5[_0x4e3a('0x2e')]);_0xee59a3[_0x4e3a('0x2f')]=_[_0x4e3a('0x30')](_0x14c0e5[_0x4e3a('0x2d')],qs[_0x4e3a('0x31')](_0x11b1f2[_0x4e3a('0x2e')][_0x4e3a('0x31')]));_0xee59a3['attributes']=_0xee59a3[_0x4e3a('0x2f')]['length']?_0xee59a3[_0x4e3a('0x2f')]:_0x14c0e5[_0x4e3a('0x2d')];if(_0x11b1f2['query'][_0x4e3a('0x3d')]){_0xee59a3[_0x4e3a('0x3e')]=[{'all':!![]}];}_0xee59a3=_[_0x4e3a('0x3b')]({},_0xee59a3,_0x11b1f2[_0x4e3a('0x45')]);return db['VoiceDialReport'][_0x4e3a('0x46')](_0xee59a3)['then'](handleEntityNotFound(_0x962102,null))[_0x4e3a('0x23')](respondWithResult(_0x962102,null))[_0x4e3a('0x41')](handleError(_0x962102,null));};exports['create']=function(_0x441a5f,_0x534381){return db['VoiceDialReport']['create'](_0x441a5f[_0x4e3a('0x47')],{})['then'](respondWithResult(_0x534381,0xc9))[_0x4e3a('0x41')](handleError(_0x534381,null));};exports[_0x4e3a('0x22')]=function(_0x215f9d,_0x41efeb){if(_0x215f9d[_0x4e3a('0x47')]['id']){delete _0x215f9d[_0x4e3a('0x47')]['id'];}return db[_0x4e3a('0x29')][_0x4e3a('0x46')]({'where':{'id':_0x215f9d[_0x4e3a('0x43')]['id']}})[_0x4e3a('0x23')](handleEntityNotFound(_0x41efeb,null))['then'](saveUpdates(_0x215f9d[_0x4e3a('0x47')],null))[_0x4e3a('0x23')](respondWithResult(_0x41efeb,null))[_0x4e3a('0x41')](handleError(_0x41efeb,null));};exports[_0x4e3a('0x48')]=function(_0x5bfbfc,_0x24d13a){return db['VoiceDialReport']['find']({'where':{'id':_0x5bfbfc[_0x4e3a('0x43')]['id']}})[_0x4e3a('0x23')](handleEntityNotFound(_0x24d13a,null))['then'](removeEntity(_0x24d13a,null))[_0x4e3a('0x41')](handleError(_0x24d13a,null));};exports['describe']=function(_0x3ab83d,_0x531488){return db[_0x4e3a('0x29')][_0x4e3a('0x49')]()[_0x4e3a('0x23')](respondWithResult(_0x531488,null))[_0x4e3a('0x41')](handleError(_0x531488,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 7da59df..5944a51 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 _0x4d33=['report_dial','lodash','util','api','moment','bluebird','request-promise','path','./voiceDialReport.attributes','exports','VoiceDialReport'];(function(_0x497592,_0x44d7f5){var _0x4e8fd5=function(_0x298551){while(--_0x298551){_0x497592['push'](_0x497592['shift']());}};_0x4e8fd5(++_0x44d7f5);}(_0x4d33,0x140));var _0x34d3=function(_0x553a87,_0x1d621f){_0x553a87=_0x553a87-0x0;var _0x12d1e6=_0x4d33[_0x553a87];return _0x12d1e6;};'use strict';var _=require(_0x34d3('0x0'));var util=require(_0x34d3('0x1'));var logger=require('../../config/logger')(_0x34d3('0x2'));var moment=require(_0x34d3('0x3'));var BPromise=require(_0x34d3('0x4'));var rp=require(_0x34d3('0x5'));var fs=require('fs');var path=require(_0x34d3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34d3('0x7'));module[_0x34d3('0x8')]=function(_0x33873b,_0x41234e){return _0x33873b['define'](_0x34d3('0x9'),attributes,{'tableName':_0x34d3('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2cca=['../../config/environment','./voiceDialReport.attributes','exports','uniqueid','lodash','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x4114dd,_0x2ad862){var _0x26f44c=function(_0xad2246){while(--_0xad2246){_0x4114dd['push'](_0x4114dd['shift']());}};_0x26f44c(++_0x2ad862);}(_0x2cca,0xa4));var _0xa2cc=function(_0x37610f,_0x2d28a2){_0x37610f=_0x37610f-0x0;var _0xea39b=_0x2cca[_0x37610f];return _0xea39b;};'use strict';var _=require(_0xa2cc('0x0'));var util=require('util');var logger=require(_0xa2cc('0x1'))(_0xa2cc('0x2'));var moment=require(_0xa2cc('0x3'));var BPromise=require(_0xa2cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa2cc('0x5'));var config=require(_0xa2cc('0x6'));var attributes=require(_0xa2cc('0x7'));module[_0xa2cc('0x8')]=function(_0xcaf068,_0xcd8c32){return _0xcaf068['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xa2cc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index d40ceb0..59af392 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 _0x22c0=['raw','UpdateVoiceDialReport','update','options','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','body'];(function(_0x29cb61,_0x494484){var _0x21d3e0=function(_0x3e0ac4){while(--_0x3e0ac4){_0x29cb61['push'](_0x29cb61['shift']());}};_0x21d3e0(++_0x494484);}(_0x22c0,0x172));var _0x022c=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x22c0[_0x47a349];return _0x18ab75;};'use strict';var _=require(_0x022c('0x0'));var util=require(_0x022c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x022c('0x2'));var fs=require('fs');var Redis=require(_0x022c('0x3'));var db=require(_0x022c('0x4'))['db'];var utils=require(_0x022c('0x5'));var logger=require(_0x022c('0x6'))(_0x022c('0x7'));var config=require(_0x022c('0x8'));var jayson=require(_0x022c('0x9'));var client=jayson[_0x022c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2dfa72,_0x3099ba,_0x2d4bac){return new BPromise(function(_0x3c588c,_0x3e0b0a){return client[_0x022c('0xb')](_0x2dfa72,_0x2d4bac)[_0x022c('0xc')](function(_0xf42197){logger[_0x022c('0xd')](_0x022c('0xe'),_0x3099ba,_0x022c('0xf'));logger[_0x022c('0x10')](_0x022c('0x11'),_0x3099ba,_0x022c('0xf'),JSON[_0x022c('0x12')](_0xf42197));if(_0xf42197[_0x022c('0x13')]){if(_0xf42197[_0x022c('0x13')][_0x022c('0x14')]===0x1f4){logger[_0x022c('0x13')](_0x022c('0xe'),_0x3099ba,_0xf42197['error'][_0x022c('0x15')]);return _0x3e0b0a(_0xf42197[_0x022c('0x13')][_0x022c('0x15')]);}logger[_0x022c('0x13')](_0x022c('0xe'),_0x3099ba,_0xf42197['error'][_0x022c('0x15')]);return _0x3c588c(_0xf42197[_0x022c('0x13')][_0x022c('0x15')]);}else{logger[_0x022c('0xd')](_0x022c('0xe'),_0x3099ba,_0x022c('0xf'));_0x3c588c(_0xf42197['result']['message']);}})[_0x022c('0x16')](function(_0x1d67cb){logger[_0x022c('0x13')](_0x022c('0xe'),_0x3099ba,_0x1d67cb);_0x3e0b0a(_0x1d67cb);});});}exports[_0x022c('0x17')]=function(_0x104990){var _0x4d73e1=this;return new Promise(function(_0x1329db,_0x4e22ae){return db[_0x022c('0x18')]['create'](_0x104990[_0x022c('0x19')],{'raw':_0x104990['options']?_0x104990['options'][_0x022c('0x1a')]===undefined?!![]:![]:!![]})[_0x022c('0xc')](function(_0x48e751){logger[_0x022c('0xd')](_0x022c('0x17'),_0x104990);logger[_0x022c('0x10')](_0x022c('0x17'),_0x104990,JSON[_0x022c('0x12')](_0x48e751));_0x1329db(_0x48e751);})[_0x022c('0x16')](function(_0x4c02c2){logger[_0x022c('0x13')](_0x022c('0x17'),_0x4c02c2[_0x022c('0x15')],_0x104990);_0x4e22ae(_0x4d73e1[_0x022c('0x13')](0x1f4,_0x4c02c2['message']));});});};exports[_0x022c('0x1b')]=function(_0x32ec5c){var _0x3053bf=this;return new Promise(function(_0x52863c,_0x58d652){return db['VoiceDialReport'][_0x022c('0x1c')](_0x32ec5c['body'],{'raw':_0x32ec5c[_0x022c('0x1d')]?_0x32ec5c['options'][_0x022c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32ec5c[_0x022c('0x1d')]?_0x32ec5c[_0x022c('0x1d')][_0x022c('0x1e')]||null:null,'attributes':_0x32ec5c[_0x022c('0x1d')]?_0x32ec5c[_0x022c('0x1d')][_0x022c('0x1f')]||null:null,'limit':_0x32ec5c[_0x022c('0x1d')]?_0x32ec5c[_0x022c('0x1d')][_0x022c('0x20')]||null:null})[_0x022c('0xc')](function(_0x5aefee){logger['info'](_0x022c('0x1b'),_0x32ec5c);logger[_0x022c('0x10')](_0x022c('0x1b'),_0x32ec5c,JSON[_0x022c('0x12')](_0x5aefee));_0x52863c(_0x5aefee);})[_0x022c('0x16')](function(_0x296218){logger[_0x022c('0x13')](_0x022c('0x1b'),_0x296218[_0x022c('0x15')],_0x32ec5c);_0x58d652(_0x3053bf[_0x022c('0x13')](0x1f4,_0x296218['message']));});});}; \ No newline at end of file +var _0x5302=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','update','where','attributes','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','request','VoiceDialReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x5ed41b,_0x5022b1){var _0x27e536=function(_0x52e05b){while(--_0x52e05b){_0x5ed41b['push'](_0x5ed41b['shift']());}};_0x27e536(++_0x5022b1);}(_0x5302,0xa9));var _0x2530=function(_0x30a36d,_0x92a66b){_0x30a36d=_0x30a36d-0x0;var _0x2f38cc=_0x5302[_0x30a36d];return _0x2f38cc;};'use strict';var _=require(_0x2530('0x0'));var util=require('util');var moment=require(_0x2530('0x1'));var BPromise=require(_0x2530('0x2'));var rs=require(_0x2530('0x3'));var fs=require('fs');var Redis=require(_0x2530('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2530('0x5'));var logger=require(_0x2530('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2530('0x7')][_0x2530('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a52c6,_0x15e0a1,_0x32542f){return new BPromise(function(_0x34a4fa,_0xcbba9b){return client[_0x2530('0x9')](_0x3a52c6,_0x32542f)['then'](function(_0x283cfd){logger['info'](_0x2530('0xa'),_0x15e0a1,_0x2530('0xb'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x15e0a1,_0x2530('0xb'),JSON[_0x2530('0xc')](_0x283cfd));if(_0x283cfd[_0x2530('0xd')]){if(_0x283cfd[_0x2530('0xd')]['code']===0x1f4){logger[_0x2530('0xd')](_0x2530('0xa'),_0x15e0a1,_0x283cfd['error'][_0x2530('0xe')]);return _0xcbba9b(_0x283cfd[_0x2530('0xd')][_0x2530('0xe')]);}logger[_0x2530('0xd')](_0x2530('0xa'),_0x15e0a1,_0x283cfd['error'][_0x2530('0xe')]);return _0x34a4fa(_0x283cfd[_0x2530('0xd')][_0x2530('0xe')]);}else{logger[_0x2530('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x15e0a1,_0x2530('0xb'));_0x34a4fa(_0x283cfd[_0x2530('0x10')]['message']);}})[_0x2530('0x11')](function(_0x4c9abe){logger[_0x2530('0xd')](_0x2530('0xa'),_0x15e0a1,_0x4c9abe);_0xcbba9b(_0x4c9abe);});});}exports[_0x2530('0x12')]=function(_0x1f52c7){var _0x368887=this;return new Promise(function(_0x354e3f,_0x194eec){return db[_0x2530('0x13')][_0x2530('0x14')](_0x1f52c7[_0x2530('0x15')],{'raw':_0x1f52c7[_0x2530('0x16')]?_0x1f52c7[_0x2530('0x16')][_0x2530('0x17')]===undefined?!![]:![]:!![]})[_0x2530('0x18')](function(_0x1167c9){logger[_0x2530('0xf')](_0x2530('0x12'),_0x1f52c7);logger['debug']('CreateVoiceDialReport',_0x1f52c7,JSON['stringify'](_0x1167c9));_0x354e3f(_0x1167c9);})[_0x2530('0x11')](function(_0x202e4e){logger[_0x2530('0xd')](_0x2530('0x12'),_0x202e4e[_0x2530('0xe')],_0x1f52c7);_0x194eec(_0x368887['error'](0x1f4,_0x202e4e[_0x2530('0xe')]));});});};exports[_0x2530('0x19')]=function(_0x9be58a){var _0x37560b=this;return new Promise(function(_0x4fe908,_0x3f8a52){return db[_0x2530('0x13')][_0x2530('0x1a')](_0x9be58a[_0x2530('0x15')],{'raw':_0x9be58a['options']?_0x9be58a[_0x2530('0x16')][_0x2530('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9be58a[_0x2530('0x16')]?_0x9be58a['options'][_0x2530('0x1b')]||null:null,'attributes':_0x9be58a[_0x2530('0x16')]?_0x9be58a[_0x2530('0x16')][_0x2530('0x1c')]||null:null,'limit':_0x9be58a['options']?_0x9be58a['options'][_0x2530('0x1d')]||null:null})[_0x2530('0x18')](function(_0x549102){logger[_0x2530('0xf')](_0x2530('0x19'),_0x9be58a);logger[_0x2530('0x1e')](_0x2530('0x19'),_0x9be58a,JSON['stringify'](_0x549102));_0x4fe908(_0x549102);})['catch'](function(_0x28cb96){logger['error'](_0x2530('0x19'),_0x28cb96[_0x2530('0xe')],_0x9be58a);_0x3f8a52(_0x37560b[_0x2530('0xd')](0x1f4,_0x28cb96[_0x2530('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 3a05cbb..6bfffdd 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 _0xab27=['/:id/applications','addApplications','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xab27,0x146));var _0x7ab2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xab27[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x7ab2('0x0'));var path=require(_0x7ab2('0x1'));var timeout=require('connect-timeout');var express=require(_0x7ab2('0x2'));var router=express[_0x7ab2('0x3')]();var fs_extra=require(_0x7ab2('0x4'));var auth=require(_0x7ab2('0x5'));var interaction=require(_0x7ab2('0x6'));var config=require(_0x7ab2('0x7'));var controller=require('./voiceExtension.controller');router[_0x7ab2('0x8')]('/',auth[_0x7ab2('0x9')](),controller['index']);router[_0x7ab2('0x8')](_0x7ab2('0xa'),auth[_0x7ab2('0x9')](),controller[_0x7ab2('0xb')]);router[_0x7ab2('0xc')]('/',auth[_0x7ab2('0x9')](),controller[_0x7ab2('0xd')]);router[_0x7ab2('0xc')](_0x7ab2('0xe'),auth['isAuthenticated'](),controller[_0x7ab2('0xf')]);router[_0x7ab2('0x10')](_0x7ab2('0xa'),auth[_0x7ab2('0x9')](),controller[_0x7ab2('0x11')]);router[_0x7ab2('0x12')](_0x7ab2('0xa'),auth[_0x7ab2('0x9')](),controller['destroy']);module[_0x7ab2('0x13')]=router; \ No newline at end of file +var _0x9a5b=['/:id','post','create','/:id/applications','addApplications','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated'];(function(_0x3a65f6,_0x58863a){var _0x111bf6=function(_0x514a8c){while(--_0x514a8c){_0x3a65f6['push'](_0x3a65f6['shift']());}};_0x111bf6(++_0x58863a);}(_0x9a5b,0x1d7));var _0xb9a5=function(_0x226d85,_0x1ac45d){_0x226d85=_0x226d85-0x0;var _0x36bc5a=_0x9a5b[_0x226d85];return _0x36bc5a;};'use strict';var multer=require(_0xb9a5('0x0'));var util=require(_0xb9a5('0x1'));var path=require(_0xb9a5('0x2'));var timeout=require(_0xb9a5('0x3'));var express=require(_0xb9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xb9a5('0x5'));var auth=require(_0xb9a5('0x6'));var interaction=require(_0xb9a5('0x7'));var config=require(_0xb9a5('0x8'));var controller=require(_0xb9a5('0x9'));router[_0xb9a5('0xa')]('/',auth[_0xb9a5('0xb')](),controller['index']);router[_0xb9a5('0xa')](_0xb9a5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb9a5('0xd')]('/',auth[_0xb9a5('0xb')](),controller[_0xb9a5('0xe')]);router[_0xb9a5('0xd')](_0xb9a5('0xf'),auth[_0xb9a5('0xb')](),controller[_0xb9a5('0x10')]);router[_0xb9a5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb9a5('0x12')]);router[_0xb9a5('0x13')](_0xb9a5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xb9a5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index aa850a1..ff498e0 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 _0xb09d=['BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x2b843d,_0x4acd9f){var _0x1c6bc7=function(_0x20d4e0){while(--_0x20d4e0){_0x2b843d['push'](_0x2b843d['shift']());}};_0x1c6bc7(++_0x4acd9f);}(_0xb09d,0xaf));var _0xdb09=function(_0x5e49df,_0x17bc8e){_0x5e49df=_0x5e49df-0x0;var _0x5e0567=_0xb09d[_0x5e49df];return _0x5e0567;};'use strict';var Sequelize=require(_0xdb09('0x0'));module[_0xdb09('0x1')]={'context':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'unique':_0xdb09('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xdb09('0x3')},'tag':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'defaultValue':_0xdb09('0x4')},'appdata':{'type':Sequelize[_0xdb09('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xdb09('0x5')](_0xdb09('0x6'),_0xdb09('0x7'),_0xdb09('0x8'),_0xdb09('0x9'),_0xdb09('0xa'),_0xdb09('0xb'),_0xdb09('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xdb09('0x2')]},'interval':{'type':Sequelize[_0xdb09('0x2')],'allowNull':![],'defaultValue':_0xdb09('0xd')},'IntervalId':{'type':Sequelize[_0xdb09('0xe')]},'isApp':{'type':Sequelize[_0xdb09('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xdb09('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xdb09('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xdb09('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xdb09('0xe')]},'recordingFormat':{'type':Sequelize[_0xdb09('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xdb09('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xdb09('0x10')],'get':function(_0x5c2ce8){return this[_0xdb09('0x11')](_0xdb09('0x12'));}},'alias':{'type':Sequelize[_0xdb09('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xcf75=['BOOLEAN','wav','VIRTUAL','getDataValue','exten','exports','compositeIndex','STRING','NoOp','ENUM','inbound','outbound','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x1b2239,_0x1b857f){var _0x4c16a6=function(_0x464a23){while(--_0x464a23){_0x1b2239['push'](_0x1b2239['shift']());}};_0x4c16a6(++_0x1b857f);}(_0xcf75,0x16a));var _0x5cf7=function(_0x24aadb,_0x42bb02){_0x24aadb=_0x24aadb-0x0;var _0x3f4c11=_0xcf75[_0x24aadb];return _0x3f4c11;};'use strict';var Sequelize=require('sequelize');module[_0x5cf7('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5cf7('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x5cf7('0x2')],'allowNull':![],'unique':_0x5cf7('0x1')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x5cf7('0x1')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5cf7('0x2')],'allowNull':![],'defaultValue':_0x5cf7('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5cf7('0x4')](_0x5cf7('0x5'),_0x5cf7('0x6'),'internal','inbound-fax',_0x5cf7('0x7'),_0x5cf7('0x8'),_0x5cf7('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x5cf7('0x2')],'allowNull':![],'defaultValue':_0x5cf7('0xa')},'IntervalId':{'type':Sequelize[_0x5cf7('0xb')]},'isApp':{'type':Sequelize[_0x5cf7('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x5cf7('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5cf7('0xb')]},'recordingFormat':{'type':Sequelize[_0x5cf7('0x2')],'defaultValue':_0x5cf7('0xd')},'answer':{'type':Sequelize[_0x5cf7('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5cf7('0xe')],'get':function(_0x1d9460){return this[_0x5cf7('0xf')](_0x5cf7('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index eefbdef..47d5a14 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 _0x5cc6=['limit','set','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','index','VoiceExtension','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','body','outbound','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','pick','description','recordingFormat','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','error','send','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count'];(function(_0x1261c2,_0x3ef819){var _0x3aabd2=function(_0x425d76){while(--_0x425d76){_0x1261c2['push'](_0x1261c2['shift']());}};_0x3aabd2(++_0x3ef819);}(_0x5cc6,0x1b8));var _0x65cc=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x5cc6[_0x2a55f8];return _0x245efd;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0x65cc('0x0'));var logger=require(_0x65cc('0x1'))(_0x65cc('0x2'));var config=require('../../config/environment');var db=require(_0x65cc('0x3'))['db'];config[_0x65cc('0x4')]=_[_0x65cc('0x5')](config['redis'],{'host':_0x65cc('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65cc('0x4')]));require(_0x65cc('0x7'))[_0x65cc('0x8')](socket);function respondWithStatusCode(_0x4a599d,_0x3e06f4){_0x3e06f4=_0x3e06f4||0xcc;return function(_0x4631c8){if(_0x4631c8){return _0x4a599d[_0x65cc('0x9')](_0x3e06f4);}return _0x4a599d[_0x65cc('0xa')](_0x3e06f4)[_0x65cc('0xb')]();};}function respondWithResult(_0xe6c304,_0x2f6812){_0x2f6812=_0x2f6812||0xc8;return function(_0x5a6b3c){if(_0x5a6b3c){return _0xe6c304['status'](_0x2f6812)['json'](_0x5a6b3c);}};}function respondWithFilteredResult(_0x49707f,_0x7aa3db){return function(_0x100a49){if(_0x100a49){var _0x2fb80c=typeof _0x7aa3db[_0x65cc('0xc')]==='undefined'&&typeof _0x7aa3db['limit']===_0x65cc('0xd');var _0x55515f=_0x100a49[_0x65cc('0xe')];var _0x53ec0c=_0x2fb80c?0x0:_0x7aa3db['offset'];var _0x50cf54=_0x2fb80c?_0x100a49[_0x65cc('0xe')]:_0x7aa3db['offset']+_0x7aa3db[_0x65cc('0xf')];var _0x3225dd;if(_0x50cf54>=_0x55515f){_0x50cf54=_0x55515f;_0x3225dd=0xc8;}else{_0x3225dd=0xce;}_0x49707f[_0x65cc('0xa')](_0x3225dd);return _0x49707f[_0x65cc('0x10')]('Content-Range',_0x53ec0c+'-'+_0x50cf54+'/'+_0x55515f)[_0x65cc('0x11')](_0x100a49);}return null;};}function removeEntity(_0x3521b9){return function(_0x1dabe5){if(_0x1dabe5){return _0x1dabe5[_0x65cc('0x12')]()[_0x65cc('0x13')](function(){var _0x6085c0=_0x1dabe5[_0x65cc('0x14')]({'plain':!![]});var _0x3299b7=[{'name':_0x65cc('0x15'),'value':_0x65cc('0x16'),'ignore':![]},{'name':_0x65cc('0x17'),'value':'outbound','ignore':![]},{'name':_0x65cc('0x18'),'value':_0x65cc('0x19'),'ignore':![]}];var _0x331c38=_(_0x3299b7)[_0x65cc('0x1a')](_0x65cc('0x1b'))[_0x65cc('0x1c')](_0x65cc('0x1d'))[_0x65cc('0x1d')]();if(_[_0x65cc('0x1e')](_0x331c38,_0x6085c0[_0x65cc('0x1f')])){return;}var _0x35c029=_[_0x65cc('0x20')](_0x3299b7,['value',_0x6085c0['type']])[_0x65cc('0x21')];return db[_0x65cc('0x22')]['destroy']({'where':{'type':_0x35c029,'resourceId':_0x6085c0['id']}})['then'](function(){return _0x1dabe5;});})[_0x65cc('0x13')](function(){_0x3521b9[_0x65cc('0xa')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25a865){return function(_0x183025){if(!_0x183025){_0x25a865[_0x65cc('0x9')](0x194);}return _0x183025;};}function handleError(_0x231247,_0x54c790){_0x54c790=_0x54c790||0x1f4;return function(_0xdf4382){logger['error'](_0xdf4382[_0x65cc('0x23')]);if(_0xdf4382[_0x65cc('0x21')]){delete _0xdf4382['name'];}_0x231247[_0x65cc('0xa')](_0x54c790)['send'](_0xdf4382);};}exports[_0x65cc('0x24')]=function(_0x1c83dd,_0x4624e0){var _0x1f97f0={},_0x5a1720={},_0x7952f2={'count':0x0,'rows':[]};var _0x7bce16=_[_0x65cc('0x1c')](db[_0x65cc('0x25')][_0x65cc('0x26')],function(_0x124a08){return{'name':_0x124a08['fieldName'],'type':_0x124a08['type']['key']};});_0x5a1720[_0x65cc('0x27')]=_['map'](_0x7bce16,_0x65cc('0x21'));_0x5a1720[_0x65cc('0x28')]=_[_0x65cc('0x29')](_0x1c83dd[_0x65cc('0x28')]);_0x5a1720[_0x65cc('0x2a')]=_[_0x65cc('0x2b')](_0x5a1720[_0x65cc('0x27')],_0x5a1720[_0x65cc('0x28')]);_0x1f97f0[_0x65cc('0x2c')]=_[_0x65cc('0x2b')](_0x5a1720[_0x65cc('0x27')],qs['fields'](_0x1c83dd[_0x65cc('0x28')][_0x65cc('0x2d')]));_0x1f97f0[_0x65cc('0x2c')]=_0x1f97f0[_0x65cc('0x2c')][_0x65cc('0x2e')]?_0x1f97f0[_0x65cc('0x2c')]:_0x5a1720['model'];if(!_0x1c83dd['query'][_0x65cc('0x2f')]('nolimit')){_0x1f97f0[_0x65cc('0xf')]=qs[_0x65cc('0xf')](_0x1c83dd['query'][_0x65cc('0xf')]);_0x1f97f0[_0x65cc('0xc')]=qs[_0x65cc('0xc')](_0x1c83dd[_0x65cc('0x28')]['offset']);}_0x1f97f0[_0x65cc('0x30')]=qs[_0x65cc('0x31')](_0x1c83dd[_0x65cc('0x28')][_0x65cc('0x31')]);_0x1f97f0[_0x65cc('0x32')]=qs[_0x65cc('0x2a')](_['pick'](_0x1c83dd[_0x65cc('0x28')],_0x5a1720[_0x65cc('0x2a')]),_0x7bce16);if(_0x1c83dd['query'][_0x65cc('0x1a')]){_0x1f97f0[_0x65cc('0x32')]=_[_0x65cc('0x33')](_0x1f97f0[_0x65cc('0x32')],{'$or':_[_0x65cc('0x1c')](_0x7bce16,function(_0x2d6eba){if(_0x2d6eba['type']!==_0x65cc('0x34')){var _0x2c1b65={};_0x2c1b65[_0x2d6eba[_0x65cc('0x21')]]={'$like':'%'+_0x1c83dd[_0x65cc('0x28')]['filter']+'%'};return _0x2c1b65;}})});}_0x1f97f0=_['merge']({},_0x1f97f0,_0x1c83dd[_0x65cc('0x35')]);var _0x2cbd16={'where':_0x1f97f0['where']};return db[_0x65cc('0x25')][_0x65cc('0xe')](_0x2cbd16)[_0x65cc('0x13')](function(_0x2ad06e){_0x7952f2[_0x65cc('0xe')]=_0x2ad06e;if(_0x1c83dd[_0x65cc('0x28')][_0x65cc('0x36')]){_0x1f97f0[_0x65cc('0x37')]=[{'all':!![]}];}return db[_0x65cc('0x25')]['findAll'](_0x1f97f0);})[_0x65cc('0x13')](function(_0x2aac00){_0x7952f2['rows']=_0x2aac00;return _0x7952f2;})[_0x65cc('0x13')](respondWithFilteredResult(_0x4624e0,_0x1f97f0))[_0x65cc('0x38')](handleError(_0x4624e0,null));};exports[_0x65cc('0x39')]=function(_0x2d189a,_0x35977b){var _0x545959={'raw':![],'where':{'id':_0x2d189a[_0x65cc('0x3a')]['id']}},_0x475aab={};_0x475aab[_0x65cc('0x27')]=_[_0x65cc('0x29')](db[_0x65cc('0x25')][_0x65cc('0x26')]);_0x475aab[_0x65cc('0x28')]=_[_0x65cc('0x29')](_0x2d189a[_0x65cc('0x28')]);_0x475aab[_0x65cc('0x2a')]=_['intersection'](_0x475aab[_0x65cc('0x27')],_0x475aab[_0x65cc('0x28')]);_0x545959[_0x65cc('0x2c')]=_[_0x65cc('0x2b')](_0x475aab[_0x65cc('0x27')],qs['fields'](_0x2d189a[_0x65cc('0x28')][_0x65cc('0x2d')]));_0x545959[_0x65cc('0x2c')]=_0x545959['attributes'][_0x65cc('0x2e')]?_0x545959[_0x65cc('0x2c')]:_0x475aab[_0x65cc('0x27')];if(_0x2d189a[_0x65cc('0x28')][_0x65cc('0x36')]){_0x545959[_0x65cc('0x37')]=[{'all':!![]}];}_0x545959=_[_0x65cc('0x33')]({},_0x545959,_0x2d189a[_0x65cc('0x35')]);return db['VoiceExtension'][_0x65cc('0x20')](_0x545959)[_0x65cc('0x13')](handleEntityNotFound(_0x35977b,null))['then'](respondWithResult(_0x35977b,null))['catch'](handleError(_0x35977b,null));};exports[_0x65cc('0x12')]=function(_0x65b4fc,_0x5738ee){return db[_0x65cc('0x25')][_0x65cc('0x20')]({'where':{'id':_0x65b4fc[_0x65cc('0x3a')]['id']}})[_0x65cc('0x13')](handleEntityNotFound(_0x5738ee,null))[_0x65cc('0x13')](removeEntity(_0x5738ee,null))[_0x65cc('0x38')](handleError(_0x5738ee,null));};exports['create']=function(_0x47aebd,_0x526143){if(_0x47aebd[_0x65cc('0x3b')]['type']===_0x65cc('0x3c')&&!_[_0x65cc('0x3d')](_0x47aebd[_0x65cc('0x3b')][_0x65cc('0x3e')],'_')){_0x47aebd[_0x65cc('0x3b')][_0x65cc('0x3e')]='_'[_0x65cc('0x3f')](_0x47aebd[_0x65cc('0x3b')][_0x65cc('0x3e')]);}return db['VoiceExtension']['create'](_0x47aebd[_0x65cc('0x3b')],{'raw':![]})['then'](function(_0x19a71c){var _0xe511bf=_0x47aebd[_0x65cc('0x40')][_0x65cc('0x14')]({'plain':!![]});if(!_0xe511bf)throw new Error(_0x65cc('0x41'));if(_0xe511bf[_0x65cc('0x42')]==='user'){var _0x1fb009=_0x19a71c[_0x65cc('0x14')]({'plain':!![]});var _0x1aa05a=[{'name':'InboundRoutes','value':_0x65cc('0x16')},{'name':_0x65cc('0x17'),'value':_0x65cc('0x3c')},{'name':_0x65cc('0x18'),'value':_0x65cc('0x19')}];var _0x295bef=_[_0x65cc('0x20')](_0x1aa05a,[_0x65cc('0x1d'),_0x1fb009[_0x65cc('0x1f')]])['name'];return db[_0x65cc('0x43')][_0x65cc('0x20')]({'where':{'name':_0x295bef,'userProfileId':_0xe511bf[_0x65cc('0x44')]},'raw':!![]})[_0x65cc('0x13')](function(_0x4caafc){if(_0x4caafc&&_0x4caafc[_0x65cc('0x45')]===0x0){return db[_0x65cc('0x22')]['create']({'name':_0x1fb009['name'],'resourceId':_0x1fb009['id'],'type':_0x4caafc[_0x65cc('0x21')],'sectionId':_0x4caafc['id']},{})[_0x65cc('0x13')](function(){return _0x19a71c;});}else{return _0x19a71c;}})[_0x65cc('0x38')](function(_0x59a1e3){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a1e3);throw _0x59a1e3;});}return _0x19a71c;})['then'](respondWithResult(_0x526143,0xc9))[_0x65cc('0x38')](handleError(_0x526143,null));};exports['update']=function(_0x1cd7e0,_0x514ce7){if(_0x1cd7e0['body']['id']){delete _0x1cd7e0[_0x65cc('0x3b')]['id'];}return db[_0x65cc('0x25')][_0x65cc('0x20')]({'where':{'id':_0x1cd7e0['params']['id']}})[_0x65cc('0x13')](handleEntityNotFound(_0x514ce7,null))['then'](function(_0x559c6b){if(_0x559c6b){return db['VoiceExtension'][_0x65cc('0x46')](_[_0x65cc('0x47')](_0x1cd7e0[_0x65cc('0x3b')],[_0x65cc('0x3e'),'context',_0x65cc('0x48'),_0x65cc('0x49'),'cutdigits',_0x65cc('0x4a'),_0x65cc('0x4b')]),{'where':{'context':_0x559c6b[_0x65cc('0x4c')],'exten':_0x559c6b[_0x65cc('0x3e')]},'individualHooks':!![]})['then'](function(_0x5a8753){return _0x5a8753;});}return null;})[_0x65cc('0x13')](respondWithStatusCode(_0x514ce7,null))[_0x65cc('0x38')](handleError(_0x514ce7,null));};exports[_0x65cc('0x4d')]=function(_0x176c42,_0x40c90b){var _0x58c5cf=_0x176c42[_0x65cc('0x3a')]['id'];var _0x56e2f3=_0x176c42['body'];var _0x3dc764=0xc8;var _0x2b24e8=null;return db[_0x65cc('0x4e')][_0x65cc('0x4f')]({'isolationLevel':db[_0x65cc('0x4e')][_0x65cc('0x50')]['ISOLATION_LEVELS'][_0x65cc('0x51')]},function(_0x4267bf){return db['VoiceExtension'][_0x65cc('0x52')]({'where':{'id':_0x58c5cf},'transaction':_0x4267bf})['then'](function(_0x110bf3){if(_0x110bf3){return db['VoiceExtension'][_0x65cc('0x12')]({'where':{'VoiceExtensionId':_0x58c5cf},'transaction':_0x4267bf})[_0x65cc('0x13')](function(){var _0x14d26d=_['map'](_0x56e2f3,function(_0x3c0962){_0x3c0962[_0x65cc('0x53')]=_0x58c5cf;_0x3c0962[_0x65cc('0x54')]=!![];return _0x3c0962;});return _0x110bf3[_0x65cc('0x55')](_0x14d26d);})[_0x65cc('0x13')](function(_0x18843d){return db[_0x65cc('0x25')][_0x65cc('0x56')](_0x18843d,{'transaction':_0x4267bf});});}else{_0x3dc764=0x194;_0x2b24e8=[];}});})[_0x65cc('0x13')](function(){if(_0x3dc764!==0x194){return db[_0x65cc('0x25')][_0x65cc('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x58c5cf},'order':_0x65cc('0x58')})[_0x65cc('0x13')](function(_0x2305a4){_0x2b24e8=_0x2305a4;});}})['catch'](function(_0x3b785e){_0x3dc764=0x1f4;logger[_0x65cc('0x59')](_0x3b785e[_0x65cc('0x23')]);if(_0x3b785e['name']){delete _0x3b785e[_0x65cc('0x21')];}_0x2b24e8=_0x3b785e;})['finally'](function(){if(_0x2b24e8===null){_0x40c90b['sendStatus'](_0x3dc764);}else{if(_0x3dc764===0x1f4){_0x40c90b[_0x65cc('0xa')](_0x3dc764)[_0x65cc('0x5a')](_0x2b24e8);}else{_0x40c90b['status'](_0x3dc764)[_0x65cc('0x11')](_0x2b24e8);}}});}; \ No newline at end of file +var _0x9ce2=['concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','description','recordingFormat','cutdigits','alias','context','addApplications','sequelize','transaction','VoiceExtensionId','isApp','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','destroy','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','value','includes','type','find','then','error','stack','name','send','VoiceExtension','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','catch','create','body','startsWith','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ce2,0x185));var _0x29ce=function(_0x10e870,_0x4c4324){_0x10e870=_0x10e870-0x0;var _0x29b93d=_0x9ce2[_0x10e870];return _0x29b93d;};'use strict';var _=require(_0x29ce('0x0'));var Redis=require('ioredis');var qs=require(_0x29ce('0x1'));var logger=require(_0x29ce('0x2'))('api');var config=require(_0x29ce('0x3'));var db=require(_0x29ce('0x4'))['db'];config['redis']=_[_0x29ce('0x5')](config[_0x29ce('0x6')],{'host':_0x29ce('0x7'),'port':0x18eb});var socket=require(_0x29ce('0x8'))(new Redis(config[_0x29ce('0x6')]));require('./voiceExtension.socket')[_0x29ce('0x9')](socket);function respondWithStatusCode(_0x450198,_0x3ed3eb){_0x3ed3eb=_0x3ed3eb||0xcc;return function(_0x57c59f){if(_0x57c59f){return _0x450198[_0x29ce('0xa')](_0x3ed3eb);}return _0x450198[_0x29ce('0xb')](_0x3ed3eb)[_0x29ce('0xc')]();};}function respondWithResult(_0x37d6c2,_0x25bc42){_0x25bc42=_0x25bc42||0xc8;return function(_0x150be4){if(_0x150be4){return _0x37d6c2[_0x29ce('0xb')](_0x25bc42)[_0x29ce('0xd')](_0x150be4);}};}function respondWithFilteredResult(_0x4b40f6,_0x1df446){return function(_0x557582){if(_0x557582){var _0x24f5fc=typeof _0x1df446['offset']==='undefined'&&typeof _0x1df446['limit']===_0x29ce('0xe');var _0x9b31f=_0x557582['count'];var _0x4bdcce=_0x24f5fc?0x0:_0x1df446[_0x29ce('0xf')];var _0x4a6db6=_0x24f5fc?_0x557582[_0x29ce('0x10')]:_0x1df446['offset']+_0x1df446[_0x29ce('0x11')];var _0x380078;if(_0x4a6db6>=_0x9b31f){_0x4a6db6=_0x9b31f;_0x380078=0xc8;}else{_0x380078=0xce;}_0x4b40f6['status'](_0x380078);return _0x4b40f6[_0x29ce('0x12')](_0x29ce('0x13'),_0x4bdcce+'-'+_0x4a6db6+'/'+_0x9b31f)[_0x29ce('0xd')](_0x557582);}return null;};}function removeEntity(_0x2c84d9){return function(_0x42e6f3){if(_0x42e6f3){return _0x42e6f3[_0x29ce('0x14')]()['then'](function(){var _0x873f2f=_0x42e6f3[_0x29ce('0x15')]({'plain':!![]});var _0x4f97f3=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x29ce('0x16'),'value':_0x29ce('0x17'),'ignore':![]},{'name':_0x29ce('0x18'),'value':_0x29ce('0x19'),'ignore':![]}];var _0x296379=_(_0x4f97f3)[_0x29ce('0x1a')]('ignore')['map'](_0x29ce('0x1b'))[_0x29ce('0x1b')]();if(_[_0x29ce('0x1c')](_0x296379,_0x873f2f[_0x29ce('0x1d')])){return;}var _0x4e5272=_[_0x29ce('0x1e')](_0x4f97f3,[_0x29ce('0x1b'),_0x873f2f[_0x29ce('0x1d')]])['name'];return db['UserProfileResource'][_0x29ce('0x14')]({'where':{'type':_0x4e5272,'resourceId':_0x873f2f['id']}})['then'](function(){return _0x42e6f3;});})[_0x29ce('0x1f')](function(){_0x2c84d9['status'](0xcc)[_0x29ce('0xc')]();});}};}function handleEntityNotFound(_0x100574){return function(_0x1bccd9){if(!_0x1bccd9){_0x100574[_0x29ce('0xa')](0x194);}return _0x1bccd9;};}function handleError(_0x19d58c,_0x20af5f){_0x20af5f=_0x20af5f||0x1f4;return function(_0x6007b5){logger[_0x29ce('0x20')](_0x6007b5[_0x29ce('0x21')]);if(_0x6007b5[_0x29ce('0x22')]){delete _0x6007b5['name'];}_0x19d58c[_0x29ce('0xb')](_0x20af5f)[_0x29ce('0x23')](_0x6007b5);};}exports['index']=function(_0x182ff6,_0x27b02d){var _0x584778={},_0x4e696e={},_0x59fabe={'count':0x0,'rows':[]};var _0xde4ac1=_['map'](db[_0x29ce('0x24')][_0x29ce('0x25')],function(_0xff28e2){return{'name':_0xff28e2['fieldName'],'type':_0xff28e2['type'][_0x29ce('0x26')]};});_0x4e696e[_0x29ce('0x27')]=_[_0x29ce('0x28')](_0xde4ac1,'name');_0x4e696e[_0x29ce('0x29')]=_['keys'](_0x182ff6[_0x29ce('0x29')]);_0x4e696e[_0x29ce('0x2a')]=_[_0x29ce('0x2b')](_0x4e696e[_0x29ce('0x27')],_0x4e696e[_0x29ce('0x29')]);_0x584778[_0x29ce('0x2c')]=_[_0x29ce('0x2b')](_0x4e696e[_0x29ce('0x27')],qs[_0x29ce('0x2d')](_0x182ff6[_0x29ce('0x29')][_0x29ce('0x2d')]));_0x584778[_0x29ce('0x2c')]=_0x584778['attributes'][_0x29ce('0x2e')]?_0x584778[_0x29ce('0x2c')]:_0x4e696e[_0x29ce('0x27')];if(!_0x182ff6[_0x29ce('0x29')][_0x29ce('0x2f')](_0x29ce('0x30'))){_0x584778[_0x29ce('0x11')]=qs[_0x29ce('0x11')](_0x182ff6[_0x29ce('0x29')][_0x29ce('0x11')]);_0x584778['offset']=qs[_0x29ce('0xf')](_0x182ff6[_0x29ce('0x29')]['offset']);}_0x584778[_0x29ce('0x31')]=qs[_0x29ce('0x32')](_0x182ff6['query'][_0x29ce('0x32')]);_0x584778['where']=qs[_0x29ce('0x2a')](_['pick'](_0x182ff6[_0x29ce('0x29')],_0x4e696e[_0x29ce('0x2a')]),_0xde4ac1);if(_0x182ff6['query'][_0x29ce('0x1a')]){_0x584778[_0x29ce('0x33')]=_[_0x29ce('0x34')](_0x584778[_0x29ce('0x33')],{'$or':_[_0x29ce('0x28')](_0xde4ac1,function(_0x45a64a){if(_0x45a64a[_0x29ce('0x1d')]!==_0x29ce('0x35')){var _0xfade41={};_0xfade41[_0x45a64a['name']]={'$like':'%'+_0x182ff6[_0x29ce('0x29')]['filter']+'%'};return _0xfade41;}})});}_0x584778=_[_0x29ce('0x34')]({},_0x584778,_0x182ff6['options']);var _0x5e775b={'where':_0x584778[_0x29ce('0x33')]};return db['VoiceExtension'][_0x29ce('0x10')](_0x5e775b)['then'](function(_0x45fd73){_0x59fabe['count']=_0x45fd73;if(_0x182ff6[_0x29ce('0x29')][_0x29ce('0x36')]){_0x584778[_0x29ce('0x37')]=[{'all':!![]}];}return db[_0x29ce('0x24')]['findAll'](_0x584778);})[_0x29ce('0x1f')](function(_0x1c168c){_0x59fabe[_0x29ce('0x38')]=_0x1c168c;return _0x59fabe;})[_0x29ce('0x1f')](respondWithFilteredResult(_0x27b02d,_0x584778))['catch'](handleError(_0x27b02d,null));};exports[_0x29ce('0x39')]=function(_0x19c8fc,_0x294979){var _0x316417={'raw':![],'where':{'id':_0x19c8fc[_0x29ce('0x3a')]['id']}},_0x4b550c={};_0x4b550c[_0x29ce('0x27')]=_[_0x29ce('0x3b')](db[_0x29ce('0x24')][_0x29ce('0x25')]);_0x4b550c[_0x29ce('0x29')]=_['keys'](_0x19c8fc[_0x29ce('0x29')]);_0x4b550c['filters']=_[_0x29ce('0x2b')](_0x4b550c['model'],_0x4b550c[_0x29ce('0x29')]);_0x316417[_0x29ce('0x2c')]=_[_0x29ce('0x2b')](_0x4b550c[_0x29ce('0x27')],qs['fields'](_0x19c8fc[_0x29ce('0x29')]['fields']));_0x316417[_0x29ce('0x2c')]=_0x316417['attributes'][_0x29ce('0x2e')]?_0x316417[_0x29ce('0x2c')]:_0x4b550c[_0x29ce('0x27')];if(_0x19c8fc[_0x29ce('0x29')][_0x29ce('0x36')]){_0x316417['include']=[{'all':!![]}];}_0x316417=_[_0x29ce('0x34')]({},_0x316417,_0x19c8fc[_0x29ce('0x3c')]);return db[_0x29ce('0x24')][_0x29ce('0x1e')](_0x316417)[_0x29ce('0x1f')](handleEntityNotFound(_0x294979,null))[_0x29ce('0x1f')](respondWithResult(_0x294979,null))[_0x29ce('0x3d')](handleError(_0x294979,null));};exports[_0x29ce('0x14')]=function(_0x4399fe,_0x4ce07e){return db[_0x29ce('0x24')]['find']({'where':{'id':_0x4399fe[_0x29ce('0x3a')]['id']}})[_0x29ce('0x1f')](handleEntityNotFound(_0x4ce07e,null))[_0x29ce('0x1f')](removeEntity(_0x4ce07e,null))[_0x29ce('0x3d')](handleError(_0x4ce07e,null));};exports[_0x29ce('0x3e')]=function(_0x9b9664,_0x18acea){if(_0x9b9664[_0x29ce('0x3f')][_0x29ce('0x1d')]===_0x29ce('0x17')&&!_[_0x29ce('0x40')](_0x9b9664[_0x29ce('0x3f')][_0x29ce('0x41')],'_')){_0x9b9664[_0x29ce('0x3f')][_0x29ce('0x41')]='_'[_0x29ce('0x42')](_0x9b9664['body'][_0x29ce('0x41')]);}return db['VoiceExtension']['create'](_0x9b9664['body'],{'raw':![]})[_0x29ce('0x1f')](function(_0x1d0971){var _0x311efa=_0x9b9664[_0x29ce('0x43')]['get']({'plain':!![]});if(!_0x311efa)throw new Error(_0x29ce('0x44'));if(_0x311efa['role']===_0x29ce('0x43')){var _0xd0ac95=_0x1d0971['get']({'plain':!![]});var _0x4182a1=[{'name':_0x29ce('0x45'),'value':_0x29ce('0x46')},{'name':_0x29ce('0x16'),'value':_0x29ce('0x17')},{'name':_0x29ce('0x18'),'value':_0x29ce('0x19')}];var _0x32fb15=_[_0x29ce('0x1e')](_0x4182a1,[_0x29ce('0x1b'),_0xd0ac95[_0x29ce('0x1d')]])[_0x29ce('0x22')];return db[_0x29ce('0x47')][_0x29ce('0x1e')]({'where':{'name':_0x32fb15,'userProfileId':_0x311efa[_0x29ce('0x48')]},'raw':!![]})[_0x29ce('0x1f')](function(_0x52738a){if(_0x52738a&&_0x52738a[_0x29ce('0x49')]===0x0){return db[_0x29ce('0x4a')][_0x29ce('0x3e')]({'name':_0xd0ac95[_0x29ce('0x22')],'resourceId':_0xd0ac95['id'],'type':_0x52738a['name'],'sectionId':_0x52738a['id']},{})['then'](function(){return _0x1d0971;});}else{return _0x1d0971;}})[_0x29ce('0x3d')](function(_0x2bf5c5){logger[_0x29ce('0x20')](_0x29ce('0x4b'),_0x2bf5c5);throw _0x2bf5c5;});}return _0x1d0971;})['then'](respondWithResult(_0x18acea,0xc9))[_0x29ce('0x3d')](handleError(_0x18acea,null));};exports[_0x29ce('0x4c')]=function(_0x1f1bf7,_0x397ee5){if(_0x1f1bf7[_0x29ce('0x3f')]['id']){delete _0x1f1bf7[_0x29ce('0x3f')]['id'];}return db[_0x29ce('0x24')][_0x29ce('0x1e')]({'where':{'id':_0x1f1bf7[_0x29ce('0x3a')]['id']}})[_0x29ce('0x1f')](handleEntityNotFound(_0x397ee5,null))[_0x29ce('0x1f')](function(_0xc63a2a){if(_0xc63a2a){return db[_0x29ce('0x24')][_0x29ce('0x4c')](_[_0x29ce('0x4d')](_0x1f1bf7['body'],['exten','context',_0x29ce('0x4e'),_0x29ce('0x4f'),_0x29ce('0x50'),'mandatoryDisposition',_0x29ce('0x51')]),{'where':{'context':_0xc63a2a[_0x29ce('0x52')],'exten':_0xc63a2a['exten']},'individualHooks':!![]})[_0x29ce('0x1f')](function(_0x590f76){return _0x590f76;});}return null;})[_0x29ce('0x1f')](respondWithStatusCode(_0x397ee5,null))[_0x29ce('0x3d')](handleError(_0x397ee5,null));};exports[_0x29ce('0x53')]=function(_0x489f38,_0x531f90){var _0x261fa8=_0x489f38['params']['id'];var _0x3de192=_0x489f38[_0x29ce('0x3f')];var _0x55cd3e=0xc8;var _0x3c8871=null;return db[_0x29ce('0x54')][_0x29ce('0x55')]({'isolationLevel':db[_0x29ce('0x54')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0xa3e44f){return db['VoiceExtension']['findOne']({'where':{'id':_0x261fa8},'transaction':_0xa3e44f})[_0x29ce('0x1f')](function(_0x16b954){if(_0x16b954){return db[_0x29ce('0x24')][_0x29ce('0x14')]({'where':{'VoiceExtensionId':_0x261fa8},'transaction':_0xa3e44f})[_0x29ce('0x1f')](function(){var _0x42461f=_[_0x29ce('0x28')](_0x3de192,function(_0x51f62f){_0x51f62f[_0x29ce('0x56')]=_0x261fa8;_0x51f62f[_0x29ce('0x57')]=!![];return _0x51f62f;});return _0x16b954['createRouting'](_0x42461f);})['then'](function(_0x5894e1){return db['VoiceExtension'][_0x29ce('0x58')](_0x5894e1,{'transaction':_0xa3e44f});});}else{_0x55cd3e=0x194;_0x3c8871=[];}});})[_0x29ce('0x1f')](function(){if(_0x55cd3e!==0x194){return db[_0x29ce('0x24')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x261fa8},'order':_0x29ce('0x59')})['then'](function(_0x4a282e){_0x3c8871=_0x4a282e;});}})[_0x29ce('0x3d')](function(_0x4d7cef){_0x55cd3e=0x1f4;logger[_0x29ce('0x20')](_0x4d7cef[_0x29ce('0x21')]);if(_0x4d7cef[_0x29ce('0x22')]){delete _0x4d7cef['name'];}_0x3c8871=_0x4d7cef;})[_0x29ce('0x5a')](function(){if(_0x3c8871===null){_0x531f90['sendStatus'](_0x55cd3e);}else{if(_0x55cd3e===0x1f4){_0x531f90[_0x29ce('0xb')](_0x55cd3e)[_0x29ce('0x23')](_0x3c8871);}else{_0x531f90['status'](_0x55cd3e)[_0x29ce('0xd')](_0x3c8871);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2e2d1b1..173aa9a 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 _0xec3e=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x236b13,_0xd848df){var _0x4def23=function(_0x804f56){while(--_0x804f56){_0x236b13['push'](_0x236b13['shift']());}};_0x4def23(++_0xd848df);}(_0xec3e,0x93));var _0xeec3=function(_0x312091,_0x23bae5){_0x312091=_0x312091-0x0;var _0x47f04d=_0xec3e[_0x312091];return _0x47f04d;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xeec3('0x0'))['db'][_0xeec3('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xeec3('0x2')](0x0);var events={'afterCreate':_0xeec3('0x3'),'afterUpdate':_0xeec3('0x4'),'afterDestroy':_0xeec3('0x5')};function emitEvent(_0x4622ae){return function(_0x37c6ee,_0x271c16,_0x2db972){VoiceExtensionEvents[_0xeec3('0x6')](_0x4622ae+':'+_0x37c6ee['id'],_0x37c6ee);VoiceExtensionEvents[_0xeec3('0x6')](_0x4622ae,_0x37c6ee);_0x2db972(null);};}for(var e in events){if(events[_0xeec3('0x7')](e)){var event=events[e];VoiceExtension[_0xeec3('0x8')](e,emitEvent(event));}}module[_0xeec3('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xeac9=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeac9,0x1a0));var _0x9eac=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xeac9[_0x29b609];return _0x54c952;};'use strict';var EventEmitter=require(_0x9eac('0x0'));var VoiceExtension=require(_0x9eac('0x1'))['db'][_0x9eac('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9eac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9eac('0x4'),'afterDestroy':_0x9eac('0x5')};function emitEvent(_0x24c6d3){return function(_0x35b5f4,_0x526aab,_0x25124a){VoiceExtensionEvents[_0x9eac('0x6')](_0x24c6d3+':'+_0x35b5f4['id'],_0x35b5f4);VoiceExtensionEvents[_0x9eac('0x6')](_0x24c6d3,_0x35b5f4);_0x25124a(null);};}for(var e in events){if(events[_0x9eac('0x7')](e)){var event=events[e];VoiceExtension[_0x9eac('0x8')](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 4983e24..aef1f0a 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 _0x4f5d=['CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','name','param','split','phone','prefix','SIP','join','U(xcally-mixmonitor-context)','replace','Interval','findAll','then','length','*,*,*,*','interval','intervals','IntervalId','toLowerCase','CDR(tag)=','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','No\x20alias\x20set','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4f5d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd4f5('0x0'));var attributes=require(_0xd4f5('0x1'));module[_0xd4f5('0x2')]=function(_0x3acbfd){var _0x4548e6=_0x3acbfd[_0xd4f5('0x3')];function _0x5b9640(_0x45f512){var _0x468609=0x2;var _0xf61335=[{'type':_0x45f512[_0xd4f5('0x4')],'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x6')+_0x45f512[_0xd4f5('0x4')],'context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512[_0xd4f5('0x8')],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']},{'type':_0x45f512[_0xd4f5('0x4')],'app':_0x45f512[_0xd4f5('0x9')]?_0xd4f5('0x5'):_0xd4f5('0xa'),'appdata':_0x45f512['alias']?_0xd4f5('0xb')+_0x45f512[_0xd4f5('0x9')]:'No\x20alias\x20set','context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512[_0xd4f5('0x8')],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']}];if(_0x45f512[_0xd4f5('0x4')]===_0xd4f5('0xc')){_0xf61335[_0xd4f5('0xd')]({'type':_0xd4f5('0xc'),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0xe')+_0x45f512['id'],'context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512['exten'],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']});}_0xf61335[_0xd4f5('0xd')]({'type':_0x45f512[_0xd4f5('0x4')],'app':'Set','appdata':_0xd4f5('0xf'),'context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512[_0xd4f5('0x8')],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']},{'type':_0x45f512['type'],'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x10'),'context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512[_0xd4f5('0x8')],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']},{'type':_0x45f512[_0xd4f5('0x4')],'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x11'),'context':_0x45f512[_0xd4f5('0x7')],'exten':_0x45f512['exten'],'priority':_0x468609++,'VoiceExtensionId':_0x45f512['id']});return _0xf61335;}function _0x452e46(_0x4f0f30){var _0x45d043=0x2;var _0x5af6e0=[{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x13'),'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0x4f0f30[_0xd4f5('0x9')]?_0xd4f5('0x5'):'NoOp','appdata':_0x4f0f30[_0xd4f5('0x9')]?_0xd4f5('0xb')+_0x4f0f30['alias']:_0xd4f5('0x14'),'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30['exten'],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':'outbound','app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x15')+(_0x4f0f30[_0xd4f5('0x16')]?_0xd4f5('0x17')+_0x4f0f30[_0xd4f5('0x16')]+'}':_0xd4f5('0x18')),'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30['exten'],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':'outbound','app':_0xd4f5('0x5'),'appdata':_0xd4f5('0xe')+_0x4f0f30['id'],'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x19'),'appdata':_0xd4f5('0x1a')+(_0x45d043+0x2)+'):Goto('+(_0x45d043+0x1)+')','context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':'outbound','app':'Set','appdata':_0x4f0f30['cutdigits']?_0xd4f5('0x1b')+_0x4f0f30[_0xd4f5('0x16')]+'}':'CDR(prefix)=noprefix','context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30['exten'],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0xf'),'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x10'),'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30['exten'],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':'outbound','app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':'outboundrouteid='+_0x4f0f30['id'],'context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']}];if(_0x4f0f30[_0xd4f5('0x1c')](_0xd4f5('0x1d'))&&_0x4f0f30[_0xd4f5('0x1d')]!==_0xd4f5('0x1e')){_0x5af6e0[_0xd4f5('0xd')]({'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4f0f30['context'],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']},{'type':_0xd4f5('0x12'),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x1f')+_0x4f0f30[_0xd4f5('0x1d')]||'wav','context':_0x4f0f30[_0xd4f5('0x7')],'exten':_0x4f0f30[_0xd4f5('0x8')],'priority':_0x45d043++,'VoiceExtensionId':_0x4f0f30['id']});}return _0x5af6e0;}function _0x14cd8c(_0x554993,_0x23b0af){var _0x31b9e6=[{'name':_0xd4f5('0x20'),'param':0x0},{'name':_0xd4f5('0x21'),'param':0x1},{'name':_0xd4f5('0x22'),'param':0x2},{'name':_0xd4f5('0x23'),'param':0x3}];var _0x50da39={};var _0x597a0c=_0x23b0af['split'](',');var _0x29f348=[];for(var _0x369424=0x0;_0x369424<_0x31b9e6['length'];_0x369424++){switch(_0x31b9e6[_0x369424][_0xd4f5('0x24')]){case _0xd4f5('0x20'):_0x50da39['trunk']=_0x597a0c[_0x31b9e6[_0x369424][_0xd4f5('0x25')]][_0xd4f5('0x26')]('/')[0x1];_0x50da39['phone']=_0x597a0c[_0x31b9e6[_0x369424]['param']][_0xd4f5('0x26')]('/')[0x2];_0x50da39['prefix']=_0x50da39[_0xd4f5('0x27')]?_0x50da39[_0xd4f5('0x27')][_0xd4f5('0x26')]('$')[0x0]:undefined;_0x50da39[_0xd4f5('0x27')]=_0x554993[_0xd4f5('0x16')]?(_0x50da39[_0xd4f5('0x28')]||'')+_0xd4f5('0x17')+_0x554993[_0xd4f5('0x16')]+'}':(_0x50da39['prefix']||'')+_0xd4f5('0x18');_0x29f348[_0x31b9e6[_0x369424][_0xd4f5('0x25')]]=[_0xd4f5('0x29'),_0x50da39[_0xd4f5('0x20')],_0x50da39[_0xd4f5('0x27')]][_0xd4f5('0x2a')]('/');break;case _0xd4f5('0x22'):_0x50da39['options']=_0x597a0c[_0x31b9e6[_0x369424]['param']];if(_0x554993[_0xd4f5('0x1d')]!==_0xd4f5('0x1e')){if(_0x50da39[_0xd4f5('0x22')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x50da39[_0xd4f5('0x22')]+=_0xd4f5('0x2b');}}else{_0x50da39[_0xd4f5('0x22')]=_0x50da39[_0xd4f5('0x22')][_0xd4f5('0x2c')]('U(xcally-mixmonitor-context)','');}_0x29f348[_0x31b9e6[_0x369424][_0xd4f5('0x25')]]=_0x50da39[_0xd4f5('0x22')];break;default:_0x29f348[_0x31b9e6[_0x369424][_0xd4f5('0x25')]]=_0x597a0c[_0x31b9e6[_0x369424][_0xd4f5('0x25')]];}}return _0x29f348[_0xd4f5('0x2a')](',');}function _0x1652dc(_0x44ba93,_0x3517e4,_0x4a413c){return new Promise(function(_0xad681b,_0x4808d4){var _0x4b6bfe=[];if(_['isEmpty'](_0x3517e4))return _0xad681b(_0x4b6bfe);_0x4548e6[_0xd4f5('0x2d')][_0xd4f5('0x2e')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xd4f5('0x2f')](function(_0x3bb6ac){for(var _0x519b05=0x0,_0x57d9e5=0x0;_0x519b05<_0x3517e4[_0xd4f5('0x30')];_0x519b05++,_0x57d9e5=0x0){var _0x1cefe1=_0x3517e4[_0x519b05];var _0x5dfd29=[];var _0x1db657=[];delete _0x1cefe1['id'];if(_0x1cefe1['interval']!==_0xd4f5('0x31')){_0x1cefe1['intervals']=[_0x1cefe1[_0xd4f5('0x32')]];}else{_0x1cefe1[_0xd4f5('0x33')]=_0x1cefe1[_0xd4f5('0x34')]?_['map'](_['filter'](_0x3bb6ac,{'IntervalId':_0x1cefe1[_0xd4f5('0x34')]}),_0xd4f5('0x32')):[];}_0x1cefe1[_0xd4f5('0x7')]=_0x44ba93[_0xd4f5('0x7')];_0x1cefe1['exten']=_0x44ba93[_0xd4f5('0x8')];if(_0x1cefe1['type'])_0x1cefe1[_0xd4f5('0x4')]=_0x1cefe1[_0xd4f5('0x4')][_0xd4f5('0x35')]();if(_0x44ba93[_0xd4f5('0x4')]===_0xd4f5('0x12')){if(_0x1cefe1[_0xd4f5('0x1c')]('tag')&&_0x1cefe1['tag']&&_0x1cefe1['tag']!=='--'){_0x5dfd29[_0xd4f5('0xd')]({'type':_0x1cefe1['type']['toLowerCase'](),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x36')+_0x1cefe1[_0xd4f5('0x37')],'context':_0x44ba93['context'],'exten':_0x44ba93[_0xd4f5('0x8')],'priority':_0x1cefe1['intervals']['length']+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});}_0x5dfd29['push']({'type':_0x1cefe1[_0xd4f5('0x4')][_0xd4f5('0x35')](),'app':'ExecIf','appdata':_0xd4f5('0x38')+(_0x1cefe1[_0xd4f5('0x39')]?_0xd4f5('0x3a')+_0x1cefe1[_0xd4f5('0x39')]+')':_0xd4f5('0x3b')),'context':_0x44ba93['context'],'exten':_0x44ba93[_0xd4f5('0x8')],'priority':_0x1cefe1['intervals'][_0xd4f5('0x30')]+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});}else{if(_0x1cefe1['hasOwnProperty'](_0xd4f5('0x3c'))){if([_0xd4f5('0x3d'),_0xd4f5('0x3e')]['includes'](_0x1cefe1[_0xd4f5('0x3f')][_0xd4f5('0x35')]())&&_0x1cefe1[_0xd4f5('0x40')]!==_0xd4f5('0x41')){if(_0x1cefe1[_0xd4f5('0x3c')]){_0x5dfd29[_0xd4f5('0xd')]({'type':_0x1cefe1[_0xd4f5('0x4')]['toLowerCase'](),'app':'ExecIf','appdata':_0xd4f5('0x42'),'context':_0x44ba93[_0xd4f5('0x7')],'exten':_0x44ba93[_0xd4f5('0x8')],'priority':_0x1cefe1[_0xd4f5('0x33')]['length']+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});_0x5dfd29[_0xd4f5('0xd')]({'type':_0x1cefe1[_0xd4f5('0x4')][_0xd4f5('0x35')](),'app':'Set','appdata':_0xd4f5('0x43'),'context':_0x44ba93['context'],'exten':_0x44ba93[_0xd4f5('0x8')],'priority':_0x1cefe1[_0xd4f5('0x33')][_0xd4f5('0x30')]+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});}else{_0x5dfd29['push']({'type':_0x1cefe1[_0xd4f5('0x4')][_0xd4f5('0x35')](),'app':_0xd4f5('0x19'),'appdata':_0xd4f5('0x44'),'context':_0x44ba93[_0xd4f5('0x7')],'exten':_0x44ba93[_0xd4f5('0x8')],'priority':_0x1cefe1['intervals'][_0xd4f5('0x30')]+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});_0x5dfd29[_0xd4f5('0xd')]({'type':_0x1cefe1[_0xd4f5('0x4')][_0xd4f5('0x35')](),'app':_0xd4f5('0x5'),'appdata':_0xd4f5('0x45'),'context':_0x44ba93['context'],'exten':_0x44ba93['exten'],'priority':_0x1cefe1['intervals'][_0xd4f5('0x30')]+_0x4a413c+_0x57d9e5++,'VoiceExtensionId':_0x44ba93['id']});}}}}for(var _0x1e74b0=0x0;_0x1e74b0<_0x1cefe1[_0xd4f5('0x33')]['length'];_0x1e74b0++){var _0x4746df=_0x4a413c+_0x1cefe1['intervals'][_0xd4f5('0x30')];var _0xc8d820=_0x1e74b0===_0x1cefe1['intervals'][_0xd4f5('0x30')]-0x1?_0x4a413c+_0x5dfd29[_0xd4f5('0x30')]+_0x1db657['length']+0x2:_0x4a413c+_0x1e74b0+0x1;_0x5dfd29[_0xd4f5('0x46')](_0x1e74b0,0x0,{'type':_0x44ba93[_0xd4f5('0x4')],'app':'GotoIfTime','appdata':_0x1cefe1[_0xd4f5('0x33')][_0x1e74b0]+'?'+_0x44ba93['context']+_0xd4f5('0x47')+_0x4746df+':'+_0x44ba93['context']+_0xd4f5('0x47')+_0xc8d820,'exten':_0x44ba93[_0xd4f5('0x8')],'context':_0x44ba93[_0xd4f5('0x7')],'priority':_0x4a413c+_0x1e74b0,'VoiceExtensionId':_0x44ba93['id']});}if(_0x1cefe1[_0xd4f5('0x40')]===_0xd4f5('0x48'))_0x1cefe1[_0xd4f5('0x49')]=_0x14cd8c(_0x44ba93,_0x1cefe1[_0xd4f5('0x49')]);_0x1cefe1[_0xd4f5('0x4a')]=_0x5dfd29[_0xd4f5('0x30')]?_[_0xd4f5('0x4b')](_0x5dfd29)[_0xd4f5('0x4a')]+0x1:_0x4a413c;_0x4b6bfe=_['concat'](_0x4b6bfe,_0x5dfd29,[_0x1cefe1],_0x1db657);_0x4a413c=_[_0xd4f5('0x4b')](_0x4b6bfe)[_0xd4f5('0x4a')]+0x1;}return _0xad681b(_0x4b6bfe);})[_0xd4f5('0x4c')](function(_0x425be2){_0x4808d4(_0x425be2);});});}return _0x3acbfd[_0xd4f5('0x4d')]('VoiceExtension',attributes,{'tableName':_0xd4f5('0x4e'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x308e19){var _0x3d0c52=this[_0xd4f5('0x4f')]({'plain':!![]});var _0x407613=_0x3d0c52[_0xd4f5('0x4')]==='outbound'?_0x452e46(_0x3d0c52):_0x5b9640(_0x3d0c52);return _0x1652dc(_0x3d0c52,_0x308e19,_[_0xd4f5('0x4b')](_0x407613)[_0xd4f5('0x4a')]+0x1)[_0xd4f5('0x2f')](function(_0xc70dfd){var _0x5ea37d=_[_0xd4f5('0x50')](_0x407613,_0xc70dfd);_0x5ea37d['push']({'type':_0x3d0c52[_0xd4f5('0x4')],'app':_0xd4f5('0x51'),'exten':_0x3d0c52[_0xd4f5('0x8')],'context':_0x3d0c52[_0xd4f5('0x7')],'priority':_['last'](_0x5ea37d)['priority']+0x1,'VoiceExtensionId':_0x3d0c52['id']});return _0x5ea37d;});}}});}; \ No newline at end of file +var _0xe91f=['get','concat','lodash','./voiceExtension.attributes','models','type','context','exten','Set','CDR(routeAlias)=','alias','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','NoOp','No\x20alias\x20set','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','options','url','split','length','name','param','phone','prefix','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','IntervalId','interval','*,*,*,*','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','last','priority','catch','define','VoiceExtension','voice_extensions'];(function(_0x407494,_0x262406){var _0x5b2bd6=function(_0x4f03c7){while(--_0x4f03c7){_0x407494['push'](_0x407494['shift']());}};_0x5b2bd6(++_0x262406);}(_0xe91f,0xf8));var _0xfe91=function(_0x10290b,_0x18bff5){_0x10290b=_0x10290b-0x0;var _0x17a5c2=_0xe91f[_0x10290b];return _0x17a5c2;};'use strict';var _=require(_0xfe91('0x0'));var attributes=require(_0xfe91('0x1'));module['exports']=function(_0x45e044){var _0x569a3b=_0x45e044[_0xfe91('0x2')];function _0x219329(_0x21f959){var _0x5c60b3=0x2;var _0xa43e10=[{'type':_0x21f959[_0xfe91('0x3')],'app':'Set','appdata':'CDR(type)='+_0x21f959['type'],'context':_0x21f959[_0xfe91('0x4')],'exten':_0x21f959[_0xfe91('0x5')],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']},{'type':_0x21f959[_0xfe91('0x3')],'app':_0x21f959['alias']?_0xfe91('0x6'):'NoOp','appdata':_0x21f959['alias']?_0xfe91('0x7')+_0x21f959[_0xfe91('0x8')]:'No\x20alias\x20set','context':_0x21f959['context'],'exten':_0x21f959['exten'],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']}];if(_0x21f959['type']==='inbound'){_0xa43e10[_0xfe91('0x9')]({'type':_0xfe91('0xa'),'app':'Set','appdata':_0xfe91('0xb')+_0x21f959['id'],'context':_0x21f959[_0xfe91('0x4')],'exten':_0x21f959[_0xfe91('0x5')],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']});}_0xa43e10['push']({'type':_0x21f959[_0xfe91('0x3')],'app':_0xfe91('0x6'),'appdata':_0xfe91('0xc'),'context':_0x21f959[_0xfe91('0x4')],'exten':_0x21f959[_0xfe91('0x5')],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']},{'type':_0x21f959['type'],'app':_0xfe91('0x6'),'appdata':_0xfe91('0xd'),'context':_0x21f959[_0xfe91('0x4')],'exten':_0x21f959['exten'],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']},{'type':_0x21f959['type'],'app':_0xfe91('0x6'),'appdata':'MONITOR_OPTIONS=ab','context':_0x21f959[_0xfe91('0x4')],'exten':_0x21f959[_0xfe91('0x5')],'priority':_0x5c60b3++,'VoiceExtensionId':_0x21f959['id']});return _0xa43e10;}function _0x44c3af(_0x2f785f){var _0x23f685=0x2;var _0x3a5c80=[{'type':'outbound','app':_0xfe91('0x6'),'appdata':_0xfe91('0xe'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0x2f785f[_0xfe91('0x8')]?_0xfe91('0x6'):_0xfe91('0xf'),'appdata':_0x2f785f[_0xfe91('0x8')]?_0xfe91('0x7')+_0x2f785f[_0xfe91('0x8')]:_0xfe91('0x10'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':_0xfe91('0x11'),'app':'Set','appdata':'CDR(destination)='+(_0x2f785f[_0xfe91('0x12')]?_0xfe91('0x13')+_0x2f785f[_0xfe91('0x12')]+'}':_0xfe91('0x14')),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0xfe91('0x6'),'appdata':'CDR(routeid)='+_0x2f785f['id'],'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':_0xfe91('0x11'),'app':_0xfe91('0x15'),'appdata':_0xfe91('0x16')+(_0x23f685+0x2)+_0xfe91('0x17')+(_0x23f685+0x1)+')','context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f['exten'],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':_0xfe91('0x11'),'app':'Set','appdata':_0x2f785f['cutdigits']?_0xfe91('0x18')+_0x2f785f[_0xfe91('0x12')]+'}':_0xfe91('0x19'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f['exten'],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0xfe91('0x6'),'appdata':_0xfe91('0xc'),'context':_0x2f785f['context'],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0xfe91('0x6'),'appdata':_0xfe91('0xd'),'context':_0x2f785f['context'],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0xfe91('0x6'),'appdata':_0xfe91('0x1a'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':'outbound','app':_0xfe91('0x6'),'appdata':_0xfe91('0x1b')+_0x2f785f['id'],'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']}];if(_0x2f785f['hasOwnProperty'](_0xfe91('0x1c'))&&_0x2f785f['recordingFormat']!==_0xfe91('0x1d')){_0x3a5c80[_0xfe91('0x9')]({'type':_0xfe91('0x11'),'app':'Set','appdata':_0xfe91('0x1e'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']},{'type':_0xfe91('0x11'),'app':_0xfe91('0x6'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2f785f['recordingFormat']||_0xfe91('0x1f'),'context':_0x2f785f[_0xfe91('0x4')],'exten':_0x2f785f[_0xfe91('0x5')],'priority':_0x23f685++,'VoiceExtensionId':_0x2f785f['id']});}return _0x3a5c80;}function _0x3509fe(_0xf5c4,_0x2cc682){var _0x1b2ae8=[{'name':_0xfe91('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xfe91('0x21'),'param':0x2},{'name':_0xfe91('0x22'),'param':0x3}];var _0x298e8f={};var _0xd4ef25=_0x2cc682[_0xfe91('0x23')](',');var _0x2ff63f=[];for(var _0x586a0d=0x0;_0x586a0d<_0x1b2ae8[_0xfe91('0x24')];_0x586a0d++){switch(_0x1b2ae8[_0x586a0d][_0xfe91('0x25')]){case _0xfe91('0x20'):_0x298e8f[_0xfe91('0x20')]=_0xd4ef25[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]]['split']('/')[0x1];_0x298e8f[_0xfe91('0x27')]=_0xd4ef25[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]][_0xfe91('0x23')]('/')[0x2];_0x298e8f[_0xfe91('0x28')]=_0x298e8f[_0xfe91('0x27')]?_0x298e8f[_0xfe91('0x27')][_0xfe91('0x23')]('$')[0x0]:undefined;_0x298e8f[_0xfe91('0x27')]=_0xf5c4[_0xfe91('0x12')]?(_0x298e8f['prefix']||'')+_0xfe91('0x13')+_0xf5c4['cutdigits']+'}':(_0x298e8f[_0xfe91('0x28')]||'')+'${EXTEN}';_0x2ff63f[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]]=[_0xfe91('0x29'),_0x298e8f[_0xfe91('0x20')],_0x298e8f[_0xfe91('0x27')]][_0xfe91('0x2a')]('/');break;case _0xfe91('0x21'):_0x298e8f[_0xfe91('0x21')]=_0xd4ef25[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]];if(_0xf5c4['recordingFormat']!==_0xfe91('0x1d')){if(_0x298e8f[_0xfe91('0x21')][_0xfe91('0x2b')](_0xfe91('0x2c'))<0x0){_0x298e8f['options']+=_0xfe91('0x2c');}}else{_0x298e8f[_0xfe91('0x21')]=_0x298e8f['options'][_0xfe91('0x2d')](_0xfe91('0x2c'),'');}_0x2ff63f[_0x1b2ae8[_0x586a0d]['param']]=_0x298e8f[_0xfe91('0x21')];break;default:_0x2ff63f[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]]=_0xd4ef25[_0x1b2ae8[_0x586a0d][_0xfe91('0x26')]];}}return _0x2ff63f[_0xfe91('0x2a')](',');}function _0x356ef5(_0x46415f,_0x5e3d31,_0x376095){return new Promise(function(_0x498178,_0x7e59b6){var _0x37a26e=[];if(_['isEmpty'](_0x5e3d31))return _0x498178(_0x37a26e);_0x569a3b[_0xfe91('0x2e')][_0xfe91('0x2f')]({'attributes':['id','interval',_0xfe91('0x30')],'raw':!![]})['then'](function(_0x5960f1){for(var _0x397fb5=0x0,_0x3cecfd=0x0;_0x397fb5<_0x5e3d31[_0xfe91('0x24')];_0x397fb5++,_0x3cecfd=0x0){var _0x2a37ab=_0x5e3d31[_0x397fb5];var _0x25b401=[];var _0x335108=[];delete _0x2a37ab['id'];if(_0x2a37ab[_0xfe91('0x31')]!==_0xfe91('0x32')){_0x2a37ab[_0xfe91('0x33')]=[_0x2a37ab['interval']];}else{_0x2a37ab[_0xfe91('0x33')]=_0x2a37ab[_0xfe91('0x30')]?_[_0xfe91('0x34')](_[_0xfe91('0x35')](_0x5960f1,{'IntervalId':_0x2a37ab[_0xfe91('0x30')]}),_0xfe91('0x31')):[];}_0x2a37ab[_0xfe91('0x4')]=_0x46415f[_0xfe91('0x4')];_0x2a37ab[_0xfe91('0x5')]=_0x46415f[_0xfe91('0x5')];if(_0x2a37ab[_0xfe91('0x3')])_0x2a37ab['type']=_0x2a37ab['type'][_0xfe91('0x36')]();if(_0x46415f[_0xfe91('0x3')]===_0xfe91('0x11')){if(_0x2a37ab[_0xfe91('0x37')](_0xfe91('0x38'))&&_0x2a37ab['tag']&&_0x2a37ab['tag']!=='--'){_0x25b401['push']({'type':_0x2a37ab['type'][_0xfe91('0x36')](),'app':_0xfe91('0x6'),'appdata':_0xfe91('0x39')+_0x2a37ab[_0xfe91('0x38')],'context':_0x46415f[_0xfe91('0x4')],'exten':_0x46415f['exten'],'priority':_0x2a37ab[_0xfe91('0x33')]['length']+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});}_0x25b401[_0xfe91('0x9')]({'type':_0x2a37ab[_0xfe91('0x3')]['toLowerCase'](),'app':_0xfe91('0x15'),'appdata':_0xfe91('0x3a')+(_0x2a37ab[_0xfe91('0x3b')]?_0xfe91('0x3c')+_0x2a37ab['callerID']+')':_0xfe91('0x3d')),'context':_0x46415f['context'],'exten':_0x46415f[_0xfe91('0x5')],'priority':_0x2a37ab[_0xfe91('0x33')]['length']+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});}else{if(_0x2a37ab['hasOwnProperty'](_0xfe91('0x3e'))){if([_0xfe91('0x3f'),'playback'][_0xfe91('0x40')](_0x2a37ab['app'][_0xfe91('0x36')]())&&_0x2a37ab[_0xfe91('0x41')]!==_0xfe91('0x42')){if(_0x2a37ab[_0xfe91('0x3e')]){_0x25b401[_0xfe91('0x9')]({'type':_0x2a37ab[_0xfe91('0x3')][_0xfe91('0x36')](),'app':_0xfe91('0x15'),'appdata':_0xfe91('0x43'),'context':_0x46415f[_0xfe91('0x4')],'exten':_0x46415f[_0xfe91('0x5')],'priority':_0x2a37ab[_0xfe91('0x33')][_0xfe91('0x24')]+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});_0x25b401[_0xfe91('0x9')]({'type':_0x2a37ab['type'][_0xfe91('0x36')](),'app':'Set','appdata':_0xfe91('0x44'),'context':_0x46415f['context'],'exten':_0x46415f[_0xfe91('0x5')],'priority':_0x2a37ab[_0xfe91('0x33')]['length']+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});}else{_0x25b401[_0xfe91('0x9')]({'type':_0x2a37ab[_0xfe91('0x3')]['toLowerCase'](),'app':'ExecIf','appdata':_0xfe91('0x45'),'context':_0x46415f[_0xfe91('0x4')],'exten':_0x46415f['exten'],'priority':_0x2a37ab['intervals'][_0xfe91('0x24')]+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});_0x25b401[_0xfe91('0x9')]({'type':_0x2a37ab[_0xfe91('0x3')][_0xfe91('0x36')](),'app':'Set','appdata':_0xfe91('0x46'),'context':_0x46415f[_0xfe91('0x4')],'exten':_0x46415f[_0xfe91('0x5')],'priority':_0x2a37ab['intervals'][_0xfe91('0x24')]+_0x376095+_0x3cecfd++,'VoiceExtensionId':_0x46415f['id']});}}}}for(var _0xb366b8=0x0;_0xb366b8<_0x2a37ab[_0xfe91('0x33')][_0xfe91('0x24')];_0xb366b8++){var _0x1ab1fe=_0x376095+_0x2a37ab[_0xfe91('0x33')]['length'];var _0x2cea66=_0xb366b8===_0x2a37ab[_0xfe91('0x33')][_0xfe91('0x24')]-0x1?_0x376095+_0x25b401[_0xfe91('0x24')]+_0x335108[_0xfe91('0x24')]+0x2:_0x376095+_0xb366b8+0x1;_0x25b401['splice'](_0xb366b8,0x0,{'type':_0x46415f[_0xfe91('0x3')],'app':_0xfe91('0x47'),'appdata':_0x2a37ab[_0xfe91('0x33')][_0xb366b8]+'?'+_0x46415f[_0xfe91('0x4')]+_0xfe91('0x48')+_0x1ab1fe+':'+_0x46415f[_0xfe91('0x4')]+_0xfe91('0x48')+_0x2cea66,'exten':_0x46415f[_0xfe91('0x5')],'context':_0x46415f[_0xfe91('0x4')],'priority':_0x376095+_0xb366b8,'VoiceExtensionId':_0x46415f['id']});}if(_0x2a37ab[_0xfe91('0x41')]==='outboundDial')_0x2a37ab['appdata']=_0x3509fe(_0x46415f,_0x2a37ab[_0xfe91('0x49')]);_0x2a37ab['priority']=_0x25b401[_0xfe91('0x24')]?_[_0xfe91('0x4a')](_0x25b401)[_0xfe91('0x4b')]+0x1:_0x376095;_0x37a26e=_['concat'](_0x37a26e,_0x25b401,[_0x2a37ab],_0x335108);_0x376095=_['last'](_0x37a26e)['priority']+0x1;}return _0x498178(_0x37a26e);})[_0xfe91('0x4c')](function(_0x5e376f){_0x7e59b6(_0x5e376f);});});}return _0x45e044[_0xfe91('0x4d')](_0xfe91('0x4e'),attributes,{'tableName':_0xfe91('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x36af4d){var _0xbc287a=this[_0xfe91('0x50')]({'plain':!![]});var _0x1af6b5=_0xbc287a[_0xfe91('0x3')]===_0xfe91('0x11')?_0x44c3af(_0xbc287a):_0x219329(_0xbc287a);return _0x356ef5(_0xbc287a,_0x36af4d,_[_0xfe91('0x4a')](_0x1af6b5)['priority']+0x1)['then'](function(_0xb90ef){var _0x1945a5=_[_0xfe91('0x51')](_0x1af6b5,_0xb90ef);_0x1945a5[_0xfe91('0x9')]({'type':_0xbc287a[_0xfe91('0x3')],'app':'Hangup','exten':_0xbc287a['exten'],'context':_0xbc287a['context'],'priority':_[_0xfe91('0x4a')](_0x1945a5)[_0xfe91('0x4b')]+0x1,'VoiceExtensionId':_0xbc287a['id']});return _0x1945a5;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index e3f7b34..8ae2abc 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 _0x5655=['http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceExtension','VoiceExtension','options','where','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1bf288,_0x67803e){var _0x257f24=function(_0x3e81fe){while(--_0x3e81fe){_0x1bf288['push'](_0x1bf288['shift']());}};_0x257f24(++_0x67803e);}(_0x5655,0x15e));var _0x5565=function(_0x9c54bb,_0x34fd27){_0x9c54bb=_0x9c54bb-0x0;var _0x443656=_0x5655[_0x9c54bb];return _0x443656;};'use strict';var _=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var moment=require(_0x5565('0x2'));var BPromise=require(_0x5565('0x3'));var rs=require(_0x5565('0x4'));var fs=require('fs');var Redis=require(_0x5565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5565('0x6'))('rpc');var config=require(_0x5565('0x7'));var jayson=require(_0x5565('0x8'));var client=jayson[_0x5565('0x9')][_0x5565('0xa')]({'port':0x232a});config[_0x5565('0xb')]=_['defaults'](config[_0x5565('0xb')],{'host':_0x5565('0xc'),'port':0x18eb});var socket=require(_0x5565('0xd'))(new Redis(config[_0x5565('0xb')]));require(_0x5565('0xe'))[_0x5565('0xf')](socket);function respondWithRpcPromise(_0x4ac5e3,_0x581dca,_0x367ce8){return new BPromise(function(_0x52db0e,_0x498370){return client[_0x5565('0x10')](_0x4ac5e3,_0x367ce8)[_0x5565('0x11')](function(_0x5d0d99){logger['info'](_0x5565('0x12'),_0x581dca,_0x5565('0x13'));logger[_0x5565('0x14')](_0x5565('0x15'),_0x581dca,_0x5565('0x13'),JSON[_0x5565('0x16')](_0x5d0d99));if(_0x5d0d99[_0x5565('0x17')]){if(_0x5d0d99[_0x5565('0x17')]['code']===0x1f4){logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x498370(_0x5d0d99['error'][_0x5565('0x18')]);}logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x52db0e(_0x5d0d99['error']['message']);}else{logger[_0x5565('0x19')](_0x5565('0x12'),_0x581dca,'request\x20sent');_0x52db0e(_0x5d0d99[_0x5565('0x1a')][_0x5565('0x18')]);}})[_0x5565('0x1b')](function(_0x5712ad){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x581dca,_0x5712ad);_0x498370(_0x5712ad);});});}exports[_0x5565('0x1c')]=function(_0x336edb){var _0x6486f3=this;return new Promise(function(_0xb6e20c,_0x183e20){return db[_0x5565('0x1d')]['findAll']({'raw':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')][_0x5565('0x1f')]||null:null,'attributes':_0x336edb['options']?_0x336edb[_0x5565('0x1e')]['attributes']||null:null,'limit':_0x336edb[_0x5565('0x1e')]?_0x336edb[_0x5565('0x1e')]['limit']||null:null,'include':_0x336edb['options']?_0x336edb[_0x5565('0x1e')][_0x5565('0x20')]?_[_0x5565('0x21')](_0x336edb['options']['include'],function(_0x28aa02){return{'model':db[_0x28aa02[_0x5565('0x22')]],'as':_0x28aa02['as'],'attributes':_0x28aa02['attributes'],'include':_0x28aa02[_0x5565('0x20')]?_[_0x5565('0x21')](_0x28aa02['include'],function(_0x2c4dee){return{'model':db[_0x2c4dee['model']],'as':_0x2c4dee['as'],'attributes':_0x2c4dee[_0x5565('0x23')],'include':_0x2c4dee[_0x5565('0x20')]?_[_0x5565('0x21')](_0x2c4dee[_0x5565('0x20')],function(_0x8d4988){return{'model':db[_0x8d4988[_0x5565('0x22')]],'as':_0x8d4988['as'],'attributes':_0x8d4988[_0x5565('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5565('0x11')](function(_0x7e9c06){logger['info'](_0x5565('0x1c'),_0x336edb);logger['debug']('GetVoiceExtension',_0x336edb,JSON[_0x5565('0x16')](_0x7e9c06));_0xb6e20c(_0x7e9c06);})['catch'](function(_0x37925a){logger[_0x5565('0x17')](_0x5565('0x1c'),_0x37925a['message'],_0x336edb);_0x183e20(_0x6486f3['error'](0x1f4,_0x37925a[_0x5565('0x18')]));});});}; \ No newline at end of file +var _0x496e=['findAll','options','raw','where','attributes','limit','include','map','model','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceExtension'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x496e,0x1a0));var _0xe496=function(_0x2931f4,_0x39812d){_0x2931f4=_0x2931f4-0x0;var _0x1cd2ba=_0x496e[_0x2931f4];return _0x1cd2ba;};'use strict';var _=require('lodash');var util=require(_0xe496('0x0'));var moment=require(_0xe496('0x1'));var BPromise=require(_0xe496('0x2'));var rs=require(_0xe496('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe496('0x4'))('rpc');var config=require(_0xe496('0x5'));var jayson=require(_0xe496('0x6'));var client=jayson[_0xe496('0x7')][_0xe496('0x8')]({'port':0x232a});config[_0xe496('0x9')]=_[_0xe496('0xa')](config[_0xe496('0x9')],{'host':_0xe496('0xb'),'port':0x18eb});var socket=require(_0xe496('0xc'))(new Redis(config[_0xe496('0x9')]));require(_0xe496('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a4caa,_0x37c55b,_0x5ca4d4){return new BPromise(function(_0x2e679b,_0x44936f){return client[_0xe496('0xe')](_0x4a4caa,_0x5ca4d4)[_0xe496('0xf')](function(_0x19d4fa){logger[_0xe496('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x37c55b,'request\x20sent');logger[_0xe496('0x11')](_0xe496('0x12'),_0x37c55b,'request\x20sent',JSON[_0xe496('0x13')](_0x19d4fa));if(_0x19d4fa[_0xe496('0x14')]){if(_0x19d4fa[_0xe496('0x14')][_0xe496('0x15')]===0x1f4){logger['error'](_0xe496('0x16'),_0x37c55b,_0x19d4fa['error'][_0xe496('0x17')]);return _0x44936f(_0x19d4fa['error'][_0xe496('0x17')]);}logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x19d4fa[_0xe496('0x14')]['message']);return _0x2e679b(_0x19d4fa[_0xe496('0x14')][_0xe496('0x17')]);}else{logger['info'](_0xe496('0x16'),_0x37c55b,_0xe496('0x18'));_0x2e679b(_0x19d4fa[_0xe496('0x19')][_0xe496('0x17')]);}})[_0xe496('0x1a')](function(_0x25e42d){logger[_0xe496('0x14')](_0xe496('0x16'),_0x37c55b,_0x25e42d);_0x44936f(_0x25e42d);});});}exports[_0xe496('0x1b')]=function(_0x1993cd){var _0x2f9856=this;return new Promise(function(_0x3f6436,_0x30927d){return db['VoiceExtension'][_0xe496('0x1c')]({'raw':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x1e')]===undefined?!![]:![]:!![],'where':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x1f')]||null:null,'attributes':_0x1993cd[_0xe496('0x1d')]?_0x1993cd['options'][_0xe496('0x20')]||null:null,'limit':_0x1993cd['options']?_0x1993cd['options'][_0xe496('0x21')]||null:null,'include':_0x1993cd[_0xe496('0x1d')]?_0x1993cd[_0xe496('0x1d')][_0xe496('0x22')]?_[_0xe496('0x23')](_0x1993cd['options'][_0xe496('0x22')],function(_0x2d122e){return{'model':db[_0x2d122e[_0xe496('0x24')]],'as':_0x2d122e['as'],'attributes':_0x2d122e['attributes'],'include':_0x2d122e[_0xe496('0x22')]?_[_0xe496('0x23')](_0x2d122e[_0xe496('0x22')],function(_0x57dc9d){return{'model':db[_0x57dc9d[_0xe496('0x24')]],'as':_0x57dc9d['as'],'attributes':_0x57dc9d[_0xe496('0x20')],'include':_0x57dc9d[_0xe496('0x22')]?_[_0xe496('0x23')](_0x57dc9d[_0xe496('0x22')],function(_0x2c6ee6){return{'model':db[_0x2c6ee6[_0xe496('0x24')]],'as':_0x2c6ee6['as'],'attributes':_0x2c6ee6[_0xe496('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe496('0xf')](function(_0x1a7c5e){logger[_0xe496('0x10')](_0xe496('0x1b'),_0x1993cd);logger['debug'](_0xe496('0x1b'),_0x1993cd,JSON[_0xe496('0x13')](_0x1a7c5e));_0x3f6436(_0x1a7c5e);})[_0xe496('0x1a')](function(_0x3fa5bc){logger[_0xe496('0x14')](_0xe496('0x1b'),_0x3fa5bc['message'],_0x1993cd);_0x30927d(_0x2f9856[_0xe496('0x14')](0x1f4,_0x3fa5bc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 01358b0..4d4e8ee 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x814b,0x1a2));var _0xb814=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0x814b[_0x2498b5];return _0x5c48d8;};'use strict';var VoiceExtensionEvents=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(){VoiceExtensionEvents[_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);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0xc4aa=['remove','update','removeListener','register','length','./voiceExtension.events','save'];(function(_0x173045,_0xc23934){var _0x3627ca=function(_0x5e69bc){while(--_0x5e69bc){_0x173045['push'](_0x173045['shift']());}};_0x3627ca(++_0xc23934);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var VoiceExtensionEvents=require(_0xac4a('0x0'));var events=[_0xac4a('0x1'),_0xac4a('0x2'),_0xac4a('0x3')];function createListener(_0x275161,_0x22469d){return function(_0x58634e){_0x22469d['emit'](_0x275161,_0x58634e);};}function removeListener(_0x47d4f6,_0x2f48ed){return function(){VoiceExtensionEvents[_0xac4a('0x4')](_0x47d4f6,_0x2f48ed);};}exports[_0xac4a('0x5')]=function(_0x215f39){for(var _0x96be2b=0x0,_0x15cd34=events[_0xac4a('0x6')];_0x96be2b<_0x15cd34;_0x96be2b++){var _0x10525b=events[_0x96be2b];var _0x5c6179=createListener('voiceExtension:'+_0x10525b,_0x215f39);VoiceExtensionEvents['on'](_0x10525b,_0x5c6179);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f149237..82397ad 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 _0xe5af=['show','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x40e06d,_0x58ca1b){var _0xa3f497=function(_0x487b0f){while(--_0x487b0f){_0x40e06d['push'](_0x40e06d['shift']());}};_0xa3f497(++_0x58ca1b);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2b51a3,_0xc9bd05){_0x2b51a3=_0x2b51a3-0x0;var _0x567758=_0xe5af[_0x2b51a3];return _0x567758;};'use strict';var multer=require('multer');var util=require(_0xfe5a('0x0'));var path=require(_0xfe5a('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe5a('0x2'));var router=express[_0xfe5a('0x3')]();var fs_extra=require(_0xfe5a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfe5a('0x5'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0xfe5a('0x6')]('/',auth[_0xfe5a('0x7')](),controller['index']);router['get'](_0xfe5a('0x8'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0x9')]);router[_0xfe5a('0x6')]('/:id/messages',auth[_0xfe5a('0x7')](),controller['getMessages']);router['post']('/',auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xa')]);router['put'](_0xfe5a('0x8'),auth[_0xfe5a('0x7')](),controller[_0xfe5a('0xb')]);router[_0xfe5a('0xc')](_0xfe5a('0x8'),auth['isAuthenticated'](),controller[_0xfe5a('0xd')]);module[_0xfe5a('0xe')]=router; \ No newline at end of file +var _0x7bd0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2ece62,_0x273d1d){var _0x2b64ff=function(_0x250364){while(--_0x250364){_0x2ece62['push'](_0x2ece62['shift']());}};_0x2b64ff(++_0x273d1d);}(_0x7bd0,0x111));var _0x07bd=function(_0x266ddc,_0x45aa52){_0x266ddc=_0x266ddc-0x0;var _0x39c1d7=_0x7bd0[_0x266ddc];return _0x39c1d7;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);router[_0x07bd('0x14')](_0x07bd('0xd'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);module[_0x07bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index abcd354..c9f03d1 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 _0xa66c=['ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail','contest_mailbox','email','trim','central'];(function(_0x522b1d,_0x232dd5){var _0x4b9f9e=function(_0x5ad1af){while(--_0x5ad1af){_0x522b1d['push'](_0x522b1d['shift']());}};_0x4b9f9e(++_0x232dd5);}(_0xa66c,0xd9));var _0xca66=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa66c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xca66('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xca66('0x1')],'defaultValue':_0xca66('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xca66('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xca66('0x1')]},'email':{'type':Sequelize[_0xca66('0x1')],'validate':{'isEmail':!![]},'set':function(_0xae449c){this['setDataValue'](_0xca66('0x4'),typeof _0xae449c==='string'&&_0xae449c['trim']()?_0xae449c[_0xca66('0x5')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xca66('0x1')],'defaultValue':_0xca66('0x6')},'attach':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':_0xca66('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xca66('0x8'),'no'),'defaultValue':_0xca66('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xca66('0x1')]},'callback':{'type':Sequelize[_0xca66('0x1')]},'review':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xca66('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':_0xca66('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xca66('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xca66('0x7')](_0xca66('0x8'),'no'),'defaultValue':_0xca66('0x8'),'allowNull':![]},'stamp':{'type':_0xca66('0xa')},'emailsubject':{'type':Sequelize[_0xca66('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xca66('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xca66('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xca66('0xc')],'get':function(){return this[_0xca66('0xd')](_0xca66('0xe'))+_0xca66('0xf')+this[_0xca66('0xd')]('mailbox');}}}; \ No newline at end of file +var _0xa31b=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x2523e8,_0x13087e){var _0x42b2fb=function(_0x53d4b3){while(--_0x53d4b3){_0x2523e8['push'](_0x2523e8['shift']());}};_0x42b2fb(++_0x13087e);}(_0xa31b,0x164));var _0xba31=function(_0x14e414,_0x460033){_0x14e414=_0x14e414-0x0;var _0x19991b=_0xa31b[_0x14e414];return _0x19991b;};'use strict';var Sequelize=require(_0xba31('0x0'));module[_0xba31('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xba31('0x2')],'defaultValue':_0xba31('0x3'),'unique':_0xba31('0x4')},'mailbox':{'type':Sequelize[_0xba31('0x2')],'defaultValue':'','allowNull':![],'unique':_0xba31('0x4')},'password':{'type':Sequelize[_0xba31('0x2')]},'fullname':{'type':Sequelize[_0xba31('0x2')]},'email':{'type':Sequelize[_0xba31('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2becf2){this[_0xba31('0x5')](_0xba31('0x6'),typeof _0x2becf2===_0xba31('0x7')&&_0x2becf2['trim']()?_0x2becf2[_0xba31('0x8')]():null);}},'pager':{'type':Sequelize[_0xba31('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xba31('0x9')},'attach':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':_0xba31('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0xba31('0xa')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xba31('0x2')]},'callback':{'type':Sequelize[_0xba31('0x2')]},'review':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xba31('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xba31('0xa')]('yes','no'),'defaultValue':_0xba31('0xb'),'allowNull':![]},'forcename':{'type':Sequelize[_0xba31('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xba31('0xa')](_0xba31('0xb'),'no'),'defaultValue':_0xba31('0xb'),'allowNull':![]},'stamp':{'type':_0xba31('0xd')},'emailsubject':{'type':Sequelize[_0xba31('0x2')]},'emailbody':{'type':Sequelize[_0xba31('0x2')]},'maxsecs':{'type':Sequelize[_0xba31('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xba31('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xba31('0xf')],'get':function(){return this[_0xba31('0x10')](_0xba31('0x11'))+'\x20-\x20'+this['getDataValue'](_0xba31('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3eb9ad8..2252b3e 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 _0xb9a7=['model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','VoiceMail','includeAll','include','findAll','rows','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','body','findOne','VoiceMailMessage','rawAttributes','nolimit','findAndCountAll','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','fieldName','type'];(function(_0x544b08,_0x2bc78b){var _0x506635=function(_0x6f957d){while(--_0x6f957d){_0x544b08['push'](_0x544b08['shift']());}};_0x506635(++_0x2bc78b);}(_0xb9a7,0x112));var _0x7b9a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xb9a7[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b9a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b9a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x7b9a('0x2'));var util=require(_0x7b9a('0x3'));var path=require(_0x7b9a('0x4'));var sox=require(_0x7b9a('0x5'));var csv=require(_0x7b9a('0x6'));var ejs=require(_0x7b9a('0x7'));var fs=require('fs');var fs_extra=require(_0x7b9a('0x8'));var _=require(_0x7b9a('0x9'));var squel=require(_0x7b9a('0xa'));var crypto=require(_0x7b9a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7b9a('0xc'));var toCsv=require(_0x7b9a('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7b9a('0xd'));var qs=require(_0x7b9a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b9a('0xf'));var logger=require('../../config/logger')(_0x7b9a('0x10'));var utils=require('../../config/utils');var config=require(_0x7b9a('0x11'));var licenseUtil=require(_0x7b9a('0x12'));var db=require(_0x7b9a('0x13'))['db'];function respondWithStatusCode(_0x5948ca,_0x32f616){_0x32f616=_0x32f616||0xcc;return function(_0xec5949){if(_0xec5949){return _0x5948ca['sendStatus'](_0x32f616);}return _0x5948ca[_0x7b9a('0x14')](_0x32f616)[_0x7b9a('0x15')]();};}function respondWithResult(_0x4b7ec0,_0xb157e5){_0xb157e5=_0xb157e5||0xc8;return function(_0xde180d){if(_0xde180d){return _0x4b7ec0[_0x7b9a('0x14')](_0xb157e5)[_0x7b9a('0x16')](_0xde180d);}};}function respondWithFilteredResult(_0x344fa7,_0x346daa){return function(_0x22a7e4){if(_0x22a7e4){var _0x35e602=typeof _0x346daa[_0x7b9a('0x17')]==='undefined'&&typeof _0x346daa[_0x7b9a('0x18')]==='undefined';var _0x123921=_0x22a7e4[_0x7b9a('0x19')];var _0x271263=_0x35e602?0x0:_0x346daa[_0x7b9a('0x17')];var _0x44a232=_0x35e602?_0x22a7e4[_0x7b9a('0x19')]:_0x346daa[_0x7b9a('0x17')]+_0x346daa[_0x7b9a('0x18')];var _0x2064a0;if(_0x44a232>=_0x123921){_0x44a232=_0x123921;_0x2064a0=0xc8;}else{_0x2064a0=0xce;}_0x344fa7[_0x7b9a('0x14')](_0x2064a0);return _0x344fa7[_0x7b9a('0x1a')](_0x7b9a('0x1b'),_0x271263+'-'+_0x44a232+'/'+_0x123921)[_0x7b9a('0x16')](_0x22a7e4);}return null;};}function patchUpdates(_0x58aed7){return function(_0x993048){try{jsonpatch['apply'](_0x993048,_0x58aed7,!![]);}catch(_0x1eacbc){return BPromise['reject'](_0x1eacbc);}return _0x993048[_0x7b9a('0x1c')]();};}function saveUpdates(_0x331ae6,_0x23d812){return function(_0x54fda7){if(_0x54fda7){return _0x54fda7[_0x7b9a('0x1d')](_0x331ae6)[_0x7b9a('0x1e')](function(_0x5705b2){return _0x5705b2;});}return null;};}function removeEntity(_0x35aca7,_0x374dca){return function(_0x269c07){if(_0x269c07){return _0x269c07[_0x7b9a('0x1f')]()[_0x7b9a('0x1e')](function(){var _0x5b2f52=_0x269c07[_0x7b9a('0x20')]({'plain':!![]});var _0x23219e='Voicemails';return db[_0x7b9a('0x21')]['destroy']({'where':{'type':_0x23219e,'resourceId':_0x5b2f52['id']}})[_0x7b9a('0x1e')](function(){return _0x269c07;});})[_0x7b9a('0x1e')](function(){_0x35aca7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d886,_0x55301c){return function(_0x54df8a){if(!_0x54df8a){_0x24d886[_0x7b9a('0x22')](0x194);}return _0x54df8a;};}function handleError(_0x58fec8,_0x5be740){_0x5be740=_0x5be740||0x1f4;return function(_0x3847b4){logger['error'](_0x3847b4[_0x7b9a('0x23')]);if(_0x3847b4[_0x7b9a('0x24')]){delete _0x3847b4['name'];}_0x58fec8[_0x7b9a('0x14')](_0x5be740)[_0x7b9a('0x25')](_0x3847b4);};}exports[_0x7b9a('0x26')]=function(_0x5b64d7,_0x45ccf5){var _0x2ce78b={},_0x181e9c={},_0x6c8b1f={'count':0x0,'rows':[]};var _0x5028e7=_[_0x7b9a('0x27')](db['VoiceMail']['rawAttributes'],function(_0x2d278e){return{'name':_0x2d278e[_0x7b9a('0x28')],'type':_0x2d278e[_0x7b9a('0x29')]['key']};});_0x181e9c[_0x7b9a('0x2a')]=_[_0x7b9a('0x27')](_0x5028e7,'name');_0x181e9c['query']=_[_0x7b9a('0x2b')](_0x5b64d7[_0x7b9a('0x2c')]);_0x181e9c['filters']=_[_0x7b9a('0x2d')](_0x181e9c[_0x7b9a('0x2a')],_0x181e9c[_0x7b9a('0x2c')]);_0x2ce78b[_0x7b9a('0x2e')]=_[_0x7b9a('0x2d')](_0x181e9c['model'],qs[_0x7b9a('0x2f')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x2ce78b[_0x7b9a('0x2e')]=_0x2ce78b[_0x7b9a('0x2e')][_0x7b9a('0x30')]?_0x2ce78b['attributes']:_0x181e9c['model'];if(!_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x31')]('nolimit')){_0x2ce78b[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x5b64d7[_0x7b9a('0x2c')]['limit']);_0x2ce78b[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x5b64d7['query']['offset']);}_0x2ce78b[_0x7b9a('0x32')]=qs[_0x7b9a('0x33')](_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x33')]);_0x2ce78b[_0x7b9a('0x34')]=qs[_0x7b9a('0x35')](_[_0x7b9a('0x36')](_0x5b64d7[_0x7b9a('0x2c')],_0x181e9c['filters']),_0x5028e7);if(_0x5b64d7[_0x7b9a('0x2c')]['filter']){_0x2ce78b[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x2ce78b[_0x7b9a('0x34')],{'$or':_[_0x7b9a('0x27')](_0x5028e7,function(_0x3fa4cd){if(_0x3fa4cd[_0x7b9a('0x29')]!=='VIRTUAL'){var _0x34eebe={};_0x34eebe[_0x3fa4cd[_0x7b9a('0x24')]]={'$like':'%'+_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x38')]+'%'};return _0x34eebe;}})});}_0x2ce78b=_['merge']({},_0x2ce78b,_0x5b64d7[_0x7b9a('0x39')]);var _0xf86939={'where':_0x2ce78b[_0x7b9a('0x34')]};return db[_0x7b9a('0x3a')]['count'](_0xf86939)[_0x7b9a('0x1e')](function(_0x53d89a){_0x6c8b1f[_0x7b9a('0x19')]=_0x53d89a;if(_0x5b64d7[_0x7b9a('0x2c')][_0x7b9a('0x3b')]){_0x2ce78b[_0x7b9a('0x3c')]=[{'all':!![]}];}return db[_0x7b9a('0x3a')][_0x7b9a('0x3d')](_0x2ce78b);})['then'](function(_0x33edc6){_0x6c8b1f[_0x7b9a('0x3e')]=_0x33edc6;return _0x6c8b1f;})[_0x7b9a('0x1e')](respondWithFilteredResult(_0x45ccf5,_0x2ce78b))['catch'](handleError(_0x45ccf5,null));};exports['show']=function(_0x3724fe,_0x454b35){var _0x995d59={'raw':!![],'where':{'id':_0x3724fe[_0x7b9a('0x3f')]['id']}},_0x5cd3dd={};_0x5cd3dd[_0x7b9a('0x2a')]=_['keys'](db['VoiceMail']['rawAttributes']);_0x5cd3dd[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x3724fe['query']);_0x5cd3dd[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0x5cd3dd[_0x7b9a('0x2a')],_0x5cd3dd['query']);_0x995d59[_0x7b9a('0x2e')]=_['intersection'](_0x5cd3dd[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x3724fe[_0x7b9a('0x2c')][_0x7b9a('0x2f')]));_0x995d59[_0x7b9a('0x2e')]=_0x995d59['attributes'][_0x7b9a('0x30')]?_0x995d59['attributes']:_0x5cd3dd[_0x7b9a('0x2a')];if(_0x3724fe['query']['includeAll']){_0x995d59[_0x7b9a('0x3c')]=[{'all':!![]}];}_0x995d59=_[_0x7b9a('0x37')]({},_0x995d59,_0x3724fe[_0x7b9a('0x39')]);return db[_0x7b9a('0x3a')][_0x7b9a('0x40')](_0x995d59)[_0x7b9a('0x1e')](handleEntityNotFound(_0x454b35,null))[_0x7b9a('0x1e')](respondWithResult(_0x454b35,null))[_0x7b9a('0x41')](handleError(_0x454b35,null));};exports[_0x7b9a('0x42')]=function(_0x5088c7,_0x1d7957){return db[_0x7b9a('0x3a')]['create'](_0x5088c7['body'],{})['then'](function(_0x1b3e65){var _0x30296e=_0x5088c7[_0x7b9a('0x43')][_0x7b9a('0x20')]({'plain':!![]});if(!_0x30296e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30296e[_0x7b9a('0x44')]===_0x7b9a('0x43')){var _0x287dea=_0x1b3e65[_0x7b9a('0x20')]({'plain':!![]});var _0x2d083b='Voicemails';return db[_0x7b9a('0x45')]['find']({'where':{'name':_0x2d083b,'userProfileId':_0x30296e[_0x7b9a('0x46')]},'raw':!![]})[_0x7b9a('0x1e')](function(_0x239146){if(_0x239146&&_0x239146[_0x7b9a('0x47')]===0x0){return db['UserProfileResource'][_0x7b9a('0x42')]({'name':_0x287dea[_0x7b9a('0x24')],'resourceId':_0x287dea['id'],'type':_0x239146[_0x7b9a('0x24')],'sectionId':_0x239146['id']},{})[_0x7b9a('0x1e')](function(){return _0x1b3e65;});}else{return _0x1b3e65;}})[_0x7b9a('0x41')](function(_0x3e2f1b){logger[_0x7b9a('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2f1b);throw _0x3e2f1b;});}return _0x1b3e65;})['then'](respondWithResult(_0x1d7957,0xc9))['catch'](handleError(_0x1d7957,null));};exports[_0x7b9a('0x1d')]=function(_0x2f8929,_0x5a1b7d){if(_0x2f8929['body']['id']){delete _0x2f8929['body']['id'];}return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x2f8929[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x5a1b7d,null))[_0x7b9a('0x1e')](saveUpdates(_0x2f8929[_0x7b9a('0x49')],null))[_0x7b9a('0x1e')](respondWithResult(_0x5a1b7d,null))[_0x7b9a('0x41')](handleError(_0x5a1b7d,null));};exports[_0x7b9a('0x1f')]=function(_0x5dc17e,_0x1f99f5){return db['VoiceMail'][_0x7b9a('0x40')]({'where':{'id':_0x5dc17e[_0x7b9a('0x3f')]['id']}})[_0x7b9a('0x1e')](handleEntityNotFound(_0x1f99f5,null))[_0x7b9a('0x1e')](removeEntity(_0x1f99f5,null))[_0x7b9a('0x41')](handleError(_0x1f99f5,null));};exports['getMessages']=function(_0x25ec82,_0x491804,_0x3d2df4){return db[_0x7b9a('0x3a')][_0x7b9a('0x4a')]({'where':{'id':_0x25ec82['params']['id']}})['then'](handleEntityNotFound(_0x491804,null))['then'](function(_0x4f6843){var _0x33375c;var _0x8a777f={},_0xb91099={};_0xb91099['model']=_[_0x7b9a('0x2b')](db[_0x7b9a('0x4b')][_0x7b9a('0x4c')]);_0xb91099[_0x7b9a('0x2c')]=_[_0x7b9a('0x2b')](_0x25ec82['query']);_0xb91099[_0x7b9a('0x35')]=_[_0x7b9a('0x2d')](_0xb91099[_0x7b9a('0x2a')],_0xb91099['query']);_0x8a777f['attributes']=_['intersection'](_0xb91099[_0x7b9a('0x2a')],qs[_0x7b9a('0x2f')](_0x25ec82[_0x7b9a('0x2c')]['fields']));_0x8a777f[_0x7b9a('0x2e')]=_0x8a777f[_0x7b9a('0x2e')]['length']?_0x8a777f[_0x7b9a('0x2e')]:_0xb91099['model'];if(!_0x25ec82[_0x7b9a('0x2c')]['hasOwnProperty'](_0x7b9a('0x4d'))){_0x8a777f[_0x7b9a('0x18')]=qs[_0x7b9a('0x18')](_0x25ec82[_0x7b9a('0x2c')]['limit']);_0x8a777f[_0x7b9a('0x17')]=qs[_0x7b9a('0x17')](_0x25ec82[_0x7b9a('0x2c')][_0x7b9a('0x17')]);}_0x8a777f['order']=qs[_0x7b9a('0x33')](_0x25ec82['query'][_0x7b9a('0x33')]);_0x8a777f['where']=qs[_0x7b9a('0x35')](_['pick'](_0x25ec82['query'],_0xb91099['filters']));if(_0x25ec82['query'][_0x7b9a('0x38')]){_0x8a777f[_0x7b9a('0x34')]=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'$or':_['map'](_0x8a777f[_0x7b9a('0x2e')],function(_0x4b9462){var _0x50b6f1={};_0x50b6f1[_0x4b9462]={'$like':'%'+_0x25ec82[_0x7b9a('0x2c')]['filter']+'%'};return _0x50b6f1;})});}_0x8a777f['where']=_[_0x7b9a('0x37')](_0x8a777f[_0x7b9a('0x34')],{'mailboxuser':_0x4f6843['mailbox']});_0x8a777f=_[_0x7b9a('0x37')]({},_0x8a777f,_0x25ec82['options']);return db[_0x7b9a('0x4b')][_0x7b9a('0x4e')](_0x8a777f)[_0x7b9a('0x1e')](respondWithFilteredResult(_0x491804,_0x8a777f));})['catch'](handleError(_0x491804,null));}; \ No newline at end of file +var _0xd914=['limit','order','sort','where','filters','pick','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','params','merge','find','create','body','get','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','filter','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','Voicemails','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x10e5a4,_0x5b0dfc){var _0x1769e5=function(_0x23cd5f){while(--_0x23cd5f){_0x10e5a4['push'](_0x10e5a4['shift']());}};_0x1769e5(++_0x5b0dfc);}(_0xd914,0x17f));var _0x4d91=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xd914[_0x56f7e2];return _0x36240b;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];function respondWithStatusCode(_0x1c15b7,_0x318e0c){_0x318e0c=_0x318e0c||0xcc;return function(_0x4ea591){if(_0x4ea591){return _0x1c15b7['sendStatus'](_0x318e0c);}return _0x1c15b7[_0x4d91('0x1b')](_0x318e0c)[_0x4d91('0x1c')]();};}function respondWithResult(_0xb6590d,_0x3c9fd6){_0x3c9fd6=_0x3c9fd6||0xc8;return function(_0x33fbd4){if(_0x33fbd4){return _0xb6590d[_0x4d91('0x1b')](_0x3c9fd6)[_0x4d91('0x1d')](_0x33fbd4);}};}function respondWithFilteredResult(_0x4f5aef,_0x3a8ec9){return function(_0x42631a){if(_0x42631a){var _0x1e2ef7=typeof _0x3a8ec9[_0x4d91('0x1e')]===_0x4d91('0x1f')&&typeof _0x3a8ec9['limit']===_0x4d91('0x1f');var _0xb75abf=_0x42631a[_0x4d91('0x20')];var _0x44b9a7=_0x1e2ef7?0x0:_0x3a8ec9['offset'];var _0x350e23=_0x1e2ef7?_0x42631a[_0x4d91('0x20')]:_0x3a8ec9[_0x4d91('0x1e')]+_0x3a8ec9['limit'];var _0x13ef2c;if(_0x350e23>=_0xb75abf){_0x350e23=_0xb75abf;_0x13ef2c=0xc8;}else{_0x13ef2c=0xce;}_0x4f5aef[_0x4d91('0x1b')](_0x13ef2c);return _0x4f5aef[_0x4d91('0x21')](_0x4d91('0x22'),_0x44b9a7+'-'+_0x350e23+'/'+_0xb75abf)[_0x4d91('0x1d')](_0x42631a);}return null;};}function patchUpdates(_0x40cde4){return function(_0xc1d44f){try{jsonpatch[_0x4d91('0x23')](_0xc1d44f,_0x40cde4,!![]);}catch(_0x30d911){return BPromise[_0x4d91('0x24')](_0x30d911);}return _0xc1d44f['save']();};}function saveUpdates(_0x4493da,_0x5f5236){return function(_0x57913e){if(_0x57913e){return _0x57913e[_0x4d91('0x25')](_0x4493da)[_0x4d91('0x26')](function(_0x341d18){return _0x341d18;});}return null;};}function removeEntity(_0x9cb864,_0x7d8cbf){return function(_0x12b722){if(_0x12b722){return _0x12b722[_0x4d91('0x27')]()[_0x4d91('0x26')](function(){var _0x55356b=_0x12b722['get']({'plain':!![]});var _0x1ee6b3=_0x4d91('0x28');return db[_0x4d91('0x29')][_0x4d91('0x27')]({'where':{'type':_0x1ee6b3,'resourceId':_0x55356b['id']}})[_0x4d91('0x26')](function(){return _0x12b722;});})[_0x4d91('0x26')](function(){_0x9cb864[_0x4d91('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc353,_0xda9802){return function(_0x12ac74){if(!_0x12ac74){_0x3dc353['sendStatus'](0x194);}return _0x12ac74;};}function handleError(_0x480a56,_0x299f27){_0x299f27=_0x299f27||0x1f4;return function(_0x470079){logger['error'](_0x470079['stack']);if(_0x470079[_0x4d91('0x2a')]){delete _0x470079[_0x4d91('0x2a')];}_0x480a56[_0x4d91('0x1b')](_0x299f27)[_0x4d91('0x2b')](_0x470079);};}exports['index']=function(_0x2587a1,_0x31bbf8){var _0x468e95={},_0xee7535={},_0xa63422={'count':0x0,'rows':[]};var _0x3466f3=_[_0x4d91('0x2c')](db['VoiceMail'][_0x4d91('0x2d')],function(_0x4f44ff){return{'name':_0x4f44ff['fieldName'],'type':_0x4f44ff[_0x4d91('0x2e')][_0x4d91('0x2f')]};});_0xee7535['model']=_[_0x4d91('0x2c')](_0x3466f3,_0x4d91('0x2a'));_0xee7535[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x2587a1[_0x4d91('0x30')]);_0xee7535['filters']=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],_0xee7535[_0x4d91('0x30')]);_0x468e95[_0x4d91('0x34')]=_[_0x4d91('0x32')](_0xee7535[_0x4d91('0x33')],qs['fields'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x35')]));_0x468e95['attributes']=_0x468e95[_0x4d91('0x34')][_0x4d91('0x36')]?_0x468e95[_0x4d91('0x34')]:_0xee7535['model'];if(!_0x2587a1[_0x4d91('0x30')][_0x4d91('0x37')](_0x4d91('0x38'))){_0x468e95[_0x4d91('0x39')]=qs['limit'](_0x2587a1[_0x4d91('0x30')][_0x4d91('0x39')]);_0x468e95[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x2587a1['query']['offset']);}_0x468e95[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x2587a1['query'][_0x4d91('0x3b')]);_0x468e95[_0x4d91('0x3c')]=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x2587a1['query'],_0xee7535[_0x4d91('0x3d')]),_0x3466f3);if(_0x2587a1[_0x4d91('0x30')]['filter']){_0x468e95[_0x4d91('0x3c')]=_['merge'](_0x468e95[_0x4d91('0x3c')],{'$or':_['map'](_0x3466f3,function(_0x2dc892){if(_0x2dc892['type']!==_0x4d91('0x3f')){var _0x2782d2={};_0x2782d2[_0x2dc892[_0x4d91('0x2a')]]={'$like':'%'+_0x2587a1[_0x4d91('0x30')]['filter']+'%'};return _0x2782d2;}})});}_0x468e95=_['merge']({},_0x468e95,_0x2587a1[_0x4d91('0x40')]);var _0x55c8d0={'where':_0x468e95[_0x4d91('0x3c')]};return db[_0x4d91('0x41')]['count'](_0x55c8d0)[_0x4d91('0x26')](function(_0x2ae356){_0xa63422[_0x4d91('0x20')]=_0x2ae356;if(_0x2587a1[_0x4d91('0x30')][_0x4d91('0x42')]){_0x468e95[_0x4d91('0x43')]=[{'all':!![]}];}return db[_0x4d91('0x41')]['findAll'](_0x468e95);})[_0x4d91('0x26')](function(_0x4c70af){_0xa63422[_0x4d91('0x44')]=_0x4c70af;return _0xa63422;})[_0x4d91('0x26')](respondWithFilteredResult(_0x31bbf8,_0x468e95))[_0x4d91('0x45')](handleError(_0x31bbf8,null));};exports[_0x4d91('0x46')]=function(_0x20ec78,_0x1fc884){var _0x4b8e12={'raw':!![],'where':{'id':_0x20ec78[_0x4d91('0x47')]['id']}},_0x4ffc08={};_0x4ffc08[_0x4d91('0x33')]=_['keys'](db[_0x4d91('0x41')][_0x4d91('0x2d')]);_0x4ffc08[_0x4d91('0x30')]=_[_0x4d91('0x31')](_0x20ec78[_0x4d91('0x30')]);_0x4ffc08[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x4ffc08[_0x4d91('0x33')],_0x4ffc08[_0x4d91('0x30')]);_0x4b8e12['attributes']=_['intersection'](_0x4ffc08[_0x4d91('0x33')],qs['fields'](_0x20ec78[_0x4d91('0x30')][_0x4d91('0x35')]));_0x4b8e12[_0x4d91('0x34')]=_0x4b8e12[_0x4d91('0x34')]['length']?_0x4b8e12[_0x4d91('0x34')]:_0x4ffc08['model'];if(_0x20ec78['query'][_0x4d91('0x42')]){_0x4b8e12[_0x4d91('0x43')]=[{'all':!![]}];}_0x4b8e12=_[_0x4d91('0x48')]({},_0x4b8e12,_0x20ec78[_0x4d91('0x40')]);return db[_0x4d91('0x41')][_0x4d91('0x49')](_0x4b8e12)['then'](handleEntityNotFound(_0x1fc884,null))[_0x4d91('0x26')](respondWithResult(_0x1fc884,null))[_0x4d91('0x45')](handleError(_0x1fc884,null));};exports[_0x4d91('0x4a')]=function(_0x449dd8,_0x106e5b){return db[_0x4d91('0x41')][_0x4d91('0x4a')](_0x449dd8[_0x4d91('0x4b')],{})[_0x4d91('0x26')](function(_0x145dfd){var _0x16f776=_0x449dd8['user'][_0x4d91('0x4c')]({'plain':!![]});if(!_0x16f776)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x16f776[_0x4d91('0x4d')]===_0x4d91('0x4e')){var _0x195e65=_0x145dfd[_0x4d91('0x4c')]({'plain':!![]});var _0x436a3d=_0x4d91('0x28');return db[_0x4d91('0x4f')][_0x4d91('0x49')]({'where':{'name':_0x436a3d,'userProfileId':_0x16f776['userProfileId']},'raw':!![]})[_0x4d91('0x26')](function(_0x43e72c){if(_0x43e72c&&_0x43e72c[_0x4d91('0x50')]===0x0){return db[_0x4d91('0x29')][_0x4d91('0x4a')]({'name':_0x195e65[_0x4d91('0x2a')],'resourceId':_0x195e65['id'],'type':_0x43e72c[_0x4d91('0x2a')],'sectionId':_0x43e72c['id']},{})['then'](function(){return _0x145dfd;});}else{return _0x145dfd;}})[_0x4d91('0x45')](function(_0x2159e4){logger[_0x4d91('0x51')](_0x4d91('0x52'),_0x2159e4);throw _0x2159e4;});}return _0x145dfd;})[_0x4d91('0x26')](respondWithResult(_0x106e5b,0xc9))[_0x4d91('0x45')](handleError(_0x106e5b,null));};exports[_0x4d91('0x25')]=function(_0x4138c5,_0x645923){if(_0x4138c5[_0x4d91('0x4b')]['id']){delete _0x4138c5[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))[_0x4d91('0x26')](saveUpdates(_0x4138c5[_0x4d91('0x4b')],null))['then'](respondWithResult(_0x645923,null))['catch'](handleError(_0x645923,null));};exports['destroy']=function(_0x45cf4e,_0x10c1dd){return db[_0x4d91('0x41')]['find']({'where':{'id':_0x45cf4e[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x10c1dd,null))[_0x4d91('0x26')](removeEntity(_0x10c1dd,null))['catch'](handleError(_0x10c1dd,null));};exports['getMessages']=function(_0x5bc877,_0x75aa6d,_0x26bfde){return db[_0x4d91('0x41')][_0x4d91('0x53')]({'where':{'id':_0x5bc877[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x75aa6d,null))[_0x4d91('0x26')](function(_0x20c0f2){var _0x4d9b87;var _0x563558={},_0x3f4f24={};_0x3f4f24['model']=_[_0x4d91('0x31')](db[_0x4d91('0x54')][_0x4d91('0x2d')]);_0x3f4f24['query']=_[_0x4d91('0x31')](_0x5bc877[_0x4d91('0x30')]);_0x3f4f24[_0x4d91('0x3d')]=_[_0x4d91('0x32')](_0x3f4f24[_0x4d91('0x33')],_0x3f4f24[_0x4d91('0x30')]);_0x563558[_0x4d91('0x34')]=_['intersection'](_0x3f4f24['model'],qs['fields'](_0x5bc877['query'][_0x4d91('0x35')]));_0x563558[_0x4d91('0x34')]=_0x563558[_0x4d91('0x34')]['length']?_0x563558[_0x4d91('0x34')]:_0x3f4f24['model'];if(!_0x5bc877[_0x4d91('0x30')][_0x4d91('0x37')]('nolimit')){_0x563558['limit']=qs[_0x4d91('0x39')](_0x5bc877[_0x4d91('0x30')][_0x4d91('0x39')]);_0x563558[_0x4d91('0x1e')]=qs[_0x4d91('0x1e')](_0x5bc877[_0x4d91('0x30')][_0x4d91('0x1e')]);}_0x563558[_0x4d91('0x3a')]=qs[_0x4d91('0x3b')](_0x5bc877[_0x4d91('0x30')]['sort']);_0x563558['where']=qs[_0x4d91('0x3d')](_[_0x4d91('0x3e')](_0x5bc877[_0x4d91('0x30')],_0x3f4f24[_0x4d91('0x3d')]));if(_0x5bc877[_0x4d91('0x30')][_0x4d91('0x55')]){_0x563558[_0x4d91('0x3c')]=_[_0x4d91('0x48')](_0x563558[_0x4d91('0x3c')],{'$or':_['map'](_0x563558['attributes'],function(_0x515574){var _0x51156f={};_0x51156f[_0x515574]={'$like':'%'+_0x5bc877[_0x4d91('0x30')][_0x4d91('0x55')]+'%'};return _0x51156f;})});}_0x563558[_0x4d91('0x3c')]=_[_0x4d91('0x48')](_0x563558[_0x4d91('0x3c')],{'mailboxuser':_0x20c0f2[_0x4d91('0x56')]});_0x563558=_[_0x4d91('0x48')]({},_0x563558,_0x5bc877[_0x4d91('0x40')]);return db[_0x4d91('0x54')][_0x4d91('0x57')](_0x563558)[_0x4d91('0x26')](respondWithFilteredResult(_0x75aa6d,_0x563558));})[_0x4d91('0x45')](handleError(_0x75aa6d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 97c3489..14bf4f1 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 _0xc68e=['context','lodash','util','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','define','VoiceMail','voice_voicemail'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xc68e,0x1ed));var _0xec68=function(_0x169f31,_0x300a37){_0x169f31=_0x169f31-0x0;var _0x39b6d8=_0xc68e[_0x169f31];return _0x39b6d8;};'use strict';var _=require(_0xec68('0x0'));var util=require(_0xec68('0x1'));var logger=require('../../config/logger')(_0xec68('0x2'));var moment=require(_0xec68('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec68('0x4'));var rimraf=require(_0xec68('0x5'));var config=require(_0xec68('0x6'));var attributes=require(_0xec68('0x7'));module['exports']=function(_0x196d12,_0x47a7f3){return _0x196d12[_0xec68('0x8')](_0xec68('0x9'),attributes,{'tableName':_0xec68('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xec68('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x428d=['VoiceMail','voice_voicemail','mailbox','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define'];(function(_0x214393,_0x243463){var _0x38be1a=function(_0x3e46b0){while(--_0x3e46b0){_0x214393['push'](_0x214393['shift']());}};_0x38be1a(++_0x243463);}(_0x428d,0xed));var _0xd428=function(_0x42257f,_0xbf098c){_0x42257f=_0x42257f-0x0;var _0x5590d7=_0x428d[_0x42257f];return _0x5590d7;};'use strict';var _=require(_0xd428('0x0'));var util=require('util');var logger=require(_0xd428('0x1'))(_0xd428('0x2'));var moment=require('moment');var BPromise=require(_0xd428('0x3'));var rp=require(_0xd428('0x4'));var fs=require('fs');var path=require(_0xd428('0x5'));var rimraf=require('rimraf');var config=require(_0xd428('0x6'));var attributes=require(_0xd428('0x7'));module[_0xd428('0x8')]=function(_0x428e83,_0x1f0d13){return _0x428e83[_0xd428('0x9')](_0xd428('0xa'),attributes,{'tableName':_0xd428('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xd428('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f4691b5..ef11997 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 _0xa19b=['code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xd52f25,_0xebca64){var _0x3894f0=function(_0xe13c3){while(--_0xe13c3){_0xd52f25['push'](_0xd52f25['shift']());}};_0x3894f0(++_0xebca64);}(_0xa19b,0x155));var _0xba19=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa19b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xba19('0x0'));var moment=require('moment');var BPromise=require(_0xba19('0x1'));var rs=require(_0xba19('0x2'));var fs=require('fs');var Redis=require(_0xba19('0x3'));var db=require(_0xba19('0x4'))['db'];var utils=require(_0xba19('0x5'));var logger=require(_0xba19('0x6'))(_0xba19('0x7'));var config=require(_0xba19('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xba19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3764,_0x2c4114,_0x201b4f){return new BPromise(function(_0x43151d,_0x35298c){return client['request'](_0x2f3764,_0x201b4f)[_0xba19('0xa')](function(_0x21f775){logger['info'](_0xba19('0xb'),_0x2c4114,'request\x20sent');logger[_0xba19('0xc')](_0xba19('0xd'),_0x2c4114,_0xba19('0xe'),JSON['stringify'](_0x21f775));if(_0x21f775[_0xba19('0xf')]){if(_0x21f775[_0xba19('0xf')][_0xba19('0x10')]===0x1f4){logger[_0xba19('0xf')](_0xba19('0xb'),_0x2c4114,_0x21f775[_0xba19('0xf')]['message']);return _0x35298c(_0x21f775[_0xba19('0xf')][_0xba19('0x11')]);}logger[_0xba19('0xf')](_0xba19('0xb'),_0x2c4114,_0x21f775[_0xba19('0xf')][_0xba19('0x11')]);return _0x43151d(_0x21f775['error']['message']);}else{logger[_0xba19('0x12')]('VoiceMail,\x20%s,\x20%s',_0x2c4114,_0xba19('0xe'));_0x43151d(_0x21f775[_0xba19('0x13')][_0xba19('0x11')]);}})[_0xba19('0x14')](function(_0x1c567e){logger['error'](_0xba19('0xb'),_0x2c4114,_0x1c567e);_0x35298c(_0x1c567e);});});} \ No newline at end of file +var _0x2d15=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x35d736,_0x3c9a45){var _0x4a648a=function(_0x3b6c0c){while(--_0x3b6c0c){_0x35d736['push'](_0x35d736['shift']());}};_0x4a648a(++_0x3c9a45);}(_0x2d15,0x88));var _0x52d1=function(_0x2e716c,_0x427e64){_0x2e716c=_0x2e716c-0x0;var _0xf4607=_0x2d15[_0x2e716c];return _0xf4607;};'use strict';var _=require(_0x52d1('0x0'));var util=require(_0x52d1('0x1'));var moment=require('moment');var BPromise=require(_0x52d1('0x2'));var rs=require(_0x52d1('0x3'));var fs=require('fs');var Redis=require(_0x52d1('0x4'));var db=require(_0x52d1('0x5'))['db'];var utils=require(_0x52d1('0x6'));var logger=require(_0x52d1('0x7'))(_0x52d1('0x8'));var config=require('../../config/environment');var jayson=require(_0x52d1('0x9'));var client=jayson[_0x52d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96eb28,_0x3fb1a4,_0x3cee9e){return new BPromise(function(_0x30349b,_0x5be054){return client[_0x52d1('0xb')](_0x96eb28,_0x3cee9e)[_0x52d1('0xc')](function(_0x1bcc08){logger[_0x52d1('0xd')](_0x52d1('0xe'),_0x3fb1a4,_0x52d1('0xf'));logger['debug'](_0x52d1('0x10'),_0x3fb1a4,'request\x20sent',JSON[_0x52d1('0x11')](_0x1bcc08));if(_0x1bcc08['error']){if(_0x1bcc08[_0x52d1('0x12')][_0x52d1('0x13')]===0x1f4){logger[_0x52d1('0x12')](_0x52d1('0xe'),_0x3fb1a4,_0x1bcc08[_0x52d1('0x12')][_0x52d1('0x14')]);return _0x5be054(_0x1bcc08[_0x52d1('0x12')][_0x52d1('0x14')]);}logger[_0x52d1('0x12')]('VoiceMail,\x20%s,\x20%s',_0x3fb1a4,_0x1bcc08[_0x52d1('0x12')][_0x52d1('0x14')]);return _0x30349b(_0x1bcc08[_0x52d1('0x12')][_0x52d1('0x14')]);}else{logger[_0x52d1('0xd')]('VoiceMail,\x20%s,\x20%s',_0x3fb1a4,_0x52d1('0xf'));_0x30349b(_0x1bcc08[_0x52d1('0x15')][_0x52d1('0x14')]);}})[_0x52d1('0x16')](function(_0x2f6b93){logger[_0x52d1('0x12')](_0x52d1('0xe'),_0x3fb1a4,_0x2f6b93);_0x5be054(_0x2f6b93);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index cbf6330..fc1aa06 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 _0x1be3=['exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','update','delete','destroy'];(function(_0x17024d,_0x47462b){var _0x5ea1f=function(_0x5c9430){while(--_0x5c9430){_0x17024d['push'](_0x17024d['shift']());}};_0x5ea1f(++_0x47462b);}(_0x1be3,0xac));var _0x31be=function(_0x3825fc,_0x2daca3){_0x3825fc=_0x3825fc-0x0;var _0x1808b7=_0x1be3[_0x3825fc];return _0x1808b7;};'use strict';var multer=require(_0x31be('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31be('0x1'));var router=express[_0x31be('0x2')]();var fs_extra=require(_0x31be('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x31be('0x4'));var config=require(_0x31be('0x5'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0x31be('0x6')](),controller[_0x31be('0x7')]);router[_0x31be('0x8')](_0x31be('0x9'),auth[_0x31be('0x6')](),controller[_0x31be('0xa')]);router[_0x31be('0x8')](_0x31be('0xb'),auth['isAuthenticated'](),controller[_0x31be('0xc')]);router[_0x31be('0xd')]('/',auth[_0x31be('0x6')](),controller[_0x31be('0xe')]);router['put'](_0x31be('0x9'),auth['isAuthenticated'](),controller[_0x31be('0xf')]);router[_0x31be('0x10')](_0x31be('0x9'),auth['isAuthenticated'](),controller[_0x31be('0x11')]);module[_0x31be('0x12')]=router; \ No newline at end of file +var _0xedb9=['put','update','destroy','multer','util','path','connect-timeout','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','/:id/download'];(function(_0x2e14f7,_0x2e778f){var _0x2e9fa3=function(_0x41f511){while(--_0x41f511){_0x2e14f7['push'](_0x2e14f7['shift']());}};_0x2e9fa3(++_0x2e778f);}(_0xedb9,0xe0));var _0x9edb=function(_0x1bd381,_0x13ec9f){_0x1bd381=_0x1bd381-0x0;var _0x354c22=_0xedb9[_0x1bd381];return _0x354c22;};'use strict';var multer=require(_0x9edb('0x0'));var util=require(_0x9edb('0x1'));var path=require(_0x9edb('0x2'));var timeout=require(_0x9edb('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9edb('0x4'));var config=require('../../config/environment');var controller=require(_0x9edb('0x5'));router[_0x9edb('0x6')]('/',auth[_0x9edb('0x7')](),controller['index']);router['get'](_0x9edb('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x9edb('0x6')](_0x9edb('0x9'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0x9edb('0x7')](),controller['create']);router[_0x9edb('0xa')](_0x9edb('0x8'),auth[_0x9edb('0x7')](),controller[_0x9edb('0xb')]);router['delete']('/:id',auth[_0x9edb('0x7')](),controller[_0x9edb('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 8e3cd28..d3b4822 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 _0xede1=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','INTEGER','STRING','BLOB','TIMESTAMP'];(function(_0x1fc857,_0x286723){var _0x1a421=function(_0x3e178d){while(--_0x3e178d){_0x1fc857['push'](_0x1fc857['shift']());}};_0x1a421(++_0x286723);}(_0xede1,0xd2));var _0x1ede=function(_0x2006df,_0x18ca2d){_0x2006df=_0x2006df-0x0;var _0x1a728e=_0xede1[_0x2006df];return _0x1a728e;};'use strict';var Sequelize=require(_0x1ede('0x0'));module['exports']={'name':{'type':Sequelize[_0x1ede('0x1')],'get':function(_0x1fe71f){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1ede('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x1ede('0x4')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':''},'stamp':{'type':_0x1ede('0x5'),'defaultValue':Sequelize[_0x1ede('0x6')](_0x1ede('0x7'))}}; \ No newline at end of file +var _0xac8f=['STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER'];(function(_0x3a41df,_0x1bd6f3){var _0xd60561=function(_0x3b5bae){while(--_0x3b5bae){_0x3a41df['push'](_0x3a41df['shift']());}};_0xd60561(++_0x1bd6f3);}(_0xac8f,0x100));var _0xfac8=function(_0x3ef8f7,_0x35359a){_0x3ef8f7=_0x3ef8f7-0x0;var _0x3b097e=_0xac8f[_0x3ef8f7];return _0x3b097e;};'use strict';var Sequelize=require(_0xfac8('0x0'));module['exports']={'name':{'type':Sequelize[_0xfac8('0x1')],'get':function(_0x1421fd){return this[_0xfac8('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xfac8('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xfac8('0x5')](_0xfac8('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfac8('0x4')],'defaultValue':''},'stamp':{'type':_0xfac8('0x7'),'defaultValue':Sequelize[_0xfac8('0x8')](_0xfac8('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 16efb6f..174d55b 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 _0x4b6e=['undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','type','options','VoiceMailMessage','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x4b6e,0x87));var _0xe4b6=function(_0x298a5f,_0x26e88d){_0x298a5f=_0x298a5f-0x0;var _0x266c0f=_0x4b6e[_0x298a5f];return _0x266c0f;};'use strict';var emlformat=require(_0xe4b6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4b6('0x1'));var jsonpatch=require(_0xe4b6('0x2'));var rp=require(_0xe4b6('0x3'));var moment=require(_0xe4b6('0x4'));var BPromise=require(_0xe4b6('0x5'));var Mustache=require('mustache');var util=require(_0xe4b6('0x6'));var path=require(_0xe4b6('0x7'));var sox=require('sox');var csv=require(_0xe4b6('0x8'));var ejs=require(_0xe4b6('0x9'));var fs=require('fs');var fs_extra=require(_0xe4b6('0xa'));var _=require(_0xe4b6('0xb'));var squel=require('squel');var crypto=require(_0xe4b6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe4b6('0xd'));var toCsv=require(_0xe4b6('0x8'));var querystring=require(_0xe4b6('0xe'));var Papa=require('papaparse');var Redis=require(_0xe4b6('0xf'));var authService=require(_0xe4b6('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4b6('0x11'));var logger=require(_0xe4b6('0x12'))(_0xe4b6('0x13'));var utils=require(_0xe4b6('0x14'));var config=require(_0xe4b6('0x15'));var licenseUtil=require(_0xe4b6('0x16'));var db=require(_0xe4b6('0x17'))['db'];function respondWithStatusCode(_0xca9b1a,_0xad982b){_0xad982b=_0xad982b||0xcc;return function(_0xdb7a74){if(_0xdb7a74){return _0xca9b1a[_0xe4b6('0x18')](_0xad982b);}return _0xca9b1a[_0xe4b6('0x19')](_0xad982b)[_0xe4b6('0x1a')]();};}function respondWithResult(_0x5b8d3a,_0x3ef8d6){_0x3ef8d6=_0x3ef8d6||0xc8;return function(_0x557a84){if(_0x557a84){return _0x5b8d3a[_0xe4b6('0x19')](_0x3ef8d6)[_0xe4b6('0x1b')](_0x557a84);}};}function respondWithFilteredResult(_0x587b37,_0x32136b){return function(_0x154c8d){if(_0x154c8d){var _0x3d5473=typeof _0x32136b[_0xe4b6('0x1c')]===_0xe4b6('0x1d')&&typeof _0x32136b[_0xe4b6('0x1e')]===_0xe4b6('0x1d');var _0x325a52=_0x154c8d[_0xe4b6('0x1f')];var _0x46253c=_0x3d5473?0x0:_0x32136b[_0xe4b6('0x1c')];var _0x7deacf=_0x3d5473?_0x154c8d['count']:_0x32136b[_0xe4b6('0x1c')]+_0x32136b[_0xe4b6('0x1e')];var _0x10a250;if(_0x7deacf>=_0x325a52){_0x7deacf=_0x325a52;_0x10a250=0xc8;}else{_0x10a250=0xce;}_0x587b37[_0xe4b6('0x19')](_0x10a250);return _0x587b37[_0xe4b6('0x20')](_0xe4b6('0x21'),_0x46253c+'-'+_0x7deacf+'/'+_0x325a52)['json'](_0x154c8d);}return null;};}function patchUpdates(_0x299b1b){return function(_0x10f371){try{jsonpatch[_0xe4b6('0x22')](_0x10f371,_0x299b1b,!![]);}catch(_0x3a7b84){return BPromise[_0xe4b6('0x23')](_0x3a7b84);}return _0x10f371[_0xe4b6('0x24')]();};}function saveUpdates(_0x321d74,_0x423428){return function(_0x454eba){if(_0x454eba){return _0x454eba[_0xe4b6('0x25')](_0x321d74)[_0xe4b6('0x26')](function(_0x5c164c){return _0x5c164c;});}return null;};}function removeEntity(_0x1e8ae0,_0x38b3a2){return function(_0x4df65a){if(_0x4df65a){return _0x4df65a['destroy']()['then'](function(){_0x1e8ae0[_0xe4b6('0x19')](0xcc)[_0xe4b6('0x1a')]();});}};}function handleEntityNotFound(_0x2831e0,_0x101742){return function(_0x5ddc12){if(!_0x5ddc12){_0x2831e0[_0xe4b6('0x18')](0x194);}return _0x5ddc12;};}function handleError(_0x23e915,_0xe20655){_0xe20655=_0xe20655||0x1f4;return function(_0xbadddd){logger[_0xe4b6('0x27')](_0xbadddd[_0xe4b6('0x28')]);if(_0xbadddd[_0xe4b6('0x29')]){delete _0xbadddd[_0xe4b6('0x29')];}_0x23e915[_0xe4b6('0x19')](_0xe20655)['send'](_0xbadddd);};}exports['index']=function(_0x50eccf,_0x9ee42e){var _0x4901cc={},_0x2d41a0={},_0x45b3cb={'count':0x0,'rows':[]};var _0x3df64e=_[_0xe4b6('0x2a')](db['VoiceMailMessage'][_0xe4b6('0x2b')],function(_0x3bff14){return{'name':_0x3bff14[_0xe4b6('0x2c')],'type':_0x3bff14['type'][_0xe4b6('0x2d')]};});_0x2d41a0[_0xe4b6('0x2e')]=_[_0xe4b6('0x2f')](_[_0xe4b6('0x2a')](_0x3df64e,_0xe4b6('0x29')),[_0xe4b6('0x29')]);_0x2d41a0[_0xe4b6('0x30')]=_['keys'](_0x50eccf[_0xe4b6('0x30')]);_0x2d41a0[_0xe4b6('0x31')]=_[_0xe4b6('0x32')](_0x2d41a0[_0xe4b6('0x2e')],_0x2d41a0[_0xe4b6('0x30')]);_0x4901cc[_0xe4b6('0x33')]=_['intersection'](_0x2d41a0['model'],qs['fields'](_0x50eccf[_0xe4b6('0x30')][_0xe4b6('0x34')]));_0x4901cc['attributes']=_0x4901cc[_0xe4b6('0x33')]['length']?_0x4901cc['attributes']:_0x2d41a0[_0xe4b6('0x2e')];if(!_0x50eccf[_0xe4b6('0x30')]['hasOwnProperty'](_0xe4b6('0x35'))){_0x4901cc[_0xe4b6('0x1e')]=qs[_0xe4b6('0x1e')](_0x50eccf[_0xe4b6('0x30')]['limit']);_0x4901cc[_0xe4b6('0x1c')]=qs[_0xe4b6('0x1c')](_0x50eccf[_0xe4b6('0x30')][_0xe4b6('0x1c')]);}_0x4901cc['order']=qs[_0xe4b6('0x36')](_0x50eccf[_0xe4b6('0x30')]['sort']);_0x4901cc['where']=qs[_0xe4b6('0x31')](_[_0xe4b6('0x37')](_0x50eccf[_0xe4b6('0x30')],_0x2d41a0[_0xe4b6('0x31')]),_0x3df64e);if(_0x50eccf[_0xe4b6('0x30')][_0xe4b6('0x38')]){_0x4901cc[_0xe4b6('0x39')]=_[_0xe4b6('0x3a')](_0x4901cc['where'],{'$or':_['map'](_0x3df64e,function(_0x27b1dc){if(_0x27b1dc[_0xe4b6('0x3b')]!=='VIRTUAL'){var _0x1da4e8={};_0x1da4e8[_0x27b1dc[_0xe4b6('0x29')]]={'$like':'%'+_0x50eccf[_0xe4b6('0x30')][_0xe4b6('0x38')]+'%'};return _0x1da4e8;}})});}_0x4901cc=_[_0xe4b6('0x3a')]({},_0x4901cc,_0x50eccf[_0xe4b6('0x3c')]);var _0x357da2={'where':_0x4901cc[_0xe4b6('0x39')]};return db[_0xe4b6('0x3d')][_0xe4b6('0x1f')](_0x357da2)['then'](function(_0xce6dae){_0x45b3cb['count']=_0xce6dae;if(_0x50eccf[_0xe4b6('0x30')][_0xe4b6('0x3e')]){_0x4901cc['include']=[{'all':!![]}];}return db[_0xe4b6('0x3d')][_0xe4b6('0x3f')](_0x4901cc);})[_0xe4b6('0x26')](function(_0x2c9eff){_0x45b3cb['rows']=_0x2c9eff;return _0x45b3cb;})[_0xe4b6('0x26')](respondWithFilteredResult(_0x9ee42e,_0x4901cc))[_0xe4b6('0x40')](handleError(_0x9ee42e,null));};exports[_0xe4b6('0x41')]=function(_0x4be87f,_0x4d1d09){var _0xddb3fc={'raw':!![],'where':{'id':_0x4be87f[_0xe4b6('0x42')]['id']}},_0x209edc={};_0x209edc[_0xe4b6('0x2e')]=_[_0xe4b6('0x43')](db[_0xe4b6('0x3d')][_0xe4b6('0x2b')]);_0x209edc['query']=_['keys'](_0x4be87f[_0xe4b6('0x30')]);_0x209edc[_0xe4b6('0x31')]=_[_0xe4b6('0x32')](_0x209edc['model'],_0x209edc[_0xe4b6('0x30')]);_0xddb3fc[_0xe4b6('0x33')]=_[_0xe4b6('0x32')](_0x209edc[_0xe4b6('0x2e')],qs[_0xe4b6('0x34')](_0x4be87f[_0xe4b6('0x30')][_0xe4b6('0x34')]));_0xddb3fc[_0xe4b6('0x33')]=_0xddb3fc[_0xe4b6('0x33')][_0xe4b6('0x44')]?_0xddb3fc[_0xe4b6('0x33')]:_0x209edc[_0xe4b6('0x2e')];if(_0x4be87f[_0xe4b6('0x30')][_0xe4b6('0x3e')]){_0xddb3fc[_0xe4b6('0x45')]=[{'all':!![]}];}_0xddb3fc=_[_0xe4b6('0x3a')]({},_0xddb3fc,_0x4be87f[_0xe4b6('0x3c')]);return db[_0xe4b6('0x3d')][_0xe4b6('0x46')](_0xddb3fc)['then'](handleEntityNotFound(_0x4d1d09,null))['then'](respondWithResult(_0x4d1d09,null))[_0xe4b6('0x40')](handleError(_0x4d1d09,null));};exports[_0xe4b6('0x47')]=function(_0x45c1ef,_0x951d40){return db['VoiceMailMessage']['create'](_0x45c1ef[_0xe4b6('0x48')],{})[_0xe4b6('0x26')](respondWithResult(_0x951d40,0xc9))['catch'](handleError(_0x951d40,null));};exports[_0xe4b6('0x25')]=function(_0x19748b,_0x251789){if(_0x19748b[_0xe4b6('0x48')]['id']){delete _0x19748b[_0xe4b6('0x48')]['id'];}return db['VoiceMailMessage'][_0xe4b6('0x46')]({'where':{'id':_0x19748b['params']['id']}})[_0xe4b6('0x26')](handleEntityNotFound(_0x251789,null))[_0xe4b6('0x26')](saveUpdates(_0x19748b[_0xe4b6('0x48')],null))[_0xe4b6('0x26')](respondWithResult(_0x251789,null))[_0xe4b6('0x40')](handleError(_0x251789,null));};exports['destroy']=function(_0x3f1de6,_0x1723c6){return db[_0xe4b6('0x3d')][_0xe4b6('0x46')]({'where':{'id':_0x3f1de6[_0xe4b6('0x42')]['id']}})[_0xe4b6('0x26')](handleEntityNotFound(_0x1723c6,null))[_0xe4b6('0x26')](removeEntity(_0x1723c6,null))[_0xe4b6('0x40')](handleError(_0x1723c6,null));};exports[_0xe4b6('0x49')]=function(_0x4e96ad,_0x188a60,_0x9b346e){return db[_0xe4b6('0x3d')][_0xe4b6('0x46')]({'where':{'id':_0x4e96ad['params']['id']},'attributes':['id',_0xe4b6('0x4a'),_0xe4b6('0x4b')]})[_0xe4b6('0x26')](handleEntityNotFound(_0x188a60,null))[_0xe4b6('0x26')](function(_0x465602){if(_0x465602){if(!_0x465602['recording']){throw new db[(_0xe4b6('0x4c'))][(_0xe4b6('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0xeaa0bb={'Content-Type':_0xe4b6('0x4e'),'Content-Disposition':_0xe4b6('0x4f')};if(_0x465602[_0xe4b6('0x4b')]){_0xeaa0bb[_0xe4b6('0x50')]='attachment;\x20filename=\x22'+_0x465602[_0xe4b6('0x4b')]+'.wav\x22';}_0x188a60[_0xe4b6('0x20')](_0xeaa0bb);return _0x188a60[_0xe4b6('0x51')](new Buffer(_0x465602['recording']));}})[_0xe4b6('0x40')](handleError(_0x188a60,null));}; \ No newline at end of file +var _0x077d=['Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','rows','params','keys','options','find','catch','create','body','download','msg_id','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','recording','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','set'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x077d,0x182));var _0xd077=function(_0x548d03,_0x5c1f8e){_0x548d03=_0x548d03-0x0;var _0x2aa0f1=_0x077d[_0x548d03];return _0x2aa0f1;};'use strict';var emlformat=require(_0xd077('0x0'));var rimraf=require(_0xd077('0x1'));var zipdir=require(_0xd077('0x2'));var jsonpatch=require(_0xd077('0x3'));var rp=require(_0xd077('0x4'));var moment=require(_0xd077('0x5'));var BPromise=require(_0xd077('0x6'));var Mustache=require(_0xd077('0x7'));var util=require(_0xd077('0x8'));var path=require(_0xd077('0x9'));var sox=require(_0xd077('0xa'));var csv=require(_0xd077('0xb'));var ejs=require(_0xd077('0xc'));var fs=require('fs');var fs_extra=require(_0xd077('0xd'));var _=require(_0xd077('0xe'));var squel=require(_0xd077('0xf'));var crypto=require('crypto');var jsforce=require(_0xd077('0x10'));var deskjs=require(_0xd077('0x11'));var toCsv=require(_0xd077('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd077('0x12'));var qs=require(_0xd077('0x13'));var as=require(_0xd077('0x14'));var hardwareService=require(_0xd077('0x15'));var logger=require(_0xd077('0x16'))(_0xd077('0x17'));var utils=require(_0xd077('0x18'));var config=require(_0xd077('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x258200,_0x551eda){_0x551eda=_0x551eda||0xcc;return function(_0x201480){if(_0x201480){return _0x258200[_0xd077('0x1a')](_0x551eda);}return _0x258200[_0xd077('0x1b')](_0x551eda)[_0xd077('0x1c')]();};}function respondWithResult(_0x56d69c,_0x53f1ce){_0x53f1ce=_0x53f1ce||0xc8;return function(_0x4dc362){if(_0x4dc362){return _0x56d69c['status'](_0x53f1ce)['json'](_0x4dc362);}};}function respondWithFilteredResult(_0x3e919e,_0x532831){return function(_0x153d85){if(_0x153d85){var _0x2545b1=typeof _0x532831[_0xd077('0x1d')]==='undefined'&&typeof _0x532831[_0xd077('0x1e')]===_0xd077('0x1f');var _0x15647a=_0x153d85[_0xd077('0x20')];var _0x116f30=_0x2545b1?0x0:_0x532831[_0xd077('0x1d')];var _0x5e0536=_0x2545b1?_0x153d85[_0xd077('0x20')]:_0x532831[_0xd077('0x1d')]+_0x532831[_0xd077('0x1e')];var _0xd7be75;if(_0x5e0536>=_0x15647a){_0x5e0536=_0x15647a;_0xd7be75=0xc8;}else{_0xd7be75=0xce;}_0x3e919e[_0xd077('0x1b')](_0xd7be75);return _0x3e919e[_0xd077('0x21')](_0xd077('0x22'),_0x116f30+'-'+_0x5e0536+'/'+_0x15647a)[_0xd077('0x23')](_0x153d85);}return null;};}function patchUpdates(_0x285c3a){return function(_0x24debc){try{jsonpatch[_0xd077('0x24')](_0x24debc,_0x285c3a,!![]);}catch(_0x3600d9){return BPromise[_0xd077('0x25')](_0x3600d9);}return _0x24debc['save']();};}function saveUpdates(_0x56bb87,_0x5312f8){return function(_0x318931){if(_0x318931){return _0x318931[_0xd077('0x26')](_0x56bb87)[_0xd077('0x27')](function(_0x437c2c){return _0x437c2c;});}return null;};}function removeEntity(_0x1e270b,_0x4b548f){return function(_0x3372e2){if(_0x3372e2){return _0x3372e2[_0xd077('0x28')]()[_0xd077('0x27')](function(){_0x1e270b['status'](0xcc)[_0xd077('0x1c')]();});}};}function handleEntityNotFound(_0x4b2cd8,_0x2a0fce){return function(_0x365334){if(!_0x365334){_0x4b2cd8[_0xd077('0x1a')](0x194);}return _0x365334;};}function handleError(_0x1bedc9,_0xeb08e7){_0xeb08e7=_0xeb08e7||0x1f4;return function(_0x3d665a){logger['error'](_0x3d665a[_0xd077('0x29')]);if(_0x3d665a[_0xd077('0x2a')]){delete _0x3d665a[_0xd077('0x2a')];}_0x1bedc9['status'](_0xeb08e7)[_0xd077('0x2b')](_0x3d665a);};}exports[_0xd077('0x2c')]=function(_0x415ae3,_0x17ead3){var _0x1ed953={},_0x475033={},_0x3e20f6={'count':0x0,'rows':[]};var _0x39e50f=_['map'](db[_0xd077('0x2d')][_0xd077('0x2e')],function(_0x307677){return{'name':_0x307677[_0xd077('0x2f')],'type':_0x307677['type'][_0xd077('0x30')]};});_0x475033[_0xd077('0x31')]=_[_0xd077('0x32')](_[_0xd077('0x33')](_0x39e50f,'name'),[_0xd077('0x2a')]);_0x475033[_0xd077('0x34')]=_['keys'](_0x415ae3[_0xd077('0x34')]);_0x475033[_0xd077('0x35')]=_['intersection'](_0x475033[_0xd077('0x31')],_0x475033[_0xd077('0x34')]);_0x1ed953['attributes']=_[_0xd077('0x36')](_0x475033['model'],qs[_0xd077('0x37')](_0x415ae3['query'][_0xd077('0x37')]));_0x1ed953[_0xd077('0x38')]=_0x1ed953[_0xd077('0x38')][_0xd077('0x39')]?_0x1ed953[_0xd077('0x38')]:_0x475033[_0xd077('0x31')];if(!_0x415ae3[_0xd077('0x34')][_0xd077('0x3a')](_0xd077('0x3b'))){_0x1ed953['limit']=qs[_0xd077('0x1e')](_0x415ae3[_0xd077('0x34')][_0xd077('0x1e')]);_0x1ed953[_0xd077('0x1d')]=qs['offset'](_0x415ae3[_0xd077('0x34')][_0xd077('0x1d')]);}_0x1ed953[_0xd077('0x3c')]=qs[_0xd077('0x3d')](_0x415ae3[_0xd077('0x34')][_0xd077('0x3d')]);_0x1ed953[_0xd077('0x3e')]=qs[_0xd077('0x35')](_['pick'](_0x415ae3[_0xd077('0x34')],_0x475033[_0xd077('0x35')]),_0x39e50f);if(_0x415ae3[_0xd077('0x34')][_0xd077('0x3f')]){_0x1ed953[_0xd077('0x3e')]=_[_0xd077('0x40')](_0x1ed953['where'],{'$or':_['map'](_0x39e50f,function(_0x3afea5){if(_0x3afea5[_0xd077('0x41')]!==_0xd077('0x42')){var _0x57a228={};_0x57a228[_0x3afea5[_0xd077('0x2a')]]={'$like':'%'+_0x415ae3[_0xd077('0x34')][_0xd077('0x3f')]+'%'};return _0x57a228;}})});}_0x1ed953=_[_0xd077('0x40')]({},_0x1ed953,_0x415ae3['options']);var _0x4b170b={'where':_0x1ed953[_0xd077('0x3e')]};return db[_0xd077('0x2d')]['count'](_0x4b170b)[_0xd077('0x27')](function(_0x30dc27){_0x3e20f6[_0xd077('0x20')]=_0x30dc27;if(_0x415ae3[_0xd077('0x34')][_0xd077('0x43')]){_0x1ed953[_0xd077('0x44')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x1ed953);})[_0xd077('0x27')](function(_0x10ccd0){_0x3e20f6[_0xd077('0x45')]=_0x10ccd0;return _0x3e20f6;})['then'](respondWithFilteredResult(_0x17ead3,_0x1ed953))['catch'](handleError(_0x17ead3,null));};exports['show']=function(_0x595b73,_0x4da815){var _0x4746e1={'raw':!![],'where':{'id':_0x595b73[_0xd077('0x46')]['id']}},_0x5a8379={};_0x5a8379[_0xd077('0x31')]=_[_0xd077('0x47')](db[_0xd077('0x2d')]['rawAttributes']);_0x5a8379[_0xd077('0x34')]=_[_0xd077('0x47')](_0x595b73['query']);_0x5a8379['filters']=_[_0xd077('0x36')](_0x5a8379[_0xd077('0x31')],_0x5a8379['query']);_0x4746e1[_0xd077('0x38')]=_['intersection'](_0x5a8379[_0xd077('0x31')],qs['fields'](_0x595b73['query']['fields']));_0x4746e1[_0xd077('0x38')]=_0x4746e1[_0xd077('0x38')]['length']?_0x4746e1[_0xd077('0x38')]:_0x5a8379[_0xd077('0x31')];if(_0x595b73[_0xd077('0x34')][_0xd077('0x43')]){_0x4746e1[_0xd077('0x44')]=[{'all':!![]}];}_0x4746e1=_['merge']({},_0x4746e1,_0x595b73[_0xd077('0x48')]);return db[_0xd077('0x2d')][_0xd077('0x49')](_0x4746e1)['then'](handleEntityNotFound(_0x4da815,null))[_0xd077('0x27')](respondWithResult(_0x4da815,null))[_0xd077('0x4a')](handleError(_0x4da815,null));};exports[_0xd077('0x4b')]=function(_0x3956b7,_0x35b63e){return db[_0xd077('0x2d')]['create'](_0x3956b7[_0xd077('0x4c')],{})[_0xd077('0x27')](respondWithResult(_0x35b63e,0xc9))['catch'](handleError(_0x35b63e,null));};exports[_0xd077('0x26')]=function(_0x51482f,_0x2109ee){if(_0x51482f[_0xd077('0x4c')]['id']){delete _0x51482f[_0xd077('0x4c')]['id'];}return db['VoiceMailMessage'][_0xd077('0x49')]({'where':{'id':_0x51482f[_0xd077('0x46')]['id']}})[_0xd077('0x27')](handleEntityNotFound(_0x2109ee,null))['then'](saveUpdates(_0x51482f[_0xd077('0x4c')],null))[_0xd077('0x27')](respondWithResult(_0x2109ee,null))['catch'](handleError(_0x2109ee,null));};exports[_0xd077('0x28')]=function(_0x5d62a2,_0x20f869){return db['VoiceMailMessage']['find']({'where':{'id':_0x5d62a2[_0xd077('0x46')]['id']}})[_0xd077('0x27')](handleEntityNotFound(_0x20f869,null))['then'](removeEntity(_0x20f869,null))[_0xd077('0x4a')](handleError(_0x20f869,null));};exports[_0xd077('0x4d')]=function(_0x283bc0,_0x43be87,_0x36fd61){return db['VoiceMailMessage'][_0xd077('0x49')]({'where':{'id':_0x283bc0['params']['id']},'attributes':['id','recording',_0xd077('0x4e')]})[_0xd077('0x27')](handleEntityNotFound(_0x43be87,null))[_0xd077('0x27')](function(_0x4e4bda){if(_0x4e4bda){if(!_0x4e4bda['recording']){throw new db['Sequelize']['ValidationError'](_0xd077('0x4f'));}var _0x1f8fcb={'Content-Type':'audio/wav','Content-Disposition':_0xd077('0x50')};if(_0x4e4bda[_0xd077('0x4e')]){_0x1f8fcb[_0xd077('0x51')]=_0xd077('0x52')+_0x4e4bda['msg_id']+'.wav\x22';}_0x43be87[_0xd077('0x21')](_0x1f8fcb);return _0x43be87['send'](new Buffer(_0x4e4bda[_0xd077('0x53')]));}})[_0xd077('0x4a')](handleError(_0x43be87,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 75b8251..87111fc 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 _0x9230=['../../config/environment','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x168fdc,_0x396e13){var _0x56d002=function(_0x58a808){while(--_0x58a808){_0x168fdc['push'](_0x168fdc['shift']());}};_0x56d002(++_0x396e13);}(_0x9230,0x90));var _0x0923=function(_0x2e5923,_0x53c4a9){_0x2e5923=_0x2e5923-0x0;var _0x23f651=_0x9230[_0x2e5923];return _0x23f651;};'use strict';var _=require(_0x0923('0x0'));var util=require(_0x0923('0x1'));var logger=require(_0x0923('0x2'))(_0x0923('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0923('0x4'));var fs=require('fs');var path=require(_0x0923('0x5'));var rimraf=require('rimraf');var config=require(_0x0923('0x6'));var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x11719f,_0x57f34e){return _0x11719f[_0x0923('0x7')]('VoiceMailMessage',attributes,{'tableName':_0x0923('0x8'),'paranoid':![],'indexes':[{'name':_0x0923('0x9'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xf53d=['moment','request-promise','../../config/environment','exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x34627a,_0x45f2fa){var _0xe92fd9=function(_0x1a7838){while(--_0x1a7838){_0x34627a['push'](_0x34627a['shift']());}};_0xe92fd9(++_0x45f2fa);}(_0xf53d,0x1ca));var _0xdf53=function(_0x3b50fb,_0x23242e){_0x3b50fb=_0x3b50fb-0x0;var _0x479620=_0xf53d[_0x3b50fb];return _0x479620;};'use strict';var _=require(_0xdf53('0x0'));var util=require(_0xdf53('0x1'));var logger=require(_0xdf53('0x2'))(_0xdf53('0x3'));var moment=require(_0xdf53('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdf53('0x6'));var attributes=require('./voiceMailMessage.attributes');module[_0xdf53('0x7')]=function(_0x182246,_0x3ae4ec){return _0x182246['define'](_0xdf53('0x8'),attributes,{'tableName':_0xdf53('0x9'),'paranoid':![],'indexes':[{'name':_0xdf53('0xa'),'fields':[_0xdf53('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 4adf559..2388a09 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 _0xf705=['code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','stringify','error'];(function(_0x55b933,_0x5d58fd){var _0x19101c=function(_0x4039c3){while(--_0x4039c3){_0x55b933['push'](_0x55b933['shift']());}};_0x19101c(++_0x5d58fd);}(_0xf705,0x1d3));var _0x5f70=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf705[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5f70('0x0'));var util=require(_0x5f70('0x1'));var moment=require(_0x5f70('0x2'));var BPromise=require(_0x5f70('0x3'));var rs=require(_0x5f70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5f70('0x5'))['db'];var utils=require(_0x5f70('0x6'));var logger=require(_0x5f70('0x7'))(_0x5f70('0x8'));var config=require('../../config/environment');var jayson=require(_0x5f70('0x9'));var client=jayson['client'][_0x5f70('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x327b7c,_0x5c529f,_0x519e59){return new BPromise(function(_0x58902c,_0x370071){return client[_0x5f70('0xb')](_0x327b7c,_0x519e59)['then'](function(_0x3c3d98){logger[_0x5f70('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x5c529f,_0x5f70('0xd'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5c529f,_0x5f70('0xd'),JSON[_0x5f70('0xe')](_0x3c3d98));if(_0x3c3d98[_0x5f70('0xf')]){if(_0x3c3d98[_0x5f70('0xf')][_0x5f70('0x10')]===0x1f4){logger['error'](_0x5f70('0x11'),_0x5c529f,_0x3c3d98[_0x5f70('0xf')][_0x5f70('0x12')]);return _0x370071(_0x3c3d98[_0x5f70('0xf')]['message']);}logger['error'](_0x5f70('0x11'),_0x5c529f,_0x3c3d98['error'][_0x5f70('0x12')]);return _0x58902c(_0x3c3d98[_0x5f70('0xf')][_0x5f70('0x12')]);}else{logger[_0x5f70('0xc')](_0x5f70('0x11'),_0x5c529f,_0x5f70('0xd'));_0x58902c(_0x3c3d98[_0x5f70('0x13')][_0x5f70('0x12')]);}})[_0x5f70('0x14')](function(_0x278fe9){logger[_0x5f70('0xf')](_0x5f70('0x11'),_0x5c529f,_0x278fe9);_0x370071(_0x278fe9);});});} \ No newline at end of file +var _0x0219=['VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','info'];(function(_0x290292,_0x261a3b){var _0x2ef98d=function(_0x2703b2){while(--_0x2703b2){_0x290292['push'](_0x290292['shift']());}};_0x2ef98d(++_0x261a3b);}(_0x0219,0x14c));var _0x9021=function(_0x3a78ee,_0x1b8f10){_0x3a78ee=_0x3a78ee-0x0;var _0x3e628f=_0x0219[_0x3a78ee];return _0x3e628f;};'use strict';var _=require('lodash');var util=require(_0x9021('0x0'));var moment=require('moment');var BPromise=require(_0x9021('0x1'));var rs=require(_0x9021('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9021('0x3'))['db'];var utils=require(_0x9021('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9021('0x5')][_0x9021('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5d1a0d,_0x273fe4,_0x9b5593){return new BPromise(function(_0x5c7795,_0x2a1db1){return client['request'](_0x5d1a0d,_0x9b5593)['then'](function(_0x14b0e0){logger[_0x9021('0x7')](_0x9021('0x8'),_0x273fe4,_0x9021('0x9'));logger[_0x9021('0xa')](_0x9021('0xb'),_0x273fe4,_0x9021('0x9'),JSON[_0x9021('0xc')](_0x14b0e0));if(_0x14b0e0['error']){if(_0x14b0e0[_0x9021('0xd')]['code']===0x1f4){logger['error'](_0x9021('0x8'),_0x273fe4,_0x14b0e0[_0x9021('0xd')][_0x9021('0xe')]);return _0x2a1db1(_0x14b0e0[_0x9021('0xd')][_0x9021('0xe')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x273fe4,_0x14b0e0[_0x9021('0xd')][_0x9021('0xe')]);return _0x5c7795(_0x14b0e0[_0x9021('0xd')][_0x9021('0xe')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x273fe4,'request\x20sent');_0x5c7795(_0x14b0e0[_0x9021('0xf')]['message']);}})[_0x9021('0x10')](function(_0x147255){logger[_0x9021('0xd')](_0x9021('0x8'),_0x273fe4,_0x147255);_0x2a1db1(_0x147255);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c8b6d4a..8946cbe 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 _0x3b50=['show','/:id/sounds','getSounds','post','create','addSound','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','isAuthenticated'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x3b50,0x9b));var _0x03b5=function(_0x58965a,_0x2e71db){_0x58965a=_0x58965a-0x0;var _0x254efc=_0x3b50[_0x58965a];return _0x254efc;};'use strict';var multer=require(_0x03b5('0x0'));var util=require(_0x03b5('0x1'));var path=require(_0x03b5('0x2'));var timeout=require(_0x03b5('0x3'));var express=require(_0x03b5('0x4'));var router=express[_0x03b5('0x5')]();var fs_extra=require(_0x03b5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x03b5('0x7'));var config=require(_0x03b5('0x8'));var controller=require(_0x03b5('0x9'));router[_0x03b5('0xa')]('/',auth['isAuthenticated'](),controller[_0x03b5('0xb')]);router[_0x03b5('0xa')]('/:id',auth[_0x03b5('0xc')](),controller[_0x03b5('0xd')]);router[_0x03b5('0xa')](_0x03b5('0xe'),auth['isAuthenticated'](),controller[_0x03b5('0xf')]);router[_0x03b5('0x10')]('/',auth[_0x03b5('0xc')](),controller[_0x03b5('0x11')]);router[_0x03b5('0x10')]('/:id/sounds',auth[_0x03b5('0xc')](),controller[_0x03b5('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x03b5('0x13')]);router[_0x03b5('0x14')]('/:id',auth[_0x03b5('0xc')](),controller[_0x03b5('0x15')]);router[_0x03b5('0x14')]('/:id/sounds/:id2',auth[_0x03b5('0xc')](),controller[_0x03b5('0x16')]);module[_0x03b5('0x17')]=router; \ No newline at end of file +var _0xb701=['show','get','/:id/sounds','getSounds','post','addSound','delete','/:id/sounds/:id2','removeSound','multer','util','path','connect-timeout','express','./voiceMusicOnHold.controller','isAuthenticated','/:id'];(function(_0x549f20,_0x23e210){var _0x56cbe0=function(_0x5a92f5){while(--_0x5a92f5){_0x549f20['push'](_0x549f20['shift']());}};_0x56cbe0(++_0x23e210);}(_0xb701,0xe6));var _0x1b70=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb701[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x1b70('0x0'));var util=require(_0x1b70('0x1'));var path=require(_0x1b70('0x2'));var timeout=require(_0x1b70('0x3'));var express=require(_0x1b70('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('../../config/environment');var controller=require(_0x1b70('0x5'));router['get']('/',auth[_0x1b70('0x6')](),controller['index']);router['get'](_0x1b70('0x7'),auth['isAuthenticated'](),controller[_0x1b70('0x8')]);router[_0x1b70('0x9')](_0x1b70('0xa'),auth[_0x1b70('0x6')](),controller[_0x1b70('0xb')]);router[_0x1b70('0xc')]('/',auth[_0x1b70('0x6')](),controller['create']);router[_0x1b70('0xc')](_0x1b70('0xa'),auth[_0x1b70('0x6')](),controller[_0x1b70('0xd')]);router['put']('/:id',auth[_0x1b70('0x6')](),controller['update']);router[_0x1b70('0xe')](_0x1b70('0x7'),auth[_0x1b70('0x6')](),controller['destroy']);router[_0x1b70('0xe')](_0x1b70('0xf'),auth[_0x1b70('0x6')](),controller[_0x1b70('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 428bfab..3550dbf 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 _0xbdf5=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha'];(function(_0x39431e,_0x43eb12){var _0x4197b8=function(_0x41321d){while(--_0x41321d){_0x39431e['push'](_0x39431e['shift']());}};_0x4197b8(++_0x43eb12);}(_0xbdf5,0xc6));var _0x5bdf=function(_0x3d4247,_0x25434c){_0x3d4247=_0x3d4247-0x0;var _0x5b2dc0=_0xbdf5[_0x3d4247];return _0x5b2dc0;};'use strict';var Sequelize=require(_0x5bdf('0x0'));module[_0x5bdf('0x1')]={'name':{'type':Sequelize[_0x5bdf('0x2')],'allowNull':![],'unique':_0x5bdf('0x3')},'mode':{'type':Sequelize[_0x5bdf('0x4')](_0x5bdf('0x5'),'files',_0x5bdf('0x6'),_0x5bdf('0x7'),_0x5bdf('0x8'),_0x5bdf('0x9')),'allowNull':!![],'defaultValue':_0x5bdf('0xa')},'directory':{'type':Sequelize[_0x5bdf('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x5bdf('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x5bdf('0xb')},'format':{'type':Sequelize[_0x5bdf('0x2')],'allowNull':!![]},'stamp':{'type':_0x5bdf('0xc')},'defaultEntry':{'type':Sequelize[_0x5bdf('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb82f=['BOOLEAN','exports','STRING','name','ENUM','files','mp3nb','quietmp3','mp3','alpha'];(function(_0x40a252,_0x18d820){var _0x4a3ab8=function(_0x62a260){while(--_0x62a260){_0x40a252['push'](_0x40a252['shift']());}};_0x4a3ab8(++_0x18d820);}(_0xb82f,0x1af));var _0xfb82=function(_0x2d774c,_0x23c32e){_0x2d774c=_0x2d774c-0x0;var _0x24ce74=_0xb82f[_0x2d774c];return _0x24ce74;};'use strict';var Sequelize=require('sequelize');module[_0xfb82('0x0')]={'name':{'type':Sequelize[_0xfb82('0x1')],'allowNull':![],'unique':_0xfb82('0x2')},'mode':{'type':Sequelize[_0xfb82('0x3')]('custom',_0xfb82('0x4'),_0xfb82('0x5'),'quietmp3nb',_0xfb82('0x6'),_0xfb82('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xfb82('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xfb82('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xfb82('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xfb82('0x1')],'allowNull':!![],'defaultValue':_0xfb82('0x8')},'format':{'type':Sequelize[_0xfb82('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xfb82('0x9')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index fff30e1..2a8b167 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 _0xf690=['index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','catch','show','body','find','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','params','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','getSounds','order','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','get','MusicOnHolds','UserProfileResource','name'];(function(_0x54a214,_0x287d40){var _0x1cd25f=function(_0x565ece){while(--_0x565ece){_0x54a214['push'](_0x54a214['shift']());}};_0x1cd25f(++_0x287d40);}(_0xf690,0x18b));var _0x0f69=function(_0x522c6d,_0x4d250d){_0x522c6d=_0x522c6d-0x0;var _0x26300d=_0xf690[_0x522c6d];return _0x26300d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0f69('0x0'));var jsonpatch=require(_0x0f69('0x1'));var rp=require(_0x0f69('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0f69('0x3'));var util=require('util');var path=require(_0x0f69('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f69('0x5'));var _=require(_0x0f69('0x6'));var squel=require(_0x0f69('0x7'));var crypto=require(_0x0f69('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0f69('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0f69('0xa'));var Papa=require(_0x0f69('0xb'));var Redis=require('ioredis');var authService=require(_0x0f69('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f69('0xd'));var logger=require(_0x0f69('0xe'))(_0x0f69('0xf'));var utils=require(_0x0f69('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x0f69('0x11'));var db=require(_0x0f69('0x12'))['db'];function respondWithStatusCode(_0x25a8af,_0x68fe5e){_0x68fe5e=_0x68fe5e||0xcc;return function(_0x29b4f4){if(_0x29b4f4){return _0x25a8af[_0x0f69('0x13')](_0x68fe5e);}return _0x25a8af['status'](_0x68fe5e)[_0x0f69('0x14')]();};}function respondWithResult(_0x3308e9,_0xe1b914){_0xe1b914=_0xe1b914||0xc8;return function(_0x196684){if(_0x196684){return _0x3308e9[_0x0f69('0x15')](_0xe1b914)[_0x0f69('0x16')](_0x196684);}};}function respondWithFilteredResult(_0x2e2f12,_0x346cd6){return function(_0x3e909a){if(_0x3e909a){var _0x4aec79=typeof _0x346cd6[_0x0f69('0x17')]==='undefined'&&typeof _0x346cd6[_0x0f69('0x18')]===_0x0f69('0x19');var _0x32dd93=_0x3e909a[_0x0f69('0x1a')];var _0x388ecd=_0x4aec79?0x0:_0x346cd6[_0x0f69('0x17')];var _0x52acba=_0x4aec79?_0x3e909a[_0x0f69('0x1a')]:_0x346cd6['offset']+_0x346cd6['limit'];var _0x33d87d;if(_0x52acba>=_0x32dd93){_0x52acba=_0x32dd93;_0x33d87d=0xc8;}else{_0x33d87d=0xce;}_0x2e2f12[_0x0f69('0x15')](_0x33d87d);return _0x2e2f12[_0x0f69('0x1b')]('Content-Range',_0x388ecd+'-'+_0x52acba+'/'+_0x32dd93)[_0x0f69('0x16')](_0x3e909a);}return null;};}function patchUpdates(_0x54d186){return function(_0x4a6d67){try{jsonpatch[_0x0f69('0x1c')](_0x4a6d67,_0x54d186,!![]);}catch(_0x235f75){return BPromise[_0x0f69('0x1d')](_0x235f75);}return _0x4a6d67['save']();};}function saveUpdates(_0x36d88a,_0x132148){return function(_0x3027c1){if(_0x3027c1){return _0x3027c1[_0x0f69('0x1e')](_0x36d88a)[_0x0f69('0x1f')](function(_0x24f44c){return _0x24f44c;});}return null;};}function removeEntity(_0x4e0d13,_0x24186b){return function(_0xc82909){if(_0xc82909){return _0xc82909[_0x0f69('0x20')]()[_0x0f69('0x1f')](function(){var _0x1eaac3=_0xc82909[_0x0f69('0x21')]({'plain':!![]});var _0x4beb2f=_0x0f69('0x22');return db[_0x0f69('0x23')]['destroy']({'where':{'type':_0x4beb2f,'resourceId':_0x1eaac3['id']}})['then'](function(){return _0xc82909;});})[_0x0f69('0x1f')](function(){_0x4e0d13[_0x0f69('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559702,_0x5d4edb){return function(_0x3373f8){if(!_0x3373f8){_0x559702[_0x0f69('0x13')](0x194);}return _0x3373f8;};}function handleError(_0x37c4c4,_0x1fe991){_0x1fe991=_0x1fe991||0x1f4;return function(_0x5332bc){logger['error'](_0x5332bc['stack']);if(_0x5332bc[_0x0f69('0x24')]){delete _0x5332bc[_0x0f69('0x24')];}_0x37c4c4[_0x0f69('0x15')](_0x1fe991)['send'](_0x5332bc);};}exports[_0x0f69('0x25')]=function(_0x448c09,_0x65c0bd){var _0x3721c0={},_0x11074e={},_0xbd6419={'count':0x0,'rows':[]};var _0x1c1c7b=_[_0x0f69('0x26')](db['VoiceMusicOnHold'][_0x0f69('0x27')],function(_0xcc0490){return{'name':_0xcc0490[_0x0f69('0x28')],'type':_0xcc0490['type'][_0x0f69('0x29')]};});_0x11074e[_0x0f69('0x2a')]=_[_0x0f69('0x26')](_0x1c1c7b,_0x0f69('0x24'));_0x11074e['query']=_[_0x0f69('0x2b')](_0x448c09[_0x0f69('0x2c')]);_0x11074e['filters']=_[_0x0f69('0x2d')](_0x11074e[_0x0f69('0x2a')],_0x11074e[_0x0f69('0x2c')]);_0x3721c0[_0x0f69('0x2e')]=_[_0x0f69('0x2d')](_0x11074e[_0x0f69('0x2a')],qs[_0x0f69('0x2f')](_0x448c09[_0x0f69('0x2c')][_0x0f69('0x2f')]));_0x3721c0[_0x0f69('0x2e')]=_0x3721c0[_0x0f69('0x2e')][_0x0f69('0x30')]?_0x3721c0[_0x0f69('0x2e')]:_0x11074e[_0x0f69('0x2a')];if(!_0x448c09[_0x0f69('0x2c')][_0x0f69('0x31')](_0x0f69('0x32'))){_0x3721c0[_0x0f69('0x18')]=qs[_0x0f69('0x18')](_0x448c09[_0x0f69('0x2c')][_0x0f69('0x18')]);_0x3721c0[_0x0f69('0x17')]=qs[_0x0f69('0x17')](_0x448c09['query']['offset']);}_0x3721c0['order']=qs['sort'](_0x448c09['query'][_0x0f69('0x33')]);delete _0x448c09['query'][_0x0f69('0x33')];_0x3721c0[_0x0f69('0x34')]=qs[_0x0f69('0x35')](_[_0x0f69('0x36')](_0x448c09[_0x0f69('0x2c')],_0x11074e[_0x0f69('0x35')]),_0x1c1c7b);if(_0x448c09[_0x0f69('0x2c')][_0x0f69('0x37')]){_0x3721c0[_0x0f69('0x34')]=_['merge'](_0x3721c0[_0x0f69('0x34')],{'$or':_[_0x0f69('0x26')](_0x1c1c7b,function(_0x25e028){if(_0x25e028['type']!=='VIRTUAL'){var _0x25ff67={};_0x25ff67[_0x25e028['name']]={'$like':'%'+_0x448c09[_0x0f69('0x2c')]['filter']+'%'};return _0x25ff67;}})});}_0x3721c0=_[_0x0f69('0x38')]({},_0x3721c0,_0x448c09[_0x0f69('0x39')]);var _0x42304f={'where':_0x3721c0[_0x0f69('0x34')]};return db[_0x0f69('0x3a')][_0x0f69('0x1a')](_0x42304f)[_0x0f69('0x1f')](function(_0x4f93ec){_0xbd6419['count']=_0x4f93ec;if(_0x448c09[_0x0f69('0x2c')][_0x0f69('0x3b')]){_0x3721c0[_0x0f69('0x3c')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0f69('0x3d')](_0x3721c0);})[_0x0f69('0x1f')](function(_0x2ff81c){_0xbd6419['rows']=_0x2ff81c;return _0xbd6419;})['then'](respondWithFilteredResult(_0x65c0bd,_0x3721c0))[_0x0f69('0x3e')](handleError(_0x65c0bd,null));};exports[_0x0f69('0x3f')]=function(_0x379aff,_0x4a6c5c){var _0x2e8b8e={'raw':![],'where':{'id':_0x379aff['params']['id']}},_0x422fa4={};_0x422fa4[_0x0f69('0x2a')]=_[_0x0f69('0x2b')](db[_0x0f69('0x3a')]['rawAttributes']);_0x422fa4['query']=_['keys'](_0x379aff['query']);_0x422fa4[_0x0f69('0x35')]=_[_0x0f69('0x2d')](_0x422fa4[_0x0f69('0x2a')],_0x422fa4['query']);_0x2e8b8e[_0x0f69('0x2e')]=_[_0x0f69('0x2d')](_0x422fa4[_0x0f69('0x2a')],qs[_0x0f69('0x2f')](_0x379aff[_0x0f69('0x2c')][_0x0f69('0x2f')]));_0x2e8b8e['attributes']=_0x2e8b8e[_0x0f69('0x2e')][_0x0f69('0x30')]?_0x2e8b8e[_0x0f69('0x2e')]:_0x422fa4['model'];if(_0x379aff['query']['includeAll']){_0x2e8b8e[_0x0f69('0x3c')]=[{'all':!![]}];}_0x2e8b8e=_[_0x0f69('0x38')]({},_0x2e8b8e,_0x379aff[_0x0f69('0x39')]);return db[_0x0f69('0x3a')]['find'](_0x2e8b8e)[_0x0f69('0x1f')](handleEntityNotFound(_0x4a6c5c,null))[_0x0f69('0x1f')](respondWithResult(_0x4a6c5c,null))[_0x0f69('0x3e')](handleError(_0x4a6c5c,null));};exports['update']=function(_0x5c0f67,_0x5a6310){if(_0x5c0f67['body']['id']){delete _0x5c0f67[_0x0f69('0x40')]['id'];}return db['VoiceMusicOnHold'][_0x0f69('0x41')]({'where':{'id':_0x5c0f67['params']['id']}})[_0x0f69('0x1f')](handleEntityNotFound(_0x5a6310,null))[_0x0f69('0x1f')](saveUpdates(_0x5c0f67[_0x0f69('0x40')],null))[_0x0f69('0x1f')](respondWithResult(_0x5a6310,null))[_0x0f69('0x3e')](handleError(_0x5a6310,null));};exports[_0x0f69('0x42')]=function(_0xa85b44,_0x5ef3bf,_0x6d033b){return db[_0x0f69('0x43')][_0x0f69('0x44')](function(_0x56dd86){if(_0xa85b44[_0x0f69('0x40')]['mode']===_0x0f69('0x45')){_0xa85b44['body']['directory']=path[_0x0f69('0x46')](config[_0x0f69('0x47')],_0x0f69('0x48'),_0xa85b44['body'][_0x0f69('0x24')]);}return db['VoiceMusicOnHold'][_0x0f69('0x42')](_0xa85b44[_0x0f69('0x40')],{'transaction':_0x56dd86})[_0x0f69('0x1f')](function(_0x1e2a42){if(_0xa85b44[_0x0f69('0x40')][_0x0f69('0x49')]===_0x0f69('0x45')){fs[_0x0f69('0x4a')](_0x1e2a42[_0x0f69('0x4b')],parseInt(_0x0f69('0x4c'),0x8));}var _0x72d652=_0xa85b44[_0x0f69('0x4d')][_0x0f69('0x21')]({'plain':!![]});if(!_0x72d652)throw new Error(_0x0f69('0x4e'));if(_0x72d652[_0x0f69('0x4f')]==='user'){var _0x4bc1bd=_0x1e2a42[_0x0f69('0x21')]({'plain':!![]});return db[_0x0f69('0x50')][_0x0f69('0x41')]({'where':{'name':_0x0f69('0x22'),'userProfileId':_0x72d652['userProfileId']},'raw':!![]})[_0x0f69('0x1f')](function(_0x269611){if(_0x269611&&_0x269611[_0x0f69('0x51')]===0x0){return db[_0x0f69('0x23')]['create']({'name':_0x4bc1bd[_0x0f69('0x24')],'resourceId':_0x4bc1bd['id'],'type':_0x269611[_0x0f69('0x24')],'sectionId':_0x269611['id']},{})['then'](function(){return _0x1e2a42;});}else{return _0x1e2a42;}})[_0x0f69('0x3e')](function(_0x5b26ed){logger[_0x0f69('0x52')](_0x0f69('0x53'),_0x5b26ed);});}return _0x1e2a42;});})['then'](respondWithResult(_0x5ef3bf,0xc9))[_0x0f69('0x3e')](handleError(_0x5ef3bf,null));};exports['destroy']=function(_0x50cb55,_0x27a6a8,_0x3f669a){var _0x506a40;return db[_0x0f69('0x3a')]['find']({'where':{'id':_0x50cb55['params']['id']}})[_0x0f69('0x1f')](function(_0x107799){if(_0x107799){return db[_0x0f69('0x43')][_0x0f69('0x44')](function(_0x236b62){return _0x107799[_0x0f69('0x20')]({'transaction':_0x236b62,'raw':!![]})['then'](function(_0x34badd){if(_0x34badd[_0x0f69('0x4b')]){fs[_0x0f69('0x54')](_0x34badd[_0x0f69('0x4b')])[_0x0f69('0x55')](function(_0x4e31c8){fs[_0x0f69('0x56')](path[_0x0f69('0x46')](_0x34badd[_0x0f69('0x4b')],_0x4e31c8));});fs[_0x0f69('0x57')](_0x34badd['directory']);}return _0x34badd;});})[_0x0f69('0x3e')](function(_0x26ee74){throw new db[(_0x0f69('0x58'))][(_0x0f69('0x59'))](_0x26ee74[_0x0f69('0x5a')]);});}})[_0x0f69('0x1f')](handleEntityNotFound(_0x27a6a8,null))['then'](removeEntity(_0x27a6a8,null))['catch'](handleError(_0x27a6a8,null));};exports[_0x0f69('0x5b')]=function(_0x153259,_0x28697c,_0x49d735){return db[_0x0f69('0x43')][_0x0f69('0x44')](function(_0x11970f){var _0x2bfbbf;return db[_0x0f69('0x3a')][_0x0f69('0x41')]({'where':{'id':_0x153259[_0x0f69('0x5c')]['id']}})[_0x0f69('0x1f')](function(_0xa94036){if(_0xa94036){_0x2bfbbf=_0xa94036;return _0xa94036[_0x0f69('0x5b')](_0x153259[_0x0f69('0x40')]['id'],{'transaction':_0x11970f});}})[_0x0f69('0x1f')](function(_0x408028){if(_0x408028){return db[_0x0f69('0x5d')][_0x0f69('0x5e')]({'where':{'id':_0x153259[_0x0f69('0x40')]['id']},'attributes':['id',_0x0f69('0x24'),_0x0f69('0x5f'),_0x0f69('0x60'),'createdAt'],'raw':!![]});}})[_0x0f69('0x1f')](function(_0x13d0c6){if(_0x13d0c6){var _0x401c9d=path[_0x0f69('0x46')](config[_0x0f69('0x47')],_0x0f69('0x61'),util[_0x0f69('0x62')](_0x0f69('0x63'),path[_0x0f69('0x64')](_0x13d0c6[_0x0f69('0x5f')],path[_0x0f69('0x65')](_0x13d0c6[_0x0f69('0x5f')])),_0x13d0c6[_0x0f69('0x60')]));var _0x3ad63b=path[_0x0f69('0x46')](config[_0x0f69('0x47')],_0x0f69('0x48'),_0x2bfbbf['name'],util[_0x0f69('0x62')](_0x0f69('0x63'),_0x13d0c6[_0x0f69('0x24')],_0x13d0c6[_0x0f69('0x60')]));fs[_0x0f69('0x66')](_0x401c9d,_0x3ad63b);return _0x13d0c6;}})[_0x0f69('0x3e')](function(_0x2a347d){throw new db[(_0x0f69('0x58'))][(_0x0f69('0x59'))](_0x2a347d[_0x0f69('0x5a')]);});})[_0x0f69('0x1f')](handleEntityNotFound(_0x28697c,null))[_0x0f69('0x1f')](respondWithResult(_0x28697c,0xc9))[_0x0f69('0x3e')](handleError(_0x28697c,null));};exports[_0x0f69('0x67')]=function(_0x3baae2,_0xf3125c,_0x122ea7){return db[_0x0f69('0x43')][_0x0f69('0x44')](function(_0x53b076){var _0x2c9571;return db[_0x0f69('0x3a')][_0x0f69('0x5e')]({'where':{'id':_0x3baae2[_0x0f69('0x5c')]['id']}})[_0x0f69('0x1f')](handleEntityNotFound(_0xf3125c,null))[_0x0f69('0x1f')](function(_0x197702){if(_0x197702){_0x2c9571=_0x197702;return _0x197702[_0x0f69('0x67')](_0x3baae2[_0x0f69('0x5c')][_0x0f69('0x68')]);}})[_0x0f69('0x1f')](function(_0x4ced75){if(_0x4ced75){return db['Sound'][_0x0f69('0x5e')]({'where':{'id':_0x3baae2[_0x0f69('0x5c')][_0x0f69('0x68')]},'attributes':['id',_0x0f69('0x24'),_0x0f69('0x5f'),'converted_format',_0x0f69('0x69')],'raw':!![]});}})['then'](function(_0x4697cd){if(_0x4697cd){fs[_0x0f69('0x56')](path[_0x0f69('0x46')](_0x2c9571[_0x0f69('0x4b')],util[_0x0f69('0x62')](_0x0f69('0x63'),_0x4697cd[_0x0f69('0x24')],_0x4697cd[_0x0f69('0x60')])));return _0x4697cd;}})[_0x0f69('0x3e')](function(_0x2955bb){throw new db[(_0x0f69('0x58'))]['ValidationError'](_0x2955bb['message']);});})[_0x0f69('0x1f')](handleEntityNotFound(_0xf3125c,null))[_0x0f69('0x1f')](respondWithStatusCode(_0xf3125c,0xcc))['catch'](handleError(_0xf3125c,null));};exports[_0x0f69('0x6a')]=function(_0x1487ca,_0x56ce35,_0x3bd8b5){var _0x2695d0={};var _0x5540f1={};var _0x3be9ff;var _0x1bef4f;return db[_0x0f69('0x3a')]['findOne']({'where':{'id':_0x1487ca['params']['id']}})['then'](handleEntityNotFound(_0x56ce35,null))['then'](function(_0x11df04){if(_0x11df04){_0x3be9ff=_0x11df04;_0x5540f1['model']=_[_0x0f69('0x2b')](db[_0x0f69('0x5d')][_0x0f69('0x27')]);_0x5540f1[_0x0f69('0x2c')]=_[_0x0f69('0x2b')](_0x1487ca[_0x0f69('0x2c')]);_0x5540f1[_0x0f69('0x35')]=_[_0x0f69('0x2d')](_0x5540f1[_0x0f69('0x2a')],_0x5540f1[_0x0f69('0x2c')]);_0x2695d0[_0x0f69('0x2e')]=_[_0x0f69('0x2d')](_0x5540f1[_0x0f69('0x2a')],qs[_0x0f69('0x2f')](_0x1487ca[_0x0f69('0x2c')]['fields']));_0x2695d0[_0x0f69('0x2e')]=_0x2695d0[_0x0f69('0x2e')][_0x0f69('0x30')]?_0x2695d0[_0x0f69('0x2e')]:_0x5540f1[_0x0f69('0x2a')];_0x2695d0[_0x0f69('0x6b')]=qs[_0x0f69('0x33')](_0x1487ca[_0x0f69('0x2c')][_0x0f69('0x33')]);_0x2695d0[_0x0f69('0x34')]=qs['filters'](_['pick'](_0x1487ca['query'],_0x5540f1[_0x0f69('0x35')]));if(_0x1487ca[_0x0f69('0x2c')][_0x0f69('0x37')]){_0x2695d0[_0x0f69('0x34')]=_[_0x0f69('0x38')](_0x2695d0['where'],{'$or':_['map'](_0x2695d0[_0x0f69('0x2e')],function(_0x4c1511){var _0x2f0890={};_0x2f0890[_0x4c1511]={'$like':'%'+_0x1487ca[_0x0f69('0x2c')][_0x0f69('0x37')]+'%'};return _0x2f0890;})});}_0x2695d0=_['merge']({},_0x2695d0,_0x1487ca[_0x0f69('0x39')]);return _0x3be9ff[_0x0f69('0x6a')](_0x2695d0);}})[_0x0f69('0x1f')](function(_0x4bd3e2){if(_0x4bd3e2){_0x1bef4f=_0x4bd3e2[_0x0f69('0x30')];if(!_0x1487ca[_0x0f69('0x2c')][_0x0f69('0x31')]('nolimit')){_0x2695d0[_0x0f69('0x18')]=qs[_0x0f69('0x18')](_0x1487ca['query'][_0x0f69('0x18')]);_0x2695d0[_0x0f69('0x17')]=qs[_0x0f69('0x17')](_0x1487ca['query'][_0x0f69('0x17')]);}return _0x3be9ff[_0x0f69('0x6a')](_0x2695d0);}})[_0x0f69('0x1f')](function(_0x1a15ad){if(_0x1a15ad){return _0x1a15ad?{'count':_0x1bef4f,'rows':_0x1a15ad}:null;}})[_0x0f69('0x1f')](respondWithResult(_0x56ce35,null))[_0x0f69('0x3e')](handleError(_0x56ce35,null));}; \ No newline at end of file +var _0xceba=['save','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','VoiceMusicOnHold','includeAll','include','findAll','rows','catch','show','params','length','merge','find','body','create','sequelize','transaction','files','directory','join','root','mode','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','unlinkSync','rmdirSync','ValidationError','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','basename','save_name','extname','%s.%s','converted_format','Sequelize','message','removeSound','id2','getSounds','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject'];(function(_0xf93b08,_0x2559d7){var _0x12f72e=function(_0x30534b){while(--_0x30534b){_0xf93b08['push'](_0xf93b08['shift']());}};_0x12f72e(++_0x2559d7);}(_0xceba,0x133));var _0xaceb=function(_0x343910,_0xac70a3){_0x343910=_0x343910-0x0;var _0xb23d30=_0xceba[_0x343910];return _0xb23d30;};'use strict';var emlformat=require(_0xaceb('0x0'));var rimraf=require(_0xaceb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaceb('0x2'));var rp=require('request-promise');var moment=require(_0xaceb('0x3'));var BPromise=require(_0xaceb('0x4'));var Mustache=require(_0xaceb('0x5'));var util=require(_0xaceb('0x6'));var path=require(_0xaceb('0x7'));var sox=require(_0xaceb('0x8'));var csv=require(_0xaceb('0x9'));var ejs=require(_0xaceb('0xa'));var fs=require('fs');var fs_extra=require(_0xaceb('0xb'));var _=require('lodash');var squel=require(_0xaceb('0xc'));var crypto=require(_0xaceb('0xd'));var jsforce=require(_0xaceb('0xe'));var deskjs=require(_0xaceb('0xf'));var toCsv=require(_0xaceb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaceb('0x10'));var authService=require(_0xaceb('0x11'));var qs=require(_0xaceb('0x12'));var as=require(_0xaceb('0x13'));var hardwareService=require(_0xaceb('0x14'));var logger=require('../../config/logger')(_0xaceb('0x15'));var utils=require(_0xaceb('0x16'));var config=require(_0xaceb('0x17'));var licenseUtil=require(_0xaceb('0x18'));var db=require(_0xaceb('0x19'))['db'];function respondWithStatusCode(_0xef386a,_0x5186db){_0x5186db=_0x5186db||0xcc;return function(_0x162454){if(_0x162454){return _0xef386a['sendStatus'](_0x5186db);}return _0xef386a[_0xaceb('0x1a')](_0x5186db)[_0xaceb('0x1b')]();};}function respondWithResult(_0x78341d,_0x3261e2){_0x3261e2=_0x3261e2||0xc8;return function(_0x7c84b3){if(_0x7c84b3){return _0x78341d[_0xaceb('0x1a')](_0x3261e2)[_0xaceb('0x1c')](_0x7c84b3);}};}function respondWithFilteredResult(_0x3a7d14,_0x4a8a77){return function(_0x1257be){if(_0x1257be){var _0x541424=typeof _0x4a8a77[_0xaceb('0x1d')]===_0xaceb('0x1e')&&typeof _0x4a8a77[_0xaceb('0x1f')]==='undefined';var _0x5dd5cb=_0x1257be[_0xaceb('0x20')];var _0x122dda=_0x541424?0x0:_0x4a8a77['offset'];var _0x10bda9=_0x541424?_0x1257be[_0xaceb('0x20')]:_0x4a8a77[_0xaceb('0x1d')]+_0x4a8a77[_0xaceb('0x1f')];var _0x4ad079;if(_0x10bda9>=_0x5dd5cb){_0x10bda9=_0x5dd5cb;_0x4ad079=0xc8;}else{_0x4ad079=0xce;}_0x3a7d14[_0xaceb('0x1a')](_0x4ad079);return _0x3a7d14[_0xaceb('0x21')]('Content-Range',_0x122dda+'-'+_0x10bda9+'/'+_0x5dd5cb)[_0xaceb('0x1c')](_0x1257be);}return null;};}function patchUpdates(_0x2fffe7){return function(_0x97d863){try{jsonpatch['apply'](_0x97d863,_0x2fffe7,!![]);}catch(_0x14ce51){return BPromise[_0xaceb('0x22')](_0x14ce51);}return _0x97d863[_0xaceb('0x23')]();};}function saveUpdates(_0x3e61e2,_0xa40434){return function(_0x270e04){if(_0x270e04){return _0x270e04[_0xaceb('0x24')](_0x3e61e2)['then'](function(_0x22ea8f){return _0x22ea8f;});}return null;};}function removeEntity(_0x549888,_0x23318d){return function(_0x2a1140){if(_0x2a1140){return _0x2a1140['destroy']()[_0xaceb('0x25')](function(){var _0x4bdfaa=_0x2a1140[_0xaceb('0x26')]({'plain':!![]});var _0x4b4065=_0xaceb('0x27');return db[_0xaceb('0x28')][_0xaceb('0x29')]({'where':{'type':_0x4b4065,'resourceId':_0x4bdfaa['id']}})['then'](function(){return _0x2a1140;});})[_0xaceb('0x25')](function(){_0x549888[_0xaceb('0x1a')](0xcc)[_0xaceb('0x1b')]();});}};}function handleEntityNotFound(_0x592255,_0xfc3567){return function(_0x4cbf4f){if(!_0x4cbf4f){_0x592255['sendStatus'](0x194);}return _0x4cbf4f;};}function handleError(_0x3db34a,_0x914560){_0x914560=_0x914560||0x1f4;return function(_0x391edc){logger[_0xaceb('0x2a')](_0x391edc[_0xaceb('0x2b')]);if(_0x391edc['name']){delete _0x391edc['name'];}_0x3db34a[_0xaceb('0x1a')](_0x914560)[_0xaceb('0x2c')](_0x391edc);};}exports['index']=function(_0x4779d7,_0x5353e4){var _0x18c847={},_0x31f06c={},_0x1629b7={'count':0x0,'rows':[]};var _0xbf3b9d=_[_0xaceb('0x2d')](db['VoiceMusicOnHold'][_0xaceb('0x2e')],function(_0xaa064b){return{'name':_0xaa064b[_0xaceb('0x2f')],'type':_0xaa064b[_0xaceb('0x30')][_0xaceb('0x31')]};});_0x31f06c[_0xaceb('0x32')]=_[_0xaceb('0x2d')](_0xbf3b9d,_0xaceb('0x33'));_0x31f06c[_0xaceb('0x34')]=_[_0xaceb('0x35')](_0x4779d7['query']);_0x31f06c[_0xaceb('0x36')]=_[_0xaceb('0x37')](_0x31f06c[_0xaceb('0x32')],_0x31f06c[_0xaceb('0x34')]);_0x18c847['attributes']=_[_0xaceb('0x37')](_0x31f06c['model'],qs[_0xaceb('0x38')](_0x4779d7[_0xaceb('0x34')][_0xaceb('0x38')]));_0x18c847[_0xaceb('0x39')]=_0x18c847['attributes']['length']?_0x18c847[_0xaceb('0x39')]:_0x31f06c['model'];if(!_0x4779d7['query'][_0xaceb('0x3a')](_0xaceb('0x3b'))){_0x18c847['limit']=qs[_0xaceb('0x1f')](_0x4779d7[_0xaceb('0x34')][_0xaceb('0x1f')]);_0x18c847[_0xaceb('0x1d')]=qs['offset'](_0x4779d7['query'][_0xaceb('0x1d')]);}_0x18c847[_0xaceb('0x3c')]=qs['sort'](_0x4779d7['query'][_0xaceb('0x3d')]);delete _0x4779d7[_0xaceb('0x34')][_0xaceb('0x3d')];_0x18c847[_0xaceb('0x3e')]=qs[_0xaceb('0x36')](_[_0xaceb('0x3f')](_0x4779d7[_0xaceb('0x34')],_0x31f06c[_0xaceb('0x36')]),_0xbf3b9d);if(_0x4779d7['query']['filter']){_0x18c847[_0xaceb('0x3e')]=_['merge'](_0x18c847[_0xaceb('0x3e')],{'$or':_[_0xaceb('0x2d')](_0xbf3b9d,function(_0x421d33){if(_0x421d33[_0xaceb('0x30')]!==_0xaceb('0x40')){var _0x45e73={};_0x45e73[_0x421d33['name']]={'$like':'%'+_0x4779d7[_0xaceb('0x34')][_0xaceb('0x41')]+'%'};return _0x45e73;}})});}_0x18c847=_['merge']({},_0x18c847,_0x4779d7[_0xaceb('0x42')]);var _0x49f4f4={'where':_0x18c847[_0xaceb('0x3e')]};return db[_0xaceb('0x43')]['count'](_0x49f4f4)[_0xaceb('0x25')](function(_0x3ad8ae){_0x1629b7[_0xaceb('0x20')]=_0x3ad8ae;if(_0x4779d7[_0xaceb('0x34')][_0xaceb('0x44')]){_0x18c847[_0xaceb('0x45')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xaceb('0x46')](_0x18c847);})[_0xaceb('0x25')](function(_0x3efb2a){_0x1629b7[_0xaceb('0x47')]=_0x3efb2a;return _0x1629b7;})[_0xaceb('0x25')](respondWithFilteredResult(_0x5353e4,_0x18c847))[_0xaceb('0x48')](handleError(_0x5353e4,null));};exports[_0xaceb('0x49')]=function(_0x322d55,_0x29f6a2){var _0x27e4ea={'raw':![],'where':{'id':_0x322d55[_0xaceb('0x4a')]['id']}},_0x2281cf={};_0x2281cf[_0xaceb('0x32')]=_['keys'](db[_0xaceb('0x43')]['rawAttributes']);_0x2281cf['query']=_[_0xaceb('0x35')](_0x322d55[_0xaceb('0x34')]);_0x2281cf[_0xaceb('0x36')]=_[_0xaceb('0x37')](_0x2281cf[_0xaceb('0x32')],_0x2281cf[_0xaceb('0x34')]);_0x27e4ea[_0xaceb('0x39')]=_[_0xaceb('0x37')](_0x2281cf[_0xaceb('0x32')],qs[_0xaceb('0x38')](_0x322d55['query'][_0xaceb('0x38')]));_0x27e4ea[_0xaceb('0x39')]=_0x27e4ea[_0xaceb('0x39')][_0xaceb('0x4b')]?_0x27e4ea['attributes']:_0x2281cf[_0xaceb('0x32')];if(_0x322d55['query']['includeAll']){_0x27e4ea[_0xaceb('0x45')]=[{'all':!![]}];}_0x27e4ea=_[_0xaceb('0x4c')]({},_0x27e4ea,_0x322d55[_0xaceb('0x42')]);return db[_0xaceb('0x43')][_0xaceb('0x4d')](_0x27e4ea)[_0xaceb('0x25')](handleEntityNotFound(_0x29f6a2,null))[_0xaceb('0x25')](respondWithResult(_0x29f6a2,null))[_0xaceb('0x48')](handleError(_0x29f6a2,null));};exports['update']=function(_0x500a99,_0x5e2e7f){if(_0x500a99[_0xaceb('0x4e')]['id']){delete _0x500a99[_0xaceb('0x4e')]['id'];}return db['VoiceMusicOnHold'][_0xaceb('0x4d')]({'where':{'id':_0x500a99[_0xaceb('0x4a')]['id']}})[_0xaceb('0x25')](handleEntityNotFound(_0x5e2e7f,null))[_0xaceb('0x25')](saveUpdates(_0x500a99['body'],null))[_0xaceb('0x25')](respondWithResult(_0x5e2e7f,null))['catch'](handleError(_0x5e2e7f,null));};exports[_0xaceb('0x4f')]=function(_0x1bef61,_0x3a8d20,_0x5265ec){return db[_0xaceb('0x50')][_0xaceb('0x51')](function(_0x59e792){if(_0x1bef61['body']['mode']===_0xaceb('0x52')){_0x1bef61[_0xaceb('0x4e')][_0xaceb('0x53')]=path[_0xaceb('0x54')](config[_0xaceb('0x55')],'server/files/moh',_0x1bef61['body'][_0xaceb('0x33')]);}return db[_0xaceb('0x43')][_0xaceb('0x4f')](_0x1bef61[_0xaceb('0x4e')],{'transaction':_0x59e792})[_0xaceb('0x25')](function(_0x2c1d4e){if(_0x1bef61[_0xaceb('0x4e')][_0xaceb('0x56')]===_0xaceb('0x52')){fs['mkdirSync'](_0x2c1d4e['directory'],parseInt(_0xaceb('0x57'),0x8));}var _0x306d61=_0x1bef61['user'][_0xaceb('0x26')]({'plain':!![]});if(!_0x306d61)throw new Error(_0xaceb('0x58'));if(_0x306d61[_0xaceb('0x59')]===_0xaceb('0x5a')){var _0x10dc5a=_0x2c1d4e[_0xaceb('0x26')]({'plain':!![]});return db[_0xaceb('0x5b')][_0xaceb('0x4d')]({'where':{'name':_0xaceb('0x27'),'userProfileId':_0x306d61['userProfileId']},'raw':!![]})[_0xaceb('0x25')](function(_0x1ee6d7){if(_0x1ee6d7&&_0x1ee6d7[_0xaceb('0x5c')]===0x0){return db[_0xaceb('0x28')][_0xaceb('0x4f')]({'name':_0x10dc5a['name'],'resourceId':_0x10dc5a['id'],'type':_0x1ee6d7[_0xaceb('0x33')],'sectionId':_0x1ee6d7['id']},{})['then'](function(){return _0x2c1d4e;});}else{return _0x2c1d4e;}})[_0xaceb('0x48')](function(_0x405647){logger[_0xaceb('0x2a')](_0xaceb('0x5d'),_0x405647);});}return _0x2c1d4e;});})['then'](respondWithResult(_0x3a8d20,0xc9))[_0xaceb('0x48')](handleError(_0x3a8d20,null));};exports[_0xaceb('0x29')]=function(_0x41cb13,_0x3a641f,_0x579c93){var _0xe72a6;return db[_0xaceb('0x43')]['find']({'where':{'id':_0x41cb13[_0xaceb('0x4a')]['id']}})[_0xaceb('0x25')](function(_0x1d3994){if(_0x1d3994){return db['sequelize']['transaction'](function(_0x5e0327){return _0x1d3994[_0xaceb('0x29')]({'transaction':_0x5e0327,'raw':!![]})['then'](function(_0x5d78c8){if(_0x5d78c8['directory']){fs['readdirSync'](_0x5d78c8[_0xaceb('0x53')])[_0xaceb('0x5e')](function(_0xaf88a3){fs[_0xaceb('0x5f')](path[_0xaceb('0x54')](_0x5d78c8[_0xaceb('0x53')],_0xaf88a3));});fs[_0xaceb('0x60')](_0x5d78c8[_0xaceb('0x53')]);}return _0x5d78c8;});})[_0xaceb('0x48')](function(_0x3d3fa6){throw new db['Sequelize'][(_0xaceb('0x61'))](_0x3d3fa6['message']);});}})[_0xaceb('0x25')](handleEntityNotFound(_0x3a641f,null))[_0xaceb('0x25')](removeEntity(_0x3a641f,null))[_0xaceb('0x48')](handleError(_0x3a641f,null));};exports[_0xaceb('0x62')]=function(_0x313bb6,_0x5089de,_0x115388){return db[_0xaceb('0x50')][_0xaceb('0x51')](function(_0x5d7a61){var _0x4d6009;return db[_0xaceb('0x43')][_0xaceb('0x4d')]({'where':{'id':_0x313bb6['params']['id']}})[_0xaceb('0x25')](function(_0x16aa6c){if(_0x16aa6c){_0x4d6009=_0x16aa6c;return _0x16aa6c[_0xaceb('0x62')](_0x313bb6['body']['id'],{'transaction':_0x5d7a61});}})[_0xaceb('0x25')](function(_0x10521c){if(_0x10521c){return db[_0xaceb('0x63')][_0xaceb('0x64')]({'where':{'id':_0x313bb6[_0xaceb('0x4e')]['id']},'attributes':['id',_0xaceb('0x33'),'save_name','converted_format',_0xaceb('0x65')],'raw':!![]});}})[_0xaceb('0x25')](function(_0x4e94d7){if(_0x4e94d7){var _0x482bb4=path[_0xaceb('0x54')](config[_0xaceb('0x55')],_0xaceb('0x66'),util[_0xaceb('0x67')]('%s.%s',path[_0xaceb('0x68')](_0x4e94d7[_0xaceb('0x69')],path[_0xaceb('0x6a')](_0x4e94d7[_0xaceb('0x69')])),_0x4e94d7['converted_format']));var _0x306ff0=path[_0xaceb('0x54')](config['root'],'server/files/moh',_0x4d6009[_0xaceb('0x33')],util[_0xaceb('0x67')](_0xaceb('0x6b'),_0x4e94d7[_0xaceb('0x33')],_0x4e94d7[_0xaceb('0x6c')]));fs['symlinkSync'](_0x482bb4,_0x306ff0);return _0x4e94d7;}})['catch'](function(_0x2fe862){throw new db[(_0xaceb('0x6d'))][(_0xaceb('0x61'))](_0x2fe862[_0xaceb('0x6e')]);});})[_0xaceb('0x25')](handleEntityNotFound(_0x5089de,null))[_0xaceb('0x25')](respondWithResult(_0x5089de,0xc9))[_0xaceb('0x48')](handleError(_0x5089de,null));};exports[_0xaceb('0x6f')]=function(_0x4437c8,_0x52c2a2,_0x26c355){return db[_0xaceb('0x50')]['transaction'](function(_0x34a021){var _0x5b1788;return db['VoiceMusicOnHold'][_0xaceb('0x64')]({'where':{'id':_0x4437c8[_0xaceb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52c2a2,null))[_0xaceb('0x25')](function(_0x155145){if(_0x155145){_0x5b1788=_0x155145;return _0x155145[_0xaceb('0x6f')](_0x4437c8[_0xaceb('0x4a')][_0xaceb('0x70')]);}})['then'](function(_0x72cf0b){if(_0x72cf0b){return db['Sound'][_0xaceb('0x64')]({'where':{'id':_0x4437c8[_0xaceb('0x4a')]['id2']},'attributes':['id',_0xaceb('0x33'),_0xaceb('0x69'),_0xaceb('0x6c'),_0xaceb('0x65')],'raw':!![]});}})[_0xaceb('0x25')](function(_0x57549d){if(_0x57549d){fs['unlinkSync'](path[_0xaceb('0x54')](_0x5b1788[_0xaceb('0x53')],util[_0xaceb('0x67')](_0xaceb('0x6b'),_0x57549d['name'],_0x57549d[_0xaceb('0x6c')])));return _0x57549d;}})['catch'](function(_0x45dabe){throw new db['Sequelize']['ValidationError'](_0x45dabe[_0xaceb('0x6e')]);});})[_0xaceb('0x25')](handleEntityNotFound(_0x52c2a2,null))[_0xaceb('0x25')](respondWithStatusCode(_0x52c2a2,0xcc))[_0xaceb('0x48')](handleError(_0x52c2a2,null));};exports['getSounds']=function(_0x1fe77e,_0x13d9f9,_0x4a26b3){var _0x3e015f={};var _0x1725b7={};var _0x183535;var _0x228f33;return db[_0xaceb('0x43')][_0xaceb('0x64')]({'where':{'id':_0x1fe77e[_0xaceb('0x4a')]['id']}})[_0xaceb('0x25')](handleEntityNotFound(_0x13d9f9,null))[_0xaceb('0x25')](function(_0x2e3ac0){if(_0x2e3ac0){_0x183535=_0x2e3ac0;_0x1725b7['model']=_[_0xaceb('0x35')](db[_0xaceb('0x63')]['rawAttributes']);_0x1725b7['query']=_[_0xaceb('0x35')](_0x1fe77e['query']);_0x1725b7['filters']=_['intersection'](_0x1725b7[_0xaceb('0x32')],_0x1725b7['query']);_0x3e015f['attributes']=_[_0xaceb('0x37')](_0x1725b7[_0xaceb('0x32')],qs[_0xaceb('0x38')](_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x38')]));_0x3e015f[_0xaceb('0x39')]=_0x3e015f[_0xaceb('0x39')][_0xaceb('0x4b')]?_0x3e015f[_0xaceb('0x39')]:_0x1725b7['model'];_0x3e015f[_0xaceb('0x3c')]=qs[_0xaceb('0x3d')](_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x3d')]);_0x3e015f['where']=qs[_0xaceb('0x36')](_[_0xaceb('0x3f')](_0x1fe77e[_0xaceb('0x34')],_0x1725b7[_0xaceb('0x36')]));if(_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x41')]){_0x3e015f[_0xaceb('0x3e')]=_[_0xaceb('0x4c')](_0x3e015f['where'],{'$or':_[_0xaceb('0x2d')](_0x3e015f[_0xaceb('0x39')],function(_0x3d5576){var _0xc6eaf6={};_0xc6eaf6[_0x3d5576]={'$like':'%'+_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x41')]+'%'};return _0xc6eaf6;})});}_0x3e015f=_['merge']({},_0x3e015f,_0x1fe77e['options']);return _0x183535[_0xaceb('0x71')](_0x3e015f);}})[_0xaceb('0x25')](function(_0x1d9c3e){if(_0x1d9c3e){_0x228f33=_0x1d9c3e[_0xaceb('0x4b')];if(!_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x3a')](_0xaceb('0x3b'))){_0x3e015f[_0xaceb('0x1f')]=qs[_0xaceb('0x1f')](_0x1fe77e[_0xaceb('0x34')]['limit']);_0x3e015f[_0xaceb('0x1d')]=qs[_0xaceb('0x1d')](_0x1fe77e[_0xaceb('0x34')][_0xaceb('0x1d')]);}return _0x183535['getSounds'](_0x3e015f);}})['then'](function(_0x251601){if(_0x251601){return _0x251601?{'count':_0x228f33,'rows':_0x251601}:null;}})[_0xaceb('0x25')](respondWithResult(_0x13d9f9,null))[_0xaceb('0x48')](handleError(_0x13d9f9,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4a53150..2fc6ffa 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 _0x680b=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util','api','moment','request-promise'];(function(_0x2b4708,_0x2bc993){var _0x59d58f=function(_0x279c14){while(--_0x279c14){_0x2b4708['push'](_0x2b4708['shift']());}};_0x59d58f(++_0x2bc993);}(_0x680b,0x140));var _0xb680=function(_0xbbb567,_0x97be8a){_0xbbb567=_0xbbb567-0x0;var _0x59e2c7=_0x680b[_0xbbb567];return _0x59e2c7;};'use strict';var _=require('lodash');var util=require(_0xb680('0x0'));var logger=require('../../config/logger')(_0xb680('0x1'));var moment=require(_0xb680('0x2'));var BPromise=require('bluebird');var rp=require(_0xb680('0x3'));var fs=require('fs');var path=require(_0xb680('0x4'));var rimraf=require(_0xb680('0x5'));var config=require(_0xb680('0x6'));var attributes=require(_0xb680('0x7'));module[_0xb680('0x8')]=function(_0x3e6f3a,_0x404f08){return _0x3e6f3a[_0xb680('0x9')](_0xb680('0xa'),attributes,{'tableName':_0xb680('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6b67=['define','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x332520,_0x590487){var _0x15a9f2=function(_0x5a4cfc){while(--_0x5a4cfc){_0x332520['push'](_0x332520['shift']());}};_0x15a9f2(++_0x590487);}(_0x6b67,0xbf));var _0x76b6=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x6b67[_0x1416fc];return _0x3a4b34;};'use strict';var _=require(_0x76b6('0x0'));var util=require(_0x76b6('0x1'));var logger=require(_0x76b6('0x2'))(_0x76b6('0x3'));var moment=require('moment');var BPromise=require(_0x76b6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76b6('0x5'));var rimraf=require(_0x76b6('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0xf1c539,_0x336543){return _0xf1c539[_0x76b6('0x7')]('VoiceMusicOnHold',attributes,{'tableName':_0x76b6('0x8'),'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 db89fdd..1939646 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22c72a,_0x47dd9){var _0x3d9ce5=function(_0x540698){while(--_0x540698){_0x22c72a['push'](_0x22c72a['shift']());}};_0x3d9ce5(++_0x47dd9);}(_0x70e0,0x17b));var _0x070e=function(_0x421290,_0xd638e7){_0x421290=_0x421290-0x0;var _0x563da7=_0x70e0[_0x421290];return _0x563da7;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +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(_0x933ff5,_0x97919a){var _0x47d99b=function(_0xf876c8){while(--_0xf876c8){_0x933ff5['push'](_0x933ff5['shift']());}};_0x47d99b(++_0x97919a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 06dd9e4..deb5617 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 _0x90d2=['getAgents','getTeams','post','create','/:id/users','addAgents','addTeams','put','delete','destroy','removeAgents','/:id/teams','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x309449,_0x5300fd){var _0x16b34a=function(_0x555df9){while(--_0x555df9){_0x309449['push'](_0x309449['shift']());}};_0x16b34a(++_0x5300fd);}(_0x90d2,0x64));var _0x290d=function(_0x21a3f4,_0x42396e){_0x21a3f4=_0x21a3f4-0x0;var _0x3d7312=_0x90d2[_0x21a3f4];return _0x3d7312;};'use strict';var multer=require(_0x290d('0x0'));var util=require(_0x290d('0x1'));var path=require(_0x290d('0x2'));var timeout=require(_0x290d('0x3'));var express=require('express');var router=express[_0x290d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x290d('0x5'));var interaction=require(_0x290d('0x6'));var config=require(_0x290d('0x7'));var controller=require(_0x290d('0x8'));router['get']('/',auth[_0x290d('0x9')](),controller[_0x290d('0xa')]);router['get'](_0x290d('0xb'),auth[_0x290d('0x9')](),controller[_0x290d('0xc')]);router[_0x290d('0xd')](_0x290d('0xe'),auth['isAuthenticated'](),controller[_0x290d('0xf')]);router['get']('/:id/users',auth[_0x290d('0x9')](),controller[_0x290d('0x10')]);router[_0x290d('0xd')]('/:id/teams',auth['isAuthenticated'](),controller[_0x290d('0x11')]);router[_0x290d('0x12')]('/',auth[_0x290d('0x9')](),controller[_0x290d('0x13')]);router[_0x290d('0x12')](_0x290d('0x14'),auth[_0x290d('0x9')](),controller[_0x290d('0x15')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x290d('0x16')]);router[_0x290d('0x17')](_0x290d('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x290d('0x18')](_0x290d('0xe'),auth[_0x290d('0x9')](),controller[_0x290d('0x19')]);router[_0x290d('0x18')]('/:id/users',auth[_0x290d('0x9')](),controller[_0x290d('0x1a')]);router[_0x290d('0x18')](_0x290d('0x1b'),auth[_0x290d('0x9')](),controller['removeTeams']);module[_0x290d('0x1c')]=router; \ No newline at end of file +var _0xb205=['connect-timeout','express','../../components/auth/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','describe','show','/:id/users','getAgents','getTeams','post','addAgents','addTeams','put','/:id','delete','destroy','removeAgents','/:id/teams','removeTeams','exports','multer','util','path'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0xb205,0xf0));var _0x5b20=function(_0x2aba42,_0x41f256){_0x2aba42=_0x2aba42-0x0;var _0x30374a=_0xb205[_0x2aba42];return _0x30374a;};'use strict';var multer=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var path=require(_0x5b20('0x2'));var timeout=require(_0x5b20('0x3'));var express=require(_0x5b20('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5b20('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5b20('0x6'));var controller=require(_0x5b20('0x7'));router['get']('/',auth[_0x5b20('0x8')](),controller[_0x5b20('0x9')]);router[_0x5b20('0xa')]('/describe',auth[_0x5b20('0x8')](),controller[_0x5b20('0xb')]);router['get']('/:id',auth[_0x5b20('0x8')](),controller[_0x5b20('0xc')]);router[_0x5b20('0xa')](_0x5b20('0xd'),auth[_0x5b20('0x8')](),controller[_0x5b20('0xe')]);router[_0x5b20('0xa')]('/:id/teams',auth[_0x5b20('0x8')](),controller[_0x5b20('0xf')]);router[_0x5b20('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5b20('0x10')](_0x5b20('0xd'),auth[_0x5b20('0x8')](),controller[_0x5b20('0x11')]);router[_0x5b20('0x10')]('/:id/teams',auth[_0x5b20('0x8')](),controller[_0x5b20('0x12')]);router[_0x5b20('0x13')](_0x5b20('0x14'),auth['isAuthenticated'](),controller['update']);router[_0x5b20('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x5b20('0x16')]);router['delete'](_0x5b20('0xd'),auth[_0x5b20('0x8')](),controller[_0x5b20('0x17')]);router['delete'](_0x5b20('0x18'),auth[_0x5b20('0x8')](),controller[_0x5b20('0x19')]);module[_0x5b20('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 69d509b..cf17ddf 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 _0xcd55=['name','VIRTUAL','system-','STRING','INTEGER','sequelize','exports'];(function(_0x480e33,_0xa3c3f4){var _0x58c96a=function(_0x50264e){while(--_0x50264e){_0x480e33['push'](_0x480e33['shift']());}};_0x58c96a(++_0xa3c3f4);}(_0xcd55,0x163));var _0x5cd5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd55[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x5cd5('0x0'));module[_0x5cd5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5cd5('0x2')},'prefix':{'type':Sequelize[_0x5cd5('0x3')],'get':function(_0x5f433e){return _0x5cd5('0x4')+this['getDataValue'](_0x5cd5('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x5cd5('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x5cd5('0x6')]}}; \ No newline at end of file +var _0x736b=['sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x128f1c,_0xc2239a){var _0x20be60=function(_0x337fe1){while(--_0x337fe1){_0x128f1c['push'](_0x128f1c['shift']());}};_0x20be60(++_0xc2239a);}(_0x736b,0x1e6));var _0xb736=function(_0x18e77b,_0x58db89){_0x18e77b=_0x18e77b-0x0;var _0x46d306=_0x736b[_0x18e77b];return _0x46d306;};'use strict';var Sequelize=require(_0xb736('0x0'));module[_0xb736('0x1')]={'name':{'type':Sequelize[_0xb736('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xb736('0x3')],'get':function(_0xccf1be){return _0xb736('0x4')+this[_0xb736('0x5')]('name')+'-';}},'description':{'type':Sequelize[_0xb736('0x2')]},'callerIdAll':{'type':Sequelize[_0xb736('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 7bfa7ae..55ff5be 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 _0x896e=['userVoicePrefix:save','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','isEmpty','forEach','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','VoicePrefix','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','find','destroy','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','Voice\x20Prefix\x20Extension','priority','appdata','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','params','addAgents','ids','spread','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','order','hasOwnProperty','Team','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','each','upsert','UserVoicePrefix','findOrCreate'];(function(_0x9b882b,_0x4e1298){var _0x1067e9=function(_0x24111d){while(--_0x24111d){_0x9b882b['push'](_0x9b882b['shift']());}};_0x1067e9(++_0x4e1298);}(_0x896e,0x1e9));var _0xe896=function(_0x2b7d75,_0x4db8da){_0x2b7d75=_0x2b7d75-0x0;var _0x221cc2=_0x896e[_0x2b7d75];return _0x221cc2;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];config[_0xe896('0x1a')]=_['defaults'](config[_0xe896('0x1a')],{'host':_0xe896('0x1b'),'port':0x18eb});var socket=require(_0xe896('0x1c'))(new Redis(config['redis']));require(_0xe896('0x1d'))[_0xe896('0x1e')](socket);function respondWithStatusCode(_0x1e7ef8,_0x564758){_0x564758=_0x564758||0xcc;return function(_0x5a7957){if(_0x5a7957){return _0x1e7ef8[_0xe896('0x1f')](_0x564758);}return _0x1e7ef8[_0xe896('0x20')](_0x564758)['end']();};}function respondWithResult(_0x5e78d6,_0x11f41c){_0x11f41c=_0x11f41c||0xc8;return function(_0x16e272){if(_0x16e272){return _0x5e78d6['status'](_0x11f41c)[_0xe896('0x21')](_0x16e272);}};}function respondWithFilteredResult(_0x4e062a,_0x41cbd7){return function(_0x32f86d){if(_0x32f86d){var _0x2d4cf0=typeof _0x41cbd7['offset']===_0xe896('0x22')&&typeof _0x41cbd7[_0xe896('0x23')]===_0xe896('0x22');var _0xbebbe1=_0x32f86d[_0xe896('0x24')];var _0x3ac8b8=_0x2d4cf0?0x0:_0x41cbd7[_0xe896('0x25')];var _0x32d3d3=_0x2d4cf0?_0x32f86d['count']:_0x41cbd7[_0xe896('0x25')]+_0x41cbd7['limit'];var _0x5d2c8d;if(_0x32d3d3>=_0xbebbe1){_0x32d3d3=_0xbebbe1;_0x5d2c8d=0xc8;}else{_0x5d2c8d=0xce;}_0x4e062a[_0xe896('0x20')](_0x5d2c8d);return _0x4e062a[_0xe896('0x26')](_0xe896('0x27'),_0x3ac8b8+'-'+_0x32d3d3+'/'+_0xbebbe1)[_0xe896('0x21')](_0x32f86d);}return null;};}function patchUpdates(_0x498469){return function(_0x468479){try{jsonpatch['apply'](_0x468479,_0x498469,!![]);}catch(_0x5001f7){return BPromise[_0xe896('0x28')](_0x5001f7);}return _0x468479[_0xe896('0x29')]();};}function saveUpdates(_0x1e952a,_0x2e2c10){return function(_0x20e295){if(_0x20e295){return _0x20e295[_0xe896('0x2a')](_0x1e952a)[_0xe896('0x2b')](function(_0x4b71cc){return _0x4b71cc;});}return null;};}function removeEntity(_0x390128,_0x163a75){return function(_0xc3cd05){if(_0xc3cd05){return _0xc3cd05['destroy']()[_0xe896('0x2b')](function(){var _0xd50fe2=_0xc3cd05[_0xe896('0x2c')]({'plain':!![]});var _0xe93aa0=_0xe896('0x2d');return db[_0xe896('0x2e')]['destroy']({'where':{'type':_0xe93aa0,'resourceId':_0xd50fe2['id']}})[_0xe896('0x2b')](function(){return _0xc3cd05;});})[_0xe896('0x2b')](function(){_0x390128[_0xe896('0x20')](0xcc)[_0xe896('0x2f')]();});}};}function handleEntityNotFound(_0xace03f,_0x5e0d9b){return function(_0x47c268){if(!_0x47c268){_0xace03f['sendStatus'](0x194);}return _0x47c268;};}function handleError(_0x504d7c,_0x562ddd){_0x562ddd=_0x562ddd||0x1f4;return function(_0x291290){logger[_0xe896('0x30')](_0x291290[_0xe896('0x31')]);if(_0x291290[_0xe896('0x32')]){delete _0x291290[_0xe896('0x32')];}_0x504d7c[_0xe896('0x20')](_0x562ddd)[_0xe896('0x33')](_0x291290);};}exports[_0xe896('0x34')]=function(_0x4ab96b,_0x4ce052){var _0x142d29={},_0x255dd1={},_0x29be89={'count':0x0,'rows':[]};var _0x76c0c3=_['map'](db[_0xe896('0x35')]['rawAttributes'],function(_0x57c6e8){return{'name':_0x57c6e8[_0xe896('0x36')],'type':_0x57c6e8[_0xe896('0x37')][_0xe896('0x38')]};});_0x255dd1['model']=_['map'](_0x76c0c3,'name');_0x255dd1[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x4ab96b[_0xe896('0x39')]);_0x255dd1[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x255dd1['model'],_0x255dd1[_0xe896('0x39')]);_0x142d29[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x255dd1[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x3f')]));_0x142d29[_0xe896('0x3d')]=_0x142d29['attributes'][_0xe896('0x40')]?_0x142d29[_0xe896('0x3d')]:_0x255dd1['model'];if(!_0x4ab96b[_0xe896('0x39')]['hasOwnProperty'](_0xe896('0x41'))){_0x142d29['limit']=qs[_0xe896('0x23')](_0x4ab96b['query'][_0xe896('0x23')]);_0x142d29[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x4ab96b[_0xe896('0x39')][_0xe896('0x25')]);}_0x142d29['order']=qs['sort'](_0x4ab96b[_0xe896('0x39')][_0xe896('0x42')]);_0x142d29[_0xe896('0x43')]=qs[_0xe896('0x3b')](_[_0xe896('0x44')](_0x4ab96b['query'],_0x255dd1['filters']),_0x76c0c3);if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]){_0x142d29['where']=_['merge'](_0x142d29[_0xe896('0x43')],{'$or':_[_0xe896('0x46')](_0x76c0c3,function(_0x911adb){if(_0x911adb[_0xe896('0x37')]!==_0xe896('0x47')){var _0x41fa6f={};_0x41fa6f[_0x911adb[_0xe896('0x32')]]={'$like':'%'+_0x4ab96b[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x41fa6f;}})});}_0x142d29=_[_0xe896('0x48')]({},_0x142d29,_0x4ab96b[_0xe896('0x49')]);var _0x1bc76a={'where':_0x142d29['where']};return db[_0xe896('0x35')][_0xe896('0x24')](_0x1bc76a)['then'](function(_0x57366b){_0x29be89['count']=_0x57366b;if(_0x4ab96b[_0xe896('0x39')][_0xe896('0x4a')]){_0x142d29[_0xe896('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xe896('0x4c')](_0x142d29);})[_0xe896('0x2b')](function(_0x55a8ba){_0x29be89['rows']=_0x55a8ba;return _0x29be89;})['then'](respondWithFilteredResult(_0x4ce052,_0x142d29))[_0xe896('0x4d')](handleError(_0x4ce052,null));};exports[_0xe896('0x4e')]=function(_0x16927a,_0x402aef){var _0x4452aa={'raw':![],'where':{'id':_0x16927a['params']['id']}},_0x2ae833={};_0x2ae833[_0xe896('0x3e')]=_[_0xe896('0x3a')](db['VoicePrefix'][_0xe896('0x4f')]);_0x2ae833[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x16927a[_0xe896('0x39')]);_0x2ae833['filters']=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],_0x2ae833[_0xe896('0x39')]);_0x4452aa[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x2ae833[_0xe896('0x3e')],qs['fields'](_0x16927a[_0xe896('0x39')]['fields']));_0x4452aa[_0xe896('0x3d')]=_0x4452aa[_0xe896('0x3d')][_0xe896('0x40')]?_0x4452aa[_0xe896('0x3d')]:_0x2ae833[_0xe896('0x3e')];if(_0x16927a[_0xe896('0x39')]['includeAll']){_0x4452aa[_0xe896('0x4b')]=[{'all':!![]}];}_0x4452aa=_[_0xe896('0x48')]({},_0x4452aa,_0x16927a['options']);return db[_0xe896('0x35')][_0xe896('0x50')](_0x4452aa)['then'](handleEntityNotFound(_0x402aef,null))[_0xe896('0x2b')](respondWithResult(_0x402aef,null))['catch'](handleError(_0x402aef,null));};exports[_0xe896('0x51')]=function(_0xb90690,_0x3fd073){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0xb90690['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3fd073,null))[_0xe896('0x2b')](removeEntity(_0x3fd073,null))[_0xe896('0x4d')](handleError(_0x3fd073,null));};exports['describe']=function(_0x2ceae5,_0x5d205b){return db['VoicePrefix'][_0xe896('0x52')]()[_0xe896('0x2b')](respondWithResult(_0x5d205b,null))['catch'](handleError(_0x5d205b,null));};exports[_0xe896('0x53')]=function(_0x3d137b,_0x5bfd1e){var _0x58497a;return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x5b8719){return db[_0xe896('0x35')][_0xe896('0x53')](_0x3d137b[_0xe896('0x56')],{'transaction':_0x5b8719})[_0xe896('0x2b')](function(_0x16d1c8){_0x58497a=_0x16d1c8[_0xe896('0x2c')]({'plain':!![]});return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x58497a[_0xe896('0x58')]},'raw':!![]})[_0xe896('0x2b')](function(_0x357302){return createVoicePrefixExtensions(_0x58497a,_0x357302,_0x5b8719);});});})['then'](function(){var _0x1d7e31=_0x3d137b[_0xe896('0x59')][_0xe896('0x2c')]({'plain':!![]});if(!_0x1d7e31)throw new Error(_0xe896('0x5a'));if(_0x1d7e31[_0xe896('0x5b')]===_0xe896('0x59')){var _0x157946=_0x58497a;return db[_0xe896('0x5c')][_0xe896('0x50')]({'where':{'name':_0xe896('0x2d'),'userProfileId':_0x1d7e31[_0xe896('0x5d')]},'raw':!![]})[_0xe896('0x2b')](function(_0x5d8265){if(_0x5d8265&&_0x5d8265[_0xe896('0x5e')]===0x0){return db[_0xe896('0x2e')][_0xe896('0x53')]({'name':_0x157946['name'],'resourceId':_0x157946['id'],'type':_0x5d8265['name'],'sectionId':_0x5d8265['id']},{})['then'](function(){return _0x58497a;});}else{return _0x58497a;}})[_0xe896('0x4d')](function(_0x29aa11){logger[_0xe896('0x30')](_0xe896('0x5f'),_0x29aa11);throw _0x29aa11;});}return _0x58497a;})['then'](respondWithResult(_0x5bfd1e,null))[_0xe896('0x4d')](handleError(_0x5bfd1e,null));};function Extension(_0x28396c,_0x57ed84,_0x3c893a,_0x5d6c1c){this[_0xe896('0x60')]=_0xe896('0x61');this['exten']=_0x28396c;this[_0xe896('0x62')]=_0x3c893a;this[_0xe896('0x37')]='system';this['description']=_0xe896('0x63');this[_0xe896('0x64')]=_0x57ed84;this[_0xe896('0x65')]=_0x5d6c1c;}function createVoicePrefixExtensions(_0x11291a,_0x2a1858,_0x4e4092){return new BPromise(function(_0xdadb92,_0x3c82d1){var _0x113b00=new Extension(formatPrefixName(_0x11291a[_0xe896('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0x113b00[_0xe896('0x67')]=_0x11291a['id'];return db[_0xe896('0x57')]['create'](_0x113b00,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0x4f2d6e){var _0x3ccaad=_0x4f2d6e[_0xe896('0x2c')]({'plain':!![]});var _0xce2b25=_[_0xe896('0x46')](addVoicePrefixExtensions(_0x11291a,_0x2a1858),function(_0x11b001){_0x11b001[_0xe896('0x58')]=_0x3ccaad['id'];_0x11b001[_0xe896('0x67')]=_0x11291a['id'];return _0x11b001;});return db[_0xe896('0x57')][_0xe896('0x68')](_0xce2b25,{'transaction':_0x4e4092})[_0xe896('0x2b')](function(_0xcb329a){if(!_0xcb329a){return _0x3c82d1(_0xe896('0x69'));}else{return _0xdadb92(_0xcb329a);}})[_0xe896('0x4d')](function(_0x14d88e){return _0x3c82d1(_0x14d88e);});});;});};function addVoicePrefixExtensions(_0x468fd7,_0x33bd1b){var _0x404b42=[];var _0x26e75d=formatPrefixName(_0x468fd7[_0xe896('0x66')]);_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x2,_0xe896('0x6b'),_0xe896('0x6c')+_0x468fd7['name']));if(_0x468fd7['callerIdAll']){_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6b'),'PREFIX-CALLERIDALL='+_0x468fd7[_0xe896('0x6d')]));}else{_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x3,_0xe896('0x6e'),_0xe896('0x6f')));}_0x404b42[_0xe896('0x6a')](new Extension(_0x26e75d,0x4,_0xe896('0x70'),_0x33bd1b[_0xe896('0x60')]+','+_0xe896('0x71')+(0x8+_0x468fd7[_0xe896('0x32')][_0xe896('0x40')])+'}'+','+0x1));return _0x404b42;}function formatPrefixName(_0x1479c8){var _0x4e417a='_';for(var _0x3d299a=0x0;_0x3d299a<_0x1479c8[_0xe896('0x40')];_0x3d299a++){if(_0x1479c8['charAt'](_0x3d299a)=='-'){_0x4e417a+=_0x1479c8[_0xe896('0x72')](_0x3d299a);}else{_0x4e417a+='['+_0x1479c8['charAt'](_0x3d299a)+']';}}_0x4e417a+='.';return _0x4e417a;}exports['update']=function(_0x1f3e10,_0x1bbeeb,_0x4fd476){var _0x56223c=_0x1f3e10[_0xe896('0x56')];_0x56223c['prefix']='system-'+_0x56223c[_0xe896('0x32')]+'-';return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x539f6d){return db[_0xe896('0x35')][_0xe896('0x2a')](_0x56223c,{'where':{'id':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db['VoiceExtension'][_0xe896('0x51')]({'where':{'VoicePrefixId':_0x56223c['id']},'transaction':_0x539f6d})[_0xe896('0x2b')](function(){return db[_0xe896('0x57')][_0xe896('0x50')]({'where':{'id':_0x56223c['VoiceExtensionId']},'raw':!![]})[_0xe896('0x2b')](function(_0x37d951){return createVoicePrefixExtensions(_0x56223c,_0x37d951,_0x539f6d);});});});})[_0xe896('0x2b')](function(){return db[_0xe896('0x35')]['findById'](_0x56223c['id']);})[_0xe896('0x2b')](respondWithResult(_0x1bbeeb,null))[_0xe896('0x4d')](handleError(_0x1bbeeb,null));};exports['addAgents']=function(_0x2d910b,_0x129ff2,_0x35ed8c){return db[_0xe896('0x35')]['find']({'where':{'id':_0x2d910b[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x129ff2,null))[_0xe896('0x2b')](function(_0x1ea3ea){if(_0x1ea3ea){return _0x1ea3ea[_0xe896('0x74')](_0x2d910b[_0xe896('0x56')]['ids'],_['omit'](_0x2d910b['body'],[_0xe896('0x75'),'id'])||{})[_0xe896('0x76')](function(_0x10421d){for(var _0x270121=0x0;_0x270121<_0x2d910b[_0xe896('0x56')][_0xe896('0x75')][_0xe896('0x40')];_0x270121+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x2d910b[_0xe896('0x56')]['ids'][_0x270121]),'VoicePrefixId':Number(_0x2d910b[_0xe896('0x73')]['id'])});}return _0x10421d;});}})['then'](respondWithResult(_0x129ff2,null))[_0xe896('0x4d')](handleError(_0x129ff2,null));};exports['removeAgents']=function(_0x2d2978,_0x36994f,_0x2ffb63){return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x2d2978['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x36994f,null))[_0xe896('0x2b')](function(_0x690a75){if(_0x690a75){return _0x690a75[_0xe896('0x77')](_0x2d2978[_0xe896('0x39')][_0xe896('0x75')])[_0xe896('0x2b')](function(){if(_['isArray'](_0x2d2978[_0xe896('0x39')]['ids'])){for(var _0x2008a9=0x0;_0x2008a9<_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]['length'];_0x2008a9+=0x1){socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')][_0x2008a9]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}}else{socket[_0xe896('0x78')](_0xe896('0x79'),{'UserId':Number(_0x2d2978[_0xe896('0x39')][_0xe896('0x75')]),'VoicePrefixId':Number(_0x2d2978[_0xe896('0x73')]['id'])});}});}})[_0xe896('0x2b')](respondWithStatusCode(_0x36994f,null))['catch'](handleError(_0x36994f,null));};exports[_0xe896('0x7a')]=function(_0x317880,_0x3d3a1b,_0x3b0f36){var _0x48885e={};var _0x12f5f6={};var _0x129fe0;var _0x8089;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x317880[_0xe896('0x73')]['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x3d3a1b,null))[_0xe896('0x2b')](function(_0x1f37e4){if(_0x1f37e4){_0x129fe0=_0x1f37e4;_0x12f5f6[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7c')]['rawAttributes']);_0x12f5f6[_0xe896('0x39')]=_[_0xe896('0x3a')](_0x317880[_0xe896('0x39')]);_0x12f5f6['filters']=_[_0xe896('0x3c')](_0x12f5f6['model'],_0x12f5f6['query']);_0x48885e[_0xe896('0x3d')]=_[_0xe896('0x3c')](_0x12f5f6[_0xe896('0x3e')],qs['fields'](_0x317880[_0xe896('0x39')][_0xe896('0x3f')]));_0x48885e['attributes']=_0x48885e['attributes'][_0xe896('0x40')]?_0x48885e[_0xe896('0x3d')]:_0x12f5f6[_0xe896('0x3e')];_0x48885e[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x317880[_0xe896('0x39')][_0xe896('0x42')]);_0x48885e['where']=qs['filters'](_[_0xe896('0x44')](_0x317880['query'],_0x12f5f6['filters']));if(_0x317880[_0xe896('0x39')][_0xe896('0x45')]){_0x48885e[_0xe896('0x43')]=_[_0xe896('0x48')](_0x48885e['where'],{'$or':_[_0xe896('0x46')](_0x48885e[_0xe896('0x3d')],function(_0x487d67){var _0x13da47={};_0x13da47[_0x487d67]={'$like':'%'+_0x317880[_0xe896('0x39')][_0xe896('0x45')]+'%'};return _0x13da47;})});}_0x48885e=_[_0xe896('0x48')]({},_0x48885e,_0x317880[_0xe896('0x49')]);return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x1c5812){if(_0x1c5812){_0x8089=_0x1c5812[_0xe896('0x40')];if(!_0x317880[_0xe896('0x39')][_0xe896('0x7e')](_0xe896('0x41'))){_0x48885e[_0xe896('0x23')]=qs['limit'](_0x317880[_0xe896('0x39')][_0xe896('0x23')]);_0x48885e[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x317880[_0xe896('0x39')][_0xe896('0x25')]);}return _0x129fe0[_0xe896('0x7a')](_0x48885e);}})[_0xe896('0x2b')](function(_0x2bf6d5){if(_0x2bf6d5){return _0x2bf6d5?{'count':_0x8089,'rows':_0x2bf6d5}:null;}})[_0xe896('0x2b')](respondWithResult(_0x3d3a1b,null))['catch'](handleError(_0x3d3a1b,null));};exports['getTeams']=function(_0x41e6c4,_0x42c83c,_0x3822cd){var _0x56ee2d={};var _0x100804={};var _0x13b335;var _0x54f5e5;return db[_0xe896('0x35')][_0xe896('0x7b')]({'where':{'id':_0x41e6c4['params']['id']}})[_0xe896('0x2b')](handleEntityNotFound(_0x42c83c,null))[_0xe896('0x2b')](function(_0x20cfaf){if(_0x20cfaf){_0x13b335=_0x20cfaf;_0x100804[_0xe896('0x3e')]=_[_0xe896('0x3a')](db[_0xe896('0x7f')][_0xe896('0x4f')]);_0x100804[_0xe896('0x39')]=_['keys'](_0x41e6c4[_0xe896('0x39')]);_0x100804[_0xe896('0x3b')]=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],_0x100804[_0xe896('0x39')]);_0x56ee2d['attributes']=_[_0xe896('0x3c')](_0x100804[_0xe896('0x3e')],qs[_0xe896('0x3f')](_0x41e6c4['query'][_0xe896('0x3f')]));_0x56ee2d[_0xe896('0x3d')]=_0x56ee2d[_0xe896('0x3d')][_0xe896('0x40')]?_0x56ee2d[_0xe896('0x3d')]:_0x100804[_0xe896('0x3e')];_0x56ee2d[_0xe896('0x7d')]=qs[_0xe896('0x42')](_0x41e6c4[_0xe896('0x39')]['sort']);_0x56ee2d[_0xe896('0x43')]=qs['filters'](_[_0xe896('0x44')](_0x41e6c4[_0xe896('0x39')],_0x100804[_0xe896('0x3b')]));if(_0x41e6c4[_0xe896('0x39')]['filter']){_0x56ee2d[_0xe896('0x43')]=_[_0xe896('0x48')](_0x56ee2d['where'],{'$or':_[_0xe896('0x46')](_0x56ee2d[_0xe896('0x3d')],function(_0x474924){var _0x498987={};_0x498987[_0x474924]={'$like':'%'+_0x41e6c4[_0xe896('0x39')]['filter']+'%'};return _0x498987;})});}_0x56ee2d=_['merge']({},_0x56ee2d,_0x41e6c4[_0xe896('0x49')]);return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0x1cf246){if(_0x1cf246){_0x54f5e5=_0x1cf246[_0xe896('0x40')];if(!_0x41e6c4['query']['hasOwnProperty']('nolimit')){_0x56ee2d['limit']=qs[_0xe896('0x23')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x23')]);_0x56ee2d[_0xe896('0x25')]=qs[_0xe896('0x25')](_0x41e6c4[_0xe896('0x39')][_0xe896('0x25')]);}return _0x13b335[_0xe896('0x80')](_0x56ee2d);}})['then'](function(_0xd345d8){if(_0xd345d8){return _0xd345d8?{'count':_0x54f5e5,'rows':_0xd345d8}:null;}})[_0xe896('0x2b')](respondWithResult(_0x42c83c,null))[_0xe896('0x4d')](handleError(_0x42c83c,null));};exports[_0xe896('0x81')]=function(_0x5a254b,_0x4f4d26,_0x2f30a9){var _0x33fbb8=_0x5a254b['body']['ids'];var _0x419fc7;return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x33fbb8},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id','name',_0xe896('0x83'),_0xe896('0x84'),_0xe896('0x85')],'raw':!![]}]})['then'](function(_0x231dcd){if(_0x231dcd){_0x419fc7=_0x231dcd;var _0x219ef1=_[_0xe896('0x86')](_0x231dcd,function(_0xdeaa37){var _0x43676c=_0xdeaa37['get']({'plain':!![]});return _0x43676c[_0xe896('0x82')];});return db[_0xe896('0x35')][_0xe896('0x50')]({'where':{'id':_0x5a254b['params']['id']}})[_0xe896('0x2b')](function(_0x5bfd3b){return db[_0xe896('0x54')][_0xe896('0x55')](function(_0x1e1820){return _0x5bfd3b[_0xe896('0x81')](_0x33fbb8,{'transaction':_0x1e1820})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x419fc7,function(_0x4870d7){return db['TeamVoicePrefix'][_0xe896('0x88')]({'TeamId':_0x4870d7['id'],'VoicePrefixId':_0x5a254b['params']['id']},{'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){return BPromise[_0xe896('0x87')](_0x219ef1,function(_0x5ac4ad){return db[_0xe896('0x89')][_0xe896('0x8a')]({'where':{'UserId':_0x5ac4ad['id'],'VoicePrefixId':_0x5a254b['params']['id']},'transaction':_0x1e1820});});})[_0xe896('0x2b')](function(){_0x219ef1['forEach'](function(_0x326c67){socket[_0xe896('0x78')](_0xe896('0x8b'),{'UserId':_0x326c67['id'],'VoicePrefixId':_0x5bfd3b['id']});});});});});}})[_0xe896('0x2b')](respondWithStatusCode(_0x4f4d26,null))['catch'](handleError(_0x4f4d26,null));};exports[_0xe896('0x8c')]=function(_0x25b297,_0x111c0d,_0x22ac85){return db[_0xe896('0x7f')][_0xe896('0x4c')]({'where':{'id':_0x25b297[_0xe896('0x39')][_0xe896('0x75')]},'attributes':['id'],'include':[{'model':db[_0xe896('0x7c')],'as':_0xe896('0x82'),'attributes':['id'],'raw':!![]}]})[_0xe896('0x2b')](handleEntityNotFound(_0x111c0d,null))[_0xe896('0x2b')](function(_0x23049d){var _0x39e735=_[_0xe896('0x46')](_0x23049d,'id');var _0xc0cb7c=[];var _0x16b398=[];var _0x4edeaf=squel[_0xe896('0x8d')]();_0x4edeaf[_0xe896('0x8e')]('tq.TeamId')['from'](_0xe896('0x8f'),'tq')[_0xe896('0x90')](_0xe896('0x91'),'ut',_0xe896('0x92'))[_0xe896('0x43')](_0xe896('0x93'),_0x25b297[_0xe896('0x73')]['id']);for(var _0x46a4f0=0x0;_0x46a4f0<_0x23049d['length'];_0x46a4f0+=0x1){let _0x13eb9a=_0x23049d[_0x46a4f0];for(var _0x3c70a3=0x0;_0x3c70a3<_0x13eb9a[_0xe896('0x82')][_0xe896('0x40')];_0x3c70a3+=0x1){let _0x59bea9=_0x13eb9a[_0xe896('0x82')][_0x3c70a3];var _0x54b2f0=_0x4edeaf['clone']();_0x54b2f0[_0xe896('0x43')](_0xe896('0x94'),_0x59bea9['id']);_0x16b398[_0xe896('0x6a')](db[_0xe896('0x54')][_0xe896('0x39')](_0x54b2f0[_0xe896('0x95')](),{'type':db[_0xe896('0x54')]['QueryTypes'][_0xe896('0x96')]})[_0xe896('0x2b')](function(_0x98bc8){if(_0x98bc8[_0xe896('0x40')]===0x1){return _0x59bea9['id'];}else{var _0xe78476=_[_0xe896('0x97')](_[_0xe896('0x46')](_0x98bc8,_0xe896('0x98')),function(_0x3c377e){return _['includes'](_0x39e735,_0x3c377e);});if(_0xe78476){return _0x59bea9['id'];}}}));}}return BPromise[_0xe896('0x99')](_0x16b398)[_0xe896('0x2b')](function(_0x4983ea){_0xc0cb7c=_(_0xc0cb7c)[_0xe896('0x9a')](_0x4983ea)['compact']()['value']();return db[_0xe896('0x35')]['find']({'where':{'id':_0x25b297['params']['id']}})[_0xe896('0x2b')](function(_0x1af1a2){return db[_0xe896('0x54')]['transaction'](function(_0x2b72af){return _0x1af1a2['removeTeams'](_0x25b297[_0xe896('0x39')][_0xe896('0x75')],{'transaction':_0x2b72af})['then'](function(){if(!_[_0xe896('0x9b')](_0xc0cb7c)){return _0x1af1a2[_0xe896('0x77')](_0xc0cb7c,{'transaction':_0x2b72af});}})['then'](function(){_0xc0cb7c[_0xe896('0x9c')](function(_0x5478f3){socket['emit']('userVoicePrefix:remove',{'UserId':_0x5478f3,'VoicePrefixId':_0x1af1a2['id']});});});});});});})[_0xe896('0x2b')](respondWithStatusCode(_0x111c0d,null))['catch'](handleError(_0x111c0d,null));}; \ No newline at end of file +var _0x0120=['get','VoicePrefixes','UserProfileResource','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','describe','create','transaction','body','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','bulkCreate','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','addAgents','params','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Agents','online','interface','flatMap','sequelize','addTeams','each','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','from','team_has_voice_prefixes','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x2b7b79,_0x5e18c8){var _0x2b9e94=function(_0x425ac3){while(--_0x425ac3){_0x2b7b79['push'](_0x2b7b79['shift']());}};_0x2b9e94(++_0x5e18c8);}(_0x0120,0x6f));var _0x0012=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x0120[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x0012('0x0'));var rimraf=require(_0x0012('0x1'));var zipdir=require(_0x0012('0x2'));var jsonpatch=require(_0x0012('0x3'));var rp=require(_0x0012('0x4'));var moment=require(_0x0012('0x5'));var BPromise=require(_0x0012('0x6'));var Mustache=require(_0x0012('0x7'));var util=require(_0x0012('0x8'));var path=require(_0x0012('0x9'));var sox=require(_0x0012('0xa'));var csv=require(_0x0012('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0012('0xc'));var crypto=require(_0x0012('0xd'));var jsforce=require(_0x0012('0xe'));var deskjs=require(_0x0012('0xf'));var toCsv=require(_0x0012('0xb'));var querystring=require('querystring');var Papa=require(_0x0012('0x10'));var Redis=require(_0x0012('0x11'));var authService=require(_0x0012('0x12'));var qs=require(_0x0012('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0012('0x14'));var logger=require('../../config/logger')(_0x0012('0x15'));var utils=require(_0x0012('0x16'));var config=require(_0x0012('0x17'));var licenseUtil=require(_0x0012('0x18'));var db=require(_0x0012('0x19'))['db'];config['redis']=_[_0x0012('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0012('0x1b'))['register'](socket);function respondWithStatusCode(_0x3995fd,_0xf658bc){_0xf658bc=_0xf658bc||0xcc;return function(_0x47a6ef){if(_0x47a6ef){return _0x3995fd[_0x0012('0x1c')](_0xf658bc);}return _0x3995fd[_0x0012('0x1d')](_0xf658bc)[_0x0012('0x1e')]();};}function respondWithResult(_0x3b8dfc,_0x522e9b){_0x522e9b=_0x522e9b||0xc8;return function(_0x4e72da){if(_0x4e72da){return _0x3b8dfc[_0x0012('0x1d')](_0x522e9b)[_0x0012('0x1f')](_0x4e72da);}};}function respondWithFilteredResult(_0x3948bf,_0x2e88a8){return function(_0x1d0423){if(_0x1d0423){var _0x22ded1=typeof _0x2e88a8[_0x0012('0x20')]===_0x0012('0x21')&&typeof _0x2e88a8['limit']===_0x0012('0x21');var _0x56b0e1=_0x1d0423['count'];var _0x45d00b=_0x22ded1?0x0:_0x2e88a8[_0x0012('0x20')];var _0xa2e623=_0x22ded1?_0x1d0423[_0x0012('0x22')]:_0x2e88a8['offset']+_0x2e88a8['limit'];var _0x460d82;if(_0xa2e623>=_0x56b0e1){_0xa2e623=_0x56b0e1;_0x460d82=0xc8;}else{_0x460d82=0xce;}_0x3948bf[_0x0012('0x1d')](_0x460d82);return _0x3948bf[_0x0012('0x23')](_0x0012('0x24'),_0x45d00b+'-'+_0xa2e623+'/'+_0x56b0e1)[_0x0012('0x1f')](_0x1d0423);}return null;};}function patchUpdates(_0x2e6a2c){return function(_0x2c9a96){try{jsonpatch[_0x0012('0x25')](_0x2c9a96,_0x2e6a2c,!![]);}catch(_0x57487e){return BPromise[_0x0012('0x26')](_0x57487e);}return _0x2c9a96[_0x0012('0x27')]();};}function saveUpdates(_0x4cf4bd,_0x36cf42){return function(_0x13a78e){if(_0x13a78e){return _0x13a78e[_0x0012('0x28')](_0x4cf4bd)[_0x0012('0x29')](function(_0x42bcd7){return _0x42bcd7;});}return null;};}function removeEntity(_0x5e820b,_0x351ffd){return function(_0x18b0a7){if(_0x18b0a7){return _0x18b0a7[_0x0012('0x2a')]()[_0x0012('0x29')](function(){var _0x173cb3=_0x18b0a7[_0x0012('0x2b')]({'plain':!![]});var _0x15d48a=_0x0012('0x2c');return db[_0x0012('0x2d')][_0x0012('0x2a')]({'where':{'type':_0x15d48a,'resourceId':_0x173cb3['id']}})[_0x0012('0x29')](function(){return _0x18b0a7;});})[_0x0012('0x29')](function(){_0x5e820b[_0x0012('0x1d')](0xcc)[_0x0012('0x1e')]();});}};}function handleEntityNotFound(_0x1282bb,_0x276389){return function(_0x1b676d){if(!_0x1b676d){_0x1282bb[_0x0012('0x1c')](0x194);}return _0x1b676d;};}function handleError(_0x1c23e0,_0x291085){_0x291085=_0x291085||0x1f4;return function(_0x1bb14d){logger['error'](_0x1bb14d[_0x0012('0x2e')]);if(_0x1bb14d[_0x0012('0x2f')]){delete _0x1bb14d['name'];}_0x1c23e0[_0x0012('0x1d')](_0x291085)[_0x0012('0x30')](_0x1bb14d);};}exports[_0x0012('0x31')]=function(_0x1b6cef,_0x287b05){var _0x47d73b={},_0x13f169={},_0x187f4b={'count':0x0,'rows':[]};var _0x2e7487=_['map'](db[_0x0012('0x32')][_0x0012('0x33')],function(_0x398990){return{'name':_0x398990[_0x0012('0x34')],'type':_0x398990[_0x0012('0x35')][_0x0012('0x36')]};});_0x13f169['model']=_[_0x0012('0x37')](_0x2e7487,_0x0012('0x2f'));_0x13f169[_0x0012('0x38')]=_[_0x0012('0x39')](_0x1b6cef['query']);_0x13f169['filters']=_[_0x0012('0x3a')](_0x13f169[_0x0012('0x3b')],_0x13f169[_0x0012('0x38')]);_0x47d73b[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x13f169[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0x1b6cef['query'][_0x0012('0x3d')]));_0x47d73b[_0x0012('0x3c')]=_0x47d73b['attributes'][_0x0012('0x3e')]?_0x47d73b[_0x0012('0x3c')]:_0x13f169[_0x0012('0x3b')];if(!_0x1b6cef[_0x0012('0x38')][_0x0012('0x3f')](_0x0012('0x40'))){_0x47d73b[_0x0012('0x41')]=qs['limit'](_0x1b6cef[_0x0012('0x38')]['limit']);_0x47d73b[_0x0012('0x20')]=qs['offset'](_0x1b6cef['query'][_0x0012('0x20')]);}_0x47d73b[_0x0012('0x42')]=qs[_0x0012('0x43')](_0x1b6cef['query'][_0x0012('0x43')]);_0x47d73b[_0x0012('0x44')]=qs[_0x0012('0x45')](_[_0x0012('0x46')](_0x1b6cef[_0x0012('0x38')],_0x13f169[_0x0012('0x45')]),_0x2e7487);if(_0x1b6cef[_0x0012('0x38')][_0x0012('0x47')]){_0x47d73b['where']=_[_0x0012('0x48')](_0x47d73b[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x2e7487,function(_0x1799f2){if(_0x1799f2[_0x0012('0x35')]!==_0x0012('0x49')){var _0x375317={};_0x375317[_0x1799f2['name']]={'$like':'%'+_0x1b6cef['query'][_0x0012('0x47')]+'%'};return _0x375317;}})});}_0x47d73b=_['merge']({},_0x47d73b,_0x1b6cef[_0x0012('0x4a')]);var _0x30af1b={'where':_0x47d73b[_0x0012('0x44')]};return db[_0x0012('0x32')][_0x0012('0x22')](_0x30af1b)['then'](function(_0x1bd93a){_0x187f4b[_0x0012('0x22')]=_0x1bd93a;if(_0x1b6cef['query'][_0x0012('0x4b')]){_0x47d73b[_0x0012('0x4c')]=[{'all':!![]}];}return db[_0x0012('0x32')][_0x0012('0x4d')](_0x47d73b);})['then'](function(_0x4ba00e){_0x187f4b[_0x0012('0x4e')]=_0x4ba00e;return _0x187f4b;})['then'](respondWithFilteredResult(_0x287b05,_0x47d73b))[_0x0012('0x4f')](handleError(_0x287b05,null));};exports['show']=function(_0xdd4689,_0x1296fd){var _0x3daefd={'raw':![],'where':{'id':_0xdd4689['params']['id']}},_0x364f8e={};_0x364f8e[_0x0012('0x3b')]=_['keys'](db[_0x0012('0x32')][_0x0012('0x33')]);_0x364f8e[_0x0012('0x38')]=_[_0x0012('0x39')](_0xdd4689[_0x0012('0x38')]);_0x364f8e[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x364f8e['model'],_0x364f8e[_0x0012('0x38')]);_0x3daefd[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x364f8e[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0xdd4689[_0x0012('0x38')]['fields']));_0x3daefd['attributes']=_0x3daefd['attributes']['length']?_0x3daefd[_0x0012('0x3c')]:_0x364f8e[_0x0012('0x3b')];if(_0xdd4689[_0x0012('0x38')][_0x0012('0x4b')]){_0x3daefd[_0x0012('0x4c')]=[{'all':!![]}];}_0x3daefd=_['merge']({},_0x3daefd,_0xdd4689[_0x0012('0x4a')]);return db[_0x0012('0x32')][_0x0012('0x50')](_0x3daefd)[_0x0012('0x29')](handleEntityNotFound(_0x1296fd,null))[_0x0012('0x29')](respondWithResult(_0x1296fd,null))[_0x0012('0x4f')](handleError(_0x1296fd,null));};exports[_0x0012('0x2a')]=function(_0x26fb2b,_0x2177a6){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x26fb2b['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x2177a6,null))[_0x0012('0x29')](removeEntity(_0x2177a6,null))[_0x0012('0x4f')](handleError(_0x2177a6,null));};exports['describe']=function(_0x2d4ee7,_0x2f451b){return db[_0x0012('0x32')][_0x0012('0x51')]()[_0x0012('0x29')](respondWithResult(_0x2f451b,null))['catch'](handleError(_0x2f451b,null));};exports[_0x0012('0x52')]=function(_0x552f02,_0x430973){var _0x42f296;return db['sequelize'][_0x0012('0x53')](function(_0x19cf31){return db[_0x0012('0x32')][_0x0012('0x52')](_0x552f02[_0x0012('0x54')],{'transaction':_0x19cf31})[_0x0012('0x29')](function(_0x4e9f7e){_0x42f296=_0x4e9f7e[_0x0012('0x2b')]({'plain':!![]});return db[_0x0012('0x55')][_0x0012('0x50')]({'where':{'id':_0x42f296[_0x0012('0x56')]},'raw':!![]})['then'](function(_0x102637){return createVoicePrefixExtensions(_0x42f296,_0x102637,_0x19cf31);});});})[_0x0012('0x29')](function(){var _0x2e79aa=_0x552f02['user'][_0x0012('0x2b')]({'plain':!![]});if(!_0x2e79aa)throw new Error(_0x0012('0x57'));if(_0x2e79aa[_0x0012('0x58')]===_0x0012('0x59')){var _0x1a48d9=_0x42f296;return db[_0x0012('0x5a')][_0x0012('0x50')]({'where':{'name':_0x0012('0x2c'),'userProfileId':_0x2e79aa[_0x0012('0x5b')]},'raw':!![]})[_0x0012('0x29')](function(_0x263634){if(_0x263634&&_0x263634['autoAssociation']===0x0){return db['UserProfileResource'][_0x0012('0x52')]({'name':_0x1a48d9[_0x0012('0x2f')],'resourceId':_0x1a48d9['id'],'type':_0x263634[_0x0012('0x2f')],'sectionId':_0x263634['id']},{})[_0x0012('0x29')](function(){return _0x42f296;});}else{return _0x42f296;}})['catch'](function(_0x248497){logger[_0x0012('0x5c')](_0x0012('0x5d'),_0x248497);throw _0x248497;});}return _0x42f296;})[_0x0012('0x29')](respondWithResult(_0x430973,null))[_0x0012('0x4f')](handleError(_0x430973,null));};function Extension(_0x130045,_0x51eae3,_0x17eaff,_0x490644){this[_0x0012('0x5e')]=_0x0012('0x5f');this[_0x0012('0x60')]=_0x130045;this[_0x0012('0x61')]=_0x17eaff;this[_0x0012('0x35')]='system';this[_0x0012('0x62')]=_0x0012('0x63');this[_0x0012('0x64')]=_0x51eae3;this[_0x0012('0x65')]=_0x490644;}function createVoicePrefixExtensions(_0x2ceed5,_0x3d32c2,_0x562d6d){return new BPromise(function(_0x4e4d52,_0x4ea93b){var _0xd7db34=new Extension(formatPrefixName(_0x2ceed5[_0x0012('0x66')]),0x1,'NoOp','Voice\x20Prefix');_0xd7db34['VoicePrefixId']=_0x2ceed5['id'];return db[_0x0012('0x55')][_0x0012('0x52')](_0xd7db34,{'transaction':_0x562d6d})[_0x0012('0x29')](function(_0x472843){var _0x1f0af9=_0x472843[_0x0012('0x2b')]({'plain':!![]});var _0x10cb5e=_[_0x0012('0x37')](addVoicePrefixExtensions(_0x2ceed5,_0x3d32c2),function(_0x2612e2){_0x2612e2[_0x0012('0x56')]=_0x1f0af9['id'];_0x2612e2['VoicePrefixId']=_0x2ceed5['id'];return _0x2612e2;});return db[_0x0012('0x55')][_0x0012('0x67')](_0x10cb5e,{'transaction':_0x562d6d})[_0x0012('0x29')](function(_0x5cfc9f){if(!_0x5cfc9f){return _0x4ea93b(_0x0012('0x68'));}else{return _0x4e4d52(_0x5cfc9f);}})[_0x0012('0x4f')](function(_0x4cba06){return _0x4ea93b(_0x4cba06);});});;});};function addVoicePrefixExtensions(_0x388466,_0x534840){var _0x2958c7=[];var _0x1661c2=formatPrefixName(_0x388466[_0x0012('0x66')]);_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x2,'Set',_0x0012('0x6a')+_0x388466[_0x0012('0x2f')]));if(_0x388466[_0x0012('0x6b')]){_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x3,_0x0012('0x6c'),_0x0012('0x6d')+_0x388466[_0x0012('0x6b')]));}else{_0x2958c7['push'](new Extension(_0x1661c2,0x3,'NoOp',_0x0012('0x6e')));}_0x2958c7[_0x0012('0x69')](new Extension(_0x1661c2,0x4,_0x0012('0x6f'),_0x534840[_0x0012('0x5e')]+','+_0x0012('0x70')+(0x8+_0x388466[_0x0012('0x2f')][_0x0012('0x3e')])+'}'+','+0x1));return _0x2958c7;}function formatPrefixName(_0x38cc51){var _0x548487='_';for(var _0x15b058=0x0;_0x15b058<_0x38cc51[_0x0012('0x3e')];_0x15b058++){if(_0x38cc51[_0x0012('0x71')](_0x15b058)=='-'){_0x548487+=_0x38cc51[_0x0012('0x71')](_0x15b058);}else{_0x548487+='['+_0x38cc51[_0x0012('0x71')](_0x15b058)+']';}}_0x548487+='.';return _0x548487;}exports[_0x0012('0x28')]=function(_0x496ab9,_0x4fc9b1,_0x571247){var _0x49963a=_0x496ab9['body'];_0x49963a['prefix']=_0x0012('0x72')+_0x49963a[_0x0012('0x2f')]+'-';return db['sequelize'][_0x0012('0x53')](function(_0x1c93e7){return db[_0x0012('0x32')][_0x0012('0x28')](_0x49963a,{'where':{'id':_0x49963a['id']},'transaction':_0x1c93e7})[_0x0012('0x29')](function(){return db['VoiceExtension'][_0x0012('0x2a')]({'where':{'VoicePrefixId':_0x49963a['id']},'transaction':_0x1c93e7})[_0x0012('0x29')](function(){return db[_0x0012('0x55')][_0x0012('0x50')]({'where':{'id':_0x49963a[_0x0012('0x56')]},'raw':!![]})[_0x0012('0x29')](function(_0x47e12a){return createVoicePrefixExtensions(_0x49963a,_0x47e12a,_0x1c93e7);});});});})['then'](function(){return db[_0x0012('0x32')]['findById'](_0x49963a['id']);})[_0x0012('0x29')](respondWithResult(_0x4fc9b1,null))[_0x0012('0x4f')](handleError(_0x4fc9b1,null));};exports[_0x0012('0x73')]=function(_0xdd97af,_0x521a88,_0x493a0d){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0xdd97af[_0x0012('0x74')]['id']}})['then'](handleEntityNotFound(_0x521a88,null))[_0x0012('0x29')](function(_0x48d748){if(_0x48d748){return _0x48d748['addAgents'](_0xdd97af['body'][_0x0012('0x75')],_[_0x0012('0x76')](_0xdd97af['body'],[_0x0012('0x75'),'id'])||{})[_0x0012('0x77')](function(_0x574cf7){for(var _0x4e0a8f=0x0;_0x4e0a8f<_0xdd97af[_0x0012('0x54')]['ids'][_0x0012('0x3e')];_0x4e0a8f+=0x1){socket[_0x0012('0x78')]('userVoicePrefix:save',{'UserId':Number(_0xdd97af['body'][_0x0012('0x75')][_0x4e0a8f]),'VoicePrefixId':Number(_0xdd97af[_0x0012('0x74')]['id'])});}return _0x574cf7;});}})[_0x0012('0x29')](respondWithResult(_0x521a88,null))[_0x0012('0x4f')](handleError(_0x521a88,null));};exports['removeAgents']=function(_0x523419,_0x2852ac,_0x58d4dc){return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x523419['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x2852ac,null))[_0x0012('0x29')](function(_0xd6f0ff){if(_0xd6f0ff){return _0xd6f0ff[_0x0012('0x79')](_0x523419[_0x0012('0x38')][_0x0012('0x75')])[_0x0012('0x29')](function(){if(_[_0x0012('0x7a')](_0x523419[_0x0012('0x38')][_0x0012('0x75')])){for(var _0x4a2ce1=0x0;_0x4a2ce1<_0x523419[_0x0012('0x38')]['ids']['length'];_0x4a2ce1+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x523419['query'][_0x0012('0x75')][_0x4a2ce1]),'VoicePrefixId':Number(_0x523419['params']['id'])});}}else{socket[_0x0012('0x78')](_0x0012('0x7b'),{'UserId':Number(_0x523419[_0x0012('0x38')]['ids']),'VoicePrefixId':Number(_0x523419[_0x0012('0x74')]['id'])});}});}})[_0x0012('0x29')](respondWithStatusCode(_0x2852ac,null))[_0x0012('0x4f')](handleError(_0x2852ac,null));};exports[_0x0012('0x7c')]=function(_0x35d36e,_0x26e6ed,_0xd6b12a){var _0x5dc5b5={};var _0x399108={};var _0x482684;var _0x526fae;return db[_0x0012('0x32')][_0x0012('0x7d')]({'where':{'id':_0x35d36e['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x26e6ed,null))['then'](function(_0xe913ef){if(_0xe913ef){_0x482684=_0xe913ef;_0x399108[_0x0012('0x3b')]=_[_0x0012('0x39')](db[_0x0012('0x7e')]['rawAttributes']);_0x399108[_0x0012('0x38')]=_[_0x0012('0x39')](_0x35d36e[_0x0012('0x38')]);_0x399108[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x399108['model'],_0x399108[_0x0012('0x38')]);_0x5dc5b5[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x399108[_0x0012('0x3b')],qs[_0x0012('0x3d')](_0x35d36e['query'][_0x0012('0x3d')]));_0x5dc5b5['attributes']=_0x5dc5b5[_0x0012('0x3c')][_0x0012('0x3e')]?_0x5dc5b5['attributes']:_0x399108[_0x0012('0x3b')];_0x5dc5b5[_0x0012('0x42')]=qs['sort'](_0x35d36e[_0x0012('0x38')][_0x0012('0x43')]);_0x5dc5b5[_0x0012('0x44')]=qs[_0x0012('0x45')](_[_0x0012('0x46')](_0x35d36e[_0x0012('0x38')],_0x399108[_0x0012('0x45')]));if(_0x35d36e['query'][_0x0012('0x47')]){_0x5dc5b5[_0x0012('0x44')]=_[_0x0012('0x48')](_0x5dc5b5[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x5dc5b5[_0x0012('0x3c')],function(_0x203996){var _0x4da831={};_0x4da831[_0x203996]={'$like':'%'+_0x35d36e[_0x0012('0x38')][_0x0012('0x47')]+'%'};return _0x4da831;})});}_0x5dc5b5=_[_0x0012('0x48')]({},_0x5dc5b5,_0x35d36e[_0x0012('0x4a')]);return _0x482684[_0x0012('0x7c')](_0x5dc5b5);}})[_0x0012('0x29')](function(_0x119e75){if(_0x119e75){_0x526fae=_0x119e75['length'];if(!_0x35d36e[_0x0012('0x38')]['hasOwnProperty'](_0x0012('0x40'))){_0x5dc5b5[_0x0012('0x41')]=qs[_0x0012('0x41')](_0x35d36e[_0x0012('0x38')]['limit']);_0x5dc5b5[_0x0012('0x20')]=qs[_0x0012('0x20')](_0x35d36e[_0x0012('0x38')][_0x0012('0x20')]);}return _0x482684[_0x0012('0x7c')](_0x5dc5b5);}})[_0x0012('0x29')](function(_0x384731){if(_0x384731){return _0x384731?{'count':_0x526fae,'rows':_0x384731}:null;}})[_0x0012('0x29')](respondWithResult(_0x26e6ed,null))[_0x0012('0x4f')](handleError(_0x26e6ed,null));};exports[_0x0012('0x7f')]=function(_0x2cd7f9,_0x30739b,_0x529ad1){var _0x4de297={};var _0x493cf8={};var _0x10acaa;var _0x6b90b3;return db['VoicePrefix'][_0x0012('0x7d')]({'where':{'id':_0x2cd7f9['params']['id']}})[_0x0012('0x29')](handleEntityNotFound(_0x30739b,null))['then'](function(_0x2ecb66){if(_0x2ecb66){_0x10acaa=_0x2ecb66;_0x493cf8['model']=_['keys'](db['Team'][_0x0012('0x33')]);_0x493cf8[_0x0012('0x38')]=_['keys'](_0x2cd7f9[_0x0012('0x38')]);_0x493cf8[_0x0012('0x45')]=_[_0x0012('0x3a')](_0x493cf8['model'],_0x493cf8[_0x0012('0x38')]);_0x4de297[_0x0012('0x3c')]=_[_0x0012('0x3a')](_0x493cf8['model'],qs[_0x0012('0x3d')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x3d')]));_0x4de297[_0x0012('0x3c')]=_0x4de297['attributes'][_0x0012('0x3e')]?_0x4de297['attributes']:_0x493cf8[_0x0012('0x3b')];_0x4de297['order']=qs[_0x0012('0x43')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x43')]);_0x4de297[_0x0012('0x44')]=qs['filters'](_[_0x0012('0x46')](_0x2cd7f9[_0x0012('0x38')],_0x493cf8['filters']));if(_0x2cd7f9[_0x0012('0x38')][_0x0012('0x47')]){_0x4de297[_0x0012('0x44')]=_[_0x0012('0x48')](_0x4de297[_0x0012('0x44')],{'$or':_[_0x0012('0x37')](_0x4de297['attributes'],function(_0x49cd17){var _0x5d13c2={};_0x5d13c2[_0x49cd17]={'$like':'%'+_0x2cd7f9[_0x0012('0x38')][_0x0012('0x47')]+'%'};return _0x5d13c2;})});}_0x4de297=_[_0x0012('0x48')]({},_0x4de297,_0x2cd7f9[_0x0012('0x4a')]);return _0x10acaa[_0x0012('0x7f')](_0x4de297);}})[_0x0012('0x29')](function(_0x314645){if(_0x314645){_0x6b90b3=_0x314645[_0x0012('0x3e')];if(!_0x2cd7f9[_0x0012('0x38')][_0x0012('0x3f')](_0x0012('0x40'))){_0x4de297[_0x0012('0x41')]=qs[_0x0012('0x41')](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x41')]);_0x4de297[_0x0012('0x20')]=qs['offset'](_0x2cd7f9[_0x0012('0x38')][_0x0012('0x20')]);}return _0x10acaa[_0x0012('0x7f')](_0x4de297);}})[_0x0012('0x29')](function(_0x3e8b0a){if(_0x3e8b0a){return _0x3e8b0a?{'count':_0x6b90b3,'rows':_0x3e8b0a}:null;}})[_0x0012('0x29')](respondWithResult(_0x30739b,null))[_0x0012('0x4f')](handleError(_0x30739b,null));};exports['addTeams']=function(_0x5e3240,_0x18aee3,_0x57f5a3){var _0x346739=_0x5e3240[_0x0012('0x54')][_0x0012('0x75')];var _0x270d2c;return db['Team']['findAll']({'where':{'id':_0x346739},'attributes':['id'],'include':[{'model':db[_0x0012('0x7e')],'as':_0x0012('0x80'),'attributes':['id','name',_0x0012('0x81'),'voicePause',_0x0012('0x82')],'raw':!![]}]})[_0x0012('0x29')](function(_0x22a7f8){if(_0x22a7f8){_0x270d2c=_0x22a7f8;var _0xe30fa=_[_0x0012('0x83')](_0x22a7f8,function(_0x250d30){var _0x300690=_0x250d30[_0x0012('0x2b')]({'plain':!![]});return _0x300690['Agents'];});return db[_0x0012('0x32')][_0x0012('0x50')]({'where':{'id':_0x5e3240['params']['id']}})['then'](function(_0x973452){return db[_0x0012('0x84')][_0x0012('0x53')](function(_0x26fa8a){return _0x973452[_0x0012('0x85')](_0x346739,{'transaction':_0x26fa8a})[_0x0012('0x29')](function(){return BPromise[_0x0012('0x86')](_0x270d2c,function(_0x5d3b2e){return db[_0x0012('0x87')][_0x0012('0x88')]({'TeamId':_0x5d3b2e['id'],'VoicePrefixId':_0x5e3240[_0x0012('0x74')]['id']},{'transaction':_0x26fa8a});});})[_0x0012('0x29')](function(){return BPromise['each'](_0xe30fa,function(_0x558eb3){return db['UserVoicePrefix'][_0x0012('0x89')]({'where':{'UserId':_0x558eb3['id'],'VoicePrefixId':_0x5e3240[_0x0012('0x74')]['id']},'transaction':_0x26fa8a});});})[_0x0012('0x29')](function(){_0xe30fa['forEach'](function(_0x24264b){socket[_0x0012('0x78')](_0x0012('0x8a'),{'UserId':_0x24264b['id'],'VoicePrefixId':_0x973452['id']});});});});});}})[_0x0012('0x29')](respondWithStatusCode(_0x18aee3,null))['catch'](handleError(_0x18aee3,null));};exports[_0x0012('0x8b')]=function(_0x12c6fa,_0x5b1cb3,_0x5cb8b9){return db['Team'][_0x0012('0x4d')]({'where':{'id':_0x12c6fa[_0x0012('0x38')][_0x0012('0x75')]},'attributes':['id'],'include':[{'model':db[_0x0012('0x7e')],'as':_0x0012('0x80'),'attributes':['id'],'raw':!![]}]})[_0x0012('0x29')](handleEntityNotFound(_0x5b1cb3,null))[_0x0012('0x29')](function(_0x2c186c){var _0x1c0814=_[_0x0012('0x37')](_0x2c186c,'id');var _0x1c1b75=[];var _0x272b17=[];var _0x504cba=squel['select']();_0x504cba['field']('tq.TeamId')[_0x0012('0x8c')](_0x0012('0x8d'),'tq')['join']('user_has_teams','ut',_0x0012('0x8e'))['where'](_0x0012('0x8f'),_0x12c6fa['params']['id']);for(var _0x58e8cf=0x0;_0x58e8cf<_0x2c186c[_0x0012('0x3e')];_0x58e8cf+=0x1){let _0x2c692=_0x2c186c[_0x58e8cf];for(var _0x3bad29=0x0;_0x3bad29<_0x2c692[_0x0012('0x80')]['length'];_0x3bad29+=0x1){let _0x4ccd2f=_0x2c692[_0x0012('0x80')][_0x3bad29];var _0x14b576=_0x504cba['clone']();_0x14b576[_0x0012('0x44')](_0x0012('0x90'),_0x4ccd2f['id']);_0x272b17[_0x0012('0x69')](db['sequelize'][_0x0012('0x38')](_0x14b576[_0x0012('0x91')](),{'type':db[_0x0012('0x84')][_0x0012('0x92')][_0x0012('0x93')]})['then'](function(_0x860c38){if(_0x860c38[_0x0012('0x3e')]===0x1){return _0x4ccd2f['id'];}else{var _0x316014=_['every'](_['map'](_0x860c38,_0x0012('0x94')),function(_0x50acf5){return _[_0x0012('0x95')](_0x1c0814,_0x50acf5);});if(_0x316014){return _0x4ccd2f['id'];}}}));}}return BPromise['all'](_0x272b17)[_0x0012('0x29')](function(_0x3153a3){_0x1c1b75=_(_0x1c1b75)[_0x0012('0x96')](_0x3153a3)[_0x0012('0x97')]()[_0x0012('0x98')]();return db['VoicePrefix'][_0x0012('0x50')]({'where':{'id':_0x12c6fa['params']['id']}})[_0x0012('0x29')](function(_0x343e40){return db['sequelize']['transaction'](function(_0x260d80){return _0x343e40[_0x0012('0x8b')](_0x12c6fa[_0x0012('0x38')]['ids'],{'transaction':_0x260d80})[_0x0012('0x29')](function(){if(!_[_0x0012('0x99')](_0x1c1b75)){return _0x343e40[_0x0012('0x79')](_0x1c1b75,{'transaction':_0x260d80});}})[_0x0012('0x29')](function(){_0x1c1b75['forEach'](function(_0x5d5544){socket[_0x0012('0x78')](_0x0012('0x7b'),{'UserId':_0x5d5544,'VoicePrefixId':_0x343e40['id']});});});});});});})['then'](respondWithStatusCode(_0x5b1cb3,null))[_0x0012('0x4f')](handleError(_0x5b1cb3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b8b8691..6a9bca0 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 _0xcf01=['events','VoicePrefix','setMaxListeners','emit','exports'];(function(_0x57338e,_0x49889f){var _0x3da2b7=function(_0xd32650){while(--_0xd32650){_0x57338e['push'](_0x57338e['shift']());}};_0x3da2b7(++_0x49889f);}(_0xcf01,0xfa));var _0x1cf0=function(_0x23bea4,_0x38a38){_0x23bea4=_0x23bea4-0x0;var _0xb54789=_0xcf01[_0x23bea4];return _0xb54789;};'use strict';var EventEmitter=require(_0x1cf0('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x1cf0('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x1cf0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x285b52){return function(_0x3b2e75,_0x2a148f,_0x2f7fd5){VoicePrefixEvents[_0x1cf0('0x3')](_0x285b52+':'+_0x3b2e75['id'],_0x3b2e75);VoicePrefixEvents['emit'](_0x285b52,_0x3b2e75);_0x2f7fd5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x1cf0('0x4')]=VoicePrefixEvents; \ No newline at end of file +var _0x4c19=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x4c19,0x1a6));var _0x94c1=function(_0x2164da,_0x16cd0b){_0x2164da=_0x2164da-0x0;var _0x12da0d=_0x4c19[_0x2164da];return _0x12da0d;};'use strict';var EventEmitter=require(_0x94c1('0x0'));var VoicePrefix=require(_0x94c1('0x1'))['db'][_0x94c1('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x94c1('0x3')](0x0);var events={'afterCreate':_0x94c1('0x4'),'afterUpdate':_0x94c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x135a5d){return function(_0x43d203,_0x3eb11b,_0x381540){VoicePrefixEvents[_0x94c1('0x6')](_0x135a5d+':'+_0x43d203['id'],_0x43d203);VoicePrefixEvents[_0x94c1('0x6')](_0x135a5d,_0x43d203);_0x381540(null);};}for(var e in events){if(events[_0x94c1('0x7')](e)){var event=events[e];VoicePrefix[_0x94c1('0x8')](e,emitEvent(event));}}module[_0x94c1('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 65217f1..3ff43e8 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 _0xc562=['rimraf','../../config/environment','./voicePrefix.attributes','voice_prefixes','lodash','util','api','moment','request-promise','path'];(function(_0x13a7dc,_0x3a09d7){var _0x42fc23=function(_0x27fe3a){while(--_0x27fe3a){_0x13a7dc['push'](_0x13a7dc['shift']());}};_0x42fc23(++_0x3a09d7);}(_0xc562,0xea));var _0x2c56=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc562[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x2c56('0x0'));var util=require(_0x2c56('0x1'));var logger=require('../../config/logger')(_0x2c56('0x2'));var moment=require(_0x2c56('0x3'));var BPromise=require('bluebird');var rp=require(_0x2c56('0x4'));var fs=require('fs');var path=require(_0x2c56('0x5'));var rimraf=require(_0x2c56('0x6'));var config=require(_0x2c56('0x7'));var attributes=require(_0x2c56('0x8'));module['exports']=function(_0xeaf972,_0x4f7b43){return _0xeaf972['define']('VoicePrefix',attributes,{'tableName':_0x2c56('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce61=['bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','moment'];(function(_0x540df4,_0x264a86){var _0x23dc36=function(_0x3661ba){while(--_0x3661ba){_0x540df4['push'](_0x540df4['shift']());}};_0x23dc36(++_0x264a86);}(_0xce61,0x8b));var _0x1ce6=function(_0x336267,_0x1530c0){_0x336267=_0x336267-0x0;var _0x4064af=_0xce61[_0x336267];return _0x4064af;};'use strict';var _=require(_0x1ce6('0x0'));var util=require(_0x1ce6('0x1'));var logger=require(_0x1ce6('0x2'))('api');var moment=require(_0x1ce6('0x3'));var BPromise=require(_0x1ce6('0x4'));var rp=require(_0x1ce6('0x5'));var fs=require('fs');var path=require(_0x1ce6('0x6'));var rimraf=require('rimraf');var config=require(_0x1ce6('0x7'));var attributes=require(_0x1ce6('0x8'));module[_0x1ce6('0x9')]=function(_0x57336a,_0x1fff52){return _0x57336a[_0x1ce6('0xa')](_0x1ce6('0xb'),attributes,{'tableName':_0x1ce6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 6c54d13..a620f87 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 _0x57b7=['VoicePrefix,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','request','info','request\x20sent','debug','error','message'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x57b7,0x160));var _0x757b=function(_0x2cbe55,_0x35a201){_0x2cbe55=_0x2cbe55-0x0;var _0x9cf533=_0x57b7[_0x2cbe55];return _0x9cf533;};'use strict';var _=require(_0x757b('0x0'));var util=require(_0x757b('0x1'));var moment=require(_0x757b('0x2'));var BPromise=require(_0x757b('0x3'));var rs=require(_0x757b('0x4'));var fs=require('fs');var Redis=require(_0x757b('0x5'));var db=require(_0x757b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x757b('0x7'))(_0x757b('0x8'));var config=require(_0x757b('0x9'));var jayson=require(_0x757b('0xa'));var client=jayson['client'][_0x757b('0xb')]({'port':0x232a});config[_0x757b('0xc')]=_[_0x757b('0xd')](config[_0x757b('0xc')],{'host':_0x757b('0xe'),'port':0x18eb});var socket=require(_0x757b('0xf'))(new Redis(config[_0x757b('0xc')]));require(_0x757b('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f048,_0x2bd3bc,_0x5d1f89){return new BPromise(function(_0x14b8e8,_0x5a0164){return client[_0x757b('0x11')](_0x1f048,_0x5d1f89)['then'](function(_0x2a440d){logger[_0x757b('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2bd3bc,_0x757b('0x13'));logger[_0x757b('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2bd3bc,_0x757b('0x13'),JSON['stringify'](_0x2a440d));if(_0x2a440d[_0x757b('0x15')]){if(_0x2a440d[_0x757b('0x15')]['code']===0x1f4){logger[_0x757b('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2bd3bc,_0x2a440d[_0x757b('0x15')][_0x757b('0x16')]);return _0x5a0164(_0x2a440d[_0x757b('0x15')]['message']);}logger[_0x757b('0x15')](_0x757b('0x17'),_0x2bd3bc,_0x2a440d['error'][_0x757b('0x16')]);return _0x14b8e8(_0x2a440d['error']['message']);}else{logger[_0x757b('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x2bd3bc,_0x757b('0x13'));_0x14b8e8(_0x2a440d[_0x757b('0x18')][_0x757b('0x16')]);}})['catch'](function(_0x5c86f8){logger[_0x757b('0x15')](_0x757b('0x17'),_0x2bd3bc,_0x5c86f8);_0x5a0164(_0x5c86f8);});});} \ No newline at end of file +var _0xbf13=['jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xedd6b2,_0x58a2a0){var _0x418929=function(_0x7fe9c6){while(--_0x7fe9c6){_0xedd6b2['push'](_0xedd6b2['shift']());}};_0x418929(++_0x58a2a0);}(_0xbf13,0xe2));var _0x3bf1=function(_0x5acbbb,_0x15f756){_0x5acbbb=_0x5acbbb-0x0;var _0x4435bf=_0xbf13[_0x5acbbb];return _0x4435bf;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require(_0x3bf1('0x7'));var jayson=require(_0x3bf1('0x8'));var client=jayson[_0x3bf1('0x9')][_0x3bf1('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3bf1('0xb')],{'host':_0x3bf1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bf1('0xb')]));require(_0x3bf1('0xd'))[_0x3bf1('0xe')](socket);function respondWithRpcPromise(_0x3bcda3,_0xdc68d1,_0xa1374a){return new BPromise(function(_0x48444a,_0x50bf27){return client[_0x3bf1('0xf')](_0x3bcda3,_0xa1374a)[_0x3bf1('0x10')](function(_0x4d8dbd){logger[_0x3bf1('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xdc68d1,_0x3bf1('0x12'));logger[_0x3bf1('0x13')](_0x3bf1('0x14'),_0xdc68d1,_0x3bf1('0x12'),JSON[_0x3bf1('0x15')](_0x4d8dbd));if(_0x4d8dbd[_0x3bf1('0x16')]){if(_0x4d8dbd['error']['code']===0x1f4){logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x50bf27(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x48444a(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}else{logger[_0x3bf1('0x11')](_0x3bf1('0x17'),_0xdc68d1,'request\x20sent');_0x48444a(_0x4d8dbd['result'][_0x3bf1('0x18')]);}})[_0x3bf1('0x19')](function(_0x140e51){logger['error']('VoicePrefix,\x20%s,\x20%s',_0xdc68d1,_0x140e51);_0x50bf27(_0x140e51);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 883e736..fa91814 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 _0x3ae9=['register','length','voicePrefix:','remove','update','emit'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3ae9,0xdb));var _0x93ae=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3ae9[_0x17d9e3];return _0x14192d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save',_0x93ae('0x0'),_0x93ae('0x1')];function createListener(_0x189f64,_0x4a724f){return function(_0x946abf){_0x4a724f[_0x93ae('0x2')](_0x189f64,_0x946abf);};}function removeListener(_0x2dc540,_0x2af5aa){return function(){VoicePrefixEvents['removeListener'](_0x2dc540,_0x2af5aa);};}exports[_0x93ae('0x3')]=function(_0x51e450){for(var _0x3a9a9c=0x0,_0x32564c=events[_0x93ae('0x4')];_0x3a9a9c<_0x32564c;_0x3a9a9c++){var _0x36e141=events[_0x3a9a9c];var _0x22761c=createListener(_0x93ae('0x5')+_0x36e141,_0x51e450);VoicePrefixEvents['on'](_0x36e141,_0x22761c);}}; \ No newline at end of file +var _0xc964=['update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x4cc891,_0x26eaf7){var _0x1466e3=function(_0x2f2a58){while(--_0x2f2a58){_0x4cc891['push'](_0x4cc891['shift']());}};_0x1466e3(++_0x26eaf7);}(_0xc964,0x7e));var _0x4c96=function(_0x3b21e8,_0x3448c3){_0x3b21e8=_0x3b21e8-0x0;var _0xbc0c43=_0xc964[_0x3b21e8];return _0xbc0c43;};'use strict';var VoicePrefixEvents=require(_0x4c96('0x0'));var events=[_0x4c96('0x1'),'remove',_0x4c96('0x2')];function createListener(_0x8d390f,_0x90fbb1){return function(_0x591daa){_0x90fbb1[_0x4c96('0x3')](_0x8d390f,_0x591daa);};}function removeListener(_0x491d1e,_0x1b0a58){return function(){VoicePrefixEvents[_0x4c96('0x4')](_0x491d1e,_0x1b0a58);};}exports[_0x4c96('0x5')]=function(_0x2f6461){for(var _0x45bb27=0x0,_0x1fa8a0=events[_0x4c96('0x6')];_0x45bb27<_0x1fa8a0;_0x45bb27++){var _0x493618=events[_0x45bb27];var _0x19ed76=createListener(_0x4c96('0x7')+_0x493618,_0x2f6461);VoicePrefixEvents['on'](_0x493618,_0x19ed76);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 163a595..d876165 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x532972,_0x23f2da){var _0x308435=function(_0x4d0ebc){while(--_0x4d0ebc){_0x532972['push'](_0x532972['shift']());}};_0x308435(++_0x23f2da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x24cf7f,_0xcda231){var _0x4c6742=function(_0x2469db){while(--_0x2469db){_0x24cf7f['push'](_0x24cf7f['shift']());}};_0x4c6742(++_0xcda231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index f2d2728..7bb35ea 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 _0xe705=['UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','Dial\x20Method.'];(function(_0xfe26da,_0x5ac1b7){var _0x2abe6e=function(_0x586ea1){while(--_0x586ea1){_0xfe26da['push'](_0xfe26da['shift']());}};_0x2abe6e(++_0x5ac1b7);}(_0xe705,0xc4));var _0x5e70=function(_0x536380,_0x3f79d5){_0x536380=_0x536380-0x0;var _0xd2229d=_0xe705[_0x536380];return _0xd2229d;};'use strict';var Sequelize=require(_0x5e70('0x0'));module[_0x5e70('0x1')]={'name':{'type':Sequelize[_0x5e70('0x2')],'allowNull':![],'unique':_0x5e70('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x5e70('0x4')]('inbound',_0x5e70('0x5')),'allowNull':![],'defaultValue':_0x5e70('0x6')},'musiconhold':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':_0x5e70('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x5e70('0x4')]('rr',_0x5e70('0x8'),_0x5e70('0x9'),_0x5e70('0xa'),_0x5e70('0xb'),_0x5e70('0xc'),'linear',_0x5e70('0xd'),_0x5e70('0xe')),'allowNull':![],'defaultValue':_0x5e70('0x8'),'set':function(_0x35a74d){this[_0x5e70('0xf')](_0x5e70('0x10'),_0x35a74d?_0x35a74d:_0x5e70('0xc'));},'get':function(){var _0x3d17c3=this[_0x5e70('0x11')]('type');var _0x2497cc=this[_0x5e70('0x11')](_0x5e70('0x12'));var _0x552dc5=this[_0x5e70('0x11')]('strategy');if(_0x3d17c3===_0x5e70('0x6')){return _0x552dc5;}if(_0x2497cc===_0x5e70('0x13')&&_0x552dc5===_0x5e70('0xc')||_0x2497cc===_0x5e70('0x13')&&_0x552dc5===_0x5e70('0x14')){return _0x552dc5;}if(_0x2497cc===_0x5e70('0x15')||_0x2497cc===_0x5e70('0x16')||_0x2497cc===_0x5e70('0x17')){return _0x552dc5;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5e70('0x18')](0xb)},'timeout':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5e70('0x2')]},'weight':{'type':Sequelize[_0x5e70('0x18')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no',_0x5e70('0x1a')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5e70('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x5e70('0x19'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x5e70('0x19'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x5e70('0x19'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5e70('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5e70('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x5e70('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':_0x5e70('0x19')},'announce_holdtime':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5e70('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x5e70('0x18')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5e70('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5e70('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5e70('0x2')]},'queue_quantity1':{'type':Sequelize[_0x5e70('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x5e70('0x2')]},'queue_less_than':{'type':Sequelize[_0x5e70('0x2')]},'periodic_announce':{'type':Sequelize[_0x5e70('0x1b')],'set':function(_0x3bb840){this[_0x5e70('0xf')](_0x5e70('0x1c'),_0x3bb840?_0x3bb840[_0x5e70('0x1d')](','):[]);},'get':function(){return this['getDataValue'](_0x5e70('0x1c'))?this[_0x5e70('0x11')](_0x5e70('0x1c'))[_0x5e70('0x1e')](','):[];}},'joinempty':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':_0x5e70('0x19'),'set':function(_0x119140){this[_0x5e70('0xf')]('joinempty',_0x119140?_0x119140['join'](','):undefined);},'get':function(){return this[_0x5e70('0x11')](_0x5e70('0x1f'))?this['getDataValue'](_0x5e70('0x1f'))[_0x5e70('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xa88b78){this[_0x5e70('0xf')](_0x5e70('0x20'),_0xa88b78?_0xa88b78[_0x5e70('0x1d')](','):undefined);},'get':function(){return this[_0x5e70('0x11')]('leavewhenempty')?this['getDataValue']('leavewhenempty')[_0x5e70('0x1e')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5e70('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x19'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5e70('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':0x0,'set':function(_0x2e1e69){this[_0x5e70('0xf')]('acw',_0x2e1e69);if(_0x2e1e69){if(this[_0x5e70('0x11')](_0x5e70('0x22'))<0x2){this['setDataValue'](_0x5e70('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5e70('0x18')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':0x0,'comment':_0x5e70('0x23')},'dialMethod':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x24'),'progressive',_0x5e70('0x17'),_0x5e70('0x16'),_0x5e70('0x13')),'defaultValue':'progressive','comment':_0x5e70('0x25')},'dialLimitChannel':{'type':Sequelize[_0x5e70('0x18')](0x4)[_0x5e70('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x5e70('0x18')](0x4)[_0x5e70('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5e70('0x27')},'dialPowerLevel':{'type':Sequelize[_0x5e70('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x29'),_0x5e70('0x2a')),'defaultValue':_0x5e70('0x2a'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x5e70('0x28')](0x2)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5e70('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x5e70('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5e70('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x5e70('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':_0x5e70('0x2d'),'comment':_0x5e70('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x5e70('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x5e70('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x30')},'dialBusyMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'comment':_0x5e70('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5e70('0x34')},'dialTimezone':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5e70('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5e70('0x4')](_0x5e70('0x35'),'never',_0x5e70('0x36')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':0x0,'comment':_0x5e70('0x37')},'dialAMDInitialSilence':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5e70('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5e70('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5e70('0x3a')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5e70('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5e70('0x18')](0x9)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5e70('0x3c')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5e70('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5e70('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5e70('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':0x0,'comment':_0x5e70('0x40')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x5e70('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x5e70('0x18')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5e70('0x42')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5e70('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5e70('0x18')](0x5)[_0x5e70('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5e70('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x5e70('0x4b')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5e70('0x4c'),'set':function(_0x255708){if(!_0x255708)this[_0x5e70('0xf')](_0x5e70('0x4d'),null);this[_0x5e70('0xf')]('mandatoryDisposition',_0x255708);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x5e70('0x18')](0x3)[_0x5e70('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x5e70('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x102b=['name','ENUM','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','once','TEXT','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING'];(function(_0x36fe51,_0x2267b3){var _0x30e4b1=function(_0x44d57c){while(--_0x44d57c){_0x36fe51['push'](_0x36fe51['shift']());}};_0x30e4b1(++_0x2267b3);}(_0x102b,0xeb));var _0xb102=function(_0x490a8d,_0x334e56){_0x490a8d=_0x490a8d-0x0;var _0x2a3519=_0x102b[_0x490a8d];return _0x2a3519;};'use strict';var Sequelize=require(_0xb102('0x0'));module['exports']={'name':{'type':Sequelize[_0xb102('0x1')],'allowNull':![],'unique':_0xb102('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb102('0x3')]('inbound',_0xb102('0x4')),'allowNull':![],'defaultValue':_0xb102('0x5')},'musiconhold':{'type':Sequelize[_0xb102('0x1')],'defaultValue':_0xb102('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xb102('0x3')]('rr',_0xb102('0x7'),_0xb102('0x8'),_0xb102('0x9'),_0xb102('0xa'),_0xb102('0xb'),_0xb102('0xc'),'wrandom',_0xb102('0xd')),'allowNull':![],'defaultValue':_0xb102('0x7'),'set':function(_0x2e26aa){this[_0xb102('0xe')](_0xb102('0xf'),_0x2e26aa?_0x2e26aa:_0xb102('0xb'));},'get':function(){var _0x141f51=this[_0xb102('0x10')](_0xb102('0x11'));var _0x2e9ecf=this['getDataValue'](_0xb102('0x12'));var _0x5aee67=this[_0xb102('0x10')](_0xb102('0xf'));if(_0x141f51===_0xb102('0x5')){return _0x5aee67;}if(_0x2e9ecf===_0xb102('0x13')&&_0x5aee67===_0xb102('0xb')||_0x2e9ecf===_0xb102('0x13')&&_0x5aee67===_0xb102('0x14')){return _0x5aee67;}if(_0x2e9ecf==='progressive'||_0x2e9ecf===_0xb102('0x15')||_0x2e9ecf===_0xb102('0x16')){return _0x5aee67;}return null;}},'servicelevel':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb102('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xb102('0x17')](0xb)},'timeout':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb102('0x1')]},'weight':{'type':Sequelize[_0xb102('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb102('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xb102('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb102('0x3')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xb102('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb102('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xb102('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no',_0xb102('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb102('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xb102('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb102('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb102('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xb102('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb102('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb102('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xb102('0x1')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xb102('0x1')]},'queue_less_than':{'type':Sequelize[_0xb102('0x1')]},'periodic_announce':{'type':Sequelize[_0xb102('0x1a')],'set':function(_0x2f2c5a){this['setDataValue']('periodic_announce',_0x2f2c5a?_0x2f2c5a[_0xb102('0x1b')](','):[]);},'get':function(){return this[_0xb102('0x10')](_0xb102('0x1c'))?this[_0xb102('0x10')](_0xb102('0x1c'))[_0xb102('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xb102('0x1')],'defaultValue':_0xb102('0x18'),'set':function(_0x4b5b52){this[_0xb102('0xe')]('joinempty',_0x4b5b52?_0x4b5b52[_0xb102('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xb102('0x1e'))?this['getDataValue'](_0xb102('0x1e'))[_0xb102('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb102('0x1')],'defaultValue':'no','set':function(_0x36d7b7){this['setDataValue'](_0xb102('0x1f'),_0x36d7b7?_0x36d7b7[_0xb102('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xb102('0x1f'))?this[_0xb102('0x10')](_0xb102('0x1f'))[_0xb102('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xb102('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb102('0x1')]},'description':{'type':Sequelize[_0xb102('0x1')]},'acw':{'type':Sequelize[_0xb102('0x20')],'defaultValue':0x0,'set':function(_0xa2395d){this[_0xb102('0xe')]('acw',_0xa2395d);if(_0xa2395d){if(this[_0xb102('0x10')](_0xb102('0x21'))<0x2){this[_0xb102('0xe')](_0xb102('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xb102('0x20')],'defaultValue':0x0,'comment':_0xb102('0x22')},'dialMethod':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x23'),_0xb102('0x24'),'power',_0xb102('0x15'),_0xb102('0x13')),'defaultValue':_0xb102('0x24'),'comment':_0xb102('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xb102('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb102('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xb102('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xb102('0x28')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xb102('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0xb102('0x3')]('agentBusyFactor',_0xb102('0x2a')),'defaultValue':_0xb102('0x2a'),'comment':_0xb102('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xb102('0x28')](0x2)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xb102('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0xb102('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb102('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xb102('0x1')],'defaultValue':_0xb102('0x2e'),'comment':_0xb102('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x30')},'dialQueueProject':{'type':Sequelize[_0xb102('0x1')],'comment':_0xb102('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xb102('0x17')](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb102('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb102('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb102('0x1')],'defaultValue':_0xb102('0x36')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x37'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0xb102('0x20')],'defaultValue':0x0,'comment':_0xb102('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xb102('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb102('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb102('0x17')](0x9)[_0xb102('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb102('0x17')](0x9)[_0xb102('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb102('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0xb102('0x17')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb102('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb102('0x17')](0x9)[_0xb102('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb102('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb102('0x17')](0x9)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb102('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb102('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb102('0x17')](0x9)[_0xb102('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb102('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0xb102('0x17')](0x5)[_0xb102('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xb102('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xb102('0x20')],'defaultValue':0x0,'comment':_0xb102('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb102('0x3')](_0xb102('0x41'),_0xb102('0x42')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xb102('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb102('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xb102('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x44')},'dialDropMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x45')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb102('0x17')](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x47')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x48')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb102('0x17')](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb102('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb102('0x17')](0x5)[_0xb102('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb102('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb102('0x17')],'allowNull':!![],'comment':_0xb102('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xb102('0x20')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c9d37){if(!_0x3c9d37)this[_0xb102('0xe')](_0xb102('0x4d'),null);this[_0xb102('0xe')](_0xb102('0x4e'),_0x3c9d37);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb102('0x17')](0x3)[_0xb102('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xb102('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xb102('0x20')],'defaultValue':!![]},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb102('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index ddd62bf..463b614 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 _0x2374=['order','sort','where','pick','merge','options','includeAll','include','rows','catch','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CmHopper','VoiceQueueId','findAll','getHopperHistories','findOne','length','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','format','emit','removeTeams','ids','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','removeAgents','UserVoiceQueueRt','addAgents','userVoiceQueue:save','isEmpty','SIP/%s','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','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','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','./voiceQueue.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','destroy','error','stack','name','send','VoiceQueue','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit'];(function(_0x2a1d94,_0x173ef3){var _0x19fd31=function(_0x1a0c27){while(--_0x1a0c27){_0x2a1d94['push'](_0x2a1d94['shift']());}};_0x19fd31(++_0x173ef3);}(_0x2374,0x1e5));var _0x4237=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x2374[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x4237('0x0'));var rimraf=require(_0x4237('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4237('0x2'));var rp=require(_0x4237('0x3'));var moment=require(_0x4237('0x4'));var BPromise=require(_0x4237('0x5'));var Mustache=require('mustache');var util=require(_0x4237('0x6'));var path=require(_0x4237('0x7'));var sox=require(_0x4237('0x8'));var csv=require(_0x4237('0x9'));var ejs=require(_0x4237('0xa'));var fs=require('fs');var fs_extra=require(_0x4237('0xb'));var _=require(_0x4237('0xc'));var squel=require(_0x4237('0xd'));var crypto=require(_0x4237('0xe'));var jsforce=require(_0x4237('0xf'));var deskjs=require(_0x4237('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4237('0x11'));var Papa=require(_0x4237('0x12'));var Redis=require(_0x4237('0x13'));var authService=require(_0x4237('0x14'));var qs=require(_0x4237('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4237('0x16'));var logger=require(_0x4237('0x17'))(_0x4237('0x18'));var utils=require('../../config/utils');var config=require(_0x4237('0x19'));var licenseUtil=require(_0x4237('0x1a'));var db=require(_0x4237('0x1b'))['db'];config[_0x4237('0x1c')]=_['defaults'](config[_0x4237('0x1c')],{'host':_0x4237('0x1d'),'port':0x18eb});var socket=require(_0x4237('0x1e'))(new Redis(config[_0x4237('0x1c')]));require(_0x4237('0x1f'))['register'](socket);function respondWithStatusCode(_0x5740c8,_0x23c799){_0x23c799=_0x23c799||0xcc;return function(_0xe7f33c){if(_0xe7f33c){return _0x5740c8[_0x4237('0x20')](_0x23c799);}return _0x5740c8[_0x4237('0x21')](_0x23c799)[_0x4237('0x22')]();};}function respondWithResult(_0x3a5a0c,_0x265309){_0x265309=_0x265309||0xc8;return function(_0x67e6dd){if(_0x67e6dd){return _0x3a5a0c['status'](_0x265309)[_0x4237('0x23')](_0x67e6dd);}};}function respondWithFilteredResult(_0x5e7923,_0x20c3bb){return function(_0x23d137){if(_0x23d137){var _0x325c8c=typeof _0x20c3bb['offset']==='undefined'&&typeof _0x20c3bb[_0x4237('0x24')]===_0x4237('0x25');var _0x1ac242=_0x23d137[_0x4237('0x26')];var _0x89c6c6=_0x325c8c?0x0:_0x20c3bb[_0x4237('0x27')];var _0x272aa2=_0x325c8c?_0x23d137[_0x4237('0x26')]:_0x20c3bb['offset']+_0x20c3bb[_0x4237('0x24')];var _0x31f8bb;if(_0x272aa2>=_0x1ac242){_0x272aa2=_0x1ac242;_0x31f8bb=0xc8;}else{_0x31f8bb=0xce;}_0x5e7923[_0x4237('0x21')](_0x31f8bb);return _0x5e7923[_0x4237('0x28')](_0x4237('0x29'),_0x89c6c6+'-'+_0x272aa2+'/'+_0x1ac242)[_0x4237('0x23')](_0x23d137);}return null;};}function patchUpdates(_0x4eff0c){return function(_0x193700){try{jsonpatch[_0x4237('0x2a')](_0x193700,_0x4eff0c,!![]);}catch(_0x231085){return BPromise[_0x4237('0x2b')](_0x231085);}return _0x193700['save']();};}function saveUpdates(_0x313c55,_0x35f9d0){return function(_0x314cb2){if(_0x314cb2){return _0x314cb2[_0x4237('0x2c')](_0x313c55)[_0x4237('0x2d')](function(_0x5280a8){return _0x5280a8;});}return null;};}function removeEntity(_0x4e55b6,_0x9633d3){return function(_0x3199f3){if(_0x3199f3){return _0x3199f3['destroy']()[_0x4237('0x2d')](function(){var _0x44f7d5=_0x3199f3['get']({'plain':!![]});var _0x11d68d=[{'name':_0x4237('0x2e'),'value':_0x4237('0x2f'),'ignore':![]},{'name':_0x4237('0x30'),'value':_0x4237('0x31'),'ignore':![]}];var _0x5cb205=_(_0x11d68d)[_0x4237('0x32')](_0x4237('0x33'))[_0x4237('0x34')](_0x4237('0x35'))[_0x4237('0x35')]();if(_[_0x4237('0x36')](_0x5cb205,_0x44f7d5['type'])){return;}var _0x3af913=_['find'](_0x11d68d,[_0x4237('0x35'),_0x44f7d5['type']])['name'];return db['UserProfileResource'][_0x4237('0x37')]({'where':{'type':_0x3af913,'resourceId':_0x44f7d5['id']}})[_0x4237('0x2d')](function(){return _0x3199f3;});})[_0x4237('0x2d')](function(){_0x4e55b6[_0x4237('0x21')](0xcc)[_0x4237('0x22')]();});}};}function handleEntityNotFound(_0xd61141,_0x123c1a){return function(_0x53dae7){if(!_0x53dae7){_0xd61141[_0x4237('0x20')](0x194);}return _0x53dae7;};}function handleError(_0x5ab83e,_0x3edacc){_0x3edacc=_0x3edacc||0x1f4;return function(_0x56d8a8){logger[_0x4237('0x38')](_0x56d8a8[_0x4237('0x39')]);if(_0x56d8a8[_0x4237('0x3a')]){delete _0x56d8a8[_0x4237('0x3a')];}_0x5ab83e[_0x4237('0x21')](_0x3edacc)[_0x4237('0x3b')](_0x56d8a8);};}exports['index']=function(_0x227246,_0xe54512){var _0x561767={},_0x24ce86={},_0x16497a={'count':0x0,'rows':[]};var _0x49aaed=_[_0x4237('0x34')](db[_0x4237('0x3c')][_0x4237('0x3d')],function(_0xc8876a){return{'name':_0xc8876a[_0x4237('0x3e')],'type':_0xc8876a[_0x4237('0x3f')]['key']};});_0x24ce86['model']=_[_0x4237('0x34')](_0x49aaed,_0x4237('0x3a'));_0x24ce86['query']=_[_0x4237('0x40')](_0x227246[_0x4237('0x41')]);_0x24ce86[_0x4237('0x42')]=_[_0x4237('0x43')](_0x24ce86[_0x4237('0x44')],_0x24ce86[_0x4237('0x41')]);_0x561767['attributes']=_['intersection'](_0x24ce86[_0x4237('0x44')],qs[_0x4237('0x45')](_0x227246[_0x4237('0x41')][_0x4237('0x45')]));_0x561767[_0x4237('0x46')]=_0x561767[_0x4237('0x46')]['length']?_0x561767[_0x4237('0x46')]:_0x24ce86[_0x4237('0x44')];if(!_0x227246[_0x4237('0x41')][_0x4237('0x47')](_0x4237('0x48'))){_0x561767[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x227246['query'][_0x4237('0x24')]);_0x561767[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x227246[_0x4237('0x41')][_0x4237('0x27')]);}_0x561767[_0x4237('0x49')]=qs[_0x4237('0x4a')](_0x227246[_0x4237('0x41')][_0x4237('0x4a')]);_0x561767[_0x4237('0x4b')]=qs['filters'](_[_0x4237('0x4c')](_0x227246[_0x4237('0x41')],_0x24ce86[_0x4237('0x42')]),_0x49aaed);if(_0x227246[_0x4237('0x41')][_0x4237('0x32')]){_0x561767['where']=_['merge'](_0x561767[_0x4237('0x4b')],{'$or':_['map'](_0x49aaed,function(_0x17a031){if(_0x17a031[_0x4237('0x3f')]!=='VIRTUAL'){var _0x4177a1={};_0x4177a1[_0x17a031[_0x4237('0x3a')]]={'$like':'%'+_0x227246['query'][_0x4237('0x32')]+'%'};return _0x4177a1;}})});}_0x561767=_[_0x4237('0x4d')]({},_0x561767,_0x227246[_0x4237('0x4e')]);var _0x22ba79={'where':_0x561767[_0x4237('0x4b')]};return db[_0x4237('0x3c')][_0x4237('0x26')](_0x22ba79)[_0x4237('0x2d')](function(_0x125543){_0x16497a[_0x4237('0x26')]=_0x125543;if(_0x227246[_0x4237('0x41')][_0x4237('0x4f')]){_0x561767[_0x4237('0x50')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x561767);})[_0x4237('0x2d')](function(_0x25926a){_0x16497a[_0x4237('0x51')]=_0x25926a;return _0x16497a;})['then'](respondWithFilteredResult(_0xe54512,_0x561767))[_0x4237('0x52')](handleError(_0xe54512,null));};exports[_0x4237('0x53')]=function(_0x79e4ef,_0x227c65){var _0xcdd7e5={'raw':![],'where':{'id':_0x79e4ef[_0x4237('0x54')]['id']}},_0x3159cd={};_0x3159cd[_0x4237('0x44')]=_[_0x4237('0x40')](db[_0x4237('0x3c')][_0x4237('0x3d')]);_0x3159cd['query']=_[_0x4237('0x40')](_0x79e4ef[_0x4237('0x41')]);_0x3159cd[_0x4237('0x42')]=_[_0x4237('0x43')](_0x3159cd[_0x4237('0x44')],_0x3159cd[_0x4237('0x41')]);_0xcdd7e5[_0x4237('0x46')]=_[_0x4237('0x43')](_0x3159cd[_0x4237('0x44')],qs[_0x4237('0x45')](_0x79e4ef[_0x4237('0x41')][_0x4237('0x45')]));_0xcdd7e5[_0x4237('0x46')]=_0xcdd7e5[_0x4237('0x46')]['length']?_0xcdd7e5['attributes']:_0x3159cd[_0x4237('0x44')];if(_0x79e4ef['query'][_0x4237('0x4f')]){_0xcdd7e5['include']=[{'all':!![]}];}_0xcdd7e5=_[_0x4237('0x4d')]({},_0xcdd7e5,_0x79e4ef[_0x4237('0x4e')]);return db['VoiceQueue'][_0x4237('0x55')](_0xcdd7e5)['then'](handleEntityNotFound(_0x227c65,null))[_0x4237('0x2d')](respondWithResult(_0x227c65,null))['catch'](handleError(_0x227c65,null));};exports[_0x4237('0x56')]=function(_0x2f3d43,_0x2b8ba0){return db[_0x4237('0x3c')][_0x4237('0x56')](_0x2f3d43[_0x4237('0x57')],{})['then'](function(_0x2708fe){var _0x28cf20=_0x2f3d43['user'][_0x4237('0x58')]({'plain':!![]});if(!_0x28cf20)throw new Error(_0x4237('0x59'));if(_0x28cf20['role']===_0x4237('0x5a')){var _0x388b81=_0x2708fe[_0x4237('0x58')]({'plain':!![]});var _0x309fa5=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x4237('0x30'),'value':'outbound'}];var _0x7341cb=_['find'](_0x309fa5,['value',_0x388b81[_0x4237('0x3f')]])[_0x4237('0x3a')];return db[_0x4237('0x5b')][_0x4237('0x55')]({'where':{'name':_0x7341cb,'userProfileId':_0x28cf20[_0x4237('0x5c')]},'raw':!![]})[_0x4237('0x2d')](function(_0x351822){if(_0x351822&&_0x351822[_0x4237('0x5d')]===0x0){return db[_0x4237('0x5e')]['create']({'name':_0x388b81[_0x4237('0x3a')],'resourceId':_0x388b81['id'],'type':_0x351822[_0x4237('0x3a')],'sectionId':_0x351822['id']},{})['then'](function(){return _0x2708fe;});}else{return _0x2708fe;}})[_0x4237('0x52')](function(_0x56f950){logger[_0x4237('0x38')](_0x4237('0x5f'),_0x56f950);throw _0x56f950;});}return _0x2708fe;})[_0x4237('0x2d')](respondWithResult(_0x2b8ba0,0xc9))[_0x4237('0x52')](handleError(_0x2b8ba0,null));};exports[_0x4237('0x60')]=function(_0x174c39,_0x19b7c3){var _0x1a6a5e={'where':{'id':_0x174c39[_0x4237('0x54')]['id']}},_0x4073eb={};_0x4073eb[_0x4237('0x44')]=_[_0x4237('0x40')](db[_0x4237('0x3c')][_0x4237('0x3d')]);_0x1a6a5e[_0x4237('0x46')]=_['intersection'](_0x4073eb['model'],qs['fields'](_0x174c39[_0x4237('0x41')][_0x4237('0x45')]));_0x1a6a5e['attributes']=_0x1a6a5e[_0x4237('0x46')]['length']?_0x1a6a5e[_0x4237('0x46')]:_0x4073eb['model'];if(_0x174c39[_0x4237('0x41')]['includeAll']){_0x1a6a5e[_0x4237('0x50')]=[{'all':!![]}];}_0x1a6a5e=_[_0x4237('0x4d')]({},_0x1a6a5e,_0x174c39['options']);return db[_0x4237('0x3c')]['find'](_0x1a6a5e)[_0x4237('0x2d')](handleEntityNotFound(_0x19b7c3,null))[_0x4237('0x2d')](function(_0x4667e0){if(_0x4667e0){var _0x59a6d6=_0x4667e0['get']({'plain':!![]});_0x59a6d6=qs[_0x4237('0x61')](_0x59a6d6,['id',_0x4237('0x62'),'updatedAt']);_0x174c39[_0x4237('0x57')]=_[_0x4237('0x61')](_0x174c39['body'],['id',_0x4237('0x62'),_0x4237('0x63')]);return db[_0x4237('0x3c')][_0x4237('0x56')](_[_0x4237('0x4d')](_0x59a6d6,_0x174c39[_0x4237('0x57')]),{'include':_0x174c39[_0x4237('0x41')][_0x4237('0x4f')]?[{'all':!![]}]:undefined})[_0x4237('0x2d')](function(_0x533ce4){var _0x50aecb=_0x174c39[_0x4237('0x5a')][_0x4237('0x58')]({'plain':!![]});if(!_0x50aecb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50aecb['role']===_0x4237('0x5a')){var _0x188604=_0x533ce4[_0x4237('0x58')]({'plain':!![]});var _0x1f8a0f=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x4237('0x30'),'value':_0x4237('0x31')}];var _0xd9fe33=_['find'](_0x1f8a0f,['value',_0x188604[_0x4237('0x3f')]])[_0x4237('0x3a')];return db['UserProfileSection'][_0x4237('0x55')]({'where':{'name':_0xd9fe33,'userProfileId':_0x50aecb['userProfileId']},'raw':!![]})['then'](function(_0x1f81ac){if(_0x1f81ac&&_0x1f81ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x4237('0x56')]({'name':_0x188604['name'],'resourceId':_0x188604['id'],'type':_0x1f81ac['name'],'sectionId':_0x1f81ac['id']},{})[_0x4237('0x2d')](function(){return _0x533ce4;});}else{return _0x533ce4;}})[_0x4237('0x52')](function(_0x2fbb8a){logger[_0x4237('0x38')](_0x4237('0x5f'),_0x2fbb8a);throw _0x2fbb8a;});}return _0x533ce4;});}})['then'](respondWithResult(_0x19b7c3,0xc9))[_0x4237('0x52')](handleError(_0x19b7c3,null));};exports['update']=function(_0x5657dd,_0x2d87a8){if(_0x5657dd[_0x4237('0x57')]['id']){delete _0x5657dd['body']['id'];}return db['VoiceQueue'][_0x4237('0x55')]({'where':{'id':_0x5657dd[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x2d87a8,null))[_0x4237('0x2d')](saveUpdates(_0x5657dd[_0x4237('0x57')],null))['then'](respondWithResult(_0x2d87a8,null))[_0x4237('0x52')](handleError(_0x2d87a8,null));};exports[_0x4237('0x37')]=function(_0x5ecfaa,_0x258db6){return db[_0x4237('0x3c')][_0x4237('0x55')]({'where':{'id':_0x5ecfaa[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x258db6,null))[_0x4237('0x2d')](removeEntity(_0x258db6,null))[_0x4237('0x52')](handleError(_0x258db6,null));};exports[_0x4237('0x64')]=function(_0x5cc303,_0x445a1b,_0x541de1){var _0x1f7c66={'raw':![],'where':{}};var _0x578a3d={};var _0x231f37={'count':0x0,'rows':[]};return db[_0x4237('0x3c')]['findOne']({'where':{'id':_0x5cc303['params']['id']}})['then'](handleEntityNotFound(_0x445a1b,null))[_0x4237('0x2d')](function(_0x43aa10){if(_0x43aa10){_0x578a3d[_0x4237('0x44')]=_[_0x4237('0x40')](db[_0x4237('0x65')][_0x4237('0x3d')]);_0x578a3d['query']=_['keys'](_0x5cc303[_0x4237('0x41')]);_0x578a3d['filters']=_[_0x4237('0x43')](_0x578a3d[_0x4237('0x44')],_0x578a3d[_0x4237('0x41')]);_0x1f7c66['attributes']=_[_0x4237('0x43')](_0x578a3d['model'],qs[_0x4237('0x45')](_0x5cc303['query'][_0x4237('0x45')]));_0x1f7c66[_0x4237('0x46')]=_0x1f7c66[_0x4237('0x46')]['length']?_0x1f7c66[_0x4237('0x46')]:_0x578a3d['model'];if(!_0x5cc303[_0x4237('0x41')][_0x4237('0x47')](_0x4237('0x48'))){_0x1f7c66[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x5cc303[_0x4237('0x41')]['limit']);_0x1f7c66['offset']=qs['offset'](_0x5cc303['query'][_0x4237('0x27')]);}_0x1f7c66[_0x4237('0x49')]=qs['sort'](_0x5cc303[_0x4237('0x41')][_0x4237('0x4a')]);_0x1f7c66['where']=qs['filters'](_[_0x4237('0x4c')](_0x5cc303[_0x4237('0x41')],_0x578a3d['filters']));_0x1f7c66[_0x4237('0x4b')][_0x4237('0x66')]=_0x43aa10['id'];if(_0x5cc303[_0x4237('0x41')][_0x4237('0x32')]){_0x1f7c66[_0x4237('0x4b')]=_[_0x4237('0x4d')](_0x1f7c66['where'],{'$or':_[_0x4237('0x34')](_0x1f7c66[_0x4237('0x46')],function(_0x13199b){var _0x54b9a9={};_0x54b9a9[_0x13199b]={'$like':'%'+_0x5cc303['query'][_0x4237('0x32')]+'%'};return _0x54b9a9;})});}_0x1f7c66=_['merge']({},_0x1f7c66,_0x5cc303[_0x4237('0x4e')]);return db['CmHopper']['count']({'where':_0x1f7c66['where']})[_0x4237('0x2d')](function(_0x2d8cd1){_0x231f37['count']=_0x2d8cd1;if(_0x5cc303[_0x4237('0x41')][_0x4237('0x4f')]){_0x1f7c66['include']=[{'all':!![]}];}return db[_0x4237('0x65')][_0x4237('0x67')](_0x1f7c66);})[_0x4237('0x2d')](function(_0x40bfb4){_0x231f37[_0x4237('0x51')]=_0x40bfb4;return _0x231f37;});}})[_0x4237('0x2d')](respondWithFilteredResult(_0x445a1b,_0x1f7c66))['catch'](handleError(_0x445a1b,null));};exports[_0x4237('0x68')]=function(_0x18b57a,_0x4d1ee5,_0x4752d8){var _0x137740={'raw':!![],'where':{}};var _0x5abd20={};var _0x27cf38={'count':0x0,'rows':[]};return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x18b57a['params']['id']}})['then'](handleEntityNotFound(_0x4d1ee5,null))[_0x4237('0x2d')](function(_0x3ad690){if(_0x3ad690){_0x5abd20['model']=_['keys'](db['CmHopperHistory'][_0x4237('0x3d')]);_0x5abd20['query']=_['keys'](_0x18b57a[_0x4237('0x41')]);_0x5abd20[_0x4237('0x42')]=_[_0x4237('0x43')](_0x5abd20[_0x4237('0x44')],_0x5abd20[_0x4237('0x41')]);_0x137740[_0x4237('0x46')]=_['intersection'](_0x5abd20[_0x4237('0x44')],qs['fields'](_0x18b57a[_0x4237('0x41')][_0x4237('0x45')]));_0x137740[_0x4237('0x46')]=_0x137740[_0x4237('0x46')][_0x4237('0x6a')]?_0x137740['attributes']:_0x5abd20[_0x4237('0x44')];if(!_0x18b57a[_0x4237('0x41')][_0x4237('0x47')](_0x4237('0x48'))){_0x137740[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x18b57a[_0x4237('0x41')]['limit']);_0x137740[_0x4237('0x27')]=qs['offset'](_0x18b57a[_0x4237('0x41')][_0x4237('0x27')]);}_0x137740['order']=qs[_0x4237('0x4a')](_0x18b57a[_0x4237('0x41')][_0x4237('0x4a')]);_0x137740['where']=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x18b57a[_0x4237('0x41')],_0x5abd20[_0x4237('0x42')]));_0x137740['where']['VoiceQueueId']=_0x3ad690['id'];if(_0x18b57a[_0x4237('0x41')][_0x4237('0x32')]){_0x137740['where']=_[_0x4237('0x4d')](_0x137740[_0x4237('0x4b')],{'$or':_[_0x4237('0x34')](_0x137740[_0x4237('0x46')],function(_0x4ef07f){var _0xb02fdc={};_0xb02fdc[_0x4ef07f]={'$like':'%'+_0x18b57a[_0x4237('0x41')][_0x4237('0x32')]+'%'};return _0xb02fdc;})});}_0x137740=_['merge']({},_0x137740,_0x18b57a[_0x4237('0x4e')]);return db[_0x4237('0x6b')][_0x4237('0x26')]({'where':_0x137740[_0x4237('0x4b')]})['then'](function(_0x192a18){_0x27cf38[_0x4237('0x26')]=_0x192a18;if(_0x18b57a[_0x4237('0x41')]['includeAll']){_0x137740[_0x4237('0x50')]=[{'all':!![]}];}return db[_0x4237('0x6b')][_0x4237('0x67')](_0x137740);})['then'](function(_0x84ff34){_0x27cf38[_0x4237('0x51')]=_0x84ff34;return _0x27cf38;});}})[_0x4237('0x2d')](respondWithFilteredResult(_0x4d1ee5,_0x137740))[_0x4237('0x52')](handleError(_0x4d1ee5,null));};exports['getHopperFinals']=function(_0x30c52e,_0x3b74f6,_0x501a21){var _0x35daa0={'raw':!![],'where':{}};var _0x58c7c2={};var _0x74e0ea={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x30c52e[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x3b74f6,null))[_0x4237('0x2d')](function(_0x4be729){if(_0x4be729){_0x58c7c2['model']=_['keys'](db[_0x4237('0x6c')][_0x4237('0x3d')]);_0x58c7c2[_0x4237('0x41')]=_[_0x4237('0x40')](_0x30c52e[_0x4237('0x41')]);_0x58c7c2[_0x4237('0x42')]=_['intersection'](_0x58c7c2[_0x4237('0x44')],_0x58c7c2[_0x4237('0x41')]);_0x35daa0[_0x4237('0x46')]=_[_0x4237('0x43')](_0x58c7c2[_0x4237('0x44')],qs[_0x4237('0x45')](_0x30c52e[_0x4237('0x41')]['fields']));_0x35daa0[_0x4237('0x46')]=_0x35daa0[_0x4237('0x46')][_0x4237('0x6a')]?_0x35daa0['attributes']:_0x58c7c2[_0x4237('0x44')];if(!_0x30c52e[_0x4237('0x41')][_0x4237('0x47')](_0x4237('0x48'))){_0x35daa0[_0x4237('0x24')]=qs['limit'](_0x30c52e[_0x4237('0x41')][_0x4237('0x24')]);_0x35daa0[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x30c52e[_0x4237('0x41')]['offset']);}_0x35daa0['order']=qs[_0x4237('0x4a')](_0x30c52e[_0x4237('0x41')][_0x4237('0x4a')]);_0x35daa0[_0x4237('0x4b')]=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x30c52e[_0x4237('0x41')],_0x58c7c2[_0x4237('0x42')]));_0x35daa0['where'][_0x4237('0x66')]=_0x4be729['id'];if(_0x30c52e[_0x4237('0x41')][_0x4237('0x32')]){_0x35daa0[_0x4237('0x4b')]=_['merge'](_0x35daa0['where'],{'$or':_[_0x4237('0x34')](_0x35daa0[_0x4237('0x46')],function(_0x4940f2){var _0x37957c={};_0x37957c[_0x4940f2]={'$like':'%'+_0x30c52e[_0x4237('0x41')][_0x4237('0x32')]+'%'};return _0x37957c;})});}_0x35daa0=_[_0x4237('0x4d')]({},_0x35daa0,_0x30c52e[_0x4237('0x4e')]);return db[_0x4237('0x6c')]['count']({'where':_0x35daa0[_0x4237('0x4b')]})['then'](function(_0x5e24f3){_0x74e0ea[_0x4237('0x26')]=_0x5e24f3;if(_0x30c52e[_0x4237('0x41')][_0x4237('0x4f')]){_0x35daa0['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x35daa0);})[_0x4237('0x2d')](function(_0x170397){_0x74e0ea[_0x4237('0x51')]=_0x170397;return _0x74e0ea;});}})[_0x4237('0x2d')](respondWithFilteredResult(_0x3b74f6,_0x35daa0))[_0x4237('0x52')](handleError(_0x3b74f6,null));};exports[_0x4237('0x6d')]=function(_0x17efc8,_0x36411b,_0x5f593a){var _0x4a66c7={'raw':!![],'where':{}};var _0x3d343c={};var _0x4c0cbc={'count':0x0,'rows':[]};return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x17efc8[_0x4237('0x54')]['id']}})['then'](handleEntityNotFound(_0x36411b,null))[_0x4237('0x2d')](function(_0x5985ed){if(_0x5985ed){_0x3d343c[_0x4237('0x44')]=_['keys'](db[_0x4237('0x6e')]['rawAttributes']);_0x3d343c[_0x4237('0x41')]=_['keys'](_0x17efc8[_0x4237('0x41')]);_0x3d343c[_0x4237('0x42')]=_['intersection'](_0x3d343c['model'],_0x3d343c['query']);_0x4a66c7[_0x4237('0x46')]=_['intersection'](_0x3d343c[_0x4237('0x44')],qs[_0x4237('0x45')](_0x17efc8[_0x4237('0x41')][_0x4237('0x45')]));_0x4a66c7[_0x4237('0x46')]=_0x4a66c7['attributes'][_0x4237('0x6a')]?_0x4a66c7['attributes']:_0x3d343c['model'];if(!_0x17efc8[_0x4237('0x41')][_0x4237('0x47')]('nolimit')){_0x4a66c7[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x17efc8[_0x4237('0x41')][_0x4237('0x24')]);_0x4a66c7[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x17efc8['query'][_0x4237('0x27')]);}_0x4a66c7['order']=qs[_0x4237('0x4a')](_0x17efc8[_0x4237('0x41')][_0x4237('0x4a')]);_0x4a66c7[_0x4237('0x4b')]=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x17efc8[_0x4237('0x41')],_0x3d343c[_0x4237('0x42')]));_0x4a66c7['where'][_0x4237('0x66')]=_0x5985ed['id'];if(_0x17efc8[_0x4237('0x41')][_0x4237('0x32')]){_0x4a66c7[_0x4237('0x4b')]=_[_0x4237('0x4d')](_0x4a66c7[_0x4237('0x4b')],{'$or':_['map'](_0x4a66c7[_0x4237('0x46')],function(_0x26071a){var _0x40821d={};_0x40821d[_0x26071a]={'$like':'%'+_0x17efc8['query'][_0x4237('0x32')]+'%'};return _0x40821d;})});}_0x4a66c7=_[_0x4237('0x4d')]({},_0x4a66c7,_0x17efc8[_0x4237('0x4e')]);return db['CmHopperBlack'][_0x4237('0x26')]({'where':_0x4a66c7[_0x4237('0x4b')]})['then'](function(_0x63c56d){_0x4c0cbc[_0x4237('0x26')]=_0x63c56d;if(_0x17efc8[_0x4237('0x41')][_0x4237('0x4f')]){_0x4a66c7[_0x4237('0x50')]=[{'all':!![]}];}return db[_0x4237('0x6e')]['findAll'](_0x4a66c7);})[_0x4237('0x2d')](function(_0x2a3795){_0x4c0cbc[_0x4237('0x51')]=_0x2a3795;return _0x4c0cbc;});}})[_0x4237('0x2d')](respondWithFilteredResult(_0x36411b,_0x4a66c7))[_0x4237('0x52')](handleError(_0x36411b,null));};exports[_0x4237('0x6f')]=function(_0x16ce77,_0x3729e5,_0x4f0f92){var _0x4a6a07={};var _0x4dd678={};var _0x10acbb;var _0x1b63eb;return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x16ce77[_0x4237('0x54')]['id']}})['then'](handleEntityNotFound(_0x3729e5,null))['then'](function(_0x7ba40){if(_0x7ba40){_0x10acbb=_0x7ba40;_0x4dd678[_0x4237('0x44')]=_[_0x4237('0x40')](db[_0x4237('0x70')][_0x4237('0x3d')]);_0x4dd678[_0x4237('0x41')]=_['keys'](_0x16ce77['query']);_0x4dd678['filters']=_['intersection'](_0x4dd678['model'],_0x4dd678[_0x4237('0x41')]);_0x4a6a07[_0x4237('0x46')]=_[_0x4237('0x43')](_0x4dd678[_0x4237('0x44')],qs['fields'](_0x16ce77['query'][_0x4237('0x45')]));_0x4a6a07[_0x4237('0x46')]=_0x4a6a07[_0x4237('0x46')]['length']?_0x4a6a07[_0x4237('0x46')]:_0x4dd678[_0x4237('0x44')];_0x4a6a07['order']=qs[_0x4237('0x4a')](_0x16ce77['query'][_0x4237('0x4a')]);_0x4a6a07[_0x4237('0x4b')]=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x16ce77[_0x4237('0x41')],_0x4dd678[_0x4237('0x42')]));if(_0x16ce77['query'][_0x4237('0x32')]){_0x4a6a07['where']=_[_0x4237('0x4d')](_0x4a6a07[_0x4237('0x4b')],{'$or':_[_0x4237('0x34')](_0x4a6a07[_0x4237('0x46')],function(_0x2e1d09){var _0x41aa85={};_0x41aa85[_0x2e1d09]={'$like':'%'+_0x16ce77[_0x4237('0x41')][_0x4237('0x32')]+'%'};return _0x41aa85;})});}_0x4a6a07=_[_0x4237('0x4d')]({},_0x4a6a07,_0x16ce77[_0x4237('0x4e')]);return _0x10acbb[_0x4237('0x6f')](_0x4a6a07);}})[_0x4237('0x2d')](function(_0x362ffa){if(_0x362ffa){_0x1b63eb=_0x362ffa[_0x4237('0x6a')];if(!_0x16ce77[_0x4237('0x41')][_0x4237('0x47')]('nolimit')){_0x4a6a07[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x16ce77[_0x4237('0x41')][_0x4237('0x24')]);_0x4a6a07[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x16ce77[_0x4237('0x41')][_0x4237('0x27')]);}return _0x10acbb[_0x4237('0x6f')](_0x4a6a07);}})[_0x4237('0x2d')](function(_0x30ebe7){if(_0x30ebe7){return _0x30ebe7?{'count':_0x1b63eb,'rows':_0x30ebe7}:null;}})[_0x4237('0x2d')](respondWithResult(_0x3729e5,null))[_0x4237('0x52')](handleError(_0x3729e5,null));};exports[_0x4237('0x71')]=function(_0x5f3713,_0x5d85e1,_0x3e3ac9){var _0x408a11=_0x5f3713[_0x4237('0x57')][_0x4237('0x72')];var _0x3d01d6=_[_0x4237('0x34')](_0x408a11,'id');return db[_0x4237('0x70')][_0x4237('0x67')]({'where':{'id':_0x3d01d6},'attributes':['id'],'include':[{'model':db[_0x4237('0x73')],'as':_0x4237('0x74'),'attributes':['id','name',_0x4237('0x75'),_0x4237('0x76'),_0x4237('0x77')],'raw':!![]}]})[_0x4237('0x2d')](function(_0x4475c7){if(_0x4475c7){var _0x365d6d=_[_0x4237('0x78')](_0x4475c7,function(_0x18f60f){var _0x343ef1=_0x18f60f[_0x4237('0x58')]({'plain':!![]});_0x343ef1['Agents'][_0x4237('0x79')](function(_0x233e65){_0x233e65[_0x4237('0x7a')]=_[_0x4237('0x55')](_0x408a11,{'id':_0x343ef1['id']})[_0x4237('0x7a')];});return _0x343ef1['Agents'];});return db[_0x4237('0x3c')][_0x4237('0x55')]({'where':{'id':_0x5f3713[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](function(_0xfc0fa){return db[_0x4237('0x7b')][_0x4237('0x7c')](function(_0x28b0f9){return _0xfc0fa[_0x4237('0x71')](_0x3d01d6,{'transaction':_0x28b0f9})[_0x4237('0x2d')](function(){return BPromise[_0x4237('0x7d')](_0x408a11,function(_0x37a8f3){return db[_0x4237('0x7e')]['upsert']({'TeamId':_0x37a8f3['id'],'VoiceQueueId':_0x5f3713[_0x4237('0x54')]['id'],'penalty':_0x37a8f3[_0x4237('0x7a')]},{'transaction':_0x28b0f9});});})['then'](function(){return BPromise[_0x4237('0x7d')](_0x365d6d,function(_0x254024){return db[_0x4237('0x7f')][_0x4237('0x80')]({'where':{'UserId':_0x254024['id'],'VoiceQueueId':_0x5f3713[_0x4237('0x54')]['id']},'defaults':{'penalty':_0x254024['penalty']},'transaction':_0x28b0f9});});})[_0x4237('0x2d')](function(){return BPromise['each'](_[_0x4237('0x32')](_0x365d6d,{'online':!![]}),function(_0x35824b){return db['UserVoiceQueueRt'][_0x4237('0x81')]({'membername':_0x35824b[_0x4237('0x3a')],'UserId':_0x35824b['id'],'queue_name':_0xfc0fa[_0x4237('0x3a')],'VoiceQueueId':_0xfc0fa['id'],'interface':_[_0x4237('0x82')](_0x35824b[_0x4237('0x77')])?util[_0x4237('0x83')]('SIP/%s',_0x35824b[_0x4237('0x3a')]):_0x35824b[_0x4237('0x77')],'paused':_0x35824b['voicePause']||![],'penalty':_0x35824b[_0x4237('0x7a')]},{'transaction':_0x28b0f9});});})[_0x4237('0x2d')](function(){_0x365d6d['forEach'](function(_0xaf2f0b){socket[_0x4237('0x84')]('userVoiceQueue:save',{'UserId':_0xaf2f0b['id'],'VoiceQueueId':_0xfc0fa['id']});});});});});}})[_0x4237('0x2d')](respondWithStatusCode(_0x5d85e1,null))[_0x4237('0x52')](handleError(_0x5d85e1,null));};exports[_0x4237('0x85')]=function(_0x56285b,_0x17144e,_0x28f15b){return db['Team'][_0x4237('0x67')]({'where':{'id':_0x56285b[_0x4237('0x41')][_0x4237('0x86')]},'attributes':['id'],'include':[{'model':db[_0x4237('0x73')],'as':_0x4237('0x74'),'attributes':['id'],'raw':!![]}]})[_0x4237('0x2d')](handleEntityNotFound(_0x17144e,null))[_0x4237('0x2d')](function(_0x20aab0){var _0x35a52c=_[_0x4237('0x34')](_0x20aab0,'id');var _0x276120=[];var _0x3b5cc2=[];var _0x2d8ff3=squel['select']();_0x2d8ff3['field'](_0x4237('0x87'))['from']('team_has_voice_queues','tq')[_0x4237('0x88')]('user_has_teams','ut',_0x4237('0x89'))[_0x4237('0x4b')](_0x4237('0x8a'),_0x56285b[_0x4237('0x54')]['id']);for(var _0x19c4f4=0x0;_0x19c4f4<_0x20aab0['length'];_0x19c4f4+=0x1){let _0x44cc82=_0x20aab0[_0x19c4f4];for(var _0x428db1=0x0;_0x428db1<_0x44cc82[_0x4237('0x74')][_0x4237('0x6a')];_0x428db1+=0x1){let _0x430112=_0x44cc82[_0x4237('0x74')][_0x428db1];var _0x4663a4=_0x2d8ff3[_0x4237('0x60')]();_0x4663a4[_0x4237('0x4b')]('ut.UserId\x20=\x20?',_0x430112['id']);_0x3b5cc2[_0x4237('0x8b')](db[_0x4237('0x7b')][_0x4237('0x41')](_0x4663a4['toString'](),{'type':db[_0x4237('0x7b')][_0x4237('0x8c')][_0x4237('0x8d')]})[_0x4237('0x2d')](function(_0x5938f3){if(_0x5938f3[_0x4237('0x6a')]===0x1){return _0x430112['id'];}else{var _0x14756f=_[_0x4237('0x8e')](_[_0x4237('0x34')](_0x5938f3,'TeamId'),function(_0xe69109){return _[_0x4237('0x36')](_0x35a52c,_0xe69109);});if(_0x14756f){return _0x430112['id'];}}}));}}return BPromise[_0x4237('0x8f')](_0x3b5cc2)[_0x4237('0x2d')](function(_0x260bcf){_0x276120=_(_0x276120)[_0x4237('0x90')](_0x260bcf)[_0x4237('0x91')]()[_0x4237('0x35')]();return db[_0x4237('0x3c')][_0x4237('0x55')]({'where':{'id':_0x56285b[_0x4237('0x54')]['id']}})['then'](function(_0xf5e46d){return db[_0x4237('0x7b')]['transaction'](function(_0x4677fb){return _0xf5e46d[_0x4237('0x85')](_0x56285b[_0x4237('0x41')][_0x4237('0x86')],{'transaction':_0x4677fb})['then'](function(){if(!_['isEmpty'](_0x276120)){return _0xf5e46d[_0x4237('0x92')](_0x276120,{'transaction':_0x4677fb})[_0x4237('0x2d')](function(){return db[_0x4237('0x93')][_0x4237('0x37')]({'where':{'VoiceQueueId':_0x56285b[_0x4237('0x54')]['id'],'UserId':_0x276120},'transaction':_0x4677fb});});}})[_0x4237('0x2d')](function(){_0x276120[_0x4237('0x79')](function(_0x331525){socket[_0x4237('0x84')]('userVoiceQueue:remove',{'UserId':_0x331525,'VoiceQueueId':_0xf5e46d['id']});});});});});});})[_0x4237('0x2d')](respondWithStatusCode(_0x17144e,null))[_0x4237('0x52')](handleError(_0x17144e,null));};exports[_0x4237('0x94')]=function(_0xe50ffe,_0x2ec3b4,_0x2df1ae){var _0x466de9,_0x1cd8dd;return db[_0x4237('0x3c')][_0x4237('0x55')]({'where':{'id':_0xe50ffe[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x2ec3b4,null))[_0x4237('0x2d')](function(_0x3b6262){if(_0x3b6262){_0x1cd8dd=_0x3b6262;return _0x3b6262['addAgents'](_0xe50ffe[_0x4237('0x57')]['ids'],_[_0x4237('0x61')](_0xe50ffe[_0x4237('0x57')],['ids','id'])||{})['spread'](function(_0x50c481){for(var _0x35469b=0x0;_0x35469b<_0xe50ffe[_0x4237('0x57')][_0x4237('0x86')][_0x4237('0x6a')];_0x35469b+=0x1){socket[_0x4237('0x84')](_0x4237('0x95'),{'UserId':Number(_0xe50ffe[_0x4237('0x57')]['ids'][_0x35469b]),'VoiceQueueId':Number(_0xe50ffe[_0x4237('0x54')]['id'])});}return _0x50c481;});}})[_0x4237('0x2d')](function(_0x1c5c4f){_0x466de9=_0x1c5c4f||[];if(_0x1cd8dd){return db['User'][_0x4237('0x67')]({'where':{'id':_0xe50ffe['body']['ids']},'attributes':['id','name',_0x4237('0x75'),_0x4237('0x76'),_0x4237('0x77')],'raw':!![]});}})[_0x4237('0x2d')](function(_0x12d2a2){if(!_[_0x4237('0x96')](_0x12d2a2)){var _0x1d5d6c=[];for(var _0x2dcd31=0x0;_0x2dcd31<_0x12d2a2[_0x4237('0x6a')];_0x2dcd31++){if(_0x12d2a2[_0x2dcd31][_0x4237('0x75')]){_0x1d5d6c[_0x4237('0x8b')](db[_0x4237('0x93')][_0x4237('0x81')]({'membername':_0x12d2a2[_0x2dcd31][_0x4237('0x3a')],'UserId':_0x12d2a2[_0x2dcd31]['id'],'queue_name':_0x1cd8dd['name'],'VoiceQueueId':_0x1cd8dd['id'],'interface':_['isNil'](_0x12d2a2[_0x2dcd31][_0x4237('0x77')])?util[_0x4237('0x83')](_0x4237('0x97'),_0x12d2a2[_0x2dcd31]['name']):_0x12d2a2[_0x2dcd31][_0x4237('0x77')],'paused':_0x12d2a2[_0x2dcd31]['voicePause']||![],'penalty':_0xe50ffe[_0x4237('0x57')]['penalty']||0x0}));}}return BPromise[_0x4237('0x8f')](_0x1d5d6c);}})[_0x4237('0x2d')](function(){return _0x466de9;})['then'](respondWithResult(_0x2ec3b4,null))[_0x4237('0x52')](handleError(_0x2ec3b4,null));};exports[_0x4237('0x92')]=function(_0x2b8512,_0x5d9f75,_0x426257){return db[_0x4237('0x3c')]['find']({'where':{'id':_0x2b8512[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x5d9f75,null))[_0x4237('0x2d')](function(_0x54427d){if(_0x54427d){return _0x54427d[_0x4237('0x92')](_0x2b8512['query'][_0x4237('0x86')])[_0x4237('0x2d')](function(){if(_[_0x4237('0x98')](_0x2b8512[_0x4237('0x41')]['ids'])){for(var _0x2aaba3=0x0;_0x2aaba3<_0x2b8512[_0x4237('0x41')][_0x4237('0x86')][_0x4237('0x6a')];_0x2aaba3+=0x1){socket[_0x4237('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x2b8512['query'][_0x4237('0x86')][_0x2aaba3]),'VoiceQueueId':Number(_0x2b8512[_0x4237('0x54')]['id'])});}}else{socket['emit'](_0x4237('0x99'),{'UserId':Number(_0x2b8512[_0x4237('0x41')][_0x4237('0x86')]),'VoiceQueueId':Number(_0x2b8512[_0x4237('0x54')]['id'])});}});}})['then'](function(_0x61e9ba){return db['UserVoiceQueueRt'][_0x4237('0x37')]({'where':{'VoiceQueueId':_0x2b8512['params']['id'],'UserId':_0x2b8512[_0x4237('0x41')]['ids']}})[_0x4237('0x2d')](function(){return _0x61e9ba;});})[_0x4237('0x2d')](respondWithStatusCode(_0x5d9f75,null))[_0x4237('0x52')](handleError(_0x5d9f75,null));};exports['getAgents']=function(_0x367a36,_0x50d456,_0x451379){var _0x3661a5={};var _0x17c878={};var _0x1f2209;var _0x377c2b;return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x367a36[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x50d456,null))[_0x4237('0x2d')](function(_0x9a8fe3){if(_0x9a8fe3){_0x1f2209=_0x9a8fe3;_0x17c878['model']=_[_0x4237('0x40')](db[_0x4237('0x73')][_0x4237('0x3d')]);_0x17c878[_0x4237('0x41')]=_[_0x4237('0x40')](_0x367a36[_0x4237('0x41')]);_0x17c878[_0x4237('0x42')]=_[_0x4237('0x43')](_0x17c878[_0x4237('0x44')],_0x17c878[_0x4237('0x41')]);_0x3661a5['attributes']=_[_0x4237('0x43')](_0x17c878[_0x4237('0x44')],qs[_0x4237('0x45')](_0x367a36[_0x4237('0x41')][_0x4237('0x45')]));_0x3661a5['attributes']=_0x3661a5[_0x4237('0x46')]['length']?_0x3661a5[_0x4237('0x46')]:_0x17c878['model'];_0x3661a5[_0x4237('0x49')]=qs[_0x4237('0x4a')](_0x367a36[_0x4237('0x41')][_0x4237('0x4a')]);_0x3661a5[_0x4237('0x4b')]=qs['filters'](_[_0x4237('0x4c')](_0x367a36['query'],_0x17c878[_0x4237('0x42')]));if(_0x367a36[_0x4237('0x41')]['filter']){_0x3661a5['where']=_['merge'](_0x3661a5[_0x4237('0x4b')],{'$or':_['map'](_0x3661a5['attributes'],function(_0x373453){var _0x4afc66={};_0x4afc66[_0x373453]={'$like':'%'+_0x367a36[_0x4237('0x41')]['filter']+'%'};return _0x4afc66;})});}_0x3661a5=_[_0x4237('0x4d')]({},_0x3661a5,_0x367a36[_0x4237('0x4e')]);return _0x1f2209[_0x4237('0x9a')](_0x3661a5);}})[_0x4237('0x2d')](function(_0x32af19){if(_0x32af19){_0x377c2b=_0x32af19[_0x4237('0x6a')];if(!_0x367a36[_0x4237('0x41')]['hasOwnProperty'](_0x4237('0x48'))){_0x3661a5['limit']=qs[_0x4237('0x24')](_0x367a36[_0x4237('0x41')][_0x4237('0x24')]);_0x3661a5[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x367a36['query'][_0x4237('0x27')]);}return _0x1f2209[_0x4237('0x9a')](_0x3661a5);}})[_0x4237('0x2d')](function(_0xe332d4){if(_0xe332d4){return _0xe332d4?{'count':_0x377c2b,'rows':_0xe332d4}:null;}})[_0x4237('0x2d')](respondWithResult(_0x50d456,null))[_0x4237('0x52')](handleError(_0x50d456,null));};exports[_0x4237('0x9b')]=function(_0x1eb1c9,_0x27adc5,_0x3b12bd){var _0x261256={};var _0x2c8c03={};var _0x70630b;var _0x519b2b;return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x1eb1c9[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x27adc5,null))['then'](function(_0x138e71){if(_0x138e71){_0x70630b=_0x138e71;_0x2c8c03[_0x4237('0x44')]=_[_0x4237('0x40')](db['UserVoiceQueueRt'][_0x4237('0x3d')]);_0x2c8c03[_0x4237('0x41')]=_['keys'](_0x1eb1c9[_0x4237('0x41')]);_0x2c8c03['filters']=_[_0x4237('0x43')](_0x2c8c03[_0x4237('0x44')],_0x2c8c03[_0x4237('0x41')]);_0x261256[_0x4237('0x46')]=_[_0x4237('0x43')](_0x2c8c03[_0x4237('0x44')],qs[_0x4237('0x45')](_0x1eb1c9['query'][_0x4237('0x45')]));_0x261256[_0x4237('0x46')]=_0x261256[_0x4237('0x46')][_0x4237('0x6a')]?_0x261256[_0x4237('0x46')]:_0x2c8c03['model'];_0x261256[_0x4237('0x49')]=qs[_0x4237('0x4a')](_0x1eb1c9[_0x4237('0x41')][_0x4237('0x4a')]);_0x261256[_0x4237('0x4b')]=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x1eb1c9[_0x4237('0x41')],_0x2c8c03[_0x4237('0x42')]));if(_0x1eb1c9[_0x4237('0x41')]['filter']){_0x261256[_0x4237('0x4b')]=_[_0x4237('0x4d')](_0x261256[_0x4237('0x4b')],{'$or':_[_0x4237('0x34')](_0x261256['attributes'],function(_0x2e4e28){var _0x40523e={};_0x40523e[_0x2e4e28]={'$like':'%'+_0x1eb1c9[_0x4237('0x41')]['filter']+'%'};return _0x40523e;})});}_0x261256=_[_0x4237('0x4d')]({},_0x261256,_0x1eb1c9[_0x4237('0x4e')]);return _0x70630b['getMembers'](_0x261256);}})[_0x4237('0x2d')](function(_0x4b5e17){if(_0x4b5e17){_0x519b2b=_0x4b5e17[_0x4237('0x6a')];if(!_0x1eb1c9[_0x4237('0x41')][_0x4237('0x47')](_0x4237('0x48'))){_0x261256['limit']=qs['limit'](_0x1eb1c9[_0x4237('0x41')][_0x4237('0x24')]);_0x261256[_0x4237('0x27')]=qs['offset'](_0x1eb1c9['query'][_0x4237('0x27')]);}return _0x70630b[_0x4237('0x9b')](_0x261256);}})[_0x4237('0x2d')](function(_0x34d9a7){return _0x34d9a7?{'count':_0x519b2b,'rows':_0x34d9a7}:null;})[_0x4237('0x2d')](respondWithResult(_0x27adc5,null))['catch'](handleError(_0x27adc5,null));};exports[_0x4237('0x9c')]=function(_0x589e6c,_0x43d25e,_0x697ba0){var _0x3250b7={};var _0x459158={};var _0x2dcbfd;var _0x2355ab;return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x589e6c[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x43d25e,null))[_0x4237('0x2d')](function(_0x531ef2){if(_0x531ef2){_0x2dcbfd=_0x531ef2;_0x459158['model']=_[_0x4237('0x40')](db[_0x4237('0x9d')][_0x4237('0x3d')]);_0x459158['query']=_['keys'](_0x589e6c[_0x4237('0x41')]);_0x459158['filters']=_[_0x4237('0x43')](_0x459158[_0x4237('0x44')],_0x459158[_0x4237('0x41')]);_0x3250b7['attributes']=_['intersection'](_0x459158['model'],qs[_0x4237('0x45')](_0x589e6c[_0x4237('0x41')]['fields']));_0x3250b7[_0x4237('0x46')]=_0x3250b7[_0x4237('0x46')]['length']?_0x3250b7[_0x4237('0x46')]:_0x459158[_0x4237('0x44')];_0x3250b7[_0x4237('0x49')]=qs[_0x4237('0x4a')](_0x589e6c['query'][_0x4237('0x4a')]);_0x3250b7[_0x4237('0x4b')]=qs['filters'](_['pick'](_0x589e6c[_0x4237('0x41')],_0x459158[_0x4237('0x42')]));if(_0x589e6c['query'][_0x4237('0x32')]){_0x3250b7['where']=_['merge'](_0x3250b7['where'],{'$or':_[_0x4237('0x34')](_0x3250b7[_0x4237('0x46')],function(_0x118fc0){var _0x38d5aa={};_0x38d5aa[_0x118fc0]={'$like':'%'+_0x589e6c[_0x4237('0x41')]['filter']+'%'};return _0x38d5aa;})});}_0x3250b7=_[_0x4237('0x4d')]({},_0x3250b7,_0x589e6c[_0x4237('0x4e')]);return _0x2dcbfd[_0x4237('0x9c')](_0x3250b7);}})['then'](function(_0x7840ad){if(_0x7840ad){_0x2355ab=_0x7840ad[_0x4237('0x6a')];if(!_0x589e6c[_0x4237('0x41')][_0x4237('0x47')]('nolimit')){_0x3250b7[_0x4237('0x24')]=qs[_0x4237('0x24')](_0x589e6c[_0x4237('0x41')][_0x4237('0x24')]);_0x3250b7[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x589e6c[_0x4237('0x41')]['offset']);}return _0x2dcbfd['getLists'](_0x3250b7);}})[_0x4237('0x2d')](function(_0x57e5b3){if(_0x57e5b3){return _0x57e5b3?{'count':_0x2355ab,'rows':_0x57e5b3}:null;}})[_0x4237('0x2d')](respondWithResult(_0x43d25e,null))[_0x4237('0x52')](handleError(_0x43d25e,null));};exports[_0x4237('0x9e')]=function(_0x2961fa,_0x5b18c8,_0x30b985){var _0x58828a,_0x307cad;return db['VoiceQueue'][_0x4237('0x55')]({'where':{'id':_0x2961fa[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x5b18c8,null))[_0x4237('0x2d')](function(_0x2f4d0f){if(_0x2f4d0f){_0x307cad=_0x2f4d0f;return _0x2f4d0f[_0x4237('0x9e')](_0x2961fa[_0x4237('0x57')][_0x4237('0x86')],_['omit'](_0x2961fa[_0x4237('0x57')],[_0x4237('0x86'),'id'])||{});}return null;})[_0x4237('0x9f')](function(_0x52fbaf){var _0xb3983d;_0x58828a=_0x52fbaf||[];var _0x2d5023=[];if(_0x52fbaf){for(var _0x3bf0de=0x0;_0x3bf0de<_0x52fbaf[_0x4237('0x6a')];_0x3bf0de+=0x1){var _0x1024dd=_0x52fbaf[_0x3bf0de][_0x4237('0x58')]({'plain':!![]});_0x307cad[_0x4237('0xa0')]=_0x2961fa['body']['dialCheckDuplicateType']?_0x2961fa['body'][_0x4237('0xa0')]:_0x307cad[_0x4237('0xa0')];switch(_0x307cad[_0x4237('0xa0')]){case _0x4237('0xa1'):_0xb3983d=squel[_0x4237('0xa2')]()[_0x4237('0xa3')](_0x4237('0xa4'))[_0x4237('0xa5')]([_0x4237('0xa6'),_0x4237('0xa7'),_0x4237('0xa8'),_0x4237('0xa9'),_0x4237('0x66'),_0x4237('0x62'),_0x4237('0x63')],squel[_0x4237('0xaa')]()[_0x4237('0xab')]('phone','phone')[_0x4237('0xab')](_0x4237('0xac'),_0x4237('0xa7'))['field']('id',_0x4237('0xa8'))[_0x4237('0xab')](_0x1024dd[_0x4237('0xad')][_0x4237('0xae')](),'ListId')['field'](_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')](),'VoiceQueueId')[_0x4237('0xab')](_0x4237('0xac'),'createdAt')[_0x4237('0xab')](_0x4237('0xac'),_0x4237('0x63'))['from'](_0x4237('0xaf'))[_0x4237('0x4b')]('deletedAt\x20IS\x20NULL')['where'](_0x4237('0xb0'),_0x1024dd['CmListId']['toString']())[_0x4237('0x4b')](_0x4237('0xb1'))[_0x4237('0x4b')](_0x4237('0xb2'),squel[_0x4237('0xaa')]()[_0x4237('0xab')](_0x4237('0xb3'))[_0x4237('0xb4')]('cm_hopper_final')[_0x4237('0x4b')](_0x4237('0x8a'),_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')]()))[_0x4237('0x4b')](_0x4237('0xb2'),squel[_0x4237('0xaa')]()[_0x4237('0xab')](_0x4237('0xb5'))[_0x4237('0xb4')]('cm_hopper')[_0x4237('0x4b')](_0x4237('0x8a'),_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')]())))[_0x4237('0xae')]();break;case'onlyIfOpen':_0xb3983d=squel[_0x4237('0xa2')]()[_0x4237('0xa3')](_0x4237('0xa4'))[_0x4237('0xa5')]([_0x4237('0xa6'),'scheduledAt','ContactId',_0x4237('0xa9'),'VoiceQueueId',_0x4237('0x62'),'updatedAt'],squel[_0x4237('0xaa')]()[_0x4237('0xab')]('phone','phone')[_0x4237('0xab')]('NOW()',_0x4237('0xa7'))[_0x4237('0xab')]('id','ContactId')[_0x4237('0xab')](_0x1024dd[_0x4237('0xad')]['toString'](),_0x4237('0xa9'))[_0x4237('0xab')](_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')](),'VoiceQueueId')[_0x4237('0xab')]('NOW()','createdAt')[_0x4237('0xab')](_0x4237('0xac'),_0x4237('0x63'))[_0x4237('0xb4')](_0x4237('0xaf'))[_0x4237('0x4b')](_0x4237('0xb6'))[_0x4237('0x4b')]('ListId\x20=\x20?',_0x1024dd[_0x4237('0xad')]['toString']())[_0x4237('0x4b')]('phone\x20IS\x20NOT\x20NULL')[_0x4237('0x4b')](_0x4237('0xb2'),squel['select']()[_0x4237('0xab')](_0x4237('0xb5'))['from'](_0x4237('0xa4'))['where'](_0x4237('0x8a'),_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')]())))['toString']();break;default:_0xb3983d=squel['insert']()['into'](_0x4237('0xa4'))['fromQuery']([_0x4237('0xa6'),_0x4237('0xa7'),_0x4237('0xa8'),_0x4237('0xa9'),_0x4237('0x66'),_0x4237('0x62'),_0x4237('0x63')],squel['select']()[_0x4237('0xab')](_0x4237('0xa6'),'phone')[_0x4237('0xab')](_0x4237('0xac'),_0x4237('0xa7'))[_0x4237('0xab')]('id',_0x4237('0xa8'))[_0x4237('0xab')](_0x1024dd[_0x4237('0xad')][_0x4237('0xae')](),_0x4237('0xa9'))[_0x4237('0xab')](_0x2961fa[_0x4237('0x54')]['id'][_0x4237('0xae')](),_0x4237('0x66'))[_0x4237('0xab')]('NOW()',_0x4237('0x62'))[_0x4237('0xab')]('NOW()',_0x4237('0x63'))[_0x4237('0xb4')]('cm_contacts')['where'](_0x4237('0xb6'))[_0x4237('0x4b')](_0x4237('0xb0'),_0x1024dd[_0x4237('0xad')][_0x4237('0xae')]())[_0x4237('0x4b')](_0x4237('0xb1')))[_0x4237('0xae')]();}_0x2d5023['push'](db[_0x4237('0x7b')][_0x4237('0x41')](_0xb3983d));}return BPromise[_0x4237('0x8f')](_0x2d5023);}})[_0x4237('0x2d')](function(){return _0x58828a;})[_0x4237('0x2d')](respondWithResult(_0x5b18c8,null))[_0x4237('0x52')](handleError(_0x5b18c8,null));};exports[_0x4237('0xb7')]=function(_0x208ff4,_0x4ab636,_0x4ea2fe){return db[_0x4237('0x3c')][_0x4237('0x55')]({'where':{'id':_0x208ff4[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x4ab636,null))[_0x4237('0x2d')](function(_0x22c48e){if(_0x22c48e){return _0x22c48e[_0x4237('0xb7')](_0x208ff4[_0x4237('0x41')]['ids']);}})[_0x4237('0x2d')](function(_0x179403){if(_0x179403){return db[_0x4237('0x65')][_0x4237('0x37')]({'where':{'ListId':_0x208ff4[_0x4237('0x41')]['ids'],'VoiceQueueId':_0x208ff4[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](function(){return _0x179403;});}})['then'](respondWithStatusCode(_0x4ab636,null))[_0x4237('0x52')](handleError(_0x4ab636,null));};exports['getBlackLists']=function(_0x218007,_0x38e984,_0x1a9654){var _0x33ed6a={};var _0x47efca={};var _0x26ea18;var _0x1ef14c;return db[_0x4237('0x3c')][_0x4237('0x69')]({'where':{'id':_0x218007[_0x4237('0x54')]['id']}})['then'](handleEntityNotFound(_0x38e984,null))[_0x4237('0x2d')](function(_0x17458d){if(_0x17458d){_0x26ea18=_0x17458d;_0x47efca[_0x4237('0x44')]=_[_0x4237('0x40')](db[_0x4237('0x9d')]['rawAttributes']);_0x47efca[_0x4237('0x41')]=_[_0x4237('0x40')](_0x218007[_0x4237('0x41')]);_0x47efca['filters']=_[_0x4237('0x43')](_0x47efca['model'],_0x47efca['query']);_0x33ed6a['attributes']=_[_0x4237('0x43')](_0x47efca['model'],qs[_0x4237('0x45')](_0x218007[_0x4237('0x41')][_0x4237('0x45')]));_0x33ed6a[_0x4237('0x46')]=_0x33ed6a[_0x4237('0x46')][_0x4237('0x6a')]?_0x33ed6a[_0x4237('0x46')]:_0x47efca['model'];_0x33ed6a[_0x4237('0x49')]=qs[_0x4237('0x4a')](_0x218007[_0x4237('0x41')][_0x4237('0x4a')]);_0x33ed6a[_0x4237('0x4b')]=qs[_0x4237('0x42')](_[_0x4237('0x4c')](_0x218007[_0x4237('0x41')],_0x47efca[_0x4237('0x42')]));if(_0x218007[_0x4237('0x41')][_0x4237('0x32')]){_0x33ed6a[_0x4237('0x4b')]=_['merge'](_0x33ed6a[_0x4237('0x4b')],{'$or':_[_0x4237('0x34')](_0x33ed6a[_0x4237('0x46')],function(_0x4aa624){var _0x50a673={};_0x50a673[_0x4aa624]={'$like':'%'+_0x218007['query'][_0x4237('0x32')]+'%'};return _0x50a673;})});}_0x33ed6a=_[_0x4237('0x4d')]({},_0x33ed6a,_0x218007[_0x4237('0x4e')]);return _0x26ea18['getBlackLists'](_0x33ed6a);}})[_0x4237('0x2d')](function(_0x19e77e){if(_0x19e77e){_0x1ef14c=_0x19e77e['length'];if(!_0x218007[_0x4237('0x41')]['hasOwnProperty'](_0x4237('0x48'))){_0x33ed6a['limit']=qs[_0x4237('0x24')](_0x218007[_0x4237('0x41')]['limit']);_0x33ed6a[_0x4237('0x27')]=qs[_0x4237('0x27')](_0x218007['query']['offset']);}return _0x26ea18[_0x4237('0xb8')](_0x33ed6a);}})['then'](function(_0x2f7b80){if(_0x2f7b80){return _0x2f7b80?{'count':_0x1ef14c,'rows':_0x2f7b80}:null;}})[_0x4237('0x2d')](respondWithResult(_0x38e984,null))[_0x4237('0x52')](handleError(_0x38e984,null));};exports[_0x4237('0xb9')]=function(_0xb93576,_0x4e680a,_0x45685b){var _0x48b14f,_0x20e387;return db[_0x4237('0x3c')]['find']({'where':{'id':_0xb93576[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x4e680a,null))[_0x4237('0x2d')](function(_0x16912f){if(_0x16912f){_0x20e387=_0x16912f;return _0x16912f[_0x4237('0xb9')](_0xb93576[_0x4237('0x57')]['ids'],_[_0x4237('0x61')](_0xb93576[_0x4237('0x57')],[_0x4237('0x86'),'id'])||{});}return null;})[_0x4237('0x9f')](function(_0x3f14b4){var _0xe615c5;_0x48b14f=_0x3f14b4||[];var _0x22754c=[];if(_0x3f14b4){for(var _0x25c0a9=0x0;_0x25c0a9<_0x3f14b4['length'];_0x25c0a9+=0x1){var _0xa081c9=_0x3f14b4[_0x25c0a9]['get']({'plain':!![]});_0xe615c5=squel[_0x4237('0xa2')]()['into']('cm_hopper_black')[_0x4237('0xa5')]([_0x4237('0xa6'),_0x4237('0xa8'),_0x4237('0xa9'),_0x4237('0x66'),_0x4237('0x62'),_0x4237('0x63')],squel['select']()[_0x4237('0xab')](_0x4237('0xa6'),'phone')[_0x4237('0xab')]('id','ContactId')[_0x4237('0xab')](_0xa081c9[_0x4237('0xad')][_0x4237('0xae')](),_0x4237('0xa9'))['field'](_0xb93576['params']['id'][_0x4237('0xae')](),_0x4237('0x66'))[_0x4237('0xab')](_0x4237('0xac'),_0x4237('0x62'))[_0x4237('0xab')](_0x4237('0xac'),'updatedAt')[_0x4237('0xb4')](_0x4237('0xaf'))[_0x4237('0x4b')](_0x4237('0xb6'))['where'](_0x4237('0xb0'),_0xa081c9['CmListId'][_0x4237('0xae')]())[_0x4237('0x4b')](_0x4237('0xb1')))[_0x4237('0xae')]();_0x22754c[_0x4237('0x8b')](db[_0x4237('0x7b')]['query'](_0xe615c5));}return BPromise['all'](_0x22754c);}})[_0x4237('0x2d')](function(){return _0x48b14f;})['then'](respondWithResult(_0x4e680a,null))[_0x4237('0x52')](handleError(_0x4e680a,null));};exports['removeBlackLists']=function(_0x57147f,_0x494916,_0x38531a){return db['VoiceQueue']['find']({'where':{'id':_0x57147f[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](handleEntityNotFound(_0x494916,null))['then'](function(_0x43c0b4){if(_0x43c0b4){return _0x43c0b4['removeBlackLists'](_0x57147f['query'][_0x4237('0x86')]);}})[_0x4237('0x2d')](function(_0x5f379f){if(_0x5f379f){return db['CmHopperBlack'][_0x4237('0x37')]({'where':{'ListId':_0x57147f[_0x4237('0x41')]['ids'],'VoiceQueueId':_0x57147f[_0x4237('0x54')]['id']}})[_0x4237('0x2d')](function(){return _0x5f379f;});}})['then'](respondWithStatusCode(_0x494916,null))[_0x4237('0x52')](handleError(_0x494916,null));}; \ No newline at end of file +var _0xfdbc=['offset','limit','undefined','set','Content-Range','apply','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','find','name','stack','send','map','VoiceQueue','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','catch','show','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','params','findOne','CmHopper','VoiceQueueId','findAll','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','interface','format','userVoiceQueue:save','User','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','removeTeams','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','SIP/%s','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','scheduledAt','ContactId','createdAt','phone','NOW()','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end'];(function(_0x4117b2,_0x2d9f30){var _0x44f42b=function(_0x413a85){while(--_0x413a85){_0x4117b2['push'](_0x4117b2['shift']());}};_0x44f42b(++_0x2d9f30);}(_0xfdbc,0x14d));var _0xcfdb=function(_0x575489,_0xe434f9){_0x575489=_0x575489-0x0;var _0x395cb0=_0xfdbc[_0x575489];return _0x395cb0;};'use strict';var emlformat=require(_0xcfdb('0x0'));var rimraf=require(_0xcfdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfdb('0x2'));var rp=require(_0xcfdb('0x3'));var moment=require('moment');var BPromise=require(_0xcfdb('0x4'));var Mustache=require(_0xcfdb('0x5'));var util=require(_0xcfdb('0x6'));var path=require(_0xcfdb('0x7'));var sox=require(_0xcfdb('0x8'));var csv=require(_0xcfdb('0x9'));var ejs=require(_0xcfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xcfdb('0xb'));var _=require(_0xcfdb('0xc'));var squel=require(_0xcfdb('0xd'));var crypto=require(_0xcfdb('0xe'));var jsforce=require(_0xcfdb('0xf'));var deskjs=require(_0xcfdb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcfdb('0x11'));var Papa=require(_0xcfdb('0x12'));var Redis=require(_0xcfdb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcfdb('0x14'));var as=require(_0xcfdb('0x15'));var hardwareService=require(_0xcfdb('0x16'));var logger=require(_0xcfdb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xcfdb('0x18'));var licenseUtil=require(_0xcfdb('0x19'));var db=require(_0xcfdb('0x1a'))['db'];config[_0xcfdb('0x1b')]=_[_0xcfdb('0x1c')](config['redis'],{'host':_0xcfdb('0x1d'),'port':0x18eb});var socket=require(_0xcfdb('0x1e'))(new Redis(config[_0xcfdb('0x1b')]));require('./voiceQueue.socket')[_0xcfdb('0x1f')](socket);function respondWithStatusCode(_0x21ebe0,_0x333cb4){_0x333cb4=_0x333cb4||0xcc;return function(_0x364459){if(_0x364459){return _0x21ebe0[_0xcfdb('0x20')](_0x333cb4);}return _0x21ebe0[_0xcfdb('0x21')](_0x333cb4)[_0xcfdb('0x22')]();};}function respondWithResult(_0xa7f03a,_0x1ed4fb){_0x1ed4fb=_0x1ed4fb||0xc8;return function(_0x1ebe85){if(_0x1ebe85){return _0xa7f03a[_0xcfdb('0x21')](_0x1ed4fb)['json'](_0x1ebe85);}};}function respondWithFilteredResult(_0x482283,_0x2b48f6){return function(_0x521c1d){if(_0x521c1d){var _0x1ab307=typeof _0x2b48f6[_0xcfdb('0x23')]==='undefined'&&typeof _0x2b48f6[_0xcfdb('0x24')]===_0xcfdb('0x25');var _0x3bee1f=_0x521c1d['count'];var _0xb3643f=_0x1ab307?0x0:_0x2b48f6[_0xcfdb('0x23')];var _0x55abb6=_0x1ab307?_0x521c1d['count']:_0x2b48f6[_0xcfdb('0x23')]+_0x2b48f6[_0xcfdb('0x24')];var _0x47d0ec;if(_0x55abb6>=_0x3bee1f){_0x55abb6=_0x3bee1f;_0x47d0ec=0xc8;}else{_0x47d0ec=0xce;}_0x482283[_0xcfdb('0x21')](_0x47d0ec);return _0x482283[_0xcfdb('0x26')](_0xcfdb('0x27'),_0xb3643f+'-'+_0x55abb6+'/'+_0x3bee1f)['json'](_0x521c1d);}return null;};}function patchUpdates(_0xad15b8){return function(_0x49e6b7){try{jsonpatch[_0xcfdb('0x28')](_0x49e6b7,_0xad15b8,!![]);}catch(_0xc76275){return BPromise['reject'](_0xc76275);}return _0x49e6b7['save']();};}function saveUpdates(_0x3d12d6,_0x56a228){return function(_0x21d1d5){if(_0x21d1d5){return _0x21d1d5['update'](_0x3d12d6)[_0xcfdb('0x29')](function(_0x48b74c){return _0x48b74c;});}return null;};}function removeEntity(_0x2a71cc,_0x38ad5a){return function(_0x1cf3de){if(_0x1cf3de){return _0x1cf3de[_0xcfdb('0x2a')]()[_0xcfdb('0x29')](function(){var _0x11f5a6=_0x1cf3de[_0xcfdb('0x2b')]({'plain':!![]});var _0x5b8c35=[{'name':_0xcfdb('0x2c'),'value':_0xcfdb('0x2d'),'ignore':![]},{'name':_0xcfdb('0x2e'),'value':_0xcfdb('0x2f'),'ignore':![]}];var _0x52e30a=_(_0x5b8c35)[_0xcfdb('0x30')]('ignore')['map'](_0xcfdb('0x31'))[_0xcfdb('0x31')]();if(_[_0xcfdb('0x32')](_0x52e30a,_0x11f5a6[_0xcfdb('0x33')])){return;}var _0x2ab1cb=_[_0xcfdb('0x34')](_0x5b8c35,[_0xcfdb('0x31'),_0x11f5a6[_0xcfdb('0x33')]])[_0xcfdb('0x35')];return db['UserProfileResource']['destroy']({'where':{'type':_0x2ab1cb,'resourceId':_0x11f5a6['id']}})['then'](function(){return _0x1cf3de;});})[_0xcfdb('0x29')](function(){_0x2a71cc['status'](0xcc)[_0xcfdb('0x22')]();});}};}function handleEntityNotFound(_0x46d290,_0x1545b6){return function(_0x1fa1a5){if(!_0x1fa1a5){_0x46d290[_0xcfdb('0x20')](0x194);}return _0x1fa1a5;};}function handleError(_0x4b3155,_0x21376e){_0x21376e=_0x21376e||0x1f4;return function(_0x5cd359){logger['error'](_0x5cd359[_0xcfdb('0x36')]);if(_0x5cd359[_0xcfdb('0x35')]){delete _0x5cd359[_0xcfdb('0x35')];}_0x4b3155[_0xcfdb('0x21')](_0x21376e)[_0xcfdb('0x37')](_0x5cd359);};}exports['index']=function(_0x3e3998,_0x353b97){var _0x135b76={},_0x378ab3={},_0x569ef9={'count':0x0,'rows':[]};var _0x5bd5a0=_[_0xcfdb('0x38')](db[_0xcfdb('0x39')][_0xcfdb('0x3a')],function(_0x56d415){return{'name':_0x56d415[_0xcfdb('0x3b')],'type':_0x56d415[_0xcfdb('0x33')]['key']};});_0x378ab3[_0xcfdb('0x3c')]=_[_0xcfdb('0x38')](_0x5bd5a0,_0xcfdb('0x35'));_0x378ab3['query']=_[_0xcfdb('0x3d')](_0x3e3998[_0xcfdb('0x3e')]);_0x378ab3[_0xcfdb('0x3f')]=_['intersection'](_0x378ab3[_0xcfdb('0x3c')],_0x378ab3[_0xcfdb('0x3e')]);_0x135b76['attributes']=_[_0xcfdb('0x40')](_0x378ab3[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x41')]));_0x135b76[_0xcfdb('0x42')]=_0x135b76['attributes'][_0xcfdb('0x43')]?_0x135b76[_0xcfdb('0x42')]:_0x378ab3['model'];if(!_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x44')](_0xcfdb('0x45'))){_0x135b76[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x135b76[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x3e3998['query'][_0xcfdb('0x23')]);}_0x135b76[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x135b76[_0xcfdb('0x48')]=qs['filters'](_[_0xcfdb('0x49')](_0x3e3998[_0xcfdb('0x3e')],_0x378ab3[_0xcfdb('0x3f')]),_0x5bd5a0);if(_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x135b76[_0xcfdb('0x48')]=_[_0xcfdb('0x4a')](_0x135b76[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x5bd5a0,function(_0x54d5bb){if(_0x54d5bb['type']!==_0xcfdb('0x4b')){var _0xd38f5c={};_0xd38f5c[_0x54d5bb['name']]={'$like':'%'+_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x30')]+'%'};return _0xd38f5c;}})});}_0x135b76=_[_0xcfdb('0x4a')]({},_0x135b76,_0x3e3998[_0xcfdb('0x4c')]);var _0x942051={'where':_0x135b76[_0xcfdb('0x48')]};return db[_0xcfdb('0x39')][_0xcfdb('0x4d')](_0x942051)[_0xcfdb('0x29')](function(_0x12cb33){_0x569ef9[_0xcfdb('0x4d')]=_0x12cb33;if(_0x3e3998[_0xcfdb('0x3e')][_0xcfdb('0x4e')]){_0x135b76[_0xcfdb('0x4f')]=[{'all':!![]}];}return db[_0xcfdb('0x39')]['findAll'](_0x135b76);})[_0xcfdb('0x29')](function(_0x1c584e){_0x569ef9['rows']=_0x1c584e;return _0x569ef9;})['then'](respondWithFilteredResult(_0x353b97,_0x135b76))[_0xcfdb('0x50')](handleError(_0x353b97,null));};exports[_0xcfdb('0x51')]=function(_0x1a8bc1,_0x5904b1){var _0x247dbe={'raw':![],'where':{'id':_0x1a8bc1['params']['id']}},_0x33eb2b={};_0x33eb2b[_0xcfdb('0x3c')]=_['keys'](db[_0xcfdb('0x39')]['rawAttributes']);_0x33eb2b[_0xcfdb('0x3e')]=_['keys'](_0x1a8bc1['query']);_0x33eb2b[_0xcfdb('0x3f')]=_[_0xcfdb('0x40')](_0x33eb2b[_0xcfdb('0x3c')],_0x33eb2b[_0xcfdb('0x3e')]);_0x247dbe[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x33eb2b[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0x1a8bc1[_0xcfdb('0x3e')]['fields']));_0x247dbe[_0xcfdb('0x42')]=_0x247dbe[_0xcfdb('0x42')][_0xcfdb('0x43')]?_0x247dbe[_0xcfdb('0x42')]:_0x33eb2b[_0xcfdb('0x3c')];if(_0x1a8bc1['query'][_0xcfdb('0x4e')]){_0x247dbe[_0xcfdb('0x4f')]=[{'all':!![]}];}_0x247dbe=_[_0xcfdb('0x4a')]({},_0x247dbe,_0x1a8bc1[_0xcfdb('0x4c')]);return db['VoiceQueue']['find'](_0x247dbe)['then'](handleEntityNotFound(_0x5904b1,null))[_0xcfdb('0x29')](respondWithResult(_0x5904b1,null))[_0xcfdb('0x50')](handleError(_0x5904b1,null));};exports[_0xcfdb('0x52')]=function(_0x55e5ed,_0x1d4904){return db[_0xcfdb('0x39')]['create'](_0x55e5ed[_0xcfdb('0x53')],{})[_0xcfdb('0x29')](function(_0x55c6e5){var _0x4efd2d=_0x55e5ed[_0xcfdb('0x54')][_0xcfdb('0x2b')]({'plain':!![]});if(!_0x4efd2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4efd2d[_0xcfdb('0x55')]===_0xcfdb('0x54')){var _0x410d5a=_0x55c6e5['get']({'plain':!![]});var _0xaa8f94=[{'name':_0xcfdb('0x2c'),'value':_0xcfdb('0x2d')},{'name':_0xcfdb('0x2e'),'value':_0xcfdb('0x2f')}];var _0x181fa7=_['find'](_0xaa8f94,[_0xcfdb('0x31'),_0x410d5a[_0xcfdb('0x33')]])[_0xcfdb('0x35')];return db[_0xcfdb('0x56')][_0xcfdb('0x34')]({'where':{'name':_0x181fa7,'userProfileId':_0x4efd2d[_0xcfdb('0x57')]},'raw':!![]})[_0xcfdb('0x29')](function(_0x148da7){if(_0x148da7&&_0x148da7[_0xcfdb('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x410d5a[_0xcfdb('0x35')],'resourceId':_0x410d5a['id'],'type':_0x148da7[_0xcfdb('0x35')],'sectionId':_0x148da7['id']},{})[_0xcfdb('0x29')](function(){return _0x55c6e5;});}else{return _0x55c6e5;}})[_0xcfdb('0x50')](function(_0x4061cd){logger[_0xcfdb('0x59')](_0xcfdb('0x5a'),_0x4061cd);throw _0x4061cd;});}return _0x55c6e5;})['then'](respondWithResult(_0x1d4904,0xc9))[_0xcfdb('0x50')](handleError(_0x1d4904,null));};exports[_0xcfdb('0x5b')]=function(_0xcce4a5,_0x2c45a3){var _0x5b8f80={'where':{'id':_0xcce4a5['params']['id']}},_0x3f6602={};_0x3f6602[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db['VoiceQueue']['rawAttributes']);_0x5b8f80[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x3f6602[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0xcce4a5[_0xcfdb('0x3e')]['fields']));_0x5b8f80[_0xcfdb('0x42')]=_0x5b8f80[_0xcfdb('0x42')]['length']?_0x5b8f80[_0xcfdb('0x42')]:_0x3f6602['model'];if(_0xcce4a5[_0xcfdb('0x3e')][_0xcfdb('0x4e')]){_0x5b8f80[_0xcfdb('0x4f')]=[{'all':!![]}];}_0x5b8f80=_['merge']({},_0x5b8f80,_0xcce4a5[_0xcfdb('0x4c')]);return db[_0xcfdb('0x39')][_0xcfdb('0x34')](_0x5b8f80)[_0xcfdb('0x29')](handleEntityNotFound(_0x2c45a3,null))[_0xcfdb('0x29')](function(_0x1b0869){if(_0x1b0869){var _0x276e13=_0x1b0869[_0xcfdb('0x2b')]({'plain':!![]});_0x276e13=qs[_0xcfdb('0x5c')](_0x276e13,['id','createdAt',_0xcfdb('0x5d')]);_0xcce4a5['body']=_[_0xcfdb('0x5c')](_0xcce4a5['body'],['id','createdAt',_0xcfdb('0x5d')]);return db['VoiceQueue'][_0xcfdb('0x52')](_[_0xcfdb('0x4a')](_0x276e13,_0xcce4a5[_0xcfdb('0x53')]),{'include':_0xcce4a5[_0xcfdb('0x3e')][_0xcfdb('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x2f0c1f){var _0x4ac1e8=_0xcce4a5['user'][_0xcfdb('0x2b')]({'plain':!![]});if(!_0x4ac1e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ac1e8['role']===_0xcfdb('0x54')){var _0x14e2bf=_0x2f0c1f[_0xcfdb('0x2b')]({'plain':!![]});var _0x533293=[{'name':_0xcfdb('0x2c'),'value':_0xcfdb('0x2d')},{'name':_0xcfdb('0x2e'),'value':_0xcfdb('0x2f')}];var _0x31a0f5=_[_0xcfdb('0x34')](_0x533293,[_0xcfdb('0x31'),_0x14e2bf[_0xcfdb('0x33')]])[_0xcfdb('0x35')];return db[_0xcfdb('0x56')]['find']({'where':{'name':_0x31a0f5,'userProfileId':_0x4ac1e8[_0xcfdb('0x57')]},'raw':!![]})[_0xcfdb('0x29')](function(_0x13adcd){if(_0x13adcd&&_0x13adcd['autoAssociation']===0x0){return db['UserProfileResource'][_0xcfdb('0x52')]({'name':_0x14e2bf[_0xcfdb('0x35')],'resourceId':_0x14e2bf['id'],'type':_0x13adcd[_0xcfdb('0x35')],'sectionId':_0x13adcd['id']},{})[_0xcfdb('0x29')](function(){return _0x2f0c1f;});}else{return _0x2f0c1f;}})[_0xcfdb('0x50')](function(_0x1b8849){logger[_0xcfdb('0x59')](_0xcfdb('0x5a'),_0x1b8849);throw _0x1b8849;});}return _0x2f0c1f;});}})[_0xcfdb('0x29')](respondWithResult(_0x2c45a3,0xc9))[_0xcfdb('0x50')](handleError(_0x2c45a3,null));};exports['update']=function(_0x4efa58,_0x13a8a8){if(_0x4efa58[_0xcfdb('0x53')]['id']){delete _0x4efa58['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x4efa58[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x13a8a8,null))[_0xcfdb('0x29')](saveUpdates(_0x4efa58[_0xcfdb('0x53')],null))[_0xcfdb('0x29')](respondWithResult(_0x13a8a8,null))['catch'](handleError(_0x13a8a8,null));};exports[_0xcfdb('0x2a')]=function(_0x2a73a7,_0x3e5002){return db[_0xcfdb('0x39')][_0xcfdb('0x34')]({'where':{'id':_0x2a73a7[_0xcfdb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3e5002,null))[_0xcfdb('0x29')](removeEntity(_0x3e5002,null))['catch'](handleError(_0x3e5002,null));};exports['getHoppers']=function(_0x5447f1,_0xc3a8c8,_0x40cef0){var _0x472f0a={'raw':![],'where':{}};var _0x270fe1={};var _0xb3453c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xcfdb('0x5f')]({'where':{'id':_0x5447f1['params']['id']}})['then'](handleEntityNotFound(_0xc3a8c8,null))[_0xcfdb('0x29')](function(_0x32e223){if(_0x32e223){_0x270fe1[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db[_0xcfdb('0x60')][_0xcfdb('0x3a')]);_0x270fe1[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x5447f1['query']);_0x270fe1[_0xcfdb('0x3f')]=_[_0xcfdb('0x40')](_0x270fe1[_0xcfdb('0x3c')],_0x270fe1[_0xcfdb('0x3e')]);_0x472f0a[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x270fe1[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0x5447f1['query']['fields']));_0x472f0a[_0xcfdb('0x42')]=_0x472f0a[_0xcfdb('0x42')][_0xcfdb('0x43')]?_0x472f0a[_0xcfdb('0x42')]:_0x270fe1[_0xcfdb('0x3c')];if(!_0x5447f1[_0xcfdb('0x3e')]['hasOwnProperty'](_0xcfdb('0x45'))){_0x472f0a[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x5447f1[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x472f0a[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x5447f1[_0xcfdb('0x3e')][_0xcfdb('0x23')]);}_0x472f0a[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x5447f1[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x472f0a[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_['pick'](_0x5447f1[_0xcfdb('0x3e')],_0x270fe1['filters']));_0x472f0a[_0xcfdb('0x48')][_0xcfdb('0x61')]=_0x32e223['id'];if(_0x5447f1[_0xcfdb('0x3e')]['filter']){_0x472f0a[_0xcfdb('0x48')]=_['merge'](_0x472f0a[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x472f0a[_0xcfdb('0x42')],function(_0xa05dd1){var _0x5df312={};_0x5df312[_0xa05dd1]={'$like':'%'+_0x5447f1[_0xcfdb('0x3e')]['filter']+'%'};return _0x5df312;})});}_0x472f0a=_[_0xcfdb('0x4a')]({},_0x472f0a,_0x5447f1[_0xcfdb('0x4c')]);return db[_0xcfdb('0x60')][_0xcfdb('0x4d')]({'where':_0x472f0a[_0xcfdb('0x48')]})[_0xcfdb('0x29')](function(_0x398964){_0xb3453c[_0xcfdb('0x4d')]=_0x398964;if(_0x5447f1[_0xcfdb('0x3e')][_0xcfdb('0x4e')]){_0x472f0a[_0xcfdb('0x4f')]=[{'all':!![]}];}return db[_0xcfdb('0x60')][_0xcfdb('0x62')](_0x472f0a);})[_0xcfdb('0x29')](function(_0x249ccb){_0xb3453c[_0xcfdb('0x63')]=_0x249ccb;return _0xb3453c;});}})[_0xcfdb('0x29')](respondWithFilteredResult(_0xc3a8c8,_0x472f0a))[_0xcfdb('0x50')](handleError(_0xc3a8c8,null));};exports[_0xcfdb('0x64')]=function(_0x2c6960,_0x859543,_0x1ed5d9){var _0x4e8d30={'raw':!![],'where':{}};var _0x359a4e={};var _0x501cb9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xcfdb('0x5f')]({'where':{'id':_0x2c6960[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x859543,null))[_0xcfdb('0x29')](function(_0x1b0ae4){if(_0x1b0ae4){_0x359a4e[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db['CmHopperHistory'][_0xcfdb('0x3a')]);_0x359a4e[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x2c6960[_0xcfdb('0x3e')]);_0x359a4e[_0xcfdb('0x3f')]=_[_0xcfdb('0x40')](_0x359a4e[_0xcfdb('0x3c')],_0x359a4e[_0xcfdb('0x3e')]);_0x4e8d30[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x359a4e[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0x2c6960['query'][_0xcfdb('0x41')]));_0x4e8d30[_0xcfdb('0x42')]=_0x4e8d30[_0xcfdb('0x42')][_0xcfdb('0x43')]?_0x4e8d30['attributes']:_0x359a4e['model'];if(!_0x2c6960[_0xcfdb('0x3e')]['hasOwnProperty'](_0xcfdb('0x45'))){_0x4e8d30[_0xcfdb('0x24')]=qs['limit'](_0x2c6960[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x4e8d30[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x2c6960['query'][_0xcfdb('0x23')]);}_0x4e8d30[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x2c6960[_0xcfdb('0x3e')]['sort']);_0x4e8d30['where']=qs[_0xcfdb('0x3f')](_[_0xcfdb('0x49')](_0x2c6960[_0xcfdb('0x3e')],_0x359a4e[_0xcfdb('0x3f')]));_0x4e8d30[_0xcfdb('0x48')][_0xcfdb('0x61')]=_0x1b0ae4['id'];if(_0x2c6960[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x4e8d30[_0xcfdb('0x48')]=_['merge'](_0x4e8d30[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x4e8d30[_0xcfdb('0x42')],function(_0x23f3fd){var _0x5c913a={};_0x5c913a[_0x23f3fd]={'$like':'%'+_0x2c6960['query'][_0xcfdb('0x30')]+'%'};return _0x5c913a;})});}_0x4e8d30=_[_0xcfdb('0x4a')]({},_0x4e8d30,_0x2c6960[_0xcfdb('0x4c')]);return db[_0xcfdb('0x65')][_0xcfdb('0x4d')]({'where':_0x4e8d30[_0xcfdb('0x48')]})[_0xcfdb('0x29')](function(_0xf3e402){_0x501cb9[_0xcfdb('0x4d')]=_0xf3e402;if(_0x2c6960[_0xcfdb('0x3e')][_0xcfdb('0x4e')]){_0x4e8d30[_0xcfdb('0x4f')]=[{'all':!![]}];}return db[_0xcfdb('0x65')][_0xcfdb('0x62')](_0x4e8d30);})[_0xcfdb('0x29')](function(_0x2f3c2e){_0x501cb9[_0xcfdb('0x63')]=_0x2f3c2e;return _0x501cb9;});}})[_0xcfdb('0x29')](respondWithFilteredResult(_0x859543,_0x4e8d30))[_0xcfdb('0x50')](handleError(_0x859543,null));};exports[_0xcfdb('0x66')]=function(_0xa7dc79,_0x396596,_0x5cc6cd){var _0x1e878a={'raw':!![],'where':{}};var _0x5e6a68={};var _0x6f20c={'count':0x0,'rows':[]};return db[_0xcfdb('0x39')][_0xcfdb('0x5f')]({'where':{'id':_0xa7dc79[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x396596,null))[_0xcfdb('0x29')](function(_0x18a047){if(_0x18a047){_0x5e6a68['model']=_[_0xcfdb('0x3d')](db[_0xcfdb('0x67')][_0xcfdb('0x3a')]);_0x5e6a68[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0xa7dc79[_0xcfdb('0x3e')]);_0x5e6a68['filters']=_[_0xcfdb('0x40')](_0x5e6a68[_0xcfdb('0x3c')],_0x5e6a68['query']);_0x1e878a['attributes']=_['intersection'](_0x5e6a68['model'],qs['fields'](_0xa7dc79['query'][_0xcfdb('0x41')]));_0x1e878a[_0xcfdb('0x42')]=_0x1e878a[_0xcfdb('0x42')][_0xcfdb('0x43')]?_0x1e878a['attributes']:_0x5e6a68[_0xcfdb('0x3c')];if(!_0xa7dc79[_0xcfdb('0x3e')][_0xcfdb('0x44')](_0xcfdb('0x45'))){_0x1e878a[_0xcfdb('0x24')]=qs['limit'](_0xa7dc79[_0xcfdb('0x3e')]['limit']);_0x1e878a[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0xa7dc79['query'][_0xcfdb('0x23')]);}_0x1e878a[_0xcfdb('0x46')]=qs['sort'](_0xa7dc79[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x1e878a[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_[_0xcfdb('0x49')](_0xa7dc79[_0xcfdb('0x3e')],_0x5e6a68[_0xcfdb('0x3f')]));_0x1e878a[_0xcfdb('0x48')][_0xcfdb('0x61')]=_0x18a047['id'];if(_0xa7dc79['query'][_0xcfdb('0x30')]){_0x1e878a[_0xcfdb('0x48')]=_[_0xcfdb('0x4a')](_0x1e878a['where'],{'$or':_[_0xcfdb('0x38')](_0x1e878a[_0xcfdb('0x42')],function(_0x14c682){var _0x2af775={};_0x2af775[_0x14c682]={'$like':'%'+_0xa7dc79[_0xcfdb('0x3e')][_0xcfdb('0x30')]+'%'};return _0x2af775;})});}_0x1e878a=_[_0xcfdb('0x4a')]({},_0x1e878a,_0xa7dc79[_0xcfdb('0x4c')]);return db[_0xcfdb('0x67')][_0xcfdb('0x4d')]({'where':_0x1e878a[_0xcfdb('0x48')]})['then'](function(_0x56e7da){_0x6f20c[_0xcfdb('0x4d')]=_0x56e7da;if(_0xa7dc79[_0xcfdb('0x3e')]['includeAll']){_0x1e878a[_0xcfdb('0x4f')]=[{'all':!![]}];}return db[_0xcfdb('0x67')][_0xcfdb('0x62')](_0x1e878a);})[_0xcfdb('0x29')](function(_0x33a7ae){_0x6f20c[_0xcfdb('0x63')]=_0x33a7ae;return _0x6f20c;});}})['then'](respondWithFilteredResult(_0x396596,_0x1e878a))[_0xcfdb('0x50')](handleError(_0x396596,null));};exports[_0xcfdb('0x68')]=function(_0x5f0df5,_0x324dd3,_0x54e7e8){var _0x13e7b2={'raw':!![],'where':{}};var _0x56d1b2={};var _0x165304={'count':0x0,'rows':[]};return db[_0xcfdb('0x39')]['findOne']({'where':{'id':_0x5f0df5[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x324dd3,null))[_0xcfdb('0x29')](function(_0x223362){if(_0x223362){_0x56d1b2[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db['CmHopperBlack'][_0xcfdb('0x3a')]);_0x56d1b2[_0xcfdb('0x3e')]=_['keys'](_0x5f0df5[_0xcfdb('0x3e')]);_0x56d1b2['filters']=_['intersection'](_0x56d1b2['model'],_0x56d1b2[_0xcfdb('0x3e')]);_0x13e7b2[_0xcfdb('0x42')]=_['intersection'](_0x56d1b2[_0xcfdb('0x3c')],qs['fields'](_0x5f0df5[_0xcfdb('0x3e')]['fields']));_0x13e7b2[_0xcfdb('0x42')]=_0x13e7b2['attributes'][_0xcfdb('0x43')]?_0x13e7b2['attributes']:_0x56d1b2[_0xcfdb('0x3c')];if(!_0x5f0df5[_0xcfdb('0x3e')]['hasOwnProperty']('nolimit')){_0x13e7b2[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x5f0df5['query'][_0xcfdb('0x24')]);_0x13e7b2[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x5f0df5[_0xcfdb('0x3e')][_0xcfdb('0x23')]);}_0x13e7b2[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x5f0df5[_0xcfdb('0x3e')]['sort']);_0x13e7b2[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_['pick'](_0x5f0df5[_0xcfdb('0x3e')],_0x56d1b2[_0xcfdb('0x3f')]));_0x13e7b2[_0xcfdb('0x48')][_0xcfdb('0x61')]=_0x223362['id'];if(_0x5f0df5[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x13e7b2['where']=_[_0xcfdb('0x4a')](_0x13e7b2[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x13e7b2[_0xcfdb('0x42')],function(_0x5928c5){var _0x4edb58={};_0x4edb58[_0x5928c5]={'$like':'%'+_0x5f0df5[_0xcfdb('0x3e')][_0xcfdb('0x30')]+'%'};return _0x4edb58;})});}_0x13e7b2=_[_0xcfdb('0x4a')]({},_0x13e7b2,_0x5f0df5[_0xcfdb('0x4c')]);return db[_0xcfdb('0x69')]['count']({'where':_0x13e7b2[_0xcfdb('0x48')]})['then'](function(_0x1442bf){_0x165304['count']=_0x1442bf;if(_0x5f0df5['query']['includeAll']){_0x13e7b2[_0xcfdb('0x4f')]=[{'all':!![]}];}return db[_0xcfdb('0x69')][_0xcfdb('0x62')](_0x13e7b2);})[_0xcfdb('0x29')](function(_0x497b43){_0x165304[_0xcfdb('0x63')]=_0x497b43;return _0x165304;});}})['then'](respondWithFilteredResult(_0x324dd3,_0x13e7b2))[_0xcfdb('0x50')](handleError(_0x324dd3,null));};exports[_0xcfdb('0x6a')]=function(_0x2cecfb,_0x28850f,_0x1506b3){var _0x469334={};var _0x3bbf6e={};var _0x39757d;var _0x1c02df;return db[_0xcfdb('0x39')][_0xcfdb('0x5f')]({'where':{'id':_0x2cecfb['params']['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x28850f,null))['then'](function(_0x49859b){if(_0x49859b){_0x39757d=_0x49859b;_0x3bbf6e[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db[_0xcfdb('0x6b')][_0xcfdb('0x3a')]);_0x3bbf6e[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x2cecfb['query']);_0x3bbf6e['filters']=_[_0xcfdb('0x40')](_0x3bbf6e['model'],_0x3bbf6e[_0xcfdb('0x3e')]);_0x469334[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x3bbf6e[_0xcfdb('0x3c')],qs['fields'](_0x2cecfb[_0xcfdb('0x3e')][_0xcfdb('0x41')]));_0x469334[_0xcfdb('0x42')]=_0x469334[_0xcfdb('0x42')]['length']?_0x469334['attributes']:_0x3bbf6e[_0xcfdb('0x3c')];_0x469334[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x2cecfb[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x469334['where']=qs['filters'](_[_0xcfdb('0x49')](_0x2cecfb[_0xcfdb('0x3e')],_0x3bbf6e[_0xcfdb('0x3f')]));if(_0x2cecfb[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x469334[_0xcfdb('0x48')]=_[_0xcfdb('0x4a')](_0x469334[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x469334[_0xcfdb('0x42')],function(_0x483ea6){var _0x3c1dfe={};_0x3c1dfe[_0x483ea6]={'$like':'%'+_0x2cecfb[_0xcfdb('0x3e')][_0xcfdb('0x30')]+'%'};return _0x3c1dfe;})});}_0x469334=_[_0xcfdb('0x4a')]({},_0x469334,_0x2cecfb['options']);return _0x39757d[_0xcfdb('0x6a')](_0x469334);}})[_0xcfdb('0x29')](function(_0x16660f){if(_0x16660f){_0x1c02df=_0x16660f['length'];if(!_0x2cecfb[_0xcfdb('0x3e')]['hasOwnProperty'](_0xcfdb('0x45'))){_0x469334['limit']=qs['limit'](_0x2cecfb[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x469334[_0xcfdb('0x23')]=qs['offset'](_0x2cecfb['query']['offset']);}return _0x39757d[_0xcfdb('0x6a')](_0x469334);}})[_0xcfdb('0x29')](function(_0x55b9a9){if(_0x55b9a9){return _0x55b9a9?{'count':_0x1c02df,'rows':_0x55b9a9}:null;}})[_0xcfdb('0x29')](respondWithResult(_0x28850f,null))[_0xcfdb('0x50')](handleError(_0x28850f,null));};exports['addTeams']=function(_0xad50ec,_0x47266c,_0x45e831){var _0x1e6f98=_0xad50ec[_0xcfdb('0x53')][_0xcfdb('0x6c')];var _0x213cde=_[_0xcfdb('0x38')](_0x1e6f98,'id');return db['Team']['findAll']({'where':{'id':_0x213cde},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcfdb('0x6d'),'attributes':['id','name',_0xcfdb('0x6e'),_0xcfdb('0x6f'),'interface'],'raw':!![]}]})[_0xcfdb('0x29')](function(_0x22424f){if(_0x22424f){var _0x3e5b59=_[_0xcfdb('0x70')](_0x22424f,function(_0x1124e3){var _0x11e134=_0x1124e3[_0xcfdb('0x2b')]({'plain':!![]});_0x11e134[_0xcfdb('0x6d')][_0xcfdb('0x71')](function(_0x2038e2){_0x2038e2['penalty']=_['find'](_0x1e6f98,{'id':_0x11e134['id']})[_0xcfdb('0x72')];});return _0x11e134[_0xcfdb('0x6d')];});return db['VoiceQueue'][_0xcfdb('0x34')]({'where':{'id':_0xad50ec[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](function(_0x46d22d){return db[_0xcfdb('0x73')][_0xcfdb('0x74')](function(_0x1022f0){return _0x46d22d[_0xcfdb('0x75')](_0x213cde,{'transaction':_0x1022f0})[_0xcfdb('0x29')](function(){return BPromise[_0xcfdb('0x76')](_0x1e6f98,function(_0x2f8166){return db['TeamVoiceQueue'][_0xcfdb('0x77')]({'TeamId':_0x2f8166['id'],'VoiceQueueId':_0xad50ec[_0xcfdb('0x5e')]['id'],'penalty':_0x2f8166[_0xcfdb('0x72')]},{'transaction':_0x1022f0});});})[_0xcfdb('0x29')](function(){return BPromise[_0xcfdb('0x76')](_0x3e5b59,function(_0x4c8ca0){return db[_0xcfdb('0x78')]['findOrCreate']({'where':{'UserId':_0x4c8ca0['id'],'VoiceQueueId':_0xad50ec[_0xcfdb('0x5e')]['id']},'defaults':{'penalty':_0x4c8ca0['penalty']},'transaction':_0x1022f0});});})[_0xcfdb('0x29')](function(){return BPromise[_0xcfdb('0x76')](_[_0xcfdb('0x30')](_0x3e5b59,{'online':!![]}),function(_0x1374d1){return db[_0xcfdb('0x79')][_0xcfdb('0x77')]({'membername':_0x1374d1[_0xcfdb('0x35')],'UserId':_0x1374d1['id'],'queue_name':_0x46d22d[_0xcfdb('0x35')],'VoiceQueueId':_0x46d22d['id'],'interface':_[_0xcfdb('0x7a')](_0x1374d1[_0xcfdb('0x7b')])?util[_0xcfdb('0x7c')]('SIP/%s',_0x1374d1[_0xcfdb('0x35')]):_0x1374d1[_0xcfdb('0x7b')],'paused':_0x1374d1['voicePause']||![],'penalty':_0x1374d1[_0xcfdb('0x72')]},{'transaction':_0x1022f0});});})[_0xcfdb('0x29')](function(){_0x3e5b59[_0xcfdb('0x71')](function(_0x3fd8ea){socket['emit'](_0xcfdb('0x7d'),{'UserId':_0x3fd8ea['id'],'VoiceQueueId':_0x46d22d['id']});});});});});}})[_0xcfdb('0x29')](respondWithStatusCode(_0x47266c,null))[_0xcfdb('0x50')](handleError(_0x47266c,null));};exports['removeTeams']=function(_0x3c13e7,_0xb61d3,_0x474bae){return db[_0xcfdb('0x6b')][_0xcfdb('0x62')]({'where':{'id':_0x3c13e7[_0xcfdb('0x3e')]['ids']},'attributes':['id'],'include':[{'model':db[_0xcfdb('0x7e')],'as':_0xcfdb('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xcfdb('0x29')](handleEntityNotFound(_0xb61d3,null))[_0xcfdb('0x29')](function(_0x3bae23){var _0x193c57=_['map'](_0x3bae23,'id');var _0x21704b=[];var _0x24b6e5=[];var _0x306299=squel[_0xcfdb('0x7f')]();_0x306299[_0xcfdb('0x80')]('tq.TeamId')[_0xcfdb('0x81')](_0xcfdb('0x82'),'tq')[_0xcfdb('0x83')]('user_has_teams','ut',_0xcfdb('0x84'))[_0xcfdb('0x48')]('VoiceQueueId\x20=\x20?',_0x3c13e7['params']['id']);for(var _0x3a8398=0x0;_0x3a8398<_0x3bae23[_0xcfdb('0x43')];_0x3a8398+=0x1){let _0x48bc88=_0x3bae23[_0x3a8398];for(var _0x15434b=0x0;_0x15434b<_0x48bc88[_0xcfdb('0x6d')][_0xcfdb('0x43')];_0x15434b+=0x1){let _0x202dc0=_0x48bc88[_0xcfdb('0x6d')][_0x15434b];var _0x23f989=_0x306299[_0xcfdb('0x5b')]();_0x23f989[_0xcfdb('0x48')](_0xcfdb('0x85'),_0x202dc0['id']);_0x24b6e5[_0xcfdb('0x86')](db[_0xcfdb('0x73')][_0xcfdb('0x3e')](_0x23f989[_0xcfdb('0x87')](),{'type':db['sequelize'][_0xcfdb('0x88')]['SELECT']})['then'](function(_0x3956e0){if(_0x3956e0[_0xcfdb('0x43')]===0x1){return _0x202dc0['id'];}else{var _0x267b89=_[_0xcfdb('0x89')](_[_0xcfdb('0x38')](_0x3956e0,_0xcfdb('0x8a')),function(_0x5c0677){return _[_0xcfdb('0x32')](_0x193c57,_0x5c0677);});if(_0x267b89){return _0x202dc0['id'];}}}));}}return BPromise[_0xcfdb('0x8b')](_0x24b6e5)['then'](function(_0x3a326e){_0x21704b=_(_0x21704b)[_0xcfdb('0x8c')](_0x3a326e)[_0xcfdb('0x8d')]()[_0xcfdb('0x31')]();return db[_0xcfdb('0x39')]['find']({'where':{'id':_0x3c13e7['params']['id']}})['then'](function(_0x362c90){return db['sequelize']['transaction'](function(_0x3d67bc){return _0x362c90[_0xcfdb('0x8e')](_0x3c13e7[_0xcfdb('0x3e')][_0xcfdb('0x8f')],{'transaction':_0x3d67bc})[_0xcfdb('0x29')](function(){if(!_[_0xcfdb('0x90')](_0x21704b)){return _0x362c90[_0xcfdb('0x91')](_0x21704b,{'transaction':_0x3d67bc})[_0xcfdb('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3c13e7[_0xcfdb('0x5e')]['id'],'UserId':_0x21704b},'transaction':_0x3d67bc});});}})[_0xcfdb('0x29')](function(){_0x21704b['forEach'](function(_0x16c9e5){socket['emit'](_0xcfdb('0x92'),{'UserId':_0x16c9e5,'VoiceQueueId':_0x362c90['id']});});});});});});})[_0xcfdb('0x29')](respondWithStatusCode(_0xb61d3,null))['catch'](handleError(_0xb61d3,null));};exports['addAgents']=function(_0x49401c,_0x157c17,_0x1e7266){var _0x4e6f71,_0x31887e;return db[_0xcfdb('0x39')][_0xcfdb('0x34')]({'where':{'id':_0x49401c['params']['id']}})['then'](handleEntityNotFound(_0x157c17,null))[_0xcfdb('0x29')](function(_0x41b441){if(_0x41b441){_0x31887e=_0x41b441;return _0x41b441[_0xcfdb('0x93')](_0x49401c[_0xcfdb('0x53')][_0xcfdb('0x8f')],_[_0xcfdb('0x5c')](_0x49401c[_0xcfdb('0x53')],['ids','id'])||{})[_0xcfdb('0x94')](function(_0x47fd06){for(var _0x2f340b=0x0;_0x2f340b<_0x49401c[_0xcfdb('0x53')][_0xcfdb('0x8f')][_0xcfdb('0x43')];_0x2f340b+=0x1){socket[_0xcfdb('0x95')](_0xcfdb('0x7d'),{'UserId':Number(_0x49401c[_0xcfdb('0x53')][_0xcfdb('0x8f')][_0x2f340b]),'VoiceQueueId':Number(_0x49401c[_0xcfdb('0x5e')]['id'])});}return _0x47fd06;});}})['then'](function(_0x1c2a6e){_0x4e6f71=_0x1c2a6e||[];if(_0x31887e){return db[_0xcfdb('0x7e')][_0xcfdb('0x62')]({'where':{'id':_0x49401c[_0xcfdb('0x53')]['ids']},'attributes':['id',_0xcfdb('0x35'),_0xcfdb('0x6e'),_0xcfdb('0x6f'),'interface'],'raw':!![]});}})['then'](function(_0x2e040e){if(!_[_0xcfdb('0x90')](_0x2e040e)){var _0x53049a=[];for(var _0x492db3=0x0;_0x492db3<_0x2e040e[_0xcfdb('0x43')];_0x492db3++){if(_0x2e040e[_0x492db3][_0xcfdb('0x6e')]){_0x53049a[_0xcfdb('0x86')](db[_0xcfdb('0x79')][_0xcfdb('0x77')]({'membername':_0x2e040e[_0x492db3][_0xcfdb('0x35')],'UserId':_0x2e040e[_0x492db3]['id'],'queue_name':_0x31887e['name'],'VoiceQueueId':_0x31887e['id'],'interface':_[_0xcfdb('0x7a')](_0x2e040e[_0x492db3][_0xcfdb('0x7b')])?util[_0xcfdb('0x7c')](_0xcfdb('0x96'),_0x2e040e[_0x492db3][_0xcfdb('0x35')]):_0x2e040e[_0x492db3][_0xcfdb('0x7b')],'paused':_0x2e040e[_0x492db3][_0xcfdb('0x6f')]||![],'penalty':_0x49401c[_0xcfdb('0x53')][_0xcfdb('0x72')]||0x0}));}}return BPromise[_0xcfdb('0x8b')](_0x53049a);}})[_0xcfdb('0x29')](function(){return _0x4e6f71;})[_0xcfdb('0x29')](respondWithResult(_0x157c17,null))[_0xcfdb('0x50')](handleError(_0x157c17,null));};exports['removeAgents']=function(_0x58e9cb,_0x21cc20,_0xa79854){return db[_0xcfdb('0x39')][_0xcfdb('0x34')]({'where':{'id':_0x58e9cb['params']['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x21cc20,null))[_0xcfdb('0x29')](function(_0x3ab302){if(_0x3ab302){return _0x3ab302[_0xcfdb('0x91')](_0x58e9cb['query'][_0xcfdb('0x8f')])[_0xcfdb('0x29')](function(){if(_['isArray'](_0x58e9cb[_0xcfdb('0x3e')]['ids'])){for(var _0x16bff5=0x0;_0x16bff5<_0x58e9cb[_0xcfdb('0x3e')][_0xcfdb('0x8f')][_0xcfdb('0x43')];_0x16bff5+=0x1){socket[_0xcfdb('0x95')](_0xcfdb('0x92'),{'UserId':Number(_0x58e9cb['query'][_0xcfdb('0x8f')][_0x16bff5]),'VoiceQueueId':Number(_0x58e9cb['params']['id'])});}}else{socket[_0xcfdb('0x95')](_0xcfdb('0x92'),{'UserId':Number(_0x58e9cb[_0xcfdb('0x3e')][_0xcfdb('0x8f')]),'VoiceQueueId':Number(_0x58e9cb[_0xcfdb('0x5e')]['id'])});}});}})['then'](function(_0x489383){return db[_0xcfdb('0x79')][_0xcfdb('0x2a')]({'where':{'VoiceQueueId':_0x58e9cb[_0xcfdb('0x5e')]['id'],'UserId':_0x58e9cb[_0xcfdb('0x3e')][_0xcfdb('0x8f')]}})['then'](function(){return _0x489383;});})[_0xcfdb('0x29')](respondWithStatusCode(_0x21cc20,null))[_0xcfdb('0x50')](handleError(_0x21cc20,null));};exports['getAgents']=function(_0x9e460f,_0x17960d,_0x42d211){var _0x426545={};var _0x461de1={};var _0xfc4845;var _0x5b1d95;return db[_0xcfdb('0x39')]['findOne']({'where':{'id':_0x9e460f['params']['id']}})['then'](handleEntityNotFound(_0x17960d,null))[_0xcfdb('0x29')](function(_0x5abdb0){if(_0x5abdb0){_0xfc4845=_0x5abdb0;_0x461de1[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db[_0xcfdb('0x7e')][_0xcfdb('0x3a')]);_0x461de1[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x9e460f[_0xcfdb('0x3e')]);_0x461de1[_0xcfdb('0x3f')]=_[_0xcfdb('0x40')](_0x461de1[_0xcfdb('0x3c')],_0x461de1[_0xcfdb('0x3e')]);_0x426545[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x461de1['model'],qs['fields'](_0x9e460f[_0xcfdb('0x3e')]['fields']));_0x426545[_0xcfdb('0x42')]=_0x426545['attributes'][_0xcfdb('0x43')]?_0x426545[_0xcfdb('0x42')]:_0x461de1[_0xcfdb('0x3c')];_0x426545['order']=qs[_0xcfdb('0x47')](_0x9e460f[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x426545[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_['pick'](_0x9e460f['query'],_0x461de1[_0xcfdb('0x3f')]));if(_0x9e460f[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x426545['where']=_['merge'](_0x426545['where'],{'$or':_['map'](_0x426545['attributes'],function(_0x1eea13){var _0x2ceba2={};_0x2ceba2[_0x1eea13]={'$like':'%'+_0x9e460f['query'][_0xcfdb('0x30')]+'%'};return _0x2ceba2;})});}_0x426545=_[_0xcfdb('0x4a')]({},_0x426545,_0x9e460f[_0xcfdb('0x4c')]);return _0xfc4845['getAgents'](_0x426545);}})[_0xcfdb('0x29')](function(_0x2ca5dc){if(_0x2ca5dc){_0x5b1d95=_0x2ca5dc[_0xcfdb('0x43')];if(!_0x9e460f[_0xcfdb('0x3e')][_0xcfdb('0x44')](_0xcfdb('0x45'))){_0x426545[_0xcfdb('0x24')]=qs['limit'](_0x9e460f[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x426545[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x9e460f[_0xcfdb('0x3e')]['offset']);}return _0xfc4845[_0xcfdb('0x97')](_0x426545);}})['then'](function(_0x5b43fd){if(_0x5b43fd){return _0x5b43fd?{'count':_0x5b1d95,'rows':_0x5b43fd}:null;}})[_0xcfdb('0x29')](respondWithResult(_0x17960d,null))[_0xcfdb('0x50')](handleError(_0x17960d,null));};exports[_0xcfdb('0x98')]=function(_0x26fbe0,_0x549a80,_0x63c570){var _0x532872={};var _0x2a8a00={};var _0x5a55d2;var _0x5ad1fb;return db[_0xcfdb('0x39')][_0xcfdb('0x5f')]({'where':{'id':_0x26fbe0[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x549a80,null))[_0xcfdb('0x29')](function(_0x232376){if(_0x232376){_0x5a55d2=_0x232376;_0x2a8a00[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db[_0xcfdb('0x79')][_0xcfdb('0x3a')]);_0x2a8a00[_0xcfdb('0x3e')]=_['keys'](_0x26fbe0[_0xcfdb('0x3e')]);_0x2a8a00[_0xcfdb('0x3f')]=_[_0xcfdb('0x40')](_0x2a8a00[_0xcfdb('0x3c')],_0x2a8a00[_0xcfdb('0x3e')]);_0x532872[_0xcfdb('0x42')]=_['intersection'](_0x2a8a00[_0xcfdb('0x3c')],qs[_0xcfdb('0x41')](_0x26fbe0[_0xcfdb('0x3e')]['fields']));_0x532872['attributes']=_0x532872['attributes'][_0xcfdb('0x43')]?_0x532872[_0xcfdb('0x42')]:_0x2a8a00[_0xcfdb('0x3c')];_0x532872['order']=qs[_0xcfdb('0x47')](_0x26fbe0[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x532872[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_[_0xcfdb('0x49')](_0x26fbe0[_0xcfdb('0x3e')],_0x2a8a00[_0xcfdb('0x3f')]));if(_0x26fbe0[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x532872[_0xcfdb('0x48')]=_[_0xcfdb('0x4a')](_0x532872[_0xcfdb('0x48')],{'$or':_['map'](_0x532872['attributes'],function(_0x109a70){var _0x4bc30e={};_0x4bc30e[_0x109a70]={'$like':'%'+_0x26fbe0[_0xcfdb('0x3e')]['filter']+'%'};return _0x4bc30e;})});}_0x532872=_[_0xcfdb('0x4a')]({},_0x532872,_0x26fbe0[_0xcfdb('0x4c')]);return _0x5a55d2[_0xcfdb('0x98')](_0x532872);}})['then'](function(_0x472c98){if(_0x472c98){_0x5ad1fb=_0x472c98[_0xcfdb('0x43')];if(!_0x26fbe0[_0xcfdb('0x3e')][_0xcfdb('0x44')]('nolimit')){_0x532872[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x26fbe0[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x532872[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x26fbe0['query'][_0xcfdb('0x23')]);}return _0x5a55d2['getMembers'](_0x532872);}})[_0xcfdb('0x29')](function(_0x3529d6){return _0x3529d6?{'count':_0x5ad1fb,'rows':_0x3529d6}:null;})[_0xcfdb('0x29')](respondWithResult(_0x549a80,null))[_0xcfdb('0x50')](handleError(_0x549a80,null));};exports[_0xcfdb('0x99')]=function(_0x2d2faf,_0x28b6d2,_0x1edc0c){var _0x117ba6={};var _0x4cd5ea={};var _0x254089;var _0x313005;return db[_0xcfdb('0x39')]['findOne']({'where':{'id':_0x2d2faf[_0xcfdb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x28b6d2,null))['then'](function(_0x3cf389){if(_0x3cf389){_0x254089=_0x3cf389;_0x4cd5ea[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db[_0xcfdb('0x9a')][_0xcfdb('0x3a')]);_0x4cd5ea[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x2d2faf[_0xcfdb('0x3e')]);_0x4cd5ea['filters']=_[_0xcfdb('0x40')](_0x4cd5ea['model'],_0x4cd5ea[_0xcfdb('0x3e')]);_0x117ba6[_0xcfdb('0x42')]=_[_0xcfdb('0x40')](_0x4cd5ea['model'],qs[_0xcfdb('0x41')](_0x2d2faf['query']['fields']));_0x117ba6['attributes']=_0x117ba6[_0xcfdb('0x42')]['length']?_0x117ba6['attributes']:_0x4cd5ea[_0xcfdb('0x3c')];_0x117ba6[_0xcfdb('0x46')]=qs[_0xcfdb('0x47')](_0x2d2faf[_0xcfdb('0x3e')][_0xcfdb('0x47')]);_0x117ba6['where']=qs[_0xcfdb('0x3f')](_[_0xcfdb('0x49')](_0x2d2faf[_0xcfdb('0x3e')],_0x4cd5ea['filters']));if(_0x2d2faf[_0xcfdb('0x3e')][_0xcfdb('0x30')]){_0x117ba6['where']=_['merge'](_0x117ba6[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x117ba6[_0xcfdb('0x42')],function(_0x4187e0){var _0x11d330={};_0x11d330[_0x4187e0]={'$like':'%'+_0x2d2faf['query']['filter']+'%'};return _0x11d330;})});}_0x117ba6=_[_0xcfdb('0x4a')]({},_0x117ba6,_0x2d2faf['options']);return _0x254089[_0xcfdb('0x99')](_0x117ba6);}})['then'](function(_0x21f425){if(_0x21f425){_0x313005=_0x21f425[_0xcfdb('0x43')];if(!_0x2d2faf[_0xcfdb('0x3e')][_0xcfdb('0x44')](_0xcfdb('0x45'))){_0x117ba6[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x2d2faf[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x117ba6['offset']=qs[_0xcfdb('0x23')](_0x2d2faf[_0xcfdb('0x3e')]['offset']);}return _0x254089[_0xcfdb('0x99')](_0x117ba6);}})[_0xcfdb('0x29')](function(_0x2000a8){if(_0x2000a8){return _0x2000a8?{'count':_0x313005,'rows':_0x2000a8}:null;}})[_0xcfdb('0x29')](respondWithResult(_0x28b6d2,null))['catch'](handleError(_0x28b6d2,null));};exports[_0xcfdb('0x9b')]=function(_0x129b24,_0x55a3db,_0x131d47){var _0x2c32ca,_0x555463;return db[_0xcfdb('0x39')][_0xcfdb('0x34')]({'where':{'id':_0x129b24[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0x55a3db,null))[_0xcfdb('0x29')](function(_0x229687){if(_0x229687){_0x555463=_0x229687;return _0x229687[_0xcfdb('0x9b')](_0x129b24[_0xcfdb('0x53')]['ids'],_[_0xcfdb('0x5c')](_0x129b24[_0xcfdb('0x53')],['ids','id'])||{});}return null;})[_0xcfdb('0x94')](function(_0x3449d9){var _0x818222;_0x2c32ca=_0x3449d9||[];var _0x10ea9f=[];if(_0x3449d9){for(var _0x2a64ef=0x0;_0x2a64ef<_0x3449d9['length'];_0x2a64ef+=0x1){var _0x24a021=_0x3449d9[_0x2a64ef][_0xcfdb('0x2b')]({'plain':!![]});_0x555463[_0xcfdb('0x9c')]=_0x129b24[_0xcfdb('0x53')][_0xcfdb('0x9c')]?_0x129b24[_0xcfdb('0x53')][_0xcfdb('0x9c')]:_0x555463[_0xcfdb('0x9c')];switch(_0x555463[_0xcfdb('0x9c')]){case _0xcfdb('0x9d'):_0x818222=squel['insert']()[_0xcfdb('0x9e')]('cm_hopper')['fromQuery'](['phone',_0xcfdb('0x9f'),_0xcfdb('0xa0'),'ListId',_0xcfdb('0x61'),_0xcfdb('0xa1'),_0xcfdb('0x5d')],squel[_0xcfdb('0x7f')]()[_0xcfdb('0x80')](_0xcfdb('0xa2'),_0xcfdb('0xa2'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x9f'))[_0xcfdb('0x80')]('id',_0xcfdb('0xa0'))[_0xcfdb('0x80')](_0x24a021['CmListId'][_0xcfdb('0x87')](),'ListId')[_0xcfdb('0x80')](_0x129b24['params']['id'][_0xcfdb('0x87')](),_0xcfdb('0x61'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0xa1'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x5d'))[_0xcfdb('0x81')]('cm_contacts')[_0xcfdb('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0xcfdb('0xa4'),_0x24a021[_0xcfdb('0xa5')]['toString']())[_0xcfdb('0x48')](_0xcfdb('0xa6'))[_0xcfdb('0x48')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xcfdb('0x80')](_0xcfdb('0xa7'))[_0xcfdb('0x81')](_0xcfdb('0xa8'))[_0xcfdb('0x48')](_0xcfdb('0xa9'),_0x129b24[_0xcfdb('0x5e')]['id'][_0xcfdb('0x87')]()))[_0xcfdb('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcfdb('0x7f')]()[_0xcfdb('0x80')](_0xcfdb('0xaa'))['from'](_0xcfdb('0xab'))[_0xcfdb('0x48')](_0xcfdb('0xa9'),_0x129b24[_0xcfdb('0x5e')]['id']['toString']())))['toString']();break;case _0xcfdb('0xac'):_0x818222=squel[_0xcfdb('0xad')]()[_0xcfdb('0x9e')](_0xcfdb('0xab'))['fromQuery']([_0xcfdb('0xa2'),'scheduledAt',_0xcfdb('0xa0'),_0xcfdb('0xae'),'VoiceQueueId',_0xcfdb('0xa1'),_0xcfdb('0x5d')],squel[_0xcfdb('0x7f')]()[_0xcfdb('0x80')](_0xcfdb('0xa2'),_0xcfdb('0xa2'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x9f'))[_0xcfdb('0x80')]('id','ContactId')[_0xcfdb('0x80')](_0x24a021[_0xcfdb('0xa5')]['toString'](),_0xcfdb('0xae'))[_0xcfdb('0x80')](_0x129b24['params']['id'][_0xcfdb('0x87')](),_0xcfdb('0x61'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0xa1'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x5d'))[_0xcfdb('0x81')](_0xcfdb('0xaf'))[_0xcfdb('0x48')](_0xcfdb('0xb0'))[_0xcfdb('0x48')](_0xcfdb('0xa4'),_0x24a021[_0xcfdb('0xa5')][_0xcfdb('0x87')]())['where'](_0xcfdb('0xa6'))['where'](_0xcfdb('0xb1'),squel[_0xcfdb('0x7f')]()[_0xcfdb('0x80')]('COALESCE(phone,\x27\x27)')[_0xcfdb('0x81')](_0xcfdb('0xab'))[_0xcfdb('0x48')](_0xcfdb('0xa9'),_0x129b24['params']['id'][_0xcfdb('0x87')]())))[_0xcfdb('0x87')]();break;default:_0x818222=squel['insert']()[_0xcfdb('0x9e')](_0xcfdb('0xab'))[_0xcfdb('0xb2')]([_0xcfdb('0xa2'),_0xcfdb('0x9f'),_0xcfdb('0xa0'),_0xcfdb('0xae'),_0xcfdb('0x61'),_0xcfdb('0xa1'),_0xcfdb('0x5d')],squel[_0xcfdb('0x7f')]()['field'](_0xcfdb('0xa2'),'phone')[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x9f'))[_0xcfdb('0x80')]('id','ContactId')[_0xcfdb('0x80')](_0x24a021[_0xcfdb('0xa5')]['toString'](),_0xcfdb('0xae'))[_0xcfdb('0x80')](_0x129b24[_0xcfdb('0x5e')]['id']['toString'](),_0xcfdb('0x61'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0xa1'))[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0x5d'))[_0xcfdb('0x81')](_0xcfdb('0xaf'))[_0xcfdb('0x48')](_0xcfdb('0xb0'))['where'](_0xcfdb('0xa4'),_0x24a021[_0xcfdb('0xa5')][_0xcfdb('0x87')]())[_0xcfdb('0x48')](_0xcfdb('0xa6')))[_0xcfdb('0x87')]();}_0x10ea9f[_0xcfdb('0x86')](db['sequelize'][_0xcfdb('0x3e')](_0x818222));}return BPromise['all'](_0x10ea9f);}})[_0xcfdb('0x29')](function(){return _0x2c32ca;})[_0xcfdb('0x29')](respondWithResult(_0x55a3db,null))['catch'](handleError(_0x55a3db,null));};exports['removeLists']=function(_0x1c87ad,_0xd149b0,_0x4e3825){return db['VoiceQueue'][_0xcfdb('0x34')]({'where':{'id':_0x1c87ad[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0xd149b0,null))[_0xcfdb('0x29')](function(_0x46cfef){if(_0x46cfef){return _0x46cfef[_0xcfdb('0xb3')](_0x1c87ad[_0xcfdb('0x3e')][_0xcfdb('0x8f')]);}})['then'](function(_0x318699){if(_0x318699){return db[_0xcfdb('0x60')][_0xcfdb('0x2a')]({'where':{'ListId':_0x1c87ad['query']['ids'],'VoiceQueueId':_0x1c87ad[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](function(){return _0x318699;});}})['then'](respondWithStatusCode(_0xd149b0,null))[_0xcfdb('0x50')](handleError(_0xd149b0,null));};exports[_0xcfdb('0xb4')]=function(_0x4003e9,_0xa996a3,_0xbfab20){var _0x4fe2b9={};var _0x5569fc={};var _0x47a830;var _0x25b1b2;return db[_0xcfdb('0x39')][_0xcfdb('0x5f')]({'where':{'id':_0x4003e9[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](handleEntityNotFound(_0xa996a3,null))['then'](function(_0xe6aad4){if(_0xe6aad4){_0x47a830=_0xe6aad4;_0x5569fc[_0xcfdb('0x3c')]=_[_0xcfdb('0x3d')](db['CmList']['rawAttributes']);_0x5569fc[_0xcfdb('0x3e')]=_[_0xcfdb('0x3d')](_0x4003e9[_0xcfdb('0x3e')]);_0x5569fc['filters']=_[_0xcfdb('0x40')](_0x5569fc[_0xcfdb('0x3c')],_0x5569fc[_0xcfdb('0x3e')]);_0x4fe2b9['attributes']=_['intersection'](_0x5569fc[_0xcfdb('0x3c')],qs['fields'](_0x4003e9['query']['fields']));_0x4fe2b9['attributes']=_0x4fe2b9[_0xcfdb('0x42')]['length']?_0x4fe2b9['attributes']:_0x5569fc['model'];_0x4fe2b9['order']=qs['sort'](_0x4003e9['query'][_0xcfdb('0x47')]);_0x4fe2b9[_0xcfdb('0x48')]=qs[_0xcfdb('0x3f')](_[_0xcfdb('0x49')](_0x4003e9[_0xcfdb('0x3e')],_0x5569fc[_0xcfdb('0x3f')]));if(_0x4003e9['query'][_0xcfdb('0x30')]){_0x4fe2b9[_0xcfdb('0x48')]=_[_0xcfdb('0x4a')](_0x4fe2b9[_0xcfdb('0x48')],{'$or':_[_0xcfdb('0x38')](_0x4fe2b9[_0xcfdb('0x42')],function(_0x578c28){var _0x263505={};_0x263505[_0x578c28]={'$like':'%'+_0x4003e9[_0xcfdb('0x3e')]['filter']+'%'};return _0x263505;})});}_0x4fe2b9=_[_0xcfdb('0x4a')]({},_0x4fe2b9,_0x4003e9[_0xcfdb('0x4c')]);return _0x47a830[_0xcfdb('0xb4')](_0x4fe2b9);}})[_0xcfdb('0x29')](function(_0x3aa8b4){if(_0x3aa8b4){_0x25b1b2=_0x3aa8b4[_0xcfdb('0x43')];if(!_0x4003e9['query'][_0xcfdb('0x44')](_0xcfdb('0x45'))){_0x4fe2b9[_0xcfdb('0x24')]=qs[_0xcfdb('0x24')](_0x4003e9[_0xcfdb('0x3e')][_0xcfdb('0x24')]);_0x4fe2b9[_0xcfdb('0x23')]=qs[_0xcfdb('0x23')](_0x4003e9[_0xcfdb('0x3e')][_0xcfdb('0x23')]);}return _0x47a830[_0xcfdb('0xb4')](_0x4fe2b9);}})['then'](function(_0x4a4f59){if(_0x4a4f59){return _0x4a4f59?{'count':_0x25b1b2,'rows':_0x4a4f59}:null;}})[_0xcfdb('0x29')](respondWithResult(_0xa996a3,null))['catch'](handleError(_0xa996a3,null));};exports[_0xcfdb('0xb5')]=function(_0x35af4b,_0xc4739b,_0x3a0f72){var _0x5d93a7,_0x36e509;return db[_0xcfdb('0x39')]['find']({'where':{'id':_0x35af4b[_0xcfdb('0x5e')]['id']}})['then'](handleEntityNotFound(_0xc4739b,null))[_0xcfdb('0x29')](function(_0x42a515){if(_0x42a515){_0x36e509=_0x42a515;return _0x42a515[_0xcfdb('0xb5')](_0x35af4b[_0xcfdb('0x53')][_0xcfdb('0x8f')],_[_0xcfdb('0x5c')](_0x35af4b['body'],[_0xcfdb('0x8f'),'id'])||{});}return null;})[_0xcfdb('0x94')](function(_0x4ef337){var _0x28f5c9;_0x5d93a7=_0x4ef337||[];var _0x4b7ac3=[];if(_0x4ef337){for(var _0xf596e=0x0;_0xf596e<_0x4ef337['length'];_0xf596e+=0x1){var _0x2c92ce=_0x4ef337[_0xf596e][_0xcfdb('0x2b')]({'plain':!![]});_0x28f5c9=squel['insert']()[_0xcfdb('0x9e')](_0xcfdb('0xb6'))[_0xcfdb('0xb2')]([_0xcfdb('0xa2'),_0xcfdb('0xa0'),'ListId',_0xcfdb('0x61'),_0xcfdb('0xa1'),_0xcfdb('0x5d')],squel['select']()[_0xcfdb('0x80')](_0xcfdb('0xa2'),_0xcfdb('0xa2'))['field']('id',_0xcfdb('0xa0'))[_0xcfdb('0x80')](_0x2c92ce[_0xcfdb('0xa5')][_0xcfdb('0x87')](),_0xcfdb('0xae'))[_0xcfdb('0x80')](_0x35af4b['params']['id'][_0xcfdb('0x87')](),'VoiceQueueId')[_0xcfdb('0x80')](_0xcfdb('0xa3'),_0xcfdb('0xa1'))[_0xcfdb('0x80')]('NOW()',_0xcfdb('0x5d'))[_0xcfdb('0x81')](_0xcfdb('0xaf'))['where'](_0xcfdb('0xb0'))['where'](_0xcfdb('0xa4'),_0x2c92ce['CmListId'][_0xcfdb('0x87')]())['where'](_0xcfdb('0xa6')))[_0xcfdb('0x87')]();_0x4b7ac3[_0xcfdb('0x86')](db['sequelize'][_0xcfdb('0x3e')](_0x28f5c9));}return BPromise['all'](_0x4b7ac3);}})['then'](function(){return _0x5d93a7;})[_0xcfdb('0x29')](respondWithResult(_0xc4739b,null))[_0xcfdb('0x50')](handleError(_0xc4739b,null));};exports[_0xcfdb('0xb7')]=function(_0xe3f1e3,_0x2d948b,_0x19bc64){return db[_0xcfdb('0x39')][_0xcfdb('0x34')]({'where':{'id':_0xe3f1e3[_0xcfdb('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2d948b,null))[_0xcfdb('0x29')](function(_0x2fb4a1){if(_0x2fb4a1){return _0x2fb4a1[_0xcfdb('0xb7')](_0xe3f1e3[_0xcfdb('0x3e')][_0xcfdb('0x8f')]);}})[_0xcfdb('0x29')](function(_0x410a27){if(_0x410a27){return db[_0xcfdb('0x69')][_0xcfdb('0x2a')]({'where':{'ListId':_0xe3f1e3[_0xcfdb('0x3e')][_0xcfdb('0x8f')],'VoiceQueueId':_0xe3f1e3[_0xcfdb('0x5e')]['id']}})[_0xcfdb('0x29')](function(){return _0x410a27;});}})[_0xcfdb('0x29')](respondWithStatusCode(_0x2d948b,null))['catch'](handleError(_0x2d948b,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index eb2dee8..e47b6f2 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 _0x1ea2=['emit','hook','events','VoiceQueue','save'];(function(_0x526c83,_0x3d9f14){var _0x4022a7=function(_0x43d7ce){while(--_0x43d7ce){_0x526c83['push'](_0x526c83['shift']());}};_0x4022a7(++_0x3d9f14);}(_0x1ea2,0x93));var _0x21ea=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x1ea2[_0x999b85];return _0x1d7124;};'use strict';var EventEmitter=require(_0x21ea('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x21ea('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x21ea('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x28d9c3){return function(_0x515128,_0x33f4d7,_0x294a0d){VoiceQueueEvents[_0x21ea('0x3')](_0x28d9c3+':'+_0x515128['id'],_0x515128);VoiceQueueEvents[_0x21ea('0x3')](_0x28d9c3,_0x515128);_0x294a0d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x21ea('0x4')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xffea=['emit','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x2b13fc,_0x5a334f){var _0xda1f9c=function(_0x1d1fe9){while(--_0x1d1fe9){_0x2b13fc['push'](_0x2b13fc['shift']());}};_0xda1f9c(++_0x5a334f);}(_0xffea,0x151));var _0xaffe=function(_0x3bc685,_0x35a785){_0x3bc685=_0x3bc685-0x0;var _0x25ec41=_0xffea[_0x3bc685];return _0x25ec41;};'use strict';var EventEmitter=require(_0xaffe('0x0'));var VoiceQueue=require(_0xaffe('0x1'))['db'][_0xaffe('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xaffe('0x3')](0x0);var events={'afterCreate':_0xaffe('0x4'),'afterUpdate':_0xaffe('0x5'),'afterDestroy':_0xaffe('0x6')};function emitEvent(_0x36d4e1){return function(_0x46706e,_0x4f9b19,_0x128beb){VoiceQueueEvents[_0xaffe('0x7')](_0x36d4e1+':'+_0x46706e['id'],_0x46706e);VoiceQueueEvents['emit'](_0x36d4e1,_0x46706e);_0x128beb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index ead04fa..e67f7df 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5d2577,_0x5ea377){var _0x437c8d=function(_0x1ce5e1){while(--_0x1ce5e1){_0x5d2577['push'](_0x5d2577['shift']());}};_0x437c8d(++_0x5ea377);}(_0x34e8,0x12c));var _0x834e=function(_0x1518fe,_0x500480){_0x1518fe=_0x1518fe-0x0;var _0x3ebe11=_0x34e8[_0x1518fe];return _0x3ebe11;};'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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x547c4c,_0x1b246e){var _0x3751be=function(_0x3befa5){while(--_0x3befa5){_0x547c4c['push'](_0x547c4c['shift']());}};_0x3751be(++_0x1b246e);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 453f64e..afdf3f1 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 _0x6b07=['bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','model','map','include','GetVoiceQueue','ShowVoiceQueue','find','lodash','util'];(function(_0x35e3b8,_0x1f543f){var _0xae5b9a=function(_0x483dd6){while(--_0x483dd6){_0x35e3b8['push'](_0x35e3b8['shift']());}};_0xae5b9a(++_0x1f543f);}(_0x6b07,0x1ec));var _0x76b0=function(_0x11463,_0x428158){_0x11463=_0x11463-0x0;var _0x276ea4=_0x6b07[_0x11463];return _0x276ea4;};'use strict';var _=require(_0x76b0('0x0'));var util=require(_0x76b0('0x1'));var moment=require('moment');var BPromise=require(_0x76b0('0x2'));var rs=require(_0x76b0('0x3'));var fs=require('fs');var Redis=require(_0x76b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x76b0('0x5'))(_0x76b0('0x6'));var config=require('../../config/environment');var jayson=require(_0x76b0('0x7'));var client=jayson[_0x76b0('0x8')][_0x76b0('0x9')]({'port':0x232a});config['redis']=_[_0x76b0('0xa')](config[_0x76b0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x76b0('0xc'))(new Redis(config[_0x76b0('0xb')]));require(_0x76b0('0xd'))[_0x76b0('0xe')](socket);function respondWithRpcPromise(_0x3f5362,_0x50b0ae,_0x181fbe){return new BPromise(function(_0x4ae66d,_0x209f22){return client['request'](_0x3f5362,_0x181fbe)[_0x76b0('0xf')](function(_0x226307){logger[_0x76b0('0x10')](_0x76b0('0x11'),_0x50b0ae,'request\x20sent');logger[_0x76b0('0x12')](_0x76b0('0x13'),_0x50b0ae,_0x76b0('0x14'),JSON[_0x76b0('0x15')](_0x226307));if(_0x226307['error']){if(_0x226307[_0x76b0('0x16')]['code']===0x1f4){logger['error'](_0x76b0('0x11'),_0x50b0ae,_0x226307[_0x76b0('0x16')][_0x76b0('0x17')]);return _0x209f22(_0x226307[_0x76b0('0x16')][_0x76b0('0x17')]);}logger[_0x76b0('0x16')](_0x76b0('0x11'),_0x50b0ae,_0x226307['error']['message']);return _0x4ae66d(_0x226307['error'][_0x76b0('0x17')]);}else{logger[_0x76b0('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x50b0ae,'request\x20sent');_0x4ae66d(_0x226307['result'][_0x76b0('0x17')]);}})[_0x76b0('0x18')](function(_0x4324da){logger[_0x76b0('0x16')](_0x76b0('0x11'),_0x50b0ae,_0x4324da);_0x209f22(_0x4324da);});});}exports['GetVoiceQueue']=function(_0x5c7eea){var _0x3c294a=this;return new Promise(function(_0x3abe60,_0x2f9dc6){return db[_0x76b0('0x19')][_0x76b0('0x1a')]({'raw':_0x5c7eea['options']?_0x5c7eea[_0x76b0('0x1b')][_0x76b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x5c7eea[_0x76b0('0x1b')]?_0x5c7eea[_0x76b0('0x1b')][_0x76b0('0x1d')]||null:null,'attributes':_0x5c7eea[_0x76b0('0x1b')]?_0x5c7eea[_0x76b0('0x1b')][_0x76b0('0x1e')]||null:null,'limit':_0x5c7eea[_0x76b0('0x1b')]?_0x5c7eea[_0x76b0('0x1b')][_0x76b0('0x1f')]||null:null,'include':_0x5c7eea[_0x76b0('0x1b')]?_0x5c7eea[_0x76b0('0x1b')]['include']?_['map'](_0x5c7eea['options']['include'],function(_0x5b6c98){return{'model':db[_0x5b6c98[_0x76b0('0x20')]],'as':_0x5b6c98['as'],'attributes':_0x5b6c98[_0x76b0('0x1e')],'include':_0x5b6c98['include']?_[_0x76b0('0x21')](_0x5b6c98['include'],function(_0x15f69a){return{'model':db[_0x15f69a[_0x76b0('0x20')]],'as':_0x15f69a['as'],'attributes':_0x15f69a[_0x76b0('0x1e')],'include':_0x15f69a['include']?_[_0x76b0('0x21')](_0x15f69a[_0x76b0('0x22')],function(_0x2da474){return{'model':db[_0x2da474[_0x76b0('0x20')]],'as':_0x2da474['as'],'attributes':_0x2da474[_0x76b0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76b0('0xf')](function(_0x1fa1bc){logger['info']('GetVoiceQueue',_0x5c7eea);logger[_0x76b0('0x12')](_0x76b0('0x23'),_0x5c7eea,JSON[_0x76b0('0x15')](_0x1fa1bc));_0x3abe60(_0x1fa1bc);})[_0x76b0('0x18')](function(_0x591924){logger[_0x76b0('0x16')]('GetVoiceQueue',_0x591924['message'],_0x5c7eea);_0x2f9dc6(_0x3c294a[_0x76b0('0x16')](0x1f4,_0x591924['message']));});});};exports[_0x76b0('0x24')]=function(_0x2389de){var _0xae877b=this;return new Promise(function(_0x890f7b,_0xe44c3c){return db[_0x76b0('0x19')][_0x76b0('0x25')]({'raw':_0x2389de['options']?_0x2389de[_0x76b0('0x1b')][_0x76b0('0x1c')]===undefined?!![]:![]:!![],'where':_0x2389de['options']?_0x2389de[_0x76b0('0x1b')][_0x76b0('0x1d')]||null:null,'attributes':_0x2389de[_0x76b0('0x1b')]?_0x2389de[_0x76b0('0x1b')][_0x76b0('0x1e')]||null:null,'include':_0x2389de[_0x76b0('0x1b')]?_0x2389de['options'][_0x76b0('0x22')]?_[_0x76b0('0x21')](_0x2389de[_0x76b0('0x1b')][_0x76b0('0x22')],function(_0x57e8c4){return{'model':db[_0x57e8c4[_0x76b0('0x20')]],'as':_0x57e8c4['as'],'attributes':_0x57e8c4[_0x76b0('0x1e')],'include':_0x57e8c4['include']?_['map'](_0x57e8c4[_0x76b0('0x22')],function(_0x54069f){return{'model':db[_0x54069f['model']],'as':_0x54069f['as'],'attributes':_0x54069f['attributes'],'include':_0x54069f[_0x76b0('0x22')]?_[_0x76b0('0x21')](_0x54069f[_0x76b0('0x22')],function(_0x14fc50){return{'model':db[_0x14fc50[_0x76b0('0x20')]],'as':_0x14fc50['as'],'attributes':_0x14fc50[_0x76b0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x76b0('0xf')](function(_0x36fc40){logger[_0x76b0('0x10')](_0x76b0('0x24'),_0x2389de);logger[_0x76b0('0x12')](_0x76b0('0x24'),_0x2389de,JSON['stringify'](_0x36fc40));_0x890f7b(_0x36fc40);})[_0x76b0('0x18')](function(_0x597a0d){logger[_0x76b0('0x16')](_0x76b0('0x24'),_0x597a0d['message'],_0x2389de);_0xe44c3c(_0xae877b['error'](0x1f4,_0x597a0d['message']));});});}; \ No newline at end of file +var _0xa5de=['defaults','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x245601,_0x2d91c9){var _0x2d9599=function(_0x1687e6){while(--_0x1687e6){_0x245601['push'](_0x245601['shift']());}};_0x2d9599(++_0x2d91c9);}(_0xa5de,0x118));var _0xea5d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xa5de[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xea5d('0x0'));var util=require('util');var moment=require(_0xea5d('0x1'));var BPromise=require(_0xea5d('0x2'));var rs=require(_0xea5d('0x3'));var fs=require('fs');var Redis=require(_0xea5d('0x4'));var db=require(_0xea5d('0x5'))['db'];var utils=require(_0xea5d('0x6'));var logger=require(_0xea5d('0x7'))(_0xea5d('0x8'));var config=require(_0xea5d('0x9'));var jayson=require(_0xea5d('0xa'));var client=jayson[_0xea5d('0xb')][_0xea5d('0xc')]({'port':0x232a});config[_0xea5d('0xd')]=_[_0xea5d('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xea5d('0xf'))(new Redis(config['redis']));require(_0xea5d('0x10'))[_0xea5d('0x11')](socket);function respondWithRpcPromise(_0xf3cb2c,_0x319fb3,_0x14e2ed){return new BPromise(function(_0x41e56e,_0x1803f1){return client['request'](_0xf3cb2c,_0x14e2ed)[_0xea5d('0x12')](function(_0x2117f){logger[_0xea5d('0x13')](_0xea5d('0x14'),_0x319fb3,_0xea5d('0x15'));logger[_0xea5d('0x16')](_0xea5d('0x17'),_0x319fb3,_0xea5d('0x15'),JSON['stringify'](_0x2117f));if(_0x2117f['error']){if(_0x2117f[_0xea5d('0x18')][_0xea5d('0x19')]===0x1f4){logger[_0xea5d('0x18')](_0xea5d('0x14'),_0x319fb3,_0x2117f[_0xea5d('0x18')][_0xea5d('0x1a')]);return _0x1803f1(_0x2117f[_0xea5d('0x18')][_0xea5d('0x1a')]);}logger['error'](_0xea5d('0x14'),_0x319fb3,_0x2117f[_0xea5d('0x18')][_0xea5d('0x1a')]);return _0x41e56e(_0x2117f[_0xea5d('0x18')][_0xea5d('0x1a')]);}else{logger[_0xea5d('0x13')](_0xea5d('0x14'),_0x319fb3,_0xea5d('0x15'));_0x41e56e(_0x2117f[_0xea5d('0x1b')][_0xea5d('0x1a')]);}})['catch'](function(_0x30a59a){logger['error'](_0xea5d('0x14'),_0x319fb3,_0x30a59a);_0x1803f1(_0x30a59a);});});}exports[_0xea5d('0x1c')]=function(_0x5df22a){var _0x193422=this;return new Promise(function(_0x49cf60,_0x18bbf2){return db['VoiceQueue'][_0xea5d('0x1d')]({'raw':_0x5df22a[_0xea5d('0x1e')]?_0x5df22a['options'][_0xea5d('0x1f')]===undefined?!![]:![]:!![],'where':_0x5df22a[_0xea5d('0x1e')]?_0x5df22a[_0xea5d('0x1e')][_0xea5d('0x20')]||null:null,'attributes':_0x5df22a[_0xea5d('0x1e')]?_0x5df22a['options'][_0xea5d('0x21')]||null:null,'limit':_0x5df22a[_0xea5d('0x1e')]?_0x5df22a[_0xea5d('0x1e')][_0xea5d('0x22')]||null:null,'include':_0x5df22a['options']?_0x5df22a[_0xea5d('0x1e')]['include']?_[_0xea5d('0x23')](_0x5df22a['options'][_0xea5d('0x24')],function(_0x575957){return{'model':db[_0x575957[_0xea5d('0x25')]],'as':_0x575957['as'],'attributes':_0x575957[_0xea5d('0x21')],'include':_0x575957[_0xea5d('0x24')]?_[_0xea5d('0x23')](_0x575957[_0xea5d('0x24')],function(_0x4f18ee){return{'model':db[_0x4f18ee[_0xea5d('0x25')]],'as':_0x4f18ee['as'],'attributes':_0x4f18ee[_0xea5d('0x21')],'include':_0x4f18ee[_0xea5d('0x24')]?_[_0xea5d('0x23')](_0x4f18ee[_0xea5d('0x24')],function(_0x38f74e){return{'model':db[_0x38f74e[_0xea5d('0x25')]],'as':_0x38f74e['as'],'attributes':_0x38f74e[_0xea5d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xea5d('0x12')](function(_0x46860a){logger['info'](_0xea5d('0x1c'),_0x5df22a);logger[_0xea5d('0x16')](_0xea5d('0x1c'),_0x5df22a,JSON[_0xea5d('0x26')](_0x46860a));_0x49cf60(_0x46860a);})[_0xea5d('0x27')](function(_0x20083e){logger[_0xea5d('0x18')](_0xea5d('0x1c'),_0x20083e['message'],_0x5df22a);_0x18bbf2(_0x193422[_0xea5d('0x18')](0x1f4,_0x20083e['message']));});});};exports[_0xea5d('0x28')]=function(_0x4e7fff){var _0x4e1ec4=this;return new Promise(function(_0x163e1f,_0x3cdfa4){return db['VoiceQueue'][_0xea5d('0x29')]({'raw':_0x4e7fff['options']?_0x4e7fff[_0xea5d('0x1e')][_0xea5d('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e7fff[_0xea5d('0x1e')]?_0x4e7fff[_0xea5d('0x1e')][_0xea5d('0x20')]||null:null,'attributes':_0x4e7fff[_0xea5d('0x1e')]?_0x4e7fff['options'][_0xea5d('0x21')]||null:null,'include':_0x4e7fff[_0xea5d('0x1e')]?_0x4e7fff['options'][_0xea5d('0x24')]?_[_0xea5d('0x23')](_0x4e7fff[_0xea5d('0x1e')]['include'],function(_0x271c55){return{'model':db[_0x271c55['model']],'as':_0x271c55['as'],'attributes':_0x271c55[_0xea5d('0x21')],'include':_0x271c55['include']?_['map'](_0x271c55['include'],function(_0x3226d6){return{'model':db[_0x3226d6['model']],'as':_0x3226d6['as'],'attributes':_0x3226d6[_0xea5d('0x21')],'include':_0x3226d6[_0xea5d('0x24')]?_[_0xea5d('0x23')](_0x3226d6[_0xea5d('0x24')],function(_0x2a01b7){return{'model':db[_0x2a01b7['model']],'as':_0x2a01b7['as'],'attributes':_0x2a01b7[_0xea5d('0x21')]};}):[]};}):[]};}):[]:[]})[_0xea5d('0x12')](function(_0x164f3d){logger['info'](_0xea5d('0x28'),_0x4e7fff);logger[_0xea5d('0x16')](_0xea5d('0x28'),_0x4e7fff,JSON[_0xea5d('0x26')](_0x164f3d));_0x163e1f(_0x164f3d);})[_0xea5d('0x27')](function(_0x4cf904){logger[_0xea5d('0x18')]('ShowVoiceQueue',_0x4cf904[_0xea5d('0x1a')],_0x4e7fff);_0x3cdfa4(_0x4e1ec4[_0xea5d('0x18')](0x1f4,_0x4cf904[_0xea5d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d26dc8a..efcd7c6 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 _0xe7e2=['register','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xe7e2,0x162));var _0x2e7e=function(_0x103238,_0x1e99ac){_0x103238=_0x103238-0x0;var _0xc908d0=_0xe7e2[_0x103238];return _0xc908d0;};'use strict';var VoiceQueueEvents=require(_0x2e7e('0x0'));var events=[_0x2e7e('0x1'),_0x2e7e('0x2'),_0x2e7e('0x3')];function createListener(_0x4f763e,_0x565d54){return function(_0x3871a9){_0x565d54[_0x2e7e('0x4')](_0x4f763e,_0x3871a9);};}function removeListener(_0x180ffa,_0x1de6c8){return function(){VoiceQueueEvents[_0x2e7e('0x5')](_0x180ffa,_0x1de6c8);};}exports[_0x2e7e('0x6')]=function(_0x432972){for(var _0x185b44=0x0,_0x442a5f=events[_0x2e7e('0x7')];_0x185b44<_0x442a5f;_0x185b44++){var _0x1c357f=events[_0x185b44];var _0x59d136=createListener(_0x2e7e('0x8')+_0x1c357f,_0x432972);VoiceQueueEvents['on'](_0x1c357f,_0x59d136);}}; \ No newline at end of file +var _0x27c9=['./voiceQueue.events','save','remove','update','length','voiceQueue:'];(function(_0x311f44,_0x1d7f5b){var _0x46f1e6=function(_0x27342a){while(--_0x27342a){_0x311f44['push'](_0x311f44['shift']());}};_0x46f1e6(++_0x1d7f5b);}(_0x27c9,0x1b6));var _0x927c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x27c9[_0x4cf98e];return _0x1623ac;};'use strict';var VoiceQueueEvents=require(_0x927c('0x0'));var events=[_0x927c('0x1'),_0x927c('0x2'),_0x927c('0x3')];function createListener(_0x4bb07a,_0x2121ba){return function(_0x110b8a){_0x2121ba['emit'](_0x4bb07a,_0x110b8a);};}function removeListener(_0xabb93b,_0x1d9c74){return function(){VoiceQueueEvents['removeListener'](_0xabb93b,_0x1d9c74);};}exports['register']=function(_0x30dce4){for(var _0x328b16=0x0,_0x1213bf=events[_0x927c('0x4')];_0x328b16<_0x1213bf;_0x328b16++){var _0x369c23=events[_0x328b16];var _0x577d60=createListener(_0x927c('0x5')+_0x369c23,_0x30dce4);VoiceQueueEvents['on'](_0x369c23,_0x577d60);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8d11154..21c842c 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 _0x4884=['getVoiceQueuesReport','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4884,0x1d1));var _0x4488=function(_0x2e0853,_0x142025){_0x2e0853=_0x2e0853-0x0;var _0x5137a9=_0x4884[_0x2e0853];return _0x5137a9;};'use strict';var multer=require(_0x4488('0x0'));var util=require(_0x4488('0x1'));var path=require('path');var timeout=require(_0x4488('0x2'));var express=require(_0x4488('0x3'));var router=express[_0x4488('0x4')]();var fs_extra=require(_0x4488('0x5'));var auth=require(_0x4488('0x6'));var interaction=require(_0x4488('0x7'));var config=require(_0x4488('0x8'));var controller=require(_0x4488('0x9'));router[_0x4488('0xa')]('/',auth['isAuthenticated'](),controller[_0x4488('0xb')]);router[_0x4488('0xa')](_0x4488('0xc'),auth[_0x4488('0xd')](),controller[_0x4488('0xe')]);router['get']('/index',auth['isAuthenticated'](),controller[_0x4488('0xf')]);router[_0x4488('0xa')](_0x4488('0x10'),auth[_0x4488('0xd')](),controller[_0x4488('0x11')]);router[_0x4488('0x12')]('/',auth['isAuthenticated'](),controller[_0x4488('0x13')]);router[_0x4488('0x14')]('/:id',auth[_0x4488('0xd')](),controller['update']);router[_0x4488('0x15')](_0x4488('0x10'),auth[_0x4488('0xd')](),controller[_0x4488('0x16')]);module[_0x4488('0x17')]=router; \ No newline at end of file +var _0xef80=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','getVoiceQueuesReport','/:id','post','update','delete','destroy','multer'];(function(_0x2114f4,_0x1964f0){var _0x55f5f1=function(_0x2b7d3e){while(--_0x2b7d3e){_0x2114f4['push'](_0x2114f4['shift']());}};_0x55f5f1(++_0x1964f0);}(_0xef80,0x175));var _0x0ef8=function(_0x1857c6,_0x48840c){_0x1857c6=_0x1857c6-0x0;var _0x51011c=_0xef80[_0x1857c6];return _0x51011c;};'use strict';var multer=require(_0x0ef8('0x0'));var util=require('util');var path=require(_0x0ef8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0ef8('0x2')]();var fs_extra=require(_0x0ef8('0x3'));var auth=require(_0x0ef8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0ef8('0x5'));var controller=require(_0x0ef8('0x6'));router[_0x0ef8('0x7')]('/',auth[_0x0ef8('0x8')](),controller['index']);router[_0x0ef8('0x7')](_0x0ef8('0x9'),auth[_0x0ef8('0x8')](),controller[_0x0ef8('0xa')]);router['get']('/index',auth[_0x0ef8('0x8')](),controller[_0x0ef8('0xb')]);router[_0x0ef8('0x7')](_0x0ef8('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0ef8('0xd')]('/',auth[_0x0ef8('0x8')](),controller['create']);router['put'](_0x0ef8('0xc'),auth[_0x0ef8('0x8')](),controller[_0x0ef8('0xe')]);router[_0x0ef8('0xf')]('/:id',auth[_0x0ef8('0x8')](),controller[_0x0ef8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index e96df2a..d1cd69f 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 _0x6e02=['DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING'];(function(_0x57a138,_0x832e71){var _0x45d6d1=function(_0x28bed1){while(--_0x28bed1){_0x57a138['push'](_0x57a138['shift']());}};_0x45d6d1(++_0x832e71);}(_0x6e02,0x192));var _0x26e0=function(_0x542c73,_0x307b9c){_0x542c73=_0x542c73-0x0;var _0x7d5f0e=_0x6e02[_0x542c73];return _0x7d5f0e;};'use strict';var Sequelize=require(_0x26e0('0x0'));var moment=require(_0x26e0('0x1'));module['exports']={'type':{'type':Sequelize[_0x26e0('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x26e0('0x2')]},'calleridname':{'type':Sequelize[_0x26e0('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x26e0('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x34a9d2){var _0x5a4a4c=moment(_0x34a9d2);var _0x12b3ee=moment(this[_0x26e0('0x4')](_0x26e0('0x5')))[_0x26e0('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x12134e=_0x5a4a4c[_0x26e0('0x7')](_0x12b3ee,_0x26e0('0x8'));this['setDataValue'](_0x26e0('0x9'),_0x34a9d2);this[_0x26e0('0xa')]('holdtime',_0x12134e||null);}},'position':{'type':Sequelize[_0x26e0('0xb')]},'count':{'type':Sequelize[_0x26e0('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x26e0('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x26e0('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x26e0('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x26e0('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x26e0('0x2')],'comment':_0x26e0('0xd')},'originalposition':{'type':Sequelize[_0x26e0('0xb')]},'channel':{'type':Sequelize[_0x26e0('0x2')]},'connectedlinenum':{'type':Sequelize[_0x26e0('0x2')]},'connectedlinename':{'type':Sequelize[_0x26e0('0x2')]},'accountcode':{'type':Sequelize[_0x26e0('0x2')]},'context':{'type':Sequelize[_0x26e0('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x26e0('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x26e0('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x26e0('0x2')],'comment':_0x26e0('0xe')},'transferexten':{'type':Sequelize[_0x26e0('0x2')]},'transferuniqueid':{'type':Sequelize[_0x26e0('0x2')]},'disposition':{'type':Sequelize[_0x26e0('0x2')]},'secondDisposition':{'type':Sequelize[_0x26e0('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x26e0('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa307=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x2532a6,_0x25e8e9){var _0x1d6b92=function(_0x39158d){while(--_0x39158d){_0x2532a6['push'](_0x2532a6['shift']());}};_0x1d6b92(++_0x25e8e9);}(_0xa307,0x6f));var _0x7a30=function(_0x1bc9ff,_0xa70baa){_0x1bc9ff=_0x1bc9ff-0x0;var _0x17f01c=_0xa307[_0x1bc9ff];return _0x17f01c;};'use strict';var Sequelize=require(_0x7a30('0x0'));var moment=require(_0x7a30('0x1'));module[_0x7a30('0x2')]={'type':{'type':Sequelize[_0x7a30('0x3')]},'uniqueid':{'type':Sequelize[_0x7a30('0x3')]},'calleridnum':{'type':Sequelize[_0x7a30('0x3')]},'calleridname':{'type':Sequelize[_0x7a30('0x3')]},'queue':{'type':Sequelize[_0x7a30('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x7a30('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x7a30('0x4')],'set':function(_0x1b6eeb){var _0x74e528=moment(_0x1b6eeb);var _0x6a2d75=moment(this[_0x7a30('0x5')](_0x7a30('0x6')))[_0x7a30('0x7')](_0x7a30('0x8'));var _0x65d57c=_0x74e528[_0x7a30('0x9')](_0x6a2d75,_0x7a30('0xa'));this[_0x7a30('0xb')](_0x7a30('0xc'),_0x1b6eeb);this[_0x7a30('0xb')](_0x7a30('0xd'),_0x65d57c||null);}},'position':{'type':Sequelize[_0x7a30('0xe')]},'count':{'type':Sequelize[_0x7a30('0xe')]},'queuecallerabandon':{'type':Sequelize[_0x7a30('0xf')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7a30('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x7a30('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7a30('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7a30('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x7a30('0x10')},'originalposition':{'type':Sequelize[_0x7a30('0xe')]},'channel':{'type':Sequelize[_0x7a30('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7a30('0x3')]},'accountcode':{'type':Sequelize[_0x7a30('0x3')]},'context':{'type':Sequelize[_0x7a30('0x3')]},'exten':{'type':Sequelize[_0x7a30('0x3')]},'priority':{'type':Sequelize[_0x7a30('0x3')]},'holdtime':{'type':Sequelize[_0x7a30('0xe')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7a30('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7a30('0x3')]},'transfer':{'type':Sequelize[_0x7a30('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7a30('0x3')],'comment':_0x7a30('0x11')},'transferexten':{'type':Sequelize[_0x7a30('0x3')]},'transferuniqueid':{'type':Sequelize[_0x7a30('0x3')]},'disposition':{'type':Sequelize[_0x7a30('0x3')]},'secondDisposition':{'type':Sequelize[_0x7a30('0x3')]},'thirdDisposition':{'type':Sequelize[_0x7a30('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x7a30('0xe')],'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 e2f5269..2cd65a3 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 _0x3dde=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','options','VoiceQueueReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','update','describe','getVoiceQueuesReport','pick','rows','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3dde,0x6d));var _0xe3dd=function(_0x3a4464,_0x37afa0){_0x3a4464=_0x3a4464-0x0;var _0x42503f=_0x3dde[_0x3a4464];return _0x42503f;};'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('request-promise');var moment=require('moment');var BPromise=require(_0xe3dd('0x0'));var Mustache=require(_0xe3dd('0x1'));var util=require(_0xe3dd('0x2'));var path=require(_0xe3dd('0x3'));var sox=require(_0xe3dd('0x4'));var csv=require(_0xe3dd('0x5'));var ejs=require(_0xe3dd('0x6'));var fs=require('fs');var fs_extra=require(_0xe3dd('0x7'));var _=require(_0xe3dd('0x8'));var squel=require(_0xe3dd('0x9'));var crypto=require(_0xe3dd('0xa'));var jsforce=require(_0xe3dd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe3dd('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe3dd('0xc'));var authService=require(_0xe3dd('0xd'));var qs=require(_0xe3dd('0xe'));var as=require(_0xe3dd('0xf'));var hardwareService=require(_0xe3dd('0x10'));var logger=require(_0xe3dd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe3dd('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xe3dd('0x13')](config['redis'],{'host':_0xe3dd('0x14'),'port':0x18eb});var socket=require(_0xe3dd('0x15'))(new Redis(config[_0xe3dd('0x16')]));require('./voiceQueueReport.socket')[_0xe3dd('0x17')](socket);function respondWithStatusCode(_0x361b88,_0x2ed6c1){_0x2ed6c1=_0x2ed6c1||0xcc;return function(_0x99a23d){if(_0x99a23d){return _0x361b88['sendStatus'](_0x2ed6c1);}return _0x361b88[_0xe3dd('0x18')](_0x2ed6c1)[_0xe3dd('0x19')]();};}function respondWithResult(_0x4e3076,_0x387082){_0x387082=_0x387082||0xc8;return function(_0x30d43e){if(_0x30d43e){return _0x4e3076[_0xe3dd('0x18')](_0x387082)[_0xe3dd('0x1a')](_0x30d43e);}};}function respondWithFilteredResult(_0x35620a,_0x48e0f1){return function(_0x366971){if(_0x366971){var _0x35928b=typeof _0x48e0f1[_0xe3dd('0x1b')]===_0xe3dd('0x1c')&&typeof _0x48e0f1[_0xe3dd('0x1d')]===_0xe3dd('0x1c');var _0x2291d4=_0x366971[_0xe3dd('0x1e')];var _0x5c9bd0=_0x35928b?0x0:_0x48e0f1[_0xe3dd('0x1b')];var _0xde88de=_0x35928b?_0x366971['count']:_0x48e0f1['offset']+_0x48e0f1[_0xe3dd('0x1d')];var _0x35a6d9;if(_0xde88de>=_0x2291d4){_0xde88de=_0x2291d4;_0x35a6d9=0xc8;}else{_0x35a6d9=0xce;}_0x35620a[_0xe3dd('0x18')](_0x35a6d9);return _0x35620a[_0xe3dd('0x1f')](_0xe3dd('0x20'),_0x5c9bd0+'-'+_0xde88de+'/'+_0x2291d4)[_0xe3dd('0x1a')](_0x366971);}return null;};}function patchUpdates(_0x4ec34d){return function(_0x22a0b0){try{jsonpatch[_0xe3dd('0x21')](_0x22a0b0,_0x4ec34d,!![]);}catch(_0x1ae4f9){return BPromise[_0xe3dd('0x22')](_0x1ae4f9);}return _0x22a0b0[_0xe3dd('0x23')]();};}function saveUpdates(_0x1949c2,_0x4608d0){return function(_0x465899){if(_0x465899){return _0x465899['update'](_0x1949c2)['then'](function(_0x5c8f91){return _0x5c8f91;});}return null;};}function removeEntity(_0x58a9f9,_0x5de4b5){return function(_0x2b9f0d){if(_0x2b9f0d){return _0x2b9f0d[_0xe3dd('0x24')]()[_0xe3dd('0x25')](function(){_0x58a9f9[_0xe3dd('0x18')](0xcc)[_0xe3dd('0x19')]();});}};}function handleEntityNotFound(_0x11ef47,_0x5c5896){return function(_0x3dfa7f){if(!_0x3dfa7f){_0x11ef47[_0xe3dd('0x26')](0x194);}return _0x3dfa7f;};}function handleError(_0x22396b,_0x4f216c){_0x4f216c=_0x4f216c||0x1f4;return function(_0x966ed4){logger['error'](_0x966ed4[_0xe3dd('0x27')]);if(_0x966ed4[_0xe3dd('0x28')]){delete _0x966ed4[_0xe3dd('0x28')];}_0x22396b['status'](_0x4f216c)[_0xe3dd('0x29')](_0x966ed4);};}exports[_0xe3dd('0x2a')]=function(_0x5cea5a,_0x3ccb1e){var _0x5706de={},_0x7b9ffa={},_0x569ef6={'count':0x0,'rows':[]};var _0x3f7b20=_[_0xe3dd('0x2b')](db['VoiceQueueReport'][_0xe3dd('0x2c')],function(_0x32d55e){return{'name':_0x32d55e['fieldName'],'type':_0x32d55e[_0xe3dd('0x2d')][_0xe3dd('0x2e')]};});_0x7b9ffa[_0xe3dd('0x2f')]=_[_0xe3dd('0x2b')](_0x3f7b20,_0xe3dd('0x28'));_0x7b9ffa['query']=_['keys'](_0x5cea5a[_0xe3dd('0x30')]);_0x7b9ffa['filters']=_[_0xe3dd('0x31')](_0x7b9ffa[_0xe3dd('0x2f')],_0x7b9ffa['query']);_0x5706de[_0xe3dd('0x32')]=_[_0xe3dd('0x31')](_0x7b9ffa[_0xe3dd('0x2f')],qs[_0xe3dd('0x33')](_0x5cea5a[_0xe3dd('0x30')][_0xe3dd('0x33')]));_0x5706de[_0xe3dd('0x32')]=_0x5706de[_0xe3dd('0x32')][_0xe3dd('0x34')]?_0x5706de[_0xe3dd('0x32')]:_0x7b9ffa[_0xe3dd('0x2f')];if(!_0x5cea5a['query'][_0xe3dd('0x35')](_0xe3dd('0x36'))){_0x5706de[_0xe3dd('0x1d')]=qs['limit'](_0x5cea5a[_0xe3dd('0x30')][_0xe3dd('0x1d')]);_0x5706de[_0xe3dd('0x1b')]=qs['offset'](_0x5cea5a['query'][_0xe3dd('0x1b')]);}_0x5706de[_0xe3dd('0x37')]=qs['sort'](_0x5cea5a[_0xe3dd('0x30')][_0xe3dd('0x38')]);_0x5706de['where']=qs['filters'](_['pick'](_0x5cea5a[_0xe3dd('0x30')],_0x7b9ffa[_0xe3dd('0x39')]),_0x3f7b20);if(_0x5cea5a[_0xe3dd('0x30')][_0xe3dd('0x3a')]){_0x5706de[_0xe3dd('0x3b')]=_['merge'](_0x5706de['where'],{'$or':_[_0xe3dd('0x2b')](_0x3f7b20,function(_0x384ad9){if(_0x384ad9['type']!==_0xe3dd('0x3c')){var _0x41054c={};_0x41054c[_0x384ad9[_0xe3dd('0x28')]]={'$like':'%'+_0x5cea5a['query'][_0xe3dd('0x3a')]+'%'};return _0x41054c;}})});}_0x5706de=_[_0xe3dd('0x3d')]({},_0x5706de,_0x5cea5a[_0xe3dd('0x3e')]);var _0x42b1a8={'where':_0x5706de[_0xe3dd('0x3b')]};return db[_0xe3dd('0x3f')]['count'](_0x42b1a8)['then'](function(_0x5f4865){_0x569ef6[_0xe3dd('0x1e')]=_0x5f4865;if(_0x5cea5a[_0xe3dd('0x30')][_0xe3dd('0x40')]){_0x5706de[_0xe3dd('0x41')]=[{'all':!![]}];}return db[_0xe3dd('0x3f')][_0xe3dd('0x42')](_0x5706de);})[_0xe3dd('0x25')](function(_0x2008f5){_0x569ef6['rows']=_0x2008f5;return _0x569ef6;})['then'](respondWithFilteredResult(_0x3ccb1e,_0x5706de))[_0xe3dd('0x43')](handleError(_0x3ccb1e,null));};exports[_0xe3dd('0x44')]=function(_0x5c7b04,_0x4fe7cb){var _0x20d52c={'raw':![],'where':{'id':_0x5c7b04[_0xe3dd('0x45')]['id']}},_0x3bffd1={};_0x3bffd1[_0xe3dd('0x2f')]=_[_0xe3dd('0x46')](db[_0xe3dd('0x3f')][_0xe3dd('0x2c')]);_0x3bffd1[_0xe3dd('0x30')]=_[_0xe3dd('0x46')](_0x5c7b04[_0xe3dd('0x30')]);_0x3bffd1[_0xe3dd('0x39')]=_[_0xe3dd('0x31')](_0x3bffd1[_0xe3dd('0x2f')],_0x3bffd1['query']);_0x20d52c[_0xe3dd('0x32')]=_[_0xe3dd('0x31')](_0x3bffd1[_0xe3dd('0x2f')],qs['fields'](_0x5c7b04['query'][_0xe3dd('0x33')]));_0x20d52c[_0xe3dd('0x32')]=_0x20d52c[_0xe3dd('0x32')][_0xe3dd('0x34')]?_0x20d52c[_0xe3dd('0x32')]:_0x3bffd1['model'];if(_0x5c7b04['query'][_0xe3dd('0x40')]){_0x20d52c[_0xe3dd('0x41')]=[{'all':!![]}];}_0x20d52c=_[_0xe3dd('0x3d')]({},_0x20d52c,_0x5c7b04[_0xe3dd('0x3e')]);return db['VoiceQueueReport'][_0xe3dd('0x47')](_0x20d52c)[_0xe3dd('0x25')](handleEntityNotFound(_0x4fe7cb,null))[_0xe3dd('0x25')](respondWithResult(_0x4fe7cb,null))['catch'](handleError(_0x4fe7cb,null));};exports[_0xe3dd('0x48')]=function(_0x3732ed,_0xcc50d8){return db[_0xe3dd('0x3f')][_0xe3dd('0x48')](_0x3732ed[_0xe3dd('0x49')],{})[_0xe3dd('0x25')](respondWithResult(_0xcc50d8,0xc9))['catch'](handleError(_0xcc50d8,null));};exports[_0xe3dd('0x4a')]=function(_0x3bacfc,_0x5a0ce4){if(_0x3bacfc[_0xe3dd('0x49')]['id']){delete _0x3bacfc[_0xe3dd('0x49')]['id'];}return db[_0xe3dd('0x3f')][_0xe3dd('0x47')]({'where':{'id':_0x3bacfc[_0xe3dd('0x45')]['id']}})[_0xe3dd('0x25')](handleEntityNotFound(_0x5a0ce4,null))[_0xe3dd('0x25')](saveUpdates(_0x3bacfc[_0xe3dd('0x49')],null))['then'](respondWithResult(_0x5a0ce4,null))['catch'](handleError(_0x5a0ce4,null));};exports[_0xe3dd('0x24')]=function(_0x2c1d5a,_0x6f85e3){return db['VoiceQueueReport'][_0xe3dd('0x47')]({'where':{'id':_0x2c1d5a[_0xe3dd('0x45')]['id']}})['then'](handleEntityNotFound(_0x6f85e3,null))['then'](removeEntity(_0x6f85e3,null))[_0xe3dd('0x43')](handleError(_0x6f85e3,null));};exports[_0xe3dd('0x4b')]=function(_0xe1ca5f,_0x3b122d){return db['VoiceQueueReport'][_0xe3dd('0x4b')]()[_0xe3dd('0x25')](respondWithResult(_0x3b122d,null))[_0xe3dd('0x43')](handleError(_0x3b122d,null));};exports[_0xe3dd('0x4c')]=function(_0x5d4f57,_0x591096){var _0x4810c4={},_0x1263bc={},_0x17f335={'count':0x0,'rows':[]};_0x1263bc['model']=_[_0xe3dd('0x46')](db[_0xe3dd('0x3f')][_0xe3dd('0x2c')]);_0x1263bc[_0xe3dd('0x30')]=_['keys'](_0x5d4f57[_0xe3dd('0x30')]);_0x1263bc[_0xe3dd('0x39')]=_[_0xe3dd('0x31')](_0x1263bc[_0xe3dd('0x2f')],_0x1263bc[_0xe3dd('0x30')]);_0x4810c4[_0xe3dd('0x32')]=_['intersection'](_0x1263bc[_0xe3dd('0x2f')],qs[_0xe3dd('0x33')](_0x5d4f57[_0xe3dd('0x30')][_0xe3dd('0x33')]));_0x4810c4[_0xe3dd('0x32')]=_0x4810c4[_0xe3dd('0x32')]['length']?_0x4810c4[_0xe3dd('0x32')]:_0x1263bc[_0xe3dd('0x2f')];if(!_0x5d4f57['query'][_0xe3dd('0x35')](_0xe3dd('0x36'))){_0x4810c4[_0xe3dd('0x1d')]=qs[_0xe3dd('0x1d')](_0x5d4f57['query'][_0xe3dd('0x1d')]);_0x4810c4['offset']=qs[_0xe3dd('0x1b')](_0x5d4f57['query'][_0xe3dd('0x1b')]);}_0x4810c4[_0xe3dd('0x37')]=qs[_0xe3dd('0x38')](_0x5d4f57[_0xe3dd('0x30')][_0xe3dd('0x38')]);_0x4810c4[_0xe3dd('0x3b')]=qs['filters'](_[_0xe3dd('0x4d')](_0x5d4f57[_0xe3dd('0x30')],_0x1263bc[_0xe3dd('0x39')]));if(_0x5d4f57['query']['filter']){_0x4810c4[_0xe3dd('0x3b')]=_[_0xe3dd('0x3d')](_0x4810c4[_0xe3dd('0x3b')],{'$or':_[_0xe3dd('0x2b')](_0x4810c4[_0xe3dd('0x32')],function(_0x3e1bc2){var _0x36769d={};_0x36769d[_0x3e1bc2]={'$like':'%'+_0x5d4f57[_0xe3dd('0x30')][_0xe3dd('0x3a')]+'%'};return _0x36769d;})});}_0x4810c4=_['merge']({},_0x4810c4,_0x5d4f57[_0xe3dd('0x3e')]);var _0xa65e77={'where':_0x4810c4[_0xe3dd('0x3b')]};return db['VoiceQueueReport'][_0xe3dd('0x1e')](_0xa65e77)[_0xe3dd('0x25')](function(_0x3ca49c){_0x17f335[_0xe3dd('0x1e')]=_0x3ca49c;if(_0x5d4f57[_0xe3dd('0x30')][_0xe3dd('0x40')]){_0x4810c4['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4810c4);})[_0xe3dd('0x25')](function(_0x4bc996){_0x17f335[_0xe3dd('0x4e')]=_0x4bc996;return _0x17f335;})[_0xe3dd('0x25')](respondWithFilteredResult(_0x591096,_0x4810c4,'getVoiceQueuesReport'))[_0xe3dd('0x43')](handleError(_0x591096,null,_0xe3dd('0x4c')));}; \ No newline at end of file +var _0xe7f8=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','findAll','show','include','options','find','catch','create','body','params','describe','getVoiceQueuesReport','order','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','end','status','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x50e691,_0xb55f7d){var _0x47a4a0=function(_0x449335){while(--_0x449335){_0x50e691['push'](_0x50e691['shift']());}};_0x47a4a0(++_0xb55f7d);}(_0xe7f8,0x67));var _0x8e7f=function(_0x43b34c,_0x8e3b7c){_0x43b34c=_0x43b34c-0x0;var _0x3d1511=_0xe7f8[_0x43b34c];return _0x3d1511;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8e7f('0x0'));var jsonpatch=require(_0x8e7f('0x1'));var rp=require(_0x8e7f('0x2'));var moment=require(_0x8e7f('0x3'));var BPromise=require(_0x8e7f('0x4'));var Mustache=require(_0x8e7f('0x5'));var util=require('util');var path=require(_0x8e7f('0x6'));var sox=require(_0x8e7f('0x7'));var csv=require(_0x8e7f('0x8'));var ejs=require(_0x8e7f('0x9'));var fs=require('fs');var fs_extra=require(_0x8e7f('0xa'));var _=require(_0x8e7f('0xb'));var squel=require('squel');var crypto=require(_0x8e7f('0xc'));var jsforce=require(_0x8e7f('0xd'));var deskjs=require(_0x8e7f('0xe'));var toCsv=require(_0x8e7f('0x8'));var querystring=require('querystring');var Papa=require(_0x8e7f('0xf'));var Redis=require(_0x8e7f('0x10'));var authService=require(_0x8e7f('0x11'));var qs=require(_0x8e7f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e7f('0x13'));var logger=require('../../config/logger')(_0x8e7f('0x14'));var utils=require(_0x8e7f('0x15'));var config=require(_0x8e7f('0x16'));var licenseUtil=require(_0x8e7f('0x17'));var db=require(_0x8e7f('0x18'))['db'];config[_0x8e7f('0x19')]=_[_0x8e7f('0x1a')](config[_0x8e7f('0x19')],{'host':_0x8e7f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e7f('0x19')]));require(_0x8e7f('0x1c'))[_0x8e7f('0x1d')](socket);function respondWithStatusCode(_0x433cae,_0x2509f9){_0x2509f9=_0x2509f9||0xcc;return function(_0x4fe847){if(_0x4fe847){return _0x433cae[_0x8e7f('0x1e')](_0x2509f9);}return _0x433cae['status'](_0x2509f9)[_0x8e7f('0x1f')]();};}function respondWithResult(_0x211b51,_0xaef791){_0xaef791=_0xaef791||0xc8;return function(_0x6d45aa){if(_0x6d45aa){return _0x211b51[_0x8e7f('0x20')](_0xaef791)['json'](_0x6d45aa);}};}function respondWithFilteredResult(_0x344016,_0x39aa69){return function(_0x2e809b){if(_0x2e809b){var _0x376ee2=typeof _0x39aa69['offset']===_0x8e7f('0x21')&&typeof _0x39aa69[_0x8e7f('0x22')]===_0x8e7f('0x21');var _0x14b25f=_0x2e809b[_0x8e7f('0x23')];var _0x341d36=_0x376ee2?0x0:_0x39aa69[_0x8e7f('0x24')];var _0x28a565=_0x376ee2?_0x2e809b[_0x8e7f('0x23')]:_0x39aa69['offset']+_0x39aa69[_0x8e7f('0x22')];var _0x1125f6;if(_0x28a565>=_0x14b25f){_0x28a565=_0x14b25f;_0x1125f6=0xc8;}else{_0x1125f6=0xce;}_0x344016['status'](_0x1125f6);return _0x344016[_0x8e7f('0x25')]('Content-Range',_0x341d36+'-'+_0x28a565+'/'+_0x14b25f)['json'](_0x2e809b);}return null;};}function patchUpdates(_0x408535){return function(_0x658f33){try{jsonpatch[_0x8e7f('0x26')](_0x658f33,_0x408535,!![]);}catch(_0x497127){return BPromise[_0x8e7f('0x27')](_0x497127);}return _0x658f33[_0x8e7f('0x28')]();};}function saveUpdates(_0x32882b,_0x59eabf){return function(_0x3d9a23){if(_0x3d9a23){return _0x3d9a23[_0x8e7f('0x29')](_0x32882b)[_0x8e7f('0x2a')](function(_0x4a95d3){return _0x4a95d3;});}return null;};}function removeEntity(_0x3fe70e,_0x3c1e48){return function(_0x1e3245){if(_0x1e3245){return _0x1e3245[_0x8e7f('0x2b')]()['then'](function(){_0x3fe70e[_0x8e7f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37efad,_0x2dfe94){return function(_0x1404db){if(!_0x1404db){_0x37efad['sendStatus'](0x194);}return _0x1404db;};}function handleError(_0x42685b,_0x4d63d8){_0x4d63d8=_0x4d63d8||0x1f4;return function(_0x330ceb){logger[_0x8e7f('0x2c')](_0x330ceb[_0x8e7f('0x2d')]);if(_0x330ceb[_0x8e7f('0x2e')]){delete _0x330ceb['name'];}_0x42685b[_0x8e7f('0x20')](_0x4d63d8)[_0x8e7f('0x2f')](_0x330ceb);};}exports[_0x8e7f('0x30')]=function(_0x569d32,_0x983f9d){var _0x2ef6cd={},_0x39d988={},_0x332e5c={'count':0x0,'rows':[]};var _0x2c2037=_[_0x8e7f('0x31')](db[_0x8e7f('0x32')][_0x8e7f('0x33')],function(_0x4f7613){return{'name':_0x4f7613[_0x8e7f('0x34')],'type':_0x4f7613[_0x8e7f('0x35')][_0x8e7f('0x36')]};});_0x39d988[_0x8e7f('0x37')]=_[_0x8e7f('0x31')](_0x2c2037,_0x8e7f('0x2e'));_0x39d988[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x569d32[_0x8e7f('0x38')]);_0x39d988[_0x8e7f('0x3a')]=_[_0x8e7f('0x3b')](_0x39d988[_0x8e7f('0x37')],_0x39d988[_0x8e7f('0x38')]);_0x2ef6cd[_0x8e7f('0x3c')]=_[_0x8e7f('0x3b')](_0x39d988[_0x8e7f('0x37')],qs[_0x8e7f('0x3d')](_0x569d32[_0x8e7f('0x38')]['fields']));_0x2ef6cd[_0x8e7f('0x3c')]=_0x2ef6cd['attributes'][_0x8e7f('0x3e')]?_0x2ef6cd[_0x8e7f('0x3c')]:_0x39d988[_0x8e7f('0x37')];if(!_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x3f')](_0x8e7f('0x40'))){_0x2ef6cd[_0x8e7f('0x22')]=qs[_0x8e7f('0x22')](_0x569d32[_0x8e7f('0x38')]['limit']);_0x2ef6cd[_0x8e7f('0x24')]=qs['offset'](_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x24')]);}_0x2ef6cd['order']=qs[_0x8e7f('0x41')](_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x41')]);_0x2ef6cd[_0x8e7f('0x42')]=qs[_0x8e7f('0x3a')](_[_0x8e7f('0x43')](_0x569d32[_0x8e7f('0x38')],_0x39d988[_0x8e7f('0x3a')]),_0x2c2037);if(_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x44')]){_0x2ef6cd[_0x8e7f('0x42')]=_[_0x8e7f('0x45')](_0x2ef6cd[_0x8e7f('0x42')],{'$or':_[_0x8e7f('0x31')](_0x2c2037,function(_0x391176){if(_0x391176['type']!=='VIRTUAL'){var _0x4e00e1={};_0x4e00e1[_0x391176[_0x8e7f('0x2e')]]={'$like':'%'+_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x44')]+'%'};return _0x4e00e1;}})});}_0x2ef6cd=_[_0x8e7f('0x45')]({},_0x2ef6cd,_0x569d32['options']);var _0x3ba03e={'where':_0x2ef6cd[_0x8e7f('0x42')]};return db[_0x8e7f('0x32')][_0x8e7f('0x23')](_0x3ba03e)[_0x8e7f('0x2a')](function(_0x3ce8b7){_0x332e5c[_0x8e7f('0x23')]=_0x3ce8b7;if(_0x569d32[_0x8e7f('0x38')][_0x8e7f('0x46')]){_0x2ef6cd['include']=[{'all':!![]}];}return db[_0x8e7f('0x32')][_0x8e7f('0x47')](_0x2ef6cd);})[_0x8e7f('0x2a')](function(_0x394cce){_0x332e5c['rows']=_0x394cce;return _0x332e5c;})[_0x8e7f('0x2a')](respondWithFilteredResult(_0x983f9d,_0x2ef6cd))['catch'](handleError(_0x983f9d,null));};exports[_0x8e7f('0x48')]=function(_0x588fc1,_0x3c1369){var _0x4fe35d={'raw':![],'where':{'id':_0x588fc1['params']['id']}},_0x110c72={};_0x110c72[_0x8e7f('0x37')]=_[_0x8e7f('0x39')](db[_0x8e7f('0x32')]['rawAttributes']);_0x110c72[_0x8e7f('0x38')]=_['keys'](_0x588fc1['query']);_0x110c72[_0x8e7f('0x3a')]=_['intersection'](_0x110c72[_0x8e7f('0x37')],_0x110c72[_0x8e7f('0x38')]);_0x4fe35d['attributes']=_['intersection'](_0x110c72[_0x8e7f('0x37')],qs[_0x8e7f('0x3d')](_0x588fc1[_0x8e7f('0x38')][_0x8e7f('0x3d')]));_0x4fe35d[_0x8e7f('0x3c')]=_0x4fe35d[_0x8e7f('0x3c')]['length']?_0x4fe35d[_0x8e7f('0x3c')]:_0x110c72[_0x8e7f('0x37')];if(_0x588fc1[_0x8e7f('0x38')][_0x8e7f('0x46')]){_0x4fe35d[_0x8e7f('0x49')]=[{'all':!![]}];}_0x4fe35d=_[_0x8e7f('0x45')]({},_0x4fe35d,_0x588fc1[_0x8e7f('0x4a')]);return db['VoiceQueueReport'][_0x8e7f('0x4b')](_0x4fe35d)[_0x8e7f('0x2a')](handleEntityNotFound(_0x3c1369,null))[_0x8e7f('0x2a')](respondWithResult(_0x3c1369,null))[_0x8e7f('0x4c')](handleError(_0x3c1369,null));};exports['create']=function(_0x460962,_0x2e58f4){return db[_0x8e7f('0x32')][_0x8e7f('0x4d')](_0x460962[_0x8e7f('0x4e')],{})[_0x8e7f('0x2a')](respondWithResult(_0x2e58f4,0xc9))[_0x8e7f('0x4c')](handleError(_0x2e58f4,null));};exports[_0x8e7f('0x29')]=function(_0x3f4864,_0x2c7d85){if(_0x3f4864[_0x8e7f('0x4e')]['id']){delete _0x3f4864[_0x8e7f('0x4e')]['id'];}return db['VoiceQueueReport'][_0x8e7f('0x4b')]({'where':{'id':_0x3f4864[_0x8e7f('0x4f')]['id']}})[_0x8e7f('0x2a')](handleEntityNotFound(_0x2c7d85,null))[_0x8e7f('0x2a')](saveUpdates(_0x3f4864['body'],null))[_0x8e7f('0x2a')](respondWithResult(_0x2c7d85,null))[_0x8e7f('0x4c')](handleError(_0x2c7d85,null));};exports[_0x8e7f('0x2b')]=function(_0x3945e7,_0x26e5bb){return db['VoiceQueueReport'][_0x8e7f('0x4b')]({'where':{'id':_0x3945e7[_0x8e7f('0x4f')]['id']}})[_0x8e7f('0x2a')](handleEntityNotFound(_0x26e5bb,null))[_0x8e7f('0x2a')](removeEntity(_0x26e5bb,null))[_0x8e7f('0x4c')](handleError(_0x26e5bb,null));};exports[_0x8e7f('0x50')]=function(_0x501687,_0x504ce1){return db[_0x8e7f('0x32')][_0x8e7f('0x50')]()[_0x8e7f('0x2a')](respondWithResult(_0x504ce1,null))[_0x8e7f('0x4c')](handleError(_0x504ce1,null));};exports[_0x8e7f('0x51')]=function(_0x3a9f8e,_0x16ef9e){var _0x1379ad={},_0x108220={},_0x34e28a={'count':0x0,'rows':[]};_0x108220[_0x8e7f('0x37')]=_[_0x8e7f('0x39')](db[_0x8e7f('0x32')]['rawAttributes']);_0x108220[_0x8e7f('0x38')]=_[_0x8e7f('0x39')](_0x3a9f8e[_0x8e7f('0x38')]);_0x108220[_0x8e7f('0x3a')]=_['intersection'](_0x108220[_0x8e7f('0x37')],_0x108220[_0x8e7f('0x38')]);_0x1379ad[_0x8e7f('0x3c')]=_[_0x8e7f('0x3b')](_0x108220['model'],qs['fields'](_0x3a9f8e[_0x8e7f('0x38')][_0x8e7f('0x3d')]));_0x1379ad[_0x8e7f('0x3c')]=_0x1379ad['attributes'][_0x8e7f('0x3e')]?_0x1379ad[_0x8e7f('0x3c')]:_0x108220['model'];if(!_0x3a9f8e['query']['hasOwnProperty']('nolimit')){_0x1379ad[_0x8e7f('0x22')]=qs[_0x8e7f('0x22')](_0x3a9f8e[_0x8e7f('0x38')][_0x8e7f('0x22')]);_0x1379ad['offset']=qs[_0x8e7f('0x24')](_0x3a9f8e[_0x8e7f('0x38')][_0x8e7f('0x24')]);}_0x1379ad[_0x8e7f('0x52')]=qs[_0x8e7f('0x41')](_0x3a9f8e[_0x8e7f('0x38')]['sort']);_0x1379ad[_0x8e7f('0x42')]=qs[_0x8e7f('0x3a')](_['pick'](_0x3a9f8e[_0x8e7f('0x38')],_0x108220[_0x8e7f('0x3a')]));if(_0x3a9f8e[_0x8e7f('0x38')]['filter']){_0x1379ad['where']=_[_0x8e7f('0x45')](_0x1379ad[_0x8e7f('0x42')],{'$or':_[_0x8e7f('0x31')](_0x1379ad[_0x8e7f('0x3c')],function(_0x42b005){var _0x2425f9={};_0x2425f9[_0x42b005]={'$like':'%'+_0x3a9f8e[_0x8e7f('0x38')][_0x8e7f('0x44')]+'%'};return _0x2425f9;})});}_0x1379ad=_['merge']({},_0x1379ad,_0x3a9f8e['options']);var _0x5f2e27={'where':_0x1379ad[_0x8e7f('0x42')]};return db[_0x8e7f('0x32')][_0x8e7f('0x23')](_0x5f2e27)['then'](function(_0x72fbe2){_0x34e28a[_0x8e7f('0x23')]=_0x72fbe2;if(_0x3a9f8e[_0x8e7f('0x38')][_0x8e7f('0x46')]){_0x1379ad[_0x8e7f('0x49')]=[{'all':!![]}];}return db[_0x8e7f('0x32')][_0x8e7f('0x47')](_0x1379ad);})[_0x8e7f('0x2a')](function(_0x11a278){_0x34e28a['rows']=_0x11a278;return _0x34e28a;})[_0x8e7f('0x2a')](respondWithFilteredResult(_0x16ef9e,_0x1379ad,_0x8e7f('0x51')))[_0x8e7f('0x4c')](handleError(_0x16ef9e,null,_0x8e7f('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 359ba6d..4fae8b7 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 _0xe2ab=['save','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceQueueReport','setMaxListeners'];(function(_0x12c34e,_0x39287a){var _0x244e88=function(_0x34507b){while(--_0x34507b){_0x12c34e['push'](_0x12c34e['shift']());}};_0x244e88(++_0x39287a);}(_0xe2ab,0x9d));var _0xbe2a=function(_0x2324fb,_0x246bd1){_0x2324fb=_0x2324fb-0x0;var _0x423796=_0xe2ab[_0x2324fb];return _0x423796;};'use strict';var EventEmitter=require(_0xbe2a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xbe2a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbe2a('0x2')](0x0);var events={'afterCreate':_0xbe2a('0x3'),'afterUpdate':_0xbe2a('0x4'),'afterDestroy':_0xbe2a('0x5')};function emitEvent(_0x61ef2c){return function(_0x4b5382,_0x535bde,_0x2c2a35){VoiceQueueReportEvents[_0xbe2a('0x6')](_0x61ef2c+':'+_0x4b5382['id'],_0x4b5382);VoiceQueueReportEvents[_0xbe2a('0x6')](_0x61ef2c,_0x4b5382);_0x2c2a35(null);};}for(var e in events){if(events[_0xbe2a('0x7')](e)){var event=events[e];VoiceQueueReport[_0xbe2a('0x8')](e,emitEvent(event));}}module[_0xbe2a('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xcdd1=['hook','exports','events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0xcdd1,0x1a6));var _0x1cdd=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xcdd1[_0x4bf96c];return _0x281d09;};'use strict';var EventEmitter=require(_0x1cdd('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x1cdd('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1cdd('0x2')](0x0);var events={'afterCreate':_0x1cdd('0x3'),'afterUpdate':_0x1cdd('0x4'),'afterDestroy':_0x1cdd('0x5')};function emitEvent(_0x45a32){return function(_0x179751,_0x9a69e8,_0x45dfe7){VoiceQueueReportEvents[_0x1cdd('0x6')](_0x45a32+':'+_0x179751['id'],_0x179751);VoiceQueueReportEvents[_0x1cdd('0x6')](_0x45a32,_0x179751);_0x45dfe7(null);};}for(var e in events){if(events[_0x1cdd('0x7')](e)){var event=events[e];VoiceQueueReport[_0x1cdd('0x8')](e,emitEvent(event));}}module[_0x1cdd('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 52a1ddb..7c9920b 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 _0x1333=['uniqueid','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue'];(function(_0x564e23,_0x5d1239){var _0x1d1420=function(_0x204d13){while(--_0x204d13){_0x564e23['push'](_0x564e23['shift']());}};_0x1d1420(++_0x5d1239);}(_0x1333,0x98));var _0x3133=function(_0x316466,_0x4b3a03){_0x316466=_0x316466-0x0;var _0x1fc09d=_0x1333[_0x316466];return _0x1fc09d;};'use strict';var _=require('lodash');var util=require(_0x3133('0x0'));var logger=require(_0x3133('0x1'))(_0x3133('0x2'));var moment=require(_0x3133('0x3'));var BPromise=require(_0x3133('0x4'));var rp=require(_0x3133('0x5'));var fs=require('fs');var path=require(_0x3133('0x6'));var rimraf=require('rimraf');var config=require(_0x3133('0x7'));var attributes=require(_0x3133('0x8'));module[_0x3133('0x9')]=function(_0x245947,_0x3d777e){return _0x245947[_0x3133('0xa')](_0x3133('0xb'),attributes,{'tableName':_0x3133('0xc'),'paranoid':![],'indexes':[{'fields':[_0x3133('0xd')]},{'fields':[_0x3133('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b0e=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','util'];(function(_0x2090fe,_0x17ad3f){var _0x14413b=function(_0xa416d8){while(--_0xa416d8){_0x2090fe['push'](_0x2090fe['shift']());}};_0x14413b(++_0x17ad3f);}(_0x8b0e,0xb5));var _0xe8b0=function(_0x56ee15,_0x1effd1){_0x56ee15=_0x56ee15-0x0;var _0x94991f=_0x8b0e[_0x56ee15];return _0x94991f;};'use strict';var _=require('lodash');var util=require(_0xe8b0('0x0'));var logger=require(_0xe8b0('0x1'))(_0xe8b0('0x2'));var moment=require('moment');var BPromise=require(_0xe8b0('0x3'));var rp=require(_0xe8b0('0x4'));var fs=require('fs');var path=require(_0xe8b0('0x5'));var rimraf=require(_0xe8b0('0x6'));var config=require(_0xe8b0('0x7'));var attributes=require(_0xe8b0('0x8'));module[_0xe8b0('0x9')]=function(_0x2d08f6,_0x43a2a2){return _0x2d08f6[_0xe8b0('0xa')](_0xe8b0('0xb'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe8b0('0xc')]},{'fields':[_0xe8b0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index fab80f2..c7f21ff 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 _0x30a3=['register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','limit','include','model','map','debug','CreateVoiceQueueReport','create','body','raw','update','UpdateVoiceQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x30a3,0x113));var _0x330a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x30a3[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x330a('0x0'));var util=require(_0x330a('0x1'));var moment=require('moment');var BPromise=require(_0x330a('0x2'));var rs=require(_0x330a('0x3'));var fs=require('fs');var Redis=require(_0x330a('0x4'));var db=require(_0x330a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x330a('0x6'));var config=require(_0x330a('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x330a('0x8')]=_[_0x330a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x330a('0xa'))(new Redis(config['redis']));require(_0x330a('0xb'))[_0x330a('0xc')](socket);function respondWithRpcPromise(_0x4da477,_0x593c35,_0x5b9164){return new BPromise(function(_0x3506a9,_0x10a192){return client[_0x330a('0xd')](_0x4da477,_0x5b9164)[_0x330a('0xe')](function(_0x383434){logger[_0x330a('0xf')](_0x330a('0x10'),_0x593c35,_0x330a('0x11'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x593c35,_0x330a('0x11'),JSON[_0x330a('0x12')](_0x383434));if(_0x383434[_0x330a('0x13')]){if(_0x383434[_0x330a('0x13')][_0x330a('0x14')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x593c35,_0x383434[_0x330a('0x13')]['message']);return _0x10a192(_0x383434['error'][_0x330a('0x15')]);}logger[_0x330a('0x13')](_0x330a('0x10'),_0x593c35,_0x383434[_0x330a('0x13')]['message']);return _0x3506a9(_0x383434['error'][_0x330a('0x15')]);}else{logger[_0x330a('0xf')](_0x330a('0x10'),_0x593c35,_0x330a('0x11'));_0x3506a9(_0x383434[_0x330a('0x16')][_0x330a('0x15')]);}})[_0x330a('0x17')](function(_0x301fe6){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x593c35,_0x301fe6);_0x10a192(_0x301fe6);});});}exports[_0x330a('0x18')]=function(_0x3103c2){var _0x15e1fa=this;return new Promise(function(_0x48c53e,_0x3ae624){return db[_0x330a('0x19')][_0x330a('0x1a')]({'raw':_0x3103c2['options']?_0x3103c2[_0x330a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3103c2[_0x330a('0x1b')]?_0x3103c2[_0x330a('0x1b')][_0x330a('0x1c')]||null:null,'attributes':_0x3103c2['options']?_0x3103c2['options'][_0x330a('0x1d')]||null:null,'limit':_0x3103c2['options']?_0x3103c2[_0x330a('0x1b')][_0x330a('0x1e')]||null:null,'include':_0x3103c2[_0x330a('0x1b')]?_0x3103c2['options'][_0x330a('0x1f')]?_['map'](_0x3103c2[_0x330a('0x1b')][_0x330a('0x1f')],function(_0x533f3c){return{'model':db[_0x533f3c[_0x330a('0x20')]],'as':_0x533f3c['as'],'attributes':_0x533f3c[_0x330a('0x1d')],'include':_0x533f3c[_0x330a('0x1f')]?_['map'](_0x533f3c[_0x330a('0x1f')],function(_0x13af48){return{'model':db[_0x13af48[_0x330a('0x20')]],'as':_0x13af48['as'],'attributes':_0x13af48[_0x330a('0x1d')],'include':_0x13af48['include']?_[_0x330a('0x21')](_0x13af48[_0x330a('0x1f')],function(_0x49de71){return{'model':db[_0x49de71['model']],'as':_0x49de71['as'],'attributes':_0x49de71[_0x330a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b4f15){logger[_0x330a('0xf')](_0x330a('0x18'),_0x3103c2);logger[_0x330a('0x22')](_0x330a('0x18'),_0x3103c2,JSON['stringify'](_0x2b4f15));_0x48c53e(_0x2b4f15);})[_0x330a('0x17')](function(_0x13cf25){logger[_0x330a('0x13')](_0x330a('0x18'),_0x13cf25[_0x330a('0x15')],_0x3103c2);_0x3ae624(_0x15e1fa[_0x330a('0x13')](0x1f4,_0x13cf25[_0x330a('0x15')]));});});};exports[_0x330a('0x23')]=function(_0x3ce708){var _0x1a2f11=this;return new Promise(function(_0x4e9b0f,_0x16573a){return db[_0x330a('0x19')][_0x330a('0x24')](_0x3ce708[_0x330a('0x25')],{'raw':_0x3ce708[_0x330a('0x1b')]?_0x3ce708[_0x330a('0x1b')][_0x330a('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0xebe6dc){logger[_0x330a('0xf')]('CreateVoiceQueueReport',_0x3ce708);logger['debug'](_0x330a('0x23'),_0x3ce708,JSON[_0x330a('0x12')](_0xebe6dc));_0x4e9b0f(_0xebe6dc);})[_0x330a('0x17')](function(_0xad5e78){logger['error'](_0x330a('0x23'),_0xad5e78['message'],_0x3ce708);_0x16573a(_0x1a2f11[_0x330a('0x13')](0x1f4,_0xad5e78['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x1036f6){var _0x15c9ee=this;return new Promise(function(_0x251c24,_0x1651b9){return db[_0x330a('0x19')][_0x330a('0x27')](_0x1036f6['body'],{'raw':_0x1036f6['options']?_0x1036f6[_0x330a('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1036f6[_0x330a('0x1b')]?_0x1036f6[_0x330a('0x1b')][_0x330a('0x1c')]||null:null,'attributes':_0x1036f6[_0x330a('0x1b')]?_0x1036f6[_0x330a('0x1b')]['attributes']||null:null,'limit':_0x1036f6['options']?_0x1036f6[_0x330a('0x1b')][_0x330a('0x1e')]||null:null})[_0x330a('0xe')](function(_0x358b48){logger[_0x330a('0xf')]('UpdateVoiceQueueReport',_0x1036f6);logger[_0x330a('0x22')](_0x330a('0x28'),_0x1036f6,JSON[_0x330a('0x12')](_0x358b48));_0x251c24(_0x358b48);})['catch'](function(_0x31fdfc){logger[_0x330a('0x13')](_0x330a('0x28'),_0x31fdfc[_0x330a('0x15')],_0x1036f6);_0x1651b9(_0x15c9ee[_0x330a('0x13')](0x1f4,_0x31fdfc[_0x330a('0x15')]));});});}; \ No newline at end of file +var _0x970f=['socket.io-emitter','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','debug','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0x970f,0x11a));var _0xf970=function(_0x3c6166,_0x51a9fe){_0x3c6166=_0x3c6166-0x0;var _0x215b27=_0x970f[_0x3c6166];return _0x215b27;};'use strict';var _=require('lodash');var util=require(_0xf970('0x0'));var moment=require(_0xf970('0x1'));var BPromise=require(_0xf970('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf970('0x3'));var logger=require(_0xf970('0x4'))('rpc');var config=require(_0xf970('0x5'));var jayson=require(_0xf970('0x6'));var client=jayson[_0xf970('0x7')][_0xf970('0x8')]({'port':0x232a});config['redis']=_[_0xf970('0x9')](config[_0xf970('0xa')],{'host':_0xf970('0xb'),'port':0x18eb});var socket=require(_0xf970('0xc'))(new Redis(config[_0xf970('0xa')]));require('./voiceQueueReport.socket')[_0xf970('0xd')](socket);function respondWithRpcPromise(_0x2602ad,_0x1a1b46,_0xe28df3){return new BPromise(function(_0x34ad4c,_0x512cee){return client['request'](_0x2602ad,_0xe28df3)[_0xf970('0xe')](function(_0x1352c5){logger[_0xf970('0xf')](_0xf970('0x10'),_0x1a1b46,_0xf970('0x11'));logger['debug'](_0xf970('0x12'),_0x1a1b46,_0xf970('0x11'),JSON[_0xf970('0x13')](_0x1352c5));if(_0x1352c5['error']){if(_0x1352c5[_0xf970('0x14')][_0xf970('0x15')]===0x1f4){logger[_0xf970('0x14')](_0xf970('0x10'),_0x1a1b46,_0x1352c5[_0xf970('0x14')][_0xf970('0x16')]);return _0x512cee(_0x1352c5['error'][_0xf970('0x16')]);}logger[_0xf970('0x14')](_0xf970('0x10'),_0x1a1b46,_0x1352c5[_0xf970('0x14')]['message']);return _0x34ad4c(_0x1352c5[_0xf970('0x14')][_0xf970('0x16')]);}else{logger['info'](_0xf970('0x10'),_0x1a1b46,'request\x20sent');_0x34ad4c(_0x1352c5[_0xf970('0x17')][_0xf970('0x16')]);}})[_0xf970('0x18')](function(_0x2b9af0){logger[_0xf970('0x14')](_0xf970('0x10'),_0x1a1b46,_0x2b9af0);_0x512cee(_0x2b9af0);});});}exports[_0xf970('0x19')]=function(_0x3c86d5){var _0x33eebe=this;return new Promise(function(_0x33d6b7,_0x1e3ef3){return db[_0xf970('0x1a')][_0xf970('0x1b')]({'raw':_0x3c86d5[_0xf970('0x1c')]?_0x3c86d5[_0xf970('0x1c')][_0xf970('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c86d5[_0xf970('0x1c')]?_0x3c86d5['options'][_0xf970('0x1e')]||null:null,'attributes':_0x3c86d5[_0xf970('0x1c')]?_0x3c86d5['options'][_0xf970('0x1f')]||null:null,'limit':_0x3c86d5[_0xf970('0x1c')]?_0x3c86d5['options'][_0xf970('0x20')]||null:null,'include':_0x3c86d5[_0xf970('0x1c')]?_0x3c86d5['options'][_0xf970('0x21')]?_['map'](_0x3c86d5[_0xf970('0x1c')]['include'],function(_0x212bbf){return{'model':db[_0x212bbf['model']],'as':_0x212bbf['as'],'attributes':_0x212bbf[_0xf970('0x1f')],'include':_0x212bbf[_0xf970('0x21')]?_[_0xf970('0x22')](_0x212bbf['include'],function(_0xb08d87){return{'model':db[_0xb08d87[_0xf970('0x23')]],'as':_0xb08d87['as'],'attributes':_0xb08d87[_0xf970('0x1f')],'include':_0xb08d87['include']?_[_0xf970('0x22')](_0xb08d87[_0xf970('0x21')],function(_0x25dfb1){return{'model':db[_0x25dfb1[_0xf970('0x23')]],'as':_0x25dfb1['as'],'attributes':_0x25dfb1[_0xf970('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf970('0xe')](function(_0x5c6cd5){logger[_0xf970('0xf')](_0xf970('0x19'),_0x3c86d5);logger['debug'](_0xf970('0x19'),_0x3c86d5,JSON['stringify'](_0x5c6cd5));_0x33d6b7(_0x5c6cd5);})[_0xf970('0x18')](function(_0x2c60fa){logger[_0xf970('0x14')](_0xf970('0x19'),_0x2c60fa[_0xf970('0x16')],_0x3c86d5);_0x1e3ef3(_0x33eebe[_0xf970('0x14')](0x1f4,_0x2c60fa[_0xf970('0x16')]));});});};exports[_0xf970('0x24')]=function(_0x2ca3d1){var _0x39f474=this;return new Promise(function(_0x335e26,_0x3b4f41){return db[_0xf970('0x1a')][_0xf970('0x25')](_0x2ca3d1[_0xf970('0x26')],{'raw':_0x2ca3d1[_0xf970('0x1c')]?_0x2ca3d1[_0xf970('0x1c')][_0xf970('0x1d')]===undefined?!![]:![]:!![]})[_0xf970('0xe')](function(_0x3b442f){logger['info'](_0xf970('0x24'),_0x2ca3d1);logger['debug'](_0xf970('0x24'),_0x2ca3d1,JSON['stringify'](_0x3b442f));_0x335e26(_0x3b442f);})[_0xf970('0x18')](function(_0x3ef197){logger['error']('CreateVoiceQueueReport',_0x3ef197[_0xf970('0x16')],_0x2ca3d1);_0x3b4f41(_0x39f474[_0xf970('0x14')](0x1f4,_0x3ef197['message']));});});};exports[_0xf970('0x27')]=function(_0x47420c){var _0x2bcc33=this;return new Promise(function(_0x5db85d,_0x24b277){return db[_0xf970('0x1a')][_0xf970('0x28')](_0x47420c[_0xf970('0x26')],{'raw':_0x47420c['options']?_0x47420c[_0xf970('0x1c')][_0xf970('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47420c[_0xf970('0x1c')]?_0x47420c[_0xf970('0x1c')][_0xf970('0x1e')]||null:null,'attributes':_0x47420c['options']?_0x47420c['options'][_0xf970('0x1f')]||null:null,'limit':_0x47420c[_0xf970('0x1c')]?_0x47420c[_0xf970('0x1c')]['limit']||null:null})[_0xf970('0xe')](function(_0x2ad0ba){logger[_0xf970('0xf')](_0xf970('0x27'),_0x47420c);logger[_0xf970('0x29')](_0xf970('0x27'),_0x47420c,JSON[_0xf970('0x13')](_0x2ad0ba));_0x5db85d(_0x2ad0ba);})[_0xf970('0x18')](function(_0x50cba8){logger[_0xf970('0x14')]('UpdateVoiceQueueReport',_0x50cba8['message'],_0x47420c);_0x24b277(_0x2bcc33[_0xf970('0x14')](0x1f4,_0x50cba8[_0xf970('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ce14b5a..ddab088 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 _0x6e12=['emit','removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x5aef24,_0x2eaa28){var _0x2cc824=function(_0x368718){while(--_0x368718){_0x5aef24['push'](_0x5aef24['shift']());}};_0x2cc824(++_0x2eaa28);}(_0x6e12,0x154));var _0x26e1=function(_0x4c8218,_0x1d70f0){_0x4c8218=_0x4c8218-0x0;var _0x218d2a=_0x6e12[_0x4c8218];return _0x218d2a;};'use strict';var VoiceQueueReportEvents=require(_0x26e1('0x0'));var events=[_0x26e1('0x1'),_0x26e1('0x2'),_0x26e1('0x3')];function createListener(_0x5f2f9c,_0x5dfba5){return function(_0x374765){_0x5dfba5[_0x26e1('0x4')](_0x5f2f9c,_0x374765);};}function removeListener(_0x47f8ce,_0x4f55d8){return function(){VoiceQueueReportEvents[_0x26e1('0x5')](_0x47f8ce,_0x4f55d8);};}exports[_0x26e1('0x6')]=function(_0x18467c){for(var _0x2073c9=0x0,_0xb8941a=events['length'];_0x2073c9<_0xb8941a;_0x2073c9++){var _0x3d543a=events[_0x2073c9];var _0x3e594f=createListener(_0x26e1('0x7')+_0x3d543a,_0x18467c);VoiceQueueReportEvents['on'](_0x3d543a,_0x3e594f);}}; \ No newline at end of file +var _0xbcba=['length','./voiceQueueReport.events','save','update','emit','register'];(function(_0x33886d,_0x154dfd){var _0x4df380=function(_0x444083){while(--_0x444083){_0x33886d['push'](_0x33886d['shift']());}};_0x4df380(++_0x154dfd);}(_0xbcba,0x6d));var _0xabcb=function(_0xde3102,_0x163f8a){_0xde3102=_0xde3102-0x0;var _0x2190aa=_0xbcba[_0xde3102];return _0x2190aa;};'use strict';var VoiceQueueReportEvents=require(_0xabcb('0x0'));var events=[_0xabcb('0x1'),'remove',_0xabcb('0x2')];function createListener(_0x2c9ee7,_0x2034d2){return function(_0xcbe337){_0x2034d2[_0xabcb('0x3')](_0x2c9ee7,_0xcbe337);};}function removeListener(_0x3e3b9b,_0x5e10df){return function(){VoiceQueueReportEvents['removeListener'](_0x3e3b9b,_0x5e10df);};}exports[_0xabcb('0x4')]=function(_0x1290b2){for(var _0x5c706e=0x0,_0x5322e7=events[_0xabcb('0x5')];_0x5c706e<_0x5322e7;_0x5c706e++){var _0x192b36=events[_0x5c706e];var _0x5e693d=createListener('voiceQueueReport:'+_0x192b36,_0x1290b2);VoiceQueueReportEvents['on'](_0x192b36,_0x5e693d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 9ce4430..1de3461 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 _0xcee7=['../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service'];(function(_0x54ed06,_0x38c1b3){var _0x400e12=function(_0x45148b){while(--_0x45148b){_0x54ed06['push'](_0x54ed06['shift']());}};_0x400e12(++_0x38c1b3);}(_0xcee7,0x160));var _0x7cee=function(_0x2d670a,_0x1021b5){_0x2d670a=_0x2d670a-0x0;var _0x4208ce=_0xcee7[_0x2d670a];return _0x4208ce;};'use strict';var multer=require(_0x7cee('0x0'));var util=require(_0x7cee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7cee('0x2')]();var fs_extra=require(_0x7cee('0x3'));var auth=require(_0x7cee('0x4'));var interaction=require(_0x7cee('0x5'));var config=require(_0x7cee('0x6'));var controller=require(_0x7cee('0x7'));router[_0x7cee('0x8')]('/',auth[_0x7cee('0x9')](),controller['index']);router['get'](_0x7cee('0xa'),auth[_0x7cee('0x9')](),controller[_0x7cee('0xb')]);router[_0x7cee('0xc')]('/',auth[_0x7cee('0x9')](),controller[_0x7cee('0xd')]);router['put'](_0x7cee('0xa'),auth[_0x7cee('0x9')](),controller['update']);router[_0x7cee('0xe')]('/:id',auth[_0x7cee('0x9')](),controller[_0x7cee('0xf')]);module[_0x7cee('0x10')]=router; \ No newline at end of file +var _0xa98d=['../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','create','put','delete','destroy','multer','util','path','connect-timeout','fs-extra'];(function(_0x10956e,_0x76475){var _0x7e6b93=function(_0x303d80){while(--_0x303d80){_0x10956e['push'](_0x10956e['shift']());}};_0x7e6b93(++_0x76475);}(_0xa98d,0x171));var _0xda98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa98d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var path=require(_0xda98('0x2'));var timeout=require(_0xda98('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xda98('0x4'));var auth=require(_0xda98('0x5'));var interaction=require(_0xda98('0x6'));var config=require('../../config/environment');var controller=require(_0xda98('0x7'));router[_0xda98('0x8')]('/',auth['isAuthenticated'](),controller[_0xda98('0x9')]);router[_0xda98('0x8')](_0xda98('0xa'),auth[_0xda98('0xb')](),controller[_0xda98('0xc')]);router['post']('/',auth[_0xda98('0xb')](),controller[_0xda98('0xd')]);router[_0xda98('0xe')]('/:id',auth[_0xda98('0xb')](),controller['update']);router[_0xda98('0xf')](_0xda98('0xa'),auth[_0xda98('0xb')](),controller[_0xda98('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 13ec85a..c840916 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 _0xf59f=['moment','exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x58a153,_0x573bf7){var _0x1dd075=function(_0x152551){while(--_0x152551){_0x58a153['push'](_0x58a153['shift']());}};_0x1dd075(++_0x573bf7);}(_0xf59f,0xb4));var _0xff59=function(_0xfd41df,_0x5e2bb1){_0xfd41df=_0xfd41df-0x0;var _0x513064=_0xf59f[_0xfd41df];return _0x513064;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xff59('0x0'));module[_0xff59('0x1')]={'time':{'type':Sequelize[_0xff59('0x2')]},'callid':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xff59('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xff59('0x3')](_0xff59('0x4'))}}; \ No newline at end of file +var _0x913a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports','STRING'];(function(_0x99259f,_0x4512e0){var _0x561c66=function(_0x45c7de){while(--_0x45c7de){_0x99259f['push'](_0x99259f['shift']());}};_0x561c66(++_0x4512e0);}(_0x913a,0xe1));var _0xa913=function(_0x3dcf48,_0x2d1fb5){_0x3dcf48=_0x3dcf48-0x0;var _0x3ed1d1=_0x913a[_0x3dcf48];return _0x3ed1d1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa913('0x0'));module[_0xa913('0x1')]={'time':{'type':Sequelize[_0xa913('0x2')]},'callid':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa913('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa913('0x3')],'allowNull':![],'defaultValue':moment()[_0xa913('0x4')](_0xa913('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index c88fa27..39cb541 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 _0x79cb=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x79cb,0x1c1));var _0xb79c=function(_0x321b3e,_0x4f1b2d){_0x321b3e=_0x321b3e-0x0;var _0x444a0a=_0x79cb[_0x321b3e];return _0x444a0a;};'use strict';var emlformat=require(_0xb79c('0x0'));var rimraf=require(_0xb79c('0x1'));var zipdir=require(_0xb79c('0x2'));var jsonpatch=require(_0xb79c('0x3'));var rp=require(_0xb79c('0x4'));var moment=require('moment');var BPromise=require(_0xb79c('0x5'));var Mustache=require(_0xb79c('0x6'));var util=require(_0xb79c('0x7'));var path=require(_0xb79c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb79c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb79c('0xa'));var jsforce=require(_0xb79c('0xb'));var deskjs=require(_0xb79c('0xc'));var toCsv=require(_0xb79c('0xd'));var querystring=require(_0xb79c('0xe'));var Papa=require(_0xb79c('0xf'));var Redis=require(_0xb79c('0x10'));var authService=require(_0xb79c('0x11'));var qs=require(_0xb79c('0x12'));var as=require(_0xb79c('0x13'));var hardwareService=require(_0xb79c('0x14'));var logger=require(_0xb79c('0x15'))('api');var utils=require(_0xb79c('0x16'));var config=require(_0xb79c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb79c('0x18'))['db'];function respondWithStatusCode(_0x249599,_0x1852d7){_0x1852d7=_0x1852d7||0xcc;return function(_0x275a14){if(_0x275a14){return _0x249599[_0xb79c('0x19')](_0x1852d7);}return _0x249599[_0xb79c('0x1a')](_0x1852d7)[_0xb79c('0x1b')]();};}function respondWithResult(_0x160f2a,_0xbe8ee8){_0xbe8ee8=_0xbe8ee8||0xc8;return function(_0x3660ff){if(_0x3660ff){return _0x160f2a[_0xb79c('0x1a')](_0xbe8ee8)['json'](_0x3660ff);}};}function respondWithFilteredResult(_0x483d8e,_0x3234cc){return function(_0x478e45){if(_0x478e45){var _0xebd5f9=typeof _0x3234cc['offset']===_0xb79c('0x1c')&&typeof _0x3234cc['limit']===_0xb79c('0x1c');var _0x1aa945=_0x478e45[_0xb79c('0x1d')];var _0x31bb5f=_0xebd5f9?0x0:_0x3234cc[_0xb79c('0x1e')];var _0x352d23=_0xebd5f9?_0x478e45[_0xb79c('0x1d')]:_0x3234cc[_0xb79c('0x1e')]+_0x3234cc[_0xb79c('0x1f')];var _0x9c209e;if(_0x352d23>=_0x1aa945){_0x352d23=_0x1aa945;_0x9c209e=0xc8;}else{_0x9c209e=0xce;}_0x483d8e['status'](_0x9c209e);return _0x483d8e[_0xb79c('0x20')]('Content-Range',_0x31bb5f+'-'+_0x352d23+'/'+_0x1aa945)[_0xb79c('0x21')](_0x478e45);}return null;};}function patchUpdates(_0x2c7c88){return function(_0x77bd0b){try{jsonpatch['apply'](_0x77bd0b,_0x2c7c88,!![]);}catch(_0x1b3a7b){return BPromise[_0xb79c('0x22')](_0x1b3a7b);}return _0x77bd0b[_0xb79c('0x23')]();};}function saveUpdates(_0x59a941,_0x4df146){return function(_0x504a40){if(_0x504a40){return _0x504a40[_0xb79c('0x24')](_0x59a941)[_0xb79c('0x25')](function(_0xe91308){return _0xe91308;});}return null;};}function removeEntity(_0x22fa9f,_0x55e444){return function(_0x4e2b83){if(_0x4e2b83){return _0x4e2b83[_0xb79c('0x26')]()[_0xb79c('0x25')](function(){_0x22fa9f[_0xb79c('0x1a')](0xcc)[_0xb79c('0x1b')]();});}};}function handleEntityNotFound(_0x2d9a0d,_0x27055a){return function(_0x2157d4){if(!_0x2157d4){_0x2d9a0d[_0xb79c('0x19')](0x194);}return _0x2157d4;};}function handleError(_0xd255ec,_0x3310c0){_0x3310c0=_0x3310c0||0x1f4;return function(_0x53088d){logger[_0xb79c('0x27')](_0x53088d[_0xb79c('0x28')]);if(_0x53088d['name']){delete _0x53088d[_0xb79c('0x29')];}_0xd255ec[_0xb79c('0x1a')](_0x3310c0)['send'](_0x53088d);};}exports[_0xb79c('0x2a')]=function(_0x1581c8,_0x170a29){var _0x46247a={},_0x4a362a={},_0x19d690={'count':0x0,'rows':[]};var _0x46d831=_[_0xb79c('0x2b')](db[_0xb79c('0x2c')]['rawAttributes'],function(_0x460cc5){return{'name':_0x460cc5[_0xb79c('0x2d')],'type':_0x460cc5[_0xb79c('0x2e')]['key']};});_0x4a362a[_0xb79c('0x2f')]=_[_0xb79c('0x2b')](_0x46d831,_0xb79c('0x29'));_0x4a362a[_0xb79c('0x30')]=_[_0xb79c('0x31')](_0x1581c8[_0xb79c('0x30')]);_0x4a362a[_0xb79c('0x32')]=_[_0xb79c('0x33')](_0x4a362a[_0xb79c('0x2f')],_0x4a362a['query']);_0x46247a[_0xb79c('0x34')]=_['intersection'](_0x4a362a[_0xb79c('0x2f')],qs[_0xb79c('0x35')](_0x1581c8['query'][_0xb79c('0x35')]));_0x46247a[_0xb79c('0x34')]=_0x46247a[_0xb79c('0x34')][_0xb79c('0x36')]?_0x46247a[_0xb79c('0x34')]:_0x4a362a['model'];if(!_0x1581c8[_0xb79c('0x30')]['hasOwnProperty'](_0xb79c('0x37'))){_0x46247a[_0xb79c('0x1f')]=qs[_0xb79c('0x1f')](_0x1581c8[_0xb79c('0x30')][_0xb79c('0x1f')]);_0x46247a[_0xb79c('0x1e')]=qs['offset'](_0x1581c8['query'][_0xb79c('0x1e')]);}_0x46247a[_0xb79c('0x38')]=qs[_0xb79c('0x39')](_0x1581c8[_0xb79c('0x30')]['sort']);_0x46247a[_0xb79c('0x3a')]=qs['filters'](_[_0xb79c('0x3b')](_0x1581c8[_0xb79c('0x30')],_0x4a362a[_0xb79c('0x32')]),_0x46d831);if(_0x1581c8[_0xb79c('0x30')][_0xb79c('0x3c')]){_0x46247a['where']=_[_0xb79c('0x3d')](_0x46247a['where'],{'$or':_[_0xb79c('0x2b')](_0x46d831,function(_0x3f89e9){if(_0x3f89e9[_0xb79c('0x2e')]!==_0xb79c('0x3e')){var _0x53c968={};_0x53c968[_0x3f89e9[_0xb79c('0x29')]]={'$like':'%'+_0x1581c8[_0xb79c('0x30')][_0xb79c('0x3c')]+'%'};return _0x53c968;}})});}_0x46247a=_[_0xb79c('0x3d')]({},_0x46247a,_0x1581c8[_0xb79c('0x3f')]);var _0x7bf74d={'where':_0x46247a[_0xb79c('0x3a')]};return db[_0xb79c('0x2c')][_0xb79c('0x1d')](_0x7bf74d)[_0xb79c('0x25')](function(_0x1f5ba4){_0x19d690[_0xb79c('0x1d')]=_0x1f5ba4;if(_0x1581c8[_0xb79c('0x30')][_0xb79c('0x40')]){_0x46247a[_0xb79c('0x41')]=[{'all':!![]}];}return db[_0xb79c('0x2c')]['findAll'](_0x46247a);})[_0xb79c('0x25')](function(_0x50284f){_0x19d690[_0xb79c('0x42')]=_0x50284f;return _0x19d690;})[_0xb79c('0x25')](respondWithFilteredResult(_0x170a29,_0x46247a))[_0xb79c('0x43')](handleError(_0x170a29,null));};exports['show']=function(_0x1e686f,_0x290cfd){var _0x3908ef={'raw':!![],'where':{'id':_0x1e686f[_0xb79c('0x44')]['id']}},_0x36bca3={};_0x36bca3[_0xb79c('0x2f')]=_[_0xb79c('0x31')](db[_0xb79c('0x2c')]['rawAttributes']);_0x36bca3['query']=_['keys'](_0x1e686f[_0xb79c('0x30')]);_0x36bca3['filters']=_['intersection'](_0x36bca3[_0xb79c('0x2f')],_0x36bca3[_0xb79c('0x30')]);_0x3908ef['attributes']=_[_0xb79c('0x33')](_0x36bca3[_0xb79c('0x2f')],qs[_0xb79c('0x35')](_0x1e686f[_0xb79c('0x30')][_0xb79c('0x35')]));_0x3908ef[_0xb79c('0x34')]=_0x3908ef[_0xb79c('0x34')][_0xb79c('0x36')]?_0x3908ef[_0xb79c('0x34')]:_0x36bca3[_0xb79c('0x2f')];if(_0x1e686f['query'][_0xb79c('0x40')]){_0x3908ef[_0xb79c('0x41')]=[{'all':!![]}];}_0x3908ef=_[_0xb79c('0x3d')]({},_0x3908ef,_0x1e686f[_0xb79c('0x3f')]);return db[_0xb79c('0x2c')][_0xb79c('0x45')](_0x3908ef)[_0xb79c('0x25')](handleEntityNotFound(_0x290cfd,null))[_0xb79c('0x25')](respondWithResult(_0x290cfd,null))[_0xb79c('0x43')](handleError(_0x290cfd,null));};exports[_0xb79c('0x46')]=function(_0x14f6f1,_0x561a51){return db[_0xb79c('0x2c')][_0xb79c('0x46')](_0x14f6f1[_0xb79c('0x47')],{})['then'](respondWithResult(_0x561a51,0xc9))[_0xb79c('0x43')](handleError(_0x561a51,null));};exports[_0xb79c('0x24')]=function(_0x2faf9c,_0xde7063){if(_0x2faf9c[_0xb79c('0x47')]['id']){delete _0x2faf9c[_0xb79c('0x47')]['id'];}return db['VoiceQueuesLog'][_0xb79c('0x45')]({'where':{'id':_0x2faf9c[_0xb79c('0x44')]['id']}})[_0xb79c('0x25')](handleEntityNotFound(_0xde7063,null))[_0xb79c('0x25')](saveUpdates(_0x2faf9c[_0xb79c('0x47')],null))[_0xb79c('0x25')](respondWithResult(_0xde7063,null))[_0xb79c('0x43')](handleError(_0xde7063,null));};exports['destroy']=function(_0x4641a2,_0x11bf58){return db[_0xb79c('0x2c')][_0xb79c('0x45')]({'where':{'id':_0x4641a2[_0xb79c('0x44')]['id']}})[_0xb79c('0x25')](handleEntityNotFound(_0x11bf58,null))[_0xb79c('0x25')](removeEntity(_0x11bf58,null))[_0xb79c('0x43')](handleError(_0x11bf58,null));}; \ No newline at end of file +var _0x2eb2=['squel','crypto','jsforce','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','sendStatus','stack','name','send','index','VoiceQueuesLog','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra'];(function(_0x4c8892,_0x567fa7){var _0x2b8fb3=function(_0x24e74f){while(--_0x24e74f){_0x4c8892['push'](_0x4c8892['shift']());}};_0x2b8fb3(++_0x567fa7);}(_0x2eb2,0x194));var _0x22eb=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2eb2[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x22eb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x22eb('0x5'));var path=require('path');var sox=require(_0x22eb('0x6'));var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require('lodash');var squel=require(_0x22eb('0xa'));var crypto=require(_0x22eb('0xb'));var jsforce=require(_0x22eb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x22eb('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22eb('0xd'));var hardwareService=require(_0x22eb('0xe'));var logger=require(_0x22eb('0xf'))(_0x22eb('0x10'));var utils=require(_0x22eb('0x11'));var config=require(_0x22eb('0x12'));var licenseUtil=require(_0x22eb('0x13'));var db=require(_0x22eb('0x14'))['db'];function respondWithStatusCode(_0x45374a,_0x1290ae){_0x1290ae=_0x1290ae||0xcc;return function(_0x3eb42f){if(_0x3eb42f){return _0x45374a['sendStatus'](_0x1290ae);}return _0x45374a[_0x22eb('0x15')](_0x1290ae)[_0x22eb('0x16')]();};}function respondWithResult(_0x55cd6f,_0xe9d39a){_0xe9d39a=_0xe9d39a||0xc8;return function(_0x5eb17f){if(_0x5eb17f){return _0x55cd6f[_0x22eb('0x15')](_0xe9d39a)['json'](_0x5eb17f);}};}function respondWithFilteredResult(_0x217ca7,_0xa6e173){return function(_0x5e3584){if(_0x5e3584){var _0x24e9d9=typeof _0xa6e173[_0x22eb('0x17')]===_0x22eb('0x18')&&typeof _0xa6e173[_0x22eb('0x19')]===_0x22eb('0x18');var _0x1d2cb0=_0x5e3584['count'];var _0x2e9858=_0x24e9d9?0x0:_0xa6e173[_0x22eb('0x17')];var _0x2eacb9=_0x24e9d9?_0x5e3584[_0x22eb('0x1a')]:_0xa6e173[_0x22eb('0x17')]+_0xa6e173[_0x22eb('0x19')];var _0x10cd64;if(_0x2eacb9>=_0x1d2cb0){_0x2eacb9=_0x1d2cb0;_0x10cd64=0xc8;}else{_0x10cd64=0xce;}_0x217ca7['status'](_0x10cd64);return _0x217ca7[_0x22eb('0x1b')](_0x22eb('0x1c'),_0x2e9858+'-'+_0x2eacb9+'/'+_0x1d2cb0)[_0x22eb('0x1d')](_0x5e3584);}return null;};}function patchUpdates(_0x1d5ec7){return function(_0x1d20b7){try{jsonpatch[_0x22eb('0x1e')](_0x1d20b7,_0x1d5ec7,!![]);}catch(_0x1cc98d){return BPromise[_0x22eb('0x1f')](_0x1cc98d);}return _0x1d20b7[_0x22eb('0x20')]();};}function saveUpdates(_0x131521,_0x1ade87){return function(_0x3b47a4){if(_0x3b47a4){return _0x3b47a4[_0x22eb('0x21')](_0x131521)[_0x22eb('0x22')](function(_0x101953){return _0x101953;});}return null;};}function removeEntity(_0x1cef22,_0x4c7d0d){return function(_0x346b48){if(_0x346b48){return _0x346b48['destroy']()[_0x22eb('0x22')](function(){_0x1cef22[_0x22eb('0x15')](0xcc)[_0x22eb('0x16')]();});}};}function handleEntityNotFound(_0x523f45,_0x1a7631){return function(_0x493313){if(!_0x493313){_0x523f45[_0x22eb('0x23')](0x194);}return _0x493313;};}function handleError(_0x36683f,_0x18e467){_0x18e467=_0x18e467||0x1f4;return function(_0x4f084d){logger['error'](_0x4f084d[_0x22eb('0x24')]);if(_0x4f084d[_0x22eb('0x25')]){delete _0x4f084d[_0x22eb('0x25')];}_0x36683f[_0x22eb('0x15')](_0x18e467)[_0x22eb('0x26')](_0x4f084d);};}exports[_0x22eb('0x27')]=function(_0x4c6ec2,_0xd3ba01){var _0x49f367={},_0x264fd7={},_0x4410da={'count':0x0,'rows':[]};var _0x467cb2=_['map'](db[_0x22eb('0x28')][_0x22eb('0x29')],function(_0x2058aa){return{'name':_0x2058aa['fieldName'],'type':_0x2058aa[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x264fd7[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x467cb2,_0x22eb('0x25'));_0x264fd7['query']=_[_0x22eb('0x2e')](_0x4c6ec2[_0x22eb('0x2f')]);_0x264fd7[_0x22eb('0x30')]=_[_0x22eb('0x31')](_0x264fd7['model'],_0x264fd7[_0x22eb('0x2f')]);_0x49f367[_0x22eb('0x32')]=_[_0x22eb('0x31')](_0x264fd7[_0x22eb('0x2c')],qs[_0x22eb('0x33')](_0x4c6ec2[_0x22eb('0x2f')][_0x22eb('0x33')]));_0x49f367[_0x22eb('0x32')]=_0x49f367[_0x22eb('0x32')][_0x22eb('0x34')]?_0x49f367['attributes']:_0x264fd7[_0x22eb('0x2c')];if(!_0x4c6ec2['query'][_0x22eb('0x35')]('nolimit')){_0x49f367[_0x22eb('0x19')]=qs[_0x22eb('0x19')](_0x4c6ec2[_0x22eb('0x2f')]['limit']);_0x49f367[_0x22eb('0x17')]=qs['offset'](_0x4c6ec2['query']['offset']);}_0x49f367['order']=qs[_0x22eb('0x36')](_0x4c6ec2[_0x22eb('0x2f')]['sort']);_0x49f367[_0x22eb('0x37')]=qs['filters'](_['pick'](_0x4c6ec2[_0x22eb('0x2f')],_0x264fd7[_0x22eb('0x30')]),_0x467cb2);if(_0x4c6ec2[_0x22eb('0x2f')][_0x22eb('0x38')]){_0x49f367['where']=_['merge'](_0x49f367[_0x22eb('0x37')],{'$or':_['map'](_0x467cb2,function(_0x48c085){if(_0x48c085[_0x22eb('0x2a')]!==_0x22eb('0x39')){var _0xb30410={};_0xb30410[_0x48c085[_0x22eb('0x25')]]={'$like':'%'+_0x4c6ec2[_0x22eb('0x2f')]['filter']+'%'};return _0xb30410;}})});}_0x49f367=_[_0x22eb('0x3a')]({},_0x49f367,_0x4c6ec2[_0x22eb('0x3b')]);var _0x22561f={'where':_0x49f367['where']};return db[_0x22eb('0x28')]['count'](_0x22561f)[_0x22eb('0x22')](function(_0x103271){_0x4410da['count']=_0x103271;if(_0x4c6ec2[_0x22eb('0x2f')][_0x22eb('0x3c')]){_0x49f367[_0x22eb('0x3d')]=[{'all':!![]}];}return db[_0x22eb('0x28')][_0x22eb('0x3e')](_0x49f367);})[_0x22eb('0x22')](function(_0x1fe263){_0x4410da[_0x22eb('0x3f')]=_0x1fe263;return _0x4410da;})[_0x22eb('0x22')](respondWithFilteredResult(_0xd3ba01,_0x49f367))[_0x22eb('0x40')](handleError(_0xd3ba01,null));};exports['show']=function(_0x147faa,_0x25f515){var _0x56d62c={'raw':!![],'where':{'id':_0x147faa['params']['id']}},_0x18ec70={};_0x18ec70[_0x22eb('0x2c')]=_[_0x22eb('0x2e')](db['VoiceQueuesLog'][_0x22eb('0x29')]);_0x18ec70[_0x22eb('0x2f')]=_[_0x22eb('0x2e')](_0x147faa[_0x22eb('0x2f')]);_0x18ec70['filters']=_[_0x22eb('0x31')](_0x18ec70[_0x22eb('0x2c')],_0x18ec70[_0x22eb('0x2f')]);_0x56d62c['attributes']=_[_0x22eb('0x31')](_0x18ec70['model'],qs[_0x22eb('0x33')](_0x147faa[_0x22eb('0x2f')][_0x22eb('0x33')]));_0x56d62c[_0x22eb('0x32')]=_0x56d62c[_0x22eb('0x32')][_0x22eb('0x34')]?_0x56d62c[_0x22eb('0x32')]:_0x18ec70['model'];if(_0x147faa[_0x22eb('0x2f')][_0x22eb('0x3c')]){_0x56d62c[_0x22eb('0x3d')]=[{'all':!![]}];}_0x56d62c=_[_0x22eb('0x3a')]({},_0x56d62c,_0x147faa['options']);return db[_0x22eb('0x28')][_0x22eb('0x41')](_0x56d62c)[_0x22eb('0x22')](handleEntityNotFound(_0x25f515,null))[_0x22eb('0x22')](respondWithResult(_0x25f515,null))[_0x22eb('0x40')](handleError(_0x25f515,null));};exports[_0x22eb('0x42')]=function(_0x4d1ae0,_0x14144d){return db['VoiceQueuesLog']['create'](_0x4d1ae0[_0x22eb('0x43')],{})[_0x22eb('0x22')](respondWithResult(_0x14144d,0xc9))[_0x22eb('0x40')](handleError(_0x14144d,null));};exports['update']=function(_0x45835b,_0x209853){if(_0x45835b[_0x22eb('0x43')]['id']){delete _0x45835b['body']['id'];}return db[_0x22eb('0x28')]['find']({'where':{'id':_0x45835b['params']['id']}})[_0x22eb('0x22')](handleEntityNotFound(_0x209853,null))[_0x22eb('0x22')](saveUpdates(_0x45835b[_0x22eb('0x43')],null))['then'](respondWithResult(_0x209853,null))['catch'](handleError(_0x209853,null));};exports[_0x22eb('0x44')]=function(_0x2ea564,_0x57c0c0){return db[_0x22eb('0x28')][_0x22eb('0x41')]({'where':{'id':_0x2ea564['params']['id']}})[_0x22eb('0x22')](handleEntityNotFound(_0x57c0c0,null))['then'](removeEntity(_0x57c0c0,null))[_0x22eb('0x40')](handleError(_0x57c0c0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 38e75e4..a09ab88 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 _0x1da6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util'];(function(_0x53f964,_0x3b52b8){var _0x17be6c=function(_0x25a732){while(--_0x25a732){_0x53f964['push'](_0x53f964['shift']());}};_0x17be6c(++_0x3b52b8);}(_0x1da6,0x7c));var _0x61da=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x1da6[_0x34aec4];return _0x51e1a7;};'use strict';var _=require(_0x61da('0x0'));var util=require(_0x61da('0x1'));var logger=require(_0x61da('0x2'))(_0x61da('0x3'));var moment=require(_0x61da('0x4'));var BPromise=require(_0x61da('0x5'));var rp=require(_0x61da('0x6'));var fs=require('fs');var path=require(_0x61da('0x7'));var rimraf=require(_0x61da('0x8'));var config=require(_0x61da('0x9'));var attributes=require(_0x61da('0xa'));module[_0x61da('0xb')]=function(_0x16cd66,_0x2c40c6){return _0x16cd66[_0x61da('0xc')](_0x61da('0xd'),attributes,{'tableName':_0x61da('0xe'),'paranoid':![],'indexes':[{'name':_0x61da('0xf'),'fields':[_0x61da('0x10'),_0x61da('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc7b4=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','lodash'];(function(_0x47436f,_0x127770){var _0x57c359=function(_0x2250c){while(--_0x2250c){_0x47436f['push'](_0x47436f['shift']());}};_0x57c359(++_0x127770);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c7b('0x0'));var util=require('util');var logger=require(_0x4c7b('0x1'))(_0x4c7b('0x2'));var moment=require('moment');var BPromise=require(_0x4c7b('0x3'));var rp=require(_0x4c7b('0x4'));var fs=require('fs');var path=require(_0x4c7b('0x5'));var rimraf=require(_0x4c7b('0x6'));var config=require(_0x4c7b('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x4c7b('0x8')]=function(_0x2272e8,_0x46532e){return _0x2272e8[_0x4c7b('0x9')](_0x4c7b('0xa'),attributes,{'tableName':_0x4c7b('0xb'),'paranoid':![],'indexes':[{'name':_0x4c7b('0xc'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ae0f451..7558efc 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 _0x6dcd=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x45a420,_0x56cdac){var _0xd22711=function(_0x12abc0){while(--_0x12abc0){_0x45a420['push'](_0x45a420['shift']());}};_0xd22711(++_0x56cdac);}(_0x6dcd,0xa2));var _0xd6dc=function(_0x5105af,_0x752e6e){_0x5105af=_0x5105af-0x0;var _0x2d63bb=_0x6dcd[_0x5105af];return _0x2d63bb;};'use strict';var _=require('lodash');var util=require(_0xd6dc('0x0'));var moment=require('moment');var BPromise=require(_0xd6dc('0x1'));var rs=require(_0xd6dc('0x2'));var fs=require('fs');var Redis=require(_0xd6dc('0x3'));var db=require(_0xd6dc('0x4'))['db'];var utils=require(_0xd6dc('0x5'));var logger=require(_0xd6dc('0x6'))(_0xd6dc('0x7'));var config=require(_0xd6dc('0x8'));var jayson=require(_0xd6dc('0x9'));var client=jayson[_0xd6dc('0xa')][_0xd6dc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe241a,_0x160480,_0x40fa8e){return new BPromise(function(_0x3de2d5,_0x755f01){return client[_0xd6dc('0xc')](_0xe241a,_0x40fa8e)['then'](function(_0x235f11){logger[_0xd6dc('0xd')](_0xd6dc('0xe'),_0x160480,_0xd6dc('0xf'));logger['debug'](_0xd6dc('0x10'),_0x160480,'request\x20sent',JSON['stringify'](_0x235f11));if(_0x235f11['error']){if(_0x235f11[_0xd6dc('0x11')][_0xd6dc('0x12')]===0x1f4){logger[_0xd6dc('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x160480,_0x235f11['error'][_0xd6dc('0x13')]);return _0x755f01(_0x235f11[_0xd6dc('0x11')][_0xd6dc('0x13')]);}logger['error'](_0xd6dc('0xe'),_0x160480,_0x235f11[_0xd6dc('0x11')]['message']);return _0x3de2d5(_0x235f11[_0xd6dc('0x11')][_0xd6dc('0x13')]);}else{logger['info'](_0xd6dc('0xe'),_0x160480,_0xd6dc('0xf'));_0x3de2d5(_0x235f11[_0xd6dc('0x14')][_0xd6dc('0x13')]);}})[_0xd6dc('0x15')](function(_0xb1a883){logger[_0xd6dc('0x11')](_0xd6dc('0xe'),_0x160480,_0xb1a883);_0x755f01(_0xb1a883);});});} \ No newline at end of file +var _0x7f8b=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util'];(function(_0x234ae1,_0x42bdd6){var _0x227ba0=function(_0x1f6531){while(--_0x1f6531){_0x234ae1['push'](_0x234ae1['shift']());}};_0x227ba0(++_0x42bdd6);}(_0x7f8b,0x1ca));var _0xb7f8=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x7f8b[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0xb7f8('0x0'));var util=require(_0xb7f8('0x1'));var moment=require(_0xb7f8('0x2'));var BPromise=require(_0xb7f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb7f8('0x4'));var db=require(_0xb7f8('0x5'))['db'];var utils=require(_0xb7f8('0x6'));var logger=require(_0xb7f8('0x7'))(_0xb7f8('0x8'));var config=require(_0xb7f8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb7f8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x583957,_0x139cab,_0x43f898){return new BPromise(function(_0x49aa8d,_0xd3fc85){return client[_0xb7f8('0xb')](_0x583957,_0x43f898)[_0xb7f8('0xc')](function(_0x592f9a){logger[_0xb7f8('0xd')](_0xb7f8('0xe'),_0x139cab,'request\x20sent');logger[_0xb7f8('0xf')](_0xb7f8('0x10'),_0x139cab,_0xb7f8('0x11'),JSON[_0xb7f8('0x12')](_0x592f9a));if(_0x592f9a[_0xb7f8('0x13')]){if(_0x592f9a[_0xb7f8('0x13')][_0xb7f8('0x14')]===0x1f4){logger[_0xb7f8('0x13')](_0xb7f8('0xe'),_0x139cab,_0x592f9a['error'][_0xb7f8('0x15')]);return _0xd3fc85(_0x592f9a[_0xb7f8('0x13')][_0xb7f8('0x15')]);}logger[_0xb7f8('0x13')](_0xb7f8('0xe'),_0x139cab,_0x592f9a['error'][_0xb7f8('0x15')]);return _0x49aa8d(_0x592f9a[_0xb7f8('0x13')][_0xb7f8('0x15')]);}else{logger['info'](_0xb7f8('0xe'),_0x139cab,'request\x20sent');_0x49aa8d(_0x592f9a['result'][_0xb7f8('0x15')]);}})[_0xb7f8('0x16')](function(_0x24a574){logger[_0xb7f8('0x13')](_0xb7f8('0xe'),_0x139cab,_0x24a574);_0xd3fc85(_0x24a574);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 2cd614b..caae91f 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 _0x4223=['post','runTranscribe','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0x4223,0x77));var _0x3422=function(_0x28224f,_0x55d07e){_0x28224f=_0x28224f-0x0;var _0xd592f2=_0x4223[_0x28224f];return _0xd592f2;};'use strict';var multer=require(_0x3422('0x0'));var util=require(_0x3422('0x1'));var path=require('path');var timeout=require(_0x3422('0x2'));var express=require(_0x3422('0x3'));var router=express[_0x3422('0x4')]();var fs_extra=require(_0x3422('0x5'));var auth=require(_0x3422('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3422('0x7'));var controller=require(_0x3422('0x8'));router[_0x3422('0x9')]('/',auth[_0x3422('0xa')](),controller[_0x3422('0xb')]);router[_0x3422('0x9')](_0x3422('0xc'),auth[_0x3422('0xa')](),controller[_0x3422('0xd')]);router[_0x3422('0x9')](_0x3422('0xe'),auth[_0x3422('0xa')](),controller['show']);router[_0x3422('0x9')](_0x3422('0xf'),auth[_0x3422('0xa')](),controller['download']);router[_0x3422('0x9')](_0x3422('0x10'),controller[_0x3422('0x11')]);router[_0x3422('0x9')](_0x3422('0x12'),auth[_0x3422('0xa')](),controller[_0x3422('0x13')]);router['post']('/',auth[_0x3422('0xa')](),controller[_0x3422('0x14')]);router[_0x3422('0x15')]('/:id/transcribe',auth[_0x3422('0xa')](),controller[_0x3422('0x16')]);router[_0x3422('0x17')]('/:id',auth[_0x3422('0xa')](),controller[_0x3422('0x18')]);router[_0x3422('0x19')](_0x3422('0xe'),auth['isAuthenticated'](),controller[_0x3422('0x1a')]);module[_0x3422('0x1b')]=router; \ No newline at end of file +var _0x7b95=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','/:id/transcribe','put','/:id','update','delete','exports','multer','util','express','fs-extra','../../components/auth/service'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0x7b95,0x1db));var _0x57b9=function(_0x332af3,_0x4ecb44){_0x332af3=_0x332af3-0x0;var _0x45cf55=_0x7b95[_0x332af3];return _0x45cf55;};'use strict';var multer=require(_0x57b9('0x0'));var util=require(_0x57b9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x57b9('0x2'));var router=express['Router']();var fs_extra=require(_0x57b9('0x3'));var auth=require(_0x57b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x57b9('0x5'));var controller=require(_0x57b9('0x6'));router[_0x57b9('0x7')]('/',auth[_0x57b9('0x8')](),controller[_0x57b9('0x9')]);router[_0x57b9('0x7')]('/describe',auth[_0x57b9('0x8')](),controller[_0x57b9('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x57b9('0x7')](_0x57b9('0xb'),auth['isAuthenticated'](),controller[_0x57b9('0xc')]);router['get'](_0x57b9('0xd'),controller[_0x57b9('0xe')]);router[_0x57b9('0x7')]('/:id/transcribe',auth[_0x57b9('0x8')](),controller[_0x57b9('0xf')]);router[_0x57b9('0x10')]('/',auth[_0x57b9('0x8')](),controller[_0x57b9('0x11')]);router['post'](_0x57b9('0x12'),auth[_0x57b9('0x8')](),controller['runTranscribe']);router[_0x57b9('0x13')](_0x57b9('0x14'),auth[_0x57b9('0x8')](),controller[_0x57b9('0x15')]);router[_0x57b9('0x16')](_0x57b9('0x14'),auth['isAuthenticated'](),controller['destroy']);module[_0x57b9('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 482f02e..c547a24 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(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 1cedd2a..c87b83f 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 _0x9ca5=['[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','attributes','fields','nolimit','order','where','pick','filter','merge','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','decryptFile','secrets','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','Not\x20found','downloads','sequelize','MD5','token','$and','push','recording','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x9ca5,0x133));var _0x59ca=function(_0x2718c7,_0x5a1636){_0x2718c7=_0x2718c7-0x0;var _0x59d89c=_0x9ca5[_0x2718c7];return _0x59d89c;};'use strict';var emlformat=require(_0x59ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59ca('0x1'));var jsonpatch=require(_0x59ca('0x2'));var rp=require(_0x59ca('0x3'));var moment=require(_0x59ca('0x4'));var BPromise=require(_0x59ca('0x5'));var Mustache=require(_0x59ca('0x6'));var util=require(_0x59ca('0x7'));var path=require(_0x59ca('0x8'));var sox=require(_0x59ca('0x9'));var csv=require(_0x59ca('0xa'));var ejs=require(_0x59ca('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59ca('0xc'));var squel=require(_0x59ca('0xd'));var crypto=require(_0x59ca('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x59ca('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59ca('0x10'));var AWS=require(_0x59ca('0x11'));var uuidv4=require(_0x59ca('0x12'));var Redis=require('ioredis');var authService=require(_0x59ca('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x59ca('0x14'));var hardwareService=require(_0x59ca('0x15'));var logger=require(_0x59ca('0x16'))(_0x59ca('0x17'));var utils=require(_0x59ca('0x18'));var config=require(_0x59ca('0x19'));var licenseUtil=require(_0x59ca('0x1a'));var db=require(_0x59ca('0x1b'))['db'];function respondWithStatusCode(_0x4c1d04,_0x1cab91){_0x1cab91=_0x1cab91||0xcc;return function(_0xb2d6a1){if(_0xb2d6a1){return _0x4c1d04['sendStatus'](_0x1cab91);}return _0x4c1d04['status'](_0x1cab91)[_0x59ca('0x1c')]();};}function respondWithResult(_0x27dc11,_0x515924){_0x515924=_0x515924||0xc8;return function(_0x385cc1){if(_0x385cc1){return _0x27dc11[_0x59ca('0x1d')](_0x515924)['json'](_0x385cc1);}};}function respondWithFilteredResult(_0x3546e7,_0x26379f){return function(_0x266759){if(_0x266759){var _0x492a29=typeof _0x26379f['offset']===_0x59ca('0x1e')&&typeof _0x26379f[_0x59ca('0x1f')]==='undefined';var _0xe259b9=_0x266759[_0x59ca('0x20')];var _0x1d0765=_0x492a29?0x0:_0x26379f[_0x59ca('0x21')];var _0xb53cf5=_0x492a29?_0x266759[_0x59ca('0x20')]:_0x26379f[_0x59ca('0x21')]+_0x26379f[_0x59ca('0x1f')];var _0x14eb4c;if(_0xb53cf5>=_0xe259b9){_0xb53cf5=_0xe259b9;_0x14eb4c=0xc8;}else{_0x14eb4c=0xce;}_0x3546e7[_0x59ca('0x1d')](_0x14eb4c);return _0x3546e7[_0x59ca('0x22')]('Content-Range',_0x1d0765+'-'+_0xb53cf5+'/'+_0xe259b9)[_0x59ca('0x23')](_0x266759);}return null;};}function patchUpdates(_0x1d3290){return function(_0x32df71){try{jsonpatch['apply'](_0x32df71,_0x1d3290,!![]);}catch(_0x4db49b){return BPromise['reject'](_0x4db49b);}return _0x32df71[_0x59ca('0x24')]();};}function saveUpdates(_0x42fbf1,_0x476af1){return function(_0x2d1cab){if(_0x2d1cab){return _0x2d1cab[_0x59ca('0x25')](_0x42fbf1)[_0x59ca('0x26')](function(_0x1a701a){return _0x1a701a;});}return null;};}function removeEntity(_0x5e4352,_0x4823d8){return function(_0x35909a){if(_0x35909a){return _0x35909a[_0x59ca('0x27')]()[_0x59ca('0x26')](function(){_0x5e4352['status'](0xcc)[_0x59ca('0x1c')]();});}};}function handleEntityNotFound(_0x48b4db,_0x1289c5){return function(_0x50c1cf){if(!_0x50c1cf){_0x48b4db['sendStatus'](0x194);}return _0x50c1cf;};}function handleError(_0x523437,_0x5da96d){_0x5da96d=_0x5da96d||0x1f4;return function(_0x472092){logger[_0x59ca('0x28')](_0x472092['stack']);if(_0x472092['name']){delete _0x472092[_0x59ca('0x29')];}_0x523437['status'](_0x5da96d)[_0x59ca('0x2a')](_0x472092);};}exports[_0x59ca('0x2b')]=function(_0x5eec48,_0xc0e52c){var _0x440101={},_0x50aaa9={},_0x4235a0={'count':0x0,'rows':[]};var _0x20f412=_[_0x59ca('0x2c')](db['VoiceRecording'][_0x59ca('0x2d')],function(_0x14e1c0){return{'name':_0x14e1c0[_0x59ca('0x2e')],'type':_0x14e1c0[_0x59ca('0x2f')][_0x59ca('0x30')]};});_0x50aaa9[_0x59ca('0x31')]=_[_0x59ca('0x32')](_[_0x59ca('0x2c')](_0x20f412,_0x59ca('0x29')),[_0x59ca('0x33')]);_0x50aaa9['query']=_[_0x59ca('0x34')](_0x5eec48[_0x59ca('0x35')]);_0x50aaa9[_0x59ca('0x36')]=_[_0x59ca('0x37')](_0x50aaa9[_0x59ca('0x31')],_0x50aaa9['query']);_0x440101[_0x59ca('0x38')]=_[_0x59ca('0x37')](_0x50aaa9[_0x59ca('0x31')],qs[_0x59ca('0x39')](_0x5eec48['query'][_0x59ca('0x39')]));_0x440101[_0x59ca('0x38')]=_0x440101[_0x59ca('0x38')]['length']?_0x440101[_0x59ca('0x38')]:_0x50aaa9[_0x59ca('0x31')];if(!_0x5eec48['query']['hasOwnProperty'](_0x59ca('0x3a'))){_0x440101[_0x59ca('0x1f')]=qs[_0x59ca('0x1f')](_0x5eec48['query'][_0x59ca('0x1f')]);_0x440101[_0x59ca('0x21')]=qs[_0x59ca('0x21')](_0x5eec48[_0x59ca('0x35')][_0x59ca('0x21')]);}_0x440101[_0x59ca('0x3b')]=qs['sort'](_0x5eec48['query']['sort']);_0x440101[_0x59ca('0x3c')]=qs['filters'](_[_0x59ca('0x3d')](_0x5eec48['query'],_0x50aaa9[_0x59ca('0x36')]),_0x20f412);if(_0x5eec48[_0x59ca('0x35')]['filter']){_0x440101[_0x59ca('0x3c')]=_['merge'](_0x440101[_0x59ca('0x3c')],{'$or':_[_0x59ca('0x2c')](_0x20f412,function(_0x27507f){if(_0x27507f[_0x59ca('0x2f')]!=='VIRTUAL'){var _0x2f2a1e={};_0x2f2a1e[_0x27507f['name']]={'$like':'%'+_0x5eec48[_0x59ca('0x35')][_0x59ca('0x3e')]+'%'};return _0x2f2a1e;}})});}_0x440101=_[_0x59ca('0x3f')]({},_0x440101,_0x5eec48['options']);var _0x8322c4={'where':_0x440101[_0x59ca('0x3c')]};return db[_0x59ca('0x40')]['count'](_0x8322c4)[_0x59ca('0x26')](function(_0x4409ed){_0x4235a0[_0x59ca('0x20')]=_0x4409ed;if(_0x5eec48[_0x59ca('0x35')][_0x59ca('0x41')]){_0x440101[_0x59ca('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x59ca('0x43')](_0x440101);})[_0x59ca('0x26')](function(_0x1d75ac){_0x4235a0[_0x59ca('0x44')]=_0x1d75ac;return _0x4235a0;})['then'](respondWithFilteredResult(_0xc0e52c,_0x440101))[_0x59ca('0x45')](handleError(_0xc0e52c,null));};exports[_0x59ca('0x46')]=function(_0x5cf834,_0x5a022e){var _0x5cb953={'raw':![],'where':{'id':_0x5cf834[_0x59ca('0x47')]['id']}},_0x70925e={};_0x70925e[_0x59ca('0x31')]=_[_0x59ca('0x34')](db[_0x59ca('0x40')][_0x59ca('0x2d')]);_0x70925e[_0x59ca('0x35')]=_[_0x59ca('0x34')](_0x5cf834[_0x59ca('0x35')]);_0x70925e[_0x59ca('0x36')]=_[_0x59ca('0x37')](_0x70925e['model'],_0x70925e[_0x59ca('0x35')]);_0x5cb953[_0x59ca('0x38')]=_[_0x59ca('0x37')](_0x70925e[_0x59ca('0x31')],qs['fields'](_0x5cf834[_0x59ca('0x35')][_0x59ca('0x39')]));_0x5cb953[_0x59ca('0x38')]=_0x5cb953[_0x59ca('0x38')][_0x59ca('0x48')]?_0x5cb953['attributes']:_0x70925e[_0x59ca('0x31')];if(_0x5cf834['query']['includeAll']){_0x5cb953[_0x59ca('0x42')]=[{'all':!![]}];}_0x5cb953=_[_0x59ca('0x3f')]({},_0x5cb953,_0x5cf834[_0x59ca('0x49')]);return db[_0x59ca('0x40')][_0x59ca('0x4a')](_0x5cb953)['then'](handleEntityNotFound(_0x5a022e,null))[_0x59ca('0x26')](respondWithResult(_0x5a022e,null))[_0x59ca('0x45')](handleError(_0x5a022e,null));};exports[_0x59ca('0x4b')]=function(_0x19a5f0,_0x372d93){return db[_0x59ca('0x40')][_0x59ca('0x4b')](_0x19a5f0[_0x59ca('0x4c')],{})['then'](respondWithResult(_0x372d93,0xc9))[_0x59ca('0x45')](handleError(_0x372d93,null));};exports[_0x59ca('0x25')]=function(_0x4f3c2d,_0x4f3d0a){if(_0x4f3c2d[_0x59ca('0x4c')]['id']){delete _0x4f3c2d[_0x59ca('0x4c')]['id'];}return db[_0x59ca('0x40')]['find']({'where':{'id':_0x4f3c2d[_0x59ca('0x47')]['id']}})[_0x59ca('0x26')](handleEntityNotFound(_0x4f3d0a,null))[_0x59ca('0x26')](saveUpdates(_0x4f3c2d[_0x59ca('0x4c')],null))['then'](respondWithResult(_0x4f3d0a,null))[_0x59ca('0x45')](handleError(_0x4f3d0a,null));};exports[_0x59ca('0x4d')]=function(_0x5e1da7,_0x48d5ee){return db['VoiceRecording'][_0x59ca('0x4d')]()[_0x59ca('0x26')](respondWithResult(_0x48d5ee,null))[_0x59ca('0x45')](handleError(_0x48d5ee,null));};exports[_0x59ca('0x4e')]=function(_0x37c96c,_0x4e19e5,_0x34c054){var _0xfb36be=require(_0x59ca('0x4f'));var _0x3e3232=![];var _0x9176ba={};if(_0x37c96c[_0x59ca('0x35')][_0x59ca('0x2f')]&&_0x37c96c[_0x59ca('0x35')][_0x59ca('0x2f')]==='uniqueid'){_0x9176ba[_0x59ca('0x50')]=_0x37c96c[_0x59ca('0x47')]['id'];}else{_0x9176ba['id']=_0x37c96c[_0x59ca('0x47')]['id'];}return db['VoiceRecording'][_0x59ca('0x4a')]({'where':_0x9176ba,'attributes':['id',_0x59ca('0x51')],'raw':!![]})[_0x59ca('0x26')](handleEntityNotFound(_0x4e19e5,null))['then'](function(_0xf73b54){if(_0xf73b54){var _0x2aa6ed=_0xf73b54['value'];var _0x541818=util['format']('%s.cypher',_0x2aa6ed);if(fs['existsSync'](_0x541818)){_0x3e3232=!![];return _0xfb36be[_0x59ca('0x52')](_0x541818,_0x2aa6ed,config[_0x59ca('0x53')]['recording'])['then'](function(){return _0xf73b54;});}return _0xf73b54;}})[_0x59ca('0x26')](function(_0x1f9bfd){if(_0x1f9bfd){var _0x59ccb4=_0x1f9bfd[_0x59ca('0x51')];if(!fs[_0x59ca('0x54')](_0x59ccb4)){throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))](_0x59ca('0x57'));}if(_0x1f9bfd[_0x59ca('0x58')]){return _0x4e19e5[_0x59ca('0x4e')](_0x59ccb4,_0x1f9bfd['filename']+path['extname'](_0x59ccb4),function(){if(_0x3e3232){fs[_0x59ca('0x59')](_0x59ccb4);}});}else{return _0x4e19e5['download'](_0x59ccb4,function(_0x184967){if(_0x3e3232){fs[_0x59ca('0x59')](_0x59ccb4);}});}}})[_0x59ca('0x45')](function(_0x126606){if(_0x126606['message']===_0x59ca('0x57')){_0x4e19e5[_0x59ca('0x1d')](0x194)[_0x59ca('0x2a')](_0x59ca('0x5a'));}else{return handleError(_0x4e19e5,null);}});};exports[_0x59ca('0x5b')]=function(_0x5e828f,_0x131931,_0x1c9fd7){var _0x418826=require('../../components/encryptor');var _0x1ee934=![];var _0x154ff2={'$and':[db[_0x59ca('0x5c')][_0x59ca('0x3c')](db['sequelize']['fn'](_0x59ca('0x5d'),db[_0x59ca('0x5c')]['col']('uniqueid')),_0x5e828f['query'][_0x59ca('0x5e')])]};if(_0x5e828f[_0x59ca('0x35')][_0x59ca('0x2f')]&&_0x5e828f['query'][_0x59ca('0x2f')]===_0x59ca('0x50')){_0x154ff2[_0x59ca('0x5f')][_0x59ca('0x60')]({'uniqueid':_0x5e828f['params']['id']});}else{_0x154ff2[_0x59ca('0x5f')]['push']({'id':_0x5e828f[_0x59ca('0x47')]['id']});}return db[_0x59ca('0x40')][_0x59ca('0x4a')]({'where':_0x154ff2,'attributes':['id',_0x59ca('0x51')],'raw':!![]})[_0x59ca('0x26')](handleEntityNotFound(_0x131931,null))[_0x59ca('0x26')](function(_0x41a774){if(_0x41a774){var _0x586e2e=util['format']('%s.cypher',_0x41a774['value']);if(fs[_0x59ca('0x54')](_0x586e2e)){_0x1ee934=!![];return _0x418826[_0x59ca('0x52')](_0x586e2e,_0x41a774[_0x59ca('0x51')],config['secrets'][_0x59ca('0x61')])[_0x59ca('0x26')](function(){return _0x41a774;});}return _0x41a774;}})[_0x59ca('0x26')](function(_0x516126){if(_0x516126){if(!fs['existsSync'](_0x516126[_0x59ca('0x51')])){throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))](_0x59ca('0x57'));}if(_0x516126['filename']){return _0x131931['download'](_0x516126[_0x59ca('0x51')],_0x516126[_0x59ca('0x58')]+path[_0x59ca('0x62')](_0x516126[_0x59ca('0x51')]),function(){if(_0x1ee934){fs[_0x59ca('0x59')](_0x516126[_0x59ca('0x51')]);}});}else{return _0x131931[_0x59ca('0x4e')](_0x516126[_0x59ca('0x51')],function(_0x4569ab){if(_0x1ee934){fs['unlink'](_0x516126['value']);}});}}})[_0x59ca('0x45')](handleError(_0x131931,null));};exports[_0x59ca('0x27')]=function(_0x2eeb7f,_0x1c7de7){return db['VoiceRecording'][_0x59ca('0x4a')]({'where':{'id':_0x2eeb7f[_0x59ca('0x47')]['id']}})[_0x59ca('0x26')](function(_0x5cc233){if(_[_0x59ca('0x63')](_0x5cc233)){throw new ReferenceError(_0x59ca('0x64'));}return _0x5cc233;})[_0x59ca('0x26')](function(_0x3826ce){var _0x1170b0=_0x3826ce[_0x59ca('0x51')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1170b0);if(!_[_0x59ca('0x63')](_0x3826ce[_0x59ca('0x51')])&&fs['existsSync'](_0x1170b0)){logger[_0x59ca('0x65')](_0x59ca('0x66')+_0x1170b0+_0x59ca('0x67'));fs[_0x59ca('0x68')](_0x1170b0);}_0x1170b0=_0x1170b0+_0x59ca('0x69');if(!_[_0x59ca('0x63')](_0x3826ce[_0x59ca('0x51')])&&fs[_0x59ca('0x54')](_0x1170b0)){logger[_0x59ca('0x65')]('File:\x20\x22'+_0x1170b0+_0x59ca('0x67'));fs['unlinkSync'](_0x1170b0);}return _0x3826ce;})[_0x59ca('0x26')](function(_0x31ff01){if(!_0x31ff01)throw new InternalError();return _0x31ff01[_0x59ca('0x27')]();})['then'](function(){_0x1c7de7[_0x59ca('0x1d')](0xcc)[_0x59ca('0x1c')]();})['catch'](handleError(_0x1c7de7,null));};function getBucketslist(_0x4e760d,_0x67388,_0x32b0ad){return new Promise(function(_0x4b5a7c,_0x581af1){var _0x4184bf=new AWS['S3']({'accessKeyId':_0x67388,'secretAccessKey':_0x4e760d,'region':_0x32b0ad});_0x4184bf['listBuckets']({},function(_0x245475,_0xb3e908){if(_0x245475){return _0x581af1(_0x245475);}else{return _0x4b5a7c(_0xb3e908);}});});}function createBucket(_0x3fb27d,_0x15e14f,_0x18794d,_0x224f1b){return new Promise(function(_0xf399bc,_0x5c3a2b){var _0x36fa1a=new AWS['S3']({'accessKeyId':_0x15e14f,'secretAccessKey':_0x3fb27d,'region':_0x18794d});_0x36fa1a['createBucket']({'Bucket':_0x224f1b},function(_0x323b5c,_0x3a79a6){if(_0x323b5c){return _0x5c3a2b(_0x323b5c);}else{return _0xf399bc(_0x3a79a6);}});});}function uploadFile(_0x53a8a9,_0x7de3fc,_0x160e60,_0x438efd,_0x5a46af,_0x55b32d){return new Promise(function(_0x58ba81,_0x4c8465){var _0x329940=new AWS['S3']({'accessKeyId':_0x7de3fc,'secretAccessKey':_0x53a8a9,'region':_0x160e60});_0x329940['upload']({'Bucket':_0x438efd,'Key':_0x5a46af,'Body':_0x55b32d},function(_0x1243ba,_0x564e08){if(_0x1243ba){return _0x4c8465(_0x1243ba);}else{return _0x58ba81(_0x564e08);}});});}function startTranscribe(_0x47996c,_0x322406,_0x152128,_0x2f47a1,_0xebeb24,_0x3b4d27){return new Promise(function(_0x2b9e5a,_0xeef9d6){var _0x308f4d=new AWS['TranscribeService']({'accessKeyId':_0x322406,'secretAccessKey':_0x47996c,'region':_0x152128});_0x308f4d['startTranscriptionJob']({'TranscriptionJobName':_0x2f47a1,'LanguageCode':_0xebeb24,'Media':{'MediaFileUri':_0x3b4d27}},function(_0x3b8ba3,_0x46e202){if(_0x3b8ba3){return _0xeef9d6(_0x3b8ba3);}else{return _0x2b9e5a(_0x46e202);}});});}function transcribe(_0x37468e,_0x5c3ed6,_0x127af7,_0x16a027,_0x286ec5,_0x68cad7,_0x15b459){return new Promise(function(_0x30ba2a,_0x15055c){var _0x15d2db={};logger[_0x59ca('0x65')](util[_0x59ca('0x33')](_0x59ca('0x6a'),_0x37468e,_0x286ec5));return uploadFile(_0x5c3ed6,_0x127af7,_0x16a027,_0x286ec5,path[_0x59ca('0x6b')](_0x68cad7),fs[_0x59ca('0x6c')](_0x68cad7))[_0x59ca('0x26')](function(_0x2b7701){logger['info'](util[_0x59ca('0x33')](_0x59ca('0x6d'),_0x37468e,_0x286ec5,_0x2b7701[_0x59ca('0x6e')]));_0x15d2db[_0x59ca('0x6f')]=_0x2b7701[_0x59ca('0x70')];_0x15d2db[_0x59ca('0x71')]=_0x2b7701[_0x59ca('0x6e')];logger[_0x59ca('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x37468e));return startTranscribe(_0x5c3ed6,_0x127af7,_0x16a027,uuidv4(),_0x15b459,_0x2b7701[_0x59ca('0x6e')]);})['then'](function(_0x5d9ad7){logger[_0x59ca('0x65')](util[_0x59ca('0x33')](_0x59ca('0x72'),_0x37468e,_0x5d9ad7['TranscriptionJob'][_0x59ca('0x73')]));_0x15d2db[_0x59ca('0x74')]=_0x5d9ad7['TranscriptionJob'][_0x59ca('0x73')];_0x15d2db[_0x59ca('0x75')]=_0x5d9ad7[_0x59ca('0x76')][_0x59ca('0x77')];return _0x30ba2a(_0x15d2db);})[_0x59ca('0x45')](function(_0x4a244d){return _0x15055c(_0x4a244d);});});}exports[_0x59ca('0x78')]=function(_0x574959,_0x26b425,_0x42bc1){var _0x11e5d2;var _0x345296;var _0xa16a55;var _0x226e1e=require('../../components/encryptor');return db[_0x59ca('0x40')][_0x59ca('0x79')]({'where':{'id':_0x574959[_0x59ca('0x47')]['id']}})[_0x59ca('0x26')](function(_0x42e1cc){if(_0x42e1cc){var _0x43ecf8=util['format'](_0x59ca('0x7a'),_0x42e1cc[_0x59ca('0x51')]);if(fs[_0x59ca('0x54')](_0x43ecf8)){cypher=!![];return _0x226e1e[_0x59ca('0x52')](_0x43ecf8,_0x42e1cc[_0x59ca('0x51')],config['secrets'][_0x59ca('0x61')])[_0x59ca('0x26')](function(){return _0x42e1cc;});}return _0x42e1cc;}})[_0x59ca('0x26')](function(_0x109109){if(!_0x109109){throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))](_0x59ca('0x7b'));}_0x345296=_0x109109;return db[_0x59ca('0x7c')][_0x59ca('0x79')]({'where':{'id':0x1}});})[_0x59ca('0x26')](handleEntityNotFound(_0x26b425,null))['then'](function(_0x24cf9d){if(_0x24cf9d){_0x11e5d2=_0x24cf9d;if(!_0x11e5d2['transcribe']||!_0x11e5d2[_0x59ca('0x7d')]||!_0x11e5d2[_0x59ca('0x7e')]||!_0x11e5d2[_0x59ca('0x7f')]||!_0x11e5d2['bucket']){throw new db['Sequelize'][(_0x59ca('0x56'))]('Transcribe\x20not\x20configured');}if(_0x574959[_0x59ca('0x4c')][_0x59ca('0x80')]&&(!_0x11e5d2[_0x59ca('0x81')]||!_0x11e5d2[_0x59ca('0x82')]||!_0x11e5d2[_0x59ca('0x83')]||!_0x11e5d2[_0x59ca('0x7f')]||!_0x11e5d2[_0x59ca('0x6f')])){throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))](_0x59ca('0x84'));}return db[_0x59ca('0x85')]['findOne']({'where':{'id':_0x11e5d2[_0x59ca('0x7d')]}});}})['then'](function(_0x389b1b){if(!_0x389b1b){throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x389b1b[_0x59ca('0x86')]||!_0x389b1b[_0x59ca('0x87')]){throw new db[(_0x59ca('0x55'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xa16a55=_0x389b1b;return getBucketslist(_0xa16a55[_0x59ca('0x86')],_0xa16a55[_0x59ca('0x87')],_0x11e5d2[_0x59ca('0x7e')]);})['then'](function(_0x475e57){if(_0x475e57&&_0x475e57[_0x59ca('0x88')]){var _0x4e1178=_[_0x59ca('0x4a')](_0x475e57[_0x59ca('0x88')],function(_0x56cb4a){return _0x56cb4a['Name']===_0x11e5d2[_0x59ca('0x6f')];});if(!_0x4e1178){logger[_0x59ca('0x65')](util[_0x59ca('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x574959[_0x59ca('0x47')]['id'],_0x11e5d2[_0x59ca('0x6f')]));return createBucket(_0xa16a55[_0x59ca('0x86')],_0xa16a55[_0x59ca('0x87')],_0x11e5d2[_0x59ca('0x7e')],_0x11e5d2[_0x59ca('0x6f')]);}logger[_0x59ca('0x65')](util[_0x59ca('0x33')](_0x59ca('0x89'),_0x574959[_0x59ca('0x47')]['id'],_0x11e5d2[_0x59ca('0x6f')]));return;}})[_0x59ca('0x26')](function(_0x398fb6){if(_0x345296['transcribeStatus']===_0x59ca('0x8a')){return transcribe(_0x574959[_0x59ca('0x47')]['id'],_0xa16a55['data1'],_0xa16a55[_0x59ca('0x87')],_0x11e5d2[_0x59ca('0x7e')],_0x11e5d2[_0x59ca('0x6f')],_0x345296[_0x59ca('0x51')],_0x11e5d2['language']);}else{logger['info'](util[_0x59ca('0x33')](_0x59ca('0x8b'),_0x574959[_0x59ca('0x47')]['id']));return{'transcribeStatus':_0x59ca('0x8c')};}})[_0x59ca('0x26')](function(_0x4fe85a){if(_0x4fe85a){_0x4fe85a[_0x59ca('0x8d')]=_0x574959[_0x59ca('0x4c')]['runSentiment'];return _0x345296[_0x59ca('0x8e')](_0x4fe85a);}})['then'](respondWithResult(_0x26b425,null))[_0x59ca('0x45')](handleError(_0x26b425,null));};function writeFile(_0x5bcbb8,_0x5c384b){return new Promise(function(_0x2d33de,_0x270e0c){fs[_0x59ca('0x8f')](_0x5c384b,_0x5bcbb8,function(_0x3556fc,_0xdc9665){if(_0x3556fc){return _0x270e0c(_0x3556fc);}else{return _0x2d33de(_0xdc9665);}});});}exports['downloadTranscribe']=function(_0x4a0cce,_0x57a6bd,_0x55ac9c){return db[_0x59ca('0x40')]['findOne']({'where':{'id':_0x4a0cce[_0x59ca('0x47')]['id']}})[_0x59ca('0x26')](handleEntityNotFound(_0x57a6bd))[_0x59ca('0x26')](function(_0x2b0cfb){if(_0x2b0cfb&&_0x2b0cfb['fileText']){var _0x1306d8=_0x2b0cfb['fileText'];var _0x291403=config[_0x59ca('0x90')]+_0x59ca('0x91')+_0x2b0cfb['id']+_0x59ca('0x92');if(fs[_0x59ca('0x54')](_0x291403)){return _0x291403;}return writeFile(_0x1306d8,_0x291403)[_0x59ca('0x26')](function(){return _0x291403;});}else{throw new db[(_0x59ca('0x55'))][(_0x59ca('0x56'))](_0x59ca('0x93'));}})[_0x59ca('0x26')](function(_0x3e2078){return _0x57a6bd['download'](_0x3e2078);})[_0x59ca('0x45')](handleError(_0x57a6bd));}; \ No newline at end of file +var _0x4a45=['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','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','decryptFile','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','then','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','catch','create','body','find','describe','download','../../components/encryptor','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','downloads','sequelize','MD5','col','token','$and','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','.cypher','File:\x20\x22','destroy','listBuckets','createBucket','upload'];(function(_0x18fe4c,_0xddfd73){var _0x4eb877=function(_0x4fe300){while(--_0x4fe300){_0x18fe4c['push'](_0x18fe4c['shift']());}};_0x4eb877(++_0xddfd73);}(_0x4a45,0x1f2));var _0x54a4=function(_0x599d93,_0x4a96f7){_0x599d93=_0x599d93-0x0;var _0x562c68=_0x4a45[_0x599d93];return _0x562c68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x54a4('0x0'));var zipdir=require(_0x54a4('0x1'));var jsonpatch=require(_0x54a4('0x2'));var rp=require(_0x54a4('0x3'));var moment=require(_0x54a4('0x4'));var BPromise=require(_0x54a4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x54a4('0x6'));var csv=require(_0x54a4('0x7'));var ejs=require(_0x54a4('0x8'));var fs=require('fs');var fs_extra=require(_0x54a4('0x9'));var _=require(_0x54a4('0xa'));var squel=require(_0x54a4('0xb'));var crypto=require('crypto');var jsforce=require(_0x54a4('0xc'));var deskjs=require(_0x54a4('0xd'));var toCsv=require(_0x54a4('0x7'));var querystring=require(_0x54a4('0xe'));var Papa=require(_0x54a4('0xf'));var AWS=require('aws-sdk');var uuidv4=require(_0x54a4('0x10'));var Redis=require('ioredis');var authService=require(_0x54a4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x54a4('0x12'));var hardwareService=require(_0x54a4('0x13'));var logger=require(_0x54a4('0x14'))('api');var utils=require(_0x54a4('0x15'));var config=require(_0x54a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x54a4('0x17'))['db'];function respondWithStatusCode(_0x4dd252,_0x71309){_0x71309=_0x71309||0xcc;return function(_0xb13049){if(_0xb13049){return _0x4dd252[_0x54a4('0x18')](_0x71309);}return _0x4dd252[_0x54a4('0x19')](_0x71309)[_0x54a4('0x1a')]();};}function respondWithResult(_0x45973e,_0x163427){_0x163427=_0x163427||0xc8;return function(_0x46891d){if(_0x46891d){return _0x45973e[_0x54a4('0x19')](_0x163427)[_0x54a4('0x1b')](_0x46891d);}};}function respondWithFilteredResult(_0x60a604,_0x46671d){return function(_0x40d26b){if(_0x40d26b){var _0x761e9=typeof _0x46671d[_0x54a4('0x1c')]===_0x54a4('0x1d')&&typeof _0x46671d[_0x54a4('0x1e')]===_0x54a4('0x1d');var _0x143b7f=_0x40d26b['count'];var _0x1e7905=_0x761e9?0x0:_0x46671d['offset'];var _0x533534=_0x761e9?_0x40d26b['count']:_0x46671d['offset']+_0x46671d[_0x54a4('0x1e')];var _0x1137fa;if(_0x533534>=_0x143b7f){_0x533534=_0x143b7f;_0x1137fa=0xc8;}else{_0x1137fa=0xce;}_0x60a604['status'](_0x1137fa);return _0x60a604['set']('Content-Range',_0x1e7905+'-'+_0x533534+'/'+_0x143b7f)['json'](_0x40d26b);}return null;};}function patchUpdates(_0x54d78e){return function(_0x280746){try{jsonpatch[_0x54a4('0x1f')](_0x280746,_0x54d78e,!![]);}catch(_0xb09df1){return BPromise[_0x54a4('0x20')](_0xb09df1);}return _0x280746[_0x54a4('0x21')]();};}function saveUpdates(_0x526c47,_0x1528cd){return function(_0xcdacc5){if(_0xcdacc5){return _0xcdacc5[_0x54a4('0x22')](_0x526c47)[_0x54a4('0x23')](function(_0x1f0a4c){return _0x1f0a4c;});}return null;};}function removeEntity(_0x2a617b,_0xc0ac67){return function(_0x48fe9a){if(_0x48fe9a){return _0x48fe9a['destroy']()[_0x54a4('0x23')](function(){_0x2a617b[_0x54a4('0x19')](0xcc)[_0x54a4('0x1a')]();});}};}function handleEntityNotFound(_0x31dcc8,_0x5c6dc1){return function(_0x1219da){if(!_0x1219da){_0x31dcc8[_0x54a4('0x18')](0x194);}return _0x1219da;};}function handleError(_0x577f57,_0x5b0071){_0x5b0071=_0x5b0071||0x1f4;return function(_0x47a670){logger['error'](_0x47a670[_0x54a4('0x24')]);if(_0x47a670[_0x54a4('0x25')]){delete _0x47a670[_0x54a4('0x25')];}_0x577f57['status'](_0x5b0071)['send'](_0x47a670);};}exports[_0x54a4('0x26')]=function(_0x568e8d,_0x35620a){var _0x487937={},_0x1392fe={},_0x17a521={'count':0x0,'rows':[]};var _0x2ada2d=_[_0x54a4('0x27')](db[_0x54a4('0x28')][_0x54a4('0x29')],function(_0x1d326d){return{'name':_0x1d326d[_0x54a4('0x2a')],'type':_0x1d326d[_0x54a4('0x2b')]['key']};});_0x1392fe[_0x54a4('0x2c')]=_[_0x54a4('0x2d')](_[_0x54a4('0x27')](_0x2ada2d,_0x54a4('0x25')),[_0x54a4('0x2e')]);_0x1392fe[_0x54a4('0x2f')]=_[_0x54a4('0x30')](_0x568e8d['query']);_0x1392fe[_0x54a4('0x31')]=_[_0x54a4('0x32')](_0x1392fe[_0x54a4('0x2c')],_0x1392fe[_0x54a4('0x2f')]);_0x487937['attributes']=_[_0x54a4('0x32')](_0x1392fe['model'],qs[_0x54a4('0x33')](_0x568e8d[_0x54a4('0x2f')][_0x54a4('0x33')]));_0x487937[_0x54a4('0x34')]=_0x487937[_0x54a4('0x34')][_0x54a4('0x35')]?_0x487937[_0x54a4('0x34')]:_0x1392fe[_0x54a4('0x2c')];if(!_0x568e8d[_0x54a4('0x2f')][_0x54a4('0x36')](_0x54a4('0x37'))){_0x487937[_0x54a4('0x1e')]=qs[_0x54a4('0x1e')](_0x568e8d[_0x54a4('0x2f')][_0x54a4('0x1e')]);_0x487937['offset']=qs[_0x54a4('0x1c')](_0x568e8d['query']['offset']);}_0x487937[_0x54a4('0x38')]=qs[_0x54a4('0x39')](_0x568e8d[_0x54a4('0x2f')][_0x54a4('0x39')]);_0x487937[_0x54a4('0x3a')]=qs['filters'](_[_0x54a4('0x3b')](_0x568e8d[_0x54a4('0x2f')],_0x1392fe[_0x54a4('0x31')]),_0x2ada2d);if(_0x568e8d[_0x54a4('0x2f')][_0x54a4('0x3c')]){_0x487937[_0x54a4('0x3a')]=_[_0x54a4('0x3d')](_0x487937['where'],{'$or':_[_0x54a4('0x27')](_0x2ada2d,function(_0xb381a3){if(_0xb381a3[_0x54a4('0x2b')]!==_0x54a4('0x3e')){var _0x15efb5={};_0x15efb5[_0xb381a3[_0x54a4('0x25')]]={'$like':'%'+_0x568e8d['query'][_0x54a4('0x3c')]+'%'};return _0x15efb5;}})});}_0x487937=_[_0x54a4('0x3d')]({},_0x487937,_0x568e8d[_0x54a4('0x3f')]);var _0x5952d6={'where':_0x487937['where']};return db[_0x54a4('0x28')][_0x54a4('0x40')](_0x5952d6)[_0x54a4('0x23')](function(_0x420182){_0x17a521[_0x54a4('0x40')]=_0x420182;if(_0x568e8d['query'][_0x54a4('0x41')]){_0x487937[_0x54a4('0x42')]=[{'all':!![]}];}return db[_0x54a4('0x28')][_0x54a4('0x43')](_0x487937);})[_0x54a4('0x23')](function(_0x1d5d78){_0x17a521[_0x54a4('0x44')]=_0x1d5d78;return _0x17a521;})[_0x54a4('0x23')](respondWithFilteredResult(_0x35620a,_0x487937))['catch'](handleError(_0x35620a,null));};exports['show']=function(_0x5b9f83,_0x4cc840){var _0x285ebe={'raw':![],'where':{'id':_0x5b9f83[_0x54a4('0x45')]['id']}},_0x3277e9={};_0x3277e9['model']=_['keys'](db[_0x54a4('0x28')][_0x54a4('0x29')]);_0x3277e9[_0x54a4('0x2f')]=_[_0x54a4('0x30')](_0x5b9f83[_0x54a4('0x2f')]);_0x3277e9[_0x54a4('0x31')]=_[_0x54a4('0x32')](_0x3277e9[_0x54a4('0x2c')],_0x3277e9['query']);_0x285ebe[_0x54a4('0x34')]=_[_0x54a4('0x32')](_0x3277e9[_0x54a4('0x2c')],qs[_0x54a4('0x33')](_0x5b9f83['query']['fields']));_0x285ebe[_0x54a4('0x34')]=_0x285ebe[_0x54a4('0x34')][_0x54a4('0x35')]?_0x285ebe['attributes']:_0x3277e9[_0x54a4('0x2c')];if(_0x5b9f83[_0x54a4('0x2f')][_0x54a4('0x41')]){_0x285ebe[_0x54a4('0x42')]=[{'all':!![]}];}_0x285ebe=_[_0x54a4('0x3d')]({},_0x285ebe,_0x5b9f83[_0x54a4('0x3f')]);return db[_0x54a4('0x28')]['find'](_0x285ebe)[_0x54a4('0x23')](handleEntityNotFound(_0x4cc840,null))[_0x54a4('0x23')](respondWithResult(_0x4cc840,null))[_0x54a4('0x46')](handleError(_0x4cc840,null));};exports['create']=function(_0x2deeec,_0x15cb94){return db[_0x54a4('0x28')][_0x54a4('0x47')](_0x2deeec[_0x54a4('0x48')],{})[_0x54a4('0x23')](respondWithResult(_0x15cb94,0xc9))[_0x54a4('0x46')](handleError(_0x15cb94,null));};exports[_0x54a4('0x22')]=function(_0x354f7e,_0x4838cb){if(_0x354f7e[_0x54a4('0x48')]['id']){delete _0x354f7e[_0x54a4('0x48')]['id'];}return db[_0x54a4('0x28')][_0x54a4('0x49')]({'where':{'id':_0x354f7e[_0x54a4('0x45')]['id']}})[_0x54a4('0x23')](handleEntityNotFound(_0x4838cb,null))[_0x54a4('0x23')](saveUpdates(_0x354f7e['body'],null))[_0x54a4('0x23')](respondWithResult(_0x4838cb,null))[_0x54a4('0x46')](handleError(_0x4838cb,null));};exports[_0x54a4('0x4a')]=function(_0x22c06c,_0x43950d){return db[_0x54a4('0x28')][_0x54a4('0x4a')]()[_0x54a4('0x23')](respondWithResult(_0x43950d,null))['catch'](handleError(_0x43950d,null));};exports[_0x54a4('0x4b')]=function(_0x52d4e1,_0x3fff91,_0x2be0cd){var _0x30d30e=require(_0x54a4('0x4c'));var _0x29d783=![];var _0x23ab14={};if(_0x52d4e1[_0x54a4('0x2f')][_0x54a4('0x2b')]&&_0x52d4e1[_0x54a4('0x2f')][_0x54a4('0x2b')]==='uniqueid'){_0x23ab14['uniqueid']=_0x52d4e1['params']['id'];}else{_0x23ab14['id']=_0x52d4e1[_0x54a4('0x45')]['id'];}return db['VoiceRecording']['find']({'where':_0x23ab14,'attributes':['id',_0x54a4('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x3fff91,null))['then'](function(_0x570c5f){if(_0x570c5f){var _0x5c53f3=_0x570c5f[_0x54a4('0x4d')];var _0x42b9ee=util[_0x54a4('0x2e')](_0x54a4('0x4e'),_0x5c53f3);if(fs[_0x54a4('0x4f')](_0x42b9ee)){_0x29d783=!![];return _0x30d30e['decryptFile'](_0x42b9ee,_0x5c53f3,config[_0x54a4('0x50')][_0x54a4('0x51')])[_0x54a4('0x23')](function(){return _0x570c5f;});}return _0x570c5f;}})[_0x54a4('0x23')](function(_0x5262ec){if(_0x5262ec){var _0x309cbb=_0x5262ec[_0x54a4('0x4d')];if(!fs[_0x54a4('0x4f')](_0x309cbb)){throw new db[(_0x54a4('0x52'))][(_0x54a4('0x53'))](_0x54a4('0x54'));}if(_0x5262ec['filename']){return _0x3fff91['download'](_0x309cbb,_0x5262ec[_0x54a4('0x55')]+path[_0x54a4('0x56')](_0x309cbb),function(){if(_0x29d783){fs[_0x54a4('0x57')](_0x309cbb);}});}else{return _0x3fff91[_0x54a4('0x4b')](_0x309cbb,function(_0x3aecf7){if(_0x29d783){fs[_0x54a4('0x57')](_0x309cbb);}});}}})[_0x54a4('0x46')](function(_0x196708){if(_0x196708[_0x54a4('0x58')]===_0x54a4('0x54')){_0x3fff91[_0x54a4('0x19')](0x194)[_0x54a4('0x59')]('Not\x20found');}else{return handleError(_0x3fff91,null);}});};exports[_0x54a4('0x5a')]=function(_0x41f1e2,_0xcdfbd6,_0x15604e){var _0x4607ef=require(_0x54a4('0x4c'));var _0x2f835a=![];var _0x410e13={'$and':[db[_0x54a4('0x5b')][_0x54a4('0x3a')](db[_0x54a4('0x5b')]['fn'](_0x54a4('0x5c'),db[_0x54a4('0x5b')][_0x54a4('0x5d')]('uniqueid')),_0x41f1e2[_0x54a4('0x2f')][_0x54a4('0x5e')])]};if(_0x41f1e2[_0x54a4('0x2f')][_0x54a4('0x2b')]&&_0x41f1e2['query'][_0x54a4('0x2b')]==='uniqueid'){_0x410e13['$and']['push']({'uniqueid':_0x41f1e2['params']['id']});}else{_0x410e13[_0x54a4('0x5f')]['push']({'id':_0x41f1e2[_0x54a4('0x45')]['id']});}return db[_0x54a4('0x28')]['find']({'where':_0x410e13,'attributes':['id',_0x54a4('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xcdfbd6,null))[_0x54a4('0x23')](function(_0x42f966){if(_0x42f966){var _0x52492f=util[_0x54a4('0x2e')](_0x54a4('0x4e'),_0x42f966[_0x54a4('0x4d')]);if(fs[_0x54a4('0x4f')](_0x52492f)){_0x2f835a=!![];return _0x4607ef['decryptFile'](_0x52492f,_0x42f966[_0x54a4('0x4d')],config[_0x54a4('0x50')][_0x54a4('0x51')])[_0x54a4('0x23')](function(){return _0x42f966;});}return _0x42f966;}})[_0x54a4('0x23')](function(_0x33a8d3){if(_0x33a8d3){if(!fs['existsSync'](_0x33a8d3[_0x54a4('0x4d')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x33a8d3[_0x54a4('0x55')]){return _0xcdfbd6['download'](_0x33a8d3[_0x54a4('0x4d')],_0x33a8d3[_0x54a4('0x55')]+path[_0x54a4('0x56')](_0x33a8d3[_0x54a4('0x4d')]),function(){if(_0x2f835a){fs[_0x54a4('0x57')](_0x33a8d3[_0x54a4('0x4d')]);}});}else{return _0xcdfbd6[_0x54a4('0x4b')](_0x33a8d3[_0x54a4('0x4d')],function(_0x1e0e01){if(_0x2f835a){fs[_0x54a4('0x57')](_0x33a8d3[_0x54a4('0x4d')]);}});}}})['catch'](handleError(_0xcdfbd6,null));};exports['destroy']=function(_0xbb2023,_0x1ef9bc){return db[_0x54a4('0x28')]['find']({'where':{'id':_0xbb2023['params']['id']}})[_0x54a4('0x23')](function(_0x442d4c){if(_[_0x54a4('0x60')](_0x442d4c)){throw new ReferenceError(_0x54a4('0x61'));}return _0x442d4c;})[_0x54a4('0x23')](function(_0x38c3a8){var _0x4721b5=_0x38c3a8['value'];logger['info'](_0x54a4('0x62'),_0x4721b5);if(!_[_0x54a4('0x60')](_0x38c3a8[_0x54a4('0x4d')])&&fs['existsSync'](_0x4721b5)){logger[_0x54a4('0x63')]('File:\x20\x22'+_0x4721b5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4721b5);}_0x4721b5=_0x4721b5+_0x54a4('0x64');if(!_[_0x54a4('0x60')](_0x38c3a8[_0x54a4('0x4d')])&&fs[_0x54a4('0x4f')](_0x4721b5)){logger[_0x54a4('0x63')](_0x54a4('0x65')+_0x4721b5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4721b5);}return _0x38c3a8;})[_0x54a4('0x23')](function(_0x25d617){if(!_0x25d617)throw new InternalError();return _0x25d617[_0x54a4('0x66')]();})['then'](function(){_0x1ef9bc[_0x54a4('0x19')](0xcc)[_0x54a4('0x1a')]();})[_0x54a4('0x46')](handleError(_0x1ef9bc,null));};function getBucketslist(_0x38ec87,_0x15a052,_0x337533){return new Promise(function(_0x147954,_0x3a2183){var _0x1b0a14=new AWS['S3']({'accessKeyId':_0x15a052,'secretAccessKey':_0x38ec87,'region':_0x337533});_0x1b0a14[_0x54a4('0x67')]({},function(_0x6de0cd,_0x238785){if(_0x6de0cd){return _0x3a2183(_0x6de0cd);}else{return _0x147954(_0x238785);}});});}function createBucket(_0x223853,_0x575ae1,_0x9b60ed,_0x355559){return new Promise(function(_0x342918,_0x5d087f){var _0x575d39=new AWS['S3']({'accessKeyId':_0x575ae1,'secretAccessKey':_0x223853,'region':_0x9b60ed});_0x575d39[_0x54a4('0x68')]({'Bucket':_0x355559},function(_0x2b2cbb,_0x3cccf2){if(_0x2b2cbb){return _0x5d087f(_0x2b2cbb);}else{return _0x342918(_0x3cccf2);}});});}function uploadFile(_0xd53120,_0x58a022,_0x2aa666,_0x31e8db,_0x22120b,_0x82b35){return new Promise(function(_0x478d26,_0x2ea06c){var _0x4fdfd3=new AWS['S3']({'accessKeyId':_0x58a022,'secretAccessKey':_0xd53120,'region':_0x2aa666});_0x4fdfd3[_0x54a4('0x69')]({'Bucket':_0x31e8db,'Key':_0x22120b,'Body':_0x82b35},function(_0x2f3b16,_0x478bdf){if(_0x2f3b16){return _0x2ea06c(_0x2f3b16);}else{return _0x478d26(_0x478bdf);}});});}function startTranscribe(_0x18025c,_0x19c9e0,_0x302187,_0x415ca3,_0x1378ca,_0x1bafbb){return new Promise(function(_0x5b618a,_0x3931f8){var _0x20e8d7=new AWS[(_0x54a4('0x6a'))]({'accessKeyId':_0x19c9e0,'secretAccessKey':_0x18025c,'region':_0x302187});_0x20e8d7['startTranscriptionJob']({'TranscriptionJobName':_0x415ca3,'LanguageCode':_0x1378ca,'Media':{'MediaFileUri':_0x1bafbb}},function(_0x5b0bb1,_0x39bb67){if(_0x5b0bb1){return _0x3931f8(_0x5b0bb1);}else{return _0x5b618a(_0x39bb67);}});});}function transcribe(_0xcf912,_0x17b77b,_0x48b3fb,_0x14543b,_0x17d929,_0x4d7358,_0x556ada){return new Promise(function(_0x2f7174,_0x26f8e5){var _0xf9e82f={};logger['info'](util[_0x54a4('0x2e')](_0x54a4('0x6b'),_0xcf912,_0x17d929));return uploadFile(_0x17b77b,_0x48b3fb,_0x14543b,_0x17d929,path['basename'](_0x4d7358),fs[_0x54a4('0x6c')](_0x4d7358))['then'](function(_0xe4ae8){logger[_0x54a4('0x63')](util['format'](_0x54a4('0x6d'),_0xcf912,_0x17d929,_0xe4ae8[_0x54a4('0x6e')]));_0xf9e82f[_0x54a4('0x6f')]=_0xe4ae8[_0x54a4('0x70')];_0xf9e82f[_0x54a4('0x71')]=_0xe4ae8['Location'];logger[_0x54a4('0x63')](util['format'](_0x54a4('0x72'),_0xcf912));return startTranscribe(_0x17b77b,_0x48b3fb,_0x14543b,uuidv4(),_0x556ada,_0xe4ae8[_0x54a4('0x6e')]);})[_0x54a4('0x23')](function(_0x46108e){logger['info'](util['format'](_0x54a4('0x73'),_0xcf912,_0x46108e[_0x54a4('0x74')]['TranscriptionJobName']));_0xf9e82f[_0x54a4('0x75')]=_0x46108e[_0x54a4('0x74')][_0x54a4('0x76')];_0xf9e82f[_0x54a4('0x77')]=_0x46108e[_0x54a4('0x74')]['TranscriptionJobStatus'];return _0x2f7174(_0xf9e82f);})[_0x54a4('0x46')](function(_0x4888b2){return _0x26f8e5(_0x4888b2);});});}exports[_0x54a4('0x78')]=function(_0xfa3afd,_0x1894fe,_0x347add){var _0x1f98b2;var _0x2d9499;var _0x394804;var _0x2fe1b6=require(_0x54a4('0x4c'));return db[_0x54a4('0x28')]['findOne']({'where':{'id':_0xfa3afd[_0x54a4('0x45')]['id']}})[_0x54a4('0x23')](function(_0x5dffb0){if(_0x5dffb0){var _0x3264ab=util['format'](_0x54a4('0x4e'),_0x5dffb0[_0x54a4('0x4d')]);if(fs[_0x54a4('0x4f')](_0x3264ab)){cypher=!![];return _0x2fe1b6[_0x54a4('0x79')](_0x3264ab,_0x5dffb0['value'],config[_0x54a4('0x50')][_0x54a4('0x51')])[_0x54a4('0x23')](function(){return _0x5dffb0;});}return _0x5dffb0;}})[_0x54a4('0x23')](function(_0x1465eb){if(!_0x1465eb){throw new db['Sequelize'][(_0x54a4('0x53'))]('Voice\x20Recording\x20not\x20found');}_0x2d9499=_0x1465eb;return db['Setting'][_0x54a4('0x7a')]({'where':{'id':0x1}});})[_0x54a4('0x23')](handleEntityNotFound(_0x1894fe,null))[_0x54a4('0x23')](function(_0x3de777){if(_0x3de777){_0x1f98b2=_0x3de777;if(!_0x1f98b2[_0x54a4('0x7b')]||!_0x1f98b2[_0x54a4('0x7c')]||!_0x1f98b2[_0x54a4('0x7d')]||!_0x1f98b2[_0x54a4('0x7e')]||!_0x1f98b2[_0x54a4('0x6f')]){throw new db[(_0x54a4('0x52'))][(_0x54a4('0x53'))](_0x54a4('0x7f'));}if(_0xfa3afd['body'][_0x54a4('0x80')]&&(!_0x1f98b2[_0x54a4('0x81')]||!_0x1f98b2[_0x54a4('0x82')]||!_0x1f98b2[_0x54a4('0x83')]||!_0x1f98b2[_0x54a4('0x7e')]||!_0x1f98b2[_0x54a4('0x6f')])){throw new db[(_0x54a4('0x52'))][(_0x54a4('0x53'))](_0x54a4('0x84'));}return db[_0x54a4('0x85')][_0x54a4('0x7a')]({'where':{'id':_0x1f98b2[_0x54a4('0x7c')]}});}})['then'](function(_0x4acc96){if(!_0x4acc96){throw new db['Sequelize'][(_0x54a4('0x53'))](_0x54a4('0x86'));}if(!_0x4acc96[_0x54a4('0x87')]||!_0x4acc96[_0x54a4('0x88')]){throw new db['Sequelize'][(_0x54a4('0x53'))](_0x54a4('0x89'));}_0x394804=_0x4acc96;return getBucketslist(_0x394804['data1'],_0x394804[_0x54a4('0x88')],_0x1f98b2[_0x54a4('0x7d')]);})[_0x54a4('0x23')](function(_0x457231){if(_0x457231&&_0x457231[_0x54a4('0x8a')]){var _0x54f023=_[_0x54a4('0x49')](_0x457231['Buckets'],function(_0x1d2637){return _0x1d2637[_0x54a4('0x8b')]===_0x1f98b2[_0x54a4('0x6f')];});if(!_0x54f023){logger[_0x54a4('0x63')](util[_0x54a4('0x2e')](_0x54a4('0x8c'),_0xfa3afd[_0x54a4('0x45')]['id'],_0x1f98b2['bucket']));return createBucket(_0x394804[_0x54a4('0x87')],_0x394804['data2'],_0x1f98b2[_0x54a4('0x7d')],_0x1f98b2['bucket']);}logger[_0x54a4('0x63')](util[_0x54a4('0x2e')](_0x54a4('0x8d'),_0xfa3afd['params']['id'],_0x1f98b2['bucket']));return;}})[_0x54a4('0x23')](function(_0x2c2a44){if(_0x2d9499['transcribeStatus']==='NEW'){return transcribe(_0xfa3afd['params']['id'],_0x394804[_0x54a4('0x87')],_0x394804[_0x54a4('0x88')],_0x1f98b2['transcribeRegion'],_0x1f98b2[_0x54a4('0x6f')],_0x2d9499[_0x54a4('0x4d')],_0x1f98b2[_0x54a4('0x7e')]);}else{logger['info'](util[_0x54a4('0x2e')](_0x54a4('0x8e'),_0xfa3afd[_0x54a4('0x45')]['id']));return{'transcribeStatus':_0x54a4('0x8f')};}})[_0x54a4('0x23')](function(_0x39d0f0){if(_0x39d0f0){_0x39d0f0[_0x54a4('0x90')]=_0xfa3afd['body'][_0x54a4('0x80')];return _0x2d9499[_0x54a4('0x91')](_0x39d0f0);}})[_0x54a4('0x23')](respondWithResult(_0x1894fe,null))[_0x54a4('0x46')](handleError(_0x1894fe,null));};function writeFile(_0x3df0ad,_0x52d6e7){return new Promise(function(_0x1d8fb0,_0x15eb71){fs[_0x54a4('0x92')](_0x52d6e7,_0x3df0ad,function(_0x118665,_0x2d3543){if(_0x118665){return _0x15eb71(_0x118665);}else{return _0x1d8fb0(_0x2d3543);}});});}exports['downloadTranscribe']=function(_0x4585d7,_0x287acf,_0x12c57d){return db[_0x54a4('0x28')]['findOne']({'where':{'id':_0x4585d7['params']['id']}})['then'](handleEntityNotFound(_0x287acf))[_0x54a4('0x23')](function(_0x5d43e9){if(_0x5d43e9&&_0x5d43e9['fileText']){var _0x3bd8d2=_0x5d43e9[_0x54a4('0x93')];var _0x81224a=config['root']+_0x54a4('0x94')+_0x5d43e9['id']+_0x54a4('0x95');if(fs['existsSync'](_0x81224a)){return _0x81224a;}return writeFile(_0x3bd8d2,_0x81224a)['then'](function(){return _0x81224a;});}else{throw new db[(_0x54a4('0x52'))][(_0x54a4('0x53'))](_0x54a4('0x96'));}})[_0x54a4('0x23')](function(_0x19a035){return _0x287acf[_0x54a4('0x4b')](_0x19a035);})['catch'](handleError(_0x287acf));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 44d479c..7cbb531 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 _0x21cb=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a1eb2,_0xfd0b2c){var _0xd8540c=function(_0x409c4d){while(--_0x409c4d){_0x4a1eb2['push'](_0x4a1eb2['shift']());}};_0xd8540c(++_0xfd0b2c);}(_0x21cb,0x19a));var _0xb21c=function(_0x20c865,_0x3e3f3c){_0x20c865=_0x20c865-0x0;var _0x27d5d7=_0x21cb[_0x20c865];return _0x27d5d7;};'use strict';var _=require(_0xb21c('0x0'));var util=require(_0xb21c('0x1'));var logger=require(_0xb21c('0x2'))(_0xb21c('0x3'));var moment=require(_0xb21c('0x4'));var BPromise=require(_0xb21c('0x5'));var rp=require(_0xb21c('0x6'));var fs=require('fs');var path=require(_0xb21c('0x7'));var rimraf=require(_0xb21c('0x8'));var config=require(_0xb21c('0x9'));var attributes=require(_0xb21c('0xa'));module[_0xb21c('0xb')]=function(_0x156c41,_0x53c7c6){return _0x156c41[_0xb21c('0xc')]('VoiceRecording',attributes,{'tableName':_0xb21c('0xd'),'paranoid':![],'indexes':[{'name':_0xb21c('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9da2=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','voice_recordings','uniqueid','lodash'];(function(_0x5552cf,_0x88f562){var _0x322baf=function(_0x54f74b){while(--_0x54f74b){_0x5552cf['push'](_0x5552cf['shift']());}};_0x322baf(++_0x88f562);}(_0x9da2,0x15b));var _0x29da=function(_0x4879b8,_0x13643d){_0x4879b8=_0x4879b8-0x0;var _0x12ad43=_0x9da2[_0x4879b8];return _0x12ad43;};'use strict';var _=require(_0x29da('0x0'));var util=require(_0x29da('0x1'));var logger=require(_0x29da('0x2'))(_0x29da('0x3'));var moment=require(_0x29da('0x4'));var BPromise=require(_0x29da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x29da('0x6'));var rimraf=require('rimraf');var config=require(_0x29da('0x7'));var attributes=require('./voiceRecording.attributes');module[_0x29da('0x8')]=function(_0x125144,_0xf80835){return _0x125144[_0x29da('0x9')]('VoiceRecording',attributes,{'tableName':_0x29da('0xa'),'paranoid':![],'indexes':[{'name':_0x29da('0xb'),'fields':[_0x29da('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c244cea..71589ea 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 _0xbbbc=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','stringify'];(function(_0x59d228,_0x183f1d){var _0x583088=function(_0x2b49f1){while(--_0x2b49f1){_0x59d228['push'](_0x59d228['shift']());}};_0x583088(++_0x183f1d);}(_0xbbbc,0xf6));var _0xcbbb=function(_0xa54031,_0x21531e){_0xa54031=_0xa54031-0x0;var _0x3c201f=_0xbbbc[_0xa54031];return _0x3c201f;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['VoiceRecording'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1a')]||null:null,'attributes':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')]['attributes']||null:null,'limit':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x1b')]||null:null})[_0xcbbb('0xd')](function(_0x258d1f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')](_0xcbbb('0x15'),_0x3436af,JSON['stringify'](_0x258d1f));_0x5052df(_0x258d1f);})[_0xcbbb('0x14')](function(_0x4490c1){logger['error'](_0xcbbb('0x15'),_0x4490c1['message'],_0x3436af);_0x57c5e9(_0x3572bb['error'](0x1f4,_0x4490c1[_0xcbbb('0x12')]));});});};exports[_0xcbbb('0x1c')]=function(_0x548440){var _0x59c422=this;return new Promise(function(_0x5499a1,_0x4439ea){var _0x55e1d8=require('../../components/encryptor');var _0x21e3b1;return db[_0xcbbb('0x1d')][_0xcbbb('0x1e')]({'attributes':['id',_0xcbbb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xcbbb('0xd')](function(_0x39ba8b){_0x21e3b1=_0x39ba8b;return db[_0xcbbb('0x20')][_0xcbbb('0x21')](_0x548440[_0xcbbb('0x17')]);})[_0xcbbb('0xd')](function(_0x1c2ac9){if(_0x21e3b1[_0xcbbb('0x1f')]&&fs[_0xcbbb('0x22')](_0x1c2ac9[_0xcbbb('0x23')])){var _0x2a9639=util[_0xcbbb('0x24')](_0xcbbb('0x25'),_0x1c2ac9[_0xcbbb('0x23')]);return _0x55e1d8['encryptFile'](_0x1c2ac9[_0xcbbb('0x23')],_0x2a9639,config[_0xcbbb('0x26')]['recording'])[_0xcbbb('0xd')](function(){fs['unlink'](_0x1c2ac9[_0xcbbb('0x23')]);logger[_0xcbbb('0xe')](_0xcbbb('0x27'));return _0x1c2ac9;});}return _0x1c2ac9;})['then'](function(_0x38ee99){logger[_0xcbbb('0xe')](_0xcbbb('0x1c'),_0x548440);logger[_0xcbbb('0xf')](_0xcbbb('0x1c'),_0x548440,JSON[_0xcbbb('0x28')](_0x38ee99));_0x5499a1(_0x38ee99);})[_0xcbbb('0x14')](function(_0x1ac1a2){logger[_0xcbbb('0x11')](_0xcbbb('0x1c'),_0x1ac1a2['message'],_0x548440);_0x4439ea(_0x59c422['error'](0x1f4,_0x1ac1a2['message']));});});}; \ No newline at end of file +var _0x8952=['message','result','catch','UpdateVoiceRecording','VoiceRecording','update','raw','options','attributes','debug','../../components/encryptor','Setting','create','callRecordingEncryption','existsSync','value','format','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','VoiceRecording,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8952,0x17e));var _0x2895=function(_0x24f965,_0x57e255){_0x24f965=_0x24f965-0x0;var _0x33b8da=_0x8952[_0x24f965];return _0x33b8da;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});}exports[_0x2895('0x15')]=function(_0xbf8b63){var _0x2cb505=this;return new Promise(function(_0x155124,_0x184d11){return db[_0x2895('0x16')][_0x2895('0x17')](_0xbf8b63['body'],{'raw':_0xbf8b63['options']?_0xbf8b63['options'][_0x2895('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')]['where']||null:null,'attributes':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')][_0x2895('0x1a')]||null:null,'limit':_0xbf8b63[_0x2895('0x19')]?_0xbf8b63[_0x2895('0x19')]['limit']||null:null})[_0x2895('0xc')](function(_0x5e93a4){logger['info'](_0x2895('0x15'),_0xbf8b63);logger[_0x2895('0x1b')](_0x2895('0x15'),_0xbf8b63,JSON['stringify'](_0x5e93a4));_0x155124(_0x5e93a4);})['catch'](function(_0x3a72fa){logger[_0x2895('0x10')](_0x2895('0x15'),_0x3a72fa['message'],_0xbf8b63);_0x184d11(_0x2cb505[_0x2895('0x10')](0x1f4,_0x3a72fa[_0x2895('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x293ad3){var _0x127540=this;return new Promise(function(_0x2cd4df,_0x5c6c21){var _0x320661=require(_0x2895('0x1c'));var _0x5eedfc;return db[_0x2895('0x1d')]['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x2895('0xc')](function(_0x4ee2cc){_0x5eedfc=_0x4ee2cc;return db[_0x2895('0x16')][_0x2895('0x1e')](_0x293ad3['body']);})['then'](function(_0x32db49){if(_0x5eedfc[_0x2895('0x1f')]&&fs[_0x2895('0x20')](_0x32db49[_0x2895('0x21')])){var _0x14d150=util[_0x2895('0x22')](_0x2895('0x23'),_0x32db49['value']);return _0x320661[_0x2895('0x24')](_0x32db49[_0x2895('0x21')],_0x14d150,config[_0x2895('0x25')]['recording'])[_0x2895('0xc')](function(){fs[_0x2895('0x26')](_0x32db49[_0x2895('0x21')]);logger[_0x2895('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x32db49;});}return _0x32db49;})[_0x2895('0xc')](function(_0xe594ff){logger[_0x2895('0xd')](_0x2895('0x27'),_0x293ad3);logger[_0x2895('0x1b')]('CreateVoiceRecording',_0x293ad3,JSON['stringify'](_0xe594ff));_0x2cd4df(_0xe594ff);})[_0x2895('0x14')](function(_0xf3c8f7){logger['error'](_0x2895('0x27'),_0xf3c8f7['message'],_0x293ad3);_0x5c6c21(_0x127540[_0x2895('0x10')](0x1f4,_0xf3c8f7[_0x2895('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 23eea3c..8b866ed 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 _0x1128=['get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x480282,_0x40d4d8){var _0x4faf42=function(_0x15bccc){while(--_0x15bccc){_0x480282['push'](_0x480282['shift']());}};_0x4faf42(++_0x40d4d8);}(_0x1128,0x7b));var _0x8112=function(_0x1c50d3,_0x12c737){_0x1c50d3=_0x1c50d3-0x0;var _0x281903=_0x1128[_0x1c50d3];return _0x281903;};'use strict';var multer=require(_0x8112('0x0'));var util=require(_0x8112('0x1'));var path=require(_0x8112('0x2'));var timeout=require(_0x8112('0x3'));var express=require(_0x8112('0x4'));var router=express[_0x8112('0x5')]();var fs_extra=require(_0x8112('0x6'));var auth=require(_0x8112('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8112('0x8'));var controller=require(_0x8112('0x9'));router[_0x8112('0xa')]('/',auth[_0x8112('0xb')](),controller['index']);router[_0x8112('0xa')](_0x8112('0xc'),auth['isAuthenticated'](),controller[_0x8112('0xd')]);router['get'](_0x8112('0xe'),auth[_0x8112('0xb')](),controller[_0x8112('0xf')]);router['post']('/',auth[_0x8112('0xb')](),controller['create']);router[_0x8112('0x10')](_0x8112('0xe'),auth[_0x8112('0xb')](),controller[_0x8112('0x11')]);router[_0x8112('0x12')](_0x8112('0xe'),auth[_0x8112('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0268=['post','isAuthenticated','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','./voiceTransferReport.controller','index','get','/describe','describe','/:id','show'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x0268,0xfe));var _0x8026=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x0268[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require('multer');var util=require(_0x8026('0x0'));var path=require(_0x8026('0x1'));var timeout=require(_0x8026('0x2'));var express=require(_0x8026('0x3'));var router=express[_0x8026('0x4')]();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(_0x8026('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x8026('0x6')]);router[_0x8026('0x7')](_0x8026('0x8'),auth['isAuthenticated'](),controller[_0x8026('0x9')]);router['get'](_0x8026('0xa'),auth['isAuthenticated'](),controller[_0x8026('0xb')]);router[_0x8026('0xc')]('/',auth[_0x8026('0xd')](),controller['create']);router[_0x8026('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8026('0xf')]);router[_0x8026('0x10')](_0x8026('0xa'),auth[_0x8026('0xd')](),controller[_0x8026('0x11')]);module[_0x8026('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index ecc9def..5bdcbef 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 _0x349f=['blind','attended','STRING','ENUM'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x349f,0xe0));var _0xf349=function(_0xe61fef,_0x56169a){_0xe61fef=_0xe61fef-0x0;var _0xe532ee=_0x349f[_0xe61fef];return _0xe532ee;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize['ENUM'](_0xf349('0x0'),_0xf349('0x1'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf349('0x2')]},'transferercalleridnum':{'type':Sequelize[_0xf349('0x2')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xf349('0x2')]},'transfererconnectedlinename':{'type':Sequelize[_0xf349('0x2')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf349('0x2')]},'transfererlinkedid':{'type':Sequelize[_0xf349('0x2')]},'transfereechannel':{'type':Sequelize[_0xf349('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0xf349('0x2')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xf349('0x2')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf349('0x2')]},'transfereecontext':{'type':Sequelize[_0xf349('0x2')]},'transfereeexten':{'type':Sequelize[_0xf349('0x2')]},'transfereelinkedid':{'type':Sequelize[_0xf349('0x2')]},'isexternal':{'type':Sequelize[_0xf349('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xf349('0x2')]},'extension':{'type':Sequelize[_0xf349('0x2')]}}; \ No newline at end of file +var _0x0551=['exports','ENUM','blind','STRING','Yes','sequelize','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x0551,0x17f));var _0x1055=function(_0x5c0aca,_0x4e5584){_0x5c0aca=_0x5c0aca-0x0;var _0x403480=_0x0551[_0x5c0aca];return _0x403480;};'use strict';var Sequelize=require(_0x1055('0x0'));var moment=require(_0x1055('0x1'));module[_0x1055('0x2')]={'type':{'type':Sequelize[_0x1055('0x3')](_0x1055('0x4'),'attended')},'result':{'type':Sequelize[_0x1055('0x5')]},'transfererchannel':{'type':Sequelize[_0x1055('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x1055('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x1055('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x1055('0x5')]},'transfererexten':{'type':Sequelize[_0x1055('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x1055('0x5')]},'transfereechannel':{'type':Sequelize[_0x1055('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x1055('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x1055('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1055('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x1055('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1055('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x1055('0x5')]},'isexternal':{'type':Sequelize[_0x1055('0x3')](_0x1055('0x6'),'No')},'context':{'type':Sequelize[_0x1055('0x5')]},'extension':{'type':Sequelize[_0x1055('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 0d3af44..f1d9efe 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 _0x6763=['save','update','then','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject'];(function(_0x2a578a,_0x3df3f7){var _0x16d0fb=function(_0x3a3025){while(--_0x3a3025){_0x2a578a['push'](_0x2a578a['shift']());}};_0x16d0fb(++_0x3df3f7);}(_0x6763,0x1f0));var _0x3676=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x6763[_0x1f5a63];return _0x30bb7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3676('0x0'));var zipdir=require(_0x3676('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3676('0x2'));var moment=require(_0x3676('0x3'));var BPromise=require(_0x3676('0x4'));var Mustache=require('mustache');var util=require(_0x3676('0x5'));var path=require(_0x3676('0x6'));var sox=require(_0x3676('0x7'));var csv=require('to-csv');var ejs=require(_0x3676('0x8'));var fs=require('fs');var fs_extra=require(_0x3676('0x9'));var _=require(_0x3676('0xa'));var squel=require('squel');var crypto=require(_0x3676('0xb'));var jsforce=require(_0x3676('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3676('0xd'));var querystring=require(_0x3676('0xe'));var Papa=require(_0x3676('0xf'));var Redis=require('ioredis');var authService=require(_0x3676('0x10'));var qs=require(_0x3676('0x11'));var as=require(_0x3676('0x12'));var hardwareService=require(_0x3676('0x13'));var logger=require(_0x3676('0x14'))(_0x3676('0x15'));var utils=require(_0x3676('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3676('0x17'))['db'];function respondWithStatusCode(_0x41192d,_0x11c0f7){_0x11c0f7=_0x11c0f7||0xcc;return function(_0x4f56a2){if(_0x4f56a2){return _0x41192d[_0x3676('0x18')](_0x11c0f7);}return _0x41192d[_0x3676('0x19')](_0x11c0f7)[_0x3676('0x1a')]();};}function respondWithResult(_0x3a3e15,_0x2bdffd){_0x2bdffd=_0x2bdffd||0xc8;return function(_0x5ab0bf){if(_0x5ab0bf){return _0x3a3e15[_0x3676('0x19')](_0x2bdffd)['json'](_0x5ab0bf);}};}function respondWithFilteredResult(_0x1cfd4e,_0x266034){return function(_0xe1bb1){if(_0xe1bb1){var _0x1a1d6f=typeof _0x266034['offset']==='undefined'&&typeof _0x266034[_0x3676('0x1b')]===_0x3676('0x1c');var _0x361858=_0xe1bb1[_0x3676('0x1d')];var _0x1c28e5=_0x1a1d6f?0x0:_0x266034[_0x3676('0x1e')];var _0x9794c1=_0x1a1d6f?_0xe1bb1[_0x3676('0x1d')]:_0x266034[_0x3676('0x1e')]+_0x266034[_0x3676('0x1b')];var _0x35d8ea;if(_0x9794c1>=_0x361858){_0x9794c1=_0x361858;_0x35d8ea=0xc8;}else{_0x35d8ea=0xce;}_0x1cfd4e[_0x3676('0x19')](_0x35d8ea);return _0x1cfd4e[_0x3676('0x1f')](_0x3676('0x20'),_0x1c28e5+'-'+_0x9794c1+'/'+_0x361858)[_0x3676('0x21')](_0xe1bb1);}return null;};}function patchUpdates(_0x359e19){return function(_0x2d98ea){try{jsonpatch[_0x3676('0x22')](_0x2d98ea,_0x359e19,!![]);}catch(_0x20d5db){return BPromise[_0x3676('0x23')](_0x20d5db);}return _0x2d98ea[_0x3676('0x24')]();};}function saveUpdates(_0x2641e9,_0x3407a8){return function(_0x5a669d){if(_0x5a669d){return _0x5a669d[_0x3676('0x25')](_0x2641e9)[_0x3676('0x26')](function(_0xf45509){return _0xf45509;});}return null;};}function removeEntity(_0x1ba7dc,_0xe10a6a){return function(_0x9a7b3a){if(_0x9a7b3a){return _0x9a7b3a['destroy']()['then'](function(){_0x1ba7dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ac71,_0x5efbbd){return function(_0x3957ce){if(!_0x3957ce){_0x12ac71[_0x3676('0x18')](0x194);}return _0x3957ce;};}function handleError(_0xfc49c,_0x10ce23){_0x10ce23=_0x10ce23||0x1f4;return function(_0x18226c){logger['error'](_0x18226c['stack']);if(_0x18226c[_0x3676('0x27')]){delete _0x18226c[_0x3676('0x27')];}_0xfc49c[_0x3676('0x19')](_0x10ce23)[_0x3676('0x28')](_0x18226c);};}exports[_0x3676('0x29')]=function(_0x1ca662,_0x5be5e2){var _0x8c67f9={},_0x4aa52c={},_0x462931={'count':0x0,'rows':[]};var _0x533f17=_[_0x3676('0x2a')](db[_0x3676('0x2b')][_0x3676('0x2c')],function(_0x17e095){return{'name':_0x17e095['fieldName'],'type':_0x17e095[_0x3676('0x2d')][_0x3676('0x2e')]};});_0x4aa52c['model']=_[_0x3676('0x2a')](_0x533f17,_0x3676('0x27'));_0x4aa52c[_0x3676('0x2f')]=_[_0x3676('0x30')](_0x1ca662[_0x3676('0x2f')]);_0x4aa52c[_0x3676('0x31')]=_['intersection'](_0x4aa52c['model'],_0x4aa52c[_0x3676('0x2f')]);_0x8c67f9[_0x3676('0x32')]=_[_0x3676('0x33')](_0x4aa52c['model'],qs[_0x3676('0x34')](_0x1ca662['query'][_0x3676('0x34')]));_0x8c67f9[_0x3676('0x32')]=_0x8c67f9[_0x3676('0x32')][_0x3676('0x35')]?_0x8c67f9[_0x3676('0x32')]:_0x4aa52c[_0x3676('0x36')];if(!_0x1ca662[_0x3676('0x2f')][_0x3676('0x37')](_0x3676('0x38'))){_0x8c67f9[_0x3676('0x1b')]=qs[_0x3676('0x1b')](_0x1ca662['query']['limit']);_0x8c67f9[_0x3676('0x1e')]=qs[_0x3676('0x1e')](_0x1ca662['query'][_0x3676('0x1e')]);}_0x8c67f9[_0x3676('0x39')]=qs[_0x3676('0x3a')](_0x1ca662[_0x3676('0x2f')][_0x3676('0x3a')]);_0x8c67f9['where']=qs[_0x3676('0x31')](_[_0x3676('0x3b')](_0x1ca662[_0x3676('0x2f')],_0x4aa52c[_0x3676('0x31')]),_0x533f17);if(_0x1ca662[_0x3676('0x2f')]['filter']){_0x8c67f9[_0x3676('0x3c')]=_[_0x3676('0x3d')](_0x8c67f9[_0x3676('0x3c')],{'$or':_['map'](_0x533f17,function(_0x45798f){if(_0x45798f[_0x3676('0x2d')]!==_0x3676('0x3e')){var _0x5a5b89={};_0x5a5b89[_0x45798f['name']]={'$like':'%'+_0x1ca662[_0x3676('0x2f')][_0x3676('0x3f')]+'%'};return _0x5a5b89;}})});}_0x8c67f9=_['merge']({},_0x8c67f9,_0x1ca662[_0x3676('0x40')]);var _0x599700={'where':_0x8c67f9[_0x3676('0x3c')]};return db[_0x3676('0x2b')][_0x3676('0x1d')](_0x599700)['then'](function(_0x3c53f0){_0x462931[_0x3676('0x1d')]=_0x3c53f0;if(_0x1ca662['query']['includeAll']){_0x8c67f9['include']=[{'all':!![]}];}return db[_0x3676('0x2b')][_0x3676('0x41')](_0x8c67f9);})['then'](function(_0x1cfb8b){_0x462931[_0x3676('0x42')]=_0x1cfb8b;return _0x462931;})['then'](respondWithFilteredResult(_0x5be5e2,_0x8c67f9))[_0x3676('0x43')](handleError(_0x5be5e2,null));};exports[_0x3676('0x44')]=function(_0x2f600e,_0x363b76){var _0x384ea9={'raw':!![],'where':{'id':_0x2f600e[_0x3676('0x45')]['id']}},_0x55c3e2={};_0x55c3e2[_0x3676('0x36')]=_[_0x3676('0x30')](db[_0x3676('0x2b')][_0x3676('0x2c')]);_0x55c3e2[_0x3676('0x2f')]=_[_0x3676('0x30')](_0x2f600e[_0x3676('0x2f')]);_0x55c3e2[_0x3676('0x31')]=_[_0x3676('0x33')](_0x55c3e2[_0x3676('0x36')],_0x55c3e2[_0x3676('0x2f')]);_0x384ea9[_0x3676('0x32')]=_[_0x3676('0x33')](_0x55c3e2[_0x3676('0x36')],qs[_0x3676('0x34')](_0x2f600e[_0x3676('0x2f')]['fields']));_0x384ea9[_0x3676('0x32')]=_0x384ea9[_0x3676('0x32')][_0x3676('0x35')]?_0x384ea9['attributes']:_0x55c3e2['model'];if(_0x2f600e[_0x3676('0x2f')][_0x3676('0x46')]){_0x384ea9[_0x3676('0x47')]=[{'all':!![]}];}_0x384ea9=_['merge']({},_0x384ea9,_0x2f600e[_0x3676('0x40')]);return db[_0x3676('0x2b')][_0x3676('0x48')](_0x384ea9)[_0x3676('0x26')](handleEntityNotFound(_0x363b76,null))[_0x3676('0x26')](respondWithResult(_0x363b76,null))[_0x3676('0x43')](handleError(_0x363b76,null));};exports[_0x3676('0x49')]=function(_0x14315f,_0x799ffb){return db[_0x3676('0x2b')]['create'](_0x14315f[_0x3676('0x4a')],{})['then'](respondWithResult(_0x799ffb,0xc9))[_0x3676('0x43')](handleError(_0x799ffb,null));};exports['update']=function(_0x4bcb15,_0x35122){if(_0x4bcb15[_0x3676('0x4a')]['id']){delete _0x4bcb15['body']['id'];}return db[_0x3676('0x2b')][_0x3676('0x48')]({'where':{'id':_0x4bcb15[_0x3676('0x45')]['id']}})['then'](handleEntityNotFound(_0x35122,null))[_0x3676('0x26')](saveUpdates(_0x4bcb15['body'],null))['then'](respondWithResult(_0x35122,null))['catch'](handleError(_0x35122,null));};exports['destroy']=function(_0x654f42,_0x24bb1e){return db[_0x3676('0x2b')][_0x3676('0x48')]({'where':{'id':_0x654f42[_0x3676('0x45')]['id']}})['then'](handleEntityNotFound(_0x24bb1e,null))[_0x3676('0x26')](removeEntity(_0x24bb1e,null))['catch'](handleError(_0x24bb1e,null));};exports[_0x3676('0x4b')]=function(_0xd6f4d,_0x4ad36d){return db[_0x3676('0x2b')][_0x3676('0x4b')]()[_0x3676('0x26')](respondWithResult(_0x4ad36d,null))[_0x3676('0x43')](handleError(_0x4ad36d,null));}; \ No newline at end of file +var _0x0c0c=['count','limit','status','set','json','apply','save','then','destroy','error','name','send','map','VoiceTransferReport','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined'];(function(_0x19a1c0,_0x14f0bb){var _0x2afb24=function(_0x142d2b){while(--_0x142d2b){_0x19a1c0['push'](_0x19a1c0['shift']());}};_0x2afb24(++_0x14f0bb);}(_0x0c0c,0x109));var _0xc0c0=function(_0x4d2d8b,_0x61335e){_0x4d2d8b=_0x4d2d8b-0x0;var _0x24fff4=_0x0c0c[_0x4d2d8b];return _0x24fff4;};'use strict';var emlformat=require(_0xc0c0('0x0'));var rimraf=require(_0xc0c0('0x1'));var zipdir=require(_0xc0c0('0x2'));var jsonpatch=require(_0xc0c0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0c0('0x4'));var Mustache=require(_0xc0c0('0x5'));var util=require('util');var path=require(_0xc0c0('0x6'));var sox=require('sox');var csv=require(_0xc0c0('0x7'));var ejs=require(_0xc0c0('0x8'));var fs=require('fs');var fs_extra=require(_0xc0c0('0x9'));var _=require('lodash');var squel=require(_0xc0c0('0xa'));var crypto=require('crypto');var jsforce=require(_0xc0c0('0xb'));var deskjs=require(_0xc0c0('0xc'));var toCsv=require(_0xc0c0('0x7'));var querystring=require(_0xc0c0('0xd'));var Papa=require('papaparse');var Redis=require(_0xc0c0('0xe'));var authService=require(_0xc0c0('0xf'));var qs=require(_0xc0c0('0x10'));var as=require(_0xc0c0('0x11'));var hardwareService=require(_0xc0c0('0x12'));var logger=require(_0xc0c0('0x13'))(_0xc0c0('0x14'));var utils=require(_0xc0c0('0x15'));var config=require(_0xc0c0('0x16'));var licenseUtil=require(_0xc0c0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a96ae,_0x315e81){_0x315e81=_0x315e81||0xcc;return function(_0x5debbf){if(_0x5debbf){return _0x3a96ae[_0xc0c0('0x18')](_0x315e81);}return _0x3a96ae['status'](_0x315e81)['end']();};}function respondWithResult(_0x207134,_0x57b432){_0x57b432=_0x57b432||0xc8;return function(_0x351c29){if(_0x351c29){return _0x207134['status'](_0x57b432)['json'](_0x351c29);}};}function respondWithFilteredResult(_0x90a54e,_0x25fc63){return function(_0x4f698b){if(_0x4f698b){var _0x32890b=typeof _0x25fc63[_0xc0c0('0x19')]==='undefined'&&typeof _0x25fc63['limit']===_0xc0c0('0x1a');var _0x3e96c1=_0x4f698b[_0xc0c0('0x1b')];var _0x58972f=_0x32890b?0x0:_0x25fc63[_0xc0c0('0x19')];var _0x19ae00=_0x32890b?_0x4f698b[_0xc0c0('0x1b')]:_0x25fc63[_0xc0c0('0x19')]+_0x25fc63[_0xc0c0('0x1c')];var _0x2eeacb;if(_0x19ae00>=_0x3e96c1){_0x19ae00=_0x3e96c1;_0x2eeacb=0xc8;}else{_0x2eeacb=0xce;}_0x90a54e[_0xc0c0('0x1d')](_0x2eeacb);return _0x90a54e[_0xc0c0('0x1e')]('Content-Range',_0x58972f+'-'+_0x19ae00+'/'+_0x3e96c1)[_0xc0c0('0x1f')](_0x4f698b);}return null;};}function patchUpdates(_0x85ed4f){return function(_0x5cb771){try{jsonpatch[_0xc0c0('0x20')](_0x5cb771,_0x85ed4f,!![]);}catch(_0x4003ad){return BPromise['reject'](_0x4003ad);}return _0x5cb771[_0xc0c0('0x21')]();};}function saveUpdates(_0x4f6204,_0x54c1d0){return function(_0x404708){if(_0x404708){return _0x404708['update'](_0x4f6204)[_0xc0c0('0x22')](function(_0x32ab13){return _0x32ab13;});}return null;};}function removeEntity(_0x28f6e5,_0x3e80a2){return function(_0x257977){if(_0x257977){return _0x257977[_0xc0c0('0x23')]()[_0xc0c0('0x22')](function(){_0x28f6e5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a3275,_0x9a236){return function(_0x47a331){if(!_0x47a331){_0x2a3275[_0xc0c0('0x18')](0x194);}return _0x47a331;};}function handleError(_0x3bffef,_0x42e98b){_0x42e98b=_0x42e98b||0x1f4;return function(_0x4e1029){logger[_0xc0c0('0x24')](_0x4e1029['stack']);if(_0x4e1029[_0xc0c0('0x25')]){delete _0x4e1029[_0xc0c0('0x25')];}_0x3bffef[_0xc0c0('0x1d')](_0x42e98b)[_0xc0c0('0x26')](_0x4e1029);};}exports['index']=function(_0x1c1397,_0x454816){var _0x318ca8={},_0x20d1a7={},_0x395682={'count':0x0,'rows':[]};var _0x2e8004=_[_0xc0c0('0x27')](db[_0xc0c0('0x28')]['rawAttributes'],function(_0x8b5b6a){return{'name':_0x8b5b6a[_0xc0c0('0x29')],'type':_0x8b5b6a[_0xc0c0('0x2a')][_0xc0c0('0x2b')]};});_0x20d1a7['model']=_[_0xc0c0('0x27')](_0x2e8004,_0xc0c0('0x25'));_0x20d1a7[_0xc0c0('0x2c')]=_[_0xc0c0('0x2d')](_0x1c1397[_0xc0c0('0x2c')]);_0x20d1a7[_0xc0c0('0x2e')]=_['intersection'](_0x20d1a7[_0xc0c0('0x2f')],_0x20d1a7[_0xc0c0('0x2c')]);_0x318ca8[_0xc0c0('0x30')]=_[_0xc0c0('0x31')](_0x20d1a7[_0xc0c0('0x2f')],qs[_0xc0c0('0x32')](_0x1c1397['query'][_0xc0c0('0x32')]));_0x318ca8[_0xc0c0('0x30')]=_0x318ca8[_0xc0c0('0x30')][_0xc0c0('0x33')]?_0x318ca8['attributes']:_0x20d1a7[_0xc0c0('0x2f')];if(!_0x1c1397['query']['hasOwnProperty'](_0xc0c0('0x34'))){_0x318ca8[_0xc0c0('0x1c')]=qs[_0xc0c0('0x1c')](_0x1c1397['query']['limit']);_0x318ca8[_0xc0c0('0x19')]=qs['offset'](_0x1c1397[_0xc0c0('0x2c')][_0xc0c0('0x19')]);}_0x318ca8[_0xc0c0('0x35')]=qs[_0xc0c0('0x36')](_0x1c1397[_0xc0c0('0x2c')][_0xc0c0('0x36')]);_0x318ca8[_0xc0c0('0x37')]=qs[_0xc0c0('0x2e')](_[_0xc0c0('0x38')](_0x1c1397[_0xc0c0('0x2c')],_0x20d1a7['filters']),_0x2e8004);if(_0x1c1397[_0xc0c0('0x2c')][_0xc0c0('0x39')]){_0x318ca8[_0xc0c0('0x37')]=_[_0xc0c0('0x3a')](_0x318ca8[_0xc0c0('0x37')],{'$or':_['map'](_0x2e8004,function(_0x241816){if(_0x241816[_0xc0c0('0x2a')]!==_0xc0c0('0x3b')){var _0x27c59a={};_0x27c59a[_0x241816[_0xc0c0('0x25')]]={'$like':'%'+_0x1c1397[_0xc0c0('0x2c')][_0xc0c0('0x39')]+'%'};return _0x27c59a;}})});}_0x318ca8=_['merge']({},_0x318ca8,_0x1c1397[_0xc0c0('0x3c')]);var _0x138742={'where':_0x318ca8[_0xc0c0('0x37')]};return db[_0xc0c0('0x28')][_0xc0c0('0x1b')](_0x138742)['then'](function(_0x180330){_0x395682[_0xc0c0('0x1b')]=_0x180330;if(_0x1c1397['query'][_0xc0c0('0x3d')]){_0x318ca8[_0xc0c0('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xc0c0('0x3f')](_0x318ca8);})[_0xc0c0('0x22')](function(_0x262ee4){_0x395682['rows']=_0x262ee4;return _0x395682;})['then'](respondWithFilteredResult(_0x454816,_0x318ca8))[_0xc0c0('0x40')](handleError(_0x454816,null));};exports[_0xc0c0('0x41')]=function(_0x5e6486,_0x5caa5f){var _0x3a0be9={'raw':!![],'where':{'id':_0x5e6486[_0xc0c0('0x42')]['id']}},_0x316738={};_0x316738[_0xc0c0('0x2f')]=_[_0xc0c0('0x2d')](db['VoiceTransferReport'][_0xc0c0('0x43')]);_0x316738[_0xc0c0('0x2c')]=_[_0xc0c0('0x2d')](_0x5e6486[_0xc0c0('0x2c')]);_0x316738['filters']=_['intersection'](_0x316738[_0xc0c0('0x2f')],_0x316738['query']);_0x3a0be9[_0xc0c0('0x30')]=_[_0xc0c0('0x31')](_0x316738[_0xc0c0('0x2f')],qs[_0xc0c0('0x32')](_0x5e6486[_0xc0c0('0x2c')][_0xc0c0('0x32')]));_0x3a0be9[_0xc0c0('0x30')]=_0x3a0be9['attributes'][_0xc0c0('0x33')]?_0x3a0be9[_0xc0c0('0x30')]:_0x316738[_0xc0c0('0x2f')];if(_0x5e6486[_0xc0c0('0x2c')][_0xc0c0('0x3d')]){_0x3a0be9[_0xc0c0('0x3e')]=[{'all':!![]}];}_0x3a0be9=_[_0xc0c0('0x3a')]({},_0x3a0be9,_0x5e6486[_0xc0c0('0x3c')]);return db[_0xc0c0('0x28')][_0xc0c0('0x44')](_0x3a0be9)[_0xc0c0('0x22')](handleEntityNotFound(_0x5caa5f,null))[_0xc0c0('0x22')](respondWithResult(_0x5caa5f,null))[_0xc0c0('0x40')](handleError(_0x5caa5f,null));};exports[_0xc0c0('0x45')]=function(_0x3fe42d,_0x3f56cf){return db[_0xc0c0('0x28')][_0xc0c0('0x45')](_0x3fe42d[_0xc0c0('0x46')],{})[_0xc0c0('0x22')](respondWithResult(_0x3f56cf,0xc9))['catch'](handleError(_0x3f56cf,null));};exports[_0xc0c0('0x47')]=function(_0xa6b8d8,_0x108db3){if(_0xa6b8d8[_0xc0c0('0x46')]['id']){delete _0xa6b8d8[_0xc0c0('0x46')]['id'];}return db[_0xc0c0('0x28')][_0xc0c0('0x44')]({'where':{'id':_0xa6b8d8[_0xc0c0('0x42')]['id']}})[_0xc0c0('0x22')](handleEntityNotFound(_0x108db3,null))['then'](saveUpdates(_0xa6b8d8[_0xc0c0('0x46')],null))['then'](respondWithResult(_0x108db3,null))[_0xc0c0('0x40')](handleError(_0x108db3,null));};exports['destroy']=function(_0x410877,_0x2bf889){return db[_0xc0c0('0x28')][_0xc0c0('0x44')]({'where':{'id':_0x410877[_0xc0c0('0x42')]['id']}})[_0xc0c0('0x22')](handleEntityNotFound(_0x2bf889,null))[_0xc0c0('0x22')](removeEntity(_0x2bf889,null))[_0xc0c0('0x40')](handleError(_0x2bf889,null));};exports[_0xc0c0('0x48')]=function(_0x220bb3,_0x534607){return db[_0xc0c0('0x28')]['describe']()[_0xc0c0('0x22')](respondWithResult(_0x534607,null))[_0xc0c0('0x40')](handleError(_0x534607,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 9fc303c..ecb442d 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 _0x6157=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6157,0xc7));var _0x7615=function(_0x546d46,_0x18b998){_0x546d46=_0x546d46-0x0;var _0x259547=_0x6157[_0x546d46];return _0x259547;};'use strict';var _=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var logger=require(_0x7615('0x2'))(_0x7615('0x3'));var moment=require(_0x7615('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7615('0x5'));var rimraf=require(_0x7615('0x6'));var config=require(_0x7615('0x7'));var attributes=require(_0x7615('0x8'));module['exports']=function(_0x4ad4cb,_0x282e77){return _0x4ad4cb[_0x7615('0x9')](_0x7615('0xa'),attributes,{'tableName':_0x7615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ce8=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x8ce8,0xf0));var _0x88ce=function(_0x22040c,_0x5f0366){_0x22040c=_0x22040c-0x0;var _0x2ed113=_0x8ce8[_0x22040c];return _0x2ed113;};'use strict';var _=require(_0x88ce('0x0'));var util=require(_0x88ce('0x1'));var logger=require(_0x88ce('0x2'))(_0x88ce('0x3'));var moment=require(_0x88ce('0x4'));var BPromise=require(_0x88ce('0x5'));var rp=require(_0x88ce('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x88ce('0x7'));var config=require(_0x88ce('0x8'));var attributes=require(_0x88ce('0x9'));module[_0x88ce('0xa')]=function(_0x2d8566,_0x38a73b){return _0x2d8566[_0x88ce('0xb')](_0x88ce('0xc'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 8aee6b8..2df6cea 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 _0xaba8=['request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x31e1ce,_0x230c65){var _0x27a3a5=function(_0x1f6368){while(--_0x1f6368){_0x31e1ce['push'](_0x31e1ce['shift']());}};_0x27a3a5(++_0x230c65);}(_0xaba8,0xd3));var _0x8aba=function(_0xfef8e6,_0x5e7297){_0xfef8e6=_0xfef8e6-0x0;var _0x819250=_0xaba8[_0xfef8e6];return _0x819250;};'use strict';var _=require('lodash');var util=require(_0x8aba('0x0'));var moment=require(_0x8aba('0x1'));var BPromise=require('bluebird');var rs=require(_0x8aba('0x2'));var fs=require('fs');var Redis=require(_0x8aba('0x3'));var db=require(_0x8aba('0x4'))['db'];var utils=require(_0x8aba('0x5'));var logger=require(_0x8aba('0x6'))(_0x8aba('0x7'));var config=require('../../config/environment');var jayson=require(_0x8aba('0x8'));var client=jayson[_0x8aba('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4606f9,_0x4fe562,_0x55db07){return new BPromise(function(_0x530157,_0x1d5729){return client[_0x8aba('0xa')](_0x4606f9,_0x55db07)[_0x8aba('0xb')](function(_0x21a4d1){logger[_0x8aba('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4fe562,_0x8aba('0xd'));logger[_0x8aba('0xe')](_0x8aba('0xf'),_0x4fe562,_0x8aba('0xd'),JSON[_0x8aba('0x10')](_0x21a4d1));if(_0x21a4d1[_0x8aba('0x11')]){if(_0x21a4d1[_0x8aba('0x11')]['code']===0x1f4){logger[_0x8aba('0x11')](_0x8aba('0x12'),_0x4fe562,_0x21a4d1[_0x8aba('0x11')][_0x8aba('0x13')]);return _0x1d5729(_0x21a4d1[_0x8aba('0x11')]['message']);}logger[_0x8aba('0x11')](_0x8aba('0x12'),_0x4fe562,_0x21a4d1[_0x8aba('0x11')]['message']);return _0x530157(_0x21a4d1[_0x8aba('0x11')]['message']);}else{logger[_0x8aba('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x4fe562,_0x8aba('0xd'));_0x530157(_0x21a4d1[_0x8aba('0x14')][_0x8aba('0x13')]);}})[_0x8aba('0x15')](function(_0x580f61){logger['error'](_0x8aba('0x12'),_0x4fe562,_0x580f61);_0x1d5729(_0x580f61);});});}exports[_0x8aba('0x16')]=function(_0x2bc4d5){var _0x57263f=this;return new Promise(function(_0x4f4449,_0x4cc29b){return db[_0x8aba('0x17')][_0x8aba('0x18')](_0x2bc4d5[_0x8aba('0x19')],{'raw':_0x2bc4d5[_0x8aba('0x1a')]?_0x2bc4d5[_0x8aba('0x1a')][_0x8aba('0x1b')]===undefined?!![]:![]:!![]})[_0x8aba('0xb')](function(_0x23e390){logger['info'](_0x8aba('0x16'),_0x2bc4d5);logger[_0x8aba('0xe')]('CreateVoiceTransferReport',_0x2bc4d5,JSON[_0x8aba('0x10')](_0x23e390));_0x4f4449(_0x23e390);})[_0x8aba('0x15')](function(_0x5d6fe2){logger[_0x8aba('0x11')](_0x8aba('0x16'),_0x5d6fe2[_0x8aba('0x13')],_0x2bc4d5);_0x4cc29b(_0x57263f[_0x8aba('0x11')](0x1f4,_0x5d6fe2[_0x8aba('0x13')]));});});}; \ No newline at end of file +var _0xb441=['error','message','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb441,0x198));var _0x1b44=function(_0x2620ae,_0x4f1757){_0x2620ae=_0x2620ae-0x0;var _0x29b2da=_0xb441[_0x2620ae];return _0x29b2da;};'use strict';var _=require('lodash');var util=require(_0x1b44('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b44('0x1'));var db=require(_0x1b44('0x2'))['db'];var utils=require(_0x1b44('0x3'));var logger=require(_0x1b44('0x4'))(_0x1b44('0x5'));var config=require(_0x1b44('0x6'));var jayson=require(_0x1b44('0x7'));var client=jayson[_0x1b44('0x8')][_0x1b44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d626a,_0x5ae611,_0x117899){return new BPromise(function(_0x343347,_0x29cc95){return client['request'](_0x2d626a,_0x117899)[_0x1b44('0xa')](function(_0x3c688c){logger[_0x1b44('0xb')](_0x1b44('0xc'),_0x5ae611,_0x1b44('0xd'));logger[_0x1b44('0xe')](_0x1b44('0xf'),_0x5ae611,_0x1b44('0xd'),JSON[_0x1b44('0x10')](_0x3c688c));if(_0x3c688c['error']){if(_0x3c688c[_0x1b44('0x11')]['code']===0x1f4){logger[_0x1b44('0x11')](_0x1b44('0xc'),_0x5ae611,_0x3c688c['error'][_0x1b44('0x12')]);return _0x29cc95(_0x3c688c[_0x1b44('0x11')][_0x1b44('0x12')]);}logger[_0x1b44('0x11')](_0x1b44('0xc'),_0x5ae611,_0x3c688c[_0x1b44('0x11')][_0x1b44('0x12')]);return _0x343347(_0x3c688c[_0x1b44('0x11')][_0x1b44('0x12')]);}else{logger[_0x1b44('0xb')](_0x1b44('0xc'),_0x5ae611,'request\x20sent');_0x343347(_0x3c688c['result'][_0x1b44('0x12')]);}})[_0x1b44('0x13')](function(_0x3eee2d){logger['error'](_0x1b44('0xc'),_0x5ae611,_0x3eee2d);_0x29cc95(_0x3eee2d);});});}exports[_0x1b44('0x14')]=function(_0x250d8c){var _0x5722e3=this;return new Promise(function(_0xa3d69d,_0x5096f9){return db[_0x1b44('0x15')]['create'](_0x250d8c[_0x1b44('0x16')],{'raw':_0x250d8c[_0x1b44('0x17')]?_0x250d8c[_0x1b44('0x17')][_0x1b44('0x18')]===undefined?!![]:![]:!![]})[_0x1b44('0xa')](function(_0xfb8181){logger[_0x1b44('0xb')](_0x1b44('0x14'),_0x250d8c);logger['debug'](_0x1b44('0x14'),_0x250d8c,JSON['stringify'](_0xfb8181));_0xa3d69d(_0xfb8181);})[_0x1b44('0x13')](function(_0x1bf1e5){logger[_0x1b44('0x11')](_0x1b44('0x14'),_0x1bf1e5[_0x1b44('0x12')],_0x250d8c);_0x5096f9(_0x5722e3['error'](0x1f4,_0x1bf1e5[_0x1b44('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 6ca10ab..e67e776 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 _0xedd9=['unhold','/calls','calls','/transfer','exports','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','answer','/hold','/unhold'];(function(_0x217884,_0x317700){var _0xecd9c2=function(_0x5914f9){while(--_0x5914f9){_0x217884['push'](_0x217884['shift']());}};_0xecd9c2(++_0x317700);}(_0xedd9,0xfc));var _0x9edd=function(_0x389ac4,_0x26addc){_0x389ac4=_0x389ac4-0x0;var _0x566ce8=_0xedd9[_0x389ac4];return _0x566ce8;};'use strict';var express=require('express');var router=express[_0x9edd('0x0')]();var auth=require(_0x9edd('0x1'));var controller=require(_0x9edd('0x2'));router[_0x9edd('0x3')](_0x9edd('0x4'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x7')]);router['post'](_0x9edd('0x8'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x9')]);router['post'](_0x9edd('0xa'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xb')]);router[_0x9edd('0x3')](_0x9edd('0xc'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller['hold']);router[_0x9edd('0x3')](_0x9edd('0xd'),auth['isAuthenticated'](),auth[_0x9edd('0x6')](),controller[_0x9edd('0xe')]);router['post'](_0x9edd('0xf'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller[_0x9edd('0x10')]);router[_0x9edd('0x3')](_0x9edd('0x11'),auth[_0x9edd('0x5')](),auth[_0x9edd('0x6')](),controller['transfer']);module[_0x9edd('0x12')]=router; \ No newline at end of file +var _0x54ef=['unhold','/calls','/transfer','transfer','express','Router','../../components/auth/service','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','/answer','/hold','hold','/unhold'];(function(_0x55278b,_0x1d1f44){var _0x5f54f1=function(_0x15be57){while(--_0x15be57){_0x55278b['push'](_0x55278b['shift']());}};_0x5f54f1(++_0x1d1f44);}(_0x54ef,0x112));var _0xf54e=function(_0x2cd0ca,_0x4ae6a8){_0x2cd0ca=_0x2cd0ca-0x0;var _0x1f6be0=_0x54ef[_0x2cd0ca];return _0x1f6be0;};'use strict';var express=require(_0xf54e('0x0'));var router=express[_0xf54e('0x1')]();var auth=require(_0xf54e('0x2'));var controller=require('./webbar.controller');router[_0xf54e('0x3')](_0xf54e('0x4'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x7')]);router[_0xf54e('0x3')](_0xf54e('0x8'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xf54e('0x9')]);router[_0xf54e('0x3')](_0xf54e('0xa'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['answer']);router[_0xf54e('0x3')](_0xf54e('0xb'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xc')]);router[_0xf54e('0x3')](_0xf54e('0xd'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller[_0xf54e('0xe')]);router[_0xf54e('0x3')](_0xf54e('0xf'),auth['isAuthenticated'](),auth[_0xf54e('0x6')](),controller['calls']);router['post'](_0xf54e('0x10'),auth[_0xf54e('0x5')](),auth[_0xf54e('0x6')](),controller[_0xf54e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 3dcc6c6..989ed26 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 _0x44a3=['client','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','stack','name','status','send','NotFound','request','then','code','result','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','catch','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','conference\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x388679,_0x502313){var _0x3392fa=function(_0x39dfda){while(--_0x39dfda){_0x388679['push'](_0x388679['shift']());}};_0x3392fa(++_0x502313);}(_0x44a3,0x1a9));var _0x344a=function(_0x2e334b,_0x426b6e){_0x2e334b=_0x2e334b-0x0;var _0x390570=_0x44a3[_0x2e334b];return _0x390570;};'use strict';var path=require(_0x344a('0x0'));var fs=require('fs');var _=require(_0x344a('0x1'));var db=require(_0x344a('0x2'))['db'];var config=require(_0x344a('0x3'));var util=require(_0x344a('0x4'));var BPromise=require(_0x344a('0x5'));var jayson=require(_0x344a('0x6'));var amiClient=jayson[_0x344a('0x7')]['http']({'port':0x232a});var logger=require(_0x344a('0x8'))(_0x344a('0x9'));var Redis=require(_0x344a('0xa'));config[_0x344a('0xb')]=_[_0x344a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x344a('0xd'));var originateValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'callNumber':{'type':_0x344a('0x10'),'required':[!![],_0x344a('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x344a('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x344a('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x344a('0x10'),'required':[!![],_0x344a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x54a643,_0x3609ce,_0x1aad46){logger[_0x344a('0x13')](_0x54a643,_0x3609ce,JSON[_0x344a('0x14')](_0x1aad46));io['to'](_0x54a643)['emit'](_0x3609ce,_0x1aad46);}function handleError(_0x397de6){return function(_0x277c06){console['log'](_0x344a('0x15'),_0x277c06,_0x277c06 instanceof RangeError);logger[_0x344a('0x16')](_0x277c06[_0x344a('0x17')]);if(_0x277c06 instanceof RangeError){if(_0x277c06[_0x344a('0x18')]){delete _0x277c06[_0x344a('0x18')];}_0x397de6[_0x344a('0x19')](0x194)[_0x344a('0x1a')](_0x277c06);}else{if(_0x277c06[_0x344a('0x18')]){delete _0x277c06[_0x344a('0x18')];}_0x397de6[_0x344a('0x19')](0x1f4)['send'](_0x277c06);}};}function checkError(){return function(_0x16c0fe){if(!_0x16c0fe){throw new RangeError(_0x344a('0x1b'));}return _0x16c0fe;};}function respondWithRpcPromise(_0xe0bdd4,_0x21216d){return new BPromise(function(_0x240be3,_0x80ae12){var _0x185303=amiClient;return _0x185303[_0x344a('0x1c')](_0xe0bdd4,_0x21216d)[_0x344a('0x1d')](function(_0x27f527){if(_0x27f527[_0x344a('0x16')]){if(_0x27f527[_0x344a('0x16')][_0x344a('0x1e')]===0x1f4){return _0x80ae12(_0x27f527[_0x344a('0x16')]['message']);}return _0x240be3(_0x27f527[_0x344a('0x16')]['message']);}else{_0x240be3(_0x27f527[_0x344a('0x1f')]);}})['catch'](function(_0x36c920){_0x80ae12(_0x36c920);});});}function getAgent(_0x8bf0b0){return db[_0x344a('0x20')][_0x344a('0x21')]({'where':{'id':_0x8bf0b0,'role':_0x344a('0x22')}})[_0x344a('0x1d')](checkError());}function getAgentCheckSession(_0x229ccd,_0x114637){return new BPromise(function(_0x4f2499,_0x283f63){var _0x18be46=respondWithRpcPromise(_0x344a('0x23'));var _0xc02d6=getAgent(_0x229ccd);Promise[_0x344a('0x24')]([_0x18be46,_0xc02d6])[_0x344a('0x1d')](function(_0x5b877d){var _0x3d25fe=_0x5b877d[0x0];var _0x49bbf8=_0x5b877d[0x1];var _0x593cf6=_[_0x344a('0x25')](_0x3d25fe[_0x344a('0x26')],function(_0x5a36bb){return _0x5a36bb['UserId']==_0x49bbf8['id']&&_0x5a36bb['sessionId']==_0x114637;});if(_0x593cf6['length']==0x1){_0x4f2499(_0x49bbf8);}else{_0x283f63(new RangeError(_0x344a('0x27')+_0x114637+_0x344a('0x28')));}});});}exports[_0x344a('0x29')]=function(_0x58d90b,_0x25b28d){logger[_0x344a('0x13')](_0x344a('0x2a'),_0x58d90b[_0x344a('0x2b')]);var _0x20e5c6=originateValidation[_0x344a('0xd')](_0x58d90b[_0x344a('0x2b')]);if(_0x20e5c6['length']>0x0){return _0x25b28d[_0x344a('0x19')](0x190)['json'](_0x20e5c6);}var _0x47d8c3=_0x58d90b['body'][_0x344a('0x2c')];var _0x279114=_0x58d90b[_0x344a('0x2b')][_0x344a('0x2d')];var _0x1fa3ee=_0x58d90b[_0x344a('0x2b')]['callerId'];var _0x44a761=_0x58d90b[_0x344a('0x2b')][_0x344a('0x2e')];return getAgent(_0x47d8c3)['then'](function(_0x3698eb){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x3698eb[_0x344a('0x18')]);emit(util[_0x344a('0x30')]('user:%s',_0x3698eb[_0x344a('0x18')]),_0x344a('0x31'),{'callNumber':_0x279114,'callerId':_0x1fa3ee,'callbackUrl':_0x44a761});return _0x25b28d[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':_0x344a('0x33')});})['catch'](handleError(_0x25b28d));};exports[_0x344a('0x34')]=function(_0x33e48e,_0x11e81f){logger[_0x344a('0x13')](_0x344a('0x35'),_0x33e48e['body']);var _0x13c9ca=hangupValidation[_0x344a('0xd')](_0x33e48e[_0x344a('0x2b')]);if(_0x13c9ca[_0x344a('0x36')]>0x0){return _0x11e81f[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x13c9ca);}var _0x335a0a=_0x33e48e[_0x344a('0x2b')]['userId'];var _0x37b960=_0x33e48e[_0x344a('0x2b')][_0x344a('0x37')];return getAgent(_0x335a0a)[_0x344a('0x1d')](function(_0x2fc05f){logger['info'](_0x344a('0x2f'),_0x2fc05f[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x2fc05f[_0x344a('0x18')]),_0x344a('0x39'),{'sessionId':_0x37b960});return _0x11e81f[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':_0x344a('0x3a')});})['catch'](handleError(_0x11e81f));};exports[_0x344a('0x3b')]=function(_0x1bad44,_0x6e7498){logger[_0x344a('0x13')]('answer\x20fired:',_0x1bad44[_0x344a('0x2b')]);var _0x3069ca=answerValidation[_0x344a('0xd')](_0x1bad44[_0x344a('0x2b')]);if(_0x3069ca[_0x344a('0x36')]>0x0){return _0x6e7498[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x3069ca);}var _0x372e7d=_0x1bad44[_0x344a('0x2b')][_0x344a('0x2c')];var _0x2de5aa=_0x1bad44['body'][_0x344a('0x37')];return getAgent(_0x372e7d)[_0x344a('0x1d')](function(_0x5ed2f4){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x5ed2f4['name']);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x5ed2f4['name']),_0x344a('0x3c'),{'sessionId':_0x2de5aa});return _0x6e7498[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0x344a('0x3d')](handleError(_0x6e7498));};exports['hold']=function(_0x793893,_0x3e1564){logger[_0x344a('0x13')](_0x344a('0x3e'),_0x793893['body']);var _0x519ddd=holdValidation[_0x344a('0xd')](_0x793893[_0x344a('0x2b')]);if(_0x519ddd[_0x344a('0x36')]>0x0){return _0x3e1564[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x519ddd);}var _0xa3c8f0=_0x793893[_0x344a('0x2b')][_0x344a('0x2c')];var _0x2b629d=_0x793893[_0x344a('0x2b')]['sessionId'];return getAgent(_0xa3c8f0)[_0x344a('0x1d')](function(_0x2d9858){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x2d9858['name']);emit(util[_0x344a('0x30')]('user:%s',_0x2d9858['name']),_0x344a('0x3f'),{'sessionId':_0x2b629d});return _0x3e1564[_0x344a('0x19')](0xc8)['json']({'error':![],'message':_0x344a('0x40')});})[_0x344a('0x3d')](handleError(_0x3e1564));};exports[_0x344a('0x41')]=function(_0x226f41,_0x51e411){logger[_0x344a('0x13')](_0x344a('0x42'),_0x226f41[_0x344a('0x2b')]);var _0x173680=unholdValidation[_0x344a('0xd')](_0x226f41[_0x344a('0x2b')]);if(_0x173680[_0x344a('0x36')]>0x0){return _0x51e411[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x173680);}var _0x1911d0=_0x226f41['body'][_0x344a('0x2c')];var _0x47ce9c=_0x226f41[_0x344a('0x2b')][_0x344a('0x37')];return getAgent(_0x1911d0)[_0x344a('0x1d')](function(_0x531972){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x531972[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x531972[_0x344a('0x18')]),_0x344a('0x43'),{'sessionId':_0x47ce9c});return _0x51e411[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0x344a('0x3d')](handleError(_0x51e411));};exports[_0x344a('0x44')]=function(_0x10d5d1,_0x16a85a){logger[_0x344a('0x13')]('calls\x20fired:',_0x16a85a[_0x344a('0x2b')]);var _0x163047=callsValidation[_0x344a('0xd')](_0x10d5d1[_0x344a('0x2b')]);if(_0x163047['length']>0x0){return _0x16a85a[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x163047);}var _0x4c2fe7=_0x10d5d1[_0x344a('0x2b')][_0x344a('0x2c')];var _0x16482c=respondWithRpcPromise(_0x344a('0x23'));var _0x2a8fc1=getAgent(_0x4c2fe7);return Promise[_0x344a('0x24')]([_0x16482c,_0x2a8fc1])[_0x344a('0x1d')](function(_0x4b6eb2){var _0x553c17=_0x4b6eb2[0x0];var _0x4d707b=_0x4b6eb2[0x1];var _0x41dc89=_[_0x344a('0x25')](_0x553c17[_0x344a('0x26')],function(_0x239439){return _0x239439['UserId']==_0x4d707b['id'];});return _0x16a85a[_0x344a('0x19')](0xc8)['json']({'count':_0x41dc89['length'],'rows':_0x41dc89});})['catch'](handleError(_0x16a85a));};exports['conference']=function(_0x3d396b,_0x3e252f){logger[_0x344a('0x13')](_0x344a('0x45'),_0x3d396b['body']);var _0x50d937=conferenceValidation['validate'](_0x3d396b[_0x344a('0x2b')]);if(_0x50d937[_0x344a('0x36')]>0x0){return _0x3e252f[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x50d937);}var _0xb88c75=_0x3d396b['body'][_0x344a('0x2c')];return getAgent(_0xb88c75)[_0x344a('0x1d')](function(_0xee5979){logger['info'](_0x344a('0x2f'),_0xee5979['name']);emit(util['format'](_0x344a('0x38'),_0xee5979['name']),'webbar:conference');return _0x3e252f[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x344a('0x3d')](handleError(_0x3e252f));};exports['transfer']=function(_0x4332f0,_0x1b6f6e){logger[_0x344a('0x13')]('transfer\x20fired:',_0x4332f0['body']);var _0x4f79da=transferValidation[_0x344a('0xd')](_0x4332f0[_0x344a('0x2b')]);if(_0x4f79da[_0x344a('0x36')]>0x0){return _0x1b6f6e['status'](0x190)['json'](_0x4f79da);}var _0x24bd35=_0x4332f0[_0x344a('0x2b')][_0x344a('0x2c')];var _0x4f5119=_0x4332f0[_0x344a('0x2b')][_0x344a('0x37')];var _0x5b1e0e=_0x4332f0[_0x344a('0x2b')]['transferNumber'];return getAgent(_0x24bd35)[_0x344a('0x1d')](function(_0x5ba532){logger['info']('entityFound:',_0x5ba532[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x5ba532[_0x344a('0x18')]),_0x344a('0x46'),{'sessionId':_0x4f5119,'transferNumber':_0x5b1e0e});return _0x1b6f6e[_0x344a('0x19')](0xc8)['json']({'error':![],'message':_0x344a('0x47')});})[_0x344a('0x3d')](handleError(_0x1b6f6e));}; \ No newline at end of file +var _0x44a3=['client','../../config/logger','webbarapi','ioredis','redis','defaults','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','handleError:','error','stack','name','status','send','NotFound','request','then','code','result','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callbackUrl','entityFound:','format','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','length','sessionId','user:%s','webbar:hangup','hangup\x20executed!','answer','webbar:answer','catch','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','conference\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise'];(function(_0x1c9671,_0x36750d){var _0x5c24ec=function(_0x3abac1){while(--_0x3abac1){_0x1c9671['push'](_0x1c9671['shift']());}};_0x5c24ec(++_0x36750d);}(_0x44a3,0x1a9));var _0x344a=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x44a3[_0x25f797];return _0x157fdd;};'use strict';var path=require(_0x344a('0x0'));var fs=require('fs');var _=require(_0x344a('0x1'));var db=require(_0x344a('0x2'))['db'];var config=require(_0x344a('0x3'));var util=require(_0x344a('0x4'));var BPromise=require(_0x344a('0x5'));var jayson=require(_0x344a('0x6'));var amiClient=jayson[_0x344a('0x7')]['http']({'port':0x232a});var logger=require(_0x344a('0x8'))(_0x344a('0x9'));var Redis=require(_0x344a('0xa'));config[_0x344a('0xb')]=_[_0x344a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x344a('0xd'));var originateValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'callNumber':{'type':_0x344a('0x10'),'required':[!![],_0x344a('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0x344a('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x344a('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x344a('0x10'),'required':[!![],_0x344a('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x344a('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],_0x344a('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x344a('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x54a643,_0x3609ce,_0x1aad46){logger[_0x344a('0x13')](_0x54a643,_0x3609ce,JSON[_0x344a('0x14')](_0x1aad46));io['to'](_0x54a643)['emit'](_0x3609ce,_0x1aad46);}function handleError(_0x397de6){return function(_0x277c06){console['log'](_0x344a('0x15'),_0x277c06,_0x277c06 instanceof RangeError);logger[_0x344a('0x16')](_0x277c06[_0x344a('0x17')]);if(_0x277c06 instanceof RangeError){if(_0x277c06[_0x344a('0x18')]){delete _0x277c06[_0x344a('0x18')];}_0x397de6[_0x344a('0x19')](0x194)[_0x344a('0x1a')](_0x277c06);}else{if(_0x277c06[_0x344a('0x18')]){delete _0x277c06[_0x344a('0x18')];}_0x397de6[_0x344a('0x19')](0x1f4)['send'](_0x277c06);}};}function checkError(){return function(_0x16c0fe){if(!_0x16c0fe){throw new RangeError(_0x344a('0x1b'));}return _0x16c0fe;};}function respondWithRpcPromise(_0xe0bdd4,_0x21216d){return new BPromise(function(_0x240be3,_0x80ae12){var _0x185303=amiClient;return _0x185303[_0x344a('0x1c')](_0xe0bdd4,_0x21216d)[_0x344a('0x1d')](function(_0x27f527){if(_0x27f527[_0x344a('0x16')]){if(_0x27f527[_0x344a('0x16')][_0x344a('0x1e')]===0x1f4){return _0x80ae12(_0x27f527[_0x344a('0x16')]['message']);}return _0x240be3(_0x27f527[_0x344a('0x16')]['message']);}else{_0x240be3(_0x27f527[_0x344a('0x1f')]);}})['catch'](function(_0x36c920){_0x80ae12(_0x36c920);});});}function getAgent(_0x8bf0b0){return db[_0x344a('0x20')][_0x344a('0x21')]({'where':{'id':_0x8bf0b0,'role':_0x344a('0x22')}})[_0x344a('0x1d')](checkError());}function getAgentCheckSession(_0x229ccd,_0x114637){return new BPromise(function(_0x4f2499,_0x283f63){var _0x18be46=respondWithRpcPromise(_0x344a('0x23'));var _0xc02d6=getAgent(_0x229ccd);Promise[_0x344a('0x24')]([_0x18be46,_0xc02d6])[_0x344a('0x1d')](function(_0x5b877d){var _0x3d25fe=_0x5b877d[0x0];var _0x49bbf8=_0x5b877d[0x1];var _0x593cf6=_[_0x344a('0x25')](_0x3d25fe[_0x344a('0x26')],function(_0x5a36bb){return _0x5a36bb['UserId']==_0x49bbf8['id']&&_0x5a36bb['sessionId']==_0x114637;});if(_0x593cf6['length']==0x1){_0x4f2499(_0x49bbf8);}else{_0x283f63(new RangeError(_0x344a('0x27')+_0x114637+_0x344a('0x28')));}});});}exports[_0x344a('0x29')]=function(_0x58d90b,_0x25b28d){logger[_0x344a('0x13')](_0x344a('0x2a'),_0x58d90b[_0x344a('0x2b')]);var _0x20e5c6=originateValidation[_0x344a('0xd')](_0x58d90b[_0x344a('0x2b')]);if(_0x20e5c6['length']>0x0){return _0x25b28d[_0x344a('0x19')](0x190)['json'](_0x20e5c6);}var _0x47d8c3=_0x58d90b['body'][_0x344a('0x2c')];var _0x279114=_0x58d90b[_0x344a('0x2b')][_0x344a('0x2d')];var _0x1fa3ee=_0x58d90b[_0x344a('0x2b')]['callerId'];var _0x44a761=_0x58d90b[_0x344a('0x2b')][_0x344a('0x2e')];return getAgent(_0x47d8c3)['then'](function(_0x3698eb){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x3698eb[_0x344a('0x18')]);emit(util[_0x344a('0x30')]('user:%s',_0x3698eb[_0x344a('0x18')]),_0x344a('0x31'),{'callNumber':_0x279114,'callerId':_0x1fa3ee,'callbackUrl':_0x44a761});return _0x25b28d[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':_0x344a('0x33')});})['catch'](handleError(_0x25b28d));};exports[_0x344a('0x34')]=function(_0x33e48e,_0x11e81f){logger[_0x344a('0x13')](_0x344a('0x35'),_0x33e48e['body']);var _0x13c9ca=hangupValidation[_0x344a('0xd')](_0x33e48e[_0x344a('0x2b')]);if(_0x13c9ca[_0x344a('0x36')]>0x0){return _0x11e81f[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x13c9ca);}var _0x335a0a=_0x33e48e[_0x344a('0x2b')]['userId'];var _0x37b960=_0x33e48e[_0x344a('0x2b')][_0x344a('0x37')];return getAgent(_0x335a0a)[_0x344a('0x1d')](function(_0x2fc05f){logger['info'](_0x344a('0x2f'),_0x2fc05f[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x2fc05f[_0x344a('0x18')]),_0x344a('0x39'),{'sessionId':_0x37b960});return _0x11e81f[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':_0x344a('0x3a')});})['catch'](handleError(_0x11e81f));};exports[_0x344a('0x3b')]=function(_0x1bad44,_0x6e7498){logger[_0x344a('0x13')]('answer\x20fired:',_0x1bad44[_0x344a('0x2b')]);var _0x3069ca=answerValidation[_0x344a('0xd')](_0x1bad44[_0x344a('0x2b')]);if(_0x3069ca[_0x344a('0x36')]>0x0){return _0x6e7498[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x3069ca);}var _0x372e7d=_0x1bad44[_0x344a('0x2b')][_0x344a('0x2c')];var _0x2de5aa=_0x1bad44['body'][_0x344a('0x37')];return getAgent(_0x372e7d)[_0x344a('0x1d')](function(_0x5ed2f4){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x5ed2f4['name']);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x5ed2f4['name']),_0x344a('0x3c'),{'sessionId':_0x2de5aa});return _0x6e7498[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'answer\x20executed!'});})[_0x344a('0x3d')](handleError(_0x6e7498));};exports['hold']=function(_0x793893,_0x3e1564){logger[_0x344a('0x13')](_0x344a('0x3e'),_0x793893['body']);var _0x519ddd=holdValidation[_0x344a('0xd')](_0x793893[_0x344a('0x2b')]);if(_0x519ddd[_0x344a('0x36')]>0x0){return _0x3e1564[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x519ddd);}var _0xa3c8f0=_0x793893[_0x344a('0x2b')][_0x344a('0x2c')];var _0x2b629d=_0x793893[_0x344a('0x2b')]['sessionId'];return getAgent(_0xa3c8f0)[_0x344a('0x1d')](function(_0x2d9858){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x2d9858['name']);emit(util[_0x344a('0x30')]('user:%s',_0x2d9858['name']),_0x344a('0x3f'),{'sessionId':_0x2b629d});return _0x3e1564[_0x344a('0x19')](0xc8)['json']({'error':![],'message':_0x344a('0x40')});})[_0x344a('0x3d')](handleError(_0x3e1564));};exports[_0x344a('0x41')]=function(_0x226f41,_0x51e411){logger[_0x344a('0x13')](_0x344a('0x42'),_0x226f41[_0x344a('0x2b')]);var _0x173680=unholdValidation[_0x344a('0xd')](_0x226f41[_0x344a('0x2b')]);if(_0x173680[_0x344a('0x36')]>0x0){return _0x51e411[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x173680);}var _0x1911d0=_0x226f41['body'][_0x344a('0x2c')];var _0x47ce9c=_0x226f41[_0x344a('0x2b')][_0x344a('0x37')];return getAgent(_0x1911d0)[_0x344a('0x1d')](function(_0x531972){logger[_0x344a('0x13')](_0x344a('0x2f'),_0x531972[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x531972[_0x344a('0x18')]),_0x344a('0x43'),{'sessionId':_0x47ce9c});return _0x51e411[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'unhold\x20executed!'});})[_0x344a('0x3d')](handleError(_0x51e411));};exports[_0x344a('0x44')]=function(_0x10d5d1,_0x16a85a){logger[_0x344a('0x13')]('calls\x20fired:',_0x16a85a[_0x344a('0x2b')]);var _0x163047=callsValidation[_0x344a('0xd')](_0x10d5d1[_0x344a('0x2b')]);if(_0x163047['length']>0x0){return _0x16a85a[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x163047);}var _0x4c2fe7=_0x10d5d1[_0x344a('0x2b')][_0x344a('0x2c')];var _0x16482c=respondWithRpcPromise(_0x344a('0x23'));var _0x2a8fc1=getAgent(_0x4c2fe7);return Promise[_0x344a('0x24')]([_0x16482c,_0x2a8fc1])[_0x344a('0x1d')](function(_0x4b6eb2){var _0x553c17=_0x4b6eb2[0x0];var _0x4d707b=_0x4b6eb2[0x1];var _0x41dc89=_[_0x344a('0x25')](_0x553c17[_0x344a('0x26')],function(_0x239439){return _0x239439['UserId']==_0x4d707b['id'];});return _0x16a85a[_0x344a('0x19')](0xc8)['json']({'count':_0x41dc89['length'],'rows':_0x41dc89});})['catch'](handleError(_0x16a85a));};exports['conference']=function(_0x3d396b,_0x3e252f){logger[_0x344a('0x13')](_0x344a('0x45'),_0x3d396b['body']);var _0x50d937=conferenceValidation['validate'](_0x3d396b[_0x344a('0x2b')]);if(_0x50d937[_0x344a('0x36')]>0x0){return _0x3e252f[_0x344a('0x19')](0x190)[_0x344a('0x32')](_0x50d937);}var _0xb88c75=_0x3d396b['body'][_0x344a('0x2c')];return getAgent(_0xb88c75)[_0x344a('0x1d')](function(_0xee5979){logger['info'](_0x344a('0x2f'),_0xee5979['name']);emit(util['format'](_0x344a('0x38'),_0xee5979['name']),'webbar:conference');return _0x3e252f[_0x344a('0x19')](0xc8)[_0x344a('0x32')]({'error':![],'message':'conference\x20executed!'});})[_0x344a('0x3d')](handleError(_0x3e252f));};exports['transfer']=function(_0x4332f0,_0x1b6f6e){logger[_0x344a('0x13')]('transfer\x20fired:',_0x4332f0['body']);var _0x4f79da=transferValidation[_0x344a('0xd')](_0x4332f0[_0x344a('0x2b')]);if(_0x4f79da[_0x344a('0x36')]>0x0){return _0x1b6f6e['status'](0x190)['json'](_0x4f79da);}var _0x24bd35=_0x4332f0[_0x344a('0x2b')][_0x344a('0x2c')];var _0x4f5119=_0x4332f0[_0x344a('0x2b')][_0x344a('0x37')];var _0x5b1e0e=_0x4332f0[_0x344a('0x2b')]['transferNumber'];return getAgent(_0x24bd35)[_0x344a('0x1d')](function(_0x5ba532){logger['info']('entityFound:',_0x5ba532[_0x344a('0x18')]);emit(util[_0x344a('0x30')](_0x344a('0x38'),_0x5ba532[_0x344a('0x18')]),_0x344a('0x46'),{'sessionId':_0x4f5119,'transferNumber':_0x5b1e0e});return _0x1b6f6e[_0x344a('0x19')](0xc8)['json']({'error':![],'message':_0x344a('0x47')});})[_0x344a('0x3d')](handleError(_0x1b6f6e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index c3a5dab..970b23c 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 _0xef0f=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','exports'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xef0f,0x168));var _0xfef0=function(_0x4d45d6,_0x2c74f0){_0x4d45d6=_0x4d45d6-0x0;var _0x19cd3f=_0xef0f[_0x4d45d6];return _0x19cd3f;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x16')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x17')]);router['post'](_0xfef0('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x16')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x19')]);router[_0xfef0('0x16')]('/:id/applications',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router[_0xfef0('0x16')](_0xfef0('0x1b'),controller[_0xfef0('0x1c')]);router['post'](_0xfef0('0x1d'),auth['isAuthenticated'](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1f')](_0xfef0('0xd'),auth['isAuthenticated'](),controller[_0xfef0('0x20')]);router['delete'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xfef0('0x9')](),controller['removeDispositions']);router[_0xfef0('0x21')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x22')]);router[_0xfef0('0x21')](_0xfef0('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfef0('0x23')]=router; \ No newline at end of file +var _0xd117=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0xd117,0x182));var _0x7d11=function(_0xa30766,_0x6f613e){_0xa30766=_0xa30766-0x0;var _0x24e780=_0xd117[_0xa30766];return _0x24e780;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0xb')]('/:id/applications',auth[_0x7d11('0xc')](),controller[_0x7d11('0x16')]);router['post']('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0x17')]);router[_0x7d11('0x18')](_0x7d11('0x12'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x19')]);router[_0x7d11('0x18')](_0x7d11('0x1a'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x18')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1c')]);router['post'](_0x7d11('0x1d'),auth[_0x7d11('0xc')](),controller['addApplications']);router['post'](_0x7d11('0x1e'),controller['notify']);router[_0x7d11('0x18')]('/:id/send',auth[_0x7d11('0xc')](),controller[_0x7d11('0x1f')]);router[_0x7d11('0x20')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x21')]);router[_0x7d11('0x22')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x23')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7d11('0x24')]);router[_0x7d11('0x22')](_0x7d11('0x1a'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x25')]);router[_0x7d11('0x22')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller['removeAgents']);module[_0x7d11('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index cc5bee1..08afbda 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 _0x1871=['mandatoryDisposition','randomstring','exports','STRING','name','ENUM','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','setDataValue'];(function(_0x55b89f,_0x406ed4){var _0x19b24c=function(_0x3f02ac){while(--_0x3f02ac){_0x55b89f['push'](_0x55b89f['shift']());}};_0x19b24c(++_0x406ed4);}(_0x1871,0xb5));var _0x1187=function(_0x38e771,_0x2e1f91){_0x38e771=_0x38e771-0x0;var _0x2fd4fe=_0x1871[_0x38e771];return _0x2fd4fe;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1187('0x0'));module[_0x1187('0x1')]={'name':{'type':Sequelize[_0x1187('0x2')],'unique':_0x1187('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1187('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1187('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1187('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1187('0x2')]},'type':{'type':Sequelize[_0x1187('0x4')]('twilio','sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1187('0x5');}},'notificationSound':{'type':Sequelize[_0x1187('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1187('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1187('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1187('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1187('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1187('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x236875){if(!_0x236875){this[_0x1187('0x8')]('mandatoryDispositionPauseId',null);}this[_0x1187('0x8')](_0x1187('0x9'),_0x236875);}},'description':{'type':Sequelize[_0x1187('0x2')]}}; \ No newline at end of file +var _0x35e2=['ENUM','twilio','sinch','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x3a6922,_0xc728be){var _0x9c1b44=function(_0x4ffb5e){while(--_0x4ffb5e){_0x3a6922['push'](_0x3a6922['shift']());}};_0x9c1b44(++_0xc728be);}(_0x35e2,0x154));var _0x235e=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x35e2[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x235e('0x0'));var rs=require(_0x235e('0x1'));module[_0x235e('0x2')]={'name':{'type':Sequelize[_0x235e('0x3')],'unique':_0x235e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x235e('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x235e('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x235e('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x235e('0x3')]},'type':{'type':Sequelize[_0x235e('0x5')](_0x235e('0x6'),_0x235e('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0x235e('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x235e('0x8')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x235e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x235e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x235e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x235e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x235e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x235e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x235e('0xa')],'comment':_0x235e('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x235e('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4256b8){if(!_0x4256b8){this[_0x235e('0xc')](_0x235e('0xd'),null);}this['setDataValue'](_0x235e('0xe'),_0x4256b8);}},'description':{'type':Sequelize[_0x235e('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 48e21ff..2edf106 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 _0xde97=['priority','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','message_id','applications','orderBy','asc','CmContact','difference','createdAt','updatedAt','ListId','mobile','from','From','replace','messageId','MessageSid','sinch','notifications','ValidationError','from\x20is\x20mandatory','isNil','Sequelize','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','Contacts','DESC','contact','spread','interaction','autoclose','close','unmanaged','created','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','WhatsappInteraction','out','dataValues','Messages','push','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./whatsappAccount.socket','jayson/promise','client','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','WhatsappAccount,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','reject','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','keys','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','create','getDispositions','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll'];(function(_0x3e0f52,_0x3754e6){var _0xc558fd=function(_0xdebfaf){while(--_0xdebfaf){_0x3e0f52['push'](_0x3e0f52['shift']());}};_0xc558fd(++_0x3754e6);}(_0xde97,0x1c7));var _0x7de9=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xde97[_0x3b231a];return _0x18d67a;};'use strict';var emlformat=require(_0x7de9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7de9('0x1'));var jsonpatch=require(_0x7de9('0x2'));var rp=require(_0x7de9('0x3'));var moment=require('moment');var BPromise=require(_0x7de9('0x4'));var Mustache=require(_0x7de9('0x5'));var util=require('util');var path=require(_0x7de9('0x6'));var sox=require(_0x7de9('0x7'));var csv=require('to-csv');var ejs=require(_0x7de9('0x8'));var fs=require('fs');var fs_extra=require(_0x7de9('0x9'));var _=require(_0x7de9('0xa'));var squel=require(_0x7de9('0xb'));var crypto=require(_0x7de9('0xc'));var jsforce=require(_0x7de9('0xd'));var deskjs=require(_0x7de9('0xe'));var toCsv=require(_0x7de9('0xf'));var querystring=require('querystring');var Papa=require(_0x7de9('0x10'));var Redis=require('ioredis');var authService=require(_0x7de9('0x11'));var qs=require(_0x7de9('0x12'));var as=require(_0x7de9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7de9('0x14'));var utils=require(_0x7de9('0x15'));var config=require(_0x7de9('0x16'));var licenseUtil=require(_0x7de9('0x17'));var db=require(_0x7de9('0x18'))['db'];config['redis']=_[_0x7de9('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7de9('0x1a')]));require(_0x7de9('0x1b'))['register'](socket);var jayson=require(_0x7de9('0x1c'));var client=jayson[_0x7de9('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x587a5e,_0x280ac6,_0x90d0de,_0x210407){return new BPromise(function(_0x543c0f,_0x2c6841){var _0x4c8e2c=_0x210407||client;return _0x4c8e2c[_0x7de9('0x1e')](_0x587a5e,_0x90d0de)['then'](function(_0x57ce06){logger[_0x7de9('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x280ac6,_0x7de9('0x20'));logger[_0x7de9('0x21')](_0x7de9('0x22'),_0x280ac6,'request\x20sent',JSON['stringify'](_0x57ce06));if(_0x57ce06['error']){if(_0x57ce06[_0x7de9('0x23')]['code']===0x1f4){logger[_0x7de9('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x280ac6,_0x57ce06['error'][_0x7de9('0x24')]);return _0x2c6841(_0x57ce06[_0x7de9('0x23')]['message']);}logger[_0x7de9('0x23')](_0x7de9('0x25'),_0x280ac6,_0x57ce06[_0x7de9('0x23')]['message']);return _0x543c0f(_0x57ce06[_0x7de9('0x23')][_0x7de9('0x24')]);}else{logger[_0x7de9('0x1f')](_0x7de9('0x25'),_0x280ac6,_0x7de9('0x20'));_0x543c0f(_0x57ce06[_0x7de9('0x26')][_0x7de9('0x24')]);}})[_0x7de9('0x27')](function(_0x5796c7){logger['error'](_0x7de9('0x25'),_0x280ac6,_0x5796c7);_0x2c6841(_0x5796c7);});});}function respondWithStatusCode(_0x8cf813,_0x4146e2){_0x4146e2=_0x4146e2||0xcc;return function(_0x497b08){if(_0x497b08){return _0x8cf813['sendStatus'](_0x4146e2);}return _0x8cf813[_0x7de9('0x28')](_0x4146e2)[_0x7de9('0x29')]();};}function respondWithResult(_0x37be7c,_0x218ddf){_0x218ddf=_0x218ddf||0xc8;return function(_0x2fbf54){if(_0x2fbf54){return _0x37be7c[_0x7de9('0x28')](_0x218ddf)[_0x7de9('0x2a')](_0x2fbf54);}};}function respondWithFilteredResult(_0x5eb09c,_0x549bbb){return function(_0x49a5ce){if(_0x49a5ce){var _0x56f325=typeof _0x549bbb['offset']===_0x7de9('0x2b')&&typeof _0x549bbb[_0x7de9('0x2c')]===_0x7de9('0x2b');var _0x55bb8f=_0x49a5ce[_0x7de9('0x2d')];var _0x3c23ba=_0x56f325?0x0:_0x549bbb[_0x7de9('0x2e')];var _0xeb4595=_0x56f325?_0x49a5ce[_0x7de9('0x2d')]:_0x549bbb[_0x7de9('0x2e')]+_0x549bbb[_0x7de9('0x2c')];var _0x2e3bbd;if(_0xeb4595>=_0x55bb8f){_0xeb4595=_0x55bb8f;_0x2e3bbd=0xc8;}else{_0x2e3bbd=0xce;}_0x5eb09c[_0x7de9('0x28')](_0x2e3bbd);return _0x5eb09c['set'](_0x7de9('0x2f'),_0x3c23ba+'-'+_0xeb4595+'/'+_0x55bb8f)[_0x7de9('0x2a')](_0x49a5ce);}return null;};}function patchUpdates(_0x1ff408){return function(_0x4e5991){try{jsonpatch['apply'](_0x4e5991,_0x1ff408,!![]);}catch(_0x387911){return BPromise[_0x7de9('0x30')](_0x387911);}return _0x4e5991['save']();};}function saveUpdates(_0x2869ec,_0x1fd19a){return function(_0x3a482e){if(_0x3a482e){return _0x3a482e['update'](_0x2869ec)[_0x7de9('0x31')](function(_0x4bf4d2){return _0x4bf4d2;});}return null;};}function removeEntity(_0x4c0d2e,_0x2fff8d){return function(_0x495792){if(_0x495792){return _0x495792[_0x7de9('0x32')]()[_0x7de9('0x31')](function(){var _0x41e91d=_0x495792[_0x7de9('0x33')]({'plain':!![]});var _0x46a68b='WhatsappAccounts';return db[_0x7de9('0x34')]['destroy']({'where':{'type':_0x46a68b,'resourceId':_0x41e91d['id']}})['then'](function(){return _0x495792;});})[_0x7de9('0x31')](function(){_0x4c0d2e[_0x7de9('0x28')](0xcc)[_0x7de9('0x29')]();});}};}function handleEntityNotFound(_0x4f3dda,_0x4ecc71){return function(_0x31a536){if(!_0x31a536){_0x4f3dda[_0x7de9('0x35')](0x194);}return _0x31a536;};}function handleError(_0x592c8b,_0x19eb4d){_0x19eb4d=_0x19eb4d||0x1f4;return function(_0x41138d){logger[_0x7de9('0x23')](_0x41138d[_0x7de9('0x36')]);if(_0x41138d['name']){delete _0x41138d[_0x7de9('0x37')];}_0x592c8b[_0x7de9('0x28')](_0x19eb4d)[_0x7de9('0x38')](_0x41138d);};}exports[_0x7de9('0x39')]=function(_0x48a65c,_0x12ef58){var _0x227af0={'include':[{'model':db[_0x7de9('0x3a')],'as':_0x7de9('0x3b')}]},_0x3e4ddf={},_0x1b73c5={'count':0x0,'rows':[]};var _0x1c7429=_['map'](db[_0x7de9('0x3c')][_0x7de9('0x3d')],function(_0x36050){return{'name':_0x36050[_0x7de9('0x3e')],'type':_0x36050[_0x7de9('0x3f')][_0x7de9('0x40')]};});_0x3e4ddf[_0x7de9('0x41')]=_[_0x7de9('0x42')](_0x1c7429,_0x7de9('0x37'));_0x3e4ddf['query']=_['keys'](_0x48a65c['query']);_0x3e4ddf['filters']=_['intersection'](_0x3e4ddf[_0x7de9('0x41')],_0x3e4ddf[_0x7de9('0x43')]);_0x227af0['attributes']=_[_0x7de9('0x44')](_0x3e4ddf[_0x7de9('0x41')],qs['fields'](_0x48a65c[_0x7de9('0x43')][_0x7de9('0x45')]));_0x227af0[_0x7de9('0x46')]=_0x227af0['attributes'][_0x7de9('0x47')]?_0x227af0[_0x7de9('0x46')]:_0x3e4ddf['model'];if(!_0x48a65c[_0x7de9('0x43')][_0x7de9('0x48')](_0x7de9('0x49'))){_0x227af0['limit']=qs[_0x7de9('0x2c')](_0x48a65c[_0x7de9('0x43')][_0x7de9('0x2c')]);_0x227af0['offset']=qs[_0x7de9('0x2e')](_0x48a65c['query']['offset']);}_0x227af0[_0x7de9('0x4a')]=qs['sort'](_0x48a65c[_0x7de9('0x43')][_0x7de9('0x4b')]);_0x227af0[_0x7de9('0x4c')]=qs['filters'](_[_0x7de9('0x4d')](_0x48a65c['query'],_0x3e4ddf[_0x7de9('0x4e')]),_0x1c7429);if(_0x48a65c[_0x7de9('0x43')][_0x7de9('0x4f')]){_0x227af0['where']=_[_0x7de9('0x50')](_0x227af0[_0x7de9('0x4c')],{'$or':_[_0x7de9('0x42')](_0x1c7429,function(_0x4dead1){if(_0x4dead1[_0x7de9('0x3f')]!==_0x7de9('0x51')){var _0x11bb0e={};_0x11bb0e[_0x4dead1[_0x7de9('0x37')]]={'$like':'%'+_0x48a65c[_0x7de9('0x43')][_0x7de9('0x4f')]+'%'};return _0x11bb0e;}})});}_0x227af0=_[_0x7de9('0x50')]({},_0x227af0,_0x48a65c[_0x7de9('0x52')]);var _0x1d0f41={'where':_0x227af0[_0x7de9('0x4c')]};return db['WhatsappAccount'][_0x7de9('0x2d')](_0x1d0f41)[_0x7de9('0x31')](function(_0x6967f){_0x1b73c5[_0x7de9('0x2d')]=_0x6967f;if(_0x48a65c[_0x7de9('0x43')][_0x7de9('0x53')]){_0x227af0['include']=[{'all':!![]}];}return db[_0x7de9('0x3c')][_0x7de9('0x54')](_0x227af0);})['then'](function(_0x4dc674){_0x1b73c5[_0x7de9('0x55')]=_0x4dc674;return _0x1b73c5;})['then'](respondWithFilteredResult(_0x12ef58,_0x227af0))[_0x7de9('0x27')](handleError(_0x12ef58,null));};exports['show']=function(_0x5a7b1e,_0x5072d9){var _0x357c9e={'raw':![],'where':{'id':_0x5a7b1e[_0x7de9('0x56')]['id']},'include':[{'model':db[_0x7de9('0x3a')],'as':_0x7de9('0x3b')}]},_0x5b9bfb={};_0x5b9bfb[_0x7de9('0x41')]=_[_0x7de9('0x57')](db['WhatsappAccount'][_0x7de9('0x3d')]);_0x5b9bfb[_0x7de9('0x43')]=_[_0x7de9('0x57')](_0x5a7b1e['query']);_0x5b9bfb[_0x7de9('0x4e')]=_[_0x7de9('0x44')](_0x5b9bfb[_0x7de9('0x41')],_0x5b9bfb[_0x7de9('0x43')]);_0x357c9e[_0x7de9('0x46')]=_[_0x7de9('0x44')](_0x5b9bfb[_0x7de9('0x41')],qs[_0x7de9('0x45')](_0x5a7b1e['query']['fields']));_0x357c9e[_0x7de9('0x46')]=_0x357c9e[_0x7de9('0x46')][_0x7de9('0x47')]?_0x357c9e[_0x7de9('0x46')]:_0x5b9bfb[_0x7de9('0x41')];if(_0x5a7b1e[_0x7de9('0x43')]['includeAll']){_0x357c9e[_0x7de9('0x58')]=[{'all':!![]}];}_0x357c9e=_[_0x7de9('0x50')]({},_0x357c9e,_0x5a7b1e[_0x7de9('0x52')]);return db[_0x7de9('0x3c')][_0x7de9('0x59')](_0x357c9e)[_0x7de9('0x31')](handleEntityNotFound(_0x5072d9,null))[_0x7de9('0x31')](respondWithResult(_0x5072d9,null))['catch'](handleError(_0x5072d9,null));};exports['create']=function(_0x23bb46,_0x4cb87f){return db[_0x7de9('0x3c')]['create'](_0x23bb46[_0x7de9('0x5a')],{})[_0x7de9('0x31')](function(_0x19cec4){var _0x491d63=_0x23bb46[_0x7de9('0x5b')][_0x7de9('0x33')]({'plain':!![]});if(!_0x491d63)throw new Error(_0x7de9('0x5c'));if(_0x491d63[_0x7de9('0x5d')]==='user'){var _0x865765=_0x19cec4[_0x7de9('0x33')]({'plain':!![]});var _0x355d26=_0x7de9('0x5e');return db['UserProfileSection']['find']({'where':{'name':_0x355d26,'userProfileId':_0x491d63[_0x7de9('0x5f')]},'raw':!![]})[_0x7de9('0x31')](function(_0xd428f7){if(_0xd428f7&&_0xd428f7[_0x7de9('0x60')]===0x0){return db[_0x7de9('0x34')]['create']({'name':_0x865765[_0x7de9('0x37')],'resourceId':_0x865765['id'],'type':_0xd428f7['name'],'sectionId':_0xd428f7['id']},{})[_0x7de9('0x31')](function(){return _0x19cec4;});}else{return _0x19cec4;}})[_0x7de9('0x27')](function(_0x8d405e){logger[_0x7de9('0x23')](_0x7de9('0x61'),_0x8d405e);throw _0x8d405e;});}return _0x19cec4;})[_0x7de9('0x31')](respondWithResult(_0x4cb87f,0xc9))[_0x7de9('0x27')](handleError(_0x4cb87f,null));};exports[_0x7de9('0x62')]=function(_0x4630f2,_0x2282f0){if(_0x4630f2[_0x7de9('0x5a')]['id']){delete _0x4630f2[_0x7de9('0x5a')]['id'];}return db[_0x7de9('0x3c')]['find']({'where':{'id':_0x4630f2[_0x7de9('0x56')]['id']},'include':[{'model':db[_0x7de9('0x3a')],'as':_0x7de9('0x3b')}]})[_0x7de9('0x31')](handleEntityNotFound(_0x2282f0,null))[_0x7de9('0x31')](saveUpdates(_0x4630f2[_0x7de9('0x5a')],null))[_0x7de9('0x31')](respondWithResult(_0x2282f0,null))[_0x7de9('0x27')](handleError(_0x2282f0,null));};exports[_0x7de9('0x32')]=function(_0x147fee,_0x48076e){return db['WhatsappAccount'][_0x7de9('0x59')]({'where':{'id':_0x147fee['params']['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x48076e,null))[_0x7de9('0x31')](removeEntity(_0x48076e,null))['catch'](handleError(_0x48076e,null));};exports[_0x7de9('0x63')]=function(_0x5711f7,_0x59fd4b){return db[_0x7de9('0x3c')][_0x7de9('0x63')]()[_0x7de9('0x31')](respondWithResult(_0x59fd4b,null))[_0x7de9('0x27')](handleError(_0x59fd4b,null));};exports[_0x7de9('0x64')]=function(_0x21ecc7,_0x216ff4,_0x528558){if(_0x21ecc7[_0x7de9('0x5a')]['id']){delete _0x21ecc7['body']['id'];}return db['WhatsappAccount'][_0x7de9('0x59')]({'where':{'id':_0x21ecc7[_0x7de9('0x56')]['id']}})['then'](handleEntityNotFound(_0x216ff4,null))[_0x7de9('0x31')](function(_0x2ccd13){if(_0x2ccd13){_0x21ecc7['body']['WhatsappAccountId']=_0x2ccd13['id'];return db[_0x7de9('0x65')][_0x7de9('0x66')](_0x21ecc7['body']);}})[_0x7de9('0x31')](respondWithResult(_0x216ff4,null))['catch'](handleError(_0x216ff4,null));};exports[_0x7de9('0x67')]=function(_0xbea7c8,_0x28ac97,_0x5bcfca){var _0x4cf38c={'raw':![],'where':{}};var _0x386d16={};var _0x253375={'count':0x0,'rows':[]};return db[_0x7de9('0x3c')][_0x7de9('0x68')]({'where':{'id':_0xbea7c8[_0x7de9('0x56')]['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x28ac97,null))[_0x7de9('0x31')](function(_0x1ab26d){if(_0x1ab26d){_0x386d16['model']=_[_0x7de9('0x57')](db['Disposition'][_0x7de9('0x3d')]);_0x386d16[_0x7de9('0x43')]=_[_0x7de9('0x57')](_0xbea7c8['query']);_0x386d16['filters']=_[_0x7de9('0x44')](_0x386d16[_0x7de9('0x41')],_0x386d16[_0x7de9('0x43')]);_0x4cf38c[_0x7de9('0x46')]=_['intersection'](_0x386d16[_0x7de9('0x41')],qs[_0x7de9('0x45')](_0xbea7c8['query'][_0x7de9('0x45')]));_0x4cf38c[_0x7de9('0x46')]=_0x4cf38c[_0x7de9('0x46')][_0x7de9('0x47')]?_0x4cf38c[_0x7de9('0x46')]:_0x386d16[_0x7de9('0x41')];if(!_0xbea7c8[_0x7de9('0x43')][_0x7de9('0x48')](_0x7de9('0x49'))){_0x4cf38c[_0x7de9('0x2c')]=qs[_0x7de9('0x2c')](_0xbea7c8[_0x7de9('0x43')][_0x7de9('0x2c')]);_0x4cf38c[_0x7de9('0x2e')]=qs[_0x7de9('0x2e')](_0xbea7c8[_0x7de9('0x43')][_0x7de9('0x2e')]);}_0x4cf38c[_0x7de9('0x4a')]=qs['sort'](_0xbea7c8[_0x7de9('0x43')]['sort']);_0x4cf38c['where']=qs['filters'](_['pick'](_0xbea7c8['query'],_0x386d16[_0x7de9('0x4e')]));_0x4cf38c[_0x7de9('0x4c')][_0x7de9('0x69')]=_0x1ab26d['id'];if(_0xbea7c8[_0x7de9('0x43')][_0x7de9('0x4f')]){_0x4cf38c[_0x7de9('0x4c')]=_['merge'](_0x4cf38c['where'],{'$or':_[_0x7de9('0x42')](_0x4cf38c[_0x7de9('0x46')],function(_0x55a053){var _0x1742ac={};_0x1742ac[_0x55a053]={'$like':'%'+_0xbea7c8[_0x7de9('0x43')][_0x7de9('0x4f')]+'%'};return _0x1742ac;})});}_0x4cf38c=_[_0x7de9('0x50')]({},_0x4cf38c,_0xbea7c8[_0x7de9('0x52')]);return db['Disposition'][_0x7de9('0x2d')]({'where':_0x4cf38c[_0x7de9('0x4c')]})[_0x7de9('0x31')](function(_0x3e5b10){_0x253375[_0x7de9('0x2d')]=_0x3e5b10;if(_0xbea7c8['query'][_0x7de9('0x53')]){_0x4cf38c['include']=[{'all':!![]}];}return db[_0x7de9('0x65')][_0x7de9('0x54')](_0x4cf38c);})['then'](function(_0x5f0ce7){_0x253375[_0x7de9('0x55')]=_0x5f0ce7;return _0x253375;});}})['then'](respondWithFilteredResult(_0x28ac97,_0x4cf38c))[_0x7de9('0x27')](handleError(_0x28ac97,null));};exports[_0x7de9('0x6a')]=function(_0x268467,_0x5854cb,_0xd3873a){return db['WhatsappAccount'][_0x7de9('0x59')]({'where':{'id':_0x268467['params']['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x5854cb,null))[_0x7de9('0x31')](function(_0x259948){if(_0x259948){return _0x259948[_0x7de9('0x6a')](_0x268467[_0x7de9('0x43')][_0x7de9('0x6b')]);}})[_0x7de9('0x31')](respondWithStatusCode(_0x5854cb,null))[_0x7de9('0x27')](handleError(_0x5854cb,null));};exports[_0x7de9('0x6c')]=function(_0x3565dd,_0x677cea,_0x24fdb1){if(_0x3565dd[_0x7de9('0x5a')]['id']){delete _0x3565dd[_0x7de9('0x5a')]['id'];}return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x3565dd['params']['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x677cea,null))[_0x7de9('0x31')](function(_0x16ad81){if(_0x16ad81){_0x3565dd[_0x7de9('0x5a')][_0x7de9('0x69')]=_0x16ad81['id'];return db[_0x7de9('0x6d')][_0x7de9('0x66')](_0x3565dd[_0x7de9('0x5a')]);}})[_0x7de9('0x31')](respondWithResult(_0x677cea,null))[_0x7de9('0x27')](handleError(_0x677cea,null));};exports[_0x7de9('0x6e')]=function(_0x275161,_0x1834d0,_0x12a91d){var _0x545372={'raw':![],'where':{}};var _0x24fc7b={};var _0x162944={'count':0x0,'rows':[]};return db[_0x7de9('0x3c')][_0x7de9('0x68')]({'where':{'id':_0x275161[_0x7de9('0x56')]['id']}})['then'](handleEntityNotFound(_0x1834d0,null))[_0x7de9('0x31')](function(_0x57752f){if(_0x57752f){_0x24fc7b['model']=_[_0x7de9('0x57')](db['CannedAnswer'][_0x7de9('0x3d')]);_0x24fc7b[_0x7de9('0x43')]=_[_0x7de9('0x57')](_0x275161['query']);_0x24fc7b['filters']=_[_0x7de9('0x44')](_0x24fc7b['model'],_0x24fc7b[_0x7de9('0x43')]);_0x545372[_0x7de9('0x46')]=_['intersection'](_0x24fc7b[_0x7de9('0x41')],qs['fields'](_0x275161[_0x7de9('0x43')]['fields']));_0x545372[_0x7de9('0x46')]=_0x545372[_0x7de9('0x46')][_0x7de9('0x47')]?_0x545372[_0x7de9('0x46')]:_0x24fc7b[_0x7de9('0x41')];if(!_0x275161['query'][_0x7de9('0x48')](_0x7de9('0x49'))){_0x545372[_0x7de9('0x2c')]=qs[_0x7de9('0x2c')](_0x275161[_0x7de9('0x43')]['limit']);_0x545372[_0x7de9('0x2e')]=qs[_0x7de9('0x2e')](_0x275161[_0x7de9('0x43')][_0x7de9('0x2e')]);}_0x545372[_0x7de9('0x4a')]=qs['sort'](_0x275161[_0x7de9('0x43')][_0x7de9('0x4b')]);_0x545372[_0x7de9('0x4c')]=qs[_0x7de9('0x4e')](_[_0x7de9('0x4d')](_0x275161[_0x7de9('0x43')],_0x24fc7b['filters']));_0x545372[_0x7de9('0x4c')]['WhatsappAccountId']=_0x57752f['id'];if(_0x275161[_0x7de9('0x43')][_0x7de9('0x4f')]){_0x545372['where']=_['merge'](_0x545372[_0x7de9('0x4c')],{'$or':_[_0x7de9('0x42')](_0x545372[_0x7de9('0x46')],function(_0x2b5bde){var _0x35b5f0={};_0x35b5f0[_0x2b5bde]={'$like':'%'+_0x275161[_0x7de9('0x43')]['filter']+'%'};return _0x35b5f0;})});}_0x545372=_[_0x7de9('0x50')]({},_0x545372,_0x275161[_0x7de9('0x52')]);return db['CannedAnswer'][_0x7de9('0x2d')]({'where':_0x545372[_0x7de9('0x4c')]})[_0x7de9('0x31')](function(_0x109f11){_0x162944[_0x7de9('0x2d')]=_0x109f11;if(_0x275161[_0x7de9('0x43')]['includeAll']){_0x545372[_0x7de9('0x58')]=[{'all':!![]}];}return db[_0x7de9('0x6d')][_0x7de9('0x54')](_0x545372);})[_0x7de9('0x31')](function(_0x5cd9e4){_0x162944['rows']=_0x5cd9e4;return _0x162944;});}})[_0x7de9('0x31')](respondWithFilteredResult(_0x1834d0,_0x545372))['catch'](handleError(_0x1834d0,null));};exports[_0x7de9('0x6f')]=function(_0x5e98d8,_0x4abab0,_0xc229b8){return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x5e98d8['params']['id']}})['then'](handleEntityNotFound(_0x4abab0,null))[_0x7de9('0x31')](function(_0x5a1610){if(_0x5a1610){return _0x5a1610[_0x7de9('0x6f')](_0x5e98d8['query'][_0x7de9('0x6b')]);}})['then'](respondWithStatusCode(_0x4abab0,null))[_0x7de9('0x27')](handleError(_0x4abab0,null));};exports[_0x7de9('0x70')]=function(_0x3badab,_0x1d2335,_0x1dbbdf){return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x3badab[_0x7de9('0x56')]['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x1d2335,null))[_0x7de9('0x31')](function(_0xe10688){if(_0xe10688){return _0xe10688[_0x7de9('0x70')](_0x3badab[_0x7de9('0x5a')][_0x7de9('0x6b')],_[_0x7de9('0x71')](_0x3badab[_0x7de9('0x5a')],[_0x7de9('0x6b'),'id'])||{})['spread'](function(_0x559dbc){for(var _0x403f22=0x0;_0x403f22<_0x3badab[_0x7de9('0x5a')][_0x7de9('0x6b')][_0x7de9('0x47')];_0x403f22+=0x1){socket[_0x7de9('0x72')]('userWhatsappAccount:save',{'UserId':Number(_0x3badab[_0x7de9('0x5a')][_0x7de9('0x6b')][_0x403f22]),'WhatsappAccountId':Number(_0x3badab[_0x7de9('0x56')]['id'])});}return _0x559dbc;});}})['then'](respondWithResult(_0x1d2335,null))[_0x7de9('0x27')](handleError(_0x1d2335,null));};exports['removeAgents']=function(_0x1eba8d,_0x2774d0,_0x348ff2){return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x1eba8d[_0x7de9('0x56')]['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x2774d0,null))[_0x7de9('0x31')](function(_0x272011){if(_0x272011){return _0x272011[_0x7de9('0x73')](_0x1eba8d['query'][_0x7de9('0x6b')])[_0x7de9('0x31')](function(){if(_[_0x7de9('0x74')](_0x1eba8d['query'][_0x7de9('0x6b')])){for(var _0x1c7729=0x0;_0x1c7729<_0x1eba8d['query'][_0x7de9('0x6b')][_0x7de9('0x47')];_0x1c7729+=0x1){socket[_0x7de9('0x72')](_0x7de9('0x75'),{'UserId':Number(_0x1eba8d['query']['ids'][_0x1c7729]),'WhatsappAccountId':Number(_0x1eba8d[_0x7de9('0x56')]['id'])});}}else{socket[_0x7de9('0x72')](_0x7de9('0x75'),{'UserId':Number(_0x1eba8d[_0x7de9('0x43')][_0x7de9('0x6b')]),'WhatsappAccountId':Number(_0x1eba8d[_0x7de9('0x56')]['id'])});}});}})[_0x7de9('0x31')](respondWithStatusCode(_0x2774d0,null))['catch'](handleError(_0x2774d0,null));};exports['getAgents']=function(_0x25953c,_0x5b9f91,_0x1b183b){var _0x4f1e9b={};var _0x2b8346={};var _0x572fd0;var _0xcd764d;return db[_0x7de9('0x3c')][_0x7de9('0x68')]({'where':{'id':_0x25953c['params']['id']}})[_0x7de9('0x31')](handleEntityNotFound(_0x5b9f91,null))[_0x7de9('0x31')](function(_0x427fc6){if(_0x427fc6){_0x572fd0=_0x427fc6;_0x2b8346[_0x7de9('0x41')]=_[_0x7de9('0x57')](db[_0x7de9('0x76')][_0x7de9('0x3d')]);_0x2b8346[_0x7de9('0x43')]=_[_0x7de9('0x57')](_0x25953c['query']);_0x2b8346[_0x7de9('0x4e')]=_[_0x7de9('0x44')](_0x2b8346['model'],_0x2b8346[_0x7de9('0x43')]);_0x4f1e9b['attributes']=_[_0x7de9('0x44')](_0x2b8346[_0x7de9('0x41')],qs[_0x7de9('0x45')](_0x25953c['query'][_0x7de9('0x45')]));_0x4f1e9b[_0x7de9('0x46')]=_0x4f1e9b['attributes'][_0x7de9('0x47')]?_0x4f1e9b['attributes']:_0x2b8346['model'];_0x4f1e9b[_0x7de9('0x4a')]=qs['sort'](_0x25953c[_0x7de9('0x43')][_0x7de9('0x4b')]);_0x4f1e9b[_0x7de9('0x4c')]=qs[_0x7de9('0x4e')](_[_0x7de9('0x4d')](_0x25953c[_0x7de9('0x43')],_0x2b8346[_0x7de9('0x4e')]));if(_0x25953c[_0x7de9('0x43')]['filter']){_0x4f1e9b[_0x7de9('0x4c')]=_[_0x7de9('0x50')](_0x4f1e9b[_0x7de9('0x4c')],{'$or':_['map'](_0x4f1e9b[_0x7de9('0x46')],function(_0x21a088){var _0x2129a2={};_0x2129a2[_0x21a088]={'$like':'%'+_0x25953c[_0x7de9('0x43')][_0x7de9('0x4f')]+'%'};return _0x2129a2;})});}_0x4f1e9b=_[_0x7de9('0x50')]({},_0x4f1e9b,_0x25953c[_0x7de9('0x52')]);return _0x572fd0[_0x7de9('0x77')](_0x4f1e9b);}})[_0x7de9('0x31')](function(_0x495be1){if(_0x495be1){_0xcd764d=_0x495be1[_0x7de9('0x47')];if(!_0x25953c[_0x7de9('0x43')][_0x7de9('0x48')](_0x7de9('0x49'))){_0x4f1e9b[_0x7de9('0x2c')]=qs[_0x7de9('0x2c')](_0x25953c[_0x7de9('0x43')][_0x7de9('0x2c')]);_0x4f1e9b[_0x7de9('0x2e')]=qs[_0x7de9('0x2e')](_0x25953c[_0x7de9('0x43')]['offset']);}return _0x572fd0['getAgents'](_0x4f1e9b);}})[_0x7de9('0x31')](function(_0x5cbcf8){if(_0x5cbcf8){return _0x5cbcf8?{'count':_0xcd764d,'rows':_0x5cbcf8}:null;}})[_0x7de9('0x31')](respondWithResult(_0x5b9f91,null))['catch'](handleError(_0x5b9f91,null));};exports[_0x7de9('0x78')]=function(_0x6c776e,_0x255f85){var _0x41db1e=_0x6c776e[_0x7de9('0x56')]['id'];var _0x2d830a=_0x6c776e[_0x7de9('0x5a')];var _0x2ef0dc=0xc8;var _0x380d62=null;return db[_0x7de9('0x79')][_0x7de9('0x7a')]({'isolationLevel':db[_0x7de9('0x79')]['Transaction'][_0x7de9('0x7b')][_0x7de9('0x7c')]},function(_0x46a5f5){return db[_0x7de9('0x3c')][_0x7de9('0x68')]({'where':{'id':_0x41db1e},'transaction':_0x46a5f5})[_0x7de9('0x31')](function(_0x133c8f){if(_0x133c8f){return db[_0x7de9('0x7d')][_0x7de9('0x32')]({'where':{'WhatsappAccountId':_0x41db1e},'transaction':_0x46a5f5})['then'](function(){var _0x3173a0=_[_0x7de9('0x42')](_0x2d830a,function(_0x270fb6){_0x270fb6[_0x7de9('0x69')]=_0x41db1e;return _0x270fb6;});return db[_0x7de9('0x7d')]['bulkCreate'](_0x3173a0,{'transaction':_0x46a5f5});});}else{_0x2ef0dc=0x194;_0x380d62=[];}});})[_0x7de9('0x31')](function(){if(_0x2ef0dc!==0x194){return db[_0x7de9('0x7d')][_0x7de9('0x7e')]({'where':{'WhatsappAccountId':_0x41db1e},'order':_0x7de9('0x7f')})[_0x7de9('0x31')](function(_0x43b23f){_0x380d62=_0x43b23f;});}})[_0x7de9('0x27')](function(_0x435de8){_0x2ef0dc=0x1f4;logger[_0x7de9('0x23')](_0x435de8[_0x7de9('0x36')]);if(_0x435de8[_0x7de9('0x37')]){delete _0x435de8[_0x7de9('0x37')];}_0x380d62=_0x435de8;})['finally'](function(){if(_0x380d62===null){_0x255f85[_0x7de9('0x35')](_0x2ef0dc);}else{if(_0x2ef0dc===0x1f4){_0x255f85['status'](_0x2ef0dc)[_0x7de9('0x38')](_0x380d62);}else{_0x255f85['status'](_0x2ef0dc)[_0x7de9('0x2a')](_0x380d62);}}});};exports[_0x7de9('0x80')]=function(_0x532979,_0x57c6ed,_0x3476ef){var _0x2ea90b={};var _0x51dd93={};var _0x4738cd;var _0x17c731;return db[_0x7de9('0x3c')][_0x7de9('0x68')]({'where':{'id':_0x532979[_0x7de9('0x56')]['id']}})['then'](handleEntityNotFound(_0x57c6ed,null))[_0x7de9('0x31')](function(_0x446c46){if(_0x446c46){_0x4738cd=_0x446c46;_0x51dd93[_0x7de9('0x41')]=_[_0x7de9('0x57')](db[_0x7de9('0x7d')][_0x7de9('0x3d')]);_0x51dd93[_0x7de9('0x43')]=_[_0x7de9('0x57')](_0x532979[_0x7de9('0x43')]);_0x51dd93['filters']=_[_0x7de9('0x44')](_0x51dd93[_0x7de9('0x41')],_0x51dd93['query']);_0x2ea90b[_0x7de9('0x46')]=_[_0x7de9('0x44')](_0x51dd93[_0x7de9('0x41')],qs[_0x7de9('0x45')](_0x532979[_0x7de9('0x43')][_0x7de9('0x45')]));_0x2ea90b[_0x7de9('0x46')]=_0x2ea90b[_0x7de9('0x46')]['length']?_0x2ea90b[_0x7de9('0x46')]:_0x51dd93[_0x7de9('0x41')];_0x2ea90b['order']=qs[_0x7de9('0x4b')](_0x532979[_0x7de9('0x43')][_0x7de9('0x4b')]);_0x2ea90b[_0x7de9('0x4c')]=qs[_0x7de9('0x4e')](_[_0x7de9('0x4d')](_0x532979[_0x7de9('0x43')],_0x51dd93[_0x7de9('0x4e')]));if(_0x532979[_0x7de9('0x43')][_0x7de9('0x4f')]){_0x2ea90b[_0x7de9('0x4c')]=_[_0x7de9('0x50')](_0x2ea90b[_0x7de9('0x4c')],{'$or':_[_0x7de9('0x42')](_0x2ea90b[_0x7de9('0x46')],function(_0x41b953){var _0x5b041f={};_0x5b041f[_0x41b953]={'$like':'%'+_0x532979['query']['filter']+'%'};return _0x5b041f;})});}_0x2ea90b=_[_0x7de9('0x50')]({},_0x2ea90b,_0x532979[_0x7de9('0x52')]);return _0x4738cd[_0x7de9('0x80')](_0x2ea90b);}})[_0x7de9('0x31')](function(_0x29240a){if(_0x29240a){_0x17c731=_0x29240a[_0x7de9('0x47')];if(!_0x532979[_0x7de9('0x43')]['hasOwnProperty']('nolimit')){_0x2ea90b[_0x7de9('0x2c')]=qs[_0x7de9('0x2c')](_0x532979['query'][_0x7de9('0x2c')]);_0x2ea90b[_0x7de9('0x2e')]=qs[_0x7de9('0x2e')](_0x532979[_0x7de9('0x43')][_0x7de9('0x2e')]);}return _0x4738cd[_0x7de9('0x80')](_0x2ea90b);}})[_0x7de9('0x31')](function(_0x953ee2){if(_0x953ee2){return _0x953ee2?{'count':_0x17c731,'rows':_0x953ee2}:null;}})[_0x7de9('0x31')](respondWithResult(_0x57c6ed,null))[_0x7de9('0x27')](handleError(_0x57c6ed,null));};exports[_0x7de9('0x81')]=function(_0x5ba182,_0x43c1d2,_0x570a01){var _0x66f944={'channel':_0x7de9('0x82')};var _0x4dd6af=[];var _0x494962=[];var _0x3d80d5={};return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x5ba182['params']['id']},'include':[{'model':db[_0x7de9('0x7d')],'as':_0x7de9('0x83')}]})[_0x7de9('0x31')](handleEntityNotFound(_0x43c1d2,null))[_0x7de9('0x31')](function(_0x25b478){_0x66f944['account']=_0x25b478;if(_0x66f944[_0x7de9('0x84')]&&_0x66f944[_0x7de9('0x84')]['type']==='sinch'&&_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x85')]){if(_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x85')][_0x7de9('0x47')]===0x0)return;if(_0x5ba182['body'][_0x7de9('0x85')][0x0][_0x7de9('0x86')]!==_0x7de9('0x87'))return;return db[_0x7de9('0x88')][_0x7de9('0x62')]({'read':!![],'readAt':_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x85')][0x0]['timestamp']},{'where':{'messageId':_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x85')][0x0][_0x7de9('0x89')]},'individualHooks':!![]})[_0x7de9('0x31')](function(_0x23e986){return _0x43c1d2['status'](0xc8)[_0x7de9('0x2a')](_0x23e986);});}_0x66f944[_0x7de9('0x8a')]=_[_0x7de9('0x8b')](_0x25b478[_0x7de9('0x83')],[_0x7de9('0x7f')],[_0x7de9('0x8c')]);if(_0x66f944[_0x7de9('0x84')]['Applications']){delete _0x66f944['account'][_0x7de9('0x83')];}return db[_0x7de9('0x8d')]['describe']()[_0x7de9('0x31')](function(_0x395883){if(!_0x395883){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4dd6af=_[_0x7de9('0x8e')](_['keys'](_0x395883),[_0x7de9('0x8f'),_0x7de9('0x90')]);_0x494962=_[_0x7de9('0x8e')](_[_0x7de9('0x57')](_0x395883),[_0x7de9('0x8f'),_0x7de9('0x90'),'CompanyId',_0x7de9('0x91')]);_0x66f944[_0x7de9('0x5a')]={'mapKey':_0x7de9('0x92')};if(_0x66f944[_0x7de9('0x84')]&&_0x66f944[_0x7de9('0x84')][_0x7de9('0x3f')]==='twilio'){_0x66f944[_0x7de9('0x5a')][_0x7de9('0x93')]=_0x5ba182['body'][_0x7de9('0x94')][_0x7de9('0x95')]('whatsapp:','');_0x66f944[_0x7de9('0x5a')]['body']=_0x5ba182[_0x7de9('0x5a')]['Body'];_0x66f944['body'][_0x7de9('0x96')]=_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x97')];}if(_0x66f944[_0x7de9('0x84')]&&_0x66f944[_0x7de9('0x84')][_0x7de9('0x3f')]===_0x7de9('0x98')){_0x66f944[_0x7de9('0x5a')][_0x7de9('0x93')]=_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x99')][0x0][_0x7de9('0x93')];_0x66f944[_0x7de9('0x5a')]['body']=_0x5ba182[_0x7de9('0x5a')][_0x7de9('0x99')][0x0][_0x7de9('0x24')][_0x7de9('0x5a')];_0x66f944[_0x7de9('0x5a')][_0x7de9('0x96')]=_0x5ba182['body']['notifications'][0x0][_0x7de9('0x89')];}if(_0x66f944['body']['id']){delete _0x66f944[_0x7de9('0x5a')]['id'];}if(_['isNil'](_0x66f944['body']['from'])){throw new db['Sequelize'][(_0x7de9('0x9a'))](_0x7de9('0x9b'));}if(_[_0x7de9('0x9c')](_0x66f944[_0x7de9('0x5a')][_0x7de9('0x5a')])||_0x66f944[_0x7de9('0x5a')]['body']===''){throw new db[(_0x7de9('0x9d'))]['ValidationError'](_0x7de9('0x9e'));}if(_[_0x7de9('0x9c')](_0x66f944[_0x7de9('0x5a')][_0x7de9('0x9f')])){throw new db[(_0x7de9('0x9d'))][(_0x7de9('0x9a'))](_0x7de9('0xa0')+_0x494962);}if(!_[_0x7de9('0xa1')](_0x494962,_0x66f944[_0x7de9('0x5a')][_0x7de9('0x9f')])){throw new db[(_0x7de9('0x9d'))][(_0x7de9('0x9a'))](_0x7de9('0xa2')+_0x494962);}_0x3d80d5[_0x66f944[_0x7de9('0x5a')][_0x7de9('0x9f')]]=_0x66f944[_0x7de9('0x5a')]['from'];return db[_0x7de9('0xa3')]['find']({'where':{'id':_0x66f944[_0x7de9('0x84')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x7de9('0xa4'),'where':_0x3d80d5,'limit':0x1,'order':[['updatedAt',_0x7de9('0xa5')]]}]});})['then'](handleEntityNotFound(_0x43c1d2,null))[_0x7de9('0x31')](function(_0x2366d0){if(_0x2366d0){_0x66f944['list']=_[_0x7de9('0x71')](_0x2366d0,[_0x7de9('0xa4')]);if(_0x2366d0[_0x7de9('0xa4')]['length']){return _0x2366d0[_0x7de9('0xa4')][0x0];}var _0x5aeaaf=_['defaults'](_0x66f944['body'],{'firstName':_0x66f944[_0x7de9('0x5a')][_0x7de9('0x93')],'ListId':_0x2366d0['id']});_0x5aeaaf[_0x66f944[_0x7de9('0x5a')][_0x7de9('0x9f')]]=_0x66f944[_0x7de9('0x5a')][_0x7de9('0x93')];return db['CmContact']['create'](_0x5aeaaf,{'fields':_0x4dd6af,'raw':!![]});}})['then'](handleEntityNotFound(_0x43c1d2,null))[_0x7de9('0x31')](function(_0x58eda8){if(_0x58eda8){_0x66f944[_0x7de9('0xa6')]=_0x58eda8;var _0xed3b3e={'ContactId':_0x58eda8['id'],'phone':_0x66f944[_0x7de9('0x5a')]['from'],'WhatsappAccountId':_0x5ba182['params']['id']};var _0x148f8f={'ContactId':_0x58eda8['id'],'WhatsappAccountId':_0x5ba182[_0x7de9('0x56')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x148f8f})['then'](function(_0x188894){if(_0x188894){return[_0x188894,![]];}return db['WhatsappInteraction'][_0x7de9('0x66')](_0xed3b3e)['then'](function(_0x5d966e){return[_0x5d966e,!![]];});});}})[_0x7de9('0xa7')](function(_0x519c9c,_0x437218){_0x66f944[_0x7de9('0xa8')]=_0x519c9c[_0x7de9('0x33')]({'plain':!![]});_0x66f944['interaction']['created']=![];if(_0x437218){if(_0x66f944['account'][_0x7de9('0xa9')]){_0x66f944[_0x7de9('0x8a')]['push']({'id':0x0,'priority':_0x66f944[_0x7de9('0x8a')][_0x7de9('0x47')]+0x1,'app':_0x7de9('0xaa'),'appdata':_0x7de9('0xab'),'interval':'*,*,*,*'});}_0x66f944[_0x7de9('0xa8')][_0x7de9('0xac')]=!![];}return db[_0x7de9('0x88')][_0x7de9('0x66')]({'phone':_0x66f944[_0x7de9('0x5a')][_0x7de9('0x93')],'messageId':_0x66f944['body'][_0x7de9('0x96')],'body':_0x66f944[_0x7de9('0x5a')][_0x7de9('0x5a')],'WhatsappAccountId':_0x5ba182[_0x7de9('0x56')]['id'],'WhatsappInteractionId':_0x519c9c['id'],'direction':'in','ContactId':_0x519c9c['ContactId'],'AttachmentId':_0x66f944[_0x7de9('0x5a')]['AttachmentId']});})[_0x7de9('0x31')](function(_0x3ab04b){_0x66f944[_0x7de9('0x24')]=_0x3ab04b;if(_0x66f944[_0x7de9('0xa8')]['UserId']){return db['User'][_0x7de9('0x59')]({'attributes':['id',_0x7de9('0x37')],'where':{'id':_0x66f944[_0x7de9('0xa8')][_0x7de9('0xad')]}})[_0x7de9('0x31')](function(_0x238144){if(_0x238144){_0x66f944[_0x7de9('0x8a')][_0x7de9('0xae')]({'id':0x0,'priority':0x0,'app':_0x7de9('0xaf'),'appdata':_0x238144[_0x7de9('0x37')]+','+(_0x66f944['account'][_0x7de9('0xb0')]||0xa),'interval':_0x7de9('0xb1')});}return respondWithRpcPromise(_0x7de9('0xb2'),_0x7de9('0xb3'),_0x66f944);});}return respondWithRpcPromise(_0x7de9('0xb2'),'startRouting',_0x66f944);})[_0x7de9('0x31')](function(_0x4a4509){if(_0x4a4509){var _0x27615f=0xc8;var _0x4b2cf7=_0x7de9('0xb4');logger[_0x7de9('0x1f')](_0x7de9('0x22'),_0x4b2cf7,_0x27615f,_0x7de9('0xb5'));logger[_0x7de9('0x21')](_0x7de9('0xb6'),_0x4b2cf7,_0x27615f,_0x7de9('0xb5'),JSON[_0x7de9('0xb7')](_0x4a4509));if(_0x66f944[_0x7de9('0x84')][_0x7de9('0x3f')]==='twilio'){return _0x43c1d2[_0x7de9('0x28')](_0x27615f)['set'](_0x7de9('0xb8'),_0x7de9('0xb9'))[_0x7de9('0x38')](_0x7de9('0xba'));}else{return _0x43c1d2[_0x7de9('0x28')](_0x27615f)[_0x7de9('0x2a')](_0x4a4509);}}});})[_0x7de9('0x27')](handleError(_0x43c1d2,null));};exports[_0x7de9('0x38')]=function(_0x1b02ef,_0x4bf791,_0x384c28){var _0x3cc346,_0x1421d3,_0x29dd17;if(_[_0x7de9('0x9c')](_0x1b02ef['body'][_0x7de9('0x5a')])||_0x1b02ef['body']['body']===''){throw new db['Sequelize'][(_0x7de9('0x9a'))](_0x7de9('0x9e'));}if(_[_0x7de9('0x9c')](_0x1b02ef['body']['to'])){throw new db[(_0x7de9('0x9d'))]['ValidationError'](_0x7de9('0xbb'));}_0x3cc346=_0x1b02ef[_0x7de9('0x5a')]['to'];return db[_0x7de9('0x3c')][_0x7de9('0x59')]({'where':{'id':_0x1b02ef['params']['id']},'include':[{'model':db[_0x7de9('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x3cc346},'limit':0x1,'order':[[_0x7de9('0x90'),_0x7de9('0xa5')]]}]}]})[_0x7de9('0x31')](handleEntityNotFound(_0x4bf791,null))[_0x7de9('0x31')](function(_0x1581fd){if(_0x1581fd&&_0x1581fd[_0x7de9('0xbc')]){_0x1421d3=_0x1581fd[_0x7de9('0x33')]({'plain':!![]});if(_0x1421d3[_0x7de9('0xbc')]&&_0x1421d3[_0x7de9('0xbc')]['Contacts'][_0x7de9('0x47')]){return _0x1421d3[_0x7de9('0xbc')][_0x7de9('0xa4')][0x0];}return db['CmContact'][_0x7de9('0x66')](_[_0x7de9('0x19')](_0x1b02ef[_0x7de9('0x5a')],{'firstName':_0x3cc346,'mobile':_0x3cc346,'phone':_0x3cc346,'ListId':_0x1421d3[_0x7de9('0x91')]}));}})[_0x7de9('0x31')](handleEntityNotFound(_0x4bf791,null))[_0x7de9('0x31')](function(_0x323843){if(_0x323843){_0x29dd17=_0x323843;return db[_0x7de9('0xbd')]['find']({'where':{'ContactId':_0x29dd17['id'],'closed':![],'WhatsappAccountId':_0x1421d3['id']}})[_0x7de9('0x31')](function(_0xdbd36c){if(_0xdbd36c){return[_0xdbd36c,![]];}return db[_0x7de9('0xbd')][_0x7de9('0x66')]({'UserId':_0x1b02ef['user']['id'],'ContactId':_0x29dd17['id'],'WhatsappAccountId':_0x1421d3['id'],'phone':_0x3cc346,'firstMsgDirection':_0x7de9('0xbe'),'Messages':[_[_0x7de9('0x50')](_0x1b02ef[_0x7de9('0x5a')],{'read':![],'body':_0x1b02ef[_0x7de9('0x5a')][_0x7de9('0x5a')],'phone':_0x3cc346,'WhatsappAccountId':_0x1421d3['id'],'UserId':_0x1b02ef['user']['id'],'ContactId':_0x29dd17['id']})]},{'include':[{'model':db[_0x7de9('0x88')],'as':'Messages'}]})[_0x7de9('0x31')](function(_0x4db863){return[_0x4db863,!![]];});});}})['spread'](function(_0x4cbfd5,_0x31b7bd){if(_0x31b7bd){return _0x4cbfd5;}return db[_0x7de9('0x88')][_0x7de9('0x66')](_[_0x7de9('0x50')](_0x1b02ef['body'],{'read':![],'body':_0x1b02ef[_0x7de9('0x5a')]['body'],'phone':_0x3cc346,'WhatsappAccountId':_0x1421d3['id'],'WhatsappInteractionId':_0x4cbfd5['id'],'UserId':_0x1b02ef[_0x7de9('0x5b')]['id'],'ContactId':_0x29dd17['id']}))[_0x7de9('0x31')](function(_0x424dbd){_0x4cbfd5[_0x7de9('0xbf')][_0x7de9('0xc0')]=[];_0x4cbfd5[_0x7de9('0xbf')][_0x7de9('0xc0')][_0x7de9('0xc1')](_0x424dbd['dataValues']);return _0x4cbfd5;});})[_0x7de9('0x31')](respondWithResult(_0x4bf791,null))['catch'](handleError(_0x4bf791,null));}; \ No newline at end of file +var _0x2617=['mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','created','WhatsappMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','WhatsappAccount','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','show','params','Pause','keys','includeAll','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','destroy','describe','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','stack','getApplications','notify','whatsapp','account','statuses','state','read','timestamp','message_id','applications','orderBy','asc','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','messageId','notifications','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x30854b,_0xb8050c){var _0x82fb5a=function(_0x539efe){while(--_0x539efe){_0x30854b['push'](_0x30854b['shift']());}};_0x82fb5a(++_0xb8050c);}(_0x2617,0x1ab));var _0x7261=function(_0x536907,_0x4ef187){_0x536907=_0x536907-0x0;var _0x6d0484=_0x2617[_0x536907];return _0x6d0484;};'use strict';var emlformat=require(_0x7261('0x0'));var rimraf=require(_0x7261('0x1'));var zipdir=require(_0x7261('0x2'));var jsonpatch=require(_0x7261('0x3'));var rp=require(_0x7261('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7261('0x5'));var path=require('path');var sox=require(_0x7261('0x6'));var csv=require('to-csv');var ejs=require(_0x7261('0x7'));var fs=require('fs');var fs_extra=require(_0x7261('0x8'));var _=require(_0x7261('0x9'));var squel=require(_0x7261('0xa'));var crypto=require(_0x7261('0xb'));var jsforce=require(_0x7261('0xc'));var deskjs=require(_0x7261('0xd'));var toCsv=require(_0x7261('0xe'));var querystring=require(_0x7261('0xf'));var Papa=require('papaparse');var Redis=require(_0x7261('0x10'));var authService=require(_0x7261('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7261('0x12'));var hardwareService=require(_0x7261('0x13'));var logger=require('../../config/logger')(_0x7261('0x14'));var utils=require('../../config/utils');var config=require(_0x7261('0x15'));var licenseUtil=require(_0x7261('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7261('0x17')](config[_0x7261('0x18')],{'host':_0x7261('0x19'),'port':0x18eb});var socket=require(_0x7261('0x1a'))(new Redis(config[_0x7261('0x18')]));require(_0x7261('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7261('0x1c')][_0x7261('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x3dfb7e,_0x4ddfa8,_0x140342,_0xffc46d){return new BPromise(function(_0x1711f6,_0x4150a6){var _0x2e0e64=_0xffc46d||client;return _0x2e0e64[_0x7261('0x1e')](_0x3dfb7e,_0x140342)[_0x7261('0x1f')](function(_0x14a6eb){logger[_0x7261('0x20')](_0x7261('0x21'),_0x4ddfa8,_0x7261('0x22'));logger[_0x7261('0x23')](_0x7261('0x24'),_0x4ddfa8,_0x7261('0x22'),JSON[_0x7261('0x25')](_0x14a6eb));if(_0x14a6eb[_0x7261('0x26')]){if(_0x14a6eb['error']['code']===0x1f4){logger['error'](_0x7261('0x21'),_0x4ddfa8,_0x14a6eb[_0x7261('0x26')][_0x7261('0x27')]);return _0x4150a6(_0x14a6eb[_0x7261('0x26')][_0x7261('0x27')]);}logger[_0x7261('0x26')](_0x7261('0x21'),_0x4ddfa8,_0x14a6eb[_0x7261('0x26')][_0x7261('0x27')]);return _0x1711f6(_0x14a6eb[_0x7261('0x26')][_0x7261('0x27')]);}else{logger[_0x7261('0x20')](_0x7261('0x21'),_0x4ddfa8,_0x7261('0x22'));_0x1711f6(_0x14a6eb['result'][_0x7261('0x27')]);}})[_0x7261('0x28')](function(_0x128d67){logger[_0x7261('0x26')](_0x7261('0x21'),_0x4ddfa8,_0x128d67);_0x4150a6(_0x128d67);});});}function respondWithStatusCode(_0x5eac55,_0x566d04){_0x566d04=_0x566d04||0xcc;return function(_0x565e62){if(_0x565e62){return _0x5eac55[_0x7261('0x29')](_0x566d04);}return _0x5eac55[_0x7261('0x2a')](_0x566d04)[_0x7261('0x2b')]();};}function respondWithResult(_0x3b2dcd,_0x13f046){_0x13f046=_0x13f046||0xc8;return function(_0x71eb54){if(_0x71eb54){return _0x3b2dcd[_0x7261('0x2a')](_0x13f046)[_0x7261('0x2c')](_0x71eb54);}};}function respondWithFilteredResult(_0x4d4d5f,_0x5e4722){return function(_0x484cf9){if(_0x484cf9){var _0x441ab2=typeof _0x5e4722[_0x7261('0x2d')]===_0x7261('0x2e')&&typeof _0x5e4722['limit']===_0x7261('0x2e');var _0x338f7f=_0x484cf9[_0x7261('0x2f')];var _0x56bd7c=_0x441ab2?0x0:_0x5e4722['offset'];var _0x59a44c=_0x441ab2?_0x484cf9[_0x7261('0x2f')]:_0x5e4722['offset']+_0x5e4722[_0x7261('0x30')];var _0x6666a0;if(_0x59a44c>=_0x338f7f){_0x59a44c=_0x338f7f;_0x6666a0=0xc8;}else{_0x6666a0=0xce;}_0x4d4d5f['status'](_0x6666a0);return _0x4d4d5f[_0x7261('0x31')]('Content-Range',_0x56bd7c+'-'+_0x59a44c+'/'+_0x338f7f)[_0x7261('0x2c')](_0x484cf9);}return null;};}function patchUpdates(_0x5da9d1){return function(_0x41b404){try{jsonpatch[_0x7261('0x32')](_0x41b404,_0x5da9d1,!![]);}catch(_0x1b0e5d){return BPromise[_0x7261('0x33')](_0x1b0e5d);}return _0x41b404[_0x7261('0x34')]();};}function saveUpdates(_0x3abbf1,_0x58fcb6){return function(_0x13c5e1){if(_0x13c5e1){return _0x13c5e1[_0x7261('0x35')](_0x3abbf1)[_0x7261('0x1f')](function(_0x2973bd){return _0x2973bd;});}return null;};}function removeEntity(_0x3cace2,_0x4325de){return function(_0x416d8c){if(_0x416d8c){return _0x416d8c['destroy']()['then'](function(){var _0xfeb143=_0x416d8c[_0x7261('0x36')]({'plain':!![]});var _0x2ab868=_0x7261('0x37');return db[_0x7261('0x38')]['destroy']({'where':{'type':_0x2ab868,'resourceId':_0xfeb143['id']}})['then'](function(){return _0x416d8c;});})[_0x7261('0x1f')](function(){_0x3cace2[_0x7261('0x2a')](0xcc)[_0x7261('0x2b')]();});}};}function handleEntityNotFound(_0x5e9fd5,_0x2a88ef){return function(_0x172011){if(!_0x172011){_0x5e9fd5[_0x7261('0x29')](0x194);}return _0x172011;};}function handleError(_0x3e168d,_0x27ef74){_0x27ef74=_0x27ef74||0x1f4;return function(_0x4e3e0b){logger[_0x7261('0x26')](_0x4e3e0b['stack']);if(_0x4e3e0b[_0x7261('0x39')]){delete _0x4e3e0b['name'];}_0x3e168d[_0x7261('0x2a')](_0x27ef74)[_0x7261('0x3a')](_0x4e3e0b);};}exports[_0x7261('0x3b')]=function(_0x4eb1d9,_0x1127f6){var _0x1e4f9d={'include':[{'model':db['Pause'],'as':_0x7261('0x3c')}]},_0x2188f2={},_0x30034a={'count':0x0,'rows':[]};var _0x653017=_['map'](db[_0x7261('0x3d')]['rawAttributes'],function(_0x466d52){return{'name':_0x466d52['fieldName'],'type':_0x466d52[_0x7261('0x3e')]['key']};});_0x2188f2[_0x7261('0x3f')]=_[_0x7261('0x40')](_0x653017,_0x7261('0x39'));_0x2188f2[_0x7261('0x41')]=_['keys'](_0x4eb1d9[_0x7261('0x41')]);_0x2188f2[_0x7261('0x42')]=_[_0x7261('0x43')](_0x2188f2[_0x7261('0x3f')],_0x2188f2[_0x7261('0x41')]);_0x1e4f9d[_0x7261('0x44')]=_[_0x7261('0x43')](_0x2188f2[_0x7261('0x3f')],qs['fields'](_0x4eb1d9['query'][_0x7261('0x45')]));_0x1e4f9d['attributes']=_0x1e4f9d['attributes'][_0x7261('0x46')]?_0x1e4f9d[_0x7261('0x44')]:_0x2188f2[_0x7261('0x3f')];if(!_0x4eb1d9[_0x7261('0x41')][_0x7261('0x47')]('nolimit')){_0x1e4f9d[_0x7261('0x30')]=qs[_0x7261('0x30')](_0x4eb1d9[_0x7261('0x41')][_0x7261('0x30')]);_0x1e4f9d[_0x7261('0x2d')]=qs[_0x7261('0x2d')](_0x4eb1d9[_0x7261('0x41')]['offset']);}_0x1e4f9d[_0x7261('0x48')]=qs[_0x7261('0x49')](_0x4eb1d9[_0x7261('0x41')][_0x7261('0x49')]);_0x1e4f9d[_0x7261('0x4a')]=qs[_0x7261('0x42')](_[_0x7261('0x4b')](_0x4eb1d9[_0x7261('0x41')],_0x2188f2[_0x7261('0x42')]),_0x653017);if(_0x4eb1d9['query']['filter']){_0x1e4f9d['where']=_[_0x7261('0x4c')](_0x1e4f9d[_0x7261('0x4a')],{'$or':_['map'](_0x653017,function(_0x1e2843){if(_0x1e2843[_0x7261('0x3e')]!==_0x7261('0x4d')){var _0x1b50f0={};_0x1b50f0[_0x1e2843['name']]={'$like':'%'+_0x4eb1d9['query'][_0x7261('0x4e')]+'%'};return _0x1b50f0;}})});}_0x1e4f9d=_[_0x7261('0x4c')]({},_0x1e4f9d,_0x4eb1d9[_0x7261('0x4f')]);var _0x15f71e={'where':_0x1e4f9d[_0x7261('0x4a')]};return db['WhatsappAccount'][_0x7261('0x2f')](_0x15f71e)['then'](function(_0x1cbbdc){_0x30034a['count']=_0x1cbbdc;if(_0x4eb1d9[_0x7261('0x41')]['includeAll']){_0x1e4f9d['include']=[{'all':!![]}];}return db[_0x7261('0x3d')][_0x7261('0x50')](_0x1e4f9d);})['then'](function(_0x2c9efb){_0x30034a[_0x7261('0x51')]=_0x2c9efb;return _0x30034a;})[_0x7261('0x1f')](respondWithFilteredResult(_0x1127f6,_0x1e4f9d))[_0x7261('0x28')](handleError(_0x1127f6,null));};exports[_0x7261('0x52')]=function(_0x36684f,_0x10ba36){var _0x269633={'raw':![],'where':{'id':_0x36684f[_0x7261('0x53')]['id']},'include':[{'model':db[_0x7261('0x54')],'as':'mandatoryDispositionPause'}]},_0x416607={};_0x416607['model']=_['keys'](db[_0x7261('0x3d')]['rawAttributes']);_0x416607['query']=_[_0x7261('0x55')](_0x36684f['query']);_0x416607[_0x7261('0x42')]=_['intersection'](_0x416607[_0x7261('0x3f')],_0x416607[_0x7261('0x41')]);_0x269633[_0x7261('0x44')]=_[_0x7261('0x43')](_0x416607[_0x7261('0x3f')],qs[_0x7261('0x45')](_0x36684f[_0x7261('0x41')][_0x7261('0x45')]));_0x269633[_0x7261('0x44')]=_0x269633[_0x7261('0x44')][_0x7261('0x46')]?_0x269633['attributes']:_0x416607[_0x7261('0x3f')];if(_0x36684f['query'][_0x7261('0x56')]){_0x269633[_0x7261('0x57')]=[{'all':!![]}];}_0x269633=_[_0x7261('0x4c')]({},_0x269633,_0x36684f['options']);return db[_0x7261('0x3d')][_0x7261('0x58')](_0x269633)[_0x7261('0x1f')](handleEntityNotFound(_0x10ba36,null))['then'](respondWithResult(_0x10ba36,null))[_0x7261('0x28')](handleError(_0x10ba36,null));};exports[_0x7261('0x59')]=function(_0x16bded,_0x401d24){return db['WhatsappAccount'][_0x7261('0x59')](_0x16bded['body'],{})[_0x7261('0x1f')](function(_0x44d249){var _0x55f43a=_0x16bded[_0x7261('0x5a')][_0x7261('0x36')]({'plain':!![]});if(!_0x55f43a)throw new Error(_0x7261('0x5b'));if(_0x55f43a[_0x7261('0x5c')]===_0x7261('0x5a')){var _0x12fc33=_0x44d249['get']({'plain':!![]});var _0x40267b=_0x7261('0x37');return db[_0x7261('0x5d')][_0x7261('0x58')]({'where':{'name':_0x40267b,'userProfileId':_0x55f43a[_0x7261('0x5e')]},'raw':!![]})[_0x7261('0x1f')](function(_0x396f60){if(_0x396f60&&_0x396f60[_0x7261('0x5f')]===0x0){return db[_0x7261('0x38')][_0x7261('0x59')]({'name':_0x12fc33['name'],'resourceId':_0x12fc33['id'],'type':_0x396f60[_0x7261('0x39')],'sectionId':_0x396f60['id']},{})[_0x7261('0x1f')](function(){return _0x44d249;});}else{return _0x44d249;}})[_0x7261('0x28')](function(_0x20271a){logger[_0x7261('0x26')](_0x7261('0x60'),_0x20271a);throw _0x20271a;});}return _0x44d249;})[_0x7261('0x1f')](respondWithResult(_0x401d24,0xc9))[_0x7261('0x28')](handleError(_0x401d24,null));};exports[_0x7261('0x35')]=function(_0x3d279f,_0x484046){if(_0x3d279f[_0x7261('0x61')]['id']){delete _0x3d279f[_0x7261('0x61')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x3d279f[_0x7261('0x53')]['id']},'include':[{'model':db[_0x7261('0x54')],'as':_0x7261('0x3c')}]})['then'](handleEntityNotFound(_0x484046,null))[_0x7261('0x1f')](saveUpdates(_0x3d279f[_0x7261('0x61')],null))[_0x7261('0x1f')](respondWithResult(_0x484046,null))[_0x7261('0x28')](handleError(_0x484046,null));};exports[_0x7261('0x62')]=function(_0xde0a5f,_0x550bfd){return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0xde0a5f['params']['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x550bfd,null))['then'](removeEntity(_0x550bfd,null))[_0x7261('0x28')](handleError(_0x550bfd,null));};exports[_0x7261('0x63')]=function(_0x2f439d,_0x328313){return db['WhatsappAccount'][_0x7261('0x63')]()[_0x7261('0x1f')](respondWithResult(_0x328313,null))[_0x7261('0x28')](handleError(_0x328313,null));};exports['addDisposition']=function(_0x1546e8,_0xe9b9d0,_0x7c08ce){if(_0x1546e8[_0x7261('0x61')]['id']){delete _0x1546e8[_0x7261('0x61')]['id'];}return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0x1546e8['params']['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0xe9b9d0,null))[_0x7261('0x1f')](function(_0x3378ab){if(_0x3378ab){_0x1546e8[_0x7261('0x61')][_0x7261('0x64')]=_0x3378ab['id'];return db[_0x7261('0x65')]['create'](_0x1546e8[_0x7261('0x61')]);}})[_0x7261('0x1f')](respondWithResult(_0xe9b9d0,null))[_0x7261('0x28')](handleError(_0xe9b9d0,null));};exports[_0x7261('0x66')]=function(_0x773c5d,_0x4e40e8,_0x19b790){var _0x24d696={'raw':![],'where':{}};var _0x57616b={};var _0x2d4d63={'count':0x0,'rows':[]};return db[_0x7261('0x3d')][_0x7261('0x67')]({'where':{'id':_0x773c5d[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x4e40e8,null))['then'](function(_0x501cba){if(_0x501cba){_0x57616b['model']=_[_0x7261('0x55')](db[_0x7261('0x65')]['rawAttributes']);_0x57616b['query']=_['keys'](_0x773c5d['query']);_0x57616b[_0x7261('0x42')]=_[_0x7261('0x43')](_0x57616b['model'],_0x57616b[_0x7261('0x41')]);_0x24d696['attributes']=_[_0x7261('0x43')](_0x57616b['model'],qs[_0x7261('0x45')](_0x773c5d[_0x7261('0x41')]['fields']));_0x24d696[_0x7261('0x44')]=_0x24d696[_0x7261('0x44')]['length']?_0x24d696['attributes']:_0x57616b[_0x7261('0x3f')];if(!_0x773c5d['query'][_0x7261('0x47')](_0x7261('0x68'))){_0x24d696[_0x7261('0x30')]=qs[_0x7261('0x30')](_0x773c5d[_0x7261('0x41')][_0x7261('0x30')]);_0x24d696[_0x7261('0x2d')]=qs[_0x7261('0x2d')](_0x773c5d[_0x7261('0x41')][_0x7261('0x2d')]);}_0x24d696[_0x7261('0x48')]=qs['sort'](_0x773c5d[_0x7261('0x41')][_0x7261('0x49')]);_0x24d696[_0x7261('0x4a')]=qs[_0x7261('0x42')](_[_0x7261('0x4b')](_0x773c5d[_0x7261('0x41')],_0x57616b[_0x7261('0x42')]));_0x24d696[_0x7261('0x4a')][_0x7261('0x64')]=_0x501cba['id'];if(_0x773c5d['query'][_0x7261('0x4e')]){_0x24d696[_0x7261('0x4a')]=_[_0x7261('0x4c')](_0x24d696[_0x7261('0x4a')],{'$or':_[_0x7261('0x40')](_0x24d696[_0x7261('0x44')],function(_0x42e37e){var _0x4a43b5={};_0x4a43b5[_0x42e37e]={'$like':'%'+_0x773c5d[_0x7261('0x41')][_0x7261('0x4e')]+'%'};return _0x4a43b5;})});}_0x24d696=_[_0x7261('0x4c')]({},_0x24d696,_0x773c5d['options']);return db['Disposition'][_0x7261('0x2f')]({'where':_0x24d696[_0x7261('0x4a')]})[_0x7261('0x1f')](function(_0x119953){_0x2d4d63[_0x7261('0x2f')]=_0x119953;if(_0x773c5d[_0x7261('0x41')][_0x7261('0x56')]){_0x24d696['include']=[{'all':!![]}];}return db[_0x7261('0x65')][_0x7261('0x50')](_0x24d696);})['then'](function(_0x118de9){_0x2d4d63[_0x7261('0x51')]=_0x118de9;return _0x2d4d63;});}})[_0x7261('0x1f')](respondWithFilteredResult(_0x4e40e8,_0x24d696))[_0x7261('0x28')](handleError(_0x4e40e8,null));};exports[_0x7261('0x69')]=function(_0x56ef08,_0xe22a87,_0x2bb148){return db['WhatsappAccount'][_0x7261('0x58')]({'where':{'id':_0x56ef08[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0xe22a87,null))[_0x7261('0x1f')](function(_0x3d05bc){if(_0x3d05bc){return _0x3d05bc[_0x7261('0x69')](_0x56ef08[_0x7261('0x41')][_0x7261('0x6a')]);}})[_0x7261('0x1f')](respondWithStatusCode(_0xe22a87,null))[_0x7261('0x28')](handleError(_0xe22a87,null));};exports[_0x7261('0x6b')]=function(_0x426f00,_0x437dfc,_0x54bead){if(_0x426f00[_0x7261('0x61')]['id']){delete _0x426f00['body']['id'];}return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0x426f00[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x437dfc,null))[_0x7261('0x1f')](function(_0x3338b3){if(_0x3338b3){_0x426f00[_0x7261('0x61')][_0x7261('0x64')]=_0x3338b3['id'];return db[_0x7261('0x6c')]['create'](_0x426f00['body']);}})[_0x7261('0x1f')](respondWithResult(_0x437dfc,null))[_0x7261('0x28')](handleError(_0x437dfc,null));};exports[_0x7261('0x6d')]=function(_0x41a417,_0x37a214,_0x33ed79){var _0xff0646={'raw':![],'where':{}};var _0x2e574e={};var _0xeefd35={'count':0x0,'rows':[]};return db[_0x7261('0x3d')][_0x7261('0x67')]({'where':{'id':_0x41a417[_0x7261('0x53')]['id']}})['then'](handleEntityNotFound(_0x37a214,null))[_0x7261('0x1f')](function(_0x40fa60){if(_0x40fa60){_0x2e574e[_0x7261('0x3f')]=_[_0x7261('0x55')](db['CannedAnswer'][_0x7261('0x6e')]);_0x2e574e['query']=_[_0x7261('0x55')](_0x41a417[_0x7261('0x41')]);_0x2e574e[_0x7261('0x42')]=_[_0x7261('0x43')](_0x2e574e['model'],_0x2e574e[_0x7261('0x41')]);_0xff0646[_0x7261('0x44')]=_[_0x7261('0x43')](_0x2e574e[_0x7261('0x3f')],qs[_0x7261('0x45')](_0x41a417['query'][_0x7261('0x45')]));_0xff0646[_0x7261('0x44')]=_0xff0646[_0x7261('0x44')][_0x7261('0x46')]?_0xff0646[_0x7261('0x44')]:_0x2e574e[_0x7261('0x3f')];if(!_0x41a417['query'][_0x7261('0x47')]('nolimit')){_0xff0646[_0x7261('0x30')]=qs[_0x7261('0x30')](_0x41a417[_0x7261('0x41')]['limit']);_0xff0646['offset']=qs['offset'](_0x41a417[_0x7261('0x41')]['offset']);}_0xff0646['order']=qs[_0x7261('0x49')](_0x41a417[_0x7261('0x41')]['sort']);_0xff0646[_0x7261('0x4a')]=qs[_0x7261('0x42')](_['pick'](_0x41a417[_0x7261('0x41')],_0x2e574e['filters']));_0xff0646[_0x7261('0x4a')][_0x7261('0x64')]=_0x40fa60['id'];if(_0x41a417[_0x7261('0x41')][_0x7261('0x4e')]){_0xff0646[_0x7261('0x4a')]=_[_0x7261('0x4c')](_0xff0646[_0x7261('0x4a')],{'$or':_[_0x7261('0x40')](_0xff0646[_0x7261('0x44')],function(_0x4f8d20){var _0x15ce4d={};_0x15ce4d[_0x4f8d20]={'$like':'%'+_0x41a417['query'][_0x7261('0x4e')]+'%'};return _0x15ce4d;})});}_0xff0646=_[_0x7261('0x4c')]({},_0xff0646,_0x41a417[_0x7261('0x4f')]);return db[_0x7261('0x6c')][_0x7261('0x2f')]({'where':_0xff0646['where']})[_0x7261('0x1f')](function(_0x55800b){_0xeefd35['count']=_0x55800b;if(_0x41a417[_0x7261('0x41')]['includeAll']){_0xff0646['include']=[{'all':!![]}];}return db[_0x7261('0x6c')][_0x7261('0x50')](_0xff0646);})['then'](function(_0x193f94){_0xeefd35['rows']=_0x193f94;return _0xeefd35;});}})['then'](respondWithFilteredResult(_0x37a214,_0xff0646))[_0x7261('0x28')](handleError(_0x37a214,null));};exports[_0x7261('0x6f')]=function(_0x58d092,_0x580cf3,_0x8c32cb){return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0x58d092[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x580cf3,null))['then'](function(_0x4d0c45){if(_0x4d0c45){return _0x4d0c45['removeAnswers'](_0x58d092[_0x7261('0x41')][_0x7261('0x6a')]);}})[_0x7261('0x1f')](respondWithStatusCode(_0x580cf3,null))[_0x7261('0x28')](handleError(_0x580cf3,null));};exports['addAgents']=function(_0xad47ae,_0x171535,_0x3372e3){return db[_0x7261('0x3d')]['find']({'where':{'id':_0xad47ae[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x171535,null))[_0x7261('0x1f')](function(_0x520849){if(_0x520849){return _0x520849[_0x7261('0x70')](_0xad47ae[_0x7261('0x61')][_0x7261('0x6a')],_[_0x7261('0x71')](_0xad47ae['body'],[_0x7261('0x6a'),'id'])||{})[_0x7261('0x72')](function(_0x70ec23){for(var _0x1f6018=0x0;_0x1f6018<_0xad47ae[_0x7261('0x61')][_0x7261('0x6a')]['length'];_0x1f6018+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':Number(_0xad47ae[_0x7261('0x61')][_0x7261('0x6a')][_0x1f6018]),'WhatsappAccountId':Number(_0xad47ae[_0x7261('0x53')]['id'])});}return _0x70ec23;});}})['then'](respondWithResult(_0x171535,null))[_0x7261('0x28')](handleError(_0x171535,null));};exports['removeAgents']=function(_0x666e5e,_0x513e67,_0xd40018){return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0x666e5e[_0x7261('0x53')]['id']}})[_0x7261('0x1f')](handleEntityNotFound(_0x513e67,null))['then'](function(_0x182bc4){if(_0x182bc4){return _0x182bc4[_0x7261('0x73')](_0x666e5e['query']['ids'])[_0x7261('0x1f')](function(){if(_[_0x7261('0x74')](_0x666e5e[_0x7261('0x41')]['ids'])){for(var _0xf4ee62=0x0;_0xf4ee62<_0x666e5e[_0x7261('0x41')]['ids'][_0x7261('0x46')];_0xf4ee62+=0x1){socket[_0x7261('0x75')](_0x7261('0x76'),{'UserId':Number(_0x666e5e[_0x7261('0x41')][_0x7261('0x6a')][_0xf4ee62]),'WhatsappAccountId':Number(_0x666e5e['params']['id'])});}}else{socket[_0x7261('0x75')](_0x7261('0x76'),{'UserId':Number(_0x666e5e['query'][_0x7261('0x6a')]),'WhatsappAccountId':Number(_0x666e5e[_0x7261('0x53')]['id'])});}});}})[_0x7261('0x1f')](respondWithStatusCode(_0x513e67,null))[_0x7261('0x28')](handleError(_0x513e67,null));};exports[_0x7261('0x77')]=function(_0x123944,_0x158da,_0x5aa28c){var _0x594048={};var _0x290219={};var _0x28fd54;var _0x2a4c55;return db['WhatsappAccount'][_0x7261('0x67')]({'where':{'id':_0x123944['params']['id']}})['then'](handleEntityNotFound(_0x158da,null))[_0x7261('0x1f')](function(_0x55acdc){if(_0x55acdc){_0x28fd54=_0x55acdc;_0x290219['model']=_[_0x7261('0x55')](db[_0x7261('0x78')][_0x7261('0x6e')]);_0x290219[_0x7261('0x41')]=_[_0x7261('0x55')](_0x123944[_0x7261('0x41')]);_0x290219[_0x7261('0x42')]=_[_0x7261('0x43')](_0x290219[_0x7261('0x3f')],_0x290219['query']);_0x594048['attributes']=_[_0x7261('0x43')](_0x290219[_0x7261('0x3f')],qs['fields'](_0x123944[_0x7261('0x41')][_0x7261('0x45')]));_0x594048['attributes']=_0x594048[_0x7261('0x44')][_0x7261('0x46')]?_0x594048['attributes']:_0x290219[_0x7261('0x3f')];_0x594048[_0x7261('0x48')]=qs[_0x7261('0x49')](_0x123944[_0x7261('0x41')]['sort']);_0x594048['where']=qs[_0x7261('0x42')](_[_0x7261('0x4b')](_0x123944[_0x7261('0x41')],_0x290219[_0x7261('0x42')]));if(_0x123944[_0x7261('0x41')][_0x7261('0x4e')]){_0x594048[_0x7261('0x4a')]=_[_0x7261('0x4c')](_0x594048[_0x7261('0x4a')],{'$or':_[_0x7261('0x40')](_0x594048['attributes'],function(_0xa26eb5){var _0x369065={};_0x369065[_0xa26eb5]={'$like':'%'+_0x123944[_0x7261('0x41')][_0x7261('0x4e')]+'%'};return _0x369065;})});}_0x594048=_[_0x7261('0x4c')]({},_0x594048,_0x123944[_0x7261('0x4f')]);return _0x28fd54[_0x7261('0x77')](_0x594048);}})[_0x7261('0x1f')](function(_0x454ceb){if(_0x454ceb){_0x2a4c55=_0x454ceb[_0x7261('0x46')];if(!_0x123944[_0x7261('0x41')][_0x7261('0x47')]('nolimit')){_0x594048[_0x7261('0x30')]=qs[_0x7261('0x30')](_0x123944[_0x7261('0x41')][_0x7261('0x30')]);_0x594048['offset']=qs[_0x7261('0x2d')](_0x123944[_0x7261('0x41')][_0x7261('0x2d')]);}return _0x28fd54[_0x7261('0x77')](_0x594048);}})['then'](function(_0x592964){if(_0x592964){return _0x592964?{'count':_0x2a4c55,'rows':_0x592964}:null;}})['then'](respondWithResult(_0x158da,null))[_0x7261('0x28')](handleError(_0x158da,null));};exports[_0x7261('0x79')]=function(_0x4dbdf7,_0x15f4d5){var _0x134466=_0x4dbdf7['params']['id'];var _0x2bff73=_0x4dbdf7[_0x7261('0x61')];var _0x222623=0xc8;var _0x828c90=null;return db[_0x7261('0x7a')][_0x7261('0x7b')]({'isolationLevel':db[_0x7261('0x7a')][_0x7261('0x7c')][_0x7261('0x7d')][_0x7261('0x7e')]},function(_0x5c05cb){return db[_0x7261('0x3d')][_0x7261('0x67')]({'where':{'id':_0x134466},'transaction':_0x5c05cb})[_0x7261('0x1f')](function(_0x577a57){if(_0x577a57){return db[_0x7261('0x7f')]['destroy']({'where':{'WhatsappAccountId':_0x134466},'transaction':_0x5c05cb})[_0x7261('0x1f')](function(){var _0x5f598a=_['map'](_0x2bff73,function(_0xb605f6){_0xb605f6[_0x7261('0x64')]=_0x134466;return _0xb605f6;});return db[_0x7261('0x7f')]['bulkCreate'](_0x5f598a,{'transaction':_0x5c05cb});});}else{_0x222623=0x194;_0x828c90=[];}});})['then'](function(){if(_0x222623!==0x194){return db[_0x7261('0x7f')][_0x7261('0x80')]({'where':{'WhatsappAccountId':_0x134466},'order':_0x7261('0x81')})['then'](function(_0x571abc){_0x828c90=_0x571abc;});}})[_0x7261('0x28')](function(_0x1066d7){_0x222623=0x1f4;logger[_0x7261('0x26')](_0x1066d7[_0x7261('0x82')]);if(_0x1066d7[_0x7261('0x39')]){delete _0x1066d7[_0x7261('0x39')];}_0x828c90=_0x1066d7;})['finally'](function(){if(_0x828c90===null){_0x15f4d5[_0x7261('0x29')](_0x222623);}else{if(_0x222623===0x1f4){_0x15f4d5[_0x7261('0x2a')](_0x222623)[_0x7261('0x3a')](_0x828c90);}else{_0x15f4d5[_0x7261('0x2a')](_0x222623)[_0x7261('0x2c')](_0x828c90);}}});};exports[_0x7261('0x83')]=function(_0x8d9fb4,_0x5e1202,_0x3a792b){var _0x3bcaaa={};var _0x207d89={};var _0x474ef6;var _0x118d89;return db[_0x7261('0x3d')][_0x7261('0x67')]({'where':{'id':_0x8d9fb4[_0x7261('0x53')]['id']}})['then'](handleEntityNotFound(_0x5e1202,null))['then'](function(_0x5afdf9){if(_0x5afdf9){_0x474ef6=_0x5afdf9;_0x207d89[_0x7261('0x3f')]=_[_0x7261('0x55')](db[_0x7261('0x7f')][_0x7261('0x6e')]);_0x207d89[_0x7261('0x41')]=_['keys'](_0x8d9fb4[_0x7261('0x41')]);_0x207d89['filters']=_[_0x7261('0x43')](_0x207d89[_0x7261('0x3f')],_0x207d89[_0x7261('0x41')]);_0x3bcaaa[_0x7261('0x44')]=_[_0x7261('0x43')](_0x207d89['model'],qs[_0x7261('0x45')](_0x8d9fb4[_0x7261('0x41')]['fields']));_0x3bcaaa['attributes']=_0x3bcaaa['attributes'][_0x7261('0x46')]?_0x3bcaaa[_0x7261('0x44')]:_0x207d89[_0x7261('0x3f')];_0x3bcaaa['order']=qs[_0x7261('0x49')](_0x8d9fb4[_0x7261('0x41')][_0x7261('0x49')]);_0x3bcaaa[_0x7261('0x4a')]=qs[_0x7261('0x42')](_[_0x7261('0x4b')](_0x8d9fb4['query'],_0x207d89[_0x7261('0x42')]));if(_0x8d9fb4[_0x7261('0x41')][_0x7261('0x4e')]){_0x3bcaaa[_0x7261('0x4a')]=_[_0x7261('0x4c')](_0x3bcaaa[_0x7261('0x4a')],{'$or':_['map'](_0x3bcaaa['attributes'],function(_0x115785){var _0x5401a8={};_0x5401a8[_0x115785]={'$like':'%'+_0x8d9fb4[_0x7261('0x41')][_0x7261('0x4e')]+'%'};return _0x5401a8;})});}_0x3bcaaa=_[_0x7261('0x4c')]({},_0x3bcaaa,_0x8d9fb4['options']);return _0x474ef6[_0x7261('0x83')](_0x3bcaaa);}})[_0x7261('0x1f')](function(_0x40bfa6){if(_0x40bfa6){_0x118d89=_0x40bfa6[_0x7261('0x46')];if(!_0x8d9fb4[_0x7261('0x41')][_0x7261('0x47')](_0x7261('0x68'))){_0x3bcaaa[_0x7261('0x30')]=qs[_0x7261('0x30')](_0x8d9fb4[_0x7261('0x41')][_0x7261('0x30')]);_0x3bcaaa[_0x7261('0x2d')]=qs['offset'](_0x8d9fb4['query'][_0x7261('0x2d')]);}return _0x474ef6['getApplications'](_0x3bcaaa);}})[_0x7261('0x1f')](function(_0x16ac44){if(_0x16ac44){return _0x16ac44?{'count':_0x118d89,'rows':_0x16ac44}:null;}})[_0x7261('0x1f')](respondWithResult(_0x5e1202,null))['catch'](handleError(_0x5e1202,null));};exports[_0x7261('0x84')]=function(_0x173975,_0x43a6c7,_0x475843){var _0x51073b={'channel':_0x7261('0x85')};var _0x4672d4=[];var _0x398616=[];var _0x232679={};return db[_0x7261('0x3d')][_0x7261('0x58')]({'where':{'id':_0x173975['params']['id']},'include':[{'model':db[_0x7261('0x7f')],'as':'Applications'}]})[_0x7261('0x1f')](handleEntityNotFound(_0x43a6c7,null))[_0x7261('0x1f')](function(_0x29ebfd){_0x51073b['account']=_0x29ebfd;if(_0x51073b[_0x7261('0x86')]&&_0x51073b[_0x7261('0x86')][_0x7261('0x3e')]==='sinch'&&_0x173975[_0x7261('0x61')][_0x7261('0x87')]){if(_0x173975['body'][_0x7261('0x87')][_0x7261('0x46')]===0x0)return;if(_0x173975['body'][_0x7261('0x87')][0x0][_0x7261('0x88')]!==_0x7261('0x89'))return;return db['WhatsappMessage']['update']({'read':!![],'readAt':_0x173975[_0x7261('0x61')][_0x7261('0x87')][0x0][_0x7261('0x8a')]},{'where':{'messageId':_0x173975['body'][_0x7261('0x87')][0x0][_0x7261('0x8b')]},'individualHooks':!![]})[_0x7261('0x1f')](function(_0x5d2c12){return _0x43a6c7[_0x7261('0x2a')](0xc8)[_0x7261('0x2c')](_0x5d2c12);});}_0x51073b[_0x7261('0x8c')]=_[_0x7261('0x8d')](_0x29ebfd['Applications'],[_0x7261('0x81')],[_0x7261('0x8e')]);if(_0x51073b['account'][_0x7261('0x8f')]){delete _0x51073b[_0x7261('0x86')][_0x7261('0x8f')];}return db[_0x7261('0x90')][_0x7261('0x63')]()[_0x7261('0x1f')](function(_0x2f2387){if(!_0x2f2387){throw new db[(_0x7261('0x91'))][(_0x7261('0x92'))](_0x7261('0x93'));}_0x4672d4=_[_0x7261('0x94')](_['keys'](_0x2f2387),[_0x7261('0x95'),'updatedAt']);_0x398616=_[_0x7261('0x94')](_['keys'](_0x2f2387),[_0x7261('0x95'),_0x7261('0x96'),_0x7261('0x97'),_0x7261('0x98')]);_0x51073b[_0x7261('0x61')]={'mapKey':_0x7261('0x99')};if(_0x51073b[_0x7261('0x86')]&&_0x51073b[_0x7261('0x86')][_0x7261('0x3e')]==='twilio'){_0x51073b['body'][_0x7261('0x9a')]=_0x173975[_0x7261('0x61')][_0x7261('0x9b')][_0x7261('0x9c')](_0x7261('0x9d'),'');_0x51073b[_0x7261('0x61')][_0x7261('0x61')]=_0x173975[_0x7261('0x61')]['Body'];_0x51073b['body'][_0x7261('0x9e')]=_0x173975[_0x7261('0x61')]['MessageSid'];}if(_0x51073b['account']&&_0x51073b['account'][_0x7261('0x3e')]==='sinch'){_0x51073b[_0x7261('0x61')][_0x7261('0x9a')]=_0x173975['body'][_0x7261('0x9f')][0x0][_0x7261('0x9a')];_0x51073b[_0x7261('0x61')][_0x7261('0x61')]=_0x173975[_0x7261('0x61')][_0x7261('0x9f')][0x0][_0x7261('0x27')]['body'];_0x51073b[_0x7261('0x61')][_0x7261('0x9e')]=_0x173975[_0x7261('0x61')]['notifications'][0x0][_0x7261('0x8b')];}if(_0x51073b['body']['id']){delete _0x51073b[_0x7261('0x61')]['id'];}if(_['isNil'](_0x51073b[_0x7261('0x61')][_0x7261('0x9a')])){throw new db['Sequelize'][(_0x7261('0x92'))](_0x7261('0xa0'));}if(_[_0x7261('0xa1')](_0x51073b[_0x7261('0x61')][_0x7261('0x61')])||_0x51073b['body'][_0x7261('0x61')]===''){throw new db[(_0x7261('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7261('0xa1')](_0x51073b[_0x7261('0x61')]['mapKey'])){throw new db[(_0x7261('0x91'))][(_0x7261('0x92'))](_0x7261('0xa2')+_0x398616);}if(!_[_0x7261('0xa3')](_0x398616,_0x51073b[_0x7261('0x61')][_0x7261('0xa4')])){throw new db[(_0x7261('0x91'))][(_0x7261('0x92'))](_0x7261('0xa5')+_0x398616);}_0x232679[_0x51073b['body'][_0x7261('0xa4')]]=_0x51073b['body'][_0x7261('0x9a')];return db[_0x7261('0xa6')][_0x7261('0x58')]({'where':{'id':_0x51073b['account'][_0x7261('0x98')]},'include':[{'model':db[_0x7261('0x90')],'as':_0x7261('0xa7'),'where':_0x232679,'limit':0x1,'order':[[_0x7261('0x96'),_0x7261('0xa8')]]}]});})['then'](handleEntityNotFound(_0x43a6c7,null))[_0x7261('0x1f')](function(_0x250421){if(_0x250421){_0x51073b[_0x7261('0xa9')]=_[_0x7261('0x71')](_0x250421,['Contacts']);if(_0x250421[_0x7261('0xa7')][_0x7261('0x46')]){return _0x250421['Contacts'][0x0];}var _0x71deb5=_[_0x7261('0x17')](_0x51073b[_0x7261('0x61')],{'firstName':_0x51073b[_0x7261('0x61')]['from'],'ListId':_0x250421['id']});_0x71deb5[_0x51073b[_0x7261('0x61')][_0x7261('0xa4')]]=_0x51073b['body'][_0x7261('0x9a')];return db['CmContact'][_0x7261('0x59')](_0x71deb5,{'fields':_0x4672d4,'raw':!![]});}})[_0x7261('0x1f')](handleEntityNotFound(_0x43a6c7,null))[_0x7261('0x1f')](function(_0x4eb8ba){if(_0x4eb8ba){_0x51073b[_0x7261('0xaa')]=_0x4eb8ba;var _0x4f74d8={'ContactId':_0x4eb8ba['id'],'phone':_0x51073b[_0x7261('0x61')][_0x7261('0x9a')],'WhatsappAccountId':_0x173975[_0x7261('0x53')]['id']};var _0x4876e1={'ContactId':_0x4eb8ba['id'],'WhatsappAccountId':_0x173975[_0x7261('0x53')]['id'],'closed':![]};return db[_0x7261('0xab')][_0x7261('0x58')]({'where':_0x4876e1})[_0x7261('0x1f')](function(_0x32129d){if(_0x32129d){return[_0x32129d,![]];}return db[_0x7261('0xab')][_0x7261('0x59')](_0x4f74d8)[_0x7261('0x1f')](function(_0x57779a){return[_0x57779a,!![]];});});}})[_0x7261('0x72')](function(_0x421ee2,_0x492353){_0x51073b[_0x7261('0xac')]=_0x421ee2[_0x7261('0x36')]({'plain':!![]});_0x51073b[_0x7261('0xac')]['created']=![];if(_0x492353){if(_0x51073b[_0x7261('0x86')][_0x7261('0xad')]){_0x51073b[_0x7261('0x8c')][_0x7261('0xae')]({'id':0x0,'priority':_0x51073b[_0x7261('0x8c')][_0x7261('0x46')]+0x1,'app':_0x7261('0xaf'),'appdata':_0x7261('0xb0'),'interval':'*,*,*,*'});}_0x51073b[_0x7261('0xac')][_0x7261('0xb1')]=!![];}return db[_0x7261('0xb2')][_0x7261('0x59')]({'phone':_0x51073b[_0x7261('0x61')][_0x7261('0x9a')],'messageId':_0x51073b['body'][_0x7261('0x9e')],'body':_0x51073b[_0x7261('0x61')][_0x7261('0x61')],'WhatsappAccountId':_0x173975['params']['id'],'WhatsappInteractionId':_0x421ee2['id'],'direction':'in','ContactId':_0x421ee2[_0x7261('0xb3')],'AttachmentId':_0x51073b[_0x7261('0x61')]['AttachmentId']});})['then'](function(_0x73433b){_0x51073b['message']=_0x73433b;if(_0x51073b[_0x7261('0xac')][_0x7261('0xb4')]){return db[_0x7261('0x78')]['find']({'attributes':['id',_0x7261('0x39')],'where':{'id':_0x51073b['interaction'][_0x7261('0xb4')]}})[_0x7261('0x1f')](function(_0x4a152a){if(_0x4a152a){_0x51073b['applications'][_0x7261('0xb5')]({'id':0x0,'priority':0x0,'app':_0x7261('0xb6'),'appdata':_0x4a152a['name']+','+(_0x51073b[_0x7261('0x86')][_0x7261('0xb7')]||0xa),'interval':_0x7261('0xb8')});}return respondWithRpcPromise('Start',_0x7261('0xb9'),_0x51073b);});}return respondWithRpcPromise(_0x7261('0xba'),'startRouting',_0x51073b);})[_0x7261('0x1f')](function(_0x5bc3dc){if(_0x5bc3dc){var _0x3125f7=0xc8;var _0x45616e=_0x7261('0xbb');logger[_0x7261('0x20')](_0x7261('0x24'),_0x45616e,_0x3125f7,'entity\x20found');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x45616e,_0x3125f7,_0x7261('0xbc'),JSON[_0x7261('0x25')](_0x5bc3dc));if(_0x51073b[_0x7261('0x86')][_0x7261('0x3e')]===_0x7261('0xbd')){return _0x43a6c7['status'](_0x3125f7)['set'](_0x7261('0xbe'),_0x7261('0xbf'))[_0x7261('0x3a')]('\x0a');}else{return _0x43a6c7['status'](_0x3125f7)[_0x7261('0x2c')](_0x5bc3dc);}}});})[_0x7261('0x28')](handleError(_0x43a6c7,null));};exports[_0x7261('0x3a')]=function(_0x1f1303,_0x27b5b0,_0x1a079e){var _0x59f136,_0x177983,_0x58a559;if(_[_0x7261('0xa1')](_0x1f1303[_0x7261('0x61')]['body'])||_0x1f1303['body']['body']===''){throw new db[(_0x7261('0x91'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x1f1303[_0x7261('0x61')]['to'])){throw new db[(_0x7261('0x91'))][(_0x7261('0x92'))](_0x7261('0xc0'));}_0x59f136=_0x1f1303[_0x7261('0x61')]['to'];return db[_0x7261('0x3d')]['find']({'where':{'id':_0x1f1303[_0x7261('0x53')]['id']},'include':[{'model':db[_0x7261('0xa6')],'as':'List','include':[{'model':db[_0x7261('0x90')],'as':_0x7261('0xa7'),'where':{'mobile':_0x59f136},'limit':0x1,'order':[[_0x7261('0x96'),_0x7261('0xa8')]]}]}]})[_0x7261('0x1f')](handleEntityNotFound(_0x27b5b0,null))[_0x7261('0x1f')](function(_0x431dc8){if(_0x431dc8&&_0x431dc8[_0x7261('0xc1')]){_0x177983=_0x431dc8[_0x7261('0x36')]({'plain':!![]});if(_0x177983['List']&&_0x177983['List']['Contacts'][_0x7261('0x46')]){return _0x177983['List']['Contacts'][0x0];}return db['CmContact'][_0x7261('0x59')](_[_0x7261('0x17')](_0x1f1303[_0x7261('0x61')],{'firstName':_0x59f136,'mobile':_0x59f136,'phone':_0x59f136,'ListId':_0x177983[_0x7261('0x98')]}));}})[_0x7261('0x1f')](handleEntityNotFound(_0x27b5b0,null))[_0x7261('0x1f')](function(_0x5e3404){if(_0x5e3404){_0x58a559=_0x5e3404;return db[_0x7261('0xab')][_0x7261('0x58')]({'where':{'ContactId':_0x58a559['id'],'closed':![],'WhatsappAccountId':_0x177983['id']}})[_0x7261('0x1f')](function(_0x12f6fe){if(_0x12f6fe){return[_0x12f6fe,![]];}return db[_0x7261('0xab')][_0x7261('0x59')]({'UserId':_0x1f1303[_0x7261('0x5a')]['id'],'ContactId':_0x58a559['id'],'WhatsappAccountId':_0x177983['id'],'phone':_0x59f136,'firstMsgDirection':_0x7261('0xc2'),'Messages':[_['merge'](_0x1f1303[_0x7261('0x61')],{'read':![],'body':_0x1f1303[_0x7261('0x61')][_0x7261('0x61')],'phone':_0x59f136,'WhatsappAccountId':_0x177983['id'],'UserId':_0x1f1303[_0x7261('0x5a')]['id'],'ContactId':_0x58a559['id']})]},{'include':[{'model':db[_0x7261('0xb2')],'as':'Messages'}]})['then'](function(_0x5b1508){return[_0x5b1508,!![]];});});}})['spread'](function(_0xc7dc45,_0x270855){if(_0x270855){return _0xc7dc45;}return db[_0x7261('0xb2')]['create'](_[_0x7261('0x4c')](_0x1f1303[_0x7261('0x61')],{'read':![],'body':_0x1f1303[_0x7261('0x61')][_0x7261('0x61')],'phone':_0x59f136,'WhatsappAccountId':_0x177983['id'],'WhatsappInteractionId':_0xc7dc45['id'],'UserId':_0x1f1303[_0x7261('0x5a')]['id'],'ContactId':_0x58a559['id']}))[_0x7261('0x1f')](function(_0x22b1ca){_0xc7dc45[_0x7261('0xc3')][_0x7261('0xc4')]=[];_0xc7dc45['dataValues'][_0x7261('0xc4')][_0x7261('0xae')](_0x22b1ca[_0x7261('0xc3')]);return _0xc7dc45;});})[_0x7261('0x1f')](respondWithResult(_0x27b5b0,null))[_0x7261('0x28')](handleError(_0x27b5b0,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d607df8..f733e54 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 _0x5555=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5555,0x1e8));var _0x5555=function(_0xc8d43a,_0x45de7e){_0xc8d43a=_0xc8d43a-0x0;var _0x30fa90=_0x5555[_0xc8d43a];return _0x30fa90;};'use strict';var EventEmitter=require(_0x5555('0x0'));var WhatsappAccount=require(_0x5555('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5555('0x2')](0x0);var events={'afterCreate':_0x5555('0x3'),'afterUpdate':_0x5555('0x4'),'afterDestroy':_0x5555('0x5')};function emitEvent(_0x15e2af){return function(_0x1a9473,_0x29d858,_0x9f2c2f){WhatsappAccountEvents[_0x5555('0x6')](_0x15e2af+':'+_0x1a9473['id'],_0x1a9473);WhatsappAccountEvents['emit'](_0x15e2af,_0x1a9473);_0x9f2c2f(null);};}for(var e in events){if(events[_0x5555('0x7')](e)){var event=events[e];WhatsappAccount[_0x5555('0x8')](e,emitEvent(event));}}module[_0x5555('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0x797e=['save','update','emit','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x797e,0xc2));var _0xe797=function(_0xcbd160,_0x233987){_0xcbd160=_0xcbd160-0x0;var _0x213f09=_0x797e[_0xcbd160];return _0x213f09;};'use strict';var EventEmitter=require(_0xe797('0x0'));var WhatsappAccount=require(_0xe797('0x1'))['db'][_0xe797('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe797('0x3')](0x0);var events={'afterCreate':_0xe797('0x4'),'afterUpdate':_0xe797('0x5'),'afterDestroy':'remove'};function emitEvent(_0x311209){return function(_0x4242a2,_0x38aa62,_0x5bc3bb){WhatsappAccountEvents['emit'](_0x311209+':'+_0x4242a2['id'],_0x4242a2);WhatsappAccountEvents[_0xe797('0x6')](_0x311209,_0x4242a2);_0x5bc3bb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xe797('0x7')](e,emitEvent(event));}}module[_0xe797('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 eecd73b..d4565df 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 _0xaa6c=['whatsapp_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount'];(function(_0x1f2c5c,_0x445d36){var _0x4c612b=function(_0x56d536){while(--_0x56d536){_0x1f2c5c['push'](_0x1f2c5c['shift']());}};_0x4c612b(++_0x445d36);}(_0xaa6c,0x90));var _0xcaa6=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xaa6c[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xcaa6('0x0'));var util=require(_0xcaa6('0x1'));var logger=require(_0xcaa6('0x2'))('api');var moment=require(_0xcaa6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcaa6('0x4'));var fs=require('fs');var path=require(_0xcaa6('0x5'));var rimraf=require(_0xcaa6('0x6'));var config=require(_0xcaa6('0x7'));var attributes=require(_0xcaa6('0x8'));module[_0xcaa6('0x9')]=function(_0x504d06,_0x2d82b0){return _0x504d06[_0xcaa6('0xa')](_0xcaa6('0xb'),attributes,{'tableName':_0xcaa6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb8=['api','moment','bluebird','request-promise','../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger'];(function(_0x42f6c7,_0x22c00f){var _0x688891=function(_0xdbf961){while(--_0xdbf961){_0x42f6c7['push'](_0x42f6c7['shift']());}};_0x688891(++_0x22c00f);}(_0xdfb8,0x1c1));var _0x8dfb=function(_0x533b5f,_0x238373){_0x533b5f=_0x533b5f-0x0;var _0x4b40a3=_0xdfb8[_0x533b5f];return _0x4b40a3;};'use strict';var _=require(_0x8dfb('0x0'));var util=require('util');var logger=require(_0x8dfb('0x1'))(_0x8dfb('0x2'));var moment=require(_0x8dfb('0x3'));var BPromise=require(_0x8dfb('0x4'));var rp=require(_0x8dfb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8dfb('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x8dfb('0x7')]=function(_0x472b57,_0x25906c){return _0x472b57[_0x8dfb('0x8')](_0x8dfb('0x9'),attributes,{'tableName':_0x8dfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 5a3d399..466a6ac 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 _0x47ca=['map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include'];(function(_0x3755a2,_0x5be61e){var _0x2df8e4=function(_0x316bae){while(--_0x316bae){_0x3755a2['push'](_0x3755a2['shift']());}};_0x2df8e4(++_0x5be61e);}(_0x47ca,0x1c9));var _0xa47c=function(_0x2f9d3d,_0x3b9543){_0x2f9d3d=_0x2f9d3d-0x0;var _0x553009=_0x47ca[_0x2f9d3d];return _0x553009;};'use strict';var _=require(_0xa47c('0x0'));var util=require(_0xa47c('0x1'));var moment=require(_0xa47c('0x2'));var BPromise=require(_0xa47c('0x3'));var rs=require(_0xa47c('0x4'));var fs=require('fs');var Redis=require(_0xa47c('0x5'));var db=require(_0xa47c('0x6'))['db'];var utils=require(_0xa47c('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa47c('0x8'));var client=jayson[_0xa47c('0x9')][_0xa47c('0xa')]({'port':0x232a});config[_0xa47c('0xb')]=_[_0xa47c('0xc')](config[_0xa47c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa47c('0xd'))(new Redis(config['redis']));require('./whatsappAccount.socket')[_0xa47c('0xe')](socket);function respondWithRpcPromise(_0xedd929,_0x14d418,_0x9ceccf){return new BPromise(function(_0x3806e0,_0x2840a3){return client[_0xa47c('0xf')](_0xedd929,_0x9ceccf)[_0xa47c('0x10')](function(_0x28d39f){logger[_0xa47c('0x11')](_0xa47c('0x12'),_0x14d418,_0xa47c('0x13'));logger[_0xa47c('0x14')](_0xa47c('0x15'),_0x14d418,_0xa47c('0x13'),JSON[_0xa47c('0x16')](_0x28d39f));if(_0x28d39f['error']){if(_0x28d39f['error']['code']===0x1f4){logger[_0xa47c('0x17')](_0xa47c('0x12'),_0x14d418,_0x28d39f[_0xa47c('0x17')][_0xa47c('0x18')]);return _0x2840a3(_0x28d39f['error'][_0xa47c('0x18')]);}logger['error'](_0xa47c('0x12'),_0x14d418,_0x28d39f[_0xa47c('0x17')]['message']);return _0x3806e0(_0x28d39f[_0xa47c('0x17')][_0xa47c('0x18')]);}else{logger[_0xa47c('0x11')](_0xa47c('0x12'),_0x14d418,'request\x20sent');_0x3806e0(_0x28d39f['result']['message']);}})[_0xa47c('0x19')](function(_0x510cd1){logger[_0xa47c('0x17')](_0xa47c('0x12'),_0x14d418,_0x510cd1);_0x2840a3(_0x510cd1);});});}exports[_0xa47c('0x1a')]=function(_0x351558){var _0xddffd=this;return new Promise(function(_0x3d416a,_0x25bb1b){return db[_0xa47c('0x1b')][_0xa47c('0x1c')]({'raw':_0x351558[_0xa47c('0x1d')]?_0x351558['options'][_0xa47c('0x1e')]===undefined?!![]:![]:!![],'where':_0x351558['options']?_0x351558['options']['where']||null:null,'attributes':_0x351558[_0xa47c('0x1d')]?_0x351558[_0xa47c('0x1d')][_0xa47c('0x1f')]||null:null,'include':_0x351558[_0xa47c('0x1d')]?_0x351558['options'][_0xa47c('0x20')]?_[_0xa47c('0x21')](_0x351558[_0xa47c('0x1d')]['include'],function(_0x5be33c){return{'model':db[_0x5be33c[_0xa47c('0x22')]],'as':_0x5be33c['as'],'attributes':_0x5be33c[_0xa47c('0x1f')],'include':_0x5be33c[_0xa47c('0x20')]?_[_0xa47c('0x21')](_0x5be33c[_0xa47c('0x20')],function(_0x5cea7c){return{'model':db[_0x5cea7c[_0xa47c('0x22')]],'as':_0x5cea7c['as'],'attributes':_0x5cea7c[_0xa47c('0x1f')],'include':_0x5cea7c[_0xa47c('0x20')]?_[_0xa47c('0x21')](_0x5cea7c['include'],function(_0x289078){return{'model':db[_0x289078[_0xa47c('0x22')]],'as':_0x289078['as'],'attributes':_0x289078[_0xa47c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa47c('0x10')](function(_0xafd681){logger[_0xa47c('0x11')](_0xa47c('0x1a'),_0x351558);logger[_0xa47c('0x14')](_0xa47c('0x1a'),_0x351558,JSON[_0xa47c('0x16')](_0xafd681));_0x3d416a(_0xafd681);})['catch'](function(_0x4a6436){logger['error'](_0xa47c('0x1a'),_0x4a6436['message'],_0x351558);_0x25bb1b(_0xddffd[_0xa47c('0x17')](0x1f4,_0x4a6436[_0xa47c('0x18')]));});});}; \ No newline at end of file +var _0xa9bf=['localhost','socket.io-emitter','redis','./whatsappAccount.socket','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','WhatsappAccount','find','options','raw','where','attributes','include','map','model','info','ShowWhatsappAccount','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','defaults'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xa9bf,0x8d));var _0xfa9b=function(_0x4b5bab,_0x1d73d4){_0x4b5bab=_0x4b5bab-0x0;var _0x5abd6b=_0xa9bf[_0x4b5bab];return _0x5abd6b;};'use strict';var _=require(_0xfa9b('0x0'));var util=require('util');var moment=require(_0xfa9b('0x1'));var BPromise=require(_0xfa9b('0x2'));var rs=require(_0xfa9b('0x3'));var fs=require('fs');var Redis=require(_0xfa9b('0x4'));var db=require(_0xfa9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa9b('0x6'));var config=require('../../config/environment');var jayson=require(_0xfa9b('0x7'));var client=jayson[_0xfa9b('0x8')][_0xfa9b('0x9')]({'port':0x232a});config['redis']=_[_0xfa9b('0xa')](config['redis'],{'host':_0xfa9b('0xb'),'port':0x18eb});var socket=require(_0xfa9b('0xc'))(new Redis(config[_0xfa9b('0xd')]));require(_0xfa9b('0xe'))['register'](socket);function respondWithRpcPromise(_0x567abe,_0x1b6583,_0x2d7065){return new BPromise(function(_0x556e5a,_0x4cfeef){return client[_0xfa9b('0xf')](_0x567abe,_0x2d7065)[_0xfa9b('0x10')](function(_0x386002){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x1b6583,_0xfa9b('0x11'));logger['debug'](_0xfa9b('0x12'),_0x1b6583,_0xfa9b('0x11'),JSON[_0xfa9b('0x13')](_0x386002));if(_0x386002[_0xfa9b('0x14')]){if(_0x386002[_0xfa9b('0x14')][_0xfa9b('0x15')]===0x1f4){logger[_0xfa9b('0x14')](_0xfa9b('0x16'),_0x1b6583,_0x386002[_0xfa9b('0x14')][_0xfa9b('0x17')]);return _0x4cfeef(_0x386002['error'][_0xfa9b('0x17')]);}logger[_0xfa9b('0x14')](_0xfa9b('0x16'),_0x1b6583,_0x386002[_0xfa9b('0x14')][_0xfa9b('0x17')]);return _0x556e5a(_0x386002[_0xfa9b('0x14')][_0xfa9b('0x17')]);}else{logger['info'](_0xfa9b('0x16'),_0x1b6583,_0xfa9b('0x11'));_0x556e5a(_0x386002[_0xfa9b('0x18')]['message']);}})['catch'](function(_0x3a7496){logger[_0xfa9b('0x14')](_0xfa9b('0x16'),_0x1b6583,_0x3a7496);_0x4cfeef(_0x3a7496);});});}exports['ShowWhatsappAccount']=function(_0x42d955){var _0x4f3f3c=this;return new Promise(function(_0x1ac50f,_0x2f05de){return db[_0xfa9b('0x19')][_0xfa9b('0x1a')]({'raw':_0x42d955[_0xfa9b('0x1b')]?_0x42d955[_0xfa9b('0x1b')][_0xfa9b('0x1c')]===undefined?!![]:![]:!![],'where':_0x42d955[_0xfa9b('0x1b')]?_0x42d955['options'][_0xfa9b('0x1d')]||null:null,'attributes':_0x42d955[_0xfa9b('0x1b')]?_0x42d955[_0xfa9b('0x1b')][_0xfa9b('0x1e')]||null:null,'include':_0x42d955[_0xfa9b('0x1b')]?_0x42d955['options'][_0xfa9b('0x1f')]?_[_0xfa9b('0x20')](_0x42d955['options'][_0xfa9b('0x1f')],function(_0x462959){return{'model':db[_0x462959['model']],'as':_0x462959['as'],'attributes':_0x462959['attributes'],'include':_0x462959[_0xfa9b('0x1f')]?_[_0xfa9b('0x20')](_0x462959['include'],function(_0xaab88e){return{'model':db[_0xaab88e['model']],'as':_0xaab88e['as'],'attributes':_0xaab88e[_0xfa9b('0x1e')],'include':_0xaab88e['include']?_[_0xfa9b('0x20')](_0xaab88e[_0xfa9b('0x1f')],function(_0x2fb613){return{'model':db[_0x2fb613[_0xfa9b('0x21')]],'as':_0x2fb613['as'],'attributes':_0x2fb613[_0xfa9b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8ccd){logger[_0xfa9b('0x22')](_0xfa9b('0x23'),_0x42d955);logger[_0xfa9b('0x24')](_0xfa9b('0x23'),_0x42d955,JSON[_0xfa9b('0x13')](_0x2f8ccd));_0x1ac50f(_0x2f8ccd);})[_0xfa9b('0x25')](function(_0x34d77d){logger['error']('ShowWhatsappAccount',_0x34d77d[_0xfa9b('0x17')],_0x42d955);_0x2f05de(_0x4f3f3c[_0xfa9b('0x14')](0x1f4,_0x34d77d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8054700..d4e5698 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 _0xea28=['emit','register','length','whatsappAccount:','save','remove','update'];(function(_0x11f598,_0x5a2990){var _0x2a37dc=function(_0x510577){while(--_0x510577){_0x11f598['push'](_0x11f598['shift']());}};_0x2a37dc(++_0x5a2990);}(_0xea28,0x1b6));var _0x8ea2=function(_0x1f90fa,_0x12e854){_0x1f90fa=_0x1f90fa-0x0;var _0x47e483=_0xea28[_0x1f90fa];return _0x47e483;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x8ea2('0x0'),_0x8ea2('0x1'),_0x8ea2('0x2')];function createListener(_0x2ae0dd,_0x28a8f4){return function(_0x423ce2){_0x28a8f4[_0x8ea2('0x3')](_0x2ae0dd,_0x423ce2);};}function removeListener(_0x43f0f0,_0x4ff937){return function(){WhatsappAccountEvents['removeListener'](_0x43f0f0,_0x4ff937);};}exports[_0x8ea2('0x4')]=function(_0x48b7d9){for(var _0x109ac5=0x0,_0x2c93dd=events[_0x8ea2('0x5')];_0x109ac5<_0x2c93dd;_0x109ac5++){var _0x4ce873=events[_0x109ac5];var _0x3193f6=createListener(_0x8ea2('0x6')+_0x4ce873,_0x48b7d9);WhatsappAccountEvents['on'](_0x4ce873,_0x3193f6);}}; \ No newline at end of file +var _0x8581=['length','save','remove','removeListener','register'];(function(_0x46406b,_0x309548){var _0x5e6b50=function(_0xca7ec9){while(--_0xca7ec9){_0x46406b['push'](_0x46406b['shift']());}};_0x5e6b50(++_0x309548);}(_0x8581,0x114));var _0x1858=function(_0x57cc7a,_0x1e738d){_0x57cc7a=_0x57cc7a-0x0;var _0x5d6159=_0x8581[_0x57cc7a];return _0x5d6159;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x1858('0x0'),_0x1858('0x1'),'update'];function createListener(_0x3d170e,_0x55a372){return function(_0x2048e0){_0x55a372['emit'](_0x3d170e,_0x2048e0);};}function removeListener(_0x37b79f,_0x58afc1){return function(){WhatsappAccountEvents[_0x1858('0x2')](_0x37b79f,_0x58afc1);};}exports[_0x1858('0x3')]=function(_0x1c6aa3){for(var _0xf0aac3=0x0,_0x27db16=events[_0x1858('0x4')];_0xf0aac3<_0x27db16;_0xf0aac3++){var _0x100b3e=events[_0xf0aac3];var _0x324c4a=createListener('whatsappAccount:'+_0x100b3e,_0x1c6aa3);WhatsappAccountEvents['on'](_0x100b3e,_0x324c4a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index bfcd623..78e30ab 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 _0x7536=['show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x382adb,_0x212716){var _0x592cec=function(_0x25d31a){while(--_0x25d31a){_0x382adb['push'](_0x382adb['shift']());}};_0x592cec(++_0x212716);}(_0x7536,0xa7));var _0x6753=function(_0x3240ff,_0x3b9c3d){_0x3240ff=_0x3240ff-0x0;var _0x514858=_0x7536[_0x3240ff];return _0x514858;};'use strict';var multer=require(_0x6753('0x0'));var util=require('util');var path=require(_0x6753('0x1'));var timeout=require(_0x6753('0x2'));var express=require(_0x6753('0x3'));var router=express['Router']();var fs_extra=require(_0x6753('0x4'));var auth=require(_0x6753('0x5'));var interaction=require(_0x6753('0x6'));var config=require(_0x6753('0x7'));var controller=require(_0x6753('0x8'));router[_0x6753('0x9')]('/',auth[_0x6753('0xa')](),controller[_0x6753('0xb')]);router['get'](_0x6753('0xc'),auth[_0x6753('0xa')](),controller[_0x6753('0xd')]);router['post']('/',auth[_0x6753('0xa')](),controller[_0x6753('0xe')]);router[_0x6753('0xf')](_0x6753('0xc'),auth[_0x6753('0xa')](),controller[_0x6753('0x10')]);router[_0x6753('0x11')](_0x6753('0xc'),auth[_0x6753('0xa')](),controller[_0x6753('0x12')]);module[_0x6753('0x13')]=router; \ No newline at end of file +var _0x16c6=['index','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16c6,0xa1));var _0x616c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x16c6[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x616c('0x0'));var timeout=require(_0x616c('0x1'));var express=require(_0x616c('0x2'));var router=express[_0x616c('0x3')]();var fs_extra=require(_0x616c('0x4'));var auth=require(_0x616c('0x5'));var interaction=require(_0x616c('0x6'));var config=require(_0x616c('0x7'));var controller=require('./whatsappApplication.controller');router[_0x616c('0x8')]('/',auth[_0x616c('0x9')](),controller[_0x616c('0xa')]);router[_0x616c('0x8')](_0x616c('0xb'),auth[_0x616c('0x9')](),controller['show']);router[_0x616c('0xc')]('/',auth['isAuthenticated'](),controller[_0x616c('0xd')]);router[_0x616c('0xe')]('/:id',auth[_0x616c('0x9')](),controller[_0x616c('0xf')]);router[_0x616c('0x10')]('/:id',auth[_0x616c('0x9')](),controller[_0x616c('0x11')]);module[_0x616c('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index e79eb0e..ac345b4 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 _0x90fa=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x90fa,0x1a8));var _0xa90f=function(_0x5afadf,_0x3becf3){_0x5afadf=_0x5afadf-0x0;var _0x163055=_0x90fa[_0x5afadf];return _0x163055;};'use strict';var Sequelize=require(_0xa90f('0x0'));module[_0xa90f('0x1')]={'priority':{'type':Sequelize[_0xa90f('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa90f('0x3')},'appdata':{'type':Sequelize[_0xa90f('0x4')]()},'description':{'type':Sequelize[_0xa90f('0x5')]},'interval':{'type':Sequelize[_0xa90f('0x5')],'defaultValue':_0xa90f('0x6')}}; \ No newline at end of file +var _0x42d9=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x42e3e1,_0x1d45af){var _0x211a2b=function(_0x3ea9b4){while(--_0x3ea9b4){_0x42e3e1['push'](_0x42e3e1['shift']());}};_0x211a2b(++_0x1d45af);}(_0x42d9,0x1c5));var _0x942d=function(_0x5acaea,_0x442cb0){_0x5acaea=_0x5acaea-0x0;var _0x509dfa=_0x42d9[_0x5acaea];return _0x509dfa;};'use strict';var Sequelize=require(_0x942d('0x0'));module[_0x942d('0x1')]={'priority':{'type':Sequelize[_0x942d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x942d('0x3')],'allowNull':![],'defaultValue':_0x942d('0x4')},'appdata':{'type':Sequelize[_0x942d('0x5')]()},'description':{'type':Sequelize[_0x942d('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 4dda10c..bd9ba7c 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 _0x9264=['rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','offset','order','sort','where','pick','filter','VIRTUAL','merge','findAll','rows','show','params','keys','includeAll','include','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','WhatsappApplication'];(function(_0x1b7330,_0x2ea8c1){var _0x4bdd4e=function(_0x1d7caf){while(--_0x1d7caf){_0x1b7330['push'](_0x1b7330['shift']());}};_0x4bdd4e(++_0x2ea8c1);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x4926('0x0'));var rimraf=require(_0x4926('0x1'));var zipdir=require(_0x4926('0x2'));var jsonpatch=require(_0x4926('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4926('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4926('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4926('0x6'));var _=require(_0x4926('0x7'));var squel=require('squel');var crypto=require(_0x4926('0x8'));var jsforce=require(_0x4926('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4926('0xa'));var querystring=require(_0x4926('0xb'));var Papa=require(_0x4926('0xc'));var Redis=require('ioredis');var authService=require(_0x4926('0xd'));var qs=require(_0x4926('0xe'));var as=require(_0x4926('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4926('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4926('0x11'));var licenseUtil=require(_0x4926('0x12'));var db=require(_0x4926('0x13'))['db'];function respondWithStatusCode(_0x5423a3,_0xd3cbc){_0xd3cbc=_0xd3cbc||0xcc;return function(_0x21eae1){if(_0x21eae1){return _0x5423a3[_0x4926('0x14')](_0xd3cbc);}return _0x5423a3[_0x4926('0x15')](_0xd3cbc)[_0x4926('0x16')]();};}function respondWithResult(_0x2a2105,_0x2f466b){_0x2f466b=_0x2f466b||0xc8;return function(_0x1a280b){if(_0x1a280b){return _0x2a2105[_0x4926('0x15')](_0x2f466b)[_0x4926('0x17')](_0x1a280b);}};}function respondWithFilteredResult(_0xac0db7,_0x1fbb5d){return function(_0x3018cb){if(_0x3018cb){var _0x1ac74f=typeof _0x1fbb5d['offset']===_0x4926('0x18')&&typeof _0x1fbb5d[_0x4926('0x19')]===_0x4926('0x18');var _0x5736dd=_0x3018cb['count'];var _0x1dd78e=_0x1ac74f?0x0:_0x1fbb5d['offset'];var _0x214e36=_0x1ac74f?_0x3018cb[_0x4926('0x1a')]:_0x1fbb5d['offset']+_0x1fbb5d[_0x4926('0x19')];var _0x49461e;if(_0x214e36>=_0x5736dd){_0x214e36=_0x5736dd;_0x49461e=0xc8;}else{_0x49461e=0xce;}_0xac0db7[_0x4926('0x15')](_0x49461e);return _0xac0db7[_0x4926('0x1b')](_0x4926('0x1c'),_0x1dd78e+'-'+_0x214e36+'/'+_0x5736dd)[_0x4926('0x17')](_0x3018cb);}return null;};}function patchUpdates(_0x5b7588){return function(_0x59dc6a){try{jsonpatch[_0x4926('0x1d')](_0x59dc6a,_0x5b7588,!![]);}catch(_0x588c7a){return BPromise['reject'](_0x588c7a);}return _0x59dc6a[_0x4926('0x1e')]();};}function saveUpdates(_0x309c71,_0x55d055){return function(_0xfd1095){if(_0xfd1095){return _0xfd1095['update'](_0x309c71)[_0x4926('0x1f')](function(_0x55e459){return _0x55e459;});}return null;};}function removeEntity(_0x10d0b2,_0x34d600){return function(_0x2df18c){if(_0x2df18c){return _0x2df18c[_0x4926('0x20')]()['then'](function(){_0x10d0b2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c02e7,_0xbfbe1b){return function(_0x43c077){if(!_0x43c077){_0x1c02e7[_0x4926('0x14')](0x194);}return _0x43c077;};}function handleError(_0x51be4f,_0x508dea){_0x508dea=_0x508dea||0x1f4;return function(_0x55413a){logger[_0x4926('0x21')](_0x55413a[_0x4926('0x22')]);if(_0x55413a[_0x4926('0x23')]){delete _0x55413a['name'];}_0x51be4f['status'](_0x508dea)['send'](_0x55413a);};}exports[_0x4926('0x24')]=function(_0x3f06a3,_0xbfe28d){var _0x4bd08d={},_0x180421={},_0x9d610c={'count':0x0,'rows':[]};var _0x3f4a69=_[_0x4926('0x25')](db[_0x4926('0x26')][_0x4926('0x27')],function(_0x5a44a9){return{'name':_0x5a44a9[_0x4926('0x28')],'type':_0x5a44a9[_0x4926('0x29')][_0x4926('0x2a')]};});_0x180421[_0x4926('0x2b')]=_[_0x4926('0x25')](_0x3f4a69,_0x4926('0x23'));_0x180421[_0x4926('0x2c')]=_['keys'](_0x3f06a3[_0x4926('0x2c')]);_0x180421[_0x4926('0x2d')]=_['intersection'](_0x180421[_0x4926('0x2b')],_0x180421[_0x4926('0x2c')]);_0x4bd08d[_0x4926('0x2e')]=_[_0x4926('0x2f')](_0x180421[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x30')]));_0x4bd08d[_0x4926('0x2e')]=_0x4bd08d[_0x4926('0x2e')][_0x4926('0x31')]?_0x4bd08d[_0x4926('0x2e')]:_0x180421[_0x4926('0x2b')];if(!_0x3f06a3[_0x4926('0x2c')]['hasOwnProperty'](_0x4926('0x32'))){_0x4bd08d[_0x4926('0x19')]=qs[_0x4926('0x19')](_0x3f06a3[_0x4926('0x2c')]['limit']);_0x4bd08d[_0x4926('0x33')]=qs[_0x4926('0x33')](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x33')]);}_0x4bd08d[_0x4926('0x34')]=qs['sort'](_0x3f06a3[_0x4926('0x2c')][_0x4926('0x35')]);_0x4bd08d[_0x4926('0x36')]=qs['filters'](_[_0x4926('0x37')](_0x3f06a3[_0x4926('0x2c')],_0x180421[_0x4926('0x2d')]),_0x3f4a69);if(_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]){_0x4bd08d[_0x4926('0x36')]=_['merge'](_0x4bd08d[_0x4926('0x36')],{'$or':_[_0x4926('0x25')](_0x3f4a69,function(_0x3c5595){if(_0x3c5595[_0x4926('0x29')]!==_0x4926('0x39')){var _0x5237f4={};_0x5237f4[_0x3c5595[_0x4926('0x23')]]={'$like':'%'+_0x3f06a3[_0x4926('0x2c')][_0x4926('0x38')]+'%'};return _0x5237f4;}})});}_0x4bd08d=_[_0x4926('0x3a')]({},_0x4bd08d,_0x3f06a3['options']);var _0x505de3={'where':_0x4bd08d['where']};return db[_0x4926('0x26')][_0x4926('0x1a')](_0x505de3)[_0x4926('0x1f')](function(_0x1d97db){_0x9d610c[_0x4926('0x1a')]=_0x1d97db;if(_0x3f06a3['query']['includeAll']){_0x4bd08d['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x4926('0x3b')](_0x4bd08d);})[_0x4926('0x1f')](function(_0x4380da){_0x9d610c[_0x4926('0x3c')]=_0x4380da;return _0x9d610c;})[_0x4926('0x1f')](respondWithFilteredResult(_0xbfe28d,_0x4bd08d))['catch'](handleError(_0xbfe28d,null));};exports[_0x4926('0x3d')]=function(_0x203f24,_0x218631){var _0x9dc879={'raw':!![],'where':{'id':_0x203f24[_0x4926('0x3e')]['id']}},_0x437800={};_0x437800[_0x4926('0x2b')]=_[_0x4926('0x3f')](db[_0x4926('0x26')][_0x4926('0x27')]);_0x437800['query']=_['keys'](_0x203f24[_0x4926('0x2c')]);_0x437800['filters']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],_0x437800[_0x4926('0x2c')]);_0x9dc879['attributes']=_[_0x4926('0x2f')](_0x437800[_0x4926('0x2b')],qs[_0x4926('0x30')](_0x203f24[_0x4926('0x2c')][_0x4926('0x30')]));_0x9dc879[_0x4926('0x2e')]=_0x9dc879[_0x4926('0x2e')][_0x4926('0x31')]?_0x9dc879[_0x4926('0x2e')]:_0x437800[_0x4926('0x2b')];if(_0x203f24[_0x4926('0x2c')][_0x4926('0x40')]){_0x9dc879[_0x4926('0x41')]=[{'all':!![]}];}_0x9dc879=_[_0x4926('0x3a')]({},_0x9dc879,_0x203f24[_0x4926('0x42')]);return db['WhatsappApplication'][_0x4926('0x43')](_0x9dc879)[_0x4926('0x1f')](handleEntityNotFound(_0x218631,null))['then'](respondWithResult(_0x218631,null))[_0x4926('0x44')](handleError(_0x218631,null));};exports[_0x4926('0x45')]=function(_0x416968,_0x572c91){return db[_0x4926('0x26')][_0x4926('0x45')](_0x416968[_0x4926('0x46')],{})[_0x4926('0x1f')](respondWithResult(_0x572c91,0xc9))[_0x4926('0x44')](handleError(_0x572c91,null));};exports[_0x4926('0x47')]=function(_0x43764f,_0x12a89b){if(_0x43764f['body']['id']){delete _0x43764f[_0x4926('0x46')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x43764f[_0x4926('0x3e')]['id']}})[_0x4926('0x1f')](handleEntityNotFound(_0x12a89b,null))['then'](saveUpdates(_0x43764f[_0x4926('0x46')],null))[_0x4926('0x1f')](respondWithResult(_0x12a89b,null))[_0x4926('0x44')](handleError(_0x12a89b,null));};exports[_0x4926('0x20')]=function(_0x15d338,_0x84f5b0){return db['WhatsappApplication']['find']({'where':{'id':_0x15d338['params']['id']}})['then'](handleEntityNotFound(_0x84f5b0,null))[_0x4926('0x1f')](removeEntity(_0x84f5b0,null))[_0x4926('0x44')](handleError(_0x84f5b0,null));}; \ No newline at end of file +var _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','WhatsappApplication','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x419ca1,_0x40738b){var _0x5dac91=function(_0x4019c5){while(--_0x4019c5){_0x419ca1['push'](_0x419ca1['shift']());}};_0x5dac91(++_0x40738b);}(_0x4991,0xf7));var _0x1499=function(_0x4239df,_0x49d5d2){_0x4239df=_0x4239df-0x0;var _0x347b70=_0x4991[_0x4239df];return _0x347b70;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['WhatsappApplication'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 7c336c2..d27bb47 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 _0x5178=['moment','bluebird','rimraf','../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','util','../../config/logger','api'];(function(_0x331789,_0xd82a31){var _0xee2eb5=function(_0x340666){while(--_0x340666){_0x331789['push'](_0x331789['shift']());}};_0xee2eb5(++_0xd82a31);}(_0x5178,0x171));var _0x8517=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5178[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./whatsappApplication.attributes');module[_0x8517('0x7')]=function(_0x58ed7e,_0x13ba05){return _0x58ed7e[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8517('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xae79=['whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x3c97e3,_0x321677){var _0x9bb0ed=function(_0x3a0cb6){while(--_0x3a0cb6){_0x3c97e3['push'](_0x3c97e3['shift']());}};_0x9bb0ed(++_0x321677);}(_0xae79,0x1d3));var _0x9ae7=function(_0x2a115a,_0x2ab06f){_0x2a115a=_0x2a115a-0x0;var _0x4b1385=_0xae79[_0x2a115a];return _0x4b1385;};'use strict';var _=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var logger=require(_0x9ae7('0x2'))(_0x9ae7('0x3'));var moment=require(_0x9ae7('0x4'));var BPromise=require(_0x9ae7('0x5'));var rp=require(_0x9ae7('0x6'));var fs=require('fs');var path=require(_0x9ae7('0x7'));var rimraf=require(_0x9ae7('0x8'));var config=require(_0x9ae7('0x9'));var attributes=require(_0x9ae7('0xa'));module[_0x9ae7('0xb')]=function(_0x3e98cf,_0x396863){return _0x3e98cf[_0x9ae7('0xc')]('WhatsappApplication',attributes,{'tableName':_0x9ae7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ae7('0xe'),'collate':_0x9ae7('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 34f85af..1fdb805 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x1dd65d,_0x565e77){var _0x51952d=function(_0x3dff2c){while(--_0x3dff2c){_0x1dd65d['push'](_0x1dd65d['shift']());}};_0x51952d(++_0x565e77);}(_0xfd28,0x148));var _0x8fd2=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xfd28[_0x533e4e];return _0x1f14bb;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0xed1f=['request','then','info','WhatsappApplication,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2f9cb5,_0x5f2316){var _0x132595=function(_0x476db2){while(--_0x476db2){_0x2f9cb5['push'](_0x2f9cb5['shift']());}};_0x132595(++_0x5f2316);}(_0xed1f,0x6a));var _0xfed1=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xed1f[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var moment=require(_0xfed1('0x2'));var BPromise=require(_0xfed1('0x3'));var rs=require(_0xfed1('0x4'));var fs=require('fs');var Redis=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];var utils=require(_0xfed1('0x7'));var logger=require(_0xfed1('0x8'))(_0xfed1('0x9'));var config=require(_0xfed1('0xa'));var jayson=require(_0xfed1('0xb'));var client=jayson[_0xfed1('0xc')][_0xfed1('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x380e18,_0x612b38,_0x2a6082){return new BPromise(function(_0x2967ef,_0x568d48){return client[_0xfed1('0xe')](_0x380e18,_0x2a6082)[_0xfed1('0xf')](function(_0x48862d){logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,'request\x20sent');logger[_0xfed1('0x12')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x612b38,_0xfed1('0x13'),JSON[_0xfed1('0x14')](_0x48862d));if(_0x48862d['error']){if(_0x48862d['error'][_0xfed1('0x15')]===0x1f4){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x568d48(_0x48862d['error'][_0xfed1('0x17')]);}logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x48862d[_0xfed1('0x16')]['message']);return _0x2967ef(_0x48862d['error'][_0xfed1('0x17')]);}else{logger[_0xfed1('0x10')](_0xfed1('0x11'),_0x612b38,_0xfed1('0x13'));_0x2967ef(_0x48862d['result'][_0xfed1('0x17')]);}})['catch'](function(_0x36ff34){logger[_0xfed1('0x16')]('WhatsappApplication,\x20%s,\x20%s',_0x612b38,_0x36ff34);_0x568d48(_0x36ff34);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 235c7f9..2d833dd 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 _0xcd59=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags'];(function(_0x4437ca,_0x87b983){var _0x42f189=function(_0x24455c){while(--_0x24455c){_0x4437ca['push'](_0x4437ca['shift']());}};_0x42f189(++_0x87b983);}(_0xcd59,0x14b));var _0x9cd5=function(_0x263d7d,_0x4fe765){_0x263d7d=_0x263d7d-0x0;var _0x510b6d=_0xcd59[_0x263d7d];return _0x510b6d;};'use strict';var multer=require(_0x9cd5('0x0'));var util=require(_0x9cd5('0x1'));var path=require(_0x9cd5('0x2'));var timeout=require(_0x9cd5('0x3'));var express=require(_0x9cd5('0x4'));var router=express[_0x9cd5('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9cd5('0x6'));var interaction=require(_0x9cd5('0x7'));var config=require(_0x9cd5('0x8'));var controller=require(_0x9cd5('0x9'));router[_0x9cd5('0xa')]('/',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xc')]);router[_0x9cd5('0xa')](_0x9cd5('0xd'),auth[_0x9cd5('0xb')](),controller['describe']);router[_0x9cd5('0xa')](_0x9cd5('0xe'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0xf')]);router[_0x9cd5('0xa')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x11')]);router['get'](_0x9cd5('0x12'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x13')]);router[_0x9cd5('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cd5('0x14')](_0x9cd5('0x10'),auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x15')]);router[_0x9cd5('0x14')](_0x9cd5('0x16'),auth['isAuthenticated'](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x19')),controller['addTags']);router['put']('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')]('whatsapp',_0x9cd5('0x1a')),controller[_0x9cd5('0x1b')]);router[_0x9cd5('0x1c')]('/:id',auth[_0x9cd5('0xb')](),interaction[_0x9cd5('0x17')](_0x9cd5('0x18'),_0x9cd5('0x1d')),controller[_0x9cd5('0x1e')]);router[_0x9cd5('0x1c')]('/:id/tags',auth[_0x9cd5('0xb')](),controller[_0x9cd5('0x1f')]);module[_0x9cd5('0x20')]=router; \ No newline at end of file +var _0xdfa0=['show','/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x4b121d,_0x4da699){var _0x4c005a=function(_0x50c3ff){while(--_0x50c3ff){_0x4b121d['push'](_0x4b121d['shift']());}};_0x4c005a(++_0x4da699);}(_0xdfa0,0x69));var _0x0dfa=function(_0x1119d4,_0x492123){_0x1119d4=_0x1119d4-0x0;var _0x51cc82=_0xdfa0[_0x1119d4];return _0x51cc82;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./whatsappInteraction.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0x7')]('/:id',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xb')]);router[_0x0dfa('0x7')]('/:id/messages',auth[_0x0dfa('0x8')](),controller['getMessages']);router[_0x0dfa('0x7')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller['download']);router[_0x0dfa('0xd')]('/',auth[_0x0dfa('0x8')](),controller['create']);router[_0x0dfa('0xd')](_0x0dfa('0xe'),auth['isAuthenticated'](),controller[_0x0dfa('0xf')]);router[_0x0dfa('0xd')](_0x0dfa('0x10'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),'whatsappinteraction:addtags'),controller[_0x0dfa('0x13')]);router[_0x0dfa('0x14')](_0x0dfa('0x15'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),_0x0dfa('0x16')),controller[_0x0dfa('0x17')]);router[_0x0dfa('0x18')](_0x0dfa('0x15'),auth[_0x0dfa('0x8')](),interaction[_0x0dfa('0x11')](_0x0dfa('0x12'),_0x0dfa('0x19')),controller[_0x0dfa('0x1a')]);router['delete'](_0x0dfa('0x10'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x1b')]);module[_0x0dfa('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index a691fcd..c2b79ec 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 _0x6596=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment'];(function(_0xfe2ae6,_0x1b3f13){var _0x40f912=function(_0x18f8d3){while(--_0x18f8d3){_0xfe2ae6['push'](_0xfe2ae6['shift']());}};_0x40f912(++_0x1b3f13);}(_0x6596,0x1d3));var _0x6659=function(_0x4cd267,_0x47d529){_0x4cd267=_0x4cd267-0x0;var _0x1ff00a=_0x6596[_0x4cd267];return _0x1ff00a;};'use strict';var Sequelize=require(_0x6659('0x0'));var moment=require(_0x6659('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6659('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6659('0x3')]},'disposition':{'type':Sequelize[_0x6659('0x4')]},'secondDisposition':{'type':Sequelize[_0x6659('0x4')]},'thirdDisposition':{'type':Sequelize[_0x6659('0x4')]},'note':{'type':Sequelize[_0x6659('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x6659('0x5')]('in',_0x6659('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6659('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6659('0x5')]('in',_0x6659('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x02a7=['ENUM','BOOLEAN','moment','DATE','STRING','out'];(function(_0x1726e1,_0x1cc1f4){var _0x44eccc=function(_0x29d671){while(--_0x29d671){_0x1726e1['push'](_0x1726e1['shift']());}};_0x44eccc(++_0x1cc1f4);}(_0x02a7,0x7a));var _0x702a=function(_0x191e5d,_0xf4f645){_0x191e5d=_0x191e5d-0x0;var _0x52f3d9=_0x02a7[_0x191e5d];return _0x52f3d9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x702a('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x702a('0x1')]},'disposition':{'type':Sequelize[_0x702a('0x2')]},'secondDisposition':{'type':Sequelize[_0x702a('0x2')]},'thirdDisposition':{'type':Sequelize[_0x702a('0x2')]},'note':{'type':Sequelize[_0x702a('0x2')]},'phone':{'type':Sequelize[_0x702a('0x2')]},'read1stAt':{'type':Sequelize[_0x702a('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x702a('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x702a('0x4')]('in',_0x702a('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x702a('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index d41ead4..1e7c09d 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 _0xe1c4=['zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name','send','Users','map','TagIds','forEach','Tags','push','waiting','talking','unmanaged','total','UserId','closed','answered','index','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','select','field','color','from','tools_tags','u.fullname','user_has_whatsapp_interactions','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','WhatsappAccountId','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','keyBy','WhatsappInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','catch','show','params','rawAttributes','include','merge','options','create','update','describe','addMessage','WhatsappMessage','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','findAll','removeTags','download','unix','root','server','files','tmp','attachments','transcript-%d-%s.zip','join','fullname','CmContact','lastName','Attachment','Messages','WhatsappAccount','Account','Owner','get','N.A.','createdAt','closedAt','basename','existsSync','pipe','createWriteStream','out','System','firstName','direction','secret','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','eml-format','rimraf'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0xce7128,_0x2620dd){_0xce7128=_0xce7128-0x0;var _0x355e8d=_0xe1c4[_0xce7128];return _0x355e8d;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e1c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e1c('0x4'));var util=require(_0x4e1c('0x5'));var path=require(_0x4e1c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e1c('0x7'));var fs=require('fs');var fs_extra=require(_0x4e1c('0x8'));var _=require(_0x4e1c('0x9'));var squel=require(_0x4e1c('0xa'));var crypto=require(_0x4e1c('0xb'));var jsforce=require(_0x4e1c('0xc'));var deskjs=require(_0x4e1c('0xd'));var toCsv=require(_0x4e1c('0xe'));var querystring=require(_0x4e1c('0xf'));var Papa=require(_0x4e1c('0x10'));var Redis=require(_0x4e1c('0x11'));var authService=require(_0x4e1c('0x12'));var qs=require(_0x4e1c('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4e1c('0x14'));var hardwareService=require(_0x4e1c('0x15'));var logger=require('../../config/logger')(_0x4e1c('0x16'));var utils=require(_0x4e1c('0x17'));var config=require(_0x4e1c('0x18'));var licenseUtil=require(_0x4e1c('0x19'));var db=require('../../mysqldb')['db'];config[_0x4e1c('0x1a')]=_[_0x4e1c('0x1b')](config[_0x4e1c('0x1a')],{'host':_0x4e1c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x4e1c('0x1d')](socket);function respondWithStatusCode(_0x130d8d,_0x344575){_0x344575=_0x344575||0xcc;return function(_0x201779){if(_0x201779){return _0x130d8d['sendStatus'](_0x344575);}return _0x130d8d[_0x4e1c('0x1e')](_0x344575)[_0x4e1c('0x1f')]();};}function respondWithResult(_0x12811c,_0xdb080a){_0xdb080a=_0xdb080a||0xc8;return function(_0x44a842){if(_0x44a842){return _0x12811c[_0x4e1c('0x1e')](_0xdb080a)['json'](_0x44a842);}};}function respondWithFilteredResult(_0x3f3a3d,_0x399bcc){return function(_0x2af3db){if(_0x2af3db){var _0x46a887=typeof _0x399bcc[_0x4e1c('0x20')]===_0x4e1c('0x21')&&typeof _0x399bcc[_0x4e1c('0x22')]==='undefined';var _0x2dbfe9=_0x2af3db[_0x4e1c('0x23')];var _0x391ade=_0x46a887?0x0:_0x399bcc[_0x4e1c('0x20')];var _0x33da37=_0x46a887?_0x2af3db[_0x4e1c('0x23')]:_0x399bcc[_0x4e1c('0x20')]+_0x399bcc['limit'];var _0x25a753;if(_0x33da37>=_0x2dbfe9){_0x33da37=_0x2dbfe9;_0x25a753=0xc8;}else{_0x25a753=0xce;}_0x3f3a3d[_0x4e1c('0x1e')](_0x25a753);return _0x3f3a3d[_0x4e1c('0x24')](_0x4e1c('0x25'),_0x391ade+'-'+_0x33da37+'/'+_0x2dbfe9)[_0x4e1c('0x26')](_0x2af3db);}return null;};}function patchUpdates(_0x133f66){return function(_0x98868b){try{jsonpatch[_0x4e1c('0x27')](_0x98868b,_0x133f66,!![]);}catch(_0x45c13e){return BPromise['reject'](_0x45c13e);}return _0x98868b[_0x4e1c('0x28')]();};}function saveUpdates(_0x7e08f5,_0x1d447c){return function(_0x49e97c){if(_0x49e97c){return _0x49e97c['update'](_0x7e08f5)[_0x4e1c('0x29')](function(_0x551d50){return _0x551d50;});}return null;};}function removeEntity(_0x25cc93,_0xd9c771){return function(_0x2a2ccb){if(_0x2a2ccb){return _0x2a2ccb[_0x4e1c('0x2a')]()[_0x4e1c('0x29')](function(){_0x25cc93[_0x4e1c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53980c,_0x2526a6){return function(_0x264c48){if(!_0x264c48){_0x53980c[_0x4e1c('0x2b')](0x194);}return _0x264c48;};}function handleError(_0x145c29,_0x5ef2f7){_0x5ef2f7=_0x5ef2f7||0x1f4;return function(_0xeccf79){logger[_0x4e1c('0x2c')](_0xeccf79[_0x4e1c('0x2d')]);if(_0xeccf79[_0x4e1c('0x2e')]){delete _0xeccf79['name'];}_0x145c29[_0x4e1c('0x1e')](_0x5ef2f7)[_0x4e1c('0x2f')](_0xeccf79);};}function getInteractionUsers(_0x53bdc7,_0x46d181){return new BPromise(function(_0x5ae521,_0x88df92){try{if(_0x46d181[_0x53bdc7['id']]){_0x53bdc7[_0x4e1c('0x30')]=_[_0x4e1c('0x31')](_0x46d181[_0x53bdc7['id']],function(_0x46a749){return{'id':_0x46a749['id'],'fullname':_0x46a749['fullname']};});}}catch(_0x2656d1){_0x88df92(_0x2656d1);}_0x5ae521(_0x53bdc7);});}function getInteractionTags(_0x56a087,_0x3d79b5){return new BPromise(function(_0x489936,_0x173e5c){try{if(_0x56a087[_0x4e1c('0x32')]){_0x56a087['Tags']=[];_0x56a087[_0x4e1c('0x32')]['split'](',')[_0x4e1c('0x33')](function(_0x27eec4){_0x56a087[_0x4e1c('0x34')][_0x4e1c('0x35')](_0x3d79b5[_0x27eec4]);});}delete _0x56a087[_0x4e1c('0x32')];}catch(_0x283f01){_0x173e5c(_0x283f01);}_0x489936(_0x56a087);});}function updateWhatsappInteraction(_0x44477f,_0xbfa994,_0x415ba7){return new BPromise(function(_0xd71946,_0x51208f){return getInteractionUsers(_0x44477f,_0x415ba7)[_0x4e1c('0x29')](function(_0x35763f){return getInteractionTags(_0x35763f,_0xbfa994);})[_0x4e1c('0x29')](function(_0x1d4884){return getStateInteraction(_0x1d4884);})[_0x4e1c('0x29')](function(_0x3f2b9a){_0xd71946(_0x3f2b9a);})['catch'](function(_0x545d6b){_0x51208f(_0x545d6b);});});}function getStateInteraction(_0xa37d6){return new BPromise(function(_0x68640d){_0xa37d6[_0x4e1c('0x36')]=0x0;_0xa37d6[_0x4e1c('0x37')]=0x0;_0xa37d6['answered']=0x0;_0xa37d6[_0x4e1c('0x38')]=0x0;_0xa37d6[_0x4e1c('0x39')]=0x0;if(!_0xa37d6['closed']&&!_0xa37d6[_0x4e1c('0x3a')]){_0xa37d6[_0x4e1c('0x36')]+=0x1;}if(!_0xa37d6[_0x4e1c('0x3b')]&&_0xa37d6['UserId']){_0xa37d6[_0x4e1c('0x37')]+=0x1;if(_0xa37d6[_0x4e1c('0x36')]){_0xa37d6['waiting']-=0x1;}}if(_0xa37d6[_0x4e1c('0x3b')]&&_0xa37d6[_0x4e1c('0x3a')]){_0xa37d6[_0x4e1c('0x3c')]+=0x1;if(_0xa37d6[_0x4e1c('0x37')]){_0xa37d6[_0x4e1c('0x37')]-=0x1;}}if(_0xa37d6[_0x4e1c('0x3b')]&&!_0xa37d6['UserId']){_0xa37d6['unmanaged']+=0x1;if(_0xa37d6[_0x4e1c('0x36')]){_0xa37d6[_0x4e1c('0x36')]-=0x1;}}_0xa37d6[_0x4e1c('0x39')]+=0x1;_0x68640d(_0xa37d6);});}exports[_0x4e1c('0x3d')]=function(_0x85622f,_0x4344b8){var _0x4773df={},_0x6838bc={},_0xe3c942={'count':0x0,'rows':[]};var _0x115dc2=_[_0x4e1c('0x31')](db['WhatsappInteraction']['rawAttributes'],function(_0x21f504){return{'name':_0x21f504[_0x4e1c('0x3e')],'type':_0x21f504[_0x4e1c('0x3f')][_0x4e1c('0x40')]};});_0x6838bc[_0x4e1c('0x41')]=_[_0x4e1c('0x31')](_0x115dc2,'name');_0x6838bc[_0x4e1c('0x42')]=_[_0x4e1c('0x43')](_0x85622f[_0x4e1c('0x42')]);_0x6838bc[_0x4e1c('0x44')]=_[_0x4e1c('0x45')](_0x6838bc[_0x4e1c('0x41')],_0x6838bc[_0x4e1c('0x42')]);_0x4773df[_0x4e1c('0x46')]=_[_0x4e1c('0x45')](_0x6838bc[_0x4e1c('0x41')],qs[_0x4e1c('0x47')](_0x85622f['query'][_0x4e1c('0x47')]));_0x4773df[_0x4e1c('0x46')]=_0x4773df[_0x4e1c('0x46')][_0x4e1c('0x48')]?_0x4773df[_0x4e1c('0x46')]:_0x6838bc[_0x4e1c('0x41')];if(!_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x49')]('nolimit')){_0x4773df[_0x4e1c('0x22')]=qs['limit'](_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x22')]);_0x4773df['offset']=qs[_0x4e1c('0x20')](_0x85622f[_0x4e1c('0x42')]['offset']);}_0x4773df['order']=qs[_0x4e1c('0x4a')](_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x4a')]);_0x4773df[_0x4e1c('0x4b')]=qs['filters'](_[_0x4e1c('0x4c')](_0x85622f[_0x4e1c('0x42')],_0x6838bc[_0x4e1c('0x44')]),_0x115dc2);var _0x6fae67=[];var _0x488fe4=squel[_0x4e1c('0x4d')]()[_0x4e1c('0x4e')]('id')[_0x4e1c('0x4e')](_0x4e1c('0x2e'))[_0x4e1c('0x4e')](_0x4e1c('0x4f'))[_0x4e1c('0x50')](_0x4e1c('0x51'));var _0x3ec5d4=squel['select']()[_0x4e1c('0x4e')]('u.id')[_0x4e1c('0x4e')](_0x4e1c('0x52'))[_0x4e1c('0x4e')]('ui.WhatsappInteractionId')['from'](_0x4e1c('0x53'),'ui')[_0x4e1c('0x54')]('users','u',_0x4e1c('0x55'));var _0x304419=squel['select']()['from'](_0x4e1c('0x56'),'i')['left_join'](_0x4e1c('0x57'),'c',_0x4e1c('0x58'))[_0x4e1c('0x54')](_0x4e1c('0x59'),'o',_0x4e1c('0x5a'))[_0x4e1c('0x54')](_0x4e1c('0x5b'),'a',_0x4e1c('0x5c'))['left_join'](_0x4e1c('0x5d'),'me',_0x4e1c('0x5e'))['left_join'](_0x4e1c('0x5f'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x4e1c('0x54')](_0x4e1c('0x51'),'t',_0x4e1c('0x60'));var _0x4ac25b=squel[_0x4e1c('0x61')]();var _0x4140dc=[];var _0x4c4c18=squel[_0x4e1c('0x61')]();var _0x2a7da7;if(_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x62')]){_0x2a7da7=as['parseSearch'](_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x62')]);var _0x2a417f=_0x2a7da7[_0x4e1c('0x63')];for(var _0xf00d05=0x0;_0xf00d05<_0x2a7da7[_0x4e1c('0x64')][_0x4e1c('0x48')];_0xf00d05++){var _0x4f09b3=_0x2a7da7[_0x4e1c('0x64')][_0xf00d05];var _0x13e096='i';var _0x10af9d=_[_0x4e1c('0x65')](_0x115dc2,['name',_0x4f09b3[_0x4e1c('0x4e')]]);if(!_0x10af9d){switch(_0x4f09b3[_0x4e1c('0x4e')]){case'unreadMessages':if(_0x4f09b3['value']==0x1){_0x304419[_0x4e1c('0x66')]('`'+_0x4f09b3[_0x4e1c('0x4e')]+_0x4e1c('0x67'));}else{_0x304419[_0x4e1c('0x66')]('`'+_0x4f09b3[_0x4e1c('0x4e')]+_0x4e1c('0x68'));}break;case _0x4e1c('0x69'):if(_0x4f09b3[_0x4e1c('0x6a')]===_0x4e1c('0x6b')){if(_0x4f09b3['value'][_0x4e1c('0x6c')]('\x20')['length']>0x1){_0x4ac25b[_0x2a417f](_0x4e1c('0x6d'),qs[_0x4e1c('0x6e')](_0x4f09b3[_0x4e1c('0x6f')]),null);}else{var _0x4eff95='%'+_0x4f09b3[_0x4e1c('0x6f')]+'%';_0x4ac25b[_0x2a417f](_0x4e1c('0x70'),_0x4eff95,_0x4eff95,_0x4eff95);}}else{_0x10af9d=_[_0x4e1c('0x65')](_0x115dc2,['name',_0x4e1c('0x71')]);_0x4f09b3[_0x4e1c('0x4e')]='ContactId';_0xb8f60f=as[_0x4e1c('0x72')](_0x13e096,_0x10af9d[_0x4e1c('0x3f')],_0x4f09b3);_0x4ac25b[_0x2a417f](_0xb8f60f[_0x4e1c('0x73')],_0xb8f60f[_0x4e1c('0x6f')][_0x4e1c('0x74')],_0xb8f60f[_0x4e1c('0x6f')][_0x4e1c('0x1f')]);}break;case _0x4e1c('0x75'):var _0x4e7a8d=_0x4f09b3[_0x4e1c('0x6f')][_0x4e1c('0x6c')](',')[_0x4e1c('0x31')](function(_0x520ef6){return Number(_0x520ef6);});_0x4e7a8d[_0x4e1c('0x33')](function(_0x13cd56){_0x4c4c18['or'](_0x4e1c('0x76'),'%,'+_0x13cd56+',%');});_0x4140dc=_[_0x4e1c('0x77')](_0x4140dc,_0x4e7a8d);break;case _0x4e1c('0x78'):if(_0x4f09b3[_0x4e1c('0x6a')]===_0x4e1c('0x6b')){_0x4ac25b[_0x2a417f](_0x4e1c('0x79'),'%'+_0x4f09b3[_0x4e1c('0x6f')]+'%',null);}else{_0x10af9d=_[_0x4e1c('0x65')](_0x115dc2,[_0x4e1c('0x2e'),_0x4e1c('0x3a')]);_0x4f09b3[_0x4e1c('0x4e')]=_0x4e1c('0x3a');_0xb8f60f=as['buildExpression'](_0x13e096,_0x10af9d['type'],_0x4f09b3);_0x4ac25b[_0x2a417f](_0xb8f60f[_0x4e1c('0x73')],_0xb8f60f['value']['start'],_0xb8f60f['value'][_0x4e1c('0x1f')]);}break;case _0x4e1c('0x7a'):_0xb8f60f=as[_0x4e1c('0x72')]('me',null,_0x4f09b3);_0x4ac25b[_0x2a417f](_0xb8f60f[_0x4e1c('0x73')],_0xb8f60f[_0x4e1c('0x6f')][_0x4e1c('0x74')],_0xb8f60f['value']['end']);break;}}else{var _0xb8f60f=as[_0x4e1c('0x72')](_0x13e096,_0x10af9d[_0x4e1c('0x3f')],_0x4f09b3);_0x4ac25b[_0x2a417f](_0xb8f60f[_0x4e1c('0x73')],_0xb8f60f[_0x4e1c('0x6f')][_0x4e1c('0x74')],_0xb8f60f[_0x4e1c('0x6f')][_0x4e1c('0x1f')]);}}}else{var _0x489b0a=_(_0x85622f[_0x4e1c('0x42')])[_0x4e1c('0x43')]()[_0x4e1c('0x31')](function(_0x276e9f){return _[_0x4e1c('0x7b')](_0x115dc2,[_0x4e1c('0x2e'),_0x276e9f])?_0x276e9f:undefined;})[_0x4e1c('0x7c')]()[_0x4e1c('0x6f')]();if(!_['isEmpty'](_0x489b0a)){_0x489b0a[_0x4e1c('0x33')](function(_0x135d5b){if(_0x135d5b===_0x4e1c('0x7d')){_0x304419[_0x4e1c('0x4b')]('i.WhatsappAccountId\x20IN\x20?',[]['concat'](_0x85622f['query'][_0x135d5b]));}else if(_0x135d5b==='createdAt'){var _0x4e1e30=JSON[_0x4e1c('0x7e')](_0x85622f[_0x4e1c('0x42')][_0x135d5b])[_0x4e1c('0x7f')];var _0x5e09d8=JSON[_0x4e1c('0x7e')](_0x85622f[_0x4e1c('0x42')][_0x135d5b])[_0x4e1c('0x80')];_0x304419[_0x4e1c('0x4b')](_0x4e1c('0x81'),_0x4e1e30,_0x5e09d8);}else{if(_0x85622f[_0x4e1c('0x42')][_0x135d5b]===_0x4e1c('0x82')){_0x304419[_0x4e1c('0x4b')]('i.'+_0x135d5b+_0x4e1c('0x83'));}else{_0x304419[_0x4e1c('0x4b')]('i.'+_0x135d5b+_0x4e1c('0x84'),_0x85622f[_0x4e1c('0x42')][_0x135d5b]);}}});}if(_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x85')]){if(_0x85622f[_0x4e1c('0x42')]['read']==0x1){_0x304419[_0x4e1c('0x66')](_0x4e1c('0x86'));}else{_0x304419[_0x4e1c('0x66')]('`unreadMessages`\x20>\x200');}}if(_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x87')]){_0x4140dc=_[_0x4e1c('0x88')](_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x87')])?_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x87')]:new Array(_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x87')]);_0x4140dc['forEach'](function(_0x14ba39){_0x4c4c18['or'](_0x4e1c('0x76'),'%,'+_0x14ba39+',%');});}if(_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x89')]){var _0x186df1=_0x85622f['query'][_0x4e1c('0x89')][_0x4e1c('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x4e1c('0x8b')](_0x186df1)){_0x4ac25b['or'](_0x4e1c('0x8c'),_0x186df1+'%')['or'](_0x4e1c('0x8d'),_0x186df1+'%');}else{_0x4ac25b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4e1c('0x6e')](_0x186df1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x186df1+'%');}}}_0x304419[_0x4e1c('0x4b')](_0x4ac25b);_0x304419['group'](_0x4e1c('0x8e'));var _0x23f789={'type':db[_0x4e1c('0x8f')][_0x4e1c('0x90')][_0x4e1c('0x91')],'raw':!![]};var _0x1feb4d=_0x304419[_0x4e1c('0x92')]();_0x1feb4d[_0x4e1c('0x4e')](_0x4e1c('0x8e'));_0x1feb4d[_0x4e1c('0x4e')](_0x4e1c('0x93'),_0x4e1c('0x94'));if(_0x4773df[_0x4e1c('0x95')]){_0x4773df[_0x4e1c('0x95')][_0x4e1c('0x33')](function(_0x335973){var _0x589fbc=_0x335973[0x0]===_0x4e1c('0x96')?_0x335973[0x0]:'i.'+_0x335973[0x0];_0x304419[_0x4e1c('0x95')](_0x589fbc,_0x335973[0x1]===_0x4e1c('0x97')?![]:!![]);});}if(!_[_0x4e1c('0x98')](_0x4140dc)){_0x304419['having'](_0x4c4c18);_0x1feb4d['where'](_0x4e1c('0x99'),_0x4140dc);}BPromise[_0x4e1c('0x9a')]()[_0x4e1c('0x29')](function(){if(!_0x2a7da7){if(_0x85622f['query'][_0x4e1c('0x7d')])return;_0x1feb4d[_0x4e1c('0x4b')](_0x4e1c('0x9b'));_0x304419['where'](_0x4e1c('0x9b'));return;}if(_0x85622f[_0x4e1c('0x9c')][_0x4e1c('0x9d')]!=='agent')return;return _0x85622f['user'][_0x4e1c('0x9e')]({'attributes':['id'],'raw':!![]})[_0x4e1c('0x29')](function(_0x572435){if(_[_0x4e1c('0x98')](_0x572435)){_0x1feb4d['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x304419['where'](_0x4e1c('0x9f'));}else{_0x1feb4d[_0x4e1c('0x4b')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4e1c('0x31')](_0x572435,'id'));_0x304419[_0x4e1c('0x4b')](_0x4e1c('0xa0'),_[_0x4e1c('0x31')](_0x572435,'id'));}});})['then'](function(){if(_0x85622f[_0x4e1c('0x9c')][_0x4e1c('0x9d')]===_0x4e1c('0xa1')&&!_0x2a7da7&&!_0x85622f[_0x4e1c('0x42')][_0x4e1c('0x7d')])return[];return db[_0x4e1c('0xa2')][_0x4e1c('0x42')](_0x1feb4d[_0x4e1c('0xa3')](),_0x23f789);})[_0x4e1c('0x29')](function(_0x4431b5){_0xe3c942[_0x4e1c('0x23')]=_0x4431b5[_0x4e1c('0x48')];if(_0xe3c942[_0x4e1c('0x23')]===0x0)return[];return db[_0x4e1c('0xa2')][_0x4e1c('0x42')](_0x488fe4[_0x4e1c('0xa3')](),_0x23f789)[_0x4e1c('0x29')](function(_0x53da4b){_0x6fae67=_[_0x4e1c('0xa4')](_0x53da4b,'id');_0x23f789=_['merge'](_0x23f789,{'model':db[_0x4e1c('0xa5')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x85622f[_0x4e1c('0x42')]['fields']){_0x4773df['attributes'][_0x4e1c('0x33')](function(_0x3b5326){_0x304419[_0x4e1c('0x4e')]('i.'+_0x3b5326);});}else{_0x304419[_0x4e1c('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4e1c('0x94'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xa6'),_0x4e1c('0xa7'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xa8'),_0x4e1c('0xa9'));_0x304419['field']('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',_0x4e1c('0x96'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xaa'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xab'),_0x4e1c('0xac'));_0x304419[_0x4e1c('0x4e')]('c.lastName',_0x4e1c('0xad'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xae'),_0x4e1c('0xaf'));_0x304419['field'](_0x4e1c('0xb0'),_0x4e1c('0xb1'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xb2'),_0x4e1c('0xb3'));_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xb4'),'Contact.fax');_0x304419['field'](_0x4e1c('0xb5'),'Owner.fullname');_0x304419[_0x4e1c('0x4e')](_0x4e1c('0xb6'),_0x4e1c('0xb7'));_0x304419['field'](_0x4e1c('0xb8'),_0x4e1c('0x32'));}if(_0x4773df[_0x4e1c('0x22')])_0x304419['limit'](_0x4773df[_0x4e1c('0x22')]);if(_0x4773df[_0x4e1c('0x20')])_0x304419[_0x4e1c('0x20')](_0x4773df[_0x4e1c('0x20')]);return db[_0x4e1c('0xa2')][_0x4e1c('0x42')](_0x304419[_0x4e1c('0xa3')](),_0x23f789);})[_0x4e1c('0x29')](function(_0x864dc6){if(_0x864dc6['length']>0x0)_0x3ec5d4['where'](_0x4e1c('0xb9'),_['map'](_0x864dc6,'id'));return db[_0x4e1c('0xa2')][_0x4e1c('0x42')](_0x3ec5d4[_0x4e1c('0xa3')](),_0x23f789)[_0x4e1c('0x29')](function(_0x7ea2a6){var _0x3143ec=_[_0x4e1c('0xba')](_0x7ea2a6,_0x4e1c('0xbb'));var _0x3cefe2=[];_0x864dc6[_0x4e1c('0x33')](function(_0x1b1d45){_0x3cefe2[_0x4e1c('0x35')](updateWhatsappInteraction(_0x1b1d45,_0x6fae67,_0x3143ec));});return BPromise[_0x4e1c('0xbc')](_0x3cefe2);});});})['then'](function(_0x20c5ca){_0xe3c942['rows']=_0x20c5ca;return _0xe3c942;})[_0x4e1c('0x29')](respondWithFilteredResult(_0x4344b8,_0x4773df))[_0x4e1c('0xbd')](handleError(_0x4344b8,null));};exports[_0x4e1c('0xbe')]=function(_0x6053b,_0x95d59f){var _0x51bd00={'raw':![],'where':{'id':_0x6053b[_0x4e1c('0xbf')]['id']}},_0x124471={};_0x124471[_0x4e1c('0x41')]=_['keys'](db[_0x4e1c('0xa5')][_0x4e1c('0xc0')]);_0x124471['query']=_[_0x4e1c('0x43')](_0x6053b[_0x4e1c('0x42')]);_0x124471['filters']=_['intersection'](_0x124471['model'],_0x124471[_0x4e1c('0x42')]);_0x51bd00[_0x4e1c('0x46')]=_['intersection'](_0x124471[_0x4e1c('0x41')],qs[_0x4e1c('0x47')](_0x6053b[_0x4e1c('0x42')][_0x4e1c('0x47')]));_0x51bd00[_0x4e1c('0x46')]=_0x51bd00[_0x4e1c('0x46')][_0x4e1c('0x48')]?_0x51bd00[_0x4e1c('0x46')]:_0x124471[_0x4e1c('0x41')];if(_0x6053b[_0x4e1c('0x42')]['includeAll']){_0x51bd00[_0x4e1c('0xc1')]=[{'all':!![]}];}_0x51bd00=_[_0x4e1c('0xc2')]({},_0x51bd00,_0x6053b[_0x4e1c('0xc3')]);return db[_0x4e1c('0xa5')][_0x4e1c('0x65')](_0x51bd00)[_0x4e1c('0x29')](handleEntityNotFound(_0x95d59f,null))['then'](respondWithResult(_0x95d59f,null))['catch'](handleError(_0x95d59f,null));};exports[_0x4e1c('0xc4')]=function(_0x159729,_0x506f85){return db[_0x4e1c('0xa5')][_0x4e1c('0xc4')](_0x159729[_0x4e1c('0x7a')],{})[_0x4e1c('0x29')](respondWithResult(_0x506f85,0xc9))[_0x4e1c('0xbd')](handleError(_0x506f85,null));};exports[_0x4e1c('0xc5')]=function(_0x4d9014,_0x1975be){if(_0x4d9014[_0x4e1c('0x7a')]['id']){delete _0x4d9014[_0x4e1c('0x7a')]['id'];}return db[_0x4e1c('0xa5')]['find']({'where':{'id':_0x4d9014['params']['id']}})[_0x4e1c('0x29')](handleEntityNotFound(_0x1975be,null))[_0x4e1c('0x29')](saveUpdates(_0x4d9014[_0x4e1c('0x7a')],null))[_0x4e1c('0x29')](respondWithResult(_0x1975be,null))['catch'](handleError(_0x1975be,null));};exports[_0x4e1c('0x2a')]=function(_0xa6df31,_0x445f56){return db[_0x4e1c('0xa5')]['find']({'where':{'id':_0xa6df31[_0x4e1c('0xbf')]['id']}})[_0x4e1c('0x29')](handleEntityNotFound(_0x445f56,null))[_0x4e1c('0x29')](removeEntity(_0x445f56,null))[_0x4e1c('0xbd')](handleError(_0x445f56,null));};exports['describe']=function(_0x2e6c33,_0x28d119){return db[_0x4e1c('0xa5')][_0x4e1c('0xc6')]()[_0x4e1c('0x29')](respondWithResult(_0x28d119,null))[_0x4e1c('0xbd')](handleError(_0x28d119,null));};exports[_0x4e1c('0xc7')]=function(_0x102d03,_0x306d51,_0x371e1f){return db[_0x4e1c('0xc8')][_0x4e1c('0x65')]({'where':{'id':_0x102d03['params']['id']}})['then'](handleEntityNotFound(_0x306d51,null))[_0x4e1c('0x29')](function(_0x4f9f26){if(_0x4f9f26){return _0x4f9f26[_0x4e1c('0xc7')](_0x102d03[_0x4e1c('0x7a')][_0x4e1c('0xc9')],_[_0x4e1c('0xca')](_0x102d03[_0x4e1c('0x7a')],['ids','id'])||{});}})[_0x4e1c('0x29')](respondWithResult(_0x306d51,null))['catch'](handleError(_0x306d51,null));};exports['getMessages']=function(_0x256888,_0x450b15,_0x576a28){var _0x457aa6={'raw':![],'where':{}};var _0x203ba3={};var _0x171966={'count':0x0,'rows':[]};return db[_0x4e1c('0xa5')][_0x4e1c('0xcb')]({'where':{'id':_0x256888['params']['id']}})[_0x4e1c('0x29')](handleEntityNotFound(_0x450b15,null))[_0x4e1c('0x29')](function(_0x62bb23){if(_0x62bb23){_0x203ba3[_0x4e1c('0x41')]=_[_0x4e1c('0x43')](db[_0x4e1c('0xc8')]['rawAttributes']);_0x203ba3[_0x4e1c('0x42')]=_[_0x4e1c('0x43')](_0x256888['query']);_0x203ba3[_0x4e1c('0x44')]=_[_0x4e1c('0x45')](_0x203ba3[_0x4e1c('0x41')],_0x203ba3[_0x4e1c('0x42')]);_0x457aa6['attributes']=_[_0x4e1c('0x45')](_0x203ba3[_0x4e1c('0x41')],qs[_0x4e1c('0x47')](_0x256888[_0x4e1c('0x42')][_0x4e1c('0x47')]));_0x457aa6[_0x4e1c('0x46')]=_0x457aa6[_0x4e1c('0x46')][_0x4e1c('0x48')]?_0x457aa6[_0x4e1c('0x46')]:_0x203ba3[_0x4e1c('0x41')];if(!_0x256888[_0x4e1c('0x42')][_0x4e1c('0x49')]('nolimit')){_0x457aa6[_0x4e1c('0x22')]=qs[_0x4e1c('0x22')](_0x256888[_0x4e1c('0x42')][_0x4e1c('0x22')]);_0x457aa6[_0x4e1c('0x20')]=qs[_0x4e1c('0x20')](_0x256888[_0x4e1c('0x42')][_0x4e1c('0x20')]);}_0x457aa6[_0x4e1c('0x95')]=qs['sort'](_0x256888[_0x4e1c('0x42')]['sort']);_0x457aa6[_0x4e1c('0x4b')]=qs['filters'](_[_0x4e1c('0x4c')](_0x256888[_0x4e1c('0x42')],_0x203ba3[_0x4e1c('0x44')]));_0x457aa6[_0x4e1c('0x4b')][_0x4e1c('0xbb')]=_0x62bb23['id'];if(_0x256888[_0x4e1c('0x42')]['filter']){_0x457aa6[_0x4e1c('0x4b')]=_[_0x4e1c('0xc2')](_0x457aa6['where'],{'$or':_[_0x4e1c('0x31')](_0x457aa6[_0x4e1c('0x46')],function(_0x13f4d4){var _0xfd9468={};_0xfd9468[_0x13f4d4]={'$like':'%'+_0x256888[_0x4e1c('0x42')][_0x4e1c('0x89')]+'%'};return _0xfd9468;})});}if(_0x256888['query'][_0x4e1c('0x7f')]){var _0x1d1edc=_0x256888[_0x4e1c('0x42')]['$gte']['split'](',');var _0x5679b3={};_0x5679b3[_0x1d1edc[0x0]]={'$gte':moment(_0x1d1edc[0x1])[_0x4e1c('0xcc')](_0x4e1c('0xcd'))};_0x457aa6[_0x4e1c('0x4b')]=_[_0x4e1c('0xc2')](_0x457aa6[_0x4e1c('0x4b')],_0x5679b3);}_0x457aa6=_[_0x4e1c('0xc2')]({},_0x457aa6,_0x256888[_0x4e1c('0xc3')]);return db[_0x4e1c('0xc8')][_0x4e1c('0x23')]({'where':_0x457aa6[_0x4e1c('0x4b')]})[_0x4e1c('0x29')](function(_0x1a2cb7){_0x171966['count']=_0x1a2cb7;if(_0x256888[_0x4e1c('0x42')]['includeAll']){_0x457aa6[_0x4e1c('0xc1')]=[{'all':!![]}];}return db[_0x4e1c('0xc8')]['findAll'](_0x457aa6);})[_0x4e1c('0x29')](function(_0x3a88e5){_0x171966['rows']=_0x3a88e5;return _0x171966;});}})[_0x4e1c('0x29')](respondWithFilteredResult(_0x450b15,_0x457aa6))[_0x4e1c('0xbd')](handleError(_0x450b15,null));};exports[_0x4e1c('0xce')]=function(_0x47e8e1,_0x7c3e0a,_0x288051){return db['WhatsappInteraction']['find']({'where':{'id':_0x47e8e1['params']['id']}})[_0x4e1c('0x29')](handleEntityNotFound(_0x7c3e0a,null))['then'](function(_0x467035){if(_0x467035){return _0x467035['setTags'](_0x47e8e1[_0x4e1c('0x7a')]['ids'],_['omit'](_0x47e8e1['body'],['ids','id'])||{})[_0x4e1c('0xcf')](function(){return db[_0x4e1c('0x75')][_0x4e1c('0xd0')]({'attributes':['id',_0x4e1c('0x2e'),_0x4e1c('0x4f')],'where':{'id':_0x47e8e1[_0x4e1c('0x7a')][_0x4e1c('0xc9')]}});})[_0x4e1c('0x29')](function(_0x4a8d1e){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x47e8e1['params']['id']),'tags':_0x4a8d1e||[]});return{'id':Number(_0x47e8e1[_0x4e1c('0xbf')]['id']),'tags':_0x4a8d1e||[]};});}})[_0x4e1c('0x29')](respondWithResult(_0x7c3e0a,null))[_0x4e1c('0xbd')](handleError(_0x7c3e0a,null));};exports[_0x4e1c('0xd1')]=function(_0xdd1ce,_0x341159,_0xa5a21d){return db[_0x4e1c('0xa5')][_0x4e1c('0x65')]({'where':{'id':_0xdd1ce[_0x4e1c('0xbf')]['id']}})[_0x4e1c('0x29')](handleEntityNotFound(_0x341159,null))['then'](function(_0x115f56){if(_0x115f56){return _0x115f56[_0x4e1c('0xd1')](_0xdd1ce[_0x4e1c('0x42')][_0x4e1c('0xc9')]);}})[_0x4e1c('0x29')](respondWithStatusCode(_0x341159,null))[_0x4e1c('0xbd')](handleError(_0x341159,null));};exports[_0x4e1c('0xd2')]=function(_0x59dec0,_0x541e1d){var _0x51e7c7=moment()[_0x4e1c('0xd3')]()[_0x4e1c('0xa3')]();var _0x1cfa29=path['join'](config[_0x4e1c('0xd4')],_0x4e1c('0xd5'),_0x4e1c('0xd6'),_0x4e1c('0xd7'));var _0xd10dd1=path['join'](config[_0x4e1c('0xd4')],_0x4e1c('0xd5'),_0x4e1c('0xd6'),_0x4e1c('0xd8'));var _0x179c54=path['join'](_0x1cfa29,_0x51e7c7);var _0x2b6de=util[_0x4e1c('0xcc')](_0x4e1c('0xd9'),_0x59dec0['params']['id'],_0x51e7c7);var _0x592bee=path[_0x4e1c('0xda')](_0x1cfa29,_0x2b6de);var _0x520fe5=[];_0x520fe5[_0x4e1c('0x35')]({'model':db['User'],'as':_0x4e1c('0x78'),'attributes':['id',_0x4e1c('0xdb')],'raw':!![]});_0x520fe5['push']({'model':db[_0x4e1c('0xdc')],'as':_0x4e1c('0x69'),'attributes':['id','firstName',_0x4e1c('0xdd')],'raw':!![]});if(_0x59dec0[_0x4e1c('0x42')][_0x4e1c('0xd8')]){_0x520fe5[_0x4e1c('0x35')]({'model':db[_0x4e1c('0xde')],'as':_0x4e1c('0xde'),'raw':!![]});}var _0x3d207a=[{'model':db['WhatsappMessage'],'as':_0x4e1c('0xdf'),'attributes':['id','body','createdAt','direction','secret',_0x4e1c('0x85')],'include':_0x520fe5}];_0x3d207a[_0x4e1c('0x35')]({'model':db[_0x4e1c('0xe0')],'as':_0x4e1c('0xe1'),'attributes':['id','name']});_0x3d207a[_0x4e1c('0x35')]({'model':db[_0x4e1c('0x78')],'as':_0x4e1c('0xe2'),'attributes':['id',_0x4e1c('0xdb')]});return db['WhatsappInteraction'][_0x4e1c('0x65')]({'where':{'id':_0x59dec0['params']['id']},'include':_0x3d207a})[_0x4e1c('0x29')](handleEntityNotFound(_0x541e1d,null))[_0x4e1c('0x29')](function(_0x5a63f3){if(_0x5a63f3){var _0x1f2f55=_0x5a63f3[_0x4e1c('0xe3')]({'plain':!![]});fs['mkdirSync'](_0x179c54);var _0x5279bb={'channel':'Whatsapp','account':_0x1f2f55[_0x4e1c('0xe1')][_0x4e1c('0x2e')],'agent':_0x1f2f55['Owner']?_0x1f2f55[_0x4e1c('0xe2')][_0x4e1c('0xdb')]:_0x4e1c('0xe4'),'createdAt':moment(_0x1f2f55[_0x4e1c('0xe5')])[_0x4e1c('0xcc')](_0x4e1c('0xcd'))['toString'](),'closedAt':_0x1f2f55[_0x4e1c('0x3b')]?moment(_0x1f2f55[_0x4e1c('0xe6')])[_0x4e1c('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4e1c('0xa3')]():'','disposition':_0x1f2f55['disposition'],'messages':_(_0x1f2f55[_0x4e1c('0xdf')])[_0x4e1c('0x89')]({'secret':![]})[_0x4e1c('0x31')](function(_0x3bbfee){if(_0x3bbfee[_0x4e1c('0xde')]){var _0x45c674=path['join'](_0xd10dd1,_0x3bbfee[_0x4e1c('0xde')][_0x4e1c('0xe7')]);if(fs[_0x4e1c('0xe8')](_0x45c674)){fs['createReadStream'](_0x45c674)[_0x4e1c('0xe9')](fs[_0x4e1c('0xea')](path['join'](_0x179c54,_0x3bbfee[_0x4e1c('0xde')][_0x4e1c('0xe7')])));}}return{'date':moment(_0x3bbfee[_0x4e1c('0xe5')])[_0x4e1c('0xcc')](_0x4e1c('0xcd'))[_0x4e1c('0xa3')](),'sender':_0x3bbfee['direction']===_0x4e1c('0xeb')?_0x3bbfee[_0x4e1c('0x78')]?_0x3bbfee['User'][_0x4e1c('0xdb')]:_0x4e1c('0xec'):_0x3bbfee[_0x4e1c('0x69')][_0x4e1c('0xed')]+(_0x3bbfee[_0x4e1c('0x69')]['lastName']?'\x20'+_0x3bbfee[_0x4e1c('0x69')]['lastName']:''),'body':_0x3bbfee['Attachment']?_0x3bbfee[_0x4e1c('0xde')][_0x4e1c('0xe7')]:_0x3bbfee[_0x4e1c('0x7a')],'direction':_0x3bbfee[_0x4e1c('0xee')]===_0x4e1c('0xeb')?'A':'C','secret':_0x3bbfee[_0x4e1c('0xef')],'read':_0x3bbfee['read'],'attachment':_0x3bbfee['Attachment']};})[_0x4e1c('0x6f')]()};return ejs['renderFile'](path[_0x4e1c('0xda')](config['root'],_0x4e1c('0xd5'),'views',_0x4e1c('0xf0')),{'interaction':_0x5279bb})[_0x4e1c('0x29')](function(_0xf0b4){var _0x2dd55b=path[_0x4e1c('0xda')](_0x179c54,_0x4e1c('0xf1')+_0x1f2f55['id']+'-'+_0x51e7c7+_0x4e1c('0xf2'));var _0x1a0beb={'path':_0x2dd55b,'channel':_0x4e1c('0xf3'),'interactionId':_0x1f2f55['id']};return pdf[_0x4e1c('0xf4')](_0xf0b4,_0x1a0beb);})['then'](function(){return new BPromise(function(_0x254b53,_0x508edf){zipdir(_0x179c54,{'saveTo':_0x592bee},function(_0x5081b9,_0x526947){if(_0x5081b9)return _0x508edf(_0x5081b9);return _0x254b53(_0x526947);});})['then'](function(){return new BPromise(function(_0x56bcb4,_0x534fd6){rimraf(_0x179c54,function(_0x39a598){if(_0x39a598)_0x534fd6(_0x39a598);return _0x56bcb4();});});})[_0x4e1c('0x29')](function(){return _0x541e1d['download'](_0x592bee,_0x2b6de,function(_0x79fed1){if(_0x79fed1){console[_0x4e1c('0xf5')](_0x4e1c('0xf6'),_0x79fed1);}else{fs['unlinkSync'](_0x592bee);}});});});}else{return _0x541e1d[_0x4e1c('0x2b')](0xc8);}})[_0x4e1c('0xbd')](handleError(_0x541e1d,null));}; \ No newline at end of file +var _0x8212=['waiting','answered','unmanaged','total','closed','UserId','talking','index','WhatsappInteraction','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','field','tools_tags','select','u.id','u.fullname','ui.WhatsappInteractionId','from','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','sqlOperator','conditions','length','find','unreadMessages','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','keys','some','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','contactName','DESC','t.id\x20IN\x20?','role','user','getWhatsappAccounts','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','rawAttributes','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','pick','format','includeAll','findAll','color','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','direction','secret','WhatsappAccount','Account','mkdirSync','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','Messages','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x8212,0xb3));var _0x2821=function(_0x1a7c1c,_0x492841){_0x1a7c1c=_0x1a7c1c-0x0;var _0xac2979=_0x8212[_0x1a7c1c];return _0xac2979;};'use strict';var emlformat=require(_0x2821('0x0'));var rimraf=require(_0x2821('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2821('0x2'));var rp=require(_0x2821('0x3'));var moment=require(_0x2821('0x4'));var BPromise=require(_0x2821('0x5'));var Mustache=require(_0x2821('0x6'));var util=require(_0x2821('0x7'));var path=require(_0x2821('0x8'));var sox=require(_0x2821('0x9'));var csv=require('to-csv');var ejs=require(_0x2821('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2821('0xb'));var squel=require(_0x2821('0xc'));var crypto=require('crypto');var jsforce=require(_0x2821('0xd'));var deskjs=require(_0x2821('0xe'));var toCsv=require(_0x2821('0xf'));var querystring=require(_0x2821('0x10'));var Papa=require(_0x2821('0x11'));var Redis=require(_0x2821('0x12'));var authService=require(_0x2821('0x13'));var qs=require(_0x2821('0x14'));var as=require(_0x2821('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x2821('0x16'));var logger=require(_0x2821('0x17'))(_0x2821('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2821('0x19')]=_[_0x2821('0x1a')](config[_0x2821('0x19')],{'host':_0x2821('0x1b'),'port':0x18eb});var socket=require(_0x2821('0x1c'))(new Redis(config[_0x2821('0x19')]));require('./whatsappInteraction.socket')[_0x2821('0x1d')](socket);function respondWithStatusCode(_0x5030fc,_0x5a92f0){_0x5a92f0=_0x5a92f0||0xcc;return function(_0x4142f1){if(_0x4142f1){return _0x5030fc[_0x2821('0x1e')](_0x5a92f0);}return _0x5030fc[_0x2821('0x1f')](_0x5a92f0)[_0x2821('0x20')]();};}function respondWithResult(_0x4bba07,_0x155811){_0x155811=_0x155811||0xc8;return function(_0x5c2aa7){if(_0x5c2aa7){return _0x4bba07[_0x2821('0x1f')](_0x155811)[_0x2821('0x21')](_0x5c2aa7);}};}function respondWithFilteredResult(_0x41f30b,_0x3f1057){return function(_0x280bfc){if(_0x280bfc){var _0x500357=typeof _0x3f1057[_0x2821('0x22')]===_0x2821('0x23')&&typeof _0x3f1057['limit']===_0x2821('0x23');var _0x4de4d0=_0x280bfc[_0x2821('0x24')];var _0xb7b9a0=_0x500357?0x0:_0x3f1057[_0x2821('0x22')];var _0x8ba96e=_0x500357?_0x280bfc[_0x2821('0x24')]:_0x3f1057[_0x2821('0x22')]+_0x3f1057[_0x2821('0x25')];var _0x1821c0;if(_0x8ba96e>=_0x4de4d0){_0x8ba96e=_0x4de4d0;_0x1821c0=0xc8;}else{_0x1821c0=0xce;}_0x41f30b[_0x2821('0x1f')](_0x1821c0);return _0x41f30b[_0x2821('0x26')](_0x2821('0x27'),_0xb7b9a0+'-'+_0x8ba96e+'/'+_0x4de4d0)['json'](_0x280bfc);}return null;};}function patchUpdates(_0x5efdc0){return function(_0x434476){try{jsonpatch[_0x2821('0x28')](_0x434476,_0x5efdc0,!![]);}catch(_0x2838d8){return BPromise[_0x2821('0x29')](_0x2838d8);}return _0x434476[_0x2821('0x2a')]();};}function saveUpdates(_0x329079,_0x133ad8){return function(_0x3f032d){if(_0x3f032d){return _0x3f032d[_0x2821('0x2b')](_0x329079)[_0x2821('0x2c')](function(_0x7a49da){return _0x7a49da;});}return null;};}function removeEntity(_0x1d2c8f,_0x1cf0d9){return function(_0x3ddbe7){if(_0x3ddbe7){return _0x3ddbe7[_0x2821('0x2d')]()[_0x2821('0x2c')](function(){_0x1d2c8f[_0x2821('0x1f')](0xcc)[_0x2821('0x20')]();});}};}function handleEntityNotFound(_0x340741,_0x2986a8){return function(_0x5dd587){if(!_0x5dd587){_0x340741[_0x2821('0x1e')](0x194);}return _0x5dd587;};}function handleError(_0x4d2b42,_0x109262){_0x109262=_0x109262||0x1f4;return function(_0x4402ea){logger[_0x2821('0x2e')](_0x4402ea[_0x2821('0x2f')]);if(_0x4402ea['name']){delete _0x4402ea[_0x2821('0x30')];}_0x4d2b42[_0x2821('0x1f')](_0x109262)['send'](_0x4402ea);};}function getInteractionUsers(_0x13447a,_0x2e4395){return new BPromise(function(_0x3d2d07,_0x54a033){try{if(_0x2e4395[_0x13447a['id']]){_0x13447a[_0x2821('0x31')]=_[_0x2821('0x32')](_0x2e4395[_0x13447a['id']],function(_0x36dd8a){return{'id':_0x36dd8a['id'],'fullname':_0x36dd8a[_0x2821('0x33')]};});}}catch(_0xd107e9){_0x54a033(_0xd107e9);}_0x3d2d07(_0x13447a);});}function getInteractionTags(_0x1e5e41,_0x4565f2){return new BPromise(function(_0x4fd3b4,_0x427c0a){try{if(_0x1e5e41[_0x2821('0x34')]){_0x1e5e41[_0x2821('0x35')]=[];_0x1e5e41[_0x2821('0x34')][_0x2821('0x36')](',')[_0x2821('0x37')](function(_0x1cb61a){_0x1e5e41[_0x2821('0x35')][_0x2821('0x38')](_0x4565f2[_0x1cb61a]);});}delete _0x1e5e41[_0x2821('0x34')];}catch(_0x352e27){_0x427c0a(_0x352e27);}_0x4fd3b4(_0x1e5e41);});}function updateWhatsappInteraction(_0x5e9194,_0x1880f6,_0x132893){return new BPromise(function(_0x2e19ed,_0x275d35){return getInteractionUsers(_0x5e9194,_0x132893)['then'](function(_0x441cca){return getInteractionTags(_0x441cca,_0x1880f6);})[_0x2821('0x2c')](function(_0x29c13b){return getStateInteraction(_0x29c13b);})[_0x2821('0x2c')](function(_0x1f8a1a){_0x2e19ed(_0x1f8a1a);})[_0x2821('0x39')](function(_0x3d73cd){_0x275d35(_0x3d73cd);});});}function getStateInteraction(_0x2e0eaf){return new BPromise(function(_0x2f30d6){_0x2e0eaf[_0x2821('0x3a')]=0x0;_0x2e0eaf['talking']=0x0;_0x2e0eaf[_0x2821('0x3b')]=0x0;_0x2e0eaf[_0x2821('0x3c')]=0x0;_0x2e0eaf[_0x2821('0x3d')]=0x0;if(!_0x2e0eaf[_0x2821('0x3e')]&&!_0x2e0eaf[_0x2821('0x3f')]){_0x2e0eaf['waiting']+=0x1;}if(!_0x2e0eaf[_0x2821('0x3e')]&&_0x2e0eaf['UserId']){_0x2e0eaf['talking']+=0x1;if(_0x2e0eaf[_0x2821('0x3a')]){_0x2e0eaf[_0x2821('0x3a')]-=0x1;}}if(_0x2e0eaf[_0x2821('0x3e')]&&_0x2e0eaf[_0x2821('0x3f')]){_0x2e0eaf[_0x2821('0x3b')]+=0x1;if(_0x2e0eaf[_0x2821('0x40')]){_0x2e0eaf[_0x2821('0x40')]-=0x1;}}if(_0x2e0eaf['closed']&&!_0x2e0eaf['UserId']){_0x2e0eaf[_0x2821('0x3c')]+=0x1;if(_0x2e0eaf[_0x2821('0x3a')]){_0x2e0eaf[_0x2821('0x3a')]-=0x1;}}_0x2e0eaf[_0x2821('0x3d')]+=0x1;_0x2f30d6(_0x2e0eaf);});}exports[_0x2821('0x41')]=function(_0x5a3e0d,_0x519b11){var _0x236659={},_0x26d389={},_0x234f59={'count':0x0,'rows':[]};var _0xde4a38=_[_0x2821('0x32')](db[_0x2821('0x42')]['rawAttributes'],function(_0x60ecf5){return{'name':_0x60ecf5[_0x2821('0x43')],'type':_0x60ecf5['type'][_0x2821('0x44')]};});_0x26d389[_0x2821('0x45')]=_[_0x2821('0x32')](_0xde4a38,_0x2821('0x30'));_0x26d389[_0x2821('0x46')]=_['keys'](_0x5a3e0d[_0x2821('0x46')]);_0x26d389[_0x2821('0x47')]=_[_0x2821('0x48')](_0x26d389[_0x2821('0x45')],_0x26d389['query']);_0x236659['attributes']=_[_0x2821('0x48')](_0x26d389[_0x2821('0x45')],qs[_0x2821('0x49')](_0x5a3e0d[_0x2821('0x46')][_0x2821('0x49')]));_0x236659[_0x2821('0x4a')]=_0x236659[_0x2821('0x4a')]['length']?_0x236659['attributes']:_0x26d389[_0x2821('0x45')];if(!_0x5a3e0d['query'][_0x2821('0x4b')](_0x2821('0x4c'))){_0x236659[_0x2821('0x25')]=qs[_0x2821('0x25')](_0x5a3e0d[_0x2821('0x46')][_0x2821('0x25')]);_0x236659[_0x2821('0x22')]=qs['offset'](_0x5a3e0d[_0x2821('0x46')][_0x2821('0x22')]);}_0x236659[_0x2821('0x4d')]=qs[_0x2821('0x4e')](_0x5a3e0d[_0x2821('0x46')][_0x2821('0x4e')]);_0x236659[_0x2821('0x4f')]=qs[_0x2821('0x47')](_['pick'](_0x5a3e0d[_0x2821('0x46')],_0x26d389[_0x2821('0x47')]),_0xde4a38);var _0x175ef3=[];var _0x3f370d=squel['select']()[_0x2821('0x50')]('id')[_0x2821('0x50')](_0x2821('0x30'))['field']('color')['from'](_0x2821('0x51'));var _0x16283e=squel[_0x2821('0x52')]()['field'](_0x2821('0x53'))[_0x2821('0x50')](_0x2821('0x54'))[_0x2821('0x50')](_0x2821('0x55'))[_0x2821('0x56')]('user_has_whatsapp_interactions','ui')['left_join'](_0x2821('0x57'),'u',_0x2821('0x58'));var _0x482c89=squel[_0x2821('0x52')]()[_0x2821('0x56')](_0x2821('0x59'),'i')[_0x2821('0x5a')](_0x2821('0x5b'),'c',_0x2821('0x5c'))[_0x2821('0x5a')](_0x2821('0x57'),'o',_0x2821('0x5d'))['left_join']('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')['left_join']('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x2821('0x5a')](_0x2821('0x5e'),'it',_0x2821('0x5f'))[_0x2821('0x5a')](_0x2821('0x51'),'t',_0x2821('0x60'));var _0x436574=squel['expr']();var _0x21a603=[];var _0x132cfb=squel['expr']();var _0x2da025;if(_0x5a3e0d[_0x2821('0x46')][_0x2821('0x61')]){_0x2da025=as['parseSearch'](_0x5a3e0d['query'][_0x2821('0x61')]);var _0xc969df=_0x2da025[_0x2821('0x62')];for(var _0x32f593=0x0;_0x32f593<_0x2da025[_0x2821('0x63')][_0x2821('0x64')];_0x32f593++){var _0x538bb8=_0x2da025[_0x2821('0x63')][_0x32f593];var _0x177a6b='i';var _0x97abab=_[_0x2821('0x65')](_0xde4a38,[_0x2821('0x30'),_0x538bb8[_0x2821('0x50')]]);if(!_0x97abab){switch(_0x538bb8[_0x2821('0x50')]){case _0x2821('0x66'):if(_0x538bb8[_0x2821('0x67')]==0x1){_0x482c89[_0x2821('0x68')]('`'+_0x538bb8[_0x2821('0x50')]+'`\x20=\x200');}else{_0x482c89[_0x2821('0x68')]('`'+_0x538bb8[_0x2821('0x50')]+_0x2821('0x69'));}break;case'Contact':if(_0x538bb8[_0x2821('0x6a')]==='$substring'){if(_0x538bb8[_0x2821('0x67')][_0x2821('0x36')]('\x20')[_0x2821('0x64')]>0x1){_0x436574[_0xc969df](_0x2821('0x6b'),qs[_0x2821('0x6c')](_0x538bb8[_0x2821('0x67')]),null);}else{var _0x4bad6b='%'+_0x538bb8[_0x2821('0x67')]+'%';_0x436574[_0xc969df](_0x2821('0x6d'),_0x4bad6b,_0x4bad6b,_0x4bad6b);}}else{_0x97abab=_[_0x2821('0x65')](_0xde4a38,[_0x2821('0x30'),_0x2821('0x6e')]);_0x538bb8[_0x2821('0x50')]='ContactId';_0x44761e=as[_0x2821('0x6f')](_0x177a6b,_0x97abab[_0x2821('0x70')],_0x538bb8);_0x436574[_0xc969df](_0x44761e[_0x2821('0x71')],_0x44761e['value'][_0x2821('0x72')],_0x44761e[_0x2821('0x67')][_0x2821('0x20')]);}break;case _0x2821('0x73'):var _0x275071=_0x538bb8[_0x2821('0x67')][_0x2821('0x36')](',')[_0x2821('0x32')](function(_0x5d40de){return Number(_0x5d40de);});_0x275071[_0x2821('0x37')](function(_0x3c114a){_0x132cfb['or'](_0x2821('0x74'),'%,'+_0x3c114a+',%');});_0x21a603=_[_0x2821('0x75')](_0x21a603,_0x275071);break;case _0x2821('0x76'):if(_0x538bb8[_0x2821('0x6a')]==='$substring'){_0x436574[_0xc969df]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x538bb8[_0x2821('0x67')]+'%',null);}else{_0x97abab=_[_0x2821('0x65')](_0xde4a38,[_0x2821('0x30'),_0x2821('0x3f')]);_0x538bb8['field']=_0x2821('0x3f');_0x44761e=as[_0x2821('0x6f')](_0x177a6b,_0x97abab[_0x2821('0x70')],_0x538bb8);_0x436574[_0xc969df](_0x44761e['text'],_0x44761e['value'][_0x2821('0x72')],_0x44761e[_0x2821('0x67')]['end']);}break;case _0x2821('0x77'):_0x44761e=as[_0x2821('0x6f')]('me',null,_0x538bb8);_0x436574[_0xc969df](_0x44761e[_0x2821('0x71')],_0x44761e[_0x2821('0x67')]['start'],_0x44761e[_0x2821('0x67')][_0x2821('0x20')]);break;}}else{var _0x44761e=as[_0x2821('0x6f')](_0x177a6b,_0x97abab['type'],_0x538bb8);_0x436574[_0xc969df](_0x44761e['text'],_0x44761e[_0x2821('0x67')]['start'],_0x44761e[_0x2821('0x67')]['end']);}}}else{var _0x156839=_(_0x5a3e0d['query'])[_0x2821('0x78')]()[_0x2821('0x32')](function(_0x347e08){return _[_0x2821('0x79')](_0xde4a38,[_0x2821('0x30'),_0x347e08])?_0x347e08:undefined;})[_0x2821('0x7a')]()[_0x2821('0x67')]();if(!_['isEmpty'](_0x156839)){_0x156839[_0x2821('0x37')](function(_0x454bee){if(_0x454bee===_0x2821('0x7b')){_0x482c89[_0x2821('0x4f')](_0x2821('0x7c'),[]['concat'](_0x5a3e0d['query'][_0x454bee]));}else if(_0x454bee===_0x2821('0x7d')){var _0x19b2eb=JSON[_0x2821('0x7e')](_0x5a3e0d[_0x2821('0x46')][_0x454bee])[_0x2821('0x7f')];var _0x3b809d=JSON['parse'](_0x5a3e0d[_0x2821('0x46')][_0x454bee])['$lte'];_0x482c89[_0x2821('0x4f')](_0x2821('0x80'),_0x19b2eb,_0x3b809d);}else{if(_0x5a3e0d['query'][_0x454bee]===_0x2821('0x81')){_0x482c89[_0x2821('0x4f')]('i.'+_0x454bee+'\x20IS\x20NULL');}else{_0x482c89[_0x2821('0x4f')]('i.'+_0x454bee+_0x2821('0x82'),_0x5a3e0d[_0x2821('0x46')][_0x454bee]);}}});}if(_0x5a3e0d['query'][_0x2821('0x83')]){if(_0x5a3e0d[_0x2821('0x46')][_0x2821('0x83')]==0x1){_0x482c89[_0x2821('0x68')]('`unreadMessages`\x20=\x200');}else{_0x482c89[_0x2821('0x68')]('`unreadMessages`\x20>\x200');}}if(_0x5a3e0d[_0x2821('0x46')]['tag']){_0x21a603=_['isArray'](_0x5a3e0d[_0x2821('0x46')][_0x2821('0x84')])?_0x5a3e0d['query'][_0x2821('0x84')]:new Array(_0x5a3e0d['query'][_0x2821('0x84')]);_0x21a603[_0x2821('0x37')](function(_0x45a526){_0x132cfb['or'](_0x2821('0x74'),'%,'+_0x45a526+',%');});}if(_0x5a3e0d['query'][_0x2821('0x85')]){var _0x2410cd=_0x5a3e0d[_0x2821('0x46')][_0x2821('0x85')][_0x2821('0x86')]('\x5c','\x5c\x5c')[_0x2821('0x86')](/'/g,'\x27\x27');if(qs[_0x2821('0x87')](_0x2410cd)){_0x436574['or']('i.id\x20LIKE\x20?',_0x2410cd+'%')['or'](_0x2821('0x88'),_0x2410cd+'%');}else{_0x436574['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2821('0x6c')](_0x2410cd))['or'](_0x2821('0x89'),_0x2410cd+'%');}}}_0x482c89[_0x2821('0x4f')](_0x436574);_0x482c89['group']('i.id');var _0x3211bb={'type':db[_0x2821('0x8a')][_0x2821('0x8b')][_0x2821('0x8c')],'raw':!![]};var _0x4bb79f=_0x482c89['clone']();_0x4bb79f[_0x2821('0x50')]('i.id');_0x4bb79f['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x236659['order']){_0x236659['order'][_0x2821('0x37')](function(_0x2c316d){var _0x36ec34=_0x2c316d[0x0]===_0x2821('0x8d')?_0x2c316d[0x0]:'i.'+_0x2c316d[0x0];_0x482c89[_0x2821('0x4d')](_0x36ec34,_0x2c316d[0x1]===_0x2821('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x21a603)){_0x482c89[_0x2821('0x68')](_0x132cfb);_0x4bb79f['where'](_0x2821('0x8f'),_0x21a603);}BPromise['resolve']()['then'](function(){if(!_0x2da025){if(_0x5a3e0d[_0x2821('0x46')]['WhatsappAccountId'])return;_0x4bb79f['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x482c89[_0x2821('0x4f')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5a3e0d['user'][_0x2821('0x90')]!=='agent')return;return _0x5a3e0d[_0x2821('0x91')][_0x2821('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4a6bc0){if(_[_0x2821('0x93')](_0x4a6bc0)){_0x4bb79f[_0x2821('0x4f')](_0x2821('0x94'));_0x482c89[_0x2821('0x4f')](_0x2821('0x94'));}else{_0x4bb79f[_0x2821('0x4f')](_0x2821('0x7c'),_[_0x2821('0x32')](_0x4a6bc0,'id'));_0x482c89['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x4a6bc0,'id'));}});})[_0x2821('0x2c')](function(){if(_0x5a3e0d[_0x2821('0x91')]['role']===_0x2821('0x95')&&!_0x2da025&&!_0x5a3e0d[_0x2821('0x46')][_0x2821('0x7b')])return[];return db[_0x2821('0x96')][_0x2821('0x46')](_0x4bb79f['toString'](),_0x3211bb);})['then'](function(_0xd5a912){_0x234f59['count']=_0xd5a912['length'];if(_0x234f59[_0x2821('0x24')]===0x0)return[];return db[_0x2821('0x96')][_0x2821('0x46')](_0x3f370d[_0x2821('0x97')](),_0x3211bb)['then'](function(_0x86371e){_0x175ef3=_[_0x2821('0x98')](_0x86371e,'id');_0x3211bb=_[_0x2821('0x99')](_0x3211bb,{'model':db[_0x2821('0x42')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5a3e0d[_0x2821('0x46')][_0x2821('0x49')]){_0x236659[_0x2821('0x4a')][_0x2821('0x37')](function(_0x7a5545){_0x482c89[_0x2821('0x50')]('i.'+_0x7a5545);});}else{_0x482c89[_0x2821('0x50')](_0x2821('0x9a'),_0x2821('0x66'));_0x482c89['field'](_0x2821('0x9b'),_0x2821('0x9c'));_0x482c89[_0x2821('0x50')](_0x2821('0x9d'),'Account.mandatoryDisposition');_0x482c89[_0x2821('0x50')]('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');_0x482c89[_0x2821('0x50')]('i.*');_0x482c89['field'](_0x2821('0x9e'),_0x2821('0x9f'));_0x482c89[_0x2821('0x50')](_0x2821('0xa0'),_0x2821('0xa1'));_0x482c89[_0x2821('0x50')](_0x2821('0xa2'),_0x2821('0xa3'));_0x482c89[_0x2821('0x50')](_0x2821('0xa4'),_0x2821('0xa5'));_0x482c89[_0x2821('0x50')]('c.mobile',_0x2821('0xa6'));_0x482c89[_0x2821('0x50')](_0x2821('0xa7'),'Contact.fax');_0x482c89[_0x2821('0x50')](_0x2821('0xa8'),_0x2821('0xa9'));_0x482c89[_0x2821('0x50')](_0x2821('0xaa'),_0x2821('0xab'));_0x482c89[_0x2821('0x50')](_0x2821('0xac'),'TagIds');}if(_0x236659[_0x2821('0x25')])_0x482c89[_0x2821('0x25')](_0x236659['limit']);if(_0x236659['offset'])_0x482c89[_0x2821('0x22')](_0x236659[_0x2821('0x22')]);return db[_0x2821('0x96')][_0x2821('0x46')](_0x482c89[_0x2821('0x97')](),_0x3211bb);})[_0x2821('0x2c')](function(_0x3faff6){if(_0x3faff6['length']>0x0)_0x16283e[_0x2821('0x4f')](_0x2821('0xad'),_[_0x2821('0x32')](_0x3faff6,'id'));return db[_0x2821('0x96')][_0x2821('0x46')](_0x16283e[_0x2821('0x97')](),_0x3211bb)[_0x2821('0x2c')](function(_0x495e1c){var _0x4f174a=_[_0x2821('0xae')](_0x495e1c,_0x2821('0xaf'));var _0x2583d3=[];_0x3faff6[_0x2821('0x37')](function(_0x1baa7f){_0x2583d3[_0x2821('0x38')](updateWhatsappInteraction(_0x1baa7f,_0x175ef3,_0x4f174a));});return BPromise[_0x2821('0xb0')](_0x2583d3);});});})[_0x2821('0x2c')](function(_0x49a34b){_0x234f59[_0x2821('0xb1')]=_0x49a34b;return _0x234f59;})[_0x2821('0x2c')](respondWithFilteredResult(_0x519b11,_0x236659))['catch'](handleError(_0x519b11,null));};exports[_0x2821('0xb2')]=function(_0x4e0ea8,_0x10b631){var _0x548273={'raw':![],'where':{'id':_0x4e0ea8[_0x2821('0xb3')]['id']}},_0x3e5e8c={};_0x3e5e8c[_0x2821('0x45')]=_['keys'](db[_0x2821('0x42')][_0x2821('0xb4')]);_0x3e5e8c[_0x2821('0x46')]=_[_0x2821('0x78')](_0x4e0ea8[_0x2821('0x46')]);_0x3e5e8c['filters']=_[_0x2821('0x48')](_0x3e5e8c[_0x2821('0x45')],_0x3e5e8c['query']);_0x548273[_0x2821('0x4a')]=_[_0x2821('0x48')](_0x3e5e8c[_0x2821('0x45')],qs[_0x2821('0x49')](_0x4e0ea8[_0x2821('0x46')]['fields']));_0x548273[_0x2821('0x4a')]=_0x548273[_0x2821('0x4a')][_0x2821('0x64')]?_0x548273['attributes']:_0x3e5e8c['model'];if(_0x4e0ea8[_0x2821('0x46')]['includeAll']){_0x548273[_0x2821('0xb5')]=[{'all':!![]}];}_0x548273=_[_0x2821('0x99')]({},_0x548273,_0x4e0ea8[_0x2821('0xb6')]);return db[_0x2821('0x42')]['find'](_0x548273)[_0x2821('0x2c')](handleEntityNotFound(_0x10b631,null))['then'](respondWithResult(_0x10b631,null))[_0x2821('0x39')](handleError(_0x10b631,null));};exports[_0x2821('0xb7')]=function(_0x1332ce,_0x354683){return db[_0x2821('0x42')][_0x2821('0xb7')](_0x1332ce[_0x2821('0x77')],{})['then'](respondWithResult(_0x354683,0xc9))[_0x2821('0x39')](handleError(_0x354683,null));};exports[_0x2821('0x2b')]=function(_0x7d56a0,_0x109ab2){if(_0x7d56a0[_0x2821('0x77')]['id']){delete _0x7d56a0['body']['id'];}return db[_0x2821('0x42')][_0x2821('0x65')]({'where':{'id':_0x7d56a0['params']['id']}})[_0x2821('0x2c')](handleEntityNotFound(_0x109ab2,null))[_0x2821('0x2c')](saveUpdates(_0x7d56a0['body'],null))[_0x2821('0x2c')](respondWithResult(_0x109ab2,null))[_0x2821('0x39')](handleError(_0x109ab2,null));};exports[_0x2821('0x2d')]=function(_0x40c8d7,_0x51c467){return db['WhatsappInteraction'][_0x2821('0x65')]({'where':{'id':_0x40c8d7['params']['id']}})[_0x2821('0x2c')](handleEntityNotFound(_0x51c467,null))['then'](removeEntity(_0x51c467,null))[_0x2821('0x39')](handleError(_0x51c467,null));};exports[_0x2821('0xb8')]=function(_0x24eea7,_0x5f0112){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x5f0112,null))['catch'](handleError(_0x5f0112,null));};exports[_0x2821('0xb9')]=function(_0x27e1c6,_0x49ef94,_0x14d4f2){return db[_0x2821('0xba')][_0x2821('0x65')]({'where':{'id':_0x27e1c6[_0x2821('0xb3')]['id']}})['then'](handleEntityNotFound(_0x49ef94,null))['then'](function(_0x4a9cc0){if(_0x4a9cc0){return _0x4a9cc0['addMessage'](_0x27e1c6[_0x2821('0x77')][_0x2821('0xbb')],_[_0x2821('0xbc')](_0x27e1c6[_0x2821('0x77')],[_0x2821('0xbb'),'id'])||{});}})[_0x2821('0x2c')](respondWithResult(_0x49ef94,null))[_0x2821('0x39')](handleError(_0x49ef94,null));};exports[_0x2821('0xbd')]=function(_0x5dbe04,_0x2e1e26,_0x22110a){var _0x3e7176={'raw':![],'where':{}};var _0x102e9f={};var _0x253bb0={'count':0x0,'rows':[]};return db[_0x2821('0x42')][_0x2821('0xbe')]({'where':{'id':_0x5dbe04[_0x2821('0xb3')]['id']}})[_0x2821('0x2c')](handleEntityNotFound(_0x2e1e26,null))['then'](function(_0x37b277){if(_0x37b277){_0x102e9f['model']=_[_0x2821('0x78')](db[_0x2821('0xba')]['rawAttributes']);_0x102e9f[_0x2821('0x46')]=_['keys'](_0x5dbe04[_0x2821('0x46')]);_0x102e9f[_0x2821('0x47')]=_[_0x2821('0x48')](_0x102e9f['model'],_0x102e9f[_0x2821('0x46')]);_0x3e7176['attributes']=_[_0x2821('0x48')](_0x102e9f['model'],qs[_0x2821('0x49')](_0x5dbe04[_0x2821('0x46')]['fields']));_0x3e7176['attributes']=_0x3e7176[_0x2821('0x4a')][_0x2821('0x64')]?_0x3e7176['attributes']:_0x102e9f[_0x2821('0x45')];if(!_0x5dbe04[_0x2821('0x46')][_0x2821('0x4b')](_0x2821('0x4c'))){_0x3e7176[_0x2821('0x25')]=qs[_0x2821('0x25')](_0x5dbe04[_0x2821('0x46')]['limit']);_0x3e7176[_0x2821('0x22')]=qs[_0x2821('0x22')](_0x5dbe04[_0x2821('0x46')][_0x2821('0x22')]);}_0x3e7176['order']=qs[_0x2821('0x4e')](_0x5dbe04[_0x2821('0x46')][_0x2821('0x4e')]);_0x3e7176['where']=qs['filters'](_[_0x2821('0xbf')](_0x5dbe04[_0x2821('0x46')],_0x102e9f[_0x2821('0x47')]));_0x3e7176[_0x2821('0x4f')][_0x2821('0xaf')]=_0x37b277['id'];if(_0x5dbe04['query']['filter']){_0x3e7176[_0x2821('0x4f')]=_[_0x2821('0x99')](_0x3e7176['where'],{'$or':_[_0x2821('0x32')](_0x3e7176['attributes'],function(_0x188892){var _0x2ebc4b={};_0x2ebc4b[_0x188892]={'$like':'%'+_0x5dbe04[_0x2821('0x46')][_0x2821('0x85')]+'%'};return _0x2ebc4b;})});}if(_0x5dbe04[_0x2821('0x46')][_0x2821('0x7f')]){var _0x1557a0=_0x5dbe04['query'][_0x2821('0x7f')][_0x2821('0x36')](',');var _0x2e25fd={};_0x2e25fd[_0x1557a0[0x0]]={'$gte':moment(_0x1557a0[0x1])[_0x2821('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3e7176['where']=_[_0x2821('0x99')](_0x3e7176[_0x2821('0x4f')],_0x2e25fd);}_0x3e7176=_['merge']({},_0x3e7176,_0x5dbe04[_0x2821('0xb6')]);return db[_0x2821('0xba')][_0x2821('0x24')]({'where':_0x3e7176[_0x2821('0x4f')]})['then'](function(_0x301f9e){_0x253bb0[_0x2821('0x24')]=_0x301f9e;if(_0x5dbe04[_0x2821('0x46')][_0x2821('0xc1')]){_0x3e7176['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x2821('0xc2')](_0x3e7176);})[_0x2821('0x2c')](function(_0x35fd65){_0x253bb0[_0x2821('0xb1')]=_0x35fd65;return _0x253bb0;});}})['then'](respondWithFilteredResult(_0x2e1e26,_0x3e7176))['catch'](handleError(_0x2e1e26,null));};exports['addTags']=function(_0x3a08bd,_0x3ca32a,_0x1e9e38){return db[_0x2821('0x42')][_0x2821('0x65')]({'where':{'id':_0x3a08bd[_0x2821('0xb3')]['id']}})[_0x2821('0x2c')](handleEntityNotFound(_0x3ca32a,null))['then'](function(_0x51e444){if(_0x51e444){return _0x51e444['setTags'](_0x3a08bd[_0x2821('0x77')][_0x2821('0xbb')],_['omit'](_0x3a08bd['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0x2821('0xc2')]({'attributes':['id',_0x2821('0x30'),_0x2821('0xc3')],'where':{'id':_0x3a08bd[_0x2821('0x77')][_0x2821('0xbb')]}});})[_0x2821('0x2c')](function(_0x15bf3c){socket['emit'](_0x2821('0xc4'),{'id':Number(_0x3a08bd[_0x2821('0xb3')]['id']),'tags':_0x15bf3c||[]});return{'id':Number(_0x3a08bd[_0x2821('0xb3')]['id']),'tags':_0x15bf3c||[]};});}})[_0x2821('0x2c')](respondWithResult(_0x3ca32a,null))[_0x2821('0x39')](handleError(_0x3ca32a,null));};exports[_0x2821('0xc5')]=function(_0x84e90f,_0x319ef2,_0x1d7001){return db[_0x2821('0x42')][_0x2821('0x65')]({'where':{'id':_0x84e90f[_0x2821('0xb3')]['id']}})[_0x2821('0x2c')](handleEntityNotFound(_0x319ef2,null))[_0x2821('0x2c')](function(_0x422ab9){if(_0x422ab9){return _0x422ab9[_0x2821('0xc5')](_0x84e90f['query']['ids']);}})[_0x2821('0x2c')](respondWithStatusCode(_0x319ef2,null))[_0x2821('0x39')](handleError(_0x319ef2,null));};exports[_0x2821('0xc6')]=function(_0x19f738,_0x1dfda9){var _0x2f0cb8=moment()[_0x2821('0xc7')]()['toString']();var _0x4a14a4=path[_0x2821('0xc8')](config[_0x2821('0xc9')],_0x2821('0xca'),_0x2821('0xcb'),_0x2821('0xcc'));var _0x28365e=path[_0x2821('0xc8')](config['root'],'server',_0x2821('0xcb'),_0x2821('0xcd'));var _0x29d704=path[_0x2821('0xc8')](_0x4a14a4,_0x2f0cb8);var _0x36b1b9=util[_0x2821('0xc0')](_0x2821('0xce'),_0x19f738['params']['id'],_0x2f0cb8);var _0x40f3dd=path[_0x2821('0xc8')](_0x4a14a4,_0x36b1b9);var _0x1568b3=[];_0x1568b3[_0x2821('0x38')]({'model':db[_0x2821('0x76')],'as':_0x2821('0x76'),'attributes':['id',_0x2821('0x33')],'raw':!![]});_0x1568b3['push']({'model':db[_0x2821('0xcf')],'as':_0x2821('0xd0'),'attributes':['id',_0x2821('0xd1'),_0x2821('0xd2')],'raw':!![]});if(_0x19f738[_0x2821('0x46')][_0x2821('0xcd')]){_0x1568b3[_0x2821('0x38')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x4f938d=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x2821('0x77'),_0x2821('0x7d'),_0x2821('0xd3'),_0x2821('0xd4'),_0x2821('0x83')],'include':_0x1568b3}];_0x4f938d['push']({'model':db[_0x2821('0xd5')],'as':_0x2821('0xd6'),'attributes':['id',_0x2821('0x30')]});_0x4f938d[_0x2821('0x38')]({'model':db[_0x2821('0x76')],'as':'Owner','attributes':['id',_0x2821('0x33')]});return db[_0x2821('0x42')]['find']({'where':{'id':_0x19f738[_0x2821('0xb3')]['id']},'include':_0x4f938d})[_0x2821('0x2c')](handleEntityNotFound(_0x1dfda9,null))[_0x2821('0x2c')](function(_0x261c5b){if(_0x261c5b){var _0x554b6b=_0x261c5b['get']({'plain':!![]});fs[_0x2821('0xd7')](_0x29d704);var _0x594c94={'channel':'Whatsapp','account':_0x554b6b[_0x2821('0xd6')][_0x2821('0x30')],'agent':_0x554b6b[_0x2821('0xd8')]?_0x554b6b['Owner']['fullname']:_0x2821('0xd9'),'createdAt':moment(_0x554b6b['createdAt'])['format'](_0x2821('0xda'))[_0x2821('0x97')](),'closedAt':_0x554b6b['closed']?moment(_0x554b6b[_0x2821('0xdb')])[_0x2821('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2821('0x97')]():'','disposition':_0x554b6b[_0x2821('0xdc')],'messages':_(_0x554b6b[_0x2821('0xdd')])[_0x2821('0x85')]({'secret':![]})[_0x2821('0x32')](function(_0x1eea7b){if(_0x1eea7b[_0x2821('0xde')]){var _0x4d8cf2=path[_0x2821('0xc8')](_0x28365e,_0x1eea7b[_0x2821('0xde')][_0x2821('0xdf')]);if(fs[_0x2821('0xe0')](_0x4d8cf2)){fs[_0x2821('0xe1')](_0x4d8cf2)[_0x2821('0xe2')](fs[_0x2821('0xe3')](path['join'](_0x29d704,_0x1eea7b[_0x2821('0xde')][_0x2821('0xdf')])));}}return{'date':moment(_0x1eea7b['createdAt'])['format'](_0x2821('0xda'))['toString'](),'sender':_0x1eea7b['direction']===_0x2821('0xe4')?_0x1eea7b[_0x2821('0x76')]?_0x1eea7b[_0x2821('0x76')]['fullname']:_0x2821('0xe5'):_0x1eea7b['Contact']['firstName']+(_0x1eea7b[_0x2821('0xd0')][_0x2821('0xd2')]?'\x20'+_0x1eea7b[_0x2821('0xd0')][_0x2821('0xd2')]:''),'body':_0x1eea7b[_0x2821('0xde')]?_0x1eea7b[_0x2821('0xde')][_0x2821('0xdf')]:_0x1eea7b['body'],'direction':_0x1eea7b[_0x2821('0xd3')]==='out'?'A':'C','secret':_0x1eea7b[_0x2821('0xd4')],'read':_0x1eea7b[_0x2821('0x83')],'attachment':_0x1eea7b[_0x2821('0xde')]};})[_0x2821('0x67')]()};return ejs[_0x2821('0xe6')](path[_0x2821('0xc8')](config[_0x2821('0xc9')],_0x2821('0xca'),_0x2821('0xe7'),'downloadInteraction.ejs'),{'interaction':_0x594c94})[_0x2821('0x2c')](function(_0x13efb5){var _0x566ca9=path[_0x2821('0xc8')](_0x29d704,_0x2821('0xe8')+_0x554b6b['id']+'-'+_0x2f0cb8+_0x2821('0xe9'));var _0x309071={'path':_0x566ca9,'channel':_0x2821('0xea'),'interactionId':_0x554b6b['id']};return pdf[_0x2821('0xeb')](_0x13efb5,_0x309071);})['then'](function(){return new BPromise(function(_0x5c2a63,_0x219e97){zipdir(_0x29d704,{'saveTo':_0x40f3dd},function(_0x471e45,_0x4d91c9){if(_0x471e45)return _0x219e97(_0x471e45);return _0x5c2a63(_0x4d91c9);});})[_0x2821('0x2c')](function(){return new BPromise(function(_0x4f8614,_0x3dccc1){rimraf(_0x29d704,function(_0x5f21fc){if(_0x5f21fc)_0x3dccc1(_0x5f21fc);return _0x4f8614();});});})[_0x2821('0x2c')](function(){return _0x1dfda9[_0x2821('0xc6')](_0x40f3dd,_0x36b1b9,function(_0x110faa){if(_0x110faa){console[_0x2821('0xec')]('err',_0x110faa);}else{fs['unlinkSync'](_0x40f3dd);}});});});}else{return _0x1dfda9[_0x2821('0x1e')](0xc8);}})[_0x2821('0x39')](handleError(_0x1dfda9,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index de3798c..3546461 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 _0x9879=['../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9879,0x98));var _0x9987=function(_0x52a85c,_0x5747d7){_0x52a85c=_0x52a85c-0x0;var _0x22eb23=_0x9879[_0x52a85c];return _0x22eb23;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x9987('0x0'))['db'][_0x9987('0x1')];var WhatsappMessage=require(_0x9987('0x0'))['db'][_0x9987('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x9987('0x3')](0x0);var events={'afterCreate':_0x9987('0x4'),'afterUpdate':_0x9987('0x5'),'afterDestroy':_0x9987('0x6')};function emitEvent(_0x37ebe8){return function(_0x58c208,_0x271cf0,_0x473510){_0x58c208[_0x9987('0x7')]({'attributes':['id'],'raw':!![]})[_0x9987('0x8')](function(_0x1a3a35){_0x58c208['setDataValue'](_0x9987('0x9'),_0x1a3a35['map'](function(_0x5d04f0){return{'id':_0x5d04f0['id']};}));return WhatsappMessage[_0x9987('0xa')]({'where':{'WhatsappInteractionId':_0x58c208['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x23c008){_0x58c208[_0x9987('0xb')](_0x9987('0xc'),_0x23c008[_0x9987('0xd')]);WhatsappInteractionEvents[_0x9987('0xe')](_0x37ebe8+':'+_0x58c208['id'],_0x58c208);WhatsappInteractionEvents[_0x9987('0xe')](_0x37ebe8,_0x58c208);_0x473510(null);})[_0x9987('0xf')](_0x473510(null));};}for(var e in events){if(events[_0x9987('0x10')](e)){var event=events[e];WhatsappInteraction[_0x9987('0x11')](e,emitEvent(event));}}module[_0x9987('0x12')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x69af=['hasOwnProperty','hook','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','then','setDataValue','findAll','emit','catch'];(function(_0x824dc,_0x1cc70e){var _0xe2e2ba=function(_0x3a29a0){while(--_0x3a29a0){_0x824dc['push'](_0x824dc['shift']());}};_0xe2e2ba(++_0x1cc70e);}(_0x69af,0x17b));var _0xf69a=function(_0x51e060,_0x4f2028){_0x51e060=_0x51e060-0x0;var _0x1d2f29=_0x69af[_0x51e060];return _0x1d2f29;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xf69a('0x0'))['db'][_0xf69a('0x1')];var WhatsappMessage=require(_0xf69a('0x0'))['db'][_0xf69a('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf69a('0x3')](0x0);var events={'afterCreate':_0xf69a('0x4'),'afterUpdate':'update','afterDestroy':_0xf69a('0x5')};function emitEvent(_0x10a24a){return function(_0x297ae0,_0x2820d8,_0x723700){_0x297ae0['getUsers']({'attributes':['id'],'raw':!![]})[_0xf69a('0x6')](function(_0x3669ef){_0x297ae0[_0xf69a('0x7')]('Users',_0x3669ef['map'](function(_0x1f7f03){return{'id':_0x1f7f03['id']};}));return WhatsappMessage[_0xf69a('0x8')]({'where':{'WhatsappInteractionId':_0x297ae0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf69a('0x6')](function(_0x302b3a){_0x297ae0[_0xf69a('0x7')]('unreadMessages',_0x302b3a['length']);WhatsappInteractionEvents['emit'](_0x10a24a+':'+_0x297ae0['id'],_0x297ae0);WhatsappInteractionEvents[_0xf69a('0x9')](_0x10a24a,_0x297ae0);_0x723700(null);})[_0xf69a('0xa')](_0x723700(null));};}for(var e in events){if(events[_0xf69a('0xb')](e)){var event=events[e];WhatsappInteraction[_0xf69a('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 4affcf2..e8fbce1 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 _0xe3bb=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x9b7f0a,_0x20ffbb){var _0x1234ce=function(_0x180ff4){while(--_0x180ff4){_0x9b7f0a['push'](_0x9b7f0a['shift']());}};_0x1234ce(++_0x20ffbb);}(_0xe3bb,0x1c8));var _0xbe3b=function(_0x308e81,_0x217890){_0x308e81=_0x308e81-0x0;var _0x112806=_0xe3bb[_0x308e81];return _0x112806;};'use strict';var _=require(_0xbe3b('0x0'));var util=require(_0xbe3b('0x1'));var logger=require(_0xbe3b('0x2'))(_0xbe3b('0x3'));var moment=require(_0xbe3b('0x4'));var BPromise=require('bluebird');var rp=require(_0xbe3b('0x5'));var fs=require('fs');var path=require(_0xbe3b('0x6'));var rimraf=require(_0xbe3b('0x7'));var config=require(_0xbe3b('0x8'));var attributes=require(_0xbe3b('0x9'));module[_0xbe3b('0xa')]=function(_0x5f0892,_0xe0cafc){return _0x5f0892[_0xbe3b('0xb')]('WhatsappInteraction',attributes,{'tableName':_0xbe3b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d4c37,_0x28651e,_0x199985){if(_0x2d4c37[_0xbe3b('0xd')]('closed')){_0x2d4c37[_0xbe3b('0xe')]=moment()[_0xbe3b('0xf')](_0xbe3b('0x10'));}_0x199985(null,_0x2d4c37);}}});}; \ No newline at end of file +var _0xb39c=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closed'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xb39c,0x136));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xcb39('0x0'));var util=require(_0xcb39('0x1'));var logger=require('../../config/logger')(_0xcb39('0x2'));var moment=require(_0xcb39('0x3'));var BPromise=require(_0xcb39('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb39('0x5'));var config=require(_0xcb39('0x6'));var attributes=require(_0xcb39('0x7'));module[_0xcb39('0x8')]=function(_0xbe8847,_0x2d8231){return _0xbe8847['define'](_0xcb39('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4783c3,_0x409405,_0xee4439){if(_0x4783c3[_0xcb39('0xa')](_0xcb39('0xb'))){_0x4783c3[_0xcb39('0xc')]=moment()['format'](_0xcb39('0xd'));}_0xee4439(null,_0x4783c3);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index da98c05..9b9a18e 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 _0x4a6c=['WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction'];(function(_0x2cbeb8,_0x273343){var _0x241435=function(_0x234dd3){while(--_0x234dd3){_0x2cbeb8['push'](_0x2cbeb8['shift']());}};_0x241435(++_0x273343);}(_0x4a6c,0xeb));var _0xc4a6=function(_0x1a2859,_0x5b49b6){_0x1a2859=_0x1a2859-0x0;var _0x1702d9=_0x4a6c[_0x1a2859];return _0x1702d9;};'use strict';var _=require(_0xc4a6('0x0'));var util=require(_0xc4a6('0x1'));var moment=require(_0xc4a6('0x2'));var BPromise=require(_0xc4a6('0x3'));var rs=require(_0xc4a6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc4a6('0x5'))['db'];var utils=require(_0xc4a6('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc4a6('0x7'));var client=jayson[_0xc4a6('0x8')][_0xc4a6('0x9')]({'port':0x232a});config[_0xc4a6('0xa')]=_[_0xc4a6('0xb')](config['redis'],{'host':_0xc4a6('0xc'),'port':0x18eb});var socket=require(_0xc4a6('0xd'))(new Redis(config[_0xc4a6('0xa')]));require(_0xc4a6('0xe'))[_0xc4a6('0xf')](socket);function respondWithRpcPromise(_0x3d27e8,_0x15ce50,_0x18cffc){return new BPromise(function(_0x26b648,_0x134096){return client[_0xc4a6('0x10')](_0x3d27e8,_0x18cffc)[_0xc4a6('0x11')](function(_0x418831){logger[_0xc4a6('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x15ce50,_0xc4a6('0x13'));logger['debug'](_0xc4a6('0x14'),_0x15ce50,_0xc4a6('0x13'),JSON[_0xc4a6('0x15')](_0x418831));if(_0x418831[_0xc4a6('0x16')]){if(_0x418831[_0xc4a6('0x16')][_0xc4a6('0x17')]===0x1f4){logger[_0xc4a6('0x16')](_0xc4a6('0x18'),_0x15ce50,_0x418831[_0xc4a6('0x16')][_0xc4a6('0x19')]);return _0x134096(_0x418831['error'][_0xc4a6('0x19')]);}logger[_0xc4a6('0x16')]('WhatsappInteraction,\x20%s,\x20%s',_0x15ce50,_0x418831[_0xc4a6('0x16')]['message']);return _0x26b648(_0x418831[_0xc4a6('0x16')][_0xc4a6('0x19')]);}else{logger[_0xc4a6('0x12')](_0xc4a6('0x18'),_0x15ce50,_0xc4a6('0x13'));_0x26b648(_0x418831[_0xc4a6('0x1a')][_0xc4a6('0x19')]);}})[_0xc4a6('0x1b')](function(_0x9b55e7){logger[_0xc4a6('0x16')](_0xc4a6('0x18'),_0x15ce50,_0x9b55e7);_0x134096(_0x9b55e7);});});}exports[_0xc4a6('0x1c')]=function(_0x25da79){var _0x586055=this;return new Promise(function(_0x4afec2,_0x1aede2){return db[_0xc4a6('0x1d')][_0xc4a6('0x1e')](_0x25da79[_0xc4a6('0x1f')],{'raw':_0x25da79[_0xc4a6('0x20')]?_0x25da79[_0xc4a6('0x20')][_0xc4a6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25da79['options']?_0x25da79['options'][_0xc4a6('0x22')]||null:null,'attributes':_0x25da79[_0xc4a6('0x20')]?_0x25da79[_0xc4a6('0x20')][_0xc4a6('0x23')]||null:null,'limit':_0x25da79['options']?_0x25da79['options'][_0xc4a6('0x24')]||null:null})[_0xc4a6('0x11')](function(_0x59cffc){logger[_0xc4a6('0x12')]('UpdateWhatsappInteraction',_0x25da79);logger[_0xc4a6('0x25')](_0xc4a6('0x1c'),_0x25da79,JSON[_0xc4a6('0x15')](_0x59cffc));_0x4afec2(_0x59cffc);})['catch'](function(_0x1ff6a7){logger['error'](_0xc4a6('0x1c'),_0x1ff6a7['message'],_0x25da79);_0x1aede2(_0x586055[_0xc4a6('0x16')](0x1f4,_0x1ff6a7[_0xc4a6('0x19')]));});});};exports[_0xc4a6('0x26')]=function(_0x4fb9f6){return new Promise(function(_0xf1d473,_0x141f91){return db['WhatsappInteraction'][_0xc4a6('0x27')]({'where':_0x4fb9f6[_0xc4a6('0x20')]?_0x4fb9f6[_0xc4a6('0x20')][_0xc4a6('0x22')]||null:null})[_0xc4a6('0x11')](function(_0x445519){if(_0x445519){return _0x445519[_0xc4a6('0x28')](_0x4fb9f6['body'][_0xc4a6('0x29')],_['omit'](_0x4fb9f6['body'],['ids','id'])||{});}})[_0xc4a6('0x2a')](function(_0x558876){logger[_0xc4a6('0x12')](_0xc4a6('0x2b'),_0x4fb9f6);logger[_0xc4a6('0x25')](_0xc4a6('0x2b'),_0x4fb9f6,JSON[_0xc4a6('0x15')](_0x558876));_0xf1d473(_0x558876);})[_0xc4a6('0x1b')](function(_0x363790){logger[_0xc4a6('0x16')]('AddTags',_0x363790[_0xc4a6('0x19')],_0x4fb9f6);_0x141f91(_this[_0xc4a6('0x16')](0x1f4,_0x363790[_0xc4a6('0x19')]));});});}; \ No newline at end of file +var _0xc41a=['./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','update','options','raw','where','attributes','limit','UpdateWhatsappInteraction','debug','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','stringify','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','localhost'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc41a,0xec));var _0xac41=function(_0x1e78f2,_0x32b98d){_0x1e78f2=_0x1e78f2-0x0;var _0x25d631=_0xc41a[_0x1e78f2];return _0x25d631;};'use strict';var _=require(_0xac41('0x0'));var util=require(_0xac41('0x1'));var moment=require(_0xac41('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac41('0x3'))['db'];var utils=require(_0xac41('0x4'));var logger=require('../../config/logger')(_0xac41('0x5'));var config=require(_0xac41('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xac41('0x7')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xac41('0x8')],{'host':_0xac41('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xac41('0xa'))[_0xac41('0xb')](socket);function respondWithRpcPromise(_0x4a63df,_0x15d8cc,_0x2937d9){return new BPromise(function(_0x4b6425,_0x378c55){return client[_0xac41('0xc')](_0x4a63df,_0x2937d9)[_0xac41('0xd')](function(_0x551608){logger[_0xac41('0xe')](_0xac41('0xf'),_0x15d8cc,_0xac41('0x10'));logger['debug'](_0xac41('0x11'),_0x15d8cc,_0xac41('0x10'),JSON['stringify'](_0x551608));if(_0x551608[_0xac41('0x12')]){if(_0x551608[_0xac41('0x12')][_0xac41('0x13')]===0x1f4){logger[_0xac41('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x15d8cc,_0x551608[_0xac41('0x12')][_0xac41('0x14')]);return _0x378c55(_0x551608['error'][_0xac41('0x14')]);}logger[_0xac41('0x12')](_0xac41('0xf'),_0x15d8cc,_0x551608[_0xac41('0x12')][_0xac41('0x14')]);return _0x4b6425(_0x551608[_0xac41('0x12')][_0xac41('0x14')]);}else{logger['info'](_0xac41('0xf'),_0x15d8cc,_0xac41('0x10'));_0x4b6425(_0x551608[_0xac41('0x15')][_0xac41('0x14')]);}})[_0xac41('0x16')](function(_0x2f2c13){logger['error'](_0xac41('0xf'),_0x15d8cc,_0x2f2c13);_0x378c55(_0x2f2c13);});});}exports['UpdateWhatsappInteraction']=function(_0x43fffb){var _0x54b36b=this;return new Promise(function(_0x27ca40,_0x3854ac){return db['WhatsappInteraction'][_0xac41('0x17')](_0x43fffb['body'],{'raw':_0x43fffb[_0xac41('0x18')]?_0x43fffb[_0xac41('0x18')][_0xac41('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43fffb[_0xac41('0x18')]?_0x43fffb[_0xac41('0x18')][_0xac41('0x1a')]||null:null,'attributes':_0x43fffb[_0xac41('0x18')]?_0x43fffb[_0xac41('0x18')][_0xac41('0x1b')]||null:null,'limit':_0x43fffb['options']?_0x43fffb['options'][_0xac41('0x1c')]||null:null})['then'](function(_0x33ff2a){logger[_0xac41('0xe')](_0xac41('0x1d'),_0x43fffb);logger[_0xac41('0x1e')](_0xac41('0x1d'),_0x43fffb,JSON['stringify'](_0x33ff2a));_0x27ca40(_0x33ff2a);})[_0xac41('0x16')](function(_0x317e63){logger['error'](_0xac41('0x1d'),_0x317e63['message'],_0x43fffb);_0x3854ac(_0x54b36b['error'](0x1f4,_0x317e63[_0xac41('0x14')]));});});};exports[_0xac41('0x1f')]=function(_0x48e451){return new Promise(function(_0x2e2082,_0x1d52e3){return db[_0xac41('0x20')][_0xac41('0x21')]({'where':_0x48e451[_0xac41('0x18')]?_0x48e451[_0xac41('0x18')][_0xac41('0x1a')]||null:null})['then'](function(_0x50237f){if(_0x50237f){return _0x50237f[_0xac41('0x22')](_0x48e451[_0xac41('0x23')][_0xac41('0x24')],_[_0xac41('0x25')](_0x48e451[_0xac41('0x23')],[_0xac41('0x24'),'id'])||{});}})[_0xac41('0x26')](function(_0xdf1399){logger[_0xac41('0xe')](_0xac41('0x27'),_0x48e451);logger[_0xac41('0x1e')](_0xac41('0x27'),_0x48e451,JSON[_0xac41('0x28')](_0xdf1399));_0x2e2082(_0xdf1399);})[_0xac41('0x16')](function(_0x9b66ca){logger['error'](_0xac41('0x27'),_0x9b66ca['message'],_0x48e451);_0x1d52e3(_this[_0xac41('0x12')](0x1f4,_0x9b66ca[_0xac41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 829b59e..fd063cb 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 _0x3953=['emit','register','whatsappInteraction:','remove','update'];(function(_0x43dd8b,_0x8343ff){var _0x9ce5a=function(_0x27d590){while(--_0x27d590){_0x43dd8b['push'](_0x43dd8b['shift']());}};_0x9ce5a(++_0x8343ff);}(_0x3953,0x116));var _0x3395=function(_0x35f22e,_0x2c0343){_0x35f22e=_0x35f22e-0x0;var _0x2ab4dd=_0x3953[_0x35f22e];return _0x2ab4dd;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x3395('0x0'),_0x3395('0x1')];function createListener(_0x4d1da5,_0x5afcf3){return function(_0x391a19){_0x5afcf3[_0x3395('0x2')](_0x4d1da5,_0x391a19);};}function removeListener(_0x4eec7c,_0x41f968){return function(){WhatsappInteractionEvents['removeListener'](_0x4eec7c,_0x41f968);};}exports[_0x3395('0x3')]=function(_0x1b1ef8){for(var _0x2a1a9f=0x0,_0x81fef6=events['length'];_0x2a1a9f<_0x81fef6;_0x2a1a9f++){var _0x2eb79a=events[_0x2a1a9f];var _0xad226c=createListener(_0x3395('0x4')+_0x2eb79a,_0x1b1ef8);WhatsappInteractionEvents['on'](_0x2eb79a,_0xad226c);}}; \ No newline at end of file +var _0x645f=['remove','update','emit','register','length','./whatsappInteraction.events','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x645f,0x1ef));var _0xf645=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x645f[_0x122ef9];return _0x42fba0;};'use strict';var WhatsappInteractionEvents=require(_0xf645('0x0'));var events=[_0xf645('0x1'),_0xf645('0x2'),_0xf645('0x3')];function createListener(_0x3a74ee,_0x32bfcf){return function(_0xdedbbc){_0x32bfcf[_0xf645('0x4')](_0x3a74ee,_0xdedbbc);};}function removeListener(_0x2b451e,_0x22025e){return function(){WhatsappInteractionEvents['removeListener'](_0x2b451e,_0x22025e);};}exports[_0xf645('0x5')]=function(_0x5066c4){for(var _0x6b6481=0x0,_0x2f4c36=events[_0xf645('0x6')];_0x6b6481<_0x2f4c36;_0x6b6481++){var _0x5a024a=events[_0x6b6481];var _0x1b922f=createListener('whatsappInteraction:'+_0x5a024a,_0x5066c4);WhatsappInteractionEvents['on'](_0x5a024a,_0x1b922f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index d37c168..9497ef8 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 _0x46b2=['reject','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/reject'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x46b2,0xaa));var _0x246b=function(_0x192db2,_0x29cc89){_0x192db2=_0x192db2-0x0;var _0x2abced=_0x46b2[_0x192db2];return _0x2abced;};'use strict';var multer=require(_0x246b('0x0'));var util=require(_0x246b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x246b('0x2'));var router=express[_0x246b('0x3')]();var fs_extra=require(_0x246b('0x4'));var auth=require(_0x246b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x246b('0x6'));var controller=require(_0x246b('0x7'));router[_0x246b('0x8')]('/',auth[_0x246b('0x9')](),controller['index']);router[_0x246b('0x8')](_0x246b('0xa'),auth['isAuthenticated'](),controller[_0x246b('0xb')]);router[_0x246b('0x8')](_0x246b('0xc'),auth[_0x246b('0x9')](),controller[_0x246b('0xd')]);router[_0x246b('0xe')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x246b('0xf'),_0x246b('0x10')),controller[_0x246b('0x11')]);router[_0x246b('0xe')](_0x246b('0x12'),controller[_0x246b('0x13')]);router[_0x246b('0x14')]('/:id',auth[_0x246b('0x9')](),controller['update']);router[_0x246b('0x14')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x246b('0x14')](_0x246b('0x15'),auth[_0x246b('0x9')](),controller[_0x246b('0x16')]);router['delete'](_0x246b('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x246b('0x17')]=router; \ No newline at end of file +var _0x0f6f=['/:id','post','tracked','whatsappmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x291abc,_0x26d6b4){var _0x336838=function(_0x1f9d95){while(--_0x1f9d95){_0x291abc['push'](_0x291abc['shift']());}};_0x336838(++_0x26d6b4);}(_0x0f6f,0x159));var _0xf0f6=function(_0x53eba7,_0x38744c){_0x53eba7=_0x53eba7-0x0;var _0x32491b=_0x0f6f[_0x53eba7];return _0x32491b;};'use strict';var multer=require('multer');var util=require(_0xf0f6('0x0'));var path=require(_0xf0f6('0x1'));var timeout=require(_0xf0f6('0x2'));var express=require(_0xf0f6('0x3'));var router=express[_0xf0f6('0x4')]();var fs_extra=require(_0xf0f6('0x5'));var auth=require(_0xf0f6('0x6'));var interaction=require(_0xf0f6('0x7'));var config=require(_0xf0f6('0x8'));var controller=require(_0xf0f6('0x9'));router[_0xf0f6('0xa')]('/',auth['isAuthenticated'](),controller[_0xf0f6('0xb')]);router[_0xf0f6('0xa')](_0xf0f6('0xc'),auth[_0xf0f6('0xd')](),controller[_0xf0f6('0xe')]);router[_0xf0f6('0xa')](_0xf0f6('0xf'),auth[_0xf0f6('0xd')](),controller['show']);router[_0xf0f6('0x10')]('/',auth[_0xf0f6('0xd')](),interaction[_0xf0f6('0x11')]('whatsapp',_0xf0f6('0x12')),controller['create']);router[_0xf0f6('0x10')](_0xf0f6('0x13'),controller[_0xf0f6('0x14')]);router[_0xf0f6('0x15')](_0xf0f6('0xf'),auth[_0xf0f6('0xd')](),controller[_0xf0f6('0x16')]);router[_0xf0f6('0x15')](_0xf0f6('0x17'),auth[_0xf0f6('0xd')](),controller[_0xf0f6('0x18')]);router[_0xf0f6('0x15')](_0xf0f6('0x19'),auth['isAuthenticated'](),controller[_0xf0f6('0x1a')]);router[_0xf0f6('0x1b')](_0xf0f6('0xf'),auth[_0xf0f6('0xd')](),controller[_0xf0f6('0x1c')]);module[_0xf0f6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2d65178..9a6fb71 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 _0x6d22=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x1bdbc1,_0x239809){var _0x67d3ff=function(_0x1f0207){while(--_0x1f0207){_0x1bdbc1['push'](_0x1bdbc1['shift']());}};_0x67d3ff(++_0x239809);}(_0x6d22,0x112));var _0x26d2=function(_0x6b90ed,_0x4d06dd){_0x6b90ed=_0x6b90ed-0x0;var _0x4d8f93=_0x6d22[_0x6b90ed];return _0x4d8f93;};'use strict';var Sequelize=require(_0x26d2('0x0'));module[_0x26d2('0x1')]={'body':{'type':Sequelize[_0x26d2('0x2')](_0x26d2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x26d2('0x5')),'defaultValue':_0x26d2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x26d2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x26d2('0x6')]},'readAt':{'type':Sequelize[_0x26d2('0x7')]},'secret':{'type':Sequelize[_0x26d2('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x26d2('0x6')]},'providerResponse':{'type':Sequelize[_0x26d2('0x2')]}}; \ No newline at end of file +var _0x039c=['STRING','DATE','BOOLEAN','exports','TEXT','medium','ENUM','out'];(function(_0x41ddc9,_0x303f3e){var _0x306a21=function(_0x4eabf7){while(--_0x4eabf7){_0x41ddc9['push'](_0x41ddc9['shift']());}};_0x306a21(++_0x303f3e);}(_0x039c,0x15b));var _0xc039=function(_0x2f7734,_0x228546){_0x2f7734=_0x2f7734-0x0;var _0x12ee80=_0x039c[_0x2f7734];return _0x12ee80;};'use strict';var Sequelize=require('sequelize');module[_0xc039('0x0')]={'body':{'type':Sequelize[_0xc039('0x1')](_0xc039('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc039('0x3')]('in','out'),'defaultValue':_0xc039('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc039('0x5')](0xbe)},'phone':{'type':Sequelize[_0xc039('0x5')]},'readAt':{'type':Sequelize[_0xc039('0x6')]},'secret':{'type':Sequelize[_0xc039('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc039('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index c90d646..55f323c 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 _0xc7a6=['readAt','UserId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','user','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','reject','get','WhatsappInteraction','WhatsappInteractionId','interaction','role','User','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','./whatsappMessage.socket','register','jayson/promise','client','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','destroy','stack','name','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','WhatsappMessage','includeAll','findAll','rows','catch','show','params','keys','create','update','body','find','describe','whatsapp-interactions','accept','whatsapp','read'];(function(_0x168bb,_0x120fcf){var _0x21f513=function(_0x10d461){while(--_0x10d461){_0x168bb['push'](_0x168bb['shift']());}};_0x21f513(++_0x120fcf);}(_0xc7a6,0x1ce));var _0x6c7a=function(_0x13b37c,_0x4f616b){_0x13b37c=_0x13b37c-0x0;var _0x2d13fa=_0xc7a6[_0x13b37c];return _0x2d13fa;};'use strict';var emlformat=require(_0x6c7a('0x0'));var rimraf=require(_0x6c7a('0x1'));var zipdir=require(_0x6c7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c7a('0x3'));var moment=require(_0x6c7a('0x4'));var BPromise=require(_0x6c7a('0x5'));var Mustache=require(_0x6c7a('0x6'));var util=require(_0x6c7a('0x7'));var path=require('path');var sox=require(_0x6c7a('0x8'));var csv=require(_0x6c7a('0x9'));var ejs=require(_0x6c7a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6c7a('0xb'));var squel=require(_0x6c7a('0xc'));var crypto=require(_0x6c7a('0xd'));var jsforce=require(_0x6c7a('0xe'));var deskjs=require(_0x6c7a('0xf'));var toCsv=require(_0x6c7a('0x9'));var querystring=require(_0x6c7a('0x10'));var Papa=require(_0x6c7a('0x11'));var Redis=require(_0x6c7a('0x12'));var authService=require(_0x6c7a('0x13'));var qs=require(_0x6c7a('0x14'));var as=require(_0x6c7a('0x15'));var hardwareService=require(_0x6c7a('0x16'));var logger=require(_0x6c7a('0x17'))('api');var utils=require(_0x6c7a('0x18'));var config=require(_0x6c7a('0x19'));var licenseUtil=require(_0x6c7a('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x6c7a('0x1b')](config[_0x6c7a('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6c7a('0x1d'))[_0x6c7a('0x1e')](socket);var jayson=require(_0x6c7a('0x1f'));var client=jayson[_0x6c7a('0x20')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55ae43,_0x3f1b31,_0x1c1033,_0x169eb2){return new BPromise(function(_0x2f1b5b,_0xe8deaf){var _0x897ab1=_0x169eb2||client;return _0x897ab1['request'](_0x55ae43,_0x1c1033)[_0x6c7a('0x21')](function(_0x13ebda){logger[_0x6c7a('0x22')](_0x6c7a('0x23'),_0x3f1b31,_0x6c7a('0x24'));logger[_0x6c7a('0x25')](_0x6c7a('0x26'),_0x3f1b31,_0x6c7a('0x24'),JSON['stringify'](_0x13ebda));if(_0x13ebda[_0x6c7a('0x27')]){if(_0x13ebda['error'][_0x6c7a('0x28')]===0x1f4){logger['error'](_0x6c7a('0x23'),_0x3f1b31,_0x13ebda['error'][_0x6c7a('0x29')]);return _0xe8deaf(_0x13ebda[_0x6c7a('0x27')][_0x6c7a('0x29')]);}logger[_0x6c7a('0x27')](_0x6c7a('0x23'),_0x3f1b31,_0x13ebda[_0x6c7a('0x27')][_0x6c7a('0x29')]);return _0x2f1b5b(_0x13ebda['error'][_0x6c7a('0x29')]);}else{logger['info'](_0x6c7a('0x23'),_0x3f1b31,_0x6c7a('0x24'));_0x2f1b5b(_0x13ebda[_0x6c7a('0x2a')][_0x6c7a('0x29')]);}})['catch'](function(_0x52f646){logger['error'](_0x6c7a('0x23'),_0x3f1b31,_0x52f646);_0xe8deaf(_0x52f646);});});}function respondWithStatusCode(_0x52b1ae,_0x4b4d46){_0x4b4d46=_0x4b4d46||0xcc;return function(_0x517f79){if(_0x517f79){return _0x52b1ae[_0x6c7a('0x2b')](_0x4b4d46);}return _0x52b1ae[_0x6c7a('0x2c')](_0x4b4d46)[_0x6c7a('0x2d')]();};}function respondWithResult(_0x4aa0c6,_0x34d2c7){_0x34d2c7=_0x34d2c7||0xc8;return function(_0x59dfd5){if(_0x59dfd5){return _0x4aa0c6[_0x6c7a('0x2c')](_0x34d2c7)['json'](_0x59dfd5);}};}function respondWithFilteredResult(_0x4c77ba,_0x3a8619){return function(_0x452e8f){if(_0x452e8f){var _0x1cf243=typeof _0x3a8619['offset']==='undefined'&&typeof _0x3a8619[_0x6c7a('0x2e')]===_0x6c7a('0x2f');var _0x16b9b8=_0x452e8f[_0x6c7a('0x30')];var _0x30968b=_0x1cf243?0x0:_0x3a8619[_0x6c7a('0x31')];var _0x3a057c=_0x1cf243?_0x452e8f[_0x6c7a('0x30')]:_0x3a8619[_0x6c7a('0x31')]+_0x3a8619[_0x6c7a('0x2e')];var _0x2b236d;if(_0x3a057c>=_0x16b9b8){_0x3a057c=_0x16b9b8;_0x2b236d=0xc8;}else{_0x2b236d=0xce;}_0x4c77ba['status'](_0x2b236d);return _0x4c77ba[_0x6c7a('0x32')](_0x6c7a('0x33'),_0x30968b+'-'+_0x3a057c+'/'+_0x16b9b8)[_0x6c7a('0x34')](_0x452e8f);}return null;};}function patchUpdates(_0x2efcad){return function(_0x4048f8){try{jsonpatch[_0x6c7a('0x35')](_0x4048f8,_0x2efcad,!![]);}catch(_0x95b6bd){return BPromise['reject'](_0x95b6bd);}return _0x4048f8['save']();};}function saveUpdates(_0x31b83e,_0x3d8afc){return function(_0x5323f3){if(_0x5323f3){return _0x5323f3['update'](_0x31b83e)[_0x6c7a('0x21')](function(_0x57b78a){return _0x57b78a;});}return null;};}function removeEntity(_0x3566bf,_0x21424e){return function(_0x1780d1){if(_0x1780d1){return _0x1780d1[_0x6c7a('0x36')]()['then'](function(){_0x3566bf[_0x6c7a('0x2c')](0xcc)[_0x6c7a('0x2d')]();});}};}function handleEntityNotFound(_0x1edffd,_0x57ef5a){return function(_0xba0b92){if(!_0xba0b92){_0x1edffd[_0x6c7a('0x2b')](0x194);}return _0xba0b92;};}function handleError(_0xbe01a5,_0x305156){_0x305156=_0x305156||0x1f4;return function(_0x4687a5){logger[_0x6c7a('0x27')](_0x4687a5[_0x6c7a('0x37')]);if(_0x4687a5[_0x6c7a('0x38')]){delete _0x4687a5[_0x6c7a('0x38')];}_0xbe01a5[_0x6c7a('0x2c')](_0x305156)['send'](_0x4687a5);};}exports[_0x6c7a('0x39')]=function(_0x239471,_0x2224fb){var _0xae1c2a={},_0x11e78c={},_0x5ec679={'count':0x0,'rows':[]};var _0x5c11b1=_[_0x6c7a('0x3a')](db['WhatsappMessage'][_0x6c7a('0x3b')],function(_0x5592c9){return{'name':_0x5592c9['fieldName'],'type':_0x5592c9[_0x6c7a('0x3c')][_0x6c7a('0x3d')]};});_0x11e78c[_0x6c7a('0x3e')]=_['map'](_0x5c11b1,_0x6c7a('0x38'));_0x11e78c[_0x6c7a('0x3f')]=_['keys'](_0x239471['query']);_0x11e78c[_0x6c7a('0x40')]=_[_0x6c7a('0x41')](_0x11e78c[_0x6c7a('0x3e')],_0x11e78c[_0x6c7a('0x3f')]);_0xae1c2a['attributes']=_[_0x6c7a('0x41')](_0x11e78c[_0x6c7a('0x3e')],qs[_0x6c7a('0x42')](_0x239471[_0x6c7a('0x3f')][_0x6c7a('0x42')]));_0xae1c2a[_0x6c7a('0x43')]=_0xae1c2a[_0x6c7a('0x43')][_0x6c7a('0x44')]?_0xae1c2a[_0x6c7a('0x43')]:_0x11e78c[_0x6c7a('0x3e')];if(!_0x239471[_0x6c7a('0x3f')][_0x6c7a('0x45')](_0x6c7a('0x46'))){_0xae1c2a[_0x6c7a('0x2e')]=qs[_0x6c7a('0x2e')](_0x239471[_0x6c7a('0x3f')][_0x6c7a('0x2e')]);_0xae1c2a['offset']=qs['offset'](_0x239471[_0x6c7a('0x3f')][_0x6c7a('0x31')]);}_0xae1c2a['order']=qs[_0x6c7a('0x47')](_0x239471['query']['sort']);_0xae1c2a[_0x6c7a('0x48')]=qs[_0x6c7a('0x40')](_[_0x6c7a('0x49')](_0x239471[_0x6c7a('0x3f')],_0x11e78c[_0x6c7a('0x40')]),_0x5c11b1);if(_0x239471['query']['filter']){_0xae1c2a[_0x6c7a('0x48')]=_[_0x6c7a('0x4a')](_0xae1c2a[_0x6c7a('0x48')],{'$or':_[_0x6c7a('0x3a')](_0x5c11b1,function(_0x121797){if(_0x121797[_0x6c7a('0x3c')]!==_0x6c7a('0x4b')){var _0x508ee1={};_0x508ee1[_0x121797[_0x6c7a('0x38')]]={'$like':'%'+_0x239471[_0x6c7a('0x3f')]['filter']+'%'};return _0x508ee1;}})});}_0xae1c2a=_[_0x6c7a('0x4a')]({},_0xae1c2a,_0x239471[_0x6c7a('0x4c')]);var _0x2651a4={'where':_0xae1c2a[_0x6c7a('0x48')]};return db[_0x6c7a('0x4d')][_0x6c7a('0x30')](_0x2651a4)['then'](function(_0x3ad5fc){_0x5ec679[_0x6c7a('0x30')]=_0x3ad5fc;if(_0x239471[_0x6c7a('0x3f')][_0x6c7a('0x4e')]){_0xae1c2a['include']=[{'all':!![]}];}return db[_0x6c7a('0x4d')][_0x6c7a('0x4f')](_0xae1c2a);})['then'](function(_0x5d9b4d){_0x5ec679[_0x6c7a('0x50')]=_0x5d9b4d;return _0x5ec679;})['then'](respondWithFilteredResult(_0x2224fb,_0xae1c2a))[_0x6c7a('0x51')](handleError(_0x2224fb,null));};exports[_0x6c7a('0x52')]=function(_0x42e126,_0x36a7e8){var _0x3c17d2={'raw':!![],'where':{'id':_0x42e126[_0x6c7a('0x53')]['id']}},_0x33f981={};_0x33f981['model']=_[_0x6c7a('0x54')](db[_0x6c7a('0x4d')][_0x6c7a('0x3b')]);_0x33f981[_0x6c7a('0x3f')]=_['keys'](_0x42e126[_0x6c7a('0x3f')]);_0x33f981[_0x6c7a('0x40')]=_[_0x6c7a('0x41')](_0x33f981[_0x6c7a('0x3e')],_0x33f981[_0x6c7a('0x3f')]);_0x3c17d2[_0x6c7a('0x43')]=_[_0x6c7a('0x41')](_0x33f981['model'],qs['fields'](_0x42e126[_0x6c7a('0x3f')][_0x6c7a('0x42')]));_0x3c17d2[_0x6c7a('0x43')]=_0x3c17d2[_0x6c7a('0x43')][_0x6c7a('0x44')]?_0x3c17d2['attributes']:_0x33f981['model'];if(_0x42e126[_0x6c7a('0x3f')][_0x6c7a('0x4e')]){_0x3c17d2['include']=[{'all':!![]}];}_0x3c17d2=_[_0x6c7a('0x4a')]({},_0x3c17d2,_0x42e126[_0x6c7a('0x4c')]);return db[_0x6c7a('0x4d')]['find'](_0x3c17d2)[_0x6c7a('0x21')](handleEntityNotFound(_0x36a7e8,null))[_0x6c7a('0x21')](respondWithResult(_0x36a7e8,null))[_0x6c7a('0x51')](handleError(_0x36a7e8,null));};exports[_0x6c7a('0x55')]=function(_0x12aa1f,_0x44c61e){return db[_0x6c7a('0x4d')][_0x6c7a('0x55')](_0x12aa1f['body'],{})[_0x6c7a('0x21')](respondWithResult(_0x44c61e,0xc9))[_0x6c7a('0x51')](handleError(_0x44c61e,null));};exports[_0x6c7a('0x56')]=function(_0x309dd1,_0x52ac65){if(_0x309dd1[_0x6c7a('0x57')]['id']){delete _0x309dd1[_0x6c7a('0x57')]['id'];}return db['WhatsappMessage'][_0x6c7a('0x58')]({'where':{'id':_0x309dd1[_0x6c7a('0x53')]['id']}})[_0x6c7a('0x21')](handleEntityNotFound(_0x52ac65,null))['then'](saveUpdates(_0x309dd1[_0x6c7a('0x57')],null))[_0x6c7a('0x21')](respondWithResult(_0x52ac65,null))[_0x6c7a('0x51')](handleError(_0x52ac65,null));};exports[_0x6c7a('0x36')]=function(_0x58786f,_0x2e5d26){return db[_0x6c7a('0x4d')][_0x6c7a('0x58')]({'where':{'id':_0x58786f['params']['id']}})[_0x6c7a('0x21')](handleEntityNotFound(_0x2e5d26,null))[_0x6c7a('0x21')](removeEntity(_0x2e5d26,null))[_0x6c7a('0x51')](handleError(_0x2e5d26,null));};exports[_0x6c7a('0x59')]=function(_0x3c16d4,_0x13ae60){return db['WhatsappMessage'][_0x6c7a('0x59')]()[_0x6c7a('0x21')](respondWithResult(_0x13ae60,null))[_0x6c7a('0x51')](handleError(_0x13ae60,null));};var interaction_log=require(_0x6c7a('0x17'))(_0x6c7a('0x5a'));exports[_0x6c7a('0x5b')]=function(_0x375bbb,_0x1d977,_0x33b9dc){var _0x250215={'agent':{},'channel':_0x6c7a('0x5c')};if(_0x375bbb[_0x6c7a('0x57')]['id']){delete _0x375bbb[_0x6c7a('0x57')]['id'];}_0x375bbb[_0x6c7a('0x57')][_0x6c7a('0x5d')]=!![];_0x375bbb[_0x6c7a('0x57')][_0x6c7a('0x5e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x375bbb['body'][_0x6c7a('0x5f')]=_0x375bbb[_0x6c7a('0x57')][_0x6c7a('0x5f')]||_0x375bbb['user']['id'];_0x250215['agent']['id']=_0x375bbb['body'][_0x6c7a('0x5f')];return db[_0x6c7a('0x4d')][_0x6c7a('0x58')]({'where':{'id':_0x375bbb[_0x6c7a('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d977,null))[_0x6c7a('0x21')](saveUpdates(_0x375bbb[_0x6c7a('0x57')],null))['then'](function(_0x6eaaff){if(_0x6eaaff){_0x250215['message']=_0x6eaaff['get']({'plain':!![]});return db['WhatsappInteraction'][_0x6c7a('0x58')]({'where':{'id':_0x6eaaff['WhatsappInteractionId']}});}return null;})[_0x6c7a('0x21')](handleEntityNotFound(_0x1d977,null))[_0x6c7a('0x21')](function(_0x3101f9){if(_0x3101f9){return _0x3101f9['update']({'UserId':_0x375bbb['body'][_0x6c7a('0x5f')],'read1stAt':_[_0x6c7a('0x60')](_0x3101f9[_0x6c7a('0x61')])?moment()[_0x6c7a('0x62')](_0x6c7a('0x63')):undefined});}return null;})[_0x6c7a('0x21')](function(_0xa2ce9d){if(_0xa2ce9d){_0x250215['interaction']=_0xa2ce9d['get']({'plain':!![]});interaction_log[_0x6c7a('0x22')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x375bbb[_0x6c7a('0x64')]['id'],_0x375bbb[_0x6c7a('0x64')][_0x6c7a('0x38')],_0x375bbb[_0x6c7a('0x64')]['role'],_0x250215['interaction']['id'],_0x375bbb[_0x6c7a('0x57')]?JSON[_0x6c7a('0x65')](_0x375bbb[_0x6c7a('0x57')]):_0x6c7a('0x66'));return respondWithRpcPromise(_0x6c7a('0x67'),_0x6c7a('0x68'),_0x250215);}return null;})[_0x6c7a('0x21')](function(_0x3b16d3){var _0x190e45=_0x6c7a('0x69')+_0x3b16d3[_0x6c7a('0x29')][_0x6c7a('0x6a')];return db['sequelize'][_0x6c7a('0x3f')](_0x190e45,{'type':db[_0x6c7a('0x6b')][_0x6c7a('0x6c')][_0x6c7a('0x6d')],'raw':!![]})[_0x6c7a('0x21')](function(_0x131c9e){return _0x131c9e;});})['then'](function(_0x2a3b06){if(_0x2a3b06){_0x250215['message'][_0x6c7a('0x6e')]=_0x2a3b06[0x0];if(!_0x375bbb[_0x6c7a('0x57')]['UserId'])return;return db['User'][_0x6c7a('0x58')]({'where':{'id':_0x375bbb[_0x6c7a('0x57')]['UserId'],'role':_0x6c7a('0x6f')},'attributes':['id',_0x6c7a('0x38'),_0x6c7a('0x70'),_0x6c7a('0x71'),_0x6c7a('0x72')],'raw':!![]});}return null;})['then'](function(_0x2806a5){if(!_0x2806a5)return null;_0x250215[_0x6c7a('0x29')][_0x6c7a('0x6f')]=_0x2806a5;return _0x250215;})[_0x6c7a('0x21')](function(_0x335304){if(_0x335304){if(_0x375bbb[_0x6c7a('0x57')][_0x6c7a('0x73')]){_0x250215[_0x6c7a('0x29')][_0x6c7a('0x74')]=util['format'](_0x6c7a('0x75'),_0x375bbb['user']['name']);_0x250215[_0x6c7a('0x29')]['channel']=_0x250215[_0x6c7a('0x76')];_0x250215[_0x6c7a('0x29')][_0x6c7a('0x77')]=_0x250215['channel'];_0x250215[_0x6c7a('0x29')][_0x6c7a('0x78')]=_0x6c7a('0x5b');return respondWithRpcPromise(_0x6c7a('0x79'),_0x6c7a('0x79'),{'event':'acceptmessage','message':_0x250215[_0x6c7a('0x29')]},client9002)['then'](function(){return _0x250215;});}return _0x250215;}return null;})[_0x6c7a('0x21')](respondWithResult(_0x1d977,null))[_0x6c7a('0x51')](handleError(_0x1d977,null));};var interaction_log=require('../../config/logger')(_0x6c7a('0x5a'));exports[_0x6c7a('0x7a')]=function(_0x51429f,_0xcde715,_0x53c0b2){var _0x537075={'agent':{},'channel':_0x6c7a('0x5c')};if(_0x51429f['body']['id']){delete _0x51429f[_0x6c7a('0x57')]['id'];}_0x51429f['body'][_0x6c7a('0x5f')]=_0x51429f[_0x6c7a('0x57')][_0x6c7a('0x5f')]||_0x51429f['user']['id'];_0x537075[_0x6c7a('0x6f')]['id']=_0x51429f['body'][_0x6c7a('0x5f')];return db[_0x6c7a('0x4d')]['find']({'where':{'id':_0x51429f[_0x6c7a('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xcde715,null))['then'](function(_0x3b327f){if(_0x3b327f){_0x537075[_0x6c7a('0x29')]=_0x3b327f[_0x6c7a('0x7b')]({'plain':!![]});return db[_0x6c7a('0x7c')][_0x6c7a('0x58')]({'where':{'id':_0x3b327f[_0x6c7a('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0xcde715,null))['then'](function(_0x314aa9){if(_0x314aa9){_0x537075[_0x6c7a('0x7e')]=_0x314aa9[_0x6c7a('0x7b')]({'plain':!![]});interaction_log[_0x6c7a('0x22')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51429f[_0x6c7a('0x64')]['id'],_0x51429f[_0x6c7a('0x64')][_0x6c7a('0x38')],_0x51429f['user'][_0x6c7a('0x7f')],_0x537075[_0x6c7a('0x7e')]['id'],_0x51429f[_0x6c7a('0x57')]?JSON[_0x6c7a('0x65')](_0x51429f[_0x6c7a('0x57')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x537075);}return null;})['then'](function(_0x6d09e8){var _0x502339=_0x6c7a('0x69')+_0x6d09e8[_0x6c7a('0x29')][_0x6c7a('0x6a')];return db['sequelize'][_0x6c7a('0x3f')](_0x502339,{'type':db[_0x6c7a('0x6b')][_0x6c7a('0x6c')][_0x6c7a('0x6d')],'raw':!![]})[_0x6c7a('0x21')](function(_0x4ff550){return _0x4ff550;});})[_0x6c7a('0x21')](function(_0x3f228d){if(_0x3f228d){_0x537075[_0x6c7a('0x29')]['contact']=_0x3f228d[0x0];if(!_0x51429f['body'][_0x6c7a('0x5f')])return;return db[_0x6c7a('0x80')][_0x6c7a('0x58')]({'where':{'id':_0x51429f[_0x6c7a('0x57')]['UserId'],'role':_0x6c7a('0x6f')},'attributes':['id',_0x6c7a('0x38'),_0x6c7a('0x70'),'email',_0x6c7a('0x72')],'raw':!![]});}return null;})[_0x6c7a('0x21')](function(_0x1f8294){if(!_0x1f8294)return null;_0x537075[_0x6c7a('0x29')][_0x6c7a('0x6f')]=_0x1f8294;return _0x537075;})[_0x6c7a('0x21')](function(_0x1711d0){if(_0x1711d0){_0x1711d0[_0x6c7a('0x29')][_0x6c7a('0x74')]=util['format']('SIP/%s',_0x51429f[_0x6c7a('0x64')]['name']);_0x1711d0[_0x6c7a('0x29')]['channel']=_0x537075[_0x6c7a('0x76')];_0x1711d0[_0x6c7a('0x29')][_0x6c7a('0x77')]=_0x537075[_0x6c7a('0x76')];_0x1711d0['message'][_0x6c7a('0x78')]=_0x6c7a('0x7a');respondWithRpcPromise(_0x6c7a('0x79'),_0x6c7a('0x79'),{'event':_0x6c7a('0x81'),'message':_0x1711d0[_0x6c7a('0x29')]},client9002);return _0x537075;}return null;})['then'](respondWithResult(_0xcde715,null))['catch'](handleError(_0xcde715,null));};exports[_0x6c7a('0x2c')]=function(_0x31b625,_0x3a9f8,_0x649a6f){if(_0x31b625['body']['id']){delete _0x31b625[_0x6c7a('0x57')]['id'];}var _0x46ad15;return db['WhatsappMessage']['find']({'where':{'id':_0x31b625['params']['id']}})[_0x6c7a('0x21')](handleEntityNotFound(_0x3a9f8,null))['then'](function(_0x5dd9e3){if(_0x5dd9e3){_0x46ad15=_0x5dd9e3;return db[_0x6c7a('0x82')][_0x6c7a('0x58')]({'where':{'id':_0x5dd9e3[_0x6c7a('0x83')]}});}})[_0x6c7a('0x21')](handleEntityNotFound(_0x3a9f8,null))[_0x6c7a('0x21')](function(_0x4fadaf){if(_0x4fadaf){logger[_0x6c7a('0x25')](_0x6c7a('0x84'),_0x6c7a('0x2c'),_0x6c7a('0x85'),_0x4fadaf[_0x6c7a('0x3c')],util['inspect'](_0x31b625[_0x6c7a('0x57')],{'showHidden':![],'depth':null}));switch(_0x4fadaf[_0x6c7a('0x3c')]){case _0x6c7a('0x86'):if(_0x31b625['body'][_0x6c7a('0x87')]&&_0x31b625['body']['MessageSid']===_0x46ad15[_0x6c7a('0x88')]&&_0x31b625[_0x6c7a('0x57')]['MessageStatus']&&_0x31b625[_0x6c7a('0x57')]['MessageStatus']===_0x6c7a('0x5d')){return _0x46ad15[_0x6c7a('0x56')]({'read':!![]});}else{logger[_0x6c7a('0x27')](_0x6c7a('0x89'),'status',_0x6c7a('0x86'),util[_0x6c7a('0x8a')](_0x31b625[_0x6c7a('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x46ad15;}})['then'](respondWithResult(_0x3a9f8,null))[_0x6c7a('0x51')](handleError(_0x3a9f8,null));}; \ No newline at end of file +var _0x97e1=['null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','manual','interface','channel','motionChannel','EventManager','acceptmessage','whatsapp-interactions','whatsapp','WhatsappInteractionId','RejectMessage','rejectMessage','contact','internal','SIP/%s','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','show','find','body','params','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteraction','isNil','read1stAt','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x2a14a5,_0x3783ff){var _0x4d4da6=function(_0x19fd04){while(--_0x19fd04){_0x2a14a5['push'](_0x2a14a5['shift']());}};_0x4d4da6(++_0x3783ff);}(_0x97e1,0xa7));var _0x197e=function(_0x1d5ba8,_0x412a52){_0x1d5ba8=_0x1d5ba8-0x0;var _0x1022a2=_0x97e1[_0x1d5ba8];return _0x1022a2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x197e('0x0'));var zipdir=require(_0x197e('0x1'));var jsonpatch=require(_0x197e('0x2'));var rp=require(_0x197e('0x3'));var moment=require(_0x197e('0x4'));var BPromise=require(_0x197e('0x5'));var Mustache=require('mustache');var util=require(_0x197e('0x6'));var path=require(_0x197e('0x7'));var sox=require(_0x197e('0x8'));var csv=require(_0x197e('0x9'));var ejs=require(_0x197e('0xa'));var fs=require('fs');var fs_extra=require(_0x197e('0xb'));var _=require(_0x197e('0xc'));var squel=require('squel');var crypto=require(_0x197e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197e('0x9'));var querystring=require('querystring');var Papa=require(_0x197e('0xe'));var Redis=require(_0x197e('0xf'));var authService=require(_0x197e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x197e('0x11'));var hardwareService=require(_0x197e('0x12'));var logger=require(_0x197e('0x13'))(_0x197e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x197e('0x15'));var db=require(_0x197e('0x16'))['db'];config[_0x197e('0x17')]=_['defaults'](config[_0x197e('0x17')],{'host':_0x197e('0x18'),'port':0x18eb});var socket=require(_0x197e('0x19'))(new Redis(config[_0x197e('0x17')]));require(_0x197e('0x1a'))[_0x197e('0x1b')](socket);var jayson=require(_0x197e('0x1c'));var client=jayson[_0x197e('0x1d')][_0x197e('0x1e')]({'port':0x232c});var client9002=jayson[_0x197e('0x1d')][_0x197e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xbff039,_0x578a4e,_0x2504ec,_0x31e0ee){return new BPromise(function(_0x2603ac,_0x245d12){var _0x587bca=_0x31e0ee||client;return _0x587bca[_0x197e('0x1f')](_0xbff039,_0x2504ec)['then'](function(_0x1524f7){logger['info'](_0x197e('0x20'),_0x578a4e,'request\x20sent');logger[_0x197e('0x21')](_0x197e('0x22'),_0x578a4e,_0x197e('0x23'),JSON[_0x197e('0x24')](_0x1524f7));if(_0x1524f7[_0x197e('0x25')]){if(_0x1524f7[_0x197e('0x25')][_0x197e('0x26')]===0x1f4){logger[_0x197e('0x25')](_0x197e('0x20'),_0x578a4e,_0x1524f7[_0x197e('0x25')][_0x197e('0x27')]);return _0x245d12(_0x1524f7['error']['message']);}logger[_0x197e('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x578a4e,_0x1524f7['error']['message']);return _0x2603ac(_0x1524f7[_0x197e('0x25')]['message']);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x578a4e,_0x197e('0x23'));_0x2603ac(_0x1524f7[_0x197e('0x28')][_0x197e('0x27')]);}})[_0x197e('0x29')](function(_0x279feb){logger[_0x197e('0x25')](_0x197e('0x20'),_0x578a4e,_0x279feb);_0x245d12(_0x279feb);});});}function respondWithStatusCode(_0x4faac4,_0x469ba5){_0x469ba5=_0x469ba5||0xcc;return function(_0x25d800){if(_0x25d800){return _0x4faac4[_0x197e('0x2a')](_0x469ba5);}return _0x4faac4[_0x197e('0x2b')](_0x469ba5)[_0x197e('0x2c')]();};}function respondWithResult(_0xd96c14,_0x459e3d){_0x459e3d=_0x459e3d||0xc8;return function(_0x92b5fe){if(_0x92b5fe){return _0xd96c14[_0x197e('0x2b')](_0x459e3d)[_0x197e('0x2d')](_0x92b5fe);}};}function respondWithFilteredResult(_0x2a1ab6,_0x2eb6ee){return function(_0xf0dad5){if(_0xf0dad5){var _0x4b5cdb=typeof _0x2eb6ee[_0x197e('0x2e')]===_0x197e('0x2f')&&typeof _0x2eb6ee['limit']==='undefined';var _0x1ef64b=_0xf0dad5['count'];var _0x2d880e=_0x4b5cdb?0x0:_0x2eb6ee[_0x197e('0x2e')];var _0x551467=_0x4b5cdb?_0xf0dad5[_0x197e('0x30')]:_0x2eb6ee[_0x197e('0x2e')]+_0x2eb6ee[_0x197e('0x31')];var _0x328e80;if(_0x551467>=_0x1ef64b){_0x551467=_0x1ef64b;_0x328e80=0xc8;}else{_0x328e80=0xce;}_0x2a1ab6[_0x197e('0x2b')](_0x328e80);return _0x2a1ab6['set'](_0x197e('0x32'),_0x2d880e+'-'+_0x551467+'/'+_0x1ef64b)[_0x197e('0x2d')](_0xf0dad5);}return null;};}function patchUpdates(_0xba9d35){return function(_0x4c76f0){try{jsonpatch['apply'](_0x4c76f0,_0xba9d35,!![]);}catch(_0x9ae7d9){return BPromise[_0x197e('0x33')](_0x9ae7d9);}return _0x4c76f0[_0x197e('0x34')]();};}function saveUpdates(_0x3b0f99,_0x2a140d){return function(_0x38d006){if(_0x38d006){return _0x38d006[_0x197e('0x35')](_0x3b0f99)[_0x197e('0x36')](function(_0x28b3b5){return _0x28b3b5;});}return null;};}function removeEntity(_0x121014,_0x4640c5){return function(_0x298ea8){if(_0x298ea8){return _0x298ea8[_0x197e('0x37')]()['then'](function(){_0x121014[_0x197e('0x2b')](0xcc)[_0x197e('0x2c')]();});}};}function handleEntityNotFound(_0x1a27c8,_0x142255){return function(_0x40a21d){if(!_0x40a21d){_0x1a27c8[_0x197e('0x2a')](0x194);}return _0x40a21d;};}function handleError(_0x328f26,_0x3bdab8){_0x3bdab8=_0x3bdab8||0x1f4;return function(_0x4ae901){logger[_0x197e('0x25')](_0x4ae901['stack']);if(_0x4ae901['name']){delete _0x4ae901[_0x197e('0x38')];}_0x328f26[_0x197e('0x2b')](_0x3bdab8)[_0x197e('0x39')](_0x4ae901);};}exports[_0x197e('0x3a')]=function(_0x221b81,_0x330825){var _0x3af8c4={},_0x448356={},_0x54d617={'count':0x0,'rows':[]};var _0x30cad4=_[_0x197e('0x3b')](db[_0x197e('0x3c')][_0x197e('0x3d')],function(_0x1aa093){return{'name':_0x1aa093[_0x197e('0x3e')],'type':_0x1aa093[_0x197e('0x3f')]['key']};});_0x448356[_0x197e('0x40')]=_['map'](_0x30cad4,_0x197e('0x38'));_0x448356[_0x197e('0x41')]=_[_0x197e('0x42')](_0x221b81[_0x197e('0x41')]);_0x448356[_0x197e('0x43')]=_[_0x197e('0x44')](_0x448356[_0x197e('0x40')],_0x448356[_0x197e('0x41')]);_0x3af8c4['attributes']=_['intersection'](_0x448356['model'],qs['fields'](_0x221b81[_0x197e('0x41')][_0x197e('0x45')]));_0x3af8c4[_0x197e('0x46')]=_0x3af8c4[_0x197e('0x46')][_0x197e('0x47')]?_0x3af8c4[_0x197e('0x46')]:_0x448356['model'];if(!_0x221b81['query']['hasOwnProperty'](_0x197e('0x48'))){_0x3af8c4[_0x197e('0x31')]=qs[_0x197e('0x31')](_0x221b81['query'][_0x197e('0x31')]);_0x3af8c4['offset']=qs[_0x197e('0x2e')](_0x221b81[_0x197e('0x41')][_0x197e('0x2e')]);}_0x3af8c4[_0x197e('0x49')]=qs[_0x197e('0x4a')](_0x221b81[_0x197e('0x41')]['sort']);_0x3af8c4['where']=qs[_0x197e('0x43')](_[_0x197e('0x4b')](_0x221b81[_0x197e('0x41')],_0x448356[_0x197e('0x43')]),_0x30cad4);if(_0x221b81[_0x197e('0x41')][_0x197e('0x4c')]){_0x3af8c4[_0x197e('0x4d')]=_[_0x197e('0x4e')](_0x3af8c4['where'],{'$or':_[_0x197e('0x3b')](_0x30cad4,function(_0x3a7952){if(_0x3a7952[_0x197e('0x3f')]!=='VIRTUAL'){var _0x357fb4={};_0x357fb4[_0x3a7952['name']]={'$like':'%'+_0x221b81['query'][_0x197e('0x4c')]+'%'};return _0x357fb4;}})});}_0x3af8c4=_[_0x197e('0x4e')]({},_0x3af8c4,_0x221b81[_0x197e('0x4f')]);var _0x2c411e={'where':_0x3af8c4[_0x197e('0x4d')]};return db['WhatsappMessage'][_0x197e('0x30')](_0x2c411e)[_0x197e('0x36')](function(_0x588a0b){_0x54d617[_0x197e('0x30')]=_0x588a0b;if(_0x221b81[_0x197e('0x41')][_0x197e('0x50')]){_0x3af8c4[_0x197e('0x51')]=[{'all':!![]}];}return db[_0x197e('0x3c')]['findAll'](_0x3af8c4);})['then'](function(_0x51986a){_0x54d617[_0x197e('0x52')]=_0x51986a;return _0x54d617;})[_0x197e('0x36')](respondWithFilteredResult(_0x330825,_0x3af8c4))['catch'](handleError(_0x330825,null));};exports[_0x197e('0x53')]=function(_0x1aabf2,_0xc8cb3a){var _0x311089={'raw':!![],'where':{'id':_0x1aabf2['params']['id']}},_0x15a83b={};_0x15a83b[_0x197e('0x40')]=_[_0x197e('0x42')](db[_0x197e('0x3c')]['rawAttributes']);_0x15a83b['query']=_['keys'](_0x1aabf2[_0x197e('0x41')]);_0x15a83b['filters']=_[_0x197e('0x44')](_0x15a83b['model'],_0x15a83b['query']);_0x311089[_0x197e('0x46')]=_['intersection'](_0x15a83b['model'],qs[_0x197e('0x45')](_0x1aabf2['query'][_0x197e('0x45')]));_0x311089[_0x197e('0x46')]=_0x311089[_0x197e('0x46')][_0x197e('0x47')]?_0x311089[_0x197e('0x46')]:_0x15a83b[_0x197e('0x40')];if(_0x1aabf2[_0x197e('0x41')][_0x197e('0x50')]){_0x311089['include']=[{'all':!![]}];}_0x311089=_[_0x197e('0x4e')]({},_0x311089,_0x1aabf2[_0x197e('0x4f')]);return db[_0x197e('0x3c')][_0x197e('0x54')](_0x311089)[_0x197e('0x36')](handleEntityNotFound(_0xc8cb3a,null))[_0x197e('0x36')](respondWithResult(_0xc8cb3a,null))[_0x197e('0x29')](handleError(_0xc8cb3a,null));};exports['create']=function(_0x559bcf,_0x956565){return db[_0x197e('0x3c')]['create'](_0x559bcf[_0x197e('0x55')],{})[_0x197e('0x36')](respondWithResult(_0x956565,0xc9))[_0x197e('0x29')](handleError(_0x956565,null));};exports[_0x197e('0x35')]=function(_0x4c0cfc,_0x4a8639){if(_0x4c0cfc['body']['id']){delete _0x4c0cfc['body']['id'];}return db[_0x197e('0x3c')]['find']({'where':{'id':_0x4c0cfc[_0x197e('0x56')]['id']}})[_0x197e('0x36')](handleEntityNotFound(_0x4a8639,null))[_0x197e('0x36')](saveUpdates(_0x4c0cfc[_0x197e('0x55')],null))[_0x197e('0x36')](respondWithResult(_0x4a8639,null))[_0x197e('0x29')](handleError(_0x4a8639,null));};exports[_0x197e('0x37')]=function(_0x19ecef,_0x45b460){return db[_0x197e('0x3c')][_0x197e('0x54')]({'where':{'id':_0x19ecef[_0x197e('0x56')]['id']}})[_0x197e('0x36')](handleEntityNotFound(_0x45b460,null))[_0x197e('0x36')](removeEntity(_0x45b460,null))[_0x197e('0x29')](handleError(_0x45b460,null));};exports[_0x197e('0x57')]=function(_0x969e3e,_0x26e0c9){return db['WhatsappMessage'][_0x197e('0x57')]()[_0x197e('0x36')](respondWithResult(_0x26e0c9,null))[_0x197e('0x29')](handleError(_0x26e0c9,null));};var interaction_log=require(_0x197e('0x13'))('whatsapp-interactions');exports[_0x197e('0x58')]=function(_0x4ba9d3,_0x49dabc,_0x4f86a2){var _0x36638f={'agent':{},'channel':'whatsapp'};if(_0x4ba9d3['body']['id']){delete _0x4ba9d3[_0x197e('0x55')]['id'];}_0x4ba9d3[_0x197e('0x55')][_0x197e('0x59')]=!![];_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5a')]=moment()[_0x197e('0x5b')](_0x197e('0x5c'));_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')]=_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')]||_0x4ba9d3[_0x197e('0x5e')]['id'];_0x36638f['agent']['id']=_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')];return db['WhatsappMessage'][_0x197e('0x54')]({'where':{'id':_0x4ba9d3[_0x197e('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49dabc,null))[_0x197e('0x36')](saveUpdates(_0x4ba9d3[_0x197e('0x55')],null))[_0x197e('0x36')](function(_0x28bbf3){if(_0x28bbf3){_0x36638f[_0x197e('0x27')]=_0x28bbf3[_0x197e('0x5f')]({'plain':!![]});return db[_0x197e('0x60')][_0x197e('0x54')]({'where':{'id':_0x28bbf3['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x49dabc,null))[_0x197e('0x36')](function(_0x2d59cc){if(_0x2d59cc){return _0x2d59cc[_0x197e('0x35')]({'UserId':_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')],'read1stAt':_[_0x197e('0x61')](_0x2d59cc[_0x197e('0x62')])?moment()[_0x197e('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3592da){if(_0x3592da){_0x36638f[_0x197e('0x63')]=_0x3592da['get']({'plain':!![]});interaction_log[_0x197e('0x64')](_0x197e('0x65'),_0x4ba9d3[_0x197e('0x5e')]['id'],_0x4ba9d3[_0x197e('0x5e')][_0x197e('0x38')],_0x4ba9d3['user'][_0x197e('0x66')],_0x36638f[_0x197e('0x63')]['id'],_0x4ba9d3[_0x197e('0x55')]?JSON[_0x197e('0x24')](_0x4ba9d3[_0x197e('0x55')]):_0x197e('0x67'));return respondWithRpcPromise(_0x197e('0x68'),'acceptMessage',_0x36638f);}return null;})['then'](function(_0x35bd65){var _0x1ca2c6=_0x197e('0x69')+_0x35bd65[_0x197e('0x27')][_0x197e('0x6a')];return db[_0x197e('0x6b')]['query'](_0x1ca2c6,{'type':db[_0x197e('0x6c')][_0x197e('0x6d')][_0x197e('0x6e')],'raw':!![]})[_0x197e('0x36')](function(_0x467e2f){return _0x467e2f;});})[_0x197e('0x36')](function(_0x3639a6){if(_0x3639a6){_0x36638f[_0x197e('0x27')]['contact']=_0x3639a6[0x0];if(!_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')])return;return db[_0x197e('0x6f')]['find']({'where':{'id':_0x4ba9d3[_0x197e('0x55')][_0x197e('0x5d')],'role':_0x197e('0x70')},'attributes':['id',_0x197e('0x38'),_0x197e('0x71'),_0x197e('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x6f0858){if(!_0x6f0858)return null;_0x36638f[_0x197e('0x27')][_0x197e('0x70')]=_0x6f0858;return _0x36638f;})[_0x197e('0x36')](function(_0x3d4734){if(_0x3d4734){if(_0x4ba9d3['body'][_0x197e('0x73')]){_0x36638f[_0x197e('0x27')][_0x197e('0x74')]=util[_0x197e('0x5b')]('SIP/%s',_0x4ba9d3[_0x197e('0x5e')][_0x197e('0x38')]);_0x36638f[_0x197e('0x27')][_0x197e('0x75')]=_0x36638f[_0x197e('0x75')];_0x36638f[_0x197e('0x27')][_0x197e('0x76')]=_0x36638f[_0x197e('0x75')];_0x36638f[_0x197e('0x27')]['event']='accept';return respondWithRpcPromise('EventManager',_0x197e('0x77'),{'event':_0x197e('0x78'),'message':_0x36638f[_0x197e('0x27')]},client9002)[_0x197e('0x36')](function(){return _0x36638f;});}return _0x36638f;}return null;})[_0x197e('0x36')](respondWithResult(_0x49dabc,null))[_0x197e('0x29')](handleError(_0x49dabc,null));};var interaction_log=require('../../config/logger')(_0x197e('0x79'));exports[_0x197e('0x33')]=function(_0x2dd625,_0x12e818,_0x353906){var _0xe34e5d={'agent':{},'channel':_0x197e('0x7a')};if(_0x2dd625['body']['id']){delete _0x2dd625[_0x197e('0x55')]['id'];}_0x2dd625[_0x197e('0x55')][_0x197e('0x5d')]=_0x2dd625[_0x197e('0x55')][_0x197e('0x5d')]||_0x2dd625['user']['id'];_0xe34e5d[_0x197e('0x70')]['id']=_0x2dd625['body']['UserId'];return db[_0x197e('0x3c')][_0x197e('0x54')]({'where':{'id':_0x2dd625[_0x197e('0x56')]['id'],'UserId':null}})[_0x197e('0x36')](handleEntityNotFound(_0x12e818,null))[_0x197e('0x36')](function(_0x5a9dce){if(_0x5a9dce){_0xe34e5d[_0x197e('0x27')]=_0x5a9dce[_0x197e('0x5f')]({'plain':!![]});return db[_0x197e('0x60')][_0x197e('0x54')]({'where':{'id':_0x5a9dce[_0x197e('0x7b')]}});}return null;})[_0x197e('0x36')](handleEntityNotFound(_0x12e818,null))[_0x197e('0x36')](function(_0x5b6f29){if(_0x5b6f29){_0xe34e5d[_0x197e('0x63')]=_0x5b6f29[_0x197e('0x5f')]({'plain':!![]});interaction_log[_0x197e('0x64')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2dd625[_0x197e('0x5e')]['id'],_0x2dd625[_0x197e('0x5e')][_0x197e('0x38')],_0x2dd625[_0x197e('0x5e')][_0x197e('0x66')],_0xe34e5d[_0x197e('0x63')]['id'],_0x2dd625['body']?JSON['stringify'](_0x2dd625[_0x197e('0x55')]):_0x197e('0x67'));return respondWithRpcPromise(_0x197e('0x7c'),_0x197e('0x7d'),_0xe34e5d);}return null;})[_0x197e('0x36')](function(_0x5df82b){var _0x3413ec=_0x197e('0x69')+_0x5df82b['message'][_0x197e('0x6a')];return db[_0x197e('0x6b')]['query'](_0x3413ec,{'type':db[_0x197e('0x6c')][_0x197e('0x6d')][_0x197e('0x6e')],'raw':!![]})[_0x197e('0x36')](function(_0x30d8a2){return _0x30d8a2;});})[_0x197e('0x36')](function(_0x46f1a5){if(_0x46f1a5){_0xe34e5d[_0x197e('0x27')][_0x197e('0x7e')]=_0x46f1a5[0x0];if(!_0x2dd625[_0x197e('0x55')]['UserId'])return;return db[_0x197e('0x6f')][_0x197e('0x54')]({'where':{'id':_0x2dd625[_0x197e('0x55')][_0x197e('0x5d')],'role':_0x197e('0x70')},'attributes':['id','name',_0x197e('0x71'),_0x197e('0x72'),_0x197e('0x7f')],'raw':!![]});}return null;})[_0x197e('0x36')](function(_0x1795cf){if(!_0x1795cf)return null;_0xe34e5d[_0x197e('0x27')][_0x197e('0x70')]=_0x1795cf;return _0xe34e5d;})[_0x197e('0x36')](function(_0x5a1a2c){if(_0x5a1a2c){_0x5a1a2c['message']['interface']=util[_0x197e('0x5b')](_0x197e('0x80'),_0x2dd625[_0x197e('0x5e')][_0x197e('0x38')]);_0x5a1a2c[_0x197e('0x27')][_0x197e('0x75')]=_0xe34e5d[_0x197e('0x75')];_0x5a1a2c[_0x197e('0x27')][_0x197e('0x76')]=_0xe34e5d[_0x197e('0x75')];_0x5a1a2c[_0x197e('0x27')]['event']=_0x197e('0x33');respondWithRpcPromise(_0x197e('0x77'),_0x197e('0x77'),{'event':_0x197e('0x81'),'message':_0x5a1a2c[_0x197e('0x27')]},client9002);return _0xe34e5d;}return null;})[_0x197e('0x36')](respondWithResult(_0x12e818,null))[_0x197e('0x29')](handleError(_0x12e818,null));};exports[_0x197e('0x2b')]=function(_0x1eaff3,_0x3d2b70,_0x3449f4){if(_0x1eaff3[_0x197e('0x55')]['id']){delete _0x1eaff3[_0x197e('0x55')]['id'];}var _0x1436f8;return db['WhatsappMessage'][_0x197e('0x54')]({'where':{'id':_0x1eaff3[_0x197e('0x56')]['id']}})[_0x197e('0x36')](handleEntityNotFound(_0x3d2b70,null))[_0x197e('0x36')](function(_0x106d3f){if(_0x106d3f){_0x1436f8=_0x106d3f;return db['WhatsappAccount']['find']({'where':{'id':_0x106d3f[_0x197e('0x82')]}});}})['then'](handleEntityNotFound(_0x3d2b70,null))[_0x197e('0x36')](function(_0x27ca83){if(_0x27ca83){logger[_0x197e('0x21')](_0x197e('0x83'),_0x197e('0x2b'),_0x197e('0x84'),_0x27ca83[_0x197e('0x3f')],util[_0x197e('0x85')](_0x1eaff3[_0x197e('0x55')],{'showHidden':![],'depth':null}));switch(_0x27ca83['type']){case'twilio':if(_0x1eaff3[_0x197e('0x55')]['MessageSid']&&_0x1eaff3['body']['MessageSid']===_0x1436f8['messageId']&&_0x1eaff3['body']['MessageStatus']&&_0x1eaff3[_0x197e('0x55')]['MessageStatus']===_0x197e('0x59')){return _0x1436f8[_0x197e('0x35')]({'read':!![]});}else{logger[_0x197e('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x197e('0x2b'),_0x197e('0x86'),util[_0x197e('0x85')](_0x1eaff3[_0x197e('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x1436f8;}})[_0x197e('0x36')](respondWithResult(_0x3d2b70,null))[_0x197e('0x29')](handleError(_0x3d2b70,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 82a035d..a0de44a 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 _0x9e6b=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x395b11,_0x53c97d){var _0xf1e83d=function(_0x5899b6){while(--_0x5899b6){_0x395b11['push'](_0x395b11['shift']());}};_0xf1e83d(++_0x53c97d);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9e6b[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xb9e6('0x0'));var WhatsappMessage=require(_0xb9e6('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xb9e6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb9e6('0x3')};function emitEvent(_0x6fcb00){return function(_0xb74c07,_0x214661,_0x47fc84){WhatsappMessageEvents[_0xb9e6('0x4')](_0x6fcb00+':'+_0xb74c07['id'],_0xb74c07);WhatsappMessageEvents[_0xb9e6('0x4')](_0x6fcb00,_0xb74c07);_0x47fc84(null);};}for(var e in events){if(events[_0xb9e6('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xb9e6('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x4ded=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit'];(function(_0xeddbd3,_0x5cd6a8){var _0x1ef436=function(_0x5434ba){while(--_0x5434ba){_0xeddbd3['push'](_0xeddbd3['shift']());}};_0x1ef436(++_0x5cd6a8);}(_0x4ded,0x116));var _0xd4de=function(_0x6d5cdc,_0xbae596){_0x6d5cdc=_0x6d5cdc-0x0;var _0x23c994=_0x4ded[_0x6d5cdc];return _0x23c994;};'use strict';var EventEmitter=require(_0xd4de('0x0'));var WhatsappMessage=require(_0xd4de('0x1'))['db'][_0xd4de('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd4de('0x3')](0x0);var events={'afterCreate':_0xd4de('0x4'),'afterUpdate':_0xd4de('0x5'),'afterDestroy':_0xd4de('0x6')};function emitEvent(_0x42f90f){return function(_0x20930f,_0x36d4dd,_0x2e8d86){WhatsappMessageEvents[_0xd4de('0x7')](_0x42f90f+':'+_0x20930f['id'],_0x20930f);WhatsappMessageEvents['emit'](_0x42f90f,_0x20930f);_0x2e8d86(null);};}for(var e in events){if(events[_0xd4de('0x8')](e)){var event=events[e];WhatsappMessage[_0xd4de('0x9')](e,emitEvent(event));}}module[_0xd4de('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index eb8fe90..683807b 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 _0x1a98=['out','secret','UserId','WhatsappInteraction','findOne','then','catch','error','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','update','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','node-fetch','path','rimraf','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','body','models','get','direction','toLowerCase'];(function(_0x30105a,_0xe0eb5b){var _0x558b32=function(_0x88764e){while(--_0x88764e){_0x30105a['push'](_0x30105a['shift']());}};_0x558b32(++_0xe0eb5b);}(_0x1a98,0xd5));var _0x81a9=function(_0x33ce34,_0x5987ec){_0x33ce34=_0x33ce34-0x0;var _0x31886e=_0x1a98[_0x33ce34];return _0x31886e;};'use strict';var _=require(_0x81a9('0x0'));var util=require(_0x81a9('0x1'));var logger=require(_0x81a9('0x2'))('api');var moment=require(_0x81a9('0x3'));var BPromise=require(_0x81a9('0x4'));var rp=require(_0x81a9('0x5'));var fetch=require(_0x81a9('0x6'));var fs=require('fs');var path=require(_0x81a9('0x7'));var rimraf=require(_0x81a9('0x8'));var config=require('../../config/environment');var attributes=require(_0x81a9('0x9'));module[_0x81a9('0xa')]=function(_0x342e13,_0x4d8041){return _0x342e13[_0x81a9('0xb')]('WhatsappMessage',attributes,{'tableName':_0x81a9('0xc'),'paranoid':![],'indexes':[{'name':_0x81a9('0xd'),'fields':[_0x81a9('0xd')]},{'name':'fti_whatsapp_messages','fields':[_0x81a9('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a8131,_0x5f5c9d,_0x559545){var _0x5501e6=_0x342e13[_0x81a9('0xf')];var _0x46f78c=_0x5a8131[_0x81a9('0x10')]({'plain':!![]});if(_0x46f78c[_0x81a9('0x11')][_0x81a9('0x12')]()==='in'||_0x46f78c[_0x81a9('0x11')][_0x81a9('0x12')]()===_0x81a9('0x13')&&!_0x46f78c[_0x81a9('0x14')]&&!_['isNil'](_0x46f78c[_0x81a9('0x15')])){_0x5501e6[_0x81a9('0x16')][_0x81a9('0x17')]({'where':{'id':_0x46f78c['WhatsappInteractionId']}})[_0x81a9('0x18')](function(_0x381185){if(_0x381185){_0x381185['update']({'lastMsgAt':_0x46f78c['createdAt'],'lastMsgDirection':_0x46f78c[_0x81a9('0x11')][_0x81a9('0x12')]()});}})[_0x81a9('0x19')](function(_0x454344){console[_0x81a9('0x1a')](_0x454344);});}if(_0x46f78c[_0x81a9('0x11')]===_0x81a9('0x13')&&!_0x46f78c['secret']){var _0x176cfc;_0x5501e6['WhatsappAccount'][_0x81a9('0x1b')]({'where':{'id':_0x46f78c[_0x81a9('0x1c')]},'raw':!![]})[_0x81a9('0x18')](function(_0x1aa5ed){_0x176cfc=_0x1aa5ed;if(_0x176cfc&&_0x176cfc[_0x81a9('0x1d')]){switch(_0x176cfc[_0x81a9('0x1d')]){case'twilio':var _0x5465e1=require(_0x81a9('0x1e'));if(_0x176cfc[_0x81a9('0x1f')]&&_0x176cfc['authToken']&&_0x176cfc[_0x81a9('0x20')]){var _0x2c2eff=new _0x5465e1(_0x176cfc[_0x81a9('0x1f')],_0x176cfc[_0x81a9('0x21')]);_0x2c2eff[_0x81a9('0x22')][_0x81a9('0x23')]({'body':_0x46f78c[_0x81a9('0xe')],'to':'whatsapp:'+_0x46f78c[_0x81a9('0x20')],'from':_0x81a9('0x24')+_0x176cfc[_0x81a9('0x20')],'statusCallback':_0x176cfc[_0x81a9('0x25')]+_0x81a9('0x26')+_0x46f78c['id']+_0x81a9('0x27')+_0x176cfc['token']})['then'](function(_0x5bdb5c){if(_0x5bdb5c[_0x81a9('0x28')]){return _0x5a8131[_0x81a9('0x29')]({'messageId':_0x5bdb5c['sid']});}})[_0x81a9('0x19')](function(_0x86f957){logger[_0x81a9('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x81a9('0x2a'),'twilio',util[_0x81a9('0x2b')](_0x86f957,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x81a9('0x2c'),_0x81a9('0x2a'),_0x81a9('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x81a9('0x2d'):var _0x39b4d1=_0x176cfc[_0x81a9('0x1f')];var _0x4aad44=_0x176cfc['authToken'];var _0x18bf3d=_0x176cfc[_0x81a9('0x2e')]+_0x81a9('0x2f')+_0x39b4d1+'/messages/';var _0x38dd8c={'to':[_0x46f78c[_0x81a9('0x20')]],'message':{'type':_0x81a9('0x30'),'text':_0x46f78c[_0x81a9('0xe')]}};var _0x1e5079={'method':_0x81a9('0x31'),'uri':_0x18bf3d,'headers':{'Authorization':_0x81a9('0x32')+_0x4aad44,'Content-Type':_0x81a9('0x33')},'body':_0x38dd8c,'json':!![]};rp(_0x1e5079)[_0x81a9('0x18')](function(_0x596e44){if(_0x596e44[_0x81a9('0x34')][0x0]['message_id']){return _0x5a8131[_0x81a9('0x29')]({'messageId':_0x596e44[_0x81a9('0x34')][0x0][_0x81a9('0x35')]});}})[_0x81a9('0x19')](function(_0x29caf9){logger[_0x81a9('0x36')](_0x81a9('0x37'),_0x29caf9);});break;}}})[_0x81a9('0x38')](function(){_0x559545();});}else{_0x559545();}}},'charset':_0x81a9('0x39'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbc37=['token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','/whatsapp/v1/','text','POST','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','secret','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','/api/whatsapp/messages/'];(function(_0x4fc468,_0x177b03){var _0x5e04c2=function(_0x58b21f){while(--_0x58b21f){_0x4fc468['push'](_0x4fc468['shift']());}};_0x5e04c2(++_0x177b03);}(_0xbc37,0x161));var _0x7bc3=function(_0x2632d6,_0xc2cf90){_0x2632d6=_0x2632d6-0x0;var _0x2643f8=_0xbc37[_0x2632d6];return _0x2643f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7bc3('0x0'))(_0x7bc3('0x1'));var moment=require(_0x7bc3('0x2'));var BPromise=require(_0x7bc3('0x3'));var rp=require(_0x7bc3('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x7bc3('0x5'));var rimraf=require(_0x7bc3('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x7bc3('0x7')]=function(_0x1a7f94,_0xbd7070){return _0x1a7f94['define'](_0x7bc3('0x8'),attributes,{'tableName':_0x7bc3('0x9'),'paranoid':![],'indexes':[{'name':_0x7bc3('0xa'),'fields':[_0x7bc3('0xa')]},{'name':_0x7bc3('0xb'),'fields':[_0x7bc3('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39b6c3,_0x2e0ad8,_0x275a45){var _0x24cb18=_0x1a7f94[_0x7bc3('0xd')];var _0x1ac1ba=_0x39b6c3[_0x7bc3('0xe')]({'plain':!![]});if(_0x1ac1ba[_0x7bc3('0xf')][_0x7bc3('0x10')]()==='in'||_0x1ac1ba[_0x7bc3('0xf')][_0x7bc3('0x10')]()===_0x7bc3('0x11')&&!_0x1ac1ba['secret']&&!_[_0x7bc3('0x12')](_0x1ac1ba[_0x7bc3('0x13')])){_0x24cb18[_0x7bc3('0x14')][_0x7bc3('0x15')]({'where':{'id':_0x1ac1ba[_0x7bc3('0x16')]}})['then'](function(_0x7aa9c0){if(_0x7aa9c0){_0x7aa9c0[_0x7bc3('0x17')]({'lastMsgAt':_0x1ac1ba[_0x7bc3('0x18')],'lastMsgDirection':_0x1ac1ba['direction'][_0x7bc3('0x10')]()});}})[_0x7bc3('0x19')](function(_0x4584b6){console['error'](_0x4584b6);});}if(_0x1ac1ba[_0x7bc3('0xf')]===_0x7bc3('0x11')&&!_0x1ac1ba[_0x7bc3('0x1a')]){var _0x1b3509;_0x24cb18[_0x7bc3('0x1b')][_0x7bc3('0x1c')]({'where':{'id':_0x1ac1ba['WhatsappAccountId']},'raw':!![]})[_0x7bc3('0x1d')](function(_0x2c0a11){_0x1b3509=_0x2c0a11;if(_0x1b3509&&_0x1b3509[_0x7bc3('0x1e')]){switch(_0x1b3509[_0x7bc3('0x1e')]){case'twilio':var _0x58746d=require(_0x7bc3('0x1f'));if(_0x1b3509[_0x7bc3('0x20')]&&_0x1b3509[_0x7bc3('0x21')]&&_0x1b3509[_0x7bc3('0x22')]){var _0x5085cc=new _0x58746d(_0x1b3509[_0x7bc3('0x20')],_0x1b3509[_0x7bc3('0x21')]);_0x5085cc[_0x7bc3('0x23')][_0x7bc3('0x24')]({'body':_0x1ac1ba[_0x7bc3('0xc')],'to':_0x7bc3('0x25')+_0x1ac1ba[_0x7bc3('0x22')],'from':'whatsapp:'+_0x1b3509['phone'],'statusCallback':_0x1b3509['remote']+_0x7bc3('0x26')+_0x1ac1ba['id']+'/status?token='+_0x1b3509[_0x7bc3('0x27')]})[_0x7bc3('0x1d')](function(_0x34833){if(_0x34833[_0x7bc3('0x28')]){return _0x39b6c3[_0x7bc3('0x17')]({'messageId':_0x34833[_0x7bc3('0x28')]});}})[_0x7bc3('0x19')](function(_0x1b1b7c){logger[_0x7bc3('0x29')](_0x7bc3('0x2a'),_0x7bc3('0x2b'),_0x7bc3('0x1f'),util[_0x7bc3('0x2c')](_0x1b1b7c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7bc3('0x2a'),'afterCreate','twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x6d135b=_0x1b3509[_0x7bc3('0x20')];var _0x56edea=_0x1b3509[_0x7bc3('0x21')];var _0x5d4ec3=_0x1b3509['baseUrl']+_0x7bc3('0x2d')+_0x6d135b+'/messages/';var _0x447c3f={'to':[_0x1ac1ba[_0x7bc3('0x22')]],'message':{'type':_0x7bc3('0x2e'),'text':_0x1ac1ba[_0x7bc3('0xc')]}};var _0x5d0714={'method':_0x7bc3('0x2f'),'uri':_0x5d4ec3,'headers':{'Authorization':'Bearer\x20'+_0x56edea,'Content-Type':_0x7bc3('0x30')},'body':_0x447c3f,'json':!![]};rp(_0x5d0714)[_0x7bc3('0x1d')](function(_0x31d033){if(_0x31d033['statuses'][0x0][_0x7bc3('0x31')]){return _0x39b6c3[_0x7bc3('0x17')]({'messageId':_0x31d033[_0x7bc3('0x32')][0x0]['message_id']});}})[_0x7bc3('0x19')](function(_0x2b32cc){logger[_0x7bc3('0x33')](_0x7bc3('0x34'),_0x2b32cc);});break;}}})[_0x7bc3('0x35')](function(){_0x275a45();});}else{_0x275a45();}}},'charset':_0x7bc3('0x36'),'collate':_0x7bc3('0x37')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 29a77cc..9cefdca 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 _0xa23d=['WhatsappMessage,\x20%s,\x20%s','message','info','catch','CreateWhatsappMessage','WhatsappMessage','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','request','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa23d,0x168));var _0xda23=function(_0x596823,_0x8d3a3b){_0x596823=_0x596823-0x0;var _0x272d44=_0xa23d[_0x596823];return _0x272d44;};'use strict';var _=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var moment=require('moment');var BPromise=require(_0xda23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda23('0x3'));var db=require(_0xda23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xda23('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda23('0x6'));var client=jayson[_0xda23('0x7')][_0xda23('0x8')]({'port':0x232a});config[_0xda23('0x9')]=_[_0xda23('0xa')](config[_0xda23('0x9')],{'host':_0xda23('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xda23('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x291004,_0x43ecc0,_0x18641c){return new BPromise(function(_0x2b5f89,_0x3531f9){return client[_0xda23('0xc')](_0x291004,_0x18641c)['then'](function(_0x1c13fc){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x43ecc0,_0xda23('0xd'));logger[_0xda23('0xe')](_0xda23('0xf'),_0x43ecc0,_0xda23('0xd'),JSON['stringify'](_0x1c13fc));if(_0x1c13fc[_0xda23('0x10')]){if(_0x1c13fc[_0xda23('0x10')][_0xda23('0x11')]===0x1f4){logger[_0xda23('0x10')](_0xda23('0x12'),_0x43ecc0,_0x1c13fc[_0xda23('0x10')]['message']);return _0x3531f9(_0x1c13fc[_0xda23('0x10')][_0xda23('0x13')]);}logger[_0xda23('0x10')](_0xda23('0x12'),_0x43ecc0,_0x1c13fc['error'][_0xda23('0x13')]);return _0x2b5f89(_0x1c13fc[_0xda23('0x10')]['message']);}else{logger[_0xda23('0x14')](_0xda23('0x12'),_0x43ecc0,_0xda23('0xd'));_0x2b5f89(_0x1c13fc['result'][_0xda23('0x13')]);}})[_0xda23('0x15')](function(_0x4fdd0d){logger[_0xda23('0x10')](_0xda23('0x12'),_0x43ecc0,_0x4fdd0d);_0x3531f9(_0x4fdd0d);});});}exports[_0xda23('0x16')]=function(_0x560af3){var _0x449060=this;return new Promise(function(_0x408418,_0x382597){return db[_0xda23('0x17')]['create'](_0x560af3[_0xda23('0x18')],{'raw':_0x560af3['options']?_0x560af3[_0xda23('0x19')][_0xda23('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x83213b){logger[_0xda23('0x14')](_0xda23('0x16'),_0x560af3);logger[_0xda23('0xe')](_0xda23('0x16'),_0x560af3,JSON['stringify'](_0x83213b));_0x408418(_0x83213b);})[_0xda23('0x15')](function(_0x53e812){logger[_0xda23('0x10')](_0xda23('0x16'),_0x53e812[_0xda23('0x13')],_0x560af3);_0x382597(_0x449060[_0xda23('0x10')](0x1f4,_0x53e812[_0xda23('0x13')]));});});}; \ No newline at end of file +var _0x49c6=['code','message','catch','CreateWhatsappMessage','WhatsappMessage','create','options','then','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x352392,_0x29ddb0){var _0x56402d=function(_0x1cea50){while(--_0x1cea50){_0x352392['push'](_0x352392['shift']());}};_0x56402d(++_0x29ddb0);}(_0x49c6,0x134));var _0x649c=function(_0xc6489d,_0x27d8d6){_0xc6489d=_0xc6489d-0x0;var _0x53618d=_0x49c6[_0xc6489d];return _0x53618d;};'use strict';var _=require('lodash');var util=require(_0x649c('0x0'));var moment=require(_0x649c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x649c('0x2'));var db=require(_0x649c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x649c('0x4'))(_0x649c('0x5'));var config=require(_0x649c('0x6'));var jayson=require(_0x649c('0x7'));var client=jayson[_0x649c('0x8')]['http']({'port':0x232a});config['redis']=_[_0x649c('0x9')](config[_0x649c('0xa')],{'host':_0x649c('0xb'),'port':0x18eb});var socket=require(_0x649c('0xc'))(new Redis(config[_0x649c('0xa')]));require(_0x649c('0xd'))[_0x649c('0xe')](socket);function respondWithRpcPromise(_0x266d37,_0x1f3150,_0x1075bc){return new BPromise(function(_0x1cf70e,_0x26c099){return client[_0x649c('0xf')](_0x266d37,_0x1075bc)['then'](function(_0x458b74){logger[_0x649c('0x10')](_0x649c('0x11'),_0x1f3150,'request\x20sent');logger[_0x649c('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f3150,_0x649c('0x13'),JSON[_0x649c('0x14')](_0x458b74));if(_0x458b74[_0x649c('0x15')]){if(_0x458b74['error'][_0x649c('0x16')]===0x1f4){logger[_0x649c('0x15')](_0x649c('0x11'),_0x1f3150,_0x458b74[_0x649c('0x15')]['message']);return _0x26c099(_0x458b74[_0x649c('0x15')]['message']);}logger[_0x649c('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x1f3150,_0x458b74[_0x649c('0x15')][_0x649c('0x17')]);return _0x1cf70e(_0x458b74[_0x649c('0x15')][_0x649c('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1f3150,_0x649c('0x13'));_0x1cf70e(_0x458b74['result'][_0x649c('0x17')]);}})[_0x649c('0x18')](function(_0xa00482){logger[_0x649c('0x15')](_0x649c('0x11'),_0x1f3150,_0xa00482);_0x26c099(_0xa00482);});});}exports[_0x649c('0x19')]=function(_0x2566a4){var _0x16a3d6=this;return new Promise(function(_0x128f9c,_0x1c72b8){return db[_0x649c('0x1a')][_0x649c('0x1b')](_0x2566a4['body'],{'raw':_0x2566a4[_0x649c('0x1c')]?_0x2566a4[_0x649c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x649c('0x1d')](function(_0x12ab84){logger['info'](_0x649c('0x19'),_0x2566a4);logger[_0x649c('0x12')]('CreateWhatsappMessage',_0x2566a4,JSON[_0x649c('0x14')](_0x12ab84));_0x128f9c(_0x12ab84);})[_0x649c('0x18')](function(_0x4ab231){logger[_0x649c('0x15')](_0x649c('0x19'),_0x4ab231[_0x649c('0x17')],_0x2566a4);_0x1c72b8(_0x16a3d6[_0x649c('0x15')](0x1f4,_0x4ab231[_0x649c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index f2d4bb1..db36342 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 _0x0bf4=['emit','register','length','whatsappMessage:','./whatsappMessage.events','update'];(function(_0x32ba3a,_0x30141c){var _0x4054a0=function(_0x3c0f53){while(--_0x3c0f53){_0x32ba3a['push'](_0x32ba3a['shift']());}};_0x4054a0(++_0x30141c);}(_0x0bf4,0x17e));var _0x40bf=function(_0x4218d0,_0x18aa4c){_0x4218d0=_0x4218d0-0x0;var _0x2c142c=_0x0bf4[_0x4218d0];return _0x2c142c;};'use strict';var WhatsappMessageEvents=require(_0x40bf('0x0'));var events=['save','remove',_0x40bf('0x1')];function createListener(_0x2a7820,_0x4256c4){return function(_0x3565b7){_0x4256c4[_0x40bf('0x2')](_0x2a7820,_0x3565b7);};}function removeListener(_0x321643,_0x3592ac){return function(){WhatsappMessageEvents['removeListener'](_0x321643,_0x3592ac);};}exports[_0x40bf('0x3')]=function(_0x59a6c7){for(var _0xf4c4f6=0x0,_0x6e507c=events[_0x40bf('0x4')];_0xf4c4f6<_0x6e507c;_0xf4c4f6++){var _0x571300=events[_0xf4c4f6];var _0x49a036=createListener(_0x40bf('0x5')+_0x571300,_0x59a6c7);WhatsappMessageEvents['on'](_0x571300,_0x49a036);}}; \ No newline at end of file +var _0x9986=['emit','removeListener','register','length','whatsappMessage:','save'];(function(_0xd79ec3,_0x246c2e){var _0x5e7cef=function(_0x47972c){while(--_0x47972c){_0xd79ec3['push'](_0xd79ec3['shift']());}};_0x5e7cef(++_0x246c2e);}(_0x9986,0x1a3));var _0x6998=function(_0x31ce84,_0x18154a){_0x31ce84=_0x31ce84-0x0;var _0x110701=_0x9986[_0x31ce84];return _0x110701;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x6998('0x0'),'remove','update'];function createListener(_0x29741f,_0x2fbb8a){return function(_0x4aaf1b){_0x2fbb8a[_0x6998('0x1')](_0x29741f,_0x4aaf1b);};}function removeListener(_0xf3d3b3,_0x360eb9){return function(){WhatsappMessageEvents[_0x6998('0x2')](_0xf3d3b3,_0x360eb9);};}exports[_0x6998('0x3')]=function(_0x13281f){for(var _0x17b007=0x0,_0x20b79e=events[_0x6998('0x4')];_0x17b007<_0x20b79e;_0x17b007++){var _0x347c50=events[_0x17b007];var _0x3ccec1=createListener(_0x6998('0x5')+_0x347c50,_0x13281f);WhatsappMessageEvents['on'](_0x347c50,_0x3ccec1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 557aad6..98d380b 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 _0xea73=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','post','create','/:id/teams','addAgents','update','delete','destroy','removeTeams','exports','express','Router','../../components/auth/service'];(function(_0x16e0c8,_0x4861eb){var _0xe4b5af=function(_0x5248bc){while(--_0x5248bc){_0x16e0c8['push'](_0x16e0c8['shift']());}};_0xe4b5af(++_0x4861eb);}(_0xea73,0x156));var _0x3ea7=function(_0x484b00,_0x222bfc){_0x484b00=_0x484b00-0x0;var _0x2b7548=_0xea73[_0x484b00];return _0x2b7548;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3ea7('0x0'));var router=express[_0x3ea7('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x3ea7('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3ea7('0x3'));var controller=require(_0x3ea7('0x4'));router[_0x3ea7('0x5')]('/',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x7')]);router[_0x3ea7('0x5')]('/describe',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x8')]);router['get'](_0x3ea7('0x9'),auth[_0x3ea7('0x6')](),controller['show']);router[_0x3ea7('0x5')](_0x3ea7('0xa'),auth['isAuthenticated'](),controller[_0x3ea7('0xb')]);router[_0x3ea7('0x5')]('/:id/teams',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0xc')]);router[_0x3ea7('0x5')](_0x3ea7('0xd'),auth[_0x3ea7('0x6')](),controller['getAgents']);router[_0x3ea7('0xe')]('/',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0xf')]);router['post'](_0x3ea7('0x10'),auth[_0x3ea7('0x6')](),controller['addTeams']);router[_0x3ea7('0xe')](_0x3ea7('0xd'),auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x11')]);router['put'](_0x3ea7('0x9'),auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x12')]);router[_0x3ea7('0x13')]('/:id',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x14')]);router[_0x3ea7('0x13')]('/:id/teams',auth[_0x3ea7('0x6')](),controller[_0x3ea7('0x15')]);router[_0x3ea7('0x13')](_0x3ea7('0xd'),auth[_0x3ea7('0x6')](),controller['removeAgents']);module[_0x3ea7('0x16')]=router; \ No newline at end of file +var _0x619c=['describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x120a1a,_0x547d24){var _0x3975b7=function(_0x19ac4d){while(--_0x19ac4d){_0x120a1a['push'](_0x120a1a['shift']());}};_0x3975b7(++_0x547d24);}(_0x619c,0x132));var _0xc619=function(_0x2af547,_0x4b3028){_0x2af547=_0x2af547-0x0;var _0x1cf447=_0x619c[_0x2af547];return _0x1cf447;};'use strict';var multer=require(_0xc619('0x0'));var util=require(_0xc619('0x1'));var path=require('path');var timeout=require(_0xc619('0x2'));var express=require(_0xc619('0x3'));var router=express[_0xc619('0x4')]();var fs_extra=require(_0xc619('0x5'));var auth=require(_0xc619('0x6'));var interaction=require(_0xc619('0x7'));var config=require(_0xc619('0x8'));var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0xc619('0x9')](),controller[_0xc619('0xa')]);router[_0xc619('0xb')](_0xc619('0xc'),auth[_0xc619('0x9')](),controller[_0xc619('0xd')]);router[_0xc619('0xb')](_0xc619('0xe'),auth[_0xc619('0x9')](),controller['show']);router[_0xc619('0xb')](_0xc619('0xf'),auth[_0xc619('0x9')](),controller[_0xc619('0x10')]);router[_0xc619('0xb')](_0xc619('0x11'),auth['isAuthenticated'](),controller[_0xc619('0x12')]);router['get']('/:id/users',auth[_0xc619('0x9')](),controller[_0xc619('0x13')]);router[_0xc619('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc619('0x14')]('/:id/teams',auth[_0xc619('0x9')](),controller[_0xc619('0x15')]);router[_0xc619('0x14')](_0xc619('0x16'),auth[_0xc619('0x9')](),controller['addAgents']);router[_0xc619('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc619('0x18')](_0xc619('0xe'),auth[_0xc619('0x9')](),controller[_0xc619('0x19')]);router[_0xc619('0x18')](_0xc619('0x11'),auth['isAuthenticated'](),controller[_0xc619('0x1a')]);router['delete'](_0xc619('0x16'),auth['isAuthenticated'](),controller[_0xc619('0x1b')]);module[_0xc619('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index f50e719..ab01ad5 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 _0xea1a=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x5d02d3,_0x4ea707){var _0x5bb653=function(_0x25072f){while(--_0x25072f){_0x5d02d3['push'](_0x5d02d3['shift']());}};_0x5bb653(++_0x4ea707);}(_0xea1a,0x158));var _0xaea1=function(_0x3b8353,_0xc89e16){_0x3b8353=_0x3b8353-0x0;var _0x270f61=_0xea1a[_0x3b8353];return _0x270f61;};'use strict';var Sequelize=require(_0xaea1('0x0'));module[_0xaea1('0x1')]={'name':{'type':Sequelize[_0xaea1('0x2')],'unique':_0xaea1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xaea1('0x4')](_0xaea1('0x5'),_0xaea1('0x6'),_0xaea1('0x7'))},'description':{'type':Sequelize[_0xaea1('0x2')]}}; \ No newline at end of file +var _0xc576=['STRING','name','INTEGER','beepall','sequelize','exports'];(function(_0x55c546,_0x649095){var _0x4db906=function(_0x32351f){while(--_0x32351f){_0x55c546['push'](_0x55c546['shift']());}};_0x4db906(++_0x649095);}(_0xc576,0x1ea));var _0x6c57=function(_0x49c057,_0xc808ed){_0x49c057=_0x49c057-0x0;var _0xd8f0e6=_0xc576[_0x49c057];return _0xd8f0e6;};'use strict';var Sequelize=require(_0x6c57('0x0'));module[_0x6c57('0x1')]={'name':{'type':Sequelize[_0x6c57('0x2')],'unique':_0x6c57('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6c57('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x6c57('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x6c57('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 42f4ee6..819cc3a 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 _0x21b9=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','voicePause','flatMap','transaction','addTeams','emit','removeTeams','ids','User','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','WhatsappQueue','fieldName','model','keys','query','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','where','type','VIRTUAL','filter','merge','includeAll','rows','catch','show','intersection','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','params','describe','getMembers','findOne','UserWhatsappQueue','rawAttributes','nolimit','WhatsappQueueId','options','findAll','findAndCountAll','UserId','agent','whatsappPause'];(function(_0x414d9f,_0x11b943){var _0xa4f0de=function(_0xad3c83){while(--_0xad3c83){_0x414d9f['push'](_0x414d9f['shift']());}};_0xa4f0de(++_0x11b943);}(_0x21b9,0x14d));var _0x921b=function(_0x23734a,_0x7c0555){_0x23734a=_0x23734a-0x0;var _0x102327=_0x21b9[_0x23734a];return _0x102327;};'use strict';var emlformat=require(_0x921b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x921b('0x1'));var rp=require(_0x921b('0x2'));var moment=require('moment');var BPromise=require(_0x921b('0x3'));var Mustache=require(_0x921b('0x4'));var util=require(_0x921b('0x5'));var path=require(_0x921b('0x6'));var sox=require(_0x921b('0x7'));var csv=require(_0x921b('0x8'));var ejs=require(_0x921b('0x9'));var fs=require('fs');var fs_extra=require(_0x921b('0xa'));var _=require(_0x921b('0xb'));var squel=require(_0x921b('0xc'));var crypto=require(_0x921b('0xd'));var jsforce=require(_0x921b('0xe'));var deskjs=require(_0x921b('0xf'));var toCsv=require(_0x921b('0x8'));var querystring=require('querystring');var Papa=require(_0x921b('0x10'));var Redis=require('ioredis');var authService=require(_0x921b('0x11'));var qs=require(_0x921b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x921b('0x13'));var logger=require('../../config/logger')(_0x921b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x921b('0x15'));var db=require(_0x921b('0x16'))['db'];config[_0x921b('0x17')]=_[_0x921b('0x18')](config[_0x921b('0x17')],{'host':_0x921b('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x921b('0x1a'))[_0x921b('0x1b')](socket);function respondWithStatusCode(_0x196dd8,_0x17f98b){_0x17f98b=_0x17f98b||0xcc;return function(_0x17c2d1){if(_0x17c2d1){return _0x196dd8[_0x921b('0x1c')](_0x17f98b);}return _0x196dd8['status'](_0x17f98b)['end']();};}function respondWithResult(_0x2a40ad,_0x454782){_0x454782=_0x454782||0xc8;return function(_0xfabb26){if(_0xfabb26){return _0x2a40ad[_0x921b('0x1d')](_0x454782)[_0x921b('0x1e')](_0xfabb26);}};}function respondWithFilteredResult(_0x11719a,_0x43d5b3){return function(_0x49180c){if(_0x49180c){var _0x38dfcf=typeof _0x43d5b3[_0x921b('0x1f')]===_0x921b('0x20')&&typeof _0x43d5b3[_0x921b('0x21')]==='undefined';var _0x2f60ae=_0x49180c[_0x921b('0x22')];var _0x5937a4=_0x38dfcf?0x0:_0x43d5b3[_0x921b('0x1f')];var _0x10bbe3=_0x38dfcf?_0x49180c['count']:_0x43d5b3[_0x921b('0x1f')]+_0x43d5b3[_0x921b('0x21')];var _0x586c58;if(_0x10bbe3>=_0x2f60ae){_0x10bbe3=_0x2f60ae;_0x586c58=0xc8;}else{_0x586c58=0xce;}_0x11719a['status'](_0x586c58);return _0x11719a[_0x921b('0x23')](_0x921b('0x24'),_0x5937a4+'-'+_0x10bbe3+'/'+_0x2f60ae)[_0x921b('0x1e')](_0x49180c);}return null;};}function patchUpdates(_0xd21109){return function(_0x1516a3){try{jsonpatch[_0x921b('0x25')](_0x1516a3,_0xd21109,!![]);}catch(_0x5ff16a){return BPromise[_0x921b('0x26')](_0x5ff16a);}return _0x1516a3[_0x921b('0x27')]();};}function saveUpdates(_0x4897f7,_0x50b637){return function(_0x4066bc){if(_0x4066bc){return _0x4066bc[_0x921b('0x28')](_0x4897f7)[_0x921b('0x29')](function(_0x558efd){return _0x558efd;});}return null;};}function removeEntity(_0x426f5d,_0x23f1ec){return function(_0x47d760){if(_0x47d760){return _0x47d760[_0x921b('0x2a')]()[_0x921b('0x29')](function(){var _0x374418=_0x47d760[_0x921b('0x2b')]({'plain':!![]});var _0x189eda=_0x921b('0x2c');return db[_0x921b('0x2d')][_0x921b('0x2a')]({'where':{'type':_0x189eda,'resourceId':_0x374418['id']}})[_0x921b('0x29')](function(){return _0x47d760;});})[_0x921b('0x29')](function(){_0x426f5d['status'](0xcc)[_0x921b('0x2e')]();});}};}function handleEntityNotFound(_0x5baacb,_0x112029){return function(_0x26d686){if(!_0x26d686){_0x5baacb[_0x921b('0x1c')](0x194);}return _0x26d686;};}function handleError(_0x48197e,_0x3a1670){_0x3a1670=_0x3a1670||0x1f4;return function(_0x152097){logger[_0x921b('0x2f')](_0x152097[_0x921b('0x30')]);if(_0x152097[_0x921b('0x31')]){delete _0x152097['name'];}_0x48197e['status'](_0x3a1670)[_0x921b('0x32')](_0x152097);};}exports[_0x921b('0x33')]=function(_0x184e31,_0x2dc46d){var _0x2c6238={},_0x101530={},_0x298928={'count':0x0,'rows':[]};var _0x5b11df=_[_0x921b('0x34')](db[_0x921b('0x35')]['rawAttributes'],function(_0x4d4448){return{'name':_0x4d4448[_0x921b('0x36')],'type':_0x4d4448['type']['key']};});_0x101530[_0x921b('0x37')]=_[_0x921b('0x34')](_0x5b11df,_0x921b('0x31'));_0x101530['query']=_[_0x921b('0x38')](_0x184e31[_0x921b('0x39')]);_0x101530[_0x921b('0x3a')]=_['intersection'](_0x101530['model'],_0x101530[_0x921b('0x39')]);_0x2c6238['attributes']=_['intersection'](_0x101530[_0x921b('0x37')],qs[_0x921b('0x3b')](_0x184e31['query'][_0x921b('0x3b')]));_0x2c6238[_0x921b('0x3c')]=_0x2c6238[_0x921b('0x3c')][_0x921b('0x3d')]?_0x2c6238[_0x921b('0x3c')]:_0x101530[_0x921b('0x37')];if(!_0x184e31['query'][_0x921b('0x3e')]('nolimit')){_0x2c6238[_0x921b('0x21')]=qs[_0x921b('0x21')](_0x184e31[_0x921b('0x39')][_0x921b('0x21')]);_0x2c6238[_0x921b('0x1f')]=qs[_0x921b('0x1f')](_0x184e31[_0x921b('0x39')]['offset']);}_0x2c6238[_0x921b('0x3f')]=qs['sort'](_0x184e31['query'][_0x921b('0x40')]);_0x2c6238['where']=qs[_0x921b('0x3a')](_[_0x921b('0x41')](_0x184e31[_0x921b('0x39')],_0x101530[_0x921b('0x3a')]),_0x5b11df);if(_0x184e31[_0x921b('0x39')]['filter']){_0x2c6238[_0x921b('0x42')]=_['merge'](_0x2c6238[_0x921b('0x42')],{'$or':_[_0x921b('0x34')](_0x5b11df,function(_0x29b9a5){if(_0x29b9a5[_0x921b('0x43')]!==_0x921b('0x44')){var _0x2c1a21={};_0x2c1a21[_0x29b9a5[_0x921b('0x31')]]={'$like':'%'+_0x184e31[_0x921b('0x39')][_0x921b('0x45')]+'%'};return _0x2c1a21;}})});}_0x2c6238=_[_0x921b('0x46')]({},_0x2c6238,_0x184e31['options']);var _0x3d14a7={'where':_0x2c6238[_0x921b('0x42')]};return db['WhatsappQueue'][_0x921b('0x22')](_0x3d14a7)['then'](function(_0x398cfc){_0x298928[_0x921b('0x22')]=_0x398cfc;if(_0x184e31[_0x921b('0x39')][_0x921b('0x47')]){_0x2c6238['include']=[{'all':!![]}];}return db[_0x921b('0x35')]['findAll'](_0x2c6238);})['then'](function(_0x480328){_0x298928[_0x921b('0x48')]=_0x480328;return _0x298928;})[_0x921b('0x29')](respondWithFilteredResult(_0x2dc46d,_0x2c6238))[_0x921b('0x49')](handleError(_0x2dc46d,null));};exports[_0x921b('0x4a')]=function(_0x1ab64b,_0x496ef6){var _0x183e05={'raw':!![],'where':{'id':_0x1ab64b['params']['id']}},_0x46c6e3={};_0x46c6e3['model']=_['keys'](db['WhatsappQueue']['rawAttributes']);_0x46c6e3[_0x921b('0x39')]=_['keys'](_0x1ab64b[_0x921b('0x39')]);_0x46c6e3['filters']=_[_0x921b('0x4b')](_0x46c6e3[_0x921b('0x37')],_0x46c6e3[_0x921b('0x39')]);_0x183e05[_0x921b('0x3c')]=_[_0x921b('0x4b')](_0x46c6e3[_0x921b('0x37')],qs[_0x921b('0x3b')](_0x1ab64b[_0x921b('0x39')][_0x921b('0x3b')]));_0x183e05['attributes']=_0x183e05[_0x921b('0x3c')][_0x921b('0x3d')]?_0x183e05['attributes']:_0x46c6e3[_0x921b('0x37')];if(_0x1ab64b[_0x921b('0x39')]['includeAll']){_0x183e05[_0x921b('0x4c')]=[{'all':!![]}];}_0x183e05=_[_0x921b('0x46')]({},_0x183e05,_0x1ab64b['options']);return db[_0x921b('0x35')][_0x921b('0x4d')](_0x183e05)[_0x921b('0x29')](handleEntityNotFound(_0x496ef6,null))[_0x921b('0x29')](respondWithResult(_0x496ef6,null))[_0x921b('0x49')](handleError(_0x496ef6,null));};exports['create']=function(_0x564dda,_0x1990c1){return db[_0x921b('0x35')][_0x921b('0x4e')](_0x564dda[_0x921b('0x4f')],{})[_0x921b('0x29')](function(_0x50bd1e){var _0x497c26=_0x564dda['user'][_0x921b('0x2b')]({'plain':!![]});if(!_0x497c26)throw new Error(_0x921b('0x50'));if(_0x497c26[_0x921b('0x51')]===_0x921b('0x52')){var _0x2d8e60=_0x50bd1e['get']({'plain':!![]});var _0x3ff879=_0x921b('0x2c');return db['UserProfileSection'][_0x921b('0x4d')]({'where':{'name':_0x3ff879,'userProfileId':_0x497c26[_0x921b('0x53')]},'raw':!![]})['then'](function(_0x356384){if(_0x356384&&_0x356384[_0x921b('0x54')]===0x0){return db[_0x921b('0x2d')][_0x921b('0x4e')]({'name':_0x2d8e60['name'],'resourceId':_0x2d8e60['id'],'type':_0x356384['name'],'sectionId':_0x356384['id']},{})[_0x921b('0x29')](function(){return _0x50bd1e;});}else{return _0x50bd1e;}})['catch'](function(_0x5dcdee){logger[_0x921b('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dcdee);throw _0x5dcdee;});}return _0x50bd1e;})[_0x921b('0x29')](respondWithResult(_0x1990c1,0xc9))['catch'](handleError(_0x1990c1,null));};exports['update']=function(_0x546f00,_0x3bf950){if(_0x546f00[_0x921b('0x4f')]['id']){delete _0x546f00[_0x921b('0x4f')]['id'];}return db[_0x921b('0x35')][_0x921b('0x4d')]({'where':{'id':_0x546f00[_0x921b('0x55')]['id']}})[_0x921b('0x29')](handleEntityNotFound(_0x3bf950,null))[_0x921b('0x29')](saveUpdates(_0x546f00[_0x921b('0x4f')],null))['then'](respondWithResult(_0x3bf950,null))[_0x921b('0x49')](handleError(_0x3bf950,null));};exports[_0x921b('0x2a')]=function(_0x297818,_0x1f7c5e){return db[_0x921b('0x35')]['find']({'where':{'id':_0x297818[_0x921b('0x55')]['id']}})[_0x921b('0x29')](handleEntityNotFound(_0x1f7c5e,null))[_0x921b('0x29')](removeEntity(_0x1f7c5e,null))[_0x921b('0x49')](handleError(_0x1f7c5e,null));};exports['describe']=function(_0x5ed727,_0x407058){return db[_0x921b('0x35')][_0x921b('0x56')]()[_0x921b('0x29')](respondWithResult(_0x407058,null))[_0x921b('0x49')](handleError(_0x407058,null));};exports[_0x921b('0x57')]=function(_0x5c80bf,_0x13ba73,_0x5b02a1){var _0x226718={'raw':!![],'where':{}},_0x3a4f7e={},_0x30f95c;return db['WhatsappQueue'][_0x921b('0x58')]({'where':{'id':_0x5c80bf[_0x921b('0x55')]['id']}})[_0x921b('0x29')](handleEntityNotFound(_0x13ba73,null))[_0x921b('0x29')](function(_0x180179){if(_0x180179){_0x30f95c=_0x180179[_0x921b('0x2b')]({'plain':!![]});_0x3a4f7e['model']=_[_0x921b('0x38')](db[_0x921b('0x59')][_0x921b('0x5a')]);_0x3a4f7e[_0x921b('0x39')]=_['keys'](_0x5c80bf['query']);_0x3a4f7e['filters']=_[_0x921b('0x4b')](_0x3a4f7e[_0x921b('0x37')],_0x3a4f7e[_0x921b('0x39')]);_0x226718[_0x921b('0x3c')]=_[_0x921b('0x4b')](_0x3a4f7e[_0x921b('0x37')],qs['fields'](_0x5c80bf[_0x921b('0x39')][_0x921b('0x3b')]));_0x226718[_0x921b('0x3c')]=_0x226718[_0x921b('0x3c')][_0x921b('0x3d')]?_0x226718[_0x921b('0x3c')]:_0x3a4f7e[_0x921b('0x37')];if(!_0x5c80bf[_0x921b('0x39')][_0x921b('0x3e')](_0x921b('0x5b'))){_0x226718[_0x921b('0x21')]=qs[_0x921b('0x21')](_0x5c80bf[_0x921b('0x39')]['limit']);_0x226718[_0x921b('0x1f')]=qs[_0x921b('0x1f')](_0x5c80bf[_0x921b('0x39')][_0x921b('0x1f')]);}_0x226718[_0x921b('0x3f')]=qs['sort'](_0x5c80bf[_0x921b('0x39')]['sort']);_0x226718['where']=qs[_0x921b('0x3a')](_[_0x921b('0x41')](_0x5c80bf['query'],_0x3a4f7e[_0x921b('0x3a')]));_0x226718[_0x921b('0x42')][_0x921b('0x5c')]=_0x180179['id'];if(_0x5c80bf[_0x921b('0x39')][_0x921b('0x45')]){_0x226718[_0x921b('0x42')]=_[_0x921b('0x46')](_0x226718['where'],{'$or':_[_0x921b('0x34')](_0x226718[_0x921b('0x3c')],function(_0x155607){var _0x45b3ae={};_0x45b3ae[_0x155607]={'$like':'%'+_0x5c80bf['query'][_0x921b('0x45')]+'%'};return _0x45b3ae;})});}_0x226718=_[_0x921b('0x46')]({},_0x226718,_0x5c80bf[_0x921b('0x5d')]);return db['UserWhatsappQueue'][_0x921b('0x5e')](_0x226718);}})[_0x921b('0x29')](function(_0x360744){if(_0x360744){return db['User'][_0x921b('0x5f')]({'where':{'id':_[_0x921b('0x34')](_0x360744,_0x921b('0x60')),'role':_0x921b('0x61')},'attributes':['id','name',_0x921b('0x62'),_0x921b('0x63'),_0x921b('0x64')]});}})['then'](function(_0x2f32bb){if(_0x2f32bb){return{'count':_0x2f32bb[_0x921b('0x22')],'rows':_[_0x921b('0x34')](_0x2f32bb[_0x921b('0x48')],function(_0x5e6b4c){return{'membername':_0x5e6b4c[_0x921b('0x31')],'UserId':_0x5e6b4c['id'],'queue_name':_0x30f95c['name'],'WhatsappQueueId':_0x30f95c['id'],'interface':util[_0x921b('0x65')](_0x921b('0x66'),_0x921b('0x67'),_0x5e6b4c['name']),'penalty':0x0,'paused':_0x5e6b4c['whatsappPause'],'createdAt':_0x5e6b4c[_0x921b('0x64')],'updatedAt':_0x5e6b4c[_0x921b('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x921b('0x29')](respondWithFilteredResult(_0x13ba73,_0x226718))[_0x921b('0x49')](handleError(_0x13ba73,null));};exports[_0x921b('0x68')]=function(_0x11dcdc,_0x4b2f6f,_0x18a6c8){var _0x9049f1={};var _0x50044d={};var _0x55844c;var _0x59d83a;return db[_0x921b('0x35')][_0x921b('0x58')]({'where':{'id':_0x11dcdc[_0x921b('0x55')]['id']}})['then'](handleEntityNotFound(_0x4b2f6f,null))[_0x921b('0x29')](function(_0x3711db){if(_0x3711db){_0x55844c=_0x3711db;_0x50044d[_0x921b('0x37')]=_['keys'](db[_0x921b('0x69')][_0x921b('0x5a')]);_0x50044d[_0x921b('0x39')]=_['keys'](_0x11dcdc['query']);_0x50044d[_0x921b('0x3a')]=_[_0x921b('0x4b')](_0x50044d[_0x921b('0x37')],_0x50044d[_0x921b('0x39')]);_0x9049f1[_0x921b('0x3c')]=_[_0x921b('0x4b')](_0x50044d['model'],qs[_0x921b('0x3b')](_0x11dcdc[_0x921b('0x39')][_0x921b('0x3b')]));_0x9049f1['attributes']=_0x9049f1[_0x921b('0x3c')][_0x921b('0x3d')]?_0x9049f1['attributes']:_0x50044d['model'];_0x9049f1[_0x921b('0x3f')]=qs[_0x921b('0x40')](_0x11dcdc[_0x921b('0x39')][_0x921b('0x40')]);_0x9049f1[_0x921b('0x42')]=qs[_0x921b('0x3a')](_['pick'](_0x11dcdc[_0x921b('0x39')],_0x50044d['filters']));if(_0x11dcdc[_0x921b('0x39')][_0x921b('0x45')]){_0x9049f1[_0x921b('0x42')]=_[_0x921b('0x46')](_0x9049f1[_0x921b('0x42')],{'$or':_['map'](_0x9049f1[_0x921b('0x3c')],function(_0xc062fb){var _0x690090={};_0x690090[_0xc062fb]={'$like':'%'+_0x11dcdc[_0x921b('0x39')][_0x921b('0x45')]+'%'};return _0x690090;})});}_0x9049f1=_[_0x921b('0x46')]({},_0x9049f1,_0x11dcdc[_0x921b('0x5d')]);return _0x55844c[_0x921b('0x68')](_0x9049f1);}})[_0x921b('0x29')](function(_0x53c2fa){if(_0x53c2fa){_0x59d83a=_0x53c2fa[_0x921b('0x3d')];if(!_0x11dcdc[_0x921b('0x39')][_0x921b('0x3e')](_0x921b('0x5b'))){_0x9049f1['limit']=qs[_0x921b('0x21')](_0x11dcdc[_0x921b('0x39')][_0x921b('0x21')]);_0x9049f1[_0x921b('0x1f')]=qs[_0x921b('0x1f')](_0x11dcdc[_0x921b('0x39')][_0x921b('0x1f')]);}return _0x55844c[_0x921b('0x68')](_0x9049f1);}})[_0x921b('0x29')](function(_0x39b042){if(_0x39b042){return _0x39b042?{'count':_0x59d83a,'rows':_0x39b042}:null;}})[_0x921b('0x29')](respondWithResult(_0x4b2f6f,null))[_0x921b('0x49')](handleError(_0x4b2f6f,null));};exports['addTeams']=function(_0x1779e1,_0x5609ba,_0x4c19e2){var _0x222b67=_0x1779e1[_0x921b('0x4f')]['ids'];return db[_0x921b('0x69')][_0x921b('0x5e')]({'where':{'id':_0x222b67},'attributes':['id'],'include':[{'model':db['User'],'as':_0x921b('0x6a'),'attributes':['id',_0x921b('0x31'),'online',_0x921b('0x6b'),'interface'],'raw':!![]}]})[_0x921b('0x29')](function(_0x5ddf6c){if(_0x5ddf6c){var _0x436931=_[_0x921b('0x6c')](_0x5ddf6c,function(_0x5aca03){var _0x8dd216=_0x5aca03[_0x921b('0x2b')]({'plain':!![]});return _0x8dd216[_0x921b('0x6a')];});return db[_0x921b('0x35')][_0x921b('0x4d')]({'where':{'id':_0x1779e1[_0x921b('0x55')]['id']}})[_0x921b('0x29')](function(_0x4eeb82){return db['sequelize'][_0x921b('0x6d')](function(_0x462f48){return _0x4eeb82[_0x921b('0x6e')](_0x222b67,{'transaction':_0x462f48})[_0x921b('0x29')](function(){return BPromise['each'](_0x436931,function(_0x1265a9){return db[_0x921b('0x59')]['findOrCreate']({'where':{'UserId':_0x1265a9['id'],'WhatsappQueueId':_0x1779e1[_0x921b('0x55')]['id']},'transaction':_0x462f48});});})[_0x921b('0x29')](function(){_0x436931['forEach'](function(_0x34d4e2){socket[_0x921b('0x6f')]('userWhatsappQueue:save',{'UserId':_0x34d4e2['id'],'WhatsappQueueId':_0x4eeb82['id']});});});});});}})[_0x921b('0x29')](respondWithStatusCode(_0x5609ba,null))['catch'](handleError(_0x5609ba,null));};exports[_0x921b('0x70')]=function(_0x509c57,_0x1d3ea7,_0x181d7d){return db[_0x921b('0x69')]['findAll']({'where':{'id':_0x509c57['query'][_0x921b('0x71')]},'attributes':['id'],'include':[{'model':db[_0x921b('0x72')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x921b('0x29')](handleEntityNotFound(_0x1d3ea7,null))[_0x921b('0x29')](function(_0x184c57){var _0x101451=_[_0x921b('0x34')](_0x184c57,'id');var _0x42749b=[];var _0x3d165e=[];var _0x518e4a=squel[_0x921b('0x73')]();_0x518e4a[_0x921b('0x74')](_0x921b('0x75'))[_0x921b('0x76')](_0x921b('0x77'),'tq')[_0x921b('0x78')](_0x921b('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x921b('0x42')](_0x921b('0x7a'),_0x509c57[_0x921b('0x55')]['id']);for(var _0x2f1bee=0x0;_0x2f1bee<_0x184c57[_0x921b('0x3d')];_0x2f1bee+=0x1){let _0x28283b=_0x184c57[_0x2f1bee];for(var _0x5d38a5=0x0;_0x5d38a5<_0x28283b[_0x921b('0x6a')]['length'];_0x5d38a5+=0x1){let _0x11e5df=_0x28283b[_0x921b('0x6a')][_0x5d38a5];var _0x4bf04a=_0x518e4a['clone']();_0x4bf04a[_0x921b('0x42')](_0x921b('0x7b'),_0x11e5df['id']);_0x3d165e[_0x921b('0x7c')](db[_0x921b('0x7d')]['query'](_0x4bf04a[_0x921b('0x7e')](),{'type':db['sequelize']['QueryTypes'][_0x921b('0x7f')]})[_0x921b('0x29')](function(_0x1a74e5){if(_0x1a74e5['length']===0x1){return _0x11e5df['id'];}else{var _0x46381f=_[_0x921b('0x80')](_[_0x921b('0x34')](_0x1a74e5,_0x921b('0x81')),function(_0x34ddce){return _[_0x921b('0x82')](_0x101451,_0x34ddce);});if(_0x46381f){return _0x11e5df['id'];}}}));}}return BPromise[_0x921b('0x83')](_0x3d165e)['then'](function(_0x3b75bd){_0x42749b=_(_0x42749b)[_0x921b('0x84')](_0x3b75bd)[_0x921b('0x85')]()['value']();return db[_0x921b('0x35')][_0x921b('0x4d')]({'where':{'id':_0x509c57[_0x921b('0x55')]['id']}})['then'](function(_0x36f548){return db[_0x921b('0x7d')][_0x921b('0x6d')](function(_0x85d340){return _0x36f548['removeTeams'](_0x509c57[_0x921b('0x39')]['ids'],{'transaction':_0x85d340})[_0x921b('0x29')](function(){if(!_[_0x921b('0x86')](_0x42749b)){return _0x36f548[_0x921b('0x87')](_0x42749b,{'transaction':_0x85d340});}})[_0x921b('0x29')](function(){_0x42749b[_0x921b('0x88')](function(_0x6a83b8){socket['emit'](_0x921b('0x89'),{'UserId':_0x6a83b8,'WhatsappQueueId':_0x36f548['id']});});});});});});})[_0x921b('0x29')](respondWithStatusCode(_0x1d3ea7,null))[_0x921b('0x49')](handleError(_0x1d3ea7,null));};exports[_0x921b('0x8a')]=function(_0x11a46f,_0x4970cf,_0xb9b5cb){return db[_0x921b('0x35')]['find']({'where':{'id':_0x11a46f[_0x921b('0x55')]['id']}})['then'](handleEntityNotFound(_0x4970cf,null))[_0x921b('0x29')](function(_0x238c1d){if(_0x238c1d){return _0x238c1d[_0x921b('0x8a')](_0x11a46f['body'][_0x921b('0x71')],_[_0x921b('0x8b')](_0x11a46f[_0x921b('0x4f')],[_0x921b('0x71'),'id'])||{})[_0x921b('0x8c')](function(_0x5ca305){for(var _0x341254=0x0;_0x341254<_0x11a46f['body'][_0x921b('0x71')][_0x921b('0x3d')];_0x341254+=0x1){socket[_0x921b('0x6f')](_0x921b('0x8d'),{'UserId':Number(_0x11a46f['body']['ids'][_0x341254]),'WhatsappQueueId':Number(_0x11a46f[_0x921b('0x55')]['id'])});}return _0x5ca305;});}})[_0x921b('0x29')](respondWithResult(_0x4970cf,null))[_0x921b('0x49')](handleError(_0x4970cf,null));};exports[_0x921b('0x87')]=function(_0x15dff5,_0x5cee92,_0x1fdcd4){return db['WhatsappQueue']['find']({'where':{'id':_0x15dff5[_0x921b('0x55')]['id']}})[_0x921b('0x29')](handleEntityNotFound(_0x5cee92,null))[_0x921b('0x29')](function(_0x4ad255){if(_0x4ad255){return _0x4ad255[_0x921b('0x87')](_0x15dff5[_0x921b('0x39')][_0x921b('0x71')])['then'](function(){if(_[_0x921b('0x8e')](_0x15dff5[_0x921b('0x39')][_0x921b('0x71')])){for(var _0x4a4fc5=0x0;_0x4a4fc5<_0x15dff5[_0x921b('0x39')][_0x921b('0x71')][_0x921b('0x3d')];_0x4a4fc5+=0x1){socket[_0x921b('0x6f')]('userWhatsappQueue:remove',{'UserId':Number(_0x15dff5['query']['ids'][_0x4a4fc5]),'WhatsappQueueId':Number(_0x15dff5[_0x921b('0x55')]['id'])});}}else{socket[_0x921b('0x6f')](_0x921b('0x89'),{'UserId':Number(_0x15dff5['query'][_0x921b('0x71')]),'WhatsappQueueId':Number(_0x15dff5[_0x921b('0x55')]['id'])});}});}})[_0x921b('0x29')](respondWithStatusCode(_0x5cee92,null))['catch'](handleError(_0x5cee92,null));};exports[_0x921b('0x8f')]=function(_0x35af9a,_0x3c2ba8,_0x4a5cab){var _0x40b918={};var _0x1700e9={};var _0x22faa1;var _0x295b52;return db[_0x921b('0x35')][_0x921b('0x58')]({'where':{'id':_0x35af9a[_0x921b('0x55')]['id']}})[_0x921b('0x29')](handleEntityNotFound(_0x3c2ba8,null))[_0x921b('0x29')](function(_0x1d7fdf){if(_0x1d7fdf){_0x22faa1=_0x1d7fdf;_0x1700e9[_0x921b('0x37')]=_[_0x921b('0x38')](db['User'][_0x921b('0x5a')]);_0x1700e9[_0x921b('0x39')]=_[_0x921b('0x38')](_0x35af9a['query']);_0x1700e9[_0x921b('0x3a')]=_[_0x921b('0x4b')](_0x1700e9[_0x921b('0x37')],_0x1700e9[_0x921b('0x39')]);_0x40b918[_0x921b('0x3c')]=_[_0x921b('0x4b')](_0x1700e9[_0x921b('0x37')],qs['fields'](_0x35af9a[_0x921b('0x39')][_0x921b('0x3b')]));_0x40b918[_0x921b('0x3c')]=_0x40b918[_0x921b('0x3c')]['length']?_0x40b918[_0x921b('0x3c')]:_0x1700e9[_0x921b('0x37')];_0x40b918[_0x921b('0x3f')]=qs[_0x921b('0x40')](_0x35af9a[_0x921b('0x39')]['sort']);_0x40b918[_0x921b('0x42')]=qs[_0x921b('0x3a')](_[_0x921b('0x41')](_0x35af9a[_0x921b('0x39')],_0x1700e9[_0x921b('0x3a')]));if(_0x35af9a[_0x921b('0x39')][_0x921b('0x45')]){_0x40b918[_0x921b('0x42')]=_[_0x921b('0x46')](_0x40b918[_0x921b('0x42')],{'$or':_[_0x921b('0x34')](_0x40b918['attributes'],function(_0x4821d3){var _0x4b8902={};_0x4b8902[_0x4821d3]={'$like':'%'+_0x35af9a[_0x921b('0x39')]['filter']+'%'};return _0x4b8902;})});}_0x40b918=_['merge']({},_0x40b918,_0x35af9a[_0x921b('0x5d')]);return _0x22faa1[_0x921b('0x8f')](_0x40b918);}})['then'](function(_0x1a45e7){if(_0x1a45e7){_0x295b52=_0x1a45e7[_0x921b('0x3d')];if(!_0x35af9a[_0x921b('0x39')][_0x921b('0x3e')]('nolimit')){_0x40b918[_0x921b('0x21')]=qs['limit'](_0x35af9a['query'][_0x921b('0x21')]);_0x40b918[_0x921b('0x1f')]=qs['offset'](_0x35af9a['query'][_0x921b('0x1f')]);}return _0x22faa1[_0x921b('0x8f')](_0x40b918);}})[_0x921b('0x29')](function(_0x172aec){if(_0x172aec){return _0x172aec?{'count':_0x295b52,'rows':_0x172aec}:null;}})[_0x921b('0x29')](respondWithResult(_0x3c2ba8,null))[_0x921b('0x49')](handleError(_0x3c2ba8,null));}; \ No newline at end of file +var _0x688e=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappQueue.socket','register','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','where','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','Team','options','getTeams','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x181057,_0x3aa7fe){var _0x688562=function(_0x26ecc2){while(--_0x26ecc2){_0x181057['push'](_0x181057['shift']());}};_0x688562(++_0x3aa7fe);}(_0x688e,0x86));var _0xe688=function(_0x3db843,_0x21bcdd){_0x3db843=_0x3db843-0x0;var _0x4fa197=_0x688e[_0x3db843];return _0x4fa197;};'use strict';var emlformat=require(_0xe688('0x0'));var rimraf=require(_0xe688('0x1'));var zipdir=require(_0xe688('0x2'));var jsonpatch=require(_0xe688('0x3'));var rp=require(_0xe688('0x4'));var moment=require(_0xe688('0x5'));var BPromise=require(_0xe688('0x6'));var Mustache=require('mustache');var util=require(_0xe688('0x7'));var path=require(_0xe688('0x8'));var sox=require(_0xe688('0x9'));var csv=require(_0xe688('0xa'));var ejs=require(_0xe688('0xb'));var fs=require('fs');var fs_extra=require(_0xe688('0xc'));var _=require(_0xe688('0xd'));var squel=require(_0xe688('0xe'));var crypto=require(_0xe688('0xf'));var jsforce=require(_0xe688('0x10'));var deskjs=require(_0xe688('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe688('0x12'));var Redis=require(_0xe688('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe688('0x14'));var as=require(_0xe688('0x15'));var hardwareService=require(_0xe688('0x16'));var logger=require(_0xe688('0x17'))(_0xe688('0x18'));var utils=require(_0xe688('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xe688('0x1a'));var db=require(_0xe688('0x1b'))['db'];config['redis']=_[_0xe688('0x1c')](config[_0xe688('0x1d')],{'host':_0xe688('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe688('0x1d')]));require(_0xe688('0x1f'))[_0xe688('0x20')](socket);function respondWithStatusCode(_0x1e5876,_0x5a2d3b){_0x5a2d3b=_0x5a2d3b||0xcc;return function(_0x5eae55){if(_0x5eae55){return _0x1e5876[_0xe688('0x21')](_0x5a2d3b);}return _0x1e5876[_0xe688('0x22')](_0x5a2d3b)[_0xe688('0x23')]();};}function respondWithResult(_0x109502,_0x3f823c){_0x3f823c=_0x3f823c||0xc8;return function(_0x206021){if(_0x206021){return _0x109502[_0xe688('0x22')](_0x3f823c)['json'](_0x206021);}};}function respondWithFilteredResult(_0x4e4bfc,_0x236423){return function(_0x5d26ac){if(_0x5d26ac){var _0x1e5d86=typeof _0x236423['offset']===_0xe688('0x24')&&typeof _0x236423[_0xe688('0x25')]===_0xe688('0x24');var _0x21dc37=_0x5d26ac['count'];var _0x2a0127=_0x1e5d86?0x0:_0x236423['offset'];var _0x50b612=_0x1e5d86?_0x5d26ac[_0xe688('0x26')]:_0x236423[_0xe688('0x27')]+_0x236423['limit'];var _0x2f9803;if(_0x50b612>=_0x21dc37){_0x50b612=_0x21dc37;_0x2f9803=0xc8;}else{_0x2f9803=0xce;}_0x4e4bfc[_0xe688('0x22')](_0x2f9803);return _0x4e4bfc['set'](_0xe688('0x28'),_0x2a0127+'-'+_0x50b612+'/'+_0x21dc37)[_0xe688('0x29')](_0x5d26ac);}return null;};}function patchUpdates(_0x1d7a23){return function(_0x3189a3){try{jsonpatch[_0xe688('0x2a')](_0x3189a3,_0x1d7a23,!![]);}catch(_0x22f6dc){return BPromise['reject'](_0x22f6dc);}return _0x3189a3[_0xe688('0x2b')]();};}function saveUpdates(_0x1b6988,_0x38ccb3){return function(_0x4ea50c){if(_0x4ea50c){return _0x4ea50c[_0xe688('0x2c')](_0x1b6988)[_0xe688('0x2d')](function(_0x562f2e){return _0x562f2e;});}return null;};}function removeEntity(_0x33fd1c,_0x2fb8ce){return function(_0x40c11b){if(_0x40c11b){return _0x40c11b[_0xe688('0x2e')]()[_0xe688('0x2d')](function(){var _0x5cf94b=_0x40c11b[_0xe688('0x2f')]({'plain':!![]});var _0x19218d=_0xe688('0x30');return db[_0xe688('0x31')][_0xe688('0x2e')]({'where':{'type':_0x19218d,'resourceId':_0x5cf94b['id']}})[_0xe688('0x2d')](function(){return _0x40c11b;});})[_0xe688('0x2d')](function(){_0x33fd1c[_0xe688('0x22')](0xcc)[_0xe688('0x23')]();});}};}function handleEntityNotFound(_0x277219,_0xa881e7){return function(_0x11575e){if(!_0x11575e){_0x277219[_0xe688('0x21')](0x194);}return _0x11575e;};}function handleError(_0x3f2e41,_0x1949df){_0x1949df=_0x1949df||0x1f4;return function(_0x47638b){logger['error'](_0x47638b[_0xe688('0x32')]);if(_0x47638b[_0xe688('0x33')]){delete _0x47638b[_0xe688('0x33')];}_0x3f2e41[_0xe688('0x22')](_0x1949df)[_0xe688('0x34')](_0x47638b);};}exports[_0xe688('0x35')]=function(_0x2faa8c,_0xb0c821){var _0x4f8134={},_0x3b7a57={},_0x14c2f3={'count':0x0,'rows':[]};var _0x50af52=_[_0xe688('0x36')](db[_0xe688('0x37')]['rawAttributes'],function(_0x23dd33){return{'name':_0x23dd33[_0xe688('0x38')],'type':_0x23dd33[_0xe688('0x39')][_0xe688('0x3a')]};});_0x3b7a57[_0xe688('0x3b')]=_[_0xe688('0x36')](_0x50af52,_0xe688('0x33'));_0x3b7a57['query']=_['keys'](_0x2faa8c[_0xe688('0x3c')]);_0x3b7a57['filters']=_[_0xe688('0x3d')](_0x3b7a57[_0xe688('0x3b')],_0x3b7a57[_0xe688('0x3c')]);_0x4f8134[_0xe688('0x3e')]=_[_0xe688('0x3d')](_0x3b7a57[_0xe688('0x3b')],qs[_0xe688('0x3f')](_0x2faa8c[_0xe688('0x3c')][_0xe688('0x3f')]));_0x4f8134[_0xe688('0x3e')]=_0x4f8134[_0xe688('0x3e')][_0xe688('0x40')]?_0x4f8134[_0xe688('0x3e')]:_0x3b7a57[_0xe688('0x3b')];if(!_0x2faa8c[_0xe688('0x3c')][_0xe688('0x41')](_0xe688('0x42'))){_0x4f8134['limit']=qs[_0xe688('0x25')](_0x2faa8c[_0xe688('0x3c')][_0xe688('0x25')]);_0x4f8134[_0xe688('0x27')]=qs['offset'](_0x2faa8c['query'][_0xe688('0x27')]);}_0x4f8134[_0xe688('0x43')]=qs[_0xe688('0x44')](_0x2faa8c['query'][_0xe688('0x44')]);_0x4f8134['where']=qs[_0xe688('0x45')](_[_0xe688('0x46')](_0x2faa8c[_0xe688('0x3c')],_0x3b7a57[_0xe688('0x45')]),_0x50af52);if(_0x2faa8c[_0xe688('0x3c')][_0xe688('0x47')]){_0x4f8134['where']=_[_0xe688('0x48')](_0x4f8134['where'],{'$or':_[_0xe688('0x36')](_0x50af52,function(_0xc8f8a8){if(_0xc8f8a8[_0xe688('0x39')]!==_0xe688('0x49')){var _0x494dab={};_0x494dab[_0xc8f8a8[_0xe688('0x33')]]={'$like':'%'+_0x2faa8c['query']['filter']+'%'};return _0x494dab;}})});}_0x4f8134=_[_0xe688('0x48')]({},_0x4f8134,_0x2faa8c['options']);var _0x293587={'where':_0x4f8134[_0xe688('0x4a')]};return db[_0xe688('0x37')][_0xe688('0x26')](_0x293587)[_0xe688('0x2d')](function(_0x4c458d){_0x14c2f3[_0xe688('0x26')]=_0x4c458d;if(_0x2faa8c[_0xe688('0x3c')][_0xe688('0x4b')]){_0x4f8134[_0xe688('0x4c')]=[{'all':!![]}];}return db[_0xe688('0x37')][_0xe688('0x4d')](_0x4f8134);})[_0xe688('0x2d')](function(_0xfdabff){_0x14c2f3[_0xe688('0x4e')]=_0xfdabff;return _0x14c2f3;})[_0xe688('0x2d')](respondWithFilteredResult(_0xb0c821,_0x4f8134))[_0xe688('0x4f')](handleError(_0xb0c821,null));};exports[_0xe688('0x50')]=function(_0x3063c2,_0x40da7b){var _0xa77113={'raw':!![],'where':{'id':_0x3063c2[_0xe688('0x51')]['id']}},_0x4e51fd={};_0x4e51fd[_0xe688('0x3b')]=_[_0xe688('0x52')](db[_0xe688('0x37')][_0xe688('0x53')]);_0x4e51fd['query']=_['keys'](_0x3063c2[_0xe688('0x3c')]);_0x4e51fd[_0xe688('0x45')]=_[_0xe688('0x3d')](_0x4e51fd[_0xe688('0x3b')],_0x4e51fd[_0xe688('0x3c')]);_0xa77113[_0xe688('0x3e')]=_['intersection'](_0x4e51fd[_0xe688('0x3b')],qs[_0xe688('0x3f')](_0x3063c2[_0xe688('0x3c')]['fields']));_0xa77113[_0xe688('0x3e')]=_0xa77113['attributes'][_0xe688('0x40')]?_0xa77113[_0xe688('0x3e')]:_0x4e51fd[_0xe688('0x3b')];if(_0x3063c2[_0xe688('0x3c')][_0xe688('0x4b')]){_0xa77113['include']=[{'all':!![]}];}_0xa77113=_[_0xe688('0x48')]({},_0xa77113,_0x3063c2['options']);return db['WhatsappQueue'][_0xe688('0x54')](_0xa77113)[_0xe688('0x2d')](handleEntityNotFound(_0x40da7b,null))[_0xe688('0x2d')](respondWithResult(_0x40da7b,null))[_0xe688('0x4f')](handleError(_0x40da7b,null));};exports['create']=function(_0x1c9941,_0x486d64){return db[_0xe688('0x37')][_0xe688('0x55')](_0x1c9941[_0xe688('0x56')],{})[_0xe688('0x2d')](function(_0x495e87){var _0x248e84=_0x1c9941[_0xe688('0x57')][_0xe688('0x2f')]({'plain':!![]});if(!_0x248e84)throw new Error(_0xe688('0x58'));if(_0x248e84[_0xe688('0x59')]===_0xe688('0x57')){var _0x213d4d=_0x495e87[_0xe688('0x2f')]({'plain':!![]});var _0x4cb6c8=_0xe688('0x30');return db['UserProfileSection'][_0xe688('0x54')]({'where':{'name':_0x4cb6c8,'userProfileId':_0x248e84[_0xe688('0x5a')]},'raw':!![]})[_0xe688('0x2d')](function(_0x1592dd){if(_0x1592dd&&_0x1592dd[_0xe688('0x5b')]===0x0){return db[_0xe688('0x31')][_0xe688('0x55')]({'name':_0x213d4d[_0xe688('0x33')],'resourceId':_0x213d4d['id'],'type':_0x1592dd[_0xe688('0x33')],'sectionId':_0x1592dd['id']},{})[_0xe688('0x2d')](function(){return _0x495e87;});}else{return _0x495e87;}})['catch'](function(_0x31d5a1){logger[_0xe688('0x5c')](_0xe688('0x5d'),_0x31d5a1);throw _0x31d5a1;});}return _0x495e87;})[_0xe688('0x2d')](respondWithResult(_0x486d64,0xc9))[_0xe688('0x4f')](handleError(_0x486d64,null));};exports[_0xe688('0x2c')]=function(_0x231b8b,_0x427040){if(_0x231b8b['body']['id']){delete _0x231b8b[_0xe688('0x56')]['id'];}return db['WhatsappQueue'][_0xe688('0x54')]({'where':{'id':_0x231b8b['params']['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x427040,null))[_0xe688('0x2d')](saveUpdates(_0x231b8b['body'],null))['then'](respondWithResult(_0x427040,null))[_0xe688('0x4f')](handleError(_0x427040,null));};exports[_0xe688('0x2e')]=function(_0x12eff5,_0x565cb7){return db[_0xe688('0x37')][_0xe688('0x54')]({'where':{'id':_0x12eff5[_0xe688('0x51')]['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x565cb7,null))[_0xe688('0x2d')](removeEntity(_0x565cb7,null))['catch'](handleError(_0x565cb7,null));};exports[_0xe688('0x5e')]=function(_0x2d208b,_0x30555b){return db[_0xe688('0x37')][_0xe688('0x5e')]()[_0xe688('0x2d')](respondWithResult(_0x30555b,null))[_0xe688('0x4f')](handleError(_0x30555b,null));};exports['getMembers']=function(_0x2a5ed8,_0x2ad2f0,_0x158876){var _0x24ce0f={'raw':!![],'where':{}},_0x448218={},_0x262910;return db[_0xe688('0x37')]['findOne']({'where':{'id':_0x2a5ed8['params']['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x2ad2f0,null))[_0xe688('0x2d')](function(_0x929b91){if(_0x929b91){_0x262910=_0x929b91[_0xe688('0x2f')]({'plain':!![]});_0x448218['model']=_['keys'](db[_0xe688('0x5f')][_0xe688('0x53')]);_0x448218['query']=_['keys'](_0x2a5ed8['query']);_0x448218[_0xe688('0x45')]=_[_0xe688('0x3d')](_0x448218[_0xe688('0x3b')],_0x448218[_0xe688('0x3c')]);_0x24ce0f[_0xe688('0x3e')]=_[_0xe688('0x3d')](_0x448218['model'],qs[_0xe688('0x3f')](_0x2a5ed8['query']['fields']));_0x24ce0f[_0xe688('0x3e')]=_0x24ce0f[_0xe688('0x3e')][_0xe688('0x40')]?_0x24ce0f[_0xe688('0x3e')]:_0x448218[_0xe688('0x3b')];if(!_0x2a5ed8['query']['hasOwnProperty']('nolimit')){_0x24ce0f[_0xe688('0x25')]=qs['limit'](_0x2a5ed8[_0xe688('0x3c')][_0xe688('0x25')]);_0x24ce0f['offset']=qs[_0xe688('0x27')](_0x2a5ed8['query'][_0xe688('0x27')]);}_0x24ce0f[_0xe688('0x43')]=qs['sort'](_0x2a5ed8[_0xe688('0x3c')]['sort']);_0x24ce0f[_0xe688('0x4a')]=qs[_0xe688('0x45')](_['pick'](_0x2a5ed8[_0xe688('0x3c')],_0x448218[_0xe688('0x45')]));_0x24ce0f[_0xe688('0x4a')][_0xe688('0x60')]=_0x929b91['id'];if(_0x2a5ed8[_0xe688('0x3c')][_0xe688('0x47')]){_0x24ce0f[_0xe688('0x4a')]=_[_0xe688('0x48')](_0x24ce0f[_0xe688('0x4a')],{'$or':_[_0xe688('0x36')](_0x24ce0f[_0xe688('0x3e')],function(_0x55b518){var _0x5a153f={};_0x5a153f[_0x55b518]={'$like':'%'+_0x2a5ed8[_0xe688('0x3c')][_0xe688('0x47')]+'%'};return _0x5a153f;})});}_0x24ce0f=_[_0xe688('0x48')]({},_0x24ce0f,_0x2a5ed8['options']);return db['UserWhatsappQueue'][_0xe688('0x4d')](_0x24ce0f);}})[_0xe688('0x2d')](function(_0x372974){if(_0x372974){return db[_0xe688('0x61')][_0xe688('0x62')]({'where':{'id':_['map'](_0x372974,_0xe688('0x63')),'role':_0xe688('0x64')},'attributes':['id',_0xe688('0x33'),_0xe688('0x65'),_0xe688('0x66'),'createdAt']});}})[_0xe688('0x2d')](function(_0x2db271){if(_0x2db271){return{'count':_0x2db271[_0xe688('0x26')],'rows':_[_0xe688('0x36')](_0x2db271[_0xe688('0x4e')],function(_0x191c6b){return{'membername':_0x191c6b[_0xe688('0x33')],'UserId':_0x191c6b['id'],'queue_name':_0x262910[_0xe688('0x33')],'WhatsappQueueId':_0x262910['id'],'interface':util[_0xe688('0x67')](_0xe688('0x68'),_0xe688('0x69'),_0x191c6b[_0xe688('0x33')]),'penalty':0x0,'paused':_0x191c6b[_0xe688('0x65')],'createdAt':_0x191c6b[_0xe688('0x6a')],'updatedAt':_0x191c6b[_0xe688('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2ad2f0,_0x24ce0f))[_0xe688('0x4f')](handleError(_0x2ad2f0,null));};exports['getTeams']=function(_0x3eb1c5,_0xe3641b,_0xff4bd4){var _0x545e8b={};var _0xc645e5={};var _0x261829;var _0xa94507;return db[_0xe688('0x37')]['findOne']({'where':{'id':_0x3eb1c5[_0xe688('0x51')]['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0xe3641b,null))[_0xe688('0x2d')](function(_0x2095db){if(_0x2095db){_0x261829=_0x2095db;_0xc645e5[_0xe688('0x3b')]=_[_0xe688('0x52')](db[_0xe688('0x6b')]['rawAttributes']);_0xc645e5['query']=_[_0xe688('0x52')](_0x3eb1c5['query']);_0xc645e5[_0xe688('0x45')]=_['intersection'](_0xc645e5[_0xe688('0x3b')],_0xc645e5[_0xe688('0x3c')]);_0x545e8b[_0xe688('0x3e')]=_[_0xe688('0x3d')](_0xc645e5[_0xe688('0x3b')],qs[_0xe688('0x3f')](_0x3eb1c5[_0xe688('0x3c')][_0xe688('0x3f')]));_0x545e8b[_0xe688('0x3e')]=_0x545e8b['attributes'][_0xe688('0x40')]?_0x545e8b[_0xe688('0x3e')]:_0xc645e5['model'];_0x545e8b['order']=qs['sort'](_0x3eb1c5[_0xe688('0x3c')]['sort']);_0x545e8b[_0xe688('0x4a')]=qs[_0xe688('0x45')](_['pick'](_0x3eb1c5['query'],_0xc645e5[_0xe688('0x45')]));if(_0x3eb1c5[_0xe688('0x3c')][_0xe688('0x47')]){_0x545e8b[_0xe688('0x4a')]=_[_0xe688('0x48')](_0x545e8b[_0xe688('0x4a')],{'$or':_[_0xe688('0x36')](_0x545e8b['attributes'],function(_0x2b7dcb){var _0x2d8dd2={};_0x2d8dd2[_0x2b7dcb]={'$like':'%'+_0x3eb1c5['query'][_0xe688('0x47')]+'%'};return _0x2d8dd2;})});}_0x545e8b=_[_0xe688('0x48')]({},_0x545e8b,_0x3eb1c5[_0xe688('0x6c')]);return _0x261829['getTeams'](_0x545e8b);}})[_0xe688('0x2d')](function(_0x5ae295){if(_0x5ae295){_0xa94507=_0x5ae295[_0xe688('0x40')];if(!_0x3eb1c5[_0xe688('0x3c')]['hasOwnProperty'](_0xe688('0x42'))){_0x545e8b[_0xe688('0x25')]=qs['limit'](_0x3eb1c5[_0xe688('0x3c')][_0xe688('0x25')]);_0x545e8b[_0xe688('0x27')]=qs[_0xe688('0x27')](_0x3eb1c5[_0xe688('0x3c')]['offset']);}return _0x261829[_0xe688('0x6d')](_0x545e8b);}})['then'](function(_0x2660e7){if(_0x2660e7){return _0x2660e7?{'count':_0xa94507,'rows':_0x2660e7}:null;}})[_0xe688('0x2d')](respondWithResult(_0xe3641b,null))[_0xe688('0x4f')](handleError(_0xe3641b,null));};exports[_0xe688('0x6e')]=function(_0x34415b,_0x1cde80,_0x3306aa){var _0x205829=_0x34415b['body']['ids'];return db[_0xe688('0x6b')]['findAll']({'where':{'id':_0x205829},'attributes':['id'],'include':[{'model':db[_0xe688('0x61')],'as':_0xe688('0x6f'),'attributes':['id',_0xe688('0x33'),_0xe688('0x70'),_0xe688('0x71'),_0xe688('0x72')],'raw':!![]}]})['then'](function(_0x1130ec){if(_0x1130ec){var _0x157043=_[_0xe688('0x73')](_0x1130ec,function(_0x2e39a4){var _0x5202d0=_0x2e39a4[_0xe688('0x2f')]({'plain':!![]});return _0x5202d0[_0xe688('0x6f')];});return db['WhatsappQueue'][_0xe688('0x54')]({'where':{'id':_0x34415b[_0xe688('0x51')]['id']}})['then'](function(_0x49f778){return db[_0xe688('0x74')][_0xe688('0x75')](function(_0x2d5707){return _0x49f778[_0xe688('0x6e')](_0x205829,{'transaction':_0x2d5707})['then'](function(){return BPromise['each'](_0x157043,function(_0x15b0c7){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x15b0c7['id'],'WhatsappQueueId':_0x34415b[_0xe688('0x51')]['id']},'transaction':_0x2d5707});});})['then'](function(){_0x157043[_0xe688('0x76')](function(_0x13c96c){socket[_0xe688('0x77')](_0xe688('0x78'),{'UserId':_0x13c96c['id'],'WhatsappQueueId':_0x49f778['id']});});});});});}})[_0xe688('0x2d')](respondWithStatusCode(_0x1cde80,null))[_0xe688('0x4f')](handleError(_0x1cde80,null));};exports[_0xe688('0x79')]=function(_0x10d362,_0x3c381e,_0x4e1f35){return db['Team'][_0xe688('0x4d')]({'where':{'id':_0x10d362[_0xe688('0x3c')][_0xe688('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe688('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xe688('0x2d')](handleEntityNotFound(_0x3c381e,null))['then'](function(_0x55e27e){var _0xb57db2=_['map'](_0x55e27e,'id');var _0x510f9d=[];var _0x18be9c=[];var _0x33517c=squel[_0xe688('0x7b')]();_0x33517c['field'](_0xe688('0x7c'))['from']('team_has_whatsapp_queues','tq')[_0xe688('0x7d')](_0xe688('0x7e'),'ut',_0xe688('0x7f'))[_0xe688('0x4a')](_0xe688('0x80'),_0x10d362[_0xe688('0x51')]['id']);for(var _0x491c47=0x0;_0x491c47<_0x55e27e['length'];_0x491c47+=0x1){let _0x24b304=_0x55e27e[_0x491c47];for(var _0x2898aa=0x0;_0x2898aa<_0x24b304[_0xe688('0x6f')]['length'];_0x2898aa+=0x1){let _0x260709=_0x24b304[_0xe688('0x6f')][_0x2898aa];var _0x5015ed=_0x33517c['clone']();_0x5015ed[_0xe688('0x4a')](_0xe688('0x81'),_0x260709['id']);_0x18be9c[_0xe688('0x82')](db[_0xe688('0x74')][_0xe688('0x3c')](_0x5015ed[_0xe688('0x83')](),{'type':db['sequelize'][_0xe688('0x84')]['SELECT']})[_0xe688('0x2d')](function(_0x2a9ee5){if(_0x2a9ee5[_0xe688('0x40')]===0x1){return _0x260709['id'];}else{var _0x3591ad=_[_0xe688('0x85')](_[_0xe688('0x36')](_0x2a9ee5,_0xe688('0x86')),function(_0x176dee){return _[_0xe688('0x87')](_0xb57db2,_0x176dee);});if(_0x3591ad){return _0x260709['id'];}}}));}}return BPromise[_0xe688('0x88')](_0x18be9c)[_0xe688('0x2d')](function(_0x36c63f){_0x510f9d=_(_0x510f9d)['union'](_0x36c63f)[_0xe688('0x89')]()[_0xe688('0x8a')]();return db[_0xe688('0x37')][_0xe688('0x54')]({'where':{'id':_0x10d362['params']['id']}})['then'](function(_0x40ad95){return db[_0xe688('0x74')][_0xe688('0x75')](function(_0x344dac){return _0x40ad95[_0xe688('0x79')](_0x10d362['query'][_0xe688('0x7a')],{'transaction':_0x344dac})[_0xe688('0x2d')](function(){if(!_[_0xe688('0x8b')](_0x510f9d)){return _0x40ad95[_0xe688('0x8c')](_0x510f9d,{'transaction':_0x344dac});}})[_0xe688('0x2d')](function(){_0x510f9d['forEach'](function(_0x2620bc){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x2620bc,'WhatsappQueueId':_0x40ad95['id']});});});});});});})[_0xe688('0x2d')](respondWithStatusCode(_0x3c381e,null))['catch'](handleError(_0x3c381e,null));};exports[_0xe688('0x8d')]=function(_0x582a3b,_0x13b49d,_0x244aa3){return db['WhatsappQueue']['find']({'where':{'id':_0x582a3b[_0xe688('0x51')]['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x13b49d,null))[_0xe688('0x2d')](function(_0x3419db){if(_0x3419db){return _0x3419db[_0xe688('0x8d')](_0x582a3b['body']['ids'],_[_0xe688('0x8e')](_0x582a3b['body'],[_0xe688('0x7a'),'id'])||{})[_0xe688('0x8f')](function(_0x109c75){for(var _0x3c88e7=0x0;_0x3c88e7<_0x582a3b[_0xe688('0x56')][_0xe688('0x7a')][_0xe688('0x40')];_0x3c88e7+=0x1){socket[_0xe688('0x77')]('userWhatsappQueue:save',{'UserId':Number(_0x582a3b['body']['ids'][_0x3c88e7]),'WhatsappQueueId':Number(_0x582a3b[_0xe688('0x51')]['id'])});}return _0x109c75;});}})['then'](respondWithResult(_0x13b49d,null))[_0xe688('0x4f')](handleError(_0x13b49d,null));};exports['removeAgents']=function(_0x26ab4a,_0x16ec12,_0x1625ec){return db['WhatsappQueue'][_0xe688('0x54')]({'where':{'id':_0x26ab4a[_0xe688('0x51')]['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x16ec12,null))[_0xe688('0x2d')](function(_0x32dac4){if(_0x32dac4){return _0x32dac4[_0xe688('0x8c')](_0x26ab4a[_0xe688('0x3c')][_0xe688('0x7a')])[_0xe688('0x2d')](function(){if(_[_0xe688('0x90')](_0x26ab4a['query']['ids'])){for(var _0xacdb4f=0x0;_0xacdb4f<_0x26ab4a[_0xe688('0x3c')]['ids'][_0xe688('0x40')];_0xacdb4f+=0x1){socket[_0xe688('0x77')](_0xe688('0x91'),{'UserId':Number(_0x26ab4a['query'][_0xe688('0x7a')][_0xacdb4f]),'WhatsappQueueId':Number(_0x26ab4a[_0xe688('0x51')]['id'])});}}else{socket[_0xe688('0x77')](_0xe688('0x91'),{'UserId':Number(_0x26ab4a[_0xe688('0x3c')]['ids']),'WhatsappQueueId':Number(_0x26ab4a[_0xe688('0x51')]['id'])});}});}})[_0xe688('0x2d')](respondWithStatusCode(_0x16ec12,null))['catch'](handleError(_0x16ec12,null));};exports['getAgents']=function(_0x158743,_0x490197,_0x210cda){var _0x4134ac={};var _0x45a1e2={};var _0x516239;var _0x469ca7;return db[_0xe688('0x37')]['findOne']({'where':{'id':_0x158743[_0xe688('0x51')]['id']}})[_0xe688('0x2d')](handleEntityNotFound(_0x490197,null))[_0xe688('0x2d')](function(_0xca7fb2){if(_0xca7fb2){_0x516239=_0xca7fb2;_0x45a1e2[_0xe688('0x3b')]=_[_0xe688('0x52')](db[_0xe688('0x61')][_0xe688('0x53')]);_0x45a1e2[_0xe688('0x3c')]=_[_0xe688('0x52')](_0x158743[_0xe688('0x3c')]);_0x45a1e2[_0xe688('0x45')]=_['intersection'](_0x45a1e2[_0xe688('0x3b')],_0x45a1e2['query']);_0x4134ac['attributes']=_[_0xe688('0x3d')](_0x45a1e2[_0xe688('0x3b')],qs[_0xe688('0x3f')](_0x158743[_0xe688('0x3c')][_0xe688('0x3f')]));_0x4134ac[_0xe688('0x3e')]=_0x4134ac[_0xe688('0x3e')]['length']?_0x4134ac[_0xe688('0x3e')]:_0x45a1e2[_0xe688('0x3b')];_0x4134ac[_0xe688('0x43')]=qs['sort'](_0x158743[_0xe688('0x3c')]['sort']);_0x4134ac[_0xe688('0x4a')]=qs[_0xe688('0x45')](_[_0xe688('0x46')](_0x158743[_0xe688('0x3c')],_0x45a1e2[_0xe688('0x45')]));if(_0x158743[_0xe688('0x3c')][_0xe688('0x47')]){_0x4134ac[_0xe688('0x4a')]=_[_0xe688('0x48')](_0x4134ac['where'],{'$or':_[_0xe688('0x36')](_0x4134ac['attributes'],function(_0x32fcae){var _0x131fd2={};_0x131fd2[_0x32fcae]={'$like':'%'+_0x158743[_0xe688('0x3c')][_0xe688('0x47')]+'%'};return _0x131fd2;})});}_0x4134ac=_['merge']({},_0x4134ac,_0x158743[_0xe688('0x6c')]);return _0x516239[_0xe688('0x92')](_0x4134ac);}})[_0xe688('0x2d')](function(_0x235d8d){if(_0x235d8d){_0x469ca7=_0x235d8d[_0xe688('0x40')];if(!_0x158743[_0xe688('0x3c')][_0xe688('0x41')]('nolimit')){_0x4134ac[_0xe688('0x25')]=qs['limit'](_0x158743['query'][_0xe688('0x25')]);_0x4134ac[_0xe688('0x27')]=qs['offset'](_0x158743['query']['offset']);}return _0x516239[_0xe688('0x92')](_0x4134ac);}})['then'](function(_0x2b497b){if(_0x2b497b){return _0x2b497b?{'count':_0x469ca7,'rows':_0x2b497b}:null;}})[_0xe688('0x2d')](respondWithResult(_0x490197,null))[_0xe688('0x4f')](handleError(_0x490197,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 3808c7d..b3d7874 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 _0x2b04=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2b04,0x163));var _0x42b0=function(_0x3e419f,_0x21a1e0){_0x3e419f=_0x3e419f-0x0;var _0x12659b=_0x2b04[_0x3e419f];return _0x12659b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x42b0('0x0'))['db'][_0x42b0('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x42b0('0x2')](0x0);var events={'afterCreate':_0x42b0('0x3'),'afterUpdate':_0x42b0('0x4'),'afterDestroy':_0x42b0('0x5')};function emitEvent(_0xe8dd0c){return function(_0x3f9a87,_0x5c1afb,_0x52f91b){WhatsappQueueEvents[_0x42b0('0x6')](_0xe8dd0c+':'+_0x3f9a87['id'],_0x3f9a87);WhatsappQueueEvents['emit'](_0xe8dd0c,_0x3f9a87);_0x52f91b(null);};}for(var e in events){if(events[_0x42b0('0x7')](e)){var event=events[e];WhatsappQueue[_0x42b0('0x8')](e,emitEvent(event));}}module[_0x42b0('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x6306=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x6306,0x126));var _0x6630=function(_0x5201a8,_0x5742af){_0x5201a8=_0x5201a8-0x0;var _0x4659f4=_0x6306[_0x5201a8];return _0x4659f4;};'use strict';var EventEmitter=require(_0x6630('0x0'));var WhatsappQueue=require(_0x6630('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6630('0x2')](0x0);var events={'afterCreate':_0x6630('0x3'),'afterUpdate':_0x6630('0x4'),'afterDestroy':_0x6630('0x5')};function emitEvent(_0x364285){return function(_0x52b807,_0x270990,_0x4c23f8){WhatsappQueueEvents[_0x6630('0x6')](_0x364285+':'+_0x52b807['id'],_0x52b807);WhatsappQueueEvents[_0x6630('0x6')](_0x364285,_0x52b807);_0x4c23f8(null);};}for(var e in events){if(events[_0x6630('0x7')](e)){var event=events[e];WhatsappQueue[_0x6630('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ec4a447..5712e56 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 _0xd99a=['exports','WhatsappQueue','whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes'];(function(_0x302694,_0x55a959){var _0x57e62b=function(_0x20f59e){while(--_0x20f59e){_0x302694['push'](_0x302694['shift']());}};_0x57e62b(++_0x55a959);}(_0xd99a,0x93));var _0xad99=function(_0x44d793,_0x43c013){_0x44d793=_0x44d793-0x0;var _0x7dbad=_0xd99a[_0x44d793];return _0x7dbad;};'use strict';var _=require(_0xad99('0x0'));var util=require(_0xad99('0x1'));var logger=require('../../config/logger')(_0xad99('0x2'));var moment=require(_0xad99('0x3'));var BPromise=require(_0xad99('0x4'));var rp=require(_0xad99('0x5'));var fs=require('fs');var path=require(_0xad99('0x6'));var rimraf=require(_0xad99('0x7'));var config=require('../../config/environment');var attributes=require(_0xad99('0x8'));module[_0xad99('0x9')]=function(_0x46771e,_0x55ebb4){return _0x46771e['define'](_0xad99('0xa'),attributes,{'tableName':_0xad99('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdbf=['request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','whatsapp_queues','lodash','util','api','moment'];(function(_0x4c9be3,_0xbd03f3){var _0x583c50=function(_0x51006c){while(--_0x51006c){_0x4c9be3['push'](_0x4c9be3['shift']());}};_0x583c50(++_0xbd03f3);}(_0xcdbf,0x80));var _0xfcdb=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xcdbf[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0xfcdb('0x0'));var util=require(_0xfcdb('0x1'));var logger=require('../../config/logger')(_0xfcdb('0x2'));var moment=require(_0xfcdb('0x3'));var BPromise=require('bluebird');var rp=require(_0xfcdb('0x4'));var fs=require('fs');var path=require(_0xfcdb('0x5'));var rimraf=require(_0xfcdb('0x6'));var config=require(_0xfcdb('0x7'));var attributes=require(_0xfcdb('0x8'));module['exports']=function(_0x3759ff,_0x335ec5){return _0x3759ff[_0xfcdb('0x9')]('WhatsappQueue',attributes,{'tableName':_0xfcdb('0xa'),'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 54f9183..7d3c86f 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 _0x5ee9=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./whatsappQueue.socket','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','find','ShowWhatsappQueue','lodash'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x5ee9,0x9b));var _0x95ee=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5ee9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x95ee('0x0'));var util=require(_0x95ee('0x1'));var moment=require(_0x95ee('0x2'));var BPromise=require(_0x95ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95ee('0x4'));var db=require(_0x95ee('0x5'))['db'];var utils=require(_0x95ee('0x6'));var logger=require(_0x95ee('0x7'))('rpc');var config=require(_0x95ee('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x95ee('0x9')]({'port':0x232a});config[_0x95ee('0xa')]=_[_0x95ee('0xb')](config['redis'],{'host':_0x95ee('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x95ee('0xa')]));require(_0x95ee('0xd'))['register'](socket);function respondWithRpcPromise(_0x29dd74,_0x3fe3ba,_0x121df2){return new BPromise(function(_0x5d32dc,_0x197987){return client[_0x95ee('0xe')](_0x29dd74,_0x121df2)['then'](function(_0x1dc934){logger['info'](_0x95ee('0xf'),_0x3fe3ba,_0x95ee('0x10'));logger[_0x95ee('0x11')](_0x95ee('0x12'),_0x3fe3ba,_0x95ee('0x10'),JSON['stringify'](_0x1dc934));if(_0x1dc934[_0x95ee('0x13')]){if(_0x1dc934[_0x95ee('0x13')][_0x95ee('0x14')]===0x1f4){logger[_0x95ee('0x13')](_0x95ee('0xf'),_0x3fe3ba,_0x1dc934[_0x95ee('0x13')][_0x95ee('0x15')]);return _0x197987(_0x1dc934[_0x95ee('0x13')][_0x95ee('0x15')]);}logger[_0x95ee('0x13')](_0x95ee('0xf'),_0x3fe3ba,_0x1dc934[_0x95ee('0x13')]['message']);return _0x5d32dc(_0x1dc934[_0x95ee('0x13')][_0x95ee('0x15')]);}else{logger[_0x95ee('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x3fe3ba,_0x95ee('0x10'));_0x5d32dc(_0x1dc934[_0x95ee('0x17')][_0x95ee('0x15')]);}})['catch'](function(_0x498f7e){logger[_0x95ee('0x13')](_0x95ee('0xf'),_0x3fe3ba,_0x498f7e);_0x197987(_0x498f7e);});});}exports[_0x95ee('0x18')]=function(_0x201ce4){var _0x2f20c1=this;return new Promise(function(_0x4ff286,_0xe38051){return db[_0x95ee('0x19')][_0x95ee('0x1a')]({'raw':_0x201ce4[_0x95ee('0x1b')]?_0x201ce4['options'][_0x95ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x201ce4[_0x95ee('0x1b')]?_0x201ce4[_0x95ee('0x1b')][_0x95ee('0x1d')]||null:null,'attributes':_0x201ce4[_0x95ee('0x1b')]?_0x201ce4['options']['attributes']||null:null,'limit':_0x201ce4['options']?_0x201ce4[_0x95ee('0x1b')][_0x95ee('0x1e')]||null:null,'include':_0x201ce4['options']?_0x201ce4[_0x95ee('0x1b')][_0x95ee('0x1f')]?_[_0x95ee('0x20')](_0x201ce4[_0x95ee('0x1b')][_0x95ee('0x1f')],function(_0x3b91f7){return{'model':db[_0x3b91f7[_0x95ee('0x21')]],'as':_0x3b91f7['as'],'attributes':_0x3b91f7['attributes'],'include':_0x3b91f7[_0x95ee('0x1f')]?_[_0x95ee('0x20')](_0x3b91f7[_0x95ee('0x1f')],function(_0xac5cbd){return{'model':db[_0xac5cbd[_0x95ee('0x21')]],'as':_0xac5cbd['as'],'attributes':_0xac5cbd[_0x95ee('0x22')],'include':_0xac5cbd['include']?_[_0x95ee('0x20')](_0xac5cbd['include'],function(_0x37cae2){return{'model':db[_0x37cae2[_0x95ee('0x21')]],'as':_0x37cae2['as'],'attributes':_0x37cae2[_0x95ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x95ee('0x23')](function(_0x1260af){logger[_0x95ee('0x16')](_0x95ee('0x18'),_0x201ce4);logger[_0x95ee('0x11')]('GetWhatsappQueue',_0x201ce4,JSON[_0x95ee('0x24')](_0x1260af));_0x4ff286(_0x1260af);})['catch'](function(_0x3d140c){logger[_0x95ee('0x13')](_0x95ee('0x18'),_0x3d140c[_0x95ee('0x15')],_0x201ce4);_0xe38051(_0x2f20c1[_0x95ee('0x13')](0x1f4,_0x3d140c[_0x95ee('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x250e39){var _0x4dee18=this;return new Promise(function(_0x44c801,_0x35a2bb){return db[_0x95ee('0x19')][_0x95ee('0x25')]({'raw':_0x250e39[_0x95ee('0x1b')]?_0x250e39[_0x95ee('0x1b')][_0x95ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x250e39['options']?_0x250e39[_0x95ee('0x1b')][_0x95ee('0x1d')]||null:null,'attributes':_0x250e39[_0x95ee('0x1b')]?_0x250e39[_0x95ee('0x1b')][_0x95ee('0x22')]||null:null,'include':_0x250e39['options']?_0x250e39[_0x95ee('0x1b')][_0x95ee('0x1f')]?_[_0x95ee('0x20')](_0x250e39[_0x95ee('0x1b')]['include'],function(_0x5c0c5c){return{'model':db[_0x5c0c5c['model']],'as':_0x5c0c5c['as'],'attributes':_0x5c0c5c['attributes'],'include':_0x5c0c5c[_0x95ee('0x1f')]?_[_0x95ee('0x20')](_0x5c0c5c[_0x95ee('0x1f')],function(_0x2878e7){return{'model':db[_0x2878e7[_0x95ee('0x21')]],'as':_0x2878e7['as'],'attributes':_0x2878e7[_0x95ee('0x22')],'include':_0x2878e7['include']?_[_0x95ee('0x20')](_0x2878e7[_0x95ee('0x1f')],function(_0x2ab4aa){return{'model':db[_0x2ab4aa[_0x95ee('0x21')]],'as':_0x2ab4aa['as'],'attributes':_0x2ab4aa[_0x95ee('0x22')]};}):[]};}):[]};}):[]:[]})[_0x95ee('0x23')](function(_0x325a01){logger['info'](_0x95ee('0x26'),_0x250e39);logger[_0x95ee('0x11')]('ShowWhatsappQueue',_0x250e39,JSON[_0x95ee('0x24')](_0x325a01));_0x44c801(_0x325a01);})['catch'](function(_0x113cb1){logger['error'](_0x95ee('0x26'),_0x113cb1[_0x95ee('0x15')],_0x250e39);_0x35a2bb(_0x4dee18[_0x95ee('0x13')](0x1f4,_0x113cb1[_0x95ee('0x15')]));});});}; \ No newline at end of file +var _0x370d=['request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','WhatsappQueue','findAll','raw','options','include','attributes','map','model','GetWhatsappQueue','ShowWhatsappQueue','find','where','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappQueue,\x20%s,\x20%s'];(function(_0x41fd1e,_0x1fdedb){var _0x4c55cf=function(_0x2e999c){while(--_0x2e999c){_0x41fd1e['push'](_0x41fd1e['shift']());}};_0x4c55cf(++_0x1fdedb);}(_0x370d,0x17c));var _0xd370=function(_0x1afd6f,_0x1dc055){_0x1afd6f=_0x1afd6f-0x0;var _0x1206ff=_0x370d[_0x1afd6f];return _0x1206ff;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require(_0xd370('0x2'));var BPromise=require(_0xd370('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd370('0x4'));var db=require(_0xd370('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd370('0x6'));var config=require(_0xd370('0x7'));var jayson=require(_0xd370('0x8'));var client=jayson[_0xd370('0x9')][_0xd370('0xa')]({'port':0x232a});config[_0xd370('0xb')]=_[_0xd370('0xc')](config[_0xd370('0xb')],{'host':_0xd370('0xd'),'port':0x18eb});var socket=require(_0xd370('0xe'))(new Redis(config[_0xd370('0xb')]));require('./whatsappQueue.socket')[_0xd370('0xf')](socket);function respondWithRpcPromise(_0x4a93cc,_0x3b2a22,_0x5e0bed){return new BPromise(function(_0x1b94ad,_0x27762f){return client[_0xd370('0x10')](_0x4a93cc,_0x5e0bed)[_0xd370('0x11')](function(_0x37317f){logger[_0xd370('0x12')](_0xd370('0x13'),_0x3b2a22,_0xd370('0x14'));logger['debug'](_0xd370('0x15'),_0x3b2a22,_0xd370('0x14'),JSON[_0xd370('0x16')](_0x37317f));if(_0x37317f[_0xd370('0x17')]){if(_0x37317f[_0xd370('0x17')]['code']===0x1f4){logger['error'](_0xd370('0x13'),_0x3b2a22,_0x37317f[_0xd370('0x17')][_0xd370('0x18')]);return _0x27762f(_0x37317f[_0xd370('0x17')][_0xd370('0x18')]);}logger[_0xd370('0x17')](_0xd370('0x13'),_0x3b2a22,_0x37317f[_0xd370('0x17')][_0xd370('0x18')]);return _0x1b94ad(_0x37317f['error'][_0xd370('0x18')]);}else{logger[_0xd370('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x3b2a22,_0xd370('0x14'));_0x1b94ad(_0x37317f[_0xd370('0x19')][_0xd370('0x18')]);}})[_0xd370('0x1a')](function(_0x3bda97){logger[_0xd370('0x17')](_0xd370('0x13'),_0x3b2a22,_0x3bda97);_0x27762f(_0x3bda97);});});}exports['GetWhatsappQueue']=function(_0x33ad2f){var _0x1deff0=this;return new Promise(function(_0x2fbe3b,_0xe31530){return db[_0xd370('0x1b')][_0xd370('0x1c')]({'raw':_0x33ad2f['options']?_0x33ad2f['options'][_0xd370('0x1d')]===undefined?!![]:![]:!![],'where':_0x33ad2f['options']?_0x33ad2f['options']['where']||null:null,'attributes':_0x33ad2f[_0xd370('0x1e')]?_0x33ad2f['options']['attributes']||null:null,'limit':_0x33ad2f[_0xd370('0x1e')]?_0x33ad2f[_0xd370('0x1e')]['limit']||null:null,'include':_0x33ad2f[_0xd370('0x1e')]?_0x33ad2f[_0xd370('0x1e')][_0xd370('0x1f')]?_['map'](_0x33ad2f['options'][_0xd370('0x1f')],function(_0x1a8ab5){return{'model':db[_0x1a8ab5['model']],'as':_0x1a8ab5['as'],'attributes':_0x1a8ab5[_0xd370('0x20')],'include':_0x1a8ab5[_0xd370('0x1f')]?_[_0xd370('0x21')](_0x1a8ab5[_0xd370('0x1f')],function(_0x3b3463){return{'model':db[_0x3b3463[_0xd370('0x22')]],'as':_0x3b3463['as'],'attributes':_0x3b3463['attributes'],'include':_0x3b3463[_0xd370('0x1f')]?_[_0xd370('0x21')](_0x3b3463[_0xd370('0x1f')],function(_0x22461b){return{'model':db[_0x22461b['model']],'as':_0x22461b['as'],'attributes':_0x22461b[_0xd370('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd370('0x11')](function(_0x203d06){logger['info'](_0xd370('0x23'),_0x33ad2f);logger['debug'](_0xd370('0x23'),_0x33ad2f,JSON[_0xd370('0x16')](_0x203d06));_0x2fbe3b(_0x203d06);})['catch'](function(_0x36b0fe){logger[_0xd370('0x17')]('GetWhatsappQueue',_0x36b0fe[_0xd370('0x18')],_0x33ad2f);_0xe31530(_0x1deff0['error'](0x1f4,_0x36b0fe[_0xd370('0x18')]));});});};exports[_0xd370('0x24')]=function(_0x1aa46d){var _0x93f74d=this;return new Promise(function(_0x2598ca,_0x3d9a4b){return db[_0xd370('0x1b')][_0xd370('0x25')]({'raw':_0x1aa46d['options']?_0x1aa46d[_0xd370('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1aa46d['options']?_0x1aa46d[_0xd370('0x1e')][_0xd370('0x26')]||null:null,'attributes':_0x1aa46d[_0xd370('0x1e')]?_0x1aa46d[_0xd370('0x1e')]['attributes']||null:null,'include':_0x1aa46d[_0xd370('0x1e')]?_0x1aa46d['options']['include']?_['map'](_0x1aa46d[_0xd370('0x1e')][_0xd370('0x1f')],function(_0x59d964){return{'model':db[_0x59d964['model']],'as':_0x59d964['as'],'attributes':_0x59d964['attributes'],'include':_0x59d964[_0xd370('0x1f')]?_[_0xd370('0x21')](_0x59d964['include'],function(_0x570740){return{'model':db[_0x570740['model']],'as':_0x570740['as'],'attributes':_0x570740[_0xd370('0x20')],'include':_0x570740[_0xd370('0x1f')]?_['map'](_0x570740[_0xd370('0x1f')],function(_0x18efc5){return{'model':db[_0x18efc5[_0xd370('0x22')]],'as':_0x18efc5['as'],'attributes':_0x18efc5[_0xd370('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x519ac6){logger['info'](_0xd370('0x24'),_0x1aa46d);logger[_0xd370('0x27')](_0xd370('0x24'),_0x1aa46d,JSON[_0xd370('0x16')](_0x519ac6));_0x2598ca(_0x519ac6);})[_0xd370('0x1a')](function(_0x103f65){logger[_0xd370('0x17')](_0xd370('0x24'),_0x103f65[_0xd370('0x18')],_0x1aa46d);_0x3d9a4b(_0x93f74d[_0xd370('0x17')](0x1f4,_0x103f65[_0xd370('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 42663d0..b2b7188 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 _0xd536=['removeListener','register','length','whatsappQueue:','save','update','emit'];(function(_0x4b4981,_0x34d066){var _0x36e67c=function(_0x3bc534){while(--_0x3bc534){_0x4b4981['push'](_0x4b4981['shift']());}};_0x36e67c(++_0x34d066);}(_0xd536,0x1b6));var _0x6d53=function(_0x25e41c,_0x1c80b4){_0x25e41c=_0x25e41c-0x0;var _0x51fba8=_0xd536[_0x25e41c];return _0x51fba8;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x6d53('0x0'),'remove',_0x6d53('0x1')];function createListener(_0x4fa1f0,_0x186c00){return function(_0x331fad){_0x186c00[_0x6d53('0x2')](_0x4fa1f0,_0x331fad);};}function removeListener(_0x5b7057,_0x48e28b){return function(){WhatsappQueueEvents[_0x6d53('0x3')](_0x5b7057,_0x48e28b);};}exports[_0x6d53('0x4')]=function(_0x5b230f){for(var _0x223b43=0x0,_0x1bb66e=events[_0x6d53('0x5')];_0x223b43<_0x1bb66e;_0x223b43++){var _0x4444a5=events[_0x223b43];var _0x6c3aee=createListener(_0x6d53('0x6')+_0x4444a5,_0x5b230f);WhatsappQueueEvents['on'](_0x4444a5,_0x6c3aee);}}; \ No newline at end of file +var _0x0980=['whatsappQueue:','./whatsappQueue.events','remove','update','removeListener','register','length'];(function(_0x384e55,_0x2d9975){var _0x5970ab=function(_0x400ffb){while(--_0x400ffb){_0x384e55['push'](_0x384e55['shift']());}};_0x5970ab(++_0x2d9975);}(_0x0980,0xb0));var _0x0098=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0980[_0x49b207];return _0x2dc8fa;};'use strict';var WhatsappQueueEvents=require(_0x0098('0x0'));var events=['save',_0x0098('0x1'),_0x0098('0x2')];function createListener(_0x6cd531,_0x4318a9){return function(_0x1b8e8f){_0x4318a9['emit'](_0x6cd531,_0x1b8e8f);};}function removeListener(_0x12686e,_0x3c3c60){return function(){WhatsappQueueEvents[_0x0098('0x3')](_0x12686e,_0x3c3c60);};}exports[_0x0098('0x4')]=function(_0x184d93){for(var _0x2f3b3d=0x0,_0x24cb0=events[_0x0098('0x5')];_0x2f3b3d<_0x24cb0;_0x2f3b3d++){var _0x35cceb=events[_0x2f3b3d];var _0x235c05=createListener(_0x0098('0x6')+_0x35cceb,_0x184d93);WhatsappQueueEvents['on'](_0x35cceb,_0x235c05);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 65b0425..64a970a 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 _0x50a3=['express','Router','fs-extra','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','create','put','delete','multer','util','path','connect-timeout'];(function(_0x36cdb9,_0x28a962){var _0x368be1=function(_0x200fe6){while(--_0x200fe6){_0x36cdb9['push'](_0x36cdb9['shift']());}};_0x368be1(++_0x28a962);}(_0x50a3,0x172));var _0x350a=function(_0x5f0501,_0x19196e){_0x5f0501=_0x5f0501-0x0;var _0x3c2c45=_0x50a3[_0x5f0501];return _0x3c2c45;};'use strict';var multer=require(_0x350a('0x0'));var util=require(_0x350a('0x1'));var path=require(_0x350a('0x2'));var timeout=require(_0x350a('0x3'));var express=require(_0x350a('0x4'));var router=express[_0x350a('0x5')]();var fs_extra=require(_0x350a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x350a('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x350a('0x8')](),controller['index']);router[_0x350a('0x9')](_0x350a('0xa'),auth['isAuthenticated'](),controller[_0x350a('0xb')]);router[_0x350a('0x9')](_0x350a('0xc'),auth[_0x350a('0x8')](),controller[_0x350a('0xd')]);router['post']('/',auth[_0x350a('0x8')](),controller[_0x350a('0xe')]);router[_0x350a('0xf')](_0x350a('0xc'),auth[_0x350a('0x8')](),controller['update']);router[_0x350a('0x10')]('/:id',auth[_0x350a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa24d=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3f958c,_0x368f68){var _0x1c42e3=function(_0xfbef66){while(--_0xfbef66){_0x3f958c['push'](_0x3f958c['shift']());}};_0x1c42e3(++_0x368f68);}(_0xa24d,0x178));var _0xda24=function(_0x43347e,_0x12f3ac){_0x43347e=_0x43347e-0x0;var _0xcb5363=_0xa24d[_0x43347e];return _0xcb5363;};'use strict';var multer=require(_0xda24('0x0'));var util=require(_0xda24('0x1'));var path=require(_0xda24('0x2'));var timeout=require(_0xda24('0x3'));var express=require(_0xda24('0x4'));var router=express[_0xda24('0x5')]();var fs_extra=require(_0xda24('0x6'));var auth=require(_0xda24('0x7'));var interaction=require(_0xda24('0x8'));var config=require(_0xda24('0x9'));var controller=require(_0xda24('0xa'));router[_0xda24('0xb')]('/',auth[_0xda24('0xc')](),controller[_0xda24('0xd')]);router[_0xda24('0xb')](_0xda24('0xe'),auth['isAuthenticated'](),controller[_0xda24('0xf')]);router[_0xda24('0xb')](_0xda24('0x10'),auth['isAuthenticated'](),controller[_0xda24('0x11')]);router[_0xda24('0x12')]('/',auth[_0xda24('0xc')](),controller[_0xda24('0x13')]);router[_0xda24('0x14')](_0xda24('0x10'),auth[_0xda24('0xc')](),controller['update']);router[_0xda24('0x15')](_0xda24('0x10'),auth[_0xda24('0xc')](),controller[_0xda24('0x16')]);module[_0xda24('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 88a97e9..19b0291 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(_0x4c1221,_0x466975){var _0x16bfc5=function(_0x216117){while(--_0x216117){_0x4c1221['push'](_0x4c1221['shift']());}};_0x16bfc5(++_0x466975);}(_0x7a54,0x106));var _0x47a5=function(_0x1a3b62,_0x9ac20){_0x1a3b62=_0x1a3b62-0x0;var _0x366a18=_0x7a54[_0x1a3b62];return _0x366a18;};'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(_0x4c90e1,_0x2bcc12){var _0x28d3ae=function(_0x3a7659){while(--_0x3a7659){_0x4c90e1['push'](_0x4c90e1['shift']());}};_0x28d3ae(++_0x2bcc12);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 6b034bd..6b8c450 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 _0xab40=['describe','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','then','stack','name','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','WhatsappQueueReport','findAll','rows','show','params','include','catch','create','body','update','find'];(function(_0x4cb7c3,_0x36c816){var _0x15afef=function(_0x4d937e){while(--_0x4d937e){_0x4cb7c3['push'](_0x4cb7c3['shift']());}};_0x15afef(++_0x36c816);}(_0xab40,0xcd));var _0x0ab4=function(_0x532b36,_0x27acf8){_0x532b36=_0x532b36-0x0;var _0x2cca70=_0xab40[_0x532b36];return _0x2cca70;};'use strict';var emlformat=require(_0x0ab4('0x0'));var rimraf=require(_0x0ab4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ab4('0x2'));var BPromise=require(_0x0ab4('0x3'));var Mustache=require(_0x0ab4('0x4'));var util=require(_0x0ab4('0x5'));var path=require(_0x0ab4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ab4('0x8'));var squel=require(_0x0ab4('0x9'));var crypto=require(_0x0ab4('0xa'));var jsforce=require(_0x0ab4('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0ab4('0xc'));var Redis=require(_0x0ab4('0xd'));var authService=require(_0x0ab4('0xe'));var qs=require(_0x0ab4('0xf'));var as=require(_0x0ab4('0x10'));var hardwareService=require(_0x0ab4('0x11'));var logger=require(_0x0ab4('0x12'))(_0x0ab4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ab4('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x249dc3,_0x45e6fd){_0x45e6fd=_0x45e6fd||0xcc;return function(_0x1e7555){if(_0x1e7555){return _0x249dc3[_0x0ab4('0x15')](_0x45e6fd);}return _0x249dc3[_0x0ab4('0x16')](_0x45e6fd)[_0x0ab4('0x17')]();};}function respondWithResult(_0x112162,_0x2cc644){_0x2cc644=_0x2cc644||0xc8;return function(_0x3cb1df){if(_0x3cb1df){return _0x112162[_0x0ab4('0x16')](_0x2cc644)[_0x0ab4('0x18')](_0x3cb1df);}};}function respondWithFilteredResult(_0x36d246,_0x293e20){return function(_0x45fad1){if(_0x45fad1){var _0x2a83a8=typeof _0x293e20[_0x0ab4('0x19')]===_0x0ab4('0x1a')&&typeof _0x293e20[_0x0ab4('0x1b')]==='undefined';var _0x5000d4=_0x45fad1['count'];var _0x17422f=_0x2a83a8?0x0:_0x293e20[_0x0ab4('0x19')];var _0x2f50d2=_0x2a83a8?_0x45fad1['count']:_0x293e20[_0x0ab4('0x19')]+_0x293e20[_0x0ab4('0x1b')];var _0x212ebd;if(_0x2f50d2>=_0x5000d4){_0x2f50d2=_0x5000d4;_0x212ebd=0xc8;}else{_0x212ebd=0xce;}_0x36d246[_0x0ab4('0x16')](_0x212ebd);return _0x36d246['set']('Content-Range',_0x17422f+'-'+_0x2f50d2+'/'+_0x5000d4)[_0x0ab4('0x18')](_0x45fad1);}return null;};}function patchUpdates(_0x5b1ed5){return function(_0x2b0e29){try{jsonpatch[_0x0ab4('0x1c')](_0x2b0e29,_0x5b1ed5,!![]);}catch(_0x5bb1d0){return BPromise[_0x0ab4('0x1d')](_0x5bb1d0);}return _0x2b0e29[_0x0ab4('0x1e')]();};}function saveUpdates(_0x2c55b3,_0x1d5c14){return function(_0x12d06d){if(_0x12d06d){return _0x12d06d['update'](_0x2c55b3)['then'](function(_0x24b929){return _0x24b929;});}return null;};}function removeEntity(_0x14087f,_0x392afe){return function(_0x13c882){if(_0x13c882){return _0x13c882['destroy']()[_0x0ab4('0x1f')](function(){_0x14087f[_0x0ab4('0x16')](0xcc)[_0x0ab4('0x17')]();});}};}function handleEntityNotFound(_0x4ea9aa,_0x4c5caf){return function(_0x176ff1){if(!_0x176ff1){_0x4ea9aa[_0x0ab4('0x15')](0x194);}return _0x176ff1;};}function handleError(_0x1a17ce,_0x4ae515){_0x4ae515=_0x4ae515||0x1f4;return function(_0x519b23){logger['error'](_0x519b23[_0x0ab4('0x20')]);if(_0x519b23['name']){delete _0x519b23[_0x0ab4('0x21')];}_0x1a17ce[_0x0ab4('0x16')](_0x4ae515)['send'](_0x519b23);};}exports['index']=function(_0x4d0cc1,_0x3d38a4){var _0x183bac={},_0x1cfdad={},_0x3f61cb={'count':0x0,'rows':[]};var _0x25385e=_['map'](db['WhatsappQueueReport']['rawAttributes'],function(_0x2e7a97){return{'name':_0x2e7a97[_0x0ab4('0x22')],'type':_0x2e7a97[_0x0ab4('0x23')][_0x0ab4('0x24')]};});_0x1cfdad[_0x0ab4('0x25')]=_['map'](_0x25385e,'name');_0x1cfdad[_0x0ab4('0x26')]=_[_0x0ab4('0x27')](_0x4d0cc1[_0x0ab4('0x26')]);_0x1cfdad['filters']=_['intersection'](_0x1cfdad[_0x0ab4('0x25')],_0x1cfdad['query']);_0x183bac[_0x0ab4('0x28')]=_[_0x0ab4('0x29')](_0x1cfdad[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x183bac['attributes']=_0x183bac[_0x0ab4('0x28')][_0x0ab4('0x2b')]?_0x183bac[_0x0ab4('0x28')]:_0x1cfdad[_0x0ab4('0x25')];if(!_0x4d0cc1['query']['hasOwnProperty'](_0x0ab4('0x2c'))){_0x183bac[_0x0ab4('0x1b')]=qs[_0x0ab4('0x1b')](_0x4d0cc1['query']['limit']);_0x183bac['offset']=qs[_0x0ab4('0x19')](_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x19')]);}_0x183bac['order']=qs['sort'](_0x4d0cc1['query'][_0x0ab4('0x2d')]);_0x183bac[_0x0ab4('0x2e')]=qs[_0x0ab4('0x2f')](_[_0x0ab4('0x30')](_0x4d0cc1[_0x0ab4('0x26')],_0x1cfdad[_0x0ab4('0x2f')]),_0x25385e);if(_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]){_0x183bac[_0x0ab4('0x2e')]=_[_0x0ab4('0x32')](_0x183bac['where'],{'$or':_[_0x0ab4('0x33')](_0x25385e,function(_0x31e234){if(_0x31e234[_0x0ab4('0x23')]!==_0x0ab4('0x34')){var _0x2e1da9={};_0x2e1da9[_0x31e234[_0x0ab4('0x21')]]={'$like':'%'+_0x4d0cc1[_0x0ab4('0x26')][_0x0ab4('0x31')]+'%'};return _0x2e1da9;}})});}_0x183bac=_[_0x0ab4('0x32')]({},_0x183bac,_0x4d0cc1[_0x0ab4('0x35')]);var _0x449437={'where':_0x183bac[_0x0ab4('0x2e')]};return db['WhatsappQueueReport'][_0x0ab4('0x36')](_0x449437)[_0x0ab4('0x1f')](function(_0x1cee1c){_0x3f61cb[_0x0ab4('0x36')]=_0x1cee1c;if(_0x4d0cc1['query'][_0x0ab4('0x37')]){_0x183bac['include']=[{'all':!![]}];}return db[_0x0ab4('0x38')][_0x0ab4('0x39')](_0x183bac);})[_0x0ab4('0x1f')](function(_0x245021){_0x3f61cb[_0x0ab4('0x3a')]=_0x245021;return _0x3f61cb;})[_0x0ab4('0x1f')](respondWithFilteredResult(_0x3d38a4,_0x183bac))['catch'](handleError(_0x3d38a4,null));};exports[_0x0ab4('0x3b')]=function(_0x3cc364,_0xe3df73){var _0x48029f={'raw':!![],'where':{'id':_0x3cc364[_0x0ab4('0x3c')]['id']}},_0x395e0b={};_0x395e0b[_0x0ab4('0x25')]=_[_0x0ab4('0x27')](db[_0x0ab4('0x38')]['rawAttributes']);_0x395e0b['query']=_['keys'](_0x3cc364[_0x0ab4('0x26')]);_0x395e0b[_0x0ab4('0x2f')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],_0x395e0b['query']);_0x48029f[_0x0ab4('0x28')]=_['intersection'](_0x395e0b[_0x0ab4('0x25')],qs[_0x0ab4('0x2a')](_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x2a')]));_0x48029f[_0x0ab4('0x28')]=_0x48029f[_0x0ab4('0x28')]['length']?_0x48029f[_0x0ab4('0x28')]:_0x395e0b[_0x0ab4('0x25')];if(_0x3cc364[_0x0ab4('0x26')][_0x0ab4('0x37')]){_0x48029f[_0x0ab4('0x3d')]=[{'all':!![]}];}_0x48029f=_[_0x0ab4('0x32')]({},_0x48029f,_0x3cc364['options']);return db[_0x0ab4('0x38')]['find'](_0x48029f)[_0x0ab4('0x1f')](handleEntityNotFound(_0xe3df73,null))[_0x0ab4('0x1f')](respondWithResult(_0xe3df73,null))[_0x0ab4('0x3e')](handleError(_0xe3df73,null));};exports['create']=function(_0x5b09e,_0x1fcc3b){return db[_0x0ab4('0x38')][_0x0ab4('0x3f')](_0x5b09e[_0x0ab4('0x40')],{})[_0x0ab4('0x1f')](respondWithResult(_0x1fcc3b,0xc9))['catch'](handleError(_0x1fcc3b,null));};exports[_0x0ab4('0x41')]=function(_0xdcc118,_0x302894){if(_0xdcc118[_0x0ab4('0x40')]['id']){delete _0xdcc118[_0x0ab4('0x40')]['id'];}return db[_0x0ab4('0x38')][_0x0ab4('0x42')]({'where':{'id':_0xdcc118[_0x0ab4('0x3c')]['id']}})[_0x0ab4('0x1f')](handleEntityNotFound(_0x302894,null))[_0x0ab4('0x1f')](saveUpdates(_0xdcc118[_0x0ab4('0x40')],null))[_0x0ab4('0x1f')](respondWithResult(_0x302894,null))[_0x0ab4('0x3e')](handleError(_0x302894,null));};exports['destroy']=function(_0x2c3a0a,_0x354bc){return db['WhatsappQueueReport'][_0x0ab4('0x42')]({'where':{'id':_0x2c3a0a['params']['id']}})['then'](handleEntityNotFound(_0x354bc,null))[_0x0ab4('0x1f')](removeEntity(_0x354bc,null))[_0x0ab4('0x3e')](handleError(_0x354bc,null));};exports[_0x0ab4('0x43')]=function(_0x4966bc,_0x12a2df){return db[_0x0ab4('0x38')][_0x0ab4('0x43')]()[_0x0ab4('0x1f')](respondWithResult(_0x12a2df,null))[_0x0ab4('0x3e')](handleError(_0x12a2df,null));}; \ No newline at end of file +var _0x57f8=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x57f8,0x198));var _0x857f=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0x57f8[_0x5c38cd];return _0xc985ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));};exports['describe']=function(_0x5464f4,_0x13ef75){return db[_0x857f('0x2f')][_0x857f('0x4d')]()[_0x857f('0x28')](respondWithResult(_0x13ef75,null))[_0x857f('0x47')](handleError(_0x13ef75,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 12abc54..cfd4692 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 _0xa616=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa616,0xb0));var _0x6a61=function(_0x4ee695,_0x5a579b){_0x4ee695=_0x4ee695-0x0;var _0x165508=_0xa616[_0x4ee695];return _0x165508;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6a61('0x0'));var moment=require(_0x6a61('0x1'));var BPromise=require('bluebird');var rp=require(_0x6a61('0x2'));var fs=require('fs');var path=require(_0x6a61('0x3'));var rimraf=require(_0x6a61('0x4'));var config=require(_0x6a61('0x5'));var attributes=require(_0x6a61('0x6'));module['exports']=function(_0x28fc03,_0x9f36b5){return _0x28fc03[_0x6a61('0x7')](_0x6a61('0x8'),attributes,{'tableName':_0x6a61('0x9'),'paranoid':![],'indexes':[{'name':_0x6a61('0xa'),'fields':[_0x6a61('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36a6=['path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','uniqueid','lodash','api','moment','bluebird','request-promise'];(function(_0x4e8dc7,_0x5ee10f){var _0x543faa=function(_0x3a3424){while(--_0x3a3424){_0x4e8dc7['push'](_0x4e8dc7['shift']());}};_0x543faa(++_0x5ee10f);}(_0x36a6,0x17b));var _0x636a=function(_0xe15312,_0x3dc2e9){_0xe15312=_0xe15312-0x0;var _0x986d31=_0x36a6[_0xe15312];return _0x986d31;};'use strict';var _=require(_0x636a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x636a('0x1'));var moment=require(_0x636a('0x2'));var BPromise=require(_0x636a('0x3'));var rp=require(_0x636a('0x4'));var fs=require('fs');var path=require(_0x636a('0x5'));var rimraf=require(_0x636a('0x6'));var config=require(_0x636a('0x7'));var attributes=require(_0x636a('0x8'));module[_0x636a('0x9')]=function(_0x11186d,_0x36935d){return _0x11186d[_0x636a('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x636a('0xb'),'fields':[_0x636a('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 9e90355..1cbec98 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 _0xa006=['http','then','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','where','limit','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3a06ba,_0x23452e){var _0x206f4c=function(_0x18dc87){while(--_0x18dc87){_0x3a06ba['push'](_0x3a06ba['shift']());}};_0x206f4c(++_0x23452e);}(_0xa006,0xe3));var _0x6a00=function(_0x6aa91c,_0x45fe33){_0x6aa91c=_0x6aa91c-0x0;var _0x5374e5=_0xa006[_0x6aa91c];return _0x5374e5;};'use strict';var _=require(_0x6a00('0x0'));var util=require('util');var moment=require(_0x6a00('0x1'));var BPromise=require(_0x6a00('0x2'));var rs=require(_0x6a00('0x3'));var fs=require('fs');var Redis=require(_0x6a00('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a00('0x5'));var logger=require(_0x6a00('0x6'))(_0x6a00('0x7'));var config=require(_0x6a00('0x8'));var jayson=require(_0x6a00('0x9'));var client=jayson[_0x6a00('0xa')][_0x6a00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x294398,_0x215b84,_0x1876a6){return new BPromise(function(_0x57be04,_0x34ace2){return client['request'](_0x294398,_0x1876a6)[_0x6a00('0xc')](function(_0x37bc84){logger['info'](_0x6a00('0xd'),_0x215b84,'request\x20sent');logger[_0x6a00('0xe')](_0x6a00('0xf'),_0x215b84,_0x6a00('0x10'),JSON[_0x6a00('0x11')](_0x37bc84));if(_0x37bc84['error']){if(_0x37bc84[_0x6a00('0x12')][_0x6a00('0x13')]===0x1f4){logger['error'](_0x6a00('0xd'),_0x215b84,_0x37bc84['error'][_0x6a00('0x14')]);return _0x34ace2(_0x37bc84[_0x6a00('0x12')]['message']);}logger[_0x6a00('0x12')](_0x6a00('0xd'),_0x215b84,_0x37bc84[_0x6a00('0x12')][_0x6a00('0x14')]);return _0x57be04(_0x37bc84[_0x6a00('0x12')]['message']);}else{logger[_0x6a00('0x15')](_0x6a00('0xd'),_0x215b84,_0x6a00('0x10'));_0x57be04(_0x37bc84[_0x6a00('0x16')]['message']);}})[_0x6a00('0x17')](function(_0x14d7b7){logger[_0x6a00('0x12')](_0x6a00('0xd'),_0x215b84,_0x14d7b7);_0x34ace2(_0x14d7b7);});});}exports[_0x6a00('0x18')]=function(_0x348886){var _0xd40862=this;return new Promise(function(_0x29b4c8,_0x3484bd){return db[_0x6a00('0x19')][_0x6a00('0x1a')](_0x348886[_0x6a00('0x1b')],{'raw':_0x348886[_0x6a00('0x1c')]?_0x348886[_0x6a00('0x1c')][_0x6a00('0x1d')]===undefined?!![]:![]:!![]})[_0x6a00('0xc')](function(_0x4e32d8){logger['info']('CreateWhatsappQueueReport',_0x348886);logger['debug'](_0x6a00('0x18'),_0x348886,JSON[_0x6a00('0x11')](_0x4e32d8));_0x29b4c8(_0x4e32d8);})[_0x6a00('0x17')](function(_0x3f6461){logger['error'](_0x6a00('0x18'),_0x3f6461[_0x6a00('0x14')],_0x348886);_0x3484bd(_0xd40862[_0x6a00('0x12')](0x1f4,_0x3f6461[_0x6a00('0x14')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x5d1725){var _0x4eea45=this;return new Promise(function(_0x294c37,_0xa5d1a2){return db[_0x6a00('0x19')][_0x6a00('0x1e')](_0x5d1725['body'],{'raw':_0x5d1725['options']?_0x5d1725[_0x6a00('0x1c')][_0x6a00('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1725['options']?_0x5d1725[_0x6a00('0x1c')][_0x6a00('0x1f')]||null:null,'attributes':_0x5d1725['options']?_0x5d1725[_0x6a00('0x1c')]['attributes']||null:null,'limit':_0x5d1725['options']?_0x5d1725['options'][_0x6a00('0x20')]||null:null})[_0x6a00('0xc')](function(_0x3ad343){logger['info'](_0x6a00('0x21'),_0x5d1725);logger[_0x6a00('0xe')](_0x6a00('0x21'),_0x5d1725,JSON[_0x6a00('0x11')](_0x3ad343));_0x294c37(_0x3ad343);})[_0x6a00('0x17')](function(_0x30f982){logger[_0x6a00('0x12')](_0x6a00('0x21'),_0x30f982[_0x6a00('0x14')],_0x5d1725);_0xa5d1a2(_0x4eea45[_0x6a00('0x12')](0x1f4,_0x30f982[_0x6a00('0x14')]));});});}; \ No newline at end of file +var _0x0767=['client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','catch','update','where','attributes','limit','UpdateWhatsappQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x492a59,_0x390dd0){var _0x179f67=function(_0x1a7745){while(--_0x1a7745){_0x492a59['push'](_0x492a59['shift']());}};_0x179f67(++_0x390dd0);}(_0x0767,0x106));var _0x7076=function(_0x376e16,_0x5496a4){_0x376e16=_0x376e16-0x0;var _0x5a72ae=_0x0767[_0x376e16];return _0x5a72ae;};'use strict';var _=require('lodash');var util=require(_0x7076('0x0'));var moment=require(_0x7076('0x1'));var BPromise=require(_0x7076('0x2'));var rs=require(_0x7076('0x3'));var fs=require('fs');var Redis=require(_0x7076('0x4'));var db=require(_0x7076('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7076('0x6'))(_0x7076('0x7'));var config=require(_0x7076('0x8'));var jayson=require(_0x7076('0x9'));var client=jayson[_0x7076('0xa')][_0x7076('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe0163f,_0x1ed592,_0x42ae9b){return new BPromise(function(_0x384821,_0x497e7e){return client[_0x7076('0xc')](_0xe0163f,_0x42ae9b)[_0x7076('0xd')](function(_0x2922ff){logger[_0x7076('0xe')](_0x7076('0xf'),_0x1ed592,'request\x20sent');logger[_0x7076('0x10')](_0x7076('0x11'),_0x1ed592,_0x7076('0x12'),JSON[_0x7076('0x13')](_0x2922ff));if(_0x2922ff[_0x7076('0x14')]){if(_0x2922ff[_0x7076('0x14')]['code']===0x1f4){logger[_0x7076('0x14')]('WhatsappQueueReport,\x20%s,\x20%s',_0x1ed592,_0x2922ff[_0x7076('0x14')][_0x7076('0x15')]);return _0x497e7e(_0x2922ff[_0x7076('0x14')]['message']);}logger['error'](_0x7076('0xf'),_0x1ed592,_0x2922ff[_0x7076('0x14')]['message']);return _0x384821(_0x2922ff[_0x7076('0x14')][_0x7076('0x15')]);}else{logger[_0x7076('0xe')](_0x7076('0xf'),_0x1ed592,_0x7076('0x12'));_0x384821(_0x2922ff['result'][_0x7076('0x15')]);}})['catch'](function(_0x511065){logger['error'](_0x7076('0xf'),_0x1ed592,_0x511065);_0x497e7e(_0x511065);});});}exports[_0x7076('0x16')]=function(_0x218445){var _0x3c6a3d=this;return new Promise(function(_0x51913b,_0x335447){return db[_0x7076('0x17')][_0x7076('0x18')](_0x218445[_0x7076('0x19')],{'raw':_0x218445[_0x7076('0x1a')]?_0x218445[_0x7076('0x1a')][_0x7076('0x1b')]===undefined?!![]:![]:!![]})[_0x7076('0xd')](function(_0x4d026d){logger[_0x7076('0xe')](_0x7076('0x16'),_0x218445);logger[_0x7076('0x10')](_0x7076('0x16'),_0x218445,JSON[_0x7076('0x13')](_0x4d026d));_0x51913b(_0x4d026d);})[_0x7076('0x1c')](function(_0x14de53){logger[_0x7076('0x14')](_0x7076('0x16'),_0x14de53[_0x7076('0x15')],_0x218445);_0x335447(_0x3c6a3d[_0x7076('0x14')](0x1f4,_0x14de53[_0x7076('0x15')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2acdca){var _0x32fb3b=this;return new Promise(function(_0x1f4559,_0x851634){return db[_0x7076('0x17')][_0x7076('0x1d')](_0x2acdca[_0x7076('0x19')],{'raw':_0x2acdca['options']?_0x2acdca['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acdca['options']?_0x2acdca[_0x7076('0x1a')][_0x7076('0x1e')]||null:null,'attributes':_0x2acdca[_0x7076('0x1a')]?_0x2acdca[_0x7076('0x1a')][_0x7076('0x1f')]||null:null,'limit':_0x2acdca[_0x7076('0x1a')]?_0x2acdca[_0x7076('0x1a')][_0x7076('0x20')]||null:null})[_0x7076('0xd')](function(_0x51a917){logger['info']('UpdateWhatsappQueueReport',_0x2acdca);logger[_0x7076('0x10')](_0x7076('0x21'),_0x2acdca,JSON[_0x7076('0x13')](_0x51a917));_0x1f4559(_0x51a917);})['catch'](function(_0x44942a){logger['error']('UpdateWhatsappQueueReport',_0x44942a[_0x7076('0x15')],_0x2acdca);_0x851634(_0x32fb3b[_0x7076('0x14')](0x1f4,_0x44942a[_0x7076('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 76c2a2e..2072076 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 _0xbc77=['../../config/environment','./whatsappTransferReport.controller','isAuthenticated','index','/describe','describe','get','/:id','create','update','delete','destroy','exports','multer','util','fs-extra','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc77,0xd9));var _0x7bc7=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xbc77[_0x102b0c];return _0x9b15ca;};'use strict';var multer=require(_0x7bc7('0x0'));var util=require(_0x7bc7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7bc7('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x7bc7('0x3'));var config=require(_0x7bc7('0x4'));var controller=require(_0x7bc7('0x5'));router['get']('/',auth[_0x7bc7('0x6')](),controller[_0x7bc7('0x7')]);router['get'](_0x7bc7('0x8'),auth[_0x7bc7('0x6')](),controller[_0x7bc7('0x9')]);router[_0x7bc7('0xa')](_0x7bc7('0xb'),auth[_0x7bc7('0x6')](),controller['show']);router['post']('/',auth[_0x7bc7('0x6')](),controller[_0x7bc7('0xc')]);router['put'](_0x7bc7('0xb'),auth['isAuthenticated'](),controller[_0x7bc7('0xd')]);router[_0x7bc7('0xe')](_0x7bc7('0xb'),auth[_0x7bc7('0x6')](),controller[_0x7bc7('0xf')]);module[_0x7bc7('0x10')]=router; \ No newline at end of file +var _0xa9be=['/:id','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0xa9be,0x15a));var _0xea9b=function(_0x2cd8fc,_0x2691c1){_0x2cd8fc=_0x2cd8fc-0x0;var _0x115c3f=_0xa9be[_0x2cd8fc];return _0x115c3f;};'use strict';var multer=require(_0xea9b('0x0'));var util=require('util');var path=require(_0xea9b('0x1'));var timeout=require(_0xea9b('0x2'));var express=require(_0xea9b('0x3'));var router=express[_0xea9b('0x4')]();var fs_extra=require(_0xea9b('0x5'));var auth=require(_0xea9b('0x6'));var interaction=require(_0xea9b('0x7'));var config=require('../../config/environment');var controller=require(_0xea9b('0x8'));router[_0xea9b('0x9')]('/',auth[_0xea9b('0xa')](),controller[_0xea9b('0xb')]);router[_0xea9b('0x9')](_0xea9b('0xc'),auth['isAuthenticated'](),controller[_0xea9b('0xd')]);router['get'](_0xea9b('0xe'),auth[_0xea9b('0xa')](),controller['show']);router[_0xea9b('0xf')]('/',auth[_0xea9b('0xa')](),controller[_0xea9b('0x10')]);router[_0xea9b('0x11')](_0xea9b('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xea9b('0x12')](_0xea9b('0xe'),auth[_0xea9b('0xa')](),controller[_0xea9b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 07b0d86..86272b9 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 _0x317b=['exports','ENUM','account','queue','DATE','sequelize'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x317b,0x1c7));var _0xb317=function(_0xd8c435,_0x4c9470){_0xd8c435=_0xd8c435-0x0;var _0x4304dc=_0x317b[_0xd8c435];return _0x4304dc;};'use strict';var Sequelize=require(_0xb317('0x0'));module[_0xb317('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb317('0x2')](_0xb317('0x3'),'agent',_0xb317('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb317('0x5')]}}; \ No newline at end of file +var _0xede3=['exports','ENUM','account','agent','queue','DATE'];(function(_0x3576c0,_0x196351){var _0x310e7d=function(_0x41c25e){while(--_0x41c25e){_0x3576c0['push'](_0x3576c0['shift']());}};_0x310e7d(++_0x196351);}(_0xede3,0xc0));var _0x3ede=function(_0x5df8ad,_0x567102){_0x5df8ad=_0x5df8ad-0x0;var _0x139d62=_0xede3[_0x5df8ad];return _0x139d62;};'use strict';var Sequelize=require('sequelize');module[_0x3ede('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3ede('0x1')](_0x3ede('0x2'),_0x3ede('0x3'),_0x3ede('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x3ede('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 75e4625..28be4c3 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 _0x6947=['stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','create','body','update','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error'];(function(_0x8b41d6,_0x39cba9){var _0x285392=function(_0x574aa6){while(--_0x574aa6){_0x8b41d6['push'](_0x8b41d6['shift']());}};_0x285392(++_0x39cba9);}(_0x6947,0x72));var _0x7694=function(_0x1ffd44,_0xcc983d){_0x1ffd44=_0x1ffd44-0x0;var _0x5335eb=_0x6947[_0x1ffd44];return _0x5335eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7694('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7694('0x1'));var rp=require(_0x7694('0x2'));var moment=require(_0x7694('0x3'));var BPromise=require(_0x7694('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7694('0x5'));var sox=require(_0x7694('0x6'));var csv=require(_0x7694('0x7'));var ejs=require(_0x7694('0x8'));var fs=require('fs');var fs_extra=require(_0x7694('0x9'));var _=require(_0x7694('0xa'));var squel=require('squel');var crypto=require(_0x7694('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7694('0xc'));var toCsv=require(_0x7694('0x7'));var querystring=require('querystring');var Papa=require(_0x7694('0xd'));var Redis=require(_0x7694('0xe'));var authService=require(_0x7694('0xf'));var qs=require(_0x7694('0x10'));var as=require(_0x7694('0x11'));var hardwareService=require(_0x7694('0x12'));var logger=require(_0x7694('0x13'))('api');var utils=require(_0x7694('0x14'));var config=require(_0x7694('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7694('0x16'))['db'];function respondWithStatusCode(_0x40abbe,_0xac1a22){_0xac1a22=_0xac1a22||0xcc;return function(_0x4c3341){if(_0x4c3341){return _0x40abbe['sendStatus'](_0xac1a22);}return _0x40abbe[_0x7694('0x17')](_0xac1a22)[_0x7694('0x18')]();};}function respondWithResult(_0x436b87,_0x574f29){_0x574f29=_0x574f29||0xc8;return function(_0x143c48){if(_0x143c48){return _0x436b87['status'](_0x574f29)[_0x7694('0x19')](_0x143c48);}};}function respondWithFilteredResult(_0x1e7706,_0x1bec84){return function(_0x306c31){if(_0x306c31){var _0x4298a2=typeof _0x1bec84['offset']===_0x7694('0x1a')&&typeof _0x1bec84[_0x7694('0x1b')]===_0x7694('0x1a');var _0xc7c0b4=_0x306c31['count'];var _0x177b0d=_0x4298a2?0x0:_0x1bec84[_0x7694('0x1c')];var _0x40ae37=_0x4298a2?_0x306c31[_0x7694('0x1d')]:_0x1bec84[_0x7694('0x1c')]+_0x1bec84[_0x7694('0x1b')];var _0x4c3067;if(_0x40ae37>=_0xc7c0b4){_0x40ae37=_0xc7c0b4;_0x4c3067=0xc8;}else{_0x4c3067=0xce;}_0x1e7706[_0x7694('0x17')](_0x4c3067);return _0x1e7706['set'](_0x7694('0x1e'),_0x177b0d+'-'+_0x40ae37+'/'+_0xc7c0b4)[_0x7694('0x19')](_0x306c31);}return null;};}function patchUpdates(_0x271a36){return function(_0x394e31){try{jsonpatch[_0x7694('0x1f')](_0x394e31,_0x271a36,!![]);}catch(_0x524e65){return BPromise[_0x7694('0x20')](_0x524e65);}return _0x394e31[_0x7694('0x21')]();};}function saveUpdates(_0x2d569a,_0x1654d2){return function(_0x267968){if(_0x267968){return _0x267968['update'](_0x2d569a)[_0x7694('0x22')](function(_0x3f8fb4){return _0x3f8fb4;});}return null;};}function removeEntity(_0x3aa24a,_0x23a4f3){return function(_0x4b36d9){if(_0x4b36d9){return _0x4b36d9[_0x7694('0x23')]()['then'](function(){_0x3aa24a[_0x7694('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d77b7,_0x4fd5ff){return function(_0xd3be74){if(!_0xd3be74){_0x2d77b7[_0x7694('0x24')](0x194);}return _0xd3be74;};}function handleError(_0x10b3bf,_0xbc2650){_0xbc2650=_0xbc2650||0x1f4;return function(_0x27269b){logger[_0x7694('0x25')](_0x27269b[_0x7694('0x26')]);if(_0x27269b['name']){delete _0x27269b[_0x7694('0x27')];}_0x10b3bf[_0x7694('0x17')](_0xbc2650)[_0x7694('0x28')](_0x27269b);};}exports[_0x7694('0x29')]=function(_0x5c3e18,_0x292553){var _0x374130={},_0x2facc7={},_0x4aed26={'count':0x0,'rows':[]};var _0x45bdc8=_[_0x7694('0x2a')](db[_0x7694('0x2b')]['rawAttributes'],function(_0x3b0029){return{'name':_0x3b0029[_0x7694('0x2c')],'type':_0x3b0029[_0x7694('0x2d')][_0x7694('0x2e')]};});_0x2facc7[_0x7694('0x2f')]=_[_0x7694('0x2a')](_0x45bdc8,_0x7694('0x27'));_0x2facc7[_0x7694('0x30')]=_[_0x7694('0x31')](_0x5c3e18['query']);_0x2facc7[_0x7694('0x32')]=_[_0x7694('0x33')](_0x2facc7[_0x7694('0x2f')],_0x2facc7[_0x7694('0x30')]);_0x374130['attributes']=_[_0x7694('0x33')](_0x2facc7[_0x7694('0x2f')],qs[_0x7694('0x34')](_0x5c3e18[_0x7694('0x30')][_0x7694('0x34')]));_0x374130[_0x7694('0x35')]=_0x374130['attributes'][_0x7694('0x36')]?_0x374130[_0x7694('0x35')]:_0x2facc7[_0x7694('0x2f')];if(!_0x5c3e18[_0x7694('0x30')][_0x7694('0x37')](_0x7694('0x38'))){_0x374130[_0x7694('0x1b')]=qs[_0x7694('0x1b')](_0x5c3e18[_0x7694('0x30')]['limit']);_0x374130[_0x7694('0x1c')]=qs['offset'](_0x5c3e18[_0x7694('0x30')][_0x7694('0x1c')]);}_0x374130[_0x7694('0x39')]=qs[_0x7694('0x3a')](_0x5c3e18[_0x7694('0x30')][_0x7694('0x3a')]);_0x374130[_0x7694('0x3b')]=qs[_0x7694('0x32')](_['pick'](_0x5c3e18['query'],_0x2facc7[_0x7694('0x32')]),_0x45bdc8);if(_0x5c3e18[_0x7694('0x30')][_0x7694('0x3c')]){_0x374130['where']=_[_0x7694('0x3d')](_0x374130[_0x7694('0x3b')],{'$or':_[_0x7694('0x2a')](_0x45bdc8,function(_0x3734cc){if(_0x3734cc[_0x7694('0x2d')]!==_0x7694('0x3e')){var _0x470b2b={};_0x470b2b[_0x3734cc[_0x7694('0x27')]]={'$like':'%'+_0x5c3e18[_0x7694('0x30')][_0x7694('0x3c')]+'%'};return _0x470b2b;}})});}_0x374130=_[_0x7694('0x3d')]({},_0x374130,_0x5c3e18[_0x7694('0x3f')]);var _0x1d97ba={'where':_0x374130[_0x7694('0x3b')]};return db[_0x7694('0x2b')][_0x7694('0x1d')](_0x1d97ba)[_0x7694('0x22')](function(_0x3e0c22){_0x4aed26[_0x7694('0x1d')]=_0x3e0c22;if(_0x5c3e18[_0x7694('0x30')][_0x7694('0x40')]){_0x374130['include']=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x7694('0x41')](_0x374130);})[_0x7694('0x22')](function(_0x19ff01){_0x4aed26['rows']=_0x19ff01;return _0x4aed26;})[_0x7694('0x22')](respondWithFilteredResult(_0x292553,_0x374130))[_0x7694('0x42')](handleError(_0x292553,null));};exports[_0x7694('0x43')]=function(_0x52feb1,_0x5c80c0){var _0x138181={'raw':!![],'where':{'id':_0x52feb1[_0x7694('0x44')]['id']}},_0x839353={};_0x839353['model']=_[_0x7694('0x31')](db['WhatsappTransferReport'][_0x7694('0x45')]);_0x839353[_0x7694('0x30')]=_[_0x7694('0x31')](_0x52feb1[_0x7694('0x30')]);_0x839353[_0x7694('0x32')]=_[_0x7694('0x33')](_0x839353[_0x7694('0x2f')],_0x839353['query']);_0x138181[_0x7694('0x35')]=_[_0x7694('0x33')](_0x839353[_0x7694('0x2f')],qs[_0x7694('0x34')](_0x52feb1[_0x7694('0x30')]['fields']));_0x138181[_0x7694('0x35')]=_0x138181[_0x7694('0x35')][_0x7694('0x36')]?_0x138181[_0x7694('0x35')]:_0x839353[_0x7694('0x2f')];if(_0x52feb1[_0x7694('0x30')][_0x7694('0x40')]){_0x138181[_0x7694('0x46')]=[{'all':!![]}];}_0x138181=_['merge']({},_0x138181,_0x52feb1[_0x7694('0x3f')]);return db[_0x7694('0x2b')]['find'](_0x138181)['then'](handleEntityNotFound(_0x5c80c0,null))[_0x7694('0x22')](respondWithResult(_0x5c80c0,null))['catch'](handleError(_0x5c80c0,null));};exports[_0x7694('0x47')]=function(_0x3a2490,_0x3ee3c0){return db[_0x7694('0x2b')][_0x7694('0x47')](_0x3a2490[_0x7694('0x48')],{})[_0x7694('0x22')](respondWithResult(_0x3ee3c0,0xc9))[_0x7694('0x42')](handleError(_0x3ee3c0,null));};exports[_0x7694('0x49')]=function(_0x5a901a,_0x424d28){if(_0x5a901a[_0x7694('0x48')]['id']){delete _0x5a901a[_0x7694('0x48')]['id'];}return db['WhatsappTransferReport'][_0x7694('0x4a')]({'where':{'id':_0x5a901a['params']['id']}})[_0x7694('0x22')](handleEntityNotFound(_0x424d28,null))['then'](saveUpdates(_0x5a901a['body'],null))[_0x7694('0x22')](respondWithResult(_0x424d28,null))[_0x7694('0x42')](handleError(_0x424d28,null));};exports[_0x7694('0x23')]=function(_0x4787b7,_0x4229c5){return db['WhatsappTransferReport'][_0x7694('0x4a')]({'where':{'id':_0x4787b7[_0x7694('0x44')]['id']}})[_0x7694('0x22')](handleEntityNotFound(_0x4229c5,null))['then'](removeEntity(_0x4229c5,null))[_0x7694('0x42')](handleError(_0x4229c5,null));};exports[_0x7694('0x4b')]=function(_0x3b6a84,_0x5e41f3){return db[_0x7694('0x2b')][_0x7694('0x4b')]()[_0x7694('0x22')](respondWithResult(_0x5e41f3,null))[_0x7694('0x42')](handleError(_0x5e41f3,null));}; \ No newline at end of file +var _0x1bba=['findAll','rows','show','params','length','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','apply','reject','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','WhatsappTransferReport','include'];(function(_0x40f5b7,_0xb3243e){var _0x3c884a=function(_0x4fc27b){while(--_0x4fc27b){_0x40f5b7['push'](_0x40f5b7['shift']());}};_0x3c884a(++_0xb3243e);}(_0x1bba,0xa7));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa1bb('0x0'));var rimraf=require(_0xa1bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa1bb('0x2'));var rp=require(_0xa1bb('0x3'));var moment=require(_0xa1bb('0x4'));var BPromise=require(_0xa1bb('0x5'));var Mustache=require(_0xa1bb('0x6'));var util=require(_0xa1bb('0x7'));var path=require(_0xa1bb('0x8'));var sox=require(_0xa1bb('0x9'));var csv=require(_0xa1bb('0xa'));var ejs=require(_0xa1bb('0xb'));var fs=require('fs');var fs_extra=require(_0xa1bb('0xc'));var _=require(_0xa1bb('0xd'));var squel=require(_0xa1bb('0xe'));var crypto=require(_0xa1bb('0xf'));var jsforce=require(_0xa1bb('0x10'));var deskjs=require(_0xa1bb('0x11'));var toCsv=require(_0xa1bb('0xa'));var querystring=require(_0xa1bb('0x12'));var Papa=require(_0xa1bb('0x13'));var Redis=require(_0xa1bb('0x14'));var authService=require(_0xa1bb('0x15'));var qs=require(_0xa1bb('0x16'));var as=require(_0xa1bb('0x17'));var hardwareService=require(_0xa1bb('0x18'));var logger=require('../../config/logger')(_0xa1bb('0x19'));var utils=require(_0xa1bb('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa1bb('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c23d,_0x5c40f){_0x5c40f=_0x5c40f||0xcc;return function(_0x2abf3a){if(_0x2abf3a){return _0x14c23d[_0xa1bb('0x1c')](_0x5c40f);}return _0x14c23d[_0xa1bb('0x1d')](_0x5c40f)[_0xa1bb('0x1e')]();};}function respondWithResult(_0x4a7e79,_0x2aff5e){_0x2aff5e=_0x2aff5e||0xc8;return function(_0x37f39a){if(_0x37f39a){return _0x4a7e79[_0xa1bb('0x1d')](_0x2aff5e)['json'](_0x37f39a);}};}function respondWithFilteredResult(_0x1c1ee6,_0x2e3028){return function(_0x52e33){if(_0x52e33){var _0x58d7d0=typeof _0x2e3028['offset']===_0xa1bb('0x1f')&&typeof _0x2e3028[_0xa1bb('0x20')]==='undefined';var _0x2a9d26=_0x52e33['count'];var _0x10d314=_0x58d7d0?0x0:_0x2e3028[_0xa1bb('0x21')];var _0x333f8d=_0x58d7d0?_0x52e33[_0xa1bb('0x22')]:_0x2e3028['offset']+_0x2e3028['limit'];var _0x289fc3;if(_0x333f8d>=_0x2a9d26){_0x333f8d=_0x2a9d26;_0x289fc3=0xc8;}else{_0x289fc3=0xce;}_0x1c1ee6['status'](_0x289fc3);return _0x1c1ee6[_0xa1bb('0x23')]('Content-Range',_0x10d314+'-'+_0x333f8d+'/'+_0x2a9d26)['json'](_0x52e33);}return null;};}function patchUpdates(_0xe1491a){return function(_0x3f31dc){try{jsonpatch[_0xa1bb('0x24')](_0x3f31dc,_0xe1491a,!![]);}catch(_0x2ffb67){return BPromise[_0xa1bb('0x25')](_0x2ffb67);}return _0x3f31dc['save']();};}function saveUpdates(_0x57d0b5,_0x246fc0){return function(_0xb26a60){if(_0xb26a60){return _0xb26a60[_0xa1bb('0x26')](_0x57d0b5)[_0xa1bb('0x27')](function(_0x1c6eef){return _0x1c6eef;});}return null;};}function removeEntity(_0x1405f6,_0x52722e){return function(_0x38d9bf){if(_0x38d9bf){return _0x38d9bf[_0xa1bb('0x28')]()[_0xa1bb('0x27')](function(){_0x1405f6['status'](0xcc)[_0xa1bb('0x1e')]();});}};}function handleEntityNotFound(_0x5696d8,_0x877182){return function(_0x20c177){if(!_0x20c177){_0x5696d8[_0xa1bb('0x1c')](0x194);}return _0x20c177;};}function handleError(_0xf58b6e,_0x2e4543){_0x2e4543=_0x2e4543||0x1f4;return function(_0x4f1302){logger[_0xa1bb('0x29')](_0x4f1302[_0xa1bb('0x2a')]);if(_0x4f1302[_0xa1bb('0x2b')]){delete _0x4f1302['name'];}_0xf58b6e['status'](_0x2e4543)['send'](_0x4f1302);};}exports[_0xa1bb('0x2c')]=function(_0xcf85b6,_0x556af5){var _0x59a493={},_0x294f4e={},_0x2c914e={'count':0x0,'rows':[]};var _0x3cc073=_[_0xa1bb('0x2d')](db['WhatsappTransferReport'][_0xa1bb('0x2e')],function(_0x4158e2){return{'name':_0x4158e2[_0xa1bb('0x2f')],'type':_0x4158e2[_0xa1bb('0x30')]['key']};});_0x294f4e[_0xa1bb('0x31')]=_[_0xa1bb('0x2d')](_0x3cc073,_0xa1bb('0x2b'));_0x294f4e[_0xa1bb('0x32')]=_[_0xa1bb('0x33')](_0xcf85b6['query']);_0x294f4e['filters']=_[_0xa1bb('0x34')](_0x294f4e[_0xa1bb('0x31')],_0x294f4e[_0xa1bb('0x32')]);_0x59a493['attributes']=_['intersection'](_0x294f4e[_0xa1bb('0x31')],qs[_0xa1bb('0x35')](_0xcf85b6[_0xa1bb('0x32')]['fields']));_0x59a493[_0xa1bb('0x36')]=_0x59a493[_0xa1bb('0x36')]['length']?_0x59a493[_0xa1bb('0x36')]:_0x294f4e[_0xa1bb('0x31')];if(!_0xcf85b6[_0xa1bb('0x32')][_0xa1bb('0x37')](_0xa1bb('0x38'))){_0x59a493[_0xa1bb('0x20')]=qs[_0xa1bb('0x20')](_0xcf85b6[_0xa1bb('0x32')]['limit']);_0x59a493[_0xa1bb('0x21')]=qs[_0xa1bb('0x21')](_0xcf85b6[_0xa1bb('0x32')]['offset']);}_0x59a493[_0xa1bb('0x39')]=qs['sort'](_0xcf85b6['query'][_0xa1bb('0x3a')]);_0x59a493['where']=qs[_0xa1bb('0x3b')](_[_0xa1bb('0x3c')](_0xcf85b6[_0xa1bb('0x32')],_0x294f4e['filters']),_0x3cc073);if(_0xcf85b6[_0xa1bb('0x32')][_0xa1bb('0x3d')]){_0x59a493[_0xa1bb('0x3e')]=_[_0xa1bb('0x3f')](_0x59a493['where'],{'$or':_[_0xa1bb('0x2d')](_0x3cc073,function(_0x3b4a93){if(_0x3b4a93[_0xa1bb('0x30')]!=='VIRTUAL'){var _0x38605e={};_0x38605e[_0x3b4a93[_0xa1bb('0x2b')]]={'$like':'%'+_0xcf85b6[_0xa1bb('0x32')]['filter']+'%'};return _0x38605e;}})});}_0x59a493=_[_0xa1bb('0x3f')]({},_0x59a493,_0xcf85b6[_0xa1bb('0x40')]);var _0x498943={'where':_0x59a493[_0xa1bb('0x3e')]};return db[_0xa1bb('0x41')][_0xa1bb('0x22')](_0x498943)[_0xa1bb('0x27')](function(_0x336c27){_0x2c914e[_0xa1bb('0x22')]=_0x336c27;if(_0xcf85b6['query']['includeAll']){_0x59a493[_0xa1bb('0x42')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xa1bb('0x43')](_0x59a493);})[_0xa1bb('0x27')](function(_0x4af403){_0x2c914e[_0xa1bb('0x44')]=_0x4af403;return _0x2c914e;})[_0xa1bb('0x27')](respondWithFilteredResult(_0x556af5,_0x59a493))['catch'](handleError(_0x556af5,null));};exports[_0xa1bb('0x45')]=function(_0x2d3afd,_0xb9860){var _0x5071cb={'raw':!![],'where':{'id':_0x2d3afd[_0xa1bb('0x46')]['id']}},_0x12a44e={};_0x12a44e[_0xa1bb('0x31')]=_['keys'](db[_0xa1bb('0x41')]['rawAttributes']);_0x12a44e[_0xa1bb('0x32')]=_['keys'](_0x2d3afd['query']);_0x12a44e[_0xa1bb('0x3b')]=_[_0xa1bb('0x34')](_0x12a44e[_0xa1bb('0x31')],_0x12a44e[_0xa1bb('0x32')]);_0x5071cb[_0xa1bb('0x36')]=_[_0xa1bb('0x34')](_0x12a44e[_0xa1bb('0x31')],qs[_0xa1bb('0x35')](_0x2d3afd[_0xa1bb('0x32')]['fields']));_0x5071cb[_0xa1bb('0x36')]=_0x5071cb[_0xa1bb('0x36')][_0xa1bb('0x47')]?_0x5071cb[_0xa1bb('0x36')]:_0x12a44e[_0xa1bb('0x31')];if(_0x2d3afd[_0xa1bb('0x32')][_0xa1bb('0x48')]){_0x5071cb['include']=[{'all':!![]}];}_0x5071cb=_[_0xa1bb('0x3f')]({},_0x5071cb,_0x2d3afd[_0xa1bb('0x40')]);return db['WhatsappTransferReport'][_0xa1bb('0x49')](_0x5071cb)['then'](handleEntityNotFound(_0xb9860,null))['then'](respondWithResult(_0xb9860,null))[_0xa1bb('0x4a')](handleError(_0xb9860,null));};exports[_0xa1bb('0x4b')]=function(_0x191b90,_0x30ceab){return db[_0xa1bb('0x41')][_0xa1bb('0x4b')](_0x191b90['body'],{})[_0xa1bb('0x27')](respondWithResult(_0x30ceab,0xc9))[_0xa1bb('0x4a')](handleError(_0x30ceab,null));};exports[_0xa1bb('0x26')]=function(_0x484e68,_0x29c4c2){if(_0x484e68[_0xa1bb('0x4c')]['id']){delete _0x484e68['body']['id'];}return db[_0xa1bb('0x41')][_0xa1bb('0x49')]({'where':{'id':_0x484e68[_0xa1bb('0x46')]['id']}})[_0xa1bb('0x27')](handleEntityNotFound(_0x29c4c2,null))[_0xa1bb('0x27')](saveUpdates(_0x484e68[_0xa1bb('0x4c')],null))['then'](respondWithResult(_0x29c4c2,null))['catch'](handleError(_0x29c4c2,null));};exports[_0xa1bb('0x28')]=function(_0x4379ac,_0x5ee0f5){return db['WhatsappTransferReport'][_0xa1bb('0x49')]({'where':{'id':_0x4379ac[_0xa1bb('0x46')]['id']}})[_0xa1bb('0x27')](handleEntityNotFound(_0x5ee0f5,null))[_0xa1bb('0x27')](removeEntity(_0x5ee0f5,null))[_0xa1bb('0x4a')](handleError(_0x5ee0f5,null));};exports['describe']=function(_0x584c7a,_0x15db0f){return db['WhatsappTransferReport'][_0xa1bb('0x4d')]()[_0xa1bb('0x27')](respondWithResult(_0x15db0f,null))['catch'](handleError(_0x15db0f,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index ebb0fc0..47b4506 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 _0x0c94=['define','WhatsappTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x0c94,0x7c));var _0x40c9=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0c94[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x40c9('0x0'));var util=require(_0x40c9('0x1'));var logger=require(_0x40c9('0x2'))(_0x40c9('0x3'));var moment=require(_0x40c9('0x4'));var BPromise=require('bluebird');var rp=require(_0x40c9('0x5'));var fs=require('fs');var path=require(_0x40c9('0x6'));var rimraf=require('rimraf');var config=require(_0x40c9('0x7'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x162373,_0x5221dc){return _0x162373[_0x40c9('0x8')](_0x40c9('0x9'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x40c9('0xa'),'fields':[_0x40c9('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x36ac=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','bluebird','request-promise','rimraf'];(function(_0x3af2d5,_0x15eb1f){var _0x4b9f0a=function(_0x581333){while(--_0x581333){_0x3af2d5['push'](_0x3af2d5['shift']());}};_0x4b9f0a(++_0x15eb1f);}(_0x36ac,0x188));var _0xc36a=function(_0x512c1c,_0x385127){_0x512c1c=_0x512c1c-0x0;var _0x596e88=_0x36ac[_0x512c1c];return _0x596e88;};'use strict';var _=require('lodash');var util=require(_0xc36a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc36a('0x1'));var rp=require(_0xc36a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc36a('0x3'));var config=require(_0xc36a('0x4'));var attributes=require(_0xc36a('0x5'));module[_0xc36a('0x6')]=function(_0x5c60b8,_0x269352){return _0x5c60b8[_0xc36a('0x7')](_0xc36a('0x8'),attributes,{'tableName':_0xc36a('0x9'),'paranoid':![],'indexes':[{'name':_0xc36a('0xa'),'fields':[_0xc36a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index c8cf6c7..506dfa8 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 _0x1ba7=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x1ba7,0x1b7));var _0x71ba=function(_0x1e9604,_0x5de613){_0x1e9604=_0x1e9604-0x0;var _0x522053=_0x1ba7[_0x1e9604];return _0x522053;};'use strict';var _=require(_0x71ba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71ba('0x1'));var fs=require('fs');var Redis=require(_0x71ba('0x2'));var db=require(_0x71ba('0x3'))['db'];var utils=require(_0x71ba('0x4'));var logger=require(_0x71ba('0x5'))(_0x71ba('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71ba('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd971,_0x59a383,_0x53c8f9){return new BPromise(function(_0x2b5278,_0x203a01){return client['request'](_0x1fd971,_0x53c8f9)[_0x71ba('0x8')](function(_0x49b231){logger['info'](_0x71ba('0x9'),_0x59a383,_0x71ba('0xa'));logger[_0x71ba('0xb')](_0x71ba('0xc'),_0x59a383,_0x71ba('0xa'),JSON[_0x71ba('0xd')](_0x49b231));if(_0x49b231[_0x71ba('0xe')]){if(_0x49b231[_0x71ba('0xe')]['code']===0x1f4){logger[_0x71ba('0xe')](_0x71ba('0x9'),_0x59a383,_0x49b231[_0x71ba('0xe')][_0x71ba('0xf')]);return _0x203a01(_0x49b231[_0x71ba('0xe')][_0x71ba('0xf')]);}logger[_0x71ba('0xe')](_0x71ba('0x9'),_0x59a383,_0x49b231[_0x71ba('0xe')][_0x71ba('0xf')]);return _0x2b5278(_0x49b231[_0x71ba('0xe')]['message']);}else{logger[_0x71ba('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x59a383,_0x71ba('0xa'));_0x2b5278(_0x49b231['result'][_0x71ba('0xf')]);}})[_0x71ba('0x11')](function(_0x1938a9){logger['error'](_0x71ba('0x9'),_0x59a383,_0x1938a9);_0x203a01(_0x1938a9);});});} \ No newline at end of file +var _0x07e7=['then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x427919,_0x5661d7){var _0x5ef09c=function(_0x12ed07){while(--_0x12ed07){_0x427919['push'](_0x427919['shift']());}};_0x5ef09c(++_0x5661d7);}(_0x07e7,0xc6));var _0x707e=function(_0x565f6c,_0x525509){_0x565f6c=_0x565f6c-0x0;var _0x416b3e=_0x07e7[_0x565f6c];return _0x416b3e;};'use strict';var _=require(_0x707e('0x0'));var util=require(_0x707e('0x1'));var moment=require('moment');var BPromise=require(_0x707e('0x2'));var rs=require(_0x707e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x707e('0x4'))['db'];var utils=require(_0x707e('0x5'));var logger=require(_0x707e('0x6'))(_0x707e('0x7'));var config=require('../../config/environment');var jayson=require(_0x707e('0x8'));var client=jayson[_0x707e('0x9')][_0x707e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdf3e7d,_0x29c5fe,_0x22e389){return new BPromise(function(_0x4a86ad,_0xe9dd2d){return client[_0x707e('0xb')](_0xdf3e7d,_0x22e389)[_0x707e('0xc')](function(_0x28797a){logger[_0x707e('0xd')](_0x707e('0xe'),_0x29c5fe,_0x707e('0xf'));logger['debug'](_0x707e('0x10'),_0x29c5fe,_0x707e('0xf'),JSON['stringify'](_0x28797a));if(_0x28797a['error']){if(_0x28797a['error']['code']===0x1f4){logger[_0x707e('0x11')](_0x707e('0xe'),_0x29c5fe,_0x28797a['error'][_0x707e('0x12')]);return _0xe9dd2d(_0x28797a['error'][_0x707e('0x12')]);}logger[_0x707e('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x29c5fe,_0x28797a[_0x707e('0x11')][_0x707e('0x12')]);return _0x4a86ad(_0x28797a[_0x707e('0x11')][_0x707e('0x12')]);}else{logger[_0x707e('0xd')](_0x707e('0xe'),_0x29c5fe,_0x707e('0xf'));_0x4a86ad(_0x28797a[_0x707e('0x13')][_0x707e('0x12')]);}})[_0x707e('0x14')](function(_0x39c59b){logger[_0x707e('0x11')](_0x707e('0xe'),_0x29c5fe,_0x39c59b);_0xe9dd2d(_0x39c59b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 59ebd08..0498fce 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81fb=['Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','sync','listen','then','start'];(function(_0x11bc34,_0x5c08b5){var _0x166522=function(_0x50462f){while(--_0x50462f){_0x11bc34['push'](_0x11bc34['shift']());}};_0x166522(++_0x5c08b5);}(_0x81fb,0xb0));var _0xb81f=function(_0x34b53e,_0x3aa2a8){_0x34b53e=_0x34b53e-0x0;var _0x3959a5=_0x81fb[_0x34b53e];return _0x3959a5;};'use strict';var _=require(_0xb81f('0x0'));var mysqldb=require(_0xb81f('0x1'));var rpc=require(_0xb81f('0x2'));var config=require('./config/environment');var logger=require(_0xb81f('0x3'))(_0xb81f('0x4'));var pm2=require(_0xb81f('0x5'));var pm2Config=require(_0xb81f('0x6'));var schedule=require(_0xb81f('0x7'));var chat=require(_0xb81f('0x8'));var whatsapp=require(_0xb81f('0x9'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb81f('0xa'));function main(){return mysqldb['db'][_0xb81f('0xb')][_0xb81f('0xc')]()['then'](function(){return rpc[_0xb81f('0xd')]();})[_0xb81f('0xe')](function(_0x4e6c62){logger['info'](_0x4e6c62);return chat[_0xb81f('0xf')]();})[_0xb81f('0xe')](function(){return whatsapp[_0xb81f('0xf')]();})[_0xb81f('0xe')](function(){return schedule[_0xb81f('0xf')]();})[_0xb81f('0xe')](function(){return transcribe[_0xb81f('0xf')]();})['then'](function(){return provider[_0xb81f('0xf')]();})['then'](function(_0x29f54b){logger['info'](_0x29f54b);return pm2[_0xb81f('0xf')](pm2Config);})[_0xb81f('0xe')](function(_0x49442c){logger['info'](_0xb81f('0x10'),_[_0xb81f('0x11')](_[_0xb81f('0x12')](_0x49442c,{'status':_0xb81f('0x13')}),_0xb81f('0x14'))[_0xb81f('0x15')]());logger['info'](_0xb81f('0x16'),_[_0xb81f('0x11')](_[_0xb81f('0x12')](_0x49442c,function(_0x27f0d9){return _0x27f0d9[_0xb81f('0x17')]!==_0xb81f('0x13');}),_0xb81f('0x14'))[_0xb81f('0x15')]()||_0xb81f('0x18'));config[_0xb81f('0x19')]&&require(_0xb81f('0x1a'))[_0xb81f('0x1b')]();require(_0xb81f('0x1c'))[_0xb81f('0x1b')]();})[_0xb81f('0x1d')](function(_0x22a049){logger[_0xb81f('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x22a049);process[_0xb81f('0x1f')](0x1);});}main(); \ No newline at end of file +var _0x9faf=['./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','info','start','Online\x20apps:','map','filter','name','join','status','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc'];(function(_0xf453e5,_0x838a2e){var _0x1483c4=function(_0x48ce40){while(--_0x48ce40){_0xf453e5['push'](_0xf453e5['shift']());}};_0x1483c4(++_0x838a2e);}(_0x9faf,0x15a));var _0xf9fa=function(_0x41bff2,_0x471d43){_0x41bff2=_0x41bff2-0x0;var _0x1f2e03=_0x9faf[_0x41bff2];return _0x1f2e03;};'use strict';var _=require('lodash');var mysqldb=require(_0xf9fa('0x0'));var rpc=require(_0xf9fa('0x1'));var config=require('./config/environment');var logger=require(_0xf9fa('0x2'))(_0xf9fa('0x3'));var pm2=require(_0xf9fa('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xf9fa('0x5'));var chat=require(_0xf9fa('0x6'));var whatsapp=require(_0xf9fa('0x7'));var transcribe=require(_0xf9fa('0x8'));var provider=require(_0xf9fa('0x9'));function main(){return mysqldb['db'][_0xf9fa('0xa')][_0xf9fa('0xb')]()[_0xf9fa('0xc')](function(){return rpc['listen']();})['then'](function(_0x26db3c){logger[_0xf9fa('0xd')](_0x26db3c);return chat[_0xf9fa('0xe')]();})[_0xf9fa('0xc')](function(){return whatsapp[_0xf9fa('0xe')]();})[_0xf9fa('0xc')](function(){return schedule['start']();})[_0xf9fa('0xc')](function(){return transcribe['start']();})[_0xf9fa('0xc')](function(){return provider[_0xf9fa('0xe')]();})['then'](function(_0x55fc20){logger['info'](_0x55fc20);return pm2[_0xf9fa('0xe')](pm2Config);})['then'](function(_0x2c6e89){logger[_0xf9fa('0xd')](_0xf9fa('0xf'),_[_0xf9fa('0x10')](_[_0xf9fa('0x11')](_0x2c6e89,{'status':'online'}),_0xf9fa('0x12'))[_0xf9fa('0x13')]());logger[_0xf9fa('0xd')]('Offline\x20apps:',_[_0xf9fa('0x10')](_[_0xf9fa('0x11')](_0x2c6e89,function(_0x5f2b17){return _0x5f2b17[_0xf9fa('0x14')]!=='online';}),_0xf9fa('0x12'))[_0xf9fa('0x13')]()||'None');config[_0xf9fa('0x15')]&&require(_0xf9fa('0x16'))[_0xf9fa('0x17')]();require(_0xf9fa('0x18'))[_0xf9fa('0x17')]();})[_0xf9fa('0x19')](function(_0xf8afbc){logger[_0xf9fa('0x1a')](_0xf9fa('0x1b'),_0xf8afbc);process[_0xf9fa('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3599309..872eabb 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 _0xd4ac=['disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','apikey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','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.','Sequelize','updatePasswordsHistory','decryptString','length','splice','unshift','encryptString','sign','secret','session','promisify','verify','secrets','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','moment','role','name','internal','email','md5secret','voicePause','chatPause','mailPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','isAuthenticated','use','user','ChatInteraction','params','closed','status','disposition','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','getUuid','find','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore'];(function(_0x3ea62b,_0x196039){var _0x4d97ee=function(_0x563ab5){while(--_0x563ab5){_0x3ea62b['push'](_0x3ea62b['shift']());}};_0x4d97ee(++_0x196039);}(_0xd4ac,0x140));var _0xcd4a=function(_0x80e2a6,_0x5ad897){_0x80e2a6=_0x80e2a6-0x0;var _0x4605ed=_0xd4ac[_0x80e2a6];return _0x4605ed;};'use strict';var db=require(_0xcd4a('0x0'))['db'];var config=require(_0xcd4a('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xcd4a('0x2'));var encryptor=require(_0xcd4a('0x3'));var _=require('lodash');var jwt=require(_0xcd4a('0x4'));var expressJwt=require('express-jwt');var compose=require(_0xcd4a('0x5'));var basicAuth=require(_0xcd4a('0x6'));var crypto=require('crypto');var BPromise=require(_0xcd4a('0x7'));var util=require(_0xcd4a('0x8'));var moment=require(_0xcd4a('0x9'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xcd4a('0xa'),'fullname',_0xcd4a('0xb'),_0xcd4a('0xc'),_0xcd4a('0xd'),'userpic','permissions',_0xcd4a('0xe'),_0xcd4a('0xf'),_0xcd4a('0x10'),_0xcd4a('0x11'),'faxPause',_0xcd4a('0x12'),_0xcd4a('0x13'),_0xcd4a('0x14'),_0xcd4a('0x15'),'lastLoginAt',_0xcd4a('0x16'),_0xcd4a('0x17'),_0xcd4a('0x18'),_0xcd4a('0x19'),_0xcd4a('0x1a'),_0xcd4a('0x1b'),_0xcd4a('0x1c'),_0xcd4a('0x1d'),'phoneBarEnableRecording',_0xcd4a('0x1e'),_0xcd4a('0x1f'),_0xcd4a('0x20'),_0xcd4a('0x21'),_0xcd4a('0x22'),_0xcd4a('0x23'),_0xcd4a('0x24'),'interface',_0xcd4a('0x25'),_0xcd4a('0x26'),'settingsEnabled',_0xcd4a('0x27'),_0xcd4a('0x28'),_0xcd4a('0x29'),'downloadAttachments',_0xcd4a('0x2a'),_0xcd4a('0x2b')];exports['isChatInteractionAuthorized']=function(){return this[_0xcd4a('0x2c')](!![])[_0xcd4a('0x2d')](function(_0x5c5e27,_0x5bc516,_0x51d7dd){if(_0x5c5e27[_0xcd4a('0x2e')]){_0x51d7dd();}else{return db[_0xcd4a('0x2f')]['findOne']({'where':{'id':_0x5c5e27[_0xcd4a('0x30')]['id']},'attributes':['id',_0xcd4a('0x31'),'disposition'],'raw':!![]})['then'](function(_0x43dbf0){if(_0x43dbf0&&_0x43dbf0['closed']){return _0x5bc516[_0xcd4a('0x32')](_0x43dbf0[_0xcd4a('0x33')]===_0xcd4a('0x34')?0x195:0x193)[_0xcd4a('0x35')]({'message':_0x43dbf0[_0xcd4a('0x33')]==='unmanaged'?_0xcd4a('0x36'):_0xcd4a('0x37')});}else{_0x51d7dd();}})[_0xcd4a('0x38')](function(_0x4bf267){_0x51d7dd(_0x4bf267);});}});};exports[_0xcd4a('0x2c')]=function isAuthenticated(_0x23725a){return compose()['use'](function(_0x11337f,_0x35b66f,_0x5e647b){var _0x45ac54;if(_0x11337f[_0xcd4a('0x39')][_0xcd4a('0x3a')]){if(_[_0xcd4a('0x3b')](_0x11337f[_0xcd4a('0x39')][_0xcd4a('0x3a')],_0xcd4a('0x3c'))){var _0x2d9345=basicAuth(_0x11337f);db[_0xcd4a('0x3d')]['find']({'where':{'name':_0x2d9345[_0xcd4a('0xb')]}})[_0xcd4a('0x3e')](function(_0x547a0e){if(!_0x547a0e||!_0x547a0e[_0xcd4a('0x3f')](_0x2d9345[_0xcd4a('0x40')])){return _0x35b66f[_0xcd4a('0x32')](0x191)['json']({'message':_0xcd4a('0x41')});}_0x11337f[_0xcd4a('0x2e')]={'id':_0x547a0e['id']};_0x5e647b();})['catch'](function(_0x18913d){_0x5e647b(_0x18913d);});}else if(_[_0xcd4a('0x3b')](_0x11337f[_0xcd4a('0x39')][_0xcd4a('0x3a')],_0xcd4a('0x42'))){validateJwt(_0x11337f,_0x35b66f,_0x5e647b);}else{if(_0x23725a){_0x5e647b();}else{return _0x35b66f[_0xcd4a('0x32')](0x193)[_0xcd4a('0x35')]({'message':_0xcd4a('0x43')});}}}else if(_0x11337f[_0xcd4a('0x44')]['apikey']){try{var _0x2512a9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xcd4a('0x45')]()};verifyJwt(_0x11337f['query']['apikey'],_0x2512a9)['then'](function(_0xc20127){return db[_0xcd4a('0x3d')][_0xcd4a('0x46')]({'where':{'id':_0xc20127['sub']}})[_0xcd4a('0x3e')](function(_0x9f2959){_0x45ac54=_0x9f2959;return db[_0xcd4a('0x47')][_0xcd4a('0x48')]({'where':{'id':0x1},'attributes':[_0xcd4a('0x49'),_0xcd4a('0x4a')],'raw':!![]});})[_0xcd4a('0x3e')](function(_0x2e51aa){if(!_0x45ac54||!_[_0xcd4a('0x4b')](_0x45ac54[_0xcd4a('0x4c')],_0xc20127[_0xcd4a('0x4d')])){return _0x35b66f[_0xcd4a('0x32')](0x191)[_0xcd4a('0x35')]({'message':_0xcd4a('0x4e')});}if(_0x45ac54[_0xcd4a('0x4f')]){return _0x35b66f[_0xcd4a('0x32')](0x191)[_0xcd4a('0x35')]({'message':_0xcd4a('0x50')});}if(_0x45ac54['blocked']){if(_0x2e51aa['blockDuration']>0x0){if(moment(_0x45ac54[_0xcd4a('0x51')])[_0xcd4a('0x52')](_0x2e51aa[_0xcd4a('0x4a')],_0xcd4a('0x53'))>moment()){return _0x35b66f[_0xcd4a('0x32')](0x191)[_0xcd4a('0x35')]({'message':_0xcd4a('0x50')});}}else{return _0x35b66f[_0xcd4a('0x32')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x11337f[_0xcd4a('0x2e')]={'id':_0x45ac54['id']};_0x5e647b();});})[_0xcd4a('0x38')](function(){return _0x35b66f[_0xcd4a('0x32')](0x191)[_0xcd4a('0x35')]({'message':_0xcd4a('0x50')});});}catch(_0x36fc2f){_0x5e647b(_0x36fc2f);}}else if(_0x23725a){_0x5e647b();}else{return _0x35b66f[_0xcd4a('0x32')](0x193)[_0xcd4a('0x35')]({'message':_0xcd4a('0x43')});}})[_0xcd4a('0x2d')](function(_0x2825b8,_0x7e7114,_0xa8da9d){if(_0x2825b8[_0xcd4a('0x2e')]){db['User'][_0xcd4a('0x46')]({'where':{'id':_0x2825b8[_0xcd4a('0x2e')]['id']},'attributes':userAttributes})[_0xcd4a('0x3e')](function(_0x38fee5){if(!_0x38fee5){return _0x7e7114['status'](0x194)['json']({'message':_0xcd4a('0x54')});}_0x2825b8[_0xcd4a('0x2e')]=_0x38fee5;_0xa8da9d();})[_0xcd4a('0x38')](function(_0x3a4bd4){_0xa8da9d(_0x3a4bd4);});}else if(_0x23725a){_0xa8da9d();}else{return _0x7e7114[_0xcd4a('0x32')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xcd4a('0x55')]=function canUpdate(){return compose()[_0xcd4a('0x2d')](function(_0x49dc6e,_0x1a741e,_0x585612){return licenseUtil[_0xcd4a('0x56')]()['then'](function(_0x11089a){if(_0x11089a['update']){_0x585612();}else{return _0x1a741e[_0xcd4a('0x32')](0x193)[_0xcd4a('0x35')]({'message':_0xcd4a('0x57')});}})[_0xcd4a('0x38')](function(_0x3e613b){_0x585612(_0x3e613b);});});};exports[_0xcd4a('0x58')]=function isWebrtcLicence(){return compose()[_0xcd4a('0x2d')](function(_0x5663e9,_0x51460e,_0x5a5c4d){return licenseUtil['getLicense']()[_0xcd4a('0x3e')](function(_0x25abd0){if(_0x25abd0[_0xcd4a('0x59')]){_0x5a5c4d();}else{return _0x51460e[_0xcd4a('0x32')](0x193)['json']({'message':_0xcd4a('0x57')});}})[_0xcd4a('0x38')](function(_0x1b7ae1){_0x5a5c4d(_0x1b7ae1);});});};exports[_0xcd4a('0x5a')]=function(_0x1672b7,_0x415dfc,_0x525771){_0x1672b7[_0xcd4a('0x5a')]=!![];return _0x525771();};exports[_0xcd4a('0x5b')]=function signToken(_0x1ae7eb){return signJwt(_0x1ae7eb);};exports[_0xcd4a('0x5c')]=function(_0x260d93,_0x1c3b52){if(!_0x260d93[_0xcd4a('0x2e')]){return _0x1c3b52[_0xcd4a('0x32')](0x194)['json']({'message':_0xcd4a('0x5d')});}var _0x3fee33={'payload':{'id':_0x260d93['user']['id'],'role':_0x260d93[_0xcd4a('0x2e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3fee33)[_0xcd4a('0x3e')](function(_0x482a24){_0x1c3b52[_0xcd4a('0x5e')](_0xcd4a('0x5f'),_0x482a24);_0x1c3b52['redirect'](_0xcd4a('0x60'));})['catch'](function(_0x30bf50){return _0x1c3b52['status'](0x1f4)[_0xcd4a('0x61')](_0x30bf50);});};exports[_0xcd4a('0x62')]=function(_0x367efb){if(_[_0xcd4a('0x63')](_0x367efb[_0xcd4a('0x4c')])||_[_0xcd4a('0x63')](_0x367efb['apiKeyIat'])){return null;}else{return createJwt(_0x367efb);}};exports[_0xcd4a('0x64')]=function(_0xa25a7a){_0xa25a7a['apiKeyNonce']=generateNonce();_0xa25a7a[_0xcd4a('0x65')]=generateIssuedAt();return createJwt(_0xa25a7a);};exports[_0xcd4a('0x66')]=function(_0x38b5e4,_0xc924d4){var _0x4c03ac=_0x38b5e4['query'][_0xcd4a('0x67')];if(_0x4c03ac){var _0x22709c={'nonce':_0xc924d4[_0xcd4a('0x4c')],'iat':_0xc924d4['apiKeyIat'],'audience':hardwareConf[_0xcd4a('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4c03ac,_0x22709c)[_0xcd4a('0x3e')](function(){return generateApiKey(_0xc924d4);});}else{throw{'message':_0xcd4a('0x68')};}};exports[_0xcd4a('0x69')]=function(_0x138977){var _0x119ada=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x119ada[_0xcd4a('0x6a')](_0x138977))throw new db['Sequelize'][(_0xcd4a('0x6b'))](_0xcd4a('0x6c'));return;};exports[_0xcd4a('0x6d')]=function(_0x3faabc,_0x55c807,_0x386238){var _0x22faeb=encryptor['decryptString'](_0x55c807)[_0xcd4a('0x6e')](',');for(var _0x3e985c=0x0;_0x3e985c<_0x386238;_0x3e985c++){if(!_0x22faeb[_0x3e985c])break;if(_0x3faabc[_0xcd4a('0x6f')]()===_0x22faeb[_0x3e985c][_0xcd4a('0x6f')]()){var _0x54eeb0=util[_0xcd4a('0x70')](_0xcd4a('0x71'),_0x386238);if(_0x386238===0x1){_0x54eeb0=_0xcd4a('0x72');}throw new db[(_0xcd4a('0x73'))]['ValidationError'](_0x54eeb0);}}return;};exports[_0xcd4a('0x74')]=function(_0x599be4,_0x553818){var _0x3ee32a=_0x553818?encryptor[_0xcd4a('0x75')](_0x553818)[_0xcd4a('0x6e')](','):[];if(_0x3ee32a[_0xcd4a('0x76')]===0x5){_0x3ee32a[_0xcd4a('0x77')](-0x1,0x1);}_0x3ee32a[_0xcd4a('0x78')](_0x599be4);return encryptor[_0xcd4a('0x79')](_0x3ee32a['join'](','));};function signJwt(_0x287aef){var _0x499551=BPromise['promisify'](jwt[_0xcd4a('0x7a')],{'context':jwt});var _0x4e6c97=_0x287aef[_0xcd4a('0x7b')]||config['secrets'][_0xcd4a('0x7c')];return new BPromise(function(_0x16329c,_0x27d4fc){_0x499551(_0x287aef['payload'],_0x4e6c97,_0x287aef['options'])[_0xcd4a('0x3e')](function(_0x40b14a){_0x16329c(_0x40b14a);})['catch'](function(_0x584d75){_0x27d4fc(_0x584d75);});});}function verifyJwt(_0x1e6d39,_0x205940,_0x4ed1ba){var _0x3b0671=BPromise[_0xcd4a('0x7d')](jwt[_0xcd4a('0x7e')],{'context':jwt});var _0xc63432=_0x4ed1ba||config[_0xcd4a('0x7f')][_0xcd4a('0x7c')];return new BPromise(function(_0x3a150a,_0x43a5b0){_0x3b0671(_0x1e6d39,_0xc63432,_0x205940)[_0xcd4a('0x3e')](function(_0x267047){_0x3a150a(_0x267047);})['catch'](function(_0x254688){_0x43a5b0(_0x254688);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xcd4a('0x80')](_0xcd4a('0x81'));}function generateIssuedAt(){return Math[_0xcd4a('0x82')](Date[_0xcd4a('0x83')]()/0x3e8)['toString']();}function createJwt(_0x1a4224){var _0x378173={'payload':{'iat':_0x1a4224['apiKeyIat'],'nonce':_0x1a4224[_0xcd4a('0x4c')]},'options':{'algorithm':_0xcd4a('0x84'),'subject':_0x1a4224['id']['toString'](),'issuer':hardwareConf[_0xcd4a('0x45')](),'audience':hardwareConf[_0xcd4a('0x45')]()}};return signJwt(_0x378173)[_0xcd4a('0x3e')](function(_0x46c69c){return{'iat':_0x1a4224[_0xcd4a('0x65')],'nonce':_0x1a4224[_0xcd4a('0x4c')],'token':_0x46c69c};});} \ No newline at end of file +var _0x0d2a=['phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','isChatInteractionAuthorized','ChatInteraction','findOne','closed','disposition','then','status','unmanaged','Unmanaged.','Forbidden.','isAuthenticated','use','headers','Basic','User','find','authenticate','json','user','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','getLicense','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','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.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','session','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires'];(function(_0x1cc368,_0x3901ee){var _0x2a47c1=function(_0x3c2949){while(--_0x3c2949){_0x1cc368['push'](_0x1cc368['shift']());}};_0x2a47c1(++_0x3901ee);}(_0x0d2a,0x1e6));var _0xa0d2=function(_0x3a4443,_0x30ae18){_0x3a4443=_0x3a4443-0x0;var _0x3a9f88=_0x0d2a[_0x3a4443];return _0x3a9f88;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0xa0d2('0x0'));var licenseUtil=require(_0xa0d2('0x1'));var encryptor=require(_0xa0d2('0x2'));var _=require(_0xa0d2('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xa0d2('0x4'));var compose=require(_0xa0d2('0x5'));var basicAuth=require(_0xa0d2('0x6'));var crypto=require(_0xa0d2('0x7'));var BPromise=require(_0xa0d2('0x8'));var util=require(_0xa0d2('0x9'));var moment=require(_0xa0d2('0xa'));var validateJwt=expressJwt({'secret':config[_0xa0d2('0xb')]['session']});var userAttributes=['id',_0xa0d2('0xc'),_0xa0d2('0xd'),_0xa0d2('0xe'),'internal',_0xa0d2('0xf'),_0xa0d2('0x10'),_0xa0d2('0x11'),'md5secret','voicePause',_0xa0d2('0x12'),_0xa0d2('0x13'),_0xa0d2('0x14'),'smsPause',_0xa0d2('0x15'),_0xa0d2('0x16'),'showWebBar',_0xa0d2('0x17'),'lastPauseAt',_0xa0d2('0x18'),_0xa0d2('0x19'),_0xa0d2('0x1a'),_0xa0d2('0x1b'),_0xa0d2('0x1c'),_0xa0d2('0x1d'),_0xa0d2('0x1e'),_0xa0d2('0x1f'),'phoneBarEnableDtmfTone',_0xa0d2('0x20'),_0xa0d2('0x21'),'phoneBarPrefixRequired',_0xa0d2('0x22'),_0xa0d2('0x23'),_0xa0d2('0x24'),_0xa0d2('0x25'),_0xa0d2('0x26'),_0xa0d2('0x27'),_0xa0d2('0x28'),_0xa0d2('0x29'),_0xa0d2('0x2a'),'downloadOmnichannelInteractions',_0xa0d2('0x2b'),_0xa0d2('0x2c'),_0xa0d2('0x2d')];exports[_0xa0d2('0x2e')]=function(){return this['isAuthenticated'](!![])['use'](function(_0xdc9283,_0x4528b5,_0x4eef4a){if(_0xdc9283['user']){_0x4eef4a();}else{return db[_0xa0d2('0x2f')][_0xa0d2('0x30')]({'where':{'id':_0xdc9283['params']['id']},'attributes':['id',_0xa0d2('0x31'),_0xa0d2('0x32')],'raw':!![]})[_0xa0d2('0x33')](function(_0x1c7883){if(_0x1c7883&&_0x1c7883[_0xa0d2('0x31')]){return _0x4528b5[_0xa0d2('0x34')](_0x1c7883['disposition']===_0xa0d2('0x35')?0x195:0x193)['json']({'message':_0x1c7883[_0xa0d2('0x32')]===_0xa0d2('0x35')?_0xa0d2('0x36'):_0xa0d2('0x37')});}else{_0x4eef4a();}})['catch'](function(_0x3d5626){_0x4eef4a(_0x3d5626);});}});};exports[_0xa0d2('0x38')]=function isAuthenticated(_0x310dbc){return compose()[_0xa0d2('0x39')](function(_0x66652d,_0xa950cf,_0x314082){var _0x855814;if(_0x66652d['headers']['authorization']){if(_['startsWith'](_0x66652d[_0xa0d2('0x3a')]['authorization'],_0xa0d2('0x3b'))){var _0x4917e7=basicAuth(_0x66652d);db[_0xa0d2('0x3c')][_0xa0d2('0x3d')]({'where':{'name':_0x4917e7[_0xa0d2('0xe')]}})['then'](function(_0x34b485){if(!_0x34b485||!_0x34b485[_0xa0d2('0x3e')](_0x4917e7['pass'])){return _0xa950cf['status'](0x191)[_0xa0d2('0x3f')]({'message':'Wrong\x20credentials.'});}_0x66652d[_0xa0d2('0x40')]={'id':_0x34b485['id']};_0x314082();})[_0xa0d2('0x41')](function(_0x317b02){_0x314082(_0x317b02);});}else if(_['startsWith'](_0x66652d[_0xa0d2('0x3a')]['authorization'],_0xa0d2('0x42'))){validateJwt(_0x66652d,_0xa950cf,_0x314082);}else{if(_0x310dbc){_0x314082();}else{return _0xa950cf[_0xa0d2('0x34')](0x193)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x43')});}}}else if(_0x66652d[_0xa0d2('0x44')][_0xa0d2('0x45')]){try{var _0x1caf62={'audience':hardwareConf[_0xa0d2('0x46')](),'issuer':hardwareConf[_0xa0d2('0x46')]()};verifyJwt(_0x66652d['query'][_0xa0d2('0x45')],_0x1caf62)['then'](function(_0x439785){return db['User'][_0xa0d2('0x3d')]({'where':{'id':_0x439785[_0xa0d2('0x47')]}})['then'](function(_0x554656){_0x855814=_0x554656;return db[_0xa0d2('0x48')][_0xa0d2('0x30')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xa0d2('0x49')],'raw':!![]});})[_0xa0d2('0x33')](function(_0x27ece0){if(!_0x855814||!_[_0xa0d2('0x4a')](_0x855814[_0xa0d2('0x4b')],_0x439785[_0xa0d2('0x4c')])){return _0xa950cf['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x855814[_0xa0d2('0x4d')]){return _0xa950cf['status'](0x191)['json']({'message':_0xa0d2('0x4e')});}if(_0x855814[_0xa0d2('0x4f')]){if(_0x27ece0[_0xa0d2('0x49')]>0x0){if(moment(_0x855814[_0xa0d2('0x50')])[_0xa0d2('0x51')](_0x27ece0[_0xa0d2('0x49')],_0xa0d2('0x52'))>moment()){return _0xa950cf['status'](0x191)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x4e')});}}else{return _0xa950cf[_0xa0d2('0x34')](0x191)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x4e')});}}_0x66652d[_0xa0d2('0x40')]={'id':_0x855814['id']};_0x314082();});})[_0xa0d2('0x41')](function(){return _0xa950cf[_0xa0d2('0x34')](0x191)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x4e')});});}catch(_0x401d56){_0x314082(_0x401d56);}}else if(_0x310dbc){_0x314082();}else{return _0xa950cf[_0xa0d2('0x34')](0x193)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x43')});}})[_0xa0d2('0x39')](function(_0x4605e9,_0x122518,_0x4759c1){if(_0x4605e9[_0xa0d2('0x40')]){db[_0xa0d2('0x3c')][_0xa0d2('0x3d')]({'where':{'id':_0x4605e9[_0xa0d2('0x40')]['id']},'attributes':userAttributes})[_0xa0d2('0x33')](function(_0x7ba859){if(!_0x7ba859){return _0x122518[_0xa0d2('0x34')](0x194)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x53')});}_0x4605e9[_0xa0d2('0x40')]=_0x7ba859;_0x4759c1();})[_0xa0d2('0x41')](function(_0xb7f9d7){_0x4759c1(_0xb7f9d7);});}else if(_0x310dbc){_0x4759c1();}else{return _0x122518['status'](0x194)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x54')});}});};exports[_0xa0d2('0x55')]=function canUpdate(){return compose()[_0xa0d2('0x39')](function(_0x3b0d3b,_0x90956b,_0x4b16a1){return licenseUtil['getLicense']()['then'](function(_0xafff72){if(_0xafff72[_0xa0d2('0x56')]){_0x4b16a1();}else{return _0x90956b['status'](0x193)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x57')});}})['catch'](function(_0x37a3ad){_0x4b16a1(_0x37a3ad);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xa0d2('0x39')](function(_0x11493e,_0x3637b6,_0x3bb7a7){return licenseUtil[_0xa0d2('0x58')]()[_0xa0d2('0x33')](function(_0x177933){if(_0x177933['webrtc']){_0x3bb7a7();}else{return _0x3637b6[_0xa0d2('0x34')](0x193)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x57')});}})[_0xa0d2('0x41')](function(_0x3eabcc){_0x3bb7a7(_0x3eabcc);});});};exports[_0xa0d2('0x59')]=function(_0x4f5689,_0x411197,_0x41c83a){_0x4f5689[_0xa0d2('0x59')]=!![];return _0x41c83a();};exports[_0xa0d2('0x5a')]=function signToken(_0x33dce5){return signJwt(_0x33dce5);};exports[_0xa0d2('0x5b')]=function(_0x5f1881,_0x26c1bd){if(!_0x5f1881[_0xa0d2('0x40')]){return _0x26c1bd[_0xa0d2('0x34')](0x194)[_0xa0d2('0x3f')]({'message':_0xa0d2('0x5c')});}var _0x12372a={'payload':{'id':_0x5f1881['user']['id'],'role':_0x5f1881[_0xa0d2('0x40')][_0xa0d2('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x12372a)['then'](function(_0x516e25){_0x26c1bd[_0xa0d2('0x5d')](_0xa0d2('0x5e'),_0x516e25);_0x26c1bd['redirect']('/dashboards/general');})['catch'](function(_0x167c6a){return _0x26c1bd[_0xa0d2('0x34')](0x1f4)[_0xa0d2('0x5f')](_0x167c6a);});};exports[_0xa0d2('0x60')]=function(_0x5cd148){if(_[_0xa0d2('0x61')](_0x5cd148['apiKeyNonce'])||_[_0xa0d2('0x61')](_0x5cd148[_0xa0d2('0x62')])){return null;}else{return createJwt(_0x5cd148);}};exports['generateApiKey']=function(_0x21c77e){_0x21c77e[_0xa0d2('0x4b')]=generateNonce();_0x21c77e[_0xa0d2('0x62')]=generateIssuedAt();return createJwt(_0x21c77e);};exports[_0xa0d2('0x63')]=function(_0x16272b,_0x1c746b){var _0x5c4d0c=_0x16272b[_0xa0d2('0x44')][_0xa0d2('0x45')];if(_0x5c4d0c){var _0x56b898={'nonce':_0x1c746b[_0xa0d2('0x4b')],'iat':_0x1c746b['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xa0d2('0x46')]()};return verifyJwt(_0x5c4d0c,_0x56b898)['then'](function(){return generateApiKey(_0x1c746b);});}else{throw{'message':_0xa0d2('0x64')};}};exports['validatePasswordPattern']=function(_0x125719){var _0x59330d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x59330d[_0xa0d2('0x65')](_0x125719))throw new db['Sequelize'][(_0xa0d2('0x66'))](_0xa0d2('0x67'));return;};exports[_0xa0d2('0x68')]=function(_0x2dbb3f,_0x5554e1,_0x894aae){var _0x12887a=encryptor[_0xa0d2('0x69')](_0x5554e1)[_0xa0d2('0x6a')](',');for(var _0x2297c7=0x0;_0x2297c7<_0x894aae;_0x2297c7++){if(!_0x12887a[_0x2297c7])break;if(_0x2dbb3f[_0xa0d2('0x6b')]()===_0x12887a[_0x2297c7][_0xa0d2('0x6b')]()){var _0xbaad25=util[_0xa0d2('0x6c')](_0xa0d2('0x6d'),_0x894aae);if(_0x894aae===0x1){_0xbaad25=_0xa0d2('0x6e');}throw new db[(_0xa0d2('0x6f'))][(_0xa0d2('0x66'))](_0xbaad25);}}return;};exports[_0xa0d2('0x70')]=function(_0x409a5d,_0x562eab){var _0x9d103f=_0x562eab?encryptor[_0xa0d2('0x69')](_0x562eab)[_0xa0d2('0x6a')](','):[];if(_0x9d103f[_0xa0d2('0x71')]===0x5){_0x9d103f['splice'](-0x1,0x1);}_0x9d103f[_0xa0d2('0x72')](_0x409a5d);return encryptor[_0xa0d2('0x73')](_0x9d103f[_0xa0d2('0x74')](','));};function signJwt(_0x4aabd1){var _0x2205f6=BPromise['promisify'](jwt[_0xa0d2('0x75')],{'context':jwt});var _0xcc0c87=_0x4aabd1[_0xa0d2('0x76')]||config[_0xa0d2('0xb')][_0xa0d2('0x77')];return new BPromise(function(_0x25a2a8,_0x482d89){_0x2205f6(_0x4aabd1[_0xa0d2('0x78')],_0xcc0c87,_0x4aabd1[_0xa0d2('0x79')])[_0xa0d2('0x33')](function(_0x4203d5){_0x25a2a8(_0x4203d5);})[_0xa0d2('0x41')](function(_0x996202){_0x482d89(_0x996202);});});}function verifyJwt(_0x42d1d5,_0x2ac010,_0x41b241){var _0x30b861=BPromise[_0xa0d2('0x7a')](jwt[_0xa0d2('0x7b')],{'context':jwt});var _0x163968=_0x41b241||config['secrets'][_0xa0d2('0x77')];return new BPromise(function(_0x42822d,_0x3cabab){_0x30b861(_0x42d1d5,_0x163968,_0x2ac010)[_0xa0d2('0x33')](function(_0x26e9e5){_0x42822d(_0x26e9e5);})[_0xa0d2('0x41')](function(_0x2ead78){_0x3cabab(_0x2ead78);});});}function generateNonce(){return crypto[_0xa0d2('0x7c')](0x10)[_0xa0d2('0x7d')](_0xa0d2('0x7e'));}function generateIssuedAt(){return Math[_0xa0d2('0x7f')](Date[_0xa0d2('0x80')]()/0x3e8)[_0xa0d2('0x7d')]();}function createJwt(_0x1f29d4){var _0x3b0b14={'payload':{'iat':_0x1f29d4[_0xa0d2('0x62')],'nonce':_0x1f29d4[_0xa0d2('0x4b')]},'options':{'algorithm':_0xa0d2('0x81'),'subject':_0x1f29d4['id'][_0xa0d2('0x7d')](),'issuer':hardwareConf[_0xa0d2('0x46')](),'audience':hardwareConf[_0xa0d2('0x46')]()}};return signJwt(_0x3b0b14)[_0xa0d2('0x33')](function(_0x309104){return{'iat':_0x1f29d4[_0xa0d2('0x62')],'nonce':_0x1f29d4[_0xa0d2('0x4b')],'token':_0x309104};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 0207cdf..1cb2bf3 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 _0x8238=['bluebird','lodash','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','binary','write','final','end','close','unlink','encryptString','secret','createCipher','utf8','base64','decryptString','createDecipher','crypto'];(function(_0x153dd4,_0x45c990){var _0x24b6f8=function(_0x3c1f21){while(--_0x3c1f21){_0x153dd4['push'](_0x153dd4['shift']());}};_0x24b6f8(++_0x45c990);}(_0x8238,0x117));var _0x8823=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x8238[_0x1ac77b];return _0x161584;};'use strict';var crypto=require(_0x8823('0x0'));var fs=require('fs');var BPromise=require(_0x8823('0x1'));var _=require(_0x8823('0x2'));var config=require('../../config/environment');var logger=require(_0x8823('0x3'))(_0x8823('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x8823('0x5')][_0x8823('0x6')],'algorithm':_0x8823('0x7')};const fileOptions={'algorithm':_0x8823('0x8')};if(config['encrypt']&&config[_0x8823('0x9')][_0x8823('0xa')]){var isSupported=isAlgorithmSupported(config[_0x8823('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config[_0x8823('0x9')][_0x8823('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x8823('0xb')](',\x20');logger[_0x8823('0xc')](config['encrypt'][_0x8823('0xa')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2e2626){return AES_SUPPORTED_RX[_0x8823('0xd')](_0x2e2626);}function getSupportedCiphers(){return crypto[_0x8823('0xe')]()[_0x8823('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x17a3e8){return getSupportedCiphers()[_0x8823('0x10')](_0x17a3e8)>-0x1;}function combineOptions(_0x3b2c24){var _0x337c36={};for(var _0x4d3db9 in fileOptions){if(fileOptions[_0x8823('0x11')](_0x4d3db9)){_0x337c36[_0x4d3db9]=fileOptions[_0x4d3db9];}}if(_0x3b2c24){for(var _0x3b6e61 in _0x3b2c24){if(_0x3b2c24['hasOwnProperty'](_0x3b6e61)){_0x337c36[_0x3b6e61]=_0x3b2c24[_0x3b6e61];}}}return _0x337c36;}exports['encryptFile']=function(_0x305e67,_0x5ec417,_0x6d0879,_0x150ba2){return new BPromise(function(_0xd5e8db,_0x2647bf){_0x150ba2=combineOptions(_0x150ba2);var _0x81633=new Buffer(_0x6d0879);var _0xac10df=fs[_0x8823('0x12')](_0x305e67);var _0x1f54a6=fs[_0x8823('0x13')](_0x5ec417);var _0x458b1e=crypto['createCipher'](_0x150ba2[_0x8823('0xa')],_0x81633);_0xac10df['on'](_0x8823('0x14'),function(_0x2bf71d){var _0x447c8e=new Buffer(_0x458b1e[_0x8823('0x15')](_0x2bf71d),_0x8823('0x16'));_0x1f54a6[_0x8823('0x17')](_0x447c8e);});_0xac10df['on']('end',function(){try{var _0x394252=new Buffer(_0x458b1e[_0x8823('0x18')](_0x8823('0x16')),_0x8823('0x16'));_0x1f54a6['write'](_0x394252);_0x1f54a6[_0x8823('0x19')]();_0x1f54a6['on'](_0x8823('0x1a'),function(){return _0xd5e8db(_0x5ec417);});}catch(_0x1a0571){fs[_0x8823('0x1b')](_0x5ec417);return _0x2647bf(_0x1a0571);}});});};exports['decryptFile']=function(_0x3053f8,_0x20079e,_0x4caf67,_0xc3f347){return new BPromise(function(_0x4fac9a,_0x497630){_0xc3f347=combineOptions(_0xc3f347);var _0x224467=new Buffer(_0x4caf67);var _0x35c5ac=fs[_0x8823('0x12')](_0x3053f8);var _0x41b6f3=fs[_0x8823('0x13')](_0x20079e);var _0x182c93=crypto['createDecipher'](_0xc3f347[_0x8823('0xa')],_0x224467);_0x35c5ac['on'](_0x8823('0x14'),function(_0xdeee13){var _0x576a8c=new Buffer(_0x182c93[_0x8823('0x15')](_0xdeee13),'binary');_0x41b6f3['write'](_0x576a8c);});_0x35c5ac['on'](_0x8823('0x19'),function(){try{var _0x5542f5=new Buffer(_0x182c93[_0x8823('0x18')](_0x8823('0x16')),'binary');_0x41b6f3[_0x8823('0x17')](_0x5542f5);_0x41b6f3[_0x8823('0x19')]();_0x41b6f3['on'](_0x8823('0x1a'),function(){return _0x4fac9a(_0x20079e);});}catch(_0x1fb006){fs[_0x8823('0x1b')](_0x20079e);return _0x497630(_0x1fb006);}});});};exports[_0x8823('0x1c')]=function(_0x223949,_0x3214ea,_0x4beb65){var _0x314c1a=_0x4beb65||stringOptions['algorithm'];var _0x45a0f0=_0x3214ea||stringOptions[_0x8823('0x1d')];var _0x4d3a96=crypto[_0x8823('0x1e')](_0x314c1a,_0x45a0f0);var _0x451552=_0x4d3a96['update'](_0x223949,_0x8823('0x1f'),_0x8823('0x20'));_0x451552+=_0x4d3a96[_0x8823('0x18')]('base64');return _0x451552;};exports[_0x8823('0x21')]=function(_0x25c933,_0x2cd58b,_0x1ebc89){var _0x59d80d=_0x1ebc89||stringOptions[_0x8823('0xa')];var _0x4bd365=_0x2cd58b||stringOptions[_0x8823('0x1d')];var _0x5add6d=crypto[_0x8823('0x22')](_0x59d80d,_0x4bd365);var _0x15d4a7=_0x5add6d[_0x8823('0x15')](_0x25c933,_0x8823('0x20'),_0x8823('0x1f'));_0x15d4a7+=_0x5add6d[_0x8823('0x18')]('utf8');return _0x15d4a7;}; \ No newline at end of file +var _0xc13b=['join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','encryptFile','createReadStream','createWriteStream','createCipher','update','write','binary','end','unlink','decryptFile','final','close','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes192','encrypt','algorithm'];(function(_0x1e0578,_0xcef6e8){var _0x39a65a=function(_0x33529c){while(--_0x33529c){_0x1e0578['push'](_0x1e0578['shift']());}};_0x39a65a(++_0xcef6e8);}(_0xc13b,0x1c4));var _0xbc13=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xc13b[_0x550d12];return _0x12103d;};'use strict';var crypto=require(_0xbc13('0x0'));var fs=require('fs');var BPromise=require(_0xbc13('0x1'));var _=require(_0xbc13('0x2'));var config=require(_0xbc13('0x3'));var logger=require(_0xbc13('0x4'))(_0xbc13('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xbc13('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xbc13('0x7')};if(config['encrypt']&&config[_0xbc13('0x8')][_0xbc13('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xbc13('0x9')]);if(isSupported){fileOptions[_0xbc13('0x9')]=config[_0xbc13('0x8')][_0xbc13('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xbc13('0xa')](',\x20');logger[_0xbc13('0xb')](config[_0xbc13('0x8')]['algorithm'],_0xbc13('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x37e95a){return AES_SUPPORTED_RX['test'](_0x37e95a);}function getSupportedCiphers(){return crypto[_0xbc13('0xd')]()[_0xbc13('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x1e23cb){return getSupportedCiphers()['indexOf'](_0x1e23cb)>-0x1;}function combineOptions(_0x4bf022){var _0x93d758={};for(var _0x3d828e in fileOptions){if(fileOptions['hasOwnProperty'](_0x3d828e)){_0x93d758[_0x3d828e]=fileOptions[_0x3d828e];}}if(_0x4bf022){for(var _0x133383 in _0x4bf022){if(_0x4bf022['hasOwnProperty'](_0x133383)){_0x93d758[_0x133383]=_0x4bf022[_0x133383];}}}return _0x93d758;}exports[_0xbc13('0xf')]=function(_0x39fe92,_0x1258ba,_0x59b4c7,_0x33ec67){return new BPromise(function(_0x9a10cf,_0x27922f){_0x33ec67=combineOptions(_0x33ec67);var _0x3b5bfc=new Buffer(_0x59b4c7);var _0x11147c=fs[_0xbc13('0x10')](_0x39fe92);var _0x32ac3f=fs[_0xbc13('0x11')](_0x1258ba);var _0x5b5701=crypto[_0xbc13('0x12')](_0x33ec67[_0xbc13('0x9')],_0x3b5bfc);_0x11147c['on']('data',function(_0x1437ae){var _0x11e09d=new Buffer(_0x5b5701[_0xbc13('0x13')](_0x1437ae),'binary');_0x32ac3f[_0xbc13('0x14')](_0x11e09d);});_0x11147c['on']('end',function(){try{var _0x491ee1=new Buffer(_0x5b5701['final'](_0xbc13('0x15')),_0xbc13('0x15'));_0x32ac3f[_0xbc13('0x14')](_0x491ee1);_0x32ac3f[_0xbc13('0x16')]();_0x32ac3f['on']('close',function(){return _0x9a10cf(_0x1258ba);});}catch(_0x13dc2e){fs[_0xbc13('0x17')](_0x1258ba);return _0x27922f(_0x13dc2e);}});});};exports[_0xbc13('0x18')]=function(_0x367d64,_0x838e8,_0x23c8fa,_0x3722a3){return new BPromise(function(_0x1b74f4,_0x3f56aa){_0x3722a3=combineOptions(_0x3722a3);var _0xaf2a48=new Buffer(_0x23c8fa);var _0x116352=fs[_0xbc13('0x10')](_0x367d64);var _0x144a20=fs['createWriteStream'](_0x838e8);var _0x25c4a4=crypto['createDecipher'](_0x3722a3['algorithm'],_0xaf2a48);_0x116352['on']('data',function(_0x4ecf9b){var _0x5f2e79=new Buffer(_0x25c4a4['update'](_0x4ecf9b),'binary');_0x144a20[_0xbc13('0x14')](_0x5f2e79);});_0x116352['on']('end',function(){try{var _0x4e3e6e=new Buffer(_0x25c4a4[_0xbc13('0x19')](_0xbc13('0x15')),_0xbc13('0x15'));_0x144a20[_0xbc13('0x14')](_0x4e3e6e);_0x144a20[_0xbc13('0x16')]();_0x144a20['on'](_0xbc13('0x1a'),function(){return _0x1b74f4(_0x838e8);});}catch(_0x3165ec){fs[_0xbc13('0x17')](_0x838e8);return _0x3f56aa(_0x3165ec);}});});};exports[_0xbc13('0x1b')]=function(_0x37bfaa,_0x540f78,_0x5a6b9c){var _0x98c01e=_0x5a6b9c||stringOptions[_0xbc13('0x9')];var _0x2c3bb0=_0x540f78||stringOptions[_0xbc13('0x1c')];var _0x247ddd=crypto[_0xbc13('0x12')](_0x98c01e,_0x2c3bb0);var _0xc12b5b=_0x247ddd[_0xbc13('0x13')](_0x37bfaa,_0xbc13('0x1d'),_0xbc13('0x1e'));_0xc12b5b+=_0x247ddd['final']('base64');return _0xc12b5b;};exports[_0xbc13('0x1f')]=function(_0x6a3c07,_0x4df4c9,_0x453f9d){var _0x3c47a2=_0x453f9d||stringOptions[_0xbc13('0x9')];var _0x4d3f1c=_0x4df4c9||stringOptions['secret'];var _0x22095e=crypto[_0xbc13('0x20')](_0x3c47a2,_0x4d3f1c);var _0x45fa05=_0x22095e[_0xbc13('0x13')](_0x6a3c07,_0xbc13('0x1e'),_0xbc13('0x1d'));_0x45fa05+=_0x22095e[_0xbc13('0x19')]('utf8');return _0x45fa05;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index b76a713..f738099 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 _0xde8d=['join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','length','range','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','dirname','basename','.csv'];(function(_0x2fd4ba,_0x54c99a){var _0x4cc444=function(_0x566c03){while(--_0x566c03){_0x2fd4ba['push'](_0x2fd4ba['shift']());}};_0x4cc444(++_0x54c99a);}(_0xde8d,0xde));var _0xdde8=function(_0x4edee4,_0x44d517){_0x4edee4=_0x4edee4-0x0;var _0x2e9f70=_0xde8d[_0x4edee4];return _0x2e9f70;};'use strict';var util=require(_0xdde8('0x0'));var path=require(_0xdde8('0x1'));var _=require('lodash');var csv=require(_0xdde8('0x2'));var fs=require('fs');var BPromise=require(_0xdde8('0x3'));var zipdir=require(_0xdde8('0x4'));var rimraf=require(_0xdde8('0x5'));var db=require(_0xdde8('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xdde8('0x7'))(_0xdde8('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdde8('0x9')][0x3];var PATH=process[_0xdde8('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1a2cf2,_0x416b2b){var _0x8df33c={'status':_0x1a2cf2};var _0x829be9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x416b2b){_0x8df33c[_0xdde8('0xa')]=_0x416b2b;}return db['AnalyticExtractedReport'][_0xdde8('0xb')](_0x8df33c,_0x829be9);}function main(){var _0x2e4801=0x1388;var _0x39918e;logger[_0xdde8('0xc')](util['format'](_0xdde8('0xd'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xdde8('0xe')][_0xdde8('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdde8('0x10'),_0xdde8('0x11')]})[_0xdde8('0x12')](function(_0x2d9108){if(_0x2d9108){_0x39918e=_0x2d9108;_0x2e4801=_0x39918e['splitSizeCsv']||0x1388;}})[_0xdde8('0x12')](function(){return dbH['sequelize']['query'](util[_0xdde8('0x13')](_0xdde8('0x14'),QUERY),{'type':dbH['sequelize'][_0xdde8('0x15')]['SELECT']});})['then'](function(_0x59a0f1){if(!_0x59a0f1[0x0][_0xdde8('0x16')]){return analyticExtractedReport('Empty');}var _0x13ccc6=[];var _0x474cbc=0x0;if(_0x39918e[_0xdde8('0x10')]){if(_0x59a0f1&&_0x59a0f1[_0xdde8('0x17')]){var _0x2ee72b=_[_0xdde8('0x18')](_0x59a0f1[0x0][_0xdde8('0x16')]/_0x2e4801);var _0x5c66aa=Number['isInteger'](_0x59a0f1[0x0][_0xdde8('0x16')]/_0x2e4801)?_0x59a0f1[0x0][_0xdde8('0x16')]%_0x2e4801:0x0;_0x2ee72b['forEach'](function(_0x59a6e8){if(_0x59a6e8>0x0){_0x474cbc+=_0x2e4801;}_0x13ccc6['push'](dbH[_0xdde8('0x19')][_0xdde8('0x1a')](util['format'](_0xdde8('0x1b'),QUERY,_0x2e4801,_0x474cbc),{'type':dbH[_0xdde8('0x19')][_0xdde8('0x15')][_0xdde8('0x1c')]}));});if(_0x5c66aa>0x0){_0x474cbc+=_0x2e4801;_0x13ccc6[_0xdde8('0x1d')](dbH['sequelize']['query'](util[_0xdde8('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5c66aa,_0x474cbc),{'type':dbH['sequelize'][_0xdde8('0x15')][_0xdde8('0x1c')]}));}}}else{_0x13ccc6[_0xdde8('0x1d')](dbH['sequelize'][_0xdde8('0x1a')](QUERY,{'type':dbH['sequelize'][_0xdde8('0x15')]['SELECT']}));}var _0x4b92ce=path[_0xdde8('0x1e')](PATH);var _0x5ea744=path[_0xdde8('0x1f')](PATH,_0xdde8('0x20'));var _0x505b42=_0x39918e[_0xdde8('0x10')]&&_0x13ccc6['length']>0x1;var _0x5cd650=[];if(!fs['existsSync'](path[_0xdde8('0x21')](_0x4b92ce,_0x5ea744))&&_0x505b42){fs[_0xdde8('0x22')](path['join'](_0x4b92ce,_0x5ea744));}return BPromise[_0xdde8('0x23')](_0x13ccc6,function(_0x11046f){_0x5cd650[_0xdde8('0x1d')](_0x11046f);})[_0xdde8('0x12')](function(){for(var _0x4ec8ec=0x0;_0x4ec8ec<_0x5cd650[_0xdde8('0x17')];_0x4ec8ec+=0x1){var _0x57d7fa;var _0x5bbff9=_0x5cd650[_0x4ec8ec];if(_0x505b42){_0x57d7fa=path['join'](_0x4b92ce,_0x5ea744,util[_0xdde8('0x13')](_0xdde8('0x24'),_0x5ea744,_0x4ec8ec,_0xdde8('0x25')));}else{_0x57d7fa=path['join'](_0x4b92ce,util['format'](_0xdde8('0x26'),_0x5ea744,_0xdde8('0x25')));}fs[_0xdde8('0x27')](_0x57d7fa,csv(_0x5bbff9));}})['then'](function(){if(_0x505b42){return new Promise(function(_0x5a3aaa){zipdir(path[_0xdde8('0x21')](_0x4b92ce,_0x5ea744),{'saveTo':path[_0xdde8('0x21')](_0x4b92ce,util[_0xdde8('0x13')](_0xdde8('0x26'),_0x5ea744,_0xdde8('0x28')))},function(_0x1d4af2,_0x21293d){rimraf(path[_0xdde8('0x21')](_0x4b92ce,_0x5ea744),function(){});_0x5a3aaa(_0xdde8('0x29'));});});}})[_0xdde8('0x12')](function(){logger[_0xdde8('0xc')](util[_0xdde8('0x13')](_0xdde8('0x2a'),EXTRACTED_REPORT_ID,_0xdde8('0x2b')));return analyticExtractedReport(_0xdde8('0x2c'),_0x505b42?util[_0xdde8('0x13')](_0xdde8('0x26'),_0x5ea744,_0x505b42?'zip':_0xdde8('0x25')):null);});})[_0xdde8('0x2d')](function(_0x1a6956){logger['info'](util['format'](_0xdde8('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xdde8('0x2f')](_0x1a6956,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdde8('0x30'));})[_0xdde8('0x31')](function(){process[_0xdde8('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x92ba=['push','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','inspect','Failed','exit','util','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x92ba,0x190));var _0xa92b=function(_0x46e881,_0x1726ae){_0x46e881=_0x46e881-0x0;var _0x2236f0=_0x92ba[_0x46e881];return _0x2236f0;};'use strict';var util=require(_0xa92b('0x0'));var path=require('path');var _=require('lodash');var csv=require(_0xa92b('0x1'));var fs=require('fs');var BPromise=require(_0xa92b('0x2'));var zipdir=require(_0xa92b('0x3'));var rimraf=require(_0xa92b('0x4'));var db=require(_0xa92b('0x5'))['db'];var dbH=require(_0xa92b('0x5'))[_0xa92b('0x6')];var logger=require(_0xa92b('0x7'))(_0xa92b('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xa92b('0x9')][0x2]);var QUERY=process[_0xa92b('0x9')][0x3];var PATH=process[_0xa92b('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x37e319,_0x45ee37){var _0x48227e={'status':_0x37e319};var _0x3476b8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x45ee37){_0x48227e[_0xa92b('0xa')]=_0x45ee37;}return db['AnalyticExtractedReport'][_0xa92b('0xb')](_0x48227e,_0x3476b8);}function main(){var _0x44acd5=0x1388;var _0x32785d;logger[_0xa92b('0xc')](util[_0xa92b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa92b('0xe')));return db[_0xa92b('0xf')][_0xa92b('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa92b('0x11'),_0xa92b('0x12')]})[_0xa92b('0x13')](function(_0x29c1ab){if(_0x29c1ab){_0x32785d=_0x29c1ab;_0x44acd5=_0x32785d[_0xa92b('0x12')]||0x1388;}})[_0xa92b('0x13')](function(){return dbH[_0xa92b('0x14')][_0xa92b('0x15')](util['format'](_0xa92b('0x16'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xa92b('0x17')]});})[_0xa92b('0x13')](function(_0x2f8d25){if(!_0x2f8d25[0x0][_0xa92b('0x18')]){return analyticExtractedReport(_0xa92b('0x19'));}var _0x1fb8a6=[];var _0x41ef61=0x0;if(_0x32785d['split']){if(_0x2f8d25&&_0x2f8d25[_0xa92b('0x1a')]){var _0x592d0a=_[_0xa92b('0x1b')](_0x2f8d25[0x0][_0xa92b('0x18')]/_0x44acd5);var _0x55eca3=Number[_0xa92b('0x1c')](_0x2f8d25[0x0]['num']/_0x44acd5)?_0x2f8d25[0x0][_0xa92b('0x18')]%_0x44acd5:0x0;_0x592d0a[_0xa92b('0x1d')](function(_0x5c6443){if(_0x5c6443>0x0){_0x41ef61+=_0x44acd5;}_0x1fb8a6['push'](dbH[_0xa92b('0x14')]['query'](util[_0xa92b('0xd')](_0xa92b('0x1e'),QUERY,_0x44acd5,_0x41ef61),{'type':dbH[_0xa92b('0x14')][_0xa92b('0x1f')][_0xa92b('0x17')]}));});if(_0x55eca3>0x0){_0x41ef61+=_0x44acd5;_0x1fb8a6[_0xa92b('0x20')](dbH['sequelize'][_0xa92b('0x15')](util['format'](_0xa92b('0x1e'),QUERY,_0x55eca3,_0x41ef61),{'type':dbH[_0xa92b('0x14')][_0xa92b('0x1f')]['SELECT']}));}}}else{_0x1fb8a6[_0xa92b('0x20')](dbH[_0xa92b('0x14')][_0xa92b('0x15')](QUERY,{'type':dbH[_0xa92b('0x14')][_0xa92b('0x1f')][_0xa92b('0x17')]}));}var _0x162510=path['dirname'](PATH);var _0x2ecc8b=path['basename'](PATH,_0xa92b('0x21'));var _0x55d531=_0x32785d['split']&&_0x1fb8a6[_0xa92b('0x1a')]>0x1;var _0x527362=[];if(!fs[_0xa92b('0x22')](path[_0xa92b('0x23')](_0x162510,_0x2ecc8b))&&_0x55d531){fs[_0xa92b('0x24')](path[_0xa92b('0x23')](_0x162510,_0x2ecc8b));}return BPromise[_0xa92b('0x25')](_0x1fb8a6,function(_0x24f981){_0x527362['push'](_0x24f981);})[_0xa92b('0x13')](function(){for(var _0x3e71ff=0x0;_0x3e71ff<_0x527362[_0xa92b('0x1a')];_0x3e71ff+=0x1){var _0x1d56fa;var _0x5301cc=_0x527362[_0x3e71ff];if(_0x55d531){_0x1d56fa=path['join'](_0x162510,_0x2ecc8b,util[_0xa92b('0xd')](_0xa92b('0x26'),_0x2ecc8b,_0x3e71ff,_0xa92b('0x27')));}else{_0x1d56fa=path[_0xa92b('0x23')](_0x162510,util[_0xa92b('0xd')](_0xa92b('0x28'),_0x2ecc8b,_0xa92b('0x27')));}fs[_0xa92b('0x29')](_0x1d56fa,csv(_0x5301cc));}})[_0xa92b('0x13')](function(){if(_0x55d531){return new Promise(function(_0x5acd73){zipdir(path['join'](_0x162510,_0x2ecc8b),{'saveTo':path[_0xa92b('0x23')](_0x162510,util[_0xa92b('0xd')](_0xa92b('0x28'),_0x2ecc8b,_0xa92b('0x2a')))},function(_0x224c2b,_0x50d7f2){rimraf(path[_0xa92b('0x23')](_0x162510,_0x2ecc8b),function(){});_0x5acd73(_0xa92b('0x2b'));});});}})[_0xa92b('0x13')](function(){logger[_0xa92b('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xa92b('0xe')));return analyticExtractedReport(_0xa92b('0x2c'),_0x55d531?util['format'](_0xa92b('0x28'),_0x2ecc8b,_0x55d531?'zip':_0xa92b('0x27')):null);});})['catch'](function(_0x184b72){logger[_0xa92b('0xc')](util[_0xa92b('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xa92b('0xe')),util[_0xa92b('0x2d')](_0x184b72,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xa92b('0x2e'));})['finally'](function(){process[_0xa92b('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index dea2331..ab21a81 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 _0x6f30=['pick','map','value','fill','auto','body','push','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','length','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','find','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','split','existsSync','join','each','flatten','createPdfKitDocument','all','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','pdf','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-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','tableHeader'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0x6f30,0x1a2));var _0x06f3=function(_0x507056,_0xe16b72){_0x507056=_0x507056-0x0;var _0x4eaecc=_0x6f30[_0x507056];return _0x4eaecc;};'use strict';var _=require(_0x06f3('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x06f3('0x1'));var moment=require(_0x06f3('0x2'));var htmlToPdfmake=require(_0x06f3('0x3'));var PdfPrinter=require(_0x06f3('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x06f3('0x5'))[_0x06f3('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x06f3('0x7'));var db=require(_0x06f3('0x8'))['db'];var dbH=require(_0x06f3('0x8'))[_0x06f3('0x9')];var logger=require(_0x06f3('0xa'))(_0x06f3('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x06f3('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0xb1a221,_0x345f2c){var _0x1a58c4={'status':_0xb1a221};var _0x51758e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x345f2c){_0x1a58c4[_0x06f3('0xd')]=_0x345f2c;}return db[_0x06f3('0xe')][_0x06f3('0xf')](_0x1a58c4,_0x51758e);}function getHeaders(_0x45f3f1){return _['map'](_0x45f3f1,function(_0x1f0418){return{'text':_0x1f0418,'style':_0x06f3('0x10')};});}function getRows(_0x104c0c,_0x575685){return _['map'](_0x575685,function(_0x15ed07){return _(_0x15ed07)[_0x06f3('0x11')](_0x104c0c)[_0x06f3('0x12')](function(_0x3ec85f){return _0x3ec85f?_['toString'](_0x3ec85f):'';})[_0x06f3('0x13')]();});}function createTable(_0x3578c5,_0x449504){var _0x957e0d={'widths':_[_0x06f3('0x14')](Array(_0x3578c5['length']),0x91),'heights':function(_0x272af3){return _0x272af3===0x0?_0x06f3('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5563b4=getHeaders(_0x3578c5);_0x957e0d[_0x06f3('0x16')][_0x06f3('0x17')](_0x5563b4);var _0x544b57=getRows(_0x3578c5,_0x449504);_0x957e0d[_0x06f3('0x16')]=_0x957e0d[_0x06f3('0x16')]['concat'](_0x544b57);return _0x957e0d;}function createTables(_0x4c42df){var _0x3ebae6=[];var _0x31609d=_[_0x06f3('0x18')](Object['keys'](_0x4c42df[0x0]),0x5);_0x31609d[_0x06f3('0x19')](function(_0x1fcafa){_0x3ebae6[_0x06f3('0x17')](createTable(_0x1fcafa,_0x4c42df));});return _0x3ebae6;}function getPDFDocDefinition(_0x143a0a){var _0x1bd282=util[_0x06f3('0x1a')](_0x06f3('0x1b'),NAME,EXTRACTED_REPORT[_0x06f3('0x1c')],moment(EXTRACTED_REPORT[_0x06f3('0x1d')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x06f3('0x1a')](FORMAT));var _0x10cd28=[];for(var _0x5170b1=0x0;_0x5170b1<_0x143a0a[_0x06f3('0x1e')];_0x5170b1++){var _0x341d6e=[];if(_0x5170b1===0x0){_0x341d6e[_0x06f3('0x17')]({'text':_0x1bd282,'style':_0x06f3('0x1f')});}var _0xed8926={'table':_0x143a0a[_0x5170b1]};if(_0x5170b1>0x0){_0xed8926[_0x06f3('0x20')]=_0x06f3('0x21');_0xed8926[_0x06f3('0x22')]=[0x0,0x46,0x0,0x0];}_0x341d6e[_0x06f3('0x17')](_0xed8926);_0x10cd28[_0x06f3('0x17')](_0x341d6e);}return{'pageSize':'A4','pageOrientation':_0x06f3('0x23'),'content':_0x10cd28,'footer':function(_0x4e09b3,_0x344df8){return{'text':_0x4e09b3['toString']()+_0x06f3('0x24')+_0x344df8,'style':_0x06f3('0x25')};},'defaultStyle':{'font':_0x06f3('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x06f3('0x27')},'footer':{'alignment':_0x06f3('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x403d9a){var _0x5d5186=0x1388;var _0x84fc62;if(!_0x403d9a[0x0][_0x06f3('0x29')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x06f3('0x2a')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x06f3('0x2b')]})[_0x06f3('0x2c')](function(_0x5dbda0){if(_0x5dbda0){_0x84fc62=_0x5dbda0;_0x5d5186=_0x84fc62['splitSizePdf']||0x3e8;}})[_0x06f3('0x2c')](function(){var _0x4e091a=[];var _0x20d4ee=0x0;if(_0x84fc62['split']){if(_0x403d9a&&_0x403d9a[_0x06f3('0x1e')]){var _0x5e4911=_['range'](_0x403d9a[0x0][_0x06f3('0x29')]/_0x5d5186);var _0x504086=Number[_0x06f3('0x2d')](_0x403d9a[0x0][_0x06f3('0x29')]/_0x5d5186)?_0x403d9a[0x0][_0x06f3('0x29')]%_0x5d5186:0x0;_0x5e4911[_0x06f3('0x19')](function(_0xbef3e0){if(_0xbef3e0>0x0){_0x20d4ee+=_0x5d5186;}_0x4e091a[_0x06f3('0x17')](dbH[_0x06f3('0x2e')][_0x06f3('0x2f')](util['format'](_0x06f3('0x30'),QUERY,_0x5d5186,_0x20d4ee),{'type':dbH['sequelize'][_0x06f3('0x31')][_0x06f3('0x32')]}));});if(_0x504086>0x0){_0x20d4ee+=_0x5d5186;_0x4e091a['push'](dbH[_0x06f3('0x2e')][_0x06f3('0x2f')](util[_0x06f3('0x1a')](_0x06f3('0x30'),QUERY,_0x504086,_0x20d4ee),{'type':dbH[_0x06f3('0x2e')][_0x06f3('0x31')][_0x06f3('0x32')]}));}}}else{_0x4e091a['push'](dbH[_0x06f3('0x2e')]['query'](QUERY,{'type':dbH[_0x06f3('0x2e')]['QueryTypes']['SELECT']}));}var _0x1abc3c=path[_0x06f3('0x33')](PATH);var _0x36dd25=path['basename'](PATH,'.pdf');var _0x584000=_0x84fc62[_0x06f3('0x34')]&&_0x4e091a[_0x06f3('0x1e')]>0x1;var _0x1c8d7f=[];if(!fs[_0x06f3('0x35')](path[_0x06f3('0x36')](_0x1abc3c,_0x36dd25))&&_0x584000){fs['mkdirSync'](path['join'](_0x1abc3c,_0x36dd25));}return BPromise[_0x06f3('0x37')](_0x4e091a,function(_0x24b7ec){_0x1c8d7f['push'](_0x24b7ec);})['then'](function(){var _0x2b9427=[];for(var _0x4f6393=0x0;_0x4f6393<_0x1c8d7f[_0x06f3('0x1e')];_0x4f6393+=0x1){var _0x24bba3=_0x1c8d7f[_0x4f6393];var _0x3a69cb=createTables(_[_0x06f3('0x38')](_0x24bba3));var _0x29b045;var _0x2170e6=getPDFDocDefinition(_0x3a69cb);var _0x13c8be=getPDFPrinter();var _0x13be6e=_0x13c8be[_0x06f3('0x39')](_0x2170e6);if(_0x584000){_0x29b045=path['join'](_0x1abc3c,_0x36dd25,util[_0x06f3('0x1a')]('%s%d.%s',_0x36dd25,_0x4f6393,'pdf'));}else{_0x29b045=path[_0x06f3('0x36')](_0x1abc3c,util[_0x06f3('0x1a')]('%s.%s',_0x36dd25,'pdf'));}_0x2b9427[_0x06f3('0x17')](writePDFDocument(_0x13be6e,_0x29b045));}return Promise[_0x06f3('0x3a')](_0x2b9427);})['then'](function(){if(_0x584000){return new Promise(function(_0x21d257){zipdir(path[_0x06f3('0x36')](_0x1abc3c,_0x36dd25),{'saveTo':path[_0x06f3('0x36')](_0x1abc3c,util[_0x06f3('0x1a')](_0x06f3('0x3b'),_0x36dd25,'zip'))},function(){rimraf(path[_0x06f3('0x36')](_0x1abc3c,_0x36dd25),function(){});_0x21d257(_0x06f3('0x3c'));});});}})[_0x06f3('0x2c')](function(){if(!_0x584000)return;rimraf(path[_0x06f3('0x36')](_0x1abc3c,_0x36dd25),function(){});})['then'](function(){logger[_0x06f3('0x3d')](util[_0x06f3('0x1a')](_0x06f3('0x3e'),EXTRACTED_REPORT_ID,_0x06f3('0x3f')));return analyticExtractedReport(_0x06f3('0x40'),_0x584000?util['format'](_0x06f3('0x3b'),_0x36dd25,_0x584000?_0x06f3('0x41'):_0x06f3('0x42')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x06f3('0x3d')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x06f3('0x3f')));return db[_0x06f3('0xe')][_0x06f3('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x06f3('0x2c')](function(_0x3051f7){EXTRACTED_REPORT=_0x3051f7;return dbH['sequelize'][_0x06f3('0x2f')](util[_0x06f3('0x1a')](_0x06f3('0x44'),QUERY),{'type':dbH[_0x06f3('0x2e')][_0x06f3('0x31')][_0x06f3('0x32')]});})[_0x06f3('0x2c')](extractReport)[_0x06f3('0x45')](function(_0x310ea4){logger['info'](util[_0x06f3('0x1a')](_0x06f3('0x46'),EXTRACTED_REPORT_ID,_0x06f3('0x3f')),util[_0x06f3('0x47')](_0x310ea4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x06f3('0x48')](function(){process[_0x06f3('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x118319=new PdfPrinter({'Arial':{'normal':__dirname+_0x06f3('0x4a'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x06f3('0x4b'),'bolditalics':__dirname+_0x06f3('0x4c')}});return _0x118319;}function getPDFDocDefinitionFromHTML(_0xcc54f2,_0xd4f469){var _0x446254=util[_0x06f3('0x1a')](_0x06f3('0x4d'),_0xd4f469['channel'],_0xd4f469[_0x06f3('0x4e')]);var _0xec86ad=moment()[_0x06f3('0x1a')]('YYYY-MM-DD')['toString']();var _0x329f04=htmlToPdfmake(_0xcc54f2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x329f04],'defaultStyle':{'font':_0x06f3('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x06f3('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x06f3('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x06f3('0x4f')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x06f3('0x1f')}];},'footer':function(_0x40c7e3,_0x51113c){return[{'text':util[_0x06f3('0x1a')](_0x06f3('0x50'),_0x446254,_0x40c7e3,_0x51113c,_0xec86ad),'style':_0x06f3('0x25')}];}};}function writePDFDocument(_0x493298,_0x8e85fb){return new Promise(function(_0x530918,_0x4dd9dc){var _0x5ac115=_0x493298[_0x06f3('0x51')](fs[_0x06f3('0x52')](_0x8e85fb));_0x5ac115['on'](_0x06f3('0x53'),function(){_0x530918(_0x06f3('0x53'));});_0x5ac115['on'](_0x06f3('0x54'),function(_0x3a5e45){_0x4dd9dc(_0x3a5e45);});_0x493298[_0x06f3('0x55')]();});}exports[_0x06f3('0x56')]=function(_0x209711,_0x944d46){var _0x2fbcd4=getPDFPrinter();var _0x4e8583=getPDFDocDefinitionFromHTML(_0x209711,_0x944d46);var _0x8ff6be=_0x2fbcd4[_0x06f3('0x39')](_0x4e8583);return writePDFDocument(_0x8ff6be,_0x944d46[_0x06f3('0x1')])[_0x06f3('0x45')](function(_0x4fde93){throw _0x4fde93;});}; \ No newline at end of file +var _0x1273=['interactionId','YYYY-MM-DD','center','finish','error','end','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','length','auto','body','concat','chunk','keys','forEach','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','\x20/\x20','footer','Arial','right','num','Empty','Setting','splitSizePdf','then','split','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','zip','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d'];(function(_0x4f217f,_0x313163){var _0x3b583a=function(_0x334971){while(--_0x334971){_0x4f217f['push'](_0x4f217f['shift']());}};_0x3b583a(++_0x313163);}(_0x1273,0x10c));var _0x3127=function(_0x44699d,_0x3df3e1){_0x44699d=_0x44699d-0x0;var _0x338949=_0x1273[_0x44699d];return _0x338949;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x3127('0x0'));var path=require(_0x3127('0x1'));var moment=require(_0x3127('0x2'));var htmlToPdfmake=require(_0x3127('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x3127('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x3127('0x5'))[_0x3127('0x6')];var window=new JSDOM('')[_0x3127('0x7')];var BPromise=require(_0x3127('0x8'));var db=require(_0x3127('0x9'))['db'];var dbH=require(_0x3127('0x9'))[_0x3127('0xa')];var logger=require(_0x3127('0xb'))(_0x3127('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3127('0xd')][0x3];var PATH=process[_0x3127('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ddd2a,_0x434649){var _0x23c472={'status':_0x4ddd2a};var _0xb3a2c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x434649){_0x23c472[_0x3127('0xe')]=_0x434649;}return db[_0x3127('0xf')][_0x3127('0x10')](_0x23c472,_0xb3a2c);}function getHeaders(_0x344fcd){return _[_0x3127('0x11')](_0x344fcd,function(_0x43b814){return{'text':_0x43b814,'style':'tableHeader'};});}function getRows(_0x53a959,_0x1e5eeb){return _['map'](_0x1e5eeb,function(_0x578223){return _(_0x578223)[_0x3127('0x12')](_0x53a959)[_0x3127('0x11')](function(_0x5878cf){return _0x5878cf?_[_0x3127('0x13')](_0x5878cf):'';})[_0x3127('0x14')]();});}function createTable(_0x10fb9b,_0x4f350c){var _0x2893e2={'widths':_['fill'](Array(_0x10fb9b[_0x3127('0x15')]),0x91),'heights':function(_0x4f7b0d){return _0x4f7b0d===0x0?_0x3127('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4c2b8d=getHeaders(_0x10fb9b);_0x2893e2['body']['push'](_0x4c2b8d);var _0x5c737b=getRows(_0x10fb9b,_0x4f350c);_0x2893e2['body']=_0x2893e2[_0x3127('0x17')][_0x3127('0x18')](_0x5c737b);return _0x2893e2;}function createTables(_0x2d9529){var _0x5c91c8=[];var _0x358444=_[_0x3127('0x19')](Object[_0x3127('0x1a')](_0x2d9529[0x0]),0x5);_0x358444[_0x3127('0x1b')](function(_0x178a97){_0x5c91c8[_0x3127('0x1c')](createTable(_0x178a97,_0x2d9529));});return _0x5c91c8;}function getPDFDocDefinition(_0x14e83c){var _0x19e57e=util[_0x3127('0x1d')](_0x3127('0x1e'),NAME,EXTRACTED_REPORT[_0x3127('0x1f')],moment(EXTRACTED_REPORT[_0x3127('0x20')])[_0x3127('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x3127('0x21')])[_0x3127('0x1d')](FORMAT));var _0x511415=[];for(var _0x42d7a8=0x0;_0x42d7a8<_0x14e83c[_0x3127('0x15')];_0x42d7a8++){var _0x4d784f=[];if(_0x42d7a8===0x0){_0x4d784f['push']({'text':_0x19e57e,'style':_0x3127('0x22')});}var _0x530c0d={'table':_0x14e83c[_0x42d7a8]};if(_0x42d7a8>0x0){_0x530c0d[_0x3127('0x23')]=_0x3127('0x24');_0x530c0d['margin']=[0x0,0x46,0x0,0x0];}_0x4d784f[_0x3127('0x1c')](_0x530c0d);_0x511415['push'](_0x4d784f);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x511415,'footer':function(_0x2da17c,_0x207bad){return{'text':_0x2da17c['toString']()+_0x3127('0x25')+_0x207bad,'style':_0x3127('0x26')};},'defaultStyle':{'font':_0x3127('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x3127('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3ecc28){var _0x41b5e3=0x1388;var _0x5afa3e;if(!_0x3ecc28[0x0][_0x3127('0x29')]){return analyticExtractedReport(_0x3127('0x2a'));}return db[_0x3127('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x3127('0x2c')]})[_0x3127('0x2d')](function(_0x121b3b){if(_0x121b3b){_0x5afa3e=_0x121b3b;_0x41b5e3=_0x5afa3e[_0x3127('0x2c')]||0x3e8;}})[_0x3127('0x2d')](function(){var _0x5d7a99=[];var _0x43c634=0x0;if(_0x5afa3e[_0x3127('0x2e')]){if(_0x3ecc28&&_0x3ecc28[_0x3127('0x15')]){var _0xa9972=_[_0x3127('0x2f')](_0x3ecc28[0x0][_0x3127('0x29')]/_0x41b5e3);var _0x5a1be8=Number[_0x3127('0x30')](_0x3ecc28[0x0][_0x3127('0x29')]/_0x41b5e3)?_0x3ecc28[0x0][_0x3127('0x29')]%_0x41b5e3:0x0;_0xa9972[_0x3127('0x1b')](function(_0x23c49f){if(_0x23c49f>0x0){_0x43c634+=_0x41b5e3;}_0x5d7a99[_0x3127('0x1c')](dbH[_0x3127('0x31')][_0x3127('0x32')](util[_0x3127('0x1d')](_0x3127('0x33'),QUERY,_0x41b5e3,_0x43c634),{'type':dbH[_0x3127('0x31')][_0x3127('0x34')][_0x3127('0x35')]}));});if(_0x5a1be8>0x0){_0x43c634+=_0x41b5e3;_0x5d7a99['push'](dbH[_0x3127('0x31')][_0x3127('0x32')](util['format'](_0x3127('0x33'),QUERY,_0x5a1be8,_0x43c634),{'type':dbH[_0x3127('0x31')]['QueryTypes'][_0x3127('0x35')]}));}}}else{_0x5d7a99['push'](dbH['sequelize'][_0x3127('0x32')](QUERY,{'type':dbH[_0x3127('0x31')][_0x3127('0x34')][_0x3127('0x35')]}));}var _0x422f63=path[_0x3127('0x36')](PATH);var _0xd4a8e9=path[_0x3127('0x37')](PATH,_0x3127('0x38'));var _0x4e2509=_0x5afa3e['split']&&_0x5d7a99['length']>0x1;var _0x599f01=[];if(!fs[_0x3127('0x39')](path['join'](_0x422f63,_0xd4a8e9))&&_0x4e2509){fs['mkdirSync'](path[_0x3127('0x3a')](_0x422f63,_0xd4a8e9));}return BPromise[_0x3127('0x3b')](_0x5d7a99,function(_0x5c3aee){_0x599f01[_0x3127('0x1c')](_0x5c3aee);})['then'](function(){var _0x40b0d0=[];for(var _0x57f989=0x0;_0x57f989<_0x599f01[_0x3127('0x15')];_0x57f989+=0x1){var _0x487fdc=_0x599f01[_0x57f989];var _0x24daad=createTables(_['flatten'](_0x487fdc));var _0xfd2028;var _0x4a5d99=getPDFDocDefinition(_0x24daad);var _0x5a59c6=getPDFPrinter();var _0x3ec165=_0x5a59c6[_0x3127('0x3c')](_0x4a5d99);if(_0x4e2509){_0xfd2028=path['join'](_0x422f63,_0xd4a8e9,util[_0x3127('0x1d')](_0x3127('0x3d'),_0xd4a8e9,_0x57f989,'pdf'));}else{_0xfd2028=path[_0x3127('0x3a')](_0x422f63,util['format']('%s.%s',_0xd4a8e9,_0x3127('0x3e')));}_0x40b0d0[_0x3127('0x1c')](writePDFDocument(_0x3ec165,_0xfd2028));}return Promise[_0x3127('0x3f')](_0x40b0d0);})[_0x3127('0x2d')](function(){if(_0x4e2509){return new Promise(function(_0x11e2aa){zipdir(path[_0x3127('0x3a')](_0x422f63,_0xd4a8e9),{'saveTo':path[_0x3127('0x3a')](_0x422f63,util['format'](_0x3127('0x40'),_0xd4a8e9,'zip'))},function(){rimraf(path[_0x3127('0x3a')](_0x422f63,_0xd4a8e9),function(){});_0x11e2aa(_0x3127('0x41'));});});}})['then'](function(){if(!_0x4e2509)return;rimraf(path[_0x3127('0x3a')](_0x422f63,_0xd4a8e9),function(){});})[_0x3127('0x2d')](function(){logger['info'](util[_0x3127('0x1d')](_0x3127('0x42'),EXTRACTED_REPORT_ID,_0x3127('0x43')));return analyticExtractedReport(_0x3127('0x44'),_0x4e2509?util['format']('%s.%s',_0xd4a8e9,_0x4e2509?_0x3127('0x45'):_0x3127('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3127('0x46')](util[_0x3127('0x1d')](_0x3127('0x47'),EXTRACTED_REPORT_ID,_0x3127('0x43')));return db[_0x3127('0xf')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3127('0x2d')](function(_0x54d1c3){EXTRACTED_REPORT=_0x54d1c3;return dbH[_0x3127('0x31')][_0x3127('0x32')](util[_0x3127('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x3127('0x31')][_0x3127('0x34')][_0x3127('0x35')]});})['then'](extractReport)[_0x3127('0x48')](function(_0x427f10){logger[_0x3127('0x46')](util[_0x3127('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x3127('0x49')](_0x427f10,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x3127('0x4a')](function(){process[_0x3127('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xc6935d=new PdfPrinter({'Arial':{'normal':__dirname+_0x3127('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x3127('0x4d'),'bolditalics':__dirname+_0x3127('0x4e')}});return _0xc6935d;}function getPDFDocDefinitionFromHTML(_0x3aeb24,_0x28f214){var _0x500188=util['format'](_0x3127('0x4f'),_0x28f214['channel'],_0x28f214[_0x3127('0x50')]);var _0x314763=moment()['format'](_0x3127('0x51'))['toString']();var _0xc4172e=htmlToPdfmake(_0x3aeb24,{'window':window,'tableAutoSize':!![]});return{'content':[_0xc4172e],'defaultStyle':{'font':_0x3127('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3127('0x52'),'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':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x1ae373,_0xadca52){return[{'text':util[_0x3127('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x500188,_0x1ae373,_0xadca52,_0x314763),'style':_0x3127('0x26')}];}};}function writePDFDocument(_0x2a2e33,_0x128d8e){return new Promise(function(_0x937e77,_0x7db40a){var _0x340f88=_0x2a2e33['pipe'](fs['createWriteStream'](_0x128d8e));_0x340f88['on']('finish',function(){_0x937e77(_0x3127('0x53'));});_0x340f88['on'](_0x3127('0x54'),function(_0x335100){_0x7db40a(_0x335100);});_0x2a2e33[_0x3127('0x55')]();});}exports[_0x3127('0x56')]=function(_0x26004e,_0x4e10d9){var _0x110c6c=getPDFPrinter();var _0x28838d=getPDFDocDefinitionFromHTML(_0x26004e,_0x4e10d9);var _0x42f971=_0x110c6c[_0x3127('0x3c')](_0x28838d);return writePDFDocument(_0x42f971,_0x4e10d9[_0x3127('0x1')])[_0x3127('0x48')](function(_0x32f5e4){throw _0x32f5e4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 70c4208..c9fe756 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 _0x8544=['zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','split','length','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','path','lodash','json2xls'];(function(_0x2feb8f,_0x39a0f8){var _0x320700=function(_0x5c78f5){while(--_0x5c78f5){_0x2feb8f['push'](_0x2feb8f['shift']());}};_0x320700(++_0x39a0f8);}(_0x8544,0x11c));var _0x4854=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x8544[_0x1ae5ab];return _0x1ce001;};'use strict';var util=require(_0x4854('0x0'));var path=require(_0x4854('0x1'));var _=require(_0x4854('0x2'));var fs=require('fs');var json2xls=require(_0x4854('0x3'));var BPromise=require('bluebird');var zipdir=require(_0x4854('0x4'));var rimraf=require(_0x4854('0x5'));var db=require(_0x4854('0x6'))['db'];var dbH=require(_0x4854('0x6'))[_0x4854('0x7')];var logger=require(_0x4854('0x8'))(_0x4854('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x4854('0xa')][0x2]);var QUERY=process[_0x4854('0xa')][0x3];var PATH=process[_0x4854('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3079a8,_0x89c1e4){var _0x2265a7={'status':_0x3079a8};var _0x219f1b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x89c1e4){_0x2265a7[_0x4854('0xb')]=_0x89c1e4;}return db[_0x4854('0xc')]['update'](_0x2265a7,_0x219f1b);}function main(){var _0x2679ee=0x1388;var _0x375545;logger[_0x4854('0xd')](util[_0x4854('0xe')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4854('0xf')));return db[_0x4854('0x10')][_0x4854('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x4854('0x12')]})[_0x4854('0x13')](function(_0x26dbfd){if(_0x26dbfd){_0x375545=_0x26dbfd;_0x2679ee=_0x375545[_0x4854('0x12')]||0x1388;}})[_0x4854('0x13')](function(){return dbH[_0x4854('0x14')][_0x4854('0x15')](util[_0x4854('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4854('0x14')][_0x4854('0x16')][_0x4854('0x17')]});})['then'](function(_0x4d25e1){if(!_0x4d25e1[0x0]['num']){return analyticExtractedReport('Empty');}var _0x3b80cf=[];var _0x201814=0x0;if(_0x375545[_0x4854('0x18')]){if(_0x4d25e1&&_0x4d25e1[_0x4854('0x19')]){var _0x26cced=_['range'](_0x4d25e1[0x0][_0x4854('0x1a')]/_0x2679ee);var _0x10fbd2=Number[_0x4854('0x1b')](_0x4d25e1[0x0][_0x4854('0x1a')]/_0x2679ee)?_0x4d25e1[0x0][_0x4854('0x1a')]%_0x2679ee:0x0;_0x26cced[_0x4854('0x1c')](function(_0x27bcbe){if(_0x27bcbe>0x0){_0x201814+=_0x2679ee;}_0x3b80cf[_0x4854('0x1d')](dbH[_0x4854('0x14')][_0x4854('0x15')](util[_0x4854('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2679ee,_0x201814),{'type':dbH['sequelize'][_0x4854('0x16')][_0x4854('0x17')]}));});if(_0x10fbd2>0x0){_0x201814+=_0x2679ee;_0x3b80cf[_0x4854('0x1d')](dbH[_0x4854('0x14')][_0x4854('0x15')](util['format'](_0x4854('0x1e'),QUERY,_0x10fbd2,_0x201814),{'type':dbH[_0x4854('0x14')]['QueryTypes'][_0x4854('0x17')]}));}}}else{_0x3b80cf['push'](dbH['sequelize'][_0x4854('0x15')](QUERY,{'type':dbH[_0x4854('0x14')][_0x4854('0x16')][_0x4854('0x17')]}));}var _0x3ab6f1=path[_0x4854('0x1f')](PATH);var _0x1f1df2=path[_0x4854('0x20')](PATH,'.xlsx');var _0x20ed7c=_0x375545[_0x4854('0x18')]&&_0x3b80cf[_0x4854('0x19')]>0x1;var _0xc2335=[];if(!fs[_0x4854('0x21')](path[_0x4854('0x22')](_0x3ab6f1,_0x1f1df2))&&_0x20ed7c){fs[_0x4854('0x23')](path[_0x4854('0x22')](_0x3ab6f1,_0x1f1df2));}return BPromise[_0x4854('0x24')](_0x3b80cf,function(_0x640b0f){_0xc2335[_0x4854('0x1d')](_0x640b0f);})[_0x4854('0x13')](function(){for(var _0x586cf4=0x0;_0x586cf4<_0xc2335[_0x4854('0x19')];_0x586cf4+=0x1){var _0x139444;var _0x4ab15b=_0xc2335[_0x586cf4];if(_0x20ed7c){_0x139444=path[_0x4854('0x22')](_0x3ab6f1,_0x1f1df2,util['format'](_0x4854('0x25'),_0x1f1df2,_0x586cf4,'xlsx'));}else{_0x139444=path[_0x4854('0x22')](_0x3ab6f1,util[_0x4854('0xe')]('%s.%s',_0x1f1df2,_0x4854('0x26')));}fs['writeFileSync'](_0x139444,json2xls(_0x4ab15b),_0x4854('0x27'));}})[_0x4854('0x13')](function(){if(_0x20ed7c){return new Promise(function(_0x48c7c9){zipdir(path[_0x4854('0x22')](_0x3ab6f1,_0x1f1df2),{'saveTo':path[_0x4854('0x22')](_0x3ab6f1,util[_0x4854('0xe')](_0x4854('0x28'),_0x1f1df2,'zip'))},function(_0x32fc5e,_0x2c5c08){rimraf(path['join'](_0x3ab6f1,_0x1f1df2),function(){});_0x48c7c9('zip\x20finished');});});}})[_0x4854('0x13')](function(){logger['info'](util[_0x4854('0xe')](_0x4854('0x29'),EXTRACTED_REPORT_ID,_0x4854('0xf')));return analyticExtractedReport(_0x4854('0x2a'),_0x20ed7c?util['format']('%s.%s',_0x1f1df2,_0x20ed7c?_0x4854('0x2b'):_0x4854('0x26')):null);});})[_0x4854('0x2c')](function(_0x402b65){logger[_0x4854('0xd')](util[_0x4854('0xe')](_0x4854('0x2d'),EXTRACTED_REPORT_ID,_0x4854('0xf')),util[_0x4854('0x2e')](_0x402b65,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x4854('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe7d2=['num','Empty','length','range','forEach','push','dirname','.xlsx','existsSync','each','join','%s%d.%s','xlsx','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xe7d2,0x13c));var _0x2e7d=function(_0x39d38e,_0x3da1f7){_0x39d38e=_0x39d38e-0x0;var _0x18e737=_0xe7d2[_0x39d38e];return _0x18e737;};'use strict';var util=require(_0x2e7d('0x0'));var path=require(_0x2e7d('0x1'));var _=require(_0x2e7d('0x2'));var fs=require('fs');var json2xls=require(_0x2e7d('0x3'));var BPromise=require(_0x2e7d('0x4'));var zipdir=require(_0x2e7d('0x5'));var rimraf=require(_0x2e7d('0x6'));var db=require(_0x2e7d('0x7'))['db'];var dbH=require(_0x2e7d('0x7'))['dbH'];var logger=require(_0x2e7d('0x8'))(_0x2e7d('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x2e7d('0xa')][0x3];var PATH=process[_0x2e7d('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5287d9,_0x1f7e3a){var _0x47cd5e={'status':_0x5287d9};var _0x1f8e77={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f7e3a){_0x47cd5e['savename']=_0x1f7e3a;}return db[_0x2e7d('0xb')][_0x2e7d('0xc')](_0x47cd5e,_0x1f8e77);}function main(){var _0x9666cf=0x1388;var _0x596a30;logger[_0x2e7d('0xd')](util[_0x2e7d('0xe')](_0x2e7d('0xf'),EXTRACTED_REPORT_ID,_0x2e7d('0x10')));return db[_0x2e7d('0x11')][_0x2e7d('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2e7d('0x13'),_0x2e7d('0x14')]})[_0x2e7d('0x15')](function(_0x1598e3){if(_0x1598e3){_0x596a30=_0x1598e3;_0x9666cf=_0x596a30['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH['sequelize'][_0x2e7d('0x16')](util[_0x2e7d('0xe')](_0x2e7d('0x17'),QUERY),{'type':dbH[_0x2e7d('0x18')][_0x2e7d('0x19')][_0x2e7d('0x1a')]});})[_0x2e7d('0x15')](function(_0x35264c){if(!_0x35264c[0x0][_0x2e7d('0x1b')]){return analyticExtractedReport(_0x2e7d('0x1c'));}var _0x1134df=[];var _0x14d23c=0x0;if(_0x596a30[_0x2e7d('0x13')]){if(_0x35264c&&_0x35264c[_0x2e7d('0x1d')]){var _0x573a74=_[_0x2e7d('0x1e')](_0x35264c[0x0][_0x2e7d('0x1b')]/_0x9666cf);var _0x551fec=Number['isInteger'](_0x35264c[0x0][_0x2e7d('0x1b')]/_0x9666cf)?_0x35264c[0x0][_0x2e7d('0x1b')]%_0x9666cf:0x0;_0x573a74[_0x2e7d('0x1f')](function(_0x30f411){if(_0x30f411>0x0){_0x14d23c+=_0x9666cf;}_0x1134df[_0x2e7d('0x20')](dbH[_0x2e7d('0x18')][_0x2e7d('0x16')](util[_0x2e7d('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x9666cf,_0x14d23c),{'type':dbH[_0x2e7d('0x18')][_0x2e7d('0x19')][_0x2e7d('0x1a')]}));});if(_0x551fec>0x0){_0x14d23c+=_0x9666cf;_0x1134df[_0x2e7d('0x20')](dbH['sequelize'][_0x2e7d('0x16')](util[_0x2e7d('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x551fec,_0x14d23c),{'type':dbH[_0x2e7d('0x18')][_0x2e7d('0x19')][_0x2e7d('0x1a')]}));}}}else{_0x1134df[_0x2e7d('0x20')](dbH[_0x2e7d('0x18')]['query'](QUERY,{'type':dbH[_0x2e7d('0x18')][_0x2e7d('0x19')][_0x2e7d('0x1a')]}));}var _0x4476e1=path[_0x2e7d('0x21')](PATH);var _0x14893f=path['basename'](PATH,_0x2e7d('0x22'));var _0x1de6d5=_0x596a30[_0x2e7d('0x13')]&&_0x1134df[_0x2e7d('0x1d')]>0x1;var _0x24929f=[];if(!fs[_0x2e7d('0x23')](path['join'](_0x4476e1,_0x14893f))&&_0x1de6d5){fs['mkdirSync'](path['join'](_0x4476e1,_0x14893f));}return BPromise[_0x2e7d('0x24')](_0x1134df,function(_0x28f050){_0x24929f[_0x2e7d('0x20')](_0x28f050);})[_0x2e7d('0x15')](function(){for(var _0x524688=0x0;_0x524688<_0x24929f['length'];_0x524688+=0x1){var _0x4e385e;var _0x3510bb=_0x24929f[_0x524688];if(_0x1de6d5){_0x4e385e=path[_0x2e7d('0x25')](_0x4476e1,_0x14893f,util['format'](_0x2e7d('0x26'),_0x14893f,_0x524688,_0x2e7d('0x27')));}else{_0x4e385e=path[_0x2e7d('0x25')](_0x4476e1,util[_0x2e7d('0xe')]('%s.%s',_0x14893f,_0x2e7d('0x27')));}fs['writeFileSync'](_0x4e385e,json2xls(_0x3510bb),'binary');}})[_0x2e7d('0x15')](function(){if(_0x1de6d5){return new Promise(function(_0x2fbd66){zipdir(path[_0x2e7d('0x25')](_0x4476e1,_0x14893f),{'saveTo':path[_0x2e7d('0x25')](_0x4476e1,util[_0x2e7d('0xe')](_0x2e7d('0x28'),_0x14893f,'zip'))},function(_0x1b2e1e,_0x5bc72e){rimraf(path[_0x2e7d('0x25')](_0x4476e1,_0x14893f),function(){});_0x2fbd66(_0x2e7d('0x29'));});});}})[_0x2e7d('0x15')](function(){logger['info'](util[_0x2e7d('0xe')](_0x2e7d('0x2a'),EXTRACTED_REPORT_ID,_0x2e7d('0x10')));return analyticExtractedReport(_0x2e7d('0x2b'),_0x1de6d5?util['format'](_0x2e7d('0x28'),_0x14893f,_0x1de6d5?_0x2e7d('0x2c'):_0x2e7d('0x27')):null);});})['catch'](function(_0x50e7d4){logger[_0x2e7d('0xd')](util[_0x2e7d('0xe')](_0x2e7d('0x2d'),EXTRACTED_REPORT_ID,_0x2e7d('0x10')),util[_0x2e7d('0x2e')](_0x50e7d4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x2e7d('0x2f'));})[_0x2e7d('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 081d75e..43a7379 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 _0x8189=['app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','models','Interval','findAll','IntervalId','then','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','priority','extension','extensions','push','type','Set','format','context','VoiceExtensionId','inbound','CDR(routeid)=','cutdigits','${EXTEN:','${EXTEN}','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','hasOwnProperty','answer'];(function(_0x2a82ed,_0xbed565){var _0x247f2a=function(_0x1e0e45){while(--_0x1e0e45){_0x2a82ed['push'](_0x2a82ed['shift']());}};_0x247f2a(++_0xbed565);}(_0x8189,0xcd));var _0x9818=function(_0xd64f33,_0x4b9bf4){_0xd64f33=_0xd64f33-0x0;var _0x2c3861=_0x8189[_0xd64f33];return _0x2c3861;};'use strict';var _=require(_0x9818('0x0'));var util=require('util');function rewrite(_0x2eeb5c,_0x15a496){var _0x4e05e5=this;return _0x2eeb5c[_0x9818('0x1')][_0x9818('0x2')]['findAll']({'raw':!![]})['then'](function(_0x2d2462){_0x4e05e5['intervals']=_0x2d2462;return _0x2eeb5c[_0x9818('0x1')]['VoiceExtension'][_0x9818('0x3')]({'where':{'IntervalId':_0x15a496[_0x9818('0x4')]},'raw':!![]});})[_0x9818('0x5')](function(_0xc5257){return _0x2eeb5c[_0x9818('0x1')][_0x9818('0x6')][_0x9818('0x3')]({'where':{'exten':{'$in':_[_0x9818('0x7')](_[_0x9818('0x8')](_0xc5257,_0x9818('0x9')))}},'order':[{'raw':_0x9818('0xa')}],'raw':!![]});})[_0x9818('0x5')](function(_0x216f56){var _0x357558=_[_0x9818('0xb')](_0x216f56,{'priority':'1'});var _0x2df66f=_['filter'](_0x216f56,{'isApp':0x1});var _0x41dd62=_[_0x9818('0xc')](_0x2df66f,'exten');var _0x13bf4d=['queue',_0x9818('0xd')];var _0x1ffb31=[];var _0x48d7a0=[];for(var _0x613bb8 in _0x41dd62){if(_0x41dd62['hasOwnProperty'](_0x613bb8)){_0x4e05e5[_0x9818('0xe')]=0x2;_0x4e05e5['extensions']=[];_0x4e05e5[_0x9818('0xf')]=_['find'](_0x357558,{'exten':_0x41dd62[_0x613bb8][0x0]['exten']});_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':util[_0x9818('0x14')]('CDR(type)=%s',_0x41dd62[_0x613bb8][0x0]['type']),'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});if(_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')]===_0x9818('0x17')){_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':'Set','appdata':_0x9818('0x18')+_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')],'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5['priority']++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});}else if(_0x41dd62[_0x613bb8][0x0]['type']==='outbound'){if(_0x4e05e5['extension']){_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':'CDR(destination)='+(_0x4e05e5[_0x9818('0xf')][_0x9818('0x19')]?_0x9818('0x1a')+_0x4e05e5[_0x9818('0xf')][_0x9818('0x19')]+'}':_0x9818('0x1b')),'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0]['exten'],'priority':_0x4e05e5['priority']++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});}_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':_0x9818('0x18')+_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')],'context':_0x41dd62[_0x613bb8][0x0]['context'],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});var _0x34932b=_0x4e05e5[_0x9818('0xe')]++;_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x34932b+0x2)+'):Goto('+(_0x34932b+0x1)+')','context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x34932b,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});if(_0x4e05e5[_0x9818('0xf')]){_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':_0x4e05e5[_0x9818('0xf')][_0x9818('0x19')]?_0x9818('0x1c')+_0x4e05e5[_0x9818('0xf')][_0x9818('0x19')]+'}':'CDR(prefix)=noprefix','context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});}_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0]['type'],'app':'Set','appdata':_0x9818('0x1d')+_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')],'context':_0x41dd62[_0x613bb8][0x0]['context'],'exten':_0x41dd62[_0x613bb8][0x0]['exten'],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});if(_0x4e05e5[_0x9818('0xf')]&&_0x4e05e5[_0x9818('0xf')]['hasOwnProperty']('recordingFormat')&&_0x4e05e5[_0x9818('0xf')][_0x9818('0x1e')]!==_0x9818('0x1f')){_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':'Set','appdata':_0x9818('0x20'),'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5['priority']++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0]['type'],'app':_0x9818('0x13'),'appdata':_0x9818('0x21')+_0x4e05e5[_0x9818('0xf')][_0x9818('0x1e')]||_0x9818('0x22'),'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0]['exten'],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});}}_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5['priority']++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':_0x9818('0x23'),'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});_0x4e05e5['extensions'][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'priority':_0x4e05e5[_0x9818('0xe')]++,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});for(var _0x20ea78=0x0,_0x448d5e=0x0;_0x20ea78<_0x41dd62[_0x613bb8][_0x9818('0x24')];_0x20ea78+=0x1,_0x448d5e=0x0){var _0x406f67=_0x41dd62[_0x613bb8][_0x20ea78];if(_0x406f67[_0x9818('0x12')]){_0x406f67['type']=_0x406f67[_0x9818('0x12')][_0x9818('0x25')]();}var _0x42482d=[];var _0x2341aa=[];delete _0x406f67['id'];delete _0x406f67[_0x9818('0x26')];delete _0x406f67['updatedAt'];var _0x29a9a0=_0x406f67[_0x9818('0x27')]!=='*,*,*,*'?[_0x406f67[_0x9818('0x27')]]:_0x406f67[_0x9818('0x4')]?_[_0x9818('0x8')](_[_0x9818('0xb')](_0x4e05e5['intervals'],{'IntervalId':_0x406f67[_0x9818('0x4')]}),_0x9818('0x27')):[];if(_0x406f67['hasOwnProperty'](_0x9818('0x28'))){if(_0x406f67[_0x9818('0x28')]&&_0x406f67[_0x9818('0x28')]!=='--'){_0x42482d[_0x9818('0x11')]({'type':_0x406f67[_0x9818('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x406f67[_0x9818('0x28')],'context':_0x406f67[_0x9818('0x15')],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0['length']+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});}}if(_0x406f67[_0x9818('0x12')]==='outbound'&&_0x406f67['hasOwnProperty'](_0x9818('0x29'))){if(_0x406f67[_0x9818('0x29')]){_0x42482d[_0x9818('0x11')]({'type':_0x406f67[_0x9818('0x12')],'app':'ExecIf','appdata':_0x9818('0x2a')+_0x406f67[_0x9818('0x29')]+')','context':_0x406f67[_0x9818('0x15')],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0[_0x9818('0x24')]+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});}else{_0x42482d[_0x9818('0x11')]({'type':_0x406f67[_0x9818('0x12')],'app':_0x9818('0x2b'),'appdata':_0x9818('0x2c'),'context':_0x406f67['context'],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0[_0x9818('0x24')]+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});}}if(_0x406f67[_0x9818('0x2d')](_0x9818('0x2e'))){if(_0x13bf4d['indexOf'](_0x406f67[_0x9818('0x2f')][_0x9818('0x25')]())>=0x0&&_0x406f67['appType']!==_0x9818('0x30')){if(_0x406f67[_0x9818('0x2e')]){_0x42482d[_0x9818('0x11')]({'type':_0x406f67['type'],'app':_0x9818('0x2b'),'appdata':_0x9818('0x31'),'context':_0x406f67[_0x9818('0x15')],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0[_0x9818('0x24')]+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67['VoiceExtensionId']});_0x42482d[_0x9818('0x11')]({'type':_0x406f67[_0x9818('0x12')],'app':'Set','appdata':_0x9818('0x32'),'context':_0x406f67['context'],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0[_0x9818('0x24')]+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});}else{_0x42482d[_0x9818('0x11')]({'type':_0x406f67[_0x9818('0x12')],'app':_0x9818('0x2b'),'appdata':_0x9818('0x33'),'context':_0x406f67['context'],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0['length']+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});_0x42482d['push']({'type':_0x406f67[_0x9818('0x12')],'app':'Set','appdata':_0x9818('0x34'),'context':_0x406f67[_0x9818('0x15')],'exten':_0x406f67[_0x9818('0x9')],'priority':_0x29a9a0['length']+_0x4e05e5[_0x9818('0xe')]+_0x448d5e++,'VoiceExtensionId':_0x406f67[_0x9818('0x16')]});}}}for(var _0x593b12=0x0;_0x593b12<_0x29a9a0[_0x9818('0x24')];_0x593b12+=0x1){var _0x3b4181=_0x4e05e5['priority']+_0x29a9a0[_0x9818('0x24')];var _0x1920a2=_0x593b12===_0x29a9a0[_0x9818('0x24')]-0x1?_0x4e05e5[_0x9818('0xe')]+_0x42482d[_0x9818('0x24')]+_0x2341aa[_0x9818('0x24')]+0x2:_0x4e05e5[_0x9818('0xe')]+_0x593b12+0x1;_0x42482d['splice'](_0x593b12,0x0,{'type':_0x406f67['type'],'app':'GotoIfTime','appdata':_0x29a9a0[_0x593b12]+'?'+_0x406f67[_0x9818('0x15')]+_0x9818('0x35')+_0x3b4181+':'+_0x406f67[_0x9818('0x15')]+_0x9818('0x35')+_0x1920a2,'exten':_0x406f67[_0x9818('0x9')],'context':_0x406f67[_0x9818('0x15')],'priority':_0x4e05e5[_0x9818('0xe')]+_0x593b12,'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0]['VoiceExtensionId']});}_0x406f67[_0x9818('0xe')]=_0x42482d[_0x9818('0x24')]?_[_0x9818('0x36')](_0x42482d)[_0x9818('0xe')]+0x1:_0x4e05e5[_0x9818('0xe')];_0x4e05e5['priority']=(_0x2341aa[_0x9818('0x24')]?_[_0x9818('0x36')](_0x2341aa)[_0x9818('0xe')]:_0x406f67['priority'])+0x1;_0x4e05e5['extensions']=_[_0x9818('0x37')](_0x4e05e5[_0x9818('0x10')],_0x42482d,[_0x406f67],_0x2341aa);}_0x4e05e5[_0x9818('0x10')][_0x9818('0x11')]({'type':_0x41dd62[_0x613bb8][0x0][_0x9818('0x12')],'app':_0x9818('0x38'),'exten':_0x41dd62[_0x613bb8][0x0][_0x9818('0x9')],'context':_0x41dd62[_0x613bb8][0x0][_0x9818('0x15')],'priority':_0x4e05e5['priority'],'VoiceExtensionId':_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]});_0x1ffb31[_0x9818('0x11')](_0x41dd62[_0x613bb8][0x0][_0x9818('0x16')]);_0x48d7a0=_[_0x9818('0x37')](_0x48d7a0,_0x4e05e5[_0x9818('0x10')]);}}return _0x2eeb5c[_0x9818('0x39')](function(_0x162a3f){return _0x2eeb5c[_0x9818('0x1')][_0x9818('0x6')][_0x9818('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x1ffb31}},'transaction':_0x162a3f})[_0x9818('0x5')](function(_0x1ccb69){return _0x2eeb5c['models'][_0x9818('0x6')][_0x9818('0x3b')](_['sortBy'](_0x48d7a0,_0x9818('0xe')),{'transaction':_0x162a3f});});});})[_0x9818('0x3c')](function(_0x27d8e3){console[_0x9818('0x3d')](_0x27d8e3);});}exports[_0x9818('0x3e')]=rewrite; \ No newline at end of file +var _0x0318=['extension','find','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','map','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','VoiceExtension','findAll','IntervalId','then','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','playback','hasOwnProperty','extensions'];(function(_0x1dee62,_0x2bb420){var _0x30d9da=function(_0x2d11f0){while(--_0x2d11f0){_0x1dee62['push'](_0x1dee62['shift']());}};_0x30d9da(++_0x2bb420);}(_0x0318,0xc9));var _0x8031=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0318[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8031('0x0'));var util=require(_0x8031('0x1'));function rewrite(_0x5d0aa5,_0x3e63ff){var _0x5daea2=this;return _0x5d0aa5[_0x8031('0x2')][_0x8031('0x3')]['findAll']({'raw':!![]})['then'](function(_0x37505f){_0x5daea2['intervals']=_0x37505f;return _0x5d0aa5[_0x8031('0x2')][_0x8031('0x4')][_0x8031('0x5')]({'where':{'IntervalId':_0x3e63ff[_0x8031('0x6')]},'raw':!![]});})[_0x8031('0x7')](function(_0x5ef6fc){return _0x5d0aa5['models']['VoiceExtension'][_0x8031('0x5')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x5ef6fc,'exten'))}},'order':[{'raw':_0x8031('0x8')}],'raw':!![]});})[_0x8031('0x7')](function(_0x12fbd7){var _0x8b0ddc=_[_0x8031('0x9')](_0x12fbd7,{'priority':'1'});var _0xebccd=_[_0x8031('0x9')](_0x12fbd7,{'isApp':0x1});var _0x22ad26=_['groupBy'](_0xebccd,_0x8031('0xa'));var _0x173f86=[_0x8031('0xb'),_0x8031('0xc')];var _0x4b18b4=[];var _0x450c45=[];for(var _0x106072 in _0x22ad26){if(_0x22ad26[_0x8031('0xd')](_0x106072)){_0x5daea2['priority']=0x2;_0x5daea2[_0x8031('0xe')]=[];_0x5daea2[_0x8031('0xf')]=_[_0x8031('0x10')](_0x8b0ddc,{'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')]});_0x5daea2['extensions'][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':util[_0x8031('0x14')](_0x8031('0x15'),_0x22ad26[_0x106072][0x0][_0x8031('0x12')]),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});if(_0x22ad26[_0x106072][0x0][_0x8031('0x12')]===_0x8031('0x19')){_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':_0x8031('0x1a')+_0x22ad26[_0x106072][0x0][_0x8031('0x18')],'context':_0x22ad26[_0x106072][0x0]['context'],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});}else if(_0x22ad26[_0x106072][0x0][_0x8031('0x12')]===_0x8031('0x1b')){if(_0x5daea2[_0x8031('0xf')]){_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':'CDR(destination)='+(_0x5daea2[_0x8031('0xf')][_0x8031('0x1c')]?_0x8031('0x1d')+_0x5daea2['extension'][_0x8031('0x1c')]+'}':'${EXTEN}'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});}_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':_0x8031('0x1a')+_0x22ad26[_0x106072][0x0][_0x8031('0x18')],'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});var _0x43cb21=_0x5daea2[_0x8031('0x17')]++;_0x5daea2[_0x8031('0xe')][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x1e'),'appdata':_0x8031('0x1f')+(_0x43cb21+0x2)+_0x8031('0x20')+(_0x43cb21+0x1)+')','context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x43cb21,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});if(_0x5daea2[_0x8031('0xf')]){_0x5daea2['extensions'][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':'Set','appdata':_0x5daea2[_0x8031('0xf')][_0x8031('0x1c')]?_0x8031('0x21')+_0x5daea2[_0x8031('0xf')][_0x8031('0x1c')]+'}':_0x8031('0x22'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});}_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':_0x8031('0x23')+_0x22ad26[_0x106072][0x0][_0x8031('0x18')],'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2['priority']++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0]['VoiceExtensionId']});if(_0x5daea2[_0x8031('0xf')]&&_0x5daea2[_0x8031('0xf')]['hasOwnProperty'](_0x8031('0x24'))&&_0x5daea2[_0x8031('0xf')][_0x8031('0x24')]!==_0x8031('0x25')){_0x5daea2[_0x8031('0xe')][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':_0x8031('0x26'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0]['exten'],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});_0x5daea2['extensions'][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0]['type'],'app':_0x8031('0x13'),'appdata':_0x8031('0x27')+_0x5daea2[_0x8031('0xf')][_0x8031('0x24')]||_0x8031('0x28'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});}}_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':'Set','appdata':_0x8031('0x29'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});_0x5daea2[_0x8031('0xe')]['push']({'type':_0x22ad26[_0x106072][0x0]['type'],'app':_0x8031('0x13'),'appdata':_0x8031('0x2a'),'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});_0x5daea2[_0x8031('0xe')][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':'Set','appdata':_0x8031('0x2b'),'context':_0x22ad26[_0x106072][0x0]['context'],'exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'priority':_0x5daea2[_0x8031('0x17')]++,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});for(var _0x54fb79=0x0,_0x795966=0x0;_0x54fb79<_0x22ad26[_0x106072][_0x8031('0x2c')];_0x54fb79+=0x1,_0x795966=0x0){var _0x176fbd=_0x22ad26[_0x106072][_0x54fb79];if(_0x176fbd[_0x8031('0x12')]){_0x176fbd[_0x8031('0x12')]=_0x176fbd[_0x8031('0x12')]['toLowerCase']();}var _0x4f2c73=[];var _0xf96023=[];delete _0x176fbd['id'];delete _0x176fbd[_0x8031('0x2d')];delete _0x176fbd[_0x8031('0x2e')];var _0x5add6c=_0x176fbd[_0x8031('0x2f')]!==_0x8031('0x30')?[_0x176fbd[_0x8031('0x2f')]]:_0x176fbd[_0x8031('0x6')]?_[_0x8031('0x31')](_[_0x8031('0x9')](_0x5daea2['intervals'],{'IntervalId':_0x176fbd[_0x8031('0x6')]}),'interval'):[];if(_0x176fbd[_0x8031('0xd')]('tag')){if(_0x176fbd[_0x8031('0x32')]&&_0x176fbd[_0x8031('0x32')]!=='--'){_0x4f2c73[_0x8031('0x11')]({'type':_0x176fbd['type'],'app':'Set','appdata':'CDR(tag)='+_0x176fbd[_0x8031('0x32')],'context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd['exten'],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2['priority']+_0x795966++,'VoiceExtensionId':_0x176fbd['VoiceExtensionId']});}}if(_0x176fbd['type']===_0x8031('0x1b')&&_0x176fbd[_0x8031('0xd')](_0x8031('0x33'))){if(_0x176fbd[_0x8031('0x33')]){_0x4f2c73[_0x8031('0x11')]({'type':_0x176fbd[_0x8031('0x12')],'app':_0x8031('0x1e'),'appdata':_0x8031('0x34')+_0x176fbd[_0x8031('0x33')]+')','context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2['priority']+_0x795966++,'VoiceExtensionId':_0x176fbd[_0x8031('0x18')]});}else{_0x4f2c73['push']({'type':_0x176fbd[_0x8031('0x12')],'app':_0x8031('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c['length']+_0x5daea2['priority']+_0x795966++,'VoiceExtensionId':_0x176fbd[_0x8031('0x18')]});}}if(_0x176fbd[_0x8031('0xd')](_0x8031('0x35'))){if(_0x173f86[_0x8031('0x36')](_0x176fbd[_0x8031('0x37')][_0x8031('0x38')]())>=0x0&&_0x176fbd[_0x8031('0x39')]!=='custom'){if(_0x176fbd[_0x8031('0x35')]){_0x4f2c73[_0x8031('0x11')]({'type':_0x176fbd['type'],'app':_0x8031('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x176fbd['context'],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2[_0x8031('0x17')]+_0x795966++,'VoiceExtensionId':_0x176fbd['VoiceExtensionId']});_0x4f2c73['push']({'type':_0x176fbd[_0x8031('0x12')],'app':'Set','appdata':_0x8031('0x3a'),'context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2[_0x8031('0x17')]+_0x795966++,'VoiceExtensionId':_0x176fbd[_0x8031('0x18')]});}else{_0x4f2c73['push']({'type':_0x176fbd[_0x8031('0x12')],'app':'ExecIf','appdata':_0x8031('0x3b'),'context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2[_0x8031('0x17')]+_0x795966++,'VoiceExtensionId':_0x176fbd[_0x8031('0x18')]});_0x4f2c73[_0x8031('0x11')]({'type':_0x176fbd[_0x8031('0x12')],'app':_0x8031('0x13'),'appdata':_0x8031('0x3c'),'context':_0x176fbd[_0x8031('0x16')],'exten':_0x176fbd[_0x8031('0xa')],'priority':_0x5add6c[_0x8031('0x2c')]+_0x5daea2['priority']+_0x795966++,'VoiceExtensionId':_0x176fbd['VoiceExtensionId']});}}}for(var _0x4baf05=0x0;_0x4baf05<_0x5add6c['length'];_0x4baf05+=0x1){var _0x559b09=_0x5daea2[_0x8031('0x17')]+_0x5add6c[_0x8031('0x2c')];var _0x400a57=_0x4baf05===_0x5add6c[_0x8031('0x2c')]-0x1?_0x5daea2[_0x8031('0x17')]+_0x4f2c73[_0x8031('0x2c')]+_0xf96023[_0x8031('0x2c')]+0x2:_0x5daea2[_0x8031('0x17')]+_0x4baf05+0x1;_0x4f2c73[_0x8031('0x3d')](_0x4baf05,0x0,{'type':_0x176fbd[_0x8031('0x12')],'app':_0x8031('0x3e'),'appdata':_0x5add6c[_0x4baf05]+'?'+_0x176fbd['context']+_0x8031('0x3f')+_0x559b09+':'+_0x176fbd[_0x8031('0x16')]+_0x8031('0x3f')+_0x400a57,'exten':_0x176fbd['exten'],'context':_0x176fbd[_0x8031('0x16')],'priority':_0x5daea2[_0x8031('0x17')]+_0x4baf05,'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});}_0x176fbd[_0x8031('0x17')]=_0x4f2c73[_0x8031('0x2c')]?_['last'](_0x4f2c73)[_0x8031('0x17')]+0x1:_0x5daea2[_0x8031('0x17')];_0x5daea2[_0x8031('0x17')]=(_0xf96023[_0x8031('0x2c')]?_['last'](_0xf96023)[_0x8031('0x17')]:_0x176fbd[_0x8031('0x17')])+0x1;_0x5daea2[_0x8031('0xe')]=_[_0x8031('0x40')](_0x5daea2[_0x8031('0xe')],_0x4f2c73,[_0x176fbd],_0xf96023);}_0x5daea2[_0x8031('0xe')][_0x8031('0x11')]({'type':_0x22ad26[_0x106072][0x0][_0x8031('0x12')],'app':'Hangup','exten':_0x22ad26[_0x106072][0x0][_0x8031('0xa')],'context':_0x22ad26[_0x106072][0x0][_0x8031('0x16')],'priority':_0x5daea2[_0x8031('0x17')],'VoiceExtensionId':_0x22ad26[_0x106072][0x0][_0x8031('0x18')]});_0x4b18b4['push'](_0x22ad26[_0x106072][0x0][_0x8031('0x18')]);_0x450c45=_['concat'](_0x450c45,_0x5daea2[_0x8031('0xe')]);}}return _0x5d0aa5[_0x8031('0x41')](function(_0x3cfc94){return _0x5d0aa5[_0x8031('0x2')]['VoiceExtension'][_0x8031('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x4b18b4}},'transaction':_0x3cfc94})[_0x8031('0x7')](function(_0x52f3e0){return _0x5d0aa5[_0x8031('0x2')][_0x8031('0x4')][_0x8031('0x43')](_[_0x8031('0x44')](_0x450c45,_0x8031('0x17')),{'transaction':_0x3cfc94});});});})[_0x8031('0x45')](function(_0x95dfa0){console[_0x8031('0x46')](_0x95dfa0);});}exports[_0x8031('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 856cb2a..a5988f5 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 _0x5950=['createdAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','updatedAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','findAll','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','then','all','outbound','BlackLists','VoiceQueueId','Campaign','always','onlyIfOpen','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resume','resolve','emit','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','ContactId'];(function(_0x296ae4,_0x5ed98c){var _0x5eaa0f=function(_0x37c00c){while(--_0x37c00c){_0x296ae4['push'](_0x296ae4['shift']());}};_0x5eaa0f(++_0x5ed98c);}(_0x5950,0x117));var _0x0595=function(_0xca1055,_0x3121a5){_0xca1055=_0xca1055-0x0;var _0x4902f6=_0x5950[_0xca1055];return _0x4902f6;};'use strict';var BPromise=require(_0x0595('0x0'));var util=require(_0x0595('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0595('0x2'));var db=require(_0x0595('0x3'))['db'];var config=require(_0x0595('0x4'));var logger=require('../../../config/logger')('api');config[_0x0595('0x5')]=_[_0x0595('0x6')](config['redis'],{'host':_0x0595('0x7'),'port':0x18eb});var socket=require(_0x0595('0x8'))(new Redis(config['redis']));require(_0x0595('0x9'))[_0x0595('0xa')](socket);try{if(!process[_0x0595('0xb')][0x2]||process[_0x0595('0xb')][0x2]===_0x0595('0xc')||process['argv'][0x2]===_0x0595('0xd')){throw new Error(_0x0595('0xe'));}var FILEPATH=process[_0x0595('0xb')][0x2];if(!process[_0x0595('0xb')][0x3]||process[_0x0595('0xb')][0x3]===_0x0595('0xc')||process[_0x0595('0xb')][0x3]===_0x0595('0xd')||!process[_0x0595('0xb')][0x4]||process['argv'][0x4]===_0x0595('0xc')||process[_0x0595('0xb')][0x4]===_0x0595('0xd')){throw new Error(_0x0595('0xf'));}var FIELDS=_[_0x0595('0x10')](process[_0x0595('0xb')][0x3][_0x0595('0x11')](','),process['argv'][0x4]['split'](','));if(!process[_0x0595('0xb')][0x5]||process[_0x0595('0xb')][0x5]==='undefined'||process[_0x0595('0xb')][0x5]===_0x0595('0xd')){throw new Error(_0x0595('0x12'));}var LISTID=process[_0x0595('0xb')][0x5];var COMPANYID=process[_0x0595('0xb')][0x6]&&process[_0x0595('0xb')][0x6]!=='undefined'&&process[_0x0595('0xb')][0x6]!==_0x0595('0xd')?process[_0x0595('0xb')][0x6]:null;var DUPLICATES=process[_0x0595('0xb')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x0595('0xb')][0x7]!==_0x0595('0xd')?process['argv'][0x7]:null;if(!process[_0x0595('0xb')][0x8]||process[_0x0595('0xb')][0x8]==='undefined'||process[_0x0595('0xb')][0x8]===_0x0595('0xd')){throw new Error(_0x0595('0x13'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x3f49f0){logger['error'](_0x3f49f0);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(_0x32a5c1,_0x3a7db1,_0x45c230,_0x27f215){var _0x362493={'message':_0x3a7db1};_0x362493[_0x32a5c1]=!![];if(_0x45c230){_0x362493[_0x0595('0x14')]=_0x45c230;}if(_0x27f215){_0x362493[_0x0595('0x15')]=_0x27f215;}return _0x362493;}function isEmail(_0x2c8ce5){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))*$/[_0x0595('0x16')](_0x2c8ce5);}function checkRow(_0x1830e6,_0x183b31,_0x3765e8){return new BPromise(function(_0x4a3637,_0x5c4b7d){if(_[_0x0595('0x17')](_0x1830e6)){return _0x5c4b7d(handleCheckRowError(_0x0595('0x18'),_0x0595('0x19'),null,_0x3765e8));}if(_0x1830e6[_0x0595('0x1a')]&&_0x1830e6[_0x0595('0x1a')][_0x0595('0x1b')]){var _0x2ba263=_[_0x0595('0x1c')](_0x1830e6['errors'],_0x0595('0x1d'))[_0x0595('0x1e')](';');return _0x5c4b7d(handleCheckRowError('error',_0x2ba263,null,_0x3765e8));}var _0x40083a={};for(var _0x5923cf in FIELDS){if(FIELDS['hasOwnProperty'](_0x5923cf)&&FIELDS[_0x5923cf]){_0x40083a[_0x5923cf]=_0x1830e6['data'][0x0][FIELDS[_0x5923cf]]||_0x1830e6[_0x0595('0x1f')][0x0]['\ufeff'+FIELDS[_0x5923cf]];}}if(!_0x40083a['firstName']){return _0x5c4b7d(handleCheckRowError('error',_0x0595('0x20'),null,_0x3765e8));}if(!_0x40083a[_0x0595('0x21')]){return _0x5c4b7d(handleCheckRowError(_0x0595('0x18'),_0x0595('0x22'),null,_0x3765e8));}if(_0x40083a[_0x0595('0x23')]){var _0x2ec388=moment(_0x40083a[_0x0595('0x23')],_0x0595('0x24'));if(!_0x2ec388[_0x0595('0x25')]()){return _0x5c4b7d(handleCheckRowError(_0x0595('0x18'),_0x0595('0x26'),null,_0x3765e8));}}if(_0x40083a[_0x0595('0x27')]){if(!isEmail(_0x40083a[_0x0595('0x27')])){return _0x5c4b7d(handleCheckRowError(_0x0595('0x18'),_0x0595('0x28'),null,_0x3765e8));}}_0x40083a[_0x0595('0x29')]=LISTID;_0x40083a[_0x0595('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0595('0x1b')]&&_0x183b31){var _0x27c2b6={};for(var _0x3b54cf=0x0,_0x57b2ba=DUPLICATES[_0x0595('0x1b')];_0x3b54cf<_0x57b2ba;_0x3b54cf+=0x1){_0x27c2b6[DUPLICATES[_0x3b54cf]]=_0x40083a[DUPLICATES[_0x3b54cf]];}var _0x342b3b=_[_0x0595('0x2b')](_0x183b31,_0x27c2b6);if(_0x342b3b){return _0x5c4b7d(handleCheckRowError(_0x0595('0x2c'),'Duplicate\x20Contact',_0x342b3b,_0x3765e8));}}return db['CmContact'][_0x0595('0x2d')](_0x40083a,{'raw':!![],'hooks':![],'fields':_['keys'](_0x40083a)})['then'](function(_0x2a9aa1){if(DUPLICATES&&DUPLICATES[_0x0595('0x1b')]&&_0x183b31){_0x183b31[_0x0595('0x2e')](_[_0x0595('0x2f')](_0x40083a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2a9aa1['id'];return _0x4a3637();})[_0x0595('0x30')](function(_0x19f791){return _0x5c4b7d(handleCheckRowError(_0x0595('0x18'),_0x0595('0x31')+(_0x19f791[_0x0595('0x1d')]||JSON[_0x0595('0x32')](_0x19f791)),null,_0x3765e8));});});}function checkHopper(){function _0x3a8559(){return function(_0x5a17e8){logger[_0x0595('0x18')]('cmContact',_0x0595('0x33'),util[_0x0595('0x34')](_0x5a17e8,{'showHidden':![],'depth':null}));};}var _0x4d4c82=function(_0x267056,_0xb05586){var _0x4a9cd8=squel['insert']()['into'](_0x0595('0x35'))[_0x0595('0x36')](['phone',_0x0595('0x37'),_0x0595('0x38'),_0x0595('0x29'),_0xb05586,_0x0595('0x39'),'updatedAt'],squel[_0x0595('0x3a')]()['field'](_0x0595('0x21'),_0x0595('0x21'))['field']('NOW()',_0x0595('0x37'))[_0x0595('0x3b')]('id',_0x0595('0x38'))[_0x0595('0x3b')](LISTID['toString'](),_0x0595('0x29'))[_0x0595('0x3b')](_0x267056['id'][_0x0595('0x3c')](),_0xb05586)[_0x0595('0x3b')](_0x0595('0x3d'),'createdAt')[_0x0595('0x3b')](_0x0595('0x3d'),'updatedAt')[_0x0595('0x3e')](_0x0595('0x3f'))[_0x0595('0x40')](_0x0595('0x41'))[_0x0595('0x40')](_0x0595('0x42'),LISTID[_0x0595('0x3c')]())['where'](_0x0595('0x43'))[_0x0595('0x40')](_0x0595('0x44'),squel[_0x0595('0x3a')]()[_0x0595('0x3b')](_0x0595('0x21'))[_0x0595('0x3e')]('cm_hopper')[_0x0595('0x40')](_0xb05586+'\x20=\x20?',_0x267056['id']['toString']())))[_0x0595('0x3c')]();return _0x4a9cd8;};var _0x370536=function(_0x4b8cde,_0x47581a){var _0x2ba87e=squel['insert']()[_0x0595('0x45')](_0x0595('0x35'))['fromQuery'](['phone','scheduledAt',_0x0595('0x38'),'ListId',_0x47581a,_0x0595('0x39'),_0x0595('0x46')],squel[_0x0595('0x3a')]()[_0x0595('0x3b')](_0x0595('0x21'),_0x0595('0x21'))[_0x0595('0x3b')]('NOW()',_0x0595('0x37'))[_0x0595('0x3b')]('id',_0x0595('0x38'))[_0x0595('0x3b')](LISTID[_0x0595('0x3c')](),_0x0595('0x29'))['field'](_0x4b8cde['id'][_0x0595('0x3c')](),_0x47581a)['field'](_0x0595('0x3d'),_0x0595('0x39'))['field'](_0x0595('0x3d'),_0x0595('0x46'))[_0x0595('0x3e')](_0x0595('0x3f'))[_0x0595('0x40')]('deletedAt\x20IS\x20NULL')[_0x0595('0x40')](_0x0595('0x42'),LISTID[_0x0595('0x3c')]())[_0x0595('0x40')](_0x0595('0x47'),squel[_0x0595('0x48')](hopperContacts))[_0x0595('0x40')](_0x0595('0x43'))[_0x0595('0x40')](_0x0595('0x44'),squel[_0x0595('0x3a')]()[_0x0595('0x3b')](_0x0595('0x49'))[_0x0595('0x3e')](_0x0595('0x4a'))[_0x0595('0x40')](_0x47581a+'\x20=\x20?',_0x4b8cde['id'][_0x0595('0x3c')]()))[_0x0595('0x40')](_0x0595('0x44'),squel[_0x0595('0x3a')]()[_0x0595('0x3b')](_0x0595('0x21'))[_0x0595('0x3e')](_0x0595('0x35'))['where'](_0x47581a+'\x20=\x20?',_0x4b8cde['id'][_0x0595('0x3c')]())))[_0x0595('0x3c')]();return _0x2ba87e;};function _0x44e47b(_0x76236,_0x33c837){var _0x492282=squel[_0x0595('0x4b')]()['into']('cm_hopper')[_0x0595('0x36')]([_0x0595('0x21'),_0x0595('0x37'),'ContactId',_0x0595('0x29'),_0x33c837,_0x0595('0x39'),_0x0595('0x46')],squel['select']()[_0x0595('0x3b')](_0x0595('0x21'),_0x0595('0x21'))[_0x0595('0x3b')]('NOW()',_0x0595('0x37'))['field']('id',_0x0595('0x38'))['field'](LISTID['toString'](),_0x0595('0x29'))['field'](_0x76236['id'][_0x0595('0x3c')](),_0x33c837)[_0x0595('0x3b')]('NOW()',_0x0595('0x39'))[_0x0595('0x3b')](_0x0595('0x3d'),'updatedAt')[_0x0595('0x3e')](_0x0595('0x3f'))[_0x0595('0x40')]('deletedAt\x20IS\x20NULL')[_0x0595('0x40')](_0x0595('0x42'),LISTID[_0x0595('0x3c')]())[_0x0595('0x40')]('id\x20IN\x20?',squel[_0x0595('0x48')](hopperContacts))[_0x0595('0x40')](_0x0595('0x43')))['toString']();return _0x492282;}function _0x46990c(_0x248a07,_0x382e47){var _0x1d2964=squel[_0x0595('0x4b')]()[_0x0595('0x45')](_0x0595('0x4c'))[_0x0595('0x36')]([_0x0595('0x21'),'ContactId','ListId',_0x382e47,_0x0595('0x39'),_0x0595('0x46')],squel[_0x0595('0x3a')]()[_0x0595('0x3b')]('phone',_0x0595('0x21'))['field']('id',_0x0595('0x38'))[_0x0595('0x3b')](LISTID[_0x0595('0x3c')](),_0x0595('0x29'))[_0x0595('0x3b')](_0x248a07['id']['toString'](),_0x382e47)[_0x0595('0x3b')]('NOW()','createdAt')[_0x0595('0x3b')](_0x0595('0x3d'),_0x0595('0x46'))[_0x0595('0x3e')](_0x0595('0x3f'))[_0x0595('0x40')](_0x0595('0x41'))[_0x0595('0x40')](_0x0595('0x42'),LISTID['toString']())[_0x0595('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x0595('0x40')](_0x0595('0x43')))[_0x0595('0x3c')]();return _0x1d2964;}return db[_0x0595('0x4d')][_0x0595('0x4e')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x0595('0x4f')],'as':_0x0595('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x239cd7){var _0x5f44d8=[];if(_0x239cd7){var _0x20fcd1;for(var _0x3ca200=0x0,_0x4f9821;_0x3ca200<_0x239cd7['length'];_0x3ca200+=0x1){_0x4f9821=_0x239cd7[_0x3ca200][_0x0595('0x51')]({'plain':!![]});switch(_0x4f9821[_0x0595('0x52')]){case'always':_0x5f44d8[_0x0595('0x2e')](db[_0x0595('0x53')][_0x0595('0x54')](_0x370536(_0x4f9821,'VoiceQueueId'))[_0x0595('0x55')](function(){})[_0x0595('0x30')](_0x3a8559()));break;case'onlyIfOpen':_0x5f44d8['push'](db[_0x0595('0x53')][_0x0595('0x54')](_0x4d4c82(_0x4f9821,'VoiceQueueId'))[_0x0595('0x55')](function(){})['catch'](_0x3a8559()));break;default:_0x5f44d8['push'](db[_0x0595('0x53')][_0x0595('0x54')](_0x44e47b(_0x4f9821,'VoiceQueueId'))[_0x0595('0x55')](function(){})[_0x0595('0x30')](_0x3a8559()));}}}return _0x5f44d8;})[_0x0595('0x56')]()[_0x0595('0x55')](function(){return db[_0x0595('0x4d')][_0x0595('0x4e')]({'where':{'type':_0x0595('0x57')},'attributes':['id'],'include':[{'model':db[_0x0595('0x4f')],'as':_0x0595('0x58'),'where':{'id':LISTID}}]})[_0x0595('0x55')](function(_0x3a9e98){var _0x5f35aa=[];if(_0x3a9e98){var _0x2578be;for(var _0x436582=0x0,_0xb3e45c;_0x436582<_0x3a9e98['length'];_0x436582+=0x1){_0xb3e45c=_0x3a9e98[_0x436582][_0x0595('0x51')]({'plain':!![]});_0x5f35aa['push'](db['sequelize'][_0x0595('0x54')](_0x46990c(_0xb3e45c,_0x0595('0x59')))['then'](function(){})[_0x0595('0x30')](_0x3a8559()));}}return _0x5f35aa;})[_0x0595('0x56')]();})[_0x0595('0x55')](function(){return db[_0x0595('0x5a')][_0x0595('0x4e')]({'attributes':['id',_0x0595('0x52')],'include':[{'model':db[_0x0595('0x4f')],'as':_0x0595('0x50'),'where':{'id':LISTID}}]})[_0x0595('0x55')](function(_0x13e63e){var _0x5ad5a4=[];if(_0x13e63e){for(var _0x4b33d6=0x0,_0x516eaf;_0x4b33d6<_0x13e63e[_0x0595('0x1b')];_0x4b33d6+=0x1){_0x516eaf=_0x13e63e[_0x4b33d6][_0x0595('0x51')]({'plain':!![]});switch(_0x516eaf[_0x0595('0x52')]){case _0x0595('0x5b'):_0x5ad5a4[_0x0595('0x2e')](db['sequelize'][_0x0595('0x54')](_0x370536(_0x516eaf,'CampaignId'))[_0x0595('0x55')](function(){})[_0x0595('0x30')](_0x3a8559()));break;case _0x0595('0x5c'):_0x5ad5a4[_0x0595('0x2e')](db[_0x0595('0x53')]['query'](_0x4d4c82(_0x516eaf,'CampaignId'))['then'](function(){})[_0x0595('0x30')](_0x3a8559()));break;default:_0x5ad5a4[_0x0595('0x2e')](db['sequelize'][_0x0595('0x54')](_0x44e47b(_0x516eaf,_0x0595('0x5d')))[_0x0595('0x55')](function(){})[_0x0595('0x30')](_0x3a8559()));}}}return _0x5ad5a4;})['all']();})[_0x0595('0x55')](function(){return db[_0x0595('0x5a')][_0x0595('0x4e')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x2b9bfb){var _0x345e9a=[];if(_0x2b9bfb){for(var _0xc7ee40=0x0,_0x170ad8;_0xc7ee40<_0x2b9bfb[_0x0595('0x1b')];_0xc7ee40+=0x1){_0x170ad8=_0x2b9bfb[_0xc7ee40][_0x0595('0x51')]({'plain':!![]});_0x345e9a[_0x0595('0x2e')](db[_0x0595('0x53')][_0x0595('0x54')](_0x46990c(_0x170ad8,'CampaignId'))[_0x0595('0x55')](function(){})['catch'](_0x3a8559()));}}return _0x345e9a;})[_0x0595('0x56')]();})[_0x0595('0x30')](function(_0x3b7820){logger[_0x0595('0x18')](_0x0595('0x5e'),_0x0595('0x5f'),_0x3b7820['message']);});}var processPromises=function(_0x3876ba){return BPromise[_0x0595('0x56')](promises)[_0x0595('0x55')](function(_0x3fa37a){})[_0x0595('0x30')](function(_0x1fd64a){logger[_0x0595('0x18')](_0x0595('0x60'),JSON[_0x0595('0x32')](_0x1fd64a));})[_0x0595('0x61')](function(){socket['emit'](_0x0595('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3876ba){return _0x3876ba[_0x0595('0x63')]();}});};var endCsv=function(){return BPromise[_0x0595('0x64')]()[_0x0595('0x55')](function(){if(hopperContacts){return checkHopper();}})[_0x0595('0x55')](function(){socket[_0x0595('0x65')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0595('0x66')](FILEPATH);}catch(_0x3dc788){logger[_0x0595('0x18')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0595('0x32')](_0x3dc788));}finally{process[_0x0595('0x67')](0x0);}});};process['on'](_0x0595('0x68'),function(){logger[_0x0595('0x69')](_0x0595('0x6a'));endCsv();});function main(){return BPromise[_0x0595('0x64')]()[_0x0595('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0595('0x11')](',');return db[_0x0595('0x6b')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0595('0x55')](function(_0x483525){var _0x11c9ec=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x11c9ec,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3bfe3c,_0x3bb000){total+=0x1;var _0x35b941=total;promises['push'](checkRow(_0x3bfe3c,_0x483525,_0x35b941)[_0x0595('0x55')](function(){success+=0x1;})[_0x0595('0x30')](function(_0x4b4279){if(_0x4b4279[_0x0595('0x18')]){errors+=0x1;delete _0x4b4279[_0x0595('0x18')];}else if(_0x4b4279[_0x0595('0x2c')]){duplicates+=0x1;delete _0x4b4279['duplicate'];}rows[_0x0595('0x2e')](_0x4b4279);}));if(total%0xc8===0x0){_0x3bb000[_0x0595('0x6c')]();return processPromises(_0x3bb000);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0595('0x69')](_0x0595('0x6d'));endCsv();});},'error':function(_0x2a437c,_0x4c217e){logger[_0x0595('0x69')](_0x0595('0x6e'),JSON[_0x0595('0x32')](_0x2a437c));endCsv();}});})[_0x0595('0x30')](function(_0x537bec){logger[_0x0595('0x18')](_0x0595('0x6f'),JSON[_0x0595('0x32')](_0x537bec));});}main(); \ No newline at end of file +var _0x9977=['util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','fromQuery','scheduledAt','ContactId','ListId','createdAt','field','NOW()','toString','updatedAt','from','cm_contacts','where','select','\x20=\x20?','cm_hopper','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','get','always','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','BlackLists','Campaign','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9977,0x1ac));var _0x7997=function(_0x40197b,_0x4e763f){_0x40197b=_0x40197b-0x0;var _0x3b9c2f=_0x9977[_0x40197b];return _0x3b9c2f;};'use strict';var BPromise=require('bluebird');var util=require(_0x7997('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x7997('0x1'));var db=require(_0x7997('0x2'))['db'];var config=require(_0x7997('0x3'));var logger=require(_0x7997('0x4'))(_0x7997('0x5'));config[_0x7997('0x6')]=_['defaults'](config[_0x7997('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x7997('0x7'))(new Redis(config['redis']));require('../../../api/cmContact/cmContact.socket')[_0x7997('0x8')](socket);try{if(!process[_0x7997('0x9')][0x2]||process[_0x7997('0x9')][0x2]===_0x7997('0xa')||process['argv'][0x2]===_0x7997('0xb')){throw new Error(_0x7997('0xc'));}var FILEPATH=process[_0x7997('0x9')][0x2];if(!process[_0x7997('0x9')][0x3]||process[_0x7997('0x9')][0x3]===_0x7997('0xa')||process[_0x7997('0x9')][0x3]==='null'||!process[_0x7997('0x9')][0x4]||process[_0x7997('0x9')][0x4]===_0x7997('0xa')||process[_0x7997('0x9')][0x4]==='null'){throw new Error(_0x7997('0xd'));}var FIELDS=_[_0x7997('0xe')](process[_0x7997('0x9')][0x3]['split'](','),process[_0x7997('0x9')][0x4]['split'](','));if(!process[_0x7997('0x9')][0x5]||process[_0x7997('0x9')][0x5]===_0x7997('0xa')||process[_0x7997('0x9')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x7997('0x9')][0x5];var COMPANYID=process[_0x7997('0x9')][0x6]&&process[_0x7997('0x9')][0x6]!==_0x7997('0xa')&&process[_0x7997('0x9')][0x6]!==_0x7997('0xb')?process[_0x7997('0x9')][0x6]:null;var DUPLICATES=process[_0x7997('0x9')][0x7]&&process['argv'][0x7]!==_0x7997('0xa')&&process[_0x7997('0x9')][0x7]!==_0x7997('0xb')?process[_0x7997('0x9')][0x7]:null;if(!process[_0x7997('0x9')][0x8]||process['argv'][0x8]==='undefined'||process['argv'][0x8]===_0x7997('0xb')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7997('0x9')][0x8];}catch(_0x2267f6){logger[_0x7997('0xf')](_0x2267f6);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(_0x3631ee,_0x20d242,_0x2e34bc,_0x27db3e){var _0x3b3899={'message':_0x20d242};_0x3b3899[_0x3631ee]=!![];if(_0x2e34bc){_0x3b3899[_0x7997('0x10')]=_0x2e34bc;}if(_0x27db3e){_0x3b3899[_0x7997('0x11')]=_0x27db3e;}return _0x3b3899;}function isEmail(_0x12f4fd){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))*$/[_0x7997('0x12')](_0x12f4fd);}function checkRow(_0x3c3a17,_0x47e747,_0x472328){return new BPromise(function(_0x24ab9c,_0x4a0b4d){if(_['isNil'](_0x3c3a17)){return _0x4a0b4d(handleCheckRowError('error',_0x7997('0x13'),null,_0x472328));}if(_0x3c3a17[_0x7997('0x14')]&&_0x3c3a17[_0x7997('0x14')][_0x7997('0x15')]){var _0x48a0f6=_[_0x7997('0x16')](_0x3c3a17[_0x7997('0x14')],_0x7997('0x17'))['join'](';');return _0x4a0b4d(handleCheckRowError(_0x7997('0xf'),_0x48a0f6,null,_0x472328));}var _0x10cac5={};for(var _0x4bacb3 in FIELDS){if(FIELDS[_0x7997('0x18')](_0x4bacb3)&&FIELDS[_0x4bacb3]){_0x10cac5[_0x4bacb3]=_0x3c3a17[_0x7997('0x19')][0x0][FIELDS[_0x4bacb3]]||_0x3c3a17[_0x7997('0x19')][0x0]['\ufeff'+FIELDS[_0x4bacb3]];}}if(!_0x10cac5['firstName']){return _0x4a0b4d(handleCheckRowError(_0x7997('0xf'),_0x7997('0x1a'),null,_0x472328));}if(!_0x10cac5[_0x7997('0x1b')]){return _0x4a0b4d(handleCheckRowError(_0x7997('0xf'),_0x7997('0x1c'),null,_0x472328));}if(_0x10cac5[_0x7997('0x1d')]){var _0x465343=moment(_0x10cac5['birthDate'],_0x7997('0x1e'));if(!_0x465343[_0x7997('0x1f')]()){return _0x4a0b4d(handleCheckRowError(_0x7997('0xf'),_0x7997('0x20'),null,_0x472328));}}if(_0x10cac5[_0x7997('0x21')]){if(!isEmail(_0x10cac5[_0x7997('0x21')])){return _0x4a0b4d(handleCheckRowError('error','email\x20format\x20is\x20not\x20valid!',null,_0x472328));}}_0x10cac5['ListId']=LISTID;_0x10cac5[_0x7997('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7997('0x15')]&&_0x47e747){var _0x48ec14={};for(var _0x5842c3=0x0,_0x25aab6=DUPLICATES['length'];_0x5842c3<_0x25aab6;_0x5842c3+=0x1){_0x48ec14[DUPLICATES[_0x5842c3]]=_0x10cac5[DUPLICATES[_0x5842c3]];}var _0x302e5c=_[_0x7997('0x23')](_0x47e747,_0x48ec14);if(_0x302e5c){return _0x4a0b4d(handleCheckRowError(_0x7997('0x24'),_0x7997('0x25'),_0x302e5c,_0x472328));}}return db[_0x7997('0x26')]['create'](_0x10cac5,{'raw':!![],'hooks':![],'fields':_[_0x7997('0x27')](_0x10cac5)})[_0x7997('0x28')](function(_0x1cc853){if(DUPLICATES&&DUPLICATES[_0x7997('0x15')]&&_0x47e747){_0x47e747[_0x7997('0x29')](_[_0x7997('0x2a')](_0x10cac5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1cc853['id'];return _0x24ab9c();})['catch'](function(_0xef4db4){return _0x4a0b4d(handleCheckRowError(_0x7997('0xf'),_0x7997('0x2b')+(_0xef4db4['message']||JSON[_0x7997('0x2c')](_0xef4db4)),null,_0x472328));});});}function checkHopper(){function _0x56736d(){return function(_0x44bc59){logger['error'](_0x7997('0x2d'),_0x7997('0x2e'),util['inspect'](_0x44bc59,{'showHidden':![],'depth':null}));};}var _0xa4c80a=function(_0x2b8027,_0x2d2f01){var _0x3e6bde=squel[_0x7997('0x2f')]()[_0x7997('0x30')]('cm_hopper')[_0x7997('0x31')]([_0x7997('0x1b'),_0x7997('0x32'),_0x7997('0x33'),_0x7997('0x34'),_0x2d2f01,_0x7997('0x35'),'updatedAt'],squel['select']()[_0x7997('0x36')]('phone',_0x7997('0x1b'))[_0x7997('0x36')](_0x7997('0x37'),_0x7997('0x32'))[_0x7997('0x36')]('id',_0x7997('0x33'))[_0x7997('0x36')](LISTID['toString'](),_0x7997('0x34'))[_0x7997('0x36')](_0x2b8027['id'][_0x7997('0x38')](),_0x2d2f01)['field'](_0x7997('0x37'),_0x7997('0x35'))[_0x7997('0x36')]('NOW()',_0x7997('0x39'))[_0x7997('0x3a')](_0x7997('0x3b'))[_0x7997('0x3c')]('deletedAt\x20IS\x20NULL')[_0x7997('0x3c')]('ListId\x20=\x20?',LISTID[_0x7997('0x38')]())[_0x7997('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x7997('0x3d')]()[_0x7997('0x36')](_0x7997('0x1b'))[_0x7997('0x3a')]('cm_hopper')['where'](_0x2d2f01+_0x7997('0x3e'),_0x2b8027['id'][_0x7997('0x38')]())))[_0x7997('0x38')]();return _0x3e6bde;};var _0x4ca43c=function(_0x3d8254,_0x405710){var _0x40d2a9=squel[_0x7997('0x2f')]()[_0x7997('0x30')](_0x7997('0x3f'))[_0x7997('0x31')]([_0x7997('0x1b'),_0x7997('0x32'),_0x7997('0x33'),_0x7997('0x34'),_0x405710,_0x7997('0x35'),_0x7997('0x39')],squel[_0x7997('0x3d')]()[_0x7997('0x36')](_0x7997('0x1b'),_0x7997('0x1b'))[_0x7997('0x36')](_0x7997('0x37'),'scheduledAt')['field']('id',_0x7997('0x33'))['field'](LISTID[_0x7997('0x38')](),_0x7997('0x34'))[_0x7997('0x36')](_0x3d8254['id'][_0x7997('0x38')](),_0x405710)[_0x7997('0x36')](_0x7997('0x37'),'createdAt')[_0x7997('0x36')](_0x7997('0x37'),_0x7997('0x39'))[_0x7997('0x3a')](_0x7997('0x3b'))['where'](_0x7997('0x40'))[_0x7997('0x3c')](_0x7997('0x41'),LISTID[_0x7997('0x38')]())[_0x7997('0x3c')](_0x7997('0x42'),squel[_0x7997('0x43')](hopperContacts))[_0x7997('0x3c')](_0x7997('0x44'))[_0x7997('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7997('0x3d')]()['field'](_0x7997('0x45'))['from'](_0x7997('0x46'))['where'](_0x405710+_0x7997('0x3e'),_0x3d8254['id']['toString']()))[_0x7997('0x3c')](_0x7997('0x47'),squel[_0x7997('0x3d')]()[_0x7997('0x36')](_0x7997('0x1b'))[_0x7997('0x3a')](_0x7997('0x3f'))['where'](_0x405710+_0x7997('0x3e'),_0x3d8254['id'][_0x7997('0x38')]())))[_0x7997('0x38')]();return _0x40d2a9;};function _0x370d1a(_0x34556f,_0x26cb95){var _0x4b2b77=squel[_0x7997('0x2f')]()[_0x7997('0x30')](_0x7997('0x3f'))[_0x7997('0x31')]([_0x7997('0x1b'),_0x7997('0x32'),'ContactId','ListId',_0x26cb95,_0x7997('0x35'),'updatedAt'],squel[_0x7997('0x3d')]()['field'](_0x7997('0x1b'),_0x7997('0x1b'))['field'](_0x7997('0x37'),_0x7997('0x32'))[_0x7997('0x36')]('id',_0x7997('0x33'))[_0x7997('0x36')](LISTID[_0x7997('0x38')](),_0x7997('0x34'))['field'](_0x34556f['id'][_0x7997('0x38')](),_0x26cb95)[_0x7997('0x36')](_0x7997('0x37'),_0x7997('0x35'))[_0x7997('0x36')](_0x7997('0x37'),_0x7997('0x39'))[_0x7997('0x3a')](_0x7997('0x3b'))[_0x7997('0x3c')](_0x7997('0x40'))[_0x7997('0x3c')](_0x7997('0x41'),LISTID[_0x7997('0x38')]())['where'](_0x7997('0x42'),squel[_0x7997('0x43')](hopperContacts))[_0x7997('0x3c')](_0x7997('0x44')))[_0x7997('0x38')]();return _0x4b2b77;}function _0x5ec72c(_0x44d03b,_0x473992){var _0x5dda5e=squel[_0x7997('0x2f')]()[_0x7997('0x30')](_0x7997('0x48'))[_0x7997('0x31')]([_0x7997('0x1b'),_0x7997('0x33'),'ListId',_0x473992,_0x7997('0x35'),'updatedAt'],squel[_0x7997('0x3d')]()[_0x7997('0x36')]('phone',_0x7997('0x1b'))[_0x7997('0x36')]('id',_0x7997('0x33'))['field'](LISTID[_0x7997('0x38')](),'ListId')[_0x7997('0x36')](_0x44d03b['id'][_0x7997('0x38')](),_0x473992)['field'](_0x7997('0x37'),_0x7997('0x35'))['field'](_0x7997('0x37'),'updatedAt')[_0x7997('0x3a')](_0x7997('0x3b'))['where'](_0x7997('0x40'))['where'](_0x7997('0x41'),LISTID[_0x7997('0x38')]())[_0x7997('0x3c')](_0x7997('0x42'),squel[_0x7997('0x43')](hopperContacts))[_0x7997('0x3c')](_0x7997('0x44')))[_0x7997('0x38')]();return _0x5dda5e;}return db[_0x7997('0x49')][_0x7997('0x4a')]({'where':{'type':_0x7997('0x4b')},'attributes':['id',_0x7997('0x4c')],'include':[{'model':db[_0x7997('0x4d')],'as':'Lists','where':{'id':LISTID}}]})[_0x7997('0x28')](function(_0x45e167){var _0x48a33e=[];if(_0x45e167){var _0x25baf9;for(var _0x3c324f=0x0,_0x34749e;_0x3c324f<_0x45e167[_0x7997('0x15')];_0x3c324f+=0x1){_0x34749e=_0x45e167[_0x3c324f][_0x7997('0x4e')]({'plain':!![]});switch(_0x34749e[_0x7997('0x4c')]){case _0x7997('0x4f'):_0x48a33e[_0x7997('0x29')](db['sequelize'][_0x7997('0x50')](_0x4ca43c(_0x34749e,_0x7997('0x51')))[_0x7997('0x28')](function(){})[_0x7997('0x52')](_0x56736d()));break;case _0x7997('0x53'):_0x48a33e[_0x7997('0x29')](db[_0x7997('0x54')][_0x7997('0x50')](_0xa4c80a(_0x34749e,_0x7997('0x51')))[_0x7997('0x28')](function(){})[_0x7997('0x52')](_0x56736d()));break;default:_0x48a33e[_0x7997('0x29')](db['sequelize']['query'](_0x370d1a(_0x34749e,_0x7997('0x51')))['then'](function(){})[_0x7997('0x52')](_0x56736d()));}}}return _0x48a33e;})[_0x7997('0x55')]()[_0x7997('0x28')](function(){return db[_0x7997('0x49')][_0x7997('0x4a')]({'where':{'type':_0x7997('0x4b')},'attributes':['id'],'include':[{'model':db[_0x7997('0x4d')],'as':_0x7997('0x56'),'where':{'id':LISTID}}]})['then'](function(_0x2df670){var _0x185800=[];if(_0x2df670){var _0x276a44;for(var _0x4da771=0x0,_0x367d2f;_0x4da771<_0x2df670[_0x7997('0x15')];_0x4da771+=0x1){_0x367d2f=_0x2df670[_0x4da771][_0x7997('0x4e')]({'plain':!![]});_0x185800[_0x7997('0x29')](db[_0x7997('0x54')]['query'](_0x5ec72c(_0x367d2f,_0x7997('0x51')))[_0x7997('0x28')](function(){})[_0x7997('0x52')](_0x56736d()));}}return _0x185800;})[_0x7997('0x55')]();})[_0x7997('0x28')](function(){return db[_0x7997('0x57')][_0x7997('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7997('0x4d')],'as':_0x7997('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x45f319){var _0x39ed87=[];if(_0x45f319){for(var _0x2a3259=0x0,_0x15a45d;_0x2a3259<_0x45f319['length'];_0x2a3259+=0x1){_0x15a45d=_0x45f319[_0x2a3259][_0x7997('0x4e')]({'plain':!![]});switch(_0x15a45d['dialCheckDuplicateType']){case _0x7997('0x4f'):_0x39ed87[_0x7997('0x29')](db['sequelize'][_0x7997('0x50')](_0x4ca43c(_0x15a45d,_0x7997('0x59')))['then'](function(){})[_0x7997('0x52')](_0x56736d()));break;case _0x7997('0x53'):_0x39ed87['push'](db[_0x7997('0x54')][_0x7997('0x50')](_0xa4c80a(_0x15a45d,'CampaignId'))[_0x7997('0x28')](function(){})[_0x7997('0x52')](_0x56736d()));break;default:_0x39ed87[_0x7997('0x29')](db[_0x7997('0x54')][_0x7997('0x50')](_0x370d1a(_0x15a45d,_0x7997('0x59')))['then'](function(){})[_0x7997('0x52')](_0x56736d()));}}}return _0x39ed87;})['all']();})[_0x7997('0x28')](function(){return db[_0x7997('0x57')][_0x7997('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x7997('0x4d')],'as':_0x7997('0x56'),'where':{'id':LISTID}}]})[_0x7997('0x28')](function(_0x4509c4){var _0x3dea11=[];if(_0x4509c4){for(var _0x3e451b=0x0,_0x4ab0c0;_0x3e451b<_0x4509c4[_0x7997('0x15')];_0x3e451b+=0x1){_0x4ab0c0=_0x4509c4[_0x3e451b][_0x7997('0x4e')]({'plain':!![]});_0x3dea11[_0x7997('0x29')](db[_0x7997('0x54')][_0x7997('0x50')](_0x5ec72c(_0x4ab0c0,_0x7997('0x59')))[_0x7997('0x28')](function(){})[_0x7997('0x52')](_0x56736d()));}}return _0x3dea11;})['all']();})[_0x7997('0x52')](function(_0x3f957b){logger[_0x7997('0xf')](_0x7997('0x5a'),_0x7997('0x5b'),_0x3f957b[_0x7997('0x17')]);});}var processPromises=function(_0x222ac2){return BPromise[_0x7997('0x55')](promises)['then'](function(_0x4e545d){})['catch'](function(_0x8223e0){logger[_0x7997('0xf')]('Error\x20processing\x20rows\x20block:',JSON[_0x7997('0x2c')](_0x8223e0));})[_0x7997('0x5c')](function(){socket[_0x7997('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x222ac2){return _0x222ac2[_0x7997('0x5e')]();}});};var endCsv=function(){return BPromise[_0x7997('0x5f')]()[_0x7997('0x28')](function(){if(hopperContacts){return checkHopper();}})[_0x7997('0x28')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7997('0x60')](FILEPATH);}catch(_0x2d36ed){logger[_0x7997('0xf')](_0x7997('0x61'),JSON['stringify'](_0x2d36ed));}finally{process[_0x7997('0x62')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x7997('0x63'));endCsv();});function main(){return BPromise[_0x7997('0x5f')]()[_0x7997('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7997('0x64')](',');return db[_0x7997('0x26')][_0x7997('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7997('0x28')](function(_0x32f89c){var _0xf0f5f4=fs[_0x7997('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7997('0x66')](_0xf0f5f4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x46039d,_0x9df817){total+=0x1;var _0x41ee57=total;promises[_0x7997('0x29')](checkRow(_0x46039d,_0x32f89c,_0x41ee57)[_0x7997('0x28')](function(){success+=0x1;})[_0x7997('0x52')](function(_0x482a2a){if(_0x482a2a['error']){errors+=0x1;delete _0x482a2a['error'];}else if(_0x482a2a[_0x7997('0x24')]){duplicates+=0x1;delete _0x482a2a[_0x7997('0x24')];}rows[_0x7997('0x29')](_0x482a2a);}));if(total%0xc8===0x0){_0x9df817[_0x7997('0x67')]();return processPromises(_0x9df817);}},'complete':function(){return processPromises()[_0x7997('0x28')](function(){logger[_0x7997('0x68')](_0x7997('0x69'));endCsv();});},'error':function(_0x11fb30,_0x506296){logger[_0x7997('0x68')](_0x7997('0x6a'),JSON['stringify'](_0x11fb30));endCsv();}});})[_0x7997('0x52')](function(_0x3a3378){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x3a3378));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index e04a84b..d0a27f8 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 _0x55b9=['emit','contact:import:','Abort\x20parser','abort','SystemError','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\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()','duplicates','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','affectedRows','unlink','exit','complete','argv','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','redis','defaults','localhost','format','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.createdAt','fields','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','fromQuery',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','info','Received\x20SIGINT','error','message','errors','push','sequelize','query','catch','stringify','send','start','binding','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','length','rows','data','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync'];(function(_0x3278e2,_0x8fb991){var _0x242a3d=function(_0x526bd8){while(--_0x526bd8){_0x3278e2['push'](_0x3278e2['shift']());}};_0x242a3d(++_0x8fb991);}(_0x55b9,0x9c));var _0x955b=function(_0x4ff817,_0x4e8345){_0x4ff817=_0x4ff817-0x0;var _0x335d11=_0x55b9[_0x4ff817];return _0x335d11;};'use strict';var fs=require('fs');var path=require(_0x955b('0x0'));var _=require(_0x955b('0x1'));var Papa=require(_0x955b('0x2'));var util=require(_0x955b('0x3'));var BPromise=require(_0x955b('0x4'));var moment=require(_0x955b('0x5'));var squel=require('squel');var Redis=require(_0x955b('0x6'));var db=require(_0x955b('0x7'))['db'];var config=require(_0x955b('0x8'));var logger=require('../../../config/logger')('import');config[_0x955b('0x9')]=_[_0x955b('0xa')](config[_0x955b('0x9')],{'host':_0x955b('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x955b('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x955b('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3e4f77){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))*$/[_0x955b('0xd')](_0x3e4f77);}function selectNotIn(_0x254197,_0x1bbe93,_0x562374,_0x59f386,_0x3e3c38){return squel[_0x955b('0xe')]()[_0x955b('0xf')](_0x955b('0x10'))[_0x955b('0x11')](_0x59f386)[_0x955b('0x12')](_0x1bbe93,null,_0x1bbe93+_0x955b('0x13')+_0x59f386+'.'+_0x562374)[_0x955b('0x14')](_0x59f386+'.'+_0x562374+_0x955b('0x15')+_0x254197+'.'+_0x562374)[_0x955b('0x14')](_0x1bbe93+_0x955b('0x16')+_0x3e3c38['join']()+')');}function insertCmHopper(_0xcff80a,_0x436278,_0xe5e69c,_0xcce43e,_0x3e91d1){var _0x151ce9=[_0x955b('0x17'),_0x955b('0x18'),'cm_contacts.id',_0x955b('0x19'),_0x436278+'.'+_0xcce43e,'cm_contacts.createdAt',_0x955b('0x1a'),_0x955b('0x1b'),_0x955b('0x1c'),'\x22'+_0x3e91d1+'\x22'];return squel[_0x955b('0x1d')]()[_0x955b('0x1e')](_0x955b('0x1f'))['fromQuery']([_0x955b('0x10'),'scheduledat',_0x955b('0x20'),_0x955b('0x21'),_0xcce43e,_0x955b('0x22'),_0x955b('0x23'),_0x955b('0x24'),_0x955b('0x25'),_0x955b('0x26')],squel['select']()['fields'](_0x151ce9)['from'](_0x436278)[_0x955b('0x12')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x436278+_0x955b('0x27'))['join'](_0xe5e69c,null,_0xe5e69c+'.id\x20=\x20'+_0x436278+'.'+_0xcce43e)['where'](_0x436278+_0x955b('0x28'),_0xcff80a)['where'](_0x955b('0x29'),NOW)[_0x955b('0x14')](_0x955b('0x2a'),selectNotIn(_0x436278,_0xe5e69c,_0xcce43e,_0x955b('0x1f'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0x955b('0x14')](_0x955b('0x2a'),selectNotIn(_0x436278,_0xe5e69c,_0xcce43e,_0x955b('0x1f'),['\x22always\x22'])))[_0x955b('0x2b')]();}function insertCmHopperBlack(_0x4e279e,_0x160904,_0x4c93af,_0x1a4f17){var _0x42f1d8=[_0x955b('0x17'),_0x955b('0x2c'),_0x955b('0x19'),_0x160904+'.'+_0x1a4f17,_0x955b('0x2d'),_0x955b('0x1a')];return squel['insert']()[_0x955b('0x1e')]('cm_hopper_black')['fromQuery']([_0x955b('0x10'),'ContactId',_0x955b('0x21'),_0x1a4f17,'createdAt','updatedAt'],squel[_0x955b('0xe')]()[_0x955b('0x2e')](_0x42f1d8)[_0x955b('0x11')](_0x160904)[_0x955b('0x12')](_0x955b('0x2f'),null,_0x955b('0x30')+_0x160904+_0x955b('0x27'))[_0x955b('0x12')](_0x4c93af,null,_0x4c93af+'.id\x20=\x20'+_0x160904+'.'+_0x1a4f17)[_0x955b('0x14')](_0x160904+'.CmListId\x20=\x20?',_0x4e279e)[_0x955b('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x955b('0x14')](_0x955b('0x2a'),squel[_0x955b('0xe')]()[_0x955b('0xf')](_0x955b('0x10'))[_0x955b('0x11')]('cm_hopper_black')[_0x955b('0x14')](_0x955b('0x31'),_0x4e279e)[_0x955b('0x14')](_0x1a4f17+_0x955b('0x32'),_0x160904+'.'+_0x1a4f17)))['toString']();}function insertCmContact(_0x1f206b,_0x507429,_0x422d7f,_0x39ad3c){var _0x2730cd=_[_0x955b('0x33')](_[_0x955b('0x34')](_0x39ad3c),['ListId',_0x955b('0x35'),_0x955b('0x22'),_0x955b('0x23')]);return squel[_0x955b('0x1d')]()[_0x955b('0x1e')](_0x955b('0x2f'))[_0x955b('0x36')](_0x2730cd,squel[_0x955b('0xe')]()[_0x955b('0x2e')](_0x2730cd)[_0x955b('0x11')](_0x507429)['where']('('+_0x422d7f[_0x955b('0x12')](',')+_0x955b('0x37'),squel['select']()[_0x955b('0x2e')](_0x422d7f)[_0x955b('0x11')](_0x955b('0x2f'))['where']('ListId\x20=\x20?',_0x1f206b)[_0x955b('0x14')](_0x955b('0x38')))['where']('id\x20IN\x20?',squel[_0x955b('0xe')]()[_0x955b('0xf')]('MIN(id)','min_id')['from'](_0x507429)['group'](_0x422d7f[_0x955b('0x12')](','))))['toString']();}function handleStop(){logger[_0x955b('0x39')](_0x955b('0x3a'));stopped=!![];}function handleUncaughtException(_0x20b14a){logger[_0x955b('0x3b')](_0x20b14a[_0x955b('0x3c')]);process['exit'](0x1);}function handleError(_0x5c1c91,_0x578eb2){stats[_0x955b('0x3d')][_0x955b('0x3e')]({'name':_0x578eb2['code'],'message':_0x578eb2[_0x955b('0x3c')],'row':_0x5c1c91});}function handleQuery(_0x338db2){logger[_0x955b('0x39')](_0x338db2);return db[_0x955b('0x3f')][_0x955b('0x40')](_0x338db2)['spread'](function(_0x1cd4b2){results[_0x955b('0x3e')](_0x1cd4b2);})[_0x955b('0x41')](function(_0x4637b6){logger[_0x955b('0x3b')](_0x4637b6[_0x955b('0x3c')]);});}function main(_0x193d72,_0x3af209,_0x5cef04,_0x66b382){logger[_0x955b('0x39')]('main',_0x193d72,JSON[_0x955b('0x42')](_0x3af209));process[_0x955b('0x43')](_0x955b('0x44'));var _0x1cfe9a=_0x3af209[_0x955b('0x45')];var _0x310ff2=_0x3af209['socket_timestamp'];var _0x3d44e2=path[_0x955b('0x12')](config[_0x955b('0x46')],_0x955b('0x47'),_0x310ff2+_0x955b('0x48'));var _0x5012ac=_[_0x955b('0x34')](_0x1cfe9a)[_0x955b('0x12')]();logger[_0x955b('0x39')]('header',_0x5012ac);fs[_0x955b('0x49')](_0x3d44e2,_0x5012ac+'\x0a');Papa[_0x955b('0x4a')](fs[_0x955b('0x4b')](_0x193d72),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3c784a,_0x4263cf){try{for(var _0x4b1e43=0x0,_0xf8c41f=[];_0x4b1e43<_0x3c784a['data'][_0x955b('0x4c')];_0x4b1e43++){stats[_0x955b('0x4d')]+=0x1;if(_0x3c784a[_0x955b('0x3d')][_0x4b1e43]){handleError(_0x3c784a[_0x955b('0x4e')][_0x4b1e43],_0x3c784a[_0x955b('0x3d')][_0x4b1e43]);}else{var _0x2f57c4=[];for(var _0x1e229c in _0x1cfe9a){if(_0x1cfe9a['hasOwnProperty'](_0x1e229c)){if(_0x3c784a[_0x955b('0x4e')][_0x4b1e43][_0x1cfe9a[_0x1e229c]]){var _0x8ec24d=_[_0x955b('0x4f')](_0x3c784a[_0x955b('0x4e')][_0x4b1e43][_0x1cfe9a[_0x1e229c]]['replace'](/"/g,'\x27'));switch(_0x1e229c){case _0x955b('0x50'):var _0x26c5f9=moment(_0x8ec24d,_0x955b('0x51'),!![]);if(_0x26c5f9[_0x955b('0x52')]()){_0xf8c41f[_0x955b('0x3e')]('\x22'+_0x8ec24d+'\x22');}else{_0x2f57c4['push'](_0x955b('0x53'));}break;case _0x955b('0x24'):var _0x5b135b=parseInt(_0x8ec24d);_0x8ec24d=_['isNaN'](_0x5b135b)||_0x5b135b<0x0||_0x5b135b>0x4?_0x66b382?0x3:0x2:_0x5b135b;_0xf8c41f['push']('\x22'+_0x8ec24d+'\x22');break;case _0x955b('0x25'):var _0x18cf48=parseInt(_0x8ec24d);if(_[_0x955b('0x54')](_0x18cf48)&&_[_0x955b('0x55')](_0x5cef04,_0x18cf48)){_0xf8c41f[_0x955b('0x3e')]('\x22'+_0x18cf48+'\x22');}else{_0x2f57c4['push']('agent\x20not\x20exists');}break;case _0x955b('0x56'):if(isEmail(_0x8ec24d)){_0xf8c41f[_0x955b('0x3e')]('\x22'+_0x8ec24d+'\x22');}else{_0x2f57c4['push']('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x2f435f=moment(_0x8ec24d,_0x955b('0x57'),!![]);if(_0x2f435f['isValid']()){_0xf8c41f['push']('\x22'+_0x8ec24d+'\x22');}else{_0x2f57c4['push'](_0x955b('0x58'));}break;default:_0xf8c41f[_0x955b('0x3e')]('\x22'+_0x8ec24d+'\x22');}}else{switch(_0x1e229c){case _0x955b('0x59'):case _0x955b('0x10'):_0x2f57c4['push'](_0x1e229c+'\x20not\x20specified');break;default:_0xf8c41f[_0x955b('0x3e')]('\x22\x22');}}}}if(_0x2f57c4[_0x955b('0x4c')]){handleError(_0x3c784a[_0x955b('0x4e')][_0x4b1e43],{'code':_0x955b('0x5a'),'message':_0x2f57c4['join']()});}else{fs[_0x955b('0x5b')](_0x3d44e2,_0xf8c41f['join']()+'\x0a');}_0xf8c41f=[];}if(!(stats[_0x955b('0x4d')]%0xc8)){socket[_0x955b('0x5c')](_0x955b('0x5d')+_0x310ff2,stats);stats[_0x955b('0x3d')]=[];}}if(stopped){logger[_0x955b('0x39')](_0x955b('0x5e'));_0x4263cf[_0x955b('0x5f')]();}}catch(_0x59c45a){handleError(_0x3c784a[_0x955b('0x4e')][_0x4b1e43],{'code':_0x955b('0x60'),'message':_0x59c45a['message']});logger['error']('step',_0x59c45a['message']);}},'complete':function(){try{var _0x282691=[];var _0x520d5a=_0x955b('0x2f');if(_0x3af209['duplicates']&&_0x3af209['duplicates'][_0x955b('0x4c')]){_0x520d5a=_0x955b('0x61')+_0x310ff2;_0x282691[_0x955b('0x3e')](_0x955b('0x62')+_0x520d5a+_0x955b('0x63'));}var _0x3f3522=util[_0x955b('0xc')](_0x955b('0x64'),_0x3d44e2,_0x520d5a,_0x5012ac,_0x3af209[_0x955b('0x21')],_0x3af209[_0x955b('0x35')]||null,NOW,NOW);if(_['isNil'](_0x1cfe9a['scheduledat'])){_0x3f3522+=_0x955b('0x65');}_0x282691[_0x955b('0x3e')](_0x3f3522);if(_0x3af209[_0x955b('0x66')]&&_0x3af209[_0x955b('0x66')][_0x955b('0x4c')]){_0x282691[_0x955b('0x3e')](insertCmContact(_0x3af209[_0x955b('0x21')],_0x520d5a,_0x3af209[_0x955b('0x66')],_0x1cfe9a));_0x282691[_0x955b('0x3e')]('DROP\x20TABLE\x20'+_0x520d5a+';');}_0x282691[_0x955b('0x3e')](insertCmHopper(_0x3af209[_0x955b('0x21')],_0x955b('0x67'),_0x955b('0x68'),'VoiceQueueId',_0x66b382));_0x282691[_0x955b('0x3e')](insertCmHopperBlack(_0x3af209[_0x955b('0x21')],_0x955b('0x69'),_0x955b('0x68'),_0x955b('0x6a')));_0x282691[_0x955b('0x3e')](insertCmHopper(_0x3af209[_0x955b('0x21')],_0x955b('0x6b'),_0x955b('0x6c'),_0x955b('0x6d'),_0x66b382));_0x282691['push'](insertCmHopperBlack(_0x3af209[_0x955b('0x21')],_0x955b('0x6e'),_0x955b('0x6c'),'CampaignId'));BPromise['each'](_0x282691,handleQuery)[_0x955b('0x6f')](function(_0x9d635e){stats['finish']=!![];stats[_0x955b('0x70')]=_0x3af209['duplicates']&&_0x3af209['duplicates'][_0x955b('0x4c')]?results[0x2][_0x955b('0x70')]:results[0x0]['affectedRows'];socket[_0x955b('0x5c')](_0x955b('0x5d')+_0x310ff2,stats);fs[_0x955b('0x71')](_0x193d72);fs[_0x955b('0x71')](_0x3d44e2);process[_0x955b('0x72')](0x0);})[_0x955b('0x41')](function(_0x3cbd0a){logger[_0x955b('0x3b')](_0x3cbd0a[_0x955b('0x3c')]);process[_0x955b('0x72')](0x1);});}catch(_0x4aa4bb){logger['error'](_0x955b('0x73'),_0x4aa4bb[_0x955b('0x3c')]);process['exit'](0x1);}},'error':function(_0x23d409,_0x3a2cd2,_0x17b0cd,_0xda2df4){throw new Error(_0xda2df4);}});}function validate(){if(process[_0x955b('0x74')]&&process[_0x955b('0x74')][_0x955b('0x4c')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4dc126=path[_0x955b('0x12')](config[_0x955b('0x46')],_0x955b('0x47'),process[_0x955b('0x74')][0x2]);if(!fs[_0x955b('0x75')](_0x4dc126)){throw new Error(_0x955b('0x76'));}var _0x515736={};try{_0x515736=JSON[_0x955b('0x4a')](process[_0x955b('0x74')][0x3]);if(!_0x515736[_0x955b('0x45')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x515736[_0x955b('0x45')][_0x955b('0x10')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x515736['binding'][_0x955b('0x59')]){throw new Error('firstName\x20is\x20mandatory');}var _0x1940f8=0x0;if(_0x515736[_0x955b('0x45')]['UserId']){_0x1940f8=0x1;}if(!_0x515736[_0x955b('0x21')]){throw new Error(_0x955b('0x77'));}}catch(_0x423e83){throw new Error(_0x955b('0x78'));}var _0x1146ff=[];try{_0x1146ff=_[_0x955b('0x79')](JSON[_0x955b('0x4a')](process[_0x955b('0x74')][0x4]),'id');}catch(_0x4c9341){logger[_0x955b('0x39')](_0x955b('0x7a'));}main(_0x4dc126,_0x515736,_0x1146ff,_0x1940f8);}validate();process['on'](_0x955b('0x7b'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xcfda=['\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','fields','.CmListId\x20=\x20?','ListId\x20=\x20?','toString','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','message','exit','errors','code','sequelize','error','stringify','send','start','binding','root','server/files/tmp','.csv','header','writeFileSync','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','push','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CompanyId','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','campaigns','CampaignId','then','finish','affectedRows','unlink','catch','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','test','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','ContactId','ListId','updatedAt','priority','UserId','recallme','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_hopper'];(function(_0x382168,_0xe03b6a){var _0x3ecf7e=function(_0x17b089){while(--_0x17b089){_0x382168['push'](_0x382168['shift']());}};_0x3ecf7e(++_0xe03b6a);}(_0xcfda,0x163));var _0xacfd=function(_0x5e2583,_0x2ddd1f){_0x5e2583=_0x5e2583-0x0;var _0x1622f2=_0xcfda[_0x5e2583];return _0x1622f2;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xacfd('0x0'));var util=require(_0xacfd('0x1'));var BPromise=require(_0xacfd('0x2'));var moment=require(_0xacfd('0x3'));var squel=require(_0xacfd('0x4'));var Redis=require(_0xacfd('0x5'));var db=require(_0xacfd('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xacfd('0x7'))('import');config[_0xacfd('0x8')]=_[_0xacfd('0x9')](config[_0xacfd('0x8')],{'host':_0xacfd('0xa'),'port':0x18eb});var socket=require(_0xacfd('0xb'))(new Redis(config[_0xacfd('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xacfd('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x525854){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))*$/[_0xacfd('0xd')](_0x525854);}function selectNotIn(_0x3ca72b,_0x4bd1a1,_0x3f542e,_0x52a9c8,_0x2c06f6){return squel['select']()[_0xacfd('0xe')](_0xacfd('0xf'))[_0xacfd('0x10')](_0x52a9c8)['join'](_0x4bd1a1,null,_0x4bd1a1+_0xacfd('0x11')+_0x52a9c8+'.'+_0x3f542e)[_0xacfd('0x12')](_0x52a9c8+'.'+_0x3f542e+'\x20=\x20'+_0x3ca72b+'.'+_0x3f542e)[_0xacfd('0x12')](_0x4bd1a1+_0xacfd('0x13')+_0x2c06f6[_0xacfd('0x14')]()+')');}function insertCmHopper(_0x19a6b8,_0x174142,_0x1a1bc3,_0x2ec33c,_0x1f4a66){var _0x4165c5=[_0xacfd('0x15'),_0xacfd('0x16'),_0xacfd('0x17'),_0xacfd('0x18'),_0x174142+'.'+_0x2ec33c,_0xacfd('0x19'),_0xacfd('0x1a'),_0xacfd('0x1b'),_0xacfd('0x1c'),'\x22'+_0x1f4a66+'\x22'];return squel[_0xacfd('0x1d')]()[_0xacfd('0x1e')]('cm_hopper')[_0xacfd('0x1f')](['phone','scheduledat',_0xacfd('0x20'),_0xacfd('0x21'),_0x2ec33c,'createdAt',_0xacfd('0x22'),_0xacfd('0x23'),_0xacfd('0x24'),_0xacfd('0x25')],squel[_0xacfd('0x26')]()['fields'](_0x4165c5)[_0xacfd('0x10')](_0x174142)[_0xacfd('0x14')](_0xacfd('0x27'),null,_0xacfd('0x28')+_0x174142+_0xacfd('0x29'))[_0xacfd('0x14')](_0x1a1bc3,null,_0x1a1bc3+_0xacfd('0x11')+_0x174142+'.'+_0x2ec33c)[_0xacfd('0x12')](_0x174142+'.CmListId\x20=\x20?',_0x19a6b8)[_0xacfd('0x12')](_0xacfd('0x2a'),NOW)[_0xacfd('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x174142,_0x1a1bc3,_0x2ec33c,_0xacfd('0x2b'),[_0xacfd('0x2c'),_0xacfd('0x2d')]))['where'](_0xacfd('0x2e'),selectNotIn(_0x174142,_0x1a1bc3,_0x2ec33c,_0xacfd('0x2b'),[_0xacfd('0x2c')])))['toString']();}function insertCmHopperBlack(_0x22c05c,_0x60b6df,_0x41e555,_0x470ac5){var _0x11e53c=['cm_contacts.phone',_0xacfd('0x17'),_0xacfd('0x18'),_0x60b6df+'.'+_0x470ac5,_0xacfd('0x19'),_0xacfd('0x1a')];return squel[_0xacfd('0x1d')]()[_0xacfd('0x1e')](_0xacfd('0x2f'))['fromQuery']([_0xacfd('0xf'),_0xacfd('0x20'),_0xacfd('0x21'),_0x470ac5,'createdAt',_0xacfd('0x22')],squel[_0xacfd('0x26')]()[_0xacfd('0x30')](_0x11e53c)[_0xacfd('0x10')](_0x60b6df)[_0xacfd('0x14')](_0xacfd('0x27'),null,_0xacfd('0x28')+_0x60b6df+_0xacfd('0x29'))[_0xacfd('0x14')](_0x41e555,null,_0x41e555+_0xacfd('0x11')+_0x60b6df+'.'+_0x470ac5)['where'](_0x60b6df+_0xacfd('0x31'),_0x22c05c)[_0xacfd('0x12')](_0xacfd('0x2a'),NOW)['where'](_0xacfd('0x2e'),squel[_0xacfd('0x26')]()[_0xacfd('0xe')]('phone')[_0xacfd('0x10')](_0xacfd('0x2f'))['where'](_0xacfd('0x32'),_0x22c05c)[_0xacfd('0x12')](_0x470ac5+'\x20=\x20?',_0x60b6df+'.'+_0x470ac5)))[_0xacfd('0x33')]();}function insertCmContact(_0x3dfcac,_0x898db6,_0x49d4d1,_0x271bac){var _0x6e834a=_['concat'](_[_0xacfd('0x34')](_0x271bac),[_0xacfd('0x21'),'CompanyId','createdAt','updatedAt']);return squel['insert']()[_0xacfd('0x1e')](_0xacfd('0x27'))[_0xacfd('0x1f')](_0x6e834a,squel['select']()[_0xacfd('0x30')](_0x6e834a)[_0xacfd('0x10')](_0x898db6)[_0xacfd('0x12')]('('+_0x49d4d1[_0xacfd('0x14')](',')+_0xacfd('0x35'),squel[_0xacfd('0x26')]()[_0xacfd('0x30')](_0x49d4d1)['from'](_0xacfd('0x27'))[_0xacfd('0x12')](_0xacfd('0x32'),_0x3dfcac)['where'](_0xacfd('0x36')))[_0xacfd('0x12')](_0xacfd('0x37'),squel['select']()[_0xacfd('0xe')](_0xacfd('0x38'),_0xacfd('0x39'))['from'](_0x898db6)['group'](_0x49d4d1['join'](','))))['toString']();}function handleStop(){logger[_0xacfd('0x3a')](_0xacfd('0x3b'));stopped=!![];}function handleUncaughtException(_0x4ffe85){logger['error'](_0x4ffe85[_0xacfd('0x3c')]);process[_0xacfd('0x3d')](0x1);}function handleError(_0x10222c,_0x3f42dc){stats[_0xacfd('0x3e')]['push']({'name':_0x3f42dc[_0xacfd('0x3f')],'message':_0x3f42dc[_0xacfd('0x3c')],'row':_0x10222c});}function handleQuery(_0x31603e){logger[_0xacfd('0x3a')](_0x31603e);return db[_0xacfd('0x40')]['query'](_0x31603e)['spread'](function(_0x504d96){results['push'](_0x504d96);})['catch'](function(_0x29ece6){logger[_0xacfd('0x41')](_0x29ece6['message']);});}function main(_0x14fcb7,_0x4dbebe,_0x22ec7d,_0x5f5bc9){logger['info']('main',_0x14fcb7,JSON[_0xacfd('0x42')](_0x4dbebe));process[_0xacfd('0x43')](_0xacfd('0x44'));var _0x3b6fba=_0x4dbebe[_0xacfd('0x45')];var _0x5864b3=_0x4dbebe['socket_timestamp'];var _0x176377=path[_0xacfd('0x14')](config[_0xacfd('0x46')],_0xacfd('0x47'),_0x5864b3+_0xacfd('0x48'));var _0x44c0c1=_[_0xacfd('0x34')](_0x3b6fba)['join']();logger[_0xacfd('0x3a')](_0xacfd('0x49'),_0x44c0c1);fs[_0xacfd('0x4a')](_0x176377,_0x44c0c1+'\x0a');Papa[_0xacfd('0x4b')](fs[_0xacfd('0x4c')](_0x14fcb7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4c6dba,_0x451baf){try{for(var _0x2ee81f=0x0,_0x1ff4be=[];_0x2ee81f<_0x4c6dba[_0xacfd('0x4d')][_0xacfd('0x4e')];_0x2ee81f++){stats[_0xacfd('0x4f')]+=0x1;if(_0x4c6dba['errors'][_0x2ee81f]){handleError(_0x4c6dba[_0xacfd('0x4d')][_0x2ee81f],_0x4c6dba[_0xacfd('0x3e')][_0x2ee81f]);}else{var _0x58bee1=[];for(var _0x4d1389 in _0x3b6fba){if(_0x3b6fba[_0xacfd('0x50')](_0x4d1389)){if(_0x4c6dba[_0xacfd('0x4d')][_0x2ee81f][_0x3b6fba[_0x4d1389]]){var _0x24701e=_[_0xacfd('0x51')](_0x4c6dba[_0xacfd('0x4d')][_0x2ee81f][_0x3b6fba[_0x4d1389]][_0xacfd('0x52')](/"/g,'\x27'));switch(_0x4d1389){case _0xacfd('0x53'):var _0x10445b=moment(_0x24701e,_0xacfd('0x54'),!![]);if(_0x10445b[_0xacfd('0x55')]()){_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x24701e+'\x22');}else{_0x58bee1[_0xacfd('0x56')](_0xacfd('0x57'));}break;case _0xacfd('0x23'):var _0x4f0ad3=parseInt(_0x24701e);_0x24701e=_[_0xacfd('0x58')](_0x4f0ad3)||_0x4f0ad3<0x0||_0x4f0ad3>0x4?_0x5f5bc9?0x3:0x2:_0x4f0ad3;_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x24701e+'\x22');break;case'UserId':var _0x4f83f8=parseInt(_0x24701e);if(_['isNumber'](_0x4f83f8)&&_[_0xacfd('0x59')](_0x22ec7d,_0x4f83f8)){_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x4f83f8+'\x22');}else{_0x58bee1[_0xacfd('0x56')](_0xacfd('0x5a'));}break;case'email':if(isEmail(_0x24701e)){_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x24701e+'\x22');}else{_0x58bee1[_0xacfd('0x56')](_0xacfd('0x5b'));}break;case _0xacfd('0x5c'):var _0x327428=moment(_0x24701e,_0xacfd('0x5d'),!![]);if(_0x327428[_0xacfd('0x55')]()){_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x24701e+'\x22');}else{_0x58bee1['push'](_0xacfd('0x5e'));}break;default:_0x1ff4be[_0xacfd('0x56')]('\x22'+_0x24701e+'\x22');}}else{switch(_0x4d1389){case _0xacfd('0x5f'):case _0xacfd('0xf'):_0x58bee1['push'](_0x4d1389+'\x20not\x20specified');break;default:_0x1ff4be[_0xacfd('0x56')]('\x22\x22');}}}}if(_0x58bee1[_0xacfd('0x4e')]){handleError(_0x4c6dba['data'][_0x2ee81f],{'code':_0xacfd('0x60'),'message':_0x58bee1[_0xacfd('0x14')]()});}else{fs['appendFileSync'](_0x176377,_0x1ff4be[_0xacfd('0x14')]()+'\x0a');}_0x1ff4be=[];}if(!(stats['rows']%0xc8)){socket[_0xacfd('0x61')](_0xacfd('0x62')+_0x5864b3,stats);stats[_0xacfd('0x3e')]=[];}}if(stopped){logger[_0xacfd('0x3a')](_0xacfd('0x63'));_0x451baf[_0xacfd('0x64')]();}}catch(_0x4c7ca5){handleError(_0x4c6dba[_0xacfd('0x4d')][_0x2ee81f],{'code':_0xacfd('0x65'),'message':_0x4c7ca5['message']});logger[_0xacfd('0x41')](_0xacfd('0x66'),_0x4c7ca5['message']);}},'complete':function(){try{var _0x41d390=[];var _0x5abcdf='cm_contacts';if(_0x4dbebe[_0xacfd('0x67')]&&_0x4dbebe[_0xacfd('0x67')][_0xacfd('0x4e')]){_0x5abcdf='cm_contacts_'+_0x5864b3;_0x41d390['push'](_0xacfd('0x68')+_0x5abcdf+_0xacfd('0x69'));}var _0xcae697=util[_0xacfd('0xc')]('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',_0x176377,_0x5abcdf,_0x44c0c1,_0x4dbebe['ListId'],_0x4dbebe[_0xacfd('0x6a')]||null,NOW,NOW);if(_[_0xacfd('0x6b')](_0x3b6fba[_0xacfd('0x53')])){_0xcae697+=_0xacfd('0x6c');}_0x41d390[_0xacfd('0x56')](_0xcae697);if(_0x4dbebe[_0xacfd('0x67')]&&_0x4dbebe[_0xacfd('0x67')][_0xacfd('0x4e')]){_0x41d390[_0xacfd('0x56')](insertCmContact(_0x4dbebe[_0xacfd('0x21')],_0x5abcdf,_0x4dbebe[_0xacfd('0x67')],_0x3b6fba));_0x41d390[_0xacfd('0x56')](_0xacfd('0x6d')+_0x5abcdf+';');}_0x41d390[_0xacfd('0x56')](insertCmHopper(_0x4dbebe[_0xacfd('0x21')],_0xacfd('0x6e'),_0xacfd('0x6f'),'VoiceQueueId',_0x5f5bc9));_0x41d390[_0xacfd('0x56')](insertCmHopperBlack(_0x4dbebe[_0xacfd('0x21')],_0xacfd('0x70'),_0xacfd('0x6f'),_0xacfd('0x71')));_0x41d390[_0xacfd('0x56')](insertCmHopper(_0x4dbebe[_0xacfd('0x21')],_0xacfd('0x72'),'campaigns','CampaignId',_0x5f5bc9));_0x41d390['push'](insertCmHopperBlack(_0x4dbebe['ListId'],_0xacfd('0x73'),_0xacfd('0x74'),_0xacfd('0x75')));BPromise['each'](_0x41d390,handleQuery)[_0xacfd('0x76')](function(_0x1a9827){stats[_0xacfd('0x77')]=!![];stats['affectedRows']=_0x4dbebe[_0xacfd('0x67')]&&_0x4dbebe[_0xacfd('0x67')][_0xacfd('0x4e')]?results[0x2][_0xacfd('0x78')]:results[0x0][_0xacfd('0x78')];socket[_0xacfd('0x61')](_0xacfd('0x62')+_0x5864b3,stats);fs[_0xacfd('0x79')](_0x14fcb7);fs[_0xacfd('0x79')](_0x176377);process[_0xacfd('0x3d')](0x0);})[_0xacfd('0x7a')](function(_0x321e81){logger[_0xacfd('0x41')](_0x321e81[_0xacfd('0x3c')]);process[_0xacfd('0x3d')](0x1);});}catch(_0x8f29a){logger['error']('complete',_0x8f29a[_0xacfd('0x3c')]);process[_0xacfd('0x3d')](0x1);}},'error':function(_0xb55558,_0x914aac,_0x2f263e,_0x29c6f9){throw new Error(_0x29c6f9);}});}function validate(){if(process[_0xacfd('0x7b')]&&process[_0xacfd('0x7b')][_0xacfd('0x4e')]<0x4){throw new Error(_0xacfd('0x7c'));}var _0x27095b=path[_0xacfd('0x14')](config[_0xacfd('0x46')],'server/files/tmp',process[_0xacfd('0x7b')][0x2]);if(!fs[_0xacfd('0x7d')](_0x27095b)){throw new Error(_0xacfd('0x7e'));}var _0x2fde99={};try{_0x2fde99=JSON[_0xacfd('0x4b')](process[_0xacfd('0x7b')][0x3]);if(!_0x2fde99[_0xacfd('0x45')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2fde99[_0xacfd('0x45')][_0xacfd('0xf')]){throw new Error(_0xacfd('0x7f'));}if(!_0x2fde99[_0xacfd('0x45')][_0xacfd('0x5f')]){throw new Error('firstName\x20is\x20mandatory');}var _0x38c435=0x0;if(_0x2fde99['binding'][_0xacfd('0x24')]){_0x38c435=0x1;}if(!_0x2fde99[_0xacfd('0x21')]){throw new Error(_0xacfd('0x80'));}}catch(_0x47f2de){throw new Error(_0xacfd('0x81'));}var _0x568b4d=[];try{_0x568b4d=_['map'](JSON[_0xacfd('0x4b')](process['argv'][0x4]),'id');}catch(_0x2226ef){logger[_0xacfd('0x3a')](_0xacfd('0x82'));}main(_0x27095b,_0x2fde99,_0x568b4d,_0x38c435);}validate();process['on'](_0xacfd('0x83'),handleStop);process['on'](_0xacfd('0x84'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 48b216d..24eda35 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 _0xa6c4=['destexten','Queue','Date','agentcalledAt','destcalleridname','Agent\x20Number','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','membername','starttime','***\x20Time\x20Info\x20***','answertime','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','push','variable','queue','calleridnum','outbound','destcalleridnum','getDescriptions','inbound','string','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To'];(function(_0x34f8d8,_0x509227){var _0x1427d5=function(_0x153959){while(--_0x153959){_0x34f8d8['push'](_0x34f8d8['shift']());}};_0x1427d5(++_0x509227);}(_0xa6c4,0x16b));var _0x4a6c=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xa6c4[_0x289e64];return _0x30246c;};'use strict';exports[_0x4a6c('0x0')]=function(_0x4baa71,_0x4392e4){var _0x4ec54e=[{'type':'string','content':_0x4a6c('0x1'),'variableName':null}];switch(_0x4baa71['toLowerCase']()){case'voice':switch(_0x4392e4[_0x4a6c('0x2')]()){case'inbound':_0x4ec54e[_0x4a6c('0x3')]({'type':_0x4a6c('0x4'),'content':'','variableName':_0x4a6c('0x5')});_0x4ec54e['push']({'type':_0x4a6c('0x4'),'content':'','variableName':_0x4a6c('0x6')});break;case _0x4a6c('0x7'):_0x4ec54e[_0x4a6c('0x3')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x4ec54e[_0x4a6c('0x3')]({'type':_0x4a6c('0x4'),'content':'','variableName':_0x4a6c('0x8')});break;}}return _0x4ec54e;};exports[_0x4a6c('0x9')]=function(_0x7cc71a,_0xdc327c){var _0x46f9ec=[];switch(_0x7cc71a[_0x4a6c('0x2')]()){case'voice':switch(_0xdc327c[_0x4a6c('0x2')]()){case _0x4a6c('0xa'):_0x46f9ec=[{'type':_0x4a6c('0xb'),'content':_0x4a6c('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0xe'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x6')},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0xf'),'keyType':_0x4a6c('0x4'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x4a6c('0x10'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x11')},{'type':'keyValue','content':'','key':_0x4a6c('0x12'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x5')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x4a6c('0x13'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x14')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x4a6c('0x15')},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x16'),'keyType':_0x4a6c('0x4'),'variableName':'destcalleridnum'},{'type':_0x4a6c('0xb'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x17'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x14')},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x18'),'keyType':'variable','variableName':_0x4a6c('0x19')},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x1a'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x1b')},{'type':'keyValue','content':'','key':_0x4a6c('0x1c'),'keyType':_0x4a6c('0x4'),'variableName':_0x4a6c('0x1d')},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x1e'),'keyType':'variable','variableName':_0x4a6c('0x1f')}];break;case'outbound':_0x46f9ec=[{'type':_0x4a6c('0xb'),'content':_0x4a6c('0xc'),'variableName':null},{'type':_0x4a6c('0xd'),'content':'','key':'Called\x20Number','keyType':_0x4a6c('0x4'),'keyContent':'','variableName':_0x4a6c('0x8')},{'type':_0x4a6c('0xd'),'content':'','key':'Member\x20Name','keyType':_0x4a6c('0x4'),'keyContent':'','variableName':_0x4a6c('0x20')},{'type':_0x4a6c('0xd'),'content':'','key':'UniqueId','keyType':_0x4a6c('0x4'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x4a6c('0x13'),'keyType':_0x4a6c('0x4'),'keyContent':'','variableName':_0x4a6c('0x21')},{'type':'string','content':_0x4a6c('0x22')},{'type':_0x4a6c('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x4a6c('0x4'),'keyContent':'','variableName':_0x4a6c('0x23')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x4a6c('0x4'),'keyContent':'','variableName':'endtime'},{'type':'keyValue','content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x4a6c('0xd'),'content':'','key':_0x4a6c('0x24'),'keyType':'variable','keyContent':'','variableName':_0x4a6c('0x25')}];break;}}return _0x46f9ec;}; \ No newline at end of file +var _0x8816=['***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','Queue','UniqueId','Date','Agent\x20Name','destcalleridname','Agent\x20Number','Agent\x20Ring','agentcalledAt','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','destcalleridnum','getDescriptions','voice'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8816,0x7e));var _0x6881=function(_0x93c97,_0x118004){_0x93c97=_0x93c97-0x0;var _0x4ac09d=_0x8816[_0x93c97];return _0x4ac09d;};'use strict';exports[_0x6881('0x0')]=function(_0x210407,_0x4d7999){var _0x8d76b8=[{'type':_0x6881('0x1'),'content':_0x6881('0x2'),'variableName':null}];switch(_0x210407[_0x6881('0x3')]()){case'voice':switch(_0x4d7999[_0x6881('0x3')]()){case _0x6881('0x4'):_0x8d76b8[_0x6881('0x5')]({'type':_0x6881('0x6'),'content':'','variableName':_0x6881('0x7')});_0x8d76b8['push']({'type':_0x6881('0x6'),'content':'','variableName':_0x6881('0x8')});break;case'outbound':_0x8d76b8[_0x6881('0x5')]({'type':_0x6881('0x1'),'content':'Outbound\x20Call','variableName':null});_0x8d76b8[_0x6881('0x5')]({'type':_0x6881('0x6'),'content':'','variableName':_0x6881('0x9')});break;}}return _0x8d76b8;};exports[_0x6881('0xa')]=function(_0x2d895d,_0x402e5b){var _0x21471a=[];switch(_0x2d895d[_0x6881('0x3')]()){case _0x6881('0xb'):switch(_0x402e5b[_0x6881('0x3')]()){case _0x6881('0x4'):_0x21471a=[{'type':_0x6881('0x1'),'content':_0x6881('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6881('0xd'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x8')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0xf'),'keyType':_0x6881('0x6'),'variableName':'calleridname'},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x10'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x11')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x12'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x7')},{'type':'keyValue','content':'','key':_0x6881('0x13'),'keyType':_0x6881('0x6'),'variableName':'uniqueid'},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x14'),'keyType':_0x6881('0x6'),'variableName':'agentcalledAt'},{'type':_0x6881('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x15'),'keyType':'variable','variableName':_0x6881('0x16')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x17'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x9')},{'type':_0x6881('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x18'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x19')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x1a'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x1b')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x1c'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x1d'),'keyType':_0x6881('0x6'),'variableName':_0x6881('0x1e')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x1f'),'keyType':'variable','variableName':_0x6881('0x20')}];break;case _0x6881('0x21'):_0x21471a=[{'type':_0x6881('0x1'),'content':_0x6881('0xc'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x6881('0x9')},{'type':'keyValue','content':'','key':_0x6881('0x22'),'keyType':'variable','keyContent':'','variableName':_0x6881('0x23')},{'type':'keyValue','content':'','key':_0x6881('0x13'),'keyType':_0x6881('0x6'),'keyContent':'','variableName':_0x6881('0x24')},{'type':_0x6881('0xe'),'content':'','key':'Date','keyType':_0x6881('0x6'),'keyContent':'','variableName':_0x6881('0x25')},{'type':_0x6881('0x1'),'content':_0x6881('0x26')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x27'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x28'),'keyType':'variable','keyContent':'','variableName':_0x6881('0x29')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x2a'),'keyType':_0x6881('0x6'),'keyContent':'','variableName':_0x6881('0x2b')},{'type':_0x6881('0xe'),'content':'','key':_0x6881('0x2c'),'keyType':_0x6881('0x6'),'keyContent':'','variableName':_0x6881('0x2d')}];break;}}return _0x21471a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 2e1552c..7e4752f 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 _0x7119=['../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','Interaction','findOne','then','update','info','error','tracked','user','query','body','omit','html','phone','fax','lodash'];(function(_0x590ab1,_0x2aaa04){var _0x1d9aca=function(_0x47c104){while(--_0x47c104){_0x590ab1['push'](_0x590ab1['shift']());}};_0x1d9aca(++_0x2aaa04);}(_0x7119,0x133));var _0x9711=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0x7119[_0x304b67];return _0x493afb;};'use strict';var _=require(_0x9711('0x0'));var db=require(_0x9711('0x1'))['db'];var loggers={'openchannel':require(_0x9711('0x2'))('openchannel-interactions'),'mail':require(_0x9711('0x2'))(_0x9711('0x3')),'fax':require('../../config/logger')(_0x9711('0x4')),'sms':require('../../config/logger')(_0x9711('0x5')),'chat':require(_0x9711('0x2'))('chat-interactions'),'whatsapp':require(_0x9711('0x2'))(_0x9711('0x6'))};function getInteractionId(_0x1e4292,_0x4371d9,_0x11b600){if(_0x1e4292&&_0x1e4292[_[_0x9711('0x7')](_0x11b600)+_0x9711('0x8')]){return _0x1e4292[_[_0x9711('0x7')](_0x11b600)+_0x9711('0x8')];}else if(_0x1e4292&&_0x1e4292['id']){return _0x1e4292['id'];}else if(_0x4371d9&&_0x4371d9['id']){return _0x4371d9['id'];}else{return'unknown';}}function log(_0x14ec56,_0x231754,_0x376d4e,_0x3a4013,_0x1937be,_0x76e6f7){loggers[_0x1937be[_0x9711('0x9')]()][_0x14ec56](_0x9711('0xa'),_0x76e6f7[_0x9711('0xb')](),_0x231754?_0x231754['id']:null,_0x231754?_0x231754[_0x9711('0xc')]:null,_0x231754?_0x231754[_0x9711('0xd')]:null,getInteractionId(_0x376d4e,_0x3a4013,_0x1937be),_0x376d4e?JSON['stringify'](_0x376d4e):'null');}function updateUser(_0x11bbcf,_0x573805,_0x14e370,_0x5bdf50,_0x5cc6ea){db[_[_0x9711('0x7')](_0x5bdf50)+_0x9711('0xe')][_0x9711('0xf')]({'where':{'id':getInteractionId(_0x573805,_0x14e370,_0x5bdf50)}})[_0x9711('0x10')](function(_0x5d83fb){if(_0x5d83fb){return _0x5d83fb[_0x9711('0x11')]({'UserId':_0x11bbcf?_0x11bbcf['id']:null});}})['then'](function(_0x42fef1){if(_0x42fef1){log(_0x9711('0x12'),_0x11bbcf,_0x573805,_0x14e370,_0x5bdf50,_0x5cc6ea);}})['catch'](function(){log(_0x9711('0x13'),_0x11bbcf,_0x573805,_0x14e370,_0x5bdf50,_0x5cc6ea);});}exports[_0x9711('0x14')]=function(_0x928532,_0x4bcb29){return function(_0x3e09fd,_0x3a0b36,_0x1ba889){var _0x17d901=_0x3e09fd[_0x9711('0x15')];var _0x39500a={};var _0x45d0ac=_0x3e09fd[_0x9711('0x16')];if(_0x39500a){_0x39500a=_['clone'](_0x3e09fd[_0x9711('0x17')]);_0x39500a=_[_0x9711('0x18')](_0x39500a,['body',_0x9711('0x19'),_0x9711('0x1a'),_0x9711('0x1b'),'mobile']);}updateUser(_0x17d901,_0x39500a,_0x45d0ac,_0x928532,_0x4bcb29);_0x1ba889(null);};}; \ No newline at end of file +var _0x141e=['info','catch','error','user','query','clone','body','html','fax','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','then'];(function(_0x2b1163,_0x327ff5){var _0x6e994f=function(_0x2a5f13){while(--_0x2a5f13){_0x2b1163['push'](_0x2b1163['shift']());}};_0x6e994f(++_0x327ff5);}(_0x141e,0xbf));var _0xe141=function(_0x127426,_0x52a62f){_0x127426=_0x127426-0x0;var _0x4186a4=_0x141e[_0x127426];return _0x4186a4;};'use strict';var _=require('lodash');var db=require(_0xe141('0x0'))['db'];var loggers={'openchannel':require(_0xe141('0x1'))(_0xe141('0x2')),'mail':require(_0xe141('0x1'))(_0xe141('0x3')),'fax':require(_0xe141('0x1'))(_0xe141('0x4')),'sms':require(_0xe141('0x1'))(_0xe141('0x5')),'chat':require(_0xe141('0x1'))(_0xe141('0x6')),'whatsapp':require('../../config/logger')(_0xe141('0x7'))};function getInteractionId(_0x2c5ad1,_0x3add3a,_0x1de74b){if(_0x2c5ad1&&_0x2c5ad1[_['upperFirst'](_0x1de74b)+_0xe141('0x8')]){return _0x2c5ad1[_['upperFirst'](_0x1de74b)+_0xe141('0x8')];}else if(_0x2c5ad1&&_0x2c5ad1['id']){return _0x2c5ad1['id'];}else if(_0x3add3a&&_0x3add3a['id']){return _0x3add3a['id'];}else{return _0xe141('0x9');}}function log(_0x301e04,_0x51bf8e,_0x4dcf38,_0x5e1029,_0x3c33eb,_0x560ab6){loggers[_0x3c33eb[_0xe141('0xa')]()][_0x301e04](_0xe141('0xb'),_0x560ab6[_0xe141('0xc')](),_0x51bf8e?_0x51bf8e['id']:null,_0x51bf8e?_0x51bf8e[_0xe141('0xd')]:null,_0x51bf8e?_0x51bf8e[_0xe141('0xe')]:null,getInteractionId(_0x4dcf38,_0x5e1029,_0x3c33eb),_0x4dcf38?JSON[_0xe141('0xf')](_0x4dcf38):'null');}function updateUser(_0x5935d1,_0x42043e,_0x1a9084,_0x5e1d97,_0x4864cd){db[_['upperFirst'](_0x5e1d97)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x42043e,_0x1a9084,_0x5e1d97)}})[_0xe141('0x10')](function(_0x3bd4f3){if(_0x3bd4f3){return _0x3bd4f3['update']({'UserId':_0x5935d1?_0x5935d1['id']:null});}})[_0xe141('0x10')](function(_0x51fa04){if(_0x51fa04){log(_0xe141('0x11'),_0x5935d1,_0x42043e,_0x1a9084,_0x5e1d97,_0x4864cd);}})[_0xe141('0x12')](function(){log(_0xe141('0x13'),_0x5935d1,_0x42043e,_0x1a9084,_0x5e1d97,_0x4864cd);});}exports['tracked']=function(_0xa53750,_0x28ad70){return function(_0x644cf7,_0xecb6de,_0x151ad0){var _0x3493a1=_0x644cf7[_0xe141('0x14')];var _0x54a9d0={};var _0x3a3d79=_0x644cf7[_0xe141('0x15')];if(_0x54a9d0){_0x54a9d0=_[_0xe141('0x16')](_0x644cf7[_0xe141('0x17')]);_0x54a9d0=_['omit'](_0x54a9d0,[_0xe141('0x17'),_0xe141('0x18'),'phone',_0xe141('0x19'),'mobile']);}updateUser(_0x3493a1,_0x54a9d0,_0x3a3d79,_0xa53750,_0x28ad70);_0x151ad0(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bbc16cf..980ce3f 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 _0x8ee2=['createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8ee2,0x6c));var _0x28ee=function(_0x5e3068,_0x1dde86){_0x5e3068=_0x5e3068-0x0;var _0x5c9abb=_0x8ee2[_0x5e3068];return _0x5c9abb;};'use strict';var crypto=require(_0x28ee('0x0'));var util=require(_0x28ee('0x1'));var compose=require(_0x28ee('0x2'));var db=require(_0x28ee('0x3'))['db'];var config=require(_0x28ee('0x4'));function getValueFromLicense(_0x286dff,_0x2befa7){if(_0x286dff&&_0x2befa7){if(_0x2befa7[_0x28ee('0x5')]&&_0x2befa7[_0x28ee('0x6')]){var _0x3b7e8c=_0x2befa7[_0x28ee('0x5')];var _0x22efb6=_0x2befa7[_0x28ee('0x6')];var _0x4bd4a2=_0x3b7e8c[_0x28ee('0x7')]('-')[0x4];var _0x2b5101=_0x3b7e8c[_0x28ee('0x7')]('-')[0x0];var _0x38383c=crypto[_0x28ee('0x8')](_0x28ee('0x9'),util[_0x28ee('0xa')](_0x28ee('0xb'),_0x4bd4a2,_0x3b7e8c,_0x2b5101));var _0x41300c=_0x38383c[_0x28ee('0xc')](_0x22efb6,_0x28ee('0xd'),_0x28ee('0xe'));_0x41300c+=_0x38383c[_0x28ee('0xf')]('utf8');var _0xbc79b8=JSON['parse'](_0x41300c);return _0xbc79b8[_0x28ee('0x10')](_0x286dff)?_0xbc79b8[_0x286dff]:null;}}return null;}function isLimit(_0x360b7b,_0x58f166,_0x271f47,_0x104359){var _0x22dace=_0x58f166;return compose()[_0x28ee('0x11')](function(_0x19c092,_0x1cf681,_0x39a60d){return db[_0x28ee('0x12')][_0x28ee('0x13')]({'where':{'id':0x1},'raw':!![]})[_0x28ee('0x14')](function(_0x565df4){var _0x28bdf7=getValueFromLicense(_0x360b7b,_0x565df4);return _0x28bdf7?_0x28bdf7:_0x22dace;})[_0x28ee('0x14')](function(_0x29cede){_0x22dace=_0x29cede;return _0x271f47[_0x28ee('0x15')](_0x104359);})[_0x28ee('0x14')](function(_0x24a550){if(_0x24a550>=_0x22dace){return _0x1cf681[_0x28ee('0x16')](0x193)[_0x28ee('0x17')]({'message':util[_0x28ee('0xa')](_0x28ee('0x18'),_0x360b7b)});}_0x39a60d();})[_0x28ee('0x19')](function(_0x270041){_0x39a60d(_0x270041);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':_0x28ee('0x1a')},{'role':_0x28ee('0x1b')}]}});}exports[_0x28ee('0x1c')]=isUserLimit; \ No newline at end of file +var _0xeb3d=['isUserLimit','composable-middleware','../../config/environment','data1','split','createDecipher','format','%s:%s:%s','update','utf8','final','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user'];(function(_0x3f9503,_0x5b6afe){var _0x1ccaf9=function(_0x1cb4f1){while(--_0x1cb4f1){_0x3f9503['push'](_0x3f9503['shift']());}};_0x1ccaf9(++_0x5b6afe);}(_0xeb3d,0x114));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require(_0xdeb3('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xdeb3('0x1'));function getValueFromLicense(_0x3eb5f9,_0x30b00e){if(_0x3eb5f9&&_0x30b00e){if(_0x30b00e[_0xdeb3('0x2')]&&_0x30b00e['license']){var _0x50d29a=_0x30b00e[_0xdeb3('0x2')];var _0x371d23=_0x30b00e['license'];var _0x2106fc=_0x50d29a[_0xdeb3('0x3')]('-')[0x4];var _0x42b4ed=_0x50d29a[_0xdeb3('0x3')]('-')[0x0];var _0x5ac35e=crypto[_0xdeb3('0x4')]('aes-256-ctr',util[_0xdeb3('0x5')](_0xdeb3('0x6'),_0x2106fc,_0x50d29a,_0x42b4ed));var _0x3662e2=_0x5ac35e[_0xdeb3('0x7')](_0x371d23,'base64',_0xdeb3('0x8'));_0x3662e2+=_0x5ac35e[_0xdeb3('0x9')](_0xdeb3('0x8'));var _0x210798=JSON['parse'](_0x3662e2);return _0x210798[_0xdeb3('0xa')](_0x3eb5f9)?_0x210798[_0x3eb5f9]:null;}}return null;}function isLimit(_0x2bba68,_0x5b2239,_0x2cedae,_0x4c9b84){var _0x3d8d74=_0x5b2239;return compose()[_0xdeb3('0xb')](function(_0x4a5f19,_0x3d59c7,_0x464516){return db[_0xdeb3('0xc')][_0xdeb3('0xd')]({'where':{'id':0x1},'raw':!![]})[_0xdeb3('0xe')](function(_0x1c9748){var _0x27397a=getValueFromLicense(_0x2bba68,_0x1c9748);return _0x27397a?_0x27397a:_0x3d8d74;})[_0xdeb3('0xe')](function(_0x2ad068){_0x3d8d74=_0x2ad068;return _0x2cedae[_0xdeb3('0xf')](_0x4c9b84);})[_0xdeb3('0xe')](function(_0x542f33){if(_0x542f33>=_0x3d8d74){return _0x3d59c7[_0xdeb3('0x10')](0x193)[_0xdeb3('0x11')]({'message':util[_0xdeb3('0x5')](_0xdeb3('0x12'),_0x2bba68)});}_0x464516();})[_0xdeb3('0x13')](function(_0x3d778e){_0x464516(_0x3d778e);});});}function isUserLimit(){return isLimit(_0xdeb3('0x14'),0x1,db[_0xdeb3('0x15')],{'where':{'$or':[{'role':_0xdeb3('0x16')},{'role':_0xdeb3('0x17')}]}});}exports[_0xdeb3('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 904a5a0..7b770c0 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 _0xafd9=['YYYY-MM-DD','castTo','text','CAST(','field','$notIn','\x20OR\x20','$in','IN\x20?','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','start','pop','DATE','format','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','replace','length','split','shift','match','forEach','filter','map','conditions','push','buildExpression','operator','$between','value','includes','$gt','$lte','add','days'];(function(_0x11b2ea,_0x225f78){var _0x2a2e0e=function(_0x3839ec){while(--_0x3839ec){_0x11b2ea['push'](_0x11b2ea['shift']());}};_0x2a2e0e(++_0x225f78);}(_0xafd9,0xec));var _0x9afd=function(_0x3d5d16,_0x1bee4a){_0x3d5d16=_0x3d5d16-0x0;var _0x19e950=_0xafd9[_0x3d5d16];return _0x19e950;};'use strict';var _=require(_0x9afd('0x0'));var moment=require(_0x9afd('0x1'));exports[_0x9afd('0x2')]=function(_0x220444){var _0xf5769f={'conditions':[]};_0xf5769f['sqlOperator']=_[_0x9afd('0x3')](_0x220444,_0x9afd('0x4'))?'or':'and';var _0x53f22e=_0x220444[_0x9afd('0x5')]('[$and]','')[_0x9afd('0x5')](_0x9afd('0x4'),'')['split']('||');for(var _0x28750e=0x0;_0x28750e<_0x53f22e[_0x9afd('0x6')];_0x28750e++){var _0x121ab4=_0x53f22e[_0x28750e][_0x9afd('0x7')](':=');var _0x16e7dc=_0x121ab4[0x0];var _0x59581d=_0x121ab4['slice'](0x1);_0x59581d['forEach'](function(_0x139979){var _0x43b2aa=_0x139979[_0x9afd('0x7')]('[')[_0x9afd('0x8')]();var _0x226e98=_0x139979[_0x9afd('0x9')](/\[(.*?)\]/g);_0x226e98[_0x9afd('0xa')](function(_0x21fd87){var _0x3b55af=_0x21fd87['split']('[')[_0x9afd('0xb')](function(_0x5b7005){return _0x5b7005['indexOf'](']')>-0x1;})[_0x9afd('0xc')](function(_0x3176e1){return _0x3176e1[_0x9afd('0x7')](']')[0x0];})[0x0];_0xf5769f[_0x9afd('0xd')][_0x9afd('0xe')]({'field':_0x16e7dc,'operator':_0x43b2aa,'value':_0x3b55af});});});}return _0xf5769f;};exports[_0x9afd('0xf')]=function(_0x11368a,_0x5bdf40,_0x2b88ca){var _0x38c5f4={};if(_0x5bdf40==='DATE'){if(_0x2b88ca[_0x9afd('0x10')]==='$eq'){_0x2b88ca[_0x9afd('0x10')]=_0x9afd('0x11');_0x2b88ca[_0x9afd('0x12')]+=','+_0x2b88ca[_0x9afd('0x12')];}else if(_[_0x9afd('0x13')]([_0x9afd('0x14'),_0x9afd('0x15')],_0x2b88ca['operator'])){_0x2b88ca[_0x9afd('0x12')]=moment(_0x2b88ca['value'])[_0x9afd('0x16')](0x1,_0x9afd('0x17'))['format'](_0x9afd('0x18'));}}if(_0x2b88ca[_0x9afd('0x19')]){_0x5bdf40=_0x2b88ca[_0x9afd('0x19')];_0x38c5f4[_0x9afd('0x1a')]=_0x9afd('0x1b')+_0x11368a+'.'+_0x2b88ca[_0x9afd('0x1c')]+'\x20AS\x20'+_0x2b88ca[_0x9afd('0x19')]+')\x20'+parseOperator(_0x2b88ca[_0x9afd('0x10')]);}else{_0x38c5f4[_0x9afd('0x1a')]=_0x11368a+'.'+_0x2b88ca[_0x9afd('0x1c')]+'\x20'+parseOperator(_0x2b88ca[_0x9afd('0x10')]);}if(_[_0x9afd('0x13')](['$ne',_0x9afd('0x1d')],_0x2b88ca['operator']))_0x38c5f4['text']='('+_0x38c5f4[_0x9afd('0x1a')]+_0x9afd('0x1e')+_0x11368a+'.'+_0x2b88ca[_0x9afd('0x1c')]+'\x20IS\x20NULL)';_0x38c5f4[_0x9afd('0x12')]=parseValue(_0x5bdf40,_0x2b88ca['operator'],_0x2b88ca[_0x9afd('0x12')]);return _0x38c5f4;};function parseOperator(_0x18823f){var _0x4cfbfe;switch(_0x18823f){case _0x9afd('0x1f'):_0x4cfbfe=_0x9afd('0x20');break;case _0x9afd('0x1d'):_0x4cfbfe='NOT\x20IN\x20?';break;case _0x9afd('0x21'):_0x4cfbfe=_0x9afd('0x22');break;case _0x9afd('0x23'):_0x4cfbfe=_0x9afd('0x24');break;case _0x9afd('0x25'):case _0x9afd('0x26'):case _0x9afd('0x27'):_0x4cfbfe=_0x9afd('0x28');break;case _0x9afd('0x29'):_0x4cfbfe=_0x9afd('0x2a');break;case _0x9afd('0x14'):_0x4cfbfe=_0x9afd('0x2b');break;case _0x9afd('0x15'):_0x4cfbfe='<=\x20?';break;case _0x9afd('0x2c'):_0x4cfbfe='>=\x20?';break;case _0x9afd('0x11'):_0x4cfbfe='BETWEEN\x20?\x20AND\x20?';break;}return _0x4cfbfe;}function parseValue(_0x30ce52,_0x4177ad,_0x91017b){var _0x317cd1={'start':undefined,'end':undefined};switch(_0x4177ad){case _0x9afd('0x1f'):case _0x9afd('0x1d'):_0x317cd1[_0x9afd('0x2d')]=_0x91017b['split'](',');break;case _0x9afd('0x25'):_0x317cd1[_0x9afd('0x2d')]='%'+_0x91017b+'%';break;case _0x9afd('0x26'):_0x317cd1['start']=_0x91017b+'%';break;case'$endsWith':_0x317cd1[_0x9afd('0x2d')]='%'+_0x91017b;break;case _0x9afd('0x11'):var _0x2dfd3d=_0x91017b[_0x9afd('0x7')](',');var _0x91017b=_0x2dfd3d[_0x9afd('0x8')]();var _0x973e74=_0x2dfd3d[_0x9afd('0x2e')]();if(_0x30ce52===_0x9afd('0x2f')){_0x91017b=moment(_0x91017b)['utcOffset'](0x0,!![])[_0x9afd('0x30')]();_0x973e74=moment(_0x973e74)['utcOffset'](0x0,!![])['add'](0x17,_0x9afd('0x31'))[_0x9afd('0x16')](0x3b,_0x9afd('0x32'))['add'](0x3b,_0x9afd('0x33'))[_0x9afd('0x30')]();}_0x317cd1={'start':_0x91017b,'end':_0x973e74};break;default:_0x317cd1[_0x9afd('0x2d')]=_0x91017b;break;}return _0x317cd1;} \ No newline at end of file +var _0xb2f8=['text','field','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','start','pop','utcOffset','format','add','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','days','YYYY-MM-DD'];(function(_0x5b0579,_0x2c40ca){var _0x3b1a9b=function(_0x4064f1){while(--_0x4064f1){_0x5b0579['push'](_0x5b0579['shift']());}};_0x3b1a9b(++_0x2c40ca);}(_0xb2f8,0x111));var _0x8b2f=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0xb2f8[_0xf26d40];return _0x50b68c;};'use strict';var _=require(_0x8b2f('0x0'));var moment=require(_0x8b2f('0x1'));exports[_0x8b2f('0x2')]=function(_0x1a2ee2){var _0x21e7aa={'conditions':[]};_0x21e7aa[_0x8b2f('0x3')]=_[_0x8b2f('0x4')](_0x1a2ee2,_0x8b2f('0x5'))?'or':'and';var _0x1da53e=_0x1a2ee2['replace']('[$and]','')[_0x8b2f('0x6')](_0x8b2f('0x5'),'')[_0x8b2f('0x7')]('||');for(var _0xc06a19=0x0;_0xc06a19<_0x1da53e[_0x8b2f('0x8')];_0xc06a19++){var _0x27a91a=_0x1da53e[_0xc06a19][_0x8b2f('0x7')](':=');var _0x1a20a6=_0x27a91a[0x0];var _0x44e7d6=_0x27a91a[_0x8b2f('0x9')](0x1);_0x44e7d6[_0x8b2f('0xa')](function(_0x47c7e2){var _0x15b44d=_0x47c7e2['split']('[')[_0x8b2f('0xb')]();var _0x40cbdf=_0x47c7e2[_0x8b2f('0xc')](/\[(.*?)\]/g);_0x40cbdf[_0x8b2f('0xa')](function(_0x515f3c){var _0x379cc0=_0x515f3c[_0x8b2f('0x7')]('[')[_0x8b2f('0xd')](function(_0x2d4adf){return _0x2d4adf[_0x8b2f('0xe')](']')>-0x1;})[_0x8b2f('0xf')](function(_0x4ed787){return _0x4ed787[_0x8b2f('0x7')](']')[0x0];})[0x0];_0x21e7aa[_0x8b2f('0x10')]['push']({'field':_0x1a20a6,'operator':_0x15b44d,'value':_0x379cc0});});});}return _0x21e7aa;};exports[_0x8b2f('0x11')]=function(_0x2a91ed,_0x1fcffc,_0x5b916b){var _0x45f2e0={};if(_0x1fcffc==='DATE'){if(_0x5b916b[_0x8b2f('0x12')]===_0x8b2f('0x13')){_0x5b916b['operator']=_0x8b2f('0x14');_0x5b916b[_0x8b2f('0x15')]+=','+_0x5b916b[_0x8b2f('0x15')];}else if(_[_0x8b2f('0x16')]([_0x8b2f('0x17'),_0x8b2f('0x18')],_0x5b916b[_0x8b2f('0x12')])){_0x5b916b['value']=moment(_0x5b916b['value'])['add'](0x1,_0x8b2f('0x19'))['format'](_0x8b2f('0x1a'));}}if(_0x5b916b['castTo']){_0x1fcffc=_0x5b916b['castTo'];_0x45f2e0[_0x8b2f('0x1b')]='CAST('+_0x2a91ed+'.'+_0x5b916b['field']+'\x20AS\x20'+_0x5b916b['castTo']+')\x20'+parseOperator(_0x5b916b[_0x8b2f('0x12')]);}else{_0x45f2e0[_0x8b2f('0x1b')]=_0x2a91ed+'.'+_0x5b916b[_0x8b2f('0x1c')]+'\x20'+parseOperator(_0x5b916b['operator']);}if(_[_0x8b2f('0x16')](['$ne',_0x8b2f('0x1d')],_0x5b916b[_0x8b2f('0x12')]))_0x45f2e0['text']='('+_0x45f2e0[_0x8b2f('0x1b')]+_0x8b2f('0x1e')+_0x2a91ed+'.'+_0x5b916b[_0x8b2f('0x1c')]+_0x8b2f('0x1f');_0x45f2e0[_0x8b2f('0x15')]=parseValue(_0x1fcffc,_0x5b916b['operator'],_0x5b916b[_0x8b2f('0x15')]);return _0x45f2e0;};function parseOperator(_0x656bb5){var _0x2673d0;switch(_0x656bb5){case'$in':_0x2673d0='IN\x20?';break;case _0x8b2f('0x1d'):_0x2673d0=_0x8b2f('0x20');break;case _0x8b2f('0x13'):_0x2673d0='=\x20?';break;case _0x8b2f('0x21'):_0x2673d0=_0x8b2f('0x22');break;case _0x8b2f('0x23'):case _0x8b2f('0x24'):case _0x8b2f('0x25'):_0x2673d0='LIKE\x20?';break;case _0x8b2f('0x26'):_0x2673d0=_0x8b2f('0x27');break;case'$gt':_0x2673d0=_0x8b2f('0x28');break;case _0x8b2f('0x18'):_0x2673d0=_0x8b2f('0x29');break;case'$gte':_0x2673d0='>=\x20?';break;case'$between':_0x2673d0='BETWEEN\x20?\x20AND\x20?';break;}return _0x2673d0;}function parseValue(_0x13f429,_0x26c584,_0x3cdf0b){var _0x20d5ae={'start':undefined,'end':undefined};switch(_0x26c584){case'$in':case _0x8b2f('0x1d'):_0x20d5ae[_0x8b2f('0x2a')]=_0x3cdf0b['split'](',');break;case _0x8b2f('0x23'):_0x20d5ae[_0x8b2f('0x2a')]='%'+_0x3cdf0b+'%';break;case'$startsWith':_0x20d5ae[_0x8b2f('0x2a')]=_0x3cdf0b+'%';break;case _0x8b2f('0x25'):_0x20d5ae[_0x8b2f('0x2a')]='%'+_0x3cdf0b;break;case'$between':var _0x177196=_0x3cdf0b[_0x8b2f('0x7')](',');var _0x3cdf0b=_0x177196['shift']();var _0x2f2d60=_0x177196[_0x8b2f('0x2b')]();if(_0x13f429==='DATE'){_0x3cdf0b=moment(_0x3cdf0b)[_0x8b2f('0x2c')](0x0,!![])[_0x8b2f('0x2d')]();_0x2f2d60=moment(_0x2f2d60)[_0x8b2f('0x2c')](0x0,!![])[_0x8b2f('0x2e')](0x17,_0x8b2f('0x2f'))[_0x8b2f('0x2e')](0x3b,_0x8b2f('0x30'))[_0x8b2f('0x2e')](0x3b,_0x8b2f('0x31'))[_0x8b2f('0x2d')]();}_0x20d5ae={'start':_0x3cdf0b,'end':_0x2f2d60};break;default:_0x20d5ae[_0x8b2f('0x2a')]=_0x3cdf0b;break;}return _0x20d5ae;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index cb40018..fbaf276 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 _0xee14=['isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','push','join','getOptions','query','$id','model','intersection','attributes','nolimit','order','pick','filter','object','columns','where','lower','merge','options','moment','parse','keys','includes','fields','filters'];(function(_0x339fc0,_0x3ba917){var _0x1ff3c6=function(_0x20cfaa){while(--_0x20cfaa){_0x339fc0['push'](_0x339fc0['shift']());}};_0x1ff3c6(++_0x3ba917);}(_0xee14,0x13a));var _0x4ee1=function(_0x4e140b,_0x3540a2){_0x4e140b=_0x4e140b-0x0;var _0x26a829=_0xee14[_0x4e140b];return _0x26a829;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x4ee1('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x674696){var _0x34e49d=['ne'];try{var _0x1fa407=JSON[_0x4ee1('0x1')](_0x674696);var _0x236ccd=Object[_0x4ee1('0x2')](_0x1fa407)[0x0];return _0x34e49d[_0x4ee1('0x3')](_0x236ccd);}catch(_0x3ccbc6){return![];}}function getOperatorValue(_0x4bc729){var _0xba6d36=JSON['parse'](_0x4bc729);var _0x327c18=Object[_0x4ee1('0x2')](_0xba6d36)[0x0];var _0x187656=_0xba6d36[_0x327c18];return{['$'+_0x327c18]:_0x187656};}exports[_0x4ee1('0x4')]=function(_0xdfe9c1){var _0x1fd8c8=null;if(_0xdfe9c1){_0x1fd8c8=_0xdfe9c1['split'](',');}return _0x1fd8c8;};exports[_0x4ee1('0x5')]=function(_0x38be25,_0x4e88e8){var _0x3fa61b={};if(!_[_0x4ee1('0x6')](_0x38be25)){_[_0x4ee1('0x7')](_0x38be25,function(_0x191da7,_0x5cbcb0){try{if(_0x4e88e8){var _0x1b3737=_[_0x4ee1('0x8')](_0x4e88e8,{'name':_0x5cbcb0})||{};if(hasSequelizeOperator(_0x191da7)){_0x3fa61b[_0x5cbcb0]=getOperatorValue(_0x191da7);}else if(_0x1b3737[_0x4ee1('0x9')]===_0x4ee1('0xa')&&_[_0x4ee1('0xb')](_0x191da7)){var _0x174427=JSON['parse'](_0x191da7);var _0x390aab={'$gte':moment(moment(_0x174427[_0x4ee1('0xc')])[_0x4ee1('0xd')](_0x4ee1('0xe')))[_0x4ee1('0xf')]()[_0x4ee1('0xd')](),'$lte':moment(moment(_0x174427[_0x4ee1('0x10')])[_0x4ee1('0xd')](_0x4ee1('0xe')))['utc']()[_0x4ee1('0x11')](0x1,'s')[_0x4ee1('0xd')]()};_0x3fa61b[_0x5cbcb0]=_0x390aab;}else if(_0x1b3737[_0x4ee1('0x12')]===_0x4ee1('0x13')){_0x3fa61b[_0x5cbcb0]=_0x191da7;}else{_0x3fa61b[_0x5cbcb0]=_[_0x4ee1('0x14')](_0x191da7)?_0x191da7:JSON[_0x4ee1('0x1')](_0x191da7);}}else{_0x3fa61b[_0x5cbcb0]=_[_0x4ee1('0x14')](_0x191da7)?_0x191da7:JSON[_0x4ee1('0x1')](_0x191da7);}}catch(_0x360056){_0x3fa61b[_0x5cbcb0]=_0x191da7[_0x4ee1('0x15')](',');}});}return _0x3fa61b;};exports[_0x4ee1('0x16')]=function(_0x5d76de){_0x5d76de=parseInt(_0x5d76de,0xa);if(!_0x5d76de||_0x5d76de<0x0){_0x5d76de=LIMIT_VALUE;}return _0x5d76de;};exports[_0x4ee1('0x17')]=function(_0x3db827){_0x3db827=parseInt(_0x3db827,0xa);if(!_0x3db827||_0x3db827<0x0){_0x3db827=0x0;}return _0x3db827;};exports[_0x4ee1('0x18')]=function(_0x1034fb){var _0x43f9a2,_0x383ab0=null;if(_0x1034fb){_0x43f9a2=_0x1034fb['split'](',');_0x383ab0=_[_0x4ee1('0x19')](_0x43f9a2,function(_0x333e96){if(_0x333e96[_0x4ee1('0x1a')]('-')===0x0){return[_0x333e96===_0x4ee1('0x1b')?sequelize[_0x4ee1('0x1c')](sequelize[_0x4ee1('0x1d')](_0x4ee1('0x1b')),_0x4ee1('0x1e')):_0x333e96[_0x4ee1('0x1f')](0x1),_0x4ee1('0x20')];}else{return[_0x333e96==='priority'?sequelize['cast'](sequelize[_0x4ee1('0x1d')](_0x4ee1('0x1b')),_0x4ee1('0x1e')):_0x333e96,_0x4ee1('0x21')];}});}return _0x383ab0;};exports[_0x4ee1('0x22')]=function(_0x28efdc,_0x57d45d){if(_['isEmpty'](_0x28efdc)){return _0x28efdc;}if(_[_0x4ee1('0x14')](_0x28efdc)){for(var _0x28b7e1=0x0;_0x28b7e1<_0x28efdc['length'];_0x28b7e1+=0x1){_0x28efdc[_0x28b7e1]=this[_0x4ee1('0x22')](_0x28efdc[_0x28b7e1],_0x57d45d);}return _0x28efdc;}if(!_[_0x4ee1('0x23')](_0x28efdc)){return _0x28efdc;}if(_[_0x4ee1('0x24')](_0x57d45d)){_0x57d45d=[_0x57d45d];}if(!_[_0x4ee1('0x14')](_0x57d45d)){return _0x28efdc;}for(var _0x2d699c=0x0;_0x2d699c<_0x57d45d[_0x4ee1('0x25')];_0x2d699c+=0x1){_[_0x4ee1('0x26')](_0x28efdc,_0x57d45d[_0x2d699c]);}for(var _0x56c4d3 in _0x28efdc){if(_0x28efdc[_0x4ee1('0x27')](_0x56c4d3)){_0x28efdc[_0x56c4d3]=this['omit'](_0x28efdc[_0x56c4d3],_0x57d45d);}}return _0x28efdc;};exports[_0x4ee1('0x28')]=function(_0x4ec408){return _0x4ec408[_0x4ee1('0x29')](RegExp(_0x4ee1('0x2a')))?!![]:![];};exports[_0x4ee1('0x2b')]=function(_0x13944c){return _0x13944c[_0x4ee1('0x29')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1f7483){var _0x5b3792=[];_0x1f7483[_0x4ee1('0x15')](/[ ,]+/)[_0x4ee1('0x2c')](function(_0x33fd38){_0x33fd38=_0x33fd38[_0x4ee1('0x2d')](/([^:]")"+/g,'$1');_0x33fd38='+'+_0x33fd38+'*';var _0xac31e9=/[ `!@#$%^&*()_\-?~]/;if(_0x33fd38['match'](_0xac31e9))_0x33fd38='\x22'+_0x33fd38+'\x22';_0x5b3792[_0x4ee1('0x2e')](_0x33fd38);});return _0x5b3792[_0x4ee1('0x2f')]('\x20');};exports[_0x4ee1('0x30')]=function(_0x2e37a3,_0x79f87c,_0x393990){var _0x5dbb15={},_0x4aa2b8={};if(_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x32')]){_0x79f87c[_0x4ee1('0x31')]['id']=_0x79f87c['query'][_0x4ee1('0x32')];delete _0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x32')];}_0x5dbb15[_0x4ee1('0x33')]=_[_0x4ee1('0x19')](_0x2e37a3,_0x4ee1('0x12'));_0x5dbb15[_0x4ee1('0x31')]=_[_0x4ee1('0x2')](_0x79f87c[_0x4ee1('0x31')]);_0x5dbb15[_0x4ee1('0x5')]=_[_0x4ee1('0x34')](_0x5dbb15[_0x4ee1('0x33')],_0x5dbb15[_0x4ee1('0x31')]);_0x4aa2b8['attributes']=_[_0x4ee1('0x34')](_0x5dbb15[_0x4ee1('0x33')],this[_0x4ee1('0x4')](_0x79f87c['query']['fields']));_0x4aa2b8[_0x4ee1('0x35')]=_0x4aa2b8[_0x4ee1('0x35')][_0x4ee1('0x25')]?_0x4aa2b8[_0x4ee1('0x35')]:_0x5dbb15['model'];if(!_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x27')](_0x4ee1('0x36'))){_0x4aa2b8[_0x4ee1('0x16')]=this[_0x4ee1('0x16')](_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x16')]);_0x4aa2b8[_0x4ee1('0x17')]=this['offset'](_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x17')]);}_0x4aa2b8[_0x4ee1('0x37')]=this[_0x4ee1('0x18')](_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x18')]);_0x4aa2b8['where']=this[_0x4ee1('0x5')](_[_0x4ee1('0x38')](_0x79f87c[_0x4ee1('0x31')],_0x5dbb15[_0x4ee1('0x5')]),_0x2e37a3);if(_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x39')]){var _0x3f0d8b=_0x2e37a3;var _0xaac883=_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x39')];if(typeof _0xaac883===_0x4ee1('0x3a')){_0x3f0d8b=_[_0x4ee1('0x39')](_0x2e37a3,function(_0x34fc7a){return _['includes'](_0xaac883[_0x4ee1('0x3b')],_0x34fc7a[_0x4ee1('0x12')]);});_0xaac883=_0xaac883['value'];}_0x4aa2b8[_0x4ee1('0x3c')]=_['merge'](_0x4aa2b8[_0x4ee1('0x3c')],{'$or':_['map'](_0x3f0d8b,function(_0x14c333){if(_0x14c333[_0x4ee1('0x9')]!=='VIRTUAL'){if(_0x393990){return sequelize[_0x4ee1('0x3c')](sequelize['fn'](_0x4ee1('0x3d'),sequelize[_0x4ee1('0x1d')](_0x14c333[_0x4ee1('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x79f87c[_0x4ee1('0x31')][_0x4ee1('0x39')]+'%')});}else{var _0x1a4157={};_0x1a4157[_0x14c333['name']]={'$like':'%'+_0x79f87c['query'][_0x4ee1('0x39')]+'%'};return _0x1a4157;}}})});}_0x4aa2b8=_[_0x4ee1('0x3e')]({},_0x4aa2b8,_0x79f87c[_0x4ee1('0x3f')]);return _0x4aa2b8;}; \ No newline at end of file +var _0x5075=['subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','replace','push','getOptions','query','$id','model','attributes','intersection','length','hasOwnProperty','nolimit','order','where','pick','filter','object','columns','value','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','filters','forOwn','find','DATE','isPlainObject','$gte','YYYY-MM-DD','utc','format','$lte'];(function(_0x2f9e82,_0x452f61){var _0x36ad99=function(_0x511c67){while(--_0x511c67){_0x2f9e82['push'](_0x2f9e82['shift']());}};_0x36ad99(++_0x452f61);}(_0x5075,0x73));var _0x5507=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x5075[_0x2c0be1];return _0x3d4bd2;};'use strict';var _=require(_0x5507('0x0'));var sequelize=require(_0x5507('0x1'));var moment=require(_0x5507('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1a552a){var _0x3ec62f=['ne'];try{var _0x2b444e=JSON[_0x5507('0x3')](_0x1a552a);var _0x518ca7=Object[_0x5507('0x4')](_0x2b444e)[0x0];return _0x3ec62f[_0x5507('0x5')](_0x518ca7);}catch(_0x8fb8a3){return![];}}function getOperatorValue(_0x54267f){var _0x5b6d7f=JSON[_0x5507('0x3')](_0x54267f);var _0x773559=Object['keys'](_0x5b6d7f)[0x0];var _0x42c232=_0x5b6d7f[_0x773559];return{['$'+_0x773559]:_0x42c232};}exports[_0x5507('0x6')]=function(_0xbf4b50){var _0x504e05=null;if(_0xbf4b50){_0x504e05=_0xbf4b50['split'](',');}return _0x504e05;};exports[_0x5507('0x7')]=function(_0x441bdc,_0xbbb0fc){var _0x36c9eb={};if(!_['isEmpty'](_0x441bdc)){_[_0x5507('0x8')](_0x441bdc,function(_0x1a6792,_0x55520e){try{if(_0xbbb0fc){var _0x18601c=_[_0x5507('0x9')](_0xbbb0fc,{'name':_0x55520e})||{};if(hasSequelizeOperator(_0x1a6792)){_0x36c9eb[_0x55520e]=getOperatorValue(_0x1a6792);}else if(_0x18601c['type']===_0x5507('0xa')&&_[_0x5507('0xb')](_0x1a6792)){var _0x32c872=JSON[_0x5507('0x3')](_0x1a6792);var _0x13b60a={'$gte':moment(moment(_0x32c872[_0x5507('0xc')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0xf')](),'$lte':moment(moment(_0x32c872[_0x5507('0x10')])['format'](_0x5507('0xd')))[_0x5507('0xe')]()[_0x5507('0x11')](0x1,'s')[_0x5507('0xf')]()};_0x36c9eb[_0x55520e]=_0x13b60a;}else if(_0x18601c[_0x5507('0x12')]===_0x5507('0x13')){_0x36c9eb[_0x55520e]=_0x1a6792;}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}else{_0x36c9eb[_0x55520e]=_[_0x5507('0x14')](_0x1a6792)?_0x1a6792:JSON[_0x5507('0x3')](_0x1a6792);}}catch(_0x233b6a){_0x36c9eb[_0x55520e]=_0x1a6792[_0x5507('0x15')](',');}});}return _0x36c9eb;};exports[_0x5507('0x16')]=function(_0x5ad6d7){_0x5ad6d7=parseInt(_0x5ad6d7,0xa);if(!_0x5ad6d7||_0x5ad6d7<0x0){_0x5ad6d7=LIMIT_VALUE;}return _0x5ad6d7;};exports[_0x5507('0x17')]=function(_0x276a81){_0x276a81=parseInt(_0x276a81,0xa);if(!_0x276a81||_0x276a81<0x0){_0x276a81=0x0;}return _0x276a81;};exports[_0x5507('0x18')]=function(_0x193eda){var _0x54f473,_0x1dc53e=null;if(_0x193eda){_0x54f473=_0x193eda[_0x5507('0x15')](',');_0x1dc53e=_[_0x5507('0x19')](_0x54f473,function(_0x3ca1f7){if(_0x3ca1f7[_0x5507('0x1a')]('-')===0x0){return[_0x3ca1f7===_0x5507('0x1b')?sequelize['cast'](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7[_0x5507('0x1e')](0x1),_0x5507('0x1f')];}else{return[_0x3ca1f7===_0x5507('0x1b')?sequelize[_0x5507('0x20')](sequelize[_0x5507('0x1c')](_0x5507('0x1b')),_0x5507('0x1d')):_0x3ca1f7,_0x5507('0x21')];}});}return _0x1dc53e;};exports[_0x5507('0x22')]=function(_0x164ac7,_0x2ee6ed){if(_[_0x5507('0x23')](_0x164ac7)){return _0x164ac7;}if(_['isArray'](_0x164ac7)){for(var _0x4e8906=0x0;_0x4e8906<_0x164ac7['length'];_0x4e8906+=0x1){_0x164ac7[_0x4e8906]=this[_0x5507('0x22')](_0x164ac7[_0x4e8906],_0x2ee6ed);}return _0x164ac7;}if(!_['isObject'](_0x164ac7)){return _0x164ac7;}if(_[_0x5507('0x24')](_0x2ee6ed)){_0x2ee6ed=[_0x2ee6ed];}if(!_[_0x5507('0x14')](_0x2ee6ed)){return _0x164ac7;}for(var _0x4beb0a=0x0;_0x4beb0a<_0x2ee6ed['length'];_0x4beb0a+=0x1){_[_0x5507('0x25')](_0x164ac7,_0x2ee6ed[_0x4beb0a]);}for(var _0x1a18d0 in _0x164ac7){if(_0x164ac7['hasOwnProperty'](_0x1a18d0)){_0x164ac7[_0x1a18d0]=this[_0x5507('0x22')](_0x164ac7[_0x1a18d0],_0x2ee6ed);}}return _0x164ac7;};exports[_0x5507('0x26')]=function(_0x85d383){return _0x85d383[_0x5507('0x27')](RegExp(_0x5507('0x28')))?!![]:![];};exports[_0x5507('0x29')]=function(_0x55e889){return _0x55e889[_0x5507('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x5507('0x2a')]=function(_0x106b11){var _0x38f0f5=[];_0x106b11[_0x5507('0x15')](/[ ,]+/)['forEach'](function(_0x51e692){_0x51e692=_0x51e692[_0x5507('0x2b')](/([^:]")"+/g,'$1');_0x51e692='+'+_0x51e692+'*';var _0x37c364=/[ `!@#$%^&*()_\-?~]/;if(_0x51e692[_0x5507('0x27')](_0x37c364))_0x51e692='\x22'+_0x51e692+'\x22';_0x38f0f5[_0x5507('0x2c')](_0x51e692);});return _0x38f0f5['join']('\x20');};exports[_0x5507('0x2d')]=function(_0x13b6e5,_0xab91bc,_0x3fe39a){var _0x3cf04d={},_0x2074a={};if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')]){_0xab91bc['query']['id']=_0xab91bc[_0x5507('0x2e')][_0x5507('0x2f')];delete _0xab91bc[_0x5507('0x2e')]['$id'];}_0x3cf04d['model']=_[_0x5507('0x19')](_0x13b6e5,_0x5507('0x12'));_0x3cf04d[_0x5507('0x2e')]=_[_0x5507('0x4')](_0xab91bc[_0x5507('0x2e')]);_0x3cf04d['filters']=_['intersection'](_0x3cf04d[_0x5507('0x30')],_0x3cf04d[_0x5507('0x2e')]);_0x2074a[_0x5507('0x31')]=_[_0x5507('0x32')](_0x3cf04d['model'],this['fields'](_0xab91bc[_0x5507('0x2e')]['fields']));_0x2074a[_0x5507('0x31')]=_0x2074a[_0x5507('0x31')][_0x5507('0x33')]?_0x2074a[_0x5507('0x31')]:_0x3cf04d[_0x5507('0x30')];if(!_0xab91bc[_0x5507('0x2e')][_0x5507('0x34')](_0x5507('0x35'))){_0x2074a[_0x5507('0x16')]=this[_0x5507('0x16')](_0xab91bc['query']['limit']);_0x2074a['offset']=this['offset'](_0xab91bc[_0x5507('0x2e')][_0x5507('0x17')]);}_0x2074a[_0x5507('0x36')]=this[_0x5507('0x18')](_0xab91bc[_0x5507('0x2e')][_0x5507('0x18')]);_0x2074a[_0x5507('0x37')]=this[_0x5507('0x7')](_[_0x5507('0x38')](_0xab91bc[_0x5507('0x2e')],_0x3cf04d[_0x5507('0x7')]),_0x13b6e5);if(_0xab91bc[_0x5507('0x2e')][_0x5507('0x39')]){var _0x4418de=_0x13b6e5;var _0x4fe79b=_0xab91bc['query']['filter'];if(typeof _0x4fe79b===_0x5507('0x3a')){_0x4418de=_[_0x5507('0x39')](_0x13b6e5,function(_0x417022){return _[_0x5507('0x5')](_0x4fe79b[_0x5507('0x3b')],_0x417022[_0x5507('0x12')]);});_0x4fe79b=_0x4fe79b[_0x5507('0x3c')];}_0x2074a[_0x5507('0x37')]=_[_0x5507('0x3d')](_0x2074a[_0x5507('0x37')],{'$or':_[_0x5507('0x19')](_0x4418de,function(_0x192a00){if(_0x192a00[_0x5507('0x3e')]!==_0x5507('0x3f')){if(_0x3fe39a){return sequelize[_0x5507('0x37')](sequelize['fn'](_0x5507('0x40'),sequelize[_0x5507('0x1c')](_0x192a00[_0x5507('0x12')])),{'$like':sequelize['fn'](_0x5507('0x40'),'%'+_0xab91bc['query'][_0x5507('0x39')]+'%')});}else{var _0x113f74={};_0x113f74[_0x192a00['name']]={'$like':'%'+_0xab91bc['query'][_0x5507('0x39')]+'%'};return _0x113f74;}}})});}_0x2074a=_[_0x5507('0x3d')]({},_0x2074a,_0xab91bc[_0x5507('0x41')]);return _0x2074a;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index e918711..16a2343 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x143a=['public','development','test','client','json\x20replacer','toISOString','use','static','views','/server/views','engine','html','view\x20engine','initialize','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','moment','./environment','default','get','env','production','set','appPath','join','root'];(function(_0x2ba00c,_0x10f136){var _0x4a4853=function(_0x42add8){while(--_0x42add8){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x4a4853(++_0x10f136);}(_0x143a,0x125));var _0xa143=function(_0x46b149,_0x5e013f){_0x46b149=_0x46b149-0x0;var _0x50b54c=_0x143a[_0x46b149];return _0x50b54c;};'use strict';var express=require('express');var favicon=require(_0xa143('0x0'));var bodyParser=require(_0xa143('0x1'));var methodOverride=require(_0xa143('0x2'));var cookieParser=require(_0xa143('0x3'));var errorHandler=require(_0xa143('0x4'));var path=require(_0xa143('0x5'));var passport=require(_0xa143('0x6'));var cors=require('cors');var moment=require(_0xa143('0x7'));var config=require(_0xa143('0x8'));var db=require('../mysqldb')['db'];exports[_0xa143('0x9')]=function(_0x49c253){var _0x2a7c2c=_0x49c253[_0xa143('0xa')](_0xa143('0xb'));if(_0x2a7c2c===_0xa143('0xc')){_0x49c253[_0xa143('0xd')](_0xa143('0xe'),path[_0xa143('0xf')](config[_0xa143('0x10')],_0xa143('0x11')));}if(_0x2a7c2c===_0xa143('0x12')||_0x2a7c2c===_0xa143('0x13')){_0x49c253[_0xa143('0xd')]('appPath',path[_0xa143('0xf')](config['root'],_0xa143('0x14')));_0x49c253['use'](errorHandler());}_0x49c253[_0xa143('0xd')](_0xa143('0x15'),function(_0x545e82,_0x1207aa){if(this[_0x545e82]instanceof Date){_0x1207aa=this[_0x545e82][_0xa143('0x16')]()['split']('.')[0x0]+'Z';}return _0x1207aa;});_0x49c253[_0xa143('0x17')](express[_0xa143('0x18')](_0x49c253[_0xa143('0xa')](_0xa143('0xe'))));_0x49c253['set'](_0xa143('0x19'),config[_0xa143('0x10')]+_0xa143('0x1a'));_0x49c253[_0xa143('0x1b')](_0xa143('0x1c'),require('ejs')['renderFile']);_0x49c253[_0xa143('0xd')](_0xa143('0x1d'),_0xa143('0x1c'));_0x49c253[_0xa143('0x17')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x49c253[_0xa143('0x17')](bodyParser['json']({'limit':'50mb'}));_0x49c253[_0xa143('0x17')](cors());_0x49c253[_0xa143('0x17')](methodOverride());_0x49c253[_0xa143('0x17')](cookieParser());_0x49c253[_0xa143('0x17')](passport[_0xa143('0x1e')]());}; \ No newline at end of file +var _0xf5d5=['view\x20engine','urlencoded','json','50mb','express','serve-favicon','body-parser','method-override','path','passport','./environment','../mysqldb','default','get','env','production','set','appPath','join','root','development','test','client','split','use','static','views','html','ejs','renderFile'];(function(_0x5d4f76,_0x81ce1c){var _0x9aeeb5=function(_0x122152){while(--_0x122152){_0x5d4f76['push'](_0x5d4f76['shift']());}};_0x9aeeb5(++_0x81ce1c);}(_0xf5d5,0x14e));var _0x5f5d=function(_0xac218e,_0x4a3a42){_0xac218e=_0xac218e-0x0;var _0x513b6d=_0xf5d5[_0xac218e];return _0x513b6d;};'use strict';var express=require(_0x5f5d('0x0'));var favicon=require(_0x5f5d('0x1'));var bodyParser=require(_0x5f5d('0x2'));var methodOverride=require(_0x5f5d('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0x5f5d('0x4'));var passport=require(_0x5f5d('0x5'));var cors=require('cors');var moment=require('moment');var config=require(_0x5f5d('0x6'));var db=require(_0x5f5d('0x7'))['db'];exports[_0x5f5d('0x8')]=function(_0x4b6344){var _0x5281d8=_0x4b6344[_0x5f5d('0x9')](_0x5f5d('0xa'));if(_0x5281d8===_0x5f5d('0xb')){_0x4b6344[_0x5f5d('0xc')](_0x5f5d('0xd'),path[_0x5f5d('0xe')](config[_0x5f5d('0xf')],'public'));}if(_0x5281d8===_0x5f5d('0x10')||_0x5281d8===_0x5f5d('0x11')){_0x4b6344[_0x5f5d('0xc')](_0x5f5d('0xd'),path[_0x5f5d('0xe')](config[_0x5f5d('0xf')],_0x5f5d('0x12')));_0x4b6344['use'](errorHandler());}_0x4b6344[_0x5f5d('0xc')]('json\x20replacer',function(_0x4f4656,_0x4a46c2){if(this[_0x4f4656]instanceof Date){_0x4a46c2=this[_0x4f4656]['toISOString']()[_0x5f5d('0x13')]('.')[0x0]+'Z';}return _0x4a46c2;});_0x4b6344[_0x5f5d('0x14')](express[_0x5f5d('0x15')](_0x4b6344[_0x5f5d('0x9')](_0x5f5d('0xd'))));_0x4b6344[_0x5f5d('0xc')](_0x5f5d('0x16'),config['root']+'/server/views');_0x4b6344['engine'](_0x5f5d('0x17'),require(_0x5f5d('0x18'))[_0x5f5d('0x19')]);_0x4b6344[_0x5f5d('0xc')](_0x5f5d('0x1a'),_0x5f5d('0x17'));_0x4b6344['use'](bodyParser[_0x5f5d('0x1b')]({'limit':'50mb','extended':!![]}));_0x4b6344[_0x5f5d('0x14')](bodyParser[_0x5f5d('0x1c')]({'limit':_0x5f5d('0x1d')}));_0x4b6344[_0x5f5d('0x14')](cors());_0x4b6344['use'](methodOverride());_0x4b6344[_0x5f5d('0x14')](cookieParser());_0x4b6344[_0x5f5d('0x14')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index dbb8b7b..7307b14 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 _0x60b2=['00:00:00:00:00:00','address','cpus','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','head','mac'];(function(_0x3f034e,_0xf1a7a){var _0x589189=function(_0x1a5c5c){while(--_0x1a5c5c){_0x3f034e['push'](_0x3f034e['shift']());}};_0x589189(++_0xf1a7a);}(_0x60b2,0xd9));var _0x260b=function(_0x373b3e,_0x347ac7){_0x373b3e=_0x373b3e-0x0;var _0xa4ce3=_0x60b2[_0x373b3e];return _0xa4ce3;};'use strict';var _=require(_0x260b('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x260b('0x1'));var exec=require(_0x260b('0x2'))[_0x260b('0x3')];var config=require('../environment');function getInterfaces(){var _0x1611dd=[];var _0x2eccf9=os[_0x260b('0x4')]();var _0xa77ed7=_[_0x260b('0x5')](_[_0x260b('0x6')](_0x2eccf9));for(var _0x5a5349=0x0;_0x5a5349<_0xa77ed7[_0x260b('0x7')];_0x5a5349++){var _0x5d245e=_0x2eccf9[_0xa77ed7[_0x5a5349]][_0x260b('0x8')](function(_0x4c4ca2){return _0x4c4ca2[_0x260b('0x9')]===_0x260b('0xa')&&_0x4c4ca2[_0x260b('0xb')]===![];});_0x1611dd=_0x1611dd['concat'](_0x5d245e);}return _0x1611dd;}function getFirstInterface(){var _0x2f051a=_[_0x260b('0xc')](getInterfaces());return{'macAddress':_0x2f051a&&_0x2f051a['mac']?_0x2f051a[_0x260b('0xd')]:_0x260b('0xe'),'ipAddress':_0x2f051a&&_0x2f051a[_0x260b('0xf')]?_0x2f051a[_0x260b('0xf')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5c9bdb=_[_0x260b('0x5')](os[_0x260b('0x10')]()['map'](function(_0x2a155c){return _0x2a155c['model'];}))['join'](':');return crypto[_0x260b('0x11')](_0x260b('0x12'))['update'](_0x5c9bdb)[_0x260b('0x13')](_0x260b('0x14'));}exports[_0x260b('0x15')]=function(){var _0x1c6c8c=os[_0x260b('0x16')]();var _0x1a20d7=/[0-9a-f-]{36}/;if(config[_0x260b('0x17')]&&_0x1a20d7[_0x260b('0x18')](config[_0x260b('0x17')])){return config['licenseToken'];}else if(_0x1c6c8c===_0x260b('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x260b('0x1a')})[_0x260b('0x1b')]('\x0d\x0a','');}else{var _0x5d5aee=getFirstInterface();var _0x422cf3=getCPUhash();var _0x13b2a7=_0x422cf3+'|'+os[_0x260b('0x1c')]()+'|'+_0x5d5aee[_0x260b('0x1d')]+'|'+_0x5d5aee[_0x260b('0x1e')];var _0x1c7b8b=crypto['createHash']('md5')[_0x260b('0x1f')](_0x13b2a7)[_0x260b('0x13')](_0x260b('0x14'));return _0x1c7b8b['substring'](0x0,0x8)+'-'+_0x1c7b8b[_0x260b('0x20')](0x8,0xc)+'-'+_0x1c7b8b[_0x260b('0x20')](0xc,0x10)+'-'+_0x1c7b8b[_0x260b('0x20')](0x10,0x14)+'-'+_0x1c7b8b[_0x260b('0x20')](0x14);}}; \ No newline at end of file +var _0x79ca=['utf8','replace','hostname','createHash','substring','lodash','crypto','bimedia-machine-uuid','networkInterfaces','keys','length','family','IPv4','internal','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','cpus','map','join','md5','update','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x113423,_0x40e3f5){var _0x502b2a=function(_0x467f93){while(--_0x467f93){_0x113423['push'](_0x113423['shift']());}};_0x502b2a(++_0x40e3f5);}(_0x79ca,0x1e5));var _0xa79c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79ca[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa79c('0x0'));var os=require('os');var crypto=require(_0xa79c('0x1'));var machine=require(_0xa79c('0x2'));var exec=require('child_process')['execSync'];var config=require('../environment');function getInterfaces(){var _0x654d83=[];var _0x483fa0=os[_0xa79c('0x3')]();var _0x1d1c40=_['orderBy'](_[_0xa79c('0x4')](_0x483fa0));for(var _0x4b6de3=0x0;_0x4b6de3<_0x1d1c40[_0xa79c('0x5')];_0x4b6de3++){var _0x38f712=_0x483fa0[_0x1d1c40[_0x4b6de3]]['filter'](function(_0x445ff7){return _0x445ff7[_0xa79c('0x6')]===_0xa79c('0x7')&&_0x445ff7[_0xa79c('0x8')]===![];});_0x654d83=_0x654d83['concat'](_0x38f712);}return _0x654d83;}function getFirstInterface(){var _0x483835=_[_0xa79c('0x9')](getInterfaces());return{'macAddress':_0x483835&&_0x483835[_0xa79c('0xa')]?_0x483835[_0xa79c('0xa')]:_0xa79c('0xb'),'ipAddress':_0x483835&&_0x483835[_0xa79c('0xc')]?_0x483835[_0xa79c('0xc')]:_0xa79c('0xd')};}exports[_0xa79c('0xe')]=getFirstInterface;function getCPUhash(){var _0x3df382=_[_0xa79c('0xf')](os[_0xa79c('0x10')]()[_0xa79c('0x11')](function(_0x1821f4){return _0x1821f4['model'];}))[_0xa79c('0x12')](':');return crypto['createHash'](_0xa79c('0x13'))[_0xa79c('0x14')](_0x3df382)['digest'](_0xa79c('0x15'));}exports['getUuid']=function(){var _0x40b532=os[_0xa79c('0x16')]();var _0x3a81a3=/[0-9a-f-]{36}/;if(config[_0xa79c('0x17')]&&_0x3a81a3[_0xa79c('0x18')](config[_0xa79c('0x17')])){return config[_0xa79c('0x17')];}else if(_0x40b532===_0xa79c('0x19')){return exec(_0xa79c('0x1a'),{'encoding':_0xa79c('0x1b')})[_0xa79c('0x1c')]('\x0d\x0a','');}else{var _0x306d4f=getFirstInterface();var _0x49dfae=getCPUhash();var _0x554859=_0x49dfae+'|'+os[_0xa79c('0x1d')]()+'|'+_0x306d4f['macAddress']+'|'+_0x306d4f['ipAddress'];var _0x38f326=crypto[_0xa79c('0x1e')]('md5')[_0xa79c('0x14')](_0x554859)['digest'](_0xa79c('0x15'));return _0x38f326[_0xa79c('0x1f')](0x0,0x8)+'-'+_0x38f326[_0xa79c('0x1f')](0x8,0xc)+'-'+_0x38f326[_0xa79c('0x1f')](0xc,0x10)+'-'+_0x38f326[_0xa79c('0x1f')](0x10,0x14)+'-'+_0x38f326[_0xa79c('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index ff18f3d..cda3c95 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 _0xef97=['data1','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','then','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','https://www.xcallymotion.com','format','exports','version','GET','catch','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xef97,0xd7));var _0x7ef9=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0xef97[_0x8cb2f9];return _0x164887;};'use strict';var util=require(_0x7ef9('0x0'));var moment=require(_0x7ef9('0x1'));var rp=require(_0x7ef9('0x2'));var BPromise=require(_0x7ef9('0x3'));var pkginfo=require(_0x7ef9('0x4'))(module,'version');var db=require(_0x7ef9('0x5'))['db'];var encryptor=require(_0x7ef9('0x6'));var hardware=require(_0x7ef9('0x7'));var logger=require('../logger')('license');var HOST=_0x7ef9('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x244e65){return new BPromise(function(_0x58d8da,_0xeec537){var _0x5b722d=util[_0x7ef9('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x244e65,module[_0x7ef9('0xa')][_0x7ef9('0xb')]);if(oldToken){_0x5b722d=util[_0x7ef9('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x244e65,module[_0x7ef9('0xa')][_0x7ef9('0xb')],oldToken);}var _0x3d6e3f={'uri':_0x5b722d,'method':_0x7ef9('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x3d6e3f)['then'](function(_0x327551){_0x58d8da(_0x327551);})[_0x7ef9('0xd')](function(_0x25c8aa){_0xeec537(_0x25c8aa);});});}function manageLicense(_0x426575,_0x11290d){var _0x1682ea=_0x11290d['get']({'plain':!![]});if(!isOldTokenSent&&_0x1682ea['data1']!==_0x426575&&!_0x1682ea['data2']){oldToken=_0x1682ea['data1'];}httpRequest(_0x426575)['then'](function(_0x82d58d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x82d58d[_0x7ef9('0xe')]){isOldTokenSent=![];if(!_0x1682ea['license']&&_0x1682ea[_0x7ef9('0xf')]!=_0x82d58d[_0x7ef9('0xf')]||_0x1682ea[_0x7ef9('0xf')]&&_0x1682ea[_0x7ef9('0x10')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x1682ea['license']&&!_0x1682ea[_0x7ef9('0x10')]&&_0x1682ea['license']!=_0x82d58d[_0x7ef9('0xf')]){logger[_0x7ef9('0x11')](_0x7ef9('0x12'));}if(_0x1682ea[_0x7ef9('0xf')]&&!_0x1682ea[_0x7ef9('0x10')]&&_0x1682ea['license']==_0x82d58d['license']){return _0x11290d;}return _0x11290d['update']({'data1':_0x426575,'data2':null,'license':_0x82d58d['license']});}else{if(_0x82d58d[_0x7ef9('0xf')]||_0x1682ea[_0x7ef9('0xf')]){if(!_0x1682ea[_0x7ef9('0x10')]){if(_0x1682ea[_0x7ef9('0x13')]==_0x426575){GRAY_PERIOD_REASON=_0x7ef9('0x14');logger[_0x7ef9('0x11')](_0x7ef9('0x15'));}else{GRAY_PERIOD_REASON='Changed';logger['info'](_0x7ef9('0x16'),_0x1682ea['data1'],_0x426575);}logger['info'](_0x7ef9('0x17'),GRAY_PERIOD_REASON[_0x7ef9('0x18')](),moment()[_0x7ef9('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x11290d[_0x7ef9('0x19')]({'data2':encryptor[_0x7ef9('0x1a')](moment()['format'](_0x7ef9('0x1b')))});}else{if(moment()[_0x7ef9('0x1c')](encryptor['decryptString'](_0x1682ea['data2']),_0x7ef9('0x1d'))>DAYS){logger[_0x7ef9('0x11')](_0x7ef9('0x1e'),moment()[_0x7ef9('0x9')](_0x7ef9('0x1b')));isOldTokenSent=![];return _0x11290d['update']({'data1':_0x426575,'data2':null,'license':null});}}}else{if(_0x1682ea[_0x7ef9('0x13')]!=_0x426575){logger[_0x7ef9('0x11')](_0x7ef9('0x16'),_0x1682ea[_0x7ef9('0x13')],_0x426575);return _0x11290d[_0x7ef9('0x19')]({'data1':_0x426575,'data2':null,'license':null});}}}return _0x11290d;})[_0x7ef9('0x1f')](function(_0x2ccdc9){_0x11290d=_0x2ccdc9;})['catch'](function(_0x2e98a3){logger[_0x7ef9('0x20')](_0x2e98a3[_0x7ef9('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x7ef9('0x22')](),_0x11290d);},TIME);});}function defaultLicense(){var _0xc4ee9c=hardware['getUuid']();if(_0xc4ee9c){return db[_0x7ef9('0x23')][_0x7ef9('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xc4ee9c}})[_0x7ef9('0x25')](function(_0xeb668e,_0x4ee32e){logger['info'](_0x7ef9('0x26'),_0xc4ee9c);manageLicense(_0xc4ee9c,_0xeb668e);})['catch'](function(_0x19e2e1){logger['error'](_0x19e2e1['message']);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0xf41a=['catch','get','data2','data1','then','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','days','DEMO\x20START\x20AT\x20%s','update','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports'];(function(_0x479e5f,_0x366561){var _0x55848c=function(_0x48a8ab){while(--_0x48a8ab){_0x479e5f['push'](_0x479e5f['shift']());}};_0x55848c(++_0x366561);}(_0xf41a,0x131));var _0xaf41=function(_0x4a42f0,_0x2da65d){_0x4a42f0=_0x4a42f0-0x0;var _0x3dc532=_0xf41a[_0x4a42f0];return _0x3dc532;};'use strict';var util=require(_0xaf41('0x0'));var moment=require(_0xaf41('0x1'));var rp=require(_0xaf41('0x2'));var BPromise=require(_0xaf41('0x3'));var pkginfo=require(_0xaf41('0x4'))(module,_0xaf41('0x5'));var db=require(_0xaf41('0x6'))['db'];var encryptor=require(_0xaf41('0x7'));var hardware=require(_0xaf41('0x8'));var logger=require(_0xaf41('0x9'))(_0xaf41('0xa'));var HOST=_0xaf41('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4c7d0f){return new BPromise(function(_0xccf6cc,_0x5dda7a){var _0x1899fd=util[_0xaf41('0xc')](_0xaf41('0xd'),HOST,_0x4c7d0f,module[_0xaf41('0xe')][_0xaf41('0x5')]);if(oldToken){_0x1899fd=util[_0xaf41('0xc')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x4c7d0f,module[_0xaf41('0xe')][_0xaf41('0x5')],oldToken);}var _0x36f3b2={'uri':_0x1899fd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x36f3b2)['then'](function(_0x465d95){_0xccf6cc(_0x465d95);})[_0xaf41('0xf')](function(_0x358834){_0x5dda7a(_0x358834);});});}function manageLicense(_0xce9574,_0x402396){var _0x47d47f=_0x402396[_0xaf41('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x47d47f['data1']!==_0xce9574&&!_0x47d47f[_0xaf41('0x11')]){oldToken=_0x47d47f[_0xaf41('0x12')];}httpRequest(_0xce9574)[_0xaf41('0x13')](function(_0x1be87e){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1be87e[_0xaf41('0x14')]){isOldTokenSent=![];if(!_0x47d47f[_0xaf41('0xa')]&&_0x47d47f[_0xaf41('0xa')]!=_0x1be87e[_0xaf41('0xa')]||_0x47d47f[_0xaf41('0xa')]&&_0x47d47f[_0xaf41('0x11')]){logger[_0xaf41('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x47d47f['license']&&!_0x47d47f[_0xaf41('0x11')]&&_0x47d47f['license']!=_0x1be87e[_0xaf41('0xa')]){logger[_0xaf41('0x15')](_0xaf41('0x16'));}if(_0x47d47f['license']&&!_0x47d47f['data2']&&_0x47d47f[_0xaf41('0xa')]==_0x1be87e[_0xaf41('0xa')]){return _0x402396;}return _0x402396['update']({'data1':_0xce9574,'data2':null,'license':_0x1be87e['license']});}else{if(_0x1be87e[_0xaf41('0xa')]||_0x47d47f[_0xaf41('0xa')]){if(!_0x47d47f[_0xaf41('0x11')]){if(_0x47d47f[_0xaf41('0x12')]==_0xce9574){GRAY_PERIOD_REASON='Disabled';logger[_0xaf41('0x15')](_0xaf41('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xaf41('0x15')](_0xaf41('0x18'),_0x47d47f[_0xaf41('0x12')],_0xce9574);}logger[_0xaf41('0x15')](_0xaf41('0x19'),GRAY_PERIOD_REASON[_0xaf41('0x1a')](),moment()[_0xaf41('0xc')](_0xaf41('0x1b')));return _0x402396['update']({'data2':encryptor[_0xaf41('0x1c')](moment()[_0xaf41('0xc')](_0xaf41('0x1b')))});}else{if(moment()[_0xaf41('0x1d')](encryptor['decryptString'](_0x47d47f['data2']),_0xaf41('0x1e'))>DAYS){logger[_0xaf41('0x15')](_0xaf41('0x1f'),moment()[_0xaf41('0xc')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x402396[_0xaf41('0x20')]({'data1':_0xce9574,'data2':null,'license':null});}}}else{if(_0x47d47f[_0xaf41('0x12')]!=_0xce9574){logger['info'](_0xaf41('0x18'),_0x47d47f['data1'],_0xce9574);return _0x402396[_0xaf41('0x20')]({'data1':_0xce9574,'data2':null,'license':null});}}}return _0x402396;})[_0xaf41('0x13')](function(_0xfe50e3){_0x402396=_0xfe50e3;})['catch'](function(_0x59ffcf){logger[_0xaf41('0x21')](_0x59ffcf[_0xaf41('0x22')]);})[_0xaf41('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x402396);},TIME);});}function defaultLicense(){var _0x2a21af=hardware[_0xaf41('0x24')]();if(_0x2a21af){return db['License'][_0xaf41('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x2a21af}})[_0xaf41('0x26')](function(_0x47f72f,_0x81f4a){logger[_0xaf41('0x15')](_0xaf41('0x27'),_0x2a21af);manageLicense(_0x2a21af,_0x47f72f);})[_0xaf41('0xf')](function(_0x2ebf92){logger[_0xaf41('0x21')](_0x2ebf92[_0xaf41('0x22')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index c152fb6..e623ff3 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 _0xa3d3=['add','days','grayReason','changed','message','role','sequelize','COUNT','admin','user','telephone','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','then','catch','uuid','data1','license','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray'];(function(_0x4a2cc2,_0x1fbafa){var _0x3f5f5c=function(_0x1e2583){while(--_0x1e2583){_0x4a2cc2['push'](_0x4a2cc2['shift']());}};_0x3f5f5c(++_0x1fbafa);}(_0xa3d3,0x18d));var _0x3a3d=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xa3d3[_0x3d42d8];return _0x27fc41;};'use strict';var util=require('util');var _=require(_0x3a3d('0x0'));var moment=require(_0x3a3d('0x1'));var BPromise=require(_0x3a3d('0x2'));var hardware=require('./hardware');var encryptor=require(_0x3a3d('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3a3d('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3a3d('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3a3d('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x3a3d('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xe31b15){return new BPromise(function(_0x29e1f3,_0x274ebc){return db[_0x3a3d('0x7')][_0x3a3d('0x8')](_['defaults'](_0xe31b15,{'raw':!![],'where':{'id':0x1}}))[_0x3a3d('0x9')](function(_0x1a827f){return checkLicense(_0x1a827f,null);})[_0x3a3d('0x9')](function(_0x5bc14b){_0x29e1f3(_0x5bc14b);return;})[_0x3a3d('0xa')](function(_0x4fa83f){_0x274ebc(_0x4fa83f);});});}function checkLicense(_0x1595c0,_0x24bd0e){if(!_0x1595c0){demoLicense[_0x3a3d('0xb')]=_0x1595c0[_0x3a3d('0xc')];return demoLicense;}try{var _0x5a7c12=_0x24bd0e||_0x1595c0[_0x3a3d('0xd')];if(_['isEmpty'](_0x5a7c12)){throw new Error(_0x3a3d('0xe'));}var _0x25ec32=_0x1595c0[_0x3a3d('0xc')];var _0x13ef55=_0x1595c0[_0x3a3d('0xf')];var _0x59a071=_0x25ec32[_0x3a3d('0x10')]('-')[0x4];var _0x152289=_0x25ec32[_0x3a3d('0x10')]('-')[0x0];var _0x1c964f=encryptor[_0x3a3d('0x11')](_0x5a7c12,util[_0x3a3d('0x12')](_0x3a3d('0x13'),_0x59a071,_0x25ec32,_0x152289));var _0x30c68d=JSON['parse'](_0x1c964f);_0x30c68d[_0x3a3d('0x14')]=![];_0x30c68d[_0x3a3d('0xb')]=_0x25ec32;_0x30c68d[_0x3a3d('0x15')]=hardware[_0x3a3d('0x6')]();if(_0x13ef55){var _0x5295fd=encryptor['decryptString'](_0x13ef55);_0x30c68d[_0x3a3d('0x16')]=_0x5295fd;_0x30c68d['deadline']=moment(_0x5295fd)[_0x3a3d('0x17')](0x7,_0x3a3d('0x18'))[_0x3a3d('0x12')]();_0x30c68d[_0x3a3d('0x19')]=_0x30c68d[_0x3a3d('0xb')]!=_0x30c68d['machineUuid']?_0x3a3d('0x1a'):'disabled';}return _0x30c68d;}catch(_0x156090){breakingLicense[_0x3a3d('0xb')]=_0x1595c0['data1'];breakingLicense[_0x3a3d('0x1b')]=_0x156090[_0x3a3d('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x30c6dd,_0xcfadeb){getLicense()['then'](function(_0x1badd7){return db['User']['findAll']({'attributes':[_0x3a3d('0x1c'),[db[_0x3a3d('0x1d')]['fn'](_0x3a3d('0x1e'),db['sequelize']['col']('role')),'count']],'group':_0x3a3d('0x1c'),'where':{'role':{'$or':[_0x3a3d('0x1f'),_0x3a3d('0x20'),_0x3a3d('0x21')]}},'raw':!![]})['then'](function(_0x451707){var _0x3de8f1={'user':_0x1badd7['users']||0x0,'telephone':_0x1badd7[_0x3a3d('0x22')]||0x0};_0x451707[_0x3a3d('0x23')](function(_0x323674){var _0x5c193d=_0x323674[_0x3a3d('0x1c')]===_0x3a3d('0x1f')?_0x3a3d('0x20'):_0x323674['role'];_0x3de8f1[_0x5c193d]-=_0x323674[_0x3a3d('0x24')];if(_0x3de8f1[_0x5c193d]<0x0)_0x3de8f1[_0x5c193d]=0x0;});_0x30c6dd(_0x3de8f1);return;});})[_0x3a3d('0xa')](function(_0x4d53bf){_0xcfadeb(_0x4d53bf);});});}function checkUserLimits(_0x345f2d){return new BPromise(function(_0x4d163c,_0x532dda){getLimits()[_0x3a3d('0x9')](function(_0x1fbd25){var _0x4ab78e=_[_0x3a3d('0x25')](_[_0x3a3d('0x26')](_0x345f2d,_0x3a3d('0x1c')),['admin',_0x3a3d('0x20'),_0x3a3d('0x21')]);var _0x5f490f=(_0x4ab78e[_0x3a3d('0x1f')]||0x0)+(_0x4ab78e[_0x3a3d('0x20')]||0x0);var _0x531720=_0x4ab78e[_0x3a3d('0x21')]||0x0;if(_0x5f490f>_0x1fbd25[_0x3a3d('0x20')])return _0x532dda(_0x3a3d('0x27'));if(_0x531720>_0x1fbd25['telephone'])return _0x532dda(_0x3a3d('0x28'));return _0x4d163c();})[_0x3a3d('0xa')](function(_0x395d46){_0x532dda(_0x395d46);});});}module[_0x3a3d('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xe4ae=['telephone','users','telephones','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','catch','uuid','license','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','message','User','role','sequelize','admin','user'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe4ae,0x1ea));var _0xee4a=function(_0x12aeb4,_0x518947){_0x12aeb4=_0x12aeb4-0x0;var _0x5bffd6=_0xe4ae[_0x12aeb4];return _0x5bffd6;};'use strict';var util=require(_0xee4a('0x0'));var _=require(_0xee4a('0x1'));var moment=require(_0xee4a('0x2'));var BPromise=require(_0xee4a('0x3'));var hardware=require('./hardware');var encryptor=require(_0xee4a('0x4'));var db=require(_0xee4a('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':_0xee4a('0x6'),'machineUuid':hardware[_0xee4a('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xee4a('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xee4a('0x9'),'machineUuid':hardware[_0xee4a('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2c3a95){return new BPromise(function(_0x5e0e85,_0x13153f){return db[_0xee4a('0xa')][_0xee4a('0xb')](_[_0xee4a('0xc')](_0x2c3a95,{'raw':!![],'where':{'id':0x1}}))[_0xee4a('0xd')](function(_0x135e5a){return checkLicense(_0x135e5a,null);})[_0xee4a('0xd')](function(_0x24181b){_0x5e0e85(_0x24181b);return;})[_0xee4a('0xe')](function(_0x56e8d0){_0x13153f(_0x56e8d0);});});}function checkLicense(_0x419572,_0x169926){if(!_0x419572){demoLicense[_0xee4a('0xf')]=_0x419572['data1'];return demoLicense;}try{var _0x4ff1ff=_0x169926||_0x419572[_0xee4a('0x10')];if(_['isEmpty'](_0x4ff1ff)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x1ecdd0=_0x419572[_0xee4a('0x11')];var _0xfacdc6=_0x419572[_0xee4a('0x12')];var _0x302705=_0x1ecdd0[_0xee4a('0x13')]('-')[0x4];var _0x53b547=_0x1ecdd0['split']('-')[0x0];var _0x31cb2b=encryptor[_0xee4a('0x14')](_0x4ff1ff,util[_0xee4a('0x15')](_0xee4a('0x16'),_0x302705,_0x1ecdd0,_0x53b547));var _0x29ee7d=JSON[_0xee4a('0x17')](_0x31cb2b);_0x29ee7d[_0xee4a('0x18')]=![];_0x29ee7d[_0xee4a('0xf')]=_0x1ecdd0;_0x29ee7d[_0xee4a('0x19')]=hardware[_0xee4a('0x7')]();if(_0xfacdc6){var _0x27f540=encryptor[_0xee4a('0x14')](_0xfacdc6);_0x29ee7d[_0xee4a('0x1a')]=_0x27f540;_0x29ee7d[_0xee4a('0x1b')]=moment(_0x27f540)[_0xee4a('0x1c')](0x7,_0xee4a('0x1d'))['format']();_0x29ee7d[_0xee4a('0x1e')]=_0x29ee7d[_0xee4a('0xf')]!=_0x29ee7d[_0xee4a('0x19')]?_0xee4a('0x1f'):'disabled';}return _0x29ee7d;}catch(_0x2db117){breakingLicense['uuid']=_0x419572[_0xee4a('0x11')];breakingLicense[_0xee4a('0x20')]=_0x2db117[_0xee4a('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x3354ae,_0x2fc36a){getLicense()['then'](function(_0x4452cb){return db[_0xee4a('0x21')]['findAll']({'attributes':[_0xee4a('0x22'),[db[_0xee4a('0x23')]['fn']('COUNT',db[_0xee4a('0x23')]['col'](_0xee4a('0x22'))),'count']],'group':_0xee4a('0x22'),'where':{'role':{'$or':[_0xee4a('0x24'),_0xee4a('0x25'),_0xee4a('0x26')]}},'raw':!![]})[_0xee4a('0xd')](function(_0x43a56e){var _0x5b7499={'user':_0x4452cb[_0xee4a('0x27')]||0x0,'telephone':_0x4452cb[_0xee4a('0x28')]||0x0};_0x43a56e[_0xee4a('0x29')](function(_0x3cb1d1){var _0x5dd546=_0x3cb1d1[_0xee4a('0x22')]===_0xee4a('0x24')?_0xee4a('0x25'):_0x3cb1d1[_0xee4a('0x22')];_0x5b7499[_0x5dd546]-=_0x3cb1d1[_0xee4a('0x2a')];if(_0x5b7499[_0x5dd546]<0x0)_0x5b7499[_0x5dd546]=0x0;});_0x3354ae(_0x5b7499);return;});})[_0xee4a('0xe')](function(_0x4f7db3){_0x2fc36a(_0x4f7db3);});});}function checkUserLimits(_0x1b004e){return new BPromise(function(_0x24d3e7,_0x1d5a3c){getLimits()[_0xee4a('0xd')](function(_0x55201c){var _0x2fa8de=_[_0xee4a('0x2b')](_[_0xee4a('0x2c')](_0x1b004e,_0xee4a('0x22')),[_0xee4a('0x24'),_0xee4a('0x25'),_0xee4a('0x26')]);var _0x2311a3=(_0x2fa8de[_0xee4a('0x24')]||0x0)+(_0x2fa8de[_0xee4a('0x25')]||0x0);var _0x12b38e=_0x2fa8de[_0xee4a('0x26')]||0x0;if(_0x2311a3>_0x55201c[_0xee4a('0x25')])return _0x1d5a3c(_0xee4a('0x2d'));if(_0x12b38e>_0x55201c[_0xee4a('0x26')])return _0x1d5a3c(_0xee4a('0x2e'));return _0x24d3e7();})[_0xee4a('0xe')](function(_0x103f86){_0x1d5a3c(_0x103f86);});});}module[_0xee4a('0x2f')]={'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 7a45e7e..344a4df 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 _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x3b9cc5,_0x1d0f92){var _0x4e5de1=function(_0x3f092a){while(--_0x3f092a){_0x3b9cc5['push'](_0x3b9cc5['shift']());}};_0x4e5de1(++_0x1d0f92);}(_0x0120,0x6f));var _0x0012=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0120[_0x6131cd];return _0x47e916;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x4fc2=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x120101,_0xaa5942){var _0x23e1ee=function(_0x37043f){while(--_0x37043f){_0x120101['push'](_0x120101['shift']());}};_0x23e1ee(++_0xaa5942);}(_0x4fc2,0x111));var _0x24fc=function(_0x4dab14,_0x4bdfb5){_0x4dab14=_0x4dab14-0x0;var _0x371600=_0x4fc2[_0x4dab14];return _0x371600;};'use strict';module[_0x24fc('0x0')]={'DOMAIN':_0x24fc('0x1'),'SESSION_SECRET':_0x24fc('0x2'),'GOOGLE_ID':_0x24fc('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 80aad5b..df946d2 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x763c=['format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','info','debugLevel','moment','winston','util','path','INFO','join','/var','log','xcally','replace','{{{'];(function(_0x446ae5,_0x10ebaf){var _0xf773b9=function(_0x23d15f){while(--_0x23d15f){_0x446ae5['push'](_0x446ae5['shift']());}};_0xf773b9(++_0x10ebaf);}(_0x763c,0xf2));var _0xc763=function(_0x427ed9,_0x55c820){_0x427ed9=_0x427ed9-0x0;var _0x4601b9=_0x763c[_0x427ed9];return _0x4601b9;};'use strict';var moment=require(_0xc763('0x0'));var winston=require(_0xc763('0x1'));var util=require(_0xc763('0x2'));var path=require(_0xc763('0x3'));var debugLevel=_0xc763('0x4');function filename(_0x4e1014,_0x3fc877){return path[_0xc763('0x5')](_0xc763('0x6'),_0xc763('0x7'),_0xc763('0x8'),util['format']('%s-%s.log',_0x4e1014,_0x3fc877));}function formatter(_0x1f1a71,_0x56927b){_0x56927b['message']=_0x56927b['message'][_0xc763('0x9')](/@@{/g,_0xc763('0xa'))['replace'](/}@@/g,'}}}')[_0xc763('0x9')](/@{/g,'{{')[_0xc763('0x9')](/}@/g,'}}');return util[_0xc763('0xb')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0xc763('0xb')](_0xc763('0xc')),_0x56927b[_0xc763('0xd')][_0xc763('0xe')](),_0x1f1a71,_0x56927b[_0xc763('0xf')]);}module[_0xc763('0x10')]=function(_0x21d0ea){return new winston[(_0xc763('0x11'))]({'transports':[new winston[(_0xc763('0x12'))][(_0xc763('0x13'))]({'name':util[_0xc763('0xb')](_0xc763('0x14'),_0x21d0ea,'error'),'filename':filename(_0x21d0ea,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x313df2){return formatter(_0x21d0ea,_0x313df2);}}),new winston[(_0xc763('0x12'))]['File']({'name':util[_0xc763('0xb')](_0xc763('0x14'),_0x21d0ea,'info'),'filename':filename(_0x21d0ea,_0xc763('0x15')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x354992){return formatter(_0x21d0ea,_0x354992);}}),new winston['transports']['Console']({'level':process['env'][_0xc763('0x16')]||debugLevel,'json':![],'formatter':function(_0x4ed4ce){return formatter(_0x21d0ea,_0x4ed4ce);}})]});}; \ No newline at end of file +var _0xdf99=['xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','%s-%s','error','File','info','Console','moment','winston','util','INFO','join','/var','log'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdf99,0xd1));var _0x9df9=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0xdf99[_0x427d3a];return _0xe5c521;};'use strict';var moment=require(_0x9df9('0x0'));var winston=require(_0x9df9('0x1'));var util=require(_0x9df9('0x2'));var path=require('path');var debugLevel=_0x9df9('0x3');function filename(_0x15777e,_0x51033c){return path[_0x9df9('0x4')](_0x9df9('0x5'),_0x9df9('0x6'),_0x9df9('0x7'),util[_0x9df9('0x8')](_0x9df9('0x9'),_0x15777e,_0x51033c));}function formatter(_0x576a3d,_0x44531e){_0x44531e[_0x9df9('0xa')]=_0x44531e[_0x9df9('0xa')]['replace'](/@@{/g,'{{{')[_0x9df9('0xb')](/}@@/g,_0x9df9('0xc'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x9df9('0xd'),moment()['format'](_0x9df9('0xe')),_0x44531e[_0x9df9('0xf')][_0x9df9('0x10')](),_0x576a3d,_0x44531e[_0x9df9('0xa')]);}module['exports']=function(_0x2e36fb){return new winston[(_0x9df9('0x11'))]({'transports':[new winston[(_0x9df9('0x12'))]['File']({'name':util['format'](_0x9df9('0x13'),_0x2e36fb,_0x9df9('0x14')),'filename':filename(_0x2e36fb,_0x9df9('0x14')),'level':_0x9df9('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xda0986){return formatter(_0x2e36fb,_0xda0986);}}),new winston[(_0x9df9('0x12'))][(_0x9df9('0x15'))]({'name':util[_0x9df9('0x8')](_0x9df9('0x13'),_0x2e36fb,'info'),'filename':filename(_0x2e36fb,_0x9df9('0x16')),'level':_0x9df9('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x579be5){return formatter(_0x2e36fb,_0x579be5);}}),new winston[(_0x9df9('0x12'))][(_0x9df9('0x17'))]({'level':process['env']['debugLevel']||debugLevel,'json':![],'formatter':function(_0x43c1c0){return formatter(_0x2e36fb,_0x43c1c0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index f5e6de6..16352a7 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 _0x9c74=['agi','../../services/agi/index.js','../../services/routing/index.js','xdr','exports','../../services/express/index.js','ami','join','../../services/ami/index.js'];(function(_0x5a8572,_0x464aa6){var _0x53c626=function(_0x4ba6c0){while(--_0x4ba6c0){_0x5a8572['push'](_0x5a8572['shift']());}};_0x53c626(++_0x464aa6);}(_0x9c74,0x11c));var _0x49c7=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0x9c74[_0xdb357c];return _0x5c8735;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':'express','script':path['join'](__dirname,_0x49c7('0x0'))},{'name':_0x49c7('0x1'),'script':path[_0x49c7('0x2')](__dirname,_0x49c7('0x3'))},{'name':_0x49c7('0x4'),'script':path[_0x49c7('0x2')](__dirname,_0x49c7('0x5'))},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js')},{'name':'routing','script':path['join'](__dirname,_0x49c7('0x6'))},{'name':_0x49c7('0x7'),'script':path[_0x49c7('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x49c7('0x8')]=config; \ No newline at end of file +var _0x9f4c=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','exports','path','express','join','../../services/express/index.js','ami'];(function(_0x4e0e7c,_0x496dc5){var _0x55fa2d=function(_0x31cece){while(--_0x31cece){_0x4e0e7c['push'](_0x4e0e7c['shift']());}};_0x55fa2d(++_0x496dc5);}(_0x9f4c,0x119));var _0xc9f4=function(_0x31a66d,_0x210ff4){_0x31a66d=_0x31a66d-0x0;var _0x5c63dd=_0x9f4c[_0x31a66d];return _0x5c63dd;};'use strict';var path=require(_0xc9f4('0x0'));var os=require('os');var config={'apps':[{'name':_0xc9f4('0x1'),'script':path[_0xc9f4('0x2')](__dirname,_0xc9f4('0x3'))},{'name':_0xc9f4('0x4'),'script':path[_0xc9f4('0x2')](__dirname,_0xc9f4('0x5'))},{'name':_0xc9f4('0x6'),'script':path[_0xc9f4('0x2')](__dirname,_0xc9f4('0x7'))},{'name':_0xc9f4('0x8'),'script':path['join'](__dirname,_0xc9f4('0x9'))},{'name':_0xc9f4('0xa'),'script':path[_0xc9f4('0x2')](__dirname,_0xc9f4('0xb'))},{'name':'xdr','script':path[_0xc9f4('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0xc9f4('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6ed1ca0..5af2a34 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 _0xcd8a=['restart','list','describe','delete','dump','saved','pm2','connect','connected','start','disconnect','stop','then'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0xcd8a,0x7b));var _0xacd8=function(_0x4f4c24,_0x5b0935){_0x4f4c24=_0x4f4c24-0x0;var _0x52dc82=_0xcd8a[_0x4f4c24];return _0x52dc82;};'use strict';var pm2=require(_0xacd8('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x5361dc,_0x1f390c){return pm2[_0xacd8('0x1')](function(_0x299267){if(_0x299267){return _0x1f390c(_0x299267);}return _0x5361dc(_0xacd8('0x2'));});});};exports[_0xacd8('0x3')]=function(_0x2a241e){return connect()['then'](function(){return new BPromise(function(_0x273cb3,_0x1f8183){return pm2[_0xacd8('0x3')](_0x2a241e,function(_0x2ad655,_0x247acf){if(_0x2ad655){return _0x1f8183(_0x2ad655);}pm2[_0xacd8('0x4')]();return _0x273cb3(_0x247acf);});});});};exports[_0xacd8('0x5')]=function(_0x5e19f8){return connect()[_0xacd8('0x6')](function(){return new BPromise(function(_0x1ae8aa,_0x4d829a){return pm2[_0xacd8('0x5')](_0x5e19f8,function(_0x3834ea,_0x5b0584){if(_0x3834ea){return _0x4d829a(_0x3834ea);}pm2[_0xacd8('0x4')]();return _0x1ae8aa(_0x5b0584);});});});};exports['restart']=function(_0x4cf9a6){return connect()[_0xacd8('0x6')](function(){return new BPromise(function(_0x2bcae4,_0x4eef6e){return pm2[_0xacd8('0x7')](_0x4cf9a6,function(_0x35a0a9,_0x44b273){if(_0x35a0a9){return _0x4eef6e(_0x35a0a9);}pm2[_0xacd8('0x4')]();return _0x2bcae4(_0x44b273);});});});};exports[_0xacd8('0x8')]=function(){return connect()[_0xacd8('0x6')](function(){return new BPromise(function(_0x5ca437,_0x5b61a1){return pm2[_0xacd8('0x8')](function(_0x4983e2,_0x517f0e){if(_0x4983e2){return _0x5b61a1(_0x4983e2);}pm2[_0xacd8('0x4')]();return _0x5ca437(_0x517f0e);});});});};exports[_0xacd8('0x9')]=function(_0x9c4e7b){return connect()['then'](function(){return new BPromise(function(_0x49b4b7,_0x241eeb){return pm2[_0xacd8('0x9')](_0x9c4e7b,function(_0x195959,_0x1f1a07){if(_0x195959){return _0x241eeb(_0x195959);}pm2['disconnect']();return _0x49b4b7(_0x1f1a07);});});});};exports[_0xacd8('0xa')]=function(_0x4f7b2e){return connect()[_0xacd8('0x6')](function(){return new BPromise(function(_0x1e88f0,_0x3cf1b2){return pm2[_0xacd8('0xa')](_0x4f7b2e,function(_0x1f8724,_0x47c57d){if(_0x1f8724){return _0x3cf1b2(_0x1f8724);}pm2[_0xacd8('0x4')]();return _0x1e88f0(_0x47c57d);});});});};exports[_0xacd8('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x6620af,_0x5eb57c){return pm2[_0xacd8('0xb')](function(_0x3ed9b7){if(_0x3ed9b7){return _0x5eb57c(_0x3ed9b7);}return _0x6620af(_0xacd8('0xc'));});});});}; \ No newline at end of file +var _0xf4be=['delete','dump','pm2','bluebird','./config','start','then','disconnect','restart','list','describe'];(function(_0x4c8fdc,_0xd60bc7){var _0x3d4ca8=function(_0x2d4e07){while(--_0x2d4e07){_0x4c8fdc['push'](_0x4c8fdc['shift']());}};_0x3d4ca8(++_0xd60bc7);}(_0xf4be,0x9c));var _0xef4b=function(_0x5d9d7d,_0xbae094){_0x5d9d7d=_0x5d9d7d-0x0;var _0x5636c2=_0xf4be[_0x5d9d7d];return _0x5636c2;};'use strict';var pm2=require(_0xef4b('0x0'));var BPromise=require(_0xef4b('0x1'));var config=require(_0xef4b('0x2'));function connect(){return new BPromise(function(_0xc2baff,_0x41a998){return pm2['connect'](function(_0x51b06c){if(_0x51b06c){return _0x41a998(_0x51b06c);}return _0xc2baff('connected');});});};exports[_0xef4b('0x3')]=function(_0x4adabf){return connect()[_0xef4b('0x4')](function(){return new BPromise(function(_0x248ed0,_0x438210){return pm2[_0xef4b('0x3')](_0x4adabf,function(_0x447a52,_0xfa09ad){if(_0x447a52){return _0x438210(_0x447a52);}pm2[_0xef4b('0x5')]();return _0x248ed0(_0xfa09ad);});});});};exports['stop']=function(_0xf0a1d7){return connect()['then'](function(){return new BPromise(function(_0x11506f,_0x59bfb3){return pm2['stop'](_0xf0a1d7,function(_0x5687ce,_0x35e555){if(_0x5687ce){return _0x59bfb3(_0x5687ce);}pm2['disconnect']();return _0x11506f(_0x35e555);});});});};exports['restart']=function(_0x3d5c39){return connect()['then'](function(){return new BPromise(function(_0x4f9b6e,_0x9806a5){return pm2[_0xef4b('0x6')](_0x3d5c39,function(_0x455428,_0x3fb7e7){if(_0x455428){return _0x9806a5(_0x455428);}pm2[_0xef4b('0x5')]();return _0x4f9b6e(_0x3fb7e7);});});});};exports[_0xef4b('0x7')]=function(){return connect()[_0xef4b('0x4')](function(){return new BPromise(function(_0x12bd80,_0x34370d){return pm2['list'](function(_0x5dad92,_0x48629){if(_0x5dad92){return _0x34370d(_0x5dad92);}pm2[_0xef4b('0x5')]();return _0x12bd80(_0x48629);});});});};exports[_0xef4b('0x8')]=function(_0xd4391){return connect()['then'](function(){return new BPromise(function(_0x5a22b6,_0x379df6){return pm2[_0xef4b('0x8')](_0xd4391,function(_0x44b59d,_0x471f75){if(_0x44b59d){return _0x379df6(_0x44b59d);}pm2[_0xef4b('0x5')]();return _0x5a22b6(_0x471f75);});});});};exports[_0xef4b('0x9')]=function(_0x599506){return connect()[_0xef4b('0x4')](function(){return new BPromise(function(_0x5d1571,_0x544718){return pm2[_0xef4b('0x9')](_0x599506,function(_0x25b237,_0x417436){if(_0x25b237){return _0x544718(_0x25b237);}pm2[_0xef4b('0x5')]();return _0x5d1571(_0x417436);});});});};exports[_0xef4b('0xa')]=function(){return connect()[_0xef4b('0x4')](function(){return new BPromise(function(_0x206e84,_0x14a091){return pm2[_0xef4b('0xa')](function(_0x5d8894){if(_0x5d8894){return _0x14a091(_0x5d8894);}return _0x206e84('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 57be788..d5dbe3f 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 _0x677f=['find','chatTimeout','findAll','lastMsgAt','subtract','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','format','YYYY-MM-DD\x20HH:mm:ss','then','length','join','emit','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','moment','ioredis','../../mysqldb','../logger','schedule','defaults','redis','localhost','Setting'];(function(_0x3e2c01,_0x1feb9c){var _0x3954ab=function(_0x526013){while(--_0x526013){_0x3e2c01['push'](_0x3e2c01['shift']());}};_0x3954ab(++_0x1feb9c);}(_0x677f,0x16b));var _0xf677=function(_0x451a6c,_0x5e6dc6){_0x451a6c=_0x451a6c-0x0;var _0x2ae48d=_0x677f[_0x451a6c];return _0x2ae48d;};'use strict';var _=require('lodash');var moment=require(_0xf677('0x0'));var Redis=require(_0xf677('0x1'));var util=require('util');var config=require('../../config/environment');var db=require(_0xf677('0x2'))['db'];var logger=require(_0xf677('0x3'))(_0xf677('0x4'));config['redis']=_[_0xf677('0x5')](config[_0xf677('0x6')],{'host':_0xf677('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf677('0x6')]));function closeInteractions(){var _0x372fc4=0x0;var _0x5ab2f8=[];return db[_0xf677('0x8')][_0xf677('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x2ce8b5){_0x372fc4=_0x2ce8b5[_0xf677('0xa')];if(_0x372fc4){return db['ChatInteraction'][_0xf677('0xb')]({'raw':!![],'attributes':['id',_0xf677('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf677('0xd')](_0x2ce8b5['chatTimeout'],_0xf677('0xe'))}}});}else{return[];}})['then'](function(_0x2dbf45){if(_0x2dbf45&&_0x2dbf45['length']){_0x5ab2f8=_[_0xf677('0xf')](_0x2dbf45||[],'id');logger[_0xf677('0x10')](_0xf677('0x11'),_0x5ab2f8['join']());return db[_0xf677('0x12')][_0xf677('0x13')]({'closeReason':_0xf677('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xf677('0x15')](_0xf677('0x16'))},{'where':{'id':_0x5ab2f8}});}})[_0xf677('0x17')](function(){if(_0x5ab2f8&&_0x5ab2f8[_0xf677('0x18')]){logger[_0xf677('0x10')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5ab2f8[_0xf677('0x19')]());for(var _0xfbe754=0x0;_0xfbe754<_0x5ab2f8[_0xf677('0x18')];_0xfbe754++){io[_0xf677('0x1a')]('chatInteraction:update',{'id':_0x5ab2f8[_0xfbe754],'closed':!![]});}}})[_0xf677('0x1b')](function(_0xc76aa4){logger[_0xf677('0x1c')](_0xf677('0x1d'),_0xc76aa4?util['inspect'](_0xc76aa4,{'showHidden':![],'depth':null}):'');});}exports[_0xf677('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x99a4=['format','length','info','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','map','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout'];(function(_0x399aad,_0x3757bf){var _0x201bc7=function(_0x2a2d0b){while(--_0x2a2d0b){_0x399aad['push'](_0x399aad['shift']());}};_0x201bc7(++_0x3757bf);}(_0x99a4,0x8e));var _0x499a=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x99a4[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x499a('0x0'));var moment=require(_0x499a('0x1'));var Redis=require(_0x499a('0x2'));var util=require(_0x499a('0x3'));var config=require(_0x499a('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x499a('0x5'))(_0x499a('0x6'));config[_0x499a('0x7')]=_['defaults'](config['redis'],{'host':_0x499a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x499a('0x7')]));function closeInteractions(){var _0x363144=0x0;var _0x593280=[];return db[_0x499a('0x9')][_0x499a('0xa')]({'raw':!![],'attributes':['id',_0x499a('0xb')],'where':{'id':0x1}})[_0x499a('0xc')](function(_0x575233){_0x363144=_0x575233[_0x499a('0xb')];if(_0x363144){return db[_0x499a('0xd')][_0x499a('0xe')]({'raw':!![],'attributes':['id',_0x499a('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x499a('0x10')](_0x575233[_0x499a('0xb')],_0x499a('0x11'))}}});}else{return[];}})[_0x499a('0xc')](function(_0x2e2f1d){if(_0x2e2f1d&&_0x2e2f1d['length']){_0x593280=_[_0x499a('0x12')](_0x2e2f1d||[],'id');logger['info'](_0x499a('0x13'),_0x593280[_0x499a('0x14')]());return db[_0x499a('0xd')][_0x499a('0x15')]({'closeReason':'system','disposition':_0x499a('0x16'),'closed':!![],'closedAt':moment()[_0x499a('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x593280}});}})['then'](function(){if(_0x593280&&_0x593280[_0x499a('0x18')]){logger[_0x499a('0x19')](_0x499a('0x1a'),_0x593280['join']());for(var _0x1a0709=0x0;_0x1a0709<_0x593280[_0x499a('0x18')];_0x1a0709++){io[_0x499a('0x1b')](_0x499a('0x1c'),{'id':_0x593280[_0x1a0709],'closed':!![]});}}})[_0x499a('0x1d')](function(_0x4491ab){logger[_0x499a('0x1e')](_0x499a('0x1f'),_0x4491ab?util[_0x499a('0x20')](_0x4491ab,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 8f55e98..226dc64 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 _0x452e=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x547b60,_0x834496){var _0x4419c4=function(_0x293755){while(--_0x293755){_0x547b60['push'](_0x547b60['shift']());}};_0x4419c4(++_0x834496);}(_0x452e,0x117));var _0xe452=function(_0x4414d5,_0xc6a75){_0x4414d5=_0x4414d5-0x0;var _0x9c75b0=_0x452e[_0x4414d5];return _0x9c75b0;};'use strict';function start(){var _0x231601=require(_0xe452('0x0'));return _0x231601[_0xe452('0x1')]();}module[_0xe452('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4560=['../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x1b4948,_0x3c40c8){var _0x108dc0=function(_0x1b28b7){while(--_0x1b28b7){_0x1b4948['push'](_0x1b4948['shift']());}};_0x108dc0(++_0x3c40c8);}(_0x4560,0xf6));var _0x0456=function(_0x349aff,_0xb091df){_0x349aff=_0x349aff-0x0;var _0x45ee8d=_0x4560[_0x349aff];return _0x45ee8d;};'use strict';function start(){var _0x55c24f=require(_0x0456('0x0'));return _0x55c24f['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 12a2087..208551f 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 _0x9fef=['path','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','message','text','Sent','attachments','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','stringify','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','exists','stop','deleteJob','toRun','length','index','my\x20id','cron','active','isBetween','endAt','add','start','add\x20cron','startAt','update\x20cron','run','util'];(function(_0x38f653,_0x17b7a2){var _0x51b74f=function(_0x53febc){while(--_0x53febc){_0x38f653['push'](_0x38f653['shift']());}};_0x51b74f(++_0x17b7a2);}(_0x9fef,0x1c6));var _0xf9fe=function(_0x31f6d2,_0x49129c){_0x31f6d2=_0x31f6d2-0x0;var _0xd9d2ba=_0x9fef[_0x31f6d2];return _0xd9d2ba;};'use strict';var fs=require('fs');var util=require(_0xf9fe('0x0'));var path=require(_0xf9fe('0x1'));var _=require(_0xf9fe('0x2'));var moment=require('moment');var CronJobManager=require(_0xf9fe('0x3'));var jayson=require(_0xf9fe('0x4'));var BPromise=require(_0xf9fe('0x5'));var logger=require(_0xf9fe('0x6'))(_0xf9fe('0x7'));var db=require(_0xf9fe('0x8'))['db'];var analyticCustomReportController=require(_0xf9fe('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xf9fe('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2ceb2c,_0x4f5f55){return function(){logger[_0xf9fe('0xb')](_0xf9fe('0xc'),_0x2ceb2c[_0xf9fe('0xd')]);var _0x1b2b15=!![];var _0x58222a={'tls':{'rejectUnauthorized':![]}};if(_0x2ceb2c[_0xf9fe('0xe')][_0xf9fe('0xf')][_0xf9fe('0x10')]){_0x58222a[_0xf9fe('0x10')]=_0x2ceb2c[_0xf9fe('0xe')][_0xf9fe('0xf')][_0xf9fe('0x10')];}else{_0x58222a[_0xf9fe('0x11')]=_0x2ceb2c[_0xf9fe('0xe')]['Smtp']['host'];_0x58222a[_0xf9fe('0x12')]=_0x2ceb2c['MailAccount'][_0xf9fe('0xf')]['port'];_0x58222a[_0xf9fe('0x13')]=_0x2ceb2c['MailAccount'][_0xf9fe('0xf')][_0xf9fe('0x13')];}if(_0x2ceb2c[_0xf9fe('0xe')]['Smtp'][_0xf9fe('0x14')]){_0x58222a[_0xf9fe('0x15')]={'user':_0x2ceb2c[_0xf9fe('0xe')][_0xf9fe('0xf')]['user'],'pass':_0x2ceb2c['MailAccount'][_0xf9fe('0xf')][_0xf9fe('0x16')]};}var _0x35d217={'account':_0x58222a,'message':{'from':util[_0xf9fe('0x17')](_0xf9fe('0x18'),_0x2ceb2c['MailAccount'][_0xf9fe('0x19')],_0x2ceb2c[_0xf9fe('0xe')][_0xf9fe('0xd')]||_0x2ceb2c[_0xf9fe('0xe')][_0xf9fe('0xf')]['user']),'to':_0x2ceb2c[_0xf9fe('0xd')],'cc':_0x2ceb2c['cc'],'bcc':_0x2ceb2c[_0xf9fe('0x1a')],'subject':util['format'](_0xf9fe('0x1b'),_0x4f5f55[_0xf9fe('0x19')],_0x2ceb2c[_0xf9fe('0x1c')],_0x2ceb2c['subtractUnit'])}};var _0x4bb27b=path[_0xf9fe('0x1d')](__dirname,_0xf9fe('0x1e'));var _0x3def18=_0x4f5f55[_0xf9fe('0x1f')];var _0x174e77=util[_0xf9fe('0x17')](_0xf9fe('0x20'),path['basename'](_0x4f5f55[_0xf9fe('0x1f')],path[_0xf9fe('0x21')](_0x4f5f55[_0xf9fe('0x1f')])),_0xf9fe('0x22'));var _0x5ebfa9=path[_0xf9fe('0x1d')](_0x4bb27b,_0x3def18);var _0xb4f168=path[_0xf9fe('0x1d')](_0x4bb27b,_0x174e77);if(fs[_0xf9fe('0x23')](_0x5ebfa9)){_0x4f5f55[_0xf9fe('0x24')]='Sent';_0x35d217['message']['attachments']=[{'filename':_0x3def18,'path':_0x5ebfa9}];_0x35d217[_0xf9fe('0x25')][_0xf9fe('0x26')]=util[_0xf9fe('0x17')]('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'](_0x4f5f55,null,0x2));}else if(fs[_0xf9fe('0x23')](_0xb4f168)){_0x4f5f55[_0xf9fe('0x24')]=_0xf9fe('0x27');_0x35d217[_0xf9fe('0x25')][_0xf9fe('0x28')]=[{'filename':_0x174e77,'path':_0xb4f168}];}else{_0x35d217[_0xf9fe('0x25')][_0xf9fe('0x26')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2ceb2c[_0xf9fe('0x29')]){_0x1b2b15=![];logger[_0xf9fe('0xb')](_0xf9fe('0x2a'));}}if(_0x1b2b15){return client[_0xf9fe('0x2b')](_0xf9fe('0x2c'),_0x35d217)[_0xf9fe('0x2d')](function(_0x5d269d){if(_0x5d269d[_0xf9fe('0x2e')]){return logger[_0xf9fe('0x2e')](_0xf9fe('0x2f'),JSON[_0xf9fe('0x30')](_0x5d269d));}return logger[_0xf9fe('0xb')]('email\x20sent');})['catch'](function(_0x38d03f){return logger[_0xf9fe('0x2e')]('error\x20mail',JSON[_0xf9fe('0x30')](_0x38d03f));});}};}function handleError(){return function(_0x83fdb3){return logger[_0xf9fe('0x2e')](JSON[_0xf9fe('0x30')](_0x83fdb3));};}function handleResult(_0x2f5069){return function(_0x5067a1){logger[_0xf9fe('0xb')](_0xf9fe('0x31'),JSON[_0xf9fe('0x30')](_0x5067a1));if(_0x2f5069[_0xf9fe('0xe')]&&_0x2f5069[_0xf9fe('0xe')][_0xf9fe('0xf')]&&!_[_0xf9fe('0x32')](_0x2f5069['email'])){setTimeout(handleSendEmail(_0x2f5069,_0x5067a1),0x3c*0x3e8);}};}function handleJob(_0x41825a){return function(){try{if(_[_0xf9fe('0x32')](_0x41825a[_0xf9fe('0x1c')])){return logger[_0xf9fe('0xb')](_0xf9fe('0x33'));}if(_[_0xf9fe('0x32')](_0x41825a[_0xf9fe('0x34')])){return logger[_0xf9fe('0xb')](_0xf9fe('0x35'));}var _0x2a683c={'startDate':moment()[_0xf9fe('0x36')](_0x41825a['subtractNumber'],_0x41825a[_0xf9fe('0x34')])[_0xf9fe('0x17')](_0xf9fe('0x37')),'endDate':moment()['format'](_0xf9fe('0x37')),'type':_0xf9fe('0x38'),'output':_0x41825a[_0xf9fe('0x39')],'name':_0x41825a[_0xf9fe('0x19')]};if(!_[_0xf9fe('0x32')](_0x41825a[_0xf9fe('0x3a')])){logger[_0xf9fe('0xb')](_0xf9fe('0x3b'),_0x41825a[_0xf9fe('0x3a')]);return analyticDefaultReportController[_0xf9fe('0x3c')]({'id':_0x41825a[_0xf9fe('0x3a')]},_0x2a683c)['then'](handleResult(_0x41825a))[_0xf9fe('0x3d')](handleError());}if(!_[_0xf9fe('0x32')](_0x41825a[_0xf9fe('0x3e')])){logger[_0xf9fe('0xb')](_0xf9fe('0x3f'),_0x41825a[_0xf9fe('0x3e')]);return analyticCustomReportController['runReport']({'id':_0x41825a[_0xf9fe('0x3e')]},_0x2a683c)[_0xf9fe('0x2d')](handleResult(_0x41825a))['catch'](handleError());}}catch(_0xd223c4){logger[_0xf9fe('0x2e')](JSON[_0xf9fe('0x30')](_0xd223c4));}return logger[_0xf9fe('0xb')](_0xf9fe('0x40'));};}function getJobs(_0x5d9090){var _0x35cfcc={};if(_0x5d9090){_0x35cfcc['id']=_0x5d9090;}return db[_0xf9fe('0x41')]['findAll']({'where':_0x35cfcc,'include':[{'model':db[_0xf9fe('0xe')],'attributes':['id',_0xf9fe('0x19'),_0xf9fe('0xd')],'include':[{'model':db[_0xf9fe('0x42')],'as':_0xf9fe('0xf')}]}]})[_0xf9fe('0x2d')](function(_0x5d72e2){var _0x44c451=_[_0xf9fe('0x43')](manager[_0xf9fe('0x44')]);var _0x5accd9=_[_0xf9fe('0x45')](_0x5d72e2,function(_0x947e85){return _0x947e85['id'][_0xf9fe('0x46')]();});var _0x5915b7=_[_0xf9fe('0x47')](_0x5d72e2,function(_0x351eb8){return _0x351eb8['id'][_0xf9fe('0x46')]();});var _0x58c89f=_0x5d9090?_0x5accd9:_[_0xf9fe('0x48')](_0x5accd9,_0x44c451);var _0x340f0e=_[_0xf9fe('0x49')](_0x5accd9,_0x44c451);var _0x18e954=_[_0xf9fe('0x48')](_0x44c451,_0x5accd9);var _0x24e1e0;var _0x582583;for(_0x24e1e0=0x0;_0x24e1e0<_0x18e954['length']&&!_0x5d9090;_0x24e1e0+=0x1){_0x582583=_0x18e954[_0x24e1e0][_0xf9fe('0x46')]();if(manager[_0xf9fe('0x4a')](_0x582583)){manager[_0xf9fe('0x4b')](_0x582583);manager[_0xf9fe('0x4c')](_0x582583);logger[_0xf9fe('0xb')]('delete\x20cron',_0x582583);}}logger[_0xf9fe('0xb')](_0xf9fe('0x4d'),JSON[_0xf9fe('0x30')](_0x58c89f));for(_0x24e1e0=0x0;_0x24e1e0<_0x58c89f[_0xf9fe('0x4e')];_0x24e1e0+=0x1){_0x582583=_0x58c89f[_0x24e1e0][_0xf9fe('0x46')]();logger[_0xf9fe('0xb')](_0xf9fe('0x4f'),_0x582583);if(_0x5d9090){logger[_0xf9fe('0xb')](_0xf9fe('0x50'),_0x5d9090);logger[_0xf9fe('0xb')](JSON[_0xf9fe('0x30')](_0x5915b7[_0x582583]));BPromise['resolve']()['then'](handleJob(_0x5915b7[_0x582583]));logger[_0xf9fe('0xb')]('run\x20job',_0x5915b7[_0x582583][_0xf9fe('0x19')],_0x5915b7[_0x582583][_0xf9fe('0x51')]);}else if(_0x5915b7[_0x582583][_0xf9fe('0x51')]&&_0x5915b7[_0x582583][_0xf9fe('0x52')]&&moment()[_0xf9fe('0x53')](_0x5915b7[_0x582583]['startAt'],_0x5915b7[_0x582583][_0xf9fe('0x54')])){manager[_0xf9fe('0x55')](_0x582583,_0x5915b7[_0x582583][_0xf9fe('0x51')],handleJob(_0x5915b7[_0x582583]));manager[_0xf9fe('0x56')](_0x582583);logger[_0xf9fe('0xb')](_0xf9fe('0x57'),_0x5915b7[_0x582583][_0xf9fe('0x19')],_0x5915b7[_0x582583][_0xf9fe('0x51')]);}else if(manager[_0xf9fe('0x4a')](_0x582583)){manager['stop'](_0x582583);manager['deleteJob'](_0x582583);logger[_0xf9fe('0xb')]('stop\x20cron',_0x5915b7[_0x582583][_0xf9fe('0x19')],_0x5915b7[_0x582583]['cron']);}}for(_0x24e1e0=0x0,_0x582583;_0x24e1e0<_0x340f0e[_0xf9fe('0x4e')]&&!_0x5d9090;_0x24e1e0+=0x1){_0x582583=_0x340f0e[_0x24e1e0][_0xf9fe('0x46')]();if(manager['exists'](_0x582583)){if(_0x5915b7[_0x582583][_0xf9fe('0x51')]&&_0x5915b7[_0x582583][_0xf9fe('0x52')]&&moment()['isBetween'](_0x5915b7[_0x582583][_0xf9fe('0x58')],_0x5915b7[_0x582583]['endAt'])){manager['update'](_0x582583,_0x5915b7[_0x582583][_0xf9fe('0x51')],handleJob(_0x5915b7[_0x582583]));logger['info'](_0xf9fe('0x59'),_0x5915b7[_0x582583][_0xf9fe('0x19')],_0x5915b7[_0x582583]['cron']);}else{manager[_0xf9fe('0x4b')](_0x582583);manager[_0xf9fe('0x4c')](_0x582583);logger[_0xf9fe('0xb')]('stop\x20cron',_0x5915b7[_0x582583][_0xf9fe('0x19')],_0x5915b7[_0x582583][_0xf9fe('0x51')]);}}}})[_0xf9fe('0x3d')](function(_0x2fe852){logger[_0xf9fe('0x2e')](JSON[_0xf9fe('0x30')](_0x2fe852));});}exports[_0xf9fe('0x5a')]=function(_0x4ccbd3){return getJobs(_0x4ccbd3);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xd530=['deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','startAt','endAt','start','exists','stop\x20cron','update\x20cron','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','name','user','bcc','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','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','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','email\x20sent','catch','error\x20mail','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','keyBy','difference','intersection','length','stop'];(function(_0xd086aa,_0x22e42f){var _0x55b1cc=function(_0x58dc3f){while(--_0x58dc3f){_0xd086aa['push'](_0xd086aa['shift']());}};_0x55b1cc(++_0x22e42f);}(_0xd530,0x1c1));var _0x0d53=function(_0x3113d3,_0x24d3d5){_0x3113d3=_0x3113d3-0x0;var _0x5c2df8=_0xd530[_0x3113d3];return _0x5c2df8;};'use strict';var fs=require('fs');var util=require(_0x0d53('0x0'));var path=require('path');var _=require(_0x0d53('0x1'));var moment=require(_0x0d53('0x2'));var CronJobManager=require(_0x0d53('0x3'));var jayson=require(_0x0d53('0x4'));var BPromise=require(_0x0d53('0x5'));var logger=require(_0x0d53('0x6'))(_0x0d53('0x7'));var db=require(_0x0d53('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x0d53('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3d0d9f,_0x4683e1){return function(){logger[_0x0d53('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x3d0d9f[_0x0d53('0xb')]);var _0x39f5da=!![];var _0x4fb588={'tls':{'rejectUnauthorized':![]}};if(_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')][_0x0d53('0xe')]){_0x4fb588[_0x0d53('0xe')]=_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')]['service'];}else{_0x4fb588[_0x0d53('0xf')]=_0x3d0d9f['MailAccount'][_0x0d53('0xd')][_0x0d53('0xf')];_0x4fb588[_0x0d53('0x10')]=_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')][_0x0d53('0x10')];_0x4fb588['secure']=_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')][_0x0d53('0x11')];}if(_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')][_0x0d53('0x12')]){_0x4fb588[_0x0d53('0x13')]={'user':_0x3d0d9f[_0x0d53('0xc')]['Smtp']['user'],'pass':_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')]['pass']};}var _0x3f8e4c={'account':_0x4fb588,'message':{'from':util[_0x0d53('0x14')](_0x0d53('0x15'),_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0x16')],_0x3d0d9f['MailAccount'][_0x0d53('0xb')]||_0x3d0d9f[_0x0d53('0xc')][_0x0d53('0xd')][_0x0d53('0x17')]),'to':_0x3d0d9f[_0x0d53('0xb')],'cc':_0x3d0d9f['cc'],'bcc':_0x3d0d9f[_0x0d53('0x18')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x4683e1[_0x0d53('0x16')],_0x3d0d9f[_0x0d53('0x19')],_0x3d0d9f['subtractUnit'])}};var _0x35bded=path['join'](__dirname,_0x0d53('0x1a'));var _0x8aeb=_0x4683e1[_0x0d53('0x1b')];var _0x3ee5ba=util[_0x0d53('0x14')](_0x0d53('0x1c'),path[_0x0d53('0x1d')](_0x4683e1[_0x0d53('0x1b')],path[_0x0d53('0x1e')](_0x4683e1[_0x0d53('0x1b')])),_0x0d53('0x1f'));var _0x47d56b=path[_0x0d53('0x20')](_0x35bded,_0x8aeb);var _0x42e786=path[_0x0d53('0x20')](_0x35bded,_0x3ee5ba);if(fs[_0x0d53('0x21')](_0x47d56b)){_0x4683e1[_0x0d53('0x22')]='Sent';_0x3f8e4c[_0x0d53('0x23')][_0x0d53('0x24')]=[{'filename':_0x8aeb,'path':_0x47d56b}];_0x3f8e4c[_0x0d53('0x23')][_0x0d53('0x25')]=util['format'](_0x0d53('0x26'),JSON[_0x0d53('0x27')](_0x4683e1,null,0x2));}else if(fs[_0x0d53('0x21')](_0x42e786)){_0x4683e1[_0x0d53('0x22')]=_0x0d53('0x28');_0x3f8e4c['message'][_0x0d53('0x24')]=[{'filename':_0x3ee5ba,'path':_0x42e786}];}else{_0x3f8e4c['message'][_0x0d53('0x25')]=_0x0d53('0x29');if(!_0x3d0d9f['sendIfEmpty']){_0x39f5da=![];logger[_0x0d53('0xa')](_0x0d53('0x2a'));}}if(_0x39f5da){return client[_0x0d53('0x2b')]('SendMail',_0x3f8e4c)['then'](function(_0xdf70e5){if(_0xdf70e5[_0x0d53('0x2c')]){return logger['error']('error\x20mail',JSON[_0x0d53('0x27')](_0xdf70e5));}return logger[_0x0d53('0xa')](_0x0d53('0x2d'));})[_0x0d53('0x2e')](function(_0x1df868){return logger[_0x0d53('0x2c')](_0x0d53('0x2f'),JSON[_0x0d53('0x27')](_0x1df868));});}};}function handleError(){return function(_0x36709e){return logger[_0x0d53('0x2c')](JSON[_0x0d53('0x27')](_0x36709e));};}function handleResult(_0x170d53){return function(_0x2b5da5){logger[_0x0d53('0xa')]('data',JSON[_0x0d53('0x27')](_0x2b5da5));if(_0x170d53[_0x0d53('0xc')]&&_0x170d53[_0x0d53('0xc')][_0x0d53('0xd')]&&!_['isNil'](_0x170d53[_0x0d53('0xb')])){setTimeout(handleSendEmail(_0x170d53,_0x2b5da5),0x3c*0x3e8);}};}function handleJob(_0xd0d3ab){return function(){try{if(_['isNil'](_0xd0d3ab[_0x0d53('0x19')])){return logger['info'](_0x0d53('0x30'));}if(_[_0x0d53('0x31')](_0xd0d3ab[_0x0d53('0x32')])){return logger[_0x0d53('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3da4ca={'startDate':moment()[_0x0d53('0x33')](_0xd0d3ab[_0x0d53('0x19')],_0xd0d3ab[_0x0d53('0x32')])[_0x0d53('0x14')](_0x0d53('0x34')),'endDate':moment()[_0x0d53('0x14')](_0x0d53('0x34')),'type':_0x0d53('0x35'),'output':_0xd0d3ab[_0x0d53('0x36')],'name':_0xd0d3ab[_0x0d53('0x16')]};if(!_[_0x0d53('0x31')](_0xd0d3ab[_0x0d53('0x37')])){logger['info'](_0x0d53('0x38'),_0xd0d3ab[_0x0d53('0x37')]);return analyticDefaultReportController[_0x0d53('0x39')]({'id':_0xd0d3ab[_0x0d53('0x37')]},_0x3da4ca)[_0x0d53('0x3a')](handleResult(_0xd0d3ab))[_0x0d53('0x2e')](handleError());}if(!_[_0x0d53('0x31')](_0xd0d3ab[_0x0d53('0x3b')])){logger[_0x0d53('0xa')]('exec\x20custom\x20report\x20id:%s',_0xd0d3ab['CustomReportId']);return analyticCustomReportController[_0x0d53('0x39')]({'id':_0xd0d3ab[_0x0d53('0x3b')]},_0x3da4ca)[_0x0d53('0x3a')](handleResult(_0xd0d3ab))[_0x0d53('0x2e')](handleError());}}catch(_0xa3cf16){logger[_0x0d53('0x2c')](JSON[_0x0d53('0x27')](_0xa3cf16));}return logger[_0x0d53('0xa')](_0x0d53('0x3c'));};}function getJobs(_0x44f792){var _0x1d7d6b={};if(_0x44f792){_0x1d7d6b['id']=_0x44f792;}return db[_0x0d53('0x3d')][_0x0d53('0x3e')]({'where':_0x1d7d6b,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0d53('0x16'),_0x0d53('0xb')],'include':[{'model':db[_0x0d53('0x3f')],'as':'Smtp'}]}]})[_0x0d53('0x3a')](function(_0x44bdb1){var _0x5f477b=_[_0x0d53('0x40')](manager[_0x0d53('0x41')]);var _0x3c5213=_[_0x0d53('0x42')](_0x44bdb1,function(_0x192619){return _0x192619['id'][_0x0d53('0x43')]();});var _0x4a4ef2=_[_0x0d53('0x44')](_0x44bdb1,function(_0x5162fc){return _0x5162fc['id'][_0x0d53('0x43')]();});var _0x1e2a4f=_0x44f792?_0x3c5213:_[_0x0d53('0x45')](_0x3c5213,_0x5f477b);var _0xafa0e0=_[_0x0d53('0x46')](_0x3c5213,_0x5f477b);var _0x2eee3c=_['difference'](_0x5f477b,_0x3c5213);var _0x4e7114;var _0x1e380e;for(_0x4e7114=0x0;_0x4e7114<_0x2eee3c[_0x0d53('0x47')]&&!_0x44f792;_0x4e7114+=0x1){_0x1e380e=_0x2eee3c[_0x4e7114][_0x0d53('0x43')]();if(manager['exists'](_0x1e380e)){manager[_0x0d53('0x48')](_0x1e380e);manager[_0x0d53('0x49')](_0x1e380e);logger['info'](_0x0d53('0x4a'),_0x1e380e);}}logger['info'](_0x0d53('0x4b'),JSON[_0x0d53('0x27')](_0x1e2a4f));for(_0x4e7114=0x0;_0x4e7114<_0x1e2a4f[_0x0d53('0x47')];_0x4e7114+=0x1){_0x1e380e=_0x1e2a4f[_0x4e7114][_0x0d53('0x43')]();logger[_0x0d53('0xa')](_0x0d53('0x4c'),_0x1e380e);if(_0x44f792){logger[_0x0d53('0xa')](_0x0d53('0x4d'),_0x44f792);logger[_0x0d53('0xa')](JSON['stringify'](_0x4a4ef2[_0x1e380e]));BPromise['resolve']()[_0x0d53('0x3a')](handleJob(_0x4a4ef2[_0x1e380e]));logger[_0x0d53('0xa')](_0x0d53('0x4e'),_0x4a4ef2[_0x1e380e][_0x0d53('0x16')],_0x4a4ef2[_0x1e380e]['cron']);}else if(_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')]&&_0x4a4ef2[_0x1e380e]['active']&&moment()[_0x0d53('0x50')](_0x4a4ef2[_0x1e380e][_0x0d53('0x51')],_0x4a4ef2[_0x1e380e][_0x0d53('0x52')])){manager['add'](_0x1e380e,_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')],handleJob(_0x4a4ef2[_0x1e380e]));manager[_0x0d53('0x53')](_0x1e380e);logger[_0x0d53('0xa')]('add\x20cron',_0x4a4ef2[_0x1e380e][_0x0d53('0x16')],_0x4a4ef2[_0x1e380e]['cron']);}else if(manager[_0x0d53('0x54')](_0x1e380e)){manager[_0x0d53('0x48')](_0x1e380e);manager[_0x0d53('0x49')](_0x1e380e);logger[_0x0d53('0xa')](_0x0d53('0x55'),_0x4a4ef2[_0x1e380e][_0x0d53('0x16')],_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')]);}}for(_0x4e7114=0x0,_0x1e380e;_0x4e7114<_0xafa0e0[_0x0d53('0x47')]&&!_0x44f792;_0x4e7114+=0x1){_0x1e380e=_0xafa0e0[_0x4e7114][_0x0d53('0x43')]();if(manager[_0x0d53('0x54')](_0x1e380e)){if(_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')]&&_0x4a4ef2[_0x1e380e]['active']&&moment()[_0x0d53('0x50')](_0x4a4ef2[_0x1e380e][_0x0d53('0x51')],_0x4a4ef2[_0x1e380e][_0x0d53('0x52')])){manager['update'](_0x1e380e,_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')],handleJob(_0x4a4ef2[_0x1e380e]));logger['info'](_0x0d53('0x56'),_0x4a4ef2[_0x1e380e][_0x0d53('0x16')],_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')]);}else{manager[_0x0d53('0x48')](_0x1e380e);manager[_0x0d53('0x49')](_0x1e380e);logger[_0x0d53('0xa')]('stop\x20cron',_0x4a4ef2[_0x1e380e]['name'],_0x4a4ef2[_0x1e380e][_0x0d53('0x4f')]);}}}})[_0x0d53('0x2e')](function(_0x352c5b){logger[_0x0d53('0x2c')](JSON['stringify'](_0x352c5b));});}exports['run']=function(_0x7cfbac){return getJobs(_0x7cfbac);};exports[_0x0d53('0x53')]=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 0999737..c20403e 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 _0xa047=['request-promise','util','../../mysqldb','transcribe','TranscribeService','Comprehend','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','Sentiment','Positive','Negative','name','SequelizeValidationError','error','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','forEach','push','all','catch','lodash','aws-sdk'];(function(_0x1ba155,_0x38626d){var _0x215aac=function(_0x15a519){while(--_0x15a519){_0x1ba155['push'](_0x1ba155['shift']());}};_0x215aac(++_0x38626d);}(_0xa047,0x1c5));var _0x7a04=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xa047[_0x3299d1];return _0x44356e;};var _=require(_0x7a04('0x0'));var AWS=require(_0x7a04('0x1'));var rp=require(_0x7a04('0x2'));var util=require(_0x7a04('0x3'));var BPromise=require('bluebird');var db=require(_0x7a04('0x4'))['db'];var logger=require('../../config/logger')(_0x7a04('0x5'));function getTranscriptionJob(_0x269341,_0x2b3190,_0x15c12c,_0x26a2c9){return new Promise(function(_0x4cc23b,_0x12564a){var _0x3166ff=new AWS[(_0x7a04('0x6'))]({'accessKeyId':_0x2b3190,'secretAccessKey':_0x269341,'region':_0x15c12c});_0x3166ff['getTranscriptionJob']({'TranscriptionJobName':_0x26a2c9},function(_0x10d92f,_0x10faf9){if(_0x10d92f){return _0x12564a(_0x10d92f);}else{return _0x4cc23b(_0x10faf9);}});});}function sentiment(_0x500da7,_0x150cbf,_0xc64317,_0x557e2f,_0x44d0e8){return new Promise(function(_0x4d21d3,_0x545716){var _0x24b4d7=new AWS[(_0x7a04('0x7'))]({'accessKeyId':_0x150cbf,'secretAccessKey':_0x500da7,'region':_0xc64317});_0x24b4d7['detectSentiment']({'Text':_0x557e2f,'LanguageCode':_0x44d0e8['substring'](0x0,0x2)},function(_0x4a90b2,_0x504fb0){if(_0x4a90b2){return _0x545716(_0x4a90b2);}else{return _0x4d21d3(_0x504fb0);}});});}function checkTranscribeJob(_0x3300ae,_0x3e8692,_0x15a002){var _0x10931c;return new BPromise(function(_0x44a0a1,_0x33fc47){logger[_0x7a04('0x8')](util[_0x7a04('0x9')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3300ae['id'],_0x3300ae[_0x7a04('0xa')]));return getTranscriptionJob(_0x15a002[_0x7a04('0xb')],_0x15a002[_0x7a04('0xc')],_0x3e8692[_0x7a04('0xd')],_0x3300ae[_0x7a04('0xa')])[_0x7a04('0xe')](function(_0x4f434f){logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0xf'),_0x3300ae['id'],_0x3300ae['transcribeName'],_0x4f434f['TranscriptionJob'][_0x7a04('0x10')]));if(!_0x3300ae[_0x7a04('0x11')]){switch(_0x4f434f[_0x7a04('0x12')]['TranscriptionJobStatus']){case _0x7a04('0x13'):var _0x43aeec={'transcribeStatus':_0x4f434f['TranscriptionJob'][_0x7a04('0x10')],'fileUri':_0x4f434f['TranscriptionJob'][_0x7a04('0x14')]['TranscriptFileUri']};logger[_0x7a04('0x8')](util[_0x7a04('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x3300ae['id']));return rp({'uri':_0x4f434f[_0x7a04('0x12')][_0x7a04('0x14')]['TranscriptFileUri'],'json':!![]})[_0x7a04('0xe')](function(_0x258346){logger['info'](util[_0x7a04('0x9')](_0x7a04('0x15'),_0x3300ae['id']));if(_0x258346&&_0x258346[_0x7a04('0x16')]&&_0x258346[_0x7a04('0x16')][_0x7a04('0x17')]&&_0x258346[_0x7a04('0x16')][_0x7a04('0x17')][_0x7a04('0x18')]){_0x43aeec['fileText']='';for(var _0x166e0b=0x0;_0x166e0b<_0x258346['results'][_0x7a04('0x17')][_0x7a04('0x18')];_0x166e0b++){_0x43aeec[_0x7a04('0x11')]+=_0x258346[_0x7a04('0x16')][_0x7a04('0x17')][_0x166e0b][_0x7a04('0x19')]+'';}}return _0x3300ae[_0x7a04('0x1a')](_0x43aeec);})[_0x7a04('0xe')](function(){logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0x1b'),_0x3300ae['id']));if(!_0x3300ae['tempSentiment']){throw new db[(_0x7a04('0x1c'))]['ValidationError'](_0x7a04('0x1d'));}if(!_0x3e8692[_0x7a04('0x1e')]||!_0x3e8692[_0x7a04('0x1f')]||!_0x3e8692[_0x7a04('0x20')]||!_0x3e8692[_0x7a04('0x21')]||!_0x3e8692[_0x7a04('0x22')]){throw new db['Sequelize'][(_0x7a04('0x23'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x43aeec[_0x7a04('0x11')]){throw new Error(_0x7a04('0x24'));}if(_0x3e8692['sentimentAccountId']===_0x15a002['id']){return _0x15a002;}else{return db[_0x7a04('0x25')][_0x7a04('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x224740){if(!_0x224740){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))](_0x7a04('0x27'));}if(!_0x224740[_0x7a04('0xb')]||!_0x224740[_0x7a04('0xc')]){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))]('Cloud\x20Provider\x20not\x20configured');}_0x10931c=_0x224740;logger[_0x7a04('0x8')](util[_0x7a04('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3300ae['id']));return sentiment(_0x10931c[_0x7a04('0xb')],_0x10931c[_0x7a04('0xc')],_0x3e8692[_0x7a04('0x20')],_0x43aeec[_0x7a04('0x11')],_0x3e8692[_0x7a04('0x21')]);})[_0x7a04('0xe')](function(_0x3d01d7){logger['info'](util[_0x7a04('0x9')](_0x7a04('0x28'),_0x3300ae['id']));return _0x3300ae['update']({'sentiment':_0x3d01d7['Sentiment'],'sPositive':_0x3d01d7[_0x7a04('0x29')]['Positive'],'sNegative':_0x3d01d7[_0x7a04('0x29')]['Negative'],'sMixed':_0x3d01d7[_0x7a04('0x29')][_0x7a04('0x2a')],'sNeutral':_0x3d01d7[_0x7a04('0x29')][_0x7a04('0x2b')]});})[_0x7a04('0xe')](function(){logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0x1b'),_0x3300ae['id']));_0x44a0a1();});case _0x7a04('0x2c'):return _0x3300ae['update']({'transcribeStatus':'FAILED','failureReason':_0x4f434f['TranscriptionJob']['FailureReason']})[_0x7a04('0xe')](function(){logger['info'](util[_0x7a04('0x9')](_0x7a04('0x1b'),_0x3300ae['id']));_0x44a0a1();});default:logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0x2d'),_0x3300ae['id']));break;}}else{return BPromise[_0x7a04('0x2e')]()[_0x7a04('0xe')](function(){if(!_0x3300ae['tempSentiment']){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))](_0x7a04('0x1d'));}if(!_0x3e8692['sentiment']||!_0x3e8692[_0x7a04('0x1f')]||!_0x3e8692[_0x7a04('0x20')]||!_0x3e8692[_0x7a04('0x21')]||!_0x3e8692[_0x7a04('0x22')]){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))](_0x7a04('0x2f'));}if(!_0x3300ae[_0x7a04('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x3e8692['sentimentAccountId']===_0x15a002['id']){return _0x15a002;}else{return db[_0x7a04('0x25')][_0x7a04('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x585334){if(!_0x585334){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))](_0x7a04('0x27'));}if(!_0x585334[_0x7a04('0xb')]||!_0x585334[_0x7a04('0xc')]){throw new db[(_0x7a04('0x1c'))]['ValidationError'](_0x7a04('0x30'));}_0x10931c=_0x585334;logger[_0x7a04('0x8')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3300ae['id']));return sentiment(_0x10931c[_0x7a04('0xb')],_0x10931c[_0x7a04('0xc')],_0x3e8692[_0x7a04('0x20')],_0x3300ae[_0x7a04('0x11')],_0x3e8692[_0x7a04('0x21')]);})[_0x7a04('0xe')](function(_0x58d1a1){logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0x28'),_0x3300ae['id']));return _0x3300ae[_0x7a04('0x1a')]({'sentiment':_0x58d1a1[_0x7a04('0x31')],'sPositive':_0x58d1a1[_0x7a04('0x29')][_0x7a04('0x32')],'sNegative':_0x58d1a1['SentimentScore'][_0x7a04('0x33')],'sMixed':_0x58d1a1[_0x7a04('0x29')]['Mixed'],'sNeutral':_0x58d1a1['SentimentScore']['Neutral'],'transcribeStatus':_0x7a04('0x13')});})[_0x7a04('0xe')](function(){logger[_0x7a04('0x8')](util[_0x7a04('0x9')](_0x7a04('0x1b'),_0x3300ae['id']));_0x44a0a1();});}})['catch'](function(_0x513895){if(_0x513895){if(!_0x513895[_0x7a04('0x34')]||_0x513895[_0x7a04('0x34')]!==_0x7a04('0x35')){logger[_0x7a04('0x36')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3300ae['id']),util[_0x7a04('0x37')](_0x513895,{'showHidden':![],'depth':null}));}}_0x44a0a1();});});}function checkTranscribe(){var _0x5dd5dc;var _0x19c1df;var _0x4d159d;return db[_0x7a04('0x38')][_0x7a04('0x39')]({'where':{'transcribeStatus':_0x7a04('0x3a')}})[_0x7a04('0xe')](function(_0x645bea){if(!_0x645bea||!_0x645bea[_0x7a04('0x18')]){throw new db[(_0x7a04('0x1c'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5dd5dc=_0x645bea;return db[_0x7a04('0x3b')][_0x7a04('0x26')]({'where':{'id':0x1}});})[_0x7a04('0xe')](function(_0x40e1d7){if(!_0x40e1d7){throw new db[(_0x7a04('0x1c'))][(_0x7a04('0x23'))](_0x7a04('0x3c'));}_0x19c1df=_0x40e1d7;if(!_0x19c1df[_0x7a04('0x5')]||!_0x19c1df['transcribeAccountId']||!_0x19c1df['transcribeRegion']||!_0x19c1df[_0x7a04('0x21')]||!_0x19c1df[_0x7a04('0x22')]){throw new db['Sequelize'][(_0x7a04('0x23'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x7a04('0x26')]({'where':{'id':_0x19c1df['transcribeAccountId']}});})[_0x7a04('0xe')](function(_0x44b4ba){if(!_0x44b4ba){throw new db[(_0x7a04('0x1c'))]['ValidationError'](_0x7a04('0x27'));}if(!_0x44b4ba[_0x7a04('0xb')]||!_0x44b4ba[_0x7a04('0xc')]){throw new db['Sequelize']['ValidationError'](_0x7a04('0x30'));}_0x4d159d=_0x44b4ba;var _0x12a4a4=[];_0x5dd5dc[_0x7a04('0x3d')](function(_0x1174b7){_0x12a4a4[_0x7a04('0x3e')](checkTranscribeJob(_0x1174b7,_0x19c1df,_0x4d159d));});return BPromise[_0x7a04('0x3f')](_0x12a4a4);})[_0x7a04('0x40')](function(_0xd6b856){if(_0xd6b856){if(!_0xd6b856[_0x7a04('0x34')]||_0xd6b856[_0x7a04('0x34')]!==_0x7a04('0x35')){logger[_0x7a04('0x36')](util[_0x7a04('0x37')](_0xd6b856,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd3a8=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Cloud\x20Provider\x20not\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','push','all','error','start','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','info','format','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured'];(function(_0x5af311,_0x5989cd){var _0x108473=function(_0xc7af7b){while(--_0xc7af7b){_0x5af311['push'](_0x5af311['shift']());}};_0x108473(++_0x5989cd);}(_0xd3a8,0x135));var _0x8d3a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd3a8[_0x2641f9];return _0x585741;};var _=require(_0x8d3a('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8d3a('0x1'));var util=require(_0x8d3a('0x2'));var BPromise=require(_0x8d3a('0x3'));var db=require(_0x8d3a('0x4'))['db'];var logger=require('../../config/logger')(_0x8d3a('0x5'));function getTranscriptionJob(_0x2f2826,_0x478dee,_0x5e3983,_0x5ee2ca){return new Promise(function(_0x457b90,_0x59893d){var _0x588567=new AWS[(_0x8d3a('0x6'))]({'accessKeyId':_0x478dee,'secretAccessKey':_0x2f2826,'region':_0x5e3983});_0x588567[_0x8d3a('0x7')]({'TranscriptionJobName':_0x5ee2ca},function(_0x28b131,_0x40bc92){if(_0x28b131){return _0x59893d(_0x28b131);}else{return _0x457b90(_0x40bc92);}});});}function sentiment(_0x2a9a0a,_0x34bb5d,_0x3cd3e3,_0x472233,_0x87efcd){return new Promise(function(_0x117b56,_0x11aaf1){var _0x459c60=new AWS[(_0x8d3a('0x8'))]({'accessKeyId':_0x34bb5d,'secretAccessKey':_0x2a9a0a,'region':_0x3cd3e3});_0x459c60['detectSentiment']({'Text':_0x472233,'LanguageCode':_0x87efcd['substring'](0x0,0x2)},function(_0x527258,_0x222886){if(_0x527258){return _0x11aaf1(_0x527258);}else{return _0x117b56(_0x222886);}});});}function checkTranscribeJob(_0x880a06,_0xc834ec,_0x43b1ca){var _0x4759cd;return new BPromise(function(_0x29b7b9,_0x58b2b7){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x880a06['id'],_0x880a06['transcribeName']));return getTranscriptionJob(_0x43b1ca[_0x8d3a('0xb')],_0x43b1ca['data2'],_0xc834ec[_0x8d3a('0xc')],_0x880a06[_0x8d3a('0xd')])[_0x8d3a('0xe')](function(_0x4c915d){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0xf'),_0x880a06['id'],_0x880a06['transcribeName'],_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')]));if(!_0x880a06[_0x8d3a('0x12')]){switch(_0x4c915d['TranscriptionJob']['TranscriptionJobStatus']){case _0x8d3a('0x13'):var _0xc8208c={'transcribeStatus':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')],'fileUri':_0x4c915d[_0x8d3a('0x10')]['Transcript'][_0x8d3a('0x14')]};logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x15'),_0x880a06['id']));return rp({'uri':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x16')]['TranscriptFileUri'],'json':!![]})[_0x8d3a('0xe')](function(_0x3ca6a9){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x880a06['id']));if(_0x3ca6a9&&_0x3ca6a9[_0x8d3a('0x17')]&&_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')]&&_0x3ca6a9['results'][_0x8d3a('0x18')][_0x8d3a('0x19')]){_0xc8208c[_0x8d3a('0x12')]='';for(var _0x327d9a=0x0;_0x327d9a<_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x8d3a('0x19')];_0x327d9a++){_0xc8208c['fileText']+=_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x327d9a][_0x8d3a('0x1a')]+'';}}return _0x880a06[_0x8d3a('0x1b')](_0xc8208c);})[_0x8d3a('0xe')](function(){logger[_0x8d3a('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x1f'));}if(!_0xc834ec[_0x8d3a('0x20')]||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec['sentimentRegion']||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x24'));}if(!_0xc8208c[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec['sentimentAccountId']===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')]['findOne']({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x44dda3){if(!_0x44dda3){throw new db['Sequelize'][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x44dda3['data1']||!_0x44dda3[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x28'));}_0x4759cd=_0x44dda3;logger['info'](util['format'](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec[_0x8d3a('0x2a')],_0xc8208c[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x1a46b1){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x1a46b1[_0x8d3a('0x2c')],'sPositive':_0x1a46b1['SentimentScore'][_0x8d3a('0x2d')],'sNegative':_0x1a46b1[_0x8d3a('0x2e')]['Negative'],'sMixed':_0x1a46b1['SentimentScore'][_0x8d3a('0x2f')],'sNeutral':_0x1a46b1[_0x8d3a('0x2e')][_0x8d3a('0x30')]});})['then'](function(){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));_0x29b7b9();});case _0x8d3a('0x31'):return _0x880a06[_0x8d3a('0x1b')]({'transcribeStatus':_0x8d3a('0x31'),'failureReason':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x32')]})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});default:logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x34'),_0x880a06['id']));break;}}else{return BPromise[_0x8d3a('0x35')]()[_0x8d3a('0xe')](function(){if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xc834ec['sentiment']||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec[_0x8d3a('0x2a')]||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x880a06[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec[_0x8d3a('0x21')]===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')][_0x8d3a('0x36')]({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x3dd0fd){if(!_0x3dd0fd){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x37'));}if(!_0x3dd0fd[_0x8d3a('0xb')]||!_0x3dd0fd['data2']){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x4759cd=_0x3dd0fd;logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec['sentimentRegion'],_0x880a06[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x26296a){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x26296a[_0x8d3a('0x2c')],'sPositive':_0x26296a[_0x8d3a('0x2e')]['Positive'],'sNegative':_0x26296a['SentimentScore']['Negative'],'sMixed':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x2f')],'sNeutral':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x30')],'transcribeStatus':_0x8d3a('0x13')});})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});}})['catch'](function(_0x234a0d){if(_0x234a0d){if(!_0x234a0d[_0x8d3a('0x38')]||_0x234a0d[_0x8d3a('0x38')]!==_0x8d3a('0x39')){logger['error'](util[_0x8d3a('0xa')](_0x8d3a('0x3a'),_0x880a06['id']),util[_0x8d3a('0x3b')](_0x234a0d,{'showHidden':![],'depth':null}));}}_0x29b7b9();});});}function checkTranscribe(){var _0x445595;var _0x178be8;var _0x45361c;return db[_0x8d3a('0x3c')][_0x8d3a('0x3d')]({'where':{'transcribeStatus':_0x8d3a('0x3e')}})[_0x8d3a('0xe')](function(_0x4df4d6){if(!_0x4df4d6||!_0x4df4d6[_0x8d3a('0x19')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x3f'));}_0x445595=_0x4df4d6;return db['Setting'][_0x8d3a('0x36')]({'where':{'id':0x1}});})[_0x8d3a('0xe')](function(_0x1ec81d){if(!_0x1ec81d){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x40'));}_0x178be8=_0x1ec81d;if(!_0x178be8[_0x8d3a('0x5')]||!_0x178be8[_0x8d3a('0x41')]||!_0x178be8[_0x8d3a('0xc')]||!_0x178be8[_0x8d3a('0x22')]||!_0x178be8[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x8d3a('0x36')]({'where':{'id':_0x178be8[_0x8d3a('0x41')]}});})[_0x8d3a('0xe')](function(_0x55dd25){if(!_0x55dd25){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x55dd25[_0x8d3a('0xb')]||!_0x55dd25[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x45361c=_0x55dd25;var _0x336c5a=[];_0x445595['forEach'](function(_0x38c946){_0x336c5a[_0x8d3a('0x42')](checkTranscribeJob(_0x38c946,_0x178be8,_0x45361c));});return BPromise[_0x8d3a('0x43')](_0x336c5a);})['catch'](function(_0x2100ee){if(_0x2100ee){if(!_0x2100ee[_0x8d3a('0x38')]||_0x2100ee['name']!=='SequelizeValidationError'){logger[_0x8d3a('0x44')](util[_0x8d3a('0x3b')](_0x2100ee,{'showHidden':![],'depth':null}));}}});}exports[_0x8d3a('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 89150ab..e648a09 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 _0xd114=['localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','../../mysqldb','../logger','schedule','redis','defaults'];(function(_0x18ae1a,_0x58a457){var _0x1a4f1b=function(_0x32d838){while(--_0x32d838){_0x18ae1a['push'](_0x18ae1a['shift']());}};_0x1a4f1b(++_0x58a457);}(_0xd114,0x157));var _0x4d11=function(_0x3fc199,_0x3e4d35){_0x3fc199=_0x3fc199-0x0;var _0xd07813=_0xd114[_0x3fc199];return _0xd07813;};'use strict';var _=require(_0x4d11('0x0'));var moment=require(_0x4d11('0x1'));var Redis=require(_0x4d11('0x2'));var util=require('util');var config=require('../../config/environment');var db=require(_0x4d11('0x3'))['db'];var logger=require(_0x4d11('0x4'))(_0x4d11('0x5'));config[_0x4d11('0x6')]=_[_0x4d11('0x7')](config[_0x4d11('0x6')],{'host':_0x4d11('0x8'),'port':0x18eb});var io=require(_0x4d11('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x5d50b2=[];return db[_0x4d11('0xa')][_0x4d11('0xb')]({'raw':!![],'attributes':['id',_0x4d11('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x4d11('0xd'))}}})[_0x4d11('0xe')](function(_0x3009f6){if(_0x3009f6&&_0x3009f6[_0x4d11('0xf')]){_0x5d50b2=_['map'](_0x3009f6||[],'id');logger['info'](_0x4d11('0x10'),_0x5d50b2[_0x4d11('0x11')]());return db[_0x4d11('0xa')]['update']({'closeReason':'system','disposition':_0x4d11('0x12'),'closed':!![],'closedAt':moment()[_0x4d11('0x13')](_0x4d11('0x14'))},{'where':{'id':_0x5d50b2}});}})[_0x4d11('0xe')](function(){if(_0x5d50b2&&_0x5d50b2['length']){logger[_0x4d11('0x15')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x5d50b2[_0x4d11('0x11')]());for(var _0xc6adf1=0x0;_0xc6adf1<_0x5d50b2[_0x4d11('0xf')];_0xc6adf1++){io[_0x4d11('0x16')](_0x4d11('0x17'),{'id':_0x5d50b2[_0xc6adf1],'closed':!![]});}}})[_0x4d11('0x18')](function(_0x522435){logger['error'](_0x4d11('0x19'),_0x522435?util[_0x4d11('0x1a')](_0x522435,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xd7c8=['redis','localhost','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','lodash','util'];(function(_0x4cbca9,_0x1018ee){var _0x511c83=function(_0x2d84c8){while(--_0x2d84c8){_0x4cbca9['push'](_0x4cbca9['shift']());}};_0x511c83(++_0x1018ee);}(_0xd7c8,0x17a));var _0x8d7c=function(_0x4dfced,_0x274f5a){_0x4dfced=_0x4dfced-0x0;var _0xc277c9=_0xd7c8[_0x4dfced];return _0xc277c9;};'use strict';var _=require(_0x8d7c('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0x8d7c('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require('../logger')('schedule');config[_0x8d7c('0x2')]=_['defaults'](config[_0x8d7c('0x2')],{'host':_0x8d7c('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8d7c('0x2')]));function closeInteractions(){var _0x3fa5e6=[];return db['WhatsappInteraction'][_0x8d7c('0x4')]({'raw':!![],'attributes':['id',_0x8d7c('0x5')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8d7c('0x6')](0x18,_0x8d7c('0x7'))}}})[_0x8d7c('0x8')](function(_0x36afd3){if(_0x36afd3&&_0x36afd3[_0x8d7c('0x9')]){_0x3fa5e6=_['map'](_0x36afd3||[],'id');logger[_0x8d7c('0xa')](_0x8d7c('0xb'),_0x3fa5e6['join']());return db['WhatsappInteraction']['update']({'closeReason':_0x8d7c('0xc'),'disposition':_0x8d7c('0xd'),'closed':!![],'closedAt':moment()['format'](_0x8d7c('0xe'))},{'where':{'id':_0x3fa5e6}});}})[_0x8d7c('0x8')](function(){if(_0x3fa5e6&&_0x3fa5e6[_0x8d7c('0x9')]){logger[_0x8d7c('0xa')](_0x8d7c('0xf'),_0x3fa5e6[_0x8d7c('0x10')]());for(var _0x3e199c=0x0;_0x3e199c<_0x3fa5e6[_0x8d7c('0x9')];_0x3e199c++){io[_0x8d7c('0x11')](_0x8d7c('0x12'),{'id':_0x3fa5e6[_0x3e199c],'closed':!![]});}}})['catch'](function(_0x3261ae){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x3261ae?util['inspect'](_0x3261ae,{'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 b8e9c29..dc1e92f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb2b9=['util','../mysqldb','Innocenzo','Biondo','@xcally.com','push','now','innocenzo.biondo','CmContact','destroy','log','finished\x20populating','contacts1','CmHopper','then','bulkCreate','contacts2','catch'];(function(_0x348186,_0x2c4ff9){var _0x22ba55=function(_0xfc53cf){while(--_0xfc53cf){_0x348186['push'](_0x348186['shift']());}};_0x22ba55(++_0x2c4ff9);}(_0xb2b9,0xb4));var _0x9b2b=function(_0x8aad12,_0x3194f4){_0x8aad12=_0x8aad12-0x0;var _0x3f641e=_0xb2b9[_0x8aad12];return _0x3f641e;};'use strict';var util=require(_0x9b2b('0x0'));var db=require(_0x9b2b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x9b2b('0x2')+i,'lastName':_0x9b2b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9b2b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9b2b('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x9b2b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b2b('0x6')](),'updatedAt':Date[_0x9b2b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x9b2b('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x9b2b('0x7')+i+_0x9b2b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9b2b('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x9b2b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9b2b('0x6')](),'updatedAt':Date[_0x9b2b('0x6')]()});}db[_0x9b2b('0x8')][_0x9b2b('0x9')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console[_0x9b2b('0xa')](_0x9b2b('0xb'),_0x9b2b('0xc'));return db[_0x9b2b('0xd')][_0x9b2b('0x9')]({'where':{}});})[_0x9b2b('0xe')](function(){return db['CmHopper'][_0x9b2b('0xf')](hopper);})[_0x9b2b('0xe')](function(){console[_0x9b2b('0xa')](_0x9b2b('0xb'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x9b2b('0xe')](function(){console[_0x9b2b('0xa')](_0x9b2b('0xb'),_0x9b2b('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console['log'](_0x9b2b('0xb'),'hopper2');})[_0x9b2b('0x11')](function(_0x4c96a6){console[_0x9b2b('0xa')](_0x4c96a6);}); \ No newline at end of file +var _0x1f51=['innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','then','finished\x20populating','contacts1','CmHopper','destroy','log','hopper1','hopper2','catch','util','push','Innocenzo','Biondo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f51,0x12e));var _0x11f5=function(_0x499f91,_0xb00a8d){_0x499f91=_0x499f91-0x0;var _0xdbb050=_0x1f51[_0x499f91];return _0xdbb050;};'use strict';var util=require(_0x11f5('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x11f5('0x1')]({'id':i,'firstName':_0x11f5('0x2')+i,'lastName':_0x11f5('0x3')+i,'phone':0xf879fb460+i,'email':_0x11f5('0x4')+i+_0x11f5('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x11f5('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x11f5('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x11f5('0x6')](),'updatedAt':Date[_0x11f5('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x11f5('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x11f5('0x3')+i,'phone':0xf879fb460+i,'email':_0x11f5('0x4')+i+_0x11f5('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x11f5('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x11f5('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x11f5('0x6')](),'updatedAt':Date[_0x11f5('0x6')]()});}db[_0x11f5('0x7')]['destroy']({'where':{}})['then'](function(){return db[_0x11f5('0x7')][_0x11f5('0x8')](contacts);})[_0x11f5('0x9')](function(){console['log'](_0x11f5('0xa'),_0x11f5('0xb'));return db[_0x11f5('0xc')][_0x11f5('0xd')]({'where':{}});})[_0x11f5('0x9')](function(){return db[_0x11f5('0xc')][_0x11f5('0x8')](hopper);})[_0x11f5('0x9')](function(){console[_0x11f5('0xe')](_0x11f5('0xa'),_0x11f5('0xf'));return db[_0x11f5('0x7')][_0x11f5('0x8')](contacts2);})[_0x11f5('0x9')](function(){console[_0x11f5('0xe')](_0x11f5('0xa'),'contacts2');return db['CmHopper'][_0x11f5('0x8')](hopper2);})[_0x11f5('0x9')](function(){console[_0x11f5('0xe')](_0x11f5('0xa'),_0x11f5('0x10'));})[_0x11f5('0x11')](function(_0x51bbe7){console[_0x11f5('0xe')](_0x51bbe7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index b21a94c..c4d34c7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ff1=['%s%s','agent','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','push','format'];(function(_0x11f89d,_0xb2fa17){var _0x41492c=function(_0x2c6174){while(--_0x2c6174){_0x11f89d['push'](_0x11f89d['shift']());}};_0x41492c(++_0xb2fa17);}(_0x5ff1,0xf9));var _0x15ff=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x5ff1[_0x56f7e2];return _0x36240b;};'use strict';var util=require(_0x15ff('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x15ff('0x1')]({'name':util[_0x15ff('0x2')](_0x15ff('0x3'),'agent',i),'fullname':util[_0x15ff('0x2')](_0x15ff('0x3'),_0x15ff('0x4'),i),'email':util[_0x15ff('0x2')]('%s%s@xcally.com',_0x15ff('0x4'),i),'role':_0x15ff('0x4'),'password':_0x15ff('0x5'),'internal':0xfa0+i,'type':_0x15ff('0x6'),'transport':[_0x15ff('0x7'),'ws',_0x15ff('0x8')],'disallow':[_0x15ff('0x9')],'allow':[_0x15ff('0xa')],'defaultuser':util[_0x15ff('0x2')](_0x15ff('0x3'),_0x15ff('0x4'),i),'encryption':'yes','avpf':_0x15ff('0xb'),'force_avp':_0x15ff('0xb'),'icesupport':_0x15ff('0xb'),'dtlsenable':_0x15ff('0xb'),'dtlsverify':'no','dtlscertfile':_0x15ff('0xc'),'dtlsprivatekey':_0x15ff('0xd'),'dtlssetup':'actpass','callerid':util[_0x15ff('0x2')](_0x15ff('0xe'),util[_0x15ff('0x2')]('%s%s',_0x15ff('0x4'),i),0xfa0+i)});}db[_0x15ff('0xf')][_0x15ff('0x10')](users)[_0x15ff('0x11')](function(){console[_0x15ff('0x12')](_0x15ff('0x13'));})[_0x15ff('0x14')](function(_0x2231d2){console[_0x15ff('0x12')](_0x2231d2);}); \ No newline at end of file +var _0x35c4=['User','bulkCreate','then','log','add\x20user','util','../mysqldb','push','format','%s%s','agent','password','friend','udp','wss','all','yes','/etc/pki/tls/private/motion.key','actpass'];(function(_0x29ae92,_0x278e69){var _0x22c72a=function(_0x17f461){while(--_0x17f461){_0x29ae92['push'](_0x29ae92['shift']());}};_0x22c72a(++_0x278e69);}(_0x35c4,0x1f3));var _0x435c=function(_0x54030e,_0x2902b5){_0x54030e=_0x54030e-0x0;var _0x46e1fa=_0x35c4[_0x54030e];return _0x46e1fa;};'use strict';var util=require(_0x435c('0x0'));var db=require(_0x435c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x435c('0x2')]({'name':util[_0x435c('0x3')](_0x435c('0x4'),_0x435c('0x5'),i),'fullname':util['format']('%s%s',_0x435c('0x5'),i),'email':util['format']('%s%s@xcally.com',_0x435c('0x5'),i),'role':_0x435c('0x5'),'password':_0x435c('0x6'),'internal':0xfa0+i,'type':_0x435c('0x7'),'transport':[_0x435c('0x8'),'ws',_0x435c('0x9')],'disallow':[_0x435c('0xa')],'allow':['ulaw'],'defaultuser':util[_0x435c('0x3')]('%s%s',_0x435c('0x5'),i),'encryption':_0x435c('0xb'),'avpf':_0x435c('0xb'),'force_avp':_0x435c('0xb'),'icesupport':_0x435c('0xb'),'dtlsenable':_0x435c('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x435c('0xc'),'dtlssetup':_0x435c('0xd'),'callerid':util[_0x435c('0x3')]('\x22%s\x22\x20<%s>',util[_0x435c('0x3')](_0x435c('0x4'),'agent',i),0xfa0+i)});}db[_0x435c('0xe')][_0x435c('0xf')](users)[_0x435c('0x10')](function(){console[_0x435c('0x11')](_0x435c('0x12'));})['catch'](function(_0x2f7cf2){console[_0x435c('0x11')](_0x2f7cf2);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 3475ba4..6c4879a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7a8=['admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','FaxQueues','SmsQueues','SmsQueue','OpenchannelQueues','WhatsappQueues','Trunks','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','catch','join','default','address','request','connection','remoteAddress','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne','autoAssociation','VoiceQueues','ChatQueues','MailQueues','findAll','Telephones','IvrCampaigns','resourceId','then','map','where','Campaign','ivr','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s'];(function(_0x1523db,_0x49af77){var _0x2e0430=function(_0x200b3d){while(--_0x200b3d){_0x1523db['push'](_0x1523db['shift']());}};_0x2e0430(++_0x49af77);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x3db10f,_0x458fbc){_0x3db10f=_0x3db10f-0x0;var _0x2d0e25=_0xf7a8[_0x3db10f];return _0x2d0e25;};'use strict';var _=require(_0x8f7a('0x0'));var util=require('util');var BPromise=require(_0x8f7a('0x1'));var db=require(_0x8f7a('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x8f7a('0x3')],'include':[{'as':_0x8f7a('0x4'),'model':db[_0x8f7a('0x5')],'attributes':['id',_0x8f7a('0x3'),_0x8f7a('0x6')],'raw':!![],'where':{'role':_0x8f7a('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8f7a('0x3')],'where':{'role':_0x8f7a('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x8f7a('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x8f7a('0x3')],'where':{'role':_0x8f7a('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8f7a('0x3'),_0x8f7a('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4c0a4d,_0x42210b,_0x958ae4){return db[_0x8f7a('0xa')][_0x8f7a('0xb')]({'where':{'name':_0x4c0a4d,'userProfileId':_0x42210b},'raw':!![]})['then'](function(_0xbeed1d){if(_0xbeed1d){if(_0xbeed1d[_0x8f7a('0xc')]){switch(_0x4c0a4d){case _0x8f7a('0xd'):case _0x8f7a('0xe'):case'FaxQueues':case'SmsQueues':case _0x8f7a('0xf'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x958ae4][_0x8f7a('0x10')](queryQueues);case _0x8f7a('0x11'):return db[_0x958ae4][_0x8f7a('0x10')](queryTelephones);case'Trunks':return db[_0x958ae4]['findAll'](queryTrunks);case _0x8f7a('0x12'):return db[_0x958ae4][_0x8f7a('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8f7a('0x10')]({'attributes':[_0x8f7a('0x13')],'where':{'sectionId':_0xbeed1d['id']},'raw':!![]})[_0x8f7a('0x14')](function(_0x39907f){if(_0x39907f){var _0x4a7da7={'where':{'id':_[_0x8f7a('0x15')](_0x39907f,'resourceId')},'raw':!![]};switch(_0x958ae4){case'User':_0x4a7da7[_0x8f7a('0x16')][_0x8f7a('0x6')]='telephone';break;case _0x8f7a('0x17'):_0x4a7da7['where']['type']=_0x8f7a('0x18');break;}return db[_0x958ae4]['findAll'](_0x4a7da7);}else{return[];}});}}else{return[];}})['then'](function(_0x4f6b18){return _0x4f6b18;});}function joinOrLeaveQueues(_0xc236de,_0x58dc4d,_0x237cee,_0x3052b2){_0xc236de[_0x58dc4d](util[_0x8f7a('0x19')](_0x8f7a('0x1a'),_0x237cee,_0x3052b2[_0x8f7a('0x3')]));if(_0x3052b2[_0x8f7a('0x4')]){for(var _0x2fcbb7=0x0;_0x2fcbb7<_0x3052b2['Agents'][_0x8f7a('0x1b')];_0x2fcbb7+=0x1){_0xc236de[_0x58dc4d](util[_0x8f7a('0x19')]('user:%s',_0x3052b2[_0x8f7a('0x4')][_0x2fcbb7]['name']));}}}function joinOrLeave(_0x740273,_0x5b797,_0x45c1c7){var _0x52c6b1;if(_0x740273[_0x8f7a('0x1c')][_0x8f7a('0x1d')]['id']){db[_0x8f7a('0x5')][_0x8f7a('0x1e')]({'attributes':['id',_0x8f7a('0x3'),'role',_0x8f7a('0x1f')],'where':{'id':_0x740273[_0x8f7a('0x1c')][_0x8f7a('0x1d')]['id']},'include':[{'model':db[_0x8f7a('0x20')],'as':_0x8f7a('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x8f7a('0x22'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8f7a('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x8f7a('0x24')],'as':_0x8f7a('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x8f7a('0x26')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8f7a('0x27')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})['then'](function(_0x37389c){if(_0x37389c){_0x52c6b1=_0x37389c;_0x740273[_0x5b797](util[_0x8f7a('0x19')](_0x8f7a('0x28'),_0x37389c['name']));var _0x1df203=[];switch(_0x37389c['role']){case _0x8f7a('0x29'):_0x740273[_0x5b797](_0x8f7a('0x2a'));_0x740273[_0x5b797](_0x8f7a('0x2b'));if(queryQueues[_0x8f7a('0x2c')](_0x8f7a('0x2d'))){delete queryQueues['include'];}_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x2f')][_0x8f7a('0x10')](queryQueues));_0x1df203['push'](db['ChatQueue'][_0x8f7a('0x10')](queryQueues));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x30')][_0x8f7a('0x10')](queryQueues));_0x1df203[_0x8f7a('0x2e')](db['SmsQueue'][_0x8f7a('0x10')](queryQueues));_0x1df203['push'](db[_0x8f7a('0x31')][_0x8f7a('0x10')](queryQueues));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x32')]['findAll'](queryQueues));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x33')][_0x8f7a('0x10')](queryQueues));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x5')][_0x8f7a('0x10')](queryTelephones));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x34')][_0x8f7a('0x10')](queryTrunks));_0x1df203['push'](db[_0x8f7a('0x17')][_0x8f7a('0x10')](queryCampaigns));_0x1df203[_0x8f7a('0x2e')](db['User'][_0x8f7a('0x10')](queryAgents));break;case'user':_0x740273[_0x5b797]('voice:inbound');_0x740273[_0x5b797](_0x8f7a('0x2b'));_0x1df203['push'](getAssociatedResources(_0x8f7a('0xd'),_0x37389c[_0x8f7a('0x1f')],'VoiceQueue'));_0x1df203['push'](getAssociatedResources('ChatQueues',_0x37389c[_0x8f7a('0x1f')],'ChatQueue'));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x35'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x30')));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x36'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x37')));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0xf'),_0x37389c[_0x8f7a('0x1f')],'MailQueue'));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x38'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x32')));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x39'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x33')));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x11'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x5')));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x3a'),_0x37389c['userProfileId'],'Trunk'));_0x1df203[_0x8f7a('0x2e')](getAssociatedResources(_0x8f7a('0x12'),_0x37389c[_0x8f7a('0x1f')],_0x8f7a('0x17')));_0x1df203[_0x8f7a('0x2e')](db[_0x8f7a('0x5')]['findAll'](queryAgents));break;case _0x8f7a('0x7'):_0x740273[_0x5b797](_0x8f7a('0x2a'));_0x740273[_0x5b797]('voice:outbound');_0x1df203[_0x8f7a('0x2e')](_0x37389c['getVoiceQueues']({'attributes':['id',_0x8f7a('0x3')]}));_0x1df203[_0x8f7a('0x2e')](_0x37389c[_0x8f7a('0x3b')]({'attributes':['id',_0x8f7a('0x3')]}));_0x1df203[_0x8f7a('0x2e')](_0x37389c[_0x8f7a('0x3c')]({'attributes':['id',_0x8f7a('0x3')]}));_0x1df203[_0x8f7a('0x2e')](_0x37389c['getSmsQueues']({'attributes':['id',_0x8f7a('0x3')]}));_0x1df203[_0x8f7a('0x2e')](_0x37389c[_0x8f7a('0x3d')]({'attributes':['id',_0x8f7a('0x3')]}));_0x1df203[_0x8f7a('0x2e')](_0x37389c[_0x8f7a('0x3e')]({'attributes':['id','name']}));_0x1df203['push'](_0x37389c[_0x8f7a('0x3f')]({'attributes':['id',_0x8f7a('0x3')]}));break;}return BPromise[_0x8f7a('0x40')](_0x1df203);}})[_0x8f7a('0x14')](function(_0x1d8574){if(_0x1d8574&&_0x1d8574[_0x8f7a('0x1b')]){for(var _0x84469e=0x0;_0x84469e<_0x1d8574[_0x8f7a('0x1b')];_0x84469e+=0x1){for(var _0x2154aa=0x0;_0x2154aa<_0x1d8574[_0x84469e][_0x8f7a('0x1b')];_0x2154aa+=0x1){switch(_0x84469e){case 0x0:joinOrLeaveQueues(_0x740273,_0x5b797,_0x8f7a('0x41'),_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x1:joinOrLeaveQueues(_0x740273,_0x5b797,_0x8f7a('0x42'),_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x2:joinOrLeaveQueues(_0x740273,_0x5b797,'fax',_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x3:joinOrLeaveQueues(_0x740273,_0x5b797,_0x8f7a('0x43'),_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x4:joinOrLeaveQueues(_0x740273,_0x5b797,_0x8f7a('0x44'),_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x5:joinOrLeaveQueues(_0x740273,_0x5b797,'openchannel',_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x6:joinOrLeaveQueues(_0x740273,_0x5b797,_0x8f7a('0x45'),_0x1d8574[_0x84469e][_0x2154aa]);break;case 0x7:if(_0x52c6b1['role']!==_0x8f7a('0x7'))_0x740273[_0x5b797](util[_0x8f7a('0x19')](_0x8f7a('0x46'),_0x1d8574[_0x84469e][_0x2154aa][_0x8f7a('0x3')]));break;case 0x8:if(_0x52c6b1[_0x8f7a('0x6')]!==_0x8f7a('0x7'))_0x740273[_0x5b797](util[_0x8f7a('0x19')](_0x8f7a('0x47'),_0x1d8574[_0x84469e][_0x2154aa][_0x8f7a('0x3')]));break;case 0x9:if(_0x52c6b1['role']!=='agent')_0x740273[_0x5b797](util[_0x8f7a('0x19')](_0x8f7a('0x48'),_0x1d8574[_0x84469e][_0x2154aa]['type'],_0x1d8574[_0x84469e][_0x2154aa][_0x8f7a('0x3')]));break;case 0xa:_0x740273[_0x5b797](util[_0x8f7a('0x19')]('user:%s',_0x1d8574[_0x84469e][_0x2154aa]['name']));break;}}}}})[_0x8f7a('0x14')](function(){if(_0x5b797===_0x8f7a('0x49')){var _0x41e6c6=_['map'](_0x52c6b1[_0x8f7a('0x21')],'id');return _0x52c6b1[_0x8f7a('0x4a')](_0x41e6c6)[_0x8f7a('0x14')](function(){for(var _0x347f52=0x0;_0x347f52<_0x41e6c6[_0x8f7a('0x1b')];_0x347f52+=0x1){_0x45c1c7['emit'](_0x8f7a('0x4b'),{'ChatInteractionId':Number(_0x41e6c6[_0x347f52]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x14')](function(){if(_0x5b797===_0x8f7a('0x49')){var _0x429321=_['map'](_0x52c6b1[_0x8f7a('0x22')],'id');return _0x52c6b1[_0x8f7a('0x4c')](_0x429321)[_0x8f7a('0x14')](function(){for(var _0x40abb8=0x0;_0x40abb8<_0x429321['length'];_0x40abb8+=0x1){_0x45c1c7[_0x8f7a('0x4d')](_0x8f7a('0x4e'),{'MailInteractionId':Number(_0x429321[_0x40abb8]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x14')](function(){if(_0x5b797===_0x8f7a('0x49')){var _0x2d39f2=_[_0x8f7a('0x15')](_0x52c6b1[_0x8f7a('0x23')],'id');return _0x52c6b1['removeFaxInteractions'](_0x2d39f2)[_0x8f7a('0x14')](function(){for(var _0x3b8838=0x0;_0x3b8838<_0x2d39f2[_0x8f7a('0x1b')];_0x3b8838+=0x1){_0x45c1c7[_0x8f7a('0x4d')](_0x8f7a('0x4f'),{'FaxInteractionId':Number(_0x2d39f2[_0x3b8838]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x14')](function(){if(_0x5b797===_0x8f7a('0x49')){var _0x142e6a=_[_0x8f7a('0x15')](_0x52c6b1[_0x8f7a('0x25')],'id');return _0x52c6b1[_0x8f7a('0x50')](_0x142e6a)[_0x8f7a('0x14')](function(){for(var _0x37f279=0x0;_0x37f279<_0x142e6a['length'];_0x37f279+=0x1){_0x45c1c7[_0x8f7a('0x4d')](_0x8f7a('0x51'),{'SmsInteractionId':Number(_0x142e6a[_0x37f279]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x14')](function(){if(_0x5b797==='leave'){var _0x3abaac=_['map'](_0x52c6b1[_0x8f7a('0x52')],'id');return _0x52c6b1['removeOpenchannelInteractions'](_0x3abaac)['then'](function(){for(var _0x44093a=0x0;_0x44093a<_0x3abaac[_0x8f7a('0x1b')];_0x44093a+=0x1){_0x45c1c7[_0x8f7a('0x4d')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3abaac[_0x44093a]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x14')](function(){if(_0x5b797===_0x8f7a('0x49')){var _0x4549a4=_[_0x8f7a('0x15')](_0x52c6b1['WhatsappInteractions'],'id');return _0x52c6b1['removeWhatsappInteractions'](_0x4549a4)[_0x8f7a('0x14')](function(){for(var _0x29d629=0x0;_0x29d629<_0x4549a4[_0x8f7a('0x1b')];_0x29d629+=0x1){_0x45c1c7['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x4549a4[_0x29d629]),'UserId':Number(_0x52c6b1['id'])});}});}})[_0x8f7a('0x53')](function(_0x3cb997){_0x740273['log'](_0x3cb997);});}}function onDisconnect(_0x5da707,_0x53bd77){joinOrLeave(_0x5da707,_0x8f7a('0x49'),_0x53bd77);}function onConnect(_0x141478){joinOrLeave(_0x141478,_0x8f7a('0x54'));}exports[_0x8f7a('0x55')]=function(_0x23f17a){_0x23f17a['on']('connection',function(_0x37dccd){_0x37dccd['setMaxListeners'](0x0);_0x37dccd[_0x8f7a('0x56')]=_0x37dccd[_0x8f7a('0x57')][_0x8f7a('0x58')][_0x8f7a('0x59')]+':'+_0x37dccd[_0x8f7a('0x57')][_0x8f7a('0x58')]['remotePort'];_0x37dccd[_0x8f7a('0x5a')]=new Date();_0x37dccd[_0x8f7a('0x5b')]=function(_0x2919f4){console[_0x8f7a('0x5b')](_0x8f7a('0x5c')+_0x37dccd[_0x8f7a('0x5d')][_0x8f7a('0x3')]+'['+_0x37dccd[_0x8f7a('0x56')]+']',_0x2919f4);};_0x37dccd['on'](_0x8f7a('0x5e'),function(){onDisconnect(_0x37dccd,_0x23f17a);_0x37dccd[_0x8f7a('0x5b')](_0x8f7a('0x5f'));});onConnect(_0x37dccd);_0x37dccd['log'](_0x8f7a('0x60'));});}; \ No newline at end of file +var _0x5cb4=['removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','bluebird','name','Agents','User','role','agent','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','Campaign','where','type','format','%s:queue:%s','length','user:%s','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','userProfileId','SmsQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','whatsapp','leave','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x5cb4,0xc6));var _0x45cb=function(_0x4c2ceb,_0x318c32){_0x4c2ceb=_0x4c2ceb-0x0;var _0x23132a=_0x5cb4[_0x4c2ceb];return _0x23132a;};'use strict';var _=require(_0x45cb('0x0'));var util=require('util');var BPromise=require(_0x45cb('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x45cb('0x2')],'include':[{'as':_0x45cb('0x3'),'model':db[_0x45cb('0x4')],'attributes':['id',_0x45cb('0x2'),_0x45cb('0x5')],'raw':!![],'where':{'role':_0x45cb('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x45cb('0x2')],'where':{'role':_0x45cb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x45cb('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x45cb('0x2')],'where':{'role':_0x45cb('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x45cb('0x2'),'type'],'where':{'type':_0x45cb('0x8')}};function getAssociatedResources(_0x46203f,_0x37ece4,_0x2946e3){return db[_0x45cb('0x9')]['findOne']({'where':{'name':_0x46203f,'userProfileId':_0x37ece4},'raw':!![]})[_0x45cb('0xa')](function(_0x2a79a0){if(_0x2a79a0){if(_0x2a79a0[_0x45cb('0xb')]){switch(_0x46203f){case _0x45cb('0xc'):case _0x45cb('0xd'):case _0x45cb('0xe'):case'SmsQueues':case _0x45cb('0xf'):case _0x45cb('0x10'):case _0x45cb('0x11'):return db[_0x2946e3][_0x45cb('0x12')](queryQueues);case _0x45cb('0x13'):return db[_0x2946e3][_0x45cb('0x12')](queryTelephones);case _0x45cb('0x14'):return db[_0x2946e3]['findAll'](queryTrunks);case _0x45cb('0x15'):return db[_0x2946e3][_0x45cb('0x12')](queryCampaigns);}}else{return db[_0x45cb('0x16')][_0x45cb('0x12')]({'attributes':[_0x45cb('0x17')],'where':{'sectionId':_0x2a79a0['id']},'raw':!![]})[_0x45cb('0xa')](function(_0x15e87d){if(_0x15e87d){var _0x36a5bb={'where':{'id':_[_0x45cb('0x18')](_0x15e87d,'resourceId')},'raw':!![]};switch(_0x2946e3){case _0x45cb('0x4'):_0x36a5bb['where'][_0x45cb('0x5')]='telephone';break;case _0x45cb('0x19'):_0x36a5bb[_0x45cb('0x1a')][_0x45cb('0x1b')]='ivr';break;}return db[_0x2946e3][_0x45cb('0x12')](_0x36a5bb);}else{return[];}});}}else{return[];}})[_0x45cb('0xa')](function(_0x1b1b4a){return _0x1b1b4a;});}function joinOrLeaveQueues(_0x465aa7,_0x4d8218,_0x48f0a6,_0x46fc46){_0x465aa7[_0x4d8218](util[_0x45cb('0x1c')](_0x45cb('0x1d'),_0x48f0a6,_0x46fc46[_0x45cb('0x2')]));if(_0x46fc46[_0x45cb('0x3')]){for(var _0x1f13e0=0x0;_0x1f13e0<_0x46fc46['Agents'][_0x45cb('0x1e')];_0x1f13e0+=0x1){_0x465aa7[_0x4d8218](util[_0x45cb('0x1c')](_0x45cb('0x1f'),_0x46fc46[_0x45cb('0x3')][_0x1f13e0][_0x45cb('0x2')]));}}}function joinOrLeave(_0x59ceed,_0x167867,_0x3d3929){var _0x8ab32d;if(_0x59ceed[_0x45cb('0x20')][_0x45cb('0x21')]['id']){db[_0x45cb('0x4')][_0x45cb('0x22')]({'attributes':['id',_0x45cb('0x2'),'role','userProfileId'],'where':{'id':_0x59ceed[_0x45cb('0x20')][_0x45cb('0x21')]['id']},'include':[{'model':db[_0x45cb('0x23')],'as':_0x45cb('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x45cb('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x45cb('0x26'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x45cb('0x27')],'as':_0x45cb('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x45cb('0x29')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x45cb('0xa')](function(_0x2a1b32){if(_0x2a1b32){_0x8ab32d=_0x2a1b32;_0x59ceed[_0x167867](util[_0x45cb('0x1c')](_0x45cb('0x1f'),_0x2a1b32[_0x45cb('0x2')]));var _0x527a82=[];switch(_0x2a1b32[_0x45cb('0x5')]){case _0x45cb('0x2a'):_0x59ceed[_0x167867](_0x45cb('0x2b'));_0x59ceed[_0x167867](_0x45cb('0x2c'));if(queryQueues[_0x45cb('0x2d')](_0x45cb('0x2e'))){delete queryQueues[_0x45cb('0x2e')];}_0x527a82['push'](db['VoiceQueue'][_0x45cb('0x12')](queryQueues));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x30')][_0x45cb('0x12')](queryQueues));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x31')]['findAll'](queryQueues));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x32')][_0x45cb('0x12')](queryQueues));_0x527a82[_0x45cb('0x2f')](db['MailQueue'][_0x45cb('0x12')](queryQueues));_0x527a82[_0x45cb('0x2f')](db['OpenchannelQueue'][_0x45cb('0x12')](queryQueues));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x33')]['findAll'](queryQueues));_0x527a82[_0x45cb('0x2f')](db['User'][_0x45cb('0x12')](queryTelephones));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x34')][_0x45cb('0x12')](queryTrunks));_0x527a82[_0x45cb('0x2f')](db['Campaign']['findAll'](queryCampaigns));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x4')]['findAll'](queryAgents));break;case _0x45cb('0x35'):_0x59ceed[_0x167867]('voice:inbound');_0x59ceed[_0x167867](_0x45cb('0x2c'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources(_0x45cb('0xc'),_0x2a1b32[_0x45cb('0x36')],'VoiceQueue'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources(_0x45cb('0xd'),_0x2a1b32[_0x45cb('0x36')],'ChatQueue'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources('FaxQueues',_0x2a1b32[_0x45cb('0x36')],'FaxQueue'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources(_0x45cb('0x37'),_0x2a1b32[_0x45cb('0x36')],_0x45cb('0x32')));_0x527a82[_0x45cb('0x2f')](getAssociatedResources('MailQueues',_0x2a1b32[_0x45cb('0x36')],'MailQueue'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources(_0x45cb('0x10'),_0x2a1b32[_0x45cb('0x36')],'OpenchannelQueue'));_0x527a82[_0x45cb('0x2f')](getAssociatedResources('WhatsappQueues',_0x2a1b32[_0x45cb('0x36')],_0x45cb('0x33')));_0x527a82['push'](getAssociatedResources(_0x45cb('0x13'),_0x2a1b32[_0x45cb('0x36')],_0x45cb('0x4')));_0x527a82[_0x45cb('0x2f')](getAssociatedResources('Trunks',_0x2a1b32[_0x45cb('0x36')],_0x45cb('0x34')));_0x527a82['push'](getAssociatedResources(_0x45cb('0x15'),_0x2a1b32[_0x45cb('0x36')],_0x45cb('0x19')));_0x527a82[_0x45cb('0x2f')](db[_0x45cb('0x4')]['findAll'](queryAgents));break;case _0x45cb('0x6'):_0x59ceed[_0x167867]('voice:inbound');_0x59ceed[_0x167867]('voice:outbound');_0x527a82[_0x45cb('0x2f')](_0x2a1b32['getVoiceQueues']({'attributes':['id',_0x45cb('0x2')]}));_0x527a82['push'](_0x2a1b32[_0x45cb('0x38')]({'attributes':['id',_0x45cb('0x2')]}));_0x527a82[_0x45cb('0x2f')](_0x2a1b32[_0x45cb('0x39')]({'attributes':['id',_0x45cb('0x2')]}));_0x527a82['push'](_0x2a1b32[_0x45cb('0x3a')]({'attributes':['id','name']}));_0x527a82[_0x45cb('0x2f')](_0x2a1b32['getMailQueues']({'attributes':['id',_0x45cb('0x2')]}));_0x527a82[_0x45cb('0x2f')](_0x2a1b32['getOpenchannelQueues']({'attributes':['id',_0x45cb('0x2')]}));_0x527a82[_0x45cb('0x2f')](_0x2a1b32[_0x45cb('0x3b')]({'attributes':['id',_0x45cb('0x2')]}));break;}return BPromise[_0x45cb('0x3c')](_0x527a82);}})[_0x45cb('0xa')](function(_0x44ac34){if(_0x44ac34&&_0x44ac34[_0x45cb('0x1e')]){for(var _0x275dc9=0x0;_0x275dc9<_0x44ac34[_0x45cb('0x1e')];_0x275dc9+=0x1){for(var _0x2174ca=0x0;_0x2174ca<_0x44ac34[_0x275dc9][_0x45cb('0x1e')];_0x2174ca+=0x1){switch(_0x275dc9){case 0x0:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x3d'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x1:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x3e'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x2:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x3f'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x3:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x40'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x4:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x41'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x5:joinOrLeaveQueues(_0x59ceed,_0x167867,'openchannel',_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x6:joinOrLeaveQueues(_0x59ceed,_0x167867,_0x45cb('0x42'),_0x44ac34[_0x275dc9][_0x2174ca]);break;case 0x7:if(_0x8ab32d[_0x45cb('0x5')]!==_0x45cb('0x6'))_0x59ceed[_0x167867](util['format']('telephone:%s',_0x44ac34[_0x275dc9][_0x2174ca][_0x45cb('0x2')]));break;case 0x8:if(_0x8ab32d['role']!==_0x45cb('0x6'))_0x59ceed[_0x167867](util['format']('trunk:%s',_0x44ac34[_0x275dc9][_0x2174ca][_0x45cb('0x2')]));break;case 0x9:if(_0x8ab32d[_0x45cb('0x5')]!==_0x45cb('0x6'))_0x59ceed[_0x167867](util[_0x45cb('0x1c')]('campaign:%s:%s',_0x44ac34[_0x275dc9][_0x2174ca][_0x45cb('0x1b')],_0x44ac34[_0x275dc9][_0x2174ca][_0x45cb('0x2')]));break;case 0xa:_0x59ceed[_0x167867](util[_0x45cb('0x1c')](_0x45cb('0x1f'),_0x44ac34[_0x275dc9][_0x2174ca]['name']));break;}}}}})['then'](function(){if(_0x167867===_0x45cb('0x43')){var _0x504d1b=_[_0x45cb('0x18')](_0x8ab32d[_0x45cb('0x24')],'id');return _0x8ab32d['removeChatInteractions'](_0x504d1b)['then'](function(){for(var _0x42a21f=0x0;_0x42a21f<_0x504d1b[_0x45cb('0x1e')];_0x42a21f+=0x1){_0x3d3929[_0x45cb('0x44')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x504d1b[_0x42a21f]),'UserId':Number(_0x8ab32d['id'])});}});}})['then'](function(){if(_0x167867===_0x45cb('0x43')){var _0x2d4f2d=_[_0x45cb('0x18')](_0x8ab32d['MailInteractions'],'id');return _0x8ab32d[_0x45cb('0x45')](_0x2d4f2d)[_0x45cb('0xa')](function(){for(var _0x35e44c=0x0;_0x35e44c<_0x2d4f2d[_0x45cb('0x1e')];_0x35e44c+=0x1){_0x3d3929[_0x45cb('0x44')](_0x45cb('0x46'),{'MailInteractionId':Number(_0x2d4f2d[_0x35e44c]),'UserId':Number(_0x8ab32d['id'])});}});}})['then'](function(){if(_0x167867===_0x45cb('0x43')){var _0x390d43=_[_0x45cb('0x18')](_0x8ab32d[_0x45cb('0x26')],'id');return _0x8ab32d[_0x45cb('0x47')](_0x390d43)[_0x45cb('0xa')](function(){for(var _0x2b89b5=0x0;_0x2b89b5<_0x390d43['length'];_0x2b89b5+=0x1){_0x3d3929[_0x45cb('0x44')](_0x45cb('0x48'),{'FaxInteractionId':Number(_0x390d43[_0x2b89b5]),'UserId':Number(_0x8ab32d['id'])});}});}})['then'](function(){if(_0x167867===_0x45cb('0x43')){var _0x401ef4=_[_0x45cb('0x18')](_0x8ab32d[_0x45cb('0x49')],'id');return _0x8ab32d[_0x45cb('0x4a')](_0x401ef4)[_0x45cb('0xa')](function(){for(var _0x4bf263=0x0;_0x4bf263<_0x401ef4['length'];_0x4bf263+=0x1){_0x3d3929[_0x45cb('0x44')](_0x45cb('0x4b'),{'SmsInteractionId':Number(_0x401ef4[_0x4bf263]),'UserId':Number(_0x8ab32d['id'])});}});}})[_0x45cb('0xa')](function(){if(_0x167867===_0x45cb('0x43')){var _0x52cf8f=_[_0x45cb('0x18')](_0x8ab32d[_0x45cb('0x28')],'id');return _0x8ab32d['removeOpenchannelInteractions'](_0x52cf8f)[_0x45cb('0xa')](function(){for(var _0x2465cd=0x0;_0x2465cd<_0x52cf8f[_0x45cb('0x1e')];_0x2465cd+=0x1){_0x3d3929[_0x45cb('0x44')](_0x45cb('0x4c'),{'OpenchannelInteractionId':Number(_0x52cf8f[_0x2465cd]),'UserId':Number(_0x8ab32d['id'])});}});}})[_0x45cb('0xa')](function(){if(_0x167867===_0x45cb('0x43')){var _0x1219cb=_['map'](_0x8ab32d[_0x45cb('0x4d')],'id');return _0x8ab32d[_0x45cb('0x4e')](_0x1219cb)['then'](function(){for(var _0x23fabf=0x0;_0x23fabf<_0x1219cb['length'];_0x23fabf+=0x1){_0x3d3929[_0x45cb('0x44')](_0x45cb('0x4f'),{'WhatsappInteractionId':Number(_0x1219cb[_0x23fabf]),'UserId':Number(_0x8ab32d['id'])});}});}})[_0x45cb('0x50')](function(_0x306499){_0x59ceed[_0x45cb('0x51')](_0x306499);});}}function onDisconnect(_0x4529a3,_0x23ead2){joinOrLeave(_0x4529a3,_0x45cb('0x43'),_0x23ead2);}function onConnect(_0x3e4900){joinOrLeave(_0x3e4900,'join');}exports[_0x45cb('0x52')]=function(_0x1d5ddd){_0x1d5ddd['on'](_0x45cb('0x53'),function(_0x7df3d8){_0x7df3d8[_0x45cb('0x54')](0x0);_0x7df3d8[_0x45cb('0x55')]=_0x7df3d8[_0x45cb('0x56')][_0x45cb('0x53')][_0x45cb('0x57')]+':'+_0x7df3d8[_0x45cb('0x56')][_0x45cb('0x53')]['remotePort'];_0x7df3d8['connectedAt']=new Date();_0x7df3d8[_0x45cb('0x51')]=function(_0x535402){console[_0x45cb('0x51')](_0x45cb('0x58')+_0x7df3d8[_0x45cb('0x59')][_0x45cb('0x2')]+'['+_0x7df3d8['address']+']',_0x535402);};_0x7df3d8['on'](_0x45cb('0x5a'),function(){onDisconnect(_0x7df3d8,_0x1d5ddd);_0x7df3d8[_0x45cb('0x51')]('DISCONNECTED');});onConnect(_0x7df3d8);_0x7df3d8['log'](_0x45cb('0x5b'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 44587e0..de67593 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 _0x31fb=['newmessage','SmsInteraction','Sms','afterUpdate','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','motionChannel','event','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','name','agent','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','format','SIP/%s','AfterCreate','closed','substatus','AfterUpdate','User','find','fullname','email','internal','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage'];(function(_0x50f2ca,_0x2beedb){var _0x9b5f5b=function(_0xe3c835){while(--_0xe3c835){_0x50f2ca['push'](_0x50f2ca['shift']());}};_0x9b5f5b(++_0x2beedb);}(_0x31fb,0x1b6));var _0xb31f=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x31fb[_0x5037ab];return _0x512adb;};'use strict';var util=require(_0xb31f('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb31f('0x1'));var logger=require(_0xb31f('0x2'))(_0xb31f('0x3'));var client=jayson[_0xb31f('0x4')][_0xb31f('0x5')]({'port':0x232a});var triggers=[{'channel':_0xb31f('0x6'),'model':_0xb31f('0x7'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':_0xb31f('0x6'),'model':_0xb31f('0x7'),'event':'afterUpdate','condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0x6'),'model':_0xb31f('0xb'),'event':_0xb31f('0x8'),'condition':_0xb31f('0xc'),'callback':afterCreateMessage},{'channel':_0xb31f('0x6'),'model':'ChatOfflineMessage','event':_0xb31f('0x8'),'condition':_0xb31f('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':_0xb31f('0xd'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':_0xb31f('0xe'),'model':_0xb31f('0xd'),'event':_0xb31f('0xf'),'condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0xe'),'model':_0xb31f('0x10'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb31f('0x11'),'model':_0xb31f('0x12'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xb31f('0x12'),'event':_0xb31f('0xf'),'condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0x11'),'model':_0xb31f('0x13'),'event':_0xb31f('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xb31f('0x14'),'model':_0xb31f('0x15'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':_0xb31f('0x14'),'model':_0xb31f('0x15'),'event':_0xb31f('0xf'),'condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0x14'),'model':_0xb31f('0x16'),'event':_0xb31f('0x8'),'condition':_0xb31f('0xc'),'callback':afterCreateMessage},{'channel':_0xb31f('0x17'),'model':_0xb31f('0x18'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':_0xb31f('0x17'),'model':'MailInteraction','event':_0xb31f('0xf'),'condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0x17'),'model':_0xb31f('0x19'),'event':'afterCreate','condition':_0xb31f('0xc'),'callback':afterCreateMessage},{'channel':_0xb31f('0x1a'),'model':_0xb31f('0x1b'),'event':_0xb31f('0x8'),'condition':_0xb31f('0x9'),'callback':afterCreate},{'channel':_0xb31f('0x1a'),'model':_0xb31f('0x1b'),'event':_0xb31f('0xf'),'condition':_0xb31f('0xa'),'callback':afterUpdate},{'channel':_0xb31f('0x1a'),'model':_0xb31f('0x1c'),'event':'afterCreate','condition':_0xb31f('0xc'),'callback':afterCreateMessage}];function request(_0x491580){return client['request'](_0xb31f('0x1d'),_0x491580)[_0xb31f('0x1e')](function(_0x1bbb85){logger[_0xb31f('0x1f')](_0xb31f('0x20'),_0xb31f('0x1d'),_0x1bbb85);if(_0x1bbb85[_0xb31f('0x21')]){if(_0x1bbb85[_0xb31f('0x21')][_0xb31f('0x22')]===0x1f4){logger[_0xb31f('0x21')](_0xb31f('0x20'),_0xb31f('0x1d'),_0x1bbb85[_0xb31f('0x21')]);}}})[_0xb31f('0x23')](function(_0x27e468){logger[_0xb31f('0x21')]('Trigger,\x20%s',_0xb31f('0x1d'),_0x27e468);});}function afterCreateMessage(_0x11bc62){return function(_0x1857b9){_0x1857b9=_0x1857b9['get']({'plain':!![]});_0x1857b9[_0xb31f('0x24')]=_0x11bc62;_0x1857b9[_0xb31f('0x25')]=_0x11bc62;_0x1857b9[_0xb31f('0x26')]=_0x1857b9['direction'];Promise[_0xb31f('0x27')]()[_0xb31f('0x1e')](function(){if(typeof _0x1857b9[_0xb31f('0x28')]===_0xb31f('0x29'))return null;var _0x2fd688=_0xb31f('0x2a')+_0x1857b9[_0xb31f('0x28')];return db[_0xb31f('0x2b')][_0xb31f('0x2c')](_0x2fd688,{'type':db[_0xb31f('0x2d')][_0xb31f('0x2e')][_0xb31f('0x2f')],'raw':!![]});})[_0xb31f('0x1e')](function(_0x1b4aa5){if(_0x1b4aa5){_0x1857b9[_0xb31f('0x30')]=_0x1b4aa5[0x0];}if(typeof _0x1857b9[_0xb31f('0x31')]==='undefined')return;return getAgent(_0x1857b9[_0xb31f('0x31')]);})[_0xb31f('0x1e')](function(_0x2d47ae){if(_0x2d47ae){_0x1857b9[_0xb31f('0x32')]=util['format']('SIP/%s',_0x2d47ae[_0xb31f('0x33')]);_0x1857b9[_0xb31f('0x34')]=_0x2d47ae;_0x1857b9[_0xb31f('0x24')]=_0x11bc62;return request({'event':_0xb31f('0x35'),'message':_0x1857b9});}else{return request({'event':_0xb31f('0x36'),'message':_0x1857b9});}})['catch'](function(_0x928dde){logger['error'](_0xb31f('0x20'),_0xb31f('0x37'),_0x928dde);});};}function afterCreateOfflineMessage(_0x5e1390){return function(_0x3079f6){_0x3079f6=_0x3079f6[_0xb31f('0x38')]({'plain':!![]});_0x3079f6[_0xb31f('0x24')]=_0x5e1390;_0x3079f6[_0xb31f('0x25')]=_0x5e1390;_0x3079f6['event']=_0xb31f('0x39');return request({'event':_0x3079f6['event'],'message':_0x3079f6});};}function afterCreate(_0x28f4b1,_0x4c7f05){return function(_0x3ef49e){_0x3ef49e=_0x3ef49e['get']({'plain':!![]});_0x3ef49e['channel']=_0x28f4b1;_0x3ef49e['motionChannel']=_0x28f4b1;_0x3ef49e[_0xb31f('0x26')]='opened';Promise['resolve']()[_0xb31f('0x1e')](function(){var _0x59c4e5=_0xb31f('0x2a')+_0x3ef49e['ContactId'];return db[_0xb31f('0x2b')][_0xb31f('0x2c')](_0x59c4e5,{'type':db[_0xb31f('0x2d')][_0xb31f('0x2e')]['SELECT'],'raw':!![]});})[_0xb31f('0x1e')](function(_0x7138ad){if(_0x7138ad){_0x3ef49e[_0xb31f('0x30')]=_0x7138ad[0x0];}if(typeof _0x3ef49e['UserId']===_0xb31f('0x29'))return;return getAgent(_0x3ef49e['UserId']);})[_0xb31f('0x1e')](function(_0x4df458){if(_0x4df458){_0x3ef49e['interface']=util[_0xb31f('0x3a')](_0xb31f('0x3b'),_0x4df458['name']);_0x3ef49e[_0xb31f('0x34')]=_0x4df458;}return request({'event':_0x4c7f05,'message':_0x3ef49e});})[_0xb31f('0x23')](function(_0x184b30){logger[_0xb31f('0x21')](_0xb31f('0x20'),_0xb31f('0x3c'),_0x184b30);});};}function afterUpdate(_0x37a536){return function(_0x3c31aa){var _0x334df2=_0x3c31aa['changed'](_0xb31f('0x3d'))&&_0x3c31aa[_0xb31f('0x3d')];var _0x54446e=_0x3c31aa['changed']('substatus');if(_0x334df2||_0x54446e){var _0x26cf01=_0x334df2?'closedinteraction':_0xb31f('0x3e');var _0x226aa6=_0x3c31aa[_0xb31f('0x38')]({'plain':!![]});_0x226aa6[_0xb31f('0x24')]=_0x37a536;_0x226aa6['motionChannel']=_0x37a536;_0x226aa6[_0xb31f('0x26')]=_0x334df2?_0xb31f('0x3d'):_0xb31f('0x3e');var _0x5d4a66=_0xb31f('0x2a')+_0x226aa6[_0xb31f('0x28')];return db['sequelize'][_0xb31f('0x2c')](_0x5d4a66,{'type':db[_0xb31f('0x2d')][_0xb31f('0x2e')]['SELECT'],'raw':!![]})[_0xb31f('0x1e')](function(_0x3db8f7){if(_0x3db8f7){_0x226aa6['contact']=_0x3db8f7[0x0];}if(typeof _0x226aa6['UserId']===_0xb31f('0x29'))return;return getAgent(_0x226aa6[_0xb31f('0x31')]);})[_0xb31f('0x1e')](function(_0xc7d363){if(_0xc7d363){_0x226aa6[_0xb31f('0x32')]=util[_0xb31f('0x3a')](_0xb31f('0x3b'),_0xc7d363['name']);_0x226aa6[_0xb31f('0x34')]=_0xc7d363;}return request({'event':_0x26cf01,'message':_0x226aa6});})[_0xb31f('0x23')](function(_0xf6d185){logger[_0xb31f('0x21')](_0xb31f('0x20'),_0xb31f('0x3f'),_0xf6d185);});}};}function getAgent(_0x1c01ae){return db[_0xb31f('0x40')][_0xb31f('0x41')]({'where':{'id':_0x1c01ae},'attributes':['id',_0xb31f('0x33'),_0xb31f('0x42'),_0xb31f('0x43'),_0xb31f('0x44')],'raw':!![]})[_0xb31f('0x1e')](function(_0x2676fa){return _0x2676fa;});}exports['default']=function(){for(var _0x1f9eab=0x0;_0x1f9eab=_0x484f9a[_0xe304('0x10')]){throw Error(_0xe304('0x11'));}_0x109beb(_0x148a1c);})[_0xe304('0x12')](function(_0xa7608e){_0x5b6fee(_0xa7608e);});});}; \ No newline at end of file +var _0x750a=['count','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','bluebird','./license/util','voice','mail','chat','fax','sms','whatsapp','getChannels','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','role','agent','User'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0x750a,0x9f));var _0xa750=function(_0x5bbd2e,_0x25155a){_0x5bbd2e=_0x5bbd2e-0x0;var _0x469456=_0x750a[_0x5bbd2e];return _0x469456;};'use strict';var _=require('lodash');var BPromise=require(_0xa750('0x0'));var db=require('../mysqldb')['db'];var util=require(_0xa750('0x1'));var channels=[_0xa750('0x2'),_0xa750('0x3'),_0xa750('0x4'),_0xa750('0x5'),_0xa750('0x6'),_0xa750('0x7'),'openchannel'];exports[_0xa750('0x8')]=function(){return channels;};exports[_0xa750('0x9')]=function(_0x30b5f8){_0x30b5f8=_0x30b5f8['toLowerCase']();return _[_0xa750('0xa')](channels,_0x30b5f8);};exports['clearBlockUser']=function(_0x32d0e9,_0x144d46,_0x2706c6,_0x33387a){var _0x312c4e={'loginAttempts':_0x144d46,'blocked':_0x2706c6};if(!_[_0xa750('0xb')](_0x33387a)){_0x312c4e[_0xa750('0xc')]=_0x33387a;}return _0x32d0e9[_0xa750('0xd')](_0x312c4e);};exports['getLicense']=function(_0x42203a){return new BPromise(function(_0x27cfa6,_0x38358b){var _0x250111=0x0;if(_0x42203a[_0xa750('0xe')]!==_0xa750('0xf')){_0x27cfa6(_0x42203a);}db[_0xa750('0x10')][_0xa750('0x11')]({'where':{'role':_0xa750('0xf'),'online':!![],'id':{'$ne':_0x42203a['id']}}})[_0xa750('0x12')](function(_0x52d423){_0x250111=_0x52d423;return util[_0xa750('0x13')]();})[_0xa750('0x12')](function(_0x107f81){if(_0x107f81&&_0x107f81[_0xa750('0x14')]&&_0x250111>=_0x107f81['agents']){throw Error(_0xa750('0x15'));}_0x27cfa6(_0x42203a);})['catch'](function(_0x2ed3c7){_0x38358b(_0x2ed3c7);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 20c1095..96e5408 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc627=['404','status','render','json','exports'];(function(_0x4e0a03,_0x5eb6b0){var _0x2478fc=function(_0x59afcc){while(--_0x59afcc){_0x4e0a03['push'](_0x4e0a03['shift']());}};_0x2478fc(++_0x5eb6b0);}(_0xc627,0x90));var _0x7c62=function(_0x3deabc,_0x4a4791){_0x3deabc=_0x3deabc-0x0;var _0x386851=_0xc627[_0x3deabc];return _0x386851;};'use strict';module[_0x7c62('0x0')][0x194]=function pageNotFound(_0x3b7800,_0x27f20b){var _0x2fbcd1=_0x7c62('0x1');var _0x1bfc4b=0x194;var _0x28e081={'status':_0x1bfc4b};_0x27f20b[_0x7c62('0x2')](_0x28e081[_0x7c62('0x2')]);_0x27f20b[_0x7c62('0x3')](_0x2fbcd1,{},function(_0x20e737,_0xd2520d){if(_0x20e737){return _0x27f20b[_0x7c62('0x2')](_0x28e081[_0x7c62('0x2')])[_0x7c62('0x4')](_0x28e081);}_0x27f20b['send'](_0xd2520d);});}; \ No newline at end of file +var _0x40be=['status','render','json','send','exports','404'];(function(_0x2af0e6,_0x54b916){var _0x2d9592=function(_0x9163ac){while(--_0x9163ac){_0x2af0e6['push'](_0x2af0e6['shift']());}};_0x2d9592(++_0x54b916);}(_0x40be,0x100));var _0xe40b=function(_0x3d6b12,_0x4f5261){_0x3d6b12=_0x3d6b12-0x0;var _0x5d01c9=_0x40be[_0x3d6b12];return _0x5d01c9;};'use strict';module[_0xe40b('0x0')][0x194]=function pageNotFound(_0x1cb3fe,_0x361768){var _0x3100a7=_0xe40b('0x1');var _0x568e57=0x194;var _0xa37e2d={'status':_0x568e57};_0x361768[_0xe40b('0x2')](_0xa37e2d[_0xe40b('0x2')]);_0x361768[_0xe40b('0x3')](_0x3100a7,{},function(_0x2ef5c2,_0x1b5fcb){if(_0x2ef5c2){return _0x361768[_0xe40b('0x2')](_0xa37e2d[_0xe40b('0x2')])[_0xe40b('0x4')](_0xa37e2d);}_0x361768[_0xe40b('0x5')](_0x1b5fcb);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index d40a931..6100395 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa44a=['Dispositions','Answers','Messages','TemplateId','Agents','user_has_mail_accounts','team_has_mail_queues','Account','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','List','DashboardItem','FaxAccountId','Interactions','FaxApplication','Exntensions','ListId','user_has_fax_accounts','Owner','fax_interaction_has_tags','Tags','FaxInteractionId','Attachment','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','Attachments','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','OneAll','AutomationAllId','OneAny','Actions','AutomationId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllConditions','AllCondition','Trigger','AnyCondition','TriggerId','Fields','CustomReportId','MetricId','Configurations','AccountId','Subjects','SubjectId','DescriptionId','FieldId','Description','Field','VariableId','SugarcrmAccount','Subject','Descriptions','int_desk_configuration_has_tags','ZohoAccount','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','FreshsalesField','ChatInternalMessage','FromId','SessionId','ProjectId','user_has_square_projects','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','CustomFields','HopperHistory','Queues','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappAccount','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','WhatsappQueue','ToQueueId','WhatsappQueueId','exports','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','xC@LL1234','utf8mb4','utf8','password','database','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','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','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','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','../api/squareProject/squareProject.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','SmsTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','cascade','UserId','Recordings','hasMany','VoiceQueuesRt','Extensions','OpenchannelInteraction','OpenchannelInteractions','FaxInteractions','MailInteraction','MailInteractions','UserNotifications','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','UserFaxQueue','SmsQueue','SmsQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','OpenchannelAccount','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','SpiedAgents','ChanSpyId','Applications','Members','Hoppers','VoiceQueueId','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','TeamVoiceQueue','VoiceRecording','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','CloudProviderId','restrict','hasOne','Imap','Smtp'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa44a,0x9a));var _0xaa44=function(_0x36402a,_0x2f929f){_0x36402a=_0x36402a-0x0;var _0x15e35c=_0xa44a[_0x36402a];return _0x15e35c;};'use strict';var config=require(_0xaa44('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xaa44('0x1'));var timezone=jstz[_0xaa44('0x2')]();config[_0xaa44('0x3')]=_[_0xaa44('0x4')](config[_0xaa44('0x3')],{'database':_0xaa44('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0xaa44('0x6'),'port':0xcea,'dialect':_0xaa44('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xaa44('0x8')](),'define':{'charset':'utf8','collate':_0xaa44('0x9')}}});config[_0xaa44('0xa')]=_['defaultsDeep'](config[_0xaa44('0xa')],{'database':_0xaa44('0x5'),'username':'xcall','password':_0xaa44('0xb'),'options':{'host':_0xaa44('0x6'),'port':0xcea,'dialect':_0xaa44('0x7'),'dialectOptions':{'charset':_0xaa44('0xc')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xaa44('0xd'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaa44('0x3')]['database'],config['sequelize']['username'],config[_0xaa44('0x3')][_0xaa44('0xe')],config[_0xaa44('0x3')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xaa44('0xa')][_0xaa44('0xf')],config['sequelizeHistory']['username'],config[_0xaa44('0xa')][_0xaa44('0xe')],config['sequelizeHistory']['options'])};db[_0xaa44('0x10')]=db['sequelize'][_0xaa44('0x11')]('../api/user/user.model');db[_0xaa44('0x12')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x13'));db[_0xaa44('0x14')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x15'));db[_0xaa44('0x16')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x17'));db[_0xaa44('0x18')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xaa44('0x19')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x1a'));db['VoiceRecording']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x1b'));db[_0xaa44('0x1c')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x1d'));db[_0xaa44('0x1e')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/voiceMail/voiceMail.model');db[_0xaa44('0x1f')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x20'));db[_0xaa44('0x21')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/voiceCallReport/voiceCallReport.model');db[_0xaa44('0x22')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x23'));db['VoiceAgentReport']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x24'));db[_0xaa44('0x25')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x26'));db[_0xaa44('0x27')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x28'));db['Trunk']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x29'));db[_0xaa44('0x2a')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xaa44('0x2b')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xaa44('0x2c')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x2d'));db['UserChatQueue']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x2e'));db[_0xaa44('0x2f')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x30'));db['UserFaxQueue']=db['sequelize']['import'](_0xaa44('0x31'));db[_0xaa44('0x32')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x33'));db[_0xaa44('0x34')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x35'));db[_0xaa44('0x36')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x37'));db[_0xaa44('0x38')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x39'));db['MailServerOut']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x3a'));db[_0xaa44('0x3b')]=db['sequelize']['import'](_0xaa44('0x3c'));db['MailQueue']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x3d'));db['MailSubstatus']=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x3e'));db[_0xaa44('0x3f')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/mailMessage/mailMessage.model');db[_0xaa44('0x40')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x41'));db[_0xaa44('0x42')]=db[_0xaa44('0x3')]['import'](_0xaa44('0x43'));db[_0xaa44('0x44')]=db['sequelize']['import'](_0xaa44('0x45'));db['DashboardItem']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x46'));db[_0xaa44('0x47')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x48'));db['FaxApplication']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x49'));db['FaxInteraction']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x4a'));db[_0xaa44('0x4b')]=db[_0xaa44('0x3')]['import'](_0xaa44('0x4c'));db[_0xaa44('0x4d')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x4e'));db[_0xaa44('0x4f')]=db['sequelize'][_0xaa44('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0xaa44('0x50')]=db['sequelize']['import'](_0xaa44('0x51'));db[_0xaa44('0x52')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/smsApplication/smsApplication.model');db[_0xaa44('0x53')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x54'));db[_0xaa44('0x55')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x56'));db['OpenchannelAccount']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x57'));db['OpenchannelApplication']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x58'));db['OpenchannelInteraction']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x59'));db[_0xaa44('0x5a')]=db['sequelize']['import'](_0xaa44('0x5b'));db[_0xaa44('0x5c')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0xaa44('0x5d')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x5e'));db[_0xaa44('0x5f')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x60'));db[_0xaa44('0x61')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x62'));db[_0xaa44('0x63')]=db['sequelize'][_0xaa44('0x11')]('../api/chatInteraction/chatInteraction.model');db[_0xaa44('0x64')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/chatMessage/chatMessage.model');db[_0xaa44('0x65')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x66'));db[_0xaa44('0x67')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x68'));db[_0xaa44('0x69')]=db[_0xaa44('0x3')]['import'](_0xaa44('0x6a'));db[_0xaa44('0x6b')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x6c'));db[_0xaa44('0x6d')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x6e'));db[_0xaa44('0x6f')]=db[_0xaa44('0x3')]['import']('../api/cmContact/cmContact.model');db[_0xaa44('0x70')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x71'));db[_0xaa44('0x72')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x73'));db[_0xaa44('0x74')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xaa44('0x75')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x76'));db[_0xaa44('0x77')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x78'));db['CmCustomField']=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0xaa44('0x79')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x7a'));db[_0xaa44('0x7b')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x7c'));db[_0xaa44('0x7d')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x7e'));db[_0xaa44('0x7f')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x80'));db[_0xaa44('0x81')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x82'));db[_0xaa44('0x83')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x84'));db[_0xaa44('0x85')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x86'));db[_0xaa44('0x87')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x88'));db[_0xaa44('0x89')]=db[_0xaa44('0x3')]['import'](_0xaa44('0x8a'));db[_0xaa44('0x8b')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x8c'));db[_0xaa44('0x8d')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/sound/sound.model');db[_0xaa44('0x8e')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0x8f'));db[_0xaa44('0x90')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x91'));db['Trigger']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x92'));db[_0xaa44('0x93')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x94'));db['Integration']=db[_0xaa44('0x3')]['import'](_0xaa44('0x95'));db[_0xaa44('0x96')]=db[_0xaa44('0x3')]['import']('../api/integrationReport/integrationReport.model');db[_0xaa44('0x97')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x98'));db['AnalyticDefaultReport']=db[_0xaa44('0x3')]['import'](_0xaa44('0x99'));db[_0xaa44('0x9a')]=db[_0xaa44('0x3')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xaa44('0x9b')]=db[_0xaa44('0x3')]['import'](_0xaa44('0x9c'));db[_0xaa44('0x9d')]=db[_0xaa44('0x3')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0xaa44('0x9e')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xaa44('0x9f')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xa0'));db[_0xaa44('0xa1')]=db[_0xaa44('0x3')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xaa44('0xa2')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xa3'));db['SugarcrmAccount']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xa4'));db[_0xaa44('0xa5')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xaa44('0xa6')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xa7'));db[_0xaa44('0xa8')]=db[_0xaa44('0x3')]['import']('../api/intDeskAccount/intDeskAccount.model');db[_0xaa44('0xa9')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xaa'));db[_0xaa44('0xab')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xac'));db[_0xaa44('0xad')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xae'));db['ZohoField']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xaf'));db[_0xaa44('0xb0')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xb1'));db[_0xaa44('0xb2')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xb3'));db[_0xaa44('0xb4')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xb5'));db[_0xaa44('0xb6')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xaa44('0x3')]['import'](_0xaa44('0xb7'));db[_0xaa44('0xb8')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xb9'));db[_0xaa44('0xba')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xbb'));db[_0xaa44('0xbc')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xbd'));db['ServicenowAccount']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xbe'));db[_0xaa44('0xbf')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xc0'));db[_0xaa44('0xc1')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xc2'));db['Dynamics365Account']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xc3'));db[_0xaa44('0xc4')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xc5'));db[_0xaa44('0xc6')]=db['sequelize'][_0xaa44('0x11')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xaa44('0xc7')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xc8'));db[_0xaa44('0xc9')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xca'));db['FreshsalesField']=db['sequelize'][_0xaa44('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x95'));db['Network']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xcb'));db[_0xaa44('0xcc')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xcd'));db['ChatInternalMessage']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xce'));db[_0xaa44('0xcf')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xd0'));db[_0xaa44('0xd1')]=db['sequelize']['import'](_0xaa44('0xd2'));db[_0xaa44('0xd3')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xd4'));db[_0xaa44('0xd5')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xd6'));db[_0xaa44('0xd7')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xd8'));db[_0xaa44('0xd9')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xda'));db[_0xaa44('0xdb')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xdc'));db[_0xaa44('0xdd')]=db['sequelize']['import'](_0xaa44('0xde'));db[_0xaa44('0xdf')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xe0'));db['SquareProject']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xe1'));db['SquareRecording']=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xe2'));db[_0xaa44('0xe3')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xe4'));db[_0xaa44('0xe5')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/license/license.model');db[_0xaa44('0xe6')]=db[_0xaa44('0x3')]['import']('../api/campaign/campaign.model');db[_0xaa44('0xe7')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xe8'));db['Attachment']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xe9'));db[_0xaa44('0xea')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xeb'));db['ChatTransferReport']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xec'));db[_0xaa44('0xed')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/faxTransferReport/faxTransferReport.model');db['OpenchannelTransferReport']=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xaa44('0xee')]=db['sequelize'][_0xaa44('0x11')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xef'));db[_0xaa44('0xf0')]=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xf1'));db[_0xaa44('0xf2')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db['sequelize'][_0xaa44('0x11')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize'][_0xaa44('0x11')](_0xaa44('0xf3'));db[_0xaa44('0xf4')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xf5'));db['WhatsappAccount']=db['sequelize']['import'](_0xaa44('0xf6'));db[_0xaa44('0xf7')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xf8'));db[_0xaa44('0xf9')]=db[_0xaa44('0x3')]['import'](_0xaa44('0xfa'));db['WhatsappMessage']=db[_0xaa44('0x3')]['import'](_0xaa44('0xfb'));db[_0xaa44('0xfc')]=db[_0xaa44('0x3')][_0xaa44('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xaa44('0xfd')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xfe'));db['WhatsappQueue']=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0xff'));db[_0xaa44('0x100')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x101'));db['TeamVoiceQueue']=db['sequelize'][_0xaa44('0x11')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xaa44('0x102')]=db[_0xaa44('0x3')][_0xaa44('0x11')](_0xaa44('0x103'));db[_0xaa44('0x104')]=db['sequelize']['import']('../api/userVoicePrefix/userVoicePrefix.model');db['User']['hasOne'](db[_0xaa44('0x1e')],{'as':_0xaa44('0x1e'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')]['hasMany'](db['VoiceRecording'],{'as':_0xaa44('0x107'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')][_0xaa44('0x108')](db[_0xaa44('0x2b')],{'as':_0xaa44('0x109'),'foreignKey':'UserId'});db['User'][_0xaa44('0x108')](db[_0xaa44('0x16')],{'as':_0xaa44('0x10a'),'onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x10')]['hasMany'](db[_0xaa44('0x74')],{'as':'HopperFinals','foreignKey':'UserId'});db['User']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xaa44('0x10')][_0xaa44('0x108')](db['ReportAgentPreview'],{'as':_0xaa44('0x77'),'foreignKey':'UserId'});db[_0xaa44('0x10')][_0xaa44('0x108')](db[_0xaa44('0x10b')],{'as':_0xaa44('0x10c'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')][_0xaa44('0x108')](db[_0xaa44('0x63')],{'as':'ChatInteractions','foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')][_0xaa44('0x108')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xaa44('0x106')});db['User'][_0xaa44('0x108')](db['FaxInteraction'],{'as':_0xaa44('0x10d'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')][_0xaa44('0x108')](db[_0xaa44('0x10e')],{'as':_0xaa44('0x10f'),'foreignKey':'UserId'});db[_0xaa44('0x10')]['hasMany'](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10')][_0xaa44('0x108')](db['UserNotification'],{'as':_0xaa44('0x110'),'foreignKey':'SenderId'});db[_0xaa44('0x10')]['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':_0xaa44('0x111')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x69')],{'as':_0xaa44('0x113'),'through':'chat_group_has_users'});db['User']['belongsToMany'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x114'),'through':_0xaa44('0x115')});db[_0xaa44('0x10')]['belongsToMany'](db[_0xaa44('0x116')],{'as':_0xaa44('0x117'),'through':_0xaa44('0x118')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0xe3')],{'through':_0xaa44('0x119')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x10e')],{'as':'MailInteractions','through':_0xaa44('0x11a')});db[_0xaa44('0x10')][_0xaa44('0x112')](db['ChatInteraction'],{'as':_0xaa44('0x11b'),'through':_0xaa44('0x11c')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x11d')],{'as':_0xaa44('0x10d'),'through':_0xaa44('0x11e')});db[_0xaa44('0x10')][_0xaa44('0x112')](db['SmsInteraction'],{'as':_0xaa44('0x11f'),'through':_0xaa44('0x120')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x10b')],{'as':_0xaa44('0x10c'),'through':'user_has_openchannel_interactions'});db[_0xaa44('0x10')][_0xaa44('0x112')](db['WhatsappInteraction'],{'as':_0xaa44('0x121'),'through':_0xaa44('0x122')});db['User']['belongsToMany'](db[_0xaa44('0x19')],{'as':_0xaa44('0x123'),'through':_0xaa44('0x2c'),'required':![]});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0xf0')],{'as':_0xaa44('0x124'),'through':_0xaa44('0x104'),'required':![]});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x125')],{'as':_0xaa44('0x126'),'through':_0xaa44('0x2f'),'required':![]});db[_0xaa44('0x10')][_0xaa44('0x112')](db['ChatQueue'],{'as':_0xaa44('0x127'),'through':_0xaa44('0x128'),'required':![],'hooks':!![]});db[_0xaa44('0x10')]['belongsToMany'](db[_0xaa44('0x4d')],{'as':_0xaa44('0x129'),'through':_0xaa44('0x12a'),'required':![]});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x12b')],{'as':_0xaa44('0x12c'),'through':_0xaa44('0x32'),'required':![]});db[_0xaa44('0x10')][_0xaa44('0x112')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db['User'][_0xaa44('0x112')](db['WhatsappQueue'],{'as':_0xaa44('0x12d'),'through':_0xaa44('0x36'),'required':![]});db['User'][_0xaa44('0x112')](db[_0xaa44('0x116')],{'through':'cm_user_has_lists'});db[_0xaa44('0x10')][_0xaa44('0x112')](db['ChatWebsite'],{'as':_0xaa44('0x12e'),'through':_0xaa44('0x12f')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x47')],{'as':_0xaa44('0x130'),'through':'user_has_fax_accounts'});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x3b')],{'as':_0xaa44('0x131'),'through':'user_has_mail_accounts'});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x132')],{'as':'OpenchannelAccounts','through':_0xaa44('0x133')});db[_0xaa44('0x10')][_0xaa44('0x112')](db[_0xaa44('0x50')],{'as':_0xaa44('0x134'),'through':_0xaa44('0x135')});db['User'][_0xaa44('0x112')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xaa44('0x136')});db[_0xaa44('0x10')]['belongsToMany'](db[_0xaa44('0x137')],{'as':_0xaa44('0x138'),'through':'user_has_square_projects'});db[_0xaa44('0x12')][_0xaa44('0x108')](db[_0xaa44('0x16')],{'as':_0xaa44('0x139'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x13a')});db[_0xaa44('0x14')][_0xaa44('0x108')](db['VoiceExtension'],{'onDelete':_0xaa44('0x105')});db[_0xaa44('0x16')][_0xaa44('0x108')](db[_0xaa44('0x16')],{'as':_0xaa44('0x13b'),'onDelete':_0xaa44('0x105')});db['VoiceMusicOnHold'][_0xaa44('0x112')](db[_0xaa44('0x8d')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xaa44('0x19')][_0xaa44('0x108')](db['UserVoiceQueueRt'],{'as':_0xaa44('0x13c'),'foreignKey':'VoiceQueueId'});db[_0xaa44('0x19')]['hasMany'](db[_0xaa44('0x70')],{'as':_0xaa44('0x13d'),'foreignKey':_0xaa44('0x13e')});db[_0xaa44('0x19')]['hasMany'](db[_0xaa44('0x74')],{'as':_0xaa44('0x13f'),'foreignKey':_0xaa44('0x13e')});db[_0xaa44('0x19')][_0xaa44('0x108')](db[_0xaa44('0x75')],{'as':_0xaa44('0x140'),'foreignKey':'VoiceQueueId'});db[_0xaa44('0x19')][_0xaa44('0x108')](db['ReportAgentPreview'],{'as':_0xaa44('0x77'),'foreignKey':_0xaa44('0x13e')});db[_0xaa44('0x19')][_0xaa44('0x108')](db['CmHopperBlack'],{'as':_0xaa44('0x141'),'foreignKey':_0xaa44('0x13e')});db[_0xaa44('0x19')]['hasMany'](db['JscriptySessionReport'],{'as':_0xaa44('0x142'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xaa44('0x143')](db['Trunk'],{'as':_0xaa44('0x144'),'foreignKey':_0xaa44('0x145')});db[_0xaa44('0x19')][_0xaa44('0x143')](db[_0xaa44('0x144')],{'as':_0xaa44('0x146'),'foreignKey':_0xaa44('0x147')});db['VoiceQueue'][_0xaa44('0x143')](db[_0xaa44('0x83')],{'as':_0xaa44('0x83'),'foreignKey':_0xaa44('0x148')});db[_0xaa44('0x19')]['belongsTo'](db[_0xaa44('0x85')],{'as':_0xaa44('0x149'),'foreignKey':_0xaa44('0x14a')});db[_0xaa44('0x19')][_0xaa44('0x112')](db[_0xaa44('0x116')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0xaa44('0x19')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':'Agents','through':_0xaa44('0x2c')});db[_0xaa44('0x19')][_0xaa44('0x112')](db[_0xaa44('0xe3')],{'as':_0xaa44('0x14b'),'through':_0xaa44('0x14c')});db[_0xaa44('0x19')][_0xaa44('0x112')](db[_0xaa44('0x116')],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0xaa44('0x14d')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x10'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x1c')][_0xaa44('0x143')](db['User'],{'as':'User','foreignKey':_0xaa44('0x106')});db['VoiceMail']['hasMany'](db[_0xaa44('0x1f')],{'as':'Messages','onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db[_0xaa44('0x1f')][_0xaa44('0x143')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0xaa44('0x14e')});db[_0xaa44('0x21')][_0xaa44('0x108')](db['VoiceQueueReport'],{'as':_0xaa44('0x14f'),'foreignKey':_0xaa44('0x150'),'constraints':![]});db[_0xaa44('0x21')][_0xaa44('0x108')](db[_0xaa44('0x151')],{'as':_0xaa44('0x152'),'foreignKey':_0xaa44('0x150'),'constraints':![]});db[_0xaa44('0x21')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x10'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x21')]['belongsTo'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x38')]['belongsTo'](db[_0xaa44('0x3b')],{'as':'MailAccount','foreignKey':_0xaa44('0x155')});db[_0xaa44('0x38')][_0xaa44('0x143')](db[_0xaa44('0x100')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db[_0xaa44('0x156')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{'as':_0xaa44('0x3b'),'foreignKey':'MailAccountId'});db[_0xaa44('0x156')][_0xaa44('0x143')](db['CloudProvider'],{'as':_0xaa44('0x100'),'foreignKey':_0xaa44('0x157'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x3b')][_0xaa44('0x159')](db[_0xaa44('0x38')],{'as':_0xaa44('0x15a'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x3b')][_0xaa44('0x159')](db['MailServerOut'],{'as':_0xaa44('0x15b'),'onDelete':'cascade'});db[_0xaa44('0x3b')][_0xaa44('0x108')](db['Disposition'],{'as':_0xaa44('0x15c'),'foreignKey':_0xaa44('0x155'),'onDelete':_0xaa44('0x105')});db['MailAccount'][_0xaa44('0x108')](db['CannedAnswer'],{'as':_0xaa44('0x15d'),'foreignKey':_0xaa44('0x155')});db[_0xaa44('0x3b')][_0xaa44('0x108')](db[_0xaa44('0x3f')],{'as':_0xaa44('0x15e'),'foreignKey':'MailAccountId'});db[_0xaa44('0x3b')][_0xaa44('0x108')](db[_0xaa44('0x10e')],{'as':'Interactions'});db[_0xaa44('0x3b')][_0xaa44('0x108')](db[_0xaa44('0x40')],{'as':'Applications'});db[_0xaa44('0x3b')][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':'List','foreignKey':'ListId'});db['MailAccount'][_0xaa44('0x143')](db[_0xaa44('0x90')],{'as':_0xaa44('0x90'),'foreignKey':_0xaa44('0x15f')});db[_0xaa44('0x3b')][_0xaa44('0x143')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xaa44('0x14a')});db[_0xaa44('0x3b')][_0xaa44('0x112')](db['User'],{'as':_0xaa44('0x160'),'through':_0xaa44('0x161')});db[_0xaa44('0x125')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':'Agents','through':_0xaa44('0x2f')});db[_0xaa44('0x125')][_0xaa44('0x112')](db['Team'],{'through':_0xaa44('0x162'),'as':_0xaa44('0x14b')});db[_0xaa44('0x10e')][_0xaa44('0x108')](db[_0xaa44('0x3f')],{'as':_0xaa44('0x15e'),'onDelete':_0xaa44('0x105'),'foreignKey':'MailInteractionId'});db[_0xaa44('0x10e')]['belongsTo'](db['MailAccount'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x155')});db[_0xaa44('0x10e')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':'Contact','foreignKey':_0xaa44('0x154')});db[_0xaa44('0x10e')][_0xaa44('0x143')](db['User'],{'as':'Owner','foreignKey':_0xaa44('0x106')});db['MailInteraction'][_0xaa44('0x112')](db['Tag'],{'through':_0xaa44('0x164'),'as':'Tags'});db['MailInteraction'][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x164'),'as':_0xaa44('0x165')});db[_0xaa44('0x10e')][_0xaa44('0x112')](db['User'],{'as':_0xaa44('0x166'),'through':'user_has_mail_interactions','foreignKey':_0xaa44('0x167')});db[_0xaa44('0x3f')][_0xaa44('0x108')](db['Attachment'],{'as':'Attachments','onDelete':_0xaa44('0x105')});db['MailMessage']['belongsTo'](db[_0xaa44('0x10')],{'as':_0xaa44('0x10')});db['MailMessage'][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'onDelete':_0xaa44('0x105'),'as':'Contact'});db[_0xaa44('0x3f')][_0xaa44('0x143')](db[_0xaa44('0x10e')],{'as':_0xaa44('0x168'),'foreignKey':'MailInteractionId'});db[_0xaa44('0x3f')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{'as':'Account','foreignKey':_0xaa44('0x155')});db[_0xaa44('0x3f')]['belongsTo'](db[_0xaa44('0x5d')],{'as':'ChatWebsite','foreignKey':_0xaa44('0x169')});db[_0xaa44('0x3f')][_0xaa44('0x143')](db['ChatOfflineMessage'],{'as':_0xaa44('0x65'),'foreignKey':_0xaa44('0x16a')});db[_0xaa44('0x40')]['belongsTo'](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x40')][_0xaa44('0x143')](db[_0xaa44('0x125')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x40')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x40')]['belongsTo'](db[_0xaa44('0x83')],{'onDelete':'restrict','foreignKey':_0xaa44('0x148')});db[_0xaa44('0x40')][_0xaa44('0x143')](db[_0xaa44('0x8e')],{'onDelete':_0xaa44('0x158'),'foreignKey':_0xaa44('0x16b')});db['MailQueueReport'][_0xaa44('0x143')](db[_0xaa44('0x3b')],{});db[_0xaa44('0x42')][_0xaa44('0x143')](db['CmList'],{'as':_0xaa44('0x16c'),'foreignKey':'ListId'});db[_0xaa44('0x42')]['belongsTo'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x42')][_0xaa44('0x143')](db[_0xaa44('0x10e')],{});db['MailQueueReport'][_0xaa44('0x143')](db[_0xaa44('0x3f')],{});db['MailQueueReport'][_0xaa44('0x143')](db[_0xaa44('0x10')],{});db[_0xaa44('0x42')][_0xaa44('0x143')](db[_0xaa44('0x125')],{});db['Dashboard'][_0xaa44('0x108')](db[_0xaa44('0x16d')],{'as':'Items','onDelete':_0xaa44('0x105')});db['FaxAccount'][_0xaa44('0x108')](db[_0xaa44('0x7f')],{'as':_0xaa44('0x15c'),'foreignKey':_0xaa44('0x16e'),'onDelete':_0xaa44('0x105')});db['FaxAccount'][_0xaa44('0x108')](db[_0xaa44('0x7d')],{'as':_0xaa44('0x15d'),'foreignKey':_0xaa44('0x16e')});db[_0xaa44('0x47')][_0xaa44('0x108')](db[_0xaa44('0x11d')],{'as':_0xaa44('0x16f')});db[_0xaa44('0x47')][_0xaa44('0x108')](db[_0xaa44('0x170')],{'as':_0xaa44('0x13b')});db['FaxAccount'][_0xaa44('0x108')](db['VoiceExtension'],{'as':_0xaa44('0x171'),'onDelete':_0xaa44('0x105')});db['FaxAccount'][_0xaa44('0x108')](db[_0xaa44('0x4b')],{'as':_0xaa44('0x15e')});db[_0xaa44('0x47')][_0xaa44('0x143')](db[_0xaa44('0x144')],{'as':_0xaa44('0x144')});db['FaxAccount'][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172')});db['FaxAccount'][_0xaa44('0x143')](db[_0xaa44('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xaa44('0x14a')});db[_0xaa44('0x47')]['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x173')});db[_0xaa44('0x170')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x158')});db['FaxApplication'][_0xaa44('0x143')](db[_0xaa44('0x4d')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0xaa44('0x47')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x170')]['belongsTo'](db[_0xaa44('0x8e')],{'onDelete':'restrict','foreignKey':_0xaa44('0x16b')});db[_0xaa44('0x11d')][_0xaa44('0x108')](db['FaxMessage'],{'as':_0xaa44('0x15e'),'onDelete':_0xaa44('0x105'),'foreignKey':'FaxInteractionId'});db[_0xaa44('0x11d')][_0xaa44('0x143')](db['FaxAccount'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x16e')});db[_0xaa44('0x11d')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0xaa44('0x11d')][_0xaa44('0x143')](db['User'],{'as':_0xaa44('0x174'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x11d')][_0xaa44('0x112')](db['Tag'],{'through':_0xaa44('0x175'),'as':_0xaa44('0x176')});db[_0xaa44('0x11d')]['belongsToMany'](db[_0xaa44('0x8e')],{'through':_0xaa44('0x175'),'as':_0xaa44('0x165')});db[_0xaa44('0x11d')][_0xaa44('0x112')](db['User'],{'as':_0xaa44('0x166'),'through':'user_has_fax_interactions','foreignKey':_0xaa44('0x177')});db[_0xaa44('0x4b')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x105'),'as':'User'});db[_0xaa44('0x4b')][_0xaa44('0x143')](db[_0xaa44('0x11d')],{'as':_0xaa44('0x168'),'foreignKey':_0xaa44('0x177')});db['FaxMessage'][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'onDelete':_0xaa44('0x105'),'as':'Contact'});db[_0xaa44('0x4b')][_0xaa44('0x143')](db[_0xaa44('0x178')],{'as':_0xaa44('0x178'),'foreignKey':_0xaa44('0x179')});db[_0xaa44('0x4b')][_0xaa44('0x143')](db[_0xaa44('0x47')],{'as':'Account','foreignKey':_0xaa44('0x16e')});db[_0xaa44('0x4d')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x12a')});db[_0xaa44('0x4d')][_0xaa44('0x112')](db[_0xaa44('0xe3')],{'through':_0xaa44('0x17a'),'as':'Teams'});db[_0xaa44('0x4f')]['belongsTo'](db[_0xaa44('0x47')],{});db[_0xaa44('0x4f')]['belongsTo'](db['CmList'],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172')});db[_0xaa44('0x4f')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xaa44('0x154')});db[_0xaa44('0x4f')][_0xaa44('0x143')](db[_0xaa44('0x11d')],{});db[_0xaa44('0x4f')][_0xaa44('0x143')](db['FaxMessage'],{});db[_0xaa44('0x4f')]['belongsTo'](db['User'],{});db[_0xaa44('0x4f')][_0xaa44('0x143')](db[_0xaa44('0x4d')],{});db['SmsAccount'][_0xaa44('0x108')](db['Disposition'],{'as':_0xaa44('0x15c'),'foreignKey':_0xaa44('0x17b'),'onDelete':'cascade'});db[_0xaa44('0x50')]['hasMany'](db[_0xaa44('0x7d')],{'as':_0xaa44('0x15d'),'foreignKey':'SmsAccountId'});db[_0xaa44('0x50')][_0xaa44('0x108')](db[_0xaa44('0x55')],{'as':'Messages','foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db['SmsInteraction'],{'as':_0xaa44('0x16f')});db[_0xaa44('0x50')][_0xaa44('0x108')](db[_0xaa44('0x52')],{'as':_0xaa44('0x13b')});db['SmsAccount'][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172')});db[_0xaa44('0x50')][_0xaa44('0x143')](db[_0xaa44('0x85')],{'as':_0xaa44('0x149'),'foreignKey':_0xaa44('0x14a')});db[_0xaa44('0x50')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x135')});db['SmsApplication'][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x52')]['belongsTo'](db[_0xaa44('0x12b')],{'onDelete':'restrict'});db['SmsApplication'][_0xaa44('0x143')](db[_0xaa44('0x50')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x52')][_0xaa44('0x143')](db['Interval'],{'onDelete':_0xaa44('0x158'),'foreignKey':_0xaa44('0x148')});db[_0xaa44('0x52')][_0xaa44('0x143')](db[_0xaa44('0x8e')],{'onDelete':_0xaa44('0x158'),'foreignKey':_0xaa44('0x16b')});db[_0xaa44('0x53')][_0xaa44('0x108')](db['SmsMessage'],{'as':_0xaa44('0x15e'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x17c')});db['SmsInteraction']['belongsTo'](db[_0xaa44('0x50')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x17b')});db[_0xaa44('0x53')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x53')]['belongsTo'](db[_0xaa44('0x10')],{'as':_0xaa44('0x174'),'foreignKey':'UserId'});db[_0xaa44('0x53')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':'sms_interaction_has_tags','as':_0xaa44('0x176')});db['SmsInteraction'][_0xaa44('0x112')](db['Tag'],{'through':_0xaa44('0x17d'),'as':_0xaa44('0x165')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0xaa44('0x166'),'through':_0xaa44('0x120'),'foreignKey':_0xaa44('0x17c')});db[_0xaa44('0x55')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x10')});db['SmsMessage'][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'onDelete':_0xaa44('0x105'),'as':_0xaa44('0x153')});db['SmsMessage'][_0xaa44('0x143')](db['SmsInteraction'],{'onDelete':'cascade','as':_0xaa44('0x168'),'foreignKey':_0xaa44('0x17c')});db['SmsMessage']['belongsTo'](db['SmsAccount'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x17b')});db[_0xaa44('0x12b')][_0xaa44('0x112')](db['User'],{'as':_0xaa44('0x160'),'through':_0xaa44('0x32'),'foreignKey':_0xaa44('0x17e')});db['SmsQueue']['belongsToMany'](db[_0xaa44('0xe3')],{'through':_0xaa44('0x17f'),'as':_0xaa44('0x14b')});db['OpenchannelAccount'][_0xaa44('0x108')](db[_0xaa44('0x7f')],{'as':'Dispositions','foreignKey':_0xaa44('0x180'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x132')]['hasMany'](db[_0xaa44('0x7d')],{'as':_0xaa44('0x15d'),'foreignKey':_0xaa44('0x180')});db[_0xaa44('0x132')]['hasMany'](db[_0xaa44('0x10b')],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xaa44('0x132')][_0xaa44('0x108')](db['OpenchannelMessage'],{'as':_0xaa44('0x15e'),'foreignKey':_0xaa44('0x180')});db[_0xaa44('0x132')][_0xaa44('0x108')](db['OpenchannelApplication'],{'as':_0xaa44('0x13b'),'foreignKey':'OpenchannelAccountId'});db[_0xaa44('0x132')][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0xaa44('0x143')](db[_0xaa44('0x85')],{'as':_0xaa44('0x149'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xaa44('0x132')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x133')});db[_0xaa44('0x181')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0x181')][_0xaa44('0x143')](db['OpenchannelQueue'],{'onDelete':_0xaa44('0x158'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0xaa44('0x158'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xaa44('0x143')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xaa44('0x148')});db['OpenchannelApplication'][_0xaa44('0x143')](db[_0xaa44('0x8e')],{'onDelete':_0xaa44('0x158'),'foreignKey':_0xaa44('0x16b')});db[_0xaa44('0x10b')][_0xaa44('0x108')](db[_0xaa44('0x5a')],{'as':_0xaa44('0x15e'),'onDelete':'cascade','foreignKey':_0xaa44('0x182')});db[_0xaa44('0x10b')][_0xaa44('0x143')](db[_0xaa44('0x132')],{'as':'Account','foreignKey':_0xaa44('0x180')});db[_0xaa44('0x10b')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db['OpenchannelInteraction'][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x174'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x10b')]['belongsToMany'](db['Tag'],{'through':_0xaa44('0x183'),'as':'Tags'});db[_0xaa44('0x10b')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x183'),'as':_0xaa44('0x165')});db['OpenchannelInteraction']['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'through':_0xaa44('0x184'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0xaa44('0x143')](db['User'],{'onDelete':'cascade','as':_0xaa44('0x10')});db['OpenchannelMessage'][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'onDelete':_0xaa44('0x105'),'as':_0xaa44('0x153')});db['OpenchannelMessage']['belongsTo'](db[_0xaa44('0x10b')],{'onDelete':'cascade','as':_0xaa44('0x168'),'foreignKey':_0xaa44('0x182')});db[_0xaa44('0x5a')][_0xaa44('0x143')](db[_0xaa44('0x178')],{'as':_0xaa44('0x178'),'foreignKey':_0xaa44('0x179')});db[_0xaa44('0x5a')][_0xaa44('0x143')](db[_0xaa44('0x132')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x180')});db[_0xaa44('0x5c')]['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x34'),'foreignKey':'OpenchannelQueueId'});db[_0xaa44('0x5c')][_0xaa44('0x112')](db[_0xaa44('0xe3')],{'through':_0xaa44('0x185'),'as':_0xaa44('0x14b')});db[_0xaa44('0x5d')][_0xaa44('0x108')](db[_0xaa44('0x7f')],{'as':_0xaa44('0x15c'),'foreignKey':_0xaa44('0x169'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x5d')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xaa44('0x169')});db[_0xaa44('0x5d')][_0xaa44('0x108')](db[_0xaa44('0x6b')],{'as':'ProactiveActions'});db[_0xaa44('0x5d')][_0xaa44('0x108')](db[_0xaa44('0x63')],{'as':_0xaa44('0x16f')});db[_0xaa44('0x5d')][_0xaa44('0x108')](db[_0xaa44('0x61')],{'as':_0xaa44('0x13b')});db[_0xaa44('0x5d')][_0xaa44('0x108')](db['ChatMessage'],{'as':_0xaa44('0x15e')});db[_0xaa44('0x5d')][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':'List','foreignKey':_0xaa44('0x172')});db[_0xaa44('0x5d')]['belongsTo'](db[_0xaa44('0x83')],{'as':'Interval','foreignKey':_0xaa44('0x148')});db[_0xaa44('0x5d')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{'as':_0xaa44('0x3b'),'foreignKey':'MailAccountId'});db[_0xaa44('0x5d')][_0xaa44('0x143')](db[_0xaa44('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xaa44('0x5d')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x12f')});db[_0xaa44('0x5f')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0xaa44('0x143')](db['CmList'],{'as':'List','foreignKey':_0xaa44('0x172')});db[_0xaa44('0x5f')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x5f')][_0xaa44('0x143')](db[_0xaa44('0x10b')],{});db[_0xaa44('0x5f')]['belongsTo'](db[_0xaa44('0x5a')],{});db[_0xaa44('0x5f')]['belongsTo'](db[_0xaa44('0x10')],{});db[_0xaa44('0x5f')][_0xaa44('0x143')](db[_0xaa44('0x5c')],{});db[_0xaa44('0x61')][_0xaa44('0x143')](db['User'],{'as':_0xaa44('0x186'),'foreignKey':_0xaa44('0x106'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x61')][_0xaa44('0x143')](db['ChatQueue'],{'as':_0xaa44('0x187'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xaa44('0x61')][_0xaa44('0x143')](db[_0xaa44('0x5d')],{'as':_0xaa44('0x188'),'foreignKey':_0xaa44('0x169'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x61')][_0xaa44('0x143')](db[_0xaa44('0x8e')],{'onDelete':_0xaa44('0x158'),'foreignKey':_0xaa44('0x16b')});db['ChatInteraction'][_0xaa44('0x108')](db[_0xaa44('0x64')],{'as':_0xaa44('0x15e'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x189')});db[_0xaa44('0x63')][_0xaa44('0x143')](db[_0xaa44('0x5d')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x169')});db[_0xaa44('0x63')]['belongsTo'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x63')]['belongsTo'](db['User'],{'as':_0xaa44('0x174'),'foreignKey':'UserId'});db['ChatInteraction']['belongsToMany'](db[_0xaa44('0x8e')],{'through':_0xaa44('0x18a'),'as':_0xaa44('0x176')});db[_0xaa44('0x63')]['belongsToMany'](db[_0xaa44('0x8e')],{'through':_0xaa44('0x18a'),'as':_0xaa44('0x165')});db[_0xaa44('0x63')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'through':_0xaa44('0x11c'),'foreignKey':_0xaa44('0x189')});db[_0xaa44('0x64')]['belongsTo'](db['User'],{'onDelete':_0xaa44('0x105'),'as':'User'});db[_0xaa44('0x64')][_0xaa44('0x143')](db['CmContact'],{'onDelete':_0xaa44('0x105'),'as':'Contact','foreignKey':_0xaa44('0x154')});db['ChatMessage'][_0xaa44('0x143')](db[_0xaa44('0x63')],{'onDelete':_0xaa44('0x105'),'as':_0xaa44('0x168'),'foreignKey':_0xaa44('0x189')});db[_0xaa44('0x64')][_0xaa44('0x143')](db[_0xaa44('0x178')],{'as':_0xaa44('0x178'),'foreignKey':_0xaa44('0x179')});db[_0xaa44('0x64')][_0xaa44('0x143')](db['ChatWebsite'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x169')});db['ChatOfflineMessage'][_0xaa44('0x108')](db[_0xaa44('0x178')],{'as':_0xaa44('0x18b'),'foreignKey':_0xaa44('0x16a'),'onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x65')]['belongsTo'](db[_0xaa44('0x6f')],{'onDelete':_0xaa44('0x105'),'as':'Contact','foreignKey':'ContactId'});db[_0xaa44('0x65')][_0xaa44('0x143')](db['ChatWebsite'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x169')});db[_0xaa44('0x67')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xaa44('0x112')](db['Team'],{'through':_0xaa44('0x18c'),'as':'Teams'});db[_0xaa44('0x69')]['hasMany'](db['ChatInternalMessage'],{'as':_0xaa44('0x15e'),'foreignKey':_0xaa44('0x18d'),'onDelete':'cascade'});db['ChatGroup']['belongsToMany'](db['User'],{'as':_0xaa44('0x13c'),'through':_0xaa44('0x18e')});db[_0xaa44('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0xaa44('0x188'),'foreignKey':_0xaa44('0x169')});db[_0xaa44('0x6d')][_0xaa44('0x108')](db['CmContact'],{'as':_0xaa44('0x114'),'foreignKey':_0xaa44('0x18f')});db[_0xaa44('0x6f')][_0xaa44('0x108')](db[_0xaa44('0x70')],{'as':_0xaa44('0x13d'),'foreignKey':_0xaa44('0x154')});db['CmContact'][_0xaa44('0x108')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xaa44('0x154')});db[_0xaa44('0x6f')]['hasMany'](db['CmHopperHistory'],{'as':_0xaa44('0x140'),'foreignKey':'ContactId'});db[_0xaa44('0x6f')][_0xaa44('0x108')](db[_0xaa44('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xaa44('0x154')});db[_0xaa44('0x6f')][_0xaa44('0x108')](db['JscriptySessionReport'],{'as':_0xaa44('0x142'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0x6f')][_0xaa44('0x108')](db['OpenchannelInteraction'],{'as':_0xaa44('0x10c'),'foreignKey':_0xaa44('0x154'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x6f')][_0xaa44('0x108')](db[_0xaa44('0x63')],{'as':'ChatInteractions','foreignKey':_0xaa44('0x154'),'onDelete':'restrict'});db[_0xaa44('0x6f')][_0xaa44('0x108')](db['SmsInteraction'],{'as':_0xaa44('0x11f'),'foreignKey':_0xaa44('0x154'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x6f')]['hasMany'](db[_0xaa44('0x11d')],{'as':_0xaa44('0x10d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xaa44('0x6f')]['hasMany'](db[_0xaa44('0x10e')],{'as':_0xaa44('0x10f'),'foreignKey':_0xaa44('0x154'),'onDelete':_0xaa44('0x158')});db['CmContact'][_0xaa44('0x143')](db[_0xaa44('0x6d')],{'as':_0xaa44('0x190'),'foreignKey':_0xaa44('0x18f')});db[_0xaa44('0x6f')][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172'),'onDelete':_0xaa44('0x105')});db['CmContact'][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'through':_0xaa44('0x115')});db[_0xaa44('0x6f')][_0xaa44('0x112')](db['Tag'],{'as':_0xaa44('0x176'),'through':_0xaa44('0x191')});db[_0xaa44('0x6f')]['belongsToMany'](db[_0xaa44('0x8e')],{'through':_0xaa44('0x191'),'as':_0xaa44('0x165')});db[_0xaa44('0x70')]['belongsTo'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154'),'onDelete':_0xaa44('0x105')});db['CmHopper'][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':'ListId','onDelete':_0xaa44('0x105')});db[_0xaa44('0x70')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x186'),'foreignKey':_0xaa44('0x106')});db[_0xaa44('0x70')][_0xaa44('0x143')](db['VoiceQueue'],{'as':_0xaa44('0x187'),'foreignKey':'VoiceQueueId','onDelete':_0xaa44('0x105')});db[_0xaa44('0x70')][_0xaa44('0x143')](db[_0xaa44('0xe6')],{'as':'Campaign','foreignKey':_0xaa44('0x192'),'onDelete':_0xaa44('0x105')});db['CmHopper']['belongsTo'](db[_0xaa44('0x10')],{'as':_0xaa44('0x174'),'foreignKey':_0xaa44('0x193')});db[_0xaa44('0x72')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154'),'onDelete':'cascade'});db[_0xaa44('0x72')]['belongsTo'](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x72')][_0xaa44('0x143')](db[_0xaa44('0x19')],{'as':_0xaa44('0x187'),'foreignKey':_0xaa44('0x13e'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x72')][_0xaa44('0x143')](db[_0xaa44('0xe6')],{'as':_0xaa44('0xe6'),'foreignKey':_0xaa44('0x192'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x7b')][_0xaa44('0x108')](db[_0xaa44('0x81')],{'as':{'plural':'All','singular':_0xaa44('0x194')},'foreignKey':_0xaa44('0x195'),'onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x7b')][_0xaa44('0x108')](db['Condition'],{'as':{'plural':'Any','singular':_0xaa44('0x196')},'foreignKey':'AutomationAnyId','onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x7b')][_0xaa44('0x108')](db[_0xaa44('0x79')],{'as':_0xaa44('0x197'),'foreignKey':_0xaa44('0x198'),'onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x7f')]['hasMany'](db[_0xaa44('0x7f')],{'as':_0xaa44('0x15c'),'foreignKey':'ParentId','onDelete':_0xaa44('0x105')});db['Interval']['hasMany'](db[_0xaa44('0x83')],{'as':_0xaa44('0x199'),'foreignKey':_0xaa44('0x148'),'onDelete':_0xaa44('0x105'),'hooks':!![],'required':![]});db[_0xaa44('0x83')][_0xaa44('0x108')](db['VoiceExtension'],{'as':_0xaa44('0x10a'),'foreignKey':'IntervalId','onDelete':_0xaa44('0x158')});db[_0xaa44('0x83')][_0xaa44('0x108')](db[_0xaa44('0x40')],{'as':_0xaa44('0x19a'),'foreignKey':_0xaa44('0x148')});db[_0xaa44('0x83')]['hasMany'](db[_0xaa44('0x61')],{'as':_0xaa44('0x19b'),'foreignKey':'IntervalId'});db[_0xaa44('0x83')][_0xaa44('0x108')](db[_0xaa44('0x170')],{'as':_0xaa44('0x19c'),'foreignKey':_0xaa44('0x148')});db[_0xaa44('0x83')][_0xaa44('0x108')](db[_0xaa44('0x52')],{'as':_0xaa44('0x19d'),'foreignKey':_0xaa44('0x148')});db[_0xaa44('0x8b')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{});db[_0xaa44('0x8b')]['belongsTo'](db[_0xaa44('0x19e')],{'foreignKey':_0xaa44('0x19f')});db[_0xaa44('0x8b')][_0xaa44('0x143')](db[_0xaa44('0x97')],{'foreignKey':'CustomReportId'});db['Sound'][_0xaa44('0x112')](db['VoiceMusicOnHold'],{'as':_0xaa44('0x1a0'),'through':_0xaa44('0x1a1'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x8e')][_0xaa44('0x112')](db[_0xaa44('0x6f')],{'through':_0xaa44('0x191')});db[_0xaa44('0x8e')][_0xaa44('0x112')](db[_0xaa44('0x63')],{'through':_0xaa44('0x18a')});db[_0xaa44('0x8e')]['belongsToMany'](db[_0xaa44('0x10e')],{'through':_0xaa44('0x164')});db[_0xaa44('0x8e')][_0xaa44('0x112')](db['SmsInteraction'],{'through':_0xaa44('0x17d')});db['Tag'][_0xaa44('0x112')](db[_0xaa44('0x11d')],{'through':_0xaa44('0x175')});db[_0xaa44('0x8e')]['belongsToMany'](db[_0xaa44('0x10b')],{'through':_0xaa44('0x183')});db[_0xaa44('0x8e')][_0xaa44('0x112')](db[_0xaa44('0xf9')],{'through':_0xaa44('0x1a2')});db['Trigger']['hasMany'](db[_0xaa44('0x81')],{'as':{'plural':_0xaa44('0x1a3'),'singular':_0xaa44('0x1a4')},'foreignKey':'TriggerAllId','onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x1a5')][_0xaa44('0x108')](db[_0xaa44('0x81')],{'as':{'plural':'AnyConditions','singular':_0xaa44('0x1a6')},'foreignKey':'TriggerAnyId','onDelete':_0xaa44('0x105'),'hooks':!![]});db['Trigger'][_0xaa44('0x108')](db[_0xaa44('0x79')],{'as':_0xaa44('0x197'),'foreignKey':_0xaa44('0x1a7'),'onDelete':_0xaa44('0x105'),'hooks':!![]});db[_0xaa44('0x97')][_0xaa44('0x108')](db['AnalyticFieldReport'],{'as':_0xaa44('0x1a8'),'onDelete':'cascade','foreignKey':_0xaa44('0x1a9'),'hooks':!![]});db['AnalyticDefaultReport'][_0xaa44('0x108')](db[_0xaa44('0x9d')],{'as':_0xaa44('0x1a8'),'onDelete':_0xaa44('0x105'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xaa44('0x108')](db[_0xaa44('0x9d')],{'as':'Fields','onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1aa')});db['AnalyticFieldReport'][_0xaa44('0x143')](db[_0xaa44('0x9b')],{'foreignKey':'MetricId'});db[_0xaa44('0x9f')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xaa44('0x1ab'),'onDelete':'cascade','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xa1')][_0xaa44('0x108')](db[_0xaa44('0xa2')],{'as':_0xaa44('0x1ad'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xa1')]['hasMany'](db[_0xaa44('0xa2')],{'as':'Descriptions','onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xa1')][_0xaa44('0x108')](db[_0xaa44('0xa2')],{'as':'Fields','onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xa1')][_0xaa44('0x143')](db[_0xaa44('0x9f')],{'as':_0xaa44('0x163'),'foreignKey':'AccountId'});db[_0xaa44('0xa2')]['hasMany'](db[_0xaa44('0xa2')],{'as':'Subject','foreignKey':_0xaa44('0x1ae')});db['SalesforceField']['hasMany'](db[_0xaa44('0xa2')],{'as':_0xaa44('0x1b1'),'foreignKey':'DescriptionId'});db[_0xaa44('0xa2')]['hasMany'](db['SalesforceField'],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db['SalesforceField'][_0xaa44('0x143')](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db['SugarcrmAccount'][_0xaa44('0x108')](db[_0xaa44('0xa5')],{'as':_0xaa44('0x1ab'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xa5')][_0xaa44('0x108')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xa5')][_0xaa44('0x108')](db[_0xaa44('0xa6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xaa44('0x1af')});db['SugarcrmConfiguration'][_0xaa44('0x108')](db[_0xaa44('0xa6')],{'as':_0xaa44('0x1a8'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xa5')][_0xaa44('0x143')](db[_0xaa44('0x1b4')],{'as':'Account','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xa6')][_0xaa44('0x108')](db['SugarcrmField'],{'as':_0xaa44('0x1b5'),'foreignKey':'SubjectId'});db[_0xaa44('0xa6')][_0xaa44('0x108')](db[_0xaa44('0xa6')],{'as':_0xaa44('0x1b1'),'foreignKey':'DescriptionId'});db[_0xaa44('0xa6')]['hasMany'](db[_0xaa44('0xa6')],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db['SugarcrmField']['belongsTo'](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':'VariableId'});db[_0xaa44('0xa8')]['hasMany'](db['DeskConfiguration'],{'as':_0xaa44('0x1ab'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xa9')][_0xaa44('0x108')](db[_0xaa44('0xab')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xa9')][_0xaa44('0x108')](db['DeskField'],{'as':_0xaa44('0x1b6'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xa9')][_0xaa44('0x108')](db[_0xaa44('0xab')],{'as':_0xaa44('0x1a8'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xa9')][_0xaa44('0x143')](db[_0xaa44('0xa8')],{'as':'Account','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xa9')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x1b7')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0xaa44('0x1b5'),'foreignKey':'SubjectId'});db['DeskField'][_0xaa44('0x108')](db[_0xaa44('0xab')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xaa44('0xab')][_0xaa44('0x108')](db[_0xaa44('0xab')],{'as':'Field','foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xab')][_0xaa44('0x143')](db['Variable'],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0x1b8')]['hasMany'](db[_0xaa44('0xad')],{'as':_0xaa44('0x1ab'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ac')});db['ZohoConfiguration'][_0xaa44('0x108')](db[_0xaa44('0x1b9')],{'as':_0xaa44('0x1ad'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0xaa44('0xad')][_0xaa44('0x108')](db['ZohoField'],{'as':_0xaa44('0x1b6'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xad')][_0xaa44('0x108')](db['ZohoField'],{'as':_0xaa44('0x1a8'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1b0')});db['ZohoConfiguration']['belongsTo'](db[_0xaa44('0x1b8')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db['ZohoField'][_0xaa44('0x108')](db[_0xaa44('0x1b9')],{'as':_0xaa44('0x1b5'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0x1b9')][_0xaa44('0x108')](db[_0xaa44('0x1b9')],{'as':_0xaa44('0x1b1'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xaa44('0x108')](db[_0xaa44('0x1b9')],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0x1b9')][_0xaa44('0x143')](db[_0xaa44('0x93')],{'as':'Variable','foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0xb0')]['hasMany'](db[_0xaa44('0xb2')],{'as':_0xaa44('0x1ab'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xb2')]['hasMany'](db[_0xaa44('0xb4')],{'as':_0xaa44('0x1ad'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xaa44('0x1b6'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xb2')][_0xaa44('0x108')](db['ZendeskField'],{'as':_0xaa44('0x1a8'),'foreignKey':_0xaa44('0x1b0')});db['ZendeskConfiguration']['belongsTo'](db[_0xaa44('0xb0')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xb2')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x1ba')});db[_0xaa44('0xb4')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xb4')][_0xaa44('0x108')](db['ZendeskField'],{'as':'Description','foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xb4')][_0xaa44('0x108')](db[_0xaa44('0xb4')],{'as':'Field','foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xb4')]['belongsTo'](db[_0xaa44('0x93')],{'as':'Variable','foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0xb6')][_0xaa44('0x108')](db[_0xaa44('0x1bb')],{'as':_0xaa44('0x1ab'),'onDelete':'cascade','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0x1bb')][_0xaa44('0x108')](db['FreshdeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xaa44('0x1ae')});db['FreshdeskConfiguration']['hasMany'](db[_0xaa44('0xb8')],{'as':_0xaa44('0x1b6'),'onDelete':'cascade','foreignKey':_0xaa44('0x1af')});db[_0xaa44('0x1bb')][_0xaa44('0x108')](db[_0xaa44('0xb8')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0x1bb')][_0xaa44('0x143')](db[_0xaa44('0xb6')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0x1bb')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x1bc')});db[_0xaa44('0xb8')]['hasMany'](db[_0xaa44('0xb8')],{'as':_0xaa44('0x1b5'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xb8')][_0xaa44('0x108')](db['FreshdeskField'],{'as':_0xaa44('0x1b1'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xb8')][_0xaa44('0x108')](db['FreshdeskField'],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db['FreshdeskField'][_0xaa44('0x143')](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db['VtigerAccount'][_0xaa44('0x108')](db[_0xaa44('0x1bd')],{'as':_0xaa44('0x1ab'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xaa44('0x1bd')]['hasMany'](db[_0xaa44('0xbc')],{'as':_0xaa44('0x1ad'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0x1bd')]['hasMany'](db['VtigerField'],{'as':_0xaa44('0x1b6'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0x1bd')][_0xaa44('0x108')](db['VtigerField'],{'as':_0xaa44('0x1a8'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0x1bd')][_0xaa44('0x143')](db[_0xaa44('0xba')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xbc')][_0xaa44('0x108')](db[_0xaa44('0xbc')],{'as':'Subject','foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0xaa44('0xbc')],{'as':_0xaa44('0x1b1'),'foreignKey':_0xaa44('0x1af')});db['VtigerField'][_0xaa44('0x108')](db[_0xaa44('0xbc')],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xbc')][_0xaa44('0x143')](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0x1be')][_0xaa44('0x108')](db[_0xaa44('0xbf')],{'as':_0xaa44('0x1ab'),'onDelete':'cascade','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xbf')][_0xaa44('0x108')](db['ServicenowField'],{'as':'Subjects','foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xbf')][_0xaa44('0x108')](db[_0xaa44('0xc1')],{'as':_0xaa44('0x1b6'),'foreignKey':_0xaa44('0x1af')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0xaa44('0x1a8'),'foreignKey':'FieldId'});db[_0xaa44('0xbf')][_0xaa44('0x143')](db['ServicenowAccount'],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db['ServicenowField']['hasMany'](db[_0xaa44('0xc1')],{'as':_0xaa44('0x1b5'),'foreignKey':'SubjectId'});db[_0xaa44('0xc1')][_0xaa44('0x108')](db[_0xaa44('0xc1')],{'as':_0xaa44('0x1b1'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xc1')][_0xaa44('0x108')](db['ServicenowField'],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db['ServicenowField'][_0xaa44('0x143')](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0x1bf')][_0xaa44('0x108')](db[_0xaa44('0xc4')],{'as':_0xaa44('0x1ab'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ac')});db['Dynamics365Configuration'][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':_0xaa44('0x1ad'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xc4')][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':_0xaa44('0x1b6'),'onDelete':'cascade','foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xc4')][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xc4')][_0xaa44('0x143')](db[_0xaa44('0x1bf')],{'as':_0xaa44('0x163'),'foreignKey':'AccountId'});db[_0xaa44('0xc6')][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':_0xaa44('0x1b5'),'foreignKey':_0xaa44('0x1ae')});db[_0xaa44('0xc6')][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':_0xaa44('0x1b1'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0xc6')][_0xaa44('0x108')](db[_0xaa44('0xc6')],{'as':_0xaa44('0x1b2'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xc6')][_0xaa44('0x143')](db['Variable'],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0xc7')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xaa44('0x1ab'),'onDelete':'cascade','foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0xc9')][_0xaa44('0x108')](db['FreshsalesField'],{'as':_0xaa44('0x1ad'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xaa44('0x108')](db['FreshsalesField'],{'as':_0xaa44('0x1b6'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db[_0xaa44('0x1c0')],{'as':_0xaa44('0x1a8'),'foreignKey':_0xaa44('0x1b0')});db[_0xaa44('0xc9')][_0xaa44('0x143')](db[_0xaa44('0xc7')],{'as':_0xaa44('0x163'),'foreignKey':_0xaa44('0x1ac')});db[_0xaa44('0x1c0')][_0xaa44('0x108')](db[_0xaa44('0x1c0')],{'as':_0xaa44('0x1b5'),'foreignKey':_0xaa44('0x1ae')});db['FreshsalesField'][_0xaa44('0x108')](db[_0xaa44('0x1c0')],{'as':_0xaa44('0x1b1'),'foreignKey':_0xaa44('0x1af')});db[_0xaa44('0x1c0')][_0xaa44('0x108')](db[_0xaa44('0x1c0')],{'as':'Field','foreignKey':_0xaa44('0x1b0')});db['FreshsalesField']['belongsTo'](db[_0xaa44('0x93')],{'as':_0xaa44('0x93'),'foreignKey':_0xaa44('0x1b3')});db[_0xaa44('0xcc')][_0xaa44('0x143')](db['ChatWebsite'],{});db['ChatQueueReport'][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172')});db[_0xaa44('0xcc')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['ChatQueueReport'][_0xaa44('0x143')](db[_0xaa44('0x63')],{});db[_0xaa44('0xcc')]['belongsTo'](db[_0xaa44('0x64')],{});db[_0xaa44('0xcc')][_0xaa44('0x143')](db[_0xaa44('0x10')],{});db[_0xaa44('0xcc')]['belongsTo'](db['ChatQueue'],{});db[_0xaa44('0x1c1')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1c2')});db[_0xaa44('0x1c1')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'onDelete':_0xaa44('0x105'),'foreignKey':'ToId'});db['JscriptySessionReport'][_0xaa44('0x108')](db['JscriptyQuestionReport'],{'foreignKey':_0xaa44('0x1c3'),'onDelete':_0xaa44('0x105')});db['JscriptySessionReport']['hasMany'](db[_0xaa44('0xcf')],{'foreignKey':'SessionId','onDelete':_0xaa44('0x105')});db[_0xaa44('0xd5')][_0xaa44('0x143')](db[_0xaa44('0x50')],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xaa44('0xd5')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':'ContactId'});db[_0xaa44('0xd5')][_0xaa44('0x143')](db[_0xaa44('0x53')],{});db[_0xaa44('0xd5')]['belongsTo'](db[_0xaa44('0x55')],{});db[_0xaa44('0xd5')][_0xaa44('0x143')](db[_0xaa44('0x10')],{});db[_0xaa44('0xd5')][_0xaa44('0x143')](db[_0xaa44('0x12b')],{});db[_0xaa44('0xdb')]['hasMany'](db[_0xaa44('0xd3')],{'foreignKey':_0xaa44('0x1c4')});db[_0xaa44('0xdb')]['hasMany'](db[_0xaa44('0xd1')],{'foreignKey':_0xaa44('0x1c4')});db[_0xaa44('0xdb')][_0xaa44('0x108')](db['JscriptyAnswerReport'],{'foreignKey':_0xaa44('0x1c4')});db[_0xaa44('0x137')]['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'through':_0xaa44('0x1c5')});db['Team'][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x119')});db[_0xaa44('0xe3')]['belongsToMany'](db[_0xaa44('0x19')],{'through':_0xaa44('0x14c'),'as':'VoiceQueues'});db[_0xaa44('0xe3')][_0xaa44('0x112')](db[_0xaa44('0x125')],{'through':_0xaa44('0x162'),'as':_0xaa44('0x126')});db[_0xaa44('0xe3')]['belongsToMany'](db[_0xaa44('0x67')],{'through':_0xaa44('0x18c'),'as':'ChatQueues'});db[_0xaa44('0xe3')]['belongsToMany'](db[_0xaa44('0x4d')],{'through':_0xaa44('0x17a'),'as':_0xaa44('0x129')});db[_0xaa44('0xe3')][_0xaa44('0x112')](db[_0xaa44('0x12b')],{'through':_0xaa44('0x17f'),'as':_0xaa44('0x12c')});db[_0xaa44('0xe3')][_0xaa44('0x112')](db[_0xaa44('0x5c')],{'through':_0xaa44('0x185'),'as':_0xaa44('0x1c6')});db['Team'][_0xaa44('0x112')](db['WhatsappQueue'],{'through':_0xaa44('0x1c7'),'as':'WhatsappQueues'});db['Team']['belongsToMany'](db[_0xaa44('0xf0')],{'through':_0xaa44('0x102'),'as':_0xaa44('0x124')});db['Campaign']['hasMany'](db['CmHopper'],{'as':_0xaa44('0x13d'),'foreignKey':_0xaa44('0x192')});db['Campaign'][_0xaa44('0x108')](db[_0xaa44('0x74')],{'as':_0xaa44('0x13f'),'foreignKey':_0xaa44('0x192')});db[_0xaa44('0xe6')][_0xaa44('0x108')](db['CmHopperHistory'],{'as':_0xaa44('0x140'),'foreignKey':_0xaa44('0x192')});db[_0xaa44('0xe6')][_0xaa44('0x108')](db[_0xaa44('0x72')],{'as':_0xaa44('0x141'),'foreignKey':_0xaa44('0x192')});db['Campaign']['belongsTo'](db[_0xaa44('0x144')],{'as':'Trunk','foreignKey':_0xaa44('0x145')});db[_0xaa44('0xe6')][_0xaa44('0x143')](db['Trunk'],{'as':_0xaa44('0x146'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0xaa44('0x143')](db[_0xaa44('0x83')],{'as':_0xaa44('0x83'),'foreignKey':_0xaa44('0x148')});db['Campaign'][_0xaa44('0x143')](db[_0xaa44('0x137')],{'as':_0xaa44('0x137'),'foreignKey':_0xaa44('0x1c8')});db[_0xaa44('0xe6')][_0xaa44('0x112')](db[_0xaa44('0x116')],{'as':_0xaa44('0x117'),'through':_0xaa44('0x1c9')});db[_0xaa44('0xe6')][_0xaa44('0x112')](db[_0xaa44('0x116')],{'as':'BlackLists','through':_0xaa44('0x1ca')});db[_0xaa44('0x178')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0xaa44('0x65'),'foreignKey':_0xaa44('0x16a')});db[_0xaa44('0x1cb')][_0xaa44('0x143')](db[_0xaa44('0x3f')],{});db['MailTransferReport']['belongsTo'](db[_0xaa44('0x10e')],{});db[_0xaa44('0x1cb')]['belongsTo'](db[_0xaa44('0x3b')],{'foreignKey':_0xaa44('0x1cc'),'as':_0xaa44('0x1cd')});db['MailTransferReport'][_0xaa44('0x143')](db['User'],{'foreignKey':_0xaa44('0x1ce'),'as':_0xaa44('0x1cf')});db[_0xaa44('0x1cb')]['belongsTo'](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1d0'),'as':_0xaa44('0x1d1')});db[_0xaa44('0x1cb')][_0xaa44('0x143')](db[_0xaa44('0x125')],{'foreignKey':_0xaa44('0x1d2'),'as':_0xaa44('0x1d3')});db[_0xaa44('0x1cb')][_0xaa44('0x143')](db[_0xaa44('0x3b')],{'foreignKey':'ToMailAccountId','as':_0xaa44('0x1d4')});db[_0xaa44('0x1d5')]['belongsTo'](db[_0xaa44('0x64')],{});db[_0xaa44('0x1d5')][_0xaa44('0x143')](db[_0xaa44('0x63')],{});db['ChatTransferReport'][_0xaa44('0x143')](db['ChatWebsite'],{'foreignKey':_0xaa44('0x1d6'),'as':_0xaa44('0x1cd')});db[_0xaa44('0x1d5')]['belongsTo'](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1ce'),'as':'FromAgent'});db['ChatTransferReport'][_0xaa44('0x143')](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1d0'),'as':_0xaa44('0x1d1')});db['ChatTransferReport']['belongsTo'](db['ChatQueue'],{'foreignKey':_0xaa44('0x1d7'),'as':_0xaa44('0x1d3')});db[_0xaa44('0x1d5')][_0xaa44('0x143')](db['ChatWebsite'],{'foreignKey':_0xaa44('0x1d8'),'as':'ToAccount'});db[_0xaa44('0xed')][_0xaa44('0x143')](db[_0xaa44('0x4b')],{});db['FaxTransferReport'][_0xaa44('0x143')](db['FaxInteraction'],{});db[_0xaa44('0xed')]['belongsTo'](db[_0xaa44('0x47')],{'foreignKey':_0xaa44('0x1d9'),'as':_0xaa44('0x1cd')});db[_0xaa44('0xed')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1ce'),'as':'FromAgent'});db[_0xaa44('0xed')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'foreignKey':'ToUserId','as':_0xaa44('0x1d1')});db['FaxTransferReport'][_0xaa44('0x143')](db[_0xaa44('0x4d')],{'foreignKey':_0xaa44('0x1da'),'as':'ToQueue'});db[_0xaa44('0xed')]['belongsTo'](db[_0xaa44('0x47')],{'foreignKey':_0xaa44('0x1db'),'as':_0xaa44('0x1d4')});db[_0xaa44('0x1dc')][_0xaa44('0x143')](db[_0xaa44('0x5a')],{});db[_0xaa44('0x1dc')]['belongsTo'](db[_0xaa44('0x10b')],{});db[_0xaa44('0x1dc')][_0xaa44('0x143')](db[_0xaa44('0x132')],{'foreignKey':_0xaa44('0x1dd'),'as':'FromAccount'});db[_0xaa44('0x1dc')][_0xaa44('0x143')](db['User'],{'foreignKey':_0xaa44('0x1ce'),'as':_0xaa44('0x1cf')});db[_0xaa44('0x1dc')]['belongsTo'](db[_0xaa44('0x10')],{'foreignKey':'ToUserId','as':_0xaa44('0x1d1')});db[_0xaa44('0x1dc')]['belongsTo'](db[_0xaa44('0x5c')],{'foreignKey':_0xaa44('0x1de'),'as':_0xaa44('0x1d3')});db[_0xaa44('0x1dc')][_0xaa44('0x143')](db[_0xaa44('0x132')],{'foreignKey':_0xaa44('0x1df'),'as':_0xaa44('0x1d4')});db[_0xaa44('0xee')]['belongsTo'](db[_0xaa44('0x55')],{});db[_0xaa44('0xee')]['belongsTo'](db[_0xaa44('0x53')],{});db[_0xaa44('0xee')][_0xaa44('0x143')](db[_0xaa44('0x50')],{'foreignKey':_0xaa44('0x1e0'),'as':'FromAccount'});db[_0xaa44('0xee')]['belongsTo'](db['User'],{'foreignKey':_0xaa44('0x1ce'),'as':_0xaa44('0x1cf')});db[_0xaa44('0xee')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1d0'),'as':_0xaa44('0x1d1')});db[_0xaa44('0xee')][_0xaa44('0x143')](db['SmsQueue'],{'foreignKey':_0xaa44('0x1e1'),'as':_0xaa44('0x1d3')});db[_0xaa44('0xee')]['belongsTo'](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db[_0xaa44('0x116')][_0xaa44('0x108')](db[_0xaa44('0x7f')],{'as':_0xaa44('0x15c'),'foreignKey':'ListId','onDelete':_0xaa44('0x105')});db[_0xaa44('0x116')][_0xaa44('0x108')](db[_0xaa44('0x1e2')],{'as':_0xaa44('0x1e3'),'foreignKey':_0xaa44('0x172')});db['CmList']['hasMany'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x114'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0xaa44('0x108')](db['CmHopperFinal'],{'as':_0xaa44('0x13f'),'foreignKey':_0xaa44('0x172')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0xaa44('0x1e4'),'foreignKey':_0xaa44('0x172')});db[_0xaa44('0x116')][_0xaa44('0x108')](db[_0xaa44('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xaa44('0x172')});db['CmList'][_0xaa44('0x112')](db[_0xaa44('0x19')],{'as':_0xaa44('0x1e5'),'through':_0xaa44('0x1e6')});db['CmList'][_0xaa44('0x112')](db['User'],{'as':_0xaa44('0x160'),'through':_0xaa44('0x118')});db[_0xaa44('0xf0')][_0xaa44('0x108')](db[_0xaa44('0x16')],{'as':_0xaa44('0x10a'),'onDelete':'cascade'});db[_0xaa44('0xf0')]['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':'UserVoicePrefix'});db[_0xaa44('0xf0')][_0xaa44('0x112')](db[_0xaa44('0xe3')],{'through':_0xaa44('0x102'),'as':_0xaa44('0x14b')});db[_0xaa44('0xf2')]['hasMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'foreignKey':_0xaa44('0x111')});db[_0xaa44('0xf2')]['hasMany'](db[_0xaa44('0x1e7')],{'as':_0xaa44('0x1e8'),'foreignKey':_0xaa44('0x111'),'onDelete':_0xaa44('0x105')});db[_0xaa44('0x1e7')][_0xaa44('0x108')](db[_0xaa44('0x1e9')],{'as':_0xaa44('0x1ea'),'foreignKey':_0xaa44('0x1eb'),'onDelete':_0xaa44('0x105')});db['WhatsappAccount'][_0xaa44('0x108')](db[_0xaa44('0x7f')],{'as':_0xaa44('0x15c'),'foreignKey':'WhatsappAccountId','onDelete':_0xaa44('0x105')});db['WhatsappAccount'][_0xaa44('0x108')](db[_0xaa44('0x7d')],{'as':_0xaa44('0x15d'),'foreignKey':_0xaa44('0x1ec')});db['WhatsappAccount'][_0xaa44('0x108')](db['WhatsappMessage'],{'as':_0xaa44('0x15e'),'foreignKey':'WhatsappAccountId'});db[_0xaa44('0x1ed')][_0xaa44('0x108')](db[_0xaa44('0xf9')],{'as':_0xaa44('0x16f')});db[_0xaa44('0x1ed')][_0xaa44('0x108')](db[_0xaa44('0xf7')],{'as':_0xaa44('0x13b')});db['WhatsappAccount'][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':'ListId'});db[_0xaa44('0x1ed')][_0xaa44('0x143')](db['Pause'],{'as':_0xaa44('0x149'),'foreignKey':_0xaa44('0x14a')});db[_0xaa44('0x1ed')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':'Agents','through':_0xaa44('0x136')});db[_0xaa44('0xf7')]['belongsTo'](db[_0xaa44('0x10')],{'onDelete':'restrict'});db[_0xaa44('0xf7')][_0xaa44('0x143')](db['WhatsappQueue'],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0xf7')][_0xaa44('0x143')](db[_0xaa44('0x1ed')],{'onDelete':_0xaa44('0x158')});db[_0xaa44('0xf7')]['belongsTo'](db['Interval'],{'onDelete':_0xaa44('0x158'),'foreignKey':'IntervalId'});db[_0xaa44('0xf7')][_0xaa44('0x143')](db['Tag'],{'onDelete':_0xaa44('0x158'),'foreignKey':'TagId'});db[_0xaa44('0xf9')][_0xaa44('0x108')](db[_0xaa44('0x1ee')],{'as':_0xaa44('0x15e'),'onDelete':_0xaa44('0x105'),'foreignKey':_0xaa44('0x1ef')});db[_0xaa44('0xf9')][_0xaa44('0x143')](db[_0xaa44('0x1ed')],{'as':_0xaa44('0x163'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0xaa44('0x143')](db['CmContact'],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db[_0xaa44('0xf9')]['belongsTo'](db[_0xaa44('0x10')],{'as':_0xaa44('0x174'),'foreignKey':_0xaa44('0x106')});db['WhatsappInteraction'][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':_0xaa44('0x1a2'),'as':'Tags'});db[_0xaa44('0xf9')][_0xaa44('0x112')](db[_0xaa44('0x8e')],{'through':'whatsapp_interaction_has_tags','as':_0xaa44('0x165')});db[_0xaa44('0xf9')]['belongsToMany'](db[_0xaa44('0x10')],{'as':_0xaa44('0x166'),'through':_0xaa44('0x122'),'foreignKey':_0xaa44('0x1ef')});db[_0xaa44('0x1ee')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'as':_0xaa44('0x10')});db[_0xaa44('0x1ee')][_0xaa44('0x143')](db[_0xaa44('0x6f')],{'onDelete':'cascade','as':_0xaa44('0x153')});db[_0xaa44('0x1ee')][_0xaa44('0x143')](db[_0xaa44('0xf9')],{'onDelete':_0xaa44('0x105'),'as':_0xaa44('0x168'),'foreignKey':_0xaa44('0x1ef')});db[_0xaa44('0x1ee')][_0xaa44('0x143')](db[_0xaa44('0x1ed')],{'as':'Account','foreignKey':_0xaa44('0x1ec')});db[_0xaa44('0xfc')][_0xaa44('0x143')](db[_0xaa44('0x1ed')],{});db[_0xaa44('0xfc')][_0xaa44('0x143')](db[_0xaa44('0x116')],{'as':_0xaa44('0x16c'),'foreignKey':_0xaa44('0x172')});db['WhatsappQueueReport']['belongsTo'](db[_0xaa44('0x6f')],{'as':_0xaa44('0x153'),'foreignKey':_0xaa44('0x154')});db['WhatsappQueueReport']['belongsTo'](db[_0xaa44('0xf9')],{});db['WhatsappQueueReport']['belongsTo'](db['WhatsappQueue'],{});db[_0xaa44('0xfc')]['belongsTo'](db[_0xaa44('0x1ee')],{});db[_0xaa44('0xfc')][_0xaa44('0x143')](db[_0xaa44('0x10')],{});db[_0xaa44('0xfd')][_0xaa44('0x143')](db[_0xaa44('0x1ee')],{});db[_0xaa44('0xfd')][_0xaa44('0x143')](db[_0xaa44('0xf9')],{});db[_0xaa44('0xfd')][_0xaa44('0x143')](db[_0xaa44('0x1ed')],{'foreignKey':_0xaa44('0x1f0'),'as':_0xaa44('0x1cd')});db[_0xaa44('0xfd')]['belongsTo'](db[_0xaa44('0x1ed')],{'foreignKey':_0xaa44('0x1f1'),'as':_0xaa44('0x1d4')});db[_0xaa44('0xfd')]['belongsTo'](db[_0xaa44('0x1f2')],{'foreignKey':_0xaa44('0x1f3'),'as':'ToQueue'});db[_0xaa44('0xfd')][_0xaa44('0x143')](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1ce'),'as':'FromAgent'});db[_0xaa44('0xfd')]['belongsTo'](db[_0xaa44('0x10')],{'foreignKey':_0xaa44('0x1d0'),'as':'ToAgent'});db[_0xaa44('0x1f2')][_0xaa44('0x112')](db[_0xaa44('0x10')],{'as':_0xaa44('0x160'),'through':_0xaa44('0x36'),'foreignKey':_0xaa44('0x1f4')});db['WhatsappQueue']['belongsToMany'](db[_0xaa44('0xe3')],{'through':_0xaa44('0x1c7'),'as':'Teams'});db[_0xaa44('0x100')]['hasOne'](db['MailServerIn'],{'as':_0xaa44('0x15a'),'onDelete':_0xaa44('0x158')});db[_0xaa44('0x100')][_0xaa44('0x159')](db[_0xaa44('0x156')],{'as':_0xaa44('0x15b'),'onDelete':_0xaa44('0x158')});module[_0xaa44('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x292e=['user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','VoiceCallReport','VoiceQueueReport','uniqueid','AgentReports','Contact','CloudProviderId','restrict','MailAccountId','Smtp','Dispositions','CannedAnswer','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachment','Attachments','Account','ChatOfflineMessageId','TagId','Dashboard','Items','FaxAccountId','Exntensions','FaxInteractionId','Owner','fax_interaction_has_tags','AttachmentId','FaxQueue','FaxQueueReport','SmsAccountId','SmsAccount','SmsInteractionId','sms_interaction_has_tags','Interaction','UserSmsQueue','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatInternalMessage','chat_group_has_users','CmCompany','CompanyId','MailInteractions','cm_contact_has_tags','CampaignId','OwnerId','Automation','All','OneAll','AutomationAllId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','SmsApplications','Schedule','DefaultReportId','AnalyticCustomReport','CustomReportId','VoiceMusicOnHold','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','Subject','Field','FieldId','VariableId','SugarcrmConfiguration','Description','ZohoAccount','ZohoField','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','ServicenowConfiguration','ServicenowField','FreshsalesAccount','ToId','JscriptyQuestionReport','SessionId','ProjectId','VoiceQueues','team_has_fax_queues','SmsQueues','team_has_whatsapp_queues','TeamVoicePrefix','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','FromAccount','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','voice_queues_has_cm_lists','UserVoicePrefix','UserProfileSections','UserProfileResource','Resources','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','user_has_whatsapp_interactions','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xcall','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','mysql','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.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','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../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','SquareRecording','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','VoicePrefixes','MailQueues','ChatQueue','ChatQueues','FaxQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites'];(function(_0x4c2fc6,_0x27e110){var _0x4d2bef=function(_0x43b2e4){while(--_0x43b2e4){_0x4c2fc6['push'](_0x4c2fc6['shift']());}};_0x4d2bef(++_0x27e110);}(_0x292e,0xcb));var _0xe292=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x292e[_0x2b4411];return _0x8e41ef;};'use strict';var config=require(_0xe292('0x0'));var Sequelize=require(_0xe292('0x1'));var _=require(_0xe292('0x2'));var jstz=require(_0xe292('0x3'));var timezone=jstz['determine']();config['sequelize']=_[_0xe292('0x4')](config[_0xe292('0x1')],{'database':_0xe292('0x5'),'username':_0xe292('0x6'),'password':'xC@LL1234','options':{'host':_0xe292('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe292('0x8')},'logging':![],'timezone':timezone[_0xe292('0x9')](),'define':{'charset':_0xe292('0xa'),'collate':_0xe292('0xb')}}});config[_0xe292('0xc')]=_[_0xe292('0x4')](config['sequelizeHistory'],{'database':'motion2','username':_0xe292('0x6'),'password':_0xe292('0xd'),'options':{'host':_0xe292('0x7'),'port':0xcea,'dialect':_0xe292('0xe'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe292('0x9')](),'define':{'charset':_0xe292('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe292('0x1')][_0xe292('0xf')],config[_0xe292('0x1')][_0xe292('0x10')],config[_0xe292('0x1')][_0xe292('0x11')],config['sequelize'][_0xe292('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe292('0xc')][_0xe292('0xf')],config[_0xe292('0xc')][_0xe292('0x10')],config[_0xe292('0xc')][_0xe292('0x11')],config['sequelizeHistory'][_0xe292('0x12')])};db[_0xe292('0x13')]=db['sequelize']['import'](_0xe292('0x14'));db[_0xe292('0x15')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe292('0x17')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x18'));db['VoiceExtension']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x19'));db['VoiceMusicOnHold']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xe292('0x1a')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x1b'));db[_0xe292('0x1c')]=db[_0xe292('0x1')]['import'](_0xe292('0x1d'));db[_0xe292('0x1e')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x1f'));db[_0xe292('0x20')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x21'));db['VoiceMailMessage']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x22'));db[_0xe292('0x23')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/voiceDialReport/voiceDialReport.model');db[_0xe292('0x24')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x25'));db['VoiceQueueReport']=db[_0xe292('0x1')]['import'](_0xe292('0x26'));db[_0xe292('0x27')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x28'));db[_0xe292('0x29')]=db[_0xe292('0x1')]['import'](_0xe292('0x2a'));db[_0xe292('0x2b')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0xe292('0x2c')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe292('0x2d')]=db[_0xe292('0x1')]['import'](_0xe292('0x2e'));db[_0xe292('0x2f')]=db['sequelize']['import'](_0xe292('0x30'));db[_0xe292('0x31')]=db['sequelize']['import'](_0xe292('0x32'));db[_0xe292('0x33')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x34'));db['UserSmsQueue']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/userSmsQueue/userSmsQueue.model');db[_0xe292('0x35')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x36'));db[_0xe292('0x37')]=db['sequelize'][_0xe292('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xe292('0x38')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x39'));db[_0xe292('0x3a')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x3b'));db[_0xe292('0x3c')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x3d'));db[_0xe292('0x3e')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x3f'));db[_0xe292('0x40')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x41'));db[_0xe292('0x42')]=db['sequelize']['import'](_0xe292('0x43'));db[_0xe292('0x44')]=db[_0xe292('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0xe292('0x45')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x46'));db[_0xe292('0x47')]=db[_0xe292('0x1')]['import'](_0xe292('0x48'));db['Dashboard']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/dashboard/dashboard.model');db[_0xe292('0x49')]=db['sequelize']['import'](_0xe292('0x4a'));db[_0xe292('0x4b')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x4c'));db[_0xe292('0x4d')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x4e'));db[_0xe292('0x4f')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x50'));db['FaxQueue']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x51'));db['SmsAccount']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x52'));db[_0xe292('0x53')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x54'));db[_0xe292('0x55')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x56'));db[_0xe292('0x57')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x58'));db[_0xe292('0x59')]=db['sequelize'][_0xe292('0x16')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/openchannelAccount/openchannelAccount.model');db[_0xe292('0x5a')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x5b'));db[_0xe292('0x5c')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x5d'));db['OpenchannelMessage']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x5e'));db['OpenchannelQueue']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/openchannelQueue/openchannelQueue.model');db[_0xe292('0x5f')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x60'));db[_0xe292('0x61')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x62'));db[_0xe292('0x63')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x64'));db['ChatInteraction']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x65'));db[_0xe292('0x66')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x67'));db[_0xe292('0x68')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x69'));db['ChatQueue']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/chatQueue/chatQueue.model');db[_0xe292('0x6a')]=db[_0xe292('0x1')]['import'](_0xe292('0x6b'));db[_0xe292('0x6c')]=db['sequelize']['import'](_0xe292('0x6d'));db['CmCompany']=db['sequelize'][_0xe292('0x16')](_0xe292('0x6e'));db[_0xe292('0x6f')]=db[_0xe292('0x1')]['import'](_0xe292('0x70'));db['CmHopper']=db['sequelize'][_0xe292('0x16')](_0xe292('0x71'));db[_0xe292('0x72')]=db[_0xe292('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xe292('0x73')]=db[_0xe292('0x1')]['import'](_0xe292('0x74'));db[_0xe292('0x75')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/cmHopperHistory/cmHopperHistory.model');db['ReportAgentPreview']=db[_0xe292('0x1')]['import'](_0xe292('0x76'));db[_0xe292('0x77')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x78'));db['Action']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x79'));db['Automation']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x7a'));db['CannedAnswer']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x7b'));db[_0xe292('0x7c')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x7d'));db[_0xe292('0x7e')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x7f'));db[_0xe292('0x80')]=db[_0xe292('0x1')]['import']('../api/interval/interval.model');db[_0xe292('0x81')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/pause/pause.model');db[_0xe292('0x82')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x83'));db['VoiceQueuesLog']=db['sequelize']['import'](_0xe292('0x84'));db['Schedule']=db['sequelize']['import']('../api/schedule/schedule.model');db[_0xe292('0x85')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x86'));db[_0xe292('0x87')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x88'));db[_0xe292('0x89')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/template/template.model');db[_0xe292('0x8a')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x8b'));db[_0xe292('0x8c')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x8d'));db[_0xe292('0x8e')]=db['sequelize']['import'](_0xe292('0x8f'));db[_0xe292('0x90')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x91'));db['AnalyticCustomReport']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x92'));db[_0xe292('0x93')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe292('0x94')]=db['sequelize'][_0xe292('0x16')](_0xe292('0x95'));db['AnalyticMetric']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xe292('0x96')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x97'));db[_0xe292('0x98')]=db[_0xe292('0x1')]['import'](_0xe292('0x99'));db['SalesforceConfiguration']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x9a'));db[_0xe292('0x9b')]=db['sequelize'][_0xe292('0x16')]('../api/intSalesforceField/intSalesforceField.model');db[_0xe292('0x9c')]=db['sequelize']['import'](_0xe292('0x9d'));db['SugarcrmConfiguration']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x9e'));db[_0xe292('0x9f')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe292('0xa0')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/intDeskAccount/intDeskAccount.model');db[_0xe292('0xa1')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xa2'));db[_0xe292('0xa3')]=db[_0xe292('0x1')]['import'](_0xe292('0xa4'));db['ZohoAccount']=db[_0xe292('0x1')]['import'](_0xe292('0xa5'));db[_0xe292('0xa6')]=db[_0xe292('0x1')]['import'](_0xe292('0xa7'));db['ZohoField']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xa8'));db[_0xe292('0xa9')]=db[_0xe292('0x1')]['import'](_0xe292('0xaa'));db[_0xe292('0xab')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xac'));db['FreshdeskAccount']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xad'));db[_0xe292('0xae')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xaf'));db[_0xe292('0xb0')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xe292('0xb1')]=db[_0xe292('0x1')]['import'](_0xe292('0xb2'));db[_0xe292('0xb3')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xb4'));db['VtigerField']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xb5'));db['ServicenowAccount']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xb6'));db['ServicenowConfiguration']=db['sequelize'][_0xe292('0x16')](_0xe292('0xb7'));db['ServicenowField']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xb8'));db[_0xe292('0xb9')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xba'));db[_0xe292('0xbb')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xbc'));db[_0xe292('0xbd')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xbe'));db['FreshsalesAccount']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xbf'));db[_0xe292('0xc0')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xc1'));db[_0xe292('0xc2')]=db[_0xe292('0x1')]['import'](_0xe292('0xc3'));db[_0xe292('0x8e')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/integration/integration.model');db[_0xe292('0xc4')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/network/network.model');db[_0xe292('0xc5')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xc6'));db['ChatInternalMessage']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xc7'));db[_0xe292('0xc8')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xc9'));db['JscriptyQuestionReport']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db['sequelize'][_0xe292('0x16')](_0xe292('0xca'));db[_0xe292('0xcb')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xcc'));db['SquareReport']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xcd'));db[_0xe292('0xce')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xcf'));db[_0xe292('0xd0')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xd1'));db[_0xe292('0xd2')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xd3'));db['SquareOdbc']=db[_0xe292('0x1')]['import'](_0xe292('0xd4'));db[_0xe292('0xd5')]=db[_0xe292('0x1')]['import'](_0xe292('0xd6'));db[_0xe292('0xd7')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/squareRecording/squareRecording.model');db['SquareMessage']=db['sequelize']['import'](_0xe292('0xd8'));db[_0xe292('0xd9')]=db[_0xe292('0x1')]['import'](_0xe292('0xda'));db[_0xe292('0xdb')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xdc'));db[_0xe292('0xdd')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xde'));db[_0xe292('0xdf')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xe0'));db['Attachment']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xe1'));db['Plugin']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xe2'));db[_0xe292('0xe3')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xe4'));db[_0xe292('0xe5')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xe6'));db[_0xe292('0xe7')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xe8'));db['OpenchannelTransferReport']=db['sequelize'][_0xe292('0x16')](_0xe292('0xe9'));db[_0xe292('0xea')]=db[_0xe292('0x1')]['import'](_0xe292('0xeb'));db[_0xe292('0xec')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xed'));db[_0xe292('0xee')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xef'));db[_0xe292('0xf0')]=db[_0xe292('0x1')]['import'](_0xe292('0xf1'));db[_0xe292('0xf2')]=db['sequelize'][_0xe292('0x16')](_0xe292('0xf3'));db['UserProfileResource']=db[_0xe292('0x1')]['import'](_0xe292('0xf4'));db[_0xe292('0xf5')]=db['sequelize']['import']('../api/userNotification/userNotification.model');db[_0xe292('0xf6')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xf7'));db['WhatsappApplication']=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xf8'));db[_0xe292('0xf9')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xfa'));db[_0xe292('0xfb')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xfc'));db[_0xe292('0xfd')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xe292('0xfe')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0xff'));db['WhatsappQueue']=db[_0xe292('0x1')]['import']('../api/whatsappQueue/whatsappQueue.model');db[_0xe292('0x100')]=db[_0xe292('0x1')][_0xe292('0x16')]('../api/cloudProvider/cloudProvider.model');db[_0xe292('0x101')]=db[_0xe292('0x1')][_0xe292('0x16')](_0xe292('0x102'));db['TeamVoicePrefix']=db[_0xe292('0x1')][_0xe292('0x16')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db[_0xe292('0x1')]['import'](_0xe292('0x103'));db[_0xe292('0x13')][_0xe292('0x104')](db['VoiceMail'],{'as':_0xe292('0x20'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x1c')],{'as':_0xe292('0x108'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x2c')],{'as':_0xe292('0x109'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x10a')],{'as':_0xe292('0x10b'),'onDelete':_0xe292('0x105'),'hooks':!![]});db[_0xe292('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0xe292('0x10c'),'foreignKey':'UserId'});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x75')],{'as':_0xe292('0x10d'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x10e')],{'as':_0xe292('0x10e'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x5c')],{'as':_0xe292('0x10f'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x110')],{'as':_0xe292('0x111'),'foreignKey':_0xe292('0x106')});db['User'][_0xe292('0x107')](db[_0xe292('0x55')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x112')],{'as':_0xe292('0x113'),'foreignKey':'UserId'});db[_0xe292('0x13')][_0xe292('0x107')](db[_0xe292('0x42')],{'as':'MailInteractions','foreignKey':_0xe292('0x106')});db['User'][_0xe292('0x107')](db[_0xe292('0xf9')],{'as':_0xe292('0x114'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13')][_0xe292('0x107')](db['UserNotification'],{'as':_0xe292('0x115'),'foreignKey':'SenderId'});db[_0xe292('0x13')][_0xe292('0x116')](db[_0xe292('0xf0')],{'as':_0xe292('0xf0'),'foreignKey':_0xe292('0x117')});db[_0xe292('0x13')][_0xe292('0x118')](db['ChatGroup'],{'as':_0xe292('0x119'),'through':'chat_group_has_users'});db[_0xe292('0x13')][_0xe292('0x118')](db['CmContact'],{'as':_0xe292('0x11a'),'through':_0xe292('0x11b')});db[_0xe292('0x13')][_0xe292('0x118')](db['CmList'],{'as':_0xe292('0x11c'),'through':'cm_user_has_lists'});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':_0xe292('0x11d')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x42')],{'as':'MailInteractions','through':'user_has_mail_interactions'});db[_0xe292('0x13')]['belongsToMany'](db[_0xe292('0x110')],{'as':_0xe292('0x111'),'through':'user_has_chat_interactions'});db[_0xe292('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0xe292('0x113'),'through':_0xe292('0x11e')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x55')],{'as':_0xe292('0x11f'),'through':_0xe292('0x120')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x5c')],{'as':_0xe292('0x10f'),'through':_0xe292('0x121')});db[_0xe292('0x13')]['belongsToMany'](db[_0xe292('0xf9')],{'as':_0xe292('0x114'),'through':'user_has_whatsapp_interactions'});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x1a')],{'as':'VoiceQueues','through':_0xe292('0x2d'),'required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0xee')],{'as':_0xe292('0x122'),'through':'UserVoicePrefix','required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db['MailQueue'],{'as':_0xe292('0x123'),'through':_0xe292('0x31'),'required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x124')],{'as':_0xe292('0x125'),'through':_0xe292('0x2f'),'required':![],'hooks':!![]});db[_0xe292('0x13')][_0xe292('0x118')](db['FaxQueue'],{'as':_0xe292('0x126'),'through':_0xe292('0x33'),'required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db['SmsQueue'],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x127')],{'as':_0xe292('0x128'),'through':_0xe292('0x35'),'required':![]});db['User']['belongsToMany'](db[_0xe292('0x129')],{'as':_0xe292('0x12a'),'through':_0xe292('0x37'),'required':![]});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0xec')],{'through':_0xe292('0x12b')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x5f')],{'as':_0xe292('0x12c'),'through':_0xe292('0x12d')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x4b')],{'as':'FaxAccounts','through':_0xe292('0x12e')});db[_0xe292('0x13')][_0xe292('0x118')](db['MailAccount'],{'as':_0xe292('0x12f'),'through':_0xe292('0x130')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0x131')],{'as':_0xe292('0x132'),'through':'user_has_openchannel_accounts'});db[_0xe292('0x13')][_0xe292('0x118')](db['SmsAccount'],{'as':_0xe292('0x133'),'through':_0xe292('0x134')});db['User'][_0xe292('0x118')](db[_0xe292('0xf6')],{'as':_0xe292('0x135'),'through':_0xe292('0x136')});db[_0xe292('0x13')][_0xe292('0x118')](db[_0xe292('0xd5')],{'as':'SquareProjects','through':_0xe292('0x137')});db['VoiceChanSpy'][_0xe292('0x107')](db['VoiceExtension'],{'as':_0xe292('0x138'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x139')});db[_0xe292('0x17')]['hasMany'](db[_0xe292('0x10a')],{'onDelete':_0xe292('0x105')});db[_0xe292('0x10a')][_0xe292('0x107')](db[_0xe292('0x10a')],{'as':_0xe292('0x13a'),'onDelete':_0xe292('0x105')});db['VoiceMusicOnHold']['belongsToMany'](db[_0xe292('0x85')],{'as':_0xe292('0x13b'),'through':_0xe292('0x13c')});db[_0xe292('0x1a')][_0xe292('0x107')](db[_0xe292('0x2c')],{'as':_0xe292('0x13d'),'foreignKey':'VoiceQueueId'});db[_0xe292('0x1a')][_0xe292('0x107')](db[_0xe292('0x13e')],{'as':_0xe292('0x13f'),'foreignKey':_0xe292('0x140')});db[_0xe292('0x1a')]['hasMany'](db[_0xe292('0x73')],{'as':_0xe292('0x10c'),'foreignKey':_0xe292('0x140')});db[_0xe292('0x1a')][_0xe292('0x107')](db[_0xe292('0x75')],{'as':_0xe292('0x141'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xe292('0x107')](db[_0xe292('0x10e')],{'as':_0xe292('0x10e'),'foreignKey':_0xe292('0x140')});db['VoiceQueue'][_0xe292('0x107')](db[_0xe292('0x72')],{'as':_0xe292('0x142'),'foreignKey':_0xe292('0x140')});db[_0xe292('0x1a')]['hasMany'](db[_0xe292('0x143')],{'as':_0xe292('0x144'),'foreignKey':_0xe292('0x140')});db[_0xe292('0x1a')]['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db['VoiceQueue'][_0xe292('0x116')](db['Trunk'],{'as':_0xe292('0x145'),'foreignKey':_0xe292('0x146')});db[_0xe292('0x1a')][_0xe292('0x116')](db['Interval'],{'as':_0xe292('0x80'),'foreignKey':_0xe292('0x147')});db[_0xe292('0x1a')]['belongsTo'](db[_0xe292('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0xe292('0x148')});db[_0xe292('0x1a')][_0xe292('0x118')](db[_0xe292('0xec')],{'as':_0xe292('0x11c'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0xe292('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xe292('0x1a')][_0xe292('0x118')](db[_0xe292('0xd9')],{'as':_0xe292('0x149'),'through':_0xe292('0x101')});db[_0xe292('0x1a')][_0xe292('0x118')](db['CmList'],{'as':_0xe292('0x14a'),'through':_0xe292('0x14b')});db[_0xe292('0x1c')][_0xe292('0x116')](db['User'],{'as':_0xe292('0x13'),'foreignKey':_0xe292('0x106')});db['ScreenRecording'][_0xe292('0x116')](db[_0xe292('0x13')],{'as':_0xe292('0x13'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x20')]['hasMany'](db[_0xe292('0x14c')],{'as':_0xe292('0x14d'),'onDelete':'cascade','foreignKey':_0xe292('0x14e'),'sourceKey':_0xe292('0x14f')});db[_0xe292('0x14c')]['belongsTo'](db[_0xe292('0x20')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xe292('0x150')][_0xe292('0x107')](db[_0xe292('0x151')],{'as':'QueueCalls','foreignKey':_0xe292('0x152'),'constraints':![]});db[_0xe292('0x150')][_0xe292('0x107')](db[_0xe292('0x24')],{'as':_0xe292('0x153'),'foreignKey':_0xe292('0x152'),'constraints':![]});db[_0xe292('0x150')][_0xe292('0x116')](db[_0xe292('0x13')],{'as':'User','foreignKey':_0xe292('0x106')});db[_0xe292('0x150')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':'ContactId'});db['MailServerIn'][_0xe292('0x116')](db[_0xe292('0x3c')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xe292('0x38')][_0xe292('0x116')](db[_0xe292('0x100')],{'as':'CloudProvider','foreignKey':_0xe292('0x155'),'onDelete':_0xe292('0x156')});db[_0xe292('0x3a')][_0xe292('0x116')](db['MailAccount'],{'as':_0xe292('0x3c'),'foreignKey':_0xe292('0x157')});db[_0xe292('0x3a')][_0xe292('0x116')](db[_0xe292('0x100')],{'as':_0xe292('0x100'),'foreignKey':'CloudProviderId','onDelete':_0xe292('0x156')});db[_0xe292('0x3c')]['hasOne'](db[_0xe292('0x38')],{'as':'Imap','onDelete':'cascade'});db[_0xe292('0x3c')][_0xe292('0x104')](db[_0xe292('0x3a')],{'as':_0xe292('0x158'),'onDelete':_0xe292('0x105')});db[_0xe292('0x3c')][_0xe292('0x107')](db[_0xe292('0x7c')],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x157'),'onDelete':'cascade'});db[_0xe292('0x3c')]['hasMany'](db[_0xe292('0x15a')],{'as':_0xe292('0x15b'),'foreignKey':_0xe292('0x157')});db[_0xe292('0x3c')][_0xe292('0x107')](db[_0xe292('0x44')],{'as':_0xe292('0x14d'),'foreignKey':_0xe292('0x157')});db['MailAccount']['hasMany'](db[_0xe292('0x42')],{'as':_0xe292('0x15c')});db[_0xe292('0x3c')][_0xe292('0x107')](db[_0xe292('0x45')],{'as':_0xe292('0x13a')});db['MailAccount'][_0xe292('0x116')](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':_0xe292('0x15e')});db['MailAccount']['belongsTo'](db['Template'],{'as':_0xe292('0x89'),'foreignKey':_0xe292('0x15f')});db[_0xe292('0x3c')][_0xe292('0x116')](db['Pause'],{'as':_0xe292('0x160'),'foreignKey':_0xe292('0x148')});db[_0xe292('0x3c')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':'Agents','through':_0xe292('0x130')});db[_0xe292('0x3e')]['belongsToMany'](db[_0xe292('0x13')],{'as':_0xe292('0x161'),'through':_0xe292('0x31')});db[_0xe292('0x3e')][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':_0xe292('0x162'),'as':_0xe292('0x149')});db['MailInteraction']['hasMany'](db[_0xe292('0x44')],{'as':'Messages','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x163')});db['MailInteraction'][_0xe292('0x116')](db[_0xe292('0x3c')],{'as':'Account','foreignKey':_0xe292('0x157')});db['MailInteraction']['belongsTo'](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db['MailInteraction'][_0xe292('0x116')](db[_0xe292('0x13')],{'as':'Owner','foreignKey':_0xe292('0x106')});db[_0xe292('0x42')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x165'),'as':_0xe292('0x166')});db[_0xe292('0x42')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':'mail_interaction_has_tags','as':_0xe292('0x167')});db['MailInteraction'][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x168'),'through':_0xe292('0x169'),'foreignKey':_0xe292('0x163')});db[_0xe292('0x44')][_0xe292('0x107')](db[_0xe292('0x16a')],{'as':_0xe292('0x16b'),'onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0xe292('0x13')],{'as':'User'});db['MailMessage'][_0xe292('0x116')](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x154')});db[_0xe292('0x44')][_0xe292('0x116')](db[_0xe292('0x42')],{'as':'Interaction','foreignKey':_0xe292('0x163')});db[_0xe292('0x44')][_0xe292('0x116')](db[_0xe292('0x3c')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x157')});db[_0xe292('0x44')]['belongsTo'](db[_0xe292('0x5f')],{'as':_0xe292('0x5f'),'foreignKey':'ChatWebsiteId'});db[_0xe292('0x44')][_0xe292('0x116')](db[_0xe292('0x68')],{'as':_0xe292('0x68'),'foreignKey':_0xe292('0x16d')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0xe292('0x156')});db[_0xe292('0x45')][_0xe292('0x116')](db[_0xe292('0x3e')],{'onDelete':_0xe292('0x156')});db[_0xe292('0x45')]['belongsTo'](db[_0xe292('0x3c')],{'onDelete':'restrict'});db['MailApplication'][_0xe292('0x116')](db[_0xe292('0x80')],{'onDelete':_0xe292('0x156'),'foreignKey':'IntervalId'});db[_0xe292('0x45')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x16e')});db[_0xe292('0x47')]['belongsTo'](db[_0xe292('0x3c')],{});db[_0xe292('0x47')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':'ListId'});db[_0xe292('0x47')]['belongsTo'](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':'ContactId'});db[_0xe292('0x47')]['belongsTo'](db[_0xe292('0x42')],{});db[_0xe292('0x47')][_0xe292('0x116')](db[_0xe292('0x44')],{});db[_0xe292('0x47')][_0xe292('0x116')](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0xe292('0x3e')],{});db[_0xe292('0x16f')][_0xe292('0x107')](db[_0xe292('0x49')],{'as':_0xe292('0x170'),'onDelete':_0xe292('0x105')});db[_0xe292('0x4b')][_0xe292('0x107')](db[_0xe292('0x7c')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xe292('0x105')});db[_0xe292('0x4b')][_0xe292('0x107')](db[_0xe292('0x15a')],{'as':'Answers','foreignKey':_0xe292('0x171')});db[_0xe292('0x4b')][_0xe292('0x107')](db[_0xe292('0x112')],{'as':_0xe292('0x15c')});db[_0xe292('0x4b')][_0xe292('0x107')](db[_0xe292('0x4d')],{'as':_0xe292('0x13a')});db['FaxAccount'][_0xe292('0x107')](db[_0xe292('0x10a')],{'as':_0xe292('0x172'),'onDelete':'cascade'});db[_0xe292('0x4b')][_0xe292('0x107')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount']['belongsTo'](db[_0xe292('0x29')],{'as':_0xe292('0x29')});db[_0xe292('0x4b')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':_0xe292('0x15e')});db[_0xe292('0x4b')][_0xe292('0x116')](db['Pause'],{'as':_0xe292('0x160'),'foreignKey':_0xe292('0x148')});db[_0xe292('0x4b')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':'Agents','through':_0xe292('0x12e')});db[_0xe292('0x4d')][_0xe292('0x116')](db['User'],{'onDelete':_0xe292('0x156')});db[_0xe292('0x4d')][_0xe292('0x116')](db['FaxQueue'],{'onDelete':_0xe292('0x156')});db['FaxApplication'][_0xe292('0x116')](db[_0xe292('0x4b')],{'onDelete':_0xe292('0x156')});db[_0xe292('0x4d')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x16e')});db[_0xe292('0x112')][_0xe292('0x107')](db[_0xe292('0x4f')],{'as':_0xe292('0x14d'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x173')});db[_0xe292('0x112')]['belongsTo'](db[_0xe292('0x4b')],{'as':'Account','foreignKey':_0xe292('0x171')});db[_0xe292('0x112')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x112')][_0xe292('0x116')](db[_0xe292('0x13')],{'as':_0xe292('0x174'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x112')][_0xe292('0x118')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0xe292('0x166')});db[_0xe292('0x112')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x175'),'as':_0xe292('0x167')});db[_0xe292('0x112')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x168'),'through':'user_has_fax_interactions','foreignKey':_0xe292('0x173')});db[_0xe292('0x4f')][_0xe292('0x116')](db['User'],{'onDelete':_0xe292('0x105'),'as':'User'});db[_0xe292('0x4f')][_0xe292('0x116')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xe292('0x4f')][_0xe292('0x116')](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':'Contact'});db[_0xe292('0x4f')]['belongsTo'](db[_0xe292('0x16a')],{'as':'Attachment','foreignKey':_0xe292('0x176')});db[_0xe292('0x4f')][_0xe292('0x116')](db['FaxAccount'],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x171')});db[_0xe292('0x177')][_0xe292('0x118')](db['User'],{'as':'Agents','through':'UserFaxQueue'});db['FaxQueue'][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':'team_has_fax_queues','as':_0xe292('0x149')});db[_0xe292('0x178')][_0xe292('0x116')](db[_0xe292('0x4b')],{});db[_0xe292('0x178')][_0xe292('0x116')](db['CmList'],{'as':_0xe292('0x15d'),'foreignKey':'ListId'});db[_0xe292('0x178')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x178')][_0xe292('0x116')](db[_0xe292('0x112')],{});db[_0xe292('0x178')][_0xe292('0x116')](db['FaxMessage'],{});db[_0xe292('0x178')][_0xe292('0x116')](db[_0xe292('0x13')],{});db[_0xe292('0x178')][_0xe292('0x116')](db['FaxQueue'],{});db['SmsAccount']['hasMany'](db['Disposition'],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x179'),'onDelete':_0xe292('0x105')});db[_0xe292('0x17a')][_0xe292('0x107')](db[_0xe292('0x15a')],{'as':_0xe292('0x15b'),'foreignKey':'SmsAccountId'});db[_0xe292('0x17a')][_0xe292('0x107')](db[_0xe292('0x57')],{'as':_0xe292('0x14d'),'foreignKey':_0xe292('0x179')});db[_0xe292('0x17a')][_0xe292('0x107')](db[_0xe292('0x55')],{'as':_0xe292('0x15c')});db[_0xe292('0x17a')][_0xe292('0x107')](db[_0xe292('0x53')],{'as':_0xe292('0x13a')});db[_0xe292('0x17a')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':_0xe292('0x15e')});db[_0xe292('0x17a')][_0xe292('0x116')](db[_0xe292('0x81')],{'as':_0xe292('0x160'),'foreignKey':_0xe292('0x148')});db[_0xe292('0x17a')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x161'),'through':_0xe292('0x134')});db[_0xe292('0x53')]['belongsTo'](db[_0xe292('0x13')],{'onDelete':_0xe292('0x156')});db['SmsApplication']['belongsTo'](db[_0xe292('0x59')],{'onDelete':_0xe292('0x156')});db[_0xe292('0x53')][_0xe292('0x116')](db['SmsAccount'],{'onDelete':_0xe292('0x156')});db[_0xe292('0x53')][_0xe292('0x116')](db[_0xe292('0x80')],{'onDelete':'restrict','foreignKey':_0xe292('0x147')});db[_0xe292('0x53')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x16e')});db[_0xe292('0x55')][_0xe292('0x107')](db[_0xe292('0x57')],{'as':'Messages','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x17b')});db[_0xe292('0x55')][_0xe292('0x116')](db[_0xe292('0x17a')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x179')});db['SmsInteraction'][_0xe292('0x116')](db['CmContact'],{'as':'Contact','foreignKey':_0xe292('0x164')});db[_0xe292('0x55')][_0xe292('0x116')](db['User'],{'as':_0xe292('0x174'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x55')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x17c'),'as':_0xe292('0x166')});db['SmsInteraction'][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x17c'),'as':_0xe292('0x167')});db[_0xe292('0x55')]['belongsToMany'](db[_0xe292('0x13')],{'as':_0xe292('0x168'),'through':_0xe292('0x120'),'foreignKey':_0xe292('0x17b')});db['SmsMessage']['belongsTo'](db[_0xe292('0x13')],{'as':_0xe292('0x13')});db[_0xe292('0x57')][_0xe292('0x116')](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x154')});db[_0xe292('0x57')]['belongsTo'](db[_0xe292('0x55')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x17d'),'foreignKey':'SmsInteractionId'});db[_0xe292('0x57')][_0xe292('0x116')](db[_0xe292('0x17a')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x179')});db[_0xe292('0x59')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x161'),'through':_0xe292('0x17e'),'foreignKey':_0xe292('0x17f')});db[_0xe292('0x59')][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':'team_has_sms_queues','as':_0xe292('0x149')});db[_0xe292('0x131')]['hasMany'](db[_0xe292('0x7c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xe292('0x105')});db['OpenchannelAccount']['hasMany'](db['CannedAnswer'],{'as':_0xe292('0x15b'),'foreignKey':_0xe292('0x180')});db['OpenchannelAccount'][_0xe292('0x107')](db[_0xe292('0x5c')],{'as':_0xe292('0x15c'),'foreignKey':_0xe292('0x180')});db[_0xe292('0x131')][_0xe292('0x107')](db[_0xe292('0x181')],{'as':'Messages','foreignKey':_0xe292('0x180')});db['OpenchannelAccount']['hasMany'](db[_0xe292('0x5a')],{'as':_0xe292('0x13a'),'foreignKey':_0xe292('0x180')});db['OpenchannelAccount'][_0xe292('0x116')](db['CmList'],{'as':'List','foreignKey':_0xe292('0x15e')});db['OpenchannelAccount']['belongsTo'](db[_0xe292('0x81')],{'as':_0xe292('0x160'),'foreignKey':_0xe292('0x148')});db[_0xe292('0x131')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x161'),'through':'user_has_openchannel_accounts'});db[_0xe292('0x5a')][_0xe292('0x116')](db[_0xe292('0x13')],{'onDelete':_0xe292('0x156')});db[_0xe292('0x5a')][_0xe292('0x116')](db[_0xe292('0x127')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x182')});db[_0xe292('0x5a')]['belongsTo'](db[_0xe292('0x131')],{'onDelete':_0xe292('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0xe292('0x5a')][_0xe292('0x116')](db[_0xe292('0x80')],{'onDelete':'restrict','foreignKey':_0xe292('0x147')});db[_0xe292('0x5a')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xe292('0x5c')][_0xe292('0x107')](db[_0xe292('0x181')],{'as':_0xe292('0x14d'),'onDelete':'cascade','foreignKey':_0xe292('0x183')});db['OpenchannelInteraction'][_0xe292('0x116')](db[_0xe292('0x131')],{'as':_0xe292('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0xe292('0x5c')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe292('0x5c')][_0xe292('0x116')](db[_0xe292('0x13')],{'as':_0xe292('0x174'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x5c')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x184'),'as':_0xe292('0x166')});db[_0xe292('0x5c')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x184'),'as':_0xe292('0x167')});db[_0xe292('0x5c')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':'Users','through':'user_has_openchannel_interactions','foreignKey':_0xe292('0x183')});db[_0xe292('0x181')][_0xe292('0x116')](db['User'],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x13')});db[_0xe292('0x181')][_0xe292('0x116')](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x154')});db[_0xe292('0x181')]['belongsTo'](db[_0xe292('0x5c')],{'onDelete':_0xe292('0x105'),'as':'Interaction','foreignKey':_0xe292('0x183')});db[_0xe292('0x181')][_0xe292('0x116')](db[_0xe292('0x16a')],{'as':_0xe292('0x16a'),'foreignKey':_0xe292('0x176')});db[_0xe292('0x181')][_0xe292('0x116')](db[_0xe292('0x131')],{'as':'Account','foreignKey':_0xe292('0x180')});db['OpenchannelQueue']['belongsToMany'](db[_0xe292('0x13')],{'as':'Agents','through':_0xe292('0x35'),'foreignKey':_0xe292('0x182')});db['OpenchannelQueue']['belongsToMany'](db[_0xe292('0xd9')],{'through':_0xe292('0x185'),'as':_0xe292('0x149')});db[_0xe292('0x5f')][_0xe292('0x107')](db[_0xe292('0x7c')],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x186'),'onDelete':_0xe292('0x105')});db['ChatWebsite']['hasMany'](db[_0xe292('0x15a')],{'as':_0xe292('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0xe292('0x5f')][_0xe292('0x107')](db[_0xe292('0x6c')],{'as':'ProactiveActions'});db['ChatWebsite'][_0xe292('0x107')](db[_0xe292('0x110')],{'as':_0xe292('0x15c')});db[_0xe292('0x5f')][_0xe292('0x107')](db[_0xe292('0x63')],{'as':_0xe292('0x13a')});db[_0xe292('0x5f')]['hasMany'](db[_0xe292('0x66')],{'as':_0xe292('0x14d')});db[_0xe292('0x5f')]['belongsTo'](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':'ListId'});db[_0xe292('0x5f')][_0xe292('0x116')](db[_0xe292('0x80')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xe292('0x5f')][_0xe292('0x116')](db[_0xe292('0x3c')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0xe292('0x5f')][_0xe292('0x116')](db['Pause'],{'as':_0xe292('0x160'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xe292('0x5f')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':'Agents','through':_0xe292('0x12d')});db[_0xe292('0x61')][_0xe292('0x116')](db[_0xe292('0x131')],{});db['OpenchannelQueueReport'][_0xe292('0x116')](db['CmList'],{'as':'List','foreignKey':_0xe292('0x15e')});db[_0xe292('0x61')]['belongsTo'](db[_0xe292('0x6f')],{'as':'Contact','foreignKey':_0xe292('0x164')});db[_0xe292('0x61')]['belongsTo'](db[_0xe292('0x5c')],{});db[_0xe292('0x61')][_0xe292('0x116')](db['OpenchannelMessage'],{});db[_0xe292('0x61')][_0xe292('0x116')](db[_0xe292('0x13')],{});db[_0xe292('0x61')][_0xe292('0x116')](db['OpenchannelQueue'],{});db[_0xe292('0x63')]['belongsTo'](db['User'],{'as':_0xe292('0x187'),'foreignKey':_0xe292('0x106'),'onDelete':_0xe292('0x156')});db[_0xe292('0x63')][_0xe292('0x116')](db[_0xe292('0x124')],{'as':_0xe292('0x188'),'foreignKey':_0xe292('0x189'),'onDelete':_0xe292('0x156')});db['ChatApplication'][_0xe292('0x116')](db[_0xe292('0x5f')],{'as':_0xe292('0x18a'),'foreignKey':_0xe292('0x186'),'onDelete':_0xe292('0x156')});db[_0xe292('0x63')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x16e')});db[_0xe292('0x110')][_0xe292('0x107')](db[_0xe292('0x66')],{'as':_0xe292('0x14d'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x18b')});db[_0xe292('0x110')][_0xe292('0x116')](db[_0xe292('0x5f')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe292('0x110')][_0xe292('0x116')](db['CmContact'],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x110')][_0xe292('0x116')](db[_0xe292('0x13')],{'as':_0xe292('0x174'),'foreignKey':'UserId'});db[_0xe292('0x110')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':'chat_interaction_has_tags','as':_0xe292('0x166')});db[_0xe292('0x110')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x18c'),'as':_0xe292('0x167')});db[_0xe292('0x110')]['belongsToMany'](db['User'],{'as':_0xe292('0x168'),'through':'user_has_chat_interactions','foreignKey':_0xe292('0x18b')});db[_0xe292('0x66')][_0xe292('0x116')](db[_0xe292('0x13')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x13')});db['ChatMessage']['belongsTo'](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x66')][_0xe292('0x116')](db[_0xe292('0x110')],{'onDelete':_0xe292('0x105'),'as':'Interaction','foreignKey':_0xe292('0x18b')});db[_0xe292('0x66')]['belongsTo'](db[_0xe292('0x16a')],{'as':_0xe292('0x16a'),'foreignKey':_0xe292('0x176')});db[_0xe292('0x66')][_0xe292('0x116')](db[_0xe292('0x5f')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x186')});db['ChatOfflineMessage'][_0xe292('0x107')](db['Attachment'],{'as':_0xe292('0x16b'),'foreignKey':'ChatOfflineMessageId','onDelete':_0xe292('0x105'),'hooks':!![]});db[_0xe292('0x68')]['belongsTo'](db[_0xe292('0x6f')],{'onDelete':_0xe292('0x105'),'as':'Contact','foreignKey':_0xe292('0x164')});db[_0xe292('0x68')][_0xe292('0x116')](db['ChatWebsite'],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x186')});db[_0xe292('0x124')][_0xe292('0x118')](db['User'],{'as':_0xe292('0x161'),'through':_0xe292('0x2f'),'hooks':!![]});db[_0xe292('0x124')][_0xe292('0x118')](db['Team'],{'through':_0xe292('0x18d'),'as':'Teams'});db[_0xe292('0x6a')][_0xe292('0x107')](db[_0xe292('0x18e')],{'as':_0xe292('0x14d'),'foreignKey':'ChatGroupId','onDelete':_0xe292('0x105')});db['ChatGroup'][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x13d'),'through':_0xe292('0x18f')});db[_0xe292('0x6c')][_0xe292('0x116')](db['ChatWebsite'],{'as':_0xe292('0x18a'),'foreignKey':_0xe292('0x186')});db[_0xe292('0x190')][_0xe292('0x107')](db[_0xe292('0x6f')],{'as':'Contacts','foreignKey':_0xe292('0x191')});db[_0xe292('0x6f')][_0xe292('0x107')](db[_0xe292('0x13e')],{'as':_0xe292('0x13f'),'foreignKey':'ContactId'});db[_0xe292('0x6f')]['hasMany'](db[_0xe292('0x73')],{'as':_0xe292('0x10c'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x6f')][_0xe292('0x107')](db['CmHopperHistory'],{'as':_0xe292('0x141'),'foreignKey':_0xe292('0x164')});db[_0xe292('0x6f')][_0xe292('0x107')](db[_0xe292('0x10e')],{'as':_0xe292('0x10e'),'foreignKey':'ContactId'});db[_0xe292('0x6f')][_0xe292('0x107')](db[_0xe292('0x143')],{'as':'JscriptySessions','foreignKey':_0xe292('0x164')});db[_0xe292('0x6f')][_0xe292('0x107')](db['OpenchannelInteraction'],{'as':_0xe292('0x10f'),'foreignKey':_0xe292('0x164'),'onDelete':_0xe292('0x156')});db[_0xe292('0x6f')][_0xe292('0x107')](db[_0xe292('0x110')],{'as':'ChatInteractions','foreignKey':_0xe292('0x164'),'onDelete':_0xe292('0x156')});db['CmContact'][_0xe292('0x107')](db[_0xe292('0x55')],{'as':'SmsInteractions','foreignKey':_0xe292('0x164'),'onDelete':_0xe292('0x156')});db['CmContact']['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0xe292('0x164'),'onDelete':'restrict'});db[_0xe292('0x6f')][_0xe292('0x107')](db['MailInteraction'],{'as':_0xe292('0x192'),'foreignKey':_0xe292('0x164'),'onDelete':_0xe292('0x156')});db[_0xe292('0x6f')][_0xe292('0x116')](db['CmCompany'],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':'ListId','onDelete':_0xe292('0x105')});db[_0xe292('0x6f')][_0xe292('0x118')](db['User'],{'as':_0xe292('0x168'),'through':_0xe292('0x11b')});db[_0xe292('0x6f')][_0xe292('0x118')](db[_0xe292('0x87')],{'as':_0xe292('0x166'),'through':_0xe292('0x193')});db[_0xe292('0x6f')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x193'),'as':'ThroughTags'});db['CmHopper'][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164'),'onDelete':'cascade'});db[_0xe292('0x13e')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xe292('0x13e')][_0xe292('0x116')](db['User'],{'as':_0xe292('0x187'),'foreignKey':_0xe292('0x106')});db[_0xe292('0x13e')][_0xe292('0x116')](db[_0xe292('0x1a')],{'as':_0xe292('0x188'),'foreignKey':'VoiceQueueId','onDelete':_0xe292('0x105')});db[_0xe292('0x13e')][_0xe292('0x116')](db[_0xe292('0xdd')],{'as':_0xe292('0xdd'),'foreignKey':_0xe292('0x194'),'onDelete':_0xe292('0x105')});db[_0xe292('0x13e')][_0xe292('0x116')](db[_0xe292('0x13')],{'as':_0xe292('0x174'),'foreignKey':_0xe292('0x195')});db['CmHopperBlack'][_0xe292('0x116')](db['CmContact'],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164'),'onDelete':_0xe292('0x105')});db['CmHopperBlack'][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':_0xe292('0x15e'),'onDelete':_0xe292('0x105')});db[_0xe292('0x72')][_0xe292('0x116')](db[_0xe292('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xe292('0x105')});db[_0xe292('0x72')]['belongsTo'](db[_0xe292('0xdd')],{'as':_0xe292('0xdd'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xe292('0x196')][_0xe292('0x107')](db[_0xe292('0x7e')],{'as':{'plural':_0xe292('0x197'),'singular':_0xe292('0x198')},'foreignKey':_0xe292('0x199'),'onDelete':_0xe292('0x105'),'hooks':!![]});db[_0xe292('0x196')][_0xe292('0x107')](db[_0xe292('0x7e')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0xe292('0x105'),'hooks':!![]});db['Automation']['hasMany'](db[_0xe292('0x19a')],{'as':_0xe292('0x19b'),'foreignKey':_0xe292('0x19c'),'onDelete':_0xe292('0x105'),'hooks':!![]});db['Disposition'][_0xe292('0x107')](db['Disposition'],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x19d'),'onDelete':_0xe292('0x105')});db[_0xe292('0x80')][_0xe292('0x107')](db[_0xe292('0x80')],{'as':_0xe292('0x19e'),'foreignKey':_0xe292('0x147'),'onDelete':_0xe292('0x105'),'hooks':!![],'required':![]});db['Interval'][_0xe292('0x107')](db['VoiceExtension'],{'as':_0xe292('0x10b'),'foreignKey':_0xe292('0x147'),'onDelete':_0xe292('0x156')});db['Interval'][_0xe292('0x107')](db[_0xe292('0x45')],{'as':_0xe292('0x19f'),'foreignKey':_0xe292('0x147')});db[_0xe292('0x80')][_0xe292('0x107')](db[_0xe292('0x63')],{'as':'ChatApplications','foreignKey':_0xe292('0x147')});db[_0xe292('0x80')]['hasMany'](db[_0xe292('0x4d')],{'as':'FaxApplications','foreignKey':_0xe292('0x147')});db['Interval'][_0xe292('0x107')](db['SmsApplication'],{'as':_0xe292('0x1a0'),'foreignKey':_0xe292('0x147')});db[_0xe292('0x1a1')][_0xe292('0x116')](db[_0xe292('0x3c')],{});db['Schedule'][_0xe292('0x116')](db[_0xe292('0x93')],{'foreignKey':_0xe292('0x1a2')});db[_0xe292('0x1a1')][_0xe292('0x116')](db[_0xe292('0x1a3')],{'foreignKey':_0xe292('0x1a4')});db[_0xe292('0x85')]['belongsToMany'](db[_0xe292('0x1a5')],{'as':'Mohs','through':'moh_has_sounds','onDelete':_0xe292('0x156')});db[_0xe292('0x87')][_0xe292('0x118')](db[_0xe292('0x6f')],{'through':'cm_contact_has_tags'});db['Tag'][_0xe292('0x118')](db[_0xe292('0x110')],{'through':'chat_interaction_has_tags'});db['Tag'][_0xe292('0x118')](db[_0xe292('0x42')],{'through':_0xe292('0x165')});db[_0xe292('0x87')][_0xe292('0x118')](db[_0xe292('0x55')],{'through':_0xe292('0x17c')});db[_0xe292('0x87')][_0xe292('0x118')](db[_0xe292('0x112')],{'through':'fax_interaction_has_tags'});db[_0xe292('0x87')]['belongsToMany'](db[_0xe292('0x5c')],{'through':'openchannel_interaction_has_tags'});db['Tag'][_0xe292('0x118')](db[_0xe292('0xf9')],{'through':_0xe292('0x1a6')});db[_0xe292('0x8a')]['hasMany'](db[_0xe292('0x7e')],{'as':{'plural':_0xe292('0x1a7'),'singular':_0xe292('0x1a8')},'foreignKey':'TriggerAllId','onDelete':_0xe292('0x105'),'hooks':!![]});db[_0xe292('0x8a')][_0xe292('0x107')](db[_0xe292('0x7e')],{'as':{'plural':_0xe292('0x1a9'),'singular':_0xe292('0x1aa')},'foreignKey':_0xe292('0x1ab'),'onDelete':_0xe292('0x105'),'hooks':!![]});db[_0xe292('0x8a')][_0xe292('0x107')](db[_0xe292('0x19a')],{'as':_0xe292('0x19b'),'foreignKey':_0xe292('0x1ac'),'onDelete':'cascade','hooks':!![]});db[_0xe292('0x1a3')][_0xe292('0x107')](db[_0xe292('0x1ad')],{'as':'Fields','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1a4'),'hooks':!![]});db[_0xe292('0x93')][_0xe292('0x107')](db[_0xe292('0x1ad')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':'DefaultReportId'});db[_0xe292('0x1af')][_0xe292('0x107')](db[_0xe292('0x1ad')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xe292('0x1b0')});db[_0xe292('0x1ad')]['belongsTo'](db[_0xe292('0x1af')],{'foreignKey':_0xe292('0x1b0')});db[_0xe292('0x98')][_0xe292('0x107')](db[_0xe292('0x1b1')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1b1')]['hasMany'](db[_0xe292('0x9b')],{'as':_0xe292('0x1b4'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0x1b1')][_0xe292('0x107')](db[_0xe292('0x9b')],{'as':_0xe292('0x1b6'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0x1b1')]['hasMany'](db[_0xe292('0x9b')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':'FieldId'});db[_0xe292('0x1b1')]['belongsTo'](db[_0xe292('0x98')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x9b')][_0xe292('0x107')](db['SalesforceField'],{'as':_0xe292('0x1b8'),'foreignKey':'SubjectId'});db['SalesforceField'][_0xe292('0x107')](db['SalesforceField'],{'as':'Description','foreignKey':_0xe292('0x1b7')});db[_0xe292('0x9b')][_0xe292('0x107')](db[_0xe292('0x9b')],{'as':_0xe292('0x1b9'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0x9b')][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db['SugarcrmAccount'][_0xe292('0x107')](db[_0xe292('0x1bc')],{'as':'Configurations','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1bc')][_0xe292('0x107')](db[_0xe292('0x9f')],{'as':_0xe292('0x1b4'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b5')});db['SugarcrmConfiguration'][_0xe292('0x107')](db[_0xe292('0x9f')],{'as':'Descriptions','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0x1bc')][_0xe292('0x107')](db[_0xe292('0x9f')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':'FieldId'});db[_0xe292('0x1bc')][_0xe292('0x116')](db[_0xe292('0x9c')],{'as':'Account','foreignKey':_0xe292('0x1b3')});db['SugarcrmField'][_0xe292('0x107')](db[_0xe292('0x9f')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0x9f')]['hasMany'](db[_0xe292('0x9f')],{'as':'Description','foreignKey':_0xe292('0x1b7')});db[_0xe292('0x9f')][_0xe292('0x107')](db['SugarcrmField'],{'as':'Field','foreignKey':_0xe292('0x1ba')});db[_0xe292('0x9f')][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0xa0')][_0xe292('0x107')](db[_0xe292('0xa1')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db['DeskConfiguration'][_0xe292('0x107')](db['DeskField'],{'as':_0xe292('0x1b4'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xa1')][_0xe292('0x107')](db['DeskField'],{'as':_0xe292('0x1b6'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xe292('0xa1')]['hasMany'](db[_0xe292('0xa3')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0xa1')][_0xe292('0x116')](db[_0xe292('0xa0')],{'as':'Account','foreignKey':_0xe292('0x1b3')});db['DeskConfiguration'][_0xe292('0x118')](db[_0xe292('0x87')],{'through':'int_desk_configuration_has_tags'});db[_0xe292('0xa3')][_0xe292('0x107')](db[_0xe292('0xa3')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xa3')]['hasMany'](db[_0xe292('0xa3')],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xa3')][_0xe292('0x107')](db[_0xe292('0xa3')],{'as':_0xe292('0x1b9'),'foreignKey':'FieldId'});db[_0xe292('0xa3')][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0x1be')][_0xe292('0x107')](db[_0xe292('0xa6')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db['ZohoConfiguration'][_0xe292('0x107')](db['ZohoField'],{'as':'Subjects','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xa6')][_0xe292('0x107')](db[_0xe292('0x1bf')],{'as':_0xe292('0x1b6'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xa6')][_0xe292('0x107')](db[_0xe292('0x1bf')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1ba')});db['ZohoConfiguration'][_0xe292('0x116')](db[_0xe292('0x1be')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1bf')]['hasMany'](db[_0xe292('0x1bf')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db['ZohoField'][_0xe292('0x107')](db[_0xe292('0x1bf')],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db['ZohoField'][_0xe292('0x107')](db[_0xe292('0x1bf')],{'as':_0xe292('0x1b9'),'foreignKey':'FieldId'});db['ZohoField']['belongsTo'](db['Variable'],{'as':_0xe292('0x8c'),'foreignKey':'VariableId'});db[_0xe292('0x1c0')][_0xe292('0x107')](db[_0xe292('0xa9')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':'AccountId'});db[_0xe292('0xa9')][_0xe292('0x107')](db['ZendeskField'],{'as':_0xe292('0x1b4'),'foreignKey':'SubjectId'});db[_0xe292('0xa9')][_0xe292('0x107')](db[_0xe292('0xab')],{'as':_0xe292('0x1b6'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xa9')][_0xe292('0x107')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xe292('0x1ba')});db['ZendeskConfiguration']['belongsTo'](db[_0xe292('0x1c0')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0xa9')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x1c1')});db['ZendeskField'][_0xe292('0x107')](db[_0xe292('0xab')],{'as':_0xe292('0x1b8'),'foreignKey':'SubjectId'});db[_0xe292('0xab')][_0xe292('0x107')](db['ZendeskField'],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xab')][_0xe292('0x107')](db[_0xe292('0xab')],{'as':_0xe292('0x1b9'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0xab')][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0x1c2')][_0xe292('0x107')](db[_0xe292('0xae')],{'as':'Configurations','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0xae')][_0xe292('0x107')](db[_0xe292('0xb0')],{'as':_0xe292('0x1b4'),'onDelete':_0xe292('0x105'),'foreignKey':'SubjectId'});db[_0xe292('0xae')][_0xe292('0x107')](db[_0xe292('0xb0')],{'as':_0xe292('0x1b6'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xae')]['hasMany'](db[_0xe292('0xb0')],{'as':_0xe292('0x1ae'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0xae')][_0xe292('0x116')](db['FreshdeskAccount'],{'as':'Account','foreignKey':_0xe292('0x1b3')});db[_0xe292('0xae')][_0xe292('0x118')](db[_0xe292('0x87')],{'through':_0xe292('0x1c3')});db[_0xe292('0xb0')][_0xe292('0x107')](db[_0xe292('0xb0')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xb0')]['hasMany'](db[_0xe292('0xb0')],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xb0')][_0xe292('0x107')](db[_0xe292('0xb0')],{'as':'Field','foreignKey':_0xe292('0x1ba')});db[_0xe292('0xb0')][_0xe292('0x116')](db['Variable'],{'as':_0xe292('0x8c'),'foreignKey':'VariableId'});db[_0xe292('0xb1')]['hasMany'](db[_0xe292('0xb3')],{'as':'Configurations','onDelete':_0xe292('0x105'),'foreignKey':'AccountId'});db[_0xe292('0xb3')][_0xe292('0x107')](db[_0xe292('0x1c4')],{'as':_0xe292('0x1b4'),'foreignKey':'SubjectId'});db[_0xe292('0xb3')][_0xe292('0x107')](db[_0xe292('0x1c4')],{'as':'Descriptions','foreignKey':_0xe292('0x1b7')});db['VtigerConfiguration']['hasMany'](db[_0xe292('0x1c4')],{'as':_0xe292('0x1ae'),'foreignKey':_0xe292('0x1ba')});db['VtigerConfiguration'][_0xe292('0x116')](db[_0xe292('0xb1')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1c4')][_0xe292('0x107')](db[_0xe292('0x1c4')],{'as':_0xe292('0x1b8'),'foreignKey':'SubjectId'});db[_0xe292('0x1c4')]['hasMany'](db[_0xe292('0x1c4')],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0x1c4')][_0xe292('0x107')](db['VtigerField'],{'as':_0xe292('0x1b9'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0x1c4')][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0x1c5')][_0xe292('0x107')](db['ServicenowConfiguration'],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1c6')][_0xe292('0x107')](db[_0xe292('0x1c7')],{'as':_0xe292('0x1b4'),'foreignKey':'SubjectId'});db[_0xe292('0x1c6')][_0xe292('0x107')](db[_0xe292('0x1c7')],{'as':_0xe292('0x1b6'),'foreignKey':'DescriptionId'});db[_0xe292('0x1c6')][_0xe292('0x107')](db[_0xe292('0x1c7')],{'as':'Fields','foreignKey':_0xe292('0x1ba')});db[_0xe292('0x1c6')][_0xe292('0x116')](db[_0xe292('0x1c5')],{'as':'Account','foreignKey':_0xe292('0x1b3')});db[_0xe292('0x1c7')][_0xe292('0x107')](db[_0xe292('0x1c7')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0x1c7')][_0xe292('0x107')](db['ServicenowField'],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0x1c7')][_0xe292('0x107')](db[_0xe292('0x1c7')],{'as':_0xe292('0x1b9'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0x1c7')][_0xe292('0x116')](db['Variable'],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0xb9')]['hasMany'](db[_0xe292('0xbb')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':'AccountId'});db[_0xe292('0xbb')][_0xe292('0x107')](db['Dynamics365Field'],{'as':_0xe292('0x1b4'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xbb')]['hasMany'](db[_0xe292('0xbd')],{'as':_0xe292('0x1b6'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xbb')][_0xe292('0x107')](db[_0xe292('0xbd')],{'as':'Fields','onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0xbb')][_0xe292('0x116')](db[_0xe292('0xb9')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db['Dynamics365Field'][_0xe292('0x107')](db[_0xe292('0xbd')],{'as':_0xe292('0x1b8'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xbd')][_0xe292('0x107')](db[_0xe292('0xbd')],{'as':_0xe292('0x1bd'),'foreignKey':_0xe292('0x1b7')});db[_0xe292('0xbd')][_0xe292('0x107')](db['Dynamics365Field'],{'as':_0xe292('0x1b9'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xe292('0x116')](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0x1c8')]['hasMany'](db[_0xe292('0xc0')],{'as':_0xe292('0x1b2'),'onDelete':_0xe292('0x105'),'foreignKey':'AccountId'});db[_0xe292('0xc0')][_0xe292('0x107')](db['FreshsalesField'],{'as':_0xe292('0x1b4'),'foreignKey':_0xe292('0x1b5')});db[_0xe292('0xc0')]['hasMany'](db[_0xe292('0xc2')],{'as':_0xe292('0x1b6'),'foreignKey':_0xe292('0x1b7')});db['FreshsalesConfiguration'][_0xe292('0x107')](db[_0xe292('0xc2')],{'as':_0xe292('0x1ae'),'foreignKey':_0xe292('0x1ba')});db[_0xe292('0xc0')]['belongsTo'](db[_0xe292('0x1c8')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1b3')});db[_0xe292('0xc2')][_0xe292('0x107')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xe292('0x1b5')});db[_0xe292('0xc2')][_0xe292('0x107')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xe292('0x1b7')});db[_0xe292('0xc2')][_0xe292('0x107')](db[_0xe292('0xc2')],{'as':_0xe292('0x1b9'),'foreignKey':'FieldId'});db[_0xe292('0xc2')]['belongsTo'](db[_0xe292('0x8c')],{'as':_0xe292('0x8c'),'foreignKey':_0xe292('0x1bb')});db[_0xe292('0xc5')]['belongsTo'](db[_0xe292('0x5f')],{});db[_0xe292('0xc5')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':_0xe292('0x15e')});db['ChatQueueReport'][_0xe292('0x116')](db['CmContact'],{'as':_0xe292('0x154'),'foreignKey':_0xe292('0x164')});db[_0xe292('0xc5')]['belongsTo'](db[_0xe292('0x110')],{});db[_0xe292('0xc5')][_0xe292('0x116')](db[_0xe292('0x66')],{});db[_0xe292('0xc5')][_0xe292('0x116')](db['User'],{});db[_0xe292('0xc5')][_0xe292('0x116')](db[_0xe292('0x124')],{});db[_0xe292('0x18e')]['belongsTo'](db[_0xe292('0x13')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xe292('0x18e')][_0xe292('0x116')](db[_0xe292('0x13')],{'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1c9')});db[_0xe292('0x143')][_0xe292('0x107')](db[_0xe292('0x1ca')],{'foreignKey':_0xe292('0x1cb'),'onDelete':_0xe292('0x105')});db[_0xe292('0x143')]['hasMany'](db[_0xe292('0xc8')],{'foreignKey':'SessionId','onDelete':_0xe292('0x105')});db[_0xe292('0xcb')][_0xe292('0x116')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':_0xe292('0x15e')});db[_0xe292('0xcb')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe292('0xcb')][_0xe292('0x116')](db['SmsInteraction'],{});db[_0xe292('0xcb')][_0xe292('0x116')](db[_0xe292('0x57')],{});db[_0xe292('0xcb')][_0xe292('0x116')](db['User'],{});db[_0xe292('0xcb')][_0xe292('0x116')](db[_0xe292('0x59')],{});db[_0xe292('0xd0')][_0xe292('0x107')](db[_0xe292('0x143')],{'foreignKey':_0xe292('0x1cc')});db[_0xe292('0xd0')][_0xe292('0x107')](db['JscriptyQuestionReport'],{'foreignKey':_0xe292('0x1cc')});db[_0xe292('0xd0')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xe292('0x1cc')});db[_0xe292('0xd5')][_0xe292('0x118')](db[_0xe292('0x13')],{'as':_0xe292('0x168'),'through':_0xe292('0x137')});db[_0xe292('0xd9')]['belongsToMany'](db[_0xe292('0x13')],{'as':_0xe292('0x161'),'through':_0xe292('0x11d')});db[_0xe292('0xd9')][_0xe292('0x118')](db[_0xe292('0x1a')],{'through':_0xe292('0x101'),'as':_0xe292('0x1cd')});db[_0xe292('0xd9')][_0xe292('0x118')](db[_0xe292('0x3e')],{'through':'team_has_mail_queues','as':_0xe292('0x123')});db[_0xe292('0xd9')][_0xe292('0x118')](db['ChatQueue'],{'through':_0xe292('0x18d'),'as':_0xe292('0x125')});db[_0xe292('0xd9')][_0xe292('0x118')](db[_0xe292('0x177')],{'through':_0xe292('0x1ce'),'as':'FaxQueues'});db['Team'][_0xe292('0x118')](db[_0xe292('0x59')],{'through':'team_has_sms_queues','as':_0xe292('0x1cf')});db['Team'][_0xe292('0x118')](db[_0xe292('0x127')],{'through':_0xe292('0x185'),'as':_0xe292('0x128')});db[_0xe292('0xd9')][_0xe292('0x118')](db[_0xe292('0x129')],{'through':_0xe292('0x1d0'),'as':_0xe292('0x12a')});db['Team']['belongsToMany'](db[_0xe292('0xee')],{'through':_0xe292('0x1d1'),'as':_0xe292('0x122')});db[_0xe292('0xdd')][_0xe292('0x107')](db[_0xe292('0x13e')],{'as':_0xe292('0x13f'),'foreignKey':_0xe292('0x194')});db[_0xe292('0xdd')][_0xe292('0x107')](db[_0xe292('0x73')],{'as':'HopperFinals','foreignKey':_0xe292('0x194')});db[_0xe292('0xdd')][_0xe292('0x107')](db[_0xe292('0x75')],{'as':'HopperHistories','foreignKey':_0xe292('0x194')});db[_0xe292('0xdd')][_0xe292('0x107')](db[_0xe292('0x72')],{'as':_0xe292('0x142'),'foreignKey':_0xe292('0x194')});db['Campaign'][_0xe292('0x116')](db['Trunk'],{'as':'Trunk','foreignKey':'TrunkId'});db['Campaign'][_0xe292('0x116')](db[_0xe292('0x29')],{'as':'TrunkBackup','foreignKey':_0xe292('0x146')});db[_0xe292('0xdd')][_0xe292('0x116')](db['Interval'],{'as':_0xe292('0x80'),'foreignKey':_0xe292('0x147')});db['Campaign'][_0xe292('0x116')](db['SquareProject'],{'as':_0xe292('0xd5'),'foreignKey':_0xe292('0x1d2')});db[_0xe292('0xdd')][_0xe292('0x118')](db['CmList'],{'as':_0xe292('0x11c'),'through':_0xe292('0x1d3')});db[_0xe292('0xdd')][_0xe292('0x118')](db[_0xe292('0xec')],{'as':_0xe292('0x14a'),'through':_0xe292('0x1d4')});db['Attachment'][_0xe292('0x116')](db[_0xe292('0x68')],{'as':'ChatOfflineMessage','foreignKey':_0xe292('0x16d')});db[_0xe292('0xe3')][_0xe292('0x116')](db[_0xe292('0x44')],{});db[_0xe292('0xe3')]['belongsTo'](db[_0xe292('0x42')],{});db[_0xe292('0xe3')][_0xe292('0x116')](db['MailAccount'],{'foreignKey':_0xe292('0x1d5'),'as':'FromAccount'});db[_0xe292('0xe3')]['belongsTo'](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d6'),'as':_0xe292('0x1d7')});db[_0xe292('0xe3')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':_0xe292('0x1d9')});db['MailTransferReport'][_0xe292('0x116')](db['MailQueue'],{'foreignKey':_0xe292('0x1da'),'as':_0xe292('0x1db')});db[_0xe292('0xe3')][_0xe292('0x116')](db[_0xe292('0x3c')],{'foreignKey':_0xe292('0x1dc'),'as':_0xe292('0x1dd')});db[_0xe292('0xe5')][_0xe292('0x116')](db['ChatMessage'],{});db['ChatTransferReport']['belongsTo'](db['ChatInteraction'],{});db[_0xe292('0xe5')][_0xe292('0x116')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0xe292('0xe5')]['belongsTo'](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d6'),'as':_0xe292('0x1d7')});db[_0xe292('0xe5')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':'ToAgent'});db[_0xe292('0xe5')][_0xe292('0x116')](db[_0xe292('0x124')],{'foreignKey':_0xe292('0x1de'),'as':_0xe292('0x1db')});db[_0xe292('0xe5')]['belongsTo'](db[_0xe292('0x5f')],{'foreignKey':_0xe292('0x1df'),'as':_0xe292('0x1dd')});db[_0xe292('0xe7')][_0xe292('0x116')](db['FaxMessage'],{});db[_0xe292('0xe7')][_0xe292('0x116')](db[_0xe292('0x112')],{});db[_0xe292('0xe7')]['belongsTo'](db[_0xe292('0x4b')],{'foreignKey':_0xe292('0x1e0'),'as':'FromAccount'});db[_0xe292('0xe7')][_0xe292('0x116')](db['User'],{'foreignKey':_0xe292('0x1d6'),'as':_0xe292('0x1d7')});db[_0xe292('0xe7')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':_0xe292('0x1d9')});db[_0xe292('0xe7')][_0xe292('0x116')](db[_0xe292('0x177')],{'foreignKey':'ToFaxQueueId','as':_0xe292('0x1db')});db[_0xe292('0xe7')][_0xe292('0x116')](db[_0xe292('0x4b')],{'foreignKey':_0xe292('0x1e1'),'as':_0xe292('0x1dd')});db[_0xe292('0x1e2')][_0xe292('0x116')](db[_0xe292('0x181')],{});db[_0xe292('0x1e2')]['belongsTo'](db[_0xe292('0x5c')],{});db[_0xe292('0x1e2')][_0xe292('0x116')](db[_0xe292('0x131')],{'foreignKey':_0xe292('0x1e3'),'as':_0xe292('0x1e4')});db[_0xe292('0x1e2')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d6'),'as':_0xe292('0x1d7')});db[_0xe292('0x1e2')]['belongsTo'](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':_0xe292('0x1d9')});db[_0xe292('0x1e2')][_0xe292('0x116')](db['OpenchannelQueue'],{'foreignKey':_0xe292('0x1e5'),'as':_0xe292('0x1db')});db[_0xe292('0x1e2')][_0xe292('0x116')](db[_0xe292('0x131')],{'foreignKey':_0xe292('0x1e6'),'as':_0xe292('0x1dd')});db[_0xe292('0xea')][_0xe292('0x116')](db[_0xe292('0x57')],{});db[_0xe292('0xea')][_0xe292('0x116')](db[_0xe292('0x55')],{});db['SmsTransferReport'][_0xe292('0x116')](db[_0xe292('0x17a')],{'foreignKey':_0xe292('0x1e7'),'as':'FromAccount'});db[_0xe292('0xea')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d6'),'as':_0xe292('0x1d7')});db[_0xe292('0xea')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':'ToAgent'});db[_0xe292('0xea')][_0xe292('0x116')](db[_0xe292('0x59')],{'foreignKey':_0xe292('0x1e8'),'as':_0xe292('0x1db')});db[_0xe292('0xea')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xe292('0x1e9'),'as':'ToAccount'});db[_0xe292('0xec')][_0xe292('0x107')](db[_0xe292('0x7c')],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x15e'),'onDelete':'cascade'});db[_0xe292('0xec')][_0xe292('0x107')](db[_0xe292('0x77')],{'as':'CustomFields','foreignKey':_0xe292('0x15e')});db['CmList'][_0xe292('0x107')](db['CmContact'],{'as':_0xe292('0x11a'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x15e')});db[_0xe292('0xec')][_0xe292('0x107')](db[_0xe292('0x73')],{'as':_0xe292('0x10c'),'foreignKey':_0xe292('0x15e')});db[_0xe292('0xec')]['hasMany'](db['CmHopperHistory'],{'as':_0xe292('0x10d'),'foreignKey':_0xe292('0x15e')});db[_0xe292('0xec')][_0xe292('0x107')](db[_0xe292('0x10e')],{'as':'ReportAgentPreview','foreignKey':_0xe292('0x15e')});db[_0xe292('0xec')][_0xe292('0x118')](db[_0xe292('0x1a')],{'as':'Queues','through':_0xe292('0x1ea')});db['CmList'][_0xe292('0x118')](db['User'],{'as':_0xe292('0x161'),'through':_0xe292('0x12b')});db[_0xe292('0xee')][_0xe292('0x107')](db[_0xe292('0x10a')],{'as':'Extensions','onDelete':'cascade'});db[_0xe292('0xee')][_0xe292('0x118')](db['User'],{'as':_0xe292('0x161'),'through':_0xe292('0x1eb')});db[_0xe292('0xee')][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':'TeamVoicePrefix','as':_0xe292('0x149')});db['UserProfile']['hasMany'](db[_0xe292('0x13')],{'as':'Users','foreignKey':'userProfileId'});db[_0xe292('0xf0')][_0xe292('0x107')](db[_0xe292('0xf2')],{'as':_0xe292('0x1ec'),'foreignKey':'userProfileId','onDelete':'cascade'});db[_0xe292('0xf2')][_0xe292('0x107')](db[_0xe292('0x1ed')],{'as':_0xe292('0x1ee'),'foreignKey':'sectionId','onDelete':_0xe292('0x105')});db[_0xe292('0xf6')]['hasMany'](db['Disposition'],{'as':_0xe292('0x159'),'foreignKey':_0xe292('0x1ef'),'onDelete':_0xe292('0x105')});db[_0xe292('0xf6')]['hasMany'](db[_0xe292('0x15a')],{'as':'Answers','foreignKey':_0xe292('0x1ef')});db[_0xe292('0xf6')][_0xe292('0x107')](db[_0xe292('0xfb')],{'as':_0xe292('0x14d'),'foreignKey':_0xe292('0x1ef')});db[_0xe292('0xf6')][_0xe292('0x107')](db[_0xe292('0xf9')],{'as':_0xe292('0x15c')});db[_0xe292('0xf6')][_0xe292('0x107')](db['WhatsappApplication'],{'as':_0xe292('0x13a')});db[_0xe292('0xf6')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':'List','foreignKey':_0xe292('0x15e')});db[_0xe292('0xf6')][_0xe292('0x116')](db[_0xe292('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe292('0xf6')]['belongsToMany'](db['User'],{'as':_0xe292('0x161'),'through':_0xe292('0x136')});db[_0xe292('0x1f0')][_0xe292('0x116')](db[_0xe292('0x13')],{'onDelete':_0xe292('0x156')});db['WhatsappApplication'][_0xe292('0x116')](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xe292('0x1f0')][_0xe292('0x116')](db[_0xe292('0xf6')],{'onDelete':_0xe292('0x156')});db[_0xe292('0x1f0')]['belongsTo'](db[_0xe292('0x80')],{'onDelete':_0xe292('0x156'),'foreignKey':_0xe292('0x147')});db[_0xe292('0x1f0')][_0xe292('0x116')](db[_0xe292('0x87')],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction'][_0xe292('0x107')](db[_0xe292('0xfb')],{'as':_0xe292('0x14d'),'onDelete':_0xe292('0x105'),'foreignKey':_0xe292('0x1f1')});db[_0xe292('0xf9')][_0xe292('0x116')](db[_0xe292('0xf6')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1ef')});db[_0xe292('0xf9')]['belongsTo'](db[_0xe292('0x6f')],{'as':'Contact','foreignKey':_0xe292('0x164')});db[_0xe292('0xf9')][_0xe292('0x116')](db['User'],{'as':'Owner','foreignKey':_0xe292('0x106')});db['WhatsappInteraction'][_0xe292('0x118')](db['Tag'],{'through':_0xe292('0x1a6'),'as':'Tags'});db[_0xe292('0xf9')]['belongsToMany'](db[_0xe292('0x87')],{'through':_0xe292('0x1a6'),'as':_0xe292('0x167')});db[_0xe292('0xf9')]['belongsToMany'](db['User'],{'as':_0xe292('0x168'),'through':_0xe292('0x1f2'),'foreignKey':_0xe292('0x1f1')});db[_0xe292('0xfb')][_0xe292('0x116')](db['User'],{'as':_0xe292('0x13')});db['WhatsappMessage'][_0xe292('0x116')](db['CmContact'],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x154')});db[_0xe292('0xfb')][_0xe292('0x116')](db['WhatsappInteraction'],{'onDelete':_0xe292('0x105'),'as':_0xe292('0x17d'),'foreignKey':_0xe292('0x1f1')});db[_0xe292('0xfb')]['belongsTo'](db[_0xe292('0xf6')],{'as':_0xe292('0x16c'),'foreignKey':_0xe292('0x1ef')});db['WhatsappQueueReport'][_0xe292('0x116')](db[_0xe292('0xf6')],{});db[_0xe292('0xfd')][_0xe292('0x116')](db[_0xe292('0xec')],{'as':_0xe292('0x15d'),'foreignKey':_0xe292('0x15e')});db[_0xe292('0xfd')][_0xe292('0x116')](db[_0xe292('0x6f')],{'as':'Contact','foreignKey':_0xe292('0x164')});db[_0xe292('0xfd')]['belongsTo'](db[_0xe292('0xf9')],{});db['WhatsappQueueReport'][_0xe292('0x116')](db[_0xe292('0x129')],{});db[_0xe292('0xfd')]['belongsTo'](db[_0xe292('0xfb')],{});db[_0xe292('0xfd')][_0xe292('0x116')](db[_0xe292('0x13')],{});db[_0xe292('0xfe')][_0xe292('0x116')](db['WhatsappMessage'],{});db[_0xe292('0xfe')][_0xe292('0x116')](db[_0xe292('0xf9')],{});db[_0xe292('0xfe')]['belongsTo'](db[_0xe292('0xf6')],{'foreignKey':_0xe292('0x1f3'),'as':_0xe292('0x1e4')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xe292('0x1f4'),'as':_0xe292('0x1dd')});db[_0xe292('0xfe')]['belongsTo'](db[_0xe292('0x129')],{'foreignKey':_0xe292('0x1f5'),'as':_0xe292('0x1db')});db[_0xe292('0xfe')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d6'),'as':'FromAgent'});db[_0xe292('0xfe')][_0xe292('0x116')](db[_0xe292('0x13')],{'foreignKey':_0xe292('0x1d8'),'as':_0xe292('0x1d9')});db[_0xe292('0x129')][_0xe292('0x118')](db['User'],{'as':_0xe292('0x161'),'through':_0xe292('0x37'),'foreignKey':_0xe292('0x1f6')});db['WhatsappQueue'][_0xe292('0x118')](db[_0xe292('0xd9')],{'through':_0xe292('0x1d0'),'as':'Teams'});db[_0xe292('0x100')][_0xe292('0x104')](db[_0xe292('0x38')],{'as':'Imap','onDelete':_0xe292('0x156')});db[_0xe292('0x100')][_0xe292('0x104')](db['MailServerOut'],{'as':_0xe292('0x158'),'onDelete':_0xe292('0x156')});module[_0xe292('0x1f7')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 6d4588e..f566b14 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97bf=['/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','appPath','/index.html','username','apiKey','lastName','street','phone','mobile','email','clientId','securityToken','code','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','secret','registry','isPlainObject','isArray','isString','replace','lodash','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','./safe-template','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','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)','format','method','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./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/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport'];(function(_0x2478b8,_0x40961b){var _0x102501=function(_0x26166c){while(--_0x26166c){_0x2478b8['push'](_0x2478b8['shift']());}};_0x102501(++_0x40961b);}(_0x97bf,0x188));var _0xf97b=function(_0x1b5a3f,_0x307e93){_0x1b5a3f=_0x1b5a3f-0x0;var _0x18e595=_0x97bf[_0x1b5a3f];return _0x18e595;};'use strict';var _=require(_0xf97b('0x0'));var path=require(_0xf97b('0x1'));var express=require(_0xf97b('0x2'));var ewinston=require(_0xf97b('0x3'));var util=require(_0xf97b('0x4'));var errors=require(_0xf97b('0x5'));var config=require(_0xf97b('0x6'));var logger=require(_0xf97b('0x7'))(_0xf97b('0x8'));var authLogger=require('./config/logger')(_0xf97b('0x9'));var safeTemplate=require(_0xf97b('0xa'))['safeTemplate'];exports['default']=function(_0x522d6f){_0x522d6f[_0xf97b('0xb')](ewinston[_0xf97b('0xc')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x47b588,_0x280a2a){var _0x2af197=_0xf97b('0xd');if(!_[_0xf97b('0xe')](_0x47b588[_0xf97b('0xf')])){_0x2af197+='\x20body=%s';var _0x5cee37=_0x47b588[_0xf97b('0xf')];maskSensitiveData(_0x5cee37);}return safeTemplate(util['format'](_0x2af197,_0x47b588['method'],_0x47b588['headers'][_0xf97b('0x10')]?_0x47b588[_0xf97b('0x11')][_0xf97b('0x10')]:_0x47b588[_0xf97b('0x12')][_0xf97b('0x13')]||_0x47b588['ip'],_0x47b588[_0xf97b('0x14')],_0x280a2a[_0xf97b('0x15')],_0x280a2a[_0xf97b('0x16')],_0x47b588[_0xf97b('0x17')]?_0x47b588[_0xf97b('0x17')]['id']:null,_0x47b588['user']?_0x47b588[_0xf97b('0x17')][_0xf97b('0x18')]:null,_0x47b588[_0xf97b('0x17')]?_0x47b588[_0xf97b('0x17')][_0xf97b('0x19')]:null,_0x5cee37?util[_0xf97b('0x1a')](_0x5cee37,![],null):''));}}));_0x522d6f[_0xf97b('0xb')](ewinston[_0xf97b('0xc')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x46593f,_0xdf5a66){var _0x29785f=_0xf97b('0x1b');if(_0x46593f[_0xf97b('0xf')]&&_0x46593f[_0xf97b('0xf')][_0xf97b('0x1c')]&&_0x46593f['body'][_0xf97b('0x1d')]){_0x29785f=_0xf97b('0x1e');}return util[_0xf97b('0x1f')](_0x29785f,_0x46593f[_0xf97b('0x20')],_0x46593f['headers'][_0xf97b('0x10')]?_0x46593f[_0xf97b('0x11')]['x-forwarded-for']:_0x46593f[_0xf97b('0x12')][_0xf97b('0x13')]||_0x46593f['ip'],_0x46593f[_0xf97b('0x14')],_0xdf5a66['statusCode'],_0xdf5a66['responseTime'],_0x46593f[_0xf97b('0x17')]?_0x46593f[_0xf97b('0x17')]['id']:null,_0x46593f[_0xf97b('0x17')]?_0x46593f[_0xf97b('0x17')][_0xf97b('0x18')]:null,_0x46593f[_0xf97b('0x17')]?_0x46593f['user']['role']:null,_0x46593f[_0xf97b('0xf')]&&_0x46593f[_0xf97b('0xf')][_0xf97b('0x1c')]?_0x46593f[_0xf97b('0xf')][_0xf97b('0x1c')]:_0xf97b('0x21'),_0x46593f[_0xf97b('0xf')]&&_0x46593f['body']['agent_id']?_0x46593f[_0xf97b('0xf')][_0xf97b('0x1d')]:'',_0x46593f[_0xf97b('0xf')]&&_0x46593f[_0xf97b('0xf')][_0xf97b('0x22')]?_0x46593f[_0xf97b('0xf')][_0xf97b('0x22')]:'');},'ignoreRoute':function(_0x3a2f26){var _0x13362e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x13362e[_0xf97b('0x23')](_0x3a2f26['url']);}}));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x24'),require(_0xf97b('0x25')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x26'),require(_0xf97b('0x27')));_0x522d6f['use'](_0xf97b('0x28'),require('./api/voiceContext'));_0x522d6f['use'](_0xf97b('0x29'),require('./api/voiceExtension'));_0x522d6f['use'](_0xf97b('0x2a'),require(_0xf97b('0x2b')));_0x522d6f['use'](_0xf97b('0x2c'),require(_0xf97b('0x2d')));_0x522d6f['use']('/api/voice/recordings',require('./api/voiceRecording'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x2e'),require(_0xf97b('0x2f')));_0x522d6f['use']('/api/voice/mails',require(_0xf97b('0x30')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x31'),require('./api/voiceMailMessage'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x32'),require('./api/voiceCallReport'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x33'),require('./api/voiceDialReport'));_0x522d6f[_0xf97b('0xb')]('/api/voice/agents/reports',require(_0xf97b('0x34')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x35'),require('./api/voiceQueueReport'));_0x522d6f['use'](_0xf97b('0x36'),require('./api/memberReport'));_0x522d6f['use'](_0xf97b('0x37'),require('./api/trunk'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x38'),require(_0xf97b('0x39')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x3a'),require(_0xf97b('0x3b')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x3c'),require(_0xf97b('0x3d')));_0x522d6f['use'](_0xf97b('0x3e'),require(_0xf97b('0x3f')));_0x522d6f[_0xf97b('0xb')]('/api/mail/substatuses',require(_0xf97b('0x40')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x41'),require(_0xf97b('0x42')));_0x522d6f['use'](_0xf97b('0x43'),require(_0xf97b('0x44')));_0x522d6f['use']('/api/mail/applications',require(_0xf97b('0x45')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x46'),require(_0xf97b('0x47')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x48'),require(_0xf97b('0x49')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x4a'),require(_0xf97b('0x4b')));_0x522d6f[_0xf97b('0xb')]('/api/fax/accounts',require(_0xf97b('0x4c')));_0x522d6f['use'](_0xf97b('0x4d'),require(_0xf97b('0x4e')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x4f'),require(_0xf97b('0x50')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x51'),require(_0xf97b('0x52')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x53'),require(_0xf97b('0x54')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x55'),require(_0xf97b('0x56')));_0x522d6f[_0xf97b('0xb')]('/api/sms/accounts',require('./api/smsAccount'));_0x522d6f[_0xf97b('0xb')]('/api/sms/applications',require(_0xf97b('0x57')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x58'),require(_0xf97b('0x59')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x5a'),require(_0xf97b('0x5b')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x5c'),require(_0xf97b('0x5d')));_0x522d6f['use'](_0xf97b('0x5e'),require(_0xf97b('0x5f')));_0x522d6f['use']('/api/openchannel/applications',require(_0xf97b('0x60')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x61'),require('./api/openchannelInteraction'));_0x522d6f[_0xf97b('0xb')]('/api/openchannel/messages',require(_0xf97b('0x62')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x63'),require('./api/openchannelQueue'));_0x522d6f['use'](_0xf97b('0x64'),require(_0xf97b('0x65')));_0x522d6f[_0xf97b('0xb')]('/api/openchannel/reports/queue',require(_0xf97b('0x66')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x67'),require(_0xf97b('0x68')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x69'),require(_0xf97b('0x6a')));_0x522d6f['use'](_0xf97b('0x6b'),require('./api/chatMessage'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x6c'),require(_0xf97b('0x6d')));_0x522d6f[_0xf97b('0xb')]('/api/chat/queues',require(_0xf97b('0x6e')));_0x522d6f['use'](_0xf97b('0x6f'),require('./api/chatGroup'));_0x522d6f['use'](_0xf97b('0x70'),require(_0xf97b('0x71')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x72'),require(_0xf97b('0x73')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x74'),require(_0xf97b('0x75')));_0x522d6f['use'](_0xf97b('0x76'),require('./api/cmHopper'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x77'),require('./api/cmHopperBlack'));_0x522d6f['use'](_0xf97b('0x78'),require('./api/cmHopperFinal'));_0x522d6f['use'](_0xf97b('0x79'),require(_0xf97b('0x7a')));_0x522d6f['use']('/api/cm/custom_fields',require(_0xf97b('0x7b')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x7c'),require('./api/action'));_0x522d6f[_0xf97b('0xb')]('/api/automations',require(_0xf97b('0x7d')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x7e'),require('./api/cannedAnswer'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x7f'),require(_0xf97b('0x80')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x81'),require(_0xf97b('0x82')));_0x522d6f['use'](_0xf97b('0x83'),require(_0xf97b('0x84')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x85'),require(_0xf97b('0x86')));_0x522d6f['use'](_0xf97b('0x87'),require(_0xf97b('0x88')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x89'),require(_0xf97b('0x8a')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x8b'),require('./api/schedule'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x8c'),require(_0xf97b('0x8d')));_0x522d6f[_0xf97b('0xb')]('/api/tags',require(_0xf97b('0x8e')));_0x522d6f[_0xf97b('0xb')]('/api/templates',require(_0xf97b('0x8f')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x90'),require(_0xf97b('0x91')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x92'),require(_0xf97b('0x93')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x94'),require(_0xf97b('0x95')));_0x522d6f['use'](_0xf97b('0x96'),require(_0xf97b('0x97')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x98'),require(_0xf97b('0x99')));_0x522d6f[_0xf97b('0xb')]('/api/analytics/default_reports',require(_0xf97b('0x9a')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x9b'),require('./api/analyticExtractedReport'));_0x522d6f[_0xf97b('0xb')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x522d6f['use'](_0xf97b('0x9c'),require('./api/analyticFieldReport'));_0x522d6f[_0xf97b('0xb')]('/api/analytics/tree_reports',require(_0xf97b('0x9d')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x9e'),require(_0xf97b('0x9f')));_0x522d6f[_0xf97b('0xb')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xa0'),require(_0xf97b('0xa1')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xa2'),require(_0xf97b('0xa3')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xa4'),require(_0xf97b('0xa5')));_0x522d6f['use']('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x522d6f[_0xf97b('0xb')]('/api/integrations/desk/accounts',require(_0xf97b('0xa6')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xa7'),require('./api/intDeskConfiguration'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xa8'),require(_0xf97b('0xa9')));_0x522d6f['use'](_0xf97b('0xaa'),require(_0xf97b('0xab')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xac'),require(_0xf97b('0xad')));_0x522d6f['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x522d6f[_0xf97b('0xb')]('/api/integrations/zendesk/accounts',require(_0xf97b('0xae')));_0x522d6f[_0xf97b('0xb')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xaf'),require(_0xf97b('0xb0')));_0x522d6f['use']('/api/integrations/freshdesk/accounts',require(_0xf97b('0xb1')));_0x522d6f['use'](_0xf97b('0xb2'),require(_0xf97b('0xb3')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xb4'),require('./api/intFreshdeskField'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xb5'),require('./api/intVtigerAccount'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xb6'),require(_0xf97b('0xb7')));_0x522d6f[_0xf97b('0xb')]('/api/integrations/vtiger/fields',require(_0xf97b('0xb8')));_0x522d6f['use']('/api/integrations/servicenow/accounts',require(_0xf97b('0xb9')));_0x522d6f['use'](_0xf97b('0xba'),require(_0xf97b('0xbb')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xbc'),require(_0xf97b('0xbd')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xbe'),require(_0xf97b('0xbf')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xc0'),require(_0xf97b('0xc1')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xc2'),require(_0xf97b('0xc3')));_0x522d6f['use'](_0xf97b('0xc4'),require(_0xf97b('0xc5')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xc6'),require(_0xf97b('0xc7')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xc8'),require(_0xf97b('0xc9')));_0x522d6f['use'](_0xf97b('0xca'),require('./api/network'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xcb'),require('./api/chatQueueReport'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xcc'),require(_0xf97b('0xcd')));_0x522d6f['use'](_0xf97b('0xce'),require(_0xf97b('0xcf')));_0x522d6f[_0xf97b('0xb')]('/api/jscripty/questions/reports',require(_0xf97b('0xd0')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xd1'),require(_0xf97b('0xd2')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xd3'),require(_0xf97b('0xd4')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xd5'),require('./api/squareReport'));_0x522d6f['use'](_0xf97b('0xd6'),require('./api/squareReportDetail'));_0x522d6f[_0xf97b('0xb')]('/api/jscripty/projects',require(_0xf97b('0xd7')));_0x522d6f['use'](_0xf97b('0xd8'),require(_0xf97b('0xd9')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xda'),require(_0xf97b('0xdb')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xdc'),require(_0xf97b('0xdd')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xde'),require(_0xf97b('0xdf')));_0x522d6f['use']('/api/square/messages',require('./api/squareMessage'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xe0'),require(_0xf97b('0xe1')));_0x522d6f['use'](_0xf97b('0xe2'),require(_0xf97b('0xe3')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xe4'),require(_0xf97b('0xe5')));_0x522d6f['use'](_0xf97b('0xe6'),require(_0xf97b('0xe7')));_0x522d6f['use'](_0xf97b('0xe8'),require('./api/attachment'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xe9'),require('./api/plugin'));_0x522d6f['use'](_0xf97b('0xea'),require(_0xf97b('0xeb')));_0x522d6f['use'](_0xf97b('0xec'),require('./api/chatTransferReport'));_0x522d6f['use']('/api/fax/reports/transfer',require(_0xf97b('0xed')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xee'),require(_0xf97b('0xef')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xf0'),require(_0xf97b('0xf1')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xf2'),require(_0xf97b('0xf3')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xf4'),require(_0xf97b('0xf5')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xf6'),require(_0xf97b('0xf7')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xf8'),require(_0xf97b('0xf9')));_0x522d6f['use']('/api/userProfile/resources',require(_0xf97b('0xfa')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xfb'),require(_0xf97b('0xfc')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xfd'),require('./api/whatsappAccount'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0xfe'),require(_0xf97b('0xff')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x100'),require('./api/whatsappInteraction'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x101'),require(_0xf97b('0x102')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x103'),require(_0xf97b('0x104')));_0x522d6f[_0xf97b('0xb')]('/api/whatsapp/reports/transfer',require(_0xf97b('0x105')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x106'),require('./api/whatsappQueue'));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x107'),require('./api/cloudProvider'));_0x522d6f['use'](_0xf97b('0x108'),require(_0xf97b('0x109')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x10a'),require(_0xf97b('0x10b')));_0x522d6f['use']('/api/auth/google',require(_0xf97b('0x10c')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x10d'),require(_0xf97b('0x10e')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x10f'),require('./api/jira'));_0x522d6f[_0xf97b('0xb')]('/api/rpc',require('./api/rpc'));_0x522d6f[_0xf97b('0xb')]('/api/version',require(_0xf97b('0x110')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x111'),require(_0xf97b('0x112')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x113'),require(_0xf97b('0x114')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x115'),require(_0xf97b('0x116')));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x117'),express[_0xf97b('0x118')](path[_0xf97b('0x119')](config[_0xf97b('0x11a')],_0xf97b('0x117'))));_0x522d6f['use'](_0xf97b('0x11b'),express['static'](path[_0xf97b('0x119')](config['root'],_0xf97b('0x11b'))));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x11c'),express[_0xf97b('0x118')](path['join'](config[_0xf97b('0x11a')],_0xf97b('0x11c'))));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x11d'),express[_0xf97b('0x118')](path['join'](config['root'],_0xf97b('0x11e'),_0xf97b('0x11f'))));_0x522d6f[_0xf97b('0xb')](_0xf97b('0x120'),express[_0xf97b('0x118')](path['join'](config[_0xf97b('0x11a')],_0xf97b('0x121'))));_0x522d6f[_0xf97b('0x122')](_0xf97b('0x123'))['get'](errors[0x194]);_0x522d6f['route']('/*')['get'](function(_0x4611f4,_0x4093bd){_0x4093bd['sendFile'](path['resolve'](_0x522d6f['get'](_0xf97b('0x124'))+_0xf97b('0x125')));});};var sensitiveFields=[_0xf97b('0x126'),'password','newPassword',_0xf97b('0x127'),'firstName',_0xf97b('0x128'),_0xf97b('0x129'),_0xf97b('0x12a'),_0xf97b('0x12b'),'fax',_0xf97b('0x12c'),_0xf97b('0x12d'),'clientSecret',_0xf97b('0x12e'),_0xf97b('0x12f'),'accessKey',_0xf97b('0x130'),_0xf97b('0x131'),_0xf97b('0x132'),_0xf97b('0x133'),_0xf97b('0x134'),_0xf97b('0x135'),_0xf97b('0x136'),'consumerSecret','membername','calleridname',_0xf97b('0x137'),_0xf97b('0x138'),_0xf97b('0x139'),_0xf97b('0x13a'),_0xf97b('0x13b'),_0xf97b('0x13c'),_0xf97b('0x13d'),_0xf97b('0x13e'),_0xf97b('0x17'),'pass',_0xf97b('0x13f'),_0xf97b('0x140'),'dsn',_0xf97b('0x141'),_0xf97b('0x142'),'oldPassword'];function maskSensitiveData(_0x33bee5){var _0x4aff84=/(?!^)[\s\S](?!$)/g;if(!_[_0xf97b('0x143')](_0x33bee5))return;for(var _0x3dc41c in _0x33bee5){if(_[_0xf97b('0x144')](_0x33bee5[_0x3dc41c])){for(var _0x298581=0x0;_0x298581<_0x33bee5[_0x3dc41c]['length'];_0x298581++){maskSensitiveData(_0x33bee5[_0x3dc41c][_0x298581]);}}else if(_[_0xf97b('0x143')](_0x33bee5[_0x3dc41c])){maskSensitiveData(_0x33bee5[_0x3dc41c]);}else if(_[_0xf97b('0x145')](_0x33bee5[_0x3dc41c])){_0x33bee5[_0x3dc41c]=_0x33bee5[_0x3dc41c][_0xf97b('0x146')](/{{{/g,'@@{')[_0xf97b('0x146')](/}}}/g,'}@@')['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3dc41c)){_0x33bee5[_0x3dc41c]=_0x33bee5[_0x3dc41c][_0xf97b('0x146')](_0x4aff84,'*');}}}} \ No newline at end of file +var _0xb90a=['/api/voice/contexts','./api/voiceContext','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/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/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/cloudProvider','/api/realtime','./api/realtime','./api/authLocal','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','./api/pm2','/api/webbar','./api/webbar','join','/apidoc','/www','static','root','/demo','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','username','password','newPassword','apiKey','firstName','lastName','mobile','fax','clientId','code','tenantId','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','exten','clientEmail','secretaccesskey','key','pass','accountSid','localstationid','secret','registry','isPlainObject','isArray','length','replace','@@{','}@@','lodash','path','express-winston','./config/logger','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy'];(function(_0x5c78d9,_0x2736c7){var _0x69ae1f=function(_0x4b31ac){while(--_0x4b31ac){_0x5c78d9['push'](_0x5c78d9['shift']());}};_0x69ae1f(++_0x2736c7);}(_0xb90a,0x12a));var _0xab90=function(_0x270311,_0x3f206b){_0x270311=_0x270311-0x0;var _0x5a99f4=_0xb90a[_0x270311];return _0x5a99f4;};'use strict';var _=require(_0xab90('0x0'));var path=require(_0xab90('0x1'));var express=require('express');var ewinston=require(_0xab90('0x2'));var util=require('util');var errors=require('./errors');var config=require('./config/environment');var logger=require('./config/logger')('api');var authLogger=require(_0xab90('0x3'))(_0xab90('0x4'));var safeTemplate=require('./safe-template')['safeTemplate'];exports[_0xab90('0x5')]=function(_0x426588){_0x426588[_0xab90('0x6')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2406e1,_0xc5ca04){var _0x3a0f26=_0xab90('0x7');if(!_[_0xab90('0x8')](_0x2406e1[_0xab90('0x9')])){_0x3a0f26+=_0xab90('0xa');var _0x1e0cf4=_0x2406e1['body'];maskSensitiveData(_0x1e0cf4);}return safeTemplate(util[_0xab90('0xb')](_0x3a0f26,_0x2406e1[_0xab90('0xc')],_0x2406e1[_0xab90('0xd')][_0xab90('0xe')]?_0x2406e1[_0xab90('0xd')]['x-forwarded-for']:_0x2406e1[_0xab90('0xf')][_0xab90('0x10')]||_0x2406e1['ip'],_0x2406e1[_0xab90('0x11')],_0xc5ca04[_0xab90('0x12')],_0xc5ca04[_0xab90('0x13')],_0x2406e1[_0xab90('0x14')]?_0x2406e1[_0xab90('0x14')]['id']:null,_0x2406e1[_0xab90('0x14')]?_0x2406e1[_0xab90('0x14')][_0xab90('0x15')]:null,_0x2406e1[_0xab90('0x14')]?_0x2406e1[_0xab90('0x14')][_0xab90('0x16')]:null,_0x1e0cf4?util['inspect'](_0x1e0cf4,![],null):''));}}));_0x426588[_0xab90('0x6')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x78ce5a,_0x138508){var _0x526bee=_0xab90('0x17');if(_0x78ce5a[_0xab90('0x9')]&&_0x78ce5a[_0xab90('0x9')]['device']&&_0x78ce5a[_0xab90('0x9')][_0xab90('0x18')]){_0x526bee=_0xab90('0x19');}return util[_0xab90('0xb')](_0x526bee,_0x78ce5a['method'],_0x78ce5a[_0xab90('0xd')]['x-forwarded-for']?_0x78ce5a[_0xab90('0xd')]['x-forwarded-for']:_0x78ce5a[_0xab90('0xf')][_0xab90('0x10')]||_0x78ce5a['ip'],_0x78ce5a[_0xab90('0x11')],_0x138508[_0xab90('0x12')],_0x138508['responseTime'],_0x78ce5a[_0xab90('0x14')]?_0x78ce5a[_0xab90('0x14')]['id']:null,_0x78ce5a[_0xab90('0x14')]?_0x78ce5a[_0xab90('0x14')][_0xab90('0x15')]:null,_0x78ce5a[_0xab90('0x14')]?_0x78ce5a[_0xab90('0x14')][_0xab90('0x16')]:null,_0x78ce5a[_0xab90('0x9')]&&_0x78ce5a[_0xab90('0x9')][_0xab90('0x1a')]?_0x78ce5a[_0xab90('0x9')][_0xab90('0x1a')]:_0xab90('0x1b'),_0x78ce5a['body']&&_0x78ce5a[_0xab90('0x9')][_0xab90('0x18')]?_0x78ce5a[_0xab90('0x9')][_0xab90('0x18')]:'',_0x78ce5a[_0xab90('0x9')]&&_0x78ce5a[_0xab90('0x9')][_0xab90('0x1c')]?_0x78ce5a[_0xab90('0x9')][_0xab90('0x1c')]:'');},'ignoreRoute':function(_0x52acf0){var _0x38b3ae=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x38b3ae[_0xab90('0x1d')](_0x52acf0['url']);}}));_0x426588[_0xab90('0x6')](_0xab90('0x1e'),require(_0xab90('0x1f')));_0x426588[_0xab90('0x6')](_0xab90('0x20'),require(_0xab90('0x21')));_0x426588[_0xab90('0x6')](_0xab90('0x22'),require(_0xab90('0x23')));_0x426588[_0xab90('0x6')]('/api/voice/extensions',require('./api/voiceExtension'));_0x426588['use'](_0xab90('0x24'),require('./api/voiceMusicOnHold'));_0x426588[_0xab90('0x6')](_0xab90('0x25'),require(_0xab90('0x26')));_0x426588[_0xab90('0x6')]('/api/voice/recordings',require(_0xab90('0x27')));_0x426588[_0xab90('0x6')](_0xab90('0x28'),require('./api/screenRecording'));_0x426588['use'](_0xab90('0x29'),require(_0xab90('0x2a')));_0x426588[_0xab90('0x6')](_0xab90('0x2b'),require(_0xab90('0x2c')));_0x426588[_0xab90('0x6')](_0xab90('0x2d'),require(_0xab90('0x2e')));_0x426588[_0xab90('0x6')](_0xab90('0x2f'),require(_0xab90('0x30')));_0x426588['use'](_0xab90('0x31'),require(_0xab90('0x32')));_0x426588[_0xab90('0x6')](_0xab90('0x33'),require(_0xab90('0x34')));_0x426588['use'](_0xab90('0x35'),require(_0xab90('0x36')));_0x426588[_0xab90('0x6')]('/api/trunks',require(_0xab90('0x37')));_0x426588[_0xab90('0x6')](_0xab90('0x38'),require(_0xab90('0x39')));_0x426588[_0xab90('0x6')](_0xab90('0x3a'),require('./api/mailServerOut'));_0x426588[_0xab90('0x6')]('/api/mail/accounts',require(_0xab90('0x3b')));_0x426588[_0xab90('0x6')]('/api/mail/queues',require(_0xab90('0x3c')));_0x426588['use'](_0xab90('0x3d'),require(_0xab90('0x3e')));_0x426588[_0xab90('0x6')](_0xab90('0x3f'),require(_0xab90('0x40')));_0x426588['use'](_0xab90('0x41'),require('./api/mailMessage'));_0x426588[_0xab90('0x6')](_0xab90('0x42'),require('./api/mailApplication'));_0x426588[_0xab90('0x6')](_0xab90('0x43'),require(_0xab90('0x44')));_0x426588['use'](_0xab90('0x45'),require(_0xab90('0x46')));_0x426588['use']('/api/dashboards/items',require(_0xab90('0x47')));_0x426588[_0xab90('0x6')](_0xab90('0x48'),require(_0xab90('0x49')));_0x426588[_0xab90('0x6')](_0xab90('0x4a'),require(_0xab90('0x4b')));_0x426588['use'](_0xab90('0x4c'),require('./api/faxInteraction'));_0x426588[_0xab90('0x6')]('/api/fax/messages',require(_0xab90('0x4d')));_0x426588[_0xab90('0x6')](_0xab90('0x4e'),require(_0xab90('0x4f')));_0x426588[_0xab90('0x6')](_0xab90('0x50'),require(_0xab90('0x51')));_0x426588[_0xab90('0x6')]('/api/sms/accounts',require('./api/smsAccount'));_0x426588['use']('/api/sms/applications',require(_0xab90('0x52')));_0x426588['use'](_0xab90('0x53'),require(_0xab90('0x54')));_0x426588[_0xab90('0x6')](_0xab90('0x55'),require(_0xab90('0x56')));_0x426588['use'](_0xab90('0x57'),require('./api/smsQueue'));_0x426588[_0xab90('0x6')](_0xab90('0x58'),require('./api/openchannelAccount'));_0x426588[_0xab90('0x6')](_0xab90('0x59'),require(_0xab90('0x5a')));_0x426588[_0xab90('0x6')](_0xab90('0x5b'),require(_0xab90('0x5c')));_0x426588['use'](_0xab90('0x5d'),require('./api/openchannelMessage'));_0x426588[_0xab90('0x6')]('/api/openchannel/queues',require(_0xab90('0x5e')));_0x426588['use'](_0xab90('0x5f'),require('./api/chatWebsite'));_0x426588['use']('/api/openchannel/reports/queue',require(_0xab90('0x60')));_0x426588[_0xab90('0x6')](_0xab90('0x61'),require(_0xab90('0x62')));_0x426588[_0xab90('0x6')](_0xab90('0x63'),require(_0xab90('0x64')));_0x426588[_0xab90('0x6')](_0xab90('0x65'),require('./api/chatMessage'));_0x426588[_0xab90('0x6')](_0xab90('0x66'),require(_0xab90('0x67')));_0x426588['use']('/api/chat/queues',require(_0xab90('0x68')));_0x426588[_0xab90('0x6')](_0xab90('0x69'),require('./api/chatGroup'));_0x426588[_0xab90('0x6')](_0xab90('0x6a'),require(_0xab90('0x6b')));_0x426588[_0xab90('0x6')](_0xab90('0x6c'),require(_0xab90('0x6d')));_0x426588[_0xab90('0x6')]('/api/cm/contacts',require(_0xab90('0x6e')));_0x426588[_0xab90('0x6')](_0xab90('0x6f'),require(_0xab90('0x70')));_0x426588[_0xab90('0x6')]('/api/cm/hopper_black',require(_0xab90('0x71')));_0x426588[_0xab90('0x6')](_0xab90('0x72'),require(_0xab90('0x73')));_0x426588[_0xab90('0x6')](_0xab90('0x74'),require(_0xab90('0x75')));_0x426588[_0xab90('0x6')](_0xab90('0x76'),require(_0xab90('0x77')));_0x426588['use'](_0xab90('0x78'),require(_0xab90('0x79')));_0x426588[_0xab90('0x6')]('/api/automations',require(_0xab90('0x7a')));_0x426588[_0xab90('0x6')](_0xab90('0x7b'),require(_0xab90('0x7c')));_0x426588[_0xab90('0x6')](_0xab90('0x7d'),require('./api/disposition'));_0x426588[_0xab90('0x6')](_0xab90('0x7e'),require(_0xab90('0x7f')));_0x426588[_0xab90('0x6')](_0xab90('0x80'),require(_0xab90('0x81')));_0x426588[_0xab90('0x6')](_0xab90('0x82'),require(_0xab90('0x83')));_0x426588[_0xab90('0x6')](_0xab90('0x84'),require(_0xab90('0x85')));_0x426588[_0xab90('0x6')](_0xab90('0x86'),require(_0xab90('0x87')));_0x426588[_0xab90('0x6')](_0xab90('0x88'),require(_0xab90('0x89')));_0x426588[_0xab90('0x6')](_0xab90('0x8a'),require(_0xab90('0x8b')));_0x426588[_0xab90('0x6')]('/api/tags',require(_0xab90('0x8c')));_0x426588['use'](_0xab90('0x8d'),require(_0xab90('0x8e')));_0x426588['use'](_0xab90('0x8f'),require(_0xab90('0x90')));_0x426588[_0xab90('0x6')](_0xab90('0x91'),require(_0xab90('0x92')));_0x426588['use'](_0xab90('0x93'),require(_0xab90('0x94')));_0x426588[_0xab90('0x6')](_0xab90('0x95'),require('./api/integrationReport'));_0x426588[_0xab90('0x6')](_0xab90('0x96'),require(_0xab90('0x97')));_0x426588[_0xab90('0x6')](_0xab90('0x98'),require('./api/analyticDefaultReport'));_0x426588[_0xab90('0x6')](_0xab90('0x99'),require(_0xab90('0x9a')));_0x426588['use'](_0xab90('0x9b'),require('./api/analyticMetric'));_0x426588[_0xab90('0x6')](_0xab90('0x9c'),require(_0xab90('0x9d')));_0x426588[_0xab90('0x6')](_0xab90('0x9e'),require(_0xab90('0x9f')));_0x426588[_0xab90('0x6')](_0xab90('0xa0'),require(_0xab90('0xa1')));_0x426588[_0xab90('0x6')](_0xab90('0xa2'),require(_0xab90('0xa3')));_0x426588['use'](_0xab90('0xa4'),require(_0xab90('0xa5')));_0x426588[_0xab90('0x6')](_0xab90('0xa6'),require('./api/intSugarcrmAccount'));_0x426588[_0xab90('0x6')]('/api/integrations/sugarcrm/configurations',require(_0xab90('0xa7')));_0x426588[_0xab90('0x6')](_0xab90('0xa8'),require(_0xab90('0xa9')));_0x426588[_0xab90('0x6')](_0xab90('0xaa'),require(_0xab90('0xab')));_0x426588[_0xab90('0x6')](_0xab90('0xac'),require('./api/intDeskConfiguration'));_0x426588[_0xab90('0x6')](_0xab90('0xad'),require(_0xab90('0xae')));_0x426588['use'](_0xab90('0xaf'),require(_0xab90('0xb0')));_0x426588[_0xab90('0x6')]('/api/integrations/zoho/configurations',require(_0xab90('0xb1')));_0x426588[_0xab90('0x6')]('/api/integrations/zoho/fields',require(_0xab90('0xb2')));_0x426588['use'](_0xab90('0xb3'),require(_0xab90('0xb4')));_0x426588[_0xab90('0x6')](_0xab90('0xb5'),require('./api/intZendeskConfiguration'));_0x426588['use'](_0xab90('0xb6'),require(_0xab90('0xb7')));_0x426588['use'](_0xab90('0xb8'),require(_0xab90('0xb9')));_0x426588[_0xab90('0x6')]('/api/integrations/freshdesk/configurations',require(_0xab90('0xba')));_0x426588[_0xab90('0x6')](_0xab90('0xbb'),require('./api/intFreshdeskField'));_0x426588['use'](_0xab90('0xbc'),require(_0xab90('0xbd')));_0x426588['use'](_0xab90('0xbe'),require(_0xab90('0xbf')));_0x426588[_0xab90('0x6')](_0xab90('0xc0'),require(_0xab90('0xc1')));_0x426588['use'](_0xab90('0xc2'),require('./api/intServicenowAccount'));_0x426588[_0xab90('0x6')](_0xab90('0xc3'),require('./api/intServicenowConfiguration'));_0x426588['use'](_0xab90('0xc4'),require(_0xab90('0xc5')));_0x426588[_0xab90('0x6')](_0xab90('0xc6'),require(_0xab90('0xc7')));_0x426588['use'](_0xab90('0xc8'),require('./api/intDynamics365Configuration'));_0x426588['use'](_0xab90('0xc9'),require(_0xab90('0xca')));_0x426588['use'](_0xab90('0xcb'),require(_0xab90('0xcc')));_0x426588['use']('/api/integrations/freshsales/configurations',require(_0xab90('0xcd')));_0x426588[_0xab90('0x6')](_0xab90('0xce'),require('./api/intFreshsalesField'));_0x426588[_0xab90('0x6')]('/api/networks',require(_0xab90('0xcf')));_0x426588[_0xab90('0x6')](_0xab90('0xd0'),require(_0xab90('0xd1')));_0x426588[_0xab90('0x6')](_0xab90('0xd2'),require('./api/chatInternalMessage'));_0x426588[_0xab90('0x6')](_0xab90('0xd3'),require(_0xab90('0xd4')));_0x426588['use'](_0xab90('0xd5'),require(_0xab90('0xd6')));_0x426588[_0xab90('0x6')](_0xab90('0xd7'),require(_0xab90('0xd8')));_0x426588[_0xab90('0x6')](_0xab90('0xd9'),require(_0xab90('0xda')));_0x426588['use'](_0xab90('0xdb'),require('./api/squareReport'));_0x426588['use'](_0xab90('0xdc'),require(_0xab90('0xdd')));_0x426588['use'](_0xab90('0xde'),require(_0xab90('0xdf')));_0x426588[_0xab90('0x6')]('/api/settings',require('./api/setting'));_0x426588[_0xab90('0x6')](_0xab90('0xe0'),require(_0xab90('0xe1')));_0x426588[_0xab90('0x6')](_0xab90('0xe2'),require(_0xab90('0xe3')));_0x426588[_0xab90('0x6')](_0xab90('0xe4'),require(_0xab90('0xe5')));_0x426588[_0xab90('0x6')](_0xab90('0xe6'),require(_0xab90('0xe7')));_0x426588[_0xab90('0x6')](_0xab90('0xe8'),require('./api/team'));_0x426588[_0xab90('0x6')](_0xab90('0xe9'),require('./api/license'));_0x426588['use'](_0xab90('0xea'),require(_0xab90('0xeb')));_0x426588[_0xab90('0x6')](_0xab90('0xec'),require(_0xab90('0xed')));_0x426588['use'](_0xab90('0xee'),require('./api/attachment'));_0x426588['use'](_0xab90('0xef'),require(_0xab90('0xf0')));_0x426588[_0xab90('0x6')](_0xab90('0xf1'),require('./api/mailTransferReport'));_0x426588[_0xab90('0x6')](_0xab90('0xf2'),require(_0xab90('0xf3')));_0x426588[_0xab90('0x6')]('/api/fax/reports/transfer',require(_0xab90('0xf4')));_0x426588[_0xab90('0x6')](_0xab90('0xf5'),require(_0xab90('0xf6')));_0x426588[_0xab90('0x6')]('/api/sms/reports/transfer',require(_0xab90('0xf7')));_0x426588[_0xab90('0x6')](_0xab90('0xf8'),require('./api/cmList'));_0x426588[_0xab90('0x6')]('/api/voice/prefixes',require(_0xab90('0xf9')));_0x426588[_0xab90('0x6')](_0xab90('0xfa'),require(_0xab90('0xfb')));_0x426588[_0xab90('0x6')](_0xab90('0xfc'),require(_0xab90('0xfd')));_0x426588['use'](_0xab90('0xfe'),require('./api/userProfileResource'));_0x426588['use'](_0xab90('0xff'),require(_0xab90('0x100')));_0x426588[_0xab90('0x6')](_0xab90('0x101'),require(_0xab90('0x102')));_0x426588[_0xab90('0x6')](_0xab90('0x103'),require(_0xab90('0x104')));_0x426588['use'](_0xab90('0x105'),require(_0xab90('0x106')));_0x426588[_0xab90('0x6')]('/api/whatsapp/messages',require(_0xab90('0x107')));_0x426588[_0xab90('0x6')]('/api/whatsapp/reports/queue',require(_0xab90('0x108')));_0x426588[_0xab90('0x6')](_0xab90('0x109'),require(_0xab90('0x10a')));_0x426588['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x426588[_0xab90('0x6')]('/api/cloudProviders',require(_0xab90('0x10b')));_0x426588[_0xab90('0x6')](_0xab90('0x10c'),require(_0xab90('0x10d')));_0x426588[_0xab90('0x6')]('/api/auth/local',require(_0xab90('0x10e')));_0x426588[_0xab90('0x6')]('/api/auth/google',require(_0xab90('0x10f')));_0x426588[_0xab90('0x6')]('/api/auth/activedirectory',require(_0xab90('0x110')));_0x426588[_0xab90('0x6')](_0xab90('0x111'),require(_0xab90('0x112')));_0x426588[_0xab90('0x6')](_0xab90('0x113'),require(_0xab90('0x114')));_0x426588['use'](_0xab90('0x115'),require(_0xab90('0x116')));_0x426588['use'](_0xab90('0x117'),require(_0xab90('0x118')));_0x426588[_0xab90('0x6')]('/api/pm2',require(_0xab90('0x119')));_0x426588[_0xab90('0x6')](_0xab90('0x11a'),require(_0xab90('0x11b')));_0x426588['use']('/apidoc',express['static'](path[_0xab90('0x11c')](config['root'],_0xab90('0x11d'))));_0x426588[_0xab90('0x6')](_0xab90('0x11e'),express[_0xab90('0x11f')](path['join'](config[_0xab90('0x120')],_0xab90('0x11e'))));_0x426588[_0xab90('0x6')](_0xab90('0x121'),express[_0xab90('0x11f')](path['join'](config[_0xab90('0x120')],_0xab90('0x121'))));_0x426588['use']('/snippet',express[_0xab90('0x11f')](path[_0xab90('0x11c')](config[_0xab90('0x120')],_0xab90('0x122'),_0xab90('0x123'))));_0x426588['use'](_0xab90('0x124'),express['static'](path[_0xab90('0x11c')](config[_0xab90('0x120')],'/server/files/plugins')));_0x426588[_0xab90('0x125')](_0xab90('0x126'))[_0xab90('0x127')](errors[0x194]);_0x426588[_0xab90('0x125')]('/*')['get'](function(_0x24fef7,_0x2a023a){_0x2a023a[_0xab90('0x128')](path[_0xab90('0x129')](_0x426588[_0xab90('0x127')]('appPath')+_0xab90('0x12a')));});};var sensitiveFields=[_0xab90('0x12b'),_0xab90('0x12c'),_0xab90('0x12d'),_0xab90('0x12e'),_0xab90('0x12f'),_0xab90('0x130'),'street','phone',_0xab90('0x131'),_0xab90('0x132'),'email',_0xab90('0x133'),'clientSecret','securityToken',_0xab90('0x134'),'accessKey',_0xab90('0x135'),_0xab90('0x136'),'channelSecret','accessToken',_0xab90('0x137'),_0xab90('0x138'),_0xab90('0x139'),_0xab90('0x13a'),_0xab90('0x13b'),_0xab90('0x13c'),'calleridnum',_0xab90('0x13d'),'vidaooApiKey',_0xab90('0x13e'),'privateKey','accesskeyid',_0xab90('0x13f'),_0xab90('0x140'),_0xab90('0x14'),_0xab90('0x141'),_0xab90('0x142'),_0xab90('0x143'),'dsn',_0xab90('0x144'),_0xab90('0x145'),'oldPassword'];function maskSensitiveData(_0x153cce){var _0x1f7e7d=/(?!^)[\s\S](?!$)/g;if(!_[_0xab90('0x146')](_0x153cce))return;for(var _0x4241bd in _0x153cce){if(_[_0xab90('0x147')](_0x153cce[_0x4241bd])){for(var _0x4798cf=0x0;_0x4798cf<_0x153cce[_0x4241bd][_0xab90('0x148')];_0x4798cf++){maskSensitiveData(_0x153cce[_0x4241bd][_0x4798cf]);}}else if(_[_0xab90('0x146')](_0x153cce[_0x4241bd])){maskSensitiveData(_0x153cce[_0x4241bd]);}else if(_['isString'](_0x153cce[_0x4241bd])){_0x153cce[_0x4241bd]=_0x153cce[_0x4241bd][_0xab90('0x149')](/{{{/g,_0xab90('0x14a'))[_0xab90('0x149')](/}}}/g,_0xab90('0x14b'))[_0xab90('0x149')](/{{/g,'@{')[_0xab90('0x149')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x4241bd)){_0x153cce[_0x4241bd]=_0x153cce[_0x4241bd]['replace'](_0x1f7e7d,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 1e7f157..85b72c1 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6c8=['../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xc6c8,0x1bd));var _0x8c6c=function(_0x1e8090,_0x2e70c0){_0x1e8090=_0x1e8090-0x0;var _0x58d31b=_0xc6c8[_0x1e8090];return _0x58d31b;};'use strict';var jayson=require(_0x8c6c('0x0'));var BPromise=require('bluebird');var _=require(_0x8c6c('0x1'));var config=require(_0x8c6c('0x2'));exports[_0x8c6c('0x3')]=function(){return new BPromise(function(_0x1c55d2,_0x58ccaf){var _0x4d0b92={};_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/user/user.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/voiceExtension/voiceExtension.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x5')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x6')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x7')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x8')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x9')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/memberReport/memberReport.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0xa')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0xb')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0xc')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0xd')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0xe')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0xf')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x10')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x11')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x12')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x13')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x14')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x15')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x16')));_0x4d0b92=_['merge'](_0x4d0b92,require('../api/faxMessage/faxMessage.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/faxQueue/faxQueue.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x17')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/smsAccount/smsAccount.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require('../api/smsInteraction/smsInteraction.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/smsMessage/smsMessage.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x18')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x19')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1a')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/chatInteraction/chatInteraction.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1b')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1c')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1d')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1e')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x1f')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x20')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x21')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/pause/pause.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x22')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/template/template.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x23')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x24')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x25')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x26')));_0x4d0b92=_['merge'](_0x4d0b92,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x27')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x28')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x29')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2a')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2b')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2c')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2d')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2e')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x2f')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x30')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x31')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x32')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/squareRecording/squareRecording.rpc'));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x33')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require('../api/campaign/campaign.rpc'));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x34')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x35')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x36')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x37')));_0x4d0b92=_['merge'](_0x4d0b92,require(_0x8c6c('0x38')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x39')));_0x4d0b92=_[_0x8c6c('0x4')](_0x4d0b92,require(_0x8c6c('0x3a')));var _0x30f303=jayson['server'](_0x4d0b92)[_0x8c6c('0x3b')]();var _0x5e96fb=config['rpc'][_0x8c6c('0x3c')]||config[_0x8c6c('0x3c')]+0x1;var _0x4b19f5=config['rpc']['ip']||_0x8c6c('0x3d');_0x30f303['on'](_0x8c6c('0x3e'),function(_0x403906){return _0x58ccaf(_0x403906);});_0x30f303['listen'](_0x5e96fb,_0x4b19f5,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4b19f5,_0x5e96fb);require(_0x8c6c('0x3f'))[_0x8c6c('0x40')]();return _0x1c55d2(_0x8c6c('0x41')+_0x4b19f5+':'+_0x5e96fb);});});}; \ No newline at end of file +var _0x2622=['../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc'];(function(_0x354548,_0x3448fe){var _0x34e184=function(_0x4d3955){while(--_0x4d3955){_0x354548['push'](_0x354548['shift']());}};_0x34e184(++_0x3448fe);}(_0x2622,0x17b));var _0x2262=function(_0x2d3e60,_0x3481ac){_0x2d3e60=_0x2d3e60-0x0;var _0x550af5=_0x2622[_0x2d3e60];return _0x550af5;};'use strict';var jayson=require(_0x2262('0x0'));var BPromise=require(_0x2262('0x1'));var _=require(_0x2262('0x2'));var config=require(_0x2262('0x3'));exports[_0x2262('0x4')]=function(){return new BPromise(function(_0x882992,_0x44ccf4){var _0x22b335={};_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x5')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x7')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x8')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/voiceRecording/voiceRecording.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x9')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0xa')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0xb')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0xc')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/memberReport/memberReport.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/trunk/trunk.rpc'));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0xd')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/mailServerIn/mailServerIn.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0xe')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0xf')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/mailInteraction/mailInteraction.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/mailMessage/mailMessage.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x10')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x11')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x12')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x13')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x14')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x15')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x16')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x17')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x18')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x19')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/smsMessage/smsMessage.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x1a')));_0x22b335=_['merge'](_0x22b335,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x22b335=_['merge'](_0x22b335,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x1b')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x1c')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x1d')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/cmContact/cmContact.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x1e')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x1f')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x20')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x21')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x22')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x23')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x24')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/sound/sound.rpc'));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x25')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x26')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/variable/variable.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x27')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x28')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x29')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x2a')));_0x22b335=_['merge'](_0x22b335,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x2b')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x2c')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x2d')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x2e')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x2f')));_0x22b335=_['merge'](_0x22b335,require('../api/squareReport/squareReport.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x30')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/setting/setting.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x31')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x32')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x33')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x34')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x35')));_0x22b335=_['merge'](_0x22b335,require(_0x2262('0x36')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/plugin/plugin.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x37')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x38')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x39')));_0x22b335=_[_0x2262('0x6')](_0x22b335,require(_0x2262('0x3a')));var _0x3dce23=jayson[_0x2262('0x3b')](_0x22b335)[_0x2262('0x3c')]();var _0x419e8b=config[_0x2262('0x3d')][_0x2262('0x3e')]||config[_0x2262('0x3e')]+0x1;var _0x52f7c5=config[_0x2262('0x3d')]['ip']||_0x2262('0x3f');_0x3dce23['on'](_0x2262('0x40'),function(_0x4161c8){return _0x44ccf4(_0x4161c8);});_0x3dce23['listen'](_0x419e8b,_0x52f7c5,function(){console[_0x2262('0x41')](_0x2262('0x42'),_0x52f7c5,_0x419e8b);require(_0x2262('0x43'))[_0x2262('0x44')]();return _0x882992(_0x2262('0x45')+_0x52f7c5+':'+_0x419e8b);});});}; \ No newline at end of file diff --git a/server/safe-template.js b/server/safe-template.js index b22091d..2f59679 100644 --- a/server/safe-template.js +++ b/server/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x608735,_0x1da97c){var _0x344051=function(_0x33b7a8){while(--_0x33b7a8){_0x608735['push'](_0x608735['shift']());}};_0x344051(++_0x1da97c);}(_0x4024,0x89));var _0x4402=function(_0x42ea25,_0x3e2714){_0x42ea25=_0x42ea25-0x0;var _0x678aba=_0x4024[_0x42ea25];return _0x678aba;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x4aa78a,_0x15c09c){var _0x444b3b=function(_0x7c30bb){while(--_0x7c30bb){_0x4aa78a['push'](_0x4aa78a['shift']());}};_0x444b3b(++_0x15c09c);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index fc0dfc0..adf5ded 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 _0xac41=['exec','AGI','WAIT','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','substring','520-Invalid','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','length','match','error','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','prototype','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','hangup','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi'];(function(_0x2b07a1,_0x25c79a){var _0x4bb96b=function(_0xcd3208){while(--_0xcd3208){_0x2b07a1['push'](_0x2b07a1['shift']());}};_0x4bb96b(++_0x25c79a);}(_0xac41,0xdd));var _0x1ac4=function(_0x19a2b8,_0x4edb7d){_0x19a2b8=_0x19a2b8-0x0;var _0x183414=_0xac41[_0x19a2b8];return _0x183414;};'use strict';var util=require(_0x1ac4('0x0'));var _=require(_0x1ac4('0x1'));var EventEmitter=require(_0x1ac4('0x2'))[_0x1ac4('0x3')];var AGIReply=require(_0x1ac4('0x4'));var AGIError=require(_0x1ac4('0x5'));function AGIChannel(_0x256c6c){var _0x3a1763=this,_0x54386c=new AGIReply(),_0x2c33d6=![],_0x216c0d={};EventEmitter[_0x1ac4('0x6')](_0x3a1763);_0x256c6c[_0x1ac4('0x7')](_0x1ac4('0x8'));_0x256c6c[_0x1ac4('0x9')](0x8*0x3c*0x3c*0x3e8);_0x54386c[_0x1ac4('0x7')](_0x1ac4('0x8'));_0x54386c['on'](_0x1ac4('0xa'),function(_0x245861){for(var _0x109c09 in _0x245861){_0x3a1763[_0x109c09]=_0x245861[_0x109c09];}_0x3a1763[_0x1ac4('0xb')](_0x1ac4('0xc'));});_0x54386c['on'](_0x1ac4('0xd'),function(_0x3a8514){if(_0x3a8514[_0x1ac4('0xe')]()=='hangup'){_0x3a1763[_0x1ac4('0xb')]('hangup');return;}if(_0x3a8514[_0x1ac4('0xf')](0x0,0xb)==_0x1ac4('0x10')){_0x2c33d6=!![];}if(_0x2c33d6){_0x216c0d['rx']+=_0x3a8514+'\x0a';if(_0x3a8514['search'](_0x1ac4('0x11'))!=-0x1){_0x2c33d6=![];}}else{_0x216c0d['rx']=_0x3a8514;}if(_0x2c33d6){return;}if(typeof _0x216c0d['cb']==_0x1ac4('0x12')){var _0x4bc8d8=_0x216c0d['rx']['substring'](0x0,0x3),_0x2ac588=null,_0x4e54c2=null;_0x4bc8d8=parseInt(_0x4bc8d8);if(isNaN(_0x4bc8d8)){_0x216c0d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x4bc8d8!=0xc8){_0x216c0d['cb'](null,{'code':_0x4bc8d8,'result':-0x1,'extra':'KO'});return;}_0x2ac588=_0x216c0d['rx'][_0x1ac4('0xf')](0x4)[_0x1ac4('0x13')](_0x1ac4('0x14'),'');if(_0x2ac588[_0x1ac4('0x15')]('\x20')!=-0x1){_0x2ac588=_0x2ac588[_0x1ac4('0x16')](0x0,_0x2ac588[_0x1ac4('0x15')]('\x20'));}if(_['startsWith'](_0x2ac588,'-1')){_0x2ac588=parseInt(_0x2ac588);}_0x4e54c2=_0x216c0d['rx']['split']('\x20');if(_0x4e54c2[_0x1ac4('0x17')]==0x3){_0x4e54c2=_0x4e54c2[0x2][_0x1ac4('0xf')](0x1,_0x4e54c2[0x2][_0x1ac4('0x17')]-0x1);}else if(_0x4e54c2['length']>0x3){var _0x477db7=/\((.+)\)/;var _0x43598c=_0x216c0d['rx'][_0x1ac4('0x18')](_0x477db7);if(_0x43598c){_0x4e54c2=_0x43598c[0x1];}else{_0x4e54c2=null;}}else{_0x4e54c2=null;}_0x216c0d['cb'](null,{'code':_0x4bc8d8,'result':_0x2ac588,'extra':_0x4e54c2});}});_0x256c6c['on'](_0x1ac4('0x19'),function(_0x1e7669){_0x3a1763[_0x1ac4('0xb')](_0x1ac4('0x19'),new AGIError('E_AGI_SOCKET_ERROR',_0x1e7669['code']));});_0x256c6c['on'](_0x1ac4('0x1a'),function(){_0x3a1763[_0x1ac4('0xb')](_0x1ac4('0x1a'),new AGIError(_0x1ac4('0x1b')));});_0x256c6c['on'](_0x1ac4('0x1c'),function(){_0x3a1763['emit']('timeout',new AGIError(_0x1ac4('0x1d')));_0x256c6c[_0x1ac4('0x1e')]();});_0x256c6c['pipe'](_0x54386c);this[_0x1ac4('0x1f')]=function(_0x18d2b9,_0x28a2d7){var _0x18d2b9=_0x18d2b9||'',_0x28a2d7=typeof _0x28a2d7==_0x1ac4('0x12')?_0x28a2d7:new Function();_0x216c0d={'tx':_0x18d2b9,'rx':'','cb':_0x28a2d7};_0x256c6c[_0x1ac4('0x20')](_0x18d2b9+'\x0a');},this['close']=function(){_0x256c6c[_0x1ac4('0x1e')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x22')]=function(_0x2d4c51){return this[_0x1ac4('0x1f')]['sync'](this,_0x2d4c51);};AGIChannel[_0x1ac4('0x21')]['answer']=function(){return this[_0x1ac4('0x22')](_0x1ac4('0x23'));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x24')]=function(_0x385885,_0x13a85d,_0x1fc03a){_0x385885=_0x385885===undefined?_0x1ac4('0x25'):_0x385885;_0x13a85d=_0x13a85d===undefined?'5':_0x13a85d;_0x1fc03a=_0x1fc03a===undefined?'1':_0x1fc03a;return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')](_0x1ac4('0x27'),_0x385885,_0x13a85d*0x3e8,_0x1fc03a));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x28')]=function(_0x14de4e){_0x14de4e=_0x14de4e||_0x1ac4('0x29');return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')]('VERBOSE\x20\x22%s\x22',_0x14de4e));};AGIChannel['prototype']['exec']=function(_0x2f6983,_0x456655){if(_['isArray'](_0x456655)){return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')](_0x1ac4('0x2a'),_0x2f6983,_0x456655['join'](',')));}return this[_0x1ac4('0x22')](util['format']('EXEC\x20%s\x20%s',_0x2f6983,_0x456655));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x2b')]=function(_0xffeb44){return this['sendRequest'](util[_0x1ac4('0x26')](_0x1ac4('0x2c'),_0xffeb44));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x2d')]=function(_0x2d7f3e){return this['sendRequest'](util[_0x1ac4('0x26')](_0x1ac4('0x2e'),_0x2d7f3e));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x2f')]=function(_0x28365d){return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')]('SET\x20PRIORITY\x20%s',_0x28365d));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x30')]=function(){return this['sendRequest'](_0x1ac4('0x31'));};AGIChannel[_0x1ac4('0x21')]['setVariable']=function(_0x10815c,_0x2709e7){var _0x405e62=_[_0x1ac4('0x32')](_0x2709e7)||_[_0x1ac4('0x33')](_0x2709e7)?_0x2709e7[_0x1ac4('0x34')]():_0x2709e7;return this[_0x1ac4('0x22')](util['format'](_0x1ac4('0x35'),_0x10815c,_0x405e62?_0x405e62[_0x1ac4('0x34')]()[_0x1ac4('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x36')]=function(_0x26546e,_0x41a9c3){return this['sendRequest'](util['format'](_0x1ac4('0x37'),_0x26546e,_0x41a9c3));};AGIChannel[_0x1ac4('0x21')]['sayDigits']=function(_0x4c45ac,_0x593635){return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')](_0x1ac4('0x38'),_0x4c45ac,_0x593635));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x39')]=function(_0x41af65,_0x3df778){return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')](_0x1ac4('0x3a'),_0x41af65,_0x3df778));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x3b')]=function(_0x65460d,_0x4ba469,_0x2c724b){_0x4ba469=_0x4ba469||this[_0x1ac4('0x3c')];_0x2c724b=_0x2c724b||0x1;this[_0x1ac4('0x2b')](_0x65460d);this[_0x1ac4('0x2d')](_0x4ba469);this[_0x1ac4('0x2f')](_0x2c724b);return this['noop'](util['format'](_0x1ac4('0x3d'),_0x65460d,_0x4ba469,_0x2c724b));};AGIChannel[_0x1ac4('0x21')]['getVariable']=function(_0x21cec8){return this['sendRequest'](util[_0x1ac4('0x26')]('GET\x20VARIABLE\x20\x22%s\x22',_0x21cec8));};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x3e')]=function(_0x2758a9,_0x3e21a3,_0x3daaaa,_0x39adae,_0x2cbfd4,_0x256f69){_0x3e21a3=_0x3e21a3||_0x1ac4('0x3f');_0x3daaaa=_0x3daaaa||'';_0x39adae=_0x39adae===undefined?-0x1:_0x39adae==='-1'?-0x1:_0x39adae*0x3e8;_0x2cbfd4=_0x2cbfd4===undefined?'':'s='+_0x2cbfd4;_0x256f69=_0x256f69?'BEEP':'';return this[_0x1ac4('0x22')](util['format'](_0x1ac4('0x40'),_0x2758a9,_0x3e21a3,_0x3daaaa,_0x39adae,_0x256f69,_0x2cbfd4));};AGIChannel['prototype'][_0x1ac4('0x41')]=function(_0x2cd49b,_0x309bc5){_0x309bc5=_0x309bc5||'';return this[_0x1ac4('0x22')](util[_0x1ac4('0x26')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x2cd49b,_0x309bc5));};AGIChannel['prototype'][_0x1ac4('0x42')]=function(_0x5d97ab){return this[_0x1ac4('0x43')](_0x1ac4('0x44'),_0x5d97ab);};AGIChannel[_0x1ac4('0x21')]['wait']=function(_0xfbb44d){return this[_0x1ac4('0x43')](_0x1ac4('0x45'),_0xfbb44d);};AGIChannel[_0x1ac4('0x21')][_0x1ac4('0x19')]=function(_0x272b83,_0x244569){this['noop'](util[_0x1ac4('0x26')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x272b83['id'],_0x272b83[_0x1ac4('0x46')],_0x244569));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1ac4('0x47')]=AGIChannel; \ No newline at end of file +var _0x5e0e=['ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','WAIT','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout'];(function(_0x204a74,_0x11172d){var _0x4695ba=function(_0x4038f1){while(--_0x4038f1){_0x204a74['push'](_0x204a74['shift']());}};_0x4695ba(++_0x11172d);}(_0x5e0e,0x89));var _0xe5e0=function(_0x5a9017,_0x4312fc){_0x5a9017=_0x5a9017-0x0;var _0x596e52=_0x5e0e[_0x5a9017];return _0x596e52;};'use strict';var util=require(_0xe5e0('0x0'));var _=require(_0xe5e0('0x1'));var EventEmitter=require('events')[_0xe5e0('0x2')];var AGIReply=require(_0xe5e0('0x3'));var AGIError=require(_0xe5e0('0x4'));function AGIChannel(_0x362ce7){var _0x270315=this,_0x5d2107=new AGIReply(),_0x22cd07=![],_0x52407b={};EventEmitter[_0xe5e0('0x5')](_0x270315);_0x362ce7[_0xe5e0('0x6')](_0xe5e0('0x7'));_0x362ce7[_0xe5e0('0x8')](0x8*0x3c*0x3c*0x3e8);_0x5d2107[_0xe5e0('0x6')](_0xe5e0('0x7'));_0x5d2107['on']('headers',function(_0x4059cf){for(var _0x29199a in _0x4059cf){_0x270315[_0x29199a]=_0x4059cf[_0x29199a];}_0x270315['emit'](_0xe5e0('0x9'));});_0x5d2107['on'](_0xe5e0('0xa'),function(_0x189f5c){if(_0x189f5c[_0xe5e0('0xb')]()==_0xe5e0('0xc')){_0x270315[_0xe5e0('0xd')](_0xe5e0('0xc'));return;}if(_0x189f5c[_0xe5e0('0xe')](0x0,0xb)==_0xe5e0('0xf')){_0x22cd07=!![];}if(_0x22cd07){_0x52407b['rx']+=_0x189f5c+'\x0a';if(_0x189f5c[_0xe5e0('0x10')](_0xe5e0('0x11'))!=-0x1){_0x22cd07=![];}}else{_0x52407b['rx']=_0x189f5c;}if(_0x22cd07){return;}if(typeof _0x52407b['cb']==_0xe5e0('0x12')){var _0x25fd2=_0x52407b['rx'][_0xe5e0('0xe')](0x0,0x3),_0x529189=null,_0x5cabeb=null;_0x25fd2=parseInt(_0x25fd2);if(isNaN(_0x25fd2)){_0x52407b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe5e0('0x13')});return;}if(_0x25fd2!=0xc8){_0x52407b['cb'](null,{'code':_0x25fd2,'result':-0x1,'extra':'KO'});return;}_0x529189=_0x52407b['rx'][_0xe5e0('0xe')](0x4)[_0xe5e0('0x14')]('result=','');if(_0x529189[_0xe5e0('0x15')]('\x20')!=-0x1){_0x529189=_0x529189[_0xe5e0('0x16')](0x0,_0x529189[_0xe5e0('0x15')]('\x20'));}if(_[_0xe5e0('0x17')](_0x529189,'-1')){_0x529189=parseInt(_0x529189);}_0x5cabeb=_0x52407b['rx'][_0xe5e0('0x18')]('\x20');if(_0x5cabeb[_0xe5e0('0x19')]==0x3){_0x5cabeb=_0x5cabeb[0x2][_0xe5e0('0xe')](0x1,_0x5cabeb[0x2][_0xe5e0('0x19')]-0x1);}else if(_0x5cabeb[_0xe5e0('0x19')]>0x3){var _0x501795=/\((.+)\)/;var _0x1e1ffa=_0x52407b['rx']['match'](_0x501795);if(_0x1e1ffa){_0x5cabeb=_0x1e1ffa[0x1];}else{_0x5cabeb=null;}}else{_0x5cabeb=null;}_0x52407b['cb'](null,{'code':_0x25fd2,'result':_0x529189,'extra':_0x5cabeb});}});_0x362ce7['on'](_0xe5e0('0x1a'),function(_0x4e7353){_0x270315[_0xe5e0('0xd')](_0xe5e0('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x4e7353[_0xe5e0('0x1b')]));});_0x362ce7['on']('close',function(){_0x270315[_0xe5e0('0xd')](_0xe5e0('0x1c'),new AGIError(_0xe5e0('0x1d')));});_0x362ce7['on'](_0xe5e0('0x1e'),function(){_0x270315[_0xe5e0('0xd')](_0xe5e0('0x1e'),new AGIError(_0xe5e0('0x1f')));_0x362ce7[_0xe5e0('0x20')]();});_0x362ce7[_0xe5e0('0x21')](_0x5d2107);this[_0xe5e0('0x22')]=function(_0x2f08dc,_0x2de764){var _0x2f08dc=_0x2f08dc||'',_0x2de764=typeof _0x2de764=='function'?_0x2de764:new Function();_0x52407b={'tx':_0x2f08dc,'rx':'','cb':_0x2de764};_0x362ce7[_0xe5e0('0x23')](_0x2f08dc+'\x0a');},this[_0xe5e0('0x1c')]=function(){_0x362ce7[_0xe5e0('0x20')]();};}util[_0xe5e0('0x24')](AGIChannel,EventEmitter);AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x26')]=function(_0x2da6fb){return this['command'][_0xe5e0('0x27')](this,_0x2da6fb);};AGIChannel['prototype'][_0xe5e0('0x28')]=function(){return this[_0xe5e0('0x26')](_0xe5e0('0x29'));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x2a')]=function(_0x4867f2,_0x55bd0a,_0x25fe90){_0x4867f2=_0x4867f2===undefined?'beep':_0x4867f2;_0x55bd0a=_0x55bd0a===undefined?'5':_0x55bd0a;_0x25fe90=_0x25fe90===undefined?'1':_0x25fe90;return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x2c'),_0x4867f2,_0x55bd0a*0x3e8,_0x25fe90));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x2d')]=function(_0x198b94){_0x198b94=_0x198b94||'NO\x20MESSAGE';return this[_0xe5e0('0x26')](util['format'](_0xe5e0('0x2e'),_0x198b94));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x2f')]=function(_0x547e28,_0x1d7cb4){if(_[_0xe5e0('0x30')](_0x1d7cb4)){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x31'),_0x547e28,_0x1d7cb4['join'](',')));}return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x31'),_0x547e28,_0x1d7cb4));};AGIChannel[_0xe5e0('0x25')]['setContext']=function(_0x55e1ff){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x32'),_0x55e1ff));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x33')]=function(_0x28eca7){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x34'),_0x28eca7));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x35')]=function(_0x463e09){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x36'),_0x463e09));};AGIChannel['prototype']['hangup']=function(){return this[_0xe5e0('0x26')](_0xe5e0('0x37'));};AGIChannel[_0xe5e0('0x25')]['setVariable']=function(_0x2fc0f6,_0x1a18fe){var _0x1dc59a=_['isBoolean'](_0x1a18fe)||_[_0xe5e0('0x38')](_0x1a18fe)?_0x1a18fe[_0xe5e0('0x39')]():_0x1a18fe;return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x2fc0f6,_0x1dc59a?_0x1dc59a[_0xe5e0('0x39')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe5e0('0x25')]['sayNumber']=function(_0xca4165,_0x54f1d1){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')]('SAY\x20NUMBER\x20%s\x20%s',_0xca4165,_0x54f1d1));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x3a')]=function(_0x1eddf9,_0x10ad9b){return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x3b'),_0x1eddf9,_0x10ad9b));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x3c')]=function(_0x1e7711,_0x212f8b){return this['sendRequest'](util[_0xe5e0('0x2b')](_0xe5e0('0x3d'),_0x1e7711,_0x212f8b));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x3e')]=function(_0x34fcaf,_0x5adf06,_0x27d189){_0x5adf06=_0x5adf06||this[_0xe5e0('0x3f')];_0x27d189=_0x27d189||0x1;this[_0xe5e0('0x40')](_0x34fcaf);this[_0xe5e0('0x33')](_0x5adf06);this['setPriority'](_0x27d189);return this[_0xe5e0('0x2d')](util[_0xe5e0('0x2b')](_0xe5e0('0x41'),_0x34fcaf,_0x5adf06,_0x27d189));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x42')]=function(_0x47dcd4){return this[_0xe5e0('0x26')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x47dcd4));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x43')]=function(_0x3e3b7c,_0x365e4e,_0x3cc8b6,_0x556602,_0x31535d,_0x3d8f92){_0x365e4e=_0x365e4e||'wav';_0x3cc8b6=_0x3cc8b6||'';_0x556602=_0x556602===undefined?-0x1:_0x556602==='-1'?-0x1:_0x556602*0x3e8;_0x31535d=_0x31535d===undefined?'':'s='+_0x31535d;_0x3d8f92=_0x3d8f92?'BEEP':'';return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')](_0xe5e0('0x44'),_0x3e3b7c,_0x365e4e,_0x3cc8b6,_0x556602,_0x3d8f92,_0x31535d));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x45')]=function(_0x4f81bb,_0x145d6c){_0x145d6c=_0x145d6c||'';return this[_0xe5e0('0x26')](util[_0xe5e0('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4f81bb,_0x145d6c));};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x46')]=function(_0x12ba02){return this['exec']('AGI',_0x12ba02);};AGIChannel[_0xe5e0('0x25')]['wait']=function(_0x3084ff){return this[_0xe5e0('0x2f')](_0xe5e0('0x47'),_0x3084ff);};AGIChannel[_0xe5e0('0x25')][_0xe5e0('0x1a')]=function(_0x2138ae,_0x38fd91){this[_0xe5e0('0x2d')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x2138ae['id'],_0x2138ae['label'],_0x38fd91));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe5e0('0x48')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 17e7611..b985bef 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 _0x55e8=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x2ceedb,_0x3d4af3){var _0x1eef5c=function(_0xee38c1){while(--_0xee38c1){_0x2ceedb['push'](_0x2ceedb['shift']());}};_0x1eef5c(++_0x3d4af3);}(_0x55e8,0x80));var _0x855e=function(_0x3ad8ec,_0x1a23d7){_0x3ad8ec=_0x3ad8ec-0x0;var _0x2c1275=_0x55e8[_0x3ad8ec];return _0x2c1275;};'use strict';var util=require(_0x855e('0x0'));var error={'E_AGI_UNDEFINED':_0x855e('0x1'),'E_AGI_ARGUMENT_PORT':_0x855e('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x855e('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x855e('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x855e('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x855e('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x855e('0x7'),'E_AGI_COMMAND_EMPTY':_0x855e('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x855e('0x9')};function AGIError(_0x694be2){var _0x694be2=_0x694be2||null,_0x418927=_0x418927||[],_0x5ddb72=0x1,_0x3b8f05='';if(!error[_0x694be2]){_0x694be2=_0x855e('0xa');}_0x418927[_0x855e('0xb')](error[_0x694be2]);while(arguments[_0x5ddb72]){_0x418927['push'](arguments[_0x5ddb72]);_0x5ddb72++;}_0x3b8f05=util[_0x855e('0xc')]['apply'](util,_0x418927);this[_0x855e('0xd')]=_0x3b8f05;this[_0x855e('0xe')]=_0x694be2;}module[_0x855e('0xf')]=AGIError; \ No newline at end of file +var _0x3fdc=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x3fdc,0x1d8));var _0xc3fd=function(_0x1d0010,_0x5e9011){_0x1d0010=_0x1d0010-0x0;var _0x750311=_0x3fdc[_0x1d0010];return _0x750311;};'use strict';var util=require(_0xc3fd('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xc3fd('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xc3fd('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc3fd('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xc3fd('0x4'),'E_AGI_SOCKET_ERROR':_0xc3fd('0x5'),'E_AGI_SOCKET_CLOSE':_0xc3fd('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xc3fd('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc3fd('0x8'),'E_AGI_IVR_ENTRY':_0xc3fd('0x9')};function AGIError(_0xb0f5f8){var _0xb0f5f8=_0xb0f5f8||null,_0xc21519=_0xc21519||[],_0xa3446a=0x1,_0xd14ffa='';if(!error[_0xb0f5f8]){_0xb0f5f8='E_AGI_UNDEFINED';}_0xc21519[_0xc3fd('0xa')](error[_0xb0f5f8]);while(arguments[_0xa3446a]){_0xc21519[_0xc3fd('0xa')](arguments[_0xa3446a]);_0xa3446a++;}_0xd14ffa=util[_0xc3fd('0xb')][_0xc3fd('0xc')](util,_0xc21519);this['message']=_0xd14ffa;this[_0xc3fd('0xd')]=_0xb0f5f8;}module[_0xc3fd('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index e4a620a..7ab1aa6 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 _0xe334=['addEdge','push','size','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xe334,0x1aa));var _0x4e33=function(_0x2723ee,_0xcce3ae){_0x2723ee=_0x2723ee-0x0;var _0x2b1b4e=_0xe334[_0x2723ee];return _0x2b1b4e;};'use strict';var _=require('lodash');var logger=require(_0x4e33('0x0'))(_0x4e33('0x1'));var verticesWithRetry=[_0x4e33('0x2'),_0x4e33('0x3'),_0x4e33('0x4')];var Graph=function(){this[_0x4e33('0x5')]={};this[_0x4e33('0x6')]={};this[_0x4e33('0x7')]=0x0;};Graph[_0x4e33('0x8')]['addVertex']=function(_0x32fb30){this[_0x4e33('0x5')][_0x32fb30['id']]=_0x32fb30;this[_0x4e33('0x6')][_0x32fb30['id']]=[];};Graph['prototype'][_0x4e33('0x9')]=function(_0x4ba096,_0x4b1b97,_0x4c3cd9){this[_0x4e33('0x6')][_0x4ba096][_0x4e33('0xa')]({'target':_0x4b1b97,'condition':_0x4c3cd9});this['numberOfEdges']+=0x1;};Graph[_0x4e33('0x8')][_0x4e33('0xb')]=function(){return _['size'](this['vertices']);};Graph[_0x4e33('0x8')]['relations']=function(){return this[_0x4e33('0x7')];};Graph[_0x4e33('0x8')]['getVertex']=function(_0x1ec15a){return this[_0x4e33('0x5')][_0x1ec15a];};Graph['prototype'][_0x4e33('0xc')]=function(_0x2613e2,_0x3e9417){if(!this[_0x4e33('0x5')][_0x2613e2]){return logger['info'](_0x4e33('0xd'));}var _0x5183f8=_0x3e9417(this[_0x4e33('0x5')][_0x2613e2]);if(!_0x5183f8){return logger[_0x4e33('0xe')](_0x4e33('0xf'));}if(this[_0x4e33('0x6')][_0x2613e2][_0x4e33('0x10')]===0x0){return logger[_0x4e33('0xe')](_0x4e33('0x11'));}for(var _0x216b93=0x0,_0x303ec6=[],_0x24d188=![];_0x216b93\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','root','agicommand','retry','addVertex','omit','hasOwnProperty','isArray','length','target','addEdge','source','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','timeout','hangup','production','start','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','toString','agicommand\x20not\x20found','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','util'];(function(_0x2099ee,_0x493770){var _0x730b29=function(_0x332009){while(--_0x332009){_0x2099ee['push'](_0x2099ee['shift']());}};_0x730b29(++_0x493770);}(_0xbb14,0x165));var _0x4bb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb14[_0x501510];return _0x1e6ee5;};'use strict';var parser=require(_0x4bb1('0x0'));var _=require(_0x4bb1('0x1'));var syncho=require('syncho');var util=require(_0x4bb1('0x2'));var moment=require('moment');var config=require(_0x4bb1('0x3'));var logger=require('../../config/logger')(_0x4bb1('0x4'));var utilLicense=require(_0x4bb1('0x5'));var rpc=require(_0x4bb1('0x6'));var mailRpc=require(_0x4bb1('0x7'));var Graph=require('./graph');var Vertices=require(_0x4bb1('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x4bb1('0x4')]=_[_0x4bb1('0x9')](config[_0x4bb1('0x4')],{'ip':_0x4bb1('0xa'),'port':0x11dd});function connectionHandler(_0x4971fe){process[_0x4bb1('0xb')](function(){syncho(function(){try{setChannelVariables(_0x4971fe);agiHandler(_0x4971fe);}catch(_0xdf9cd4){logger[_0x4bb1('0xc')](_0xdf9cd4[_0x4bb1('0xd')]);}});});}function listeningHandler(){console[_0x4bb1('0xe')](_0x4bb1('0xf'),config['agi'][_0x4bb1('0x10')]);logger[_0x4bb1('0x11')](util[_0x4bb1('0x12')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config[_0x4bb1('0x4')]['port']));}function errorHandler(_0x23a37e){if(_0x23a37e&&_0x23a37e['name']&&_0x23a37e[_0x4bb1('0x13')]){logger[_0x4bb1('0xc')](util[_0x4bb1('0x12')]('[%s]\x20%s',_0x23a37e[_0x4bb1('0x14')],_0x23a37e[_0x4bb1('0x13')]));}else{logger[_0x4bb1('0xc')](util[_0x4bb1('0x12')](_0x4bb1('0x15'),_0x23a37e[_0x4bb1('0xd')]));}}function closeHandler(){logger[_0x4bb1('0x11')](util[_0x4bb1('0x12')](_0x4bb1('0x16'),this[_0x4bb1('0x17')],this[_0x4bb1('0x18')],this['callerid'],this['dnid'],this[_0x4bb1('0x19')]));try{createSquareReport(this);}catch(_0x33e426){logger['error'](_0x33e426[_0x4bb1('0xd')]);}}function timeoutHandler(){logger['info'](util['format'](_0x4bb1('0x1a'),this[_0x4bb1('0x17')],this[_0x4bb1('0x18')],this['callerid'],this[_0x4bb1('0x1b')],this[_0x4bb1('0x19')]));}function hangupHandler(){logger['info'](util[_0x4bb1('0x12')](_0x4bb1('0x1c'),this[_0x4bb1('0x17')],this[_0x4bb1('0x18')],this[_0x4bb1('0x1d')],this[_0x4bb1('0x1b')],this[_0x4bb1('0x19')]));this[_0x4bb1('0x1e')]=!![];}function getRoot(_0x17bdcc){return parser['toJson'](_0x17bdcc,{'object':!![]})['mxGraphModel'][_0x4bb1('0x1f')];}function addVertex(_0x296dc9,_0x4e5aeb,_0x3f50cc){_0x4e5aeb[_0x4bb1('0x20')]=_0x3f50cc;if(_0x4e5aeb['hasOwnProperty'](_0x4bb1('0x21'))){_0x4e5aeb['maxRetry']=parseInt(_0x4e5aeb['retry'],0xa);}_0x296dc9[_0x4bb1('0x22')](_[_0x4bb1('0x23')](_0x4e5aeb,'mxCell'));}function initGraph(_0x1d57ad,_0x2272bf){var _0x3369ad=new Graph();for(var _0x2c9a44 in _0x1d57ad){if(_0x1d57ad[_0x4bb1('0x24')](_0x2c9a44)){if(_[_0x4bb1('0x25')](_0x1d57ad[_0x2c9a44])){for(var _0x2b20de=0x0;_0x2b20de<_0x1d57ad[_0x2c9a44][_0x4bb1('0x26')];_0x2b20de+=0x1){addVertex(_0x3369ad,_0x1d57ad[_0x2c9a44][_0x2b20de],_0x2c9a44);}}else{addVertex(_0x3369ad,_0x1d57ad[_0x2c9a44],_0x2c9a44);}}}for(var _0x209dd6=0x0;_0x209dd6<_0x2272bf[_0x4bb1('0x26')];_0x209dd6+=0x1){if(_0x2272bf[_0x209dd6]['source']&&_0x2272bf[_0x209dd6][_0x4bb1('0x27')]){_0x3369ad[_0x4bb1('0x28')](_0x2272bf[_0x209dd6][_0x4bb1('0x29')],_0x2272bf[_0x209dd6][_0x4bb1('0x27')],_0x2272bf[_0x209dd6][_0x4bb1('0x2a')]);}}return _0x3369ad;}function getSquareProject(_0x4c6309,_0x3336e8){rpc[_0x4bb1('0x2b')](_0x4c6309)[_0x4bb1('0x2c')](function(_0x4e0bf1){_0x3336e8(null,_0x4e0bf1);})[_0x4bb1('0x2d')](function(_0x298e9a){_0x3336e8(null,_0x298e9a);});}function createSquareReport(_0xd81773,_0x47dc52){rpc[_0x4bb1('0x2e')](_0xd81773)[_0x4bb1('0x2c')](function(_0x352849){if(_0x47dc52){_0x47dc52(null,_0x352849);}})[_0x4bb1('0x2d')](function(_0x145362){if(_0x47dc52){_0x47dc52(null,_0x145362);}});}function setChannelVariables(_0x7d5eac){for(var _0x4aac9b in _0x7d5eac){if(_0x7d5eac[_0x4bb1('0x24')](_0x4aac9b)){if(_0x4aac9b[_0x4bb1('0x2f')](_0x4bb1('0x30'))===0x0){_0x7d5eac[_0x4aac9b[_0x4bb1('0x31')](0x4)]=_0x7d5eac[_0x4aac9b];delete _0x7d5eac[_0x4aac9b];}}}}function getLogFromObject(_0x4a3894){return util[_0x4bb1('0x32')](_0x4a3894,{'showHidden':![],'depth':null});}function agiHandler(_0x2aa794){var _0x2c8fa1,_0x5f3c3b,_0x9507da,_0x13ef33,_0x3904b8;logger[_0x4bb1('0x33')](_0x4bb1('0x34'),JSON[_0x4bb1('0x35')](_0x2aa794,null,0x2));logger['info'](util[_0x4bb1('0x12')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aa794[_0x4bb1('0x17')],_0x2aa794[_0x4bb1('0x18')],_0x2aa794[_0x4bb1('0x1d')],_0x2aa794['dnid'],_0x2aa794['uniqueid']));_0x2aa794['on'](_0x4bb1('0xc'),errorHandler);_0x2aa794['on']('close',closeHandler);_0x2aa794['on'](_0x4bb1('0x36'),timeoutHandler);_0x2aa794[_0x4bb1('0x1e')]=![];_0x2aa794['on'](_0x4bb1('0x37'),hangupHandler);var _0x3a6cdf=getSquareProject['sync'](null,_0x2aa794[_0x4bb1('0x17')]);if(_0x3a6cdf){if(_0x3a6cdf[_0x4bb1('0x38')]){_0x2c8fa1=getRoot(_0x3a6cdf[_0x4bb1('0x38')]);if(_0x2c8fa1&&_0x2c8fa1[_0x4bb1('0x39')]){logger['debug']('root',JSON['stringify'](_0x2c8fa1,null,0x2));_0x2aa794['joinAt']=moment()[_0x4bb1('0x12')](_0x4bb1('0x3a'));_0x5f3c3b=initGraph(_['omit'](_0x2c8fa1,_0x4bb1('0x3b')),_0x2c8fa1[_0x4bb1('0x3b')]);_0x9507da=new Vertices(_0x2aa794,rpc,mailRpc);logger[_0x4bb1('0x11')](util[_0x4bb1('0x12')](_0x4bb1('0x3c'),_0x2aa794[_0x4bb1('0x17')],_0x2aa794[_0x4bb1('0x18')],_0x2aa794[_0x4bb1('0x1d')],_0x2aa794[_0x4bb1('0x1b')],_0x2aa794[_0x4bb1('0x19')]));_0x5f3c3b['traverseBFS'](_0x2c8fa1['start']['id'],function(_0x21f954){try{_0x21f954=_0x9507da['clear'](_0x21f954);logger[_0x4bb1('0x33')](_0x4bb1('0x3d'),JSON['stringify'](_0x21f954,null,0x2));if(_0x21f954[_0x4bb1('0x20')]===_0x4bb1('0x3e')){logger['info'](_0x4bb1('0x3f'));_0x2aa794[_0x4bb1('0x40')]=_0x21f954[_0x4bb1('0x40')]||_0x2aa794[_0x4bb1('0x40')];_0x2aa794[_0x4bb1('0x41')]=_0x21f954[_0x4bb1('0x41')];_0x2aa794[_0x4bb1('0x42')]=_0x21f954[_0x4bb1('0x42')]?_0x21f954['priority']-0x1:0x1;return null;}else if(_0x21f954&&_0x9507da[_0x21f954[_0x4bb1('0x20')]]){_0x3904b8=_0x9507da[_0x21f954['agicommand']](_0x21f954);logger[_0x4bb1('0x11')](_0x4bb1('0x43'),JSON[_0x4bb1('0x35')](_0x3904b8,null,0x2));if(_0x3904b8&&_0x3904b8[_0x4bb1('0x44')]===AGI_CODE_SUCCESS&&_0x3904b8['result']!==AGI_RESULT_ERROR&&!_0x2aa794[_0x4bb1('0x1e')]){logger[_0x4bb1('0x33')](_0x4bb1('0x43'),getLogFromObject(_0x3904b8));return _[_0x4bb1('0x45')](_0x3904b8[_0x4bb1('0x46')])?null:_0x3904b8[_0x4bb1('0x46')]['toString']();}else{logger[_0x4bb1('0xc')](_0x4bb1('0x43'),getLogFromObject(_0x3904b8));return null;}}else{logger[_0x4bb1('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x40dc94){logger[_0x4bb1('0xc')](_0x40dc94[_0x4bb1('0xd')]);return null;}});if(_0x2c8fa1[_0x4bb1('0x47')]){logger['info'](util[_0x4bb1('0x12')](_0x4bb1('0x48'),_0x2aa794[_0x4bb1('0x17')],_0x2aa794[_0x4bb1('0x18')],_0x2aa794[_0x4bb1('0x1d')],_0x2aa794[_0x4bb1('0x1b')],_0x2aa794[_0x4bb1('0x19')]));_0x5f3c3b[_0x4bb1('0x49')](_0x2c8fa1[_0x4bb1('0x47')]['id'],function(_0x46a4e2){try{_0x46a4e2=_0x9507da[_0x4bb1('0x4a')](_0x46a4e2);logger[_0x4bb1('0x33')](_0x4bb1('0x3d'),JSON['stringify'](_0x46a4e2,null,0x2));if(_0x46a4e2&&_0x9507da[_0x46a4e2[_0x4bb1('0x20')]]){_0x3904b8=_0x9507da[_0x46a4e2[_0x4bb1('0x20')]](_0x46a4e2);if(_0x3904b8){logger['debug']('response',getLogFromObject(_0x3904b8));return _['isUndefined'](_0x3904b8['result'])?null:_0x3904b8[_0x4bb1('0x46')][_0x4bb1('0x4b')]();}else{logger[_0x4bb1('0xc')]('response',getLogFromObject(_0x3904b8));return null;}}else{logger['error'](_0x4bb1('0x4c'));return null;}}catch(_0x571333){logger[_0x4bb1('0xc')](_0x571333[_0x4bb1('0xd')]);return null;}});}logger[_0x4bb1('0x11')](util[_0x4bb1('0x12')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x2aa794[_0x4bb1('0x17')],_0x2aa794[_0x4bb1('0x18')],_0x2aa794[_0x4bb1('0x1d')],_0x2aa794[_0x4bb1('0x1b')],_0x2aa794['uniqueid']));logger[_0x4bb1('0x11')](util['format'](_0x4bb1('0x4d'),_0x2aa794['context'],_0x2aa794['extension'],parseInt(_0x2aa794['priority'],0xa)+0x1));_0x2aa794[_0x4bb1('0x4e')](_0x2aa794['context'],_0x2aa794[_0x4bb1('0x41')],parseInt(_0x2aa794[_0x4bb1('0x42')],0xa)+0x1);_0x2aa794['close']();}}else{logger[_0x4bb1('0xc')](util[_0x4bb1('0x12')]('Project\x20%s\x20not\x20published',_0x2aa794['arg_1']));_0x2aa794[_0x4bb1('0x4e')](_0x2aa794['context'],_0x2aa794['extension'],parseInt(_0x2aa794[_0x4bb1('0x42')],0xa)+0x1);_0x2aa794[_0x4bb1('0x4f')]();}}else{logger[_0x4bb1('0xc')](util[_0x4bb1('0x12')](_0x4bb1('0x50'),_0x2aa794[_0x4bb1('0x17')]));_0x2aa794[_0x4bb1('0x4e')](_0x2aa794[_0x4bb1('0x40')],_0x2aa794[_0x4bb1('0x41')],parseInt(_0x2aa794[_0x4bb1('0x42')],0xa)+0x1);_0x2aa794[_0x4bb1('0x4f')]();}}function main(){var _0x589b08;return utilLicense[_0x4bb1('0x51')]()[_0x4bb1('0x2c')](function(_0x51899b){if(_0x51899b){if(_0x51899b[_0x4bb1('0x52')]){if(_0x51899b[_0x4bb1('0x53')]&&_0x51899b[_0x4bb1('0x53')]>0x0){logger[_0x4bb1('0x11')](util[_0x4bb1('0x12')](_0x4bb1('0x54'),_0x51899b[_0x4bb1('0x53')]));_0x589b08=_0x51899b['callysquare'];}else{logger[_0x4bb1('0x11')](_0x4bb1('0x55'));}}else{logger[_0x4bb1('0x11')](_0x4bb1('0x56'));_0x589b08=-0x1;}}})['catch'](function(_0x2913fe){logger[_0x4bb1('0xc')](_0x4bb1('0x57'),_0x2913fe['stack']);})[_0x4bb1('0x47')](function(){var _0x9d0f8=require(_0x4bb1('0x58'))(config[_0x4bb1('0x4')][_0x4bb1('0x10')],config[_0x4bb1('0x4')]['ip'],_0x589b08);_0x9d0f8['on']('error',errorHandler);_0x9d0f8['on'](_0x4bb1('0x59'),listeningHandler);_0x9d0f8['on']('connection',connectionHandler);_0x9d0f8['on'](_0x4bb1('0x4f'),closeHandler);});}main(); \ No newline at end of file +var _0x18e5=['length','target','addEdge','source','getSquareProject','then','catch','indexOf','agi_','substring','inspect','variables','stringify','close','timeout','sync','production','start','joinAt','traverseBFS','clear','gotoc','context','extension','priority','agicommand','response','code','debug','result','toString','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','connection','xml2json','syncho','util','moment','../../config/environment','agi','./mailRpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','stack','calleridname','dnid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','evtHangup','toJson','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray'];(function(_0x54a549,_0x1d5be3){var _0x222d56=function(_0x6e927e){while(--_0x6e927e){_0x54a549['push'](_0x54a549['shift']());}};_0x222d56(++_0x1d5be3);}(_0x18e5,0x12f));var _0x518e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x18e5[_0x19e35c];return _0x3e1fe8;};'use strict';var parser=require(_0x518e('0x0'));var _=require('lodash');var syncho=require(_0x518e('0x1'));var util=require(_0x518e('0x2'));var moment=require(_0x518e('0x3'));var config=require(_0x518e('0x4'));var logger=require('../../config/logger')(_0x518e('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0x518e('0x6'));var Graph=require(_0x518e('0x7'));var Vertices=require(_0x518e('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x518e('0x5')]=_[_0x518e('0x9')](config['agi'],{'ip':_0x518e('0xa'),'port':0x11dd});function connectionHandler(_0x3ca09f){process[_0x518e('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3ca09f);agiHandler(_0x3ca09f);}catch(_0x41fe42){logger[_0x518e('0xc')](_0x41fe42['stack']);}});});}function listeningHandler(){console[_0x518e('0xd')](_0x518e('0xe'),config['agi'][_0x518e('0xf')]);logger[_0x518e('0x10')](util[_0x518e('0x11')](_0x518e('0x12'),config[_0x518e('0x5')]['ip'],config[_0x518e('0x5')][_0x518e('0xf')]));}function errorHandler(_0x13bca1){if(_0x13bca1&&_0x13bca1[_0x518e('0x13')]&&_0x13bca1[_0x518e('0x14')]){logger[_0x518e('0xc')](util[_0x518e('0x11')](_0x518e('0x15'),_0x13bca1['name'],_0x13bca1[_0x518e('0x14')]));}else{logger['error'](util[_0x518e('0x11')](_0x518e('0x16'),_0x13bca1[_0x518e('0x17')]));}}function closeHandler(){logger[_0x518e('0x10')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x518e('0x18')],this['callerid'],this[_0x518e('0x19')],this[_0x518e('0x1a')]));try{createSquareReport(this);}catch(_0x45f95d){logger[_0x518e('0xc')](_0x45f95d[_0x518e('0x17')]);}}function timeoutHandler(){logger[_0x518e('0x10')](util[_0x518e('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x518e('0x1b')],this[_0x518e('0x18')],this['callerid'],this['dnid'],this[_0x518e('0x1a')]));}function hangupHandler(){logger[_0x518e('0x10')](util['format'](_0x518e('0x1c'),this['arg_1'],this[_0x518e('0x18')],this[_0x518e('0x1d')],this['dnid'],this['uniqueid']));this[_0x518e('0x1e')]=!![];}function getRoot(_0x299175){return parser[_0x518e('0x1f')](_0x299175,{'object':!![]})[_0x518e('0x20')][_0x518e('0x21')];}function addVertex(_0x219137,_0x5bc1f5,_0x18de90){_0x5bc1f5['agicommand']=_0x18de90;if(_0x5bc1f5[_0x518e('0x22')](_0x518e('0x23'))){_0x5bc1f5[_0x518e('0x24')]=parseInt(_0x5bc1f5['retry'],0xa);}_0x219137[_0x518e('0x25')](_[_0x518e('0x26')](_0x5bc1f5,_0x518e('0x27')));}function initGraph(_0x3471dc,_0x138071){var _0x2da64f=new Graph();for(var _0x1920f5 in _0x3471dc){if(_0x3471dc[_0x518e('0x22')](_0x1920f5)){if(_[_0x518e('0x28')](_0x3471dc[_0x1920f5])){for(var _0x1d7b1d=0x0;_0x1d7b1d<_0x3471dc[_0x1920f5][_0x518e('0x29')];_0x1d7b1d+=0x1){addVertex(_0x2da64f,_0x3471dc[_0x1920f5][_0x1d7b1d],_0x1920f5);}}else{addVertex(_0x2da64f,_0x3471dc[_0x1920f5],_0x1920f5);}}}for(var _0x2c8aa9=0x0;_0x2c8aa9<_0x138071['length'];_0x2c8aa9+=0x1){if(_0x138071[_0x2c8aa9]['source']&&_0x138071[_0x2c8aa9][_0x518e('0x2a')]){_0x2da64f[_0x518e('0x2b')](_0x138071[_0x2c8aa9][_0x518e('0x2c')],_0x138071[_0x2c8aa9][_0x518e('0x2a')],_0x138071[_0x2c8aa9]['value']);}}return _0x2da64f;}function getSquareProject(_0x372676,_0x4aadae){rpc[_0x518e('0x2d')](_0x372676)[_0x518e('0x2e')](function(_0x4800b8){_0x4aadae(null,_0x4800b8);})[_0x518e('0x2f')](function(_0x5f4cb5){_0x4aadae(null,_0x5f4cb5);});}function createSquareReport(_0x39c5e7,_0x1605ca){rpc['createSquareReport'](_0x39c5e7)[_0x518e('0x2e')](function(_0x50645a){if(_0x1605ca){_0x1605ca(null,_0x50645a);}})[_0x518e('0x2f')](function(_0x340611){if(_0x1605ca){_0x1605ca(null,_0x340611);}});}function setChannelVariables(_0x59909c){for(var _0x346bfd in _0x59909c){if(_0x59909c[_0x518e('0x22')](_0x346bfd)){if(_0x346bfd[_0x518e('0x30')](_0x518e('0x31'))===0x0){_0x59909c[_0x346bfd[_0x518e('0x32')](0x4)]=_0x59909c[_0x346bfd];delete _0x59909c[_0x346bfd];}}}}function getLogFromObject(_0x3fdb1d){return util[_0x518e('0x33')](_0x3fdb1d,{'showHidden':![],'depth':null});}function agiHandler(_0x514ed1){var _0x5c3e45,_0x314d2a,_0x34816b,_0x1c2fa5,_0x41df7a;logger['debug'](_0x518e('0x34'),JSON[_0x518e('0x35')](_0x514ed1,null,0x2));logger[_0x518e('0x10')](util[_0x518e('0x11')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x514ed1[_0x518e('0x1b')],_0x514ed1[_0x518e('0x18')],_0x514ed1['callerid'],_0x514ed1[_0x518e('0x19')],_0x514ed1[_0x518e('0x1a')]));_0x514ed1['on'](_0x518e('0xc'),errorHandler);_0x514ed1['on'](_0x518e('0x36'),closeHandler);_0x514ed1['on'](_0x518e('0x37'),timeoutHandler);_0x514ed1[_0x518e('0x1e')]=![];_0x514ed1['on']('hangup',hangupHandler);var _0x3c8caf=getSquareProject[_0x518e('0x38')](null,_0x514ed1[_0x518e('0x1b')]);if(_0x3c8caf){if(_0x3c8caf[_0x518e('0x39')]){_0x5c3e45=getRoot(_0x3c8caf['production']);if(_0x5c3e45&&_0x5c3e45[_0x518e('0x3a')]){logger['debug']('root',JSON[_0x518e('0x35')](_0x5c3e45,null,0x2));_0x514ed1[_0x518e('0x3b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x314d2a=initGraph(_[_0x518e('0x26')](_0x5c3e45,_0x518e('0x27')),_0x5c3e45[_0x518e('0x27')]);_0x34816b=new Vertices(_0x514ed1,rpc,mailRpc);logger[_0x518e('0x10')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x514ed1['arg_1'],_0x514ed1['calleridname'],_0x514ed1[_0x518e('0x1d')],_0x514ed1[_0x518e('0x19')],_0x514ed1['uniqueid']));_0x314d2a[_0x518e('0x3c')](_0x5c3e45[_0x518e('0x3a')]['id'],function(_0x370442){try{_0x370442=_0x34816b[_0x518e('0x3d')](_0x370442);logger['debug']('vertex',JSON[_0x518e('0x35')](_0x370442,null,0x2));if(_0x370442['agicommand']===_0x518e('0x3e')){logger[_0x518e('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x514ed1['context']=_0x370442[_0x518e('0x3f')]||_0x514ed1[_0x518e('0x3f')];_0x514ed1[_0x518e('0x40')]=_0x370442['extension'];_0x514ed1[_0x518e('0x41')]=_0x370442[_0x518e('0x41')]?_0x370442[_0x518e('0x41')]-0x1:0x1;return null;}else if(_0x370442&&_0x34816b[_0x370442[_0x518e('0x42')]]){_0x41df7a=_0x34816b[_0x370442[_0x518e('0x42')]](_0x370442);logger[_0x518e('0x10')](_0x518e('0x43'),JSON[_0x518e('0x35')](_0x41df7a,null,0x2));if(_0x41df7a&&_0x41df7a[_0x518e('0x44')]===AGI_CODE_SUCCESS&&_0x41df7a['result']!==AGI_RESULT_ERROR&&!_0x514ed1[_0x518e('0x1e')]){logger[_0x518e('0x45')](_0x518e('0x43'),getLogFromObject(_0x41df7a));return _['isUndefined'](_0x41df7a['result'])?null:_0x41df7a[_0x518e('0x46')][_0x518e('0x47')]();}else{logger[_0x518e('0xc')](_0x518e('0x43'),getLogFromObject(_0x41df7a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4bb5b7){logger['error'](_0x4bb5b7['stack']);return null;}});if(_0x5c3e45['finally']){logger[_0x518e('0x10')](util[_0x518e('0x11')](_0x518e('0x48'),_0x514ed1[_0x518e('0x1b')],_0x514ed1[_0x518e('0x18')],_0x514ed1[_0x518e('0x1d')],_0x514ed1[_0x518e('0x19')],_0x514ed1[_0x518e('0x1a')]));_0x314d2a['traverseBFS'](_0x5c3e45[_0x518e('0x49')]['id'],function(_0x308a2e){try{_0x308a2e=_0x34816b[_0x518e('0x3d')](_0x308a2e);logger[_0x518e('0x45')]('vertex',JSON['stringify'](_0x308a2e,null,0x2));if(_0x308a2e&&_0x34816b[_0x308a2e[_0x518e('0x42')]]){_0x41df7a=_0x34816b[_0x308a2e['agicommand']](_0x308a2e);if(_0x41df7a){logger[_0x518e('0x45')]('response',getLogFromObject(_0x41df7a));return _['isUndefined'](_0x41df7a[_0x518e('0x46')])?null:_0x41df7a['result']['toString']();}else{logger['error'](_0x518e('0x43'),getLogFromObject(_0x41df7a));return null;}}else{logger[_0x518e('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x7665ff){logger['error'](_0x7665ff['stack']);return null;}});}logger[_0x518e('0x10')](util[_0x518e('0x11')](_0x518e('0x4a'),_0x514ed1[_0x518e('0x1b')],_0x514ed1[_0x518e('0x18')],_0x514ed1['callerid'],_0x514ed1[_0x518e('0x19')],_0x514ed1[_0x518e('0x1a')]));logger[_0x518e('0x10')](util[_0x518e('0x11')](_0x518e('0x4b'),_0x514ed1['context'],_0x514ed1['extension'],parseInt(_0x514ed1[_0x518e('0x41')],0xa)+0x1));_0x514ed1[_0x518e('0x4c')](_0x514ed1[_0x518e('0x3f')],_0x514ed1['extension'],parseInt(_0x514ed1[_0x518e('0x41')],0xa)+0x1);_0x514ed1[_0x518e('0x36')]();}}else{logger[_0x518e('0xc')](util[_0x518e('0x11')]('Project\x20%s\x20not\x20published',_0x514ed1['arg_1']));_0x514ed1[_0x518e('0x4c')](_0x514ed1[_0x518e('0x3f')],_0x514ed1[_0x518e('0x40')],parseInt(_0x514ed1[_0x518e('0x41')],0xa)+0x1);_0x514ed1[_0x518e('0x36')]();}}else{logger['error'](util[_0x518e('0x11')](_0x518e('0x4d'),_0x514ed1[_0x518e('0x1b')]));_0x514ed1[_0x518e('0x4c')](_0x514ed1[_0x518e('0x3f')],_0x514ed1['extension'],parseInt(_0x514ed1['priority'],0xa)+0x1);_0x514ed1[_0x518e('0x36')]();}}function main(){var _0x2b7eee;return utilLicense[_0x518e('0x4e')]()['then'](function(_0x485aa6){if(_0x485aa6){if(_0x485aa6['voice']){if(_0x485aa6[_0x518e('0x4f')]&&_0x485aa6[_0x518e('0x4f')]>0x0){logger[_0x518e('0x10')](util[_0x518e('0x11')](_0x518e('0x50'),_0x485aa6[_0x518e('0x4f')]));_0x2b7eee=_0x485aa6[_0x518e('0x4f')];}else{logger['info'](_0x518e('0x51'));}}else{logger[_0x518e('0x10')](_0x518e('0x52'));_0x2b7eee=-0x1;}}})[_0x518e('0x2f')](function(_0x48b461){logger[_0x518e('0xc')](_0x518e('0x53'),_0x48b461[_0x518e('0x17')]);})[_0x518e('0x49')](function(){var _0x27c06b=require(_0x518e('0x54'))(config[_0x518e('0x5')][_0x518e('0xf')],config[_0x518e('0x5')]['ip'],_0x2b7eee);_0x27c06b['on'](_0x518e('0xc'),errorHandler);_0x27c06b['on']('listening',listeningHandler);_0x27c06b['on'](_0x518e('0x55'),connectionHandler);_0x27c06b['on'](_0x518e('0x36'),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 e46ac08..92b6049 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 _0x58f7=['message','result','catch','sendMailMessage','bluebird','jayson/promise','client','http','request','error'];(function(_0x26d878,_0x4a4f8c){var _0x1d525a=function(_0x1388db){while(--_0x1388db){_0x26d878['push'](_0x26d878['shift']());}};_0x1d525a(++_0x4a4f8c);}(_0x58f7,0x1c6));var _0x758f=function(_0x5aba4f,_0x1afb63){_0x5aba4f=_0x5aba4f-0x0;var _0x10cf5c=_0x58f7[_0x5aba4f];return _0x10cf5c;};'use strict';var BPromise=require(_0x758f('0x0'));var jayson=require(_0x758f('0x1'));var client=jayson[_0x758f('0x2')][_0x758f('0x3')]({'port':0x232b});function request(_0x4468ca,_0x18ed2b){return new BPromise(function(_0x1cb28f,_0x4019c2){return client[_0x758f('0x4')](_0x4468ca,_0x18ed2b)['then'](function(_0xab33bf){if(_0xab33bf[_0x758f('0x5')]){return _0x4019c2(_0xab33bf[_0x758f('0x5')][_0x758f('0x6')]);}else{return _0x1cb28f(_0xab33bf[_0x758f('0x7')]);}})[_0x758f('0x8')](function(_0x10752a){return _0x4019c2(_0x10752a);});});}exports[_0x758f('0x9')]=function(_0x25faa5,_0x5e14f7){return request('SendMail',{'account':_0x25faa5,'message':_0x5e14f7});}; \ No newline at end of file +var _0x2581=['bluebird','jayson/promise','client','http','then','message','catch','sendMailMessage','SendMail'];(function(_0x58c39b,_0x843363){var _0x82bde4=function(_0xcad3ef){while(--_0xcad3ef){_0x58c39b['push'](_0x58c39b['shift']());}};_0x82bde4(++_0x843363);}(_0x2581,0x75));var _0x1258=function(_0x3c7a54,_0x37de44){_0x3c7a54=_0x3c7a54-0x0;var _0x3acde2=_0x2581[_0x3c7a54];return _0x3acde2;};'use strict';var BPromise=require(_0x1258('0x0'));var jayson=require(_0x1258('0x1'));var client=jayson[_0x1258('0x2')][_0x1258('0x3')]({'port':0x232b});function request(_0x15f840,_0x5064ec){return new BPromise(function(_0x4725b9,_0x2ff239){return client['request'](_0x15f840,_0x5064ec)[_0x1258('0x4')](function(_0x3e41b6){if(_0x3e41b6['error']){return _0x2ff239(_0x3e41b6['error'][_0x1258('0x5')]);}else{return _0x4725b9(_0x3e41b6['result']);}})[_0x1258('0x6')](function(_0x36e61e){return _0x2ff239(_0x36e61e);});});}exports[_0x1258('0x7')]=function(_0x1fb5cf,_0x1e1969){return request(_0x1258('0x8'),{'account':_0x1fb5cf,'message':_0x1e1969});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index fa39230..2d371c0 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 _0xd932=['toString','indexOf','substring','length','split','trim','slice','line','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a'];(function(_0x1d0441,_0xd3c45c){var _0x274618=function(_0x314adb){while(--_0x314adb){_0x1d0441['push'](_0x1d0441['shift']());}};_0x274618(++_0xd3c45c);}(_0xd932,0x1c2));var _0x2d93=function(_0x2a44bf,_0x1a47b3){_0x2a44bf=_0x2a44bf-0x0;var _0x3a2d5f=_0xd932[_0x2a44bf];return _0x3a2d5f;};'use strict';var util=require('util');var Transform=require(_0x2d93('0x0'))[_0x2d93('0x1')];function AGIReply(_0x44a669){Transform[_0x2d93('0x2')](this,_0x44a669);this[_0x2d93('0x3')]='';this[_0x2d93('0x4')]=![];}util[_0x2d93('0x5')](AGIReply,Transform);AGIReply[_0x2d93('0x6')][_0x2d93('0x7')]=function(_0x3a37eb,_0x56711a,_0x3c987e){var _0x2cc890='\x0a',_0x54ad6d=['\x0a\x0a',_0x2d93('0x8')],_0x3c92cf=-0x1,_0xfe0694=-0x1,_0x5b1d80='',_0x35336b=0x0,_0x1ecc7c='',_0x3e7dd6='';this[_0x2d93('0x3')]+=_0x3a37eb[_0x2d93('0x9')]();_0x1ecc7c=this[_0x2d93('0x3')];if(!this[_0x2d93('0x4')]){_0x35336b=0x0;while(_0x54ad6d[_0x35336b]){while((_0xfe0694=_0x1ecc7c[_0x2d93('0xa')](_0x54ad6d[_0x35336b]))!=-0x1){_0x5b1d80=_0x54ad6d[_0x35336b];_0x3e7dd6=_0x1ecc7c['substring'](0x0,_0xfe0694);_0x1ecc7c=_0x1ecc7c[_0x2d93('0xb')](_0xfe0694+_0x5b1d80[_0x2d93('0xc')]);var _0x3a0d83=_0x3e7dd6[_0x2d93('0xd')](_0x2cc890),_0x1613f7=0x0,_0x59432b={},_0x104018='',_0x2f49b1='',_0x5966c1=-0x1;while(_0x3a0d83[_0x1613f7]){_0x5966c1=_0x3a0d83[_0x1613f7][_0x2d93('0xa')](':');if(_0x5966c1!=-0x1){_0x104018=_0x3a0d83[_0x1613f7]['slice'](0x0,_0x5966c1)[_0x2d93('0xe')]();_0x2f49b1=_0x3a0d83[_0x1613f7][_0x2d93('0xf')](_0x5966c1+0x1)[_0x2d93('0xe')]();if(_0x104018[_0x2d93('0xc')]>0x0){_0x59432b[_0x104018]=_0x2f49b1;}}else{}_0x1613f7++;}this['emit']('headers',_0x59432b);this[_0x2d93('0x4')]=!![];}_0x35336b++;}this[_0x2d93('0x3')]=_0x1ecc7c;}else{while((_0x3c92cf=_0x1ecc7c[_0x2d93('0xa')](_0x2cc890))!=-0x1){_0x3e7dd6=_0x1ecc7c[_0x2d93('0xb')](0x0,_0x3c92cf);this['emit'](_0x2d93('0x10'),_0x3e7dd6);_0x1ecc7c=_0x1ecc7c[_0x2d93('0xb')](_0x3c92cf+_0x2cc890[_0x2d93('0xc')]);}this[_0x2d93('0x3')]=_0x1ecc7c;}_0x3c987e();};module['exports']=AGIReply; \ No newline at end of file +var _0xe235=['util','stream','Transform','_inBody','inherits','prototype','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','slice','trim','length','emit','headers','line','exports'];(function(_0x49bfca,_0x37306a){var _0x5015be=function(_0x1c22df){while(--_0x1c22df){_0x49bfca['push'](_0x49bfca['shift']());}};_0x5015be(++_0x37306a);}(_0xe235,0xe4));var _0x5e23=function(_0x3f9e48,_0xe329b){_0x3f9e48=_0x3f9e48-0x0;var _0x280edd=_0xe235[_0x3f9e48];return _0x280edd;};'use strict';var util=require(_0x5e23('0x0'));var Transform=require(_0x5e23('0x1'))[_0x5e23('0x2')];function AGIReply(_0x90bed3){Transform['call'](this,_0x90bed3);this['_localBuffer']='';this[_0x5e23('0x3')]=![];}util[_0x5e23('0x4')](AGIReply,Transform);AGIReply[_0x5e23('0x5')]['_transform']=function(_0x56c773,_0x37cae3,_0x37c8a7){var _0x1b49b2='\x0a',_0x1c9b2b=['\x0a\x0a',_0x5e23('0x6')],_0x16454c=-0x1,_0xd7f262=-0x1,_0x1f0008='',_0x92ae38=0x0,_0x16704e='',_0x3d20ac='';this[_0x5e23('0x7')]+=_0x56c773[_0x5e23('0x8')]();_0x16704e=this[_0x5e23('0x7')];if(!this['_inBody']){_0x92ae38=0x0;while(_0x1c9b2b[_0x92ae38]){while((_0xd7f262=_0x16704e[_0x5e23('0x9')](_0x1c9b2b[_0x92ae38]))!=-0x1){_0x1f0008=_0x1c9b2b[_0x92ae38];_0x3d20ac=_0x16704e[_0x5e23('0xa')](0x0,_0xd7f262);_0x16704e=_0x16704e[_0x5e23('0xa')](_0xd7f262+_0x1f0008['length']);var _0x2eda30=_0x3d20ac[_0x5e23('0xb')](_0x1b49b2),_0x533089=0x0,_0x171d25={},_0x25b3c8='',_0x4b8cf2='',_0xf54178=-0x1;while(_0x2eda30[_0x533089]){_0xf54178=_0x2eda30[_0x533089][_0x5e23('0x9')](':');if(_0xf54178!=-0x1){_0x25b3c8=_0x2eda30[_0x533089][_0x5e23('0xc')](0x0,_0xf54178)['trim']();_0x4b8cf2=_0x2eda30[_0x533089]['slice'](_0xf54178+0x1)[_0x5e23('0xd')]();if(_0x25b3c8[_0x5e23('0xe')]>0x0){_0x171d25[_0x25b3c8]=_0x4b8cf2;}}else{}_0x533089++;}this[_0x5e23('0xf')](_0x5e23('0x10'),_0x171d25);this[_0x5e23('0x3')]=!![];}_0x92ae38++;}this[_0x5e23('0x7')]=_0x16704e;}else{while((_0x16454c=_0x16704e[_0x5e23('0x9')](_0x1b49b2))!=-0x1){_0x3d20ac=_0x16704e[_0x5e23('0xa')](0x0,_0x16454c);this[_0x5e23('0xf')](_0x5e23('0x11'),_0x3d20ac);_0x16704e=_0x16704e[_0x5e23('0xa')](_0x16454c+_0x1b49b2[_0x5e23('0xe')]);}this[_0x5e23('0x7')]=_0x16704e;}_0x37c8a7();};module[_0x5e23('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d0c2b8e..1fbfcf3 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 _0x6240=['arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','getTrunkById','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport'];(function(_0x3eea3e,_0x5e1e6c){var _0x1f6bf7=function(_0x493a8b){while(--_0x493a8b){_0x3eea3e['push'](_0x3eea3e['shift']());}};_0x1f6bf7(++_0x5e1e6c);}(_0x6240,0xc5));var _0x0624=function(_0x1fb211,_0x365aea){_0x1fb211=_0x1fb211-0x0;var _0x231291=_0x6240[_0x1fb211];return _0x231291;};'use strict';var BPromise=require(_0x0624('0x0'));var moment=require(_0x0624('0x1'));var _=require(_0x0624('0x2'));var util=require(_0x0624('0x3'));var jayson=require(_0x0624('0x4'));var client=jayson[_0x0624('0x5')]['http']({'port':0x2329});function request(_0x1b880c,_0x121510){return new BPromise(function(_0x2ae127,_0x381a93){return client[_0x0624('0x6')](_0x1b880c,_0x121510)[_0x0624('0x7')](function(_0x2dd4d0){if(_0x2dd4d0[_0x0624('0x8')]){return _0x381a93(_0x2dd4d0[_0x0624('0x8')]['message']);}else{return _0x2ae127(_0x2dd4d0['result']);}})[_0x0624('0x9')](function(_0x540d47){return _0x381a93(_0x540d47);});});}exports[_0x0624('0xa')]=function(_0x18b131){return request(_0x0624('0xb'),{'options':{'raw':![],'where':{'name':_0x18b131},'attributes':[_0x0624('0xc')]}});};exports[_0x0624('0xd')]=function(_0x57f47b){return request(_0x0624('0xe'),{'options':{'raw':![],'where':{'id':_0x57f47b},'include':[{'model':_0x0624('0xf'),'as':'Smtp'}],'attributes':['id',_0x0624('0x10'),_0x0624('0x11')]}});};exports[_0x0624('0x12')]=function(_0x41da79){return request('ShowSquareProject',{'options':{'where':{'id':_0x41da79},'attributes':[_0x0624('0x10')]}});};exports[_0x0624('0x13')]=function(_0x4ac822){return request(_0x0624('0x14'),{'options':{'where':{'id':_0x4ac822},'attributes':[_0x0624('0x10')]}});};exports[_0x0624('0x15')]=function(_0x4c115f){return request(_0x0624('0x16'),{'options':{'where':{'id':_0x4c115f},'attributes':[_0x0624('0x10')]}});};exports[_0x0624('0x17')]=function(_0x499303){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x499303},'attributes':['dsn']}});};exports['getUserById']=function(_0x3ee46f){return request('ShowUser',{'options':{'where':{'id':_0x3ee46f},'attributes':['name']}});};exports[_0x0624('0x18')]=function(_0x4c8aac){return request('ShowTrunk',{'options':{'where':{'id':_0x4c8aac},'attributes':[_0x0624('0x10')]}});};exports[_0x0624('0x19')]=function(_0x27ac52){return request(_0x0624('0x1a'),{'options':{'where':{'id':_0x27ac52},'attributes':[_0x0624('0x1b')]}});};exports['getIntervalById']=function(_0x24c0b6){return request(_0x0624('0x1c'),{'options':{'raw':![],'where':{'id':_0x24c0b6},'include':[{'model':_0x0624('0x1d'),'as':_0x0624('0x1e')}]}});};exports[_0x0624('0x1f')]=function(_0x2449f5){return request(_0x0624('0x20'),{'options':{'where':{'id':_0x2449f5},'attributes':['id',_0x0624('0x10')]}});};exports[_0x0624('0x21')]=function(_0x38f4d1){return request(_0x0624('0x22'),{'body':_0x38f4d1});};exports[_0x0624('0x23')]=function(_0xec5550){return request(_0x0624('0x24'),{'body':_0xec5550});};exports[_0x0624('0x25')]=function(_0xce8fa){return request(_0x0624('0x26'),{'body':_['merge'](_0xce8fa,{'project_name':_0xce8fa['arg_1'],'prev_project_name':_0xce8fa[_0x0624('0x27')]||'','is_subproject':_0xce8fa['arg_2']?!![]:![],'leaveAt':moment()[_0x0624('0x28')](_0x0624('0x29'))})});};exports[_0x0624('0x2a')]=function(_0x40a20f){return request(_0x0624('0x2b'),{'body':_0x40a20f});};exports[_0x0624('0x2c')]=function(_0x500b0b){return request(_0x0624('0x2d'),{'body':_0x500b0b});};exports[_0x0624('0x2e')]=function(_0x46fcc4){return request(_0x0624('0x2f'),{'options':{'raw':![],'where':{'phone':_0x46fcc4[_0x0624('0x30')],'ListId':_0x46fcc4[_0x0624('0x31')]}}})[_0x0624('0x7')](function(_0x469d8b){if(_0x469d8b){return _0x469d8b;}return request('CreateCmContact',{'body':_0x46fcc4});});};exports[_0x0624('0x32')]=function(_0x8490b6){return request(_0x0624('0x33'),{'options':{'where':{'id':_0x8490b6},'attributes':[_0x0624('0x10')]}});};exports[_0x0624('0x34')]=function(_0x4efbbe,_0x12f989){return request(_0x0624('0x35'),{'body':{'interface':_0x12f989},'options':{'where':_0x4efbbe}});};exports[_0x0624('0x36')]=function(_0x497dfa,_0x2f9ad3,_0x591a1d){return request(_0x0624('0x37'),{'body':{'type':_0x2f9ad3,'uniqueid':_0x591a1d},'options':{'where':_0x497dfa}});};exports[_0x0624('0x38')]=function(_0x52d9c7){return request(_0x0624('0x39'),{'body':{},'options':{'where':_0x52d9c7}});};exports['agentLogout']=function(_0x491d5f){return request(_0x0624('0x3a'),{'body':{},'options':{'where':_0x491d5f}});}; \ No newline at end of file +var _0x9a0f=['getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','request','then','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','email','getSquareProjectById','name','getVoiceQueueById','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser'];(function(_0x30f020,_0x7d2cfa){var _0x3933c0=function(_0x563de3){while(--_0x563de3){_0x30f020['push'](_0x30f020['shift']());}};_0x3933c0(++_0x7d2cfa);}(_0x9a0f,0x65));var _0xf9a0=function(_0x556d13,_0xc7e4d6){_0x556d13=_0x556d13-0x0;var _0x410b54=_0x9a0f[_0x556d13];return _0x410b54;};'use strict';var BPromise=require(_0xf9a0('0x0'));var moment=require(_0xf9a0('0x1'));var _=require(_0xf9a0('0x2'));var util=require(_0xf9a0('0x3'));var jayson=require(_0xf9a0('0x4'));var client=jayson[_0xf9a0('0x5')]['http']({'port':0x2329});function request(_0x7808f4,_0x17532d){return new BPromise(function(_0x55fc31,_0x29b312){return client[_0xf9a0('0x6')](_0x7808f4,_0x17532d)[_0xf9a0('0x7')](function(_0x41379d){if(_0x41379d[_0xf9a0('0x8')]){return _0x29b312(_0x41379d[_0xf9a0('0x8')][_0xf9a0('0x9')]);}else{return _0x55fc31(_0x41379d['result']);}})[_0xf9a0('0xa')](function(_0x33f616){return _0x29b312(_0x33f616);});});}exports[_0xf9a0('0xb')]=function(_0x492382){return request(_0xf9a0('0xc'),{'options':{'raw':![],'where':{'name':_0x492382},'attributes':[_0xf9a0('0xd')]}});};exports[_0xf9a0('0xe')]=function(_0x4a8616){return request(_0xf9a0('0xf'),{'options':{'raw':![],'where':{'id':_0x4a8616},'include':[{'model':_0xf9a0('0x10'),'as':'Smtp'}],'attributes':['id','name',_0xf9a0('0x11')]}});};exports[_0xf9a0('0x12')]=function(_0x505946){return request(_0xf9a0('0xc'),{'options':{'where':{'id':_0x505946},'attributes':[_0xf9a0('0x13')]}});};exports[_0xf9a0('0x14')]=function(_0x1c9bc7){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x1c9bc7},'attributes':[_0xf9a0('0x13')]}});};exports['getVariableById']=function(_0x30fd2f){return request('ShowVariable',{'options':{'where':{'id':_0x30fd2f},'attributes':[_0xf9a0('0x13')]}});};exports[_0xf9a0('0x15')]=function(_0xc04b67){return request(_0xf9a0('0x16'),{'options':{'where':{'id':_0xc04b67},'attributes':[_0xf9a0('0x17')]}});};exports['getUserById']=function(_0x5c7314){return request(_0xf9a0('0x18'),{'options':{'where':{'id':_0x5c7314},'attributes':['name']}});};exports[_0xf9a0('0x19')]=function(_0x5c7cbb){return request(_0xf9a0('0x1a'),{'options':{'where':{'id':_0x5c7cbb},'attributes':[_0xf9a0('0x13')]}});};exports[_0xf9a0('0x1b')]=function(_0x581f0f){return request(_0xf9a0('0x1c'),{'options':{'where':{'id':_0x581f0f},'attributes':[_0xf9a0('0x1d')]}});};exports[_0xf9a0('0x1e')]=function(_0x5f5271){return request(_0xf9a0('0x1f'),{'options':{'raw':![],'where':{'id':_0x5f5271},'include':[{'model':_0xf9a0('0x20'),'as':_0xf9a0('0x21')}]}});};exports[_0xf9a0('0x22')]=function(_0x382d6b){return request(_0xf9a0('0x23'),{'options':{'where':{'id':_0x382d6b},'attributes':['id',_0xf9a0('0x13')]}});};exports['createSmsMessage']=function(_0x3dcf70){return request('CreateSmsMessage',{'body':_0x3dcf70});};exports[_0xf9a0('0x24')]=function(_0x3b779c){return request(_0xf9a0('0x25'),{'body':_0x3b779c});};exports[_0xf9a0('0x26')]=function(_0x1b2b87){return request(_0xf9a0('0x27'),{'body':_[_0xf9a0('0x28')](_0x1b2b87,{'project_name':_0x1b2b87[_0xf9a0('0x29')],'prev_project_name':_0x1b2b87[_0xf9a0('0x2a')]||'','is_subproject':_0x1b2b87[_0xf9a0('0x2a')]?!![]:![],'leaveAt':moment()[_0xf9a0('0x2b')](_0xf9a0('0x2c'))})});};exports[_0xf9a0('0x2d')]=function(_0x3283b9){return request(_0xf9a0('0x2e'),{'body':_0x3283b9});};exports[_0xf9a0('0x2f')]=function(_0x5e3ebe){return request(_0xf9a0('0x30'),{'body':_0x5e3ebe});};exports[_0xf9a0('0x31')]=function(_0x43ff43){return request(_0xf9a0('0x32'),{'options':{'raw':![],'where':{'phone':_0x43ff43[_0xf9a0('0x33')],'ListId':_0x43ff43[_0xf9a0('0x34')]}}})[_0xf9a0('0x7')](function(_0x5327bd){if(_0x5327bd){return _0x5327bd;}return request(_0xf9a0('0x35'),{'body':_0x43ff43});});};exports['getPauseById']=function(_0x1fdab1){return request(_0xf9a0('0x36'),{'options':{'where':{'id':_0x1fdab1},'attributes':['name']}});};exports[_0xf9a0('0x37')]=function(_0x574fa0,_0x130d6a){return request(_0xf9a0('0x38'),{'body':{'interface':_0x130d6a},'options':{'where':_0x574fa0}});};exports[_0xf9a0('0x39')]=function(_0x18971f,_0x415e72,_0x14df86){return request(_0xf9a0('0x3a'),{'body':{'type':_0x415e72,'uniqueid':_0x14df86},'options':{'where':_0x18971f}});};exports[_0xf9a0('0x3b')]=function(_0x1cedbd){return request(_0xf9a0('0x3c'),{'body':{},'options':{'where':_0x1cedbd}});};exports[_0xf9a0('0x3d')]=function(_0x58f128){return request(_0xf9a0('0x3e'),{'body':{},'options':{'where':_0x58f128}});}; \ 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 63b24b7..22bbac8 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 _0xa6b0=['./lex','./polly'];(function(_0x3690de,_0xaad404){var _0x9737de=function(_0x4bc616){while(--_0x4bc616){_0x3690de['push'](_0x3690de['shift']());}};_0x9737de(++_0xaad404);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x1596f5,_0x3b70f7){_0x1596f5=_0x1596f5-0x0;var _0x12da7f=_0xa6b0[_0x1596f5];return _0x12da7f;};var polly=require(_0x0a6b('0x0'));var lex=require(_0x0a6b('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xa1aa=['exports'];(function(_0x97f518,_0xe7cedb){var _0x33529a=function(_0x17cfa3){while(--_0x17cfa3){_0x97f518['push'](_0x97f518['shift']());}};_0x33529a(++_0xe7cedb);}(_0xa1aa,0x88));var _0xaa1a=function(_0x2ce5c6,_0x2935cd){_0x2ce5c6=_0x2ce5c6-0x0;var _0x48b59d=_0xa1aa[_0x2ce5c6];return _0x48b59d;};var polly=require('./polly');var lex=require('./lex');module[_0xaa1a('0x0')]={'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 06b40ce..a9f30e9 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','./lib/api'];(function(_0x3c60cf,_0x5e701b){var _0xefa1f9=function(_0x510476){while(--_0x510476){_0x3c60cf['push'](_0x3c60cf['shift']());}};_0xefa1f9(++_0x5e701b);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var lex=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1){return lex(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1);}; \ No newline at end of file +var _0x91a7=['exports'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0x91a7,0xe7));var _0x791a=function(_0x12abdd,_0x570e1d){_0x12abdd=_0x12abdd-0x0;var _0x71519d=_0x91a7[_0x12abdd];return _0x71519d;};'use strict';var lex=require('./lib/api');module[_0x791a('0x0')]=function(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392){return lex(_0x3d6eab,_0x268862,_0x5d2796,_0x415994,_0x5b6f78,_0x2f6392);}; \ 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 cca4167..f526bd0 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(_0x1fa05d,_0x44287f){var _0x403df1=function(_0x154126){while(--_0x154126){_0x1fa05d['push'](_0x1fa05d['shift']());}};_0x403df1(++_0x44287f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'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(_0x494c66,_0x2df234){var _0x4ca4f0=function(_0x4e366c){while(--_0x4e366c){_0x494c66['push'](_0x494c66['shift']());}};_0x4ca4f0(++_0x2df234);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 2df80d7..0da9e14 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 _0xe228=['exports'];(function(_0x1e22d6,_0x25605f){var _0x397cc4=function(_0x4339fa){while(--_0x4339fa){_0x1e22d6['push'](_0x1e22d6['shift']());}};_0x397cc4(++_0x25605f);}(_0xe228,0xfc));var _0x8e22=function(_0x1a33fd,_0x2890b0){_0x1a33fd=_0x1a33fd-0x0;var _0x38cec3=_0xe228[_0x1a33fd];return _0x38cec3;};'use strict';var polly=require('./lib/api');module[_0x8e22('0x0')]=function(_0x110216,_0x1c0fa6,_0x4dd60f,_0x5be2fa,_0x462b75,_0x5df779,_0x1d9546){return polly(_0x110216,_0x1c0fa6,_0x4dd60f,_0x5be2fa,_0x462b75,_0x5df779,_0x1d9546);}; \ No newline at end of file +var _0xbe3f=['./lib/api','exports'];(function(_0x3b3d5b,_0x4b7b90){var _0x181f5e=function(_0x627e94){while(--_0x627e94){_0x3b3d5b['push'](_0x3b3d5b['shift']());}};_0x181f5e(++_0x4b7b90);}(_0xbe3f,0x1ac));var _0xfbe3=function(_0x966bf3,_0x5a1db1){_0x966bf3=_0x966bf3-0x0;var _0x25161c=_0xbe3f[_0x966bf3];return _0x25161c;};'use strict';var polly=require(_0xfbe3('0x0'));module[_0xfbe3('0x1')]=function(_0x360996,_0x1526bd,_0x41eb93,_0x4f6ae7,_0x53dc8f,_0x18af39,_0x4a176a){return polly(_0x360996,_0x1526bd,_0x41eb93,_0x4f6ae7,_0x53dc8f,_0x18af39,_0x4a176a);}; \ 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 70bd0a3..c3453b5 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 _0x2bc4=['text','mp3','bluebird','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x1c3f45,_0x593c30){var _0x50a61c=function(_0x3f763b){while(--_0x3f763b){_0x1c3f45['push'](_0x1c3f45['shift']());}};_0x50a61c(++_0x593c30);}(_0x2bc4,0x8c));var _0x42bc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x2bc4[_0x42cae2];return _0x5f256f;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x42bc('0x0'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x487f77,_0x517a9a,_0x1dc8f7){return new BPromise(function(_0x21f6f5,_0x16e0b3){_0x487f77['synthesizeSpeech'](_0x517a9a,function(_0x18eb68,_0x246fe1){if(_0x18eb68){_0x16e0b3(_0x18eb68);}else if(_0x246fe1){if(_0x246fe1[_0x42bc('0x1')]instanceof Buffer){fs[_0x42bc('0x2')](_0x1dc8f7,_0x246fe1[_0x42bc('0x1')],function(_0x5241ba){if(_0x5241ba){_0x16e0b3(_0x5241ba);}else{_0x21f6f5();}});}else{_0x16e0b3(new Error(_0x42bc('0x3')));}}else{_0x16e0b3(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x585c3a,_0x356bd4,_0x162ad0,_0x177bc7,_0x47af80,_0x5b4c32,_0x24a4b0){var _0x3a4eea=new AWS['Polly']({'accessKeyId':_0x585c3a,'secretAccessKey':_0x356bd4,'region':_0x162ad0});var _0x36d9ce={'Text':_0x47af80,'TextType':_0x5b4c32||_0x42bc('0x4'),'OutputFormat':_0x42bc('0x5'),'VoiceId':_0x177bc7};return pollyResult(_0x3a4eea,_0x36d9ce,_0x24a4b0);}; \ No newline at end of file +var _0x259a=['exports','Polly','text','mp3','path','bluebird','aws-sdk','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0xc638d7,_0x221143){var _0x10ce44=function(_0x389cd7){while(--_0x389cd7){_0xc638d7['push'](_0xc638d7['shift']());}};_0x10ce44(++_0x221143);}(_0x259a,0x1ee));var _0xa259=function(_0x38efe1,_0x34a883){_0x38efe1=_0x38efe1-0x0;var _0x44c9fb=_0x259a[_0x38efe1];return _0x44c9fb;};'use strict';var fs=require('fs');var path=require(_0xa259('0x0'));var BPromise=require(_0xa259('0x1'));var rs=require('randomstring');var AWS=require(_0xa259('0x2'));function pollyResult(_0x5cb19d,_0x4dda99,_0x65b6d3){return new BPromise(function(_0x2906ba,_0x3510da){_0x5cb19d['synthesizeSpeech'](_0x4dda99,function(_0x1ae22f,_0x265df3){if(_0x1ae22f){_0x3510da(_0x1ae22f);}else if(_0x265df3){if(_0x265df3[_0xa259('0x3')]instanceof Buffer){fs['writeFile'](_0x65b6d3,_0x265df3[_0xa259('0x3')],function(_0x5bd1a7){if(_0x5bd1a7){_0x3510da(_0x5bd1a7);}else{_0x2906ba();}});}else{_0x3510da(new Error(_0xa259('0x4')));}}else{_0x3510da(new Error(_0xa259('0x5')));}});});}module[_0xa259('0x6')]=function(_0x1a12b6,_0x236a1f,_0x1c95d0,_0x429df7,_0x42b68e,_0x1cc431,_0x36b9a6){var _0x5df4be=new AWS[(_0xa259('0x7'))]({'accessKeyId':_0x1a12b6,'secretAccessKey':_0x236a1f,'region':_0x1c95d0});var _0x3e024c={'Text':_0x42b68e,'TextType':_0x1cc431||_0xa259('0x8'),'OutputFormat':_0xa259('0x9'),'VoiceId':_0x429df7};return pollyResult(_0x5df4be,_0x3e024c,_0x36b9a6);}; \ 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 e6c9595..f4d1b73 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 _0x426e=['./lib/api','exports'];(function(_0x37756b,_0x24db76){var _0x46efec=function(_0x319807){while(--_0x319807){_0x37756b['push'](_0x37756b['shift']());}};_0x46efec(++_0x24db76);}(_0x426e,0xe2));var _0xe426=function(_0x730192,_0x531aed){_0x730192=_0x730192-0x0;var _0x24bd5d=_0x426e[_0x730192];return _0x24bd5d;};'use strict';var asr=require(_0xe426('0x0'));module[_0xe426('0x1')]=function(_0x1c5a43,_0x53e101,_0x2574a0,_0x184a4b){return asr(_0x1c5a43,_0x53e101,_0x2574a0);}; \ No newline at end of file +var _0x6c78=['exports'];(function(_0x5e4212,_0x2bee54){var _0x4c941e=function(_0x35f2f4){while(--_0x35f2f4){_0x5e4212['push'](_0x5e4212['shift']());}};_0x4c941e(++_0x2bee54);}(_0x6c78,0x93));var _0x86c7=function(_0x2b43a9,_0x246f01){_0x2b43a9=_0x2b43a9-0x0;var _0x34238d=_0x6c78[_0x2b43a9];return _0x34238d;};'use strict';var asr=require('./lib/api');module[_0x86c7('0x0')]=function(_0x487cac,_0x4f3144,_0x11d589,_0x1bf245){return asr(_0x487cac,_0x4f3144,_0x11d589);}; \ 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 6cf2f52..db4228a 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 _0x4d46=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','POST','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x224130,_0x2da405){var _0x456f31=function(_0x623c7a){while(--_0x623c7a){_0x224130['push'](_0x224130['shift']());}};_0x456f31(++_0x2da405);}(_0x4d46,0x197));var _0x64d4=function(_0x56dfe8,_0x3b0d6c){_0x56dfe8=_0x56dfe8-0x0;var _0x34d146=_0x4d46[_0x56dfe8];return _0x34d146;};'use strict';var url=require(_0x64d4('0x0'));var BPromise=require(_0x64d4('0x1'));var fs=require('fs');var host=_0x64d4('0x2');module[_0x64d4('0x3')]=function(_0x262015,_0x145fbc,_0x51c43f){return new BPromise(function(_0x3025f0,_0xc60ca5){var _0x200491;if(typeof _0x262015!==_0x64d4('0x4')||_0x262015[_0x64d4('0x5')]===0x0){return _0xc60ca5(_0x64d4('0x6'));}if(typeof _0x145fbc!=='string'||_0x145fbc[_0x64d4('0x5')]===0x0){return _0xc60ca5(_0x64d4('0x7'));}if(typeof _0x51c43f!=='undefined'&&(typeof _0x51c43f!==_0x64d4('0x4')||_0x51c43f[_0x64d4('0x5')]===0x0)){return _0xc60ca5('lang\x20should\x20be\x20a\x20string');}try{_0x200491=fs['readFileSync'](_0x262015)['toString']('base64');}catch(_0x56bfd2){return _0xc60ca5(_0x56bfd2);}return _0x3025f0({'method':_0x64d4('0x8'),'uri':host+_0x64d4('0x9')+_0x145fbc,'body':{'config':{'encoding':_0x64d4('0xa'),'sampleRateHertz':_0x64d4('0xb'),'languageCode':_0x51c43f},'audio':{'content':_0x200491}},'json':!![]});});}; \ No newline at end of file +var _0x9224=['exports','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com'];(function(_0x3e7efb,_0x1b7376){var _0x102b24=function(_0x12d993){while(--_0x12d993){_0x3e7efb['push'](_0x3e7efb['shift']());}};_0x102b24(++_0x1b7376);}(_0x9224,0xa3));var _0x4922=function(_0x480c87,_0x1a504c){_0x480c87=_0x480c87-0x0;var _0x410c17=_0x9224[_0x480c87];return _0x410c17;};'use strict';var url=require('url');var BPromise=require(_0x4922('0x0'));var fs=require('fs');var host=_0x4922('0x1');module[_0x4922('0x2')]=function(_0x472129,_0x3517a1,_0x3c8757){return new BPromise(function(_0x59ed16,_0x582640){var _0x572f8f;if(typeof _0x472129!==_0x4922('0x3')||_0x472129['length']===0x0){return _0x582640(_0x4922('0x4'));}if(typeof _0x3517a1!==_0x4922('0x3')||_0x3517a1[_0x4922('0x5')]===0x0){return _0x582640(_0x4922('0x6'));}if(typeof _0x3c8757!==_0x4922('0x7')&&(typeof _0x3c8757!==_0x4922('0x3')||_0x3c8757['length']===0x0)){return _0x582640(_0x4922('0x8'));}try{_0x572f8f=fs[_0x4922('0x9')](_0x472129)['toString'](_0x4922('0xa'));}catch(_0x2bddaf){return _0x582640(_0x2bddaf);}return _0x59ed16({'method':_0x4922('0xb'),'uri':host+_0x4922('0xc')+_0x3517a1,'body':{'config':{'encoding':_0x4922('0xd'),'sampleRateHertz':_0x4922('0xe'),'languageCode':_0x3c8757},'audio':{'content':_0x572f8f}},'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 5f9cf51..1f87505 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 _0xa2a5=['exports','./asr'];(function(_0x39e381,_0x472564){var _0x295bb6=function(_0x43973f){while(--_0x43973f){_0x39e381['push'](_0x39e381['shift']());}};_0x295bb6(++_0x472564);}(_0xa2a5,0x7d));var _0x5a2a=function(_0x1efb79,_0x53fd14){_0x1efb79=_0x1efb79-0x0;var _0xcde3f1=_0xa2a5[_0x1efb79];return _0xcde3f1;};var asr=require(_0x5a2a('0x0'));module[_0x5a2a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x7ace=['exports','./asr'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x7ace,0x1f3));var _0xe7ac=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7ace[_0x27af45];return _0x18df21;};var asr=require(_0xe7ac('0x0'));module[_0xe7ac('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 cf35c2c..fbd6353 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 _0xe1a2=['ssml','input','voice','audioConfig','POST','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','freeform=3','parse','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','querystring','request-promise','randomstring','url','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','unlink','download\x20error','end','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','base64','then','chmodSync','777','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x27e6ed,_0x146097){var _0x256feb=function(_0x317c1a){while(--_0x317c1a){_0x27e6ed['push'](_0x27e6ed['shift']());}};_0x256feb(++_0x146097);}(_0xe1a2,0xe1));var _0x2e1a=function(_0x3d2e4b,_0x1f6653){_0x3d2e4b=_0x3d2e4b-0x0;var _0x509e78=_0xe1a2[_0x3d2e4b];return _0x509e78;};'use strict';var apiai=require(_0x2e1a('0x0'));var BPromise=require(_0x2e1a('0x1'));var dialogflow=require(_0x2e1a('0x2'));var fs=require('fs');var http=require(_0x2e1a('0x3'));var https=require(_0x2e1a('0x4'));var md5=require(_0x2e1a('0x5'));var path=require(_0x2e1a('0x6'));var querystring=require(_0x2e1a('0x7'));var rp=require(_0x2e1a('0x8'));var rs=require(_0x2e1a('0x9'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require(_0x2e1a('0xa'))['parse'];var util=require('util');var aws=require(_0x2e1a('0xb'));var google=require(_0x2e1a('0xc'));var sestek=require(_0x2e1a('0xd'));var tilde=require('./tilde');var logger=require(_0x2e1a('0xe'))(_0x2e1a('0xf'));var ISPEECH_API=_0x2e1a('0x10');function downloadFile(_0x54f6a9,_0xbc884e){return new BPromise(function(_0x192c3d,_0x2dbc1e){var _0x15bc77=urlParse(_0x54f6a9);var _0x3e4052=_0x15bc77[_0x2e1a('0x11')]===_0x2e1a('0x12')?https:http;var _0x294523={'host':_0x15bc77[_0x2e1a('0x13')],'path':_0x15bc77[_0x2e1a('0x6')],'headers':{'user-agent':_0x2e1a('0x14')}};_0x3e4052[_0x2e1a('0x15')](_0x294523,function(_0x3be5f3){if(_0x3be5f3['statusCode']!==0xc8){logger[_0x2e1a('0x16')](_0x2e1a('0x17')+_0x54f6a9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3be5f3[_0x2e1a('0x18')]+'\x20('+_0x3be5f3[_0x2e1a('0x19')]+')');_0x2dbc1e(new Error(_0x2e1a('0x17')+_0x54f6a9+_0x2e1a('0x1a')+_0x3be5f3[_0x2e1a('0x18')]+'\x20('+_0x3be5f3[_0x2e1a('0x19')]+')'));return;}var _0x5e1279=fs[_0x2e1a('0x1b')](_0xbc884e);_0x5e1279['on'](_0x2e1a('0x1c'),function(){logger[_0x2e1a('0x1d')]('finish\x20download\x20file');_0x5e1279[_0x2e1a('0x1e')](_0x192c3d);});_0x5e1279['on'](_0x2e1a('0x16'),function(_0x4a4d5e){fs[_0x2e1a('0x1f')](_0xbc884e);logger['error'](_0x2e1a('0x20'),_0x4a4d5e);_0x2dbc1e(_0x4a4d5e);});_0x3be5f3['pipe'](_0x5e1279);})['on']('error',function(_0x36a83d){logger[_0x2e1a('0x16')](_0x36a83d);_0x2dbc1e(_0x36a83d);})['end']();});}function uploadFile(_0x41f5ac){return new BPromise(function(_0x23bfec,_0xf242df){var _0x2aabc9=urlParse(_0x41f5ac);var _0x4c324=_0x2aabc9['protocol']===_0x2e1a('0x12')?https:http;var _0x4de865={'host':_0x2aabc9[_0x2e1a('0x13')],'path':_0x2aabc9[_0x2e1a('0x6')],'headers':{'user-agent':_0x2e1a('0x14')}};_0x4c324[_0x2e1a('0x15')](_0x4de865,function(_0xa296ec){if(_0xa296ec[_0x2e1a('0x18')]!==0xc8){_0xf242df(new Error(_0x2e1a('0x17')+_0x41f5ac+'\x20failed,\x20status\x20code\x20=\x20'+_0xa296ec[_0x2e1a('0x18')]+'\x20('+_0xa296ec[_0x2e1a('0x19')]+')'));return;}var _0x3bb054='';_0xa296ec['on']('data',function(_0xcae454){_0x3bb054+=_0xcae454;});_0xa296ec['on'](_0x2e1a('0x21'),function(){_0x23bfec(_0x3bb054);});})['on'](_0x2e1a('0x16'),function(_0x4ae6e7){_0xf242df(_0x4ae6e7);})[_0x2e1a('0x21')]();});}function convertFile(_0x359420,_0x37b53a){return new BPromise(function(_0xd8e48e,_0x248829){var _0x332e8a=sox[_0x2e1a('0x22')](_0x359420,_0x37b53a,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x332e8a['on'](_0x2e1a('0x16'),function(_0x3bcb69){logger[_0x2e1a('0x16')](_0x2e1a('0x23'),_0x3bcb69);_0x248829(_0x3bcb69);});_0x332e8a['on']('end',function(){logger[_0x2e1a('0x1d')](_0x2e1a('0x24'));_0xd8e48e();});_0x332e8a[_0x2e1a('0x25')]();});}function base64Decode(_0x4a945b,_0x2b632c){var _0x593ca3=path[_0x2e1a('0x26')](__dirname,_0x2e1a('0x27'),rs['generate'](0x4)+_0x2e1a('0x28'));fs[_0x2e1a('0x29')](_0x593ca3,_0x4a945b,_0x2e1a('0x2a'));return convertFile(_0x593ca3,_0x2b632c)[_0x2e1a('0x2b')](function(){try{fs['unlink'](_0x593ca3);fs[_0x2e1a('0x2c')](_0x2b632c,_0x2e1a('0x2d'));}catch(_0x309986){logger[_0x2e1a('0x16')](_0x309986);}return _0x2b632c['split']('.')[0x0];});}function base64Encode(_0x458ec9){var _0x47d004=fs['readFileSync'](_0x458ec9);return new Buffer(_0x47d004)[_0x2e1a('0x2e')]('base64');}exports[_0x2e1a('0x2f')]=function(_0x1c26a5,_0x591ddf,_0x724545,_0x103dc9,_0x31a1ad,_0x117c18){var _0x58e55b,_0x5693b2;var _0x55c3bd=_0x2e1a('0x30');var _0x5bcf34='?key='+_0x1c26a5;var _0x331c53={};if(_0x591ddf===_0x2e1a('0x31')){_0x331c53[_0x2e1a('0x32')]={'ssml':_0x724545};}else{_0x331c53[_0x2e1a('0x32')]={'text':_0x724545};};_0x331c53[_0x2e1a('0x33')]={'languageCode':_0x103dc9,'ssmlGender':_0x31a1ad};_0x331c53[_0x2e1a('0x34')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x520282={'url':_0x55c3bd+'text:synthesize'+_0x5bcf34,'method':_0x2e1a('0x35'),'json':!![],'body':_0x331c53};return rp(_0x520282)[_0x2e1a('0x2b')](function(_0x5d5882){return new BPromise(function(_0x15adcc,_0xa8efc7){_0x58e55b=path['resolve'](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+_0x2e1a('0x37'));var _0x4582ee=Buffer[_0x2e1a('0x38')](_0x5d5882[_0x2e1a('0x39')],'base64');return fs[_0x2e1a('0x3a')](_0x58e55b,_0x4582ee,function(_0x5f11cf){_0xa8efc7(_0x5f11cf);},function(_0x418cfc){fs[_0x2e1a('0x2c')](_0x58e55b,'777');_0x15adcc(_0x418cfc);});});})[_0x2e1a('0x2b')](function(_0x43fda2){_0x5693b2=path[_0x2e1a('0x26')](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+_0x2e1a('0x28'));return convertFile(_0x58e55b,_0x5693b2);})['then'](function(){try{fs[_0x2e1a('0x1f')](_0x58e55b);fs['chmodSync'](_0x5693b2,'777');}catch(_0x32cb06){logger['error'](_0x32cb06);}logger[_0x2e1a('0x1d')](_0x2e1a('0x3b'),_0x5693b2[_0x2e1a('0x3c')]('.')[0x0]);return _0x5693b2[_0x2e1a('0x3c')]('.')[0x0];});};exports[_0x2e1a('0x3d')]=function(_0x1aaa6b,_0x254499){var _0x4715c2=_0x2e1a('0x3e');var _0xdb6f34,_0x17a490;var _0x1898d3;var _0x5637fd={'encoding':_0x2e1a('0x3f'),'method':_0x2e1a('0x35'),'timeout':0x2710,'url':_0x4715c2,'headers':{'Content-Type':_0x2e1a('0x40')},'body':_0x2e1a('0x41')+encodeURIComponent(JSON[_0x2e1a('0x42')]([[['jQ1olc',JSON[_0x2e1a('0x42')]([_0x1aaa6b,_0x254499||'en',![],_0x2e1a('0x43')]),null,'generic']]]))};return rp(_0x5637fd)[_0x2e1a('0x2b')](function(_0x336fd4){try{_0x1898d3=eval(_0x336fd4[_0x2e1a('0x44')](0x5))[0x0][0x2];}catch(_0x1a3a43){throw new Error('parse\x20response\x20failed:\x0a'+_0x336fd4[_0x2e1a('0x45')]);}if(!_0x1898d3){if(_0x1aaa6b[_0x2e1a('0x46')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x2e1a('0x47')+_0x254499+_0x2e1a('0x48'));}}try{_0x1898d3=eval(_0x1898d3)[0x0];}catch(_0x407d03){throw new Error(_0x2e1a('0x49')+res[_0x2e1a('0x45')]);}const _0x3fdeb2=_0x1898d3;_0xdb6f34=path['resolve'](__dirname,'tmp',rs[_0x2e1a('0x36')](0x4)+'.mp3');fs[_0x2e1a('0x29')](_0xdb6f34,_0x1898d3,{'encoding':_0x2e1a('0x2a')});_0x17a490=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0x2e1a('0x28'));return convertFile(_0xdb6f34,_0x17a490);})[_0x2e1a('0x2b')](function(){try{fs[_0x2e1a('0x1f')](_0xdb6f34);fs[_0x2e1a('0x2c')](_0x17a490,_0x2e1a('0x2d'));}catch(_0xe98025){logger[_0x2e1a('0x16')](_0xe98025);}logger['info'](_0x2e1a('0x4a'),_0x17a490['split']('.')[0x0]);return _0x17a490[_0x2e1a('0x3c')]('.')[0x0];});};exports[_0x2e1a('0x4b')]=function(_0xbdc93f,_0x4bc2b9,_0x20d5d0){return google[_0x2e1a('0x4c')](_0xbdc93f,_0x4bc2b9,_0x20d5d0)[_0x2e1a('0x2b')](function(_0x2f6cbf){logger['info'](_0x2f6cbf['uri']);return rp(_0x2f6cbf);})[_0x2e1a('0x2b')](function(_0x427231){var _0x3db9fd='';var _0x2c4ab1=0x0;try{fs[_0x2e1a('0x1f')](_0xbdc93f);}catch(_0x2f8a13){logger[_0x2e1a('0x16')](_0x2f8a13);}if(_0x427231&&_0x427231[_0x2e1a('0x4d')]){_0x3db9fd=_0x427231[_0x2e1a('0x4d')][_0x2e1a('0x4e')](function(_0x220cd4){return _0x220cd4&&_0x220cd4[_0x2e1a('0x4f')][0x0]&&_0x220cd4[_0x2e1a('0x4f')][0x0][_0x2e1a('0x50')]?_0x220cd4['alternatives'][0x0]['transcript']:'';})['join']('\x0a');_0x2c4ab1=_0x427231[_0x2e1a('0x4d')][_0x2e1a('0x4e')](function(_0x289a0e){return _0x289a0e&&_0x289a0e[_0x2e1a('0x4f')][0x0]&&_0x289a0e['alternatives'][0x0][_0x2e1a('0x51')]?_0x289a0e[_0x2e1a('0x4f')][0x0][_0x2e1a('0x51')]:0x0;})['join']('\x0a');}logger[_0x2e1a('0x1d')]('googleASR\x20transcription',_0x3db9fd);logger[_0x2e1a('0x1d')](_0x2e1a('0x52'),_0x2c4ab1);return{'transcript':_0x3db9fd,'confidence':_0x2c4ab1};})[_0x2e1a('0x53')](function(_0x4f48fd){logger[_0x2e1a('0x16')](_0x2e1a('0x54'),_0x4f48fd[_0x2e1a('0x18')],_0x4f48fd[_0x2e1a('0x55')],_0x4f48fd[_0x2e1a('0x56')]);});};exports[_0x2e1a('0x57')]=function(_0x4140fb,_0x2dc253,_0x3c9bef,_0x357d58){var _0xf26866=apiai(_0x2dc253,{'language':_0x357d58||'en'});return _0xf26866[_0x2e1a('0x58')](_0x3c9bef,{'sessionId':md5(_0x4140fb)})[_0x2e1a('0x2b')](function(_0xe022ea){logger[_0x2e1a('0x1d')](JSON[_0x2e1a('0x42')](_0xe022ea));return{'source':_0xe022ea[_0x2e1a('0x59')]['source'],'resolvedQuery':_0xe022ea[_0x2e1a('0x59')][_0x2e1a('0x5a')],'action':_0xe022ea[_0x2e1a('0x59')][_0x2e1a('0x5b')],'actionIncomplete':_0xe022ea[_0x2e1a('0x59')][_0x2e1a('0x5c')],'speech':_0xe022ea['result'][_0x2e1a('0x5d')][_0x2e1a('0x5e')],'score':_0xe022ea[_0x2e1a('0x59')][_0x2e1a('0x5f')],'statusCode':_0xe022ea[_0x2e1a('0x60')][_0x2e1a('0x61')],'endConversation':_0xe022ea[_0x2e1a('0x59')]['metadata']['endConversation']||![],'isFallbackIntent':_0xe022ea[_0x2e1a('0x59')][_0x2e1a('0x62')][_0x2e1a('0x63')]};});};exports['googleDialogflowV2']=function(_0x5f25a1,_0x846ab1,_0x2a35e8,_0x5f433d,_0x56898d,_0x5e6d92){var _0x26b6ae=_0x5f433d[_0x2e1a('0x64')](/\\n/g,'\x0a');var _0x5f4ea5={'credentials':{'private_key':_0x26b6ae,'client_email':_0x2a35e8}};var _0x19eb3b=new dialogflow[(_0x2e1a('0x65'))](_0x5f4ea5);var _0x3a4d91=_0x19eb3b[_0x2e1a('0x66')](_0x846ab1,md5(_0x5f25a1));var _0x45c4aa={'session':_0x3a4d91,'queryInput':{'text':{'text':_0x56898d,'languageCode':_0x5e6d92}}};return _0x19eb3b[_0x2e1a('0x67')](_0x45c4aa)[_0x2e1a('0x2b')](function(_0x31c4f8){if(_0x31c4f8&&_0x31c4f8['length']){logger['info'](_0x2e1a('0x68'),JSON[_0x2e1a('0x42')](_0x31c4f8));var _0x55ed0a=_0x31c4f8[0x0];if(_0x55ed0a){var _0x1fa0e8={'action':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x5b')],'allRequiredParamsPresent':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x6a')],'endConversation':_0x55ed0a[_0x2e1a('0x69')]['diagnosticInfo']&&_0x55ed0a['queryResult'][_0x2e1a('0x6b')]['fields']?_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x6b')][_0x2e1a('0x6c')][_0x2e1a('0x6d')][_0x2e1a('0x6e')]:![],'fulfillmentText':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x6f')],'intentName':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x70')][_0x2e1a('0x55')],'intentDisplayName':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x70')][_0x2e1a('0x71')],'isFallbackIntent':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x70')][_0x2e1a('0x72')],'languageCode':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x73')],'queryText':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x74')],'responseId':_0x55ed0a['responseId'],'score':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x75')],'speech':_0x55ed0a[_0x2e1a('0x69')][_0x2e1a('0x6f')],'providerResponse':JSON[_0x2e1a('0x42')](_0x31c4f8)};return _0x1fa0e8;}}});};exports['tildeASR']=function(_0x25700b,_0x541501,_0x25d2f9,_0x1618bd){return tilde['asr'](_0x25700b,_0x541501,_0x25d2f9,_0x1618bd)[_0x2e1a('0x2b')](function(_0x1cacde){try{fs[_0x2e1a('0x1f')](_0x25700b);}catch(_0x7ac625){logger[_0x2e1a('0x16')](_0x7ac625);}logger['info'](_0x2e1a('0x76'),_0x1cacde[_0x2e1a('0x50')]);logger['info']('Tilde\x20ASR\x20confidence',_0x1cacde[_0x2e1a('0x51')]);return _0x1cacde;});};exports[_0x2e1a('0x77')]=function(_0x1ec10b,_0x45b673,_0x1dad55,_0x5c1611,_0x3c3b77,_0x412fb3){var _0x6f7422=path['resolve'](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+'.mp3');var _0x373593;return aws['polly'](_0x1ec10b,_0x45b673,_0x1dad55,_0x5c1611,_0x3c3b77,_0x412fb3,_0x6f7422)['then'](function(){_0x373593=path[_0x2e1a('0x26')](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+_0x2e1a('0x28'));return convertFile(_0x6f7422,_0x373593);})[_0x2e1a('0x2b')](function(){try{fs['unlink'](_0x6f7422);fs['chmodSync'](_0x373593,_0x2e1a('0x2d'));}catch(_0x2f7fc5){logger[_0x2e1a('0x16')](_0x2f7fc5);}return _0x373593[_0x2e1a('0x3c')]('.')[0x0];});};exports[_0x2e1a('0x78')]=function(_0x1d1b60,_0x3ecf0a,_0x293e27,_0x51d891,_0x15a855,_0x3d8ce2){return aws[_0x2e1a('0x79')](_0x1d1b60,_0x3ecf0a,_0x293e27,_0x51d891,_0x15a855,_0x3d8ce2)[_0x2e1a('0x2b')](function(_0x44e6a0){logger['info'](JSON[_0x2e1a('0x42')](_0x44e6a0));return _0x44e6a0;});};exports[_0x2e1a('0x7a')]=function(_0x15e3f2,_0x22aaf4,_0x25949a,_0x5b1d1c){var _0xfa8a09=util[_0x2e1a('0x7b')](_0x2e1a('0x7c'),ISPEECH_API,_0x15e3f2,encodeURIComponent(_0x22aaf4),_0x25949a,_0x5b1d1c);var _0x2330ed=path[_0x2e1a('0x26')](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+'.mp3');var _0xe65736;return downloadFile(_0xfa8a09,_0x2330ed)[_0x2e1a('0x2b')](function(){_0xe65736=path['resolve'](__dirname,_0x2e1a('0x27'),rs[_0x2e1a('0x36')](0x4)+_0x2e1a('0x28'));return convertFile(_0x2330ed,_0xe65736);})[_0x2e1a('0x2b')](function(){try{fs[_0x2e1a('0x1f')](_0x2330ed);fs[_0x2e1a('0x2c')](_0xe65736,_0x2e1a('0x2d'));}catch(_0x598828){logger[_0x2e1a('0x16')](_0x598828);}return _0xe65736[_0x2e1a('0x3c')]('.')[0x0];});};exports[_0x2e1a('0x7d')]=function(_0x15e5ff,_0xa123e0,_0x650d88,_0x247c7c){var _0xb18ce0=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xa123e0,_0x650d88,base64Encode(_0x15e5ff),_0x247c7c?util[_0x2e1a('0x7b')](_0x2e1a('0x7e'),encodeURIComponent(_0x247c7c)):_0x2e1a('0x7f'));return uploadFile(_0xb18ce0)[_0x2e1a('0x2b')](function(_0x58c4c1){return querystring[_0x2e1a('0x80')](_0x58c4c1);});};exports['sestekNDA']=function(_0x33f2ad,_0xb52d68){return sestek[_0x2e1a('0x81')](_0x33f2ad,_0xb52d68)['then'](function(_0x13a2dd){logger[_0x2e1a('0x1d')](JSON[_0x2e1a('0x42')](_0x13a2dd));var _0x263787={'speech':_0x13a2dd['text'],'action':_0x13a2dd[_0x2e1a('0x82')]?_0x13a2dd[_0x2e1a('0x82')][_0x2e1a('0x83')]:undefined,'actiondata':_0x13a2dd[_0x2e1a('0x82')]?_0x13a2dd[_0x2e1a('0x82')][_0x2e1a('0x84')]:undefined};if(_0x13a2dd['channelData']&&_0x13a2dd[_0x2e1a('0x82')][_0x2e1a('0x85')]){return base64Decode(_0x13a2dd[_0x2e1a('0x82')][_0x2e1a('0x85')][_0x2e1a('0x86')],path[_0x2e1a('0x26')](__dirname,_0x2e1a('0x27'),rs['generate'](0x4)+_0x2e1a('0x28')))[_0x2e1a('0x2b')](function(_0x59ff19){_0x263787[_0x2e1a('0x87')]=_0x59ff19;return _0x263787;});}return _0x263787;});};exports[_0x2e1a('0x88')]=function(){return __dirname;}; \ No newline at end of file +var _0xc3c2=['intent','displayName','isFallback','queryText','responseId','fulfillmentText','Tilde\x20ASR\x20transcription','awsPolly','awsLex','lex','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./google','./sestek','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','tmp','.mp3','from','resolve','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','f.req=','stringify','jQ1olc','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','end_conversation'];(function(_0x2ed9fd,_0x1b95dc){var _0x4e1d99=function(_0x17f8b8){while(--_0x17f8b8){_0x2ed9fd['push'](_0x2ed9fd['shift']());}};_0x4e1d99(++_0x1b95dc);}(_0xc3c2,0x120));var _0x2c3c=function(_0x1e02bc,_0x31d02d){_0x1e02bc=_0x1e02bc-0x0;var _0x16bcd8=_0xc3c2[_0x1e02bc];return _0x16bcd8;};'use strict';var apiai=require(_0x2c3c('0x0'));var BPromise=require(_0x2c3c('0x1'));var dialogflow=require(_0x2c3c('0x2'));var fs=require('fs');var http=require(_0x2c3c('0x3'));var https=require(_0x2c3c('0x4'));var md5=require('md5');var path=require(_0x2c3c('0x5'));var querystring=require(_0x2c3c('0x6'));var rp=require(_0x2c3c('0x7'));var rs=require('randomstring');var sox=require(_0x2c3c('0x8'));var tts=require(_0x2c3c('0x9'));var urlParse=require(_0x2c3c('0xa'))[_0x2c3c('0xb')];var util=require(_0x2c3c('0xc'));var aws=require('./aws');var google=require(_0x2c3c('0xd'));var sestek=require(_0x2c3c('0xe'));var tilde=require('./tilde');var logger=require('../../../config/logger')(_0x2c3c('0xf'));var ISPEECH_API=_0x2c3c('0x10');function downloadFile(_0x390dc8,_0x19b592){return new BPromise(function(_0x3b97de,_0x33fef4){var _0x255f57=urlParse(_0x390dc8);var _0x549a2f=_0x255f57[_0x2c3c('0x11')]===_0x2c3c('0x12')?https:http;var _0x13c3bd={'host':_0x255f57[_0x2c3c('0x13')],'path':_0x255f57[_0x2c3c('0x5')],'headers':{'user-agent':_0x2c3c('0x14')}};_0x549a2f[_0x2c3c('0x15')](_0x13c3bd,function(_0x14b01c){if(_0x14b01c[_0x2c3c('0x16')]!==0xc8){logger[_0x2c3c('0x17')](_0x2c3c('0x18')+_0x390dc8+'\x20failed,\x20status\x20code\x20=\x20'+_0x14b01c['statusCode']+'\x20('+_0x14b01c[_0x2c3c('0x19')]+')');_0x33fef4(new Error('request\x20to\x20'+_0x390dc8+_0x2c3c('0x1a')+_0x14b01c[_0x2c3c('0x16')]+'\x20('+_0x14b01c[_0x2c3c('0x19')]+')'));return;}var _0x28e58d=fs[_0x2c3c('0x1b')](_0x19b592);_0x28e58d['on'](_0x2c3c('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x28e58d[_0x2c3c('0x1d')](_0x3b97de);});_0x28e58d['on'](_0x2c3c('0x17'),function(_0x324fbd){fs[_0x2c3c('0x1e')](_0x19b592);logger['error'](_0x2c3c('0x1f'),_0x324fbd);_0x33fef4(_0x324fbd);});_0x14b01c['pipe'](_0x28e58d);})['on'](_0x2c3c('0x17'),function(_0x507918){logger['error'](_0x507918);_0x33fef4(_0x507918);})[_0x2c3c('0x20')]();});}function uploadFile(_0x226700){return new BPromise(function(_0x46b358,_0x4139cc){var _0x58c18b=urlParse(_0x226700);var _0x1809da=_0x58c18b['protocol']==='https:'?https:http;var _0x29bb89={'host':_0x58c18b[_0x2c3c('0x13')],'path':_0x58c18b[_0x2c3c('0x5')],'headers':{'user-agent':_0x2c3c('0x14')}};_0x1809da[_0x2c3c('0x15')](_0x29bb89,function(_0x27e7f3){if(_0x27e7f3[_0x2c3c('0x16')]!==0xc8){_0x4139cc(new Error(_0x2c3c('0x18')+_0x226700+_0x2c3c('0x1a')+_0x27e7f3[_0x2c3c('0x16')]+'\x20('+_0x27e7f3[_0x2c3c('0x19')]+')'));return;}var _0x2966de='';_0x27e7f3['on'](_0x2c3c('0x21'),function(_0x441044){_0x2966de+=_0x441044;});_0x27e7f3['on']('end',function(){_0x46b358(_0x2966de);});})['on'](_0x2c3c('0x17'),function(_0xb7094f){_0x4139cc(_0xb7094f);})[_0x2c3c('0x20')]();});}function convertFile(_0x5b503c,_0x5d804d){return new BPromise(function(_0x2bc601,_0x4f9cff){var _0x137efc=sox[_0x2c3c('0x22')](_0x5b503c,_0x5d804d,{'sampleRate':0x1f40,'format':_0x2c3c('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x137efc['on'](_0x2c3c('0x17'),function(_0x37384c){logger['error'](_0x2c3c('0x24'),_0x37384c);_0x4f9cff(_0x37384c);});_0x137efc['on'](_0x2c3c('0x20'),function(){logger[_0x2c3c('0x25')](_0x2c3c('0x26'));_0x2bc601();});_0x137efc[_0x2c3c('0x27')]();});}function base64Decode(_0x17b660,_0x28f76c){var _0x2b1915=path['resolve'](__dirname,'tmp',rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x29'));fs[_0x2c3c('0x2a')](_0x2b1915,_0x17b660,_0x2c3c('0x2b'));return convertFile(_0x2b1915,_0x28f76c)[_0x2c3c('0x2c')](function(){try{fs[_0x2c3c('0x1e')](_0x2b1915);fs[_0x2c3c('0x2d')](_0x28f76c,_0x2c3c('0x2e'));}catch(_0x4c33e7){logger[_0x2c3c('0x17')](_0x4c33e7);}return _0x28f76c[_0x2c3c('0x2f')]('.')[0x0];});}function base64Encode(_0x5c311d){var _0x42048a=fs[_0x2c3c('0x30')](_0x5c311d);return new Buffer(_0x42048a)['toString']('base64');}exports['googleCloudTTS']=function(_0x51b42c,_0x5ce8b6,_0x5ed8f9,_0x3f4c2f,_0x132b21,_0x1a7bf3){var _0x4068bd,_0x45d5ac;var _0x307f32=_0x2c3c('0x31');var _0x197e47=_0x2c3c('0x32')+_0x51b42c;var _0x2c75c7={};if(_0x5ce8b6===_0x2c3c('0x33')){_0x2c75c7[_0x2c3c('0x34')]={'ssml':_0x5ed8f9};}else{_0x2c75c7[_0x2c3c('0x34')]={'text':_0x5ed8f9};};_0x2c75c7[_0x2c3c('0x35')]={'languageCode':_0x3f4c2f,'ssmlGender':_0x132b21};_0x2c75c7[_0x2c3c('0x36')]={'audioEncoding':_0x2c3c('0x37'),'sampleRateHertz':0x1f40};var _0x4687b2={'url':_0x307f32+_0x2c3c('0x38')+_0x197e47,'method':'POST','json':!![],'body':_0x2c75c7};return rp(_0x4687b2)[_0x2c3c('0x2c')](function(_0x5e3deb){return new BPromise(function(_0x45f0ab,_0x3e8cb2){_0x4068bd=path['resolve'](__dirname,_0x2c3c('0x39'),rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x3a'));var _0xb4e139=Buffer[_0x2c3c('0x3b')](_0x5e3deb['audioContent'],_0x2c3c('0x2b'));return fs['writeFile'](_0x4068bd,_0xb4e139,function(_0x126b24){_0x3e8cb2(_0x126b24);},function(_0x2d401b){fs[_0x2c3c('0x2d')](_0x4068bd,'777');_0x45f0ab(_0x2d401b);});});})[_0x2c3c('0x2c')](function(_0x3899ba){_0x45d5ac=path[_0x2c3c('0x3c')](__dirname,'tmp',rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x29'));return convertFile(_0x4068bd,_0x45d5ac);})['then'](function(){try{fs[_0x2c3c('0x1e')](_0x4068bd);fs['chmodSync'](_0x45d5ac,_0x2c3c('0x2e'));}catch(_0x2d7ffd){logger[_0x2c3c('0x17')](_0x2d7ffd);}logger['info'](_0x2c3c('0x3d'),_0x45d5ac[_0x2c3c('0x2f')]('.')[0x0]);return _0x45d5ac['split']('.')[0x0];});};exports['googleTTS']=function(_0xbbc5d3,_0x16b13b){var _0x7f606=_0x2c3c('0x3e');var _0x11caea,_0x3404b2;var _0x4e12f8;var _0x2162f1={'encoding':_0x2c3c('0x3f'),'method':_0x2c3c('0x40'),'timeout':0x2710,'url':_0x7f606,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x2c3c('0x41')+encodeURIComponent(JSON[_0x2c3c('0x42')]([[[_0x2c3c('0x43'),JSON[_0x2c3c('0x42')]([_0xbbc5d3,_0x16b13b||'en',![],_0x2c3c('0x44')]),null,'generic']]]))};return rp(_0x2162f1)[_0x2c3c('0x2c')](function(_0x3e3315){try{_0x4e12f8=eval(_0x3e3315['slice'](0x5))[0x0][0x2];}catch(_0x3cb035){throw new Error(_0x2c3c('0x45')+_0x3e3315['data']);}if(!_0x4e12f8){if(_0xbbc5d3[_0x2c3c('0x46')]>0xc8){throw new Error(_0x2c3c('0x47'));}else{throw new Error(_0x2c3c('0x48')+_0x16b13b+_0x2c3c('0x49'));}}try{_0x4e12f8=eval(_0x4e12f8)[0x0];}catch(_0x58beba){throw new Error(_0x2c3c('0x45')+res[_0x2c3c('0x21')]);}const _0xff0b98=_0x4e12f8;_0x11caea=path[_0x2c3c('0x3c')](__dirname,_0x2c3c('0x39'),rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x3a'));fs['writeFileSync'](_0x11caea,_0x4e12f8,{'encoding':'base64'});_0x3404b2=path[_0x2c3c('0x3c')](__dirname,_0x2c3c('0x39'),rs['generate'](0x4)+'.wav');return convertFile(_0x11caea,_0x3404b2);})[_0x2c3c('0x2c')](function(){try{fs['unlink'](_0x11caea);fs['chmodSync'](_0x3404b2,_0x2c3c('0x2e'));}catch(_0x36412c){logger[_0x2c3c('0x17')](_0x36412c);}logger[_0x2c3c('0x25')](_0x2c3c('0x4a'),_0x3404b2[_0x2c3c('0x2f')]('.')[0x0]);return _0x3404b2[_0x2c3c('0x2f')]('.')[0x0];});};exports[_0x2c3c('0x4b')]=function(_0x3aaf1c,_0x3ecc54,_0x1c7ffd){return google[_0x2c3c('0x4c')](_0x3aaf1c,_0x3ecc54,_0x1c7ffd)['then'](function(_0x4f4c40){logger[_0x2c3c('0x25')](_0x4f4c40[_0x2c3c('0x4d')]);return rp(_0x4f4c40);})[_0x2c3c('0x2c')](function(_0x1332e3){var _0x3cd405='';var _0x529708=0x0;try{fs[_0x2c3c('0x1e')](_0x3aaf1c);}catch(_0xdeceaf){logger[_0x2c3c('0x17')](_0xdeceaf);}if(_0x1332e3&&_0x1332e3[_0x2c3c('0x4e')]){_0x3cd405=_0x1332e3[_0x2c3c('0x4e')]['map'](function(_0x3629fe){return _0x3629fe&&_0x3629fe['alternatives'][0x0]&&_0x3629fe[_0x2c3c('0x4f')][0x0]['transcript']?_0x3629fe['alternatives'][0x0][_0x2c3c('0x50')]:'';})[_0x2c3c('0x51')]('\x0a');_0x529708=_0x1332e3[_0x2c3c('0x4e')][_0x2c3c('0x52')](function(_0x2a2778){return _0x2a2778&&_0x2a2778['alternatives'][0x0]&&_0x2a2778[_0x2c3c('0x4f')][0x0][_0x2c3c('0x53')]?_0x2a2778['alternatives'][0x0][_0x2c3c('0x53')]:0x0;})[_0x2c3c('0x51')]('\x0a');}logger[_0x2c3c('0x25')](_0x2c3c('0x54'),_0x3cd405);logger['info'](_0x2c3c('0x55'),_0x529708);return{'transcript':_0x3cd405,'confidence':_0x529708};})[_0x2c3c('0x56')](function(_0x8f0d8f){logger[_0x2c3c('0x17')](_0x2c3c('0x57'),_0x8f0d8f['statusCode'],_0x8f0d8f[_0x2c3c('0x58')],_0x8f0d8f['message']);});};exports[_0x2c3c('0x59')]=function(_0x58792b,_0x34fd7b,_0xad2ea8,_0x36b8e8){var _0x4741fe=apiai(_0x34fd7b,{'language':_0x36b8e8||'en'});return _0x4741fe[_0x2c3c('0x5a')](_0xad2ea8,{'sessionId':md5(_0x58792b)})[_0x2c3c('0x2c')](function(_0x305046){logger[_0x2c3c('0x25')](JSON[_0x2c3c('0x42')](_0x305046));return{'source':_0x305046[_0x2c3c('0x5b')][_0x2c3c('0x5c')],'resolvedQuery':_0x305046[_0x2c3c('0x5b')]['resolvedQuery'],'action':_0x305046['result'][_0x2c3c('0x5d')],'actionIncomplete':_0x305046[_0x2c3c('0x5b')][_0x2c3c('0x5e')],'speech':_0x305046['result'][_0x2c3c('0x5f')][_0x2c3c('0x60')],'score':_0x305046[_0x2c3c('0x5b')][_0x2c3c('0x61')],'statusCode':_0x305046[_0x2c3c('0x62')][_0x2c3c('0x63')],'endConversation':_0x305046[_0x2c3c('0x5b')][_0x2c3c('0x64')][_0x2c3c('0x65')]||![],'isFallbackIntent':_0x305046[_0x2c3c('0x5b')][_0x2c3c('0x64')][_0x2c3c('0x66')]};});};exports[_0x2c3c('0x67')]=function(_0x56d486,_0x5c0010,_0x4d47fc,_0x36a69e,_0xc26504,_0x5c265b){var _0x1bc8ff=_0x36a69e['replace'](/\\n/g,'\x0a');var _0x303075={'credentials':{'private_key':_0x1bc8ff,'client_email':_0x4d47fc}};var _0x114f54=new dialogflow[(_0x2c3c('0x68'))](_0x303075);var _0x21750f=_0x114f54[_0x2c3c('0x69')](_0x5c0010,md5(_0x56d486));var _0x8fe323={'session':_0x21750f,'queryInput':{'text':{'text':_0xc26504,'languageCode':_0x5c265b}}};return _0x114f54['detectIntent'](_0x8fe323)[_0x2c3c('0x2c')](function(_0x2d29b0){if(_0x2d29b0&&_0x2d29b0[_0x2c3c('0x46')]){logger[_0x2c3c('0x25')](_0x2c3c('0x6a'),JSON[_0x2c3c('0x42')](_0x2d29b0));var _0x416de9=_0x2d29b0[0x0];if(_0x416de9){var _0x3a02dd={'action':_0x416de9['queryResult'][_0x2c3c('0x5d')],'allRequiredParamsPresent':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x6c')],'endConversation':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x6d')]&&_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x6d')]['fields']?_0x416de9[_0x2c3c('0x6b')]['diagnosticInfo']['fields'][_0x2c3c('0x6e')]['boolValue']:![],'fulfillmentText':_0x416de9[_0x2c3c('0x6b')]['fulfillmentText'],'intentName':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x6f')]['name'],'intentDisplayName':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x6f')][_0x2c3c('0x70')],'isFallbackIntent':_0x416de9['queryResult'][_0x2c3c('0x6f')][_0x2c3c('0x71')],'languageCode':_0x416de9[_0x2c3c('0x6b')]['languageCode'],'queryText':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x72')],'responseId':_0x416de9[_0x2c3c('0x73')],'score':_0x416de9[_0x2c3c('0x6b')]['intentDetectionConfidence'],'speech':_0x416de9[_0x2c3c('0x6b')][_0x2c3c('0x74')],'providerResponse':JSON[_0x2c3c('0x42')](_0x2d29b0)};return _0x3a02dd;}}});};exports['tildeASR']=function(_0x1cf16a,_0x1ea1d3,_0x586f9c,_0x59ed64){return tilde[_0x2c3c('0x4c')](_0x1cf16a,_0x1ea1d3,_0x586f9c,_0x59ed64)[_0x2c3c('0x2c')](function(_0x3074ee){try{fs[_0x2c3c('0x1e')](_0x1cf16a);}catch(_0x71f449){logger[_0x2c3c('0x17')](_0x71f449);}logger[_0x2c3c('0x25')](_0x2c3c('0x75'),_0x3074ee[_0x2c3c('0x50')]);logger[_0x2c3c('0x25')]('Tilde\x20ASR\x20confidence',_0x3074ee[_0x2c3c('0x53')]);return _0x3074ee;});};exports[_0x2c3c('0x76')]=function(_0x5ba364,_0x117cb0,_0x446e64,_0x454d7d,_0x5e5787,_0xdae1df){var _0x48596f=path[_0x2c3c('0x3c')](__dirname,_0x2c3c('0x39'),rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x3a'));var _0x56cde0;return aws['polly'](_0x5ba364,_0x117cb0,_0x446e64,_0x454d7d,_0x5e5787,_0xdae1df,_0x48596f)['then'](function(){_0x56cde0=path['resolve'](__dirname,_0x2c3c('0x39'),rs['generate'](0x4)+'.wav');return convertFile(_0x48596f,_0x56cde0);})[_0x2c3c('0x2c')](function(){try{fs['unlink'](_0x48596f);fs[_0x2c3c('0x2d')](_0x56cde0,'777');}catch(_0x606e6a){logger[_0x2c3c('0x17')](_0x606e6a);}return _0x56cde0['split']('.')[0x0];});};exports[_0x2c3c('0x77')]=function(_0x547863,_0x123b9f,_0x140f12,_0x1ac460,_0x1685a8,_0x508092){return aws[_0x2c3c('0x78')](_0x547863,_0x123b9f,_0x140f12,_0x1ac460,_0x1685a8,_0x508092)['then'](function(_0x2d11b9){logger[_0x2c3c('0x25')](JSON[_0x2c3c('0x42')](_0x2d11b9));return _0x2d11b9;});};exports['ispeechTTS']=function(_0x224df8,_0x582c4e,_0x195565,_0xf8267f){var _0x3ae5a2=util[_0x2c3c('0x79')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x224df8,encodeURIComponent(_0x582c4e),_0x195565,_0xf8267f);var _0xb010ba=path[_0x2c3c('0x3c')](__dirname,'tmp',rs[_0x2c3c('0x28')](0x4)+'.mp3');var _0x25169a;return downloadFile(_0x3ae5a2,_0xb010ba)['then'](function(){_0x25169a=path[_0x2c3c('0x3c')](__dirname,_0x2c3c('0x39'),rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x29'));return convertFile(_0xb010ba,_0x25169a);})['then'](function(){try{fs[_0x2c3c('0x1e')](_0xb010ba);fs['chmodSync'](_0x25169a,_0x2c3c('0x2e'));}catch(_0x5ab15d){logger[_0x2c3c('0x17')](_0x5ab15d);}return _0x25169a[_0x2c3c('0x2f')]('.')[0x0];});};exports[_0x2c3c('0x7a')]=function(_0x4a8965,_0x53ca2b,_0x7631bc,_0x4a1e73){var _0x10d01c=util['format'](_0x2c3c('0x7b'),ISPEECH_API,_0x53ca2b,_0x7631bc,base64Encode(_0x4a8965),_0x4a1e73?util[_0x2c3c('0x79')]('model=%s',encodeURIComponent(_0x4a1e73)):_0x2c3c('0x7c'));return uploadFile(_0x10d01c)[_0x2c3c('0x2c')](function(_0x47f907){return querystring[_0x2c3c('0xb')](_0x47f907);});};exports['sestekNDA']=function(_0xcef179,_0x57891c){return sestek[_0x2c3c('0x7d')](_0xcef179,_0x57891c)[_0x2c3c('0x2c')](function(_0x1b7e65){logger[_0x2c3c('0x25')](JSON[_0x2c3c('0x42')](_0x1b7e65));var _0x4d7b5a={'speech':_0x1b7e65[_0x2c3c('0x7e')],'action':_0x1b7e65[_0x2c3c('0x7f')]?_0x1b7e65[_0x2c3c('0x7f')][_0x2c3c('0x80')]:undefined,'actiondata':_0x1b7e65[_0x2c3c('0x7f')]?_0x1b7e65[_0x2c3c('0x7f')][_0x2c3c('0x81')]:undefined};if(_0x1b7e65[_0x2c3c('0x7f')]&&_0x1b7e65['channelData'][_0x2c3c('0x82')]){return base64Decode(_0x1b7e65[_0x2c3c('0x7f')][_0x2c3c('0x82')][_0x2c3c('0x83')],path['resolve'](__dirname,_0x2c3c('0x39'),rs[_0x2c3c('0x28')](0x4)+_0x2c3c('0x29')))[_0x2c3c('0x2c')](function(_0x28b533){_0x4d7b5a['audiofile']=_0x28b533;return _0x4d7b5a;});}return _0x4d7b5a;});};exports[_0x2c3c('0x84')]=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 f61a191..5452fa3 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 _0x0f47=['./nda'];(function(_0x495804,_0x251efb){var _0x12526f=function(_0x116d9f){while(--_0x116d9f){_0x495804['push'](_0x495804['shift']());}};_0x12526f(++_0x251efb);}(_0x0f47,0xcb));var _0x70f4=function(_0x7ceebd,_0x184363){_0x7ceebd=_0x7ceebd-0x0;var _0x55523e=_0x0f47[_0x7ceebd];return _0x55523e;};var nda=require(_0x70f4('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x6eb7=['./nda'];(function(_0x39126a,_0x43e8f0){var _0x190435=function(_0x16c9f7){while(--_0x16c9f7){_0x39126a['push'](_0x39126a['shift']());}};_0x190435(++_0x43e8f0);}(_0x6eb7,0x191));var _0x76eb=function(_0x4dc470,_0x398c97){_0x4dc470=_0x4dc470-0x0;var _0xdfa0af=_0x6eb7[_0x4dc470];return _0xdfa0af;};var nda=require(_0x76eb('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index da71914..8840b25 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 _0xe630=['ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomActionData','custom_action_data','request-promise','url','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe630,0x149));var _0x0e63=function(_0x484404,_0x166aca){_0x484404=_0x484404-0x0;var _0x3c7ef5=_0xe630[_0x484404];return _0x3c7ef5;};'use strict';var rp=require(_0x0e63('0x0'));var url=require(_0x0e63('0x1'));var logger=require('../../../../../config/logger')(_0x0e63('0x2'));module[_0x0e63('0x3')]=function(_0x45c680,_0x500458){var _0x103691={'method':_0x0e63('0x4'),'uri':url[_0x0e63('0x5')](_0x500458['ndauth_url'],_0x0e63('0x6')),'form':{'grant_type':_0x0e63('0x7'),'username':_0x500458[_0x0e63('0x8')],'password':_0x500458[_0x0e63('0x7')]},'json':!![]};return rp(_0x103691)[_0x0e63('0x9')](function(_0x563ad9){var _0x35e304={'method':_0x0e63('0x4'),'uri':url[_0x0e63('0x5')](_0x500458[_0x0e63('0xa')],_0x0e63('0xb')),'body':{'type':_0x500458[_0x0e63('0xc')]||_0x0e63('0xd'),'channelId':_0x0e63('0xe'),'conversation':{'id':_0x45c680[_0x0e63('0xf')]},'from':{'id':_0x45c680[_0x0e63('0x10')],'name':_0x45c680[_0x0e63('0x11')]},'recipient':{'id':_0x45c680['dnid'],'name':_0x45c680[_0x0e63('0x12')]},'text':_0x500458[_0x0e63('0x13')],'channelData':{}},'headers':{'Authorization':_0x0e63('0x14')+_0x563ad9[_0x0e63('0x15')]},'json':!![]};if(_0x500458[_0x0e63('0x16')]){_0x35e304[_0x0e63('0x17')][_0x0e63('0x18')][_0x0e63('0x19')]=_0x500458[_0x0e63('0x16')];}if(_0x500458['ndagenerate_audio']=='1'){_0x35e304['body'][_0x0e63('0x18')][_0x0e63('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0e63('0x1b')};}if(_0x500458[_0x0e63('0x1c')]){_0x35e304[_0x0e63('0x17')][_0x0e63('0x18')]['CustomAction']=_0x500458['custom_action'];if(_0x500458['custom_action_data']){_0x35e304['body'][_0x0e63('0x18')][_0x0e63('0x1d')]=_0x500458[_0x0e63('0x1e')];}}logger['info'](JSON['stringify'](_0x35e304));return rp(_0x35e304);});}; \ No newline at end of file +var _0xfd3a=['dnid','extension','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfd3a,0x179));var _0xafd3=function(_0x4b8513,_0x2a04e4){_0x4b8513=_0x4b8513-0x0;var _0x390aca=_0xfd3a[_0x4b8513];return _0x390aca;};'use strict';var rp=require(_0xafd3('0x0'));var url=require(_0xafd3('0x1'));var logger=require(_0xafd3('0x2'))(_0xafd3('0x3'));module['exports']=function(_0x488608,_0x160b0d){var _0x26bd6c={'method':_0xafd3('0x4'),'uri':url[_0xafd3('0x5')](_0x160b0d[_0xafd3('0x6')],'/token'),'form':{'grant_type':_0xafd3('0x7'),'username':_0x160b0d[_0xafd3('0x8')],'password':_0x160b0d[_0xafd3('0x7')]},'json':!![]};return rp(_0x26bd6c)[_0xafd3('0x9')](function(_0xd2d780){var _0x4c4dcd={'method':'POST','uri':url[_0xafd3('0x5')](_0x160b0d[_0xafd3('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x160b0d[_0xafd3('0xb')]||_0xafd3('0xc'),'channelId':_0xafd3('0xd'),'conversation':{'id':_0x488608[_0xafd3('0xe')]},'from':{'id':_0x488608['callerid'],'name':_0x488608['calleridname']},'recipient':{'id':_0x488608[_0xafd3('0xf')],'name':_0x488608[_0xafd3('0x10')]},'text':_0x160b0d['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xd2d780[_0xafd3('0x11')]},'json':!![]};if(_0x160b0d['project']){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x14')]=_0x160b0d['project'];}if(_0x160b0d[_0xafd3('0x15')]=='1'){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xafd3('0x17')};}if(_0x160b0d[_0xafd3('0x18')]){_0x4c4dcd['body']['channelData']['CustomAction']=_0x160b0d[_0xafd3('0x18')];if(_0x160b0d[_0xafd3('0x19')]){_0x4c4dcd[_0xafd3('0x12')][_0xafd3('0x13')][_0xafd3('0x1a')]=_0x160b0d[_0xafd3('0x19')];}}logger[_0xafd3('0x1b')](JSON['stringify'](_0x4c4dcd));return rp(_0x4c4dcd);});}; \ 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 cd4f698..6b35f18 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 _0xa17f=['exports'];(function(_0x5a867f,_0x4ddbf2){var _0x9417c5=function(_0x1337fb){while(--_0x1337fb){_0x5a867f['push'](_0x5a867f['shift']());}};_0x9417c5(++_0x4ddbf2);}(_0xa17f,0x116));var _0xfa17=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xa17f[_0x39106e];return _0x892aec;};'use strict';var asr=require('./lib/api');module[_0xfa17('0x0')]=function(_0x4f870f,_0x9a3905,_0x3988ca,_0x5c3725){return asr(_0x4f870f,_0x9a3905,_0x3988ca,_0x5c3725);}; \ No newline at end of file +var _0xb293=['./lib/api'];(function(_0x3200f0,_0x1a7b9a){var _0x1717f1=function(_0x15bf64){while(--_0x15bf64){_0x3200f0['push'](_0x3200f0['shift']());}};_0x1717f1(++_0x1a7b9a);}(_0xb293,0x93));var _0x3b29=function(_0x15fd4d,_0x2a665e){_0x15fd4d=_0x15fd4d-0x0;var _0x31a652=_0xb293[_0x15fd4d];return _0x31a652;};'use strict';var asr=require(_0x3b29('0x0'));module['exports']=function(_0xb1a5ee,_0x32efb7,_0x4c4c60,_0xf6d59d){return asr(_0xb1a5ee,_0x32efb7,_0x4c4c60,_0xf6d59d);}; \ 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 ab25d84..418f90f 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 _0xdaed=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','stringify','Close\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','lodash','crypto','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','likelihood','Success.'];(function(_0xd73631,_0x9efa4){var _0xc34d41=function(_0x4b40cc){while(--_0x4b40cc){_0xd73631['push'](_0xd73631['shift']());}};_0xc34d41(++_0x9efa4);}(_0xdaed,0x1d3));var _0xddae=function(_0x2b7edc,_0x13ab63){_0x2b7edc=_0x2b7edc-0x0;var _0x39d5fa=_0xdaed[_0x2b7edc];return _0x39d5fa;};'use strict';var BPromise=require(_0xddae('0x0'));var _=require(_0xddae('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xddae('0x2'));var logger=require('../../../../../../config/logger')('agi');module['exports']=function(_0x25a9e5,_0x262b10,_0x5ab1e9,_0x382266){return new BPromise(function(_0x51d709,_0x1b403e){logger[_0xddae('0x3')](_0xddae('0x4'),_0x382266||_0xddae('0x5'));var _0xf7a09b=new WebSocket(_0x382266||_0xddae('0x5'),{'perMessageDeflate':![]});var _0x471604='';var _0x1c2c63='0';var _0x4c3f83='1';var _0x1d8cc7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x25d734(_0x321562){var _0xb13b2d=crypto[_0xddae('0x6')](_0xddae('0x7'));_0xb13b2d[_0xddae('0x8')](_0x321562);return _0xb13b2d[_0xddae('0x9')]('hex');}function _0x5d6ff7(){try{logger[_0xddae('0x3')](_0xddae('0xa'));var _0x38a95d=moment()[_0xddae('0xb')]();var _0x3d83a7=_0x25d734(_0x38a95d+_0x262b10+_0x5ab1e9);_0xf7a09b[_0xddae('0xc')](JSON['stringify']({'appID':_0x262b10,'timestamp':_0x38a95d,'appKey':_0x3d83a7}));var _0x576687=fs['createReadStream'](_0x25a9e5);_0x576687['on'](_0xddae('0xd'),function(_0x4603b6){_0xf7a09b[_0xddae('0xc')](_0x4603b6);});_0x576687['on'](_0xddae('0xe'),function(){_0xf7a09b[_0xddae('0xc')](_0xddae('0xf'));});}catch(_0x2641af){logger[_0xddae('0x10')](_0xddae('0x11'),JSON['stringify'](_0x2641af));_0xf7a09b[_0xddae('0x12')]();}}function _0x408601(_0x3bb80a){try{if(_0x3bb80a){var _0x3bf562=JSON[_0xddae('0x13')](_0x3bb80a);switch(_0x3bf562['status']){case 0x0:if(_0x3bf562[_0xddae('0x14')]){if(_0x3bf562[_0xddae('0x14')][_0xddae('0x15')]){logger[_0xddae('0x3')](_0xddae('0x16'),JSON['stringify'](_0x3bf562[_0xddae('0x14')]['hypotheses']));_0x471604=_0x3bf562[_0xddae('0x14')]['hypotheses'][0x0][_0xddae('0x17')];_0x1c2c63=_0x3bf562[_0xddae('0x14')][_0xddae('0x18')][0x0][_0xddae('0x19')];_0x4c3f83='0';_0x1d8cc7=_0xddae('0x1a');_0xf7a09b[_0xddae('0x12')]();}}break;case 0x1:logger[_0xddae('0x3')](_0xddae('0x1b'));_0x4c3f83='1';_0x1d8cc7='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4c3f83='2';_0x1d8cc7=_0xddae('0x1c');break;case 0x9:logger[_0xddae('0x3')](_0xddae('0x1d'));_0x4c3f83='9';_0x1d8cc7='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xddae('0x3')]('Authentication\x20failed.');_0x4c3f83='10';_0x1d8cc7=_0xddae('0x1e');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x4c3f83='11';_0x1d8cc7=_0xddae('0x1f');}}}catch(_0x288a53){logger[_0xddae('0x10')](_0xddae('0x20'),JSON[_0xddae('0x21')](_0x288a53));_0xf7a09b[_0xddae('0x12')]();}}function _0x12b135(){logger[_0xddae('0x3')](_0xddae('0x22'));_0x51d709({'transcript':_0x471604,'confidence':_0x1c2c63,'status':_0x4c3f83,'status_message':_0x1d8cc7});}function _0xe28b9(_0x158cbf){logger[_0xddae('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x158cbf)){logger[_0xddae('0x10')](_[_0xddae('0x23')](_0x158cbf)?JSON[_0xddae('0x21')](_0x158cbf):_0x158cbf);}}_0xf7a09b['on'](_0xddae('0x24'),_0x5d6ff7);_0xf7a09b['on'](_0xddae('0x25'),_0x408601);_0xf7a09b['on'](_0xddae('0xe'),_0x12b135);_0xf7a09b['on'](_0xddae('0x10'),_0xe28b9);});}; \ No newline at end of file +var _0x927d=['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.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','moment','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','transcript','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech'];(function(_0x5ee40b,_0xfd7a16){var _0xc63e99=function(_0x42cc81){while(--_0x42cc81){_0x5ee40b['push'](_0x5ee40b['shift']());}};_0xc63e99(++_0xfd7a16);}(_0x927d,0x113));var _0xd927=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x927d[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xd927('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xd927('0x1'));var crypto=require('crypto');var logger=require(_0xd927('0x2'))(_0xd927('0x3'));module[_0xd927('0x4')]=function(_0x5e1876,_0x3f1b11,_0x3b9552,_0x2c327a){return new BPromise(function(_0x18ad8b,_0x587785){logger['info'](_0xd927('0x5'),_0x2c327a||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x1ca6e5=new WebSocket(_0x2c327a||_0xd927('0x6'),{'perMessageDeflate':![]});var _0x3f2ccd='';var _0x53534f='0';var _0x249812='1';var _0x208089='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x3688aa(_0x2b06f1){var _0x5d194a=crypto[_0xd927('0x7')](_0xd927('0x8'));_0x5d194a[_0xd927('0x9')](_0x2b06f1);return _0x5d194a['digest'](_0xd927('0xa'));}function _0x14154a(){try{logger[_0xd927('0xb')](_0xd927('0xc'));var _0x6aa857=moment()[_0xd927('0xd')]();var _0x103c3d=_0x3688aa(_0x6aa857+_0x3f1b11+_0x3b9552);_0x1ca6e5[_0xd927('0xe')](JSON[_0xd927('0xf')]({'appID':_0x3f1b11,'timestamp':_0x6aa857,'appKey':_0x103c3d}));var _0x2e9c7f=fs['createReadStream'](_0x5e1876);_0x2e9c7f['on'](_0xd927('0x10'),function(_0x2af4b1){_0x1ca6e5[_0xd927('0xe')](_0x2af4b1);});_0x2e9c7f['on'](_0xd927('0x11'),function(){_0x1ca6e5[_0xd927('0xe')]('EOS');});}catch(_0x53b73f){logger['error'](_0xd927('0x12'),JSON[_0xd927('0xf')](_0x53b73f));_0x1ca6e5[_0xd927('0x13')]();}}function _0x107a99(_0x15cd7e){try{if(_0x15cd7e){var _0x2f345d=JSON['parse'](_0x15cd7e);switch(_0x2f345d[_0xd927('0x14')]){case 0x0:if(_0x2f345d[_0xd927('0x15')]){if(_0x2f345d[_0xd927('0x15')][_0xd927('0x16')]){logger[_0xd927('0xb')](_0xd927('0x17'),JSON[_0xd927('0xf')](_0x2f345d[_0xd927('0x15')]['hypotheses']));_0x3f2ccd=_0x2f345d[_0xd927('0x15')]['hypotheses'][0x0][_0xd927('0x18')];_0x53534f=_0x2f345d['result'][_0xd927('0x19')][0x0][_0xd927('0x1a')];_0x249812='0';_0x208089=_0xd927('0x1b');_0x1ca6e5[_0xd927('0x13')]();}}break;case 0x1:logger[_0xd927('0xb')](_0xd927('0x1c'));_0x249812='1';_0x208089=_0xd927('0x1c');break;case 0x2:logger[_0xd927('0xb')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x249812='2';_0x208089=_0xd927('0x1d');break;case 0x9:logger[_0xd927('0xb')](_0xd927('0x1e'));_0x249812='9';_0x208089='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info']('Authentication\x20failed.');_0x249812='10';_0x208089=_0xd927('0x1f');break;case 0xb:logger[_0xd927('0xb')](_0xd927('0x20'));_0x249812='11';_0x208089=_0xd927('0x20');}}}catch(_0x981e5a){logger[_0xd927('0x21')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x981e5a));_0x1ca6e5[_0xd927('0x13')]();}}function _0xc4d45d(){logger['info'](_0xd927('0x22'));_0x18ad8b({'transcript':_0x3f2ccd,'confidence':_0x53534f,'status':_0x249812,'status_message':_0x208089});}function _0x4b6b5a(_0x3dcedd){logger[_0xd927('0x21')](_0xd927('0x23'));if(!_['isNil'](_0x3dcedd)){logger[_0xd927('0x21')](_[_0xd927('0x24')](_0x3dcedd)?JSON[_0xd927('0xf')](_0x3dcedd):_0x3dcedd);}}_0x1ca6e5['on'](_0xd927('0x25'),_0x14154a);_0x1ca6e5['on']('message',_0x107a99);_0x1ca6e5['on']('close',_0xc4d45d);_0x1ca6e5['on'](_0xd927('0x21'),_0x4b6b5a);});}; \ 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 c8a94f9..50a6025 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 _0x68af=['exports'];(function(_0x3aba33,_0x2827ef){var _0x9d6c46=function(_0x30722b){while(--_0x30722b){_0x3aba33['push'](_0x3aba33['shift']());}};_0x9d6c46(++_0x2827ef);}(_0x68af,0x1b0));var _0xf68a=function(_0x12d224,_0x30616e){_0x12d224=_0x12d224-0x0;var _0x32c471=_0x68af[_0x12d224];return _0x32c471;};var asr=require('./asr');module[_0xf68a('0x0')]={'asr':asr}; \ No newline at end of file +var _0x83f1=['./asr','exports'];(function(_0x36acfb,_0x5854d8){var _0x9235f0=function(_0x48123c){while(--_0x48123c){_0x36acfb['push'](_0x36acfb['shift']());}};_0x9235f0(++_0x5854d8);}(_0x83f1,0x88));var _0x183f=function(_0x3cbf5a,_0x18716f){_0x3cbf5a=_0x3cbf5a-0x0;var _0xdfb97b=_0x83f1[_0x3cbf5a];return _0xdfb97b;};var asr=require(_0x183f('0x0'));module[_0x183f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index ed1fafe..5bb6faa 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 _0x64d8=['./channel','127.0.0.1','E_AGI_ARGUMENT_PORT','listen','emit','listening','connection','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy','ready','close','nextTick','inherits','exports','util','net','events','EventEmitter','./error'];(function(_0x2e7759,_0xf3445b){var _0x1ca035=function(_0x52c2fb){while(--_0x52c2fb){_0x2e7759['push'](_0x2e7759['shift']());}};_0x1ca035(++_0xf3445b);}(_0x64d8,0x1b4));var _0x864d=function(_0x5c3d11,_0x589686){_0x5c3d11=_0x5c3d11-0x0;var _0x31e455=_0x64d8[_0x5c3d11];return _0x31e455;};'use strict';var util=require(_0x864d('0x0'));var net=require(_0x864d('0x1'));var EventEmitter=require(_0x864d('0x2'))[_0x864d('0x3')];var AGIError=require(_0x864d('0x4'));var AGIChannel=require(_0x864d('0x5'));var AGIServer=function(_0x10c1f2,_0x5330b7,_0x3ccac2){var _0x4a9e77=this,_0x10c1f2=_0x10c1f2||0x11dd,_0x5330b7=_0x5330b7||_0x864d('0x6'),_0x1ec601=null,_0x48cdc5=0x0;EventEmitter['call'](_0x4a9e77);function _0x7890a(){if(!_0x10c1f2){_0x4a9e77['emit']('error',new AGIError(_0x864d('0x7')));return![];}_0x1ec601=net['createServer']();_0x1ec601[_0x864d('0x8')](_0x10c1f2,_0x5330b7);_0x1ec601['on']('listening',function(){_0x4a9e77[_0x864d('0x9')](_0x864d('0xa'));});_0x1ec601['on'](_0x864d('0xb'),function(_0x1ed87e){_0x1ec601['getConnections'](function(_0x47bd6f,_0x4f1c78){if(_0x47bd6f){_0x4a9e77['emit'](_0x864d('0xc'),new AGIError(_0x864d('0xd'),_0x47bd6f));}else if(_0x3ccac2&&_0x3ccac2<0x0){_0x4a9e77['emit'](_0x864d('0xc'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1ed87e['destroy']();}else if(_0x3ccac2&&_0x3ccac2>0x0&&_0x3ccac2<_0x4f1c78){_0x48cdc5+=0x1;_0x4a9e77[_0x864d('0x9')](_0x864d('0xc'),new AGIError(_0x864d('0xe'),_0x48cdc5));_0x1ed87e[_0x864d('0xf')]();}else{var _0x1305b2=new AGIChannel(_0x1ed87e);_0x1305b2['on'](_0x864d('0x10'),function(){_0x4a9e77['emit'](_0x864d('0xb'),_0x1305b2);});}});});_0x1ec601['on'](_0x864d('0xc'),function(_0x36c30a){_0x4a9e77[_0x864d('0x9')]('error',new AGIError(_0x864d('0xd'),_0x36c30a['code']));});_0x1ec601['on'](_0x864d('0x11'),function(){_0x4a9e77[_0x864d('0x9')](_0x864d('0x11'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x864d('0x12')](function(){_0x7890a();});};util[_0x864d('0x13')](AGIServer,EventEmitter);module[_0x864d('0x14')]=function(_0x5d414b,_0x11e4e5,_0x267b81){return new AGIServer(_0x5d414b,_0x11e4e5,_0x267b81);}; \ No newline at end of file +var _0xcc38=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x4b4755,_0x5e2832){var _0x338d9d=function(_0x280ac3){while(--_0x280ac3){_0x4b4755['push'](_0x4b4755['shift']());}};_0x338d9d(++_0x5e2832);}(_0xcc38,0x168));var _0x8cc3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcc38[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x8cc3('0x0'));var net=require(_0x8cc3('0x1'));var EventEmitter=require(_0x8cc3('0x2'))[_0x8cc3('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x8cc3('0x4'));var AGIServer=function(_0xf80db1,_0x308ad3,_0x206ae3){var _0x3cbe9f=this,_0xf80db1=_0xf80db1||0x11dd,_0x308ad3=_0x308ad3||'127.0.0.1',_0x429102=null,_0x54bcc5=0x0;EventEmitter[_0x8cc3('0x5')](_0x3cbe9f);function _0x4e1958(){if(!_0xf80db1){_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0x7'),new AGIError(_0x8cc3('0x8')));return![];}_0x429102=net[_0x8cc3('0x9')]();_0x429102[_0x8cc3('0xa')](_0xf80db1,_0x308ad3);_0x429102['on'](_0x8cc3('0xb'),function(){_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0xb'));});_0x429102['on'](_0x8cc3('0xc'),function(_0x3f4a49){_0x429102[_0x8cc3('0xd')](function(_0x393108,_0x2c6a28){if(_0x393108){_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0x7'),new AGIError(_0x8cc3('0xe'),_0x393108));}else if(_0x206ae3&&_0x206ae3<0x0){_0x3cbe9f['emit'](_0x8cc3('0x7'),new AGIError(_0x8cc3('0xf')));_0x3f4a49[_0x8cc3('0x10')]();}else if(_0x206ae3&&_0x206ae3>0x0&&_0x206ae3<_0x2c6a28){_0x54bcc5+=0x1;_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0x7'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x54bcc5));_0x3f4a49[_0x8cc3('0x10')]();}else{var _0x3c2c02=new AGIChannel(_0x3f4a49);_0x3c2c02['on'](_0x8cc3('0x11'),function(){_0x3cbe9f['emit'](_0x8cc3('0xc'),_0x3c2c02);});}});});_0x429102['on'](_0x8cc3('0x7'),function(_0x478f48){_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0x7'),new AGIError(_0x8cc3('0xe'),_0x478f48['code']));});_0x429102['on']('close',function(){_0x3cbe9f[_0x8cc3('0x6')](_0x8cc3('0x12'),new AGIError(_0x8cc3('0x13')));});}process[_0x8cc3('0x14')](function(){_0x4e1958();});};util[_0x8cc3('0x15')](AGIServer,EventEmitter);module[_0x8cc3('0x16')]=function(_0x3f88b2,_0x1a5e60,_0xf6304c){return new AGIServer(_0x3f88b2,_0x1a5e60,_0xf6304c);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3f1c14f..ec39b4d 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 _0x8742=['dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','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','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','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','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','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','127.0.0.1','system','command','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','join','path','util','lodash','odbc','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','ssmlGender','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','format','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','minutes','callback_priority','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','no\x20user\x20selected','DIAL','SIP/%s','opts','Executed\x20command\x20%s'];(function(_0xafbb43,_0x1bd799){var _0x40afa8=function(_0x85dd34){while(--_0x85dd34){_0xafbb43['push'](_0xafbb43['shift']());}};_0x40afa8(++_0x1bd799);}(_0x8742,0xe9));var _0x2874=function(_0x184aaa,_0x4b4b18){_0x184aaa=_0x184aaa-0x0;var _0xd574fb=_0x8742[_0x184aaa];return _0xd574fb;};'use strict';var fs=require('fs');var path=require(_0x2874('0x0'));var util=require(_0x2874('0x1'));var _=require(_0x2874('0x2'));var sh=require('shelljs');var odbc=require(_0x2874('0x3'))();var rs=require('randomstring');var moment=require('moment');var Mustache=require(_0x2874('0x4'));var rp=require(_0x2874('0x5'));var logger=require(_0x2874('0x6'))(_0x2874('0x7'));var config=require(_0x2874('0x8'));var scripts=require(_0x2874('0x9'));var FILES_PATH=_0x2874('0xa');var recursiveMapAttributes=['rawHeaders',_0x2874('0xb')];var verticesWithRetry=[_0x2874('0xc'),'getdigits',_0x2874('0xd')];var AGIVertices=function(_0x23f55b,_0x1cbca2,_0x47b465){this[_0x2874('0xe')]=_0x23f55b;this[_0x2874('0xf')]=_0x1cbca2;this[_0x2874('0x10')]=_0x47b465;};AGIVertices['prototype'][_0x2874('0x11')]=function(_0x1a2bfd,_0x199e25){this[_0x2874('0xf')][_0x2874('0x12')](_0x1a2bfd)[_0x2874('0x13')](function(_0x322212){_0x199e25(null,_0x322212?_0x322212[_0x2874('0x14')]:![]);})[_0x2874('0x15')](function(_0x1e5cd1){_0x199e25(_0x1e5cd1);});};AGIVertices[_0x2874('0x16')][_0x2874('0x17')]=function(_0xa9efa3,_0x2c5afa){this[_0x2874('0xf')][_0x2874('0x18')](_0xa9efa3)[_0x2874('0x13')](function(_0x1304e9){_0x2c5afa(null,_0x1304e9?_0x1304e9[_0x2874('0x14')]:![]);})[_0x2874('0x15')](function(_0x59f353){_0x2c5afa(_0x59f353);});};AGIVertices[_0x2874('0x16')]['getSquareProject']=function(_0x33cd69,_0x14f8dd){this[_0x2874('0xf')]['getSquareProjectById'](_0x33cd69)[_0x2874('0x13')](function(_0x4bdb0e){_0x14f8dd(null,_0x4bdb0e?_0x4bdb0e[_0x2874('0x14')]:![]);})['catch'](function(_0x2c37e9){_0x14f8dd(_0x2c37e9);});};AGIVertices[_0x2874('0x16')]['getSquareOdbc']=function(_0x373e5c,_0x4c2fe4){this[_0x2874('0xf')][_0x2874('0x19')](_0x373e5c)['then'](function(_0x3ec61b){_0x4c2fe4(null,_0x3ec61b?_0x3ec61b[_0x2874('0x1a')]:![]);})['catch'](function(_0x72dd96){_0x4c2fe4(_0x72dd96);});};AGIVertices[_0x2874('0x16')][_0x2874('0x1b')]=function(_0x20a3e5,_0x15adbb){this['rpc'][_0x2874('0x1c')](_0x20a3e5)[_0x2874('0x13')](function(_0x5c0285){_0x15adbb(null,_0x5c0285?_0x5c0285[_0x2874('0x14')]:![]);})[_0x2874('0x15')](function(_0x801d5b){_0x15adbb(_0x801d5b);});};AGIVertices['prototype'][_0x2874('0x1d')]=function(_0x366144,_0x19cac2){this[_0x2874('0xf')]['getTrunkById'](_0x366144)[_0x2874('0x13')](function(_0x36645b){_0x19cac2(null,_0x36645b?_0x36645b[_0x2874('0x14')]:![]);})[_0x2874('0x15')](function(_0x22efae){_0x19cac2(_0x22efae);});};AGIVertices[_0x2874('0x16')]['getSound']=function(_0x3a98bf,_0x10f535){var _0x2000ea=this;this[_0x2874('0xf')][_0x2874('0x1e')](_0x3a98bf)[_0x2874('0x13')](function(_0x53ece2){_0x10f535(null,_0x53ece2?_0x2000ea[_0x2874('0x1f')](_0x53ece2[_0x2874('0x20')]):![]);})['catch'](function(_0x2b2010){_0x10f535(_0x2b2010);});};AGIVertices[_0x2874('0x16')][_0x2874('0x21')]=function(_0x14d836,_0x2a803f){this[_0x2874('0xf')][_0x2874('0x22')](_0x14d836)[_0x2874('0x13')](function(_0x3c1f94){_0x2a803f(null,_0x3c1f94?_0x3c1f94:![]);})['catch'](function(_0x34e0bf){_0x2a803f(_0x34e0bf);});};AGIVertices[_0x2874('0x16')][_0x2874('0x23')]=function(_0x8b08ce,_0x2c6ec0,_0xa7c3bc){this[_0x2874('0x10')][_0x2874('0x23')](_0x8b08ce,_0x2c6ec0)['then'](function(){_0xa7c3bc(null);})['catch'](function(_0x4b6528){_0xa7c3bc(_0x4b6528);});};AGIVertices['prototype']['getIntervals']=function(_0x53f574,_0x2a01e7){this[_0x2874('0xf')][_0x2874('0x24')](_0x53f574)[_0x2874('0x13')](function(_0x3efd04){if(_0x3efd04){if(_0x3efd04['IntervalId']){_0x2a01e7(null,[_0x3efd04[_0x2874('0x25')]]);}else{_0x2a01e7(null,_[_0x2874('0x26')](_0x3efd04[_0x2874('0x27')],_0x2874('0x25')));}}else{_0x2a01e7(null,![]);}})[_0x2874('0x15')](function(_0x5e94bc){_0x2a01e7(_0x5e94bc);});};AGIVertices[_0x2874('0x16')][_0x2874('0x1f')]=function(_0x216a1e){return util['format'](_0x2874('0x28'),FILES_PATH,_0x216a1e);};AGIVertices['prototype'][_0x2874('0x29')]=function(_0x5f2c76,_0x4e70af,_0x13c7bc){odbc['open'](_0x5f2c76,function(_0x31c675){if(_0x31c675){logger[_0x2874('0x2a')](_0x2874('0x2b'),_0x31c675);_0x13c7bc(_0x31c675);}else{logger[_0x2874('0x2c')](_0x2874('0x2d'));odbc[_0x2874('0x2e')](_0x4e70af,function(_0x2628fe,_0x201cf5){if(_0x2628fe){logger['info']('Error\x20executing\x20query\x20%s',_0x4e70af);_0x13c7bc(_0x2628fe);}else{logger[_0x2874('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x4e70af);odbc[_0x2874('0x2f')](function(_0x36b6aa){if(_0x36b6aa){logger[_0x2874('0x2a')](_0x2874('0x30'),_0x36b6aa);}_0x13c7bc(null,_0x201cf5);});}});}});};AGIVertices[_0x2874('0x16')][_0x2874('0x31')]=function(_0x44ed3a,_0x334f50){this['rpc'][_0x2874('0x32')](_0x44ed3a)[_0x2874('0x13')](function(_0x5e8221){_0x334f50(null,_0x5e8221?_0x5e8221:![]);})[_0x2874('0x15')](function(_0x45d870){_0x334f50(_0x45d870);});};AGIVertices[_0x2874('0x16')]['createSmsMessage']=function(_0xc33446,_0x411531){this['rpc'][_0x2874('0x33')](_0xc33446)[_0x2874('0x13')](function(_0x56c703){_0x411531(null,_0x56c703);})['catch'](function(_0x4d18f3){_0x411531(_0x4d18f3);});};AGIVertices[_0x2874('0x16')][_0x2874('0x34')]=function(_0x30721a,_0x500c19,_0x27a523){this[_0x2874('0xf')]['createSquareDetailsReport']({'uniqueid':this['channel']['uniqueid'],'node':_0x30721a[_0x2874('0x35')],'application':_0x30721a[_0x2874('0x36')],'data':_0x500c19||null,'project_name':this[_0x2874('0xe')][_0x2874('0x37')],'callerid':this['channel'][_0x2874('0x38')]})[_0x2874('0x13')](function(_0xd5c0d){if(_0x27a523){_0x27a523(null,_0xd5c0d);}})[_0x2874('0x15')](function(_0x515a63){if(_0x27a523){_0x27a523(_0x515a63);}});};AGIVertices[_0x2874('0x16')][_0x2874('0x39')]=function(_0x803ccd,_0x404054,_0x28692d,_0x1559b2){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x2874('0x3a')],'callerid':this[_0x2874('0xe')][_0x2874('0x38')],'calleridname':this[_0x2874('0xe')]['calleridname'],'context':this[_0x2874('0xe')][_0x2874('0x3b')],'extension':this[_0x2874('0xe')][_0x2874('0x3c')],'priority':this[_0x2874('0xe')][_0x2874('0x3d')],'accountcode':this['channel'][_0x2874('0x3e')],'dnid':this[_0x2874('0xe')][_0x2874('0x3f')],'projectName':this[_0x2874('0xe')][_0x2874('0x37')],'saveName':_0x404054,'filename':_0x803ccd[_0x2874('0x40')]||_0x404054,'savePath':_0x28692d})[_0x2874('0x13')](function(_0x562af1){_0x1559b2(null,_0x562af1);})[_0x2874('0x15')](function(_0x130baf){_0x1559b2(_0x130baf);});};AGIVertices['prototype'][_0x2874('0x41')]=function(_0x5c6e97,_0x2e9f6a,_0x10a9eb,_0x2183a5,_0x317c8a){this['rpc']['createSquareMessage']({'uniqueid':this[_0x2874('0xe')][_0x2874('0x3a')],'body':_0x5c6e97,'direction':_0x2e9f6a,'providerName':_0x10a9eb,'providerResponse':_0x2183a5})[_0x2874('0x13')](function(_0x112420){if(_0x317c8a){_0x317c8a(null,_0x112420);}})[_0x2874('0x15')](function(_0x2d1ee6){if(_0x317c8a){_0x317c8a(_0x2d1ee6);}});};AGIVertices[_0x2874('0x16')][_0x2874('0x42')]=function(_0x4c7b3e,_0x413d5f){this['rpc'][_0x2874('0x42')]({'firstName':_[_0x2874('0x43')](_0x4c7b3e['name'])||_[_0x2874('0x44')](_0x4c7b3e[_0x2874('0x14')])?_0x2874('0x45')+Math[_0x2874('0x46')]():_0x4c7b3e[_0x2874('0x14')],'lastName':_[_0x2874('0x43')](_0x4c7b3e[_0x2874('0x47')])||_[_0x2874('0x44')](_0x4c7b3e[_0x2874('0x47')])?null:_0x4c7b3e[_0x2874('0x47')],'phone':_0x4c7b3e[_0x2874('0x48')],'ListId':_0x4c7b3e['list_id'],'scheduledat':_0x4c7b3e[_0x2874('0x49')],'callbackUniqueid':this['channel'][_0x2874('0x3a')],'tags':_0x2874('0x4a'),'description':_0x2874('0x4b')+_0x4c7b3e[_0x2874('0x49')][_0x2874('0x4c')](),'priority':_0x4c7b3e['callback_priority']})[_0x2874('0x13')](function(_0x22f4d1){_0x413d5f(null,_0x22f4d1);})[_0x2874('0x15')](function(_0x1cd94e){_0x413d5f(_0x1cd94e);});};AGIVertices['prototype']['getPause']=function(_0x569f49,_0x2c36f1){this[_0x2874('0xf')]['getPauseById'](_0x569f49)['then'](function(_0x4339a5){_0x2c36f1(null,_0x4339a5?_0x4339a5[_0x2874('0x14')]:![]);})['catch'](function(_0x40ae95){_0x2c36f1(_0x40ae95);});};AGIVertices[_0x2874('0x16')][_0x2874('0x4d')]=function(_0x34a5fb,_0x378801,_0x49140b){var _0x4902e8={'role':_0x2874('0x4e')};_0x4902e8[_0x34a5fb]=this['channel'][_0x2874('0x38')];this['rpc'][_0x2874('0x4d')](_0x4902e8,_0x378801,this[_0x2874('0xe')]['uniqueid'])['then'](function(_0x39df29){_0x49140b(null,_[_0x2874('0x44')](_0x39df29)?![]:!![]);})[_0x2874('0x15')](function(_0xe9ffdc){logger[_0x2874('0x2a')](_0xe9ffdc);_0x49140b(null,![]);});};AGIVertices[_0x2874('0x16')]['agentUnpause']=function(_0x3a96d1,_0x3d1a13){var _0x2b5b1b={'role':_0x2874('0x4e')};_0x2b5b1b[_0x3a96d1]=this[_0x2874('0xe')]['callerid'];this[_0x2874('0xf')][_0x2874('0x4f')](_0x2b5b1b)[_0x2874('0x13')](function(_0x137e9f){_0x3d1a13(null,_[_0x2874('0x44')](_0x137e9f)?![]:!![]);})['catch'](function(_0x4e76c1){logger[_0x2874('0x2a')](_0x4e76c1);_0x3d1a13(null,![]);});};AGIVertices[_0x2874('0x16')][_0x2874('0x50')]=function(_0x1f1769,_0x1f647d){var _0x1186b7={'role':_0x2874('0x4e')};_0x1186b7[_0x1f1769]=this['channel'][_0x2874('0x38')];this['rpc'][_0x2874('0x50')](_0x1186b7)[_0x2874('0x13')](function(_0x457fec){_0x1f647d(null,_[_0x2874('0x44')](_0x457fec)?![]:!![]);})[_0x2874('0x15')](function(_0x4f5f02){logger[_0x2874('0x2a')](_0x4f5f02);_0x1f647d(null,![]);});};AGIVertices[_0x2874('0x16')][_0x2874('0x51')]=function(_0x3af850,_0x1895c1){var _0x3d723e={'role':'agent'};_0x3d723e[_0x3af850]=this[_0x2874('0xe')][_0x2874('0x38')];var _0x47a07b=_0x3af850!=_0x2874('0x52')?util['format'](_0x2874('0x53'),_0x2874('0x54'),this[_0x2874('0xe')][_0x2874('0x38')]):undefined;this[_0x2874('0xf')][_0x2874('0x51')](_0x3d723e,_0x47a07b)['then'](function(_0x416542){_0x1895c1(null,_['isNil'](_0x416542)?![]:!![]);})['catch'](function(_0x3b8da0){logger[_0x2874('0x2a')](_0x3b8da0);_0x1895c1(null,![]);});};AGIVertices[_0x2874('0x16')][_0x2874('0x55')]=function(_0x1dd546,_0x5c6fd9){sh[_0x2874('0x56')](_[_0x2874('0x57')](_0x1dd546),function(_0x45e081,_0x41f642){var _0x518cf3=_0x41f642[_0x2874('0x58')](/(\r\n|\n|\r)/gm,'');_0x5c6fd9(null,_0x518cf3);});};AGIVertices[_0x2874('0x16')]['googleCloudTTS']=function(_0x250523,_0x48d937){scripts[_0x2874('0x59')](_0x250523[_0x2874('0x5a')],_0x250523[_0x2874('0x5b')]||_0x2874('0x5c'),_0x250523[_0x2874('0x5c')],_0x250523['languageCode']||'en-US',_0x250523[_0x2874('0x5d')]||'MALE',_0x250523[_0x2874('0x5e')]||_0x2874('0x5f'))['then'](function(_0x9b36d7){_0x48d937(null,_0x9b36d7);})[_0x2874('0x15')](function(_0x2721d0){_0x48d937(_0x2721d0);});};AGIVertices['prototype']['googleTTS']=function(_0xf34720,_0x2174d2){scripts[_0x2874('0x60')](_0xf34720['text'],_0xf34720[_0x2874('0x61')]||'en',0x1)[_0x2874('0x13')](function(_0x1b48fb){_0x2174d2(null,_0x1b48fb);})['catch'](function(_0x24033b){_0x2174d2(_0x24033b);});};AGIVertices[_0x2874('0x16')][_0x2874('0x62')]=function(_0x4d460f,_0x704963){var _0x1736f1={'uri':_0x4d460f[_0x2874('0x63')],'method':_0x4d460f[_0x2874('0x64')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4d460f[_0x2874('0x65')])===_0x2874('0x66')&&parseInt(_0x4d460f['timeout'])>=0x1?parseInt(_0x4d460f['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x2874('0x67')]([_0x2874('0x68'),_0x2874('0x69')],_0x1736f1['method'][_0x2874('0x6a')]())){try{_0x1736f1['body']=_0x4d460f[_0x2874('0xb')]?JSON[_0x2874('0x6b')](_0x4d460f[_0x2874('0xb')]):{};}catch(_0x121a86){logger[_0x2874('0x2a')](_0x2874('0x6c'),_0x121a86);}}try{_0x1736f1[_0x2874('0x6d')]=_0x4d460f[_0x2874('0x6e')]?JSON[_0x2874('0x6b')](_0x4d460f[_0x2874('0x6e')]):{};}catch(_0x449850){logger[_0x2874('0x2a')](_0x2874('0x6f'),_0x449850);}if(_0x4d460f[_0x2874('0x70')]){try{var _0xed9568=require(_0x4d460f[_0x2874('0x70')])[_0x2874('0x71')](this,_0x1736f1);_0x1736f1[_0x2874('0x72')]=Mustache[_0x2874('0x73')](_0x4d460f[_0x2874('0x63')],_0xed9568,{},['$$','$$']);if(_0x1736f1['headers']){_0x1736f1['headers']=JSON['parse'](Mustache['render'](JSON[_0x2874('0x74')](_0x1736f1[_0x2874('0x6d')]),_0xed9568,{},['$$','$$']));}if(_0x1736f1['body']){_0x1736f1[_0x2874('0x75')]=JSON[_0x2874('0x6b')](Mustache[_0x2874('0x73')](JSON[_0x2874('0x74')](_0x1736f1[_0x2874('0x75')]),_0xed9568,{},['$$','$$']));}}catch(_0x1261b8){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1261b8);}}rp(_0x1736f1)['then'](function(_0x687ce8){var _0x193a78={'statusCode':_0x687ce8[_0x2874('0x76')]||0xc8,'statusMessage':_0x687ce8['statusMessage']||'OK','headers':_0x687ce8[_0x2874('0x6d')]||{},'body':_0x687ce8['body']||{}};_0x704963(null,_0x193a78);})[_0x2874('0x15')](function(_0x245196){var _0x1d625f={'statusCode':_0x245196[_0x2874('0x76')]||0x1f4,'statusMessage':_0x245196[_0x2874('0x77')]||_0x2874('0x78'),'headers':_0x245196[_0x2874('0x79')][_0x2874('0x6d')]||{},'body':_0x245196[_0x2874('0x79')][_0x2874('0x75')]||{}};_0x704963(null,_0x1d625f);});};AGIVertices['prototype'][_0x2874('0x7a')]=function(_0x2ae5ce,_0x38da10){scripts[_0x2874('0x7a')](this[_0x2874('0xe')]['uniqueid'],_0x2ae5ce[_0x2874('0x7b')],_0x2ae5ce[_0x2874('0x5c')],_0x2ae5ce[_0x2874('0x7c')]||'en')[_0x2874('0x13')](function(_0x28382d){_0x38da10(null,_0x28382d);})[_0x2874('0x15')](function(_0x3c82f5){_0x38da10(_0x3c82f5);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x2ad5c5,_0x24c399){scripts[_0x2874('0x7d')](this[_0x2874('0xe')][_0x2874('0x3a')],_0x2ad5c5['dialogflowV2_project_id'],_0x2ad5c5[_0x2874('0x7e')],_0x2ad5c5[_0x2874('0x7f')],_0x2ad5c5[_0x2874('0x5c')],_0x2ad5c5[_0x2874('0x80')]||'en')[_0x2874('0x13')](function(_0x5bf2ff){_0x24c399(null,_0x5bf2ff);})[_0x2874('0x15')](function(_0x4bd5a1){_0x24c399(_0x4bd5a1);});};AGIVertices['prototype']['sestekNDA']=function(_0x2331bf,_0x40ac41){scripts[_0x2874('0x81')](this[_0x2874('0xe')],_0x2331bf)['then'](function(_0x5839dc){_0x40ac41(null,_0x5839dc);})['catch'](function(_0x2912ab){_0x40ac41(_0x2912ab);});};AGIVertices[_0x2874('0x16')][_0x2874('0x82')]=function(_0x497a18,_0x5e36ba){scripts['ispeechTTS'](_0x497a18[_0x2874('0x7b')],_0x497a18[_0x2874('0x5c')],_0x497a18[_0x2874('0x83')]||_0x2874('0x84'),_0x497a18['speed'])[_0x2874('0x13')](function(_0x4a4532){_0x5e36ba(null,_0x4a4532);})[_0x2874('0x15')](function(_0x39d7b2){_0x5e36ba(_0x39d7b2);});};AGIVertices[_0x2874('0x16')][_0x2874('0x85')]=function(_0x113ee3,_0x125405,_0x350c0f){scripts[_0x2874('0x85')](_0x125405,_0x113ee3[_0x2874('0x7b')],_0x113ee3[_0x2874('0x86')]||'en-US',this['isConfigured'](_0x113ee3['model'])?_0x113ee3[_0x2874('0x87')]:undefined)[_0x2874('0x13')](function(_0x9fd0a3){_0x350c0f(null,_0x9fd0a3);})[_0x2874('0x15')](function(_0x40e208){_0x350c0f(_0x40e208);});};AGIVertices[_0x2874('0x16')][_0x2874('0x88')]=function(_0x516a7b,_0x8913bb){scripts['awsPolly'](_0x516a7b[_0x2874('0x89')],_0x516a7b[_0x2874('0x8a')],_0x516a7b[_0x2874('0x8b')],_0x516a7b[_0x2874('0x8c')]||_0x2874('0x8d'),_0x516a7b['text'],_0x516a7b[_0x2874('0x8e')]||_0x2874('0x5c'))[_0x2874('0x13')](function(_0x4d61d7){_0x8913bb(null,_0x4d61d7);})[_0x2874('0x15')](function(_0x3e83d5){_0x8913bb(_0x3e83d5);});};AGIVertices[_0x2874('0x16')]['awsLex']=function(_0x2b6907,_0x5094ec){scripts['awsLex'](this['channel'][_0x2874('0x3a')],_0x2b6907[_0x2874('0x89')],_0x2b6907[_0x2874('0x8a')],_0x2b6907['aws_lex_region'],_0x2b6907[_0x2874('0x5c')],_0x2b6907[_0x2874('0x8f')])[_0x2874('0x13')](function(_0x817595){_0x5094ec(null,_0x817595);})[_0x2874('0x15')](function(_0x2b5918){_0x5094ec(_0x2b5918);});};AGIVertices[_0x2874('0x16')][_0x2874('0x90')]=function(_0x47ef89,_0x1530cd,_0x3dc964){scripts[_0x2874('0x90')](_0x1530cd,_0x47ef89[_0x2874('0x7b')],_0x47ef89[_0x2874('0x91')]||_0x2874('0x84'))[_0x2874('0x13')](function(_0xe5c2ed){_0x3dc964(null,_0xe5c2ed);})[_0x2874('0x15')](function(_0xa34a79){_0x3dc964(_0xa34a79);});};AGIVertices[_0x2874('0x16')][_0x2874('0x92')]=function(_0x3a74ff,_0x418dd0,_0x25ccc5){scripts[_0x2874('0x92')](_0x418dd0,_0x3a74ff['appid'],_0x3a74ff[_0x2874('0x93')],_0x3a74ff[_0x2874('0x72')])['then'](function(_0x41fc47){_0x25ccc5(null,_0x41fc47);})['catch'](function(_0x5c6fdf){_0x25ccc5(_0x5c6fdf);});};AGIVertices[_0x2874('0x16')]['clear']=function(_0x2bc08){var _0x30a5ef=_[_0x2874('0x67')](verticesWithRetry,_0x2bc08['agicommand'])?_0x2bc08:_[_0x2874('0x94')](_0x2bc08);for(var _0x56c9b8 in _0x30a5ef){if(_0x30a5ef[_0x2874('0x95')](_0x56c9b8)){if(_0x30a5ef[_0x56c9b8]&&_[_0x2874('0x96')](_0x30a5ef[_0x56c9b8])){if(_[_0x2874('0x67')](recursiveMapAttributes,_0x56c9b8)){_0x30a5ef[_0x56c9b8]=this[_0x2874('0x97')](_0x30a5ef[_0x56c9b8]);}else{_0x30a5ef[_0x56c9b8]=this[_0x2874('0x98')](_0x30a5ef[_0x56c9b8]);}}}}return _0x30a5ef;};AGIVertices[_0x2874('0x16')][_0x2874('0x99')]=function(_0x4bd7c6){for(var _0x4a5838 in _0x4bd7c6){if(_0x4bd7c6['hasOwnProperty'](_0x4a5838)){if(_[_0x2874('0x9a')](_0x4bd7c6[_0x4a5838])){this['recursiveNodeIndex'](_0x4bd7c6[_0x4a5838]);}else if(_[_0x2874('0x9b')](_0x4bd7c6[_0x4a5838])){for(var _0x4dcb5c=0x0;_0x4dcb5c<_0x4bd7c6[_0x4a5838]['length'];_0x4dcb5c++){this[_0x2874('0x99')](_0x4bd7c6[_0x4a5838][_0x4dcb5c]);}}else if(_[_0x2874('0x96')](_0x4bd7c6[_0x4a5838])){_0x4bd7c6[_0x4a5838]=this[_0x2874('0x98')](_0x4bd7c6[_0x4a5838]);}}}};AGIVertices[_0x2874('0x16')]['saveRestApiResult']=function(_0x1f1bf4,_0x101cc7){for(var _0x3a0712 in _0x1f1bf4){if(_0x1f1bf4[_0x2874('0x95')](_0x3a0712)){if(_[_0x2874('0x9a')](_0x1f1bf4[_0x3a0712])){if(!_['isEmpty'](_0x1f1bf4[_0x3a0712])){this[_0x2874('0x9c')](_0x1f1bf4[_0x3a0712],util['format'](_0x2874('0x9d'),_0x101cc7,_0x3a0712));}}else if(_[_0x2874('0x9b')](_0x1f1bf4[_0x3a0712])){for(var _0x4517ae=0x0;_0x4517ae<_0x1f1bf4[_0x3a0712][_0x2874('0x9e')];_0x4517ae++){this[_0x2874('0x9c')](_0x1f1bf4[_0x3a0712][_0x4517ae],util[_0x2874('0x9f')](_0x2874('0x9d'),_0x101cc7,_0x3a0712+'['+_0x4517ae+']'));}}else{if(!_[_0x2874('0x44')](_0x1f1bf4[_0x3a0712])){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0x9d'),_0x101cc7,_0x3a0712),_0x1f1bf4[_0x3a0712]);}}}}};AGIVertices[_0x2874('0x16')]['replaceObjectAllVariables']=function(_0x470d82){try{var _0x12d2a1=JSON[_0x2874('0x6b')](_0x470d82);this[_0x2874('0x99')](_0x12d2a1);return JSON[_0x2874('0x74')](_0x12d2a1);}catch(_0x4f6703){return this['replaceAllVariables'](_0x470d82);}};AGIVertices[_0x2874('0x16')][_0x2874('0x98')]=function(_0x2ea1d6){var _0x202f3f=_0x2ea1d6[_0x2874('0xa1')]('{');for(var _0x33c84f=0x1;_0x33c84f<_0x202f3f[_0x2874('0x9e')];_0x33c84f+=0x1){var _0x190362=_0x202f3f[_0x33c84f]['split']('}');if(_0x190362[_0x2874('0x9e')]>0x1){_0x2ea1d6=_0x2ea1d6[_0x2874('0xa2')]('{'+_0x190362[0x0]+'}',this['channel']['getVariable'](_0x190362[0x0])[_0x2874('0xa3')]||_0x190362[0x0]);}}if(_0x202f3f[_0x2874('0x9e')]===0x1){return _0x2ea1d6[_0x2874('0x4c')]();}return this[_0x2874('0x98')](_0x2ea1d6);};AGIVertices[_0x2874('0x16')][_0x2874('0xa4')]=function(_0x186e91,_0x91258a){var _0x55a505=this['channel']['getVariable'](_0x186e91);if(_0x55a505[_0x2874('0xa5')]===-0x1){return _0x55a505;}logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xa6'),_0x91258a,_0x55a505[_0x2874('0xa3')]));return this['channel']['setVariable'](_0x91258a,_0x55a505['extra']);};AGIVertices[_0x2874('0x16')][_0x2874('0xa7')]=function(_0x3771c8){return _0x3771c8&&_0x3771c8!=='0'&&_0x3771c8!=='-1'&&_0x3771c8!=='';};AGIVertices['prototype'][_0x2874('0xa8')]=function(_0x4a47b1){this[_0x2874('0x34')]['sync'](this,_0x4a47b1,'-');_0x4a47b1[_0x2874('0xa9')]=_0x4a47b1[_0x2874('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x2874('0x16')][_0x2874('0xaa')]=function(_0x5f2beb){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xab'),_0x5f2beb[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x5f2beb[_0x2874('0x5c')])){return this['channel'][_0x2874('0xac')](_0x2874('0xad'));}var _0x48e654='\x22'+_0x5f2beb[_0x2874('0x5c')]+'\x22';if(this['isConfigured'](_0x5f2beb[_0x2874('0x79')])){_0x48e654+=','+_0x5f2beb[_0x2874('0x79')];}var _0x5c1750=this['channel'][_0x2874('0x56')](_0x2874('0xae'),_0x48e654);if(_0x5c1750[_0x2874('0xa5')]===-0x1){return _0x5c1750;}return this['channel']['noop'](util['format'](_0x2874('0xaf'),_0x48e654));};AGIVertices[_0x2874('0x16')][_0x2874('0xb0')]=function(_0x505f3e){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x505f3e[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x505f3e[_0x2874('0xb1')])){return this['channel'][_0x2874('0xac')](_0x2874('0xb2'));}var _0x42bc27=_0x505f3e['grammar'];if(this[_0x2874('0xa7')](_0x505f3e[_0x2874('0x79')])){_0x42bc27+=','+_0x505f3e['options'];}var _0x40330f=this['channel'][_0x2874('0x56')](_0x2874('0xb3'),_0x42bc27);if(_0x40330f[_0x2874('0xa5')]===-0x1){return _0x40330f;}var _0x57ea76=this[_0x2874('0xa4')](_0x2874('0xb4'),_0x2874('0xb5'));if(_0x57ea76['result']===-0x1){return _0x57ea76;}var _0x5c1efc=this[_0x2874('0xa4')](_0x2874('0xb6'),'MRCP_RECOG_TRANSCRIPT');if(_0x5c1efc['result']===-0x1){return _0x5c1efc;}var _0x61cc37=this[_0x2874('0xa4')]('RECOG_INSTANCE()',_0x2874('0xb7'));if(_0x61cc37[_0x2874('0xa5')]===-0x1){return _0x61cc37;}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xb8'),_0x42bc27));};AGIVertices['prototype'][_0x2874('0x7')]=function(_0x186191){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xb9'),_0x186191[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0x7')]([_0x186191['command'],_0x186191[_0x2874('0xba')]]);};AGIVertices[_0x2874('0x16')][_0x2874('0xbb')]=function(_0x15491f){logger[_0x2874('0x2c')](util['format'](_0x2874('0xbc'),_0x15491f[_0x2874('0x35')]));if(this[_0x2874('0xa7')](_0x15491f[_0x2874('0x65')])){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xbd'),_0x15491f[_0x2874('0x65')]));var _0x5532a4=this[_0x2874('0xe')]['wait'](_0x15491f[_0x2874('0x65')]);if(_0x5532a4[_0x2874('0xa5')]===-0x1){return _0x5532a4;}}return this[_0x2874('0xe')]['answer']();};AGIVertices['prototype'][_0x2874('0x4a')]=function(_0x3299f8){logger['info'](util[_0x2874('0x9f')](_0x2874('0xbe'),_0x3299f8[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x3299f8[_0x2874('0xbf')])){return this[_0x2874('0xe')]['error'](_0x3299f8,_0x2874('0xc0'));}_0x3299f8[_0x2874('0x49')]=moment();if(this[_0x2874('0xa7')](_0x3299f8['delay'])){_0x3299f8[_0x2874('0x49')]=moment()[_0x2874('0xc1')](_0x3299f8['delay'],_0x2874('0xc2'));}if(!this[_0x2874('0xa7')](_0x3299f8['callback_priority'])){_0x3299f8[_0x2874('0xc3')]=0x2;}this[_0x2874('0x42')][_0x2874('0x71')](this,_0x3299f8);return this[_0x2874('0xe')][_0x2874('0xac')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3299f8[_0x2874('0x48')],_0x3299f8[_0x2874('0xbf')],_0x3299f8['scheduledAt']));};AGIVertices[_0x2874('0x16')]['custom_app']=function(_0x102b22){logger[_0x2874('0x2c')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x102b22[_0x2874('0x35')]));var _0x197c29=this['channel'][_0x2874('0x56')](_0x102b22[_0x2874('0xc4')],_0x102b22['options']);if(_0x197c29[_0x2874('0xa5')]===-0x1){return _0x197c29;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0xc5'),_0x102b22[_0x2874('0xc4')],_0x102b22[_0x2874('0x79')]));};AGIVertices[_0x2874('0x16')][_0x2874('0xc6')]=function(_0x47d2c4){logger['info'](util[_0x2874('0x9f')](_0x2874('0xc7'),_0x47d2c4[_0x2874('0x35')]));if(!this['isConfigured'](_0x47d2c4[_0x2874('0x5c')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xad'));}var _0x5e589d='\x22'+_0x47d2c4[_0x2874('0x5c')]+'\x22';if(this[_0x2874('0xa7')](_0x47d2c4[_0x2874('0x79')])){_0x5e589d+=','+_0x47d2c4[_0x2874('0x79')];}var _0x3f7351=this[_0x2874('0xe')]['exec'](_0x2874('0xae'),_0x5e589d);if(_0x3f7351['result']===-0x1){return _0x3f7351;}return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0xaf'),_0x5e589d));};AGIVertices[_0x2874('0x16')][_0x2874('0xc8')]=function(_0x372798){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x372798[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x372798['text'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xad'));}var _0x4285a3='\x22'+_0x372798[_0x2874('0x5c')]+'\x22';if(this['isConfigured'](_0x372798[_0x2874('0x79')])){_0x4285a3+=','+_0x372798[_0x2874('0x79')];}var _0x56ebc4=this['channel'][_0x2874('0x56')](_0x2874('0xae'),_0x4285a3);if(_0x56ebc4[_0x2874('0xa5')]===-0x1){return _0x56ebc4;}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xaf'),_0x4285a3));};AGIVertices['prototype'][_0x2874('0xc9')]=function(_0x1fbf56){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xca'),_0x1fbf56[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x1fbf56[_0x2874('0xb1')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xb2'));}var _0x12a90d=_0x1fbf56[_0x2874('0xb1')];if(this[_0x2874('0xa7')](_0x1fbf56[_0x2874('0x79')])){_0x12a90d+=','+_0x1fbf56[_0x2874('0x79')];}var _0x2152c6=this['channel']['exec'](_0x2874('0xb3'),_0x12a90d);if(_0x2152c6['result']===-0x1){return _0x2152c6;}var _0x708251=this[_0x2874('0xa4')](_0x2874('0xb4'),'LUMENVOX_ASR_CONFIDENCE');if(_0x708251[_0x2874('0xa5')]===-0x1){return _0x708251;}var _0x224839=this['getAndSetVariable'](_0x2874('0xb6'),_0x2874('0xcb'));if(_0x224839[_0x2874('0xa5')]===-0x1){return _0x224839;}var _0x5ce532=this[_0x2874('0xa4')]('RECOG_INSTANCE()',_0x2874('0xcc'));if(_0x5ce532['result']===-0x1){return _0x5ce532;}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xb8'),_0x12a90d));};AGIVertices['prototype'][_0x2874('0xcd')]=function(_0x2f5c82){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0xce'),_0x2f5c82[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x2f5c82[_0x2874('0xb1')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xb2'));}var _0x42eccb=_0x2f5c82[_0x2874('0xb1')];if(this[_0x2874('0xa7')](_0x2f5c82[_0x2874('0x79')])){_0x42eccb+=','+_0x2f5c82[_0x2874('0x79')];}var _0x432d48=this[_0x2874('0xe')][_0x2874('0x56')]('MRCPRecog',_0x42eccb);if(_0x432d48['result']===-0x1){return _0x432d48;}var _0x5b0c31=this[_0x2874('0xa4')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x5b0c31['result']===-0x1){return _0x5b0c31;}var _0x4912d2=this[_0x2874('0xa4')](_0x2874('0xb6'),_0x2874('0xcf'));if(_0x4912d2[_0x2874('0xa5')]===-0x1){return _0x4912d2;}var _0x339b3a=this[_0x2874('0xa4')](_0x2874('0xd0'),'SESTEK_ASR_INSTANCE');if(_0x339b3a[_0x2874('0xa5')]===-0x1){return _0x339b3a;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x42eccb));};AGIVertices[_0x2874('0x16')][_0x2874('0xd1')]=function(_0x341dbd){logger[_0x2874('0x2c')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x341dbd[_0x2874('0x35')]));if(!this['isConfigured'](_0x341dbd[_0x2874('0xd2')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x341dbd,_0x2874('0xd3'));}var _0x23f42a=this['getSquareOdbc']['sync'](this,_0x341dbd[_0x2874('0xd2')]);if(!_0x23f42a){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x341dbd,_0x2874('0xd4'));}if(!this['isConfigured'](_0x341dbd[_0x2874('0x2e')])){return this['channel'][_0x2874('0x2a')](_0x341dbd,_0x2874('0xd5'));}var _0x5686ea=_0x341dbd[_0x2874('0x2e')][_0x2874('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('query:\x20%s',_0x5686ea));var _0x5d455d=this[_0x2874('0x29')][_0x2874('0x71')](this,_0x23f42a,_0x5686ea);this[_0x2874('0x34')][_0x2874('0x71')](this,_0x341dbd,_0x5686ea);if(!this[_0x2874('0xa7')](_0x341dbd[_0x2874('0xd6')])){return this['channel'][_0x2874('0xac')](_0x2874('0xd7'));}var _0x36c1f5=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x341dbd[_0x2874('0xd6')]);if(!_0x36c1f5){return this['channel'][_0x2874('0x2a')](_0x341dbd,'no\x20variable\x20found');}var _0x569bda=this;_0x5d455d['forEach'](function(_0x2e1cf6,_0x58d76d){Object[_0x2874('0xd8')](_0x2e1cf6)[_0x2874('0xd9')](function(_0x4997fa){_0x569bda[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0xda'),_0x36c1f5,_0x58d76d,_0x4997fa),_0x2e1cf6[_0x4997fa]);});});this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0xdb'),_0x36c1f5),_0x5d455d[_0x2874('0x9e')]);return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xdc'),_0x36c1f5));};AGIVertices[_0x2874('0x16')]['dial']=function(_0x2cd785){logger[_0x2874('0xdd')](util[_0x2874('0x9f')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2cd785['label']));if(!this[_0x2874('0xa7')](_0x2cd785[_0x2874('0xde')])){return this[_0x2874('0xe')]['error'](_0x2cd785,_0x2874('0xdf'));}var _0x495ee0=this['getUser'][_0x2874('0x71')](this,_0x2cd785[_0x2874('0xde')]);if(!_0x495ee0){return this['channel'][_0x2874('0x2a')](_0x2cd785,'no\x20user\x20found');}var _0x441427=this[_0x2874('0xe')][_0x2874('0x56')](_0x2874('0xe0'),[util[_0x2874('0x9f')](_0x2874('0xe1'),_0x495ee0),_0x2cd785[_0x2874('0x65')],_0x2cd785[_0x2874('0xe2')],_0x2cd785[_0x2874('0x63')]]);if(_0x441427[_0x2874('0xa5')]===-0x1){return _0x441427;}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xe3'),_0x2874('0xe0')));};AGIVertices['prototype'][_0x2874('0xe4')]=function(_0x260ebc){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x260ebc[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x260ebc[_0x2874('0x7b')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xe5'));}if(!this['isConfigured'](_0x260ebc['text'])){return this[_0x2874('0xe')]['noop'](_0x2874('0xad'));}this[_0x2874('0xe')][_0x2874('0xe6')]=!![];this['createSquareDetailsReport'](_0x260ebc);this[_0x2874('0x41')](_0x260ebc[_0x2874('0x5c')],'in','','');this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xe7'),_0x260ebc[_0x2874('0x5c')]));var _0x4cac49=this['googleDialogflow'][_0x2874('0x71')](this,_0x260ebc);if(_0x4cac49){for(var _0x101087 in _0x4cac49){if(_0x4cac49['hasOwnProperty'](_0x101087)){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0xe8'),_0x101087[_0x2874('0x6a')]()),_0x4cac49[_0x101087]);}}this[_0x2874('0x41')](_0x4cac49[_0x2874('0xe9')],_0x2874('0xea'),'dialogflow','');return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xeb'),_0x4cac49[_0x2874('0xe9')]));}return this['channel'][_0x2874('0x2a')](_0x260ebc,_0x2874('0xec'));};AGIVertices['prototype'][_0x2874('0xed')]=function(_0x6e48fd){logger[_0x2874('0x2c')](util['format'](_0x2874('0xee'),_0x6e48fd[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x6e48fd['dialogflowV2_project_id'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xef'));}if(!this[_0x2874('0xa7')](_0x6e48fd[_0x2874('0x7e')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xf0'));}if(!this[_0x2874('0xa7')](_0x6e48fd[_0x2874('0x7f')])){return this['channel']['noop'](_0x2874('0xf1'));}if(!this[_0x2874('0xa7')](_0x6e48fd['dialogflowV2_language'])){return this[_0x2874('0xe')]['noop']('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x6e48fd['text'])){return this[_0x2874('0xe')]['noop'](_0x2874('0xad'));}this[_0x2874('0xe')][_0x2874('0xe6')]=!![];this[_0x2874('0x34')](_0x6e48fd);this[_0x2874('0x41')](_0x6e48fd[_0x2874('0x5c')],'in','','');this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0xf2'),_0x6e48fd['text']));var _0x31ad28=this[_0x2874('0x7d')][_0x2874('0x71')](this,_0x6e48fd);if(_0x31ad28){for(var _0x5ebd1a in _0x31ad28){if(_0x31ad28[_0x2874('0x95')](_0x5ebd1a)){if(_0x5ebd1a!==_0x2874('0xf3')){this[_0x2874('0xe')][_0x2874('0xa0')](util['format'](_0x2874('0xe8'),_0x5ebd1a['toUpperCase']()),_0x31ad28[_0x5ebd1a]);}}}this[_0x2874('0x41')](_0x31ad28[_0x2874('0xe9')],_0x2874('0xea'),_0x2874('0xed'),_0x31ad28[_0x2874('0xf3')]);return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0xf4'),_0x31ad28[_0x2874('0xe9')]));}return this[_0x2874('0xe')]['error'](_0x6e48fd,_0x2874('0xf5'));};AGIVertices[_0x2874('0x16')][_0x2874('0xf6')]=function(_0x2af425){logger[_0x2874('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2af425[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x2af425[_0x2874('0xf7')])){return this['channel'][_0x2874('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x2874('0xa7')](_0x2af425[_0x2874('0xf8')])){return this['channel'][_0x2874('0xac')](_0x2874('0xf9'));}if(!this[_0x2874('0xa7')](_0x2af425[_0x2874('0xfa')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xfb'));}if(!this[_0x2874('0xa7')](_0x2af425[_0x2874('0xfc')])){return this[_0x2874('0xe')]['noop']('no\x20text\x20configured');}this[_0x2874('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x2af425);this['createSquareMessage'](_0x2af425[_0x2874('0x5c')],'in','','');this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xfd'),_0x2af425[_0x2874('0x5c')]));var _0x40ece9=this[_0x2874('0x81')]['sync'](this,_0x2af425);if(_0x40ece9){for(var _0x231a0d in _0x40ece9){if(_0x40ece9['hasOwnProperty'](_0x231a0d)){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0xfe'),_0x231a0d[_0x2874('0x6a')]()),_0x40ece9[_0x231a0d]);}}this['createSquareMessage'](_0x40ece9[_0x2874('0xe9')],_0x2874('0xea'),_0x2874('0xf6'),'');if(_0x40ece9[_0x2874('0xff')]){this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x100'),_0x40ece9[_0x2874('0xff')]));var _0x1a651e=this[_0x2874('0xe')][_0x2874('0x101')](_0x40ece9[_0x2874('0xff')]);try{fs[_0x2874('0x102')](_0x40ece9['audiofile']+'.wav');}catch(_0x4630e4){logger[_0x2874('0x2a')](_0x4630e4);}return _0x1a651e;}else{return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x103'),_0x40ece9[_0x2874('0xe9')]));}}return this[_0x2874('0xe')][_0x2874('0x2a')](_0x2af425,_0x2874('0x104'));};AGIVertices[_0x2874('0x16')]['end']=function(_0x5c9d0a){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x105'),_0x5c9d0a[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x106'));};AGIVertices[_0x2874('0x16')][_0x2874('0x107')]=function(_0x3e092e){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3e092e[_0x2874('0x35')]));var _0x4fe1f6='';if(_0x3e092e['trunk_id']){if(!this[_0x2874('0xa7')](_0x3e092e[_0x2874('0x108')])){return this['channel'][_0x2874('0x2a')](_0x3e092e,_0x2874('0x109'));}else{var _0x8c0b81=parseInt(_0x3e092e['trunk_id'],0xa);if(isNaN(_0x8c0b81)){_0x4fe1f6=_0x3e092e[_0x2874('0x108')];}else{_0x4fe1f6=this[_0x2874('0x1d')][_0x2874('0x71')](this,_0x3e092e[_0x2874('0x108')]);if(!_0x4fe1f6){return this['channel'][_0x2874('0x2a')](_0x3e092e,'no\x20trunk\x20found');}}}}else if(_0x3e092e[_0x2874('0x10a')]){_0x4fe1f6=_0x3e092e[_0x2874('0x10a')];}else{return this[_0x2874('0xe')][_0x2874('0x2a')](_0x3e092e,_0x2874('0x109'));}var _0x1865ee=this[_0x2874('0xe')][_0x2874('0x56')]('DIAL',[util[_0x2874('0x9f')](_0x2874('0x10b'),_0x4fe1f6,_0x3e092e['phone']),_0x3e092e[_0x2874('0x65')],_0x3e092e[_0x2874('0xe2')],_0x3e092e[_0x2874('0x63')]]);if(_0x1865ee[_0x2874('0xa5')]===-0x1){return _0x1865ee;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0xe3'),_0x2874('0xe0')));};AGIVertices[_0x2874('0x16')][_0x2874('0x10c')]=function(_0x286e26){logger[_0x2874('0x2c')](util['format'](_0x2874('0x10d'),_0x286e26[_0x2874('0x35')]));return this['channel'][_0x2874('0xac')]('finally');};AGIVertices['prototype'][_0x2874('0x10e')]=function(_0x20f9db){logger['info'](util[_0x2874('0x9f')](_0x2874('0x10f'),_0x20f9db[_0x2874('0x35')]));if(_0x20f9db[_0x2874('0xa9')]===0x0){return this['maxRetry'](_0x20f9db);}_0x20f9db[_0x2874('0xa9')]-=0x1;if(!this['isConfigured'](_0x20f9db[_0x2874('0x110')])){return this[_0x2874('0xe')]['error'](_0x20f9db,_0x2874('0x111'));}var _0x2d7c31=this[_0x2874('0x112')]['sync'](this,_0x20f9db[_0x2874('0x110')]);if(!_0x2d7c31){return this['channel']['error'](_0x20f9db,_0x2874('0x113'));}if(!this[_0x2874('0xa7')](_0x20f9db[_0x2874('0xd6')])){return this[_0x2874('0xe')][_0x2874('0x2a')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1f7d1c=this['channel'][_0x2874('0x114')](_0x2d7c31,_0x20f9db[_0x2874('0x115')],_0x20f9db[_0x2874('0x116')]);var _0x3315d6=_0x1f7d1c[_0x2874('0xa5')]?_0x1f7d1c[_0x2874('0xa5')][_0x2874('0x4c')]():'';logger['info'](_0x2874('0x117'),JSON[_0x2874('0x74')](_0x1f7d1c));if(_0x1f7d1c['result']===-0x1){this[_0x2874('0x34')][_0x2874('0x71')](this,_0x20f9db,_0x3315d6);return _0x1f7d1c;}else if(_0x1f7d1c[_0x2874('0xa3')]===_0x2874('0x65')){_0x1f7d1c['result']=_0x3315d6[_0x2874('0x9e')]>=parseInt(_0x20f9db['mindigit'])?'x':'i';}else{_0x1f7d1c[_0x2874('0xa5')]=_0x3315d6[_0x2874('0x9e')]>=parseInt(_0x20f9db[_0x2874('0x118')])&&_0x3315d6[_0x2874('0x9e')]<=parseInt(_0x20f9db[_0x2874('0x116')])?'x':'i';}var _0x4c42e1=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x20f9db['variable_id']);if(!_0x4c42e1){return this['channel'][_0x2874('0x2a')](_0x20f9db,_0x2874('0x119'));}this[_0x2874('0xe')]['setVariable'](_0x4c42e1,_0x3315d6);if(this[_0x2874('0xa7')](_0x20f9db['hiddendigitsnum'])){var _0x41babd=parseInt(_0x20f9db[_0x2874('0x11a')],0xa);var _0x3434de=rs['generate']({'charset':'*','length':_0x41babd});var _0x16c01c=_0x3315d6[_0x2874('0x9e')];if(_0x16c01c>0x0){if(_0x16c01c>_0x41babd){this['createSquareDetailsReport'][_0x2874('0x71')](this,_0x20f9db,_0x20f9db[_0x2874('0x11b')]===_0x2874('0x11c')?_0x3434de+_0x3315d6['substr'](_0x41babd):_0x3315d6[_0x2874('0x11d')](0x0,_0x16c01c-_0x41babd)+_0x3434de);}else{this[_0x2874('0x34')][_0x2874('0x71')](this,_0x20f9db,rs[_0x2874('0x11e')]({'charset':'*','length':_0x16c01c}));}}else{this[_0x2874('0x34')][_0x2874('0x71')](this,_0x20f9db,'');}}else{this[_0x2874('0x34')]['sync'](this,_0x20f9db,_0x3315d6);}return _0x1f7d1c;};AGIVertices['prototype'][_0x2874('0xd')]=function(_0x3c7e7a){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x11f'),_0x3c7e7a['label']));return this[_0x2874('0x10e')](_0x3c7e7a);};AGIVertices[_0x2874('0x16')][_0x2874('0x120')]=function(_0x4d437c){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x121'),_0x4d437c['label']));this['createSquareDetailsReport']['sync'](this,_0x4d437c,_0x4d437c['goalname']);return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0x122'),_0x4d437c[_0x2874('0x123')]));};AGIVertices[_0x2874('0x16')][_0x2874('0x124')]=function(_0x40d462){logger['info'](util[_0x2874('0x9f')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x40d462[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x40d462[_0x2874('0x89')])||!this['isConfigured'](_0x40d462['aws_secret_access_key'])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x2874('0xa7')](_0x40d462['text'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xad'));}this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')]('Trying\x20aws\x20Polly\x20%s',_0x40d462['text']));var _0x5e6bdc=this['awsPolly'][_0x2874('0x71')](this,_0x40d462);if(_0x5e6bdc){this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x125'),_0x5e6bdc));var _0x49987c=this[_0x2874('0xe')][_0x2874('0x101')](_0x5e6bdc);try{fs[_0x2874('0x102')](_0x5e6bdc+_0x2874('0x126'));}catch(_0x3302b7){logger[_0x2874('0x2a')](_0x3302b7);}return _0x49987c;}return this['channel'][_0x2874('0x2a')](_0x40d462,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x2874('0x16')][_0x2874('0x127')]=function(_0x4818e3){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x128'),_0x4818e3[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x4818e3['aws_access_key_id'])||!this[_0x2874('0xa7')](_0x4818e3[_0x2874('0x8a')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x129'));}if(!this[_0x2874('0xa7')](_0x4818e3['aws_bot_name'])){return this['channel'][_0x2874('0xac')](_0x2874('0x12a'));}if(!this[_0x2874('0xa7')](_0x4818e3['text'])){return this[_0x2874('0xe')][_0x2874('0xac')]('no\x20text\x20configured');}this[_0x2874('0xe')][_0x2874('0xe6')]=!![];this[_0x2874('0x34')](_0x4818e3);this[_0x2874('0x41')](_0x4818e3[_0x2874('0x5c')],'in','','');this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x12b'),_0x4818e3[_0x2874('0x5c')]));var _0x57c67e=this[_0x2874('0x12c')][_0x2874('0x71')](this,_0x4818e3);if(_0x57c67e){for(var _0x1723a4 in _0x57c67e){if(_0x57c67e[_0x2874('0x95')](_0x1723a4)&&_[_0x2874('0x96')](_0x57c67e[_0x1723a4])){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0x12d'),_0x1723a4[_0x2874('0x6a')]()),_0x57c67e[_0x1723a4]);}}if(_[_0x2874('0x44')](_0x57c67e['message'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x12e'));}else{this[_0x2874('0x41')](_0x57c67e['message'],_0x2874('0xea'),_0x2874('0x12f'),'');return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x130'),_0x57c67e[_0x2874('0x77')]));}}return this[_0x2874('0xe')][_0x2874('0x2a')](_0x4818e3,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x2874('0x16')][_0x2874('0x131')]=function(_0x5e6b12){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5e6b12[_0x2874('0x35')],_0x5e6b12[_0x2874('0x65')]));if(!this['isConfigured'](_0x5e6b12[_0x2874('0x7b')])){return this[_0x2874('0xe')]['noop'](_0x2874('0xe5'));}var _0x31111b='wav';var _0x19c671=util[_0x2874('0x9f')](_0x2874('0x132'),FILES_PATH,rs[_0x2874('0x11e')](0x4));var _0x1408e0=util[_0x2874('0x9f')](_0x2874('0x9d'),_0x19c671,_0x31111b);var _0x4ba3f5=!![];if(_0x5e6b12[_0x2874('0x133')]===_0x2874('0x134')){_0x4ba3f5=![];}var _0x12054a=this['channel']['recordFile'](_0x19c671,_0x31111b,_0x5e6b12[_0x2874('0x135')],_0x5e6b12[_0x2874('0x65')],undefined,_0x4ba3f5);if(_0x12054a['result']!==-0x1){this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x136'),_0x1408e0));var _0x55874b=this[_0x2874('0x90')][_0x2874('0x71')](this,_0x5e6b12,_0x1408e0);if(_0x55874b){for(var _0x116841 in _0x55874b){if(_0x55874b[_0x2874('0x95')](_0x116841)){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0x137'),_0x116841[_0x2874('0x6a')]()),_0x55874b[_0x116841]);}}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x138'),JSON[_0x2874('0x74')](_0x55874b)));}}return _0x12054a;};AGIVertices[_0x2874('0x16')][_0x2874('0x139')]=function(_0x587712){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x13a'),_0x587712[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x587712[_0x2874('0x13b')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x13c'));}if(!this[_0x2874('0xa7')](_0x587712[_0x2874('0x93')])){return this[_0x2874('0xe')]['noop'](_0x2874('0x13d'));}var _0x338b36=_0x2874('0x13e');var _0x122e23=util[_0x2874('0x9f')]('%s/recordings/%s',FILES_PATH,rs[_0x2874('0x11e')](0x4));var _0x5b06df=util['format'](_0x2874('0x9d'),_0x122e23,_0x338b36);var _0x131ada=!![];if(_0x587712[_0x2874('0x133')]===_0x2874('0x134')){_0x131ada=![];}var _0x53d777=this['channel'][_0x2874('0x13f')](_0x122e23,_0x338b36,_0x587712[_0x2874('0x135')],_0x587712['timeout'],undefined,_0x131ada);if(_0x53d777[_0x2874('0xa5')]!==-0x1){this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x140'),_0x5b06df));var _0x2aed9b=this['tildeASR'][_0x2874('0x71')](this,_0x587712,_0x5b06df);if(_0x2aed9b){for(var _0x141d7d in _0x2aed9b){if(_0x2aed9b['hasOwnProperty'](_0x141d7d)){this[_0x2874('0xe')][_0x2874('0xa0')](util['format']('TILDE_ASR_%s',_0x141d7d['toUpperCase']()),_0x2aed9b[_0x141d7d]);}}return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0x141'),JSON[_0x2874('0x74')](_0x2aed9b)));}}return _0x53d777;};AGIVertices['prototype'][_0x2874('0x142')]=function(_0x243718){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x243718['label']));return this['channel'][_0x2874('0x143')](_0x243718['context'],_0x243718[_0x2874('0x3c')],_0x243718[_0x2874('0x3d')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x144')]=function(_0x5514bd){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x145'),_0x5514bd[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x5514bd['condition'])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x5514bd,_0x2874('0x146'));}try{var _0x361300=eval(_0x5514bd[_0x2874('0x147')])?'true':_0x2874('0x148');this['channel']['noop'](util[_0x2874('0x9f')](_0x2874('0x149'),_0x5514bd[_0x2874('0x147')],_0x361300));return{'code':0xc8,'result':_0x361300};}catch(_0x14582e){return{'code':0xc8,'result':_0x2874('0x148')};}};AGIVertices[_0x2874('0x16')][_0x2874('0x14a')]=function(_0x1bb1d3){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x1bb1d3[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x1bb1d3[_0x2874('0x14b')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1bb1d3,'no\x20interval\x20configured');}var _0x4415b5=this[_0x2874('0x14c')][_0x2874('0x71')](this,_0x1bb1d3[_0x2874('0x14b')]);if(!_0x4415b5){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1bb1d3,_0x2874('0x14d'));}for(var _0x46488b=0x0;_0x46488b<_0x4415b5[_0x2874('0x9e')];_0x46488b+=0x1){var _0xa093df=this[_0x2874('0xe')][_0x2874('0x11')](util[_0x2874('0x9f')](_0x2874('0x14e'),_0x4415b5[_0x46488b]));if(_0xa093df[_0x2874('0xa5')]===-0x1){return _0xa093df;}logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('IFTIME\x20%s\x20%s',_0x4415b5[_0x46488b],_0xa093df[_0x2874('0xa3')]));if(_0xa093df[_0x2874('0xa3')]==='true'){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x14f'),_0x4415b5[_0x46488b],_0x2874('0x150')));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('IFTIME\x20%s\x20%s',_0x4415b5[_0x46488b],_0x2874('0x150')));return{'code':0xc8,'result':'true'};}else{logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x14f'),_0x4415b5[_0x46488b],_0x2874('0x148')));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x14f'),_0x4415b5[_0x46488b],_0x2874('0x148')));}}return{'code':0xc8,'result':_0x2874('0x148')};};AGIVertices['prototype'][_0x2874('0x151')]=function(_0x2ed0e1){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x152'),_0x2ed0e1[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0x151')]();};AGIVertices['prototype'][_0x2874('0x153')]=function(_0x4c6d06){logger[_0x2874('0x2c')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4c6d06[_0x2874('0x35')]));if(!this['isConfigured'](_0x4c6d06[_0x2874('0x7b')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xe5'));}var _0x322f76=_0x2874('0x13e');var _0x5155e7=util[_0x2874('0x9f')](_0x2874('0x132'),FILES_PATH,rs[_0x2874('0x11e')](0x4));var _0x189534=util[_0x2874('0x9f')](_0x2874('0x9d'),_0x5155e7,_0x322f76);var _0x454304=!![];if(_0x4c6d06[_0x2874('0x133')]==='NOBEEP'){_0x454304=![];}var _0x916e63=this[_0x2874('0xe')]['recordFile'](_0x5155e7,_0x322f76,_0x4c6d06[_0x2874('0x135')],_0x4c6d06['timeout'],undefined,_0x454304);if(_0x916e63[_0x2874('0xa5')]!==-0x1){this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x154'),_0x189534));var _0x2f986c=this[_0x2874('0x85')][_0x2874('0x71')](this,_0x4c6d06,_0x189534);if(_0x2f986c){for(var _0x437f13 in _0x2f986c){if(_0x2f986c[_0x2874('0x95')](_0x437f13)){this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')]('ISPEECH_ASR_%s',_0x437f13[_0x2874('0x6a')]()),_0x2f986c[_0x437f13]);}}return this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0x155'),JSON[_0x2874('0x74')](_0x2f986c)));}}return _0x916e63;};AGIVertices[_0x2874('0x16')]['ispeechtts']=function(_0x1e14de){logger[_0x2874('0x2c')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1e14de[_0x2874('0x35')]));if(!this['isConfigured'](_0x1e14de[_0x2874('0x7b')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xe5'));}if(!this[_0x2874('0xa7')](_0x1e14de[_0x2874('0x5c')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xad'));}this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('Trying\x20ispeech\x20TTS\x20%s',_0x1e14de[_0x2874('0x5c')]));var _0x164a36=this[_0x2874('0x82')][_0x2874('0x71')](this,_0x1e14de);if(_0x164a36){this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('ispeech\x20%s\x20file\x20created',_0x164a36));var _0x59a680=this['channel']['streamFile'](_0x164a36,_0x1e14de[_0x2874('0x135')]);try{fs[_0x2874('0x102')](_0x164a36+_0x2874('0x126'));}catch(_0x57da6d){logger[_0x2874('0x2a')](_0x57da6d);}return _0x59a680;}return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1e14de,_0x2874('0x156'));};AGIVertices['prototype'][_0x2874('0x157')]=function(_0x3a90ba){logger[_0x2874('0x2c')](util['format'](_0x2874('0x158'),_0x3a90ba['label']));if(!this[_0x2874('0xa7')](_0x3a90ba[_0x2874('0x159')])){return this['channel'][_0x2874('0x2a')](_0x3a90ba,_0x2874('0x15a'));}logger['info'](util[_0x2874('0x9f')](_0x2874('0x15b'),this[_0x2874('0xe')][_0x2874('0x38')],_0x3a90ba['findBy']));var _0x1fbbc4=this[_0x2874('0x51')][_0x2874('0x71')](this,_0x3a90ba[_0x2874('0x159')]);if(_0x1fbbc4){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x15c'),this[_0x2874('0xe')][_0x2874('0x38')],_0x3a90ba[_0x2874('0x159')]));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15c'),this['channel'][_0x2874('0x38')],_0x3a90ba['findBy']));return{'code':0xc8,'result':_0x2874('0x15d')};}else{logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x15e'),this['channel']['callerid'],_0x3a90ba[_0x2874('0x159')]));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15e'),this['channel']['callerid'],_0x3a90ba[_0x2874('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2874('0x16')][_0x2874('0x15f')]=function(_0x3dfc2d){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x3dfc2d[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x3dfc2d[_0x2874('0x159')])){return this['channel']['error'](_0x3dfc2d,_0x2874('0x15a'));}logger[_0x2874('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x2874('0xe')][_0x2874('0x38')],_0x3dfc2d['findBy']));var _0x3cf965=this[_0x2874('0x50')][_0x2874('0x71')](this,_0x3dfc2d[_0x2874('0x159')]);if(_0x3cf965){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x2874('0xe')]['callerid'],_0x3dfc2d[_0x2874('0x159')]));this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15c'),this[_0x2874('0xe')][_0x2874('0x38')],_0x3dfc2d[_0x2874('0x159')]));return{'code':0xc8,'result':_0x2874('0x15d')};}else{logger[_0x2874('0x2c')](util['format'](_0x2874('0x15e'),this[_0x2874('0xe')][_0x2874('0x38')],_0x3dfc2d[_0x2874('0x159')]));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15e'),this[_0x2874('0xe')][_0x2874('0x38')],_0x3dfc2d[_0x2874('0x159')]));return{'code':0xc8,'result':_0x2874('0x160')};}};AGIVertices['prototype'][_0x2874('0x161')]=function(_0x350a5d){logger['info'](util[_0x2874('0x9f')](_0x2874('0x162'),_0x350a5d[_0x2874('0x35')]));if(!this['isConfigured'](_0x350a5d[_0x2874('0x163')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x350a5d,'no\x20operation\x20configured');}this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0x164'),_0x350a5d[_0x2874('0x163')]));var _0x5133f9=eval(_0x350a5d[_0x2874('0x163')]);if(!this[_0x2874('0xa7')](_0x350a5d['variable_id'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xd7'));}var _0x22185a=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x350a5d['variable_id']);if(!_0x22185a){return this['channel'][_0x2874('0x2a')](_0x350a5d,_0x2874('0x119'));}if(_[_0x2874('0x9b')](_0x5133f9)){var _0x3ab37f=this;_0x5133f9[_0x2874('0xd9')](function(_0x47656d,_0xc9cde9){_0x3ab37f[_0x2874('0xe')][_0x2874('0xa0')](util['format'](_0x2874('0x165'),_0x22185a,_0xc9cde9),_0x47656d);});return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')]('variable\x20%s[key]\x20set',_0x22185a));}else{return this[_0x2874('0xe')][_0x2874('0xa0')](_0x22185a,_0x5133f9);}};AGIVertices['prototype'][_0x2874('0xc')]=function(_0x50810a){logger[_0x2874('0x2c')](util['format'](_0x2874('0x166'),_0x50810a['label']));if(_0x50810a['retry']===0x0){return this['maxRetry'](_0x50810a);}_0x50810a[_0x2874('0xa9')]-=0x1;if(!this[_0x2874('0xa7')](_0x50810a[_0x2874('0x110')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x50810a,'no\x20file\x20audio\x20selected');}var _0x26268a=this[_0x2874('0x112')][_0x2874('0x71')](this,_0x50810a['file_id']);if(!_0x26268a){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x50810a,_0x2874('0x113'));}var _0x34979b=this[_0x2874('0xe')]['getData'](_0x26268a,_0x50810a[_0x2874('0x115')],_0x50810a['digit']);var _0x2ccafc=_0x34979b[_0x2874('0xa5')];if(_0x34979b[_0x2874('0xa5')]===-0x1){this[_0x2874('0x34')][_0x2874('0x71')](this,_0x50810a,'-1');return _0x34979b;}else if(_0x34979b[_0x2874('0xa3')]===_0x2874('0x65')){_0x34979b[_0x2874('0xa5')]=_0x34979b[_0x2874('0xa5')][_0x2874('0x9e')]>0x0?_0x34979b['result']:'t';}else if(_[_0x2874('0x43')](_0x34979b[_0x2874('0xa5')])){_0x34979b[_0x2874('0xa5')]='#';_0x2ccafc='#';}if(!this[_0x2874('0xa7')](_0x50810a[_0x2874('0xd6')])){this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xd7'));}else{var _0x2d6bc1=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x50810a[_0x2874('0xd6')]);if(!_0x2d6bc1){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x50810a,_0x2874('0x119'));}this[_0x2874('0xe')][_0x2874('0xa0')](_0x2d6bc1,_0x2ccafc);}this[_0x2874('0x34')][_0x2874('0x71')](this,_0x50810a,_0x2ccafc);return _0x34979b;};AGIVertices[_0x2874('0x16')][_0x2874('0xac')]=function(_0x3e62c0){logger['info'](util['format'](_0x2874('0x167'),_0x3e62c0[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0xac')](_0x3e62c0[_0x2874('0x168')]||_0x3e62c0[_0x2874('0x35')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x169')]=function(_0x5d14fb){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x5d14fb['label']));if(!this[_0x2874('0xa7')](_0x5d14fb[_0x2874('0x159')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x5d14fb,_0x2874('0x15a'));}logger['info'](util[_0x2874('0x9f')](_0x2874('0x15b'),this['channel'][_0x2874('0x38')],_0x5d14fb[_0x2874('0x159')]));var _0x142b3e=this[_0x2874('0x16a')][_0x2874('0x71')](this,_0x5d14fb[_0x2874('0x16b')]);var _0x12ddeb=this[_0x2874('0x4d')][_0x2874('0x71')](this,_0x5d14fb[_0x2874('0x159')],_0x142b3e);if(_0x12ddeb){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x15c'),this[_0x2874('0xe')][_0x2874('0x38')],_0x5d14fb[_0x2874('0x159')]));this[_0x2874('0xe')]['noop'](util['format'](_0x2874('0x15c'),this[_0x2874('0xe')]['callerid'],_0x5d14fb[_0x2874('0x159')]));return{'code':0xc8,'result':_0x2874('0x15d')};}else{logger['info'](util[_0x2874('0x9f')](_0x2874('0x15e'),this[_0x2874('0xe')][_0x2874('0x38')],_0x5d14fb[_0x2874('0x159')]));this['channel'][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15c'),this[_0x2874('0xe')]['callerid'],_0x5d14fb[_0x2874('0x159')]));return{'code':0xc8,'result':_0x2874('0x160')};}};AGIVertices['prototype'][_0x2874('0x16c')]=function(_0x3fb54d){logger['info'](util[_0x2874('0x9f')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3fb54d[_0x2874('0x35')]));if(!this['isConfigured'](_0x3fb54d[_0x2874('0x110')])){return this[_0x2874('0xe')]['error'](_0x3fb54d,_0x2874('0x111'));}var _0x430fb8=this[_0x2874('0x112')][_0x2874('0x71')](this,_0x3fb54d[_0x2874('0x110')]);if(!_0x430fb8){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x3fb54d,_0x2874('0x113'));}var _0xbcd84f=this[_0x2874('0xe')]['exec'](_0x2874('0x16d'),[_0x430fb8,_0x3fb54d[_0x2874('0xe2')]]);if(_0xbcd84f['result']===-0x1){return _0xbcd84f;}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0xc5'),_0x2874('0x16d'),_0x430fb8));};AGIVertices['prototype']['queue']=function(_0x315fc5){logger[_0x2874('0x2c')](util['format'](_0x2874('0x16e'),_0x315fc5['label']));if(!this[_0x2874('0xa7')](_0x315fc5[_0x2874('0x16f')])){return this[_0x2874('0xe')]['error'](_0x315fc5,_0x2874('0x170'));}var _0x45509e='';var _0x4f9ff4=parseInt(_0x315fc5[_0x2874('0x16f')],0xa);if(isNaN(_0x4f9ff4)){_0x45509e=_0x315fc5['queue_id'];}else{_0x45509e=this[_0x2874('0x17')][_0x2874('0x71')](this,_0x315fc5[_0x2874('0x16f')]);if(!_0x45509e){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x315fc5,'no\x20queue\x20found');}}var _0x16ab09='';if(this[_0x2874('0xa7')](_0x315fc5[_0x2874('0x110')])){var _0x557089=this[_0x2874('0x112')]['sync'](this,_0x315fc5['file_id']);if(_0x557089){_0x16ab09=_0x557089;}}this[_0x2874('0x34')][_0x2874('0x71')](this,_0x315fc5,_0x45509e);if(_0x315fc5[_0x2874('0xe2')]['indexOf']('x')<0x0){_0x315fc5[_0x2874('0xe2')]+='x';}if(_0x315fc5[_0x2874('0xe2')]['indexOf']('X')<0x0){_0x315fc5[_0x2874('0xe2')]+='X';}this[_0x2874('0xe')][_0x2874('0xa0')]('XMCS-QUEUE',_0x45509e?_0x45509e['toLowerCase']():'');var _0x5d2a06=this[_0x2874('0xe')][_0x2874('0x56')](_0x2874('0x171'),[_0x45509e,_0x315fc5['opts'],_0x315fc5[_0x2874('0x63')],_0x16ab09,_0x315fc5[_0x2874('0x65')],_0x315fc5['agi'],_0x315fc5[_0x2874('0x172')],_0x315fc5[_0x2874('0x173')],'',_0x315fc5[_0x2874('0x174')]]);if(_0x5d2a06[_0x2874('0xa5')]===-0x1){return _0x5d2a06;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0xc5'),_0x2874('0x171'),_0x45509e));};AGIVertices['prototype']['record']=function(_0x587cc8){logger['info'](util[_0x2874('0x9f')](_0x2874('0x175'),_0x587cc8['label']));var _0x549d33=_0x587cc8[_0x2874('0x176')]||_0x2874('0x13e');var _0x11f968=util[_0x2874('0x9f')](_0x2874('0x177'),this['channel'][_0x2874('0x3a')],rs[_0x2874('0x11e')](0x5));var _0x18fc3c=util[_0x2874('0x9f')](_0x2874('0x178'),FILES_PATH,_0x11f968,_0x549d33);var _0x156d4e=util[_0x2874('0x9f')](_0x2874('0x132'),FILES_PATH,_0x11f968);this[_0x2874('0x39')][_0x2874('0x71')](this,_0x587cc8,_0x11f968,_0x18fc3c);this[_0x2874('0xe')][_0x2874('0xa0')](_0x2874('0x179'),_0x11f968);logger['info'](_0x2874('0x17a'),_0x156d4e,_0x549d33,_0x587cc8['escape_digits'],_0x587cc8[_0x2874('0x65')]);return this['channel'][_0x2874('0x13f')](_0x156d4e,_0x549d33,_0x587cc8[_0x2874('0x17b')],_0x587cc8[_0x2874('0x65')],undefined,!![]);};AGIVertices['prototype'][_0x2874('0x17c')]=function(_0x47d734){logger['info'](util[_0x2874('0x9f')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x47d734['label']));if(!this[_0x2874('0xa7')](_0x47d734[_0x2874('0x63')])){return this['channel']['noop'](_0x2874('0x17d'));}var _0x3d9459=this[_0x2874('0x62')]['sync'](this,_0x47d734);logger[_0x2874('0x2c')](util['format'](_0x2874('0x17e'),util[_0x2874('0x17f')](_0x3d9459,{'showHidden':![],'depth':null})));if(!this[_0x2874('0xa7')](_0x47d734[_0x2874('0xd6')])){return this['channel'][_0x2874('0xac')](_0x2874('0x180'));}var _0x145605=this['getVariable'][_0x2874('0x71')](this,_0x47d734[_0x2874('0xd6')]);if(!_0x145605){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x47d734,_0x2874('0x119'));}this[_0x2874('0xe')]['setVariable'](util[_0x2874('0x9f')](_0x2874('0x181'),_0x145605),_0x3d9459[_0x2874('0x76')]?_0x3d9459[_0x2874('0x76')]:'200');this[_0x2874('0xe')][_0x2874('0xa0')](util[_0x2874('0x9f')](_0x2874('0x182'),_0x145605),_0x3d9459[_0x2874('0x183')]?_0x3d9459[_0x2874('0x183')]:'OK');if(_0x3d9459[_0x2874('0x75')]){try{this['saveRestApiResult'](_0x3d9459['body'],_0x145605);}catch(_0x387189){logger[_0x2874('0x2a')](util[_0x2874('0x9f')](_0x2874('0x184'),_0x145605));}}return this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')](_0x2874('0xdc'),_0x145605));};AGIVertices[_0x2874('0x16')][_0x2874('0x185')]=function(_0x11bd97){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x186'),_0x11bd97[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0x187')](_0x11bd97[_0x2874('0x188')]['replace'](/\s+/g,''),_0x11bd97[_0x2874('0x17b')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x189')]=function(_0x4cbfa7){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x18a'),_0x4cbfa7[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0x18b')](_0x4cbfa7[_0x2874('0x66')]['replace'](/\s+/g,''),_0x4cbfa7[_0x2874('0x17b')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x18c')]=function(_0x41491d){logger['info'](util[_0x2874('0x9f')](_0x2874('0x18d'),_0x41491d[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0x18e')](_0x41491d[_0x2874('0x5c')],_0x41491d[_0x2874('0x17b')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x18f')]=function(_0x32f4b9){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x190'),_0x32f4b9[_0x2874('0x35')]));if(!this['isConfigured'](_0x32f4b9[_0x2874('0x191')])){return this['channel']['noop'](_0x2874('0x192'));}var _0x21fdf5=this[_0x2874('0x21')][_0x2874('0x71')](this,_0x32f4b9[_0x2874('0x191')]);if(!_0x21fdf5||!_0x21fdf5[_0x2874('0x193')]){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x32f4b9,'no\x20mail\x20account\x20found');}var _0x268e4e={'from':util[_0x2874('0x9f')](_0x2874('0x194'),_0x21fdf5[_0x2874('0x14')],_0x21fdf5[_0x2874('0x195')]||_0x21fdf5[_0x2874('0x193')][_0x2874('0x196')]),'to':_0x32f4b9['to']||'','cc':_0x32f4b9['cc']||'','bcc':_0x32f4b9[_0x2874('0x197')]||'','subject':_0x32f4b9[_0x2874('0x198')],'html':_0x32f4b9[_0x2874('0x5c')],'text':_0x32f4b9['text']};var _0x4581a3={'tls':{'rejectUnauthorized':![]}};if(_0x21fdf5[_0x2874('0x193')][_0x2874('0x199')]){_0x4581a3[_0x2874('0x199')]=_0x21fdf5['Smtp'][_0x2874('0x199')];}else{_0x4581a3['host']=_0x21fdf5['Smtp'][_0x2874('0x19a')];_0x4581a3[_0x2874('0x19b')]=_0x21fdf5['Smtp'][_0x2874('0x19b')];_0x4581a3['secure']=_0x21fdf5['Smtp'][_0x2874('0x19c')];}if(_0x21fdf5['Smtp'][_0x2874('0x19d')]){_0x4581a3[_0x2874('0x19e')]={'user':_0x21fdf5['Smtp'][_0x2874('0x196')],'pass':_0x21fdf5[_0x2874('0x193')]['pass']};}if(this[_0x2874('0xa7')](_0x32f4b9[_0x2874('0x19f')])){}logger[_0x2874('0xdd')](_0x2874('0x1a0'),JSON[_0x2874('0x74')](_0x268e4e));this[_0x2874('0x34')]['sync'](this,_0x32f4b9,_0x32f4b9[_0x2874('0x191')]);this['channel'][_0x2874('0xac')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x21fdf5['name']));this[_0x2874('0x23')]['sync'](this,_0x4581a3,_0x268e4e);return this['channel'][_0x2874('0xac')](_0x2874('0x1a1'));};AGIVertices['prototype'][_0x2874('0x1a2')]=function(_0xdffa58){logger['info'](util[_0x2874('0x9f')](_0x2874('0x1a3'),_0xdffa58[_0x2874('0x35')]));return this[_0x2874('0xe')][_0x2874('0xac')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x322d49){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x1a4'),_0x322d49[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x322d49[_0x2874('0x1a5')])){return this[_0x2874('0xe')]['noop'](_0x2874('0x1a6'));}var _0x521399=this[_0x2874('0x31')][_0x2874('0x71')](this,_0x322d49['sms_account_id']);if(!_0x521399){return this['channel'][_0x2874('0x2a')](_0x322d49,_0x2874('0x1a7'));}var _0x32121d={'body':_0x322d49[_0x2874('0x1a8')],'phone':_0x322d49['to']||'','SmsAccountId':_0x521399['id']};logger['debug']('sendSMS\x20message',JSON[_0x2874('0x74')](_0x32121d));this['createSquareDetailsReport'][_0x2874('0x71')](this,_0x322d49,_0x322d49[_0x2874('0x1a5')]);this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x1a9'),_0x521399[_0x2874('0x14')]));this[_0x2874('0x33')][_0x2874('0x71')](this,_0x32121d);return this['channel'][_0x2874('0xac')](_0x2874('0x1aa'));};AGIVertices[_0x2874('0x16')][_0x2874('0x1ab')]=function(_0x3217de){logger[_0x2874('0x2c')](util['format'](_0x2874('0x1ac'),_0x3217de[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x3217de[_0x2874('0xd6')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x3217de,_0x2874('0x1ad'));}var _0x1c2536=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x3217de[_0x2874('0xd6')]);if(!_0x1c2536){return this['channel']['error'](_0x3217de,_0x2874('0x119'));}return this[_0x2874('0xe')][_0x2874('0xa0')](_0x1c2536,_0x3217de[_0x2874('0x1ae')]);};AGIVertices[_0x2874('0x16')][_0x2874('0x1af')]=function(_0x33a1c9){logger['info'](util[_0x2874('0x9f')](_0x2874('0x1b0'),_0x33a1c9[_0x2874('0x35')]));this['channel'][_0x2874('0xac')](_0x2874('0x1b1'));if(_0x33a1c9[_0x2874('0xbb')]==='yes'){this['channel'][_0x2874('0xac')](_0x2874('0x1b2'));return this[_0x2874('0xe')]['answer']();}return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x1b3'));};AGIVertices[_0x2874('0x16')][_0x2874('0x1b4')]=function(_0x1db647){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x1b5'),_0x1db647[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x1db647[_0x2874('0x1b6')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1db647,_0x2874('0x1b7'));}var _0x47596f=this[_0x2874('0x1b8')][_0x2874('0x71')](this,_0x1db647[_0x2874('0x1b6')]);if(!this[_0x2874('0xa7')](_0x47596f)){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1db647,util['format'](_0x2874('0x1b9'),_0x1db647[_0x2874('0x1b6')]));}if(_0x47596f===this[_0x2874('0xe')][_0x2874('0x37')]){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x1db647,_0x2874('0x1ba'));}this[_0x2874('0x34')][_0x2874('0x71')](this,_0x1db647,_0x47596f);var _0x370706=this['channel']['exec'](_0x2874('0x1bb'),util[_0x2874('0x9f')](_0x2874('0x1bc'),config[_0x2874('0x7')][_0x2874('0x19a')]||_0x2874('0x1bd'),_0x47596f,this[_0x2874('0xe')][_0x2874('0x37')]));if(_0x370706['result']===-0x1){return _0x370706;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format']('Executed\x20command\x20%s\x20%s','AGI',_0x47596f));};AGIVertices['prototype'][_0x2874('0x1be')]=function(_0x29b79a){logger['info'](util[_0x2874('0x9f')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x29b79a[_0x2874('0x35')]));var _0x1e85ff=this[_0x2874('0x55')][_0x2874('0x71')](this,_0x29b79a[_0x2874('0x1bf')]);this['createSquareDetailsReport'][_0x2874('0x71')](this,_0x29b79a,_0x29b79a[_0x2874('0x1bf')]);if(this[_0x2874('0xa7')](_0x29b79a[_0x2874('0xd6')])){var _0x364916=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x29b79a[_0x2874('0xd6')]);if(_0x364916){this[_0x2874('0xe')][_0x2874('0xa0')](_0x364916,_0x1e85ff);return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x29b79a[_0x2874('0x1bf')],_0x364916));}}return this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x29b79a['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x39f431){logger[_0x2874('0x2c')](util[_0x2874('0x9f')](_0x2874('0x1c0'),_0x39f431[_0x2874('0x35')]));_0x39f431[_0x2874('0x5c')]=_0x39f431['text'][_0x2874('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2874('0xa7')](_0x39f431[_0x2874('0x5a')])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0x1c1'));}if(!this[_0x2874('0xa7')](_0x39f431['text'])){return this[_0x2874('0xe')][_0x2874('0xac')](_0x2874('0xad'));}this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x1c2'),_0x39f431[_0x2874('0x5c')]));var _0x156075=this[_0x2874('0x59')][_0x2874('0x71')](this,_0x39f431);if(_0x156075){this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0x1c3'),_0x156075));var _0x3117c7=this[_0x2874('0xe')]['streamFile'](_0x156075);try{fs['unlink'](_0x156075+'.wav');}catch(_0x4582ba){logger[_0x2874('0x2a')](_0x4582ba);}return _0x3117c7;}return this[_0x2874('0xe')][_0x2874('0x2a')](_0x39f431,_0x2874('0x1c4'));};AGIVertices['prototype'][_0x2874('0x1c5')]=function(_0x571666){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x571666[_0x2874('0x35')]));_0x571666[_0x2874('0x5c')]=_0x571666[_0x2874('0x5c')][_0x2874('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x2874('0xa7')](_0x571666[_0x2874('0x5c')])){return this[_0x2874('0xe')][_0x2874('0xac')]('no\x20text\x20configured');}this[_0x2874('0xe')]['noop'](util[_0x2874('0x9f')]('Trying\x20Google\x20TTS\x20%s',_0x571666[_0x2874('0x5c')]));var _0x5f5b8d=this['googleTTS'][_0x2874('0x71')](this,_0x571666);if(_0x5f5b8d){this[_0x2874('0xe')]['noop'](util['format'](_0x2874('0x1c6'),_0x5f5b8d));var _0x479908=this[_0x2874('0xe')][_0x2874('0x101')](_0x5f5b8d);try{fs[_0x2874('0x102')](_0x5f5b8d+_0x2874('0x126'));}catch(_0x449352){logger[_0x2874('0x2a')](_0x449352);}return _0x479908;}return this[_0x2874('0xe')][_0x2874('0x2a')](_0x571666,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x2874('0x16')]['unpause']=function(_0x94abaf){logger['info'](util[_0x2874('0x9f')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x94abaf['label']));if(!this['isConfigured'](_0x94abaf[_0x2874('0x159')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x94abaf,'no\x20find\x20by\x20configured');}logger['info'](util[_0x2874('0x9f')](_0x2874('0x15b'),this[_0x2874('0xe')][_0x2874('0x38')],_0x94abaf[_0x2874('0x159')]));var _0x5b6f39=this[_0x2874('0x4f')][_0x2874('0x71')](this,_0x94abaf[_0x2874('0x159')]);if(_0x5b6f39){logger[_0x2874('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x94abaf[_0x2874('0x159')]));this[_0x2874('0xe')][_0x2874('0xac')](util[_0x2874('0x9f')](_0x2874('0x15c'),this[_0x2874('0xe')][_0x2874('0x38')],_0x94abaf[_0x2874('0x159')]));return{'code':0xc8,'result':_0x2874('0x15d')};}else{logger['info'](util[_0x2874('0x9f')](_0x2874('0x15e'),this[_0x2874('0xe')][_0x2874('0x38')],_0x94abaf[_0x2874('0x159')]));this[_0x2874('0xe')][_0x2874('0xac')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x2874('0xe')][_0x2874('0x38')],_0x94abaf[_0x2874('0x159')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x2874('0x16')][_0x2874('0x1c7')]=function(_0x4ab479){logger['info'](util[_0x2874('0x9f')](_0x2874('0x1c8'),_0x4ab479[_0x2874('0x35')]));var _0xc95c6=this[_0x2874('0xe')][_0x2874('0x56')]('VOICEMAIL',[_0x4ab479[_0x2874('0x1c9')],_0x4ab479[_0x2874('0x79')]]);if(_0xc95c6[_0x2874('0xa5')]===-0x1){return _0xc95c6;}return this[_0x2874('0xe')][_0x2874('0xac')](util['format'](_0x2874('0xc5'),_0x2874('0x1ca'),_0x4ab479[_0x2874('0x1c9')]));};AGIVertices[_0x2874('0x16')][_0x2874('0x1cb')]=function(_0x2e05e0){logger[_0x2874('0x2c')](util[_0x2874('0x9f')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2e05e0[_0x2874('0x35')]));if(!this[_0x2874('0xa7')](_0x2e05e0[_0x2874('0xd6')])){return this[_0x2874('0xe')][_0x2874('0x2a')](_0x2e05e0,_0x2874('0x1ad'));}var _0x2eb7b3=this[_0x2874('0x11')][_0x2874('0x71')](this,_0x2e05e0[_0x2874('0xd6')]);if(!_0x2eb7b3){return this['channel'][_0x2874('0x2a')](_0x2e05e0,_0x2874('0x119'));}var _0x4630ba=this[_0x2874('0xe')][_0x2874('0x11')](_0x2eb7b3);return{'code':0xc8,'result':_0x4630ba[_0x2874('0xa3')]?_0x4630ba[_0x2874('0xa3')]:'-'};};String[_0x2874('0x16')][_0x2874('0xa2')]=function(_0x5b903c,_0xb68ca6){return this[_0x2874('0xa1')](_0x5b903c)[_0x2874('0x1cc')](_0xb68ca6);};module['exports']=AGIVertices; \ No newline at end of file +var _0x2300=['agentLogout','agentLogin','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','isArray','setVariable','stringify','split','replaceAll','getAndSetVariable','extra','maxRetry','mrcpsynth','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','out','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','recordFile','tilde\x20%s\x20file\x20created','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','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','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','toLowerCase','QUEUE','macro','position','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','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','getSquareProject','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','lodash','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','toString','callback_priority','agentPause','agent','agentUnpause'];(function(_0x2a32ca,_0x6f350f){var _0x4027de=function(_0x41a6fb){while(--_0x41a6fb){_0x2a32ca['push'](_0x2a32ca['shift']());}};_0x4027de(++_0x6f350f);}(_0x2300,0x181));var _0x0230=function(_0x1e48bc,_0x5ba595){_0x1e48bc=_0x1e48bc-0x0;var _0x143f3a=_0x2300[_0x1e48bc];return _0x143f3a;};'use strict';var fs=require('fs');var path=require(_0x0230('0x0'));var util=require(_0x0230('0x1'));var _=require(_0x0230('0x2'));var sh=require('shelljs');var odbc=require(_0x0230('0x3'))();var rs=require(_0x0230('0x4'));var moment=require(_0x0230('0x5'));var Mustache=require('mustache');var rp=require(_0x0230('0x6'));var logger=require(_0x0230('0x7'))('agi');var config=require(_0x0230('0x8'));var scripts=require(_0x0230('0x9'));var FILES_PATH=_0x0230('0xa');var recursiveMapAttributes=[_0x0230('0xb'),_0x0230('0xc')];var verticesWithRetry=[_0x0230('0xd'),'getdigits',_0x0230('0xe')];var AGIVertices=function(_0x29d542,_0x2dea97,_0x532633){this['channel']=_0x29d542;this[_0x0230('0xf')]=_0x2dea97;this[_0x0230('0x10')]=_0x532633;};AGIVertices[_0x0230('0x11')][_0x0230('0x12')]=function(_0x1ed91d,_0x25258b){this[_0x0230('0xf')]['getVariableById'](_0x1ed91d)[_0x0230('0x13')](function(_0x48a360){_0x25258b(null,_0x48a360?_0x48a360[_0x0230('0x14')]:![]);})[_0x0230('0x15')](function(_0x5ae655){_0x25258b(_0x5ae655);});};AGIVertices[_0x0230('0x11')][_0x0230('0x16')]=function(_0x14968f,_0x51de7b){this['rpc'][_0x0230('0x17')](_0x14968f)['then'](function(_0x2c883d){_0x51de7b(null,_0x2c883d?_0x2c883d[_0x0230('0x14')]:![]);})[_0x0230('0x15')](function(_0x1412ef){_0x51de7b(_0x1412ef);});};AGIVertices['prototype']['getSquareProject']=function(_0x49086f,_0x2b321d){this[_0x0230('0xf')]['getSquareProjectById'](_0x49086f)[_0x0230('0x13')](function(_0x11f992){_0x2b321d(null,_0x11f992?_0x11f992[_0x0230('0x14')]:![]);})['catch'](function(_0x5cd53f){_0x2b321d(_0x5cd53f);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x56171d,_0x3f5683){this[_0x0230('0xf')][_0x0230('0x18')](_0x56171d)[_0x0230('0x13')](function(_0x49c8ed){_0x3f5683(null,_0x49c8ed?_0x49c8ed[_0x0230('0x19')]:![]);})[_0x0230('0x15')](function(_0x1fd2a5){_0x3f5683(_0x1fd2a5);});};AGIVertices[_0x0230('0x11')][_0x0230('0x1a')]=function(_0x2aa6a2,_0x591599){this[_0x0230('0xf')][_0x0230('0x1b')](_0x2aa6a2)[_0x0230('0x13')](function(_0x2eb371){_0x591599(null,_0x2eb371?_0x2eb371[_0x0230('0x14')]:![]);})[_0x0230('0x15')](function(_0x4f897a){_0x591599(_0x4f897a);});};AGIVertices[_0x0230('0x11')][_0x0230('0x1c')]=function(_0x27ce65,_0x12b817){this[_0x0230('0xf')][_0x0230('0x1d')](_0x27ce65)[_0x0230('0x13')](function(_0x17c73b){_0x12b817(null,_0x17c73b?_0x17c73b['name']:![]);})[_0x0230('0x15')](function(_0x186598){_0x12b817(_0x186598);});};AGIVertices['prototype'][_0x0230('0x1e')]=function(_0x17585e,_0x5aace5){var _0x4d013d=this;this[_0x0230('0xf')][_0x0230('0x1f')](_0x17585e)[_0x0230('0x13')](function(_0x4c9908){_0x5aace5(null,_0x4c9908?_0x4d013d[_0x0230('0x20')](_0x4c9908[_0x0230('0x21')]):![]);})[_0x0230('0x15')](function(_0x1af3fa){_0x5aace5(_0x1af3fa);});};AGIVertices[_0x0230('0x11')]['getMailAccount']=function(_0x3356d7,_0x65891b){this['rpc']['getMailAccountById'](_0x3356d7)[_0x0230('0x13')](function(_0x5d62de){_0x65891b(null,_0x5d62de?_0x5d62de:![]);})['catch'](function(_0x510e5f){_0x65891b(_0x510e5f);});};AGIVertices['prototype']['sendMailMessage']=function(_0x256a5e,_0x1e7203,_0x3170fa){this['mailRpc'][_0x0230('0x22')](_0x256a5e,_0x1e7203)[_0x0230('0x13')](function(){_0x3170fa(null);})[_0x0230('0x15')](function(_0x21a85f){_0x3170fa(_0x21a85f);});};AGIVertices[_0x0230('0x11')][_0x0230('0x23')]=function(_0x750504,_0x251fd0){this[_0x0230('0xf')][_0x0230('0x24')](_0x750504)[_0x0230('0x13')](function(_0x190d43){if(_0x190d43){if(_0x190d43[_0x0230('0x25')]){_0x251fd0(null,[_0x190d43[_0x0230('0x26')]]);}else{_0x251fd0(null,_[_0x0230('0x27')](_0x190d43[_0x0230('0x28')],'interval'));}}else{_0x251fd0(null,![]);}})['catch'](function(_0x484fbf){_0x251fd0(_0x484fbf);});};AGIVertices[_0x0230('0x11')][_0x0230('0x20')]=function(_0x1af92b){return util['format'](_0x0230('0x29'),FILES_PATH,_0x1af92b);};AGIVertices['prototype'][_0x0230('0x2a')]=function(_0x59afeb,_0x4edb93,_0xe757c7){odbc['open'](_0x59afeb,function(_0x379042){if(_0x379042){logger[_0x0230('0x2b')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x379042);_0xe757c7(_0x379042);}else{logger[_0x0230('0x2c')](_0x0230('0x2d'));odbc[_0x0230('0x2e')](_0x4edb93,function(_0x37e28c,_0x2392ee){if(_0x37e28c){logger['info'](_0x0230('0x2f'),_0x4edb93);_0xe757c7(_0x37e28c);}else{logger[_0x0230('0x2c')](_0x0230('0x30'),_0x4edb93);odbc[_0x0230('0x31')](function(_0x5b92f7){if(_0x5b92f7){logger[_0x0230('0x2b')](_0x0230('0x32'),_0x5b92f7);}_0xe757c7(null,_0x2392ee);});}});}});};AGIVertices['prototype'][_0x0230('0x33')]=function(_0x563880,_0x4de99a){this[_0x0230('0xf')]['getSmsAccountById'](_0x563880)[_0x0230('0x13')](function(_0xf1c604){_0x4de99a(null,_0xf1c604?_0xf1c604:![]);})[_0x0230('0x15')](function(_0x56e050){_0x4de99a(_0x56e050);});};AGIVertices[_0x0230('0x11')][_0x0230('0x34')]=function(_0x1a8063,_0x4c2d7c){this[_0x0230('0xf')][_0x0230('0x34')](_0x1a8063)[_0x0230('0x13')](function(_0x5a86b7){_0x4c2d7c(null,_0x5a86b7);})['catch'](function(_0x258bac){_0x4c2d7c(_0x258bac);});};AGIVertices['prototype'][_0x0230('0x35')]=function(_0x5f343e,_0x436488,_0x164eea){this[_0x0230('0xf')][_0x0230('0x35')]({'uniqueid':this[_0x0230('0x36')][_0x0230('0x37')],'node':_0x5f343e[_0x0230('0x38')],'application':_0x5f343e[_0x0230('0x39')],'data':_0x436488||null,'project_name':this[_0x0230('0x36')][_0x0230('0x3a')],'callerid':this['channel'][_0x0230('0x3b')]})[_0x0230('0x13')](function(_0x5d890e){if(_0x164eea){_0x164eea(null,_0x5d890e);}})[_0x0230('0x15')](function(_0x30f4ae){if(_0x164eea){_0x164eea(_0x30f4ae);}});};AGIVertices[_0x0230('0x11')]['createSquareRecording']=function(_0xa373fa,_0x55f620,_0x5521b1,_0x248187){this[_0x0230('0xf')][_0x0230('0x3c')]({'uniqueid':this[_0x0230('0x36')][_0x0230('0x37')],'callerid':this[_0x0230('0x36')][_0x0230('0x3b')],'calleridname':this[_0x0230('0x36')][_0x0230('0x3d')],'context':this['channel'][_0x0230('0x3e')],'extension':this['channel'][_0x0230('0x3f')],'priority':this[_0x0230('0x36')]['priority'],'accountcode':this[_0x0230('0x36')]['accountcode'],'dnid':this[_0x0230('0x36')][_0x0230('0x40')],'projectName':this[_0x0230('0x36')][_0x0230('0x3a')],'saveName':_0x55f620,'filename':_0xa373fa['file']||_0x55f620,'savePath':_0x5521b1})[_0x0230('0x13')](function(_0x3a2e0b){_0x248187(null,_0x3a2e0b);})[_0x0230('0x15')](function(_0x48cbd6){_0x248187(_0x48cbd6);});};AGIVertices[_0x0230('0x11')][_0x0230('0x41')]=function(_0x19c18e,_0x4f0c3d,_0x4a4c02,_0x5513e8,_0x23be47){this[_0x0230('0xf')][_0x0230('0x41')]({'uniqueid':this[_0x0230('0x36')]['uniqueid'],'body':_0x19c18e,'direction':_0x4f0c3d,'providerName':_0x4a4c02,'providerResponse':_0x5513e8})[_0x0230('0x13')](function(_0x5c9d03){if(_0x23be47){_0x23be47(null,_0x5c9d03);}})[_0x0230('0x15')](function(_0x39c044){if(_0x23be47){_0x23be47(_0x39c044);}});};AGIVertices['prototype']['createCmContact']=function(_0x84cb98,_0x21c9c5){this['rpc'][_0x0230('0x42')]({'firstName':_[_0x0230('0x43')](_0x84cb98[_0x0230('0x14')])||_[_0x0230('0x44')](_0x84cb98[_0x0230('0x14')])?_0x0230('0x45')+Math[_0x0230('0x46')]():_0x84cb98[_0x0230('0x14')],'lastName':_['isEmpty'](_0x84cb98[_0x0230('0x47')])||_[_0x0230('0x44')](_0x84cb98[_0x0230('0x47')])?null:_0x84cb98[_0x0230('0x47')],'phone':_0x84cb98[_0x0230('0x48')],'ListId':_0x84cb98['list_id'],'scheduledat':_0x84cb98[_0x0230('0x49')],'callbackUniqueid':this[_0x0230('0x36')][_0x0230('0x37')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x84cb98[_0x0230('0x49')][_0x0230('0x4a')](),'priority':_0x84cb98[_0x0230('0x4b')]})['then'](function(_0x4ce215){_0x21c9c5(null,_0x4ce215);})['catch'](function(_0x477efb){_0x21c9c5(_0x477efb);});};AGIVertices[_0x0230('0x11')]['getPause']=function(_0x3ace14,_0x1e5908){this[_0x0230('0xf')]['getPauseById'](_0x3ace14)[_0x0230('0x13')](function(_0x158bb5){_0x1e5908(null,_0x158bb5?_0x158bb5[_0x0230('0x14')]:![]);})[_0x0230('0x15')](function(_0x5e0511){_0x1e5908(_0x5e0511);});};AGIVertices[_0x0230('0x11')][_0x0230('0x4c')]=function(_0xb60684,_0x6570db,_0x2c7fe6){var _0x53dcf5={'role':_0x0230('0x4d')};_0x53dcf5[_0xb60684]=this[_0x0230('0x36')][_0x0230('0x3b')];this['rpc'][_0x0230('0x4c')](_0x53dcf5,_0x6570db,this[_0x0230('0x36')][_0x0230('0x37')])[_0x0230('0x13')](function(_0x19b965){_0x2c7fe6(null,_[_0x0230('0x44')](_0x19b965)?![]:!![]);})[_0x0230('0x15')](function(_0x4c98e6){logger[_0x0230('0x2b')](_0x4c98e6);_0x2c7fe6(null,![]);});};AGIVertices[_0x0230('0x11')][_0x0230('0x4e')]=function(_0x1c66fe,_0x5dfe65){var _0xe4570b={'role':_0x0230('0x4d')};_0xe4570b[_0x1c66fe]=this[_0x0230('0x36')][_0x0230('0x3b')];this[_0x0230('0xf')]['agentUnpause'](_0xe4570b)['then'](function(_0x35e221){_0x5dfe65(null,_[_0x0230('0x44')](_0x35e221)?![]:!![]);})['catch'](function(_0x4946ca){logger[_0x0230('0x2b')](_0x4946ca);_0x5dfe65(null,![]);});};AGIVertices['prototype'][_0x0230('0x4f')]=function(_0x36d19f,_0x4472db){var _0x22b69f={'role':_0x0230('0x4d')};_0x22b69f[_0x36d19f]=this[_0x0230('0x36')][_0x0230('0x3b')];this['rpc']['agentLogout'](_0x22b69f)['then'](function(_0xbe0f11){_0x4472db(null,_['isNil'](_0xbe0f11)?![]:!![]);})[_0x0230('0x15')](function(_0x4deffa){logger[_0x0230('0x2b')](_0x4deffa);_0x4472db(null,![]);});};AGIVertices['prototype'][_0x0230('0x50')]=function(_0x14f50f,_0x1fefff){var _0x502819={'role':_0x0230('0x4d')};_0x502819[_0x14f50f]=this[_0x0230('0x36')]['callerid'];var _0x5347b9=_0x14f50f!='internal'?util[_0x0230('0x51')](_0x0230('0x52'),_0x0230('0x53'),this['channel']['callerid']):undefined;this[_0x0230('0xf')]['agentLogin'](_0x502819,_0x5347b9)[_0x0230('0x13')](function(_0x3bf41e){_0x1fefff(null,_['isNil'](_0x3bf41e)?![]:!![]);})[_0x0230('0x15')](function(_0x49ad9b){logger['error'](_0x49ad9b);_0x1fefff(null,![]);});};AGIVertices[_0x0230('0x11')][_0x0230('0x54')]=function(_0x3fd321,_0x4ad9f5){sh[_0x0230('0x55')](_['trim'](_0x3fd321),function(_0x54c03e,_0x2280e5){var _0x3da4a9=_0x2280e5[_0x0230('0x56')](/(\r\n|\n|\r)/gm,'');_0x4ad9f5(null,_0x3da4a9);});};AGIVertices[_0x0230('0x11')][_0x0230('0x57')]=function(_0x558022,_0x505166){scripts[_0x0230('0x57')](_0x558022[_0x0230('0x58')],_0x558022['google_cloud_tts_text_type']||'text',_0x558022[_0x0230('0x59')],_0x558022[_0x0230('0x5a')]||'en-US',_0x558022[_0x0230('0x5b')]||_0x0230('0x5c'),_0x558022[_0x0230('0x5d')]||_0x0230('0x5e'))[_0x0230('0x13')](function(_0xd73495){_0x505166(null,_0xd73495);})[_0x0230('0x15')](function(_0x80f21e){_0x505166(_0x80f21e);});};AGIVertices[_0x0230('0x11')]['googleTTS']=function(_0x1bb851,_0x52ff22){scripts[_0x0230('0x5f')](_0x1bb851[_0x0230('0x59')],_0x1bb851[_0x0230('0x60')]||'en',0x1)[_0x0230('0x13')](function(_0x3dcb97){_0x52ff22(null,_0x3dcb97);})[_0x0230('0x15')](function(_0x4751cc){_0x52ff22(_0x4751cc);});};AGIVertices['prototype'][_0x0230('0x61')]=function(_0x52972b,_0x247351){var _0x4d654f={'uri':_0x52972b[_0x0230('0x62')],'method':_0x52972b[_0x0230('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x52972b[_0x0230('0x64')])===_0x0230('0x65')&&parseInt(_0x52972b[_0x0230('0x64')])>=0x1?parseInt(_0x52972b['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x0230('0x66')]([_0x0230('0x67'),_0x0230('0x68')],_0x4d654f['method']['toUpperCase']())){try{_0x4d654f[_0x0230('0x69')]=_0x52972b[_0x0230('0xc')]?JSON[_0x0230('0x6a')](_0x52972b[_0x0230('0xc')]):{};}catch(_0x838ffe){logger['error'](_0x0230('0x6b'),_0x838ffe);}}try{_0x4d654f[_0x0230('0x6c')]=_0x52972b['rawHeaders']?JSON[_0x0230('0x6a')](_0x52972b['rawHeaders']):{};}catch(_0xf58dda){logger[_0x0230('0x2b')](_0x0230('0x6d'),_0xf58dda);}if(_0x52972b[_0x0230('0x6e')]){try{var _0x5c698d=require(_0x52972b[_0x0230('0x6e')])[_0x0230('0x6f')](this,_0x4d654f);_0x4d654f['uri']=Mustache[_0x0230('0x70')](_0x52972b[_0x0230('0x62')],_0x5c698d,{},['$$','$$']);if(_0x4d654f[_0x0230('0x6c')]){_0x4d654f[_0x0230('0x6c')]=JSON['parse'](Mustache[_0x0230('0x70')](JSON['stringify'](_0x4d654f[_0x0230('0x6c')]),_0x5c698d,{},['$$','$$']));}if(_0x4d654f['body']){_0x4d654f['body']=JSON[_0x0230('0x6a')](Mustache[_0x0230('0x70')](JSON['stringify'](_0x4d654f[_0x0230('0x69')]),_0x5c698d,{},['$$','$$']));}}catch(_0x5a05c4){logger[_0x0230('0x2b')](_0x0230('0x71'),_0x5a05c4);}}rp(_0x4d654f)[_0x0230('0x13')](function(_0x2c05b4){var _0x49cb13={'statusCode':_0x2c05b4['statusCode']||0xc8,'statusMessage':_0x2c05b4[_0x0230('0x72')]||'OK','headers':_0x2c05b4[_0x0230('0x6c')]||{},'body':_0x2c05b4[_0x0230('0x69')]||{}};_0x247351(null,_0x49cb13);})[_0x0230('0x15')](function(_0x370c60){var _0x538154={'statusCode':_0x370c60[_0x0230('0x73')]||0x1f4,'statusMessage':_0x370c60[_0x0230('0x74')]||_0x0230('0x75'),'headers':_0x370c60[_0x0230('0x76')]['headers']||{},'body':_0x370c60['options'][_0x0230('0x69')]||{}};_0x247351(null,_0x538154);});};AGIVertices[_0x0230('0x11')][_0x0230('0x77')]=function(_0x4ea29f,_0x554214){scripts['googleDialogflow'](this[_0x0230('0x36')][_0x0230('0x37')],_0x4ea29f[_0x0230('0x78')],_0x4ea29f[_0x0230('0x59')],_0x4ea29f[_0x0230('0x79')]||'en')[_0x0230('0x13')](function(_0x52b25b){_0x554214(null,_0x52b25b);})[_0x0230('0x15')](function(_0xcf34cc){_0x554214(_0xcf34cc);});};AGIVertices[_0x0230('0x11')][_0x0230('0x7a')]=function(_0x356a14,_0xd5d99f){scripts[_0x0230('0x7a')](this[_0x0230('0x36')][_0x0230('0x37')],_0x356a14['dialogflowV2_project_id'],_0x356a14[_0x0230('0x7b')],_0x356a14['private_key'],_0x356a14[_0x0230('0x59')],_0x356a14[_0x0230('0x7c')]||'en')['then'](function(_0x22bdae){_0xd5d99f(null,_0x22bdae);})[_0x0230('0x15')](function(_0x28ef05){_0xd5d99f(_0x28ef05);});};AGIVertices[_0x0230('0x11')][_0x0230('0x7d')]=function(_0x3210d6,_0x3191a0){scripts['sestekNDA'](this[_0x0230('0x36')],_0x3210d6)['then'](function(_0x5b3ca9){_0x3191a0(null,_0x5b3ca9);})[_0x0230('0x15')](function(_0x5be713){_0x3191a0(_0x5be713);});};AGIVertices[_0x0230('0x11')][_0x0230('0x7e')]=function(_0x13f573,_0x319d1e){scripts[_0x0230('0x7e')](_0x13f573[_0x0230('0x78')],_0x13f573[_0x0230('0x59')],_0x13f573[_0x0230('0x7f')]||_0x0230('0x80'),_0x13f573[_0x0230('0x81')])[_0x0230('0x13')](function(_0x58b645){_0x319d1e(null,_0x58b645);})[_0x0230('0x15')](function(_0x59d716){_0x319d1e(_0x59d716);});};AGIVertices[_0x0230('0x11')][_0x0230('0x82')]=function(_0x1c23dd,_0x4ec170,_0x1ce011){scripts['ispeechASR'](_0x4ec170,_0x1c23dd[_0x0230('0x78')],_0x1c23dd[_0x0230('0x83')]||_0x0230('0x80'),this[_0x0230('0x84')](_0x1c23dd[_0x0230('0x85')])?_0x1c23dd['model']:undefined)['then'](function(_0x1fe333){_0x1ce011(null,_0x1fe333);})[_0x0230('0x15')](function(_0x3235c5){_0x1ce011(_0x3235c5);});};AGIVertices['prototype'][_0x0230('0x86')]=function(_0x4681f9,_0x1c6f43){scripts[_0x0230('0x86')](_0x4681f9[_0x0230('0x87')],_0x4681f9[_0x0230('0x88')],_0x4681f9[_0x0230('0x89')],_0x4681f9[_0x0230('0x8a')]||_0x0230('0x8b'),_0x4681f9['text'],_0x4681f9[_0x0230('0x8c')]||_0x0230('0x59'))[_0x0230('0x13')](function(_0x36d9ab){_0x1c6f43(null,_0x36d9ab);})[_0x0230('0x15')](function(_0x522c68){_0x1c6f43(_0x522c68);});};AGIVertices[_0x0230('0x11')][_0x0230('0x8d')]=function(_0x8030ec,_0x522c03){scripts[_0x0230('0x8d')](this['channel']['uniqueid'],_0x8030ec['aws_access_key_id'],_0x8030ec[_0x0230('0x88')],_0x8030ec[_0x0230('0x8e')],_0x8030ec[_0x0230('0x59')],_0x8030ec[_0x0230('0x8f')])['then'](function(_0x5af5ee){_0x522c03(null,_0x5af5ee);})[_0x0230('0x15')](function(_0x383846){_0x522c03(_0x383846);});};AGIVertices['prototype']['googleASR']=function(_0x2cceb2,_0x19bf72,_0x193ff8){scripts[_0x0230('0x90')](_0x19bf72,_0x2cceb2[_0x0230('0x78')],_0x2cceb2[_0x0230('0x91')]||_0x0230('0x80'))[_0x0230('0x13')](function(_0x3e7d34){_0x193ff8(null,_0x3e7d34);})['catch'](function(_0x34da75){_0x193ff8(_0x34da75);});};AGIVertices['prototype'][_0x0230('0x92')]=function(_0x54356a,_0xba3a2e,_0x40cda6){scripts[_0x0230('0x92')](_0xba3a2e,_0x54356a[_0x0230('0x93')],_0x54356a[_0x0230('0x94')],_0x54356a['uri'])[_0x0230('0x13')](function(_0x4d2006){_0x40cda6(null,_0x4d2006);})['catch'](function(_0xf7dad7){_0x40cda6(_0xf7dad7);});};AGIVertices[_0x0230('0x11')][_0x0230('0x95')]=function(_0x44f02b){var _0x3eabc7=_[_0x0230('0x66')](verticesWithRetry,_0x44f02b['agicommand'])?_0x44f02b:_[_0x0230('0x96')](_0x44f02b);for(var _0x558200 in _0x3eabc7){if(_0x3eabc7[_0x0230('0x97')](_0x558200)){if(_0x3eabc7[_0x558200]&&_[_0x0230('0x98')](_0x3eabc7[_0x558200])){if(_['includes'](recursiveMapAttributes,_0x558200)){_0x3eabc7[_0x558200]=this[_0x0230('0x99')](_0x3eabc7[_0x558200]);}else{_0x3eabc7[_0x558200]=this[_0x0230('0x9a')](_0x3eabc7[_0x558200]);}}}}return _0x3eabc7;};AGIVertices[_0x0230('0x11')]['recursiveNodeIndex']=function(_0x40f3c4){for(var _0x361c25 in _0x40f3c4){if(_0x40f3c4[_0x0230('0x97')](_0x361c25)){if(_[_0x0230('0x9b')](_0x40f3c4[_0x361c25])){this[_0x0230('0x9c')](_0x40f3c4[_0x361c25]);}else if(_['isArray'](_0x40f3c4[_0x361c25])){for(var _0x3e66e4=0x0;_0x3e66e4<_0x40f3c4[_0x361c25][_0x0230('0x9d')];_0x3e66e4++){this[_0x0230('0x9c')](_0x40f3c4[_0x361c25][_0x3e66e4]);}}else if(_[_0x0230('0x98')](_0x40f3c4[_0x361c25])){_0x40f3c4[_0x361c25]=this['replaceAllVariables'](_0x40f3c4[_0x361c25]);}}}};AGIVertices[_0x0230('0x11')][_0x0230('0x9e')]=function(_0x2b38f7,_0x2f22e3){for(var _0x400f00 in _0x2b38f7){if(_0x2b38f7['hasOwnProperty'](_0x400f00)){if(_[_0x0230('0x9b')](_0x2b38f7[_0x400f00])){if(!_[_0x0230('0x43')](_0x2b38f7[_0x400f00])){this[_0x0230('0x9e')](_0x2b38f7[_0x400f00],util['format'](_0x0230('0x9f'),_0x2f22e3,_0x400f00));}}else if(_[_0x0230('0xa0')](_0x2b38f7[_0x400f00])){for(var _0x507742=0x0;_0x507742<_0x2b38f7[_0x400f00][_0x0230('0x9d')];_0x507742++){this[_0x0230('0x9e')](_0x2b38f7[_0x400f00][_0x507742],util['format']('%s.%s',_0x2f22e3,_0x400f00+'['+_0x507742+']'));}}else{if(!_[_0x0230('0x44')](_0x2b38f7[_0x400f00])){this[_0x0230('0x36')][_0x0230('0xa1')](util[_0x0230('0x51')](_0x0230('0x9f'),_0x2f22e3,_0x400f00),_0x2b38f7[_0x400f00]);}}}}};AGIVertices[_0x0230('0x11')][_0x0230('0x99')]=function(_0x48848){try{var _0xf92acd=JSON[_0x0230('0x6a')](_0x48848);this[_0x0230('0x9c')](_0xf92acd);return JSON[_0x0230('0xa2')](_0xf92acd);}catch(_0x2523b3){return this['replaceAllVariables'](_0x48848);}};AGIVertices[_0x0230('0x11')][_0x0230('0x9a')]=function(_0x294ada){var _0x281e11=_0x294ada[_0x0230('0xa3')]('{');for(var _0x5c8c8f=0x1;_0x5c8c8f<_0x281e11[_0x0230('0x9d')];_0x5c8c8f+=0x1){var _0x3cd1a7=_0x281e11[_0x5c8c8f][_0x0230('0xa3')]('}');if(_0x3cd1a7[_0x0230('0x9d')]>0x1){_0x294ada=_0x294ada[_0x0230('0xa4')]('{'+_0x3cd1a7[0x0]+'}',this[_0x0230('0x36')][_0x0230('0x12')](_0x3cd1a7[0x0])['extra']||_0x3cd1a7[0x0]);}}if(_0x281e11['length']===0x1){return _0x294ada[_0x0230('0x4a')]();}return this[_0x0230('0x9a')](_0x294ada);};AGIVertices[_0x0230('0x11')][_0x0230('0xa5')]=function(_0x3dde1e,_0x51d476){var _0x54761b=this['channel'][_0x0230('0x12')](_0x3dde1e);if(_0x54761b['result']===-0x1){return _0x54761b;}logger[_0x0230('0x2c')](util[_0x0230('0x51')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x51d476,_0x54761b[_0x0230('0xa6')]));return this[_0x0230('0x36')]['setVariable'](_0x51d476,_0x54761b[_0x0230('0xa6')]);};AGIVertices[_0x0230('0x11')][_0x0230('0x84')]=function(_0x36d11e){return _0x36d11e&&_0x36d11e!=='0'&&_0x36d11e!=='-1'&&_0x36d11e!=='';};AGIVertices['prototype'][_0x0230('0xa7')]=function(_0x2a4511){this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x2a4511,'-');_0x2a4511['retry']=_0x2a4511['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x0230('0x11')][_0x0230('0xa8')]=function(_0x3bc4da){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x3bc4da[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x3bc4da[_0x0230('0x59')])){return this[_0x0230('0x36')]['noop']('no\x20text\x20configured');}var _0x3d201a='\x22'+_0x3bc4da['text']+'\x22';if(this[_0x0230('0x84')](_0x3bc4da[_0x0230('0x76')])){_0x3d201a+=','+_0x3bc4da['options'];}var _0x277555=this['channel']['exec'](_0x0230('0xa9'),_0x3d201a);if(_0x277555[_0x0230('0xaa')]===-0x1){return _0x277555;}return this[_0x0230('0x36')][_0x0230('0xab')](util['format'](_0x0230('0xac'),_0x3d201a));};AGIVertices[_0x0230('0x11')][_0x0230('0xad')]=function(_0x4f55c6){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xae'),_0x4f55c6[_0x0230('0x38')]));if(!this['isConfigured'](_0x4f55c6[_0x0230('0xaf')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20grammar\x20configured');}var _0x3a402a=_0x4f55c6[_0x0230('0xaf')];if(this['isConfigured'](_0x4f55c6['options'])){_0x3a402a+=','+_0x4f55c6[_0x0230('0x76')];}var _0x2a100f=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0xb0'),_0x3a402a);if(_0x2a100f[_0x0230('0xaa')]===-0x1){return _0x2a100f;}var _0x5edc1d=this['getAndSetVariable'](_0x0230('0xb1'),_0x0230('0xb2'));if(_0x5edc1d['result']===-0x1){return _0x5edc1d;}var _0x921b15=this[_0x0230('0xa5')](_0x0230('0xb3'),_0x0230('0xb4'));if(_0x921b15[_0x0230('0xaa')]===-0x1){return _0x921b15;}var _0x504f24=this[_0x0230('0xa5')](_0x0230('0xb5'),_0x0230('0xb6'));if(_0x504f24[_0x0230('0xaa')]===-0x1){return _0x504f24;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xb7'),_0x3a402a));};AGIVertices[_0x0230('0x11')]['agi']=function(_0x2019b5){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2019b5[_0x0230('0x38')]));return this[_0x0230('0x36')][_0x0230('0xb8')]([_0x2019b5[_0x0230('0xb9')],_0x2019b5['args']]);};AGIVertices[_0x0230('0x11')][_0x0230('0xba')]=function(_0x2af277){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xbb'),_0x2af277[_0x0230('0x38')]));if(this['isConfigured'](_0x2af277[_0x0230('0x64')])){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x2af277[_0x0230('0x64')]));var _0x87b970=this[_0x0230('0x36')][_0x0230('0xbc')](_0x2af277[_0x0230('0x64')]);if(_0x87b970[_0x0230('0xaa')]===-0x1){return _0x87b970;}}return this[_0x0230('0x36')][_0x0230('0xba')]();};AGIVertices[_0x0230('0x11')]['callback']=function(_0x5a2f86){logger['info'](util[_0x0230('0x51')](_0x0230('0xbd'),_0x5a2f86['label']));if(!this[_0x0230('0x84')](_0x5a2f86['list_id'])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x5a2f86,_0x0230('0xbe'));}_0x5a2f86[_0x0230('0x49')]=moment();if(this['isConfigured'](_0x5a2f86[_0x0230('0xbf')])){_0x5a2f86[_0x0230('0x49')]=moment()['add'](_0x5a2f86[_0x0230('0xbf')],_0x0230('0xc0'));}if(!this[_0x0230('0x84')](_0x5a2f86['callback_priority'])){_0x5a2f86[_0x0230('0x4b')]=0x2;}this['createCmContact'][_0x0230('0x6f')](this,_0x5a2f86);return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xc1'),_0x5a2f86['phone'],_0x5a2f86['list_id'],_0x5a2f86[_0x0230('0x49')]));};AGIVertices['prototype'][_0x0230('0xc2')]=function(_0x375139){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x375139[_0x0230('0x38')]));var _0x5348dd=this['channel'][_0x0230('0x55')](_0x375139[_0x0230('0xc3')],_0x375139['options']);if(_0x5348dd[_0x0230('0xaa')]===-0x1){return _0x5348dd;}return this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')](_0x0230('0xc4'),_0x375139['application'],_0x375139[_0x0230('0x76')]));};AGIVertices[_0x0230('0x11')]['lumenvoxtts']=function(_0x9ca2c9){logger[_0x0230('0x2c')](util['format'](_0x0230('0xc5'),_0x9ca2c9[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x9ca2c9[_0x0230('0x59')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xc6'));}var _0x3eae39='\x22'+_0x9ca2c9['text']+'\x22';if(this['isConfigured'](_0x9ca2c9[_0x0230('0x76')])){_0x3eae39+=','+_0x9ca2c9[_0x0230('0x76')];}var _0x23fe58=this['channel'][_0x0230('0x55')](_0x0230('0xa9'),_0x3eae39);if(_0x23fe58[_0x0230('0xaa')]===-0x1){return _0x23fe58;}return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xac'),_0x3eae39));};AGIVertices['prototype'][_0x0230('0xc7')]=function(_0x320bef){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xc8'),_0x320bef[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x320bef[_0x0230('0x59')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20text\x20configured');}var _0x365f07='\x22'+_0x320bef[_0x0230('0x59')]+'\x22';if(this[_0x0230('0x84')](_0x320bef[_0x0230('0x76')])){_0x365f07+=','+_0x320bef[_0x0230('0x76')];}var _0x174b87=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0xa9'),_0x365f07);if(_0x174b87['result']===-0x1){return _0x174b87;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xac'),_0x365f07));};AGIVertices[_0x0230('0x11')][_0x0230('0xc9')]=function(_0x17af8f){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xca'),_0x17af8f[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x17af8f[_0x0230('0xaf')])){return this['channel'][_0x0230('0xab')](_0x0230('0xcb'));}var _0x5852de=_0x17af8f[_0x0230('0xaf')];if(this['isConfigured'](_0x17af8f['options'])){_0x5852de+=','+_0x17af8f[_0x0230('0x76')];}var _0x4c5ace=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0xb0'),_0x5852de);if(_0x4c5ace[_0x0230('0xaa')]===-0x1){return _0x4c5ace;}var _0x4168a7=this[_0x0230('0xa5')](_0x0230('0xb1'),'LUMENVOX_ASR_CONFIDENCE');if(_0x4168a7[_0x0230('0xaa')]===-0x1){return _0x4168a7;}var _0x427d53=this[_0x0230('0xa5')](_0x0230('0xb3'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x427d53[_0x0230('0xaa')]===-0x1){return _0x427d53;}var _0x4e3ecf=this[_0x0230('0xa5')]('RECOG_INSTANCE()',_0x0230('0xcc'));if(_0x4e3ecf[_0x0230('0xaa')]===-0x1){return _0x4e3ecf;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xb7'),_0x5852de));};AGIVertices[_0x0230('0x11')][_0x0230('0xcd')]=function(_0x1a5cfb){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xce'),_0x1a5cfb['label']));if(!this[_0x0230('0x84')](_0x1a5cfb['grammar'])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20grammar\x20configured');}var _0x546de8=_0x1a5cfb[_0x0230('0xaf')];if(this[_0x0230('0x84')](_0x1a5cfb['options'])){_0x546de8+=','+_0x1a5cfb[_0x0230('0x76')];}var _0x393436=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0xb0'),_0x546de8);if(_0x393436['result']===-0x1){return _0x393436;}var _0x132333=this['getAndSetVariable'](_0x0230('0xb1'),_0x0230('0xcf'));if(_0x132333[_0x0230('0xaa')]===-0x1){return _0x132333;}var _0x11d126=this[_0x0230('0xa5')](_0x0230('0xb3'),_0x0230('0xd0'));if(_0x11d126[_0x0230('0xaa')]===-0x1){return _0x11d126;}var _0xa7130b=this[_0x0230('0xa5')](_0x0230('0xb5'),_0x0230('0xd1'));if(_0xa7130b[_0x0230('0xaa')]===-0x1){return _0xa7130b;}return this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x546de8));};AGIVertices[_0x0230('0x11')][_0x0230('0xd2')]=function(_0x32705a){logger[_0x0230('0x2c')](util['format'](_0x0230('0xd3'),_0x32705a[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x32705a[_0x0230('0xd4')])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x32705a,_0x0230('0xd5'));}var _0x1932c3=this[_0x0230('0xd6')][_0x0230('0x6f')](this,_0x32705a['odbc_id']);if(!_0x1932c3){return this['channel'][_0x0230('0x2b')](_0x32705a,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x32705a['query'])){return this['channel']['error'](_0x32705a,_0x0230('0xd7'));}var _0x120135=_0x32705a[_0x0230('0x2e')][_0x0230('0x56')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x0230('0xab')](util['format'](_0x0230('0xd8'),_0x120135));var _0x3c47b9=this[_0x0230('0x2a')]['sync'](this,_0x1932c3,_0x120135);this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x32705a,_0x120135);if(!this[_0x0230('0x84')](_0x32705a['variable_id'])){return this['channel'][_0x0230('0xab')](_0x0230('0xd9'));}var _0x148a5b=this[_0x0230('0x12')]['sync'](this,_0x32705a[_0x0230('0xda')]);if(!_0x148a5b){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x32705a,_0x0230('0xdb'));}var _0x316442=this;_0x3c47b9[_0x0230('0xdc')](function(_0x510ac8,_0x10d8dc){Object[_0x0230('0xdd')](_0x510ac8)[_0x0230('0xdc')](function(_0x55e33d){_0x316442[_0x0230('0x36')][_0x0230('0xa1')](util[_0x0230('0x51')](_0x0230('0xde'),_0x148a5b,_0x10d8dc,_0x55e33d),_0x510ac8[_0x55e33d]);});});this['channel'][_0x0230('0xa1')](util[_0x0230('0x51')](_0x0230('0xdf'),_0x148a5b),_0x3c47b9[_0x0230('0x9d')]);return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xe0'),_0x148a5b));};AGIVertices[_0x0230('0x11')][_0x0230('0xe1')]=function(_0x4ee034){logger[_0x0230('0xe2')](util['format'](_0x0230('0xe3'),_0x4ee034[_0x0230('0x38')]));if(!this['isConfigured'](_0x4ee034['sip_id'])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x4ee034,'no\x20user\x20selected');}var _0x27946e=this[_0x0230('0x1a')]['sync'](this,_0x4ee034[_0x0230('0xe4')]);if(!_0x27946e){return this[_0x0230('0x36')]['error'](_0x4ee034,_0x0230('0xe5'));}var _0x3fc2c0=this['channel']['exec'](_0x0230('0xe6'),[util['format'](_0x0230('0xe7'),_0x27946e),_0x4ee034[_0x0230('0x64')],_0x4ee034['opts'],_0x4ee034[_0x0230('0x62')]]);if(_0x3fc2c0['result']===-0x1){return _0x3fc2c0;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('Executed\x20command\x20%s',_0x0230('0xe6')));};AGIVertices[_0x0230('0x11')][_0x0230('0xe8')]=function(_0x4e8e53){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0xe9'),_0x4e8e53[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x4e8e53[_0x0230('0x78')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xea'));}if(!this['isConfigured'](_0x4e8e53[_0x0230('0x59')])){return this['channel'][_0x0230('0xab')](_0x0230('0xc6'));}this['channel'][_0x0230('0xeb')]=!![];this[_0x0230('0x35')](_0x4e8e53);this[_0x0230('0x41')](_0x4e8e53['text'],'in','','');this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xec'),_0x4e8e53['text']));var _0x8162a7=this[_0x0230('0x77')][_0x0230('0x6f')](this,_0x4e8e53);if(_0x8162a7){for(var _0x1843c1 in _0x8162a7){if(_0x8162a7[_0x0230('0x97')](_0x1843c1)){this[_0x0230('0x36')][_0x0230('0xa1')](util[_0x0230('0x51')](_0x0230('0xed'),_0x1843c1[_0x0230('0xee')]()),_0x8162a7[_0x1843c1]);}}this[_0x0230('0x41')](_0x8162a7[_0x0230('0xef')],'out',_0x0230('0xe8'),'');return this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')](_0x0230('0xf0'),_0x8162a7['speech']));}return this[_0x0230('0x36')]['error'](_0x4e8e53,_0x0230('0xf1'));};AGIVertices[_0x0230('0x11')]['dialogflowV2']=function(_0x4468d5){logger[_0x0230('0x2c')](util['format'](_0x0230('0xf2'),_0x4468d5['label']));if(!this[_0x0230('0x84')](_0x4468d5[_0x0230('0xf3')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xf4'));}if(!this[_0x0230('0x84')](_0x4468d5[_0x0230('0x7b')])){return this[_0x0230('0x36')]['noop'](_0x0230('0xf5'));}if(!this[_0x0230('0x84')](_0x4468d5[_0x0230('0xf6')])){return this['channel'][_0x0230('0xab')](_0x0230('0xf7'));}if(!this['isConfigured'](_0x4468d5[_0x0230('0x7c')])){return this[_0x0230('0x36')]['noop'](_0x0230('0xf8'));}if(!this[_0x0230('0x84')](_0x4468d5[_0x0230('0x59')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x0230('0x35')](_0x4468d5);this[_0x0230('0x41')](_0x4468d5[_0x0230('0x59')],'in','','');this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xf9'),_0x4468d5['text']));var _0x4cc093=this[_0x0230('0x7a')][_0x0230('0x6f')](this,_0x4468d5);if(_0x4cc093){for(var _0x39dbbc in _0x4cc093){if(_0x4cc093[_0x0230('0x97')](_0x39dbbc)){if(_0x39dbbc!==_0x0230('0xfa')){this[_0x0230('0x36')]['setVariable'](util['format'](_0x0230('0xed'),_0x39dbbc['toUpperCase']()),_0x4cc093[_0x39dbbc]);}}}this['createSquareMessage'](_0x4cc093[_0x0230('0xef')],'out',_0x0230('0xfb'),_0x4cc093[_0x0230('0xfa')]);return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xfc'),_0x4cc093['speech']));}return this[_0x0230('0x36')][_0x0230('0x2b')](_0x4468d5,_0x0230('0xfd'));};AGIVertices[_0x0230('0x11')]['sesteknda']=function(_0x45aec3){logger[_0x0230('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x45aec3[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x45aec3['ndauth_url'])){return this['channel'][_0x0230('0xab')](_0x0230('0xfe'));}if(!this[_0x0230('0x84')](_0x45aec3[_0x0230('0xff')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x100'));}if(!this[_0x0230('0x84')](_0x45aec3['password'])){return this['channel']['noop'](_0x0230('0x101'));}if(!this[_0x0230('0x84')](_0x45aec3[_0x0230('0x102')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x0230('0x35')](_0x45aec3);this[_0x0230('0x41')](_0x45aec3['text'],'in','','');this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x103'),_0x45aec3[_0x0230('0x59')]));var _0x1a100d=this['sestekNDA'][_0x0230('0x6f')](this,_0x45aec3);if(_0x1a100d){for(var _0x135575 in _0x1a100d){if(_0x1a100d[_0x0230('0x97')](_0x135575)){this[_0x0230('0x36')]['setVariable'](util[_0x0230('0x51')](_0x0230('0x104'),_0x135575[_0x0230('0xee')]()),_0x1a100d[_0x135575]);}}this[_0x0230('0x41')](_0x1a100d[_0x0230('0xef')],_0x0230('0x105'),_0x0230('0x106'),'');if(_0x1a100d[_0x0230('0x107')]){this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x108'),_0x1a100d[_0x0230('0x107')]));var _0x30d0b0=this[_0x0230('0x36')][_0x0230('0x109')](_0x1a100d[_0x0230('0x107')]);try{fs[_0x0230('0x10a')](_0x1a100d[_0x0230('0x107')]+_0x0230('0x10b'));}catch(_0x6c187a){logger['error'](_0x6c187a);}return _0x30d0b0;}else{return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x10c'),_0x1a100d[_0x0230('0xef')]));}}return this[_0x0230('0x36')][_0x0230('0x2b')](_0x45aec3,_0x0230('0x10d'));};AGIVertices['prototype'][_0x0230('0x10e')]=function(_0x193db3){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20END\x20(%s)\x20block',_0x193db3[_0x0230('0x38')]));return this[_0x0230('0x36')]['noop']('end');};AGIVertices[_0x0230('0x11')]['ext_dial']=function(_0x460377){logger[_0x0230('0x2c')](util['format'](_0x0230('0x10f'),_0x460377[_0x0230('0x38')]));var _0x3e6fcb='';if(_0x460377[_0x0230('0x110')]){if(!this[_0x0230('0x84')](_0x460377[_0x0230('0x110')])){return this[_0x0230('0x36')]['error'](_0x460377,_0x0230('0x111'));}else{var _0xe15578=parseInt(_0x460377['trunk_id'],0xa);if(isNaN(_0xe15578)){_0x3e6fcb=_0x460377['trunk_id'];}else{_0x3e6fcb=this[_0x0230('0x1c')][_0x0230('0x6f')](this,_0x460377[_0x0230('0x110')]);if(!_0x3e6fcb){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x460377,_0x0230('0x112'));}}}}else if(_0x460377['trunk_name']){_0x3e6fcb=_0x460377['trunk_name'];}else{return this[_0x0230('0x36')][_0x0230('0x2b')](_0x460377,'no\x20trunk\x20selected');}var _0x152961=this[_0x0230('0x36')][_0x0230('0x55')]('DIAL',[util[_0x0230('0x51')](_0x0230('0x113'),_0x3e6fcb,_0x460377[_0x0230('0x48')]),_0x460377[_0x0230('0x64')],_0x460377[_0x0230('0x114')],_0x460377['url']]);if(_0x152961[_0x0230('0xaa')]===-0x1){return _0x152961;}return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x115'),_0x0230('0xe6')));};AGIVertices['prototype'][_0x0230('0x116')]=function(_0x1be58a){logger['info'](util['format'](_0x0230('0x117'),_0x1be58a[_0x0230('0x38')]));return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x116'));};AGIVertices['prototype'][_0x0230('0x118')]=function(_0x2406e7){logger[_0x0230('0x2c')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x2406e7[_0x0230('0x38')]));if(_0x2406e7[_0x0230('0x119')]===0x0){return this[_0x0230('0xa7')](_0x2406e7);}_0x2406e7[_0x0230('0x119')]-=0x1;if(!this['isConfigured'](_0x2406e7[_0x0230('0x11a')])){return this['channel'][_0x0230('0x2b')](_0x2406e7,_0x0230('0x11b'));}var _0x34a777=this['getSound'][_0x0230('0x6f')](this,_0x2406e7[_0x0230('0x11a')]);if(!_0x34a777){return this['channel']['error'](_0x2406e7,_0x0230('0x11c'));}if(!this['isConfigured'](_0x2406e7['variable_id'])){return this['channel'][_0x0230('0x2b')](_0x0230('0xd9'));}var _0x23ca9b=this[_0x0230('0x36')][_0x0230('0x11d')](_0x34a777,_0x2406e7['response'],_0x2406e7[_0x0230('0x11e')]);var _0x430235=_0x23ca9b[_0x0230('0xaa')]?_0x23ca9b['result']['toString']():'';logger[_0x0230('0x2c')](_0x0230('0x11f'),JSON[_0x0230('0xa2')](_0x23ca9b));if(_0x23ca9b[_0x0230('0xaa')]===-0x1){this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x2406e7,_0x430235);return _0x23ca9b;}else if(_0x23ca9b[_0x0230('0xa6')]===_0x0230('0x64')){_0x23ca9b[_0x0230('0xaa')]=_0x430235['length']>=parseInt(_0x2406e7[_0x0230('0x120')])?'x':'i';}else{_0x23ca9b['result']=_0x430235[_0x0230('0x9d')]>=parseInt(_0x2406e7[_0x0230('0x120')])&&_0x430235['length']<=parseInt(_0x2406e7[_0x0230('0x11e')])?'x':'i';}var _0x1467f3=this['getVariable']['sync'](this,_0x2406e7[_0x0230('0xda')]);if(!_0x1467f3){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x2406e7,_0x0230('0xdb'));}this['channel'][_0x0230('0xa1')](_0x1467f3,_0x430235);if(this['isConfigured'](_0x2406e7[_0x0230('0x121')])){var _0x514e1e=parseInt(_0x2406e7['hiddendigitsnum'],0xa);var _0x2408c2=rs[_0x0230('0x122')]({'charset':'*','length':_0x514e1e});var _0x1ee021=_0x430235['length'];if(_0x1ee021>0x0){if(_0x1ee021>_0x514e1e){this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x2406e7,_0x2406e7[_0x0230('0x123')]===_0x0230('0x124')?_0x2408c2+_0x430235['substr'](_0x514e1e):_0x430235[_0x0230('0x125')](0x0,_0x1ee021-_0x514e1e)+_0x2408c2);}else{this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x2406e7,rs[_0x0230('0x122')]({'charset':'*','length':_0x1ee021}));}}else{this[_0x0230('0x35')]['sync'](this,_0x2406e7,'');}}else{this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x2406e7,_0x430235);}return _0x23ca9b;};AGIVertices['prototype']['getsecretdigits']=function(_0x4703e7){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x126'),_0x4703e7[_0x0230('0x38')]));return this[_0x0230('0x118')](_0x4703e7);};AGIVertices['prototype']['goal']=function(_0x1d8570){logger['info'](util[_0x0230('0x51')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x1d8570[_0x0230('0x38')]));this[_0x0230('0x35')]['sync'](this,_0x1d8570,_0x1d8570[_0x0230('0x127')]);return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x128'),_0x1d8570[_0x0230('0x127')]));};AGIVertices[_0x0230('0x11')][_0x0230('0x129')]=function(_0x400bc5){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x12a'),_0x400bc5[_0x0230('0x38')]));if(!this['isConfigured'](_0x400bc5[_0x0230('0x87')])||!this[_0x0230('0x84')](_0x400bc5[_0x0230('0x88')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x12b'));}if(!this['isConfigured'](_0x400bc5[_0x0230('0x59')])){return this[_0x0230('0x36')]['noop'](_0x0230('0xc6'));}this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x12c'),_0x400bc5[_0x0230('0x59')]));var _0xed3cd=this[_0x0230('0x86')][_0x0230('0x6f')](this,_0x400bc5);if(_0xed3cd){this[_0x0230('0x36')][_0x0230('0xab')](util['format'](_0x0230('0x12d'),_0xed3cd));var _0x5b6357=this[_0x0230('0x36')]['streamFile'](_0xed3cd);try{fs[_0x0230('0x10a')](_0xed3cd+_0x0230('0x10b'));}catch(_0x22dad8){logger['error'](_0x22dad8);}return _0x5b6357;}return this['channel'][_0x0230('0x2b')](_0x400bc5,_0x0230('0x12e'));};AGIVertices[_0x0230('0x11')][_0x0230('0x12f')]=function(_0xd49e74){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0xd49e74[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0xd49e74['aws_access_key_id'])||!this[_0x0230('0x84')](_0xd49e74[_0x0230('0x88')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x12b'));}if(!this[_0x0230('0x84')](_0xd49e74['aws_bot_name'])){return this['channel'][_0x0230('0xab')](_0x0230('0x130'));}if(!this[_0x0230('0x84')](_0xd49e74[_0x0230('0x59')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20text\x20configured');}this['channel'][_0x0230('0xeb')]=!![];this['createSquareDetailsReport'](_0xd49e74);this['createSquareMessage'](_0xd49e74[_0x0230('0x59')],'in','','');this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x131'),_0xd49e74[_0x0230('0x59')]));var _0x36f7c0=this['awsLex'][_0x0230('0x6f')](this,_0xd49e74);if(_0x36f7c0){for(var _0x3279df in _0x36f7c0){if(_0x36f7c0[_0x0230('0x97')](_0x3279df)&&_[_0x0230('0x98')](_0x36f7c0[_0x3279df])){this[_0x0230('0x36')]['setVariable'](util[_0x0230('0x51')](_0x0230('0x132'),_0x3279df[_0x0230('0xee')]()),_0x36f7c0[_0x3279df]);}}if(_[_0x0230('0x44')](_0x36f7c0[_0x0230('0x74')])){return this[_0x0230('0x36')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x0230('0x41')](_0x36f7c0[_0x0230('0x74')],_0x0230('0x105'),_0x0230('0x133'),'');return this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')](_0x0230('0x134'),_0x36f7c0['message']));}}return this[_0x0230('0x36')][_0x0230('0x2b')](_0xd49e74,_0x0230('0x135'));};AGIVertices[_0x0230('0x11')][_0x0230('0x136')]=function(_0x9b0f79){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x137'),_0x9b0f79[_0x0230('0x38')],_0x9b0f79[_0x0230('0x64')]));if(!this[_0x0230('0x84')](_0x9b0f79[_0x0230('0x78')])){return this['channel'][_0x0230('0xab')](_0x0230('0xea'));}var _0x3bfbc6='wav';var _0x3527eb=util['format'](_0x0230('0x138'),FILES_PATH,rs[_0x0230('0x122')](0x4));var _0x2d40af=util[_0x0230('0x51')](_0x0230('0x9f'),_0x3527eb,_0x3bfbc6);var _0x4fb918=!![];if(_0x9b0f79[_0x0230('0x139')]===_0x0230('0x13a')){_0x4fb918=![];}var _0x2dbf08=this[_0x0230('0x36')]['recordFile'](_0x3527eb,_0x3bfbc6,_0x9b0f79[_0x0230('0x13b')],_0x9b0f79[_0x0230('0x64')],undefined,_0x4fb918);if(_0x2dbf08[_0x0230('0xaa')]!==-0x1){this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('google\x20%s\x20file\x20created',_0x2d40af));var _0x215cc1=this[_0x0230('0x90')][_0x0230('0x6f')](this,_0x9b0f79,_0x2d40af);if(_0x215cc1){for(var _0x1bf426 in _0x215cc1){if(_0x215cc1[_0x0230('0x97')](_0x1bf426)){this['channel'][_0x0230('0xa1')](util[_0x0230('0x51')](_0x0230('0x13c'),_0x1bf426[_0x0230('0xee')]()),_0x215cc1[_0x1bf426]);}}return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x13d'),JSON[_0x0230('0xa2')](_0x215cc1)));}}return _0x2dbf08;};AGIVertices[_0x0230('0x11')][_0x0230('0x13e')]=function(_0x1da1b9){logger['info'](util['format']('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1da1b9[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x1da1b9[_0x0230('0x93')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x13f'));}if(!this[_0x0230('0x84')](_0x1da1b9[_0x0230('0x94')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x140'));}var _0x3ec680=_0x0230('0x141');var _0x2a50db=util[_0x0230('0x51')](_0x0230('0x138'),FILES_PATH,rs[_0x0230('0x122')](0x4));var _0x521945=util['format']('%s.%s',_0x2a50db,_0x3ec680);var _0x39240d=!![];if(_0x1da1b9[_0x0230('0x139')]===_0x0230('0x13a')){_0x39240d=![];}var _0x39bbc2=this[_0x0230('0x36')][_0x0230('0x142')](_0x2a50db,_0x3ec680,_0x1da1b9[_0x0230('0x13b')],_0x1da1b9[_0x0230('0x64')],undefined,_0x39240d);if(_0x39bbc2[_0x0230('0xaa')]!==-0x1){this[_0x0230('0x36')][_0x0230('0xab')](util['format'](_0x0230('0x143'),_0x521945));var _0x2c27cf=this[_0x0230('0x92')][_0x0230('0x6f')](this,_0x1da1b9,_0x521945);if(_0x2c27cf){for(var _0x3787bb in _0x2c27cf){if(_0x2c27cf['hasOwnProperty'](_0x3787bb)){this[_0x0230('0x36')][_0x0230('0xa1')](util['format']('TILDE_ASR_%s',_0x3787bb[_0x0230('0xee')]()),_0x2c27cf[_0x3787bb]);}}return this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x2c27cf)));}}return _0x39bbc2;};AGIVertices['prototype'][_0x0230('0x144')]=function(_0x5adb58){logger['info'](util[_0x0230('0x51')](_0x0230('0x145'),_0x5adb58[_0x0230('0x38')]));return this[_0x0230('0x36')]['continueAt'](_0x5adb58[_0x0230('0x3e')],_0x5adb58[_0x0230('0x3f')],_0x5adb58[_0x0230('0x146')]);};AGIVertices[_0x0230('0x11')][_0x0230('0x147')]=function(_0x165d3e){logger['info'](util['format'](_0x0230('0x148'),_0x165d3e[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x165d3e[_0x0230('0x149')])){return this['channel'][_0x0230('0x2b')](_0x165d3e,_0x0230('0x14a'));}try{var _0x10a4a2=eval(_0x165d3e[_0x0230('0x149')])?_0x0230('0x14b'):_0x0230('0x14c');this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('EVAL\x20CONDITION\x20%s\x20%s',_0x165d3e[_0x0230('0x149')],_0x10a4a2));return{'code':0xc8,'result':_0x10a4a2};}catch(_0xad55a){return{'code':0xc8,'result':_0x0230('0x14c')};}};AGIVertices[_0x0230('0x11')][_0x0230('0x14d')]=function(_0x1c9d49){logger[_0x0230('0x2c')](util['format'](_0x0230('0x14e'),_0x1c9d49[_0x0230('0x38')]));if(!this['isConfigured'](_0x1c9d49[_0x0230('0x14f')])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x1c9d49,_0x0230('0x150'));}var _0x4813dd=this[_0x0230('0x23')][_0x0230('0x6f')](this,_0x1c9d49[_0x0230('0x14f')]);if(!_0x4813dd){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x1c9d49,_0x0230('0x151'));}for(var _0x2b6fe3=0x0;_0x2b6fe3<_0x4813dd[_0x0230('0x9d')];_0x2b6fe3+=0x1){var _0x312fd1=this[_0x0230('0x36')][_0x0230('0x12')](util[_0x0230('0x51')](_0x0230('0x152'),_0x4813dd[_0x2b6fe3]));if(_0x312fd1[_0x0230('0xaa')]===-0x1){return _0x312fd1;}logger['info'](util['format'](_0x0230('0x153'),_0x4813dd[_0x2b6fe3],_0x312fd1[_0x0230('0xa6')]));if(_0x312fd1[_0x0230('0xa6')]===_0x0230('0x14b')){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x153'),_0x4813dd[_0x2b6fe3],_0x0230('0x14b')));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x153'),_0x4813dd[_0x2b6fe3],_0x0230('0x14b')));return{'code':0xc8,'result':'true'};}else{logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x153'),_0x4813dd[_0x2b6fe3],_0x0230('0x14c')));this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')](_0x0230('0x153'),_0x4813dd[_0x2b6fe3],_0x0230('0x14c')));}}return{'code':0xc8,'result':_0x0230('0x14c')};};AGIVertices[_0x0230('0x11')][_0x0230('0x154')]=function(_0xe749c3){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x155'),_0xe749c3['label']));return this[_0x0230('0x36')]['hangup']();};AGIVertices[_0x0230('0x11')][_0x0230('0x156')]=function(_0x1786e3){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x157'),_0x1786e3[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x1786e3[_0x0230('0x78')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xea'));}var _0x40b9f3=_0x0230('0x141');var _0x1ba235=util['format'](_0x0230('0x138'),FILES_PATH,rs[_0x0230('0x122')](0x4));var _0x350c5b=util[_0x0230('0x51')]('%s.%s',_0x1ba235,_0x40b9f3);var _0x3d6fda=!![];if(_0x1786e3[_0x0230('0x139')]==='NOBEEP'){_0x3d6fda=![];}var _0x59e0bd=this[_0x0230('0x36')][_0x0230('0x142')](_0x1ba235,_0x40b9f3,_0x1786e3['intKey'],_0x1786e3[_0x0230('0x64')],undefined,_0x3d6fda);if(_0x59e0bd[_0x0230('0xaa')]!==-0x1){this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')]('ispeech\x20%s\x20file\x20created',_0x350c5b));var _0x18a861=this[_0x0230('0x82')][_0x0230('0x6f')](this,_0x1786e3,_0x350c5b);if(_0x18a861){for(var _0x5978bb in _0x18a861){if(_0x18a861[_0x0230('0x97')](_0x5978bb)){this[_0x0230('0x36')][_0x0230('0xa1')](util['format'](_0x0230('0x158'),_0x5978bb[_0x0230('0xee')]()),_0x18a861[_0x5978bb]);}}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x159'),JSON[_0x0230('0xa2')](_0x18a861)));}}return _0x59e0bd;};AGIVertices['prototype'][_0x0230('0x15a')]=function(_0x495484){logger[_0x0230('0x2c')](util['format'](_0x0230('0x15b'),_0x495484[_0x0230('0x38')]));if(!this['isConfigured'](_0x495484[_0x0230('0x78')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xea'));}if(!this[_0x0230('0x84')](_0x495484[_0x0230('0x59')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0xc6'));}this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x15c'),_0x495484[_0x0230('0x59')]));var _0x2e2bbd=this[_0x0230('0x7e')][_0x0230('0x6f')](this,_0x495484);if(_0x2e2bbd){this[_0x0230('0x36')]['noop'](util[_0x0230('0x51')]('ispeech\x20%s\x20file\x20created',_0x2e2bbd));var _0x7fff5=this['channel'][_0x0230('0x109')](_0x2e2bbd,_0x495484[_0x0230('0x13b')]);try{fs[_0x0230('0x10a')](_0x2e2bbd+_0x0230('0x10b'));}catch(_0x1a3286){logger[_0x0230('0x2b')](_0x1a3286);}return _0x7fff5;}return this[_0x0230('0x36')][_0x0230('0x2b')](_0x495484,_0x0230('0x15d'));};AGIVertices[_0x0230('0x11')]['login']=function(_0x1823ff){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x15e'),_0x1823ff[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x1823ff[_0x0230('0x15f')])){return this['channel'][_0x0230('0x2b')](_0x1823ff,_0x0230('0x160'));}logger['info'](util[_0x0230('0x51')](_0x0230('0x161'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x1823ff[_0x0230('0x15f')]));var _0x890944=this[_0x0230('0x50')]['sync'](this,_0x1823ff['findBy']);if(_0x890944){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x162'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x1823ff[_0x0230('0x15f')]));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x162'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x1823ff[_0x0230('0x15f')]));return{'code':0xc8,'result':_0x0230('0x163')};}else{logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x164'),this[_0x0230('0x36')]['callerid'],_0x1823ff[_0x0230('0x15f')]));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0230('0x36')][_0x0230('0x3b')],_0x1823ff[_0x0230('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0230('0x165')]=function(_0x4199a2){logger['info'](util[_0x0230('0x51')](_0x0230('0x166'),_0x4199a2[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x4199a2[_0x0230('0x15f')])){return this['channel'][_0x0230('0x2b')](_0x4199a2,_0x0230('0x160'));}logger[_0x0230('0x2c')](util['format'](_0x0230('0x161'),this['channel'][_0x0230('0x3b')],_0x4199a2[_0x0230('0x15f')]));var _0x473136=this[_0x0230('0x4f')][_0x0230('0x6f')](this,_0x4199a2[_0x0230('0x15f')]);if(_0x473136){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0230('0x36')][_0x0230('0x3b')],_0x4199a2[_0x0230('0x15f')]));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x162'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x4199a2['findBy']));return{'code':0xc8,'result':_0x0230('0x163')};}else{logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x164'),this['channel']['callerid'],_0x4199a2[_0x0230('0x15f')]));this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x164'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x4199a2[_0x0230('0x15f')]));return{'code':0xc8,'result':_0x0230('0x167')};}};AGIVertices[_0x0230('0x11')]['math']=function(_0x39b8c7){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x168'),_0x39b8c7['label']));if(!this['isConfigured'](_0x39b8c7[_0x0230('0x169')])){return this['channel']['error'](_0x39b8c7,_0x0230('0x16a'));}this['channel'][_0x0230('0xab')](util[_0x0230('0x51')]('math\x20%s',_0x39b8c7[_0x0230('0x169')]));var _0x83fba6=eval(_0x39b8c7[_0x0230('0x169')]);if(!this[_0x0230('0x84')](_0x39b8c7[_0x0230('0xda')])){return this['channel'][_0x0230('0xab')](_0x0230('0xd9'));}var _0x80ed9b=this['getVariable'][_0x0230('0x6f')](this,_0x39b8c7[_0x0230('0xda')]);if(!_0x80ed9b){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x39b8c7,'no\x20variable\x20found');}if(_['isArray'](_0x83fba6)){var _0x406190=this;_0x83fba6[_0x0230('0xdc')](function(_0xfa6402,_0x1fc32e){_0x406190[_0x0230('0x36')]['setVariable'](util[_0x0230('0x51')](_0x0230('0x16b'),_0x80ed9b,_0x1fc32e),_0xfa6402);});return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x16c'),_0x80ed9b));}else{return this[_0x0230('0x36')][_0x0230('0xa1')](_0x80ed9b,_0x83fba6);}};AGIVertices[_0x0230('0x11')][_0x0230('0xd')]=function(_0x271da0){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x16d'),_0x271da0['label']));if(_0x271da0[_0x0230('0x119')]===0x0){return this[_0x0230('0xa7')](_0x271da0);}_0x271da0[_0x0230('0x119')]-=0x1;if(!this[_0x0230('0x84')](_0x271da0['file_id'])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x271da0,_0x0230('0x11b'));}var _0x3d9c8c=this[_0x0230('0x1e')][_0x0230('0x6f')](this,_0x271da0[_0x0230('0x11a')]);if(!_0x3d9c8c){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x271da0,_0x0230('0x11c'));}var _0x1134e2=this[_0x0230('0x36')][_0x0230('0x11d')](_0x3d9c8c,_0x271da0['response'],_0x271da0[_0x0230('0x16e')]);var _0x34260f=_0x1134e2[_0x0230('0xaa')];if(_0x1134e2[_0x0230('0xaa')]===-0x1){this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x271da0,'-1');return _0x1134e2;}else if(_0x1134e2['extra']===_0x0230('0x64')){_0x1134e2[_0x0230('0xaa')]=_0x1134e2[_0x0230('0xaa')]['length']>0x0?_0x1134e2[_0x0230('0xaa')]:'t';}else if(_[_0x0230('0x43')](_0x1134e2[_0x0230('0xaa')])){_0x1134e2[_0x0230('0xaa')]='#';_0x34260f='#';}if(!this[_0x0230('0x84')](_0x271da0['variable_id'])){this[_0x0230('0x36')][_0x0230('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x38533c=this[_0x0230('0x12')]['sync'](this,_0x271da0[_0x0230('0xda')]);if(!_0x38533c){return this['channel'][_0x0230('0x2b')](_0x271da0,_0x0230('0xdb'));}this[_0x0230('0x36')][_0x0230('0xa1')](_0x38533c,_0x34260f);}this[_0x0230('0x35')]['sync'](this,_0x271da0,_0x34260f);return _0x1134e2;};AGIVertices[_0x0230('0x11')]['noop']=function(_0x335d3c){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x16f'),_0x335d3c[_0x0230('0x38')]));return this['channel']['noop'](_0x335d3c[_0x0230('0x170')]||_0x335d3c['label']);};AGIVertices[_0x0230('0x11')]['pause']=function(_0x47b9e4){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x171'),_0x47b9e4[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x47b9e4[_0x0230('0x15f')])){return this['channel'][_0x0230('0x2b')](_0x47b9e4,_0x0230('0x160'));}logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x161'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x47b9e4[_0x0230('0x15f')]));var _0x11444e=this[_0x0230('0x172')][_0x0230('0x6f')](this,_0x47b9e4['pause_id']);var _0x1e80d6=this['agentPause'][_0x0230('0x6f')](this,_0x47b9e4['findBy'],_0x11444e);if(_0x1e80d6){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x162'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x47b9e4[_0x0230('0x15f')]));this['channel']['noop'](util[_0x0230('0x51')](_0x0230('0x162'),this[_0x0230('0x36')]['callerid'],_0x47b9e4[_0x0230('0x15f')]));return{'code':0xc8,'result':_0x0230('0x163')};}else{logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x164'),this['channel']['callerid'],_0x47b9e4[_0x0230('0x15f')]));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x162'),this['channel'][_0x0230('0x3b')],_0x47b9e4[_0x0230('0x15f')]));return{'code':0xc8,'result':_0x0230('0x167')};}};AGIVertices[_0x0230('0x11')][_0x0230('0x173')]=function(_0x1c5cd0){logger['info'](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x1c5cd0[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x1c5cd0[_0x0230('0x11a')])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x1c5cd0,_0x0230('0x11b'));}var _0x30fc9f=this[_0x0230('0x1e')][_0x0230('0x6f')](this,_0x1c5cd0[_0x0230('0x11a')]);if(!_0x30fc9f){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x1c5cd0,_0x0230('0x11c'));}var _0x1eba1e=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0x174'),[_0x30fc9f,_0x1c5cd0[_0x0230('0x114')]]);if(_0x1eba1e[_0x0230('0xaa')]===-0x1){return _0x1eba1e;}return this['channel'][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xc4'),'PLAYBACK',_0x30fc9f));};AGIVertices[_0x0230('0x11')][_0x0230('0x175')]=function(_0x26c359){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x176'),_0x26c359[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x26c359[_0x0230('0x177')])){return this[_0x0230('0x36')]['error'](_0x26c359,'no\x20queue\x20selected');}var _0x47b898='';var _0x5898fa=parseInt(_0x26c359['queue_id'],0xa);if(isNaN(_0x5898fa)){_0x47b898=_0x26c359['queue_id'];}else{_0x47b898=this['getVoiceQueue']['sync'](this,_0x26c359[_0x0230('0x177')]);if(!_0x47b898){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x26c359,'no\x20queue\x20found');}}var _0x17e839='';if(this[_0x0230('0x84')](_0x26c359[_0x0230('0x11a')])){var _0xf8b44f=this[_0x0230('0x1e')][_0x0230('0x6f')](this,_0x26c359[_0x0230('0x11a')]);if(_0xf8b44f){_0x17e839=_0xf8b44f;}}this['createSquareDetailsReport'][_0x0230('0x6f')](this,_0x26c359,_0x47b898);if(_0x26c359[_0x0230('0x114')][_0x0230('0x178')]('x')<0x0){_0x26c359[_0x0230('0x114')]+='x';}if(_0x26c359['opts'][_0x0230('0x178')]('X')<0x0){_0x26c359['opts']+='X';}this[_0x0230('0x36')]['setVariable']('XMCS-QUEUE',_0x47b898?_0x47b898[_0x0230('0x179')]():'');var _0x31829f=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0x17a'),[_0x47b898,_0x26c359[_0x0230('0x114')],_0x26c359[_0x0230('0x62')],_0x17e839,_0x26c359['timeout'],_0x26c359[_0x0230('0xb8')],_0x26c359[_0x0230('0x17b')],_0x26c359['gosub'],'',_0x26c359[_0x0230('0x17c')]]);if(_0x31829f[_0x0230('0xaa')]===-0x1){return _0x31829f;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('Executed\x20command\x20%s\x20%s',_0x0230('0x17a'),_0x47b898));};AGIVertices['prototype']['record']=function(_0x52d967){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x52d967['label']));var _0x213a0d=_0x52d967[_0x0230('0x17d')]||_0x0230('0x141');var _0x53a3c6=util['format'](_0x0230('0x17e'),this['channel'][_0x0230('0x37')],rs[_0x0230('0x122')](0x5));var _0x4a25df=util[_0x0230('0x51')](_0x0230('0x17f'),FILES_PATH,_0x53a3c6,_0x213a0d);var _0x2ca2f2=util[_0x0230('0x51')]('%s/recordings/%s',FILES_PATH,_0x53a3c6);this['createSquareRecording'][_0x0230('0x6f')](this,_0x52d967,_0x53a3c6,_0x4a25df);this[_0x0230('0x36')]['setVariable']('RECORDING_SAVENAME',_0x53a3c6);logger[_0x0230('0x2c')](_0x0230('0x180'),_0x2ca2f2,_0x213a0d,_0x52d967[_0x0230('0x181')],_0x52d967[_0x0230('0x64')]);return this['channel']['recordFile'](_0x2ca2f2,_0x213a0d,_0x52d967['escape_digits'],_0x52d967['timeout'],undefined,!![]);};AGIVertices[_0x0230('0x11')][_0x0230('0x182')]=function(_0x17b6ac){logger['info'](util[_0x0230('0x51')](_0x0230('0x183'),_0x17b6ac['label']));if(!this[_0x0230('0x84')](_0x17b6ac[_0x0230('0x62')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x184'));}var _0x5d984b=this[_0x0230('0x61')][_0x0230('0x6f')](this,_0x17b6ac);logger['info'](util[_0x0230('0x51')](_0x0230('0x185'),util[_0x0230('0x186')](_0x5d984b,{'showHidden':![],'depth':null})));if(!this[_0x0230('0x84')](_0x17b6ac['variable_id'])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x187'));}var _0x18c3f7=this[_0x0230('0x12')][_0x0230('0x6f')](this,_0x17b6ac[_0x0230('0xda')]);if(!_0x18c3f7){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x17b6ac,_0x0230('0xdb'));}this[_0x0230('0x36')]['setVariable'](util['format'](_0x0230('0x188'),_0x18c3f7),_0x5d984b[_0x0230('0x73')]?_0x5d984b[_0x0230('0x73')]:_0x0230('0x189'));this[_0x0230('0x36')][_0x0230('0xa1')](util['format']('%s_STATUS_MESSAGE',_0x18c3f7),_0x5d984b[_0x0230('0x72')]?_0x5d984b['statusMessage']:'OK');if(_0x5d984b[_0x0230('0x69')]){try{this[_0x0230('0x9e')](_0x5d984b['body'],_0x18c3f7);}catch(_0x5e5d97){logger[_0x0230('0x2b')](util[_0x0230('0x51')](_0x0230('0x18a'),_0x18c3f7));}}return this[_0x0230('0x36')][_0x0230('0xab')](util['format'](_0x0230('0xe0'),_0x18c3f7));};AGIVertices[_0x0230('0x11')][_0x0230('0x18b')]=function(_0x155b6b){logger[_0x0230('0x2c')](util['format'](_0x0230('0x18c'),_0x155b6b[_0x0230('0x38')]));return this['channel'][_0x0230('0x18d')](_0x155b6b[_0x0230('0x18e')][_0x0230('0x56')](/\s+/g,''),_0x155b6b[_0x0230('0x181')]);};AGIVertices[_0x0230('0x11')][_0x0230('0x18f')]=function(_0x12dfc6){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x190'),_0x12dfc6[_0x0230('0x38')]));return this['channel'][_0x0230('0x191')](_0x12dfc6[_0x0230('0x65')][_0x0230('0x56')](/\s+/g,''),_0x12dfc6[_0x0230('0x181')]);};AGIVertices['prototype'][_0x0230('0x192')]=function(_0x210250){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x210250['label']));return this[_0x0230('0x36')]['sayPhonetic'](_0x210250[_0x0230('0x59')],_0x210250['escape_digits']);};AGIVertices[_0x0230('0x11')]['sendMail']=function(_0x20e037){logger[_0x0230('0x2c')](util['format'](_0x0230('0x193'),_0x20e037[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x20e037[_0x0230('0x194')])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20mail\x20account\x20configured');}var _0x4ed310=this['getMailAccount']['sync'](this,_0x20e037[_0x0230('0x194')]);if(!_0x4ed310||!_0x4ed310[_0x0230('0x195')]){return this['channel']['error'](_0x20e037,_0x0230('0x196'));}var _0x22f39e={'from':util['format'](_0x0230('0x197'),_0x4ed310['name'],_0x4ed310[_0x0230('0x198')]||_0x4ed310[_0x0230('0x195')][_0x0230('0x199')]),'to':_0x20e037['to']||'','cc':_0x20e037['cc']||'','bcc':_0x20e037[_0x0230('0x19a')]||'','subject':_0x20e037[_0x0230('0x19b')],'html':_0x20e037['text'],'text':_0x20e037['text']};var _0x56dd25={'tls':{'rejectUnauthorized':![]}};if(_0x4ed310[_0x0230('0x195')][_0x0230('0x19c')]){_0x56dd25[_0x0230('0x19c')]=_0x4ed310['Smtp']['service'];}else{_0x56dd25[_0x0230('0x19d')]=_0x4ed310[_0x0230('0x195')]['host'];_0x56dd25[_0x0230('0x19e')]=_0x4ed310[_0x0230('0x195')][_0x0230('0x19e')];_0x56dd25[_0x0230('0x19f')]=_0x4ed310['Smtp']['secure'];}if(_0x4ed310['Smtp'][_0x0230('0x1a0')]){_0x56dd25[_0x0230('0x1a1')]={'user':_0x4ed310[_0x0230('0x195')][_0x0230('0x199')],'pass':_0x4ed310[_0x0230('0x195')][_0x0230('0x1a2')]};}if(this[_0x0230('0x84')](_0x20e037[_0x0230('0x1a3')])){}logger[_0x0230('0xe2')](_0x0230('0x1a4'),JSON[_0x0230('0xa2')](_0x22f39e));this[_0x0230('0x35')][_0x0230('0x6f')](this,_0x20e037,_0x20e037['account_id']);this['channel'][_0x0230('0xab')](util['format'](_0x0230('0x1a5'),_0x4ed310[_0x0230('0x14')]));this[_0x0230('0x22')][_0x0230('0x6f')](this,_0x56dd25,_0x22f39e);return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x1a6'));};AGIVertices['prototype'][_0x0230('0x1a7')]=function(_0x52842e){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x1a8'),_0x52842e[_0x0230('0x38')]));return this[_0x0230('0x36')]['noop'](_0x0230('0x1a9'));};AGIVertices['prototype']['sendSMS']=function(_0x168442){logger[_0x0230('0x2c')](util['format'](_0x0230('0x1aa'),_0x168442['label']));if(!this[_0x0230('0x84')](_0x168442[_0x0230('0x1ab')])){return this['channel'][_0x0230('0xab')]('no\x20sms\x20account\x20configured');}var _0x2c5213=this[_0x0230('0x33')][_0x0230('0x6f')](this,_0x168442[_0x0230('0x1ab')]);if(!_0x2c5213){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x168442,_0x0230('0x1ac'));}var _0x20853e={'body':_0x168442['sms_text'],'phone':_0x168442['to']||'','SmsAccountId':_0x2c5213['id']};logger[_0x0230('0xe2')](_0x0230('0x1ad'),JSON[_0x0230('0xa2')](_0x20853e));this[_0x0230('0x35')]['sync'](this,_0x168442,_0x168442[_0x0230('0x1ab')]);this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x1ae'),_0x2c5213[_0x0230('0x14')]));this[_0x0230('0x34')][_0x0230('0x6f')](this,_0x20853e);return this[_0x0230('0x36')]['noop'](_0x0230('0x1af'));};AGIVertices[_0x0230('0x11')][_0x0230('0x1b0')]=function(_0x1e6115){logger['info'](util[_0x0230('0x51')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x1e6115['label']));if(!this[_0x0230('0x84')](_0x1e6115[_0x0230('0xda')])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x1e6115,_0x0230('0x1b1'));}var _0x5a6086=this[_0x0230('0x12')][_0x0230('0x6f')](this,_0x1e6115[_0x0230('0xda')]);if(!_0x5a6086){return this[_0x0230('0x36')]['error'](_0x1e6115,'no\x20variable\x20found');}return this[_0x0230('0x36')]['setVariable'](_0x5a6086,_0x1e6115[_0x0230('0x1b2')]);};AGIVertices[_0x0230('0x11')][_0x0230('0x1b3')]=function(_0x5debc6){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20START\x20(%s)\x20block',_0x5debc6[_0x0230('0x38')]));this['channel'][_0x0230('0xab')]('START\x20CALLY\x20SQUARE');if(_0x5debc6[_0x0230('0xba')]===_0x0230('0x1b4')){this[_0x0230('0x36')][_0x0230('0xab')]('Answer');return this[_0x0230('0x36')][_0x0230('0xba')]();}return this[_0x0230('0x36')][_0x0230('0xab')]('Skipped\x20Answer');};AGIVertices[_0x0230('0x11')][_0x0230('0x1b5')]=function(_0x3d2458){logger[_0x0230('0x2c')](util['format'](_0x0230('0x1b6'),_0x3d2458[_0x0230('0x38')]));if(!this['isConfigured'](_0x3d2458['project_id'])){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x3d2458,'no\x20subproject\x20selected');}var _0x4eab0d=this[_0x0230('0x1b7')][_0x0230('0x6f')](this,_0x3d2458[_0x0230('0x1b8')]);if(!this[_0x0230('0x84')](_0x4eab0d)){return this[_0x0230('0x36')]['error'](_0x3d2458,util[_0x0230('0x51')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3d2458[_0x0230('0x1b8')]));}if(_0x4eab0d===this[_0x0230('0x36')]['arg_1']){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x3d2458,_0x0230('0x1b9'));}this[_0x0230('0x35')]['sync'](this,_0x3d2458,_0x4eab0d);var _0x2c4d1b=this[_0x0230('0x36')][_0x0230('0x55')](_0x0230('0x1ba'),util[_0x0230('0x51')](_0x0230('0x1bb'),config[_0x0230('0xb8')]['host']||_0x0230('0x1bc'),_0x4eab0d,this['channel'][_0x0230('0x3a')]));if(_0x2c4d1b[_0x0230('0xaa')]===-0x1){return _0x2c4d1b;}return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0xc4'),_0x0230('0x1ba'),_0x4eab0d));};AGIVertices[_0x0230('0x11')]['system']=function(_0x114eae){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x114eae['label']));var _0xa42f40=this[_0x0230('0x54')][_0x0230('0x6f')](this,_0x114eae['command']);this['createSquareDetailsReport']['sync'](this,_0x114eae,_0x114eae[_0x0230('0xb9')]);if(this[_0x0230('0x84')](_0x114eae['variable_id'])){var _0x1a3e46=this[_0x0230('0x12')][_0x0230('0x6f')](this,_0x114eae['variable_id']);if(_0x1a3e46){this['channel'][_0x0230('0xa1')](_0x1a3e46,_0xa42f40);return this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x1bd'),_0x114eae[_0x0230('0xb9')],_0x1a3e46));}}return this[_0x0230('0x36')]['noop'](util['format'](_0x0230('0x1be'),_0x114eae['command']));};AGIVertices[_0x0230('0x11')][_0x0230('0x1bf')]=function(_0xdbbea1){logger['info'](util[_0x0230('0x51')](_0x0230('0x1c0'),_0xdbbea1[_0x0230('0x38')]));_0xdbbea1['text']=_0xdbbea1[_0x0230('0x59')][_0x0230('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0230('0x84')](_0xdbbea1[_0x0230('0x58')])){return this[_0x0230('0x36')][_0x0230('0xab')](_0x0230('0x1c1'));}if(!this[_0x0230('0x84')](_0xdbbea1['text'])){return this[_0x0230('0x36')]['noop']('no\x20text\x20configured');}this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x1c2'),_0xdbbea1[_0x0230('0x59')]));var _0x41e98f=this[_0x0230('0x57')]['sync'](this,_0xdbbea1);if(_0x41e98f){this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x1c3'),_0x41e98f));var _0x561a0a=this['channel']['streamFile'](_0x41e98f);try{fs[_0x0230('0x10a')](_0x41e98f+'.wav');}catch(_0x540241){logger[_0x0230('0x2b')](_0x540241);}return _0x561a0a;}return this[_0x0230('0x36')]['error'](_0xdbbea1,_0x0230('0x1c4'));};AGIVertices['prototype'][_0x0230('0x1c5')]=function(_0x223a22){logger['info'](util[_0x0230('0x51')](_0x0230('0x1c6'),_0x223a22[_0x0230('0x38')]));_0x223a22['text']=_0x223a22[_0x0230('0x59')][_0x0230('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0230('0x84')](_0x223a22['text'])){return this[_0x0230('0x36')][_0x0230('0xab')]('no\x20text\x20configured');}this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('Trying\x20Google\x20TTS\x20%s',_0x223a22[_0x0230('0x59')]));var _0x241b85=this[_0x0230('0x5f')]['sync'](this,_0x223a22);if(_0x241b85){this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')]('Google\x20TTS\x20%s\x20file\x20created',_0x241b85));var _0x4251ac=this[_0x0230('0x36')][_0x0230('0x109')](_0x241b85);try{fs[_0x0230('0x10a')](_0x241b85+'.wav');}catch(_0x5d3ae9){logger[_0x0230('0x2b')](_0x5d3ae9);}return _0x4251ac;}return this['channel'][_0x0230('0x2b')](_0x223a22,_0x0230('0x1c7'));};AGIVertices['prototype']['unpause']=function(_0x52f621){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x1c8'),_0x52f621['label']));if(!this[_0x0230('0x84')](_0x52f621[_0x0230('0x15f')])){return this[_0x0230('0x36')]['error'](_0x52f621,_0x0230('0x160'));}logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x161'),this[_0x0230('0x36')]['callerid'],_0x52f621[_0x0230('0x15f')]));var _0x121bb5=this[_0x0230('0x4e')][_0x0230('0x6f')](this,_0x52f621[_0x0230('0x15f')]);if(_0x121bb5){logger[_0x0230('0x2c')](util[_0x0230('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0230('0x3b')],_0x52f621['findBy']));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x162'),this['channel']['callerid'],_0x52f621['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x164'),this['channel'][_0x0230('0x3b')],_0x52f621[_0x0230('0x15f')]));this[_0x0230('0x36')][_0x0230('0xab')](util[_0x0230('0x51')](_0x0230('0x164'),this[_0x0230('0x36')][_0x0230('0x3b')],_0x52f621[_0x0230('0x15f')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x0230('0x1c9')]=function(_0x444f7b){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x1ca'),_0x444f7b[_0x0230('0x38')]));var _0x381d39=this[_0x0230('0x36')]['exec'](_0x0230('0x1cb'),[_0x444f7b[_0x0230('0x1cc')],_0x444f7b[_0x0230('0x76')]]);if(_0x381d39[_0x0230('0xaa')]===-0x1){return _0x381d39;}return this[_0x0230('0x36')][_0x0230('0xab')](util['format'](_0x0230('0xc4'),_0x0230('0x1cb'),_0x444f7b[_0x0230('0x1cc')]));};AGIVertices[_0x0230('0x11')][_0x0230('0x1cd')]=function(_0x3c7b2c){logger[_0x0230('0x2c')](util[_0x0230('0x51')](_0x0230('0x1ce'),_0x3c7b2c[_0x0230('0x38')]));if(!this[_0x0230('0x84')](_0x3c7b2c[_0x0230('0xda')])){return this['channel'][_0x0230('0x2b')](_0x3c7b2c,_0x0230('0x1b1'));}var _0x21cd1a=this[_0x0230('0x12')][_0x0230('0x6f')](this,_0x3c7b2c[_0x0230('0xda')]);if(!_0x21cd1a){return this[_0x0230('0x36')][_0x0230('0x2b')](_0x3c7b2c,_0x0230('0xdb'));}var _0x545334=this[_0x0230('0x36')][_0x0230('0x12')](_0x21cd1a);return{'code':0xc8,'result':_0x545334[_0x0230('0xa6')]?_0x545334[_0x0230('0xa6')]:'-'};};String[_0x0230('0x11')][_0x0230('0xa4')]=function(_0x2670f3,_0x37eab7){return this[_0x0230('0xa3')](_0x2670f3)[_0x0230('0x1cf')](_0x37eab7);};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 5535b05..ff2f13a 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 _0x3e33=['[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','../ami','../../../config/logger','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','startAcw','channels','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3e33,0xb5));var _0x33e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e33[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var ami=require(_0x33e3('0x0'));var logger=require(_0x33e3('0x1'))('acw');var RpcUser=require(_0x33e3('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x553615){this[_0x33e3('0x3')]=_0x553615[_0x33e3('0x3')];this[_0x33e3('0x4')]=_0x553615[_0x33e3('0x4')];this[_0x33e3('0x5')]=_0x553615[_0x33e3('0x5')];this['channels']={};ami['on'](_0x33e3('0x6'),this[_0x33e3('0x7')][_0x33e3('0x8')](this));ami['on'](_0x33e3('0x9'),this[_0x33e3('0xa')]['bind'](this));ami['on'](_0x33e3('0xb'),this[_0x33e3('0xc')][_0x33e3('0x8')](this));ami['on'](_0x33e3('0xd'),this[_0x33e3('0xe')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x33e3('0x8')](this));ami['on']('blindtransfer',this[_0x33e3('0xf')]['bind'](this));ami['on'](_0x33e3('0x10'),this[_0x33e3('0x11')]['bind'](this));}function getDiff(_0x529626){var _0x194316=moment()[_0x33e3('0x12')](0x0);var _0x5b3ebd=moment(_0x529626)['milliseconds'](0x0);return _0x194316['diff'](_0x5b3ebd,'seconds');}Acw['prototype'][_0x33e3('0x13')]=function(_0x5a62e2){try{var _0x226cae=this;var _0x46698c=this[_0x33e3('0x14')][_0x5a62e2][_0x33e3('0x15')];var _0x14a984=this[_0x33e3('0x14')][_0x5a62e2][_0x33e3('0x16')];var _0x5eac88=this[_0x33e3('0x3')][_0x14a984];var _0x38e994=![];var _0x436f28='ACW';if(_0x5eac88[_0x33e3('0x17')]){if(_0x5eac88[_0x33e3('0x18')][_0x33e3('0x19')]){_0x38e994=!![];_0x436f28=_0x5eac88[_0x33e3('0x18')][_0x33e3('0x19')];}}ami[_0x33e3('0x1a')]({'action':_0x33e3('0x1b'),'interface':_0x46698c,'paused':!![],'reason':_0x436f28})[_0x33e3('0x1c')](function(_0xe1a576){if(_0x226cae[_0x33e3('0x4')][_0x46698c]){return RpcUser[_0x33e3('0x1d')](_0x226cae['agents'][_0x46698c]['id'])['then'](function(_0x25765d){if(_0x25765d&&!_0x25765d[_0x33e3('0x1e')]){logger[_0x33e3('0x1f')](_0x33e3('0x20'),_0x5a62e2,_0x46698c,_0x14a984);var _0x1aab63=_0x226cae[_0x33e3('0x14')][_0x5a62e2][_0x33e3('0x21')]&&_0x226cae[_0x33e3('0x14')][_0x5a62e2]['destlinkedid']?_0x226cae[_0x33e3('0x14')][_0x5a62e2][_0x33e3('0x22')]:_0x5a62e2;return RpcUser[_0x33e3('0x23')](_0x226cae['agents'][_0x46698c],_0x436f28,_0x1aab63)[_0x33e3('0x1c')](function(_0x12e20d){if(!_0x38e994){_0x226cae[_0x33e3('0x5')][_0x46698c]={};logger[_0x33e3('0x1f')](_0x33e3('0x24'),_0x5a62e2,_0x226cae[_0x33e3('0x3')][_0x14a984]['acwTimeout'],_0x46698c,_0x14a984);_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x25')]=setTimeout(_0x226cae[_0x33e3('0x26')][_0x33e3('0x8')](_0x226cae,_0x46698c),_0x226cae[_0x33e3('0x3')][_0x14a984][_0x33e3('0x27')]*0x3e8);_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x28')]=moment()[_0x33e3('0x29')](_0x33e3('0x2a'));_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x2b')]=_0x5a62e2;_0x226cae['timers'][_0x46698c][_0x33e3('0x16')]=_0x14a984;_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x2c')]=function(){var _0xd2be05=getDiff(_0x226cae[_0x33e3('0x5')][_0x46698c]['lastPauseAt']);clearTimeout(_0x226cae['timers'][_0x46698c]['timer']);_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x25')]=![];RpcVoiceAgentReport[_0x33e3('0x2d')]({'acwtime':_0xd2be05},_0x226cae[_0x33e3('0x5')][_0x46698c][_0x33e3('0x2b')],_0x46698c)[_0x33e3('0x1c')](function(_0x50fc26){logger['info'](_0x33e3('0x2e'),_0x5a62e2,_0xd2be05,_0x50fc26);})[_0x33e3('0x2f')](function(_0x22a212){logger['error'](_0x33e3('0x30'),_0x5a62e2,_0x22a212);});delete _0x226cae[_0x33e3('0x5')][_0x46698c];};}});}else{logger[_0x33e3('0x1f')](_0x33e3('0x31'),_0x5a62e2,_0x46698c,_0x14a984);}});}})['catch'](function(_0x4b85a4){logger['error'](_0x33e3('0x24'),_0x5a62e2,_0x226cae[_0x33e3('0x3')][_0x14a984][_0x33e3('0x27')],_0x46698c,_0x14a984);})['finally'](function(){delete _0x226cae[_0x33e3('0x14')][_0x5a62e2];});}catch(_0x19c0a3){logger[_0x33e3('0x32')](_0x33e3('0x33'),_0x19c0a3[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')]['stopAcw']=function(_0x46c6a7){try{var _0xaedd4a=this;if(_0xaedd4a['timers'][_0x46c6a7]){_0xaedd4a['timers'][_0x46c6a7][_0x33e3('0x25')]=![];var _0x4e8fab=_0xaedd4a[_0x33e3('0x5')][_0x46c6a7][_0x33e3('0x2b')];var _0xa962a4=_0xaedd4a[_0x33e3('0x5')][_0x46c6a7]['queue'];var _0x4008e7=_0xaedd4a[_0x33e3('0x3')][_0xa962a4][_0x33e3('0x27')];logger[_0x33e3('0x1f')](_0x33e3('0x36'),_0x4e8fab,_0x46c6a7);RpcUser[_0x33e3('0x37')](this['agents'][_0x46c6a7]);RpcVoiceAgentReport[_0x33e3('0x2d')]({'acwtime':_0x4008e7,'agentacw':!![]},_0x4e8fab,_0x46c6a7)['then'](function(_0x42636c){logger[_0x33e3('0x1f')](_0x33e3('0x2e'),_0x4e8fab,_0x4008e7,_0x42636c);})[_0x33e3('0x2f')](function(_0x3d6887){logger[_0x33e3('0x32')](_0x33e3('0x30'),_0x4e8fab,_0x3d6887);});}else{logger[_0x33e3('0x32')](_0x33e3('0x38'),_0x46c6a7);if(_0xaedd4a['timers']){logger[_0x33e3('0x1f')](_0x33e3('0x39'),JSON[_0x33e3('0x3a')](_0xaedd4a[_0x33e3('0x5')]));}}}catch(_0x14871f){logger[_0x33e3('0x32')](_0x33e3('0x3b'),_0x14871f[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')]['syncAgentConnect']=function(_0xbd38ed){try{if(this[_0x33e3('0x3')][_0xbd38ed[_0x33e3('0x16')]]&&(this[_0x33e3('0x3')][_0xbd38ed[_0x33e3('0x16')]]['acw']||this['voiceQueues'][_0xbd38ed[_0x33e3('0x16')]][_0x33e3('0x17')])){if(this[_0x33e3('0x4')][_0xbd38ed[_0x33e3('0x15')]]){this['channels'][_0xbd38ed[_0x33e3('0x2b')]]={'queue':_0xbd38ed[_0x33e3('0x16')],'interface':_0xbd38ed['interface'],'destlinkedid':_0xbd38ed['destlinkedid']};}}}catch(_0x5210a3){logger[_0x33e3('0x32')](_0x33e3('0x3c'),_0x5210a3[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')][_0x33e3('0x11')]=function(_0x11ecea){try{if(this[_0x33e3('0x3')][_0x11ecea[_0x33e3('0x16')]]&&(this['voiceQueues'][_0x11ecea['queue']]['acw']||this[_0x33e3('0x3')][_0x11ecea[_0x33e3('0x16')]][_0x33e3('0x17')])){if(this[_0x33e3('0x4')][_0x11ecea[_0x33e3('0x15')]]){this[_0x33e3('0x14')][_0x11ecea[_0x33e3('0x2b')]]={'queue':_0x11ecea[_0x33e3('0x16')],'interface':_0x11ecea[_0x33e3('0x15')]};}}}catch(_0x4bed45){logger[_0x33e3('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4bed45['message']);}};Acw[_0x33e3('0x35')]['syncHangupRequest']=function(_0x444834){try{if(this[_0x33e3('0x14')][_0x444834[_0x33e3('0x2b')]]&&_[_0x33e3('0x3d')](this[_0x33e3('0x14')][_0x444834[_0x33e3('0x2b')]]['attended'])){logger[_0x33e3('0x1f')](_0x33e3('0x3e'),_0x444834[_0x33e3('0x2b')]);this[_0x33e3('0x13')](_0x444834[_0x33e3('0x2b')]);}else if(this['channels'][_0x444834['linkedid']]&&_['isUndefined'](this['channels'][_0x444834['linkedid']][_0x33e3('0x21')])){logger[_0x33e3('0x1f')](_0x33e3('0x3f'),_0x444834['linkedid']);this['startAcw'](_0x444834[_0x33e3('0x40')]);}}catch(_0x4d55ed){logger[_0x33e3('0x32')](_0x33e3('0x41'),_0x4d55ed[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')][_0x33e3('0xc')]=function(_0x2e01d0){try{if(this[_0x33e3('0x14')][_0x2e01d0[_0x33e3('0x2b')]]&&this[_0x33e3('0x14')][_0x2e01d0[_0x33e3('0x2b')]][_0x33e3('0x21')]){logger['info'](_0x33e3('0x42'),_0x2e01d0[_0x33e3('0x2b')]);this[_0x33e3('0x13')](_0x2e01d0['uniqueid']);}else if(this[_0x33e3('0x14')][_0x2e01d0['linkedid']]&&this['channels'][_0x2e01d0[_0x33e3('0x40')]][_0x33e3('0x21')]){logger[_0x33e3('0x1f')](_0x33e3('0x43'),_0x2e01d0[_0x33e3('0x40')]);this[_0x33e3('0x13')](_0x2e01d0[_0x33e3('0x40')]);}}catch(_0x149d52){logger[_0x33e3('0x32')]('[ACW][syncHangup]\x20%s',_0x149d52[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')]['syncAttendedTransfer']=function(_0xd727b1){try{if(!_[_0x33e3('0x44')](this[_0x33e3('0x14')][_0xd727b1['transfereeuniqueid']])){this[_0x33e3('0x13')](_0xd727b1[_0x33e3('0x45')]);if(this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x46')]]){this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x46')]]['attended']=!![];this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x47')]]=this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x46')]];delete this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x46')]];}}else if(!_[_0x33e3('0x44')](this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x47')]])){this[_0x33e3('0x13')](_0xd727b1[_0x33e3('0x47')]);if(this['channels'][_0xd727b1['origtransfereruniqueid']]){this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x48')]]['attended']=!![];this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x45')]]=this['channels'][_0xd727b1['origtransfereruniqueid']];delete this[_0x33e3('0x14')][_0xd727b1[_0x33e3('0x48')]];}}}catch(_0x2693af){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x2693af[_0x33e3('0x34')]);}};Acw[_0x33e3('0x35')][_0x33e3('0xf')]=function(_0x4d2407){try{if(this[_0x33e3('0x14')][_0x4d2407[_0x33e3('0x49')]]){logger[_0x33e3('0x1f')](_0x33e3('0x4a'),JSON[_0x33e3('0x3a')](_0x4d2407[_0x33e3('0x49')]));this[_0x33e3('0x13')](_0x4d2407[_0x33e3('0x49')]);}else if(this[_0x33e3('0x14')][_0x4d2407[_0x33e3('0x4b')]]){logger[_0x33e3('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x33e3('0x3a')](_0x4d2407[_0x33e3('0x4b')]));this[_0x33e3('0x13')](_0x4d2407[_0x33e3('0x4b')]);}}catch(_0x228a49){logger[_0x33e3('0x32')](_0x33e3('0x4c'),_0x228a49['message']);}};Acw[_0x33e3('0x35')]['syncAgentRingNoAnswer']=function(_0xf7c7d7){try{if(this['voiceQueues'][_0xf7c7d7['queue']]&&this[_0x33e3('0x3')][_0xf7c7d7['queue']][_0x33e3('0x4d')]===_0x33e3('0x4e')){if(this[_0x33e3('0x4')][_0xf7c7d7[_0x33e3('0x15')]]){logger[_0x33e3('0x1f')](_0x33e3('0x4f'),_0xf7c7d7['uniqueid'],_0xf7c7d7[_0x33e3('0x15')],_0xf7c7d7[_0x33e3('0x16')]);return RpcUser[_0x33e3('0x23')](this[_0x33e3('0x4')][_0xf7c7d7['interface']],_0x33e3('0x50'),_0xf7c7d7[_0x33e3('0x2b')]);}}}catch(_0x361d66){logger[_0x33e3('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x361d66[_0x33e3('0x34')]);}};module['exports']=Acw; \ No newline at end of file +var _0x43f1=['acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','exports','util','moment','../ami'];(function(_0x275af7,_0x12731c){var _0x1d653f=function(_0x49fe35){while(--_0x49fe35){_0x275af7['push'](_0x275af7['shift']());}};_0x1d653f(++_0x12731c);}(_0x43f1,0x192));var _0x143f=function(_0x51a6d6,_0x3c9c49){_0x51a6d6=_0x51a6d6-0x0;var _0x5ef1a8=_0x43f1[_0x51a6d6];return _0x5ef1a8;};'use strict';var util=require(_0x143f('0x0'));var _=require('lodash');var moment=require(_0x143f('0x1'));var ami=require(_0x143f('0x2'));var logger=require('../../../config/logger')(_0x143f('0x3'));var RpcUser=require(_0x143f('0x4'));var RpcVoiceAgentReport=require(_0x143f('0x5'));function Acw(_0x3163c6){this[_0x143f('0x6')]=_0x3163c6[_0x143f('0x6')];this[_0x143f('0x7')]=_0x3163c6[_0x143f('0x7')];this[_0x143f('0x8')]=_0x3163c6[_0x143f('0x8')];this[_0x143f('0x9')]={};ami['on'](_0x143f('0xa'),this[_0x143f('0xb')][_0x143f('0xc')](this));ami['on'](_0x143f('0xd'),this[_0x143f('0xe')]['bind'](this));ami['on'](_0x143f('0xf'),this[_0x143f('0x10')][_0x143f('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x143f('0xc')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x143f('0x11'),this[_0x143f('0x12')][_0x143f('0xc')](this));ami['on'](_0x143f('0x13'),this['syncAgentConnectPreview'][_0x143f('0xc')](this));}function getDiff(_0x6cd84){var _0x222af4=moment()[_0x143f('0x14')](0x0);var _0x217639=moment(_0x6cd84)[_0x143f('0x14')](0x0);return _0x222af4['diff'](_0x217639,_0x143f('0x15'));}Acw[_0x143f('0x16')][_0x143f('0x17')]=function(_0x57de23){try{var _0x2db2d4=this;var _0x8fc991=this[_0x143f('0x9')][_0x57de23][_0x143f('0x18')];var _0x1598c4=this[_0x143f('0x9')][_0x57de23][_0x143f('0x19')];var _0x146504=this[_0x143f('0x6')][_0x1598c4];var _0x1f8de9=![];var _0xccdad2=_0x143f('0x1a');if(_0x146504[_0x143f('0x1b')]){if(_0x146504[_0x143f('0x1c')][_0x143f('0x1d')]){_0x1f8de9=!![];_0xccdad2=_0x146504[_0x143f('0x1c')][_0x143f('0x1d')];}}ami[_0x143f('0x1e')]({'action':_0x143f('0x1f'),'interface':_0x8fc991,'paused':!![],'reason':_0xccdad2})[_0x143f('0x20')](function(_0x2c670c){if(_0x2db2d4[_0x143f('0x7')][_0x8fc991]){return RpcUser[_0x143f('0x21')](_0x2db2d4[_0x143f('0x7')][_0x8fc991]['id'])['then'](function(_0x3947e5){if(_0x3947e5&&!_0x3947e5[_0x143f('0x22')]){logger[_0x143f('0x23')](_0x143f('0x24'),_0x57de23,_0x8fc991,_0x1598c4);var _0xad2f8d=_0x2db2d4[_0x143f('0x9')][_0x57de23][_0x143f('0x25')]&&_0x2db2d4[_0x143f('0x9')][_0x57de23]['destlinkedid']?_0x2db2d4[_0x143f('0x9')][_0x57de23][_0x143f('0x26')]:_0x57de23;return RpcUser[_0x143f('0x27')](_0x2db2d4[_0x143f('0x7')][_0x8fc991],_0xccdad2,_0xad2f8d)['then'](function(_0xc32f1c){if(!_0x1f8de9){_0x2db2d4[_0x143f('0x8')][_0x8fc991]={};logger[_0x143f('0x23')](_0x143f('0x28'),_0x57de23,_0x2db2d4[_0x143f('0x6')][_0x1598c4][_0x143f('0x29')],_0x8fc991,_0x1598c4);_0x2db2d4[_0x143f('0x8')][_0x8fc991][_0x143f('0x2a')]=setTimeout(_0x2db2d4[_0x143f('0x2b')]['bind'](_0x2db2d4,_0x8fc991),_0x2db2d4[_0x143f('0x6')][_0x1598c4][_0x143f('0x29')]*0x3e8);_0x2db2d4[_0x143f('0x8')][_0x8fc991][_0x143f('0x2c')]=moment()[_0x143f('0x2d')](_0x143f('0x2e'));_0x2db2d4[_0x143f('0x8')][_0x8fc991][_0x143f('0x2f')]=_0x57de23;_0x2db2d4[_0x143f('0x8')][_0x8fc991][_0x143f('0x19')]=_0x1598c4;_0x2db2d4[_0x143f('0x8')][_0x8fc991]['updateAcw']=function(){var _0x1f3c1=getDiff(_0x2db2d4[_0x143f('0x8')][_0x8fc991][_0x143f('0x2c')]);clearTimeout(_0x2db2d4[_0x143f('0x8')][_0x8fc991]['timer']);_0x2db2d4['timers'][_0x8fc991][_0x143f('0x2a')]=![];RpcVoiceAgentReport[_0x143f('0x30')]({'acwtime':_0x1f3c1},_0x2db2d4[_0x143f('0x8')][_0x8fc991]['uniqueid'],_0x8fc991)[_0x143f('0x20')](function(_0x3c2bc1){logger[_0x143f('0x23')](_0x143f('0x31'),_0x57de23,_0x1f3c1,_0x3c2bc1);})['catch'](function(_0x3625f3){logger[_0x143f('0x32')](_0x143f('0x33'),_0x57de23,_0x3625f3);});delete _0x2db2d4[_0x143f('0x8')][_0x8fc991];};}});}else{logger[_0x143f('0x23')](_0x143f('0x34'),_0x57de23,_0x8fc991,_0x1598c4);}});}})[_0x143f('0x35')](function(_0x269361){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x57de23,_0x2db2d4[_0x143f('0x6')][_0x1598c4][_0x143f('0x29')],_0x8fc991,_0x1598c4);})[_0x143f('0x36')](function(){delete _0x2db2d4['channels'][_0x57de23];});}catch(_0x2de17b){logger[_0x143f('0x32')](_0x143f('0x37'),_0x2de17b[_0x143f('0x38')]);}};Acw[_0x143f('0x16')][_0x143f('0x2b')]=function(_0x203a12){try{var _0x3f4555=this;if(_0x3f4555['timers'][_0x203a12]){_0x3f4555[_0x143f('0x8')][_0x203a12][_0x143f('0x2a')]=![];var _0x59f196=_0x3f4555[_0x143f('0x8')][_0x203a12]['uniqueid'];var _0xaffa50=_0x3f4555[_0x143f('0x8')][_0x203a12]['queue'];var _0x320496=_0x3f4555[_0x143f('0x6')][_0xaffa50][_0x143f('0x29')];logger[_0x143f('0x23')](_0x143f('0x39'),_0x59f196,_0x203a12);RpcUser['saveUnpause'](this[_0x143f('0x7')][_0x203a12]);RpcVoiceAgentReport[_0x143f('0x30')]({'acwtime':_0x320496,'agentacw':!![]},_0x59f196,_0x203a12)[_0x143f('0x20')](function(_0x33435e){logger[_0x143f('0x23')](_0x143f('0x31'),_0x59f196,_0x320496,_0x33435e);})[_0x143f('0x35')](function(_0x2989f0){logger['error'](_0x143f('0x33'),_0x59f196,_0x2989f0);});}else{logger[_0x143f('0x32')](_0x143f('0x3a'),_0x203a12);if(_0x3f4555[_0x143f('0x8')]){logger[_0x143f('0x23')]('[ACW][TIMERS]',JSON[_0x143f('0x3b')](_0x3f4555[_0x143f('0x8')]));}}}catch(_0x22f3cf){logger[_0x143f('0x32')](_0x143f('0x3c'),_0x22f3cf[_0x143f('0x38')]);}};Acw[_0x143f('0x16')][_0x143f('0xb')]=function(_0x12337b){try{if(this[_0x143f('0x6')][_0x12337b[_0x143f('0x19')]]&&(this['voiceQueues'][_0x12337b[_0x143f('0x19')]][_0x143f('0x3')]||this['voiceQueues'][_0x12337b[_0x143f('0x19')]][_0x143f('0x1b')])){if(this[_0x143f('0x7')][_0x12337b['interface']]){this[_0x143f('0x9')][_0x12337b[_0x143f('0x2f')]]={'queue':_0x12337b[_0x143f('0x19')],'interface':_0x12337b[_0x143f('0x18')],'destlinkedid':_0x12337b[_0x143f('0x26')]};}}}catch(_0x31f147){logger[_0x143f('0x32')](_0x143f('0x3d'),_0x31f147['message']);}};Acw[_0x143f('0x16')][_0x143f('0x3e')]=function(_0x472865){try{if(this[_0x143f('0x6')][_0x472865['queue']]&&(this[_0x143f('0x6')][_0x472865['queue']][_0x143f('0x3')]||this[_0x143f('0x6')][_0x472865['queue']]['mandatoryDisposition'])){if(this[_0x143f('0x7')][_0x472865['interface']]){this[_0x143f('0x9')][_0x472865[_0x143f('0x2f')]]={'queue':_0x472865[_0x143f('0x19')],'interface':_0x472865[_0x143f('0x18')]};}}}catch(_0x1cb5f2){logger[_0x143f('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1cb5f2[_0x143f('0x38')]);}};Acw[_0x143f('0x16')][_0x143f('0xe')]=function(_0x380414){try{if(this[_0x143f('0x9')][_0x380414['uniqueid']]&&_[_0x143f('0x3f')](this['channels'][_0x380414[_0x143f('0x2f')]]['attended'])){logger[_0x143f('0x23')]('[%s][HANGUP:UNIQUEID]',_0x380414[_0x143f('0x2f')]);this[_0x143f('0x17')](_0x380414[_0x143f('0x2f')]);}else if(this['channels'][_0x380414[_0x143f('0x40')]]&&_[_0x143f('0x3f')](this['channels'][_0x380414[_0x143f('0x40')]][_0x143f('0x25')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x380414[_0x143f('0x40')]);this[_0x143f('0x17')](_0x380414[_0x143f('0x40')]);}}catch(_0x147d14){logger['error'](_0x143f('0x41'),_0x147d14[_0x143f('0x38')]);}};Acw[_0x143f('0x16')][_0x143f('0x10')]=function(_0x323416){try{if(this['channels'][_0x323416[_0x143f('0x2f')]]&&this[_0x143f('0x9')][_0x323416[_0x143f('0x2f')]][_0x143f('0x25')]){logger['info'](_0x143f('0x42'),_0x323416[_0x143f('0x2f')]);this[_0x143f('0x17')](_0x323416[_0x143f('0x2f')]);}else if(this[_0x143f('0x9')][_0x323416[_0x143f('0x40')]]&&this['channels'][_0x323416['linkedid']][_0x143f('0x25')]){logger['info'](_0x143f('0x43'),_0x323416['linkedid']);this[_0x143f('0x17')](_0x323416[_0x143f('0x40')]);}}catch(_0x52d5d3){logger[_0x143f('0x32')](_0x143f('0x44'),_0x52d5d3['message']);}};Acw[_0x143f('0x16')]['syncAttendedTransfer']=function(_0x597d48){try{if(!_['isNil'](this[_0x143f('0x9')][_0x597d48['transfereeuniqueid']])){this['startAcw'](_0x597d48[_0x143f('0x45')]);if(this[_0x143f('0x9')][_0x597d48[_0x143f('0x46')]]){this[_0x143f('0x9')][_0x597d48['secondtransfereruniqueid']][_0x143f('0x25')]=!![];this['channels'][_0x597d48[_0x143f('0x47')]]=this[_0x143f('0x9')][_0x597d48[_0x143f('0x46')]];delete this[_0x143f('0x9')][_0x597d48[_0x143f('0x46')]];}}else if(!_[_0x143f('0x48')](this['channels'][_0x597d48['transfertargetuniqueid']])){this['startAcw'](_0x597d48[_0x143f('0x47')]);if(this['channels'][_0x597d48['origtransfereruniqueid']]){this[_0x143f('0x9')][_0x597d48[_0x143f('0x49')]][_0x143f('0x25')]=!![];this['channels'][_0x597d48['transfereeuniqueid']]=this[_0x143f('0x9')][_0x597d48['origtransfereruniqueid']];delete this['channels'][_0x597d48[_0x143f('0x49')]];}}}catch(_0x35e2ca){logger[_0x143f('0x32')]('[ACW][syncAttendedTransfer]\x20%s',_0x35e2ca[_0x143f('0x38')]);}};Acw['prototype'][_0x143f('0x12')]=function(_0x1cd771){try{if(this[_0x143f('0x9')][_0x1cd771[_0x143f('0x4a')]]){logger[_0x143f('0x23')](_0x143f('0x4b'),JSON[_0x143f('0x3b')](_0x1cd771[_0x143f('0x4a')]));this['startAcw'](_0x1cd771[_0x143f('0x4a')]);}else if(this['channels'][_0x1cd771[_0x143f('0x4c')]]){logger[_0x143f('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x143f('0x3b')](_0x1cd771[_0x143f('0x4c')]));this['startAcw'](_0x1cd771[_0x143f('0x4c')]);}}catch(_0x5e1b26){logger[_0x143f('0x32')](_0x143f('0x4d'),_0x5e1b26[_0x143f('0x38')]);}};Acw[_0x143f('0x16')]['syncAgentRingNoAnswer']=function(_0x277163){try{if(this[_0x143f('0x6')][_0x277163[_0x143f('0x19')]]&&this['voiceQueues'][_0x277163['queue']][_0x143f('0x4e')]==='all'){if(this[_0x143f('0x7')][_0x277163[_0x143f('0x18')]]){logger[_0x143f('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x277163[_0x143f('0x2f')],_0x277163['interface'],_0x277163[_0x143f('0x19')]);return RpcUser[_0x143f('0x27')](this['agents'][_0x277163['interface']],_0x143f('0x4f'),_0x277163['uniqueid']);}}}catch(_0x47e300){logger[_0x143f('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x47e300[_0x143f('0x38')]);}};module[_0x143f('0x50')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 855a4e1..0f5a54d 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 _0x757a=['devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','close','exports','bluebird','moment','ami','../../config/environment','asterisk','port','password','Action','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','inspect','actionSipShowRegistry','actionDeviceStateList'];(function(_0x2a5475,_0x2378cc){var _0x145650=function(_0xe57e0c){while(--_0xe57e0c){_0x2a5475['push'](_0x2a5475['shift']());}};_0x145650(++_0x2378cc);}(_0x757a,0xde));var _0xa757=function(_0x263f8e,_0x396a8a){_0x263f8e=_0x263f8e-0x0;var _0x123ba8=_0x757a[_0x263f8e];return _0x123ba8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var util=require('util');var _=require('lodash');var logger=require('../../config/logger')(_0xa757('0x2'));var config=require(_0xa757('0x3'));var ami=new Manager(config[_0xa757('0x4')][_0xa757('0x5')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')]['username'],config[_0xa757('0x4')][_0xa757('0x6')],!![]);ami['keepConnected']();ami[_0xa757('0x7')]=BPromise[_0xa757('0x8')](ami[_0xa757('0x9')]);function error(_0x1a95ee){logger[_0xa757('0xa')](util['format'](_0xa757('0xb'),config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x1a95ee,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk']['username'],config[_0xa757('0x4')]['ip'],config['asterisk']['port']));}ami[_0xa757('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0xa757('0xf')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x10')});};};ami[_0xa757('0x11')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x12')});};};ami[_0xa757('0x13')]=function(){return function(){return ami[_0xa757('0x7')]({'action':_0xa757('0x14')});};};ami[_0xa757('0x15')]=function(){return function(){return ami['Action']({'action':_0xa757('0x16')});};};function connect(_0x44eab8){logger[_0xa757('0x17')](util['format']('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));ami[_0xa757('0x18')]('error',error);ami[_0xa757('0x18')]('close',close);}ami['on'](_0xa757('0x19'),connect);ami['on'](_0xa757('0x1a'),function(_0x14014c){logger[_0xa757('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xa757('0x4')][_0xa757('0xc')],config[_0xa757('0x4')]['ip'],config[_0xa757('0x4')][_0xa757('0x5')],util[_0xa757('0xd')](_0x14014c,![],null)));});ami['on'](_0xa757('0x1b'),function(_0x21f1af){logger[_0xa757('0x17')](util['format'](_0xa757('0x1c'),config['asterisk'][_0xa757('0xc')],config['asterisk']['ip'],config[_0xa757('0x4')][_0xa757('0x5')]));return BPromise[_0xa757('0x1d')]()['then'](ami[_0xa757('0xe')]())[_0xa757('0x1e')](ami[_0xa757('0xf')]())[_0xa757('0x1e')](ami['actionSipPeerStatus']())[_0xa757('0x1e')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())['catch'](function(_0xfdf69d){logger['error'](_0xa757('0x1f'),util[_0xa757('0xd')](_0xfdf69d,{'showHidden':![],'depth':null}));});});ami['once'](_0xa757('0xa'),error);ami['once'](_0xa757('0x20'),close);module[_0xa757('0x21')]=ami; \ No newline at end of file +var _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x1bc50b,_0x423d8b){var _0x411b50=function(_0x2074b0){while(--_0x2074b0){_0x1bc50b['push'](_0x1bc50b['shift']());}};_0x411b50(++_0x423d8b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index b9091fe..a6351cd 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 _0xf4eb=['rpc','error','message','result','exports','jayson/promise','http','request','then','debug','memberReport'];(function(_0x58ab89,_0xf01b2d){var _0xb93c04=function(_0x29e1b2){while(--_0x29e1b2){_0x58ab89['push'](_0x58ab89['shift']());}};_0xb93c04(++_0xf01b2d);}(_0xf4eb,0xec));var _0xbf4e=function(_0xf0c0c9,_0x382560){_0xf0c0c9=_0xf0c0c9-0x0;var _0x57558c=_0xf4eb[_0xf0c0c9];return _0x57558c;};'use strict';var jayson=require(_0xbf4e('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('ami');var client=jayson['client'][_0xbf4e('0x1')]({'port':0x2329});client['Request']=function(_0x4e7fa7,_0x2e3070){return new BPromise(function(_0x1c7606,_0x32d1d7){return client[_0xbf4e('0x2')](_0x4e7fa7,_0x2e3070)[_0xbf4e('0x3')](function(_0x2fcfed){logger[_0xbf4e('0x4')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x2e3070,_0x2fcfed);if(_0x2fcfed['error']){logger['error'](_0xbf4e('0x6'),_0xbf4e('0x5'),_0x4e7fa7,_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')],_0x2e3070);return _0x32d1d7(_0x2fcfed[_0xbf4e('0x7')][_0xbf4e('0x8')]);}else{return _0x1c7606(_0x2fcfed[_0xbf4e('0x9')]);}})['catch'](function(_0x4d9a07){logger[_0xbf4e('0x7')]('rpc',_0xbf4e('0x5'),_0x4e7fa7,_0x4d9a07,_0x2e3070);return _0x32d1d7(_0x4d9a07);});});};module[_0xbf4e('0xa')]=client; \ No newline at end of file +var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0xac4a,0x13f));var _0xaac4=function(_0x15d571,_0x547743){_0x15d571=_0x15d571-0x0;var _0x2a749e=_0xac4a[_0x15d571];return _0x2a749e;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index cfa6324..412a837 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 _0x3674=['isNil','string','uniqueid','name','phone','firstName','Contact','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','getQueue','exports','util','moment'];(function(_0x2f5156,_0x50ef5e){var _0x1855e2=function(_0xb017d6){while(--_0xb017d6){_0x2f5156['push'](_0x2f5156['shift']());}};_0x1855e2(++_0x50ef5e);}(_0x3674,0x10c));var _0x4367=function(_0x433fa5,_0x884980){_0x433fa5=_0x433fa5-0x0;var _0x36b69b=_0x3674[_0x433fa5];return _0x36b69b;};'use strict';var util=require(_0x4367('0x0'));var _=require('lodash');var moment=require(_0x4367('0x1'));function checkNameSurname(_0x1b5fe1,_0x2f2eae,_0x199e3c){var _0x353a21='';if(!_[_0x4367('0x2')](_0x2f2eae)&&_0x4367('0x3')===typeof _0x2f2eae){_0x353a21+=_0x2f2eae;}if(!_[_0x4367('0x2')](_0x199e3c)&&_0x4367('0x3')===typeof _0x199e3c){_0x353a21+='\x20'+_0x199e3c;}if(_0x353a21!==''){return _0x353a21;}return _0x1b5fe1;}function Action(_0x2036ee,_0x2c09e5,_0x148eb7){this['voiceQueue']=_0x2036ee;this[_0x4367('0x4')]=_0x148eb7||undefined;this[_0x4367('0x5')]=checkNameSurname(_0x2c09e5['Contact'][_0x4367('0x6')],_0x2c09e5['Contact'][_0x4367('0x7')],_0x2c09e5[_0x4367('0x8')]['lastName']);this[_0x4367('0x9')]=_0x2c09e5['Contact']['phone'];this[_0x4367('0xa')]=_0x2036ee[_0x4367('0x5')];this[_0x4367('0xb')]=_0x2c09e5['active']||![];this[_0x4367('0xc')]=_0x2036ee[_0x4367('0xc')];this[_0x4367('0xd')]=_0x2036ee[_0x4367('0xd')]||0x3;this[_0x4367('0xe')]=_0x2c09e5['scheduledat'];this['countbusyretry']=_0x2c09e5[_0x4367('0xf')];this[_0x4367('0x10')]=_0x2c09e5[_0x4367('0x10')];this[_0x4367('0x11')]=_0x2c09e5[_0x4367('0x11')];this['countnosuchnumberretry']=_0x2c09e5[_0x4367('0x12')];this[_0x4367('0x13')]=_0x2c09e5[_0x4367('0x13')];this[_0x4367('0x14')]=_0x2c09e5[_0x4367('0x14')];this['countmachineretry']=_0x2c09e5[_0x4367('0x15')];this['countagentrejectretry']=_0x2c09e5[_0x4367('0x16')];this[_0x4367('0x17')]=_0x2c09e5['ContactId'];this['ListId']=_0x2c09e5['ListId'];this[_0x4367('0x18')]=_0x2c09e5[_0x4367('0x18')];this[_0x4367('0x19')]=_0x2c09e5['VoiceQueueId'];this[_0x4367('0x1a')]=_0x2c09e5[_0x4367('0x1a')];this[_0x4367('0x1b')]=_0x2c09e5['id'];this[_0x4367('0x1c')]=_0x2c09e5[_0x4367('0x8')][_0x4367('0x7')]||'';this['starttime']=moment()[_0x4367('0x1d')](_0x4367('0x1e'));this['callback']=_0x2c09e5[_0x4367('0x1f')];this[_0x4367('0x20')]=_0x2c09e5['callbackuniqueid'];this[_0x4367('0x21')]=_0x2c09e5[_0x4367('0x21')];this[_0x4367('0x22')]=_0x2c09e5[_0x4367('0x22')];this[_0x4367('0x23')]='';this[_0x4367('0x24')]='';}Action['prototype'][_0x4367('0x25')]=function(){return util[_0x4367('0x1d')](_0x4367('0x26'),this[_0x4367('0x5')],this[_0x4367('0x27')][_0x4367('0x28')]>0x0?this[_0x4367('0x9')][_0x4367('0x29')](this[_0x4367('0x27')]['dialCutDigit']):this[_0x4367('0x9')]);};Action[_0x4367('0x2a')][_0x4367('0x2b')]=function(){return this['queue'];};module[_0x4367('0x2c')]=Action; \ No newline at end of file +var _0x0a02=['recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','voiceQueue','dialCutDigit','substring','getQueue','queue','exports','lodash','moment','isNil','string','uniqueid','name','Contact','phone','lastName','number','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat'];(function(_0x45cfac,_0x5f0169){var _0x184382=function(_0x1610bc){while(--_0x1610bc){_0x45cfac['push'](_0x45cfac['shift']());}};_0x184382(++_0x5f0169);}(_0x0a02,0x185));var _0x20a0=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x0a02[_0x2f54b6];return _0x169f21;};'use strict';var util=require('util');var _=require(_0x20a0('0x0'));var moment=require(_0x20a0('0x1'));function checkNameSurname(_0x4f71be,_0x135fad,_0x50e913){var _0xbe7fe9='';if(!_[_0x20a0('0x2')](_0x135fad)&&_0x20a0('0x3')===typeof _0x135fad){_0xbe7fe9+=_0x135fad;}if(!_[_0x20a0('0x2')](_0x50e913)&&'string'===typeof _0x50e913){_0xbe7fe9+='\x20'+_0x50e913;}if(_0xbe7fe9!==''){return _0xbe7fe9;}return _0x4f71be;}function Action(_0x2cd3bc,_0x2628c0,_0x2439a2){this['voiceQueue']=_0x2cd3bc;this[_0x20a0('0x4')]=_0x2439a2||undefined;this[_0x20a0('0x5')]=checkNameSurname(_0x2628c0[_0x20a0('0x6')][_0x20a0('0x7')],_0x2628c0['Contact']['firstName'],_0x2628c0[_0x20a0('0x6')][_0x20a0('0x8')]);this[_0x20a0('0x9')]=_0x2628c0['Contact'][_0x20a0('0x7')];this['queue']=_0x2cd3bc['name'];this['active']=_0x2628c0['active']||![];this['type']=_0x2cd3bc['type'];this[_0x20a0('0xa')]=_0x2cd3bc['dialQueueTimeout']||0x3;this['scheduledat']=_0x2628c0['scheduledat'];this[_0x20a0('0xb')]=_0x2628c0[_0x20a0('0xb')];this[_0x20a0('0xc')]=_0x2628c0[_0x20a0('0xc')];this['countnoanswerretry']=_0x2628c0[_0x20a0('0xd')];this[_0x20a0('0xe')]=_0x2628c0[_0x20a0('0xe')];this[_0x20a0('0xf')]=_0x2628c0[_0x20a0('0xf')];this[_0x20a0('0x10')]=_0x2628c0[_0x20a0('0x10')];this[_0x20a0('0x11')]=_0x2628c0[_0x20a0('0x11')];this[_0x20a0('0x12')]=_0x2628c0[_0x20a0('0x12')];this[_0x20a0('0x13')]=_0x2628c0[_0x20a0('0x13')];this[_0x20a0('0x14')]=_0x2628c0[_0x20a0('0x14')];this[_0x20a0('0x15')]=_0x2628c0[_0x20a0('0x15')];this['VoiceQueueId']=_0x2628c0[_0x20a0('0x16')];this[_0x20a0('0x17')]=_0x2628c0[_0x20a0('0x17')];this['idHopper']=_0x2628c0['id'];this[_0x20a0('0x18')]=_0x2628c0['Contact']['firstName']||'';this[_0x20a0('0x19')]=moment()[_0x20a0('0x1a')](_0x20a0('0x1b'));this[_0x20a0('0x1c')]=_0x2628c0[_0x20a0('0x1c')];this[_0x20a0('0x1d')]=_0x2628c0[_0x20a0('0x1d')];this[_0x20a0('0x1e')]=_0x2628c0['callbackat'];this[_0x20a0('0x1f')]=_0x2628c0[_0x20a0('0x1f')];this[_0x20a0('0x20')]='';this[_0x20a0('0x21')]='';}Action[_0x20a0('0x22')][_0x20a0('0x23')]=function(){return util[_0x20a0('0x1a')]('\x22%s\x22\x20<%s>',this['name'],this[_0x20a0('0x24')][_0x20a0('0x25')]>0x0?this['number'][_0x20a0('0x26')](this[_0x20a0('0x24')][_0x20a0('0x25')]):this[_0x20a0('0x9')]);};Action['prototype'][_0x20a0('0x27')]=function(){return this[_0x20a0('0x28')];};module[_0x20a0('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 4e43042..014c2dc 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 _0x8c75=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x577f71,_0x3a8951){var _0xfec7c2=function(_0x440797){while(--_0x440797){_0x577f71['push'](_0x577f71['shift']());}};_0xfec7c2(++_0x3a8951);}(_0x8c75,0xbe));var _0x58c7=function(_0x25ebff,_0x11aec5){_0x25ebff=_0x25ebff-0x0;var _0x898e46=_0x8c75[_0x25ebff];return _0x898e46;};'use strict';var util=require(_0x58c7('0x0'));var _=require(_0x58c7('0x1'));var moment=require(_0x58c7('0x2'));function getSeconds(_0x32993f,_0x65d43f){var _0x124827=moment(_0x32993f)[_0x58c7('0x3')](0x0);var _0x3cf3=moment(_0x65d43f)[_0x58c7('0x3')](0x0);return _0x124827['diff'](_0x3cf3,_0x58c7('0x4'));}function AgentComplete(_0x30ba6c,_0x497d8d){this[_0x58c7('0x5')]=0x4;this[_0x58c7('0x6')]='Answer';this[_0x58c7('0x7')]=_0x30ba6c[_0x58c7('0x7')];this[_0x58c7('0x8')]=_0x30ba6c['type'];this[_0x58c7('0x9')]=_0x30ba6c['type']===_0x58c7('0xa')?_0x58c7('0xb'):_0x30ba6c['type'];this[_0x58c7('0xc')]=_0x30ba6c[_0x58c7('0xc')];this[_0x58c7('0xd')]=_0x30ba6c[_0x58c7('0xd')];this[_0x58c7('0xe')]=_0x30ba6c[_0x58c7('0xe')];this[_0x58c7('0xf')]=_0x30ba6c[_0x58c7('0xc')]+_0x30ba6c['countcongestionretry']+_0x30ba6c[_0x58c7('0xe')]+_0x30ba6c[_0x58c7('0x10')]+_0x30ba6c[_0x58c7('0x11')]+_0x30ba6c[_0x58c7('0x12')]+_0x30ba6c['countmachineretry']+_0x30ba6c[_0x58c7('0x13')];this[_0x58c7('0x10')]=_0x30ba6c['countnosuchnumberretry'];this['countdropretry']=_0x30ba6c[_0x58c7('0x11')];this[_0x58c7('0x12')]=_0x30ba6c['countabandonedretry'];this[_0x58c7('0x14')]=_0x30ba6c[_0x58c7('0x14')];this['countagentrejectretry']=_0x30ba6c[_0x58c7('0x13')];this[_0x58c7('0x15')]=_0x497d8d[_0x58c7('0x15')];this[_0x58c7('0x16')]=_0x30ba6c[_0x58c7('0x17')];this['calleridnum']=_0x30ba6c[_0x58c7('0x18')];this[_0x58c7('0x19')]=_0x30ba6c[_0x58c7('0x19')];this[_0x58c7('0x1a')]=_0x30ba6c[_0x58c7('0x1a')];this['answertime']=_0x30ba6c[_0x58c7('0x1b')];this[_0x58c7('0x1c')]=moment()['format'](_0x58c7('0x1d'));this[_0x58c7('0x1e')]=getSeconds(_0x30ba6c[_0x58c7('0x1a')],_0x30ba6c[_0x58c7('0x19')]);this[_0x58c7('0x1f')]=getSeconds(_0x30ba6c[_0x58c7('0x1b')],_0x30ba6c[_0x58c7('0x1a')]);this[_0x58c7('0x20')]=getSeconds(this[_0x58c7('0x1c')],_0x30ba6c[_0x58c7('0x1b')]);this['queue']=_0x497d8d[_0x58c7('0xb')];this['membername']=_0x497d8d[_0x58c7('0x21')];this[_0x58c7('0x22')]=_0x497d8d['reason'];this[_0x58c7('0x23')]=_0x30ba6c['callback'];this[_0x58c7('0x24')]=_0x30ba6c[_0x58c7('0x24')];this[_0x58c7('0x25')]=_0x30ba6c[_0x58c7('0x25')];this[_0x58c7('0x26')]=_0x30ba6c['recallme'];this[_0x58c7('0x27')]=_0x30ba6c['ContactId'];this[_0x58c7('0x28')]=_0x30ba6c[_0x58c7('0x28')];this[_0x58c7('0x29')]=_0x30ba6c[_0x58c7('0x29')];this[_0x58c7('0x2a')]=_0x30ba6c[_0x58c7('0x2a')];this[_0x58c7('0x2b')]=_0x30ba6c['CampaignId'];this['originatecalleridnum']=_0x30ba6c[_0x58c7('0x2c')]||'';this[_0x58c7('0x2d')]=_0x30ba6c['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0xe299=['countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x20c6fc,_0x3b8b9b){var _0x4e4bdb=function(_0x2c625e){while(--_0x2c625e){_0x20c6fc['push'](_0x20c6fc['shift']());}};_0x4e4bdb(++_0x3b8b9b);}(_0xe299,0x1cf));var _0x9e29=function(_0x140a5e,_0x559701){_0x140a5e=_0x140a5e-0x0;var _0x335e64=_0xe299[_0x140a5e];return _0x335e64;};'use strict';var util=require(_0x9e29('0x0'));var _=require(_0x9e29('0x1'));var moment=require(_0x9e29('0x2'));function getSeconds(_0x1ebc94,_0x15c02d){var _0x34e680=moment(_0x1ebc94)['milliseconds'](0x0);var _0x274649=moment(_0x15c02d)[_0x9e29('0x3')](0x0);return _0x34e680[_0x9e29('0x4')](_0x274649,_0x9e29('0x5'));}function AgentComplete(_0x43af7c,_0x52e33c){this[_0x9e29('0x6')]=0x4;this[_0x9e29('0x7')]=_0x9e29('0x8');this[_0x9e29('0x9')]=_0x43af7c[_0x9e29('0x9')];this[_0x9e29('0xa')]=_0x43af7c['type'];this[_0x9e29('0xb')]=_0x43af7c['type']===_0x9e29('0xc')?_0x9e29('0xd'):_0x43af7c[_0x9e29('0xa')];this['countbusyretry']=_0x43af7c[_0x9e29('0xe')];this[_0x9e29('0xf')]=_0x43af7c[_0x9e29('0xf')];this[_0x9e29('0x10')]=_0x43af7c[_0x9e29('0x10')];this[_0x9e29('0x11')]=_0x43af7c[_0x9e29('0xe')]+_0x43af7c['countcongestionretry']+_0x43af7c[_0x9e29('0x10')]+_0x43af7c['countnosuchnumberretry']+_0x43af7c[_0x9e29('0x12')]+_0x43af7c[_0x9e29('0x13')]+_0x43af7c[_0x9e29('0x14')]+_0x43af7c[_0x9e29('0x15')];this[_0x9e29('0x16')]=_0x43af7c[_0x9e29('0x16')];this[_0x9e29('0x12')]=_0x43af7c[_0x9e29('0x12')];this[_0x9e29('0x13')]=_0x43af7c[_0x9e29('0x13')];this[_0x9e29('0x14')]=_0x43af7c[_0x9e29('0x14')];this[_0x9e29('0x15')]=_0x43af7c[_0x9e29('0x15')];this[_0x9e29('0x17')]=_0x52e33c['uniqueid'];this[_0x9e29('0x18')]=_0x43af7c[_0x9e29('0x19')];this[_0x9e29('0x1a')]=_0x43af7c['number'];this[_0x9e29('0x1b')]=_0x43af7c[_0x9e29('0x1b')];this[_0x9e29('0x1c')]=_0x43af7c[_0x9e29('0x1c')];this[_0x9e29('0x1d')]=_0x43af7c['answertime'];this[_0x9e29('0x1e')]=moment()['format'](_0x9e29('0x1f'));this[_0x9e29('0x20')]=getSeconds(_0x43af7c[_0x9e29('0x1c')],_0x43af7c[_0x9e29('0x1b')]);this[_0x9e29('0x21')]=getSeconds(_0x43af7c[_0x9e29('0x1d')],_0x43af7c[_0x9e29('0x1c')]);this[_0x9e29('0x22')]=getSeconds(this[_0x9e29('0x1e')],_0x43af7c['answertime']);this[_0x9e29('0xd')]=_0x52e33c[_0x9e29('0xd')];this[_0x9e29('0x23')]=_0x52e33c[_0x9e29('0x23')];this['reason']=_0x52e33c[_0x9e29('0x24')];this[_0x9e29('0x25')]=_0x43af7c[_0x9e29('0x25')];this[_0x9e29('0x26')]=_0x43af7c[_0x9e29('0x26')];this[_0x9e29('0x27')]=_0x43af7c['callbackat'];this[_0x9e29('0x28')]=_0x43af7c[_0x9e29('0x28')];this[_0x9e29('0x29')]=_0x43af7c['ContactId'];this[_0x9e29('0x2a')]=_0x43af7c[_0x9e29('0x2a')];this[_0x9e29('0x2b')]=_0x43af7c[_0x9e29('0x2b')];this[_0x9e29('0x2c')]=_0x43af7c[_0x9e29('0x2c')];this[_0x9e29('0x2d')]=_0x43af7c[_0x9e29('0x2d')];this[_0x9e29('0x2e')]=_0x43af7c[_0x9e29('0x2e')]||'';this[_0x9e29('0x2f')]=_0x43af7c[_0x9e29('0x2f')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index e557c5f..bea6cff 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(_0x317497,_0x2d6cf7){var _0x3445b0=function(_0x22fe4d){while(--_0x22fe4d){_0x317497['push'](_0x317497['shift']());}};_0x3445b0(++_0x2d6cf7);}(_0x50a6,0xa4));var _0x650a=function(_0x399b24,_0x2d6c6a){_0x399b24=_0x399b24-0x0;var _0x5971c7=_0x50a6[_0x399b24];return _0x5971c7;};'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 _0xcd59=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xcd59,0x14b));var _0x9cd5=function(_0x3142b1,_0x3cf732){_0x3142b1=_0x3142b1-0x0;var _0x35c702=_0xcd59[_0x3142b1];return _0x35c702;};'use strict';var util=require(_0x9cd5('0x0'));var _=require(_0x9cd5('0x1'));var moment=require(_0x9cd5('0x2'));function getSeconds(_0x27ce9f,_0x271070){var _0x302b21=moment(_0x27ce9f)['milliseconds'](0x0);var _0x2d392c=moment(_0x271070)[_0x9cd5('0x3')](0x0);return _0x302b21[_0x9cd5('0x4')](_0x2d392c,_0x9cd5('0x5'));}function Final(_0x6acbef){this[_0x9cd5('0x6')]=_0x6acbef[_0x9cd5('0x6')];this[_0x9cd5('0x7')]=_0x6acbef[_0x9cd5('0x7')];this[_0x9cd5('0x8')]=_0x6acbef['type'];this[_0x9cd5('0x9')]=_0x6acbef[_0x9cd5('0x8')]===_0x9cd5('0xa')?_0x9cd5('0xb'):_0x6acbef[_0x9cd5('0x8')];this[_0x9cd5('0xc')]=_0x6acbef[_0x9cd5('0xc')];this[_0x9cd5('0xd')]=_0x6acbef['countcongestionretry'];this[_0x9cd5('0xe')]=_0x6acbef[_0x9cd5('0xe')];this[_0x9cd5('0xf')]=_0x6acbef[_0x9cd5('0xc')]+_0x6acbef['countcongestionretry']+_0x6acbef['countnoanswerretry']+_0x6acbef[_0x9cd5('0x10')]+_0x6acbef[_0x9cd5('0x11')]+_0x6acbef[_0x9cd5('0x12')]+_0x6acbef[_0x9cd5('0x13')]+_0x6acbef[_0x9cd5('0x14')];this[_0x9cd5('0x10')]=_0x6acbef['countnosuchnumberretry'];this[_0x9cd5('0x11')]=_0x6acbef[_0x9cd5('0x11')];this[_0x9cd5('0x12')]=_0x6acbef['countabandonedretry'];this['countmachineretry']=_0x6acbef['countmachineretry'];this[_0x9cd5('0x14')]=_0x6acbef[_0x9cd5('0x14')];this['queue']=_0x6acbef[_0x9cd5('0xb')];this[_0x9cd5('0x15')]=_0x6acbef[_0x9cd5('0x15')];this['calleridnum']=_0x6acbef[_0x9cd5('0x16')];this[_0x9cd5('0x17')]=_0x6acbef[_0x9cd5('0x17')];this[_0x9cd5('0x18')]=_0x6acbef[_0x9cd5('0x18')];this[_0x9cd5('0x19')]=_0x6acbef['responsetime'];this[_0x9cd5('0x1a')]=_0x6acbef[_0x9cd5('0x1a')]||0x0;this[_0x9cd5('0x1b')]=_0x6acbef[_0x9cd5('0x1b')]||0x0;this[_0x9cd5('0x1c')]=_0x6acbef['talktime']||0x0;this[_0x9cd5('0x1d')]=_0x6acbef[_0x9cd5('0x1d')];this[_0x9cd5('0x1e')]=_0x6acbef[_0x9cd5('0x1e')];this[_0x9cd5('0x1f')]=_0x6acbef[_0x9cd5('0x1f')];this[_0x9cd5('0x20')]=_0x6acbef[_0x9cd5('0x20')];this[_0x9cd5('0x21')]=_0x6acbef['ContactId'];this[_0x9cd5('0x22')]=_0x6acbef[_0x9cd5('0x22')];this[_0x9cd5('0x23')]=_0x6acbef[_0x9cd5('0x23')];this['VoiceQueueId']=_0x6acbef[_0x9cd5('0x24')];this[_0x9cd5('0x25')]=_0x6acbef[_0x9cd5('0x25')];this[_0x9cd5('0x26')]=_0x6acbef[_0x9cd5('0x26')]||'';this[_0x9cd5('0x27')]=_0x6acbef[_0x9cd5('0x27')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 8febc19..2e10ce3 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 _0x5d04=['YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','name','number','starttime','format'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x5d04,0x6f));var _0x45d0=function(_0x1f2be7,_0x55f91b){_0x1f2be7=_0x1f2be7-0x0;var _0x221ec6=_0x5d04[_0x1f2be7];return _0x221ec6;};'use strict';var util=require(_0x45d0('0x0'));var _=require(_0x45d0('0x1'));var moment=require(_0x45d0('0x2'));function getSeconds(_0x326617,_0x1a36bc){var _0x32a8db=moment(_0x326617)[_0x45d0('0x3')](0x0);var _0x5d8b79=moment(_0x1a36bc)[_0x45d0('0x3')](0x0);return _0x32a8db[_0x45d0('0x4')](_0x5d8b79,'seconds');}function Hangup(_0x539260,_0x22f645){this[_0x45d0('0x5')]=0x4;this[_0x45d0('0x6')]=_0x45d0('0x7');this[_0x45d0('0x8')]=_0x539260[_0x45d0('0x8')];this[_0x45d0('0x9')]=_0x539260['type'];this[_0x45d0('0xa')]=_0x539260[_0x45d0('0x9')]===_0x45d0('0xb')?_0x45d0('0xc'):_0x539260[_0x45d0('0x9')];this[_0x45d0('0xd')]=_0x539260['countbusyretry'];this['countcongestionretry']=_0x539260[_0x45d0('0xe')];this[_0x45d0('0xf')]=_0x539260[_0x45d0('0xf')];this[_0x45d0('0x10')]=_0x539260[_0x45d0('0xd')]+_0x539260['countcongestionretry']+_0x539260[_0x45d0('0xf')]+_0x539260[_0x45d0('0x11')]+_0x539260['countdropretry']+_0x539260[_0x45d0('0x12')]+_0x539260['countmachineretry']+_0x539260[_0x45d0('0x13')];this[_0x45d0('0x11')]=_0x539260[_0x45d0('0x11')];this[_0x45d0('0x14')]=_0x539260[_0x45d0('0x14')];this[_0x45d0('0x12')]=_0x539260[_0x45d0('0x12')];this[_0x45d0('0x15')]=_0x539260[_0x45d0('0x15')];this[_0x45d0('0x13')]=_0x539260[_0x45d0('0x13')];this['uniqueid']=_0x22f645['uniqueid'];this[_0x45d0('0x16')]=_0x539260[_0x45d0('0x17')];this['calleridnum']=_0x539260[_0x45d0('0x18')];this[_0x45d0('0x19')]=_0x539260[_0x45d0('0x19')];this['responsetime']=_0x539260['responsetime'];this['endtime']=moment()[_0x45d0('0x1a')](_0x45d0('0x1b'));this[_0x45d0('0x1c')]=getSeconds(_0x539260[_0x45d0('0x1d')],_0x539260[_0x45d0('0x19')]);this[_0x45d0('0x1e')]=0x0;this['talktime']=getSeconds(this[_0x45d0('0x1f')],_0x539260['responsetime']);this[_0x45d0('0xc')]=_0x539260['queue'];this[_0x45d0('0x20')]=_0x45d0('0x21');this[_0x45d0('0x22')]=_0x22f645[_0x45d0('0x23')];this[_0x45d0('0x24')]=_0x539260['callback'];this[_0x45d0('0x25')]=_0x539260[_0x45d0('0x25')];this[_0x45d0('0x26')]=_0x539260[_0x45d0('0x26')];this[_0x45d0('0x27')]=_0x539260[_0x45d0('0x27')];this['ContactId']=_0x539260[_0x45d0('0x28')];this['ListId']=_0x539260[_0x45d0('0x29')];this[_0x45d0('0x2a')]=_0x539260[_0x45d0('0x2a')];this[_0x45d0('0x2b')]=_0x539260[_0x45d0('0x2b')];this[_0x45d0('0x2c')]=_0x539260[_0x45d0('0x2c')];}module[_0x45d0('0x2d')]=Hangup; \ No newline at end of file +var _0xed78=['milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment'];(function(_0x226e5b,_0x4935ed){var _0x3c44d3=function(_0x4b3077){while(--_0x4b3077){_0x226e5b['push'](_0x226e5b['shift']());}};_0x3c44d3(++_0x4935ed);}(_0xed78,0x13f));var _0x8ed7=function(_0x42b8e1,_0x1d3d12){_0x42b8e1=_0x42b8e1-0x0;var _0x3efbc8=_0xed78[_0x42b8e1];return _0x3efbc8;};'use strict';var util=require(_0x8ed7('0x0'));var _=require(_0x8ed7('0x1'));var moment=require(_0x8ed7('0x2'));function getSeconds(_0x2edb66,_0x92d160){var _0x26aad8=moment(_0x2edb66)[_0x8ed7('0x3')](0x0);var _0x446ab1=moment(_0x92d160)[_0x8ed7('0x3')](0x0);return _0x26aad8[_0x8ed7('0x4')](_0x446ab1,_0x8ed7('0x5'));}function Hangup(_0x4a7484,_0xb22d7b){this[_0x8ed7('0x6')]=0x4;this[_0x8ed7('0x7')]=_0x8ed7('0x8');this[_0x8ed7('0x9')]=_0x4a7484[_0x8ed7('0x9')];this[_0x8ed7('0xa')]=_0x4a7484[_0x8ed7('0xa')];this[_0x8ed7('0xb')]=_0x4a7484[_0x8ed7('0xa')]===_0x8ed7('0xc')?_0x8ed7('0xd'):_0x4a7484[_0x8ed7('0xa')];this[_0x8ed7('0xe')]=_0x4a7484[_0x8ed7('0xe')];this['countcongestionretry']=_0x4a7484['countcongestionretry'];this[_0x8ed7('0xf')]=_0x4a7484[_0x8ed7('0xf')];this['countglobal']=_0x4a7484[_0x8ed7('0xe')]+_0x4a7484['countcongestionretry']+_0x4a7484[_0x8ed7('0xf')]+_0x4a7484[_0x8ed7('0x10')]+_0x4a7484['countdropretry']+_0x4a7484['countabandonedretry']+_0x4a7484['countmachineretry']+_0x4a7484['countagentrejectretry'];this['countnosuchnumberretry']=_0x4a7484['countnosuchnumberretry'];this['countdropretry']=_0x4a7484[_0x8ed7('0x11')];this[_0x8ed7('0x12')]=_0x4a7484[_0x8ed7('0x12')];this[_0x8ed7('0x13')]=_0x4a7484['countmachineretry'];this[_0x8ed7('0x14')]=_0x4a7484[_0x8ed7('0x14')];this[_0x8ed7('0x15')]=_0xb22d7b[_0x8ed7('0x15')];this[_0x8ed7('0x16')]=_0x4a7484[_0x8ed7('0x17')];this[_0x8ed7('0x18')]=_0x4a7484[_0x8ed7('0x19')];this[_0x8ed7('0x1a')]=_0x4a7484[_0x8ed7('0x1a')];this[_0x8ed7('0x1b')]=_0x4a7484['responsetime'];this[_0x8ed7('0x1c')]=moment()['format'](_0x8ed7('0x1d'));this[_0x8ed7('0x1e')]=getSeconds(_0x4a7484[_0x8ed7('0x1b')],_0x4a7484['starttime']);this[_0x8ed7('0x1f')]=0x0;this[_0x8ed7('0x20')]=getSeconds(this[_0x8ed7('0x1c')],_0x4a7484[_0x8ed7('0x1b')]);this['queue']=_0x4a7484[_0x8ed7('0xd')];this[_0x8ed7('0x21')]=_0x8ed7('0x22');this[_0x8ed7('0x23')]=_0xb22d7b['cause-txt'];this[_0x8ed7('0x24')]=_0x4a7484['callback'];this[_0x8ed7('0x25')]=_0x4a7484[_0x8ed7('0x25')];this[_0x8ed7('0x26')]=_0x4a7484[_0x8ed7('0x26')];this['recallme']=_0x4a7484[_0x8ed7('0x27')];this[_0x8ed7('0x28')]=_0x4a7484[_0x8ed7('0x28')];this[_0x8ed7('0x29')]=_0x4a7484['ListId'];this['UserId']=_0x4a7484[_0x8ed7('0x2a')];this['VoiceQueueId']=_0x4a7484[_0x8ed7('0x2b')];this['CampaignId']=_0x4a7484[_0x8ed7('0x2c')];}module[_0x8ed7('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index fe57944..5d3a2a0 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 _0xc53a=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc53a,0x106));var _0xac53=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc53a[_0x4b369d];return _0x571a98;};'use strict';var util=require(_0xac53('0x0'));var _=require(_0xac53('0x1'));var moment=require('moment');function getSeconds(_0x35d099,_0x4d2a2e){var _0x341fa6=moment(_0x35d099)['milliseconds'](0x0);var _0x2109fb=moment(_0x4d2a2e)[_0xac53('0x2')](0x0);return _0x341fa6[_0xac53('0x3')](_0x2109fb,'seconds');}function History(_0x1b006e){this['uniqueid']=_0x1b006e['uniqueid'];this[_0xac53('0x4')]=_0x1b006e[_0xac53('0x4')]||undefined;this[_0xac53('0x5')]=_0x1b006e[_0xac53('0x5')];this['campaigntype']=_0x1b006e[_0xac53('0x5')]===_0xac53('0x6')?_0xac53('0x7'):_0x1b006e[_0xac53('0x5')];this['countbusyretry']=_0x1b006e[_0xac53('0x8')];this[_0xac53('0x9')]=_0x1b006e[_0xac53('0x9')];this['countnoanswerretry']=_0x1b006e[_0xac53('0xa')];this['countglobal']=_0x1b006e[_0xac53('0x8')]+_0x1b006e['countcongestionretry']+_0x1b006e[_0xac53('0xa')]+_0x1b006e['countnosuchnumberretry']+_0x1b006e[_0xac53('0xb')]+_0x1b006e[_0xac53('0xc')]+_0x1b006e[_0xac53('0xd')]+_0x1b006e[_0xac53('0xe')];this[_0xac53('0xf')]=_0x1b006e[_0xac53('0xf')];this[_0xac53('0xb')]=_0x1b006e[_0xac53('0xb')];this['countabandonedretry']=_0x1b006e[_0xac53('0xc')];this[_0xac53('0xd')]=_0x1b006e[_0xac53('0xd')];this[_0xac53('0xe')]=_0x1b006e[_0xac53('0xe')];this[_0xac53('0x7')]=_0x1b006e['queue'];this['calleridname']=_0x1b006e[_0xac53('0x10')];this[_0xac53('0x11')]=_0x1b006e[_0xac53('0x12')];this['starttime']=_0x1b006e[_0xac53('0x13')];this[_0xac53('0x14')]=_0x1b006e['responsetime'];this[_0xac53('0x15')]=_0x1b006e['responsetime'];this[_0xac53('0x16')]=getSeconds(_0x1b006e[_0xac53('0x14')],_0x1b006e[_0xac53('0x13')]);this[_0xac53('0x17')]=0x0;this['talktime']=0x0;this[_0xac53('0x18')]=_0x1b006e[_0xac53('0x18')];this[_0xac53('0x19')]=_0x1b006e['callbackuniqueid'];this['callbackat']=_0x1b006e[_0xac53('0x1a')];this[_0xac53('0x1b')]=_0x1b006e['recallme'];this['ContactId']=_0x1b006e[_0xac53('0x1c')];this[_0xac53('0x1d')]=_0x1b006e[_0xac53('0x1d')];this[_0xac53('0x1e')]=_0x1b006e[_0xac53('0x1e')];this[_0xac53('0x1f')]=_0x1b006e['VoiceQueueId'];this[_0xac53('0x20')]=_0x1b006e[_0xac53('0x20')];this[_0xac53('0x21')]=_0x1b006e[_0xac53('0x21')]||'';this[_0xac53('0x22')]=_0x1b006e[_0xac53('0x22')]||'';}module[_0xac53('0x23')]=History; \ No newline at end of file +var _0x556e=['calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue','calleridname','name'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x556e,0x65));var _0xe556=function(_0xfbb69e,_0x1c65dd){_0xfbb69e=_0xfbb69e-0x0;var _0x31666f=_0x556e[_0xfbb69e];return _0x31666f;};'use strict';var util=require(_0xe556('0x0'));var _=require(_0xe556('0x1'));var moment=require(_0xe556('0x2'));function getSeconds(_0x36290f,_0x3e827c){var _0x28768d=moment(_0x36290f)['milliseconds'](0x0);var _0x4e1905=moment(_0x3e827c)['milliseconds'](0x0);return _0x28768d[_0xe556('0x3')](_0x4e1905,_0xe556('0x4'));}function History(_0x12b3a7){this[_0xe556('0x5')]=_0x12b3a7[_0xe556('0x5')];this[_0xe556('0x6')]=_0x12b3a7['scheduledat']||undefined;this[_0xe556('0x7')]=_0x12b3a7['type'];this[_0xe556('0x8')]=_0x12b3a7[_0xe556('0x7')]===_0xe556('0x9')?'queue':_0x12b3a7[_0xe556('0x7')];this[_0xe556('0xa')]=_0x12b3a7[_0xe556('0xa')];this[_0xe556('0xb')]=_0x12b3a7[_0xe556('0xb')];this[_0xe556('0xc')]=_0x12b3a7['countnoanswerretry'];this[_0xe556('0xd')]=_0x12b3a7['countbusyretry']+_0x12b3a7[_0xe556('0xb')]+_0x12b3a7[_0xe556('0xc')]+_0x12b3a7['countnosuchnumberretry']+_0x12b3a7[_0xe556('0xe')]+_0x12b3a7[_0xe556('0xf')]+_0x12b3a7['countmachineretry']+_0x12b3a7[_0xe556('0x10')];this[_0xe556('0x11')]=_0x12b3a7[_0xe556('0x11')];this[_0xe556('0xe')]=_0x12b3a7['countdropretry'];this[_0xe556('0xf')]=_0x12b3a7[_0xe556('0xf')];this[_0xe556('0x12')]=_0x12b3a7['countmachineretry'];this[_0xe556('0x10')]=_0x12b3a7[_0xe556('0x10')];this['queue']=_0x12b3a7[_0xe556('0x13')];this[_0xe556('0x14')]=_0x12b3a7[_0xe556('0x15')];this[_0xe556('0x16')]=_0x12b3a7[_0xe556('0x17')];this['starttime']=_0x12b3a7[_0xe556('0x18')];this[_0xe556('0x19')]=_0x12b3a7[_0xe556('0x19')];this[_0xe556('0x1a')]=_0x12b3a7[_0xe556('0x19')];this[_0xe556('0x1b')]=getSeconds(_0x12b3a7['responsetime'],_0x12b3a7[_0xe556('0x18')]);this[_0xe556('0x1c')]=0x0;this[_0xe556('0x1d')]=0x0;this[_0xe556('0x1e')]=_0x12b3a7['callback'];this[_0xe556('0x1f')]=_0x12b3a7[_0xe556('0x1f')];this[_0xe556('0x20')]=_0x12b3a7[_0xe556('0x20')];this[_0xe556('0x21')]=_0x12b3a7[_0xe556('0x21')];this['ContactId']=_0x12b3a7['ContactId'];this[_0xe556('0x22')]=_0x12b3a7[_0xe556('0x22')];this[_0xe556('0x23')]=_0x12b3a7['UserId'];this[_0xe556('0x24')]=_0x12b3a7[_0xe556('0x24')];this[_0xe556('0x25')]=_0x12b3a7['CampaignId'];this[_0xe556('0x26')]=_0x12b3a7['originatecalleridnum']||'';this[_0xe556('0x27')]=_0x12b3a7['originatecalleridname']||'';}module[_0xe556('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5b67a1d..1dc01c5 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 _0x64d5=['CampaignId','[syncHangupInAMDIvr]','countdropretry','countagentrejectretry','reason19\x20machine....','add','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','Unknow','syncAgentComplete','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','endtime','starttime','calleridname','calleridnum','Abandoned','CALLEREXIT','countglobal','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actions','actionid','locked','stateinterface','queueBooked','push','idHopper','paused','queueStatusComplete','[booked][unlockQueueStatus]','run','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','stringify','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','command','iftime\x20%s,%s','interval','content','true','indexOf','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','booked','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','handleIvr','dialMethod','dialActive','dialGlobalInterval','dialPreviewRecallmeReminder','dialTimezone','launchHandleIvr','\x5cw{0,','pow','replace','random','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','createdAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','custom:agentnosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','available','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','busyFactor','erlangCallToSecond','[handlePredictive]','fail\x20to\x20scheduled\x20calls','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','dialOrderByScheduledAt','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Error','m\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','Umin\x20=\x20','exports','lodash','bluebird','uuid','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/setting','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startProgressive','ivrOriginated','queueBookedRR','queuecallerabandon','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','hangup','syncHangup','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','pTalking','sumHoldTime','talking','total','unmanaged','loggedInDb','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','md5','format','voice_queue:save','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','predictiveIntervalDroppedCallsTimeout','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','Avg\x20Hold\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','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','clearZombieChannels','isNil','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[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','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','status','unmonitored','uniqueId','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency'];(function(_0x5bbae2,_0x49532e){var _0x2a9fd0=function(_0x1b82d5){while(--_0x1b82d5){_0x5bbae2['push'](_0x5bbae2['shift']());}};_0x2a9fd0(++_0x49532e);}(_0x64d5,0x129));var _0x564d=function(_0x356c02,_0x35a71e){_0x356c02=_0x356c02-0x0;var _0x467995=_0x64d5[_0x356c02];return _0x467995;};'use strict';var util=require('util');var _=require(_0x564d('0x0'));var BPromise=require(_0x564d('0x1'));var uuid=require(_0x564d('0x2'));var moment=require(_0x564d('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x564d('0x4'));var config=require(_0x564d('0x5'));var logger=require(_0x564d('0x6'))(_0x564d('0x7'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x564d('0x6'))(_0x564d('0x8'));var loggerPredictiveCalls=require(_0x564d('0x6'))(_0x564d('0x9'));var loggerSyncQueueSummary=require(_0x564d('0x6'))(_0x564d('0xa'));var ami=require(_0x564d('0xb'));config['redis']=_[_0x564d('0xc')](config['redis'],{'host':_0x564d('0xd'),'port':0x18eb});var io=require(_0x564d('0xe'))(new Redis(config['redis']));var cmHopper=require(_0x564d('0xf'));var cmHopperHistory=require(_0x564d('0x10'));var cmHopperBlack=require(_0x564d('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x564d('0x12'));var Action=require('./action');var History=require('./history');var Final=require(_0x564d('0x13'));var AgentComplete=require(_0x564d('0x14'));var QueueCallerAbandon=require(_0x564d('0x15'));var Hangup=require(_0x564d('0x16'));var ipAgi=process[_0x564d('0x17')][_0x564d('0x18')]||_0x564d('0x19');var strategy={'rrmemory':_0x564d('0x1a'),'roundrobin':_0x564d('0x1b')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x564d('0x1c')][_0x564d('0x1d')]=function(_0x5d8842){this['tail']=this[_0x564d('0x1e')]?this[_0x564d('0x1e')][_0x564d('0x1f')](_0x5d8842):_0x5d8842();};function Dialer(_0x3f83ef,_0x241cf0){this[_0x564d('0x20')]=new Sequence();this['preview']=_0x241cf0;this['voiceQueues']=_0x3f83ef[_0x564d('0x21')];this[_0x564d('0x22')]=_0x3f83ef[_0x564d('0x22')];this['agents']=_0x3f83ef[_0x564d('0x23')];this[_0x564d('0x24')]=_0x3f83ef[_0x564d('0x24')];this[_0x564d('0x25')]=config[_0x564d('0x25')]||0x2;this[_0x564d('0x26')]={};this['actions']={};this[_0x564d('0x27')]={};this['uniqueId']={};this[_0x564d('0x28')]={};this['startPredictive']={};this[_0x564d('0x29')]={};this[_0x564d('0x2a')]={};this['queueBooked']={};this[_0x564d('0x2b')]={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x564d('0x2c'),this[_0x564d('0x2d')][_0x564d('0x2e')](this));ami['on'](_0x564d('0x2f'),this[_0x564d('0x30')][_0x564d('0x2e')](this));ami['on'](_0x564d('0x31'),this['syncAgentComplete'][_0x564d('0x2e')](this));ami['on']('custom:queuesummary',this[_0x564d('0xa')]['bind'](this));ami['on'](_0x564d('0x32'),this[_0x564d('0x33')][_0x564d('0x2e')](this));ami['on']('newexten',this[_0x564d('0x34')][_0x564d('0x2e')](this));ami['on'](_0x564d('0x35'),this[_0x564d('0x36')][_0x564d('0x2e')](this));ami['on'](_0x564d('0x37'),this[_0x564d('0x38')][_0x564d('0x2e')](this));ami['on'](_0x564d('0x39'),this[_0x564d('0x3a')]['bind'](this));this[_0x564d('0x3b')]();this[_0x564d('0x3c')]();RpcSetting['getSettings']()[_0x564d('0x3d')](function(_0x101da4){previewRecallmeReminderInterval=_0x101da4[_0x564d('0x3e')];});}function isNotNull(_0x2e1b3e){return _0x2e1b3e!==null&&!_[_0x564d('0x3f')](_0x2e1b3e);}function checkIsLoggedIn(_0x32bfe0,_0x229a78){return function(){if(_0x229a78<=0x0){_0x32bfe0['message']='AGENTS_NOT_LOGGED';throw _0x32bfe0['name']+_0x564d('0x40');}};}function isActive(_0x588922){return _0x588922;}function checkIsActive(_0x757d14,_0x5896bd){return function(){if(!isActive(_0x5896bd)){_0x757d14[_0x564d('0x41')]=_0x564d('0x42');throw _0x757d14[_0x564d('0x43')]+_0x564d('0x44');}};}function checkInterval(_0x45f95f){return function(){if(!isNotNull(_0x45f95f[_0x564d('0x45')])){_0x45f95f[_0x564d('0x41')]=_0x564d('0x46');throw _0x45f95f[_0x564d('0x43')]+_0x564d('0x47');}if(!isNotNull(_0x45f95f[_0x564d('0x45')]['Intervals'])){_0x45f95f[_0x564d('0x41')]=_0x564d('0x46');throw _0x45f95f['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x564d('0x48')](_0x45f95f[_0x564d('0x45')][_0x564d('0x49')]))){_0x45f95f[_0x564d('0x41')]='INTERVAL_IS_NULL';throw _0x45f95f[_0x564d('0x43')]+_0x564d('0x47');}};}function msgResponse(_0x4b6cae,_0x38cee7,_0x4a9907){return{'action':_0x4b6cae,'response':_0x38cee7,'message':_0x4a9907,'stack':_0x4a9907};}function myreject(_0x4310ad){return function(_0x31132c){return _0x4310ad(msgResponse(_0x564d('0x4a'),'Error',JSON['stringify'](_0x31132c)));};}function getSeconds(_0x34b798,_0x8767cf){var _0x149ac6=moment(_0x34b798)[_0x564d('0x4b')](0x0);var _0x286c11=moment(_0x8767cf)[_0x564d('0x4b')](0x0);return _0x149ac6[_0x564d('0x4c')](_0x286c11,_0x564d('0x4d'));}function emit(_0x3a1ffe,_0x48cf8d,_0x471347){io['to'](_0x3a1ffe)[_0x564d('0x4e')](_0x48cf8d,_0x471347);}function emitVoiceQueueSummary(_0x11af9a){if(_0x11af9a[_0x564d('0x4f')]===_0x564d('0x50')){var _0x1b79a9={'id':_0x11af9a['id'],'name':_0x11af9a['name'],'strategy':_0x11af9a[_0x564d('0x51')],'answered':_0x11af9a[_0x564d('0x52')],'available':_0x11af9a['available'],'loggedIn':_0x11af9a[_0x564d('0x53')],'pTalking':_0x11af9a[_0x564d('0x54')],'sumBillable':_0x11af9a['sumBillable'],'sumDuration':_0x11af9a['sumDuration'],'sumHoldTime':_0x11af9a[_0x564d('0x55')]||0x0,'talking':_0x11af9a[_0x564d('0x56')],'total':_0x11af9a[_0x564d('0x57')],'type':_0x11af9a[_0x564d('0x4f')],'unmanaged':_0x11af9a[_0x564d('0x58')],'abandoned':_0x11af9a['abandoned'],'waiting':_0x11af9a['waiting'],'loggedInDb':_0x11af9a[_0x564d('0x59')],'dialActive':_0x11af9a['dialActive'],'dialMethod':_0x11af9a['dialMethod'],'dialOriginateCallerIdName':_0x11af9a[_0x564d('0x5a')],'dialOriginateCallerIdNumber':_0x11af9a[_0x564d('0x5b')],'dialOriginateTimeout':_0x11af9a[_0x564d('0x5c')],'dialPrefix':_0x11af9a[_0x564d('0x5d')],'outboundAnswerAgiCallsDay':_0x11af9a['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x11af9a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x11af9a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x11af9a[_0x564d('0x5e')],'outboundCongestionCallsDay':_0x11af9a[_0x564d('0x5f')],'outboundDropCallsDayACS':_0x11af9a[_0x564d('0x60')],'outboundDropCallsDayCallersExit':_0x11af9a[_0x564d('0x61')],'outboundDropCallsDayTimeout':_0x11af9a[_0x564d('0x62')],'outboundNoAnswerCallsDay':_0x11af9a[_0x564d('0x63')],'outboundNoSuchCallsDay':_0x11af9a[_0x564d('0x64')],'outboundOriginateFailureCallsDay':_0x11af9a[_0x564d('0x65')],'outboundReCallsDay':_0x11af9a[_0x564d('0x66')],'outboundRejectCallsDay':_0x11af9a[_0x564d('0x67')],'outboundUnknownCallsDay':_0x11af9a[_0x564d('0x68')],'predictiveIntervalAnsweredCalls':_0x11af9a[_0x564d('0x69')],'predictiveIntervalAvgHoldtime':_0x11af9a[_0x564d('0x6a')],'predictiveIntervalAvgTalktime':_0x11af9a[_0x564d('0x6b')],'predictiveIntervalDroppedCallsCallersExit':_0x11af9a[_0x564d('0x6c')],'predictiveIntervalDroppedCallsTimeout':_0x11af9a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x11af9a[_0x564d('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x11af9a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x11af9a[_0x564d('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x11af9a['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x11af9a[_0x564d('0x6f')],'predictiveIntervalAvailable':_0x11af9a['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x11af9a[_0x564d('0x70')],'message':_0x11af9a[_0x564d('0x41')],'originated':_0x11af9a[_0x564d('0x71')],'erlangCalls':_0x11af9a[_0x564d('0x72')],'erlangCallToSecond':_0x11af9a['erlangCallToSecond'],'erlangAbandonmentRate':_0x11af9a[_0x564d('0x73')],'erlangBusyFactor':_0x11af9a[_0x564d('0x74')],'startPredictive':_0x11af9a[_0x564d('0x75')],'startProgressive':_0x11af9a[_0x564d('0x29')]};if(_0x11af9a['Trunk']){_0x1b79a9[_0x564d('0x76')]={'id':_0x11af9a['Trunk']['id'],'name':_0x11af9a[_0x564d('0x76')][_0x564d('0x43')],'active':_0x11af9a['Trunk']['active'],'callerid':_0x11af9a[_0x564d('0x76')][_0x564d('0x77')]};}if(_0x11af9a[_0x564d('0x45')]){_0x1b79a9['Interval']={'id':_0x11af9a['Interval']['id'],'name':_0x11af9a[_0x564d('0x45')][_0x564d('0x43')]};}var _0x46f7e3=md5(JSON['stringify'](_0x1b79a9));if(_0x11af9a[_0x564d('0x78')]!==_0x46f7e3){_0x11af9a[_0x564d('0x78')]=_0x46f7e3;emit(util[_0x564d('0x79')]('voice:queue:%s',_0x1b79a9['name']),_0x564d('0x7a'),_0x1b79a9);}}}function emitCampaignSummary(_0x500d41){if(_0x500d41[_0x564d('0x4f')]===_0x564d('0x7b')){emit(util[_0x564d('0x79')](_0x564d('0x7c'),_0x500d41[_0x564d('0x43')]),_0x564d('0x7d'),_0x500d41);}}function checkGetDataPredictive(_0x2f83d1){if(isNotNull(_0x2f83d1)&&!_[_0x564d('0x48')](_0x2f83d1)){loggerPredictive[_0x564d('0x7e')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x564d('0x7e')](_0x564d('0x7f'),_0x2f83d1[_0x564d('0x70')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x80'),_0x2f83d1[_0x564d('0x69')]);loggerPredictive[_0x564d('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2f83d1[_0x564d('0x81')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x82'),_0x2f83d1['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x564d('0x7e')](_0x564d('0x83'),_0x2f83d1[_0x564d('0x6a')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x84'),_0x2f83d1[_0x564d('0x6b')]);loggerPredictive[_0x564d('0x7e')]('---------------------------');if(_0x2f83d1['predictiveIntervalTotalCalls']>0x0){if(!_[_0x564d('0x3f')](_0x2f83d1[_0x564d('0x6b')])&&_0x2f83d1[_0x564d('0x6b')]>0x0){return!![];}loggerPredictive[_0x564d('0x7e')](_0x564d('0x85'));if(!_['isUndefined'](_0x2f83d1['predictiveIntervalAvgHoldtime'])&&_0x2f83d1[_0x564d('0x6a')]>0x0){return!![];}loggerPredictive[_0x564d('0x7e')](_0x564d('0x86'));}else{loggerPredictive[_0x564d('0x7e')](_0x564d('0x87'));}}else{loggerPredictive['info'](_0x564d('0x88'));}return![];}function mergeDataErlangB(_0x155bba){return function(_0xc2f558){loggerPredictive[_0x564d('0x7e')](_0x564d('0x89'));loggerPredictive[_0x564d('0x7e')](_0x564d('0x8a'),_0xc2f558[_0x564d('0x72')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8b'),_0xc2f558['erlangCallToSecond']);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8c'),_0xc2f558[_0x564d('0x73')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8d'),_0xc2f558[_0x564d('0x74')]);loggerPredictive[_0x564d('0x7e')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc2f558[_0x564d('0x73')]);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8e'));_[_0x564d('0x8f')](_0x155bba,_0xc2f558);};}function getDiff(_0x67cbd8){var _0x564aac=moment()[_0x564d('0x4b')](0x0);var _0x5f3c28=moment(_0x67cbd8)[_0x564d('0x4b')](0x0);return _0x564aac['diff'](_0x5f3c28,_0x564d('0x4d'));}function ifInterval(_0x5ce56d,_0x4234e0){if(_[_0x564d('0x3f')](_0x4234e0)){return![];}return getDiff(_0x4234e0)<_0x5ce56d*0x3c;}function freeVariablesPredictive(_0x1489ba){if(isNotNull(_0x1489ba)){if(!_[_0x564d('0x3f')](_0x1489ba[_0x564d('0x29')])){_0x1489ba[_0x564d('0x29')]=undefined;loggerPredictive[_0x564d('0x7e')](_0x1489ba[_0x564d('0x43')],_0x564d('0x90'));}if(!_['isUndefined'](_0x1489ba[_0x564d('0x75')])){_0x1489ba[_0x564d('0x75')]=undefined;loggerPredictive[_0x564d('0x7e')](_0x1489ba[_0x564d('0x43')],_0x564d('0x91'));}if(!_['isUndefined'](_0x1489ba[_0x564d('0x92')])){clearInterval(_0x1489ba[_0x564d('0x92')]);_0x1489ba[_0x564d('0x92')]=undefined;loggerPredictive[_0x564d('0x7e')](_0x1489ba[_0x564d('0x43')],_0x564d('0x93'));}}}function erlangb(_0x3614a3,_0x4ef76f){if(_0x4ef76f===0x0){return 0x0;}var _0x4deb22=0x1;for(var _0x21fc0e=0x1;_0x21fc0e<=_0x4ef76f;_0x21fc0e+=0x1){_0x4deb22=0x1+_0x4deb22*_0x21fc0e/_0x3614a3;}return 0x1/_0x4deb22;}function isVoiceQueueOutbound(_0x5aa3af){return _0x5aa3af===_0x564d('0x50');}function isNotPreview(_0x5e2455){return _0x5e2455!==_0x564d('0x94');}function isCampaignIvr(_0x2a90f3){return _0x2a90f3==='ivr';}function getCallerId(_0x2ba8d2,_0x231d52,_0x505c29){if(!_[_0x564d('0x3f')](_0x505c29)&&typeof _0x505c29===_0x564d('0x95')&&!_['isEmpty'](_0x505c29)){if(!_['isUndefined'](_0x231d52)&&typeof _0x231d52===_0x564d('0x95')&&!_['isEmpty'](_0x231d52)){return util[_0x564d('0x79')]('\x22%s\x22\x20<%s>',_0x231d52,_0x505c29);}return util[_0x564d('0x79')](_0x564d('0x96'),_0x505c29,_0x505c29);}if(!_[_0x564d('0x3f')](_0x2ba8d2)&&typeof _0x2ba8d2===_0x564d('0x95')&&!_[_0x564d('0x48')](_0x2ba8d2)){return _0x2ba8d2;}return _0x564d('0x97');}function loggerCatchQueueSummary(_0x171dce,_0x219c25){return function(_0x3b1a03){freeVariablesPredictive(_0x219c25);emitVoiceQueueSummary(_0x219c25);emitCampaignSummary(_0x219c25);loggerSyncQueueSummary['error'](_0x171dce,util[_0x564d('0x98')](_0x3b1a03,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x24c3ec,_0x35815e){return function(_0x540ff6){loggerPredictive[_0x564d('0x99')](_0x35815e[_0x564d('0x43')],_0x24c3ec);loggerPredictive[_0x564d('0x99')](_0x540ff6['stack']);freeVariablesPredictive(_0x35815e);};}function loggerCatch(_0x56f227){return function(_0x221e06){logger['error'](_0x56f227,util[_0x564d('0x98')](_0x221e06,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4b5e8f){return _0x4b5e8f&&!_[_0x564d('0x3f')](_0x4b5e8f)&&_0x4b5e8f['length']>0x0;}function decremetOriginate(_0x2eae69){if(!_[_0x564d('0x3f')](_0x2eae69)&&_0x2eae69!==null){if(typeof _0x2eae69[_0x564d('0x71')]!==_0x564d('0x9a')){if(_0x2eae69[_0x564d('0x71')]>0x0){_0x2eae69[_0x564d('0x71')]-=0x1;}else{logger[_0x564d('0x99')](_0x564d('0x9b'));}}}else{logger[_0x564d('0x99')](_0x564d('0x9c'));}}function checkContactLowerLimitOriginate(_0x2518fb,_0x35e69c,_0x39096a){if(_0x35e69c>_0x39096a){for(var _0x3ce9ae=0x0;_0x3ce9ae<_0x35e69c-_0x39096a;_0x3ce9ae+=0x1){decremetOriginate(_0x2518fb);}}}function loggerGetContactDialer(_0x561e5d,_0x3f2524,_0x43a38c){return function(_0x14f672){checkContactLowerLimitOriginate(_0x3f2524,_0x43a38c,0x0);logger[_0x564d('0x99')](_0x561e5d,util[_0x564d('0x98')](_0x14f672,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5cfcda){return function(_0xc9fd88){if(isNotNull(_0xc9fd88)&&isNotNull(_0xc9fd88[0x0])){if(_0xc9fd88[0x0]['contactsRescheduled']>0x0){_0x5cfcda[_0x564d('0x41')]=_0x564d('0x9d');logger['info'](_0x564d('0x9e')+_0x5cfcda['name'],_0xc9fd88[0x0][_0x564d('0x9f')],'contacts');}else{_0x5cfcda[_0x564d('0x41')]=_0x564d('0xa0');logger[_0x564d('0x7e')]('[getContactDialer2][Empty]'+_0x5cfcda[_0x564d('0x43')]);}}};}function notSendMessagesQueue(_0x38e65e){if(_0x38e65e[_0x564d('0xa1')]){freeVariablesPredictive(_0x38e65e);if(_0x38e65e[_0x564d('0x71')]===0x0&&_0x38e65e['talking']===0x0&&_0x38e65e[_0x564d('0xa2')]===0x0&&(_0x38e65e[_0x564d('0x54')]||0x0)===0x0){_0x38e65e['sendMessageOneNotActive']=![];_0x38e65e['available']=0x0;_0x38e65e['message']=_0x564d('0x42');loggerSyncQueueSummary[_0x564d('0x99')](_0x564d('0xa3'),_0x38e65e[_0x564d('0x43')],_0x564d('0xa4'));}else{_0x38e65e[_0x564d('0x41')]=_0x564d('0xa5');loggerSyncQueueSummary[_0x564d('0x99')](_0x564d('0xa3'),_0x38e65e[_0x564d('0x43')],'is\x20disactive');}emitVoiceQueueSummary(_0x38e65e);}}function notSendMessagesCampaign(_0x34c811){if(_0x34c811[_0x564d('0xa1')]){if(_0x34c811[_0x564d('0x71')]===0x0){_0x34c811[_0x564d('0xa1')]=![];_0x34c811[_0x564d('0x41')]=_0x564d('0x42');loggerSyncQueueSummary[_0x564d('0x99')](_0x564d('0xa6'),_0x34c811[_0x564d('0x43')],_0x564d('0xa4'));}else{_0x34c811['message']=_0x564d('0xa5');loggerSyncQueueSummary['error'](_0x564d('0xa6'),_0x34c811[_0x564d('0x43')],_0x564d('0xa7'));}emitCampaignSummary(_0x34c811);}}function createObjHistory(_0x4f4c9e,_0x27d44d,_0x581e8a,_0x2ad341,_0x4f9329){_0x4f4c9e[_0x564d('0x41')]=_0x581e8a;var _0x1b103b=new Action(_0x4f4c9e,_0x27d44d);var _0x1edf21=new History(_0x1b103b);_0x1edf21[_0x564d('0xa8')]=_0x2ad341;_0x1edf21[_0x564d('0xa9')]=_0x4f9329;_0x1edf21['endtime']=_0x1b103b['starttime'];return _0x1edf21;}Dialer[_0x564d('0x1c')][_0x564d('0x3c')]=function(){var _0x56d425=this;setInterval(function(){_0x56d425['clearZombieChannels'](_0x56d425['uniqueId'],'[uniqueid]');_0x56d425[_0x564d('0xaa')](_0x56d425['actions'],'[actions]');},0x32c8);};Dialer['prototype'][_0x564d('0xaa')]=function(_0x52a09e,_0x28d936){var _0x4662fb=this;for(var _0x51eab9 in _0x52a09e){if(typeof _0x52a09e[_0x51eab9]!==_0x564d('0x9a')){this[_0x564d('0x20')][_0x564d('0x1d')](function(){if(!_[_0x564d('0xab')](_0x52a09e[_0x51eab9])){return ami['Action']({'action':'status','channel':_0x52a09e[_0x51eab9][_0x564d('0xac')]})[_0x564d('0xad')](function(_0x550559){if(_0x550559['message']===_0x564d('0xae')){setTimeout(function(){if(_0x52a09e[_0x51eab9]&&_0x52a09e[_0x51eab9]['type']!==_0x564d('0x7b')){_0x4662fb['updateOriginated'](_0x4662fb[_0x564d('0x21')][_0x52a09e[_0x51eab9][_0x564d('0xaf')]]);logger[_0x564d('0x99')](_0x564d('0xb0'),_0x28d936,_0x51eab9,_0x52a09e[_0x51eab9]['queue']);delete _0x52a09e[_0x51eab9];}if(_0x52a09e[_0x51eab9]&&_0x52a09e[_0x51eab9][_0x564d('0x4f')]===_0x564d('0x7b')){_0x4662fb[_0x564d('0xb1')](_0x4662fb['campaigns'][_0x52a09e[_0x51eab9]['queue']]);logger[_0x564d('0x99')](_0x564d('0xb2'),_0x28d936,_0x51eab9,_0x52a09e[_0x51eab9][_0x564d('0xaf')]);delete _0x52a09e[_0x51eab9];}},0x2328);}});}});}}};Dialer[_0x564d('0x1c')][_0x564d('0xb3')]=function(_0x5671d4){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopper[_0x564d('0xb3')](_0x5671d4))[_0x564d('0xad')](loggerCatch(_0x564d('0xb5')));};Dialer[_0x564d('0x1c')][_0x564d('0xb6')]=function(_0x55d114){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopperBlack['checkIsBlackList'](_0x55d114))[_0x564d('0xad')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x564d('0x1c')][_0x564d('0xb7')]=function(_0x43c041){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopperBlack[_0x564d('0xb7')](_0x43c041))[_0x564d('0xad')](loggerCatch(_0x564d('0xb8')));};Dialer[_0x564d('0x1c')][_0x564d('0xb9')]=function(_0x7828a0){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopperHistory[_0x564d('0xba')](_0x7828a0))[_0x564d('0xad')](loggerCatch(_0x564d('0xbb')));};Dialer[_0x564d('0x1c')][_0x564d('0xbc')]=function(_0x32cbf0){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopper[_0x564d('0xbc')](_0x32cbf0))[_0x564d('0xad')](loggerCatch(_0x564d('0xbd')));};Dialer[_0x564d('0x1c')]['unlockContact']=function(_0x116bda,_0x184806,_0x1464cc){return BPromise['resolve']()['then'](cmHopper[_0x564d('0xbe')](_0x116bda,_0x184806,_0x1464cc))[_0x564d('0xad')](loggerCatch(_0x564d('0xbf')));};Dialer[_0x564d('0x1c')][_0x564d('0xc0')]=function(_0x41e8bc,_0x30e839,_0x4cfcc2,_0x4c26d2,_0x48c709){return BPromise['resolve']()[_0x564d('0x3d')](cmHopper[_0x564d('0xc0')](_0x41e8bc,_0x30e839,_0x4cfcc2,_0x4c26d2))[_0x564d('0xad')](function(_0x30bb12){_0x48c709[_0x564d('0xc1')]-=_0x4cfcc2;_0x48c709[_0x564d('0xc1')]=_0x48c709[_0x564d('0xc1')]>0x0?_0x48c709['temp']:0x0;loggerCatch(_0x564d('0xc2'))(_0x30bb12);});};Dialer[_0x564d('0x1c')]['getContactDialerIvr']=function(_0x109b78,_0x2c60b1,_0x5b19f3,_0x5b4fc8){return BPromise[_0x564d('0xb4')]()['then'](cmHopper[_0x564d('0xc3')](_0x109b78,_0x2c60b1,_0x5b19f3))[_0x564d('0xad')](function(_0x1ca917){_0x5b4fc8[_0x564d('0xc1')]-=_0x2c60b1;_0x5b4fc8[_0x564d('0xc1')]=_0x5b4fc8[_0x564d('0xc1')]>0x0?_0x5b4fc8[_0x564d('0xc1')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x1ca917);});};Dialer[_0x564d('0x1c')][_0x564d('0xc4')]=function(_0x5ac6e7){return BPromise[_0x564d('0xb4')]()['then'](voiceQueueRt[_0x564d('0xc4')](_0x5ac6e7))[_0x564d('0xad')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x564d('0x1c')][_0x564d('0xc5')]=function(_0x58156d){return BPromise['resolve']()[_0x564d('0x3d')](cmHopper[_0x564d('0xc5')](_0x58156d))[_0x564d('0xad')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x564d('0x1c')][_0x564d('0xc6')]=function(_0x25f725){return BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](cmHopperHistory[_0x564d('0xc6')](_0x25f725))[_0x564d('0xad')](loggerCatch(_0x564d('0xc7')));};Dialer[_0x564d('0x1c')][_0x564d('0xb1')]=function(_0xfb2cb8){if(!_['isUndefined'](_0xfb2cb8)&&_0xfb2cb8!==null){if(typeof _0xfb2cb8['originated']!=='undefined'){if(_0xfb2cb8['originated']>0x0){_0xfb2cb8[_0x564d('0x71')]-=0x1;}else{logger[_0x564d('0x99')](_0x564d('0xc8'));}}}else{logger[_0x564d('0x99')](_0x564d('0xc9'));}};Dialer[_0x564d('0x1c')][_0x564d('0xca')]=function(_0x266501,_0x227152){var _0x51875c=this;return function(_0x153b31){_0x51875c['updateOriginated'](_0x227152);logger[_0x564d('0x99')](_0x266501,util[_0x564d('0x98')](_0x153b31,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x37ae40,_0x832041,_0x187f52){var _0x73171={'state':0x19,'statedesc':_0x564d('0xcb')};this['updateOriginated'](_0x832041);this[_0x564d('0xcc')](_['merge'](_0x73171,_[_0x564d('0xcd')](_0x187f52,[_0x564d('0xce'),_0x564d('0xcf'),_0x564d('0xd0'),_0x564d('0xd1'),'CampaignId'])),'[emptyContact][createHistory]',_0x564d('0xd2'));logger['error'](_0x37ae40);};Dialer[_0x564d('0x1c')][_0x564d('0xd3')]=function(_0x477b66){return _0x477b66===_0x564d('0xd4');};Dialer[_0x564d('0x1c')][_0x564d('0xd5')]=function(_0x22afd3){return!_[_0x564d('0x3f')](_0x22afd3)&&_0x22afd3&&!_[_0x564d('0x3f')](_0x22afd3[_0x564d('0x43')])&&!_[_0x564d('0x3f')](_0x22afd3[_0x564d('0xd6')])&&_0x22afd3[_0x564d('0xd6')]&&(this[_0x564d('0x24')][util[_0x564d('0x79')](_0x564d('0xd7'),_0x22afd3['name'])][_0x564d('0xd8')]==='reachable'||this[_0x564d('0x24')][util[_0x564d('0x79')](_0x564d('0xd7'),_0x22afd3[_0x564d('0x43')])][_0x564d('0xd8')]===_0x564d('0xd9'));};Dialer[_0x564d('0x1c')][_0x564d('0xcc')]=function(_0x1c44ec,_0x487211,_0x371769){this[_0x564d('0xc6')](_0x1c44ec)[_0x564d('0xad')](loggerCatch(_0x487211));this[_0x564d('0xc5')](_0x1c44ec)[_0x564d('0xad')](loggerCatch(_0x371769));};Dialer['prototype'][_0x564d('0x36')]=function(_0x9eb20a){var _0x4886e2=this[_0x564d('0xda')][_0x9eb20a[_0x564d('0xdb')]];var _0x20b312;if(!_['isNil'](_0x9eb20a)&&!_['isNil'](_0x9eb20a['variable'])&&!_['isNil'](_0x9eb20a[_0x564d('0xdc')][_0x564d('0xdd')])&&_0x9eb20a['exten']===_0x564d('0xde')&&_0x4886e2){if(_0x4886e2['type']!=='ivr'&&this[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]][_0x564d('0xdf')]&&_0x9eb20a['value']==='HANGUP'){delete this[_0x564d('0xda')][_0x9eb20a['uniqueid']];this[_0x564d('0xb1')](this[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]]);this[_0x564d('0x21')][_0x4886e2['queue']][_0x564d('0xe0')]+=0x1;this[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]][_0x564d('0xe1')]+=0x1;_0x20b312=new Hangup(_0x4886e2,_0x9eb20a);_0x20b312[_0x564d('0xa8')]=0x12;_0x20b312[_0x564d('0xa9')]=_0x564d('0xe2');_0x20b312[_0x564d('0xe3')]=_0x564d('0xe4');ami[_0x564d('0x4e')](_0x564d('0xe5'),ut[_0x564d('0xe6')](_0x20b312,_0x564d('0xe7')));this[_0x564d('0xcc')](_0x20b312,_0x564d('0xe8'),_0x564d('0xe9'));}if(_0x4886e2[_0x564d('0x4f')]!==_0x564d('0x7b')&&this[_0x564d('0x21')][_0x4886e2['queue']]['dialAMDActive']&&_0x9eb20a[_0x564d('0xea')]===_0x564d('0xeb')){var _0x5f10b6=this;return new BPromise(function(_0x286953,_0x1a4bb5){delete _0x5f10b6[_0x564d('0xda')][_0x9eb20a['uniqueid']];_0x5f10b6[_0x564d('0xb1')](_0x5f10b6[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]]);_0x5f10b6[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]][_0x564d('0xe0')]+=0x1;_0x5f10b6[_0x564d('0x21')][_0x4886e2[_0x564d('0xaf')]][_0x564d('0xe1')]+=0x1;var _0x321aca=_0x5f10b6['voiceQueues'][_0x4886e2[_0x564d('0xaf')]];var _0x3de83e=new Hangup(_0x4886e2,_0x9eb20a);_0x3de83e[_0x564d('0xa8')]=0x13;_0x3de83e[_0x564d('0xa9')]=_0x564d('0xec');_0x3de83e[_0x564d('0xe3')]=_0x564d('0xe4');_0x3de83e[_0x564d('0xed')]+=0x1;_0x3de83e['countglobal']+=0x1;_0x3de83e['amd']=!![];ami[_0x564d('0x4e')](_0x564d('0xe5'),ut[_0x564d('0xe6')](_0x3de83e,_0x564d('0xe7')));_0x5f10b6[_0x564d('0xc6')](_0x3de83e)[_0x564d('0xad')](loggerCatch(_0x564d('0xee')));if(_0x3de83e[_0x564d('0xef')]+_0x3de83e[_0x564d('0xf0')]+_0x3de83e[_0x564d('0xf1')]+_0x3de83e[_0x564d('0xf2')]+_0x3de83e['countdropretry']+_0x3de83e[_0x564d('0xf3')]+_0x3de83e['countmachineretry']+_0x3de83e['countagentrejectretry']>=_0x321aca[_0x564d('0xf4')]){_0x5f10b6[_0x564d('0xf5')](_0x3de83e,_0x286953,_0x1a4bb5,'reason19\x20machine....');}else{if(_0x3de83e[_0x564d('0xed')]>=_0x321aca[_0x564d('0xf6')]){_0x5f10b6[_0x564d('0xf7')](_0x3de83e,_0x286953,_0x1a4bb5,_0x564d('0xf8'));}else{_0x5f10b6[_0x564d('0xbc')]({'active':![],'countmachineretry':_0x3de83e['countmachineretry'],'scheduledat':moment()['add'](_0x321aca[_0x564d('0xf9')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3de83e[_0x564d('0xce')],'ListId':_0x3de83e['ListId'],'VoiceQueueId':_0x3de83e['VoiceQueueId']||undefined,'CampaignId':_0x3de83e[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch('[rescheduleContact][Machine]'));_0x286953({'reschedule':0x1});}}});}if(_0x4886e2['type']===_0x564d('0x7b')&&this[_0x564d('0x22')][_0x4886e2['queue']][_0x564d('0xdf')]&&_0x9eb20a[_0x564d('0xea')]==='HANGUP'){delete this['uniqueId'][_0x9eb20a[_0x564d('0xdb')]];this[_0x564d('0xb1')](this[_0x564d('0x22')][_0x4886e2[_0x564d('0xaf')]]);_0x20b312=new Hangup(_0x4886e2,_0x9eb20a);_0x20b312[_0x564d('0xa8')]=0x12;_0x20b312[_0x564d('0xa9')]='HangupInAMD';_0x20b312[_0x564d('0xe3')]=_0x564d('0xe4');ami['emit'](_0x564d('0xe5'),ut['buildObj'](_0x20b312,'amd'));this[_0x564d('0xcc')](_0x20b312,'[syncHangupInAMDIvr][createHistory]',_0x564d('0xfb'));}if(_0x4886e2['type']===_0x564d('0x7b')&&this['campaigns'][_0x4886e2['queue']][_0x564d('0xdf')]&&_0x9eb20a[_0x564d('0xea')]===_0x564d('0xeb')){var _0x5f10b6=this;return new BPromise(function(_0xd8201e,_0x52d985){delete _0x5f10b6[_0x564d('0xda')][_0x9eb20a[_0x564d('0xdb')]];_0x5f10b6[_0x564d('0xb1')](_0x5f10b6[_0x564d('0x22')][_0x4886e2[_0x564d('0xaf')]]);_0x5f10b6[_0x564d('0x22')][_0x4886e2[_0x564d('0xaf')]]['outboundAnswerCallsDay']+=0x1;_0x5f10b6[_0x564d('0x22')][_0x4886e2[_0x564d('0xaf')]][_0x564d('0xe1')]+=0x1;var _0x7abea1=_0x5f10b6[_0x564d('0x22')][_0x4886e2[_0x564d('0xaf')]];var _0x26fa81=new Hangup(_0x4886e2,_0x9eb20a);_0x26fa81['state']=0x13;_0x26fa81[_0x564d('0xa9')]=_0x564d('0xec');_0x26fa81[_0x564d('0xe3')]='AMD';_0x26fa81['countmachineretry']+=0x1;_0x26fa81['countglobal']+=0x1;_0x26fa81[_0x564d('0xe7')]=!![];ami['emit']('custom:amd',ut[_0x564d('0xe6')](_0x26fa81,'amd'));_0x5f10b6[_0x564d('0xc6')](_0x26fa81)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x26fa81['countbusyretry']+_0x26fa81[_0x564d('0xf0')]+_0x26fa81[_0x564d('0xf1')]+_0x26fa81[_0x564d('0xf2')]+_0x26fa81[_0x564d('0xfc')]+_0x26fa81['countabandonedretry']+_0x26fa81['countmachineretry']+_0x26fa81[_0x564d('0xfd')]>=_0x7abea1[_0x564d('0xf4')]){_0x5f10b6['stateGlobal'](_0x26fa81,_0xd8201e,_0x52d985,_0x564d('0xfe'));}else{if(_0x26fa81['countmachineretry']>=_0x7abea1['dialMachineMaxRetry']){_0x5f10b6['createStateFinal'](_0x26fa81,_0xd8201e,_0x52d985,_0x564d('0xf8'));}else{_0x5f10b6[_0x564d('0xbc')]({'active':![],'countmachineretry':_0x26fa81[_0x564d('0xed')],'scheduledat':moment()[_0x564d('0xff')](_0x7abea1[_0x564d('0xf9')],'minutes')[_0x564d('0x79')](_0x564d('0x100')),'ContactId':_0x26fa81[_0x564d('0xce')],'ListId':_0x26fa81[_0x564d('0xcf')],'VoiceQueueId':_0x26fa81['VoiceQueueId']||undefined,'CampaignId':_0x26fa81['CampaignId']||undefined})['catch'](loggerCatch(_0x564d('0x101')));_0xd8201e({'reschedule':0x1});}}});}}};Dialer[_0x564d('0x1c')]['syncHangup']=function(_0x3cc3e5){var _0x586070=this[_0x564d('0xda')][_0x3cc3e5[_0x564d('0xdb')]];var _0x310361=this;var _0x28c5f2;if(_0x586070&&_0x586070[_0x564d('0x4f')]===_0x564d('0x7b')){delete this[_0x564d('0xda')][_0x3cc3e5['uniqueid']];this['updateOriginated'](this[_0x564d('0x22')][_0x586070[_0x564d('0xaf')]]);this[_0x564d('0x22')][_0x586070['queue']][_0x564d('0x102')]+=0x1;_0x28c5f2=new Hangup(_0x586070,_0x3cc3e5);this['createHistory'](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x103')));this[_0x564d('0xc5')](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x104')));}if(_0x586070&&_0x586070[_0x564d('0x4f')]!=='ivr'&&isNotNull(this[_0x564d('0x21')][_0x586070[_0x564d('0xaf')]]['dialQueueProject'])){delete this['uniqueId'][_0x3cc3e5[_0x564d('0xdb')]];this[_0x564d('0xb1')](this[_0x564d('0x21')][_0x586070[_0x564d('0xaf')]]);this['voiceQueues'][_0x586070[_0x564d('0xaf')]][_0x564d('0xe0')]+=0x1;this[_0x564d('0x21')][_0x586070[_0x564d('0xaf')]]['outboundAnswerAgiCallsDay']+=0x1;_0x28c5f2=new Hangup(_0x586070,_0x3cc3e5);_0x28c5f2['state']=0x10;_0x28c5f2['statedesc']=_0x564d('0x105');_0x28c5f2[_0x564d('0xe3')]=_0x564d('0x106');this['createHistory'](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x103')));this[_0x564d('0xc5')](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x104')));}if(_0x586070&&_0x586070[_0x564d('0x4f')]!==_0x564d('0x7b')&&!isNotNull(this[_0x564d('0x21')][_0x586070['queue']][_0x564d('0x107')])){delete this['uniqueId'][_0x3cc3e5[_0x564d('0xdb')]];this['updateOriginated'](this[_0x564d('0x21')][_0x586070['queue']]);this[_0x564d('0x21')][_0x586070['queue']][_0x564d('0x68')]+=0x1;_0x28c5f2=new Hangup(_0x586070,_0x3cc3e5);_0x28c5f2[_0x564d('0xa8')]=0xc;_0x28c5f2[_0x564d('0xa9')]=_0x3cc3e5['cause-txt'];_0x28c5f2[_0x564d('0xe3')]=_0x564d('0x108');this[_0x564d('0xc6')](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x103')));this[_0x564d('0xc5')](_0x28c5f2)[_0x564d('0xad')](loggerCatch(_0x564d('0x104')));}};Dialer[_0x564d('0x1c')][_0x564d('0x109')]=function(_0x5cc0b2){var _0xe0ed5a=this[_0x564d('0xda')][_0x5cc0b2['uniqueid']];var _0x26d2dc=this;if(this['voiceQueues'][_0x5cc0b2[_0x564d('0xaf')]]){if(_0xe0ed5a&&_0xe0ed5a[_0x564d('0x4f')]!=='ivr'){delete this[_0x564d('0xda')][_0x5cc0b2[_0x564d('0xdb')]];this['voiceQueues'][_0x5cc0b2['queue']][_0x564d('0xe0')]+=0x1;var _0x4d379a=new AgentComplete(_0xe0ed5a,_0x5cc0b2);if(_0x5cc0b2[_0x564d('0x10a')]===_0x564d('0x10b')){_0x4d379a['agiafterat']=this[_0x564d('0x21')][_0x5cc0b2[_0x564d('0xaf')]][_0x564d('0x10c')]&&this[_0x564d('0x21')][_0x5cc0b2[_0x564d('0xaf')]][_0x564d('0x10d')]?moment()['format'](_0x564d('0x100')):undefined;}this[_0x564d('0xc6')](_0x4d379a)[_0x564d('0xad')](loggerCatch(_0x564d('0x10e')));this[_0x564d('0xc5')](_0x4d379a)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x564d('0x1c')]['syncAgentConnect']=function(_0x45a816){if(this['voiceQueues'][_0x45a816['queue']]){if(this[_0x564d('0xda')][_0x45a816[_0x564d('0xdb')]]&&this[_0x564d('0xda')][_0x45a816[_0x564d('0xdb')]][_0x564d('0x4f')]!==_0x564d('0x7b')){this['updateOriginated'](this[_0x564d('0x21')][_0x45a816[_0x564d('0xaf')]]);this[_0x564d('0xda')][_0x45a816[_0x564d('0xdb')]]['answertime']=moment()[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x564d('0x1c')][_0x564d('0x10f')]=function(_0x1329c4){this[_0x564d('0xc6')](_0x1329c4)[_0x564d('0xad')](loggerCatch(_0x564d('0x10e')));this[_0x564d('0xc5')](_0x1329c4)['catch'](loggerCatch(_0x564d('0x110')));};Dialer[_0x564d('0x1c')][_0x564d('0x2d')]=function(_0x4f8ec7){var _0x1f2d22=this[_0x564d('0xda')][_0x4f8ec7['uniqueid']];var _0x120674=this;if(this['voiceQueues'][_0x4f8ec7[_0x564d('0xaf')]]){if(_0x1f2d22&&_0x1f2d22[_0x564d('0x4f')]!=='ivr'){delete this[_0x564d('0xda')][_0x4f8ec7[_0x564d('0xdb')]];this['updateOriginated'](this[_0x564d('0x21')][_0x4f8ec7['queue']]);_0x1f2d22[_0x564d('0x111')]=moment()[_0x564d('0x79')](_0x564d('0x100'));var _0x10f964=new QueueCallerAbandon(_0x1f2d22,_0x4f8ec7);if(getSeconds(_0x1f2d22[_0x564d('0x111')],_0x1f2d22['responsetime'])>=_0x1f2d22[_0x564d('0x112')]){this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]][_0x564d('0x81')]+=0x1;this['voiceQueues'][_0x4f8ec7['queue']][_0x564d('0x62')]+=0x1;this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]][_0x564d('0x113')]+=0x1;_0x10f964[_0x564d('0xa8')]=0xa;_0x10f964[_0x564d('0xa9')]=_0x564d('0x114');_0x10f964[_0x564d('0x115')]=_0x564d('0x116');_0x10f964[_0x564d('0x117')]=this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]][_0x564d('0x10c')]?moment()[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x10f964[_0x564d('0xfc')]+=0x1;_0x10f964['countglobal']+=0x1;if(_0x10f964[_0x564d('0xfc')]>=this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]][_0x564d('0x118')]){this['queueCallerAbandonCreateState'](_0x10f964);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x10f964['countdropretry'],'scheduledat':moment()['add'](this[_0x564d('0x21')][_0x4f8ec7['queue']][_0x564d('0x119')],_0x564d('0x11a'))[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f2d22['ContactId'],'ListId':_0x1f2d22[_0x564d('0xcf')],'VoiceQueueId':_0x1f2d22[_0x564d('0xd1')]||undefined,'CampaignId':_0x1f2d22[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x11b')));var _0x2f7a3d=new History(_0x10f964);_0x2f7a3d[_0x564d('0xa8')]=0xa;_0x2f7a3d[_0x564d('0xa9')]=_0x564d('0x114');_0x2f7a3d['starttime']=moment()[_0x564d('0x79')](_0x564d('0x100'));_0x2f7a3d[_0x564d('0x11c')]=_0x2f7a3d[_0x564d('0x11d')];_0x2f7a3d[_0x564d('0x11e')]=_0x10f964[_0x564d('0x11e')];_0x2f7a3d[_0x564d('0x11f')]=_0x10f964[_0x564d('0x11f')];this[_0x564d('0xc6')](_0x2f7a3d)[_0x564d('0xad')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x4f8ec7['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]][_0x564d('0x61')]+=0x1;_0x10f964['state']=0xb;_0x10f964[_0x564d('0xa9')]=_0x564d('0x120');_0x10f964['dropreason']=_0x564d('0x121');_0x10f964[_0x564d('0xf3')]+=0x1;_0x10f964[_0x564d('0x122')]+=0x1;if(_0x10f964['countabandonedretry']>=this[_0x564d('0x21')][_0x4f8ec7[_0x564d('0xaf')]]['dialAbandonedMaxRetry']){this[_0x564d('0x10f')](_0x10f964);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x10f964[_0x564d('0xf3')],'scheduledat':moment()[_0x564d('0xff')](this[_0x564d('0x21')][_0x4f8ec7['queue']][_0x564d('0x123')],_0x564d('0x11a'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1f2d22[_0x564d('0xce')],'ListId':_0x1f2d22[_0x564d('0xcf')],'VoiceQueueId':_0x1f2d22[_0x564d('0xd1')]||undefined,'CampaignId':_0x1f2d22[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x124')));var _0x2f7a3d=new History(_0x10f964);_0x2f7a3d[_0x564d('0xa8')]=0xb;_0x2f7a3d[_0x564d('0xa9')]=_0x564d('0x120');_0x2f7a3d['starttime']=moment()[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f7a3d[_0x564d('0x11c')]=_0x2f7a3d[_0x564d('0x11d')];_0x2f7a3d[_0x564d('0x11e')]=_0x10f964[_0x564d('0x11e')];_0x2f7a3d[_0x564d('0x11f')]=_0x10f964[_0x564d('0x11f')];this[_0x564d('0xc6')](_0x2f7a3d)[_0x564d('0xad')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x564d('0x1c')]['syncNewExten']=function(_0xb7fa5c){if(this['actions'][_0xb7fa5c[_0x564d('0xdb')]]){this[_0x564d('0x125')][_0xb7fa5c['uniqueid']][_0x564d('0xac')]=_0xb7fa5c[_0x564d('0xac')];}if(this[_0x564d('0xda')][_0xb7fa5c[_0x564d('0xdb')]]){this[_0x564d('0xda')][_0xb7fa5c[_0x564d('0xdb')]][_0x564d('0xac')]=_0xb7fa5c[_0x564d('0xac')];}};Dialer[_0x564d('0x1c')][_0x564d('0x38')]=function(_0x21b34b){if(strategy[this[_0x564d('0x21')][this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]]['queue']]['strategy']]===_0x564d('0x1b')){if(this['actions'][_0x21b34b[_0x564d('0x126')]]&&_[_0x564d('0xab')](this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0x127')])&&_0x21b34b['status']==='1'&&_0x21b34b['paused']==='0'){if(this['agents'][_0x21b34b[_0x564d('0x128')]]){if(!this[_0x564d('0x23')][_0x21b34b['stateinterface']][_0x564d('0x127')]){this[_0x564d('0x23')][_0x21b34b[_0x564d('0x128')]][_0x564d('0x127')]=!![];this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]]['locked']=!![];this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0x128')]=_0x21b34b[_0x564d('0x128')];}}}}else if((strategy[this[_0x564d('0x21')][this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0xaf')]][_0x564d('0x51')]]||_0x564d('0x1a'))===_0x564d('0x1a')){if(this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]]){if(this[_0x564d('0x23')][_0x21b34b[_0x564d('0x128')]]){this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0x128')]=_0x21b34b[_0x564d('0x128')];if(_[_0x564d('0xab')](this[_0x564d('0x129')][this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0xaf')]])){this[_0x564d('0x129')][this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]][_0x564d('0xaf')]]=[];}this[_0x564d('0x129')][this[_0x564d('0x125')][_0x21b34b['actionid']][_0x564d('0xaf')]][_0x564d('0x12a')](_[_0x564d('0x8f')](_[_0x564d('0xcd')](this[_0x564d('0x125')][_0x21b34b[_0x564d('0x126')]],[_0x564d('0x12b'),_0x564d('0x128')]),{'status':_0x21b34b['status'],'paused':_0x21b34b[_0x564d('0x12c')]}));}}}};function unlockQueueStatus(_0x2583ae,_0xc789f7){setTimeout(function(){if(_[_0x564d('0x3f')](_0x2583ae['queueStatusComplete'])){loggerBooked[_0x564d('0x99')]('[unlockQueueStatus][undefined]',_0xc789f7);}_0x2583ae[_0x564d('0x12d')]=!![];loggerBooked['info'](_0x564d('0x12e'),_0xc789f7,JSON['stringify'](_[_0x564d('0xcd')](_0x2583ae,[_0x564d('0x43'),_0x564d('0x12d')])));},0x1f3);}Dialer[_0x564d('0x1c')][_0x564d('0x3a')]=function(_0x946441){var _0x50f93c=this;var _0x434b15=_0x50f93c[_0x564d('0x21')][_0x50f93c[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]];if(strategy[this[_0x564d('0x21')][this['actions'][_0x946441[_0x564d('0x126')]]['queue']][_0x564d('0x51')]]==='roundrobin'){if(this['actions'][_0x946441['actionid']]&&this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['stateinterface']){this[_0x564d('0x94')][_0x564d('0x12f')](this['actions'][_0x946441['actionid']]['idHopper'],this['actions'][_0x946441[_0x564d('0x126')]][_0x564d('0x128')])[_0x564d('0xad')](function(_0x4d45f8){logger[_0x564d('0x99')]('[Catch][Preview][syncQueueStatusComplete]',util['inspect'](_0x4d45f8,{'showHidden':![],'depth':null}));})['finally'](function(){_0x50f93c[_0x564d('0xb1')](_0x50f93c[_0x564d('0x21')][_0x50f93c[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]]);_0x50f93c[_0x564d('0x23')][_0x50f93c['actions'][_0x946441[_0x564d('0x126')]][_0x564d('0x128')]][_0x564d('0x127')]=![];delete _0x50f93c[_0x564d('0x125')][_0x946441[_0x564d('0x126')]];unlockQueueStatus(_0x434b15);});}else{this['updateOriginated'](this[_0x564d('0x21')][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]]);this[_0x564d('0xbc')]({'active':![],'ContactId':this[_0x564d('0x125')][_0x946441['actionid']]['ContactId'],'ListId':this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xcf')],'VoiceQueueId':this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x946441[_0x564d('0x126')]][_0x564d('0xfa')]||undefined})['catch'](loggerCatch(_0x564d('0x130')));delete this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]];unlockQueueStatus(_0x434b15);}}else if((strategy[this[_0x564d('0x21')][this[_0x564d('0x125')][_0x946441['actionid']][_0x564d('0xaf')]][_0x564d('0x51')]]||_0x564d('0x1a'))==='rrmemory'){var _0x16131c;if(this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]&&!_[_0x564d('0x48')](this['queueBooked'][this['actions'][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]])){if(this[_0x564d('0x2b')][_0x50f93c[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['queue']]){this['queueBookedRR'][_0x50f93c[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]]=this[_0x564d('0x2b')][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['queue']]?this['queueBookedRR'][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['queue']]:this[_0x564d('0x129')][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]]?this[_0x564d('0x129')][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]]['queue']]['_rr']||0x0:0x0;}this['queueBooked'][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]][_0x564d('0x131')]=this['queueBookedRR'][this[_0x564d('0x125')][_0x946441[_0x564d('0x126')]][_0x564d('0xaf')]];for(var _0x43a18c=0x0;_0x43a18c=0x0;})[_0x564d('0xad')](myreject(_0x5a63b1)));}}else{_0x791a3b[_0x564d('0x12a')](ami[_0x564d('0x14d')]({'action':_0x564d('0x14e'),'command':util[_0x564d('0x79')](_0x564d('0x14f'),_0x1f4a92,!_[_0x564d('0x3f')](config[_0x564d('0x14a')][_0x34be99])?_0x34be99:'')})[_0x564d('0x3d')](function(_0x156655){return _0x156655[_0x564d('0x151')][_0x564d('0x153')](_0x564d('0x152'))>=0x0;})[_0x564d('0xad')](myreject(_0x5a63b1)));}BPromise['all'](_0x791a3b)[_0x564d('0x3d')](function(_0x2a053d){var _0x18cf2f=_[_0x564d('0x154')](_0x2a053d);if(_0x18cf2f){return _0x5f51cb(_0x18cf2f);}else{_0x17508e['message']=_0x7c6726?_0x564d('0x155'):_0x564d('0x156');return _0x5a63b1(msgResponse('[ifTime][promiseAll]',_0x564d('0x146'),_0x564d('0x157')+_0x7c6726+'\x20'+_0x311a8d+_0x564d('0x158')+util[_0x564d('0x98')](_0x1f4a92,{'showHidden':![],'depth':null})+_0x564d('0x159')+_0x34be99));}})[_0x564d('0xad')](function(_0x156784){return _0x5a63b1(msgResponse(_0x564d('0x144'),'Failure',JSON[_0x564d('0x135')](_0x156784)));});});};Dialer['prototype'][_0x564d('0x15a')]=function(_0x5df245){var _0x3f45fa=this;return function(){switch(_0x5df245['dialMethod']){case _0x564d('0x15b'):freeVariablesPredictive(_0x5df245);_0x3f45fa['handlePower'](_0x5df245,0x1);break;case _0x564d('0x15c'):freeVariablesPredictive(_0x5df245);_0x3f45fa[_0x564d('0x15d')](_0x5df245,_0x5df245['dialPowerLevel']);break;case _0x564d('0x8'):_0x3f45fa[_0x564d('0x8')](_0x5df245);break;case _0x564d('0x15e'):freeVariablesPredictive(_0x5df245);_0x3f45fa[_0x564d('0x15d')](_0x5df245,0x1);break;default:freeVariablesPredictive(_0x5df245);logger[_0x564d('0x99')]('Queue',_0x5df245[_0x564d('0x43')],_0x564d('0x15f'));}};};Dialer[_0x564d('0x1c')][_0x564d('0x160')]=function(_0x3fdecb){return BPromise['resolve']()['then'](cmHopper[_0x564d('0x161')](_0x3fdecb['id'],previewRecallmeReminderInterval))[_0x564d('0x3d')](function(_0x49163f){for(var _0x55050e=0x0;_0x55050e<_0x49163f[_0x564d('0x132')];_0x55050e++){var _0x519771=_0x49163f[_0x55050e]['Agent'][_0x564d('0x43')];if(_0x519771)io['to'](util[_0x564d('0x79')](_0x564d('0x162'),_0x519771))[_0x564d('0x4e')](_0x564d('0x163'),{'hopper':_0x49163f[_0x55050e]});}})[_0x564d('0xad')](function(_0x4a2cea){});};Dialer['prototype']['launchHandleIvr']=function(_0x107b4d){var _0x5e2fb0=this;return function(){_0x5e2fb0[_0x564d('0x164')](_0x107b4d);};};Dialer[_0x564d('0x1c')][_0x564d('0xa')]=function(_0x2991fb){var _0x432579=this;if(isNotPreview(_0x2991fb[_0x564d('0x165')])){if(isVoiceQueueOutbound(_0x2991fb[_0x564d('0x4f')])&&isActive(_0x2991fb[_0x564d('0x166')])){_0x2991fb['sendMessageOneNotActive']=!![];BPromise[_0x564d('0xb4')]()['then'](checkIsLoggedIn(_0x2991fb,_0x2991fb[_0x564d('0x53')]))[_0x564d('0x3d')](checkIsActive(_0x2991fb,_0x2991fb[_0x564d('0x166')]))[_0x564d('0x3d')](checkInterval(_0x2991fb))['then'](_0x432579[_0x564d('0x140')](_0x2991fb))['then'](_0x432579['checkIfTime'](_0x2991fb[_0x564d('0x167')],_0x2991fb['dialTimezone'],_0x2991fb[_0x564d('0x43')],_0x2991fb))['then'](_0x432579[_0x564d('0x145')](_0x2991fb[_0x564d('0x45')],_0x2991fb['dialTimezone'],_0x2991fb['name'],_0x2991fb))[_0x564d('0x3d')](_0x432579[_0x564d('0x15a')](_0x2991fb))[_0x564d('0xad')](loggerCatchQueueSummary('[syncQueueSummary]',_0x2991fb));}else{notSendMessagesQueue(_0x2991fb);}}else{freeVariablesPredictive(_0x2991fb);if(_0x2991fb[_0x564d('0x168')]){_0x432579[_0x564d('0x160')](_0x2991fb);}}};Dialer['prototype'][_0x564d('0x13f')]=function(){var _0x2cebfe=this;var _0x1ed169;for(var _0x4270b3 in this[_0x564d('0x22')]){if(typeof this[_0x564d('0x22')][_0x4270b3]!==_0x564d('0x9a')){_0x1ed169=this[_0x564d('0x22')][_0x4270b3];if(isCampaignIvr(_0x1ed169[_0x564d('0x4f')])&&isActive(_0x1ed169['active'])){_0x1ed169['sendMessageOneNotActive']=!![];BPromise[_0x564d('0xb4')]()[_0x564d('0x3d')](checkIsActive(_0x1ed169,_0x1ed169[_0x564d('0xd6')]))[_0x564d('0x3d')](checkInterval(_0x1ed169))['then'](_0x2cebfe[_0x564d('0x140')](_0x1ed169))['then'](_0x2cebfe['checkIfTime'](_0x1ed169[_0x564d('0x167')],_0x1ed169[_0x564d('0x169')],_0x1ed169[_0x564d('0x43')],_0x1ed169))[_0x564d('0x3d')](_0x2cebfe['checkIfTimeIntervals'](_0x1ed169[_0x564d('0x45')],_0x1ed169[_0x564d('0x169')],_0x1ed169[_0x564d('0x43')],_0x1ed169))[_0x564d('0x3d')](_0x2cebfe[_0x564d('0x16a')](_0x1ed169))[_0x564d('0xad')](loggerCatchQueueSummary('[syncCampaigns]',_0x1ed169));}else{notSendMessagesCampaign(_0x1ed169);}}}};function getCallerIdRandom(_0x2d31c7,_0x1ad65e){var _0x13ac32;var _0x525929;var _0x3aef85;if(_0x1ad65e<=0x0){_0x1ad65e=0x1;}_0x13ac32=new RegExp(_0x564d('0x16b')+_0x1ad65e+'}$');_0x525929=Math[_0x564d('0x16c')](0xa,_0x1ad65e-0x1);_0x3aef85=Math[_0x564d('0x16c')](0xa,_0x1ad65e)-0x1;return util[_0x564d('0x79')]('%s',_[_0x564d('0x16d')](_0x2d31c7,_0x13ac32,_[_0x564d('0x16e')](_0x525929,_0x3aef85)));}function extractCalleridName(_0x29b982){var _0x17ee1a=_0x29b982['match'](/"(.*?)"/);return _0x17ee1a?_0x17ee1a[0x1]:_0x29b982;}function extractCalleridNumber(_0x42fde6){var _0x158740=_0x42fde6['match'](/<(.*?)>/);return _0x158740?_0x158740[0x1]:_0x42fde6;}Dialer[_0x564d('0x1c')]['actionOriginate']=function(_0x14151d,_0x4c429f){var _0x330d09=this;var _0x516b29=uuid['v4']();this[_0x564d('0x125')][_0x516b29]=new Action(_0x14151d,_0x4c429f,_0x516b29);return new BPromise(function(_0x5d4a76,_0x49eceb){if(_[_0x564d('0x3f')](_0x14151d)&&typeof _0x14151d!=='object'){return _0x49eceb(msgResponse('originate',_0x564d('0x146'),_0x564d('0x16f')));}if(_[_0x564d('0x3f')](_0x4c429f[_0x564d('0x170')][_0x564d('0x171')])||_0x4c429f[_0x564d('0x170')][_0x564d('0x171')]===null){return _0x49eceb(msgResponse(_0x564d('0x172'),_0x564d('0x146'),_0x564d('0x173')));}var _0x413bc8={'XMD-CALLERID':_0x330d09[_0x564d('0x125')][_0x516b29][_0x564d('0x174')](),'XMD-AGI':_0x14151d[_0x564d('0x107')]?util[_0x564d('0x79')](_0x564d('0x175'),ipAgi,_0x14151d[_0x564d('0x107')]):_0x564d('0x176'),'XMD-AGIAFTER':_0x14151d[_0x564d('0x10c')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x14151d[_0x564d('0x10c')]):_0x564d('0x176'),'XMD-QUEUE':_0x14151d[_0x564d('0x4f')]===_0x564d('0x50')?util[_0x564d('0x79')](_0x564d('0x177'),_0x14151d[_0x564d('0x43')],_0x14151d[_0x564d('0x178')]||'',_0x14151d[_0x564d('0x10d')]?'c':'',_0x14151d['dialQueueTimeout']||0x3):_0x564d('0x176'),'XMD-CONTACTID':_0x4c429f[_0x564d('0xce')],'XMD-CDRTYPE':_0x564d('0x7'),'CALLERID(all)':_0x330d09[_0x564d('0x125')][_0x516b29][_0x564d('0x174')](),'XMD-AMD':_0x14151d[_0x564d('0xdf')]?_0x564d('0x179'):_0x564d('0x176'),'XMD-DESTINATION':_0x564d('0xde')};if(_0x14151d[_0x564d('0xdf')]){_0x413bc8[_0x564d('0x17a')]=_0x14151d['dialAMDInitialSilence']||0x9c4;_0x413bc8[_0x564d('0x17b')]=_0x14151d['dialAMDGreeting']||0x5dc;_0x413bc8[_0x564d('0x17c')]=_0x14151d[_0x564d('0x17d')]||0x320;_0x413bc8[_0x564d('0x17e')]=_0x14151d['dialAMDTotalAnalysisTime']||0x1388;_0x413bc8[_0x564d('0x17f')]=_0x14151d[_0x564d('0x180')]||0x64;_0x413bc8['XMD-AMDBETWEENWORDSSILENCE']=_0x14151d['dialAMDBetweenWordsSilence']||0x32;_0x413bc8[_0x564d('0x181')]=_0x14151d[_0x564d('0x182')]||0x3;_0x413bc8[_0x564d('0x183')]=_0x14151d[_0x564d('0x184')]||0x100;_0x413bc8[_0x564d('0x185')]=_0x14151d[_0x564d('0x186')]||0x1388;}if(_0x14151d[_0x564d('0x4f')]===_0x564d('0x50')){_0x413bc8[_0x564d('0x187')]=_0x4c429f[_0x564d('0xd1')];}else{_0x413bc8['XMD-CAMPAIGNID']=_0x4c429f[_0x564d('0xfa')];}for(var _0x123690 in _0x4c429f[_0x564d('0x170')]){if(typeof _0x4c429f[_0x564d('0x170')][_0x123690]!==_0x564d('0x9a')){if(isNotNull(_0x4c429f[_0x564d('0x170')][_0x123690])&&_0x123690!=='id'&&_0x123690!==_0x564d('0x188')&&_0x123690!==_0x564d('0x189')&&_0x123690!=='updatedAt'){_0x413bc8[util[_0x564d('0x79')]('%s%s',_0x564d('0x18a'),_[_0x564d('0x18b')](_0x123690))]=_0x4c429f[_0x564d('0x170')][_0x123690];}}}var _0x2b708d=_0x330d09['isTrunkReachable'](_0x14151d[_0x564d('0x76')])?getCallerId(_0x14151d[_0x564d('0x76')][_0x564d('0x77')],_0x14151d[_0x564d('0x5a')],_0x14151d[_0x564d('0x18c')]>0x0?getCallerIdRandom(_0x14151d['dialOriginateCallerIdNumber'],_0x14151d[_0x564d('0x18c')]):_0x14151d[_0x564d('0x5b')]):getCallerId(_['isNil'](_0x14151d[_0x564d('0x141')])?_0x14151d[_0x564d('0x76')]['callerid']:_0x14151d['TrunkBackup']['callerid'],_0x14151d['dialOriginateCallerIdName'],_0x14151d[_0x564d('0x18c')]>0x0?getCallerIdRandom(_0x14151d['dialOriginateCallerIdNumber'],_0x14151d[_0x564d('0x18c')]):_0x14151d[_0x564d('0x5b')]);if(_0x2b708d){_0x413bc8[_0x564d('0x18d')]=_0x330d09[_0x564d('0x125')][_0x516b29][_0x564d('0x18e')]=extractCalleridName(_0x2b708d);_0x413bc8[_0x564d('0x18f')]=_0x330d09[_0x564d('0x125')][_0x516b29][_0x564d('0x190')]=extractCalleridNumber(_0x2b708d);}return ami[_0x564d('0x14d')]({'actionid':_0x516b29,'action':'originate','channel':_0x330d09[_0x564d('0xd5')](_0x14151d[_0x564d('0x76')])?util[_0x564d('0x79')]('SIP/%s/%s%s',_0x14151d[_0x564d('0x76')]['name'],isNotNull(_0x14151d['dialPrefix'])?_0x14151d[_0x564d('0x5d')][_0x564d('0x191')]()||'':'',_0x14151d[_0x564d('0x192')]>0x0?_0x4c429f[_0x564d('0x170')]['phone']['substring'](_0x14151d[_0x564d('0x192')]):_0x4c429f[_0x564d('0x170')][_0x564d('0x171')]):util[_0x564d('0x79')]('SIP/%s/%s%s',_[_0x564d('0xab')](_0x14151d[_0x564d('0x141')])?_0x14151d[_0x564d('0x76')][_0x564d('0x43')]:_0x14151d[_0x564d('0x141')][_0x564d('0x43')],isNotNull(_0x14151d[_0x564d('0x5d')])?_0x14151d['dialPrefix'][_0x564d('0x191')]()||'':'',_0x14151d[_0x564d('0x192')]>0x0?_0x4c429f['Contact'][_0x564d('0x171')][_0x564d('0x193')](_0x14151d['dialCutDigit']):_0x4c429f[_0x564d('0x170')][_0x564d('0x171')]),'callerid':_0x2b708d,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x413bc8,'timeout':(_0x14151d['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x516b29})[_0x564d('0x3d')](function(_0x368947){return _0x5d4a76(_0x368947);})[_0x564d('0xad')](function(_0x50a17d){_0x14151d[_0x564d('0x65')]+=0x1;var _0x47a40b=new History(_0x330d09['actions'][_0x516b29]);logger['error'](util[_0x564d('0x79')](_0x564d('0x194'),JSON['stringify'](_0x50a17d)));_0x47a40b[_0x564d('0xa8')]=0xe;_0x47a40b[_0x564d('0xa9')]=_0x564d('0x195');_0x47a40b[_0x564d('0x11d')]=moment()[_0x564d('0x79')](_0x564d('0x100'));_0x47a40b[_0x564d('0x11c')]=_0x47a40b['starttime'];_0x330d09[_0x564d('0xc6')](_0x47a40b)['catch'](loggerCatch(_0x564d('0x196')));_0x330d09['moveContactManagedDialer'](_0x47a40b)[_0x564d('0xad')](loggerCatch(_0x564d('0x196')))[_0x564d('0x1f')](function(){delete _0x330d09[_0x564d('0x125')][_0x516b29];return _0x49eceb(msgResponse('originate','Error',_0x564d('0x197')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x2763f8){var _0x5eef1f=this[_0x564d('0x125')][_0x2763f8[_0x564d('0x126')]];if(_0x5eef1f){delete this['actions'][_0x2763f8[_0x564d('0x126')]];_0x5eef1f[_0x564d('0x198')]=moment()[_0x564d('0x79')](_0x564d('0x100'));var _0x15f241=_0x5eef1f[_0x564d('0x4f')]==='ivr'?this[_0x564d('0x22')][_0x5eef1f[_0x564d('0xaf')]]:this[_0x564d('0x21')][_0x5eef1f[_0x564d('0x199')]()];if(!this[_0x564d('0xd3')](_0x2763f8['response'])){this[_0x564d('0xb1')](_0x15f241);return this[_0x564d('0x19a')](_0x5eef1f,_0x15f241,_0x2763f8)[_0x564d('0xad')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x2763f8[_0x564d('0xdb')]]=_0x5eef1f;}};Dialer[_0x564d('0x1c')]['checkRetriveMax']=function(_0xbcb4a2,_0x3ccf98,_0x4cc3ac){var _0x1b6c31=new History(_0x3ccf98);if(_0x1b6c31[_0x564d('0xef')]+_0x1b6c31[_0x564d('0xf0')]+_0x1b6c31[_0x564d('0xf1')]+_0x1b6c31[_0x564d('0xf2')]+_0x1b6c31[_0x564d('0xfc')]+_0x1b6c31['countabandonedretry']+_0x1b6c31['countmachineretry']+_0x1b6c31[_0x564d('0xfd')]>=_0x4cc3ac[_0x564d('0xf4')]-0x1){return!![];}switch(_0xbcb4a2){case 0x3:if(_0x1b6c31[_0x564d('0xf1')]>=_0x4cc3ac[_0x564d('0x19b')]-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countnoanswerretry':_0x1b6c31['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x19c')],_0x564d('0x11a'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31['VoiceQueueId']||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x19d')));break;case 0x5:if(_0x1b6c31[_0x564d('0xef')]>=_0x4cc3ac['dialBusyMaxRetry']-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countbusyretry':_0x1b6c31['countbusyretry']+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x19e')],_0x564d('0x11a'))[_0x564d('0x79')](_0x564d('0x100')),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x19f')));break;case 0x8:if(_0x1b6c31[_0x564d('0xf0')]>=_0x4cc3ac[_0x564d('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x1b6c31[_0x564d('0xf0')]+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x1a1')],_0x564d('0x11a'))['format'](_0x564d('0x100')),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31['CampaignId']||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x1a2')));break;case 0x0:if(_0x1b6c31[_0x564d('0xf2')]>=_0x4cc3ac[_0x564d('0x1a3')]-0x1){return!![];}else{this[_0x564d('0xbc')]({'active':![],'countnosuchnumberretry':_0x1b6c31[_0x564d('0xf2')]+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x1a4')],_0x564d('0x11a'))[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x1a5')));}break;case 0xa:if(_0x1b6c31[_0x564d('0xfc')]>=_0x4cc3ac[_0x564d('0x118')]-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countdropretry':_0x1b6c31['countdropretry']+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x119')],_0x564d('0x11a'))['format'](_0x564d('0x100')),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31['ListId'],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1b6c31['countabandonedretry']>=_0x4cc3ac[_0x564d('0x1a6')]-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countabandonedretry':_0x1b6c31[_0x564d('0xf3')]+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x123')],'minutes')[_0x564d('0x79')](_0x564d('0x100')),'ContactId':_0x1b6c31['ContactId'],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31['CampaignId']||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x124')));break;case 0x13:if(_0x1b6c31['countmachineretry']>=_0x4cc3ac[_0x564d('0xf6')]-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countmachineretry':_0x1b6c31[_0x564d('0xed')]+=0x1,'scheduledat':moment()['add'](_0x4cc3ac[_0x564d('0xf9')],_0x564d('0x11a'))[_0x564d('0x79')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b6c31[_0x564d('0xce')],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x101')));break;case 0x14:if(_0x1b6c31[_0x564d('0xfd')]>=_0x4cc3ac[_0x564d('0x1a7')]-0x1){return!![];}this[_0x564d('0xbc')]({'active':![],'countagentrejectretry':_0x1b6c31[_0x564d('0xfd')]+=0x1,'scheduledat':moment()[_0x564d('0xff')](_0x4cc3ac[_0x564d('0x1a8')],_0x564d('0x11a'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1b6c31['ContactId'],'ListId':_0x1b6c31[_0x564d('0xcf')],'VoiceQueueId':_0x1b6c31[_0x564d('0xd1')]||undefined,'CampaignId':_0x1b6c31[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x1a9')));break;default:return!![];}};Dialer[_0x564d('0x1c')][_0x564d('0x19a')]=function(_0x1d0ae8,_0x368904,_0xe5e7e4){var _0x5d6e39=this;var _0x4db83a=new History(_0x1d0ae8);return new BPromise(function(_0xdcf002,_0x2c779f){if(_['isUndefined'](_0x368904)&&typeof _0x368904!==_0x564d('0x1aa')){return _0x2c779f(msgResponse(_0x564d('0x1ab'),_0x564d('0x146'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0xe5e7e4)&&typeof _0xe5e7e4!==_0x564d('0x1aa')){return _0x2c779f(msgResponse('[callProgressDetecting]',_0x564d('0x146'),'evt\x20is\x20undefine'));}switch(_0xe5e7e4[_0x564d('0x10a')]){case'0':_0x368904['outboundNoSuchCallsDay']+=0x1;_0x4db83a[_0x564d('0xa8')]=0x0;_0x4db83a[_0x564d('0xa9')]='NoSuchNumber';_0x4db83a[_0x564d('0xf2')]+=0x1;_0x4db83a[_0x564d('0x122')]+=0x1;ami[_0x564d('0x4e')](_0x564d('0x1ac'),ut[_0x564d('0xe6')](_0x1d0ae8,'nosuchnumber'));_0x5d6e39['createHistory'](_0x4db83a)[_0x564d('0xad')](loggerCatch(_0x564d('0xee')));if(_0x5d6e39[_0x564d('0x1ad')](0x0,_0x1d0ae8,_0x368904)){if(_0x4db83a[_0x564d('0xf2')]>=_0x368904[_0x564d('0x1a3')]){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1ae'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1ae'));}}break;case'3':_0x368904[_0x564d('0x63')]+=0x1;_0x4db83a['state']=0x3;_0x4db83a[_0x564d('0xa9')]=_0x564d('0x1af');_0x4db83a[_0x564d('0xf1')]+=0x1;_0x4db83a[_0x564d('0x122')]+=0x1;ami[_0x564d('0x4e')](_0x564d('0x1b0'),ut[_0x564d('0xe6')](_0x1d0ae8,_0x564d('0x1b1')));_0x5d6e39[_0x564d('0xc6')](_0x4db83a)[_0x564d('0xad')](loggerCatch(_0x564d('0x1b2')));if(_0x5d6e39[_0x564d('0x1ad')](0x3,_0x1d0ae8,_0x368904)){if(_0x4db83a[_0x564d('0xf1')]>=_0x368904[_0x564d('0x19b')]){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1b3'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x368904[_0x564d('0x5e')]+=0x1;_0x4db83a[_0x564d('0xa8')]=0x5;_0x4db83a[_0x564d('0xa9')]=_0x564d('0x1b4');_0x4db83a[_0x564d('0xef')]+=0x1;_0x4db83a['countglobal']+=0x1;ami[_0x564d('0x4e')]('custom:agentbusy',ut['buildObj'](_0x1d0ae8,_0x564d('0x1b5')));_0x5d6e39['createHistory'](_0x4db83a)[_0x564d('0xad')](loggerCatch(_0x564d('0x1b6')));if(_0x5d6e39['checkRetriveMax'](0x5,_0x1d0ae8,_0x368904)){if(_0x4db83a[_0x564d('0xef')]>=_0x368904[_0x564d('0x1b7')]){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1b8'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1b8'));}}break;case'8':_0x368904[_0x564d('0x5f')]+=0x1;_0x4db83a[_0x564d('0xa8')]=0x8;_0x4db83a[_0x564d('0xa9')]=_0x564d('0x1b9');_0x4db83a[_0x564d('0xf0')]+=0x1;_0x4db83a[_0x564d('0x122')]+=0x1;ami[_0x564d('0x4e')](_0x564d('0x1ba'),ut[_0x564d('0xe6')](_0x1d0ae8,_0x564d('0x1bb')));_0x5d6e39[_0x564d('0xc6')](_0x4db83a)[_0x564d('0xad')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5d6e39['checkRetriveMax'](0x8,_0x1d0ae8,_0x368904)){if(_0x4db83a[_0x564d('0xf0')]>=_0x368904[_0x564d('0x1a0')]){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1bc'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,'reason\x208\x20congestion');}}break;case'11':_0x368904[_0x564d('0x1bd')]+=0x1;_0x4db83a[_0x564d('0xa8')]=0xb;_0x4db83a[_0x564d('0xa9')]=_0x564d('0x120');_0x4db83a[_0x564d('0xf3')]+=0x1;_0x4db83a[_0x564d('0x122')]+=0x1;_0x5d6e39['createHistory'](_0x4db83a)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x5d6e39[_0x564d('0x1ad')](0xb,_0x1d0ae8,_0x368904)){if(_0x4db83a['countabandonedretry']>=_0x368904[_0x564d('0x1a6')]){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1be'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1be'));}}break;case'20':_0x368904['outboundRejectCallsDay']+=0x1;_0x4db83a[_0x564d('0xa8')]=0x14;_0x4db83a[_0x564d('0xa9')]=_0x564d('0x1bf');_0x4db83a[_0x564d('0xfd')]+=0x1;_0x4db83a[_0x564d('0x122')]+=0x1;ami['emit'](_0x564d('0x1c0'),ut[_0x564d('0xe6')](_0x1d0ae8,_0x564d('0x1c1')));_0x5d6e39[_0x564d('0xc6')](_0x4db83a)[_0x564d('0xad')](loggerCatch(_0x564d('0x1c2')));if(_0x5d6e39[_0x564d('0x1ad')](0x14,_0x1d0ae8,_0x368904)){if(_0x4db83a[_0x564d('0xfd')]>=_0x368904['dialAgentRejectMaxRetry']){_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1c3'));}else{_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,_0x564d('0x1c3'));}}break;default:_0x368904['outboundUnknownCallsDay']+=0x1;_0x4db83a[_0x564d('0xa8')]=0xc;_0x4db83a[_0x564d('0xa9')]=_0xe5e7e4[_0x564d('0x10a')];_0x5d6e39[_0x564d('0xc6')](_0x4db83a)[_0x564d('0xad')](loggerCatch(_0x564d('0x1c4')));if(_0x5d6e39[_0x564d('0x1ad')](_0xe5e7e4[_0x564d('0x10a')],_0x1d0ae8,_0x368904)){if(_0x4db83a['countbusyretry']+_0x4db83a[_0x564d('0xf0')]+_0x4db83a[_0x564d('0xf1')]+_0x4db83a['countnosuchnumberretry']+_0x4db83a[_0x564d('0xfc')]+_0x4db83a[_0x564d('0xf3')]+_0x4db83a[_0x564d('0xed')]+_0x4db83a['countagentrejectretry']>=_0x368904['dialGlobalMaxRetry']){_0x5d6e39[_0x564d('0xf5')](_0x4db83a,_0xdcf002,_0x2c779f,_0xe5e7e4[_0x564d('0x10a')]);}else{_0x5d6e39[_0x564d('0xf7')](_0x4db83a,_0xdcf002,_0x2c779f,_0xe5e7e4['reason']);}}}});};Dialer[_0x564d('0x1c')]['stateGlobal']=function(_0x4bb4ac,_0x5974a6,_0x10e90f,_0x3b5472){var _0x406775=new Final(_0x4bb4ac);_0x406775[_0x564d('0xa8')]=0xf;_0x406775[_0x564d('0xa9')]=_0x564d('0x1c5');this['createStateFinal'](_0x406775,_0x5974a6,_0x10e90f,_0x3b5472);};Dialer['prototype'][_0x564d('0xf7')]=function(_0x5e2585,_0x840960,_0x4d63e1,_0x25504d){this[_0x564d('0xc5')](_0x5e2585)[_0x564d('0x3d')](function(){return _0x840960(msgResponse(_0x564d('0x1ab'),_0x564d('0xd4'),_0x25504d));})[_0x564d('0xad')](function(){return _0x4d63e1(msgResponse(_0x564d('0x1c6'),_0x564d('0x146'),_0x564d('0x1c7')));});};Dialer[_0x564d('0x1c')][_0x564d('0x8')]=function(_0x2c880a){var _0x1b3456=_0x2c880a[_0x564d('0x1c8')]/0x64;var _0x58d74c=_0x2c880a[_0x564d('0x62')]/(_0x2c880a[_0x564d('0x62')]+_0x2c880a[_0x564d('0xe0')]);var _0x2f7d49=Math[_0x564d('0x1c9')](_0x2c880a[_0x564d('0x1ca')]*(_0x2c880a[_0x564d('0x1cb')]/0x64));var _0x4e892f=Math[_0x564d('0x1c9')](_0x2c880a[_0x564d('0x1ca')]*(_0x2c880a['predictiveIntervalMinThreshold']/0x64));var _0x35a957=_0x2c880a[_0x564d('0x1cc')]+_0x2c880a[_0x564d('0x56')];var _0x3cdf7a=Math[_0x564d('0x1cd')](_0x2c880a[_0x564d('0x72')]*_0x2c880a[_0x564d('0x73')]*_0x2c880a[_0x564d('0x6e')]*_0x2c880a[_0x564d('0x1ce')]);if(_['isUndefined'](_0x2c880a['startProgressive'])){if(!_[_0x564d('0x3f')](_0x2c880a[_0x564d('0x75')])){_0x2c880a['startPredictive']=undefined;loggerPredictive['error'](_0x564d('0x1cf'),_0x564d('0x1d0'));}if(!_[_0x564d('0x3f')](_0x2c880a[_0x564d('0x92')])){loggerPredictive[_0x564d('0x99')]('[startMethodPredictive][StartProgressive]',_0x564d('0x1d1'));clearInterval(_0x2c880a[_0x564d('0x92')]);_0x2c880a[_0x564d('0x92')]=undefined;}_0x2c880a[_0x564d('0x29')]=moment()['format'](_0x564d('0x100'));loggerPredictive[_0x564d('0x7e')](_0x2c880a['name'],_0x564d('0x1d2'),_0x2c880a[_0x564d('0x29')]);this[_0x564d('0x15d')](_0x2c880a,0x1);}else if(ifInterval(_0x2c880a['dialPredictiveInterval'],_0x2c880a['startProgressive'])){this[_0x564d('0x15d')](_0x2c880a,0x1);loggerPredictiveCalls[_0x564d('0x7e')]('[startMethodPredictive][StartProgressive][Loop]',_0x2c880a[_0x564d('0x29')],_0x2c880a[_0x564d('0x43')]);_0x2c880a[_0x564d('0x72')]=0x0;_0x2c880a[_0x564d('0x113')]=0x0;}else if(_0x1b3456<_0x58d74c&&_0x2c880a[_0x564d('0x1d3')]===_0x564d('0x1d4')){freeVariablesPredictive(_0x2c880a);loggerPredictive[_0x564d('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x564d('0x1d5'),_0x58d74c,_0x564d('0x29'),_0x2c880a['name']);}else if(_0x3cdf7a<_0x2c880a[_0x564d('0x113')]&&_0x2c880a[_0x564d('0x1d3')]===_0x564d('0x1d4')){freeVariablesPredictive(_0x2c880a);loggerPredictive[_0x564d('0x7e')](_0x564d('0x1d6'),_0x564d('0x1d7'),_0x3cdf7a,'Drop\x20in\x20this\x20interval',_0x2c880a['predictiveIntervalErlangCallsDroppedCalls'],_0x564d('0x29'),_0x2c880a[_0x564d('0x43')]);}else if(!ifInterval(_0x2c880a[_0x564d('0x1d8')],_0x2c880a[_0x564d('0x29')])&&_['isUndefined'](_0x2c880a[_0x564d('0x75')])&&!_[_0x564d('0x3f')](_0x2c880a['startProgressive'])){_0x2c880a['startPredictive']=moment()['format'](_0x564d('0x100'));loggerPredictive[_0x564d('0x7e')](_0x2c880a[_0x564d('0x43')],_0x564d('0x1d9'),_0x2c880a[_0x564d('0x75')]);this['averageHandleTime'](_0x2c880a['dialPredictiveInterval'])[_0x564d('0x3d')](this[_0x564d('0x1da')](_0x2c880a))[_0x564d('0x3d')](mergeDataErlangB(_0x2c880a))[_0x564d('0x3d')](this['startMethodPredictive'](_0x2c880a))['catch'](loggerCatchPredictive(_0x564d('0x1db'),_0x2c880a));}else if(!ifInterval(_0x2c880a[_0x564d('0x1d8')],_0x2c880a[_0x564d('0x75')])){_0x2c880a[_0x564d('0x113')]=0x0;_0x2c880a[_0x564d('0x75')]=moment()[_0x564d('0x79')](_0x564d('0x100'));loggerPredictive[_0x564d('0x7e')](_0x2c880a[_0x564d('0x43')],_0x564d('0x1dc'),_0x2c880a['startPredictive']);clearInterval(_0x2c880a[_0x564d('0x92')]);_0x2c880a[_0x564d('0x92')]=undefined;this['averageHandleTime'](_0x2c880a[_0x564d('0x1d8')])[_0x564d('0x3d')](this[_0x564d('0x1da')](_0x2c880a))[_0x564d('0x3d')](mergeDataErlangB(_0x2c880a))[_0x564d('0x3d')](this[_0x564d('0x1dd')](_0x2c880a))['catch'](loggerCatchPredictive(_0x564d('0x1de'),_0x2c880a));}else if(_0x2c880a['predictiveIntervalAvailable']&&_0x35a957<_0x2c880a[_0x564d('0x1ca')]-_0x4e892f){freeVariablesPredictive(_0x2c880a);loggerPredictive[_0x564d('0x7e')](_0x2c880a['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x35a957,_0x564d('0x1df'),_0x2c880a[_0x564d('0x1ca')],'-',_0x4e892f,'=',_0x2c880a[_0x564d('0x1ca')]-_0x4e892f,')');}else if(_0x2c880a['predictiveIntervalAvailable']&&_0x35a957>_0x2c880a[_0x564d('0x1ca')]+_0x2f7d49){freeVariablesPredictive(_0x2c880a);loggerPredictive['info'](_0x2c880a[_0x564d('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x35a957,_0x564d('0x1e0'),_0x2c880a[_0x564d('0x1ca')],'+',_0x2f7d49,'=',_0x2c880a[_0x564d('0x1ca')]+_0x2f7d49,')');}};Dialer[_0x564d('0x1c')]['getDataPredictive']=function(_0x2d6016){var _0x5a0e0f=this;return function(_0x24dfdf){return new BPromise(function(_0x2b5020,_0x31c39e){_[_0x564d('0x8f')](_0x2d6016,_0x24dfdf[0x0]);if(checkGetDataPredictive(_0x24dfdf[0x0])){var _0x322a5b=_0x2d6016[_0x564d('0x1ca')]=_0x2d6016[_0x564d('0x56')]+_0x2d6016[_0x564d('0x1cc')];var _0x29a96d=_0x2d6016[_0x564d('0x1d8')]*0x3c;var _0x563a40=_0x24dfdf[0x0]['predictiveIntervalAvgTalktime']+_0x24dfdf[0x0][_0x564d('0x6a')];var _0x4a0ec1=(_0x24dfdf[0x0][_0x564d('0x69')]+_0x24dfdf[0x0][_0x564d('0x81')]+_0x24dfdf[0x0][_0x564d('0x6c')])/_0x24dfdf[0x0]['predictiveIntervalTotalCalls'];_0x2d6016['predictiveIntervalHitRate']=_0x4a0ec1>0x0?_0x4a0ec1:0x1;switch(_0x2d6016[_0x564d('0x1d3')]){case _0x564d('0x1d4'):var _0xe1980=_0x2d6016[_0x564d('0x1c8')]/0x64;return _0x5a0e0f[_0x564d('0x1e1')](_0x322a5b,_0x29a96d,_0x563a40,_0x4a0ec1,_0xe1980)['then'](function(_0x1c20ff){return _0x2b5020(_0x1c20ff);});case _0x564d('0x1e2'):var _0x5c5a38=_0x2d6016[_0x564d('0x1c8')]/0x64;return _0x5a0e0f['busyFactor'](_0x322a5b,_0x29a96d,_0x563a40,_0x4a0ec1,_0x5c5a38)[_0x564d('0x3d')](function(_0xa5707b){return _0x2b5020(_0xa5707b);});default:return _0x31c39e(msgResponse(_0x564d('0x1e3'),'Failure',_0x564d('0x1e4')));}}else{return _0x31c39e(msgResponse(_0x564d('0x1e3'),_0x564d('0x146'),_0x564d('0x1e5')));}});};};Dialer[_0x564d('0x1c')]['getDataPredictiveOld']=function(_0x4dcce5){var _0x45aa3a=this;return function(_0x4d4e22){return new BPromise(function(_0x42ae75,_0x521260){_[_0x564d('0x8f')](_0x4dcce5,_0x4d4e22[0x0]);if(checkGetDataPredictive(_0x4d4e22[0x0])){loggerPredictive['info'](JSON['stringify'](_0x4d4e22[0x0]));if(_0x4dcce5[_0x564d('0x1d3')]===_0x564d('0x1d4')){return _0x45aa3a[_0x564d('0xc4')](_0x4dcce5['id'])[_0x564d('0x3d')](function(_0x668e45){var _0x1843dd=_0x4dcce5[_0x564d('0x53')]-_0x668e45[0x0][_0x564d('0x1e6')];var _0x234b63=_0x4dcce5['dialPredictiveInterval']*0x3c;var _0x442e58=_0x4d4e22[0x0]['predictiveIntervalAvgTalktime']+_0x4d4e22[0x0][_0x564d('0x6a')];var _0x1a2421=(_0x4d4e22[0x0][_0x564d('0x69')]+_0x4d4e22[0x0][_0x564d('0x81')]+_0x4d4e22[0x0][_0x564d('0x6c')])/_0x4d4e22[0x0]['predictiveIntervalTotalCalls'];var _0x451a7e=_0x4dcce5[_0x564d('0x1c8')]/0x64;_0x4dcce5[_0x564d('0x6f')]=_0x668e45[0x0]['outboundQueuePauses']||0x0;_0x4dcce5['predictiveIntervalHitRate']=_0x1a2421>0x0?_0x1a2421:0x1;return _0x45aa3a[_0x564d('0x1e1')](_0x1843dd,_0x234b63,_0x442e58,_0x1a2421,_0x451a7e);})[_0x564d('0x3d')](function(_0x4d5ff9){return _0x42ae75(_0x4d5ff9);})[_0x564d('0xad')](function(_0x1fa9c7){return _0x521260(msgResponse(_0x564d('0x1e7'),_0x564d('0x146'),JSON[_0x564d('0x135')](_0x1fa9c7)));});}if(_0x4dcce5[_0x564d('0x1d3')]==='agentBusyFactor'){return _0x45aa3a[_0x564d('0xc4')](_0x4dcce5['id'])[_0x564d('0x3d')](function(_0x3db20b){var _0x40dd3a=_0x4dcce5[_0x564d('0x53')]-_0x3db20b[0x0]['outboundQueuePauses'];var _0xf98de=_0x4dcce5[_0x564d('0x1d8')]*0x3c;var _0x4e9997=_0x4d4e22[0x0]['predictiveIntervalAvgTalktime']+_0x4d4e22[0x0][_0x564d('0x6a')];var _0x1a2452=(_0x4d4e22[0x0]['predictiveIntervalAnsweredCalls']+_0x4d4e22[0x0][_0x564d('0x81')]+_0x4d4e22[0x0][_0x564d('0x6c')])/_0x4d4e22[0x0][_0x564d('0x70')];var _0x2c8715=_0x4dcce5[_0x564d('0x1c8')]/0x64;_0x4dcce5['predictiveIntervalPauses']=_0x3db20b[0x0][_0x564d('0x1e6')]||0x0;_0x4dcce5[_0x564d('0x6e')]=_0x1a2452>0x0?_0x1a2452:0x1;return _0x45aa3a[_0x564d('0x1e8')](_0x40dd3a,_0xf98de,_0x4e9997,_0x1a2452,_0x2c8715);})[_0x564d('0x3d')](function(_0x4ed4e2){return _0x42ae75(_0x4ed4e2);})['catch'](function(_0x132c37){return _0x521260(msgResponse(_0x564d('0x1e7'),_0x564d('0x146'),JSON[_0x564d('0x135')](_0x132c37)));});}}else{return _0x521260(msgResponse('[getDataPredictive]','Failure',_0x564d('0x1e5')));}});};};Dialer[_0x564d('0x1c')][_0x564d('0x1dd')]=function(_0x3b02fe){var _0x5392a5=this;return function(){var _0x306b81=0x0;var _0xa5fd99=Math[_0x564d('0x1cd')](_0x3b02fe[_0x564d('0x1e9')]*0x3e8);if(_0xa5fd99>0x0){_0xa5fd99=_0xa5fd99<0x64?0x64:_0xa5fd99;loggerPredictive[_0x564d('0x7e')](_0x3b02fe[_0x564d('0x43')],'one\x20call\x20every:',_0xa5fd99,_0x564d('0x4b'));_0x3b02fe['handlePredictive']=setInterval(function(){_0x5392a5[_0x564d('0x92')](_0x3b02fe);loggerPredictiveCalls[_0x564d('0x7e')](_0x564d('0x1ea'),_0x306b81+=0x1);},_0xa5fd99);}else{loggerPredictive[_0x564d('0x7e')](_0x3b02fe['name'],_0x564d('0x1eb'));}};};Dialer[_0x564d('0x1c')]['checkContactBlack']=function(_0x4316d1,_0x236b28){var _0x365e0e=this;return function(_0x375a1f){if(_['isEmpty'](_0x375a1f)){if(_['isNil'](_0x236b28[_0x564d('0xd0')])||!_0x236b28['recallme']){if(_0x4316d1[_0x564d('0x165')]===_0x564d('0x15e')){_0x4316d1[_0x564d('0x12d')]=_['isUndefined'](_0x4316d1[_0x564d('0x12d')])?!![]:_0x4316d1[_0x564d('0x12d')];var _0xe89137=uuid['v4']();_0x365e0e[_0x564d('0x125')][_0xe89137]=new Action(_0x4316d1,_0x236b28,_0xe89137);loggerBooked[_0x564d('0x7e')](_0x564d('0x1ec'),_0xe89137,_0x564d('0x1ed'),JSON[_0x564d('0x135')](_0x4316d1['queueStatusComplete']),_0x564d('0x1ee'),_0x4316d1['name']);if(_0x4316d1[_0x564d('0x12d')]){_0x4316d1[_0x564d('0x12d')]=![];_0x365e0e['queueBooked'][_0x365e0e['actions'][_0xe89137][_0x564d('0xaf')]]=[];ami['Action']({'actionid':_0xe89137,'action':_0x564d('0x1ef'),'queue':_0x4316d1[_0x564d('0x43')]})[_0x564d('0xad')](function(){_0x365e0e[_0x564d('0xb1')](_0x4316d1);_0x365e0e[_0x564d('0xbc')]({'active':![],'ContactId':_0x365e0e[_0x564d('0x125')][_0xe89137]['ContactId'],'ListId':_0x365e0e[_0x564d('0x125')][_0xe89137]['ListId'],'VoiceQueueId':_0x365e0e[_0x564d('0x125')][_0xe89137][_0x564d('0xd1')]||undefined,'CampaignId':_0x365e0e[_0x564d('0x125')][_0xe89137][_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x1f0')));delete _0x365e0e['actions'][_0xe89137];});}else{loggerBooked['info'](_0x564d('0x1f1'),JSON['stringify'](_0x4316d1[_0x564d('0x12d')]),_0x564d('0x1ee'),_0x4316d1[_0x564d('0x43')]);_0x365e0e['updateOriginated'](_0x4316d1);_0x365e0e[_0x564d('0xbc')]({'active':![],'ContactId':_0x365e0e['actions'][_0xe89137][_0x564d('0xce')],'ListId':_0x365e0e[_0x564d('0x125')][_0xe89137][_0x564d('0xcf')],'VoiceQueueId':_0x365e0e[_0x564d('0x125')][_0xe89137]['VoiceQueueId']||undefined,'CampaignId':_0x365e0e[_0x564d('0x125')][_0xe89137][_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x365e0e[_0x564d('0x125')][_0xe89137];}}else{return _0x365e0e[_0x564d('0x1f2')](_0x4316d1,_0x236b28);}}else{if(getDiff(_0x236b28[_0x564d('0x1f3')])<_0x4316d1['dialRecallMeTimeout']*0x3c){if(_0x236b28[_0x564d('0x1f4')]&&!_0x236b28['Agent'][_0x564d('0x1f5')]){_0x365e0e[_0x564d('0x94')][_0x564d('0x12f')](_0x236b28['id'])[_0x564d('0x1f')](function(){_0x365e0e[_0x564d('0xb1')](_0x4316d1);});}else{_0x365e0e[_0x564d('0xbe')]({'active':![]},_0x236b28['id'],0x1)[_0x564d('0x1f')](function(){_0x365e0e[_0x564d('0xb1')](_0x4316d1);});}}else{_0x4316d1['outboundReCallsDay']+=0x1;_0x365e0e[_0x564d('0xb1')](_0x4316d1);if(_0x4316d1[_0x564d('0x1f6')]){_0x365e0e[_0x564d('0xbc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x236b28[_0x564d('0xce')],'ListId':_0x236b28[_0x564d('0xcf')],'VoiceQueueId':_0x236b28[_0x564d('0xd1')]||undefined,'CampaignId':_0x236b28[_0x564d('0xfa')]||undefined})[_0x564d('0xad')](loggerCatch(_0x564d('0x1f7')));_0x365e0e[_0x564d('0xc6')](createObjHistory(_0x4316d1,_0x236b28,_0x564d('0x1f8'),0x17,_0x564d('0x1f9')))[_0x564d('0xad')](loggerCatch(_0x564d('0x1fa')));}else{_0x365e0e[_0x564d('0xcc')](createObjHistory(_0x4316d1,_0x236b28,'RECALLFAILEDTIMEOUT',0x16,_0x564d('0x1fb')),_0x564d('0x1fc'),_0x564d('0x1fd'));}}}}else{_0x4316d1[_0x564d('0x1fe')]+=0x1;_0x365e0e['saveInDb'](createObjHistory(_0x4316d1,_0x236b28,_0x564d('0x1ff'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x564d('0x200'));throw _0x564d('0x201');}};};Dialer['prototype']['handleIvr']=function(_0x144ffb){var _0x134b76=this;var _0x28be93=_0x144ffb[_0x564d('0x202')]-_0x144ffb[_0x564d('0x71')]-_0x144ffb[_0x564d('0xc1')];emitCampaignSummary(_0x144ffb);if(_0x28be93>0x0){if(_0x28be93>this[_0x564d('0x25')]){_0x28be93=this[_0x564d('0x25')];}_0x144ffb[_0x564d('0xc1')]+=_0x28be93;this[_0x564d('0xc3')](_0x144ffb['id'],_0x28be93,_0x144ffb['dialOrderByScheduledAt'],_0x144ffb)[_0x564d('0x3d')](function(_0x5518f8){_0x144ffb['temp']-=_0x28be93;_0x144ffb[_0x564d('0xc1')]=_0x144ffb[_0x564d('0xc1')]>0x0?_0x144ffb[_0x564d('0xc1')]:0x0;if(!checkContactEmpty(_0x5518f8)){_0x144ffb[_0x564d('0x41')]=_0x564d('0xa0');logger['info']('[getContactCampaign2][Empty]'+_0x144ffb[_0x564d('0x43')]);}else{_0x144ffb[_0x564d('0x71')]+=_0x5518f8[_0x564d('0x132')];_0x144ffb[_0x564d('0x41')]=_0x564d('0x203');for(var _0x5b2519=0x0;_0x5b2519<_0x5518f8['length'];_0x5b2519+=0x1){_0x144ffb[_0x564d('0x204')]+=0x1;if(_[_0x564d('0xab')](_0x5518f8[_0x5b2519])||_[_0x564d('0xab')](_0x5518f8[_0x5b2519][_0x564d('0x170')])||_[_0x564d('0xab')](_0x5518f8[_0x5b2519][_0x564d('0x170')][_0x564d('0x171')])){_0x134b76[_0x564d('0x205')](_0x564d('0x206'),_0x144ffb,_0x5518f8[_0x5b2519]);}else{_0x134b76['checkIsBlackListIvr'](_[_0x564d('0xcd')](_0x5518f8[_0x5b2519],[_0x564d('0xfa'),'Contact.phone']))[_0x564d('0x3d')](_0x134b76[_0x564d('0x207')](_0x144ffb,_0x5518f8[_0x5b2519]))[_0x564d('0xad')](_0x134b76['loggerHandler'](_0x564d('0x208'),_0x144ffb));}}}})['catch'](loggerGetContactDialer(_0x564d('0x209'),_0x144ffb,_0x28be93));}};Dialer[_0x564d('0x1c')][_0x564d('0x15d')]=function(_0x41f964,_0x956911){var _0x3257c=this;var _0x55bb5e=[];var _0x11904e=_0x956911>=0x1?_0x956911:0x1;if(_0x41f964[_0x564d('0x165')]===_0x564d('0x15e')){_0x11904e=0x1;}var _0x45ebf8=Math['floor'](_0x41f964[_0x564d('0x1cc')]*_0x11904e)-_0x41f964[_0x564d('0x71')]-_0x41f964[_0x564d('0xc1')];emitVoiceQueueSummary(_0x41f964);if(_0x41f964[_0x564d('0x20a')]>0x0){var _0x507ef4=_0x41f964[_0x564d('0x20a')]-_0x41f964['originated']-_0x41f964[_0x564d('0x56')]-_0x41f964[_0x564d('0xc1')]-_0x41f964[_0x564d('0x54')];if(_0x45ebf8>_0x507ef4){_0x45ebf8=_0x507ef4;}}if(_0x45ebf8>0x0){if(_0x41f964[_0x564d('0x165')]===_0x564d('0x15e')){_0x45ebf8=0x1;}if(_0x45ebf8>this[_0x564d('0x25')]){_0x45ebf8=this[_0x564d('0x25')];}_0x41f964[_0x564d('0xc1')]+=_0x45ebf8;for(var _0x2e0634 in this[_0x564d('0x23')]){if(typeof this[_0x564d('0x23')][_0x2e0634]!==_0x564d('0x9a')){if(this[_0x564d('0x23')][_0x2e0634][_0x564d('0xa8')]===_0x564d('0x20b')&&this['agents'][_0x2e0634][_0x564d('0xd8')]===_0x564d('0x20c')){_0x55bb5e[_0x564d('0x12a')](this[_0x564d('0x23')][_0x2e0634]['id']);}}}this[_0x564d('0xc0')](_0x41f964['id'],_0x55bb5e,_0x45ebf8,_0x41f964[_0x564d('0x20d')],_0x41f964)[_0x564d('0x3d')](function(_0x43de72){_0x41f964['temp']-=_0x45ebf8;_0x41f964[_0x564d('0xc1')]=_0x41f964[_0x564d('0xc1')]>0x0?_0x41f964[_0x564d('0xc1')]:0x0;if(!checkContactEmpty(_0x43de72)){_0x3257c['countReScheduled'](_0x41f964)[_0x564d('0x3d')](sendMessageReschedule(_0x41f964))[_0x564d('0xad')](loggerCatch(_0x564d('0xb5')));}else{_0x41f964[_0x564d('0x71')]+=_0x43de72[_0x564d('0x132')];_0x41f964[_0x564d('0x41')]=_0x41f964[_0x564d('0x165')]===_0x564d('0x15e')?_0x564d('0x179'):_0x564d('0x203');for(var _0x2d47ef=0x0;_0x2d47ef<_0x43de72['length'];_0x2d47ef+=0x1){if(_[_0x564d('0xab')](_0x43de72[_0x2d47ef])||_[_0x564d('0xab')](_0x43de72[_0x2d47ef][_0x564d('0x170')])||_['isNil'](_0x43de72[_0x2d47ef][_0x564d('0x170')][_0x564d('0x171')])){_0x3257c[_0x564d('0x205')](_0x564d('0x206'),_0x41f964,_0x43de72[_0x2d47ef]);}else{_0x3257c[_0x564d('0xb6')](_[_0x564d('0xcd')](_0x43de72[_0x2d47ef],[_0x564d('0xd1'),'Contact.phone']))[_0x564d('0x3d')](_0x3257c[_0x564d('0x207')](_0x41f964,_0x43de72[_0x2d47ef]))[_0x564d('0xad')](_0x3257c[_0x564d('0xca')](_0x564d('0x206'),_0x41f964));}}}})[_0x564d('0xad')](loggerGetContactDialer(_0x564d('0x20e'),_0x41f964,_0x45ebf8));}};Dialer[_0x564d('0x1c')][_0x564d('0x92')]=function(_0x1ec2e0){if(_0x1ec2e0['dialLimitQueue']>0x0){var _0x3d179d=_0x1ec2e0[_0x564d('0x20a')]-_0x1ec2e0[_0x564d('0x71')]-_0x1ec2e0[_0x564d('0x56')];if(_0x3d179d>0x0){this['tryOriginatePredictive'](_0x1ec2e0);}else{loggerPredictiveCalls[_0x564d('0x7e')](_0x564d('0x20f'));}}else{this[_0x564d('0x210')](_0x1ec2e0);}};Dialer[_0x564d('0x1c')]['tryOriginatePredictive']=function(_0x27d28d){var _0x40ee91=this;var _0x5ee45c=[];_0x27d28d[_0x564d('0x71')]+=0x1;for(var _0x1891a5 in this[_0x564d('0x23')]){if(typeof this[_0x564d('0x23')][_0x1891a5]!==_0x564d('0x9a')){if(this[_0x564d('0x23')][_0x1891a5][_0x564d('0xa8')]==='not_inuse'&&this['agents'][_0x1891a5][_0x564d('0xd8')]===_0x564d('0x20c')){_0x5ee45c[_0x564d('0x12a')](this['agents'][_0x1891a5]['id']);}}}this[_0x564d('0xc0')](_0x27d28d['id'],_0x5ee45c,0x1,_0x27d28d[_0x564d('0x20d')],_0x27d28d)[_0x564d('0x3d')](function(_0x4445ae){if(!checkContactEmpty(_0x4445ae)){checkContactLowerLimitOriginate(_0x27d28d,0x1,0x0);_0x40ee91['countReScheduled'](_0x27d28d)['then'](sendMessageReschedule(_0x27d28d))[_0x564d('0xad')](loggerCatch('[countReScheduled]\x20'));}else{_0x27d28d[_0x564d('0x41')]=_0x564d('0x203');if(_[_0x564d('0xab')](_0x4445ae[0x0])||_[_0x564d('0xab')](_0x4445ae[0x0][_0x564d('0x170')])||_[_0x564d('0xab')](_0x4445ae[0x0]['Contact']['phone'])){_0x40ee91['emptyContact']('[actionOriginate]\x20',_0x27d28d,_0x4445ae[0x0]);}else{_0x40ee91[_0x564d('0xb6')](_[_0x564d('0xcd')](_0x4445ae[0x0],[_0x564d('0xd1'),_0x564d('0x211')]))[_0x564d('0x3d')](_0x40ee91[_0x564d('0x207')](_0x27d28d,_0x4445ae[0x0]))['catch'](_0x40ee91[_0x564d('0xca')](_0x564d('0x212'),_0x27d28d));}}})[_0x564d('0xad')](loggerGetContactDialer(_0x564d('0x213'),_0x27d28d,0x1));emitVoiceQueueSummary(_0x27d28d);};Dialer[_0x564d('0x1c')][_0x564d('0x1e1')]=function(_0xfd9c20,_0x48f8ae,_0x348227,_0x27cbe0,_0x333950,_0x973f92){loggerPredictive[_0x564d('0x7e')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x564d('0x214'),_0xfd9c20);loggerPredictive['info'](_0x564d('0x215'),_0x48f8ae);loggerPredictive[_0x564d('0x7e')](_0x564d('0x216'),_0x348227);loggerPredictive['info'](_0x564d('0x217'),_0x27cbe0);loggerPredictive[_0x564d('0x7e')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x333950);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8e'));return new BPromise(function(_0x2253aa,_0x30ce49){if(_0xfd9c20<=0x0||isNaN(_0xfd9c20)){return _0x30ce49(msgResponse(_0x564d('0x218'),_0x564d('0x219'),_0x564d('0x21a')+_0xfd9c20));}if(_0x348227<=0x0||isNaN(_0x348227)){return _0x30ce49(msgResponse('[abandonmentRate]',_0x564d('0x219'),'Ts\x20=\x20'+_0x348227));}if(_0x27cbe0<=0x0||isNaN(_0x27cbe0)){return _0x30ce49(msgResponse(_0x564d('0x218'),'Error',_0x564d('0x21b')+_0x27cbe0));}if(_0x48f8ae<=0x0||isNaN(_0x48f8ae)){return _0x30ce49(msgResponse(_0x564d('0x218'),_0x564d('0x219'),_0x564d('0x21c')+_0x48f8ae));}if(_0x333950<=0x0||isNaN(_0x333950)){return _0x30ce49(msgResponse(_0x564d('0x218'),_0x564d('0x219'),'Amax\x20=\x20'+_0x333950));}_0x973f92=_0x973f92||0x0;var _0x3deb91=0x1/_0x348227;var _0xadc48d=0x0;var _0x329bfe=0x0;var _0x52b501=0x0;var _0x3b739d=0x0;for(var _0x25304c=0x0;_0x52b501<_0x333950;_0x25304c+=0x1){_0x329bfe=_0x25304c/_0x48f8ae;_0xadc48d=(_0x27cbe0*_0x329bfe+_0x973f92)/_0x3deb91;_0x52b501=erlangb(_0xadc48d,_0xfd9c20);_0x3b739d=_0xadc48d/_0xfd9c20*(0x1-erlangb(_0xadc48d,_0xfd9c20));}return _0x2253aa({'erlangCalls':_0x25304c,'erlangCallToSecond':_0x48f8ae/_0x25304c,'erlangAbandonmentRate':_0x52b501,'erlangBusyFactor':_0x3b739d});});};Dialer[_0x564d('0x1c')]['busyFactor']=function(_0x484df2,_0x131f95,_0x2bb0cb,_0x36a549,_0x172096,_0x5876fa){loggerPredictive[_0x564d('0x7e')](_0x564d('0x21d'));loggerPredictive[_0x564d('0x7e')]('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',_0x484df2);loggerPredictive[_0x564d('0x7e')](_0x564d('0x215'),_0x131f95);loggerPredictive[_0x564d('0x7e')](_0x564d('0x216'),_0x2bb0cb);loggerPredictive[_0x564d('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',_0x36a549);loggerPredictive[_0x564d('0x7e')](_0x564d('0x21e'),_0x172096);loggerPredictive[_0x564d('0x7e')](_0x564d('0x8e'));return new BPromise(function(_0x3e374e,_0x5c05b3){if(_0x484df2<=0x0||isNaN(_0x484df2)){return _0x5c05b3(msgResponse(_0x564d('0x21f'),_0x564d('0x219'),_0x564d('0x21a')+_0x484df2));}if(_0x2bb0cb<=0x0||isNaN(_0x2bb0cb)){return _0x5c05b3(msgResponse('[busyFactor]',_0x564d('0x219'),_0x564d('0x220')+_0x2bb0cb));}if(_0x36a549<=0x0||isNaN(_0x36a549)){return _0x5c05b3(msgResponse('[busyFactor]',_0x564d('0x219'),_0x564d('0x21b')+_0x36a549));}if(_0x131f95<=0x0||isNaN(_0x131f95)){return _0x5c05b3(msgResponse(_0x564d('0x21f'),_0x564d('0x219'),'interval\x20=\x20'+_0x131f95));}if(_0x172096<=0x0||isNaN(_0x172096)){return _0x5c05b3(msgResponse('[busyFactor]','Error',_0x564d('0x221')+_0x172096));}_0x5876fa=_0x5876fa||0x0;var _0xd58816=0x1/_0x2bb0cb;var _0xb478b0=0x0;var _0x41e52b=0x0;var _0x390dd0=0x0;var _0xa57092=0x0;for(var _0x68513a=0x0;_0xa57092<_0x172096;_0x68513a+=0x1){_0x41e52b=_0x68513a/_0x131f95;_0xb478b0=(_0x36a549*_0x41e52b+_0x5876fa)/_0xd58816;_0x390dd0=erlangb(_0xb478b0,_0x484df2);_0xa57092=_0xb478b0/_0x484df2*(0x1-erlangb(_0xb478b0,_0x484df2));}return _0x3e374e({'erlangCalls':_0x68513a,'erlangCallToSecond':_0x131f95/_0x68513a,'erlangAbandonmentRate':_0x390dd0,'erlangBusyFactor':_0xa57092});});};module[_0x564d('0x222')]=Dialer; \ No newline at end of file +var _0xfa8e=['pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCalls','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','seconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','starttime','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','undefined','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','[Dialer][checkChannel]','queue','updateOriginated','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','ListId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','unmonitored','moveContactManagedDialer','uniqueid','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','emit','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','membername','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','VoiceQueueId','CampaignId','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','AMD','countglobal','reason19\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','[syncHangupIvr]','outboundUnknownCallsDay','cause-txt','Unknow','reason','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','agiafterat','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','actionid','roundrobin','locked','paused','stateinterface','agents','queueBooked','push','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','run','contactAgent-idHopper:\x20','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','true','command','timezones','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','dialActive','dialGlobalInterval','dialTimezone','checkDialMethod','dialPreviewRecallmeReminder','\x5cw{0,','pow','replace','random','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','getCaller','NONE','outbound','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','endtime','[originate][error]','getQueue','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','nosuchnumber','[syncAgentComplete][createHistory][0]','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','[getContactCampaign2][Empty]','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','ACTIVE','RUNNING','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Umin\x20=\x20','exports','util','lodash','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','prototype','tail','finally','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','uniqueId','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','strategy','available','loggedIn'];(function(_0x4cb695,_0x5689f3){var _0x2ca20a=function(_0xfe833a){while(--_0xfe833a){_0x4cb695['push'](_0x4cb695['shift']());}};_0x2ca20a(++_0x5689f3);}(_0xfa8e,0x1ca));var _0xefa8=function(_0x5beb61,_0x4b1c65){_0x5beb61=_0x5beb61-0x0;var _0x1da73c=_0xfa8e[_0x5beb61];return _0x1da73c;};'use strict';var util=require(_0xefa8('0x0'));var _=require(_0xefa8('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xefa8('0x2'));var rr=require('rr');var md5=require(_0xefa8('0x3'));var Redis=require('ioredis');var ut=require(_0xefa8('0x4'));var config=require(_0xefa8('0x5'));var logger=require(_0xefa8('0x6'))(_0xefa8('0x7'));var loggerBooked=require(_0xefa8('0x6'))(_0xefa8('0x8'));var loggerPredictive=require(_0xefa8('0x6'))(_0xefa8('0x9'));var loggerPredictiveCalls=require(_0xefa8('0x6'))(_0xefa8('0xa'));var loggerSyncQueueSummary=require(_0xefa8('0x6'))(_0xefa8('0xb'));var ami=require(_0xefa8('0xc'));config['redis']=_[_0xefa8('0xd')](config[_0xefa8('0xe')],{'host':_0xefa8('0xf'),'port':0x18eb});var io=require(_0xefa8('0x10'))(new Redis(config[_0xefa8('0xe')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xefa8('0x11'));var cmHopperBlack=require(_0xefa8('0x12'));var voiceQueueRt=require(_0xefa8('0x13'));var RpcSetting=require(_0xefa8('0x14'));var Action=require(_0xefa8('0x15'));var History=require(_0xefa8('0x16'));var Final=require('./final');var AgentComplete=require(_0xefa8('0x17'));var QueueCallerAbandon=require(_0xefa8('0x18'));var Hangup=require(_0xefa8('0x19'));var ipAgi=process[_0xefa8('0x1a')][_0xefa8('0x1b')]||_0xefa8('0x1c');var strategy={'rrmemory':_0xefa8('0x1d'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xefa8('0x1e')]['enqueue']=function(_0x2a9a4d){this[_0xefa8('0x1f')]=this[_0xefa8('0x1f')]?this[_0xefa8('0x1f')][_0xefa8('0x20')](_0x2a9a4d):_0x2a9a4d();};function Dialer(_0x1b2ac3,_0x464a21){this['sequence']=new Sequence();this[_0xefa8('0x21')]=_0x464a21;this['voiceQueues']=_0x1b2ac3[_0xefa8('0x22')];this[_0xefa8('0x23')]=_0x1b2ac3['campaigns'];this['agents']=_0x1b2ac3['agents'];this[_0xefa8('0x24')]=_0x1b2ac3[_0xefa8('0x24')];this[_0xefa8('0x25')]=config[_0xefa8('0x25')]||0x2;this['channels']={};this[_0xefa8('0x26')]={};this['contactsId']={};this[_0xefa8('0x27')]={};this['optionPredictive']={};this[_0xefa8('0x28')]={};this['startProgressive']={};this[_0xefa8('0x29')]={};this['queueBooked']={};this[_0xefa8('0x2a')]={};ami['on'](_0xefa8('0x2b'),this[_0xefa8('0x2c')][_0xefa8('0x2d')](this));ami['on']('queuecallerabandon',this[_0xefa8('0x2e')][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x2f'),this[_0xefa8('0x30')]['bind'](this));ami['on']('agentcomplete',this[_0xefa8('0x31')][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x32'),this['syncQueueSummary'][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x33'),this[_0xefa8('0x34')][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x35'),this[_0xefa8('0x36')]['bind'](this));ami['on'](_0xefa8('0x37'),this[_0xefa8('0x38')][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x39'),this[_0xefa8('0x3a')][_0xefa8('0x2d')](this));ami['on'](_0xefa8('0x3b'),this[_0xefa8('0x3c')][_0xefa8('0x2d')](this));this[_0xefa8('0x3d')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0xefa8('0x3e')](function(_0x278298){previewRecallmeReminderInterval=_0x278298[_0xefa8('0x3f')];});}function isNotNull(_0x512bf5){return _0x512bf5!==null&&!_[_0xefa8('0x40')](_0x512bf5);}function checkIsLoggedIn(_0x5d209d,_0x5e04ca){return function(){if(_0x5e04ca<=0x0){_0x5d209d[_0xefa8('0x41')]=_0xefa8('0x42');throw _0x5d209d[_0xefa8('0x43')]+_0xefa8('0x44');}};}function isActive(_0x208590){return _0x208590;}function checkIsActive(_0x48c500,_0x44d381){return function(){if(!isActive(_0x44d381)){_0x48c500[_0xefa8('0x41')]=_0xefa8('0x45');throw _0x48c500[_0xefa8('0x43')]+_0xefa8('0x46');}};}function checkInterval(_0x20f185){return function(){if(!isNotNull(_0x20f185[_0xefa8('0x47')])){_0x20f185[_0xefa8('0x41')]=_0xefa8('0x48');throw _0x20f185[_0xefa8('0x43')]+_0xefa8('0x49');}if(!isNotNull(_0x20f185['Interval'][_0xefa8('0x4a')])){_0x20f185[_0xefa8('0x41')]=_0xefa8('0x48');throw _0x20f185['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xefa8('0x4b')](_0x20f185[_0xefa8('0x47')]['Intervals']))){_0x20f185[_0xefa8('0x41')]=_0xefa8('0x48');throw _0x20f185[_0xefa8('0x43')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x140a0c,_0x18b256,_0xee6457){return{'action':_0x140a0c,'response':_0x18b256,'message':_0xee6457,'stack':_0xee6457};}function myreject(_0x4e8ede){return function(_0x36e3c4){return _0x4e8ede(msgResponse(_0xefa8('0x4c'),_0xefa8('0x4d'),JSON[_0xefa8('0x4e')](_0x36e3c4)));};}function getSeconds(_0x5e892d,_0xa04152){var _0x346198=moment(_0x5e892d)[_0xefa8('0x4f')](0x0);var _0x3e9513=moment(_0xa04152)[_0xefa8('0x4f')](0x0);return _0x346198[_0xefa8('0x50')](_0x3e9513,'seconds');}function emit(_0x30a011,_0x452dd1,_0x28a0f7){io['to'](_0x30a011)['emit'](_0x452dd1,_0x28a0f7);}function emitVoiceQueueSummary(_0x4ee6cf){if(_0x4ee6cf['type']==='outbound'){var _0x18313a={'id':_0x4ee6cf['id'],'name':_0x4ee6cf['name'],'strategy':_0x4ee6cf[_0xefa8('0x51')],'answered':_0x4ee6cf['answered'],'available':_0x4ee6cf[_0xefa8('0x52')],'loggedIn':_0x4ee6cf[_0xefa8('0x53')],'pTalking':_0x4ee6cf[_0xefa8('0x54')],'sumBillable':_0x4ee6cf['sumBillable'],'sumDuration':_0x4ee6cf[_0xefa8('0x55')],'sumHoldTime':_0x4ee6cf[_0xefa8('0x56')]||0x0,'talking':_0x4ee6cf[_0xefa8('0x57')],'total':_0x4ee6cf[_0xefa8('0x58')],'type':_0x4ee6cf[_0xefa8('0x59')],'unmanaged':_0x4ee6cf[_0xefa8('0x5a')],'abandoned':_0x4ee6cf[_0xefa8('0x5b')],'waiting':_0x4ee6cf[_0xefa8('0x5c')],'loggedInDb':_0x4ee6cf[_0xefa8('0x5d')],'dialActive':_0x4ee6cf['dialActive'],'dialMethod':_0x4ee6cf[_0xefa8('0x5e')],'dialOriginateCallerIdName':_0x4ee6cf['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x4ee6cf['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x4ee6cf[_0xefa8('0x5f')],'dialPrefix':_0x4ee6cf[_0xefa8('0x60')],'outboundAnswerAgiCallsDay':_0x4ee6cf[_0xefa8('0x61')],'outboundAnswerCallsDay':_0x4ee6cf[_0xefa8('0x62')],'outboundBlacklistCallsDay':_0x4ee6cf[_0xefa8('0x63')],'outboundBusyCallsDay':_0x4ee6cf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4ee6cf[_0xefa8('0x64')],'outboundDropCallsDayACS':_0x4ee6cf['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4ee6cf[_0xefa8('0x65')],'outboundDropCallsDayTimeout':_0x4ee6cf['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4ee6cf[_0xefa8('0x66')],'outboundNoSuchCallsDay':_0x4ee6cf[_0xefa8('0x67')],'outboundOriginateFailureCallsDay':_0x4ee6cf['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4ee6cf[_0xefa8('0x68')],'outboundRejectCallsDay':_0x4ee6cf[_0xefa8('0x69')],'outboundUnknownCallsDay':_0x4ee6cf['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4ee6cf[_0xefa8('0x6a')],'predictiveIntervalAvgHoldtime':_0x4ee6cf[_0xefa8('0x6b')],'predictiveIntervalAvgTalktime':_0x4ee6cf[_0xefa8('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x4ee6cf['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4ee6cf['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4ee6cf[_0xefa8('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x4ee6cf['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x4ee6cf['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x4ee6cf['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4ee6cf['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4ee6cf[_0xefa8('0x6e')],'predictiveIntervalTotalCalls':_0x4ee6cf[_0xefa8('0x6f')],'message':_0x4ee6cf[_0xefa8('0x41')],'originated':_0x4ee6cf[_0xefa8('0x70')],'erlangCalls':_0x4ee6cf[_0xefa8('0x71')],'erlangCallToSecond':_0x4ee6cf['erlangCallToSecond'],'erlangAbandonmentRate':_0x4ee6cf['erlangAbandonmentRate'],'erlangBusyFactor':_0x4ee6cf[_0xefa8('0x72')],'startPredictive':_0x4ee6cf[_0xefa8('0x28')],'startProgressive':_0x4ee6cf[_0xefa8('0x73')]};if(_0x4ee6cf[_0xefa8('0x74')]){_0x18313a[_0xefa8('0x74')]={'id':_0x4ee6cf[_0xefa8('0x74')]['id'],'name':_0x4ee6cf[_0xefa8('0x74')][_0xefa8('0x43')],'active':_0x4ee6cf[_0xefa8('0x74')][_0xefa8('0x75')],'callerid':_0x4ee6cf[_0xefa8('0x74')][_0xefa8('0x76')]};}if(_0x4ee6cf[_0xefa8('0x47')]){_0x18313a[_0xefa8('0x47')]={'id':_0x4ee6cf[_0xefa8('0x47')]['id'],'name':_0x4ee6cf[_0xefa8('0x47')]['name']};}var _0x46287d=md5(JSON[_0xefa8('0x4e')](_0x18313a));if(_0x4ee6cf['md5']!==_0x46287d){_0x4ee6cf['md5']=_0x46287d;emit(util[_0xefa8('0x77')](_0xefa8('0x78'),_0x18313a['name']),'voice_queue:save',_0x18313a);}}}function emitCampaignSummary(_0x1e48f5){if(_0x1e48f5[_0xefa8('0x59')]===_0xefa8('0x79')){emit(util[_0xefa8('0x77')]('campaign:ivr:%s',_0x1e48f5[_0xefa8('0x43')]),_0xefa8('0x7a'),_0x1e48f5);}}function checkGetDataPredictive(_0x1c46e0){if(isNotNull(_0x1c46e0)&&!_[_0xefa8('0x4b')](_0x1c46e0)){loggerPredictive['info'](_0xefa8('0x7b'));loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x7d'),_0x1c46e0[_0xefa8('0x6f')]);loggerPredictive[_0xefa8('0x7c')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c46e0[_0xefa8('0x6a')]);loggerPredictive['info'](_0xefa8('0x7e'),_0x1c46e0[_0xefa8('0x7f')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c46e0[_0xefa8('0x80')]);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x81'),_0x1c46e0[_0xefa8('0x6b')]);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x82'),_0x1c46e0[_0xefa8('0x6c')]);loggerPredictive['info'](_0xefa8('0x83'));if(_0x1c46e0[_0xefa8('0x6f')]>0x0){if(!_[_0xefa8('0x40')](_0x1c46e0[_0xefa8('0x6c')])&&_0x1c46e0['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xefa8('0x7c')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xefa8('0x40')](_0x1c46e0[_0xefa8('0x6b')])&&_0x1c46e0[_0xefa8('0x6b')]>0x0){return!![];}loggerPredictive[_0xefa8('0x7c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x84'));}}else{loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x85'));}return![];}function mergeDataErlangB(_0x5d7295){return function(_0x1cbd44){loggerPredictive['info'](_0xefa8('0x86'));loggerPredictive[_0xefa8('0x7c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cbd44[_0xefa8('0x71')]);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x87'),_0x1cbd44[_0xefa8('0x88')]);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x89'),_0x1cbd44[_0xefa8('0x8a')]);loggerPredictive[_0xefa8('0x7c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1cbd44[_0xefa8('0x72')]);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x89'),_0x1cbd44[_0xefa8('0x8a')]);loggerPredictive['info'](_0xefa8('0x83'));_[_0xefa8('0x8b')](_0x5d7295,_0x1cbd44);};}function getDiff(_0x2d9166){var _0x221bf8=moment()[_0xefa8('0x4f')](0x0);var _0x3469be=moment(_0x2d9166)[_0xefa8('0x4f')](0x0);return _0x221bf8['diff'](_0x3469be,_0xefa8('0x8c'));}function ifInterval(_0x33c4a5,_0x447546){if(_['isUndefined'](_0x447546)){return![];}return getDiff(_0x447546)<_0x33c4a5*0x3c;}function freeVariablesPredictive(_0xc90c4c){if(isNotNull(_0xc90c4c)){if(!_['isUndefined'](_0xc90c4c['startProgressive'])){_0xc90c4c[_0xefa8('0x73')]=undefined;loggerPredictive[_0xefa8('0x7c')](_0xc90c4c[_0xefa8('0x43')],_0xefa8('0x8d'));}if(!_['isUndefined'](_0xc90c4c[_0xefa8('0x28')])){_0xc90c4c[_0xefa8('0x28')]=undefined;loggerPredictive[_0xefa8('0x7c')](_0xc90c4c[_0xefa8('0x43')],_0xefa8('0x8e'));}if(!_['isUndefined'](_0xc90c4c[_0xefa8('0x8f')])){clearInterval(_0xc90c4c['handlePredictive']);_0xc90c4c[_0xefa8('0x8f')]=undefined;loggerPredictive[_0xefa8('0x7c')](_0xc90c4c['name'],_0xefa8('0x90'));}}}function erlangb(_0x1186ca,_0x5d871a){if(_0x5d871a===0x0){return 0x0;}var _0x27d844=0x1;for(var _0xa51ca5=0x1;_0xa51ca5<=_0x5d871a;_0xa51ca5+=0x1){_0x27d844=0x1+_0x27d844*_0xa51ca5/_0x1186ca;}return 0x1/_0x27d844;}function isVoiceQueueOutbound(_0x363271){return _0x363271==='outbound';}function isNotPreview(_0x1c8d48){return _0x1c8d48!==_0xefa8('0x21');}function isCampaignIvr(_0x2e86c8){return _0x2e86c8==='ivr';}function getCallerId(_0x34c1eb,_0x530aba,_0x1d9e5f){if(!_[_0xefa8('0x40')](_0x1d9e5f)&&typeof _0x1d9e5f===_0xefa8('0x91')&&!_[_0xefa8('0x4b')](_0x1d9e5f)){if(!_[_0xefa8('0x40')](_0x530aba)&&typeof _0x530aba===_0xefa8('0x91')&&!_['isEmpty'](_0x530aba)){return util[_0xefa8('0x77')](_0xefa8('0x92'),_0x530aba,_0x1d9e5f);}return util[_0xefa8('0x77')](_0xefa8('0x92'),_0x1d9e5f,_0x1d9e5f);}if(!_[_0xefa8('0x40')](_0x34c1eb)&&typeof _0x34c1eb==='string'&&!_[_0xefa8('0x4b')](_0x34c1eb)){return _0x34c1eb;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4e4569,_0x42fa49){return function(_0x5a1f9f){freeVariablesPredictive(_0x42fa49);emitVoiceQueueSummary(_0x42fa49);emitCampaignSummary(_0x42fa49);loggerSyncQueueSummary[_0xefa8('0x93')](_0x4e4569,util[_0xefa8('0x94')](_0x5a1f9f,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5b4e54,_0x38d7ee){return function(_0x1df3b0){loggerPredictive[_0xefa8('0x93')](_0x38d7ee[_0xefa8('0x43')],_0x5b4e54);loggerPredictive[_0xefa8('0x93')](_0x1df3b0['stack']);freeVariablesPredictive(_0x38d7ee);};}function loggerCatch(_0x1afa9c){return function(_0x38e82b){logger[_0xefa8('0x93')](_0x1afa9c,util['inspect'](_0x38e82b,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xca5aed){return _0xca5aed&&!_['isUndefined'](_0xca5aed)&&_0xca5aed['length']>0x0;}function decremetOriginate(_0x2668ac){if(!_['isUndefined'](_0x2668ac)&&_0x2668ac!==null){if(typeof _0x2668ac[_0xefa8('0x70')]!=='undefined'){if(_0x2668ac[_0xefa8('0x70')]>0x0){_0x2668ac['originated']-=0x1;}else{logger[_0xefa8('0x93')](_0xefa8('0x95'));}}}else{logger[_0xefa8('0x93')](_0xefa8('0x96'));}}function checkContactLowerLimitOriginate(_0x4efa7c,_0x4c4b7b,_0x352d54){if(_0x4c4b7b>_0x352d54){for(var _0x3e1f92=0x0;_0x3e1f92<_0x4c4b7b-_0x352d54;_0x3e1f92+=0x1){decremetOriginate(_0x4efa7c);}}}function loggerGetContactDialer(_0x320e41,_0x465210,_0x56d03d){return function(_0x2c2948){checkContactLowerLimitOriginate(_0x465210,_0x56d03d,0x0);logger['error'](_0x320e41,util[_0xefa8('0x94')](_0x2c2948,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x114e1a){return function(_0x310a7d){if(isNotNull(_0x310a7d)&&isNotNull(_0x310a7d[0x0])){if(_0x310a7d[0x0][_0xefa8('0x97')]>0x0){_0x114e1a[_0xefa8('0x41')]='RESCHEDULED_CONTACTS';logger['info'](_0xefa8('0x98')+_0x114e1a[_0xefa8('0x43')],_0x310a7d[0x0]['contactsRescheduled'],_0xefa8('0x99'));}else{_0x114e1a['message']=_0xefa8('0x9a');logger['info'](_0xefa8('0x9b')+_0x114e1a[_0xefa8('0x43')]);}}};}function notSendMessagesQueue(_0x365c69){if(_0x365c69[_0xefa8('0x9c')]){freeVariablesPredictive(_0x365c69);if(_0x365c69[_0xefa8('0x70')]===0x0&&_0x365c69['talking']===0x0&&_0x365c69[_0xefa8('0x5c')]===0x0&&(_0x365c69['pTalking']||0x0)===0x0){_0x365c69[_0xefa8('0x9c')]=![];_0x365c69[_0xefa8('0x52')]=0x0;_0x365c69['message']=_0xefa8('0x45');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x365c69[_0xefa8('0x43')],_0xefa8('0x9d'));}else{_0x365c69[_0xefa8('0x41')]=_0xefa8('0x9e');loggerSyncQueueSummary[_0xefa8('0x93')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x365c69[_0xefa8('0x43')],_0xefa8('0x9f'));}emitVoiceQueueSummary(_0x365c69);}}function notSendMessagesCampaign(_0x56fa2d){if(_0x56fa2d[_0xefa8('0x9c')]){if(_0x56fa2d[_0xefa8('0x70')]===0x0){_0x56fa2d['sendMessageOneNotActive']=![];_0x56fa2d[_0xefa8('0x41')]=_0xefa8('0x45');loggerSyncQueueSummary[_0xefa8('0x93')](_0xefa8('0xa0'),_0x56fa2d[_0xefa8('0x43')],_0xefa8('0x9d'));}else{_0x56fa2d[_0xefa8('0x41')]=_0xefa8('0x9e');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x56fa2d[_0xefa8('0x43')],_0xefa8('0x9f'));}emitCampaignSummary(_0x56fa2d);}}function createObjHistory(_0x43bfc8,_0x317469,_0x4d4367,_0x2cb11d,_0xe85ca4){_0x43bfc8[_0xefa8('0x41')]=_0x4d4367;var _0x45c08e=new Action(_0x43bfc8,_0x317469);var _0x23532e=new History(_0x45c08e);_0x23532e[_0xefa8('0xa1')]=_0x2cb11d;_0x23532e[_0xefa8('0xa2')]=_0xe85ca4;_0x23532e['endtime']=_0x45c08e[_0xefa8('0xa3')];return _0x23532e;}Dialer[_0xefa8('0x1e')][_0xefa8('0xa4')]=function(){var _0x52418c=this;setInterval(function(){_0x52418c['clearZombieChannels'](_0x52418c[_0xefa8('0x27')],_0xefa8('0xa5'));_0x52418c[_0xefa8('0xa6')](_0x52418c[_0xefa8('0x26')],_0xefa8('0xa7'));},0x32c8);};Dialer['prototype'][_0xefa8('0xa6')]=function(_0x6c4484,_0x5efd81){var _0x26ef68=this;for(var _0x563393 in _0x6c4484){if(typeof _0x6c4484[_0x563393]!==_0xefa8('0xa8')){this['sequence'][_0xefa8('0xa9')](function(){if(!_[_0xefa8('0xaa')](_0x6c4484[_0x563393])){return ami[_0xefa8('0xab')]({'action':_0xefa8('0xac'),'channel':_0x6c4484[_0x563393][_0xefa8('0xad')]})[_0xefa8('0xae')](function(_0x4fd20a){if(_0x4fd20a[_0xefa8('0x41')]===_0xefa8('0xaf')){setTimeout(function(){if(_0x6c4484[_0x563393]&&_0x6c4484[_0x563393][_0xefa8('0x59')]!==_0xefa8('0x79')){_0x26ef68['updateOriginated'](_0x26ef68['voiceQueues'][_0x6c4484[_0x563393]['queue']]);logger[_0xefa8('0x93')](_0xefa8('0xb0'),_0x5efd81,_0x563393,_0x6c4484[_0x563393][_0xefa8('0xb1')]);delete _0x6c4484[_0x563393];}if(_0x6c4484[_0x563393]&&_0x6c4484[_0x563393][_0xefa8('0x59')]===_0xefa8('0x79')){_0x26ef68[_0xefa8('0xb2')](_0x26ef68['campaigns'][_0x6c4484[_0x563393]['queue']]);logger[_0xefa8('0x93')]('[Dialer][checkChannel][ivr]',_0x5efd81,_0x563393,_0x6c4484[_0x563393][_0xefa8('0xb1')]);delete _0x6c4484[_0x563393];}},0x2328);}});}});}}};Dialer[_0xefa8('0x1e')]['countReScheduled']=function(_0x20327b){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](cmHopper[_0xefa8('0xb4')](_0x20327b))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xb5')));};Dialer['prototype'][_0xefa8('0xb6')]=function(_0x3aee68){return BPromise['resolve']()[_0xefa8('0x3e')](cmHopperBlack[_0xefa8('0xb6')](_0x3aee68))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xb7')));};Dialer[_0xefa8('0x1e')]['checkIsBlackListIvr']=function(_0x320fa6){return BPromise['resolve']()[_0xefa8('0x3e')](cmHopperBlack[_0xefa8('0xb8')](_0x320fa6))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xefa8('0x1e')]['averageHandleTime']=function(_0x5be80d){return BPromise['resolve']()[_0xefa8('0x3e')](cmHopperHistory[_0xefa8('0xb9')](_0x5be80d))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xba')));};Dialer[_0xefa8('0x1e')][_0xefa8('0xbb')]=function(_0xcdd172){return BPromise[_0xefa8('0xb3')]()['then'](cmHopper['rescheduleContact'](_0xcdd172))['catch'](loggerCatch(_0xefa8('0xbc')));};Dialer[_0xefa8('0x1e')][_0xefa8('0xbd')]=function(_0x3409ab,_0x22ab7f,_0x39e19c){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](cmHopper[_0xefa8('0xbd')](_0x3409ab,_0x22ab7f,_0x39e19c))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xbe')));};Dialer[_0xefa8('0x1e')][_0xefa8('0xbf')]=function(_0x5e2e5a,_0x297a76,_0x1bcc5f,_0x137b26,_0xa17edb){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](cmHopper[_0xefa8('0xbf')](_0x5e2e5a,_0x297a76,_0x1bcc5f,_0x137b26))[_0xefa8('0xae')](function(_0x48e8e5){_0xa17edb['temp']-=_0x1bcc5f;_0xa17edb['temp']=_0xa17edb[_0xefa8('0xc0')]>0x0?_0xa17edb[_0xefa8('0xc0')]:0x0;loggerCatch(_0xefa8('0xc1'))(_0x48e8e5);});};Dialer[_0xefa8('0x1e')]['getContactDialerIvr']=function(_0x49a00a,_0x25ae16,_0x298f78,_0x4c9e7f){return BPromise[_0xefa8('0xb3')]()['then'](cmHopper[_0xefa8('0xc2')](_0x49a00a,_0x25ae16,_0x298f78))[_0xefa8('0xae')](function(_0x45d419){_0x4c9e7f[_0xefa8('0xc0')]-=_0x25ae16;_0x4c9e7f[_0xefa8('0xc0')]=_0x4c9e7f[_0xefa8('0xc0')]>0x0?_0x4c9e7f['temp']:0x0;loggerCatch(_0xefa8('0xc3'))(_0x45d419);});};Dialer[_0xefa8('0x1e')][_0xefa8('0xc4')]=function(_0x2cf849){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2cf849))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xc5')));};Dialer[_0xefa8('0x1e')]['moveContactManagedDialer']=function(_0x88034c){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](cmHopper['moveContactManagedDialer'](_0x88034c))[_0xefa8('0xae')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xefa8('0xc6')]=function(_0x44b129){return BPromise['resolve']()[_0xefa8('0x3e')](cmHopperHistory[_0xefa8('0xc6')](_0x44b129))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xc7')));};Dialer[_0xefa8('0x1e')]['updateOriginated']=function(_0x2ca89b){if(!_[_0xefa8('0x40')](_0x2ca89b)&&_0x2ca89b!==null){if(typeof _0x2ca89b[_0xefa8('0x70')]!=='undefined'){if(_0x2ca89b[_0xefa8('0x70')]>0x0){_0x2ca89b[_0xefa8('0x70')]-=0x1;}else{logger[_0xefa8('0x93')](_0xefa8('0xc8'));}}}else{logger[_0xefa8('0x93')](_0xefa8('0xc9'));}};Dialer['prototype'][_0xefa8('0xca')]=function(_0x1c4af4,_0x3d1752){var _0x4691c6=this;return function(_0x1496ab){_0x4691c6[_0xefa8('0xb2')](_0x3d1752);logger[_0xefa8('0x93')](_0x1c4af4,util[_0xefa8('0x94')](_0x1496ab,{'showHidden':![],'depth':null}));};};Dialer[_0xefa8('0x1e')]['emptyContact']=function(_0xe8c42a,_0xf06f8e,_0x30caff){var _0x405909={'state':0x19,'statedesc':_0xefa8('0xcb')};this[_0xefa8('0xb2')](_0xf06f8e);this[_0xefa8('0xcc')](_[_0xefa8('0x8b')](_0x405909,_[_0xefa8('0xcd')](_0x30caff,[_0xefa8('0xce'),_0xefa8('0xcf'),'UserId','VoiceQueueId','CampaignId'])),_0xefa8('0xd0'),_0xefa8('0xd1'));logger[_0xefa8('0x93')](_0xe8c42a);};Dialer['prototype'][_0xefa8('0xd2')]=function(_0x5c4ddb){return _0x5c4ddb===_0xefa8('0xd3');};Dialer[_0xefa8('0x1e')][_0xefa8('0xd4')]=function(_0x33e011){return!_['isUndefined'](_0x33e011)&&_0x33e011&&!_['isUndefined'](_0x33e011['name'])&&!_[_0xefa8('0x40')](_0x33e011[_0xefa8('0x75')])&&_0x33e011[_0xefa8('0x75')]&&(this[_0xefa8('0x24')][util['format'](_0xefa8('0xd5'),_0x33e011[_0xefa8('0x43')])][_0xefa8('0xac')]==='reachable'||this[_0xefa8('0x24')][util[_0xefa8('0x77')]('SIP/%s',_0x33e011[_0xefa8('0x43')])][_0xefa8('0xac')]===_0xefa8('0xd6'));};Dialer[_0xefa8('0x1e')][_0xefa8('0xcc')]=function(_0x54aa5c,_0x4335e5,_0x4ea227){this['createHistory'](_0x54aa5c)['catch'](loggerCatch(_0x4335e5));this[_0xefa8('0xd7')](_0x54aa5c)[_0xefa8('0xae')](loggerCatch(_0x4ea227));};Dialer[_0xefa8('0x1e')]['syncVarSet']=function(_0x46c13d){var _0x292855=this[_0xefa8('0x27')][_0x46c13d[_0xefa8('0xd8')]];var _0x5eef20;if(!_[_0xefa8('0xaa')](_0x46c13d)&&!_[_0xefa8('0xaa')](_0x46c13d[_0xefa8('0xd9')])&&!_[_0xefa8('0xaa')](_0x46c13d[_0xefa8('0xd9')]['amdstatus'])&&_0x46c13d[_0xefa8('0xda')]===_0xefa8('0xdb')&&_0x292855){if(_0x292855['type']!==_0xefa8('0x79')&&this[_0xefa8('0x22')][_0x292855[_0xefa8('0xb1')]][_0xefa8('0xdc')]&&_0x46c13d[_0xefa8('0xdd')]===_0xefa8('0xde')){delete this[_0xefa8('0x27')][_0x46c13d[_0xefa8('0xd8')]];this['updateOriginated'](this[_0xefa8('0x22')][_0x292855[_0xefa8('0xb1')]]);this[_0xefa8('0x22')][_0x292855[_0xefa8('0xb1')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0x292855[_0xefa8('0xb1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5eef20=new Hangup(_0x292855,_0x46c13d);_0x5eef20[_0xefa8('0xa1')]=0x12;_0x5eef20['statedesc']='HangupInAMD';_0x5eef20['membername']='AMD';ami[_0xefa8('0xdf')](_0xefa8('0xe0'),ut[_0xefa8('0xe1')](_0x5eef20,_0xefa8('0xe2')));this[_0xefa8('0xcc')](_0x5eef20,_0xefa8('0xe3'),_0xefa8('0xe4'));}if(_0x292855['type']!==_0xefa8('0x79')&&this[_0xefa8('0x22')][_0x292855[_0xefa8('0xb1')]][_0xefa8('0xdc')]&&_0x46c13d[_0xefa8('0xdd')]==='MACHINE'){var _0x2f91b0=this;return new BPromise(function(_0x4652c1,_0x29363b){delete _0x2f91b0['uniqueId'][_0x46c13d['uniqueid']];_0x2f91b0[_0xefa8('0xb2')](_0x2f91b0[_0xefa8('0x22')][_0x292855[_0xefa8('0xb1')]]);_0x2f91b0['voiceQueues'][_0x292855[_0xefa8('0xb1')]][_0xefa8('0x62')]+=0x1;_0x2f91b0[_0xefa8('0x22')][_0x292855['queue']][_0xefa8('0x61')]+=0x1;var _0x1ef035=_0x2f91b0['voiceQueues'][_0x292855[_0xefa8('0xb1')]];var _0x2875b2=new Hangup(_0x292855,_0x46c13d);_0x2875b2['state']=0x13;_0x2875b2['statedesc']=_0xefa8('0xe5');_0x2875b2[_0xefa8('0xe6')]='AMD';_0x2875b2[_0xefa8('0xe7')]+=0x1;_0x2875b2['countglobal']+=0x1;_0x2875b2['amd']=!![];ami[_0xefa8('0xdf')]('custom:amd',ut['buildObj'](_0x2875b2,'amd'));_0x2f91b0['createHistory'](_0x2875b2)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2875b2[_0xefa8('0xe8')]+_0x2875b2[_0xefa8('0xe9')]+_0x2875b2[_0xefa8('0xea')]+_0x2875b2[_0xefa8('0xeb')]+_0x2875b2[_0xefa8('0xec')]+_0x2875b2[_0xefa8('0xed')]+_0x2875b2['countmachineretry']+_0x2875b2[_0xefa8('0xee')]>=_0x1ef035[_0xefa8('0xef')]){_0x2f91b0[_0xefa8('0xf0')](_0x2875b2,_0x4652c1,_0x29363b,'reason19\x20machine....');}else{if(_0x2875b2[_0xefa8('0xe7')]>=_0x1ef035[_0xefa8('0xf1')]){_0x2f91b0[_0xefa8('0xf2')](_0x2875b2,_0x4652c1,_0x29363b,_0xefa8('0xf3'));}else{_0x2f91b0[_0xefa8('0xbb')]({'active':![],'countmachineretry':_0x2875b2[_0xefa8('0xe7')],'scheduledat':moment()[_0xefa8('0xf4')](_0x1ef035[_0xefa8('0xf5')],_0xefa8('0xf6'))[_0xefa8('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2875b2[_0xefa8('0xce')],'ListId':_0x2875b2[_0xefa8('0xcf')],'VoiceQueueId':_0x2875b2[_0xefa8('0xf7')]||undefined,'CampaignId':_0x2875b2[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0xf9')));_0x4652c1({'reschedule':0x1});}}});}if(_0x292855['type']===_0xefa8('0x79')&&this[_0xefa8('0x23')][_0x292855[_0xefa8('0xb1')]][_0xefa8('0xdc')]&&_0x46c13d[_0xefa8('0xdd')]===_0xefa8('0xde')){delete this['uniqueId'][_0x46c13d[_0xefa8('0xd8')]];this[_0xefa8('0xb2')](this[_0xefa8('0x23')][_0x292855['queue']]);_0x5eef20=new Hangup(_0x292855,_0x46c13d);_0x5eef20['state']=0x12;_0x5eef20[_0xefa8('0xa2')]=_0xefa8('0xfa');_0x5eef20[_0xefa8('0xe6')]='AMD';ami[_0xefa8('0xdf')](_0xefa8('0xe0'),ut[_0xefa8('0xe1')](_0x5eef20,'amd'));this[_0xefa8('0xcc')](_0x5eef20,_0xefa8('0xfb'),_0xefa8('0xfc'));}if(_0x292855['type']==='ivr'&&this[_0xefa8('0x23')][_0x292855['queue']][_0xefa8('0xdc')]&&_0x46c13d[_0xefa8('0xdd')]===_0xefa8('0xfd')){var _0x2f91b0=this;return new BPromise(function(_0x288078,_0x2e865e){delete _0x2f91b0[_0xefa8('0x27')][_0x46c13d[_0xefa8('0xd8')]];_0x2f91b0[_0xefa8('0xb2')](_0x2f91b0[_0xefa8('0x23')][_0x292855[_0xefa8('0xb1')]]);_0x2f91b0[_0xefa8('0x23')][_0x292855[_0xefa8('0xb1')]][_0xefa8('0x62')]+=0x1;_0x2f91b0[_0xefa8('0x23')][_0x292855['queue']][_0xefa8('0x61')]+=0x1;var _0x250e2c=_0x2f91b0[_0xefa8('0x23')][_0x292855['queue']];var _0x332244=new Hangup(_0x292855,_0x46c13d);_0x332244[_0xefa8('0xa1')]=0x13;_0x332244['statedesc']=_0xefa8('0xe5');_0x332244[_0xefa8('0xe6')]=_0xefa8('0xfe');_0x332244[_0xefa8('0xe7')]+=0x1;_0x332244[_0xefa8('0xff')]+=0x1;_0x332244[_0xefa8('0xe2')]=!![];ami[_0xefa8('0xdf')](_0xefa8('0xe0'),ut[_0xefa8('0xe1')](_0x332244,'amd'));_0x2f91b0['createHistory'](_0x332244)[_0xefa8('0xae')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x332244['countbusyretry']+_0x332244[_0xefa8('0xe9')]+_0x332244[_0xefa8('0xea')]+_0x332244[_0xefa8('0xeb')]+_0x332244[_0xefa8('0xec')]+_0x332244['countabandonedretry']+_0x332244['countmachineretry']+_0x332244['countagentrejectretry']>=_0x250e2c[_0xefa8('0xef')]){_0x2f91b0['stateGlobal'](_0x332244,_0x288078,_0x2e865e,_0xefa8('0x100'));}else{if(_0x332244[_0xefa8('0xe7')]>=_0x250e2c['dialMachineMaxRetry']){_0x2f91b0[_0xefa8('0xf2')](_0x332244,_0x288078,_0x2e865e,'reason\x2019\x20machine....');}else{_0x2f91b0[_0xefa8('0xbb')]({'active':![],'countmachineretry':_0x332244[_0xefa8('0xe7')],'scheduledat':moment()['add'](_0x250e2c[_0xefa8('0xf5')],_0xefa8('0xf6'))['format'](_0xefa8('0x101')),'ContactId':_0x332244[_0xefa8('0xce')],'ListId':_0x332244['ListId'],'VoiceQueueId':_0x332244[_0xefa8('0xf7')]||undefined,'CampaignId':_0x332244[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0xf9')));_0x288078({'reschedule':0x1});}}});}}};Dialer[_0xefa8('0x1e')][_0xefa8('0x34')]=function(_0x4b2ab3){var _0x22a481=this[_0xefa8('0x27')][_0x4b2ab3[_0xefa8('0xd8')]];var _0x549912=this;var _0x29bfc6;if(_0x22a481&&_0x22a481[_0xefa8('0x59')]===_0xefa8('0x79')){delete this[_0xefa8('0x27')][_0x4b2ab3['uniqueid']];this['updateOriginated'](this['campaigns'][_0x22a481['queue']]);this[_0xefa8('0x23')][_0x22a481[_0xefa8('0xb1')]][_0xefa8('0x102')]+=0x1;_0x29bfc6=new Hangup(_0x22a481,_0x4b2ab3);this[_0xefa8('0xc6')](_0x29bfc6)['catch'](loggerCatch(_0xefa8('0x103')));this['moveContactManagedDialer'](_0x29bfc6)[_0xefa8('0xae')](loggerCatch('[syncHangupIvr]'));}if(_0x22a481&&_0x22a481[_0xefa8('0x59')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x22a481['queue']][_0xefa8('0x104')])){delete this['uniqueId'][_0x4b2ab3[_0xefa8('0xd8')]];this['updateOriginated'](this[_0xefa8('0x22')][_0x22a481['queue']]);this[_0xefa8('0x22')][_0x22a481[_0xefa8('0xb1')]][_0xefa8('0x62')]+=0x1;this[_0xefa8('0x22')][_0x22a481[_0xefa8('0xb1')]][_0xefa8('0x61')]+=0x1;_0x29bfc6=new Hangup(_0x22a481,_0x4b2ab3);_0x29bfc6[_0xefa8('0xa1')]=0x10;_0x29bfc6[_0xefa8('0xa2')]=_0xefa8('0x105');_0x29bfc6[_0xefa8('0xe6')]='AGI';this[_0xefa8('0xc6')](_0x29bfc6)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x103')));this['moveContactManagedDialer'](_0x29bfc6)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x106')));}if(_0x22a481&&_0x22a481[_0xefa8('0x59')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x22a481[_0xefa8('0xb1')]]['dialQueueProject'])){delete this['uniqueId'][_0x4b2ab3['uniqueid']];this['updateOriginated'](this[_0xefa8('0x22')][_0x22a481[_0xefa8('0xb1')]]);this[_0xefa8('0x22')][_0x22a481[_0xefa8('0xb1')]][_0xefa8('0x107')]+=0x1;_0x29bfc6=new Hangup(_0x22a481,_0x4b2ab3);_0x29bfc6['state']=0xc;_0x29bfc6['statedesc']=_0x4b2ab3[_0xefa8('0x108')];_0x29bfc6[_0xefa8('0xe6')]=_0xefa8('0x109');this['createHistory'](_0x29bfc6)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x103')));this[_0xefa8('0xd7')](_0x29bfc6)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x106')));}};Dialer[_0xefa8('0x1e')][_0xefa8('0x31')]=function(_0x1862cc){var _0x2e3bb9=this[_0xefa8('0x27')][_0x1862cc[_0xefa8('0xd8')]];var _0x4790d1=this;if(this[_0xefa8('0x22')][_0x1862cc[_0xefa8('0xb1')]]){if(_0x2e3bb9&&_0x2e3bb9[_0xefa8('0x59')]!==_0xefa8('0x79')){delete this[_0xefa8('0x27')][_0x1862cc['uniqueid']];this[_0xefa8('0x22')][_0x1862cc[_0xefa8('0xb1')]][_0xefa8('0x62')]+=0x1;var _0x2983b0=new AgentComplete(_0x2e3bb9,_0x1862cc);if(_0x1862cc[_0xefa8('0x10a')]==='agent'){_0x2983b0['agiafterat']=this['voiceQueues'][_0x1862cc[_0xefa8('0xb1')]]['dialQueueProject2']&&this[_0xefa8('0x22')][_0x1862cc[_0xefa8('0xb1')]][_0xefa8('0x10b')]?moment()[_0xefa8('0x77')](_0xefa8('0x101')):undefined;}this[_0xefa8('0xc6')](_0x2983b0)['catch'](loggerCatch(_0xefa8('0x10c')));this['moveContactManagedDialer'](_0x2983b0)['catch'](loggerCatch(_0xefa8('0x10d')));}}};Dialer['prototype'][_0xefa8('0x2c')]=function(_0x45da30){if(this[_0xefa8('0x22')][_0x45da30['queue']]){if(this[_0xefa8('0x27')][_0x45da30[_0xefa8('0xd8')]]&&this['uniqueId'][_0x45da30['uniqueid']][_0xefa8('0x59')]!==_0xefa8('0x79')){this[_0xefa8('0xb2')](this[_0xefa8('0x22')][_0x45da30[_0xefa8('0xb1')]]);this[_0xefa8('0x27')][_0x45da30[_0xefa8('0xd8')]][_0xefa8('0x10e')]=moment()[_0xefa8('0x77')](_0xefa8('0x101'));}}};Dialer[_0xefa8('0x1e')][_0xefa8('0x10f')]=function(_0x2e4a3f){this[_0xefa8('0xc6')](_0x2e4a3f)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x10c')));this[_0xefa8('0xd7')](_0x2e4a3f)['catch'](loggerCatch(_0xefa8('0x110')));};Dialer[_0xefa8('0x1e')][_0xefa8('0x2e')]=function(_0x167f6f){var _0x3e64c1=this[_0xefa8('0x27')][_0x167f6f[_0xefa8('0xd8')]];var _0x49de29=this;if(this[_0xefa8('0x22')][_0x167f6f[_0xefa8('0xb1')]]){if(_0x3e64c1&&_0x3e64c1[_0xefa8('0x59')]!==_0xefa8('0x79')){delete this[_0xefa8('0x27')][_0x167f6f[_0xefa8('0xd8')]];this['updateOriginated'](this[_0xefa8('0x22')][_0x167f6f[_0xefa8('0xb1')]]);_0x3e64c1[_0xefa8('0x111')]=moment()[_0xefa8('0x77')](_0xefa8('0x101'));var _0x373a8d=new QueueCallerAbandon(_0x3e64c1,_0x167f6f);if(getSeconds(_0x3e64c1['droptime'],_0x3e64c1[_0xefa8('0x112')])>=_0x3e64c1[_0xefa8('0x113')]){this[_0xefa8('0x22')][_0x167f6f['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x114')]+=0x1;this[_0xefa8('0x22')][_0x167f6f['queue']][_0xefa8('0x115')]+=0x1;_0x373a8d['state']=0xa;_0x373a8d[_0xefa8('0xa2')]='Drop';_0x373a8d[_0xefa8('0x116')]=_0xefa8('0x117');_0x373a8d[_0xefa8('0x118')]=this[_0xefa8('0x22')][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x119')]?moment()[_0xefa8('0x77')](_0xefa8('0x101')):undefined;_0x373a8d['countdropretry']+=0x1;_0x373a8d['countglobal']+=0x1;if(_0x373a8d[_0xefa8('0xec')]>=this['voiceQueues'][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x11a')]){this[_0xefa8('0x10f')](_0x373a8d);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x373a8d[_0xefa8('0xec')],'scheduledat':moment()['add'](this[_0xefa8('0x22')][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x11b')],_0xefa8('0xf6'))['format'](_0xefa8('0x101')),'ContactId':_0x3e64c1[_0xefa8('0xce')],'ListId':_0x3e64c1[_0xefa8('0xcf')],'VoiceQueueId':_0x3e64c1[_0xefa8('0xf7')]||undefined,'CampaignId':_0x3e64c1[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x11c')));var _0x19f452=new History(_0x373a8d);_0x19f452[_0xefa8('0xa1')]=0xa;_0x19f452[_0xefa8('0xa2')]=_0xefa8('0x11d');_0x19f452[_0xefa8('0xa3')]=moment()[_0xefa8('0x77')](_0xefa8('0x101'));_0x19f452['endtime']=_0x19f452[_0xefa8('0xa3')];_0x19f452['calleridname']=_0x373a8d['calleridname'];_0x19f452[_0xefa8('0x11e')]=_0x373a8d[_0xefa8('0x11e')];this[_0xefa8('0xc6')](_0x19f452)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x11f')));}}else{this['voiceQueues'][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x80')]+=0x1;this[_0xefa8('0x22')][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x65')]+=0x1;_0x373a8d[_0xefa8('0xa1')]=0xb;_0x373a8d['statedesc']=_0xefa8('0x120');_0x373a8d[_0xefa8('0x116')]='CALLEREXIT';_0x373a8d[_0xefa8('0xed')]+=0x1;_0x373a8d[_0xefa8('0xff')]+=0x1;if(_0x373a8d[_0xefa8('0xed')]>=this['voiceQueues'][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x121')]){this[_0xefa8('0x10f')](_0x373a8d);}else{this[_0xefa8('0xbb')]({'active':![],'countabandonedretry':_0x373a8d[_0xefa8('0xed')],'scheduledat':moment()['add'](this['voiceQueues'][_0x167f6f[_0xefa8('0xb1')]][_0xefa8('0x122')],'minutes')[_0xefa8('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e64c1[_0xefa8('0xce')],'ListId':_0x3e64c1[_0xefa8('0xcf')],'VoiceQueueId':_0x3e64c1['VoiceQueueId']||undefined,'CampaignId':_0x3e64c1[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x123')));var _0x19f452=new History(_0x373a8d);_0x19f452['state']=0xb;_0x19f452[_0xefa8('0xa2')]=_0xefa8('0x120');_0x19f452[_0xefa8('0xa3')]=moment()['format'](_0xefa8('0x101'));_0x19f452['endtime']=_0x19f452[_0xefa8('0xa3')];_0x19f452['calleridname']=_0x373a8d[_0xefa8('0x124')];_0x19f452[_0xefa8('0x11e')]=_0x373a8d['calleridnum'];this[_0xefa8('0xc6')](_0x19f452)[_0xefa8('0xae')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0xefa8('0x36')]=function(_0x3950ff){if(this[_0xefa8('0x26')][_0x3950ff[_0xefa8('0xd8')]]){this[_0xefa8('0x26')][_0x3950ff[_0xefa8('0xd8')]][_0xefa8('0xad')]=_0x3950ff[_0xefa8('0xad')];}if(this[_0xefa8('0x27')][_0x3950ff[_0xefa8('0xd8')]]){this[_0xefa8('0x27')][_0x3950ff[_0xefa8('0xd8')]][_0xefa8('0xad')]=_0x3950ff[_0xefa8('0xad')];}};Dialer['prototype'][_0xefa8('0x3a')]=function(_0x5a485e){if(strategy[this[_0xefa8('0x22')][this['actions'][_0x5a485e[_0xefa8('0x125')]]['queue']][_0xefa8('0x51')]]===_0xefa8('0x126')){if(this['actions'][_0x5a485e[_0xefa8('0x125')]]&&_['isNil'](this[_0xefa8('0x26')][_0x5a485e['actionid']][_0xefa8('0x127')])&&_0x5a485e[_0xefa8('0xac')]==='1'&&_0x5a485e[_0xefa8('0x128')]==='0'){if(this['agents'][_0x5a485e[_0xefa8('0x129')]]){if(!this['agents'][_0x5a485e[_0xefa8('0x129')]][_0xefa8('0x127')]){this[_0xefa8('0x12a')][_0x5a485e['stateinterface']][_0xefa8('0x127')]=!![];this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]][_0xefa8('0x127')]=!![];this[_0xefa8('0x26')][_0x5a485e['actionid']][_0xefa8('0x129')]=_0x5a485e[_0xefa8('0x129')];}}}}else if((strategy[this[_0xefa8('0x22')][this[_0xefa8('0x26')][_0x5a485e['actionid']][_0xefa8('0xb1')]]['strategy']]||_0xefa8('0x1d'))===_0xefa8('0x1d')){if(this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]]){if(this[_0xefa8('0x12a')][_0x5a485e[_0xefa8('0x129')]]){this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]]['stateinterface']=_0x5a485e[_0xefa8('0x129')];if(_['isNil'](this['queueBooked'][this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]][_0xefa8('0xb1')]])){this[_0xefa8('0x12b')][this[_0xefa8('0x26')][_0x5a485e['actionid']][_0xefa8('0xb1')]]=[];}this[_0xefa8('0x12b')][this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]]['queue']][_0xefa8('0x12c')](_['merge'](_[_0xefa8('0xcd')](this[_0xefa8('0x26')][_0x5a485e[_0xefa8('0x125')]],['idHopper',_0xefa8('0x129')]),{'status':_0x5a485e[_0xefa8('0xac')],'paused':_0x5a485e[_0xefa8('0x128')]}));}}}};function unlockQueueStatus(_0x318c18,_0x1346b3){setTimeout(function(){if(_[_0xefa8('0x40')](_0x318c18[_0xefa8('0x12d')])){loggerBooked['error'](_0xefa8('0x12e'),_0x1346b3);}_0x318c18[_0xefa8('0x12d')]=!![];loggerBooked[_0xefa8('0x7c')](_0xefa8('0x12f'),_0x1346b3,JSON[_0xefa8('0x4e')](_['pick'](_0x318c18,[_0xefa8('0x43'),_0xefa8('0x12d')])));},0x1f3);}Dialer['prototype'][_0xefa8('0x3c')]=function(_0x198e98){var _0x349a1b=this;var _0x4ca429=_0x349a1b['voiceQueues'][_0x349a1b['actions'][_0x198e98[_0xefa8('0x125')]]['queue']];if(strategy[this['voiceQueues'][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['queue']][_0xefa8('0x51')]]===_0xefa8('0x126')){if(this['actions'][_0x198e98[_0xefa8('0x125')]]&&this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0x129')]){this[_0xefa8('0x21')]['run'](this[_0xefa8('0x26')][_0x198e98['actionid']][_0xefa8('0x130')],this[_0xefa8('0x26')][_0x198e98['actionid']][_0xefa8('0x129')])[_0xefa8('0xae')](function(_0x21ee55){logger[_0xefa8('0x93')](_0xefa8('0x131'),util['inspect'](_0x21ee55,{'showHidden':![],'depth':null}));})[_0xefa8('0x20')](function(){_0x349a1b['updateOriginated'](_0x349a1b[_0xefa8('0x22')][_0x349a1b[_0xefa8('0x26')][_0x198e98['actionid']][_0xefa8('0xb1')]]);_0x349a1b['agents'][_0x349a1b[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0x129')]][_0xefa8('0x127')]=![];delete _0x349a1b[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]];unlockQueueStatus(_0x4ca429);});}else{this[_0xefa8('0xb2')](this[_0xefa8('0x22')][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['queue']]);this[_0xefa8('0xbb')]({'active':![],'ContactId':this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['ContactId'],'ListId':this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xcf')],'VoiceQueueId':this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xf7')]||undefined,'CampaignId':this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x132')));delete this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]];unlockQueueStatus(_0x4ca429);}}else if((strategy[this[_0xefa8('0x22')][this['actions'][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xb1')]][_0xefa8('0x51')]]||_0xefa8('0x1d'))===_0xefa8('0x1d')){var _0x5112b8;if(this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]&&!_[_0xefa8('0x4b')](this['queueBooked'][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['queue']])){if(this[_0xefa8('0x2a')][_0x349a1b[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['queue']]){this[_0xefa8('0x2a')][_0x349a1b[_0xefa8('0x26')][_0x198e98['actionid']][_0xefa8('0xb1')]]=this['queueBookedRR'][this[_0xefa8('0x26')][_0x198e98['actionid']][_0xefa8('0xb1')]]?this[_0xefa8('0x2a')][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xb1')]]:this[_0xefa8('0x12b')][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xb1')]]?this[_0xefa8('0x12b')][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xb1')]][_0xefa8('0x133')]||0x0:0x0;}this[_0xefa8('0x12b')][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]]['queue']][_0xefa8('0x133')]=this['queueBookedRR'][this[_0xefa8('0x26')][_0x198e98[_0xefa8('0x125')]][_0xefa8('0xb1')]];for(var _0x141fd8=0x0;_0x141fd8=0x0;})[_0xefa8('0xae')](myreject(_0xa709cc)));}}else{_0x2ec928['push'](ami['Action']({'action':_0xefa8('0x151'),'command':util[_0xefa8('0x77')](_0xefa8('0x14d'),_0x11024f,!_[_0xefa8('0x40')](config[_0xefa8('0x152')][_0x5b7217])?_0x5b7217:'')})[_0xefa8('0x3e')](function(_0x364558){return _0x364558[_0xefa8('0x14f')][_0xefa8('0x153')](_0xefa8('0x150'))>=0x0;})[_0xefa8('0xae')](myreject(_0xa709cc)));}BPromise[_0xefa8('0x154')](_0x2ec928)['then'](function(_0x13d2b9){var _0x1a52f4=_[_0xefa8('0x155')](_0x13d2b9);if(_0x1a52f4){return _0x369850(_0x1a52f4);}else{_0x5f2631[_0xefa8('0x41')]=_0x10bc14?_0xefa8('0x156'):_0xefa8('0x157');return _0xa709cc(msgResponse(_0xefa8('0x158'),_0xefa8('0x146'),'Global:\x20'+_0x10bc14+'\x20'+_0x3f00bb+_0xefa8('0x159')+util[_0xefa8('0x94')](_0x11024f,{'showHidden':![],'depth':null})+_0xefa8('0x15a')+_0x5b7217));}})['catch'](function(_0x1cc749){return _0xa709cc(msgResponse(_0xefa8('0x145'),_0xefa8('0x146'),JSON[_0xefa8('0x4e')](_0x1cc749)));});});};Dialer[_0xefa8('0x1e')]['checkDialMethod']=function(_0x50cc3e){var _0x5ef2b2=this;return function(){switch(_0x50cc3e[_0xefa8('0x5e')]){case _0xefa8('0x15b'):freeVariablesPredictive(_0x50cc3e);_0x5ef2b2[_0xefa8('0x15c')](_0x50cc3e,0x1);break;case _0xefa8('0x15d'):freeVariablesPredictive(_0x50cc3e);_0x5ef2b2[_0xefa8('0x15c')](_0x50cc3e,_0x50cc3e[_0xefa8('0x15e')]);break;case'predictive':_0x5ef2b2[_0xefa8('0x9')](_0x50cc3e);break;case _0xefa8('0x8'):freeVariablesPredictive(_0x50cc3e);_0x5ef2b2['handlePower'](_0x50cc3e,0x1);break;default:freeVariablesPredictive(_0x50cc3e);logger['error'](_0xefa8('0x15f'),_0x50cc3e[_0xefa8('0x43')],_0xefa8('0x160'));}};};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x5e63fe){return BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](cmHopper[_0xefa8('0x161')](_0x5e63fe['id'],previewRecallmeReminderInterval))[_0xefa8('0x3e')](function(_0x26d481){for(var _0x374432=0x0;_0x374432<_0x26d481[_0xefa8('0x134')];_0x374432++){var _0x5e45db=_0x26d481[_0x374432][_0xefa8('0x162')][_0xefa8('0x43')];if(_0x5e45db)io['to'](util['format'](_0xefa8('0x163'),_0x5e45db))[_0xefa8('0xdf')](_0xefa8('0x164'),{'hopper':_0x26d481[_0x374432]});}})['catch'](function(_0x40d920){});};Dialer[_0xefa8('0x1e')][_0xefa8('0x165')]=function(_0x27d9e9){var _0x4b0268=this;return function(){_0x4b0268[_0xefa8('0x166')](_0x27d9e9);};};Dialer[_0xefa8('0x1e')]['syncQueueSummary']=function(_0x29bf9b){var _0x3204e9=this;if(isNotPreview(_0x29bf9b[_0xefa8('0x5e')])){if(isVoiceQueueOutbound(_0x29bf9b[_0xefa8('0x59')])&&isActive(_0x29bf9b[_0xefa8('0x167')])){_0x29bf9b[_0xefa8('0x9c')]=!![];BPromise[_0xefa8('0xb3')]()[_0xefa8('0x3e')](checkIsLoggedIn(_0x29bf9b,_0x29bf9b[_0xefa8('0x53')]))[_0xefa8('0x3e')](checkIsActive(_0x29bf9b,_0x29bf9b[_0xefa8('0x167')]))['then'](checkInterval(_0x29bf9b))[_0xefa8('0x3e')](_0x3204e9[_0xefa8('0x13f')](_0x29bf9b))['then'](_0x3204e9[_0xefa8('0x143')](_0x29bf9b[_0xefa8('0x168')],_0x29bf9b[_0xefa8('0x169')],_0x29bf9b['name'],_0x29bf9b))[_0xefa8('0x3e')](_0x3204e9[_0xefa8('0x144')](_0x29bf9b[_0xefa8('0x47')],_0x29bf9b['dialTimezone'],_0x29bf9b['name'],_0x29bf9b))[_0xefa8('0x3e')](_0x3204e9[_0xefa8('0x16a')](_0x29bf9b))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x29bf9b));}else{notSendMessagesQueue(_0x29bf9b);}}else{freeVariablesPredictive(_0x29bf9b);if(_0x29bf9b[_0xefa8('0x16b')]){_0x3204e9['checkPreviewRecallReminder'](_0x29bf9b);}}};Dialer['prototype'][_0xefa8('0x13e')]=function(){var _0x5e4429=this;var _0x43be4d;for(var _0x275b47 in this[_0xefa8('0x23')]){if(typeof this[_0xefa8('0x23')][_0x275b47]!==_0xefa8('0xa8')){_0x43be4d=this[_0xefa8('0x23')][_0x275b47];if(isCampaignIvr(_0x43be4d[_0xefa8('0x59')])&&isActive(_0x43be4d['active'])){_0x43be4d[_0xefa8('0x9c')]=!![];BPromise[_0xefa8('0xb3')]()['then'](checkIsActive(_0x43be4d,_0x43be4d[_0xefa8('0x75')]))[_0xefa8('0x3e')](checkInterval(_0x43be4d))[_0xefa8('0x3e')](_0x5e4429[_0xefa8('0x13f')](_0x43be4d))[_0xefa8('0x3e')](_0x5e4429['checkIfTime'](_0x43be4d[_0xefa8('0x168')],_0x43be4d[_0xefa8('0x169')],_0x43be4d[_0xefa8('0x43')],_0x43be4d))[_0xefa8('0x3e')](_0x5e4429['checkIfTimeIntervals'](_0x43be4d[_0xefa8('0x47')],_0x43be4d['dialTimezone'],_0x43be4d[_0xefa8('0x43')],_0x43be4d))[_0xefa8('0x3e')](_0x5e4429[_0xefa8('0x165')](_0x43be4d))[_0xefa8('0xae')](loggerCatchQueueSummary('[syncCampaigns]',_0x43be4d));}else{notSendMessagesCampaign(_0x43be4d);}}}};function getCallerIdRandom(_0x4e6514,_0x1c36d5){var _0x33fed5;var _0x42130a;var _0x3c57d8;if(_0x1c36d5<=0x0){_0x1c36d5=0x1;}_0x33fed5=new RegExp(_0xefa8('0x16c')+_0x1c36d5+'}$');_0x42130a=Math['pow'](0xa,_0x1c36d5-0x1);_0x3c57d8=Math[_0xefa8('0x16d')](0xa,_0x1c36d5)-0x1;return util[_0xefa8('0x77')]('%s',_[_0xefa8('0x16e')](_0x4e6514,_0x33fed5,_[_0xefa8('0x16f')](_0x42130a,_0x3c57d8)));}function extractCalleridName(_0x587537){var _0x4e322f=_0x587537['match'](/"(.*?)"/);return _0x4e322f?_0x4e322f[0x1]:_0x587537;}function extractCalleridNumber(_0x463488){var _0x34bb96=_0x463488[_0xefa8('0x170')](/<(.*?)>/);return _0x34bb96?_0x34bb96[0x1]:_0x463488;}Dialer[_0xefa8('0x1e')][_0xefa8('0x171')]=function(_0x5d4787,_0x5c67b0){var _0xf87f94=this;var _0x2d21e6=uuid['v4']();this[_0xefa8('0x26')][_0x2d21e6]=new Action(_0x5d4787,_0x5c67b0,_0x2d21e6);return new BPromise(function(_0x5c5cd5,_0x1f3735){if(_['isUndefined'](_0x5d4787)&&typeof _0x5d4787!==_0xefa8('0x172')){return _0x1f3735(msgResponse('originate',_0xefa8('0x146'),'voiceQueue\x20is\x20undefine'));}if(_[_0xefa8('0x40')](_0x5c67b0[_0xefa8('0x173')][_0xefa8('0x174')])||_0x5c67b0[_0xefa8('0x173')][_0xefa8('0x174')]===null){return _0x1f3735(msgResponse(_0xefa8('0x175'),_0xefa8('0x146'),_0xefa8('0x176')));}var _0x52bbfd={'XMD-CALLERID':_0xf87f94[_0xefa8('0x26')][_0x2d21e6][_0xefa8('0x177')](),'XMD-AGI':_0x5d4787['dialQueueProject']?util[_0xefa8('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d4787[_0xefa8('0x104')]):'NONE','XMD-AGIAFTER':_0x5d4787['dialQueueProject2']?util[_0xefa8('0x77')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5d4787[_0xefa8('0x119')]):_0xefa8('0x178'),'XMD-QUEUE':_0x5d4787[_0xefa8('0x59')]===_0xefa8('0x179')?util[_0xefa8('0x77')]('\x22%s,%s%s,,,%s\x22',_0x5d4787['name'],_0x5d4787[_0xefa8('0x17a')]||'',_0x5d4787[_0xefa8('0x10b')]?'c':'',_0x5d4787[_0xefa8('0x113')]||0x3):_0xefa8('0x178'),'XMD-CONTACTID':_0x5c67b0['ContactId'],'XMD-CDRTYPE':_0xefa8('0x7'),'CALLERID(all)':_0xf87f94[_0xefa8('0x26')][_0x2d21e6][_0xefa8('0x177')](),'XMD-AMD':_0x5d4787[_0xefa8('0xdc')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xefa8('0xdb')};if(_0x5d4787[_0xefa8('0xdc')]){_0x52bbfd[_0xefa8('0x17b')]=_0x5d4787[_0xefa8('0x17c')]||0x9c4;_0x52bbfd[_0xefa8('0x17d')]=_0x5d4787[_0xefa8('0x17e')]||0x5dc;_0x52bbfd[_0xefa8('0x17f')]=_0x5d4787['dialAMDAfterGreetingSilence']||0x320;_0x52bbfd[_0xefa8('0x180')]=_0x5d4787[_0xefa8('0x181')]||0x1388;_0x52bbfd['XMD-AMDMINWORDLENGTH']=_0x5d4787[_0xefa8('0x182')]||0x64;_0x52bbfd['XMD-AMDBETWEENWORDSSILENCE']=_0x5d4787[_0xefa8('0x183')]||0x32;_0x52bbfd['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x5d4787['dialAMDMaximumNumberOfWords']||0x3;_0x52bbfd[_0xefa8('0x184')]=_0x5d4787[_0xefa8('0x185')]||0x100;_0x52bbfd[_0xefa8('0x186')]=_0x5d4787[_0xefa8('0x187')]||0x1388;}if(_0x5d4787[_0xefa8('0x59')]===_0xefa8('0x179')){_0x52bbfd[_0xefa8('0x188')]=_0x5c67b0[_0xefa8('0xf7')];}else{_0x52bbfd[_0xefa8('0x189')]=_0x5c67b0['CampaignId'];}for(var _0x1f9460 in _0x5c67b0['Contact']){if(typeof _0x5c67b0[_0xefa8('0x173')][_0x1f9460]!==_0xefa8('0xa8')){if(isNotNull(_0x5c67b0['Contact'][_0x1f9460])&&_0x1f9460!=='id'&&_0x1f9460!==_0xefa8('0x18a')&&_0x1f9460!==_0xefa8('0x18b')&&_0x1f9460!==_0xefa8('0x18c')){_0x52bbfd[util[_0xefa8('0x77')](_0xefa8('0x18d'),'XMD-',_[_0xefa8('0x18e')](_0x1f9460))]=_0x5c67b0['Contact'][_0x1f9460];}}}var _0x40be74=_0xf87f94[_0xefa8('0xd4')](_0x5d4787[_0xefa8('0x74')])?getCallerId(_0x5d4787['Trunk'][_0xefa8('0x76')],_0x5d4787[_0xefa8('0x18f')],_0x5d4787['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5d4787[_0xefa8('0x190')],_0x5d4787[_0xefa8('0x191')]):_0x5d4787['dialOriginateCallerIdNumber']):getCallerId(_['isNil'](_0x5d4787[_0xefa8('0x140')])?_0x5d4787['Trunk'][_0xefa8('0x76')]:_0x5d4787[_0xefa8('0x140')][_0xefa8('0x76')],_0x5d4787[_0xefa8('0x18f')],_0x5d4787[_0xefa8('0x191')]>0x0?getCallerIdRandom(_0x5d4787[_0xefa8('0x190')],_0x5d4787[_0xefa8('0x191')]):_0x5d4787[_0xefa8('0x190')]);if(_0x40be74){_0x52bbfd[_0xefa8('0x192')]=_0xf87f94['actions'][_0x2d21e6]['originatecalleridname']=extractCalleridName(_0x40be74);_0x52bbfd['XMD-ORIGINATECALLERIDNUM']=_0xf87f94[_0xefa8('0x26')][_0x2d21e6][_0xefa8('0x193')]=extractCalleridNumber(_0x40be74);}return ami[_0xefa8('0xab')]({'actionid':_0x2d21e6,'action':_0xefa8('0x175'),'channel':_0xf87f94[_0xefa8('0xd4')](_0x5d4787[_0xefa8('0x74')])?util[_0xefa8('0x77')](_0xefa8('0x194'),_0x5d4787[_0xefa8('0x74')][_0xefa8('0x43')],isNotNull(_0x5d4787['dialPrefix'])?_0x5d4787[_0xefa8('0x60')][_0xefa8('0x195')]()||'':'',_0x5d4787[_0xefa8('0x196')]>0x0?_0x5c67b0[_0xefa8('0x173')][_0xefa8('0x174')][_0xefa8('0x197')](_0x5d4787['dialCutDigit']):_0x5c67b0['Contact'][_0xefa8('0x174')]):util[_0xefa8('0x77')](_0xefa8('0x194'),_['isNil'](_0x5d4787[_0xefa8('0x140')])?_0x5d4787[_0xefa8('0x74')][_0xefa8('0x43')]:_0x5d4787[_0xefa8('0x140')]['name'],isNotNull(_0x5d4787[_0xefa8('0x60')])?_0x5d4787[_0xefa8('0x60')]['trim']()||'':'',_0x5d4787[_0xefa8('0x196')]>0x0?_0x5c67b0[_0xefa8('0x173')][_0xefa8('0x174')]['substring'](_0x5d4787[_0xefa8('0x196')]):_0x5c67b0[_0xefa8('0x173')]['phone']),'callerid':_0x40be74,'Exten':'xcally-motion-dialer','Context':_0xefa8('0x198'),'Priority':'1','variable':_0x52bbfd,'timeout':(_0x5d4787[_0xefa8('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d21e6})[_0xefa8('0x3e')](function(_0xa26582){return _0x5c5cd5(_0xa26582);})[_0xefa8('0xae')](function(_0x57e062){_0x5d4787['outboundOriginateFailureCallsDay']+=0x1;var _0x4e877a=new History(_0xf87f94[_0xefa8('0x26')][_0x2d21e6]);logger[_0xefa8('0x93')](util['format']('[originateError]:\x20%s',JSON[_0xefa8('0x4e')](_0x57e062)));_0x4e877a[_0xefa8('0xa1')]=0xe;_0x4e877a[_0xefa8('0xa2')]='OriginateError';_0x4e877a[_0xefa8('0xa3')]=moment()[_0xefa8('0x77')](_0xefa8('0x101'));_0x4e877a[_0xefa8('0x199')]=_0x4e877a[_0xefa8('0xa3')];_0xf87f94[_0xefa8('0xc6')](_0x4e877a)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x19a')));_0xf87f94[_0xefa8('0xd7')](_0x4e877a)[_0xefa8('0xae')](loggerCatch('[originate][error]'))[_0xefa8('0x20')](function(){delete _0xf87f94[_0xefa8('0x26')][_0x2d21e6];return _0x1f3735(msgResponse(_0xefa8('0x175'),_0xefa8('0x4d'),'originate\x20action\x20Error'));});});});};Dialer[_0xefa8('0x1e')][_0xefa8('0x30')]=function(_0x5954bb){var _0x50bacf=this[_0xefa8('0x26')][_0x5954bb[_0xefa8('0x125')]];if(_0x50bacf){delete this[_0xefa8('0x26')][_0x5954bb[_0xefa8('0x125')]];_0x50bacf['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xbf8482=_0x50bacf['type']===_0xefa8('0x79')?this[_0xefa8('0x23')][_0x50bacf[_0xefa8('0xb1')]]:this[_0xefa8('0x22')][_0x50bacf[_0xefa8('0x19b')]()];if(!this[_0xefa8('0xd2')](_0x5954bb[_0xefa8('0x19c')])){this[_0xefa8('0xb2')](_0xbf8482);return this['callProgressDetecting'](_0x50bacf,_0xbf8482,_0x5954bb)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x19d')));}this[_0xefa8('0x27')][_0x5954bb[_0xefa8('0xd8')]]=_0x50bacf;}};Dialer[_0xefa8('0x1e')][_0xefa8('0x19e')]=function(_0x5d7338,_0x48e81e,_0x1b46dd){var _0x52655f=new History(_0x48e81e);if(_0x52655f[_0xefa8('0xe8')]+_0x52655f['countcongestionretry']+_0x52655f[_0xefa8('0xea')]+_0x52655f['countnosuchnumberretry']+_0x52655f[_0xefa8('0xec')]+_0x52655f[_0xefa8('0xed')]+_0x52655f[_0xefa8('0xe7')]+_0x52655f[_0xefa8('0xee')]>=_0x1b46dd['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5d7338){case 0x3:if(_0x52655f[_0xefa8('0xea')]>=_0x1b46dd[_0xefa8('0x19f')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x52655f[_0xefa8('0xea')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x1a0')],_0xefa8('0xf6'))[_0xefa8('0x77')](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f[_0xefa8('0xcf')],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f['CampaignId']||undefined})['catch'](loggerCatch(_0xefa8('0x1a1')));break;case 0x5:if(_0x52655f['countbusyretry']>=_0x1b46dd['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x52655f[_0xefa8('0xe8')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x1a2')],_0xefa8('0xf6'))[_0xefa8('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f[_0xefa8('0xcf')],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1a3')));break;case 0x8:if(_0x52655f['countcongestionretry']>=_0x1b46dd[_0xefa8('0x1a4')]-0x1){return!![];}this[_0xefa8('0xbb')]({'active':![],'countcongestionretry':_0x52655f[_0xefa8('0xe9')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd['dialCongestionRetryFrequency'],'minutes')[_0xefa8('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f[_0xefa8('0xcf')],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x52655f[_0xefa8('0xeb')]>=_0x1b46dd[_0xefa8('0x1a5')]-0x1){return!![];}else{this[_0xefa8('0xbb')]({'active':![],'countnosuchnumberretry':_0x52655f[_0xefa8('0xeb')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x1a6')],_0xefa8('0xf6'))[_0xefa8('0x77')](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f[_0xefa8('0xcf')],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1a7')));}break;case 0xa:if(_0x52655f[_0xefa8('0xec')]>=_0x1b46dd[_0xefa8('0x11a')]-0x1){return!![];}this[_0xefa8('0xbb')]({'active':![],'countdropretry':_0x52655f[_0xefa8('0xec')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x11b')],_0xefa8('0xf6'))[_0xefa8('0x77')](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f['ListId'],'VoiceQueueId':_0x52655f['VoiceQueueId']||undefined,'CampaignId':_0x52655f['CampaignId']||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x11c')));break;case 0xb:if(_0x52655f[_0xefa8('0xed')]>=_0x1b46dd[_0xefa8('0x121')]-0x1){return!![];}this[_0xefa8('0xbb')]({'active':![],'countabandonedretry':_0x52655f[_0xefa8('0xed')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x122')],_0xefa8('0xf6'))['format'](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f['ListId'],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x123')));break;case 0x13:if(_0x52655f['countmachineretry']>=_0x1b46dd[_0xefa8('0xf1')]-0x1){return!![];}this[_0xefa8('0xbb')]({'active':![],'countmachineretry':_0x52655f[_0xefa8('0xe7')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0xf5')],'minutes')[_0xefa8('0x77')](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f['ListId'],'VoiceQueueId':_0x52655f[_0xefa8('0xf7')]||undefined,'CampaignId':_0x52655f[_0xefa8('0xf8')]||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0xf9')));break;case 0x14:if(_0x52655f['countagentrejectretry']>=_0x1b46dd['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xefa8('0xbb')]({'active':![],'countagentrejectretry':_0x52655f[_0xefa8('0xee')]+=0x1,'scheduledat':moment()[_0xefa8('0xf4')](_0x1b46dd[_0xefa8('0x1a8')],'minutes')[_0xefa8('0x77')](_0xefa8('0x101')),'ContactId':_0x52655f[_0xefa8('0xce')],'ListId':_0x52655f[_0xefa8('0xcf')],'VoiceQueueId':_0x52655f['VoiceQueueId']||undefined,'CampaignId':_0x52655f['CampaignId']||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1a9')));break;default:return!![];}};Dialer[_0xefa8('0x1e')][_0xefa8('0x1aa')]=function(_0x414b7e,_0x3bab3d,_0x29046b){var _0x3b6f4e=this;var _0xe441ac=new History(_0x414b7e);return new BPromise(function(_0x2396e4,_0x3b2b6f){if(_[_0xefa8('0x40')](_0x3bab3d)&&typeof _0x3bab3d!=='object'){return _0x3b2b6f(msgResponse(_0xefa8('0x1ab'),_0xefa8('0x146'),_0xefa8('0x1ac')));}if(_['isUndefined'](_0x29046b)&&typeof _0x29046b!==_0xefa8('0x172')){return _0x3b2b6f(msgResponse(_0xefa8('0x1ab'),'Failure',_0xefa8('0x1ad')));}switch(_0x29046b[_0xefa8('0x10a')]){case'0':_0x3bab3d[_0xefa8('0x67')]+=0x1;_0xe441ac[_0xefa8('0xa1')]=0x0;_0xe441ac[_0xefa8('0xa2')]=_0xefa8('0x1ae');_0xe441ac[_0xefa8('0xeb')]+=0x1;_0xe441ac[_0xefa8('0xff')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0xefa8('0xe1')](_0x414b7e,_0xefa8('0x1af')));_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1b0')));if(_0x3b6f4e['checkRetriveMax'](0x0,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xeb')]>=_0x3bab3d[_0xefa8('0x1a5')]){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1b1'));}else{_0x3b6f4e['stateGlobal'](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1b1'));}}break;case'3':_0x3bab3d['outboundNoAnswerCallsDay']+=0x1;_0xe441ac[_0xefa8('0xa1')]=0x3;_0xe441ac[_0xefa8('0xa2')]=_0xefa8('0x1b2');_0xe441ac[_0xefa8('0xea')]+=0x1;_0xe441ac['countglobal']+=0x1;ami[_0xefa8('0xdf')](_0xefa8('0x1b3'),ut[_0xefa8('0xe1')](_0x414b7e,_0xefa8('0x1b4')));_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x3b6f4e['checkRetriveMax'](0x3,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xea')]>=_0x3bab3d[_0xefa8('0x19f')]){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1b5'));}else{_0x3b6f4e['stateGlobal'](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1b5'));}}break;case'5':_0x3bab3d[_0xefa8('0x1b6')]+=0x1;_0xe441ac[_0xefa8('0xa1')]=0x5;_0xe441ac['statedesc']='Busy';_0xe441ac[_0xefa8('0xe8')]+=0x1;_0xe441ac[_0xefa8('0xff')]+=0x1;ami[_0xefa8('0xdf')](_0xefa8('0x1b7'),ut[_0xefa8('0xe1')](_0x414b7e,_0xefa8('0x1b8')));_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)['catch'](loggerCatch(_0xefa8('0x1b9')));if(_0x3b6f4e[_0xefa8('0x19e')](0x5,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xe8')]>=_0x3bab3d[_0xefa8('0x1ba')]){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1bb'));}else{_0x3b6f4e[_0xefa8('0xf0')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1bb'));}}break;case'8':_0x3bab3d[_0xefa8('0x64')]+=0x1;_0xe441ac[_0xefa8('0xa1')]=0x8;_0xe441ac[_0xefa8('0xa2')]=_0xefa8('0x1bc');_0xe441ac[_0xefa8('0xe9')]+=0x1;_0xe441ac[_0xefa8('0xff')]+=0x1;ami[_0xefa8('0xdf')](_0xefa8('0x1bd'),ut[_0xefa8('0xe1')](_0x414b7e,_0xefa8('0x1be')));_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)['catch'](loggerCatch(_0xefa8('0x1bf')));if(_0x3b6f4e[_0xefa8('0x19e')](0x8,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xe9')]>=_0x3bab3d[_0xefa8('0x1a4')]){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c0'));}else{_0x3b6f4e[_0xefa8('0xf0')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c0'));}}break;case'11':_0x3bab3d[_0xefa8('0x1c1')]+=0x1;_0xe441ac['state']=0xb;_0xe441ac[_0xefa8('0xa2')]=_0xefa8('0x120');_0xe441ac[_0xefa8('0xed')]+=0x1;_0xe441ac[_0xefa8('0xff')]+=0x1;_0x3b6f4e['createHistory'](_0xe441ac)['catch'](loggerCatch(_0xefa8('0x1c2')));if(_0x3b6f4e[_0xefa8('0x19e')](0xb,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xed')]>=_0x3bab3d['dialAbandonedMaxRetry']){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c3'));}else{_0x3b6f4e[_0xefa8('0xf0')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c3'));}}break;case'20':_0x3bab3d[_0xefa8('0x69')]+=0x1;_0xe441ac[_0xefa8('0xa1')]=0x14;_0xe441ac[_0xefa8('0xa2')]=_0xefa8('0x1c4');_0xe441ac[_0xefa8('0xee')]+=0x1;_0xe441ac[_0xefa8('0xff')]+=0x1;ami[_0xefa8('0xdf')](_0xefa8('0x1c5'),ut[_0xefa8('0xe1')](_0x414b7e,_0xefa8('0x1c6')));_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)[_0xefa8('0xae')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x3b6f4e[_0xefa8('0x19e')](0x14,_0x414b7e,_0x3bab3d)){if(_0xe441ac[_0xefa8('0xee')]>=_0x3bab3d['dialAgentRejectMaxRetry']){_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c7'));}else{_0x3b6f4e[_0xefa8('0xf0')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0xefa8('0x1c7'));}}break;default:_0x3bab3d[_0xefa8('0x107')]+=0x1;_0xe441ac[_0xefa8('0xa1')]=0xc;_0xe441ac[_0xefa8('0xa2')]=_0x29046b['reason'];_0x3b6f4e[_0xefa8('0xc6')](_0xe441ac)[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1c8')));if(_0x3b6f4e[_0xefa8('0x19e')](_0x29046b[_0xefa8('0x10a')],_0x414b7e,_0x3bab3d)){if(_0xe441ac['countbusyretry']+_0xe441ac[_0xefa8('0xe9')]+_0xe441ac[_0xefa8('0xea')]+_0xe441ac[_0xefa8('0xeb')]+_0xe441ac[_0xefa8('0xec')]+_0xe441ac[_0xefa8('0xed')]+_0xe441ac[_0xefa8('0xe7')]+_0xe441ac[_0xefa8('0xee')]>=_0x3bab3d[_0xefa8('0xef')]){_0x3b6f4e['stateGlobal'](_0xe441ac,_0x2396e4,_0x3b2b6f,_0x29046b['reason']);}else{_0x3b6f4e[_0xefa8('0xf2')](_0xe441ac,_0x2396e4,_0x3b2b6f,_0x29046b[_0xefa8('0x10a')]);}}}});};Dialer[_0xefa8('0x1e')][_0xefa8('0xf0')]=function(_0x28f87f,_0x524806,_0x51b896,_0x5924e2){var _0x24bd05=new Final(_0x28f87f);_0x24bd05[_0xefa8('0xa1')]=0xf;_0x24bd05['statedesc']=_0xefa8('0x1c9');this['createStateFinal'](_0x24bd05,_0x524806,_0x51b896,_0x5924e2);};Dialer[_0xefa8('0x1e')][_0xefa8('0xf2')]=function(_0x31c5e1,_0x28b019,_0x1039c1,_0x980df2){this['moveContactManagedDialer'](_0x31c5e1)[_0xefa8('0x3e')](function(){return _0x28b019(msgResponse('[callProgressDetecting]',_0xefa8('0xd3'),_0x980df2));})[_0xefa8('0xae')](function(){return _0x1039c1(msgResponse(_0xefa8('0x1ca'),'Failure',_0xefa8('0x1cb')));});};Dialer[_0xefa8('0x1e')][_0xefa8('0x9')]=function(_0x87ad03){var _0x1270d8=_0x87ad03[_0xefa8('0x1cc')]/0x64;var _0x1ce6e1=_0x87ad03['outboundDropCallsDayTimeout']/(_0x87ad03[_0xefa8('0x114')]+_0x87ad03[_0xefa8('0x62')]);var _0x21a310=Math[_0xefa8('0x1cd')](_0x87ad03[_0xefa8('0x6e')]*(_0x87ad03['predictiveIntervalMaxThreshold']/0x64));var _0x3c2f42=Math[_0xefa8('0x1cd')](_0x87ad03['predictiveIntervalAvailable']*(_0x87ad03[_0xefa8('0x1ce')]/0x64));var _0x52ef5f=_0x87ad03[_0xefa8('0x52')]+_0x87ad03[_0xefa8('0x57')];var _0x23af52=Math[_0xefa8('0x1cf')](_0x87ad03[_0xefa8('0x71')]*_0x87ad03[_0xefa8('0x8a')]*_0x87ad03[_0xefa8('0x1d0')]*_0x87ad03[_0xefa8('0x1d1')]);if(_[_0xefa8('0x40')](_0x87ad03['startProgressive'])){if(!_[_0xefa8('0x40')](_0x87ad03[_0xefa8('0x28')])){_0x87ad03['startPredictive']=undefined;loggerPredictive[_0xefa8('0x93')](_0xefa8('0x1d2'),_0xefa8('0x1d3'));}if(!_['isUndefined'](_0x87ad03[_0xefa8('0x8f')])){loggerPredictive[_0xefa8('0x93')](_0xefa8('0x1d2'),_0xefa8('0x1d4'));clearInterval(_0x87ad03[_0xefa8('0x8f')]);_0x87ad03[_0xefa8('0x8f')]=undefined;}_0x87ad03['startProgressive']=moment()[_0xefa8('0x77')](_0xefa8('0x101'));loggerPredictive[_0xefa8('0x7c')](_0x87ad03[_0xefa8('0x43')],'collection\x20data\x20in\x20progressive\x20at',_0x87ad03[_0xefa8('0x73')]);this[_0xefa8('0x15c')](_0x87ad03,0x1);}else if(ifInterval(_0x87ad03[_0xefa8('0x1d5')],_0x87ad03[_0xefa8('0x73')])){this[_0xefa8('0x15c')](_0x87ad03,0x1);loggerPredictiveCalls[_0xefa8('0x7c')](_0xefa8('0x1d6'),_0x87ad03[_0xefa8('0x73')],_0x87ad03[_0xefa8('0x43')]);_0x87ad03[_0xefa8('0x71')]=0x0;_0x87ad03[_0xefa8('0x115')]=0x0;}else if(_0x1270d8<_0x1ce6e1&&_0x87ad03[_0xefa8('0x1d7')]===_0xefa8('0x1d8')){freeVariablesPredictive(_0x87ad03);loggerPredictive[_0xefa8('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x1ce6e1,'startProgressive',_0x87ad03['name']);}else if(_0x23af52<_0x87ad03[_0xefa8('0x115')]&&_0x87ad03[_0xefa8('0x1d7')]==='dropRate'){freeVariablesPredictive(_0x87ad03);loggerPredictive[_0xefa8('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xefa8('0x1d9'),_0x23af52,_0xefa8('0x1da'),_0x87ad03[_0xefa8('0x115')],_0xefa8('0x73'),_0x87ad03[_0xefa8('0x43')]);}else if(!ifInterval(_0x87ad03[_0xefa8('0x1d5')],_0x87ad03[_0xefa8('0x73')])&&_['isUndefined'](_0x87ad03[_0xefa8('0x28')])&&!_[_0xefa8('0x40')](_0x87ad03['startProgressive'])){_0x87ad03['startPredictive']=moment()[_0xefa8('0x77')](_0xefa8('0x101'));loggerPredictive[_0xefa8('0x7c')](_0x87ad03[_0xefa8('0x43')],_0xefa8('0x1db'),_0x87ad03[_0xefa8('0x28')]);this[_0xefa8('0x1dc')](_0x87ad03[_0xefa8('0x1d5')])[_0xefa8('0x3e')](this[_0xefa8('0x1dd')](_0x87ad03))['then'](mergeDataErlangB(_0x87ad03))['then'](this[_0xefa8('0x1de')](_0x87ad03))[_0xefa8('0xae')](loggerCatchPredictive(_0xefa8('0x1df'),_0x87ad03));}else if(!ifInterval(_0x87ad03['dialPredictiveInterval'],_0x87ad03[_0xefa8('0x28')])){_0x87ad03[_0xefa8('0x115')]=0x0;_0x87ad03[_0xefa8('0x28')]=moment()['format'](_0xefa8('0x101'));loggerPredictive['info'](_0x87ad03['name'],_0xefa8('0x1e0'),_0x87ad03['startPredictive']);clearInterval(_0x87ad03[_0xefa8('0x8f')]);_0x87ad03[_0xefa8('0x8f')]=undefined;this['averageHandleTime'](_0x87ad03[_0xefa8('0x1d5')])[_0xefa8('0x3e')](this[_0xefa8('0x1dd')](_0x87ad03))[_0xefa8('0x3e')](mergeDataErlangB(_0x87ad03))[_0xefa8('0x3e')](this[_0xefa8('0x1de')](_0x87ad03))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x87ad03));}else if(_0x87ad03[_0xefa8('0x6e')]&&_0x52ef5f<_0x87ad03['predictiveIntervalAvailable']-_0x3c2f42){freeVariablesPredictive(_0x87ad03);loggerPredictive[_0xefa8('0x7c')](_0x87ad03[_0xefa8('0x43')],_0xefa8('0x1e1'),_0x52ef5f,_0xefa8('0x1e2'),_0x87ad03['predictiveIntervalAvailable'],'-',_0x3c2f42,'=',_0x87ad03[_0xefa8('0x6e')]-_0x3c2f42,')');}else if(_0x87ad03[_0xefa8('0x6e')]&&_0x52ef5f>_0x87ad03[_0xefa8('0x6e')]+_0x21a310){freeVariablesPredictive(_0x87ad03);loggerPredictive['info'](_0x87ad03[_0xefa8('0x43')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x52ef5f,_0xefa8('0x1e3'),_0x87ad03[_0xefa8('0x6e')],'+',_0x21a310,'=',_0x87ad03[_0xefa8('0x6e')]+_0x21a310,')');}};Dialer['prototype'][_0xefa8('0x1dd')]=function(_0x8cfe31){var _0x40387a=this;return function(_0xb12767){return new BPromise(function(_0x5cbb17,_0x1d1ecb){_[_0xefa8('0x8b')](_0x8cfe31,_0xb12767[0x0]);if(checkGetDataPredictive(_0xb12767[0x0])){var _0x3b00e7=_0x8cfe31['predictiveIntervalAvailable']=_0x8cfe31[_0xefa8('0x57')]+_0x8cfe31[_0xefa8('0x52')];var _0x44829f=_0x8cfe31[_0xefa8('0x1d5')]*0x3c;var _0x78f11e=_0xb12767[0x0][_0xefa8('0x6c')]+_0xb12767[0x0][_0xefa8('0x6b')];var _0x2a4296=(_0xb12767[0x0][_0xefa8('0x6a')]+_0xb12767[0x0][_0xefa8('0x7f')]+_0xb12767[0x0][_0xefa8('0x80')])/_0xb12767[0x0][_0xefa8('0x6f')];_0x8cfe31['predictiveIntervalHitRate']=_0x2a4296>0x0?_0x2a4296:0x1;switch(_0x8cfe31[_0xefa8('0x1d7')]){case _0xefa8('0x1d8'):var _0x2393bc=_0x8cfe31[_0xefa8('0x1cc')]/0x64;return _0x40387a[_0xefa8('0x1e4')](_0x3b00e7,_0x44829f,_0x78f11e,_0x2a4296,_0x2393bc)['then'](function(_0x32054c){return _0x5cbb17(_0x32054c);});case _0xefa8('0x1e5'):var _0xb4491d=_0x8cfe31[_0xefa8('0x1cc')]/0x64;return _0x40387a[_0xefa8('0x1e6')](_0x3b00e7,_0x44829f,_0x78f11e,_0x2a4296,_0xb4491d)[_0xefa8('0x3e')](function(_0x1e29e7){return _0x5cbb17(_0x1e29e7);});default:return _0x1d1ecb(msgResponse(_0xefa8('0x1e7'),_0xefa8('0x146'),'Unknown\x20Predictive'));}}else{return _0x1d1ecb(msgResponse('[getDataPredictive]',_0xefa8('0x146'),_0xefa8('0x1e8')));}});};};Dialer[_0xefa8('0x1e')]['getDataPredictiveOld']=function(_0x2cbb4f){var _0x4d6490=this;return function(_0x36c5ed){return new BPromise(function(_0x33fa14,_0xd94f94){_[_0xefa8('0x8b')](_0x2cbb4f,_0x36c5ed[0x0]);if(checkGetDataPredictive(_0x36c5ed[0x0])){loggerPredictive[_0xefa8('0x7c')](JSON[_0xefa8('0x4e')](_0x36c5ed[0x0]));if(_0x2cbb4f[_0xefa8('0x1d7')]===_0xefa8('0x1d8')){return _0x4d6490['getVoiceQueueRtPauses'](_0x2cbb4f['id'])[_0xefa8('0x3e')](function(_0x238f42){var _0x2190da=_0x2cbb4f[_0xefa8('0x53')]-_0x238f42[0x0][_0xefa8('0x1e9')];var _0x21b8ec=_0x2cbb4f[_0xefa8('0x1d5')]*0x3c;var _0x50a7f7=_0x36c5ed[0x0][_0xefa8('0x6c')]+_0x36c5ed[0x0]['predictiveIntervalAvgHoldtime'];var _0x2650b7=(_0x36c5ed[0x0][_0xefa8('0x6a')]+_0x36c5ed[0x0][_0xefa8('0x7f')]+_0x36c5ed[0x0][_0xefa8('0x80')])/_0x36c5ed[0x0]['predictiveIntervalTotalCalls'];var _0x409811=_0x2cbb4f[_0xefa8('0x1cc')]/0x64;_0x2cbb4f['predictiveIntervalPauses']=_0x238f42[0x0][_0xefa8('0x1e9')]||0x0;_0x2cbb4f[_0xefa8('0x1d0')]=_0x2650b7>0x0?_0x2650b7:0x1;return _0x4d6490[_0xefa8('0x1e4')](_0x2190da,_0x21b8ec,_0x50a7f7,_0x2650b7,_0x409811);})[_0xefa8('0x3e')](function(_0xea098a){return _0x33fa14(_0xea098a);})[_0xefa8('0xae')](function(_0x31d96e){return _0xd94f94(msgResponse(_0xefa8('0x1ea'),_0xefa8('0x146'),JSON[_0xefa8('0x4e')](_0x31d96e)));});}if(_0x2cbb4f['dialPredictiveOptimization']===_0xefa8('0x1e5')){return _0x4d6490[_0xefa8('0xc4')](_0x2cbb4f['id'])[_0xefa8('0x3e')](function(_0x1e8ca3){var _0x168613=_0x2cbb4f[_0xefa8('0x53')]-_0x1e8ca3[0x0][_0xefa8('0x1e9')];var _0x36cbab=_0x2cbb4f['dialPredictiveInterval']*0x3c;var _0x1d0a12=_0x36c5ed[0x0][_0xefa8('0x6c')]+_0x36c5ed[0x0][_0xefa8('0x6b')];var _0xa932=(_0x36c5ed[0x0]['predictiveIntervalAnsweredCalls']+_0x36c5ed[0x0][_0xefa8('0x7f')]+_0x36c5ed[0x0][_0xefa8('0x80')])/_0x36c5ed[0x0]['predictiveIntervalTotalCalls'];var _0x4dd643=_0x2cbb4f[_0xefa8('0x1cc')]/0x64;_0x2cbb4f[_0xefa8('0x1eb')]=_0x1e8ca3[0x0][_0xefa8('0x1e9')]||0x0;_0x2cbb4f[_0xefa8('0x1d0')]=_0xa932>0x0?_0xa932:0x1;return _0x4d6490[_0xefa8('0x1e6')](_0x168613,_0x36cbab,_0x1d0a12,_0xa932,_0x4dd643);})[_0xefa8('0x3e')](function(_0x20ba67){return _0x33fa14(_0x20ba67);})[_0xefa8('0xae')](function(_0x27306f){return _0xd94f94(msgResponse(_0xefa8('0x1ea'),_0xefa8('0x146'),JSON[_0xefa8('0x4e')](_0x27306f)));});}}else{return _0xd94f94(msgResponse('[getDataPredictive]',_0xefa8('0x146'),_0xefa8('0x1e8')));}});};};Dialer['prototype'][_0xefa8('0x1de')]=function(_0x23eb44){var _0x48a245=this;return function(){var _0x7b25bc=0x0;var _0x8df55f=Math[_0xefa8('0x1cf')](_0x23eb44['erlangCallToSecond']*0x3e8);if(_0x8df55f>0x0){_0x8df55f=_0x8df55f<0x64?0x64:_0x8df55f;loggerPredictive[_0xefa8('0x7c')](_0x23eb44[_0xefa8('0x43')],_0xefa8('0x1ec'),_0x8df55f,_0xefa8('0x4f'));_0x23eb44[_0xefa8('0x8f')]=setInterval(function(){_0x48a245[_0xefa8('0x8f')](_0x23eb44);loggerPredictiveCalls[_0xefa8('0x7c')]('[handlePredictive]',_0x7b25bc+=0x1);},_0x8df55f);}else{loggerPredictive[_0xefa8('0x7c')](_0x23eb44['name'],_0xefa8('0x1ed'));}};};Dialer[_0xefa8('0x1e')][_0xefa8('0x1ee')]=function(_0x1ff6fe,_0xd42544){var _0x4ec23a=this;return function(_0x4996f3){if(_[_0xefa8('0x4b')](_0x4996f3)){if(_[_0xefa8('0xaa')](_0xd42544['UserId'])||!_0xd42544['recallme']){if(_0x1ff6fe[_0xefa8('0x5e')]===_0xefa8('0x8')){_0x1ff6fe['queueStatusComplete']=_[_0xefa8('0x40')](_0x1ff6fe['queueStatusComplete'])?!![]:_0x1ff6fe['queueStatusComplete'];var _0x72dd4b=uuid['v4']();_0x4ec23a[_0xefa8('0x26')][_0x72dd4b]=new Action(_0x1ff6fe,_0xd42544,_0x72dd4b);loggerBooked[_0xefa8('0x7c')](_0xefa8('0x1ef'),_0x72dd4b,_0xefa8('0x1f0'),JSON[_0xefa8('0x4e')](_0x1ff6fe['queueStatusComplete']),_0xefa8('0x1f1'),_0x1ff6fe[_0xefa8('0x43')]);if(_0x1ff6fe[_0xefa8('0x12d')]){_0x1ff6fe[_0xefa8('0x12d')]=![];_0x4ec23a[_0xefa8('0x12b')][_0x4ec23a[_0xefa8('0x26')][_0x72dd4b][_0xefa8('0xb1')]]=[];ami[_0xefa8('0xab')]({'actionid':_0x72dd4b,'action':_0xefa8('0x1f2'),'queue':_0x1ff6fe['name']})[_0xefa8('0xae')](function(){_0x4ec23a[_0xefa8('0xb2')](_0x1ff6fe);_0x4ec23a[_0xefa8('0xbb')]({'active':![],'ContactId':_0x4ec23a['actions'][_0x72dd4b]['ContactId'],'ListId':_0x4ec23a[_0xefa8('0x26')][_0x72dd4b][_0xefa8('0xcf')],'VoiceQueueId':_0x4ec23a['actions'][_0x72dd4b][_0xefa8('0xf7')]||undefined,'CampaignId':_0x4ec23a[_0xefa8('0x26')][_0x72dd4b][_0xefa8('0xf8')]||undefined})['catch'](loggerCatch(_0xefa8('0x1f3')));delete _0x4ec23a[_0xefa8('0x26')][_0x72dd4b];});}else{loggerBooked[_0xefa8('0x7c')](_0xefa8('0x1f4'),JSON[_0xefa8('0x4e')](_0x1ff6fe[_0xefa8('0x12d')]),_0xefa8('0x1f1'),_0x1ff6fe[_0xefa8('0x43')]);_0x4ec23a['updateOriginated'](_0x1ff6fe);_0x4ec23a[_0xefa8('0xbb')]({'active':![],'ContactId':_0x4ec23a['actions'][_0x72dd4b][_0xefa8('0xce')],'ListId':_0x4ec23a[_0xefa8('0x26')][_0x72dd4b]['ListId'],'VoiceQueueId':_0x4ec23a['actions'][_0x72dd4b]['VoiceQueueId']||undefined,'CampaignId':_0x4ec23a[_0xefa8('0x26')][_0x72dd4b]['CampaignId']||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1f3')));delete _0x4ec23a[_0xefa8('0x26')][_0x72dd4b];}}else{return _0x4ec23a[_0xefa8('0x171')](_0x1ff6fe,_0xd42544);}}else{if(getDiff(_0xd42544[_0xefa8('0x1f5')])<_0x1ff6fe['dialRecallMeTimeout']*0x3c){if(_0xd42544[_0xefa8('0x162')]&&!_0xd42544[_0xefa8('0x162')][_0xefa8('0x1f6')]){_0x4ec23a['preview'][_0xefa8('0x138')](_0xd42544['id'])[_0xefa8('0x20')](function(){_0x4ec23a[_0xefa8('0xb2')](_0x1ff6fe);});}else{_0x4ec23a[_0xefa8('0xbd')]({'active':![]},_0xd42544['id'],0x1)['finally'](function(){_0x4ec23a[_0xefa8('0xb2')](_0x1ff6fe);});}}else{_0x1ff6fe[_0xefa8('0x68')]+=0x1;_0x4ec23a[_0xefa8('0xb2')](_0x1ff6fe);if(_0x1ff6fe['dialRecallInQueue']){_0x4ec23a[_0xefa8('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xd42544[_0xefa8('0xce')],'ListId':_0xd42544[_0xefa8('0xcf')],'VoiceQueueId':_0xd42544['VoiceQueueId']||undefined,'CampaignId':_0xd42544['CampaignId']||undefined})[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1f7')));_0x4ec23a[_0xefa8('0xc6')](createObjHistory(_0x1ff6fe,_0xd42544,_0xefa8('0x1f8'),0x17,'RecallInQueue'))[_0xefa8('0xae')](loggerCatch(_0xefa8('0x1f9')));}else{_0x4ec23a[_0xefa8('0xcc')](createObjHistory(_0x1ff6fe,_0xd42544,'RECALLFAILEDTIMEOUT',0x16,_0xefa8('0x1fa')),'[Originate][HistoryRecallClose][historyCatch]',_0xefa8('0x1fb'));}}}}else{_0x1ff6fe['outboundBlacklistCallsDay']+=0x1;_0x4ec23a['saveInDb'](createObjHistory(_0x1ff6fe,_0xd42544,_0xefa8('0x1fc'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xefa8('0x1fd'));throw _0xefa8('0x1fe');}};};Dialer['prototype'][_0xefa8('0x166')]=function(_0x1f8ebe){var _0x4854d9=this;var _0x77975e=_0x1f8ebe['limitCalls']-_0x1f8ebe[_0xefa8('0x70')]-_0x1f8ebe[_0xefa8('0xc0')];emitCampaignSummary(_0x1f8ebe);if(_0x77975e>0x0){if(_0x77975e>this[_0xefa8('0x25')]){_0x77975e=this[_0xefa8('0x25')];}_0x1f8ebe[_0xefa8('0xc0')]+=_0x77975e;this[_0xefa8('0xc2')](_0x1f8ebe['id'],_0x77975e,_0x1f8ebe['dialOrderByScheduledAt'],_0x1f8ebe)['then'](function(_0x454c49){_0x1f8ebe[_0xefa8('0xc0')]-=_0x77975e;_0x1f8ebe[_0xefa8('0xc0')]=_0x1f8ebe[_0xefa8('0xc0')]>0x0?_0x1f8ebe[_0xefa8('0xc0')]:0x0;if(!checkContactEmpty(_0x454c49)){_0x1f8ebe[_0xefa8('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xefa8('0x7c')](_0xefa8('0x1ff')+_0x1f8ebe[_0xefa8('0x43')]);}else{_0x1f8ebe[_0xefa8('0x70')]+=_0x454c49['length'];_0x1f8ebe['message']='RUNNING';for(var _0x59f0dc=0x0;_0x59f0dc<_0x454c49['length'];_0x59f0dc+=0x1){_0x1f8ebe[_0xefa8('0x200')]+=0x1;if(_[_0xefa8('0xaa')](_0x454c49[_0x59f0dc])||_[_0xefa8('0xaa')](_0x454c49[_0x59f0dc]['Contact'])||_['isNil'](_0x454c49[_0x59f0dc][_0xefa8('0x173')][_0xefa8('0x174')])){_0x4854d9[_0xefa8('0x201')](_0xefa8('0x202'),_0x1f8ebe,_0x454c49[_0x59f0dc]);}else{_0x4854d9['checkIsBlackListIvr'](_[_0xefa8('0xcd')](_0x454c49[_0x59f0dc],[_0xefa8('0xf8'),_0xefa8('0x203')]))['then'](_0x4854d9[_0xefa8('0x1ee')](_0x1f8ebe,_0x454c49[_0x59f0dc]))['catch'](_0x4854d9[_0xefa8('0xca')](_0xefa8('0x204'),_0x1f8ebe));}}}})[_0xefa8('0xae')](loggerGetContactDialer(_0xefa8('0x205'),_0x1f8ebe,_0x77975e));}};Dialer[_0xefa8('0x1e')][_0xefa8('0x15c')]=function(_0x2c3b7c,_0x543e45){var _0x392a4a=this;var _0x4baa5d=[];var _0x111f10=_0x543e45>=0x1?_0x543e45:0x1;if(_0x2c3b7c[_0xefa8('0x5e')]===_0xefa8('0x8')){_0x111f10=0x1;}var _0x20aa76=Math[_0xefa8('0x1cf')](_0x2c3b7c['available']*_0x111f10)-_0x2c3b7c[_0xefa8('0x70')]-_0x2c3b7c[_0xefa8('0xc0')];emitVoiceQueueSummary(_0x2c3b7c);if(_0x2c3b7c[_0xefa8('0x206')]>0x0){var _0x2f618b=_0x2c3b7c[_0xefa8('0x206')]-_0x2c3b7c['originated']-_0x2c3b7c[_0xefa8('0x57')]-_0x2c3b7c[_0xefa8('0xc0')]-_0x2c3b7c[_0xefa8('0x54')];if(_0x20aa76>_0x2f618b){_0x20aa76=_0x2f618b;}}if(_0x20aa76>0x0){if(_0x2c3b7c[_0xefa8('0x5e')]===_0xefa8('0x8')){_0x20aa76=0x1;}if(_0x20aa76>this[_0xefa8('0x25')]){_0x20aa76=this[_0xefa8('0x25')];}_0x2c3b7c[_0xefa8('0xc0')]+=_0x20aa76;for(var _0x1259b3 in this['agents']){if(typeof this['agents'][_0x1259b3]!==_0xefa8('0xa8')){if(this[_0xefa8('0x12a')][_0x1259b3][_0xefa8('0xa1')]===_0xefa8('0x207')&&this['agents'][_0x1259b3][_0xefa8('0xac')]===_0xefa8('0x208')){_0x4baa5d['push'](this[_0xefa8('0x12a')][_0x1259b3]['id']);}}}this[_0xefa8('0xbf')](_0x2c3b7c['id'],_0x4baa5d,_0x20aa76,_0x2c3b7c['dialOrderByScheduledAt'],_0x2c3b7c)[_0xefa8('0x3e')](function(_0x95938e){_0x2c3b7c[_0xefa8('0xc0')]-=_0x20aa76;_0x2c3b7c[_0xefa8('0xc0')]=_0x2c3b7c[_0xefa8('0xc0')]>0x0?_0x2c3b7c[_0xefa8('0xc0')]:0x0;if(!checkContactEmpty(_0x95938e)){_0x392a4a['countReScheduled'](_0x2c3b7c)[_0xefa8('0x3e')](sendMessageReschedule(_0x2c3b7c))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xb5')));}else{_0x2c3b7c[_0xefa8('0x70')]+=_0x95938e['length'];_0x2c3b7c[_0xefa8('0x41')]=_0x2c3b7c[_0xefa8('0x5e')]===_0xefa8('0x8')?_0xefa8('0x209'):_0xefa8('0x20a');for(var _0x7e9a64=0x0;_0x7e9a64<_0x95938e['length'];_0x7e9a64+=0x1){if(_[_0xefa8('0xaa')](_0x95938e[_0x7e9a64])||_[_0xefa8('0xaa')](_0x95938e[_0x7e9a64][_0xefa8('0x173')])||_[_0xefa8('0xaa')](_0x95938e[_0x7e9a64][_0xefa8('0x173')]['phone'])){_0x392a4a['emptyContact'](_0xefa8('0x202'),_0x2c3b7c,_0x95938e[_0x7e9a64]);}else{_0x392a4a[_0xefa8('0xb6')](_['pick'](_0x95938e[_0x7e9a64],[_0xefa8('0xf7'),'Contact.phone']))[_0xefa8('0x3e')](_0x392a4a[_0xefa8('0x1ee')](_0x2c3b7c,_0x95938e[_0x7e9a64]))[_0xefa8('0xae')](_0x392a4a[_0xefa8('0xca')](_0xefa8('0x202'),_0x2c3b7c));}}}})['catch'](loggerGetContactDialer(_0xefa8('0x20b'),_0x2c3b7c,_0x20aa76));}};Dialer[_0xefa8('0x1e')][_0xefa8('0x8f')]=function(_0x2e252c){if(_0x2e252c[_0xefa8('0x206')]>0x0){var _0x5d10b6=_0x2e252c['dialLimitQueue']-_0x2e252c[_0xefa8('0x70')]-_0x2e252c[_0xefa8('0x57')];if(_0x5d10b6>0x0){this[_0xefa8('0x20c')](_0x2e252c);}else{loggerPredictiveCalls[_0xefa8('0x7c')](_0xefa8('0x20d'));}}else{this['tryOriginatePredictive'](_0x2e252c);}};Dialer['prototype'][_0xefa8('0x20c')]=function(_0x4e6bb5){var _0x56c789=this;var _0x89380f=[];_0x4e6bb5[_0xefa8('0x70')]+=0x1;for(var _0x174c6f in this[_0xefa8('0x12a')]){if(typeof this[_0xefa8('0x12a')][_0x174c6f]!==_0xefa8('0xa8')){if(this[_0xefa8('0x12a')][_0x174c6f]['state']==='not_inuse'&&this[_0xefa8('0x12a')][_0x174c6f][_0xefa8('0xac')]===_0xefa8('0x208')){_0x89380f[_0xefa8('0x12c')](this[_0xefa8('0x12a')][_0x174c6f]['id']);}}}this[_0xefa8('0xbf')](_0x4e6bb5['id'],_0x89380f,0x1,_0x4e6bb5[_0xefa8('0x20e')],_0x4e6bb5)['then'](function(_0x3653f6){if(!checkContactEmpty(_0x3653f6)){checkContactLowerLimitOriginate(_0x4e6bb5,0x1,0x0);_0x56c789[_0xefa8('0xb4')](_0x4e6bb5)[_0xefa8('0x3e')](sendMessageReschedule(_0x4e6bb5))[_0xefa8('0xae')](loggerCatch(_0xefa8('0xb5')));}else{_0x4e6bb5[_0xefa8('0x41')]=_0xefa8('0x20a');if(_[_0xefa8('0xaa')](_0x3653f6[0x0])||_[_0xefa8('0xaa')](_0x3653f6[0x0][_0xefa8('0x173')])||_[_0xefa8('0xaa')](_0x3653f6[0x0][_0xefa8('0x173')][_0xefa8('0x174')])){_0x56c789[_0xefa8('0x201')](_0xefa8('0x202'),_0x4e6bb5,_0x3653f6[0x0]);}else{_0x56c789['checkIsBlackList'](_[_0xefa8('0xcd')](_0x3653f6[0x0],['VoiceQueueId',_0xefa8('0x203')]))[_0xefa8('0x3e')](_0x56c789[_0xefa8('0x1ee')](_0x4e6bb5,_0x3653f6[0x0]))['catch'](_0x56c789['loggerHandler'](_0xefa8('0x20f'),_0x4e6bb5));}}})[_0xefa8('0xae')](loggerGetContactDialer(_0xefa8('0x210'),_0x4e6bb5,0x1));emitVoiceQueueSummary(_0x4e6bb5);};Dialer[_0xefa8('0x1e')][_0xefa8('0x1e4')]=function(_0x4061ec,_0x392090,_0x2cabf4,_0x194c92,_0x300ae1,_0x598298){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x211'),_0x4061ec);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x212'),_0x392090);loggerPredictive[_0xefa8('0x7c')]('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',_0x2cabf4);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x213'),_0x194c92);loggerPredictive[_0xefa8('0x7c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x300ae1);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x83'));return new BPromise(function(_0x5fb1ed,_0x6bf03c){if(_0x4061ec<=0x0||isNaN(_0x4061ec)){return _0x6bf03c(msgResponse(_0xefa8('0x214'),_0xefa8('0x4d'),_0xefa8('0x215')+_0x4061ec));}if(_0x2cabf4<=0x0||isNaN(_0x2cabf4)){return _0x6bf03c(msgResponse(_0xefa8('0x214'),_0xefa8('0x4d'),'Ts\x20=\x20'+_0x2cabf4));}if(_0x194c92<=0x0||isNaN(_0x194c92)){return _0x6bf03c(msgResponse(_0xefa8('0x214'),_0xefa8('0x4d'),_0xefa8('0x216')+_0x194c92));}if(_0x392090<=0x0||isNaN(_0x392090)){return _0x6bf03c(msgResponse('[abandonmentRate]',_0xefa8('0x4d'),_0xefa8('0x217')+_0x392090));}if(_0x300ae1<=0x0||isNaN(_0x300ae1)){return _0x6bf03c(msgResponse(_0xefa8('0x214'),_0xefa8('0x4d'),_0xefa8('0x218')+_0x300ae1));}_0x598298=_0x598298||0x0;var _0x5a9599=0x1/_0x2cabf4;var _0x3081a4=0x0;var _0x4f3ec5=0x0;var _0x2c8468=0x0;var _0x55d4c1=0x0;for(var _0x3359c9=0x0;_0x2c8468<_0x300ae1;_0x3359c9+=0x1){_0x4f3ec5=_0x3359c9/_0x392090;_0x3081a4=(_0x194c92*_0x4f3ec5+_0x598298)/_0x5a9599;_0x2c8468=erlangb(_0x3081a4,_0x4061ec);_0x55d4c1=_0x3081a4/_0x4061ec*(0x1-erlangb(_0x3081a4,_0x4061ec));}return _0x5fb1ed({'erlangCalls':_0x3359c9,'erlangCallToSecond':_0x392090/_0x3359c9,'erlangAbandonmentRate':_0x2c8468,'erlangBusyFactor':_0x55d4c1});});};Dialer[_0xefa8('0x1e')]['busyFactor']=function(_0x34a7b1,_0x25a124,_0x81219b,_0xcd95d8,_0x2bdc48,_0xc29aee){loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x219'));loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x34a7b1);loggerPredictive[_0xefa8('0x7c')](_0xefa8('0x212'),_0x25a124);loggerPredictive['info'](_0xefa8('0x21a'),_0x81219b);loggerPredictive['info']('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',_0xcd95d8);loggerPredictive[_0xefa8('0x7c')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2bdc48);loggerPredictive[_0xefa8('0x7c')]('---------------------------');return new BPromise(function(_0x6ea5f7,_0x4eeb90){if(_0x34a7b1<=0x0||isNaN(_0x34a7b1)){return _0x4eeb90(msgResponse(_0xefa8('0x21b'),'Error',_0xefa8('0x215')+_0x34a7b1));}if(_0x81219b<=0x0||isNaN(_0x81219b)){return _0x4eeb90(msgResponse(_0xefa8('0x21b'),_0xefa8('0x4d'),'Ts\x20=\x20'+_0x81219b));}if(_0xcd95d8<=0x0||isNaN(_0xcd95d8)){return _0x4eeb90(msgResponse(_0xefa8('0x21b'),'Error',_0xefa8('0x216')+_0xcd95d8));}if(_0x25a124<=0x0||isNaN(_0x25a124)){return _0x4eeb90(msgResponse(_0xefa8('0x21b'),_0xefa8('0x4d'),_0xefa8('0x217')+_0x25a124));}if(_0x2bdc48<=0x0||isNaN(_0x2bdc48)){return _0x4eeb90(msgResponse(_0xefa8('0x21b'),_0xefa8('0x4d'),_0xefa8('0x21c')+_0x2bdc48));}_0xc29aee=_0xc29aee||0x0;var _0x446a2e=0x1/_0x81219b;var _0x409cdc=0x0;var _0x1e4fc8=0x0;var _0x37fb6f=0x0;var _0x5b8bc6=0x0;for(var _0xcf44b4=0x0;_0x5b8bc6<_0x2bdc48;_0xcf44b4+=0x1){_0x1e4fc8=_0xcf44b4/_0x25a124;_0x409cdc=(_0xcd95d8*_0x1e4fc8+_0xc29aee)/_0x446a2e;_0x37fb6f=erlangb(_0x409cdc,_0x34a7b1);_0x5b8bc6=_0x409cdc/_0x34a7b1*(0x1-erlangb(_0x409cdc,_0x34a7b1));}return _0x6ea5f7({'erlangCalls':_0xcf44b4,'erlangCallToSecond':_0x25a124/_0xcf44b4,'erlangAbandonmentRate':_0x37fb6f,'erlangBusyFactor':_0x5b8bc6});});};module[_0xefa8('0x21d')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 61a933a..6a451ef 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 _0xede7=['name','calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x5bf7ab,_0x2094d7){var _0x2f0ad9=function(_0x2c5a29){while(--_0x2c5a29){_0x5bf7ab['push'](_0x5bf7ab['shift']());}};_0x2f0ad9(++_0x2094d7);}(_0xede7,0xcc));var _0x7ede=function(_0x4a0b1f,_0x14e63e){_0x4a0b1f=_0x4a0b1f-0x0;var _0x4afbfa=_0xede7[_0x4a0b1f];return _0x4afbfa;};'use strict';var util=require(_0x7ede('0x0'));var _=require('lodash');var moment=require(_0x7ede('0x1'));function getSeconds(_0x129d5f,_0x46f92c){var _0x173082=moment(_0x129d5f)['milliseconds'](0x0);var _0x582515=moment(_0x46f92c)[_0x7ede('0x2')](0x0);return _0x173082[_0x7ede('0x3')](_0x582515,_0x7ede('0x4'));}function QueueCallerAbandon(_0xff75c2,_0x550e3b){this[_0x7ede('0x5')]=_0xff75c2[_0x7ede('0x5')];this['type']=_0xff75c2[_0x7ede('0x6')];this[_0x7ede('0x7')]=_0xff75c2[_0x7ede('0x6')]===_0x7ede('0x8')?_0x7ede('0x9'):_0xff75c2[_0x7ede('0x6')];this['countbusyretry']=_0xff75c2[_0x7ede('0xa')];this['countcongestionretry']=_0xff75c2[_0x7ede('0xb')];this[_0x7ede('0xc')]=_0xff75c2[_0x7ede('0xc')];this[_0x7ede('0xd')]=_0xff75c2[_0x7ede('0xa')]+_0xff75c2['countcongestionretry']+_0xff75c2[_0x7ede('0xc')]+_0xff75c2[_0x7ede('0xe')]+_0xff75c2[_0x7ede('0xf')]+_0xff75c2[_0x7ede('0x10')]+_0xff75c2[_0x7ede('0x11')]+_0xff75c2[_0x7ede('0x12')];this['countnosuchnumberretry']=_0xff75c2[_0x7ede('0xe')];this[_0x7ede('0xf')]=_0xff75c2[_0x7ede('0xf')];this['countabandonedretry']=_0xff75c2['countabandonedretry'];this[_0x7ede('0x11')]=_0xff75c2[_0x7ede('0x11')];this[_0x7ede('0x12')]=_0xff75c2[_0x7ede('0x12')];this['uniqueid']=_0x550e3b[_0x7ede('0x13')];this[_0x7ede('0x14')]=_0xff75c2[_0x7ede('0x15')];this[_0x7ede('0x16')]=_0xff75c2[_0x7ede('0x17')];this['starttime']=_0xff75c2[_0x7ede('0x18')];this['responsetime']=_0xff75c2['responsetime'];this[_0x7ede('0x19')]=_0xff75c2[_0x7ede('0x19')];this[_0x7ede('0x1a')]=this[_0x7ede('0x19')];this[_0x7ede('0x1b')]=getSeconds(_0xff75c2[_0x7ede('0x1c')],_0xff75c2['starttime']);this[_0x7ede('0x1d')]=getSeconds(this[_0x7ede('0x19')],_0xff75c2[_0x7ede('0x1c')]);this[_0x7ede('0x1e')]=0x0;this[_0x7ede('0x9')]=_0x550e3b[_0x7ede('0x9')];this[_0x7ede('0x1f')]=_0x550e3b[_0x7ede('0x20')];this[_0x7ede('0x21')]=_0x550e3b['reason'];this[_0x7ede('0x22')]=_0xff75c2[_0x7ede('0x22')];this[_0x7ede('0x23')]=_0xff75c2[_0x7ede('0x23')];this['callbackat']=_0xff75c2['callbackat'];this[_0x7ede('0x24')]=_0xff75c2['recallme'];this[_0x7ede('0x25')]=_0xff75c2[_0x7ede('0x25')];this[_0x7ede('0x26')]=_0xff75c2['ListId'];this['UserId']=_0xff75c2[_0x7ede('0x27')];this[_0x7ede('0x28')]=_0xff75c2[_0x7ede('0x28')];this[_0x7ede('0x29')]=_0xff75c2['CampaignId'];this['originatecalleridnum']=_0xff75c2[_0x7ede('0x2a')]||'';this['originatecalleridname']=_0xff75c2[_0x7ede('0x2b')]||'';}module[_0x7ede('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0xd1b2=['responsetime','droptime','endtime','ringtime','holdtime','queue','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0xd1b2,0x10f));var _0x2d1b=function(_0x3cb3c8,_0x2a2e93){_0x3cb3c8=_0x3cb3c8-0x0;var _0x1e1868=_0xd1b2[_0x3cb3c8];return _0x1e1868;};'use strict';var util=require('util');var _=require(_0x2d1b('0x0'));var moment=require(_0x2d1b('0x1'));function getSeconds(_0x434a48,_0xd397f1){var _0x2ad669=moment(_0x434a48)['milliseconds'](0x0);var _0x25bc3e=moment(_0xd397f1)[_0x2d1b('0x2')](0x0);return _0x2ad669[_0x2d1b('0x3')](_0x25bc3e,_0x2d1b('0x4'));}function QueueCallerAbandon(_0x5c74ad,_0x1a5f7e){this[_0x2d1b('0x5')]=_0x5c74ad[_0x2d1b('0x5')];this[_0x2d1b('0x6')]=_0x5c74ad[_0x2d1b('0x6')];this[_0x2d1b('0x7')]=_0x5c74ad[_0x2d1b('0x6')]===_0x2d1b('0x8')?'queue':_0x5c74ad[_0x2d1b('0x6')];this[_0x2d1b('0x9')]=_0x5c74ad[_0x2d1b('0x9')];this[_0x2d1b('0xa')]=_0x5c74ad['countcongestionretry'];this[_0x2d1b('0xb')]=_0x5c74ad[_0x2d1b('0xb')];this['countglobal']=_0x5c74ad[_0x2d1b('0x9')]+_0x5c74ad[_0x2d1b('0xa')]+_0x5c74ad[_0x2d1b('0xb')]+_0x5c74ad[_0x2d1b('0xc')]+_0x5c74ad[_0x2d1b('0xd')]+_0x5c74ad[_0x2d1b('0xe')]+_0x5c74ad[_0x2d1b('0xf')]+_0x5c74ad[_0x2d1b('0x10')];this[_0x2d1b('0xc')]=_0x5c74ad[_0x2d1b('0xc')];this[_0x2d1b('0xd')]=_0x5c74ad[_0x2d1b('0xd')];this[_0x2d1b('0xe')]=_0x5c74ad[_0x2d1b('0xe')];this[_0x2d1b('0xf')]=_0x5c74ad[_0x2d1b('0xf')];this[_0x2d1b('0x10')]=_0x5c74ad[_0x2d1b('0x10')];this['uniqueid']=_0x1a5f7e[_0x2d1b('0x11')];this[_0x2d1b('0x12')]=_0x5c74ad[_0x2d1b('0x13')];this[_0x2d1b('0x14')]=_0x5c74ad[_0x2d1b('0x15')];this[_0x2d1b('0x16')]=_0x5c74ad[_0x2d1b('0x16')];this['responsetime']=_0x5c74ad[_0x2d1b('0x17')];this[_0x2d1b('0x18')]=_0x5c74ad[_0x2d1b('0x18')];this[_0x2d1b('0x19')]=this[_0x2d1b('0x18')];this[_0x2d1b('0x1a')]=getSeconds(_0x5c74ad['responsetime'],_0x5c74ad[_0x2d1b('0x16')]);this[_0x2d1b('0x1b')]=getSeconds(this[_0x2d1b('0x18')],_0x5c74ad[_0x2d1b('0x17')]);this['talktime']=0x0;this[_0x2d1b('0x1c')]=_0x1a5f7e[_0x2d1b('0x1c')];this['membername']=_0x1a5f7e[_0x2d1b('0x1d')];this[_0x2d1b('0x1e')]=_0x1a5f7e[_0x2d1b('0x1e')];this['callback']=_0x5c74ad[_0x2d1b('0x1f')];this[_0x2d1b('0x20')]=_0x5c74ad['callbackuniqueid'];this[_0x2d1b('0x21')]=_0x5c74ad[_0x2d1b('0x21')];this[_0x2d1b('0x22')]=_0x5c74ad[_0x2d1b('0x22')];this[_0x2d1b('0x23')]=_0x5c74ad['ContactId'];this[_0x2d1b('0x24')]=_0x5c74ad[_0x2d1b('0x24')];this[_0x2d1b('0x25')]=_0x5c74ad[_0x2d1b('0x25')];this[_0x2d1b('0x26')]=_0x5c74ad[_0x2d1b('0x26')];this[_0x2d1b('0x27')]=_0x5c74ad['CampaignId'];this[_0x2d1b('0x28')]=_0x5c74ad[_0x2d1b('0x28')]||'';this[_0x2d1b('0x29')]=_0x5c74ad[_0x2d1b('0x29')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 7373017..3cb431d 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(_0x5c47a6,_0x3a6f8d){var _0x4d34d1=function(_0x28f49f){while(--_0x28f49f){_0x5c47a6['push'](_0x5c47a6['shift']());}};_0x4d34d1(++_0x3a6f8d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x235a78,_0x5605e9){var _0x3ac47f=function(_0x45419c){while(--_0x45419c){_0x235a78['push'](_0x235a78['shift']());}};_0x3ac47f(++_0x5605e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 c1c4381..d51145c 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 _0xb7e7=['resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','actions','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','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','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','bluebird','moment','tiff2pdf','../../../config/logger','fax','../ami','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','channelstate','channelstatedesc','variable','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0x3a5847,_0x467d3b){var _0x2a202a=function(_0x2d9f74){while(--_0x2d9f74){_0x3a5847['push'](_0x3a5847['shift']());}};_0x2a202a(++_0x467d3b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var util=require(_0x7b7e('0x0'));var _=require('lodash');var BPromise=require(_0x7b7e('0x1'));var uuid=require('uuid');var moment=require(_0x7b7e('0x2'));var path=require('path');var tiff2pdf=require(_0x7b7e('0x3'));var gs=require('./util/gs');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var ami=require(_0x7b7e('0x6'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x7b7e('0x7'));var Action=require(_0x7b7e('0x8'));var faxAccount=require(_0x7b7e('0x9'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x7b7e('0xa'));function Fax(_0x223587){this[_0x7b7e('0xb')]={};this[_0x7b7e('0xc')]=_0x223587[_0x7b7e('0xc')];this[_0x7b7e('0xd')]=_0x223587[_0x7b7e('0xd')];this['actions']={};ami['on'](_0x7b7e('0xe'),this[_0x7b7e('0xf')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x11'),this[_0x7b7e('0x12')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x13'),this[_0x7b7e('0x14')][_0x7b7e('0x10')](this));ami['on']('newexten',this[_0x7b7e('0x15')][_0x7b7e('0x10')](this));ami['on']('faxstatus',this[_0x7b7e('0x16')]['bind'](this));ami['on']('receivefax',this[_0x7b7e('0x17')][_0x7b7e('0x10')](this));ami['on'](_0x7b7e('0x18'),this[_0x7b7e('0x19')][_0x7b7e('0x10')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x7b7e('0x10')](this));}Fax[_0x7b7e('0x1a')][_0x7b7e('0xf')]=function(_0x26aaec){if(_0x26aaec[_0x7b7e('0x1b')]===_0x7b7e('0x1c')){for(var _0x242368 in this[_0x7b7e('0xc')]){if(this[_0x7b7e('0xc')][_0x7b7e('0x1d')](_0x242368)){if(_0x26aaec[_0x7b7e('0x1e')]===this[_0x7b7e('0xc')][_0x242368][_0x7b7e('0x1f')]){this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]={};this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['channel']=_0x26aaec[_0x7b7e('0x21')];this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['id']=this['faxAccounts'][_0x242368]['id'];this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]][_0x7b7e('0x22')]=this[_0x7b7e('0xc')][_0x242368][_0x7b7e('0x22')];logger[_0x7b7e('0x23')](_0x26aaec[_0x7b7e('0x20')],_0x7b7e('0x24'));}}}}if(this['actions'][_0x26aaec['uniqueid']]){this['channels'][_0x26aaec[_0x7b7e('0x20')]]={};this[_0x7b7e('0xb')][_0x26aaec[_0x7b7e('0x20')]]['channel']=_0x26aaec['channel'];logger['info'](_0x26aaec[_0x7b7e('0x20')],_0x7b7e('0x24'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x12')]=function(_0x3ceaf5){if(this['channels'][_0x3ceaf5[_0x7b7e('0x20')]]){for(var _0x21a15 in _0x3ceaf5['variable']){if(_0x3ceaf5['variable']['hasOwnProperty'](_0x21a15)){this[_0x7b7e('0xb')][_0x3ceaf5[_0x7b7e('0x20')]][_0x21a15]=_0x3ceaf5['value'];}}}};Fax[_0x7b7e('0x1a')]['syncNewState']=function(_0x1b4341){if(this[_0x7b7e('0xb')][_0x1b4341[_0x7b7e('0x20')]]){this['channels'][_0x1b4341[_0x7b7e('0x20')]][_0x7b7e('0x25')]=_0x1b4341[_0x7b7e('0x25')];this[_0x7b7e('0xb')][_0x1b4341[_0x7b7e('0x20')]]['channelstatedesc']=_0x1b4341[_0x7b7e('0x26')];}};Fax['prototype'][_0x7b7e('0x15')]=function(_0x1c7de4){if(this[_0x7b7e('0xb')][_0x1c7de4[_0x7b7e('0x20')]]){for(var _0x378faa in _0x1c7de4[_0x7b7e('0x27')]){if(_0x1c7de4[_0x7b7e('0x27')]['hasOwnProperty'](_0x378faa)){this['channels'][_0x1c7de4[_0x7b7e('0x20')]][_0x378faa]=_0x1c7de4[_0x7b7e('0x28')];}}}};Fax['prototype'][_0x7b7e('0x16')]=function(_0x2a4754){if(this[_0x7b7e('0xb')][_0x2a4754['uniqueid']]){this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x29')]=_0x2a4754[_0x7b7e('0x29')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x2a')]=_0x2a4754[_0x7b7e('0x2a')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x1f')]=_0x2a4754[_0x7b7e('0x1f')];this[_0x7b7e('0xb')][_0x2a4754[_0x7b7e('0x20')]][_0x7b7e('0x2b')]=_0x2a4754[_0x7b7e('0x2b')];logger['info'](_0x2a4754[_0x7b7e('0x20')],_0x7b7e('0x2c'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x17')]=function(_0x36abfc){var _0x909c65=this;if(this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]]){var _0x1c6d11=this[_0x7b7e('0xb')][_0x36abfc['uniqueid']]['id'];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2d')]=_0x36abfc[_0x7b7e('0x2d')];this['channels'][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2e')]=_0x36abfc[_0x7b7e('0x2e')];this['channels'][_0x36abfc['uniqueid']][_0x7b7e('0x1f')]=_0x36abfc['localstationid'];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]]['resolution']=_0x36abfc[_0x7b7e('0x2f')];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x30')]=_0x36abfc[_0x7b7e('0x30')];this[_0x7b7e('0xb')][_0x36abfc[_0x7b7e('0x20')]][_0x7b7e('0x2b')]=_0x36abfc[_0x7b7e('0x2b')];this['channels'][_0x36abfc['uniqueid']][_0x7b7e('0x31')]=_0x36abfc['calleridnum'];if(this[_0x7b7e('0xb')][_0x36abfc['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x36abfc[_0x7b7e('0x2b')],'/var/opt/motion2/server/files/attachments/',function(_0x2f9982){logger['info'](_0x36abfc[_0x7b7e('0x20')],_0x7b7e('0x32'),_0x2f9982[_0x7b7e('0x33')]);attachment[_0x7b7e('0x34')]({'name':path['parse'](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')],'basename':path[_0x7b7e('0x35')](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')]+_0x7b7e('0x36'),'type':'application/pdf'})['then'](function(_0x5827f7){faxAccount[_0x7b7e('0x37')](_0x1c6d11,{'from':_0x36abfc[_0x7b7e('0x31')],'mapKey':_0x7b7e('0x5'),'body':path[_0x7b7e('0x35')](_0x36abfc[_0x7b7e('0x2b')])[_0x7b7e('0x22')]+'.pdf','AttachmentId':_0x5827f7['id']})[_0x7b7e('0x38')](function(_0x42e560){logger['error'](_0x36abfc['uniqueid'],_0x7b7e('0x39'),JSON[_0x7b7e('0x3a')](_0x42e560));});})[_0x7b7e('0x38')](function(_0x378a29){logger[_0x7b7e('0x3b')](_0x36abfc[_0x7b7e('0x20')],'\x20receiveFax\x20',JSON[_0x7b7e('0x3a')](_0x378a29));});});}logger['info'](_0x36abfc[_0x7b7e('0x20')],_0x7b7e('0x3c'));}};Fax[_0x7b7e('0x1a')][_0x7b7e('0x3d')]=function(_0x58e4e6){if(this[_0x7b7e('0x3e')][_0x58e4e6[_0x7b7e('0x20')]]){_[_0x7b7e('0x3f')](this[_0x7b7e('0xb')][_0x58e4e6[_0x7b7e('0x20')]],_['pick'](_0x58e4e6,[_0x7b7e('0x40'),_0x7b7e('0x41')]));}};function updateStatus(_0x21868a){if(_0x21868a[_0x7b7e('0x42')]){faxMessage[_0x7b7e('0x43')](_0x21868a['AttachmentId'],{'failMessage':_0x7b7e('0x44')})[_0x7b7e('0x45')](function(_0x46d4ee){ut[_0x7b7e('0x46')](_0x7b7e('0x47'),_0x46d4ee);})[_0x7b7e('0x38')](function(_0x210768){ut['logger'](_0x7b7e('0x48'),_0x210768);});}else{ut['logger'](_0x7b7e('0x49'));}}Fax[_0x7b7e('0x1a')]['updateStatus']=function(_0x36f1be,_0x44e3a0,_0x16c81d){var _0x3afe88=this;var _0x412d1b={};if(_0x44e3a0){_0x412d1b={'read':_0x44e3a0};}else{_0x412d1b={'failMessage':_0x16c81d};}if(this[_0x7b7e('0x3e')][_0x36f1be][_0x7b7e('0x42')]){faxMessage['update'](this[_0x7b7e('0x3e')][_0x36f1be][_0x7b7e('0x42')],_0x412d1b)[_0x7b7e('0x45')](function(_0x24481a){ut['logger']('[Fax][Message][Updated]',_0x24481a);})['catch'](function(_0x2471ad){ut[_0x7b7e('0x46')](_0x7b7e('0x4a'),_0x2471ad);})['finally'](function(){delete _0x3afe88['channels'][_0x36f1be];delete _0x3afe88[_0x7b7e('0x3e')][_0x36f1be];});}else{ut[_0x7b7e('0x46')]('[Fax][Message][NoUpdate2]');delete this[_0x7b7e('0xb')][_0x36f1be];delete this[_0x7b7e('0x3e')][_0x36f1be];}};Fax[_0x7b7e('0x1a')]['syncHangup']=function(_0x2b0657){var _0x1d9af5=this;if(this['channels'][_0x2b0657[_0x7b7e('0x20')]]){if(this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]){this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['id']=this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]['id'];this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['name']=this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]['name'];}logger[_0x7b7e('0x23')](_0x2b0657[_0x7b7e('0x20')],this[_0x7b7e('0x3e')][_0x2b0657['uniqueid']]?_0x7b7e('0x4b'):'\x20hangup\x20faxRiceive\x20',JSON[_0x7b7e('0x3a')](this[_0x7b7e('0xb')][_0x2b0657['uniqueid']]));if(this[_0x7b7e('0x3e')][_0x2b0657[_0x7b7e('0x20')]]){if(this['channels'][_0x2b0657[_0x7b7e('0x20')]][_0x7b7e('0x4c')]>0x0&&this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]]['faxstatus']===_0x7b7e('0x4d')){this[_0x7b7e('0x4e')](_0x2b0657[_0x7b7e('0x20')],!![]);}else{this[_0x7b7e('0x4e')](_0x2b0657[_0x7b7e('0x20')],![],this[_0x7b7e('0xb')][_0x2b0657[_0x7b7e('0x20')]][_0x7b7e('0x4f')]?_0x7b7e('0x50')+this[_0x7b7e('0xb')][_0x2b0657['uniqueid']][_0x7b7e('0x4f')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x7b7e('0x51')]=function(_0x7cbe6c){var _0x1eb4b1=this;return new BPromise(function(_0x3dfd33,_0x5cd4ae){_0x1eb4b1[_0x7b7e('0x52')](_0x7cbe6c,_0x1eb4b1[_0x7b7e('0xc')][_0x7cbe6c[_0x7b7e('0x53')]])[_0x7b7e('0x45')](function(_0x169540){ut[_0x7b7e('0x46')]('[Fax][execOriginate][success]',_0x169540);_0x3dfd33(ut[_0x7b7e('0x33')]('Fax\x20received'));})['catch'](function(_0x43a61b){ut['logger'](_0x7b7e('0x54'),_0x43a61b);updateStatus(_0x7cbe6c);_0x5cd4ae(ut['message'](_0x7b7e('0x55')));});});};Fax[_0x7b7e('0x1a')]['checkAfterSend']=function(_0x2c167d){var _0x2da71e=this;return new BPromise(function(_0x57e88f,_0x106a16){var _0x27a552=_0x2da71e[_0x7b7e('0x56')](_0x2da71e[_0x7b7e('0xc')][_0x2c167d[_0x7b7e('0x53')]][_0x7b7e('0x57')],_0x2c167d);if(_0x27a552[_0x7b7e('0x58')]){_0x57e88f(ut[_0x7b7e('0x33')](_0x7b7e('0x59')));}else{_0x106a16(ut[_0x7b7e('0x33')](_0x27a552['message']));}});};function originate(_0x59ecf9,_0x34e7df,_0x46ac1f){return new BPromise(function(_0x2c6e3a,_0x348c77){if(_0x46ac1f){var _0xea39fa=util[_0x7b7e('0x5a')](_0x7b7e('0x5b'),path['parse'](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x22')],_0x59ecf9['path']);gs[_0x7b7e('0x5d')](_0xea39fa)[_0x7b7e('0x45')](function(){_0x59ecf9[_0x7b7e('0x5c')]=util[_0x7b7e('0x5a')](_0x7b7e('0x5e'),path[_0x7b7e('0x35')](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x5f')],path[_0x7b7e('0x35')](_0x59ecf9[_0x7b7e('0x5c')])[_0x7b7e('0x22')]);_0x34e7df['XMF-PATH']=_0x59ecf9[_0x7b7e('0x5c')];ut[_0x7b7e('0x46')](_0x7b7e('0x60'),'');ami[_0x7b7e('0x61')](ut[_0x7b7e('0x62')](_0x59ecf9,_0x34e7df))[_0x7b7e('0x45')](function(_0xfdd68c){_0x2c6e3a(_0xfdd68c);})['catch'](function(_0x2158b8){_0x348c77(_0x2158b8);});})[_0x7b7e('0x38')](function(_0x1eb5ce){_0x348c77(_0x1eb5ce);});}else{ami['Action'](ut[_0x7b7e('0x62')](_0x59ecf9,_0x34e7df))[_0x7b7e('0x45')](function(_0x381ee6){_0x2c6e3a(_0x381ee6);})[_0x7b7e('0x38')](function(_0x435cc9){_0x348c77(_0x435cc9);});}});}Fax['prototype']['execOriginate']=function(_0x5af831,_0x397923){var _0x8b339c=this;return new BPromise(function(_0x24c6fe,_0x518a97){var _0x37714b=uuid['v4']();var _0x23e2cc=ut[_0x7b7e('0x63')](_0x5af831,_0x397923);_0x8b339c['actions'][_0x37714b]=new Action(_0x37714b,_0x397923,_0x5af831);var _0x2983bf=_0x8b339c[_0x7b7e('0x3e')][_0x37714b];if(path[_0x7b7e('0x35')](_0x5af831[_0x7b7e('0x5c')])['ext']===_0x7b7e('0x36')){originate(_0x2983bf,_0x23e2cc,!![])[_0x7b7e('0x45')](function(_0xa52b93){_0x24c6fe(_0xa52b93);})[_0x7b7e('0x38')](function(_0x4f0745){_0x518a97(_0x4f0745);});}else{originate(_0x2983bf,_0x23e2cc,![])['then'](function(_0x2b5d20){_0x24c6fe(_0x2b5d20);})['catch'](function(_0x1ecb55){_0x518a97(_0x1ecb55);});}});};Fax[_0x7b7e('0x1a')][_0x7b7e('0x64')]=function(_0x30b703){return!_['isNil'](_0x30b703)&&!_[_0x7b7e('0x65')](_0x30b703[_0x7b7e('0x22')])&&!_[_0x7b7e('0x65')](_0x30b703[_0x7b7e('0x66')])&&_0x30b703[_0x7b7e('0x66')]&&!_[_0x7b7e('0x65')](this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])])&&!_[_0x7b7e('0x65')](this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')])&&(this['trunks'][util[_0x7b7e('0x5a')](_0x7b7e('0x67'),_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')]===_0x7b7e('0x68')||this[_0x7b7e('0xd')][util[_0x7b7e('0x5a')]('SIP/%s',_0x30b703[_0x7b7e('0x22')])][_0x7b7e('0x2a')]===_0x7b7e('0x69'));};Fax[_0x7b7e('0x1a')][_0x7b7e('0x56')]=function(_0x4b4f55,_0x51d41f){if(!this[_0x7b7e('0x64')](_0x4b4f55)){ut[_0x7b7e('0x46')](_0x7b7e('0x6a'),_[_0x7b7e('0x65')](_0x4b4f55)?'':_0x4b4f55[_0x7b7e('0x22')]+_0x7b7e('0x6b'));return{'isValid':![],'message':_0x7b7e('0x6c')};}if(_[_0x7b7e('0x65')](_0x51d41f[_0x7b7e('0x5')])){ut[_0x7b7e('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x7b7e('0x3a')](_0x51d41f));return{'isValid':![],'message':_0x7b7e('0x6d')};}if(_[_0x7b7e('0x65')](_0x51d41f[_0x7b7e('0x5c')])){ut[_0x7b7e('0x46')](_0x7b7e('0x6e'),JSON[_0x7b7e('0x3a')](_0x51d41f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x7b7e('0x6f')};};module['exports']=Fax; \ No newline at end of file +var _0x6b20=['syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','actions','\x20syncNewchannel\x20','variable','value','prototype','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','then','catch','error','\x20receiveFax\x20','stringify','merge','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','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','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind'];(function(_0x5aed69,_0x259b5e){var _0x48b0f9=function(_0x31e169){while(--_0x31e169){_0x5aed69['push'](_0x5aed69['shift']());}};_0x48b0f9(++_0x259b5e);}(_0x6b20,0xd1));var _0x06b2=function(_0x4cc24b,_0x3f6d69){_0x4cc24b=_0x4cc24b-0x0;var _0x4dad06=_0x6b20[_0x4cc24b];return _0x4dad06;};'use strict';var util=require(_0x06b2('0x0'));var _=require(_0x06b2('0x1'));var BPromise=require('bluebird');var uuid=require(_0x06b2('0x2'));var moment=require('moment');var path=require(_0x06b2('0x3'));var tiff2pdf=require(_0x06b2('0x4'));var gs=require(_0x06b2('0x5'));var logger=require('../../../config/logger')(_0x06b2('0x6'));var ami=require(_0x06b2('0x7'));var rpcDb=require(_0x06b2('0x8'));var Channel=require(_0x06b2('0x9'));var ut=require(_0x06b2('0xa'));var Action=require(_0x06b2('0xb'));var faxAccount=require(_0x06b2('0xc'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x06b2('0xd'));function Fax(_0x1828e4){this[_0x06b2('0xe')]={};this['faxAccounts']=_0x1828e4[_0x06b2('0xf')];this['trunks']=_0x1828e4[_0x06b2('0x10')];this['actions']={};ami['on']('newchannel',this[_0x06b2('0x11')][_0x06b2('0x12')](this));ami['on']('varset',this[_0x06b2('0x13')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x14'),this[_0x06b2('0x15')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x16'),this[_0x06b2('0x17')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x18'),this[_0x06b2('0x19')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x1a'),this[_0x06b2('0x1b')]['bind'](this));ami['on'](_0x06b2('0x1c'),this[_0x06b2('0x1d')][_0x06b2('0x12')](this));ami['on'](_0x06b2('0x1e'),this[_0x06b2('0x1f')][_0x06b2('0x12')](this));}Fax['prototype'][_0x06b2('0x11')]=function(_0x3f2a53){if(_0x3f2a53['context']===_0x06b2('0x20')){for(var _0x594b48 in this['faxAccounts']){if(this[_0x06b2('0xf')][_0x06b2('0x21')](_0x594b48)){if(_0x3f2a53[_0x06b2('0x22')]===this[_0x06b2('0xf')][_0x594b48]['localstationid']){this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]]={};this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]][_0x06b2('0x24')]=_0x3f2a53[_0x06b2('0x24')];this[_0x06b2('0xe')][_0x3f2a53['uniqueid']]['id']=this[_0x06b2('0xf')][_0x594b48]['id'];this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]][_0x06b2('0x25')]=this['faxAccounts'][_0x594b48]['name'];logger[_0x06b2('0x26')](_0x3f2a53[_0x06b2('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0x06b2('0x27')][_0x3f2a53['uniqueid']]){this[_0x06b2('0xe')][_0x3f2a53[_0x06b2('0x23')]]={};this[_0x06b2('0xe')][_0x3f2a53['uniqueid']][_0x06b2('0x24')]=_0x3f2a53[_0x06b2('0x24')];logger[_0x06b2('0x26')](_0x3f2a53[_0x06b2('0x23')],_0x06b2('0x28'));}};Fax['prototype'][_0x06b2('0x13')]=function(_0x34370b){if(this[_0x06b2('0xe')][_0x34370b[_0x06b2('0x23')]]){for(var _0x1976ac in _0x34370b[_0x06b2('0x29')]){if(_0x34370b['variable'][_0x06b2('0x21')](_0x1976ac)){this[_0x06b2('0xe')][_0x34370b[_0x06b2('0x23')]][_0x1976ac]=_0x34370b[_0x06b2('0x2a')];}}}};Fax[_0x06b2('0x2b')][_0x06b2('0x15')]=function(_0x3668bb){if(this['channels'][_0x3668bb[_0x06b2('0x23')]]){this[_0x06b2('0xe')][_0x3668bb[_0x06b2('0x23')]][_0x06b2('0x2c')]=_0x3668bb[_0x06b2('0x2c')];this[_0x06b2('0xe')][_0x3668bb[_0x06b2('0x23')]][_0x06b2('0x2d')]=_0x3668bb['channelstatedesc'];}};Fax[_0x06b2('0x2b')][_0x06b2('0x17')]=function(_0x259e3d){if(this[_0x06b2('0xe')][_0x259e3d[_0x06b2('0x23')]]){for(var _0x422393 in _0x259e3d[_0x06b2('0x29')]){if(_0x259e3d['variable']['hasOwnProperty'](_0x422393)){this[_0x06b2('0xe')][_0x259e3d[_0x06b2('0x23')]][_0x422393]=_0x259e3d[_0x06b2('0x2a')];}}}};Fax['prototype'][_0x06b2('0x19')]=function(_0x25ec1a){if(this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]){this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]['operation']=_0x25ec1a[_0x06b2('0x2e')];this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]]['status']=_0x25ec1a[_0x06b2('0x2f')];this[_0x06b2('0xe')][_0x25ec1a['uniqueid']][_0x06b2('0x30')]=_0x25ec1a[_0x06b2('0x30')];this[_0x06b2('0xe')][_0x25ec1a[_0x06b2('0x23')]][_0x06b2('0x31')]=_0x25ec1a[_0x06b2('0x31')];logger[_0x06b2('0x26')](_0x25ec1a[_0x06b2('0x23')],_0x06b2('0x32'));}};Fax[_0x06b2('0x2b')][_0x06b2('0x1b')]=function(_0x1cc7b6){var _0x5ec05d=this;if(this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]){var _0x4a4146=this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]['id'];this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']][_0x06b2('0x33')]=_0x1cc7b6[_0x06b2('0x33')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x34')]=_0x1cc7b6['pagestransferred'];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x30')]=_0x1cc7b6[_0x06b2('0x30')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]]['resolution']=_0x1cc7b6[_0x06b2('0x35')];this[_0x06b2('0xe')][_0x1cc7b6['uniqueid']]['transferrate']=_0x1cc7b6[_0x06b2('0x36')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x31')]=_0x1cc7b6[_0x06b2('0x31')];this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x37')]=_0x1cc7b6[_0x06b2('0x37')];if(this[_0x06b2('0xe')][_0x1cc7b6[_0x06b2('0x23')]][_0x06b2('0x34')]>0x0){tiff2pdf(_0x1cc7b6[_0x06b2('0x31')],_0x06b2('0x38'),function(_0x262c93){logger[_0x06b2('0x26')](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x39'),_0x262c93[_0x06b2('0x3a')]);attachment['create']({'name':path[_0x06b2('0x3b')](_0x1cc7b6[_0x06b2('0x31')])[_0x06b2('0x25')],'basename':path[_0x06b2('0x3b')](_0x1cc7b6['filename'])[_0x06b2('0x25')]+_0x06b2('0x3c'),'type':'application/pdf'})[_0x06b2('0x3d')](function(_0x2e3a85){faxAccount['notify'](_0x4a4146,{'from':_0x1cc7b6[_0x06b2('0x37')],'mapKey':_0x06b2('0x6'),'body':path['parse'](_0x1cc7b6['filename'])['name']+_0x06b2('0x3c'),'AttachmentId':_0x2e3a85['id']})[_0x06b2('0x3e')](function(_0x4448bb){logger[_0x06b2('0x3f')](_0x1cc7b6[_0x06b2('0x23')],'\x20notify\x20',JSON['stringify'](_0x4448bb));});})[_0x06b2('0x3e')](function(_0x3d89c2){logger[_0x06b2('0x3f')](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x40'),JSON[_0x06b2('0x41')](_0x3d89c2));});});}logger['info'](_0x1cc7b6[_0x06b2('0x23')],_0x06b2('0x40'));}};Fax[_0x06b2('0x2b')][_0x06b2('0x1f')]=function(_0x146c5c){if(this[_0x06b2('0x27')][_0x146c5c['uniqueid']]){_[_0x06b2('0x42')](this[_0x06b2('0xe')][_0x146c5c[_0x06b2('0x23')]],_[_0x06b2('0x43')](_0x146c5c,['response',_0x06b2('0x44')]));}};function updateStatus(_0x17d138){if(_0x17d138[_0x06b2('0x45')]){faxMessage[_0x06b2('0x46')](_0x17d138['AttachmentId'],{'failMessage':_0x06b2('0x47')})[_0x06b2('0x3d')](function(_0x36329e){ut[_0x06b2('0x48')](_0x06b2('0x49'),_0x36329e);})[_0x06b2('0x3e')](function(_0x3ea829){ut[_0x06b2('0x48')]('[Fax][Message][Error][NoUpdate1]',_0x3ea829);});}else{ut[_0x06b2('0x48')](_0x06b2('0x4a'));}}Fax[_0x06b2('0x2b')][_0x06b2('0x4b')]=function(_0x2857d5,_0x2f75a0,_0x4fba4c){var _0x5db1cc=this;var _0x1bf9e7={};if(_0x2f75a0){_0x1bf9e7={'read':_0x2f75a0};}else{_0x1bf9e7={'failMessage':_0x4fba4c};}if(this['actions'][_0x2857d5]['AttachmentId']){faxMessage[_0x06b2('0x46')](this['actions'][_0x2857d5][_0x06b2('0x45')],_0x1bf9e7)[_0x06b2('0x3d')](function(_0x18a927){ut[_0x06b2('0x48')](_0x06b2('0x4c'),_0x18a927);})[_0x06b2('0x3e')](function(_0x4664c2){ut[_0x06b2('0x48')](_0x06b2('0x4d'),_0x4664c2);})[_0x06b2('0x4e')](function(){delete _0x5db1cc['channels'][_0x2857d5];delete _0x5db1cc['actions'][_0x2857d5];});}else{ut[_0x06b2('0x48')](_0x06b2('0x4f'));delete this['channels'][_0x2857d5];delete this[_0x06b2('0x27')][_0x2857d5];}};Fax[_0x06b2('0x2b')][_0x06b2('0x1d')]=function(_0x36f2a8){var _0x5d725f=this;if(this['channels'][_0x36f2a8['uniqueid']]){if(this[_0x06b2('0x27')][_0x36f2a8['uniqueid']]){this['channels'][_0x36f2a8[_0x06b2('0x23')]]['id']=this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]['id'];this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x25')]=this['actions'][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x25')];}logger['info'](_0x36f2a8[_0x06b2('0x23')],this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]?_0x06b2('0x50'):_0x06b2('0x51'),JSON[_0x06b2('0x41')](this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]));if(this[_0x06b2('0x27')][_0x36f2a8[_0x06b2('0x23')]]){if(this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]['faxpages']>0x0&&this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]]['faxstatus']===_0x06b2('0x52')){this[_0x06b2('0x4b')](_0x36f2a8[_0x06b2('0x23')],!![]);}else{this[_0x06b2('0x4b')](_0x36f2a8['uniqueid'],![],this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x53')]?'SENDING\x20FAILED:\x20'+this[_0x06b2('0xe')][_0x36f2a8[_0x06b2('0x23')]][_0x06b2('0x53')]:_0x06b2('0x54'));}}}};Fax[_0x06b2('0x2b')][_0x06b2('0x55')]=function(_0x1aae55){var _0x10faea=this;return new BPromise(function(_0x2f0ca0,_0x5aae69){_0x10faea['execOriginate'](_0x1aae55,_0x10faea['faxAccounts'][_0x1aae55['FaxAccountId']])[_0x06b2('0x3d')](function(_0x4a1bf5){ut[_0x06b2('0x48')](_0x06b2('0x56'),_0x4a1bf5);_0x2f0ca0(ut[_0x06b2('0x3a')](_0x06b2('0x57')));})[_0x06b2('0x3e')](function(_0x378547){ut['logger']('[Fax][execOriginate][failure]',_0x378547);updateStatus(_0x1aae55);_0x5aae69(ut[_0x06b2('0x3a')](_0x06b2('0x58')));});});};Fax['prototype'][_0x06b2('0x59')]=function(_0xd826e9){var _0x4ea78f=this;return new BPromise(function(_0x353dd6,_0x1ac2f0){var _0x10f3e6=_0x4ea78f['checkTrunk'](_0x4ea78f[_0x06b2('0xf')][_0xd826e9['FaxAccountId']][_0x06b2('0x5a')],_0xd826e9);if(_0x10f3e6[_0x06b2('0x5b')]){_0x353dd6(ut[_0x06b2('0x3a')]('Trunk\x20Reachable'));}else{_0x1ac2f0(ut[_0x06b2('0x3a')](_0x10f3e6[_0x06b2('0x3a')]));}});};function originate(_0x461c4d,_0x4cc763,_0xc1010){return new BPromise(function(_0x4900d2,_0x15b345){if(_0xc1010){var _0x1ea5ed=util[_0x06b2('0x5c')](_0x06b2('0x5d'),path[_0x06b2('0x3b')](_0x461c4d[_0x06b2('0x3')])['name'],_0x461c4d[_0x06b2('0x3')]);gs[_0x06b2('0x5e')](_0x1ea5ed)[_0x06b2('0x3d')](function(){_0x461c4d[_0x06b2('0x3')]=util['format'](_0x06b2('0x5f'),path[_0x06b2('0x3b')](_0x461c4d[_0x06b2('0x3')])['dir'],path['parse'](_0x461c4d[_0x06b2('0x3')])['name']);_0x4cc763[_0x06b2('0x60')]=_0x461c4d['path'];ut['logger'](_0x06b2('0x61'),'');ami[_0x06b2('0x62')](ut['variablesAction'](_0x461c4d,_0x4cc763))[_0x06b2('0x3d')](function(_0x15f107){_0x4900d2(_0x15f107);})[_0x06b2('0x3e')](function(_0x305c36){_0x15b345(_0x305c36);});})[_0x06b2('0x3e')](function(_0x3542b4){_0x15b345(_0x3542b4);});}else{ami[_0x06b2('0x62')](ut[_0x06b2('0x63')](_0x461c4d,_0x4cc763))[_0x06b2('0x3d')](function(_0x333a76){_0x4900d2(_0x333a76);})[_0x06b2('0x3e')](function(_0x5028d4){_0x15b345(_0x5028d4);});}});}Fax[_0x06b2('0x2b')]['execOriginate']=function(_0x4a606b,_0x3257b9){var _0x32e2c4=this;return new BPromise(function(_0x4ff30d,_0x3c73fc){var _0x326b90=uuid['v4']();var _0x445a67=ut['addVariables'](_0x4a606b,_0x3257b9);_0x32e2c4[_0x06b2('0x27')][_0x326b90]=new Action(_0x326b90,_0x3257b9,_0x4a606b);var _0x3ff04f=_0x32e2c4['actions'][_0x326b90];if(path['parse'](_0x4a606b['path'])['ext']===_0x06b2('0x3c')){originate(_0x3ff04f,_0x445a67,!![])['then'](function(_0x1e4412){_0x4ff30d(_0x1e4412);})[_0x06b2('0x3e')](function(_0x1b1e6c){_0x3c73fc(_0x1b1e6c);});}else{originate(_0x3ff04f,_0x445a67,![])[_0x06b2('0x3d')](function(_0x18b76f){_0x4ff30d(_0x18b76f);})[_0x06b2('0x3e')](function(_0x406101){_0x3c73fc(_0x406101);});}});};Fax[_0x06b2('0x2b')][_0x06b2('0x64')]=function(_0x27c73d){return!_[_0x06b2('0x65')](_0x27c73d)&&!_[_0x06b2('0x65')](_0x27c73d[_0x06b2('0x25')])&&!_['isNil'](_0x27c73d['active'])&&_0x27c73d[_0x06b2('0x66')]&&!_[_0x06b2('0x65')](this[_0x06b2('0x10')][util[_0x06b2('0x5c')](_0x06b2('0x67'),_0x27c73d[_0x06b2('0x25')])])&&!_['isNil'](this['trunks'][util[_0x06b2('0x5c')](_0x06b2('0x67'),_0x27c73d[_0x06b2('0x25')])][_0x06b2('0x2f')])&&(this[_0x06b2('0x10')][util['format'](_0x06b2('0x67'),_0x27c73d['name'])]['status']===_0x06b2('0x68')||this[_0x06b2('0x10')][util['format']('SIP/%s',_0x27c73d[_0x06b2('0x25')])][_0x06b2('0x2f')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x512415,_0x3913cb){if(!this[_0x06b2('0x64')](_0x512415)){ut[_0x06b2('0x48')](_0x06b2('0x69'),_[_0x06b2('0x65')](_0x512415)?'':_0x512415[_0x06b2('0x25')]+_0x06b2('0x6a'));return{'isValid':![],'message':_0x06b2('0x6b')};}if(_[_0x06b2('0x65')](_0x3913cb[_0x06b2('0x6')])){ut[_0x06b2('0x48')](_0x06b2('0x6c'),JSON[_0x06b2('0x41')](_0x3913cb));return{'isValid':![],'message':_0x06b2('0x6d')};}if(_[_0x06b2('0x65')](_0x3913cb[_0x06b2('0x3')])){ut[_0x06b2('0x48')](_0x06b2('0x6e'),JSON[_0x06b2('0x41')](_0x3913cb));return{'isValid':![],'message':_0x06b2('0x6f')};}return{'isValid':!![],'message':_0x06b2('0x70')};};module[_0x06b2('0x71')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index dde6233..6f1ffaf 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 _0x001f=['lodash','../rpc/faxAccount','error','inspect','notify','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview'];(function(_0x39a16d,_0x588192){var _0x44c9d5=function(_0x2babea){while(--_0x2babea){_0x39a16d['push'](_0x39a16d['shift']());}};_0x44c9d5(++_0x588192);}(_0x001f,0x1ac));var _0xf001=function(_0x2ddd42,_0x39be46){_0x2ddd42=_0x2ddd42-0x0;var _0x189dc1=_0x001f[_0x2ddd42];return _0x189dc1;};'use strict';var util=require(_0xf001('0x0'));var BPromise=require(_0xf001('0x1'));var logger=require(_0xf001('0x2'))(_0xf001('0x3'));var _=require(_0xf001('0x4'));var faxAccount=require(_0xf001('0x5'));function loggerCatch(_0x549bd0){return function(_0x22aa02){logger[_0xf001('0x6')](_0x549bd0,util[_0xf001('0x7')](_0x22aa02,{'showHidden':![],'depth':null}));};}exports[_0xf001('0x8')]=function(_0x1d7bc6,_0x12a87f){return BPromise['resolve']()[_0xf001('0x9')](faxAccount[_0xf001('0x8')](_0x1d7bc6,_0x12a87f))[_0xf001('0xa')](loggerCatch(_0xf001('0xb')));}; \ No newline at end of file +var _0x2d89=['error','inspect','notify','resolve','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x2d89,0xbb));var _0x92d8=function(_0x3fa0ee,_0x3ba57a){_0x3fa0ee=_0x3fa0ee-0x0;var _0xdd5ac3=_0x2d89[_0x3fa0ee];return _0xdd5ac3;};'use strict';var util=require(_0x92d8('0x0'));var BPromise=require(_0x92d8('0x1'));var logger=require(_0x92d8('0x2'))('preview');var _=require(_0x92d8('0x3'));var faxAccount=require(_0x92d8('0x4'));function loggerCatch(_0x652ff0){return function(_0xfc9b37){logger[_0x92d8('0x5')](_0x652ff0,util[_0x92d8('0x6')](_0xfc9b37,{'showHidden':![],'depth':null}));};}exports[_0x92d8('0x7')]=function(_0x1ac1e9,_0x6e1eeb){return BPromise[_0x92d8('0x8')]()[_0x92d8('0x9')](faxAccount['notify'](_0x1ac1e9,_0x6e1eeb))[_0x92d8('0xa')](loggerCatch(_0x92d8('0xb')));}; \ 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 e1c32ca..009ac3d 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 _0x7b53=['bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x39dad1,_0x1021ff){var _0x1fb3e7=function(_0x7c8ad3){while(--_0x7c8ad3){_0x39dad1['push'](_0x39dad1['shift']());}};_0x1fb3e7(++_0x1021ff);}(_0x7b53,0xf1));var _0x37b5=function(_0x4cfebf,_0x296f26){_0x4cfebf=_0x4cfebf-0x0;var _0x4ee9da=_0x7b53[_0x4cfebf];return _0x4ee9da;};'use strict';var util=require('util');var logger=require(_0x37b5('0x0'))(_0x37b5('0x1'));var BPromise=require(_0x37b5('0x2'));var exec=require(_0x37b5('0x3'))[_0x37b5('0x4')];exports['execute']=function(_0x37035a){return new BPromise(function(_0xd4fdeb,_0x406c28){exec(_0x37035a,function(_0x4c38c5,_0x4e0c8b,_0x258180){logger[_0x37b5('0x5')](_0x37b5('0x6'),_0x4e0c8b);if(_0x4c38c5){logger[_0x37b5('0x5')]('Exec\x20gs',_0x37b5('0x7'),util[_0x37b5('0x8')](_0x4c38c5,{'showHidden':![],'depth':null}),_0x4e0c8b,_0x258180);_0x406c28(_0x4c38c5);}_0xd4fdeb(_0x4e0c8b);});});}; \ No newline at end of file +var _0x5d8e=['bluebird','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax'];(function(_0x4d2fe7,_0x1b8ce9){var _0x502a14=function(_0x5c14b0){while(--_0x5c14b0){_0x4d2fe7['push'](_0x4d2fe7['shift']());}};_0x502a14(++_0x1b8ce9);}(_0x5d8e,0x129));var _0xe5d8=function(_0x3faa29,_0x492728){_0x3faa29=_0x3faa29-0x0;var _0x52f9a1=_0x5d8e[_0x3faa29];return _0x52f9a1;};'use strict';var util=require(_0xe5d8('0x0'));var logger=require(_0xe5d8('0x1'))(_0xe5d8('0x2'));var BPromise=require(_0xe5d8('0x3'));var exec=require('child_process')[_0xe5d8('0x4')];exports[_0xe5d8('0x5')]=function(_0x5ab6e4){return new BPromise(function(_0xf09f4,_0x5e29a5){exec(_0x5ab6e4,function(_0x34b6e6,_0x2bf821,_0x43caf1){logger[_0xe5d8('0x6')](_0xe5d8('0x7'),_0x2bf821);if(_0x34b6e6){logger[_0xe5d8('0x6')](_0xe5d8('0x7'),_0xe5d8('0x8'),util[_0xe5d8('0x9')](_0x34b6e6,{'showHidden':![],'depth':null}),_0x2bf821,_0x43caf1);_0x5e29a5(_0x34b6e6);}_0xf09f4(_0x2bf821);});});}; \ 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 7d7b885..8ba010d 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 _0x9749=['lodash','moment','../../../../config/logger','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','faxdetect','t38timeout','localstationid','path','variablesAction','originate','xcally-motion-fax','uniqueid'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9749,0x13b));var _0x9974=function(_0x49f9f8,_0x4bca95){_0x49f9f8=_0x49f9f8-0x0;var _0x650dee=_0x9749[_0x49f9f8];return _0x650dee;};'use strict';var util=require('util');var _=require(_0x9974('0x0'));var moment=require(_0x9974('0x1'));var logger=require(_0x9974('0x2'))('fax');exports[_0x9974('0x3')]=function(_0x160319){return{'message':_0x160319};};exports[_0x9974('0x4')]=function(_0x2d7ff1,_0xf68bd4){logger[_0x9974('0x5')](_0x2d7ff1,util['inspect'](_0xf68bd4,{'showHidden':![],'depth':null}));};exports[_0x9974('0x6')]=function(_0x991b58,_0x343dab){var _0x376c2c={'XMF-ECM':_0x343dab[_0x9974('0x7')],'XMF-HEADERINFO':_0x343dab[_0x9974('0x8')],'XMF-MINRATE':_0x343dab[_0x9974('0x9')],'XMF-MAXRATE':_0x343dab[_0x9974('0xa')],'XMF-MODEM':util[_0x9974('0xb')]('\x22%s\x22',_0x343dab[_0x9974('0xc')]),'XMF-GATEWAY':_0x343dab['gateway'],'XMF-FAXDETECT':_0x343dab[_0x9974('0xd')],'XMF-T38TIMEOUT':_0x343dab[_0x9974('0xe')],'XMF-LOCALSTATIONID':_0x343dab[_0x9974('0xf')],'XMF-PATH':_0x991b58[_0x9974('0x10')]};return _0x376c2c;};exports[_0x9974('0x11')]=function(_0x24094f,_0x38eefe){return{'actionid':_0x24094f['uniqueid'],'action':_0x9974('0x12'),'channel':_0x24094f['channel'],'Exten':_0x9974('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0x9974('0xb')]('\x22%s\x22\x20<%s>',_0x24094f[_0x9974('0x8')]?_0x24094f['headerinfo']:'',_0x24094f[_0x9974('0xf')]),'variable':_0x38eefe,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x24094f[_0x9974('0x14')]};}; \ No newline at end of file +var _0x718e=['headerinfo','util','lodash','../../../../config/logger','fax','info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>'];(function(_0xe88496,_0x2ae579){var _0x6eecdd=function(_0x3dad96){while(--_0x3dad96){_0xe88496['push'](_0xe88496['shift']());}};_0x6eecdd(++_0x2ae579);}(_0x718e,0x14b));var _0xe718=function(_0x3e5ba5,_0x28e9cd){_0x3e5ba5=_0x3e5ba5-0x0;var _0x4ab4d8=_0x718e[_0x3e5ba5];return _0x4ab4d8;};'use strict';var util=require(_0xe718('0x0'));var _=require(_0xe718('0x1'));var moment=require('moment');var logger=require(_0xe718('0x2'))(_0xe718('0x3'));exports['message']=function(_0x5b1d4b){return{'message':_0x5b1d4b};};exports['logger']=function(_0x422b2d,_0x257601){logger[_0xe718('0x4')](_0x422b2d,util[_0xe718('0x5')](_0x257601,{'showHidden':![],'depth':null}));};exports[_0xe718('0x6')]=function(_0x4a4132,_0x43f6b7){var _0x4a25a7={'XMF-ECM':_0x43f6b7['ecm'],'XMF-HEADERINFO':_0x43f6b7['headerinfo'],'XMF-MINRATE':_0x43f6b7[_0xe718('0x7')],'XMF-MAXRATE':_0x43f6b7[_0xe718('0x8')],'XMF-MODEM':util[_0xe718('0x9')](_0xe718('0xa'),_0x43f6b7[_0xe718('0xb')]),'XMF-GATEWAY':_0x43f6b7['gateway'],'XMF-FAXDETECT':_0x43f6b7[_0xe718('0xc')],'XMF-T38TIMEOUT':_0x43f6b7[_0xe718('0xd')],'XMF-LOCALSTATIONID':_0x43f6b7[_0xe718('0xe')],'XMF-PATH':_0x4a4132[_0xe718('0xf')]};return _0x4a25a7;};exports[_0xe718('0x10')]=function(_0x1f30dd,_0x156f61){return{'actionid':_0x1f30dd[_0xe718('0x11')],'action':'originate','channel':_0x1f30dd[_0xe718('0x12')],'Exten':_0xe718('0x13'),'Context':'from-sip','Priority':'1','callerid':util[_0xe718('0x9')](_0xe718('0x14'),_0x1f30dd[_0xe718('0x15')]?_0x1f30dd[_0xe718('0x15')]:'',_0x1f30dd[_0xe718('0xe')]),'variable':_0x156f61,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1f30dd['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index ba0d830..4e4e979 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 _0x8ed7=['./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/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','listen','sync','error','[index.js][main]','inspect','bluebird','moment','./server','./realtime','./report','./acw','./trigger'];(function(_0x379f98,_0x26e8cd){var _0x250ba2=function(_0x338e32){while(--_0x338e32){_0x379f98['push'](_0x379f98['shift']());}};_0x250ba2(++_0x26e8cd);}(_0x8ed7,0x8d));var _0x78ed=function(_0x4dfd5f,_0x3dcaf7){_0x4dfd5f=_0x4dfd5f-0x0;var _0x3e8927=_0x8ed7[_0x4dfd5f];return _0x3e8927;};'use strict';var BPromise=require(_0x78ed('0x0'));var util=require('util');var moment=require(_0x78ed('0x1'));var server=require(_0x78ed('0x2'));var Realtime=require(_0x78ed('0x3'));var Report=require(_0x78ed('0x4'));var Acw=require(_0x78ed('0x5'));var Trigger=require(_0x78ed('0x6'));var Dialer=require(_0x78ed('0x7'));var Preview=require(_0x78ed('0x8'));var Fax=require(_0x78ed('0x9'));var user=require(_0x78ed('0xa'));var voiceQueue=require(_0x78ed('0xb'));var voiceQueueReport=require(_0x78ed('0xc'));var voiceCallReport=require(_0x78ed('0xd'));var trunk=require(_0x78ed('0xe'));var trigger=require(_0x78ed('0xf'));var template=require(_0x78ed('0x10'));var cmHopperHistory=require(_0x78ed('0x11'));var campaign=require(_0x78ed('0x12'));var voiceExtension=require(_0x78ed('0x13'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x78ed('0x14'));var salesforce=require(_0x78ed('0x15'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x78ed('0x16'));var desk=require(_0x78ed('0x17'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x78ed('0x18'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x78ed('0x19'));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(_0x78ed('0x1a'))(_0x78ed('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x78ed('0x1c')](_0x78ed('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x78ed('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x78ed('0x1e')]()[_0x78ed('0x1f')](user[_0x78ed('0x20')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x21')]())['then'](user[_0x78ed('0x22')]())['then'](realtime[_0x78ed('0x23')]())[_0x78ed('0x1f')](trunk['getTrunks']())['then'](realtime[_0x78ed('0x24')]())[_0x78ed('0x1f')](voiceQueue[_0x78ed('0x25')]())[_0x78ed('0x1f')](realtime['initVoiceQueues']())[_0x78ed('0x1f')](trigger[_0x78ed('0x26')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x27')]())[_0x78ed('0x1f')](template[_0x78ed('0x28')]())['then'](realtime['initTemplates']())[_0x78ed('0x1f')](zendesk[_0x78ed('0x29')]())['then'](realtime[_0x78ed('0x2a')]())['then'](salesforce[_0x78ed('0x2b')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x2c')]())[_0x78ed('0x1f')](sugarcrm[_0x78ed('0x2d')]())['then'](realtime[_0x78ed('0x2e')]())[_0x78ed('0x1f')](freshdesk['getFreshdeskAccounts']())[_0x78ed('0x1f')](realtime[_0x78ed('0x2f')]())[_0x78ed('0x1f')](desk['getDeskAccounts']())[_0x78ed('0x1f')](realtime['initDeskAccounts']())['then'](zoho[_0x78ed('0x30')]())[_0x78ed('0x1f')](realtime['initZohoAccounts']())[_0x78ed('0x1f')](vtiger[_0x78ed('0x31')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x32')]())['then'](freshsales['getFreshsalesAccounts']())[_0x78ed('0x1f')](realtime[_0x78ed('0x33')]())[_0x78ed('0x1f')](servicenow[_0x78ed('0x34')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x35')]())[_0x78ed('0x1f')](dynamics365[_0x78ed('0x36')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x37')]())[_0x78ed('0x1f')](campaign[_0x78ed('0x38')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x39')]())[_0x78ed('0x1f')](voiceExtension[_0x78ed('0x3a')]())[_0x78ed('0x1f')](realtime['initVoiceExtensions']())[_0x78ed('0x1f')](faxAccount[_0x78ed('0x3b')]())[_0x78ed('0x1f')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x78ed('0x1e')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x78ed('0x1f')](realtime[_0x78ed('0x3c')]())['then'](cmHopperHistory[_0x78ed('0x3d')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x3e')]())[_0x78ed('0x1f')](cmHopperHistory[_0x78ed('0x3f')]())[_0x78ed('0x1f')](realtime[_0x78ed('0x40')]())['then'](voiceCallReport[_0x78ed('0x41')]())['then'](realtime[_0x78ed('0x42')]())[_0x78ed('0x43')](function(_0x27c63e){logger['error'](_0x78ed('0x44'),util['inspect'](_0x27c63e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x78ed('0x45')](realtime,preview,fax)[_0x78ed('0x1f')](function(_0x49105a){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x78ed('0x46')]();setInterval(initRealtime,0x1388);})[_0x78ed('0x43')](function(_0x1dc43d){logger[_0x78ed('0x47')](_0x78ed('0x48'),util[_0x78ed('0x49')](_0x1dc43d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0df8=['getVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','bluebird','moment','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','ami','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts'];(function(_0x486db3,_0x4cf415){var _0x2372fe=function(_0x2a311d){while(--_0x2a311d){_0x486db3['push'](_0x486db3['shift']());}};_0x2372fe(++_0x4cf415);}(_0x0df8,0x195));var _0x80df=function(_0x229996,_0x3041e3){_0x229996=_0x229996-0x0;var _0x5e9f5e=_0x0df8[_0x229996];return _0x5e9f5e;};'use strict';var BPromise=require(_0x80df('0x0'));var util=require('util');var moment=require(_0x80df('0x1'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x80df('0x2'));var Acw=require('./acw');var Trigger=require(_0x80df('0x3'));var Dialer=require(_0x80df('0x4'));var Preview=require(_0x80df('0x5'));var Fax=require(_0x80df('0x6'));var user=require(_0x80df('0x7'));var voiceQueue=require(_0x80df('0x8'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x80df('0x9'));var trunk=require(_0x80df('0xa'));var trigger=require('./rpc/trigger');var template=require(_0x80df('0xb'));var cmHopperHistory=require(_0x80df('0xc'));var campaign=require(_0x80df('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x80df('0xe'));var salesforce=require(_0x80df('0xf'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x80df('0x10'));var desk=require(_0x80df('0x11'));var zoho=require(_0x80df('0x12'));var vtiger=require(_0x80df('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x80df('0x14'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x80df('0x15'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x80df('0x16')](_0x80df('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x80df('0x16')](_0x80df('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x80df('0x18')](user[_0x80df('0x19')]())[_0x80df('0x18')](realtime[_0x80df('0x1a')]())[_0x80df('0x18')](user[_0x80df('0x1b')]())[_0x80df('0x18')](realtime[_0x80df('0x1c')]())[_0x80df('0x18')](trunk['getTrunks']())['then'](realtime['initTrunks']())['then'](voiceQueue[_0x80df('0x1d')]())[_0x80df('0x18')](realtime[_0x80df('0x1e')]())['then'](trigger['getTriggers']())['then'](realtime[_0x80df('0x1f')]())[_0x80df('0x18')](template[_0x80df('0x20')]())[_0x80df('0x18')](realtime[_0x80df('0x21')]())[_0x80df('0x18')](zendesk[_0x80df('0x22')]())[_0x80df('0x18')](realtime[_0x80df('0x23')]())[_0x80df('0x18')](salesforce[_0x80df('0x24')]())[_0x80df('0x18')](realtime[_0x80df('0x25')]())[_0x80df('0x18')](sugarcrm['getSugarcrmAccounts']())[_0x80df('0x18')](realtime[_0x80df('0x26')]())[_0x80df('0x18')](freshdesk[_0x80df('0x27')]())[_0x80df('0x18')](realtime['initFreshdeskAccounts']())[_0x80df('0x18')](desk[_0x80df('0x28')]())[_0x80df('0x18')](realtime[_0x80df('0x29')]())[_0x80df('0x18')](zoho['getZohoAccounts']())[_0x80df('0x18')](realtime[_0x80df('0x2a')]())[_0x80df('0x18')](vtiger[_0x80df('0x2b')]())[_0x80df('0x18')](realtime['initVtigerAccounts']())['then'](freshsales[_0x80df('0x2c')]())[_0x80df('0x18')](realtime['initFreshsalesAccounts']())[_0x80df('0x18')](servicenow[_0x80df('0x2d')]())[_0x80df('0x18')](realtime[_0x80df('0x2e')]())[_0x80df('0x18')](dynamics365['getDynamics365Accounts']())[_0x80df('0x18')](realtime[_0x80df('0x2f')]())[_0x80df('0x18')](campaign[_0x80df('0x30')]())[_0x80df('0x18')](realtime['initCampaigns']())[_0x80df('0x18')](voiceExtension[_0x80df('0x31')]())[_0x80df('0x18')](realtime[_0x80df('0x32')]())[_0x80df('0x18')](faxAccount[_0x80df('0x33')]())[_0x80df('0x18')](realtime[_0x80df('0x34')]())[_0x80df('0x18')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x80df('0x18')](voiceQueueReport[_0x80df('0x35')]())[_0x80df('0x18')](realtime[_0x80df('0x36')]())['then'](cmHopperHistory[_0x80df('0x37')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x80df('0x18')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime[_0x80df('0x38')]())['then'](voiceCallReport[_0x80df('0x39')]())[_0x80df('0x18')](realtime[_0x80df('0x3a')]())[_0x80df('0x3b')](function(_0x3ac36e){logger[_0x80df('0x3c')](_0x80df('0x3d'),util['inspect'](_0x3ac36e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x80df('0x3e')](realtime,preview,fax)[_0x80df('0x18')](function(_0x3d4b4b){return initRealtime();})['then'](function(){return initParams();})[_0x80df('0x18')](function(){report[_0x80df('0x3f')]();setInterval(initRealtime,0x1388);})[_0x80df('0x3b')](function(_0x335a5b){logger['error']('[index.js][main]',util['inspect'](_0x335a5b,{'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 c2b7ce5..b3777c8 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x91e5da,_0x25ce34){var _0x5533f3=function(_0x15b980){while(--_0x15b980){_0x91e5da['push'](_0x91e5da['shift']());}};_0x5533f3(++_0x25ce34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x20e037,_0x3a64f3){var _0x31028e=function(_0x2fdfbe){while(--_0x2fdfbe){_0x20e037['push'](_0x20e037['shift']());}};_0x31028e(++_0x3a64f3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index f709267..efadb30 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 _0x8c0d=['SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval'];(function(_0x3510c2,_0x396bf6){var _0x191fb0=function(_0x1e3f44){while(--_0x1e3f44){_0x3510c2['push'](_0x3510c2['shift']());}};_0x191fb0(++_0x396bf6);}(_0x8c0d,0x133));var _0xd8c0=function(_0x588b4a,_0x54fee8){_0x588b4a=_0x588b4a-0x0;var _0x61315e=_0x8c0d[_0x588b4a];return _0x61315e;};'use strict';function Campaign(_0x3b539a){this['id']=_0x3b539a['id']||0x0;this[_0xd8c0('0x0')]=_0x3b539a[_0xd8c0('0x0')]||'';this[_0xd8c0('0x1')]=_0x3b539a[_0xd8c0('0x1')]||_0xd8c0('0x2');this[_0xd8c0('0x3')]=0x0;this['temp']=0x0;this[_0xd8c0('0x4')]=0x0;this[_0xd8c0('0x5')]=0x0;this[_0xd8c0('0x6')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x3b539a['active'];this[_0xd8c0('0x7')]=_0x3b539a[_0xd8c0('0x7')];this[_0xd8c0('0x8')]=_0x3b539a['dialTimezone']||null;this[_0xd8c0('0x9')]=_0x3b539a[_0xd8c0('0x9')]?_0x3b539a[_0xd8c0('0x9')]:null;this['dialOriginateCallerIdName']=_0x3b539a[_0xd8c0('0xa')];this[_0xd8c0('0xb')]=_0x3b539a[_0xd8c0('0xb')];this[_0xd8c0('0xc')]=_0x3b539a[_0xd8c0('0xc')]||0x1e;this[_0xd8c0('0xd')]=_0x3b539a[_0xd8c0('0xd')];this[_0xd8c0('0xe')]=_0x3b539a[_0xd8c0('0xe')];this[_0xd8c0('0xf')]=_0x3b539a[_0xd8c0('0xf')];this[_0xd8c0('0x10')]=_0x3b539a[_0xd8c0('0x10')];this['dialNoAnswerMaxRetry']=_0x3b539a[_0xd8c0('0x11')];this[_0xd8c0('0x12')]=_0x3b539a[_0xd8c0('0x12')];this['dialGlobalMaxRetry']=_0x3b539a[_0xd8c0('0x13')];this[_0xd8c0('0x14')]=_0x3b539a[_0xd8c0('0x14')]||0x3;this[_0xd8c0('0x15')]=_0x3b539a['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd8c0('0x16')]=_0x3b539a[_0xd8c0('0x16')]||0x3;this[_0xd8c0('0x17')]=_0x3b539a[_0xd8c0('0x17')]||0x96;this['dialAbandonedMaxRetry']=_0x3b539a['dialAbandonedMaxRetry']||0x3;this[_0xd8c0('0x18')]=_0x3b539a[_0xd8c0('0x18')]||0x96;this[_0xd8c0('0x19')]=_0x3b539a['dialMachineMaxRetry']||0x3;this[_0xd8c0('0x1a')]=_0x3b539a[_0xd8c0('0x1a')]||0x96;this[_0xd8c0('0x1b')]=_0x3b539a[_0xd8c0('0x1b')]||0x3;this[_0xd8c0('0x1c')]=_0x3b539a[_0xd8c0('0x1c')]||0x96;this[_0xd8c0('0x1d')]=_0x3b539a[_0xd8c0('0x1d')]||'DESC';this[_0xd8c0('0x1e')]=_0x3b539a['dialPrefix']||undefined;this[_0xd8c0('0x1f')]=_0x3b539a[_0xd8c0('0x1f')]||undefined;this[_0xd8c0('0x20')]=_0x3b539a['dialCutDigit']||undefined;this['TrunkBackup']=_0x3b539a[_0xd8c0('0x21')]?_0x3b539a['TrunkBackup']:undefined;this[_0xd8c0('0x22')]=_0x3b539a[_0xd8c0('0x22')]?_0x3b539a[_0xd8c0('0x22')]:undefined;this[_0xd8c0('0x23')]=_0x3b539a[_0xd8c0('0x23')]?_0x3b539a[_0xd8c0('0x23')]:undefined;this[_0xd8c0('0x24')]=_0x3b539a[_0xd8c0('0x24')]?_0x3b539a[_0xd8c0('0x24')]:undefined;this[_0xd8c0('0x25')]=_0x3b539a[_0xd8c0('0x24')]?_0x3b539a[_0xd8c0('0x24')][_0xd8c0('0x0')]:undefined;this[_0xd8c0('0x26')]=_0x3b539a[_0xd8c0('0x26')]||![];this[_0xd8c0('0x27')]=_0x3b539a[_0xd8c0('0x27')];this['dialAMDGreeting']=_0x3b539a[_0xd8c0('0x28')];this[_0xd8c0('0x29')]=_0x3b539a[_0xd8c0('0x29')];this[_0xd8c0('0x2a')]=_0x3b539a[_0xd8c0('0x2a')];this[_0xd8c0('0x2b')]=_0x3b539a[_0xd8c0('0x2b')];this[_0xd8c0('0x2c')]=_0x3b539a[_0xd8c0('0x2c')];this[_0xd8c0('0x2d')]=_0x3b539a[_0xd8c0('0x2d')];this[_0xd8c0('0x2e')]=_0x3b539a[_0xd8c0('0x2e')];this['dialAMDMaximumWordLength']=_0x3b539a[_0xd8c0('0x2f')];}module[_0xd8c0('0x30')]=Campaign; \ No newline at end of file +var _0xbc94=['dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry'];(function(_0x44ea7a,_0x5314b4){var _0x3f79ec=function(_0x1bd5f1){while(--_0x1bd5f1){_0x44ea7a['push'](_0x44ea7a['shift']());}};_0x3f79ec(++_0x5314b4);}(_0xbc94,0xaa));var _0x4bc9=function(_0x21de89,_0x367053){_0x21de89=_0x21de89-0x0;var _0x290b7e=_0xbc94[_0x21de89];return _0x290b7e;};'use strict';function Campaign(_0x1e91af){this['id']=_0x1e91af['id']||0x0;this[_0x4bc9('0x0')]=_0x1e91af['name']||'';this[_0x4bc9('0x1')]=_0x1e91af[_0x4bc9('0x1')]||_0x4bc9('0x2');this[_0x4bc9('0x3')]=0x0;this[_0x4bc9('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x4bc9('0x5')]='';this[_0x4bc9('0x6')]=!![];this[_0x4bc9('0x7')]=_0x1e91af['active'];this[_0x4bc9('0x8')]=_0x1e91af['limitCalls'];this[_0x4bc9('0x9')]=_0x1e91af[_0x4bc9('0x9')]||null;this[_0x4bc9('0xa')]=_0x1e91af[_0x4bc9('0xa')]?_0x1e91af[_0x4bc9('0xa')]:null;this['dialOriginateCallerIdName']=_0x1e91af[_0x4bc9('0xb')];this['dialOriginateCallerIdNumber']=_0x1e91af[_0x4bc9('0xc')];this[_0x4bc9('0xd')]=_0x1e91af[_0x4bc9('0xd')]||0x1e;this[_0x4bc9('0xe')]=_0x1e91af[_0x4bc9('0xe')];this[_0x4bc9('0xf')]=_0x1e91af[_0x4bc9('0xf')];this[_0x4bc9('0x10')]=_0x1e91af[_0x4bc9('0x10')];this[_0x4bc9('0x11')]=_0x1e91af[_0x4bc9('0x11')];this[_0x4bc9('0x12')]=_0x1e91af[_0x4bc9('0x12')];this[_0x4bc9('0x13')]=_0x1e91af[_0x4bc9('0x13')];this[_0x4bc9('0x14')]=_0x1e91af[_0x4bc9('0x14')];this['dialNoSuchNumberMaxRetry']=_0x1e91af[_0x4bc9('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1e91af[_0x4bc9('0x16')]||0x96;this[_0x4bc9('0x17')]=_0x1e91af[_0x4bc9('0x17')]||0x3;this[_0x4bc9('0x18')]=_0x1e91af['dialDropRetryFrequency']||0x96;this[_0x4bc9('0x19')]=_0x1e91af['dialAbandonedMaxRetry']||0x3;this[_0x4bc9('0x1a')]=_0x1e91af['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x1e91af['dialMachineMaxRetry']||0x3;this[_0x4bc9('0x1b')]=_0x1e91af['dialMachineRetryFrequency']||0x96;this[_0x4bc9('0x1c')]=_0x1e91af[_0x4bc9('0x1c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x1e91af['dialAgentRejectRetryFrequency']||0x96;this[_0x4bc9('0x1d')]=_0x1e91af[_0x4bc9('0x1d')]||_0x4bc9('0x1e');this['dialPrefix']=_0x1e91af['dialPrefix']||undefined;this[_0x4bc9('0x1f')]=_0x1e91af['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x4bc9('0x20')]=_0x1e91af[_0x4bc9('0x20')]||undefined;this[_0x4bc9('0x21')]=_0x1e91af[_0x4bc9('0x21')]?_0x1e91af[_0x4bc9('0x21')]:undefined;this[_0x4bc9('0x22')]=_0x1e91af[_0x4bc9('0x22')]?_0x1e91af[_0x4bc9('0x22')]:undefined;this['Interval']=_0x1e91af[_0x4bc9('0x23')]?_0x1e91af[_0x4bc9('0x23')]:undefined;this[_0x4bc9('0x24')]=_0x1e91af[_0x4bc9('0x24')]?_0x1e91af[_0x4bc9('0x24')]:undefined;this[_0x4bc9('0x25')]=_0x1e91af[_0x4bc9('0x24')]?_0x1e91af[_0x4bc9('0x24')][_0x4bc9('0x0')]:undefined;this[_0x4bc9('0x26')]=_0x1e91af[_0x4bc9('0x26')]||![];this['dialAMDInitialSilence']=_0x1e91af[_0x4bc9('0x27')];this[_0x4bc9('0x28')]=_0x1e91af[_0x4bc9('0x28')];this[_0x4bc9('0x29')]=_0x1e91af['dialAMDAfterGreetingSilence'];this[_0x4bc9('0x2a')]=_0x1e91af[_0x4bc9('0x2a')];this[_0x4bc9('0x2b')]=_0x1e91af[_0x4bc9('0x2b')];this[_0x4bc9('0x2c')]=_0x1e91af[_0x4bc9('0x2c')];this['dialAMDMaximumNumberOfWords']=_0x1e91af[_0x4bc9('0x2d')];this[_0x4bc9('0x2e')]=_0x1e91af[_0x4bc9('0x2e')];this['dialAMDMaximumWordLength']=_0x1e91af[_0x4bc9('0x2f')];}module[_0x4bc9('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d60eb89..9c6247f 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 _0xd276=['tag','disposition','monitor','monitorFilename','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answertime','endtime','lastapplication','lastdata','duration','billableseconds','holdtime','type'];(function(_0x553357,_0x19edfa){var _0x135378=function(_0x3d4b85){while(--_0x3d4b85){_0x553357['push'](_0x553357['shift']());}};_0x135378(++_0x19edfa);}(_0xd276,0xfc));var _0x6d27=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xd276[_0x511bd1];return _0x4c48ec;};'use strict';function Channel(){this[_0x6d27('0x0')]=null;this[_0x6d27('0x1')]='';this[_0x6d27('0x2')]='';this[_0x6d27('0x3')]=0x0;this['calleridname']='';this[_0x6d27('0x4')]=undefined;this[_0x6d27('0x5')]=undefined;this[_0x6d27('0x6')]=0x0;this[_0x6d27('0x7')]='';this['uniqueid']=0x0;this[_0x6d27('0x8')]=0x0;this[_0x6d27('0x9')]=0x0;this['answered']=![];this[_0x6d27('0xa')]=null;this[_0x6d27('0xb')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x6d27('0xc')]='';this[_0x6d27('0xd')]='';this[_0x6d27('0xe')]=0x0;this[_0x6d27('0xf')]=0x0;this[_0x6d27('0x10')]=0x0;this[_0x6d27('0x11')]=null;this[_0x6d27('0x12')]=null;this[_0x6d27('0x13')]=null;this[_0x6d27('0x14')]=![];this[_0x6d27('0x15')]=null;this['queue']=null;this[_0x6d27('0x16')]=[];this['transfercalleridnum']=undefined;this[_0x6d27('0x17')]=undefined;this[_0x6d27('0x18')]=undefined;this[_0x6d27('0x19')]=0x0;}module[_0x6d27('0x1a')]=Channel; \ No newline at end of file +var _0x689b=['connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','connectedlinenum'];(function(_0x4f1b84,_0x47d053){var _0x32e5dc=function(_0x11feb1){while(--_0x11feb1){_0x4f1b84['push'](_0x4f1b84['shift']());}};_0x32e5dc(++_0x47d053);}(_0x689b,0x142));var _0xb689=function(_0x35eb06,_0x3553c8){_0x35eb06=_0x35eb06-0x0;var _0x3ce0ff=_0x689b[_0x35eb06];return _0x3ce0ff;};'use strict';function Channel(){this[_0xb689('0x0')]=null;this['channel']='';this[_0xb689('0x1')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0xb689('0x2')]=undefined;this[_0xb689('0x3')]=undefined;this[_0xb689('0x4')]=0x0;this[_0xb689('0x5')]='';this[_0xb689('0x6')]=0x0;this[_0xb689('0x7')]=0x0;this[_0xb689('0x8')]=0x0;this['answered']=![];this[_0xb689('0x9')]=null;this[_0xb689('0xa')]=null;this[_0xb689('0xb')]=![];this[_0xb689('0xc')]=![];this[_0xb689('0xd')]='';this[_0xb689('0xe')]='';this[_0xb689('0xf')]=0x0;this['billableseconds']=0x0;this[_0xb689('0x10')]=0x0;this['type']=null;this['tag']=null;this[_0xb689('0x11')]=null;this['monitor']=![];this[_0xb689('0x12')]=null;this['queue']=null;this[_0xb689('0x13')]=[];this[_0xb689('0x14')]=undefined;this[_0xb689('0x15')]=undefined;this[_0xb689('0x16')]=undefined;this[_0xb689('0x17')]=0x0;}module[_0xb689('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 4f87ffb..d9b8b4f 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 _0xc3db=['consumerSecret','tokenSecret','serverUrl','name','remoteUri','authType','password','consumerKey'];(function(_0x10efbc,_0x1c597a){var _0x4c2fff=function(_0x19bc41){while(--_0x19bc41){_0x10efbc['push'](_0x10efbc['shift']());}};_0x4c2fff(++_0x1c597a);}(_0xc3db,0x14b));var _0xbc3d=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0xc3db[_0x2b4448];return _0xb4b465;};'use strict';function DeskAccount(_0x3ec8f4){this['id']=_0x3ec8f4['id']||0x0;this[_0xbc3d('0x0')]=_0x3ec8f4[_0xbc3d('0x0')]||'';this['username']=_0x3ec8f4['username']||'';this[_0xbc3d('0x1')]=_0x3ec8f4['remoteUri']||'';this[_0xbc3d('0x2')]=_0x3ec8f4[_0xbc3d('0x2')]||'';this[_0xbc3d('0x3')]=_0x3ec8f4[_0xbc3d('0x3')]||'';this[_0xbc3d('0x4')]=_0x3ec8f4[_0xbc3d('0x4')]||'';this['consumerSecret']=_0x3ec8f4[_0xbc3d('0x5')]||'';this['token']=_0x3ec8f4['token']||'';this[_0xbc3d('0x6')]=_0x3ec8f4[_0xbc3d('0x6')]||'';this['type']=_0x3ec8f4['type']||'';this[_0xbc3d('0x7')]=_0x3ec8f4[_0xbc3d('0x7')]||'';this['Configurations']=_0x3ec8f4['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x5017=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x385595,_0x2be054){var _0x160ae7=function(_0x23bbe5){while(--_0x23bbe5){_0x385595['push'](_0x385595['shift']());}};_0x160ae7(++_0x2be054);}(_0x5017,0x67));var _0x7501=function(_0x98ceb9,_0x3af4d9){_0x98ceb9=_0x98ceb9-0x0;var _0x2b30f5=_0x5017[_0x98ceb9];return _0x2b30f5;};'use strict';function DeskAccount(_0x67f189){this['id']=_0x67f189['id']||0x0;this[_0x7501('0x0')]=_0x67f189['name']||'';this['username']=_0x67f189[_0x7501('0x1')]||'';this[_0x7501('0x2')]=_0x67f189[_0x7501('0x2')]||'';this[_0x7501('0x3')]=_0x67f189['authType']||'';this[_0x7501('0x4')]=_0x67f189[_0x7501('0x4')]||'';this['consumerKey']=_0x67f189['consumerKey']||'';this[_0x7501('0x5')]=_0x67f189[_0x7501('0x5')]||'';this[_0x7501('0x6')]=_0x67f189[_0x7501('0x6')]||'';this[_0x7501('0x7')]=_0x67f189[_0x7501('0x7')]||'';this[_0x7501('0x8')]=_0x67f189[_0x7501('0x8')]||'';this['serverUrl']=_0x67f189[_0x7501('0x9')]||'';this[_0x7501('0xa')]=_0x67f189['Configurations']||{};}module[_0x7501('0xb')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 7fe832b..51dde2f 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 _0x3c81=['Configurations','exports','name','username','tenantId','clientId','clientSecret','serverUrl'];(function(_0x35a177,_0x54cf5a){var _0x4ab904=function(_0x5da0f3){while(--_0x5da0f3){_0x35a177['push'](_0x35a177['shift']());}};_0x4ab904(++_0x54cf5a);}(_0x3c81,0x102));var _0x13c8=function(_0x22984c,_0x38e909){_0x22984c=_0x22984c-0x0;var _0x377db6=_0x3c81[_0x22984c];return _0x377db6;};'use strict';function Dynamics365Account(_0x55010d){this['id']=_0x55010d['id']||0x0;this[_0x13c8('0x0')]=_0x55010d['name']||'';this[_0x13c8('0x1')]=_0x55010d[_0x13c8('0x1')]||'';this['password']=_0x55010d['password']||'';this['remoteUri']=_0x55010d['remoteUri']||'';this[_0x13c8('0x2')]=_0x55010d[_0x13c8('0x2')]||'';this[_0x13c8('0x3')]=_0x55010d[_0x13c8('0x3')]||'';this[_0x13c8('0x4')]=_0x55010d[_0x13c8('0x4')]||{};this[_0x13c8('0x5')]=_0x55010d['serverUrl']||'';this[_0x13c8('0x6')]=_0x55010d['Configurations']||{};}module[_0x13c8('0x7')]=Dynamics365Account; \ No newline at end of file +var _0xe605=['clientSecret','serverUrl','name','username','password','remoteUri','tenantId','clientId'];(function(_0x11fd4e,_0x1a32ec){var _0x324371=function(_0x3f90a1){while(--_0x3f90a1){_0x11fd4e['push'](_0x11fd4e['shift']());}};_0x324371(++_0x1a32ec);}(_0xe605,0x92));var _0x5e60=function(_0xce6f72,_0x4aec2d){_0xce6f72=_0xce6f72-0x0;var _0x42c3ec=_0xe605[_0xce6f72];return _0x42c3ec;};'use strict';function Dynamics365Account(_0x4cf32c){this['id']=_0x4cf32c['id']||0x0;this[_0x5e60('0x0')]=_0x4cf32c['name']||'';this[_0x5e60('0x1')]=_0x4cf32c[_0x5e60('0x1')]||'';this[_0x5e60('0x2')]=_0x4cf32c[_0x5e60('0x2')]||'';this[_0x5e60('0x3')]=_0x4cf32c[_0x5e60('0x3')]||'';this[_0x5e60('0x4')]=_0x4cf32c[_0x5e60('0x4')]||'';this[_0x5e60('0x5')]=_0x4cf32c[_0x5e60('0x5')]||'';this[_0x5e60('0x6')]=_0x4cf32c[_0x5e60('0x6')]||{};this['serverUrl']=_0x4cf32c[_0x5e60('0x7')]||'';this['Configurations']=_0x4cf32c['Configurations']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2838edb..5e0eccd 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 _0xa8b4=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','t38timeout','tech','Trunk','ListId','key'];(function(_0x465c26,_0x226895){var _0x1b75de=function(_0x222b44){while(--_0x222b44){_0x465c26['push'](_0x465c26['shift']());}};_0x1b75de(++_0x226895);}(_0xa8b4,0xf1));var _0x4a8b=function(_0x243bfd,_0x1f041d){_0x243bfd=_0x243bfd-0x0;var _0x1e6beb=_0xa8b4[_0x243bfd];return _0x1e6beb;};'use strict';function FaxAccount(_0x5172a1){this['id']=_0x5172a1['id']||0x0;this[_0x4a8b('0x0')]=_0x5172a1[_0x4a8b('0x0')]||'';this[_0x4a8b('0x1')]=_0x5172a1[_0x4a8b('0x1')];this[_0x4a8b('0x2')]=_0x5172a1[_0x4a8b('0x2')];this[_0x4a8b('0x3')]=_0x5172a1[_0x4a8b('0x3')];this['localstationid']=_0x5172a1[_0x4a8b('0x4')];this[_0x4a8b('0x5')]=_0x5172a1[_0x4a8b('0x5')]||0x960;this[_0x4a8b('0x6')]=_0x5172a1[_0x4a8b('0x6')]||0x3840;this[_0x4a8b('0x7')]=_0x5172a1[_0x4a8b('0x7')]||_0x4a8b('0x8');this['gateway']=_0x5172a1[_0x4a8b('0x9')]||'no';this['faxdetect']=_0x5172a1['faxdetect']||'no';this[_0x4a8b('0xa')]=_0x5172a1[_0x4a8b('0xa')]||0x1388;this[_0x4a8b('0xb')]=_0x5172a1[_0x4a8b('0xb')]||'SIP';this[_0x4a8b('0xc')]=_0x5172a1[_0x4a8b('0xc')]?_0x5172a1['Trunk']:undefined;this[_0x4a8b('0xd')]=_0x5172a1['ListId'];this[_0x4a8b('0xe')]=_0x5172a1[_0x4a8b('0xe')];}module[_0x4a8b('0xf')]=FaxAccount; \ No newline at end of file +var _0x6221=['SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6221,0xef));var _0x1622=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0x6221[_0x2211ed];return _0x4d78cc;};'use strict';function FaxAccount(_0x2ac3cb){this['id']=_0x2ac3cb['id']||0x0;this[_0x1622('0x0')]=_0x2ac3cb[_0x1622('0x0')]||'';this[_0x1622('0x1')]=_0x2ac3cb[_0x1622('0x1')];this[_0x1622('0x2')]=_0x2ac3cb['ecm'];this[_0x1622('0x3')]=_0x2ac3cb[_0x1622('0x3')];this[_0x1622('0x4')]=_0x2ac3cb['localstationid'];this[_0x1622('0x5')]=_0x2ac3cb[_0x1622('0x5')]||0x960;this[_0x1622('0x6')]=_0x2ac3cb[_0x1622('0x6')]||0x3840;this[_0x1622('0x7')]=_0x2ac3cb[_0x1622('0x7')]||_0x1622('0x8');this[_0x1622('0x9')]=_0x2ac3cb[_0x1622('0x9')]||'no';this['faxdetect']=_0x2ac3cb[_0x1622('0xa')]||'no';this[_0x1622('0xb')]=_0x2ac3cb[_0x1622('0xb')]||0x1388;this[_0x1622('0xc')]=_0x2ac3cb[_0x1622('0xc')]||_0x1622('0xd');this[_0x1622('0xe')]=_0x2ac3cb['Trunk']?_0x2ac3cb[_0x1622('0xe')]:undefined;this[_0x1622('0xf')]=_0x2ac3cb[_0x1622('0xf')];this[_0x1622('0x10')]=_0x2ac3cb[_0x1622('0x10')];}module[_0x1622('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 06f47e6..6a475fc 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 _0xd966=['apiKey','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x5d543b,_0x6a969a){var _0x2015b8=function(_0x1d3800){while(--_0x1d3800){_0x5d543b['push'](_0x5d543b['shift']());}};_0x2015b8(++_0x6a969a);}(_0xd966,0xd1));var _0x6d96=function(_0x4b6792,_0x1098bb){_0x4b6792=_0x4b6792-0x0;var _0x406802=_0xd966[_0x4b6792];return _0x406802;};'use strict';function FreshdeskAccount(_0x7abcfd){this['id']=_0x7abcfd['id']||0x0;this['name']=_0x7abcfd['name']||'';this['username']=_0x7abcfd[_0x6d96('0x0')]||'';this[_0x6d96('0x1')]=_0x7abcfd['token']||'';this[_0x6d96('0x2')]=_0x7abcfd[_0x6d96('0x2')]||'';this[_0x6d96('0x3')]=_0x7abcfd[_0x6d96('0x3')]||'';this[_0x6d96('0x4')]=_0x7abcfd['Configurations']||{};}module[_0x6d96('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0xcb11=['exports','name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x4efc87,_0x17a7d1){var _0x191fc4=function(_0x19dda1){while(--_0x19dda1){_0x4efc87['push'](_0x4efc87['shift']());}};_0x191fc4(++_0x17a7d1);}(_0xcb11,0xbe));var _0x1cb1=function(_0x5f58a1,_0x234450){_0x5f58a1=_0x5f58a1-0x0;var _0x362706=_0xcb11[_0x5f58a1];return _0x362706;};'use strict';function FreshdeskAccount(_0x429408){this['id']=_0x429408['id']||0x0;this['name']=_0x429408[_0x1cb1('0x0')]||'';this['username']=_0x429408['username']||'';this[_0x1cb1('0x1')]=_0x429408[_0x1cb1('0x2')]||'';this[_0x1cb1('0x3')]=_0x429408[_0x1cb1('0x3')]||'';this[_0x1cb1('0x4')]=_0x429408[_0x1cb1('0x4')]||'';this['Configurations']=_0x429408[_0x1cb1('0x5')]||{};}module[_0x1cb1('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 0fd240e..74a0516 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 _0xc906=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x4e7805,_0x2d3335){var _0x184ae0=function(_0x44c486){while(--_0x44c486){_0x4e7805['push'](_0x4e7805['shift']());}};_0x184ae0(++_0x2d3335);}(_0xc906,0x1ad));var _0x6c90=function(_0x11567b,_0x746d0c){_0x11567b=_0x11567b-0x0;var _0x4527ce=_0xc906[_0x11567b];return _0x4527ce;};'use strict';function FreshsalesAccount(_0x1b05cc){this['id']=_0x1b05cc['id']||0x0;this[_0x6c90('0x0')]=_0x1b05cc['name']||'';this[_0x6c90('0x1')]=_0x1b05cc[_0x6c90('0x1')]||'';this[_0x6c90('0x2')]=_0x1b05cc['token']||'';this[_0x6c90('0x3')]=_0x1b05cc[_0x6c90('0x3')]||'';this[_0x6c90('0x4')]=_0x1b05cc[_0x6c90('0x4')]||'';this[_0x6c90('0x5')]=_0x1b05cc[_0x6c90('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x6753=['name','username','apiKey','token','remoteUri','serverUrl','exports'];(function(_0x5cabc4,_0x55a2ec){var _0x5b8692=function(_0xe9cd71){while(--_0xe9cd71){_0x5cabc4['push'](_0x5cabc4['shift']());}};_0x5b8692(++_0x55a2ec);}(_0x6753,0xa1));var _0x3675=function(_0xb4caad,_0xc8a39a){_0xb4caad=_0xb4caad-0x0;var _0x3cb57e=_0x6753[_0xb4caad];return _0x3cb57e;};'use strict';function FreshsalesAccount(_0x2f30ab){this['id']=_0x2f30ab['id']||0x0;this[_0x3675('0x0')]=_0x2f30ab[_0x3675('0x0')]||'';this[_0x3675('0x1')]=_0x2f30ab['username']||'';this[_0x3675('0x2')]=_0x2f30ab[_0x3675('0x3')]||'';this['remoteUri']=_0x2f30ab[_0x3675('0x4')]||'';this[_0x3675('0x5')]=_0x2f30ab['serverUrl']||'';this['Configurations']=_0x2f30ab['Configurations']||{};}module[_0x3675('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 8830176..1b57dfb 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 _0x4a64=['connectedlinenum','connectedlinename','accountcode','context','exten','priority','lastAssignedTo','voice','variables','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexitAt','channel'];(function(_0x2b97b2,_0x10314d){var _0x464c68=function(_0x353823){while(--_0x353823){_0x2b97b2['push'](_0x2b97b2['shift']());}};_0x464c68(++_0x10314d);}(_0x4a64,0x13d));var _0x44a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a64[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this['type']=_0x44a6('0x0');this[_0x44a6('0x1')]='';this[_0x44a6('0x2')]='';this[_0x44a6('0x3')]='';this['queue']='';this[_0x44a6('0x4')]=null;this[_0x44a6('0x5')]=null;this[_0x44a6('0x6')]=0x1;this[_0x44a6('0x7')]=0x1;this[_0x44a6('0x8')]=![];this[_0x44a6('0x9')]=null;this[_0x44a6('0xa')]=![];this['queuecallercompleteAt']=null;this['queuecallerexit']=![];this[_0x44a6('0xb')]=null;this['originalposition']=0x1;this[_0x44a6('0xc')]='';this[_0x44a6('0xd')]='';this[_0x44a6('0xe')]='';this[_0x44a6('0xf')]='';this[_0x44a6('0x10')]='';this[_0x44a6('0x11')]='';this[_0x44a6('0x12')]='';this['holdtime']=0x0;this['assigned']=![];this[_0x44a6('0x13')]='';this['motionChannel']=_0x44a6('0x14');this['mohtime']=0x0;this[_0x44a6('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xf39e=['connectedlinenum','accountcode','exten','priority','assigned','lastAssignedTo','motionChannel','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xf39e,0x1e8));var _0xef39=function(_0x2dae9e,_0x2e6f30){_0x2dae9e=_0x2dae9e-0x0;var _0x41b7ca=_0xf39e[_0x2dae9e];return _0x41b7ca;};'use strict';function QueueReport(){this[_0xef39('0x0')]=_0xef39('0x1');this[_0xef39('0x2')]='';this[_0xef39('0x3')]='';this[_0xef39('0x4')]='';this[_0xef39('0x5')]='';this[_0xef39('0x6')]=null;this[_0xef39('0x7')]=null;this[_0xef39('0x8')]=0x1;this[_0xef39('0x9')]=0x1;this[_0xef39('0xa')]=![];this[_0xef39('0xb')]=null;this[_0xef39('0xc')]=![];this[_0xef39('0xd')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xef39('0xe')]=0x1;this[_0xef39('0xf')]='';this[_0xef39('0x10')]='';this['connectedlinename']='';this[_0xef39('0x11')]='';this['context']='';this[_0xef39('0x12')]='';this[_0xef39('0x13')]='';this['holdtime']=0x0;this[_0xef39('0x14')]=![];this[_0xef39('0x15')]='';this[_0xef39('0x16')]='voice';this['mohtime']=0x0;this['variables']={};}module[_0xef39('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1ebde48..af14d1b 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 _0x4afb=['clientSecret','type','serverUrl','exports','name','username','remoteUri','password','clientId'];(function(_0x2d01d9,_0x163554){var _0x15d1ac=function(_0x2ac66a){while(--_0x2ac66a){_0x2d01d9['push'](_0x2d01d9['shift']());}};_0x15d1ac(++_0x163554);}(_0x4afb,0x1c6));var _0xb4af=function(_0x3be56f,_0x6c63cd){_0x3be56f=_0x3be56f-0x0;var _0x3d0b86=_0x4afb[_0x3be56f];return _0x3d0b86;};'use strict';function SalesforceAccount(_0x28b6f4){this['id']=_0x28b6f4['id']||0x0;this[_0xb4af('0x0')]=_0x28b6f4[_0xb4af('0x0')]||'';this[_0xb4af('0x1')]=_0x28b6f4[_0xb4af('0x1')]||'';this[_0xb4af('0x2')]=_0x28b6f4['remoteUri']||'';this[_0xb4af('0x3')]=_0x28b6f4[_0xb4af('0x3')]||'';this[_0xb4af('0x4')]=_0x28b6f4[_0xb4af('0x4')]||'';this[_0xb4af('0x5')]=_0x28b6f4[_0xb4af('0x5')]||'';this['securityToken']=_0x28b6f4['securityToken']||'';this[_0xb4af('0x6')]=_0x28b6f4[_0xb4af('0x6')]||'integrationTab';this[_0xb4af('0x7')]=_0x28b6f4[_0xb4af('0x7')]||'';this['Configurations']=_0x28b6f4['Configurations']||{};}module[_0xb4af('0x8')]=SalesforceAccount; \ No newline at end of file +var _0xf40b=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x51690c,_0x18b504){var _0x1e1cd=function(_0x17e0ae){while(--_0x17e0ae){_0x51690c['push'](_0x51690c['shift']());}};_0x1e1cd(++_0x18b504);}(_0xf40b,0xf7));var _0xbf40=function(_0x3a0b7f,_0x550d3b){_0x3a0b7f=_0x3a0b7f-0x0;var _0x551562=_0xf40b[_0x3a0b7f];return _0x551562;};'use strict';function SalesforceAccount(_0x25ac70){this['id']=_0x25ac70['id']||0x0;this['name']=_0x25ac70[_0xbf40('0x0')]||'';this['username']=_0x25ac70[_0xbf40('0x1')]||'';this[_0xbf40('0x2')]=_0x25ac70[_0xbf40('0x2')]||'';this[_0xbf40('0x3')]=_0x25ac70[_0xbf40('0x3')]||'';this[_0xbf40('0x4')]=_0x25ac70[_0xbf40('0x4')]||'';this['clientSecret']=_0x25ac70[_0xbf40('0x5')]||'';this[_0xbf40('0x6')]=_0x25ac70[_0xbf40('0x6')]||'';this[_0xbf40('0x7')]=_0x25ac70[_0xbf40('0x7')]||_0xbf40('0x8');this[_0xbf40('0x9')]=_0x25ac70[_0xbf40('0x9')]||'';this[_0xbf40('0xa')]=_0x25ac70[_0xbf40('0xa')]||{};}module[_0xbf40('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index e5b427b..30857da 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 _0x7a33=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x163a88,_0x2e36a9){var _0x4c1207=function(_0x106160){while(--_0x106160){_0x163a88['push'](_0x163a88['shift']());}};_0x4c1207(++_0x2e36a9);}(_0x7a33,0x109));var _0x37a3=function(_0x34923a,_0x45b2de){_0x34923a=_0x34923a-0x0;var _0x49a594=_0x7a33[_0x34923a];return _0x49a594;};'use strict';function ServicenowAccount(_0x287cbf){this['id']=_0x287cbf['id']||0x0;this[_0x37a3('0x0')]=_0x287cbf[_0x37a3('0x0')]||'';this[_0x37a3('0x1')]=_0x287cbf[_0x37a3('0x1')]||'';this['password']=_0x287cbf['password']||'';this['remoteUri']=_0x287cbf[_0x37a3('0x2')]||'';this[_0x37a3('0x3')]=_0x287cbf[_0x37a3('0x3')]||'';this[_0x37a3('0x4')]=_0x287cbf[_0x37a3('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x90ae=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x90ae,0xbd));var _0xe90a=function(_0x357c3e,_0x4ca8c0){_0x357c3e=_0x357c3e-0x0;var _0x7b6384=_0x90ae[_0x357c3e];return _0x7b6384;};'use strict';function ServicenowAccount(_0x52be55){this['id']=_0x52be55['id']||0x0;this[_0xe90a('0x0')]=_0x52be55[_0xe90a('0x0')]||'';this[_0xe90a('0x1')]=_0x52be55[_0xe90a('0x1')]||'';this[_0xe90a('0x2')]=_0x52be55[_0xe90a('0x2')]||'';this[_0xe90a('0x3')]=_0x52be55['remoteUri']||'';this['serverUrl']=_0x52be55[_0xe90a('0x4')]||'';this[_0xe90a('0x5')]=_0x52be55[_0xe90a('0x5')]||{};}module[_0xe90a('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 061a390..a0accbb 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 _0x6548=['Configurations','exports','username','password','serverUrl'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x6548,0x133));var _0x8654=function(_0x4ff1ff,_0x2c2872){_0x4ff1ff=_0x4ff1ff-0x0;var _0x9afa87=_0x6548[_0x4ff1ff];return _0x9afa87;};'use strict';function SugarcrmAccount(_0x5bf36c){this['id']=_0x5bf36c['id']||0x0;this['name']=_0x5bf36c['name']||'';this[_0x8654('0x0')]=_0x5bf36c[_0x8654('0x0')]||'';this[_0x8654('0x1')]=_0x5bf36c['password']||'';this['remoteUri']=_0x5bf36c['remoteUri']||'';this[_0x8654('0x2')]=_0x5bf36c['serverUrl']||'';this[_0x8654('0x3')]=_0x5bf36c[_0x8654('0x3')]||{};}module[_0x8654('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0x201d=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x1737b1,_0x3d454e){var _0x2e7af3=function(_0x51edbd){while(--_0x51edbd){_0x1737b1['push'](_0x1737b1['shift']());}};_0x2e7af3(++_0x3d454e);}(_0x201d,0x97));var _0xd201=function(_0x2b5d8b,_0x5d6245){_0x2b5d8b=_0x2b5d8b-0x0;var _0x5a9834=_0x201d[_0x2b5d8b];return _0x5a9834;};'use strict';function SugarcrmAccount(_0x11d42e){this['id']=_0x11d42e['id']||0x0;this['name']=_0x11d42e[_0xd201('0x0')]||'';this['username']=_0x11d42e[_0xd201('0x1')]||'';this[_0xd201('0x2')]=_0x11d42e[_0xd201('0x2')]||'';this['remoteUri']=_0x11d42e[_0xd201('0x3')]||'';this[_0xd201('0x4')]=_0x11d42e['serverUrl']||'';this['Configurations']=_0x11d42e[_0xd201('0x5')]||{};}module[_0xd201('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 81538c9..ae393e9 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 _0x28b9=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x28b9,0x180));var _0x928b=function(_0x4ff3d1,_0x15c737){_0x4ff3d1=_0x4ff3d1-0x0;var _0x32af0c=_0x28b9[_0x4ff3d1];return _0x32af0c;};'use strict';function Telephone(_0x2b7b66){this['id']=_0x2b7b66['id']||0x0;this[_0x928b('0x0')]=_0x2b7b66[_0x928b('0x0')]||'';this[_0x928b('0x1')]=_0x2b7b66[_0x928b('0x1')]||'';this[_0x928b('0x2')]=_0x928b('0x3');this[_0x928b('0x4')]=0x0;this[_0x928b('0x5')]=_0x928b('0x3');this[_0x928b('0x6')]='';}module[_0x928b('0x7')]=Telephone; \ No newline at end of file +var _0x8081=['accountcode','unknown','stateTime','status','address','exports','name'];(function(_0x4c593c,_0x39b6fc){var _0x20fb6a=function(_0x284e9e){while(--_0x284e9e){_0x4c593c['push'](_0x4c593c['shift']());}};_0x20fb6a(++_0x39b6fc);}(_0x8081,0xbc));var _0x1808=function(_0x51d3dd,_0x1e77de){_0x51d3dd=_0x51d3dd-0x0;var _0x414e94=_0x8081[_0x51d3dd];return _0x414e94;};'use strict';function Telephone(_0xea7543){this['id']=_0xea7543['id']||0x0;this['name']=_0xea7543[_0x1808('0x0')]||'';this[_0x1808('0x1')]=_0xea7543[_0x1808('0x1')]||'';this['state']=_0x1808('0x2');this[_0x1808('0x3')]=0x0;this[_0x1808('0x4')]=_0x1808('0x2');this[_0x1808('0x5')]='';}module[_0x1808('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 dad40e5..896cf4b 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(_0x35353a,_0x5450fb){var _0x3dee56=function(_0x316613){while(--_0x316613){_0x35353a['push'](_0x35353a['shift']());}};_0x3dee56(++_0x5450fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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(_0x590973,_0x37bb1a){var _0x13a3b2=function(_0x41cf17){while(--_0x41cf17){_0x590973['push'](_0x590973['shift']());}};_0x13a3b2(++_0x37bb1a);}(_0xb10b,0x12a));var _0xbb10=function(_0x283ce1,_0x52f230){_0x283ce1=_0x283ce1-0x0;var _0xda31d8=_0xb10b[_0x283ce1];return _0xda31d8;};'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 a56918e..4361c97 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 _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x12a592,_0x1b7656){var _0x3e3fb3=function(_0x4eede6){while(--_0x4eede6){_0x12a592['push'](_0x12a592['shift']());}};_0x3e3fb3(++_0x1b7656);}(_0x14a0,0x8e));var _0x014a=function(_0x7f73c3,_0x5629bf){_0x7f73c3=_0x7f73c3-0x0;var _0xcf0dfc=_0x14a0[_0x7f73c3];return _0xcf0dfc;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x152ea8,_0x3fb53f){var _0x4c0ebe=function(_0x1c2641){while(--_0x1c2641){_0x152ea8['push'](_0x152ea8['shift']());}};_0x4c0ebe(++_0x3fb53f);}(_0x4fc2,0x111));var _0x24fc=function(_0x3bf04a,_0x56ed90){_0x3bf04a=_0x3bf04a-0x0;var _0x241e4b=_0x4fc2[_0x3bf04a];return _0x241e4b;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6dbab9f..902ec56 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 _0xa47c=['registry','indexOf','split','host','port','domain','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0xa47c,0x170));var _0xca47=function(_0x556421,_0x22858b){_0x556421=_0x556421-0x0;var _0x501ee0=_0xa47c[_0x556421];return _0x501ee0;};'use strict';function Trunk(_0x2a47aa){this['id']=_0x2a47aa['id']||0x0;this[_0xca47('0x0')]=_0x2a47aa[_0xca47('0x0')]||![];this['name']=_0x2a47aa[_0xca47('0x1')]||'';this[_0xca47('0x2')]=_0xca47('0x3');this[_0xca47('0x4')]=0x0;this[_0xca47('0x5')]='unknown';this[_0xca47('0x6')]=_0x2a47aa[_0xca47('0x6')]&&_0x2a47aa[_0xca47('0x6')][_0xca47('0x7')](':')?_0x2a47aa[_0xca47('0x6')][_0xca47('0x8')](':')[0x0]:'';this[_0xca47('0x9')]='';this[_0xca47('0xa')]='';this[_0xca47('0xb')]='';this['domainport']='';this[_0xca47('0xc')]='';this[_0xca47('0xd')]='unknown';this[_0xca47('0xe')]='';this[_0xca47('0xf')]='';this[_0xca47('0x10')]=_0x2a47aa['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file +var _0x5dd7=['domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','port','domain'];(function(_0x2d5401,_0x2c196a){var _0x5747e7=function(_0x1e65a2){while(--_0x1e65a2){_0x2d5401['push'](_0x2d5401['shift']());}};_0x5747e7(++_0x2c196a);}(_0x5dd7,0x102));var _0x75dd=function(_0x1693a3,_0x496ffb){_0x1693a3=_0x1693a3-0x0;var _0x373896=_0x5dd7[_0x1693a3];return _0x373896;};'use strict';function Trunk(_0x4bf411){this['id']=_0x4bf411['id']||0x0;this[_0x75dd('0x0')]=_0x4bf411[_0x75dd('0x0')]||![];this[_0x75dd('0x1')]=_0x4bf411['name']||'';this[_0x75dd('0x2')]=_0x75dd('0x3');this[_0x75dd('0x4')]=0x0;this[_0x75dd('0x5')]=_0x75dd('0x3');this[_0x75dd('0x6')]=_0x4bf411[_0x75dd('0x6')]&&_0x4bf411['registry'][_0x75dd('0x7')](':')?_0x4bf411[_0x75dd('0x6')][_0x75dd('0x8')](':')[0x0]:'';this[_0x75dd('0x9')]='';this[_0x75dd('0xa')]='';this[_0x75dd('0xb')]='';this[_0x75dd('0xc')]='';this[_0x75dd('0xd')]='';this['stateRegistry']=_0x75dd('0x3');this[_0x75dd('0xe')]='';this[_0x75dd('0xf')]='';this[_0x75dd('0x10')]=_0x4bf411[_0x75dd('0x10')]||'';}module[_0x75dd('0x11')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 6dc636b..a3ea8ff 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 _0x9b35=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x9b35,0x1cf));var _0x59b3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9b35[_0x502c7d];return _0x30b7ed;};'use strict';function voiceExtension(_0x120890){this['id']=_0x120890['id']||0x0;this[_0x59b3('0x0')]=_0x120890['exten']||'';this[_0x59b3('0x1')]=_0x120890[_0x59b3('0x1')]||_0x59b3('0x2');this[_0x59b3('0x3')]=_0x120890[_0x59b3('0x3')]||![];}module[_0x59b3('0x4')]=voiceExtension; \ No newline at end of file +var _0x6a3f=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x43b793,_0xcf6619){var _0x3ae44f=function(_0x2e6cd8){while(--_0x2e6cd8){_0x43b793['push'](_0x43b793['shift']());}};_0x3ae44f(++_0xcf6619);}(_0x6a3f,0xb7));var _0xf6a3=function(_0x4a1647,_0x51a7ca){_0x4a1647=_0x4a1647-0x0;var _0x429446=_0x6a3f[_0x4a1647];return _0x429446;};'use strict';function voiceExtension(_0x5266f5){this['id']=_0x5266f5['id']||0x0;this['exten']=_0x5266f5[_0xf6a3('0x0')]||'';this[_0xf6a3('0x1')]=_0x5266f5[_0xf6a3('0x1')]||_0xf6a3('0x2');this['mandatoryDisposition']=_0x5266f5[_0xf6a3('0x3')]||![];}module[_0xf6a3('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 e69892f..b868ab8 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 _0xf061=['dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','gsm','rrmemory','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x54e931,_0x1c1506){var _0x5c37de=function(_0x381b71){while(--_0x381b71){_0x54e931['push'](_0x54e931['shift']());}};_0x5c37de(++_0x1c1506);}(_0xf061,0x12f));var _0x1f06=function(_0x40efea,_0x4faa8f){_0x40efea=_0x40efea-0x0;var _0x3dec65=_0xf061[_0x40efea];return _0x3dec65;};'use strict';var statusDesc=[_0x1f06('0x0'),'not_inuse',_0x1f06('0x1'),_0x1f06('0x2'),_0x1f06('0x3'),_0x1f06('0x4'),_0x1f06('0x5'),_0x1f06('0x6'),_0x1f06('0x7')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x1f06('0x8')};var strategy={'rrmemory':_0x1f06('0x9'),'roundrobin':'roundrobin'};function VoiceQueue(_0x5d109b){this['id']=_0x5d109b['id']||0x0;this[_0x1f06('0xa')]=_0x5d109b[_0x1f06('0xa')]||'';this[_0x1f06('0xb')]=_0x5d109b[_0x1f06('0xb')]||'';this[_0x1f06('0xc')]=_0x5d109b[_0x1f06('0xc')]||_0x1f06('0xd');this[_0x1f06('0xe')]=0x0;this['talking']=0x0;this[_0x1f06('0xf')]=0x0;this[_0x1f06('0x10')]=0x0;this[_0x1f06('0x11')]=0x0;this[_0x1f06('0x12')]=0x0;this[_0x1f06('0x13')]=0x0;this[_0x1f06('0x14')]=0x0;this[_0x1f06('0x15')]=0x0;this[_0x1f06('0x16')]=0x0;this[_0x1f06('0x17')]=0x0;this[_0x1f06('0x18')]=_0x5d109b[_0x1f06('0x18')]||![];this[_0x1f06('0x19')]=_0x5d109b[_0x1f06('0x19')]||0xa;this[_0x1f06('0x1a')]=_0x5d109b[_0x1f06('0x1a')]||'no';this[_0x1f06('0x1b')]=!![];this[_0x1f06('0x1c')]='';this[_0x1f06('0x1d')]=0x0;this[_0x1f06('0x1e')]=0x0;this['dialTimezone']=_0x5d109b['dialTimezone']||null;this[_0x1f06('0x1f')]=_0x5d109b[_0x1f06('0x1f')]?_0x5d109b[_0x1f06('0x1f')]:null;this['dialActive']=_0x5d109b[_0x1f06('0x20')];this[_0x1f06('0x21')]=_0x5d109b[_0x1f06('0x21')]||'progressive';this[_0x1f06('0x22')]=_0x5d109b[_0x1f06('0x22')]||0x0;this['dialLimitQueue']=_0x5d109b['dialLimitQueue']||0x0;this['dialPowerLevel']=_0x5d109b[_0x1f06('0x23')]||0x1;this[_0x1f06('0x24')]=_0x5d109b[_0x1f06('0x24')]||_0x1f06('0x25');this[_0x1f06('0x26')]=_0x5d109b[_0x1f06('0x26')]||0.03;this['dialPredictiveInterval']=_0x5d109b[_0x1f06('0x27')]||0x258;this[_0x1f06('0x28')]=_0x5d109b[_0x1f06('0x28')]||'anonymous';this[_0x1f06('0x29')]=_0x5d109b[_0x1f06('0x29')]||_0x1f06('0x2a');this[_0x1f06('0x2b')]=_0x5d109b['dialOriginateTimeout']||0x1e;this[_0x1f06('0x2c')]=_0x5d109b[_0x1f06('0x2c')]||_0x1f06('0x2d');this['dialQueueTimeout']=_0x5d109b[_0x1f06('0x2e')]||0x3;this['dialQueueProject']=_0x5d109b[_0x1f06('0x2f')]||undefined;this[_0x1f06('0x30')]=_0x5d109b[_0x1f06('0x30')]||0x3;this[_0x1f06('0x31')]=_0x5d109b[_0x1f06('0x31')]||0x96;this[_0x1f06('0x32')]=_0x5d109b[_0x1f06('0x32')]||0x3;this['dialBusyRetryFrequency']=_0x5d109b[_0x1f06('0x33')]||0x96;this[_0x1f06('0x34')]=_0x5d109b[_0x1f06('0x34')]||0x3;this[_0x1f06('0x35')]=_0x5d109b[_0x1f06('0x35')]||0x96;this[_0x1f06('0x36')]=_0x5d109b[_0x1f06('0x36')]||0x3;this[_0x1f06('0x37')]=_0x5d109b[_0x1f06('0x37')]||0x96;this[_0x1f06('0x38')]=_0x5d109b[_0x1f06('0x38')]||0x3;this[_0x1f06('0x39')]=_0x5d109b[_0x1f06('0x39')]||0x96;this[_0x1f06('0x3a')]=_0x5d109b['dialAbandonedMaxRetry']||0x3;this[_0x1f06('0x3b')]=_0x5d109b[_0x1f06('0x3b')]||0x96;this[_0x1f06('0x3c')]=_0x5d109b[_0x1f06('0x3c')]||0x3;this[_0x1f06('0x3d')]=_0x5d109b[_0x1f06('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x5d109b['dialAgentRejectMaxRetry']||0x3;this[_0x1f06('0x3e')]=_0x5d109b[_0x1f06('0x3e')]||0x96;this['dialGlobalMaxRetry']=_0x5d109b[_0x1f06('0x3f')]||0x4;this[_0x1f06('0x40')]=_0x5d109b[_0x1f06('0x40')]?_0x5d109b[_0x1f06('0x40')]:undefined;this[_0x1f06('0x41')]=_0x5d109b[_0x1f06('0x41')]?_0x5d109b[_0x1f06('0x41')]:undefined;this[_0x1f06('0x42')]=_0x5d109b[_0x1f06('0x42')]||undefined;this[_0x1f06('0x43')]=_0x5d109b[_0x1f06('0x43')]?_0x5d109b['Interval']:undefined;this[_0x1f06('0x44')]=_0x5d109b[_0x1f06('0x44')]||_0x1f06('0x45');this[_0x1f06('0x46')]=_0x5d109b['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x1f06('0x47')]=_0x5d109b['dialCutDigit']||undefined;this[_0x1f06('0x48')]=strategy[_0x5d109b['strategy']]||_0x1f06('0x9');this[_0x1f06('0x49')]=!![];this['dialAMDActive']=_0x5d109b[_0x1f06('0x4a')]||![];this[_0x1f06('0x4b')]=_0x5d109b['dialAMDInitialSilence'];this[_0x1f06('0x4c')]=_0x5d109b[_0x1f06('0x4c')];this[_0x1f06('0x4d')]=_0x5d109b[_0x1f06('0x4d')];this[_0x1f06('0x4e')]=_0x5d109b[_0x1f06('0x4e')];this['dialAMDMinWordLength']=_0x5d109b['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x5d109b[_0x1f06('0x4f')];this['dialAMDMaximumNumberOfWords']=_0x5d109b['dialAMDMaximumNumberOfWords'];this[_0x1f06('0x50')]=_0x5d109b[_0x1f06('0x50')];this[_0x1f06('0x51')]=_0x5d109b['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x1f06('0x52')]=0x0;this[_0x1f06('0x53')]=_0x5d109b[_0x1f06('0x53')];this[_0x1f06('0x54')]=0x0;this[_0x1f06('0x55')]=0x0;this[_0x1f06('0x56')]=0x0;this[_0x1f06('0x57')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x1f06('0x58')]=0x0;this[_0x1f06('0x59')]=0x0;this[_0x1f06('0x5a')]=0x0;this[_0x1f06('0x5b')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x1f06('0x5c')]=0x0;this[_0x1f06('0x5d')]=0x0;this[_0x1f06('0x5e')]=0x0;this[_0x1f06('0x5f')]=0x0;this['startProgressive']=undefined;this[_0x1f06('0x60')]=undefined;this[_0x1f06('0x61')]=undefined;this[_0x1f06('0x62')]=1.05;this[_0x1f06('0x63')]=0x0;this[_0x1f06('0x64')]=0x0;this[_0x1f06('0x65')]=0x0;this[_0x1f06('0x66')]=0x0;this[_0x1f06('0x67')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0x1f06('0x68')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x1f06('0x69')]=_0x5d109b[_0x1f06('0x6a')]||0x14;this[_0x1f06('0x6b')]=_0x5d109b[_0x1f06('0x6a')]||0xa;this[_0x1f06('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x1f06('0x6d')]=0x1;this[_0x1f06('0x6e')]=0x0;this[_0x1f06('0x6f')]=0x0;this[_0x1f06('0x70')]=0x0;this['erlangBusyFactor']=0x0;this[_0x1f06('0x71')]=_0x5d109b[_0x1f06('0x71')]||0x1e;this['dialRecallInQueue']=_0x5d109b[_0x1f06('0x72')]||![];this[_0x1f06('0x73')]=!!_0x5d109b[_0x1f06('0x73')]||![];this[_0x1f06('0x74')]=!!_0x5d109b['dialPreviewRecallmeReminder']||![];this[_0x1f06('0x75')]=_0x5d109b[_0x1f06('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x5d109b[_0x1f06('0x76')]||![];this[_0x1f06('0x77')]=_0x5d109b[_0x1f06('0x77')]||![];this[_0x1f06('0xb')]=monitorFormat[_0x5d109b[_0x1f06('0xb')]]?monitorFormat[_0x5d109b[_0x1f06('0xb')]]:undefined;this[_0x1f06('0x78')]=_0x5d109b[_0x1f06('0x78')]||![];this[_0x1f06('0x79')]=_0x5d109b['mandatoryDispositionPause']?_0x5d109b[_0x1f06('0x79')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x8e51=['onhold','gsm','rrmemory','roundrobin','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','invalid','unavailable','ringinuse'];(function(_0x4f0ac9,_0xf8844e){var _0x1d1f24=function(_0x4f1387){while(--_0x4f1387){_0x4f0ac9['push'](_0x4f0ac9['shift']());}};_0x1d1f24(++_0xf8844e);}(_0x8e51,0x1de));var _0x18e5=function(_0x3f0651,_0x1d5c66){_0x3f0651=_0x3f0651-0x0;var _0xe7affc=_0x8e51[_0x3f0651];return _0xe7affc;};'use strict';var statusDesc=[_0x18e5('0x0'),_0x18e5('0x1'),_0x18e5('0x2'),'busy',_0x18e5('0x3'),_0x18e5('0x4'),'ringing',_0x18e5('0x5'),_0x18e5('0x6')];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x18e5('0x7')};var strategy={'rrmemory':_0x18e5('0x8'),'roundrobin':_0x18e5('0x9')};function VoiceQueue(_0x483aee){this['id']=_0x483aee['id']||0x0;this['name']=_0x483aee['name']||'';this[_0x18e5('0xa')]=_0x483aee[_0x18e5('0xa')]||'';this[_0x18e5('0xb')]=_0x483aee['type']||_0x18e5('0xc');this[_0x18e5('0xd')]=0x0;this[_0x18e5('0xe')]=0x0;this[_0x18e5('0xf')]=0x0;this[_0x18e5('0x10')]=0x0;this[_0x18e5('0x11')]=0x0;this[_0x18e5('0x12')]=0x0;this['sumBillable']=0x0;this[_0x18e5('0x13')]=0x0;this[_0x18e5('0x14')]=0x0;this[_0x18e5('0x15')]=0x0;this['available']=0x0;this['acw']=_0x483aee['acw']||![];this[_0x18e5('0x16')]=_0x483aee[_0x18e5('0x16')]||0xa;this[_0x18e5('0x17')]=_0x483aee[_0x18e5('0x17')]||'no';this[_0x18e5('0x18')]=!![];this[_0x18e5('0x19')]='';this[_0x18e5('0x1a')]=0x0;this[_0x18e5('0x1b')]=0x0;this[_0x18e5('0x1c')]=_0x483aee[_0x18e5('0x1c')]||null;this['dialGlobalInterval']=_0x483aee[_0x18e5('0x1d')]?_0x483aee[_0x18e5('0x1d')]:null;this[_0x18e5('0x1e')]=_0x483aee[_0x18e5('0x1e')];this['dialMethod']=_0x483aee[_0x18e5('0x1f')]||_0x18e5('0x20');this[_0x18e5('0x21')]=_0x483aee[_0x18e5('0x21')]||0x0;this[_0x18e5('0x22')]=_0x483aee[_0x18e5('0x22')]||0x0;this[_0x18e5('0x23')]=_0x483aee['dialPowerLevel']||0x1;this[_0x18e5('0x24')]=_0x483aee[_0x18e5('0x24')]||_0x18e5('0x25');this['dialPredictiveOptimizationPercentage']=_0x483aee[_0x18e5('0x26')]||0.03;this['dialPredictiveInterval']=_0x483aee[_0x18e5('0x27')]||0x258;this[_0x18e5('0x28')]=_0x483aee[_0x18e5('0x28')]||_0x18e5('0x29');this[_0x18e5('0x2a')]=_0x483aee[_0x18e5('0x2a')]||_0x18e5('0x29');this[_0x18e5('0x2b')]=_0x483aee[_0x18e5('0x2b')]||0x1e;this[_0x18e5('0x2c')]=_0x483aee[_0x18e5('0x2c')]||_0x18e5('0x2d');this[_0x18e5('0x2e')]=_0x483aee['dialQueueTimeout']||0x3;this[_0x18e5('0x2f')]=_0x483aee[_0x18e5('0x2f')]||undefined;this['dialCongestionMaxRetry']=_0x483aee['dialCongestionMaxRetry']||0x3;this[_0x18e5('0x30')]=_0x483aee[_0x18e5('0x30')]||0x96;this[_0x18e5('0x31')]=_0x483aee[_0x18e5('0x31')]||0x3;this[_0x18e5('0x32')]=_0x483aee['dialBusyRetryFrequency']||0x96;this[_0x18e5('0x33')]=_0x483aee[_0x18e5('0x33')]||0x3;this[_0x18e5('0x34')]=_0x483aee['dialNoAnswerRetryFrequency']||0x96;this[_0x18e5('0x35')]=_0x483aee['dialNoSuchNumberMaxRetry']||0x3;this[_0x18e5('0x36')]=_0x483aee[_0x18e5('0x36')]||0x96;this['dialDropMaxRetry']=_0x483aee[_0x18e5('0x37')]||0x3;this[_0x18e5('0x38')]=_0x483aee['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x483aee[_0x18e5('0x39')]||0x3;this[_0x18e5('0x3a')]=_0x483aee['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x483aee['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x483aee[_0x18e5('0x3b')]||0x96;this[_0x18e5('0x3c')]=_0x483aee[_0x18e5('0x3c')]||0x3;this[_0x18e5('0x3d')]=_0x483aee[_0x18e5('0x3d')]||0x96;this['dialGlobalMaxRetry']=_0x483aee['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x483aee[_0x18e5('0x3e')]?_0x483aee['Trunk']:undefined;this[_0x18e5('0x3f')]=_0x483aee[_0x18e5('0x3f')]?_0x483aee['TrunkBackup']:undefined;this[_0x18e5('0x40')]=_0x483aee['dialPrefix']||undefined;this[_0x18e5('0x41')]=_0x483aee[_0x18e5('0x41')]?_0x483aee[_0x18e5('0x41')]:undefined;this['dialOrderByScheduledAt']=_0x483aee['dialOrderByScheduledAt']||_0x18e5('0x42');this[_0x18e5('0x43')]=_0x483aee[_0x18e5('0x43')]||undefined;this['dialCutDigit']=_0x483aee[_0x18e5('0x44')]||undefined;this[_0x18e5('0x45')]=strategy[_0x483aee[_0x18e5('0x45')]]||_0x18e5('0x8');this[_0x18e5('0x46')]=!![];this[_0x18e5('0x47')]=_0x483aee[_0x18e5('0x47')]||![];this['dialAMDInitialSilence']=_0x483aee[_0x18e5('0x48')];this[_0x18e5('0x49')]=_0x483aee[_0x18e5('0x49')];this[_0x18e5('0x4a')]=_0x483aee['dialAMDAfterGreetingSilence'];this[_0x18e5('0x4b')]=_0x483aee[_0x18e5('0x4b')];this['dialAMDMinWordLength']=_0x483aee[_0x18e5('0x4c')];this[_0x18e5('0x4d')]=_0x483aee[_0x18e5('0x4d')];this[_0x18e5('0x4e')]=_0x483aee['dialAMDMaximumNumberOfWords'];this[_0x18e5('0x4f')]=_0x483aee['dialAMDSilenceThreshold'];this[_0x18e5('0x50')]=_0x483aee[_0x18e5('0x50')];this[_0x18e5('0x51')]=0x0;this[_0x18e5('0x52')]=0x0;this[_0x18e5('0x53')]=_0x483aee['timeout'];this[_0x18e5('0x54')]=0x0;this[_0x18e5('0x55')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x18e5('0x56')]=0x0;this[_0x18e5('0x57')]=0x0;this[_0x18e5('0x58')]=0x0;this[_0x18e5('0x59')]=0x0;this[_0x18e5('0x5a')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x18e5('0x5b')]=0x0;this[_0x18e5('0x5c')]=0x0;this[_0x18e5('0x5d')]=0x0;this[_0x18e5('0x5e')]=0x0;this[_0x18e5('0x5f')]=0x0;this[_0x18e5('0x60')]=undefined;this[_0x18e5('0x61')]=undefined;this[_0x18e5('0x62')]=undefined;this[_0x18e5('0x63')]=1.05;this[_0x18e5('0x64')]=0x0;this[_0x18e5('0x65')]=0x0;this[_0x18e5('0x66')]=0x0;this[_0x18e5('0x67')]=0x0;this[_0x18e5('0x68')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x18e5('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x483aee[_0x18e5('0x6a')]||0x14;this[_0x18e5('0x6b')]=_0x483aee[_0x18e5('0x6a')]||0xa;this[_0x18e5('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x18e5('0x6d')]=0x0;this[_0x18e5('0x6e')]=0x0;this[_0x18e5('0x6f')]=0x0;this[_0x18e5('0x70')]=_0x483aee['dialRecallMeTimeout']||0x1e;this[_0x18e5('0x71')]=_0x483aee[_0x18e5('0x71')]||![];this[_0x18e5('0x72')]=!!_0x483aee[_0x18e5('0x72')]||![];this['dialPreviewRecallmeReminder']=!!_0x483aee[_0x18e5('0x73')]||![];this[_0x18e5('0x74')]=_0x483aee[_0x18e5('0x74')]||undefined;this[_0x18e5('0x75')]=_0x483aee[_0x18e5('0x75')]||![];this['dialAgiAfterHangupAgent']=_0x483aee['dialAgiAfterHangupAgent']||![];this[_0x18e5('0xa')]=monitorFormat[_0x483aee[_0x18e5('0xa')]]?monitorFormat[_0x483aee[_0x18e5('0xa')]]:undefined;this[_0x18e5('0x76')]=_0x483aee[_0x18e5('0x76')]||![];this[_0x18e5('0x77')]=_0x483aee['mandatoryDispositionPause']?_0x483aee['mandatoryDispositionPause']:undefined;}module[_0x18e5('0x78')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8d3354a..8ef983f 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 _0x52ec=['accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x2239cb,_0x1ce7e5){var _0x322c41=function(_0x397e83){while(--_0x397e83){_0x2239cb['push'](_0x2239cb['shift']());}};_0x322c41(++_0x1ce7e5);}(_0x52ec,0x162));var _0xc52e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x52ec[_0x4154a6];return _0x3b2786;};'use strict';function VtigerAccount(_0x36f5cc){this['id']=_0x36f5cc['id']||0x0;this[_0xc52e('0x0')]=_0x36f5cc[_0xc52e('0x0')]||'';this['username']=_0x36f5cc['username']||'';this[_0xc52e('0x1')]=_0x36f5cc[_0xc52e('0x1')]||'';this['remoteUri']=_0x36f5cc[_0xc52e('0x2')]||'';this[_0xc52e('0x3')]=_0x36f5cc[_0xc52e('0x3')]||'';this[_0xc52e('0x4')]=_0x36f5cc['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0xb228=['remoteUri','serverUrl','name','username'];(function(_0x525b88,_0xca0753){var _0xd2e148=function(_0x328c2b){while(--_0x328c2b){_0x525b88['push'](_0x525b88['shift']());}};_0xd2e148(++_0xca0753);}(_0xb228,0x106));var _0x8b22=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb228[_0x17d9e3];return _0x14192d;};'use strict';function VtigerAccount(_0x47b6e8){this['id']=_0x47b6e8['id']||0x0;this['name']=_0x47b6e8[_0x8b22('0x0')]||'';this[_0x8b22('0x1')]=_0x47b6e8[_0x8b22('0x1')]||'';this['accessKey']=_0x47b6e8['accessKey']||'';this[_0x8b22('0x2')]=_0x47b6e8[_0x8b22('0x2')]||'';this[_0x8b22('0x3')]=_0x47b6e8[_0x8b22('0x3')]||'';this['Configurations']=_0x47b6e8['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 462cbd1..3ca33a3 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 _0xaaf9=['username','password','token','remoteUri','authType','type','serverUrl','Configurations','name'];(function(_0xddfbdc,_0x561a0b){var _0x395d72=function(_0x2b7de6){while(--_0x2b7de6){_0xddfbdc['push'](_0xddfbdc['shift']());}};_0x395d72(++_0x561a0b);}(_0xaaf9,0x167));var _0x9aaf=function(_0x1bf0c4,_0x4ce6c9){_0x1bf0c4=_0x1bf0c4-0x0;var _0x404d42=_0xaaf9[_0x1bf0c4];return _0x404d42;};'use strict';function ZendeskAccount(_0x2fa984){this['id']=_0x2fa984['id']||0x0;this[_0x9aaf('0x0')]=_0x2fa984[_0x9aaf('0x0')]||'';this['username']=_0x2fa984[_0x9aaf('0x1')]||'';this['password']=_0x2fa984[_0x9aaf('0x2')]||'';this[_0x9aaf('0x3')]=_0x2fa984[_0x9aaf('0x3')]||'';this[_0x9aaf('0x4')]=_0x2fa984[_0x9aaf('0x4')]||'';this[_0x9aaf('0x5')]=_0x2fa984[_0x9aaf('0x5')]||'';this[_0x9aaf('0x6')]=_0x2fa984[_0x9aaf('0x6')]||'integrationTab';this[_0x9aaf('0x7')]=_0x2fa984['serverUrl']||'';this[_0x9aaf('0x8')]=_0x2fa984[_0x9aaf('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xbe82=['Configurations','exports','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x3c68e4,_0x20e968){var _0x2b35e7=function(_0x1732a7){while(--_0x1732a7){_0x3c68e4['push'](_0x3c68e4['shift']());}};_0x2b35e7(++_0x20e968);}(_0xbe82,0x1b0));var _0x2be8=function(_0x33d58c,_0x5e5732){_0x33d58c=_0x33d58c-0x0;var _0x3ee8a3=_0xbe82[_0x33d58c];return _0x3ee8a3;};'use strict';function ZendeskAccount(_0x2e75b2){this['id']=_0x2e75b2['id']||0x0;this['name']=_0x2e75b2['name']||'';this[_0x2be8('0x0')]=_0x2e75b2[_0x2be8('0x0')]||'';this['password']=_0x2e75b2[_0x2be8('0x1')]||'';this[_0x2be8('0x2')]=_0x2e75b2[_0x2be8('0x2')]||'';this['remoteUri']=_0x2e75b2[_0x2be8('0x3')]||'';this['authType']=_0x2e75b2[_0x2be8('0x4')]||'';this[_0x2be8('0x5')]=_0x2e75b2[_0x2be8('0x5')]||_0x2be8('0x6');this[_0x2be8('0x7')]=_0x2e75b2[_0x2be8('0x7')]||'';this[_0x2be8('0x8')]=_0x2e75b2[_0x2be8('0x8')]||{};}module[_0x2be8('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 cde3aeb..417b506 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 _0x244b=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0xfb70c,_0x2179a9){var _0x4b65d5=function(_0x20a586){while(--_0x20a586){_0xfb70c['push'](_0xfb70c['shift']());}};_0x4b65d5(++_0x2179a9);}(_0x244b,0x199));var _0xb244=function(_0x2e641b,_0x1b03ae){_0x2e641b=_0x2e641b-0x0;var _0x3f15a9=_0x244b[_0x2e641b];return _0x3f15a9;};'use strict';function ZohoAccount(_0x3ca5f3){this['id']=_0x3ca5f3['id']||0x0;this['name']=_0x3ca5f3[_0xb244('0x0')]||'';this['description']=_0x3ca5f3['description']||'';this[_0xb244('0x1')]=_0x3ca5f3['host']||'';this['zone']=_0x3ca5f3[_0xb244('0x2')]||'';this[_0xb244('0x3')]=_0x3ca5f3['clientId']||'';this[_0xb244('0x4')]=_0x3ca5f3[_0xb244('0x4')]||'';this[_0xb244('0x5')]=_0x3ca5f3[_0xb244('0x5')]||'';this[_0xb244('0x6')]=_0x3ca5f3[_0xb244('0x6')]||'';this[_0xb244('0x7')]=_0x3ca5f3['refreshToken']||'';this[_0xb244('0x8')]=_0x3ca5f3[_0xb244('0x8')]||{};}module[_0xb244('0x9')]=ZohoAccount; \ No newline at end of file +var _0xfcf9=['Configurations','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x3368f0,_0xf3eaa3){var _0x471300=function(_0xf8c93){while(--_0xf8c93){_0x3368f0['push'](_0x3368f0['shift']());}};_0x471300(++_0xf3eaa3);}(_0xfcf9,0xd3));var _0x9fcf=function(_0x1e3536,_0x2335b2){_0x1e3536=_0x1e3536-0x0;var _0x838e29=_0xfcf9[_0x1e3536];return _0x838e29;};'use strict';function ZohoAccount(_0x588edc){this['id']=_0x588edc['id']||0x0;this[_0x9fcf('0x0')]=_0x588edc[_0x9fcf('0x0')]||'';this[_0x9fcf('0x1')]=_0x588edc['description']||'';this['host']=_0x588edc[_0x9fcf('0x2')]||'';this[_0x9fcf('0x3')]=_0x588edc[_0x9fcf('0x3')]||'';this['clientId']=_0x588edc[_0x9fcf('0x4')]||'';this[_0x9fcf('0x5')]=_0x588edc[_0x9fcf('0x5')]||'';this[_0x9fcf('0x6')]=_0x588edc[_0x9fcf('0x6')]||'';this[_0x9fcf('0x7')]=_0x588edc[_0x9fcf('0x7')]||'';this[_0x9fcf('0x8')]=_0x588edc[_0x9fcf('0x8')]||'';this[_0x9fcf('0x9')]=_0x588edc[_0x9fcf('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 19cfb2f..3f981be 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 _0xdb80=['countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','Agent','name','channelAgent','format','membername','calleridname','Contact','firstName','lastName','phone','scheduledat'];(function(_0x245f5c,_0xeb9b14){var _0x48a3a8=function(_0x3c51fb){while(--_0x3c51fb){_0x245f5c['push'](_0x245f5c['shift']());}};_0x48a3a8(++_0xeb9b14);}(_0xdb80,0x1d8));var _0x0db8=function(_0x1bfc60,_0x50aff7){_0x1bfc60=_0x1bfc60-0x0;var _0x2046ae=_0xdb80[_0x1bfc60];return _0x2046ae;};'use strict';var util=require(_0x0db8('0x0'));var _=require(_0x0db8('0x1'));var moment=require('moment');function checkNameSurname(_0x3e120a,_0x3ecd58,_0x357883){var _0x31c95f='';if(!_[_0x0db8('0x2')](_0x3ecd58)&&'string'===typeof _0x3ecd58){_0x31c95f+=_0x3ecd58;}if(!_[_0x0db8('0x2')](_0x357883)&&_0x0db8('0x3')===typeof _0x357883){_0x31c95f+='\x20'+_0x357883;}if(_0x31c95f!==''){return _0x31c95f;}return _0x3e120a;}function Action(_0x115890,_0x3452c8,_0x96729,_0x2b82fe,_0x684997){this[_0x0db8('0x4')]=_0x96729||undefined;this[_0x0db8('0x5')]=_0x115890['id'];this[_0x0db8('0x6')]=_0x3452c8['name'];this[_0x0db8('0x7')]=_0x3452c8['type'];this[_0x0db8('0x8')]='queue';this['dialAnswer']=![];this['membername']=_['isNil'](_0x115890['Agent'])?undefined:_0x115890[_0x0db8('0x9')][_0x0db8('0xa')];this[_0x0db8('0xb')]=this['membername']?util[_0x0db8('0xc')]('SIP/%s',this[_0x0db8('0xd')]):_0x2b82fe||undefined;this[_0x0db8('0xe')]=checkNameSurname(_0x115890[_0x0db8('0xf')]['phone'],_0x115890[_0x0db8('0xf')][_0x0db8('0x10')],_0x115890[_0x0db8('0xf')][_0x0db8('0x11')]);this['active']=_0x115890['active']||![];this['calleridnum']=_0x115890['Contact'][_0x0db8('0x12')];this[_0x0db8('0x13')]=_0x115890['scheduledat'];this[_0x0db8('0x14')]=_0x115890[_0x0db8('0x14')]||0x0;this[_0x0db8('0x15')]=_0x115890['countcongestionretry']||0x0;this['countnoanswerretry']=_0x115890[_0x0db8('0x16')]||0x0;this['countglobal']=(_0x115890['countbusyretry']||0x0)+(_0x115890[_0x0db8('0x15')]||0x0)+(_0x115890[_0x0db8('0x16')]||0x0)+(_0x115890['countnosuchnumberretry']||0x0)+(_0x115890[_0x0db8('0x17')]||0x0)+(_0x115890[_0x0db8('0x18')]||0x0)+(_0x115890[_0x0db8('0x19')]||0x0)+(_0x115890[_0x0db8('0x1a')]||0x0);this[_0x0db8('0x1b')]=_0x115890[_0x0db8('0x1b')]||0x0;this[_0x0db8('0x17')]=_0x115890[_0x0db8('0x17')]||0x0;this[_0x0db8('0x18')]=_0x115890[_0x0db8('0x18')]||0x0;this[_0x0db8('0x19')]=_0x115890[_0x0db8('0x19')]||0x0;this['countagentrejectretry']=_0x115890[_0x0db8('0x1a')]||0x0;this[_0x0db8('0x1c')]=_0x115890[_0x0db8('0x1c')];this['callbackuniqueid']=_0x115890[_0x0db8('0x1d')];this['callbackat']=_0x115890[_0x0db8('0x1e')];this['recallme']=_0x115890[_0x0db8('0x1f')];this['ContactId']=_0x115890[_0x0db8('0x20')];this[_0x0db8('0x21')]=_0x115890[_0x0db8('0x21')];this[_0x0db8('0x22')]=_[_0x0db8('0x2')](_0x115890[_0x0db8('0x9')])?_0x115890[_0x0db8('0x22')]:_0x115890[_0x0db8('0x9')]['id'];this[_0x0db8('0x23')]=_0x115890[_0x0db8('0x23')];this[_0x0db8('0x24')]='';this['originatecalleridname']='';}Action[_0x0db8('0x25')][_0x0db8('0x26')]=function(){return util[_0x0db8('0xc')](_0x0db8('0x27'),this[_0x0db8('0xe')],this['number']);};module[_0x0db8('0x28')]=Action; \ No newline at end of file +var _0x121c=['uniqueid','queue','name','type','membername','Agent','channelAgent','format','calleridname','Contact','firstName','active','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string'];(function(_0x34ee8b,_0x4cf7aa){var _0x38619c=function(_0x17d8c5){while(--_0x17d8c5){_0x34ee8b['push'](_0x34ee8b['shift']());}};_0x38619c(++_0x4cf7aa);}(_0x121c,0x77));var _0xc121=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x121c[_0x243b2f];return _0xcb3c2d;};'use strict';var util=require(_0xc121('0x0'));var _=require(_0xc121('0x1'));var moment=require('moment');function checkNameSurname(_0x1495da,_0x4f89ff,_0xa12427){var _0x31a5a6='';if(!_[_0xc121('0x2')](_0x4f89ff)&&_0xc121('0x3')===typeof _0x4f89ff){_0x31a5a6+=_0x4f89ff;}if(!_[_0xc121('0x2')](_0xa12427)&&'string'===typeof _0xa12427){_0x31a5a6+='\x20'+_0xa12427;}if(_0x31a5a6!==''){return _0x31a5a6;}return _0x1495da;}function Action(_0x8e6ea9,_0x9568d1,_0x214a84,_0x37de42,_0x2adda7){this[_0xc121('0x4')]=_0x214a84||undefined;this['idContact']=_0x8e6ea9['id'];this[_0xc121('0x5')]=_0x9568d1[_0xc121('0x6')];this[_0xc121('0x7')]=_0x9568d1['type'];this['campaigntype']=_0xc121('0x5');this['dialAnswer']=![];this[_0xc121('0x8')]=_[_0xc121('0x2')](_0x8e6ea9[_0xc121('0x9')])?undefined:_0x8e6ea9[_0xc121('0x9')]['name'];this[_0xc121('0xa')]=this[_0xc121('0x8')]?util[_0xc121('0xb')]('SIP/%s',this[_0xc121('0x8')]):_0x37de42||undefined;this[_0xc121('0xc')]=checkNameSurname(_0x8e6ea9[_0xc121('0xd')]['phone'],_0x8e6ea9[_0xc121('0xd')][_0xc121('0xe')],_0x8e6ea9[_0xc121('0xd')]['lastName']);this[_0xc121('0xf')]=_0x8e6ea9[_0xc121('0xf')]||![];this['calleridnum']=_0x8e6ea9['Contact'][_0xc121('0x10')];this[_0xc121('0x11')]=_0x8e6ea9[_0xc121('0x11')];this[_0xc121('0x12')]=_0x8e6ea9[_0xc121('0x12')]||0x0;this[_0xc121('0x13')]=_0x8e6ea9[_0xc121('0x13')]||0x0;this[_0xc121('0x14')]=_0x8e6ea9[_0xc121('0x14')]||0x0;this[_0xc121('0x15')]=(_0x8e6ea9[_0xc121('0x12')]||0x0)+(_0x8e6ea9[_0xc121('0x13')]||0x0)+(_0x8e6ea9[_0xc121('0x14')]||0x0)+(_0x8e6ea9[_0xc121('0x16')]||0x0)+(_0x8e6ea9[_0xc121('0x17')]||0x0)+(_0x8e6ea9['countabandonedretry']||0x0)+(_0x8e6ea9[_0xc121('0x18')]||0x0)+(_0x8e6ea9[_0xc121('0x19')]||0x0);this[_0xc121('0x16')]=_0x8e6ea9['countnosuchnumberretry']||0x0;this[_0xc121('0x17')]=_0x8e6ea9[_0xc121('0x17')]||0x0;this[_0xc121('0x1a')]=_0x8e6ea9[_0xc121('0x1a')]||0x0;this[_0xc121('0x18')]=_0x8e6ea9[_0xc121('0x18')]||0x0;this[_0xc121('0x19')]=_0x8e6ea9[_0xc121('0x19')]||0x0;this['callback']=_0x8e6ea9[_0xc121('0x1b')];this['callbackuniqueid']=_0x8e6ea9[_0xc121('0x1c')];this[_0xc121('0x1d')]=_0x8e6ea9[_0xc121('0x1d')];this['recallme']=_0x8e6ea9[_0xc121('0x1e')];this['ContactId']=_0x8e6ea9[_0xc121('0x1f')];this['ListId']=_0x8e6ea9[_0xc121('0x20')];this[_0xc121('0x21')]=_['isNil'](_0x8e6ea9[_0xc121('0x9')])?_0x8e6ea9[_0xc121('0x21')]:_0x8e6ea9[_0xc121('0x9')]['id'];this[_0xc121('0x22')]=_0x8e6ea9[_0xc121('0x22')];this[_0xc121('0x23')]='';this[_0xc121('0x24')]='';}Action[_0xc121('0x25')][_0xc121('0x26')]=function(){return util[_0xc121('0xb')](_0xc121('0x27'),this[_0xc121('0xc')],this['number']);};module[_0xc121('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 25cc99a..f8235b6 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 _0x5178=['[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','idContact','custom:agentringnoanswer','rejected','YYYY-MM-DD\x20HH:mm:ss','Answer','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','callProgressDetectingAgent','transfer','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','name','strategy','answered','available','loggedIn','sumBillable','sumDuration','talking','total','type','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','loopCampaigns','syncCampaigns','hasOwnProperty','booked','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','originated:\x20','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','dialAnswer','queue','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','format','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','\x20Queue','BUSY','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','linkedid','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','destlinkedid','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','Contact\x20is\x20undefined','Queue','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','logger','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','SIP/%s','reachable','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Empty\x20Contact','[Preview][validateContact][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','dialPrefix','dialCutDigit','Contact','substring','trim','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','starttime','Action','[originated][increment]','OriginateError'];(function(_0x13d8cb,_0x49b7bc){var _0x50e8bb=function(_0x54c15b){while(--_0x54c15b){_0x13d8cb['push'](_0x13d8cb['shift']());}};_0x50e8bb(++_0x49b7bc);}(_0x5178,0x171));var _0x8517=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x5178[_0x1035c1];return _0x308d67;};'use strict';var util=require('util');var _=require(_0x8517('0x0'));var BPromise=require(_0x8517('0x1'));var uuid=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var md5=require(_0x8517('0x4'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x8517('0x5'))(_0x8517('0x6'));var loggerAction=require('../../../config/logger')(_0x8517('0x7'));var ami=require('../ami');var rpcDb=require(_0x8517('0x8'));var Action=require(_0x8517('0x9'));var ut=require(_0x8517('0xa'));config[_0x8517('0xb')]=_[_0x8517('0xc')](config['redis'],{'host':_0x8517('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x8517('0xe')][_0x8517('0xf')]=function(_0x4dac4d){this[_0x8517('0x10')]=this[_0x8517('0x10')]?this[_0x8517('0x10')][_0x8517('0x11')](_0x4dac4d):_0x4dac4d();};function Preview(_0x1b4fc2){this[_0x8517('0x12')]=new Sequence();this[_0x8517('0x13')]=_0x1b4fc2[_0x8517('0x14')];this['trunks']=_0x1b4fc2[_0x8517('0x15')];this[_0x8517('0x16')]={};this[_0x8517('0x17')]=_0x1b4fc2[_0x8517('0x17')];this[_0x8517('0x18')]=0x0;ami['on']('originateresponse',this[_0x8517('0x19')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1b'),this[_0x8517('0x1c')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1d'),this[_0x8517('0x1e')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x1f'),this[_0x8517('0x20')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x21'),this['syncNewExten'][_0x8517('0x1a')](this));ami['on'](_0x8517('0x22'),this[_0x8517('0x23')][_0x8517('0x1a')](this));ami['on'](_0x8517('0x24'),this[_0x8517('0x25')][_0x8517('0x1a')](this));ami['on']('blindtransfer',this[_0x8517('0x26')]['bind'](this));this['loopCampaigns'](this[_0x8517('0x13')]);}function emit(_0x157bea,_0xf35d95,_0x180d8d){io['to'](_0x157bea)[_0x8517('0x27')](_0xf35d95,_0x180d8d);}function emitCampaignPreview(_0xdfde16){if(_0xdfde16['type']==='outbound'){var _0x2dd1df={'id':_0xdfde16['id'],'name':_0xdfde16[_0x8517('0x28')],'strategy':_0xdfde16[_0x8517('0x29')],'answered':_0xdfde16[_0x8517('0x2a')],'available':_0xdfde16[_0x8517('0x2b')],'loggedIn':_0xdfde16[_0x8517('0x2c')],'pTalking':_0xdfde16['pTalking'],'sumBillable':_0xdfde16[_0x8517('0x2d')],'sumDuration':_0xdfde16[_0x8517('0x2e')],'sumHoldTime':_0xdfde16['sumHoldTime']||0x0,'talking':_0xdfde16[_0x8517('0x2f')],'total':_0xdfde16[_0x8517('0x30')],'type':_0xdfde16[_0x8517('0x31')],'unmanaged':_0xdfde16['unmanaged'],'abandoned':_0xdfde16[_0x8517('0x32')],'waiting':_0xdfde16['waiting'],'loggedInDb':_0xdfde16[_0x8517('0x33')],'dialActive':_0xdfde16[_0x8517('0x34')],'dialMethod':_0xdfde16[_0x8517('0x35')],'dialOriginateCallerIdName':_0xdfde16[_0x8517('0x36')],'dialOriginateCallerIdNumber':_0xdfde16[_0x8517('0x37')],'dialOriginateTimeout':_0xdfde16[_0x8517('0x38')],'dialPrefix':_0xdfde16['dialPrefix'],'outboundAnswerAgiCallsDay':_0xdfde16[_0x8517('0x39')],'outboundAnswerCallsDay':_0xdfde16['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xdfde16[_0x8517('0x3a')],'outboundBusyCallsDay':_0xdfde16[_0x8517('0x3b')],'outboundCongestionCallsDay':_0xdfde16[_0x8517('0x3c')],'outboundDropCallsDayACS':_0xdfde16[_0x8517('0x3d')],'outboundDropCallsDayCallersExit':_0xdfde16[_0x8517('0x3e')],'outboundDropCallsDayTimeout':_0xdfde16[_0x8517('0x3f')],'outboundNoAnswerCallsDay':_0xdfde16['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xdfde16[_0x8517('0x40')],'outboundOriginateFailureCallsDay':_0xdfde16['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0xdfde16[_0x8517('0x41')],'outboundRejectCallsDay':_0xdfde16[_0x8517('0x42')],'outboundUnknownCallsDay':_0xdfde16[_0x8517('0x43')],'outboundAbandonedCallsDay':_0xdfde16[_0x8517('0x44')],'predictiveIntervalAnsweredCalls':_0xdfde16[_0x8517('0x45')],'predictiveIntervalAvgHoldtime':_0xdfde16[_0x8517('0x46')],'predictiveIntervalAvgTalktime':_0xdfde16[_0x8517('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0xdfde16[_0x8517('0x48')],'predictiveIntervalDroppedCallsTimeout':_0xdfde16[_0x8517('0x49')],'predictiveIntervalErlangCalls':_0xdfde16['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0xdfde16[_0x8517('0x4a')],'predictiveIntervalHitRate':_0xdfde16[_0x8517('0x4b')],'predictiveIntervalMultiplicativeFactor':_0xdfde16[_0x8517('0x4c')],'predictiveIntervalPauses':_0xdfde16['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xdfde16['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0xdfde16['predictiveIntervalTotalCalls'],'message':_0xdfde16[_0x8517('0x4d')],'originated':_0xdfde16[_0x8517('0x4e')],'erlangCalls':_0xdfde16[_0x8517('0x4f')],'erlangCallToSecond':_0xdfde16[_0x8517('0x50')],'erlangAbandonmentRate':_0xdfde16[_0x8517('0x51')],'erlangBusyFactor':_0xdfde16[_0x8517('0x52')],'startPredictive':_0xdfde16['startPredictive'],'startProgressive':_0xdfde16[_0x8517('0x53')]};if(_0xdfde16[_0x8517('0x54')]){_0x2dd1df[_0x8517('0x54')]={'id':_0xdfde16['Trunk']['id'],'name':_0xdfde16[_0x8517('0x54')]['name'],'active':_0xdfde16[_0x8517('0x54')][_0x8517('0x55')],'callerid':_0xdfde16['Trunk']['callerid']};}if(_0xdfde16[_0x8517('0x56')]){_0x2dd1df[_0x8517('0x56')]={'id':_0xdfde16[_0x8517('0x56')]['id'],'name':_0xdfde16[_0x8517('0x56')]['name']};}var _0x5b1d34=md5(JSON[_0x8517('0x57')](_0x2dd1df));if(_0xdfde16[_0x8517('0x4')]!==_0x5b1d34){_0xdfde16[_0x8517('0x4')]=_0x5b1d34;emit(util['format'](_0x8517('0x58'),_0x2dd1df[_0x8517('0x28')]),'voice_queue:save',_0x2dd1df);}}}function emitVoiceQueueChannelRemove(_0x209235){logger[_0x8517('0x59')](_0x8517('0x5a'),JSON[_0x8517('0x57')](_0x209235));emit(util['format'](_0x8517('0x58'),_0x209235[_0x8517('0x28')]),_0x8517('0x5b'),_0x209235);io[_0x8517('0x27')](_0x8517('0x5c'),_0x209235);}function notSendMessagesQueue(_0x22592a){if(_0x22592a[_0x8517('0x5d')]){if(_0x22592a[_0x8517('0x4e')]===0x0&&_0x22592a[_0x8517('0x5e')]===0x0){_0x22592a[_0x8517('0x5d')]=![];_0x22592a[_0x8517('0x2b')]=0x0;_0x22592a[_0x8517('0x5f')]=0x0;_0x22592a[_0x8517('0x4d')]='NOT_ACTIVE';ut['logger'](_0x8517('0x60'),_0x22592a[_0x8517('0x28')]+_0x8517('0x61'));}else{_0x22592a[_0x8517('0x4d')]=_0x8517('0x62');ut['logger'](_0x8517('0x60'),_0x22592a[_0x8517('0x28')]+'\x20is\x20disactive');}emitCampaignPreview(_0x22592a);}}Preview[_0x8517('0xe')][_0x8517('0x63')]=function(){var _0x32fba6=this;setInterval(function(){_0x32fba6[_0x8517('0x64')]();},0x7cf);};Preview['prototype'][_0x8517('0x64')]=function(){var _0x24034f=this['campaignsPreview'];this[_0x8517('0x18')]+=0x1;for(var _0x275960 in _0x24034f){if(_0x24034f[_0x8517('0x65')](_0x275960)&&(_0x24034f[_0x275960]['dialMethod']===_0x8517('0x6')||_0x24034f[_0x275960][_0x8517('0x35')]===_0x8517('0x66'))&&_0x24034f[_0x275960][_0x8517('0x31')]===_0x8517('0x67')){if(this[_0x8517('0x18')]>0x7){this[_0x8517('0x18')]=0x0;this['clearZombieChannels']();}}if(_0x24034f[_0x8517('0x65')](_0x275960)&&_0x24034f[_0x275960][_0x8517('0x35')]==='preview'&&_0x24034f[_0x275960][_0x8517('0x31')]===_0x8517('0x67')){if(_0x24034f[_0x275960][_0x8517('0x34')]){this[_0x8517('0x68')](_0x24034f[_0x275960]);if(_0x24034f[_0x275960][_0x8517('0x69')])this[_0x8517('0x6a')](_0x24034f[_0x275960]);}else{notSendMessagesQueue(_0x24034f[_0x275960]);}}}};Preview['prototype'][_0x8517('0x6b')]=function(_0x10c07a){var _0x3a9778=this;this['sequence'][_0x8517('0xf')](function(){if(!_[_0x8517('0x6c')](_0x3a9778['actions'][_0x10c07a])){loggerAction[_0x8517('0x59')](_0x8517('0x6d'),_0x10c07a,'Queue',_0x3a9778['actions'][_0x10c07a]['queue'],_0x8517('0x6e'),JSON[_0x8517('0x57')](_0x3a9778['campaignsPreview'][_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']]['originated']),_0x8517('0x6f'),JSON[_0x8517('0x57')](_0x3a9778[_0x8517('0x13')][_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']][_0x8517('0x5e')]),JSON[_0x8517('0x57')](_0x3a9778[_0x8517('0x16')][_0x10c07a]['dialAnswer']),JSON[_0x8517('0x57')](_[_0x8517('0x70')](_0x3a9778[_0x8517('0x16')][_0x10c07a],[_0x8517('0x71'),_0x8517('0x72'),_0x8517('0x73'),_0x8517('0x74')])));return ami['Action']({'action':_0x8517('0x75'),'channel':_0x3a9778['actions'][_0x10c07a]['channel']})[_0x8517('0x76')](function(_0x776ee2){if(_0x776ee2[_0x8517('0x4d')]===_0x8517('0x77')){setTimeout(function(){if(_0x3a9778['actions'][_0x10c07a]){ut[_0x8517('0x78')](_0x3a9778[_0x8517('0x13')][_0x3a9778['actions'][_0x10c07a]['queue']],_0x8517('0x79'));if(_0x3a9778[_0x8517('0x16')][_0x10c07a][_0x8517('0x7a')]===!![]){ut['decrementTalkink'](_0x3a9778[_0x8517('0x13')][_0x3a9778['actions'][_0x10c07a][_0x8517('0x7b')]],_0x8517('0x79'));ut[_0x8517('0x7c')](_0x8517('0x7d')+_0x10c07a,_0x3a9778[_0x8517('0x16')][_0x10c07a][_0x8517('0x7b')]);}ut[_0x8517('0x7c')](_0x8517('0x7e')+_0x10c07a,_0x3a9778[_0x8517('0x16')][_0x10c07a]['queue']);delete _0x3a9778['actions'][_0x10c07a];}},0x2328);}});}});};Preview[_0x8517('0xe')][_0x8517('0x7f')]=function(){var _0x260aa9=this;loggerAction['info'](_0x8517('0x80'),_[_0x8517('0x81')](this[_0x8517('0x16')]));for(var _0x4cc9e2 in this['actions']){if(_0x260aa9[_0x8517('0x16')][_0x8517('0x65')](_0x4cc9e2)){_0x260aa9[_0x8517('0x6b')](_0x4cc9e2);}}};Preview[_0x8517('0xe')][_0x8517('0x6a')]=function(_0x3be6db){var _0x3d8773=this;rpcDb[_0x8517('0x82')](_0x3be6db['id'],ut[_0x8517('0x83')](this[_0x8517('0x17')]))[_0x8517('0x84')](function(_0x3c5462){if(!_[_0x8517('0x6c')](_0x3c5462)){for(var _0x20dc60=0x0;_0x20dc60<_0x3c5462[_0x8517('0x85')];_0x20dc60+=0x1){if(ut[_0x8517('0x86')](_0x3c5462[_0x20dc60]['scheduledat'])<_0x3be6db[_0x8517('0x87')]*0x3c){if(_0x3c5462[_0x20dc60][_0x8517('0x88')]&&!_0x3c5462[_0x20dc60][_0x8517('0x88')][_0x8517('0x89')]){_0x3d8773[_0x8517('0x8a')](_0x3c5462[_0x20dc60]['id'])[_0x8517('0x84')](ut[_0x8517('0x8b')]('[RecallMe]'))[_0x8517('0x76')](ut[_0x8517('0x8b')](_0x8517('0x8c')));}else{rpcDb[_0x8517('0x8d')](_0x3c5462[_0x20dc60]['id']);}}else{var _0x4240d0=new Action(_0x3c5462[_0x20dc60],_0x3be6db);_0x4240d0['starttime']=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3be6db[_0x8517('0x41')]+=0x1;ut[_0x8517('0x8f')](_0x4240d0,0x17,_0x8517('0x90'));if(_0x3be6db[_0x8517('0x91')]){rpcDb[_0x8517('0x92')](ut['createBody'](_0x3c5462[_0x20dc60]));rpcDb[_0x8517('0x93')](_0x4240d0,_0x8517('0x94'));}else{ut[_0x8517('0x8f')](_0x4240d0,0x16,_0x8517('0x95'));rpcDb['createCustomerHistory'](_0x4240d0,'[HistoryRecallClose]');rpcDb[_0x8517('0x96')](_0x4240d0,'[HistoryRecallClose]');}}}}})[_0x8517('0x76')](ut[_0x8517('0x8b')]('[getContactRecallMe]'));};Preview[_0x8517('0xe')][_0x8517('0x68')]=function(_0x4a483d){_0x4a483d[_0x8517('0x5d')]=!![];if(ut[_0x8517('0x97')](_0x4a483d[_0x8517('0x2c')])){_0x4a483d[_0x8517('0x4d')]=_0x8517('0x98');}else if(!ut[_0x8517('0x99')](_0x4a483d[_0x8517('0x34')])){_0x4a483d[_0x8517('0x4d')]='NOT_ACTIVE';}else if(!this[_0x8517('0x9a')](_0x4a483d[_0x8517('0x54')])){if(!this[_0x8517('0x9a')](_0x4a483d[_0x8517('0x9b')])){_0x4a483d['message']=_0x8517('0x9c');}else{_0x4a483d['message']=_0x8517('0x9d');}}else{_0x4a483d[_0x8517('0x4d')]=_0x8517('0x9d');}emitCampaignPreview(_0x4a483d);};Preview[_0x8517('0xe')]['callProgressDetectingCustomer']=function(_0x56d267,_0x23be4d,_0x1f1984){var _0x462c1c=this;var _0x548fa1=this['actions'][_0x23be4d];var _0x11a801=this[_0x8517('0x13')][_0x548fa1[_0x8517('0x7b')]];var _0x197a30;if(_0x11a801){switch(_0x1f1984){case'1':_0x11a801[_0x8517('0x40')]+=0x1;_0x548fa1[_0x8517('0x9e')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x0,_0x8517('0xa1'));ami['emit'](_0x8517('0xa2'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xa4')));rpcDb['createCustomerHistory'](_0x548fa1,_0x8517('0xa5'));if(ut['totalGlobal'](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,'Global');rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xa8'));}else{if(_0x548fa1[_0x8517('0x9e')]>=_0x11a801[_0x8517('0xa9')]){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xa8'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,'countnosuchnumberretry',_0x11a801[_0x8517('0xab')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}delete this[_0x8517('0x16')][_0x56d267['linkedid']];break;case _0x8517('0xae'):var _0x670690=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');_0x548fa1[_0x8517('0xaf')]=_0x670690;_0x548fa1[_0x8517('0xb0')]=_0x670690;_0x548fa1[_0x8517('0x7a')]=!![];_0x11a801[_0x8517('0x5e')]+=0x1;logger[_0x8517('0x59')](_0x8517('0xb1'),_0x548fa1[_0x8517('0xb2')],'\x20Queue',_0x11a801[_0x8517('0x28')],'pTalking:\x20',_0x11a801['pTalking']);ami[_0x8517('0x27')](_0x8517('0xb3'),ut[_0x8517('0xa3')](_0x548fa1,'connect',this[_0x8517('0x13')][_0x548fa1[_0x8517('0x7b')]]));if(_0x11a801['acw']){ami[_0x8517('0x27')]('custom:agentConnectPreview',ut['buildAcw'](_0x548fa1));}break;case'16':ami[_0x8517('0x27')](_0x8517('0xb4'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xb5'),this[_0x8517('0x13')][_0x548fa1['queue']]));emitVoiceQueueChannelRemove(ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xb5')));_0x11a801['outboundAnswerCallsDay']+=0x1;_0x11a801['total']+=0x1;_0x11a801[_0x8517('0x2a')]+=0x1;ut[_0x8517('0xb6')](_0x11a801,_0x8517('0xb7'));_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x4,'Answer');rpcDb['createCustomerHistory'](_0x548fa1,_0x8517('0xb8'));rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x8517('0xb9')](_0x548fa1);_0x11a801[_0x8517('0x2e')]+=_0x548fa1['talktime'];_0x11a801[_0x8517('0x2d')]+=_0x548fa1[_0x8517('0xba')];logger[_0x8517('0x59')]('[syncHangup][talking][decrement]',_0x548fa1['uniqueid'],_0x8517('0xbb'),_0x11a801[_0x8517('0x28')],_0x8517('0x6f'),_0x11a801[_0x8517('0x5e')]);delete this[_0x8517('0x16')][_0x56d267['linkedid']];break;case _0x8517('0xbc'):_0x11a801[_0x8517('0x3b')]+=0x1;_0x548fa1['countbusyretry']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x5,_0x8517('0xbd'));ami[_0x8517('0x27')](_0x8517('0xbe'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xbf')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xc0'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xc2'));}else{if(_0x548fa1[_0x8517('0xc3')]>=_0x11a801[_0x8517('0xc4')]){rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x8517('0xc5')](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xc3'),_0x11a801[_0x8517('0xc6')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xc7'):_0x11a801['outboundNoAnswerCallsDay']+=0x1;_0x548fa1[_0x8517('0xc8')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x3,_0x8517('0xc9'));ami[_0x8517('0x27')]('custom:agentnoanswer',ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xca')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xcb'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xcc'));}else{if(_0x548fa1['countnoanswerretry']>=_0x11a801[_0x8517('0xcd')]){rpcDb['createCustomerFinal'](_0x548fa1,_0x8517('0xcb'));}else{rpcDb[_0x8517('0xc5')](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xc8'),_0x11a801[_0x8517('0xce')]),_0x548fa1[_0x8517('0xac')],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xcf'):_0x11a801[_0x8517('0x3c')]+=0x1;_0x548fa1['countcongestionretry']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x8,_0x8517('0xd0'));ami['emit'](_0x8517('0xd1'),ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xd2')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xd3'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xd4'));}else{if(_0x548fa1[_0x8517('0xd5')]>=_0x11a801['dialCongestionMaxRetry']){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xd3'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xd5'),_0x11a801['dialBusyRetryFrequency']),_0x548fa1['unlockAgent'],_0x548fa1['activeContact']);}}break;case _0x8517('0xd6'):_0x11a801['outboundRejectCallsDay']+=0x1;_0x548fa1[_0x8517('0xd7')]+=0x1;_0x548fa1['countglobal']=ut[_0x8517('0xa0')](_0x548fa1);ut['logCustomer'](_0x548fa1,0x14,_0x8517('0xd8'));ami['emit'](_0x8517('0xd9'),ut[_0x8517('0xa3')](_0x548fa1,'agentreject'));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xda'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x197a30,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x548fa1[_0x8517('0xd7')]>=_0x11a801[_0x8517('0xdb')]){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xdc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x548fa1,_0x8517('0xd7'),_0x11a801[_0x8517('0xdd')]),_0x548fa1['unlockAgent'],_0x548fa1[_0x8517('0xad')]);}}break;case _0x8517('0xde'):_0x11a801[_0x8517('0x44')]+=0x1;_0x548fa1[_0x8517('0xdf')]+=0x1;_0x548fa1['countglobal']=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0xb,_0x8517('0xe0'));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xe1'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xe1'));}else{if(_0x548fa1[_0x8517('0xe2')]>=_0x11a801['dialAbandonedMaxRety']){rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xe1'));}else{rpcDb['rescheduleContact'](ut[_0x8517('0xaa')](_0x548fa1,_0x8517('0xdf'),_0x11a801[_0x8517('0xe3')]),_0x548fa1['unlockAgent'],_0x548fa1[_0x8517('0xad')]);}}break;case'18':_0x11a801['outboundUnknownCallsDay']+=0x1;_0x548fa1[_0x8517('0xe4')]+=0x1;_0x548fa1['countglobal']=ut['totalGlobal'](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0x12,_0x56d267[_0x8517('0xe5')]||_0x56d267[_0x8517('0xe6')]);ami[_0x8517('0x27')](_0x8517('0xe7'),ut['buildObj'](_0x548fa1,_0x8517('0xe8')));rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xe9'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut['cloneAction'](_0x548fa1,0xf,'Global');rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xe9'));}else{rpcDb[_0x8517('0x96')](_0x548fa1,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xea')]];break;case'19':_0x11a801['outboundUnknownCallsDay']+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut['logCustomer'](_0x548fa1,0x13,_0x56d267['cause-txt']||_0x56d267[_0x8517('0xe6')]);ami['emit']('custom:amd',ut[_0x8517('0xa3')](_0x548fa1,_0x8517('0xe8')));rpcDb['createCustomerHistory'](_0x548fa1,'[callProgressDetectingCustomer][machine]');if(ut['totalGlobal'](_0x548fa1)>=_0x11a801['dialGlobalMaxRetry']){_0x197a30=ut['cloneAction'](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb[_0x8517('0x96')](_0x197a30,_0x8517('0xeb'));}else{rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xeb'));}delete this['actions'][_0x56d267['linkedid']];break;default:if(_0x548fa1[_0x8517('0x7a')]){ut[_0x8517('0xb6')](_0x11a801,_0x8517('0xec'));ut[_0x8517('0x7c')](_0x8517('0xed')+_0x11a801[_0x8517('0x28')],_0x56d267);}_0x11a801[_0x8517('0x43')]+=0x1;_0x548fa1[_0x8517('0x9f')]=ut[_0x8517('0xa0')](_0x548fa1);ut[_0x8517('0x8f')](_0x548fa1,0xc,_0x56d267[_0x8517('0xe5')]||_0x56d267[_0x8517('0xe6')]);rpcDb[_0x8517('0x93')](_0x548fa1,_0x8517('0xee'));if(ut[_0x8517('0xa0')](_0x548fa1)>=_0x11a801[_0x8517('0xa6')]){_0x197a30=ut[_0x8517('0xa7')](_0x548fa1,0xf,_0x8517('0xc1'));rpcDb['createCustomerFinal'](_0x197a30,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x8517('0x96')](_0x548fa1,_0x8517('0xef'));}delete this[_0x8517('0x16')][_0x56d267['linkedid']];}if(!(_0x548fa1[_0x8517('0x7a')]&&_0x1f1984==='16')){ut[_0x8517('0x78')](_0x11a801,'[callProgressDetectingCustomer]');logger[_0x8517('0x59')]('[originated][decrement][callProgressDetectingCustomer]',_0x548fa1['uniqueid'],_0x8517('0xbb'),_0x11a801['name'],'originated:\x20',_0x11a801['originated']);}if(_0x1f1984!==_0x8517('0xae')){delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xea')]];delete this[_0x8517('0x16')][_0x56d267[_0x8517('0xf0')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x547651,_0x25c45d,_0x2e8859){if(_[_0x8517('0xf1')](_0x25c45d)&&_0x8517('0xf2')!==typeof _0x25c45d){return;}if(_['isUndefined'](_0x2e8859)&&_0x8517('0xf2')!==typeof _0x2e8859){return;}switch(_0x2e8859[_0x8517('0xf3')]){case'0':ut[_0x8517('0xf4')](_0x547651,0x0,_0x8517('0xa1'));rpcDb['createAgentHistory'](_0x547651,_0x8517('0xf5'));break;case'3':ut[_0x8517('0xf4')](_0x547651,0x3,_0x8517('0xc9'));rpcDb['createAgentHistory'](_0x547651,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x547651,0x5,_0x8517('0xbd'));rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xf7'));break;case'8':ut['logAgent'](_0x547651,0x8,'Congestion');rpcDb['createAgentHistory'](_0x547651,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x8517('0xf4')](_0x547651,0x16,_0x8517('0xf8'));rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xf9'));break;default:ut[_0x8517('0xf4')](_0x547651,0xc,_0x2e8859[_0x8517('0xf3')]);rpcDb[_0x8517('0xf6')](_0x547651,_0x8517('0xfa'));}ut['updateOriginated'](_0x25c45d,_0x8517('0xfb'));logger[_0x8517('0x59')](_0x8517('0xfc'),_0x547651['uniqueid'],_0x8517('0xbb'),_0x25c45d[_0x8517('0x28')],'originated:\x20',_0x25c45d[_0x8517('0x4e')]);delete this[_0x8517('0x16')][_0x547651[_0x8517('0xb2')]];};Preview[_0x8517('0xe')][_0x8517('0xfd')]=function(_0x3784cc,_0x283f38,_0x2093e8,_0x3059a,_0x37b066){var _0x410651=this;return new BPromise(function(_0x194c1d,_0x41d647){if(_[_0x8517('0x6c')](_0x283f38)||_[_0x8517('0x6c')](_0x283f38['Contact'])||_[_0x8517('0x6c')](_0x283f38['Contact'][_0x8517('0xfe')])||_[_0x8517('0x6c')](_0x283f38[_0x8517('0x73')])){_0x41d647(ut[_0x8517('0x4d')](_0x8517('0xff'),_0x3059a,_0x37b066));return;}var _0xd8e716=uuid['v4']();var _0x4289e2=_0x410651[_0x8517('0x13')][_0x283f38[_0x8517('0x100')]['name']];var _0x5b591e=_0x2093e8?_0x410651['agents'][_0x2093e8]['id']:undefined;_0x410651[_0x8517('0x16')][_0xd8e716]=new Action(_0x283f38,_0x4289e2,_0xd8e716,_0x2093e8,_0x5b591e);var _0x16ebfb=_0x410651[_0x8517('0x16')][_0xd8e716];_0x16ebfb[_0x8517('0xac')]=_0x3059a;_0x16ebfb[_0x8517('0xad')]=_0x37b066;_0x16ebfb[_0x8517('0x101')]=_0x2093e8;if(_['isEmpty'](_0x3784cc)){_0x410651[_0x8517('0x102')](_0x16ebfb,_0x4289e2,_0x283f38,_0x2093e8)['then'](function(_0xbb4eaa){logger['info']('[Preview][execCall][success]',_0x8517('0x103')+_0x16ebfb[_0x8517('0x7b')]+_0x8517('0x104')+_0x16ebfb['idContact'],JSON[_0x8517('0x57')](_0xbb4eaa));ami['emit'](_0x8517('0x105'),ut['buildObj'](_0x16ebfb,_0x8517('0x106'),_0x410651[_0x8517('0x13')][_0x16ebfb['queue']]));_0x194c1d(ut['message']('Calling'));})[_0x8517('0x76')](function(_0x55348c){ut[_0x8517('0x107')](_0x8517('0x108'),_0x55348c);_0x41d647(ut[_0x8517('0x4d')](_0x8517('0x109'),_0x3059a,_0x37b066));});}else{_0x4289e2[_0x8517('0x3a')]+=0x1;ut[_0x8517('0x10a')](_0x16ebfb);rpcDb['createHistory'](_0x16ebfb,_0x8517('0x10b'));delete _0x410651[_0x8517('0x16')][_0xd8e716];_0x41d647(ut[_0x8517('0x4d')]('Contact\x20in\x20black\x20List',_0x3059a,_0x37b066));}});};Preview[_0x8517('0xe')][_0x8517('0x9a')]=function(_0xf83d16){return!_[_0x8517('0x6c')](_0xf83d16)&&!_['isNil'](_0xf83d16[_0x8517('0x28')])&&!_[_0x8517('0x6c')](_0xf83d16[_0x8517('0x55')])&&_0xf83d16[_0x8517('0x55')]&&!_[_0x8517('0x6c')](this['trunks'][util['format'](_0x8517('0x10c'),_0xf83d16['name'])])&&!_[_0x8517('0x6c')](this[_0x8517('0x15')][util[_0x8517('0x8e')](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])][_0x8517('0x75')])&&(this[_0x8517('0x15')][util[_0x8517('0x8e')](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])]['status']===_0x8517('0x10d')||this[_0x8517('0x15')][util['format'](_0x8517('0x10c'),_0xf83d16[_0x8517('0x28')])]['status']==='unmonitored');};Preview[_0x8517('0xe')][_0x8517('0x8a')]=function(_0x55fe4e,_0x44395a){var _0xa21a56=this;return new BPromise(function(_0x1d5f5e,_0x3a6b52){_0xa21a56[_0x8517('0x10e')](_0x55fe4e,_0x44395a)[_0x8517('0x84')](function(_0x1e71ba){_0x1d5f5e(_['pick'](_0x1e71ba,[_0x8517('0x4d')]));})[_0x8517('0x76')](function(_0x48c790){if(_0x48c790[_0x8517('0x10f')]){rpcDb[_0x8517('0x110')](_0x55fe4e);}if(_0x48c790[_0x8517('0x55')]){rpcDb[_0x8517('0x8d')](_0x55fe4e);}_0x3a6b52(_[_0x8517('0x70')](_0x48c790,[_0x8517('0x4d')]));});});};Preview[_0x8517('0xe')][_0x8517('0x10e')]=function(_0xc35223,_0x29499b){var _0x49ab5a=this;return new BPromise(function(_0x1d347e,_0x4ea202){var _0x5d2ef6,_0x1df5c8;rpcDb[_0x8517('0x111')](_0xc35223)[_0x8517('0x84')](function(_0x4602b2){if(!_[_0x8517('0x6c')](_0x4602b2[0x0])){_0x1df5c8=_0x4602b2[0x0][_0x8517('0x112')]?![]:!![];_0x5d2ef6=_0x4602b2[0x0][_0x8517('0x112')]?!![]:![];_0x5d2ef6=_0x29499b?!![]:_0x5d2ef6;}var _0x59aa36=_0x49ab5a['validateContact'](_0x4602b2);if(_0x59aa36[_0x8517('0x113')]){rpcDb[_0x8517('0x114')](_[_0x8517('0x70')](_0x4602b2[0x0],[_0x8517('0x73'),'Contact.phone']))['then'](function(_0x29844e){_0x49ab5a[_0x8517('0xfd')](_0x29844e,_0x4602b2[0x0],_0x29499b,_0x1df5c8,_0x5d2ef6)[_0x8517('0x84')](function(_0x5ac4c1){_0x1d347e(_0x5ac4c1);})[_0x8517('0x76')](function(_0x1a7d79){_0x4ea202(_0x1a7d79);});})[_0x8517('0x76')](function(_0x612f42){ut[_0x8517('0x107')](_0x8517('0x115'),_0x612f42);_0x4ea202(ut['message']('Call\x20unsuccessful',_0x1df5c8,_0x5d2ef6));});}else{_0x4ea202(ut['message'](_0x59aa36[_0x8517('0x4d')],_0x1df5c8,_0x5d2ef6));}})[_0x8517('0x76')](function(_0xb9db8f){ut[_0x8517('0x107')]('[Preview][getContactPreview]',_0xb9db8f);_0x4ea202(ut[_0x8517('0x4d')](_0x8517('0x116'),![],!![]));});});};Preview[_0x8517('0xe')]['validateContact']=function(_0x217924){if(_[_0x8517('0x6c')](_0x217924)||_[_0x8517('0x117')](_0x217924)||!_[_0x8517('0x6c')](_0x217924[0x0]['Agent'])&&_['isNil'](_0x217924[0x0]['Agent']['name'])){ut[_0x8517('0x107')]('[Preview][validateContact][Empty\x20Contact]',_0x217924);return{'isValid':![],'message':_0x8517('0x118')};}var _0x5af9cb=this['campaignsPreview'][_0x217924[0x0]['Queue']['name']];_0x5af9cb[_0x8517('0x4d')]=_0x8517('0x9d');if(_[_0x8517('0x6c')](_0x5af9cb)){ut[_0x8517('0x107')](_0x8517('0x119'),_0x5af9cb);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x8517('0x9a')](_0x5af9cb[_0x8517('0x54')])){ut[_0x8517('0x107')](_0x8517('0x11a'),_0x8517('0x11b')+_0x5af9cb[_0x8517('0x28')]+_0x8517('0x11c'));if(!this[_0x8517('0x9a')](_0x5af9cb[_0x8517('0x9b')])){ut[_0x8517('0x107')](_0x8517('0x11a'),_0x5af9cb['name']+_0x8517('0x11d'));return{'isValid':![],'message':_0x8517('0x11e')};}}if(!ut[_0x8517('0x99')](_0x5af9cb[_0x8517('0x34')])){ut[_0x8517('0x107')](_0x8517('0x11f'),_0x5af9cb[_0x8517('0x28')]+_0x8517('0x120'));return{'isValid':![],'message':_0x8517('0x11b')+_0x5af9cb[_0x8517('0x28')]+_0x8517('0x120')};}return{'isValid':!![],'message':_0x8517('0x121')};};Preview[_0x8517('0xe')][_0x8517('0x102')]=function(_0x5d74d4,_0x1e3c84,_0x15256c,_0x2ad6f7){var _0x3535e3=this;return new BPromise(function(_0x4f03be,_0x5a1c63){var _0x3fbfe0=_0x5d74d4[_0x8517('0xb2')];var _0x5a1f7d=_0x3535e3[_0x8517('0x9a')](_0x1e3c84[_0x8517('0x54')])?util['format'](_0x8517('0x122'),_0x1e3c84['Trunk']['name'],_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x123')])?'':_0x1e3c84[_0x8517('0x123')]['trim']()||'',_0x1e3c84[_0x8517('0x124')]>0x0?_0x15256c[_0x8517('0x125')][_0x8517('0xfe')][_0x8517('0x126')](_0x1e3c84[_0x8517('0x124')]):_0x15256c[_0x8517('0x125')][_0x8517('0xfe')]):util[_0x8517('0x8e')](_0x8517('0x122'),_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x9b')])?_0x1e3c84['Trunk']['name']:_0x1e3c84['TrunkBackup']['name'],_['isNil'](_0x1e3c84['dialPrefix'])?'':_0x1e3c84[_0x8517('0x123')][_0x8517('0x127')]()||'',_0x1e3c84[_0x8517('0x124')]>0x0?_0x15256c[_0x8517('0x125')][_0x8517('0xfe')][_0x8517('0x126')](_0x1e3c84[_0x8517('0x124')]):_0x15256c['Contact'][_0x8517('0xfe')]);var _0x209801=_0x3535e3[_0x8517('0x9a')](_0x1e3c84[_0x8517('0x54')])?ut[_0x8517('0x128')](_0x1e3c84[_0x8517('0x54')][_0x8517('0x129')],_0x1e3c84[_0x8517('0x36')],_0x1e3c84[_0x8517('0x12a')]>0x0?ut[_0x8517('0x12b')](_0x1e3c84['dialOriginateCallerIdNumber'],_0x1e3c84[_0x8517('0x12a')]):_0x1e3c84['dialOriginateCallerIdNumber']):ut['getCallerId'](_[_0x8517('0x6c')](_0x1e3c84[_0x8517('0x9b')])?_0x1e3c84['Trunk'][_0x8517('0x129')]:_0x1e3c84['TrunkBackup']['callerid'],_0x1e3c84[_0x8517('0x36')],_0x1e3c84[_0x8517('0x12a')]>0x0?ut[_0x8517('0x12b')](_0x1e3c84[_0x8517('0x37')],_0x1e3c84[_0x8517('0x12a')]):_0x1e3c84['dialOriginateCallerIdNumber']);if(_0x209801){_0x5d74d4[_0x8517('0x12c')]=ut[_0x8517('0x12d')](_0x209801);_0x5d74d4[_0x8517('0x12e')]=ut[_0x8517('0x12f')](_0x209801);}var _0x23d64b=ut[_0x8517('0x130')](_0x1e3c84,_0x15256c,_0x5a1f7d,_0x209801,_0x3fbfe0,_0x5d74d4);_[_0x8517('0x131')](_0x5d74d4,ut[_0x8517('0x132')](_0x23d64b));_0x5d74d4[_0x8517('0x133')]=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x8517('0x134')](ut['variablesAction'](_0x5d74d4,_0x1e3c84,_0x23d64b,_0x5d74d4[_0x8517('0xad')],_0x2ad6f7))[_0x8517('0x84')](function(_0x488062){_0x1e3c84[_0x8517('0x4e')]+=0x1;logger[_0x8517('0x59')](_0x8517('0x135'),_0x3fbfe0,_0x8517('0xbb'),_0x1e3c84[_0x8517('0x28')],_0x8517('0x6e'),_0x1e3c84[_0x8517('0x4e')]);_0x4f03be(_0x488062);})[_0x8517('0x76')](function(_0x257a0c){ut[_0x8517('0xf4')](_0x5d74d4,0xe,_0x8517('0x136'));rpcDb[_0x8517('0xf6')](_0x5d74d4,_0x8517('0x137'));_0x5a1c63(_0x257a0c);});});};Preview[_0x8517('0xe')][_0x8517('0x138')]=function(_0x18b6c4){if(this[_0x8517('0x16')][_0x18b6c4[_0x8517('0xea')]]){this[_0x8517('0x16')][_0x18b6c4[_0x8517('0xea')]]['channel']=_0x18b6c4[_0x8517('0x139')];}};Preview[_0x8517('0xe')][_0x8517('0x19')]=function(_0x19ce0b){var _0x2c39ec=this;var _0x4e8b57=this[_0x8517('0x16')][_0x19ce0b[_0x8517('0x13a')]];if(_0x4e8b57){if(_0x4e8b57[_0x8517('0x101')]&&this[_0x8517('0x17')][_0x4e8b57[_0x8517('0x101')]]){ut[_0x8517('0x13b')](_0x4e8b57,this[_0x8517('0x17')][_0x4e8b57[_0x8517('0x101')]][_0x8517('0x28')],this['agents'][_0x4e8b57[_0x8517('0x101')]]['id']);}var _0xc0b55a=_[_0x8517('0x13c')](_0x4e8b57);_0xc0b55a[_0x8517('0xaf')]=moment()[_0x8517('0x8e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x31d6ad=_0x2c39ec['campaignsPreview'][_0x4e8b57[_0x8517('0x7b')]];if(ut[_0x8517('0x13d')](_0x19ce0b['response'])){if(_0x4e8b57[_0x8517('0xac')]){rpcDb[_0x8517('0x110')](_0x4e8b57[_0x8517('0x13e')]);}if(_0x4e8b57['activeContact']){rpcDb[_0x8517('0x8d')](_0x4e8b57[_0x8517('0x13e')]);}ami[_0x8517('0x27')](_0x8517('0x13f'),ut[_0x8517('0xa3')](_0x4e8b57,_0x8517('0x140'),this['campaignsPreview'][_0x4e8b57[_0x8517('0x7b')]]));this['callProgressDetectingAgent'](_0xc0b55a,_0x31d6ad,_0x19ce0b);}else{_0x4e8b57[_0x8517('0x133')]=moment()[_0x8517('0x8e')](_0x8517('0x141'));ut[_0x8517('0xf4')](_0xc0b55a,0x4,_0x8517('0x142'));rpcDb[_0x8517('0xf6')](_0xc0b55a,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x32cab3){var _0x47bd94=this;var _0x38e4bb=this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]];var _0x408937;if(_0x38e4bb){_0x408937=this[_0x8517('0x13')][_0x38e4bb[_0x8517('0x7b')]];logger[_0x8517('0x59')]('[syncHangup][talking]',_0x32cab3['linkedid'],_0x8517('0xbb'),_0x408937['name'],'pTalking:\x20',_0x408937['pTalking']);}if(this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]]&&_0x32cab3['linkedid']!==_0x32cab3['uniqueid']){if(_0x32cab3[_0x8517('0x143')]==='16'&&this['actions'][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}else if(this[_0x8517('0x16')][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){logger[_0x8517('0x59')](_0x8517('0x145'),_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')],_0x8517('0xbb'),_0x408937['name'],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this['callProgressDetectingCustomer'](_0x32cab3,_0x32cab3['linkedid'],_0x32cab3[_0x8517('0x143')]);}}else if(_0x38e4bb&&_['isNil'](_0x38e4bb[_0x8517('0x146')])&&_0x408937['dialQueueProject']&&_0x32cab3[_0x8517('0xea')]===_0x32cab3[_0x8517('0xb2')]&&_[_0x8517('0x6c')](_0x32cab3[_0x8517('0xf3')])&&_0x32cab3['cause']==='16'&&_0x32cab3['channelstate']==='6'&&_[_0x8517('0xf1')](_0x38e4bb['transfer'])){if(_0x38e4bb['unlockAgent']){rpcDb[_0x8517('0x110')](_0x38e4bb[_0x8517('0x13e')]);}if(_0x38e4bb['activeContact']){rpcDb[_0x8517('0x8d')](_0x38e4bb[_0x8517('0x13e')]);}_0x32cab3['reason']='22';this[_0x8517('0x147')](_0x38e4bb,_0x408937,_0x32cab3);}else if(_0x38e4bb&&_0x38e4bb[_0x8517('0x148')]){if(_0x32cab3['cause']==='16'&&this[_0x8517('0x16')][_0x32cab3['linkedid']][_0x8517('0x7a')]){logger[_0x8517('0x59')]('[syncHangup][talking][transfer]',_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')],_0x8517('0xbb'),_0x408937[_0x8517('0x28')],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}else if(this['actions'][_0x32cab3[_0x8517('0xea')]][_0x8517('0x7a')]){logger[_0x8517('0x59')](_0x8517('0x145'),_0x32cab3[_0x8517('0xea')],_0x32cab3['cause'],'\x20Queue',_0x408937['name'],_0x8517('0x6f'),_0x408937[_0x8517('0x5e')]);this[_0x8517('0x144')](_0x32cab3,_0x32cab3[_0x8517('0xea')],_0x32cab3[_0x8517('0x143')]);}}};Preview[_0x8517('0xe')][_0x8517('0x20')]=function(_0x4500ce){if(this[_0x8517('0x16')][_0x4500ce['destlinkedid']]&&_0x4500ce[_0x8517('0xf0')]!==_0x4500ce[_0x8517('0x149')]){this[_0x8517('0x144')](_0x4500ce,_0x4500ce[_0x8517('0xf0')],_0x4500ce[_0x8517('0xe6')]);}};Preview['prototype'][_0x8517('0x1e')]=function(_0xb7e380){if(this[_0x8517('0x16')][_0xb7e380['linkedid']]&&_0xb7e380[_0x8517('0xea')]!==_0xb7e380[_0x8517('0xb2')]&&!this[_0x8517('0x16')][_0xb7e380['linkedid']][_0x8517('0x7a')]){if(_0xb7e380[_0x8517('0x143')]==='1'){this[_0x8517('0x144')](_0xb7e380,_0xb7e380['linkedid'],_0xb7e380['cause']);}}};Preview[_0x8517('0xe')][_0x8517('0x14a')]=function(_0x5d5e06,_0x3a67d8,_0x176601){if(this[_0x8517('0x16')][_0x5d5e06]){if(_[_0x8517('0x6c')](this[_0x8517('0x16')][_0x5d5e06]['variables'])){this[_0x8517('0x16')][_0x5d5e06][_0x8517('0x14b')]={};}this[_0x8517('0x16')][_0x5d5e06]['variables'][_0x3a67d8]=_0x176601;}};Preview[_0x8517('0xe')]['syncVarSet']=function(_0x350c39){try{if(!_[_0x8517('0x6c')](_0x350c39)){if(ut[_0x8517('0x14c')](_[_0x8517('0x14d')](_0x350c39['variable'])[0x0])){this[_0x8517('0x14a')](_0x350c39[_0x8517('0xb2')],_[_0x8517('0x14d')](_0x350c39['variable'])[0x0],_0x350c39[_0x8517('0x14e')]);}}}catch(_0x335e4b){logger[_0x8517('0x14f')](_0x8517('0x150'),util[_0x8517('0x151')](_0x335e4b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x8517('0x25')]=function(_0x5d4692){if(_0x5d4692){if(this['actions'][_0x5d4692[_0x8517('0x152')]]){this['actions'][_0x5d4692[_0x8517('0x152')]][_0x8517('0x148')]=!![];}}};Preview[_0x8517('0xe')][_0x8517('0x26')]=function(_0x469726){if(_0x469726){if(this[_0x8517('0x16')][_0x469726[_0x8517('0x153')]]){this['actions'][_0x469726['transfererlinkedid']][_0x8517('0x148')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x5089=['noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','\x20Queue','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','pick','unlock','unlockContact','getContactPreview','recallme','Contact.phone','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','Empty\x20Contact','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','addVariables','toLowerVariables','variablesAction','[originated][increment]','actionid','logLookAgent','isFailure','idContact','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destlinkedid','destuniqueid','variables','filterKey','keys','variable','addVariable','value','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','moment','md5','ioredis','../../../config/environment','preview','actionPreview','../ami','./rpcDb','./util/util','redis','localhost','enqueue','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','campaignsPreview','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','loopCampaigns','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','originated:\x20','originated','pTalking:\x20','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','queue','dialAnswer','[clearZombieChannel]','[Dialer][checkChannel][Preview]','[action]','size','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','connect','acw','custom:agentConnectPreview','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','custom:agentnoanswer'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0x5089,0x1bb));var _0x9508=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0x5089[_0x21bfab];return _0x4db318;};'use strict';var util=require(_0x9508('0x0'));var _=require(_0x9508('0x1'));var BPromise=require('bluebird');var uuid=require(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var md5=require(_0x9508('0x4'));var Redis=require(_0x9508('0x5'));var config=require(_0x9508('0x6'));var logger=require('../../../config/logger')(_0x9508('0x7'));var loggerAction=require('../../../config/logger')(_0x9508('0x8'));var ami=require(_0x9508('0x9'));var rpcDb=require(_0x9508('0xa'));var Action=require('./action');var ut=require(_0x9508('0xb'));config[_0x9508('0xc')]=_['defaults'](config[_0x9508('0xc')],{'host':_0x9508('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9508('0xc')]));var Sequence=function(){};Sequence['prototype'][_0x9508('0xe')]=function(_0x26cc8a){this[_0x9508('0xf')]=this[_0x9508('0xf')]?this[_0x9508('0xf')][_0x9508('0x10')](_0x26cc8a):_0x26cc8a();};function Preview(_0x4bb70e){this[_0x9508('0x11')]=new Sequence();this['campaignsPreview']=_0x4bb70e[_0x9508('0x12')];this[_0x9508('0x13')]=_0x4bb70e['trunks'];this[_0x9508('0x14')]={};this[_0x9508('0x15')]=_0x4bb70e[_0x9508('0x15')];this[_0x9508('0x16')]=0x0;ami['on']('originateresponse',this[_0x9508('0x17')][_0x9508('0x18')](this));ami['on']('hangup',this[_0x9508('0x19')]['bind'](this));ami['on'](_0x9508('0x1a'),this[_0x9508('0x1b')][_0x9508('0x18')](this));ami['on'](_0x9508('0x1c'),this[_0x9508('0x1d')][_0x9508('0x18')](this));ami['on'](_0x9508('0x1e'),this[_0x9508('0x1f')]['bind'](this));ami['on'](_0x9508('0x20'),this[_0x9508('0x21')][_0x9508('0x18')](this));ami['on'](_0x9508('0x22'),this[_0x9508('0x23')][_0x9508('0x18')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x9508('0x18')](this));this['loopCampaigns'](this[_0x9508('0x24')]);}function emit(_0x4e9e9f,_0x3ba927,_0x22ff69){io['to'](_0x4e9e9f)[_0x9508('0x25')](_0x3ba927,_0x22ff69);}function emitCampaignPreview(_0x1dfc6c){if(_0x1dfc6c[_0x9508('0x26')]===_0x9508('0x27')){var _0x20eb53={'id':_0x1dfc6c['id'],'name':_0x1dfc6c['name'],'strategy':_0x1dfc6c['strategy'],'answered':_0x1dfc6c[_0x9508('0x28')],'available':_0x1dfc6c[_0x9508('0x29')],'loggedIn':_0x1dfc6c[_0x9508('0x2a')],'pTalking':_0x1dfc6c[_0x9508('0x2b')],'sumBillable':_0x1dfc6c[_0x9508('0x2c')],'sumDuration':_0x1dfc6c[_0x9508('0x2d')],'sumHoldTime':_0x1dfc6c['sumHoldTime']||0x0,'talking':_0x1dfc6c['talking'],'total':_0x1dfc6c[_0x9508('0x2e')],'type':_0x1dfc6c['type'],'unmanaged':_0x1dfc6c['unmanaged'],'abandoned':_0x1dfc6c[_0x9508('0x2f')],'waiting':_0x1dfc6c['waiting'],'loggedInDb':_0x1dfc6c['loggedInDb'],'dialActive':_0x1dfc6c[_0x9508('0x30')],'dialMethod':_0x1dfc6c[_0x9508('0x31')],'dialOriginateCallerIdName':_0x1dfc6c['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x1dfc6c[_0x9508('0x32')],'dialOriginateTimeout':_0x1dfc6c[_0x9508('0x33')],'dialPrefix':_0x1dfc6c[_0x9508('0x34')],'outboundAnswerAgiCallsDay':_0x1dfc6c[_0x9508('0x35')],'outboundAnswerCallsDay':_0x1dfc6c[_0x9508('0x36')],'outboundBlacklistCallsDay':_0x1dfc6c[_0x9508('0x37')],'outboundBusyCallsDay':_0x1dfc6c[_0x9508('0x38')],'outboundCongestionCallsDay':_0x1dfc6c[_0x9508('0x39')],'outboundDropCallsDayACS':_0x1dfc6c[_0x9508('0x3a')],'outboundDropCallsDayCallersExit':_0x1dfc6c[_0x9508('0x3b')],'outboundDropCallsDayTimeout':_0x1dfc6c[_0x9508('0x3c')],'outboundNoAnswerCallsDay':_0x1dfc6c['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x1dfc6c[_0x9508('0x3d')],'outboundOriginateFailureCallsDay':_0x1dfc6c[_0x9508('0x3e')],'outboundReCallsDay':_0x1dfc6c[_0x9508('0x3f')],'outboundRejectCallsDay':_0x1dfc6c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1dfc6c[_0x9508('0x40')],'outboundAbandonedCallsDay':_0x1dfc6c[_0x9508('0x41')],'predictiveIntervalAnsweredCalls':_0x1dfc6c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1dfc6c[_0x9508('0x42')],'predictiveIntervalAvgTalktime':_0x1dfc6c[_0x9508('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x1dfc6c['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1dfc6c[_0x9508('0x44')],'predictiveIntervalErlangCalls':_0x1dfc6c[_0x9508('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x1dfc6c[_0x9508('0x46')],'predictiveIntervalHitRate':_0x1dfc6c[_0x9508('0x47')],'predictiveIntervalMultiplicativeFactor':_0x1dfc6c['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x1dfc6c['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1dfc6c[_0x9508('0x48')],'predictiveIntervalTotalCalls':_0x1dfc6c[_0x9508('0x49')],'message':_0x1dfc6c[_0x9508('0x4a')],'originated':_0x1dfc6c['originated'],'erlangCalls':_0x1dfc6c['erlangCalls'],'erlangCallToSecond':_0x1dfc6c[_0x9508('0x4b')],'erlangAbandonmentRate':_0x1dfc6c[_0x9508('0x4c')],'erlangBusyFactor':_0x1dfc6c[_0x9508('0x4d')],'startPredictive':_0x1dfc6c[_0x9508('0x4e')],'startProgressive':_0x1dfc6c[_0x9508('0x4f')]};if(_0x1dfc6c[_0x9508('0x50')]){_0x20eb53[_0x9508('0x50')]={'id':_0x1dfc6c[_0x9508('0x50')]['id'],'name':_0x1dfc6c[_0x9508('0x50')][_0x9508('0x51')],'active':_0x1dfc6c['Trunk'][_0x9508('0x52')],'callerid':_0x1dfc6c[_0x9508('0x50')]['callerid']};}if(_0x1dfc6c[_0x9508('0x53')]){_0x20eb53[_0x9508('0x53')]={'id':_0x1dfc6c[_0x9508('0x53')]['id'],'name':_0x1dfc6c[_0x9508('0x53')][_0x9508('0x51')]};}var _0x31ab9c=md5(JSON[_0x9508('0x54')](_0x20eb53));if(_0x1dfc6c[_0x9508('0x4')]!==_0x31ab9c){_0x1dfc6c[_0x9508('0x4')]=_0x31ab9c;emit(util[_0x9508('0x55')](_0x9508('0x56'),_0x20eb53['name']),_0x9508('0x57'),_0x20eb53);}}}function emitVoiceQueueChannelRemove(_0x5b690e){logger[_0x9508('0x58')](_0x9508('0x59'),JSON[_0x9508('0x54')](_0x5b690e));emit(util['format']('voice:queue:%s',_0x5b690e[_0x9508('0x51')]),_0x9508('0x5a'),_0x5b690e);io[_0x9508('0x25')](_0x9508('0x5b'),_0x5b690e);}function notSendMessagesQueue(_0x4eb600){if(_0x4eb600[_0x9508('0x5c')]){if(_0x4eb600['originated']===0x0&&_0x4eb600[_0x9508('0x2b')]===0x0){_0x4eb600[_0x9508('0x5c')]=![];_0x4eb600['available']=0x0;_0x4eb600[_0x9508('0x5d')]=0x0;_0x4eb600[_0x9508('0x4a')]='NOT_ACTIVE';ut[_0x9508('0x5e')](_0x9508('0x5f'),_0x4eb600[_0x9508('0x51')]+_0x9508('0x60'));}else{_0x4eb600['message']='IS_DISACTIVED';ut[_0x9508('0x5e')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4eb600[_0x9508('0x51')]+_0x9508('0x61'));}emitCampaignPreview(_0x4eb600);}}Preview[_0x9508('0x62')][_0x9508('0x63')]=function(){var _0x4a4556=this;setInterval(function(){_0x4a4556['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x9508('0x64')]=function(){var _0x5e7fe3=this[_0x9508('0x24')];this['clockClearZombieChannels']+=0x1;for(var _0x1429a1 in _0x5e7fe3){if(_0x5e7fe3[_0x9508('0x65')](_0x1429a1)&&(_0x5e7fe3[_0x1429a1][_0x9508('0x31')]===_0x9508('0x7')||_0x5e7fe3[_0x1429a1]['dialMethod']===_0x9508('0x66'))&&_0x5e7fe3[_0x1429a1][_0x9508('0x26')]===_0x9508('0x27')){if(this['clockClearZombieChannels']>0x7){this[_0x9508('0x16')]=0x0;this[_0x9508('0x67')]();}}if(_0x5e7fe3['hasOwnProperty'](_0x1429a1)&&_0x5e7fe3[_0x1429a1][_0x9508('0x31')]==='preview'&&_0x5e7fe3[_0x1429a1][_0x9508('0x26')]==='outbound'){if(_0x5e7fe3[_0x1429a1]['dialActive']){this[_0x9508('0x68')](_0x5e7fe3[_0x1429a1]);if(_0x5e7fe3[_0x1429a1][_0x9508('0x69')])this[_0x9508('0x6a')](_0x5e7fe3[_0x1429a1]);}else{notSendMessagesQueue(_0x5e7fe3[_0x1429a1]);}}}};Preview[_0x9508('0x62')][_0x9508('0x6b')]=function(_0x169daf){var _0x5bdd1f=this;this[_0x9508('0x11')][_0x9508('0xe')](function(){if(!_[_0x9508('0x6c')](_0x5bdd1f['actions'][_0x169daf])){loggerAction[_0x9508('0x58')](_0x9508('0x6d'),_0x169daf,_0x9508('0x6e'),_0x5bdd1f[_0x9508('0x14')][_0x169daf]['queue'],_0x9508('0x6f'),JSON['stringify'](_0x5bdd1f[_0x9508('0x24')][_0x5bdd1f[_0x9508('0x14')][_0x169daf]['queue']][_0x9508('0x70')]),_0x9508('0x71'),JSON['stringify'](_0x5bdd1f[_0x9508('0x24')][_0x5bdd1f[_0x9508('0x14')][_0x169daf]['queue']][_0x9508('0x2b')]),JSON['stringify'](_0x5bdd1f[_0x9508('0x14')][_0x169daf]['dialAnswer']),JSON[_0x9508('0x54')](_['pick'](_0x5bdd1f['actions'][_0x169daf],['contactId','UserId',_0x9508('0x72'),_0x9508('0x73')])));return ami[_0x9508('0x74')]({'action':_0x9508('0x75'),'channel':_0x5bdd1f[_0x9508('0x14')][_0x169daf][_0x9508('0x76')]})[_0x9508('0x77')](function(_0x1e58c2){if(_0x1e58c2[_0x9508('0x4a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x5bdd1f[_0x9508('0x14')][_0x169daf]){ut[_0x9508('0x78')](_0x5bdd1f[_0x9508('0x24')][_0x5bdd1f[_0x9508('0x14')][_0x169daf][_0x9508('0x79')]],'[clearZombieChannel]');if(_0x5bdd1f['actions'][_0x169daf][_0x9508('0x7a')]===!![]){ut['decrementTalkink'](_0x5bdd1f[_0x9508('0x24')][_0x5bdd1f[_0x9508('0x14')][_0x169daf]['queue']],_0x9508('0x7b'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x169daf,_0x5bdd1f[_0x9508('0x14')][_0x169daf][_0x9508('0x79')]);}ut['loggerError'](_0x9508('0x7c')+_0x169daf,_0x5bdd1f[_0x9508('0x14')][_0x169daf][_0x9508('0x79')]);delete _0x5bdd1f[_0x9508('0x14')][_0x169daf];}},0x2328);}});}});};Preview[_0x9508('0x62')][_0x9508('0x67')]=function(){var _0xf438ab=this;loggerAction[_0x9508('0x58')](_0x9508('0x7d'),_[_0x9508('0x7e')](this[_0x9508('0x14')]));for(var _0x2dc921 in this[_0x9508('0x14')]){if(_0xf438ab[_0x9508('0x14')]['hasOwnProperty'](_0x2dc921)){_0xf438ab[_0x9508('0x6b')](_0x2dc921);}}};Preview[_0x9508('0x62')]['recallMe']=function(_0x2573d1){var _0x5e7384=this;rpcDb['getContactRecallMe'](_0x2573d1['id'],ut[_0x9508('0x7f')](this[_0x9508('0x15')]))['then'](function(_0x199c2e){if(!_[_0x9508('0x6c')](_0x199c2e)){for(var _0x553e6b=0x0;_0x553e6b<_0x199c2e[_0x9508('0x80')];_0x553e6b+=0x1){if(ut[_0x9508('0x81')](_0x199c2e[_0x553e6b][_0x9508('0x82')])<_0x2573d1['dialRecallMeTimeout']*0x3c){if(_0x199c2e[_0x553e6b][_0x9508('0x83')]&&!_0x199c2e[_0x553e6b][_0x9508('0x83')][_0x9508('0x84')]){_0x5e7384[_0x9508('0x85')](_0x199c2e[_0x553e6b]['id'])[_0x9508('0x86')](ut[_0x9508('0x87')]('[RecallMe]'))[_0x9508('0x77')](ut[_0x9508('0x87')](_0x9508('0x88')));}else{rpcDb[_0x9508('0x89')](_0x199c2e[_0x553e6b]['id']);}}else{var _0x5bab99=new Action(_0x199c2e[_0x553e6b],_0x2573d1);_0x5bab99[_0x9508('0x8a')]=moment()['format'](_0x9508('0x8b'));_0x2573d1[_0x9508('0x3f')]+=0x1;ut['logCustomer'](_0x5bab99,0x17,_0x9508('0x8c'));if(_0x2573d1[_0x9508('0x8d')]){rpcDb['rescheduleContactInQueue'](ut[_0x9508('0x8e')](_0x199c2e[_0x553e6b]));rpcDb[_0x9508('0x8f')](_0x5bab99,_0x9508('0x90'));}else{ut[_0x9508('0x91')](_0x5bab99,0x16,'RecallFailedTimeout');rpcDb[_0x9508('0x8f')](_0x5bab99,_0x9508('0x92'));rpcDb[_0x9508('0x93')](_0x5bab99,_0x9508('0x92'));}}}}})[_0x9508('0x77')](ut[_0x9508('0x87')](_0x9508('0x94')));};Preview[_0x9508('0x62')]['setMessage']=function(_0x1476e1){_0x1476e1[_0x9508('0x5c')]=!![];if(ut[_0x9508('0x95')](_0x1476e1['loggedIn'])){_0x1476e1[_0x9508('0x4a')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x9508('0x96')](_0x1476e1['dialActive'])){_0x1476e1['message']='NOT_ACTIVE';}else if(!this[_0x9508('0x97')](_0x1476e1[_0x9508('0x50')])){if(!this[_0x9508('0x97')](_0x1476e1['TrunkBackup'])){_0x1476e1[_0x9508('0x4a')]=_0x9508('0x98');}else{_0x1476e1[_0x9508('0x4a')]=_0x9508('0x99');}}else{_0x1476e1[_0x9508('0x4a')]='ACTIVE';}emitCampaignPreview(_0x1476e1);};Preview['prototype'][_0x9508('0x9a')]=function(_0x374fe0,_0x1d3e4d,_0x202467){var _0x306709=this;var _0x3ec6b7=this[_0x9508('0x14')][_0x1d3e4d];var _0x2d87e8=this[_0x9508('0x24')][_0x3ec6b7[_0x9508('0x79')]];var _0x299b4f;if(_0x2d87e8){switch(_0x202467){case'1':_0x2d87e8[_0x9508('0x3d')]+=0x1;_0x3ec6b7['countnosuchnumberretry']+=0x1;_0x3ec6b7['countglobal']=ut[_0x9508('0x9b')](_0x3ec6b7);ut['logCustomer'](_0x3ec6b7,0x0,_0x9508('0x9c'));ami['emit']('custom:agentnosuchnumber',ut[_0x9508('0x9d')](_0x3ec6b7,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x3ec6b7,_0x9508('0x9e'));if(ut[_0x9508('0x9b')](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xa2'));}else{if(_0x3ec6b7[_0x9508('0xa3')]>=_0x2d87e8[_0x9508('0xa4')]){rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xa2'));}else{rpcDb[_0x9508('0xa5')](ut[_0x9508('0xa6')](_0x3ec6b7,_0x9508('0xa3'),_0x2d87e8[_0x9508('0xa7')]),_0x3ec6b7['unlockAgent'],_0x3ec6b7[_0x9508('0xa8')]);}}delete this['actions'][_0x374fe0[_0x9508('0xa9')]];break;case _0x9508('0xaa'):var _0x42ab8e=moment()[_0x9508('0x55')](_0x9508('0x8b'));_0x3ec6b7[_0x9508('0xab')]=_0x42ab8e;_0x3ec6b7[_0x9508('0xac')]=_0x42ab8e;_0x3ec6b7[_0x9508('0x7a')]=!![];_0x2d87e8[_0x9508('0x2b')]+=0x1;logger[_0x9508('0x58')](_0x9508('0xad'),_0x3ec6b7[_0x9508('0xae')],'\x20Queue',_0x2d87e8[_0x9508('0x51')],_0x9508('0x71'),_0x2d87e8[_0x9508('0x2b')]);ami['emit']('custom:agentconnect',ut[_0x9508('0x9d')](_0x3ec6b7,_0x9508('0xaf'),this[_0x9508('0x24')][_0x3ec6b7[_0x9508('0x79')]]));if(_0x2d87e8[_0x9508('0xb0')]){ami[_0x9508('0x25')](_0x9508('0xb1'),ut['buildAcw'](_0x3ec6b7));}break;case'16':ami[_0x9508('0x25')]('custom:agentcomplete',ut['buildObj'](_0x3ec6b7,_0x9508('0xb2'),this['campaignsPreview'][_0x3ec6b7[_0x9508('0x79')]]));emitVoiceQueueChannelRemove(ut[_0x9508('0x9d')](_0x3ec6b7,'complete'));_0x2d87e8[_0x9508('0x36')]+=0x1;_0x2d87e8['total']+=0x1;_0x2d87e8[_0x9508('0x28')]+=0x1;ut['decrementTalkink'](_0x2d87e8,_0x9508('0xb3'));_0x3ec6b7[_0x9508('0xb4')]=ut[_0x9508('0x9b')](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x4,_0x9508('0xb5'));rpcDb[_0x9508('0x8f')](_0x3ec6b7,_0x9508('0xb6'));rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xb7'));rpcDb[_0x9508('0xb8')](_0x3ec6b7);_0x2d87e8['sumDuration']+=_0x3ec6b7[_0x9508('0xb9')];_0x2d87e8[_0x9508('0x2c')]+=_0x3ec6b7[_0x9508('0xb9')];logger[_0x9508('0x58')](_0x9508('0xba'),_0x3ec6b7[_0x9508('0xae')],'\x20Queue',_0x2d87e8['name'],_0x9508('0x71'),_0x2d87e8[_0x9508('0x2b')]);delete this[_0x9508('0x14')][_0x374fe0['linkedid']];break;case'BUSY':_0x2d87e8[_0x9508('0x38')]+=0x1;_0x3ec6b7['countbusyretry']+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut[_0x9508('0x9b')](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x5,'Busy');ami[_0x9508('0x25')](_0x9508('0xbb'),ut[_0x9508('0x9d')](_0x3ec6b7,_0x9508('0xbc')));rpcDb[_0x9508('0x8f')](_0x3ec6b7,_0x9508('0xbd'));if(ut['totalGlobal'](_0x3ec6b7)>=_0x2d87e8['dialGlobalMaxRetry']){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb['createCustomerFinal'](_0x299b4f,_0x9508('0xbe'));}else{if(_0x3ec6b7[_0x9508('0xbf')]>=_0x2d87e8[_0x9508('0xc0')]){rpcDb['createCustomerFinal'](_0x3ec6b7,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x9508('0xa5')](ut['scheduledAt'](_0x3ec6b7,_0x9508('0xbf'),_0x2d87e8[_0x9508('0xc1')]),_0x3ec6b7[_0x9508('0xc2')],_0x3ec6b7[_0x9508('0xa8')]);}}break;case'NOANSWER':_0x2d87e8[_0x9508('0xc3')]+=0x1;_0x3ec6b7[_0x9508('0xc4')]+=0x1;_0x3ec6b7['countglobal']=ut[_0x9508('0x9b')](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x3,_0x9508('0xc5'));ami['emit'](_0x9508('0xc6'),ut['buildObj'](_0x3ec6b7,_0x9508('0xc7')));rpcDb[_0x9508('0x8f')](_0x3ec6b7,_0x9508('0xc8'));if(ut[_0x9508('0x9b')](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xc9'));}else{if(_0x3ec6b7[_0x9508('0xc4')]>=_0x2d87e8[_0x9508('0xca')]){rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xc8'));}else{rpcDb[_0x9508('0xa5')](ut[_0x9508('0xa6')](_0x3ec6b7,_0x9508('0xc4'),_0x2d87e8['dialNoAnswerRetryFrequency']),_0x3ec6b7[_0x9508('0xc2')],_0x3ec6b7['activeContact']);}}break;case'CONGESTION':_0x2d87e8[_0x9508('0x39')]+=0x1;_0x3ec6b7[_0x9508('0xcb')]+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut['totalGlobal'](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x8,_0x9508('0xcc'));ami[_0x9508('0x25')](_0x9508('0xcd'),ut[_0x9508('0x9d')](_0x3ec6b7,_0x9508('0xce')));rpcDb[_0x9508('0x8f')](_0x3ec6b7,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x9508('0x9b')](_0x3ec6b7)>=_0x2d87e8['dialGlobalMaxRetry']){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xcf'));}else{if(_0x3ec6b7[_0x9508('0xcb')]>=_0x2d87e8[_0x9508('0xd0')]){rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xd1'));}else{rpcDb[_0x9508('0xa5')](ut['scheduledAt'](_0x3ec6b7,_0x9508('0xcb'),_0x2d87e8['dialBusyRetryFrequency']),_0x3ec6b7['unlockAgent'],_0x3ec6b7[_0x9508('0xa8')]);}}break;case _0x9508('0xd2'):_0x2d87e8[_0x9508('0xd3')]+=0x1;_0x3ec6b7[_0x9508('0xd4')]+=0x1;_0x3ec6b7['countglobal']=ut['totalGlobal'](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x14,_0x9508('0xd5'));ami[_0x9508('0x25')]('custom:agentreject',ut[_0x9508('0x9d')](_0x3ec6b7,'agentreject'));rpcDb['createCustomerHistory'](_0x3ec6b7,_0x9508('0xd6'));if(ut['totalGlobal'](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0x14,_0x9508('0xd5'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xd7'));}else{if(_0x3ec6b7[_0x9508('0xd4')]>=_0x2d87e8['dialAgentRejectMaxRetry']){rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xd7'));}else{rpcDb['rescheduleContact'](ut[_0x9508('0xa6')](_0x3ec6b7,'countagentrejectretry',_0x2d87e8['dialAgentRejectRetryFrequency']),_0x3ec6b7[_0x9508('0xc2')],_0x3ec6b7[_0x9508('0xa8')]);}}break;case _0x9508('0xd8'):_0x2d87e8[_0x9508('0x41')]+=0x1;_0x3ec6b7['countabandonedretry']+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut[_0x9508('0x9b')](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0xb,_0x9508('0xd9'));rpcDb['createCustomerHistory'](_0x3ec6b7,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xda'));}else{if(_0x3ec6b7[_0x9508('0xdb')]>=_0x2d87e8[_0x9508('0xdc')]){rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xda'));}else{rpcDb[_0x9508('0xa5')](ut[_0x9508('0xa6')](_0x3ec6b7,_0x9508('0xdd'),_0x2d87e8[_0x9508('0xde')]),_0x3ec6b7[_0x9508('0xc2')],_0x3ec6b7['activeContact']);}}break;case'18':_0x2d87e8[_0x9508('0x40')]+=0x1;_0x3ec6b7['countmachineretry']+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut['totalGlobal'](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x12,_0x374fe0[_0x9508('0xdf')]||_0x374fe0[_0x9508('0xe0')]);ami[_0x9508('0x25')](_0x9508('0xe1'),ut[_0x9508('0x9d')](_0x3ec6b7,_0x9508('0xe2')));rpcDb[_0x9508('0x8f')](_0x3ec6b7,_0x9508('0xe3'));if(ut[_0x9508('0x9b')](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut['cloneAction'](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x9508('0x93')](_0x3ec6b7,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x9508('0x14')][_0x374fe0[_0x9508('0xa9')]];break;case'19':_0x2d87e8[_0x9508('0x40')]+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut[_0x9508('0x9b')](_0x3ec6b7);ut[_0x9508('0x91')](_0x3ec6b7,0x13,_0x374fe0['cause-txt']||_0x374fe0[_0x9508('0xe0')]);ami['emit'](_0x9508('0xe1'),ut['buildObj'](_0x3ec6b7,_0x9508('0xe2')));rpcDb[_0x9508('0x8f')](_0x3ec6b7,_0x9508('0xe4'));if(ut[_0x9508('0x9b')](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,_0x9508('0xa1'));rpcDb[_0x9508('0x93')](_0x299b4f,_0x9508('0xe4'));}else{rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xe4'));}delete this[_0x9508('0x14')][_0x374fe0[_0x9508('0xa9')]];break;default:if(_0x3ec6b7['dialAnswer']){ut['decrementTalkink'](_0x2d87e8,_0x9508('0xe5'));ut['loggerError']('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x2d87e8['name'],_0x374fe0);}_0x2d87e8[_0x9508('0x40')]+=0x1;_0x3ec6b7[_0x9508('0xb4')]=ut['totalGlobal'](_0x3ec6b7);ut['logCustomer'](_0x3ec6b7,0xc,_0x374fe0[_0x9508('0xdf')]||_0x374fe0[_0x9508('0xe0')]);rpcDb['createCustomerHistory'](_0x3ec6b7,_0x9508('0xe6'));if(ut['totalGlobal'](_0x3ec6b7)>=_0x2d87e8[_0x9508('0x9f')]){_0x299b4f=ut[_0x9508('0xa0')](_0x3ec6b7,0xf,'Global');rpcDb[_0x9508('0x93')](_0x299b4f,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9508('0x93')](_0x3ec6b7,_0x9508('0xe7'));}delete this[_0x9508('0x14')][_0x374fe0[_0x9508('0xa9')]];}if(!(_0x3ec6b7['dialAnswer']&&_0x202467==='16')){ut[_0x9508('0x78')](_0x2d87e8,'[callProgressDetectingCustomer]');logger[_0x9508('0x58')](_0x9508('0xe8'),_0x3ec6b7[_0x9508('0xae')],_0x9508('0xe9'),_0x2d87e8[_0x9508('0x51')],_0x9508('0x6f'),_0x2d87e8[_0x9508('0x70')]);}if(_0x202467!==_0x9508('0xaa')){delete this[_0x9508('0x14')][_0x374fe0[_0x9508('0xa9')]];delete this['actions'][_0x374fe0['destlinkedid']];}}};Preview[_0x9508('0x62')][_0x9508('0xea')]=function(_0x2310b0,_0x4ce085,_0x3cb70d){if(_[_0x9508('0xeb')](_0x4ce085)&&'object'!==typeof _0x4ce085){return;}if(_[_0x9508('0xeb')](_0x3cb70d)&&_0x9508('0xec')!==typeof _0x3cb70d){return;}switch(_0x3cb70d[_0x9508('0xed')]){case'0':ut[_0x9508('0xee')](_0x2310b0,0x0,'NoSuchNumber');rpcDb[_0x9508('0xef')](_0x2310b0,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x2310b0,0x3,'NoAnswer');rpcDb[_0x9508('0xef')](_0x2310b0,_0x9508('0xf0'));break;case'5':ut[_0x9508('0xee')](_0x2310b0,0x5,_0x9508('0xf1'));rpcDb[_0x9508('0xef')](_0x2310b0,_0x9508('0xf2'));break;case'8':ut['logAgent'](_0x2310b0,0x8,_0x9508('0xcc'));rpcDb[_0x9508('0xef')](_0x2310b0,_0x9508('0xf3'));break;case'22':ut[_0x9508('0xee')](_0x2310b0,0x16,_0x9508('0xf4'));rpcDb[_0x9508('0xef')](_0x2310b0,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x9508('0xee')](_0x2310b0,0xc,_0x3cb70d['reason']);rpcDb[_0x9508('0xef')](_0x2310b0,_0x9508('0xf3'));}ut[_0x9508('0x78')](_0x4ce085,'[callProgressDetectingAgent]');logger[_0x9508('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x2310b0['uniqueid'],_0x9508('0xe9'),_0x4ce085[_0x9508('0x51')],'originated:\x20',_0x4ce085[_0x9508('0x70')]);delete this[_0x9508('0x14')][_0x2310b0[_0x9508('0xae')]];};Preview[_0x9508('0x62')][_0x9508('0xf5')]=function(_0xb0a585,_0x45fe21,_0x119c3a,_0x11bb6c,_0x9376a5){var _0x29c0f1=this;return new BPromise(function(_0x454d43,_0x202f5f){if(_[_0x9508('0x6c')](_0x45fe21)||_['isNil'](_0x45fe21[_0x9508('0xf6')])||_[_0x9508('0x6c')](_0x45fe21[_0x9508('0xf6')][_0x9508('0xf7')])||_['isNil'](_0x45fe21[_0x9508('0x72')])){_0x202f5f(ut[_0x9508('0x4a')](_0x9508('0xf8'),_0x11bb6c,_0x9376a5));return;}var _0x3a8ae7=uuid['v4']();var _0x171225=_0x29c0f1[_0x9508('0x24')][_0x45fe21['Queue'][_0x9508('0x51')]];var _0x131bea=_0x119c3a?_0x29c0f1[_0x9508('0x15')][_0x119c3a]['id']:undefined;_0x29c0f1[_0x9508('0x14')][_0x3a8ae7]=new Action(_0x45fe21,_0x171225,_0x3a8ae7,_0x119c3a,_0x131bea);var _0x1e7a63=_0x29c0f1['actions'][_0x3a8ae7];_0x1e7a63['unlockAgent']=_0x11bb6c;_0x1e7a63[_0x9508('0xa8')]=_0x9376a5;_0x1e7a63[_0x9508('0xf9')]=_0x119c3a;if(_[_0x9508('0xfa')](_0xb0a585)){_0x29c0f1[_0x9508('0xfb')](_0x1e7a63,_0x171225,_0x45fe21,_0x119c3a)[_0x9508('0x86')](function(_0x4e74cd){logger[_0x9508('0x58')]('[Preview][execCall][success]',_0x9508('0xfc')+_0x1e7a63['queue']+_0x9508('0xfd')+_0x1e7a63['idContact'],JSON[_0x9508('0x54')](_0x4e74cd));ami[_0x9508('0x25')](_0x9508('0xfe'),ut[_0x9508('0x9d')](_0x1e7a63,_0x9508('0xff'),_0x29c0f1[_0x9508('0x24')][_0x1e7a63[_0x9508('0x79')]]));_0x454d43(ut['message'](_0x9508('0x100')));})[_0x9508('0x77')](function(_0x575aaf){ut[_0x9508('0x5e')](_0x9508('0x101'),_0x575aaf);_0x202f5f(ut[_0x9508('0x4a')]('Call\x20failed',_0x11bb6c,_0x9376a5));});}else{_0x171225['outboundBlacklistCallsDay']+=0x1;ut[_0x9508('0x102')](_0x1e7a63);rpcDb[_0x9508('0x103')](_0x1e7a63,_0x9508('0x104'));delete _0x29c0f1['actions'][_0x3a8ae7];_0x202f5f(ut['message'](_0x9508('0x105'),_0x11bb6c,_0x9376a5));}});};Preview[_0x9508('0x62')][_0x9508('0x97')]=function(_0x3ef7e3){return!_[_0x9508('0x6c')](_0x3ef7e3)&&!_[_0x9508('0x6c')](_0x3ef7e3[_0x9508('0x51')])&&!_[_0x9508('0x6c')](_0x3ef7e3[_0x9508('0x52')])&&_0x3ef7e3[_0x9508('0x52')]&&!_[_0x9508('0x6c')](this[_0x9508('0x13')][util[_0x9508('0x55')]('SIP/%s',_0x3ef7e3[_0x9508('0x51')])])&&!_[_0x9508('0x6c')](this['trunks'][util[_0x9508('0x55')](_0x9508('0x106'),_0x3ef7e3[_0x9508('0x51')])][_0x9508('0x75')])&&(this['trunks'][util[_0x9508('0x55')](_0x9508('0x106'),_0x3ef7e3['name'])][_0x9508('0x75')]==='reachable'||this[_0x9508('0x13')][util['format'](_0x9508('0x106'),_0x3ef7e3[_0x9508('0x51')])][_0x9508('0x75')]===_0x9508('0x107'));};Preview[_0x9508('0x62')][_0x9508('0x85')]=function(_0x1c17a7,_0x43ea8c){var _0x31b11e=this;return new BPromise(function(_0x2cb8a8,_0x3dc94a){_0x31b11e[_0x9508('0x108')](_0x1c17a7,_0x43ea8c)['then'](function(_0x2eb679){_0x2cb8a8(_[_0x9508('0x109')](_0x2eb679,[_0x9508('0x4a')]));})['catch'](function(_0x4941b4){if(_0x4941b4[_0x9508('0x10a')]){rpcDb[_0x9508('0x10b')](_0x1c17a7);}if(_0x4941b4[_0x9508('0x52')]){rpcDb[_0x9508('0x89')](_0x1c17a7);}_0x3dc94a(_['pick'](_0x4941b4,[_0x9508('0x4a')]));});});};Preview[_0x9508('0x62')][_0x9508('0x108')]=function(_0x5bd667,_0x5a976c){var _0x1941c3=this;return new BPromise(function(_0x120d28,_0x583370){var _0x35959d,_0x443113;rpcDb[_0x9508('0x10c')](_0x5bd667)['then'](function(_0xb39882){if(!_[_0x9508('0x6c')](_0xb39882[0x0])){_0x443113=_0xb39882[0x0][_0x9508('0x10d')]?![]:!![];_0x35959d=_0xb39882[0x0][_0x9508('0x10d')]?!![]:![];_0x35959d=_0x5a976c?!![]:_0x35959d;}var _0x4f4658=_0x1941c3['validateContact'](_0xb39882);if(_0x4f4658['isValid']){rpcDb['checkIsBlackList'](_[_0x9508('0x109')](_0xb39882[0x0],['VoiceQueueId',_0x9508('0x10e')]))[_0x9508('0x86')](function(_0x117566){_0x1941c3[_0x9508('0xf5')](_0x117566,_0xb39882[0x0],_0x5a976c,_0x443113,_0x35959d)[_0x9508('0x86')](function(_0x2b9482){_0x120d28(_0x2b9482);})['catch'](function(_0x1dc938){_0x583370(_0x1dc938);});})['catch'](function(_0x361fd9){ut[_0x9508('0x5e')](_0x9508('0x10f'),_0x361fd9);_0x583370(ut['message']('Call\x20unsuccessful',_0x443113,_0x35959d));});}else{_0x583370(ut[_0x9508('0x4a')](_0x4f4658[_0x9508('0x4a')],_0x443113,_0x35959d));}})['catch'](function(_0x4c6bc2){ut[_0x9508('0x5e')](_0x9508('0x110'),_0x4c6bc2);_0x583370(ut[_0x9508('0x4a')](_0x9508('0x111'),![],!![]));});});};Preview[_0x9508('0x62')]['validateContact']=function(_0x1fb57c){if(_[_0x9508('0x6c')](_0x1fb57c)||_[_0x9508('0xfa')](_0x1fb57c)||!_[_0x9508('0x6c')](_0x1fb57c[0x0]['Agent'])&&_[_0x9508('0x6c')](_0x1fb57c[0x0]['Agent'][_0x9508('0x51')])){ut[_0x9508('0x5e')]('[Preview][validateContact][Empty\x20Contact]',_0x1fb57c);return{'isValid':![],'message':_0x9508('0x112')};}var _0x1e0ff1=this[_0x9508('0x24')][_0x1fb57c[0x0][_0x9508('0x6e')][_0x9508('0x51')]];_0x1e0ff1[_0x9508('0x4a')]=_0x9508('0x99');if(_[_0x9508('0x6c')](_0x1e0ff1)){ut[_0x9508('0x5e')]('[Preview][validateContact][Empty\x20Campaign]',_0x1e0ff1);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x9508('0x97')](_0x1e0ff1[_0x9508('0x50')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x1e0ff1[_0x9508('0x51')]+_0x9508('0x113'));if(!this[_0x9508('0x97')](_0x1e0ff1[_0x9508('0x114')])){ut[_0x9508('0x5e')](_0x9508('0x115'),_0x1e0ff1['name']+_0x9508('0x116'));return{'isValid':![],'message':_0x9508('0x117')};}}if(!ut['isActive'](_0x1e0ff1[_0x9508('0x30')])){ut['logger'](_0x9508('0x118'),_0x1e0ff1['name']+_0x9508('0x119'));return{'isValid':![],'message':_0x9508('0x11a')+_0x1e0ff1[_0x9508('0x51')]+_0x9508('0x119')};}return{'isValid':!![],'message':_0x9508('0x11b')};};Preview[_0x9508('0x62')][_0x9508('0xfb')]=function(_0x4b4abd,_0x8bbf47,_0x23bfe7,_0x46e577){var _0x1aa037=this;return new BPromise(function(_0xd6ca5d,_0x8873a0){var _0x3d4d7b=_0x4b4abd[_0x9508('0xae')];var _0x48def6=_0x1aa037[_0x9508('0x97')](_0x8bbf47['Trunk'])?util['format'](_0x9508('0x11c'),_0x8bbf47[_0x9508('0x50')][_0x9508('0x51')],_[_0x9508('0x6c')](_0x8bbf47['dialPrefix'])?'':_0x8bbf47[_0x9508('0x34')][_0x9508('0x11d')]()||'',_0x8bbf47[_0x9508('0x11e')]>0x0?_0x23bfe7[_0x9508('0xf6')][_0x9508('0xf7')][_0x9508('0x11f')](_0x8bbf47[_0x9508('0x11e')]):_0x23bfe7['Contact']['phone']):util[_0x9508('0x55')]('SIP/%s/%s%s',_[_0x9508('0x6c')](_0x8bbf47[_0x9508('0x114')])?_0x8bbf47[_0x9508('0x50')][_0x9508('0x51')]:_0x8bbf47[_0x9508('0x114')][_0x9508('0x51')],_['isNil'](_0x8bbf47[_0x9508('0x34')])?'':_0x8bbf47[_0x9508('0x34')][_0x9508('0x11d')]()||'',_0x8bbf47[_0x9508('0x11e')]>0x0?_0x23bfe7[_0x9508('0xf6')][_0x9508('0xf7')][_0x9508('0x11f')](_0x8bbf47['dialCutDigit']):_0x23bfe7[_0x9508('0xf6')][_0x9508('0xf7')]);var _0x4cc31b=_0x1aa037[_0x9508('0x97')](_0x8bbf47['Trunk'])?ut[_0x9508('0x120')](_0x8bbf47['Trunk'][_0x9508('0x121')],_0x8bbf47[_0x9508('0x122')],_0x8bbf47[_0x9508('0x123')]>0x0?ut[_0x9508('0x124')](_0x8bbf47[_0x9508('0x32')],_0x8bbf47[_0x9508('0x123')]):_0x8bbf47[_0x9508('0x32')]):ut[_0x9508('0x120')](_[_0x9508('0x6c')](_0x8bbf47[_0x9508('0x114')])?_0x8bbf47[_0x9508('0x50')][_0x9508('0x121')]:_0x8bbf47[_0x9508('0x114')]['callerid'],_0x8bbf47['dialOriginateCallerIdName'],_0x8bbf47['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x9508('0x124')](_0x8bbf47[_0x9508('0x32')],_0x8bbf47['dialRandomLastDigitCallerIdNumber']):_0x8bbf47[_0x9508('0x32')]);if(_0x4cc31b){_0x4b4abd['originatecalleridname']=ut['extractCalleridName'](_0x4cc31b);_0x4b4abd['originatecalleridnum']=ut['extractCalleridNumber'](_0x4cc31b);}var _0x4ae5c2=ut[_0x9508('0x125')](_0x8bbf47,_0x23bfe7,_0x48def6,_0x4cc31b,_0x3d4d7b,_0x4b4abd);_['merge'](_0x4b4abd,ut[_0x9508('0x126')](_0x4ae5c2));_0x4b4abd[_0x9508('0x8a')]=moment()[_0x9508('0x55')]('YYYY-MM-DD\x20HH:mm:ss');ami['Action'](ut[_0x9508('0x127')](_0x4b4abd,_0x8bbf47,_0x4ae5c2,_0x4b4abd['activeContact'],_0x46e577))[_0x9508('0x86')](function(_0x4d4b49){_0x8bbf47[_0x9508('0x70')]+=0x1;logger[_0x9508('0x58')](_0x9508('0x128'),_0x3d4d7b,_0x9508('0xe9'),_0x8bbf47[_0x9508('0x51')],_0x9508('0x6f'),_0x8bbf47[_0x9508('0x70')]);_0xd6ca5d(_0x4d4b49);})[_0x9508('0x77')](function(_0x51052e){ut['logAgent'](_0x4b4abd,0xe,'OriginateError');rpcDb[_0x9508('0xef')](_0x4b4abd,'[originateFailure][logOriginateFailure]');_0x8873a0(_0x51052e);});});};Preview[_0x9508('0x62')][_0x9508('0x1f')]=function(_0x41b44){if(this[_0x9508('0x14')][_0x41b44[_0x9508('0xa9')]]){this[_0x9508('0x14')][_0x41b44[_0x9508('0xa9')]][_0x9508('0x76')]=_0x41b44[_0x9508('0x76')];}};Preview[_0x9508('0x62')][_0x9508('0x17')]=function(_0xbe8dda){var _0x357d58=this;var _0x8729b6=this[_0x9508('0x14')][_0xbe8dda[_0x9508('0x129')]];if(_0x8729b6){if(_0x8729b6[_0x9508('0xf9')]&&this[_0x9508('0x15')][_0x8729b6[_0x9508('0xf9')]]){ut[_0x9508('0x12a')](_0x8729b6,this['agents'][_0x8729b6[_0x9508('0xf9')]]['name'],this['agents'][_0x8729b6[_0x9508('0xf9')]]['id']);}var _0x15ba1c=_['clone'](_0x8729b6);_0x15ba1c[_0x9508('0xab')]=moment()[_0x9508('0x55')](_0x9508('0x8b'));var _0x50c019=_0x357d58[_0x9508('0x24')][_0x8729b6['queue']];if(ut[_0x9508('0x12b')](_0xbe8dda['response'])){if(_0x8729b6[_0x9508('0xc2')]){rpcDb['unlockContact'](_0x8729b6[_0x9508('0x12c')]);}if(_0x8729b6[_0x9508('0xa8')]){rpcDb['disableContact'](_0x8729b6[_0x9508('0x12c')]);}ami[_0x9508('0x25')]('custom:agentringnoanswer',ut[_0x9508('0x9d')](_0x8729b6,'rejected',this['campaignsPreview'][_0x8729b6['queue']]));this[_0x9508('0xea')](_0x15ba1c,_0x50c019,_0xbe8dda);}else{_0x8729b6[_0x9508('0x8a')]=moment()['format'](_0x9508('0x8b'));ut['logAgent'](_0x15ba1c,0x4,_0x9508('0xb5'));rpcDb[_0x9508('0xef')](_0x15ba1c,_0x9508('0x12d'));}}};Preview[_0x9508('0x62')][_0x9508('0x19')]=function(_0x2dc2c7){var _0xcb2e=this;var _0x482718=this[_0x9508('0x14')][_0x2dc2c7[_0x9508('0xa9')]];var _0x5a2437;if(_0x482718){_0x5a2437=this[_0x9508('0x24')][_0x482718['queue']];logger[_0x9508('0x58')]('[syncHangup][talking]',_0x2dc2c7['linkedid'],_0x9508('0xe9'),_0x5a2437['name'],_0x9508('0x71'),_0x5a2437[_0x9508('0x2b')]);}if(this[_0x9508('0x14')][_0x2dc2c7['linkedid']]&&_0x2dc2c7['linkedid']!==_0x2dc2c7[_0x9508('0xae')]){if(_0x2dc2c7['cause']==='16'&&this[_0x9508('0x14')][_0x2dc2c7[_0x9508('0xa9')]][_0x9508('0x7a')]){this[_0x9508('0x9a')](_0x2dc2c7,_0x2dc2c7['linkedid'],_0x2dc2c7[_0x9508('0x12e')]);}else if(this['actions'][_0x2dc2c7['linkedid']]['dialAnswer']){logger[_0x9508('0x58')](_0x9508('0x12f'),_0x2dc2c7['linkedid'],_0x2dc2c7[_0x9508('0x12e')],'\x20Queue',_0x5a2437[_0x9508('0x51')],'pTalking:\x20',_0x5a2437['pTalking']);this[_0x9508('0x9a')](_0x2dc2c7,_0x2dc2c7[_0x9508('0xa9')],_0x2dc2c7[_0x9508('0x12e')]);}}else if(_0x482718&&_[_0x9508('0x6c')](_0x482718[_0x9508('0x130')])&&_0x5a2437[_0x9508('0x131')]&&_0x2dc2c7[_0x9508('0xa9')]===_0x2dc2c7[_0x9508('0xae')]&&_['isNil'](_0x2dc2c7['reason'])&&_0x2dc2c7[_0x9508('0x12e')]==='16'&&_0x2dc2c7[_0x9508('0x132')]==='6'&&_[_0x9508('0xeb')](_0x482718[_0x9508('0x133')])){if(_0x482718[_0x9508('0xc2')]){rpcDb[_0x9508('0x10b')](_0x482718['idContact']);}if(_0x482718[_0x9508('0xa8')]){rpcDb[_0x9508('0x89')](_0x482718[_0x9508('0x12c')]);}_0x2dc2c7['reason']='22';this[_0x9508('0xea')](_0x482718,_0x5a2437,_0x2dc2c7);}else if(_0x482718&&_0x482718[_0x9508('0x133')]){if(_0x2dc2c7[_0x9508('0x12e')]==='16'&&this[_0x9508('0x14')][_0x2dc2c7[_0x9508('0xa9')]]['dialAnswer']){logger[_0x9508('0x58')]('[syncHangup][talking][transfer]',_0x2dc2c7[_0x9508('0xa9')],_0x2dc2c7[_0x9508('0x12e')],_0x9508('0xe9'),_0x5a2437[_0x9508('0x51')],_0x9508('0x71'),_0x5a2437[_0x9508('0x2b')]);this[_0x9508('0x9a')](_0x2dc2c7,_0x2dc2c7[_0x9508('0xa9')],_0x2dc2c7[_0x9508('0x12e')]);}else if(this[_0x9508('0x14')][_0x2dc2c7[_0x9508('0xa9')]][_0x9508('0x7a')]){logger[_0x9508('0x58')](_0x9508('0x12f'),_0x2dc2c7[_0x9508('0xa9')],_0x2dc2c7['cause'],_0x9508('0xe9'),_0x5a2437['name'],'pTalking:\x20',_0x5a2437['pTalking']);this[_0x9508('0x9a')](_0x2dc2c7,_0x2dc2c7[_0x9508('0xa9')],_0x2dc2c7[_0x9508('0x12e')]);}}};Preview[_0x9508('0x62')]['syncDialEnd']=function(_0x1e40c3){if(this[_0x9508('0x14')][_0x1e40c3[_0x9508('0x134')]]&&_0x1e40c3['destlinkedid']!==_0x1e40c3[_0x9508('0x135')]){this['callProgressDetectingCustomer'](_0x1e40c3,_0x1e40c3[_0x9508('0x134')],_0x1e40c3[_0x9508('0xe0')]);}};Preview['prototype'][_0x9508('0x1b')]=function(_0x447d88){if(this[_0x9508('0x14')][_0x447d88[_0x9508('0xa9')]]&&_0x447d88[_0x9508('0xa9')]!==_0x447d88['uniqueid']&&!this[_0x9508('0x14')][_0x447d88['linkedid']][_0x9508('0x7a')]){if(_0x447d88['cause']==='1'){this[_0x9508('0x9a')](_0x447d88,_0x447d88[_0x9508('0xa9')],_0x447d88[_0x9508('0x12e')]);}}};Preview[_0x9508('0x62')]['addVariable']=function(_0x281e45,_0xd67ea2,_0xef2667){if(this[_0x9508('0x14')][_0x281e45]){if(_[_0x9508('0x6c')](this[_0x9508('0x14')][_0x281e45]['variables'])){this[_0x9508('0x14')][_0x281e45][_0x9508('0x136')]={};}this[_0x9508('0x14')][_0x281e45][_0x9508('0x136')][_0xd67ea2]=_0xef2667;}};Preview[_0x9508('0x62')][_0x9508('0x21')]=function(_0x38b021){try{if(!_[_0x9508('0x6c')](_0x38b021)){if(ut[_0x9508('0x137')](_[_0x9508('0x138')](_0x38b021[_0x9508('0x139')])[0x0])){this[_0x9508('0x13a')](_0x38b021[_0x9508('0xae')],_[_0x9508('0x138')](_0x38b021[_0x9508('0x139')])[0x0],_0x38b021[_0x9508('0x13b')]);}}}catch(_0x27428d){logger['error']('[syncVarSet][Preview]',util[_0x9508('0x13c')](_0x27428d,{'showHidden':![],'depth':null}));}};Preview[_0x9508('0x62')][_0x9508('0x23')]=function(_0x45c545){if(_0x45c545){if(this[_0x9508('0x14')][_0x45c545[_0x9508('0x13d')]]){this[_0x9508('0x14')][_0x45c545[_0x9508('0x13d')]][_0x9508('0x133')]=!![];}}};Preview[_0x9508('0x62')][_0x9508('0x13e')]=function(_0x105b5a){if(_0x105b5a){if(this[_0x9508('0x14')][_0x105b5a['transfererlinkedid']]){this[_0x9508('0x14')][_0x105b5a[_0x9508('0x13f')]][_0x9508('0x133')]=!![];}}};module[_0x9508('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 35aeaaa..84e7d65 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 _0x6f3d=['createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','getContactPreview'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x6f3d,0x181));var _0xd6f3=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x6f3d[_0x5400a1];return _0x4006c7;};'use strict';var util=require('util');var BPromise=require(_0xd6f3('0x0'));var logger=require(_0xd6f3('0x1'))(_0xd6f3('0x2'));var _=require(_0xd6f3('0x3'));var cmHopper=require(_0xd6f3('0x4'));var cmHopperFinal=require(_0xd6f3('0x5'));var cmHopperHistory=require(_0xd6f3('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0xd6f3('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xd6f3('0x8'));function loggerCatch(_0xdafd7d){return function(_0x16d811){logger[_0xd6f3('0x9')](_0xdafd7d,util[_0xd6f3('0xa')](_0x16d811,{'showHidden':![],'depth':null}));};}function create(_0x56c222){return BPromise['resolve']()['then'](cmHopperHistory[_0xd6f3('0xb')](_0x56c222))[_0xd6f3('0xc')](loggerCatch(_0xd6f3('0xd')));}function createAgent(_0x430ca7){return BPromise['resolve']()[_0xd6f3('0xe')](agentReportPreview[_0xd6f3('0xb')](_0x430ca7))['catch'](loggerCatch(_0xd6f3('0xd')));}function moveContact(_0x246595){return BPromise['resolve']()[_0xd6f3('0xe')](cmHopper[_0xd6f3('0xf')](_0x246595,!![]))[_0xd6f3('0xc')](loggerCatch(_0xd6f3('0x10')));}exports[_0xd6f3('0x11')]=function(_0x5ef1c8){return BPromise[_0xd6f3('0x12')]()['then'](cmHopperBlack[_0xd6f3('0x11')](_0x5ef1c8))[_0xd6f3('0xc')](loggerCatch(_0xd6f3('0x13')));};exports['getContactPreview']=function(_0x5ef473){return BPromise[_0xd6f3('0x12')]()[_0xd6f3('0xe')](cmHopper[_0xd6f3('0x14')](_0x5ef473))['catch'](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x317778,_0x5ccf2e){create(_0x317778)[_0xd6f3('0xc')](loggerCatch(_0x5ccf2e));moveContact(_0x317778)[_0xd6f3('0xc')](loggerCatch(_0x5ccf2e));};exports[_0xd6f3('0x15')]=function(_0x1988d7,_0x43910e){createAgent(_0x1988d7)[_0xd6f3('0xc')](loggerCatch(_0x43910e));};exports[_0xd6f3('0x16')]=function(_0x3f4919,_0x4e378f){create(_0x3f4919)[_0xd6f3('0xc')](loggerCatch(_0x4e378f));};exports[_0xd6f3('0x17')]=function(_0x19281a,_0x3ba846){moveContact(_0x19281a)[_0xd6f3('0xc')](loggerCatch(_0x3ba846));};exports['rescheduleContact']=function(_0x5a961f,_0x459b36,_0x27eeb5){if(_0x459b36){_0x5a961f[_0xd6f3('0x18')]=null;}if(_0x27eeb5){_0x5a961f[_0xd6f3('0x19')]=![];}return BPromise['resolve']()[_0xd6f3('0xe')](cmHopper['rescheduleContact'](_0x5a961f))['catch'](loggerCatch(_0xd6f3('0x1a')));};exports['countReScheduled']=function(_0x3a5fee){return BPromise[_0xd6f3('0x12')]()['then'](cmHopper[_0xd6f3('0x1b')](_0x3a5fee))['catch'](loggerCatch(_0xd6f3('0x1c')));};exports['unlockContact']=function(_0x9ebd2f){return BPromise[_0xd6f3('0x12')]()['then'](cmHopper[_0xd6f3('0x1d')]({'UserId':null},_0x9ebd2f,0x1))[_0xd6f3('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0xd6f3('0x1e')]=function(_0x1a2c6b){return BPromise[_0xd6f3('0x12')]()[_0xd6f3('0xe')](cmHopper[_0xd6f3('0x1d')]({'active':![]},_0x1a2c6b,0x1))[_0xd6f3('0xc')](loggerCatch(_0xd6f3('0x1f')));};exports['crateCustomerReportQueue']=function(_0x2d19c3){var _0x5bbde9={};_0x5bbde9[_0xd6f3('0x20')]=_0x2d19c3['type'];_0x5bbde9[_0xd6f3('0x21')]=_0x2d19c3[_0xd6f3('0x21')];_0x5bbde9[_0xd6f3('0x22')]=_0x2d19c3[_0xd6f3('0x22')];_0x5bbde9['calleridname']=_0x2d19c3[_0xd6f3('0x23')];_0x5bbde9[_0xd6f3('0x24')]=_0x2d19c3[_0xd6f3('0x24')];_0x5bbde9[_0xd6f3('0x25')]=_0x2d19c3[_0xd6f3('0x26')];_0x5bbde9[_0xd6f3('0x27')]=_0x2d19c3['answertime'];_0x5bbde9['queuecallercomplete']=0x1;_0x5bbde9['queuecallercompleteAt']=_0x2d19c3[_0xd6f3('0x28')];_0x5bbde9[_0xd6f3('0x29')]=_0x2d19c3[_0xd6f3('0x2a')];_0x5bbde9[_0xd6f3('0x2b')]=_0xd6f3('0x2c');_0x5bbde9[_0xd6f3('0x2d')]=_0xd6f3('0x2e');_0x5bbde9[_0xd6f3('0x2f')]=0x0;_0x5bbde9[_0xd6f3('0x30')]=0x1;_0x5bbde9[_0xd6f3('0x31')]=_0x2d19c3[_0xd6f3('0x2a')];_0x5bbde9[_0xd6f3('0x32')]=_0xd6f3('0x33');return BPromise[_0xd6f3('0x12')]()[_0xd6f3('0xe')](voiceQueueReport['create'](_0x5bbde9))[_0xd6f3('0xc')](loggerCatch(_0xd6f3('0x34')));};exports[_0xd6f3('0x35')]=function(_0xf95595,_0x35c0c5){return BPromise[_0xd6f3('0x12')]()[_0xd6f3('0xe')](cmHopper[_0xd6f3('0x35')](_0xf95595,_0x35c0c5))['catch'](loggerCatch(_0xd6f3('0x36')));};exports[_0xd6f3('0x37')]=function(_0x33727c){return BPromise[_0xd6f3('0x12')]()[_0xd6f3('0xe')](cmHopper[_0xd6f3('0x38')](_0x33727c,!![],!![]))['catch'](loggerCatch(_0xd6f3('0x39')));}; \ No newline at end of file +var _0x945f=['context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','resolve','then','createHistory','[createHistory]\x20','moveContactManagedDialer','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','answertime','membername'];(function(_0x46c874,_0x2b57e6){var _0x3596a3=function(_0x48ad27){while(--_0x48ad27){_0x46c874['push'](_0x46c874['shift']());}};_0x3596a3(++_0x2b57e6);}(_0x945f,0xcd));var _0xf945=function(_0x3a7dee,_0x892897){_0x3a7dee=_0x3a7dee-0x0;var _0x55afe6=_0x945f[_0x3a7dee];return _0x55afe6;};'use strict';var util=require(_0xf945('0x0'));var BPromise=require(_0xf945('0x1'));var logger=require(_0xf945('0x2'))('preview');var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xf945('0x3'));var cmHopperBlack=require(_0xf945('0x4'));var voiceQueueRt=require(_0xf945('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xf945('0x6'));function loggerCatch(_0x383650){return function(_0x42f570){logger['error'](_0x383650,util['inspect'](_0x42f570,{'showHidden':![],'depth':null}));};}function create(_0x12dbba){return BPromise[_0xf945('0x7')]()[_0xf945('0x8')](cmHopperHistory[_0xf945('0x9')](_0x12dbba))['catch'](loggerCatch(_0xf945('0xa')));}function createAgent(_0x1b4ce4){return BPromise['resolve']()[_0xf945('0x8')](agentReportPreview[_0xf945('0x9')](_0x1b4ce4))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3e23c9){return BPromise['resolve']()['then'](cmHopper[_0xf945('0xb')](_0x3e23c9,!![]))[_0xf945('0xc')](loggerCatch(_0xf945('0xd')));}exports[_0xf945('0xe')]=function(_0x5c40bf){return BPromise[_0xf945('0x7')]()['then'](cmHopperBlack[_0xf945('0xe')](_0x5c40bf))['catch'](loggerCatch(_0xf945('0xf')));};exports[_0xf945('0x10')]=function(_0x5c301f){return BPromise['resolve']()[_0xf945('0x8')](cmHopper['getContactPreview'](_0x5c301f))['catch'](loggerCatch(_0xf945('0x11')));};exports['createHistory']=function(_0x1d65dd,_0x3dc1f7){create(_0x1d65dd)[_0xf945('0xc')](loggerCatch(_0x3dc1f7));moveContact(_0x1d65dd)[_0xf945('0xc')](loggerCatch(_0x3dc1f7));};exports['createAgentHistory']=function(_0x3b0280,_0x2041f1){createAgent(_0x3b0280)['catch'](loggerCatch(_0x2041f1));};exports[_0xf945('0x12')]=function(_0x91d780,_0x53f4ca){create(_0x91d780)[_0xf945('0xc')](loggerCatch(_0x53f4ca));};exports[_0xf945('0x13')]=function(_0x29ea98,_0x210d3b){moveContact(_0x29ea98)[_0xf945('0xc')](loggerCatch(_0x210d3b));};exports[_0xf945('0x14')]=function(_0x6d26d7,_0xf0780f,_0x59bb99){if(_0xf0780f){_0x6d26d7['UserId']=null;}if(_0x59bb99){_0x6d26d7[_0xf945('0x15')]=![];}return BPromise[_0xf945('0x7')]()[_0xf945('0x8')](cmHopper['rescheduleContact'](_0x6d26d7))[_0xf945('0xc')](loggerCatch(_0xf945('0x16')));};exports[_0xf945('0x17')]=function(_0x68f6b2){return BPromise[_0xf945('0x7')]()['then'](cmHopper[_0xf945('0x17')](_0x68f6b2))[_0xf945('0xc')](loggerCatch(_0xf945('0x18')));};exports[_0xf945('0x19')]=function(_0x59c328){return BPromise[_0xf945('0x7')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x59c328,0x1))[_0xf945('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0xf945('0x1a')]=function(_0x3f84eb){return BPromise[_0xf945('0x7')]()[_0xf945('0x8')](cmHopper[_0xf945('0x19')]({'active':![]},_0x3f84eb,0x1))[_0xf945('0xc')](loggerCatch('[activeContact]\x20'));};exports[_0xf945('0x1b')]=function(_0x588f53){var _0x5c29f8={};_0x5c29f8[_0xf945('0x1c')]=_0x588f53[_0xf945('0x1c')];_0x5c29f8['uniqueid']=_0x588f53['uniqueid'];_0x5c29f8[_0xf945('0x1d')]=_0x588f53['calleridnum'];_0x5c29f8[_0xf945('0x1e')]=_0x588f53['calleridname'];_0x5c29f8['queue']=_0x588f53['queue'];_0x5c29f8[_0xf945('0x1f')]=_0x588f53['answertime'];_0x5c29f8[_0xf945('0x20')]=_0x588f53[_0xf945('0x21')];_0x5c29f8['queuecallercomplete']=0x1;_0x5c29f8['queuecallercompleteAt']=_0x588f53['endtime'];_0x5c29f8['connectedlinename']=_0x588f53[_0xf945('0x22')];_0x5c29f8[_0xf945('0x23')]='from-sip';_0x5c29f8[_0xf945('0x24')]=_0xf945('0x25');_0x5c29f8[_0xf945('0x26')]=0x0;_0x5c29f8[_0xf945('0x27')]=0x1;_0x5c29f8[_0xf945('0x28')]=_0x588f53['membername'];_0x5c29f8[_0xf945('0x29')]=_0xf945('0x2a');return BPromise[_0xf945('0x7')]()[_0xf945('0x8')](voiceQueueReport[_0xf945('0x2b')](_0x5c29f8))['catch'](loggerCatch(_0xf945('0x2c')));};exports[_0xf945('0x2d')]=function(_0x538297,_0xd1cd5f){return BPromise[_0xf945('0x7')]()[_0xf945('0x8')](cmHopper['getContactRecallMe'](_0x538297,_0xd1cd5f))['catch'](loggerCatch(_0xf945('0x2e')));};exports[_0xf945('0x2f')]=function(_0x4a871c){return BPromise[_0xf945('0x7')]()['then'](cmHopper['rescheduleContact'](_0x4a871c,!![],!![]))[_0xf945('0xc')](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 f7d2019..b8b3ee8 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 _0x0b43=['getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','info','error','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','ringtime','responsetime','logLookAgent','membername','UserId','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','timeout','totalGlobal','countbusyretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','buildObj','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','countcongestionretry','countnoanswerretry','callback','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepvtcallid'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0x0b43,0x8c));var _0x30b4=function(_0x4ec8f8,_0x59b707){_0x4ec8f8=_0x4ec8f8-0x0;var _0x59d53c=_0x0b43[_0x4ec8f8];return _0x59d53c;};'use strict';var util=require(_0x30b4('0x0'));var _=require(_0x30b4('0x1'));var moment=require('moment');var logger=require(_0x30b4('0x2'))(_0x30b4('0x3'));var ipAgi=process[_0x30b4('0x4')][_0x30b4('0x5')]||_0x30b4('0x6');function getSeconds(_0x280fd2,_0xef553d){var _0x262cee=moment(_0x280fd2)[_0x30b4('0x7')](0x0);var _0x4e1689=moment(_0xef553d)[_0x30b4('0x7')](0x0);return _0x262cee['diff'](_0x4e1689,_0x30b4('0x8'));}exports[_0x30b4('0x9')]=function(_0x11a1b0){return function(_0x5cb40e){logger['error'](_0x11a1b0,util[_0x30b4('0xa')](_0x5cb40e,{'showHidden':![],'depth':null}));};};exports[_0x30b4('0xb')]=function(_0x4f1baa,_0x15a927){logger[_0x30b4('0xc')](_0x4f1baa,util[_0x30b4('0xa')](_0x15a927,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5105f3,_0x4deb44){logger[_0x30b4('0xd')](_0x5105f3,util[_0x30b4('0xa')](_0x4deb44,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2dc7f3){return function(_0x332729){logger[_0x30b4('0xc')](_0x2dc7f3,util[_0x30b4('0xa')](_0x332729,{'showHidden':![],'depth':null}));};};exports[_0x30b4('0xe')]=function(_0x28c0af,_0x37be8a,_0x295f4f){return{'message':_0x28c0af,'unlock':_0x37be8a,'active':_0x295f4f};};exports[_0x30b4('0xf')]=function(_0x10a43f,_0x4cb637,_0x636e28){if(!_[_0x30b4('0x10')](_0x636e28)&&_0x30b4('0x11')===typeof _0x636e28&&!_[_0x30b4('0x12')](_0x636e28)){if(!_['isUndefined'](_0x4cb637)&&_0x30b4('0x11')===typeof _0x4cb637&&!_[_0x30b4('0x12')](_0x4cb637)){return util[_0x30b4('0x13')](_0x30b4('0x14'),_0x4cb637,_0x636e28);}return util['format'](_0x30b4('0x14'),_0x636e28,_0x636e28);}if(!_[_0x30b4('0x10')](_0x10a43f)&&'string'===typeof _0x10a43f&&!_[_0x30b4('0x12')](_0x10a43f)){return _0x10a43f;}return _0x30b4('0x15');};exports['isActive']=function(_0x304d56){if(_[_0x30b4('0x16')](_0x304d56)){return![];}return _0x304d56;};exports[_0x30b4('0x17')]=function(_0xcffd4a,_0x49bf5b,_0xb21e69,_0x3ee548,_0x17cbee,_0x8830c5){var _0x465449={'XMD-QUEUE':_0x49bf5b['Queue']?_0x49bf5b['Queue'][_0x30b4('0x18')]:'','XMD-CALLERID':_0x3ee548,'XMD-CALLERID-PREVIEW':_0x8830c5?util['format'](_0x30b4('0x14'),_0x8830c5[_0x30b4('0x19')],_0x8830c5['calleridnum']):_0x3ee548,'XMD-DIALID':_0x17cbee,'XMD-CONTACTID':_0x49bf5b[_0x30b4('0x1a')],'XMD-CDRTYPE':_0x30b4('0x1b'),'CALLERID(all)':_0x3ee548,'XMD-VOICEQUEUEID':_0x49bf5b[_0x30b4('0x1c')],'XMD-DIALCHANNEL':_0xb21e69,'XMD-DIALTIMEOUT':_0xcffd4a[_0x30b4('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x30b4('0x1e'),_0xcffd4a[_0x30b4('0x1f')]?'g':'',_['isEmpty'](_0xcffd4a[_0x30b4('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0xcffd4a[_0x30b4('0x21')]||'','XMD-AGI':_0xcffd4a[_0x30b4('0x22')]?util[_0x30b4('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0xcffd4a['dialQueueProject']):_0x30b4('0x23'),'XMD-AGIAFTER':_0xcffd4a[_0x30b4('0x1f')]?util['format'](_0x30b4('0x24'),ipAgi,_0xcffd4a[_0x30b4('0x1f')]):_0x30b4('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x8830c5?_0x8830c5[_0x30b4('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x8830c5?_0x8830c5['originatecalleridname']:'','XMD-DESTINATION':_0x30b4('0x26'),'SIPADDHEADER':_0x30b4('0x27')};if(!_[_0x30b4('0x12')](_0xcffd4a[_0x30b4('0x20')])){_0x465449[util[_0x30b4('0x13')]('%s',_0x30b4('0x28'))]=_0xcffd4a[_0x30b4('0x20')];_0x465449[util[_0x30b4('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x17cbee;}if(_0x49bf5b&&_0x49bf5b[_0x30b4('0x29')]){for(var _0x8df821 in _0x49bf5b[_0x30b4('0x29')]){if(_0x49bf5b['Contact'][_0x30b4('0x2a')](_0x8df821)){if(!_[_0x30b4('0x16')](_0x49bf5b['Contact'][_0x8df821])&&_0x8df821!=='id'&&_0x8df821!=='tags'&&_0x8df821!==_0x30b4('0x2b')&&_0x8df821!=='updatedAt'){_0x465449[util['format'](_0x30b4('0x2c'),_0x30b4('0x2d'),_[_0x30b4('0x2e')](_0x8df821))]=_0x49bf5b[_0x30b4('0x29')][_0x8df821];}}}}return _0x465449;};exports[_0x30b4('0x2f')]=function(_0x72b9eb){var _0x4bbc69={};for(var _0x6047c in _0x72b9eb){if(_0x72b9eb[_0x30b4('0x2a')](_0x6047c)){_0x4bbc69[util[_0x30b4('0x13')]('%s',_['toLower'](_0x6047c))]=_0x72b9eb[_0x6047c];}}return{'variables':_0x4bbc69};};exports[_0x30b4('0x30')]=function(_0x2e6131,_0x540d29){if(!_[_0x30b4('0x16')](_0x2e6131)){if(_0x2e6131[_0x30b4('0x2a')](_0x30b4('0x31'))){if(_0x2e6131[_0x30b4('0x31')]>0x0){_0x2e6131[_0x30b4('0x31')]-=0x1;}else{logger[_0x30b4('0xd')](_0x30b4('0x32'),_0x540d29);}}}else{logger[_0x30b4('0xd')](_0x30b4('0x33'),_0x540d29);}};exports[_0x30b4('0x34')]=function(_0x14b070){var _0x5ce957=moment()[_0x30b4('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x14b070['state']=0xd;_0x14b070['statedesc']=_0x30b4('0x35');_0x14b070[_0x30b4('0x36')]=_0x5ce957;_0x14b070['responsetime']=_0x5ce957;_0x14b070[_0x30b4('0x37')]=_0x5ce957;};exports[_0x30b4('0x38')]=function(_0x33bd1d,_0x54079f,_0x4192ac){var _0x3c84d2=moment()['format'](_0x30b4('0x39'));_0x33bd1d[_0x30b4('0x3a')]=_0x54079f;_0x33bd1d[_0x30b4('0x3b')]=_0x4192ac;_0x33bd1d['responsetime']=_0x3c84d2;_0x33bd1d[_0x30b4('0x3c')]=getSeconds(_0x33bd1d[_0x30b4('0x3d')],_0x33bd1d[_0x30b4('0x36')]);};exports[_0x30b4('0x3e')]=function(_0x2f9d5d,_0x11ae91,_0x375c27){_0x2f9d5d[_0x30b4('0x3f')]=_0x11ae91;_0x2f9d5d[_0x30b4('0x40')]=_0x375c27;};exports['logCustomer']=function(_0x5a2f09,_0x39186c,_0xe45ca2){var _0x4c8376=moment()['format'](_0x30b4('0x39'));_0x5a2f09[_0x30b4('0x3a')]=_0x39186c;_0x5a2f09[_0x30b4('0x3b')]=_0xe45ca2;_0x5a2f09['responsetime']=_0x5a2f09[_0x30b4('0x3d')]?_0x5a2f09[_0x30b4('0x3d')]:_0x4c8376;_0x5a2f09['endtime']=_0x5a2f09[_0x30b4('0x37')]?_0x5a2f09['endtime']:_0x4c8376;_0x5a2f09[_0x30b4('0x3c')]=getSeconds(_0x5a2f09[_0x30b4('0x3d')]||0x0,_0x5a2f09[_0x30b4('0x36')]||0x0);_0x5a2f09['talktime']=_0x5a2f09['answertime']?getSeconds(_0x5a2f09['endtime'],_0x5a2f09[_0x30b4('0x41')]):0x0;};exports[_0x30b4('0x42')]=function(_0x773347){return _0x773347===_0x30b4('0x43');};exports['variablesAction']=function(_0xee0832,_0x37775c,_0x38fcb4,_0x6b412f,_0x309274){var _0x5f47c9=_0x6b412f?_0x30b4('0x44'):_0xee0832[_0x30b4('0x19')];_0x5f47c9=_0x309274?_0x30b4('0x45'):_0x5f47c9;return{'actionid':_0xee0832[_0x30b4('0x46')],'action':_0x30b4('0x47'),'channel':_0xee0832['channelAgent'],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x5f47c9,_0xee0832['calleridnum']),'Exten':_0x30b4('0x26'),'Context':_0x30b4('0x48'),'Priority':'1','variable':_0x38fcb4,'timeout':(_0x37775c[_0x30b4('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0xee0832[_0x30b4('0x46')]};};exports[_0x30b4('0x4a')]=function(_0x4428d1){return _0x4428d1[_0x30b4('0x4b')]+_0x4428d1['countcongestionretry']+_0x4428d1['countnoanswerretry']+_0x4428d1['countagentrejectretry']+_0x4428d1['countnosuchnumberretry'];};exports[_0x30b4('0x4c')]=function(_0xfd75d9){var _0x270227=_[_0x30b4('0x4d')](_0xfd75d9);_0x270227[_0x30b4('0x3a')]=0xf;_0x270227[_0x30b4('0x3b')]=_0x30b4('0x4e');return _0x270227;};exports['scheduledAt']=function(_0x15d131,_0x309c9a,_0x5847c8){var _0x1cd4aa={};_0x1cd4aa[_0x309c9a]=_0x15d131[_0x309c9a];_0x1cd4aa[_0x30b4('0x4f')]=![];_0x1cd4aa[_0x30b4('0x50')]=moment()['add'](_0x5847c8,_0x30b4('0x51'))[_0x30b4('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1cd4aa[_0x30b4('0x1a')]=_0x15d131[_0x30b4('0x1a')];_0x1cd4aa[_0x30b4('0x52')]=_0x15d131[_0x30b4('0x52')];_0x1cd4aa[_0x30b4('0x1c')]=_0x15d131[_0x30b4('0x1c')]||undefined;return _0x1cd4aa;};exports[_0x30b4('0x53')]=function(_0x43cda5,_0xa92633){if(!_['isNil'](_0x43cda5)){if(_0x43cda5[_0x30b4('0x54')]>0x0){_0x43cda5[_0x30b4('0x54')]-=0x1;}else{logger['error'](_0xa92633,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x30b4('0xd')](_0xa92633,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x5a9f38){if(_0x5a9f38<=0x0){return!![];}return![];};exports[_0x30b4('0x55')]=function(_0x4f0d61,_0x29571a,_0x1350f0){_0x4f0d61[_0x30b4('0x56')]=_0x29571a;_0x4f0d61[_0x30b4('0x18')]=_0x4f0d61[_0x30b4('0x57')];_0x4f0d61[_0x30b4('0x58')]=_0x4f0d61[_0x30b4('0x59')];_0x4f0d61[_0x30b4('0x5a')]=_0x30b4('0x5b');if(_0x1350f0){_0x4f0d61[_0x30b4('0x5c')]=_0x1350f0[_0x30b4('0x5c')];}return _0x4f0d61;};exports[_0x30b4('0x5d')]=function(_0x44fd1f){var _0x5b16cb={};_0x5b16cb['queue']=_0x44fd1f[_0x30b4('0x57')];_0x5b16cb[_0x30b4('0x58')]=_0x44fd1f['channelAgent'];_0x5b16cb[_0x30b4('0x46')]=_0x44fd1f[_0x30b4('0x46')];return _0x5b16cb;};exports['agentReadyId']=function(_0x54b483){var _0x2ddd9b=[];for(var _0x228f07 in _0x54b483){if(_0x54b483[_0x30b4('0x2a')](_0x228f07)){if(!_[_0x30b4('0x16')](_0x54b483[_0x228f07])&&_0x54b483[_0x228f07][_0x30b4('0x3a')]==='not_inuse'&&_0x54b483[_0x228f07]['status']===_0x30b4('0x5e')){_0x2ddd9b[_0x30b4('0x5f')](_0x54b483[_0x228f07]['id']);}}}return _0x2ddd9b;};exports[_0x30b4('0x60')]=function(_0x370fa1){var _0x2a1ae5=moment()[_0x30b4('0x7')](0x0);var _0x1a015f=moment(_0x370fa1)['milliseconds'](0x0);return _0x2a1ae5[_0x30b4('0x61')](_0x1a015f,'seconds');};exports[_0x30b4('0x62')]=function(_0x2f82cd){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f82cd[_0x30b4('0x1a')],'ListId':_0x2f82cd['ListId'],'VoiceQueueId':_0x2f82cd[_0x30b4('0x1c')]||undefined,'CampaignId':_0x2f82cd[_0x30b4('0x63')]||undefined};};exports[_0x30b4('0x64')]=function(_0x413f8f){if(_0x413f8f===_0x30b4('0x46')||_0x413f8f===_0x30b4('0x65')||_0x413f8f==='queue'||_0x413f8f===_0x30b4('0x66')||_0x413f8f==='campaigntype'||_0x413f8f==='dialAnswer'||_0x413f8f===_0x30b4('0x3f')||_0x413f8f==='channelAgent'||_0x413f8f==='calleridname'||_0x413f8f==='active'||_0x413f8f==='calleridnum'||_0x413f8f==='scheduledat'||_0x413f8f===_0x30b4('0x4b')||_0x413f8f===_0x30b4('0x67')||_0x413f8f===_0x30b4('0x68')||_0x413f8f==='countglobal'||_0x413f8f===_0x30b4('0x69')||_0x413f8f===_0x30b4('0x6a')||_0x413f8f===_0x30b4('0x6b')||_0x413f8f==='recallme'||_0x413f8f==='ContactId'||_0x413f8f==='ListId'||_0x413f8f===_0x30b4('0x40')||_0x413f8f===_0x30b4('0x1c')||_0x413f8f===_0x30b4('0x6c')||_0x413f8f==='xmd-voicequeueid'||_0x413f8f===_0x30b4('0x6d')||_0x413f8f==='xmd-phone'||_0x413f8f===_0x30b4('0x6e')||_0x413f8f===_0x30b4('0x6f')||_0x413f8f==='xmd-dialtimeout'||_0x413f8f===_0x30b4('0x70')||_0x413f8f==='xmd-dialid'||_0x413f8f===_0x30b4('0x71')||_0x413f8f===_0x30b4('0x72')||_0x413f8f===_0x30b4('0x73')||_0x413f8f==='xmd-callerid'||_0x413f8f===_0x30b4('0x74')||_0x413f8f===_0x30b4('0x75')||_0x413f8f==='rtpaudioqos'||_0x413f8f===_0x30b4('0x76')||_0x413f8f===_0x30b4('0x77')||_0x413f8f==='rtpaudioqosjitterbridged'||_0x413f8f===_0x30b4('0x78')||_0x413f8f===_0x30b4('0x79')||_0x413f8f===_0x30b4('0x7a')||_0x413f8f===_0x30b4('0x7b')||_0x413f8f===_0x30b4('0x7c')||_0x413f8f===_0x30b4('0x76')||_0x413f8f===_0x30b4('0x77')||_0x413f8f==='rtpaudioqosjitterbridged'||_0x413f8f===_0x30b4('0x78')||_0x413f8f===_0x30b4('0x79')||_0x413f8f===_0x30b4('0x7a')||_0x413f8f===_0x30b4('0x7b')||_0x413f8f==='bridgepeer'||_0x413f8f===_0x30b4('0x7d')||_0x413f8f===_0x30b4('0x3a')||_0x413f8f===_0x30b4('0x3b')){return![];}return!![];};exports[_0x30b4('0x7e')]=function(_0x2f1847,_0x5750ff){var _0x29a4ce,_0x296b4f,_0x1c9b64;if(_0x5750ff<=0x0){_0x5750ff=0x1;}_0x29a4ce=new RegExp(_0x30b4('0x7f')+_0x5750ff+'}$');_0x296b4f=Math[_0x30b4('0x80')](0xa,_0x5750ff-0x1);_0x1c9b64=Math[_0x30b4('0x80')](0xa,_0x5750ff)-0x1;return util[_0x30b4('0x13')]('%s',_[_0x30b4('0x81')](_0x2f1847,_0x29a4ce,_['random'](_0x296b4f,_0x1c9b64)));};exports[_0x30b4('0x82')]=function(_0x767964){var _0x42281d=_0x767964['match'](/"(.*?)"/);return _0x42281d?_0x42281d[0x1]:_0x767964;};exports[_0x30b4('0x83')]=function(_0x59c116){var _0x4795c3=_0x59c116[_0x30b4('0x84')](/<(.*?)>/);return _0x4795c3?_0x4795c3[0x1]:_0x59c116;}; \ No newline at end of file +var _0xba15=['pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','channelAgent','voice','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','type','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialoptions','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','extractCalleridNumber','match','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','inspect','info','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','statedesc','ringtime','logLookAgent','logCustomer','endtime','talktime','answertime','Failure','variablesAction','RECALL','uniqueid','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink'];(function(_0xd21c16,_0x213ad3){var _0x30d7b2=function(_0x1bdb2f){while(--_0x1bdb2f){_0xd21c16['push'](_0xd21c16['shift']());}};_0x30d7b2(++_0x213ad3);}(_0xba15,0x1c9));var _0x5ba1=function(_0x49f13d,_0x1caae4){_0x49f13d=_0x49f13d-0x0;var _0x148ac1=_0xba15[_0x49f13d];return _0x148ac1;};'use strict';var util=require('util');var _=require(_0x5ba1('0x0'));var moment=require('moment');var logger=require(_0x5ba1('0x1'))(_0x5ba1('0x2'));var ipAgi=process[_0x5ba1('0x3')][_0x5ba1('0x4')]||_0x5ba1('0x5');function getSeconds(_0x5a6b12,_0x594e0e){var _0x2b782d=moment(_0x5a6b12)['milliseconds'](0x0);var _0x3db2f6=moment(_0x594e0e)[_0x5ba1('0x6')](0x0);return _0x2b782d['diff'](_0x3db2f6,_0x5ba1('0x7'));}exports['loggerCatch']=function(_0x5a0ff3){return function(_0x5ed64b){logger[_0x5ba1('0x8')](_0x5a0ff3,util[_0x5ba1('0x9')](_0x5ed64b,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5d03f8,_0x41f176){logger[_0x5ba1('0xa')](_0x5d03f8,util['inspect'](_0x41f176,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0xa683ad,_0x54f40f){logger[_0x5ba1('0x8')](_0xa683ad,util[_0x5ba1('0x9')](_0x54f40f,{'showHidden':![],'depth':null}));};exports[_0x5ba1('0xb')]=function(_0x8d7ea7){return function(_0x5e652b){logger[_0x5ba1('0xa')](_0x8d7ea7,util[_0x5ba1('0x9')](_0x5e652b,{'showHidden':![],'depth':null}));};};exports[_0x5ba1('0xc')]=function(_0x74092b,_0x3308a7,_0x509369){return{'message':_0x74092b,'unlock':_0x3308a7,'active':_0x509369};};exports[_0x5ba1('0xd')]=function(_0x527a61,_0x3e1ea5,_0x5cb54d){if(!_[_0x5ba1('0xe')](_0x5cb54d)&&_0x5ba1('0xf')===typeof _0x5cb54d&&!_[_0x5ba1('0x10')](_0x5cb54d)){if(!_[_0x5ba1('0xe')](_0x3e1ea5)&&_0x5ba1('0xf')===typeof _0x3e1ea5&&!_[_0x5ba1('0x10')](_0x3e1ea5)){return util['format']('\x22%s\x22\x20<%s>',_0x3e1ea5,_0x5cb54d);}return util[_0x5ba1('0x11')](_0x5ba1('0x12'),_0x5cb54d,_0x5cb54d);}if(!_[_0x5ba1('0xe')](_0x527a61)&&_0x5ba1('0xf')===typeof _0x527a61&&!_[_0x5ba1('0x10')](_0x527a61)){return _0x527a61;}return _0x5ba1('0x13');};exports['isActive']=function(_0x5b292f){if(_[_0x5ba1('0x14')](_0x5b292f)){return![];}return _0x5b292f;};exports[_0x5ba1('0x15')]=function(_0x5086e0,_0x4af176,_0x56966b,_0x3a63cc,_0x705ad8,_0x137957){var _0x45540f={'XMD-QUEUE':_0x4af176[_0x5ba1('0x16')]?_0x4af176[_0x5ba1('0x16')]['name']:'','XMD-CALLERID':_0x3a63cc,'XMD-CALLERID-PREVIEW':_0x137957?util[_0x5ba1('0x11')](_0x5ba1('0x12'),_0x137957[_0x5ba1('0x17')],_0x137957[_0x5ba1('0x18')]):_0x3a63cc,'XMD-DIALID':_0x705ad8,'XMD-CONTACTID':_0x4af176[_0x5ba1('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3a63cc,'XMD-VOICEQUEUEID':_0x4af176['VoiceQueueId'],'XMD-DIALCHANNEL':_0x56966b,'XMD-DIALTIMEOUT':_0x5086e0['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x5ba1('0x11')]('\x22rtTxX%s%s\x22',_0x5086e0[_0x5ba1('0x1a')]?'g':'',_[_0x5ba1('0x10')](_0x5086e0[_0x5ba1('0x1b')])?'':_0x5ba1('0x1c')),'XMD-DIALURL':_0x5086e0['dialPreviewUrl']||'','XMD-AGI':_0x5086e0['dialQueueProject']?util[_0x5ba1('0x11')](_0x5ba1('0x1d'),ipAgi,_0x5086e0[_0x5ba1('0x1e')]):_0x5ba1('0x1f'),'XMD-AGIAFTER':_0x5086e0[_0x5ba1('0x1a')]?util[_0x5ba1('0x11')](_0x5ba1('0x1d'),ipAgi,_0x5086e0['dialQueueProject2']):_0x5ba1('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x137957?_0x137957[_0x5ba1('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x137957?_0x137957['originatecalleridname']:'','XMD-DESTINATION':_0x5ba1('0x21'),'SIPADDHEADER':_0x5ba1('0x22')};if(!_[_0x5ba1('0x10')](_0x5086e0[_0x5ba1('0x1b')])){_0x45540f[util[_0x5ba1('0x11')]('%s',_0x5ba1('0x23'))]=_0x5086e0[_0x5ba1('0x1b')];_0x45540f[util[_0x5ba1('0x11')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x705ad8;}if(_0x4af176&&_0x4af176[_0x5ba1('0x24')]){for(var _0x4e7752 in _0x4af176[_0x5ba1('0x24')]){if(_0x4af176[_0x5ba1('0x24')][_0x5ba1('0x25')](_0x4e7752)){if(!_[_0x5ba1('0x14')](_0x4af176[_0x5ba1('0x24')][_0x4e7752])&&_0x4e7752!=='id'&&_0x4e7752!==_0x5ba1('0x26')&&_0x4e7752!=='createdAt'&&_0x4e7752!==_0x5ba1('0x27')){_0x45540f[util[_0x5ba1('0x11')](_0x5ba1('0x28'),_0x5ba1('0x29'),_[_0x5ba1('0x2a')](_0x4e7752))]=_0x4af176['Contact'][_0x4e7752];}}}}return _0x45540f;};exports['toLowerVariables']=function(_0xfd0a37){var _0x2f4bab={};for(var _0xba2058 in _0xfd0a37){if(_0xfd0a37[_0x5ba1('0x25')](_0xba2058)){_0x2f4bab[util[_0x5ba1('0x11')]('%s',_[_0x5ba1('0x2b')](_0xba2058))]=_0xfd0a37[_0xba2058];}}return{'variables':_0x2f4bab};};exports[_0x5ba1('0x2c')]=function(_0x1c9415,_0x1e2f7d){if(!_[_0x5ba1('0x14')](_0x1c9415)){if(_0x1c9415[_0x5ba1('0x25')](_0x5ba1('0x2d'))){if(_0x1c9415[_0x5ba1('0x2d')]>0x0){_0x1c9415[_0x5ba1('0x2d')]-=0x1;}else{logger[_0x5ba1('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1e2f7d);}}}else{logger[_0x5ba1('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1e2f7d);}};exports[_0x5ba1('0x2e')]=function(_0x5f0182){var _0x9b14ef=moment()[_0x5ba1('0x11')](_0x5ba1('0x2f'));_0x5f0182[_0x5ba1('0x30')]=0xd;_0x5f0182['statedesc']=_0x5ba1('0x31');_0x5f0182[_0x5ba1('0x32')]=_0x9b14ef;_0x5f0182[_0x5ba1('0x33')]=_0x9b14ef;_0x5f0182['endtime']=_0x9b14ef;};exports[_0x5ba1('0x34')]=function(_0x467444,_0x532b3b,_0x8cd7f3){var _0x551077=moment()['format'](_0x5ba1('0x2f'));_0x467444['state']=_0x532b3b;_0x467444[_0x5ba1('0x35')]=_0x8cd7f3;_0x467444['responsetime']=_0x551077;_0x467444[_0x5ba1('0x36')]=getSeconds(_0x467444['responsetime'],_0x467444[_0x5ba1('0x32')]);};exports[_0x5ba1('0x37')]=function(_0x51423a,_0x53a3ab,_0x158110){_0x51423a['membername']=_0x53a3ab;_0x51423a['UserId']=_0x158110;};exports[_0x5ba1('0x38')]=function(_0x4fe527,_0x2db964,_0x1bccb3){var _0x580deb=moment()['format'](_0x5ba1('0x2f'));_0x4fe527[_0x5ba1('0x30')]=_0x2db964;_0x4fe527[_0x5ba1('0x35')]=_0x1bccb3;_0x4fe527[_0x5ba1('0x33')]=_0x4fe527[_0x5ba1('0x33')]?_0x4fe527[_0x5ba1('0x33')]:_0x580deb;_0x4fe527[_0x5ba1('0x39')]=_0x4fe527[_0x5ba1('0x39')]?_0x4fe527[_0x5ba1('0x39')]:_0x580deb;_0x4fe527['ringtime']=getSeconds(_0x4fe527[_0x5ba1('0x33')]||0x0,_0x4fe527[_0x5ba1('0x32')]||0x0);_0x4fe527[_0x5ba1('0x3a')]=_0x4fe527[_0x5ba1('0x3b')]?getSeconds(_0x4fe527[_0x5ba1('0x39')],_0x4fe527[_0x5ba1('0x3b')]):0x0;};exports['isFailure']=function(_0x59d815){return _0x59d815===_0x5ba1('0x3c');};exports[_0x5ba1('0x3d')]=function(_0x3f8050,_0x25d389,_0x4cfc3b,_0x3e629e,_0x2833f6){var _0x3ebec3=_0x3e629e?_0x5ba1('0x3e'):_0x3f8050[_0x5ba1('0x17')];_0x3ebec3=_0x2833f6?'BOOKED':_0x3ebec3;return{'actionid':_0x3f8050[_0x5ba1('0x3f')],'action':'originate','channel':_0x3f8050['channelAgent'],'callerid':util[_0x5ba1('0x11')]('\x22%s\x22\x20<%s>',_0x3ebec3,_0x3f8050[_0x5ba1('0x18')]),'Exten':'xcally-motion-preview','Context':_0x5ba1('0x40'),'Priority':'1','variable':_0x4cfc3b,'timeout':(_0x25d389[_0x5ba1('0x41')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3f8050[_0x5ba1('0x3f')]};};exports['totalGlobal']=function(_0x4d6c24){return _0x4d6c24[_0x5ba1('0x42')]+_0x4d6c24[_0x5ba1('0x43')]+_0x4d6c24[_0x5ba1('0x44')]+_0x4d6c24[_0x5ba1('0x45')]+_0x4d6c24['countnosuchnumberretry'];};exports[_0x5ba1('0x46')]=function(_0x17a412){var _0x2501db=_['clone'](_0x17a412);_0x2501db['state']=0xf;_0x2501db[_0x5ba1('0x35')]=_0x5ba1('0x47');return _0x2501db;};exports[_0x5ba1('0x48')]=function(_0x1805f1,_0x42399f,_0x1b8927){var _0x4b103e={};_0x4b103e[_0x42399f]=_0x1805f1[_0x42399f];_0x4b103e[_0x5ba1('0x49')]=![];_0x4b103e[_0x5ba1('0x4a')]=moment()['add'](_0x1b8927,_0x5ba1('0x4b'))['format'](_0x5ba1('0x2f'));_0x4b103e[_0x5ba1('0x19')]=_0x1805f1[_0x5ba1('0x19')];_0x4b103e[_0x5ba1('0x4c')]=_0x1805f1[_0x5ba1('0x4c')];_0x4b103e[_0x5ba1('0x4d')]=_0x1805f1[_0x5ba1('0x4d')]||undefined;return _0x4b103e;};exports[_0x5ba1('0x4e')]=function(_0xf313cf,_0x31f3c3){if(!_[_0x5ba1('0x14')](_0xf313cf)){if(_0xf313cf[_0x5ba1('0x4f')]>0x0){_0xf313cf[_0x5ba1('0x4f')]-=0x1;}else{logger['error'](_0x31f3c3,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x31f3c3,_0x5ba1('0x50'));}};exports[_0x5ba1('0x51')]=function(_0x178b97){if(_0x178b97<=0x0){return!![];}return![];};exports[_0x5ba1('0x52')]=function(_0xf84c6d,_0x1aea2d,_0x5f4e37){_0xf84c6d[_0x5ba1('0x53')]=_0x1aea2d;_0xf84c6d[_0x5ba1('0x54')]=_0xf84c6d[_0x5ba1('0x55')];_0xf84c6d[_0x5ba1('0x56')]=_0xf84c6d[_0x5ba1('0x57')];_0xf84c6d['motionChannel']=_0x5ba1('0x58');if(_0x5f4e37){_0xf84c6d[_0x5ba1('0x59')]=_0x5f4e37['mandatoryDisposition'];}return _0xf84c6d;};exports[_0x5ba1('0x5a')]=function(_0x534d61){var _0x228688={};_0x228688[_0x5ba1('0x55')]=_0x534d61[_0x5ba1('0x55')];_0x228688[_0x5ba1('0x56')]=_0x534d61[_0x5ba1('0x57')];_0x228688[_0x5ba1('0x3f')]=_0x534d61[_0x5ba1('0x3f')];return _0x228688;};exports[_0x5ba1('0x5b')]=function(_0x500c80){var _0x3ae307=[];for(var _0x5db432 in _0x500c80){if(_0x500c80['hasOwnProperty'](_0x5db432)){if(!_[_0x5ba1('0x14')](_0x500c80[_0x5db432])&&_0x500c80[_0x5db432][_0x5ba1('0x30')]===_0x5ba1('0x5c')&&_0x500c80[_0x5db432][_0x5ba1('0x5d')]===_0x5ba1('0x5e')){_0x3ae307[_0x5ba1('0x5f')](_0x500c80[_0x5db432]['id']);}}}return _0x3ae307;};exports[_0x5ba1('0x60')]=function(_0x5e202b){var _0x550a37=moment()[_0x5ba1('0x6')](0x0);var _0x5f5a6e=moment(_0x5e202b)['milliseconds'](0x0);return _0x550a37[_0x5ba1('0x61')](_0x5f5a6e,'seconds');};exports[_0x5ba1('0x62')]=function(_0x3a00fe){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3a00fe['ContactId'],'ListId':_0x3a00fe['ListId'],'VoiceQueueId':_0x3a00fe[_0x5ba1('0x4d')]||undefined,'CampaignId':_0x3a00fe[_0x5ba1('0x63')]||undefined};};exports[_0x5ba1('0x64')]=function(_0x3ca9e0){if(_0x3ca9e0===_0x5ba1('0x3f')||_0x3ca9e0==='idContact'||_0x3ca9e0===_0x5ba1('0x55')||_0x3ca9e0===_0x5ba1('0x65')||_0x3ca9e0==='campaigntype'||_0x3ca9e0===_0x5ba1('0x66')||_0x3ca9e0===_0x5ba1('0x67')||_0x3ca9e0===_0x5ba1('0x57')||_0x3ca9e0===_0x5ba1('0x17')||_0x3ca9e0===_0x5ba1('0x49')||_0x3ca9e0===_0x5ba1('0x18')||_0x3ca9e0===_0x5ba1('0x4a')||_0x3ca9e0===_0x5ba1('0x42')||_0x3ca9e0===_0x5ba1('0x43')||_0x3ca9e0==='countnoanswerretry'||_0x3ca9e0===_0x5ba1('0x68')||_0x3ca9e0===_0x5ba1('0x69')||_0x3ca9e0===_0x5ba1('0x6a')||_0x3ca9e0===_0x5ba1('0x6b')||_0x3ca9e0===_0x5ba1('0x6c')||_0x3ca9e0===_0x5ba1('0x19')||_0x3ca9e0==='ListId'||_0x3ca9e0===_0x5ba1('0x6d')||_0x3ca9e0===_0x5ba1('0x4d')||_0x3ca9e0===_0x5ba1('0x6e')||_0x3ca9e0===_0x5ba1('0x6f')||_0x3ca9e0===_0x5ba1('0x70')||_0x3ca9e0===_0x5ba1('0x71')||_0x3ca9e0===_0x5ba1('0x72')||_0x3ca9e0==='xmd-dialurl'||_0x3ca9e0==='xmd-dialtimeout'||_0x3ca9e0===_0x5ba1('0x73')||_0x3ca9e0==='xmd-dialid'||_0x3ca9e0===_0x5ba1('0x74')||_0x3ca9e0==='xmd-contactid'||_0x3ca9e0===_0x5ba1('0x75')||_0x3ca9e0===_0x5ba1('0x76')||_0x3ca9e0==='xmd-agiafter'||_0x3ca9e0===_0x5ba1('0x77')||_0x3ca9e0===_0x5ba1('0x78')||_0x3ca9e0===_0x5ba1('0x79')||_0x3ca9e0===_0x5ba1('0x7a')||_0x3ca9e0==='rtpaudioqosjitterbridged'||_0x3ca9e0==='rtpaudioqosloss'||_0x3ca9e0===_0x5ba1('0x7b')||_0x3ca9e0===_0x5ba1('0x7c')||_0x3ca9e0===_0x5ba1('0x7d')||_0x3ca9e0===_0x5ba1('0x78')||_0x3ca9e0===_0x5ba1('0x79')||_0x3ca9e0===_0x5ba1('0x7a')||_0x3ca9e0===_0x5ba1('0x7e')||_0x3ca9e0==='rtpaudioqosloss'||_0x3ca9e0===_0x5ba1('0x7b')||_0x3ca9e0===_0x5ba1('0x7c')||_0x3ca9e0===_0x5ba1('0x7d')||_0x3ca9e0===_0x5ba1('0x7f')||_0x3ca9e0===_0x5ba1('0x80')||_0x3ca9e0===_0x5ba1('0x30')||_0x3ca9e0===_0x5ba1('0x35')){return![];}return!![];};exports[_0x5ba1('0x81')]=function(_0x248515,_0x4e9ab1){var _0x26e666,_0x52645c,_0xa0ee68;if(_0x4e9ab1<=0x0){_0x4e9ab1=0x1;}_0x26e666=new RegExp('\x5cw{0,'+_0x4e9ab1+'}$');_0x52645c=Math[_0x5ba1('0x82')](0xa,_0x4e9ab1-0x1);_0xa0ee68=Math[_0x5ba1('0x82')](0xa,_0x4e9ab1)-0x1;return util[_0x5ba1('0x11')]('%s',_[_0x5ba1('0x83')](_0x248515,_0x26e666,_['random'](_0x52645c,_0xa0ee68)));};exports['extractCalleridName']=function(_0x4d5735){var _0x2f8174=_0x4d5735['match'](/"(.*?)"/);return _0x2f8174?_0x2f8174[0x1]:_0x4d5735;};exports[_0x5ba1('0x84')]=function(_0x551300){var _0x24d8c7=_0x551300[_0x5ba1('0x85')](/<(.*?)>/);return _0x24d8c7?_0x24d8c7[0x1]:_0x551300;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 63491c0..5f61630 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 _0x9700=['queueadd','string','number','boolean','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup'];(function(_0x36d981,_0x11310a){var _0x23a592=function(_0x367057){while(--_0x367057){_0x36d981['push'](_0x36d981['shift']());}};_0x23a592(++_0x11310a);}(_0x9700,0x1d8));var _0x0970=function(_0x1c6bfa,_0x5cf919){_0x1c6bfa=_0x1c6bfa-0x0;var _0x38852a=_0x9700[_0x1c6bfa];return _0x38852a;};'use strict';exports[_0x0970('0x0')]={'queue':{'type':_0x0970('0x1'),'required':!![]},'interface':{'type':_0x0970('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x0970('0x2'),'required':![]},'paused':{'type':_0x0970('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x0970('0x1'),'required':!![]},'interface':{'type':_0x0970('0x1'),'required':!![]}};exports[_0x0970('0x4')]={'interface':{'type':_0x0970('0x1'),'required':!![]},'paused':{'type':_0x0970('0x3')},'reason':{'type':_0x0970('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x0970('0x1'),'required':![]}};exports[_0x0970('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0970('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x0970('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0970('0x1')}};exports[_0x0970('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x0970('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x46a8=['voicequeuechannelhangup','voicequeuechannelredirect','string','number','queuepause','boolean','reload','voicequeuechannel','voicechannel'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x46a8,0x185));var _0x846a=function(_0x28f733,_0x55a21a){_0x28f733=_0x28f733-0x0;var _0x656a86=_0x46a8[_0x28f733];return _0x656a86;};'use strict';exports['queueadd']={'queue':{'type':_0x846a('0x0'),'required':!![]},'interface':{'type':_0x846a('0x0'),'required':!![]},'membername':{'type':_0x846a('0x0'),'required':!![]},'penalty':{'type':_0x846a('0x1'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0x846a('0x0'),'required':!![]},'interface':{'type':_0x846a('0x0'),'required':!![]}};exports[_0x846a('0x2')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x846a('0x3')},'reason':{'type':_0x846a('0x0'),'required':![]}};exports[_0x846a('0x4')]={'module':{'type':_0x846a('0x0'),'required':![]}};exports[_0x846a('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x846a('0x6')]={'uniqueid':{'type':_0x846a('0x0'),'required':!![]},'filename':{'type':_0x846a('0x0')},'format':{'type':_0x846a('0x0')},'mixmonitorid':{'type':_0x846a('0x0')}};exports[_0x846a('0x7')]={'uniqueid':{'type':_0x846a('0x0'),'required':!![]}};exports[_0x846a('0x8')]={'uniqueid':{'type':_0x846a('0x0'),'required':!![]},'exten':{'type':_0x846a('0x0'),'required':!![]},'context':{'type':_0x846a('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 176ec35..b369875 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 _0x82a9=['initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','salesforceAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','abandoned','sumHoldTime','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','agents','length','mergeFromDatabase','initTelephones','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initServicenowAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x82a9,0x168));var _0x982a=function(_0x77f82d,_0x436fa0){_0x77f82d=_0x77f82d-0x0;var _0x16fbd1=_0x82a9[_0x77f82d];return _0x16fbd1;};'use strict';var BPromise=require('bluebird');var util=require(_0x982a('0x0'));var _=require(_0x982a('0x1'));var moment=require(_0x982a('0x2'));var Agent=require(_0x982a('0x3'));var Telephone=require(_0x982a('0x4'));var Trunk=require(_0x982a('0x5'));var VoiceQueue=require(_0x982a('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x982a('0x7'));var Campaign=require(_0x982a('0x8'));var VoiceExtension=require(_0x982a('0x9'));var ZendeskAccount=require(_0x982a('0xa'));var SalesforceAccount=require(_0x982a('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x982a('0xc'));var ZohoAccount=require(_0x982a('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x982a('0xe'));var ServicenowAccount=require(_0x982a('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x982a('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x982a('0x11')]={};this['trunks']={};this[_0x982a('0x12')]={};this[_0x982a('0x13')]={};this['campaigns']={};this[_0x982a('0x14')]={};this[_0x982a('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x982a('0x16')]={};this[_0x982a('0x17')]={};this['queueChannels']={};this[_0x982a('0x18')]={};this[_0x982a('0x19')]={};this[_0x982a('0x1a')]={};this['zendeskAccounts']={};this[_0x982a('0x1b')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x982a('0x1c')]={};this[_0x982a('0x1d')]={};this[_0x982a('0x1e')]={};this[_0x982a('0x1f')]={};this[_0x982a('0x20')]={};this[_0x982a('0x21')]={};};function freeIsNotKey(_0x4f1639,_0x15532e,_0x17bddb){var _0x32b7f9=_[_0x982a('0x22')](_0x4f1639,function(_0x2125db,_0x4af4fa){return _0x2125db[_0x17bddb];});for(var _0x4fab65 in _0x15532e){if(_0x15532e['hasOwnProperty'](_0x4fab65)){if(!_0x32b7f9[_0x4fab65]){delete _0x15532e[_0x4fab65];}}}}function freeIsNotKeySip(_0x426388,_0x205b98){var _0x2e2596=_[_0x982a('0x22')](_0x426388,function(_0x30e487,_0x400c72){return util[_0x982a('0x23')](_0x982a('0x24'),_0x30e487[_0x982a('0x25')]);});for(var _0x3b8423 in _0x205b98){if(_0x205b98[_0x982a('0x26')](_0x3b8423)){if(!_0x2e2596[_0x3b8423]){delete _0x205b98[_0x3b8423];}}}}function freeIsNotKeyAgent(_0x3cf9da,_0x1c0382){var _0x3736fd=_['mapKeys'](_0x3cf9da,function(_0x4cde21,_0x3a7644){var _0x4d49b4=_[_0x982a('0x27')](_0x4cde21[_0x982a('0x28')])?util['format']('SIP/%s',_0x4cde21[_0x982a('0x25')]):_0x4cde21[_0x982a('0x28')];return _0x4d49b4;});for(var _0x2894a5 in _0x1c0382){if(_0x1c0382[_0x982a('0x26')](_0x2894a5)){if(!_0x3736fd[_0x2894a5]){delete _0x1c0382[_0x2894a5];}}}}function clearVoiceCallReports(_0x4d16a8){_0x4d16a8[_0x982a('0x29')]=0x0;_0x4d16a8['answered']=0x0;_0x4d16a8['sumHoldTime']=0x0;_0x4d16a8[_0x982a('0x2a')]=0x0;_0x4d16a8['sumBillable']=0x0;}function clearCampaigns(_0x3fa498){if(!_[_0x982a('0x2b')](_0x3fa498)){for(var _0x2fbd95 in _0x3fa498){if(_0x3fa498[_0x982a('0x26')](_0x2fbd95)){_0x3fa498[_0x2fbd95][_0x982a('0x2c')]=0x0;_0x3fa498[_0x2fbd95][_0x982a('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x1a8690){if(!_['isEmpty'](_0x1a8690)){for(var _0x17f547 in _0x1a8690){if(_0x1a8690[_0x982a('0x26')](_0x17f547)){_0x1a8690[_0x17f547]['total']=0x0;_0x1a8690[_0x17f547][_0x982a('0x2e')]=0x0;_0x1a8690[_0x17f547]['unmanaged']=0x0;_0x1a8690[_0x17f547][_0x982a('0x2f')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x30')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x2a')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x31')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x32')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x33')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x34')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x35')]=0x0;_0x1a8690[_0x17f547]['outboundNoSuchCallsDay']=0x0;_0x1a8690[_0x17f547][_0x982a('0x36')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x37')]=0x0;_0x1a8690[_0x17f547][_0x982a('0x38')]=0x0;_0x1a8690[_0x17f547]['outboundBlacklistCallsDay']=0x0;_0x1a8690[_0x17f547][_0x982a('0x39')]=0x0;_0x1a8690[_0x17f547]['outboundRejectCallsDay']=0x0;_0x1a8690[_0x17f547][_0x982a('0x3a')]=0x0;_0x1a8690[_0x17f547]['outboundAnswerAgiCallsDay']=0x0;_0x1a8690[_0x17f547][_0x982a('0x3b')]=0x0;_0x1a8690[_0x17f547]['queueStatusComplete']=!![];}}}}Realtime[_0x982a('0x3c')]['mergeFromDatabase']=function(_0x53627d,_0x455eb0){for(var _0x381778 in _0x455eb0){if(_0x53627d['hasOwnProperty'](_0x381778)){_0x53627d[_0x381778]=_0x455eb0[_0x381778];}}};Realtime[_0x982a('0x3c')]['initAgents']=function(){var _0x37d1df=this;return function(_0x89b36d){if(_0x89b36d){freeIsNotKeyAgent(_0x89b36d,_0x37d1df[_0x982a('0x3d')]);for(var _0x249271=0x0,_0x5cc189={},_0x3d7fc3={};_0x249271<_0x89b36d[_0x982a('0x3e')];_0x249271+=0x1){_0x5cc189=_0x89b36d[_0x249271];var _0x1a0412=_[_0x982a('0x27')](_0x5cc189[_0x982a('0x28')])?util[_0x982a('0x23')](_0x982a('0x24'),_0x5cc189[_0x982a('0x25')]):_0x5cc189[_0x982a('0x28')];if(_['isUndefined'](_0x37d1df[_0x982a('0x3d')][_0x1a0412])){_0x37d1df[_0x982a('0x3d')][_0x1a0412]=new Agent(_0x5cc189);}else{_0x37d1df[_0x982a('0x3f')](_0x37d1df[_0x982a('0x3d')][_0x1a0412],_0x5cc189);}}}return _0x37d1df['agents'];};};Realtime['prototype'][_0x982a('0x40')]=function(){var _0x24cd0e=this;return function(_0x341afa){if(_0x341afa){freeIsNotKeySip(_0x341afa,_0x24cd0e[_0x982a('0x11')]);for(var _0x353753=0x0,_0x4e7574={},_0xfb5e7f={};_0x353753<_0x341afa[_0x982a('0x3e')];_0x353753+=0x1){_0x4e7574=_0x341afa[_0x353753];if(_[_0x982a('0x41')](_0x24cd0e[_0x982a('0x11')][util['format'](_0x982a('0x24'),_0x4e7574[_0x982a('0x25')])])){_0x24cd0e[_0x982a('0x11')][util[_0x982a('0x23')]('SIP/%s',_0x4e7574['name'])]=new Telephone(_0x4e7574);}else{_0x24cd0e[_0x982a('0x3f')](_0x24cd0e[_0x982a('0x11')][util[_0x982a('0x23')](_0x982a('0x24'),_0x4e7574[_0x982a('0x25')])],_0x4e7574);}}}return _0x24cd0e['telephones'];};};Realtime[_0x982a('0x3c')][_0x982a('0x42')]=function(){var _0x5e2ac7=this;return function(_0x379faf){if(_0x379faf){freeIsNotKeySip(_0x379faf,_0x5e2ac7[_0x982a('0x43')]);for(var _0x57fa79=0x0,_0x5dc6dd={},_0x4b5b41={};_0x57fa79<_0x379faf[_0x982a('0x3e')];_0x57fa79+=0x1){_0x5dc6dd=_0x379faf[_0x57fa79];if(_[_0x982a('0x41')](_0x5e2ac7['trunks'][util['format']('SIP/%s',_0x5dc6dd[_0x982a('0x25')])])){_0x5e2ac7['trunks'][util['format'](_0x982a('0x24'),_0x5dc6dd[_0x982a('0x25')])]=new Trunk(_0x5dc6dd);}else{_0x5e2ac7[_0x982a('0x3f')](_0x5e2ac7[_0x982a('0x43')][util[_0x982a('0x23')]('SIP/%s',_0x5dc6dd[_0x982a('0x25')])],_0x5dc6dd);}}}return _0x5e2ac7['trunks'];};};Realtime[_0x982a('0x3c')][_0x982a('0x44')]=function(){var _0x204493=this;return function(_0x2e07b9){if(_0x2e07b9){freeIsNotKey(_0x2e07b9,_0x204493[_0x982a('0x12')],_0x982a('0x25'));for(var _0x12414a=0x0,_0x3bf060={},_0x1860d4={};_0x12414a<_0x2e07b9['length'];_0x12414a+=0x1){_0x3bf060=_0x2e07b9[_0x12414a];if(_[_0x982a('0x41')](_0x204493[_0x982a('0x12')][_0x3bf060[_0x982a('0x25')]])){_0x204493[_0x982a('0x12')][_0x3bf060[_0x982a('0x25')]]=new VoiceQueue(_0x3bf060);}else{_0x204493[_0x982a('0x3f')](_0x204493[_0x982a('0x12')][_0x3bf060[_0x982a('0x25')]],_0x3bf060);}}}return _0x204493[_0x982a('0x12')];};};Realtime[_0x982a('0x3c')][_0x982a('0x45')]=function(){var _0xe80546=this;return function(_0x2e19de){if(_0x2e19de){freeIsNotKey(_0x2e19de,_0xe80546[_0x982a('0x13')],'id');for(var _0x4435a5=0x0,_0x441b5a={},_0x4701d8={};_0x4435a5<_0x2e19de[_0x982a('0x3e')];_0x4435a5+=0x1){_0x441b5a=_0x2e19de[_0x4435a5];if(_[_0x982a('0x41')](_0xe80546[_0x982a('0x13')][_0x441b5a['id']])){_0xe80546[_0x982a('0x13')][_0x441b5a['id']]=new Trigger(_0x441b5a);}else{_0xe80546[_0x982a('0x3f')](_0xe80546[_0x982a('0x13')][_0x441b5a['id']],_0x441b5a);}}}return _0xe80546[_0x982a('0x13')];};};Realtime[_0x982a('0x3c')][_0x982a('0x46')]=function(){var _0x1faa32=this;return function(_0x35642f){if(_0x35642f){freeIsNotKey(_0x35642f,_0x1faa32['templates'],'id');for(var _0xdf731e=0x0,_0x27453a={},_0x4d13d7={};_0xdf731e<_0x35642f[_0x982a('0x3e')];_0xdf731e+=0x1){_0x27453a=_0x35642f[_0xdf731e];if(_[_0x982a('0x41')](_0x1faa32[_0x982a('0x14')][_0x27453a['id']])){_0x1faa32['templates'][_0x27453a['id']]=new Template(_0x27453a);}else{_0x1faa32['mergeFromDatabase'](_0x1faa32['templates'][_0x27453a['id']],_0x27453a);}}}return _0x1faa32[_0x982a('0x14')];};};Realtime[_0x982a('0x3c')]['initZendeskAccounts']=function(){var _0x18ffc9=this;return function(_0x2b7391){if(_0x2b7391){freeIsNotKey(_0x2b7391,_0x18ffc9[_0x982a('0x47')],'id');for(var _0x2f873c=0x0,_0x25e3c6={},_0x1aa35a={};_0x2f873c<_0x2b7391['length'];_0x2f873c+=0x1){_0x25e3c6=_0x2b7391[_0x2f873c];if(_[_0x982a('0x41')](_0x18ffc9[_0x982a('0x47')][_0x25e3c6['id']])){_0x18ffc9['zendeskAccounts'][_0x25e3c6['id']]=new ZendeskAccount(_0x25e3c6);}else{_0x18ffc9[_0x982a('0x3f')](_0x18ffc9[_0x982a('0x47')][_0x25e3c6['id']],_0x25e3c6);}}}return _0x18ffc9['zendeskAccounts'];};};Realtime[_0x982a('0x3c')][_0x982a('0x48')]=function(){var _0x32c6c4=this;return function(_0x433224){if(_0x433224){freeIsNotKey(_0x433224,_0x32c6c4[_0x982a('0x1b')],'id');for(var _0x76163e=0x0,_0x56e06c={},_0x34220e={};_0x76163e<_0x433224[_0x982a('0x3e')];_0x76163e+=0x1){_0x56e06c=_0x433224[_0x76163e];if(_[_0x982a('0x41')](_0x32c6c4[_0x982a('0x1b')][_0x56e06c['id']])){_0x32c6c4[_0x982a('0x1b')][_0x56e06c['id']]=new SalesforceAccount(_0x56e06c);}else{_0x32c6c4[_0x982a('0x3f')](_0x32c6c4['salesforceAccounts'][_0x56e06c['id']],_0x56e06c);}}}return _0x32c6c4[_0x982a('0x1b')];};};Realtime[_0x982a('0x3c')][_0x982a('0x49')]=function(){var _0xc54714=this;return function(_0x5f2835){if(_0x5f2835){freeIsNotKey(_0x5f2835,_0xc54714[_0x982a('0x4a')],'id');for(var _0x2c617b=0x0,_0x4cffe5={},_0x155a17={};_0x2c617b<_0x5f2835[_0x982a('0x3e')];_0x2c617b+=0x1){_0x4cffe5=_0x5f2835[_0x2c617b];if(_[_0x982a('0x41')](_0xc54714['freshdeskAccounts'][_0x4cffe5['id']])){_0xc54714[_0x982a('0x4a')][_0x4cffe5['id']]=new FreshdeskAccount(_0x4cffe5);}else{_0xc54714['mergeFromDatabase'](_0xc54714[_0x982a('0x4a')][_0x4cffe5['id']],_0x4cffe5);}}}return _0xc54714[_0x982a('0x4a')];};};Realtime[_0x982a('0x3c')]['initZohoAccounts']=function(){var _0x3601d3=this;return function(_0x2d8e7a){if(_0x2d8e7a){freeIsNotKey(_0x2d8e7a,_0x3601d3['zohoAccounts'],'id');for(var _0x32a8ab=0x0,_0x53eb9d={},_0xad3c95={};_0x32a8ab<_0x2d8e7a['length'];_0x32a8ab+=0x1){_0x53eb9d=_0x2d8e7a[_0x32a8ab];if(_[_0x982a('0x41')](_0x3601d3[_0x982a('0x4b')][_0x53eb9d['id']])){_0x3601d3[_0x982a('0x4b')][_0x53eb9d['id']]=new ZohoAccount(_0x53eb9d);}else{_0x3601d3['mergeFromDatabase'](_0x3601d3[_0x982a('0x4b')][_0x53eb9d['id']],_0x53eb9d);}}}return _0x3601d3[_0x982a('0x4b')];};};Realtime[_0x982a('0x3c')][_0x982a('0x4c')]=function(){var _0x1848f4=this;return function(_0x27e8f8){if(_0x27e8f8){freeIsNotKey(_0x27e8f8,_0x1848f4[_0x982a('0x1c')],'id');for(var _0x51d684=0x0,_0x3fd5af={},_0x49403b={};_0x51d684<_0x27e8f8['length'];_0x51d684+=0x1){_0x3fd5af=_0x27e8f8[_0x51d684];if(_[_0x982a('0x41')](_0x1848f4[_0x982a('0x1c')][_0x3fd5af['id']])){_0x1848f4[_0x982a('0x1c')][_0x3fd5af['id']]=new DeskAccount(_0x3fd5af);}else{_0x1848f4['mergeFromDatabase'](_0x1848f4[_0x982a('0x1c')][_0x3fd5af['id']],_0x3fd5af);}}}return _0x1848f4[_0x982a('0x1c')];};};Realtime[_0x982a('0x3c')][_0x982a('0x4d')]=function(){var _0x345299=this;return function(_0x25124c){if(_0x25124c){freeIsNotKey(_0x25124c,_0x345299['sugarcrmAccounts'],'id');for(var _0x92ec8a=0x0,_0x309047={},_0x192020={};_0x92ec8a<_0x25124c[_0x982a('0x3e')];_0x92ec8a+=0x1){_0x309047=_0x25124c[_0x92ec8a];if(_[_0x982a('0x41')](_0x345299[_0x982a('0x4e')][_0x309047['id']])){_0x345299[_0x982a('0x4e')][_0x309047['id']]=new SugarcrmAccount(_0x309047);}else{_0x345299[_0x982a('0x3f')](_0x345299[_0x982a('0x4e')][_0x309047['id']],_0x309047);}}}return _0x345299[_0x982a('0x4e')];};};Realtime[_0x982a('0x3c')]['initVtigerAccounts']=function(){var _0x36a737=this;return function(_0x7e5f1a){if(_0x7e5f1a){freeIsNotKey(_0x7e5f1a,_0x36a737['vtigerAccounts'],'id');for(var _0x76a953=0x0,_0x5b82b4={},_0x2038c3={};_0x76a953<_0x7e5f1a[_0x982a('0x3e')];_0x76a953+=0x1){_0x5b82b4=_0x7e5f1a[_0x76a953];if(_[_0x982a('0x41')](_0x36a737[_0x982a('0x1d')][_0x5b82b4['id']])){_0x36a737[_0x982a('0x1d')][_0x5b82b4['id']]=new VtigerAccount(_0x5b82b4);}else{_0x36a737[_0x982a('0x3f')](_0x36a737[_0x982a('0x1d')][_0x5b82b4['id']],_0x5b82b4);}}}return _0x36a737[_0x982a('0x1d')];};};Realtime[_0x982a('0x3c')][_0x982a('0x4f')]=function(){var _0xf20899=this;return function(_0x5d02dc){if(_0x5d02dc){freeIsNotKey(_0x5d02dc,_0xf20899[_0x982a('0x1e')],'id');for(var _0x99a641=0x0,_0x19b796={},_0x201a09={};_0x99a641<_0x5d02dc['length'];_0x99a641+=0x1){_0x19b796=_0x5d02dc[_0x99a641];if(_[_0x982a('0x41')](_0xf20899[_0x982a('0x1e')][_0x19b796['id']])){_0xf20899[_0x982a('0x1e')][_0x19b796['id']]=new ServicenowAccount(_0x19b796);}else{_0xf20899['mergeFromDatabase'](_0xf20899[_0x982a('0x1e')][_0x19b796['id']],_0x19b796);}}}return _0xf20899[_0x982a('0x1e')];};};Realtime[_0x982a('0x3c')][_0x982a('0x50')]=function(){var _0x25b3df=this;return function(_0x52f160){if(_0x52f160){freeIsNotKey(_0x52f160,_0x25b3df[_0x982a('0x1f')],'id');for(var _0x311b85=0x0,_0x6c5f1d={},_0x23bd63={};_0x311b85<_0x52f160['length'];_0x311b85+=0x1){_0x6c5f1d=_0x52f160[_0x311b85];if(_['isUndefined'](_0x25b3df['dynamics365Accounts'][_0x6c5f1d['id']])){_0x25b3df[_0x982a('0x1f')][_0x6c5f1d['id']]=new Dynamics365Account(_0x6c5f1d);}else{_0x25b3df['mergeFromDatabase'](_0x25b3df['dynamics365Accounts'][_0x6c5f1d['id']],_0x6c5f1d);}}}return _0x25b3df['dynamics365Accounts'];};};Realtime[_0x982a('0x3c')][_0x982a('0x51')]=function(){var _0x4e310a=this;return function(_0x35cebb){if(_0x35cebb){freeIsNotKey(_0x35cebb,_0x4e310a[_0x982a('0x20')],'id');for(var _0x2ef8cd=0x0,_0x21c07c={},_0x323fd0={};_0x2ef8cd<_0x35cebb['length'];_0x2ef8cd+=0x1){_0x21c07c=_0x35cebb[_0x2ef8cd];if(_[_0x982a('0x41')](_0x4e310a[_0x982a('0x20')][_0x21c07c['id']])){_0x4e310a[_0x982a('0x20')][_0x21c07c['id']]=new FreshsalesAccount(_0x21c07c);}else{_0x4e310a[_0x982a('0x3f')](_0x4e310a['freshsalesAccounts'][_0x21c07c['id']],_0x21c07c);}}}return _0x4e310a[_0x982a('0x20')];};};Realtime[_0x982a('0x3c')][_0x982a('0x52')]=function(){var _0x45fe53=this;return function(_0x31ae9a){for(var _0x56598e=0x0;_0x56598e<_0x31ae9a[_0x982a('0x3e')];_0x56598e+=0x1){_[_0x982a('0x53')](_0x45fe53[_0x982a('0x12')][_0x31ae9a[_0x56598e][_0x982a('0x25')]],_0x31ae9a[_0x56598e]);}return _0x45fe53[_0x982a('0x12')];};};Realtime[_0x982a('0x3c')][_0x982a('0x54')]=function(){var _0x50ab0d=this;return function(_0x412efa){clearVoiceQueues(_0x50ab0d[_0x982a('0x12')]);if(_0x412efa){_0x412efa=_[_0x982a('0x55')](_0x412efa,_0x982a('0x56'));for(var _0x208cde in _0x412efa){if(_0x412efa[_0x982a('0x26')](_0x208cde)){var _0xceb3be={};for(var _0x37dbe1=0x0;_0x37dbe1<_0x412efa[_0x208cde][_0x982a('0x3e')];_0x37dbe1+=0x1){var _0x1418ae=_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x57')];if(_0x50ab0d[_0x982a('0x12')][_0x1418ae]){if(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x58')]){_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x59')]+=0x1;}if(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x5a')]){_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x2f')]+=0x1;}_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x30')]+=moment(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x5b')])[_0x982a('0x5c')](moment(_0x412efa[_0x208cde][_0x37dbe1]['queuecallerjoinAt']),_0x982a('0x5d'))||0x0;if(_0x37dbe1===_0x412efa[_0x208cde][_0x982a('0x3e')]-0x1){_0x50ab0d[_0x982a('0x12')][_0x1418ae]['sumDuration']+=moment(_0x412efa[_0x208cde][_0x37dbe1]['queuecallercompleteAt']||_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x5e')]||_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x5f')])[_0x982a('0x5c')](moment(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x60')]),_0x982a('0x5d'))||0x0;_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x29')]+=0x1;if(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x61')]){_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x2e')]+=0x1;_0x50ab0d[_0x982a('0x12')][_0x1418ae]['sumBillable']+=moment(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x62')])[_0x982a('0x5c')](moment(_0x412efa[_0x208cde][_0x37dbe1][_0x982a('0x5b')]),'seconds')||0x0;}}else{_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x2a')]+=_0x50ab0d[_0x982a('0x12')][_0x1418ae][_0x982a('0x30')]||0x0;}}}}}}return _0x50ab0d[_0x982a('0x12')];};};Realtime[_0x982a('0x3c')][_0x982a('0x63')]=function(){var _0x389eb7=this;return function(_0x589210){clearVoiceCallReports(_0x389eb7[_0x982a('0x15')]);if(_0x589210){for(var _0x135d55=0x0;_0x135d55<_0x589210['length'];_0x135d55+=0x1){_0x389eb7[_0x982a('0x15')][_0x982a('0x29')]+=0x1;_0x389eb7[_0x982a('0x15')][_0x982a('0x2a')]+=_0x589210[_0x135d55][_0x982a('0x64')];if(_0x589210[_0x135d55][_0x982a('0x65')]===_0x982a('0x66')){_0x389eb7['outbound'][_0x982a('0x2e')]+=0x1;_0x389eb7[_0x982a('0x15')][_0x982a('0x30')]+=_0x589210[_0x135d55][_0x982a('0x64')]-_0x589210[_0x135d55][_0x982a('0x67')]||0x0;_0x389eb7[_0x982a('0x15')][_0x982a('0x31')]+=_0x589210[_0x135d55][_0x982a('0x67')];}}}return _0x389eb7[_0x982a('0x15')];};};Realtime[_0x982a('0x3c')][_0x982a('0x68')]=function(){var _0x474b13=this;return function(_0x4673b8){if(_0x4673b8){freeIsNotKey(_0x4673b8,_0x474b13[_0x982a('0x69')],_0x982a('0x25'));for(var _0x764525=0x0,_0x3146c8={};_0x764525<_0x4673b8[_0x982a('0x3e')];_0x764525+=0x1){_0x3146c8=_0x4673b8[_0x764525];if(_['isUndefined'](_0x474b13[_0x982a('0x69')][_0x3146c8[_0x982a('0x25')]])){_0x474b13[_0x982a('0x69')][_0x3146c8[_0x982a('0x25')]]=new Campaign(_0x3146c8);}else{_0x474b13['mergeFromDatabase'](_0x474b13['campaigns'][_0x3146c8[_0x982a('0x25')]],_0x3146c8);_0x474b13[_0x982a('0x69')][_0x3146c8[_0x982a('0x25')]][_0x982a('0x6a')]=_0x3146c8[_0x982a('0x6b')]?_0x3146c8[_0x982a('0x6b')]['name']:undefined;}}}return _0x474b13['campaigns'];};};Realtime[_0x982a('0x3c')][_0x982a('0x6c')]=function(){var _0x483805=this;return function(_0x48087f){if(_0x48087f){freeIsNotKey(_0x48087f,_0x483805[_0x982a('0x16')],'id');for(var _0x5ed33a=0x0,_0x49d839={};_0x5ed33a<_0x48087f[_0x982a('0x3e')];_0x5ed33a+=0x1){_0x49d839=_0x48087f[_0x5ed33a];if(_[_0x982a('0x41')](_0x483805[_0x982a('0x16')][_0x49d839['id']])){_0x483805[_0x982a('0x16')][_0x49d839['id']]=new VoiceExtension(_0x49d839);}else{_0x483805['mergeFromDatabase'](_0x483805[_0x982a('0x16')][_0x49d839['id']],_0x49d839);}}}return _0x483805[_0x982a('0x16')];};};Realtime[_0x982a('0x3c')]['initCampaignHopperHistory']=function(){var _0x1c25de=this;return function(_0x218782){clearCampaigns(_0x1c25de[_0x982a('0x69')]);for(var _0x488cfc=0x0;_0x488cfc<_0x218782[_0x982a('0x3e')];_0x488cfc+=0x1){_[_0x982a('0x53')](_0x1c25de[_0x982a('0x69')][_0x218782[_0x488cfc][_0x982a('0x25')]],_0x218782[_0x488cfc]);}return _0x1c25de[_0x982a('0x69')];};};Realtime[_0x982a('0x3c')][_0x982a('0x6d')]=function(){var _0x550a82=this;return function(_0x21d5c3){if(_0x21d5c3){freeIsNotKey(_0x21d5c3,_0x550a82[_0x982a('0x21')],'id');for(var _0x57c79a=0x0,_0x201511={},_0x1c7a9a={};_0x57c79a<_0x21d5c3[_0x982a('0x3e')];_0x57c79a+=0x1){_0x201511=_0x21d5c3[_0x57c79a];if(_['isUndefined'](_0x550a82[_0x982a('0x21')][_0x201511['id']])){_0x550a82[_0x982a('0x21')][_0x201511['id']]=new FaxAccount(_0x201511);}else{_0x550a82[_0x982a('0x3f')](_0x550a82[_0x982a('0x21')][_0x201511['id']],_0x201511);}}}return _0x550a82[_0x982a('0x21')];};};module['exports']=Realtime; \ No newline at end of file +var _0x3817=['queuecallerexit','queuecallerabandon','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','lodash','moment','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/salesforceAccount','../model/freshdeskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumDuration','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue'];(function(_0x587ce1,_0x1e331c){var _0x3e5ba4=function(_0x183ac6){while(--_0x183ac6){_0x587ce1['push'](_0x587ce1['shift']());}};_0x3e5ba4(++_0x1e331c);}(_0x3817,0x15b));var _0x7381=function(_0x33e200,_0x4d13ab){_0x33e200=_0x33e200-0x0;var _0xc868bb=_0x3817[_0x33e200];return _0xc868bb;};'use strict';var BPromise=require(_0x7381('0x0'));var util=require('util');var _=require(_0x7381('0x1'));var moment=require(_0x7381('0x2'));var Agent=require('../model/agent');var Telephone=require(_0x7381('0x3'));var Trunk=require(_0x7381('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x7381('0x5'));var Template=require(_0x7381('0x6'));var Campaign=require(_0x7381('0x7'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x7381('0x8'));var FreshdeskAccount=require(_0x7381('0x9'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x7381('0xa'));var FreshsalesAccount=require(_0x7381('0xb'));var FaxAccount=require(_0x7381('0xc'));var Realtime=function(){this[_0x7381('0xd')]={};this[_0x7381('0xe')]={};this[_0x7381('0xf')]={};this[_0x7381('0x10')]={};this[_0x7381('0x11')]={};this[_0x7381('0x12')]={};this[_0x7381('0x13')]={};this[_0x7381('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x7381('0x15')]={};this['channels']={};this[_0x7381('0x16')]={};this[_0x7381('0x17')]={};this['timers']={};this['settings']={};this[_0x7381('0x18')]={};this[_0x7381('0x19')]={};this['sugarcrmAccounts']={};this[_0x7381('0x1a')]={};this[_0x7381('0x1b')]={};this[_0x7381('0x1c')]={};this[_0x7381('0x1d')]={};this[_0x7381('0x1e')]={};this[_0x7381('0x1f')]={};this[_0x7381('0x20')]={};this[_0x7381('0x21')]={};};function freeIsNotKey(_0x1cc361,_0x3af321,_0x1f5f54){var _0x3b285d=_[_0x7381('0x22')](_0x1cc361,function(_0x4ff8c7,_0xe01923){return _0x4ff8c7[_0x1f5f54];});for(var _0x18cec2 in _0x3af321){if(_0x3af321[_0x7381('0x23')](_0x18cec2)){if(!_0x3b285d[_0x18cec2]){delete _0x3af321[_0x18cec2];}}}}function freeIsNotKeySip(_0xd086fb,_0x170ff9){var _0x9bffa1=_['mapKeys'](_0xd086fb,function(_0x19bdef,_0x36d8ec){return util[_0x7381('0x24')](_0x7381('0x25'),_0x19bdef[_0x7381('0x26')]);});for(var _0x3056e6 in _0x170ff9){if(_0x170ff9['hasOwnProperty'](_0x3056e6)){if(!_0x9bffa1[_0x3056e6]){delete _0x170ff9[_0x3056e6];}}}}function freeIsNotKeyAgent(_0x2c0bac,_0x1b6e2c){var _0x1849c0=_[_0x7381('0x22')](_0x2c0bac,function(_0x5a07d4,_0x1acec4){var _0x39c6b8=_[_0x7381('0x27')](_0x5a07d4[_0x7381('0x28')])?util['format'](_0x7381('0x25'),_0x5a07d4[_0x7381('0x26')]):_0x5a07d4[_0x7381('0x28')];return _0x39c6b8;});for(var _0x113d08 in _0x1b6e2c){if(_0x1b6e2c[_0x7381('0x23')](_0x113d08)){if(!_0x1849c0[_0x113d08]){delete _0x1b6e2c[_0x113d08];}}}}function clearVoiceCallReports(_0x985869){_0x985869[_0x7381('0x29')]=0x0;_0x985869['answered']=0x0;_0x985869['sumHoldTime']=0x0;_0x985869[_0x7381('0x2a')]=0x0;_0x985869[_0x7381('0x2b')]=0x0;}function clearCampaigns(_0x18baea){if(!_['isEmpty'](_0x18baea)){for(var _0x305f77 in _0x18baea){if(_0x18baea[_0x7381('0x23')](_0x305f77)){_0x18baea[_0x305f77][_0x7381('0x2c')]=0x0;_0x18baea[_0x305f77][_0x7381('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x2a1327){if(!_[_0x7381('0x2e')](_0x2a1327)){for(var _0x559e1d in _0x2a1327){if(_0x2a1327[_0x7381('0x23')](_0x559e1d)){_0x2a1327[_0x559e1d][_0x7381('0x29')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x2f')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x30')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x31')]=0x0;_0x2a1327[_0x559e1d]['sumHoldTime']=0x0;_0x2a1327[_0x559e1d][_0x7381('0x2a')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x2b')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x32')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x33')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x34')]=0x0;_0x2a1327[_0x559e1d]['outboundCongestionCallsDay']=0x0;_0x2a1327[_0x559e1d][_0x7381('0x35')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x36')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x37')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x38')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x39')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x3a')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x3b')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x3c')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x32')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x3d')]=0x0;_0x2a1327[_0x559e1d][_0x7381('0x3e')]=!![];}}}}Realtime['prototype'][_0x7381('0x3f')]=function(_0x2f72fc,_0x2cfca8){for(var _0x4fcd7a in _0x2cfca8){if(_0x2f72fc['hasOwnProperty'](_0x4fcd7a)){_0x2f72fc[_0x4fcd7a]=_0x2cfca8[_0x4fcd7a];}}};Realtime[_0x7381('0x40')][_0x7381('0x41')]=function(){var _0x4d2faa=this;return function(_0x1b26a7){if(_0x1b26a7){freeIsNotKeyAgent(_0x1b26a7,_0x4d2faa['agents']);for(var _0x54b314=0x0,_0x107e74={},_0x177e74={};_0x54b314<_0x1b26a7[_0x7381('0x42')];_0x54b314+=0x1){_0x107e74=_0x1b26a7[_0x54b314];var _0x29ab0c=_['isNil'](_0x107e74[_0x7381('0x28')])?util['format']('SIP/%s',_0x107e74['name']):_0x107e74[_0x7381('0x28')];if(_[_0x7381('0x43')](_0x4d2faa['agents'][_0x29ab0c])){_0x4d2faa[_0x7381('0xd')][_0x29ab0c]=new Agent(_0x107e74);}else{_0x4d2faa[_0x7381('0x3f')](_0x4d2faa[_0x7381('0xd')][_0x29ab0c],_0x107e74);}}}return _0x4d2faa[_0x7381('0xd')];};};Realtime[_0x7381('0x40')][_0x7381('0x44')]=function(){var _0x53553b=this;return function(_0x5c3e94){if(_0x5c3e94){freeIsNotKeySip(_0x5c3e94,_0x53553b[_0x7381('0xe')]);for(var _0x35d5d0=0x0,_0xfef78={},_0x55346f={};_0x35d5d0<_0x5c3e94[_0x7381('0x42')];_0x35d5d0+=0x1){_0xfef78=_0x5c3e94[_0x35d5d0];if(_[_0x7381('0x43')](_0x53553b[_0x7381('0xe')][util['format'](_0x7381('0x25'),_0xfef78[_0x7381('0x26')])])){_0x53553b['telephones'][util[_0x7381('0x24')](_0x7381('0x25'),_0xfef78[_0x7381('0x26')])]=new Telephone(_0xfef78);}else{_0x53553b['mergeFromDatabase'](_0x53553b[_0x7381('0xe')][util[_0x7381('0x24')](_0x7381('0x25'),_0xfef78[_0x7381('0x26')])],_0xfef78);}}}return _0x53553b['telephones'];};};Realtime[_0x7381('0x40')][_0x7381('0x45')]=function(){var _0x134319=this;return function(_0x2d37ef){if(_0x2d37ef){freeIsNotKeySip(_0x2d37ef,_0x134319[_0x7381('0xf')]);for(var _0x152c59=0x0,_0x389873={},_0x2f6893={};_0x152c59<_0x2d37ef[_0x7381('0x42')];_0x152c59+=0x1){_0x389873=_0x2d37ef[_0x152c59];if(_[_0x7381('0x43')](_0x134319[_0x7381('0xf')][util['format'](_0x7381('0x25'),_0x389873['name'])])){_0x134319[_0x7381('0xf')][util[_0x7381('0x24')](_0x7381('0x25'),_0x389873[_0x7381('0x26')])]=new Trunk(_0x389873);}else{_0x134319[_0x7381('0x3f')](_0x134319[_0x7381('0xf')][util[_0x7381('0x24')]('SIP/%s',_0x389873[_0x7381('0x26')])],_0x389873);}}}return _0x134319[_0x7381('0xf')];};};Realtime['prototype'][_0x7381('0x46')]=function(){var _0x3d91c4=this;return function(_0x3e208e){if(_0x3e208e){freeIsNotKey(_0x3e208e,_0x3d91c4['voiceQueues'],_0x7381('0x26'));for(var _0x5d8c36=0x0,_0x5979cb={},_0x469cb7={};_0x5d8c36<_0x3e208e[_0x7381('0x42')];_0x5d8c36+=0x1){_0x5979cb=_0x3e208e[_0x5d8c36];if(_[_0x7381('0x43')](_0x3d91c4[_0x7381('0x10')][_0x5979cb[_0x7381('0x26')]])){_0x3d91c4[_0x7381('0x10')][_0x5979cb[_0x7381('0x26')]]=new VoiceQueue(_0x5979cb);}else{_0x3d91c4['mergeFromDatabase'](_0x3d91c4['voiceQueues'][_0x5979cb[_0x7381('0x26')]],_0x5979cb);}}}return _0x3d91c4[_0x7381('0x10')];};};Realtime[_0x7381('0x40')][_0x7381('0x47')]=function(){var _0x460178=this;return function(_0x1c122a){if(_0x1c122a){freeIsNotKey(_0x1c122a,_0x460178['triggers'],'id');for(var _0x506041=0x0,_0x5b95b5={},_0x189328={};_0x506041<_0x1c122a[_0x7381('0x42')];_0x506041+=0x1){_0x5b95b5=_0x1c122a[_0x506041];if(_['isUndefined'](_0x460178['triggers'][_0x5b95b5['id']])){_0x460178[_0x7381('0x11')][_0x5b95b5['id']]=new Trigger(_0x5b95b5);}else{_0x460178['mergeFromDatabase'](_0x460178[_0x7381('0x11')][_0x5b95b5['id']],_0x5b95b5);}}}return _0x460178[_0x7381('0x11')];};};Realtime[_0x7381('0x40')][_0x7381('0x48')]=function(){var _0x2090ca=this;return function(_0x4d6844){if(_0x4d6844){freeIsNotKey(_0x4d6844,_0x2090ca[_0x7381('0x13')],'id');for(var _0x2a3d39=0x0,_0x28d010={},_0x2df1ea={};_0x2a3d39<_0x4d6844['length'];_0x2a3d39+=0x1){_0x28d010=_0x4d6844[_0x2a3d39];if(_[_0x7381('0x43')](_0x2090ca[_0x7381('0x13')][_0x28d010['id']])){_0x2090ca[_0x7381('0x13')][_0x28d010['id']]=new Template(_0x28d010);}else{_0x2090ca[_0x7381('0x3f')](_0x2090ca[_0x7381('0x13')][_0x28d010['id']],_0x28d010);}}}return _0x2090ca[_0x7381('0x13')];};};Realtime[_0x7381('0x40')][_0x7381('0x49')]=function(){var _0x3ebb1d=this;return function(_0x1be315){if(_0x1be315){freeIsNotKey(_0x1be315,_0x3ebb1d[_0x7381('0x18')],'id');for(var _0x4f47db=0x0,_0x2e8176={},_0x1418bf={};_0x4f47db<_0x1be315['length'];_0x4f47db+=0x1){_0x2e8176=_0x1be315[_0x4f47db];if(_[_0x7381('0x43')](_0x3ebb1d[_0x7381('0x18')][_0x2e8176['id']])){_0x3ebb1d[_0x7381('0x18')][_0x2e8176['id']]=new ZendeskAccount(_0x2e8176);}else{_0x3ebb1d[_0x7381('0x3f')](_0x3ebb1d[_0x7381('0x18')][_0x2e8176['id']],_0x2e8176);}}}return _0x3ebb1d[_0x7381('0x18')];};};Realtime[_0x7381('0x40')][_0x7381('0x4a')]=function(){var _0x1cda17=this;return function(_0x373121){if(_0x373121){freeIsNotKey(_0x373121,_0x1cda17[_0x7381('0x19')],'id');for(var _0xc9e32b=0x0,_0x325157={},_0x299975={};_0xc9e32b<_0x373121['length'];_0xc9e32b+=0x1){_0x325157=_0x373121[_0xc9e32b];if(_[_0x7381('0x43')](_0x1cda17[_0x7381('0x19')][_0x325157['id']])){_0x1cda17[_0x7381('0x19')][_0x325157['id']]=new SalesforceAccount(_0x325157);}else{_0x1cda17[_0x7381('0x3f')](_0x1cda17['salesforceAccounts'][_0x325157['id']],_0x325157);}}}return _0x1cda17[_0x7381('0x19')];};};Realtime[_0x7381('0x40')][_0x7381('0x4b')]=function(){var _0x228ea4=this;return function(_0x1b2eb1){if(_0x1b2eb1){freeIsNotKey(_0x1b2eb1,_0x228ea4['freshdeskAccounts'],'id');for(var _0x128444=0x0,_0x4cf8ff={},_0x34ca94={};_0x128444<_0x1b2eb1['length'];_0x128444+=0x1){_0x4cf8ff=_0x1b2eb1[_0x128444];if(_[_0x7381('0x43')](_0x228ea4[_0x7381('0x1a')][_0x4cf8ff['id']])){_0x228ea4['freshdeskAccounts'][_0x4cf8ff['id']]=new FreshdeskAccount(_0x4cf8ff);}else{_0x228ea4[_0x7381('0x3f')](_0x228ea4[_0x7381('0x1a')][_0x4cf8ff['id']],_0x4cf8ff);}}}return _0x228ea4[_0x7381('0x1a')];};};Realtime[_0x7381('0x40')][_0x7381('0x4c')]=function(){var _0x30ab1e=this;return function(_0x428003){if(_0x428003){freeIsNotKey(_0x428003,_0x30ab1e[_0x7381('0x1b')],'id');for(var _0x1e816e=0x0,_0x5f2a28={},_0x56e0bb={};_0x1e816e<_0x428003[_0x7381('0x42')];_0x1e816e+=0x1){_0x5f2a28=_0x428003[_0x1e816e];if(_[_0x7381('0x43')](_0x30ab1e[_0x7381('0x1b')][_0x5f2a28['id']])){_0x30ab1e[_0x7381('0x1b')][_0x5f2a28['id']]=new ZohoAccount(_0x5f2a28);}else{_0x30ab1e['mergeFromDatabase'](_0x30ab1e[_0x7381('0x1b')][_0x5f2a28['id']],_0x5f2a28);}}}return _0x30ab1e[_0x7381('0x1b')];};};Realtime['prototype'][_0x7381('0x4d')]=function(){var _0x6ccab7=this;return function(_0x760885){if(_0x760885){freeIsNotKey(_0x760885,_0x6ccab7['deskAccounts'],'id');for(var _0x543f7a=0x0,_0x35fafb={},_0x29071d={};_0x543f7a<_0x760885[_0x7381('0x42')];_0x543f7a+=0x1){_0x35fafb=_0x760885[_0x543f7a];if(_[_0x7381('0x43')](_0x6ccab7[_0x7381('0x1c')][_0x35fafb['id']])){_0x6ccab7[_0x7381('0x1c')][_0x35fafb['id']]=new DeskAccount(_0x35fafb);}else{_0x6ccab7[_0x7381('0x3f')](_0x6ccab7[_0x7381('0x1c')][_0x35fafb['id']],_0x35fafb);}}}return _0x6ccab7[_0x7381('0x1c')];};};Realtime[_0x7381('0x40')][_0x7381('0x4e')]=function(){var _0xddf8c0=this;return function(_0x5595a1){if(_0x5595a1){freeIsNotKey(_0x5595a1,_0xddf8c0[_0x7381('0x4f')],'id');for(var _0x59b527=0x0,_0x38353e={},_0x4b2493={};_0x59b527<_0x5595a1[_0x7381('0x42')];_0x59b527+=0x1){_0x38353e=_0x5595a1[_0x59b527];if(_['isUndefined'](_0xddf8c0[_0x7381('0x4f')][_0x38353e['id']])){_0xddf8c0[_0x7381('0x4f')][_0x38353e['id']]=new SugarcrmAccount(_0x38353e);}else{_0xddf8c0['mergeFromDatabase'](_0xddf8c0['sugarcrmAccounts'][_0x38353e['id']],_0x38353e);}}}return _0xddf8c0[_0x7381('0x4f')];};};Realtime['prototype'][_0x7381('0x50')]=function(){var _0x16cf83=this;return function(_0x4df830){if(_0x4df830){freeIsNotKey(_0x4df830,_0x16cf83[_0x7381('0x1d')],'id');for(var _0x2cd429=0x0,_0x170cb8={},_0x192bb3={};_0x2cd429<_0x4df830['length'];_0x2cd429+=0x1){_0x170cb8=_0x4df830[_0x2cd429];if(_[_0x7381('0x43')](_0x16cf83['vtigerAccounts'][_0x170cb8['id']])){_0x16cf83[_0x7381('0x1d')][_0x170cb8['id']]=new VtigerAccount(_0x170cb8);}else{_0x16cf83[_0x7381('0x3f')](_0x16cf83[_0x7381('0x1d')][_0x170cb8['id']],_0x170cb8);}}}return _0x16cf83[_0x7381('0x1d')];};};Realtime[_0x7381('0x40')][_0x7381('0x51')]=function(){var _0x4b832a=this;return function(_0x172ac8){if(_0x172ac8){freeIsNotKey(_0x172ac8,_0x4b832a['servicenowAccounts'],'id');for(var _0x13d636=0x0,_0x2577b1={},_0x2ae1f1={};_0x13d636<_0x172ac8[_0x7381('0x42')];_0x13d636+=0x1){_0x2577b1=_0x172ac8[_0x13d636];if(_[_0x7381('0x43')](_0x4b832a[_0x7381('0x1e')][_0x2577b1['id']])){_0x4b832a['servicenowAccounts'][_0x2577b1['id']]=new ServicenowAccount(_0x2577b1);}else{_0x4b832a['mergeFromDatabase'](_0x4b832a[_0x7381('0x1e')][_0x2577b1['id']],_0x2577b1);}}}return _0x4b832a['servicenowAccounts'];};};Realtime['prototype'][_0x7381('0x52')]=function(){var _0x31be9d=this;return function(_0x3c96ad){if(_0x3c96ad){freeIsNotKey(_0x3c96ad,_0x31be9d['dynamics365Accounts'],'id');for(var _0x48e74d=0x0,_0x5b7a37={},_0x4ee5c3={};_0x48e74d<_0x3c96ad[_0x7381('0x42')];_0x48e74d+=0x1){_0x5b7a37=_0x3c96ad[_0x48e74d];if(_[_0x7381('0x43')](_0x31be9d[_0x7381('0x1f')][_0x5b7a37['id']])){_0x31be9d['dynamics365Accounts'][_0x5b7a37['id']]=new Dynamics365Account(_0x5b7a37);}else{_0x31be9d[_0x7381('0x3f')](_0x31be9d[_0x7381('0x1f')][_0x5b7a37['id']],_0x5b7a37);}}}return _0x31be9d[_0x7381('0x1f')];};};Realtime[_0x7381('0x40')][_0x7381('0x53')]=function(){var _0x30ea5c=this;return function(_0x2c3c97){if(_0x2c3c97){freeIsNotKey(_0x2c3c97,_0x30ea5c[_0x7381('0x20')],'id');for(var _0x4cefcf=0x0,_0x214b69={},_0x9721c0={};_0x4cefcf<_0x2c3c97['length'];_0x4cefcf+=0x1){_0x214b69=_0x2c3c97[_0x4cefcf];if(_[_0x7381('0x43')](_0x30ea5c[_0x7381('0x20')][_0x214b69['id']])){_0x30ea5c[_0x7381('0x20')][_0x214b69['id']]=new FreshsalesAccount(_0x214b69);}else{_0x30ea5c['mergeFromDatabase'](_0x30ea5c[_0x7381('0x20')][_0x214b69['id']],_0x214b69);}}}return _0x30ea5c[_0x7381('0x20')];};};Realtime[_0x7381('0x40')][_0x7381('0x54')]=function(){var _0xaf4159=this;return function(_0x289087){for(var _0xd66b0a=0x0;_0xd66b0a<_0x289087[_0x7381('0x42')];_0xd66b0a+=0x1){_[_0x7381('0x55')](_0xaf4159[_0x7381('0x10')][_0x289087[_0xd66b0a][_0x7381('0x26')]],_0x289087[_0xd66b0a]);}return _0xaf4159[_0x7381('0x10')];};};Realtime[_0x7381('0x40')][_0x7381('0x56')]=function(){var _0x4f3dbe=this;return function(_0x557eea){clearVoiceQueues(_0x4f3dbe[_0x7381('0x10')]);if(_0x557eea){_0x557eea=_['groupBy'](_0x557eea,_0x7381('0x57'));for(var _0x4c2a03 in _0x557eea){if(_0x557eea[_0x7381('0x23')](_0x4c2a03)){var _0x235b7e={};for(var _0x3ca021=0x0;_0x3ca021<_0x557eea[_0x4c2a03][_0x7381('0x42')];_0x3ca021+=0x1){var _0x2cc921=_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x58')];if(_0x4f3dbe[_0x7381('0x10')][_0x2cc921]){if(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x59')]){_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x30')]+=0x1;}if(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x5a')]){_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x31')]+=0x1;}_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x5b')]+=moment(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x5c')])[_0x7381('0x5d')](moment(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x5e')]),_0x7381('0x5f'))||0x0;if(_0x3ca021===_0x557eea[_0x4c2a03][_0x7381('0x42')]-0x1){_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x2a')]+=moment(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x60')]||_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x61')]||_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x62')])['diff'](moment(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x5e')]),_0x7381('0x5f'))||0x0;_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x29')]+=0x1;if(_0x557eea[_0x4c2a03][_0x3ca021][_0x7381('0x63')]){_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x2f')]+=0x1;_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x2b')]+=moment(_0x557eea[_0x4c2a03][_0x3ca021]['queuecallercompleteAt'])[_0x7381('0x5d')](moment(_0x557eea[_0x4c2a03][_0x3ca021]['queuecallerleaveAt']),_0x7381('0x5f'))||0x0;}}else{_0x4f3dbe[_0x7381('0x10')][_0x2cc921][_0x7381('0x2a')]+=_0x4f3dbe[_0x7381('0x10')][_0x2cc921]['sumHoldTime']||0x0;}}}}}}return _0x4f3dbe['voiceQueues'];};};Realtime['prototype'][_0x7381('0x64')]=function(){var _0x5ddd7c=this;return function(_0x48ad01){clearVoiceCallReports(_0x5ddd7c[_0x7381('0x14')]);if(_0x48ad01){for(var _0x13dace=0x0;_0x13dace<_0x48ad01[_0x7381('0x42')];_0x13dace+=0x1){_0x5ddd7c[_0x7381('0x14')][_0x7381('0x29')]+=0x1;_0x5ddd7c[_0x7381('0x14')][_0x7381('0x2a')]+=_0x48ad01[_0x13dace][_0x7381('0x65')];if(_0x48ad01[_0x13dace]['disposition']===_0x7381('0x66')){_0x5ddd7c[_0x7381('0x14')]['answered']+=0x1;_0x5ddd7c['outbound'][_0x7381('0x5b')]+=_0x48ad01[_0x13dace]['duration']-_0x48ad01[_0x13dace][_0x7381('0x67')]||0x0;_0x5ddd7c['outbound']['sumBillable']+=_0x48ad01[_0x13dace][_0x7381('0x67')];}}}return _0x5ddd7c[_0x7381('0x14')];};};Realtime[_0x7381('0x40')]['initCampaigns']=function(){var _0xb7a46b=this;return function(_0x47c921){if(_0x47c921){freeIsNotKey(_0x47c921,_0xb7a46b[_0x7381('0x12')],_0x7381('0x26'));for(var _0x4ff71b=0x0,_0x58578f={};_0x4ff71b<_0x47c921[_0x7381('0x42')];_0x4ff71b+=0x1){_0x58578f=_0x47c921[_0x4ff71b];if(_[_0x7381('0x43')](_0xb7a46b[_0x7381('0x12')][_0x58578f['name']])){_0xb7a46b['campaigns'][_0x58578f[_0x7381('0x26')]]=new Campaign(_0x58578f);}else{_0xb7a46b['mergeFromDatabase'](_0xb7a46b['campaigns'][_0x58578f[_0x7381('0x26')]],_0x58578f);_0xb7a46b['campaigns'][_0x58578f[_0x7381('0x26')]]['dialQueueProject']=_0x58578f[_0x7381('0x68')]?_0x58578f[_0x7381('0x68')][_0x7381('0x26')]:undefined;}}}return _0xb7a46b[_0x7381('0x12')];};};Realtime[_0x7381('0x40')][_0x7381('0x69')]=function(){var _0x38bc20=this;return function(_0x565708){if(_0x565708){freeIsNotKey(_0x565708,_0x38bc20['voiceExtensions'],'id');for(var _0x471c42=0x0,_0x6b18df={};_0x471c42<_0x565708[_0x7381('0x42')];_0x471c42+=0x1){_0x6b18df=_0x565708[_0x471c42];if(_['isUndefined'](_0x38bc20['voiceExtensions'][_0x6b18df['id']])){_0x38bc20[_0x7381('0x15')][_0x6b18df['id']]=new VoiceExtension(_0x6b18df);}else{_0x38bc20[_0x7381('0x3f')](_0x38bc20['voiceExtensions'][_0x6b18df['id']],_0x6b18df);}}}return _0x38bc20[_0x7381('0x15')];};};Realtime[_0x7381('0x40')][_0x7381('0x6a')]=function(){var _0x304fc4=this;return function(_0x3da3b9){clearCampaigns(_0x304fc4[_0x7381('0x12')]);for(var _0x3738ab=0x0;_0x3738ab<_0x3da3b9['length'];_0x3738ab+=0x1){_[_0x7381('0x55')](_0x304fc4[_0x7381('0x12')][_0x3da3b9[_0x3738ab]['name']],_0x3da3b9[_0x3738ab]);}return _0x304fc4[_0x7381('0x12')];};};Realtime[_0x7381('0x40')][_0x7381('0x6b')]=function(){var _0x493878=this;return function(_0x56f295){if(_0x56f295){freeIsNotKey(_0x56f295,_0x493878[_0x7381('0x21')],'id');for(var _0x448cee=0x0,_0x571d21={},_0x3a50e7={};_0x448cee<_0x56f295[_0x7381('0x42')];_0x448cee+=0x1){_0x571d21=_0x56f295[_0x448cee];if(_[_0x7381('0x43')](_0x493878[_0x7381('0x21')][_0x571d21['id']])){_0x493878[_0x7381('0x21')][_0x571d21['id']]=new FaxAccount(_0x571d21);}else{_0x493878[_0x7381('0x3f')](_0x493878[_0x7381('0x21')][_0x571d21['id']],_0x571d21);}}}return _0x493878['faxAccounts'];};};module[_0x7381('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 21426bd..e411d1b 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 _0x957a=['YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview','destinationchannel','calleridpreview','calleridname','transfers','linkedid','transfereelinkedid','getCallType','UserId','split','membername','monitors','length','monitorFilename','filename','createdAt','connectedlinename','originatecalleridnum','startsWith','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','exports','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','prototype','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','telephones','interface','format','connectedlinenum','lastAssignedTo','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt'];(function(_0x31edbe,_0x34d231){var _0x37fcee=function(_0x17ecba){while(--_0x17ecba){_0x31edbe['push'](_0x31edbe['shift']());}};_0x37fcee(++_0x34d231);}(_0x957a,0x1eb));var _0xa957=function(_0x523011,_0x14a36f){_0x523011=_0x523011-0x0;var _0x1316c4=_0x957a[_0x523011];return _0x1316c4;};'use strict';var _=require('lodash');var moment=require(_0xa957('0x0'));var util=require('util');var config=require(_0xa957('0x1'));var ami=require(_0xa957('0x2'));var RpcVoiceAgentReport=require(_0xa957('0x3'));var RpcVoiceCallReport=require(_0xa957('0x4'));var RpcVoiceDialReport=require(_0xa957('0x5'));var RpcMemberReport=require(_0xa957('0x6'));var RpcVoiceQueueReport=require(_0xa957('0x7'));var RpcVoiceRecording=require(_0xa957('0x8'));var RpcVoiceTransferReport=require(_0xa957('0x9'));var VoiceQueueReport=require(_0xa957('0xa'));var VoiceCallReport=require(_0xa957('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xa957('0xc'));var UserReport=require(_0xa957('0xd'));function Report(_0x1f644c){this[_0xa957('0xe')]=_0x1f644c;this[_0xa957('0xf')]=_0x1f644c[_0xa957('0xf')];this['telephones']=_0x1f644c['telephones'];}Report[_0xa957('0x10')]['sync']=function(_0x1f5f2a){var _0x2878a2=new VoiceQueueReport(this[_0xa957('0xe')]);var _0x443935=new VoiceAgentReport(this[_0xa957('0xe')]);var _0x4a5c0a=new VoiceDialReport(this['realtime']);var _0x2011ca=new VoiceCallReport(this[_0xa957('0xe')]);var _0x4321ec=new UserReport(this[_0xa957('0xe')]);if(config['xdr']&&config['xdr'][_0xa957('0x11')]){ami['on']('custom:voiceQueueReport',this[_0xa957('0x12')][_0xa957('0x13')](this));ami['on'](_0xa957('0x14'),this[_0xa957('0x15')][_0xa957('0x13')](this));ami['on'](_0xa957('0x16'),this[_0xa957('0x17')][_0xa957('0x13')](this));ami['on'](_0xa957('0x18'),this[_0xa957('0x19')][_0xa957('0x13')](this));ami['on'](_0xa957('0x1a'),this[_0xa957('0x1b')][_0xa957('0x13')](this));ami['on'](_0xa957('0x1c'),this[_0xa957('0x1d')][_0xa957('0x13')](this));}};Report[_0xa957('0x10')][_0xa957('0x1e')]=function(_0x4ff346){var _0x755742;_0x755742=_[_0xa957('0x1f')](this['agents'],function(_0x31d6f5){return _0x31d6f5[_0xa957('0x20')]==_0x4ff346||_0x31d6f5[_0xa957('0x21')]==_0x4ff346;});if(_['isNil'](_0x755742)){var _0x28fc61=_[_0xa957('0x1f')](this[_0xa957('0x22')],function(_0x2a74b2){return _0x2a74b2[_0xa957('0x20')]==_0x4ff346||_0x2a74b2[_0xa957('0x21')]==_0x4ff346;});if(_0x28fc61){_0x755742=_['find'](this['agents'],function(_0x114d4f){return _0x114d4f[_0xa957('0x23')]==util[_0xa957('0x24')]('SIP/%s',_0x28fc61[_0xa957('0x21')]);});}}return _0x755742;};Report[_0xa957('0x10')]['voiceQueueReport']=function(_0x58768f){for(var _0x20a704=0x0;_0x20a704<_0x58768f['length'];_0x20a704+=0x1){var _0xda2076=this[_0xa957('0x1e')](_0x58768f[_0x20a704][_0xa957('0x25')]);if(_0xda2076){_0x58768f[_0x20a704][_0xa957('0x20')]=_0xda2076[_0xa957('0x20')];_0x58768f[_0x20a704]['assigned']=!![];_0x58768f[_0x20a704][_0xa957('0x26')]=_0xda2076[_0xa957('0x21')];_0x58768f[_0x20a704]['interface']=_[_0xa957('0x27')](_0xda2076[_0xa957('0x23')])?util[_0xa957('0x24')](_0xa957('0x28'),_0xda2076[_0xa957('0x21')]):_0xda2076[_0xa957('0x23')];if(_0x58768f[_0x20a704][_0xa957('0x29')]){_0x58768f[_0x20a704][_0xa957('0x2a')]=moment()[_0xa957('0x24')](_0xa957('0x2b'));}if(_0x58768f[_0x20a704][_0xa957('0x2c')]){_0x58768f[_0x20a704][_0xa957('0x2d')]=moment()[_0xa957('0x24')](_0xa957('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x58768f[_0x20a704]);}RpcVoiceQueueReport[_0xa957('0x2e')](_0x58768f[_0x20a704]);}};function extractCalleridNumber(_0x338c95){var _0x36ed89=_0x338c95[_0xa957('0x2f')](/<(.*?)>/);return _0x36ed89?_0x36ed89[0x1]:_0x338c95;}Report[_0xa957('0x10')][_0xa957('0x30')]=function(_0x1c42ad){for(var _0x26182b=0x0;_0x26182b',_0x5e3362[_0xa957('0x42')],_0x5e3362[_0xa957('0x33')]);}if(RpcVoiceTransferReport[_0xa957('0x43')][_0x5e3362[_0xa957('0x44')]]){var _0x2ab033=RpcVoiceTransferReport[_0xa957('0x43')][_0x5e3362[_0xa957('0x44')]];_0x2ab033[_0xa957('0x45')]=_0x5e3362['uniqueid'];RpcVoiceTransferReport[_0xa957('0x1b')](_0x2ab033);delete RpcVoiceTransferReport['transfers'][_0x5e3362[_0xa957('0x44')]];}if(_[_0xa957('0x27')](_0x5e3362[_0xa957('0x38')])){_0x5e3362[_0xa957('0x38')]=this[_0xa957('0x46')](_0x5e3362);}if(_[_0xa957('0x27')](_0x5e3362[_0xa957('0x47')])){var _0x19b457=_0x5e3362[_0xa957('0x32')][_0xa957('0x48')]('-')[0x0];var _0x43fa01=this['agents'][_0x19b457];if(!_0x43fa01)_0x43fa01=this[_0xa957('0x30')](_0x5e3362[_0xa957('0x20')]);if(_0x43fa01){_0x5e3362[_0xa957('0x47')]=_0x43fa01['id'];_0x5e3362[_0xa957('0x49')]=_0x43fa01[_0xa957('0x21')];}}RpcVoiceCallReport[_0xa957('0x2e')](_0x5e3362);if(_0x5e3362['monitor']){for(var _0x17da46=0x0;_0x17da46<_0x5e3362[_0xa957('0x4a')][_0xa957('0x4b')];_0x17da46+=0x1){_0x5e3362[_0xa957('0x4c')]=_0x5e3362[_0xa957('0x4a')][_0x17da46][_0xa957('0x4d')];_0x5e3362['createdAt']=_0x5e3362['monitors'][_0x17da46][_0xa957('0x4e')];if(_0x5e3362['exten']==_0xa957('0x3f')){_0x5e3362['calleridnum']=_0x5e3362['connectedlinenum'];_0x5e3362['calleridname']=_0x5e3362['connectedlinename'];_0x5e3362['connectedlinenum']=_0x5e3362[_0xa957('0x20')];_0x5e3362[_0xa957('0x4f')]=_0x5e3362['membername'];_0x5e3362[_0xa957('0x37')]=_0x5e3362['originatecalleridnum'];}else if(_0x5e3362[_0xa957('0x37')]=='xcally-motion-dialer'){_0x5e3362['calleridnum']=_0x5e3362[_0xa957('0x36')];_0x5e3362[_0xa957('0x37')]=_0x5e3362[_0xa957('0x50')];}RpcVoiceRecording[_0xa957('0x2e')](_0x5e3362);}}};Report['prototype'][_0xa957('0x17')]=function(_0x19cd98){if(_['isArray'](_0x19cd98)){_0x19cd98['forEach'](function(_0x2ec073){RpcVoiceAgentReport[_0xa957('0x2e')](_0x2ec073);});}else{RpcVoiceAgentReport[_0xa957('0x2e')](_0x19cd98);}};Report[_0xa957('0x10')][_0xa957('0x19')]=function(_0x5f2ec0){RpcVoiceDialReport[_0xa957('0x2e')](_0x5f2ec0);var _0x5c0e3b;var _0x2d1c28;var _0x1b848a=_0x5f2ec0[_0xa957('0x32')];if(_[_0xa957('0x51')](_0x1b848a,_0xa957('0x52'))){_0x2d1c28=_0x1b848a['substring'](_0x1b848a[_0xa957('0x53')]('/')+0x1,_0x1b848a[_0xa957('0x53')]('@'));_0x5c0e3b=_['find'](this[_0xa957('0xf')],function(_0xc7defd){return _0xc7defd['mobile']==_0x2d1c28||_0xc7defd[_0xa957('0x54')]==_0x2d1c28||_0xc7defd[_0xa957('0x20')]==_0x2d1c28;});}else{_0x2d1c28=_0x1b848a[_0xa957('0x55')](_0x1b848a[_0xa957('0x53')]('/')+0x1,_0x1b848a[_0xa957('0x56')]('-'));_0x5c0e3b=this['findAgent'](_0x2d1c28);}if(_0x5c0e3b){_0x5f2ec0[_0xa957('0x23')]=_['isNil'](_0x5c0e3b[_0xa957('0x23')])?util[_0xa957('0x24')](_0xa957('0x28'),_0x5c0e3b[_0xa957('0x21')]):_0x5c0e3b[_0xa957('0x23')];_0x5f2ec0[_0xa957('0x49')]=_0x5c0e3b['name'];_0x5f2ec0[_0xa957('0x20')]=_0x5c0e3b['accountcode'];RpcMemberReport['voiceDialReport'](_0x5f2ec0);}};Report[_0xa957('0x10')]['blindTransfer']=function(_0x2078a9){RpcVoiceTransferReport[_0xa957('0x43')][_0x2078a9[_0xa957('0x57')]]=_0x2078a9;};Report[_0xa957('0x10')]['attendedTransfer']=function(_0x1dc44a){RpcVoiceTransferReport['attendedTransfer'](_0x1dc44a);};module[_0xa957('0x58')]=Report; \ No newline at end of file +var _0xca71=['find','accountcode','name','isNil','interface','connectedlinenum','assigned','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','length','keys','getCallType','channel','split','outbound','internal','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','destination','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','blindTransfer','type','UserId','monitor','monitors','filename','createdAt','connectedlinename','membername','voiceAgentReport','isArray','startsWith','Local','indexOf','mobile','substring','lastIndexOf','voiceDialReport','transfererlinkedid','attendedTransfer','exports','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceDialReport','blindtransfer','prototype','findAgent'];(function(_0x32ae2b,_0x228034){var _0x213905=function(_0x28d48b){while(--_0x28d48b){_0x32ae2b['push'](_0x32ae2b['shift']());}};_0x213905(++_0x228034);}(_0xca71,0x1ac));var _0x1ca7=function(_0x5272b2,_0x59f060){_0x5272b2=_0x5272b2-0x0;var _0x2ca6c5=_0xca71[_0x5272b2];return _0x2ca6c5;};'use strict';var _=require('lodash');var moment=require(_0x1ca7('0x0'));var util=require(_0x1ca7('0x1'));var config=require('../../../config/environment');var ami=require(_0x1ca7('0x2'));var RpcVoiceAgentReport=require(_0x1ca7('0x3'));var RpcVoiceCallReport=require(_0x1ca7('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x1ca7('0x5'));var RpcVoiceQueueReport=require(_0x1ca7('0x6'));var RpcVoiceRecording=require(_0x1ca7('0x7'));var RpcVoiceTransferReport=require(_0x1ca7('0x8'));var VoiceQueueReport=require(_0x1ca7('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x1ca7('0xa'));var VoiceDialReport=require(_0x1ca7('0xb'));var UserReport=require('./userReport');function Report(_0x46d003){this[_0x1ca7('0xc')]=_0x46d003;this[_0x1ca7('0xd')]=_0x46d003[_0x1ca7('0xd')];this[_0x1ca7('0xe')]=_0x46d003['telephones'];}Report['prototype'][_0x1ca7('0xf')]=function(_0x34de9d){var _0x1d99f7=new VoiceQueueReport(this['realtime']);var _0x236206=new VoiceAgentReport(this[_0x1ca7('0xc')]);var _0xa2c187=new VoiceDialReport(this[_0x1ca7('0xc')]);var _0x408bd7=new VoiceCallReport(this['realtime']);var _0x486a3a=new UserReport(this[_0x1ca7('0xc')]);if(config[_0x1ca7('0x10')]&&config[_0x1ca7('0x10')][_0x1ca7('0x11')]){ami['on'](_0x1ca7('0x12'),this[_0x1ca7('0x13')]['bind'](this));ami['on'](_0x1ca7('0x14'),this[_0x1ca7('0x15')][_0x1ca7('0x16')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport']['bind'](this));ami['on'](_0x1ca7('0x17'),this['voiceDialReport'][_0x1ca7('0x16')](this));ami['on'](_0x1ca7('0x18'),this['blindTransfer']['bind'](this));ami['on']('attendedtransfer',this['attendedTransfer']['bind'](this));}};Report[_0x1ca7('0x19')][_0x1ca7('0x1a')]=function(_0xb7bfed){var _0x32e8df;_0x32e8df=_[_0x1ca7('0x1b')](this['agents'],function(_0x5e7cab){return _0x5e7cab[_0x1ca7('0x1c')]==_0xb7bfed||_0x5e7cab[_0x1ca7('0x1d')]==_0xb7bfed;});if(_[_0x1ca7('0x1e')](_0x32e8df)){var _0x493912=_[_0x1ca7('0x1b')](this[_0x1ca7('0xe')],function(_0xc0023d){return _0xc0023d[_0x1ca7('0x1c')]==_0xb7bfed||_0xc0023d[_0x1ca7('0x1d')]==_0xb7bfed;});if(_0x493912){_0x32e8df=_[_0x1ca7('0x1b')](this[_0x1ca7('0xd')],function(_0x535ec0){return _0x535ec0[_0x1ca7('0x1f')]==util['format']('SIP/%s',_0x493912[_0x1ca7('0x1d')]);});}}return _0x32e8df;};Report[_0x1ca7('0x19')]['voiceQueueReport']=function(_0xf280a1){for(var _0x5f06d6=0x0;_0x5f06d6<_0xf280a1['length'];_0x5f06d6+=0x1){var _0x4dc10f=this[_0x1ca7('0x1a')](_0xf280a1[_0x5f06d6][_0x1ca7('0x20')]);if(_0x4dc10f){_0xf280a1[_0x5f06d6]['accountcode']=_0x4dc10f['accountcode'];_0xf280a1[_0x5f06d6][_0x1ca7('0x21')]=!![];_0xf280a1[_0x5f06d6][_0x1ca7('0x22')]=_0x4dc10f[_0x1ca7('0x1d')];_0xf280a1[_0x5f06d6]['interface']=_[_0x1ca7('0x1e')](_0x4dc10f[_0x1ca7('0x1f')])?util[_0x1ca7('0x23')](_0x1ca7('0x24'),_0x4dc10f[_0x1ca7('0x1d')]):_0x4dc10f['interface'];if(_0xf280a1[_0x5f06d6][_0x1ca7('0x25')]){_0xf280a1[_0x5f06d6]['queuecallercompleteAt']=moment()[_0x1ca7('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xf280a1[_0x5f06d6]['queuecallerexit']){_0xf280a1[_0x5f06d6][_0x1ca7('0x26')]=moment()[_0x1ca7('0x23')](_0x1ca7('0x27'));}RpcMemberReport[_0x1ca7('0x13')](_0xf280a1[_0x5f06d6]);}RpcVoiceQueueReport[_0x1ca7('0x28')](_0xf280a1[_0x5f06d6]);}};function extractCalleridNumber(_0x5cc60c){var _0x54eee8=_0x5cc60c[_0x1ca7('0x29')](/<(.*?)>/);return _0x54eee8?_0x54eee8[0x1]:_0x5cc60c;}Report['prototype'][_0x1ca7('0x2a')]=function(_0x348ab0){for(var _0x497816=0x0;_0x4978160x0?_0xdf3021:0x0;this[_0x0228('0x11')][_0x65b544[_0x0228('0x68')]][_0x0228('0x2d')]=this[_0x0228('0x11')][_0x65b544[_0x0228('0x68')]][_0x0228('0x2d')]>_[_0x0228('0x6b')](_0x65b544['loggedin'])?_[_0x0228('0x6b')](_0x65b544[_0x0228('0x6c')]):this[_0x0228('0x11')][_0x65b544[_0x0228('0x68')]]['talking'];this[_0x0228('0x4b')](this[_0x0228('0x11')][_0x65b544[_0x0228('0x68')]],_0x0228('0x65'));}logger[_0x0228('0x40')](_0x0228('0x6d'),util[_0x0228('0x39')](this['voiceQueues'][_0x65b544[_0x0228('0x68')]],{'showHidden':![],'depth':null}));ami[_0x0228('0x3f')]('custom:queuesummary',this[_0x0228('0x11')][_0x65b544[_0x0228('0x68')]]);}}}catch(_0x1f514c){logger[_0x0228('0x38')](_0x0228('0x67'),util[_0x0228('0x39')](_0x1f514c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x22e591){logger[_0x0228('0x40')](_0x0228('0x6e'),util[_0x0228('0x39')](_0x22e591,{'showHidden':![],'depth':null}));this[_0x0228('0x12')]=!![];};VoiceQueueReport[_0x0228('0x31')][_0x0228('0x19')]=function(_0x1c97ba){try{if(this[_0x0228('0x5f')](_0x1c97ba)){logger[_0x0228('0x40')](_0x0228('0x6f'),_0x1c97ba[_0x0228('0x70')],util[_0x0228('0x39')](_0x1c97ba,{'showHidden':![],'depth':null}));if(_[_0x0228('0x60')](this[_0x0228('0xd')][_0x1c97ba[_0x0228('0x70')]]))this[_0x0228('0xd')][_0x1c97ba[_0x0228('0x70')]]=[];if(_[_0x0228('0x60')](this[_0x0228('0xf')][_0x1c97ba[_0x0228('0x70')]]))this[_0x0228('0xf')][_0x1c97ba[_0x0228('0x70')]]={};var _0x166f54=new QueueReport();_0x166f54[_0x0228('0x48')]=_0x1c97ba['queue'];_0x166f54[_0x0228('0x4c')]=this[_0x0228('0x11')][_0x166f54[_0x0228('0x48')]]&&this['voiceQueues'][_0x166f54[_0x0228('0x48')]][_0x0228('0x4c')]?this['voiceQueues'][_0x166f54[_0x0228('0x48')]][_0x0228('0x4c')]||'inbound':_0x0228('0x4d');_0x166f54['queue']=_0x1c97ba[_0x0228('0x68')];_0x166f54[_0x0228('0x71')]=moment()[_0x0228('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x166f54[_0x0228('0x72')]=_0x1c97ba[_0x0228('0x72')];_0x166f54[_0x0228('0x73')]=_0x1c97ba[_0x0228('0x73')];_0x166f54[_0x0228('0x70')]=_0x1c97ba[_0x0228('0x70')];_0x166f54['routealias']=this[_0x0228('0xf')][_0x1c97ba[_0x0228('0x70')]]['routealias'];logger['info'](_0x0228('0x74'),_0x166f54[_0x0228('0x48')],_0x166f54[_0x0228('0x4c')]);_[_0x0228('0x75')](_0x166f54,_[_0x0228('0x76')](_0x1c97ba,_['keys'](_0x166f54)));this[_0x0228('0xd')][_0x1c97ba[_0x0228('0x70')]][_0x0228('0x77')](_0x166f54);this['channels'][_0x1c97ba[_0x0228('0x70')]]=_0x166f54;this[_0x0228('0x78')](_0x166f54,'queuecallerjoin');}}catch(_0x4ed88e){logger[_0x0228('0x38')](_0x0228('0x6f'),_0x1c97ba[_0x0228('0x70')],util[_0x0228('0x39')](_0x4ed88e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0228('0x31')][_0x0228('0x1b')]=function(_0x44bc46){try{if(this[_0x0228('0x5f')](_0x44bc46)){logger[_0x0228('0x40')](_0x0228('0x79'),_0x44bc46['uniqueid'],util[_0x0228('0x39')](_0x44bc46,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x44bc46['uniqueid']]){var _0x7ae6d7=_[_0x0228('0x7a')](this[_0x0228('0xd')][_0x44bc46[_0x0228('0x70')]]);_0x7ae6d7[_0x0228('0x7b')]=![];_0x7ae6d7[_0x0228('0x7c')]=null;_0x7ae6d7['holdtime']=_0x44bc46[_0x0228('0x7d')];_0x7ae6d7['originalposition']=_0x44bc46['originalposition'];_0x7ae6d7[_0x0228('0x1a')]=!![];_0x7ae6d7[_0x0228('0x7e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x7ae6d7[_0x0228('0x7f')]=_0x0228('0x80');_0x7ae6d7[_0x0228('0x81')]=null;logger[_0x0228('0x82')](_0x0228('0x83'),_0x7ae6d7[_0x0228('0x48')],_0x7ae6d7[_0x0228('0x4c')]);this['channels'][_0x44bc46[_0x0228('0x70')]]=_0x7ae6d7;this[_0x0228('0x84')](_0x7ae6d7,_0x0228('0x1a'));}}}catch(_0x2f5b26){logger[_0x0228('0x38')](_0x0228('0x79'),_0x44bc46[_0x0228('0x70')],util[_0x0228('0x39')](_0x2f5b26,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0228('0x31')][_0x0228('0x85')]=function(_0x249edf){try{if(this[_0x0228('0x5f')](_0x249edf)){logger[_0x0228('0x40')]('[%s][voiceQueueReport][queuecallerleave]',_0x249edf[_0x0228('0x70')],util[_0x0228('0x39')](_0x249edf,{'showHidden':![],'depth':null}));if(this[_0x0228('0xd')][_0x249edf[_0x0228('0x70')]]){var _0xf7da0d=_[_0x0228('0x7a')](this[_0x0228('0xd')][_0x249edf[_0x0228('0x70')]]);_0xf7da0d[_0x0228('0x86')]=moment()[_0x0228('0x42')](_0x0228('0x87'));_0xf7da0d[_0x0228('0x88')]=_0x249edf[_0x0228('0x88')];_0xf7da0d[_0x0228('0x89')]=_0x249edf[_0x0228('0x89')];logger[_0x0228('0x82')](_0x0228('0x8a'),_0xf7da0d[_0x0228('0x48')],_0xf7da0d[_0x0228('0x4c')],_0x249edf[_0x0228('0x88')],_0x249edf['connectedlinename']);this[_0x0228('0xf')][_0x249edf[_0x0228('0x70')]]=_0xf7da0d;this[_0x0228('0x78')](_0xf7da0d,_0x0228('0x1c'));}}}catch(_0x2dac5a){logger[_0x0228('0x38')]('[%s][voiceQueueReport][queuecallerleave]',_0x249edf[_0x0228('0x70')],util[_0x0228('0x39')](_0x2dac5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0228('0x20')]=function(_0x248b75){try{if(this['isNotNull'](_0x248b75)){logger[_0x0228('0x40')]('[%s][voiceQueueReport][agentconnect]',_0x248b75[_0x0228('0x70')],util['inspect'](_0x248b75,{'showHidden':![],'depth':null}));if(this[_0x0228('0xd')][_0x248b75[_0x0228('0x70')]]){var _0x3d2bd5=_['last'](this[_0x0228('0xd')][_0x248b75[_0x0228('0x70')]]);_0x3d2bd5[_0x0228('0x7b')]=!![];_0x3d2bd5['queuecallerexitreason']=_0x0228('0x8b');logger[_0x0228('0x82')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x3d2bd5[_0x0228('0x48')],_0x3d2bd5['type']);}}}catch(_0x9dea4c){logger['error'](_0x0228('0x8c'),_0x248b75['uniqueid'],util[_0x0228('0x39')](_0x9dea4c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0228('0x31')]['syncAgentComplete']=function(_0x596805){try{if(this[_0x0228('0x5f')](_0x596805)){logger[_0x0228('0x40')]('[%s][voiceQueueReport][agentcomplete]',_0x596805['uniqueid'],util[_0x0228('0x39')](_0x596805,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x596805['uniqueid']]){var _0x55d20c=_['last'](this[_0x0228('0xd')][_0x596805[_0x0228('0x70')]]);_0x55d20c[_0x0228('0x1a')]=![];_0x55d20c[_0x0228('0x7e')]=null;_0x55d20c[_0x0228('0x8d')]=!![];_0x55d20c[_0x0228('0x81')]=_0x596805[_0x0228('0x8e')];_0x55d20c[_0x0228('0x7d')]=_0x596805[_0x0228('0x7d')];_0x55d20c['queuecallercomplete']=!![];_0x55d20c[_0x0228('0x8f')]=![];_0x55d20c[_0x0228('0x90')]=null;if(!_0x55d20c['transfer']){if(_0x596805['reason']==_0x0228('0x91')){_0x55d20c[_0x0228('0x7f')]=_0x0228('0x92');logger[_0x0228('0x82')](_0x0228('0x93'),_0x55d20c[_0x0228('0x48')],_0x55d20c['type']);}else{if(_[_0x0228('0x94')](_0x596805[_0x0228('0x36')][_0x0228('0x95')](),_0x0228('0x96'))){if(this['queueReports'][_0x596805[_0x0228('0x97')]]){var _0x32893f=_[_0x0228('0x7a')](this['queueReports'][_0x596805[_0x0228('0x97')]]);_0x32893f[_0x0228('0x7b')]=![];_0x32893f[_0x0228('0x8f')]=!![];_0x32893f[_0x0228('0x90')]=moment(_0x55d20c[_0x0228('0x71')])['add'](_0x596805[_0x0228('0x7d')],'seconds')[_0x0228('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x32893f[_0x0228('0x7f')]=_0x0228('0x98');_0x32893f[_0x0228('0x91')]=!![];_0x32893f[_0x0228('0x99')]='FORWARD';_0x32893f['transferexten']=_0x596805[_0x0228('0x9a')];_0x32893f[_0x0228('0x9b')]=_0x596805[_0x0228('0x70')];logger['info'](_0x0228('0x9c'),_0x32893f[_0x0228('0x48')],_0x32893f[_0x0228('0x4c')]);var _0x451d72=this[_0x0228('0xd')][_0x596805[_0x0228('0x97')]];this[_0x0228('0xd')][_0x596805[_0x0228('0x97')]]=this[_0x0228('0xd')][_0x596805['uniqueid']];this[_0x0228('0xd')][_0x596805[_0x0228('0x70')]]=_0x451d72;}}else{_0x55d20c[_0x0228('0x7f')]=_0x0228('0x9d')+_0x596805[_0x0228('0x9e')][_0x0228('0x9f')]();logger[_0x0228('0x82')](_0x0228('0xa0'),_0x55d20c['name'],_0x55d20c[_0x0228('0x4c')],_0x55d20c[_0x0228('0x7f')]);}}}this['channels'][_0x596805[_0x0228('0x70')]]=_0x55d20c;this[_0x0228('0x84')](_0x55d20c,'agentcomplete');}}}catch(_0x4ca9b7){logger[_0x0228('0x38')](_0x0228('0xa1'),_0x596805[_0x0228('0x70')],util[_0x0228('0x39')](_0x4ca9b7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0228('0x31')][_0x0228('0x22')]=function(_0x33ad4b){try{if(this[_0x0228('0x5f')](_0x33ad4b)){logger[_0x0228('0x40')]('[%s][voiceQueueReport][varset]',_0x33ad4b[_0x0228('0x70')],util[_0x0228('0x39')](_0x33ad4b,{'showHidden':![],'depth':null}));this[_0x0228('0xa2')](_0x33ad4b['uniqueid'],_[_0x0228('0xa3')](_0x33ad4b['variable'])[0x0],_0x33ad4b[_0x0228('0xa4')]);if(this[_0x0228('0xd')][_0x33ad4b[_0x0228('0x70')]]){var _0x4242e7=_[_0x0228('0x7a')](this['queueReports'][_0x33ad4b[_0x0228('0x70')]]);if(_0x4242e7){if(this[_0x0228('0x5f')](_0x33ad4b[_0x0228('0xa5')])&&this[_0x0228('0x5f')](_0x33ad4b[_0x0228('0xa5')][_0x0228('0xa6')])){switch(_0x33ad4b[_0x0228('0xa4')]){case'CONTINUE':_0x4242e7[_0x0228('0x8f')]=![];_0x4242e7[_0x0228('0x90')]=null;break;case _0x0228('0xa7'):_0x4242e7['lastevent']=_0x0228('0xa8');_0x4242e7[_0x0228('0x8f')]=!![];_0x4242e7[_0x0228('0x90')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4242e7[_0x0228('0x86')]=moment()[_0x0228('0x42')](_0x0228('0x87'));logger[_0x0228('0x40')](_0x0228('0xa9'),_0x33ad4b[_0x0228('0x70')],util[_0x0228('0x39')](_0x4242e7,{'showHidden':![],'depth':null}));ami[_0x0228('0x3f')](_0x0228('0xaa'),_0x4242e7);break;default:_0x4242e7['queuecallerexit']=!![];_0x4242e7['queuecallerexitAt']=moment()['format'](_0x0228('0x87'));_0x4242e7['queuecallerleaveAt']=moment()[_0x0228('0x42')](_0x0228('0x87'));}_0x4242e7['queuecallerabandon']=![];_0x4242e7[_0x0228('0x7e')]=null;_0x4242e7[_0x0228('0x7f')]=_0x33ad4b['value'];this[_0x0228('0xf')][_0x33ad4b[_0x0228('0x70')]]=_0x4242e7;this[_0x0228('0x84')](_0x4242e7,_0x0228('0x21'));}else if(this['isNotNull'](_0x33ad4b[_0x0228('0xa5')])&&this[_0x0228('0x5f')](_0x33ad4b[_0x0228('0xa5')][_0x0228('0xab')])){if(!_0x4242e7[_0x0228('0x1a')]){_0x4242e7['queuecallerexit']=!![];_0x4242e7['queuecallerexitAt']=moment()[_0x0228('0x42')](_0x0228('0x87'));_0x4242e7['queuecallerexitreason']='EXITWITHKEY';_0x4242e7['queuecallerleaveAt']=moment()['format'](_0x0228('0x87'));this[_0x0228('0xf')][_0x33ad4b[_0x0228('0x70')]]=_0x4242e7;}}logger[_0x0228('0x82')](_0x0228('0xac'),_0x33ad4b[_0x0228('0x70')],_0x4242e7[_0x0228('0x48')],_0x4242e7[_0x0228('0x4c')],_[_0x0228('0xa3')](_0x33ad4b[_0x0228('0xa5')])[0x0],_0x33ad4b[_0x0228('0xa4')]);_0x4242e7[_0x0228('0x3a')]=this[_0x0228('0x3a')][_0x33ad4b[_0x0228('0x70')]];}}}}catch(_0x47911d){logger[_0x0228('0x38')]('[%s][voiceQueueReport][varset]',_0x33ad4b[_0x0228('0x70')],util['inspect'](_0x47911d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0228('0x31')][_0x0228('0xa2')]=function(_0x1c71b7,_0x15feb7,_0x28765a){var _0x590d04=[_0x0228('0xad'),_0x0228('0xae'),_0x0228('0xaf'),_0x0228('0xb0'),_0x0228('0xb1'),'rtpaudioqoslossbridged',_0x0228('0xb2'),_0x0228('0xb3'),_0x0228('0xb4'),'sipuri','bridgepeer',_0x0228('0xb5'),_0x0228('0xb6'),_0x0228('0xb7'),_0x0228('0xb8'),_0x0228('0xb9'),_0x0228('0x8e'),_0x0228('0xba'),_0x0228('0xbb')];if(!_[_0x0228('0x34')](_0x15feb7)&&!_['includes'](_0x590d04,_0x15feb7)){if(_[_0x0228('0x60')](this[_0x0228('0x3a')][_0x1c71b7])){this[_0x0228('0x3a')][_0x1c71b7]={};}this[_0x0228('0x3a')][_0x1c71b7][_0x15feb7]=_0x28765a;}};VoiceQueueReport[_0x0228('0x31')][_0x0228('0x24')]=function(_0x573870){try{if(this['isNotNull'](_0x573870)){logger['debug'](_0x0228('0xbc'),_0x573870[_0x0228('0x70')],util[_0x0228('0x39')](_0x573870,{'showHidden':![],'depth':null}));if(this[_0x0228('0xd')][_0x573870[_0x0228('0x70')]]){for(var _0x4fae6f=0x0,_0x28e5f7={};_0x4fae6f0x0?_0x1c4aec:0x0;this[_0x801f('0x10')][_0x49f851[_0x801f('0x6a')]][_0x801f('0x30')]=this[_0x801f('0x10')][_0x49f851[_0x801f('0x6a')]]['talking']>_[_0x801f('0x6e')](_0x49f851[_0x801f('0x6f')])?_[_0x801f('0x6e')](_0x49f851['loggedin']):this['voiceQueues'][_0x49f851['queue']][_0x801f('0x30')];this['emitVoiceQueueSummary'](this[_0x801f('0x10')][_0x49f851[_0x801f('0x6a')]],_0x801f('0x14'));}logger[_0x801f('0x45')](_0x801f('0x71'),util[_0x801f('0x3d')](this[_0x801f('0x10')][_0x49f851['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0x801f('0x72'),this[_0x801f('0x10')][_0x49f851['queue']]);}}}catch(_0x68c6f4){logger[_0x801f('0x3b')](_0x801f('0x73'),util['inspect'](_0x68c6f4,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x801f('0x17')]=function(_0x5b1665){logger[_0x801f('0x45')](_0x801f('0x74'),util[_0x801f('0x3d')](_0x5b1665,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x801f('0xa')][_0x801f('0x18')]=function(_0x522236){try{if(this[_0x801f('0x64')](_0x522236)){logger[_0x801f('0x45')](_0x801f('0x75'),_0x522236[_0x801f('0x48')],util['inspect'](_0x522236,{'showHidden':![],'depth':null}));if(_[_0x801f('0x65')](this[_0x801f('0x3e')][_0x522236[_0x801f('0x48')]]))this['queueReports'][_0x522236['uniqueid']]=[];if(_['isUndefined'](this[_0x801f('0xf')][_0x522236[_0x801f('0x48')]]))this['channels'][_0x522236[_0x801f('0x48')]]={};var _0x1c581b=new QueueReport();_0x1c581b['name']=_0x522236[_0x801f('0x6a')];_0x1c581b[_0x801f('0x5a')]=this['voiceQueues'][_0x1c581b['name']]&&this[_0x801f('0x10')][_0x1c581b[_0x801f('0x4e')]][_0x801f('0x5a')]?this[_0x801f('0x10')][_0x1c581b[_0x801f('0x4e')]][_0x801f('0x5a')]||_0x801f('0x51'):_0x801f('0x51');_0x1c581b[_0x801f('0x6a')]=_0x522236[_0x801f('0x6a')];_0x1c581b[_0x801f('0x76')]=moment()['format'](_0x801f('0x77'));_0x1c581b[_0x801f('0x78')]=_0x522236['position'];_0x1c581b[_0x801f('0x79')]=_0x522236['count'];_0x1c581b[_0x801f('0x48')]=_0x522236[_0x801f('0x48')];_0x1c581b[_0x801f('0x7a')]=this['channels'][_0x522236[_0x801f('0x48')]][_0x801f('0x7a')];logger[_0x801f('0x6b')](_0x801f('0x7b'),_0x1c581b[_0x801f('0x4e')],_0x1c581b[_0x801f('0x5a')]);_[_0x801f('0x7c')](_0x1c581b,_[_0x801f('0x7d')](_0x522236,_[_0x801f('0x7e')](_0x1c581b)));this[_0x801f('0x3e')][_0x522236[_0x801f('0x48')]][_0x801f('0x7f')](_0x1c581b);this[_0x801f('0xf')][_0x522236[_0x801f('0x48')]]=_0x1c581b;this[_0x801f('0x44')](_0x1c581b,'queuecallerjoin');}}catch(_0x3bd306){logger[_0x801f('0x3b')](_0x801f('0x75'),_0x522236[_0x801f('0x48')],util[_0x801f('0x3d')](_0x3bd306,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x801f('0xa')][_0x801f('0x1a')]=function(_0x26d41d){try{if(this[_0x801f('0x64')](_0x26d41d)){logger[_0x801f('0x45')](_0x801f('0x80'),_0x26d41d[_0x801f('0x48')],util['inspect'](_0x26d41d,{'showHidden':![],'depth':null}));if(this[_0x801f('0x3e')][_0x26d41d[_0x801f('0x48')]]){var _0x147688=_['last'](this[_0x801f('0x3e')][_0x26d41d[_0x801f('0x48')]]);_0x147688[_0x801f('0x81')]=![];_0x147688[_0x801f('0x82')]=null;_0x147688[_0x801f('0x83')]=_0x26d41d[_0x801f('0x83')];_0x147688['originalposition']=_0x26d41d[_0x801f('0x84')];_0x147688['queuecallerabandon']=!![];_0x147688['queuecallerabandonAt']=moment()[_0x801f('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x147688[_0x801f('0x85')]='ABANDONED';_0x147688[_0x801f('0x86')]=null;logger[_0x801f('0x6b')](_0x801f('0x87'),_0x147688[_0x801f('0x4e')],_0x147688['type']);this[_0x801f('0xf')][_0x26d41d['uniqueid']]=_0x147688;this[_0x801f('0x4c')](_0x147688,_0x801f('0x19'));}}}catch(_0xf511f){logger[_0x801f('0x3b')](_0x801f('0x80'),_0x26d41d[_0x801f('0x48')],util[_0x801f('0x3d')](_0xf511f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x801f('0xa')][_0x801f('0x88')]=function(_0x1bc6a3){try{if(this['isNotNull'](_0x1bc6a3)){logger[_0x801f('0x45')](_0x801f('0x89'),_0x1bc6a3['uniqueid'],util[_0x801f('0x3d')](_0x1bc6a3,{'showHidden':![],'depth':null}));if(this[_0x801f('0x3e')][_0x1bc6a3[_0x801f('0x48')]]){var _0x475458=_[_0x801f('0x8a')](this[_0x801f('0x3e')][_0x1bc6a3[_0x801f('0x48')]]);_0x475458[_0x801f('0x8b')]=moment()[_0x801f('0x49')](_0x801f('0x77'));_0x475458['connectedlinenum']=_0x1bc6a3[_0x801f('0x8c')];_0x475458[_0x801f('0x8d')]=_0x1bc6a3[_0x801f('0x8d')];logger[_0x801f('0x6b')](_0x801f('0x8e'),_0x475458[_0x801f('0x4e')],_0x475458[_0x801f('0x5a')],_0x1bc6a3[_0x801f('0x8c')],_0x1bc6a3[_0x801f('0x8d')]);this['channels'][_0x1bc6a3[_0x801f('0x48')]]=_0x475458;this['emitVoiceQueueChannelSave'](_0x475458,_0x801f('0x1b'));}}}catch(_0x2900fa){logger[_0x801f('0x3b')](_0x801f('0x89'),_0x1bc6a3['uniqueid'],util[_0x801f('0x3d')](_0x2900fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x1905d5){try{if(this['isNotNull'](_0x1905d5)){logger[_0x801f('0x45')](_0x801f('0x8f'),_0x1905d5['uniqueid'],util['inspect'](_0x1905d5,{'showHidden':![],'depth':null}));if(this[_0x801f('0x3e')][_0x1905d5[_0x801f('0x48')]]){var _0x422d23=_[_0x801f('0x8a')](this[_0x801f('0x3e')][_0x1905d5[_0x801f('0x48')]]);_0x422d23[_0x801f('0x81')]=!![];_0x422d23['queuecallerexitreason']=_0x801f('0x90');logger[_0x801f('0x6b')](_0x801f('0x91'),_0x422d23[_0x801f('0x4e')],_0x422d23[_0x801f('0x5a')]);}}}catch(_0x2b18fb){logger[_0x801f('0x3b')](_0x801f('0x8f'),_0x1905d5[_0x801f('0x48')],util['inspect'](_0x2b18fb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x801f('0x1d')]=function(_0xfb1c6e){try{if(this[_0x801f('0x64')](_0xfb1c6e)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0xfb1c6e[_0x801f('0x48')],util[_0x801f('0x3d')](_0xfb1c6e,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xfb1c6e[_0x801f('0x48')]]){var _0x521e3e=_[_0x801f('0x8a')](this[_0x801f('0x3e')][_0xfb1c6e['uniqueid']]);_0x521e3e[_0x801f('0x19')]=![];_0x521e3e[_0x801f('0x92')]=null;_0x521e3e[_0x801f('0x93')]=!![];_0x521e3e[_0x801f('0x86')]=_0xfb1c6e[_0x801f('0x94')];_0x521e3e['holdtime']=_0xfb1c6e[_0x801f('0x83')];_0x521e3e[_0x801f('0x81')]=!![];_0x521e3e[_0x801f('0x95')]=![];_0x521e3e[_0x801f('0x96')]=null;if(!_0x521e3e[_0x801f('0x97')]){if(_0xfb1c6e[_0x801f('0x98')]==_0x801f('0x97')){_0x521e3e[_0x801f('0x85')]='COMPLETED';logger[_0x801f('0x6b')](_0x801f('0x99'),_0x521e3e[_0x801f('0x4e')],_0x521e3e[_0x801f('0x5a')]);}else{if(_[_0x801f('0x9a')](_0xfb1c6e[_0x801f('0x37')][_0x801f('0x9b')](),'local/')){if(this[_0x801f('0x3e')][_0xfb1c6e[_0x801f('0x9c')]]){var _0x35206b=_[_0x801f('0x8a')](this[_0x801f('0x3e')][_0xfb1c6e['linkedid']]);_0x35206b[_0x801f('0x81')]=![];_0x35206b[_0x801f('0x95')]=!![];_0x35206b[_0x801f('0x96')]=moment(_0x521e3e[_0x801f('0x76')])[_0x801f('0x9d')](_0xfb1c6e[_0x801f('0x83')],_0x801f('0x9e'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x35206b[_0x801f('0x85')]=_0x801f('0x9f');_0x35206b['transfer']=!![];_0x35206b[_0x801f('0xa0')]='FORWARD';_0x35206b[_0x801f('0xa1')]=_0xfb1c6e[_0x801f('0xa2')];_0x35206b[_0x801f('0xa3')]=_0xfb1c6e['uniqueid'];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x35206b[_0x801f('0x4e')],_0x35206b[_0x801f('0x5a')]);var _0x3b2b32=this[_0x801f('0x3e')][_0xfb1c6e[_0x801f('0x9c')]];this['queueReports'][_0xfb1c6e[_0x801f('0x9c')]]=this[_0x801f('0x3e')][_0xfb1c6e['uniqueid']];this[_0x801f('0x3e')][_0xfb1c6e[_0x801f('0x48')]]=_0x3b2b32;}}else{_0x521e3e[_0x801f('0x85')]=_0x801f('0xa4')+_0xfb1c6e['reason'][_0x801f('0xa5')]();logger[_0x801f('0x6b')](_0x801f('0xa6'),_0x521e3e['name'],_0x521e3e[_0x801f('0x5a')],_0x521e3e[_0x801f('0x85')]);}}}this['channels'][_0xfb1c6e[_0x801f('0x48')]]=_0x521e3e;this[_0x801f('0x4c')](_0x521e3e,_0x801f('0x1c'));}}}catch(_0x1746ef){logger[_0x801f('0x3b')](_0x801f('0xa7'),_0xfb1c6e[_0x801f('0x48')],util[_0x801f('0x3d')](_0x1746ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x801f('0xa')][_0x801f('0x20')]=function(_0x2571df){try{if(this[_0x801f('0x64')](_0x2571df)){logger[_0x801f('0x45')](_0x801f('0xa8'),_0x2571df['uniqueid'],util[_0x801f('0x3d')](_0x2571df,{'showHidden':![],'depth':null}));this[_0x801f('0xa9')](_0x2571df[_0x801f('0x48')],_['keys'](_0x2571df[_0x801f('0xaa')])[0x0],_0x2571df[_0x801f('0xab')]);if(this[_0x801f('0x3e')][_0x2571df[_0x801f('0x48')]]){var _0xbec88c=_[_0x801f('0x8a')](this[_0x801f('0x3e')][_0x2571df[_0x801f('0x48')]]);if(_0xbec88c){if(this['isNotNull'](_0x2571df[_0x801f('0xaa')])&&this[_0x801f('0x64')](_0x2571df[_0x801f('0xaa')]['queuestatus'])){switch(_0x2571df['value']){case _0x801f('0xac'):_0xbec88c['queuecallerexit']=![];_0xbec88c[_0x801f('0x96')]=null;break;case _0x801f('0xad'):_0xbec88c[_0x801f('0xae')]=_0x801f('0xaf');_0xbec88c[_0x801f('0x95')]=!![];_0xbec88c[_0x801f('0x96')]=moment()[_0x801f('0x49')](_0x801f('0x77'));_0xbec88c[_0x801f('0x8b')]=moment()['format'](_0x801f('0x77'));logger[_0x801f('0x45')](_0x801f('0xb0'),_0x2571df['uniqueid'],util['inspect'](_0xbec88c,{'showHidden':![],'depth':null}));ami['emit'](_0x801f('0xb1'),_0xbec88c);break;default:_0xbec88c[_0x801f('0x95')]=!![];_0xbec88c[_0x801f('0x96')]=moment()[_0x801f('0x49')](_0x801f('0x77'));_0xbec88c[_0x801f('0x8b')]=moment()[_0x801f('0x49')](_0x801f('0x77'));}_0xbec88c['queuecallerabandon']=![];_0xbec88c['queuecallerabandonAt']=null;_0xbec88c[_0x801f('0x85')]=_0x2571df[_0x801f('0xab')];this['channels'][_0x2571df[_0x801f('0x48')]]=_0xbec88c;this['emitVoiceQueueChannelRemove'](_0xbec88c,_0x801f('0xb2'));}else if(this['isNotNull'](_0x2571df[_0x801f('0xaa')])&&this[_0x801f('0x64')](_0x2571df[_0x801f('0xaa')][_0x801f('0xb3')])){if(!_0xbec88c[_0x801f('0x19')]){_0xbec88c[_0x801f('0x95')]=!![];_0xbec88c[_0x801f('0x96')]=moment()[_0x801f('0x49')](_0x801f('0x77'));_0xbec88c[_0x801f('0x85')]=_0x801f('0xb4');_0xbec88c[_0x801f('0x8b')]=moment()[_0x801f('0x49')](_0x801f('0x77'));this[_0x801f('0xf')][_0x2571df[_0x801f('0x48')]]=_0xbec88c;}}logger[_0x801f('0x6b')](_0x801f('0xb5'),_0x2571df[_0x801f('0x48')],_0xbec88c[_0x801f('0x4e')],_0xbec88c[_0x801f('0x5a')],_[_0x801f('0x7e')](_0x2571df['variable'])[0x0],_0x2571df['value']);_0xbec88c[_0x801f('0x13')]=this[_0x801f('0x13')][_0x2571df[_0x801f('0x48')]];}}}}catch(_0x2b7f69){logger[_0x801f('0x3b')]('[%s][voiceQueueReport][varset]',_0x2571df[_0x801f('0x48')],util[_0x801f('0x3d')](_0x2b7f69,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x134c18,_0x1e0e11,_0x3a6eee){var _0x84a415=[_0x801f('0xb6'),'rtpaudioqosbridged',_0x801f('0xb7'),'rtpaudioqosjitterbridged',_0x801f('0xb8'),_0x801f('0xb9'),_0x801f('0xba'),_0x801f('0xbb'),'sipcallid',_0x801f('0xbc'),_0x801f('0xbd'),_0x801f('0xbe'),'membercalls',_0x801f('0xbf'),_0x801f('0xc0'),'memberlastcall',_0x801f('0x94'),_0x801f('0xc1'),_0x801f('0xc2')];if(!_[_0x801f('0xc3')](_0x1e0e11)&&!_['includes'](_0x84a415,_0x1e0e11)){if(_[_0x801f('0x65')](this[_0x801f('0x13')][_0x134c18])){this['variables'][_0x134c18]={};}this[_0x801f('0x13')][_0x134c18][_0x1e0e11]=_0x3a6eee;}};VoiceQueueReport[_0x801f('0xa')][_0x801f('0xc4')]=function(_0xb05abd){try{if(this[_0x801f('0x64')](_0xb05abd)){logger[_0x801f('0x45')](_0x801f('0xc5'),_0xb05abd[_0x801f('0x48')],util[_0x801f('0x3d')](_0xb05abd,{'showHidden':![],'depth':null}));if(this[_0x801f('0x3e')][_0xb05abd['uniqueid']]){for(var _0x2db951=0x0,_0x5b54eb={};_0x2db951=0x0?moment(_0x3bc0eb['endtime'])['diff'](_0x3bc0eb[_0x2f2f('0x1b')],_0x2f2f('0xf')):null,'data1':_0x2f2f('0x1c'),'data2':_0x3bc0eb[_0x2f2f('0x15')],'data3':_0x3bc0eb['exten'],'data4':_0x3bc0eb[_0x2f2f('0x1d')]||null,'role':'agent','internal':_0x3bc0eb[_0x2f2f('0x15')]?_[_0x2f2f('0x14')](_0x3bc0eb[_0x2f2f('0x15')]):undefined,'uniqueid':_0x3bc0eb[_0x2f2f('0x16')]},'log':_0x2f2f('0x17')});}; \ No newline at end of file +var _0xf320=['inbound','exten','agent','accountcode','toNumber','voiceDialReport','membername','starttime','endtime','seconds','outbound','dialstring','uniqueid','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','SIP/%s','interface','TALKING','queuecallerleaveAt','diff'];(function(_0x2ac84e,_0x3d8931){var _0x481a04=function(_0x367b52){while(--_0x367b52){_0x2ac84e['push'](_0x2ac84e['shift']());}};_0x481a04(++_0x3d8931);}(_0xf320,0xbb));var _0x0f32=function(_0x1b8f5a,_0x57c154){_0x1b8f5a=_0x1b8f5a-0x0;var _0x594189=_0xf320[_0x1b8f5a];return _0x594189;};'use strict';var moment=require('moment');var _=require(_0x0f32('0x0'));var util=require(_0x0f32('0x1'));var client=require(_0x0f32('0x2'));exports[_0x0f32('0x3')]=function(_0x3dc2ad){var _0x42b617=_0x3dc2ad[_0x0f32('0x4')]||_0x3dc2ad[_0x0f32('0x5')];return client[_0x0f32('0x6')](_0x0f32('0x7'),{'body':{'channel':_0x0f32('0x8'),'membername':_0x3dc2ad[_0x0f32('0x9')],'interface':_[_0x0f32('0xa')](_0x3dc2ad['interface'])?util['format'](_0x0f32('0xb'),_0x3dc2ad[_0x0f32('0x9')]):_0x3dc2ad[_0x0f32('0xc')],'type':_0x0f32('0xd'),'enterAt':_0x3dc2ad[_0x0f32('0xe')],'exitAt':_0x42b617,'duration':moment(_0x42b617)[_0x0f32('0xf')](_0x3dc2ad['queuecallerleaveAt'],'seconds'),'data1':_0x0f32('0x10'),'data2':_0x3dc2ad['calleridnum'],'data3':_0x3dc2ad[_0x0f32('0x11')],'data4':null,'data5':_0x3dc2ad['queue'],'role':_0x0f32('0x12'),'internal':_0x3dc2ad[_0x0f32('0x13')]?_[_0x0f32('0x14')](_0x3dc2ad[_0x0f32('0x13')]):undefined,'uniqueid':_0x3dc2ad['uniqueid']},'log':'CreateMemberReport'});};exports[_0x0f32('0x15')]=function(_0x2ea67b){return client['Request'](_0x0f32('0x7'),{'body':{'channel':_0x0f32('0x8'),'membername':_0x2ea67b[_0x0f32('0x16')],'interface':_0x2ea67b['interface'],'type':_0x0f32('0xd'),'enterAt':_0x2ea67b[_0x0f32('0x17')],'exitAt':_0x2ea67b[_0x0f32('0x18')],'duration':moment(_0x2ea67b[_0x0f32('0x18')])[_0x0f32('0xf')](_0x2ea67b['starttime'],_0x0f32('0x19'))>=0x0?moment(_0x2ea67b['endtime'])['diff'](_0x2ea67b[_0x0f32('0x17')],_0x0f32('0x19')):null,'data1':_0x0f32('0x1a'),'data2':_0x2ea67b[_0x0f32('0x13')],'data3':_0x2ea67b['exten'],'data4':_0x2ea67b[_0x0f32('0x1b')]||null,'role':'agent','internal':_0x2ea67b[_0x0f32('0x13')]?_[_0x0f32('0x14')](_0x2ea67b[_0x0f32('0x13')]):undefined,'uniqueid':_0x2ea67b[_0x0f32('0x1c')]},'log':_0x0f32('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8cad3e8..3011111 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 _0x2964=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x3cb7ab,_0x417129){var _0x18e65b=function(_0x1f77ec){while(--_0x1f77ec){_0x3cb7ab['push'](_0x3cb7ab['shift']());}};_0x18e65b(++_0x417129);}(_0x2964,0x108));var _0x4296=function(_0x12a5c2,_0x1802da){_0x12a5c2=_0x12a5c2-0x0;var _0x47ac93=_0x2964[_0x12a5c2];return _0x47ac93;};'use strict';var client=require(_0x4296('0x0'));exports[_0x4296('0x1')]=function(){return client[_0x4296('0x2')](_0x4296('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x4296('0x4'),_0x4296('0x5')]},'log':_0x4296('0x6')});}; \ No newline at end of file +var _0xabad=['GetSettings','../client','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x426a37,_0x1d32df){var _0x4e9e28=function(_0x420223){while(--_0x420223){_0x426a37['push'](_0x426a37['shift']());}};_0x4e9e28(++_0x1d32df);}(_0xabad,0x150));var _0xdaba=function(_0x58fc2b,_0x368286){_0x58fc2b=_0x58fc2b-0x0;var _0x3937ce=_0xabad[_0x58fc2b];return _0x3937ce;};'use strict';var client=require(_0xdaba('0x0'));exports['getSettings']=function(){return client[_0xdaba('0x1')](_0xdaba('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdaba('0x3'),'previewRecallmeReminderInterval']},'log':_0xdaba('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9785ea0..f0cf753 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 _0x6a42=['../client','getTemplates','GetTemplate','name','html'];(function(_0x184920,_0x154b2c){var _0x22f406=function(_0x2e745a){while(--_0x2e745a){_0x184920['push'](_0x184920['shift']());}};_0x22f406(++_0x154b2c);}(_0x6a42,0x6e));var _0x26a4=function(_0x1c2c28,_0x3857f7){_0x1c2c28=_0x1c2c28-0x0;var _0x23a521=_0x6a42[_0x1c2c28];return _0x23a521;};'use strict';var client=require(_0x26a4('0x0'));exports[_0x26a4('0x1')]=function(_0x47aaa9){return function(_0x1b7244){return client['Request'](_0x26a4('0x2'),{'options':{'raw':!![],'attributes':['id',_0x26a4('0x3'),_0x26a4('0x4')]},'log':_0x26a4('0x2')});};}; \ No newline at end of file +var _0x0bf7=['../client','Request','GetTemplate','name','html'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0bf7,0x14a));var _0x70bf=function(_0x5becbd,_0x5b68b5){_0x5becbd=_0x5becbd-0x0;var _0x304e4b=_0x0bf7[_0x5becbd];return _0x304e4b;};'use strict';var client=require(_0x70bf('0x0'));exports['getTemplates']=function(_0x2fda82){return function(_0x1d3eee){return client[_0x70bf('0x1')](_0x70bf('0x2'),{'options':{'raw':!![],'attributes':['id',_0x70bf('0x3'),_0x70bf('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 6d24ca4..b5df2c3 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 _0xc4e7=['AnyConditions','Action','Actions','data1','data2','data3','data6','data7','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value'];(function(_0x48a5a2,_0x98c715){var _0xea8e6=function(_0x468021){while(--_0x468021){_0x48a5a2['push'](_0x48a5a2['shift']());}};_0xea8e6(++_0x98c715);}(_0xc4e7,0x7a));var _0x7c4e=function(_0x36213c,_0x32e283){_0x36213c=_0x36213c-0x0;var _0xebc53=_0xc4e7[_0x36213c];return _0xebc53;};'use strict';var client=require(_0x7c4e('0x0'));exports['getTriggers']=function(_0x5e8f9c){return function(_0x269034){return client[_0x7c4e('0x1')](_0x7c4e('0x2'),{'options':{'raw':![],'attributes':['id',_0x7c4e('0x3'),_0x7c4e('0x4'),_0x7c4e('0x5')],'include':[{'model':_0x7c4e('0x6'),'as':_0x7c4e('0x7'),'attributes':['id',_0x7c4e('0x8'),_0x7c4e('0x9'),_0x7c4e('0xa')]},{'model':_0x7c4e('0x6'),'as':_0x7c4e('0xb'),'attributes':['id','field',_0x7c4e('0x9'),_0x7c4e('0xa')]},{'model':_0x7c4e('0xc'),'as':_0x7c4e('0xd'),'attributes':['id','action',_0x7c4e('0xe'),_0x7c4e('0xf'),_0x7c4e('0x10'),'data4','data5',_0x7c4e('0x11'),_0x7c4e('0x12')]}]},'log':_0x7c4e('0x2')});};}; \ No newline at end of file +var _0xee0e=['data3','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','channel','status','AllConditions','field','operator','Condition','Action','Actions','action','data1'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xee0e,0xe9));var _0xeee0=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xee0e[_0x154192];return _0x3c2792;};'use strict';var client=require(_0xeee0('0x0'));exports[_0xeee0('0x1')]=function(_0x36b9df){return function(_0x4097e1){return client[_0xeee0('0x2')](_0xeee0('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xeee0('0x4'),_0xeee0('0x5')],'include':[{'model':'Condition','as':_0xeee0('0x6'),'attributes':['id',_0xeee0('0x7'),_0xeee0('0x8'),'value']},{'model':_0xeee0('0x9'),'as':'AnyConditions','attributes':['id',_0xeee0('0x7'),_0xeee0('0x8'),'value']},{'model':_0xeee0('0xa'),'as':_0xeee0('0xb'),'attributes':['id',_0xeee0('0xc'),_0xeee0('0xd'),'data2',_0xeee0('0xe'),_0xeee0('0xf'),_0xeee0('0x10'),_0xeee0('0x11'),_0xeee0('0x12')]}]},'log':_0xeee0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 078f87c..25288c8 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 _0x8e18=['GetTrunk','defaultuser','getTrunks','Request'];(function(_0x12d812,_0x496bb7){var _0x3711ab=function(_0x3259da){while(--_0x3259da){_0x12d812['push'](_0x12d812['shift']());}};_0x3711ab(++_0x496bb7);}(_0x8e18,0x1ba));var _0x88e1=function(_0x504dde,_0x207ebc){_0x504dde=_0x504dde-0x0;var _0x5333c4=_0x8e18[_0x504dde];return _0x5333c4;};'use strict';var client=require('../client');exports[_0x88e1('0x0')]=function(_0x5e8209){return function(_0x3be3e8){return client[_0x88e1('0x1')](_0x88e1('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x88e1('0x3')]},'log':_0x88e1('0x2')});};}; \ No newline at end of file +var _0xe2a3=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x4233b1,_0x157346){var _0xf22d46=function(_0x2373fe){while(--_0x2373fe){_0x4233b1['push'](_0x4233b1['shift']());}};_0xf22d46(++_0x157346);}(_0xe2a3,0x67));var _0x3e2a=function(_0x200045,_0x4e5da1){_0x200045=_0x200045-0x0;var _0x566a8d=_0xe2a3[_0x200045];return _0x566a8d;};'use strict';var client=require(_0x3e2a('0x0'));exports[_0x3e2a('0x1')]=function(_0x5ac2c6){return function(_0x5d527f){return client[_0x3e2a('0x2')](_0x3e2a('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3e2a('0x4'),'registry','defaultuser']},'log':_0x3e2a('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3f747bf..fdf88a5 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x40c0a6,_0x98f0b5){var _0x5e0ece=function(_0xce9c49){while(--_0xce9c49){_0x40c0a6['push'](_0x40c0a6['shift']());}};_0x5e0ece(++_0x98f0b5);}(_0x70e0,0x17b));var _0x070e=function(_0x4af1a0,_0x5a2cc6){_0x4af1a0=_0x4af1a0-0x0;var _0x23bc77=_0x70e0[_0x4af1a0];return _0x23bc77;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe706,0xa3));var _0x6e70=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xe706[_0x34c063];return _0x2c63a3;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 53fe9f8..1bc7b62 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 _0xa845=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create'];(function(_0x1fc98a,_0x431b61){var _0xbfa679=function(_0x889cce){while(--_0x889cce){_0x1fc98a['push'](_0x1fc98a['shift']());}};_0xbfa679(++_0x431b61);}(_0xa845,0x16c));var _0x5a84=function(_0x4d6f67,_0x22ba63){_0x4d6f67=_0x4d6f67-0x0;var _0x4a4eb3=_0xa845[_0x4d6f67];return _0x4a4eb3;};'use strict';var client=require(_0x5a84('0x0'));exports[_0x5a84('0x1')]=function(_0x99e34d){return client[_0x5a84('0x2')]('CreateVoiceAgentReport',{'body':_0x99e34d,'log':_0x5a84('0x3')});};exports[_0x5a84('0x4')]=function(_0xf2df2,_0x1dd762,_0x40f2cc){return client['Request'](_0x5a84('0x5'),{'body':_0xf2df2,'options':{'where':{'uniqueid':_0x1dd762,'interface':_0x40f2cc,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xe267=['CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe267,0xff));var _0x7e26=function(_0x4527d8,_0x59e349){_0x4527d8=_0x4527d8-0x0;var _0x1ec91d=_0xe267[_0x4527d8];return _0x1ec91d;};'use strict';var client=require(_0x7e26('0x0'));exports['create']=function(_0x1b135d){return client['Request'](_0x7e26('0x1'),{'body':_0x1b135d,'log':_0x7e26('0x1')});};exports['update']=function(_0x38585d,_0x3399c2,_0x49337f){return client[_0x7e26('0x2')](_0x7e26('0x3'),{'body':_0x38585d,'options':{'where':{'uniqueid':_0x3399c2,'interface':_0x49337f,'agentcomplete':!![]}},'log':_0x7e26('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 6e381a6..9f637a9 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 _0x8cee=['context','callerid','getVoiceCallReports','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','calleridnum'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8cee,0x109));var _0xe8ce=function(_0x533373,_0x590a06){_0x533373=_0x533373-0x0;var _0x2f4cc1=_0x8cee[_0x533373];return _0x2f4cc1;};'use strict';var moment=require(_0xe8ce('0x0'));var util=require(_0xe8ce('0x1'));var _=require(_0xe8ce('0x2'));var client=require(_0xe8ce('0x3'));exports[_0xe8ce('0x4')]=function(_0x579b35){return client[_0xe8ce('0x5')](_0xe8ce('0x6'),{'body':_['merge'](_0x579b35,{'source':_0x579b35[_0xe8ce('0x7')],'destinationcontext':_0x579b35[_0xe8ce('0x8')],'callerid':_0x579b35[_0xe8ce('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0xe8ce('0xa')]=function(){return function(){return client['Request'](_0xe8ce('0xb'),{'options':{'where':{'type':[_0xe8ce('0xc')],'createdAt':{'$between':[moment()['startOf']('day')[_0xe8ce('0xd')](_0xe8ce('0xe')),moment()[_0xe8ce('0xf')](_0xe8ce('0x10'))[_0xe8ce('0xd')](_0xe8ce('0xe'))]}},'attributes':[_0xe8ce('0x11'),_0xe8ce('0x12'),_0xe8ce('0x13'),'billableseconds']},'log':_0xe8ce('0x14')});};}; \ No newline at end of file +var _0xd021=['util','../client','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment'];(function(_0x219c32,_0x2e5c63){var _0x442f4e=function(_0x52ba14){while(--_0x52ba14){_0x219c32['push'](_0x219c32['shift']());}};_0x442f4e(++_0x2e5c63);}(_0xd021,0x1cd));var _0x1d02=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd021[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x1d02('0x0'));var util=require(_0x1d02('0x1'));var _=require('lodash');var client=require(_0x1d02('0x2'));exports['create']=function(_0x2e5328){return client[_0x1d02('0x3')](_0x1d02('0x4'),{'body':_[_0x1d02('0x5')](_0x2e5328,{'source':_0x2e5328[_0x1d02('0x6')],'destinationcontext':_0x2e5328[_0x1d02('0x7')],'callerid':_0x2e5328[_0x1d02('0x8')],'amaflags':_0x1d02('0x9')}),'log':_0x1d02('0x4')});};exports[_0x1d02('0xa')]=function(){return function(){return client[_0x1d02('0x3')](_0x1d02('0xb'),{'options':{'where':{'type':[_0x1d02('0xc')],'createdAt':{'$between':[moment()['startOf'](_0x1d02('0xd'))[_0x1d02('0xe')](_0x1d02('0xf')),moment()[_0x1d02('0x10')](_0x1d02('0xd'))[_0x1d02('0xe')](_0x1d02('0xf'))]}},'attributes':[_0x1d02('0x11'),_0x1d02('0x12'),_0x1d02('0x13'),_0x1d02('0x14')]},'log':_0x1d02('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index e4a10ae..8e6f772 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 _0xd204=['CreateVoiceDialReport','create','Request'];(function(_0x4781d8,_0x120900){var _0x2f142d=function(_0x4223ed){while(--_0x4223ed){_0x4781d8['push'](_0x4781d8['shift']());}};_0x2f142d(++_0x120900);}(_0xd204,0x1ab));var _0x4d20=function(_0x124ff2,_0x2ba925){_0x124ff2=_0x124ff2-0x0;var _0x177e51=_0xd204[_0x124ff2];return _0x177e51;};'use strict';var client=require('../client');exports[_0x4d20('0x0')]=function(_0x301738){return client[_0x4d20('0x1')](_0x4d20('0x2'),{'body':_0x301738,'log':_0x4d20('0x2')});}; \ No newline at end of file +var _0x56fa=['Request','CreateVoiceDialReport','../client','create'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0x56fa,0x7a));var _0xa56f=function(_0x1396d6,_0x308485){_0x1396d6=_0x1396d6-0x0;var _0x5e9468=_0x56fa[_0x1396d6];return _0x5e9468;};'use strict';var client=require(_0xa56f('0x0'));exports[_0xa56f('0x1')]=function(_0x1655db){return client[_0xa56f('0x2')](_0xa56f('0x3'),{'body':_0x1655db,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 819ce05..2e04f02 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 _0x0fd9=['Request','GetVoiceExtension','exten','getVoiceExtensions'];(function(_0x54d998,_0x5451bc){var _0x1b4f9c=function(_0x330e14){while(--_0x330e14){_0x54d998['push'](_0x54d998['shift']());}};_0x1b4f9c(++_0x5451bc);}(_0x0fd9,0xa3));var _0x90fd=function(_0x414f67,_0x861aed){_0x414f67=_0x414f67-0x0;var _0x338537=_0x0fd9[_0x414f67];return _0x338537;};'use strict';var client=require('../client');exports[_0x90fd('0x0')]=function(){return function(){return client[_0x90fd('0x1')](_0x90fd('0x2'),{'options':{'raw':!![],'attributes':['id',_0x90fd('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xce3a=['exten','recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xce3a,0x194));var _0xace3=function(_0x120d6b,_0x33169d){_0x120d6b=_0x120d6b-0x0;var _0x15f377=_0xce3a[_0x120d6b];return _0x15f377;};'use strict';var client=require(_0xace3('0x0'));exports[_0xace3('0x1')]=function(){return function(){return client[_0xace3('0x2')](_0xace3('0x3'),{'options':{'raw':!![],'attributes':['id',_0xace3('0x4'),_0xace3('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xace3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4d83fb8..1ef8eb5 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 _0xdb83=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x39bf04,_0x45d907){var _0xa8a474=function(_0x331eae){while(--_0x331eae){_0x39bf04['push'](_0x39bf04['shift']());}};_0xa8a474(++_0x45d907);}(_0xdb83,0xff));var _0x3db8=function(_0x428ff0,_0x44444c){_0x428ff0=_0x428ff0-0x0;var _0x1202bb=_0xdb83[_0x428ff0];return _0x1202bb;};'use strict';var client=require(_0x3db8('0x0'));exports[_0x3db8('0x1')]=function(){return function(){return client[_0x3db8('0x2')](_0x3db8('0x3'),{'options':{'raw':![],'attributes':['id',_0x3db8('0x4'),_0x3db8('0x5'),_0x3db8('0x6'),_0x3db8('0x7'),_0x3db8('0x8'),_0x3db8('0x9'),_0x3db8('0xa'),_0x3db8('0xb'),_0x3db8('0xc'),_0x3db8('0xd'),_0x3db8('0xe'),'dialPredictiveOptimization',_0x3db8('0xf'),_0x3db8('0x10'),_0x3db8('0x11'),_0x3db8('0x12'),_0x3db8('0x13'),_0x3db8('0x14'),_0x3db8('0x15'),_0x3db8('0x16'),_0x3db8('0x17'),'dialCongestionRetryFrequency',_0x3db8('0x18'),_0x3db8('0x19'),_0x3db8('0x1a'),_0x3db8('0x1b'),'dialGlobalMaxRetry',_0x3db8('0x1c'),'dialGlobalInterval',_0x3db8('0x1d'),'dialCheckDuplicateType',_0x3db8('0x1e'),_0x3db8('0x1f'),_0x3db8('0x20'),_0x3db8('0x21'),_0x3db8('0x22'),_0x3db8('0x23'),'dialAMDBetweenWordsSilence',_0x3db8('0x24'),_0x3db8('0x25'),'dialAMDMaximumWordLength',_0x3db8('0x26'),_0x3db8('0x27'),_0x3db8('0x28'),_0x3db8('0x29'),_0x3db8('0x2a'),_0x3db8('0x2b'),_0x3db8('0x2c'),_0x3db8('0x8'),_0x3db8('0x2d'),_0x3db8('0x2e'),_0x3db8('0x2f'),_0x3db8('0x30'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x3db8('0x31'),_0x3db8('0x32'),_0x3db8('0x33'),_0x3db8('0x34'),_0x3db8('0x35'),_0x3db8('0x36'),_0x3db8('0x37'),_0x3db8('0x38'),'dialPredictiveIntervalMaxThreshold',_0x3db8('0x39'),_0x3db8('0x3a'),_0x3db8('0x3b')],'include':[{'model':_0x3db8('0x3c'),'as':_0x3db8('0x3c'),'attributes':['id',_0x3db8('0x4'),'callerid',_0x3db8('0x3d')]},{'model':_0x3db8('0x3e'),'as':_0x3db8('0x3f'),'attributes':['id','name']},{'model':_0x3db8('0x3c'),'as':_0x3db8('0x40'),'attributes':['id','name',_0x3db8('0x41'),_0x3db8('0x3d')]},{'model':_0x3db8('0x42'),'as':_0x3db8('0x42'),'attributes':['id',_0x3db8('0x4')],'include':[{'model':_0x3db8('0x42'),'as':_0x3db8('0x43'),'attributes':['id','name',_0x3db8('0x44')]}]}]},'log':_0x3db8('0x1')});};}; \ No newline at end of file +var _0x32ce=['mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x32ce,0xc3));var _0xe32c=function(_0x2c3537,_0x46779f){_0x2c3537=_0x2c3537-0x0;var _0x42904c=_0x32ce[_0x2c3537];return _0x42904c;};'use strict';var client=require(_0xe32c('0x0'));exports[_0xe32c('0x1')]=function(){return function(){return client[_0xe32c('0x2')](_0xe32c('0x3'),{'options':{'raw':![],'attributes':['id',_0xe32c('0x4'),_0xe32c('0x5'),'acwTimeout',_0xe32c('0x6'),_0xe32c('0x7'),_0xe32c('0x8'),_0xe32c('0x9'),_0xe32c('0xa'),_0xe32c('0xb'),_0xe32c('0xc'),_0xe32c('0xd'),_0xe32c('0xe'),_0xe32c('0xf'),_0xe32c('0x10'),_0xe32c('0x11'),_0xe32c('0x12'),_0xe32c('0x13'),_0xe32c('0x14'),'dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry',_0xe32c('0x15'),'dialBusyMaxRetry',_0xe32c('0x16'),_0xe32c('0x17'),'dialNoAnswerRetryFrequency',_0xe32c('0x18'),_0xe32c('0x19'),_0xe32c('0x1a'),_0xe32c('0x1b'),_0xe32c('0x1c'),_0xe32c('0x1d'),'dialAMDInitialSilence',_0xe32c('0x1e'),_0xe32c('0x1f'),_0xe32c('0x20'),_0xe32c('0x21'),_0xe32c('0x22'),'dialAMDMaximumNumberOfWords',_0xe32c('0x23'),_0xe32c('0x24'),'timeout','dialRecallMeTimeout',_0xe32c('0x25'),_0xe32c('0x26'),'dialAgiAfterHangupAgent',_0xe32c('0x27'),_0xe32c('0x28'),_0xe32c('0x7'),'strategy',_0xe32c('0x29'),_0xe32c('0x2a'),'dialNoSuchNumberMaxRetry',_0xe32c('0x2b'),_0xe32c('0x2c'),_0xe32c('0x2d'),_0xe32c('0x2e'),_0xe32c('0x2f'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0xe32c('0x30'),_0xe32c('0x31'),_0xe32c('0x32'),_0xe32c('0x33'),'dialPreviewAutoRecallMe',_0xe32c('0x34')],'include':[{'model':_0xe32c('0x35'),'as':_0xe32c('0x35'),'attributes':['id',_0xe32c('0x4'),_0xe32c('0x36'),_0xe32c('0x37')]},{'model':_0xe32c('0x38'),'as':_0xe32c('0x39'),'attributes':['id',_0xe32c('0x4')]},{'model':_0xe32c('0x35'),'as':'TrunkBackup','attributes':['id','name',_0xe32c('0x36'),_0xe32c('0x37')]},{'model':'Interval','as':_0xe32c('0x3a'),'attributes':['id',_0xe32c('0x4')],'include':[{'model':_0xe32c('0x3a'),'as':_0xe32c('0x3b'),'attributes':['id',_0xe32c('0x4'),_0xe32c('0x3c')]}]}]},'log':_0xe32c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 9ebc48c..63b8649 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(_0x442cac,_0x5748b3){var _0xd96f05=function(_0x34a4c8){while(--_0x34a4c8){_0x442cac['push'](_0x442cac['shift']());}};_0xd96f05(++_0x5748b3);}(_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 +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(_0x27e814,_0x8a7830){var _0x5bdbf0=function(_0xb4970d){while(--_0xb4970d){_0x27e814['push'](_0x27e814['shift']());}};_0x5bdbf0(++_0x8a7830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 57802d8..aa337ba 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 _0x387d=['../client','getVoiceQueueRtPauses'];(function(_0x1e2aae,_0x2349e3){var _0x4d8a43=function(_0x305d4c){while(--_0x305d4c){_0x1e2aae['push'](_0x1e2aae['shift']());}};_0x4d8a43(++_0x2349e3);}(_0x387d,0x114));var _0xd387=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x387d[_0x36eaaa];return _0x461349;};'use strict';var client=require(_0xd387('0x0'));exports[_0xd387('0x1')]=function(_0x3c7884){return function(){return client['Request']('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x3c7884,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x9288=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x5bb367,_0x25c4cb){var _0x2442d2=function(_0x51260a){while(--_0x51260a){_0x5bb367['push'](_0x5bb367['shift']());}};_0x2442d2(++_0x25c4cb);}(_0x9288,0x173));var _0x8928=function(_0x3314cc,_0x58dd79){_0x3314cc=_0x3314cc-0x0;var _0xdf4b0b=_0x9288[_0x3314cc];return _0xdf4b0b;};'use strict';var client=require('../client');exports[_0x8928('0x0')]=function(_0x29c161){return function(){return client[_0x8928('0x1')](_0x8928('0x2'),{'options':{'where':{'VoiceQueueId':_0x29c161,'paused':!![]},'raw':!![]},'log':_0x8928('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index cc1a2d8..5f9552d 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x46bee1,_0x25d4d4){var _0x279156=function(_0x311aba){while(--_0x311aba){_0x46bee1['push'](_0x46bee1['shift']());}};_0x279156(++_0x25d4d4);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x5d993e,_0x397cfc){var _0x597c0e=function(_0x4ce2a3){while(--_0x4ce2a3){_0x5d993e['push'](_0x5d993e['shift']());}};_0x597c0e(++_0x397cfc);}(_0x7a54,0x106));var _0x47a5=function(_0x580b95,_0x1fc661){_0x580b95=_0x580b95-0x0;var _0x158ef6=_0x7a54[_0x580b95];return _0x158ef6;};'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 d47019c..d67ecd4 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 _0x8b95=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','attendedTransfer','CreateVoiceTransferReport','secondtransfererconnectedlinenum'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x8b95,0x1d6));var _0x58b9=function(_0x34ef6d,_0x326f28){_0x34ef6d=_0x34ef6d-0x0;var _0x57c2b1=_0x8b95[_0x34ef6d];return _0x57c2b1;};'use strict';var client=require('../client');exports[_0x58b9('0x0')]={};exports['blindTransfer']=function(_0x5dcc01){return client[_0x58b9('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x5dcc01[_0x58b9('0x2')],'transfererchannel':_0x5dcc01[_0x58b9('0x3')],'transferercalleridnum':_0x5dcc01[_0x58b9('0x4')],'transferercalleridname':_0x5dcc01[_0x58b9('0x5')],'transfererconnectedlinenum':_0x5dcc01[_0x58b9('0x6')],'transfererconnectedlinename':_0x5dcc01[_0x58b9('0x7')],'transfereraccountcode':_0x5dcc01[_0x58b9('0x8')],'transferercontext':_0x5dcc01[_0x58b9('0x9')],'transfererexten':_0x5dcc01['transfererexten'],'transfererlinkedid':_0x5dcc01[_0x58b9('0xa')],'transfereechannel':_0x5dcc01['transfereechannel'],'transfereecalleridnum':_0x5dcc01[_0x58b9('0xb')],'transfereecalleridname':_0x5dcc01[_0x58b9('0xc')],'transfereeconnectedlinenum':_0x5dcc01['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x5dcc01[_0x58b9('0xd')],'transfereeaccountcode':_0x5dcc01[_0x58b9('0xe')],'transfereecontext':_0x5dcc01[_0x58b9('0xf')],'transfereeexten':_0x5dcc01[_0x58b9('0x10')],'transfereelinkedid':_0x5dcc01[_0x58b9('0x11')],'isexternal':_0x5dcc01[_0x58b9('0x12')],'context':_0x5dcc01[_0x58b9('0x13')],'extension':_0x5dcc01[_0x58b9('0x14')],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0x58b9('0x15')]=function(_0x4a9d60){return client[_0x58b9('0x1')](_0x58b9('0x16'),{'body':{'result':_0x4a9d60['result'],'transfererchannel':_0x4a9d60['origtransfererchannel'],'transferercalleridnum':_0x4a9d60['origtransferercalleridnum'],'transferercalleridname':_0x4a9d60['origtransferercalleridname'],'transfererconnectedlinenum':_0x4a9d60[_0x58b9('0x17')],'transfererconnectedlinename':_0x4a9d60['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4a9d60[_0x58b9('0x18')],'transferercontext':_0x4a9d60[_0x58b9('0x19')],'transfererexten':_0x4a9d60[_0x58b9('0x1a')],'transfererlinkedid':_0x4a9d60[_0x58b9('0x1b')],'transfereechannel':_0x4a9d60[_0x58b9('0x1c')],'transfereecalleridnum':_0x4a9d60[_0x58b9('0x1d')],'transfereecalleridname':_0x4a9d60[_0x58b9('0x1e')],'transfereeconnectedlinenum':_0x4a9d60[_0x58b9('0x1f')],'transfereeconnectedlinename':_0x4a9d60[_0x58b9('0x20')],'transfereeaccountcode':_0x4a9d60[_0x58b9('0x21')],'transfereecontext':_0x4a9d60['transfertargetcontext'],'transfereeexten':_0x4a9d60['transfertargetexten'],'transfereelinkedid':_0x4a9d60[_0x58b9('0x22')],'isexternal':_0x4a9d60['isexternal'],'context':_0x4a9d60[_0x58b9('0x23')],'extension':_0x4a9d60[_0x58b9('0x24')],'type':_0x58b9('0x25')},'log':_0x58b9('0x16')});}; \ No newline at end of file +var _0xe09e=['attendedTransfer','CreateVoiceTransferReport','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','extension','blind'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xe09e,0xf5));var _0xee09=function(_0x5529f5,_0x4ab6e7){_0x5529f5=_0x5529f5-0x0;var _0x39cff4=_0xe09e[_0x5529f5];return _0x39cff4;};'use strict';var client=require(_0xee09('0x0'));exports['transfers']={};exports[_0xee09('0x1')]=function(_0x2d61a8){return client[_0xee09('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x2d61a8[_0xee09('0x3')],'transfererchannel':_0x2d61a8['transfererchannel'],'transferercalleridnum':_0x2d61a8[_0xee09('0x4')],'transferercalleridname':_0x2d61a8[_0xee09('0x5')],'transfererconnectedlinenum':_0x2d61a8[_0xee09('0x6')],'transfererconnectedlinename':_0x2d61a8[_0xee09('0x7')],'transfereraccountcode':_0x2d61a8['transfereraccountcode'],'transferercontext':_0x2d61a8[_0xee09('0x8')],'transfererexten':_0x2d61a8[_0xee09('0x9')],'transfererlinkedid':_0x2d61a8[_0xee09('0xa')],'transfereechannel':_0x2d61a8['transfereechannel'],'transfereecalleridnum':_0x2d61a8[_0xee09('0xb')],'transfereecalleridname':_0x2d61a8['transfereecalleridname'],'transfereeconnectedlinenum':_0x2d61a8[_0xee09('0xc')],'transfereeconnectedlinename':_0x2d61a8[_0xee09('0xd')],'transfereeaccountcode':_0x2d61a8[_0xee09('0xe')],'transfereecontext':_0x2d61a8['transfereecontext'],'transfereeexten':_0x2d61a8[_0xee09('0xf')],'transfereelinkedid':_0x2d61a8[_0xee09('0x10')],'isexternal':_0x2d61a8[_0xee09('0x11')],'context':_0x2d61a8[_0xee09('0x12')],'extension':_0x2d61a8[_0xee09('0x13')],'type':_0xee09('0x14')},'log':'CreateVoiceTransferReport'});};exports[_0xee09('0x15')]=function(_0xa7f9c5){return client['Request'](_0xee09('0x16'),{'body':{'result':_0xa7f9c5[_0xee09('0x3')],'transfererchannel':_0xa7f9c5['origtransfererchannel'],'transferercalleridnum':_0xa7f9c5[_0xee09('0x17')],'transferercalleridname':_0xa7f9c5[_0xee09('0x18')],'transfererconnectedlinenum':_0xa7f9c5[_0xee09('0x19')],'transfererconnectedlinename':_0xa7f9c5[_0xee09('0x1a')],'transfereraccountcode':_0xa7f9c5['origtransfereraccountcode'],'transferercontext':_0xa7f9c5[_0xee09('0x1b')],'transfererexten':_0xa7f9c5['secondtransfererexten'],'transfererlinkedid':_0xa7f9c5[_0xee09('0x1c')],'transfereechannel':_0xa7f9c5[_0xee09('0x1d')],'transfereecalleridnum':_0xa7f9c5[_0xee09('0x1e')],'transfereecalleridname':_0xa7f9c5[_0xee09('0x1f')],'transfereeconnectedlinenum':_0xa7f9c5[_0xee09('0x20')],'transfereeconnectedlinename':_0xa7f9c5['transfertargetconnectedlinename'],'transfereeaccountcode':_0xa7f9c5[_0xee09('0x21')],'transfereecontext':_0xa7f9c5[_0xee09('0x22')],'transfereeexten':_0xa7f9c5[_0xee09('0x23')],'transfereelinkedid':_0xa7f9c5['transfertargetlinkedid'],'isexternal':_0xa7f9c5[_0xee09('0x11')],'context':_0xa7f9c5[_0xee09('0x24')],'extension':_0xa7f9c5[_0xee09('0x25')],'type':'attended'},'log':_0xee09('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 04f9be6..20be942 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 _0xf69c=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','omit','undefined','voicechannel','map','find','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','status','MixMonitor\x20Success','mixmonitorid','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','event','emit','custom:','faxAccounts','send','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','username','join','pick','keys','module','Reload','Action','message','catch','error','isConnected','asterisk','ami\x20disconnected','command','action','Command','then','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x1bed71,_0x54e832){var _0x55afaf=function(_0x3bebc7){while(--_0x3bebc7){_0x1bed71['push'](_0x1bed71['shift']());}};_0x55afaf(++_0x54e832);}(_0xf69c,0x151));var _0xcf69=function(_0x5831a3,_0x4463b7){_0x5831a3=_0x5831a3-0x0;var _0x198912=_0xf69c[_0x5831a3];return _0x198912;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var jayson=require(_0xcf69('0x1'));var schema=require(_0xcf69('0x2'));var BPromise=require('bluebird');var moment=require(_0xcf69('0x3'));var config=require('../../../config/environment');var properties=require(_0xcf69('0x4'));var ami=require('../ami');exports[_0xcf69('0x5')]=function(_0x4d8180,_0x1c813d,_0x168197){return new BPromise(function(_0x225c65,_0x35aa67){var _0x3b7608={'QueuePause':function(_0x5f1e98){return new Promise(function(_0x38478c,_0xbeb916){var _0x46b433=util[_0xcf69('0x6')]('%s/%s',_0xcf69('0x7'),_0x5f1e98[_0xcf69('0x8')]);if(_0x4d8180[_0xcf69('0x9')]&&_0x4d8180[_0xcf69('0x9')][_0x46b433]&&_0x4d8180[_0xcf69('0x9')][_0x46b433][_0xcf69('0xa')]){_0x4d8180['timers'][_0x46b433][_0xcf69('0xb')]();}if(_0x4d8180['agents'][_0x46b433]){_0x4d8180[_0xcf69('0xc')][_0x46b433][_0xcf69('0xd')]({'statePause':_0x5f1e98[_0xcf69('0xe')]?!![]:![]});}_0x38478c({'code':0xc8,'message':_0xcf69('0xf')});});},'Reload':function(_0x329250){var _0x2981ab=this;return new Promise(function(_0x182dde,_0x34e299){if(ami['isConnected']()==![]){return _0x34e299(_0x2981ab['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xcf69('0x10')],'ami\x20disconnected'][_0xcf69('0x11')]('\x20')));}_0x329250=_[_0xcf69('0x12')](_0x329250,_[_0xcf69('0x13')](properties[_0xcf69('0x14')]));_0x329250['action']=_0xcf69('0x15');return ami[_0xcf69('0x16')](_0x329250)['then'](function(_0x486e06){_0x182dde({'code':0xc8,'message':_0x486e06[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x39306a){_0x34e299(_0x2981ab[_0xcf69('0x19')](0x1f5,_0x39306a[_0xcf69('0x17')]));});});},'Command':function(_0xfd30d2){var _0x120980=this;return new Promise(function(_0x210630,_0x53666e){if(ami[_0xcf69('0x1a')]()==![]){return _0x53666e(_0x120980['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}_0xfd30d2=_[_0xcf69('0x12')](_0xfd30d2,_0xcf69('0x1d'));_0xfd30d2[_0xcf69('0x1e')]=_0xcf69('0x1f');return ami[_0xcf69('0x16')](_0xfd30d2)[_0xcf69('0x20')](function(_0x7d86bc){_0x210630({'code':0xc8,'message':_0x7d86bc[_0xcf69('0x21')]});})[_0xcf69('0x18')](function(_0x3ec2fb){_0x53666e(_0x120980['error'](0x1f5,_0x3ec2fb[_0xcf69('0x17')]));});});},'VoiceQueues':function(_0x1abce9){return new Promise(function(_0x183067,_0x278ce3){var _0x9a006b=[];for(var _0x1a0b33 in _0x4d8180['voiceQueues']){if(_0x4d8180['voiceQueues'][_0xcf69('0x22')](_0x1a0b33)){var _0x59de98=_0x4d8180[_0xcf69('0x23')][_0x1a0b33];var _0x81a49f={'id':_0x59de98['id'],'name':_0x59de98[_0xcf69('0x8')],'strategy':_0x59de98[_0xcf69('0x24')],'answered':_0x59de98[_0xcf69('0x25')],'available':_0x59de98[_0xcf69('0x26')],'loggedIn':_0x59de98[_0xcf69('0x27')],'pTalking':_0x59de98[_0xcf69('0x28')],'sumBillable':_0x59de98['sumBillable'],'sumDuration':_0x59de98['sumDuration'],'sumHoldTime':_0x59de98[_0xcf69('0x29')]||0x0,'talking':_0x59de98[_0xcf69('0x2a')],'total':_0x59de98[_0xcf69('0x2b')],'type':_0x59de98[_0xcf69('0x2c')],'unmanaged':_0x59de98['unmanaged'],'abandoned':_0x59de98[_0xcf69('0x2d')],'waiting':_0x59de98[_0xcf69('0x2e')],'loggedInDb':_0x59de98[_0xcf69('0x2f')]};if(_0x59de98[_0xcf69('0x2c')]===_0xcf69('0x30')){_0x81a49f[_0xcf69('0x31')]=_0x59de98[_0xcf69('0x31')];_0x81a49f[_0xcf69('0x32')]=_0x59de98[_0xcf69('0x32')];_0x81a49f[_0xcf69('0x33')]=_0x59de98['dialOriginateCallerIdName'];_0x81a49f[_0xcf69('0x34')]=_0x59de98['dialOriginateCallerIdNumber'];_0x81a49f[_0xcf69('0x35')]=_0x59de98[_0xcf69('0x35')];_0x81a49f[_0xcf69('0x36')]=_0x59de98[_0xcf69('0x36')];_0x81a49f[_0xcf69('0x37')]=_0x59de98[_0xcf69('0x37')];_0x81a49f[_0xcf69('0x38')]=_0x59de98[_0xcf69('0x38')];_0x81a49f[_0xcf69('0x39')]=_0x59de98[_0xcf69('0x39')];_0x81a49f['outboundBlacklistCallsDay']=_0x59de98[_0xcf69('0x3a')];_0x81a49f[_0xcf69('0x3b')]=_0x59de98['outboundBusyCallsDay'];_0x81a49f[_0xcf69('0x3c')]=_0x59de98['outboundCongestionCallsDay'];_0x81a49f[_0xcf69('0x3d')]=_0x59de98['outboundDropCallsDayACS'];_0x81a49f['outboundDropCallsDayCallersExit']=_0x59de98[_0xcf69('0x3e')];_0x81a49f[_0xcf69('0x3f')]=_0x59de98[_0xcf69('0x3f')];_0x81a49f[_0xcf69('0x40')]=_0x59de98[_0xcf69('0x40')];_0x81a49f[_0xcf69('0x41')]=_0x59de98['outboundNoSuchCallsDay'];_0x81a49f['outboundOriginateFailureCallsDay']=_0x59de98[_0xcf69('0x42')];_0x81a49f[_0xcf69('0x43')]=_0x59de98[_0xcf69('0x43')];_0x81a49f[_0xcf69('0x44')]=_0x59de98[_0xcf69('0x44')];_0x81a49f[_0xcf69('0x45')]=_0x59de98[_0xcf69('0x45')];_0x81a49f[_0xcf69('0x46')]=_0x59de98[_0xcf69('0x46')];_0x81a49f[_0xcf69('0x47')]=_0x59de98[_0xcf69('0x47')];_0x81a49f[_0xcf69('0x48')]=_0x59de98[_0xcf69('0x48')];_0x81a49f[_0xcf69('0x49')]=_0x59de98[_0xcf69('0x49')];_0x81a49f[_0xcf69('0x4a')]=_0x59de98[_0xcf69('0x4a')];_0x81a49f[_0xcf69('0x4b')]=_0x59de98[_0xcf69('0x4b')];_0x81a49f[_0xcf69('0x4c')]=_0x59de98[_0xcf69('0x4c')];_0x81a49f['predictiveIntervalHitRate']=_0x59de98['predictiveIntervalHitRate'];_0x81a49f[_0xcf69('0x4d')]=_0x59de98[_0xcf69('0x4d')];_0x81a49f[_0xcf69('0x4e')]=_0x59de98[_0xcf69('0x4e')];_0x81a49f['predictiveIntervalAvailable']=_0x59de98[_0xcf69('0x4f')];_0x81a49f[_0xcf69('0x50')]=_0x59de98[_0xcf69('0x50')];_0x81a49f[_0xcf69('0x17')]=_0x59de98[_0xcf69('0x17')];_0x81a49f['originated']=_0x59de98[_0xcf69('0x51')];_0x81a49f[_0xcf69('0x52')]=_0x59de98['erlangCalls'];_0x81a49f[_0xcf69('0x53')]=_0x59de98[_0xcf69('0x53')];_0x81a49f[_0xcf69('0x54')]=_0x59de98['erlangAbandonmentRate'];_0x81a49f[_0xcf69('0x55')]=_0x59de98['erlangBusyFactor'];_0x81a49f[_0xcf69('0x56')]=_0x59de98[_0xcf69('0x56')];_0x81a49f['startProgressive']=_0x59de98['startProgressive'];}if(_0x59de98[_0xcf69('0x57')]){_0x81a49f[_0xcf69('0x57')]={'id':_0x59de98[_0xcf69('0x57')]['id'],'name':_0x59de98['Trunk']['name'],'active':_0x59de98[_0xcf69('0x57')][_0xcf69('0x58')],'callerid':_0x59de98['Trunk'][_0xcf69('0x59')]};}if(_0x59de98[_0xcf69('0x5a')]){_0x81a49f[_0xcf69('0x5a')]={'id':_0x59de98[_0xcf69('0x5a')]['id'],'name':_0x59de98[_0xcf69('0x5a')][_0xcf69('0x8')]};}_0x9a006b['push'](_0x81a49f);}}_0x183067({'count':_0x9a006b[_0xcf69('0x5b')],'rows':_0x9a006b});});},'UpdateVoiceQueue':function(_0x39522d){return new Promise(function(_0x3e33e6,_0x58e261){var _0x1a1270=_['find'](_0x4d8180[_0xcf69('0x23')],{'id':parseInt(_0x39522d['id'])});var _0x81d8a7=_[_0xcf69('0x5c')](_0x39522d,['id']);if(_0x1a1270){for(var _0x45c458 in _0x81d8a7){if(typeof _0x81d8a7[_0x45c458]!==_0xcf69('0x5d')&&typeof _0x1a1270[_0x45c458]!=='undefined'){_0x1a1270[_0x45c458]=_0x81d8a7[_0x45c458];}}_0x3e33e6(_0x1a1270);}else{_0x58e261();}});},'VoiceChannels':function(_0x57748d){return new Promise(function(_0xca4bc0,_0x29dfbf){var _0x43ded1=_['values'](_0x4d8180['channels']);_0xca4bc0({'count':_0x43ded1['length'],'rows':_0x43ded1});});},'VoiceChannelMixMonitor':function(_0x2f2b20){var _0x814320=this;return new Promise(function(_0x91069e,_0x4c55e4){if(ami[_0xcf69('0x1a')]()==![]){return _0x4c55e4(_0x814320['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config['asterisk'][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x2f8346=schema(properties[_0xcf69('0x5e')])[_0xcf69('0x2')](_0x2f2b20);if(_0x2f8346[_0xcf69('0x5b')]>0x0){return _0x4c55e4(_0x814320[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x2f8346,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52473a=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x61')],{'uniqueid':_0x2f2b20[_0xcf69('0x62')]});if(_0x52473a&&_0x52473a['channel']){var _0x294e08=util['format'](_0xcf69('0x63'),_0x2f2b20[_0xcf69('0x64')]||_0x2f2b20[_0xcf69('0x62')],_0x2f2b20[_0xcf69('0x6')]||_0xcf69('0x65'));return ami[_0xcf69('0x16')]({'action':_0xcf69('0x66'),'channel':_0x52473a[_0xcf69('0x67')],'file':_0x294e08,'options':_0xcf69('0x68')})[_0xcf69('0x20')](function(_0x2f83f6){var _0x2be62c=_[_0xcf69('0x60')](_0x52473a['monitors'],{'filename':_0xcf69('0x69')+_0x294e08[_0xcf69('0x6a')]()});if(_[_0xcf69('0x6b')](_0x2be62c)){_0x52473a['monitors']['push']({'filename':_0xcf69('0x69')+_0x294e08['toLowerCase'](),'createdAt':moment()[_0xcf69('0x6')](_0xcf69('0x6c')),'mixmonitorid':_0x2f83f6['mixmonitorid'],'status':_0xcf69('0x6d')});}else{_0x2be62c['mixmonitorid']=_0x2f83f6['mixmonitorid'];_0x2be62c[_0xcf69('0x6e')]=_0xcf69('0x6d');}_0x91069e({'code':0xc8,'message':[_0x2f2b20[_0xcf69('0x62')],_0xcf69('0x6f'),_0x2f83f6['mixmonitorid']][_0xcf69('0x11')]('\x20'),'mixmonitorid':_0x2f83f6[_0xcf69('0x70')]});})[_0xcf69('0x18')](function(_0x5996eb){_0x4c55e4(_0x814320['error'](0x1f5,[_0x2f2b20[_0xcf69('0x62')],_0x5996eb[_0xcf69('0x17')][_0xcf69('0x6a')]()]['join']('\x20')));});}else{return _0x4c55e4(_0x814320['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4ab987){var _0x5d036b=this;return new Promise(function(_0x4bfd20,_0x1ace3c){if(ami[_0xcf69('0x1a')]()==![]){return _0x1ace3c(_0x5d036b['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x19310e=schema(properties['voicechannel'])['validate'](_0x4ab987);if(_0x19310e[_0xcf69('0x5b')]>0x0){return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x19310e,_0xcf69('0x17'))['join'](',\x20')));}var _0x593502=_['find'](_0x4d8180['channels'],{'uniqueid':_0x4ab987[_0xcf69('0x62')]});if(_0x593502){return BPromise[_0xcf69('0x71')]()[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502['channel'],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x111089){});}})[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x73')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502[_0xcf69('0x73')],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x16d25d){});}})['then'](function(_0x1d5dc1){var _0x3e5450=_[_0xcf69('0x60')](_0x593502['monitors'],{'mixmonitorid':_0x4ab987[_0xcf69('0x70')]});if(_0x3e5450){_0x3e5450['status']=_0xcf69('0x74');}})['then'](function(){var _0x4b3250=util[_0xcf69('0x6')](_0xcf69('0x63'),_0x4ab987[_0xcf69('0x64')]||_0x4ab987[_0xcf69('0x62')],_0x4ab987[_0xcf69('0x6')]||'wav');var _0x5d098a=_[_0xcf69('0x60')](_0x593502[_0xcf69('0x75')],{'filename':'/var/spool/asterisk/monitor/'+_0x4b3250['toLowerCase']()});if(_0x5d098a){_0x5d098a['status']=_0xcf69('0x74');}})[_0xcf69('0x20')](function(){_0x4bfd20({'code':0xc8,'message':[_0x4ab987['uniqueid'],_0xcf69('0x76')]['join']('\x20')});})[_0xcf69('0x18')](function(_0x3b76ce){_0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,[_0x4ab987[_0xcf69('0x62')],_0x3b76ce[_0xcf69('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x188d15){return new Promise(function(_0x54cf09,_0x53ee6c){var _0x5a183e=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x78')]);_0x54cf09({'count':_0x5a183e[_0xcf69('0x5b')],'rows':_0x5a183e});});},'VoiceQueuesChannel':function(_0xbb5438){var _0x566520=this;return new Promise(function(_0x287912,_0x5658f4){var _0x243fda=schema(properties['voicequeuechannel'])[_0xcf69('0x2')](_0xbb5438);if(_0x243fda[_0xcf69('0x5b')]>0x0){return _0x5658f4(_0x566520['error'](0x1f4,_[_0xcf69('0x5f')](_0x243fda,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x490cce=_['find'](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0xbb5438[_0xcf69('0x62')]});if(_0x490cce){_0x287912(_0x490cce);}else{return _0x5658f4(_0x566520['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x38e0b2){var _0x746a64=this;return new Promise(function(_0x4bc426,_0x48774f){if(ami[_0xcf69('0x1a')]()==![]){return _0x48774f(_0x746a64['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')]['username'],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x5b68b8=schema(properties[_0xcf69('0x7a')])['validate'](_0x38e0b2);if(_0x5b68b8[_0xcf69('0x5b')]>0x0){return _0x48774f(_0x746a64[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x5b68b8,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52eae3=_[_0xcf69('0x60')](_0x4d8180['queueChannels'],{'uniqueid':_0x38e0b2[_0xcf69('0x62')]});if(_0x52eae3&&_0x52eae3[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7b'),'channel':_0x52eae3['channel']})['then'](function(_0x2f97f5){_0x4bc426({'code':0xc8,'message':[_0x38e0b2[_0xcf69('0x62')],_0x2f97f5[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')});})[_0xcf69('0x18')](function(_0x5d5dfe){_0x48774f(_0x746a64[_0xcf69('0x19')](0x1f5,[_0x38e0b2[_0xcf69('0x62')],_0x5d5dfe[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x48774f(_0x746a64['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x595e2f){var _0x4dbf4e=this;return new Promise(function(_0x96cf1d,_0x270e79){if(ami['isConnected']()==![]){return _0x270e79(_0x4dbf4e['error'](0x1f4,[config['asterisk']['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x3d1055=schema(properties[_0xcf69('0x7c')])['validate'](_0x595e2f);if(_0x3d1055[_0xcf69('0x5b')]>0x0){return _0x270e79(_0x4dbf4e[_0xcf69('0x19')](0x1f4,_['map'](_0x3d1055,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x3cfb21=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0x595e2f[_0xcf69('0x62')]});if(_0x3cfb21&&_0x3cfb21['channel']){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7d'),'channel':_0x3cfb21[_0xcf69('0x67')],'exten':_0x595e2f[_0xcf69('0x7e')],'context':_0x595e2f['context']||_0x3cfb21[_0xcf69('0x7f')],'priority':0x1})[_0xcf69('0x20')](function(_0x2cdcc3){_0x96cf1d({'code':0xc8,'message':[_0x595e2f[_0xcf69('0x62')],_0x2cdcc3['message'][_0xcf69('0x6a')]()]['join']('\x20')});})[_0xcf69('0x18')](function(_0x1af8a0){_0x270e79(_0x4dbf4e['error'](0x1f5,[_0x595e2f['uniqueid'],_0x1af8a0['message'][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x270e79(_0x4dbf4e['error'](0x1f5,_0xcf69('0x79')));}});},'Agents':function(_0x2002e1){return new Promise(function(_0x145bde,_0x2cd107){var _0x1cb7fd=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0xc')]);_0x145bde({'count':_0x1cb7fd[_0xcf69('0x5b')],'rows':_0x1cb7fd});});},'Telephones':function(_0x3f67d7){return new Promise(function(_0x4a7f65,_0x455dd0){var _0x2ca0d3=_[_0xcf69('0x77')](_0x4d8180['telephones']);_0x4a7f65({'count':_0x2ca0d3['length'],'rows':_0x2ca0d3});});},'Trunks':function(_0x57f3cb){return new Promise(function(_0x24194c,_0x587c1b){var _0x5eabdb=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x80')]);_0x24194c({'count':_0x5eabdb[_0xcf69('0x5b')],'rows':_0x5eabdb});});},'OutboundChannels':function(_0x352d40){return new Promise(function(_0x2b79f0,_0x1fc8db){var _0xeb1b54=_['values'](_0x4d8180[_0xcf69('0x81')]);_0x2b79f0({'count':_0xeb1b54[_0xcf69('0x5b')],'rows':_0xeb1b54});});},'Outbound':function(_0x29e5fc){return new Promise(function(_0x2fbec3,_0x53438c){_0x2fbec3(_0x4d8180[_0xcf69('0x30')]);});},'Campaigns':function(_0xf339fa){return new Promise(function(_0x29d887,_0x3c7db3){var _0xac1fa9=_['values'](_0x4d8180['campaigns']);_0x29d887({'count':_0xac1fa9[_0xcf69('0x5b')],'rows':_0xac1fa9});});},'VoiceQueuesPreview':function(_0x165f37){var _0x4ece02=this;return new Promise(function(_0x14e9d6,_0x45a3a7){_0x1c813d['run'](_0x165f37['id'])[_0xcf69('0x20')](function(_0x548195){_0x14e9d6({'code':0xc8,'message':_0x548195[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3d1fb0){_0x45a3a7(_0x4ece02[_0xcf69('0x19')](0x1f4,_0x3d1fb0[_0xcf69('0x17')]));});});},'EventManager':function(_0x1fe4a9){var _0x29574f=this;return new Promise(function(_0x478426,_0x3748b5){if(!_0x1fe4a9[_0xcf69('0x82')]){return _0x3748b5(_0x29574f[_0xcf69('0x19')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xcf69('0x83')](_0xcf69('0x84')+_0x1fe4a9['event'],_0x1fe4a9['message']);_0x478426({'code':0xc8,'message':_0x1fe4a9});});},'FaxAccounts':function(_0x11cdad){return new Promise(function(_0x437d15,_0x3f7b13){var _0x4c8346=_['values'](_0x4d8180[_0xcf69('0x85')]);_0x437d15({'count':_0x4c8346[_0xcf69('0x5b')],'rows':_0x4c8346});});},'SendFax':function(_0x8a4d91){var _0x47d3cb=this;return new Promise(function(_0x172362,_0x2f2ca0){_0x168197[_0xcf69('0x86')](_0x8a4d91)['then'](function(_0x363533){_0x172362({'code':0xc8,'message':_0x363533[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3e73b9){_0x2f2ca0(_0x47d3cb[_0xcf69('0x19')](0x1f4,_0x3e73b9[_0xcf69('0x17')]));});});},'CheckAfterSend':function(_0x2d1bbf){var _0x4bca3d=this;return new Promise(function(_0x3e29d3,_0x1279fc){_0x168197['checkAfterSend'](_0x2d1bbf)[_0xcf69('0x20')](function(_0x17ef57){_0x3e29d3({'code':0xc8,'message':_0x17ef57[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x18db19){_0x1279fc(_0x4bca3d[_0xcf69('0x19')](0x1f4,_0x18db19['message']));});});}};var _0x1d7528=jayson[_0xcf69('0x87')](_0x3b7608)[_0xcf69('0x88')]();_0x1d7528['on'](_0xcf69('0x19'),function(_0x220220){return _0x35aa67(_0x220220);});_0x1d7528['listen'](0x232a,_0xcf69('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x225c65(_0xcf69('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xe2bc=['jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','pick','keys','module','Action','then','message','catch','error','username','ami\x20disconnected','join','command','Command','content','voiceQueues','hasOwnProperty','answered','available','loggedIn','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','undefined','values','channels','voicechannel','validate','map','uniqueid','channel','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','mixmonitorid','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','status','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash'];(function(_0x4de02f,_0x2be2bf){var _0x4ad758=function(_0x4b37d0){while(--_0x4b37d0){_0x4de02f['push'](_0x4de02f['shift']());}};_0x4ad758(++_0x2be2bf);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xe2bc[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var jayson=require(_0xce2b('0x1'));var schema=require('validate');var BPromise=require(_0xce2b('0x2'));var moment=require(_0xce2b('0x3'));var config=require(_0xce2b('0x4'));var properties=require(_0xce2b('0x5'));var ami=require(_0xce2b('0x6'));exports['listen']=function(_0x29382b,_0x10b729,_0x3c15d3){return new BPromise(function(_0x343373,_0x22a898){var _0x54d279={'QueuePause':function(_0x972d2){return new Promise(function(_0x3ec031,_0x53c0de){var _0x97112a=util[_0xce2b('0x7')](_0xce2b('0x8'),_0xce2b('0x9'),_0x972d2[_0xce2b('0xa')]);if(_0x29382b[_0xce2b('0xb')]&&_0x29382b[_0xce2b('0xb')][_0x97112a]&&_0x29382b[_0xce2b('0xb')][_0x97112a][_0xce2b('0xc')]){_0x29382b[_0xce2b('0xb')][_0x97112a]['updateAcw']();}if(_0x29382b[_0xce2b('0xd')][_0x97112a]){_0x29382b['agents'][_0x97112a][_0xce2b('0xe')]({'statePause':_0x972d2[_0xce2b('0xf')]?!![]:![]});}_0x3ec031({'code':0xc8,'message':_0xce2b('0x10')});});},'Reload':function(_0xfb4ef5){var _0x33b6fe=this;return new Promise(function(_0x422c23,_0xd82158){if(ami[_0xce2b('0x11')]()==![]){return _0xd82158(_0x33b6fe['error'](0x1f4,[config[_0xce2b('0x12')]['ip'],config[_0xce2b('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}_0xfb4ef5=_[_0xce2b('0x13')](_0xfb4ef5,_[_0xce2b('0x14')](properties[_0xce2b('0x15')]));_0xfb4ef5['action']='Reload';return ami[_0xce2b('0x16')](_0xfb4ef5)[_0xce2b('0x17')](function(_0x8bf420){_0x422c23({'code':0xc8,'message':_0x8bf420[_0xce2b('0x18')]});})[_0xce2b('0x19')](function(_0x32fd68){_0xd82158(_0x33b6fe[_0xce2b('0x1a')](0x1f5,_0x32fd68[_0xce2b('0x18')]));});});},'Command':function(_0x3716f9){var _0x29b9e4=this;return new Promise(function(_0x4e92fd,_0x192002){if(ami[_0xce2b('0x11')]()==![]){return _0x192002(_0x29b9e4[_0xce2b('0x1a')](0x1f4,[config[_0xce2b('0x12')]['ip'],config[_0xce2b('0x12')][_0xce2b('0x1b')],_0xce2b('0x1c')][_0xce2b('0x1d')]('\x20')));}_0x3716f9=_[_0xce2b('0x13')](_0x3716f9,_0xce2b('0x1e'));_0x3716f9['action']=_0xce2b('0x1f');return ami[_0xce2b('0x16')](_0x3716f9)[_0xce2b('0x17')](function(_0x421f80){_0x4e92fd({'code':0xc8,'message':_0x421f80[_0xce2b('0x20')]});})[_0xce2b('0x19')](function(_0x1ceda5){_0x192002(_0x29b9e4[_0xce2b('0x1a')](0x1f5,_0x1ceda5[_0xce2b('0x18')]));});});},'VoiceQueues':function(_0x19d178){return new Promise(function(_0x14ca70,_0x56047c){var _0x49a52c=[];for(var _0x527b03 in _0x29382b[_0xce2b('0x21')]){if(_0x29382b['voiceQueues'][_0xce2b('0x22')](_0x527b03)){var _0x294af8=_0x29382b['voiceQueues'][_0x527b03];var _0x60eca0={'id':_0x294af8['id'],'name':_0x294af8[_0xce2b('0xa')],'strategy':_0x294af8['strategy'],'answered':_0x294af8[_0xce2b('0x23')],'available':_0x294af8[_0xce2b('0x24')],'loggedIn':_0x294af8[_0xce2b('0x25')],'pTalking':_0x294af8['pTalking'],'sumBillable':_0x294af8['sumBillable'],'sumDuration':_0x294af8[_0xce2b('0x26')],'sumHoldTime':_0x294af8[_0xce2b('0x27')]||0x0,'talking':_0x294af8[_0xce2b('0x28')],'total':_0x294af8['total'],'type':_0x294af8['type'],'unmanaged':_0x294af8[_0xce2b('0x29')],'abandoned':_0x294af8[_0xce2b('0x2a')],'waiting':_0x294af8[_0xce2b('0x2b')],'loggedInDb':_0x294af8['loggedInDb']};if(_0x294af8[_0xce2b('0x2c')]===_0xce2b('0x2d')){_0x60eca0[_0xce2b('0x2e')]=_0x294af8[_0xce2b('0x2e')];_0x60eca0[_0xce2b('0x2f')]=_0x294af8[_0xce2b('0x2f')];_0x60eca0[_0xce2b('0x30')]=_0x294af8['dialOriginateCallerIdName'];_0x60eca0[_0xce2b('0x31')]=_0x294af8['dialOriginateCallerIdNumber'];_0x60eca0[_0xce2b('0x32')]=_0x294af8[_0xce2b('0x32')];_0x60eca0[_0xce2b('0x33')]=_0x294af8[_0xce2b('0x33')];_0x60eca0[_0xce2b('0x34')]=_0x294af8['temp'];_0x60eca0[_0xce2b('0x35')]=_0x294af8[_0xce2b('0x35')];_0x60eca0[_0xce2b('0x36')]=_0x294af8[_0xce2b('0x36')];_0x60eca0[_0xce2b('0x37')]=_0x294af8[_0xce2b('0x37')];_0x60eca0[_0xce2b('0x38')]=_0x294af8[_0xce2b('0x38')];_0x60eca0[_0xce2b('0x39')]=_0x294af8[_0xce2b('0x39')];_0x60eca0[_0xce2b('0x3a')]=_0x294af8[_0xce2b('0x3a')];_0x60eca0[_0xce2b('0x3b')]=_0x294af8[_0xce2b('0x3b')];_0x60eca0[_0xce2b('0x3c')]=_0x294af8[_0xce2b('0x3c')];_0x60eca0['outboundNoAnswerCallsDay']=_0x294af8[_0xce2b('0x3d')];_0x60eca0['outboundNoSuchCallsDay']=_0x294af8[_0xce2b('0x3e')];_0x60eca0[_0xce2b('0x3f')]=_0x294af8[_0xce2b('0x3f')];_0x60eca0[_0xce2b('0x40')]=_0x294af8[_0xce2b('0x40')];_0x60eca0[_0xce2b('0x41')]=_0x294af8['outboundRejectCallsDay'];_0x60eca0[_0xce2b('0x42')]=_0x294af8[_0xce2b('0x42')];_0x60eca0[_0xce2b('0x43')]=_0x294af8[_0xce2b('0x43')];_0x60eca0[_0xce2b('0x44')]=_0x294af8[_0xce2b('0x44')];_0x60eca0['predictiveIntervalAvgTalktime']=_0x294af8[_0xce2b('0x45')];_0x60eca0[_0xce2b('0x46')]=_0x294af8[_0xce2b('0x46')];_0x60eca0[_0xce2b('0x47')]=_0x294af8[_0xce2b('0x47')];_0x60eca0[_0xce2b('0x48')]=_0x294af8['predictiveIntervalErlangCalls'];_0x60eca0['predictiveIntervalErlangCallsDroppedCalls']=_0x294af8[_0xce2b('0x49')];_0x60eca0[_0xce2b('0x4a')]=_0x294af8[_0xce2b('0x4a')];_0x60eca0[_0xce2b('0x4b')]=_0x294af8[_0xce2b('0x4b')];_0x60eca0[_0xce2b('0x4c')]=_0x294af8[_0xce2b('0x4c')];_0x60eca0[_0xce2b('0x4d')]=_0x294af8[_0xce2b('0x4d')];_0x60eca0[_0xce2b('0x4e')]=_0x294af8[_0xce2b('0x4e')];_0x60eca0[_0xce2b('0x18')]=_0x294af8[_0xce2b('0x18')];_0x60eca0[_0xce2b('0x4f')]=_0x294af8[_0xce2b('0x4f')];_0x60eca0['erlangCalls']=_0x294af8[_0xce2b('0x50')];_0x60eca0[_0xce2b('0x51')]=_0x294af8['erlangCallToSecond'];_0x60eca0[_0xce2b('0x52')]=_0x294af8['erlangAbandonmentRate'];_0x60eca0[_0xce2b('0x53')]=_0x294af8[_0xce2b('0x53')];_0x60eca0[_0xce2b('0x54')]=_0x294af8['startPredictive'];_0x60eca0[_0xce2b('0x55')]=_0x294af8[_0xce2b('0x55')];}if(_0x294af8['Trunk']){_0x60eca0['Trunk']={'id':_0x294af8[_0xce2b('0x56')]['id'],'name':_0x294af8[_0xce2b('0x56')][_0xce2b('0xa')],'active':_0x294af8[_0xce2b('0x56')][_0xce2b('0x57')],'callerid':_0x294af8['Trunk'][_0xce2b('0x58')]};}if(_0x294af8[_0xce2b('0x59')]){_0x60eca0[_0xce2b('0x59')]={'id':_0x294af8[_0xce2b('0x59')]['id'],'name':_0x294af8[_0xce2b('0x59')]['name']};}_0x49a52c[_0xce2b('0x5a')](_0x60eca0);}}_0x14ca70({'count':_0x49a52c[_0xce2b('0x5b')],'rows':_0x49a52c});});},'UpdateVoiceQueue':function(_0xc7a9b4){return new Promise(function(_0x3f0383,_0x334da3){var _0x30d668=_[_0xce2b('0x5c')](_0x29382b['voiceQueues'],{'id':parseInt(_0xc7a9b4['id'])});var _0x52909f=_['omit'](_0xc7a9b4,['id']);if(_0x30d668){for(var _0x346fd5 in _0x52909f){if(typeof _0x52909f[_0x346fd5]!==_0xce2b('0x5d')&&typeof _0x30d668[_0x346fd5]!==_0xce2b('0x5d')){_0x30d668[_0x346fd5]=_0x52909f[_0x346fd5];}}_0x3f0383(_0x30d668);}else{_0x334da3();}});},'VoiceChannels':function(_0x590437){return new Promise(function(_0x4ea31b,_0x4efd57){var _0x2b5334=_[_0xce2b('0x5e')](_0x29382b[_0xce2b('0x5f')]);_0x4ea31b({'count':_0x2b5334['length'],'rows':_0x2b5334});});},'VoiceChannelMixMonitor':function(_0x419308){var _0x83d2a3=this;return new Promise(function(_0x1b2bfb,_0x4f282d){if(ami[_0xce2b('0x11')]()==![]){return _0x4f282d(_0x83d2a3['error'](0x1f4,[config[_0xce2b('0x12')]['ip'],config[_0xce2b('0x12')][_0xce2b('0x1b')],'ami\x20disconnected'][_0xce2b('0x1d')]('\x20')));}var _0x34213c=schema(properties[_0xce2b('0x60')])[_0xce2b('0x61')](_0x419308);if(_0x34213c['length']>0x0){return _0x4f282d(_0x83d2a3[_0xce2b('0x1a')](0x1f4,_[_0xce2b('0x62')](_0x34213c,_0xce2b('0x18'))[_0xce2b('0x1d')](',\x20')));}var _0x14ecae=_['find'](_0x29382b[_0xce2b('0x5f')],{'uniqueid':_0x419308[_0xce2b('0x63')]});if(_0x14ecae&&_0x14ecae[_0xce2b('0x64')]){var _0x4bd2b0=util[_0xce2b('0x7')]('%s.%s',_0x419308[_0xce2b('0x65')]||_0x419308['uniqueid'],_0x419308[_0xce2b('0x7')]||_0xce2b('0x66'));return ami['Action']({'action':'MixMonitor','channel':_0x14ecae[_0xce2b('0x64')],'file':_0x4bd2b0,'options':_0xce2b('0x67')})[_0xce2b('0x17')](function(_0x492d01){var _0x736b95=_[_0xce2b('0x5c')](_0x14ecae['monitors'],{'filename':_0xce2b('0x68')+_0x4bd2b0[_0xce2b('0x69')]()});if(_[_0xce2b('0x6a')](_0x736b95)){_0x14ecae[_0xce2b('0x6b')][_0xce2b('0x5a')]({'filename':_0xce2b('0x68')+_0x4bd2b0['toLowerCase'](),'createdAt':moment()[_0xce2b('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x492d01[_0xce2b('0x6c')],'status':_0xce2b('0x6d')});}else{_0x736b95[_0xce2b('0x6c')]=_0x492d01[_0xce2b('0x6c')];_0x736b95['status']=_0xce2b('0x6d');}_0x1b2bfb({'code':0xc8,'message':[_0x419308[_0xce2b('0x63')],_0xce2b('0x6e'),_0x492d01[_0xce2b('0x6c')]]['join']('\x20'),'mixmonitorid':_0x492d01[_0xce2b('0x6c')]});})[_0xce2b('0x19')](function(_0x338fbb){_0x4f282d(_0x83d2a3[_0xce2b('0x1a')](0x1f5,[_0x419308[_0xce2b('0x63')],_0x338fbb[_0xce2b('0x18')][_0xce2b('0x69')]()]['join']('\x20')));});}else{return _0x4f282d(_0x83d2a3[_0xce2b('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x1b0ffa){var _0x20ccaf=this;return new Promise(function(_0x2ae9ae,_0x1546ff){if(ami[_0xce2b('0x11')]()==![]){return _0x1546ff(_0x20ccaf[_0xce2b('0x1a')](0x1f4,[config[_0xce2b('0x12')]['ip'],config[_0xce2b('0x12')]['username'],_0xce2b('0x1c')][_0xce2b('0x1d')]('\x20')));}var _0x230e22=schema(properties[_0xce2b('0x60')])[_0xce2b('0x61')](_0x1b0ffa);if(_0x230e22['length']>0x0){return _0x1546ff(_0x20ccaf[_0xce2b('0x1a')](0x1f4,_[_0xce2b('0x62')](_0x230e22,'message')[_0xce2b('0x1d')](',\x20')));}var _0x287072=_[_0xce2b('0x5c')](_0x29382b[_0xce2b('0x5f')],{'uniqueid':_0x1b0ffa[_0xce2b('0x63')]});if(_0x287072){return BPromise[_0xce2b('0x6f')]()[_0xce2b('0x17')](function(){if(_0x287072[_0xce2b('0x64')]){return ami[_0xce2b('0x16')]({'action':_0xce2b('0x70'),'channel':_0x287072[_0xce2b('0x64')],'mixmonitorid':_0x1b0ffa[_0xce2b('0x6c')]})[_0xce2b('0x19')](function(_0x2f604a){});}})['then'](function(){if(_0x287072[_0xce2b('0x71')]){return ami[_0xce2b('0x16')]({'action':_0xce2b('0x70'),'channel':_0x287072['destinationchannel'],'mixmonitorid':_0x1b0ffa[_0xce2b('0x6c')]})[_0xce2b('0x19')](function(_0x5e3cfe){});}})[_0xce2b('0x17')](function(_0xe9e1a3){var _0x56435f=_[_0xce2b('0x5c')](_0x287072[_0xce2b('0x6b')],{'mixmonitorid':_0x1b0ffa[_0xce2b('0x6c')]});if(_0x56435f){_0x56435f[_0xce2b('0x72')]=_0xce2b('0x73');}})[_0xce2b('0x17')](function(){var _0x36e527=util['format'](_0xce2b('0x74'),_0x1b0ffa[_0xce2b('0x65')]||_0x1b0ffa['uniqueid'],_0x1b0ffa[_0xce2b('0x7')]||_0xce2b('0x66'));var _0x448521=_[_0xce2b('0x5c')](_0x287072['monitors'],{'filename':_0xce2b('0x68')+_0x36e527[_0xce2b('0x69')]()});if(_0x448521){_0x448521['status']='stop';}})['then'](function(){_0x2ae9ae({'code':0xc8,'message':[_0x1b0ffa['uniqueid'],_0xce2b('0x75')][_0xce2b('0x1d')]('\x20')});})['catch'](function(_0x5c4652){_0x1546ff(_0x20ccaf[_0xce2b('0x1a')](0x1f5,[_0x1b0ffa[_0xce2b('0x63')],_0x5c4652[_0xce2b('0x18')]['toLowerCase']()][_0xce2b('0x1d')]('\x20')));});}else{return _0x1546ff(_0x20ccaf[_0xce2b('0x1a')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x3b2716){return new Promise(function(_0xeca50f,_0x2f47ed){var _0x2a3bdc=_['values'](_0x29382b[_0xce2b('0x76')]);_0xeca50f({'count':_0x2a3bdc[_0xce2b('0x5b')],'rows':_0x2a3bdc});});},'VoiceQueuesChannel':function(_0x542580){var _0x14e188=this;return new Promise(function(_0x54de07,_0x53fc7b){var _0x5c9b77=schema(properties[_0xce2b('0x77')])[_0xce2b('0x61')](_0x542580);if(_0x5c9b77[_0xce2b('0x5b')]>0x0){return _0x53fc7b(_0x14e188['error'](0x1f4,_['map'](_0x5c9b77,_0xce2b('0x18'))[_0xce2b('0x1d')](',\x20')));}var _0x43161b=_[_0xce2b('0x5c')](_0x29382b[_0xce2b('0x76')],{'uniqueid':_0x542580[_0xce2b('0x63')]});if(_0x43161b){_0x54de07(_0x43161b);}else{return _0x53fc7b(_0x14e188['error'](0x1f5,_0xce2b('0x78')));}});},'VoiceQueuesChannelHangup':function(_0xa02716){var _0x324251=this;return new Promise(function(_0x3656aa,_0x5079c3){if(ami['isConnected']()==![]){return _0x5079c3(_0x324251[_0xce2b('0x1a')](0x1f4,[config['asterisk']['ip'],config[_0xce2b('0x12')][_0xce2b('0x1b')],_0xce2b('0x1c')]['join']('\x20')));}var _0x56eb43=schema(properties[_0xce2b('0x79')])[_0xce2b('0x61')](_0xa02716);if(_0x56eb43[_0xce2b('0x5b')]>0x0){return _0x5079c3(_0x324251[_0xce2b('0x1a')](0x1f4,_[_0xce2b('0x62')](_0x56eb43,'message')[_0xce2b('0x1d')](',\x20')));}var _0x212800=_[_0xce2b('0x5c')](_0x29382b[_0xce2b('0x76')],{'uniqueid':_0xa02716[_0xce2b('0x63')]});if(_0x212800&&_0x212800[_0xce2b('0x64')]){return ami['Action']({'action':_0xce2b('0x7a'),'channel':_0x212800['channel']})['then'](function(_0x13bd8a){_0x3656aa({'code':0xc8,'message':[_0xa02716[_0xce2b('0x63')],_0x13bd8a[_0xce2b('0x18')]['toLowerCase']()][_0xce2b('0x1d')]('\x20')});})['catch'](function(_0x23a1e5){_0x5079c3(_0x324251['error'](0x1f5,[_0xa02716['uniqueid'],_0x23a1e5['message'][_0xce2b('0x69')]()][_0xce2b('0x1d')]('\x20')));});}else{return _0x5079c3(_0x324251['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x513dc3){var _0x4d8901=this;return new Promise(function(_0x35b9e3,_0x12313d){if(ami[_0xce2b('0x11')]()==![]){return _0x12313d(_0x4d8901['error'](0x1f4,[config[_0xce2b('0x12')]['ip'],config['asterisk'][_0xce2b('0x1b')],_0xce2b('0x1c')][_0xce2b('0x1d')]('\x20')));}var _0x4d902f=schema(properties[_0xce2b('0x7b')])[_0xce2b('0x61')](_0x513dc3);if(_0x4d902f[_0xce2b('0x5b')]>0x0){return _0x12313d(_0x4d8901[_0xce2b('0x1a')](0x1f4,_[_0xce2b('0x62')](_0x4d902f,_0xce2b('0x18'))[_0xce2b('0x1d')](',\x20')));}var _0x3ad82b=_[_0xce2b('0x5c')](_0x29382b[_0xce2b('0x76')],{'uniqueid':_0x513dc3[_0xce2b('0x63')]});if(_0x3ad82b&&_0x3ad82b[_0xce2b('0x64')]){return ami[_0xce2b('0x16')]({'action':_0xce2b('0x7c'),'channel':_0x3ad82b['channel'],'exten':_0x513dc3['exten'],'context':_0x513dc3[_0xce2b('0x7d')]||_0x3ad82b[_0xce2b('0x7d')],'priority':0x1})['then'](function(_0x209194){_0x35b9e3({'code':0xc8,'message':[_0x513dc3['uniqueid'],_0x209194[_0xce2b('0x18')][_0xce2b('0x69')]()]['join']('\x20')});})[_0xce2b('0x19')](function(_0x5b75e4){_0x12313d(_0x4d8901[_0xce2b('0x1a')](0x1f5,[_0x513dc3[_0xce2b('0x63')],_0x5b75e4[_0xce2b('0x18')]['toLowerCase']()][_0xce2b('0x1d')]('\x20')));});}else{return _0x12313d(_0x4d8901[_0xce2b('0x1a')](0x1f5,_0xce2b('0x78')));}});},'Agents':function(_0x515ca0){return new Promise(function(_0xbc41b8,_0x291590){var _0xfe1a81=_[_0xce2b('0x5e')](_0x29382b[_0xce2b('0xd')]);_0xbc41b8({'count':_0xfe1a81[_0xce2b('0x5b')],'rows':_0xfe1a81});});},'Telephones':function(_0x40c0fc){return new Promise(function(_0x19fff7,_0x557c84){var _0x1f34bd=_[_0xce2b('0x5e')](_0x29382b[_0xce2b('0x7e')]);_0x19fff7({'count':_0x1f34bd[_0xce2b('0x5b')],'rows':_0x1f34bd});});},'Trunks':function(_0x472a35){return new Promise(function(_0x2df567,_0x538176){var _0xc36ed8=_[_0xce2b('0x5e')](_0x29382b[_0xce2b('0x7f')]);_0x2df567({'count':_0xc36ed8['length'],'rows':_0xc36ed8});});},'OutboundChannels':function(_0x7dfc17){return new Promise(function(_0x3ee2ec,_0x5383bf){var _0x42bfd0=_['values'](_0x29382b[_0xce2b('0x80')]);_0x3ee2ec({'count':_0x42bfd0[_0xce2b('0x5b')],'rows':_0x42bfd0});});},'Outbound':function(_0x37f89e){return new Promise(function(_0x3fc6d3,_0x1a71eb){_0x3fc6d3(_0x29382b[_0xce2b('0x2d')]);});},'Campaigns':function(_0x26ffed){return new Promise(function(_0x356d55,_0x19f27a){var _0x1678df=_['values'](_0x29382b[_0xce2b('0x81')]);_0x356d55({'count':_0x1678df[_0xce2b('0x5b')],'rows':_0x1678df});});},'VoiceQueuesPreview':function(_0x1371b5){var _0x8c9465=this;return new Promise(function(_0x48225a,_0x6a2546){_0x10b729[_0xce2b('0x82')](_0x1371b5['id'])[_0xce2b('0x17')](function(_0x534234){_0x48225a({'code':0xc8,'message':_0x534234[_0xce2b('0x18')]});})[_0xce2b('0x19')](function(_0x5903bf){_0x6a2546(_0x8c9465[_0xce2b('0x1a')](0x1f4,_0x5903bf[_0xce2b('0x18')]));});});},'EventManager':function(_0x3ed2c6){var _0x4f889a=this;return new Promise(function(_0x2c6c6f,_0x5e3f6f){if(!_0x3ed2c6[_0xce2b('0x83')]){return _0x5e3f6f(_0x4f889a[_0xce2b('0x1a')](0x1f4,_0xce2b('0x84')));}ami[_0xce2b('0x85')](_0xce2b('0x86')+_0x3ed2c6[_0xce2b('0x83')],_0x3ed2c6[_0xce2b('0x18')]);_0x2c6c6f({'code':0xc8,'message':_0x3ed2c6});});},'FaxAccounts':function(_0x15c9b0){return new Promise(function(_0x2d27f6,_0x13fdec){var _0x5cf50b=_['values'](_0x29382b['faxAccounts']);_0x2d27f6({'count':_0x5cf50b['length'],'rows':_0x5cf50b});});},'SendFax':function(_0x2148c8){var _0x15d7a1=this;return new Promise(function(_0x12d895,_0x5ab72b){_0x3c15d3[_0xce2b('0x87')](_0x2148c8)[_0xce2b('0x17')](function(_0x2a8ac0){_0x12d895({'code':0xc8,'message':_0x2a8ac0[_0xce2b('0x18')]});})[_0xce2b('0x19')](function(_0x330d7a){_0x5ab72b(_0x15d7a1[_0xce2b('0x1a')](0x1f4,_0x330d7a[_0xce2b('0x18')]));});});},'CheckAfterSend':function(_0x2ca3ff){var _0x5d82fb=this;return new Promise(function(_0x41721a,_0x188fcc){_0x3c15d3[_0xce2b('0x88')](_0x2ca3ff)[_0xce2b('0x17')](function(_0x1e2e94){_0x41721a({'code':0xc8,'message':_0x1e2e94[_0xce2b('0x18')]});})[_0xce2b('0x19')](function(_0x41a0f6){_0x188fcc(_0x5d82fb[_0xce2b('0x1a')](0x1f4,_0x41a0f6[_0xce2b('0x18')]));});});}};var _0x2db301=jayson[_0xce2b('0x89')](_0x54d279)[_0xce2b('0x8a')]();_0x2db301['on'](_0xce2b('0x1a'),function(_0x11b765){return _0x22a898(_0x11b765);});_0x2db301['listen'](0x232a,_0xce2b('0x8b'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x343373(_0xce2b('0x8c')+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 eb3be60..7406e79 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 _0x4ea3=['toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','format','user:%s','name','trigger:%s','action'];(function(_0xeaf197,_0x1e35f1){var _0x250918=function(_0x1d8bc7){while(--_0x1d8bc7){_0xeaf197['push'](_0xeaf197['shift']());}};_0x250918(++_0x1e35f1);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x34ea('0x0'));var BPromise=require(_0x34ea('0x1'));var Redis=require(_0x34ea('0x2'));var util=require(_0x34ea('0x3'));var config=require('../../../../config/environment');var logger=require(_0x34ea('0x4'))('trigger');var cmContactRpc=require(_0x34ea('0x5'));config['redis']=_['defaults'](config[_0x34ea('0x6')],{'host':_0x34ea('0x7'),'port':0x18eb});var io=require(_0x34ea('0x8'))(new Redis(config[_0x34ea('0x6')]));function emit(_0x40434e,_0x18b461,_0x22b09e,_0x5bec7c,_0x341727){logger[_0x34ea('0x9')](_0x34ea('0xa'),_0x40434e,_0x18b461['id'],_0x22b09e,_0x5bec7c,JSON['stringify'](_0x341727));io['to'](_0x22b09e)[_0x34ea('0xb')](_0x5bec7c,_0x341727);}exports[_0x34ea('0xc')]=function(_0x5126de,_0x4a76b1,_0x5bd8b6,_0x346287){var _0x167667,_0x58bb0d;var _0x11229e={};var _0x29a5c8=Number(_0x5bd8b6[_0x34ea('0xd')]);var _0x233b11=_0x5bd8b6[_0x34ea('0xe')]?Boolean(Number(_0x5bd8b6[_0x34ea('0xe')])):![];var _0x37e1b4;var _0x36af43=![];if(!_[_0x34ea('0xf')](_0x5bd8b6[_0x34ea('0x10')])){if(_0x5bd8b6[_0x34ea('0x10')]=='1')_0x36af43=!![];}if(!_0x36af43){if(_0x346287['xmd-contactid']){_0x11229e['id']=_0x346287[_0x34ea('0x11')];}}if(!_0x11229e['id']){_0x11229e[_0x34ea('0x12')]=_0x29a5c8;_0x37e1b4=_0x5bd8b6[_0x34ea('0x13')]&&_0x5bd8b6[_0x34ea('0x13')]!=='0'?_0x5bd8b6[_0x34ea('0x13')]['split'](','):[_0x34ea('0x14')];_0x11229e[_0x34ea('0x15')]=_[_0x34ea('0x16')](_0x37e1b4,function(_0x305576){var _0x5f420f={};_0x5f420f[_0x305576]=_0x346287[_0x34ea('0x17')]?_0x346287[_0x34ea('0x18')]:_0x346287[_0x34ea('0x19')];return _0x5f420f;});}var _0x5340a4=['id',_0x34ea('0x1a'),_0x34ea('0x1b'),_0x34ea('0x14'),_0x34ea('0x1c'),'fax',_0x34ea('0x12'),_0x34ea('0x1d'),_0x34ea('0x1e'),_0x34ea('0x1f')];var _0x4fc1a2=_['union'](_0x5340a4,_0x37e1b4);BPromise[_0x34ea('0x20')]()[_0x34ea('0x21')](cmContactRpc[_0x34ea('0x22')]({'attributes':_0x4fc1a2,'where':_0x11229e}))['then'](function(_0x5197a2){_0x58bb0d=_0x5197a2;if(!_[_0x34ea('0x23')](_0x58bb0d)){if(_0x58bb0d[_0x34ea('0x24')]===0x1){_0x167667=_0x58bb0d[0x0];logger[_0x34ea('0x9')](_0x34ea('0x25'),_0x346287[_0x34ea('0x26')],_0x4a76b1['id'],_0x167667['id']);}else{logger[_0x34ea('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x346287[_0x34ea('0x26')],_0x4a76b1['id'],_[_0x34ea('0x16')](_0x58bb0d,'id')[_0x34ea('0x27')](','));}return;}else{logger[_0x34ea('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x346287['uniqueid'],_0x4a76b1['id']);var _0x564d1b={'ListId':_0x29a5c8};var _0x142709=_0x5bd8b6[_0x34ea('0x28')]&&_0x5bd8b6[_0x34ea('0x28')]!=='0'?_0x5bd8b6[_0x34ea('0x28')]:'phone';if(_0x233b11){logger[_0x34ea('0x9')](_0x34ea('0x29'),_0x346287[_0x34ea('0x26')],_0x4a76b1['id']);_0x564d1b[_0x142709]=_['isNil'](_0x346287['routeId'])?_0x346287['calleridnum']:_0x346287['destcalleridnum'];if(_[_0x34ea('0xf')](_0x346287[_0x34ea('0x17')])){_0x564d1b[_0x34ea('0x1a')]=_0x346287[_0x34ea('0x2a')]&&_0x346287['calleridname']!==_0x34ea('0x2b')?_0x346287['calleridname']:_0x34ea('0x2c');}else{_0x564d1b['firstName']=_0x346287[_0x34ea('0x2d')]&&_0x346287[_0x34ea('0x2d')]!==_0x34ea('0x2b')?_0x346287['destcalleridname']:_0x34ea('0x2c');}return BPromise[_0x34ea('0x20')]()['then'](cmContactRpc[_0x34ea('0x2e')](_0x564d1b))['then'](function(_0x1392b6){_0x167667=_0x1392b6;_0x58bb0d[_0x34ea('0x2f')](_0x1392b6);if(_0x167667){logger[_0x34ea('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x346287['uniqueid'],_0x4a76b1['id'],_0x167667['id']);}return;});}else{logger[_0x34ea('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x346287[_0x34ea('0x26')],_0x4a76b1['id']);_0x564d1b[_0x142709]=_[_0x34ea('0xf')](_0x346287['routeId'])?_0x346287[_0x34ea('0x19')]:_0x346287[_0x34ea('0x18')];if(_[_0x34ea('0xf')](_0x346287[_0x34ea('0x17')])){_0x564d1b['firstName']=_0x346287['calleridname']&&_0x346287['calleridname']!==_0x34ea('0x2b')?_0x346287[_0x34ea('0x2a')]:_0x34ea('0x2c');}else{_0x564d1b['firstName']=_0x346287['destcalleridname']&&_0x346287['destcalleridname']!==_0x34ea('0x2b')?_0x346287[_0x34ea('0x2d')]:'Unknown';}_0x167667=_0x564d1b;_0x58bb0d[_0x34ea('0x2f')](_0x564d1b);return;}}})[_0x34ea('0x21')](function(){if(_0x5126de){emit(_0x346287[_0x34ea('0x26')],_0x4a76b1,util[_0x34ea('0x30')](_0x34ea('0x31'),_0x5126de[_0x34ea('0x32')]),util['format'](_0x34ea('0x33'),_0x5bd8b6[_0x34ea('0x34')][_0x34ea('0x35')]()),{'evt':_[_0x34ea('0x36')](_0x346287,{'autoCreate':_0x233b11}),'contact':_0x167667===undefined?{}:_0x167667,'contacts':_0x58bb0d['length']===0x0?undefined:_0x58bb0d});}});}; \ No newline at end of file +var _0xac31=['mobile','fax','ListId','createdAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','info','[CM][%s][%s]\x20Contact\x20not\x20found','routeId','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','phone','$or','map','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x5c01bb,_0x44b01e){var _0x54e418=function(_0x5adfe8){while(--_0x5adfe8){_0x5c01bb['push'](_0x5c01bb['shift']());}};_0x54e418(++_0x44b01e);}(_0xac31,0xca));var _0x1ac3=function(_0x79ef5b,_0x2404b9){_0x79ef5b=_0x79ef5b-0x0;var _0x3e1f6d=_0xac31[_0x79ef5b];return _0x3e1f6d;};'use strict';var _=require(_0x1ac3('0x0'));var BPromise=require(_0x1ac3('0x1'));var Redis=require(_0x1ac3('0x2'));var util=require(_0x1ac3('0x3'));var config=require(_0x1ac3('0x4'));var logger=require(_0x1ac3('0x5'))(_0x1ac3('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1ac3('0x7')]=_[_0x1ac3('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1ac3('0x9'))(new Redis(config[_0x1ac3('0x7')]));function emit(_0x2bf9b1,_0x1be223,_0x157604,_0x57893c,_0x2d17de){logger['info'](_0x1ac3('0xa'),_0x2bf9b1,_0x1be223['id'],_0x157604,_0x57893c,JSON[_0x1ac3('0xb')](_0x2d17de));io['to'](_0x157604)[_0x1ac3('0xc')](_0x57893c,_0x2d17de);}exports['exec']=function(_0xa26c88,_0x1e2642,_0x3e835b,_0x24f0d2){var _0x2a8dc7,_0x422d19;var _0x4b5c92={};var _0x3b38fc=Number(_0x3e835b[_0x1ac3('0xd')]);var _0x2eeabf=_0x3e835b[_0x1ac3('0xe')]?Boolean(Number(_0x3e835b['data2'])):![];var _0x88ed7c;var _0x37d426=![];if(!_[_0x1ac3('0xf')](_0x3e835b[_0x1ac3('0x10')])){if(_0x3e835b['data5']=='1')_0x37d426=!![];}if(!_0x37d426){if(_0x24f0d2[_0x1ac3('0x11')]){_0x4b5c92['id']=_0x24f0d2[_0x1ac3('0x11')];}}if(!_0x4b5c92['id']){_0x4b5c92['ListId']=_0x3b38fc;_0x88ed7c=_0x3e835b[_0x1ac3('0x12')]&&_0x3e835b[_0x1ac3('0x12')]!=='0'?_0x3e835b[_0x1ac3('0x12')]['split'](','):[_0x1ac3('0x13')];_0x4b5c92[_0x1ac3('0x14')]=_[_0x1ac3('0x15')](_0x88ed7c,function(_0x541744){var _0x195683={};_0x195683[_0x541744]=_0x24f0d2['routeId']?_0x24f0d2[_0x1ac3('0x16')]:_0x24f0d2[_0x1ac3('0x17')];return _0x195683;});}var _0x20091d=['id',_0x1ac3('0x18'),_0x1ac3('0x19'),'phone',_0x1ac3('0x1a'),_0x1ac3('0x1b'),_0x1ac3('0x1c'),_0x1ac3('0x1d'),'scheduledAt','updatedAt'];var _0x2879d8=_[_0x1ac3('0x1e')](_0x20091d,_0x88ed7c);BPromise[_0x1ac3('0x1f')]()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x21')]({'attributes':_0x2879d8,'where':_0x4b5c92}))[_0x1ac3('0x20')](function(_0x23b767){_0x422d19=_0x23b767;if(!_[_0x1ac3('0x22')](_0x422d19)){if(_0x422d19[_0x1ac3('0x23')]===0x1){_0x2a8dc7=_0x422d19[0x0];logger['info'](_0x1ac3('0x24'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}else{logger['info'](_0x1ac3('0x26'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_['map'](_0x422d19,'id')[_0x1ac3('0x27')](','));}return;}else{logger[_0x1ac3('0x28')](_0x1ac3('0x29'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);var _0x10db3d={'ListId':_0x3b38fc};var _0x565a0f=_0x3e835b['data4']&&_0x3e835b['data4']!=='0'?_0x3e835b['data4']:'phone';if(_0x2eeabf){logger[_0x1ac3('0x28')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2['destcalleridnum'];if(_[_0x1ac3('0xf')](_0x24f0d2['routeId'])){_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2['destcalleridname']&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2e')]:_0x1ac3('0x2d');}return BPromise['resolve']()[_0x1ac3('0x20')](cmContactRpc[_0x1ac3('0x2f')](_0x10db3d))[_0x1ac3('0x20')](function(_0x294513){_0x2a8dc7=_0x294513;_0x422d19[_0x1ac3('0x30')](_0x294513);if(_0x2a8dc7){logger['info'](_0x1ac3('0x31'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id'],_0x2a8dc7['id']);}return;});}else{logger[_0x1ac3('0x28')](_0x1ac3('0x32'),_0x24f0d2[_0x1ac3('0x25')],_0x1e2642['id']);_0x10db3d[_0x565a0f]=_[_0x1ac3('0xf')](_0x24f0d2['routeId'])?_0x24f0d2[_0x1ac3('0x17')]:_0x24f0d2[_0x1ac3('0x16')];if(_[_0x1ac3('0xf')](_0x24f0d2[_0x1ac3('0x2a')])){_0x10db3d['firstName']=_0x24f0d2[_0x1ac3('0x2b')]&&_0x24f0d2[_0x1ac3('0x2b')]!==_0x1ac3('0x2c')?_0x24f0d2[_0x1ac3('0x2b')]:_0x1ac3('0x2d');}else{_0x10db3d[_0x1ac3('0x18')]=_0x24f0d2[_0x1ac3('0x2e')]&&_0x24f0d2[_0x1ac3('0x2e')]!==_0x1ac3('0x2c')?_0x24f0d2['destcalleridname']:_0x1ac3('0x2d');}_0x2a8dc7=_0x10db3d;_0x422d19[_0x1ac3('0x30')](_0x10db3d);return;}}})['then'](function(){if(_0xa26c88){emit(_0x24f0d2[_0x1ac3('0x25')],_0x1e2642,util[_0x1ac3('0x33')](_0x1ac3('0x34'),_0xa26c88[_0x1ac3('0x35')]),util[_0x1ac3('0x33')](_0x1ac3('0x36'),_0x3e835b[_0x1ac3('0x37')][_0x1ac3('0x38')]()),{'evt':_['merge'](_0x24f0d2,{'autoCreate':_0x2eeabf}),'contact':_0x2a8dc7===undefined?{}:_0x2a8dc7,'contacts':_0x422d19[_0x1ac3('0x23')]===0x0?undefined:_0x422d19});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 4c2d218..8ff8876 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 _0x0598=['name','trigger:%s:%s','jscripty','trigger:%s','contactmanager','exec','integration','queue','routeId','buildUri','parse','replace','channel','AllConditions','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','AccountId','value','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','util','url','mustache','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','zohoAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','interface','hasOwnProperty','checkTrigger','merge','variables','Actions','length','action','toLowerCase','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','windowHeight','data6','600','winApplication','winArguments','format','user:%s'];(function(_0x463463,_0x3513f9){var _0x5bdf3d=function(_0x43346d){while(--_0x43346d){_0x463463['push'](_0x463463['shift']());}};_0x5bdf3d(++_0x3513f9);}(_0x0598,0x19e));var _0x8059=function(_0x23502f,_0x1a99a7){_0x23502f=_0x23502f-0x0;var _0x5745b1=_0x0598[_0x23502f];return _0x5745b1;};'use strict';var util=require(_0x8059('0x0'));var _=require('lodash');var url=require(_0x8059('0x1'));var Mustache=require(_0x8059('0x2'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require(_0x8059('0x3'));var script=require(_0x8059('0x4'));var config=require(_0x8059('0x5'));var logger=require(_0x8059('0x6'))(_0x8059('0x7'));var ami=require(_0x8059('0x8'));config[_0x8059('0x9')]=_['defaults'](config[_0x8059('0x9')],{'host':_0x8059('0xa'),'port':0x18eb});var io=require(_0x8059('0xb'))(new Redis(config[_0x8059('0x9')]));var operators={'equals':function(_0x25bd1b,_0x4cf11a){return _0x25bd1b==_0x4cf11a;},'not_equals':function(_0x29343a,_0x533905){return _0x29343a!=_0x533905;}};var barAndWebActions=[_0x8059('0xc'),_0x8059('0x1'),_0x8059('0xd')];function Trigger(_0x151e57){this[_0x8059('0xe')]=_0x151e57[_0x8059('0xe')];this[_0x8059('0xf')]=_0x151e57['agents'];this[_0x8059('0x10')]=_0x151e57['voiceQueues'];this[_0x8059('0x11')]=_0x151e57[_0x8059('0x11')];this[_0x8059('0x12')]=_0x151e57['voiceExtensions'];this[_0x8059('0x13')]=_0x151e57['zendeskAccounts'];this['freshdeskAccounts']=_0x151e57[_0x8059('0x14')];this[_0x8059('0x15')]=_0x151e57['salesforceAccounts'];this[_0x8059('0x16')]=_0x151e57[_0x8059('0x16')];this['zohoAccounts']=_0x151e57['zohoAccounts'];this[_0x8059('0x17')]=_0x151e57['deskAccounts'];this['vtigerAccounts']=_0x151e57[_0x8059('0x18')];this['servicenowAccounts']=_0x151e57[_0x8059('0x19')];this[_0x8059('0x1a')]=_0x151e57[_0x8059('0x1a')];this[_0x8059('0x1b')]=_0x151e57[_0x8059('0x1b')];this[_0x8059('0x1c')]={'zendesk':this[_0x8059('0x13')],'salesforce':this[_0x8059('0x15')],'freshdesk':this[_0x8059('0x14')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x8059('0x1d')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x8059('0x1a')],'freshsales':this[_0x8059('0x1b')],'servicenow':this[_0x8059('0x19')]};ami['on'](_0x8059('0x1e'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on']('custom:agentconnect',this['syncCustomEvent'][_0x8059('0x20')](this));ami['on'](_0x8059('0x21'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x22'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x23'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x24'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x25'),this[_0x8059('0x1f')]['bind'](this));ami['on'](_0x8059('0x26'),this['syncCustomEvent'][_0x8059('0x20')](this));ami['on']('custom:agentreject',this['syncCustomEvent'][_0x8059('0x20')](this));ami['on'](_0x8059('0x27'),this[_0x8059('0x1f')]['bind'](this));ami['on'](_0x8059('0x28'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x29'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x2a'),this[_0x8059('0x2b')][_0x8059('0x20')](this));ami['on'](_0x8059('0x2c'),this[_0x8059('0x2b')][_0x8059('0x20')](this));ami['on'](_0x8059('0x2d'),this['syncAgentDial'][_0x8059('0x20')](this));ami['on'](_0x8059('0x2e'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x2f'),this['syncCustomEvent'][_0x8059('0x20')](this));ami['on']('custom:substatus',this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x30'),this['syncCustomEvent'][_0x8059('0x20')](this));ami['on'](_0x8059('0x31'),this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on']('custom:acceptmessage',this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on']('custom:rejectmessage',this[_0x8059('0x1f')][_0x8059('0x20')](this));ami['on'](_0x8059('0x32'),this[_0x8059('0x1f')][_0x8059('0x20')](this));}Trigger[_0x8059('0x33')][_0x8059('0x34')]=function(_0x21df02,_0x3d46ef,_0x390748){logger[_0x8059('0x35')](_0x21df02,_0x3d46ef,JSON[_0x8059('0x36')](_0x390748));io['to'](_0x21df02)[_0x8059('0x34')](_0x3d46ef,_0x390748);};Trigger[_0x8059('0x33')][_0x8059('0x1f')]=function(_0x2a1a4a){var _0x2ff87e=_[_0x8059('0x37')](_0x2a1a4a);if(typeof _0x2ff87e[_0x8059('0x38')]===_0x8059('0x39')){_0x2ff87e[_0x8059('0x38')]=_0x8059('0x3a');}this[_0x8059('0x3b')](_0x2ff87e);};Trigger[_0x8059('0x33')]['syncAgentDial']=function(_0x1b187a){if(this[_0x8059('0xf')][_0x1b187a[_0x8059('0x3c')]]){this[_0x8059('0x1f')](_0x1b187a);}};Trigger[_0x8059('0x33')][_0x8059('0x3b')]=function(_0x398254){var _0x5d1815;for(var _0x5e0067 in this[_0x8059('0xe')]){if(this[_0x8059('0xe')][_0x8059('0x3d')](_0x5e0067)){if(this[_0x8059('0xe')][_0x5e0067]['status']){_0x5d1815=this[_0x8059('0x3e')](this[_0x8059('0xe')][_0x5e0067],_0x398254);if(_0x5d1815){_[_0x8059('0x3f')](_0x398254,_0x398254[_0x8059('0x40')]);for(var _0x19cf88=0x0,_0x26bbde,_0x1107fb,_0x38d89b;_0x19cf880x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x5fc3,0xa8));var _0x35fc=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x5fc3[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index e72521a..4e50f6b 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 _0x70b2=['indexOf','content','ticketType','assign','Subjects','getString','Descriptions','/contacts(','phonecall','callDirection','queue','phonecalls','format','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\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','lodash','request-promise','util','./util','md5','../../../../config/logger','defaults','redis','localhost','POST','username','password','clientSecret','then','error','toUpperCase','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','userEmail','internalemailaddress','catch','message','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','outbound','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','enduserId','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','forEach','includes','string','type','nameField','customField','idField'];(function(_0x3a8782,_0x3d9bf5){var _0x19fb12=function(_0x40b289){while(--_0x40b289){_0x3a8782['push'](_0x3a8782['shift']());}};_0x19fb12(++_0x3d9bf5);}(_0x70b2,0xee));var _0x270b=function(_0x3f5f7b,_0x250ee2){_0x3f5f7b=_0x3f5f7b-0x0;var _0x218358=_0x70b2[_0x3f5f7b];return _0x218358;};'use strict';var _=require(_0x270b('0x0'));var BPromise=require('bluebird');var rp=require(_0x270b('0x1'));var util=require(_0x270b('0x2'));var intUtil=require(_0x270b('0x3'));var md5=require(_0x270b('0x4'));var Redis=require('ioredis');var logger=require(_0x270b('0x5'))('dynamics365');var config=require('../../../../config/environment');config['redis']=_[_0x270b('0x6')](config[_0x270b('0x7')],{'host':_0x270b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x270b('0x7')]));function getAuthToken(_0x74785a,_0xf68094,_0x50e93d){var _0x10f0d9={'method':_0x270b('0x9'),'uri':_0xf68094,'form':{'client_id':_0x74785a['clientId'],'resource':_0x74785a['remoteUri'],'username':_0x74785a[_0x270b('0xa')],'password':_0x74785a['password'],'grant_type':_0x270b('0xb'),'client_secret':_0x74785a[_0x270b('0xc')]},'json':!![]};return rp(_0x10f0d9)[_0x270b('0xd')](function(_0x5ebb4a){return _0x5ebb4a['access_token'];})['catch'](function(_0xbbe892){logger[_0x270b('0xe')]('['+[_0x50e93d[_0x270b('0xf')]()]+']\x20Wrong\x20credentials!');return _0xbbe892['message'];});}function getUser(_0x1db4dd,_0x41338e,_0x50ab6d,_0x466be7,_0x1b544e,_0x1e4fa3){return new BPromise(function(_0x4a761f,_0x4bbc3e){return getAuthToken(_0x41338e,_0x466be7,_0x1e4fa3)[_0x270b('0xd')](function(_0x1eaa5a){var _0x525325={'method':'GET','uri':_0x1b544e+_0x270b('0x10'),'headers':{'Authorization':_0x270b('0x11')+_0x1eaa5a,'OData-Version':_0x270b('0x12')},'json':!![]};return rp(_0x525325);})['then'](function(_0x3dbb50){var _0x125202=_0x3dbb50[_0x270b('0x13')];var _0x33ceec=![];var _0x2a766d=null;if(!_[_0x270b('0x14')](_0x50ab6d)){if(intUtil[_0x270b('0x15')](_0x50ab6d[_0x270b('0x16')])){_0x1db4dd['userEmail']=_0x50ab6d['email'];for(_0x2a766d=0x0;_0x2a766d<_0x125202[_0x270b('0x17')];_0x2a766d++){if(_0x125202[_0x2a766d]['internalemailaddress']===_0x50ab6d[_0x270b('0x16')]&&!_0x125202[_0x2a766d][_0x270b('0x18')]){_0x33ceec=!![];logger[_0x270b('0x19')]('['+[_0x1e4fa3[_0x270b('0xf')]()]+_0x270b('0x1a')+_0x125202[_0x2a766d][_0x270b('0x1b')]+'!');_0x1db4dd[_0x270b('0x1c')]=_0x125202[_0x2a766d][_0x270b('0x1b')];}}}}if(!_0x33ceec){logger[_0x270b('0x19')]('['+[_0x1e4fa3['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1db4dd[_0x270b('0x1d')]=_0x41338e[_0x270b('0xa')];for(_0x2a766d=0x0;_0x2a766d<_0x125202['length'];_0x2a766d++){if(_0x125202[_0x2a766d][_0x270b('0x1e')]===_0x41338e[_0x270b('0xa')]){_0x1db4dd[_0x270b('0x1c')]=_0x125202[_0x2a766d]['systemuserid'];}}}_0x4a761f(_0x1db4dd);})[_0x270b('0x1f')](function(_0x3f923c){_0x4bbc3e(_0x3f923c[_0x270b('0x20')]);});});}function createEndUser(_0x8ccb6d,_0xed1c49,_0x4dcbe2,_0x562f1a,_0x575869,_0x6da93){return new BPromise(function(_0x3f8953,_0x56fbd8){return getAuthToken(_0xed1c49,_0x4dcbe2,_0x6da93)[_0x270b('0xd')](function(_0x3ddbc5){var _0x2cf19a=_0x6da93[_0x270b('0x21')]()==='outbound'?_0x575869[_0x270b('0x22')]:_0x575869[_0x270b('0x23')];var _0x3c837f={'method':_0x270b('0x9'),'uri':_0x562f1a+_0x270b('0x24'),'body':{'telephone1':_0x2cf19a,'fullname':_0x2cf19a,'firstname':_0x2cf19a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x270b('0x25')+_0x8ccb6d[_0x270b('0x1c')]+')'},'headers':{'Authorization':_0x270b('0x11')+_0x3ddbc5,'OData-Version':_0x270b('0x12')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3c837f);})[_0x270b('0xd')](function(_0x4d2ff5){var _0x871ea3=_0x4d2ff5[_0x270b('0x26')]['odata-entityid'];var _0x1fe4ae=_0x871ea3[_0x270b('0x27')](_0x871ea3[_0x270b('0x28')]('(')+0x1,_0x871ea3['lastIndexOf'](')'));_0x8ccb6d['enduserId']=_0x1fe4ae;_0x3f8953(_0x8ccb6d);})['catch'](function(_0x4b1294){_0x56fbd8(_0x4b1294[_0x270b('0x20')]);});});}function getEndUser(_0x50127b,_0x409185,_0x59da21,_0x41e0e8,_0x4b6415,_0x2958cf,_0x26ddfd){var _0x56896c=_0x2958cf[_0x270b('0x21')]()===_0x270b('0x29')?_0x4b6415['destcalleridnum']:_0x4b6415['calleridnum'];return getAuthToken(_0x409185,_0x59da21,_0x2958cf)['then'](function(_0x65b57a){var _0x2e687c={'method':_0x270b('0x2a'),'uri':_0x41e0e8+_0x270b('0x2b')+_0x56896c[_0x270b('0x2c')]('+',_0x270b('0x2d'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x65b57a,'If-None-Match':null,'OData-Version':_0x270b('0x12')},'json':!![]};return rp(_0x2e687c);})[_0x270b('0xd')](function(_0xcd7d07){var _0x5755e6=![];if(!_0xcd7d07)return _0x5755e6;var _0x5c387d=_0xcd7d07[_0x270b('0x13')];for(var _0x3fcdb8=0x0;_0x3fcdb8<_0x5c387d[_0x270b('0x17')];_0x3fcdb8++){if(_0x5c387d[_0x3fcdb8]['telephone1']===_0x56896c){_0x5755e6=!![];_0x50127b[_0x270b('0x2e')]=_0x5c387d[_0x3fcdb8]['contactid'];}}return _0x5755e6;})[_0x270b('0xd')](function(_0x1013ae){if(_0x1013ae)return _0x50127b;if(_0x26ddfd===_0x270b('0x2f')){logger['info']('['+[_0x2958cf[_0x270b('0xf')]()]+_0x270b('0x30'));return _0x50127b;}return createEndUser(_0x50127b,_0x409185,_0x59da21,_0x41e0e8,_0x4b6415,_0x2958cf)[_0x270b('0xd')](function(_0x210b2e){logger[_0x270b('0x19')]('['+[_0x2958cf['toUpperCase']()]+']\x20Enduser\x20created!',_0x210b2e[_0x270b('0x2e')]);return _0x210b2e;});});}function getCustomFields(_0x5be844,_0xb25cb2,_0x26442b){var _0x232332={};if(_0x5be844[_0x270b('0x17')]>0x0){_[_0x270b('0x31')](_0x5be844,function(_0x2cb408){if(_[_0x270b('0x32')]([_0x270b('0x33'),'picklist'],_0x2cb408[_0x270b('0x34')])&&_0x2cb408[_0x270b('0x35')]&&!_0x2cb408[_0x270b('0x36')]){var _0x18b7cc=_0x2cb408[_0x270b('0x37')][_0x270b('0x21')]();var _0x55d437=_0x18b7cc['substring'](0x0,_0x18b7cc['indexOf']('_'));var _0xa08d56=_0x18b7cc['substring'](_0x18b7cc[_0x270b('0x38')]('_')+0x1);if(_0x55d437===_0x26442b){_0x232332[_0xa08d56]=_0x2cb408[_0x270b('0x39')];}}});}return _0x232332;}function getTicket(_0x4151d3,_0x38b645,_0x4319f4,_0x10519d,_0x2bca32,_0x3f4847,_0x49ad94){return new BPromise(function(_0x7c6bf0,_0x517321){var _0x83a3cd;return getAuthToken(_0x38b645,_0x4319f4,_0x49ad94)[_0x270b('0xd')](function(_0x491d1d){if(_0x3f4847[_0x270b('0x3a')]==='incident'){_0x83a3cd={'method':'POST','uri':_0x10519d+'incidents','body':Object[_0x270b('0x3b')]({},{'title':intUtil['getString'](_0x3f4847[_0x270b('0x3c')],_0x2bca32,'\x20'),'description':intUtil[_0x270b('0x3d')](_0x3f4847[_0x270b('0x3e')],_0x2bca32,'\x0a'),'customerid_contact@odata.bind':_0x4151d3[_0x270b('0x2e')]?_0x270b('0x3f')+_0x4151d3[_0x270b('0x2e')]+')':undefined,'ownerid@odata.bind':_0x270b('0x25')+_0x4151d3[_0x270b('0x1c')]+')','caseorigincode':'1'},getCustomFields(_0x3f4847['Fields'],_0x2bca32,_0x3f4847[_0x270b('0x3a')])),'headers':{'Authorization':_0x270b('0x11')+_0x491d1d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3f4847[_0x270b('0x3a')]===_0x270b('0x40')){var _0x95f509=_0x4151d3[_0x270b('0x2e')]?[{'partyid_systemuser@odata.bind':_0x270b('0x25')+_0x4151d3[_0x270b('0x1c')]+')','participationtypemask':_0x4151d3[_0x270b('0x41')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4151d3[_0x270b('0x2e')]+')','participationtypemask':_0x4151d3['callDirection']===_0x270b('0x42')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4151d3[_0x270b('0x1c')]+')','participationtypemask':_0x4151d3[_0x270b('0x41')]==='queue'?0x2:0x1}];_0x83a3cd={'method':_0x270b('0x9'),'uri':_0x10519d+_0x270b('0x43'),'body':Object[_0x270b('0x3b')]({},{'subject':intUtil[_0x270b('0x3d')](_0x3f4847[_0x270b('0x3c')],_0x2bca32,'\x20'),'phonenumber':String(_0x2bca32[_0x270b('0x23')]),'description':intUtil[_0x270b('0x3d')](_0x3f4847[_0x270b('0x3e')],_0x2bca32,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4151d3[_0x270b('0x2e')]?_0x270b('0x3f')+_0x4151d3['enduserId']+')':undefined,'ownerid@odata.bind':_0x270b('0x25')+_0x4151d3['userId']+')','directioncode':_0x4151d3['callDirection']===_0x270b('0x42')?![]:!![],'phonecall_activity_parties':_0x95f509},getCustomFields(_0x3f4847['Fields'],_0x2bca32,_0x3f4847[_0x270b('0x3a')])),'headers':{'Authorization':_0x270b('0x11')+_0x491d1d,'OData-Version':_0x270b('0x12')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x83a3cd);})['then'](function(_0x114d33){var _0x2362dc=_0x114d33[_0x270b('0x26')]['odata-entityid'];var _0x472cd0=_0x2362dc[_0x270b('0x27')](_0x2362dc[_0x270b('0x28')]('(')+0x1,_0x2362dc[_0x270b('0x28')](')'));_0x4151d3['ticketId']=_0x472cd0;_0x7c6bf0(_0x4151d3);})['catch'](function(_0x3befb5){_0x517321(_0x3befb5[_0x270b('0x20')]);});});}function emit(_0xa868d,_0x329d5c,_0x2f21b8,_0x562eba){var _0x1d6c4b={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xa868d,_0x2f21b8,_0x562eba)};io['to'](util[_0x270b('0x44')](_0x270b('0x45'),_0x329d5c))[_0x270b('0x46')](_0x270b('0x47'),_0x1d6c4b);}exports['cs']=function(_0x2f8543,_0x4d6eb3,_0xe7e0b4,_0xadc46d,_0x1c2882,_0x462139,_0x105109,_0x1d1235){var _0x189ef2={};_0x462139[_0x270b('0x48')]=intUtil[_0x270b('0x49')](_0x462139[_0x270b('0x48')]);_0x462139[_0x270b('0x4a')]=intUtil[_0x270b('0x49')](_0x462139[_0x270b('0x4a')]);_0x189ef2[_0x270b('0x41')]=_0x1d1235==='queue'||_0x1d1235===_0x270b('0x4b')?_0x270b('0x42'):_0x270b('0x29');var _0x26bd1c=util[_0x270b('0x44')](_0x270b('0x4c'),_0x462139['remoteUri']);var _0xa55309=util['format'](_0x270b('0x4d'),_0x462139[_0x270b('0x4e')]);var _0x44dbcd=util['format'](_0x270b('0x4f'),_0x462139[_0x270b('0x4a')],_0x4d6eb3[_0x270b('0x50')],md5(_0x4d6eb3[_0x270b('0x50')]));if(_0x1c2882&&_0x1c2882['monitor_format']){logger[_0x270b('0x19')](_0x270b('0x51'),_0x270b('0x52'));_0x4d6eb3[_0x270b('0x53')]=_0x44dbcd;}else if(_0x105109&&_0x105109['recordingFormat']&&_0x105109[_0x270b('0x54')]!==_0x270b('0x55')){logger[_0x270b('0x19')](_0x270b('0x56'),_0x270b('0x52'));_0x4d6eb3[_0x270b('0x53')]=_0x44dbcd;}else{_0x4d6eb3[_0x270b('0x53')]='';}return getUser(_0x189ef2,_0x462139,_0xadc46d,_0xa55309,_0x26bd1c,_0x1d1235)['then'](function(_0x1a26d0){logger[_0x270b('0x19')]('['+_0x1d1235[_0x270b('0xf')]()+_0x270b('0x57'),_0x1a26d0['userId']);logger['info']('['+_0x1d1235[_0x270b('0xf')]()+_0x270b('0x58'),_0x1a26d0[_0x270b('0x1d')]);return getEndUser(_0x1a26d0,_0x462139,_0xa55309,_0x26bd1c,_0x4d6eb3,_0x1d1235,_0xe7e0b4[_0x270b('0x59')]);})['then'](function(_0x5c83fa){logger[_0x270b('0x19')]('['+_0x1d1235[_0x270b('0xf')]()+_0x270b('0x5a'),_0x5c83fa[_0x270b('0x2e')]);logger[_0x270b('0x19')]('['+_0x1d1235['toUpperCase']()+_0x270b('0x5b'),_0x4d6eb3[_0x270b('0x23')]);return getTicket(_0x5c83fa,_0x462139,_0xa55309,_0x26bd1c,_0x4d6eb3,_0xe7e0b4,_0x1d1235);})[_0x270b('0xd')](function(_0x4d87f0){logger['info'](util[_0x270b('0x44')]('['+_0x1d1235[_0x270b('0xf')]()+_0x270b('0x5c'),_0xe7e0b4['ticketType'],_0x4d87f0[_0x270b('0x5d')]));logger[_0x270b('0x19')](util['format']('['+_0x1d1235[_0x270b('0xf')]()+']\x20Call\x20direction:\x20%s',_0x1d1235));if(_0x1d1235!=='unmanaged'){logger['info']('['+_0x1d1235[_0x270b('0xf')]()+']',_0x270b('0x5e'));emit(_0x462139[_0x270b('0x48')],_0xadc46d[_0x270b('0x5f')],_0xe7e0b4[_0x270b('0x3a')],_0x4d87f0[_0x270b('0x5d')]);}})[_0x270b('0x1f')](function(_0x1b7c23){logger['error']('['+_0x1d1235[_0x270b('0xf')]()+_0x270b('0x60'),util[_0x270b('0x61')](_0x1b7c23,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7f97=['socket.io-emitter','POST','clientId','password','then','access_token','catch',']\x20Wrong\x20credentials!','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','validateEmail','email','length','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','internalemailaddress','toLowerCase','destcalleridnum','headers','odata-entityid','substring','enduserId','outbound','calleridnum','GET','%2b','value','contactid','toUpperCase',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','string','type','nameField','customField','indexOf','content','incident','incidents','getString','Subjects','Descriptions','/contacts(','ticketType','phonecall','/systemusers(','callDirection','queue','phonecalls','assign','Fields','lastIndexOf','ticketId','message','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','util','dynamics365','../../../../config/environment','redis','localhost'];(function(_0x5acfa2,_0x35c46a){var _0x2f8584=function(_0x502096){while(--_0x502096){_0x5acfa2['push'](_0x5acfa2['shift']());}};_0x2f8584(++_0x35c46a);}(_0x7f97,0xb2));var _0x77f9=function(_0x4f65b6,_0x1f2853){_0x4f65b6=_0x4f65b6-0x0;var _0x224f44=_0x7f97[_0x4f65b6];return _0x224f44;};'use strict';var _=require(_0x77f9('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require(_0x77f9('0x1'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x77f9('0x2'));var config=require(_0x77f9('0x3'));config[_0x77f9('0x4')]=_['defaults'](config[_0x77f9('0x4')],{'host':_0x77f9('0x5'),'port':0x18eb});var io=require(_0x77f9('0x6'))(new Redis(config[_0x77f9('0x4')]));function getAuthToken(_0x458368,_0xa91090,_0x517228){var _0x4661a6={'method':_0x77f9('0x7'),'uri':_0xa91090,'form':{'client_id':_0x458368[_0x77f9('0x8')],'resource':_0x458368['remoteUri'],'username':_0x458368['username'],'password':_0x458368[_0x77f9('0x9')],'grant_type':_0x77f9('0x9'),'client_secret':_0x458368['clientSecret']},'json':!![]};return rp(_0x4661a6)[_0x77f9('0xa')](function(_0x634752){return _0x634752[_0x77f9('0xb')];})[_0x77f9('0xc')](function(_0x1f59ca){logger['error']('['+[_0x517228['toUpperCase']()]+_0x77f9('0xd'));return _0x1f59ca['message'];});}function getUser(_0x6210bb,_0xb51b1,_0x149e27,_0x488a65,_0x24bcf8,_0x453b59){return new BPromise(function(_0x9cc0f,_0x497169){return getAuthToken(_0xb51b1,_0x488a65,_0x453b59)[_0x77f9('0xa')](function(_0x4dfba2){var _0x375b9a={'method':'GET','uri':_0x24bcf8+_0x77f9('0xe'),'headers':{'Authorization':_0x77f9('0xf')+_0x4dfba2,'OData-Version':_0x77f9('0x10')},'json':!![]};return rp(_0x375b9a);})[_0x77f9('0xa')](function(_0x577846){var _0x42cb48=_0x577846['value'];var _0x57bc5d=![];var _0x1add63=null;if(!_['isNil'](_0x149e27)){if(intUtil[_0x77f9('0x11')](_0x149e27['email'])){_0x6210bb['userEmail']=_0x149e27[_0x77f9('0x12')];for(_0x1add63=0x0;_0x1add63<_0x42cb48[_0x77f9('0x13')];_0x1add63++){if(_0x42cb48[_0x1add63]['internalemailaddress']===_0x149e27['email']&&!_0x42cb48[_0x1add63]['isdisabled']){_0x57bc5d=!![];logger[_0x77f9('0x14')]('['+[_0x453b59['toUpperCase']()]+_0x77f9('0x15')+_0x42cb48[_0x1add63]['systemuserid']+'!');_0x6210bb[_0x77f9('0x16')]=_0x42cb48[_0x1add63][_0x77f9('0x17')];}}}}if(!_0x57bc5d){logger[_0x77f9('0x14')]('['+[_0x453b59['toUpperCase']()]+_0x77f9('0x18'));_0x6210bb[_0x77f9('0x19')]=_0xb51b1[_0x77f9('0x1a')];for(_0x1add63=0x0;_0x1add63<_0x42cb48[_0x77f9('0x13')];_0x1add63++){if(_0x42cb48[_0x1add63][_0x77f9('0x1b')]===_0xb51b1[_0x77f9('0x1a')]){_0x6210bb[_0x77f9('0x16')]=_0x42cb48[_0x1add63][_0x77f9('0x17')];}}}_0x9cc0f(_0x6210bb);})[_0x77f9('0xc')](function(_0x3a0ffa){_0x497169(_0x3a0ffa['message']);});});}function createEndUser(_0x5326b9,_0x47b936,_0x48255d,_0x2f722d,_0x323818,_0x317814){return new BPromise(function(_0x294834,_0x4dca23){return getAuthToken(_0x47b936,_0x48255d,_0x317814)['then'](function(_0x5d9724){var _0x588a54=_0x317814[_0x77f9('0x1c')]()==='outbound'?_0x323818[_0x77f9('0x1d')]:_0x323818['calleridnum'];var _0x487c2e={'method':_0x77f9('0x7'),'uri':_0x2f722d+'contacts','body':{'telephone1':_0x588a54,'fullname':_0x588a54,'firstname':_0x588a54,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x5326b9[_0x77f9('0x16')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x5d9724,'OData-Version':_0x77f9('0x10')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x487c2e);})[_0x77f9('0xa')](function(_0x24dc0f){var _0xc21cec=_0x24dc0f[_0x77f9('0x1e')][_0x77f9('0x1f')];var _0x1c2999=_0xc21cec[_0x77f9('0x20')](_0xc21cec['lastIndexOf']('(')+0x1,_0xc21cec['lastIndexOf'](')'));_0x5326b9[_0x77f9('0x21')]=_0x1c2999;_0x294834(_0x5326b9);})[_0x77f9('0xc')](function(_0x2bef87){_0x4dca23(_0x2bef87['message']);});});}function getEndUser(_0x23c334,_0x157fe1,_0x26ee4e,_0x832cce,_0x454254,_0x5160f4,_0x52d7e1){var _0x25394a=_0x5160f4[_0x77f9('0x1c')]()===_0x77f9('0x22')?_0x454254[_0x77f9('0x1d')]:_0x454254[_0x77f9('0x23')];return getAuthToken(_0x157fe1,_0x26ee4e,_0x5160f4)[_0x77f9('0xa')](function(_0x5ab3dd){var _0x1e9d18={'method':_0x77f9('0x24'),'uri':_0x832cce+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x25394a['replace']('+',_0x77f9('0x25'))+'\x27','headers':{'Authorization':_0x77f9('0xf')+_0x5ab3dd,'If-None-Match':null,'OData-Version':_0x77f9('0x10')},'json':!![]};return rp(_0x1e9d18);})['then'](function(_0x4dc1a2){var _0x439a63=![];if(!_0x4dc1a2)return _0x439a63;var _0x274dd8=_0x4dc1a2[_0x77f9('0x26')];for(var _0x5ebfde=0x0;_0x5ebfde<_0x274dd8['length'];_0x5ebfde++){if(_0x274dd8[_0x5ebfde]['telephone1']===_0x25394a){_0x439a63=!![];_0x23c334[_0x77f9('0x21')]=_0x274dd8[_0x5ebfde][_0x77f9('0x27')];}}return _0x439a63;})[_0x77f9('0xa')](function(_0x573c07){if(_0x573c07)return _0x23c334;if(_0x52d7e1==='nothing'){logger[_0x77f9('0x14')]('['+[_0x5160f4[_0x77f9('0x28')]()]+_0x77f9('0x29'));return _0x23c334;}return createEndUser(_0x23c334,_0x157fe1,_0x26ee4e,_0x832cce,_0x454254,_0x5160f4)[_0x77f9('0xa')](function(_0x1158ac){logger[_0x77f9('0x14')]('['+[_0x5160f4[_0x77f9('0x28')]()]+_0x77f9('0x2a'),_0x1158ac[_0x77f9('0x21')]);return _0x1158ac;});});}function getCustomFields(_0x22e323,_0x23f68b,_0x30e08){var _0x42491f={};if(_0x22e323['length']>0x0){_['forEach'](_0x22e323,function(_0xda964d){if(_['includes']([_0x77f9('0x2b'),'picklist'],_0xda964d[_0x77f9('0x2c')])&&_0xda964d[_0x77f9('0x2d')]&&!_0xda964d[_0x77f9('0x2e')]){var _0xbc6252=_0xda964d['idField'][_0x77f9('0x1c')]();var _0x327f3a=_0xbc6252[_0x77f9('0x20')](0x0,_0xbc6252[_0x77f9('0x2f')]('_'));var _0x3781ef=_0xbc6252[_0x77f9('0x20')](_0xbc6252['indexOf']('_')+0x1);if(_0x327f3a===_0x30e08){_0x42491f[_0x3781ef]=_0xda964d[_0x77f9('0x30')];}}});}return _0x42491f;}function getTicket(_0x404a6,_0x49ad37,_0x326572,_0x47a5e8,_0x46dd23,_0x2c61c2,_0x1bc695){return new BPromise(function(_0x5644b4,_0x2e8cce){var _0x9a127f;return getAuthToken(_0x49ad37,_0x326572,_0x1bc695)[_0x77f9('0xa')](function(_0x16774c){if(_0x2c61c2['ticketType']===_0x77f9('0x31')){_0x9a127f={'method':_0x77f9('0x7'),'uri':_0x47a5e8+_0x77f9('0x32'),'body':Object['assign']({},{'title':intUtil[_0x77f9('0x33')](_0x2c61c2[_0x77f9('0x34')],_0x46dd23,'\x20'),'description':intUtil[_0x77f9('0x33')](_0x2c61c2[_0x77f9('0x35')],_0x46dd23,'\x0a'),'customerid_contact@odata.bind':_0x404a6[_0x77f9('0x21')]?_0x77f9('0x36')+_0x404a6[_0x77f9('0x21')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x404a6[_0x77f9('0x16')]+')','caseorigincode':'1'},getCustomFields(_0x2c61c2['Fields'],_0x46dd23,_0x2c61c2[_0x77f9('0x37')])),'headers':{'Authorization':'Bearer\x20'+_0x16774c,'OData-Version':_0x77f9('0x10')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2c61c2['ticketType']===_0x77f9('0x38')){var _0x37bb09=_0x404a6[_0x77f9('0x21')]?[{'partyid_systemuser@odata.bind':_0x77f9('0x39')+_0x404a6[_0x77f9('0x16')]+')','participationtypemask':_0x404a6[_0x77f9('0x3a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x77f9('0x36')+_0x404a6[_0x77f9('0x21')]+')','participationtypemask':_0x404a6['callDirection']===_0x77f9('0x3b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x404a6[_0x77f9('0x16')]+')','participationtypemask':_0x404a6[_0x77f9('0x3a')]===_0x77f9('0x3b')?0x2:0x1}];_0x9a127f={'method':_0x77f9('0x7'),'uri':_0x47a5e8+_0x77f9('0x3c'),'body':Object[_0x77f9('0x3d')]({},{'subject':intUtil[_0x77f9('0x33')](_0x2c61c2[_0x77f9('0x34')],_0x46dd23,'\x20'),'phonenumber':String(_0x46dd23[_0x77f9('0x23')]),'description':intUtil[_0x77f9('0x33')](_0x2c61c2[_0x77f9('0x35')],_0x46dd23,'\x0a'),'regardingobjectid_contact@odata.bind':_0x404a6[_0x77f9('0x21')]?'/contacts('+_0x404a6['enduserId']+')':undefined,'ownerid@odata.bind':_0x77f9('0x39')+_0x404a6[_0x77f9('0x16')]+')','directioncode':_0x404a6[_0x77f9('0x3a')]==='queue'?![]:!![],'phonecall_activity_parties':_0x37bb09},getCustomFields(_0x2c61c2[_0x77f9('0x3e')],_0x46dd23,_0x2c61c2[_0x77f9('0x37')])),'headers':{'Authorization':_0x77f9('0xf')+_0x16774c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x9a127f);})[_0x77f9('0xa')](function(_0x5b804c){var _0x10fd13=_0x5b804c[_0x77f9('0x1e')][_0x77f9('0x1f')];var _0x2d341e=_0x10fd13[_0x77f9('0x20')](_0x10fd13[_0x77f9('0x3f')]('(')+0x1,_0x10fd13[_0x77f9('0x3f')](')'));_0x404a6[_0x77f9('0x40')]=_0x2d341e;_0x5644b4(_0x404a6);})[_0x77f9('0xc')](function(_0x32a3ef){_0x2e8cce(_0x32a3ef[_0x77f9('0x41')]);});});}function emit(_0x245208,_0x175922,_0x999c9,_0x1e2b8d){var _0x47e558={'uri':util[_0x77f9('0x42')](_0x77f9('0x43'),_0x245208,_0x999c9,_0x1e2b8d)};io['to'](util[_0x77f9('0x42')](_0x77f9('0x44'),_0x175922))[_0x77f9('0x45')]('trigger:browser:url',_0x47e558);}exports['cs']=function(_0x3dc51f,_0x1afec9,_0x1cc3b4,_0xebc826,_0x50652e,_0x12327c,_0x1f0da7,_0x3d5fb4){var _0x438dec={};_0x12327c[_0x77f9('0x46')]=intUtil['stripTrailingSlash'](_0x12327c[_0x77f9('0x46')]);_0x12327c['serverUrl']=intUtil[_0x77f9('0x47')](_0x12327c[_0x77f9('0x48')]);_0x438dec[_0x77f9('0x3a')]=_0x3d5fb4===_0x77f9('0x3b')||_0x3d5fb4===_0x77f9('0x49')?_0x77f9('0x3b'):'outbound';var _0x4a0d37=util[_0x77f9('0x42')](_0x77f9('0x4a'),_0x12327c[_0x77f9('0x46')]);var _0x114e60=util[_0x77f9('0x42')]('https://login.microsoftonline.com/%s/oauth2/token',_0x12327c[_0x77f9('0x4b')]);var _0x2e4200=util[_0x77f9('0x42')](_0x77f9('0x4c'),_0x12327c[_0x77f9('0x48')],_0x1afec9[_0x77f9('0x4d')],md5(_0x1afec9[_0x77f9('0x4d')]));if(_0x50652e&&_0x50652e['monitor_format']){logger[_0x77f9('0x14')](_0x77f9('0x4e'),_0x77f9('0x4f'));_0x1afec9[_0x77f9('0x50')]=_0x2e4200;}else if(_0x1f0da7&&_0x1f0da7[_0x77f9('0x51')]&&_0x1f0da7[_0x77f9('0x51')]!==_0x77f9('0x52')){logger['info'](_0x77f9('0x53'),'Recording\x20is\x20enabled!');_0x1afec9[_0x77f9('0x50')]=_0x2e4200;}else{_0x1afec9['recordingURL']='';}return getUser(_0x438dec,_0x12327c,_0xebc826,_0x114e60,_0x4a0d37,_0x3d5fb4)[_0x77f9('0xa')](function(_0x5374e3){logger[_0x77f9('0x14')]('['+_0x3d5fb4[_0x77f9('0x28')]()+_0x77f9('0x54'),_0x5374e3['userId']);logger[_0x77f9('0x14')]('['+_0x3d5fb4[_0x77f9('0x28')]()+']\x20The\x20User\x20email\x20is:',_0x5374e3[_0x77f9('0x19')]);return getEndUser(_0x5374e3,_0x12327c,_0x114e60,_0x4a0d37,_0x1afec9,_0x3d5fb4,_0x1cc3b4[_0x77f9('0x55')]);})[_0x77f9('0xa')](function(_0x197118){logger[_0x77f9('0x14')]('['+_0x3d5fb4[_0x77f9('0x28')]()+_0x77f9('0x56'),_0x197118[_0x77f9('0x21')]);logger['info']('['+_0x3d5fb4[_0x77f9('0x28')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1afec9[_0x77f9('0x23')]);return getTicket(_0x197118,_0x12327c,_0x114e60,_0x4a0d37,_0x1afec9,_0x1cc3b4,_0x3d5fb4);})['then'](function(_0x1a5046){logger[_0x77f9('0x14')](util[_0x77f9('0x42')]('['+_0x3d5fb4[_0x77f9('0x28')]()+_0x77f9('0x57'),_0x1cc3b4[_0x77f9('0x37')],_0x1a5046[_0x77f9('0x40')]));logger['info'](util[_0x77f9('0x42')]('['+_0x3d5fb4[_0x77f9('0x28')]()+']\x20Call\x20direction:\x20%s',_0x3d5fb4));if(_0x3d5fb4!==_0x77f9('0x49')){logger[_0x77f9('0x14')]('['+_0x3d5fb4['toUpperCase']()+']',_0x77f9('0x58'));emit(_0x12327c['remoteUri'],_0xebc826['name'],_0x1cc3b4['ticketType'],_0x1a5046['ticketId']);}})[_0x77f9('0xc')](function(_0x198ec7){logger[_0x77f9('0x59')]('['+_0x3d5fb4['toUpperCase']()+_0x77f9('0x5a'),util[_0x77f9('0x5b')](_0x198ec7,{'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 e17da2e..33e4540 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 _0x71cd=['../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','getString','Descriptions','
','Tags','name','Fields','mapValues','custom_fields','value','format','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','stringify','defaults','GET','map','forEach','includes','string','picklist','type','customField','nameField','toLowerCase','content','idField','variable','push','variableName','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridnum','md5','./util'];(function(_0x5a2cdc,_0x3f3c68){var _0x2c3e1a=function(_0x428dc4){while(--_0x428dc4){_0x5a2cdc['push'](_0x5a2cdc['shift']());}};_0x2c3e1a(++_0x3f3c68);}(_0x71cd,0xb8));var _0xd71c=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x71cd[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xd71c('0x0'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xd71c('0x1'));var config=require('../../../../config/environment');var logger=require(_0xd71c('0x2'))('freshdesk');config[_0xd71c('0x3')]=_['defaults'](config[_0xd71c('0x3')],{'host':_0xd71c('0x4'),'port':0x18eb});var io=require(_0xd71c('0x5'))(new Redis(config[_0xd71c('0x3')]));var headers={'Content-Type':'application/json','Accept':_0xd71c('0x6')};function emit(_0x189f24,_0x257153,_0x91f1c0){io['to'](_0x189f24)[_0xd71c('0x7')](_0x257153,_0x91f1c0);}function getTicket(_0x1897fc,_0x28b02a,_0x526496,_0x10e6b7,_0x5acde5){logger[_0xd71c('0x8')](_0xd71c('0x9'));var _0x57c45f=_[_0xd71c('0xa')]({'responder_id':_0x28b02a['id'],'requester_id':_0x526496['id'],'name':util['format'](_0xd71c('0xb'),_0x5acde5['calleridname']),'phone':_0x5acde5['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd71c('0xc')](_0x10e6b7['Subjects'],_0x5acde5,'\x20'),'description':intUtil[_0xd71c('0xc')](_0x10e6b7[_0xd71c('0xd')],_0x5acde5,_0xd71c('0xe')),'tags':getTags(_0x10e6b7[_0xd71c('0xf')],_0xd71c('0x10'))},getCustomFields(_0x10e6b7[_0xd71c('0x11')],_0x5acde5));_0x57c45f['custom_fields']=_[_0xd71c('0x12')](_['keyBy'](_0x57c45f[_0xd71c('0x13')],'id'),_0xd71c('0x14'));return request({'uri':util[_0xd71c('0x15')]('%s/api/v2/tickets',_0x1897fc['remoteUri']),'method':_0xd71c('0x16'),'body':_0x57c45f})[_0xd71c('0x17')](function(_0x12f74d){logger[_0xd71c('0x8')](_0xd71c('0x18'));return _0x12f74d;});}function getUser(_0x233c2d,_0x57b790){if(intUtil[_0xd71c('0x19')](_0x57b790)){return request({'uri':util[_0xd71c('0x15')](_0xd71c('0x1a'),_0x233c2d[_0xd71c('0x1b')]),'qs':{'email':_0x57b790}})[_0xd71c('0x17')](function(_0x437b61){if(_0x437b61[_0xd71c('0x1c')]){logger[_0xd71c('0x8')](_0xd71c('0x1d'));return _[_0xd71c('0x1e')](_0x437b61,function(_0x430492){return _0x430492[_0xd71c('0x1f')][_0xd71c('0x20')]===_0x57b790;});}else{logger[_0xd71c('0x8')](_0xd71c('0x21'));return request({'uri':util[_0xd71c('0x15')](_0xd71c('0x22'),_0x233c2d[_0xd71c('0x1b')])})[_0xd71c('0x17')](function(_0x47d1bd){logger[_0xd71c('0x8')]('Admin\x20account\x20selected.');return _0x47d1bd;});}});}else{logger['info'](_0xd71c('0x23'));return request({'uri':util[_0xd71c('0x15')](_0xd71c('0x22'),_0x233c2d[_0xd71c('0x1b')])})['then'](function(_0x4efdc8){logger['info'](_0xd71c('0x24'));return _0x4efdc8;});}}function getEndUser(_0x4a763e,_0x3a670b,_0x386e6f){logger[_0xd71c('0x8')](_0xd71c('0x25'),_0x386e6f);return request({'uri':util[_0xd71c('0x15')](_0xd71c('0x26'),_0x4a763e[_0xd71c('0x1b')]),'qs':{'phone':_0x386e6f}})['then'](function(_0x126a97){if(_0x126a97[_0xd71c('0x1c')]){logger[_0xd71c('0x8')](_0xd71c('0x27'));return _[_0xd71c('0x1e')](_0x126a97,{'phone':_0x386e6f});}else{logger[_0xd71c('0x8')](_0xd71c('0x28'));return request({'uri':util['format'](_0xd71c('0x26'),_0x4a763e[_0xd71c('0x1b')]),'method':_0xd71c('0x16'),'body':{'name':_0x3a670b,'phone':_0x386e6f}})[_0xd71c('0x17')](function(_0x3333fe){logger[_0xd71c('0x8')](_0xd71c('0x29'));return _0x3333fe;});}});}function getAuth(_0x3b6503){return util[_0xd71c('0x15')](_0xd71c('0x2a'),new Buffer(_0x3b6503[_0xd71c('0x2b')]+':X')[_0xd71c('0x2c')](_0xd71c('0x2d')));}function request(_0x441fb2){logger['debug']('[HTTP]',JSON[_0xd71c('0x2e')](_0x441fb2));return rp(_[_0xd71c('0x2f')](_0x441fb2,{'method':_0xd71c('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x4eb1b0,_0x421d71){var _0x598412=[];if(_0x4eb1b0&&_0x4eb1b0[_0xd71c('0x1c')]>0x0){_0x598412=_[_0xd71c('0x31')](_0x4eb1b0,_0x421d71);}return _0x598412;}function getCustomFields(_0x4a204f,_0x3648a5){var _0x2bbdef=[];var _0x59ddc2={'custom_fields':[]};if(_0x4a204f['length']>0x0){_[_0xd71c('0x32')](_0x4a204f,function(_0x512f57){if(_[_0xd71c('0x33')]([_0xd71c('0x34'),_0xd71c('0x35')],_0x512f57[_0xd71c('0x36')])&&_0x512f57['nameField']&&!_0x512f57[_0xd71c('0x37')]){_0x59ddc2[_0x512f57[_0xd71c('0x38')][_0xd71c('0x39')]()]=_0x512f57[_0xd71c('0x3a')]['toString']();}else if(_[_0xd71c('0x33')]([_0xd71c('0x34'),_0xd71c('0x35')],_0x512f57[_0xd71c('0x36')])&&_0x512f57[_0xd71c('0x3b')]&&_0x512f57[_0xd71c('0x37')]){_0x59ddc2[_0xd71c('0x13')]['push']({'id':_0x512f57[_0xd71c('0x3b')],'value':_0x512f57[_0xd71c('0x3a')]['toString']()});}else if(_0x512f57[_0xd71c('0x36')]===_0xd71c('0x3c')&&_0x512f57['variableName']&&_0x512f57[_0xd71c('0x3b')]&&_0x512f57['customField']){_0x3648a5[_0x512f57['variableName']]&&_0x59ddc2[_0xd71c('0x13')][_0xd71c('0x3d')]({'id':_0x512f57['idField'],'value':_0x3648a5[_0x512f57[_0xd71c('0x3e')]][_0xd71c('0x2c')]()});}else if(_0x512f57[_0xd71c('0x36')]===_0xd71c('0x3f')&&_0x512f57[_0xd71c('0x40')]&&_0x512f57[_0xd71c('0x40')][_0xd71c('0x10')]&&_0x512f57[_0xd71c('0x3b')]&&_0x512f57[_0xd71c('0x37')]){_0x3648a5[_0x512f57[_0xd71c('0x40')]['name'][_0xd71c('0x39')]()]&&_0x59ddc2[_0xd71c('0x13')][_0xd71c('0x3d')]({'id':_0x512f57[_0xd71c('0x3b')],'value':_0x3648a5[_0x512f57[_0xd71c('0x40')][_0xd71c('0x10')][_0xd71c('0x39')]()]['toString']()});}});}return _0x59ddc2;}exports[_0xd71c('0x41')]=function(_0x16ef04,_0xe01a36,_0x57abf4,_0x15da50,_0x62513c,_0x2b8408){var _0x2a8dc1,_0x1c94da;_0x2b8408['remoteUri']=intUtil['stripTrailingSlash'](_0x2b8408['remoteUri']);_0x2b8408[_0xd71c('0x42')]=intUtil[_0xd71c('0x43')](_0x2b8408[_0xd71c('0x42')]);if(_0x62513c&&_0x62513c[_0xd71c('0x44')]){logger[_0xd71c('0x8')]('[QUEUE]',_0xd71c('0x45'));_0xe01a36[_0xd71c('0x46')]=util[_0xd71c('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b8408[_0xd71c('0x42')],_0xe01a36[_0xd71c('0x47')],md5(_0xe01a36['uniqueid']));}else{_0xe01a36[_0xd71c('0x46')]='';}headers[_0xd71c('0x48')]=getAuth(_0x2b8408);return getUser(_0x2b8408,_0x15da50[_0xd71c('0x20')])['then'](function(_0x408a24){_0x2a8dc1=_0x408a24;logger[_0xd71c('0x8')](_0xd71c('0x49'),_0x2a8dc1['id']);return getEndUser(_0x2b8408,_0xe01a36[_0xd71c('0x4a')],_0xe01a36['calleridnum']);})[_0xd71c('0x17')](function(_0x4b62c0){_0x1c94da=_0x4b62c0;logger[_0xd71c('0x8')]('The\x20Enduser\x20ID\x20is:',_0x1c94da['id']);return getTicket(_0x2b8408,_0x2a8dc1,_0x1c94da,_0x57abf4,_0xe01a36);})[_0xd71c('0x17')](function(_0x4f6355){if(_0x4f6355&&_0x4f6355['id']){logger['info'](_0xd71c('0x18'));logger['info'](_0xd71c('0x4b'),_0x4f6355['id']);logger['info']('[QUEUE]',_0xd71c('0x4c'));emit(util['format'](_0xd71c('0x4d'),_0x15da50[_0xd71c('0x10')]),_0xd71c('0x4e'),{'uri':util[_0xd71c('0x15')](_0xd71c('0x4f'),_0x2b8408[_0xd71c('0x1b')],_0x4f6355['id'])});}})[_0xd71c('0x50')](function(_0x4ef93f){logger[_0xd71c('0x51')](_0xd71c('0x52'),JSON[_0xd71c('0x2e')](_0x4ef93f));});};exports[_0xd71c('0x53')]=function(_0x25a097,_0x2ad051,_0x397579,_0x468dd8,_0x1abbcc,_0x531e2b,_0x502504){var _0x59c554,_0x2982b7;_0x531e2b[_0xd71c('0x1b')]=intUtil[_0xd71c('0x43')](_0x531e2b['remoteUri']);_0x531e2b[_0xd71c('0x42')]=intUtil[_0xd71c('0x43')](_0x531e2b[_0xd71c('0x42')]);if(_0x502504&&_0x502504['recordingFormat']&&_0x502504['recordingFormat']!==_0xd71c('0x54')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2ad051['recordingURL']=util[_0xd71c('0x15')](_0xd71c('0x55'),_0x531e2b[_0xd71c('0x42')],_0x2ad051[_0xd71c('0x47')],md5(_0x2ad051[_0xd71c('0x47')]));}headers['Authorization']=getAuth(_0x531e2b);return getUser(_0x531e2b,_0x468dd8['email'])[_0xd71c('0x17')](function(_0x4ff518){_0x59c554=_0x4ff518;logger[_0xd71c('0x8')](_0xd71c('0x49'),_0x59c554['id']);return getEndUser(_0x531e2b,_0x2ad051['destcalleridname'],_0x2ad051[_0xd71c('0x56')]);})[_0xd71c('0x17')](function(_0x26d7e4){_0x2982b7=_0x26d7e4;logger[_0xd71c('0x8')](_0xd71c('0x57'),_0x2982b7['id']);return getTicket(_0x531e2b,_0x59c554,_0x2982b7,_0x397579,_0x2ad051);})[_0xd71c('0x17')](function(_0x5d8a35){if(_0x5d8a35&&_0x5d8a35['id']){logger['info'](_0xd71c('0x18'));logger['info'](_0xd71c('0x4b'),_0x5d8a35['id']);logger[_0xd71c('0x8')](_0xd71c('0x58'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xd71c('0x4d'),_0x468dd8['name']),_0xd71c('0x4e'),{'uri':util['format'](_0xd71c('0x4f'),_0x531e2b[_0xd71c('0x1b')],_0x5d8a35['id'])});}})[_0xd71c('0x50')](function(_0x49fa67){logger['error'](_0xd71c('0x58'),JSON['stringify'](_0x49fa67));});};exports[_0xd71c('0x59')]=function(_0x50b8a2,_0x3186ca,_0x2a67d0,_0x33cde4,_0x11fd65,_0x2f7cf3){var _0x2749fc,_0x217ae7;_0x2f7cf3['remoteUri']=intUtil['stripTrailingSlash'](_0x2f7cf3[_0xd71c('0x1b')]);_0x2f7cf3[_0xd71c('0x42')]=intUtil[_0xd71c('0x43')](_0x2f7cf3[_0xd71c('0x42')]);if(_0x11fd65&&_0x11fd65['monitor_format']){logger[_0xd71c('0x8')]('['+_0x3186ca[_0xd71c('0x5a')][_0xd71c('0x5b')]()+']',_0xd71c('0x45'));_0x3186ca[_0xd71c('0x46')]=util[_0xd71c('0x15')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f7cf3[_0xd71c('0x42')],_0x3186ca[_0xd71c('0x47')],md5(_0x3186ca[_0xd71c('0x47')]));}else{_0x3186ca[_0xd71c('0x46')]='';}headers[_0xd71c('0x48')]=getAuth(_0x2f7cf3);return getUser(_0x2f7cf3,'')[_0xd71c('0x17')](function(_0x2bd10f){_0x2749fc=_0x2bd10f;logger[_0xd71c('0x8')](_0xd71c('0x49'),_0x2749fc['id']);return getEndUser(_0x2f7cf3,_0x3186ca[_0xd71c('0x4a')],_0x3186ca[_0xd71c('0x5c')]);})[_0xd71c('0x17')](function(_0x4f7209){_0x217ae7=_0x4f7209;logger['info'](_0xd71c('0x57'),_0x217ae7['id']);return getTicket(_0x2f7cf3,_0x2749fc,_0x217ae7,_0x2a67d0,_0x3186ca);})['then'](function(_0x26c06f){if(_0x26c06f){logger[_0xd71c('0x8')](_0xd71c('0x18'));logger[_0xd71c('0x8')](_0xd71c('0x4b'),_0x26c06f['id']);}})[_0xd71c('0x50')](function(_0x126331){logger[_0xd71c('0x51')]('['+_0x3186ca[_0xd71c('0x5a')][_0xd71c('0x5b')]()+']',JSON[_0xd71c('0x2e')](_0x126331));});}; \ No newline at end of file +var _0xa56d=['lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','calleridname','Subjects','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','apiKey','stringify','GET','map','string','picklist','type','nameField','content','toString','idField','push','variableName','customField','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d'];(function(_0x514eb5,_0x16ac2e){var _0x23b75a=function(_0x3911c8){while(--_0x3911c8){_0x514eb5['push'](_0x514eb5['shift']());}};_0x23b75a(++_0x16ac2e);}(_0xa56d,0xb0));var _0xda56=function(_0x16dd70,_0x3fa885){_0x16dd70=_0x16dd70-0x0;var _0x3d1eca=_0xa56d[_0x16dd70];return _0x3d1eca;};'use strict';var _=require('lodash');var rp=require(_0xda56('0x0'));var md5=require(_0xda56('0x1'));var util=require(_0xda56('0x2'));var Redis=require('ioredis');var intUtil=require(_0xda56('0x3'));var config=require(_0xda56('0x4'));var logger=require('../../../../config/logger')(_0xda56('0x5'));config[_0xda56('0x6')]=_[_0xda56('0x7')](config[_0xda56('0x6')],{'host':_0xda56('0x8'),'port':0x18eb});var io=require(_0xda56('0x9'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xda56('0xa')};function emit(_0x3c39cf,_0x5bc406,_0x59c9bd){io['to'](_0x3c39cf)[_0xda56('0xb')](_0x5bc406,_0x59c9bd);}function getTicket(_0xd17cd7,_0x5ec59d,_0x7daca8,_0x3666ac,_0x199411){logger[_0xda56('0xc')]('Creating\x20new\x20ticket...');var _0x2adddd=_['merge']({'responder_id':_0x5ec59d['id'],'requester_id':_0x7daca8['id'],'name':util['format']('Caller\x20-\x20%s',_0x199411[_0xda56('0xd')]),'phone':_0x199411['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3666ac[_0xda56('0xe')],_0x199411,'\x20'),'description':intUtil['getString'](_0x3666ac['Descriptions'],_0x199411,_0xda56('0xf')),'tags':getTags(_0x3666ac[_0xda56('0x10')],_0xda56('0x11'))},getCustomFields(_0x3666ac[_0xda56('0x12')],_0x199411));_0x2adddd['custom_fields']=_[_0xda56('0x13')](_[_0xda56('0x14')](_0x2adddd[_0xda56('0x15')],'id'),_0xda56('0x16'));return request({'uri':util[_0xda56('0x17')](_0xda56('0x18'),_0xd17cd7['remoteUri']),'method':_0xda56('0x19'),'body':_0x2adddd})['then'](function(_0x3bf98f){logger[_0xda56('0xc')](_0xda56('0x1a'));return _0x3bf98f;});}function getUser(_0x5798ff,_0x33635d){if(intUtil[_0xda56('0x1b')](_0x33635d)){return request({'uri':util['format'](_0xda56('0x1c'),_0x5798ff[_0xda56('0x1d')]),'qs':{'email':_0x33635d}})[_0xda56('0x1e')](function(_0x48b676){if(_0x48b676[_0xda56('0x1f')]){logger[_0xda56('0xc')]('Agent\x20found!');return _[_0xda56('0x20')](_0x48b676,function(_0x5c15f0){return _0x5c15f0[_0xda56('0x21')][_0xda56('0x22')]===_0x33635d;});}else{logger[_0xda56('0xc')](_0xda56('0x23'));return request({'uri':util[_0xda56('0x17')](_0xda56('0x24'),_0x5798ff[_0xda56('0x1d')])})[_0xda56('0x1e')](function(_0x9b62a4){logger[_0xda56('0xc')](_0xda56('0x25'));return _0x9b62a4;});}});}else{logger[_0xda56('0xc')](_0xda56('0x26'));return request({'uri':util[_0xda56('0x17')](_0xda56('0x24'),_0x5798ff['remoteUri'])})[_0xda56('0x1e')](function(_0x15b3c9){logger[_0xda56('0xc')]('Admin\x20account\x20selected.');return _0x15b3c9;});}}function getEndUser(_0x3c9a66,_0xc00faf,_0x5b1fba){logger[_0xda56('0xc')](_0xda56('0x27'),_0x5b1fba);return request({'uri':util[_0xda56('0x17')]('%s/api/v2/contacts',_0x3c9a66[_0xda56('0x1d')]),'qs':{'phone':_0x5b1fba}})['then'](function(_0x379c29){if(_0x379c29[_0xda56('0x1f')]){logger['info'](_0xda56('0x28'));return _[_0xda56('0x20')](_0x379c29,{'phone':_0x5b1fba});}else{logger[_0xda56('0xc')](_0xda56('0x29'));return request({'uri':util['format'](_0xda56('0x2a'),_0x3c9a66[_0xda56('0x1d')]),'method':_0xda56('0x19'),'body':{'name':_0xc00faf,'phone':_0x5b1fba}})[_0xda56('0x1e')](function(_0x1c9efa){logger['info'](_0xda56('0x2b'));return _0x1c9efa;});}});}function getAuth(_0x28af9a){return util[_0xda56('0x17')]('Basic\x20%s',new Buffer(_0x28af9a[_0xda56('0x2c')]+':X')['toString']('base64'));}function request(_0x1c388a){logger['debug']('[HTTP]',JSON[_0xda56('0x2d')](_0x1c388a));return rp(_[_0xda56('0x7')](_0x1c388a,{'method':_0xda56('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x375e73,_0xe42a22){var _0x2e1120=[];if(_0x375e73&&_0x375e73[_0xda56('0x1f')]>0x0){_0x2e1120=_[_0xda56('0x2f')](_0x375e73,_0xe42a22);}return _0x2e1120;}function getCustomFields(_0x18d977,_0x36f362){var _0x131f3a=[];var _0x190d4d={'custom_fields':[]};if(_0x18d977[_0xda56('0x1f')]>0x0){_['forEach'](_0x18d977,function(_0x1a5464){if(_['includes']([_0xda56('0x30'),_0xda56('0x31')],_0x1a5464[_0xda56('0x32')])&&_0x1a5464[_0xda56('0x33')]&&!_0x1a5464['customField']){_0x190d4d[_0x1a5464[_0xda56('0x33')]['toLowerCase']()]=_0x1a5464[_0xda56('0x34')][_0xda56('0x35')]();}else if(_['includes']([_0xda56('0x30'),_0xda56('0x31')],_0x1a5464['type'])&&_0x1a5464[_0xda56('0x36')]&&_0x1a5464['customField']){_0x190d4d[_0xda56('0x15')][_0xda56('0x37')]({'id':_0x1a5464[_0xda56('0x36')],'value':_0x1a5464[_0xda56('0x34')][_0xda56('0x35')]()});}else if(_0x1a5464[_0xda56('0x32')]==='variable'&&_0x1a5464[_0xda56('0x38')]&&_0x1a5464[_0xda56('0x36')]&&_0x1a5464[_0xda56('0x39')]){_0x36f362[_0x1a5464[_0xda56('0x38')]]&&_0x190d4d[_0xda56('0x15')][_0xda56('0x37')]({'id':_0x1a5464['idField'],'value':_0x36f362[_0x1a5464['variableName']][_0xda56('0x35')]()});}else if(_0x1a5464[_0xda56('0x32')]===_0xda56('0x3a')&&_0x1a5464[_0xda56('0x3b')]&&_0x1a5464['Variable'][_0xda56('0x11')]&&_0x1a5464[_0xda56('0x36')]&&_0x1a5464[_0xda56('0x39')]){_0x36f362[_0x1a5464[_0xda56('0x3b')][_0xda56('0x11')][_0xda56('0x3c')]()]&&_0x190d4d[_0xda56('0x15')][_0xda56('0x37')]({'id':_0x1a5464['idField'],'value':_0x36f362[_0x1a5464[_0xda56('0x3b')]['name'][_0xda56('0x3c')]()][_0xda56('0x35')]()});}});}return _0x190d4d;}exports['queue']=function(_0x1b40e8,_0x254036,_0x11a37f,_0x597962,_0x4df694,_0x21d752){var _0x49ca64,_0xac0400;_0x21d752['remoteUri']=intUtil[_0xda56('0x3d')](_0x21d752[_0xda56('0x1d')]);_0x21d752[_0xda56('0x3e')]=intUtil['stripTrailingSlash'](_0x21d752[_0xda56('0x3e')]);if(_0x4df694&&_0x4df694[_0xda56('0x3f')]){logger[_0xda56('0xc')](_0xda56('0x40'),_0xda56('0x41'));_0x254036[_0xda56('0x42')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21d752['serverUrl'],_0x254036[_0xda56('0x43')],md5(_0x254036[_0xda56('0x43')]));}else{_0x254036[_0xda56('0x42')]='';}headers['Authorization']=getAuth(_0x21d752);return getUser(_0x21d752,_0x597962[_0xda56('0x22')])[_0xda56('0x1e')](function(_0x3df2ae){_0x49ca64=_0x3df2ae;logger[_0xda56('0xc')](_0xda56('0x44'),_0x49ca64['id']);return getEndUser(_0x21d752,_0x254036[_0xda56('0xd')],_0x254036[_0xda56('0x45')]);})[_0xda56('0x1e')](function(_0x427b40){_0xac0400=_0x427b40;logger['info']('The\x20Enduser\x20ID\x20is:',_0xac0400['id']);return getTicket(_0x21d752,_0x49ca64,_0xac0400,_0x11a37f,_0x254036);})[_0xda56('0x1e')](function(_0x397adc){if(_0x397adc&&_0x397adc['id']){logger['info'](_0xda56('0x1a'));logger[_0xda56('0xc')](_0xda56('0x46'),_0x397adc['id']);logger[_0xda56('0xc')](_0xda56('0x40'),_0xda56('0x47'));emit(util[_0xda56('0x17')]('user:%s',_0x597962[_0xda56('0x11')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x21d752[_0xda56('0x1d')],_0x397adc['id'])});}})[_0xda56('0x48')](function(_0x7f1389){logger[_0xda56('0x49')](_0xda56('0x40'),JSON[_0xda56('0x2d')](_0x7f1389));});};exports[_0xda56('0x4a')]=function(_0x4df4a8,_0x18343f,_0x28cc5e,_0x22dac9,_0x25a3a1,_0x66aa81,_0x4c7c80){var _0x327a96,_0x37f551;_0x66aa81[_0xda56('0x1d')]=intUtil[_0xda56('0x3d')](_0x66aa81['remoteUri']);_0x66aa81[_0xda56('0x3e')]=intUtil[_0xda56('0x3d')](_0x66aa81[_0xda56('0x3e')]);if(_0x4c7c80&&_0x4c7c80[_0xda56('0x4b')]&&_0x4c7c80[_0xda56('0x4b')]!==_0xda56('0x4c')){logger[_0xda56('0xc')](_0xda56('0x4d'),_0xda56('0x41'));_0x18343f[_0xda56('0x42')]=util['format'](_0xda56('0x4e'),_0x66aa81[_0xda56('0x3e')],_0x18343f[_0xda56('0x43')],md5(_0x18343f['uniqueid']));}headers[_0xda56('0x4f')]=getAuth(_0x66aa81);return getUser(_0x66aa81,_0x22dac9[_0xda56('0x22')])[_0xda56('0x1e')](function(_0x1762c6){_0x327a96=_0x1762c6;logger[_0xda56('0xc')](_0xda56('0x44'),_0x327a96['id']);return getEndUser(_0x66aa81,_0x18343f['destcalleridname'],_0x18343f[_0xda56('0x50')]);})[_0xda56('0x1e')](function(_0x120e0d){_0x37f551=_0x120e0d;logger[_0xda56('0xc')](_0xda56('0x51'),_0x37f551['id']);return getTicket(_0x66aa81,_0x327a96,_0x37f551,_0x28cc5e,_0x18343f);})['then'](function(_0x225176){if(_0x225176&&_0x225176['id']){logger['info'](_0xda56('0x1a'));logger['info'](_0xda56('0x46'),_0x225176['id']);logger[_0xda56('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xda56('0x17')](_0xda56('0x52'),_0x22dac9['name']),_0xda56('0x53'),{'uri':util[_0xda56('0x17')](_0xda56('0x54'),_0x66aa81[_0xda56('0x1d')],_0x225176['id'])});}})['catch'](function(_0x15bdb9){logger[_0xda56('0x49')]('[OUTBOUND]',JSON['stringify'](_0x15bdb9));});};exports['unmanaged']=function(_0x325fd2,_0x136689,_0x3cd533,_0x1698b1,_0xcd9633,_0x409638){var _0x428694,_0x4dc7a5;_0x409638[_0xda56('0x1d')]=intUtil[_0xda56('0x3d')](_0x409638[_0xda56('0x1d')]);_0x409638[_0xda56('0x3e')]=intUtil[_0xda56('0x3d')](_0x409638[_0xda56('0x3e')]);if(_0xcd9633&&_0xcd9633[_0xda56('0x3f')]){logger[_0xda56('0xc')]('['+_0x136689[_0xda56('0x55')][_0xda56('0x56')]()+']',_0xda56('0x41'));_0x136689['recordingURL']=util[_0xda56('0x17')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x409638[_0xda56('0x3e')],_0x136689[_0xda56('0x43')],md5(_0x136689[_0xda56('0x43')]));}else{_0x136689[_0xda56('0x42')]='';}headers[_0xda56('0x4f')]=getAuth(_0x409638);return getUser(_0x409638,'')[_0xda56('0x1e')](function(_0x4b35ed){_0x428694=_0x4b35ed;logger[_0xda56('0xc')](_0xda56('0x44'),_0x428694['id']);return getEndUser(_0x409638,_0x136689['calleridname'],_0x136689[_0xda56('0x45')]);})['then'](function(_0x4060dc){_0x4dc7a5=_0x4060dc;logger[_0xda56('0xc')](_0xda56('0x51'),_0x4dc7a5['id']);return getTicket(_0x409638,_0x428694,_0x4dc7a5,_0x3cd533,_0x136689);})['then'](function(_0x1d88b7){if(_0x1d88b7){logger[_0xda56('0xc')](_0xda56('0x1a'));logger[_0xda56('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1d88b7['id']);}})[_0xda56('0x48')](function(_0x51708a){logger[_0xda56('0x49')]('['+_0x136689['lastevent'][_0xda56('0x56')]()+']',JSON['stringify'](_0x51708a));});}; \ 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 a449acb..6f2e622 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 _0x4c3e=['serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','moment','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','headers','info','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20with\x20email','agentEmail','email','userId','User\x20found:','Admin\x20selected','catch','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Creating\x20new\x20task','POST','/api/tasks','getString','Descriptions','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','apiKey','remoteUri','stripTrailingSlash'];(function(_0xad0d96,_0x34adca){var _0x7b1862=function(_0x306608){while(--_0x306608){_0xad0d96['push'](_0xad0d96['shift']());}};_0x7b1862(++_0x34adca);}(_0x4c3e,0xae));var _0xe4c3=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x4c3e[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xe4c3('0x0'));var rp=require(_0xe4c3('0x1'));var md5=require('md5');var util=require('util');var moment=require(_0xe4c3('0x2'));var Promise=require(_0xe4c3('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xe4c3('0x4'));var logger=require(_0xe4c3('0x5'))('freshsales');config[_0xe4c3('0x6')]=_[_0xe4c3('0x7')](config[_0xe4c3('0x6')],{'host':_0xe4c3('0x8'),'port':0x18eb});var io=require(_0xe4c3('0x9'))(new Redis(config[_0xe4c3('0x6')]));function getAdminId(_0x2b41fc,_0x49fa3f,_0x32e9de,_0x4a7e4f){return new Promise(function(_0x2ee762,_0x220c44){var _0x4d413f=![];var _0x5de939={'method':_0xe4c3('0xa'),'uri':_0x4a7e4f+'/api/selector/owners','json':!![]};_0x5de939[_0xe4c3('0xb')]=_0x32e9de;logger[_0xe4c3('0xc')]('Getting\x20admin\x20information');return rp(_0x5de939)[_0xe4c3('0xd')](function(_0xbdba35){if(_0xbdba35){var _0x50d8cd=_0xbdba35[_0xe4c3('0xe')];var _0x14fe49=null;for(_0x14fe49=0x0;_0x14fe49<_0x50d8cd[_0xe4c3('0xf')];_0x14fe49++){if(_0x50d8cd[_0x14fe49]['email']===_0x2b41fc[_0xe4c3('0x10')]){_0x2b41fc[_0xe4c3('0x11')]=_0x50d8cd[_0x14fe49]['id'];_0x4d413f=!![];}}if(_0x4d413f){logger[_0xe4c3('0xc')]('Admin\x20found:',_0x2b41fc[_0xe4c3('0x11')]);_0x2ee762(_0x2b41fc);}else{_0x220c44({'statusCode':0x194,'message':_0xe4c3('0x12')});}}else{_0x220c44({'statusCode':0x194,'message':_0xe4c3('0x12')});}})['catch'](function(_0x35edb0){logger[_0xe4c3('0x13')]('['+[_0x49fa3f[_0xe4c3('0x14')]()]+']',_0x35edb0[_0xe4c3('0x15')]);_0x220c44(_0x35edb0);});});}function getUser(_0x2e8b2,_0x45fbcb,_0x5632cc){return function(_0x377206){return new Promise(function(_0x31d4ea,_0x1b2f9f){var _0x5a95ad={'method':_0xe4c3('0xa'),'uri':_0x5632cc+_0xe4c3('0x16'),'json':!![]};_0x5a95ad[_0xe4c3('0xb')]=_0x45fbcb;logger[_0xe4c3('0xc')]('Getting\x20user\x20list');return rp(_0x5a95ad)[_0xe4c3('0xd')](function(_0x418e6a){if(_0x418e6a){var _0x39050a=_0x418e6a[_0xe4c3('0xe')];var _0x580cd0=![];var _0x5bb431=null;if(_0x377206['agentEmail']!==null){logger[_0xe4c3('0xc')](_0xe4c3('0x17'),_0x377206[_0xe4c3('0x18')]);_0x377206['userEmail']=_0x377206[_0xe4c3('0x18')];for(_0x5bb431=0x0;_0x5bb431<_0x39050a[_0xe4c3('0xf')];_0x5bb431++){if(_0x39050a[_0x5bb431][_0xe4c3('0x19')]===_0x377206[_0xe4c3('0x18')]){_0x580cd0=!![];_0x377206[_0xe4c3('0x1a')]=_0x39050a[_0x5bb431]['id'];logger[_0xe4c3('0xc')](_0xe4c3('0x1b'),_0x377206[_0xe4c3('0x1a')]);}}}if(!_0x580cd0){logger[_0xe4c3('0xc')](_0xe4c3('0x1c'));_0x377206['userEmail']=_0x377206[_0xe4c3('0x10')];_0x377206[_0xe4c3('0x1a')]=_0x377206[_0xe4c3('0x11')];_0x580cd0=!![];}if(_0x580cd0){_0x31d4ea(_0x377206);}else{_0x1b2f9f({'statusCode':0x194,'message':_0xe4c3('0x12')});}}else{_0x1b2f9f({'statusCode':0x194,'message':_0xe4c3('0x12')});}})[_0xe4c3('0x1d')](function(_0x286156){logger[_0xe4c3('0x13')]('['+[_0x2e8b2['toUpperCase']()]+']',_0x286156[_0xe4c3('0x15')]);_0x1b2f9f(_0x286156);});});};}function searchContact(_0x4a9b70,_0x1db5f3,_0x11769b,_0x144c67){return new Promise(function(_0x144383,_0x590d96){var _0x3309be={'method':'GET','headers':_0x1db5f3,'uri':_0x4a9b70+'/api/lookup?q='+_0x144c67+'&f='+_0x11769b+'&entities=contact','json':!![]};rp(_0x3309be)[_0xe4c3('0xd')](function(_0x4dbaad){var _0x50ec89=_[_0xe4c3('0x1e')](_0x4dbaad[_0xe4c3('0x1f')][_0xe4c3('0x1f')],[_0x11769b,_0x144c67]);_0x144383(_0x50ec89);})[_0xe4c3('0x1d')](function(_0x42bf3a){_0x590d96(_0x42bf3a);});});}function getEndUser(_0x3f7b40,_0x53377c,_0x525282){return function(_0x33a382){return new Promise(function(_0x3e3d9d,_0x244551){logger[_0xe4c3('0xc')](util['format'](_0xe4c3('0x20'),_0x33a382[_0xe4c3('0x21')]));searchContact(_0x525282,_0x53377c,_0xe4c3('0x22'),_0x33a382[_0xe4c3('0x21')])[_0xe4c3('0xd')](function(_0x5b0056){if(_0x5b0056){_0x33a382['endUserId']=_0x5b0056['id'];logger['info'](_0xe4c3('0x23'),_0x33a382[_0xe4c3('0x24')]);return _0x3e3d9d(_0x33a382);}searchContact(_0x525282,_0x53377c,_0xe4c3('0x25'),_0x33a382[_0xe4c3('0x21')])[_0xe4c3('0xd')](function(_0x81d441){if(_0x81d441){_0x33a382[_0xe4c3('0x24')]=_0x81d441['id'];logger[_0xe4c3('0xc')](_0xe4c3('0x26'),_0x33a382[_0xe4c3('0x24')]);return _0x3e3d9d(_0x33a382);}createEndUser(_0x33a382,_0x3f7b40,_0x53377c,_0x525282)['then'](function(_0x88dab8){logger[_0xe4c3('0xc')]('Contact\x20created:',_0x88dab8['endUserId']);return _0x3e3d9d(_0x88dab8);});});})[_0xe4c3('0x1d')](function(_0x58e0ce){_0x244551(_0x58e0ce);});});};}function createEndUser(_0x24b5b8,_0x503f77,_0x325376,_0x4cd734){return new Promise(function(_0x55614c,_0xeaf8df){var _0x5f1182=moment();var _0x12d0e6={'method':'POST','uri':_0x4cd734+_0xe4c3('0x27'),'body':{'contact':{'last_name':_0x24b5b8[_0xe4c3('0x21')],'work_number':_0x24b5b8[_0xe4c3('0x21')],'mobile_number':_0x24b5b8[_0xe4c3('0x21')],'owner_id':_0x24b5b8['userId'],'created_at':_0x5f1182[_0xe4c3('0x28')](_0xe4c3('0x29'))}},'json':!![]};_0x12d0e6['headers']=_0x325376;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x12d0e6)[_0xe4c3('0xd')](function(_0x44a34f){_0x24b5b8[_0xe4c3('0x24')]=_0x44a34f['contact']['id'];_0x55614c(_0x24b5b8);})[_0xe4c3('0x1d')](function(_0x564ffe){logger[_0xe4c3('0x13')]('['+[_0x503f77[_0xe4c3('0x14')]()]+']',_0x564ffe['message']);_0xeaf8df(_0x564ffe[_0xe4c3('0x15')]);});});}function getTicket(_0x446647,_0x19ba6a,_0x3381e2,_0x5d3202,_0x295b5f){return function(_0x18e21d){logger[_0xe4c3('0xc')](_0xe4c3('0x2a'));return new Promise(function(_0xcf06f0,_0x943f55){var _0x5779a4=moment();var _0x3a531c={'method':_0xe4c3('0x2b'),'uri':_0x3381e2+_0xe4c3('0x2c'),'body':{'title':intUtil[_0xe4c3('0x2d')](_0x5d3202['Subjects'],_0x295b5f,'\x20'),'description':intUtil['getString'](_0x5d3202[_0xe4c3('0x2e')],_0x295b5f,'\x0a'),'owner_id':_0x18e21d[_0xe4c3('0x1a')],'creater_id':_0x18e21d['adminId'],'targetable_id':_0x18e21d[_0xe4c3('0x24')],'targetable_type':'Contact','created_at':_0x5779a4[_0xe4c3('0x28')](_0xe4c3('0x29')),'due_date':_0x5779a4[_0xe4c3('0x2f')](0x1e,'m')[_0xe4c3('0x28')](_0xe4c3('0x29'))},'json':!![]};_0x3a531c[_0xe4c3('0xb')]=_0x19ba6a;return rp(_0x3a531c)[_0xe4c3('0xd')](function(_0x7fe742){_0x18e21d[_0xe4c3('0x30')]=_0x7fe742[_0xe4c3('0x31')]['id'];logger[_0xe4c3('0xc')](_0xe4c3('0x32'),_0x18e21d['ticketId']);_0xcf06f0(_0x18e21d);})[_0xe4c3('0x1d')](function(_0x4cb8e9){logger[_0xe4c3('0x13')]('['+[_0x446647[_0xe4c3('0x14')]()]+']',_0x4cb8e9[_0xe4c3('0x15')]);_0x943f55(_0x4cb8e9['message']);});});};}function emit(_0x4edad8,_0x561088,_0x52b66a){var _0x36b95b={'uri':_0x4edad8+'/contacts/'+_0x52b66a};io['to'](util[_0xe4c3('0x28')](_0xe4c3('0x33'),_0x561088))[_0xe4c3('0x34')](_0xe4c3('0x35'),_0x36b95b);}exports['cs']=function(_0x3c3fae,_0x7e3e03,_0x285937,_0x152900,_0xb4b27,_0x29a3af,_0x33b859,_0x3a55b3){var _0x2e7a76={};var _0x3e1dbc={'Authorization':'Token\x20token='+_0x29a3af[_0xe4c3('0x36')]};_0x29a3af[_0xe4c3('0x37')]=intUtil[_0xe4c3('0x38')](_0x29a3af[_0xe4c3('0x37')]);_0x29a3af[_0xe4c3('0x39')]=intUtil[_0xe4c3('0x38')](_0x29a3af['serverUrl']);var _0x1ceceb=_0x29a3af['remoteUri'];_0x2e7a76[_0xe4c3('0x10')]=_0x29a3af[_0xe4c3('0x3a')];_0x2e7a76[_0xe4c3('0x21')]=_0x3a55b3[_0xe4c3('0x3b')]()===_0xe4c3('0x3c')?_0x7e3e03[_0xe4c3('0x3d')]:_0x7e3e03[_0xe4c3('0x3e')];_0x2e7a76[_0xe4c3('0x3f')]=_0x3a55b3===_0xe4c3('0x40')||_0x3a55b3===_0xe4c3('0x41')?'queue':_0xe4c3('0x3c');if(_0x152900){_0x2e7a76[_0xe4c3('0x18')]=_0x152900[_0xe4c3('0x19')];}var _0x30cec9=util[_0xe4c3('0x28')](_0xe4c3('0x42'),_0x29a3af[_0xe4c3('0x39')],_0x7e3e03[_0xe4c3('0x43')],md5(_0x7e3e03[_0xe4c3('0x43')]));if(_0xb4b27&&_0xb4b27['monitor_format']){logger['info'](_0xe4c3('0x44'),_0xe4c3('0x45'));_0x7e3e03[_0xe4c3('0x46')]=_0x30cec9;}else if(_0x33b859&&_0x33b859[_0xe4c3('0x47')]&&_0x33b859[_0xe4c3('0x47')]!==_0xe4c3('0x48')){logger['info']('[OUTBOUND]',_0xe4c3('0x45'));_0x7e3e03[_0xe4c3('0x46')]=_0x30cec9;}else{_0x7e3e03['recordingURL']='';}return getAdminId(_0x2e7a76,_0x3a55b3,_0x3e1dbc,_0x1ceceb)[_0xe4c3('0xd')](getUser(_0x3a55b3,_0x3e1dbc,_0x1ceceb))['then'](getEndUser(_0x3a55b3,_0x3e1dbc,_0x1ceceb))[_0xe4c3('0xd')](getTicket(_0x3a55b3,_0x3e1dbc,_0x1ceceb,_0x285937,_0x7e3e03))[_0xe4c3('0xd')](function(_0x42c928){logger[_0xe4c3('0xc')](util[_0xe4c3('0x28')](_0xe4c3('0x49'),_0x42c928[_0xe4c3('0x30')]));if(_0x3a55b3!==_0xe4c3('0x41')){logger[_0xe4c3('0xc')]('['+[_0x3a55b3['toUpperCase']()]+']',_0xe4c3('0x4a'));emit(_0x1ceceb,_0x152900[_0xe4c3('0x4b')],_0x42c928['endUserId']);}})[_0xe4c3('0x1d')](function(_0x5b3964){logger[_0xe4c3('0x13')]('['+[_0x3a55b3[_0xe4c3('0x14')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xe4c3('0x4c')](_0x5b3964,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5bb0=['&f=','&entities=contact','find','contacts','contactNumber','mobile_number','then','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','agentEmail','Getting\x20user\x20with\x20email','userId','Admin\x20selected','userEmail','catch','/api/lookup?q='];(function(_0x34b6aa,_0x5ddd29){var _0x3ead29=function(_0x53979c){while(--_0x53979c){_0x34b6aa['push'](_0x34b6aa['shift']());}};_0x3ead29(++_0x5ddd29);}(_0x5bb0,0x13e));var _0x05bb=function(_0x200095,_0x41e7ef){_0x200095=_0x200095-0x0;var _0x4a4644=_0x5bb0[_0x200095];return _0x4a4644;};'use strict';var _=require(_0x05bb('0x0'));var rp=require('request-promise');var md5=require(_0x05bb('0x1'));var util=require(_0x05bb('0x2'));var moment=require(_0x05bb('0x3'));var Promise=require('bluebird');var Redis=require(_0x05bb('0x4'));var intUtil=require(_0x05bb('0x5'));var config=require(_0x05bb('0x6'));var logger=require(_0x05bb('0x7'))(_0x05bb('0x8'));config['redis']=_['defaults'](config[_0x05bb('0x9')],{'host':_0x05bb('0xa'),'port':0x18eb});var io=require(_0x05bb('0xb'))(new Redis(config[_0x05bb('0x9')]));function getAdminId(_0x240722,_0x3316f7,_0x28895c,_0x31bd4f){return new Promise(function(_0x5a1bea,_0x28c74e){var _0x15c63a=![];var _0xc1293a={'method':_0x05bb('0xc'),'uri':_0x31bd4f+_0x05bb('0xd'),'json':!![]};_0xc1293a['headers']=_0x28895c;logger['info'](_0x05bb('0xe'));return rp(_0xc1293a)['then'](function(_0x45b7bc){if(_0x45b7bc){var _0x541a90=_0x45b7bc[_0x05bb('0xf')];var _0x26377f=null;for(_0x26377f=0x0;_0x26377f<_0x541a90[_0x05bb('0x10')];_0x26377f++){if(_0x541a90[_0x26377f][_0x05bb('0x11')]===_0x240722[_0x05bb('0x12')]){_0x240722[_0x05bb('0x13')]=_0x541a90[_0x26377f]['id'];_0x15c63a=!![];}}if(_0x15c63a){logger[_0x05bb('0x14')](_0x05bb('0x15'),_0x240722['adminId']);_0x5a1bea(_0x240722);}else{_0x28c74e({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x28c74e({'statusCode':0x194,'message':_0x05bb('0x16')});}})['catch'](function(_0x2c8919){logger[_0x05bb('0x17')]('['+[_0x3316f7[_0x05bb('0x18')]()]+']',_0x2c8919[_0x05bb('0x19')]);_0x28c74e(_0x2c8919);});});}function getUser(_0x1b48d4,_0x582b24,_0x494d76){return function(_0x5cd8f3){return new Promise(function(_0x250846,_0x5b0431){var _0x53e238={'method':_0x05bb('0xc'),'uri':_0x494d76+_0x05bb('0xd'),'json':!![]};_0x53e238[_0x05bb('0x1a')]=_0x582b24;logger['info']('Getting\x20user\x20list');return rp(_0x53e238)['then'](function(_0x319f39){if(_0x319f39){var _0xdeb59e=_0x319f39[_0x05bb('0xf')];var _0x590738=![];var _0x4a5bcd=null;if(_0x5cd8f3[_0x05bb('0x1b')]!==null){logger[_0x05bb('0x14')](_0x05bb('0x1c'),_0x5cd8f3[_0x05bb('0x1b')]);_0x5cd8f3['userEmail']=_0x5cd8f3[_0x05bb('0x1b')];for(_0x4a5bcd=0x0;_0x4a5bcd<_0xdeb59e[_0x05bb('0x10')];_0x4a5bcd++){if(_0xdeb59e[_0x4a5bcd][_0x05bb('0x11')]===_0x5cd8f3[_0x05bb('0x1b')]){_0x590738=!![];_0x5cd8f3[_0x05bb('0x1d')]=_0xdeb59e[_0x4a5bcd]['id'];logger[_0x05bb('0x14')]('User\x20found:',_0x5cd8f3[_0x05bb('0x1d')]);}}}if(!_0x590738){logger['info'](_0x05bb('0x1e'));_0x5cd8f3[_0x05bb('0x1f')]=_0x5cd8f3[_0x05bb('0x12')];_0x5cd8f3[_0x05bb('0x1d')]=_0x5cd8f3['adminId'];_0x590738=!![];}if(_0x590738){_0x250846(_0x5cd8f3);}else{_0x5b0431({'statusCode':0x194,'message':_0x05bb('0x16')});}}else{_0x5b0431({'statusCode':0x194,'message':_0x05bb('0x16')});}})[_0x05bb('0x20')](function(_0x243731){logger[_0x05bb('0x17')]('['+[_0x1b48d4[_0x05bb('0x18')]()]+']',_0x243731[_0x05bb('0x19')]);_0x5b0431(_0x243731);});});};}function searchContact(_0x4a3fe1,_0x11eeca,_0x378830,_0x3e5227){return new Promise(function(_0x3bc141,_0x48766c){var _0x4e45a8={'method':_0x05bb('0xc'),'headers':_0x11eeca,'uri':_0x4a3fe1+_0x05bb('0x21')+_0x3e5227+_0x05bb('0x22')+_0x378830+_0x05bb('0x23'),'json':!![]};rp(_0x4e45a8)['then'](function(_0x4236d3){var _0x30469e=_[_0x05bb('0x24')](_0x4236d3[_0x05bb('0x25')][_0x05bb('0x25')],[_0x378830,_0x3e5227]);_0x3bc141(_0x30469e);})['catch'](function(_0x22d481){_0x48766c(_0x22d481);});});}function getEndUser(_0x57fb9,_0x392fe8,_0x4b5a1f){return function(_0x16fe88){return new Promise(function(_0x4025e6,_0x58d479){logger[_0x05bb('0x14')](util['format']('Searching\x20contact\x20with\x20phone\x20%s',_0x16fe88[_0x05bb('0x26')]));searchContact(_0x4b5a1f,_0x392fe8,_0x05bb('0x27'),_0x16fe88[_0x05bb('0x26')])[_0x05bb('0x28')](function(_0x1fe6b4){if(_0x1fe6b4){_0x16fe88[_0x05bb('0x29')]=_0x1fe6b4['id'];logger[_0x05bb('0x14')](_0x05bb('0x2a'),_0x16fe88['endUserId']);return _0x4025e6(_0x16fe88);}searchContact(_0x4b5a1f,_0x392fe8,_0x05bb('0x2b'),_0x16fe88[_0x05bb('0x26')])[_0x05bb('0x28')](function(_0x592d88){if(_0x592d88){_0x16fe88[_0x05bb('0x29')]=_0x592d88['id'];logger[_0x05bb('0x14')](_0x05bb('0x2c'),_0x16fe88[_0x05bb('0x29')]);return _0x4025e6(_0x16fe88);}createEndUser(_0x16fe88,_0x57fb9,_0x392fe8,_0x4b5a1f)[_0x05bb('0x28')](function(_0x4ea3e7){logger[_0x05bb('0x14')](_0x05bb('0x2d'),_0x4ea3e7[_0x05bb('0x29')]);return _0x4025e6(_0x4ea3e7);});});})[_0x05bb('0x20')](function(_0x59e731){_0x58d479(_0x59e731);});});};}function createEndUser(_0xc72944,_0x5e62cb,_0x1c4a30,_0x30d8bb){return new Promise(function(_0x2279a2,_0xf5d3ce){var _0x12dc72=moment();var _0x5e2f07={'method':_0x05bb('0x2e'),'uri':_0x30d8bb+_0x05bb('0x2f'),'body':{'contact':{'last_name':_0xc72944[_0x05bb('0x26')],'work_number':_0xc72944[_0x05bb('0x26')],'mobile_number':_0xc72944['contactNumber'],'owner_id':_0xc72944[_0x05bb('0x1d')],'created_at':_0x12dc72[_0x05bb('0x30')](_0x05bb('0x31'))}},'json':!![]};_0x5e2f07[_0x05bb('0x1a')]=_0x1c4a30;logger['info'](_0x05bb('0x32'));return rp(_0x5e2f07)[_0x05bb('0x28')](function(_0x146191){_0xc72944[_0x05bb('0x29')]=_0x146191[_0x05bb('0x33')]['id'];_0x2279a2(_0xc72944);})[_0x05bb('0x20')](function(_0x612c04){logger[_0x05bb('0x17')]('['+[_0x5e62cb['toUpperCase']()]+']',_0x612c04[_0x05bb('0x19')]);_0xf5d3ce(_0x612c04[_0x05bb('0x19')]);});});}function getTicket(_0x45c398,_0xea8304,_0x18e1db,_0xedc24c,_0x38d25c){return function(_0x49b3ce){logger['info'](_0x05bb('0x34'));return new Promise(function(_0x252526,_0x25fc8c){var _0x4f1145=moment();var _0x39585b={'method':_0x05bb('0x2e'),'uri':_0x18e1db+_0x05bb('0x35'),'body':{'title':intUtil[_0x05bb('0x36')](_0xedc24c['Subjects'],_0x38d25c,'\x20'),'description':intUtil[_0x05bb('0x36')](_0xedc24c[_0x05bb('0x37')],_0x38d25c,'\x0a'),'owner_id':_0x49b3ce[_0x05bb('0x1d')],'creater_id':_0x49b3ce[_0x05bb('0x13')],'targetable_id':_0x49b3ce['endUserId'],'targetable_type':'Contact','created_at':_0x4f1145[_0x05bb('0x30')](_0x05bb('0x31')),'due_date':_0x4f1145[_0x05bb('0x38')](0x1e,'m')['format'](_0x05bb('0x31'))},'json':!![]};_0x39585b[_0x05bb('0x1a')]=_0xea8304;return rp(_0x39585b)[_0x05bb('0x28')](function(_0xb89c2){_0x49b3ce[_0x05bb('0x39')]=_0xb89c2[_0x05bb('0x3a')]['id'];logger[_0x05bb('0x14')](_0x05bb('0x3b'),_0x49b3ce[_0x05bb('0x39')]);_0x252526(_0x49b3ce);})['catch'](function(_0xc84064){logger['error']('['+[_0x45c398[_0x05bb('0x18')]()]+']',_0xc84064[_0x05bb('0x19')]);_0x25fc8c(_0xc84064['message']);});});};}function emit(_0x1553a0,_0x7d0d8,_0x3ec46c){var _0x278ed4={'uri':_0x1553a0+_0x05bb('0x3c')+_0x3ec46c};io['to'](util[_0x05bb('0x30')](_0x05bb('0x3d'),_0x7d0d8))['emit'](_0x05bb('0x3e'),_0x278ed4);}exports['cs']=function(_0xe8849d,_0x5dc970,_0x21263d,_0xf280d1,_0x328034,_0x3153b8,_0x566dc9,_0x57abee){var _0x8836d8={};var _0x3afe16={'Authorization':_0x05bb('0x3f')+_0x3153b8['apiKey']};_0x3153b8[_0x05bb('0x40')]=intUtil['stripTrailingSlash'](_0x3153b8[_0x05bb('0x40')]);_0x3153b8[_0x05bb('0x41')]=intUtil['stripTrailingSlash'](_0x3153b8[_0x05bb('0x41')]);var _0x5a396b=_0x3153b8[_0x05bb('0x40')];_0x8836d8[_0x05bb('0x12')]=_0x3153b8[_0x05bb('0x42')];_0x8836d8[_0x05bb('0x26')]=_0x57abee[_0x05bb('0x43')]()===_0x05bb('0x44')?_0x5dc970[_0x05bb('0x45')]:_0x5dc970[_0x05bb('0x46')];_0x8836d8[_0x05bb('0x47')]=_0x57abee===_0x05bb('0x48')||_0x57abee===_0x05bb('0x49')?_0x05bb('0x48'):_0x05bb('0x44');if(_0xf280d1){_0x8836d8[_0x05bb('0x1b')]=_0xf280d1[_0x05bb('0x11')];}var _0x2231bf=util[_0x05bb('0x30')](_0x05bb('0x4a'),_0x3153b8[_0x05bb('0x41')],_0x5dc970[_0x05bb('0x4b')],md5(_0x5dc970[_0x05bb('0x4b')]));if(_0x328034&&_0x328034[_0x05bb('0x4c')]){logger[_0x05bb('0x14')](_0x05bb('0x4d'),_0x05bb('0x4e'));_0x5dc970['recordingURL']=_0x2231bf;}else if(_0x566dc9&&_0x566dc9[_0x05bb('0x4f')]&&_0x566dc9[_0x05bb('0x4f')]!==_0x05bb('0x50')){logger[_0x05bb('0x14')](_0x05bb('0x51'),'Recording\x20is\x20enabled!');_0x5dc970[_0x05bb('0x52')]=_0x2231bf;}else{_0x5dc970[_0x05bb('0x52')]='';}return getAdminId(_0x8836d8,_0x57abee,_0x3afe16,_0x5a396b)['then'](getUser(_0x57abee,_0x3afe16,_0x5a396b))['then'](getEndUser(_0x57abee,_0x3afe16,_0x5a396b))[_0x05bb('0x28')](getTicket(_0x57abee,_0x3afe16,_0x5a396b,_0x21263d,_0x5dc970))[_0x05bb('0x28')](function(_0x4987c6){logger[_0x05bb('0x14')](util['format'](_0x05bb('0x53'),_0x4987c6['ticketId']));if(_0x57abee!=='unmanaged'){logger[_0x05bb('0x14')]('['+[_0x57abee[_0x05bb('0x18')]()]+']',_0x05bb('0x54'));emit(_0x5a396b,_0xf280d1[_0x05bb('0x55')],_0x4987c6[_0x05bb('0x29')]);}})[_0x05bb('0x20')](function(_0x2d8c57){logger['error']('['+[_0x57abee[_0x05bb('0x18')]()]+_0x05bb('0x56'),util[_0x05bb('0x57')](_0x2d8c57,{'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 808a723..42cfd81 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 _0x072a=['%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./desk','./servicenow','./freshsales','zendesk','sugarcrm','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','salesforce','freshdesk','desk','unknown\x20integration','../../../../config/logger','format','error'];(function(_0x18337a,_0x47bb74){var _0x479625=function(_0x15602c){while(--_0x15602c){_0x18337a['push'](_0x18337a['shift']());}};_0x479625(++_0x47bb74);}(_0x072a,0xba));var _0xa072=function(_0x12a22f,_0x261b21){_0x12a22f=_0x12a22f-0x0;var _0x44f4b7=_0x072a[_0x12a22f];return _0x44f4b7;};'use strict';var _=require(_0xa072('0x0'));var util=require(_0xa072('0x1'));var zendesk=require(_0xa072('0x2'));var salesforce=require(_0xa072('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xa072('0x4'));var zoho=require('./zoho');var desk=require(_0xa072('0x5'));var vtiger=require('./vtiger');var servicenow=require(_0xa072('0x6'));var dynamics365=require('./dynamics365');var freshsales=require(_0xa072('0x7'));var integrations=[_0xa072('0x8'),'salesforce',_0xa072('0x9'),'freshdesk',_0xa072('0xa'),'desk',_0xa072('0xb'),_0xa072('0xc'),_0xa072('0xd'),_0xa072('0xe')];exports[_0xa072('0xf')]=function(_0xe286ce,_0x424998,_0x4477ac,_0x307cea,_0x5cec5a,_0x1e30ca){if(_0x4477ac){if(_[_0xa072('0x10')](integrations,_0xe286ce[_0xa072('0x11')][_0xa072('0x12')]())){try{var _0x3da4c1=null;var _0x31d153='';var _0x430735=_0x4477ac[_0xe286ce['data1'][_0xa072('0x12')]()];if(_0x430735){var _0x84d026=_0x430735[_0xe286ce[_0xa072('0x13')]];if(_0x84d026){var _0x36d71d=_[_0xa072('0x14')](_0x84d026[_0xa072('0x15')],{'id':parseInt(_0xe286ce[_0xa072('0x16')],0xa)});if(_0x36d71d){if(_0x307cea){if(_0x5cec5a&&_0x424998[_0xa072('0x17')]){_0x31d153='queue';}else if(_0x424998[_0xa072('0x18')]){_0x31d153=_0xa072('0x19');}else{console[_0xa072('0x1a')](_0xa072('0x1b'),_0x424998);}}else{_0x31d153=_0xa072('0x1c');}switch(_0xe286ce[_0xa072('0x11')]['toLowerCase']()){case _0xa072('0x8'):zendesk[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0x1d'):salesforce[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0x9'):sugarcrm[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0x1e'):freshdesk[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0xa'):zoho[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0x1f'):desk[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0xb'):vtiger[_0x31d153](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca);break;case _0xa072('0xd'):freshsales['cs'](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca,_0x31d153);break;case _0xa072('0xe'):servicenow['cs'](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca,_0x31d153);break;case _0xa072('0xc'):dynamics365['cs'](_0xe286ce,_0x424998,_0x36d71d,_0x307cea,_0x5cec5a,_0x84d026,_0x1e30ca,_0x31d153);break;default:console[_0xa072('0x1a')](_0xa072('0x20'));}}else{_0x3da4c1=require(_0xa072('0x21'))(_0xe286ce[_0xa072('0x11')]['toLowerCase']());_0x3da4c1['error']('[EXEC]',util[_0xa072('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0xe286ce['data1'][_0xa072('0x12')](),_0xe286ce[_0xa072('0x16')]));}}else{_0x3da4c1=require(_0xa072('0x21'))(_0xe286ce[_0xa072('0x11')]['toLowerCase']());_0x3da4c1[_0xa072('0x23')]('[EXEC]',util[_0xa072('0x22')](_0xa072('0x24'),_0xe286ce['data1'][_0xa072('0x12')](),_0xe286ce[_0xa072('0x13')]));}}else{}}catch(_0x43f4fd){console[_0xa072('0x23')](_0x43f4fd);}}}}; \ No newline at end of file +var _0x15ee=['freshdesk','zoho','desk','dynamics365','servicenow','exec','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','zendesk','salesforce','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./zoho','./servicenow','./dynamics365','./freshsales','sugarcrm'];(function(_0x3b6cc7,_0x5df0c1){var _0x37f564=function(_0x160517){while(--_0x160517){_0x3b6cc7['push'](_0x3b6cc7['shift']());}};_0x37f564(++_0x5df0c1);}(_0x15ee,0x7b));var _0xe15e=function(_0x4c0e31,_0xa79bf2){_0x4c0e31=_0x4c0e31-0x0;var _0x41707d=_0x15ee[_0x4c0e31];return _0x41707d;};'use strict';var _=require('lodash');var util=require(_0xe15e('0x0'));var zendesk=require(_0xe15e('0x1'));var salesforce=require(_0xe15e('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xe15e('0x3'));var zoho=require(_0xe15e('0x4'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0xe15e('0x5'));var dynamics365=require(_0xe15e('0x6'));var freshsales=require(_0xe15e('0x7'));var integrations=['zendesk','salesforce',_0xe15e('0x8'),_0xe15e('0x9'),_0xe15e('0xa'),_0xe15e('0xb'),'vtiger',_0xe15e('0xc'),'freshsales',_0xe15e('0xd')];exports[_0xe15e('0xe')]=function(_0x28aa58,_0x11e59d,_0x1fab31,_0x182e2d,_0x507db0,_0x331284){if(_0x1fab31){if(_['includes'](integrations,_0x28aa58[_0xe15e('0xf')]['toLowerCase']())){try{var _0xcfc950=null;var _0x9b9fa4='';var _0x380697=_0x1fab31[_0x28aa58[_0xe15e('0xf')][_0xe15e('0x10')]()];if(_0x380697){var _0x2ff123=_0x380697[_0x28aa58[_0xe15e('0x11')]];if(_0x2ff123){var _0x14478c=_['find'](_0x2ff123[_0xe15e('0x12')],{'id':parseInt(_0x28aa58[_0xe15e('0x13')],0xa)});if(_0x14478c){if(_0x182e2d){if(_0x507db0&&_0x11e59d[_0xe15e('0x14')]){_0x9b9fa4=_0xe15e('0x14');}else if(_0x11e59d[_0xe15e('0x15')]){_0x9b9fa4=_0xe15e('0x16');}else{console['log'](_0xe15e('0x17'),_0x11e59d);}}else{_0x9b9fa4='unmanaged';}switch(_0x28aa58[_0xe15e('0xf')][_0xe15e('0x10')]()){case _0xe15e('0x18'):zendesk[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case _0xe15e('0x19'):salesforce[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case _0xe15e('0x8'):sugarcrm[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case'freshdesk':freshdesk[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case _0xe15e('0xa'):zoho[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case _0xe15e('0xb'):desk[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case'vtiger':vtiger[_0x9b9fa4](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284);break;case'freshsales':freshsales['cs'](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284,_0x9b9fa4);break;case'servicenow':servicenow['cs'](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284,_0x9b9fa4);break;case _0xe15e('0xc'):dynamics365['cs'](_0x28aa58,_0x11e59d,_0x14478c,_0x182e2d,_0x507db0,_0x2ff123,_0x331284,_0x9b9fa4);break;default:console[_0xe15e('0x1a')](_0xe15e('0x1b'));}}else{_0xcfc950=require(_0xe15e('0x1c'))(_0x28aa58[_0xe15e('0xf')]['toLowerCase']());_0xcfc950[_0xe15e('0x1d')](_0xe15e('0x1e'),util[_0xe15e('0x1f')]('%s\x20configuration\x20#%s\x20not\x20found',_0x28aa58['data1'][_0xe15e('0x10')](),_0x28aa58[_0xe15e('0x13')]));}}else{_0xcfc950=require(_0xe15e('0x1c'))(_0x28aa58[_0xe15e('0xf')][_0xe15e('0x10')]());_0xcfc950[_0xe15e('0x1d')](_0xe15e('0x1e'),util['format'](_0xe15e('0x20'),_0x28aa58['data1'][_0xe15e('0x10')](),_0x28aa58[_0xe15e('0x11')]));}}else{}}catch(_0x1ce6b2){console['error'](_0x1ce6b2);}}}}; \ 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 591a37a..572d760 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 _0x0be4=['moment','md5','jsforce','util','ioredis','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','execute','length','info','Agent\x20%s\x20found.','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','merge','account_contact_lead','additionalSearchAccount','Lead','Account','first','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','resolve','forEach','includes','string','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','trigger:salesforce:display','trigger:browser:url','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise'];(function(_0x3f78aa,_0xc64ba1){var _0x5da377=function(_0x205bd9){while(--_0x205bd9){_0x3f78aa['push'](_0x3f78aa['shift']());}};_0x5da377(++_0xc64ba1);}(_0x0be4,0x7c));var _0x40be=function(_0x25508a,_0xd352f3){_0x25508a=_0x25508a-0x0;var _0x2626b1=_0x0be4[_0x25508a];return _0x2626b1;};'use strict';var _=require(_0x40be('0x0'));var rp=require(_0x40be('0x1'));var moment=require(_0x40be('0x2'));var BPromise=require('bluebird');var md5=require(_0x40be('0x3'));var jsforce=require(_0x40be('0x4'));var util=require(_0x40be('0x5'));var Redis=require(_0x40be('0x6'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x40be('0x7'))(_0x40be('0x8'));config[_0x40be('0x9')]=_[_0x40be('0xa')](config[_0x40be('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x40be('0xb'))(new Redis(config['redis']));function emit(_0x12ba96,_0x13a3c5,_0x3c7bf6){io['to'](_0x12ba96)[_0x40be('0xc')](_0x13a3c5,_0x3c7bf6);}function getTicket(_0xf8e735,_0x2c5177,_0x4344cf,_0x2dd026,_0x1385e5,_0x3d173a,_0x28429a,_0x1192c8){var _0x49a39c=Object[_0x40be('0xd')]({},{'OwnerId':_0x2c5177['id'],'Subject':intUtil['getString'](_0x2dd026[_0x40be('0xe')],_0x1385e5,'\x20'),'Description':intUtil['getString'](_0x2dd026['Descriptions'],_0x1385e5,'\x0a')},getCustomFields(_0x3d173a,_0x1385e5));if(_0x4344cf){if(_0x2dd026[_0x40be('0xf')]===_0x40be('0x10')){_0x49a39c[_0x40be('0x11')]=moment[_0x40be('0x12')]();_0x49a39c[_0x40be('0x13')]=![];_0x49a39c[_0x40be('0x14')]=![];if(_0x4344cf['endUserType']===_0x40be('0x15')||_0x4344cf[_0x40be('0x16')]===_0x40be('0x17')){_0x49a39c[_0x40be('0x18')]=_0x4344cf['id'];}else if(_0x4344cf[_0x40be('0x16')]===_0x40be('0x19')){_0x49a39c[_0x40be('0x1a')]=_0x4344cf['id'];}}else if(_0x2dd026[_0x40be('0xf')]==='Case'){if(_0x4344cf['endUserType']===_0x40be('0x15')){_0x49a39c[_0x40be('0x1b')]=_0x4344cf['id'];}else if(_0x4344cf[_0x40be('0x16')]==='account'){_0x49a39c[_0x40be('0x1c')]=_0x4344cf['id'];}else if(_0x4344cf[_0x40be('0x16')]===_0x40be('0x17')&&_0x2dd026[_0x40be('0x1d')]){_0x49a39c[_0x2dd026['leadId']]=_0x4344cf['id'];}else{logger['info'](_0x40be('0x1e'));}}}return _0x28429a[_0x40be('0x1f')](_0x2dd026[_0x40be('0xf')])[_0x40be('0x20')](_0x49a39c);}function getUser(_0x28c70a,_0x2f8390,_0x3e1d74){if(!_[_0x40be('0x21')](_0x2f8390)&&intUtil['validateEmail'](_0x2f8390)){var _0x44c81f={'Email':_0x2f8390};var _0x20b482={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3e1d74[_0x40be('0x1f')](_0x40be('0x22'))[_0x40be('0x23')](_0x44c81f,_0x20b482)[_0x40be('0x24')]()['then'](function(_0x36c79a){if(_0x36c79a[_0x40be('0x25')]){var _0x19ea5d=_[_0x40be('0x23')](_0x36c79a,function(_0x11c4a8){return _0x11c4a8['Email']===_0x2f8390;});if(_0x19ea5d){logger[_0x40be('0x26')](_0x40be('0x27'),_0x2f8390);return BPromise['resolve']({'id':_0x19ea5d['Id'],'name':_0x19ea5d['Name']});}}else{logger[_0x40be('0x26')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2f8390);return _0x3e1d74['identity']()[_0x40be('0x28')](function(_0xf560a2){return BPromise['resolve']({'id':_0xf560a2[_0x40be('0x29')],'name':_0xf560a2['display_name']});});}});}else{logger[_0x40be('0x26')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2f8390);return _0x3e1d74['identity']()[_0x40be('0x28')](function(_0x473292){return BPromise['resolve']({'id':_0x473292[_0x40be('0x29')],'name':_0x473292[_0x40be('0x2a')]});});}}function getEndUser(_0x868f55,_0x217721,_0x35e5f6,_0x46eb3d,_0x3a8905){var _0x5dee07={'$or':{'Phone':_0x46eb3d}};var _0x3db43d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x40be('0x28')](function(){logger[_0x40be('0x26')](_0x40be('0x2b'),_0x46eb3d,_0x217721[_0x40be('0x2c')]);switch(_0x217721[_0x40be('0x2c')]){case _0x40be('0x2d'):var _0x159973=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721[_0x40be('0x2f')]){var _0x3896e1={};_0x3896e1[_0x217721[_0x40be('0x2f')]]=_0x46eb3d;_['merge'](_0x159973[_0x40be('0x30')],_0x3896e1);}return _0x3a8905[_0x40be('0x1f')](_0x40be('0x31'))[_0x40be('0x23')](_0x159973,_0x3db43d)[_0x40be('0x24')]()[_0x40be('0x28')](function(_0x36e270){if(_0x36e270&&_0x36e270[_0x40be('0x25')]){return _0x36e270;}else{var _0xebcb4c=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721[_0x40be('0x32')]){var _0x58e1db={};_0x58e1db[_0x217721[_0x40be('0x32')]]=_0x46eb3d;_[_0x40be('0x33')](_0xebcb4c[_0x40be('0x30')],_0x58e1db);}return _0x3a8905['sobject']('Lead')['find'](_0xebcb4c,_0x3db43d);}});case _0x40be('0x34'):var _0x27ceba=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721['additionalSearchAccount']){var _0x3896e1={};_0x3896e1[_0x217721[_0x40be('0x35')]]=_0x46eb3d;_[_0x40be('0x33')](_0x27ceba[_0x40be('0x30')],_0x3896e1);}return _0x3a8905[_0x40be('0x1f')]('Account')[_0x40be('0x23')](_0x27ceba,_0x3db43d)[_0x40be('0x24')]()[_0x40be('0x28')](function(_0xbfb759){if(_0xbfb759&&_0xbfb759[_0x40be('0x25')]){return _0xbfb759;}else{var _0x3a9b37=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721[_0x40be('0x2f')]){var _0x5c06a3={};_0x5c06a3[_0x217721['additionalSearchContact']]=_0x46eb3d;_['merge'](_0x3a9b37[_0x40be('0x30')],_0x5c06a3);}return _0x3a8905['sobject'](_0x40be('0x31'))[_0x40be('0x23')](_0x3a9b37,_0x3db43d)[_0x40be('0x28')](function(_0xb2ca1d){if(_0xb2ca1d&&_0xb2ca1d[_0x40be('0x25')]){return _0xb2ca1d;}else{var _0x203f9f=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721[_0x40be('0x32')]){var _0x2f2360={};_0x2f2360[_0x217721[_0x40be('0x32')]]=_0x46eb3d;_[_0x40be('0x33')](_0x203f9f['$or'],_0x2f2360);}return _0x3a8905[_0x40be('0x1f')](_0x40be('0x36'))[_0x40be('0x23')](_0x203f9f,_0x3db43d);}});}});case'contact':var _0x159973=_['cloneDeep'](_0x5dee07);if(_0x217721[_0x40be('0x2f')]){var _0x3896e1={};_0x3896e1[_0x217721[_0x40be('0x2f')]]=_0x46eb3d;_[_0x40be('0x33')](_0x159973[_0x40be('0x30')],_0x3896e1);}return _0x3a8905[_0x40be('0x1f')](_0x40be('0x31'))[_0x40be('0x23')](_0x159973,_0x3db43d)[_0x40be('0x24')]();case'lead':var _0x541b11=_[_0x40be('0x2e')](_0x5dee07);if(_0x217721[_0x40be('0x32')]){var _0x3896e1={};_0x3896e1[_0x217721[_0x40be('0x32')]]=_0x46eb3d;_['merge'](_0x541b11[_0x40be('0x30')],_0x3896e1);}return _0x3a8905[_0x40be('0x1f')](_0x40be('0x36'))[_0x40be('0x23')](_0x541b11,_0x3db43d);case'account':var _0x27ceba=_['cloneDeep'](_0x5dee07);if(_0x217721[_0x40be('0x35')]){var _0x3896e1={};_0x3896e1[_0x217721['additionalSearchAccount']]=_0x46eb3d;_[_0x40be('0x33')](_0x27ceba[_0x40be('0x30')],_0x3896e1);}return _0x3a8905[_0x40be('0x1f')](_0x40be('0x37'))[_0x40be('0x23')](_0x27ceba,_0x3db43d);default:return null;}})[_0x40be('0x28')](function(_0x166d30){if(_0x166d30&&_0x166d30[_0x40be('0x25')]){var _0x582b3a=_[_0x40be('0x38')](_0x166d30);if(_0x582b3a){return BPromise['resolve']({'id':_0x582b3a['Id'],'name':_0x582b3a['Name'],'phone':_0x582b3a['Phone'],'endUserType':_0x582b3a['attributes']['type']['toLowerCase']()});}}})['then'](function(_0x3dfe3e){if(_0x3dfe3e){logger[_0x40be('0x26')](_0x40be('0x39'),_0x3dfe3e[_0x40be('0x16')],_0x46eb3d);return BPromise['resolve'](_0x3dfe3e);}else{logger[_0x40be('0x26')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x46eb3d);var _0x2f358e={'Phone':_0x46eb3d};if(_0x217721['moduleCreate']){if(_0x217721[_0x40be('0x3a')]===_0x40be('0x15')){logger[_0x40be('0x26')](_0x40be('0x3b'),_0x46eb3d,_0x217721[_0x40be('0x3a')]);_0x2f358e[_0x40be('0x3c')]=_0x35e5f6!==_0x40be('0x3d')?_0x35e5f6:util[_0x40be('0x3e')](_0x40be('0x3f'),_0x46eb3d);}else if(_0x217721[_0x40be('0x3a')]===_0x40be('0x17')){logger[_0x40be('0x26')](_0x40be('0x3b'),_0x46eb3d,_0x217721[_0x40be('0x3a')]);_0x2f358e[_0x40be('0x3c')]=_0x35e5f6!==''?_0x35e5f6:util['format'](_0x40be('0x3f'),_0x46eb3d);_0x2f358e[_0x40be('0x40')]=_0x40be('0x41');}else if(_0x217721[_0x40be('0x3a')]===_0x40be('0x19')){logger[_0x40be('0x26')](_0x40be('0x3b'),_0x46eb3d,_0x217721[_0x40be('0x3a')]);_0x2f358e['Name']=_0x35e5f6!==_0x40be('0x3d')?_0x35e5f6:util[_0x40be('0x3e')]('Caller\x20-\x20%s',_0x46eb3d);}else{return null;}}return _0x3a8905[_0x40be('0x1f')](_['upperFirst'](_0x217721[_0x40be('0x3a')]))[_0x40be('0x20')](_0x2f358e)[_0x40be('0x28')](function(_0x9552bd){return BPromise[_0x40be('0x42')]({'id':_0x9552bd['id'],'endUserType':_0x217721[_0x40be('0x3a')]});});}});}function getCustomFields(_0x1dd42b,_0xc40716){var _0x3e863f={};if(_0x1dd42b[_0x40be('0x25')]>0x0){_[_0x40be('0x43')](_0x1dd42b,function(_0x15bd1e){if(_[_0x40be('0x44')]([_0x40be('0x45'),_0x40be('0x46')],_0x15bd1e[_0x40be('0x47')])&&_0x15bd1e[_0x40be('0x48')]){_0x3e863f[_0x15bd1e[_0x40be('0x48')]]=_0x15bd1e[_0x40be('0x49')]['toString']();}else if(_0x15bd1e[_0x40be('0x47')]===_0x40be('0x4a')&&_0x15bd1e[_0x40be('0x4b')]&&_0x15bd1e[_0x40be('0x48')]){_0xc40716[_0x15bd1e[_0x40be('0x4b')]]&&(_0x3e863f[_0x15bd1e[_0x40be('0x48')]]=_0xc40716[_0x15bd1e[_0x40be('0x4b')]][_0x40be('0x4c')]());}else if(_0x15bd1e['type']===_0x40be('0x4d')&&_0x15bd1e[_0x40be('0x4e')]&&_0x15bd1e[_0x40be('0x4e')][_0x40be('0x4f')]&&_0x15bd1e[_0x40be('0x48')]){_0xc40716[_0x15bd1e[_0x40be('0x4e')]['name'][_0x40be('0x50')]()]&&(_0x3e863f[_0x15bd1e[_0x40be('0x48')]]=_0xc40716[_0x15bd1e[_0x40be('0x4e')][_0x40be('0x4f')][_0x40be('0x50')]()]['toString']());}});}return _0x3e863f;}function getConnection(_0x5f5931){var _0x5aa790=_0x5f5931[_0x40be('0x51')]['concat'](_0x5f5931['securityToken']);var _0x2cdb5f=new jsforce[(_0x40be('0x52'))]({'oauth2':{'loginUrl':_0x5f5931[_0x40be('0x53')]||_0x40be('0x54'),'clientId':_0x5f5931[_0x40be('0x55')],'clientSecret':_0x5f5931['clientSecret']}});return _0x2cdb5f[_0x40be('0x56')](_0x5f5931[_0x40be('0x57')],_0x5aa790)['then'](function(){logger[_0x40be('0x26')](_0x40be('0x58'));return _0x2cdb5f;});}exports[_0x40be('0x59')]=function(_0x27890f,_0x49f7ba,_0x7fb781,_0x55727a,_0x4618af,_0x5be63b){var _0x129a26,_0x4ae46a,_0x405364,_0x323dea;_0x5be63b[_0x40be('0x5a')]=intUtil['stripTrailingSlash'](_0x5be63b[_0x40be('0x5a')]);_0x5be63b[_0x40be('0x53')]=intUtil[_0x40be('0x5b')](_0x5be63b['remoteUri']);if(_0x4618af&&_0x4618af['monitor_format']){logger['info'](_0x40be('0x5c'),_0x40be('0x5d'));_0x49f7ba[_0x40be('0x5e')]=util[_0x40be('0x3e')](_0x40be('0x5f'),_0x5be63b['serverUrl'],_0x49f7ba[_0x40be('0x60')],md5(_0x49f7ba['uniqueid']));}else{_0x49f7ba['recordingURL']='';}return getConnection(_0x5be63b)[_0x40be('0x28')](function(_0x18ca3c){_0x323dea=_0x18ca3c;return getUser(_0x5be63b,_0x55727a['email'],_0x323dea);})['then'](function(_0x49be22){_0x129a26=_0x49be22;return getEndUser(_0x5be63b,_0x7fb781,_0x49f7ba[_0x40be('0x61')],_0x49f7ba['calleridnum'],_0x323dea);})[_0x40be('0x28')](function(_0x4a6137){_0x4ae46a=_0x4a6137;return getTicket(_0x5be63b,_0x129a26,_0x4ae46a,_0x7fb781,_0x49f7ba,_0x7fb781[_0x40be('0x62')],_0x323dea,_0x40be('0x59'));})[_0x40be('0x28')](function(_0x2fbe32){_0x405364=_0x2fbe32;logger['info'](_0x40be('0x63'),_0x405364['id']);logger[_0x40be('0x26')](_0x40be('0x64'),_0x405364['id'],_0x55727a[_0x40be('0x4f')],_0x5be63b['type']);switch(_0x5be63b['type']){case _0x40be('0x65'):emit(util[_0x40be('0x3e')](_0x40be('0x66'),_0x55727a[_0x40be('0x4f')]),'trigger:salesforce:display',{'recordId':_0x405364['id']});break;case _0x40be('0x67'):emit(util[_0x40be('0x3e')](_0x40be('0x66'),_0x55727a['name']),'trigger:browser:url',{'uri':util[_0x40be('0x3e')](_0x40be('0x68'),_0x323dea[_0x40be('0x69')],_0x405364['id'])});break;default:logger[_0x40be('0x6a')](_0x40be('0x6b'));}})[_0x40be('0x6c')](function(_0x5722be){logger[_0x40be('0x6a')](_0x40be('0x5c'),_0x5722be);});};exports[_0x40be('0x6d')]=function(_0x34c0d5,_0xac52de,_0x23797b,_0x52e6bc,_0x4de31f,_0x27c764,_0x345070){var _0x5596f7,_0xd14d4e,_0x2b9a0,_0x95297f;_0x27c764[_0x40be('0x5a')]=intUtil[_0x40be('0x5b')](_0x27c764[_0x40be('0x5a')]);_0x27c764[_0x40be('0x53')]=intUtil[_0x40be('0x5b')](_0x27c764[_0x40be('0x53')]);if(_0x345070&&_0x345070[_0x40be('0x6e')]&&_0x345070[_0x40be('0x6e')]!==_0x40be('0x6f')){logger[_0x40be('0x26')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xac52de[_0x40be('0x5e')]=util[_0x40be('0x3e')](_0x40be('0x5f'),_0x27c764['serverUrl'],_0xac52de[_0x40be('0x60')],md5(_0xac52de[_0x40be('0x60')]));}return getConnection(_0x27c764)[_0x40be('0x28')](function(_0x5aa8c4){_0x95297f=_0x5aa8c4;return getUser(_0x27c764,_0x52e6bc[_0x40be('0x70')],_0x95297f);})['then'](function(_0x31f091){_0x5596f7=_0x31f091;return getEndUser(_0x27c764,_0x23797b,_0xac52de[_0x40be('0x71')],_0xac52de[_0x40be('0x72')],_0x95297f);})[_0x40be('0x28')](function(_0x4cd607){_0xd14d4e=_0x4cd607;return getTicket(_0x27c764,_0x5596f7,_0xd14d4e,_0x23797b,_0xac52de,_0x23797b[_0x40be('0x62')],_0x95297f,_0x40be('0x6d'));})['then'](function(_0x16f30f){_0x2b9a0=_0x16f30f;logger['info'](_0x40be('0x73'),_0x2b9a0['id']);logger[_0x40be('0x26')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x2b9a0['id'],_0x52e6bc[_0x40be('0x4f')],_0x27c764[_0x40be('0x47')]);switch(_0x27c764[_0x40be('0x47')]){case _0x40be('0x65'):emit(util[_0x40be('0x3e')](_0x40be('0x66'),_0x52e6bc[_0x40be('0x4f')]),_0x40be('0x74'),{'recordId':_0x2b9a0['id']});break;case'newTab':emit(util['format'](_0x40be('0x66'),_0x52e6bc[_0x40be('0x4f')]),_0x40be('0x75'),{'uri':util['format'](_0x40be('0x68'),_0x95297f['instanceUrl'],_0x2b9a0['id'])});break;default:logger['error'](_0x40be('0x76'),_0x40be('0x77'));}})[_0x40be('0x6c')](function(_0x40326e){logger['error']('[OUTBOUND]',_0x40326e);});};exports[_0x40be('0x78')]=function(_0x12ee00,_0x39e6bc,_0x5c90e8,_0x54af18,_0x1a1c01,_0x16e6e7){var _0x257751,_0x59ffc8,_0x364634,_0x15a258;_0x16e6e7[_0x40be('0x5a')]=intUtil['stripTrailingSlash'](_0x16e6e7[_0x40be('0x5a')]);_0x16e6e7[_0x40be('0x53')]=intUtil[_0x40be('0x5b')](_0x16e6e7['remoteUri']);if(_0x1a1c01&&_0x1a1c01[_0x40be('0x79')]){logger[_0x40be('0x26')]('['+_0x39e6bc[_0x40be('0x7a')][_0x40be('0x7b')]()+']',_0x40be('0x5d'));_0x39e6bc[_0x40be('0x5e')]=util[_0x40be('0x3e')](_0x40be('0x5f'),_0x16e6e7['serverUrl'],_0x39e6bc['uniqueid'],md5(_0x39e6bc['uniqueid']));}else{_0x39e6bc[_0x40be('0x5e')]='';}return getConnection(_0x16e6e7)[_0x40be('0x28')](function(_0x27812e){_0x15a258=_0x27812e;if(!_[_0x40be('0x21')](_0x54af18)){return getUser(_0x16e6e7,_0x54af18[_0x40be('0x4f')],_0x15a258);}else{return getUser(_0x16e6e7,null,_0x15a258);}})['then'](function(_0x58c57f){_0x257751=_0x58c57f;return getEndUser(_0x16e6e7,_0x5c90e8,_0x39e6bc[_0x40be('0x61')],_0x39e6bc[_0x40be('0x7c')],_0x15a258);})[_0x40be('0x28')](function(_0x188e70){_0x59ffc8=_0x188e70;return getTicket(_0x16e6e7,_0x257751,_0x59ffc8,_0x5c90e8,_0x39e6bc,_0x5c90e8[_0x40be('0x62')],_0x15a258);})[_0x40be('0x28')](function(_0x51402d){_0x364634=_0x51402d;logger[_0x40be('0x26')]('['+_0x39e6bc[_0x40be('0x7a')][_0x40be('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x364634['id']);logger['info']('['+_0x39e6bc[_0x40be('0x7a')][_0x40be('0x7b')]()+_0x40be('0x7d'),_0x16e6e7[_0x40be('0x47')]);})['catch'](function(_0x377f60){logger[_0x40be('0x6a')]('['+_0x39e6bc[_0x40be('0x7a')][_0x40be('0x7b')]()+']',_0x377f60);});}; \ No newline at end of file +var _0xe709=['content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','execute','then','find','Email','resolve','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','length','additionalSearchLead','Lead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','endUserType','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','forEach','string','picklist','idField'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xe709,0x140));var _0x9e70=function(_0x48c2c3,_0x59d5f5){_0x48c2c3=_0x48c2c3-0x0;var _0x5e6607=_0xe709[_0x48c2c3];return _0x5e6607;};'use strict';var _=require(_0x9e70('0x0'));var rp=require('request-promise');var moment=require(_0x9e70('0x1'));var BPromise=require('bluebird');var md5=require(_0x9e70('0x2'));var jsforce=require(_0x9e70('0x3'));var util=require(_0x9e70('0x4'));var Redis=require(_0x9e70('0x5'));var intUtil=require(_0x9e70('0x6'));var config=require(_0x9e70('0x7'));var logger=require('../../../../config/logger')('salesforce');config[_0x9e70('0x8')]=_[_0x9e70('0x9')](config[_0x9e70('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9e70('0xa'))(new Redis(config[_0x9e70('0x8')]));function emit(_0x689fed,_0x1f1ea0,_0x56fb8a){io['to'](_0x689fed)[_0x9e70('0xb')](_0x1f1ea0,_0x56fb8a);}function getTicket(_0x2dd2d9,_0x39d972,_0x5540df,_0x5433c8,_0x58bab5,_0x18f94b,_0xc0e5e8,_0x2b69e9){var _0x1319e0=Object['assign']({},{'OwnerId':_0x39d972['id'],'Subject':intUtil[_0x9e70('0xc')](_0x5433c8[_0x9e70('0xd')],_0x58bab5,'\x20'),'Description':intUtil[_0x9e70('0xc')](_0x5433c8[_0x9e70('0xe')],_0x58bab5,'\x0a')},getCustomFields(_0x18f94b,_0x58bab5));if(_0x5540df){if(_0x5433c8[_0x9e70('0xf')]===_0x9e70('0x10')){_0x1319e0[_0x9e70('0x11')]=moment[_0x9e70('0x12')]();_0x1319e0[_0x9e70('0x13')]=![];_0x1319e0[_0x9e70('0x14')]=![];if(_0x5540df['endUserType']===_0x9e70('0x15')||_0x5540df['endUserType']===_0x9e70('0x16')){_0x1319e0[_0x9e70('0x17')]=_0x5540df['id'];}else if(_0x5540df['endUserType']===_0x9e70('0x18')){_0x1319e0[_0x9e70('0x19')]=_0x5540df['id'];}}else if(_0x5433c8[_0x9e70('0xf')]===_0x9e70('0x1a')){if(_0x5540df['endUserType']==='contact'){_0x1319e0[_0x9e70('0x1b')]=_0x5540df['id'];}else if(_0x5540df['endUserType']===_0x9e70('0x18')){_0x1319e0[_0x9e70('0x1c')]=_0x5540df['id'];}else if(_0x5540df['endUserType']===_0x9e70('0x16')&&_0x5433c8[_0x9e70('0x1d')]){_0x1319e0[_0x5433c8[_0x9e70('0x1d')]]=_0x5540df['id'];}else{logger[_0x9e70('0x1e')](_0x9e70('0x1f'));}}}return _0xc0e5e8[_0x9e70('0x20')](_0x5433c8[_0x9e70('0xf')])[_0x9e70('0x21')](_0x1319e0);}function getUser(_0x316223,_0x33547d,_0x4761a1){if(!_[_0x9e70('0x22')](_0x33547d)&&intUtil['validateEmail'](_0x33547d)){var _0x42173b={'Email':_0x33547d};var _0x341c2c={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4761a1[_0x9e70('0x20')](_0x9e70('0x23'))['find'](_0x42173b,_0x341c2c)[_0x9e70('0x24')]()[_0x9e70('0x25')](function(_0x51ab51){if(_0x51ab51['length']){var _0x2054b2=_[_0x9e70('0x26')](_0x51ab51,function(_0x457912){return _0x457912[_0x9e70('0x27')]===_0x33547d;});if(_0x2054b2){logger[_0x9e70('0x1e')]('Agent\x20%s\x20found.',_0x33547d);return BPromise[_0x9e70('0x28')]({'id':_0x2054b2['Id'],'name':_0x2054b2['Name']});}}else{logger[_0x9e70('0x1e')](_0x9e70('0x29'),_0x33547d);return _0x4761a1[_0x9e70('0x2a')]()[_0x9e70('0x25')](function(_0x4bf6c0){return BPromise['resolve']({'id':_0x4bf6c0[_0x9e70('0x2b')],'name':_0x4bf6c0[_0x9e70('0x2c')]});});}});}else{logger[_0x9e70('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x33547d);return _0x4761a1[_0x9e70('0x2a')]()[_0x9e70('0x25')](function(_0xe59e96){return BPromise[_0x9e70('0x28')]({'id':_0xe59e96[_0x9e70('0x2b')],'name':_0xe59e96[_0x9e70('0x2c')]});});}}function getEndUser(_0x49c45f,_0x24e899,_0x7c6a10,_0x22588f,_0x270dff){var _0x4d519a={'$or':{'Phone':_0x22588f}};var _0x1b8453={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9e70('0x28')]()[_0x9e70('0x25')](function(){logger[_0x9e70('0x1e')](_0x9e70('0x2d'),_0x22588f,_0x24e899['moduleSearch']);switch(_0x24e899[_0x9e70('0x2e')]){case _0x9e70('0x2f'):var _0x5ea208=_['cloneDeep'](_0x4d519a);if(_0x24e899['additionalSearchContact']){var _0x5df890={};_0x5df890[_0x24e899[_0x9e70('0x30')]]=_0x22588f;_[_0x9e70('0x31')](_0x5ea208[_0x9e70('0x32')],_0x5df890);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x33'))['find'](_0x5ea208,_0x1b8453)['execute']()['then'](function(_0x14ef9a){if(_0x14ef9a&&_0x14ef9a[_0x9e70('0x34')]){return _0x14ef9a;}else{var _0x757bfb=_['cloneDeep'](_0x4d519a);if(_0x24e899[_0x9e70('0x35')]){var _0x28c1c7={};_0x28c1c7[_0x24e899[_0x9e70('0x35')]]=_0x22588f;_[_0x9e70('0x31')](_0x757bfb['$or'],_0x28c1c7);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x36'))[_0x9e70('0x26')](_0x757bfb,_0x1b8453);}});case _0x9e70('0x37'):var _0x5032ab=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899[_0x9e70('0x39')]){var _0x5df890={};_0x5df890[_0x24e899[_0x9e70('0x39')]]=_0x22588f;_['merge'](_0x5032ab[_0x9e70('0x32')],_0x5df890);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x3a'))[_0x9e70('0x26')](_0x5032ab,_0x1b8453)[_0x9e70('0x24')]()['then'](function(_0x4c69ed){if(_0x4c69ed&&_0x4c69ed[_0x9e70('0x34')]){return _0x4c69ed;}else{var _0x2f4757=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899[_0x9e70('0x30')]){var _0x23ea17={};_0x23ea17[_0x24e899[_0x9e70('0x30')]]=_0x22588f;_[_0x9e70('0x31')](_0x2f4757[_0x9e70('0x32')],_0x23ea17);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x33'))[_0x9e70('0x26')](_0x2f4757,_0x1b8453)[_0x9e70('0x25')](function(_0x33b6f6){if(_0x33b6f6&&_0x33b6f6[_0x9e70('0x34')]){return _0x33b6f6;}else{var _0x43081e=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899[_0x9e70('0x35')]){var _0x368703={};_0x368703[_0x24e899[_0x9e70('0x35')]]=_0x22588f;_[_0x9e70('0x31')](_0x43081e[_0x9e70('0x32')],_0x368703);}return _0x270dff[_0x9e70('0x20')]('Lead')[_0x9e70('0x26')](_0x43081e,_0x1b8453);}});}});case _0x9e70('0x15'):var _0x5ea208=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899['additionalSearchContact']){var _0x5df890={};_0x5df890[_0x24e899[_0x9e70('0x30')]]=_0x22588f;_[_0x9e70('0x31')](_0x5ea208[_0x9e70('0x32')],_0x5df890);}return _0x270dff['sobject'](_0x9e70('0x33'))[_0x9e70('0x26')](_0x5ea208,_0x1b8453)['execute']();case _0x9e70('0x16'):var _0x3b9035=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899['additionalSearchLead']){var _0x5df890={};_0x5df890[_0x24e899[_0x9e70('0x35')]]=_0x22588f;_['merge'](_0x3b9035[_0x9e70('0x32')],_0x5df890);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x36'))[_0x9e70('0x26')](_0x3b9035,_0x1b8453);case _0x9e70('0x18'):var _0x5032ab=_[_0x9e70('0x38')](_0x4d519a);if(_0x24e899[_0x9e70('0x39')]){var _0x5df890={};_0x5df890[_0x24e899['additionalSearchAccount']]=_0x22588f;_[_0x9e70('0x31')](_0x5032ab[_0x9e70('0x32')],_0x5df890);}return _0x270dff[_0x9e70('0x20')](_0x9e70('0x3a'))['find'](_0x5032ab,_0x1b8453);default:return null;}})[_0x9e70('0x25')](function(_0x4b3529){if(_0x4b3529&&_0x4b3529[_0x9e70('0x34')]){var _0x2d36f6=_[_0x9e70('0x3b')](_0x4b3529);if(_0x2d36f6){return BPromise[_0x9e70('0x28')]({'id':_0x2d36f6['Id'],'name':_0x2d36f6[_0x9e70('0x3c')],'phone':_0x2d36f6['Phone'],'endUserType':_0x2d36f6[_0x9e70('0x3d')][_0x9e70('0x3e')][_0x9e70('0x3f')]()});}}})[_0x9e70('0x25')](function(_0x48787e){if(_0x48787e){logger[_0x9e70('0x1e')](_0x9e70('0x40'),_0x48787e[_0x9e70('0x41')],_0x22588f);return BPromise[_0x9e70('0x28')](_0x48787e);}else{logger[_0x9e70('0x1e')](_0x9e70('0x42'),_0x22588f);var _0x43dad9={'Phone':_0x22588f};if(_0x24e899[_0x9e70('0x43')]){if(_0x24e899[_0x9e70('0x43')]==='contact'){logger[_0x9e70('0x1e')](_0x9e70('0x44'),_0x22588f,_0x24e899[_0x9e70('0x43')]);_0x43dad9[_0x9e70('0x45')]=_0x7c6a10!==_0x9e70('0x46')?_0x7c6a10:util[_0x9e70('0x47')](_0x9e70('0x48'),_0x22588f);}else if(_0x24e899['moduleCreate']===_0x9e70('0x16')){logger[_0x9e70('0x1e')](_0x9e70('0x44'),_0x22588f,_0x24e899['moduleCreate']);_0x43dad9[_0x9e70('0x45')]=_0x7c6a10!==''?_0x7c6a10:util[_0x9e70('0x47')]('Caller\x20-\x20%s',_0x22588f);_0x43dad9['Company']=_0x9e70('0x49');}else if(_0x24e899[_0x9e70('0x43')]==='account'){logger[_0x9e70('0x1e')](_0x9e70('0x44'),_0x22588f,_0x24e899[_0x9e70('0x43')]);_0x43dad9[_0x9e70('0x3c')]=_0x7c6a10!==_0x9e70('0x46')?_0x7c6a10:util['format'](_0x9e70('0x48'),_0x22588f);}else{return null;}}return _0x270dff[_0x9e70('0x20')](_[_0x9e70('0x4a')](_0x24e899['moduleCreate']))[_0x9e70('0x21')](_0x43dad9)['then'](function(_0x3029af){return BPromise['resolve']({'id':_0x3029af['id'],'endUserType':_0x24e899[_0x9e70('0x43')]});});}});}function getCustomFields(_0x40c895,_0x29ce3f){var _0x28d372={};if(_0x40c895[_0x9e70('0x34')]>0x0){_[_0x9e70('0x4b')](_0x40c895,function(_0x53e3bc){if(_['includes']([_0x9e70('0x4c'),_0x9e70('0x4d')],_0x53e3bc[_0x9e70('0x3e')])&&_0x53e3bc[_0x9e70('0x4e')]){_0x28d372[_0x53e3bc[_0x9e70('0x4e')]]=_0x53e3bc[_0x9e70('0x4f')][_0x9e70('0x50')]();}else if(_0x53e3bc[_0x9e70('0x3e')]===_0x9e70('0x51')&&_0x53e3bc['variableName']&&_0x53e3bc['idField']){_0x29ce3f[_0x53e3bc[_0x9e70('0x52')]]&&(_0x28d372[_0x53e3bc['idField']]=_0x29ce3f[_0x53e3bc[_0x9e70('0x52')]][_0x9e70('0x50')]());}else if(_0x53e3bc[_0x9e70('0x3e')]===_0x9e70('0x53')&&_0x53e3bc[_0x9e70('0x54')]&&_0x53e3bc[_0x9e70('0x54')][_0x9e70('0x55')]&&_0x53e3bc[_0x9e70('0x4e')]){_0x29ce3f[_0x53e3bc['Variable'][_0x9e70('0x55')][_0x9e70('0x3f')]()]&&(_0x28d372[_0x53e3bc[_0x9e70('0x4e')]]=_0x29ce3f[_0x53e3bc[_0x9e70('0x54')][_0x9e70('0x55')]['toLowerCase']()][_0x9e70('0x50')]());}});}return _0x28d372;}function getConnection(_0x345540){var _0xf8114d=_0x345540[_0x9e70('0x56')]['concat'](_0x345540[_0x9e70('0x57')]);var _0x2e6caf=new jsforce[(_0x9e70('0x58'))]({'oauth2':{'loginUrl':_0x345540[_0x9e70('0x59')]||_0x9e70('0x5a'),'clientId':_0x345540[_0x9e70('0x5b')],'clientSecret':_0x345540[_0x9e70('0x5c')]}});return _0x2e6caf[_0x9e70('0x5d')](_0x345540[_0x9e70('0x5e')],_0xf8114d)['then'](function(){logger[_0x9e70('0x1e')](_0x9e70('0x5f'));return _0x2e6caf;});}exports[_0x9e70('0x60')]=function(_0x199d32,_0x70af82,_0x408db4,_0x2f8821,_0x5c90fe,_0x26747f){var _0x16c81f,_0x49d9d6,_0x4f2d52,_0x2b085c;_0x26747f[_0x9e70('0x61')]=intUtil[_0x9e70('0x62')](_0x26747f[_0x9e70('0x61')]);_0x26747f[_0x9e70('0x59')]=intUtil[_0x9e70('0x62')](_0x26747f[_0x9e70('0x59')]);if(_0x5c90fe&&_0x5c90fe[_0x9e70('0x63')]){logger['info'](_0x9e70('0x64'),_0x9e70('0x65'));_0x70af82[_0x9e70('0x66')]=util[_0x9e70('0x47')](_0x9e70('0x67'),_0x26747f[_0x9e70('0x61')],_0x70af82['uniqueid'],md5(_0x70af82[_0x9e70('0x68')]));}else{_0x70af82['recordingURL']='';}return getConnection(_0x26747f)['then'](function(_0x2f16c3){_0x2b085c=_0x2f16c3;return getUser(_0x26747f,_0x2f8821['email'],_0x2b085c);})[_0x9e70('0x25')](function(_0x14fbb4){_0x16c81f=_0x14fbb4;return getEndUser(_0x26747f,_0x408db4,_0x70af82[_0x9e70('0x69')],_0x70af82[_0x9e70('0x6a')],_0x2b085c);})[_0x9e70('0x25')](function(_0x292c98){_0x49d9d6=_0x292c98;return getTicket(_0x26747f,_0x16c81f,_0x49d9d6,_0x408db4,_0x70af82,_0x408db4[_0x9e70('0x6b')],_0x2b085c,_0x9e70('0x60'));})[_0x9e70('0x25')](function(_0x4f8c59){_0x4f2d52=_0x4f8c59;logger[_0x9e70('0x1e')](_0x9e70('0x6c'),_0x4f2d52['id']);logger[_0x9e70('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4f2d52['id'],_0x2f8821[_0x9e70('0x55')],_0x26747f['type']);switch(_0x26747f[_0x9e70('0x3e')]){case _0x9e70('0x6d'):emit(util[_0x9e70('0x47')](_0x9e70('0x6e'),_0x2f8821[_0x9e70('0x55')]),_0x9e70('0x6f'),{'recordId':_0x4f2d52['id']});break;case _0x9e70('0x70'):emit(util[_0x9e70('0x47')]('user:%s',_0x2f8821['name']),_0x9e70('0x71'),{'uri':util[_0x9e70('0x47')](_0x9e70('0x72'),_0x2b085c[_0x9e70('0x73')],_0x4f2d52['id'])});break;default:logger[_0x9e70('0x74')](_0x9e70('0x75'));}})['catch'](function(_0x4542be){logger[_0x9e70('0x74')](_0x9e70('0x64'),_0x4542be);});};exports[_0x9e70('0x76')]=function(_0x4f9f7a,_0x255010,_0x511147,_0x351dca,_0x12f0ce,_0x54592c,_0x28b9af){var _0x1a57b2,_0x27c6e8,_0x559235,_0x172f64;_0x54592c['serverUrl']=intUtil[_0x9e70('0x62')](_0x54592c[_0x9e70('0x61')]);_0x54592c[_0x9e70('0x59')]=intUtil[_0x9e70('0x62')](_0x54592c[_0x9e70('0x59')]);if(_0x28b9af&&_0x28b9af[_0x9e70('0x77')]&&_0x28b9af[_0x9e70('0x77')]!==_0x9e70('0x78')){logger[_0x9e70('0x1e')](_0x9e70('0x79'),_0x9e70('0x65'));_0x255010['recordingURL']=util[_0x9e70('0x47')](_0x9e70('0x67'),_0x54592c[_0x9e70('0x61')],_0x255010[_0x9e70('0x68')],md5(_0x255010['uniqueid']));}return getConnection(_0x54592c)['then'](function(_0x3f1ed1){_0x172f64=_0x3f1ed1;return getUser(_0x54592c,_0x351dca[_0x9e70('0x7a')],_0x172f64);})[_0x9e70('0x25')](function(_0xdbd485){_0x1a57b2=_0xdbd485;return getEndUser(_0x54592c,_0x511147,_0x255010[_0x9e70('0x7b')],_0x255010[_0x9e70('0x7c')],_0x172f64);})[_0x9e70('0x25')](function(_0x23574f){_0x27c6e8=_0x23574f;return getTicket(_0x54592c,_0x1a57b2,_0x27c6e8,_0x511147,_0x255010,_0x511147[_0x9e70('0x6b')],_0x172f64,_0x9e70('0x76'));})[_0x9e70('0x25')](function(_0x1fd002){_0x559235=_0x1fd002;logger[_0x9e70('0x1e')](_0x9e70('0x7d'),_0x559235['id']);logger[_0x9e70('0x1e')](_0x9e70('0x7e'),_0x559235['id'],_0x351dca['name'],_0x54592c[_0x9e70('0x3e')]);switch(_0x54592c['type']){case _0x9e70('0x6d'):emit(util[_0x9e70('0x47')](_0x9e70('0x6e'),_0x351dca[_0x9e70('0x55')]),_0x9e70('0x6f'),{'recordId':_0x559235['id']});break;case _0x9e70('0x70'):emit(util[_0x9e70('0x47')](_0x9e70('0x6e'),_0x351dca[_0x9e70('0x55')]),_0x9e70('0x71'),{'uri':util[_0x9e70('0x47')](_0x9e70('0x72'),_0x172f64[_0x9e70('0x73')],_0x559235['id'])});break;default:logger[_0x9e70('0x74')](_0x9e70('0x79'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x9e70('0x7f')](function(_0x42f4f6){logger['error'](_0x9e70('0x79'),_0x42f4f6);});};exports[_0x9e70('0x80')]=function(_0x593136,_0x470a10,_0x1ec043,_0x1b137c,_0x459f63,_0x2656f4){var _0x14a27c,_0x5e383c,_0x2e8516,_0x32ceab;_0x2656f4[_0x9e70('0x61')]=intUtil[_0x9e70('0x62')](_0x2656f4[_0x9e70('0x61')]);_0x2656f4[_0x9e70('0x59')]=intUtil[_0x9e70('0x62')](_0x2656f4[_0x9e70('0x59')]);if(_0x459f63&&_0x459f63[_0x9e70('0x63')]){logger[_0x9e70('0x1e')]('['+_0x470a10[_0x9e70('0x81')][_0x9e70('0x82')]()+']',_0x9e70('0x65'));_0x470a10[_0x9e70('0x66')]=util['format'](_0x9e70('0x67'),_0x2656f4[_0x9e70('0x61')],_0x470a10[_0x9e70('0x68')],md5(_0x470a10[_0x9e70('0x68')]));}else{_0x470a10[_0x9e70('0x66')]='';}return getConnection(_0x2656f4)[_0x9e70('0x25')](function(_0xf4ebd3){_0x32ceab=_0xf4ebd3;if(!_['isNil'](_0x1b137c)){return getUser(_0x2656f4,_0x1b137c['name'],_0x32ceab);}else{return getUser(_0x2656f4,null,_0x32ceab);}})['then'](function(_0x3e9efa){_0x14a27c=_0x3e9efa;return getEndUser(_0x2656f4,_0x1ec043,_0x470a10['calleridname'],_0x470a10[_0x9e70('0x6a')],_0x32ceab);})[_0x9e70('0x25')](function(_0x1ec3e3){_0x5e383c=_0x1ec3e3;return getTicket(_0x2656f4,_0x14a27c,_0x5e383c,_0x1ec043,_0x470a10,_0x1ec043['Fields'],_0x32ceab);})['then'](function(_0x436944){_0x2e8516=_0x436944;logger[_0x9e70('0x1e')]('['+_0x470a10[_0x9e70('0x81')][_0x9e70('0x82')]()+_0x9e70('0x83'),_0x2e8516['id']);logger[_0x9e70('0x1e')]('['+_0x470a10['lastevent'][_0x9e70('0x82')]()+_0x9e70('0x84'),_0x2656f4[_0x9e70('0x3e')]);})[_0x9e70('0x7f')](function(_0x15f039){logger[_0x9e70('0x74')]('['+_0x470a10['lastevent']['toUpperCase']()+']',_0x15f039);});}; \ 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 a16720b..f592f80 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 _0xc56f=['message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','picklist','type','nameField','toLowerCase','content','string','idField','customField','toString','variable','Variable',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','ticketId','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','name','%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','user:%s','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xc56f,0x130));var _0xfc56=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xc56f[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xfc56('0x0'));var Promise=require(_0xfc56('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0xfc56('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xfc56('0x3'));var logger=require(_0xfc56('0x4'))(_0xfc56('0x5'));config[_0xfc56('0x6')]=_[_0xfc56('0x7')](config[_0xfc56('0x6')],{'host':_0xfc56('0x8'),'port':0x18eb});var io=require(_0xfc56('0x9'))(new Redis(config[_0xfc56('0x6')]));function getAdminUser(_0x2dc7a7,_0x18db9f,_0x512789,_0x5233da,_0x2faff3,_0x210a42){return new Promise(function(_0x2a33f7,_0x1cadb3){var _0x540178={'method':_0xfc56('0xa'),'uri':_0x5233da+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2faff3+'&'+_0x210a42,'auth':_0x18db9f,'json':!![]};return rp(_0x540178)[_0xfc56('0xb')](function(_0x40e711){if(_0x40e711['result']['length']>0x0){_0x512789[_0xfc56('0xc')]=_0x40e711[_0xfc56('0xd')][0x0][_0xfc56('0xe')];}logger[_0xfc56('0xf')]('['+[_0x2dc7a7[_0xfc56('0x10')]()]+_0xfc56('0x11'),_0x512789);_0x2a33f7(_0x512789);})[_0xfc56('0x12')](function(_0x2cec81){logger[_0xfc56('0x13')]('['+[_0x2dc7a7[_0xfc56('0x10')]()]+']',_0x2cec81[_0xfc56('0x14')]);_0x1cadb3(_0x2cec81['message']);});});}function getUser(_0x3803cc,_0x503460,_0x145c9c,_0x32a6e7,_0xfc79dc){return function(_0x1027df){logger['info']('['+[_0x3803cc[_0xfc56('0x10')]()]+_0xfc56('0x15'),_0x1027df);return new Promise(function(_0x28a742,_0x50c497){if(intUtil[_0xfc56('0x16')](_0x1027df['userEmail'])){var _0x120961={'method':'GET','uri':_0x145c9c+_0xfc56('0x17')+_0x1027df[_0xfc56('0x18')]+'&'+_0x32a6e7+'&'+_0xfc79dc,'auth':_0x503460,'json':!![]};logger[_0xfc56('0xf')]('['+[_0x3803cc['toUpperCase']()]+_0xfc56('0x19'),_0x120961);return rp(_0x120961)[_0xfc56('0xb')](function(_0x20456f){logger['info']('['+[_0x3803cc[_0xfc56('0x10')]()]+_0xfc56('0x1a'),_0x20456f);if(_0x20456f[_0xfc56('0xd')][_0xfc56('0x1b')]>0x0&&String(_0x20456f[_0xfc56('0xd')][0x0][_0xfc56('0x1c')])===_0xfc56('0x1d')){_0x1027df[_0xfc56('0x1e')]=_0x20456f[_0xfc56('0xd')][0x0]['sys_id'];}else{_0x1027df[_0xfc56('0x1e')]=_0x1027df[_0xfc56('0xc')];_0x1027df[_0xfc56('0x18')]=_0x1027df[_0xfc56('0x1f')];}logger[_0xfc56('0xf')]('['+[_0x3803cc['toUpperCase']()]+_0xfc56('0x20'),_0x1027df);_0x28a742(_0x1027df);})[_0xfc56('0x12')](function(_0x42bf45){logger[_0xfc56('0x13')]('['+[_0x3803cc[_0xfc56('0x10')]()]+']',_0x42bf45[_0xfc56('0x14')]);_0x50c497(_0x42bf45['message']);});}else{logger['info']('['+[_0x3803cc[_0xfc56('0x10')]()]+_0xfc56('0x21'));_0x1027df['userId']=_0x1027df[_0xfc56('0xc')];_0x1027df['userEmail']=_0x1027df['adminEmail'];_0x28a742(_0x1027df);}});};}function createEndUser(_0x170400,_0x3a2299,_0x1550b3,_0x59bb37,_0x3a86eb){logger[_0xfc56('0xf')]('['+[_0x170400[_0xfc56('0x10')]()]+_0xfc56('0x22'),_0x1550b3);return new Promise(function(_0x4389ad,_0x387686){var _0x451644={'method':_0xfc56('0x23'),'uri':_0x59bb37+_0xfc56('0x24')+_0x3a86eb,'body':{'user_name':_0x1550b3['endUserNumber'],'roles':_0xfc56('0x25'),'first_name':_0x1550b3[_0xfc56('0x26')],'active':_0xfc56('0x1d'),'date_format':_0xfc56('0x27'),'phone':_0x1550b3['endUserNumber']},'auth':_0x3a2299,'json':!![]};return rp(_0x451644)[_0xfc56('0xb')](function(_0x4be049){logger[_0xfc56('0xf')]('['+[_0x170400[_0xfc56('0x10')]()]+_0xfc56('0x28'),_0x4be049[_0xfc56('0xd')]);_0x1550b3[_0xfc56('0x29')]=_0x4be049[_0xfc56('0xd')][_0xfc56('0xe')];_0x4389ad(_0x1550b3);})[_0xfc56('0x12')](function(_0x4719ef){logger[_0xfc56('0x13')]('['+[_0x170400['toUpperCase']()]+']',_0x4719ef[_0xfc56('0x14')]);_0x387686(_0x4719ef[_0xfc56('0x14')]);});});}function getEndUser(_0xa2de71,_0x2fb73f,_0x391f1f,_0x2a5b54,_0x5c7765){return function(_0x557e51){logger[_0xfc56('0xf')]('['+[_0xa2de71[_0xfc56('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x557e51);return new Promise(function(_0x2a1f95,_0x1f4254){var _0x2aaa10={'method':_0xfc56('0xa'),'uri':_0x391f1f+_0xfc56('0x2a')+_0x557e51[_0xfc56('0x26')]+'&'+_0x2a5b54+'&'+_0x5c7765,'auth':_0x2fb73f,'json':!![]};return rp(_0x2aaa10)[_0xfc56('0xb')](function(_0x3f2c1b){if(_0x3f2c1b[_0xfc56('0xd')]['length']>0x0){_0x557e51[_0xfc56('0x29')]=_0x3f2c1b[_0xfc56('0xd')][0x0][_0xfc56('0xe')];logger[_0xfc56('0xf')]('['+[_0xa2de71[_0xfc56('0x10')]()]+_0xfc56('0x2b'),_0x557e51);_0x2a1f95(_0x557e51);}else{return createEndUser(_0xa2de71,_0x2fb73f,_0x557e51,_0x391f1f,_0x2a5b54)[_0xfc56('0xb')](function(_0x1e565c){logger[_0xfc56('0xf')]('['+[_0xa2de71[_0xfc56('0x10')]()]+_0xfc56('0x2c'),_0x1e565c);_0x2a1f95(_0x1e565c);});}})[_0xfc56('0x12')](function(_0x3b82e5){logger[_0xfc56('0x13')]('['+[_0xa2de71[_0xfc56('0x10')]()]+']',_0x3b82e5[_0xfc56('0x14')]);_0x1f4254(_0x3b82e5[_0xfc56('0x14')]);});});};}function getCustomFields(_0x3c658f,_0x228285){var _0x35bb1f={};if(_0x3c658f[_0xfc56('0x1b')]>0x0){_[_0xfc56('0x2d')](_0x3c658f,function(_0x2dd93c){if(_[_0xfc56('0x2e')](['string',_0xfc56('0x2f')],_0x2dd93c[_0xfc56('0x30')])&&_0x2dd93c[_0xfc56('0x31')]&&!_0x2dd93c['customField']){_0x35bb1f[_0x2dd93c['nameField'][_0xfc56('0x32')]()]=_0x2dd93c[_0xfc56('0x33')]['toString']();}else if(_[_0xfc56('0x2e')]([_0xfc56('0x34'),_0xfc56('0x2f')],_0x2dd93c[_0xfc56('0x30')])&&_0x2dd93c[_0xfc56('0x35')]&&_0x2dd93c[_0xfc56('0x36')]){_0x35bb1f[_0x2dd93c[_0xfc56('0x35')][_0xfc56('0x32')]()]=_0x2dd93c['content'][_0xfc56('0x37')]();}else if(_0x2dd93c[_0xfc56('0x30')]===_0xfc56('0x38')&&_0x2dd93c['variableName']&&_0x2dd93c[_0xfc56('0x35')]&&_0x2dd93c['customField']){_0x35bb1f[_0x2dd93c['idField'][_0xfc56('0x32')]()]=_0x228285[_0x2dd93c['variableName']][_0xfc56('0x37')]();}else if(_0x2dd93c[_0xfc56('0x30')]==='customVariable'&&_0x2dd93c['Variable']&&_0x2dd93c['Variable']['name']&&_0x2dd93c['idField']&&_0x2dd93c[_0xfc56('0x36')]){_0x35bb1f[_0x2dd93c[_0xfc56('0x35')][_0xfc56('0x32')]()]=_0x228285[_0x2dd93c[_0xfc56('0x39')]['name'][_0xfc56('0x32')]()][_0xfc56('0x37')]();}});}return _0x35bb1f;}function getTicket(_0x1692f9,_0x1feffe,_0x2a58ed,_0x32fbc2,_0xe8b87c,_0x3ea08a){return function(_0x18a201){logger[_0xfc56('0xf')]('['+[_0x1692f9[_0xfc56('0x10')]()]+_0xfc56('0x3a'),_0x18a201);return new Promise(function(_0x14c5f4,_0x1e938a){var _0x200354=_0x1692f9[_0xfc56('0x32')]()===_0xfc56('0x3b')?_0x18a201[_0xfc56('0x1e')]:_0x18a201[_0xfc56('0x29')];var _0x3e2e5c={'method':_0xfc56('0x23'),'uri':_0x2a58ed+'incident'+'?'+_0x3ea08a,'body':Object[_0xfc56('0x3c')]({},{'active':_0xfc56('0x1d'),'caller_id':_0x200354,'assigned_to':_0x18a201[_0xfc56('0x1e')],'short_description':intUtil[_0xfc56('0x3d')](_0x32fbc2[_0xfc56('0x3e')],_0xe8b87c,'\x20'),'description':intUtil[_0xfc56('0x3d')](_0x32fbc2[_0xfc56('0x3f')],_0xe8b87c,'\x0a')},getCustomFields(_0x32fbc2['Fields'],_0xe8b87c)),'auth':_0x1feffe,'json':!![]};return rp(_0x3e2e5c)[_0xfc56('0xb')](function(_0x55689f){logger[_0xfc56('0xf')]('['+[_0x1692f9[_0xfc56('0x10')]()]+_0xfc56('0x40'),_0x55689f[_0xfc56('0xd')]);_0x18a201['ticketId']=_0x55689f[_0xfc56('0xd')]['sys_id'];_0x18a201[_0xfc56('0x41')]=_0x55689f[_0xfc56('0xd')][_0xfc56('0x42')];logger[_0xfc56('0xf')]('['+[_0x1692f9[_0xfc56('0x10')]()]+_0xfc56('0x43'),_0x18a201);_0x14c5f4(_0x18a201);})['catch'](function(_0x522499){logger[_0xfc56('0x13')]('['+[_0x1692f9[_0xfc56('0x10')]()]+']',_0x522499['message']);_0x1e938a(_0x522499['message']);});});};}function createRemoteTag(_0x79c8f6,_0x2bc3d8,_0x24d131,_0xa5a951){return new Promise(function(_0x3c1462,_0x3cc8ee){var _0xf2439f={'method':_0xfc56('0x23'),'uri':_0x24d131+_0xfc56('0x44')+'?'+_0xa5a951,'body':{'short_description':_0x79c8f6,'global':!![],'active':!![],'name':_0x79c8f6},'auth':_0x2bc3d8,'json':!![]};return rp(_0xf2439f)[_0xfc56('0xb')](function(_0x5e5e8e){var _0x466192=_0x5e5e8e[_0xfc56('0xd')][_0xfc56('0xe')];_0x3c1462(_0x466192);});});}function getRemoteTag(_0x3ff017,_0x12b16c,_0x17a42f,_0x26f4d4,_0x59b907){return new Promise(function(_0x5ae468,_0x558406){var _0x42a360={'method':_0xfc56('0xa'),'uri':_0x17a42f+_0xfc56('0x44')+_0xfc56('0x45')+_0x3ff017+'&'+_0x26f4d4,'auth':_0x12b16c,'json':!![]};return rp(_0x42a360)[_0xfc56('0xb')](function(_0x19232){if(_0x19232[_0xfc56('0xd')][_0xfc56('0x1b')]>0x0){var _0x2e9ec4=_0x19232[_0xfc56('0xd')][0x0]['sys_id'];_0x5ae468(_0x2e9ec4);}else{return createRemoteTag(_0x3ff017,_0x12b16c,_0x17a42f,_0x26f4d4)[_0xfc56('0xb')](function(_0xe8cf6d){_0x5ae468(_0xe8cf6d);});}});});}function assignTagToIncident(_0x21ba0f,_0x742cca,_0x76ba14,_0xcc6e36,_0x1b4fd8){return new Promise(function(_0x317c3f,_0x50ca26){var _0x530a8={'method':_0xfc56('0x23'),'uri':_0x76ba14+_0xfc56('0x46')+'?'+_0x1b4fd8,'body':{'label':_0x21ba0f,'table':'incident','id_type':'Incident','table_key':_0xcc6e36[_0xfc56('0x47')],'title':'Incident\x20-\x20'+_0xcc6e36[_0xfc56('0x41')],'id_display':_0xcc6e36[_0xfc56('0x41')]},'auth':_0x742cca,'json':!![]};return rp(_0x530a8)[_0xfc56('0xb')](function(_0x1e8593){_0x317c3f();})[_0xfc56('0x12')](function(){_0x317c3f();});});}function manageTags(_0x241bae,_0x24e3d9,_0x159aee,_0x382b3c,_0x28eb85,_0x2830c7,_0x1c0103){return new Promise(function(_0x121a21,_0x4941f2){var _0x3a73c3=[];_0x24e3d9['forEach'](function(_0x138299){_0x3a73c3[_0xfc56('0x48')](getRemoteTag(_0x138299,_0x159aee,_0x382b3c,_0x2830c7,_0x1c0103));});return Promise[_0xfc56('0x49')](_0x3a73c3)[_0xfc56('0xb')](function(_0x10d2a8){if(_0x10d2a8[_0xfc56('0x1b')]){logger['info']('['+[_0x241bae[_0xfc56('0x10')]()]+_0xfc56('0x4a'),_0x10d2a8);var _0x53d1ea=[];_0x10d2a8[_0xfc56('0x2d')](function(_0x46a9f5){_0x53d1ea[_0xfc56('0x48')](assignTagToIncident(_0x46a9f5,_0x159aee,_0x382b3c,_0x28eb85,_0x2830c7));});return Promise[_0xfc56('0x49')](_0x53d1ea)['then'](function(){_0x121a21();})['catch'](function(){_0x121a21();});}else{_0x121a21();}});});}function getTags(_0x400812,_0x403c0b,_0x535fae,_0x3c895c,_0x202ec4,_0x274fcb){return function(_0x23bccb){return new Promise(function(_0x58ac42,_0x39f84c){var _0x4c3204=[];var _0x45574c=_0x3c895c['Tags'];if(_0x45574c&&_0x45574c[_0xfc56('0x1b')]>0x0){_0x4c3204=_[_0xfc56('0x4b')](_0x45574c,_0xfc56('0x4c'));}if(_0x4c3204['length']>0x0){return manageTags(_0x400812,_0x4c3204,_0x403c0b,_0x535fae,_0x23bccb,_0x202ec4,_0x274fcb)['then'](function(){_0x58ac42(_0x23bccb);});}else{_0x58ac42(_0x23bccb);}});};}function emit(_0x62c005,_0x386fad,_0x573b46){var _0x2f5d46=_0xfc56('0x4d')+_0xfc56('0x4e')+_0xfc56('0x4f')+_0xfc56('0x50');var _0x48e85f={'uri':_0x62c005+_0xfc56('0x51')+_0x573b46+_0x2f5d46};io['to'](util['format'](_0xfc56('0x52'),_0x386fad))[_0xfc56('0x53')](_0xfc56('0x54'),_0x48e85f);}exports['cs']=function(_0x508a14,_0x212316,_0x2138fa,_0x590ae6,_0x59eb3f,_0x158b13,_0x41b73c,_0x36f14e){var _0x4e8946={};var _0x14955f={'user':_0x158b13['username'],'pass':_0x158b13['password']};var _0x346d64='sysparm_limit=1';var _0x15f752=_0xfc56('0x55');_0x158b13['remoteUri']=intUtil['stripTrailingSlash'](_0x158b13[_0xfc56('0x56')]);_0x158b13[_0xfc56('0x57')]=intUtil[_0xfc56('0x58')](_0x158b13[_0xfc56('0x57')]);var _0x11a199=util[_0xfc56('0x59')](_0xfc56('0x5a'),_0x158b13[_0xfc56('0x56')]);_0x4e8946[_0xfc56('0x18')]=!_[_0xfc56('0x5b')](_0x590ae6)?_0x590ae6[_0xfc56('0x5c')]:null;_0x4e8946[_0xfc56('0x1f')]=_0x158b13[_0xfc56('0x5c')];_0x4e8946[_0xfc56('0x26')]=_0x36f14e[_0xfc56('0x32')]()===_0xfc56('0x3b')?_0x212316[_0xfc56('0x5d')]:_0x212316[_0xfc56('0x5e')];_0x4e8946['callDirection']=_0x36f14e===_0xfc56('0x5f')||_0x36f14e==='unmanaged'?_0xfc56('0x5f'):'outbound';var _0x31abcc=util[_0xfc56('0x59')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x158b13[_0xfc56('0x57')],_0x212316['uniqueid'],md5(_0x212316[_0xfc56('0x60')]));if(_0x59eb3f&&_0x59eb3f[_0xfc56('0x61')]){logger[_0xfc56('0xf')]('[QUEUE]',_0xfc56('0x62'));_0x212316['recordingURL']=_0x31abcc;}else if(_0x41b73c&&_0x41b73c[_0xfc56('0x63')]&&_0x41b73c[_0xfc56('0x63')]!==_0xfc56('0x64')){logger['info'](_0xfc56('0x65'),'Recording\x20is\x20enabled!');_0x212316['recordingURL']=_0x31abcc;}else{_0x212316[_0xfc56('0x66')]='';}return getAdminUser(_0x36f14e,_0x14955f,_0x4e8946,_0x11a199,_0x15f752,_0x346d64)[_0xfc56('0xb')](getUser(_0x36f14e,_0x14955f,_0x11a199,_0x15f752,_0x346d64))[_0xfc56('0xb')](getEndUser(_0x36f14e,_0x14955f,_0x11a199,_0x15f752,_0x346d64))[_0xfc56('0xb')](getTicket(_0x36f14e,_0x14955f,_0x11a199,_0x2138fa,_0x212316,_0x15f752))[_0xfc56('0xb')](function(_0x521e32){logger['info'](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x521e32[_0xfc56('0x47')]));logger['info'](util['format'](_0xfc56('0x67'),_0x36f14e));if(_0x36f14e!==_0xfc56('0x68')){logger['info']('['+[_0x36f14e[_0xfc56('0x10')]()]+']',_0xfc56('0x69'));emit(_0x158b13[_0xfc56('0x56')],_0x590ae6['name'],_0x521e32[_0xfc56('0x47')]);}})[_0xfc56('0x12')](function(_0x537802){logger['error']('['+[_0x36f14e['toUpperCase']()]+_0xfc56('0x6a'),util[_0xfc56('0x6b')](_0x537802,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x83a1=['],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','userId','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20createEndUser\x20crm','forEach','string','type','customField','nameField','toLowerCase','content','toString','includes','picklist','idField','variable','variableName','customVariable','Variable','name','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','number','label','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','ticketId',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail'];(function(_0x5bfa38,_0x5b4769){var _0x56ba65=function(_0x549dd8){while(--_0x549dd8){_0x5bfa38['push'](_0x5bfa38['shift']());}};_0x56ba65(++_0x5b4769);}(_0x83a1,0xc1));var _0x183a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x83a1[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var Promise=require(_0x183a('0x0'));var rp=require(_0x183a('0x1'));var util=require(_0x183a('0x2'));var md5=require(_0x183a('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x183a('0x4'))(_0x183a('0x5'));config[_0x183a('0x6')]=_[_0x183a('0x7')](config[_0x183a('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x183a('0x8'))(new Redis(config[_0x183a('0x6')]));function getAdminUser(_0x431f5b,_0x14ae41,_0xc70136,_0x47f40c,_0x1ce38e,_0x2e78ab){return new Promise(function(_0x5a1289,_0x1ab975){var _0x12ea16={'method':_0x183a('0x9'),'uri':_0x47f40c+_0x183a('0xa')+'&'+_0x1ce38e+'&'+_0x2e78ab,'auth':_0x14ae41,'json':!![]};return rp(_0x12ea16)[_0x183a('0xb')](function(_0x3e39b8){if(_0x3e39b8[_0x183a('0xc')][_0x183a('0xd')]>0x0){_0xc70136[_0x183a('0xe')]=_0x3e39b8[_0x183a('0xc')][0x0][_0x183a('0xf')];}logger[_0x183a('0x10')]('['+[_0x431f5b[_0x183a('0x11')]()]+_0x183a('0x12'),_0xc70136);_0x5a1289(_0xc70136);})[_0x183a('0x13')](function(_0x14ca87){logger[_0x183a('0x14')]('['+[_0x431f5b[_0x183a('0x11')]()]+']',_0x14ca87['message']);_0x1ab975(_0x14ca87[_0x183a('0x15')]);});});}function getUser(_0x451ba4,_0x3236e2,_0x3f6301,_0x421d9e,_0x44950a){return function(_0x48fd46){logger[_0x183a('0x10')]('['+[_0x451ba4['toUpperCase']()]+_0x183a('0x16'),_0x48fd46);return new Promise(function(_0x40e65d,_0x49dbf8){if(intUtil['validateEmail'](_0x48fd46['userEmail'])){var _0x19b95b={'method':_0x183a('0x9'),'uri':_0x3f6301+_0x183a('0x17')+_0x48fd46[_0x183a('0x18')]+'&'+_0x421d9e+'&'+_0x44950a,'auth':_0x3236e2,'json':!![]};logger[_0x183a('0x10')]('['+[_0x451ba4['toUpperCase']()]+_0x183a('0x19'),_0x19b95b);return rp(_0x19b95b)[_0x183a('0xb')](function(_0x575206){logger[_0x183a('0x10')]('['+[_0x451ba4[_0x183a('0x11')]()]+_0x183a('0x1a'),_0x575206);if(_0x575206['result']['length']>0x0&&String(_0x575206['result'][0x0]['active'])===_0x183a('0x1b')){_0x48fd46['userId']=_0x575206['result'][0x0][_0x183a('0xf')];}else{_0x48fd46['userId']=_0x48fd46[_0x183a('0xe')];_0x48fd46['userEmail']=_0x48fd46[_0x183a('0x1c')];}logger[_0x183a('0x10')]('['+[_0x451ba4['toUpperCase']()]+_0x183a('0x1d'),_0x48fd46);_0x40e65d(_0x48fd46);})[_0x183a('0x13')](function(_0x1d8fcf){logger[_0x183a('0x14')]('['+[_0x451ba4[_0x183a('0x11')]()]+']',_0x1d8fcf[_0x183a('0x15')]);_0x49dbf8(_0x1d8fcf[_0x183a('0x15')]);});}else{logger['info']('['+[_0x451ba4['toUpperCase']()]+_0x183a('0x1e'));_0x48fd46[_0x183a('0x1f')]=_0x48fd46[_0x183a('0xe')];_0x48fd46[_0x183a('0x18')]=_0x48fd46[_0x183a('0x1c')];_0x40e65d(_0x48fd46);}});};}function createEndUser(_0x300583,_0x3f4ab0,_0x15d06b,_0x33454e,_0x14f701){logger[_0x183a('0x10')]('['+[_0x300583['toUpperCase']()]+'],\x20createEndUser\x20input\x20crm',_0x15d06b);return new Promise(function(_0x1bd041,_0x381470){var _0x47871e={'method':_0x183a('0x20'),'uri':_0x33454e+_0x183a('0x21')+_0x14f701,'body':{'user_name':_0x15d06b[_0x183a('0x22')],'roles':'user','first_name':_0x15d06b['endUserNumber'],'active':_0x183a('0x1b'),'date_format':_0x183a('0x23'),'phone':_0x15d06b['endUserNumber']},'auth':_0x3f4ab0,'json':!![]};return rp(_0x47871e)[_0x183a('0xb')](function(_0x197bea){logger[_0x183a('0x10')]('['+[_0x300583[_0x183a('0x11')]()]+_0x183a('0x24'),_0x197bea['result']);_0x15d06b[_0x183a('0x25')]=_0x197bea[_0x183a('0xc')]['sys_id'];_0x1bd041(_0x15d06b);})['catch'](function(_0xcdd8b3){logger[_0x183a('0x14')]('['+[_0x300583['toUpperCase']()]+']',_0xcdd8b3[_0x183a('0x15')]);_0x381470(_0xcdd8b3[_0x183a('0x15')]);});});}function getEndUser(_0x117366,_0x4dec6a,_0x5b8f59,_0x14efb7,_0x4560a0){return function(_0x2cd910){logger[_0x183a('0x10')]('['+[_0x117366[_0x183a('0x11')]()]+_0x183a('0x26'),_0x2cd910);return new Promise(function(_0x2b3d98,_0x1f97ca){var _0x5f391c={'method':_0x183a('0x9'),'uri':_0x5b8f59+'sys_user?sysparm_query=phone%3D'+_0x2cd910[_0x183a('0x22')]+'&'+_0x14efb7+'&'+_0x4560a0,'auth':_0x4dec6a,'json':!![]};return rp(_0x5f391c)[_0x183a('0xb')](function(_0x5991f1){if(_0x5991f1[_0x183a('0xc')][_0x183a('0xd')]>0x0){_0x2cd910[_0x183a('0x25')]=_0x5991f1[_0x183a('0xc')][0x0][_0x183a('0xf')];logger[_0x183a('0x10')]('['+[_0x117366[_0x183a('0x11')]()]+'],\x20getEndUser\x20crm',_0x2cd910);_0x2b3d98(_0x2cd910);}else{return createEndUser(_0x117366,_0x4dec6a,_0x2cd910,_0x5b8f59,_0x14efb7)['then'](function(_0x19cb2e){logger[_0x183a('0x10')]('['+[_0x117366['toUpperCase']()]+_0x183a('0x27'),_0x19cb2e);_0x2b3d98(_0x19cb2e);});}})[_0x183a('0x13')](function(_0x3b9383){logger['error']('['+[_0x117366[_0x183a('0x11')]()]+']',_0x3b9383[_0x183a('0x15')]);_0x1f97ca(_0x3b9383[_0x183a('0x15')]);});});};}function getCustomFields(_0x411b25,_0x3e3367){var _0x4b2f02={};if(_0x411b25[_0x183a('0xd')]>0x0){_[_0x183a('0x28')](_0x411b25,function(_0x498c1e){if(_['includes']([_0x183a('0x29'),'picklist'],_0x498c1e[_0x183a('0x2a')])&&_0x498c1e['nameField']&&!_0x498c1e[_0x183a('0x2b')]){_0x4b2f02[_0x498c1e[_0x183a('0x2c')][_0x183a('0x2d')]()]=_0x498c1e[_0x183a('0x2e')][_0x183a('0x2f')]();}else if(_[_0x183a('0x30')]([_0x183a('0x29'),_0x183a('0x31')],_0x498c1e[_0x183a('0x2a')])&&_0x498c1e['idField']&&_0x498c1e[_0x183a('0x2b')]){_0x4b2f02[_0x498c1e[_0x183a('0x32')][_0x183a('0x2d')]()]=_0x498c1e[_0x183a('0x2e')]['toString']();}else if(_0x498c1e[_0x183a('0x2a')]===_0x183a('0x33')&&_0x498c1e[_0x183a('0x34')]&&_0x498c1e[_0x183a('0x32')]&&_0x498c1e['customField']){_0x4b2f02[_0x498c1e[_0x183a('0x32')]['toLowerCase']()]=_0x3e3367[_0x498c1e[_0x183a('0x34')]][_0x183a('0x2f')]();}else if(_0x498c1e[_0x183a('0x2a')]===_0x183a('0x35')&&_0x498c1e[_0x183a('0x36')]&&_0x498c1e['Variable'][_0x183a('0x37')]&&_0x498c1e[_0x183a('0x32')]&&_0x498c1e[_0x183a('0x2b')]){_0x4b2f02[_0x498c1e[_0x183a('0x32')]['toLowerCase']()]=_0x3e3367[_0x498c1e[_0x183a('0x36')][_0x183a('0x37')][_0x183a('0x2d')]()][_0x183a('0x2f')]();}});}return _0x4b2f02;}function getTicket(_0x4a6056,_0x35e781,_0x41f01b,_0x598e24,_0x945e30,_0x554bde){return function(_0x4511f7){logger[_0x183a('0x10')]('['+[_0x4a6056[_0x183a('0x11')]()]+']\x20getTicket\x20input\x20crm',_0x4511f7);return new Promise(function(_0x170895,_0x10e505){var _0x3acdc6=_0x4a6056[_0x183a('0x2d')]()==='outbound'?_0x4511f7[_0x183a('0x1f')]:_0x4511f7[_0x183a('0x25')];var _0x2c69e2={'method':'POST','uri':_0x41f01b+'incident'+'?'+_0x554bde,'body':Object[_0x183a('0x38')]({},{'active':'true','caller_id':_0x3acdc6,'assigned_to':_0x4511f7['userId'],'short_description':intUtil['getString'](_0x598e24[_0x183a('0x39')],_0x945e30,'\x20'),'description':intUtil[_0x183a('0x3a')](_0x598e24[_0x183a('0x3b')],_0x945e30,'\x0a')},getCustomFields(_0x598e24[_0x183a('0x3c')],_0x945e30)),'auth':_0x35e781,'json':!![]};return rp(_0x2c69e2)['then'](function(_0x58e00e){logger[_0x183a('0x10')]('['+[_0x4a6056[_0x183a('0x11')]()]+_0x183a('0x3d'),_0x58e00e[_0x183a('0xc')]);_0x4511f7['ticketId']=_0x58e00e[_0x183a('0xc')]['sys_id'];_0x4511f7['ticketNumber']=_0x58e00e[_0x183a('0xc')][_0x183a('0x3e')];logger[_0x183a('0x10')]('['+[_0x4a6056[_0x183a('0x11')]()]+']\x20getTicket\x20crm',_0x4511f7);_0x170895(_0x4511f7);})[_0x183a('0x13')](function(_0x2fdfe4){logger[_0x183a('0x14')]('['+[_0x4a6056[_0x183a('0x11')]()]+']',_0x2fdfe4['message']);_0x10e505(_0x2fdfe4[_0x183a('0x15')]);});});};}function createRemoteTag(_0x473fff,_0x252278,_0x4b3015,_0x3c2ee7){return new Promise(function(_0x29f6fa,_0x55bbde){var _0x2206c4={'method':_0x183a('0x20'),'uri':_0x4b3015+'label'+'?'+_0x3c2ee7,'body':{'short_description':_0x473fff,'global':!![],'active':!![],'name':_0x473fff},'auth':_0x252278,'json':!![]};return rp(_0x2206c4)['then'](function(_0x49e466){var _0x1a9248=_0x49e466[_0x183a('0xc')][_0x183a('0xf')];_0x29f6fa(_0x1a9248);});});}function getRemoteTag(_0x1bef73,_0x2dd62b,_0x5cae42,_0x5a1c78,_0x1f9032){return new Promise(function(_0x58449a,_0x71c4f5){var _0x4791dd={'method':_0x183a('0x9'),'uri':_0x5cae42+_0x183a('0x3f')+_0x183a('0x40')+_0x1bef73+'&'+_0x5a1c78,'auth':_0x2dd62b,'json':!![]};return rp(_0x4791dd)['then'](function(_0x29a881){if(_0x29a881['result'][_0x183a('0xd')]>0x0){var _0x214453=_0x29a881[_0x183a('0xc')][0x0][_0x183a('0xf')];_0x58449a(_0x214453);}else{return createRemoteTag(_0x1bef73,_0x2dd62b,_0x5cae42,_0x5a1c78)[_0x183a('0xb')](function(_0x5d906f){_0x58449a(_0x5d906f);});}});});}function assignTagToIncident(_0x3bc7bc,_0x5f4bdf,_0x4ca215,_0x2743e2,_0x12843a){return new Promise(function(_0x36bfab,_0x554ff1){var _0x33b723={'method':_0x183a('0x20'),'uri':_0x4ca215+'label_entry'+'?'+_0x12843a,'body':{'label':_0x3bc7bc,'table':_0x183a('0x41'),'id_type':_0x183a('0x42'),'table_key':_0x2743e2['ticketId'],'title':_0x183a('0x43')+_0x2743e2[_0x183a('0x44')],'id_display':_0x2743e2[_0x183a('0x44')]},'auth':_0x5f4bdf,'json':!![]};return rp(_0x33b723)['then'](function(_0x8db1ba){_0x36bfab();})[_0x183a('0x13')](function(){_0x36bfab();});});}function manageTags(_0x3ba85f,_0x5c348c,_0x2ca98f,_0x5c96a2,_0x2c45d7,_0x5ec025,_0x1f54a0){return new Promise(function(_0x1d1504,_0xca77d2){var _0x28f2df=[];_0x5c348c['forEach'](function(_0x419c4a){_0x28f2df[_0x183a('0x45')](getRemoteTag(_0x419c4a,_0x2ca98f,_0x5c96a2,_0x5ec025,_0x1f54a0));});return Promise[_0x183a('0x46')](_0x28f2df)['then'](function(_0x4ef293){if(_0x4ef293['length']){logger[_0x183a('0x10')]('['+[_0x3ba85f[_0x183a('0x11')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4ef293);var _0x3eab78=[];_0x4ef293['forEach'](function(_0x19c733){_0x3eab78[_0x183a('0x45')](assignTagToIncident(_0x19c733,_0x2ca98f,_0x5c96a2,_0x2c45d7,_0x5ec025));});return Promise[_0x183a('0x46')](_0x3eab78)[_0x183a('0xb')](function(){_0x1d1504();})[_0x183a('0x13')](function(){_0x1d1504();});}else{_0x1d1504();}});});}function getTags(_0x483f10,_0x46c882,_0x547e35,_0x37b8c9,_0x11f869,_0x46724e){return function(_0x2eaac7){return new Promise(function(_0x262252,_0x946464){var _0x46b1b2=[];var _0x43877f=_0x37b8c9[_0x183a('0x47')];if(_0x43877f&&_0x43877f[_0x183a('0xd')]>0x0){_0x46b1b2=_[_0x183a('0x48')](_0x43877f,_0x183a('0x37'));}if(_0x46b1b2[_0x183a('0xd')]>0x0){return manageTags(_0x483f10,_0x46b1b2,_0x46c882,_0x547e35,_0x2eaac7,_0x11f869,_0x46724e)['then'](function(){_0x262252(_0x2eaac7);});}else{_0x262252(_0x2eaac7);}});};}function emit(_0xe5a485,_0x586db6,_0x3f6dba){var _0x5d0afc=_0x183a('0x49')+_0x183a('0x4a')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x183a('0x4b');var _0x461c03={'uri':_0xe5a485+_0x183a('0x4c')+_0x3f6dba+_0x5d0afc};io['to'](util[_0x183a('0x4d')](_0x183a('0x4e'),_0x586db6))[_0x183a('0x4f')](_0x183a('0x50'),_0x461c03);}exports['cs']=function(_0xf8591b,_0x38a9c2,_0x3ce94e,_0xfe92fa,_0x5d46b5,_0x220863,_0x2e026d,_0x38c246){var _0x553de1={};var _0x12ea6e={'user':_0x220863['username'],'pass':_0x220863[_0x183a('0x51')]};var _0x5dc556=_0x183a('0x52');var _0x4e27a7=_0x183a('0x53');_0x220863['remoteUri']=intUtil[_0x183a('0x54')](_0x220863[_0x183a('0x55')]);_0x220863[_0x183a('0x56')]=intUtil[_0x183a('0x54')](_0x220863[_0x183a('0x56')]);var _0x59c2a4=util[_0x183a('0x4d')](_0x183a('0x57'),_0x220863['remoteUri']);_0x553de1[_0x183a('0x18')]=!_[_0x183a('0x58')](_0xfe92fa)?_0xfe92fa[_0x183a('0x59')]:null;_0x553de1[_0x183a('0x1c')]=_0x220863[_0x183a('0x59')];_0x553de1[_0x183a('0x22')]=_0x38c246[_0x183a('0x2d')]()===_0x183a('0x5a')?_0x38a9c2[_0x183a('0x5b')]:_0x38a9c2[_0x183a('0x5c')];_0x553de1[_0x183a('0x5d')]=_0x38c246===_0x183a('0x5e')||_0x38c246===_0x183a('0x5f')?'queue':_0x183a('0x5a');var _0x1e6aa3=util['format'](_0x183a('0x60'),_0x220863[_0x183a('0x56')],_0x38a9c2[_0x183a('0x61')],md5(_0x38a9c2['uniqueid']));if(_0x5d46b5&&_0x5d46b5[_0x183a('0x62')]){logger[_0x183a('0x10')](_0x183a('0x63'),_0x183a('0x64'));_0x38a9c2[_0x183a('0x65')]=_0x1e6aa3;}else if(_0x2e026d&&_0x2e026d[_0x183a('0x66')]&&_0x2e026d[_0x183a('0x66')]!==_0x183a('0x67')){logger['info'](_0x183a('0x68'),_0x183a('0x64'));_0x38a9c2[_0x183a('0x65')]=_0x1e6aa3;}else{_0x38a9c2['recordingURL']='';}return getAdminUser(_0x38c246,_0x12ea6e,_0x553de1,_0x59c2a4,_0x4e27a7,_0x5dc556)['then'](getUser(_0x38c246,_0x12ea6e,_0x59c2a4,_0x4e27a7,_0x5dc556))[_0x183a('0xb')](getEndUser(_0x38c246,_0x12ea6e,_0x59c2a4,_0x4e27a7,_0x5dc556))['then'](getTicket(_0x38c246,_0x12ea6e,_0x59c2a4,_0x3ce94e,_0x38a9c2,_0x4e27a7))[_0x183a('0xb')](function(_0xa7670d){logger[_0x183a('0x10')](util['format'](_0x183a('0x69'),_0xa7670d['ticketId']));logger[_0x183a('0x10')](util['format']('call\x20direction:\x20%s',_0x38c246));if(_0x38c246!==_0x183a('0x5f')){logger['info']('['+[_0x38c246['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x220863[_0x183a('0x55')],_0xfe92fa[_0x183a('0x37')],_0xa7670d[_0x183a('0x6a')]);}})[_0x183a('0x13')](function(_0x3a6eb0){logger[_0x183a('0x14')]('['+[_0x38c246[_0x183a('0x11')]()]+_0x183a('0x6b'),util[_0x183a('0x6c')](_0x3a6eb0,{'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 3d99a10..3fbe2c1 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 _0xe4ac=['apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','map','type','string','customField','nameField','content','toString','custom_fields','customVariable','Variable','toLowerCase','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','uri','lastevent','toUpperCase','calleridname','Inbound','lodash','request-promise','bluebird','md5','util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format'];(function(_0x513ce4,_0x4ac653){var _0x18b933=function(_0x2fd2b3){while(--_0x2fd2b3){_0x513ce4['push'](_0x513ce4['shift']());}};_0x18b933(++_0x4ac653);}(_0xe4ac,0x1b3));var _0xce4a=function(_0x36199a,_0x4f756c){_0x36199a=_0x36199a-0x0;var _0x5b36f1=_0xe4ac[_0x36199a];return _0x5b36f1;};'use strict';var _=require(_0xce4a('0x0'));var rp=require(_0xce4a('0x1'));var BPromise=require(_0xce4a('0x2'));var md5=require(_0xce4a('0x3'));var util=require(_0xce4a('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xce4a('0x5'));var logger=require(_0xce4a('0x6'))('sugarcrm');config[_0xce4a('0x7')]=_['defaults'](config['redis'],{'host':_0xce4a('0x8'),'port':0x18eb});var io=require(_0xce4a('0x9'))(new Redis(config[_0xce4a('0x7')]));var def={'method':'POST','json':!![]};function emit(_0x28888f,_0x2a9dba,_0xb083a8){io['to'](_0x28888f)[_0xce4a('0xa')](_0x2a9dba,_0xb083a8);}function getTicket(_0x199256,_0x44d4e8,_0x3934fa,_0x56de2e,_0x5c5d7d,_0x10c8e9,_0x1f78f1,_0x45a270){logger[_0xce4a('0xb')](_0xce4a('0xc'));var _0x231d83=new Date();var _0x11d5de=[{'name':_0xce4a('0xd'),'value':intUtil['getString'](_0x56de2e[_0xce4a('0xe')],_0x5c5d7d,'\x20')},{'name':'assigned_user_id','value':_0x44d4e8['id']},{'name':_0xce4a('0xf'),'value':_0x44d4e8['id']},{'name':_0xce4a('0x10'),'value':intUtil['getString'](_0x56de2e['Descriptions'],_0x5c5d7d,'\x0a')},{'name':_0xce4a('0x11'),'value':_0x231d83[_0xce4a('0x12')]()[_0xce4a('0x13')](0x0,0x13)[_0xce4a('0x14')]('T','\x20')},{'name':_0xce4a('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xce4a('0x16'),'value':_0x3934fa['id']},{'name':_0xce4a('0x17'),'value':_0xce4a('0x18')},{'name':_0xce4a('0x19'),'value':_0x3934fa[_0xce4a('0xd')]},{'name':_0xce4a('0x1a'),'value':_0x45a270}];if(_0x10c8e9[_0xce4a('0x1b')]){_[_0xce4a('0x1c')](_0x10c8e9,function(_0x316c17){if(_0x5c5d7d[_0x316c17[_0xce4a('0x1d')]]){_0x11d5de[_0xce4a('0x1e')]({'name':_0x316c17[_0xce4a('0x1f')],'value':_0x5c5d7d[_0x316c17[_0xce4a('0x1d')]]});}});}return request({'form':{'method':_0xce4a('0x20'),'input_type':_0xce4a('0x21'),'response_type':'JSON','rest_data':JSON[_0xce4a('0x22')]({'session':_0x1f78f1['id'],'module_name':_0xce4a('0x23'),'name_value_list':_0x11d5de})}});}function getAuth(_0x268048){return util[_0xce4a('0x24')]('Basic\x20%s',new Buffer(_0x268048[_0xce4a('0x25')]+':X')['toString'](_0xce4a('0x26')));}function getServerInfo(_0x34df88){return request({'form':{'method':_0xce4a('0x27'),'input_type':_0xce4a('0x21'),'response_type':_0xce4a('0x21'),'rest_data':JSON[_0xce4a('0x22')]({'session':_0x34df88['id']})}});}function getUser(_0x5e1541,_0x56499e,_0x1a31ac){if(!_[_0xce4a('0x28')](_0x56499e)){logger[_0xce4a('0xb')](_0xce4a('0x29'),_0x56499e);return request({'form':{'method':_0xce4a('0x2a'),'input_type':_0xce4a('0x21'),'response_type':_0xce4a('0x21'),'rest_data':JSON[_0xce4a('0x22')]({'session':_0x1a31ac['id'],'module_name':_0xce4a('0x2b'),'query':util[_0xce4a('0x24')](_0xce4a('0x2c'),_0x56499e),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xce4a('0x2d')](function(_0x1fa17c){if(_0x1fa17c[_0xce4a('0x2e')][_0xce4a('0x1b')]){var _0x196ae6=_['find'](_0x1fa17c[_0xce4a('0x2e')],function(_0x37bac4){return _0x37bac4['name_value_list'][_0xce4a('0x2f')][_0xce4a('0x30')]===_0x56499e;});if(_0x196ae6){logger[_0xce4a('0xb')](_0xce4a('0x31'));return BPromise[_0xce4a('0x32')]({'id':_0x196ae6['name_value_list']['id'][_0xce4a('0x30')],'name':_0x196ae6[_0xce4a('0x33')][_0xce4a('0xd')]['value']});}}logger[_0xce4a('0xb')](_0xce4a('0x34'));return BPromise[_0xce4a('0x32')]({'id':_0x1a31ac[_0xce4a('0x33')][_0xce4a('0x35')][_0xce4a('0x30')],'name':_0x1a31ac[_0xce4a('0x33')][_0xce4a('0x2f')][_0xce4a('0x30')]});});}else{logger['info'](_0xce4a('0x36'));return BPromise[_0xce4a('0x32')]({'id':_0x1a31ac[_0xce4a('0x33')][_0xce4a('0x35')][_0xce4a('0x30')],'name':_0x1a31ac[_0xce4a('0x33')][_0xce4a('0x2f')][_0xce4a('0x30')]});}}function getEndUser(_0x41bad9,_0x4edb74,_0x42b9b9,_0x3136c2){logger[_0xce4a('0xb')](_0xce4a('0x37'),_0x42b9b9);return request({'form':{'method':_0xce4a('0x2a'),'input_type':_0xce4a('0x21'),'response_type':_0xce4a('0x21'),'rest_data':JSON[_0xce4a('0x22')]({'session':_0x3136c2['id'],'module_name':_0xce4a('0x18'),'query':util[_0xce4a('0x24')](_0xce4a('0x38'),_0x42b9b9),'order_by':'','offset':'0','select_fields':['id','name',_0xce4a('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xce4a('0x2d')](function(_0x3caae2){if(_0x3caae2['entry_list'][_0xce4a('0x1b')]){var _0x337dbf=_[_0xce4a('0x3a')](_0x3caae2[_0xce4a('0x2e')],function(_0x34e692){return _0x34e692[_0xce4a('0x33')][_0xce4a('0x39')][_0xce4a('0x30')]===_0x42b9b9;});if(_0x337dbf){logger[_0xce4a('0xb')]('Enduser\x20found!');return BPromise[_0xce4a('0x32')]({'id':_0x337dbf['name_value_list']['id'][_0xce4a('0x30')],'name':_0x337dbf[_0xce4a('0x33')][_0xce4a('0xd')][_0xce4a('0x30')],'phone':_0x337dbf[_0xce4a('0x33')][_0xce4a('0x39')][_0xce4a('0x30')]});}}else{logger[_0xce4a('0xb')](_0xce4a('0x3b'));return request({'form':{'method':_0xce4a('0x20'),'input_type':_0xce4a('0x21'),'response_type':_0xce4a('0x21'),'rest_data':JSON[_0xce4a('0x22')]({'session':_0x3136c2['id'],'module_name':'Contacts','name_value_list':[{'name':_0xce4a('0x3c'),'value':_0x4edb74!==_0xce4a('0x3d')?_0x4edb74:util[_0xce4a('0x24')](_0xce4a('0x3e'),_0x42b9b9)},{'name':_0xce4a('0x39'),'value':_0x42b9b9}]})}})['then'](function(_0x52890e){logger[_0xce4a('0xb')]('Enduser\x20created.');return BPromise[_0xce4a('0x32')]({'id':_0x52890e['id'],'name':_0x52890e['entry_list'][_0xce4a('0x3c')][_0xce4a('0x30')],'phone':_0x52890e[_0xce4a('0x2e')][_0xce4a('0x39')][_0xce4a('0x30')]});});}});}function request(_0x4e26df){logger[_0xce4a('0x3f')]('[HTTP]',JSON[_0xce4a('0x22')](_0x4e26df));return rp(_['merge'](def,_0x4e26df));}function getTags(_0x415b2c,_0x10e24a){var _0x143bcc=[];if(_0x415b2c&&_0x415b2c[_0xce4a('0x1b')]>0x0){_0x143bcc=_[_0xce4a('0x40')](_0x415b2c,_0x10e24a);}return _0x143bcc;}function getCustomFields(_0x2c9d61,_0x553055){var _0x2d10c9=[];var _0x9e738b={'custom_fields':[]};if(_0x2c9d61[_0xce4a('0x1b')]>0x0){_[_0xce4a('0x1c')](_0x2c9d61,function(_0x255df){if(_0x255df[_0xce4a('0x41')]===_0xce4a('0x42')&&_0x255df['nameField']&&!_0x255df[_0xce4a('0x43')]){_0x9e738b[_0x255df[_0xce4a('0x44')]['toLowerCase']()]=_0x255df[_0xce4a('0x45')]['toString']();}else if(_0x255df[_0xce4a('0x41')]===_0xce4a('0x42')&&_0x255df[_0xce4a('0x1f')]&&_0x255df[_0xce4a('0x43')]){_0x9e738b['custom_fields'][_0xce4a('0x1e')]({'id':_0x255df[_0xce4a('0x1f')],'value':_0x255df['content'][_0xce4a('0x46')]()});}else if(_0x255df[_0xce4a('0x41')]==='variable'&&_0x255df['variableName']&&_0x255df[_0xce4a('0x1f')]&&_0x255df[_0xce4a('0x43')]){_0x553055[_0x255df[_0xce4a('0x1d')]]&&_0x9e738b[_0xce4a('0x47')][_0xce4a('0x1e')]({'id':_0x255df['idField'],'value':_0x553055[_0x255df[_0xce4a('0x1d')]][_0xce4a('0x46')]()});}else if(_0x255df[_0xce4a('0x41')]===_0xce4a('0x48')&&_0x255df['Variable']&&_0x255df[_0xce4a('0x49')][_0xce4a('0xd')]&&_0x255df[_0xce4a('0x1f')]&&_0x255df[_0xce4a('0x43')]){_0x553055[_0x255df[_0xce4a('0x49')][_0xce4a('0xd')][_0xce4a('0x4a')]()]&&_0x9e738b[_0xce4a('0x47')][_0xce4a('0x1e')]({'id':_0x255df[_0xce4a('0x1f')],'value':_0x553055[_0x255df['Variable'][_0xce4a('0xd')][_0xce4a('0x4a')]()]['toString']()});}});}return _0x9e738b;}function getConnection(_0x14658f){return request({'method':'POST','form':{'method':_0xce4a('0x4b'),'input_type':_0xce4a('0x21'),'response_type':'JSON','rest_data':JSON[_0xce4a('0x22')]({'user_auth':{'user_name':_0x14658f['username'],'password':_0x14658f[_0xce4a('0x4c')],'encryption':_0xce4a('0x4d')},'application':_0xce4a('0x4e')})}})[_0xce4a('0x2d')](function(_0x212524){var _0x361f18=_0x212524;if(_0x361f18['id']){def[_0xce4a('0x4f')]=_0x361f18['id'];return BPromise[_0xce4a('0x32')](_0x361f18);}else{throw new Error(util[_0xce4a('0x24')]('Account\x20%d\x20is\x20not\x20valid',_0x14658f['id']));}});}function setRelationship(_0x1d9048,_0x5b20df,_0x42b6bb,_0xef0f54){return request({'form':{'method':_0xce4a('0x50'),'input_type':'JSON','response_type':_0xce4a('0x21'),'rest_data':JSON['stringify']({'session':_0x1d9048['id'],'module_name':'Calls','module_id':_0x42b6bb['id'],'link_field_name':_0xef0f54,'related_ids':[_0x5b20df['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x321433,_0x2b3ac7,_0x394a1a,_0xb34501,_0x3b3969,_0xd67c8e){var _0x17996f,_0x1dacb0,_0x1e6503,_0x2ef02b;_0xd67c8e['remoteUri']=intUtil[_0xce4a('0x51')](_0xd67c8e[_0xce4a('0x52')]);_0xd67c8e[_0xce4a('0x53')]=intUtil[_0xce4a('0x51')](_0xd67c8e[_0xce4a('0x53')]);def['uri']=util[_0xce4a('0x24')](_0xce4a('0x54'),_0xd67c8e[_0xce4a('0x52')]);if(_0x3b3969&&_0x3b3969[_0xce4a('0x55')]){logger[_0xce4a('0xb')](_0xce4a('0x56'),_0xce4a('0x57'));_0x2b3ac7['recordingURL']=util[_0xce4a('0x24')](_0xce4a('0x58'),_0xd67c8e[_0xce4a('0x53')],_0x2b3ac7[_0xce4a('0x59')],md5(_0x2b3ac7['uniqueid']));}else{_0x2b3ac7[_0xce4a('0x5a')]='';}return getConnection(_0xd67c8e)[_0xce4a('0x2d')](function(_0xcd6a4){_0x2ef02b=_0xcd6a4;return getUser(_0xd67c8e,_0xb34501[_0xce4a('0xd')],_0x2ef02b);})[_0xce4a('0x2d')](function(_0x1ce89a){_0x17996f=_0x1ce89a;logger['info'](_0xce4a('0x5b'),_0x17996f['id']);return getEndUser(_0xd67c8e,_0x2b3ac7['calleridname'],_0x2b3ac7[_0xce4a('0x5c')],_0x2ef02b);})[_0xce4a('0x2d')](function(_0x540759){_0x1dacb0=_0x540759;logger[_0xce4a('0xb')](_0xce4a('0x5d'),_0x1dacb0['id']);return getTicket(_0xd67c8e,_0x17996f,_0x1dacb0,_0x394a1a,_0x2b3ac7,_0x394a1a[_0xce4a('0x5e')],_0x2ef02b,'Inbound');})[_0xce4a('0x2d')](function(_0x3fdbc2){_0x1e6503=_0x3fdbc2;logger[_0xce4a('0xb')]('Ticket\x20created!');logger[_0xce4a('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1e6503['id']);return setRelationship(_0x2ef02b,_0x17996f,_0x1e6503,_0xce4a('0x5f'));})[_0xce4a('0x2d')](function(){return setRelationship(_0x2ef02b,_0x1dacb0,_0x1e6503,_0xce4a('0x60'));})[_0xce4a('0x2d')](function(){return getServerInfo(_0x2ef02b);})['then'](function(_0x34281e){var _0x519a93=parseInt(_0x34281e[_0xce4a('0x61')][_0xce4a('0x62')](0x0));var _0x29d170=util['format'](_0xce4a('0x63'),_0xd67c8e[_0xce4a('0x52')],_0x1e6503['id']);if(_0x519a93>0x6){_0x29d170=util[_0xce4a('0x24')](_0xce4a('0x64'),_0xd67c8e[_0xce4a('0x52')],_0x1e6503['id']);}logger[_0xce4a('0xb')]('[QUEUE]',_0xce4a('0x65'));emit(util['format'](_0xce4a('0x66'),_0xb34501[_0xce4a('0xd')]),_0xce4a('0x67'),{'uri':_0x29d170});})[_0xce4a('0x68')](function(_0x18ce28){logger[_0xce4a('0x69')](_0xce4a('0x56'),JSON[_0xce4a('0x22')](_0x18ce28));});};exports['outbound']=function(_0x64b75f,_0xf4a61b,_0x953cda,_0x99413b,_0x5263f5,_0x36ab94,_0x282ade){var _0x52ea85,_0x54443e,_0x259eb7,_0x52e56e;_0x36ab94[_0xce4a('0x52')]=intUtil[_0xce4a('0x51')](_0x36ab94['remoteUri']);_0x36ab94[_0xce4a('0x53')]=intUtil['stripTrailingSlash'](_0x36ab94['serverUrl']);def['uri']=util[_0xce4a('0x24')](_0xce4a('0x54'),_0x36ab94[_0xce4a('0x52')]);if(_0x282ade&&_0x282ade[_0xce4a('0x6a')]&&_0x282ade[_0xce4a('0x6a')]!==_0xce4a('0x6b')){logger[_0xce4a('0xb')](_0xce4a('0x6c'),_0xce4a('0x57'));_0xf4a61b[_0xce4a('0x5a')]=util[_0xce4a('0x24')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36ab94[_0xce4a('0x53')],_0xf4a61b[_0xce4a('0x59')],md5(_0xf4a61b['uniqueid']));}return getConnection(_0x36ab94)[_0xce4a('0x2d')](function(_0x567cef){_0x52e56e=_0x567cef;return getUser(_0x36ab94,_0x99413b[_0xce4a('0xd')],_0x52e56e);})[_0xce4a('0x2d')](function(_0x35f43e){_0x52ea85=_0x35f43e;logger[_0xce4a('0xb')]('The\x20User\x20ID\x20is:',_0x52ea85['id']);return getEndUser(_0x36ab94,_0xf4a61b[_0xce4a('0x6d')],_0xf4a61b[_0xce4a('0x6e')],_0x52e56e);})[_0xce4a('0x2d')](function(_0x426a38){_0x54443e=_0x426a38;logger[_0xce4a('0xb')](_0xce4a('0x5d'),_0x54443e['id']);return getTicket(_0x36ab94,_0x52ea85,_0x54443e,_0x953cda,_0xf4a61b,_0x953cda['Fields'],_0x52e56e,'Outbound');})[_0xce4a('0x2d')](function(_0x57576d){_0x259eb7=_0x57576d;logger[_0xce4a('0xb')]('Ticket\x20created!');logger[_0xce4a('0xb')](_0xce4a('0x6f'),_0x259eb7['id']);return setRelationship(_0x52e56e,_0x52ea85,_0x259eb7,_0xce4a('0x5f'));})['then'](function(){return setRelationship(_0x52e56e,_0x54443e,_0x259eb7,_0xce4a('0x60'));})[_0xce4a('0x2d')](function(){return getServerInfo(_0x52e56e);})[_0xce4a('0x2d')](function(_0x1ab04c){var _0x54d552=parseInt(_0x1ab04c[_0xce4a('0x61')][_0xce4a('0x62')](0x0));var _0x363e66=util[_0xce4a('0x24')](_0xce4a('0x63'),_0x36ab94[_0xce4a('0x52')],_0x259eb7['id']);if(_0x54d552>0x6){_0x363e66=util[_0xce4a('0x24')](_0xce4a('0x64'),_0x36ab94[_0xce4a('0x52')],_0x259eb7['id']);}logger[_0xce4a('0xb')](_0xce4a('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xce4a('0x24')]('user:%s',_0x99413b[_0xce4a('0xd')]),_0xce4a('0x67'),{'uri':_0x363e66});})['catch'](function(_0x5e471e){logger['error'](_0xce4a('0x6c'),JSON['stringify'](_0x5e471e));});};exports[_0xce4a('0x70')]=function(_0x55bcb2,_0x1034aa,_0x31bcbf,_0x49cd7f,_0x261eab,_0x5cbe57){var _0xfff027,_0x3b914f,_0x4f573e,_0x59a007;_0x5cbe57[_0xce4a('0x52')]=intUtil[_0xce4a('0x51')](_0x5cbe57[_0xce4a('0x52')]);_0x5cbe57[_0xce4a('0x53')]=intUtil[_0xce4a('0x51')](_0x5cbe57[_0xce4a('0x53')]);def[_0xce4a('0x71')]=util[_0xce4a('0x24')](_0xce4a('0x54'),_0x5cbe57[_0xce4a('0x52')]);if(_0x261eab&&_0x261eab[_0xce4a('0x55')]){logger[_0xce4a('0xb')]('['+_0x1034aa[_0xce4a('0x72')][_0xce4a('0x73')]()+']',_0xce4a('0x57'));_0x1034aa[_0xce4a('0x5a')]=util[_0xce4a('0x24')](_0xce4a('0x58'),_0x5cbe57['serverUrl'],_0x1034aa[_0xce4a('0x59')],md5(_0x1034aa[_0xce4a('0x59')]));}else{_0x1034aa[_0xce4a('0x5a')]='';}return getConnection(_0x5cbe57)[_0xce4a('0x2d')](function(_0x59fc73){_0x59a007=_0x59fc73;if(!_[_0xce4a('0x28')](_0x49cd7f)){return getUser(_0x5cbe57,_0x49cd7f[_0xce4a('0xd')],_0x59a007);}else{return getUser(_0x5cbe57,null,_0x59a007);}})[_0xce4a('0x2d')](function(_0xe3f7f3){_0xfff027=_0xe3f7f3;logger[_0xce4a('0xb')]('The\x20User\x20ID\x20is:',_0xfff027['id']);return getEndUser(_0x5cbe57,_0x1034aa[_0xce4a('0x74')],_0x1034aa[_0xce4a('0x5c')],_0x59a007);})[_0xce4a('0x2d')](function(_0x3fef2c){_0x3b914f=_0x3fef2c;logger[_0xce4a('0xb')](_0xce4a('0x5d'),_0x3b914f['id']);return getTicket(_0x5cbe57,_0xfff027,_0x3b914f,_0x31bcbf,_0x1034aa,_0x31bcbf[_0xce4a('0x5e')],_0x59a007,_0xce4a('0x75'));})['then'](function(_0x5b9b86){_0x4f573e=_0x5b9b86;logger[_0xce4a('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x4f573e['id']);return setRelationship(_0x59a007,_0xfff027,_0x4f573e,_0xce4a('0x5f'));})[_0xce4a('0x2d')](function(){return setRelationship(_0x59a007,_0x3b914f,_0x4f573e,_0xce4a('0x60'));})[_0xce4a('0x2d')](function(){return getServerInfo(_0x59a007);})['catch'](function(_0x2020cd){logger[_0xce4a('0x69')]('['+_0x1034aa[_0xce4a('0x72')][_0xce4a('0x73')]()+']',JSON['stringify'](_0x2020cd));});}; \ No newline at end of file +var _0x31ae=['toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','find','entry_list','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','merge','map','string','nameField','customField','toLowerCase','content','type','variableName','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','version','charAt','catch','unmanaged','lastevent','toUpperCase','calleridnum','Inbound','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','name','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','duration_hours','parent_id','parent_type','Contacts','parent_name','length','forEach','push','idField','JSON','stringify','format','Basic\x20%s','apiKey'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0x31ae,0xd3));var _0xe31a=function(_0x56f8d7,_0x334464){_0x56f8d7=_0x56f8d7-0x0;var _0x1b6aee=_0x31ae[_0x56f8d7];return _0x1b6aee;};'use strict';var _=require(_0xe31a('0x0'));var rp=require(_0xe31a('0x1'));var BPromise=require(_0xe31a('0x2'));var md5=require(_0xe31a('0x3'));var util=require('util');var Redis=require(_0xe31a('0x4'));var intUtil=require(_0xe31a('0x5'));var config=require(_0xe31a('0x6'));var logger=require(_0xe31a('0x7'))(_0xe31a('0x8'));config[_0xe31a('0x9')]=_[_0xe31a('0xa')](config[_0xe31a('0x9')],{'host':_0xe31a('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe31a('0x9')]));var def={'method':_0xe31a('0xc'),'json':!![]};function emit(_0x44d25e,_0x6b607b,_0x3d5145){io['to'](_0x44d25e)[_0xe31a('0xd')](_0x6b607b,_0x3d5145);}function getTicket(_0x380e3a,_0x52e9dd,_0x4ff99b,_0x37239d,_0x52af4f,_0x3bfd0d,_0x3ca9e2,_0x208649){logger[_0xe31a('0xe')]('Creating\x20new\x20ticket...');var _0x570328=new Date();var _0xc24c97=[{'name':_0xe31a('0xf'),'value':intUtil[_0xe31a('0x10')](_0x37239d['Subjects'],_0x52af4f,'\x20')},{'name':_0xe31a('0x11'),'value':_0x52e9dd['id']},{'name':_0xe31a('0x12'),'value':_0x52e9dd['id']},{'name':_0xe31a('0x13'),'value':intUtil[_0xe31a('0x10')](_0x37239d[_0xe31a('0x14')],_0x52af4f,'\x0a')},{'name':_0xe31a('0x15'),'value':_0x570328[_0xe31a('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xe31a('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xe31a('0x18'),'value':_0x4ff99b['id']},{'name':_0xe31a('0x19'),'value':_0xe31a('0x1a')},{'name':_0xe31a('0x1b'),'value':_0x4ff99b[_0xe31a('0xf')]},{'name':'direction','value':_0x208649}];if(_0x3bfd0d[_0xe31a('0x1c')]){_[_0xe31a('0x1d')](_0x3bfd0d,function(_0x11fb61){if(_0x52af4f[_0x11fb61['variableName']]){_0xc24c97[_0xe31a('0x1e')]({'name':_0x11fb61[_0xe31a('0x1f')],'value':_0x52af4f[_0x11fb61['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0xe31a('0x20'),'response_type':'JSON','rest_data':JSON[_0xe31a('0x21')]({'session':_0x3ca9e2['id'],'module_name':'Calls','name_value_list':_0xc24c97})}});}function getAuth(_0x1054d5){return util[_0xe31a('0x22')](_0xe31a('0x23'),new Buffer(_0x1054d5[_0xe31a('0x24')]+':X')[_0xe31a('0x25')](_0xe31a('0x26')));}function getServerInfo(_0x15c267){return request({'form':{'method':_0xe31a('0x27'),'input_type':_0xe31a('0x20'),'response_type':'JSON','rest_data':JSON[_0xe31a('0x21')]({'session':_0x15c267['id']})}});}function getUser(_0x5b2240,_0x2221aa,_0x48af88){if(!_[_0xe31a('0x28')](_0x2221aa)){logger[_0xe31a('0xe')](_0xe31a('0x29'),_0x2221aa);return request({'form':{'method':_0xe31a('0x2a'),'input_type':_0xe31a('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x48af88['id'],'module_name':_0xe31a('0x2b'),'query':util[_0xe31a('0x22')](_0xe31a('0x2c'),_0x2221aa),'order_by':'','offset':'0','select_fields':['id',_0xe31a('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe31a('0x2d')](function(_0x2f92a7){if(_0x2f92a7['entry_list']['length']){var _0x5110b1=_[_0xe31a('0x2e')](_0x2f92a7[_0xe31a('0x2f')],function(_0x348e0e){return _0x348e0e['name_value_list'][_0xe31a('0x30')][_0xe31a('0x31')]===_0x2221aa;});if(_0x5110b1){logger[_0xe31a('0xe')](_0xe31a('0x32'));return BPromise[_0xe31a('0x33')]({'id':_0x5110b1[_0xe31a('0x34')]['id'][_0xe31a('0x31')],'name':_0x5110b1['name_value_list'][_0xe31a('0xf')][_0xe31a('0x31')]});}}logger['info'](_0xe31a('0x35'));return BPromise['resolve']({'id':_0x48af88[_0xe31a('0x34')]['user_id'][_0xe31a('0x31')],'name':_0x48af88[_0xe31a('0x34')][_0xe31a('0x30')][_0xe31a('0x31')]});});}else{logger[_0xe31a('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xe31a('0x33')]({'id':_0x48af88[_0xe31a('0x34')][_0xe31a('0x36')][_0xe31a('0x31')],'name':_0x48af88['name_value_list'][_0xe31a('0x30')][_0xe31a('0x31')]});}}function getEndUser(_0x26970d,_0x5a6191,_0x3f21b8,_0x193772){logger['info'](_0xe31a('0x37'),_0x3f21b8);return request({'form':{'method':_0xe31a('0x2a'),'input_type':_0xe31a('0x20'),'response_type':_0xe31a('0x20'),'rest_data':JSON[_0xe31a('0x21')]({'session':_0x193772['id'],'module_name':_0xe31a('0x1a'),'query':util[_0xe31a('0x22')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3f21b8),'order_by':'','offset':'0','select_fields':['id','name',_0xe31a('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe31a('0x2d')](function(_0x113148){if(_0x113148['entry_list']['length']){var _0x125441=_[_0xe31a('0x2e')](_0x113148[_0xe31a('0x2f')],function(_0x3217f2){return _0x3217f2[_0xe31a('0x34')][_0xe31a('0x38')][_0xe31a('0x31')]===_0x3f21b8;});if(_0x125441){logger[_0xe31a('0xe')](_0xe31a('0x39'));return BPromise[_0xe31a('0x33')]({'id':_0x125441[_0xe31a('0x34')]['id']['value'],'name':_0x125441['name_value_list']['name'][_0xe31a('0x31')],'phone':_0x125441[_0xe31a('0x34')][_0xe31a('0x38')][_0xe31a('0x31')]});}}else{logger[_0xe31a('0xe')](_0xe31a('0x3a'));return request({'form':{'method':_0xe31a('0x3b'),'input_type':_0xe31a('0x20'),'response_type':_0xe31a('0x20'),'rest_data':JSON[_0xe31a('0x21')]({'session':_0x193772['id'],'module_name':_0xe31a('0x1a'),'name_value_list':[{'name':_0xe31a('0x3c'),'value':_0x5a6191!==''?_0x5a6191:util[_0xe31a('0x22')](_0xe31a('0x3d'),_0x3f21b8)},{'name':_0xe31a('0x38'),'value':_0x3f21b8}]})}})['then'](function(_0x98688){logger[_0xe31a('0xe')](_0xe31a('0x3e'));return BPromise[_0xe31a('0x33')]({'id':_0x98688['id'],'name':_0x98688[_0xe31a('0x2f')][_0xe31a('0x3c')]['value'],'phone':_0x98688[_0xe31a('0x2f')]['phone_home'][_0xe31a('0x31')]});});}});}function request(_0x21565c){logger['debug'](_0xe31a('0x3f'),JSON[_0xe31a('0x21')](_0x21565c));return rp(_[_0xe31a('0x40')](def,_0x21565c));}function getTags(_0x2083b7,_0x1b4d81){var _0x13106e=[];if(_0x2083b7&&_0x2083b7[_0xe31a('0x1c')]>0x0){_0x13106e=_[_0xe31a('0x41')](_0x2083b7,_0x1b4d81);}return _0x13106e;}function getCustomFields(_0x31787a,_0x39cc1d){var _0x32861d=[];var _0xa66e65={'custom_fields':[]};if(_0x31787a[_0xe31a('0x1c')]>0x0){_[_0xe31a('0x1d')](_0x31787a,function(_0x2522b0){if(_0x2522b0['type']===_0xe31a('0x42')&&_0x2522b0[_0xe31a('0x43')]&&!_0x2522b0[_0xe31a('0x44')]){_0xa66e65[_0x2522b0[_0xe31a('0x43')][_0xe31a('0x45')]()]=_0x2522b0[_0xe31a('0x46')][_0xe31a('0x25')]();}else if(_0x2522b0[_0xe31a('0x47')]===_0xe31a('0x42')&&_0x2522b0['idField']&&_0x2522b0['customField']){_0xa66e65['custom_fields'][_0xe31a('0x1e')]({'id':_0x2522b0['idField'],'value':_0x2522b0[_0xe31a('0x46')]['toString']()});}else if(_0x2522b0[_0xe31a('0x47')]==='variable'&&_0x2522b0[_0xe31a('0x48')]&&_0x2522b0[_0xe31a('0x1f')]&&_0x2522b0['customField']){_0x39cc1d[_0x2522b0[_0xe31a('0x48')]]&&_0xa66e65[_0xe31a('0x49')][_0xe31a('0x1e')]({'id':_0x2522b0['idField'],'value':_0x39cc1d[_0x2522b0[_0xe31a('0x48')]][_0xe31a('0x25')]()});}else if(_0x2522b0['type']===_0xe31a('0x4a')&&_0x2522b0[_0xe31a('0x4b')]&&_0x2522b0[_0xe31a('0x4b')][_0xe31a('0xf')]&&_0x2522b0[_0xe31a('0x1f')]&&_0x2522b0[_0xe31a('0x44')]){_0x39cc1d[_0x2522b0[_0xe31a('0x4b')][_0xe31a('0xf')][_0xe31a('0x45')]()]&&_0xa66e65[_0xe31a('0x49')][_0xe31a('0x1e')]({'id':_0x2522b0['idField'],'value':_0x39cc1d[_0x2522b0[_0xe31a('0x4b')]['name'][_0xe31a('0x45')]()][_0xe31a('0x25')]()});}});}return _0xa66e65;}function getConnection(_0x49daeb){return request({'method':_0xe31a('0xc'),'form':{'method':_0xe31a('0x4c'),'input_type':_0xe31a('0x20'),'response_type':_0xe31a('0x20'),'rest_data':JSON[_0xe31a('0x21')]({'user_auth':{'user_name':_0x49daeb[_0xe31a('0x4d')],'password':_0x49daeb[_0xe31a('0x4e')],'encryption':_0xe31a('0x4f')},'application':_0xe31a('0x50')})}})['then'](function(_0x14406b){var _0x33a1d0=_0x14406b;if(_0x33a1d0['id']){def['sessionID']=_0x33a1d0['id'];return BPromise[_0xe31a('0x33')](_0x33a1d0);}else{throw new Error(util[_0xe31a('0x22')](_0xe31a('0x51'),_0x49daeb['id']));}});}function setRelationship(_0x1ae063,_0x61a8c2,_0x17b336,_0x3d240b){return request({'form':{'method':_0xe31a('0x52'),'input_type':_0xe31a('0x20'),'response_type':_0xe31a('0x20'),'rest_data':JSON[_0xe31a('0x21')]({'session':_0x1ae063['id'],'module_name':_0xe31a('0x53'),'module_id':_0x17b336['id'],'link_field_name':_0x3d240b,'related_ids':[_0x61a8c2['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x4b4e7f,_0x4eb1dd,_0x2e86e2,_0x3073b0,_0x263aaa,_0x59f0a7){var _0x219e4f,_0x5e9da9,_0x1580e7,_0x19f5f0;_0x59f0a7['remoteUri']=intUtil['stripTrailingSlash'](_0x59f0a7[_0xe31a('0x54')]);_0x59f0a7['serverUrl']=intUtil[_0xe31a('0x55')](_0x59f0a7[_0xe31a('0x56')]);def[_0xe31a('0x57')]=util[_0xe31a('0x22')]('%s/service/v4_1/rest.php',_0x59f0a7[_0xe31a('0x54')]);if(_0x263aaa&&_0x263aaa[_0xe31a('0x58')]){logger[_0xe31a('0xe')](_0xe31a('0x59'),'Recording\x20is\x20enabled!');_0x4eb1dd[_0xe31a('0x5a')]=util[_0xe31a('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x59f0a7[_0xe31a('0x56')],_0x4eb1dd[_0xe31a('0x5b')],md5(_0x4eb1dd[_0xe31a('0x5b')]));}else{_0x4eb1dd[_0xe31a('0x5a')]='';}return getConnection(_0x59f0a7)['then'](function(_0x515fd6){_0x19f5f0=_0x515fd6;return getUser(_0x59f0a7,_0x3073b0[_0xe31a('0xf')],_0x19f5f0);})['then'](function(_0x46214){_0x219e4f=_0x46214;logger[_0xe31a('0xe')](_0xe31a('0x5c'),_0x219e4f['id']);return getEndUser(_0x59f0a7,_0x4eb1dd[_0xe31a('0x5d')],_0x4eb1dd['calleridnum'],_0x19f5f0);})[_0xe31a('0x2d')](function(_0x1bcb33){_0x5e9da9=_0x1bcb33;logger['info'](_0xe31a('0x5e'),_0x5e9da9['id']);return getTicket(_0x59f0a7,_0x219e4f,_0x5e9da9,_0x2e86e2,_0x4eb1dd,_0x2e86e2[_0xe31a('0x5f')],_0x19f5f0,'Inbound');})[_0xe31a('0x2d')](function(_0x38a7b9){_0x1580e7=_0x38a7b9;logger[_0xe31a('0xe')](_0xe31a('0x60'));logger[_0xe31a('0xe')](_0xe31a('0x61'),_0x1580e7['id']);return setRelationship(_0x19f5f0,_0x219e4f,_0x1580e7,_0xe31a('0x62'));})['then'](function(){return setRelationship(_0x19f5f0,_0x5e9da9,_0x1580e7,_0xe31a('0x63'));})['then'](function(){return getServerInfo(_0x19f5f0);})[_0xe31a('0x2d')](function(_0x5ab614){var _0x17fb85=parseInt(_0x5ab614['version']['charAt'](0x0));var _0x1fc692=util['format'](_0xe31a('0x64'),_0x59f0a7[_0xe31a('0x54')],_0x1580e7['id']);if(_0x17fb85>0x6){_0x1fc692=util[_0xe31a('0x22')](_0xe31a('0x65'),_0x59f0a7[_0xe31a('0x54')],_0x1580e7['id']);}logger[_0xe31a('0xe')](_0xe31a('0x59'),_0xe31a('0x66'));emit(util[_0xe31a('0x22')](_0xe31a('0x67'),_0x3073b0['name']),_0xe31a('0x68'),{'uri':_0x1fc692});})['catch'](function(_0x471fea){logger[_0xe31a('0x69')]('[QUEUE]',JSON[_0xe31a('0x21')](_0x471fea));});};exports[_0xe31a('0x6a')]=function(_0x5479ea,_0x1e9e1e,_0x4aa6f5,_0x19a771,_0x551f3f,_0x584973,_0x4502ae){var _0x40ac0d,_0xfee093,_0x3d5e99,_0x414cc7;_0x584973[_0xe31a('0x54')]=intUtil[_0xe31a('0x55')](_0x584973[_0xe31a('0x54')]);_0x584973[_0xe31a('0x56')]=intUtil['stripTrailingSlash'](_0x584973[_0xe31a('0x56')]);def[_0xe31a('0x57')]=util[_0xe31a('0x22')](_0xe31a('0x6b'),_0x584973[_0xe31a('0x54')]);if(_0x4502ae&&_0x4502ae[_0xe31a('0x6c')]&&_0x4502ae['recordingFormat']!==_0xe31a('0x6d')){logger[_0xe31a('0xe')](_0xe31a('0x6e'),_0xe31a('0x6f'));_0x1e9e1e[_0xe31a('0x5a')]=util[_0xe31a('0x22')](_0xe31a('0x70'),_0x584973['serverUrl'],_0x1e9e1e['uniqueid'],md5(_0x1e9e1e[_0xe31a('0x5b')]));}return getConnection(_0x584973)[_0xe31a('0x2d')](function(_0x18d523){_0x414cc7=_0x18d523;return getUser(_0x584973,_0x19a771['name'],_0x414cc7);})[_0xe31a('0x2d')](function(_0x31f8a2){_0x40ac0d=_0x31f8a2;logger[_0xe31a('0xe')](_0xe31a('0x5c'),_0x40ac0d['id']);return getEndUser(_0x584973,_0x1e9e1e[_0xe31a('0x71')],_0x1e9e1e[_0xe31a('0x72')],_0x414cc7);})[_0xe31a('0x2d')](function(_0x38ffc9){_0xfee093=_0x38ffc9;logger[_0xe31a('0xe')](_0xe31a('0x5e'),_0xfee093['id']);return getTicket(_0x584973,_0x40ac0d,_0xfee093,_0x4aa6f5,_0x1e9e1e,_0x4aa6f5[_0xe31a('0x5f')],_0x414cc7,_0xe31a('0x73'));})['then'](function(_0x2471d2){_0x3d5e99=_0x2471d2;logger[_0xe31a('0xe')](_0xe31a('0x60'));logger[_0xe31a('0xe')](_0xe31a('0x61'),_0x3d5e99['id']);return setRelationship(_0x414cc7,_0x40ac0d,_0x3d5e99,_0xe31a('0x62'));})[_0xe31a('0x2d')](function(){return setRelationship(_0x414cc7,_0xfee093,_0x3d5e99,_0xe31a('0x63'));})['then'](function(){return getServerInfo(_0x414cc7);})[_0xe31a('0x2d')](function(_0x320b62){var _0x2d9eb1=parseInt(_0x320b62[_0xe31a('0x74')][_0xe31a('0x75')](0x0));var _0x400bae=util[_0xe31a('0x22')](_0xe31a('0x64'),_0x584973[_0xe31a('0x54')],_0x3d5e99['id']);if(_0x2d9eb1>0x6){_0x400bae=util['format'](_0xe31a('0x65'),_0x584973[_0xe31a('0x54')],_0x3d5e99['id']);}logger[_0xe31a('0xe')](_0xe31a('0x6e'),_0xe31a('0x66'));emit(util[_0xe31a('0x22')](_0xe31a('0x67'),_0x19a771[_0xe31a('0xf')]),_0xe31a('0x68'),{'uri':_0x400bae});})[_0xe31a('0x76')](function(_0x6683f4){logger[_0xe31a('0x69')](_0xe31a('0x6e'),JSON[_0xe31a('0x21')](_0x6683f4));});};exports[_0xe31a('0x77')]=function(_0x29016e,_0x468f14,_0x191246,_0x1ac0bd,_0x56a925,_0x45a630){var _0x331e75,_0x5f06ac,_0x3a3472,_0x551444;_0x45a630[_0xe31a('0x54')]=intUtil[_0xe31a('0x55')](_0x45a630[_0xe31a('0x54')]);_0x45a630['serverUrl']=intUtil['stripTrailingSlash'](_0x45a630['serverUrl']);def[_0xe31a('0x57')]=util[_0xe31a('0x22')](_0xe31a('0x6b'),_0x45a630[_0xe31a('0x54')]);if(_0x56a925&&_0x56a925['monitor_format']){logger[_0xe31a('0xe')]('['+_0x468f14[_0xe31a('0x78')][_0xe31a('0x79')]()+']',_0xe31a('0x6f'));_0x468f14[_0xe31a('0x5a')]=util[_0xe31a('0x22')](_0xe31a('0x70'),_0x45a630[_0xe31a('0x56')],_0x468f14[_0xe31a('0x5b')],md5(_0x468f14[_0xe31a('0x5b')]));}else{_0x468f14['recordingURL']='';}return getConnection(_0x45a630)[_0xe31a('0x2d')](function(_0x82f234){_0x551444=_0x82f234;if(!_['isNil'](_0x1ac0bd)){return getUser(_0x45a630,_0x1ac0bd[_0xe31a('0xf')],_0x551444);}else{return getUser(_0x45a630,null,_0x551444);}})[_0xe31a('0x2d')](function(_0x371291){_0x331e75=_0x371291;logger[_0xe31a('0xe')](_0xe31a('0x5c'),_0x331e75['id']);return getEndUser(_0x45a630,_0x468f14['calleridname'],_0x468f14[_0xe31a('0x7a')],_0x551444);})[_0xe31a('0x2d')](function(_0xc56396){_0x5f06ac=_0xc56396;logger['info'](_0xe31a('0x5e'),_0x5f06ac['id']);return getTicket(_0x45a630,_0x331e75,_0x5f06ac,_0x191246,_0x468f14,_0x191246[_0xe31a('0x5f')],_0x551444,_0xe31a('0x7b'));})[_0xe31a('0x2d')](function(_0x3846ef){_0x3a3472=_0x3846ef;logger[_0xe31a('0xe')]('Ticket\x20created!');logger[_0xe31a('0xe')](_0xe31a('0x61'),_0x3a3472['id']);return setRelationship(_0x551444,_0x331e75,_0x3a3472,_0xe31a('0x62'));})[_0xe31a('0x2d')](function(){return setRelationship(_0x551444,_0x5f06ac,_0x3a3472,_0xe31a('0x63'));})[_0xe31a('0x2d')](function(){return getServerInfo(_0x551444);})['catch'](function(_0x576b82){logger[_0xe31a('0x69')]('['+_0x468f14[_0xe31a('0x78')]['toUpperCase']()+']',JSON[_0xe31a('0x21')](_0x576b82));});}; \ 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 82d05ce..4cba5f6 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 _0x3361=['Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','util','getString','length','type','string','push','content','variable','variableName','toString','customVariable'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x3361,0x11e));var _0x1336=function(_0x5c70f5,_0x52ff74){_0x5c70f5=_0x5c70f5-0x0;var _0x5065c0=_0x3361[_0x5c70f5];return _0x5065c0;};'use strict';var _=require('lodash');var util=require(_0x1336('0x0'));exports[_0x1336('0x1')]=function(_0x447f73,_0x1be27d,_0x46e709){var _0xce21b5=[];if(_0x447f73[_0x1336('0x2')]>0x0){var _0x4ca97c=_['sortBy'](_0x447f73,['id']);for(var _0x49cd4d=0x0;_0x49cd4d<_0x4ca97c[_0x1336('0x2')];_0x49cd4d++){var _0x20b90e=_0x4ca97c[_0x49cd4d];if(_0x20b90e[_0x1336('0x3')]===_0x1336('0x4')){_0xce21b5[_0x1336('0x5')](_0x20b90e[_0x1336('0x6')]);}else if(_0x20b90e[_0x1336('0x3')]===_0x1336('0x7')&&_0x20b90e[_0x1336('0x8')]){_0x1be27d[_0x20b90e[_0x1336('0x8')]]&&_0xce21b5[_0x1336('0x5')](_0x1be27d[_0x20b90e[_0x1336('0x8')]][_0x1336('0x9')]());}else if(_0x20b90e[_0x1336('0x3')]===_0x1336('0xa')&&_0x20b90e[_0x1336('0xb')]&&_0x20b90e[_0x1336('0xb')][_0x1336('0xc')]){_0x1be27d[_0x20b90e[_0x1336('0xb')][_0x1336('0xc')][_0x1336('0xd')]()]&&_0xce21b5[_0x1336('0x5')](_0x1be27d[_0x20b90e['Variable'][_0x1336('0xc')][_0x1336('0xd')]()][_0x1336('0x9')]());}else if(_0x20b90e['type']===_0x1336('0xe')){if(_0x20b90e[_0x1336('0xf')]==='string'&&_0x20b90e[_0x1336('0x10')]){_0xce21b5[_0x1336('0x5')](util[_0x1336('0x11')](_0x1336('0x12'),_0x20b90e['key'],_0x20b90e[_0x1336('0x13')]));}else if(_0x20b90e[_0x1336('0xf')]===_0x1336('0x7')&&_0x20b90e['variableName']&&_0x20b90e[_0x1336('0x10')]){_0x1be27d[_0x20b90e[_0x1336('0x8')]]&&_0xce21b5[_0x1336('0x5')](util[_0x1336('0x11')](_0x1336('0x12'),_0x20b90e['key'],_0x1be27d[_0x20b90e[_0x1336('0x8')]]));}else if(_0x20b90e['keyType']===_0x1336('0xa')&&_0x20b90e[_0x1336('0xb')]&&_0x20b90e[_0x1336('0xb')][_0x1336('0xc')]&&_0x20b90e[_0x1336('0x10')]){_0x1be27d[_0x20b90e['Variable'][_0x1336('0xc')][_0x1336('0xd')]()]&&_0xce21b5[_0x1336('0x5')](util['format']('%s:\x20%s',_0x20b90e[_0x1336('0x10')],_0x1be27d[_0x20b90e[_0x1336('0xb')]['name'][_0x1336('0xd')]()]));}}}}return _0xce21b5['join'](_0x46e709);};exports[_0x1336('0x14')]=function(_0x213941){var _0x5edfb1=_0x213941[_0x1336('0x15')](-0x1);if(_0x5edfb1==='/'){_0x213941=_0x213941[_0x1336('0x16')](0x0,_0x213941[_0x1336('0x17')](_0x5edfb1));}return _0x213941;};exports[_0x1336('0x18')]=function(_0x2abc93){if(!_[_0x1336('0x19')](_0x2abc93)&&_0x2abc93!==''){var _0x1cea6c=/^(([^<>()\[\]\\.,;:\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 _0x1cea6c[_0x1336('0x1a')](String(_0x2abc93)[_0x1336('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x110e=['toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','push','type','variable','variableName','toString','customVariable','Variable','name'];(function(_0x18d9e1,_0x1c2177){var _0x3cb35a=function(_0x255492){while(--_0x255492){_0x18d9e1['push'](_0x18d9e1['shift']());}};_0x3cb35a(++_0x1c2177);}(_0x110e,0x115));var _0xe110=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x110e[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xe110('0x0'));var util=require(_0xe110('0x1'));exports[_0xe110('0x2')]=function(_0x27b6da,_0x14e6c5,_0x2e4815){var _0x6623e3=[];if(_0x27b6da[_0xe110('0x3')]>0x0){var _0x4f2ce4=_[_0xe110('0x4')](_0x27b6da,['id']);for(var _0x20abdf=0x0;_0x20abdf<_0x4f2ce4[_0xe110('0x3')];_0x20abdf++){var _0x292b=_0x4f2ce4[_0x20abdf];if(_0x292b['type']==='string'){_0x6623e3[_0xe110('0x5')](_0x292b['content']);}else if(_0x292b[_0xe110('0x6')]===_0xe110('0x7')&&_0x292b[_0xe110('0x8')]){_0x14e6c5[_0x292b[_0xe110('0x8')]]&&_0x6623e3[_0xe110('0x5')](_0x14e6c5[_0x292b[_0xe110('0x8')]][_0xe110('0x9')]());}else if(_0x292b['type']===_0xe110('0xa')&&_0x292b['Variable']&&_0x292b[_0xe110('0xb')][_0xe110('0xc')]){_0x14e6c5[_0x292b[_0xe110('0xb')][_0xe110('0xc')][_0xe110('0xd')]()]&&_0x6623e3['push'](_0x14e6c5[_0x292b[_0xe110('0xb')][_0xe110('0xc')][_0xe110('0xd')]()][_0xe110('0x9')]());}else if(_0x292b[_0xe110('0x6')]===_0xe110('0xe')){if(_0x292b[_0xe110('0xf')]===_0xe110('0x10')&&_0x292b[_0xe110('0x11')]){_0x6623e3[_0xe110('0x5')](util[_0xe110('0x12')](_0xe110('0x13'),_0x292b['key'],_0x292b[_0xe110('0x14')]));}else if(_0x292b[_0xe110('0xf')]===_0xe110('0x7')&&_0x292b[_0xe110('0x8')]&&_0x292b[_0xe110('0x11')]){_0x14e6c5[_0x292b[_0xe110('0x8')]]&&_0x6623e3[_0xe110('0x5')](util['format'](_0xe110('0x13'),_0x292b[_0xe110('0x11')],_0x14e6c5[_0x292b[_0xe110('0x8')]]));}else if(_0x292b['keyType']===_0xe110('0xa')&&_0x292b[_0xe110('0xb')]&&_0x292b['Variable'][_0xe110('0xc')]&&_0x292b[_0xe110('0x11')]){_0x14e6c5[_0x292b[_0xe110('0xb')]['name'][_0xe110('0xd')]()]&&_0x6623e3['push'](util[_0xe110('0x12')]('%s:\x20%s',_0x292b[_0xe110('0x11')],_0x14e6c5[_0x292b[_0xe110('0xb')]['name'][_0xe110('0xd')]()]));}}}}return _0x6623e3[_0xe110('0x15')](_0x2e4815);};exports[_0xe110('0x16')]=function(_0x56a59b){var _0x4ded9f=_0x56a59b[_0xe110('0x17')](-0x1);if(_0x4ded9f==='/'){_0x56a59b=_0x56a59b[_0xe110('0x18')](0x0,_0x56a59b[_0xe110('0x19')](_0x4ded9f));}return _0x56a59b;};exports[_0xe110('0x1a')]=function(_0x31213c){if(!_[_0xe110('0x1b')](_0x31213c)&&_0x31213c!==''){var _0x34a6d3=/^(([^<>()\[\]\\.,;:\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 _0x34a6d3[_0xe110('0x1c')](String(_0x31213c)[_0xe110('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 c197668..fbb2732 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(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x33af0d,_0x1a4042){var _0x2a5307=function(_0x759c0e){while(--_0x759c0e){_0x33af0d['push'](_0x33af0d['shift']());}};_0x2a5307(++_0x1a4042);}(_0x34e8,0x12c));var _0x834e=function(_0x166096,_0x1cc292){_0x166096=_0x166096-0x0;var _0x1e631c=_0x34e8[_0x166096];return _0x1e631c;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ 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 a341a4e..076f1a6 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 _0xa1c5=['ioredis','./util','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','toString','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','custom_fields','name','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','util'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0xa1c5,0x1b4));var _0x5a1c=function(_0x230a5a,_0x4c69c5){_0x230a5a=_0x230a5a-0x0;var _0x37a794=_0xa1c5[_0x230a5a];return _0x37a794;};'use strict';var _=require(_0x5a1c('0x0'));var rp=require(_0x5a1c('0x1'));var md5=require(_0x5a1c('0x2'));var util=require(_0x5a1c('0x3'));var Redis=require(_0x5a1c('0x4'));var intUtil=require(_0x5a1c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5a1c('0x6'))(_0x5a1c('0x7'));config[_0x5a1c('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5a1c('0x9'))(new Redis(config[_0x5a1c('0x8')]));function emit(_0x4e4431,_0x5c041d,_0x2bdc74){io['to'](_0x4e4431)[_0x5a1c('0xa')](_0x5c041d,_0x2bdc74);}var headers={'Content-Type':'application/json','Accept':_0x5a1c('0xb')};function getTicket(_0x5d798e,_0x4ee2ac,_0x562615,_0x4e9e7e,_0x5092fb){logger[_0x5a1c('0xc')](_0x5a1c('0xd'));return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0xf'),_0x5d798e[_0x5a1c('0x10')]),'method':_0x5a1c('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x562615['id'],'submitter_id':_0x4ee2ac?_0x4ee2ac['id']:undefined,'assignee_id':_0x4ee2ac?_0x4ee2ac['id']:undefined,'tags':getTags(_0x4e9e7e['Tags'],'name'),'subject':intUtil[_0x5a1c('0x12')](_0x4e9e7e[_0x5a1c('0x13')],_0x5092fb,'\x20'),'description':intUtil['getString'](_0x4e9e7e[_0x5a1c('0x14')],_0x5092fb,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5a1c('0x12')](_0x4e9e7e[_0x5a1c('0x14')],_0x5092fb,'\x0a')}},getCustomFields(_0x4e9e7e[_0x5a1c('0x15')],_0x5092fb))}})[_0x5a1c('0x16')](function(_0xcdd151){logger[_0x5a1c('0xc')](_0x5a1c('0x17'));return _0xcdd151[_0x5a1c('0x18')];});}function getUser(_0x16644f,_0x3c5dae){if(intUtil[_0x5a1c('0x19')](_0x3c5dae)){logger[_0x5a1c('0xc')](_0x5a1c('0x1a'),_0x3c5dae);return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0x1b'),_0x16644f[_0x5a1c('0x10')]),'qs':{'query':util[_0x5a1c('0xe')](_0x5a1c('0x1c'),_0x3c5dae)}})[_0x5a1c('0x16')](function(_0x1f3913){if(_0x1f3913[_0x5a1c('0x1d')]){logger[_0x5a1c('0xc')]('Agent\x20found!');return _[_0x5a1c('0x1e')](_0x1f3913[_0x5a1c('0x1f')],{'email':_0x3c5dae,'role':_0x5a1c('0x20')});}else{logger[_0x5a1c('0xc')](_0x5a1c('0x21'));return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0x22'),_0x16644f[_0x5a1c('0x10')])})['then'](function(_0x1d1d6c){logger['info'](_0x5a1c('0x23'));return _0x1d1d6c[_0x5a1c('0x24')];});}});}else{logger[_0x5a1c('0xc')](_0x5a1c('0x21'));return request({'uri':util['format'](_0x5a1c('0x22'),_0x16644f[_0x5a1c('0x10')])})[_0x5a1c('0x16')](function(_0x380db7){logger['info'](_0x5a1c('0x23'));return _0x380db7[_0x5a1c('0x24')];});}}function getEndUser(_0x4ecb13,_0x37aa65,_0x43e2fa){logger[_0x5a1c('0xc')](_0x5a1c('0x25'),_0x43e2fa);return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0x1b'),_0x4ecb13[_0x5a1c('0x10')]),'qs':{'query':util[_0x5a1c('0xe')](_0x5a1c('0x26'),_0x43e2fa)}})[_0x5a1c('0x16')](function(_0x3275d2){var _0x824743;if(_0x3275d2[_0x5a1c('0x1f')][_0x5a1c('0x27')]){_0x3275d2[_0x5a1c('0x1f')]=_['filter'](_0x3275d2[_0x5a1c('0x1f')],{'suspended':![],'role':_0x5a1c('0x28')});if(_0x3275d2[_0x5a1c('0x1f')][_0x5a1c('0x27')]){_0x824743=_[_0x5a1c('0x29')](_0x3275d2[_0x5a1c('0x1f')]);}}if(_0x824743){logger[_0x5a1c('0xc')](_0x5a1c('0x2a'));return _0x824743;}else{logger[_0x5a1c('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0x2b'),_0x4ecb13[_0x5a1c('0x10')]),'method':_0x5a1c('0x11'),'body':{'user':{'role':_0x5a1c('0x28'),'name':util['format'](_0x5a1c('0x2c'),_0x37aa65||_0x43e2fa),'phone':_0x43e2fa}}})['then'](function(_0x95dc61){logger[_0x5a1c('0xc')](_0x5a1c('0x2d'));return _0x95dc61[_0x5a1c('0x24')];});}});}function getAuth(_0x42372d){var _0x1d9507;if(_0x42372d[_0x5a1c('0x2e')]===_0x5a1c('0x2f')){_0x1d9507=util[_0x5a1c('0xe')](_0x5a1c('0x30'),_0x42372d[_0x5a1c('0x31')],_0x42372d[_0x5a1c('0x2f')]);}else if(_0x42372d[_0x5a1c('0x2e')]===_0x5a1c('0x32')){_0x1d9507=util[_0x5a1c('0xe')]('%s/token:%s',_0x42372d[_0x5a1c('0x31')],_0x42372d['token']);}return util['format']('Basic\x20%s',new Buffer(_0x1d9507)[_0x5a1c('0x33')]('base64'));}function request(_0x342b10){logger[_0x5a1c('0x34')](_0x5a1c('0x35'),JSON[_0x5a1c('0x36')](_0x342b10));return rp(_[_0x5a1c('0x37')](_0x342b10,{'method':_0x5a1c('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x552687,_0x5710a6){var _0x4012c0=[];if(_0x552687&&_0x552687[_0x5a1c('0x27')]>0x0){_0x4012c0=_[_0x5a1c('0x39')](_0x552687,_0x5710a6);}return _0x4012c0;}function getCustomFields(_0x1651c8,_0x5d8d2c){var _0x5dfcf6=[];var _0x26fece={'custom_fields':[]};if(_0x1651c8[_0x5a1c('0x27')]>0x0){_[_0x5a1c('0x3a')](_0x1651c8,function(_0x1bbb7b){if(_[_0x5a1c('0x3b')]([_0x5a1c('0x3c'),_0x5a1c('0x3d')],_0x1bbb7b[_0x5a1c('0x3e')])&&_0x1bbb7b[_0x5a1c('0x3f')]&&!_0x1bbb7b[_0x5a1c('0x40')]){_0x26fece[_0x1bbb7b[_0x5a1c('0x3f')][_0x5a1c('0x41')]()]=_0x1bbb7b[_0x5a1c('0x42')][_0x5a1c('0x33')]();}else if(_['includes']([_0x5a1c('0x3c'),_0x5a1c('0x3d')],_0x1bbb7b[_0x5a1c('0x3e')])&&_0x1bbb7b[_0x5a1c('0x43')]&&_0x1bbb7b[_0x5a1c('0x40')]){_0x26fece['custom_fields'][_0x5a1c('0x44')]({'id':_0x1bbb7b[_0x5a1c('0x43')],'value':_0x1bbb7b[_0x5a1c('0x42')][_0x5a1c('0x33')]()});}else if(_0x1bbb7b[_0x5a1c('0x3e')]==='variable'&&_0x1bbb7b[_0x5a1c('0x45')]&&_0x1bbb7b[_0x5a1c('0x43')]&&_0x1bbb7b[_0x5a1c('0x40')]){_0x5d8d2c[_0x1bbb7b[_0x5a1c('0x45')]]&&_0x26fece[_0x5a1c('0x46')][_0x5a1c('0x44')]({'id':_0x1bbb7b[_0x5a1c('0x43')],'value':_0x5d8d2c[_0x1bbb7b[_0x5a1c('0x45')]][_0x5a1c('0x33')]()});}else if(_0x1bbb7b[_0x5a1c('0x3e')]==='customVariable'&&_0x1bbb7b['Variable']&&_0x1bbb7b['Variable'][_0x5a1c('0x47')]&&_0x1bbb7b['idField']&&_0x1bbb7b['customField']){_0x5d8d2c[_0x1bbb7b[_0x5a1c('0x48')][_0x5a1c('0x47')]['toLowerCase']()]&&_0x26fece[_0x5a1c('0x46')]['push']({'id':_0x1bbb7b[_0x5a1c('0x43')],'value':_0x5d8d2c[_0x1bbb7b['Variable'][_0x5a1c('0x47')][_0x5a1c('0x41')]()][_0x5a1c('0x33')]()});}});}return _0x26fece;}exports[_0x5a1c('0x49')]=function(_0x550c37,_0x17cbe9,_0x533dea,_0x595680,_0x5b12a9,_0x30942f){var _0x2c71c2,_0x544b23;_0x30942f[_0x5a1c('0x10')]=intUtil['stripTrailingSlash'](_0x30942f['remoteUri']);_0x30942f[_0x5a1c('0x4a')]=intUtil[_0x5a1c('0x4b')](_0x30942f['serverUrl']);if(_0x5b12a9&&_0x5b12a9[_0x5a1c('0x4c')]){logger[_0x5a1c('0xc')](_0x5a1c('0x4d'),_0x5a1c('0x4e'));_0x17cbe9['recordingURL']=util[_0x5a1c('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30942f[_0x5a1c('0x4a')],_0x17cbe9[_0x5a1c('0x4f')],md5(_0x17cbe9[_0x5a1c('0x4f')]));}else{_0x17cbe9[_0x5a1c('0x50')]='';}headers[_0x5a1c('0x51')]=getAuth(_0x30942f);return getUser(_0x30942f,_0x595680[_0x5a1c('0x52')])[_0x5a1c('0x16')](function(_0x5ecaab){_0x2c71c2=_0x5ecaab;logger[_0x5a1c('0xc')](_0x5a1c('0x53'),_0x2c71c2['id']);return getEndUser(_0x30942f,_0x17cbe9[_0x5a1c('0x54')],_0x17cbe9[_0x5a1c('0x55')]);})['then'](function(_0x4d5c59){_0x544b23=_0x4d5c59;logger[_0x5a1c('0xc')](_0x5a1c('0x56'),_0x544b23['id']);return getTicket(_0x30942f,_0x2c71c2,_0x544b23,_0x533dea,_0x17cbe9);})[_0x5a1c('0x16')](function(_0x58f44f){if(_0x58f44f){logger['info']('The\x20Ticket\x20ID\x20is:',_0x58f44f['id']);switch(_0x30942f[_0x5a1c('0x3e')]){case _0x5a1c('0x57'):logger[_0x5a1c('0xc')](_0x5a1c('0x4d'),_0x5a1c('0x58'));return request({'uri':util[_0x5a1c('0xe')](_0x5a1c('0x59'),_0x30942f[_0x5a1c('0x10')],_0x2c71c2['id'],_0x58f44f['id']),'method':_0x5a1c('0x11')});case _0x5a1c('0x5a'):logger[_0x5a1c('0xc')](_0x5a1c('0x4d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5a1c('0xe')](_0x5a1c('0x5b'),_0x595680[_0x5a1c('0x47')]),_0x5a1c('0x5c'),{'uri':util['format']('%s/agent/tickets/%s',_0x30942f['remoteUri'][_0x5a1c('0x5d')](_0x5a1c('0x5e'),''),_0x58f44f['id'])});break;default:logger[_0x5a1c('0x5f')](_0x5a1c('0x4d'),_0x5a1c('0x60'));}}})[_0x5a1c('0x61')](function(_0x585c6b){logger[_0x5a1c('0x5f')](_0x5a1c('0x62'),util[_0x5a1c('0x63')](_0x585c6b,{'showHidden':!![],'depth':null}));});};exports[_0x5a1c('0x64')]=function(_0x4ecd6d,_0x2d96d9,_0xd1b2a5,_0x54c284,_0x4cd77f,_0x1ff5c6,_0x4f1939){var _0x150c39,_0x3dafe6;_0x1ff5c6[_0x5a1c('0x10')]=intUtil['stripTrailingSlash'](_0x1ff5c6[_0x5a1c('0x10')]);_0x1ff5c6[_0x5a1c('0x4a')]=intUtil[_0x5a1c('0x4b')](_0x1ff5c6['serverUrl']);if(_0x4f1939&&_0x4f1939['recordingFormat']&&_0x4f1939['recordingFormat']!==_0x5a1c('0x65')){logger[_0x5a1c('0xc')](_0x5a1c('0x66'),_0x5a1c('0x4e'));_0x2d96d9['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1ff5c6[_0x5a1c('0x4a')],_0x2d96d9[_0x5a1c('0x4f')],md5(_0x2d96d9[_0x5a1c('0x4f')]));}headers[_0x5a1c('0x51')]=getAuth(_0x1ff5c6);return getUser(_0x1ff5c6,_0x54c284['email'])[_0x5a1c('0x16')](function(_0xe029c){_0x150c39=_0xe029c;logger[_0x5a1c('0xc')](_0x5a1c('0x53'),_0x150c39['id']);return getEndUser(_0x1ff5c6,_0x2d96d9[_0x5a1c('0x67')],_0x2d96d9[_0x5a1c('0x68')]);})['then'](function(_0x280bf5){_0x3dafe6=_0x280bf5;logger[_0x5a1c('0xc')](_0x5a1c('0x56'),_0x3dafe6['id']);return getTicket(_0x1ff5c6,_0x150c39,_0x3dafe6,_0xd1b2a5,_0x2d96d9);})['then'](function(_0x51495d){if(_0x51495d){logger[_0x5a1c('0xc')](_0x5a1c('0x69'),_0x51495d['id']);switch(_0x1ff5c6['type']){case'integrationTab':logger['info'](_0x5a1c('0x66'),_0x5a1c('0x58'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1ff5c6['remoteUri'],_0x150c39['id'],_0x51495d['id']),'method':_0x5a1c('0x11')});case _0x5a1c('0x5a'):logger[_0x5a1c('0xc')](_0x5a1c('0x66'),_0x5a1c('0x6a'));emit(util[_0x5a1c('0xe')](_0x5a1c('0x5b'),_0x54c284['name']),_0x5a1c('0x5c'),{'uri':util['format']('%s/agent/tickets/%s',_0x1ff5c6[_0x5a1c('0x10')]['replace'](_0x5a1c('0x5e'),''),_0x51495d['id'])});break;default:logger[_0x5a1c('0x5f')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x1e76b5){logger[_0x5a1c('0x5f')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x5a1c('0x63')](_0x1e76b5,{'showHidden':!![],'depth':null}));});};exports[_0x5a1c('0x6b')]=function(_0x3b4fd7,_0x120c0e,_0x56f340,_0x407e01,_0x1512da,_0x211918){var _0x4db43e,_0x224681;_0x211918[_0x5a1c('0x10')]=intUtil['stripTrailingSlash'](_0x211918[_0x5a1c('0x10')]);_0x211918[_0x5a1c('0x4a')]=intUtil[_0x5a1c('0x4b')](_0x211918['serverUrl']);if(_0x1512da&&_0x1512da[_0x5a1c('0x4c')]){logger[_0x5a1c('0xc')]('['+_0x120c0e['lastevent'][_0x5a1c('0x6c')]()+']','Recording\x20is\x20enabled!');_0x120c0e[_0x5a1c('0x50')]=util[_0x5a1c('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x211918[_0x5a1c('0x4a')],_0x120c0e[_0x5a1c('0x4f')],md5(_0x120c0e['uniqueid']));}else{_0x120c0e[_0x5a1c('0x50')]='';}headers[_0x5a1c('0x51')]=getAuth(_0x211918);return getUser(_0x211918)['then'](function(_0x2a0e54){_0x4db43e=_0x2a0e54;logger[_0x5a1c('0xc')](_0x5a1c('0x53'),_0x4db43e['id']);return getEndUser(_0x211918,_0x120c0e[_0x5a1c('0x54')],_0x120c0e[_0x5a1c('0x55')]);})[_0x5a1c('0x16')](function(_0x21b9ce){_0x224681=_0x21b9ce;logger[_0x5a1c('0xc')](_0x5a1c('0x56'),_0x224681['id']);return getTicket(_0x211918,_0x4db43e,_0x224681,_0x56f340,_0x120c0e);})['then'](function(_0x1bdb1d){if(_0x1bdb1d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x1bdb1d['id']);}})[_0x5a1c('0x61')](function(_0x1b15cc){logger['error']('['+_0x120c0e[_0x5a1c('0x6d')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x5a1c('0x63')](_0x1b15cc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x67c8=['Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','results','length','end-user','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','toString','idField','push','variable','variableName','customVariable','Variable','custom_fields','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:','calleridname','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','trigger:browser:url','replace','/api/v2','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','defaults','localhost','socket.io-emitter','application/json','info','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x67c8,0x138));var _0x867c=function(_0x366a58,_0x4b93d1){_0x366a58=_0x366a58-0x0;var _0x315e43=_0x67c8[_0x366a58];return _0x315e43;};'use strict';var _=require(_0x867c('0x0'));var rp=require(_0x867c('0x1'));var md5=require(_0x867c('0x2'));var util=require(_0x867c('0x3'));var Redis=require(_0x867c('0x4'));var intUtil=require(_0x867c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x867c('0x6'))('zendesk');config['redis']=_[_0x867c('0x7')](config['redis'],{'host':_0x867c('0x8'),'port':0x18eb});var io=require(_0x867c('0x9'))(new Redis(config['redis']));function emit(_0x5a5522,_0x3c6cbc,_0xc6350c){io['to'](_0x5a5522)['emit'](_0x3c6cbc,_0xc6350c);}var headers={'Content-Type':_0x867c('0xa'),'Accept':'application/json'};function getTicket(_0x11d8cd,_0x6850cf,_0x3106b7,_0xc5b135,_0x4353f1){logger[_0x867c('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0x867c('0xc'),_0x11d8cd[_0x867c('0xd')]),'method':_0x867c('0xe'),'body':{'ticket':_[_0x867c('0xf')]({'requester_id':_0x3106b7['id'],'submitter_id':_0x6850cf?_0x6850cf['id']:undefined,'assignee_id':_0x6850cf?_0x6850cf['id']:undefined,'tags':getTags(_0xc5b135[_0x867c('0x10')],_0x867c('0x11')),'subject':intUtil[_0x867c('0x12')](_0xc5b135[_0x867c('0x13')],_0x4353f1,'\x20'),'description':intUtil['getString'](_0xc5b135['Descriptions'],_0x4353f1,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0xc5b135[_0x867c('0x14')],_0x4353f1,'\x0a')}},getCustomFields(_0xc5b135[_0x867c('0x15')],_0x4353f1))}})[_0x867c('0x16')](function(_0x39dc50){logger[_0x867c('0xb')](_0x867c('0x17'));return _0x39dc50[_0x867c('0x18')];});}function getUser(_0x510629,_0x225d45){if(intUtil[_0x867c('0x19')](_0x225d45)){logger[_0x867c('0xb')](_0x867c('0x1a'),_0x225d45);return request({'uri':util['format']('%s/search.json',_0x510629['remoteUri']),'qs':{'query':util[_0x867c('0x1b')](_0x867c('0x1c'),_0x225d45)}})[_0x867c('0x16')](function(_0x30c7ac){if(_0x30c7ac[_0x867c('0x1d')]){logger[_0x867c('0xb')](_0x867c('0x1e'));return _[_0x867c('0x1f')](_0x30c7ac['results'],{'email':_0x225d45,'role':_0x867c('0x20')});}else{logger[_0x867c('0xb')](_0x867c('0x21'));return request({'uri':util['format'](_0x867c('0x22'),_0x510629[_0x867c('0xd')])})[_0x867c('0x16')](function(_0x502bd2){logger['info'](_0x867c('0x23'));return _0x502bd2[_0x867c('0x24')];});}});}else{logger[_0x867c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x867c('0x1b')](_0x867c('0x22'),_0x510629[_0x867c('0xd')])})[_0x867c('0x16')](function(_0x2913d7){logger[_0x867c('0xb')]('Admin\x20account\x20selected.');return _0x2913d7[_0x867c('0x24')];});}}function getEndUser(_0x535ad4,_0x540faa,_0x3e2b1d){logger[_0x867c('0xb')](_0x867c('0x25'),_0x3e2b1d);return request({'uri':util[_0x867c('0x1b')]('%s/search.json',_0x535ad4['remoteUri']),'qs':{'query':util[_0x867c('0x1b')]('type:user\x20role:end-user\x20phone:%s',_0x3e2b1d)}})[_0x867c('0x16')](function(_0x3833e2){var _0x3ec8db;if(_0x3833e2[_0x867c('0x26')][_0x867c('0x27')]){_0x3833e2[_0x867c('0x26')]=_['filter'](_0x3833e2[_0x867c('0x26')],{'suspended':![],'role':_0x867c('0x28')});if(_0x3833e2[_0x867c('0x26')][_0x867c('0x27')]){_0x3ec8db=_['first'](_0x3833e2['results']);}}if(_0x3ec8db){logger[_0x867c('0xb')]('Enduser\x20found!');return _0x3ec8db;}else{logger[_0x867c('0xb')](_0x867c('0x29'));return request({'uri':util[_0x867c('0x1b')](_0x867c('0x2a'),_0x535ad4['remoteUri']),'method':_0x867c('0xe'),'body':{'user':{'role':_0x867c('0x28'),'name':util[_0x867c('0x1b')](_0x867c('0x2b'),_0x540faa||_0x3e2b1d),'phone':_0x3e2b1d}}})[_0x867c('0x16')](function(_0x1e320e){logger[_0x867c('0xb')](_0x867c('0x2c'));return _0x1e320e[_0x867c('0x24')];});}});}function getAuth(_0x548d9c){var _0x22e79a;if(_0x548d9c[_0x867c('0x2d')]===_0x867c('0x2e')){_0x22e79a=util[_0x867c('0x1b')](_0x867c('0x2f'),_0x548d9c[_0x867c('0x30')],_0x548d9c['password']);}else if(_0x548d9c[_0x867c('0x2d')]===_0x867c('0x31')){_0x22e79a=util[_0x867c('0x1b')](_0x867c('0x32'),_0x548d9c[_0x867c('0x30')],_0x548d9c[_0x867c('0x31')]);}return util[_0x867c('0x1b')](_0x867c('0x33'),new Buffer(_0x22e79a)['toString']('base64'));}function request(_0x51d1da){logger[_0x867c('0x34')](_0x867c('0x35'),JSON[_0x867c('0x36')](_0x51d1da));return rp(_[_0x867c('0x7')](_0x51d1da,{'method':_0x867c('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x24d943,_0x4e6188){var _0x5cfef1=[];if(_0x24d943&&_0x24d943['length']>0x0){_0x5cfef1=_[_0x867c('0x38')](_0x24d943,_0x4e6188);}return _0x5cfef1;}function getCustomFields(_0x56f558,_0x35809e){var _0x3bcb03=[];var _0x3ec5f2={'custom_fields':[]};if(_0x56f558[_0x867c('0x27')]>0x0){_[_0x867c('0x39')](_0x56f558,function(_0x30c258){if(_[_0x867c('0x3a')]([_0x867c('0x3b'),_0x867c('0x3c')],_0x30c258[_0x867c('0x3d')])&&_0x30c258[_0x867c('0x3e')]&&!_0x30c258[_0x867c('0x3f')]){_0x3ec5f2[_0x30c258[_0x867c('0x3e')][_0x867c('0x40')]()]=_0x30c258['content'][_0x867c('0x41')]();}else if(_[_0x867c('0x3a')]([_0x867c('0x3b'),_0x867c('0x3c')],_0x30c258[_0x867c('0x3d')])&&_0x30c258[_0x867c('0x42')]&&_0x30c258[_0x867c('0x3f')]){_0x3ec5f2['custom_fields'][_0x867c('0x43')]({'id':_0x30c258[_0x867c('0x42')],'value':_0x30c258['content'][_0x867c('0x41')]()});}else if(_0x30c258[_0x867c('0x3d')]===_0x867c('0x44')&&_0x30c258['variableName']&&_0x30c258[_0x867c('0x42')]&&_0x30c258[_0x867c('0x3f')]){_0x35809e[_0x30c258[_0x867c('0x45')]]&&_0x3ec5f2['custom_fields'][_0x867c('0x43')]({'id':_0x30c258[_0x867c('0x42')],'value':_0x35809e[_0x30c258[_0x867c('0x45')]][_0x867c('0x41')]()});}else if(_0x30c258[_0x867c('0x3d')]===_0x867c('0x46')&&_0x30c258[_0x867c('0x47')]&&_0x30c258['Variable'][_0x867c('0x11')]&&_0x30c258[_0x867c('0x42')]&&_0x30c258[_0x867c('0x3f')]){_0x35809e[_0x30c258[_0x867c('0x47')][_0x867c('0x11')]['toLowerCase']()]&&_0x3ec5f2[_0x867c('0x48')][_0x867c('0x43')]({'id':_0x30c258[_0x867c('0x42')],'value':_0x35809e[_0x30c258['Variable']['name'][_0x867c('0x40')]()][_0x867c('0x41')]()});}});}return _0x3ec5f2;}exports[_0x867c('0x49')]=function(_0x55631f,_0x1926f6,_0x3ef08f,_0x21eb42,_0x1df797,_0x3c5068){var _0x5b9b88,_0x58707b;_0x3c5068[_0x867c('0xd')]=intUtil[_0x867c('0x4a')](_0x3c5068['remoteUri']);_0x3c5068[_0x867c('0x4b')]=intUtil[_0x867c('0x4a')](_0x3c5068[_0x867c('0x4b')]);if(_0x1df797&&_0x1df797[_0x867c('0x4c')]){logger['info'](_0x867c('0x4d'),_0x867c('0x4e'));_0x1926f6['recordingURL']=util[_0x867c('0x1b')](_0x867c('0x4f'),_0x3c5068[_0x867c('0x4b')],_0x1926f6[_0x867c('0x50')],md5(_0x1926f6[_0x867c('0x50')]));}else{_0x1926f6[_0x867c('0x51')]='';}headers[_0x867c('0x52')]=getAuth(_0x3c5068);return getUser(_0x3c5068,_0x21eb42[_0x867c('0x53')])[_0x867c('0x16')](function(_0x4bc60e){_0x5b9b88=_0x4bc60e;logger[_0x867c('0xb')](_0x867c('0x54'),_0x5b9b88['id']);return getEndUser(_0x3c5068,_0x1926f6[_0x867c('0x55')],_0x1926f6['calleridnum']);})['then'](function(_0x85d49b){_0x58707b=_0x85d49b;logger[_0x867c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x58707b['id']);return getTicket(_0x3c5068,_0x5b9b88,_0x58707b,_0x3ef08f,_0x1926f6);})[_0x867c('0x16')](function(_0x2af1c5){if(_0x2af1c5){logger[_0x867c('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2af1c5['id']);switch(_0x3c5068[_0x867c('0x3d')]){case _0x867c('0x56'):logger['info'](_0x867c('0x4d'),_0x867c('0x57'));return request({'uri':util[_0x867c('0x1b')](_0x867c('0x58'),_0x3c5068[_0x867c('0xd')],_0x5b9b88['id'],_0x2af1c5['id']),'method':_0x867c('0xe')});case _0x867c('0x59'):logger[_0x867c('0xb')](_0x867c('0x4d'),_0x867c('0x5a'));emit(util['format'](_0x867c('0x5b'),_0x21eb42[_0x867c('0x11')]),_0x867c('0x5c'),{'uri':util[_0x867c('0x1b')]('%s/agent/tickets/%s',_0x3c5068[_0x867c('0xd')][_0x867c('0x5d')](_0x867c('0x5e'),''),_0x2af1c5['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x867c('0x5f')](function(_0x4d5288){logger['error'](_0x867c('0x60'),util[_0x867c('0x61')](_0x4d5288,{'showHidden':!![],'depth':null}));});};exports[_0x867c('0x62')]=function(_0x41ddd5,_0x3a649c,_0x5427d9,_0x50e524,_0x33a910,_0x3125ff,_0x16e220){var _0x2e4456,_0x5f94fd;_0x3125ff['remoteUri']=intUtil[_0x867c('0x4a')](_0x3125ff[_0x867c('0xd')]);_0x3125ff[_0x867c('0x4b')]=intUtil[_0x867c('0x4a')](_0x3125ff[_0x867c('0x4b')]);if(_0x16e220&&_0x16e220[_0x867c('0x63')]&&_0x16e220[_0x867c('0x63')]!==_0x867c('0x64')){logger[_0x867c('0xb')](_0x867c('0x65'),_0x867c('0x4e'));_0x3a649c[_0x867c('0x51')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3125ff[_0x867c('0x4b')],_0x3a649c[_0x867c('0x50')],md5(_0x3a649c[_0x867c('0x50')]));}headers[_0x867c('0x52')]=getAuth(_0x3125ff);return getUser(_0x3125ff,_0x50e524[_0x867c('0x53')])[_0x867c('0x16')](function(_0x3d2db8){_0x2e4456=_0x3d2db8;logger[_0x867c('0xb')](_0x867c('0x54'),_0x2e4456['id']);return getEndUser(_0x3125ff,_0x3a649c[_0x867c('0x66')],_0x3a649c[_0x867c('0x67')]);})[_0x867c('0x16')](function(_0x246b65){_0x5f94fd=_0x246b65;logger[_0x867c('0xb')](_0x867c('0x68'),_0x5f94fd['id']);return getTicket(_0x3125ff,_0x2e4456,_0x5f94fd,_0x5427d9,_0x3a649c);})[_0x867c('0x16')](function(_0x2f639f){if(_0x2f639f){logger['info']('The\x20Ticket\x20ID\x20is:',_0x2f639f['id']);switch(_0x3125ff['type']){case _0x867c('0x56'):logger[_0x867c('0xb')](_0x867c('0x65'),_0x867c('0x57'));return request({'uri':util[_0x867c('0x1b')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3125ff[_0x867c('0xd')],_0x2e4456['id'],_0x2f639f['id']),'method':_0x867c('0xe')});case'newTab':logger[_0x867c('0xb')](_0x867c('0x65'),_0x867c('0x5a'));emit(util[_0x867c('0x1b')]('user:%s',_0x50e524['name']),_0x867c('0x5c'),{'uri':util[_0x867c('0x1b')](_0x867c('0x69'),_0x3125ff[_0x867c('0xd')][_0x867c('0x5d')](_0x867c('0x5e'),''),_0x2f639f['id'])});break;default:logger[_0x867c('0x6a')]('[OUTBOUND]',_0x867c('0x6b'));}}})[_0x867c('0x5f')](function(_0x1332b0){logger[_0x867c('0x6a')](_0x867c('0x6c'),util[_0x867c('0x61')](_0x1332b0,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x3a744e,_0x5d175b,_0x5719fd,_0x22691b,_0xafe4bd,_0x42caad){var _0x471993,_0x578db9;_0x42caad[_0x867c('0xd')]=intUtil['stripTrailingSlash'](_0x42caad[_0x867c('0xd')]);_0x42caad['serverUrl']=intUtil[_0x867c('0x4a')](_0x42caad[_0x867c('0x4b')]);if(_0xafe4bd&&_0xafe4bd[_0x867c('0x4c')]){logger[_0x867c('0xb')]('['+_0x5d175b[_0x867c('0x6d')]['toUpperCase']()+']',_0x867c('0x4e'));_0x5d175b[_0x867c('0x51')]=util[_0x867c('0x1b')](_0x867c('0x4f'),_0x42caad[_0x867c('0x4b')],_0x5d175b[_0x867c('0x50')],md5(_0x5d175b[_0x867c('0x50')]));}else{_0x5d175b['recordingURL']='';}headers[_0x867c('0x52')]=getAuth(_0x42caad);return getUser(_0x42caad)[_0x867c('0x16')](function(_0xecdf8a){_0x471993=_0xecdf8a;logger['info'](_0x867c('0x54'),_0x471993['id']);return getEndUser(_0x42caad,_0x5d175b['calleridname'],_0x5d175b['calleridnum']);})[_0x867c('0x16')](function(_0x1bc0e3){_0x578db9=_0x1bc0e3;logger[_0x867c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x578db9['id']);return getTicket(_0x42caad,_0x471993,_0x578db9,_0x5719fd,_0x5d175b);})['then'](function(_0x2e88fe){if(_0x2e88fe){logger[_0x867c('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2e88fe['id']);}})[_0x867c('0x5f')](function(_0x59023d){logger['error']('['+_0x5d175b['lastevent'][_0x867c('0x6e')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x867c('0x61')](_0x59023d,{'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 487f8ff..1332565 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 _0xb0d2=['stringify','length','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','name','Variable','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','Contacts','lead','Creating\x20new\x20call...','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','First_Name','Last_Name','Full_Name','$se_module','utc','talktime','mm:ss','answertime','Call_Duration','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','complete','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','Outbound','trigger:browser:url','unmanaged','toUpperCase','/api/voice/recordings/','calleridname','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/logger','zoho','redis','localhost','emit','debug','[HTTP]'];(function(_0x384134,_0xf2ff1f){var _0x40a4df=function(_0x139d0d){while(--_0x139d0d){_0x384134['push'](_0x384134['shift']());}};_0x40a4df(++_0xf2ff1f);}(_0xb0d2,0x1cf));var _0x2b0d=function(_0x8160b6,_0x31c12d){_0x8160b6=_0x8160b6-0x0;var _0x61dd1a=_0xb0d2[_0x8160b6];return _0x61dd1a;};'use strict';var _=require(_0x2b0d('0x0'));var rp=require(_0x2b0d('0x1'));var md5=require(_0x2b0d('0x2'));var util=require(_0x2b0d('0x3'));var intUtil=require(_0x2b0d('0x4'));var moment=require(_0x2b0d('0x5'));var Redis=require('ioredis');var BPromise=require(_0x2b0d('0x6'));var config=require('../../../../config/environment');var logger=require(_0x2b0d('0x7'))(_0x2b0d('0x8'));config[_0x2b0d('0x9')]=_['defaults'](config[_0x2b0d('0x9')],{'host':_0x2b0d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2b0d('0x9')]));function emit(_0x2481d8,_0x5de0a4,_0x32197){io['to'](_0x2481d8)[_0x2b0d('0xb')](_0x5de0a4,_0x32197);}function request(_0x5b1b90){logger[_0x2b0d('0xc')](_0x2b0d('0xd'),JSON[_0x2b0d('0xe')](_0x5b1b90));return rp(_0x5b1b90);}function getCustomFields(_0x2f4cc7,_0xea8ef3){var _0x2b799e={};if(_0x2f4cc7[_0x2b0d('0xf')]>0x0){_[_0x2b0d('0x10')](_0x2f4cc7,function(_0x2c42b0){if(_[_0x2b0d('0x11')]([_0x2b0d('0x12'),_0x2b0d('0x13')],_0x2c42b0[_0x2b0d('0x14')])&&_0x2c42b0['idField']){_0x2b799e[_0x2c42b0[_0x2b0d('0x15')]]=_0x2c42b0['content'][_0x2b0d('0x16')]();}else if(_0x2c42b0[_0x2b0d('0x14')]===_0x2b0d('0x17')&&_0x2c42b0[_0x2b0d('0x18')]&&_0x2c42b0[_0x2b0d('0x15')]&&_0xea8ef3[_0x2c42b0[_0x2b0d('0x18')]]){_0x2b799e[_0x2c42b0['idField']]=_0xea8ef3[_0x2c42b0[_0x2b0d('0x18')]][_0x2b0d('0x16')]();}else if(_0x2c42b0[_0x2b0d('0x14')]===_0x2b0d('0x19')&&_0x2c42b0['Variable']&&_0x2c42b0['Variable'][_0x2b0d('0x1a')]&&_0x2c42b0[_0x2b0d('0x15')]&&_0xea8ef3[_0x2c42b0[_0x2b0d('0x1b')][_0x2b0d('0x1a')]['toLowerCase']()]){_0x2b799e[_0x2c42b0[_0x2b0d('0x15')]]=_0xea8ef3[_0x2c42b0[_0x2b0d('0x1b')]['name'][_0x2b0d('0x1c')]()]['toString']();}});}return _0x2b799e;}function getName(_0x345843){if(_0x345843[_0x2b0d('0x1d')]('\x20')>0x0){var _0x4e270a=_0x345843[_0x2b0d('0x1e')](/ (.+)/);if(_0x4e270a[0x1]){return _0x4e270a;}}return[_0x345843,_0x345843];}var accountsTokens={};function getAccessToken(_0x25e10a){return new Promise(function(_0x56c13a,_0x54034c){if(!_[_0x2b0d('0x1f')](accountsTokens[_0x25e10a['id']])&&!_[_0x2b0d('0x1f')](accountsTokens[_0x25e10a['id']][_0x2b0d('0x20')])){if(moment()['isBefore'](accountsTokens[_0x25e10a['id']][_0x2b0d('0x21')])){_0x56c13a(accountsTokens[_0x25e10a['id']][_0x2b0d('0x20')]);}}var _0x4da3b9;switch(_0x25e10a[_0x2b0d('0x22')]){case'US':_0x4da3b9=_0x2b0d('0x23');break;case'AU':_0x4da3b9='https://accounts.zoho.com.au';break;case'EU':_0x4da3b9=_0x2b0d('0x24');break;case'IN':_0x4da3b9=_0x2b0d('0x25');break;case'CN':_0x4da3b9=_0x2b0d('0x26');break;default:_0x4da3b9=_0x2b0d('0x24');break;}var _0x1001af={'method':_0x2b0d('0x27'),'uri':_0x4da3b9+_0x2b0d('0x28'),'qs':{'refresh_token':_0x25e10a[_0x2b0d('0x29')],'client_id':_0x25e10a['clientId'],'client_secret':_0x25e10a[_0x2b0d('0x2a')],'grant_type':_0x2b0d('0x2b')},'json':!![]};return rp(_0x1001af)[_0x2b0d('0x2c')](function(_0x4c4ca0){accountsTokens[_0x25e10a['id']]={'access_token':_0x4c4ca0[_0x2b0d('0x20')],'expires_in':moment()[_0x2b0d('0x2d')](_0x4c4ca0[_0x2b0d('0x21')],_0x2b0d('0x2e'))};_0x56c13a(_0x4c4ca0['access_token']);})[_0x2b0d('0x2f')](function(_0x2e79cb){logger[_0x2b0d('0x30')](_0x2b0d('0x31'),_0x2e79cb[_0x2b0d('0x32')]);_0x54034c(_0x2e79cb);});});}function getUser(_0x1cf880,_0x48c8ae,_0x4f1158,_0x29356a){logger['info'](_0x2b0d('0x33'));return request({'method':_0x2b0d('0x34'),'uri':util[_0x2b0d('0x35')](_0x2b0d('0x36'),_0x48c8ae),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x2b0d('0x37')+_0x1cf880},'json':!![]})[_0x2b0d('0x2c')](function(_0x5ae731){if(_0x5ae731['users']){var _0xc117b6=-0x1;if(_[_0x2b0d('0x38')](_0x5ae731[_0x2b0d('0x39')])){if(!_[_0x2b0d('0x1f')](_0x29356a)){_0xc117b6=_['findIndex'](_0x5ae731['users'],function(_0x35b8d2){return _0x35b8d2[_0x2b0d('0x3a')]===_0x29356a;});}if(_0xc117b6>=0x0){logger[_0x2b0d('0x3b')](_0x2b0d('0x3c'));}else{logger[_0x2b0d('0x3b')](_0x2b0d('0x3d'));_0xc117b6=_[_0x2b0d('0x3e')](_0x5ae731[_0x2b0d('0x39')],function(_0x3f61fe){return _0x3f61fe['profile']['name']===_0x2b0d('0x3f');});}return _0x5ae731[_0x2b0d('0x39')][_0xc117b6];}else{if(_0x5ae731[_0x2b0d('0x40')]['profile'][_0x2b0d('0x1a')]===_0x2b0d('0x3f')){logger[_0x2b0d('0x3b')](_0x2b0d('0x3d'));user=_0x5ae731[_0x2b0d('0x40')];return user;}else{logger[_0x2b0d('0x30')](_0x2b0d('0x41'),JSON[_0x2b0d('0xe')](_0x5ae731));throw new Error(_0x2b0d('0x42')+JSON[_0x2b0d('0xe')](_0x5ae731));}}}else{logger[_0x2b0d('0x30')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x5ae731));throw new Error(_0x2b0d('0x42')+JSON[_0x2b0d('0xe')](_0x5ae731));}})[_0x2b0d('0x2f')](function(_0x1c655a){console['error'](_0x1c655a);});}function getZohoUser(_0xc84682,_0x111072){return new BPromise(function(_0x3ec1ed,_0x3cb736){request(_0xc84682)['then'](function(_0x2a8a91){var _0x3ba09c=null;if(_0x2a8a91){_0x3ba09c=_0x2a8a91[_0x2b0d('0x43')][0x0];_0x3ba09c[_0x2b0d('0x44')]=_0x111072;}_0x3ec1ed(_0x3ba09c);})[_0x2b0d('0x2f')](function(_0x1481d9){_0x3cb736(_0x1481d9);});});}function createEndUser(_0x45fb38,_0x27ad95,_0x573829,_0x4f70d5,_0x1a593e,_0x2c2a84){var _0x573829=getName(_0x573829);return request({'method':_0x2b0d('0x27'),'uri':_0x2b0d('0x45')+_0x27ad95+_0x2b0d('0x46')+_[_0x2b0d('0x47')](_0x2c2a84[_0x2b0d('0x48')])+'s','body':{'data':[{'Last_Name':_0x573829[0x1],'First_Name':_0x573829[0x0],'Phone':_0x4f70d5,'Owner':{'name':!_[_0x2b0d('0x1f')](_0x1a593e[_0x2b0d('0x49')]['name'])?_0x1a593e[_0x2b0d('0x49')][_0x2b0d('0x1a')]:!_[_0x2b0d('0x1f')](_0x1a593e[_0x2b0d('0x4a')])?_0x1a593e[_0x2b0d('0x4a')]+'\x20'+_0x1a593e[_0x2b0d('0x4b')]:_0x1a593e['last_name'],'id':_0x1a593e['id']}}]},'headers':{'Authorization':_0x2b0d('0x37')+_0x45fb38},'json':!![]})[_0x2b0d('0x2c')](function(_0x4bc4c6){if(_0x4bc4c6&&_0x4bc4c6[_0x2b0d('0x43')][0x0][_0x2b0d('0x4c')]==='SUCCESS'){var _0x49135d=_0x4bc4c6['data'][0x0]['details'];_0x49135d[_0x2b0d('0x44')]=_[_0x2b0d('0x47')](_0x2c2a84['moduleCreate'])+'s';return _0x49135d;}logger['error'](_0x2b0d('0x41'),JSON[_0x2b0d('0xe')](data));throw new Error(_0x2b0d('0x4d')+JSON[_0x2b0d('0xe')](data));})[_0x2b0d('0x2f')](function(_0x5ea852){console[_0x2b0d('0x4e')]('CREATE\x20ERROR',_0x5ea852);});}function getEndUser(_0x59f363,_0x51355c,_0x518d5e,_0x4b2625,_0x21eb82,_0x563182,_0x425c91){var _0x32c9b3={'method':_0x2b0d('0x34'),'uri':'','headers':{'Authorization':_0x2b0d('0x37')+_0x59f363},'json':!![]};switch(_0x425c91['moduleSearch']){case _0x2b0d('0x4f'):_0x32c9b3[_0x2b0d('0x50')]='https://www.zohoapis.'+_0x51355c+_0x2b0d('0x51')+_0x21eb82+'))';return getZohoUser(_0x32c9b3,'Contacts')[_0x2b0d('0x2c')](function(_0x4c59f7){if(_0x4c59f7)return _0x4c59f7;_0x32c9b3[_0x2b0d('0x50')]=_0x2b0d('0x45')+_0x51355c+_0x2b0d('0x52')+_0x21eb82+'))';return getZohoUser(_0x32c9b3,_0x2b0d('0x53'))[_0x2b0d('0x2c')](function(_0x8cb2db){if(_0x8cb2db)return _0x8cb2db;if(_0x425c91[_0x2b0d('0x48')]!=_0x2b0d('0x54')){return createEndUser(_0x59f363,_0x51355c,_0x4b2625,_0x21eb82,_0x563182,_0x425c91);}else{return{};}});});break;case'contact':_0x32c9b3['uri']=_0x2b0d('0x45')+_0x51355c+_0x2b0d('0x51')+_0x21eb82+'))';return getZohoUser(_0x32c9b3,_0x2b0d('0x55'))[_0x2b0d('0x2c')](function(_0x4764f1){if(_0x4764f1)return _0x4764f1;if(_0x425c91[_0x2b0d('0x48')]!='nothing'){return createEndUser(_0x59f363,_0x51355c,_0x4b2625,_0x21eb82,_0x563182,_0x425c91);}else{return{};}});break;case _0x2b0d('0x56'):_0x32c9b3['uri']=_0x2b0d('0x45')+_0x51355c+_0x2b0d('0x52')+_0x21eb82+'))';return getZohoUser(_0x32c9b3,_0x2b0d('0x53'))[_0x2b0d('0x2c')](function(_0x54a37f){if(_0x54a37f)return _0x54a37f;if(_0x425c91[_0x2b0d('0x48')]!=_0x2b0d('0x54')){return createEndUser(_0x59f363,_0x51355c,_0x4b2625,_0x21eb82,_0x563182,_0x425c91);}else{return{};}});break;}}function getCall(_0x457d10,_0x2e7d38,_0x2da152,_0x4febf3,_0x2518b9,_0x58d391,_0x3d81c5,_0x3cfcca){logger[_0x2b0d('0x3b')](_0x2b0d('0x57'));var _0x4c02ac={};_0x4c02ac['Owner']={'name':!_[_0x2b0d('0x1f')](_0x4febf3[_0x2b0d('0x49')][_0x2b0d('0x1a')])&&!_['isNil'](_0x4febf3['profile'][_0x2b0d('0x1a')])&&_0x4febf3[_0x2b0d('0x58')][_0x2b0d('0x1a')]===_0x2b0d('0x59')?_0x4febf3[_0x2b0d('0x49')][_0x2b0d('0x1a')]:!_[_0x2b0d('0x1f')](_0x4febf3['first_name'])?_0x4febf3[_0x2b0d('0x4a')]+'\x20'+_0x4febf3['last_name']:_0x4febf3[_0x2b0d('0x4b')],'id':_0x4febf3['id']};_0x4c02ac[_0x2b0d('0x5a')]=intUtil[_0x2b0d('0x5b')](_0x58d391[_0x2b0d('0x5c')],_0x3d81c5,'\x20');_0x4c02ac[_0x2b0d('0x5d')]=intUtil[_0x2b0d('0x5b')](_0x58d391[_0x2b0d('0x5e')],_0x3d81c5,'\x0a');if(_0x2518b9[_0x2b0d('0x44')]===_0x2b0d('0x55')){_0x4c02ac[_0x2b0d('0x5f')]={'name':!_[_0x2b0d('0x1f')](_0x2518b9['Full_Name'])?_0x2518b9['Full_Name']:!_[_0x2b0d('0x1f')](_0x2518b9[_0x2b0d('0x60')])?_0x2518b9[_0x2b0d('0x60')]+'\x20'+_0x2518b9[_0x2b0d('0x61')]:_0x2518b9[_0x2b0d('0x61')],'id':_0x2518b9['id']};}if(_0x2518b9[_0x2b0d('0x44')]===_0x2b0d('0x53')){_0x4c02ac['What_Id']={'name':!_[_0x2b0d('0x1f')](_0x2518b9[_0x2b0d('0x62')])?_0x2518b9[_0x2b0d('0x62')]:!_[_0x2b0d('0x1f')](_0x2518b9[_0x2b0d('0x60')])?_0x2518b9[_0x2b0d('0x60')]+'\x20'+_0x2518b9[_0x2b0d('0x61')]:_0x2518b9['Last_Name'],'id':_0x2518b9['id']};_0x4c02ac[_0x2b0d('0x63')]=_[_0x2b0d('0x47')](_0x2518b9['enduserType']);}if(_0x3d81c5['talktime']){_0x4c02ac['Call_Duration']=moment[_0x2b0d('0x64')](parseInt(_0x3d81c5[_0x2b0d('0x65')])*0x3e8)[_0x2b0d('0x35')](_0x2b0d('0x66'));}else if(_0x3d81c5[_0x2b0d('0x67')]&&_0x3d81c5['endtime']){_0x4c02ac[_0x2b0d('0x68')]=moment['utc'](moment(_0x3d81c5[_0x2b0d('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0x2b0d('0x6a')](moment(_0x3d81c5[_0x2b0d('0x6b')],_0x2b0d('0x6c'))))[_0x2b0d('0x35')](_0x2b0d('0x66'));}switch(_0x3d81c5[_0x2b0d('0x6d')]){case _0x2b0d('0x6e'):_0x4c02ac['Call_Result']=_0x2b0d('0x6f');break;case _0x2b0d('0x70'):case _0x2b0d('0x71'):_0x4c02ac[_0x2b0d('0x72')]=_0x2b0d('0x73');break;case'rejected':_0x4c02ac['Call_Result']=_0x2b0d('0x74');break;case _0x2b0d('0x75'):_0x4c02ac['Call_Result']=_0x2b0d('0x76');break;case _0x2b0d('0x77'):_0x4c02ac[_0x2b0d('0x72')]='Timeout';default:}_0x4c02ac[_0x2b0d('0x78')]=(_0x3cfcca===_0x2b0d('0x79')?moment(_0x3d81c5[_0x2b0d('0x6b')])['format'](_0x2b0d('0x6c')):moment(_0x3d81c5[_0x2b0d('0x7a')])[_0x2b0d('0x35')](_0x2b0d('0x6c')))||moment()[_0x2b0d('0x35')](_0x2b0d('0x6c'));_0x4c02ac[_0x2b0d('0x7b')]=_0x3cfcca||_0x2b0d('0x7c');_0x4c02ac=_[_0x2b0d('0x7d')](_0x4c02ac,getCustomFields(_0x58d391[_0x2b0d('0x7e')],_0x3d81c5));return request({'method':_0x2b0d('0x27'),'uri':_0x2b0d('0x45')+_0x2e7d38+_0x2b0d('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x457d10},'body':{'data':[_0x4c02ac]},'json':!![]})[_0x2b0d('0x2c')](function(_0x587c1e){if(_0x587c1e&&_0x587c1e[_0x2b0d('0x43')][0x0][_0x2b0d('0x4c')]==='SUCCESS'){logger['info'](_0x2b0d('0x80'));return{'id':_0x587c1e[_0x2b0d('0x43')][0x0][_0x2b0d('0x81')]['id']};}})[_0x2b0d('0x2f')](function(_0x868d3){logger['info']('err',_0x868d3[_0x2b0d('0x32')]);console[_0x2b0d('0x4e')](_0x2b0d('0x82'),_0x868d3);});}exports[_0x2b0d('0x83')]=function(_0x27d798,_0x19ae99,_0x36ae98,_0xd3c2dc,_0x54a56c,_0x1f8f4e){var _0x524a9f,_0x526c28,_0x5f5244;_0x1f8f4e[_0x2b0d('0x84')]=intUtil[_0x2b0d('0x85')](_0x1f8f4e['host']);_0x1f8f4e[_0x2b0d('0x86')]=intUtil[_0x2b0d('0x85')](_0x1f8f4e[_0x2b0d('0x86')]);if(_0x54a56c&&_0x54a56c[_0x2b0d('0x87')]){logger['info'](_0x2b0d('0x88'),_0x2b0d('0x89'));_0x19ae99[_0x2b0d('0x8a')]=_0x1f8f4e[_0x2b0d('0x86')]+'/api/voice/recordings/'+_0x19ae99[_0x2b0d('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x19ae99['uniqueid']);}else{_0x19ae99[_0x2b0d('0x8a')]='';}var _0x5b78da=_0x1f8f4e[_0x2b0d('0x84')]===_0x2b0d('0x8c')?'eu':_0x2b0d('0x8d');return getAccessToken(_0x1f8f4e)[_0x2b0d('0x2c')](function(_0x29d9e8){_0x5f5244=_0x29d9e8;return getUser(_0x5f5244,_0x5b78da,_0x1f8f4e,_0xd3c2dc[_0x2b0d('0x3a')]);})[_0x2b0d('0x2c')](function(_0x104f06){_0x524a9f=_0x104f06;logger[_0x2b0d('0x3b')](_0x2b0d('0x8e'),_0x524a9f['id']);return getEndUser(_0x5f5244,_0x5b78da,_0x1f8f4e,_0x19ae99['calleridname'],_0x19ae99[_0x2b0d('0x8f')],_0x524a9f,_0x36ae98);})['then'](function(_0x3e6b18){_0x526c28=_0x3e6b18;return getCall(_0x5f5244,_0x5b78da,_0x1f8f4e,_0x524a9f,_0x526c28,_0x36ae98,_0x19ae99,_0x2b0d('0x7c'));})[_0x2b0d('0x2c')](function(_0x268692){if(_0x268692){logger[_0x2b0d('0x3b')](_0x2b0d('0x90'),_0x268692['id']);logger['info'](_0x2b0d('0x88'),_0x2b0d('0x91'));emit(util[_0x2b0d('0x35')](_0x2b0d('0x92'),_0xd3c2dc['name']),'trigger:browser:url',{'uri':_0x2b0d('0x93')+_0x1f8f4e['host']+_0x2b0d('0x94')+_0x268692['id']});}})[_0x2b0d('0x2f')](function(_0x3e7449){logger[_0x2b0d('0x30')](_0x2b0d('0x88'),JSON[_0x2b0d('0xe')](_0x3e7449));});};exports[_0x2b0d('0x79')]=function(_0x2af584,_0x319466,_0x2071a1,_0x1554d8,_0x5c225e,_0xbbb253,_0x234117){var _0x2e506b,_0x42c8e6,_0x6fd2dd;_0xbbb253['host']=intUtil[_0x2b0d('0x85')](_0xbbb253[_0x2b0d('0x84')]);_0xbbb253[_0x2b0d('0x86')]=intUtil[_0x2b0d('0x85')](_0xbbb253[_0x2b0d('0x86')]);if(_0x234117&&_0x234117['recordingFormat']&&_0x234117[_0x2b0d('0x95')]!==_0x2b0d('0x96')){logger[_0x2b0d('0x3b')](_0x2b0d('0x97'),_0x2b0d('0x89'));_0x319466[_0x2b0d('0x8a')]=_0xbbb253[_0x2b0d('0x86')]+'/api/voice/recordings/'+_0x319466['uniqueid']+_0x2b0d('0x98')+md5(_0x319466[_0x2b0d('0x8b')]);}var _0x4eea8c=_0xbbb253[_0x2b0d('0x84')]==='zoho.eu'?'eu':'com';return getAccessToken(_0xbbb253)[_0x2b0d('0x2c')](function(_0x1afac7){_0x6fd2dd=_0x1afac7;return getUser(_0x6fd2dd,_0x4eea8c,_0xbbb253,_0x1554d8[_0x2b0d('0x3a')]);})[_0x2b0d('0x2c')](function(_0x394511){_0x2e506b=_0x394511;logger[_0x2b0d('0x3b')](_0x2b0d('0x8e'),_0x2e506b['id']);return getEndUser(_0x6fd2dd,_0x4eea8c,_0xbbb253,_0x319466['destcalleridname'],_0x319466['destcalleridnum'],_0x2e506b,_0x2071a1);})['then'](function(_0x3a67d7){_0x42c8e6=_0x3a67d7;return getCall(_0x6fd2dd,_0x4eea8c,_0xbbb253,_0x2e506b,_0x42c8e6,_0x2071a1,_0x319466,_0x2b0d('0x99'));})['then'](function(_0x21f998){if(_0x21f998){logger[_0x2b0d('0x3b')](_0x2b0d('0x90'),_0x21f998['id']);logger[_0x2b0d('0x3b')](_0x2b0d('0x97'),_0x2b0d('0x91'));emit(util[_0x2b0d('0x35')]('user:%s',_0x1554d8[_0x2b0d('0x1a')]),_0x2b0d('0x9a'),{'uri':'https://crm.'+_0xbbb253['host']+_0x2b0d('0x94')+_0x21f998['id']});}})[_0x2b0d('0x2f')](function(_0x236978){logger[_0x2b0d('0x30')](_0x2b0d('0x97'),JSON[_0x2b0d('0xe')](_0x236978));});};exports[_0x2b0d('0x9b')]=function(_0x570dc,_0xbf4d4d,_0x179408,_0x5c1225,_0x4c6b5e,_0x422fe9){var _0x3e7738,_0x3dcd12,_0x4193bb;_0x422fe9[_0x2b0d('0x84')]=intUtil[_0x2b0d('0x85')](_0x422fe9[_0x2b0d('0x84')]);_0x422fe9['serverUrl']=intUtil[_0x2b0d('0x85')](_0x422fe9['serverUrl']);if(_0x4c6b5e&&_0x4c6b5e['monitor_format']){logger[_0x2b0d('0x3b')]('['+_0xbf4d4d[_0x2b0d('0x6d')][_0x2b0d('0x9c')]()+']',_0x2b0d('0x89'));_0xbf4d4d[_0x2b0d('0x8a')]=_0x422fe9[_0x2b0d('0x86')]+_0x2b0d('0x9d')+_0xbf4d4d['uniqueid']+_0x2b0d('0x98')+md5(_0xbf4d4d[_0x2b0d('0x8b')]);}else{_0xbf4d4d[_0x2b0d('0x8a')]='';}var _0x1e7a8d=_0x422fe9[_0x2b0d('0x84')]===_0x2b0d('0x8c')?'eu':_0x2b0d('0x8d');return getAccessToken(_0x422fe9)['then'](function(_0x5602fb){_0x4193bb=_0x5602fb;return getUser(_0x4193bb,_0x1e7a8d,_0x422fe9);})[_0x2b0d('0x2c')](function(_0x2f6c0b){_0x3e7738=_0x2f6c0b;logger[_0x2b0d('0x3b')](_0x2b0d('0x8e'),_0x3e7738['id']);return getEndUser(_0x4193bb,_0x1e7a8d,_0x422fe9,_0xbf4d4d[_0x2b0d('0x9e')],_0xbf4d4d[_0x2b0d('0x8f')],_0x3e7738,_0x179408);})[_0x2b0d('0x2c')](function(_0x28bd6d){_0x3dcd12=_0x28bd6d;return getCall(_0x4193bb,_0x1e7a8d,_0x422fe9,_0x3e7738,_0x3dcd12,_0x179408,_0xbf4d4d,_0x2b0d('0x7c'));})['then'](function(_0x1591ec){if(_0x1591ec){logger[_0x2b0d('0x3b')]('The\x20Call\x20ID\x20is:',_0x1591ec['id']);}})[_0x2b0d('0x2f')](function(_0x165733){logger[_0x2b0d('0x30')]('['+_0xbf4d4d[_0x2b0d('0x6d')][_0x2b0d('0x9c')]()+']',JSON['stringify'](_0x165733));});}; \ No newline at end of file +var _0x912f=['Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','code','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','uniqueid','recordingURL','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','/api/voice/recordings/','zoho.eu','email','destcalleridname','destcalleridnum','Outbound','unmanaged','toUpperCase','/downloads?type=uniqueid&token=','lodash','request-promise','md5','./util','moment','ioredis','bluebird','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','toLowerCase','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','refresh_token','then','add','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','isArrayLikeObject','findIndex','users','Using\x20the\x20admin\x20account!','profile','name','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','SUCCESS','enduserType','Error:\x20','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Creating\x20new\x20call...','administrator','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','complete','Rejected','abandoned','Abandoned'];(function(_0x135f50,_0x3e56a4){var _0x203d47=function(_0x17b999){while(--_0x17b999){_0x135f50['push'](_0x135f50['shift']());}};_0x203d47(++_0x3e56a4);}(_0x912f,0x1d9));var _0xf912=function(_0x386aa3,_0x225714){_0x386aa3=_0x386aa3-0x0;var _0x346cd6=_0x912f[_0x386aa3];return _0x346cd6;};'use strict';var _=require(_0xf912('0x0'));var rp=require(_0xf912('0x1'));var md5=require(_0xf912('0x2'));var util=require('util');var intUtil=require(_0xf912('0x3'));var moment=require(_0xf912('0x4'));var Redis=require(_0xf912('0x5'));var BPromise=require(_0xf912('0x6'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zoho');config[_0xf912('0x7')]=_[_0xf912('0x8')](config['redis'],{'host':_0xf912('0x9'),'port':0x18eb});var io=require(_0xf912('0xa'))(new Redis(config[_0xf912('0x7')]));function emit(_0x51b95b,_0x553a67,_0x1d494c){io['to'](_0x51b95b)[_0xf912('0xb')](_0x553a67,_0x1d494c);}function request(_0x2469a2){logger[_0xf912('0xc')]('[HTTP]',JSON[_0xf912('0xd')](_0x2469a2));return rp(_0x2469a2);}function getCustomFields(_0x4e5914,_0xf5b5f6){var _0x3d4788={};if(_0x4e5914[_0xf912('0xe')]>0x0){_['forEach'](_0x4e5914,function(_0x4b680e){if(_['includes']([_0xf912('0xf'),_0xf912('0x10')],_0x4b680e[_0xf912('0x11')])&&_0x4b680e[_0xf912('0x12')]){_0x3d4788[_0x4b680e['idField']]=_0x4b680e[_0xf912('0x13')][_0xf912('0x14')]();}else if(_0x4b680e[_0xf912('0x11')]==='variable'&&_0x4b680e['variableName']&&_0x4b680e[_0xf912('0x12')]&&_0xf5b5f6[_0x4b680e[_0xf912('0x15')]]){_0x3d4788[_0x4b680e[_0xf912('0x12')]]=_0xf5b5f6[_0x4b680e[_0xf912('0x15')]][_0xf912('0x14')]();}else if(_0x4b680e[_0xf912('0x11')]===_0xf912('0x16')&&_0x4b680e[_0xf912('0x17')]&&_0x4b680e[_0xf912('0x17')]['name']&&_0x4b680e[_0xf912('0x12')]&&_0xf5b5f6[_0x4b680e[_0xf912('0x17')]['name'][_0xf912('0x18')]()]){_0x3d4788[_0x4b680e['idField']]=_0xf5b5f6[_0x4b680e[_0xf912('0x17')]['name'][_0xf912('0x18')]()][_0xf912('0x14')]();}});}return _0x3d4788;}function getName(_0x4c5a8d){if(_0x4c5a8d['indexOf']('\x20')>0x0){var _0x3366db=_0x4c5a8d[_0xf912('0x19')](/ (.+)/);if(_0x3366db[0x1]){return _0x3366db;}}return[_0x4c5a8d,_0x4c5a8d];}var accountsTokens={};function getAccessToken(_0x2a01e6){return new Promise(function(_0x3f537f,_0xc6423e){if(!_['isNil'](accountsTokens[_0x2a01e6['id']])&&!_[_0xf912('0x1a')](accountsTokens[_0x2a01e6['id']][_0xf912('0x1b')])){if(moment()[_0xf912('0x1c')](accountsTokens[_0x2a01e6['id']][_0xf912('0x1d')])){_0x3f537f(accountsTokens[_0x2a01e6['id']]['access_token']);}}var _0x4cf6e3;switch(_0x2a01e6['zone']){case'US':_0x4cf6e3=_0xf912('0x1e');break;case'AU':_0x4cf6e3='https://accounts.zoho.com.au';break;case'EU':_0x4cf6e3=_0xf912('0x1f');break;case'IN':_0x4cf6e3='https://accounts.zoho.in';break;case'CN':_0x4cf6e3=_0xf912('0x20');break;default:_0x4cf6e3='https://accounts.zoho.eu';break;}var _0xd55095={'method':_0xf912('0x21'),'uri':_0x4cf6e3+_0xf912('0x22'),'qs':{'refresh_token':_0x2a01e6[_0xf912('0x23')],'client_id':_0x2a01e6['clientId'],'client_secret':_0x2a01e6['clientSecret'],'grant_type':_0xf912('0x24')},'json':!![]};return rp(_0xd55095)[_0xf912('0x25')](function(_0x24587a){accountsTokens[_0x2a01e6['id']]={'access_token':_0x24587a[_0xf912('0x1b')],'expires_in':moment()[_0xf912('0x26')](_0x24587a[_0xf912('0x1d')],'seconds')};_0x3f537f(_0x24587a['access_token']);})[_0xf912('0x27')](function(_0x485e2d){logger[_0xf912('0x28')](_0xf912('0x29'),_0x485e2d[_0xf912('0x2a')]);_0xc6423e(_0x485e2d);});});}function getUser(_0x34ff42,_0x5696fd,_0x1c7f5c,_0x69a071){logger[_0xf912('0x2b')](_0xf912('0x2c'));return request({'method':_0xf912('0x2d'),'uri':util[_0xf912('0x2e')](_0xf912('0x2f'),_0x5696fd),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x34ff42},'json':!![]})[_0xf912('0x25')](function(_0x2a2f47){if(_0x2a2f47['users']){var _0x568e88=-0x1;if(_[_0xf912('0x30')](_0x2a2f47['users'])){if(!_[_0xf912('0x1a')](_0x69a071)){_0x568e88=_[_0xf912('0x31')](_0x2a2f47[_0xf912('0x32')],function(_0x3ac1eb){return _0x3ac1eb['email']===_0x69a071;});}if(_0x568e88>=0x0){logger[_0xf912('0x2b')]('Agent\x20found!');}else{logger[_0xf912('0x2b')](_0xf912('0x33'));_0x568e88=_[_0xf912('0x31')](_0x2a2f47['users'],function(_0x30e80c){return _0x30e80c[_0xf912('0x34')][_0xf912('0x35')]==='Administrator';});}return _0x2a2f47['users'][_0x568e88];}else{if(_0x2a2f47['user'][_0xf912('0x34')][_0xf912('0x35')]===_0xf912('0x36')){logger[_0xf912('0x2b')](_0xf912('0x33'));user=_0x2a2f47[_0xf912('0x37')];return user;}else{logger[_0xf912('0x28')](_0xf912('0x38'),JSON[_0xf912('0xd')](_0x2a2f47));throw new Error(_0xf912('0x39')+JSON['stringify'](_0x2a2f47));}}}else{logger[_0xf912('0x28')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x2a2f47));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf912('0xd')](_0x2a2f47));}})[_0xf912('0x27')](function(_0x21595f){console[_0xf912('0x28')](_0x21595f);});}function getZohoUser(_0x393874,_0x182c1f){return new BPromise(function(_0x6c7160,_0x368321){request(_0x393874)['then'](function(_0x3ac826){var _0x106f90=null;if(_0x3ac826){_0x106f90=_0x3ac826[_0xf912('0x3a')][0x0];_0x106f90['enduserType']=_0x182c1f;}_0x6c7160(_0x106f90);})[_0xf912('0x27')](function(_0x2a4b20){_0x368321(_0x2a4b20);});});}function createEndUser(_0x475cf3,_0x2b570e,_0x1ece12,_0x18875f,_0x537c89,_0x559ca4){var _0x1ece12=getName(_0x1ece12);return request({'method':_0xf912('0x21'),'uri':_0xf912('0x3b')+_0x2b570e+'/crm/v2/'+_[_0xf912('0x3c')](_0x559ca4[_0xf912('0x3d')])+'s','body':{'data':[{'Last_Name':_0x1ece12[0x1],'First_Name':_0x1ece12[0x0],'Phone':_0x18875f,'Owner':{'name':!_['isNil'](_0x537c89[_0xf912('0x3e')][_0xf912('0x35')])?_0x537c89[_0xf912('0x3e')]['name']:!_[_0xf912('0x1a')](_0x537c89[_0xf912('0x3f')])?_0x537c89['first_name']+'\x20'+_0x537c89[_0xf912('0x40')]:_0x537c89['last_name'],'id':_0x537c89['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x475cf3},'json':!![]})[_0xf912('0x25')](function(_0x2f9188){if(_0x2f9188&&_0x2f9188[_0xf912('0x3a')][0x0]['code']===_0xf912('0x41')){var _0x3892f5=_0x2f9188[_0xf912('0x3a')][0x0]['details'];_0x3892f5[_0xf912('0x42')]=_['startCase'](_0x559ca4[_0xf912('0x3d')])+'s';return _0x3892f5;}logger[_0xf912('0x28')](_0xf912('0x38'),JSON[_0xf912('0xd')](data));throw new Error(_0xf912('0x43')+JSON[_0xf912('0xd')](data));})[_0xf912('0x27')](function(_0x3c80fc){console[_0xf912('0x44')](_0xf912('0x45'),_0x3c80fc);});}function getEndUser(_0x40c709,_0x364f7d,_0x194c53,_0x1d2deb,_0x15e976,_0x16c4dd,_0x46d1b9){var _0x5cec0={'method':_0xf912('0x2d'),'uri':'','headers':{'Authorization':_0xf912('0x46')+_0x40c709},'json':!![]};switch(_0x46d1b9[_0xf912('0x47')]){case'contact_lead':_0x5cec0[_0xf912('0x48')]=_0xf912('0x3b')+_0x364f7d+_0xf912('0x49')+_0x15e976+'))';return getZohoUser(_0x5cec0,_0xf912('0x4a'))[_0xf912('0x25')](function(_0x5c8e91){if(_0x5c8e91)return _0x5c8e91;_0x5cec0[_0xf912('0x48')]=_0xf912('0x3b')+_0x364f7d+_0xf912('0x4b')+_0x15e976+'))';return getZohoUser(_0x5cec0,_0xf912('0x4c'))[_0xf912('0x25')](function(_0x49568d){if(_0x49568d)return _0x49568d;if(_0x46d1b9[_0xf912('0x3d')]!=_0xf912('0x4d')){return createEndUser(_0x40c709,_0x364f7d,_0x1d2deb,_0x15e976,_0x16c4dd,_0x46d1b9);}else{return{};}});});break;case _0xf912('0x4e'):_0x5cec0[_0xf912('0x48')]=_0xf912('0x3b')+_0x364f7d+_0xf912('0x49')+_0x15e976+'))';return getZohoUser(_0x5cec0,_0xf912('0x4a'))['then'](function(_0x1a1da5){if(_0x1a1da5)return _0x1a1da5;if(_0x46d1b9['moduleCreate']!=_0xf912('0x4d')){return createEndUser(_0x40c709,_0x364f7d,_0x1d2deb,_0x15e976,_0x16c4dd,_0x46d1b9);}else{return{};}});break;case'lead':_0x5cec0[_0xf912('0x48')]=_0xf912('0x3b')+_0x364f7d+_0xf912('0x4b')+_0x15e976+'))';return getZohoUser(_0x5cec0,'Leads')[_0xf912('0x25')](function(_0xebc9f){if(_0xebc9f)return _0xebc9f;if(_0x46d1b9[_0xf912('0x3d')]!=_0xf912('0x4d')){return createEndUser(_0x40c709,_0x364f7d,_0x1d2deb,_0x15e976,_0x16c4dd,_0x46d1b9);}else{return{};}});break;}}function getCall(_0x14fe9e,_0x5a66fc,_0x2b8556,_0x52fc58,_0x390e05,_0xa3867f,_0x21a524,_0xfd2dc6){logger[_0xf912('0x2b')](_0xf912('0x4f'));var _0x4a61f1={};_0x4a61f1['Owner']={'name':!_[_0xf912('0x1a')](_0x52fc58['role'][_0xf912('0x35')])&&!_['isNil'](_0x52fc58[_0xf912('0x34')]['name'])&&_0x52fc58['profile'][_0xf912('0x35')]===_0xf912('0x50')?_0x52fc58[_0xf912('0x3e')][_0xf912('0x35')]:!_[_0xf912('0x1a')](_0x52fc58[_0xf912('0x3f')])?_0x52fc58[_0xf912('0x3f')]+'\x20'+_0x52fc58[_0xf912('0x40')]:_0x52fc58['last_name'],'id':_0x52fc58['id']};_0x4a61f1['Subject']=intUtil['getString'](_0xa3867f[_0xf912('0x51')],_0x21a524,'\x20');_0x4a61f1[_0xf912('0x52')]=intUtil[_0xf912('0x53')](_0xa3867f[_0xf912('0x54')],_0x21a524,'\x0a');if(_0x390e05['enduserType']===_0xf912('0x4a')){_0x4a61f1[_0xf912('0x55')]={'name':!_[_0xf912('0x1a')](_0x390e05[_0xf912('0x56')])?_0x390e05[_0xf912('0x56')]:!_[_0xf912('0x1a')](_0x390e05[_0xf912('0x57')])?_0x390e05[_0xf912('0x57')]+'\x20'+_0x390e05['Last_Name']:_0x390e05[_0xf912('0x58')],'id':_0x390e05['id']};}if(_0x390e05[_0xf912('0x42')]==='Leads'){_0x4a61f1[_0xf912('0x59')]={'name':!_[_0xf912('0x1a')](_0x390e05[_0xf912('0x56')])?_0x390e05[_0xf912('0x56')]:!_[_0xf912('0x1a')](_0x390e05[_0xf912('0x57')])?_0x390e05['First_Name']+'\x20'+_0x390e05[_0xf912('0x58')]:_0x390e05[_0xf912('0x58')],'id':_0x390e05['id']};_0x4a61f1[_0xf912('0x5a')]=_[_0xf912('0x3c')](_0x390e05[_0xf912('0x42')]);}if(_0x21a524['talktime']){_0x4a61f1[_0xf912('0x5b')]=moment[_0xf912('0x5c')](parseInt(_0x21a524[_0xf912('0x5d')])*0x3e8)[_0xf912('0x2e')](_0xf912('0x5e'));}else if(_0x21a524[_0xf912('0x5f')]&&_0x21a524[_0xf912('0x60')]){_0x4a61f1[_0xf912('0x5b')]=moment[_0xf912('0x5c')](moment(_0x21a524[_0xf912('0x60')],_0xf912('0x61'))[_0xf912('0x62')](moment(_0x21a524[_0xf912('0x63')],'YYYY-MM-DDTHH:mm:ss')))[_0xf912('0x2e')](_0xf912('0x5e'));}switch(_0x21a524[_0xf912('0x64')]){case _0xf912('0x65'):_0x4a61f1[_0xf912('0x66')]='Called';break;case _0xf912('0x67'):case'connect':_0x4a61f1[_0xf912('0x66')]='Answered';break;case'rejected':_0x4a61f1[_0xf912('0x66')]=_0xf912('0x68');break;case _0xf912('0x69'):_0x4a61f1[_0xf912('0x66')]=_0xf912('0x6a');break;case'timeout':_0x4a61f1['Call_Result']='Timeout';default:}_0x4a61f1[_0xf912('0x6b')]=(_0xfd2dc6===_0xf912('0x6c')?moment(_0x21a524['starttime'])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x21a524['agentcalledAt'])['format'](_0xf912('0x61')))||moment()[_0xf912('0x2e')](_0xf912('0x61'));_0x4a61f1[_0xf912('0x6d')]=_0xfd2dc6||_0xf912('0x6e');_0x4a61f1=_[_0xf912('0x6f')](_0x4a61f1,getCustomFields(_0xa3867f[_0xf912('0x70')],_0x21a524));return request({'method':_0xf912('0x21'),'uri':_0xf912('0x3b')+_0x5a66fc+'/crm/v2/Calls','headers':{'Authorization':_0xf912('0x46')+_0x14fe9e},'body':{'data':[_0x4a61f1]},'json':!![]})[_0xf912('0x25')](function(_0x1bc84a){if(_0x1bc84a&&_0x1bc84a['data'][0x0][_0xf912('0x71')]==='SUCCESS'){logger[_0xf912('0x2b')]('Call\x20created!');return{'id':_0x1bc84a[_0xf912('0x3a')][0x0]['details']['id']};}})[_0xf912('0x27')](function(_0x984331){logger[_0xf912('0x2b')](_0xf912('0x72'),_0x984331[_0xf912('0x2a')]);console['log'](_0xf912('0x72'),_0x984331);});}exports[_0xf912('0x73')]=function(_0x2ac59f,_0x263fc1,_0x716b04,_0x3318c3,_0x213f88,_0x209167){var _0x1022c9,_0x3e93e9,_0x562fc5;_0x209167[_0xf912('0x74')]=intUtil[_0xf912('0x75')](_0x209167[_0xf912('0x74')]);_0x209167[_0xf912('0x76')]=intUtil['stripTrailingSlash'](_0x209167['serverUrl']);if(_0x213f88&&_0x213f88[_0xf912('0x77')]){logger['info'](_0xf912('0x78'),'Recording\x20is\x20enabled!');_0x263fc1['recordingURL']=_0x209167[_0xf912('0x76')]+'/api/voice/recordings/'+_0x263fc1[_0xf912('0x79')]+'/downloads?type=uniqueid&token='+md5(_0x263fc1[_0xf912('0x79')]);}else{_0x263fc1[_0xf912('0x7a')]='';}var _0x39f874=_0x209167[_0xf912('0x74')]==='zoho.eu'?'eu':_0xf912('0x7b');return getAccessToken(_0x209167)['then'](function(_0x312352){_0x562fc5=_0x312352;return getUser(_0x562fc5,_0x39f874,_0x209167,_0x3318c3['email']);})['then'](function(_0x41a0b3){_0x1022c9=_0x41a0b3;logger[_0xf912('0x2b')](_0xf912('0x7c'),_0x1022c9['id']);return getEndUser(_0x562fc5,_0x39f874,_0x209167,_0x263fc1[_0xf912('0x7d')],_0x263fc1[_0xf912('0x7e')],_0x1022c9,_0x716b04);})[_0xf912('0x25')](function(_0x1dd773){_0x3e93e9=_0x1dd773;return getCall(_0x562fc5,_0x39f874,_0x209167,_0x1022c9,_0x3e93e9,_0x716b04,_0x263fc1,_0xf912('0x6e'));})[_0xf912('0x25')](function(_0x1aedca){if(_0x1aedca){logger['info'](_0xf912('0x7f'),_0x1aedca['id']);logger[_0xf912('0x2b')](_0xf912('0x78'),_0xf912('0x80'));emit(util[_0xf912('0x2e')](_0xf912('0x81'),_0x3318c3['name']),_0xf912('0x82'),{'uri':_0xf912('0x83')+_0x209167[_0xf912('0x74')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1aedca['id']});}})[_0xf912('0x27')](function(_0x6f4c4f){logger['error'](_0xf912('0x78'),JSON[_0xf912('0xd')](_0x6f4c4f));});};exports[_0xf912('0x6c')]=function(_0x4593d5,_0x1cd068,_0x574d37,_0x2247f3,_0x112b83,_0x28ed86,_0x503694){var _0x16ba3f,_0x58dbab,_0x29c8ef;_0x28ed86[_0xf912('0x74')]=intUtil[_0xf912('0x75')](_0x28ed86[_0xf912('0x74')]);_0x28ed86[_0xf912('0x76')]=intUtil[_0xf912('0x75')](_0x28ed86['serverUrl']);if(_0x503694&&_0x503694[_0xf912('0x84')]&&_0x503694[_0xf912('0x84')]!==_0xf912('0x85')){logger[_0xf912('0x2b')](_0xf912('0x86'),_0xf912('0x87'));_0x1cd068[_0xf912('0x7a')]=_0x28ed86['serverUrl']+_0xf912('0x88')+_0x1cd068[_0xf912('0x79')]+'/downloads?type=uniqueid&token='+md5(_0x1cd068[_0xf912('0x79')]);}var _0xcb0712=_0x28ed86[_0xf912('0x74')]===_0xf912('0x89')?'eu':_0xf912('0x7b');return getAccessToken(_0x28ed86)[_0xf912('0x25')](function(_0x1be156){_0x29c8ef=_0x1be156;return getUser(_0x29c8ef,_0xcb0712,_0x28ed86,_0x2247f3[_0xf912('0x8a')]);})[_0xf912('0x25')](function(_0x50d7d9){_0x16ba3f=_0x50d7d9;logger['info'](_0xf912('0x7c'),_0x16ba3f['id']);return getEndUser(_0x29c8ef,_0xcb0712,_0x28ed86,_0x1cd068[_0xf912('0x8b')],_0x1cd068[_0xf912('0x8c')],_0x16ba3f,_0x574d37);})['then'](function(_0xebed49){_0x58dbab=_0xebed49;return getCall(_0x29c8ef,_0xcb0712,_0x28ed86,_0x16ba3f,_0x58dbab,_0x574d37,_0x1cd068,_0xf912('0x8d'));})['then'](function(_0x57b1bc){if(_0x57b1bc){logger[_0xf912('0x2b')](_0xf912('0x7f'),_0x57b1bc['id']);logger[_0xf912('0x2b')](_0xf912('0x86'),_0xf912('0x80'));emit(util[_0xf912('0x2e')](_0xf912('0x81'),_0x2247f3['name']),_0xf912('0x82'),{'uri':_0xf912('0x83')+_0x28ed86[_0xf912('0x74')]+'/crm/EntityInfo.do?module=Calls&id='+_0x57b1bc['id']});}})[_0xf912('0x27')](function(_0x3c452f){logger[_0xf912('0x28')](_0xf912('0x86'),JSON[_0xf912('0xd')](_0x3c452f));});};exports[_0xf912('0x8e')]=function(_0x2b87ca,_0x1249af,_0x3e479a,_0x459567,_0x287509,_0x4a05af){var _0x1d0f96,_0x282c58,_0x1032a6;_0x4a05af[_0xf912('0x74')]=intUtil['stripTrailingSlash'](_0x4a05af[_0xf912('0x74')]);_0x4a05af[_0xf912('0x76')]=intUtil[_0xf912('0x75')](_0x4a05af[_0xf912('0x76')]);if(_0x287509&&_0x287509[_0xf912('0x77')]){logger[_0xf912('0x2b')]('['+_0x1249af[_0xf912('0x64')][_0xf912('0x8f')]()+']','Recording\x20is\x20enabled!');_0x1249af[_0xf912('0x7a')]=_0x4a05af[_0xf912('0x76')]+'/api/voice/recordings/'+_0x1249af[_0xf912('0x79')]+_0xf912('0x90')+md5(_0x1249af[_0xf912('0x79')]);}else{_0x1249af[_0xf912('0x7a')]='';}var _0x23e7d6=_0x4a05af['host']==='zoho.eu'?'eu':_0xf912('0x7b');return getAccessToken(_0x4a05af)[_0xf912('0x25')](function(_0x30c83f){_0x1032a6=_0x30c83f;return getUser(_0x1032a6,_0x23e7d6,_0x4a05af);})[_0xf912('0x25')](function(_0x44ec10){_0x1d0f96=_0x44ec10;logger[_0xf912('0x2b')]('The\x20User\x20ID\x20is:',_0x1d0f96['id']);return getEndUser(_0x1032a6,_0x23e7d6,_0x4a05af,_0x1249af[_0xf912('0x7d')],_0x1249af[_0xf912('0x7e')],_0x1d0f96,_0x3e479a);})['then'](function(_0x1135a9){_0x282c58=_0x1135a9;return getCall(_0x1032a6,_0x23e7d6,_0x4a05af,_0x1d0f96,_0x282c58,_0x3e479a,_0x1249af,_0xf912('0x6e'));})[_0xf912('0x25')](function(_0x2863d1){if(_0x2863d1){logger['info']('The\x20Call\x20ID\x20is:',_0x2863d1['id']);}})[_0xf912('0x27')](function(_0x4db038){logger['error']('['+_0x1249af[_0xf912('0x64')][_0xf912('0x8f')]()+']',JSON[_0xf912('0xd')](_0x4db038));});}; \ 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 04803cf..e23fad4 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 _0xca8c=['../../../../config/logger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs'];(function(_0x2e0c46,_0x4fbe9e){var _0x3912e9=function(_0x37b02d){while(--_0x37b02d){_0x2e0c46['push'](_0x2e0c46['shift']());}};_0x3912e9(++_0x4fbe9e);}(_0xca8c,0x196));var _0xcca8=function(_0x20ddb5,_0x139a30){_0x20ddb5=_0x20ddb5-0x0;var _0x463b48=_0xca8c[_0x20ddb5];return _0x463b48;};'use strict';var util=require(_0xcca8('0x0'));var sh=require(_0xcca8('0x1'));var Mustache=require('mustache');var logger=require(_0xcca8('0x2'))('trigger');exports['exec']=function(_0x5ad0c8,_0x5c430d){var _0x451305=_0x5ad0c8[_0xcca8('0x3')]?_0x5ad0c8[_0xcca8('0x3')]:_0xcca8('0x4');var _0x2cf1a3=_0x5ad0c8[_0xcca8('0x5')]?Mustache[_0xcca8('0x6')](_0x5ad0c8[_0xcca8('0x5')],_0x5c430d):_0x5c430d;sh[_0xcca8('0x7')](_0x2cf1a3,function(_0x2d0eb8,_0x4aedcc,_0x523b44){if(_0x2d0eb8!==0x0){logger['error'](util[_0xcca8('0x8')](_0xcca8('0x9'),_0x451305,_0x2cf1a3,_0x2d0eb8,_0x523b44));}else{logger[_0xcca8('0xa')](util[_0xcca8('0x8')](_0xcca8('0xb'),_0x451305,_0x2cf1a3,_0x4aedcc));}});}; \ No newline at end of file +var _0x6ca2=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','shelljs','mustache','trigger','exec','data2','Script','data3','render','error'];(function(_0x2a5173,_0xf1c539){var _0x27ed06=function(_0x22d441){while(--_0x22d441){_0x2a5173['push'](_0x2a5173['shift']());}};_0x27ed06(++_0xf1c539);}(_0x6ca2,0xff));var _0x26ca=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6ca2[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var sh=require(_0x26ca('0x0'));var Mustache=require(_0x26ca('0x1'));var logger=require('../../../../config/logger')(_0x26ca('0x2'));exports[_0x26ca('0x3')]=function(_0x5d3c17,_0x254f2c){var _0x3222ba=_0x5d3c17[_0x26ca('0x4')]?_0x5d3c17[_0x26ca('0x4')]:_0x26ca('0x5');var _0x3d4327=_0x5d3c17[_0x26ca('0x6')]?Mustache[_0x26ca('0x7')](_0x5d3c17[_0x26ca('0x6')],_0x254f2c):_0x254f2c;sh[_0x26ca('0x3')](_0x3d4327,function(_0x1147a7,_0x146ff3,_0x2a9ec6){if(_0x1147a7!==0x0){logger[_0x26ca('0x8')](util[_0x26ca('0x9')](_0x26ca('0xa'),_0x3222ba,_0x3d4327,_0x1147a7,_0x2a9ec6));}else{logger[_0x26ca('0xb')](util[_0x26ca('0x9')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x3222ba,_0x3d4327,_0x146ff3));}});}; \ 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 467f4bf..d9b4578 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 _0x0657=['POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2','data5','number','headers','parse','data6','error','stack','GET','DELETE'];(function(_0x540e8a,_0x43e90a){var _0x6ceed9=function(_0x165d53){while(--_0x165d53){_0x540e8a['push'](_0x540e8a['shift']());}};_0x6ceed9(++_0x43e90a);}(_0x0657,0x97));var _0x7065=function(_0x31af49,_0x3b1c83){_0x31af49=_0x31af49-0x0;var _0x18b215=_0x0657[_0x31af49];return _0x18b215;};'use strict';var rp=require(_0x7065('0x0'));var util=require(_0x7065('0x1'));var _=require(_0x7065('0x2'));var Mustache=require(_0x7065('0x3'));var logger=require('../../../../config/logger')(_0x7065('0x4'));exports[_0x7065('0x5')]=function(_0x3a9297,_0x4000d7){var _0xa2828,_0xce29f0;var _0xa4eab={'method':_0x3a9297[_0x7065('0x6')][_0x7065('0x7')](),'uri':Mustache[_0x7065('0x8')](_0x3a9297[_0x7065('0x9')],_0x4000d7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3a9297[_0x7065('0xa')])===_0x7065('0xb')&&parseInt(_0x3a9297['data5'])>=0x1&&parseInt(_0x3a9297['data5'])<=0xa?parseInt(_0x3a9297[_0x7065('0xa')])*0x3e8:0x5*0x3e8};try{_0xa4eab[_0x7065('0xc')]=_0x3a9297['data6']?JSON[_0x7065('0xd')](Mustache['render'](_0x3a9297[_0x7065('0xe')],_0x4000d7)):{};}catch(_0x47d61a){logger[_0x7065('0xf')](_0x47d61a[_0x7065('0x10')]);}switch(_0x3a9297['data1'][_0x7065('0x7')]()){case _0x7065('0x11'):case _0x7065('0x12'):_0xa2828=null;_0xa4eab['qs']=_0x4000d7;break;case _0x7065('0x13'):case'PUT':if(_0x3a9297[_0x7065('0x14')]){try{_0xa2828=JSON[_0x7065('0xd')](Mustache[_0x7065('0x8')](_0x3a9297['data7'],_0x4000d7));_0xa4eab[_0x7065('0x15')]=_0xa2828;}catch(_0x20192f){logger[_0x7065('0xf')](_0x20192f['stack']);logger['error'](_0x7065('0x16'));}}else{_0xa2828=_0x4000d7;_0xa4eab[_0x7065('0x15')]=_0xa2828;}break;}logger[_0x7065('0x17')](util[_0x7065('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3a9297[_0x7065('0x6')],_0x3a9297[_0x7065('0x9')],JSON[_0x7065('0x19')](_0xa4eab)));rp(_0xa4eab)[_0x7065('0x1a')](function(_0x1fe7fe){_0xa2828=!_[_0x7065('0x1b')](_0xa2828)?_0x7065('0x1c')+_0xa2828:'';_0xce29f0=typeof _0x1fe7fe[_0x7065('0x15')]===_0x7065('0x1d')?JSON['stringify'](_0x1fe7fe[_0x7065('0x15')]):_0x1fe7fe[_0x7065('0x15')];logger[_0x7065('0x17')](util[_0x7065('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x3a9297[_0x7065('0x6')],_0x3a9297[_0x7065('0x9')],_0x1fe7fe['statusCode'],_0xce29f0));})[_0x7065('0x1e')](function(_0x1a5d1b){logger[_0x7065('0xf')](util['format'](_0x7065('0x1f'),_0x3a9297['data1'],_0x3a9297['data2'],_0x1a5d1b['statusCode'],_0x1a5d1b[_0x7065('0x20')],_0x1a5d1b[_0x7065('0x21')]));});}; \ No newline at end of file +var _0x6728=['isNil',',\x20request\x20body:\x20','object','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','number','parse','data6','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','stringify','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6728,0x6c));var _0x8672=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x6728[_0x55d911];return _0x3104c2;};'use strict';var rp=require('request-promise');var util=require(_0x8672('0x0'));var _=require(_0x8672('0x1'));var Mustache=require('mustache');var logger=require(_0x8672('0x2'))(_0x8672('0x3'));exports[_0x8672('0x4')]=function(_0x146d8c,_0x1a13d5){var _0x5717cc,_0x315f13;var _0x1c1078={'method':_0x146d8c[_0x8672('0x5')][_0x8672('0x6')](),'uri':Mustache[_0x8672('0x7')](_0x146d8c[_0x8672('0x8')],_0x1a13d5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x146d8c[_0x8672('0x9')])===_0x8672('0xa')&&parseInt(_0x146d8c['data5'])>=0x1&&parseInt(_0x146d8c[_0x8672('0x9')])<=0xa?parseInt(_0x146d8c[_0x8672('0x9')])*0x3e8:0x5*0x3e8};try{_0x1c1078['headers']=_0x146d8c['data6']?JSON[_0x8672('0xb')](Mustache[_0x8672('0x7')](_0x146d8c[_0x8672('0xc')],_0x1a13d5)):{};}catch(_0xf1e7c6){logger['error'](_0xf1e7c6[_0x8672('0xd')]);}switch(_0x146d8c['data1']['toUpperCase']()){case _0x8672('0xe'):case _0x8672('0xf'):_0x5717cc=null;_0x1c1078['qs']=_0x1a13d5;break;case _0x8672('0x10'):case _0x8672('0x11'):if(_0x146d8c[_0x8672('0x12')]){try{_0x5717cc=JSON['parse'](Mustache[_0x8672('0x7')](_0x146d8c[_0x8672('0x12')],_0x1a13d5));_0x1c1078[_0x8672('0x13')]=_0x5717cc;}catch(_0x3cbe30){logger['error'](_0x3cbe30[_0x8672('0xd')]);logger[_0x8672('0x14')](_0x8672('0x15'));}}else{_0x5717cc=_0x1a13d5;_0x1c1078[_0x8672('0x13')]=_0x5717cc;}break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x146d8c[_0x8672('0x5')],_0x146d8c[_0x8672('0x8')],JSON[_0x8672('0x16')](_0x1c1078)));rp(_0x1c1078)[_0x8672('0x17')](function(_0x257ddb){_0x5717cc=!_[_0x8672('0x18')](_0x5717cc)?_0x8672('0x19')+_0x5717cc:'';_0x315f13=typeof _0x257ddb[_0x8672('0x13')]===_0x8672('0x1a')?JSON[_0x8672('0x16')](_0x257ddb[_0x8672('0x13')]):_0x257ddb[_0x8672('0x13')];logger['info'](util[_0x8672('0x1b')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x146d8c[_0x8672('0x5')],_0x146d8c[_0x8672('0x8')],_0x257ddb[_0x8672('0x1c')],_0x315f13));})[_0x8672('0x1d')](function(_0x2af510){logger[_0x8672('0x14')](util[_0x8672('0x1b')](_0x8672('0x1e'),_0x146d8c[_0x8672('0x5')],_0x146d8c[_0x8672('0x8')],_0x2af510[_0x8672('0x1c')],_0x2af510[_0x8672('0x1f')],_0x2af510[_0x8672('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 5166d47..3669b5a 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 _0x898c=['catch','exports','jayson/promise','../../config/logger','client','Request','request','then','debug','rpc','routing','error','message','result'];(function(_0x57a906,_0x583eb2){var _0x3ab80d=function(_0x34d81c){while(--_0x34d81c){_0x57a906['push'](_0x57a906['shift']());}};_0x3ab80d(++_0x583eb2);}(_0x898c,0x64));var _0xc898=function(_0x35a779,_0x27f8fb){_0x35a779=_0x35a779-0x0;var _0xca723b=_0x898c[_0x35a779];return _0xca723b;};'use strict';var jayson=require(_0xc898('0x0'));var BPromise=require('bluebird');var logger=require(_0xc898('0x1'))('routing');var client=jayson[_0xc898('0x2')]['http']({'port':0x2329});client[_0xc898('0x3')]=function(_0x525eb8,_0x170661){return new BPromise(function(_0x480fcc,_0x49b0a4){return client[_0xc898('0x4')](_0x525eb8,_0x170661)[_0xc898('0x5')](function(_0x2fc3c6){logger[_0xc898('0x6')](_0xc898('0x7'),_0xc898('0x8'),_0x525eb8,_0x170661,_0x2fc3c6);if(_0x2fc3c6[_0xc898('0x9')]){logger[_0xc898('0x9')](_0xc898('0x7'),_0xc898('0x8'),_0x525eb8,_0x2fc3c6[_0xc898('0x9')][_0xc898('0xa')],_0x170661);return _0x49b0a4(_0x2fc3c6[_0xc898('0x9')]['message']);}else{return _0x480fcc(_0x2fc3c6[_0xc898('0xb')]);}})[_0xc898('0xc')](function(_0x4ea47e){logger['error'](_0xc898('0x7'),_0xc898('0x8'),_0x525eb8,_0x4ea47e,_0x170661);return _0x49b0a4(_0x4ea47e);});});};module[_0xc898('0xd')]=client; \ No newline at end of file +var _0xd701=['http','Request','request','then','debug','rpc','error','message','result','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x49e4dc,_0x4b2ac8){var _0x319b1d=function(_0x2ec9ad){while(--_0x2ec9ad){_0x49e4dc['push'](_0x49e4dc['shift']());}};_0x319b1d(++_0x4b2ac8);}(_0xd701,0x168));var _0x1d70=function(_0x475d32,_0x45102b){_0x475d32=_0x475d32-0x0;var _0x3adbd3=_0xd701[_0x475d32];return _0x3adbd3;};'use strict';var jayson=require(_0x1d70('0x0'));var BPromise=require(_0x1d70('0x1'));var logger=require(_0x1d70('0x2'))(_0x1d70('0x3'));var client=jayson['client'][_0x1d70('0x4')]({'port':0x2329});client[_0x1d70('0x5')]=function(_0x43303f,_0x215219){return new BPromise(function(_0x11d7ce,_0x3eb3b1){return client[_0x1d70('0x6')](_0x43303f,_0x215219)[_0x1d70('0x7')](function(_0xa07670){logger[_0x1d70('0x8')](_0x1d70('0x9'),_0x1d70('0x3'),_0x43303f,_0x215219,_0xa07670);if(_0xa07670['error']){logger['error'](_0x1d70('0x9'),_0x1d70('0x3'),_0x43303f,_0xa07670[_0x1d70('0xa')][_0x1d70('0xb')],_0x215219);return _0x3eb3b1(_0xa07670['error'][_0x1d70('0xb')]);}else{return _0x11d7ce(_0xa07670[_0x1d70('0xc')]);}})['catch'](function(_0x4b8a6c){logger[_0x1d70('0xa')]('rpc',_0x1d70('0x3'),_0x43303f,_0x4b8a6c,_0x215219);return _0x3eb3b1(_0x4b8a6c);});});};module[_0x1d70('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8d80f46..f253200 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 _0xd42b=['./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen','loginMailFrequency','error','Email\x20service\x20initialization'];(function(_0x38f6ee,_0xf06a6c){var _0x49aeef=function(_0x1f1262){while(--_0x1f1262){_0x38f6ee['push'](_0x38f6ee['shift']());}};_0x49aeef(++_0xf06a6c);}(_0xd42b,0xc3));var _0xbd42=function(_0x279368,_0x41c002){_0x279368=_0x279368-0x0;var _0x40b6d0=_0xd42b[_0x279368];return _0x40b6d0;};'use strict';var server=require(_0xbd42('0x0'));var Realtime=require(_0xbd42('0x1'));var EmailChannel=require(_0xbd42('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xbd42('0x3'));var logger=require(_0xbd42('0x4'))(_0xbd42('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xbd42('0x6')]()[_0xbd42('0x7')](mailAccount[_0xbd42('0x8')]())[_0xbd42('0x7')](realtime[_0xbd42('0x9')]())[_0xbd42('0x7')](function(){email[_0xbd42('0xa')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xbd42('0xb')](realtime,email)[_0xbd42('0x7')](function(){return initRealtime();})[_0xbd42('0x7')](function(){return setting['getSettings']();})['then'](function(_0x4923b2){return setInterval(initRealtime,_0x4923b2[_0xbd42('0xc')]*0x3e8);})['catch'](function(_0x2b4789){logger[_0xbd42('0xd')](_0xbd42('0xe'),_0x2b4789);});}main(); \ No newline at end of file +var _0x18dc=['resolve','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./realtime','./rpc/mailAccount','./rpc/setting','../../config/logger','email'];(function(_0x4df78b,_0xd7466c){var _0x5abffe=function(_0x3d353d){while(--_0x3d353d){_0x4df78b['push'](_0x4df78b['shift']());}};_0x5abffe(++_0xd7466c);}(_0x18dc,0x1bd));var _0xc18d=function(_0x588053,_0x16bdda){_0x588053=_0x588053-0x0;var _0x3f822d=_0x18dc[_0x588053];return _0x3f822d;};'use strict';var server=require('./server');var Realtime=require(_0xc18d('0x0'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xc18d('0x1'));var setting=require(_0xc18d('0x2'));var logger=require(_0xc18d('0x3'))(_0xc18d('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xc18d('0x5')]()['then'](mailAccount['getMailAccounts']())[_0xc18d('0x6')](realtime[_0xc18d('0x7')]())[_0xc18d('0x6')](function(){email[_0xc18d('0x8')](realtime[_0xc18d('0x9')]);return realtime;});}function main(){return server[_0xc18d('0xa')](realtime,email)['then'](function(){return initRealtime();})[_0xc18d('0x6')](function(){return setting[_0xc18d('0xb')]();})[_0xc18d('0x6')](function(_0x5239d5){return setInterval(initRealtime,_0x5239d5[_0xc18d('0xc')]*0x3e8);})[_0xc18d('0xd')](function(_0x13334f){logger['error'](_0xc18d('0xe'),_0x13334f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 1cd4571..74c2972 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 _0x3582=['localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','key','active','Imap','status','isNil','stringify','md5','mailAccount:update','prototype','service','provider','hasOwnProperty','box','bind','handleImapEmail','end','error','handleImapError','disabled','connected','messageStatus','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','sendMail','send','verifySmtp','Smtp','lastSync','verify','verified','lodash','bluebird','../../../config/environment','email','redis','defaults'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x3582,0xde));var _0x2358=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3582[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2358('0x0'));var moment=require('moment');var BPromise=require(_0x2358('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x2358('0x2'));var logger=require('../../../config/logger')(_0x2358('0x3'));config[_0x2358('0x4')]=_[_0x2358('0x5')](config[_0x2358('0x4')],{'host':_0x2358('0x6'),'port':0x18eb});var io=require(_0x2358('0x7'))(new Redis(config[_0x2358('0x4')]));var EmailImap=require(_0x2358('0x8'));var EmailSmtp=require(_0x2358('0x9'));var mailAccount=require(_0x2358('0xa'));var md5Accounts={};function EmailChannel(_0x173adc){logger['info'](_0x2358('0xb'));this[_0x2358('0xc')]=_0x173adc[_0x2358('0xc')];this[_0x2358('0xd')]={};this[_0x2358('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x2358('0xf')]=function(_0x130606){var _0x44a1a1=this[_0x2358('0xc')][_0x130606];var _0x1806c0={'id':_0x44a1a1['id'],'name':_0x44a1a1['name'],'key':_0x44a1a1[_0x2358('0x10')],'active':_0x44a1a1[_0x2358('0x11')],'Imap':{'status':_0x44a1a1[_0x2358('0x12')][_0x2358('0x13')],'messageStatus':_0x44a1a1[_0x2358('0x12')]['messageStatus'],'total':_0x44a1a1[_0x2358('0x12')]['total']}};if(_[_0x2358('0x14')](md5Accounts[_0x130606])){md5Accounts[_0x130606]={};}var _0xbee406=md5(JSON[_0x2358('0x15')](_0x1806c0));if(md5Accounts[_0x130606][_0x2358('0x16')]!==_0xbee406){md5Accounts[_0x130606][_0x2358('0x16')]=_0xbee406;io['emit'](_0x2358('0x17'),_0x1806c0);}};EmailChannel[_0x2358('0x18')]['refresh']=function(_0x2cced7){for(var _0x4592c8 in _0x2cced7){if(_0x2cced7['hasOwnProperty'](_0x4592c8)){if(_0x2cced7[_0x4592c8]['Imap']&&_0x2cced7[_0x4592c8][_0x2358('0x11')]){var _0x19dcbd=_0x2cced7[_0x4592c8][_0x2358('0x12')];if(!_0x19dcbd[_0x2358('0x19')]&&_0x2cced7[_0x4592c8]['provider']!=='custom')_0x19dcbd[_0x2358('0x19')]=_0x2cced7[_0x4592c8][_0x2358('0x1a')];if(!this[_0x2358('0xd')][_0x2358('0x1b')](_0x19dcbd['id'])){this[_0x2358('0xd')][_0x19dcbd['id']]=new EmailImap(_0x19dcbd,_0x2cced7[_0x4592c8]['email']);this[_0x2358('0xd')][_0x19dcbd['id']]['on'](_0x2358('0x1c'),this['handleImapBox'][_0x2358('0x1d')](this,_0x4592c8));this[_0x2358('0xd')][_0x19dcbd['id']]['on']('email',this[_0x2358('0x1e')][_0x2358('0x1d')](this,_0x4592c8));this[_0x2358('0xd')][_0x19dcbd['id']]['on'](_0x2358('0x1f'),this['handleImapEnd'][_0x2358('0x1d')](this,_0x4592c8));this[_0x2358('0xd')][_0x19dcbd['id']]['on'](_0x2358('0x20'),this[_0x2358('0x21')][_0x2358('0x1d')](this,_0x4592c8));}}else{if(_[_0x2358('0x14')](this[_0x2358('0xc')][_0x4592c8][_0x2358('0x12')])){this[_0x2358('0xc')][_0x4592c8][_0x2358('0x12')]={};}this['mailAccounts'][_0x4592c8][_0x2358('0x12')][_0x2358('0x13')]=_0x2358('0x22');this[_0x2358('0xc')][_0x4592c8][_0x2358('0x12')]['messageStatus']='';this[_0x2358('0xf')](_0x4592c8);}}}};EmailChannel[_0x2358('0x18')]['handleImapBox']=function(_0x4f1345,_0x30ec67){if(this[_0x2358('0xc')][_0x4f1345]){this[_0x2358('0xc')][_0x4f1345][_0x2358('0x12')]['status']=_0x2358('0x23');this[_0x2358('0xc')][_0x4f1345][_0x2358('0x12')][_0x2358('0x24')]=_0x30ec67['name'];if(_0x30ec67[_0x2358('0x25')]){this[_0x2358('0xc')][_0x4f1345]['Imap'][_0x2358('0x26')]=_0x30ec67[_0x2358('0x25')][_0x2358('0x26')];}return this[_0x2358('0xf')](_0x4f1345);}};EmailChannel[_0x2358('0x18')]['handleImapEmail']=function(_0x3b71d2,_0x4d0cfd){logger['info'](_0x2358('0x27'),_0x4d0cfd[_0x2358('0x28')],_0x4d0cfd[_0x2358('0x29')],_0x4d0cfd[_0x2358('0x2a')],_0x3b71d2);if(this['mailAccounts'][_0x3b71d2]){return mailAccount[_0x2358('0x2b')](_0x3b71d2,_0x4d0cfd)[_0x2358('0x2c')](function(_0x7a4191){if(_0x7a4191){logger[_0x2358('0x2d')](_0x2358('0x2e'));}})[_0x2358('0x2f')](function(_0x44441a){logger[_0x2358('0x20')](_0x2358('0x30'),JSON['stringify'](_0x44441a));});}};EmailChannel['prototype'][_0x2358('0x31')]=function(_0x5ef964){if(this['mailAccounts'][_0x5ef964]&&this['mailAccounts'][_0x5ef964]['Imap']){if(this['imapAccounts'][this[_0x2358('0xc')][_0x5ef964]['Imap']['id']]){delete this['imapAccounts'][this[_0x2358('0xc')][_0x5ef964][_0x2358('0x12')]['id']];}this[_0x2358('0xc')][_0x5ef964][_0x2358('0x12')]['lastSync']=moment();this['emit'](_0x5ef964);}};EmailChannel[_0x2358('0x18')][_0x2358('0x21')]=function(_0x3c5f2f,_0x50b11c){if(this[_0x2358('0xc')][_0x3c5f2f]){this[_0x2358('0xc')][_0x3c5f2f][_0x2358('0x12')][_0x2358('0x13')]=_0x2358('0x20');this[_0x2358('0xc')][_0x3c5f2f][_0x2358('0x12')][_0x2358('0x24')]=_0x50b11c;return this[_0x2358('0xf')](_0x3c5f2f);}};EmailChannel[_0x2358('0x18')][_0x2358('0x32')]=function(_0x2711a1,_0x40e79e){return this[_0x2358('0xe')][_0x2358('0x33')](_0x2711a1,_0x40e79e);};EmailChannel[_0x2358('0x18')][_0x2358('0x34')]=function(_0x11a5b2){var _0x152ccb=this;if(this[_0x2358('0xc')][_0x11a5b2['id']]){if(_[_0x2358('0x14')](this[_0x2358('0xc')][_0x11a5b2['id']][_0x2358('0x35')])){this[_0x2358('0xc')][_0x11a5b2['id']][_0x2358('0x35')]={};}this[_0x2358('0xc')][_0x11a5b2['id']]['Smtp'][_0x2358('0x36')]=moment();return new BPromise(function(_0x1dcd0b,_0x386f60){return _0x152ccb[_0x2358('0xe')][_0x2358('0x37')](_0x11a5b2)[_0x2358('0x2c')](function(_0x5e8ca0){_0x152ccb[_0x2358('0xc')][_0x11a5b2['id']][_0x2358('0x35')]['status']=_0x2358('0x38');_0x152ccb['mailAccounts'][_0x11a5b2['id']]['Smtp'][_0x2358('0x24')]='';_0x152ccb[_0x2358('0xf')](_0x11a5b2['id']);_0x1dcd0b(_0x5e8ca0);})['catch'](function(_0x359754){_0x152ccb[_0x2358('0xc')][_0x11a5b2['id']]['Smtp'][_0x2358('0x13')]=_0x2358('0x20');_0x152ccb['mailAccounts'][_0x11a5b2['id']]['Smtp'][_0x2358('0x24')]=_0x359754;_0x152ccb[_0x2358('0xf')](_0x11a5b2['id']);_0x386f60(_0x359754);});});}return this[_0x2358('0xe')]['verify'](_0x11a5b2);};module['exports']=EmailChannel; \ No newline at end of file +var _0xffa1=['moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','total','isNil','emit','mailAccount:update','refresh','hasOwnProperty','custom','service','imapAccounts','box','handleImapBox','handleImapEmail','end','handleImapEnd','bind','error','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash'];(function(_0xf20f83,_0x1e5f2f){var _0x2409df=function(_0x5ed28b){while(--_0x5ed28b){_0xf20f83['push'](_0xf20f83['shift']());}};_0x2409df(++_0x1e5f2f);}(_0xffa1,0x11c));var _0x1ffa=function(_0x5efbc4,_0x2a1ff7){_0x5efbc4=_0x5efbc4-0x0;var _0x459b16=_0xffa1[_0x5efbc4];return _0x459b16;};'use strict';var _=require(_0x1ffa('0x0'));var moment=require(_0x1ffa('0x1'));var BPromise=require(_0x1ffa('0x2'));var md5=require(_0x1ffa('0x3'));var Redis=require(_0x1ffa('0x4'));var config=require(_0x1ffa('0x5'));var logger=require('../../../config/logger')(_0x1ffa('0x6'));config['redis']=_[_0x1ffa('0x7')](config[_0x1ffa('0x8')],{'host':_0x1ffa('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1ffa('0x8')]));var EmailImap=require(_0x1ffa('0xa'));var EmailSmtp=require(_0x1ffa('0xb'));var mailAccount=require(_0x1ffa('0xc'));var md5Accounts={};function EmailChannel(_0x44910d){logger[_0x1ffa('0xd')](_0x1ffa('0xe'));this[_0x1ffa('0xf')]=_0x44910d[_0x1ffa('0xf')];this['imapAccounts']={};this[_0x1ffa('0x10')]=new EmailSmtp();}EmailChannel[_0x1ffa('0x11')]['emit']=function(_0x185aa2){var _0x539a2c=this[_0x1ffa('0xf')][_0x185aa2];var _0x1af25d={'id':_0x539a2c['id'],'name':_0x539a2c[_0x1ffa('0x12')],'key':_0x539a2c[_0x1ffa('0x13')],'active':_0x539a2c[_0x1ffa('0x14')],'Imap':{'status':_0x539a2c[_0x1ffa('0x15')][_0x1ffa('0x16')],'messageStatus':_0x539a2c[_0x1ffa('0x15')][_0x1ffa('0x17')],'total':_0x539a2c[_0x1ffa('0x15')][_0x1ffa('0x18')]}};if(_[_0x1ffa('0x19')](md5Accounts[_0x185aa2])){md5Accounts[_0x185aa2]={};}var _0x203329=md5(JSON['stringify'](_0x1af25d));if(md5Accounts[_0x185aa2][_0x1ffa('0x3')]!==_0x203329){md5Accounts[_0x185aa2][_0x1ffa('0x3')]=_0x203329;io[_0x1ffa('0x1a')](_0x1ffa('0x1b'),_0x1af25d);}};EmailChannel[_0x1ffa('0x11')][_0x1ffa('0x1c')]=function(_0x44cdda){for(var _0x9718d1 in _0x44cdda){if(_0x44cdda[_0x1ffa('0x1d')](_0x9718d1)){if(_0x44cdda[_0x9718d1][_0x1ffa('0x15')]&&_0x44cdda[_0x9718d1]['active']){var _0x24f6f4=_0x44cdda[_0x9718d1]['Imap'];if(!_0x24f6f4['service']&&_0x44cdda[_0x9718d1]['provider']!==_0x1ffa('0x1e'))_0x24f6f4[_0x1ffa('0x1f')]=_0x44cdda[_0x9718d1]['provider'];if(!this['imapAccounts'][_0x1ffa('0x1d')](_0x24f6f4['id'])){this[_0x1ffa('0x20')][_0x24f6f4['id']]=new EmailImap(_0x24f6f4,_0x44cdda[_0x9718d1][_0x1ffa('0x6')]);this[_0x1ffa('0x20')][_0x24f6f4['id']]['on'](_0x1ffa('0x21'),this[_0x1ffa('0x22')]['bind'](this,_0x9718d1));this[_0x1ffa('0x20')][_0x24f6f4['id']]['on'](_0x1ffa('0x6'),this[_0x1ffa('0x23')]['bind'](this,_0x9718d1));this[_0x1ffa('0x20')][_0x24f6f4['id']]['on'](_0x1ffa('0x24'),this[_0x1ffa('0x25')][_0x1ffa('0x26')](this,_0x9718d1));this['imapAccounts'][_0x24f6f4['id']]['on'](_0x1ffa('0x27'),this['handleImapError'][_0x1ffa('0x26')](this,_0x9718d1));}}else{if(_[_0x1ffa('0x19')](this[_0x1ffa('0xf')][_0x9718d1][_0x1ffa('0x15')])){this[_0x1ffa('0xf')][_0x9718d1][_0x1ffa('0x15')]={};}this[_0x1ffa('0xf')][_0x9718d1][_0x1ffa('0x15')][_0x1ffa('0x16')]=_0x1ffa('0x28');this[_0x1ffa('0xf')][_0x9718d1]['Imap'][_0x1ffa('0x17')]='';this['emit'](_0x9718d1);}}}};EmailChannel[_0x1ffa('0x11')]['handleImapBox']=function(_0x568b39,_0x27fcab){if(this[_0x1ffa('0xf')][_0x568b39]){this[_0x1ffa('0xf')][_0x568b39][_0x1ffa('0x15')]['status']='connected';this[_0x1ffa('0xf')][_0x568b39][_0x1ffa('0x15')][_0x1ffa('0x17')]=_0x27fcab['name'];if(_0x27fcab['messages']){this['mailAccounts'][_0x568b39][_0x1ffa('0x15')][_0x1ffa('0x18')]=_0x27fcab[_0x1ffa('0x29')][_0x1ffa('0x18')];}return this[_0x1ffa('0x1a')](_0x568b39);}};EmailChannel['prototype'][_0x1ffa('0x23')]=function(_0x2598fb,_0x1f24f8){logger[_0x1ffa('0xd')](_0x1ffa('0x2a'),_0x1f24f8[_0x1ffa('0x2b')],_0x1f24f8['lastName'],_0x1f24f8[_0x1ffa('0x2c')],_0x2598fb);if(this['mailAccounts'][_0x2598fb]){return mailAccount[_0x1ffa('0x2d')](_0x2598fb,_0x1f24f8)[_0x1ffa('0x2e')](function(_0x204b85){if(_0x204b85){logger[_0x1ffa('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x1ffa('0x2f')](function(_0x599657){logger['error'](_0x1ffa('0x30'),JSON['stringify'](_0x599657));});}};EmailChannel[_0x1ffa('0x11')][_0x1ffa('0x25')]=function(_0x597ca9){if(this[_0x1ffa('0xf')][_0x597ca9]&&this[_0x1ffa('0xf')][_0x597ca9][_0x1ffa('0x15')]){if(this[_0x1ffa('0x20')][this['mailAccounts'][_0x597ca9][_0x1ffa('0x15')]['id']]){delete this[_0x1ffa('0x20')][this[_0x1ffa('0xf')][_0x597ca9][_0x1ffa('0x15')]['id']];}this[_0x1ffa('0xf')][_0x597ca9][_0x1ffa('0x15')][_0x1ffa('0x31')]=moment();this[_0x1ffa('0x1a')](_0x597ca9);}};EmailChannel[_0x1ffa('0x11')]['handleImapError']=function(_0x385c2e,_0x393307){if(this[_0x1ffa('0xf')][_0x385c2e]){this[_0x1ffa('0xf')][_0x385c2e][_0x1ffa('0x15')]['status']=_0x1ffa('0x27');this[_0x1ffa('0xf')][_0x385c2e][_0x1ffa('0x15')][_0x1ffa('0x17')]=_0x393307;return this['emit'](_0x385c2e);}};EmailChannel[_0x1ffa('0x11')][_0x1ffa('0x32')]=function(_0x396bba,_0x3a7068){return this[_0x1ffa('0x10')][_0x1ffa('0x33')](_0x396bba,_0x3a7068);};EmailChannel[_0x1ffa('0x11')][_0x1ffa('0x34')]=function(_0x818e85){var _0x30f615=this;if(this[_0x1ffa('0xf')][_0x818e85['id']]){if(_[_0x1ffa('0x19')](this[_0x1ffa('0xf')][_0x818e85['id']][_0x1ffa('0x35')])){this['mailAccounts'][_0x818e85['id']][_0x1ffa('0x35')]={};}this[_0x1ffa('0xf')][_0x818e85['id']][_0x1ffa('0x35')]['lastSync']=moment();return new BPromise(function(_0x28edd7,_0x10eee4){return _0x30f615['smtp'][_0x1ffa('0x36')](_0x818e85)[_0x1ffa('0x2e')](function(_0x3a0489){_0x30f615['mailAccounts'][_0x818e85['id']][_0x1ffa('0x35')]['status']=_0x1ffa('0x37');_0x30f615[_0x1ffa('0xf')][_0x818e85['id']][_0x1ffa('0x35')]['messageStatus']='';_0x30f615['emit'](_0x818e85['id']);_0x28edd7(_0x3a0489);})['catch'](function(_0x1f3206){_0x30f615['mailAccounts'][_0x818e85['id']][_0x1ffa('0x35')][_0x1ffa('0x16')]=_0x1ffa('0x27');_0x30f615[_0x1ffa('0xf')][_0x818e85['id']][_0x1ffa('0x35')][_0x1ffa('0x17')]=_0x1f3206;_0x30f615[_0x1ffa('0x1a')](_0x818e85['id']);_0x10eee4(_0x1f3206);});});}return this['smtp']['verify'](_0x818e85);};module[_0x1ffa('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index dbb352f..47cfcf9 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 _0x53ec=['modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','service','email','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','handleFetchMessage','handleFetchError','closeBox','body','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','error','handleError','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required'];(function(_0x83cdb,_0x5625cd){var _0x41e803=function(_0x21d80f){while(--_0x21d80f){_0x83cdb['push'](_0x83cdb['shift']());}};_0x41e803(++_0x5625cd);}(_0x53ec,0x192));var _0xc53e=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0x53ec[_0x151334];return _0x3d03da;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var Imap=require(_0xc53e('0x2'));var simpleParser=require(_0xc53e('0x3'))[_0xc53e('0x4')];var Iconv=require(_0xc53e('0x5'))['Iconv'];var EventEmitter=require(_0xc53e('0x6'))['EventEmitter'];var utils=require(_0xc53e('0x7'));var logger=require(_0xc53e('0x8'))('email');function EmailImap(_0x2f1414,_0x4f989b){this[_0xc53e('0x9')]=_0xc53e('0xa');this['account']=this[_0xc53e('0xb')](_0x2f1414,_0x4f989b);this[_0xc53e('0x2')]=new Imap(this[_0xc53e('0xc')]);this[_0xc53e('0x2')][_0xc53e('0xd')](_0xc53e('0xe'),this[_0xc53e('0xf')][_0xc53e('0x10')](this));this[_0xc53e('0x2')]['once']('end',this[_0xc53e('0x11')]['bind'](this));this['imap']['on'](_0xc53e('0x12'),this[_0xc53e('0x13')][_0xc53e('0x10')](this));this[_0xc53e('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xc53e('0x14')][_0xc53e('0xb')]=function(_0x7cd798,_0x3d2e17){var _0x358ef3={'connTimeout':_0x7cd798[_0xc53e('0x15')]?_0x7cd798[_0xc53e('0x15')]*0x3e8:0x2710,'authTimeout':_0x7cd798[_0xc53e('0x16')]?_0x7cd798[_0xc53e('0x16')]*0x3e8:0x1388};if(_[_0xc53e('0x17')](_0x7cd798['service'])){if(_0x7cd798[_0xc53e('0x18')]){_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];_0x358ef3[_0xc53e('0x1a')]=_0x7cd798[_0xc53e('0x1a')];}_0x358ef3[_0xc53e('0x1b')]=_0x7cd798[_0xc53e('0x1b')];_0x358ef3[_0xc53e('0x1c')]=_0x7cd798[_0xc53e('0x1c')]||0x3e1;if(_0x7cd798['tls']){_0x358ef3['tls']=!![];}else{_0x358ef3[_0xc53e('0x1d')]=![];_0x358ef3[_0xc53e('0x1e')]=_0xc53e('0x1f');}}else{if(_0x7cd798[_0xc53e('0x20')]){_0x358ef3[_0xc53e('0x21')]=utils[_0xc53e('0x22')](_0x7cd798[_0xc53e('0x23')][_0xc53e('0x24')],_0x7cd798[_0xc53e('0x19')]);_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];}else{_0x358ef3[_0xc53e('0x19')]=_0x7cd798[_0xc53e('0x19')];_0x358ef3['password']=_0x7cd798['password'];}_0x358ef3['host']=utils[_0xc53e('0x25')](_0x7cd798[_0xc53e('0x26')]);_0x358ef3[_0xc53e('0x1c')]=0x3e1;_0x358ef3[_0xc53e('0x1d')]=!![];}_0x358ef3[_0xc53e('0x27')]=_0x3d2e17||_0x7cd798['user']||'anonymous@xcally.com';return _0x358ef3;};EmailImap[_0xc53e('0x14')]['handleReady']=function(){this[_0xc53e('0x2')][_0xc53e('0x28')](this[_0xc53e('0x9')],![],this[_0xc53e('0x29')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x29')]=function(_0x4b9f6a,_0x4d9a68){if(_0x4b9f6a){this['handleError'](_0x4b9f6a,!![]);}else{this[_0xc53e('0x2a')]('box',_0x4d9a68);this[_0xc53e('0x2b')]();}};EmailImap['prototype'][_0xc53e('0x2c')]=function(_0x5112d2){if(_0x5112d2){this['handleError'](_0x5112d2,!![]);}else{this[_0xc53e('0x2')][_0xc53e('0x2d')]();}};EmailImap[_0xc53e('0x14')][_0xc53e('0x2b')]=function(){this[_0xc53e('0x2')][_0xc53e('0x2e')]([_0xc53e('0x2f')],this[_0xc53e('0x30')]['bind'](this));};EmailImap[_0xc53e('0x14')][_0xc53e('0x30')]=function(_0x2d36c0,_0x56206b){if(_0x2d36c0){this[_0xc53e('0x13')](_0x2d36c0,!![]);}else{if(_0x56206b['length']){try{var _0x4572e=this[_0xc53e('0x2')]['fetch'](_0x56206b,{'bodies':'','markSeen':!![]});_0x4572e['on']('message',this[_0xc53e('0x31')][_0xc53e('0x10')](this));_0x4572e[_0xc53e('0xd')](_0xc53e('0x12'),this[_0xc53e('0x32')][_0xc53e('0x10')](this));_0x4572e[_0xc53e('0xd')](_0xc53e('0x2d'),this['handleFetchEnd'][_0xc53e('0x10')](this));}catch(_0x3bae8a){logger[_0xc53e('0x12')](_0x3bae8a);}}else{this[_0xc53e('0x2')][_0xc53e('0x33')](!![],this[_0xc53e('0x2c')][_0xc53e('0x10')](this));}}};EmailImap[_0xc53e('0x14')][_0xc53e('0x31')]=function(_0x595efb){_0x595efb['on'](_0xc53e('0x34'),this['handleMessageBody'][_0xc53e('0x10')](this));_0x595efb[_0xc53e('0xd')]('attributes',this[_0xc53e('0x35')][_0xc53e('0x10')](this));_0x595efb[_0xc53e('0xd')]('end',this[_0xc53e('0x36')][_0xc53e('0x10')](this));};EmailImap[_0xc53e('0x14')][_0xc53e('0x37')]=function(_0xeaec72){simpleParser(_0xeaec72,{'Iconv':Iconv},this[_0xc53e('0x38')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x35')]=function(){};EmailImap[_0xc53e('0x14')][_0xc53e('0x36')]=function(){};EmailImap['prototype'][_0xc53e('0x38')]=function(_0x5e8ab7,_0xaa00cd){if(_0x5e8ab7){logger[_0xc53e('0x12')](_0x5e8ab7);}else{var _0x40c4f5=this;utils[_0xc53e('0x39')](this[_0xc53e('0xc')],_0xaa00cd,function(_0x5507d0){_0x40c4f5[_0xc53e('0x2a')](_0xc53e('0x27'),_0x5507d0);});}};EmailImap['prototype']['handleFetchEnd']=function(){this['imap']['closeBox'](!![],this[_0xc53e('0x2c')][_0xc53e('0x10')](this));};EmailImap['prototype'][_0xc53e('0x32')]=function(_0x574983){this['handleError'](_0x574983);this['imap'][_0xc53e('0x33')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xc53e('0x14')]['handleEnd']=function(){this[_0xc53e('0x2a')](_0xc53e('0x2d'));};EmailImap['prototype'][_0xc53e('0x13')]=function(_0x3a4ebc,_0x509a04){logger[_0xc53e('0x12')]('handleError',this['account']['email'],JSON['stringify'](_0x3a4ebc));var _0x887d78='';if(_0x3a4ebc){if(_0x3a4ebc[_0xc53e('0x3a')]){_0x887d78=_0x3a4ebc[_0xc53e('0x3a')];}else{for(var _0x5f1884 in _0x3a4ebc){if(_0x3a4ebc[_0xc53e('0x3b')](_0x5f1884)){_0x887d78+=_[_0xc53e('0x3c')](_0x5f1884)+':\x20'+_0x3a4ebc[_0x5f1884]+'\x0a';}}}}if(_0x509a04){this['imap']['end']();}else{this[_0xc53e('0x2a')](_0xc53e('0x12'),_0x887d78);this[_0xc53e('0x2a')]('end');}};module[_0xc53e('0x3d')]=EmailImap; \ No newline at end of file +var _0xd8fb=['box','readUnseen','handleCloseBox','end','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleEnd','account','stringify','upperFirst','emit','exports','lodash','util','imap','mailparser','events','EventEmitter','../../../config/logger','email','INBOX','getAccount','once','ready','handleReady','bind','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','xoauth2','generateXOAuth2Token','CloudProvider','data5','getHost','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','handleError'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2eca50,_0x50d7f7){_0x2eca50=_0x2eca50-0x0;var _0x394fb8=_0xd8fb[_0x2eca50];return _0x394fb8;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var Imap=require(_0xbd8f('0x2'));var simpleParser=require(_0xbd8f('0x3'))['simpleParser'];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0xbd8f('0x4'))[_0xbd8f('0x5')];var utils=require('./utils');var logger=require(_0xbd8f('0x6'))(_0xbd8f('0x7'));function EmailImap(_0x5543b2,_0x33d541){this['mailbox']=_0xbd8f('0x8');this['account']=this[_0xbd8f('0x9')](_0x5543b2,_0x33d541);this[_0xbd8f('0x2')]=new Imap(this['account']);this['imap'][_0xbd8f('0xa')](_0xbd8f('0xb'),this[_0xbd8f('0xc')]['bind'](this));this[_0xbd8f('0x2')][_0xbd8f('0xa')]('end',this['handleEnd'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')]['on'](_0xbd8f('0xe'),this['handleError'][_0xbd8f('0xd')](this));this[_0xbd8f('0x2')][_0xbd8f('0xf')]();}util[_0xbd8f('0x10')](EmailImap,EventEmitter);EmailImap[_0xbd8f('0x11')][_0xbd8f('0x9')]=function(_0x37d4d5,_0x29ffe8){var _0x14606c={'connTimeout':_0x37d4d5['connTimeout']?_0x37d4d5[_0xbd8f('0x12')]*0x3e8:0x2710,'authTimeout':_0x37d4d5[_0xbd8f('0x13')]?_0x37d4d5[_0xbd8f('0x13')]*0x3e8:0x1388};if(_[_0xbd8f('0x14')](_0x37d4d5['service'])){if(_0x37d4d5[_0xbd8f('0x15')]){_0x14606c[_0xbd8f('0x16')]=_0x37d4d5['user'];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c['host']=_0x37d4d5[_0xbd8f('0x18')];_0x14606c[_0xbd8f('0x19')]=_0x37d4d5['port']||0x3e1;if(_0x37d4d5['tls']){_0x14606c[_0xbd8f('0x1a')]=!![];}else{_0x14606c['tls']=![];_0x14606c['autotls']=_0xbd8f('0x1b');}}else{if(_0x37d4d5['modernAuthentication']){_0x14606c[_0xbd8f('0x1c')]=utils[_0xbd8f('0x1d')](_0x37d4d5[_0xbd8f('0x1e')][_0xbd8f('0x1f')],_0x37d4d5[_0xbd8f('0x16')]);_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];}else{_0x14606c[_0xbd8f('0x16')]=_0x37d4d5[_0xbd8f('0x16')];_0x14606c[_0xbd8f('0x17')]=_0x37d4d5[_0xbd8f('0x17')];}_0x14606c[_0xbd8f('0x18')]=utils[_0xbd8f('0x20')](_0x37d4d5[_0xbd8f('0x21')]);_0x14606c[_0xbd8f('0x19')]=0x3e1;_0x14606c[_0xbd8f('0x1a')]=!![];}_0x14606c[_0xbd8f('0x7')]=_0x29ffe8||_0x37d4d5['user']||_0xbd8f('0x22');return _0x14606c;};EmailImap[_0xbd8f('0x11')][_0xbd8f('0xc')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x23')](this[_0xbd8f('0x24')],![],this[_0xbd8f('0x25')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x25')]=function(_0x421f3e,_0x5a3a8c){if(_0x421f3e){this[_0xbd8f('0x26')](_0x421f3e,!![]);}else{this['emit'](_0xbd8f('0x27'),_0x5a3a8c);this[_0xbd8f('0x28')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x29')]=function(_0x2aefa2){if(_0x2aefa2){this[_0xbd8f('0x26')](_0x2aefa2,!![]);}else{this['imap'][_0xbd8f('0x2a')]();}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x28')]=function(){this[_0xbd8f('0x2')][_0xbd8f('0x2b')]([_0xbd8f('0x2c')],this[_0xbd8f('0x2d')]['bind'](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x2d')]=function(_0xb9214c,_0x7ca145){if(_0xb9214c){this['handleError'](_0xb9214c,!![]);}else{if(_0x7ca145['length']){try{var _0x1c2274=this[_0xbd8f('0x2')][_0xbd8f('0x2e')](_0x7ca145,{'bodies':'','markSeen':!![]});_0x1c2274['on'](_0xbd8f('0x2f'),this['handleFetchMessage'][_0xbd8f('0xd')](this));_0x1c2274[_0xbd8f('0xa')](_0xbd8f('0xe'),this[_0xbd8f('0x30')][_0xbd8f('0xd')](this));_0x1c2274['once'](_0xbd8f('0x2a'),this[_0xbd8f('0x31')][_0xbd8f('0xd')](this));}catch(_0x3949c2){logger[_0xbd8f('0xe')](_0x3949c2);}}else{this['imap'][_0xbd8f('0x32')](!![],this['handleCloseBox'][_0xbd8f('0xd')](this));}}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x33')]=function(_0x386a29){_0x386a29['on'](_0xbd8f('0x34'),this[_0xbd8f('0x35')]['bind'](this));_0x386a29['once']('attributes',this[_0xbd8f('0x36')][_0xbd8f('0xd')](this));_0x386a29[_0xbd8f('0xa')](_0xbd8f('0x2a'),this[_0xbd8f('0x37')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x35')]=function(_0x2d4882){simpleParser(_0x2d4882,{'Iconv':Iconv},this[_0xbd8f('0x38')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x36')]=function(){};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x37')]=function(){};EmailImap['prototype'][_0xbd8f('0x38')]=function(_0x4181e0,_0x47f9cd){if(_0x4181e0){logger[_0xbd8f('0xe')](_0x4181e0);}else{var _0x40204a=this;utils[_0xbd8f('0x39')](this['account'],_0x47f9cd,function(_0x21da54){_0x40204a['emit'](_0xbd8f('0x7'),_0x21da54);});}};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x31')]=function(){this['imap'][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap['prototype'][_0xbd8f('0x30')]=function(_0x3d82ef){this[_0xbd8f('0x26')](_0x3d82ef);this[_0xbd8f('0x2')][_0xbd8f('0x32')](!![],this[_0xbd8f('0x29')][_0xbd8f('0xd')](this));};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x3a')]=function(){this['emit']('end');};EmailImap[_0xbd8f('0x11')][_0xbd8f('0x26')]=function(_0x353e34,_0x2f014b){logger['error'](_0xbd8f('0x26'),this[_0xbd8f('0x3b')][_0xbd8f('0x7')],JSON[_0xbd8f('0x3c')](_0x353e34));var _0x753f0='';if(_0x353e34){if(_0x353e34['textCode']){_0x753f0=_0x353e34['textCode'];}else{for(var _0x44776c in _0x353e34){if(_0x353e34['hasOwnProperty'](_0x44776c)){_0x753f0+=_[_0xbd8f('0x3d')](_0x44776c)+':\x20'+_0x353e34[_0x44776c]+'\x0a';}}}}if(_0x2f014b){this[_0xbd8f('0x2')][_0xbd8f('0x2a')]();}else{this[_0xbd8f('0x3e')](_0xbd8f('0xe'),_0x753f0);this[_0xbd8f('0x3e')](_0xbd8f('0x2a'));}};module[_0xbd8f('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index cb5a335..c117a38 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 _0x5887=['createTransport','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send'];(function(_0x14c00f,_0x11b192){var _0x19fbda=function(_0xf9caa4){while(--_0xf9caa4){_0x14c00f['push'](_0x14c00f['shift']());}};_0x19fbda(++_0x11b192);}(_0x5887,0x192));var _0x7588=function(_0x549ffa,_0x4011d9){_0x549ffa=_0x549ffa-0x0;var _0x378324=_0x5887[_0x549ffa];return _0x378324;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x7588('0x0'));function EmailSmtp(){}EmailSmtp[_0x7588('0x1')][_0x7588('0x2')]=function(_0x1669d4,_0x1d22e1){return new Promise(function(_0x8b22c8,_0x520c65){var _0x424f27=nodemailer[_0x7588('0x3')](_0x1669d4);_0x424f27['use']('compile',inlineBase64());_0x424f27[_0x7588('0x4')](_0x1d22e1,function(_0x52c4b3,_0x261ce5){if(_0x52c4b3){_0x520c65(_0x52c4b3[_0x7588('0x5')]());}else{_0x8b22c8(_0x261ce5);}});});};EmailSmtp[_0x7588('0x1')][_0x7588('0x6')]=function(_0x3a7fec){return new Promise(function(_0x54f2c8,_0x304425){var _0x152ba4=nodemailer[_0x7588('0x3')](_0x3a7fec);_0x152ba4['verify'](function(_0x709890,_0x29af42){if(_0x709890){_0x304425(_0x709890['toString']());}else{if(_0x29af42){_0x54f2c8(_0x29af42);}else{_0x304425(_0x7588('0x7'));}}});});};module[_0x7588('0x8')]=EmailSmtp; \ No newline at end of file +var _0xdc21=['prototype','send','use','compile','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64'];(function(_0x275561,_0x18158e){var _0x43dabb=function(_0x4e6aac){while(--_0x4e6aac){_0x275561['push'](_0x275561['shift']());}};_0x43dabb(++_0x18158e);}(_0xdc21,0x18a));var _0x1dc2=function(_0x24d534,_0xaedd7d){_0x24d534=_0x24d534-0x0;var _0x3dd92e=_0xdc21[_0x24d534];return _0x3dd92e;};'use strict';var nodemailer=require(_0x1dc2('0x0'));var inlineBase64=require(_0x1dc2('0x1'));function EmailSmtp(){}EmailSmtp[_0x1dc2('0x2')][_0x1dc2('0x3')]=function(_0x4892c7,_0x5a2beb){return new Promise(function(_0x32d823,_0x53d7d4){var _0x381d93=nodemailer['createTransport'](_0x4892c7);_0x381d93[_0x1dc2('0x4')](_0x1dc2('0x5'),inlineBase64());_0x381d93['sendMail'](_0x5a2beb,function(_0x4b2c4f,_0x152771){if(_0x4b2c4f){_0x53d7d4(_0x4b2c4f[_0x1dc2('0x6')]());}else{_0x32d823(_0x152771);}});});};EmailSmtp[_0x1dc2('0x2')]['verify']=function(_0xf98339){return new Promise(function(_0x29dfea,_0xbdfa9e){var _0x3c3fbe=nodemailer['createTransport'](_0xf98339);_0x3c3fbe[_0x1dc2('0x7')](function(_0xa6deb2,_0xdeb45a){if(_0xa6deb2){_0xbdfa9e(_0xa6deb2[_0x1dc2('0x6')]());}else{if(_0xdeb45a){_0x29dfea(_0xdeb45a);}else{_0xbdfa9e(_0x1dc2('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 506c95c..2e54c94 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 _0x65b9=['head','value','address','anonymous','generate','name','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','@xcally.com','html','test','replace','includes','','body','textAsHtml','message','originTo','email','originCc','bcc','attachments','attach','type','attachment','format','%s-%s','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply','parser','from','subject','messageId','inReplyTo','date','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','generateXOAuth2Token','user=','auth=Bearer\x20','base64','lodash','path','node-tnef','../../../config/logger','../../../config/environment'];(function(_0x1dae94,_0x239003){var _0x36ce2d=function(_0x295f18){while(--_0x295f18){_0x1dae94['push'](_0x1dae94['shift']());}};_0x36ce2d(++_0x239003);}(_0x65b9,0x1db));var _0x965b=function(_0x56ffae,_0x16ac0f){_0x56ffae=_0x56ffae-0x0;var _0x532acd=_0x65b9[_0x56ffae];return _0x532acd;};'use strict';var _=require(_0x965b('0x0'));var moment=require('moment');var random=require('randomstring');var fs=require('fs');var path=require(_0x965b('0x1'));var util=require('util');var tnef=require(_0x965b('0x2'));var logger=require(_0x965b('0x3'))('email');var config=require(_0x965b('0x4'));function getAddress(_0x18d9d5){var _0x12e4ac=_[_0x965b('0x5')](_0x18d9d5[_0x965b('0x6')]);return _0x12e4ac&&_0x12e4ac[_0x965b('0x7')]?_0x12e4ac[_0x965b('0x7')]:_0x965b('0x8')+random[_0x965b('0x9')](0x6)+'@xcally.com';}function getFirstName(_0x4c213a){var _0x10a337=_['head'](_0x4c213a['value']);if(_0x10a337&&_0x10a337[_0x965b('0xa')]){if(_0x10a337[_0x965b('0xa')]==_0x10a337[_0x965b('0x7')]){return _0x10a337['name']['substring'](0x0,_0x10a337['name'][_0x965b('0xb')]('@'));}var _0x2c5890=_0x10a337[_0x965b('0xa')][_0x965b('0xc')](/\s+/);return _0x2c5890[_0x965b('0xd')]>0x1?_0x2c5890[_0x965b('0xe')](0x0,-0x1)[_0x965b('0xf')]('\x20'):_0x10a337[_0x965b('0xa')];}return _0x965b('0x10');}function getLastName(_0x224929){var _0x39c589=_[_0x965b('0x5')](_0x224929[_0x965b('0x6')]);if(_0x39c589&&_0x39c589[_0x965b('0xa')]){var _0x5504e8=_0x39c589[_0x965b('0xa')][_0x965b('0xc')](/\s+/);return _0x5504e8['length']>0x1?_0x5504e8[_0x965b('0x11')]():'';}return'';}function getMails(_0x58c75a,_0x41cfe7){var _0x468d6e='';for(var _0x3ad0b3=0x0;_0x3ad0b3<_0x41cfe7[_0x965b('0x6')][_0x965b('0xd')];_0x3ad0b3+=0x1){if(_0x41cfe7[_0x965b('0x6')][_0x3ad0b3]['address']!==_0x58c75a){if(!_[_0x965b('0x12')](_0x468d6e)){_0x468d6e+=',';}_0x468d6e+=_0x41cfe7['value'][_0x3ad0b3]['name']||_0x41cfe7['value'][_0x3ad0b3][_0x965b('0x7')]||'';_0x468d6e+='\x20<';_0x468d6e+=_0x41cfe7['value'][_0x3ad0b3][_0x965b('0x7')]?_0x41cfe7[_0x965b('0x6')][_0x3ad0b3][_0x965b('0x7')]:'anonymous'+random[_0x965b('0x9')](0x6)+_0x965b('0x13');_0x468d6e+='>';}}return _0x468d6e;}function parseEmail(_0xb529f6,_0x5476ce,_0x577a3a){if(_0x5476ce[_0x965b('0x14')]){var _0x436838=/)<[^<]*)*<\/script>/gi;while(_0x436838[_0x965b('0x15')](_0x5476ce[_0x965b('0x14')])){_0x5476ce[_0x965b('0x14')]=_0x5476ce[_0x965b('0x14')][_0x965b('0x16')](_0x436838,'');}if(_0x5476ce[_0x965b('0x14')][_0x965b('0x17')](_0x965b('0x18'))){var _0x4b7866=[];_0x5476ce['attachments'][_0x965b('0x19')](_0x261ba3=>{_0x4b7866[_0x965b('0x1a')](_0x261ba3[_0x965b('0x1b')]);});var _0x42e545=/]+>/g;var _0x109855=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x506a2b=_0x5476ce[_0x965b('0x14')][_0x965b('0x16')](_0x109855,_0x965b('0x1c'));var _0x469763=_0x506a2b[_0x965b('0x16')](_0x42e545,_0x965b('0x1d'));for(let _0x1c3b23=0x0;_0x1c3b23<_0x4b7866[_0x965b('0xd')];_0x1c3b23++){var _0x4bbcbb=_0x469763[_0x965b('0x16')](_0x965b('0x1d'),'\x20[Attachment:\x20'+_0x4b7866[_0x1c3b23]+_0x965b('0x1e'));_0x469763=_0x4bbcbb;}_0x5476ce[_0x965b('0x14')]=_0x469763;}_0x577a3a[_0x965b('0x1f')]=_0x5476ce[_0x965b('0x14')];}else{_0x577a3a[_0x965b('0x1f')]=_0x5476ce[_0x965b('0x20')];}if(_0x577a3a['body']){_0x577a3a[_0x965b('0x1f')]=_0x577a3a[_0x965b('0x1f')]['replace'](/0x0){var _0x2dc7b2=[_0x965b('0x31'),_0x965b('0x32'),_0x965b('0x33')];for(var _0x5ec489=0x0;_0x5ec489<_0x5476ce[_0x965b('0x30')][_0x965b('0xd')];_0x5ec489++){var _0x56b629=_['indexOf'](_0x2dc7b2,_0x5476ce['headerLines'][_0x5ec489]['line']);if(_0x56b629>=0x0){_0x577a3a[_0x965b('0x34')]=!![];}}}return _0x577a3a;}exports[_0x965b('0x35')]=function(_0x53fe78,_0x59da9d,_0x9890c0){var _0x2b64c2={'from':getAddress(_0x59da9d['from']),'firstName':getFirstName(_0x59da9d[_0x965b('0x36')]),'lastName':getLastName(_0x59da9d['from']),'mapKey':_0x965b('0x23'),'message':{'from':getMails(_0x53fe78[_0x965b('0x23')],_0x59da9d[_0x965b('0x36')]),'to':_0x53fe78[_0x965b('0x23')],'cc':'','subject':_0x59da9d[_0x965b('0x37')]||'','messageId':_0x59da9d[_0x965b('0x38')],'inReplyTo':_0x59da9d[_0x965b('0x39')],'sentAt':moment(_0x59da9d[_0x965b('0x3a')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x59da9d['html']&&!_0x59da9d[_0x965b('0x20')]){var _0x221dc1=_[_0x965b('0x3b')](_0x59da9d[_0x965b('0x26')],{'contentType':_0x965b('0x3c')});if(_0x221dc1[_0x965b('0xd')]){logger[_0x965b('0x3d')](util[_0x965b('0x2a')](_0x965b('0x3e'),_0x59da9d[_0x965b('0x38')]));tnef[_0x965b('0x3f')](_[_0x965b('0x40')](_0x221dc1)['content'],function(_0x17416a,_0x4416a6){if(_0x4416a6){_0x59da9d['html']=_0x4416a6[_0x965b('0x41')]||_0x965b('0x42');if(_0x4416a6[_0x965b('0x43')]){for(var _0x332417=0x0;_0x332417<_0x4416a6[_0x965b('0x43')][_0x965b('0xd')];_0x332417++){var _0x2a1ae5=_0x4416a6[_0x965b('0x43')][_0x332417];_0x2b64c2[_0x965b('0x21')][_0x965b('0x26')][_0x965b('0x1a')]({'filename':_0x2a1ae5[_0x965b('0x44')],'content':Buffer[_0x965b('0x36')](_0x2a1ae5[_0x965b('0x45')])});}}}_0x9890c0(parseEmail(_0x53fe78,_0x59da9d,_0x2b64c2));});}else{_0x59da9d[_0x965b('0x14')]=_0x965b('0x42');_0x9890c0(parseEmail(_0x53fe78,_0x59da9d,_0x2b64c2));}}else{_0x9890c0(parseEmail(_0x53fe78,_0x59da9d,_0x2b64c2));}};exports[_0x965b('0x46')]=function(_0x499565){switch(_0x499565){case'gmail':return'imap.gmail.com';case _0x965b('0x47'):return _0x965b('0x48');case'hotmail':return _0x965b('0x49');case _0x965b('0x4a'):return _0x965b('0x4b');}return'127.0.0.1';};exports[_0x965b('0x4c')]=function(_0x100543,_0x246157){var _0x511fe7=[_0x965b('0x4d')+(_0x246157||''),_0x965b('0x4e')+_0x100543,'',''];return Buffer[_0x965b('0x36')](_0x511fe7[_0x965b('0xf')](''),'utf-8')['toString'](_0x965b('0x4f'));}; \ No newline at end of file +var _0x767b=['name','indexOf','length','slice','Anonymous','pop','value','isEmpty','html','test','replace','\x20[Attachment:\x20','\x20]','body','Empty\x20message

','Attachments','Title','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','base64','lodash','moment','randomstring','path','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com'];(function(_0x5624c2,_0x53a1b9){var _0x1deb8e=function(_0x15aa75){while(--_0x15aa75){_0x5624c2['push'](_0x5624c2['shift']());}};_0x1deb8e(++_0x53a1b9);}(_0x767b,0xde));var _0xb767=function(_0x15e950,_0x1db756){_0x15e950=_0x15e950-0x0;var _0x3425e5=_0x767b[_0x15e950];return _0x3425e5;};'use strict';var _=require(_0xb767('0x0'));var moment=require(_0xb767('0x1'));var random=require(_0xb767('0x2'));var fs=require('fs');var path=require(_0xb767('0x3'));var util=require('util');var tnef=require('node-tnef');var logger=require(_0xb767('0x4'))(_0xb767('0x5'));var config=require(_0xb767('0x6'));function getAddress(_0xaf1893){var _0x5549e1=_[_0xb767('0x7')](_0xaf1893['value']);return _0x5549e1&&_0x5549e1['address']?_0x5549e1[_0xb767('0x8')]:_0xb767('0x9')+random[_0xb767('0xa')](0x6)+_0xb767('0xb');}function getFirstName(_0x250631){var _0x6e00ce=_[_0xb767('0x7')](_0x250631['value']);if(_0x6e00ce&&_0x6e00ce[_0xb767('0xc')]){if(_0x6e00ce[_0xb767('0xc')]==_0x6e00ce[_0xb767('0x8')]){return _0x6e00ce['name']['substring'](0x0,_0x6e00ce[_0xb767('0xc')][_0xb767('0xd')]('@'));}var _0xab1ef3=_0x6e00ce[_0xb767('0xc')]['split'](/\s+/);return _0xab1ef3[_0xb767('0xe')]>0x1?_0xab1ef3[_0xb767('0xf')](0x0,-0x1)['join']('\x20'):_0x6e00ce[_0xb767('0xc')];}return _0xb767('0x10');}function getLastName(_0x45564d){var _0x3f036a=_[_0xb767('0x7')](_0x45564d['value']);if(_0x3f036a&&_0x3f036a[_0xb767('0xc')]){var _0x531256=_0x3f036a[_0xb767('0xc')]['split'](/\s+/);return _0x531256['length']>0x1?_0x531256[_0xb767('0x11')]():'';}return'';}function getMails(_0x5355da,_0xacdf2e){var _0x3068b2='';for(var _0x1747f2=0x0;_0x1747f2<_0xacdf2e['value'][_0xb767('0xe')];_0x1747f2+=0x1){if(_0xacdf2e[_0xb767('0x12')][_0x1747f2][_0xb767('0x8')]!==_0x5355da){if(!_[_0xb767('0x13')](_0x3068b2)){_0x3068b2+=',';}_0x3068b2+=_0xacdf2e[_0xb767('0x12')][_0x1747f2]['name']||_0xacdf2e[_0xb767('0x12')][_0x1747f2][_0xb767('0x8')]||'';_0x3068b2+='\x20<';_0x3068b2+=_0xacdf2e[_0xb767('0x12')][_0x1747f2][_0xb767('0x8')]?_0xacdf2e['value'][_0x1747f2][_0xb767('0x8')]:_0xb767('0x9')+random['generate'](0x6)+'@xcally.com';_0x3068b2+='>';}}return _0x3068b2;}function parseEmail(_0x293680,_0x567545,_0x38c3c7){if(_0x567545[_0xb767('0x14')]){var _0x2fe739=/)<[^<]*)*<\/script>/gi;while(_0x2fe739[_0xb767('0x15')](_0x567545['html'])){_0x567545[_0xb767('0x14')]=_0x567545[_0xb767('0x14')][_0xb767('0x16')](_0x2fe739,'');}if(_0x567545[_0xb767('0x14')]['includes'](_0xb767('0x17'))){var _0x54d3e4=[];_0x567545[_0xb767('0x18')][_0xb767('0x19')](_0xcfb5be=>{_0x54d3e4['push'](_0xcfb5be[_0xb767('0x1a')]);});var _0xadf40d=/]+>/g;var _0x589628=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x33aca7=_0x567545[_0xb767('0x14')]['replace'](_0x589628,_0xb767('0x1b'));var _0x52e141=_0x33aca7[_0xb767('0x16')](_0xadf40d,_0xb767('0x1c'));for(let _0x1785df=0x0;_0x1785df<_0x54d3e4[_0xb767('0xe')];_0x1785df++){var _0x4db706=_0x52e141[_0xb767('0x16')]('_IMG',_0xb767('0x1d')+_0x54d3e4[_0x1785df]+_0xb767('0x1e'));_0x52e141=_0x4db706;}_0x567545[_0xb767('0x14')]=_0x52e141;}_0x38c3c7[_0xb767('0x1f')]=_0x567545['html'];}else{_0x38c3c7['body']=_0x567545['textAsHtml'];}if(_0x38c3c7[_0xb767('0x1f')]){_0x38c3c7[_0xb767('0x1f')]=_0x38c3c7[_0xb767('0x1f')][_0xb767('0x16')](/0x0){var _0x4f2e15=[_0xb767('0x32'),_0xb767('0x33'),_0xb767('0x34')];for(var _0x4326f5=0x0;_0x4326f5<_0x567545[_0xb767('0x31')][_0xb767('0xe')];_0x4326f5++){var _0x35a5a4=_[_0xb767('0xd')](_0x4f2e15,_0x567545[_0xb767('0x31')][_0x4326f5]['line']);if(_0x35a5a4>=0x0){_0x38c3c7['isAutoreply']=!![];}}}return _0x38c3c7;}exports[_0xb767('0x35')]=function(_0x315ad0,_0x18b683,_0x55ad35){var _0x2f5625={'from':getAddress(_0x18b683[_0xb767('0x36')]),'firstName':getFirstName(_0x18b683[_0xb767('0x36')]),'lastName':getLastName(_0x18b683[_0xb767('0x36')]),'mapKey':_0xb767('0x5'),'message':{'from':getMails(_0x315ad0['email'],_0x18b683[_0xb767('0x36')]),'to':_0x315ad0[_0xb767('0x5')],'cc':'','subject':_0x18b683[_0xb767('0x37')]||'','messageId':_0x18b683['messageId'],'inReplyTo':_0x18b683['inReplyTo'],'sentAt':moment(_0x18b683['date'])[_0xb767('0x2a')](_0xb767('0x38')),'attach':![],'attachments':[]}};if(!_0x18b683[_0xb767('0x14')]&&!_0x18b683[_0xb767('0x39')]){var _0x5cddd4=_['filter'](_0x18b683[_0xb767('0x18')],{'contentType':_0xb767('0x3a')});if(_0x5cddd4[_0xb767('0xe')]){logger['info'](util['format'](_0xb767('0x3b'),_0x18b683['messageId']));tnef['parseBuffer'](_['first'](_0x5cddd4)[_0xb767('0x2e')],function(_0x4b8864,_0x3a8e5d){if(_0x3a8e5d){_0x18b683[_0xb767('0x14')]=_0x3a8e5d[_0xb767('0x3c')]||_0xb767('0x3d');if(_0x3a8e5d[_0xb767('0x3e')]){for(var _0x2dfaf7=0x0;_0x2dfaf7<_0x3a8e5d[_0xb767('0x3e')][_0xb767('0xe')];_0x2dfaf7++){var _0x5ef0ba=_0x3a8e5d['Attachments'][_0x2dfaf7];_0x2f5625['message']['attachments'][_0xb767('0x2f')]({'filename':_0x5ef0ba[_0xb767('0x3f')],'content':Buffer[_0xb767('0x36')](_0x5ef0ba['Data'])});}}}_0x55ad35(parseEmail(_0x315ad0,_0x18b683,_0x2f5625));});}else{_0x18b683[_0xb767('0x14')]=_0xb767('0x3d');_0x55ad35(parseEmail(_0x315ad0,_0x18b683,_0x2f5625));}}else{_0x55ad35(parseEmail(_0x315ad0,_0x18b683,_0x2f5625));}};exports['getHost']=function(_0x36d7db){switch(_0x36d7db){case _0xb767('0x40'):return _0xb767('0x41');case _0xb767('0x42'):return _0xb767('0x43');case _0xb767('0x44'):return'imap-mail.outlook.com';case _0xb767('0x45'):return _0xb767('0x46');}return _0xb767('0x47');};exports[_0xb767('0x48')]=function(_0x568058,_0xfffc23){var _0x4a5a41=[_0xb767('0x49')+(_0xfffc23||''),_0xb767('0x4a')+_0x568058,'',''];return Buffer[_0xb767('0x36')](_0x4a5a41[_0xb767('0x4b')](''),_0xb767('0x4c'))['toString'](_0xb767('0x4d'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index b709598..0315193 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 _0xac35=['key','SERV','active','Imap','Smtp','exports','lodash','name'];(function(_0x453e2b,_0x4f1258){var _0x50f306=function(_0x397f14){while(--_0x397f14){_0x453e2b['push'](_0x453e2b['shift']());}};_0x50f306(++_0x4f1258);}(_0xac35,0x1ee));var _0x5ac3=function(_0x539228,_0x2168c9){_0x539228=_0x539228-0x0;var _0x59aa15=_0xac35[_0x539228];return _0x59aa15;};'use strict';var _=require(_0x5ac3('0x0'));function MailAccount(_0x5b42fa){this['id']=_0x5b42fa['id']||0x0;this[_0x5ac3('0x1')]=_0x5b42fa[_0x5ac3('0x1')]||'Service';this['key']=_0x5b42fa[_0x5ac3('0x2')]||_0x5ac3('0x3');this[_0x5ac3('0x4')]=_0x5b42fa['active']||![];this['Imap']=_0x5b42fa[_0x5ac3('0x5')]||[];this['Smtp']=_0x5b42fa[_0x5ac3('0x6')]||[];}module[_0x5ac3('0x7')]=MailAccount; \ No newline at end of file +var _0x4460=['key','SERV','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x420619,_0x1b6fc9){var _0x2737d9=function(_0x5e2a05){while(--_0x5e2a05){_0x420619['push'](_0x420619['shift']());}};_0x2737d9(++_0x1b6fc9);}(_0x4460,0x9f));var _0x0446=function(_0x28896b,_0xbd4c7f){_0x28896b=_0x28896b-0x0;var _0x2b9293=_0x4460[_0x28896b];return _0x2b9293;};'use strict';var _=require(_0x0446('0x0'));function MailAccount(_0x3f73cb){this['id']=_0x3f73cb['id']||0x0;this[_0x0446('0x1')]=_0x3f73cb[_0x0446('0x1')]||_0x0446('0x2');this['key']=_0x3f73cb[_0x0446('0x3')]||_0x0446('0x4');this[_0x0446('0x5')]=_0x3f73cb['active']||![];this[_0x0446('0x6')]=_0x3f73cb['Imap']||[];this[_0x0446('0x7')]=_0x3f73cb['Smtp']||[];}module[_0x0446('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 38a3817..4066bbe 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 _0x4f45=['lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports'];(function(_0x1db481,_0x1627b2){var _0x3db95b=function(_0x2d54e4){while(--_0x2d54e4){_0x1db481['push'](_0x1db481['shift']());}};_0x3db95b(++_0x1627b2);}(_0x4f45,0xa8));var _0x54f4=function(_0x68c8aa,_0x1ceff0){_0x68c8aa=_0x68c8aa-0x0;var _0x4ad0d9=_0x4f45[_0x68c8aa];return _0x4ad0d9;};'use strict';var _=require(_0x54f4('0x0'));var MailAccount=require(_0x54f4('0x1'));var Realtime=function(){this[_0x54f4('0x2')]={};};function freeIsNotKey(_0x3ddf96,_0x306239,_0x40fa74){var _0x395fae=_[_0x54f4('0x3')](_0x3ddf96,function(_0x5762a5,_0x133fa7){return _0x5762a5[_0x40fa74];});for(var _0x458c83 in _0x306239){if(_0x306239[_0x54f4('0x4')](_0x458c83)){if(!_0x395fae[_0x458c83]){delete _0x306239[_0x458c83];}}}}Realtime[_0x54f4('0x5')][_0x54f4('0x6')]=function(_0x1e2f99,_0xbc9d0c){for(var _0x4effdf in _0xbc9d0c){if(_0x1e2f99[_0x54f4('0x4')](_0x4effdf)){_0x1e2f99[_0x4effdf]=_0xbc9d0c[_0x4effdf];}}};Realtime[_0x54f4('0x5')][_0x54f4('0x7')]=function(){var _0x24ae45=this;return function(_0x161fd9){if(_0x161fd9){freeIsNotKey(_0x161fd9,_0x24ae45[_0x54f4('0x2')],'id');for(var _0xd82abc=0x0,_0x43e975={},_0x289dc4={};_0xd82abc<_0x161fd9[_0x54f4('0x8')];_0xd82abc+=0x1){_0x43e975=_0x161fd9[_0xd82abc];if(_[_0x54f4('0x9')](_0x24ae45[_0x54f4('0x2')][_0x43e975['id']])){_0x24ae45[_0x54f4('0x2')][_0x43e975['id']]=new MailAccount(_0x43e975);}else{_[_0x54f4('0xa')](_0x24ae45[_0x54f4('0x2')][_0x43e975['id']],_0x43e975);}}}return _0x24ae45[_0x54f4('0x2')];};};module[_0x54f4('0xb')]=Realtime; \ No newline at end of file +var _0x7bc0=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x3eb4bb,_0x1b1c6d){var _0xa9427d=function(_0x3d2f61){while(--_0x3d2f61){_0x3eb4bb['push'](_0x3eb4bb['shift']());}};_0xa9427d(++_0x1b1c6d);}(_0x7bc0,0x9c));var _0x07bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bc0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07bc('0x0'));var MailAccount=require(_0x07bc('0x1'));var Realtime=function(){this[_0x07bc('0x2')]={};};function freeIsNotKey(_0x2fedfe,_0x54c3b8,_0x4c3c5b){var _0x4272ce=_[_0x07bc('0x3')](_0x2fedfe,function(_0x200799,_0x1128af){return _0x200799[_0x4c3c5b];});for(var _0x333a2e in _0x54c3b8){if(_0x54c3b8[_0x07bc('0x4')](_0x333a2e)){if(!_0x4272ce[_0x333a2e]){delete _0x54c3b8[_0x333a2e];}}}}Realtime[_0x07bc('0x5')][_0x07bc('0x6')]=function(_0x28c3c9,_0x1f9e69){for(var _0x4ce3f5 in _0x1f9e69){if(_0x28c3c9[_0x07bc('0x4')](_0x4ce3f5)){_0x28c3c9[_0x4ce3f5]=_0x1f9e69[_0x4ce3f5];}}};Realtime[_0x07bc('0x5')][_0x07bc('0x7')]=function(){var _0x2578a9=this;return function(_0x414679){if(_0x414679){freeIsNotKey(_0x414679,_0x2578a9[_0x07bc('0x2')],'id');for(var _0x43a420=0x0,_0x3bf0f4={},_0x755eae={};_0x43a420<_0x414679['length'];_0x43a420+=0x1){_0x3bf0f4=_0x414679[_0x43a420];if(_[_0x07bc('0x8')](_0x2578a9[_0x07bc('0x2')][_0x3bf0f4['id']])){_0x2578a9['mailAccounts'][_0x3bf0f4['id']]=new MailAccount(_0x3bf0f4);}else{_['merge'](_0x2578a9[_0x07bc('0x2')][_0x3bf0f4['id']],_0x3bf0f4);}}}return _0x2578a9[_0x07bc('0x2')];};};module[_0x07bc('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 210fde9..f707de2 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 _0x8208=['MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','ListId','TemplateId'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x8208,0x14b));var _0x8820=function(_0x4716e7,_0x4b3dca){_0x4716e7=_0x4716e7-0x0;var _0x1b58ce=_0x8208[_0x4716e7];return _0x1b58ce;};'use strict';var client=require(_0x8820('0x0'));exports[_0x8820('0x1')]=function(){return function(){return client[_0x8820('0x2')](_0x8820('0x3'),{'options':{'attributes':['id',_0x8820('0x4'),_0x8820('0x5'),_0x8820('0x6'),_0x8820('0x7'),_0x8820('0x8'),'key',_0x8820('0x9'),_0x8820('0xa')],'raw':![],'include':[{'model':_0x8820('0xb'),'as':_0x8820('0xc'),'include':[{'model':_0x8820('0xd'),'attributes':['id',_0x8820('0x4'),'service',_0x8820('0xe'),_0x8820('0xf')],'as':'CloudProvider'}]},{'model':_0x8820('0x10'),'as':'Smtp','include':[{'model':'CloudProvider','attributes':['id',_0x8820('0x4'),_0x8820('0x6'),'type',_0x8820('0xf')],'as':'CloudProvider'}]}]},'log':_0x8820('0x11')});};};exports['notify']=function(_0x56b860,_0x381719){return client[_0x8820('0x2')](_0x8820('0x12'),{'account':{'id':_0x56b860},'body':_0x381719,'log':_0x8820('0x12')});}; \ No newline at end of file +var _0x2133=['CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x472378,_0x327f94){var _0x4c1e48=function(_0x300b1c){while(--_0x300b1c){_0x472378['push'](_0x472378['shift']());}};_0x4c1e48(++_0x327f94);}(_0x2133,0x1d1));var _0x3213=function(_0x4b5609,_0x5df15a){_0x4b5609=_0x4b5609-0x0;var _0x51431f=_0x2133[_0x4b5609];return _0x51431f;};'use strict';var client=require('../client');exports[_0x3213('0x0')]=function(){return function(){return client[_0x3213('0x1')](_0x3213('0x2'),{'options':{'attributes':['id',_0x3213('0x3'),'provider','service',_0x3213('0x4'),_0x3213('0x5'),_0x3213('0x6'),_0x3213('0x7'),_0x3213('0x8')],'raw':![],'include':[{'model':_0x3213('0x9'),'as':'Imap','include':[{'model':_0x3213('0xa'),'attributes':['id',_0x3213('0x3'),_0x3213('0xb'),_0x3213('0xc'),_0x3213('0xd')],'as':_0x3213('0xa')}]},{'model':_0x3213('0xe'),'as':_0x3213('0xf'),'include':[{'model':_0x3213('0xa'),'attributes':['id',_0x3213('0x3'),_0x3213('0xb'),_0x3213('0xc'),_0x3213('0xd')],'as':_0x3213('0xa')}]}]},'log':_0x3213('0x10')});};};exports[_0x3213('0x11')]=function(_0x399e8f,_0x3ea3c6){return client[_0x3213('0x1')](_0x3213('0x12'),{'account':{'id':_0x399e8f},'body':_0x3ea3c6,'log':_0x3213('0x12')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 22d4c60..562d63c 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 _0x629e=['../client','Request','ShowSetting','GetSettings'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x629e,0xbc));var _0xe629=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x629e[_0x17d9e3];return _0x14192d;};'use strict';var client=require(_0xe629('0x0'));exports['getSettings']=function(){return client[_0xe629('0x1')](_0xe629('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xe629('0x3')});}; \ No newline at end of file +var _0xa78e=['GetSettings','../client','ShowSetting','loginMailFrequency'];(function(_0xba10dd,_0x379c6b){var _0x24dae5=function(_0x1f5276){while(--_0x1f5276){_0xba10dd['push'](_0xba10dd['shift']());}};_0x24dae5(++_0x379c6b);}(_0xa78e,0xe1));var _0xea78=function(_0x4c4a34,_0x1424e0){_0x4c4a34=_0x4c4a34-0x0;var _0x2313fe=_0xa78e[_0x4c4a34];return _0x2313fe;};'use strict';var client=require(_0xea78('0x0'));exports['getSettings']=function(){return client['Request'](_0xea78('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xea78('0x2')]},'log':_0xea78('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 929d603..eadecf8 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 260790c..57b17c0 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 _0xe904=['express','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xe904,0x84));var _0x4e90=function(_0x1c2c65,_0x5ea3f4){_0x1c2c65=_0x1c2c65-0x0;var _0x449f89=_0xe904[_0x1c2c65];return _0x449f89;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x4e90('0x0'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0x4e90('0x1'));var app=express();var server=http[_0x4e90('0x2')](app);server[_0x4e90('0x3')]=0xdbba0;if(sticky[_0x4e90('0x4')](server,config[_0x4e90('0x5')])){var socketio=require(_0x4e90('0x6'))(server,{'transports':[_0x4e90('0x7'),_0x4e90('0x8')]});config[_0x4e90('0x9')]=_[_0x4e90('0xa')](config[_0x4e90('0x9')],{'host':_0x4e90('0xb'),'port':0x18eb});socketio[_0x4e90('0xc')](require(_0x4e90('0xd'))({'pubClient':new Redis(config[_0x4e90('0x9')]),'subClient':new Redis(config[_0x4e90('0x9')])}));require('../../config/triggers')[_0x4e90('0xe')]();require(_0x4e90('0xf'))[_0x4e90('0xe')](socketio);require('../../config/express')['default'](app);require(_0x4e90('0x10'))[_0x4e90('0xe')](app);}else{server[_0x4e90('0x11')](_0x4e90('0x12'),function(){console[_0x4e90('0x13')](_0x4e90('0x14'),config['port']);});}exports=module[_0x4e90('0x15')]=app; \ No newline at end of file +var _0xe87f=['port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','listen'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0xe87f,0xfc));var _0xfe87=function(_0x560419,_0x32d862){_0x560419=_0x560419-0x0;var _0x56183d=_0xe87f[_0x560419];return _0x56183d;};'use strict';var _=require(_0xfe87('0x0'));var http=require(_0xfe87('0x1'));var express=require(_0xfe87('0x2'));var sticky=require(_0xfe87('0x3'));var Redis=require(_0xfe87('0x4'));var config=require(_0xfe87('0x5'));var app=express();var server=http[_0xfe87('0x6')](app);server['timeout']=0xdbba0;if(sticky[_0xfe87('0x7')](server,config[_0xfe87('0x8')])){var socketio=require(_0xfe87('0x9'))(server,{'transports':[_0xfe87('0xa'),_0xfe87('0xb')]});config[_0xfe87('0xc')]=_[_0xfe87('0xd')](config[_0xfe87('0xc')],{'host':_0xfe87('0xe'),'port':0x18eb});socketio[_0xfe87('0xf')](require(_0xfe87('0x10'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xfe87('0xc')])}));require(_0xfe87('0x11'))[_0xfe87('0x12')]();require(_0xfe87('0x13'))['default'](socketio);require(_0xfe87('0x14'))[_0xfe87('0x12')](app);require(_0xfe87('0x15'))[_0xfe87('0x12')](app);}else{server[_0xfe87('0x16')](_0xfe87('0x17'),function(){console['log'](_0xfe87('0x18'),config['port']);});}exports=module[_0xfe87('0x19')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 7df3feb..7b15008 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 _0x9374=['rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug'];(function(_0x498cb3,_0x56d646){var _0x2196a1=function(_0x7d2572){while(--_0x7d2572){_0x498cb3['push'](_0x498cb3['shift']());}};_0x2196a1(++_0x56d646);}(_0x9374,0x19a));var _0x4937=function(_0x5329ef,_0x409214){_0x5329ef=_0x5329ef-0x0;var _0x25b5d5=_0x9374[_0x5329ef];return _0x25b5d5;};'use strict';var jayson=require(_0x4937('0x0'));var BPromise=require(_0x4937('0x1'));var logger=require(_0x4937('0x2'))(_0x4937('0x3'));var client=jayson[_0x4937('0x4')][_0x4937('0x5')]({'port':0x2329});client[_0x4937('0x6')]=function(_0x3fdc41,_0x2da72c){return new BPromise(function(_0x4b5bda,_0x2eeeeb){return client[_0x4937('0x7')](_0x3fdc41,_0x2da72c)[_0x4937('0x8')](function(_0x599058){logger[_0x4937('0x9')](_0x4937('0xa'),_0x4937('0x3'),_0x3fdc41,_0x2da72c,_0x599058);if(_0x599058[_0x4937('0xb')]){logger[_0x4937('0xb')]('rpc',_0x4937('0x3'),_0x3fdc41,_0x599058[_0x4937('0xb')][_0x4937('0xc')],_0x2da72c);return _0x2eeeeb(_0x599058['error'][_0x4937('0xc')]);}else{return _0x4b5bda(_0x599058['result']);}})[_0x4937('0xd')](function(_0x27acca){logger[_0x4937('0xb')](_0x4937('0xa'),'routing',_0x3fdc41,_0x27acca,_0x2da72c);return _0x2eeeeb(_0x27acca);});});};module['exports']=client; \ No newline at end of file +var _0x9a8c=['exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error','message','result','catch','rpc'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0x9a8c,0x71));var _0xc9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8c[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xc9a8('0x0'));var BPromise=require(_0xc9a8('0x1'));var logger=require(_0xc9a8('0x2'))(_0xc9a8('0x3'));var client=jayson[_0xc9a8('0x4')][_0xc9a8('0x5')]({'port':0x2329});client[_0xc9a8('0x6')]=function(_0xb12ba7,_0x479818){return new BPromise(function(_0x8f491b,_0x33332c){return client[_0xc9a8('0x7')](_0xb12ba7,_0x479818)[_0xc9a8('0x8')](function(_0x43ab56){logger[_0xc9a8('0x9')]('rpc','routing',_0xb12ba7,_0x479818,_0x43ab56);if(_0x43ab56[_0xc9a8('0xa')]){logger[_0xc9a8('0xa')]('rpc','routing',_0xb12ba7,_0x43ab56[_0xc9a8('0xa')][_0xc9a8('0xb')],_0x479818);return _0x33332c(_0x43ab56[_0xc9a8('0xa')][_0xc9a8('0xb')]);}else{return _0x8f491b(_0x43ab56[_0xc9a8('0xc')]);}})[_0xc9a8('0xd')](function(_0x1156a1){logger[_0xc9a8('0xa')](_0xc9a8('0xe'),_0xc9a8('0x3'),_0xb12ba7,_0x1156a1,_0x479818);return _0x33332c(_0x1156a1);});});};module[_0xc9a8('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 89cfd1a..d43b689 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 _0xc1be=['getSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','getChatQueues','initChatQueues'];(function(_0x2bdb3a,_0x111f88){var _0x40d593=function(_0x560c17){while(--_0x560c17){_0x2bdb3a['push'](_0x2bdb3a['shift']());}};_0x40d593(++_0x111f88);}(_0xc1be,0x152));var _0xec1b=function(_0x508e5a,_0x187f75){_0x508e5a=_0x508e5a-0x0;var _0x578297=_0xc1be[_0x508e5a];return _0x578297;};'use strict';var BPromise=require(_0xec1b('0x0'));var server=require(_0xec1b('0x1'));var Realtime=require(_0xec1b('0x2'));var user=require(_0xec1b('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xec1b('0x4'));var chatQueue=require(_0xec1b('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xec1b('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xec1b('0x7')]()[_0xec1b('0x8')](user['getAgents']())[_0xec1b('0x8')](realtime[_0xec1b('0x9')]())[_0xec1b('0x8')](interval[_0xec1b('0xa')]())[_0xec1b('0x8')](realtime['initIntervals']())[_0xec1b('0x8')](openchannelQueue[_0xec1b('0xb')]())['then'](realtime['initOpenchannelQueues']())[_0xec1b('0x8')](chatQueue[_0xec1b('0xc')]())[_0xec1b('0x8')](realtime[_0xec1b('0xd')]())[_0xec1b('0x8')](smsQueue[_0xec1b('0xe')]())[_0xec1b('0x8')](realtime['initSmsQueues']())[_0xec1b('0x8')](mailQueue[_0xec1b('0xf')]())['then'](realtime[_0xec1b('0x10')]())[_0xec1b('0x8')](faxQueue['getFaxQueues']())[_0xec1b('0x8')](realtime[_0xec1b('0x11')]())[_0xec1b('0x8')](whatsappQueue[_0xec1b('0x12')]())[_0xec1b('0x8')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0xec1b('0x13')](realtime)[_0xec1b('0x8')](function(_0x5ced49){return initRealtime();})[_0xec1b('0x8')](function(_0x3abd1c){return setInterval(initRealtime,0x1388);})[_0xec1b('0x14')](function(_0x439b9b){console[_0xec1b('0x15')](_0x439b9b);});}main(); \ No newline at end of file +var _0x1b88=['log','bluebird','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','initAgents','getIntervals','getOpenchannelQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','catch'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x1b88,0x133));var _0x81b8=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x1b88[_0x3740fe];return _0x55492b;};'use strict';var BPromise=require(_0x81b8('0x0'));var server=require('./server');var Realtime=require(_0x81b8('0x1'));var user=require('./rpc/user');var interval=require(_0x81b8('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x81b8('0x3'));var smsQueue=require(_0x81b8('0x4'));var mailQueue=require(_0x81b8('0x5'));var faxQueue=require(_0x81b8('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x81b8('0x7')]()[_0x81b8('0x8')](user['getAgents']())[_0x81b8('0x8')](realtime[_0x81b8('0x9')]())[_0x81b8('0x8')](interval[_0x81b8('0xa')]())[_0x81b8('0x8')](realtime['initIntervals']())[_0x81b8('0x8')](openchannelQueue[_0x81b8('0xb')]())[_0x81b8('0x8')](realtime['initOpenchannelQueues']())[_0x81b8('0x8')](chatQueue['getChatQueues']())[_0x81b8('0x8')](realtime['initChatQueues']())[_0x81b8('0x8')](smsQueue['getSmsQueues']())[_0x81b8('0x8')](realtime['initSmsQueues']())[_0x81b8('0x8')](mailQueue[_0x81b8('0xc')]())[_0x81b8('0x8')](realtime[_0x81b8('0xd')]())[_0x81b8('0x8')](faxQueue['getFaxQueues']())[_0x81b8('0x8')](realtime[_0x81b8('0xe')]())[_0x81b8('0x8')](whatsappQueue[_0x81b8('0xf')]())[_0x81b8('0x8')](realtime['initWhatsappQueues']())[_0x81b8('0x8')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x81b8('0x8')](function(_0x4afc21){return initRealtime();})[_0x81b8('0x8')](function(_0x3ed3ce){return setInterval(initRealtime,0x1388);})[_0x81b8('0x10')](function(_0x132041){console[_0x81b8('0x11')](_0x132041);});}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 64776c0..ab23a27 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x1261[_0x4aa838];return _0x3abff0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +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(_0x52892f,_0x59d580){var _0x4d58e3=function(_0x14a7fc){while(--_0x14a7fc){_0x52892f['push'](_0x52892f['shift']());}};_0x4d58e3(++_0x59d580);}(_0x2ef3,0xba));var _0x32ef=function(_0x28cd5b,_0x35aa67){_0x28cd5b=_0x28cd5b-0x0;var _0x4782cd=_0x2ef3[_0x28cd5b];return _0x4782cd;};'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 ce8e8e6..b6a4982 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 _0xd310=['client','http','request','then','error','result','catch','sendMailMessage'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd310,0xb8));var _0x0d31=function(_0x350072,_0x1800a5){_0x350072=_0x350072-0x0;var _0x4ee2c3=_0xd310[_0x350072];return _0x4ee2c3;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x0d31('0x0')][_0x0d31('0x1')]({'port':0x232b});function request(_0x18bacb,_0x3200b3){return new BPromise(function(_0x46b241,_0x239d47){return client[_0x0d31('0x2')](_0x18bacb,_0x3200b3)[_0x0d31('0x3')](function(_0x654a4d){if(_0x654a4d[_0x0d31('0x4')]){return _0x239d47(_0x654a4d[_0x0d31('0x4')]['message']);}else{return _0x46b241(_0x654a4d[_0x0d31('0x5')]);}})[_0x0d31('0x6')](function(_0x58dc6e){return _0x239d47(_0x58dc6e);});});}exports[_0x0d31('0x7')]=function(_0x9ff616,_0x4800f3){return request('SendMail',{'account':_0x9ff616,'message':_0x4800f3});}; \ No newline at end of file +var _0x483b=['then','error','message','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0x14c8ee,_0x34d4fb){var _0x51acc2=function(_0x4c1277){while(--_0x4c1277){_0x14c8ee['push'](_0x14c8ee['shift']());}};_0x51acc2(++_0x34d4fb);}(_0x483b,0x1e2));var _0xb483=function(_0x546bc3,_0x52595d){_0x546bc3=_0x546bc3-0x0;var _0x5dc9c3=_0x483b[_0x546bc3];return _0x5dc9c3;};'use strict';var BPromise=require(_0xb483('0x0'));var jayson=require(_0xb483('0x1'));var client=jayson['client'][_0xb483('0x2')]({'port':0x232b});function request(_0x483ec0,_0x5329da){return new BPromise(function(_0x1e7554,_0x215feb){return client[_0xb483('0x3')](_0x483ec0,_0x5329da)[_0xb483('0x4')](function(_0x4abaf6){if(_0x4abaf6[_0xb483('0x5')]){return _0x215feb(_0x4abaf6[_0xb483('0x5')][_0xb483('0x6')]);}else{return _0x1e7554(_0x4abaf6['result']);}})['catch'](function(_0x178651){return _0x215feb(_0x178651);});});}exports[_0xb483('0x7')]=function(_0x1af6b2,_0x433aae){return request(_0xb483('0x8'),{'account':_0x1af6b2,'message':_0x433aae});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 30c34a6..0ad84c7 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 _0x46af=['idle','chat','openchannel','fax','sms','whatsapp','length','StatusTime','chatStatus','faxStatus','whatsappStatusTime','whatsappCurrentCapacity','openchannelStatusTime','busy','emit','user:save','exports','lodash','md5','ioredis','redis','defaults','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x46af,0x18b));var _0xf46a=function(_0x28d109,_0x21064b){_0x28d109=_0x28d109-0x0;var _0x630dd1=_0x46af[_0x28d109];return _0x630dd1;};'use strict';var _=require(_0xf46a('0x0'));var moment=require('moment');var md5=require(_0xf46a('0x1'));var Redis=require(_0xf46a('0x2'));var config=require('../../../config/environment');config[_0xf46a('0x3')]=_[_0xf46a('0x4')](config[_0xf46a('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x485953){this['id']=_0x485953['id']||0x0;this['name']=_0x485953['name']||'';this['online']=_0x485953['online']||!![];this[_0xf46a('0x5')]=_0x485953['voicePause']||![];this[_0xf46a('0x6')]=_0x485953[_0xf46a('0x6')]||![];this[_0xf46a('0x7')]=_0x485953[_0xf46a('0x7')]||![];this[_0xf46a('0x8')]=_0x485953[_0xf46a('0x8')]||![];this[_0xf46a('0x9')]=_0x485953[_0xf46a('0x9')]||![];this[_0xf46a('0xa')]=_0x485953[_0xf46a('0xa')]||![];this['chatStatus']=_0xf46a('0xb');this[_0xf46a('0xc')]=0x0;this[_0xf46a('0xd')]=_0x485953['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xf46a('0xe')]=_0xf46a('0xb');this[_0xf46a('0xf')]=0x0;this['mailCapacity']=_0x485953[_0xf46a('0x10')]||0x0;this[_0xf46a('0x11')]=0x0;this['faxStatus']=_0xf46a('0xb');this[_0xf46a('0x12')]=0x0;this['faxCapacity']=_0x485953[_0xf46a('0x13')]||0x0;this[_0xf46a('0x14')]=0x0;this[_0xf46a('0x15')]='unknown';this['smsStatusTime']=0x0;this[_0xf46a('0x16')]=_0x485953[_0xf46a('0x16')]||0x0;this[_0xf46a('0x17')]=0x0;this[_0xf46a('0x18')]=_0xf46a('0xb');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x485953[_0xf46a('0x19')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xf46a('0x1a')]=_0xf46a('0xb');this['openchannelStatusTime']=0x0;this[_0xf46a('0x1b')]=_0x485953[_0xf46a('0x1b')]||0x0;this[_0xf46a('0x1c')]=0x0;this['busy']=![];this[_0xf46a('0x1d')]=undefined;this[_0xf46a('0x1')]='';this[_0xf46a('0x1e')]();}Agent[_0xf46a('0x1f')][_0xf46a('0x20')]=function(_0x183728){if(this[_0x183728+_0xf46a('0x21')]>0x0){if(this[_0x183728+_0xf46a('0x22')]>0x0&&this[_0x183728+_0xf46a('0x21')]>=this[_0x183728+'Capacity']){return _0xf46a('0x23');}else{return _0xf46a('0x24');}}else{return _0xf46a('0x25');}};Agent[_0xf46a('0x1f')][_0xf46a('0x1e')]=function(){var _0x2a40e9=['mail',_0xf46a('0x26'),_0xf46a('0x27'),_0xf46a('0x28'),_0xf46a('0x29'),_0xf46a('0x2a')];for(var _0xc5b423=0x0;_0xc5b423<_0x2a40e9[_0xf46a('0x2b')];_0xc5b423+=0x1){var _0x222991=this[_0xf46a('0x20')](_0x2a40e9[_0xc5b423]);if(this[_0x2a40e9[_0xc5b423]+'Status']!==_0x222991){this[_0x2a40e9[_0xc5b423]+_0xf46a('0x2c')]=_['toNumber'](moment()['format']('x'));}this[_0x2a40e9[_0xc5b423]+'Status']=_0x222991;}var _0x8fa26e={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xf46a('0x5')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xf46a('0x9')],'faxPause':this[_0xf46a('0x8')],'openchannelPause':this[_0xf46a('0xa')],'chatStatus':this[_0xf46a('0x2d')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xf46a('0xe')],'mailStatusTime':this[_0xf46a('0xf')],'mailCapacity':this[_0xf46a('0x10')],'mailCurrentCapacity':this[_0xf46a('0x11')],'faxStatus':this[_0xf46a('0x2e')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0xf46a('0x15')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xf46a('0x16')],'smsCurrentCapacity':this[_0xf46a('0x17')],'whatsappStatus':this[_0xf46a('0x18')],'whatsappStatusTime':this[_0xf46a('0x2f')],'whatsappCapacity':this[_0xf46a('0x19')],'whatsappCurrentCapacity':this[_0xf46a('0x30')],'openchannelStatus':this[_0xf46a('0x1a')],'openchannelStatusTime':this[_0xf46a('0x31')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf46a('0x1c')],'busy':this[_0xf46a('0x32')],'busyQueue':this[_0xf46a('0x1d')]};var _0x1e5942=md5(JSON['stringify'](_0x8fa26e));if(this['md5']!==_0x1e5942){this[_0xf46a('0x1')]=_0x1e5942;io[_0xf46a('0x33')](_0xf46a('0x34'),_0x8fa26e);}};module[_0xf46a('0x35')]=Agent; \ No newline at end of file +var _0x9db7=['smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','mailStatusTime','openchannelStatus','busy','emit','user:save','exports','lodash','moment','md5','ioredis','redis','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus'];(function(_0x51a546,_0x3cd100){var _0x2d1a67=function(_0x2999cc){while(--_0x2999cc){_0x51a546['push'](_0x51a546['shift']());}};_0x2d1a67(++_0x3cd100);}(_0x9db7,0x1bf));var _0x79db=function(_0x356324,_0x483312){_0x356324=_0x356324-0x0;var _0x117611=_0x9db7[_0x356324];return _0x117611;};'use strict';var _=require(_0x79db('0x0'));var moment=require(_0x79db('0x1'));var md5=require(_0x79db('0x2'));var Redis=require(_0x79db('0x3'));var config=require('../../../config/environment');config[_0x79db('0x4')]=_['defaults'](config[_0x79db('0x4')],{'host':_0x79db('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x79db('0x4')]));function Agent(_0x7abe17){this['id']=_0x7abe17['id']||0x0;this[_0x79db('0x6')]=_0x7abe17[_0x79db('0x6')]||'';this[_0x79db('0x7')]=_0x7abe17[_0x79db('0x7')]||!![];this[_0x79db('0x8')]=_0x7abe17[_0x79db('0x8')]||![];this[_0x79db('0x9')]=_0x7abe17[_0x79db('0x9')]||![];this[_0x79db('0xa')]=_0x7abe17[_0x79db('0xa')]||![];this['faxPause']=_0x7abe17[_0x79db('0xb')]||![];this[_0x79db('0xc')]=_0x7abe17[_0x79db('0xc')]||![];this[_0x79db('0xd')]=_0x7abe17[_0x79db('0xd')]||![];this[_0x79db('0xe')]=_0x79db('0xf');this[_0x79db('0x10')]=0x0;this[_0x79db('0x11')]=_0x7abe17['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x79db('0xf');this['mailStatusTime']=0x0;this[_0x79db('0x12')]=_0x7abe17['mailCapacity']||0x0;this[_0x79db('0x13')]=0x0;this[_0x79db('0x14')]=_0x79db('0xf');this[_0x79db('0x15')]=0x0;this[_0x79db('0x16')]=_0x7abe17[_0x79db('0x16')]||0x0;this[_0x79db('0x17')]=0x0;this[_0x79db('0x18')]=_0x79db('0xf');this[_0x79db('0x19')]=0x0;this[_0x79db('0x1a')]=_0x7abe17[_0x79db('0x1a')]||0x0;this[_0x79db('0x1b')]=0x0;this['whatsappStatus']=_0x79db('0xf');this[_0x79db('0x1c')]=0x0;this[_0x79db('0x1d')]=_0x7abe17[_0x79db('0x1d')]||0x0;this[_0x79db('0x1e')]=0x0;this['openchannelStatus']=_0x79db('0xf');this[_0x79db('0x1f')]=0x0;this['openchannelCapacity']=_0x7abe17[_0x79db('0x20')]||0x0;this[_0x79db('0x21')]=0x0;this['busy']=![];this[_0x79db('0x22')]=undefined;this[_0x79db('0x2')]='';this[_0x79db('0x23')]();}Agent[_0x79db('0x24')][_0x79db('0x25')]=function(_0x9a6dae){if(this[_0x9a6dae+_0x79db('0x26')]>0x0){if(this[_0x9a6dae+_0x79db('0x27')]>0x0&&this[_0x9a6dae+_0x79db('0x26')]>=this[_0x9a6dae+_0x79db('0x27')]){return _0x79db('0x28');}else{return _0x79db('0x29');}}else{return _0x79db('0x2a');}};Agent[_0x79db('0x24')][_0x79db('0x23')]=function(){var _0x4d319a=[_0x79db('0x2b'),_0x79db('0x2c'),'openchannel','fax',_0x79db('0x2d'),_0x79db('0x2e')];for(var _0x25186e=0x0;_0x25186e<_0x4d319a[_0x79db('0x2f')];_0x25186e+=0x1){var _0x3ac231=this[_0x79db('0x25')](_0x4d319a[_0x25186e]);if(this[_0x4d319a[_0x25186e]+_0x79db('0x30')]!==_0x3ac231){this[_0x4d319a[_0x25186e]+_0x79db('0x31')]=_[_0x79db('0x32')](moment()[_0x79db('0x33')]('x'));}this[_0x4d319a[_0x25186e]+_0x79db('0x30')]=_0x3ac231;}var _0x4bd0da={'id':this['id'],'name':this[_0x79db('0x6')],'online':this['online'],'voicePause':this['voicePause'],'chatPause':this[_0x79db('0x9')],'mailPause':this[_0x79db('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0x79db('0xb')],'openchannelPause':this[_0x79db('0xd')],'chatStatus':this[_0x79db('0xe')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x79db('0x11')],'chatCurrentCapacity':this[_0x79db('0x34')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x79db('0x35')],'mailCapacity':this[_0x79db('0x12')],'mailCurrentCapacity':this[_0x79db('0x13')],'faxStatus':this[_0x79db('0x14')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x79db('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x79db('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x79db('0x1a')],'smsCurrentCapacity':this[_0x79db('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x79db('0x1c')],'whatsappCapacity':this[_0x79db('0x1d')],'whatsappCurrentCapacity':this[_0x79db('0x1e')],'openchannelStatus':this[_0x79db('0x36')],'openchannelStatusTime':this[_0x79db('0x1f')],'openchannelCapacity':this[_0x79db('0x20')],'openchannelCurrentCapacity':this[_0x79db('0x21')],'busy':this[_0x79db('0x37')],'busyQueue':this['busyQueue']};var _0x5c1b48=md5(JSON['stringify'](_0x4bd0da));if(this['md5']!==_0x5c1b48){this[_0x79db('0x2')]=_0x5c1b48;io[_0x79db('0x38')](_0x79db('0x39'),_0x4bd0da);}};module[_0x79db('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 18cb17f..1d850f7 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 _0x2294=['../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','updateRouting','mapAgentsId','map','_rr','loggedIn','paused','length','online','chatPause','available','stringify','format','emit','chat_queue:save','exports','md5','util','ioredis'];(function(_0x43ac0b,_0x4a0e27){var _0x1cf748=function(_0x61b252){while(--_0x61b252){_0x43ac0b['push'](_0x43ac0b['shift']());}};_0x1cf748(++_0x4a0e27);}(_0x2294,0x1dd));var _0x4229=function(_0x5ba028,_0x47b78b){_0x5ba028=_0x5ba028-0x0;var _0x2afbda=_0x2294[_0x5ba028];return _0x2afbda;};'use strict';var _=require('lodash');var md5=require(_0x4229('0x0'));var util=require(_0x4229('0x1'));var Redis=require(_0x4229('0x2'));var config=require(_0x4229('0x3'));config[_0x4229('0x4')]=_[_0x4229('0x5')](config[_0x4229('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4229('0x6'))(new Redis(config[_0x4229('0x4')]));function ChatQueue(_0xe00806){this['id']=_0xe00806['id']||0x0;this[_0x4229('0x7')]=_0xe00806[_0x4229('0x7')]||'';this[_0x4229('0x8')]=_0xe00806['timeout']||0xa;this[_0x4229('0x9')]=_0xe00806[_0x4229('0x9')]||_0x4229('0xa');this['Agents']=_0xe00806[_0x4229('0xb')];this['mapAgentsId']={};this[_0x4229('0xc')]=0x0;this[_0x4229('0x0')]='';this['updateRouting']();this[_0x4229('0xd')]();}ChatQueue[_0x4229('0xe')][_0x4229('0xf')]=function(){var _0x28762=this[_0x4229('0x10')]['_rr'];this['mapAgentsId']=_[_0x4229('0x11')](this['Agents'],'id');this['mapAgentsId'][_0x4229('0x12')]=_0x28762;};ChatQueue['prototype'][_0x4229('0xd')]=function(){this[_0x4229('0x13')]=0x0;this[_0x4229('0x14')]=0x0;for(var _0x1146ff=0x0;_0x1146ff=0x0?this['available']:0x0;var _0xdf5893={'id':this['id'],'available':this[_0x4229('0x18')],'loggedIn':this[_0x4229('0x13')],'name':this['name'],'paused':this[_0x4229('0x14')],'waiting':this[_0x4229('0xc')]};var _0x59b340=md5(JSON[_0x4229('0x19')](_0xdf5893));if(this[_0x4229('0x0')]!==_0x59b340){this[_0x4229('0x0')]=_0x59b340;io['to'](util[_0x4229('0x1a')]('chat:queue:%s',_0xdf5893[_0x4229('0x7')]))[_0x4229('0x1b')](_0x4229('0x1c'),_0xdf5893);}};module[_0x4229('0x1d')]=ChatQueue; \ No newline at end of file +var _0xb537=['online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length'];(function(_0x5ae187,_0x8afd5c){var _0x211069=function(_0x5a56b6){while(--_0x5a56b6){_0x5ae187['push'](_0x5ae187['shift']());}};_0x211069(++_0x8afd5c);}(_0xb537,0x131));var _0x7b53=function(_0x48432d,_0x4cb335){_0x48432d=_0x48432d-0x0;var _0x5099d7=_0xb537[_0x48432d];return _0x5099d7;};'use strict';var _=require(_0x7b53('0x0'));var md5=require(_0x7b53('0x1'));var util=require(_0x7b53('0x2'));var Redis=require(_0x7b53('0x3'));var config=require(_0x7b53('0x4'));config[_0x7b53('0x5')]=_['defaults'](config[_0x7b53('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x7b53('0x6'))(new Redis(config[_0x7b53('0x5')]));function ChatQueue(_0x5e91cf){this['id']=_0x5e91cf['id']||0x0;this[_0x7b53('0x7')]=_0x5e91cf[_0x7b53('0x7')]||'';this[_0x7b53('0x8')]=_0x5e91cf[_0x7b53('0x8')]||0xa;this[_0x7b53('0x9')]=_0x5e91cf[_0x7b53('0x9')]||'beepall';this[_0x7b53('0xa')]=_0x5e91cf[_0x7b53('0xa')];this['mapAgentsId']={};this[_0x7b53('0xb')]=0x0;this[_0x7b53('0x1')]='';this[_0x7b53('0xc')]();this[_0x7b53('0xd')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x3de1be=this['mapAgentsId'][_0x7b53('0xe')];this['mapAgentsId']=_['map'](this[_0x7b53('0xa')],'id');this['mapAgentsId']['_rr']=_0x3de1be;};ChatQueue[_0x7b53('0xf')][_0x7b53('0xd')]=function(){this[_0x7b53('0x10')]=0x0;this[_0x7b53('0x11')]=0x0;for(var _0x33d7c1=0x0;_0x33d7c1=0x0?this['available']:0x0;var _0x3ec745={'id':this['id'],'available':this[_0x7b53('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x7b53('0x7')],'paused':this[_0x7b53('0x11')],'waiting':this['waiting']};var _0x283ee7=md5(JSON[_0x7b53('0x15')](_0x3ec745));if(this[_0x7b53('0x1')]!==_0x283ee7){this['md5']=_0x283ee7;io['to'](util[_0x7b53('0x16')](_0x7b53('0x17'),_0x3ec745[_0x7b53('0x7')]))[_0x7b53('0x18')](_0x7b53('0x19'),_0x3ec745);}};module[_0x7b53('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 247950c..b67c6b1 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 _0x85de=['updateRouting','updateRealtime','_rr','map','prototype','paused','length','online','faxPause','available','loggedIn','stringify','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x3ba780,_0x14133a){var _0x45e705=function(_0x2dd8ed){while(--_0x2dd8ed){_0x3ba780['push'](_0x3ba780['shift']());}};_0x45e705(++_0x14133a);}(_0x85de,0x114));var _0xe85d=function(_0x714d36,_0x187e6c){_0x714d36=_0x714d36-0x0;var _0x2c405f=_0x85de[_0x714d36];return _0x2c405f;};'use strict';var _=require(_0xe85d('0x0'));var md5=require(_0xe85d('0x1'));var util=require(_0xe85d('0x2'));var Redis=require(_0xe85d('0x3'));var config=require(_0xe85d('0x4'));config['redis']=_['defaults'](config[_0xe85d('0x5')],{'host':_0xe85d('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe85d('0x5')]));function FaxQueue(_0x3c4322){this['id']=_0x3c4322['id']||0x0;this['name']=_0x3c4322[_0xe85d('0x7')]||'';this[_0xe85d('0x8')]=_0x3c4322[_0xe85d('0x8')]||0xa;this['strategy']=_0x3c4322[_0xe85d('0x9')]||_0xe85d('0xa');this[_0xe85d('0xb')]=_0x3c4322[_0xe85d('0xb')];this[_0xe85d('0xc')]={};this[_0xe85d('0xd')]=0x0;this[_0xe85d('0x1')]='';this[_0xe85d('0xe')]();this[_0xe85d('0xf')]();}FaxQueue['prototype'][_0xe85d('0xe')]=function(){var _0x258ddc=this[_0xe85d('0xc')][_0xe85d('0x10')];this[_0xe85d('0xc')]=_[_0xe85d('0x11')](this[_0xe85d('0xb')],'id');this[_0xe85d('0xc')][_0xe85d('0x10')]=_0x258ddc;};FaxQueue[_0xe85d('0x12')][_0xe85d('0xf')]=function(){this['loggedIn']=0x0;this[_0xe85d('0x13')]=0x0;for(var _0x23ec93=0x0;_0x23ec93=0x0?this['available']:0x0;var _0x555dc4={'id':this['id'],'available':this[_0xe85d('0x17')],'loggedIn':this[_0xe85d('0x18')],'name':this[_0xe85d('0x7')],'paused':this[_0xe85d('0x13')],'waiting':this[_0xe85d('0xd')]};var _0x27b16c=md5(JSON[_0xe85d('0x19')](_0x555dc4));if(this[_0xe85d('0x1')]!==_0x27b16c){this['md5']=_0x27b16c;io['to'](util['format'](_0xe85d('0x1a'),_0x555dc4[_0xe85d('0x7')]))[_0xe85d('0x1b')]('fax_queue:save',_0x555dc4);}};module[_0xe85d('0x1c')]=FaxQueue; \ No newline at end of file +var _0x36d9=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','paused','length','online','loggedIn','available','fax:queue:%s','fax_queue:save','exports','lodash','md5','util','redis','defaults','localhost'];(function(_0x22e544,_0x2fad7b){var _0x16a2a5=function(_0x228ecd){while(--_0x228ecd){_0x22e544['push'](_0x22e544['shift']());}};_0x16a2a5(++_0x2fad7b);}(_0x36d9,0x18a));var _0x936d=function(_0x2a58ad,_0x4a3357){_0x2a58ad=_0x2a58ad-0x0;var _0x49276b=_0x36d9[_0x2a58ad];return _0x49276b;};'use strict';var _=require(_0x936d('0x0'));var md5=require(_0x936d('0x1'));var util=require(_0x936d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x936d('0x3')]=_[_0x936d('0x4')](config[_0x936d('0x3')],{'host':_0x936d('0x5'),'port':0x18eb});var io=require(_0x936d('0x6'))(new Redis(config[_0x936d('0x3')]));function FaxQueue(_0x385711){this['id']=_0x385711['id']||0x0;this[_0x936d('0x7')]=_0x385711[_0x936d('0x7')]||'';this[_0x936d('0x8')]=_0x385711['timeout']||0xa;this[_0x936d('0x9')]=_0x385711['strategy']||'beepall';this[_0x936d('0xa')]=_0x385711[_0x936d('0xa')];this[_0x936d('0xb')]={};this[_0x936d('0xc')]=0x0;this[_0x936d('0x1')]='';this[_0x936d('0xd')]();this['updateRealtime']();}FaxQueue[_0x936d('0xe')]['updateRouting']=function(){var _0x55a4e8=this[_0x936d('0xb')][_0x936d('0xf')];this[_0x936d('0xb')]=_['map'](this[_0x936d('0xa')],'id');this[_0x936d('0xb')][_0x936d('0xf')]=_0x55a4e8;};FaxQueue['prototype'][_0x936d('0x10')]=function(){this['loggedIn']=0x0;this[_0x936d('0x11')]=0x0;for(var _0x1f9b57=0x0;_0x1f9b57=0x0?this[_0x936d('0x15')]:0x0;var _0x277cbb={'id':this['id'],'available':this[_0x936d('0x15')],'loggedIn':this[_0x936d('0x14')],'name':this[_0x936d('0x7')],'paused':this[_0x936d('0x11')],'waiting':this[_0x936d('0xc')]};var _0x3c6f31=md5(JSON['stringify'](_0x277cbb));if(this['md5']!==_0x3c6f31){this[_0x936d('0x1')]=_0x3c6f31;io['to'](util['format'](_0x936d('0x16'),_0x277cbb[_0x936d('0x7')]))['emit'](_0x936d('0x17'),_0x277cbb);}};module[_0x936d('0x18')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d705390..a8d8365 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 _0x5ddd=['name','Intervals','exports'];(function(_0x1853f4,_0x4a6557){var _0x3b1182=function(_0x27dfcc){while(--_0x27dfcc){_0x1853f4['push'](_0x1853f4['shift']());}};_0x3b1182(++_0x4a6557);}(_0x5ddd,0x171));var _0xd5dd=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0x5ddd[_0x8af54b];return _0x27d8f0;};'use strict';function Interval(_0x4778b3){this['id']=_0x4778b3['id']||0x0;this[_0xd5dd('0x0')]=_0x4778b3['name']||'';this[_0xd5dd('0x1')]=_0x4778b3[_0xd5dd('0x1')]||{};}module[_0xd5dd('0x2')]=Interval; \ No newline at end of file +var _0x3e88=['name','Intervals'];(function(_0x7fec48,_0x31b598){var _0x3c1526=function(_0x3974f5){while(--_0x3974f5){_0x7fec48['push'](_0x7fec48['shift']());}};_0x3c1526(++_0x31b598);}(_0x3e88,0x16a));var _0x83e8=function(_0xa75db,_0x97eeb8){_0xa75db=_0xa75db-0x0;var _0x988497=_0x3e88[_0xa75db];return _0x988497;};'use strict';function Interval(_0x2e7a0b){this['id']=_0x2e7a0b['id']||0x0;this[_0x83e8('0x0')]=_0x2e7a0b[_0x83e8('0x0')]||'';this[_0x83e8('0x1')]=_0x2e7a0b[_0x83e8('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 364be11..a7a6afd 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 _0x9a36=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','map','_rr','loggedIn','paused','length','online','mailPause','available','format','emit','exports','lodash','md5','../../../config/environment'];(function(_0x4f0581,_0x350e3f){var _0x313344=function(_0x175ffa){while(--_0x175ffa){_0x4f0581['push'](_0x4f0581['shift']());}};_0x313344(++_0x350e3f);}(_0x9a36,0x1bf));var _0x69a3=function(_0x7a1e45,_0x5a901c){_0x7a1e45=_0x7a1e45-0x0;var _0x9e5b2=_0x9a36[_0x7a1e45];return _0x9e5b2;};'use strict';var _=require(_0x69a3('0x0'));var md5=require(_0x69a3('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x69a3('0x2'));config[_0x69a3('0x3')]=_[_0x69a3('0x4')](config['redis'],{'host':_0x69a3('0x5'),'port':0x18eb});var io=require(_0x69a3('0x6'))(new Redis(config['redis']));function MailQueue(_0x2cd3a3){this['id']=_0x2cd3a3['id']||0x0;this[_0x69a3('0x7')]=_0x2cd3a3[_0x69a3('0x7')]||'';this[_0x69a3('0x8')]=_0x2cd3a3[_0x69a3('0x8')]||0xa;this['strategy']=_0x2cd3a3[_0x69a3('0x9')]||'beepall';this['Agents']=_0x2cd3a3[_0x69a3('0xa')];this[_0x69a3('0xb')]={};this['waiting']=0x0;this[_0x69a3('0x1')]='';this[_0x69a3('0xc')]();this['updateRealtime']();}MailQueue[_0x69a3('0xd')][_0x69a3('0xc')]=function(){var _0x290721=this[_0x69a3('0xb')]['_rr'];this[_0x69a3('0xb')]=_[_0x69a3('0xe')](this[_0x69a3('0xa')],'id');this[_0x69a3('0xb')][_0x69a3('0xf')]=_0x290721;};MailQueue['prototype']['updateRealtime']=function(){this[_0x69a3('0x10')]=0x0;this[_0x69a3('0x11')]=0x0;for(var _0x5dbf32=0x0;_0x5dbf32=0x0?this[_0x69a3('0x15')]:0x0;var _0xca047={'id':this['id'],'available':this[_0x69a3('0x15')],'loggedIn':this[_0x69a3('0x10')],'name':this['name'],'paused':this[_0x69a3('0x11')],'waiting':this['waiting']};var _0x52b58f=md5(JSON['stringify'](_0xca047));if(this[_0x69a3('0x1')]!==_0x52b58f){this['md5']=_0x52b58f;io['to'](util[_0x69a3('0x16')]('mail:queue:%s',_0xca047[_0x69a3('0x7')]))[_0x69a3('0x17')]('mail_queue:save',_0xca047);}};module[_0x69a3('0x18')]=MailQueue; \ No newline at end of file +var _0x7605=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','map','prototype','updateRealtime','paused','length','online','loggedIn','mailPause','available','format','mail:queue:%s','exports','lodash','md5','util','ioredis'];(function(_0x397f18,_0x5bc52c){var _0x43ae0e=function(_0x220d6c){while(--_0x220d6c){_0x397f18['push'](_0x397f18['shift']());}};_0x43ae0e(++_0x5bc52c);}(_0x7605,0xc7));var _0x5760=function(_0x4a706b,_0x52e021){_0x4a706b=_0x4a706b-0x0;var _0x7a5b6b=_0x7605[_0x4a706b];return _0x7a5b6b;};'use strict';var _=require(_0x5760('0x0'));var md5=require(_0x5760('0x1'));var util=require(_0x5760('0x2'));var Redis=require(_0x5760('0x3'));var config=require(_0x5760('0x4'));config['redis']=_[_0x5760('0x5')](config[_0x5760('0x6')],{'host':_0x5760('0x7'),'port':0x18eb});var io=require(_0x5760('0x8'))(new Redis(config[_0x5760('0x6')]));function MailQueue(_0x271da6){this['id']=_0x271da6['id']||0x0;this['name']=_0x271da6[_0x5760('0x9')]||'';this[_0x5760('0xa')]=_0x271da6[_0x5760('0xa')]||0xa;this[_0x5760('0xb')]=_0x271da6[_0x5760('0xb')]||_0x5760('0xc');this[_0x5760('0xd')]=_0x271da6[_0x5760('0xd')];this[_0x5760('0xe')]={};this[_0x5760('0xf')]=0x0;this[_0x5760('0x1')]='';this[_0x5760('0x10')]();this['updateRealtime']();}MailQueue['prototype']['updateRouting']=function(){var _0x1efeb0=this[_0x5760('0xe')]['_rr'];this[_0x5760('0xe')]=_[_0x5760('0x11')](this[_0x5760('0xd')],'id');this['mapAgentsId']['_rr']=_0x1efeb0;};MailQueue[_0x5760('0x12')][_0x5760('0x13')]=function(){this['loggedIn']=0x0;this[_0x5760('0x14')]=0x0;for(var _0xf86f15=0x0;_0xf86f15=0x0?this[_0x5760('0x19')]:0x0;var _0x534d94={'id':this['id'],'available':this[_0x5760('0x19')],'loggedIn':this[_0x5760('0x17')],'name':this[_0x5760('0x9')],'paused':this[_0x5760('0x14')],'waiting':this[_0x5760('0xf')]};var _0x49f276=md5(JSON['stringify'](_0x534d94));if(this[_0x5760('0x1')]!==_0x49f276){this[_0x5760('0x1')]=_0x49f276;io['to'](util[_0x5760('0x1a')](_0x5760('0x1b'),_0x534d94[_0x5760('0x9')]))['emit']('mail_queue:save',_0x534d94);}};module[_0x5760('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 9c1231e..ce83d4d 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(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7a54,0x106));var _0x47a5=function(_0x3bb76b,_0x5c5cb5){_0x3bb76b=_0x3bb76b-0x0;var _0x3032a7=_0x7a54[_0x3bb76b];return _0x3032a7;};'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 _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};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 7c97b37..d146402 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 _0x70e0=['waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','smsPause','paused','available','stringify','sms:queue:%s','emit','exports','lodash','md5','util','redis','defaults','localhost','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x2e9ad9,_0x124a5e){var _0x359589=function(_0x32f497){while(--_0x32f497){_0x2e9ad9['push'](_0x2e9ad9['shift']());}};_0x359589(++_0x124a5e);}(_0x70e0,0x17b));var _0x070e=function(_0x1374cb,_0x30357a){_0x1374cb=_0x1374cb-0x0;var _0x4e6444=_0x70e0[_0x1374cb];return _0x4e6444;};'use strict';var _=require(_0x070e('0x0'));var md5=require(_0x070e('0x1'));var util=require(_0x070e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x070e('0x3')]=_[_0x070e('0x4')](config[_0x070e('0x3')],{'host':_0x070e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x070e('0x3')]));function SmsQueue(_0x579a6b){this['id']=_0x579a6b['id']||0x0;this[_0x070e('0x6')]=_0x579a6b['name']||'';this['timeout']=_0x579a6b['timeout']||0xa;this[_0x070e('0x7')]=_0x579a6b[_0x070e('0x7')]||_0x070e('0x8');this[_0x070e('0x9')]=_0x579a6b[_0x070e('0x9')];this[_0x070e('0xa')]={};this[_0x070e('0xb')]=0x0;this['md5']='';this['updateRouting']();this[_0x070e('0xc')]();}SmsQueue[_0x070e('0xd')][_0x070e('0xe')]=function(){var _0xb8d819=this[_0x070e('0xa')][_0x070e('0xf')];this[_0x070e('0xa')]=_[_0x070e('0x10')](this[_0x070e('0x9')],'id');this[_0x070e('0xa')][_0x070e('0xf')]=_0xb8d819;};SmsQueue['prototype']['updateRealtime']=function(){this[_0x070e('0x11')]=0x0;this['paused']=0x0;for(var _0x4a33d2=0x0;_0x4a33d2=0x0?this[_0x070e('0x15')]:0x0;var _0x2060cc={'id':this['id'],'available':this[_0x070e('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x070e('0x6')],'paused':this[_0x070e('0x14')],'waiting':this[_0x070e('0xb')]};var _0x3ea105=md5(JSON[_0x070e('0x16')](_0x2060cc));if(this['md5']!==_0x3ea105){this['md5']=_0x3ea105;io['to'](util['format'](_0x070e('0x17'),_0x2060cc[_0x070e('0x6')]))[_0x070e('0x18')]('sms_queue:save',_0x2060cc);}};module[_0x070e('0x19')]=SmsQueue; \ No newline at end of file +var _0x80d9=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','paused','length','online','smsPause','available','stringify','md5','exports','lodash','util','ioredis'];(function(_0x5f2acc,_0x47fcfd){var _0x1ec79c=function(_0xe1d16b){while(--_0xe1d16b){_0x5f2acc['push'](_0x5f2acc['shift']());}};_0x1ec79c(++_0x47fcfd);}(_0x80d9,0x15c));var _0x980d=function(_0x1f1f71,_0x468a33){_0x1f1f71=_0x1f1f71-0x0;var _0x5180af=_0x80d9[_0x1f1f71];return _0x5180af;};'use strict';var _=require(_0x980d('0x0'));var md5=require('md5');var util=require(_0x980d('0x1'));var Redis=require(_0x980d('0x2'));var config=require(_0x980d('0x3'));config['redis']=_[_0x980d('0x4')](config[_0x980d('0x5')],{'host':_0x980d('0x6'),'port':0x18eb});var io=require(_0x980d('0x7'))(new Redis(config[_0x980d('0x5')]));function SmsQueue(_0x4a1d3f){this['id']=_0x4a1d3f['id']||0x0;this['name']=_0x4a1d3f[_0x980d('0x8')]||'';this['timeout']=_0x4a1d3f['timeout']||0xa;this[_0x980d('0x9')]=_0x4a1d3f[_0x980d('0x9')]||_0x980d('0xa');this[_0x980d('0xb')]=_0x4a1d3f[_0x980d('0xb')];this[_0x980d('0xc')]={};this[_0x980d('0xd')]=0x0;this['md5']='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0x980d('0xe')][_0x980d('0xf')]=function(){var _0x4a9536=this[_0x980d('0xc')]['_rr'];this[_0x980d('0xc')]=_['map'](this[_0x980d('0xb')],'id');this[_0x980d('0xc')][_0x980d('0x10')]=_0x4a9536;};SmsQueue[_0x980d('0xe')][_0x980d('0x11')]=function(){this[_0x980d('0x12')]=0x0;this[_0x980d('0x13')]=0x0;for(var _0x3a317b=0x0;_0x3a317b=0x0?this[_0x980d('0x17')]:0x0;var _0x1bc7e4={'id':this['id'],'available':this[_0x980d('0x17')],'loggedIn':this[_0x980d('0x12')],'name':this[_0x980d('0x8')],'paused':this[_0x980d('0x13')],'waiting':this[_0x980d('0xd')]};var _0x5a9f5e=md5(JSON[_0x980d('0x18')](_0x1bc7e4));if(this[_0x980d('0x19')]!==_0x5a9f5e){this[_0x980d('0x19')]=_0x5a9f5e;io['to'](util['format']('sms:queue:%s',_0x1bc7e4[_0x980d('0x8')]))['emit']('sms_queue:save',_0x1bc7e4);}};module[_0x980d('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e7e6934..ca23053 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 _0xe29b=['paused','length','online','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe29b,0x132));var _0xbe29=function(_0x116ec4,_0x4d7553){_0x116ec4=_0x116ec4-0x0;var _0x10a048=_0xe29b[_0x116ec4];return _0x10a048;};'use strict';var _=require(_0xbe29('0x0'));var md5=require(_0xbe29('0x1'));var util=require(_0xbe29('0x2'));var Redis=require(_0xbe29('0x3'));var config=require(_0xbe29('0x4'));config[_0xbe29('0x5')]=_['defaults'](config['redis'],{'host':_0xbe29('0x6'),'port':0x18eb});var io=require(_0xbe29('0x7'))(new Redis(config[_0xbe29('0x5')]));function WhatsappQueue(_0x58b015){this['id']=_0x58b015['id']||0x0;this[_0xbe29('0x8')]=_0x58b015[_0xbe29('0x8')]||'';this[_0xbe29('0x9')]=_0x58b015['timeout']||0xa;this['strategy']=_0x58b015['strategy']||'beepall';this[_0xbe29('0xa')]=_0x58b015[_0xbe29('0xa')];this[_0xbe29('0xb')]={};this[_0xbe29('0xc')]=0x0;this[_0xbe29('0x1')]='';this[_0xbe29('0xd')]();this[_0xbe29('0xe')]();}WhatsappQueue[_0xbe29('0xf')]['updateRouting']=function(){var _0x56b362=this[_0xbe29('0xb')][_0xbe29('0x10')];this[_0xbe29('0xb')]=_['map'](this['Agents'],'id');this[_0xbe29('0xb')][_0xbe29('0x10')]=_0x56b362;};WhatsappQueue[_0xbe29('0xf')][_0xbe29('0xe')]=function(){this[_0xbe29('0x11')]=0x0;this[_0xbe29('0x12')]=0x0;for(var _0x59ca24=0x0;_0x59ca24=0x0?this[_0xbe29('0x16')]:0x0;var _0x24b7ac={'id':this['id'],'available':this[_0xbe29('0x16')],'loggedIn':this[_0xbe29('0x11')],'name':this[_0xbe29('0x8')],'paused':this[_0xbe29('0x12')],'waiting':this['waiting']};var _0x43a49f=md5(JSON[_0xbe29('0x17')](_0x24b7ac));if(this[_0xbe29('0x1')]!==_0x43a49f){this[_0xbe29('0x1')]=_0x43a49f;io['to'](util[_0xbe29('0x18')]('whatsapp:queue:%s',_0x24b7ac[_0xbe29('0x8')]))['emit'](_0xbe29('0x19'),_0x24b7ac);}};module[_0xbe29('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0xb70f=['loggedIn','stringify','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','prototype','paused','online','whatsappPause','available'];(function(_0x37c83f,_0x2e2285){var _0x127f57=function(_0x1a3dd3){while(--_0x1a3dd3){_0x37c83f['push'](_0x37c83f['shift']());}};_0x127f57(++_0x2e2285);}(_0xb70f,0x1cd));var _0xfb70=function(_0x32d332,_0x24e788){_0x32d332=_0x32d332-0x0;var _0x51444d=_0xb70f[_0x32d332];return _0x51444d;};'use strict';var _=require(_0xfb70('0x0'));var md5=require(_0xfb70('0x1'));var util=require(_0xfb70('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xfb70('0x3')]=_['defaults'](config[_0xfb70('0x3')],{'host':_0xfb70('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfb70('0x3')]));function WhatsappQueue(_0x4ca090){this['id']=_0x4ca090['id']||0x0;this[_0xfb70('0x5')]=_0x4ca090[_0xfb70('0x5')]||'';this['timeout']=_0x4ca090[_0xfb70('0x6')]||0xa;this[_0xfb70('0x7')]=_0x4ca090[_0xfb70('0x7')]||'beepall';this[_0xfb70('0x8')]=_0x4ca090['Agents'];this[_0xfb70('0x9')]={};this[_0xfb70('0xa')]=0x0;this[_0xfb70('0x1')]='';this['updateRouting']();this[_0xfb70('0xb')]();}WhatsappQueue['prototype'][_0xfb70('0xc')]=function(){var _0x6b23b1=this[_0xfb70('0x9')][_0xfb70('0xd')];this[_0xfb70('0x9')]=_['map'](this[_0xfb70('0x8')],'id');this[_0xfb70('0x9')]['_rr']=_0x6b23b1;};WhatsappQueue[_0xfb70('0xe')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xfb70('0xf')]=0x0;for(var _0x2ed4e7=0x0;_0x2ed4e7=0x0?this[_0xfb70('0x12')]:0x0;var _0x5d0fb4={'id':this['id'],'available':this[_0xfb70('0x12')],'loggedIn':this['loggedIn'],'name':this[_0xfb70('0x5')],'paused':this[_0xfb70('0xf')],'waiting':this['waiting']};var _0x2cc6f8=md5(JSON[_0xfb70('0x14')](_0x5d0fb4));if(this[_0xfb70('0x1')]!==_0x2cc6f8){this[_0xfb70('0x1')]=_0x2cc6f8;io['to'](util['format']('whatsapp:queue:%s',_0x5d0fb4[_0xfb70('0x5')]))[_0xfb70('0x15')](_0xfb70('0x16'),_0x5d0fb4);}};module[_0xfb70('0x17')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1f12761..b58d0e3 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x451194,_0x2f1ff8){var _0x527d76=function(_0x454c04){while(--_0x454c04){_0x451194['push'](_0x451194['shift']());}};_0x527d76(++_0x2f1ff8);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0xb10b[_0x3e3d0a];return _0x3fc765;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 30c3125..e65520d 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 _0x669f=['Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x669f,0x7c));var _0xf669=function(_0x3a9661,_0x530b12){_0x3a9661=_0x3a9661-0x0;var _0x5bb119=_0x669f[_0x3a9661];return _0x5bb119;};'use strict';var client=require(_0xf669('0x0'));exports[_0xf669('0x1')]=function(_0xc321bf,_0x1ebc25){return client[_0xf669('0x2')](_0xf669('0x3'),{'body':_0x1ebc25,'options':{'where':{'id':_0xc321bf}},'log':_0xf669('0x4')});};exports[_0xf669('0x5')]=function(_0x5a65c9,_0x5aa747){return client[_0xf669('0x2')](_0xf669('0x6'),{'body':_0x5aa747,'options':{'where':{'id':_0x5a65c9}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe851=['Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update'];(function(_0x352d04,_0x3991b5){var _0x5d53cb=function(_0x3593f7){while(--_0x3593f7){_0x352d04['push'](_0x352d04['shift']());}};_0x5d53cb(++_0x3991b5);}(_0xe851,0x10f));var _0x1e85=function(_0x40dd8e,_0x29a8df){_0x40dd8e=_0x40dd8e-0x0;var _0x39517b=_0xe851[_0x40dd8e];return _0x39517b;};'use strict';var client=require(_0x1e85('0x0'));exports[_0x1e85('0x1')]=function(_0x112cf3,_0x3e2b19){return client[_0x1e85('0x2')](_0x1e85('0x3'),{'body':_0x3e2b19,'options':{'where':{'id':_0x112cf3}},'log':'updateChatInteraction'});};exports[_0x1e85('0x4')]=function(_0x111c44,_0x21fe8a){return client[_0x1e85('0x2')](_0x1e85('0x5'),{'body':_0x21fe8a,'options':{'where':{'id':_0x111c44}},'log':_0x1e85('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6caf4aa..2eee1e2 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 _0xec6a=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x5b0af6,_0x3060ee){var _0x15a087=function(_0x3f70bb){while(--_0x3f70bb){_0x5b0af6['push'](_0x5b0af6['shift']());}};_0x15a087(++_0x3060ee);}(_0xec6a,0x134));var _0xaec6=function(_0x380dd0,_0x20706b){_0x380dd0=_0x380dd0-0x0;var _0x587d5a=_0xec6a[_0x380dd0];return _0x587d5a;};'use strict';var client=require('../client');exports[_0xaec6('0x0')]=function(_0x5a0217){return client[_0xaec6('0x1')](_0xaec6('0x2'),{'body':_0x5a0217,'log':_0xaec6('0x3')});}; \ No newline at end of file +var _0x7c93=['../client','CreateChatMessage','createChatMessage'];(function(_0x4d674b,_0x176474){var _0x535a1f=function(_0xac7726){while(--_0xac7726){_0x4d674b['push'](_0x4d674b['shift']());}};_0x535a1f(++_0x176474);}(_0x7c93,0xcc));var _0x37c9=function(_0x5cf3ee,_0x2fca46){_0x5cf3ee=_0x5cf3ee-0x0;var _0x3b4fc2=_0x7c93[_0x5cf3ee];return _0x3b4fc2;};'use strict';var client=require(_0x37c9('0x0'));exports['create']=function(_0x5d7666){return client['Request'](_0x37c9('0x1'),{'body':_0x5d7666,'log':_0x37c9('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a7cb28e..370b00f 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 _0x74f3=['timeout','strategy','User','online','../client','getChatQueues','Request','name'];(function(_0x56e3ad,_0x35b520){var _0x46a129=function(_0x1b3431){while(--_0x1b3431){_0x56e3ad['push'](_0x56e3ad['shift']());}};_0x46a129(++_0x35b520);}(_0x74f3,0x164));var _0x374f=function(_0x4ef0d8,_0x472590){_0x4ef0d8=_0x4ef0d8-0x0;var _0x11f79f=_0x74f3[_0x4ef0d8];return _0x11f79f;};'use strict';var client=require(_0x374f('0x0'));exports[_0x374f('0x1')]=function(){return function(){return client[_0x374f('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x374f('0x3'),_0x374f('0x4'),_0x374f('0x5')],'include':[{'model':_0x374f('0x6'),'as':'Agents','attributes':['id',_0x374f('0x3'),_0x374f('0x7'),'chatPause']}]},'log':_0x374f('0x1')});};}; \ No newline at end of file +var _0x6f72=['GetChatQueue','timeout','strategy','Agents','name','chatPause','getChatQueues','Request'];(function(_0x5a0170,_0x5ded50){var _0x34115c=function(_0x31d1b4){while(--_0x31d1b4){_0x5a0170['push'](_0x5a0170['shift']());}};_0x34115c(++_0x5ded50);}(_0x6f72,0xae));var _0x26f7=function(_0x18a42e,_0x2d420d){_0x18a42e=_0x18a42e-0x0;var _0x41b3e6=_0x6f72[_0x18a42e];return _0x41b3e6;};'use strict';var client=require('../client');exports[_0x26f7('0x0')]=function(){return function(){return client[_0x26f7('0x1')](_0x26f7('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x26f7('0x3'),_0x26f7('0x4')],'include':[{'model':'User','as':_0x26f7('0x5'),'attributes':['id',_0x26f7('0x6'),'online',_0x26f7('0x7')]}]},'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 91f4ef2..b853809 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 _0x43f3=['UpdateChatQueueReport','create','CreateChatQueueReport','update','Request'];(function(_0x24d06b,_0x3386d0){var _0x116a09=function(_0x580f6c){while(--_0x580f6c){_0x24d06b['push'](_0x24d06b['shift']());}};_0x116a09(++_0x3386d0);}(_0x43f3,0xab));var _0x343f=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x43f3[_0x237546];return _0x233e29;};'use strict';var client=require('../client');exports[_0x343f('0x0')]=function(_0x177f01){return client['Request'](_0x343f('0x1'),{'body':_0x177f01,'log':'CreateChatQueueReport'});};exports[_0x343f('0x2')]=function(_0x48008f,_0x3339a9){return client[_0x343f('0x3')](_0x343f('0x4'),{'body':_0x3339a9,'options':{'where':{'uniqueid':_0x48008f},'order':[['id','DESC']],'limit':0x1},'log':_0x343f('0x4')});}; \ No newline at end of file +var _0xc18a=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0xc18a,0x1cf));var _0xac18=function(_0x13518d,_0x5536b0){_0x13518d=_0x13518d-0x0;var _0x1fe3e8=_0xc18a[_0x13518d];return _0x1fe3e8;};'use strict';var client=require(_0xac18('0x0'));exports[_0xac18('0x1')]=function(_0x1bb84d){return client[_0xac18('0x2')]('CreateChatQueueReport',{'body':_0x1bb84d,'log':_0xac18('0x3')});};exports[_0xac18('0x4')]=function(_0x3bf117,_0x3da5f5){return client[_0xac18('0x2')](_0xac18('0x5'),{'body':_0x3da5f5,'options':{'where':{'uniqueid':_0x3bf117},'order':[['id',_0xac18('0x6')]],'limit':0x1},'log':_0xac18('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 9a990b7..aa93ba3 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0x7a54,0x106));var _0x47a5=function(_0x5af702,_0x4bd838){_0x5af702=_0x5af702-0x0;var _0xd3b562=_0x7a54[_0x5af702];return _0xd3b562;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x117643,_0x2b3351){var _0x4f9ce1=function(_0x3500b8){while(--_0x3500b8){_0x117643['push'](_0x117643['shift']());}};_0x4f9ce1(++_0x2b3351);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 4b4f77c..7dda540 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 _0xa85f=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x4bb42d,_0x335f18){var _0x48d2ab=function(_0xf92988){while(--_0xf92988){_0x4bb42d['push'](_0x4bb42d['shift']());}};_0x48d2ab(++_0x335f18);}(_0xa85f,0x13b));var _0xfa85=function(_0x135b18,_0x259a03){_0x135b18=_0x135b18-0x0;var _0xf4db7b=_0xa85f[_0x135b18];return _0xf4db7b;};'use strict';var client=require(_0xfa85('0x0'));exports[_0xfa85('0x1')]=function(_0x281449){return client['Request'](_0xfa85('0x2'),{'body':_0x281449,'log':_0xfa85('0x3')});}; \ No newline at end of file +var _0x8389=['create','CreateFaxMessage','createFaxMessage'];(function(_0x44f755,_0xa774c7){var _0x47e9a4=function(_0x492e8c){while(--_0x492e8c){_0x44f755['push'](_0x44f755['shift']());}};_0x47e9a4(++_0xa774c7);}(_0x8389,0xde));var _0x9838=function(_0x103b02,_0x3f9ad8){_0x103b02=_0x103b02-0x0;var _0x3db8b3=_0x8389[_0x103b02];return _0x3db8b3;};'use strict';var client=require('../client');exports[_0x9838('0x0')]=function(_0x356416){return client['Request'](_0x9838('0x1'),{'body':_0x356416,'log':_0x9838('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 14238b3..72384ae 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 _0x5038=['GetFaxQueue','name','timeout','User','online','faxPause','getFaxQueues','../client','Request'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0x5038,0x1ae));var _0x8503=function(_0x55454d,_0xbfdf9d){_0x55454d=_0x55454d-0x0;var _0xa418d2=_0x5038[_0x55454d];return _0xa418d2;};'use strict';var client=require(_0x8503('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x8503('0x1')](_0x8503('0x2'),{'options':{'raw':![],'attributes':['id',_0x8503('0x3'),_0x8503('0x4'),'strategy'],'include':[{'model':_0x8503('0x5'),'as':'Agents','attributes':['id',_0x8503('0x3'),_0x8503('0x6'),_0x8503('0x7')]}]},'log':_0x8503('0x8')});};}; \ No newline at end of file +var _0x2a47=['../client','getFaxQueues','Request','GetFaxQueue','name','strategy','User','Agents','online','faxPause'];(function(_0x14dfb6,_0x4d38ea){var _0x28afe9=function(_0x210c8e){while(--_0x210c8e){_0x14dfb6['push'](_0x14dfb6['shift']());}};_0x28afe9(++_0x4d38ea);}(_0x2a47,0x140));var _0x72a4=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x2a47[_0x45d3f0];return _0x314b79;};'use strict';var client=require(_0x72a4('0x0'));exports[_0x72a4('0x1')]=function(){return function(){return client[_0x72a4('0x2')](_0x72a4('0x3'),{'options':{'raw':![],'attributes':['id',_0x72a4('0x4'),'timeout',_0x72a4('0x5')],'include':[{'model':_0x72a4('0x6'),'as':_0x72a4('0x7'),'attributes':['id',_0x72a4('0x4'),_0x72a4('0x8'),_0x72a4('0x9')]}]},'log':_0x72a4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 868b46e..af7ff7a 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 _0x7e62=['CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x3f27f3,_0x5469e1){var _0x53e624=function(_0x49ef1b){while(--_0x49ef1b){_0x3f27f3['push'](_0x3f27f3['shift']());}};_0x53e624(++_0x5469e1);}(_0x7e62,0x190));var _0x27e6=function(_0x9d7c2,_0x511703){_0x9d7c2=_0x9d7c2-0x0;var _0x5d7a36=_0x7e62[_0x9d7c2];return _0x5d7a36;};'use strict';var client=require(_0x27e6('0x0'));exports[_0x27e6('0x1')]=function(_0x26fafb){return client['Request'](_0x27e6('0x2'),{'body':_0x26fafb,'log':_0x27e6('0x2')});};exports['update']=function(_0x587764,_0x5ccb05){return client[_0x27e6('0x3')](_0x27e6('0x4'),{'body':_0x5ccb05,'options':{'where':{'uniqueid':_0x587764},'order':[['id',_0x27e6('0x5')]],'limit':0x1},'log':_0x27e6('0x4')});}; \ No newline at end of file +var _0x0e12=['DESC','../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0e12,0x169));var _0x20e1=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x0e12[_0xe66cf2];return _0x2d84e7;};'use strict';var client=require(_0x20e1('0x0'));exports['create']=function(_0x409b7d){return client[_0x20e1('0x1')](_0x20e1('0x2'),{'body':_0x409b7d,'log':_0x20e1('0x2')});};exports[_0x20e1('0x3')]=function(_0x42ee30,_0x314dbc){return client['Request'](_0x20e1('0x4'),{'body':_0x314dbc,'options':{'where':{'uniqueid':_0x42ee30},'order':[['id',_0x20e1('0x5')]],'limit':0x1},'log':_0x20e1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 305787a..a4494d8 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 _0x9b0f=['Interval','Intervals','../client','getIntervals'];(function(_0x46bd97,_0x754606){var _0x36b8f3=function(_0x2a305c){while(--_0x2a305c){_0x46bd97['push'](_0x46bd97['shift']());}};_0x36b8f3(++_0x754606);}(_0x9b0f,0x1b2));var _0xf9b0=function(_0x49dce2,_0x50763b){_0x49dce2=_0x49dce2-0x0;var _0x121560=_0x9b0f[_0x49dce2];return _0x121560;};'use strict';var client=require(_0xf9b0('0x0'));exports[_0xf9b0('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xf9b0('0x2'),'as':_0xf9b0('0x3'),'attributes':['id','name','interval']}]},'log':_0xf9b0('0x1')});};}; \ No newline at end of file +var _0xd93c=['getIntervals','Request','GetInterval','name','Interval','Intervals'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd93c,0x144));var _0xcd93=function(_0x4546bc,_0x4bc388){_0x4546bc=_0x4546bc-0x0;var _0x2b1980=_0xd93c[_0x4546bc];return _0x2b1980;};'use strict';var client=require('../client');exports[_0xcd93('0x0')]=function(){return function(){return client[_0xcd93('0x1')](_0xcd93('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcd93('0x3')],'include':[{'model':_0xcd93('0x4'),'as':_0xcd93('0x5'),'attributes':['id',_0xcd93('0x3'),'interval']}]},'log':_0xcd93('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 9798ea1..f82b64d 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 _0xd943=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x495bb5,_0x431f9b){var _0x3f9630=function(_0x535ac3){while(--_0x535ac3){_0x495bb5['push'](_0x495bb5['shift']());}};_0x3f9630(++_0x431f9b);}(_0xd943,0x15d));var _0x3d94=function(_0x57f790,_0x17bf16){_0x57f790=_0x57f790-0x0;var _0x2b954d=_0xd943[_0x57f790];return _0x2b954d;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x55353d,_0x440dd8){return client['Request'](_0x3d94('0x2'),{'body':_0x440dd8,'options':{'where':{'id':_0x55353d}},'log':_0x3d94('0x3')});};exports[_0x3d94('0x4')]=function(_0xc13b61,_0xaf8962){return client['Request']('AddTagsToMailInteraction',{'body':_0xaf8962,'options':{'where':{'id':_0xc13b61}},'log':_0x3d94('0x5')});}; \ No newline at end of file +var _0x5b12=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x25904d,_0x398a7c){var _0x129dcb=function(_0xabfb76){while(--_0xabfb76){_0x25904d['push'](_0x25904d['shift']());}};_0x129dcb(++_0x398a7c);}(_0x5b12,0xa3));var _0x25b1=function(_0x183ca1,_0x3be397){_0x183ca1=_0x183ca1-0x0;var _0x2b3545=_0x5b12[_0x183ca1];return _0x2b3545;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(_0x1fe5c1,_0x569948){return client[_0x25b1('0x2')]('UpdateMailInteraction',{'body':_0x569948,'options':{'where':{'id':_0x1fe5c1}},'log':_0x25b1('0x3')});};exports[_0x25b1('0x4')]=function(_0x47995b,_0x31f3fc){return client['Request']('AddTagsToMailInteraction',{'body':_0x31f3fc,'options':{'where':{'id':_0x47995b}},'log':_0x25b1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 0691ed3..1877898 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 _0x6d82=['../client','CreateMailMessage','createMailMessage'];(function(_0x486cbf,_0x2b4646){var _0x5a61d7=function(_0xaa3e03){while(--_0xaa3e03){_0x486cbf['push'](_0x486cbf['shift']());}};_0x5a61d7(++_0x2b4646);}(_0x6d82,0x180));var _0x26d8=function(_0x4e2abf,_0x476d5d){_0x4e2abf=_0x4e2abf-0x0;var _0x25eb38=_0x6d82[_0x4e2abf];return _0x25eb38;};'use strict';var client=require(_0x26d8('0x0'));exports['create']=function(_0x205361){return client['Request'](_0x26d8('0x1'),{'body':_0x205361,'log':_0x26d8('0x2')});}; \ No newline at end of file +var _0x986e=['../client','create','Request','CreateMailMessage'];(function(_0x5ab62b,_0x8b7ce2){var _0x2d44be=function(_0x1cdaca){while(--_0x1cdaca){_0x5ab62b['push'](_0x5ab62b['shift']());}};_0x2d44be(++_0x8b7ce2);}(_0x986e,0x1a0));var _0xe986=function(_0x464fe5,_0x59ee12){_0x464fe5=_0x464fe5-0x0;var _0x20019f=_0x986e[_0x464fe5];return _0x20019f;};'use strict';var client=require(_0xe986('0x0'));exports[_0xe986('0x1')]=function(_0x8bb7fc){return client[_0xe986('0x2')](_0xe986('0x3'),{'body':_0x8bb7fc,'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 06ef6db..1842e41 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 _0xae90=['mailPause','name','timeout','strategy','Agents','online'];(function(_0x2538ca,_0xb651c1){var _0x5b4cee=function(_0x1ad646){while(--_0x1ad646){_0x2538ca['push'](_0x2538ca['shift']());}};_0x5b4cee(++_0xb651c1);}(_0xae90,0x11b));var _0x0ae9=function(_0x4d2465,_0x1f8052){_0x4d2465=_0x4d2465-0x0;var _0x40d52b=_0xae90[_0x4d2465];return _0x40d52b;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x0ae9('0x0'),_0x0ae9('0x1'),_0x0ae9('0x2')],'include':[{'model':'User','as':_0x0ae9('0x3'),'attributes':['id',_0x0ae9('0x0'),_0x0ae9('0x4'),_0x0ae9('0x5')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x32fd=['name','timeout','strategy','User','Agents','online','mailPause','../client','getMailQueues','GetMailQueue'];(function(_0x4ae8f6,_0x249ff9){var _0x212a6a=function(_0x1541f8){while(--_0x1541f8){_0x4ae8f6['push'](_0x4ae8f6['shift']());}};_0x212a6a(++_0x249ff9);}(_0x32fd,0x15b));var _0xd32f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x32fd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd32f('0x0'));exports[_0xd32f('0x1')]=function(){return function(){return client['Request'](_0xd32f('0x2'),{'options':{'raw':![],'attributes':['id',_0xd32f('0x3'),_0xd32f('0x4'),_0xd32f('0x5')],'include':[{'model':_0xd32f('0x6'),'as':_0xd32f('0x7'),'attributes':['id','name',_0xd32f('0x8'),_0xd32f('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e72fb5a..4a1261d 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 _0xc1fd=['update','UpdateMailQueueReport','DESC','../client','create','Request','CreateMailQueueReport'];(function(_0x4de1c3,_0xbe77b9){var _0x26acfe=function(_0x2c9df4){while(--_0x2c9df4){_0x4de1c3['push'](_0x4de1c3['shift']());}};_0x26acfe(++_0xbe77b9);}(_0xc1fd,0x8f));var _0xdc1f=function(_0x347c58,_0x19b3e5){_0x347c58=_0x347c58-0x0;var _0x4fa9d2=_0xc1fd[_0x347c58];return _0x4fa9d2;};'use strict';var client=require(_0xdc1f('0x0'));exports[_0xdc1f('0x1')]=function(_0x5f1c2f){return client[_0xdc1f('0x2')](_0xdc1f('0x3'),{'body':_0x5f1c2f,'log':_0xdc1f('0x3')});};exports[_0xdc1f('0x4')]=function(_0x561f01,_0x2b5cd1){return client[_0xdc1f('0x2')](_0xdc1f('0x5'),{'body':_0x2b5cd1,'options':{'where':{'uniqueid':_0x561f01},'order':[['id',_0xdc1f('0x6')]],'limit':0x1},'log':_0xdc1f('0x5')});}; \ No newline at end of file +var _0x3956=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','../client','create'];(function(_0x36112e,_0x12df14){var _0x59eb59=function(_0xa6470d){while(--_0xa6470d){_0x36112e['push'](_0x36112e['shift']());}};_0x59eb59(++_0x12df14);}(_0x3956,0x14e));var _0x6395=function(_0x36a469,_0x59d84c){_0x36a469=_0x36a469-0x0;var _0x3347fc=_0x3956[_0x36a469];return _0x3347fc;};'use strict';var client=require(_0x6395('0x0'));exports[_0x6395('0x1')]=function(_0x2cef2f){return client['Request'](_0x6395('0x2'),{'body':_0x2cef2f,'log':_0x6395('0x2')});};exports[_0x6395('0x3')]=function(_0x3f632c,_0x1fbd95){return client[_0x6395('0x4')](_0x6395('0x5'),{'body':_0x1fbd95,'options':{'where':{'uniqueid':_0x3f632c},'order':[['id','DESC']],'limit':0x1},'log':_0x6395('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 568632e..6dbc285 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 _0x72ee=['updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x4ae506,_0x5a97ed){var _0x18e3a1=function(_0x3995a2){while(--_0x3995a2){_0x4ae506['push'](_0x4ae506['shift']());}};_0x18e3a1(++_0x5a97ed);}(_0x72ee,0x1e4));var _0xe72e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x72ee[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require(_0xe72e('0x0'));exports[_0xe72e('0x1')]=function(_0x3015cc,_0xc2326e){return client[_0xe72e('0x2')](_0xe72e('0x3'),{'body':_0xc2326e,'options':{'where':{'id':_0x3015cc}},'log':_0xe72e('0x4')});};exports[_0xe72e('0x5')]=function(_0x43d400,_0x4b438d){return client[_0xe72e('0x2')](_0xe72e('0x6'),{'body':_0x4b438d,'options':{'where':{'id':_0x43d400}},'log':_0xe72e('0x7')});}; \ No newline at end of file +var _0xb75d=['AddTagsToOpenchannelInteraction','../client','update','addTags'];(function(_0x5c977d,_0x178322){var _0x48e5df=function(_0x14250c){while(--_0x14250c){_0x5c977d['push'](_0x5c977d['shift']());}};_0x48e5df(++_0x178322);}(_0xb75d,0x99));var _0xdb75=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0xb75d[_0x22cb5f];return _0x274d36;};'use strict';var client=require(_0xdb75('0x0'));exports[_0xdb75('0x1')]=function(_0x1b49de,_0x47c85e){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x47c85e,'options':{'where':{'id':_0x1b49de}},'log':'updateOpenchannelInteraction'});};exports[_0xdb75('0x2')]=function(_0x594f5d,_0x5a8ed9){return client['Request'](_0xdb75('0x3'),{'body':_0x5a8ed9,'options':{'where':{'id':_0x594f5d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 2bafcb5..6fe4c63 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 _0x16a5=['Request','createOpenchannelMessage','create'];(function(_0x2dc54c,_0x1613ff){var _0x369d5f=function(_0x3f504a){while(--_0x3f504a){_0x2dc54c['push'](_0x2dc54c['shift']());}};_0x369d5f(++_0x1613ff);}(_0x16a5,0x8c));var _0x516a=function(_0x4ffc34,_0x5db65f){_0x4ffc34=_0x4ffc34-0x0;var _0x46b4df=_0x16a5[_0x4ffc34];return _0x46b4df;};'use strict';var client=require('../client');exports[_0x516a('0x0')]=function(_0x22ea14){return client[_0x516a('0x1')]('CreateOpenchannelMessage',{'body':_0x22ea14,'log':_0x516a('0x2')});}; \ No newline at end of file +var _0x7df1=['createOpenchannelMessage','../client','CreateOpenchannelMessage'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x7df1,0x124));var _0x17df=function(_0x36c714,_0x437e56){_0x36c714=_0x36c714-0x0;var _0x2a3723=_0x7df1[_0x36c714];return _0x2a3723;};'use strict';var client=require(_0x17df('0x0'));exports['create']=function(_0x1976d1){return client['Request'](_0x17df('0x1'),{'body':_0x1976d1,'log':_0x17df('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d41f9dd..6399a0c 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 _0x9115=['Request','GetOpenchannelQueue','name','strategy','User','Agents','online','openchannelPause','getOpenchannelQueues'];(function(_0x1c53e1,_0x2f11a8){var _0x1f5b1f=function(_0x37bc47){while(--_0x37bc47){_0x1c53e1['push'](_0x1c53e1['shift']());}};_0x1f5b1f(++_0x2f11a8);}(_0x9115,0x8f));var _0x5911=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x9115[_0x4aba15];return _0x1c8122;};'use strict';var client=require('../client');exports[_0x5911('0x0')]=function(){return function(){return client[_0x5911('0x1')](_0x5911('0x2'),{'options':{'raw':![],'attributes':['id',_0x5911('0x3'),'timeout',_0x5911('0x4')],'include':[{'model':_0x5911('0x5'),'as':_0x5911('0x6'),'attributes':['id',_0x5911('0x3'),_0x5911('0x7'),_0x5911('0x8')]}]},'log':_0x5911('0x0')});};}; \ No newline at end of file +var _0x18af=['../client','getOpenchannelQueues','name','timeout','strategy','User','Agents','online','openchannelPause'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0x18af,0x17a));var _0xf18a=function(_0x4c68f0,_0x18e3b7){_0x4c68f0=_0x4c68f0-0x0;var _0x48cca8=_0x18af[_0x4c68f0];return _0x48cca8;};'use strict';var client=require(_0xf18a('0x0'));exports[_0xf18a('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xf18a('0x2'),_0xf18a('0x3'),_0xf18a('0x4')],'include':[{'model':_0xf18a('0x5'),'as':_0xf18a('0x6'),'attributes':['id',_0xf18a('0x2'),_0xf18a('0x7'),_0xf18a('0x8')]}]},'log':_0xf18a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a5b4172..fd8a743 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 _0x342c=['../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x342c,0x149));var _0xc342=function(_0x9d5412,_0x3c6b97){_0x9d5412=_0x9d5412-0x0;var _0x10977f=_0x342c[_0x9d5412];return _0x10977f;};'use strict';var client=require(_0xc342('0x0'));exports[_0xc342('0x1')]=function(_0x5ca670){return client[_0xc342('0x2')](_0xc342('0x3'),{'body':_0x5ca670,'log':_0xc342('0x3')});};exports[_0xc342('0x4')]=function(_0x795b47,_0x5553d2){return client[_0xc342('0x2')](_0xc342('0x5'),{'body':_0x5553d2,'options':{'where':{'uniqueid':_0x795b47},'order':[['id',_0xc342('0x6')]],'limit':0x1},'log':_0xc342('0x5')});}; \ No newline at end of file +var _0xd6e2=['DESC','../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x5452bc,_0x4c5ce3){var _0x301bd8=function(_0x3ff438){while(--_0x3ff438){_0x5452bc['push'](_0x5452bc['shift']());}};_0x301bd8(++_0x4c5ce3);}(_0xd6e2,0x169));var _0x2d6e=function(_0x330e11,_0x55cb67){_0x330e11=_0x330e11-0x0;var _0x3793ca=_0xd6e2[_0x330e11];return _0x3793ca;};'use strict';var client=require(_0x2d6e('0x0'));exports['create']=function(_0x5abe1b){return client[_0x2d6e('0x1')](_0x2d6e('0x2'),{'body':_0x5abe1b,'log':_0x2d6e('0x2')});};exports[_0x2d6e('0x3')]=function(_0xa75d5a,_0x52d498){return client['Request'](_0x2d6e('0x4'),{'body':_0x52d498,'options':{'where':{'uniqueid':_0xa75d5a},'order':[['id',_0x2d6e('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 034bf4f..66d9012 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 _0xef8b=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x2ebf1b,_0x55921d){var _0x494b12=function(_0x5dfafb){while(--_0x5dfafb){_0x2ebf1b['push'](_0x2ebf1b['shift']());}};_0x494b12(++_0x55921d);}(_0xef8b,0x192));var _0xbef8=function(_0x37e307,_0x378e6c){_0x37e307=_0x37e307-0x0;var _0x44a38c=_0xef8b[_0x37e307];return _0x44a38c;};'use strict';var client=require('../client');exports[_0xbef8('0x0')]=function(_0x2c70dc,_0x98588a){return client[_0xbef8('0x1')](_0xbef8('0x2'),{'body':_0x98588a,'options':{'where':{'id':_0x2c70dc}},'log':_0xbef8('0x3')});};exports[_0xbef8('0x4')]=function(_0x224dd2,_0x201996){return client[_0xbef8('0x1')](_0xbef8('0x5'),{'body':_0x201996,'options':{'where':{'id':_0x224dd2}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xbe52=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x115828,_0x422beb){var _0x522f32=function(_0x30e1b4){while(--_0x30e1b4){_0x115828['push'](_0x115828['shift']());}};_0x522f32(++_0x422beb);}(_0xbe52,0x164));var _0x2be5=function(_0x462505,_0x10d688){_0x462505=_0x462505-0x0;var _0x10cc55=_0xbe52[_0x462505];return _0x10cc55;};'use strict';var client=require(_0x2be5('0x0'));exports[_0x2be5('0x1')]=function(_0x1a1548,_0x376828){return client[_0x2be5('0x2')]('UpdateSmsInteraction',{'body':_0x376828,'options':{'where':{'id':_0x1a1548}},'log':_0x2be5('0x3')});};exports[_0x2be5('0x4')]=function(_0x3339d3,_0x20abd0){return client[_0x2be5('0x2')](_0x2be5('0x5'),{'body':_0x20abd0,'options':{'where':{'id':_0x3339d3}},'log':_0x2be5('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2aa4500..0579f5c 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 _0x0ce4=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0ce4,0x12e));var _0x40ce=function(_0x4f7618,_0x243df2){_0x4f7618=_0x4f7618-0x0;var _0x20ba5f=_0x0ce4[_0x4f7618];return _0x20ba5f;};'use strict';var client=require(_0x40ce('0x0'));exports[_0x40ce('0x1')]=function(_0x4c25a3){return client[_0x40ce('0x2')](_0x40ce('0x3'),{'body':_0x4c25a3,'log':_0x40ce('0x4')});}; \ No newline at end of file +var _0x23d4=['../client','create','Request','createSmsMessage'];(function(_0x135b29,_0x1df51a){var _0x41f6b6=function(_0x576a1e){while(--_0x576a1e){_0x135b29['push'](_0x135b29['shift']());}};_0x41f6b6(++_0x1df51a);}(_0x23d4,0x1e8));var _0x423d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23d4[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x423d('0x0'));exports[_0x423d('0x1')]=function(_0xa3f72c){return client[_0x423d('0x2')]('CreateSmsMessage',{'body':_0xa3f72c,'log':_0x423d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 557f3ab..a026a1f 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(_0x4205f4,_0xb36250){var _0x209ebf=function(_0x33d98c){while(--_0x33d98c){_0x4205f4['push'](_0x4205f4['shift']());}};_0x209ebf(++_0xb36250);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x1035a1,_0x333e06){var _0x1f3b8f=function(_0x1ba514){while(--_0x1ba514){_0x1035a1['push'](_0x1035a1['shift']());}};_0x1f3b8f(++_0x333e06);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xcb91[_0x3ccdf8];return _0x243dab;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 694af60..947e971 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x2da583,_0x3bf5da){var _0x44b02a=function(_0xb9115c){while(--_0xb9115c){_0x2da583['push'](_0x2da583['shift']());}};_0x44b02a(++_0x3bf5da);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x4e27cc,_0x8eca75){var _0x5e2fac=function(_0x993d76){while(--_0x993d76){_0x4e27cc['push'](_0x4e27cc['shift']());}};_0x5e2fac(++_0x8eca75);}(_0x008c,0x188));var _0xc008=function(_0x110e11,_0x2386fb){_0x110e11=_0x110e11-0x0;var _0x16d509=_0x008c[_0x110e11];return _0x16d509;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1e1af0a..783aeab 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(_0x5a7777,_0x1b9186){var _0x12881f=function(_0x11850a){while(--_0x11850a){_0x5a7777['push'](_0x5a7777['shift']());}};_0x12881f(++_0x1b9186);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x3added,_0x3b1dfc){var _0x40737a=function(_0x56aff4){while(--_0x56aff4){_0x3added['push'](_0x3added['shift']());}};_0x40737a(++_0x3b1dfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 7d2578c..5c8c5a3 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 _0x9fc5=['addTags','AddTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x333ea8,_0x1701c1){var _0x283419=function(_0x2b1f99){while(--_0x2b1f99){_0x333ea8['push'](_0x333ea8['shift']());}};_0x283419(++_0x1701c1);}(_0x9fc5,0xb6));var _0x59fc=function(_0x4404ff,_0x13d7a9){_0x4404ff=_0x4404ff-0x0;var _0x5e7b19=_0x9fc5[_0x4404ff];return _0x5e7b19;};'use strict';var client=require('../client');exports[_0x59fc('0x0')]=function(_0x6e30f8,_0x4a0dd0){return client[_0x59fc('0x1')](_0x59fc('0x2'),{'body':_0x4a0dd0,'options':{'where':{'id':_0x6e30f8}},'log':_0x59fc('0x3')});};exports[_0x59fc('0x4')]=function(_0x44979c,_0x1b0778){return client[_0x59fc('0x1')](_0x59fc('0x5'),{'body':_0x1b0778,'options':{'where':{'id':_0x44979c}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xb931=['updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','UpdateWhatsappInteraction'];(function(_0x5e8c59,_0x293858){var _0x293685=function(_0x226eaa){while(--_0x226eaa){_0x5e8c59['push'](_0x5e8c59['shift']());}};_0x293685(++_0x293858);}(_0xb931,0x155));var _0x1b93=function(_0x1f6732,_0x58e902){_0x1f6732=_0x1f6732-0x0;var _0x3f932a=_0xb931[_0x1f6732];return _0x3f932a;};'use strict';var client=require('../client');exports['update']=function(_0xbac405,_0x57105d){return client['Request'](_0x1b93('0x0'),{'body':_0x57105d,'options':{'where':{'id':_0xbac405}},'log':_0x1b93('0x1')});};exports[_0x1b93('0x2')]=function(_0x42a943,_0x1c8b77){return client[_0x1b93('0x3')](_0x1b93('0x4'),{'body':_0x1c8b77,'options':{'where':{'id':_0x42a943}},'log':_0x1b93('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 01e027e..cab7af9 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 _0x1aeb=['create','Request','CreateWhatsappMessage','../client'];(function(_0x5009d9,_0x310504){var _0x2b4b9b=function(_0xe9edb4){while(--_0xe9edb4){_0x5009d9['push'](_0x5009d9['shift']());}};_0x2b4b9b(++_0x310504);}(_0x1aeb,0x137));var _0xb1ae=function(_0x4249c9,_0x173aea){_0x4249c9=_0x4249c9-0x0;var _0x3ba4b8=_0x1aeb[_0x4249c9];return _0x3ba4b8;};'use strict';var client=require(_0xb1ae('0x0'));exports[_0xb1ae('0x1')]=function(_0xa3a30e){return client[_0xb1ae('0x2')](_0xb1ae('0x3'),{'body':_0xa3a30e,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xb616=['../client','create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x383627,_0x5be16e){var _0x2c16a0=function(_0x569b72){while(--_0x569b72){_0x383627['push'](_0x383627['shift']());}};_0x2c16a0(++_0x5be16e);}(_0xb616,0x1ec));var _0x6b61=function(_0x1721b3,_0x64c349){_0x1721b3=_0x1721b3-0x0;var _0x4aea05=_0xb616[_0x1721b3];return _0x4aea05;};'use strict';var client=require(_0x6b61('0x0'));exports[_0x6b61('0x1')]=function(_0x15ca6b){return client['Request'](_0x6b61('0x2'),{'body':_0x15ca6b,'log':_0x6b61('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index f26bd41..98a95dc 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 _0xbcad=['whatsappPause','getWhatsappQueues','../client','GetWhatsappQueue','name','Agents','online'];(function(_0x121090,_0x303207){var _0x1a56a8=function(_0x16e9ef){while(--_0x16e9ef){_0x121090['push'](_0x121090['shift']());}};_0x1a56a8(++_0x303207);}(_0xbcad,0x159));var _0xdbca=function(_0xc2d073,_0x1ad1fe){_0xc2d073=_0xc2d073-0x0;var _0x3a4d81=_0xbcad[_0xc2d073];return _0x3a4d81;};'use strict';var client=require(_0xdbca('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0xdbca('0x1'),{'options':{'raw':![],'attributes':['id',_0xdbca('0x2'),'timeout','strategy'],'include':[{'model':'User','as':_0xdbca('0x3'),'attributes':['id','name',_0xdbca('0x4'),_0xdbca('0x5')]}]},'log':_0xdbca('0x6')});};}; \ No newline at end of file +var _0xf537=['../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','User','name','online'];(function(_0x413f5c,_0x5d9c5c){var _0x1a27a0=function(_0x2e6152){while(--_0x2e6152){_0x413f5c['push'](_0x413f5c['shift']());}};_0x1a27a0(++_0x5d9c5c);}(_0xf537,0x130));var _0x7f53=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf537[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x7f53('0x0'));exports[_0x7f53('0x1')]=function(){return function(){return client[_0x7f53('0x2')](_0x7f53('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7f53('0x4'),'strategy'],'include':[{'model':_0x7f53('0x5'),'as':'Agents','attributes':['id',_0x7f53('0x6'),_0x7f53('0x7'),'whatsappPause']}]},'log':_0x7f53('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index ce1b2b2..30c3af1 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 _0x3648=['Request','UpdateWhatsappQueueReport','DESC','../client','update'];(function(_0x31ddba,_0x28ec26){var _0x3f014c=function(_0x24aa10){while(--_0x24aa10){_0x31ddba['push'](_0x31ddba['shift']());}};_0x3f014c(++_0x28ec26);}(_0x3648,0xbc));var _0x8364=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3648[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x8364('0x0'));exports['create']=function(_0x2f6dbd){return client['Request']('CreateWhatsappQueueReport',{'body':_0x2f6dbd,'log':'CreateWhatsappQueueReport'});};exports[_0x8364('0x1')]=function(_0x3d5468,_0xdedff){return client[_0x8364('0x2')](_0x8364('0x3'),{'body':_0xdedff,'options':{'where':{'uniqueid':_0x3d5468},'order':[['id',_0x8364('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x8973=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','create'];(function(_0x287072,_0x166448){var _0x4fb750=function(_0x3c72b9){while(--_0x3c72b9){_0x287072['push'](_0x287072['shift']());}};_0x4fb750(++_0x166448);}(_0x8973,0x1ad));var _0x3897=function(_0x1e54eb,_0x2e1692){_0x1e54eb=_0x1e54eb-0x0;var _0x1003b3=_0x8973[_0x1e54eb];return _0x1003b3;};'use strict';var client=require('../client');exports[_0x3897('0x0')]=function(_0x1ba1e6){return client[_0x3897('0x1')]('CreateWhatsappQueueReport',{'body':_0x1ba1e6,'log':_0x3897('0x2')});};exports[_0x3897('0x3')]=function(_0x2ac139,_0x548d39){return client[_0x3897('0x1')](_0x3897('0x4'),{'body':_0x548d39,'options':{'where':{'uniqueid':_0x2ac139},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ 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 bfd0b2d..116a00d 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 _0x4c91=['agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','length','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','close','complete','[%s][AGENT]\x20ROUTING\x20END','next'];(function(_0x3d7a2d,_0x2b19c1){var _0x338476=function(_0x3adbf2){while(--_0x3adbf2){_0x3d7a2d['push'](_0x3d7a2d['shift']());}};_0x338476(++_0x2b19c1);}(_0x4c91,0x1da));var _0x14c9=function(_0x4732cb,_0x207b9b){_0x4732cb=_0x4732cb-0x0;var _0x11fac8=_0x4c91[_0x4732cb];return _0x11fac8;};'use strict';var schema=require(_0x14c9('0x0'));var _=require(_0x14c9('0x1'));var util=require(_0x14c9('0x2'));var seqqueue=require(_0x14c9('0x3'));var logger=require('../../../../config/logger')(_0x14c9('0x4'));var strategy=require(_0x14c9('0x5'));var queue=schema({'name':{'type':_0x14c9('0x6'),'required':!![],'message':_0x14c9('0x7')},'timeout':{'type':_0x14c9('0x8'),'message':_0x14c9('0x9')}});function writeLog(_0x2bb47f,_0x27404d,_0x492d51){return logger['info'](util[_0x14c9('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2bb47f,_0x27404d[_0x14c9('0xb')],_0x492d51));}function handleFindAgent(_0xc95424){return function(_0x5b5d3f){return _0x5b5d3f['name'][_0x14c9('0xc')]()===_0xc95424['toLowerCase']();};}exports[_0x14c9('0xd')]=function(_0x23961f,_0xcbe6bf,_0x2f06aa,_0x4a4331){return function(_0x29f542){try{var _0x3f8bf7={'name':_0xcbe6bf[0x0],'timeout':_0xcbe6bf[0x1]};var _0x11a215=queue['validate'](_0x3f8bf7,{'typecast':!![]});if(_0x11a215[_0x14c9('0xe')]){logger['error'](_0x14c9('0xf'),_0x23961f,_[_0x14c9('0x10')](_0x11a215,_0x14c9('0x11'))['join'](',\x20'));_0x29f542[_0x14c9('0x12')]();}else{var _0xc7dc97=_[_0x14c9('0x13')](_0x2f06aa[_0x14c9('0x14')],handleFindAgent(_0x3f8bf7[_0x14c9('0xb')]));if(_0xc7dc97){var _0x432b19=(_0x3f8bf7[_0x14c9('0x15')]||0xa)*0x3e8;var _0x476097,_0x936efd;var _0x4a54b9=seqqueue[_0x14c9('0x16')](_0x432b19);_0x4a54b9['id']=_0x23961f;_0x4a54b9[_0x14c9('0x17')]=_0x432b19;_0x4a54b9['channel']=_0x4a4331[_0x14c9('0x18')];writeLog(_0x23961f,_0xc7dc97,util[_0x14c9('0xa')](_0x14c9('0x19'),_0x432b19));_0x2f06aa[_0x14c9('0x1a')][_0x23961f]['on'](_0x14c9('0x1b'),function(){logger[_0x14c9('0x1c')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x23961f);clearTimeout(_0x936efd);_0x936efd=undefined;_0x4a54b9[_0x14c9('0x1d')]();if(_0x2f06aa[_0x14c9('0x1a')][_0x23961f]){delete _0x2f06aa[_0x14c9('0x1a')][_0x23961f];}_0x29f542[_0x14c9('0x12')]();});_0x2f06aa[_0x14c9('0x1a')][_0x23961f]['on'](_0x14c9('0x1e'),function(){if(_0x2f06aa[_0x14c9('0x1a')][_0x23961f]){delete _0x2f06aa['rules'][_0x23961f];}});_0x936efd=setTimeout(function(){logger[_0x14c9('0x1c')](_0x14c9('0x1f'),_0x23961f);clearTimeout(_0x936efd);_0x4a54b9['close']();_0x29f542[_0x14c9('0x20')]();},_0x432b19);strategy[_0x14c9('0x21')](_0x4a54b9,_0xc7dc97,_0x2f06aa,_0x4a4331);}else{logger[_0x14c9('0x22')](_0x14c9('0x23'),_0x23961f,_0x3f8bf7[_0x14c9('0xb')]);_0x29f542['stop']();}}}catch(_0x1a42c0){console[_0x14c9('0x24')](_0x1a42c0);logger[_0x14c9('0x22')](_0x14c9('0x25'),_0x23961f,_0x1a42c0[_0x14c9('0x26')]);_0x29f542[_0x14c9('0x12')]();}};}; \ No newline at end of file +var _0x5c47=['format','name','toLowerCase','consequence','length','map','message','join','stop','find','createQueue','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','info','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','error','[%s][QUEUE]\x20%s','validate','lodash','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x52a7a9,_0x4df6fc){var _0x5253e4=function(_0xc13118){while(--_0xc13118){_0x52a7a9['push'](_0x52a7a9['shift']());}};_0x5253e4(++_0x4df6fc);}(_0x5c47,0x142));var _0x75c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c47[_0x20a584];return _0x4b41a8;};'use strict';var schema=require(_0x75c4('0x0'));var _=require(_0x75c4('0x1'));var util=require('util');var seqqueue=require(_0x75c4('0x2'));var logger=require(_0x75c4('0x3'))(_0x75c4('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x75c4('0x5')},'timeout':{'type':_0x75c4('0x6'),'message':_0x75c4('0x7')}});function writeLog(_0x5f382e,_0x5d4bc2,_0x1f9b81){return logger['info'](util[_0x75c4('0x8')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5f382e,_0x5d4bc2[_0x75c4('0x9')],_0x1f9b81));}function handleFindAgent(_0x59edf3){return function(_0x9ea6a6){return _0x9ea6a6['name'][_0x75c4('0xa')]()===_0x59edf3['toLowerCase']();};}exports[_0x75c4('0xb')]=function(_0x13018d,_0x5dd4f2,_0x33377a,_0x5353ba){return function(_0x4d86ef){try{var _0x82894c={'name':_0x5dd4f2[0x0],'timeout':_0x5dd4f2[0x1]};var _0x1006fb=queue[_0x75c4('0x0')](_0x82894c,{'typecast':!![]});if(_0x1006fb[_0x75c4('0xc')]){logger['error']('[%s][AGENT]\x20%s',_0x13018d,_[_0x75c4('0xd')](_0x1006fb,_0x75c4('0xe'))[_0x75c4('0xf')](',\x20'));_0x4d86ef[_0x75c4('0x10')]();}else{var _0x2588ea=_[_0x75c4('0x11')](_0x33377a['agents'],handleFindAgent(_0x82894c['name']));if(_0x2588ea){var _0x31f1fe=(_0x82894c['timeout']||0xa)*0x3e8;var _0x1b5842,_0xeb28d7;var _0x1278bf=seqqueue[_0x75c4('0x12')](_0x31f1fe);_0x1278bf['id']=_0x13018d;_0x1278bf[_0x75c4('0x13')]=_0x31f1fe;_0x1278bf['channel']=_0x5353ba[_0x75c4('0x14')];writeLog(_0x13018d,_0x2588ea,util[_0x75c4('0x8')](_0x75c4('0x15'),_0x31f1fe));_0x33377a[_0x75c4('0x16')][_0x13018d]['on']('end',function(){logger['info'](_0x75c4('0x17'),_0x13018d);clearTimeout(_0xeb28d7);_0xeb28d7=undefined;_0x1278bf[_0x75c4('0x18')]();if(_0x33377a[_0x75c4('0x16')][_0x13018d]){delete _0x33377a['rules'][_0x13018d];}_0x4d86ef['stop']();});_0x33377a['rules'][_0x13018d]['on']('complete',function(){if(_0x33377a['rules'][_0x13018d]){delete _0x33377a[_0x75c4('0x16')][_0x13018d];}});_0xeb28d7=setTimeout(function(){logger[_0x75c4('0x19')](_0x75c4('0x1a'),_0x13018d);clearTimeout(_0xeb28d7);_0x1278bf['close']();_0x4d86ef['next']();},_0x31f1fe);strategy['agent'](_0x1278bf,_0x2588ea,_0x33377a,_0x5353ba);}else{logger['error'](_0x75c4('0x1b'),_0x13018d,_0x82894c[_0x75c4('0x9')]);_0x4d86ef[_0x75c4('0x10')]();}}}catch(_0x4c0d4e){console['log'](_0x4c0d4e);logger[_0x75c4('0x1c')](_0x75c4('0x1d'),_0x13018d,_0x4c0d4e['stack']);_0x4d86ef[_0x75c4('0x10')]();}};}; \ 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 729b284..38ddb73 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 _0x2b86=['../../rpc/whatsappMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','chat','upperFirst','AccountId','account','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','toString','postText','error','amazonlex','providerResponse','Failed','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x2b86,0x149));var _0x62b8=function(_0x2a4a32,_0x1e6018){_0x2a4a32=_0x2a4a32-0x0;var _0x45ac77=_0x2b86[_0x2a4a32];return _0x45ac77;};'use strict';var _=require('lodash');var moment=require(_0x62b8('0x0'));var AWS=require(_0x62b8('0x1'));var utils=require(_0x62b8('0x2'));var logger=require(_0x62b8('0x3'))('routing');var rpc={'chatMessage':require(_0x62b8('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x62b8('0x5')),'faxMessage':require(_0x62b8('0x6')),'whatsappMessage':require(_0x62b8('0x7'))};exports['consequence']=function(_0x5696ae,_0x60ca9e){return function(_0x2927c6){try{if(!_[_0x62b8('0x8')](this[_0x62b8('0x9')][_0x62b8('0xa')])){logger[_0x62b8('0xb')]('[%s][AMAZONLEX]\x20%s',_0x5696ae,_0x62b8('0xc'));return _0x2927c6[_0x62b8('0xd')]();}var _0x120d37={'ContactId':this[_0x62b8('0xe')]['id'],'sentAt':moment()[_0x62b8('0xf')](_0x62b8('0x10')),'direction':_0x62b8('0x11')};if(this[_0x62b8('0x12')]===_0x62b8('0x13')||this[_0x62b8('0x12')]==='whatsapp'){_0x120d37['phone']=this[_0x62b8('0x9')][_0x62b8('0x14')];}var _0x29cfe4=this[_0x62b8('0x12')];if(_0x29cfe4===_0x62b8('0x15')){_0x120d37['ChatWebsiteId']=this['account']['id'];}else{_0x120d37[_[_0x62b8('0x16')](_0x29cfe4)+_0x62b8('0x17')]=this[_0x62b8('0x18')]['id'];}_0x120d37[_['upperFirst'](_0x29cfe4)+_0x62b8('0x19')]=this['interaction']['id'];if(this[_0x62b8('0x9')][_0x62b8('0x1a')]){var _0x5d1920=_0x60ca9e[0x4];if(!_[_0x62b8('0x1b')](_0x5d1920)){_0x120d37[_0x62b8('0x1c')]=utils[_0x62b8('0x1d')](_0x5d1920,this);return rpc[_0x29cfe4+_0x62b8('0x1e')][_0x62b8('0x1f')](_0x120d37)[_0x62b8('0x20')](function(_0x474d5e){logger[_0x62b8('0xb')](_0x62b8('0x21'),_0x5696ae,_0x120d37[_0x62b8('0x1c')]);})[_0x62b8('0x22')](function(_0x4abceb){logger['error'](_0x62b8('0x21'),_0x5696ae,JSON[_0x62b8('0x23')](_0x4abceb));})[_0x62b8('0x24')](function(){logger[_0x62b8('0xb')](_0x62b8('0x25'),_0x5696ae);_0x2927c6['stop']();});}else{logger[_0x62b8('0xb')](_0x62b8('0x26'),_0x5696ae);_0x2927c6[_0x62b8('0x27')]();}}else{var _0x2dced8=this;var _0x570bf8=new AWS[(_0x62b8('0x28'))]({'accessKeyId':_0x60ca9e[0x0],'secretAccessKey':_0x60ca9e[0x1],'region':_0x60ca9e[0x2]});var _0x5218f0={'botAlias':'$LATEST','botName':_0x60ca9e[0x3],'inputText':this[_0x62b8('0x29')][_0x62b8('0x1c')],'userId':this[_0x62b8('0x12')]+':'+this[_0x62b8('0x9')]['id'][_0x62b8('0x2a')]()};_0x570bf8[_0x62b8('0x2b')](_0x5218f0,function(_0x2542a3,_0x2db525){if(_0x2542a3){logger[_0x62b8('0x2c')](_0x62b8('0x21'),_0x5696ae,_0x2542a3[_0x62b8('0x29')]);_0x2927c6[_0x62b8('0xd')]();}else if(_0x2db525&&_0x2db525[_0x62b8('0x29')]){_0x2dced8['body'][_0x62b8('0x2d')]=_0x2db525;_0x120d37[_0x62b8('0x1c')]=_0x2db525[_0x62b8('0x29')];_0x120d37['providerName']=_0x62b8('0x2d');_0x120d37[_0x62b8('0x2e')]=JSON['stringify'](_0x2db525);return rpc[_0x29cfe4+'Message']['create'](_0x120d37)[_0x62b8('0x20')](function(_0x6eae61){logger[_0x62b8('0xb')](_0x62b8('0x21'),_0x5696ae,_0x120d37['body']);if(_0x2db525['dialogState']==_0x62b8('0x2f')){_0x2927c6[_0x62b8('0xd')]();}else{_0x2927c6[_0x62b8('0x27')]();}})[_0x62b8('0x22')](function(_0x587485){logger[_0x62b8('0x2c')](_0x62b8('0x21'),_0x5696ae,JSON[_0x62b8('0x23')](_0x587485));_0x2927c6[_0x62b8('0xd')]();});}else{_0x2927c6[_0x62b8('0xd')]();}});}}catch(_0x131086){logger['error'](_0x62b8('0x21'),_0x5696ae,JSON[_0x62b8('0x23')](_0x131086));_0x2927c6['stop']();}};}; \ No newline at end of file +var _0x9aec=['consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','body','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','stringify','Message','[%s][AMAZONLEX]\x20%s','dialogState','catch','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x26f919,_0x1bb9d4){var _0x190371=function(_0x2eb06b){while(--_0x2eb06b){_0x26f919['push'](_0x26f919['shift']());}};_0x190371(++_0x1bb9d4);}(_0x9aec,0x150));var _0xc9ae=function(_0x10e6be,_0x27b137){_0x10e6be=_0x10e6be-0x0;var _0x2928d9=_0x9aec[_0x10e6be];return _0x2928d9;};'use strict';var _=require(_0xc9ae('0x0'));var moment=require(_0xc9ae('0x1'));var AWS=require('aws-sdk');var utils=require(_0xc9ae('0x2'));var logger=require(_0xc9ae('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc9ae('0x4')),'mailMessage':require(_0xc9ae('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc9ae('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc9ae('0x7')]=function(_0x6c1ec5,_0x5db2f0){return function(_0x3d2009){try{if(!_['isNil'](this[_0xc9ae('0x8')][_0xc9ae('0x9')])){logger[_0xc9ae('0xa')]('[%s][AMAZONLEX]\x20%s',_0x6c1ec5,_0xc9ae('0xb'));return _0x3d2009[_0xc9ae('0xc')]();}var _0x3996f7={'ContactId':this[_0xc9ae('0xd')]['id'],'sentAt':moment()[_0xc9ae('0xe')](_0xc9ae('0xf')),'direction':'out'};if(this[_0xc9ae('0x10')]==='sms'||this['channel']===_0xc9ae('0x11')){_0x3996f7[_0xc9ae('0x12')]=this[_0xc9ae('0x8')][_0xc9ae('0x12')];}var _0x363020=this['channel'];if(_0x363020===_0xc9ae('0x13')){_0x3996f7[_0xc9ae('0x14')]=this[_0xc9ae('0x15')]['id'];}else{_0x3996f7[_[_0xc9ae('0x16')](_0x363020)+_0xc9ae('0x17')]=this[_0xc9ae('0x15')]['id'];}_0x3996f7[_[_0xc9ae('0x16')](_0x363020)+_0xc9ae('0x18')]=this[_0xc9ae('0x8')]['id'];if(this['interaction'][_0xc9ae('0x19')]){var _0x49a9f4=_0x5db2f0[0x4];if(!_[_0xc9ae('0x1a')](_0x49a9f4)){_0x3996f7['body']=utils[_0xc9ae('0x1b')](_0x49a9f4,this);return rpc[_0x363020+'Message'][_0xc9ae('0x1c')](_0x3996f7)[_0xc9ae('0x1d')](function(_0x5aa7d4){logger['info']('[%s][AMAZONLEX]\x20%s',_0x6c1ec5,_0x3996f7[_0xc9ae('0x1e')]);})['catch'](function(_0x40f929){logger[_0xc9ae('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x6c1ec5,JSON['stringify'](_0x40f929));})[_0xc9ae('0x20')](function(){logger[_0xc9ae('0xa')](_0xc9ae('0x21'),_0x6c1ec5);_0x3d2009[_0xc9ae('0x22')]();});}else{logger[_0xc9ae('0xa')](_0xc9ae('0x23'),_0x6c1ec5);_0x3d2009[_0xc9ae('0x22')]();}}else{var _0x265874=this;var _0x448f31=new AWS[(_0xc9ae('0x24'))]({'accessKeyId':_0x5db2f0[0x0],'secretAccessKey':_0x5db2f0[0x1],'region':_0x5db2f0[0x2]});var _0x54eaf6={'botAlias':_0xc9ae('0x25'),'botName':_0x5db2f0[0x3],'inputText':this[_0xc9ae('0x26')][_0xc9ae('0x1e')],'userId':this['channel']+':'+this[_0xc9ae('0x8')]['id'][_0xc9ae('0x27')]()};_0x448f31[_0xc9ae('0x28')](_0x54eaf6,function(_0x465531,_0x410b91){if(_0x465531){logger[_0xc9ae('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x6c1ec5,_0x465531['message']);_0x3d2009[_0xc9ae('0xc')]();}else if(_0x410b91&&_0x410b91[_0xc9ae('0x26')]){_0x265874[_0xc9ae('0x1e')][_0xc9ae('0x29')]=_0x410b91;_0x3996f7['body']=_0x410b91[_0xc9ae('0x26')];_0x3996f7[_0xc9ae('0x2a')]=_0xc9ae('0x29');_0x3996f7[_0xc9ae('0x2b')]=JSON[_0xc9ae('0x2c')](_0x410b91);return rpc[_0x363020+_0xc9ae('0x2d')][_0xc9ae('0x1c')](_0x3996f7)[_0xc9ae('0x1d')](function(_0x465d9e){logger[_0xc9ae('0xa')](_0xc9ae('0x2e'),_0x6c1ec5,_0x3996f7[_0xc9ae('0x1e')]);if(_0x410b91[_0xc9ae('0x2f')]=='Failed'){_0x3d2009['next']();}else{_0x3d2009[_0xc9ae('0x22')]();}})[_0xc9ae('0x30')](function(_0x5a1c04){logger[_0xc9ae('0x1f')](_0xc9ae('0x2e'),_0x6c1ec5,JSON[_0xc9ae('0x2c')](_0x5a1c04));_0x3d2009[_0xc9ae('0xc')]();});}else{_0x3d2009[_0xc9ae('0xc')]();}});}}catch(_0x17a299){logger[_0xc9ae('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x6c1ec5,JSON[_0xc9ae('0x2c')](_0x17a299));_0x3d2009[_0xc9ae('0x22')]();}};}; \ 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 1865f6e..8343c7a 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 _0x248d=['stringify','catch','error','finally','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','update','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','body','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','channel','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','AccountId','upperFirst','Message','Smtp','service','host','port','secure','user','pass','inReplyTo','messageId','','replace','','headers','All','auto_reply','sendMailMessage','then','create'];(function(_0x51ddca,_0x2bac34){var _0x5685e4=function(_0xbb66fa){while(--_0xbb66fa){_0x51ddca['push'](_0x51ddca['shift']());}};_0x5685e4(++_0x2bac34);}(_0x248d,0x91));var _0xd248=function(_0x279de1,_0x3c7f12){_0x279de1=_0x279de1-0x0;var _0x557fca=_0x248d[_0x279de1];return _0x557fca;};'use strict';var _=require(_0xd248('0x0'));var moment=require('moment');var utils=require('./utils');var logger=require(_0xd248('0x1'))(_0xd248('0x2'));var rpc={'chatMessage':require(_0xd248('0x3')),'openchannelMessage':require(_0xd248('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xd248('0x5')),'faxMessage':require(_0xd248('0x6')),'whatsappMessage':require(_0xd248('0x7')),'chatInteraction':require(_0xd248('0x8')),'openchannelInteraction':require(_0xd248('0x9')),'mailInteraction':require(_0xd248('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xd248('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0xd248('0xc')]=function(_0x32e0e8,_0x26619a,_0x2d9be9,_0x3c10cf){return function(_0x66d62b){try{var _0x409861=this['channel'];if(_0x409861==='mail'&&_0x3c10cf[_0xd248('0xd')]['isAutoreply']){logger[_0xd248('0xe')]('[%s][AUTOREPLY]\x20%s',_0x32e0e8,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x66d62b[_0xd248('0xf')]();}if(_0x26619a[0x0]==='1'&&(_[_0xd248('0x10')](this[_0xd248('0x11')][_0xd248('0x12')])||!this[_0xd248('0x11')][_0xd248('0x12')])){logger[_0xd248('0xe')](_0xd248('0x13'),_0x32e0e8,_0xd248('0x14'));return _0x66d62b[_0xd248('0xf')]();}if(_0x26619a[0x0]==='2'&&this[_0xd248('0x11')][_0xd248('0x15')]){logger[_0xd248('0xe')](_0xd248('0x16'),_0x32e0e8,_0xd248('0x17'));return _0x66d62b[_0xd248('0xf')]();}var _0x586763={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd248('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xd248('0x19')]===_0xd248('0x1a')){_0x586763[_0xd248('0xd')]=utils[_0xd248('0x1b')](_0x26619a[0x2],this);}else{_0x586763[_0xd248('0xd')]=utils[_0xd248('0x1b')](_0x26619a[0x1],this);}if(this[_0xd248('0x1c')]){_0x586763['to']=this['message']['from']||'';if(this['channel']===_0xd248('0x1a')&&_0x26619a[0x1]==='1'){_0x586763['cc']=this['message']['cc']||'';}_0x586763[_0xd248('0x1d')]=this['message']['to']||'';_0x586763[_0xd248('0x1e')]=this[_0xd248('0x1c')][_0xd248('0x1e')]||'';_0x586763[_0xd248('0x1f')]=!![];if(this[_0xd248('0x1c')][_0xd248('0x20')]){_0x586763[_0xd248('0x20')]='';_0x586763[_0xd248('0x20')]+=_[_0xd248('0x21')](this['message']['subject'],_0xd248('0x22'))?'':_0xd248('0x23');_0x586763[_0xd248('0x20')]+=this[_0xd248('0x1c')][_0xd248('0x20')];}}if(this[_0xd248('0x19')]==='chat'){_0x586763['ChatWebsiteId']=this[_0xd248('0x24')]['id'];}else{_0x586763[_['upperFirst'](this[_0xd248('0x19')])+_0xd248('0x25')]=this[_0xd248('0x24')]['id'];}_0x586763[_[_0xd248('0x26')](this[_0xd248('0x19')])+'InteractionId']=this['interaction']['id'];var _0x155f28=this['interaction'];if(rpc[this[_0xd248('0x19')]+_0xd248('0x27')]){if(this[_0xd248('0x19')]===_0xd248('0x1a')){var _0x255e91={'tls':{'rejectUnauthorized':![]}};if(this[_0xd248('0x24')][_0xd248('0x28')][_0xd248('0x29')]){_0x255e91[_0xd248('0x29')]=this[_0xd248('0x24')][_0xd248('0x28')]['service'];}else{_0x255e91[_0xd248('0x2a')]=this['account'][_0xd248('0x28')][_0xd248('0x2a')];_0x255e91['port']=this[_0xd248('0x24')][_0xd248('0x28')][_0xd248('0x2b')];_0x255e91[_0xd248('0x2c')]=this[_0xd248('0x24')][_0xd248('0x28')][_0xd248('0x2c')];}if(this[_0xd248('0x24')][_0xd248('0x28')]['authentication']){_0x255e91['auth']={'user':this[_0xd248('0x24')][_0xd248('0x28')][_0xd248('0x2d')],'pass':this[_0xd248('0x24')][_0xd248('0x28')][_0xd248('0x2e')]};}_0x586763[_0xd248('0x2f')]=this[_0xd248('0x1c')][_0xd248('0x30')];_0x586763['html']=_0xd248('0x31')+_[_0xd248('0x32')](_0x586763['body'],'','replace','','headers','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','[RPC][%s][AUTOREPLY]\x20%s','update','error','catch','finally','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','lodash','./utils'];(function(_0xaf0396,_0x52fd55){var _0x382ebb=function(_0x188207){while(--_0x188207){_0xaf0396['push'](_0xaf0396['shift']());}};_0x382ebb(++_0x52fd55);}(_0x70c6,0x116));var _0x670c=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x70c6[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x670c('0x0'));var moment=require('moment');var utils=require(_0x670c('0x1'));var logger=require(_0x670c('0x2'))(_0x670c('0x3'));var rpc={'chatMessage':require(_0x670c('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x670c('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x670c('0x6')),'chatInteraction':require(_0x670c('0x7')),'openchannelInteraction':require(_0x670c('0x8')),'mailInteraction':require(_0x670c('0x9')),'smsInteraction':require(_0x670c('0xa')),'faxInteraction':require(_0x670c('0xb')),'whatsappInteraction':require(_0x670c('0xc'))};var mailRpc=require(_0x670c('0xd'));exports['consequence']=function(_0x799bcd,_0x503104,_0x4c9935,_0x4aecd1){return function(_0xc6dd0){try{var _0x3a7829=this[_0x670c('0xe')];if(_0x3a7829===_0x670c('0xf')&&_0x4aecd1[_0x670c('0x10')][_0x670c('0x11')]){logger[_0x670c('0x12')](_0x670c('0x13'),_0x799bcd,_0x670c('0x14'));return _0xc6dd0[_0x670c('0x15')]();}if(_0x503104[0x0]==='1'&&(_['isNil'](this[_0x670c('0x16')]['created'])||!this[_0x670c('0x16')][_0x670c('0x17')])){logger[_0x670c('0x12')](_0x670c('0x13'),_0x799bcd,'Autoreply\x20already\x20sent');return _0xc6dd0[_0x670c('0x15')]();}if(_0x503104[0x0]==='2'&&this['interaction'][_0x670c('0x18')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x799bcd,'One\x20Time\x20already\x20sent');return _0xc6dd0[_0x670c('0x15')]();}var _0x5a5ade={'ContactId':this[_0x670c('0x19')]['id'],'sentAt':moment()['format'](_0x670c('0x1a')),'direction':'out'};if(this[_0x670c('0xe')]===_0x670c('0xf')){_0x5a5ade[_0x670c('0x10')]=utils[_0x670c('0x1b')](_0x503104[0x2],this);}else{_0x5a5ade[_0x670c('0x10')]=utils['getMustacheRender'](_0x503104[0x1],this);}if(this[_0x670c('0x1c')]){_0x5a5ade['to']=this[_0x670c('0x1c')][_0x670c('0x1d')]||'';if(this[_0x670c('0xe')]===_0x670c('0xf')&&_0x503104[0x1]==='1'){_0x5a5ade['cc']=this[_0x670c('0x1c')]['cc']||'';}_0x5a5ade[_0x670c('0x1d')]=this[_0x670c('0x1c')]['to']||'';_0x5a5ade[_0x670c('0x1e')]=this[_0x670c('0x1c')][_0x670c('0x1e')]||'';_0x5a5ade[_0x670c('0x1f')]=!![];if(this[_0x670c('0x1c')][_0x670c('0x20')]){_0x5a5ade['subject']='';_0x5a5ade[_0x670c('0x20')]+=_['startsWith'](this[_0x670c('0x1c')][_0x670c('0x20')],_0x670c('0x21'))?'':_0x670c('0x22');_0x5a5ade[_0x670c('0x20')]+=this[_0x670c('0x1c')][_0x670c('0x20')];}}if(this[_0x670c('0xe')]===_0x670c('0x23')){_0x5a5ade[_0x670c('0x24')]=this[_0x670c('0x25')]['id'];}else{_0x5a5ade[_[_0x670c('0x26')](this[_0x670c('0xe')])+_0x670c('0x27')]=this[_0x670c('0x25')]['id'];}_0x5a5ade[_[_0x670c('0x26')](this[_0x670c('0xe')])+_0x670c('0x28')]=this[_0x670c('0x16')]['id'];var _0x382e17=this[_0x670c('0x16')];if(rpc[this[_0x670c('0xe')]+_0x670c('0x29')]){if(this[_0x670c('0xe')]==='mail'){var _0x503de3={'tls':{'rejectUnauthorized':![]}};if(this[_0x670c('0x25')][_0x670c('0x2a')]['service']){_0x503de3[_0x670c('0x2b')]=this['account'][_0x670c('0x2a')][_0x670c('0x2b')];}else{_0x503de3['host']=this[_0x670c('0x25')]['Smtp'][_0x670c('0x2c')];_0x503de3[_0x670c('0x2d')]=this[_0x670c('0x25')][_0x670c('0x2a')][_0x670c('0x2d')];_0x503de3['secure']=this[_0x670c('0x25')][_0x670c('0x2a')][_0x670c('0x2e')];}if(this[_0x670c('0x25')][_0x670c('0x2a')][_0x670c('0x2f')]){_0x503de3[_0x670c('0x30')]={'user':this[_0x670c('0x25')][_0x670c('0x2a')][_0x670c('0x31')],'pass':this[_0x670c('0x25')][_0x670c('0x2a')][_0x670c('0x32')]};}_0x5a5ade[_0x670c('0x33')]=this['message'][_0x670c('0x34')];_0x5a5ade[_0x670c('0x35')]=_0x670c('0x36')+_[_0x670c('0x37')](_0x5a5ade['body'],']+(>|$)/g,''),'priorityTrue':_0x55cce9[0x1],'priorityFalse':_0x55cce9[0x2]};var _0x10ee41=gotoif[_0xb4b8('0x0')](_0x334f22,{'typecast':!![]});if(_0x10ee41['length']){logger[_0xb4b8('0xc')](_0xb4b8('0xd'),_0x2723c9,_['map'](_0x10ee41,_0xb4b8('0xe'))[_0xb4b8('0xf')](',\x20'));_0x2a0534[_0xb4b8('0x10')]();}else{try{var _0x583860=eval('('+_0x334f22['condition']+')');var _0x473271=_0x583860?_0x334f22[_0xb4b8('0x11')]:_0x334f22[_0xb4b8('0x12')];logger[_0xb4b8('0x13')](_0xb4b8('0x14'),_0x2723c9,_0x334f22[_0xb4b8('0x15')],_0x583860,_0x473271||_0xb4b8('0x16'));if(_0x473271){var _0x47e6e1=_['findIndex'](_0x2a0534[_0xb4b8('0x17')](),{'p':_0x473271});if(_0x47e6e1>=0x0){logger[_0xb4b8('0x13')](_0xb4b8('0x18'),_0x2723c9,_0x473271||_0xb4b8('0x16'),_0x47e6e1);_0x2a0534[_0xb4b8('0x16')](_0x47e6e1);}else{logger[_0xb4b8('0x13')](_0xb4b8('0x19'),_0x2723c9,_0x473271||_0xb4b8('0x16'));_0x2a0534[_0xb4b8('0x10')]();}}else{_0x2a0534['next']();}}catch(_0x285eb8){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x2723c9,_0x285eb8[_0xb4b8('0xe')]);_0x2a0534[_0xb4b8('0x10')]();}}}catch(_0x30b38b){logger[_0xb4b8('0xc')](_0xb4b8('0xd'),_0x2723c9,JSON[_0xb4b8('0x1a')](_0x30b38b));_0x2a0534['stop']();}};}; \ No newline at end of file +var _0x14a8=['fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number'];(function(_0x188576,_0x2ecc9b){var _0x5dbe50=function(_0x45ad78){while(--_0x45ad78){_0x188576['push'](_0x188576['shift']());}};_0x5dbe50(++_0x2ecc9b);}(_0x14a8,0xa4));var _0x814a=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x14a8[_0x3054be];return _0x3df150;};'use strict';var schema=require(_0x814a('0x0'));var _=require(_0x814a('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x814a('0x2'));var logger=require(_0x814a('0x3'))(_0x814a('0x4'));var gotoif=schema({'condition':{'type':_0x814a('0x5'),'required':!![],'message':_0x814a('0x6')},'priorityTrue':{'type':'number','message':_0x814a('0x7')},'priorityFalse':{'type':_0x814a('0x8'),'message':_0x814a('0x9')}});exports['consequence']=function(_0x3ee783,_0x4a7cdb){return function(_0xbd0028){try{var _0x5c36d6={'condition':htmlToText[_0x814a('0xa')](utils[_0x814a('0xb')](_0x4a7cdb[0x0],this),{'wordwrap':![]})[_0x814a('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4a7cdb[0x1],'priorityFalse':_0x4a7cdb[0x2]};var _0x515463=gotoif[_0x814a('0x0')](_0x5c36d6,{'typecast':!![]});if(_0x515463[_0x814a('0xd')]){logger[_0x814a('0xe')](_0x814a('0xf'),_0x3ee783,_[_0x814a('0x10')](_0x515463,_0x814a('0x11'))[_0x814a('0x12')](',\x20'));_0xbd0028[_0x814a('0x13')]();}else{try{var _0x2548bd=eval('('+_0x5c36d6[_0x814a('0x14')]+')');var _0x5bd02e=_0x2548bd?_0x5c36d6['priorityTrue']:_0x5c36d6[_0x814a('0x15')];logger[_0x814a('0x16')](_0x814a('0x17'),_0x3ee783,_0x5c36d6[_0x814a('0x14')],_0x2548bd,_0x5bd02e||_0x814a('0x18'));if(_0x5bd02e){var _0x585b52=_[_0x814a('0x19')](_0xbd0028[_0x814a('0x1a')](),{'p':_0x5bd02e});if(_0x585b52>=0x0){logger[_0x814a('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3ee783,_0x5bd02e||_0x814a('0x18'),_0x585b52);_0xbd0028[_0x814a('0x18')](_0x585b52);}else{logger[_0x814a('0x16')](_0x814a('0x1b'),_0x3ee783,_0x5bd02e||_0x814a('0x18'));_0xbd0028[_0x814a('0x13')]();}}else{_0xbd0028['next']();}}catch(_0x3bf64e){logger[_0x814a('0xe')](_0x814a('0x1c'),_0x3ee783,_0x3bf64e[_0x814a('0x11')]);_0xbd0028[_0x814a('0x13')]();}}}catch(_0x592159){logger[_0x814a('0xe')](_0x814a('0xf'),_0x3ee783,JSON['stringify'](_0x592159));_0xbd0028['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index f7495d1..f8d53bb 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 _0xd14e=['number','consequence','length','error','[%s][GOTOP]\x20%s','message','join','info','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','lodash','../../../../config/logger','routing'];(function(_0x54c9a6,_0x267ead){var _0x303481=function(_0x36695e){while(--_0x36695e){_0x54c9a6['push'](_0x54c9a6['shift']());}};_0x303481(++_0x267ead);}(_0xd14e,0xd4));var _0xed14=function(_0xc95853,_0x165cfa){_0xc95853=_0xc95853-0x0;var _0x23d7e1=_0xd14e[_0xc95853];return _0x23d7e1;};'use strict';var schema=require(_0xed14('0x0'));var _=require(_0xed14('0x1'));var logger=require(_0xed14('0x2'))(_0xed14('0x3'));var gotop=schema({'priority':{'type':_0xed14('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xed14('0x5')]=function(_0x158018,_0x44ac6a){return function(_0x55e018){try{var _0x386132={'priority':_0x44ac6a[0x0]};var _0x17ea7e=gotop[_0xed14('0x0')](_0x386132,{'typecast':!![]});if(_0x17ea7e[_0xed14('0x6')]){logger[_0xed14('0x7')](_0xed14('0x8'),_0x158018,_['map'](_0x17ea7e,_0xed14('0x9'))[_0xed14('0xa')](',\x20'));_0x55e018['stop']();}else{logger[_0xed14('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x158018,_0x386132[_0xed14('0xc')]);if(_0x386132[_0xed14('0xc')]){var _0x9cc9d2=_['findIndex'](_0x55e018[_0xed14('0xd')](),{'p':_0x386132[_0xed14('0xc')]});if(_0x9cc9d2>=0x0){logger[_0xed14('0xb')](_0xed14('0xe'),_0x158018,_0x386132[_0xed14('0xc')]||_0xed14('0xf'),_0x9cc9d2);_0x55e018[_0xed14('0xf')](_0x9cc9d2);}else{logger[_0xed14('0xb')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x158018,_0x386132['priority']||'next');_0x55e018[_0xed14('0x10')]();}}else{_0x55e018[_0xed14('0xf')]();}}}catch(_0x582c59){logger[_0xed14('0x7')](_0xed14('0x8'),_0x158018,JSON[_0xed14('0x11')](_0x582c59));_0x55e018[_0xed14('0x10')]();}};}; \ No newline at end of file +var _0x8475=['[%s][GOTOP]\x20%s','map','message','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x129a12,_0x18f6ba){var _0x312f90=function(_0x39fb01){while(--_0x39fb01){_0x129a12['push'](_0x129a12['shift']());}};_0x312f90(++_0x18f6ba);}(_0x8475,0x76));var _0x5847=function(_0x37bd8b,_0x423091){_0x37bd8b=_0x37bd8b-0x0;var _0x32b852=_0x8475[_0x37bd8b];return _0x32b852;};'use strict';var schema=require(_0x5847('0x0'));var _=require(_0x5847('0x1'));var logger=require('../../../../config/logger')(_0x5847('0x2'));var gotop=schema({'priority':{'type':_0x5847('0x3'),'required':!![],'message':_0x5847('0x4')}});exports[_0x5847('0x5')]=function(_0x4281b3,_0x3cec4b){return function(_0x21f632){try{var _0x5e9fdd={'priority':_0x3cec4b[0x0]};var _0x15d2dc=gotop[_0x5847('0x0')](_0x5e9fdd,{'typecast':!![]});if(_0x15d2dc[_0x5847('0x6')]){logger[_0x5847('0x7')](_0x5847('0x8'),_0x4281b3,_[_0x5847('0x9')](_0x15d2dc,_0x5847('0xa'))[_0x5847('0xb')](',\x20'));_0x21f632['stop']();}else{logger[_0x5847('0xc')](_0x5847('0xd'),_0x4281b3,_0x5e9fdd['priority']);if(_0x5e9fdd[_0x5847('0xe')]){var _0x43ccfb=_[_0x5847('0xf')](_0x21f632[_0x5847('0x10')](),{'p':_0x5e9fdd[_0x5847('0xe')]});if(_0x43ccfb>=0x0){logger[_0x5847('0xc')](_0x5847('0x11'),_0x4281b3,_0x5e9fdd[_0x5847('0xe')]||_0x5847('0x12'),_0x43ccfb);_0x21f632[_0x5847('0x12')](_0x43ccfb);}else{logger[_0x5847('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x4281b3,_0x5e9fdd[_0x5847('0xe')]||_0x5847('0x12'));_0x21f632[_0x5847('0x13')]();}}else{_0x21f632[_0x5847('0x12')]();}}}catch(_0x35d163){logger[_0x5847('0x7')](_0x5847('0x8'),_0x4281b3,JSON[_0x5847('0x14')](_0x35d163));_0x21f632[_0x5847('0x13')]();}};}; \ 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 1cb705e..7454e13 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 _0xc30f=['stop','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','chat','ChatWebsiteId','account','upperFirst','channel','AccountId','interaction','then','info','[%s][MESSAGE]\x20%s','body','catch','error','stringify'];(function(_0x4e58d1,_0x18c460){var _0xf9daf9=function(_0x5ccb3f){while(--_0x5ccb3f){_0x4e58d1['push'](_0x4e58d1['shift']());}};_0xf9daf9(++_0x18c460);}(_0xc30f,0x97));var _0xfc30=function(_0x3dd845,_0x33692d){_0x3dd845=_0x3dd845-0x0;var _0x46cd22=_0xc30f[_0x3dd845];return _0x46cd22;};'use strict';var _=require(_0xfc30('0x0'));var utils=require(_0xfc30('0x1'));var logger=require(_0xfc30('0x2'))(_0xfc30('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfc30('0x4')),'mailMessage':require(_0xfc30('0x5')),'smsMessage':require(_0xfc30('0x6')),'faxMessage':require(_0xfc30('0x7')),'whatsappMessage':require(_0xfc30('0x8'))};exports[_0xfc30('0x9')]=function(_0x4285ce,_0x43488e){return function(_0x1a7887){try{var _0x5bac11={'body':utils['getMustacheRender'](_0x43488e[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xfc30('0xa')){_0x5bac11[_0xfc30('0xb')]=this[_0xfc30('0xc')]['id'];}else{_0x5bac11[_[_0xfc30('0xd')](this[_0xfc30('0xe')])+_0xfc30('0xf')]=this[_0xfc30('0xc')]['id'];}_0x5bac11[_[_0xfc30('0xd')](this[_0xfc30('0xe')])+'InteractionId']=this[_0xfc30('0x10')]['id'];if(rpc[this['channel']+'Message']){return rpc[this['channel']+'Message']['create'](_0x5bac11)[_0xfc30('0x11')](function(_0x4c6e1e){logger[_0xfc30('0x12')](_0xfc30('0x13'),_0x4285ce,_0x5bac11[_0xfc30('0x14')]);_0x1a7887['next']();})[_0xfc30('0x15')](function(_0x1f5ad4){logger[_0xfc30('0x16')](_0xfc30('0x13'),_0x4285ce,JSON[_0xfc30('0x17')](_0x1f5ad4));_0x1a7887['stop']();});}}catch(_0x7967fc){logger['error'](_0xfc30('0x13'),_0x4285ce,JSON[_0xfc30('0x17')](_0x7967fc));_0x1a7887[_0xfc30('0x18')]();}};}; \ No newline at end of file +var _0xf660=['next','catch','error','stringify','stop','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','channel','account','upperFirst','AccountId','InteractionId','Message','[%s][MESSAGE]\x20%s','body'];(function(_0x5d7db8,_0x3e19b1){var _0x5f7dc2=function(_0x21b364){while(--_0x21b364){_0x5d7db8['push'](_0x5d7db8['shift']());}};_0x5f7dc2(++_0x3e19b1);}(_0xf660,0x195));var _0x0f66=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xf660[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var utils=require(_0x0f66('0x0'));var logger=require('../../../../config/logger')(_0x0f66('0x1'));var rpc={'chatMessage':require(_0x0f66('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0f66('0x3')),'faxMessage':require(_0x0f66('0x4')),'whatsappMessage':require(_0x0f66('0x5'))};exports[_0x0f66('0x6')]=function(_0x489d01,_0x50511d){return function(_0x3e87b1){try{var _0x54b129={'body':utils['getMustacheRender'](_0x50511d[0x0],this),'ContactId':this['contact']['id']};if(this[_0x0f66('0x7')]==='chat'){_0x54b129['ChatWebsiteId']=this[_0x0f66('0x8')]['id'];}else{_0x54b129[_[_0x0f66('0x9')](this[_0x0f66('0x7')])+_0x0f66('0xa')]=this[_0x0f66('0x8')]['id'];}_0x54b129[_[_0x0f66('0x9')](this['channel'])+_0x0f66('0xb')]=this['interaction']['id'];if(rpc[this['channel']+_0x0f66('0xc')]){return rpc[this[_0x0f66('0x7')]+_0x0f66('0xc')]['create'](_0x54b129)['then'](function(_0x37789c){logger['info'](_0x0f66('0xd'),_0x489d01,_0x54b129[_0x0f66('0xe')]);_0x3e87b1[_0x0f66('0xf')]();})[_0x0f66('0x10')](function(_0x7fc97e){logger[_0x0f66('0x11')](_0x0f66('0xd'),_0x489d01,JSON[_0x0f66('0x12')](_0x7fc97e));_0x3e87b1[_0x0f66('0x13')]();});}}catch(_0xac2de9){logger[_0x0f66('0x11')](_0x0f66('0xd'),_0x489d01,JSON[_0x0f66('0x12')](_0xac2de9));_0x3e87b1[_0x0f66('0x13')]();}};}; \ 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 ba71920..a0970f9 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 _0x6cf3=['stop','./utils','consequence','info','[%s][NOOP]\x20%s','next','error','stringify'];(function(_0x29e49a,_0x21f8bc){var _0x3660d9=function(_0x2e2ae3){while(--_0x2e2ae3){_0x29e49a['push'](_0x29e49a['shift']());}};_0x3660d9(++_0x21f8bc);}(_0x6cf3,0x69));var _0x36cf=function(_0x24d4b9,_0x214af6){_0x24d4b9=_0x24d4b9-0x0;var _0x1acb6a=_0x6cf3[_0x24d4b9];return _0x1acb6a;};'use strict';var utils=require(_0x36cf('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0x36cf('0x1')]=function(_0x3757b4,_0x3156a5){return function(_0x453119){try{logger[_0x36cf('0x2')](_0x36cf('0x3'),_0x3757b4,utils['getMustacheRender'](_0x3156a5[0x0],this));_0x453119[_0x36cf('0x4')]();}catch(_0x40092c){logger[_0x36cf('0x5')]('[%s][NOOP]\x20%s',_0x3757b4,JSON[_0x36cf('0x6')](_0x40092c));_0x453119[_0x36cf('0x7')]();}};}; \ No newline at end of file +var _0x2f3f=['next','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s'];(function(_0x18db4d,_0x381bb1){var _0x132535=function(_0x4faa0a){while(--_0x4faa0a){_0x18db4d['push'](_0x18db4d['shift']());}};_0x132535(++_0x381bb1);}(_0x2f3f,0x1b1));var _0xf2f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2f3f[_0x3ab51d];return _0x29a04e;};'use strict';var utils=require(_0xf2f3('0x0'));var logger=require(_0xf2f3('0x1'))('routing');exports[_0xf2f3('0x2')]=function(_0x28bf8f,_0x3a6951){return function(_0x3e38b0){try{logger[_0xf2f3('0x3')](_0xf2f3('0x4'),_0x28bf8f,utils['getMustacheRender'](_0x3a6951[0x0],this));_0x3e38b0[_0xf2f3('0x5')]();}catch(_0x43dc98){logger['error'](_0xf2f3('0x4'),_0x28bf8f,JSON['stringify'](_0x43dc98));_0x3e38b0['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 4ca22b2..34b9849 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 _0x6db7=['YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','AccountId','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','validate','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x47f536,_0x4e2dc3){var _0x4edad7=function(_0x1c249d){while(--_0x1c249d){_0x47f536['push'](_0x47f536['shift']());}};_0x4edad7(++_0x4e2dc3);}(_0x6db7,0x1a1));var _0x76db=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x6db7[_0x3eff21];return _0x1945bb;};'use strict';var schema=require('validate');var _=require(_0x76db('0x0'));var util=require(_0x76db('0x1'));var seqqueue=require(_0x76db('0x2'));var moment=require('moment');var Redis=require(_0x76db('0x3'));var config=require(_0x76db('0x4'));var logger=require(_0x76db('0x5'))(_0x76db('0x6'));var strategy=require(_0x76db('0x7'));config[_0x76db('0x8')]=_[_0x76db('0x9')](config['redis'],{'host':_0x76db('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x76db('0x8')]));var attributes=['id',_0x76db('0xb'),_0x76db('0xc'),_0x76db('0xd'),'from',_0x76db('0xe')];function emit(_0x1c17cf,_0x205be4,_0x4db51a){io['to'](_0x1c17cf)['emit'](_0x205be4,_0x4db51a);}function emitChannelQueueInteraction(_0x25d0b6,_0x9125f1,_0x129643,_0x2f95da,_0x3fce55,_0x1ff1eb,_0x34216d,_0x5c2449){var _0xf48a8d=_[_0x76db('0xf')](_0x129643);_0xf48a8d[_0x76db('0xb')]=_0x5c2449;_0xf48a8d[_0x76db('0xd')]=_0x9125f1;_0xf48a8d['account']=_0x2f95da;_0xf48a8d['id']=_0x3fce55;if(_0x1ff1eb){_0x34216d[util[_0x76db('0x10')](_0x76db('0x11'),_0x25d0b6)][_0x3fce55]=_['pick'](_0xf48a8d,attributes);}else{delete _0x34216d[util[_0x76db('0x10')]('%sQueuesWaitingInteractions',_0x25d0b6)][_0x3fce55];}emit(util[_0x76db('0x10')](_0x76db('0x12'),_0x25d0b6,_0x9125f1),util[_0x76db('0x10')](_0x76db('0x13'),_0x25d0b6,_0x1ff1eb?_0x76db('0x14'):_0x76db('0x15')),_[_0x76db('0x16')](_0xf48a8d,attributes));}var rpc={'openchannelQueueReport':require(_0x76db('0x17')),'mailQueueReport':require(_0x76db('0x18')),'chatQueueReport':require(_0x76db('0x19')),'smsQueueReport':require(_0x76db('0x1a')),'faxQueueReport':require(_0x76db('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x76db('0x1c')},'timeout':{'type':_0x76db('0x1d'),'message':_0x76db('0x1e')}});function startRouting(_0x524e7e,_0x4b67bf,_0xc560ec,_0x50c50f){if(_0x524e7e&&_0x4b67bf&&_0xc560ec){_0x4b67bf[_0x76db('0x1f')]+=0x1;var _0x5cc81b={'uniqueid':_0x524e7e,'from':_0xc560ec['body']?_0xc560ec[_0x76db('0x20')]['from']:'','joinAt':moment()[_0x76db('0x10')](_0x76db('0x21')),'ContactId':_0xc560ec[_0x76db('0x22')]?_0xc560ec[_0x76db('0x22')]['id']:null,'ListId':_0xc560ec[_0x76db('0x23')]?_0xc560ec[_0x76db('0x23')]['id']:null};_0x5cc81b[_[_0x76db('0x24')](_0xc560ec['channel'])+_0x76db('0x25')]=_0x4b67bf['id']||null;_0x5cc81b[_[_0x76db('0x24')](_0xc560ec[_0x76db('0x26')])+'InteractionId']=_0xc560ec[_0x76db('0x27')]?_0xc560ec[_0x76db('0x27')]['id']:null;_0x5cc81b[_[_0x76db('0x24')](_0xc560ec['channel'])+_0x76db('0x28')]=_0xc560ec[_0x76db('0x29')]?_0xc560ec['message']['id']:null;_0x5cc81b[_['upperFirst'](_0xc560ec[_0x76db('0x26')])+(_0xc560ec[_0x76db('0x26')]!=='chat'?_0x76db('0x2a'):_0x76db('0x2b'))]=_0xc560ec[_0x76db('0xc')]?_0xc560ec[_0x76db('0xc')]['id']:null;logger[_0x76db('0x2c')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x524e7e,_0x4b67bf[_0x76db('0x2d')]));emitChannelQueueInteraction(_0xc560ec[_0x76db('0x26')],_0x4b67bf[_0x76db('0x2d')],_0x5cc81b,_0xc560ec[_0x76db('0xc')][_0x76db('0x2d')],_0xc560ec['message']['id'],!![],_0x50c50f,_0x4b67bf['id']);if(rpc[_0xc560ec[_0x76db('0x26')]+'QueueReport']){return rpc[_0xc560ec[_0x76db('0x26')]+_0x76db('0x2e')]['create'](_0x5cc81b)[_0x76db('0x2f')](function(_0x526c91){logger[_0x76db('0x30')](_0x76db('0x31'));});}}}function stopRouting(_0x412dd2,_0x3678c3,_0x11a781,_0x41ea7c){if(_0x412dd2&&_0x3678c3){_0x3678c3[_0x76db('0x1f')]-=0x1;var _0x1a2962={'leaveAt':moment()['format'](_0x76db('0x21')),'acceptAt':moment()[_0x76db('0x10')](_0x76db('0x21')),'reason':_0x76db('0x32')};logger[_0x76db('0x2c')](util[_0x76db('0x10')](_0x76db('0x33'),_0x412dd2,_0x3678c3[_0x76db('0x2d')]));emitChannelQueueInteraction(_0x11a781[_0x76db('0x26')],_0x3678c3[_0x76db('0x2d')],_0x11a781[_0x76db('0x20')],_0x11a781[_0x76db('0xc')][_0x76db('0x2d')],_0x11a781[_0x76db('0x29')]['id'],![],_0x41ea7c,_0x3678c3['id']);if(rpc[_0x11a781['channel']+_0x76db('0x2e')]){return rpc[_0x11a781[_0x76db('0x26')]+_0x76db('0x2e')][_0x76db('0x34')](_0x412dd2,_0x1a2962)['catch'](function(_0x3a0607){logger[_0x76db('0x30')](_0x76db('0x35'));});}}}function endRouting(_0x4a5863,_0x49fea3,_0x1a9cd5,_0x5cba3f){if(_0x4a5863&&_0x49fea3){_0x49fea3[_0x76db('0x1f')]-=0x1;var _0x4c98c4={'leaveAt':moment()[_0x76db('0x10')](_0x76db('0x21')),'exitAt':moment()[_0x76db('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x76db('0x36')};logger[_0x76db('0x2c')](util[_0x76db('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x4a5863,_0x49fea3['name']));emitChannelQueueInteraction(_0x1a9cd5[_0x76db('0x26')],_0x49fea3['name'],_0x1a9cd5['body'],_0x1a9cd5[_0x76db('0xc')][_0x76db('0x2d')],_0x1a9cd5[_0x76db('0x29')]['id'],![],_0x5cba3f);if(rpc[_0x1a9cd5[_0x76db('0x26')]+_0x76db('0x2e')]){return rpc[_0x1a9cd5[_0x76db('0x26')]+_0x76db('0x2e')][_0x76db('0x34')](_0x4a5863,_0x4c98c4)[_0x76db('0x2f')](function(_0x2cd2c5){logger[_0x76db('0x30')](_0x76db('0x35'));});}}}function handleFindQueue(_0x51d83c){return function(_0x197ef4){return _0x197ef4['name'][_0x76db('0x37')]()===_0x51d83c[_0x76db('0x37')]();};}exports['consequence']=function(_0x3d353e,_0x30ece9,_0x41fdb6,_0x6c4600){return function(_0x33e43d){try{var _0x2e5f47={'name':_0x30ece9[0x0],'timeout':_0x30ece9[0x1]};var _0x2696be=queue[_0x76db('0x38')](_0x2e5f47,{'typecast':!![]});if(_0x2696be[_0x76db('0x39')]){logger[_0x76db('0x30')](_0x76db('0x3a'),_0x3d353e,_[_0x76db('0x3b')](_0x2696be,_0x76db('0x29'))['join'](',\x20'));_0x33e43d[_0x76db('0x3c')]();}else{var _0x4c6b14=_[_0x76db('0x3d')](_0x41fdb6[_0x6c4600[_0x76db('0x26')]+_0x76db('0x3e')],handleFindQueue(_0x2e5f47[_0x76db('0x2d')]));if(_0x4c6b14){startRouting(_0x3d353e,_0x4c6b14,_0x6c4600,_0x41fdb6);var _0x5bfa6a=(_0x4c6b14[_0x76db('0x36')]||0xa)*0x3e8;var _0x1043de=(_0x2e5f47[_0x76db('0x36')]||0x14)*0x3e8;var _0x3a343f,_0x3f9eee;if(_0x5bfa6a>_0x1043de){_0x1043de=_0x5bfa6a;}var _0x35b9a3=seqqueue['createQueue'](_0x5bfa6a);_0x35b9a3['id']=_0x3d353e;_0x35b9a3['atimeout']=_0x5bfa6a;_0x35b9a3['qtimeout']=_0x1043de;_0x35b9a3['channel']=_0x6c4600[_0x76db('0x26')];_0x41fdb6['rules'][_0x3d353e]['on'](_0x76db('0x3f'),function(){logger[_0x76db('0x2c')](_0x76db('0x40'),_0x3d353e);stopRouting(_0x3d353e,_0x4c6b14,_0x6c4600,_0x41fdb6);clearTimeout(_0x3a343f);_0x3a343f=undefined;_0x35b9a3[_0x76db('0x41')](!![]);if(_0x41fdb6[_0x76db('0x42')][_0x3d353e]){delete _0x41fdb6[_0x76db('0x42')][_0x3d353e];}_0x33e43d[_0x76db('0x3c')]();});_0x41fdb6[_0x76db('0x42')][_0x3d353e]['on'](_0x76db('0x43'),function(){if(_0x41fdb6[_0x76db('0x42')][_0x3d353e]){delete _0x41fdb6[_0x76db('0x42')][_0x3d353e];}});_0x3a343f=setTimeout(function(){logger[_0x76db('0x2c')](_0x76db('0x44'),_0x3d353e);endRouting(_0x3d353e,_0x4c6b14,_0x6c4600,_0x41fdb6);clearTimeout(_0x3a343f);_0x35b9a3[_0x76db('0x41')](!![]);_0x33e43d[_0x76db('0x45')]();},_0x1043de);switch(_0x4c6b14[_0x76db('0x46')]){case'rrmemory':strategy['rrmemory'](_0x35b9a3,_0x4c6b14,_0x41fdb6,_0x6c4600);break;default:strategy[_0x76db('0x47')](_0x35b9a3,_0x4c6b14,_0x41fdb6,_0x6c4600);}}else{logger[_0x76db('0x30')](_0x76db('0x48'),_0x3d353e,_0x2e5f47[_0x76db('0x2d')]);_0x33e43d[_0x76db('0x3c')]();}}}catch(_0x566a07){console[_0x76db('0x49')](_0x566a07);logger[_0x76db('0x30')]('[%s][QUEUE]\x20%s',_0x3d353e,_0x566a07[_0x76db('0x4a')]);_0x33e43d[_0x76db('0x3c')]();}};}; \ No newline at end of file +var _0xc7fd=['../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','queue_id','account','queue','from','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','YYYY-MM-DD\x20HH:mm:ss','error','update\x20queue\x20report','waiting','[%s][END:QUEUE][NAME:%s]','update','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis'];(function(_0x55dbd1,_0x574cb7){var _0x129bc8=function(_0x3d3ce5){while(--_0x3d3ce5){_0x55dbd1['push'](_0x55dbd1['shift']());}};_0x129bc8(++_0x574cb7);}(_0xc7fd,0xde));var _0xdc7f=function(_0x307d2b,_0x5f55d1){_0x307d2b=_0x307d2b-0x0;var _0x39da26=_0xc7fd[_0x307d2b];return _0x39da26;};'use strict';var schema=require(_0xdc7f('0x0'));var _=require(_0xdc7f('0x1'));var util=require(_0xdc7f('0x2'));var seqqueue=require(_0xdc7f('0x3'));var moment=require(_0xdc7f('0x4'));var Redis=require(_0xdc7f('0x5'));var config=require(_0xdc7f('0x6'));var logger=require(_0xdc7f('0x7'))(_0xdc7f('0x8'));var strategy=require('./strategy');config[_0xdc7f('0x9')]=_[_0xdc7f('0xa')](config[_0xdc7f('0x9')],{'host':_0xdc7f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0xdc7f('0xc'),_0xdc7f('0xd'),_0xdc7f('0xe'),_0xdc7f('0xf'),'joinAt'];function emit(_0x51fef3,_0x474ae5,_0x4db2b0){io['to'](_0x51fef3)[_0xdc7f('0x10')](_0x474ae5,_0x4db2b0);}function emitChannelQueueInteraction(_0x4adbd7,_0x255b13,_0x3adfc6,_0x4bb642,_0x985228,_0x62e6c7,_0x50bc87,_0xf1ad52){var _0x484a94=_[_0xdc7f('0x11')](_0x3adfc6);_0x484a94[_0xdc7f('0xc')]=_0xf1ad52;_0x484a94[_0xdc7f('0xe')]=_0x255b13;_0x484a94[_0xdc7f('0xd')]=_0x4bb642;_0x484a94['id']=_0x985228;if(_0x62e6c7){_0x50bc87[util['format'](_0xdc7f('0x12'),_0x4adbd7)][_0x985228]=_[_0xdc7f('0x13')](_0x484a94,attributes);}else{delete _0x50bc87[util[_0xdc7f('0x14')]('%sQueuesWaitingInteractions',_0x4adbd7)][_0x985228];}emit(util[_0xdc7f('0x14')](_0xdc7f('0x15'),_0x4adbd7,_0x255b13),util['format'](_0xdc7f('0x16'),_0x4adbd7,_0x62e6c7?_0xdc7f('0x17'):_0xdc7f('0x18')),_[_0xdc7f('0x13')](_0x484a94,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xdc7f('0x19')),'chatQueueReport':require(_0xdc7f('0x1a')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xdc7f('0x1b'),'required':!![],'message':_0xdc7f('0x1c')},'timeout':{'type':_0xdc7f('0x1d'),'message':_0xdc7f('0x1e')}});function startRouting(_0x34754f,_0x567dab,_0x4506d8,_0x202170){if(_0x34754f&&_0x567dab&&_0x4506d8){_0x567dab['waiting']+=0x1;var _0x28126c={'uniqueid':_0x34754f,'from':_0x4506d8[_0xdc7f('0x1f')]?_0x4506d8[_0xdc7f('0x1f')][_0xdc7f('0xf')]:'','joinAt':moment()[_0xdc7f('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4506d8[_0xdc7f('0x20')]?_0x4506d8[_0xdc7f('0x20')]['id']:null,'ListId':_0x4506d8[_0xdc7f('0x21')]?_0x4506d8['list']['id']:null};_0x28126c[_[_0xdc7f('0x22')](_0x4506d8[_0xdc7f('0x23')])+_0xdc7f('0x24')]=_0x567dab['id']||null;_0x28126c[_[_0xdc7f('0x22')](_0x4506d8['channel'])+'InteractionId']=_0x4506d8[_0xdc7f('0x25')]?_0x4506d8[_0xdc7f('0x25')]['id']:null;_0x28126c[_[_0xdc7f('0x22')](_0x4506d8['channel'])+_0xdc7f('0x26')]=_0x4506d8[_0xdc7f('0x27')]?_0x4506d8['message']['id']:null;_0x28126c[_[_0xdc7f('0x22')](_0x4506d8[_0xdc7f('0x23')])+(_0x4506d8['channel']!==_0xdc7f('0x28')?_0xdc7f('0x29'):_0xdc7f('0x2a'))]=_0x4506d8[_0xdc7f('0xd')]?_0x4506d8[_0xdc7f('0xd')]['id']:null;logger[_0xdc7f('0x2b')](util['format'](_0xdc7f('0x2c'),_0x34754f,_0x567dab['name']));emitChannelQueueInteraction(_0x4506d8[_0xdc7f('0x23')],_0x567dab[_0xdc7f('0x2d')],_0x28126c,_0x4506d8[_0xdc7f('0xd')][_0xdc7f('0x2d')],_0x4506d8[_0xdc7f('0x27')]['id'],!![],_0x202170,_0x567dab['id']);if(rpc[_0x4506d8['channel']+_0xdc7f('0x2e')]){return rpc[_0x4506d8[_0xdc7f('0x23')]+'QueueReport']['create'](_0x28126c)[_0xdc7f('0x2f')](function(_0x4f9225){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x187ebb,_0x45acf0,_0x40211c,_0x487b3b){if(_0x187ebb&&_0x45acf0){_0x45acf0['waiting']-=0x1;var _0x149b57={'leaveAt':moment()[_0xdc7f('0x14')](_0xdc7f('0x30')),'acceptAt':moment()[_0xdc7f('0x14')](_0xdc7f('0x30')),'reason':'accepted'};logger[_0xdc7f('0x2b')](util[_0xdc7f('0x14')]('[%s][STOP:QUEUE][NAME:%s]',_0x187ebb,_0x45acf0['name']));emitChannelQueueInteraction(_0x40211c['channel'],_0x45acf0['name'],_0x40211c[_0xdc7f('0x1f')],_0x40211c[_0xdc7f('0xd')]['name'],_0x40211c[_0xdc7f('0x27')]['id'],![],_0x487b3b,_0x45acf0['id']);if(rpc[_0x40211c[_0xdc7f('0x23')]+_0xdc7f('0x2e')]){return rpc[_0x40211c[_0xdc7f('0x23')]+_0xdc7f('0x2e')]['update'](_0x187ebb,_0x149b57)['catch'](function(_0x6965c0){logger[_0xdc7f('0x31')](_0xdc7f('0x32'));});}}}function endRouting(_0x3d6ea6,_0x1f2c95,_0xd14e6d,_0x6cfaf6){if(_0x3d6ea6&&_0x1f2c95){_0x1f2c95[_0xdc7f('0x33')]-=0x1;var _0x545e41={'leaveAt':moment()[_0xdc7f('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xdc7f('0x14')](_0xdc7f('0x30')),'reason':'timeout'};logger[_0xdc7f('0x2b')](util[_0xdc7f('0x14')](_0xdc7f('0x34'),_0x3d6ea6,_0x1f2c95[_0xdc7f('0x2d')]));emitChannelQueueInteraction(_0xd14e6d[_0xdc7f('0x23')],_0x1f2c95[_0xdc7f('0x2d')],_0xd14e6d[_0xdc7f('0x1f')],_0xd14e6d[_0xdc7f('0xd')][_0xdc7f('0x2d')],_0xd14e6d[_0xdc7f('0x27')]['id'],![],_0x6cfaf6);if(rpc[_0xd14e6d[_0xdc7f('0x23')]+'QueueReport']){return rpc[_0xd14e6d[_0xdc7f('0x23')]+'QueueReport'][_0xdc7f('0x35')](_0x3d6ea6,_0x545e41)[_0xdc7f('0x2f')](function(_0x3a9e23){logger[_0xdc7f('0x31')](_0xdc7f('0x32'));});}}}function handleFindQueue(_0x3b6be5){return function(_0x589b78){return _0x589b78[_0xdc7f('0x2d')]['toLowerCase']()===_0x3b6be5['toLowerCase']();};}exports[_0xdc7f('0x36')]=function(_0x43e565,_0x1ce4b0,_0x48900c,_0x5b2825){return function(_0x1aad41){try{var _0xb3fe59={'name':_0x1ce4b0[0x0],'timeout':_0x1ce4b0[0x1]};var _0x136726=queue[_0xdc7f('0x0')](_0xb3fe59,{'typecast':!![]});if(_0x136726[_0xdc7f('0x37')]){logger['error'](_0xdc7f('0x38'),_0x43e565,_[_0xdc7f('0x39')](_0x136726,_0xdc7f('0x27'))['join'](',\x20'));_0x1aad41[_0xdc7f('0x3a')]();}else{var _0xd45b55=_['find'](_0x48900c[_0x5b2825[_0xdc7f('0x23')]+_0xdc7f('0x3b')],handleFindQueue(_0xb3fe59[_0xdc7f('0x2d')]));if(_0xd45b55){startRouting(_0x43e565,_0xd45b55,_0x5b2825,_0x48900c);var _0x800db7=(_0xd45b55[_0xdc7f('0x3c')]||0xa)*0x3e8;var _0x2c61b9=(_0xb3fe59[_0xdc7f('0x3c')]||0x14)*0x3e8;var _0x2d9a0b,_0x3e7d54;if(_0x800db7>_0x2c61b9){_0x2c61b9=_0x800db7;}var _0x13de2b=seqqueue[_0xdc7f('0x3d')](_0x800db7);_0x13de2b['id']=_0x43e565;_0x13de2b['atimeout']=_0x800db7;_0x13de2b[_0xdc7f('0x3e')]=_0x2c61b9;_0x13de2b[_0xdc7f('0x23')]=_0x5b2825[_0xdc7f('0x23')];_0x48900c[_0xdc7f('0x3f')][_0x43e565]['on'](_0xdc7f('0x40'),function(){logger[_0xdc7f('0x2b')](_0xdc7f('0x41'),_0x43e565);stopRouting(_0x43e565,_0xd45b55,_0x5b2825,_0x48900c);clearTimeout(_0x2d9a0b);_0x2d9a0b=undefined;_0x13de2b[_0xdc7f('0x42')](!![]);if(_0x48900c[_0xdc7f('0x3f')][_0x43e565]){delete _0x48900c['rules'][_0x43e565];}_0x1aad41[_0xdc7f('0x3a')]();});_0x48900c['rules'][_0x43e565]['on'](_0xdc7f('0x43'),function(){if(_0x48900c[_0xdc7f('0x3f')][_0x43e565]){delete _0x48900c[_0xdc7f('0x3f')][_0x43e565];}});_0x2d9a0b=setTimeout(function(){logger['info'](_0xdc7f('0x44'),_0x43e565);endRouting(_0x43e565,_0xd45b55,_0x5b2825,_0x48900c);clearTimeout(_0x2d9a0b);_0x13de2b[_0xdc7f('0x42')](!![]);_0x1aad41[_0xdc7f('0x45')]();},_0x2c61b9);switch(_0xd45b55[_0xdc7f('0x46')]){case'rrmemory':strategy[_0xdc7f('0x47')](_0x13de2b,_0xd45b55,_0x48900c,_0x5b2825);break;default:strategy[_0xdc7f('0x48')](_0x13de2b,_0xd45b55,_0x48900c,_0x5b2825);}}else{logger[_0xdc7f('0x31')](_0xdc7f('0x49'),_0x43e565,_0xb3fe59['name']);_0x1aad41[_0xdc7f('0x3a')]();}}}catch(_0x1b7bfe){console[_0xdc7f('0x4a')](_0x1b7bfe);logger[_0xdc7f('0x31')](_0xdc7f('0x38'),_0x43e565,_0x1b7bfe[_0xdc7f('0x4b')]);_0x1aad41[_0xdc7f('0x3a')]();}};}; \ 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 ff46c1e..6f2481f 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 _0xe0e7=['drained','handleDrained','prototype','push','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','handleTimeout','bind'];(function(_0x46d1f9,_0x7dff8b){var _0xbd6a84=function(_0x3e9883){while(--_0x3e9883){_0x46d1f9['push'](_0x46d1f9['shift']());}};_0xbd6a84(++_0x7dff8b);}(_0xe0e7,0xa0));var _0x7e0e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xe0e7[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x7e0e('0x0'));var uuid=require(_0x7e0e('0x1'));var util=require(_0x7e0e('0x2'));var logger=require('../../../../../config/logger')(_0x7e0e('0x3'));var Agent=function(_0x430ef1,_0x3d420a,_0x61d368,_0x463da6){this[_0x7e0e('0x4')]=uuid['v4']();this[_0x7e0e('0x5')]=_0x430ef1;this[_0x7e0e('0x6')]=_0x3d420a;this[_0x7e0e('0x7')]=_0x61d368;this['routing']=_0x463da6;this['squeue']['push'](this['handleRun']['bind'](this),this[_0x7e0e('0x8')][_0x7e0e('0x9')](this));this[_0x7e0e('0x5')]['on']('timeout',this[_0x7e0e('0x8')]['bind'](this));this[_0x7e0e('0x5')]['on'](_0x7e0e('0xa'),this[_0x7e0e('0xb')][_0x7e0e('0x9')](this));};Agent[_0x7e0e('0xc')][_0x7e0e('0xd')]=function(){this[_0x7e0e('0x5')][_0x7e0e('0xd')](this[_0x7e0e('0xe')][_0x7e0e('0x9')](this),this[_0x7e0e('0x8')][_0x7e0e('0x9')](this));};Agent['prototype'][_0x7e0e('0xb')]=function(){this[_0x7e0e('0x8')](!![]);};Agent[_0x7e0e('0xc')][_0x7e0e('0xe')]=function(_0x2e8639){logger[_0x7e0e('0xf')](_0x7e0e('0x10'),this[_0x7e0e('0x5')]['id'],this[_0x7e0e('0x6')]['id']);if(_[_0x7e0e('0x11')](this['realtime'][_0x7e0e('0x12')][this['agent']['id']])){logger[_0x7e0e('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x7e0e('0x3')][_0x7e0e('0x13')]||util[_0x7e0e('0x14')](this['squeue']['id'],this['realtime'][_0x7e0e('0x12')][this['agent']['id']],this[_0x7e0e('0x5')][_0x7e0e('0x15')],![])){this[_0x7e0e('0x7')][_0x7e0e('0x12')][this['agent']['id']][_0x7e0e('0x16')]=!![];this[_0x7e0e('0x7')]['agents'][this[_0x7e0e('0x6')]['id']][_0x7e0e('0x17')]=undefined;util[_0x7e0e('0x18')](this['notificationId'],this[_0x7e0e('0x5')]['id'],this['realtime'][_0x7e0e('0x12')][this[_0x7e0e('0x6')]['id']],null,this[_0x7e0e('0x3')]);util['writeLog'](this[_0x7e0e('0x5')]['id'],this[_0x7e0e('0x7')]['agents'][this[_0x7e0e('0x6')]['id']],'RINGING'+(this[_0x7e0e('0x3')][_0x7e0e('0x13')]?_0x7e0e('0x19'):''));}else{logger[_0x7e0e('0xf')](_0x7e0e('0x1a'),this['squeue']['id'],this[_0x7e0e('0x6')]['id']);setTimeout(this[_0x7e0e('0xd')]['bind'](this),0x3e8);}}};Agent[_0x7e0e('0xc')][_0x7e0e('0x8')]=function(_0xb18b18){if(_['isNil'](this[_0x7e0e('0x7')]['agents'][this[_0x7e0e('0x6')]['id']])){return logger[_0x7e0e('0xf')](_0x7e0e('0x1b'),this[_0x7e0e('0x5')]['id'],this[_0x7e0e('0x6')]['id']);}else{logger[_0x7e0e('0xf')](_0x7e0e('0x1c'),this[_0x7e0e('0x5')]['id'],this[_0x7e0e('0x6')]['id']);util[_0x7e0e('0x1d')](this[_0x7e0e('0x4')],this['squeue']['id'],this[_0x7e0e('0x7')][_0x7e0e('0x12')][this[_0x7e0e('0x6')]['id']],null,this[_0x7e0e('0x3')]);this[_0x7e0e('0x7')]['agents'][this[_0x7e0e('0x6')]['id']]['busy']=![];this['realtime'][_0x7e0e('0x12')][this[_0x7e0e('0x6')]['id']][_0x7e0e('0x17')]=undefined;util[_0x7e0e('0x1e')](this[_0x7e0e('0x5')]['id'],this['realtime']['agents'][this[_0x7e0e('0x6')]['id']],_0xb18b18?_0x7e0e('0x1f'):_0x7e0e('0x20'));}if(!_0xb18b18){setTimeout(this[_0x7e0e('0xd')][_0x7e0e('0x9')](this),0x3e8);}};function agent(_0x2837be,_0x5d97be,_0x3711c5,_0x31a52c){return new Agent(_0x2837be,_0x5d97be,_0x3711c5,_0x31a52c);}module[_0x7e0e('0x21')]=agent; \ No newline at end of file +var _0x8ca7=['routing','squeue','agent','push','bind','handleTimeout','drained','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','notificationId','writeLog','hideNotification','STOP','TIMEOUT','exports','lodash','../../../../../config/logger'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8ca7,0x1a2));var _0x78ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ca7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x78ca('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x78ca('0x1'))(_0x78ca('0x2'));var Agent=function(_0x2cf105,_0x36af49,_0x425cae,_0x1050ad){this['notificationId']=uuid['v4']();this[_0x78ca('0x3')]=_0x2cf105;this[_0x78ca('0x4')]=_0x36af49;this['realtime']=_0x425cae;this[_0x78ca('0x2')]=_0x1050ad;this[_0x78ca('0x3')][_0x78ca('0x5')](this['handleRun'][_0x78ca('0x6')](this),this[_0x78ca('0x7')][_0x78ca('0x6')](this));this['squeue']['on']('timeout',this[_0x78ca('0x7')]['bind'](this));this[_0x78ca('0x3')]['on'](_0x78ca('0x8'),this[_0x78ca('0x9')][_0x78ca('0x6')](this));};Agent['prototype']['push']=function(){this[_0x78ca('0x3')][_0x78ca('0x5')](this[_0x78ca('0xa')][_0x78ca('0x6')](this),this[_0x78ca('0x7')]['bind'](this));};Agent['prototype'][_0x78ca('0x9')]=function(){this[_0x78ca('0x7')](!![]);};Agent[_0x78ca('0xb')]['handleRun']=function(_0xc701d8){logger[_0x78ca('0xc')](_0x78ca('0xd'),this[_0x78ca('0x3')]['id'],this[_0x78ca('0x4')]['id']);if(_[_0x78ca('0xe')](this[_0x78ca('0xf')]['agents'][this[_0x78ca('0x4')]['id']])){logger[_0x78ca('0xc')](_0x78ca('0x10'),this[_0x78ca('0x3')]['id'],this[_0x78ca('0x4')]['id']);setTimeout(this[_0x78ca('0x5')][_0x78ca('0x6')](this),0x3e8);}else{if(this[_0x78ca('0x2')][_0x78ca('0x11')]||util[_0x78ca('0x12')](this['squeue']['id'],this['realtime'][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']],this['squeue'][_0x78ca('0x14')],![])){this['realtime'][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']][_0x78ca('0x15')]=!![];this[_0x78ca('0xf')][_0x78ca('0x13')][this['agent']['id']][_0x78ca('0x16')]=undefined;util[_0x78ca('0x17')](this[_0x78ca('0x18')],this[_0x78ca('0x3')]['id'],this[_0x78ca('0xf')][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']],null,this[_0x78ca('0x2')]);util[_0x78ca('0x19')](this['squeue']['id'],this[_0x78ca('0xf')][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']],'RINGING'+(this[_0x78ca('0x2')][_0x78ca('0x11')]?':FORCED':''));}else{logger[_0x78ca('0xc')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x78ca('0x4')]['id']);setTimeout(this[_0x78ca('0x5')][_0x78ca('0x6')](this),0x3e8);}}};Agent['prototype'][_0x78ca('0x7')]=function(_0x274181){if(_['isNil'](this['realtime'][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']])){return logger[_0x78ca('0xc')](_0x78ca('0x10'),this[_0x78ca('0x3')]['id'],this[_0x78ca('0x4')]['id']);}else{logger[_0x78ca('0xc')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x78ca('0x3')]['id'],this[_0x78ca('0x4')]['id']);util[_0x78ca('0x1a')](this[_0x78ca('0x18')],this[_0x78ca('0x3')]['id'],this[_0x78ca('0xf')]['agents'][this[_0x78ca('0x4')]['id']],null,this['routing']);this[_0x78ca('0xf')][_0x78ca('0x13')][this['agent']['id']]['busy']=![];this[_0x78ca('0xf')]['agents'][this[_0x78ca('0x4')]['id']][_0x78ca('0x16')]=undefined;util[_0x78ca('0x19')](this['squeue']['id'],this[_0x78ca('0xf')][_0x78ca('0x13')][this[_0x78ca('0x4')]['id']],_0x274181?_0x78ca('0x1b'):_0x78ca('0x1c'));}if(!_0x274181){setTimeout(this[_0x78ca('0x5')][_0x78ca('0x6')](this),0x3e8);}};function agent(_0x4b42a7,_0x433f1b,_0x2a87c2,_0x271b59){return new Agent(_0x4b42a7,_0x433f1b,_0x2a87c2,_0x271b59);}module[_0x78ca('0x1d')]=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 fc38cc2..9d91f26 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 _0xfd87=['routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','lodash','uuid','./util','../../../../../config/logger'];(function(_0x5730ba,_0x2e5775){var _0x505e55=function(_0xecc5ec){while(--_0xecc5ec){_0x5730ba['push'](_0x5730ba['shift']());}};_0x505e55(++_0x2e5775);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7fd8('0x0'));var uuid=require(_0x7fd8('0x1'));var util=require(_0x7fd8('0x2'));var logger=require(_0x7fd8('0x3'))(_0x7fd8('0x4'));var Beepall=function(_0x15d25f,_0x2631d9,_0x42b06c,_0x4429f2){this[_0x7fd8('0x5')]=uuid['v4']();this[_0x7fd8('0x6')]=_0x15d25f;this['queue']=_0x2631d9;this[_0x7fd8('0x7')]=_0x42b06c;this[_0x7fd8('0x4')]=_0x4429f2;this['squeue'][_0x7fd8('0x8')](this[_0x7fd8('0x9')][_0x7fd8('0xa')](this),this[_0x7fd8('0xb')][_0x7fd8('0xa')](this));this['squeue']['on'](_0x7fd8('0xc'),this[_0x7fd8('0xb')][_0x7fd8('0xa')](this));this['squeue']['on']('drained',this['handleDrained'][_0x7fd8('0xa')](this));};Beepall['prototype'][_0x7fd8('0x8')]=function(){this[_0x7fd8('0x6')][_0x7fd8('0x8')](this['handleRun'][_0x7fd8('0xa')](this),this[_0x7fd8('0xb')][_0x7fd8('0xa')](this));};Beepall[_0x7fd8('0xd')][_0x7fd8('0xe')]=function(_0x5b7061){this[_0x7fd8('0xb')](!![]);};Beepall[_0x7fd8('0xd')][_0x7fd8('0x9')]=function(_0x1131ef){var _0x250a02=!![];if(!_[_0x7fd8('0xf')](this[_0x7fd8('0x10')])&&!_[_0x7fd8('0xf')](this[_0x7fd8('0x10')][_0x7fd8('0x11')])&&this[_0x7fd8('0x10')]['Agents']['length']>0x0){for(var _0x5ca7f6=0x0,_0xab57f7;_0x5ca7f60x0){for(var _0xd33b3f=0x0,_0x3a2305;_0xd33b3f0x0&&_0x240000[_0x1f8d27+'CurrentCapacity']>=_0x240000[_0x1f8d27+_0x85d5('0x20')]){writeLog(_0x5ce96e,_0x240000,_0x1f8d27[_0x85d5('0x21')]()+_0x85d5('0x22'));return![];}}return!![];};exports['showNotification']=function(_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5){return sendNotification(!![],_0x2d0497,_0x367704,_0x815808,_0x370c97,_0x4605c5);};exports['hideNotification']=function(_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91){return sendNotification(![],_0x1cbef1,_0x476c8b,_0x330f8a,_0x22a961,_0x43ac91);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x7bd0=['notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','hideNotification','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg','error','message'];(function(_0x478e10,_0x36e9e5){var _0x51af8a=function(_0x4bd978){while(--_0x4bd978){_0x478e10['push'](_0x478e10['shift']());}};_0x51af8a(++_0x36e9e5);}(_0x7bd0,0x111));var _0x07bd=function(_0x3a73bc,_0x550aef){_0x3a73bc=_0x3a73bc-0x0;var _0x32891b=_0x7bd0[_0x3a73bc];return _0x32891b;};'use strict';var _=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var utils=require(_0x07bd('0x2'));var Mustache=require(_0x07bd('0x3'));var Redis=require(_0x07bd('0x4'));var config=require(_0x07bd('0x5'));var logger=require(_0x07bd('0x6'))(_0x07bd('0x7'));config['redis']=_[_0x07bd('0x8')](config[_0x07bd('0x9')],{'host':_0x07bd('0xa'),'port':0x18eb});var io=require(_0x07bd('0xb'))(new Redis(config[_0x07bd('0x9')]));function emit(_0x422a22,_0x2e4cd1,_0x5a939d){io['to'](_0x422a22)[_0x07bd('0xc')](_0x2e4cd1,_0x5a939d);}function sendNotification(_0x5cd446,_0x8032dc,_0xb10241,_0x323724,_0x5984fa,_0x2bace8){io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))['emit'](_0x07bd('0x10'),_0x323724);var _0x313ca5=_0x2bace8||{};var _0x1b067a=_0xb10241[_0x07bd('0x11')]('.');var _0x456ecd={'uniqueid':_0x8032dc,'channel':_0x1b067a[0x0],'id':_0x1b067a[0x1],'title':_0x1b067a[0x0]+_0x07bd('0x12'),'interactionId':_0x1b067a[0x2],'queue':_0x5984fa?_0x5984fa[_0x07bd('0xf')]:null,'sound':_0x313ca5[_0x07bd('0x13')]['notificationSound'],'shake':_0x313ca5['account'][_0x07bd('0x14')]};try{if(!_0x313ca5[_0x07bd('0x15')]){_0x313ca5[_0x07bd('0x15')]={};}if(_0x5984fa){_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]=_0x5984fa;}else if(_0x313ca5[_0x07bd('0x15')][_0x07bd('0x16')]){delete _0x313ca5['body'][_0x07bd('0x16')];}_0x456ecd['msg']=utils[_0x07bd('0x17')](_0x313ca5[_0x07bd('0x13')][_0x07bd('0x18')],_0x313ca5);}catch(_0x1713ca){_0x456ecd[_0x07bd('0x19')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x07bd('0x1a')](util[_0x07bd('0xd')]('[%s][QUEUE]\x20%s',_0x8032dc,_0x1713ca[_0x07bd('0x1b')]));}io['to'](util[_0x07bd('0xd')](_0x07bd('0xe'),_0x323724[_0x07bd('0xf')]))[_0x07bd('0xc')](util[_0x07bd('0xd')](_0x07bd('0x1c'),_0x5cd446?_0x07bd('0x1d'):_0x07bd('0x1e')),_0x456ecd);}function writeLog(_0x50109f,_0x15c0b8,_0x227807){return logger[_0x07bd('0x1f')](util[_0x07bd('0xd')](_0x07bd('0x20'),_0x50109f,_0x15c0b8['name'],_0x227807));}exports['isAgentAvailable']=function(_0xbb7117,_0x51ca22,_0x2b0dee,_0x480c9c){if(_0x51ca22['busy']){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x21'));return![];}if(!_0x51ca22[_0x07bd('0x22')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x23'));return![];}if(_0x51ca22[_0x2b0dee+_0x07bd('0x24')]){writeLog(_0xbb7117,_0x51ca22,_0x07bd('0x25'));return![];}if(_0x480c9c&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+'Capacity')&&_0x51ca22[_0x07bd('0x26')](_0x2b0dee+_0x07bd('0x27'))){if(_0x51ca22[_0x2b0dee+_0x07bd('0x28')]>0x0&&_0x51ca22[_0x2b0dee+_0x07bd('0x27')]>=_0x51ca22[_0x2b0dee+_0x07bd('0x28')]){writeLog(_0xbb7117,_0x51ca22,_0x2b0dee[_0x07bd('0x29')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports['showNotification']=function(_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8){return sendNotification(!![],_0x5184dc,_0x335d61,_0xfa7566,_0x5b31f7,_0x51efa8);};exports[_0x07bd('0x2a')]=function(_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b){return sendNotification(![],_0x400cc0,_0x253dc0,_0x46ed12,_0x3f9424,_0x13bf6b);};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 97ae100..a57d054 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 _0x6737=['isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','shelljs','lodash','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','map','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0x6737,0xe2));var _0x7673=function(_0x5d8bb7,_0x153ae7){_0x5d8bb7=_0x5d8bb7-0x0;var _0x462a9f=_0x6737[_0x5d8bb7];return _0x462a9f;};'use strict';var schema=require('validate');var sh=require(_0x7673('0x0'));var _=require(_0x7673('0x1'));var utils=require('./utils');var logger=require(_0x7673('0x2'))(_0x7673('0x3'));var system=schema({'command':{'type':_0x7673('0x4'),'required':!![],'message':_0x7673('0x5')}});exports['consequence']=function(_0x32e6f2,_0x22ce8d){return function(_0x543b61){try{var _0x2f5edc={'command':_0x22ce8d[0x0]};var _0x15230f=system['validate'](_0x2f5edc,{'typecast':!![]});if(_0x15230f['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x32e6f2,_[_0x7673('0x6')](_0x15230f,'message')[_0x7673('0x7')](',\x20'));logger[_0x7673('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x32e6f2);_0x543b61[_0x7673('0x9')]();}else{var _0x331f57=this;var _0x35c1b3=utils['getMustacheRender'](_0x22ce8d[0x0],this);logger['info'](_0x7673('0xa'),_0x32e6f2,_0x35c1b3);sh['exec'](_[_0x7673('0xb')](_0x35c1b3),function(_0x8b5b80,_0x38090f){logger[_0x7673('0x8')](_0x7673('0xc'),_0x32e6f2,_0x8b5b80);if(_0x8b5b80==0x0){var _0x119e42=_0x38090f[_0x7673('0xd')](/(\r\n|\n|\r)/gm,'');if(_[_0x7673('0xe')](_0x22ce8d[0x1])||_[_0x7673('0xf')](_0x22ce8d[0x1])){logger[_0x7673('0x8')]('[%s][SYSTEM]\x20no\x20variable',_0x32e6f2);_0x331f57[_0x7673('0x10')][_0x22ce8d[0x1]]=_0x119e42;}else{logger[_0x7673('0x8')](_0x7673('0x11'),_0x32e6f2,_0x22ce8d[0x1],_0x119e42);_0x331f57[_0x7673('0x10')][_0x22ce8d[0x1]]=_0x119e42;}}_0x543b61[_0x7673('0x9')]();});}}catch(_0x2e83c4){logger[_0x7673('0x12')]('[%s][SYSTEM]\x20%s',_0x32e6f2,_['isObject'](_0x2e83c4)?JSON[_0x7673('0x13')](_0x2e83c4):_0x2e83c4);logger[_0x7673('0x8')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x32e6f2);_0x543b61[_0x7673('0x9')]();}};}; \ No newline at end of file +var _0xe458=['./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','stringify','validate','shelljs'];(function(_0x5930d8,_0xb06601){var _0x5ccf9a=function(_0x55d44b){while(--_0x55d44b){_0x5930d8['push'](_0x5930d8['shift']());}};_0x5ccf9a(++_0xb06601);}(_0xe458,0x6c));var _0x8e45=function(_0x3df163,_0x45b81c){_0x3df163=_0x3df163-0x0;var _0x2af052=_0xe458[_0x3df163];return _0x2af052;};'use strict';var schema=require(_0x8e45('0x0'));var sh=require(_0x8e45('0x1'));var _=require('lodash');var utils=require(_0x8e45('0x2'));var logger=require('../../../../config/logger')(_0x8e45('0x3'));var system=schema({'command':{'type':_0x8e45('0x4'),'required':!![],'message':_0x8e45('0x5')}});exports[_0x8e45('0x6')]=function(_0x517d7e,_0x499820){return function(_0x5175cf){try{var _0x17d5e9={'command':_0x499820[0x0]};var _0x2e8573=system[_0x8e45('0x0')](_0x17d5e9,{'typecast':!![]});if(_0x2e8573['length']){logger['error'](_0x8e45('0x7'),_0x517d7e,_[_0x8e45('0x8')](_0x2e8573,_0x8e45('0x9'))['join'](',\x20'));logger[_0x8e45('0xa')](_0x8e45('0xb'),_0x517d7e);_0x5175cf[_0x8e45('0xc')]();}else{var _0x49da93=this;var _0x4119c8=utils['getMustacheRender'](_0x499820[0x0],this);logger[_0x8e45('0xa')](_0x8e45('0xd'),_0x517d7e,_0x4119c8);sh['exec'](_['trim'](_0x4119c8),function(_0xbbe6cc,_0x22f5e5){logger['info'](_0x8e45('0xe'),_0x517d7e,_0xbbe6cc);if(_0xbbe6cc==0x0){var _0x35fed0=_0x22f5e5[_0x8e45('0xf')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x499820[0x1])||_[_0x8e45('0x10')](_0x499820[0x1])){logger['info'](_0x8e45('0x11'),_0x517d7e);_0x49da93[_0x8e45('0x12')][_0x499820[0x1]]=_0x35fed0;}else{logger[_0x8e45('0xa')](_0x8e45('0x13'),_0x517d7e,_0x499820[0x1],_0x35fed0);_0x49da93[_0x8e45('0x12')][_0x499820[0x1]]=_0x35fed0;}}_0x5175cf[_0x8e45('0xc')]();});}}catch(_0x576ace){logger[_0x8e45('0x14')](_0x8e45('0x7'),_0x517d7e,_['isObject'](_0x576ace)?JSON[_0x8e45('0x15')](_0x576ace):_0x576ace);logger['info'](_0x8e45('0xb'),_0x517d7e);_0x5175cf['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index d011074..14f9929 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 _0x6459=['Interaction','addTags','then','interaction','[%s][TAG]\x20%s','stringify','finally','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel'];(function(_0x291728,_0x5f4842){var _0x10444c=function(_0x1533ba){while(--_0x1533ba){_0x291728['push'](_0x291728['shift']());}};_0x10444c(++_0x5f4842);}(_0x6459,0x8a));var _0x9645=function(_0x335264,_0x492d1e){_0x335264=_0x335264-0x0;var _0x45342b=_0x6459[_0x335264];return _0x45342b;};'use strict';var schema=require('validate');var _=require(_0x9645('0x0'));var rpc={'chatInteraction':require(_0x9645('0x1')),'openchannelInteraction':require(_0x9645('0x2')),'smsInteraction':require(_0x9645('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9645('0x4'))};var logger=require(_0x9645('0x5'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x9645('0x6')}});exports[_0x9645('0x7')]=function(_0x14fab5,_0x5e15f5,_0x5eec25,_0xbafe01){return function(_0x15d8ac){try{var _0x501979={'tag':_0x5e15f5[0x0]};var _0x5568fa=tag[_0x9645('0x8')](_0x501979,{'typecast':!![]});if(_0x5568fa[_0x9645('0x9')]){logger[_0x9645('0xa')]('[%s][TAG]\x20%s',_0x14fab5,_[_0x9645('0xb')](_0x5568fa,_0x9645('0xc'))[_0x9645('0xd')](',\x20'));logger[_0x9645('0xe')](_0x9645('0xf'),_0x14fab5);_0x15d8ac[_0x9645('0x10')]();}else{var _0x31ea3e={'ids':[_0x5e15f5[0x0]]};if(rpc[_0xbafe01[_0x9645('0x11')]+'Interaction']){rpc[_0xbafe01[_0x9645('0x11')]+_0x9645('0x12')][_0x9645('0x13')](_0xbafe01['interaction']['id'],_0x31ea3e)[_0x9645('0x14')](function(_0x53a26a){logger[_0x9645('0xe')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x14fab5,_0x5e15f5[0x1],_0xbafe01[_0x9645('0x11')],_0xbafe01[_0x9645('0x15')]['id']);})['catch'](function(_0x79802d){logger['error'](_0x9645('0x16'),_0x14fab5,JSON[_0x9645('0x17')](_0x79802d));logger[_0x9645('0xe')](_0x9645('0xf'),_0x14fab5);})[_0x9645('0x18')](function(){_0x15d8ac['next']();});}}}catch(_0x78fe68){logger['error']('[%s][TAG]\x20%s',_0x14fab5,_[_0x9645('0x19')](_0x78fe68)?JSON[_0x9645('0x17')](_0x78fe68):_0x78fe68);logger[_0x9645('0xe')](_0x9645('0xf'),_0x14fab5);_0x15d8ac['next']();}};}; \ No newline at end of file +var _0xe719=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','error','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xe719,0xc4));var _0x9e71=function(_0xc5a268,_0x20fa24){_0xc5a268=_0xc5a268-0x0;var _0x4a47a1=_0xe719[_0xc5a268];return _0x4a47a1;};'use strict';var schema=require(_0x9e71('0x0'));var _=require(_0x9e71('0x1'));var rpc={'chatInteraction':require(_0x9e71('0x2')),'openchannelInteraction':require(_0x9e71('0x3')),'smsInteraction':require(_0x9e71('0x4')),'mailInteraction':require(_0x9e71('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x9e71('0x6'))};var logger=require(_0x9e71('0x7'))(_0x9e71('0x8'));var tag=schema({'tag':{'type':_0x9e71('0x9'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x9e71('0xa')]=function(_0xa74ea4,_0x5c8b63,_0x21a4e9,_0x5e0b8e){return function(_0x2b7eef){try{var _0x25b8f6={'tag':_0x5c8b63[0x0]};var _0x4eebb4=tag[_0x9e71('0x0')](_0x25b8f6,{'typecast':!![]});if(_0x4eebb4['length']){logger[_0x9e71('0xb')]('[%s][TAG]\x20%s',_0xa74ea4,_['map'](_0x4eebb4,'message')['join'](',\x20'));logger[_0x9e71('0xc')](_0x9e71('0xd'),_0xa74ea4);_0x2b7eef[_0x9e71('0xe')]();}else{var _0x1c4bb1={'ids':[_0x5c8b63[0x0]]};if(rpc[_0x5e0b8e[_0x9e71('0xf')]+'Interaction']){rpc[_0x5e0b8e[_0x9e71('0xf')]+_0x9e71('0x10')][_0x9e71('0x11')](_0x5e0b8e['interaction']['id'],_0x1c4bb1)[_0x9e71('0x12')](function(_0x2eb5b7){logger[_0x9e71('0xc')](_0x9e71('0x13'),_0xa74ea4,_0x5c8b63[0x1],_0x5e0b8e[_0x9e71('0xf')],_0x5e0b8e['interaction']['id']);})[_0x9e71('0x14')](function(_0x1c5317){logger[_0x9e71('0xb')](_0x9e71('0x15'),_0xa74ea4,JSON[_0x9e71('0x16')](_0x1c5317));logger[_0x9e71('0xc')](_0x9e71('0xd'),_0xa74ea4);})[_0x9e71('0x17')](function(){_0x2b7eef[_0x9e71('0xe')]();});}}}catch(_0x48c5e5){logger[_0x9e71('0xb')](_0x9e71('0x15'),_0xa74ea4,_[_0x9e71('0x18')](_0x48c5e5)?JSON[_0x9e71('0x16')](_0x48c5e5):_0x48c5e5);logger[_0x9e71('0xc')](_0x9e71('0xd'),_0xa74ea4);_0x2b7eef['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 e8e3045..d0eb43f 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 _0xcff7=['channelId=','&serviceId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','info','next','../../../../config/logger','routing','lodash','\x20-\x20','replace','includes','push','urlOnAnswer','?params=','urlOnRing','2.0','method','login','params','stringify','application/json-rpc','then','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x164a97,_0x2dd205){var _0x1ec236=function(_0x174fce){while(--_0x174fce){_0x164a97['push'](_0x164a97['shift']());}};_0x1ec236(++_0x2dd205);}(_0xcff7,0x1ef));var _0x7cff=function(_0x41230e,_0x257bb9){_0x41230e=_0x41230e-0x0;var _0x3d744c=_0xcff7[_0x41230e];return _0x3d744c;};'use strict';var rp=require('request-promise');var logger=require(_0x7cff('0x0'))(_0x7cff('0x1'));var _=require(_0x7cff('0x2'));var arr=[];exports['consequence']=function(_0xd306a3,_0x5a647d){return function(_0xf178af){var _0x22c684=_0x5a647d[0xa];var _0x2f5ea3=_0x5a647d[0xb];var _0x5c88fb=_0x5a647d[0xc];var _0x3b00a6=_0x5a647d[0xd];var _0x31a569=_0x5a647d[0xe];var _0x92aa81=_0x5a647d[0xf]['replace'](/\n/g,_0x7cff('0x3'));var _0x1356a7=_0x5a647d[0x10][_0x7cff('0x4')](/\n/g,'\x20');if(!arr[_0x7cff('0x5')](_0x2f5ea3)){arr[_0x7cff('0x6')](_0x2f5ea3);var _0x3fd256=_0x5a647d[0x3];var _0x377941=_0x5a647d[0x4];var _0x46c1f0=_0x5a647d[0x1];var _0x336d72=_0x5a647d[0x0];var _0x48db59={};_0x48db59[_0x7cff('0x7')]=_0x5a647d[0x8]+_0x7cff('0x8')+_0x5c88fb+'|'+_0x22c684+'|'+_0x3b00a6+'|'+_0x2f5ea3+'|'+_0x31a569;_0x48db59[_0x7cff('0x9')]=_0x5a647d[0x7]+_0x7cff('0x8')+_0x5c88fb+'|'+_0x22c684+'|'+_0x3b00a6+'|'+_0x2f5ea3+'|'+_0x31a569+'|'+_0x92aa81+'|'+_0x1356a7;_0x48db59['title']=_0x5a647d[0x9];var _0x3ea617={};_0x3ea617['jsonrpc']=_0x7cff('0xa');_0x3ea617[_0x7cff('0xb')]=_0x7cff('0xc');var _0x3e66e0=[];_0x3e66e0[_0x7cff('0x6')](_0x5a647d[0x2]);_0x3e66e0[_0x7cff('0x6')](_0x5a647d[0x5]);_0x3e66e0[_0x7cff('0x6')](_0x5a647d[0x6]);_0x3ea617[_0x7cff('0xd')]=_0x3e66e0;_0x3ea617['id']=0x1;var _0x4722b2=JSON[_0x7cff('0xe')](_0x3ea617);var _0x53caee={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x3fd256,'headers':{'Content-Type':_0x7cff('0xf')},'body':_0x4722b2};return rp(_0x53caee)[_0x7cff('0x10')](function(_0x56f02c){const _0x24fb27=JSON['parse'](_0x56f02c);if(!_0x24fb27['result']['logged']){throw new Error(_0x7cff('0x11'));}var _0xe3f34d=_0x2f5ea3;var _0x1dc405=_0x7cff('0x12')+_0x46c1f0+_0x7cff('0x13')+_0x336d72+'&sessionId='+_0xe3f34d+_0x7cff('0x14')+JSON['stringify'](_0x48db59);var _0x1bba48=_0x377941+'?'+_0x1dc405;return rp(_0x1bba48);})[_0x7cff('0x10')](function(_0x219619){logger['info'](_0x7cff('0x15'),_0xd306a3,_0x219619);_0xf178af[_0x7cff('0x16')]();})[_0x7cff('0x17')](function(_0x2a3afb){logger['error'](_0x7cff('0x18'),_0xd306a3,_['isObject'](_0x2a3afb)?JSON[_0x7cff('0xe')](_0x2a3afb):_0x2a3afb);_0xf178af[_0x7cff('0x16')]();});}else{logger[_0x7cff('0x19')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xd306a3);_0xf178af[_0x7cff('0x1a')]();}};}; \ No newline at end of file +var _0xeb34=['&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','replace','\x20-\x20','includes','push','urlOnRing','?params=','title','2.0','method','login','stringify','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId='];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xeb34,0xbd));var _0x4eb3=function(_0x379799,_0x4ccf16){_0x379799=_0x379799-0x0;var _0x46e431=_0xeb34[_0x379799];return _0x46e431;};'use strict';var rp=require(_0x4eb3('0x0'));var logger=require('../../../../config/logger')('routing');var _=require('lodash');var arr=[];exports['consequence']=function(_0x37baf4,_0xba8d5d){return function(_0x3a62bf){var _0x319775=_0xba8d5d[0xa];var _0x426e56=_0xba8d5d[0xb];var _0xd731b1=_0xba8d5d[0xc];var _0x4a9acb=_0xba8d5d[0xd];var _0x52777f=_0xba8d5d[0xe];var _0x5b31e8=_0xba8d5d[0xf][_0x4eb3('0x1')](/\n/g,_0x4eb3('0x2'));var _0x3766e5=_0xba8d5d[0x10][_0x4eb3('0x1')](/\n/g,'\x20');if(!arr[_0x4eb3('0x3')](_0x426e56)){arr[_0x4eb3('0x4')](_0x426e56);var _0x5017f8=_0xba8d5d[0x3];var _0x3cc1b6=_0xba8d5d[0x4];var _0x5baa10=_0xba8d5d[0x1];var _0x3926ee=_0xba8d5d[0x0];var _0x2e2cd7={};_0x2e2cd7['urlOnAnswer']=_0xba8d5d[0x8]+'?params='+_0xd731b1+'|'+_0x319775+'|'+_0x4a9acb+'|'+_0x426e56+'|'+_0x52777f;_0x2e2cd7[_0x4eb3('0x5')]=_0xba8d5d[0x7]+_0x4eb3('0x6')+_0xd731b1+'|'+_0x319775+'|'+_0x4a9acb+'|'+_0x426e56+'|'+_0x52777f+'|'+_0x5b31e8+'|'+_0x3766e5;_0x2e2cd7[_0x4eb3('0x7')]=_0xba8d5d[0x9];var _0x31a393={};_0x31a393['jsonrpc']=_0x4eb3('0x8');_0x31a393[_0x4eb3('0x9')]=_0x4eb3('0xa');var _0x530691=[];_0x530691[_0x4eb3('0x4')](_0xba8d5d[0x2]);_0x530691[_0x4eb3('0x4')](_0xba8d5d[0x5]);_0x530691[_0x4eb3('0x4')](_0xba8d5d[0x6]);_0x31a393['params']=_0x530691;_0x31a393['id']=0x1;var _0x27baeb=JSON[_0x4eb3('0xb')](_0x31a393);var _0x310085={'encoding':_0x4eb3('0xc'),'method':'POST','timeout':0x2710,'url':_0x5017f8,'headers':{'Content-Type':_0x4eb3('0xd')},'body':_0x27baeb};return rp(_0x310085)[_0x4eb3('0xe')](function(_0x279e3b){const _0x598201=JSON[_0x4eb3('0xf')](_0x279e3b);if(!_0x598201[_0x4eb3('0x10')][_0x4eb3('0x11')]){throw new Error(_0x4eb3('0x12'));}var _0x364455=_0x426e56;var _0x2cf6dd=_0x4eb3('0x13')+_0x5baa10+_0x4eb3('0x14')+_0x3926ee+'&sessionId='+_0x364455+_0x4eb3('0x15')+JSON[_0x4eb3('0xb')](_0x2e2cd7);var _0x513404=_0x3cc1b6+'?'+_0x2cf6dd;return rp(_0x513404);})[_0x4eb3('0xe')](function(_0x45f4a9){logger['info'](_0x4eb3('0x16'),_0x37baf4,_0x45f4a9);_0x3a62bf[_0x4eb3('0x17')]();})[_0x4eb3('0x18')](function(_0x3edeb0){logger[_0x4eb3('0x19')]('[%s][TVOX]\x20%s',_0x37baf4,_[_0x4eb3('0x1a')](_0x3edeb0)?JSON[_0x4eb3('0xb')](_0x3edeb0):_0x3edeb0);_0x3a62bf[_0x4eb3('0x17')]();});}else{logger[_0x4eb3('0x1b')](_0x4eb3('0x1c'),_0x37baf4);_0x3a62bf[_0x4eb3('0x1d')]();}};}; \ 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 0b60372..64f960b 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3e7954,_0x39781a){var _0x18328b=function(_0x19bee4){while(--_0x19bee4){_0x3e7954['push'](_0x3e7954['shift']());}};_0x18328b(++_0x39781a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4f4222,_0xf8c8a5){var _0x3e3c6c=function(_0x529278){while(--_0x529278){_0x4f4222['push'](_0x4f4222['shift']());}};_0x3e3c6c(++_0xf8c8a5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index bec5970..2a97d0f 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 _0x524a=['stack','routing\x20is\x20empty','agent','agents','busy','emit','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','name','mailQueues','available','loggedIn','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','./applications/utils','../../../config/environment','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','body','%s:%s:%s','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','stringify','matchPath','complete','No\x20applications\x20to\x20execute'];(function(_0xc96b,_0x397fe1){var _0x570b5c=function(_0x529710){while(--_0x529710){_0xc96b['push'](_0xc96b['shift']());}};_0x570b5c(++_0x397fe1);}(_0x524a,0xf5));var _0xa524=function(_0x1ed450,_0x3485be){_0x1ed450=_0x1ed450-0x0;var _0x51b186=_0x524a[_0x1ed450];return _0x51b186;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var fs=require('fs');var jayson=require(_0xa524('0x3'));var BPromise=require('bluebird');var uuid=require(_0xa524('0x4'));var utils=require(_0xa524('0x5'));var config=require(_0xa524('0x6'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xa524('0x7')),'mailQueueReport':require(_0xa524('0x8')),'chatQueueReport':require(_0xa524('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xa524('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xa524('0xb'));function getId(_0x11aa98,_0x56849e,_0x1316b0){return util[_0xa524('0xc')](_0xa524('0xd'),_0x11aa98,_0x56849e||0x0,_0x1316b0||0x0);}function getIntervals(_0x13076e,_0x3b484b){var _0x4c467d=[];if(!_[_0xa524('0xe')](_0x3b484b[_0xa524('0xf')])&&!_['isNil'](_0x13076e[_0x3b484b['IntervalId']])&&!_[_0xa524('0xe')](_0x13076e[_0x3b484b[_0xa524('0xf')]][_0xa524('0x10')])){_0x4c467d=_['map'](_0x13076e[_0x3b484b['IntervalId']][_0xa524('0x10')],'interval');}else if(!_[_0xa524('0xe')](_0x3b484b['interval'])){_0x4c467d=[_0x3b484b[_0xa524('0x11')]];}return _0x4c467d;}exports['listen']=function(_0x75bfe8){_0x75bfe8[_0xa524('0x12')]={};return new BPromise(function(_0x59620d,_0x2d8bdb){var _0x15b14c={'Start':function(_0xe85361){var _0x1de01e=this;return new Promise(function(_0x45347f,_0x433c8a){if(_0xe85361){try{var _0x371385=[];var _0x4fc42f=getId(_0xe85361[_0xa524('0x13')],_0xe85361[_0xa524('0x14')]?_0xe85361[_0xa524('0x14')]['id']:0x0,_0xe85361[_0xa524('0x15')]?_0xe85361[_0xa524('0x15')]['id']:0x0);if(_0xe85361[_0xa524('0x16')]&&_[_0xa524('0x17')](_0xe85361[_0xa524('0x16')])&&_0xe85361['applications'][_0xa524('0x18')]){for(var _0x20f8e1=0x0;_0x20f8e1<_0xe85361[_0xa524('0x16')][_0xa524('0x18')];_0x20f8e1+=0x1){var _0x5f4cd1=_0xe85361['applications'][_0x20f8e1];if(fs[_0xa524('0x19')](path[_0xa524('0x1a')](__dirname,_0xa524('0x16'),_0x5f4cd1[_0xa524('0x1b')]+_0xa524('0x1c')))){var _0x3866e2=[];switch(_0x5f4cd1['app'][_0xa524('0x1d')]()){case _0xa524('0x1e'):var _0x1992f0=_0x5f4cd1[_0xa524('0x1f')][_0xa524('0x20')](',');if(_0xe85361[_0xa524('0x13')]===_0xa524('0x21')){_0x3866e2['push'](_0x1992f0[0x0]);_0x3866e2[_0xa524('0x22')](_0x1992f0[0x1]);_0x3866e2[_0xa524('0x22')](_0x1992f0['slice'](0x2,_0x1992f0['length'])[_0xa524('0x1a')](','));}else{_0x3866e2[_0xa524('0x22')](_0x1992f0[0x0]);_0x3866e2[_0xa524('0x22')](_0x1992f0[_0xa524('0x23')](0x1,_0x1992f0[_0xa524('0x18')])['join'](','));}break;case'dialogflow':var _0x1aeabc=_0x5f4cd1[_0xa524('0x1f')][_0xa524('0x20')](',');_0x3866e2[_0xa524('0x22')](_0x1aeabc[0x0]);_0x3866e2['push'](_0x1aeabc[0x1]);_0x3866e2[_0xa524('0x22')](_0x1aeabc[_0xa524('0x23')](0x2,_0x1aeabc['length'])[_0xa524('0x1a')](','));break;case _0xa524('0x24'):var _0x4c587b=_0x5f4cd1[_0xa524('0x1f')]['split'](',');_0x3866e2[_0xa524('0x22')](_0x4c587b[0x0]);_0x3866e2[_0xa524('0x22')](_0x4c587b[0x1]);_0x3866e2[_0xa524('0x22')](_0x4c587b[0x2]);_0x3866e2[_0xa524('0x22')](_0x4c587b[0x3]);_0x3866e2[_0xa524('0x22')](_0x4c587b[_0xa524('0x23')](0x4,_0x4c587b[_0xa524('0x18')])[_0xa524('0x1a')](','));break;case _0xa524('0x25'):var _0x5b6a54=_0x5f4cd1['appdata'][_0xa524('0x20')](',');_0x3866e2['push'](_0x5b6a54[0x0]);_0x3866e2['push'](_0x5b6a54[0x1]);_0x3866e2[_0xa524('0x22')](_0x5b6a54[0x2]);_0x3866e2[_0xa524('0x22')](_0x5b6a54[0x3]);_0x3866e2[_0xa524('0x22')](_0x5b6a54[_0xa524('0x23')](0x4,_0x5b6a54['length'])['join'](','));break;case _0xa524('0x14'):_0x3866e2['push'](_0x5f4cd1['appdata']);break;case _0xa524('0x26'):_0x3866e2[_0xa524('0x22')](_0x5f4cd1[_0xa524('0x27')]);_0x3866e2[_0xa524('0x22')](_0x5f4cd1[_0xa524('0x1f')]);break;case _0xa524('0x28'):var _0x9bb038=utils[_0xa524('0x29')](_0xe85361[_0xa524('0x2a')][_0xa524('0x2b')],_0xe85361);var _0xc7b408=_0x5f4cd1[_0xa524('0x1f')]['split'](',');_0x3866e2['push'](_0xc7b408[0x0]);_0x3866e2['push'](_0xc7b408[0x1]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0x2]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0x3]);_0x3866e2['push'](_0xc7b408[0x4]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0x5]);_0x3866e2['push'](_0xc7b408[0x6]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0x7]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0x8]);_0x3866e2['push'](_0xc7b408[0x9]);_0x3866e2[_0xa524('0x22')](_0xc7b408[0xa]);_0x3866e2[_0xa524('0x22')](_0xe85361[_0xa524('0x15')]['id']);_0x3866e2['push'](_0xe85361[_0xa524('0x14')]['id']);_0x3866e2[_0xa524('0x22')](_0x5f4cd1['ChatWebsiteId']);_0x3866e2[_0xa524('0x22')](_0xe85361[_0xa524('0x15')]['ContactId']);_0x3866e2[_0xa524('0x22')](_0xe85361[_0xa524('0x2c')]['body']);_0x3866e2[_0xa524('0x22')](_0x9bb038);break;default:_0x3866e2=_[_0xa524('0xe')](_0x5f4cd1[_0xa524('0x1f')])?[]:_0x5f4cd1[_0xa524('0x1f')][_0xa524('0x20')](',');}var _0x38f87a={'id':util[_0xa524('0xc')](_0xa524('0x2d'),_0x4fc42f,_0x5f4cd1['id'],_0x5f4cd1[_0xa524('0x1b')]),'condition':require(_0xa524('0x2e'))[_0xa524('0x2f')](_0x4fc42f,getIntervals(_0x75bfe8['intervals'],_0x5f4cd1),_0x75bfe8),'consequence':require(_0xa524('0x30')+_0x5f4cd1['app'])[_0xa524('0x31')](_0x4fc42f,_0x3866e2,_0x75bfe8,_0xe85361),'p':_0x5f4cd1[_0xa524('0x32')]||0x0};logger[_0xa524('0x33')](_0xa524('0x34'),_0x38f87a['id'],_0xa524('0x35'),getIntervals(_0x75bfe8[_0xa524('0x36')],_0x5f4cd1)[_0xa524('0x1a')](_0xa524('0x37')));_0x371385[_0xa524('0x22')](_0x38f87a);}else{logger[_0xa524('0x38')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xa524('0x1a')](__dirname,_0xa524('0x16'),_0x5f4cd1['app']+_0xa524('0x1c')));}}_0x75bfe8[_0xa524('0x12')][_0x4fc42f]=new RuleEngine(_0x371385);_0x75bfe8['rules'][_0x4fc42f]['execute'](_0xe85361,function(_0x4dff4b){logger['info']('Applications\x20executed',JSON[_0xa524('0x39')](_0x4dff4b[_0xa524('0x3a')]));if(_0x75bfe8[_0xa524('0x12')][_0x4fc42f]){_0x75bfe8[_0xa524('0x12')][_0x4fc42f]['emit'](_0xa524('0x3b'));}});return _0x45347f({'code':0xc8,'message':_0xe85361});}else{logger[_0xa524('0x33')](_0xa524('0x3c'));return _0x45347f({'code':0xc8,'message':_0xe85361});}}catch(_0x357fce){logger['error'](_0x357fce[_0xa524('0x3d')]);return _0x433c8a(_0x1de01e[_0xa524('0x38')](0x1f4,_0x357fce));}}return _0x433c8a(_0xa524('0x3e'));});},'AcceptMessage':function(_0x44ed59){var _0x239c77=this;return new Promise(function(_0x4b5eed,_0x3cb983){if(_0x44ed59[_0xa524('0x3f')]&&_0x44ed59[_0xa524('0x3f')]['id']){if(_0x75bfe8[_0xa524('0x40')][_0x44ed59[_0xa524('0x3f')]['id']]){_0x75bfe8[_0xa524('0x40')][_0x44ed59[_0xa524('0x3f')]['id']][_0xa524('0x41')]=![];_0x75bfe8[_0xa524('0x40')][_0x44ed59['agent']['id']]['busyQueue']=undefined;}}if(_0x44ed59[_0xa524('0x14')]&&_0x44ed59[_0xa524('0x14')]['id']){try{var _0x368356=getId(_0x44ed59[_0xa524('0x13')],_0x44ed59[_0xa524('0x14')]?_0x44ed59[_0xa524('0x14')]['id']:0x0,_0x44ed59['interaction']?_0x44ed59[_0xa524('0x15')]['id']:0x0);if(_0x75bfe8[_0xa524('0x12')][_0x368356]){_0x75bfe8[_0xa524('0x12')][_0x368356][_0xa524('0x42')](_0xa524('0x43'));if(rpc[_0x44ed59[_0xa524('0x13')]+'QueueReport']){rpc[_0x44ed59[_0xa524('0x13')]+_0xa524('0x44')][_0xa524('0x45')](_0x368356,{'UserId':_0x44ed59[_0xa524('0x14')][_0xa524('0x46')]})[_0xa524('0x47')](function(_0xef18b7){logger[_0xa524('0x38')](_0xa524('0x48'));});}}return _0x4b5eed({'code':0xc8,'message':_0x44ed59});}catch(_0x217314){logger[_0xa524('0x38')](_0x217314[_0xa524('0x3d')]);return _0x3cb983(_0x239c77[_0xa524('0x38')](0x1f4,_0x217314));}}logger[_0xa524('0x38')](_0xa524('0x49'));return _0x3cb983(_0x239c77['error'](0x1f4,_0xa524('0x49')));});},'RejectMessage':function(_0x3a6000){var _0x4eeab2=this;return new Promise(function(_0x4d4115,_0x32844c){if(_0x3a6000[_0xa524('0x3f')]&&_0x3a6000[_0xa524('0x3f')]['id']){try{if(_0x75bfe8[_0xa524('0x40')][_0x3a6000[_0xa524('0x3f')]['id']]){_0x75bfe8[_0xa524('0x40')][_0x3a6000[_0xa524('0x3f')]['id']]['busy']=![];_0x75bfe8[_0xa524('0x40')][_0x3a6000[_0xa524('0x3f')]['id']][_0xa524('0x4a')]=undefined;}return _0x4d4115({'code':0xc8,'message':_0x3a6000});}catch(_0x19525f){logger[_0xa524('0x38')](_0x19525f['stack']);return _0x32844c(_0x4eeab2[_0xa524('0x38')](0x1f4,_0x19525f));}}logger['error'](_0xa524('0x49'));return _0x32844c(_0x4eeab2[_0xa524('0x38')](0x1f4,_0xa524('0x49')));});},'AbandonInteraction':function(_0x3f5694){var _0x161393=this;return new Promise(function(_0x12ef0c,_0x11be58){if(_0x3f5694['channel']&&_0x3f5694['interaction']&&_0x3f5694[_0xa524('0x15')]['id']){try{var _0x17b33d=getId(_0x3f5694[_0xa524('0x13')],_0x3f5694['message']?_0x3f5694[_0xa524('0x14')]['id']:0x0,_0x3f5694[_0xa524('0x15')]?_0x3f5694['interaction']['id']:0x0);if(_0x75bfe8[_0xa524('0x12')][_0x17b33d]){_0x75bfe8[_0xa524('0x12')][_0x17b33d][_0xa524('0x42')](_0xa524('0x43'));}return _0x12ef0c({'code':0xc8,'message':_0x3f5694});}catch(_0x6aad5c){logger[_0xa524('0x38')](_0x6aad5c[_0xa524('0x3d')]);return _0x11be58(_0x161393['error'](0x1f4,_0x6aad5c));}}logger[_0xa524('0x38')](_0xa524('0x49'));return _0x11be58(_0x161393[_0xa524('0x38')](0x1f4,_0xa524('0x49')));});},'AgentCapacity':function(_0x5f2de3){var _0x4fdca0=this;return new Promise(function(_0x25e68f,_0x5cd707){if(_0x75bfe8[_0xa524('0x40')][_0xa524('0x4b')](_0x5f2de3['id'])){for(var _0x361a55 in _0x5f2de3[_0xa524('0x4c')]){if(_0x5f2de3['capacity']['hasOwnProperty'](_0x361a55)){if(_0x75bfe8[_0xa524('0x40')][_0x5f2de3['id']]['hasOwnProperty'](_0x361a55+'CurrentCapacity')){_0x75bfe8['agents'][_0x5f2de3['id']][_0x361a55+_0xa524('0x4d')]=parseInt(_0x5f2de3['capacity'][_0x361a55],0xa);}}}_0x75bfe8['agents'][_0x5f2de3['id']][_0xa524('0x4e')]();return _0x25e68f({'code':0xc8,'message':_0x75bfe8[_0xa524('0x40')][_0x5f2de3['id']]});}else{return _0x5cd707(_0x4fdca0[_0xa524('0x38')](0x1f4,_0xa524('0x4f')));}});},'Agents':function(_0x59191f){return new Promise(function(_0x16384d,_0x2878e5){var _0x23b253=_['values'](_0x75bfe8[_0xa524('0x40')]);_0x16384d({'count':_0x23b253[_0xa524('0x18')],'rows':_0x23b253});});},'ChatQueues':function(_0x5da1de){return new Promise(function(_0x578dd0,_0x3e710f){var _0x3e8167=[];for(var _0x158e1c in _0x75bfe8[_0xa524('0x50')]){if(_0x75bfe8['chatQueues']['hasOwnProperty'](_0x158e1c)){var _0x300bb7=_0x75bfe8[_0xa524('0x50')][_0x158e1c];var _0x1e6a0a={'id':_0x300bb7['id'],'available':_0x300bb7['available'],'loggedIn':_0x300bb7['loggedIn'],'name':_0x300bb7[_0xa524('0x51')],'paused':_0x300bb7['paused'],'waiting':_0x300bb7['waiting']};_0x3e8167['push'](_0x1e6a0a);}}_0x578dd0({'count':_0x3e8167['length'],'rows':_0x3e8167});});},'MailQueues':function(_0x443b4a){return new Promise(function(_0x385d22,_0x5a5ce4){var _0x4ab4bc=[];for(var _0x3c9028 in _0x75bfe8[_0xa524('0x52')]){if(_0x75bfe8['mailQueues'][_0xa524('0x4b')](_0x3c9028)){var _0x1bd372=_0x75bfe8[_0xa524('0x52')][_0x3c9028];var _0x396a4a={'id':_0x1bd372['id'],'available':_0x1bd372[_0xa524('0x53')],'loggedIn':_0x1bd372[_0xa524('0x54')],'name':_0x1bd372[_0xa524('0x51')],'paused':_0x1bd372[_0xa524('0x55')],'waiting':_0x1bd372[_0xa524('0x56')]};_0x4ab4bc[_0xa524('0x22')](_0x396a4a);}}_0x385d22({'count':_0x4ab4bc['length'],'rows':_0x4ab4bc});});},'OpenchannelQueues':function(_0x2695e0){return new Promise(function(_0x122cdb,_0xdd4ace){var _0x1f6f53=[];for(var _0x241b41 in _0x75bfe8[_0xa524('0x57')]){if(_0x75bfe8['openchannelQueues']['hasOwnProperty'](_0x241b41)){var _0x1e25e7=_0x75bfe8['openchannelQueues'][_0x241b41];var _0x3e1714={'id':_0x1e25e7['id'],'available':_0x1e25e7[_0xa524('0x53')],'loggedIn':_0x1e25e7[_0xa524('0x54')],'name':_0x1e25e7[_0xa524('0x51')],'paused':_0x1e25e7[_0xa524('0x55')],'waiting':_0x1e25e7[_0xa524('0x56')]};_0x1f6f53[_0xa524('0x22')](_0x3e1714);}}_0x122cdb({'count':_0x1f6f53[_0xa524('0x18')],'rows':_0x1f6f53});});},'SmsQueues':function(_0x36d10e){return new Promise(function(_0x106168,_0xa23fd3){var _0x4c9be4=[];for(var _0x319119 in _0x75bfe8[_0xa524('0x58')]){if(_0x75bfe8[_0xa524('0x58')][_0xa524('0x4b')](_0x319119)){var _0xefd8fc=_0x75bfe8[_0xa524('0x58')][_0x319119];var _0x54d86b={'id':_0xefd8fc['id'],'available':_0xefd8fc[_0xa524('0x53')],'loggedIn':_0xefd8fc[_0xa524('0x54')],'name':_0xefd8fc[_0xa524('0x51')],'paused':_0xefd8fc['paused'],'waiting':_0xefd8fc['waiting']};_0x4c9be4[_0xa524('0x22')](_0x54d86b);}}_0x106168({'count':_0x4c9be4[_0xa524('0x18')],'rows':_0x4c9be4});});},'FaxQueues':function(_0x162254){return new Promise(function(_0x1a8887,_0x25d559){var _0xf934dc=[];for(var _0x780cf7 in _0x75bfe8[_0xa524('0x59')]){if(_0x75bfe8[_0xa524('0x59')]['hasOwnProperty'](_0x780cf7)){var _0x1b9563=_0x75bfe8[_0xa524('0x59')][_0x780cf7];var _0x5100f9={'id':_0x1b9563['id'],'available':_0x1b9563[_0xa524('0x53')],'loggedIn':_0x1b9563[_0xa524('0x54')],'name':_0x1b9563[_0xa524('0x51')],'paused':_0x1b9563[_0xa524('0x55')],'waiting':_0x1b9563[_0xa524('0x56')]};_0xf934dc[_0xa524('0x22')](_0x5100f9);}}_0x1a8887({'count':_0xf934dc['length'],'rows':_0xf934dc});});},'WhatsappQueues':function(_0x5238a8){return new Promise(function(_0x532b0f,_0x43cf85){var _0x59d186=[];for(var _0x4d0911 in _0x75bfe8[_0xa524('0x5a')]){if(_0x75bfe8[_0xa524('0x5a')][_0xa524('0x4b')](_0x4d0911)){var _0x19a7fb=_0x75bfe8[_0xa524('0x5a')][_0x4d0911];var _0x5598be={'id':_0x19a7fb['id'],'available':_0x19a7fb['available'],'loggedIn':_0x19a7fb[_0xa524('0x54')],'name':_0x19a7fb[_0xa524('0x51')],'paused':_0x19a7fb['paused'],'waiting':_0x19a7fb[_0xa524('0x56')]};_0x59d186['push'](_0x5598be);}}_0x532b0f({'count':_0x59d186[_0xa524('0x18')],'rows':_0x59d186});});},'ChatQueuesWaitingInteractions':function(_0x3c74a8){return new Promise(function(_0x551760,_0x3a850c){var _0x59f653=_['values'](_0x75bfe8[_0xa524('0x5b')]);_0x551760({'count':_0x59f653[_0xa524('0x18')],'rows':_0x59f653});});},'MailQueuesWaitingInteractions':function(_0x2c453e){return new Promise(function(_0x38e170,_0x2765ce){var _0x160c1b=_[_0xa524('0x5c')](_0x75bfe8[_0xa524('0x5d')]);_0x38e170({'count':_0x160c1b[_0xa524('0x18')],'rows':_0x160c1b});});},'OpenchannelQueuesWaitingInteractions':function(_0x47220d){return new Promise(function(_0x50d6d4,_0x38d878){var _0x13d0f3=_[_0xa524('0x5c')](_0x75bfe8[_0xa524('0x5e')]);_0x50d6d4({'count':_0x13d0f3[_0xa524('0x18')],'rows':_0x13d0f3});});},'SmsQueuesWaitingInteractions':function(_0x3a3b99){return new Promise(function(_0x12b834,_0x44eb67){var _0xae094d=_['values'](_0x75bfe8[_0xa524('0x5f')]);_0x12b834({'count':_0xae094d['length'],'rows':_0xae094d});});},'FaxQueuesWaitingInteractions':function(_0x2b244e){return new Promise(function(_0x45be9b,_0xc38823){var _0x52699a=_[_0xa524('0x5c')](_0x75bfe8['faxQueuesWaitingInteractions']);_0x45be9b({'count':_0x52699a['length'],'rows':_0x52699a});});},'WhatsappQueuesWaitingInteractions':function(_0x5c4356){return new Promise(function(_0x5b38e1,_0xc439e9){var _0x2c9fda=_[_0xa524('0x5c')](_0x75bfe8[_0xa524('0x60')]);_0x5b38e1({'count':_0x2c9fda[_0xa524('0x18')],'rows':_0x2c9fda});});}};var _0x15ec5b=jayson['server'](_0x15b14c)['http']();_0x15ec5b['on'](_0xa524('0x38'),function(_0x426371){logger[_0xa524('0x38')](JSON[_0xa524('0x39')](_0x426371));return _0x2d8bdb(_0x426371);});_0x15ec5b[_0xa524('0x61')](0x232c,_0xa524('0x62'),function(){console[_0xa524('0x63')](_0xa524('0x64'),0x232c);return _0x59620d(_0xa524('0x65')+0x232c);});});}; \ No newline at end of file +var _0xe0c0=['split','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','body','format','./interval','intervals','./applications/','consequence','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','.js','app','toLowerCase','autoreply','appdata'];(function(_0x1f029a,_0x567cff){var _0x3bc7e5=function(_0x48677e){while(--_0x48677e){_0x1f029a['push'](_0x1f029a['shift']());}};_0x3bc7e5(++_0x567cff);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x38bcc4,_0x1e15b9){_0x38bcc4=_0x38bcc4-0x0;var _0x493efd=_0xe0c0[_0x38bcc4];return _0x493efd;};'use strict';var _=require(_0x0e0c('0x0'));var util=require('util');var path=require(_0x0e0c('0x1'));var fs=require('fs');var jayson=require(_0x0e0c('0x2'));var BPromise=require(_0x0e0c('0x3'));var uuid=require(_0x0e0c('0x4'));var utils=require('./applications/utils');var config=require(_0x0e0c('0x5'));var logger=require(_0x0e0c('0x6'))(_0x0e0c('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x0e0c('0x8')),'chatQueueReport':require(_0x0e0c('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x0e0c('0xa')),'whatsappQueueReport':require(_0x0e0c('0xb'))};var RuleEngine=require(_0x0e0c('0xc'));function getId(_0x13e45d,_0xe3ccce,_0x512f83){return util['format']('%s.%s.%s',_0x13e45d,_0xe3ccce||0x0,_0x512f83||0x0);}function getIntervals(_0x2bd09c,_0x5b347b){var _0xb2aa1d=[];if(!_[_0x0e0c('0xd')](_0x5b347b[_0x0e0c('0xe')])&&!_[_0x0e0c('0xd')](_0x2bd09c[_0x5b347b[_0x0e0c('0xe')]])&&!_[_0x0e0c('0xd')](_0x2bd09c[_0x5b347b[_0x0e0c('0xe')]][_0x0e0c('0xf')])){_0xb2aa1d=_['map'](_0x2bd09c[_0x5b347b[_0x0e0c('0xe')]]['Intervals'],'interval');}else if(!_[_0x0e0c('0xd')](_0x5b347b[_0x0e0c('0x10')])){_0xb2aa1d=[_0x5b347b[_0x0e0c('0x10')]];}return _0xb2aa1d;}exports[_0x0e0c('0x11')]=function(_0x1b598b){_0x1b598b[_0x0e0c('0x12')]={};return new BPromise(function(_0x599def,_0x3fdc00){var _0x27cbcd={'Start':function(_0x3b6d65){var _0x4ebe33=this;return new Promise(function(_0x368ba0,_0x1d7545){if(_0x3b6d65){try{var _0x3a57f9=[];var _0x20f13d=getId(_0x3b6d65[_0x0e0c('0x13')],_0x3b6d65[_0x0e0c('0x14')]?_0x3b6d65[_0x0e0c('0x14')]['id']:0x0,_0x3b6d65[_0x0e0c('0x15')]?_0x3b6d65[_0x0e0c('0x15')]['id']:0x0);if(_0x3b6d65['applications']&&_[_0x0e0c('0x16')](_0x3b6d65['applications'])&&_0x3b6d65['applications']['length']){for(var _0x3743fb=0x0;_0x3743fb<_0x3b6d65[_0x0e0c('0x17')][_0x0e0c('0x18')];_0x3743fb+=0x1){var _0x41cee2=_0x3b6d65[_0x0e0c('0x17')][_0x3743fb];if(fs[_0x0e0c('0x19')](path['join'](__dirname,_0x0e0c('0x17'),_0x41cee2['app']+_0x0e0c('0x1a')))){var _0x4419e9=[];switch(_0x41cee2[_0x0e0c('0x1b')][_0x0e0c('0x1c')]()){case _0x0e0c('0x1d'):var _0x4ccf11=_0x41cee2[_0x0e0c('0x1e')][_0x0e0c('0x1f')](',');if(_0x3b6d65[_0x0e0c('0x13')]===_0x0e0c('0x20')){_0x4419e9[_0x0e0c('0x21')](_0x4ccf11[0x0]);_0x4419e9[_0x0e0c('0x21')](_0x4ccf11[0x1]);_0x4419e9[_0x0e0c('0x21')](_0x4ccf11[_0x0e0c('0x22')](0x2,_0x4ccf11[_0x0e0c('0x18')])[_0x0e0c('0x23')](','));}else{_0x4419e9['push'](_0x4ccf11[0x0]);_0x4419e9[_0x0e0c('0x21')](_0x4ccf11[_0x0e0c('0x22')](0x1,_0x4ccf11['length'])[_0x0e0c('0x23')](','));}break;case _0x0e0c('0x24'):var _0x581c6d=_0x41cee2[_0x0e0c('0x1e')][_0x0e0c('0x1f')](',');_0x4419e9[_0x0e0c('0x21')](_0x581c6d[0x0]);_0x4419e9[_0x0e0c('0x21')](_0x581c6d[0x1]);_0x4419e9[_0x0e0c('0x21')](_0x581c6d[_0x0e0c('0x22')](0x2,_0x581c6d[_0x0e0c('0x18')])[_0x0e0c('0x23')](','));break;case _0x0e0c('0x25'):var _0x433f56=_0x41cee2[_0x0e0c('0x1e')][_0x0e0c('0x1f')](',');_0x4419e9[_0x0e0c('0x21')](_0x433f56[0x0]);_0x4419e9[_0x0e0c('0x21')](_0x433f56[0x1]);_0x4419e9[_0x0e0c('0x21')](_0x433f56[0x2]);_0x4419e9[_0x0e0c('0x21')](_0x433f56[0x3]);_0x4419e9['push'](_0x433f56[_0x0e0c('0x22')](0x4,_0x433f56[_0x0e0c('0x18')])[_0x0e0c('0x23')](','));break;case _0x0e0c('0x26'):var _0x289fc6=_0x41cee2['appdata'][_0x0e0c('0x1f')](',');_0x4419e9['push'](_0x289fc6[0x0]);_0x4419e9[_0x0e0c('0x21')](_0x289fc6[0x1]);_0x4419e9[_0x0e0c('0x21')](_0x289fc6[0x2]);_0x4419e9['push'](_0x289fc6[0x3]);_0x4419e9['push'](_0x289fc6['slice'](0x4,_0x289fc6['length'])[_0x0e0c('0x23')](','));break;case _0x0e0c('0x14'):_0x4419e9[_0x0e0c('0x21')](_0x41cee2['appdata']);break;case'tag':_0x4419e9[_0x0e0c('0x21')](_0x41cee2[_0x0e0c('0x27')]);_0x4419e9['push'](_0x41cee2['appdata']);break;case _0x0e0c('0x28'):var _0x5d9e39=utils[_0x0e0c('0x29')](_0x3b6d65[_0x0e0c('0x2a')][_0x0e0c('0x2b')],_0x3b6d65);var _0x11e4e7=_0x41cee2[_0x0e0c('0x1e')][_0x0e0c('0x1f')](',');_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x0]);_0x4419e9['push'](_0x11e4e7[0x1]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x2]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x3]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x4]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x5]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x6]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x7]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x8]);_0x4419e9[_0x0e0c('0x21')](_0x11e4e7[0x9]);_0x4419e9['push'](_0x11e4e7[0xa]);_0x4419e9['push'](_0x3b6d65[_0x0e0c('0x15')]['id']);_0x4419e9[_0x0e0c('0x21')](_0x3b6d65[_0x0e0c('0x14')]['id']);_0x4419e9[_0x0e0c('0x21')](_0x41cee2['ChatWebsiteId']);_0x4419e9[_0x0e0c('0x21')](_0x3b6d65['interaction']['ContactId']);_0x4419e9[_0x0e0c('0x21')](_0x3b6d65[_0x0e0c('0x2c')][_0x0e0c('0x2c')]);_0x4419e9[_0x0e0c('0x21')](_0x5d9e39);break;default:_0x4419e9=_[_0x0e0c('0xd')](_0x41cee2[_0x0e0c('0x1e')])?[]:_0x41cee2[_0x0e0c('0x1e')][_0x0e0c('0x1f')](',');}var _0x169148={'id':util[_0x0e0c('0x2d')]('%s:%s:%s',_0x20f13d,_0x41cee2['id'],_0x41cee2[_0x0e0c('0x1b')]),'condition':require(_0x0e0c('0x2e'))['condition'](_0x20f13d,getIntervals(_0x1b598b[_0x0e0c('0x2f')],_0x41cee2),_0x1b598b),'consequence':require(_0x0e0c('0x30')+_0x41cee2[_0x0e0c('0x1b')])[_0x0e0c('0x31')](_0x20f13d,_0x4419e9,_0x1b598b,_0x3b6d65),'p':_0x41cee2[_0x0e0c('0x32')]||0x0};logger[_0x0e0c('0x33')]('Push\x20new\x20rule',_0x169148['id'],_0x0e0c('0x34'),getIntervals(_0x1b598b[_0x0e0c('0x2f')],_0x41cee2)[_0x0e0c('0x23')](_0x0e0c('0x35')));_0x3a57f9[_0x0e0c('0x21')](_0x169148);}else{logger[_0x0e0c('0x36')](_0x0e0c('0x37'),path['join'](__dirname,'applications',_0x41cee2[_0x0e0c('0x1b')]+'.js'));}}_0x1b598b['rules'][_0x20f13d]=new RuleEngine(_0x3a57f9);_0x1b598b['rules'][_0x20f13d][_0x0e0c('0x38')](_0x3b6d65,function(_0xa7f3cd){logger[_0x0e0c('0x33')](_0x0e0c('0x39'),JSON[_0x0e0c('0x3a')](_0xa7f3cd[_0x0e0c('0x3b')]));if(_0x1b598b[_0x0e0c('0x12')][_0x20f13d]){_0x1b598b[_0x0e0c('0x12')][_0x20f13d][_0x0e0c('0x3c')](_0x0e0c('0x3d'));}});return _0x368ba0({'code':0xc8,'message':_0x3b6d65});}else{logger[_0x0e0c('0x33')](_0x0e0c('0x3e'));return _0x368ba0({'code':0xc8,'message':_0x3b6d65});}}catch(_0x495c5f){logger[_0x0e0c('0x36')](_0x495c5f[_0x0e0c('0x3f')]);return _0x1d7545(_0x4ebe33[_0x0e0c('0x36')](0x1f4,_0x495c5f));}}return _0x1d7545(_0x0e0c('0x40'));});},'AcceptMessage':function(_0x5500f6){var _0x3b5db8=this;return new Promise(function(_0x111fdd,_0x2de942){if(_0x5500f6[_0x0e0c('0x41')]&&_0x5500f6[_0x0e0c('0x41')]['id']){if(_0x1b598b[_0x0e0c('0x42')][_0x5500f6[_0x0e0c('0x41')]['id']]){_0x1b598b[_0x0e0c('0x42')][_0x5500f6[_0x0e0c('0x41')]['id']]['busy']=![];_0x1b598b[_0x0e0c('0x42')][_0x5500f6[_0x0e0c('0x41')]['id']]['busyQueue']=undefined;}}if(_0x5500f6['message']&&_0x5500f6[_0x0e0c('0x14')]['id']){try{var _0x41c808=getId(_0x5500f6[_0x0e0c('0x13')],_0x5500f6['message']?_0x5500f6[_0x0e0c('0x14')]['id']:0x0,_0x5500f6[_0x0e0c('0x15')]?_0x5500f6[_0x0e0c('0x15')]['id']:0x0);if(_0x1b598b[_0x0e0c('0x12')][_0x41c808]){_0x1b598b['rules'][_0x41c808]['emit'](_0x0e0c('0x43'));if(rpc[_0x5500f6[_0x0e0c('0x13')]+_0x0e0c('0x44')]){rpc[_0x5500f6[_0x0e0c('0x13')]+_0x0e0c('0x44')]['update'](_0x41c808,{'UserId':_0x5500f6['message'][_0x0e0c('0x45')]})['catch'](function(_0xec745a){logger[_0x0e0c('0x36')](_0x0e0c('0x46'));});}}return _0x111fdd({'code':0xc8,'message':_0x5500f6});}catch(_0x41c7dc){logger['error'](_0x41c7dc[_0x0e0c('0x3f')]);return _0x2de942(_0x3b5db8['error'](0x1f4,_0x41c7dc));}}logger[_0x0e0c('0x36')](_0x0e0c('0x47'));return _0x2de942(_0x3b5db8[_0x0e0c('0x36')](0x1f4,_0x0e0c('0x47')));});},'RejectMessage':function(_0x21e747){var _0x1f1ea8=this;return new Promise(function(_0x5269af,_0x4faf89){if(_0x21e747[_0x0e0c('0x41')]&&_0x21e747[_0x0e0c('0x41')]['id']){try{if(_0x1b598b[_0x0e0c('0x42')][_0x21e747[_0x0e0c('0x41')]['id']]){_0x1b598b['agents'][_0x21e747[_0x0e0c('0x41')]['id']][_0x0e0c('0x48')]=![];_0x1b598b['agents'][_0x21e747['agent']['id']][_0x0e0c('0x49')]=undefined;}return _0x5269af({'code':0xc8,'message':_0x21e747});}catch(_0x166427){logger[_0x0e0c('0x36')](_0x166427['stack']);return _0x4faf89(_0x1f1ea8[_0x0e0c('0x36')](0x1f4,_0x166427));}}logger[_0x0e0c('0x36')](_0x0e0c('0x47'));return _0x4faf89(_0x1f1ea8[_0x0e0c('0x36')](0x1f4,_0x0e0c('0x47')));});},'AbandonInteraction':function(_0x27b54d){var _0x467880=this;return new Promise(function(_0x5c4113,_0x5c1078){if(_0x27b54d[_0x0e0c('0x13')]&&_0x27b54d[_0x0e0c('0x15')]&&_0x27b54d['interaction']['id']){try{var _0x48301d=getId(_0x27b54d[_0x0e0c('0x13')],_0x27b54d[_0x0e0c('0x14')]?_0x27b54d[_0x0e0c('0x14')]['id']:0x0,_0x27b54d['interaction']?_0x27b54d[_0x0e0c('0x15')]['id']:0x0);if(_0x1b598b[_0x0e0c('0x12')][_0x48301d]){_0x1b598b[_0x0e0c('0x12')][_0x48301d]['emit']('end');}return _0x5c4113({'code':0xc8,'message':_0x27b54d});}catch(_0xba21af){logger['error'](_0xba21af[_0x0e0c('0x3f')]);return _0x5c1078(_0x467880[_0x0e0c('0x36')](0x1f4,_0xba21af));}}logger[_0x0e0c('0x36')](_0x0e0c('0x47'));return _0x5c1078(_0x467880['error'](0x1f4,_0x0e0c('0x47')));});},'AgentCapacity':function(_0x43ad0b){var _0x88d611=this;return new Promise(function(_0x56df30,_0x34201a){if(_0x1b598b[_0x0e0c('0x42')][_0x0e0c('0x4a')](_0x43ad0b['id'])){for(var _0x3c3996 in _0x43ad0b[_0x0e0c('0x4b')]){if(_0x43ad0b[_0x0e0c('0x4b')]['hasOwnProperty'](_0x3c3996)){if(_0x1b598b[_0x0e0c('0x42')][_0x43ad0b['id']][_0x0e0c('0x4a')](_0x3c3996+'CurrentCapacity')){_0x1b598b[_0x0e0c('0x42')][_0x43ad0b['id']][_0x3c3996+_0x0e0c('0x4c')]=parseInt(_0x43ad0b[_0x0e0c('0x4b')][_0x3c3996],0xa);}}}_0x1b598b['agents'][_0x43ad0b['id']][_0x0e0c('0x4d')]();return _0x56df30({'code':0xc8,'message':_0x1b598b[_0x0e0c('0x42')][_0x43ad0b['id']]});}else{return _0x34201a(_0x88d611[_0x0e0c('0x36')](0x1f4,_0x0e0c('0x4e')));}});},'Agents':function(_0x4e6e94){return new Promise(function(_0xa90812,_0x55de80){var _0x1ae516=_[_0x0e0c('0x4f')](_0x1b598b[_0x0e0c('0x42')]);_0xa90812({'count':_0x1ae516[_0x0e0c('0x18')],'rows':_0x1ae516});});},'ChatQueues':function(_0x34cbc2){return new Promise(function(_0x3cb20e,_0x203805){var _0x18dee3=[];for(var _0x11e471 in _0x1b598b['chatQueues']){if(_0x1b598b[_0x0e0c('0x50')]['hasOwnProperty'](_0x11e471)){var _0xecdb10=_0x1b598b[_0x0e0c('0x50')][_0x11e471];var _0x564dd2={'id':_0xecdb10['id'],'available':_0xecdb10[_0x0e0c('0x51')],'loggedIn':_0xecdb10['loggedIn'],'name':_0xecdb10[_0x0e0c('0x52')],'paused':_0xecdb10[_0x0e0c('0x53')],'waiting':_0xecdb10[_0x0e0c('0x54')]};_0x18dee3[_0x0e0c('0x21')](_0x564dd2);}}_0x3cb20e({'count':_0x18dee3[_0x0e0c('0x18')],'rows':_0x18dee3});});},'MailQueues':function(_0x574e2e){return new Promise(function(_0x50abd5,_0x8d274b){var _0x3556e6=[];for(var _0x1a4ea0 in _0x1b598b[_0x0e0c('0x55')]){if(_0x1b598b['mailQueues'][_0x0e0c('0x4a')](_0x1a4ea0)){var _0x10b911=_0x1b598b[_0x0e0c('0x55')][_0x1a4ea0];var _0x46566f={'id':_0x10b911['id'],'available':_0x10b911[_0x0e0c('0x51')],'loggedIn':_0x10b911[_0x0e0c('0x56')],'name':_0x10b911['name'],'paused':_0x10b911[_0x0e0c('0x53')],'waiting':_0x10b911[_0x0e0c('0x54')]};_0x3556e6[_0x0e0c('0x21')](_0x46566f);}}_0x50abd5({'count':_0x3556e6[_0x0e0c('0x18')],'rows':_0x3556e6});});},'OpenchannelQueues':function(_0x374faf){return new Promise(function(_0x4af68c,_0xbcf3a0){var _0x87a992=[];for(var _0x4ecaad in _0x1b598b['openchannelQueues']){if(_0x1b598b[_0x0e0c('0x57')]['hasOwnProperty'](_0x4ecaad)){var _0x5919a7=_0x1b598b[_0x0e0c('0x57')][_0x4ecaad];var _0xc759e1={'id':_0x5919a7['id'],'available':_0x5919a7[_0x0e0c('0x51')],'loggedIn':_0x5919a7[_0x0e0c('0x56')],'name':_0x5919a7[_0x0e0c('0x52')],'paused':_0x5919a7['paused'],'waiting':_0x5919a7['waiting']};_0x87a992[_0x0e0c('0x21')](_0xc759e1);}}_0x4af68c({'count':_0x87a992[_0x0e0c('0x18')],'rows':_0x87a992});});},'SmsQueues':function(_0x46b2ca){return new Promise(function(_0x591294,_0x2edc0a){var _0xe51783=[];for(var _0x10e8b0 in _0x1b598b['smsQueues']){if(_0x1b598b[_0x0e0c('0x58')][_0x0e0c('0x4a')](_0x10e8b0)){var _0x36ca6b=_0x1b598b[_0x0e0c('0x58')][_0x10e8b0];var _0x13cb73={'id':_0x36ca6b['id'],'available':_0x36ca6b[_0x0e0c('0x51')],'loggedIn':_0x36ca6b[_0x0e0c('0x56')],'name':_0x36ca6b[_0x0e0c('0x52')],'paused':_0x36ca6b[_0x0e0c('0x53')],'waiting':_0x36ca6b[_0x0e0c('0x54')]};_0xe51783[_0x0e0c('0x21')](_0x13cb73);}}_0x591294({'count':_0xe51783[_0x0e0c('0x18')],'rows':_0xe51783});});},'FaxQueues':function(_0x5778af){return new Promise(function(_0x143889,_0x57f8f7){var _0x5eed90=[];for(var _0x3bb2bb in _0x1b598b['faxQueues']){if(_0x1b598b[_0x0e0c('0x59')][_0x0e0c('0x4a')](_0x3bb2bb)){var _0x564804=_0x1b598b['faxQueues'][_0x3bb2bb];var _0x50aee4={'id':_0x564804['id'],'available':_0x564804[_0x0e0c('0x51')],'loggedIn':_0x564804[_0x0e0c('0x56')],'name':_0x564804[_0x0e0c('0x52')],'paused':_0x564804[_0x0e0c('0x53')],'waiting':_0x564804['waiting']};_0x5eed90[_0x0e0c('0x21')](_0x50aee4);}}_0x143889({'count':_0x5eed90[_0x0e0c('0x18')],'rows':_0x5eed90});});},'WhatsappQueues':function(_0x3aedc2){return new Promise(function(_0x2a7d5d,_0x274117){var _0x3f8473=[];for(var _0x207b12 in _0x1b598b[_0x0e0c('0x5a')]){if(_0x1b598b[_0x0e0c('0x5a')]['hasOwnProperty'](_0x207b12)){var _0x22273f=_0x1b598b[_0x0e0c('0x5a')][_0x207b12];var _0x430230={'id':_0x22273f['id'],'available':_0x22273f['available'],'loggedIn':_0x22273f[_0x0e0c('0x56')],'name':_0x22273f[_0x0e0c('0x52')],'paused':_0x22273f[_0x0e0c('0x53')],'waiting':_0x22273f[_0x0e0c('0x54')]};_0x3f8473[_0x0e0c('0x21')](_0x430230);}}_0x2a7d5d({'count':_0x3f8473['length'],'rows':_0x3f8473});});},'ChatQueuesWaitingInteractions':function(_0x475759){return new Promise(function(_0x554cd9,_0x28ca85){var _0x1f3eba=_[_0x0e0c('0x4f')](_0x1b598b[_0x0e0c('0x5b')]);_0x554cd9({'count':_0x1f3eba[_0x0e0c('0x18')],'rows':_0x1f3eba});});},'MailQueuesWaitingInteractions':function(_0x2106c5){return new Promise(function(_0x383824,_0x47c0db){var _0x25a999=_['values'](_0x1b598b[_0x0e0c('0x5c')]);_0x383824({'count':_0x25a999[_0x0e0c('0x18')],'rows':_0x25a999});});},'OpenchannelQueuesWaitingInteractions':function(_0x30458c){return new Promise(function(_0x361035,_0x291c04){var _0x1622ef=_[_0x0e0c('0x4f')](_0x1b598b['openchannelQueuesWaitingInteractions']);_0x361035({'count':_0x1622ef[_0x0e0c('0x18')],'rows':_0x1622ef});});},'SmsQueuesWaitingInteractions':function(_0x2119a7){return new Promise(function(_0x186d82,_0x15b2c0){var _0xcbac68=_[_0x0e0c('0x4f')](_0x1b598b[_0x0e0c('0x5d')]);_0x186d82({'count':_0xcbac68[_0x0e0c('0x18')],'rows':_0xcbac68});});},'FaxQueuesWaitingInteractions':function(_0x417e10){return new Promise(function(_0x10ffc0,_0x25a55a){var _0x441c05=_['values'](_0x1b598b[_0x0e0c('0x5e')]);_0x10ffc0({'count':_0x441c05['length'],'rows':_0x441c05});});},'WhatsappQueuesWaitingInteractions':function(_0x333efd){return new Promise(function(_0x3e7a74,_0x34d05b){var _0x44f353=_['values'](_0x1b598b[_0x0e0c('0x5f')]);_0x3e7a74({'count':_0x44f353[_0x0e0c('0x18')],'rows':_0x44f353});});}};var _0x234f0a=jayson['server'](_0x27cbcd)['http']();_0x234f0a['on'](_0x0e0c('0x36'),function(_0x36076e){logger[_0x0e0c('0x36')](JSON[_0x0e0c('0x3a')](_0x36076e));return _0x3fdc00(_0x36076e);});_0x234f0a[_0x0e0c('0x11')](0x232c,_0x0e0c('0x60'),function(){console[_0x0e0c('0x61')](_0x0e0c('0x62'),0x232c);return _0x599def('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index fef1d97..307780e 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 _0x09dd=['http','request','then','message','result','rules','info','length','push','Command','format','indexOf','true','catch','error','[%s][INTERVAL]\x20%s','all','some','join','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','stop','util','bluebird','lodash','../../../config/logger','routing','client'];(function(_0xfb8129,_0x4412a0){var _0x4e959d=function(_0x18f03a){while(--_0x18f03a){_0xfb8129['push'](_0xfb8129['shift']());}};_0x4e959d(++_0x4412a0);}(_0x09dd,0x144));var _0xd09d=function(_0x2254a0,_0x41f33e){_0x2254a0=_0x2254a0-0x0;var _0x35cd31=_0x09dd[_0x2254a0];return _0x35cd31;};'use strict';var util=require(_0xd09d('0x0'));var BPromise=require(_0xd09d('0x1'));var jayson=require('jayson/promise');var _=require(_0xd09d('0x2'));var logger=require(_0xd09d('0x3'))(_0xd09d('0x4'));var client=jayson[_0xd09d('0x5')][_0xd09d('0x6')]({'port':0x232a});function request(_0x5ceea8,_0x1f4fc8){return new BPromise(function(_0xa0540f,_0x1de087){return client[_0xd09d('0x7')](_0x5ceea8,_0x1f4fc8)[_0xd09d('0x8')](function(_0x29a0d7){if(_0x29a0d7['error']){return _0x1de087(_0x29a0d7['error'][_0xd09d('0x9')]);}else{return _0xa0540f(_0x29a0d7[_0xd09d('0xa')]);}})['catch'](function(_0xcc5914){return _0x1de087(_0xcc5914);});});}exports['condition']=function(_0x513be7,_0x328240,_0xa59126){return function(_0x58e42e){if(_0xa59126[_0xd09d('0xb')]&&!_0xa59126[_0xd09d('0xb')][_0x513be7]){logger[_0xd09d('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x513be7);return _0x58e42e['stop']();}var _0x3a9fe2=[];for(var _0x408f82=0x0;_0x408f82<_0x328240[_0xd09d('0xd')];_0x408f82+=0x1){_0x3a9fe2[_0xd09d('0xe')](request(_0xd09d('0xf'),{'command':util[_0xd09d('0x10')]('iftime\x20%s',_0x328240[_0x408f82])})[_0xd09d('0x8')](function(_0x4d4769){return _0x4d4769&&_0x4d4769[_0xd09d('0x9')]&&_0x4d4769[_0xd09d('0x9')][_0xd09d('0x11')](_0xd09d('0x12'))>=0x0?!![]:![];})[_0xd09d('0x13')](function(_0x92d598){logger[_0xd09d('0x14')](_0xd09d('0x15'),_0x513be7,_0x328240[_0x408f82]);}));}BPromise[_0xd09d('0x16')](_0x3a9fe2)['then'](function(_0x333405){var _0x4b70ed=_[_0xd09d('0x17')](_0x333405);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x513be7,_0x328240[_0xd09d('0x18')]('\x20|\x20'),_0x4b70ed);_0x58e42e['when'](_0x4b70ed);})['catch'](function(_0x255f33){console[_0xd09d('0x19')](_0x255f33);logger[_0xd09d('0x14')](_0xd09d('0x1a'),_0x513be7,_0x328240[_0xd09d('0x18')](_0xd09d('0x1b')),_0x255f33[_0xd09d('0x1c')]);_0x58e42e[_0xd09d('0x1d')]();});};}; \ No newline at end of file +var _0x72ae=['stop','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','jayson/promise','lodash','../../../config/logger','client','http','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x53807d,_0x4a90a8){var _0x501207=function(_0xea7078){while(--_0xea7078){_0x53807d['push'](_0x53807d['shift']());}};_0x501207(++_0x4a90a8);}(_0x72ae,0x1a3));var _0xe72a=function(_0x139a48,_0x4e568d){_0x139a48=_0x139a48-0x0;var _0x4c9eec=_0x72ae[_0x139a48];return _0x4c9eec;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xe72a('0x0'));var _=require(_0xe72a('0x1'));var logger=require(_0xe72a('0x2'))('routing');var client=jayson[_0xe72a('0x3')][_0xe72a('0x4')]({'port':0x232a});function request(_0x532bdf,_0x371a6e){return new BPromise(function(_0x4764ca,_0x340b6a){return client['request'](_0x532bdf,_0x371a6e)[_0xe72a('0x5')](function(_0x41c5da){if(_0x41c5da['error']){return _0x340b6a(_0x41c5da[_0xe72a('0x6')][_0xe72a('0x7')]);}else{return _0x4764ca(_0x41c5da[_0xe72a('0x8')]);}})[_0xe72a('0x9')](function(_0x13fbeb){return _0x340b6a(_0x13fbeb);});});}exports[_0xe72a('0xa')]=function(_0x596ccf,_0x5c59d2,_0x44204c){return function(_0x4ad080){if(_0x44204c[_0xe72a('0xb')]&&!_0x44204c[_0xe72a('0xb')][_0x596ccf]){logger['info'](_0xe72a('0xc'),_0x596ccf);return _0x4ad080[_0xe72a('0xd')]();}var _0x4debee=[];for(var _0xc7fea9=0x0;_0xc7fea9<_0x5c59d2['length'];_0xc7fea9+=0x1){_0x4debee['push'](request('Command',{'command':util[_0xe72a('0xe')](_0xe72a('0xf'),_0x5c59d2[_0xc7fea9])})['then'](function(_0x104162){return _0x104162&&_0x104162['message']&&_0x104162['message'][_0xe72a('0x10')](_0xe72a('0x11'))>=0x0?!![]:![];})[_0xe72a('0x9')](function(_0x273ce0){logger['error'](_0xe72a('0x12'),_0x596ccf,_0x5c59d2[_0xc7fea9]);}));}BPromise[_0xe72a('0x13')](_0x4debee)['then'](function(_0x5a05c2){var _0x300bba=_[_0xe72a('0x14')](_0x5a05c2);logger[_0xe72a('0x15')](_0xe72a('0x16'),_0x596ccf,_0x5c59d2[_0xe72a('0x17')]('\x20|\x20'),_0x300bba);_0x4ad080[_0xe72a('0x18')](_0x300bba);})[_0xe72a('0x9')](function(_0x18d921){console['log'](_0x18d921);logger[_0xe72a('0x6')](_0xe72a('0x16'),_0x596ccf,_0x5c59d2[_0xe72a('0x17')](_0xe72a('0x19')),_0x18d921[_0xe72a('0x1a')]);_0x4ad080[_0xe72a('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 953a048..9f4fc99 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 _0xae60=['transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','lodash','util','./utils','info','format','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten'];(function(_0x375a10,_0x2a4a64){var _0x418a89=function(_0x47cb66){while(--_0x47cb66){_0x375a10['push'](_0x375a10['shift']());}};_0x418a89(++_0x2a4a64);}(_0xae60,0x1c7));var _0x0ae6=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xae60[_0x39c734];return _0xb2a2f9;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var utils=require(_0x0ae6('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x52d7cd,_0x267ad6){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x52d7cd[_0x0ae6('0x5')],_0x52d7cd[_0x0ae6('0x6')],_0x52d7cd['queue'],_0x52d7cd[_0x0ae6('0x7')],_0x52d7cd[_0x0ae6('0x8')],_0x52d7cd[_0x0ae6('0x9')],_0x52d7cd[_0x0ae6('0xa')],_0x52d7cd[_0x0ae6('0xb')]));if(_0x52d7cd[_0x0ae6('0xc')]){utils[_0x0ae6('0xd')](_0x52d7cd[_0x0ae6('0xc')])['then'](function(_0x3b3fc3){if(_0x3b3fc3){_0x52d7cd[_0x0ae6('0xe')]=_0x3b3fc3[_0x0ae6('0xe')];_0x52d7cd[_0x0ae6('0xf')]=_0x52d7cd['agentcomplete']?_0x3b3fc3[_0x0ae6('0x10')]:![];_0x52d7cd[_0x0ae6('0x11')]=_0x52d7cd[_0x0ae6('0xf')]?_0x3b3fc3[_0x0ae6('0x12')]:0x0;}utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);});}else{utils[_0x0ae6('0x13')](_0x0ae6('0x14'),_0x52d7cd);}if(_0x267ad6){delete transfers[_0x52d7cd[_0x0ae6('0x5')]];}else{delete agents[_0x52d7cd[_0x0ae6('0x15')]];}}exports[_0x0ae6('0x16')]=function(_0xf86cad){try{utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0xf86cad);agents[_0xf86cad[_0x0ae6('0x15')]]=_0xf86cad;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x18')]=utils[_0x0ae6('0x19')]();agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xb')]=_0x0ae6('0x1a');agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0xa')]=null;agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x1b')]=null;utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x1c'),_0xf86cad[_0x0ae6('0x5')],agents[_0xf86cad[_0x0ae6('0x15')]][_0x0ae6('0x7')],_0xf86cad[_0x0ae6('0x15')]));}catch(_0x9e2c46){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcalled]',_0xf86cad[_0x0ae6('0x5')]),_0x9e2c46);}};exports[_0x0ae6('0x1e')]=function(_0x140a3b){try{if(!_[_0x0ae6('0x1f')](agents[_0x140a3b[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b['uniqueid']),_0x140a3b);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x21'),_0x140a3b[_0x0ae6('0x5')],agents[_0x140a3b[_0x0ae6('0x15')]]['membername'],_0x140a3b[_0x0ae6('0x15')]));agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x1e')]=!![];agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();agents[_0x140a3b['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x23');agents[_0x140a3b['destuniqueid']]['reason']=_0x0ae6('0x23');agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x24')]=_0x140a3b['ringtime']?parseInt(_0x140a3b[_0x0ae6('0x25')])/0x3e8:0x0;agents[_0x140a3b[_0x0ae6('0x15')]][_0x0ae6('0x26')]=0x0;unanswered['push'](_0x140a3b[_0x0ae6('0x15')]);}}catch(_0x29fef3){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x20'),_0x140a3b[_0x0ae6('0x5')]),_0x29fef3);}};exports['queuecallerabandon']=function(_0x5b2ad6){try{_[_0x0ae6('0x27')](agents,function(_0x419384,_0x4e6df8){if(_0x419384['uniqueid']==_0x5b2ad6[_0x0ae6('0x5')]&&!_[_0x0ae6('0x28')](unanswered,_0x419384[_0x0ae6('0x15')])){utils[_0x0ae6('0x17')](util['format'](_0x0ae6('0x29'),_0x5b2ad6[_0x0ae6('0x5')]),_0x5b2ad6);utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x2a'),_0x5b2ad6[_0x0ae6('0x5')],_0x419384[_0x0ae6('0x7')],_0x419384[_0x0ae6('0x15')]));_0x419384[_0x0ae6('0x1e')]=!![];_0x419384[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x419384[_0x0ae6('0xb')]=_0x0ae6('0x2b');_0x419384[_0x0ae6('0x2c')]='abandoned';_0x419384[_0x0ae6('0x24')]=_0x5b2ad6[_0x0ae6('0x24')];_0x419384['talktime']=0x0;writeDB(_0x419384);}});}catch(_0x3264d5){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][queuecallerabandon]',_0x5b2ad6[_0x0ae6('0x5')]),_0x3264d5);}};exports['agentconnect']=function(_0x59e388){try{if(agents[_0x59e388[_0x0ae6('0x15')]]){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x59e388);utils['info'](util['format'](_0x0ae6('0x2e'),_0x59e388['uniqueid'],agents[_0x59e388[_0x0ae6('0x15')]]['membername'],_0x59e388[_0x0ae6('0x15')]));agents[_0x59e388['destuniqueid']][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();agents[_0x59e388[_0x0ae6('0x15')]][_0x0ae6('0xa')]=_0x59e388['connectedlinenum'];agents[_0x59e388['destuniqueid']][_0x0ae6('0x1b')]=_0x59e388[_0x0ae6('0x1b')];agents[_0x59e388[_0x0ae6('0x15')]]['holdtime']=_0x59e388[_0x0ae6('0x25')];agents[_0x59e388['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x30');_[_0x0ae6('0x27')](agents,function(_0x19403c,_0x450f00){if(_0x19403c[_0x0ae6('0x15')]!=_0x59e388['destuniqueid']&&_0x19403c[_0x0ae6('0x5')]==_0x59e388[_0x0ae6('0x5')]){_0x19403c[_0x0ae6('0x26')]=0x0;_0x19403c[_0x0ae6('0x24')]=_0x59e388[_0x0ae6('0x25')];_0x19403c[_0x0ae6('0x1e')]=!![];_0x19403c[_0x0ae6('0x22')]=utils[_0x0ae6('0x19')]();_0x19403c['lastevent']=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x2c')]=_0x0ae6('0x31');_0x19403c[_0x0ae6('0x32')]=_0x59e388[_0x0ae6('0x15')];_0x19403c[_0x0ae6('0x33')]=_0x59e388[_0x0ae6('0x7')];writeDB(_0x19403c);}});}}catch(_0x21431e){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x2d'),_0x59e388[_0x0ae6('0x5')]),_0x21431e);}};exports[_0x0ae6('0x34')]=function(_0x85d9ce){try{if(!_[_0x0ae6('0x1f')](agents[_0x85d9ce[_0x0ae6('0x15')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x85d9ce);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x35'),_0x85d9ce[_0x0ae6('0x5')],agents[_0x85d9ce[_0x0ae6('0x15')]]['membername'],_0x85d9ce[_0x0ae6('0x15')]));agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x34')]=!![];agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](agents[_0x85d9ce[_0x0ae6('0x15')]]['agentcompleteAt'],agents[_0x85d9ce[_0x0ae6('0x15')]][_0x0ae6('0x2f')]);agents[_0x85d9ce['destuniqueid']][_0x0ae6('0x2c')]=_0x85d9ce[_0x0ae6('0x2c')];agents[_0x85d9ce['destuniqueid']][_0x0ae6('0xb')]=_0x0ae6('0x37');writeDB(agents[_0x85d9ce['destuniqueid']]);}}catch(_0x76e561){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')]('[%s][agents][agentcomplete]',_0x85d9ce[_0x0ae6('0x5')]),_0x76e561);}};exports[_0x0ae6('0x38')]=function(_0x46075a){try{if(!_[_0x0ae6('0x1f')](agents[_0x46075a[_0x0ae6('0x39')]])){utils[_0x0ae6('0x17')](util[_0x0ae6('0x4')]('[%s][agents][blindtransfer]',_0x46075a['uniqueid']),_0x46075a);utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x3a'),_0x46075a['uniqueid'],agents[_0x46075a[_0x0ae6('0x39')]]['membername'],agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x5')]));agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3b')]=!![];agents[_0x46075a['transfereruniqueid']][_0x0ae6('0x3c')]=_0x0ae6('0x3d');agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x3e')]=_0x46075a[_0x0ae6('0x3f')];agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x40')]=agents[_0x46075a[_0x0ae6('0x39')]][_0x0ae6('0x5')];}}catch(_0x117d24){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x41'),_0x46075a[_0x0ae6('0x5')]),_0x117d24);}};exports[_0x0ae6('0x42')]=function(_0x5c4785){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x5c4785);if(_0x5c4785[_0x0ae6('0x44')]==_0x5c4785[_0x0ae6('0x45')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785[_0x0ae6('0x46')]])){utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x3c')]=_0x0ae6('0x48');agents[_0x5c4785['secondtransfereruniqueid']][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x49')];agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x40')]=_0x5c4785[_0x0ae6('0x44')];}if(_0x5c4785[_0x0ae6('0x4a')]&&agents[_0x5c4785[_0x0ae6('0x4a')]]){agents[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4a')]]=_['clone'](agents[_0x5c4785[_0x0ae6('0x4a')]]);transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x46')]][_0x0ae6('0x4c')];transfers[_0x5c4785['transfereeuniqueid']]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4a')]]['agentconnectAt']=utils['now']();transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785[_0x0ae6('0x4a')]][_0x0ae6('0x4b')]=0x2;}}else if(_0x5c4785[_0x0ae6('0x46')]==_0x5c4785[_0x0ae6('0x4d')]){if(!_[_0x0ae6('0x1f')](agents[_0x5c4785['origtransfereruniqueid']])){utils[_0x0ae6('0x3')](util['format'](_0x0ae6('0x47'),_0x5c4785[_0x0ae6('0x44')],agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x7')]));agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3b')]=!![];agents[_0x5c4785['origtransfereruniqueid']][_0x0ae6('0x3c')]='ATTENDED';agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x3e')]=_0x5c4785[_0x0ae6('0x4e')];agents[_0x5c4785[_0x0ae6('0x44')]]['transferuniqueid']=_0x5c4785['secondtransfereruniqueid'];}if(_0x5c4785[_0x0ae6('0x4f')]&&agents[_0x5c4785[_0x0ae6('0x4f')]]){agents[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4b')]=0x1;transfers[_0x5c4785[_0x0ae6('0x4f')]]=_[_0x0ae6('0x50')](agents[_0x5c4785['transfertargetuniqueid']]);transfers[_0x5c4785['transfertargetuniqueid']][_0x0ae6('0x9')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x9')];transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x4c')]=agents[_0x5c4785[_0x0ae6('0x44')]][_0x0ae6('0x4c')];transfers[_0x5c4785[_0x0ae6('0x4f')]]['agentcalledAt']=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x2f')]=utils[_0x0ae6('0x19')]();transfers[_0x5c4785[_0x0ae6('0x4f')]][_0x0ae6('0x24')]=0x0;transfers[_0x5c4785['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x35068d){utils[_0x0ae6('0x1d')](util['format'](_0x0ae6('0x43'),_0x5c4785[_0x0ae6('0x44')]),_0x35068d);}};exports[_0x0ae6('0x51')]=function(_0x37ad9b){try{utils['debug'](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x37ad9b);if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')]===_0x0ae6('0x23')){if(_0x37ad9b[_0x0ae6('0x53')]==='21'){agents[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]=_0x0ae6('0x54');agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x54');}utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b[_0x0ae6('0x5')]]);var _0x346d19=unanswered[_0x0ae6('0x56')](_0x37ad9b[_0x0ae6('0x5')]);if(_0x346d19>-0x1){unanswered[_0x0ae6('0x57')](_0x346d19,0x1);}}if(transfers[_0x37ad9b[_0x0ae6('0x5')]]){transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x34')]=!![];transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x26')]=utils[_0x0ae6('0x36')](transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2f')]);transfers[_0x37ad9b['uniqueid']][_0x0ae6('0x2c')]='agent';transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')](_0x0ae6('0x55'),_0x37ad9b[_0x0ae6('0x5')],transfers[_0x37ad9b['uniqueid']]['membername'],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],transfers[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(transfers[_0x37ad9b['uniqueid']],!![]);}if(agents[_0x37ad9b[_0x0ae6('0x5')]]&&agents[_0x37ad9b[_0x0ae6('0x5')]]['agentconnectAt']){agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x34')]=!![];agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x58')]=utils[_0x0ae6('0x19')]();agents[_0x37ad9b[_0x0ae6('0x5')]]['talktime']=utils['diffTime'](agents[_0x37ad9b['uniqueid']][_0x0ae6('0x58')],agents[_0x37ad9b['uniqueid']]['agentconnectAt']);agents[_0x37ad9b['uniqueid']]['reason']=agents[_0x37ad9b[_0x0ae6('0x5')]]['transfer']?_0x0ae6('0x3b'):'agent';agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]=_0x0ae6('0x37');utils[_0x0ae6('0x3')](util[_0x0ae6('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x37ad9b[_0x0ae6('0x5')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x7')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0x2c')],agents[_0x37ad9b[_0x0ae6('0x5')]][_0x0ae6('0xb')]));writeDB(agents[_0x37ad9b['uniqueid']]);}}catch(_0x435707){utils[_0x0ae6('0x1d')](util[_0x0ae6('0x4')](_0x0ae6('0x52'),_0x37ad9b[_0x0ae6('0x5')]),_0x435707);}}; \ No newline at end of file +var _0x04b8=['ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','[%s][agents][hangup]','util','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','agentcalled','debug','destuniqueid','agentcalledAt','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','agentringnoanswerAt','reason','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','abandoned','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfer'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0x04b8,0x159));var _0x804b=function(_0x4b5161,_0xcce11f){_0x4b5161=_0x4b5161-0x0;var _0x2c9c3c=_0x04b8[_0x4b5161];return _0x2c9c3c;};'use strict';var _=require('lodash');var util=require(_0x804b('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x241a4f,_0xa6a605){utils['info'](util[_0x804b('0x1')](_0x804b('0x2'),_0x241a4f['uniqueid'],_0x241a4f[_0x804b('0x3')],_0x241a4f[_0x804b('0x4')],_0x241a4f[_0x804b('0x5')],_0x241a4f['interface'],_0x241a4f[_0x804b('0x6')],_0x241a4f[_0x804b('0x7')],_0x241a4f[_0x804b('0x8')]));if(_0x241a4f['queue']){utils[_0x804b('0x9')](_0x241a4f[_0x804b('0x4')])['then'](function(_0x2a5a68){if(_0x2a5a68){_0x241a4f[_0x804b('0xa')]=_0x2a5a68[_0x804b('0xa')];_0x241a4f[_0x804b('0xb')]=_0x241a4f[_0x804b('0xc')]?_0x2a5a68['acw']:![];_0x241a4f[_0x804b('0xd')]=_0x241a4f[_0x804b('0xb')]?_0x2a5a68[_0x804b('0xe')]:0x0;}utils[_0x804b('0xf')](_0x804b('0x10'),_0x241a4f);});}else{utils[_0x804b('0xf')]('CreateVoiceAgentReport',_0x241a4f);}if(_0xa6a605){delete transfers[_0x241a4f[_0x804b('0x11')]];}else{delete agents[_0x241a4f['destuniqueid']];}}exports[_0x804b('0x12')]=function(_0x3a2702){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x3a2702);agents[_0x3a2702[_0x804b('0x14')]]=_0x3a2702;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x15')]=utils['now']();agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x8')]='called';agents[_0x3a2702[_0x804b('0x14')]]['connectedlinenum']=null;agents[_0x3a2702[_0x804b('0x14')]][_0x804b('0x16')]=null;utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x18'),_0x3a2702['uniqueid'],agents[_0x3a2702[_0x804b('0x14')]]['membername'],_0x3a2702[_0x804b('0x14')]));}catch(_0x95e719){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentcalled]',_0x3a2702[_0x804b('0x11')]),_0x95e719);}};exports[_0x804b('0x1a')]=function(_0x427166){try{if(!_[_0x804b('0x1b')](agents[_0x427166[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166[_0x804b('0x11')]),_0x427166);utils[_0x804b('0x17')](util[_0x804b('0x1')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x427166[_0x804b('0x11')],agents[_0x427166[_0x804b('0x14')]]['membername'],_0x427166[_0x804b('0x14')]));agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1a')]=!![];agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1d')]=utils['now']();agents[_0x427166[_0x804b('0x14')]][_0x804b('0x8')]='timeout';agents[_0x427166[_0x804b('0x14')]][_0x804b('0x1e')]=_0x804b('0x1f');agents[_0x427166[_0x804b('0x14')]][_0x804b('0x20')]=_0x427166['ringtime']?parseInt(_0x427166[_0x804b('0x21')])/0x3e8:0x0;agents[_0x427166[_0x804b('0x14')]][_0x804b('0x22')]=0x0;unanswered[_0x804b('0x23')](_0x427166[_0x804b('0x14')]);}}catch(_0x4a6079){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x1c'),_0x427166['uniqueid']),_0x4a6079);}};exports[_0x804b('0x24')]=function(_0x407357){try{_[_0x804b('0x25')](agents,function(_0x57b8da,_0x408857){if(_0x57b8da[_0x804b('0x11')]==_0x407357['uniqueid']&&!_[_0x804b('0x26')](unanswered,_0x57b8da[_0x804b('0x14')])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x407357);utils['info'](util[_0x804b('0x1')](_0x804b('0x28'),_0x407357[_0x804b('0x11')],_0x57b8da[_0x804b('0x5')],_0x57b8da[_0x804b('0x14')]));_0x57b8da[_0x804b('0x1a')]=!![];_0x57b8da[_0x804b('0x1d')]=utils[_0x804b('0x29')]();_0x57b8da[_0x804b('0x8')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x1e')]=_0x804b('0x2a');_0x57b8da[_0x804b('0x20')]=_0x407357[_0x804b('0x20')];_0x57b8da[_0x804b('0x22')]=0x0;writeDB(_0x57b8da);}});}catch(_0x384c44){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x27'),_0x407357[_0x804b('0x11')]),_0x384c44);}};exports[_0x804b('0x2b')]=function(_0x350387){try{if(agents[_0x350387[_0x804b('0x14')]]){utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387['uniqueid']),_0x350387);utils['info'](util[_0x804b('0x1')](_0x804b('0x2c'),_0x350387[_0x804b('0x11')],agents[_0x350387['destuniqueid']]['membername'],_0x350387['destuniqueid']));agents[_0x350387[_0x804b('0x14')]][_0x804b('0x2d')]=utils[_0x804b('0x29')]();agents[_0x350387[_0x804b('0x14')]][_0x804b('0x7')]=_0x350387[_0x804b('0x7')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x16')]=_0x350387[_0x804b('0x16')];agents[_0x350387[_0x804b('0x14')]][_0x804b('0x20')]=_0x350387[_0x804b('0x21')];agents[_0x350387[_0x804b('0x14')]]['lastevent']=_0x804b('0x2e');_[_0x804b('0x25')](agents,function(_0xb877d6,_0x3d6d8a){if(_0xb877d6[_0x804b('0x14')]!=_0x350387['destuniqueid']&&_0xb877d6['uniqueid']==_0x350387[_0x804b('0x11')]){_0xb877d6[_0x804b('0x22')]=0x0;_0xb877d6[_0x804b('0x20')]=_0x350387['ringtime'];_0xb877d6[_0x804b('0x1a')]=!![];_0xb877d6['agentringnoanswerAt']=utils[_0x804b('0x29')]();_0xb877d6[_0x804b('0x8')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x1e')]=_0x804b('0x2f');_0xb877d6[_0x804b('0x30')]=_0x350387[_0x804b('0x14')];_0xb877d6['answeredelsewheremembername']=_0x350387[_0x804b('0x5')];writeDB(_0xb877d6);}});}}catch(_0x1c0363){utils[_0x804b('0x19')](util[_0x804b('0x1')]('[%s][agents][agentconnect]',_0x350387[_0x804b('0x11')]),_0x1c0363);}};exports[_0x804b('0xc')]=function(_0x1df519){try{if(!_[_0x804b('0x1b')](agents[_0x1df519[_0x804b('0x14')]])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519['uniqueid']),_0x1df519);utils[_0x804b('0x17')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1df519['uniqueid'],agents[_0x1df519[_0x804b('0x14')]]['membername'],_0x1df519[_0x804b('0x14')]));agents[_0x1df519[_0x804b('0x14')]][_0x804b('0xc')]=!![];agents[_0x1df519[_0x804b('0x14')]]['agentcompleteAt']=utils[_0x804b('0x29')]();agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x22')]=utils['diffTime'](agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x32')],agents[_0x1df519[_0x804b('0x14')]]['agentconnectAt']);agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x1e')]=_0x1df519[_0x804b('0x1e')];agents[_0x1df519[_0x804b('0x14')]][_0x804b('0x8')]=_0x804b('0x33');writeDB(agents[_0x1df519[_0x804b('0x14')]]);}}catch(_0x2a2a08){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x31'),_0x1df519[_0x804b('0x11')]),_0x2a2a08);}};exports[_0x804b('0x34')]=function(_0x2c1796){try{if(!_['isNil'](agents[_0x2c1796['transfereruniqueid']])){utils[_0x804b('0x13')](util[_0x804b('0x1')](_0x804b('0x35'),_0x2c1796[_0x804b('0x11')]),_0x2c1796);utils[_0x804b('0x17')](util['format'](_0x804b('0x36'),_0x2c1796[_0x804b('0x11')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x5')],agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')]));agents[_0x2c1796['transfereruniqueid']]['transfer']=!![];agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x38')]='blind';agents[_0x2c1796['transfereruniqueid']][_0x804b('0x39')]=_0x2c1796[_0x804b('0x3a')];agents[_0x2c1796[_0x804b('0x37')]]['transferuniqueid']=agents[_0x2c1796[_0x804b('0x37')]][_0x804b('0x11')];}}catch(_0x54cc99){utils[_0x804b('0x19')](util['format'](_0x804b('0x35'),_0x2c1796['uniqueid']),_0x54cc99);}};exports[_0x804b('0x3b')]=function(_0x183e72){try{utils['debug'](util[_0x804b('0x1')]('[%s][agents][attendedtransfer]',_0x183e72[_0x804b('0x3c')]),_0x183e72);if(_0x183e72[_0x804b('0x3c')]==_0x183e72[_0x804b('0x3d')]){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3e')]])){utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3e')]]['membername']));agents[_0x183e72['secondtransfereruniqueid']][_0x804b('0x40')]=!![];agents[_0x183e72['secondtransfereruniqueid']]['transfertype']=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x39')]=_0x183e72[_0x804b('0x42')];agents[_0x183e72['secondtransfereruniqueid']]['transferuniqueid']=_0x183e72[_0x804b('0x3c')];}if(_0x183e72[_0x804b('0x43')]&&agents[_0x183e72[_0x804b('0x43')]]){agents[_0x183e72[_0x804b('0x43')]][_0x804b('0x44')]=0x1;transfers[_0x183e72[_0x804b('0x43')]]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x43')]]);transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x6')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x6')];transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x46')]=agents[_0x183e72[_0x804b('0x3e')]][_0x804b('0x46')];transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x15')]=utils[_0x804b('0x29')]();transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x2d')]=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x43')]][_0x804b('0x20')]=0x0;transfers[_0x183e72['transfereeuniqueid']][_0x804b('0x44')]=0x2;}}else if(_0x183e72[_0x804b('0x3e')]==_0x183e72['secondtransfererlinkedid']){if(!_[_0x804b('0x1b')](agents[_0x183e72[_0x804b('0x3c')]])){utils[_0x804b('0x17')](util['format'](_0x804b('0x3f'),_0x183e72[_0x804b('0x3c')],agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x5')]));agents[_0x183e72[_0x804b('0x3c')]]['transfer']=!![];agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x38')]=_0x804b('0x41');agents[_0x183e72[_0x804b('0x3c')]]['transferexten']=_0x183e72['secondtransfererexten'];agents[_0x183e72[_0x804b('0x3c')]]['transferuniqueid']=_0x183e72[_0x804b('0x3e')];}if(_0x183e72[_0x804b('0x47')]&&agents[_0x183e72[_0x804b('0x47')]]){agents[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x1;transfers[_0x183e72['transfertargetuniqueid']]=_[_0x804b('0x45')](agents[_0x183e72[_0x804b('0x47')]]);transfers[_0x183e72[_0x804b('0x47')]]['calleridnum']=agents[_0x183e72[_0x804b('0x3c')]][_0x804b('0x6')];transfers[_0x183e72['transfertargetuniqueid']][_0x804b('0x46')]=agents[_0x183e72['origtransfereruniqueid']][_0x804b('0x46')];transfers[_0x183e72[_0x804b('0x47')]]['agentcalledAt']=utils[_0x804b('0x29')]();transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x2d')]=utils['now']();transfers[_0x183e72[_0x804b('0x47')]]['holdtime']=0x0;transfers[_0x183e72[_0x804b('0x47')]][_0x804b('0x44')]=0x2;}}}catch(_0x43f3ec){utils[_0x804b('0x19')](util['format'](_0x804b('0x48'),_0x183e72[_0x804b('0x3c')]),_0x43f3ec);}};exports[_0x804b('0x49')]=function(_0xa1da42){try{utils[_0x804b('0x13')](util[_0x804b('0x1')]('[%s][agents][hangup]',_0xa1da42[_0x804b('0x11')]),_0xa1da42);if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x1e')]===_0x804b('0x1f')){if(_0xa1da42[_0x804b('0x4a')]==='21'){agents[_0xa1da42[_0x804b('0x11')]]['reason']=_0x804b('0x4b');agents[_0xa1da42[_0x804b('0x11')]]['lastevent']=_0x804b('0x4b');}utils[_0x804b('0x17')](util['format'](_0x804b('0x4c'),_0xa1da42['uniqueid'],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);var _0x5efc95=unanswered[_0x804b('0x4d')](_0xa1da42['uniqueid']);if(_0x5efc95>-0x1){unanswered[_0x804b('0x4e')](_0x5efc95,0x1);}}if(transfers[_0xa1da42[_0x804b('0x11')]]){transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0xc')]=!![];transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x32')]=utils[_0x804b('0x29')]();transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils[_0x804b('0x4f')](transfers[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt'],transfers[_0xa1da42['uniqueid']][_0x804b('0x2d')]);transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')]=_0x804b('0x50');transfers[_0xa1da42['uniqueid']][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],transfers[_0xa1da42[_0x804b('0x11')]][_0x804b('0x1e')],transfers[_0xa1da42['uniqueid']]['lastevent']));writeDB(transfers[_0xa1da42[_0x804b('0x11')]],!![]);}if(agents[_0xa1da42[_0x804b('0x11')]]&&agents[_0xa1da42['uniqueid']][_0x804b('0x2d')]){agents[_0xa1da42[_0x804b('0x11')]]['agentcomplete']=!![];agents[_0xa1da42[_0x804b('0x11')]]['agentcompleteAt']=utils['now']();agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x22')]=utils['diffTime'](agents[_0xa1da42['uniqueid']][_0x804b('0x32')],agents[_0xa1da42[_0x804b('0x11')]]['agentconnectAt']);agents[_0xa1da42[_0x804b('0x11')]]['reason']=agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x40')]?_0x804b('0x40'):'agent';agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x8')]=_0x804b('0x33');utils[_0x804b('0x17')](util[_0x804b('0x1')](_0x804b('0x4c'),_0xa1da42[_0x804b('0x11')],agents[_0xa1da42[_0x804b('0x11')]][_0x804b('0x5')],agents[_0xa1da42[_0x804b('0x11')]]['reason'],agents[_0xa1da42['uniqueid']][_0x804b('0x8')]));writeDB(agents[_0xa1da42[_0x804b('0x11')]]);}}catch(_0x3dd61f){utils[_0x804b('0x19')](util[_0x804b('0x1')](_0x804b('0x51'),_0xa1da42[_0x804b('0x11')]),_0x3dd61f);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 3af2195..d5669cb 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 _0x38e4=['[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','channel','isNil','systemanswertime','context','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime'];(function(_0x5b10f1,_0x31e425){var _0xf0a43c=function(_0x239813){while(--_0x239813){_0x5b10f1['push'](_0x5b10f1['shift']());}};_0xf0a43c(++_0x31e425);}(_0x38e4,0x9e));var _0x438e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x38e4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var utils=require('./utils');var transfers=require(_0x438e('0x2'));var dispositions=[_0x438e('0x3'),'FAILED',_0x438e('0x4'),_0x438e('0x3'),_0x438e('0x3'),'NO\x20ANSWER',_0x438e('0x5'),_0x438e('0x6'),_0x438e('0x4'),_0x438e('0x4'),_0x438e('0x4')];var channels={};function writeDB(_0x37a9ac){var _0x58d120;if(transfers['blinds'][_0x37a9ac['uniqueid']]){_0x58d120=_0x37a9ac['uniqueid'];_0x37a9ac[_0x438e('0x7')]=transfers[_0x438e('0x8')][_0x37a9ac[_0x438e('0x7')]][_0x438e('0x9')];}utils['info'](util[_0x438e('0xa')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x37a9ac[_0x438e('0x7')],_0x37a9ac['channel'],_0x37a9ac[_0x438e('0xb')],_0x37a9ac[_0x438e('0xc')],_0x37a9ac[_0x438e('0xd')],_0x37a9ac[_0x438e('0xe')],_0x37a9ac[_0x438e('0xf')],_0x37a9ac['lastevent']));if(_0x37a9ac[_0x438e('0x10')]){utils[_0x438e('0x11')](_0x37a9ac[_0x438e('0x10')])[_0x438e('0x12')](function(_0x56e395){if(_0x56e395){_0x37a9ac['UserId']=_0x56e395['id'];}utils['request'](_0x438e('0x13'),_0x37a9ac);});}else{utils[_0x438e('0x14')](_0x438e('0x13'),_0x37a9ac);}if(channels[_0x37a9ac[_0x438e('0x7')]]){delete channels[_0x37a9ac[_0x438e('0x7')]];}else if(_0x58d120&&channels[_0x58d120]){if(!transfers[_0x438e('0x8')][_0x58d120][_0x438e('0x15')])delete transfers['blinds'][_0x58d120];delete channels[_0x58d120];}}exports[_0x438e('0x16')]=function(_0x347505){try{utils[_0x438e('0x17')](util[_0x438e('0xa')](_0x438e('0x18'),_0x347505[_0x438e('0x7')]),_0x347505);if(_0x347505['uniqueid']==_0x347505[_0x438e('0x19')]&&_0x347505['channel']!='OutgoingSpoolFailed'){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x1b'),_0x347505[_0x438e('0x7')],_0x347505['context'],_0x347505[_0x438e('0x1c')]));channels[_0x347505[_0x438e('0x7')]]={'uniqueid':_0x347505[_0x438e('0x7')],'accountcode':_0x347505[_0x438e('0x10')],'source':_0x347505[_0x438e('0xe')],'destination':_0x347505['exten'],'destinationcontext':_0x347505['context'],'channel':_0x347505['channel'],'starttime':utils[_0x438e('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x438e('0x3'),'amaflags':_0x438e('0x1e')};}}catch(_0x68639c){utils[_0x438e('0x1f')](util['format'](_0x438e('0x18'),_0x347505['uniqueid']),_0x68639c);}};exports[_0x438e('0x20')]=function(_0x40510d){try{utils[_0x438e('0x17')](util[_0x438e('0xa')](_0x438e('0x21'),_0x40510d[_0x438e('0x7')]),_0x40510d);if(!_['isNil'](channels[_0x40510d[_0x438e('0x7')]])&&_0x40510d[_0x438e('0x22')]==0x6){utils['info'](util[_0x438e('0xa')](_0x438e('0x23'),_0x40510d[_0x438e('0x7')],_0x40510d['context'],_0x40510d[_0x438e('0x24')]));if(_[_0x438e('0x25')](channels[_0x40510d[_0x438e('0x7')]][_0x438e('0x26')])){channels[_0x40510d['uniqueid']][_0x438e('0x26')]=utils[_0x438e('0x1d')]();}}else if(!_['isNil'](channels[_0x40510d['linkedid']])&&_0x40510d[_0x438e('0x22')]==0x6&&_0x40510d[_0x438e('0x27')]!=_0x438e('0x28')){utils[_0x438e('0x1a')](util['format'](_0x438e('0x29'),_0x40510d[_0x438e('0x7')],_0x40510d['linkedid'],_0x40510d[_0x438e('0x27')],_0x40510d[_0x438e('0x24')]));channels[_0x40510d[_0x438e('0x19')]]['accountcode']=_0x40510d[_0x438e('0x10')];channels[_0x40510d[_0x438e('0x19')]][_0x438e('0x2a')]=_0x40510d[_0x438e('0x24')];if(_[_0x438e('0x25')](channels[_0x40510d['linkedid']][_0x438e('0x2b')])){channels[_0x40510d['linkedid']][_0x438e('0x2b')]=utils['now']();}channels[_0x40510d[_0x438e('0x19')]][_0x438e('0x2c')]=dispositions[_[_0x438e('0x2d')](_0x40510d[_0x438e('0x22')])]||_0x438e('0x5');}}catch(_0x1d8623){utils[_0x438e('0x1f')](util[_0x438e('0xa')](_0x438e('0x21'),_0x40510d['uniqueid']),_0x1d8623);}};exports[_0x438e('0x2e')]=function(_0x1a9c69){try{if(!_[_0x438e('0x25')](channels[_0x1a9c69[_0x438e('0x7')]])){utils[_0x438e('0x17')](util[_0x438e('0xa')](_0x438e('0x2f'),_0x1a9c69[_0x438e('0x7')]),_0x1a9c69);if(_[_0x438e('0x25')](channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x30')])){channels[_0x1a9c69['uniqueid']]['callerid']=_0x1a9c69['calleridname']+'\x20<'+_0x1a9c69[_0x438e('0xe')]+'>';}utils[_0x438e('0x1a')](util['format'](_0x438e('0x31'),_0x1a9c69[_0x438e('0x7')],channels[_0x1a9c69[_0x438e('0x7')]]['callerid'],_0x1a9c69[_0x438e('0x32')]));channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x33')]=utils[_0x438e('0x1d')]();channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x34')]=utils[_0x438e('0x35')](channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x33')],channels[_0x1a9c69['uniqueid']][_0x438e('0x36')]);channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x37')]=channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x2b')]?utils[_0x438e('0x35')](channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x33')],channels[_0x1a9c69[_0x438e('0x7')]][_0x438e('0x2b')]):0x0;writeDB(channels[_0x1a9c69['uniqueid']]);}}catch(_0x3338ca){utils[_0x438e('0x1f')](util['format'](_0x438e('0x2f'),_0x1a9c69[_0x438e('0x7')]),_0x3338ca);}};exports['attendedtransfer']=function(_0x24e0d0){try{if(!_[_0x438e('0x25')](channels[_0x24e0d0[_0x438e('0x38')]])){utils[_0x438e('0x17')](util['format'](_0x438e('0x39'),_0x24e0d0[_0x438e('0x3a')]),_0x24e0d0);if(channels[_0x24e0d0[_0x438e('0x38')]][_0x438e('0x24')]==_0x24e0d0[_0x438e('0x3b')]){utils[_0x438e('0x1a')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x24e0d0[_0x438e('0x3a')],_0x24e0d0[_0x438e('0x38')],_0x24e0d0['secondtransfererchannel']));channels[_0x24e0d0['localtwolinkedid']][_0x438e('0x2a')]=_0x24e0d0[_0x438e('0x3c')];channels[_0x24e0d0['localtwolinkedid']][_0x438e('0x3d')]=_0x438e('0x3e');}else if(channels[_0x24e0d0[_0x438e('0x38')]][_0x438e('0x24')]=_0x24e0d0[_0x438e('0x3f')]){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x40'),_0x24e0d0['origtransfereruniqueid'],_0x24e0d0[_0x438e('0x38')],_0x24e0d0[_0x438e('0x41')]));channels[_0x24e0d0['localtwolinkedid']][_0x438e('0x2a')]=_0x24e0d0[_0x438e('0x41')];channels[_0x24e0d0[_0x438e('0x38')]][_0x438e('0x3d')]=_0x438e('0x3e');}}}catch(_0x1ab3fb){utils[_0x438e('0x1f')](util[_0x438e('0xa')](_0x438e('0x39'),_0x24e0d0['origtransfereruniqueid']),_0x1ab3fb);}};exports[_0x438e('0x42')]=function(_0x1a8919){try{if(!_['isNil'](channels[_0x1a8919[_0x438e('0x7')]])){utils['debug'](util[_0x438e('0xa')]('[%s][calls][musiconholdstart]',_0x1a8919[_0x438e('0x7')]),_0x1a8919);channels[_0x1a8919[_0x438e('0x7')]][_0x438e('0x43')]=utils[_0x438e('0x1d')]();utils[_0x438e('0x1a')](util[_0x438e('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x1a8919['uniqueid'],channels[_0x1a8919[_0x438e('0x7')]][_0x438e('0x43')]));}}catch(_0x8520ae){utils[_0x438e('0x1f')](util[_0x438e('0xa')](_0x438e('0x44'),_0x1a8919[_0x438e('0x7')]),_0x8520ae);}};exports[_0x438e('0x45')]=function(_0x12b06f){try{if(!_['isNil'](channels[_0x12b06f['uniqueid']])){utils[_0x438e('0x17')](util['format'](_0x438e('0x46'),_0x12b06f[_0x438e('0x7')]),_0x12b06f);if(!_[_0x438e('0x25')](channels[_0x12b06f[_0x438e('0x7')]][_0x438e('0x43')])){channels[_0x12b06f['uniqueid']][_0x438e('0x47')]+=utils[_0x438e('0x35')](utils[_0x438e('0x1d')](),channels[_0x12b06f[_0x438e('0x7')]]['musiconholdstartAt']);utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x48'),_0x12b06f[_0x438e('0x7')],channels[_0x12b06f[_0x438e('0x7')]][_0x438e('0x47')]));delete channels[_0x12b06f['uniqueid']][_0x438e('0x43')];}}}catch(_0x2c776f){utils[_0x438e('0x1f')](util[_0x438e('0xa')](_0x438e('0x46'),_0x12b06f[_0x438e('0x7')]),_0x2c776f);}};exports['varset']=function(_0x3313c1){try{if(!_[_0x438e('0x25')](channels[_0x3313c1[_0x438e('0x7')]])){utils[_0x438e('0x17')](util[_0x438e('0xa')](_0x438e('0x49'),_0x3313c1[_0x438e('0x7')]),_0x3313c1);if(!_[_0x438e('0x25')](_0x3313c1['variable'][_0x438e('0x4a')])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x4b'),_0x3313c1['uniqueid'],_0x3313c1[_0x438e('0x4c')]));channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x4d')]=_0x3313c1[_0x438e('0x4c')];}if(!_[_0x438e('0x25')](_0x3313c1[_0x438e('0x4e')]['xmd-phone'])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x4f'),_0x3313c1[_0x438e('0x7')],_0x3313c1['value']));channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x50')]=_0x3313c1['value'];channels[_0x3313c1['uniqueid']][_0x438e('0x30')]='\x22'+_0x3313c1[_0x438e('0x4c')]+_0x438e('0x51')+_0x3313c1[_0x438e('0x4c')]+'>';}if(!_[_0x438e('0x25')](_0x3313c1[_0x438e('0x4e')]['xmd-callerid-preview'])||!_['isNil'](_0x3313c1['variable']['xmd-callerid'])){utils[_0x438e('0x1a')](util[_0x438e('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x3313c1[_0x438e('0x7')],!_[_0x438e('0x25')](_0x3313c1[_0x438e('0x4e')][_0x438e('0x52')])?_0x438e('0x52'):_0x438e('0x53'),_0x3313c1['value']));channels[_0x3313c1[_0x438e('0x7')]]['callerid']=_0x3313c1[_0x438e('0x4c')];}if(!_[_0x438e('0x25')](_0x3313c1[_0x438e('0x4e')][_0x438e('0x54')])||!_[_0x438e('0x25')](_0x3313c1[_0x438e('0x4e')][_0x438e('0x55')])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x56'),_0x3313c1['uniqueid'],!_['isNil'](_0x3313c1['variable'][_0x438e('0x54')])?'xmd-queue':_0x438e('0x55'),_0x3313c1[_0x438e('0x4c')]));channels[_0x3313c1['uniqueid']][_0x438e('0x57')]=_0x438e('0x58');channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x59')]=_0x3313c1[_0x438e('0x4c')];channels[_0x3313c1[_0x438e('0x7')]]['queue']=!![];}if(!_['isNil'](_0x3313c1[_0x438e('0x4e')][_0x438e('0x5a')])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x5b'),_0x3313c1[_0x438e('0x7')],_0x3313c1[_0x438e('0x4c')]));channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x5c')]=_0x3313c1[_0x438e('0x4c')];}if(!_['isNil'](_0x3313c1[_0x438e('0x4e')][_0x438e('0x5d')])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x5e'),_0x3313c1[_0x438e('0x7')],_0x3313c1[_0x438e('0x4c')]));channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x5f')]=_0x3313c1[_0x438e('0x4c')];}if(!_['isNil'](_0x3313c1[_0x438e('0x4e')][_0x438e('0x60')])){utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x61'),_0x3313c1[_0x438e('0x7')],_0x3313c1[_0x438e('0x4c')]));channels[_0x3313c1['uniqueid']]['routeid']=_0x3313c1[_0x438e('0x4c')];}if(!_['isNil'](_0x3313c1[_0x438e('0x4e')][_0x438e('0x62')])){utils['info'](util[_0x438e('0xa')](_0x438e('0x63'),_0x3313c1[_0x438e('0x7')],_0x3313c1['value']));channels[_0x3313c1[_0x438e('0x7')]][_0x438e('0x62')]=_0x3313c1[_0x438e('0x4c')];}}}catch(_0x73c96){utils[_0x438e('0x1f')](util[_0x438e('0xa')]('[%s][calls][varset]',_0x3313c1[_0x438e('0x7')]),_0x73c96);}};exports[_0x438e('0x64')]=function(_0x3ba1e0){try{if(!_[_0x438e('0x25')](channels[_0x3ba1e0[_0x438e('0x7')]])){utils[_0x438e('0x17')](util['format'](_0x438e('0x65'),_0x3ba1e0[_0x438e('0x7')]),_0x3ba1e0);utils[_0x438e('0x1a')](util[_0x438e('0xa')](_0x438e('0x66'),_0x3ba1e0[_0x438e('0x7')],_0x3ba1e0[_0x438e('0x67')],_0x3ba1e0[_0x438e('0x68')]));if(_0x3ba1e0[_0x438e('0x67')]['toLowerCase']()=='set'&&_[_0x438e('0x69')](_0x3ba1e0[_0x438e('0x68')][_0x438e('0x6a')](),_0x438e('0x6b'))){var _0x4f379d=_0x3ba1e0['appdata'][_0x438e('0x6c')]('=');var _0x217c91=_0x4f379d[0x0][_0x438e('0x6d')](_0x4f379d[0x0][_0x438e('0x6e')]('(')+0x1,_0x4f379d[0x0]['lastIndexOf'](')'));var _0x66fab9=_0x4f379d[0x1];channels[_0x3ba1e0[_0x438e('0x7')]][_0x217c91]=_0x66fab9;}if(!_[_0x438e('0x6f')]([_0x438e('0x2e'),'noop',_0x438e('0x70'),_0x438e('0x71'),_0x438e('0x72')],_0x3ba1e0[_0x438e('0x67')]['toLowerCase']())){channels[_0x3ba1e0['uniqueid']][_0x438e('0x57')]=_0x3ba1e0[_0x438e('0x67')];channels[_0x3ba1e0[_0x438e('0x7')]][_0x438e('0x59')]=_0x3ba1e0['appdata'];}}}catch(_0x3348c7){utils[_0x438e('0x1f')](util[_0x438e('0xa')](_0x438e('0x65'),_0x3ba1e0[_0x438e('0x7')]),_0x3348c7);}}; \ No newline at end of file +var _0x46c9=['[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','mohtime','diffTime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','xmd-callerid-preview','callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','execif','set','gotoif','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','endtime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt'];(function(_0x4e6e39,_0x2ebecf){var _0x4c80bc=function(_0x55615a){while(--_0x55615a){_0x4e6e39['push'](_0x4e6e39['shift']());}};_0x4c80bc(++_0x2ebecf);}(_0x46c9,0x106));var _0x946c=function(_0x2e75c8,_0x43557b){_0x2e75c8=_0x2e75c8-0x0;var _0x4ebdd0=_0x46c9[_0x2e75c8];return _0x4ebdd0;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x946c('0x0'));var transfers=require(_0x946c('0x1'));var dispositions=[_0x946c('0x2'),_0x946c('0x3'),_0x946c('0x3'),_0x946c('0x2'),_0x946c('0x2'),_0x946c('0x2'),_0x946c('0x4'),_0x946c('0x5'),_0x946c('0x3'),_0x946c('0x3'),_0x946c('0x3')];var channels={};function writeDB(_0x144180){var _0x42e785;if(transfers[_0x946c('0x6')][_0x144180[_0x946c('0x7')]]){_0x42e785=_0x144180[_0x946c('0x7')];_0x144180[_0x946c('0x7')]=transfers[_0x946c('0x6')][_0x144180['uniqueid']][_0x946c('0x8')];}utils[_0x946c('0x9')](util['format'](_0x946c('0xa'),_0x144180['uniqueid'],_0x144180[_0x946c('0xb')],_0x144180['queue'],_0x144180['membername'],_0x144180['interface'],_0x144180[_0x946c('0xc')],_0x144180[_0x946c('0xd')],_0x144180[_0x946c('0xe')]));if(_0x144180[_0x946c('0xf')]){utils[_0x946c('0x10')](_0x144180[_0x946c('0xf')])[_0x946c('0x11')](function(_0x3b1d13){if(_0x3b1d13){_0x144180[_0x946c('0x12')]=_0x3b1d13['id'];}utils[_0x946c('0x13')](_0x946c('0x14'),_0x144180);});}else{utils[_0x946c('0x13')]('CreateVoiceCallReport',_0x144180);}if(channels[_0x144180[_0x946c('0x7')]]){delete channels[_0x144180[_0x946c('0x7')]];}else if(_0x42e785&&channels[_0x42e785]){if(!transfers[_0x946c('0x6')][_0x42e785][_0x946c('0x15')])delete transfers[_0x946c('0x6')][_0x42e785];delete channels[_0x42e785];}}exports[_0x946c('0x16')]=function(_0x500fa4){try{utils[_0x946c('0x17')](util[_0x946c('0x18')](_0x946c('0x19'),_0x500fa4[_0x946c('0x7')]),_0x500fa4);if(_0x500fa4['uniqueid']==_0x500fa4[_0x946c('0x1a')]&&_0x500fa4['channel']!=_0x946c('0x1b')){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x1c'),_0x500fa4[_0x946c('0x7')],_0x500fa4[_0x946c('0x1d')],_0x500fa4[_0x946c('0x1e')]));channels[_0x500fa4[_0x946c('0x7')]]={'uniqueid':_0x500fa4[_0x946c('0x7')],'accountcode':_0x500fa4[_0x946c('0xf')],'source':_0x500fa4[_0x946c('0xc')],'destination':_0x500fa4[_0x946c('0x1e')],'destinationcontext':_0x500fa4['context'],'channel':_0x500fa4[_0x946c('0xb')],'starttime':utils[_0x946c('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x946c('0x2'),'amaflags':_0x946c('0x20')};}}catch(_0x4e4e35){utils['error'](util[_0x946c('0x18')](_0x946c('0x19'),_0x500fa4['uniqueid']),_0x4e4e35);}};exports[_0x946c('0x21')]=function(_0x3a4fc6){try{utils[_0x946c('0x17')](util[_0x946c('0x18')](_0x946c('0x22'),_0x3a4fc6[_0x946c('0x7')]),_0x3a4fc6);if(!_['isNil'](channels[_0x3a4fc6['uniqueid']])&&_0x3a4fc6[_0x946c('0x23')]==0x6){utils['info'](util[_0x946c('0x18')](_0x946c('0x24'),_0x3a4fc6['uniqueid'],_0x3a4fc6[_0x946c('0x1d')],_0x3a4fc6[_0x946c('0xb')]));if(_[_0x946c('0x25')](channels[_0x3a4fc6[_0x946c('0x7')]][_0x946c('0x26')])){channels[_0x3a4fc6[_0x946c('0x7')]][_0x946c('0x26')]=utils[_0x946c('0x1f')]();}}else if(!_[_0x946c('0x25')](channels[_0x3a4fc6[_0x946c('0x1a')]])&&_0x3a4fc6[_0x946c('0x23')]==0x6&&_0x3a4fc6[_0x946c('0x1d')]!=_0x946c('0x27')){utils[_0x946c('0x9')](util['format'](_0x946c('0x28'),_0x3a4fc6[_0x946c('0x7')],_0x3a4fc6[_0x946c('0x1a')],_0x3a4fc6['context'],_0x3a4fc6[_0x946c('0xb')]));channels[_0x3a4fc6[_0x946c('0x1a')]][_0x946c('0xf')]=_0x3a4fc6[_0x946c('0xf')];channels[_0x3a4fc6['linkedid']][_0x946c('0x29')]=_0x3a4fc6[_0x946c('0xb')];if(_[_0x946c('0x25')](channels[_0x3a4fc6[_0x946c('0x1a')]][_0x946c('0x2a')])){channels[_0x3a4fc6[_0x946c('0x1a')]]['answertime']=utils[_0x946c('0x1f')]();}channels[_0x3a4fc6[_0x946c('0x1a')]][_0x946c('0x2b')]=dispositions[_[_0x946c('0x2c')](_0x3a4fc6[_0x946c('0x23')])]||_0x946c('0x4');}}catch(_0xedd191){utils[_0x946c('0x2d')](util[_0x946c('0x18')](_0x946c('0x22'),_0x3a4fc6[_0x946c('0x7')]),_0xedd191);}};exports[_0x946c('0x2e')]=function(_0x10de53){try{if(!_[_0x946c('0x25')](channels[_0x10de53[_0x946c('0x7')]])){utils[_0x946c('0x17')](util['format'](_0x946c('0x2f'),_0x10de53[_0x946c('0x7')]),_0x10de53);if(_[_0x946c('0x25')](channels[_0x10de53[_0x946c('0x7')]]['callerid'])){channels[_0x10de53[_0x946c('0x7')]]['callerid']=_0x10de53[_0x946c('0x30')]+'\x20<'+_0x10de53[_0x946c('0xc')]+'>';}utils[_0x946c('0x9')](util['format'](_0x946c('0x31'),_0x10de53[_0x946c('0x7')],channels[_0x10de53['uniqueid']]['callerid'],_0x10de53[_0x946c('0x32')]));channels[_0x10de53[_0x946c('0x7')]]['endtime']=utils[_0x946c('0x1f')]();channels[_0x10de53['uniqueid']][_0x946c('0x33')]=utils['diffTime'](channels[_0x10de53[_0x946c('0x7')]][_0x946c('0x34')],channels[_0x10de53['uniqueid']]['starttime']);channels[_0x10de53[_0x946c('0x7')]][_0x946c('0x35')]=channels[_0x10de53[_0x946c('0x7')]][_0x946c('0x2a')]?utils['diffTime'](channels[_0x10de53[_0x946c('0x7')]][_0x946c('0x34')],channels[_0x10de53[_0x946c('0x7')]]['answertime']):0x0;writeDB(channels[_0x10de53[_0x946c('0x7')]]);}}catch(_0x502251){utils['error'](util['format']('[%s][calls][hangup]',_0x10de53['uniqueid']),_0x502251);}};exports[_0x946c('0x36')]=function(_0xec1098){try{if(!_[_0x946c('0x25')](channels[_0xec1098[_0x946c('0x37')]])){utils[_0x946c('0x17')](util[_0x946c('0x18')]('[%s][calls][attendedtransfer]',_0xec1098['origtransfereruniqueid']),_0xec1098);if(channels[_0xec1098[_0x946c('0x37')]][_0x946c('0xb')]==_0xec1098['transfereechannel']){utils[_0x946c('0x9')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xec1098[_0x946c('0x38')],_0xec1098[_0x946c('0x37')],_0xec1098['secondtransfererchannel']));channels[_0xec1098[_0x946c('0x37')]][_0x946c('0x29')]=_0xec1098[_0x946c('0x39')];channels[_0xec1098[_0x946c('0x37')]][_0x946c('0x3a')]=_0x946c('0x3b');}else if(channels[_0xec1098['localtwolinkedid']][_0x946c('0xb')]=_0xec1098['transfertargetchannel']){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x3c'),_0xec1098[_0x946c('0x38')],_0xec1098[_0x946c('0x37')],_0xec1098[_0x946c('0x3d')]));channels[_0xec1098[_0x946c('0x37')]]['destinationchannel']=_0xec1098[_0x946c('0x3d')];channels[_0xec1098[_0x946c('0x37')]][_0x946c('0x3a')]=_0x946c('0x3b');}}}catch(_0x53f6f1){utils[_0x946c('0x2d')](util[_0x946c('0x18')]('[%s][calls][attendedtransfer]',_0xec1098[_0x946c('0x38')]),_0x53f6f1);}};exports[_0x946c('0x3e')]=function(_0x189a29){try{if(!_[_0x946c('0x25')](channels[_0x189a29[_0x946c('0x7')]])){utils['debug'](util[_0x946c('0x18')](_0x946c('0x3f'),_0x189a29[_0x946c('0x7')]),_0x189a29);channels[_0x189a29[_0x946c('0x7')]][_0x946c('0x40')]=utils['now']();utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x41'),_0x189a29['uniqueid'],channels[_0x189a29['uniqueid']][_0x946c('0x40')]));}}catch(_0x352ce3){utils[_0x946c('0x2d')](util[_0x946c('0x18')]('[%s][calls][musiconholdstart]',_0x189a29['uniqueid']),_0x352ce3);}};exports['musiconholdstop']=function(_0x453545){try{if(!_['isNil'](channels[_0x453545[_0x946c('0x7')]])){utils['debug'](util[_0x946c('0x18')]('[%s][calls][musiconholdstop]',_0x453545[_0x946c('0x7')]),_0x453545);if(!_[_0x946c('0x25')](channels[_0x453545[_0x946c('0x7')]][_0x946c('0x40')])){channels[_0x453545[_0x946c('0x7')]][_0x946c('0x42')]+=utils[_0x946c('0x43')](utils[_0x946c('0x1f')](),channels[_0x453545[_0x946c('0x7')]][_0x946c('0x40')]);utils['info'](util[_0x946c('0x18')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x453545[_0x946c('0x7')],channels[_0x453545['uniqueid']]['mohtime']));delete channels[_0x453545[_0x946c('0x7')]][_0x946c('0x40')];}}}catch(_0x1ba2c6){utils[_0x946c('0x2d')](util[_0x946c('0x18')](_0x946c('0x44'),_0x453545[_0x946c('0x7')]),_0x1ba2c6);}};exports[_0x946c('0x45')]=function(_0x53c302){try{if(!_[_0x946c('0x25')](channels[_0x53c302[_0x946c('0x7')]])){utils['debug'](util['format'](_0x946c('0x46'),_0x53c302[_0x946c('0x7')]),_0x53c302);if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')][_0x946c('0x48')])){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x49'),_0x53c302[_0x946c('0x7')],_0x53c302['value']));channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x4a')]=_0x53c302[_0x946c('0x4b')];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')][_0x946c('0x4c')])){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x4d'),_0x53c302[_0x946c('0x7')],_0x53c302['value']));channels[_0x53c302[_0x946c('0x7')]]['destination']=_0x53c302[_0x946c('0x4b')];channels[_0x53c302[_0x946c('0x7')]]['callerid']='\x22'+_0x53c302[_0x946c('0x4b')]+_0x946c('0x4e')+_0x53c302[_0x946c('0x4b')]+'>';}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')]['xmd-callerid-preview'])||!_['isNil'](_0x53c302['variable'][_0x946c('0x4f')])){utils[_0x946c('0x9')](util[_0x946c('0x18')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x53c302[_0x946c('0x7')],!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')][_0x946c('0x50')])?'xmd-callerid-preview':_0x946c('0x4f'),_0x53c302[_0x946c('0x4b')]));channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x51')]=_0x53c302['value'];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')][_0x946c('0x52')])||!_['isNil'](_0x53c302[_0x946c('0x47')][_0x946c('0x53')])){utils[_0x946c('0x9')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x53c302[_0x946c('0x7')],!_['isNil'](_0x53c302[_0x946c('0x47')][_0x946c('0x52')])?_0x946c('0x52'):_0x946c('0x53'),_0x53c302[_0x946c('0x4b')]));channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x54')]=_0x946c('0x55');channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x56')]=_0x53c302['value'];channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x57')]=!![];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')]['xmd-contactid'])){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x58'),_0x53c302['uniqueid'],_0x53c302[_0x946c('0x4b')]));channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x59')]=_0x53c302[_0x946c('0x4b')];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')][_0x946c('0x5a')])){utils['info'](util[_0x946c('0x18')](_0x946c('0x5b'),_0x53c302[_0x946c('0x7')],_0x53c302[_0x946c('0x4b')]));channels[_0x53c302['uniqueid']][_0x946c('0x5c')]=_0x53c302[_0x946c('0x4b')];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')]['outboundrouteid'])){utils[_0x946c('0x9')](util[_0x946c('0x18')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x53c302[_0x946c('0x7')],_0x53c302[_0x946c('0x4b')]));channels[_0x53c302[_0x946c('0x7')]][_0x946c('0x5d')]=_0x53c302[_0x946c('0x4b')];}if(!_[_0x946c('0x25')](_0x53c302[_0x946c('0x47')]['sipcallid'])){utils[_0x946c('0x9')](util[_0x946c('0x18')](_0x946c('0x5e'),_0x53c302[_0x946c('0x7')],_0x53c302[_0x946c('0x4b')]));channels[_0x53c302[_0x946c('0x7')]]['sipcallid']=_0x53c302['value'];}}}catch(_0x8ec63c){utils[_0x946c('0x2d')](util[_0x946c('0x18')](_0x946c('0x46'),_0x53c302[_0x946c('0x7')]),_0x8ec63c);}};exports[_0x946c('0x5f')]=function(_0x5d0736){try{if(!_[_0x946c('0x25')](channels[_0x5d0736['uniqueid']])){utils[_0x946c('0x17')](util[_0x946c('0x18')](_0x946c('0x60'),_0x5d0736[_0x946c('0x7')]),_0x5d0736);utils[_0x946c('0x9')](util[_0x946c('0x18')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x5d0736['uniqueid'],_0x5d0736[_0x946c('0x61')],_0x5d0736['appdata']));if(_0x5d0736[_0x946c('0x61')][_0x946c('0x62')]()=='set'&&_[_0x946c('0x63')](_0x5d0736[_0x946c('0x64')]['toLowerCase'](),_0x946c('0x65'))){var _0x8131f5=_0x5d0736['appdata'][_0x946c('0x66')]('=');var _0x35cc1e=_0x8131f5[0x0][_0x946c('0x67')](_0x8131f5[0x0][_0x946c('0x68')]('(')+0x1,_0x8131f5[0x0][_0x946c('0x68')](')'));var _0x54cda7=_0x8131f5[0x1];channels[_0x5d0736['uniqueid']][_0x35cc1e]=_0x54cda7;}if(!_[_0x946c('0x69')]([_0x946c('0x2e'),'noop',_0x946c('0x6a'),_0x946c('0x6b'),_0x946c('0x6c')],_0x5d0736['application'][_0x946c('0x62')]())){channels[_0x5d0736[_0x946c('0x7')]][_0x946c('0x54')]=_0x5d0736[_0x946c('0x61')];channels[_0x5d0736[_0x946c('0x7')]][_0x946c('0x56')]=_0x5d0736[_0x946c('0x64')];}}}catch(_0x401b6a){utils['error'](util['format'](_0x946c('0x60'),_0x5d0736[_0x946c('0x7')]),_0x401b6a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 5c9be56..d0e6f96 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 _0xdcc0=['[core]\x20error','close','managerevent','./utils','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x409de6,_0x5479fb){var _0x5d5215=function(_0x3cc71c){while(--_0x3cc71c){_0x409de6['push'](_0x409de6['shift']());}};_0x5d5215(++_0x5479fb);}(_0xdcc0,0x1bb));var _0x0dcc=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xdcc0[_0x37bd26];return _0xe83dc4;};'use strict';var utils=require(_0x0dcc('0x0'));exports['connect']=function(){utils[_0x0dcc('0x1')](_0x0dcc('0x2'));};exports[_0x0dcc('0x3')]=function(){utils['info'](_0x0dcc('0x4'));};exports[_0x0dcc('0x5')]=function(){utils[_0x0dcc('0x1')](_0x0dcc('0x6'));};exports['error']=function(_0x17319e){utils[_0x0dcc('0x7')](_0x0dcc('0x8'),_0x17319e);};exports[_0x0dcc('0x9')]=function(){utils[_0x0dcc('0x1')]('[core]\x20close');};exports[_0x0dcc('0xa')]=function(_0x50d945){}; \ No newline at end of file +var _0x61c0=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown'];(function(_0xe35d46,_0x1395a3){var _0x22a60a=function(_0x24b45a){while(--_0x24b45a){_0xe35d46['push'](_0xe35d46['shift']());}};_0x22a60a(++_0x1395a3);}(_0x61c0,0x73));var _0x061c=function(_0x2b03f7,_0x143d71){_0x2b03f7=_0x2b03f7-0x0;var _0x462aad=_0x61c0[_0x2b03f7];return _0x462aad;};'use strict';var utils=require(_0x061c('0x0'));exports[_0x061c('0x1')]=function(){utils[_0x061c('0x2')](_0x061c('0x3'));};exports['shutdown']=function(){utils['info'](_0x061c('0x4'));};exports[_0x061c('0x5')]=function(){utils['info'](_0x061c('0x6'));};exports[_0x061c('0x7')]=function(_0x5b5831){utils[_0x061c('0x7')](_0x061c('0x8'),_0x5b5831);};exports[_0x061c('0x9')]=function(){utils[_0x061c('0x2')](_0x061c('0xa'));};exports[_0x061c('0xb')]=function(_0x491c24){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 79eb1db..ebb595e 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 _0xb367=['set','cdr(routeid)','[%s][dials][newexten]','varset','[%s][dials][varset]','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','isNil','[%s][dials][dialend]','assign','answertime','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','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase'];(function(_0x36d203,_0x3653f3){var _0x2f9e62=function(_0x461a77){while(--_0x461a77){_0x36d203['push'](_0x36d203['shift']());}};_0x2f9e62(++_0x3653f3);}(_0xb367,0xed));var _0x7b36=function(_0x4ba20e,_0x5d7255){_0x4ba20e=_0x4ba20e-0x0;var _0x1cda38=_0xb367[_0x4ba20e];return _0x1cda38;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x7b36('0x0'));var dials={};function writeDB(_0x251a1f){utils[_0x7b36('0x1')](util['format'](_0x7b36('0x2'),_0x251a1f[_0x7b36('0x3')],_0x251a1f[_0x7b36('0x4')],_0x251a1f[_0x7b36('0x5')],_0x251a1f[_0x7b36('0x6')],_0x251a1f[_0x7b36('0x7')],_0x251a1f[_0x7b36('0x8')]));utils[_0x7b36('0x9')](_0x7b36('0xa'),_0x251a1f);delete dials[_0x251a1f['uniqueid']];}exports[_0x7b36('0xb')]=function(_0x4ef9d4){try{utils[_0x7b36('0xc')](util[_0x7b36('0xd')]('[%s][dials][newexten]',_0x4ef9d4['uniqueid']),_0x4ef9d4);utils['info'](util[_0x7b36('0xd')](_0x7b36('0xe'),_0x4ef9d4['uniqueid'],_0x4ef9d4['application'],_0x4ef9d4[_0x7b36('0xf')]));if(_0x4ef9d4[_0x7b36('0x10')][_0x7b36('0x11')]()==_0x7b36('0x12')&&_['startsWith'](_0x4ef9d4[_0x7b36('0xf')][_0x7b36('0x11')](),_0x7b36('0x13'))){var _0x401c85=_0x4ef9d4[_0x7b36('0xf')]['split']('=');dials[_0x4ef9d4[_0x7b36('0x3')]]={'routeId':_0x401c85[0x1]};}}catch(_0x500163){utils['error'](util[_0x7b36('0xd')](_0x7b36('0x14'),_0x4ef9d4[_0x7b36('0x3')]),_0x500163);}};exports[_0x7b36('0x15')]=function(_0x108534){try{utils[_0x7b36('0xc')](util[_0x7b36('0xd')](_0x7b36('0x16'),_0x108534['uniqueid']),_0x108534);if(!_['isNil'](_0x108534[_0x7b36('0x17')]['outboundrouteid'])){utils['info'](util[_0x7b36('0xd')](_0x7b36('0x18'),_0x108534['uniqueid'],_0x108534[_0x7b36('0x19')]));dials[_0x108534[_0x7b36('0x3')]]={'routeId':_0x108534[_0x7b36('0x19')]};}}catch(_0x1ea5ed){utils[_0x7b36('0x1a')](util[_0x7b36('0xd')](_0x7b36('0x16'),_0x108534[_0x7b36('0x3')]),_0x1ea5ed);}};exports[_0x7b36('0x1b')]=function(_0x10a6ff){try{if(!_['isNil'](dials[_0x10a6ff[_0x7b36('0x3')]])){utils['debug'](util[_0x7b36('0xd')](_0x7b36('0x1c'),_0x10a6ff[_0x7b36('0x3')]),_0x10a6ff);dials[_0x10a6ff['uniqueid']]=_['assign'](dials[_0x10a6ff[_0x7b36('0x3')]],_0x10a6ff);dials[_0x10a6ff[_0x7b36('0x3')]][_0x7b36('0x1d')]=utils[_0x7b36('0x1e')]();dials[_0x10a6ff[_0x7b36('0x3')]][_0x7b36('0x1f')]=_0x7b36('0x20');utils[_0x7b36('0x1')](util[_0x7b36('0xd')](_0x7b36('0x21'),_0x10a6ff[_0x7b36('0x3')],dials[_0x10a6ff[_0x7b36('0x3')]][_0x7b36('0x1d')]));}}catch(_0x54c975){utils[_0x7b36('0x1a')](util['format'](_0x7b36('0x1c'),_0x10a6ff[_0x7b36('0x3')]),_0x54c975);}};exports[_0x7b36('0x22')]=function(_0x101631){try{if(!_[_0x7b36('0x23')](dials[_0x101631[_0x7b36('0x3')]])){utils[_0x7b36('0xc')](util[_0x7b36('0xd')](_0x7b36('0x24'),_0x101631[_0x7b36('0x3')]),_0x101631);dials[_0x101631[_0x7b36('0x3')]][_0x7b36('0x8')]=_0x101631[_0x7b36('0x8')];if(_0x101631[_0x7b36('0x8')]=='ANSWER'){dials[_0x101631[_0x7b36('0x3')]]=_[_0x7b36('0x25')](dials[_0x101631[_0x7b36('0x3')]],_0x101631);dials[_0x101631[_0x7b36('0x3')]][_0x7b36('0x26')]=utils[_0x7b36('0x1e')]();dials[_0x101631['uniqueid']][_0x7b36('0x1f')]=_0x7b36('0x27');utils[_0x7b36('0x1')](util['format'](_0x7b36('0x28'),_0x101631[_0x7b36('0x3')],_0x101631['dialstatus'],dials[_0x101631[_0x7b36('0x3')]][_0x7b36('0x26')]));}else{utils[_0x7b36('0x1')](util[_0x7b36('0xd')](_0x7b36('0x29'),_0x101631[_0x7b36('0x3')],_0x101631[_0x7b36('0x8')]));}}}catch(_0x2c00e8){utils[_0x7b36('0x1a')](util['format']('[%s][dials][dialend]',_0x101631[_0x7b36('0x3')]),_0x2c00e8);}};exports['hangup']=function(_0x135567){try{if(!_[_0x7b36('0x23')](dials[_0x135567[_0x7b36('0x3')]])){utils[_0x7b36('0xc')](util[_0x7b36('0xd')](_0x7b36('0x2a'),_0x135567[_0x7b36('0x3')]),_0x135567);utils[_0x7b36('0x1')](util[_0x7b36('0xd')](_0x7b36('0x2b'),_0x135567['uniqueid'],_0x135567[_0x7b36('0x6')],_0x135567['calleridname'],_0x135567[_0x7b36('0x2c')]));dials[_0x135567['uniqueid']]=_[_0x7b36('0x25')](dials[_0x135567[_0x7b36('0x3')]],{'endtime':utils[_0x7b36('0x1e')](),'lastevent':_0x7b36('0x2d')});dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x2e')]=utils[_0x7b36('0x2f')](dials[_0x135567['uniqueid']][_0x7b36('0x30')],dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x1d')]);dials[_0x135567['uniqueid']][_0x7b36('0x31')]=utils[_0x7b36('0x2f')](dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x26')]||dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x30')],dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x1d')]);dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x32')]=dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x26')]?utils[_0x7b36('0x2f')](dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x30')],dials[_0x135567[_0x7b36('0x3')]][_0x7b36('0x26')]):0x0;writeDB(dials[_0x135567[_0x7b36('0x3')]]);}}catch(_0x151c26){utils[_0x7b36('0x1a')](util[_0x7b36('0xd')]('[%s][dials][hangup]',_0x135567[_0x7b36('0x3')]),_0x151c26);}}; \ No newline at end of file +var _0xd157=['connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','uniqueid','info','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','varset','[%s][dials][varset]','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','dialend','ANSWER','connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum'];(function(_0x22632e,_0x3d8de7){var _0x475d48=function(_0x427f4f){while(--_0x427f4f){_0x22632e['push'](_0x22632e['shift']());}};_0x475d48(++_0x3d8de7);}(_0xd157,0x1c5));var _0x7d15=function(_0x4f4b1a,_0x17722d){_0x4f4b1a=_0x4f4b1a-0x0;var _0x1ac278=_0xd157[_0x4f4b1a];return _0x1ac278;};'use strict';var _=require(_0x7d15('0x0'));var util=require('util');var utils=require(_0x7d15('0x1'));var dials={};function writeDB(_0xc6dea9){utils['info'](util[_0x7d15('0x2')](_0x7d15('0x3'),_0xc6dea9['uniqueid'],_0xc6dea9[_0x7d15('0x4')],_0xc6dea9[_0x7d15('0x5')],_0xc6dea9[_0x7d15('0x6')],_0xc6dea9[_0x7d15('0x7')],_0xc6dea9[_0x7d15('0x8')]));utils['request'](_0x7d15('0x9'),_0xc6dea9);delete dials[_0xc6dea9['uniqueid']];}exports[_0x7d15('0xa')]=function(_0x481573){try{utils[_0x7d15('0xb')](util[_0x7d15('0x2')](_0x7d15('0xc'),_0x481573[_0x7d15('0xd')]),_0x481573);utils[_0x7d15('0xe')](util[_0x7d15('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x481573[_0x7d15('0xd')],_0x481573[_0x7d15('0xf')],_0x481573[_0x7d15('0x10')]));if(_0x481573[_0x7d15('0xf')][_0x7d15('0x11')]()==_0x7d15('0x12')&&_[_0x7d15('0x13')](_0x481573[_0x7d15('0x10')][_0x7d15('0x11')](),_0x7d15('0x14'))){var _0x4cd797=_0x481573[_0x7d15('0x10')]['split']('=');dials[_0x481573[_0x7d15('0xd')]]={'routeId':_0x4cd797[0x1]};}}catch(_0x5d47b7){utils[_0x7d15('0x15')](util[_0x7d15('0x2')](_0x7d15('0xc'),_0x481573[_0x7d15('0xd')]),_0x5d47b7);}};exports[_0x7d15('0x16')]=function(_0x262c92){try{utils[_0x7d15('0xb')](util[_0x7d15('0x2')](_0x7d15('0x17'),_0x262c92[_0x7d15('0xd')]),_0x262c92);if(!_['isNil'](_0x262c92['variable'][_0x7d15('0x18')])){utils['info'](util[_0x7d15('0x2')](_0x7d15('0x19'),_0x262c92[_0x7d15('0xd')],_0x262c92['value']));dials[_0x262c92[_0x7d15('0xd')]]={'routeId':_0x262c92[_0x7d15('0x1a')]};}}catch(_0x4f6244){utils[_0x7d15('0x15')](util[_0x7d15('0x2')](_0x7d15('0x17'),_0x262c92['uniqueid']),_0x4f6244);}};exports['dialbegin']=function(_0x15fcac){try{if(!_['isNil'](dials[_0x15fcac[_0x7d15('0xd')]])){utils[_0x7d15('0xb')](util['format'](_0x7d15('0x1b'),_0x15fcac[_0x7d15('0xd')]),_0x15fcac);dials[_0x15fcac[_0x7d15('0xd')]]=_[_0x7d15('0x1c')](dials[_0x15fcac[_0x7d15('0xd')]],_0x15fcac);dials[_0x15fcac[_0x7d15('0xd')]][_0x7d15('0x1d')]=utils[_0x7d15('0x1e')]();dials[_0x15fcac[_0x7d15('0xd')]][_0x7d15('0x1f')]=_0x7d15('0x20');utils[_0x7d15('0xe')](util[_0x7d15('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x15fcac[_0x7d15('0xd')],dials[_0x15fcac[_0x7d15('0xd')]][_0x7d15('0x1d')]));}}catch(_0x5c769f){utils['error'](util['format'](_0x7d15('0x1b'),_0x15fcac[_0x7d15('0xd')]),_0x5c769f);}};exports[_0x7d15('0x21')]=function(_0x319fe2){try{if(!_['isNil'](dials[_0x319fe2[_0x7d15('0xd')]])){utils[_0x7d15('0xb')](util[_0x7d15('0x2')]('[%s][dials][dialend]',_0x319fe2[_0x7d15('0xd')]),_0x319fe2);dials[_0x319fe2[_0x7d15('0xd')]][_0x7d15('0x8')]=_0x319fe2[_0x7d15('0x8')];if(_0x319fe2[_0x7d15('0x8')]==_0x7d15('0x22')){dials[_0x319fe2[_0x7d15('0xd')]]=_['assign'](dials[_0x319fe2[_0x7d15('0xd')]],_0x319fe2);dials[_0x319fe2['uniqueid']]['answertime']=utils['now']();dials[_0x319fe2['uniqueid']]['lastevent']=_0x7d15('0x23');utils[_0x7d15('0xe')](util[_0x7d15('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x319fe2['uniqueid'],_0x319fe2[_0x7d15('0x8')],dials[_0x319fe2['uniqueid']][_0x7d15('0x24')]));}else{utils[_0x7d15('0xe')](util[_0x7d15('0x2')](_0x7d15('0x25'),_0x319fe2[_0x7d15('0xd')],_0x319fe2[_0x7d15('0x8')]));}}}catch(_0x311af1){utils[_0x7d15('0x15')](util[_0x7d15('0x2')]('[%s][dials][dialend]',_0x319fe2['uniqueid']),_0x311af1);}};exports[_0x7d15('0x26')]=function(_0x11e087){try{if(!_['isNil'](dials[_0x11e087[_0x7d15('0xd')]])){utils[_0x7d15('0xb')](util['format'](_0x7d15('0x27'),_0x11e087['uniqueid']),_0x11e087);utils[_0x7d15('0xe')](util[_0x7d15('0x2')](_0x7d15('0x28'),_0x11e087[_0x7d15('0xd')],_0x11e087[_0x7d15('0x6')],_0x11e087[_0x7d15('0x29')],_0x11e087[_0x7d15('0x2a')]));dials[_0x11e087[_0x7d15('0xd')]]=_[_0x7d15('0x1c')](dials[_0x11e087[_0x7d15('0xd')]],{'endtime':utils[_0x7d15('0x1e')](),'lastevent':_0x7d15('0x2b')});dials[_0x11e087[_0x7d15('0xd')]]['duration']=utils[_0x7d15('0x2c')](dials[_0x11e087[_0x7d15('0xd')]][_0x7d15('0x2d')],dials[_0x11e087[_0x7d15('0xd')]]['starttime']);dials[_0x11e087[_0x7d15('0xd')]]['holdtime']=utils[_0x7d15('0x2c')](dials[_0x11e087[_0x7d15('0xd')]][_0x7d15('0x24')]||dials[_0x11e087['uniqueid']][_0x7d15('0x2d')],dials[_0x11e087['uniqueid']]['starttime']);dials[_0x11e087[_0x7d15('0xd')]]['billableseconds']=dials[_0x11e087['uniqueid']][_0x7d15('0x24')]?utils[_0x7d15('0x2c')](dials[_0x11e087[_0x7d15('0xd')]][_0x7d15('0x2d')],dials[_0x11e087[_0x7d15('0xd')]][_0x7d15('0x24')]):0x0;writeDB(dials[_0x11e087['uniqueid']]);}}catch(_0x49dad7){utils['error'](util[_0x7d15('0x2')](_0x7d15('0x27'),_0x11e087['uniqueid']),_0x49dad7);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 14490f5..104c08e 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 _0x97e2=['[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]'];(function(_0x4750a2,_0x27935b){var _0x2a1af1=function(_0x2ee8d7){while(--_0x2ee8d7){_0x4750a2['push'](_0x4750a2['shift']());}};_0x2a1af1(++_0x27935b);}(_0x97e2,0x1b7));var _0x297e=function(_0x586a6d,_0x492b26){_0x586a6d=_0x586a6d-0x0;var _0x206e86=_0x97e2[_0x586a6d];return _0x206e86;};var AsteriskManager=require('asterisk-manager');var config=require(_0x297e('0x0'));var utils=require(_0x297e('0x1'));var util=require(_0x297e('0x2'));var ami=new AsteriskManager(config[_0x297e('0x3')][_0x297e('0x4')],config['asterisk']['ip'],config[_0x297e('0x3')][_0x297e('0x5')],config[_0x297e('0x3')][_0x297e('0x6')],!![]);ami[_0x297e('0x7')]();if(config[_0x297e('0x8')]&&config['xdr']['disabled']){utils[_0x297e('0x9')](_0x297e('0xa'));}else{var agents=require(_0x297e('0xb'));var calls=require(_0x297e('0xc'));var queues=require(_0x297e('0xd'));var recordings=require(_0x297e('0xe'));var members=require(_0x297e('0xf'));var dials=require(_0x297e('0x10'));var transfers=require(_0x297e('0x11'));var core=require(_0x297e('0x12'));ami['on'](_0x297e('0x13'),core[_0x297e('0x13')]);ami['on']('shutdown',core[_0x297e('0x14')]);ami['on'](_0x297e('0x15'),core[_0x297e('0x15')]);ami['on'](_0x297e('0x16'),core[_0x297e('0x16')]);ami['on'](_0x297e('0x17'),core[_0x297e('0x17')]);ami['on']('managerevent',core[_0x297e('0x18')]);ami['on']('devicestatechange',function(_0x4462bc){try{utils['debug'](util[_0x297e('0x19')]('[%s][index][devicestatechange]',_0x4462bc[_0x297e('0x1a')]),_0x4462bc);members[_0x297e('0x1b')](_0x4462bc);}catch(_0x438010){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x1c'),_0x4462bc[_0x297e('0x1a')]),_0x438010);}});ami['on'](_0x297e('0x1d'),function(_0x5bb00a){try{utils['debug'](util['format'](_0x297e('0x1e'),_0x5bb00a[_0x297e('0x1f')]),_0x5bb00a);agents['agentcalled'](_0x5bb00a);}catch(_0xf26ac0){utils[_0x297e('0x16')](util['format'](_0x297e('0x1e'),_0x5bb00a[_0x297e('0x1f')]),_0xf26ac0);}});ami['on'](_0x297e('0x20'),function(_0x131800){try{utils[_0x297e('0x21')](util['format'](_0x297e('0x22'),_0x131800[_0x297e('0x1f')]),_0x131800);agents[_0x297e('0x20')](_0x131800);}catch(_0x4dc684){utils['error'](util[_0x297e('0x19')](_0x297e('0x22'),_0x131800[_0x297e('0x1f')]),_0x4dc684);}});ami['on'](_0x297e('0x23'),function(_0x101b78){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x24'),_0x101b78[_0x297e('0x1f')]),_0x101b78);agents[_0x297e('0x23')](_0x101b78);queues['agentconnect'](_0x101b78);}catch(_0x1d74d9){utils['error'](util[_0x297e('0x19')](_0x297e('0x24'),_0x101b78['uniqueid']),_0x1d74d9);}});ami['on']('agentcomplete',function(_0x491055){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x25'),_0x491055[_0x297e('0x1f')]),_0x491055);agents[_0x297e('0x26')](_0x491055);queues[_0x297e('0x26')](_0x491055);members[_0x297e('0x26')](_0x491055);}catch(_0x435c18){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x25'),_0x491055['uniqueid']),_0x435c18);}});ami['on'](_0x297e('0x27'),function(_0x9de790){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x9de790[_0x297e('0x1f')]),_0x9de790);agents[_0x297e('0x27')](_0x9de790);queues[_0x297e('0x27')](_0x9de790);}catch(_0x1ca669){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x28'),_0x9de790[_0x297e('0x1f')]),_0x1ca669);}});ami['on']('queuecallerjoin',function(_0x9114f2){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x29'),_0x9114f2[_0x297e('0x1f')]),_0x9114f2);queues[_0x297e('0x2a')](_0x9114f2);recordings[_0x297e('0x2a')](_0x9114f2);}catch(_0x2ab54a){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x29'),_0x9114f2[_0x297e('0x1f')]),_0x2ab54a);}});ami['on'](_0x297e('0x2b'),function(_0x196b4e){try{utils['debug'](util[_0x297e('0x19')](_0x297e('0x2c'),_0x196b4e[_0x297e('0x1f')]),_0x196b4e);queues[_0x297e('0x2b')](_0x196b4e);}catch(_0x46e3e2){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x2c'),_0x196b4e[_0x297e('0x1f')]),_0x46e3e2);}});ami['on'](_0x297e('0x2d'),function(_0x3cffda){try{utils['debug'](util[_0x297e('0x19')](_0x297e('0x2e'),_0x3cffda['uniqueid']),_0x3cffda);queues[_0x297e('0x2d')](_0x3cffda);calls['musiconholdstart'](_0x3cffda);}catch(_0x856242){utils[_0x297e('0x16')](util['format']('[%s][index][musiconholdstart]',_0x3cffda[_0x297e('0x1f')]),_0x856242);}});ami['on'](_0x297e('0x2f'),function(_0x2adcf9){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x30'),_0x2adcf9[_0x297e('0x1f')]),_0x2adcf9);queues['musiconholdstop'](_0x2adcf9);calls[_0x297e('0x2f')](_0x2adcf9);}catch(_0x369ee3){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x30'),_0x2adcf9[_0x297e('0x1f')]),_0x369ee3);}});ami['on'](_0x297e('0x31'),function(_0xd6ded3){try{utils['debug'](util[_0x297e('0x19')](_0x297e('0x32'),_0xd6ded3['uniqueid']),_0xd6ded3);calls['newstate'](_0xd6ded3);recordings[_0x297e('0x31')](_0xd6ded3);}catch(_0x3bc5ee){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x32'),_0xd6ded3[_0x297e('0x1f')]),_0x3bc5ee);}});ami['on'](_0x297e('0x33'),function(_0x392db1){try{utils['debug'](util[_0x297e('0x19')](_0x297e('0x34'),_0x392db1[_0x297e('0x1f')]),_0x392db1);calls[_0x297e('0x33')](_0x392db1);recordings[_0x297e('0x33')](_0x392db1);dials[_0x297e('0x33')](_0x392db1);agents[_0x297e('0x33')](_0x392db1);queues[_0x297e('0x33')](_0x392db1);}catch(_0x283433){utils[_0x297e('0x16')](util['format'](_0x297e('0x34'),_0x392db1[_0x297e('0x1f')]),_0x283433);}});ami['on'](_0x297e('0x35'),function(_0x5013c3){try{utils[_0x297e('0x21')](util['format'](_0x297e('0x36'),_0x5013c3[_0x297e('0x1f')]),_0x5013c3);members[_0x297e('0x35')](_0x5013c3);}catch(_0x3ff566){utils['error'](util['format'](_0x297e('0x36'),_0x5013c3[_0x297e('0x1f')]),_0x3ff566);}});ami['on'](_0x297e('0x37'),function(_0x1eb044){try{utils['debug'](util[_0x297e('0x19')]('[%s][index][blindtransfer]',_0x1eb044[_0x297e('0x1f')]),_0x1eb044);queues[_0x297e('0x37')](_0x1eb044);agents[_0x297e('0x37')](_0x1eb044);transfers[_0x297e('0x37')](_0x1eb044);recordings['blindtransfer'](_0x1eb044);}catch(_0x2bc9f9){utils['error'](util['format']('[%s][index][blindtransfer]',_0x1eb044['uniqueid']),_0x2bc9f9);}});ami['on']('attendedtransfer',function(_0x4ab37d){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x38'),_0x4ab37d['origtransfereruniqueid']),_0x4ab37d);queues['attendedtransfer'](_0x4ab37d);transfers[_0x297e('0x39')](_0x4ab37d);agents[_0x297e('0x39')](_0x4ab37d);calls[_0x297e('0x39')](_0x4ab37d);}catch(_0x243509){utils[_0x297e('0x16')](util[_0x297e('0x19')](_0x297e('0x38'),_0x4ab37d[_0x297e('0x3a')]),_0x243509);}});ami['on'](_0x297e('0x3b'),function(_0x58d1ba){try{utils[_0x297e('0x21')](util[_0x297e('0x19')](_0x297e('0x3c'),_0x58d1ba[_0x297e('0x1f')]),_0x58d1ba);queues[_0x297e('0x3b')](_0x58d1ba);recordings['varset'](_0x58d1ba);calls[_0x297e('0x3b')](_0x58d1ba);dials[_0x297e('0x3b')](_0x58d1ba);}catch(_0x131a48){utils['error'](util[_0x297e('0x19')](_0x297e('0x3c'),_0x58d1ba[_0x297e('0x1f')]),_0x131a48);}});ami['on'](_0x297e('0x3d'),function(_0xe54dc){try{utils[_0x297e('0x21')](util[_0x297e('0x19')]('[%s][index][newexten]',_0xe54dc['uniqueid']),_0xe54dc);calls['newexten'](_0xe54dc);recordings[_0x297e('0x3d')](_0xe54dc);dials[_0x297e('0x3d')](_0xe54dc);}catch(_0x50dbbc){utils[_0x297e('0x16')](util[_0x297e('0x19')]('[%s][index][newexten]',_0xe54dc[_0x297e('0x1f')]),_0x50dbbc);}});ami['on']('newchannel',function(_0x54604b){try{utils[_0x297e('0x21')](util['format']('[%s][index][newchannel]',_0x54604b[_0x297e('0x1f')]),_0x54604b);calls[_0x297e('0x3e')](_0x54604b);recordings[_0x297e('0x3e')](_0x54604b);}catch(_0xd6f8f9){utils['error'](util[_0x297e('0x19')](_0x297e('0x3f'),_0x54604b[_0x297e('0x1f')]),_0xd6f8f9);}});ami['on'](_0x297e('0x40'),function(_0xe4b69a){try{utils[_0x297e('0x21')](util[_0x297e('0x19')]('[%s][index][dialbegin]',_0xe4b69a[_0x297e('0x1f')]),_0xe4b69a);dials['dialbegin'](_0xe4b69a);}catch(_0x486e16){utils['error'](util[_0x297e('0x19')](_0x297e('0x41'),_0xe4b69a[_0x297e('0x1f')]),_0x486e16);}});ami['on'](_0x297e('0x42'),function(_0x139189){try{utils[_0x297e('0x21')](util[_0x297e('0x19')]('[%s][index][dialend]',_0x139189[_0x297e('0x1f')]),_0x139189);dials[_0x297e('0x42')](_0x139189);}catch(_0x5d951d){utils['error'](util[_0x297e('0x19')](_0x297e('0x43'),_0x139189[_0x297e('0x1f')]),_0x5d951d);}});} \ No newline at end of file +var _0x8ae4=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','util','asterisk','port','keepConnected','xdr','disabled','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x202b7c,_0x143753){var _0x3b5401=function(_0x18d507){while(--_0x18d507){_0x202b7c['push'](_0x202b7c['shift']());}};_0x3b5401(++_0x143753);}(_0x8ae4,0xd8));var _0x48ae=function(_0x330168,_0x53568e){_0x330168=_0x330168-0x0;var _0x26e50a=_0x8ae4[_0x330168];return _0x26e50a;};var AsteriskManager=require(_0x48ae('0x0'));var config=require(_0x48ae('0x1'));var utils=require(_0x48ae('0x2'));var util=require(_0x48ae('0x3'));var ami=new AsteriskManager(config[_0x48ae('0x4')][_0x48ae('0x5')],config[_0x48ae('0x4')]['ip'],config['asterisk']['username'],config['asterisk']['password'],!![]);ami[_0x48ae('0x6')]();if(config[_0x48ae('0x7')]&&config[_0x48ae('0x7')][_0x48ae('0x8')]){utils[_0x48ae('0x9')]('XDR\x20DISABLED');}else{var agents=require(_0x48ae('0xa'));var calls=require(_0x48ae('0xb'));var queues=require(_0x48ae('0xc'));var recordings=require(_0x48ae('0xd'));var members=require('./members.controller');var dials=require(_0x48ae('0xe'));var transfers=require(_0x48ae('0xf'));var core=require(_0x48ae('0x10'));ami['on'](_0x48ae('0x11'),core[_0x48ae('0x11')]);ami['on']('shutdown',core[_0x48ae('0x12')]);ami['on'](_0x48ae('0x13'),core['fullybooted']);ami['on']('error',core[_0x48ae('0x14')]);ami['on'](_0x48ae('0x15'),core[_0x48ae('0x15')]);ami['on'](_0x48ae('0x16'),core[_0x48ae('0x16')]);ami['on'](_0x48ae('0x17'),function(_0x588efd){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')]('[%s][index][devicestatechange]',_0x588efd[_0x48ae('0x1a')]),_0x588efd);members[_0x48ae('0x17')](_0x588efd);}catch(_0x4e40c7){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x1b'),_0x588efd['device']),_0x4e40c7);}});ami['on'](_0x48ae('0x1c'),function(_0x466c26){try{utils[_0x48ae('0x18')](util['format'](_0x48ae('0x1d'),_0x466c26[_0x48ae('0x1e')]),_0x466c26);agents[_0x48ae('0x1c')](_0x466c26);}catch(_0x3fd7de){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x1d'),_0x466c26[_0x48ae('0x1e')]),_0x3fd7de);}});ami['on']('agentringnoanswer',function(_0x850955){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')](_0x48ae('0x1f'),_0x850955['uniqueid']),_0x850955);agents[_0x48ae('0x20')](_0x850955);}catch(_0xc0406d){utils[_0x48ae('0x14')](util[_0x48ae('0x19')]('[%s][index][agentringnoanswer]',_0x850955['uniqueid']),_0xc0406d);}});ami['on'](_0x48ae('0x21'),function(_0x11c8c3){try{utils['debug'](util[_0x48ae('0x19')](_0x48ae('0x22'),_0x11c8c3[_0x48ae('0x1e')]),_0x11c8c3);agents['agentconnect'](_0x11c8c3);queues[_0x48ae('0x21')](_0x11c8c3);}catch(_0x58ebc6){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x22'),_0x11c8c3[_0x48ae('0x1e')]),_0x58ebc6);}});ami['on']('agentcomplete',function(_0xd027fb){try{utils[_0x48ae('0x18')](util['format'](_0x48ae('0x23'),_0xd027fb[_0x48ae('0x1e')]),_0xd027fb);agents['agentcomplete'](_0xd027fb);queues[_0x48ae('0x24')](_0xd027fb);members[_0x48ae('0x24')](_0xd027fb);}catch(_0x34ece0){utils[_0x48ae('0x14')](util[_0x48ae('0x19')]('[%s][index][agentcomplete]',_0xd027fb[_0x48ae('0x1e')]),_0x34ece0);}});ami['on'](_0x48ae('0x25'),function(_0x116821){try{utils[_0x48ae('0x18')](util['format']('[%s][index][queuecallerabandon]',_0x116821[_0x48ae('0x1e')]),_0x116821);agents[_0x48ae('0x25')](_0x116821);queues['queuecallerabandon'](_0x116821);}catch(_0x400d62){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x26'),_0x116821[_0x48ae('0x1e')]),_0x400d62);}});ami['on'](_0x48ae('0x27'),function(_0x418bdb){try{utils[_0x48ae('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x418bdb[_0x48ae('0x1e')]),_0x418bdb);queues[_0x48ae('0x27')](_0x418bdb);recordings[_0x48ae('0x27')](_0x418bdb);}catch(_0x1aceda){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x28'),_0x418bdb[_0x48ae('0x1e')]),_0x1aceda);}});ami['on'](_0x48ae('0x29'),function(_0x45bc7d){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')]('[%s][index][queuecallerleave]',_0x45bc7d[_0x48ae('0x1e')]),_0x45bc7d);queues[_0x48ae('0x29')](_0x45bc7d);}catch(_0x29922e){utils['error'](util[_0x48ae('0x19')](_0x48ae('0x2a'),_0x45bc7d['uniqueid']),_0x29922e);}});ami['on']('musiconholdstart',function(_0x30b5cf){try{utils['debug'](util['format'](_0x48ae('0x2b'),_0x30b5cf['uniqueid']),_0x30b5cf);queues[_0x48ae('0x2c')](_0x30b5cf);calls[_0x48ae('0x2c')](_0x30b5cf);}catch(_0x502a48){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x2b'),_0x30b5cf[_0x48ae('0x1e')]),_0x502a48);}});ami['on'](_0x48ae('0x2d'),function(_0x84d83){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')](_0x48ae('0x2e'),_0x84d83[_0x48ae('0x1e')]),_0x84d83);queues[_0x48ae('0x2d')](_0x84d83);calls[_0x48ae('0x2d')](_0x84d83);}catch(_0x4dc89e){utils[_0x48ae('0x14')](util['format'](_0x48ae('0x2e'),_0x84d83['uniqueid']),_0x4dc89e);}});ami['on'](_0x48ae('0x2f'),function(_0x36f4d6){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')](_0x48ae('0x30'),_0x36f4d6['uniqueid']),_0x36f4d6);calls['newstate'](_0x36f4d6);recordings['newstate'](_0x36f4d6);}catch(_0x2f4c54){utils['error'](util[_0x48ae('0x19')]('[%s][index][newstate]',_0x36f4d6[_0x48ae('0x1e')]),_0x2f4c54);}});ami['on'](_0x48ae('0x31'),function(_0x53a6df){try{utils['debug'](util[_0x48ae('0x19')](_0x48ae('0x32'),_0x53a6df[_0x48ae('0x1e')]),_0x53a6df);calls[_0x48ae('0x31')](_0x53a6df);recordings[_0x48ae('0x31')](_0x53a6df);dials['hangup'](_0x53a6df);agents[_0x48ae('0x31')](_0x53a6df);queues[_0x48ae('0x31')](_0x53a6df);}catch(_0x312129){utils['error'](util[_0x48ae('0x19')]('[%s][index][hangup]',_0x53a6df[_0x48ae('0x1e')]),_0x312129);}});ami['on'](_0x48ae('0x33'),function(_0x4da1db){try{utils['debug'](util[_0x48ae('0x19')](_0x48ae('0x34'),_0x4da1db[_0x48ae('0x1e')]),_0x4da1db);members[_0x48ae('0x33')](_0x4da1db);}catch(_0x4df6c3){utils['error'](util['format'](_0x48ae('0x34'),_0x4da1db[_0x48ae('0x1e')]),_0x4df6c3);}});ami['on'](_0x48ae('0x35'),function(_0x9d3c25){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')](_0x48ae('0x36'),_0x9d3c25['uniqueid']),_0x9d3c25);queues[_0x48ae('0x35')](_0x9d3c25);agents[_0x48ae('0x35')](_0x9d3c25);transfers[_0x48ae('0x35')](_0x9d3c25);recordings[_0x48ae('0x35')](_0x9d3c25);}catch(_0x564c00){utils[_0x48ae('0x14')](util[_0x48ae('0x19')]('[%s][index][blindtransfer]',_0x9d3c25['uniqueid']),_0x564c00);}});ami['on'](_0x48ae('0x37'),function(_0x391ddf){try{utils[_0x48ae('0x18')](util['format'](_0x48ae('0x38'),_0x391ddf['origtransfereruniqueid']),_0x391ddf);queues['attendedtransfer'](_0x391ddf);transfers[_0x48ae('0x37')](_0x391ddf);agents[_0x48ae('0x37')](_0x391ddf);calls[_0x48ae('0x37')](_0x391ddf);}catch(_0x36635a){utils[_0x48ae('0x14')](util[_0x48ae('0x19')](_0x48ae('0x38'),_0x391ddf['origtransfereruniqueid']),_0x36635a);}});ami['on'](_0x48ae('0x39'),function(_0x36febe){try{utils['debug'](util[_0x48ae('0x19')](_0x48ae('0x3a'),_0x36febe[_0x48ae('0x1e')]),_0x36febe);queues[_0x48ae('0x39')](_0x36febe);recordings[_0x48ae('0x39')](_0x36febe);calls[_0x48ae('0x39')](_0x36febe);dials['varset'](_0x36febe);}catch(_0x4ccf24){utils[_0x48ae('0x14')](util[_0x48ae('0x19')]('[%s][index][varset]',_0x36febe[_0x48ae('0x1e')]),_0x4ccf24);}});ami['on'](_0x48ae('0x3b'),function(_0x303775){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')]('[%s][index][newexten]',_0x303775[_0x48ae('0x1e')]),_0x303775);calls[_0x48ae('0x3b')](_0x303775);recordings[_0x48ae('0x3b')](_0x303775);dials[_0x48ae('0x3b')](_0x303775);}catch(_0x2f3860){utils['error'](util[_0x48ae('0x19')](_0x48ae('0x3c'),_0x303775['uniqueid']),_0x2f3860);}});ami['on'](_0x48ae('0x3d'),function(_0x25c4fa){try{utils[_0x48ae('0x18')](util['format']('[%s][index][newchannel]',_0x25c4fa[_0x48ae('0x1e')]),_0x25c4fa);calls[_0x48ae('0x3d')](_0x25c4fa);recordings[_0x48ae('0x3d')](_0x25c4fa);}catch(_0x263193){utils[_0x48ae('0x14')](util['format'](_0x48ae('0x3e'),_0x25c4fa[_0x48ae('0x1e')]),_0x263193);}});ami['on'](_0x48ae('0x3f'),function(_0xc4a3a0){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')]('[%s][index][dialbegin]',_0xc4a3a0[_0x48ae('0x1e')]),_0xc4a3a0);dials[_0x48ae('0x3f')](_0xc4a3a0);}catch(_0x9deb7){utils['error'](util['format'](_0x48ae('0x40'),_0xc4a3a0[_0x48ae('0x1e')]),_0x9deb7);}});ami['on']('dialend',function(_0x234b89){try{utils[_0x48ae('0x18')](util[_0x48ae('0x19')](_0x48ae('0x41'),_0x234b89[_0x48ae('0x1e')]),_0x234b89);dials[_0x48ae('0x42')](_0x234b89);}catch(_0x4cc7cd){utils['error'](util[_0x48ae('0x19')](_0x48ae('0x41'),_0x234b89[_0x48ae('0x1e')]),_0x4cc7cd);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 7ea9b40..ccbebfc 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 _0x12f1=['./utils','Local/_attended@transfer','Queue:','info','interface','data2','membername','type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error','format','[%s][members][writeDB]','uniqueid','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','now','NOT_INUSE','duration','diffTime','exitAt','isNil','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','channel','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash'];(function(_0x50d22e,_0x27b956){var _0x482340=function(_0x101f4e){while(--_0x101f4e){_0x50d22e['push'](_0x50d22e['shift']());}};_0x482340(++_0x27b956);}(_0x12f1,0xf4));var _0x112f=function(_0x47db33,_0x55110f){_0x47db33=_0x47db33-0x0;var _0x333cef=_0x12f1[_0x47db33];return _0x333cef;};'use strict';var _=require(_0x112f('0x0'));var util=require('util');var utils=require(_0x112f('0x1'));var members={};var exclude=[_0x112f('0x2'),_0x112f('0x3')];function writeDB(_0x10747c){utils[_0x112f('0x4')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x10747c['uniqueid'],_0x10747c[_0x112f('0x5')],_0x10747c['channel'],_0x10747c[_0x112f('0x6')],_0x10747c[_0x112f('0x7')],_0x10747c[_0x112f('0x8')]));if(_0x10747c[_0x112f('0x5')]){utils[_0x112f('0x9')](_0x10747c[_0x112f('0x5')])[_0x112f('0xa')](function(_0x37812b){if(_0x37812b){_0x10747c[_0x112f('0x7')]=_0x37812b['name'];_0x10747c[_0x112f('0xb')]=_0x37812b[_0x112f('0xb')];utils[_0x112f('0xc')](_0x112f('0xd'),_0x10747c);}else{utils[_0x112f('0xe')](_0x10747c[_0x112f('0x5')][_0x112f('0xf')]('/')[0x1])['then'](function(_0x115351){if(_0x115351){_0x10747c[_0x112f('0x7')]=_0x115351[_0x112f('0x10')];_0x10747c[_0x112f('0xb')]=_0x115351[_0x112f('0xb')];utils[_0x112f('0xc')]('CreateMemberReport',_0x10747c);}});}})[_0x112f('0x11')](function(_0x3e0664){utils[_0x112f('0x12')](util[_0x112f('0x13')](_0x112f('0x14'),_0x10747c[_0x112f('0x15')]),_0x3e0664);});}delete members[_0x10747c['interface']];}function startsWith(_0x5923df,_0x3c7bd2){return _['some'](_0x5923df,function(_0x28e5ff){return _[_0x112f('0x16')](_0x3c7bd2,_0x28e5ff);});}exports[_0x112f('0x17')]=function(_0x1c3b82){try{utils[_0x112f('0x18')](util[_0x112f('0x13')](_0x112f('0x19'),members[_0x1c3b82[_0x112f('0x1a')]]?members[_0x1c3b82[_0x112f('0x1a')]][_0x112f('0x15')]:_0x1c3b82[_0x112f('0x1a')]),_0x1c3b82);utils[_0x112f('0x4')](util['format'](_0x112f('0x1b'),members[_0x1c3b82[_0x112f('0x1a')]]?members[_0x1c3b82[_0x112f('0x1a')]][_0x112f('0x15')]:_0x1c3b82[_0x112f('0x1a')],_0x1c3b82[_0x112f('0x1c')],_0x1c3b82[_0x112f('0x1a')]));switch(_0x1c3b82[_0x112f('0x1c')]){case'INUSE':case _0x112f('0x1d'):if(!startsWith(exclude,_0x1c3b82['device'])){members[_0x1c3b82[_0x112f('0x1a')]]={'channel':_0x112f('0x1e'),'interface':_0x1c3b82[_0x112f('0x1a')],'type':'TALKING','enterAt':utils[_0x112f('0x1f')](),'role':'agent'};}break;case _0x112f('0x20'):if(!_['isNil'](members[_0x1c3b82[_0x112f('0x1a')]])){members[_0x1c3b82[_0x112f('0x1a')]]['exitAt']=utils[_0x112f('0x1f')]();members[_0x1c3b82[_0x112f('0x1a')]][_0x112f('0x21')]=utils[_0x112f('0x22')](members[_0x1c3b82[_0x112f('0x1a')]][_0x112f('0x23')],members[_0x1c3b82['device']]['enterAt']);if(members[_0x1c3b82[_0x112f('0x1a')]]['uniqueid']){writeDB(members[_0x1c3b82[_0x112f('0x1a')]]);}}break;default:break;}}catch(_0x2f2000){utils[_0x112f('0x12')](util[_0x112f('0x13')](_0x112f('0x19'),members[_0x1c3b82['device']]?members[_0x1c3b82['device']][_0x112f('0x15')]:_0x1c3b82[_0x112f('0x1a')]),_0x2f2000);}};exports['agentcomplete']=function(_0x5a8e47){try{if(!_[_0x112f('0x24')](members[_0x5a8e47['interface']])){utils['debug'](util[_0x112f('0x13')](_0x112f('0x25'),_0x5a8e47[_0x112f('0x15')]),_0x5a8e47);utils['info'](util['format']('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x5a8e47[_0x112f('0x15')],_0x5a8e47[_0x112f('0x5')],_0x5a8e47[_0x112f('0x26')]));members[_0x5a8e47[_0x112f('0x5')]]=_[_0x112f('0x27')](members[_0x5a8e47[_0x112f('0x5')]],{'data4':_0x5a8e47[_0x112f('0x26')],'uniqueid':_0x5a8e47[_0x112f('0x15')]});}}catch(_0x3d3566){utils[_0x112f('0x12')](util[_0x112f('0x13')](_0x112f('0x25'),_0x5a8e47[_0x112f('0x15')]),_0x3d3566);}};exports[_0x112f('0x28')]=function(_0x39ffae){try{utils[_0x112f('0x18')](util[_0x112f('0x13')](_0x112f('0x29'),_0x39ffae[_0x112f('0x15')]),_0x39ffae);if(_0x39ffae[_0x112f('0x2a')]){var _0x18d599=_0x39ffae[_0x112f('0x2a')][_0x112f('0xf')]('-')[0x0];if(!_[_0x112f('0x24')](members[_0x18d599])){members[_0x18d599]=_[_0x112f('0x27')](members[_0x18d599],{'data1':members[_0x18d599][_0x112f('0x2b')]||_0x39ffae['type'],'data2':members[_0x18d599][_0x112f('0x6')]||_0x39ffae[_0x112f('0x2c')],'data3':members[_0x18d599][_0x112f('0x2d')]||_0x39ffae[_0x112f('0x2e')],'uniqueid':members[_0x18d599][_0x112f('0x15')]||_0x39ffae[_0x112f('0x15')]});utils['info'](util[_0x112f('0x13')](_0x112f('0x2f'),_0x39ffae[_0x112f('0x15')],members[_0x18d599]['data1'],members[_0x18d599]['data2'],members[_0x18d599][_0x112f('0x2d')]));if(members[_0x18d599]['exitAt']){writeDB(members[_0x18d599]);}}}if(_0x39ffae[_0x112f('0x30')]){var _0x5e4cdc=_0x39ffae[_0x112f('0x30')]['split']('-')[0x0];if(!_[_0x112f('0x24')](members[_0x5e4cdc])){members[_0x5e4cdc]=_[_0x112f('0x27')](members[_0x5e4cdc],{'data1':members[_0x5e4cdc][_0x112f('0x2b')]||_0x39ffae[_0x112f('0x8')],'data2':members[_0x5e4cdc][_0x112f('0x6')]||_0x39ffae[_0x112f('0x2c')],'data3':members[_0x5e4cdc][_0x112f('0x2d')]||_0x39ffae[_0x112f('0x2e')],'uniqueid':members[_0x5e4cdc]['uniqueid']||_0x39ffae['uniqueid']});utils['info'](util[_0x112f('0x13')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x39ffae[_0x112f('0x15')],members[_0x5e4cdc][_0x112f('0x2b')],members[_0x5e4cdc][_0x112f('0x6')],members[_0x5e4cdc][_0x112f('0x2d')]));if(members[_0x5e4cdc][_0x112f('0x23')]){writeDB(members[_0x5e4cdc]);}}}}catch(_0xaafcde){utils[_0x112f('0x12')](util['format'](_0x112f('0x29'),_0x39ffae[_0x112f('0x15')]),_0xaafcde);}}; \ No newline at end of file +var _0x8eeb=['internal','request','CreateMemberReport','getUserByName','split','catch','[%s][members][writeDB]','some','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','enterAt','error','agentcomplete','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','[%s][members][cdr]','lodash','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','membername','type','interface','getUserByInterface','then'];(function(_0x272b45,_0x177804){var _0x4892a3=function(_0xc670e0){while(--_0xc670e0){_0x272b45['push'](_0x272b45['shift']());}};_0x4892a3(++_0x177804);}(_0x8eeb,0x183));var _0xb8ee=function(_0x16884e,_0x223175){_0x16884e=_0x16884e-0x0;var _0x59341a=_0x8eeb[_0x16884e];return _0x59341a;};'use strict';var _=require(_0xb8ee('0x0'));var util=require('util');var utils=require(_0xb8ee('0x1'));var members={};var exclude=[_0xb8ee('0x2'),'Queue:'];function writeDB(_0x29c63e){utils[_0xb8ee('0x3')](util[_0xb8ee('0x4')](_0xb8ee('0x5'),_0x29c63e[_0xb8ee('0x6')],_0x29c63e['interface'],_0x29c63e[_0xb8ee('0x7')],_0x29c63e['data2'],_0x29c63e[_0xb8ee('0x8')],_0x29c63e[_0xb8ee('0x9')]));if(_0x29c63e[_0xb8ee('0xa')]){utils[_0xb8ee('0xb')](_0x29c63e['interface'])[_0xb8ee('0xc')](function(_0x11dc1a){if(_0x11dc1a){_0x29c63e[_0xb8ee('0x8')]=_0x11dc1a['name'];_0x29c63e[_0xb8ee('0xd')]=_0x11dc1a['internal'];utils[_0xb8ee('0xe')](_0xb8ee('0xf'),_0x29c63e);}else{utils[_0xb8ee('0x10')](_0x29c63e[_0xb8ee('0xa')][_0xb8ee('0x11')]('/')[0x1])[_0xb8ee('0xc')](function(_0x23ee46){if(_0x23ee46){_0x29c63e[_0xb8ee('0x8')]=_0x23ee46['name'];_0x29c63e[_0xb8ee('0xd')]=_0x23ee46[_0xb8ee('0xd')];utils[_0xb8ee('0xe')](_0xb8ee('0xf'),_0x29c63e);}});}})[_0xb8ee('0x12')](function(_0x2787fe){utils['error'](util[_0xb8ee('0x4')](_0xb8ee('0x13'),_0x29c63e[_0xb8ee('0x6')]),_0x2787fe);});}delete members[_0x29c63e[_0xb8ee('0xa')]];}function startsWith(_0x6c405c,_0x19f9c9){return _[_0xb8ee('0x14')](_0x6c405c,function(_0x13b79c){return _[_0xb8ee('0x15')](_0x19f9c9,_0x13b79c);});}exports['devicestatechange']=function(_0x135d5d){try{utils['debug'](util['format'](_0xb8ee('0x16'),members[_0x135d5d[_0xb8ee('0x17')]]?members[_0x135d5d['device']][_0xb8ee('0x6')]:_0x135d5d[_0xb8ee('0x17')]),_0x135d5d);utils['info'](util[_0xb8ee('0x4')](_0xb8ee('0x18'),members[_0x135d5d[_0xb8ee('0x17')]]?members[_0x135d5d['device']][_0xb8ee('0x6')]:_0x135d5d[_0xb8ee('0x17')],_0x135d5d[_0xb8ee('0x19')],_0x135d5d[_0xb8ee('0x17')]));switch(_0x135d5d[_0xb8ee('0x19')]){case'INUSE':case _0xb8ee('0x1a'):if(!startsWith(exclude,_0x135d5d['device'])){members[_0x135d5d[_0xb8ee('0x17')]]={'channel':_0xb8ee('0x1b'),'interface':_0x135d5d[_0xb8ee('0x17')],'type':_0xb8ee('0x1c'),'enterAt':utils[_0xb8ee('0x1d')](),'role':_0xb8ee('0x1e')};}break;case _0xb8ee('0x1f'):if(!_[_0xb8ee('0x20')](members[_0x135d5d[_0xb8ee('0x17')]])){members[_0x135d5d[_0xb8ee('0x17')]]['exitAt']=utils[_0xb8ee('0x1d')]();members[_0x135d5d['device']]['duration']=utils['diffTime'](members[_0x135d5d['device']][_0xb8ee('0x21')],members[_0x135d5d[_0xb8ee('0x17')]][_0xb8ee('0x22')]);if(members[_0x135d5d[_0xb8ee('0x17')]][_0xb8ee('0x6')]){writeDB(members[_0x135d5d[_0xb8ee('0x17')]]);}}break;default:break;}}catch(_0x1ac4e1){utils[_0xb8ee('0x23')](util['format'](_0xb8ee('0x16'),members[_0x135d5d[_0xb8ee('0x17')]]?members[_0x135d5d[_0xb8ee('0x17')]][_0xb8ee('0x6')]:_0x135d5d['device']),_0x1ac4e1);}};exports[_0xb8ee('0x24')]=function(_0x1a643f){try{if(!_['isNil'](members[_0x1a643f[_0xb8ee('0xa')]])){utils[_0xb8ee('0x25')](util['format'](_0xb8ee('0x26'),_0x1a643f[_0xb8ee('0x6')]),_0x1a643f);utils[_0xb8ee('0x3')](util['format'](_0xb8ee('0x27'),_0x1a643f[_0xb8ee('0x6')],_0x1a643f[_0xb8ee('0xa')],_0x1a643f['queue']));members[_0x1a643f['interface']]=_[_0xb8ee('0x28')](members[_0x1a643f[_0xb8ee('0xa')]],{'data4':_0x1a643f['queue'],'uniqueid':_0x1a643f[_0xb8ee('0x6')]});}}catch(_0x5589ed){utils[_0xb8ee('0x23')](util['format'](_0xb8ee('0x26'),_0x1a643f[_0xb8ee('0x6')]),_0x5589ed);}};exports[_0xb8ee('0x29')]=function(_0x17b1ff){try{utils[_0xb8ee('0x25')](util['format']('[%s][members][cdr]',_0x17b1ff[_0xb8ee('0x6')]),_0x17b1ff);if(_0x17b1ff[_0xb8ee('0x7')]){var _0x2eadf6=_0x17b1ff[_0xb8ee('0x7')][_0xb8ee('0x11')]('-')[0x0];if(!_[_0xb8ee('0x20')](members[_0x2eadf6])){members[_0x2eadf6]=_[_0xb8ee('0x28')](members[_0x2eadf6],{'data1':members[_0x2eadf6][_0xb8ee('0x2a')]||_0x17b1ff[_0xb8ee('0x9')],'data2':members[_0x2eadf6][_0xb8ee('0x2b')]||_0x17b1ff[_0xb8ee('0x2c')],'data3':members[_0x2eadf6][_0xb8ee('0x2d')]||_0x17b1ff[_0xb8ee('0x2e')],'uniqueid':members[_0x2eadf6][_0xb8ee('0x6')]||_0x17b1ff[_0xb8ee('0x6')]});utils[_0xb8ee('0x3')](util[_0xb8ee('0x4')](_0xb8ee('0x2f'),_0x17b1ff[_0xb8ee('0x6')],members[_0x2eadf6][_0xb8ee('0x2a')],members[_0x2eadf6][_0xb8ee('0x2b')],members[_0x2eadf6][_0xb8ee('0x2d')]));if(members[_0x2eadf6][_0xb8ee('0x21')]){writeDB(members[_0x2eadf6]);}}}if(_0x17b1ff[_0xb8ee('0x30')]){var _0xb0b9fb=_0x17b1ff['destinationchannel'][_0xb8ee('0x11')]('-')[0x0];if(!_['isNil'](members[_0xb0b9fb])){members[_0xb0b9fb]=_[_0xb8ee('0x28')](members[_0xb0b9fb],{'data1':members[_0xb0b9fb][_0xb8ee('0x2a')]||_0x17b1ff[_0xb8ee('0x9')],'data2':members[_0xb0b9fb][_0xb8ee('0x2b')]||_0x17b1ff[_0xb8ee('0x2c')],'data3':members[_0xb0b9fb]['data3']||_0x17b1ff['destination'],'uniqueid':members[_0xb0b9fb]['uniqueid']||_0x17b1ff[_0xb8ee('0x6')]});utils[_0xb8ee('0x3')](util['format'](_0xb8ee('0x2f'),_0x17b1ff[_0xb8ee('0x6')],members[_0xb0b9fb]['data1'],members[_0xb0b9fb][_0xb8ee('0x2b')],members[_0xb0b9fb]['data3']));if(members[_0xb0b9fb][_0xb8ee('0x21')]){writeDB(members[_0xb0b9fb]);}}}}catch(_0x267039){utils[_0xb8ee('0x23')](util['format'](_0xb8ee('0x31'),_0x17b1ff[_0xb8ee('0x6')]),_0x267039);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e71a2e5..1449f59 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 _0x9d8f=['agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','isNil','debug','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerjoinAt','count','connectedlinename'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0x9d8f,0x98));var _0xf9d8=function(_0x41c741,_0x548531){_0x41c741=_0x41c741-0x0;var _0x59bb23=_0x9d8f[_0x41c741];return _0x59bb23;};'use strict';var _=require(_0xf9d8('0x0'));var util=require(_0xf9d8('0x1'));var utils=require(_0xf9d8('0x2'));var queues={};function writeDB(_0x460e61){utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x5'),_0x460e61[_0xf9d8('0x6')],_0x460e61['channel'],_0x460e61[_0xf9d8('0x7')],_0x460e61['lastAssignedTo'],_0x460e61['calleridnum'],_0x460e61['accountcode'],_0x460e61[_0xf9d8('0x8')]));if(_0x460e61[_0xf9d8('0x7')]){utils['getVoiceQueueByName'](_0x460e61[_0xf9d8('0x7')])[_0xf9d8('0x9')](function(_0x475d0b){if(_0x475d0b){_0x460e61[_0xf9d8('0xa')]=_0x475d0b[_0xf9d8('0xa')];}utils[_0xf9d8('0xb')](_0xf9d8('0xc'),_0x460e61);});}else{utils[_0xf9d8('0xb')]('CreateVoiceQueueReport',_0x460e61);}if(_0x460e61[_0xf9d8('0xd')]){delete queues[_0x460e61[_0xf9d8('0xd')]];}else{delete queues[_0x460e61[_0xf9d8('0x6')]];}}exports[_0xf9d8('0xe')]=function(_0xe6931c){try{utils['debug'](util['format'](_0xf9d8('0xf'),_0xe6931c[_0xf9d8('0x6')]),_0xe6931c);utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x10'),_0xe6931c[_0xf9d8('0x6')],_0xe6931c[_0xf9d8('0x7')],_0xe6931c[_0xf9d8('0x11')]));queues[_0xe6931c[_0xf9d8('0x6')]]=_[_0xf9d8('0x12')](_0xe6931c,{'originalposition':_0xe6931c[_0xf9d8('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5a951d){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0xf'),_0xe6931c[_0xf9d8('0x6')]),_0x5a951d);}};exports[_0xf9d8('0x14')]=function(_0x3611fa){try{if(!_[_0xf9d8('0x15')](queues[_0x3611fa[_0xf9d8('0x6')]])){utils[_0xf9d8('0x16')](util['format']('[%s][queues][hangup]',_0x3611fa[_0xf9d8('0x6')]),_0x3611fa);if(queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0x17')]){if(!queues[_0x3611fa[_0xf9d8('0x6')]]['queuecallerabandon']&&!queues[_0x3611fa['uniqueid']][_0xf9d8('0x18')]){queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0x19')]=!![];queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0x1a')]=utils[_0xf9d8('0x1b')]();queues[_0x3611fa['uniqueid']][_0xf9d8('0x8')]='COMPLETEDBYAGENT';}utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x1c'),_0x3611fa[_0xf9d8('0x6')],queues[_0x3611fa[_0xf9d8('0x6')]]['name'],queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0x8')]));writeDB(queues[_0x3611fa['uniqueid']]);}else if(queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0xd')]){utils['info'](util[_0xf9d8('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3611fa[_0xf9d8('0x6')],queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0x1d')],queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0xd')]));queues[queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0xd')]]=queues[_0x3611fa[_0xf9d8('0x6')]];queues[queues[_0x3611fa[_0xf9d8('0x6')]][_0xf9d8('0xd')]][_0xf9d8('0x1e')]=0x2;delete queues[_0x3611fa[_0xf9d8('0x6')]];}}}catch(_0x194171){utils['error'](util[_0xf9d8('0x4')](_0xf9d8('0x1f'),_0x3611fa['uniqueid']),_0x194171);}};exports[_0xf9d8('0x20')]=function(_0x400f15){try{utils['debug'](util[_0xf9d8('0x4')](_0xf9d8('0x21'),_0x400f15[_0xf9d8('0x6')]),_0x400f15);if(!_['isNil'](_0x400f15[_0xf9d8('0x22')][_0xf9d8('0x23')])&&_0x400f15['value'][_0xf9d8('0x24')]()!==_0xf9d8('0x25')){if(!_['isNil'](queues[_0x400f15[_0xf9d8('0x6')]])){queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x26')]=![];queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x27')]=null;queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x18')]=!![];queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x28')]=utils[_0xf9d8('0x1b')]();queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x8')]=_0x400f15['value']['toUpperCase']();utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x29'),_0x400f15[_0xf9d8('0x6')],queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x1d')],_0x400f15['value'],queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x8')]));writeDB(queues[_0x400f15[_0xf9d8('0x6')]]);}}else if(!_[_0xf9d8('0x15')](_0x400f15[_0xf9d8('0x22')][_0xf9d8('0x2a')])){if(!_[_0xf9d8('0x15')](queues[_0x400f15[_0xf9d8('0x6')]])&&!queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x26')]){queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x26')]=![];queues[_0x400f15['uniqueid']][_0xf9d8('0x27')]=null;queues[_0x400f15[_0xf9d8('0x6')]]['queuecallerexit']=!![];queues[_0x400f15[_0xf9d8('0x6')]]['queuecallerexitAt']=utils['now']();queues[_0x400f15[_0xf9d8('0x6')]][_0xf9d8('0x8')]=_0xf9d8('0x2b');utils[_0xf9d8('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x400f15['uniqueid'],queues[_0x400f15['uniqueid']]['name'],_0x400f15['value'],queues[_0x400f15['uniqueid']][_0xf9d8('0x8')]));}}}catch(_0x5ce2c7){utils['error'](util[_0xf9d8('0x4')](_0xf9d8('0x21'),_0x400f15[_0xf9d8('0x6')]),_0x5ce2c7);}};exports['queuecallerabandon']=function(_0x14e361){try{if(!_[_0xf9d8('0x15')](queues[_0x14e361[_0xf9d8('0x6')]])){utils['debug'](util[_0xf9d8('0x4')](_0xf9d8('0x2c'),_0x14e361[_0xf9d8('0x6')]),_0x14e361);queues[_0x14e361[_0xf9d8('0x6')]]['queuecallerexit']=![];queues[_0x14e361[_0xf9d8('0x6')]][_0xf9d8('0x28')]=null;queues[_0x14e361[_0xf9d8('0x6')]][_0xf9d8('0x26')]=!![];queues[_0x14e361[_0xf9d8('0x6')]][_0xf9d8('0x27')]=utils['now']();queues[_0x14e361[_0xf9d8('0x6')]][_0xf9d8('0x8')]='ABANDONED';utils['info'](util[_0xf9d8('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x14e361[_0xf9d8('0x6')],queues[_0x14e361['uniqueid']][_0xf9d8('0x1d')],queues[_0x14e361[_0xf9d8('0x6')]][_0xf9d8('0x8')]));}}catch(_0x468220){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0x2c'),_0x14e361[_0xf9d8('0x6')]),_0x468220);}};exports[_0xf9d8('0x2d')]=function(_0xa024f4){try{if(!_['isNil'](queues[_0xa024f4['uniqueid']])){utils[_0xf9d8('0x16')](util[_0xf9d8('0x4')](_0xf9d8('0x2e'),_0xa024f4['uniqueid']),_0xa024f4);utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x2f'),_0xa024f4['uniqueid'],queues[_0xa024f4['uniqueid']][_0xf9d8('0x1d')],_0xa024f4[_0xf9d8('0x30')],_0xa024f4['connectedlinename']));queues[_0xa024f4[_0xf9d8('0x6')]][_0xf9d8('0x2d')]=!![];queues[_0xa024f4[_0xf9d8('0x6')]]['queuecallerleaveAt']=utils['now']();queues[_0xa024f4[_0xf9d8('0x6')]]['holdtime']=utils['diffTime'](queues[_0xa024f4['uniqueid']]['queuecallerleaveAt'],queues[_0xa024f4[_0xf9d8('0x6')]][_0xf9d8('0x31')]);queues[_0xa024f4[_0xf9d8('0x6')]][_0xf9d8('0x11')]=_0xa024f4[_0xf9d8('0x11')];queues[_0xa024f4[_0xf9d8('0x6')]][_0xf9d8('0x32')]=_0xa024f4[_0xf9d8('0x32')];queues[_0xa024f4['uniqueid']][_0xf9d8('0x30')]=_0xa024f4['connectedlinenum'];queues[_0xa024f4[_0xf9d8('0x6')]]['connectedlinename']=_0xa024f4[_0xf9d8('0x33')];}}catch(_0x49d2cb){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0x2e'),_0xa024f4[_0xf9d8('0x6')]),_0x49d2cb);}};exports[_0xf9d8('0x34')]=function(_0x1b247f){try{if(!_[_0xf9d8('0x15')](queues[_0x1b247f['uniqueid']])){utils['debug'](util[_0xf9d8('0x4')](_0xf9d8('0x35'),_0x1b247f[_0xf9d8('0x6')]),_0x1b247f);utils['info'](util['format'](_0xf9d8('0x36'),_0x1b247f[_0xf9d8('0x6')],queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x1d')],_0x1b247f[_0xf9d8('0x37')],_0x1b247f['destaccountcode']));queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x26')]=![];queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x26')]=![];queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x27')]=null;queues[_0x1b247f['uniqueid']][_0xf9d8('0x18')]=![];queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x8')]=null;queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x28')]=null;queues[_0x1b247f[_0xf9d8('0x6')]]['assigned']=!![];queues[_0x1b247f[_0xf9d8('0x6')]]['accountcode']=_0x1b247f[_0xf9d8('0x38')];queues[_0x1b247f[_0xf9d8('0x6')]][_0xf9d8('0x39')]=_0x1b247f['membername'];}}catch(_0x3589b2){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0x35'),_0x1b247f['uniqueid']),_0x3589b2);}};exports['agentcomplete']=function(_0x1fbf70){try{if(!_[_0xf9d8('0x15')](queues[_0x1fbf70[_0xf9d8('0x6')]])){if(queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x17')]){utils[_0xf9d8('0x16')](util[_0xf9d8('0x4')](_0xf9d8('0x3a'),_0x1fbf70['uniqueid']),_0x1fbf70);queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x26')]=![];queues[_0x1fbf70['uniqueid']]['queuecallerabandon']=![];queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x27')]=null;queues[_0x1fbf70[_0xf9d8('0x6')]]['queuecallerexit']=![];queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x28')]=null;queues[_0x1fbf70[_0xf9d8('0x6')]]['assigned']=!![];queues[_0x1fbf70[_0xf9d8('0x6')]]['lastAssignedTo']=_0x1fbf70[_0xf9d8('0x37')];queues[_0x1fbf70[_0xf9d8('0x6')]]['queuecallercomplete']=!![];queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x1a')]=utils[_0xf9d8('0x1b')]();if(_0x1fbf70[_0xf9d8('0x3b')]==_0xf9d8('0x3c')){if(!queues[_0x1fbf70['uniqueid']][_0xf9d8('0x3c')]){queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x8')]='TRANSFER';}}else{queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x8')]=_0xf9d8('0x3d')+_0x1fbf70[_0xf9d8('0x3b')][_0xf9d8('0x24')]();}utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x3e'),_0x1fbf70['uniqueid'],queues[_0x1fbf70[_0xf9d8('0x6')]]['name'],_0x1fbf70[_0xf9d8('0x37')],queues[_0x1fbf70[_0xf9d8('0x6')]][_0xf9d8('0x8')]));writeDB(queues[_0x1fbf70[_0xf9d8('0x6')]]);}}}catch(_0x2f5d89){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0x3a'),_0x1fbf70[_0xf9d8('0x6')]),_0x2f5d89);}};exports[_0xf9d8('0x3f')]=function(_0xafbcec){try{if(!_['isNil'](queues[_0xafbcec[_0xf9d8('0x40')]])){utils[_0xf9d8('0x16')](util[_0xf9d8('0x4')](_0xf9d8('0x41'),_0xafbcec[_0xf9d8('0x6')]),_0xafbcec);queues[_0xafbcec[_0xf9d8('0x40')]][_0xf9d8('0x3c')]=!![];queues[_0xafbcec[_0xf9d8('0x40')]][_0xf9d8('0x42')]=_0xf9d8('0x43');queues[_0xafbcec[_0xf9d8('0x40')]][_0xf9d8('0x44')]=_0xafbcec[_0xf9d8('0x45')];queues[_0xafbcec[_0xf9d8('0x40')]][_0xf9d8('0x46')]=_0xafbcec[_0xf9d8('0x40')];queues[_0xafbcec[_0xf9d8('0x40')]]['queuecallerexitreason']=_0xf9d8('0x47');utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x48'),_0xafbcec['uniqueid'],queues[_0xafbcec[_0xf9d8('0x40')]][_0xf9d8('0x1d')],_0xafbcec[_0xf9d8('0x40')],_0xafbcec[_0xf9d8('0x45')]));}}catch(_0x50e992){utils['error'](util[_0xf9d8('0x4')](_0xf9d8('0x41'),_0xafbcec[_0xf9d8('0x6')]),_0x50e992);}};exports[_0xf9d8('0x49')]=function(_0x1ece44){try{utils[_0xf9d8('0x16')](util[_0xf9d8('0x4')](_0xf9d8('0x4a'),_0x1ece44[_0xf9d8('0x4b')]),_0x1ece44);if(_0x1ece44['origtransfereruniqueid']==_0x1ece44[_0xf9d8('0x4c')]){if(!_[_0xf9d8('0x15')](queues[_0x1ece44[_0xf9d8('0x4d')]])){utils['info'](util[_0xf9d8('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x1ece44['origtransfereruniqueid'],queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x1d')],_0x1ece44[_0xf9d8('0x4e')]));queues[_0x1ece44['secondtransfererlinkedid']][_0xf9d8('0x3c')]=!![];queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x42')]=_0xf9d8('0x4f');queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x44')]=_0x1ece44[_0xf9d8('0x4e')];queues[_0x1ece44['secondtransfererlinkedid']][_0xf9d8('0x46')]=_0x1ece44['origtransfereruniqueid'];queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xf9d8('0x15')](queues[_0x1ece44[_0xf9d8('0x4c')]])){if(_0x1ece44[_0xf9d8('0x50')]&&queues[_0x1ece44[_0xf9d8('0x50')]]){queues[_0x1ece44[_0xf9d8('0x50')]]['queuecallerenterreason']=0x1;queues[_0x1ece44[_0xf9d8('0x40')]]=_[_0xf9d8('0x51')](queues[_0x1ece44['transfereelinkedid']]);queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0xd')]=_0x1ece44[_0xf9d8('0x52')];queues[_0x1ece44[_0xf9d8('0x40')]]['queuecallerenterreason']=0x2;queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x53')]=queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x53')];queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x54')]=queues[_0x1ece44[_0xf9d8('0x4d')]][_0xf9d8('0x54')];queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x31')]=utils[_0xf9d8('0x1b')]();queues[_0x1ece44[_0xf9d8('0x40')]]['queuecallerleaveAt']=utils[_0xf9d8('0x1b')]();queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x55')]=0x0;queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x56')]=0x0;utils['info'](util[_0xf9d8('0x4')](_0xf9d8('0x57'),_0x1ece44[_0xf9d8('0x4b')],queues[_0x1ece44['transfereeuniqueid']]['name'],queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x53')],queues[_0x1ece44[_0xf9d8('0x40')]][_0xf9d8('0x54')]));}else{utils['info'](util[_0xf9d8('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x1ece44['origtransfereruniqueid'],queues[_0x1ece44['origtransfererlinkedid']][_0xf9d8('0x1d')],_0x1ece44[_0xf9d8('0x4d')]));queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0xd')]=_0x1ece44[_0xf9d8('0x4d')];}}}else if(_0x1ece44[_0xf9d8('0x58')]==_0x1ece44[_0xf9d8('0x4d')]){if(!_[_0xf9d8('0x15')](queues[_0x1ece44[_0xf9d8('0x4c')]])){utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x59'),_0x1ece44[_0xf9d8('0x4b')],queues[_0x1ece44[_0xf9d8('0x4c')]]['name'],_0x1ece44[_0xf9d8('0x58')],_0x1ece44[_0xf9d8('0x5a')]));queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0x3c')]=!![];queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0x42')]='ATTENDED';queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0x44')]=_0x1ece44['secondtransfererexten'];queues[_0x1ece44[_0xf9d8('0x4c')]]['transferuniqueid']=_0x1ece44[_0xf9d8('0x58')];queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0x8')]='ATTENDEDTRANSFER';}if(!_[_0xf9d8('0x15')](queues[_0x1ece44[_0xf9d8('0x4d')]])){if(_0x1ece44[_0xf9d8('0x5b')]&&queues[_0x1ece44[_0xf9d8('0x5b')]]){queues[_0x1ece44[_0xf9d8('0x5b')]][_0xf9d8('0x1e')]=0x1;queues[_0x1ece44[_0xf9d8('0x52')]]=_['clone'](queues[_0x1ece44[_0xf9d8('0x5b')]]);queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0xd')]=_0x1ece44[_0xf9d8('0x52')];queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0x1e')]=0x2;queues[_0x1ece44['transfertargetuniqueid']][_0xf9d8('0x53')]=queues[_0x1ece44[_0xf9d8('0x4c')]]['calleridnum'];queues[_0x1ece44[_0xf9d8('0x52')]]['calleridname']=queues[_0x1ece44[_0xf9d8('0x4c')]][_0xf9d8('0x54')];queues[_0x1ece44['transfertargetuniqueid']][_0xf9d8('0x31')]=utils['now']();queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0x17')]=utils[_0xf9d8('0x1b')]();queues[_0x1ece44[_0xf9d8('0x52')]]['holdtime']=0x0;queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0x56')]=0x0;utils[_0xf9d8('0x3')](util['format'](_0xf9d8('0x5c'),_0x1ece44[_0xf9d8('0x4b')],queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0x1d')],queues[_0x1ece44[_0xf9d8('0x52')]][_0xf9d8('0xd')],queues[_0x1ece44[_0xf9d8('0x52')]]['calleridnum'],queues[_0x1ece44['transfertargetuniqueid']][_0xf9d8('0x54')]));}else{utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x5d'),_0x1ece44[_0xf9d8('0x4b')],queues[_0x1ece44['secondtransfererlinkedid']]['name'],_0x1ece44[_0xf9d8('0x4c')]));queues[_0x1ece44[_0xf9d8('0x4d')]]['transfereduniqueid']=_0x1ece44[_0xf9d8('0x4c')];}}}}catch(_0x29e966){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')]('[%s][queues][attendedtransfer]',_0x1ece44[_0xf9d8('0x4b')]),_0x29e966);}};exports[_0xf9d8('0x5e')]=function(_0x20a230){try{if(!_[_0xf9d8('0x15')](queues[_0x20a230[_0xf9d8('0x6')]])){utils['debug'](util['format'](_0xf9d8('0x5f'),_0x20a230[_0xf9d8('0x6')]),_0x20a230);queues[_0x20a230[_0xf9d8('0x6')]]['musiconholdstartAt']=utils[_0xf9d8('0x1b')]();utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x60'),_0x20a230[_0xf9d8('0x6')],queues[_0x20a230[_0xf9d8('0x6')]][_0xf9d8('0x1d')],queues[_0x20a230[_0xf9d8('0x6')]][_0xf9d8('0x61')]));}}catch(_0x170bbe){utils[_0xf9d8('0x13')](util['format'](_0xf9d8('0x5f'),_0x20a230[_0xf9d8('0x6')]),_0x170bbe);}};exports[_0xf9d8('0x62')]=function(_0x44e25b){try{if(!_['isNil'](queues[_0x44e25b[_0xf9d8('0x6')]])){if(!_['isNil'](queues[_0x44e25b['uniqueid']][_0xf9d8('0x61')])){utils[_0xf9d8('0x16')](util[_0xf9d8('0x4')]('[%s][queues][musiconholdstop]',_0x44e25b[_0xf9d8('0x6')]),_0x44e25b);queues[_0x44e25b[_0xf9d8('0x6')]][_0xf9d8('0x56')]+=utils[_0xf9d8('0x63')](utils[_0xf9d8('0x1b')](),queues[_0x44e25b['uniqueid']][_0xf9d8('0x61')]);utils[_0xf9d8('0x3')](util[_0xf9d8('0x4')](_0xf9d8('0x64'),_0x44e25b[_0xf9d8('0x6')],queues[_0x44e25b[_0xf9d8('0x6')]][_0xf9d8('0x1d')],queues[_0x44e25b[_0xf9d8('0x6')]]['mohtime']));delete queues[_0x44e25b[_0xf9d8('0x6')]][_0xf9d8('0x61')];}}}catch(_0x5929b6){utils[_0xf9d8('0x13')](util[_0xf9d8('0x4')](_0xf9d8('0x65'),_0x44e25b[_0xf9d8('0x6')]),_0x5929b6);}}; \ No newline at end of file +var _0x93f2=['count','membername','assigned','destaccountcode','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt'];(function(_0x3e51b4,_0x404ee7){var _0x2c1928=function(_0x2d8d51){while(--_0x2d8d51){_0x3e51b4['push'](_0x3e51b4['shift']());}};_0x2c1928(++_0x404ee7);}(_0x93f2,0xfc));var _0x293f=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x93f2[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x293f('0x0'));var util=require('util');var utils=require(_0x293f('0x1'));var queues={};function writeDB(_0x5a67d2){utils[_0x293f('0x2')](util['format'](_0x293f('0x3'),_0x5a67d2[_0x293f('0x4')],_0x5a67d2[_0x293f('0x5')],_0x5a67d2[_0x293f('0x6')],_0x5a67d2['lastAssignedTo'],_0x5a67d2[_0x293f('0x7')],_0x5a67d2[_0x293f('0x8')],_0x5a67d2[_0x293f('0x9')]));if(_0x5a67d2['queue']){utils[_0x293f('0xa')](_0x5a67d2['queue'])[_0x293f('0xb')](function(_0x5786a6){if(_0x5786a6){_0x5a67d2['type']=_0x5786a6[_0x293f('0xc')];}utils[_0x293f('0xd')](_0x293f('0xe'),_0x5a67d2);});}else{utils[_0x293f('0xd')]('CreateVoiceQueueReport',_0x5a67d2);}if(_0x5a67d2[_0x293f('0xf')]){delete queues[_0x5a67d2[_0x293f('0xf')]];}else{delete queues[_0x5a67d2[_0x293f('0x4')]];}}exports['queuecallerjoin']=function(_0x3bddcd){try{utils[_0x293f('0x10')](util[_0x293f('0x11')]('[%s][queues][queuecallerjoin]',_0x3bddcd[_0x293f('0x4')]),_0x3bddcd);utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x12'),_0x3bddcd[_0x293f('0x4')],_0x3bddcd[_0x293f('0x6')],_0x3bddcd['position']));queues[_0x3bddcd[_0x293f('0x4')]]=_[_0x293f('0x13')](_0x3bddcd,{'originalposition':_0x3bddcd[_0x293f('0x14')],'queuecallerjoinAt':utils[_0x293f('0x15')](),'mohtime':0x0});}catch(_0x4a8bd7){utils['error'](util[_0x293f('0x11')]('[%s][queues][queuecallerjoin]',_0x3bddcd['uniqueid']),_0x4a8bd7);}};exports[_0x293f('0x16')]=function(_0x92bc9a){try{if(!_[_0x293f('0x17')](queues[_0x92bc9a[_0x293f('0x4')]])){utils[_0x293f('0x10')](util[_0x293f('0x11')](_0x293f('0x18'),_0x92bc9a[_0x293f('0x4')]),_0x92bc9a);if(queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x19')]){if(!queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x1a')]&&!queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x1b')]){queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x1c')]=!![];queues[_0x92bc9a[_0x293f('0x4')]]['queuecallercompleteAt']=utils[_0x293f('0x15')]();queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x9')]=_0x293f('0x1d');}utils[_0x293f('0x2')](util[_0x293f('0x11')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x92bc9a['uniqueid'],queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x1e')],queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x9')]));writeDB(queues[_0x92bc9a[_0x293f('0x4')]]);}else if(queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0xf')]){utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x1f'),_0x92bc9a['uniqueid'],queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0x1e')],queues[_0x92bc9a[_0x293f('0x4')]]['transfereduniqueid']));queues[queues[_0x92bc9a[_0x293f('0x4')]][_0x293f('0xf')]]=queues[_0x92bc9a['uniqueid']];queues[queues[_0x92bc9a['uniqueid']][_0x293f('0xf')]][_0x293f('0x20')]=0x2;delete queues[_0x92bc9a['uniqueid']];}}}catch(_0x23d1ec){utils[_0x293f('0x21')](util['format']('[%s][queues][hangup]',_0x92bc9a['uniqueid']),_0x23d1ec);}};exports[_0x293f('0x22')]=function(_0x217eca){try{utils[_0x293f('0x10')](util['format'](_0x293f('0x23'),_0x217eca['uniqueid']),_0x217eca);if(!_[_0x293f('0x17')](_0x217eca[_0x293f('0x24')][_0x293f('0x25')])&&_0x217eca[_0x293f('0x26')][_0x293f('0x27')]()!==_0x293f('0x28')){if(!_[_0x293f('0x17')](queues[_0x217eca[_0x293f('0x4')]])){queues[_0x217eca[_0x293f('0x4')]]['queuecallerabandon']=![];queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x29')]=null;queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x1b')]=!![];queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x2a')]=utils['now']();queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x9')]=_0x217eca[_0x293f('0x26')]['toUpperCase']();utils['info'](util[_0x293f('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x217eca[_0x293f('0x4')],queues[_0x217eca['uniqueid']]['name'],_0x217eca[_0x293f('0x26')],queues[_0x217eca[_0x293f('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x217eca[_0x293f('0x4')]]);}}else if(!_[_0x293f('0x17')](_0x217eca[_0x293f('0x24')][_0x293f('0x2b')])){if(!_[_0x293f('0x17')](queues[_0x217eca[_0x293f('0x4')]])&&!queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x1a')]){queues[_0x217eca['uniqueid']][_0x293f('0x1a')]=![];queues[_0x217eca[_0x293f('0x4')]]['queuecallerabandonAt']=null;queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x1b')]=!![];queues[_0x217eca['uniqueid']][_0x293f('0x2a')]=utils[_0x293f('0x15')]();queues[_0x217eca[_0x293f('0x4')]]['queuecallerexitreason']=_0x293f('0x2c');utils[_0x293f('0x2')](util[_0x293f('0x11')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x217eca[_0x293f('0x4')],queues[_0x217eca[_0x293f('0x4')]][_0x293f('0x1e')],_0x217eca[_0x293f('0x26')],queues[_0x217eca['uniqueid']][_0x293f('0x9')]));}}}catch(_0x481951){utils[_0x293f('0x21')](util['format'](_0x293f('0x23'),_0x217eca[_0x293f('0x4')]),_0x481951);}};exports['queuecallerabandon']=function(_0x46121f){try{if(!_[_0x293f('0x17')](queues[_0x46121f['uniqueid']])){utils[_0x293f('0x10')](util[_0x293f('0x11')](_0x293f('0x2d'),_0x46121f[_0x293f('0x4')]),_0x46121f);queues[_0x46121f['uniqueid']][_0x293f('0x1b')]=![];queues[_0x46121f['uniqueid']]['queuecallerexitAt']=null;queues[_0x46121f[_0x293f('0x4')]][_0x293f('0x1a')]=!![];queues[_0x46121f[_0x293f('0x4')]][_0x293f('0x29')]=utils[_0x293f('0x15')]();queues[_0x46121f[_0x293f('0x4')]]['queuecallerexitreason']=_0x293f('0x2e');utils['info'](util[_0x293f('0x11')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x46121f[_0x293f('0x4')],queues[_0x46121f[_0x293f('0x4')]][_0x293f('0x1e')],queues[_0x46121f['uniqueid']][_0x293f('0x9')]));}}catch(_0xa0b2ab){utils[_0x293f('0x21')](util[_0x293f('0x11')](_0x293f('0x2d'),_0x46121f[_0x293f('0x4')]),_0xa0b2ab);}};exports[_0x293f('0x2f')]=function(_0x2c6d05){try{if(!_['isNil'](queues[_0x2c6d05[_0x293f('0x4')]])){utils[_0x293f('0x10')](util[_0x293f('0x11')](_0x293f('0x30'),_0x2c6d05[_0x293f('0x4')]),_0x2c6d05);utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x31'),_0x2c6d05[_0x293f('0x4')],queues[_0x2c6d05['uniqueid']][_0x293f('0x1e')],_0x2c6d05[_0x293f('0x32')],_0x2c6d05[_0x293f('0x33')]));queues[_0x2c6d05[_0x293f('0x4')]]['queuecallerleave']=!![];queues[_0x2c6d05[_0x293f('0x4')]]['queuecallerleaveAt']=utils[_0x293f('0x15')]();queues[_0x2c6d05['uniqueid']][_0x293f('0x34')]=utils['diffTime'](queues[_0x2c6d05[_0x293f('0x4')]][_0x293f('0x19')],queues[_0x2c6d05[_0x293f('0x4')]][_0x293f('0x35')]);queues[_0x2c6d05[_0x293f('0x4')]]['position']=_0x2c6d05[_0x293f('0x14')];queues[_0x2c6d05[_0x293f('0x4')]][_0x293f('0x36')]=_0x2c6d05['count'];queues[_0x2c6d05[_0x293f('0x4')]]['connectedlinenum']=_0x2c6d05['connectedlinenum'];queues[_0x2c6d05['uniqueid']][_0x293f('0x33')]=_0x2c6d05[_0x293f('0x33')];}}catch(_0x127887){utils[_0x293f('0x21')](util['format'](_0x293f('0x30'),_0x2c6d05[_0x293f('0x4')]),_0x127887);}};exports['agentconnect']=function(_0x49ab0b){try{if(!_[_0x293f('0x17')](queues[_0x49ab0b[_0x293f('0x4')]])){utils[_0x293f('0x10')](util[_0x293f('0x11')]('[%s][queues][agentconnect]',_0x49ab0b[_0x293f('0x4')]),_0x49ab0b);utils[_0x293f('0x2')](util[_0x293f('0x11')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x49ab0b[_0x293f('0x4')],queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x1e')],_0x49ab0b[_0x293f('0x37')],_0x49ab0b['destaccountcode']));queues[_0x49ab0b['uniqueid']][_0x293f('0x1a')]=![];queues[_0x49ab0b['uniqueid']]['queuecallerabandon']=![];queues[_0x49ab0b[_0x293f('0x4')]]['queuecallerabandonAt']=null;queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x1b')]=![];queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x9')]=null;queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x2a')]=null;queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x38')]=!![];queues[_0x49ab0b[_0x293f('0x4')]][_0x293f('0x8')]=_0x49ab0b[_0x293f('0x39')];queues[_0x49ab0b['uniqueid']][_0x293f('0x3a')]=_0x49ab0b['membername'];}}catch(_0x15ff1e){utils[_0x293f('0x21')](util[_0x293f('0x11')](_0x293f('0x3b'),_0x49ab0b[_0x293f('0x4')]),_0x15ff1e);}};exports[_0x293f('0x3c')]=function(_0x4352cc){try{if(!_[_0x293f('0x17')](queues[_0x4352cc[_0x293f('0x4')]])){if(queues[_0x4352cc[_0x293f('0x4')]]['queuecallerleaveAt']){utils['debug'](util[_0x293f('0x11')](_0x293f('0x3d'),_0x4352cc[_0x293f('0x4')]),_0x4352cc);queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x1a')]=![];queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x1a')]=![];queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x29')]=null;queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x1b')]=![];queues[_0x4352cc[_0x293f('0x4')]]['queuecallerexitAt']=null;queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x38')]=!![];queues[_0x4352cc[_0x293f('0x4')]]['lastAssignedTo']=_0x4352cc['membername'];queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x1c')]=!![];queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x3e')]=utils['now']();if(_0x4352cc[_0x293f('0x3f')]==_0x293f('0x40')){if(!queues[_0x4352cc['uniqueid']]['transfer']){queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x9')]=_0x293f('0x41');}}else{queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x9')]='COMPLETEDBY'+_0x4352cc[_0x293f('0x3f')][_0x293f('0x27')]();}utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x42'),_0x4352cc[_0x293f('0x4')],queues[_0x4352cc[_0x293f('0x4')]][_0x293f('0x1e')],_0x4352cc[_0x293f('0x37')],queues[_0x4352cc[_0x293f('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x4352cc[_0x293f('0x4')]]);}}}catch(_0x4a1d03){utils['error'](util[_0x293f('0x11')]('[%s][queues][agentcomplete]',_0x4352cc['uniqueid']),_0x4a1d03);}};exports[_0x293f('0x43')]=function(_0x546c1f){try{if(!_[_0x293f('0x17')](queues[_0x546c1f['transfereeuniqueid']])){utils['debug'](util[_0x293f('0x11')](_0x293f('0x44'),_0x546c1f[_0x293f('0x4')]),_0x546c1f);queues[_0x546c1f[_0x293f('0x45')]]['transfer']=!![];queues[_0x546c1f[_0x293f('0x45')]][_0x293f('0x46')]=_0x293f('0x47');queues[_0x546c1f[_0x293f('0x45')]]['transferexten']=_0x546c1f['extension'];queues[_0x546c1f[_0x293f('0x45')]][_0x293f('0x48')]=_0x546c1f['transfereeuniqueid'];queues[_0x546c1f[_0x293f('0x45')]]['queuecallerexitreason']=_0x293f('0x49');utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x4a'),_0x546c1f[_0x293f('0x4')],queues[_0x546c1f[_0x293f('0x45')]][_0x293f('0x1e')],_0x546c1f[_0x293f('0x45')],_0x546c1f[_0x293f('0x4b')]));}}catch(_0x35ed2c){utils['error'](util[_0x293f('0x11')](_0x293f('0x44'),_0x546c1f[_0x293f('0x4')]),_0x35ed2c);}};exports[_0x293f('0x4c')]=function(_0x570043){try{utils[_0x293f('0x10')](util[_0x293f('0x11')](_0x293f('0x4d'),_0x570043[_0x293f('0x4e')]),_0x570043);if(_0x570043[_0x293f('0x4e')]==_0x570043['origtransfererlinkedid']){if(!_[_0x293f('0x17')](queues[_0x570043[_0x293f('0x4f')]])){utils[_0x293f('0x2')](util['format'](_0x293f('0x50'),_0x570043[_0x293f('0x4e')],queues[_0x570043['secondtransfererlinkedid']]['name'],_0x570043[_0x293f('0x51')]));queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x40')]=!![];queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x46')]=_0x293f('0x52');queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x53')]=_0x570043[_0x293f('0x51')];queues[_0x570043[_0x293f('0x4f')]]['transferuniqueid']=_0x570043[_0x293f('0x4e')];queues[_0x570043['secondtransfererlinkedid']][_0x293f('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x293f('0x17')](queues[_0x570043['origtransfererlinkedid']])){if(_0x570043[_0x293f('0x54')]&&queues[_0x570043[_0x293f('0x54')]]){queues[_0x570043[_0x293f('0x54')]][_0x293f('0x20')]=0x1;queues[_0x570043[_0x293f('0x45')]]=_[_0x293f('0x55')](queues[_0x570043[_0x293f('0x54')]]);queues[_0x570043[_0x293f('0x45')]][_0x293f('0xf')]=_0x570043['transfertargetuniqueid'];queues[_0x570043['transfereeuniqueid']][_0x293f('0x20')]=0x2;queues[_0x570043[_0x293f('0x45')]][_0x293f('0x7')]=queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x7')];queues[_0x570043[_0x293f('0x45')]][_0x293f('0x56')]=queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x56')];queues[_0x570043['transfereeuniqueid']][_0x293f('0x35')]=utils[_0x293f('0x15')]();queues[_0x570043[_0x293f('0x45')]]['queuecallerleaveAt']=utils[_0x293f('0x15')]();queues[_0x570043[_0x293f('0x45')]][_0x293f('0x34')]=0x0;queues[_0x570043[_0x293f('0x45')]][_0x293f('0x57')]=0x0;utils[_0x293f('0x2')](util['format'](_0x293f('0x58'),_0x570043['origtransfereruniqueid'],queues[_0x570043[_0x293f('0x45')]][_0x293f('0x1e')],queues[_0x570043['transfereeuniqueid']][_0x293f('0x7')],queues[_0x570043[_0x293f('0x45')]][_0x293f('0x56')]));}else{utils['info'](util[_0x293f('0x11')](_0x293f('0x59'),_0x570043[_0x293f('0x4e')],queues[_0x570043['origtransfererlinkedid']][_0x293f('0x1e')],_0x570043['secondtransfererlinkedid']));queues[_0x570043[_0x293f('0x5a')]]['transfereduniqueid']=_0x570043[_0x293f('0x4f')];}}}else if(_0x570043[_0x293f('0x5b')]==_0x570043[_0x293f('0x4f')]){if(!_[_0x293f('0x17')](queues[_0x570043['origtransfererlinkedid']])){utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x5c'),_0x570043[_0x293f('0x4e')],queues[_0x570043[_0x293f('0x5a')]][_0x293f('0x1e')],_0x570043[_0x293f('0x5b')],_0x570043['secondtransfererexten']));queues[_0x570043[_0x293f('0x5a')]][_0x293f('0x40')]=!![];queues[_0x570043[_0x293f('0x5a')]][_0x293f('0x46')]=_0x293f('0x52');queues[_0x570043['origtransfererlinkedid']]['transferexten']=_0x570043['secondtransfererexten'];queues[_0x570043[_0x293f('0x5a')]][_0x293f('0x48')]=_0x570043[_0x293f('0x5b')];queues[_0x570043['origtransfererlinkedid']][_0x293f('0x9')]=_0x293f('0x5d');}if(!_[_0x293f('0x17')](queues[_0x570043[_0x293f('0x4f')]])){if(_0x570043[_0x293f('0x5e')]&&queues[_0x570043[_0x293f('0x5e')]]){queues[_0x570043[_0x293f('0x5e')]][_0x293f('0x20')]=0x1;queues[_0x570043['transfertargetuniqueid']]=_['clone'](queues[_0x570043['transfertargetlinkedid']]);queues[_0x570043[_0x293f('0x5f')]][_0x293f('0xf')]=_0x570043[_0x293f('0x5f')];queues[_0x570043[_0x293f('0x5f')]]['queuecallerenterreason']=0x2;queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x7')]=queues[_0x570043[_0x293f('0x5a')]]['calleridnum'];queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x56')]=queues[_0x570043['origtransfererlinkedid']][_0x293f('0x56')];queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x35')]=utils[_0x293f('0x15')]();queues[_0x570043['transfertargetuniqueid']]['queuecallerleaveAt']=utils[_0x293f('0x15')]();queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x34')]=0x0;queues[_0x570043['transfertargetuniqueid']][_0x293f('0x57')]=0x0;utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x60'),_0x570043['origtransfereruniqueid'],queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x1e')],queues[_0x570043['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x7')],queues[_0x570043[_0x293f('0x5f')]][_0x293f('0x56')]));}else{utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x59'),_0x570043['origtransfereruniqueid'],queues[_0x570043[_0x293f('0x4f')]][_0x293f('0x1e')],_0x570043[_0x293f('0x5a')]));queues[_0x570043[_0x293f('0x4f')]][_0x293f('0xf')]=_0x570043[_0x293f('0x5a')];}}}}catch(_0x2dddd4){utils['error'](util[_0x293f('0x11')]('[%s][queues][attendedtransfer]',_0x570043[_0x293f('0x4e')]),_0x2dddd4);}};exports[_0x293f('0x61')]=function(_0x216b47){try{if(!_['isNil'](queues[_0x216b47[_0x293f('0x4')]])){utils[_0x293f('0x10')](util['format'](_0x293f('0x62'),_0x216b47[_0x293f('0x4')]),_0x216b47);queues[_0x216b47[_0x293f('0x4')]][_0x293f('0x63')]=utils[_0x293f('0x15')]();utils[_0x293f('0x2')](util[_0x293f('0x11')](_0x293f('0x64'),_0x216b47['uniqueid'],queues[_0x216b47['uniqueid']]['name'],queues[_0x216b47[_0x293f('0x4')]][_0x293f('0x63')]));}}catch(_0x4aa510){utils[_0x293f('0x21')](util[_0x293f('0x11')]('[%s][queues][musiconholdstart]',_0x216b47[_0x293f('0x4')]),_0x4aa510);}};exports['musiconholdstop']=function(_0x4fcd9d){try{if(!_[_0x293f('0x17')](queues[_0x4fcd9d[_0x293f('0x4')]])){if(!_[_0x293f('0x17')](queues[_0x4fcd9d[_0x293f('0x4')]][_0x293f('0x63')])){utils[_0x293f('0x10')](util[_0x293f('0x11')](_0x293f('0x65'),_0x4fcd9d['uniqueid']),_0x4fcd9d);queues[_0x4fcd9d['uniqueid']][_0x293f('0x57')]+=utils['diffTime'](utils['now'](),queues[_0x4fcd9d[_0x293f('0x4')]][_0x293f('0x63')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x4fcd9d['uniqueid'],queues[_0x4fcd9d[_0x293f('0x4')]]['name'],queues[_0x4fcd9d['uniqueid']]['mohtime']));delete queues[_0x4fcd9d['uniqueid']][_0x293f('0x63')];}}}catch(_0x4560b3){utils[_0x293f('0x21')](util['format']('[%s][queues][musiconholdstop]',_0x4fcd9d[_0x293f('0x4')]),_0x4560b3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index afb5221..6aa90b0 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 _0x8739=['push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','lastIndexOf','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereruniqueid','util','./utils','info','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','format','newstate','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','transfer','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','.WAV','find','monitors'];(function(_0x249ff7,_0x4c8574){var _0x29db81=function(_0x444bfe){while(--_0x444bfe){_0x249ff7['push'](_0x249ff7['shift']());}};_0x29db81(++_0x4c8574);}(_0x8739,0x121));var _0x9873=function(_0x1fd337,_0xe27e67){_0x1fd337=_0x1fd337-0x0;var _0x579bd3=_0x8739[_0x1fd337];return _0x579bd3;};'use strict';var _=require('lodash');var util=require(_0x9873('0x0'));var utils=require(_0x9873('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x24721a){var _0x8b8879;utils[_0x9873('0x2')](util['format']('[%s][recordings][writeDB]',_0x24721a[_0x9873('0x3')]));if(transfers[_0x9873('0x4')][_0x24721a[_0x9873('0x3')]]){_0x8b8879=_0x24721a[_0x9873('0x3')];_0x24721a['uniqueid']=transfers['blinds'][_0x24721a[_0x9873('0x3')]][_0x9873('0x5')];}if(_0x24721a[_0x9873('0x6')]){utils['getUserByInternal'](_0x24721a[_0x9873('0x6')])[_0x9873('0x7')](function(_0x4b90c7){if(_0x4b90c7){_0x24721a[_0x9873('0x8')]=_0x4b90c7['name'];_0x24721a[_0x9873('0x9')]=_0x4b90c7['id'];}utils[_0x9873('0xa')](_0x9873('0xb'),_0x24721a);});}else{utils[_0x9873('0xa')](_0x9873('0xb'),_0x24721a);}if(_0x8b8879)delete transfers[_0x9873('0x4')][_0x8b8879];}exports[_0x9873('0xc')]=function(_0x3fe273){try{utils[_0x9873('0xd')](util['format'](_0x9873('0xe'),_0x3fe273[_0x9873('0x3')]),_0x3fe273);if(_0x3fe273['uniqueid']==_0x3fe273[_0x9873('0xf')]){utils[_0x9873('0x2')](util['format'](_0x9873('0x10'),_0x3fe273[_0x9873('0x3')],_0x3fe273['context'],_0x3fe273['exten']));recordings[_0x3fe273[_0x9873('0x3')]]={'uniqueid':_0x3fe273[_0x9873('0x3')],'accountcode':_0x3fe273[_0x9873('0x6')],'exten':_0x3fe273[_0x9873('0x11')],'context':_0x3fe273[_0x9873('0x12')],'channel':_0x3fe273[_0x9873('0x13')],'monitors':[]};}}catch(_0x42dcaa){utils[_0x9873('0x14')](util[_0x9873('0x15')](_0x9873('0xe'),_0x3fe273[_0x9873('0x3')]),_0x42dcaa);}};exports[_0x9873('0x16')]=function(_0x3dc614){try{utils[_0x9873('0xd')](util[_0x9873('0x15')](_0x9873('0x17'),_0x3dc614[_0x9873('0x3')]),_0x3dc614);if(!_['isNil'](recordings[_0x3dc614[_0x9873('0x3')]])&&_0x3dc614[_0x9873('0x18')]==0x6){utils[_0x9873('0x2')](util[_0x9873('0x15')](_0x9873('0x19'),_0x3dc614[_0x9873('0x3')],_0x3dc614[_0x9873('0x12')],_0x3dc614[_0x9873('0x13')]));}else if(!_[_0x9873('0x1a')](recordings[_0x3dc614[_0x9873('0xf')]])&&_0x3dc614['channelstate']==0x6&&_0x3dc614[_0x9873('0x12')]!=_0x9873('0x1b')){utils[_0x9873('0x2')](util[_0x9873('0x15')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3dc614[_0x9873('0x3')],_0x3dc614[_0x9873('0xf')],_0x3dc614[_0x9873('0x12')],_0x3dc614['channel']));recordings[_0x3dc614[_0x9873('0xf')]][_0x9873('0x6')]=_0x3dc614['accountcode'];}}catch(_0x2b176d){utils[_0x9873('0x14')](util['format'](_0x9873('0x17'),_0x3dc614['uniqueid']),_0x2b176d);}};exports['varset']=function(_0x22e2f3){try{if(!_['isNil'](_0x22e2f3[_0x9873('0x1c')])&&!_[_0x9873('0x1a')](_0x22e2f3['variable']['mixmonitor_filename'])){utils['debug'](util[_0x9873('0x15')](_0x9873('0x1d'),_0x22e2f3[_0x9873('0x3')]),_0x22e2f3);utils[_0x9873('0x2')](util[_0x9873('0x15')](_0x9873('0x1e'),_0x22e2f3['uniqueid'],_0x22e2f3['variable'],_0x22e2f3['value']));if(_['endsWith'](_0x22e2f3[_0x9873('0x1f')],_0x9873('0x20'))){_0x22e2f3[_0x9873('0x1f')]=_0x22e2f3['value']['replace'](_0x9873('0x20'),_0x9873('0x21'));}if(recordings[_0x22e2f3[_0x9873('0xf')]]){var _0x25b369=_[_0x9873('0x22')](recordings[_0x22e2f3[_0x9873('0xf')]][_0x9873('0x23')],{'value':_0x22e2f3[_0x9873('0x1f')]});if(_[_0x9873('0x1a')](_0x25b369)){recordings[_0x22e2f3['linkedid']][_0x9873('0x23')][_0x9873('0x24')]({'value':_0x22e2f3[_0x9873('0x1f')]});}}}}catch(_0x3f597e){utils[_0x9873('0x14')](util[_0x9873('0x15')](_0x9873('0x1d'),_0x22e2f3[_0x9873('0x3')]),_0x3f597e);}};exports[_0x9873('0x25')]=function(_0x10d65c){try{if(!_[_0x9873('0x1a')](recordings[_0x10d65c[_0x9873('0x3')]])){utils[_0x9873('0xd')](util[_0x9873('0x15')](_0x9873('0x26'),_0x10d65c[_0x9873('0x3')]),_0x10d65c);utils[_0x9873('0x2')](util['format'](_0x9873('0x27'),_0x10d65c['uniqueid'],_0x10d65c[_0x9873('0x28')],_0x10d65c[_0x9873('0x29')],_0x10d65c[_0x9873('0x2a')]));recordings[_0x10d65c['uniqueid']][_0x9873('0x28')]=_0x10d65c[_0x9873('0x28')];recordings[_0x10d65c[_0x9873('0x3')]][_0x9873('0x29')]=_0x10d65c[_0x9873('0x29')];recordings[_0x10d65c[_0x9873('0x3')]][_0x9873('0x2b')]=_0x10d65c[_0x9873('0x2b')];recordings[_0x10d65c['uniqueid']][_0x9873('0x2c')]=_0x10d65c[_0x9873('0x2c')];if(recordings[_0x10d65c[_0x9873('0x3')]][_0x9873('0x2d')]=='outbound'&&recordings[_0x10d65c[_0x9873('0x3')]]['accountcode']){recordings[_0x10d65c['uniqueid']][_0x9873('0x2b')]=recordings[_0x10d65c[_0x9873('0x3')]][_0x9873('0x6')];recordings[_0x10d65c[_0x9873('0x3')]][_0x9873('0x2c')]='';}recordings[_0x10d65c[_0x9873('0x3')]]['monitors'][_0x9873('0x2e')](function(_0x1e31ac){var _0x37a445=_['clone'](recordings[_0x10d65c[_0x9873('0x3')]]);_0x37a445[_0x9873('0x1f')]=_0x1e31ac['value'];writeDB(_0x37a445);});delete recordings[_0x10d65c[_0x9873('0x3')]];}}catch(_0x46ba1f){utils[_0x9873('0x14')](util['format'](_0x9873('0x26'),_0x10d65c['uniqueid']),_0x46ba1f);}};exports[_0x9873('0x2f')]=function(_0x45856b){try{if(!_[_0x9873('0x1a')](recordings[_0x45856b[_0x9873('0x3')]])){utils['debug'](util[_0x9873('0x15')](_0x9873('0x30'),_0x45856b[_0x9873('0x3')]),_0x45856b);utils['info'](util[_0x9873('0x15')](_0x9873('0x31'),_0x45856b[_0x9873('0x3')],_0x45856b[_0x9873('0x32')],_0x45856b[_0x9873('0x33')]));if(_0x45856b[_0x9873('0x32')][_0x9873('0x34')]()==_0x9873('0x35')&&_[_0x9873('0x36')](_0x45856b['appdata']['toLowerCase'](),'cdr')){var _0x55075d=_0x45856b['appdata'][_0x9873('0x37')]('=');var _0xfc3cff=_0x55075d[0x0]['substring'](_0x55075d[0x0][_0x9873('0x38')]('(')+0x1,_0x55075d[0x0][_0x9873('0x38')](')'));var _0x30c3fa=_0x55075d[0x1];recordings[_0x45856b['uniqueid']][_0xfc3cff]=_0x30c3fa;}}}catch(_0x3740c4){utils[_0x9873('0x14')](util['format'](_0x9873('0x30'),_0x45856b[_0x9873('0x3')]),_0x3740c4);}};exports['queuecallerjoin']=function(_0x43997e){try{if(!_[_0x9873('0x1a')](recordings[_0x43997e[_0x9873('0x3')]])){utils[_0x9873('0xd')](util[_0x9873('0x15')]('[%s][recordings][queuecallerjoin]',_0x43997e[_0x9873('0x3')]),_0x43997e);utils[_0x9873('0x2')](util['format'](_0x9873('0x39'),_0x43997e[_0x9873('0x3')],_0x43997e[_0x9873('0x3a')]));recordings[_0x43997e['uniqueid']][_0x9873('0x3a')]=_0x43997e[_0x9873('0x3a')];}}catch(_0x2318d0){utils[_0x9873('0x14')](util['format']('[%s][recordings][queuecallerjoin]',_0x43997e[_0x9873('0x3')]),_0x2318d0);}};exports[_0x9873('0x3b')]=function(_0x276e93){try{utils[_0x9873('0xd')](util[_0x9873('0x15')](_0x9873('0x3c'),_0x276e93[_0x9873('0x3')]),_0x276e93);utils['info'](util[_0x9873('0x15')](_0x9873('0x3d'),_0x276e93['uniqueid'],_0x276e93[_0x9873('0x3e')],_0x276e93[_0x9873('0x3f')],_0x276e93['transfereecalleridnum'],_0x276e93['transfereecalleridname']));if(recordings[_0x276e93[_0x9873('0x40')]]&&transfers[_0x9873('0x4')][_0x276e93[_0x9873('0x40')]]){transfers[_0x9873('0x4')][_0x276e93[_0x9873('0x40')]]['recording']=!![];}}catch(_0xe1cc5e){utils[_0x9873('0x14')](util[_0x9873('0x15')](_0x9873('0x3c'),_0x276e93[_0x9873('0x3')]),_0xe1cc5e);}}; \ No newline at end of file +var _0x26cc=['substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transfereecalleridnum','transfereecalleridname','transfereruniqueid','util','./utils','./transfers.controller','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith'];(function(_0x18bb27,_0x3a7d73){var _0x7ad241=function(_0x295507){while(--_0x295507){_0x18bb27['push'](_0x18bb27['shift']());}};_0x7ad241(++_0x3a7d73);}(_0x26cc,0x1b4));var _0xc26c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x26cc[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require(_0xc26c('0x0'));var utils=require(_0xc26c('0x1'));var transfers=require(_0xc26c('0x2'));var recordings={};function writeDB(_0x1b200a){var _0x1fe325;utils['info'](util[_0xc26c('0x3')](_0xc26c('0x4'),_0x1b200a[_0xc26c('0x5')]));if(transfers[_0xc26c('0x6')][_0x1b200a[_0xc26c('0x5')]]){_0x1fe325=_0x1b200a[_0xc26c('0x5')];_0x1b200a[_0xc26c('0x5')]=transfers['blinds'][_0x1b200a[_0xc26c('0x5')]][_0xc26c('0x7')];}if(_0x1b200a[_0xc26c('0x8')]){utils[_0xc26c('0x9')](_0x1b200a[_0xc26c('0x8')])[_0xc26c('0xa')](function(_0x26cdfa){if(_0x26cdfa){_0x1b200a[_0xc26c('0xb')]=_0x26cdfa[_0xc26c('0xc')];_0x1b200a[_0xc26c('0xd')]=_0x26cdfa['id'];}utils['request'](_0xc26c('0xe'),_0x1b200a);});}else{utils['request'](_0xc26c('0xe'),_0x1b200a);}if(_0x1fe325)delete transfers[_0xc26c('0x6')][_0x1fe325];}exports[_0xc26c('0xf')]=function(_0x445230){try{utils[_0xc26c('0x10')](util['format'](_0xc26c('0x11'),_0x445230['uniqueid']),_0x445230);if(_0x445230[_0xc26c('0x5')]==_0x445230[_0xc26c('0x12')]){utils[_0xc26c('0x13')](util[_0xc26c('0x3')](_0xc26c('0x14'),_0x445230[_0xc26c('0x5')],_0x445230[_0xc26c('0x15')],_0x445230['exten']));recordings[_0x445230[_0xc26c('0x5')]]={'uniqueid':_0x445230[_0xc26c('0x5')],'accountcode':_0x445230[_0xc26c('0x8')],'exten':_0x445230[_0xc26c('0x16')],'context':_0x445230['context'],'channel':_0x445230[_0xc26c('0x17')],'monitors':[]};}}catch(_0x40c7a6){utils[_0xc26c('0x18')](util[_0xc26c('0x3')](_0xc26c('0x11'),_0x445230[_0xc26c('0x5')]),_0x40c7a6);}};exports[_0xc26c('0x19')]=function(_0x52584b){try{utils[_0xc26c('0x10')](util[_0xc26c('0x3')](_0xc26c('0x1a'),_0x52584b[_0xc26c('0x5')]),_0x52584b);if(!_[_0xc26c('0x1b')](recordings[_0x52584b[_0xc26c('0x5')]])&&_0x52584b[_0xc26c('0x1c')]==0x6){utils[_0xc26c('0x13')](util[_0xc26c('0x3')](_0xc26c('0x1d'),_0x52584b[_0xc26c('0x5')],_0x52584b[_0xc26c('0x15')],_0x52584b[_0xc26c('0x17')]));}else if(!_['isNil'](recordings[_0x52584b[_0xc26c('0x12')]])&&_0x52584b[_0xc26c('0x1c')]==0x6&&_0x52584b[_0xc26c('0x15')]!='transfer'){utils['info'](util[_0xc26c('0x3')](_0xc26c('0x1e'),_0x52584b[_0xc26c('0x5')],_0x52584b[_0xc26c('0x12')],_0x52584b[_0xc26c('0x15')],_0x52584b['channel']));recordings[_0x52584b[_0xc26c('0x12')]]['accountcode']=_0x52584b[_0xc26c('0x8')];}}catch(_0x496048){utils[_0xc26c('0x18')](util[_0xc26c('0x3')](_0xc26c('0x1a'),_0x52584b['uniqueid']),_0x496048);}};exports[_0xc26c('0x1f')]=function(_0x43b10d){try{if(!_[_0xc26c('0x1b')](_0x43b10d['variable'])&&!_['isNil'](_0x43b10d[_0xc26c('0x20')][_0xc26c('0x21')])){utils[_0xc26c('0x10')](util['format'](_0xc26c('0x22'),_0x43b10d[_0xc26c('0x5')]),_0x43b10d);utils['info'](util[_0xc26c('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x43b10d[_0xc26c('0x5')],_0x43b10d['variable'],_0x43b10d[_0xc26c('0x23')]));if(_[_0xc26c('0x24')](_0x43b10d[_0xc26c('0x23')],_0xc26c('0x25'))){_0x43b10d[_0xc26c('0x23')]=_0x43b10d[_0xc26c('0x23')][_0xc26c('0x26')]('.wav49',_0xc26c('0x27'));}if(recordings[_0x43b10d[_0xc26c('0x12')]]){var _0x4e79d2=_[_0xc26c('0x28')](recordings[_0x43b10d[_0xc26c('0x12')]][_0xc26c('0x29')],{'value':_0x43b10d['value']});if(_[_0xc26c('0x1b')](_0x4e79d2)){recordings[_0x43b10d['linkedid']]['monitors'][_0xc26c('0x2a')]({'value':_0x43b10d[_0xc26c('0x23')]});}}}}catch(_0xd88356){utils[_0xc26c('0x18')](util[_0xc26c('0x3')](_0xc26c('0x22'),_0x43b10d['uniqueid']),_0xd88356);}};exports[_0xc26c('0x2b')]=function(_0x48ff8b){try{if(!_['isNil'](recordings[_0x48ff8b[_0xc26c('0x5')]])){utils['debug'](util['format'](_0xc26c('0x2c'),_0x48ff8b['uniqueid']),_0x48ff8b);utils[_0xc26c('0x13')](util['format'](_0xc26c('0x2d'),_0x48ff8b[_0xc26c('0x5')],_0x48ff8b[_0xc26c('0x2e')],_0x48ff8b[_0xc26c('0x2f')],_0x48ff8b[_0xc26c('0x30')]));recordings[_0x48ff8b['uniqueid']][_0xc26c('0x2e')]=_0x48ff8b[_0xc26c('0x2e')];recordings[_0x48ff8b[_0xc26c('0x5')]][_0xc26c('0x2f')]=_0x48ff8b[_0xc26c('0x2f')];recordings[_0x48ff8b[_0xc26c('0x5')]][_0xc26c('0x31')]=_0x48ff8b[_0xc26c('0x31')];recordings[_0x48ff8b['uniqueid']][_0xc26c('0x32')]=_0x48ff8b[_0xc26c('0x32')];if(recordings[_0x48ff8b[_0xc26c('0x5')]]['type']==_0xc26c('0x33')&&recordings[_0x48ff8b[_0xc26c('0x5')]][_0xc26c('0x8')]){recordings[_0x48ff8b['uniqueid']][_0xc26c('0x31')]=recordings[_0x48ff8b['uniqueid']][_0xc26c('0x8')];recordings[_0x48ff8b[_0xc26c('0x5')]]['connectedlinename']='';}recordings[_0x48ff8b[_0xc26c('0x5')]][_0xc26c('0x29')][_0xc26c('0x34')](function(_0x223d0e){var _0x432958=_[_0xc26c('0x35')](recordings[_0x48ff8b[_0xc26c('0x5')]]);_0x432958['value']=_0x223d0e['value'];writeDB(_0x432958);});delete recordings[_0x48ff8b[_0xc26c('0x5')]];}}catch(_0x367bab){utils[_0xc26c('0x18')](util[_0xc26c('0x3')]('[%s][recordings][hangup]',_0x48ff8b[_0xc26c('0x5')]),_0x367bab);}};exports[_0xc26c('0x36')]=function(_0x2349ae){try{if(!_[_0xc26c('0x1b')](recordings[_0x2349ae[_0xc26c('0x5')]])){utils[_0xc26c('0x10')](util[_0xc26c('0x3')](_0xc26c('0x37'),_0x2349ae['uniqueid']),_0x2349ae);utils[_0xc26c('0x13')](util[_0xc26c('0x3')](_0xc26c('0x38'),_0x2349ae[_0xc26c('0x5')],_0x2349ae[_0xc26c('0x39')],_0x2349ae[_0xc26c('0x3a')]));if(_0x2349ae[_0xc26c('0x39')][_0xc26c('0x3b')]()=='set'&&_[_0xc26c('0x3c')](_0x2349ae[_0xc26c('0x3a')][_0xc26c('0x3b')](),'cdr')){var _0x5b36ca=_0x2349ae[_0xc26c('0x3a')]['split']('=');var _0x4f0345=_0x5b36ca[0x0][_0xc26c('0x3d')](_0x5b36ca[0x0][_0xc26c('0x3e')]('(')+0x1,_0x5b36ca[0x0][_0xc26c('0x3e')](')'));var _0x2be711=_0x5b36ca[0x1];recordings[_0x2349ae[_0xc26c('0x5')]][_0x4f0345]=_0x2be711;}}}catch(_0x40c799){utils['error'](util[_0xc26c('0x3')](_0xc26c('0x37'),_0x2349ae[_0xc26c('0x5')]),_0x40c799);}};exports['queuecallerjoin']=function(_0x809a1e){try{if(!_[_0xc26c('0x1b')](recordings[_0x809a1e[_0xc26c('0x5')]])){utils[_0xc26c('0x10')](util['format'](_0xc26c('0x3f'),_0x809a1e[_0xc26c('0x5')]),_0x809a1e);utils[_0xc26c('0x13')](util[_0xc26c('0x3')](_0xc26c('0x40'),_0x809a1e[_0xc26c('0x5')],_0x809a1e[_0xc26c('0x41')]));recordings[_0x809a1e[_0xc26c('0x5')]][_0xc26c('0x41')]=_0x809a1e[_0xc26c('0x41')];}}catch(_0x1ad6b4){utils[_0xc26c('0x18')](util[_0xc26c('0x3')](_0xc26c('0x3f'),_0x809a1e[_0xc26c('0x5')]),_0x1ad6b4);}};exports[_0xc26c('0x42')]=function(_0x4ddde4){try{utils[_0xc26c('0x10')](util[_0xc26c('0x3')](_0xc26c('0x43'),_0x4ddde4[_0xc26c('0x5')]),_0x4ddde4);utils['info'](util['format']('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4ddde4[_0xc26c('0x5')],_0x4ddde4['transferercalleridnum'],_0x4ddde4['transferercalleridname'],_0x4ddde4[_0xc26c('0x44')],_0x4ddde4[_0xc26c('0x45')]));if(recordings[_0x4ddde4[_0xc26c('0x46')]]&&transfers[_0xc26c('0x6')][_0x4ddde4[_0xc26c('0x46')]]){transfers[_0xc26c('0x6')][_0x4ddde4['transfereruniqueid']]['recording']=!![];}}catch(_0x28b1d8){utils[_0xc26c('0x18')](util[_0xc26c('0x3')]('[%s][recordings][blindtransfer]',_0x4ddde4[_0xc26c('0x5')]),_0x28b1d8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3ff00e6..b55932b 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 _0xdf54=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','error','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','uniqueid','type','request','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x1e8e66,_0x46db77){var _0x4d9633=function(_0x567f40){while(--_0x567f40){_0x1e8e66['push'](_0x1e8e66['shift']());}};_0x4d9633(++_0x46db77);}(_0xdf54,0x15b));var _0x4df5=function(_0x1b071f,_0x2e5773){_0x1b071f=_0x1b071f-0x0;var _0x112192=_0xdf54[_0x1b071f];return _0x112192;};'use strict';var _=require(_0x4df5('0x0'));var util=require(_0x4df5('0x1'));var utils=require(_0x4df5('0x2'));function writeDB(_0x34ae65){utils[_0x4df5('0x3')](util[_0x4df5('0x4')](_0x4df5('0x5'),_0x34ae65['type']==='attended'?_0x34ae65['origtransfereruniqueid']:_0x34ae65[_0x4df5('0x6')],_0x34ae65[_0x4df5('0x7')]));utils[_0x4df5('0x8')]('CreateVoiceTransferReport',_0x34ae65);}exports[_0x4df5('0x9')]={};exports[_0x4df5('0xa')]=function(_0x2d6231){try{utils[_0x4df5('0xb')](util[_0x4df5('0x4')]('[%s][transfers][blindtransfer]',_0x2d6231[_0x4df5('0x6')]),_0x2d6231);utils['info'](util[_0x4df5('0x4')](_0x4df5('0xc'),_0x2d6231[_0x4df5('0x6')],_0x2d6231[_0x4df5('0xd')],_0x2d6231[_0x4df5('0xe')],_0x2d6231[_0x4df5('0xf')],_0x2d6231[_0x4df5('0x10')]));_0x2d6231[_0x4df5('0x7')]='blind';exports['blinds'][_0x2d6231[_0x4df5('0x11')]]=_0x2d6231;writeDB(_0x2d6231);}catch(_0x1b9dd3){utils['error'](util[_0x4df5('0x4')](_0x4df5('0x12'),_0x2d6231[_0x4df5('0x6')]),_0x1b9dd3);}};exports[_0x4df5('0x13')]=function(_0x84edda){try{utils['debug'](util[_0x4df5('0x4')](_0x4df5('0x14'),_0x84edda['origtransfereruniqueid']),_0x84edda);utils[_0x4df5('0x3')](util[_0x4df5('0x4')](_0x4df5('0x15'),_0x84edda[_0x4df5('0x16')],_0x84edda[_0x4df5('0x17')],_0x84edda['origtransferercalleridname'],_0x84edda[_0x4df5('0x18')],_0x84edda[_0x4df5('0x19')]));_0x84edda=_['assign'](_0x84edda,{'transfererchannel':_0x84edda[_0x4df5('0x1a')],'transferercalleridnum':_0x84edda[_0x4df5('0x17')],'transferercalleridname':_0x84edda[_0x4df5('0x1b')],'transfererconnectedlinenum':_0x84edda[_0x4df5('0x1c')],'transfererconnectedlinename':_0x84edda[_0x4df5('0x1d')],'transfereraccountcode':_0x84edda[_0x4df5('0x1e')],'transferercontext':_0x84edda[_0x4df5('0x1f')],'transfererexten':_0x84edda[_0x4df5('0x20')],'transfererlinkedid':_0x84edda[_0x4df5('0x21')],'context':_0x84edda[_0x4df5('0x22')],'extension':_0x84edda[_0x4df5('0x23')],'type':_0x4df5('0x24')});if(_[_0x4df5('0x25')](_0x84edda['transfereechannel'])){_0x84edda=_[_0x4df5('0x26')](_0x84edda,{'transfereechannel':_0x84edda[_0x4df5('0x27')],'transfereecalleridnum':_0x84edda[_0x4df5('0x18')],'transfereecalleridname':_0x84edda[_0x4df5('0x19')],'transfereeconnectedlinenum':_0x84edda[_0x4df5('0x28')],'transfereeconnectedlinename':_0x84edda[_0x4df5('0x29')],'transfereeaccountcode':_0x84edda[_0x4df5('0x2a')],'transfereecontext':_0x84edda['transfertargetcontext'],'transfereeexten':_0x84edda[_0x4df5('0x2b')],'transfereelinkedid':_0x84edda['transfertargetlinkedid']});}writeDB(_0x84edda);}catch(_0x3c72a8){utils[_0x4df5('0x2c')](util[_0x4df5('0x4')](_0x4df5('0x14'),_0x84edda[_0x4df5('0x16')]),_0x3c72a8);}}; \ No newline at end of file +var _0x2ab4=['transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','uniqueid','type','request','blinds','format','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten'];(function(_0x27ed41,_0xb780a1){var _0x507934=function(_0x1f09ab){while(--_0x1f09ab){_0x27ed41['push'](_0x27ed41['shift']());}};_0x507934(++_0xb780a1);}(_0x2ab4,0xce));var _0x42ab=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x2ab4[_0x344a3f];return _0x264712;};'use strict';var _=require(_0x42ab('0x0'));var util=require(_0x42ab('0x1'));var utils=require(_0x42ab('0x2'));function writeDB(_0x1340d6){utils[_0x42ab('0x3')](util['format'](_0x42ab('0x4'),_0x1340d6['type']===_0x42ab('0x5')?_0x1340d6[_0x42ab('0x6')]:_0x1340d6[_0x42ab('0x7')],_0x1340d6[_0x42ab('0x8')]));utils[_0x42ab('0x9')]('CreateVoiceTransferReport',_0x1340d6);}exports[_0x42ab('0xa')]={};exports['blindtransfer']=function(_0x3a50c7){try{utils['debug'](util[_0x42ab('0xb')]('[%s][transfers][blindtransfer]',_0x3a50c7['uniqueid']),_0x3a50c7);utils[_0x42ab('0x3')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3a50c7[_0x42ab('0x7')],_0x3a50c7['transferercalleridnum'],_0x3a50c7['transferercalleridname'],_0x3a50c7[_0x42ab('0xc')],_0x3a50c7[_0x42ab('0xd')]));_0x3a50c7['type']=_0x42ab('0xe');exports[_0x42ab('0xa')][_0x3a50c7[_0x42ab('0xf')]]=_0x3a50c7;writeDB(_0x3a50c7);}catch(_0x5064c3){utils[_0x42ab('0x10')](util[_0x42ab('0xb')](_0x42ab('0x11'),_0x3a50c7['uniqueid']),_0x5064c3);}};exports[_0x42ab('0x12')]=function(_0x4d02e5){try{utils[_0x42ab('0x13')](util[_0x42ab('0xb')](_0x42ab('0x14'),_0x4d02e5[_0x42ab('0x6')]),_0x4d02e5);utils['info'](util['format'](_0x42ab('0x15'),_0x4d02e5[_0x42ab('0x6')],_0x4d02e5['origtransferercalleridnum'],_0x4d02e5[_0x42ab('0x16')],_0x4d02e5[_0x42ab('0x17')],_0x4d02e5[_0x42ab('0x18')]));_0x4d02e5=_[_0x42ab('0x19')](_0x4d02e5,{'transfererchannel':_0x4d02e5['origtransfererchannel'],'transferercalleridnum':_0x4d02e5[_0x42ab('0x1a')],'transferercalleridname':_0x4d02e5['origtransferercalleridname'],'transfererconnectedlinenum':_0x4d02e5[_0x42ab('0x1b')],'transfererconnectedlinename':_0x4d02e5[_0x42ab('0x1c')],'transfereraccountcode':_0x4d02e5[_0x42ab('0x1d')],'transferercontext':_0x4d02e5[_0x42ab('0x1e')],'transfererexten':_0x4d02e5[_0x42ab('0x1f')],'transfererlinkedid':_0x4d02e5['origtransfererlinkedid'],'context':_0x4d02e5[_0x42ab('0x20')],'extension':_0x4d02e5[_0x42ab('0x21')],'type':'attended'});if(_['isNil'](_0x4d02e5[_0x42ab('0x22')])){_0x4d02e5=_[_0x42ab('0x19')](_0x4d02e5,{'transfereechannel':_0x4d02e5[_0x42ab('0x23')],'transfereecalleridnum':_0x4d02e5[_0x42ab('0x17')],'transfereecalleridname':_0x4d02e5[_0x42ab('0x18')],'transfereeconnectedlinenum':_0x4d02e5['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d02e5[_0x42ab('0x24')],'transfereeaccountcode':_0x4d02e5[_0x42ab('0x25')],'transfereecontext':_0x4d02e5[_0x42ab('0x26')],'transfereeexten':_0x4d02e5[_0x42ab('0x27')],'transfereelinkedid':_0x4d02e5['transfertargetlinkedid']});}writeDB(_0x4d02e5);}catch(_0x46e68c){utils[_0x42ab('0x10')](util['format'](_0x42ab('0x14'),_0x4d02e5[_0x42ab('0x6')]),_0x46e68c);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 47102b6..77471fa 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 _0xe891=['getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','util','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','found','notfound','catch','[utils][getUserByInternal]'];(function(_0x29986c,_0x3fc03c){var _0x475f7f=function(_0x391a2c){while(--_0x391a2c){_0x29986c['push'](_0x29986c['shift']());}};_0x475f7f(++_0x3fc03c);}(_0xe891,0xcf));var _0x1e89=function(_0x1feded,_0x5d74da){_0x1feded=_0x1feded-0x0;var _0x2a05ea=_0xe891[_0x1feded];return _0x2a05ea;};'use strict';var BPromise=require(_0x1e89('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x1e89('0x1'));var client=jayson[_0x1e89('0x2')][_0x1e89('0x3')]({'port':0x2329});var logger=require(_0x1e89('0x4'))(_0x1e89('0x5'));exports['info']=function(_0x3042a2,_0x1408e2){logger[_0x1e89('0x6')](_0x3042a2,_0x1408e2?util['inspect'](_0x1408e2,{'showHidden':![],'depth':null}):'');};exports[_0x1e89('0x7')]=function(_0x33447c,_0x3f7a0b){logger[_0x1e89('0x7')](_0x33447c,_0x3f7a0b?util[_0x1e89('0x8')](_0x3f7a0b,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xaa3ffd,_0x1081e8){logger[_0x1e89('0x9')](_0xaa3ffd,_0x1081e8?util['inspect'](_0x1081e8,{'showHidden':![],'depth':null}):'');};exports[_0x1e89('0xa')]=function(_0x48e600,_0x5e64cb){return client[_0x1e89('0xa')](_0x48e600,{'body':_0x5e64cb})[_0x1e89('0xb')](function(_0x2e4d64){logger['debug'](_0x1e89('0xc'),_0x48e600,_0x2e4d64?util[_0x1e89('0x8')](_0x2e4d64,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4af4a1){logger[_0x1e89('0x9')](_0x1e89('0xc'),_0x48e600,_0x4af4a1?util['inspect'](_0x4af4a1,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5e44e6){return client['request'](_0x1e89('0xd'),{'options':{'raw':!![],'attributes':['id',_0x1e89('0xe'),'name',_0x1e89('0xf')],'where':_0x5e44e6,'limit':0x1}})[_0x1e89('0xb')](function(_0x315d65){logger['debug'](_0x1e89('0x10'),JSON[_0x1e89('0x11')](_0x5e44e6),_0x315d65?util['inspect'](_0x315d65,{'showHidden':![],'depth':null}):'');return _0x315d65[_0x1e89('0x12')]['length']?_0x315d65['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x3f1bf5){return new BPromise(function(_0x5354a4,_0x585b32){if(_0x3f1bf5){return getUser({'internal':_0x3f1bf5})['then'](function(_0x441639){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x3f1bf5,_0x441639?_0x1e89('0x13'):_0x1e89('0x14'));return _0x5354a4(_0x441639);})[_0x1e89('0x15')](function(_0x4b378a){logger[_0x1e89('0x9')](_0x1e89('0x16'),_0x4b378a?util[_0x1e89('0x8')](_0x4b378a,{'showHidden':![],'depth':null}):'');return _0x5354a4(null);});}return _0x5354a4(null);});};exports[_0x1e89('0x17')]=function(_0x1e45c1){return new BPromise(function(_0x19e1b3,_0x46dd25){if(_0x1e45c1){return getUser({'interface':_0x1e45c1})[_0x1e89('0xb')](function(_0x37976d){logger['info'](_0x1e89('0x18'),_0x1e45c1,_0x37976d?_0x1e89('0x13'):'notfound');return _0x19e1b3(_0x37976d);})[_0x1e89('0x15')](function(_0x546707){logger[_0x1e89('0x9')]('[utils][getUserByInterface]',_0x546707?util[_0x1e89('0x8')](_0x546707,{'showHidden':![],'depth':null}):'');return _0x19e1b3(null);});}return _0x19e1b3(null);});};exports['getUserByName']=function(_0x2bff43){return new BPromise(function(_0x11316c,_0x2b7d75){if(_0x2bff43){return getUser({'name':_0x2bff43})['then'](function(_0x3a74f5){logger[_0x1e89('0x6')](_0x1e89('0x19'),_0x2bff43,_0x3a74f5?_0x1e89('0x13'):_0x1e89('0x14'));return _0x11316c(_0x3a74f5);})[_0x1e89('0x15')](function(_0x1a3c47){logger[_0x1e89('0x9')](_0x1e89('0x1a'),_0x1a3c47?util['inspect'](_0x1a3c47,{'showHidden':![],'depth':null}):'');return _0x11316c(null);});}return _0x11316c(null);});};exports[_0x1e89('0x1b')]=function(_0x310455){return new BPromise(function(_0x553886,_0x1fd6c7){if(_0x310455){return client[_0x1e89('0xa')](_0x1e89('0x1c'),{'options':{'raw':!![],'attributes':['id',_0x1e89('0x1d'),_0x1e89('0x1e'),_0x1e89('0x1f'),_0x1e89('0x20')],'where':{'name':_0x310455},'limit':0x1}})[_0x1e89('0xb')](function(_0x37ab99){logger[_0x1e89('0x7')](_0x1e89('0x21'),_0x310455,_0x37ab99?util[_0x1e89('0x8')](_0x37ab99,{'showHidden':![],'depth':null}):'');logger['info'](_0x1e89('0x22'),_0x310455,_0x37ab99?_0x1e89('0x13'):_0x1e89('0x14'));return _0x553886(_0x37ab99[_0x1e89('0x12')]['length']?_0x37ab99[_0x1e89('0x12')][0x0]:null);})[_0x1e89('0x15')](function(_0x19e9b5){logger[_0x1e89('0x9')]('[utils][getVoiceQueueByName]',_0x19e9b5?util['inspect'](_0x19e9b5,{'showHidden':![],'depth':null}):'');return _0x553886(null);});}return _0x553886(null);});};exports['addTime']=function(_0xe14537,_0x1fb14d){return moment(_0xe14537)[_0x1e89('0x23')](_0x1fb14d,_0x1e89('0x24'))[_0x1e89('0x25')](_0x1e89('0x26'));};exports[_0x1e89('0x27')]=function(_0xbe26bf,_0x3c9282){return moment(_0xbe26bf)[_0x1e89('0x28')](_0x3c9282,_0x1e89('0x24'))[_0x1e89('0x25')](_0x1e89('0x26'));};exports['diffTime']=function(_0x4b5c90,_0x152457){return moment(_0x4b5c90)[_0x1e89('0x29')](moment(_0x152457),'seconds');};exports[_0x1e89('0x2a')]=function(_0x317fcd,_0x5d8b70){return parseInt(_0x317fcd,0xa)+parseInt(_0x5d8b70,0xa);};exports[_0x1e89('0x2b')]=function(){return moment()['format'](_0x1e89('0x26'));};exports[_0x1e89('0x2c')]=function(_0x2b3c1e,_0x1675af){if(_0x1675af){return moment(_0x2b3c1e)[_0x1e89('0x2c')](_0x1675af);}return!![];};exports[_0x1e89('0x2d')]=function(_0x33631f,_0xc75449){if(_0xc75449){return moment(_0x33631f)[_0x1e89('0x2d')](_0xc75449);}else if(_0x33631f){return!![];}return![];}; \ No newline at end of file +var _0xbd3c=['stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','diff','isAfter','bluebird','jayson/promise','moment','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','name','then'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0xbd3c,0xc2));var _0xcbd3=function(_0x431770,_0x3e6b50){_0x431770=_0x431770-0x0;var _0x21e5a6=_0xbd3c[_0x431770];return _0x21e5a6;};'use strict';var BPromise=require(_0xcbd3('0x0'));var jayson=require(_0xcbd3('0x1'));var moment=require(_0xcbd3('0x2'));var util=require('util');var client=jayson[_0xcbd3('0x3')][_0xcbd3('0x4')]({'port':0x2329});var logger=require(_0xcbd3('0x5'))('xdr');exports['info']=function(_0x2b7178,_0x5c280d){logger[_0xcbd3('0x6')](_0x2b7178,_0x5c280d?util[_0xcbd3('0x7')](_0x5c280d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x348468,_0x1c1483){logger[_0xcbd3('0x8')](_0x348468,_0x1c1483?util['inspect'](_0x1c1483,{'showHidden':![],'depth':null}):'');};exports[_0xcbd3('0x9')]=function(_0x258d74,_0x39fec0){logger[_0xcbd3('0x9')](_0x258d74,_0x39fec0?util[_0xcbd3('0x7')](_0x39fec0,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4c4e8c,_0x41f67b){return client[_0xcbd3('0xa')](_0x4c4e8c,{'body':_0x41f67b})['then'](function(_0x49961e){logger['debug'](_0xcbd3('0xb'),_0x4c4e8c,_0x49961e?util[_0xcbd3('0x7')](_0x49961e,{'showHidden':![],'depth':null}):'');})[_0xcbd3('0xc')](function(_0x488258){logger[_0xcbd3('0x9')](_0xcbd3('0xb'),_0x4c4e8c,_0x488258?util[_0xcbd3('0x7')](_0x488258,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1dfcfd){return client[_0xcbd3('0xa')](_0xcbd3('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0xcbd3('0xe'),'interface'],'where':_0x1dfcfd,'limit':0x1}})[_0xcbd3('0xf')](function(_0x434ed6){logger[_0xcbd3('0x8')]('[utils][getUser]\x20where:%s',JSON[_0xcbd3('0x10')](_0x1dfcfd),_0x434ed6?util['inspect'](_0x434ed6,{'showHidden':![],'depth':null}):'');return _0x434ed6[_0xcbd3('0x11')]['length']?_0x434ed6[_0xcbd3('0x11')][0x0]:null;});}exports[_0xcbd3('0x12')]=function(_0x202970){return new BPromise(function(_0x115336,_0xb02b09){if(_0x202970){return getUser({'internal':_0x202970})['then'](function(_0x4f0bd7){logger[_0xcbd3('0x6')](_0xcbd3('0x13'),_0x202970,_0x4f0bd7?_0xcbd3('0x14'):'notfound');return _0x115336(_0x4f0bd7);})[_0xcbd3('0xc')](function(_0x51e481){logger[_0xcbd3('0x9')]('[utils][getUserByInternal]',_0x51e481?util[_0xcbd3('0x7')](_0x51e481,{'showHidden':![],'depth':null}):'');return _0x115336(null);});}return _0x115336(null);});};exports['getUserByInterface']=function(_0x27b0a5){return new BPromise(function(_0x4eccf7,_0x5f0bcb){if(_0x27b0a5){return getUser({'interface':_0x27b0a5})[_0xcbd3('0xf')](function(_0x443531){logger[_0xcbd3('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x27b0a5,_0x443531?_0xcbd3('0x14'):_0xcbd3('0x15'));return _0x4eccf7(_0x443531);})[_0xcbd3('0xc')](function(_0x334b34){logger[_0xcbd3('0x9')](_0xcbd3('0x16'),_0x334b34?util[_0xcbd3('0x7')](_0x334b34,{'showHidden':![],'depth':null}):'');return _0x4eccf7(null);});}return _0x4eccf7(null);});};exports[_0xcbd3('0x17')]=function(_0x4f6eec){return new BPromise(function(_0x35fd76,_0x5d9047){if(_0x4f6eec){return getUser({'name':_0x4f6eec})[_0xcbd3('0xf')](function(_0x526a56){logger[_0xcbd3('0x6')](_0xcbd3('0x18'),_0x4f6eec,_0x526a56?'found':_0xcbd3('0x15'));return _0x35fd76(_0x526a56);})['catch'](function(_0x319837){logger[_0xcbd3('0x9')](_0xcbd3('0x19'),_0x319837?util[_0xcbd3('0x7')](_0x319837,{'showHidden':![],'depth':null}):'');return _0x35fd76(null);});}return _0x35fd76(null);});};exports[_0xcbd3('0x1a')]=function(_0x197b00){return new BPromise(function(_0x15349e,_0x4e2a58){if(_0x197b00){return client[_0xcbd3('0xa')](_0xcbd3('0x1b'),{'options':{'raw':!![],'attributes':['id',_0xcbd3('0xe'),_0xcbd3('0x1c'),_0xcbd3('0x1d'),_0xcbd3('0x1e')],'where':{'name':_0x197b00},'limit':0x1}})[_0xcbd3('0xf')](function(_0x15ed47){logger[_0xcbd3('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x197b00,_0x15ed47?util[_0xcbd3('0x7')](_0x15ed47,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x197b00,_0x15ed47?_0xcbd3('0x14'):_0xcbd3('0x15'));return _0x15349e(_0x15ed47[_0xcbd3('0x11')][_0xcbd3('0x1f')]?_0x15ed47[_0xcbd3('0x11')][0x0]:null);})[_0xcbd3('0xc')](function(_0x10215c){logger['error'](_0xcbd3('0x20'),_0x10215c?util['inspect'](_0x10215c,{'showHidden':![],'depth':null}):'');return _0x15349e(null);});}return _0x15349e(null);});};exports[_0xcbd3('0x21')]=function(_0x3a1f86,_0x3c2b0e){return moment(_0x3a1f86)[_0xcbd3('0x22')](_0x3c2b0e,_0xcbd3('0x23'))[_0xcbd3('0x24')](_0xcbd3('0x25'));};exports[_0xcbd3('0x26')]=function(_0xa0a36d,_0x53b1a8){return moment(_0xa0a36d)['subtract'](_0x53b1a8,_0xcbd3('0x23'))['format'](_0xcbd3('0x25'));};exports[_0xcbd3('0x27')]=function(_0x27d6d0,_0x2ea7a2){return moment(_0x27d6d0)[_0xcbd3('0x28')](moment(_0x2ea7a2),_0xcbd3('0x23'));};exports['sumTime']=function(_0x1d7734,_0x2b8f3d){return parseInt(_0x1d7734,0xa)+parseInt(_0x2b8f3d,0xa);};exports['now']=function(){return moment()[_0xcbd3('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xcbd3('0x29')]=function(_0x3b4702,_0x2333c5){if(_0x2333c5){return moment(_0x3b4702)[_0xcbd3('0x29')](_0x2333c5);}return!![];};exports['isBefore']=function(_0x5866c5,_0x222c9a){if(_0x222c9a){return moment(_0x5866c5)['isBefore'](_0x222c9a);}else if(_0x5866c5){return!![];}return![];}; \ No newline at end of file